1 line
1.7 MiB
Plaintext
1 line
1.7 MiB
Plaintext
var t=Object.create,e=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,o=(t,e)=>()=>(e||(t((e={exports:{}}).exports,e),t=null),e.exports),a=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:"Module"}),r},l=(t,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(t,l)||l===o||e(t,l,{get:(t=>i[t]).bind(null,l),enumerable:!(a=n(i,l))||a.enumerable});return t},c=(n,r,o)=>(o=null!=n?t(i(n)):{},l(!r&&n&&n.__esModule&&s.call(n,"default")?o:e(o,"default",{value:n,enumerable:!0}),n)),u=(t=>"undefined"!=typeof require?require:"undefined"!=typeof Proxy?new Proxy(t,{get:(t,e)=>("undefined"!=typeof require?require:t)[e]}):t)(function(t){if("undefined"!=typeof require)return require.apply(this,arguments);throw Error('Calling `require` for "'+t+"\" 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 t=document.createElement("link").relList;if(!(t&&t.supports&&t.supports("modulepreload"))){for(const t of document.querySelectorAll('link[rel="modulepreload"]'))e(t);new MutationObserver(t=>{for(const n of t)if("childList"===n.type)for(const t of n.addedNodes)"LINK"===t.tagName&&"modulepreload"===t.rel&&e(t)}).observe(document,{childList:!0,subtree:!0})}function e(t){if(t.ep)return;t.ep=!0;const e=function(t){const e={};return t.integrity&&(e.integrity=t.integrity),t.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),"use-credentials"===t.crossOrigin?e.credentials="include":"anonymous"===t.crossOrigin?e.credentials="omit":e.credentials="same-origin",e}(t);fetch(t.href,e)}}();var h,d=Object.prototype,p=Symbol("undefined"),f=function(t){return t[t.ADD=0]="ADD",t[t.ONCE=1]="ONCE",t[t.REMOVE=2]="REMOVE",t}(f||{}),g=1,m=class{_descriptors;_mixins;_isInit;_lazyChains;_values;_revisions;source;proto;_parent;_listeners;_listenersVersion=1;_inheritedEnd=-1;_flattenedVersion=0;constructor(t){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=t,this.proto=void 0===t.constructor?void 0:t.constructor.prototype,this._listeners=void 0}get parent(){let t=this._parent;if(void 0===t){let e=y(this.source);this._parent=t=null===e||e===d?null:_(e)}return t}setInitializing(){this._isInit=!0}unsetInitializing(){this._isInit=!1}isInitializing(){return this._isInit}isPrototypeMeta(t){return this.proto===this.source&&this.source===t}_getOrCreateOwnMap(t){return this[t]||(this[t]=Object.create(null))}_getOrCreateOwnSet(t){return this[t]||(this[t]=new Set)}_findInheritedMap(t,e){let n=this;for(;null!==n;){let r=n[t];if(void 0!==r){let t=r.get(e);if(void 0!==t)return t}n=n.parent}}_hasInInheritedSet(t,e){let n=this;for(;null!==n;){let r=n[t];if(void 0!==r&&r.has(e))return!0;n=n.parent}return!1}valueFor(t){let e=this._values;return void 0!==e?e[t]:void 0}setValueFor(t,e){this._getOrCreateOwnMap("_values")[t]=e}revisionFor(t){let e=this._revisions;return void 0!==e?e[t]:void 0}setRevisionFor(t,e){this._getOrCreateOwnMap("_revisions")[t]=e}writableLazyChainsFor(t){let e=this._getOrCreateOwnMap("_lazyChains"),n=e[t];return void 0===n&&(n=e[t]=[]),n}readableLazyChainsFor(t){let e=this._lazyChains;if(void 0!==e)return e[t]}addMixin(t){this._getOrCreateOwnSet("_mixins").add(t)}hasMixin(t){return this._hasInInheritedSet("_mixins",t)}forEachMixins(t){let e,n=this;for(;null!==n;){let r=n._mixins;void 0!==r&&(e=void 0===e?new Set:e,r.forEach(n=>{e.has(n)||(e.add(n),t(n))})),n=n.parent}}writeDescriptors(t,e){(this._descriptors||(this._descriptors=new Map)).set(t,e)}peekDescriptors(t){let e=this._findInheritedMap("_descriptors",t);return e===p?void 0:e}removeDescriptors(t){this.writeDescriptors(t,p)}forEachDescriptors(t){let e,n=this;for(;null!==n;){let r=n._descriptors;void 0!==r&&(e=void 0===e?new Set:e,r.forEach((n,r)=>{e.has(r)||(e.add(r),n!==p&&t(r,n))})),n=n.parent}}addToListeners(t,e,n,r,i){this.pushListener(t,e,n,r?f.ONCE:f.ADD,i)}removeFromListeners(t,e,n){this.pushListener(t,e,n,f.REMOVE)}pushListener(t,e,n,r,i=!1){let s=this.writableListeners(),o=x(s,t,e,n);if(-1!==o&&o<this._inheritedEnd&&(s.splice(o,1),this._inheritedEnd--,o=-1),-1===o)s.push({event:t,target:e,method:n,kind:r,sync:i});else{let t=s[o];r===f.REMOVE&&t.kind!==f.REMOVE?s.splice(o,1):(t.kind=r,t.sync=i)}}writableListeners(){return this._flattenedVersion!==g||this.source!==this.proto&&-1!==this._inheritedEnd||g++,-1===this._inheritedEnd&&(this._inheritedEnd=0,this._listeners=[]),this._listeners}flattenedListeners(){if(this._flattenedVersion<g){let t=this.parent;if(null!==t){let e=t.flattenedListeners();if(void 0!==e)if(void 0===this._listeners)this._listeners=e;else{let t=this._listeners;this._inheritedEnd>0&&(t.splice(0,this._inheritedEnd),this._inheritedEnd=0);for(let n of e)-1===x(t,n.event,n.target,n.method)&&(t.unshift(n),this._inheritedEnd++)}}this._flattenedVersion=g}return this._listeners}matchingListeners(t){let e,n=this.flattenedListeners();if(void 0!==n)for(let r of n)r.event!==t||r.kind!==f.ADD&&r.kind!==f.ONCE||(void 0===e&&(e=[]),e.push(r.target,r.method,r.kind===f.ONCE));return e}observerEvents(){let t,e=this.flattenedListeners();if(void 0!==e)for(let n of e)n.kind!==f.ADD&&n.kind!==f.ONCE||-1===n.event.indexOf(":change")||(void 0===t&&(t=[]),t.push(n));return t}},y=Object.getPrototypeOf,v=new WeakMap;function b(t,e){v.set(t,e)}function w(t){let e=v.get(t);if(void 0!==e)return e;let n=y(t);for(;null!==n;){if(e=v.get(n),void 0!==e)return e.proto!==n&&(e.proto=n),e;n=y(n)}return null}var _=function(t){let e=w(t);if(null!==e&&e.source===t)return e;let n=new m(t);return b(t,n),n};function x(t,e,n,r){for(let i=t.length-1;i>=0;i--){let s=t[i];if(s.event===e&&s.target===n&&s.method===r)return i}return-1}function C(t){let[e,n,r]=t;return 3===t.length&&("function"==typeof e||"object"==typeof e&&null!==e)&&"string"==typeof n&&("object"==typeof r&&null!==r||void 0===r)}function S(t){let e=function(){return t};return O(e),e}var k=class{enumerable=!0;configurable=!0;_dependentKeys=void 0;_meta=void 0;setup(t,e,n,r){r.writeDescriptors(e,this)}teardown(t,e,n){n.removeDescriptors(e)}};function E(t,e){return function(){return e.get(this,t)}}function R(t,e){let n=function(n){return e.set(this,t,n)};return T.add(n),n}var T=new WeakSet;function L(t,e){let n=function(e,n,r,i){let s=3===arguments.length?_(e):i;return t.setup(e,n,r,s),{enumerable:t.enumerable,configurable:t.configurable,get:E(n,t),set:R(n,t)}};return O(n,t),Object.setPrototypeOf(n,e.prototype),n}var I=new WeakMap;function P(t,e,n){let r=void 0===n?w(t):n;if(null!==r)return r.peekDescriptors(e)}function M(t){return I.get(t)}function A(t){return"function"==typeof t&&I.has(t)}function O(t,e=!0){I.set(t,e)}var N={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:{}},F=globalThis.EmberENV;if("object"==typeof F&&null!==F){for(let e in F){if(!Object.prototype.hasOwnProperty.call(F,e)||"EXTEND_PROTOTYPES"===e||"EMBER_LOAD_HOOKS"===e)continue;let t=N[e];N[e]=!0===t?!1!==F[e]:!1===t?!0===F[e]:F[e]}let{FEATURES:t}=F;if("object"==typeof t&&null!==t)for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(N.FEATURES[e]=!0===t[e])}function z(){return N}var D,j,U,B,$,q,V,W,H=()=>{},G=new WeakMap,Z=Symbol("BrandedArray");function K(t){return Array.isArray(t)&&Z in t}function Y(t,e){if(null===t)return e;if(K(t))return t.push(e),t;{const n=[t,e];return n[Z]=!0,n}}function X(t,e){K(t)?t.forEach(e):null!==t&&e(t)}function J(t,e){if(K(t)&&t.length>1){let n=t.indexOf(e),r=t.length-1;return n!==r&&(t[n]=t[r]),t.length=r,t}return null}function Q(t){let e=G.get(t);return void 0===e&&(e={parents:null,children:null,eagerDestructors:null,destructors:null,state:0},G.set(t,e)),e}function tt(t,e){let n=Q(t),r=Q(e);return n.children=Y(n.children,e),r.parents=Y(r.parents,t),e}function et(t,e,n=!1){let r=Q(t),i=n?"eagerDestructors":"destructors";return r[i]=Y(r[i],e),e}function nt(t){let e=Q(t);if(e.state>=1)return;let{parents:n,children:r,eagerDestructors:i,destructors:s}=e;e.state=1,X(r,nt),X(i,e=>{e(t)}),X(s,e=>{D(t,e)}),j(()=>{X(n,e=>{!function(t,e){let n=Q(e);2!==n.state&&(n.children=J(n.children,t))}(t,e)}),e.state=2})}function rt(t){let e=G.get(t);return void 0!==e&&null!==e.children}function it(t){let e=G.get(t);return void 0!==e&&e.state>=1}function st(t){let e=G.get(t);return void 0!==e&&e.state>=2}var ot=1;function at(){ot++}var lt=Symbol("TAG_COMPUTE");function ct(t){return t[lt]()}function ut(t,e){return e>=t[lt]()}var ht=Symbol("TAG_TYPE"),dt=class t{static combine(e){switch(e.length){case 0:return yt;case 1:return e[0];default:{let n=new t(2);return n.subtag=e,n}}}revision=1;lastChecked=1;lastValue=1;isUpdating=!1;subtag=null;subtagBufferCache=null;constructor(t){this[ht]=t}[lt](){let{lastChecked:t}=this;if(this.isUpdating)this.lastChecked=++ot;else if(t!==ot){this.isUpdating=!0,this.lastChecked=ot;try{let{subtag:t,revision:e}=this;if(null!==t)if(Array.isArray(t))for(const n of t){let t=n[lt]();e=Math.max(t,e)}else{let n=t[lt]();n===this.subtagBufferCache?e=Math.max(e,this.lastValue):(this.subtagBufferCache=null,e=Math.max(e,n))}this.lastValue=e}finally{this.isUpdating=!1}}return this.lastValue}static updateTag(t,e){let n=t,r=e;r===yt?n.subtag=null:(n.subtagBufferCache=r[lt](),n.subtag=r)}static dirtyTag(t,e){t.revision=++ot,H()}},pt=dt.dirtyTag,ft=dt.updateTag;function gt(){return new dt(0)}function mt(){return new dt(1)}var yt=new dt(3);function vt(t){return t===yt}var bt=class{[ht]=100;[lt](){return NaN}},wt=new bt,_t=class{[ht]=101;[lt](){return ot}},xt=new _t,Ct=dt.combine,St=mt(),kt=mt(),Et=mt();ct(St),pt(St),ct(St),ft(St,Ct([kt,Et])),ct(St),pt(kt),ct(St),pt(Et),ct(St),ft(St,Et),ct(St),pt(Et),ct(St);var Rt=class{tags=new Set;last=null;add(t){t!==yt&&(this.tags.add(t),this.last=t)}combine(){let{tags:t}=this;return 0===t.size?yt:1===t.size?this.last:Ct(Array.from(this.tags))}},Tt=null,Lt=[];function It(){Lt.push(Tt),Tt=new Rt}function Pt(){let t=Tt;return Tt=Lt.pop()||null,function(t){if(null==t)throw new Error("Expected value to be present");return t}(t).combine()}function Mt(){Lt.push(Tt),Tt=null}function At(){Tt=Lt.pop()||null}function Ot(){for(;Lt.length>0;)Lt.pop();Tt=null}function Nt(){return null!==Tt}function Ft(t){null!==Tt&&Tt.add(t)}var zt=Symbol("FN"),Dt=Symbol("LAST_VALUE"),jt=Symbol("TAG"),Ut=Symbol("SNAPSHOT");function Bt(t){return{[zt]:t,[Dt]:void 0,[jt]:void 0,[Ut]:-1}}function $t(t){let e=t[zt],n=t[jt],r=t[Ut];if(void 0!==n&&ut(n,r))Ft(n);else{It();try{t[Dt]=e()}finally{n=Pt(),t[jt]=n,t[Ut]=ct(n),Ft(n)}}return t[Dt]}function qt(t){return vt(t[jt])}function Vt(t){let e;It();try{t()}finally{e=Pt()}return e}function Wt(t){Mt();try{return t()}finally{At()}}var Ht=new WeakMap;function Gt(t,e,n){let r=void 0===n?Ht.get(t):n;if(void 0===r)return;let i=r.get(e);void 0!==i&&pt(i,!0)}function Zt(t){let e=Ht.get(t);return void 0===e&&(e=new Map,Ht.set(t,e)),e}function Kt(t,e,n){let r=void 0===n?Zt(t):n,i=r.get(e);return void 0===i&&(i=mt(),r.set(e,i)),i}function Yt(t){return null!==t&&("object"==typeof t||"function"==typeof t)}function Xt(t){return t}function Jt(t){return t}function Qt(t){return!!t&&t.length>0}function te(t){return 0===t.length?void 0:t[t.length-1]}function ee(t){return 0===t.length?void 0:t[0]}function ne(){return Object.create(null)}function re(t){return null!=t}function ie(t){return"function"==typeof t||"object"==typeof t&&null!==t}var se=class{stack;current=null;constructor(t=[]){this.stack=t}get size(){return this.stack.length}push(t){this.current=t,this.stack.push(t)}pop(){let t=this.stack.pop();return this.current=te(this.stack)??null,void 0===t?null:t}nth(t){let e=this.stack.length;return e<t?null:this.stack[e-t]}isEmpty(){return 0===this.stack.length}snapshot(){return[...this.stack]}toArray(){return this.stack}},oe=Symbol("REFERENCE"),ae=class{[oe];tag=null;lastRevision=1;lastValue;children=null;compute=null;update=null;debugLabel;constructor(t){this[oe]=t}};function le(t){const e=new ae(2);return e.tag=yt,e.lastValue=t,e}var ce=le(void 0),ue=le(null),he=le(!0),de=le(!1);function pe(t){const e=new ae(0);return e.lastValue=t,e.tag=yt,e}function fe(t){const e=new ae(2);return e.lastValue=t,e.tag=yt,e}function ge(t,e=null){const n=new ae(1);return n.compute=t,n.update=e,n}function me(t){return we(t)?ge(()=>_e(t),null,t.debugLabel):t}function ye(t){return 3===t[oe]}function ve(t){const e=ge(()=>_e(t),e=>xe(t,e));return e.debugLabel=t.debugLabel,e[oe]=3,e}function be(t){return t.tag===yt}function we(t){return null!==t.update}function _e(t){const e=t;let{tag:n}=e;if(n===yt)return e.lastValue;const{lastRevision:r}=e;let i;if(null!==n&&ut(n,r))i=e.lastValue;else{const{compute:t}=e,r=Vt(()=>{i=e.lastValue=t()});n=e.tag=r,e.lastRevision=ct(r)}return Ft(n),i}function xe(t,e){(0,t.update)(e)}function Ce(t,e){const n=t,r=n[oe];let i,s=n.children;if(null===s)s=n.children=new Map;else{const t=s.get(e);if(t)return t}if(2===r){const t=_e(n);i=re(t)?fe(t[e]):ce}else i=ge(()=>{const t=_e(n);if(re(t))return $(t,e)},t=>{const r=_e(n);if(re(r))return q(r,e,t)});return s.set(e,i),i}function Se(t,e){let n=t;for(const r of e)n=Ce(n,r);return n}var ke=new WeakMap;function Ee(t){return ke.get(t)}function Re(t,e){ke.set(t,e)}function Te(t){if("symbol"==typeof t)return null;const e=Number(t);return isNaN(e)?null:e%1==0?e:null}var Le=class{constructor(t){this.named=t}get(t,e){const n=this.named[e];if(void 0!==n)return _e(n)}has(t,e){return e in this.named}ownKeys(){return Object.keys(this.named)}isExtensible(){return!1}getOwnPropertyDescriptor(t,e){return{enumerable:!0,configurable:!0}}},Ie=class{constructor(t){this.positional=t}get(t,e){let{positional:n}=this;if("length"===e)return n.length;const r=Te(e);return null!==r&&r>=0&&r<n.length?_e(n[r]):t[e]}isExtensible(){return!1}has(t,e){const n=Te(e);return null!==n&&n>=0&&n<this.positional.length}},Pe=t=>{const{named:e,positional:n}=t,r=new Le(e),i=new Ie(n),s=Object.create(null),o=new Proxy(s,r),a=new Proxy([],i);return Re(o,(t,n)=>function(t,e){return Vt(()=>{e in t&&_e(t[e])})}(e,n)),Re(a,(t,e)=>function(t,e){return Vt(()=>{"[]"===e&&t.forEach(_e);const n=Te(e);null!==n&&n>=0&&n<t.length&&_e(t[n])})}(n,e)),{named:o,positional:a}};function Me(t,e){return Array.isArray(t)?t[e]:t.objectAt(e)}var Ae=Symbol("SELF_TAG");function Oe(t,e,n=!1,r){let i=Ee(t);return void 0!==i?i(t,e,n):Kt(t,e,r)}function Ne(t){return Yt(t)?Kt(t,Ae):yt}function Fe(t,e){Gt(t,e),Gt(t,Ae)}var ze=new WeakSet;function De(t,e,n){let r=t.readableLazyChainsFor(e);if(void 0!==r){if(Yt(n))for(let[t,e]of r)ft(t,Ue(n,e,Zt(n),w(n)));r.length=0}}function je(t,e,n,r){let i=[];for(let s of e)Be(i,t,s,n,r);return Ct(i)}function Ue(t,e,n,r){return Ct(Be([],t,e,n,r))}function Be(t,e,n,r,i){let s,o,a=e,l=r,c=i,u=n.length,h=-1;for(;;){let e=h+1;if(h=n.indexOf(".",e),-1===h&&(h=u),s=n.slice(e,h),"@each"===s&&h!==u){e=h+1,h=n.indexOf(".",e);let r=a.length;if("number"!=typeof r||!Array.isArray(a)&&!("objectAt"in a))break;if(0===r){t.push(Oe(a,"[]"));break}s=-1===h?n.slice(e):n.slice(e,h);for(let e=0;e<r;e++){let n=Me(a,e);n&&(t.push(Oe(n,s,!0)),c=w(n),o=null!==c?c.peekDescriptors(s):void 0,void 0!==o&&"string"==typeof o.altKey&&n[s])}t.push(Oe(a,"[]",!0,l));break}let r=Oe(a,s,!0,l);if(o=null!==c?c.peekDescriptors(s):void 0,t.push(r),h===u){ze.has(o)&&a[s];break}if(void 0===o)a=s in a||"function"!=typeof a.unknownProperty?a[s]:a.unknownProperty(s);else if(ze.has(o))a=a[s];else{let e=c.source===a?c:_(a),i=e.revisionFor(s);if(void 0===i||!ut(r,i)){let r=e.writableLazyChainsFor(s),i=n.substring(h+1),o=mt();r.push([o,i]),t.push(o);break}a=e.valueFor(s)}if(!Yt(a))break;l=Zt(a),c=w(a)}return t}var $e=/\.(_super|call\(this|apply\(this)/,qe=Function.prototype.toString,Ve=qe.call(function(){return this}).indexOf("return this")>-1?function(t){return $e.test(qe.call(t))}:function(){return!0},We=new WeakMap,He=Object.freeze(function(){});function Ge(t){let e=We.get(t);return void 0===e&&(e=Ve(t),We.set(t,e)),e}We.set(He,!1);var Ze=class{listeners=void 0;observers=void 0},Ke=new WeakMap;function Ye(t){let e=Ke.get(t);return void 0===e&&(e=new Ze,Ke.set(t,e)),e}function Xe(t){return Ke.get(t)}function Je(t,e){Ye(t).observers=e}function Qe(t,e){Ye(t).listeners=e}var tn=new WeakSet;function en(t,e){return Ge(t)?!tn.has(e)&&Ge(e)?nn(t,nn(e,He)):nn(t,e):t}function nn(t,e){function n(){let n=this._super;this._super=e;let r=t.apply(this,arguments);return this._super=n,r}tn.add(n);let r=Ke.get(t);return void 0!==r&&Ke.set(n,r),n}function rn(t,e,n,r,i,s=!0){r||"function"!=typeof n||(r=n,n=null),_(t).addToListeners(e,n,r,!0===i,s)}function sn(t,e,n,r){let i,s;"object"==typeof n?(i=n,s=r):(i=null,s=n),_(t).removeFromListeners(e,i,s)}function on(t,e,n,r,i){if(void 0===r){let n=void 0===i?w(t):i;r=null!==n?n.matchingListeners(e):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&&sn(t,e,i,o),i||(i=t);let l=typeof o;"string"!==l&&"symbol"!==l||(o=i[o]),o.apply(i,n)}return!0}function an(t,e){let n=w(t);if(null===n)return!1;let r=n.matchingListeners(e);return void 0!==r&&r.length>0}function ln(...t){let e=t.pop();return Qe(e,t),e}function cn(t){return t+":change"}var un=!N._DEFAULT_ASYNC_OBSERVERS,hn=new Map,dn=new Map;function pn(t,e,n,r,i=un){let s=cn(e);rn(t,s,n,r,!1,i);let o=w(t);null!==o&&(o.isPrototypeMeta(t)||o.isInitializing())||gn(t,s,i)}function fn(t,e,n,r,i=un){let s=cn(e),o=w(t);null!==o&&(o.isPrototypeMeta(t)||o.isInitializing())||vn(t,s,i),sn(t,s,n,r)}function gn(t,e,n=!1){let r=function(t,e){let n=!0===e?hn:dn;return n.has(t)||(n.set(t,new Map),et(t,()=>function(t){hn.size>0&&hn.delete(t),dn.size>0&&dn.delete(t)}(t),!0)),n.get(t)}(t,n);if(r.has(e))r.get(e).count++;else{let n=e.substring(0,e.lastIndexOf(":")),i=Ue(t,n,Zt(t),w(t));r.set(e,{count:1,path:n,tag:i,lastRevision:ct(i),suspended:!1})}}var mn=!1,yn=[];function vn(t,e,n=!1){if(!0===mn)return void yn.push([t,e,n]);let r=!0===n?hn:dn,i=r.get(t);if(void 0!==i){let n=i.get(e);n.count--,0===n.count&&(i.delete(e),0===i.size&&r.delete(t))}}function bn(t){dn.has(t)&&dn.get(t).forEach(e=>{e.tag=Ue(t,e.path,Zt(t),w(t)),e.lastRevision=ct(e.tag)}),hn.has(t)&&hn.get(t).forEach(e=>{e.tag=Ue(t,e.path,Zt(t),w(t)),e.lastRevision=ct(e.tag)})}var wn=0;function _n(t){let e=ct(xt);wn!==e&&(wn=e,dn.forEach((e,n)=>{let r=w(n);e.forEach((e,i)=>{if(!ut(e.tag,e.lastRevision)){let s=()=>{try{on(n,i,[n,e.path],void 0,r)}finally{e.tag=Ue(n,e.path,Zt(n),w(n)),e.lastRevision=ct(e.tag)}};t?t("actions",s):s()}})}))}function xn(){hn.forEach((t,e)=>{let n=w(e);t.forEach((t,r)=>{if(!t.suspended&&!ut(t.tag,t.lastRevision))try{t.suspended=!0,on(e,r,[e,t.path],void 0,n)}finally{t.tag=Ue(e,t.path,Zt(e),w(e)),t.lastRevision=ct(t.tag),t.suspended=!1}})})}function Cn(t,e,n){let r=hn.get(t);if(!r)return;let i=r.get(cn(e));i&&(i.suspended=n)}var Sn=()=>{},{toString:kn}=Object.prototype,{toString:En}=Function.prototype,{isArray:Rn}=Array,{keys:Tn}=Object,{stringify:Ln}=JSON,In=100,Pn=/^[\w$]+$/;function Mn(t){return"number"==typeof t&&2===arguments.length?this:An(t,0)}function An(t,e,n){let r=!1;switch(typeof t){case"undefined":return"undefined";case"object":if(null===t)return"null";if(Rn(t)){r=!0;break}if(t.toString===kn||void 0===t.toString)break;return t.toString();case"function":return t.toString===En?t.name?`[Function:${t.name}]`:"[Function]":t.toString();case"string":return Ln(t);default:return t.toString()}if(void 0===n)n=new WeakSet;else if(n.has(t))return"[Circular]";return n.add(t),r?function(t,e,n){if(e>4)return"[Array]";let r="[";for(let i=0;i<t.length;i++){if(r+=0===i?" ":", ",i>=In){r+=`... ${t.length-In} more items`;break}r+=An(t[i],e,n)}return r+=" ]",r}(t,e+1,n):function(t,e,n){if(e>4)return"[Object]";let r="{",i=Tn(t);for(let s=0;s<i.length;s++){if(r+=0===s?" ":", ",s>=In){r+=`... ${i.length-In} more keys`;break}let o=i[s];Sn(),r+=`${On(String(o))}: ${An(t[o],e,n)}`}return r+=" }",r}(t,e+1,n)}function On(t){return Pn.test(t)?t:Ln(t)}var Nn=/\.@each$/;function Fn(t,e){let n=t.indexOf("{");n<0?e(t.replace(Nn,".[]")):zn("",t,n,e)}function zn(t,e,n,r){let i,s,o=e.indexOf("}"),a=0,l=e.substring(n+1,o).split(","),c=e.substring(o+1);for(t+=e.substring(0,n),s=l.length;a<s;)i=c.indexOf("{"),i<0?r((t+l[a++]+c).replace(Nn,".[]")):zn(t+l[a++],c,i,r)}function Dn(t,e,n,r,i){let s=void 0===i?_(t):i,o=P(t,e,s),a=void 0!==o;a&&o.teardown(t,e,s),A(n)?jn(t,e,n,s):null==n?Un(t,e,r,a,!0):Object.defineProperty(t,e,n),s.isPrototypeMeta(t)||bn(t)}function jn(t,e,n,r){let i;return i=n(t,e,void 0,r),Object.defineProperty(t,e,i),n}function Un(t,e,n,r,i=!0){return!0===r||!1===i?Object.defineProperty(t,e,{configurable:!0,enumerable:i,writable:!0,value:n}):t[e]=n,n}var Bn=Symbol("PROPERTY_DID_CHANGE"),$n=0;function qn(t,e,n,r){let i=void 0===n?w(t):n;null!==i&&(i.isInitializing()||i.isPrototypeMeta(t))||(Fe(t,e),$n<=0&&xn(),Bn in t&&(4===arguments.length?t[Bn](e,r):t[Bn](e)))}function Vn(){$n++,mn=!0}function Wn(){--$n<=0&&(xn(),function(){mn=!1;for(let[t,e,n]of yn)vn(t,e,n);yn=[]}())}function Hn(t){Vn();try{t()}finally{Wn()}}function Gn(){}var Zn=class extends k{_readOnly=!1;_hasConfig=!1;_getter=void 0;_setter=void 0;constructor(t){super();let e=t[t.length-1];if("function"==typeof e||null!==e&&"object"==typeof e){this._hasConfig=!0;let e=t.pop();if("function"==typeof e)this._getter=e;else{const t=e;this._getter=t.get||Gn,this._setter=t.set}}t.length>0&&this._property(...t)}setup(t,e,n,r){if(super.setup(t,e,n,r),!1===this._hasConfig){let{get:t,set:e}=n;void 0!==t&&(this._getter=t),void 0!==e&&(this._setter=function(n,r){let i=e.call(this,r);return void 0!==t&&void 0===i?t.call(this):i})}}_property(...t){let e=[];function n(t){e.push(t)}for(let r of t)Fn(r,n);this._dependentKeys=e}get(t,e){let n,r=_(t),i=Zt(t),s=Kt(t,e,i),o=r.revisionFor(e);if(void 0!==o&&ut(s,o))n=r.valueFor(e);else{let{_getter:o,_dependentKeys:a}=this;Wt(()=>{n=o.call(t,e)}),void 0!==a&&ft(s,je(t,a,i,r)),r.setValueFor(e,n),r.setRevisionFor(e,ct(s)),De(r,e,n)}return Ft(s),Array.isArray(n)&&Ft(Kt(n,"[]")),n}set(t,e,n){this._readOnly&&this._throwReadOnlyError(t,e);let r,i=_(t);i.isInitializing()&&void 0!==this._dependentKeys&&this._dependentKeys.length>0&&"function"==typeof t[Bn]&&t.isComponent&&pn(t,e,()=>{t[Bn](e)},void 0,!0);try{Vn(),r=this._set(t,e,n,i),De(i,e,r);let s=Zt(t),o=Kt(t,e,s),{_dependentKeys:a}=this;void 0!==a&&ft(o,je(t,a,s,i)),i.setRevisionFor(e,ct(o))}finally{Wn()}return r}_throwReadOnlyError(t,e){throw new Error(`Cannot set read-only property "${e}" on object: ${Mn(t)}`)}_set(t,e,n,r){let i,s=void 0!==r.revisionFor(e),o=r.valueFor(e),{_setter:a}=this;Cn(t,e,!0);try{i=a.call(t,e,n,o)}finally{Cn(t,e,!1)}return s&&o===i||(r.setValueFor(e,i),qn(t,e,r,n)),i}teardown(t,e,n){void 0!==n.revisionFor(e)&&(n.setRevisionFor(e,void 0),n.setValueFor(e,void 0)),super.teardown(t,e,n)}},Kn=class extends Zn{get(t,e){let n,r=_(t),i=Zt(t),s=Kt(t,e,i),o=r.revisionFor(e);if(void 0!==o&&ut(s,o))n=r.valueFor(e);else{let{_getter:i}=this,o=Vt(()=>{n=i.call(t,e)});ft(s,o),r.setValueFor(e,n),r.setRevisionFor(e,ct(s)),De(r,e,n)}return Ft(s),Array.isArray(n)&&Ft(Kt(n,"[]",i)),n}},Yn=class extends Function{readOnly(){return M(this)._readOnly=!0,this}meta(t){let e=M(this);return 0===arguments.length?e._meta||{}:(e._meta=t,this)}get _getter(){return M(this)._getter}set enumerable(t){M(this).enumerable=t}};function Xn(...t){return C(t)?L(new Zn([]),Yn)(t[0],t[1],t[2]):L(new Zn(t),Yn)}function Jn(...t){return L(new Kn(t),Yn)}function Qn(t,e){return Boolean(P(t,e))}function tr(t,e){let n=w(t);return n?n.valueFor(e):void 0}var er=new WeakSet;function nr(t){return!!Yt(t)&&er.has(t)}function rr(t){Yt(t)&&er.add(t)}var ir=new WeakSet;function sr(t){return ir.has(t)}var or=class{size=0;misses=0;hits=0;constructor(t,e,n=new Map){this.limit=t,this.func=e,this.store=n}get(t){return this.store.has(t)?(this.hits++,this.store.get(t)):(this.misses++,this.set(t,this.func(t)))}set(t,e){return this.limit>this.size&&(this.size++,this.store.set(t,e)),e}purge(){this.store.clear(),this.size=0,this.hits=0,this.misses=0}},ar=new or(1e3,t=>t.indexOf("."));function lr(t){return"string"==typeof t&&-1!==ar.get(t)}var cr=Symbol("PROXY_CONTENT");function ur(t){return"object"==typeof t&&null!==t&&"function"==typeof t.unknownProperty}function hr(t,e){return lr(e)?pr(t,e):dr(t,e)}function dr(t,e){if(null==t)return;let n;return"object"==typeof t||"function"==typeof t?(n=t[e],void 0===n&&"object"==typeof t&&!(e in t)&&ur(t)&&(n=t.unknownProperty(e)),Nt()&&(Ft(Kt(t,e)),(Array.isArray(n)||sr(n))&&Ft(Kt(n,"[]")))):n=t[e],n}function pr(t,e,n){let r="string"==typeof e?e.split("."):e;for(let i of r){if(null==t||t.isDestroyed)return;if(n&&("__proto__"===i||"constructor"===i))return;t=dr(t,i)}return t}dr("foo","a"),dr("foo",1),dr({},"a"),dr({},1),dr({unknownProperty(){}},"a"),dr({unknownProperty(){}},1),hr({},"foo"),hr({},"foo.bar");var fr={};function gr(t,e){let n=t;do{let t=Object.getOwnPropertyDescriptor(n,e);if(void 0!==t)return t;n=Object.getPrototypeOf(n)}while(null!==n);return null}function mr(t,e,n,r){return t.isDestroyed?n:lr(e)?function(t,e,n,r){let i=e.split("."),s=i.pop(),o=pr(t,i,!0);if(null!=o)return mr(o,s,n);if(!r)throw new Error(`Property set failed: object in path "${i.join(".")}" could not be found.`)}(t,e,n,r):yr(t,e,n)}function yr(t,e,n){let r,i=gr(t,e);return null!==i&&T.has(i.set)?(t[e]=n,n):(r=t[e],void 0!==r||"object"!=typeof t||e in t||"function"!=typeof t.setUnknownProperty?(t[e]=n,r!==n&&qn(t,e)):t.setUnknownProperty(e,n),n)}function vr(t,e,n){return mr(t,e,n,!0)}function br(t){return L(new _r(t),wr)}rr(fr),Vt(()=>dr({},"a")),Vt(()=>dr({},1)),Vt(()=>dr({a:[]},"a")),Vt(()=>dr({a:fr},"a"));var wr=class extends Function{readOnly(){return M(this).readOnly(),this}oneWay(){return M(this).oneWay(),this}meta(t){let e=M(this);if(0===arguments.length)return e._meta||{};e._meta=t}},_r=class extends k{altKey;constructor(t){super(),this.altKey=t}setup(t,e,n,r){super.setup(t,e,n,r),ze.add(this)}get(t,e){let n,r=_(t),i=Zt(t),s=Kt(t,e,i);Wt(()=>{n=hr(t,this.altKey)});let o=r.revisionFor(e);return void 0!==o&&ut(s,o)||(ft(s,Ue(t,this.altKey,i,r)),r.setRevisionFor(e,ct(s)),De(r,e,n)),Ft(s),n}set(t,e,n){return mr(t,this.altKey,n)}readOnly(){this.set=xr}oneWay(){this.set=Cr}};function xr(t,e){throw new Error(`Cannot set read-only property '${e}' on object: ${Mn(t)}`)}function Cr(t,e,n){return Dn(t,e,null),mr(t,e,n)}function Sr(t,e,n,r){return void 0===e?(e=0,n=r=-1):(void 0===n&&(n=-1),void 0===r&&(r=-1)),on(t,"@array:before",[t,e,n,r]),t}function kr(t,e,n,r,i=!0){void 0===e?(e=0,n=r=-1):(void 0===n&&(n=-1),void 0===r&&(r=-1));let s=w(t);if(i&&((r<0||n<0||r-n!==0)&&qn(t,"length",s),qn(t,"[]",s)),on(t,"@array:change",[t,e,n,r]),null!==s){let i=-1===n?0:n,o=t.length-((-1===r?0:r)-i),a=e<0?o+e:e;void 0!==s.revisionFor("firstObject")&&0===a&&qn(t,"firstObject",s),void 0!==s.revisionFor("lastObject")&&o-1<a+i&&qn(t,"lastObject",s)}return t}var Er=Object.freeze([]);function Rr(t,e,n,r=Er){var i;null!=(i=t)&&"function"==typeof i.replace?t.replace(e,n,r):Lr(t,e,n,r)}var Tr=6e4;function Lr(t,e,n,r){if(Sr(t,e,n,r.length),r.length<=Tr)t.splice(e,n,...r);else{t.splice(e,n);for(let n=0;n<r.length;n+=Tr){let i=r.slice(n,n+Tr);t.splice(e+n,0,...i)}}kr(t,e,n,r.length)}function Ir(t,e,n,r){let{willChange:i,didChange:s}=n;return r(t,"@array:before",e,i),r(t,"@array:change",e,s),t._revalidate?.(),t}function Pr(t,e,n){return Ir(t,e,n,rn)}function Mr(t,e,n){return Ir(t,e,n,sn)}var Ar=a({default:()=>Or}),Or="7.2.0",Nr=class{_registry;_coreLibIndex;constructor(){this._registry=[],this._coreLibIndex=0}_getLibraryByName(t){let e=this._registry;for(let n of e)if(n.name===t)return n}register(t,e,n){let r=this._registry.length;this._getLibraryByName(t)||(n&&(r=this._coreLibIndex++),this._registry.splice(r,0,{name:t,version:e}))}registerCoreLibrary(t,e){this.register(t,e,!0)}deRegister(t){let e,n=this._getLibraryByName(t);n&&(e=this._registry.indexOf(n),this._registry.splice(e,1))}},Fr=new Nr;function zr(t,e){let n,r={},i=1;for(2===arguments.length&&Array.isArray(e)?(i=0,n=arguments[1]):n=Array.from(arguments);i<n.length;i++){let e=n[i];r[e]=hr(t,e)}return r}function Dr(t,e){return null===e||"object"!=typeof e||Hn(()=>{let n=Object.keys(e);for(let r of n)mr(t,r,e[r])}),e}Fr.registerCoreLibrary("Ember",Or);var jr=Symbol("OWNER");function Ur(t){return t[jr]}function Br(t){return Ur(t)}function $r(t,e){!function(t,e){t[jr]=e}(t,e)}function qr(t,...e){let n,r;C(e)?n=e:"string"==typeof e[0]&&(r=e[0]);let i=Xn({get:function(e){return(Br(this)||this.container).lookup(`${t}:${r||e}`)},set(t,e){Dn(this,t,null,e)}});return n?i(n[0],n[1],n[2]):i}function Vr(t,e){let n=new WeakMap,r="function"==typeof e;return{getter:function(i){let s;return Ft(Kt(i,t)),r&&!n.has(i)?(s=e.call(i),n.set(i,s)):s=n.get(i),s},setter:function(e,r){Gt(e,t),n.set(e,r)}}}function Wr(...t){if(!C(t)){let e=t[0],n=e?e.initializer:void 0,r=e?e.value:void 0,i=function(t,e){return Hr([t,e,{initializer:n||(()=>r)}])};return O(i),i}return Hr(t)}function Hr([t,e,n]){let{getter:r,setter:i}=Vr(e,n?n.initializer:void 0);function s(){let t=r(this);return(Array.isArray(t)||sr(t))&&Ft(Kt(t,"[]")),t}function o(t){i(this,t),Gt(this,Ae)}let a={enumerable:!0,configurable:!0,isTracked:!0,get:s,set:o};return T.add(o),_(t).writeDescriptors(e,new Gr(s,o)),a}var Gr=class{constructor(t,e){this._get=t,this._set=e,ze.add(this)}get(t){return this._get.call(t)}set(t,e,n){this._set.call(t,n)}},Zr=(...t)=>{const[e,n,r]=t,i=new WeakMap,s=r.get;r.get=function(){return i.has(this)||i.set(this,Bt(s.bind(this))),$t(i.get(this))}},Kr=a({ENV:()=>N,context:()=>Jr,getENV:()=>z,getLookup:()=>Qr,setLookup:()=>ti}),Yr=globalThis,Xr=Yr.Ember,Jr=void 0===Xr?{imports:Yr,exports:Yr,lookup:Yr}:{imports:Xr.imports||Yr,exports:Xr.exports||Yr,lookup:Xr.lookup||Yr};function Qr(){return Jr.lookup}function ti(t){Jr.lookup=t}var ei=new WeakMap;function ni(t,e){Yt(t)&&ei.set(t,e)}function ri(t){return ei.get(t)}var ii=Object.prototype.hasOwnProperty,si=!1,oi={_set:0,_unprocessedNamespaces:!1,get unprocessedNamespaces(){return this._unprocessedNamespaces},set unprocessedNamespaces(t){this._set++,this._unprocessedNamespaces=t}},ai=!1,li=[],ci=Object.create(null);function ui(t){oi.unprocessedNamespaces=!0,li.push(t)}function hi(t){let e=ri(t);delete ci[e],li.splice(li.indexOf(t),1),e in Jr.lookup&&t===Jr.lookup[e]&&(Jr.lookup[e]=void 0)}function di(){if(!oi.unprocessedNamespaces)return;let t=Jr.lookup,e=Object.keys(t);for(let n of e){if(!_i(n.charCodeAt(0)))continue;let e=xi(t,n);e&&ni(e,n)}}function pi(t){return si||gi(),ci[t]}function fi(t){bi([t.toString()],t,new Set)}function gi(){let t=oi.unprocessedNamespaces;if(t&&(di(),oi.unprocessedNamespaces=!1),t||ai){let t=li;for(let e of t)fi(e);ai=!1}}function mi(){return si}function yi(t){si=Boolean(t)}function vi(){ai=!0}function bi(t,e,n){let r=t.length,i=t.join(".");ci[i]=e,ni(e,i);for(let s in e){if(!ii.call(e,s))continue;let i=e[s];if(t[r]=s,i&&void 0===ri(i))ni(i,t.join("."));else if(i&&wi(i)){if(n.has(i))continue;n.add(i),bi(t,i,n)}}t.length=r}function wi(t){return null!=t&&"object"==typeof t&&t.isNamespace}function _i(t){return t>=65&&t<=90}function xi(t,e){try{let n=t[e];return(null!==n&&"object"==typeof n||"function"==typeof n)&&n.isNamespace&&n}catch(n){}}var Ci=a({ASYNC_OBSERVERS:()=>dn,ComputedDescriptor:()=>k,ComputedProperty:()=>Zn,DEBUG_INJECTION_FUNCTIONS:()=>{},Libraries:()=>Nr,NAMESPACES:()=>li,NAMESPACES_BY_ID:()=>ci,PROPERTY_DID_CHANGE:()=>Bn,PROXY_CONTENT:()=>cr,SYNC_OBSERVERS:()=>hn,TrackedDescriptor:()=>Gr,_getPath:()=>pr,_getProp:()=>dr,_setProp:()=>yr,activateObserver:()=>gn,addArrayObserver:()=>Pr,addListener:()=>rn,addNamespace:()=>ui,addObserver:()=>pn,alias:()=>br,arrayContentDidChange:()=>kr,arrayContentWillChange:()=>Sr,autoComputed:()=>Jn,beginPropertyChanges:()=>Vn,cached:()=>Zr,changeProperties:()=>Hn,computed:()=>Xn,createCache:()=>Bt,defineDecorator:()=>jn,defineProperty:()=>Dn,defineValue:()=>Un,deprecateProperty:()=>Si,descriptorForDecorator:()=>M,descriptorForProperty:()=>P,eachProxyArrayDidChange:()=>Ri,eachProxyArrayWillChange:()=>Ei,endPropertyChanges:()=>Wn,expandProperties:()=>Fn,findNamespace:()=>pi,findNamespaces:()=>di,flushAsyncObservers:()=>_n,get:()=>hr,getCachedValueFor:()=>tr,getProperties:()=>zr,getValue:()=>$t,hasListeners:()=>an,hasUnknownProperty:()=>ur,inject:()=>qr,isClassicDecorator:()=>A,isComputed:()=>Qn,isConst:()=>qt,isElementDescriptor:()=>C,isNamespaceSearchDisabled:()=>mi,libraries:()=>Fr,makeComputedDecorator:()=>L,markObjectAsDirty:()=>Fe,nativeDescDecorator:()=>S,notifyPropertyChange:()=>qn,objectAt:()=>Me,on:()=>ln,processAllNamespaces:()=>gi,processNamespace:()=>fi,removeArrayObserver:()=>Mr,removeListener:()=>sn,removeNamespace:()=>hi,removeObserver:()=>fn,replace:()=>Rr,replaceInNativeArray:()=>Lr,revalidateObservers:()=>bn,sendEvent:()=>on,set:()=>mr,setClassicDecorator:()=>O,setNamespaceSearchDisabled:()=>yi,setProperties:()=>Dr,setUnprocessedMixins:()=>vi,tagForObject:()=>Ne,tagForProperty:()=>Oe,tracked:()=>Wr,trySet:()=>vr});function Si(t,e,n){Object.defineProperty(t,e,{configurable:!0,enumerable:!1,set(t){mr(this,n,t)},get(){return hr(this,n)}})}var ki=new WeakMap;function Ei(t,e,n,r){let i=ki.get(t);void 0!==i&&i.arrayWillChange(t,e,n,r)}function Ri(t,e,n,r){let i=ki.get(t);void 0!==i&&i.arrayDidChange(t,e,n,r)}var Ti={get onerror(){}},Li=setTimeout,Ii=()=>{};function Pi(t){if("function"==typeof Promise){const e=Promise.resolve();return()=>e.then(t)}if("function"==typeof MutationObserver){let e=0,n=new MutationObserver(t),r=document.createTextNode("");return n.observe(r,{characterData:!0}),()=>(e=++e%2,r.data=""+e,e)}return()=>Li(t,0)}function Mi(t){let e=Ii;return{setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),now:()=>Date.now(),next:Pi(t),clearNext:e}}var Ai=/\d+/;function Oi(t){let e=typeof t;return"number"===e&&t==t||"string"===e&&Ai.test(t)}function Ni(t){return t.onError||t.onErrorTarget&&t.onErrorTarget[t.onErrorMethod]}function Fi(t,e,n){let r=-1;for(let i=0,s=n.length;i<s;i+=4)if(n[i]===t&&n[i+1]===e){r=i;break}return r}function zi(t,e,n){let r=-1;for(let i=2,s=n.length;i<s;i+=6)if(n[i]===t&&n[i+1]===e){r=i-2;break}return r}function Di(t,e,n=0){let r=[];for(let i=0;i<t.length;i+=e){let e=t[i+3+n],s={target:t[i+0+n],method:t[i+1+n],args:t[i+2+n],stack:void 0!==e&&"stack"in e?e.stack:""};r.push(s)}return r}function ji(t,e){let n,r,i=0,s=e.length-6;for(;i<s;)r=(s-i)/6,n=i+r-r%6,t>=e[n]?i=n+6:s=n;return t>=e[i]?i+6:i}var Ui=class{constructor(t,e={},n={}){this._queueBeingFlushed=[],this.targetQueues=new Map,this.index=0,this._queue=[],this.name=t,this.options=e,this.globalOptions=n}stackFor(t){if(t<this._queue.length){let e=this._queue[3*t+4];return e?e.stack:null}}flush(t){let e,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 t=Ni(this.globalOptions);s=t?this.invokeWithOnError:this.invoke;for(let o=this.index;o<l.length;o+=4)if(this.index+=4,n=l[o+1],null!==n&&(e=l[o],r=l[o+2],i=l[o+3],s(e,n,r,t,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!==t&&this._queue.length>0&&this.flush(!0)}hasWork(){return this._queueBeingFlushed.length>0||this._queue.length>0}cancel({target:t,method:e}){let n=this._queue,r=this.targetQueues.get(t);void 0!==r&&r.delete(e);let i=Fi(t,e,n);return i>-1?(n[i+1]=null,!0):(n=this._queueBeingFlushed,i=Fi(t,e,n),i>-1&&(n[i+1]=null,!0))}push(t,e,n,r){return this._queue.push(t,e,n,r),{queue:this,target:t,method:e}}pushUnique(t,e,n,r){let i=this.targetQueues.get(t);void 0===i&&(i=new Map,this.targetQueues.set(t,i));let s=i.get(e);if(void 0===s){let s=this._queue.push(t,e,n,r)-4;i.set(e,s)}else{let t=this._queue;t[s+2]=n,t[s+3]=r}return{queue:this,target:t,method:e}}_getDebugInfo(t){if(t)return Di(this._queue,4)}invoke(t,e,n){void 0===n?e.call(t):e.apply(t,n)}invokeWithOnError(t,e,n,r,i){try{void 0===n?e.call(t):e.apply(t,n)}catch(d8){r(d8,i)}}},Bi=class{constructor(t=[],e){this.queues={},this.queueNameIndex=0,this.queueNames=t,t.reduce(function(t,n){return t[n]=new Ui(n,e[n],e),t},this.queues)}schedule(t,e,n,r,i,s){let o=this.queues[t];if(void 0===o)throw new Error(`You attempted to schedule an action in a queue (${t}) that doesn't exist`);if(null==n)throw new Error(`You attempted to schedule an action in a queue (${t}) for a method that doesn't exist`);return this.queueNameIndex=0,i?o.pushUnique(e,n,r,s):o.push(e,n,r,s)}flush(t=!1){let e,n,r=this.queueNames.length;for(;this.queueNameIndex<r;)if(n=this.queueNames[this.queueNameIndex],e=this.queues[n],!1===e.hasWork()){if(this.queueNameIndex++,t&&this.queueNameIndex<r)return 1}else if(1===e.flush(!1))return 1}_getDebugInfo(t){if(t){let e,n,r={},i=this.queueNames.length,s=0;for(;s<i;)n=this.queueNames[s],e=this.queues[n],r[n]=e._getDebugInfo(t),s++;return r}}};function $i(t){let e=t(),n=e.next();for(;!1===n.done;)n.value(),n=e.next()}var qi=function(){},Vi=Object.freeze([]);function Wi(){let t,e,n,r=arguments.length;if(0===r);else if(1===r)n=null,e=arguments[0];else{let i=2,s=arguments[0],o=arguments[1],a=typeof o;if("function"===a?(n=s,e=o):null!==s&&"string"===a&&o in s?(n=s,e=n[o]):"function"==typeof s&&(i=1,n=null,e=s),r>i){let e=r-i;t=new Array(e);for(let n=0;n<e;n++)t[n]=arguments[n+i]}}return[n,e,t]}function Hi(){let t,e,n,r,i;return 2===arguments.length?(e=arguments[0],i=arguments[1],t=null):([t,e,r]=Wi(...arguments),void 0===r?i=0:(i=r.pop(),Oi(i)||(n=!0===i,i=r.pop()))),i=parseInt(i,10),[t,e,r,i,n]}var Gi=0,Zi=0,Ki=0,Yi=0,Xi=0,Ji=0,Qi=0,ts=0,es=0,ns=0,rs=0,is=0,ss=0,os=0,as=0,ls=0,cs=0,us=0,hs=0,ds=0,ps=0,fs=class{constructor(t,e){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=t,this.options=e||{},"string"==typeof this.options.defaultQueue?this._defaultQueue=this.options.defaultQueue:this._defaultQueue=this.queueNames[0],this._onBegin=this.options.onBegin||qi,this._onEnd=this.options.onEnd||qi,this._boundRunExpiredTimers=this._runExpiredTimers.bind(this),this._boundAutorunEnd=()=>{hs++,!1!==this._autorun&&(this._autorun=!1,this._autorunStack=null,this._end(!0))};let n=this.options._buildPlatform||Mi;this._platform=n(this._boundAutorunEnd)}get counters(){return{begin:Zi,end:Ki,events:{begin:Yi,end:0},autoruns:{created:us,completed:hs},run:Xi,join:Ji,defer:Qi,schedule:ts,scheduleIterable:es,deferOnce:ns,scheduleOnce:rs,setTimeout:is,later:ss,throttle:os,debounce:as,cancelTimers:ls,cancel:cs,loops:{total:ds,nested:ps}}}get defaultQueue(){return this._defaultQueue}begin(){Zi++;let t,e=this.options,n=this.currentInstance;return!1!==this._autorun?(t=n,this._cancelAutorun()):(null!==n&&(ps++,this.instanceStack.push(n)),ds++,t=this.currentInstance=new Bi(this.queueNames,e),Yi++,this._trigger("begin",t,n)),this._onBegin(t,n),t}end(){Ki++,this._end(!1)}on(t,e){if("function"!=typeof e)throw new TypeError("Callback must be a function");let n=this._eventCallbacks[t];if(void 0===n)throw new TypeError(`Cannot on() event ${t} because it does not exist`);n.push(e)}off(t,e){let n=this._eventCallbacks[t];if(!t||void 0===n)throw new TypeError(`Cannot off() event ${t} because it does not exist`);let r=!1;if(e)for(let i=0;i<n.length;i++)n[i]===e&&(r=!0,n.splice(i,1),i--);if(!r)throw new TypeError("Cannot off() callback that does not exist")}run(){Xi++;let[t,e,n]=Wi(...arguments);return this._run(t,e,n)}join(){Ji++;let[t,e,n]=Wi(...arguments);return this._join(t,e,n)}defer(t,e,n,...r){return Qi++,this.schedule(t,e,n,...r)}schedule(t,...e){ts++;let[n,r,i]=Wi(...e),s=this.DEBUG?new Error:void 0;return this._ensureInstance().schedule(t,n,r,i,!1,s)}scheduleIterable(t,e){es++;let n=this.DEBUG?new Error:void 0;return this._ensureInstance().schedule(t,null,$i,[e],!1,n)}deferOnce(t,e,n,...r){return ns++,this.scheduleOnce(t,e,n,...r)}scheduleOnce(t,...e){rs++;let[n,r,i]=Wi(...e),s=this.DEBUG?new Error:void 0;return this._ensureInstance().schedule(t,n,r,i,!0,s)}setTimeout(){return is++,this.later(...arguments)}later(){ss++;let[t,e,n,r]=function(){let[t,e,n]=Wi(...arguments),r=0,i=void 0!==n?n.length:0;return i>0&&Oi(n[i-1])&&(r=parseInt(n.pop(),10)),[t,e,n,r]}(...arguments);return this._later(t,e,n,r)}throttle(){os++;let t,[e,n,r,i,s=!0]=Hi(...arguments),o=zi(e,n,this._timers);if(-1===o)t=this._later(e,n,s?Vi:r,i),s&&this._join(e,n,r);else{t=this._timers[o+1];let e=o+4;this._timers[e]!==Vi&&(this._timers[e]=r)}return t}debounce(){as++;let t,[e,n,r,i,s=!1]=Hi(...arguments),o=this._timers,a=zi(e,n,o);if(-1===a)t=this._later(e,n,s?Vi:r,i),s&&this._join(e,n,r);else{let s=this._platform.now()+i,l=a+4;o[l]===Vi&&(r=Vi),t=o[a+1];let c=ji(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,t,e,n,r,i),this._timers.splice(a,6)}0===a&&this._reinstallTimerTimeout()}return t}cancelTimers(){ls++,this._clearTimerTimeout(),this._timers=[],this._cancelAutorun()}hasTimers(){return this._timers.length>0||this._autorun}cancel(t){if(cs++,null==t)return!1;let e=typeof t;return"number"===e?this._cancelLaterTimer(t):!("object"!==e||!t.queue||!t.method)&&t.queue.cancel(t)}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(t=>t&&t._getDebugInfo(this.DEBUG))}}_end(t){let e=this.currentInstance,n=null;if(null===e)throw new Error("end called without begin");let r,i=!1;try{r=e.flush(t)}finally{if(!i)if(i=!0,1===r){const t=this.queueNames[e.queueNameIndex];this._scheduleAutorun(t)}else this.currentInstance=null,this.instanceStack.length>0&&(n=this.instanceStack.pop(),this.currentInstance=n),this._trigger("end",e,n),this._onEnd(e,n)}}_join(t,e,n){return null===this.currentInstance?this._run(t,e,n):void 0===t&&void 0===n?e():e.apply(t,n)}_run(t,e,n){let r=Ni(this.options);if(this.begin(),r)try{return e.apply(t,n)}catch(d8){r(d8)}finally{this.end()}else try{return e.apply(t,n)}finally{this.end()}}_cancelAutorun(){this._autorun&&(this._platform.clearNext(),this._autorun=!1,this._autorunStack=null)}_later(t,e,n,r){let i=this.DEBUG?new Error:void 0,s=this._platform.now()+r,o=Gi++;if(0===this._timers.length)this._timers.push(s,o,t,e,n,i),this._installTimerTimeout();else{let r=ji(s,this._timers);this._timers.splice(r,0,s,o,t,e,n,i),this._reinstallTimerTimeout()}return o}_cancelLaterTimer(t){for(let e=1;e<this._timers.length;e+=6)if(this._timers[e]===t)return this._timers.splice(e-1,6),1===e&&this._reinstallTimerTimeout(),!0;return!1}_trigger(t,e,n){let r=this._eventCallbacks[t];if(void 0!==r)for(let i=0;i<r.length;i++)r[i](e,n)}_runExpiredTimers(){this._timerTimeoutId=null,this._timers.length>0&&(this.begin(),this._scheduleExpiredTimers(),this.end())}_scheduleExpiredTimers(){let t=this._timers,e=0,n=t.length,r=this._defaultQueue,i=this._platform.now();for(;e<n&&!(t[e]>i);e+=6){let n=t[e+4];if(n!==Vi){let i=t[e+2],s=t[e+3],o=t[e+5];this.currentInstance.schedule(r,i,s,n,!1,o)}}t.splice(0,e),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 t=this._timers[0],e=this._platform.now(),n=Math.max(0,t-e);this._timerTimeoutId=this._platform.setTimeout(this._boundRunExpiredTimers,n)}_ensureInstance(){let t=this.currentInstance;return null===t&&(this._autorunStack=this.DEBUG?new Error:void 0,t=this.begin(),this._scheduleAutorun(this.queueNames[0])),t}_scheduleAutorun(t){us++;const e=this._platform.next,n=this.options.flush;n?n(t,e):e(),this._autorun=!0}};fs.Queue=Ui,fs.buildPlatform=Mi,fs.buildNext=Pi;var gs=a({_backburner:()=>ws,_cancelTimers:()=>Ts,_getCurrentRunLoop:()=>ys,_hasScheduledTimers:()=>Rs,_queues:()=>bs,_rsvpErrorQueue:()=>vs,begin:()=>Ss,bind:()=>Cs,cancel:()=>As,debounce:()=>Os,end:()=>ks,join:()=>xs,later:()=>Ls,next:()=>Ms,once:()=>Is,run:()=>_s,schedule:()=>Es,scheduleOnce:()=>Ps,throttle:()=>Ns}),ms=null;function ys(){return ms}var vs=`${Math.random()}${Date.now()}`.replace(".",""),bs=["actions","routerTransitions","render","afterRender","destroy",vs],ws=new fs(bs,{defaultQueue:"actions",onBegin:function(t){ms=t},onEnd:function(t,e){ms=e,_n(Es)},onErrorTarget:Ti,onErrorMethod:"onerror",flush:function(t,e){"render"!==t&&t!==vs||_n(Es),e()}});function _s(...t){return ws.run(...t)}function xs(t,e,...n){return ws.join(t,e,...n)}function Cs(...t){return(...e)=>xs(...t.concat(e))}function Ss(){ws.begin()}function ks(){ws.end()}function Es(...t){return ws.schedule(...t)}function Rs(){return ws.hasTimers()}function Ts(){ws.cancelTimers()}function Ls(...t){return ws.later(...t)}function Is(...t){return ws.scheduleOnce("actions",...t)}function Ps(...t){return ws.scheduleOnce(...t)}function Ms(...t){return ws.later(...t,1)}function As(t){return ws.cancel(t)}function Os(...t){return ws.debounce(...t)}function Ns(...t){return ws.throttle(...t)}var Fs=new Set([Symbol.iterator,"concat","entries","every","filter","find","findIndex","flat","flatMap","forEach","includes","indexOf","join","keys","lastIndexOf","map","reduce","reduceRight","slice","some","values"]),zs=new Set(["fill","push","unshift"]);function Ds(t){if("symbol"==typeof t)return null;const e=Number(t);return isNaN(e)?null:e%1==0?e:null}var js=class t{#t;constructor(e,n){this.#t=n;const r=e.slice(),i=this,s=new Map;let o=!1;return new Proxy(r,{get(t,e){const n=Ds(e);if(null!==n)return i.#e(n),Ft(i.#n),t[n];if("length"===e)return o?o=!1:Ft(i.#n),t[e];if(zs.has(e)&&(o=!0),Fs.has(e)){let n=s.get(e);return void 0===n&&(n=(...n)=>(Ft(i.#n),t[e](...n)),s.set(e,n)),n}return t[e]},set(t,e,n){if(i.#t.equals(t[e],n))return!0;t[e]=n;const r=Ds(e);return null!==r?(i.#r(r),i.#i()):"length"===e&&i.#i(),!0},getPrototypeOf:()=>t.prototype})}#n=mt();#s=new Map;#e(t){let e=this.#s.get(t);void 0===e&&(e=mt(),this.#s.set(t,e)),Ft(e)}#r(t){const e=this.#s.get(t);e&&pt(e)}#i(){pt(this.#n),this.#s.clear()}};function Us(t,e){return new js(t??[],{equals:e?.equals??Object.is,description:e?.description})}Object.setPrototypeOf(js.prototype,Array.prototype);var Bs=class t{#t;#s=new Map;#n=mt();#e(t){let e=this.#s.get(t);void 0===e&&(e=mt(),this.#s.set(t,e)),Ft(e)}#r(t){const e=this.#s.get(t);e&&pt(e)}#i(){pt(this.#n)}constructor(e,n){this.#t=n;const r=Object.getPrototypeOf(e),i=Object.getOwnPropertyDescriptors(e),s=Object.create(r);for(const t in i)Object.defineProperty(s,t,i[t]);const o=this;return new Proxy(s,{get:(t,e)=>(o.#e(e),t[e]),has:(t,e)=>(o.#e(e),e in t),ownKeys:t=>(Ft(o.#n),Reflect.ownKeys(t)),set:(t,e,n)=>(o.#t.equals(t[e],n)||(t[e]=n,o.#r(e),o.#i()),!0),deleteProperty:(t,e)=>(e in t&&(delete t[e],o.#r(e),o.#s.delete(e),o.#i()),!0),getPrototypeOf:()=>t.prototype})}};function $s(t,e){return new Bs(t??{},{equals:e?.equals??Object.is,description:e?.description})}function qs(t,e){const n=e?.equals??Object.is,r=new Set(t??[]),i=mt(),s=new Map;function o(t){const e=s.get(t);e&&pt(e)}const a=new Proxy(r,{get(t,e,r){if("add"===e)return function(e){if(t.has(e)){if(n(e,e))return a}else pt(i);return o(e),t.add(e),a};if("delete"===e)return function(e){return!!t.has(e)&&(o(e),pt(i),s.delete(e),t.delete(e))};if("clear"===e)return function(){0!==t.size&&(s.forEach(t=>pt(t)),pt(i),s.clear(),t.clear())};if("has"===e)return function(e){return Ft(function(t){let e=s.get(t);return void 0===e&&(e=mt(),s.set(t,e)),e}(e)),t.has(e)};if("size"===e)return Ft(i),t.size;const l=Reflect.get(t,e,r);return"function"==typeof l?function(...e){return Ft(i),l.apply(t,e)}:l}});return a}function Vs(t,e){const n=e?.equals??Object.is,r=new WeakSet(t??[]),i=new WeakMap;function s(t){const e=i.get(t);e&&pt(e)}const o=new Proxy(r,{get(t,e,r){if("add"===e)return function(e){return t.has(e)&&n(e,e)||(t.add(e),s(e)),o};if("delete"===e)return function(e){return!!t.has(e)&&(s(e),i.delete(e),t.delete(e))};if("has"===e)return function(e){return Ft(function(t){let e=i.get(t);return void 0===e&&(e=mt(),i.set(t,e)),e}(e)),t.has(e)};const a=Reflect.get(t,e,r);return"function"==typeof a?a.bind(t):a}});return o}function Ws(t,e){const n=e?.equals??Object.is,r=t instanceof Map?new Map(t.entries()):new Map(t??[]),i=mt(),s=new Map;function o(t){let e=s.get(t);return void 0===e&&(e=mt(),s.set(t,e)),e}function a(t){const e=s.get(t);e&&pt(e)}const l=new Proxy(r,{get(t,e,r){if("set"===e)return function(e,r){return t.has(e)&&n(t.get(e),r)||(a(e),pt(i),t.set(e,r)),l};if("delete"===e)return function(e){return!!t.has(e)&&(a(e),pt(i),s.delete(e),t.delete(e))};if("clear"===e)return function(){0!==t.size&&(s.forEach(t=>pt(t)),s.clear(),pt(i),t.clear())};if("get"===e)return function(e){return Ft(o(e)),t.get(e)};if("has"===e)return function(e){return Ft(o(e)),t.has(e)};if("size"===e)return Ft(i),t.size;const c=Reflect.get(t,e,r);return"function"==typeof c?function(...e){return Ft(i),c.apply(t,e)}:c}});return l}function Hs(t,e){const n=e?.equals??Object.is,r=t??[],i=r instanceof WeakMap?r:new WeakMap(r),s=new WeakMap;function o(t){let e=s.get(t);return void 0===e&&(e=mt(),s.set(t,e)),e}function a(t){const e=s.get(t);e&&pt(e)}const l=new Proxy(i,{get(t,e,r){if("set"===e)return function(e,r){return t.has(e)&&n(t.get(e),r)||(a(e),t.set(e,r)),l};if("delete"===e)return function(e){return!!t.has(e)&&(a(e),s.delete(e),t.delete(e))};if("get"===e)return function(e){return Ft(o(e)),t.get(e)};if("has"===e)return function(e){return Ft(o(e)),t.has(e)};const i=Reflect.get(t,e,r);return"function"==typeof i?i.bind(t):i}});return l}var Gs=a({ALLOW_CYCLES:()=>{},COMPUTE:()=>lt,CONSTANT:()=>0,CONSTANT_TAG:()=>yt,CURRENT_TAG:()=>xt,CurrentTag:()=>_t,INITIAL:()=>1,VOLATILE:()=>NaN,VOLATILE_TAG:()=>wt,VolatileTag:()=>bt,beginTrackFrame:()=>It,beginUntrackFrame:()=>Mt,bump:()=>at,combine:()=>Ct,consumeTag:()=>Ft,createCache:()=>Bt,createTag:()=>gt,createUpdatableTag:()=>mt,debug:()=>Zs,dirtyTag:()=>pt,dirtyTagFor:()=>Gt,endTrackFrame:()=>Pt,endUntrackFrame:()=>At,getValue:()=>$t,isConst:()=>qt,isConstTag:()=>vt,isTracking:()=>Nt,resetTracking:()=>Ot,tagFor:()=>Kt,tagMetaFor:()=>Zt,track:()=>Vt,trackedArray:()=>Us,trackedData:()=>Vr,trackedMap:()=>Ws,trackedObject:()=>$s,trackedSet:()=>qs,trackedWeakMap:()=>Hs,trackedWeakSet:()=>Vs,untrack:()=>Wt,updateTag:()=>ft,validateTag:()=>ut,valueForTag:()=>ct}),Zs={},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 Ys="@warp-drive/core",Xs=globalThis;Xs.__warpDrive_universalCache=Xs.__warpDrive_universalCache??{},Xs[Ys]=Xs[Ys]??{__version:"5.8.2"};var Js=Xs[Ys],Qs=Js.__warpDrive_ModuleScopedCaches??{};if(Js.__warpDrive_hasOtherCopy)throw new Error("Multiple copies of WarpDrive detected, the application will malfunction.");function to(t,e){return e}function eo(t){return Qs[`(transient) ${t}`]??null}function no(t,e){return e}Js.__warpDrive_hasOtherCopy=!0,no(0,Symbol.for("wd:skip-cache")),no(0,Symbol.for("wd:enable-hydration")),to(0,Symbol("IS_FUTURE")),to(0,Symbol("DOC")),to(0,Symbol("FROZEN")),to(0,Symbol.for("Collection"));var ro=no(0,new WeakMap);function io(t,e){ro.set(t,e)}no(0,new Map),to(0,Symbol("IS_CACHE_HANDLER"));var so=to(0,Symbol("#[]"));function oo(t,e){return eo("signalHooks").createSignal(t,e)}to(0,Symbol("#{}"));var ao={isInitializer:!0};function lo(t){return"object"==typeof t&&null!==t&&Object.getPrototypeOf(t)===ao}var co=to(0,Symbol("Signals"));function uo(t){return t[co]||function(t){t[co]=new Map}(t),t[co]}function ho(t,e,n,r){const i={key:n,context:e,signal:oo(e,n),value:lo(r)?r.value.call(e):r,isStale:!1};return t.set(n,i),i}function po(t,e){return t?.get(e)}function fo(t,e){return{enumerable:!0,configurable:!1,get(){const n=function(t,e,n,r){let i=po(t,n);return i||(i=ho(t,e,n,r)),function(t){eo("signalHooks").consumeSignal(t)}(i.signal),i}(uo(this),this,t,e);return n.isStale=!1,n.value},set(n){const r=function(t,e,n,r){let i=po(t,n);return i||(i=ho(t,e,n,r)),i}(uo(this),this,t,e);var i;r.value!==n&&(r.value=n,(i=r)&&(i.isStale=!0,function(t){eo("signalHooks").notifySignal(t)}(i.signal)))}}}function go(t,e,n){Object.defineProperty(t,e,fo(e,n))}function mo(t,e,n){const r=fo(e,n);r.enumerable=!1,Object.defineProperty(t,e,r)}function yo(t,e,n){const r=n.get;return n.get=function(){const t=uo(this);let n=t.get(e);return n||(n=function(t,e,n,r){{const i=function(t,e,n){return eo("signalHooks").createMemo(t,e,n)}(e,n,r);return t.set(n,i),i}}(t,this,e,r.bind(this))),n()},n}var vo=new WeakMap;function bo(t){return t instanceof DOMException&&"AbortError"===t.name}var wo=class{_stream=null;_future;_triggered=!1;_trigger(){if(this._triggered)return;this._triggered=!0;const t=this._future.getStream();t.sizeHint&&(this._sizeHint=t.sizeHint),this.promise=t.then(t=>t?async function(t,e){const n=e,r=t.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:t,done:e}=await r.read();if(e)break;if(i+=t.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 t of l)await a.ready,await a.write(t);l.length=0}await a.ready,await a.write(t)}else l.push(t)}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}(t,this):(this._isPending=!1,void(this._isComplete=!0)),t=>{this._isPending=!1,this._isStarted=!1,bo(t)&&(this._isCancelled=!0,this._isComplete=!0),this._isErrored=!0,this._error=t})}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(t){this._future=t}abort=()=>{this._future.abort()}};mo(wo.prototype,"_isPending",!0),mo(wo.prototype,"_isStarted",!1),mo(wo.prototype,"_isComplete",!1),mo(wo.prototype,"_isCancelled",!1),mo(wo.prototype,"_isErrored",!1),mo(wo.prototype,"_error",null),mo(wo.prototype,"_sizeHint",0),mo(wo.prototype,"_bytesLoaded",0),mo(wo.prototype,"_startTime",0),mo(wo.prototype,"_endTime",0),mo(wo.prototype,"_lastPacketTime",0);var _o={};function xo(t,e,n){const r=Object.assign({},e),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,t.request(r)}function Co(t,e,n){let r={...Object.getOwnPropertyDescriptor(t,e)};for(let i of n)r=i(t,e,r)||r;void 0!==r.initializer&&(r.value=r.initializer?r.initializer.call(t):void 0,r.initializer=void 0),Object.defineProperty(t,e,r)}go(_o,"reason",null),go(_o,"value",null),go(_o,"result",null),go(_o,"error",null),go(_o,"status","pending"),go(_o,"isPending",!0),go(_o,"isLoading",!0),go(_o,"isSuccess",!1),go(_o,"isError",!1),go(_o,"request",null),go(_o,"response",null),Object.defineProperty(_o,"isCancelled",{get(){return this.isError&&bo(this.reason)}}),Object.defineProperty(_o,"loadingState",{get(){return this._loadingState||(this._loadingState=new wo(this._request)),this._loadingState}});var So=Symbol.dispose||Symbol.for("dispose"),ko=class{_requester;constructor(t,e){this._args=e,this.store=t,this._subscribedTo=null,this._subscription=null,this._intervalStart=null,this._invalidated=!1,this._nextInterval=null,this._requester=null,this.isDestroyed=!1,this[So]=Ro,this._installListeners(),this._beginPolling()}async _beginPolling(){try{this.isIdle||await this.request}catch{}finally{this.isDestroyed||this._scheduleInterval()}}get isIdle(){const{request:t,query:e}=this._args;return Boolean(!t&&!e)}static{Co(this.prototype,"isIdle",[yo])}get autorefreshTypes(){const{autorefresh:t}=this._args;let e;return e=!0===t?["online","invalid"]:"string"==typeof t?t.split(","):[],new Set(e)}static{Co(this.prototype,"autorefreshTypes",[yo])}async _scheduleInterval(){const{autorefreshThreshold:t}=this._args;if("undefined"!=typeof window&&"number"==typeof t&&t>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()},t)}}_clearInterval(){this._nextInterval&&(clearTimeout(this._nextInterval),this._intervalStart=null)}_updateSubscriptions(){if(this.isIdle)return;const t=this._request.lid;if(this._subscribedTo===t)return;this._removeSubscriptions();const e=this._getRequester();this._requester=e,t&&Eo(e)&&(this._subscribedTo=t,this._subscription=e.notifications.subscribe(t,(n,r)=>{if(!this._isUpdating)switch(r){case"invalidated":this.autorefreshTypes.has("invalid")&&(this._invalidated=!0,this._maybeUpdate());break;case"state":{const n=e.requestManager._deduped.get(t)?.priority,r=this.reqState;n?n.blocking&&!r.isLoading?(this.isRefreshing=!1,this._maybeUpdate("policy",!0)):this.isRefreshing=!0:this.isRefreshing=!1}}}))}_removeSubscriptions(){const t=this._requester;this._subscription&&t&&Eo(t)&&(t.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=t=>{this.isOnline="online"===t.type,"offline"===t.type&&null===this._unavailableStart&&(this._unavailableStart=Date.now()),this._maybeUpdate()},this._backgroundChanged=()=>{const t="hidden"===document.visibilityState;this.isHidden=t,t&&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(t,e){if(this.isIdle)return;const{reqState:n}=this;if(n.isPending)return;if(!Boolean(this.isOnline&&!this.isHidden&&(t||this.autorefreshTypes.size))){if(!e&&t&&"_invalidated"!==t)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(t);if(!i&&r.has("online")){const{_unavailableStart:t}=this,{autorefreshThreshold:e}=this._args,n="number"==typeof e?e:3e4;i=Boolean(t&&Date.now()-t>n)}if(!i&&r.has("interval")){const{_intervalStart:t}=this,{autorefreshThreshold:e}=this._args;t&&"number"==typeof e&&e>0&&(i=Boolean(Date.now()-t>=e))}if(this._unavailableStart=null,this._invalidated=!1,i){this._clearInterval(),this._isUpdating=!0;const e=("_invalidated"===t?null:t)??this._args.autorefreshBehavior??"policy",r=this._getRequester();switch(n._request.requester||(n._request.requester=r),e){case"reload":this._latestRequest=n.reload();break;case"refresh":this._latestRequest=n.refresh();break;case"policy":this._latestRequest=n.refresh(!0)}"refresh"!==e&&(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{Co(this.prototype,"errorFeatures",[yo])}get contentFeatures(){const t={isHidden:this.isHidden,isOnline:this.isOnline,reload:this.retry,refresh:this.refresh,isRefreshing:this.isRefreshing,latestRequest:this._latestRequest};return t.isRefreshing&&(t.abort=()=>{this._latestRequest?.abort()}),t}static{Co(this.prototype,"contentFeatures",[yo])}get _request(){const{request:t,query:e}=this._args,{_localRequest:n,_originalRequest:r,_originalQuery:i}=this;return n&&t===r&&e===i?n:(this._originalQuery=e,this._originalRequest=t,t||this.store.request(e))}static{Co(this.prototype,"_request",[yo])}get request(){{const t=this._request;return this._updateSubscriptions(),t}}static{Co(this.prototype,"request",[yo])}get reqState(){return function(t){let e=vo.get(t);return e||(e=function(t){const e=(n=t,ro.get(n));var n;const r=Object.create(_o);return r._request=t,r.reload=()=>xo(t.requester,r.request,!0),r.refresh=(e=!1)=>xo(t.requester,r.request,!0===e&&null),e?e.isError?(r.error=e.result,r.reason=e.result,r.status="rejected",r.isError=!0,r.isPending=!1,r.isLoading=!1,r.request=e.result.request,r.response=e.result.response):(r.result=e.result.content,r.value=e.result.content,r.status="fulfilled",r.isSuccess=!0,r.isPending=!1,r.isLoading=!1,r.request=e.result.request,r.response=e.result.response):t.then(e=>{io(t,{isError:!1,result:e}),r.result=e.content,r.value=e.content,r.status="fulfilled",r.isSuccess=!0,r.isPending=!1,r.isLoading=!1,r.request=e.request,r.response=e.response},e=>{io(t,{isError:!0,result:e}),r.error=e,r.reason=e,r.status="rejected",r.isError=!0,r.isPending=!1,r.isLoading=!1,r.request=e.request,r.response=e.response}),r}(t),vo.set(t,e)),e}(this.request)}get result(){return this.reqState.result}};function Eo(t){return"requestManager"in t}function Ro(){const t=this;t.isDestroyed=!0,t._removeSubscriptions(),"undefined"!=typeof window&&(t._clearInterval(),window.removeEventListener("online",t._onlineChanged,{passive:!0,capture:!0}),window.removeEventListener("offline",t._onlineChanged,{passive:!0,capture:!0}),document.removeEventListener("visibilitychange",t._backgroundChanged,{passive:!0,capture:!0}))}go(ko.prototype,"isOnline",!0),go(ko.prototype,"isHidden",!1),go(ko.prototype,"isRefreshing",!1),go(ko.prototype,"_localRequest",void 0),go(ko.prototype,"_latestRequest",void 0);var To={};go(To,"reason",null),go(To,"value",null),go(To,"result",null),go(To,"error",null),go(To,"status","pending"),go(To,"isPending",!0),go(To,"isLoading",!0),go(To,"isSuccess",!1),go(To,"isError",!1);var Lo=pt;!function(){const t=function(t){const e=t.wellknown.Array;return{createSignal:(t,n)=>n===e?[Oe(t,n),Oe(t,"length"),Oe(t,"[]")]:Oe(t,n),consumeSignal(t){if(Array.isArray(t))return Ft(t[0]),Ft(t[1]),void Ft(t[2]);Ft(t)},notifySignal(t){if(Array.isArray(t))return Lo(t[0]),Lo(t[1]),void Lo(t[2]);Lo(t)},createMemo:(t,e,n)=>{{const r=Oe(t,e),i=Bt(n);let s;const o=()=>{s=$t(i)};return()=>{const t=Vt(o);return ft(r,t),Ft(t),s}}},willSyncFlushWatchers:()=>!!ws.currentInstance&&!0!==ws._autorun,waitFor:async t=>t}}({wellknown:{Array:so}});var e;e=t,Qs["(transient) signalHooks"]=e}();var Io=a({getOwner:()=>Po,setOwner:()=>$r}),Po=Br;function Mo(t){let e=Object.create(t);return e._dict=null,delete e._dict,e}var Ao="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 Oo(t){let e=t._promiseCallbacks;return e||(e=t._promiseCallbacks={}),e}var No={mixin(t){return t.on=this.on,t.off=this.off,t.trigger=this.trigger,t._promiseCallbacks=void 0,t},on(t,e){if("function"!=typeof e)throw new TypeError("Callback must be a function");let n=Oo(this),r=n[t];r||(r=n[t]=[]),-1===r.indexOf(e)&&r.push(e)},off(t,e){let n=Oo(this);if(!e)return void(n[t]=[]);let r=n[t],i=r.indexOf(e);-1!==i&&r.splice(i,1)},trigger(t,e,n){let r=Oo(this)[t];if(r){let t;for(let i=0;i<r.length;i++)t=r[i],t(e,n)}}},Fo={instrument:!1};function zo(t,e){if(2!==arguments.length)return Fo[t];Fo[t]=e}No.mixin(Fo);var Do=[];function jo(t,e,n){1===Do.push({name:t,payload:{key:e._guidKey,id:e._id,eventName:t,detail:e._result,childId:n&&n._id,label:e._label,timeStamp:Date.now(),error:Fo["instrument-with-stack"]?new Error(e._label):null}})&&setTimeout(()=>{for(let t=0;t<Do.length;t++){let e=Do[t],n=e.payload;n.guid=n.key+n.id,n.childGuid=n.key+n.childId,n.error&&(n.stack=n.error.stack),Fo.trigger(e.name,e.payload)}Do.length=0},50)}function Uo(t,e){if(t&&"object"==typeof t&&t.constructor===this)return t;let n=new this(Bo,e);return Ho(n,t),n}function Bo(){}var $o=void 0,qo=1,Vo=2;function Wo(t,e,n){e.constructor===t.constructor&&n===Qo&&t.constructor.resolve===Uo?function(t,e){e._state===qo?Zo(t,e._result):e._state===Vo?(e._onError=null,Ko(t,e._result)):Yo(e,void 0,n=>{e===n?Zo(t,n):Ho(t,n)},e=>Ko(t,e))}(t,e):"function"==typeof n?function(t,e,n){Fo.async(t=>{let r=!1,i=function(n,i){try{n.call(i,n=>{r||(r=!0,e===n?Zo(t,n):Ho(t,n))},e=>{r||(r=!0,Ko(t,e))})}catch(s){return s}}(n,e,t._label);!r&&i&&(r=!0,Ko(t,i))},t)}(t,e,n):Zo(t,e)}function Ho(t,e){if(t===e)Zo(t,e);else if(function(t){let e=typeof t;return null!==t&&("object"===e||"function"===e)}(e)){let n;try{n=e.then}catch(d8){return void Ko(t,d8)}Wo(t,e,n)}else Zo(t,e)}function Go(t){t._onError&&t._onError(t._result),Xo(t)}function Zo(t,e){t._state===$o&&(t._result=e,t._state=qo,0===t._subscribers.length?Fo.instrument&&jo("fulfilled",t):Fo.async(Xo,t))}function Ko(t,e){t._state===$o&&(t._state=Vo,t._result=e,Fo.async(Go,t))}function Yo(t,e,n,r){let i=t._subscribers,s=i.length;t._onError=null,i[s]=e,i[s+qo]=n,i[s+Vo]=r,0===s&&t._state&&Fo.async(Xo,t)}function Xo(t){let e=t._subscribers,n=t._state;if(Fo.instrument&&jo(n===qo?"fulfilled":"rejected",t),0===e.length)return;let r,i,s=t._result;for(let o=0;o<e.length;o+=3)r=e[o],i=e[o+n],r?Jo(n,r,i,s):i(s);t._subscribers.length=0}function Jo(t,e,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;e._state!==$o||(i===e?Ko(e,new TypeError("A promises callback cannot return that same promise.")):!1===a?Ko(e,s):o?Ho(e,i):t===qo?Zo(e,i):t===Vo&&Ko(e,i))}function Qo(t,e,n){let r=this,i=r._state;if(i===qo&&!t||i===Vo&&!e)return Fo.instrument&&jo("chained",r,r),r;r._onError=null;let s=new r.constructor(Bo,n),o=r._result;if(Fo.instrument&&jo("chained",r,s),i===$o)Yo(r,s,t,e);else{let n=i===qo?t:e;Fo.async(()=>Jo(i,s,n,o))}return s}var ta=class{constructor(t,e,n,r){this._instanceConstructor=t,this.promise=new t(Bo,r),this._abortOnReject=n,this._isUsingOwnPromise=t===ia,this._isUsingOwnResolve=t.resolve===Uo,this._init(...arguments)}_init(t,e){let n=e.length||0;this.length=n,this._remaining=n,this._result=new Array(n),this._enumerate(e)}_enumerate(t){let e=this.length,n=this.promise;for(let r=0;n._state===$o&&r<e;r++)this._eachEntry(t[r],r,!0);this._checkFullfillment()}_checkFullfillment(){if(0===this._remaining){let t=this._result;Zo(this.promise,t),this._result=null}}_settleMaybeThenable(t,e,n){let r=this._instanceConstructor;if(this._isUsingOwnResolve){let s,o,a=!0;try{s=t.then}catch(i){a=!1,o=i}if(s===Qo&&t._state!==$o)t._onError=null,this._settledAt(t._state,e,t._result,n);else if("function"!=typeof s)this._settledAt(qo,e,t,n);else if(this._isUsingOwnPromise){let i=new r(Bo);!1===a?Ko(i,o):(Wo(i,t,s),this._willSettleAt(i,e,n))}else this._willSettleAt(new r(e=>e(t)),e,n)}else this._willSettleAt(r.resolve(t),e,n)}_eachEntry(t,e,n){null!==t&&"object"==typeof t?this._settleMaybeThenable(t,e,n):this._setResultAt(qo,e,t,n)}_settledAt(t,e,n,r){let i=this.promise;i._state===$o&&(this._abortOnReject&&t===Vo?Ko(i,n):(this._setResultAt(t,e,n,r),this._checkFullfillment()))}_setResultAt(t,e,n,r){this._remaining--,this._result[e]=n}_willSettleAt(t,e,n){Yo(t,void 0,t=>this._settledAt(qo,e,t,n),t=>this._settledAt(Vo,e,t,n))}};function ea(t,e,n){this._remaining--,this._result[e]=t===qo?{state:"fulfilled",value:n}:{state:"rejected",reason:n}}var na="rsvp_"+Date.now()+"-",ra=0,ia=class t{constructor(e,n){this._id=ra++,this._label=n,this._state=void 0,this._result=void 0,this._subscribers=[],Fo.instrument&&jo("created",this),Bo!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof t?function(t,e){let n=!1;try{e(e=>{n||(n=!0,Ho(t,e))},e=>{n||(n=!0,Ko(t,e))})}catch(r){Ko(t,r)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}_onError(t){Fo.after(()=>{this._onError&&Fo.trigger("error",t,this._label)})}catch(t,e){return this.then(void 0,t,e)}finally(t,e){let n=this,r=n.constructor;return"function"==typeof t?n.then(e=>r.resolve(t()).then(()=>e),e=>r.resolve(t()).then(()=>{throw e})):n.then(t,t)}};function sa(t,e){return{then:(n,r)=>t.call(e,n,r)}}function oa(t,e){let n=function(){let n=arguments.length,r=new Array(n+1),i=!1;for(let t=0;t<n;++t){let e=arguments[t];if(!i){if(null!==e&&"object"==typeof e)if(e.constructor===ia)i=!0;else try{i=e.then}catch(d8){let e=new ia(Bo);return Ko(e,d8),e}else i=!1;i&&!0!==i&&(e=sa(i,e))}r[t]=e}let s=new ia(Bo);return r[n]=function(t,n){t?Ko(s,t):void 0===e?Ho(s,n):!0===e?Ho(s,function(t){let e=t.length,n=new Array(e-1);for(let r=1;r<e;r++)n[r-1]=t[r];return n}(arguments)):Array.isArray(e)?Ho(s,function(t,e){let n={},r=t.length,i=new Array(r);for(let s=0;s<r;s++)i[s]=t[s];for(let s=0;s<e.length;s++)n[e[s]]=i[s+1];return n}(arguments,e)):Ho(s,n)},i?function(t,e,n,r){return ia.all(e).then(e=>aa(t,e,n,r))}(s,r,t,this):aa(s,r,t,this)};return n.__proto__=t,n}function aa(t,e,n,r){try{n.apply(r,e)}catch(d8){Ko(t,d8)}return t}function la(t,e){return ia.all(t,e)}ia.cast=Uo,ia.all=function(t,e){return Array.isArray(t)?new ta(this,t,!0,e).promise:this.reject(new TypeError("Promise.all must be called with an array"),e)},ia.race=function(t,e){let n=this,r=new n(Bo,e);if(!Array.isArray(t))return Ko(r,new TypeError("Promise.race must be called with an array")),r;for(let i=0;r._state===$o&&i<t.length;i++)Yo(n.resolve(t[i]),void 0,t=>Ho(r,t),t=>Ko(r,t));return r},ia.resolve=Uo,ia.reject=function(t,e){let n=new this(Bo,e);return Ko(n,t),n},ia.prototype._guidKey=na,ia.prototype.then=Qo;var ca=class extends ta{constructor(t,e,n){super(t,e,!1,n)}};function ua(t,e){return Array.isArray(t)?new ca(ia,t,e).promise:ia.reject(new TypeError("Promise.allSettled must be called with an array"),e)}function ha(t,e){return ia.race(t,e)}ca.prototype._setResultAt=ea;var da=class extends ta{constructor(t,e,n=!0,r){super(t,e,n,r)}_init(t,e){this._result={},this._enumerate(e)}_enumerate(t){let e,n,r=Object.keys(t),i=r.length,s=this.promise;this._remaining=i;for(let o=0;s._state===$o&&o<i;o++)e=r[o],n=t[e],this._eachEntry(n,e,!0);this._checkFullfillment()}};function pa(t,e){return ia.resolve(t,e).then(function(t){if(null===t||"object"!=typeof t)throw new TypeError("Promise.hash must be called with an object");return new da(ia,t,e).promise})}var fa=class extends da{constructor(t,e,n){super(t,e,!1,n)}};function ga(t,e){return ia.resolve(t,e).then(function(t){if(null===t||"object"!=typeof t)throw new TypeError("hashSettled must be called with an object");return new fa(ia,t,!1,e).promise})}function ma(t){throw setTimeout(()=>{throw t}),t}function ya(t){let e={resolve:void 0,reject:void 0};return e.promise=new ia((t,n)=>{e.resolve=t,e.reject=n},t),e}fa.prototype._setResultAt=ea;var va=class extends ta{constructor(t,e,n,r){super(t,e,!0,r,n)}_init(t,e,n,r,i){let s=e.length||0;this.length=s,this._remaining=s,this._result=new Array(s),this._mapFn=i,this._enumerate(e)}_setResultAt(t,e,n,r){if(r)try{this._eachEntry(this._mapFn(n,e),e,!1)}catch(d8){this._settledAt(Vo,e,d8,!1)}else this._remaining--,this._result[e]=n}};function ba(t,e,n){return"function"!=typeof e?ia.reject(new TypeError("map expects a function as a second argument"),n):ia.resolve(t,n).then(function(t){if(!Array.isArray(t))throw new TypeError("map must be called with an array");return new va(ia,t,e,n).promise})}function wa(t,e){return ia.resolve(t,e)}function _a(t,e){return ia.reject(t,e)}var xa={},Ca=class extends va{_checkFullfillment(){if(0===this._remaining&&null!==this._result){let t=this._result.filter(t=>t!==xa);Zo(this.promise,t),this._result=null}}_setResultAt(t,e,n,r){if(r){this._result[e]=n;let t,r=!0;try{t=this._mapFn(n,e)}catch(d8){r=!1,this._settledAt(Vo,e,d8,!1)}r&&this._eachEntry(t,e,!1)}else this._remaining--,n||(this._result[e]=xa)}};function Sa(t,e,n){return"function"!=typeof e?ia.reject(new TypeError("filter expects function as a second argument"),n):ia.resolve(t,n).then(function(t){if(!Array.isArray(t))throw new TypeError("filter must be called with an array");return new Ca(ia,t,e,n).promise})}var ka,Ea=0;function Ra(t,e){Na[Ea]=t,Na[Ea+1]=e,2===(Ea+=2)&&Oa()}var Ta="undefined"!=typeof window?window:void 0,La=Ta||{},Ia=La.MutationObserver||La.WebKitMutationObserver,Pa="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),Ma="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function Aa(){return()=>setTimeout(Fa,1)}var Oa,Na=new Array(1e3);function Fa(){for(let t=0;t<Ea;t+=2)(0,Na[t])(Na[t+1]),Na[t]=void 0,Na[t+1]=void 0;Ea=0}Oa=Pa?function(){let t=process.nextTick,e=process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);return Array.isArray(e)&&"0"===e[1]&&"10"===e[2]&&(t=setImmediate),()=>t(Fa)}():Ia?function(){let t=0,e=new Ia(Fa),n=document.createTextNode("");return e.observe(n,{characterData:!0}),()=>n.data=t=++t%2}():Ma?function(){let t=new MessageChannel;return t.port1.onmessage=Fa,()=>t.port2.postMessage(0)}():void 0===Ta&&"function"==typeof window.require?function(){try{const t=Function("return this")().require("vertx");return void 0!==(ka=t.runOnLoop||t.runOnContext)?function(){ka(Fa)}:Aa()}catch(t){return Aa()}}():Aa(),Fo.async=Ra,Fo.after=t=>setTimeout(t,0);var za=wa,Da=(t,e)=>Fo.async(t,e);function ja(){Fo.on(...arguments)}function Ua(){Fo.off(...arguments)}if("undefined"!=typeof window&&"object"==typeof window.__PROMISE_INSTRUMENTATION__){let t=window.__PROMISE_INSTRUMENTATION__;zo("instrument",!0);for(let e in t)t.hasOwnProperty(e)&&ja(e,t[e])}var Ba={asap:Ra,cast:za,Promise:ia,EventTarget:No,all:la,allSettled:ua,race:ha,hash:pa,hashSettled:ga,rethrow:ma,defer:ya,denodeify:oa,configure:zo,on:ja,off:Ua,resolve:wa,reject:_a,map:ba,async:Da,filter:Sa},$a=Object.freeze(Object.defineProperty({__proto__:null,EventTarget:No,Promise:ia,all:la,allSettled:ua,asap:Ra,async:Da,cast:za,configure:zo,default:Ba,defer:ya,denodeify:oa,filter:Sa,hash:pa,hashSettled:ga,map:ba,off:Ua,on:ja,race:ha,reject:_a,resolve:wa,rethrow:ma},Symbol.toStringTag,{value:"Module"}));function qa(t){let e=function(t){if(!t)return;let e=t;return e.errorThrown?function(t){let e=t.errorThrown;return"string"==typeof e&&(e=new Error(e)),Object.defineProperty(e,"__reason_with_error_thrown__",{value:t,enumerable:!1}),e}(e):"UnrecognizedURLError"!==t.name&&"TransitionAborted"!==t.name?t:void 0}(t);if(e){let t=null;if(!t)throw e;t(e)}}zo("async",(t,e)=>{ws.schedule("actions",null,t,e)}),zo("after",t=>{ws.schedule(vs,null,t)}),ja("error",qa);var Va=class{static _leakTracking;owner;registry;cache;factoryManagerCache;validationCache;isDestroyed;isDestroying;constructor(t,e={}){this.registry=t,this.owner=e.owner||null,this.cache=Mo(e.cache||null),this.factoryManagerCache=Mo(e.factoryManagerCache||null),this.isDestroyed=!1,this.isDestroying=!1}lookup(t,e){if(this.isDestroyed)throw new Error(`Cannot call \`.lookup('${t}')\` after the owner has been destroyed`);return function(t,e,n={}){let r=e;if(!0===n.singleton||void 0===n.singleton&&Wa(t,e)){let e=t.cache[r];if(void 0!==e)return e}return function(t,e,n,r){let i=Ga(t,e,n);if(void 0!==i){if(function(t,e,{instantiate:n,singleton:r}){return!1!==r&&!1!==n&&(!0===r||Wa(t,e))&&Ha(t,e)}(t,n,r)){let n=t.cache[e]=i.create();return t.isDestroying&&"function"==typeof n.destroy&&n.destroy(),n}if(function(t,e,{instantiate:n,singleton:r}){return!1!==n&&(!1===r||!Wa(t,e))&&Ha(t,e)}(t,n,r))return i.create();if(function(t,e,{instantiate:n,singleton:r}){return!1!==r&&!n&&Wa(t,e)&&!Ha(t,e)}(t,n,r)||function(t,e,{instantiate:n,singleton:r}){return!(!1!==n||!1!==r&&Wa(t,e)||Ha(t,e))}(t,n,r))return i.class;throw new Error("Could not create factory")}}(t,r,e,n)}(this,this.registry.normalize(t),e)}destroy(){this.isDestroying=!0,Za(this)}finalizeDestroy(){Ka(this),this.isDestroyed=!0}reset(t){this.isDestroyed||(void 0===t?(Za(this),Ka(this)):function(t,e){let n=t.cache[e];delete t.factoryManagerCache[e],n&&(delete t.cache[e],n.destroy&&n.destroy())}(this,this.registry.normalize(t)))}ownerInjection(){let t={};return $r(t,this.owner),t}factoryFor(t){if(this.isDestroyed)throw new Error(`Cannot call \`.factoryFor('${t}')\` after the owner has been destroyed`);return Ga(this,this.registry.normalize(t),t)}};function Wa(t,e){return!1!==t.registry.getOption(e,"singleton")}function Ha(t,e){return!1!==t.registry.getOption(e,"instantiate")}function Ga(t,e,n){let r=t.factoryManagerCache[e];if(void 0!==r)return r;let i=t.registry.resolve(e);if(void 0===i)return;let s=new Qa(t,i,n,e);return t.factoryManagerCache[e]=s,s}function Za(t){let e=t.cache,n=Object.keys(e);for(let r of n){let t=e[r];t.destroy&&t.destroy()}}function Ka(t){t.cache=Mo(null),t.factoryManagerCache=Mo(null)}var Ya=Symbol("INIT_FACTORY");function Xa(t){return t[Ya]}function Ja(t,e){t[Ya]=e}var Qa=class{container;owner;class;fullName;normalizedName;madeToString;injections;constructor(t,e,n,r){this.container=t,this.owner=t.owner,this.class=e,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(t){let{container:e}=this;if(e.isDestroyed)throw new Error(`Cannot create new instances after the owner has been destroyed (you attempted to create ${this.fullName})`);let n=t?{...t}:{};return $r(n,e.owner),Ja(n,this),this.class.create(n)}};function tl(t){let e=Object.create(null);e[t]=1;for(let n in e)if(n===t)return n;return t}var el=0;function nl(){return++el}var rl="ember",il=new WeakMap,sl=new Map,ol=tl(`__ember${Date.now()}`);function al(t,e=rl){let n=e+nl().toString();return Yt(t)&&il.set(t,n),n}function ll(t){let e;if(Yt(t))e=il.get(t),void 0===e&&(e=`${rl}${nl()}`,il.set(t,e));else if(e=sl.get(t),void 0===e){let n=typeof t;e="string"===n?`st${nl()}`:"number"===n?`nu${nl()}`:"symbol"===n?`sy${nl()}`:`(${t})`,sl.set(t,e)}return e}var cl=Array.prototype.concat;function ul(t,e,n,r){let i=n[t]||r[t];return e[t]&&(i=i?cl.call(i,e[t]):e[t]),i}function hl(t,e,n,r){if(!0===n)return e;let i=n._getter;if(void 0===i)return e;let s=r[t],o="function"==typeof s?M(s):s;if(void 0===o||!0===o)return e;let a=o._getter;if(void 0===a)return e;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 t=n._dependentKeys||[],e=new Zn([...t,{get:c,set:l}]);return e._readOnly=n._readOnly,e._meta=n._meta,e.enumerable=n.enumerable,L(e,Zn)}return e}function dl(t,e,n,r){if(void 0!==r[t])return e;let i=n[t];return"function"==typeof i?en(e,i):e}function pl(t){return t?Array.isArray(t)?t:[t]:[]}function fl(t,e,n){return pl(n[t]).concat(pl(e))}function gl(t,e,n){let r=n[t];if(!r)return e;let i=Object.assign({},r),s=!1,o=Object.keys(e);for(let a of o){let t=e[a];"function"==typeof t?(s=!0,i[a]=dl(a,t,r,{})):i[a]=t}return s&&(i._super=He),i}function ml(t,e,n,r,i,s,o){let a;for(let l=0;l<t.length;l++)if(a=t[l],wl.has(a)){if(e.hasMixin(a))continue;e.addMixin(a);let{properties:t,mixins:l}=a;void 0!==t?yl(e,t,n,r,i,s,o):void 0!==l&&(ml(l,e,n,r,i,s,o),a instanceof _l&&void 0!==a._without&&a._without.forEach(t=>{let e=s.indexOf(t);-1!==e&&s.splice(e,1)}))}else yl(e,a,n,r,i,s,o)}function yl(t,e,n,r,i,s,o){let a=ul("concatenatedProperties",e,r,i),l=ul("mergedProperties",e,r,i),c=Object.keys(e);for(let u of c){let c=e[u];if(void 0===c)continue;if(-1===s.indexOf(u)){s.push(u);let e=t.peekDescriptors(u);if(void 0===e){if(!A(c)){let t=r[u]=i[u];"function"==typeof t&&vl(i,u,t,!1)}}else n[u]=e,o.push(u),e.teardown(i,u,t)}let h="function"==typeof c;if(h){let t=M(c);if(void 0!==t){n[u]=hl(u,c,t,n),r[u]=void 0;continue}}a&&a.indexOf(u)>=0||"concatenatedProperties"===u||"mergedProperties"===u?c=fl(u,c,r):l&&l.indexOf(u)>-1?c=gl(u,c,r):h&&(c=dl(u,c,r,n)),r[u]=c,n[u]=void 0}}function vl(t,e,n,r){let i=Xe(n);if(void 0===i)return;let{observers:s,listeners:o}=i;if(void 0!==s){let n=r?pn:fn;for(let r of s.paths)n(t,r,null,e,s.sync)}if(void 0!==o){let n=r?rn:sn;for(let r of o)n(t,r,null,e)}}function bl(t,e,n=!1){let r=Object.create(null),i=Object.create(null),s=_(t),o=[],a=[];t._super=He,ml(e,s,r,i,t,o,a);for(let l of o){let e=i[l],o=r[l];void 0!==e?("function"==typeof e&&vl(t,l,e,!0),Un(t,l,e,-1!==a.indexOf(l),!n)):void 0!==o&&jn(t,l,o,s)}return s.isPrototypeMeta(t)||bn(t),t}var wl=new WeakSet,_l=class t{mixins;properties;ownerConstructor;_without;constructor(t,e){wl.add(this),this.properties=function(t){if(void 0!==t)for(let e of Object.keys(t)){let n=Object.getOwnPropertyDescriptor(t,e);void 0===n.get&&void 0===n.set||Object.defineProperty(t,e,{value:S(n)})}return t}(e),this.mixins=xl(t),this.ownerConstructor=void 0,this._without=void 0}static create(...t){return vi(),new this(t,void 0)}static mixins(t){let e=w(t),n=[];return null===e||e.forEachMixins(t=>{t.properties||n.push(t)}),n}reopen(...e){if(0===e.length)return this;if(this.properties){let e=new t(void 0,this.properties);this.properties=void 0,this.mixins=[e]}else this.mixins||(this.mixins=[]);return this.mixins=this.mixins.concat(xl(e)),this}apply(t,e=!1){return bl(t,[this],e)}applyPartial(t){return bl(t,[this])}detect(t){if("object"!=typeof t||null===t)return!1;if(wl.has(t))return Cl(t,this);let e=w(t);return null!==e&&e.hasMixin(this)}without(...e){let n=new t([this]);return n._without=e,n}keys(){return Sl(this)}toString(){return"(unknown mixin)"}};function xl(t){let e,n=t&&t.length||0;if(n>0){e=new Array(n);for(let r=0;r<n;r++){let n=t[r];wl.has(n)?e[r]=n:e[r]=new _l(void 0,n)}}return e}function Cl(t,e,n=new Set){if(n.has(t))return!1;if(n.add(t),t===e)return!0;let r=t.mixins;return!!r&&r.some(t=>Cl(t,e,n))}function Sl(t,e=new Set,n=new Set){if(!n.has(t)){if(n.add(t),t.properties){let n=Object.keys(t.properties);for(let t of n)e.add(t)}else t.mixins&&t.mixins.forEach(t=>Sl(t,e,n));return e}}var kl=_l.create({mergedProperties:["actions"],send(t,...e){if(this.actions&&this.actions[t]&&!0!==this.actions[t].apply(this,e))return;let n=hr(this,"target");n&&n.send(...arguments)}}),{isArray:El}=Array;function Rl(t){return null==t?[]:El(t)?t:[t]}var Tl=a({default:()=>Fl});function Ll(t){return"object"==typeof t&&null!==t&&"function"==typeof t.setUnknownProperty}var Il=_l.prototype.reopen,Pl=new WeakSet,Ml=new WeakMap,Al=new Set;function Ol(t){Al.has(t)||t.destroy()}function Nl(t,e){let n=_(t);if(void 0!==e){let r=t.concatenatedProperties,i=t.mergedProperties,s=Object.keys(e);for(let o of s){let s=e[o],a=P(t,o,n),l=void 0!==a;if(!l){if(void 0!==r&&r.length>0&&r.includes(o)){let e=t[o];s=e?Rl(e).concat(s):Rl(s)}if(void 0!==i&&i.length>0&&i.includes(o)){let e=t[o];s=Object.assign({},e,s)}}l?a.set(t,o,s):Ll(t)&&!(o in t)?t.setUnknownProperty(o,s):t[o]=s}}t.init(e),n.unsetInitializing();let r=n.observerEvents();if(void 0!==r)for(let i=0;i<r.length;i++)gn(t,r[i].event,r[i].sync);on(t,"init",void 0,void 0,n)}var Fl=class{[jr];constructor(t){let e;this[jr]=t,this.constructor.proto(),e=this;const n=e;et(e,Ol,!0),et(e,()=>n.willDestroy()),_(e).setInitializing()}reopen(...t){return bl(this,t),this}init(t){}get isDestroyed(){return st(this)}set isDestroyed(t){}get isDestroying(){return it(this)}set isDestroying(t){}destroy(){Al.add(this);try{nt(this)}finally{Al.delete(this)}return this}willDestroy(){}toString(){let t="object"==typeof this&&null!==this&&"function"==typeof this.toStringExtension?`:${this.toStringExtension()}`:"";return`<${Xa(this)||"(unknown)"}:${ll(this)}${t}>`}static extend(...t){let e=class extends(this){};return Il.apply(e.PrototypeMixin,t),e}static create(...t){let e,n=t[0];return void 0!==n?(e=new this(Br(n)),Ja(e,Xa(n))):e=new this,t.length<=1?Nl(e,n):Nl(e,zl.apply(this,t)),e}static reopen(...t){return this.willReopen(),Il.apply(this.PrototypeMixin,t),this}static willReopen(){let t=this.prototype;Pl.has(t)&&(Pl.delete(t),Ml.has(this)&&Ml.set(this,_l.create(this.PrototypeMixin)))}static reopenClass(...t){return bl(this,t),this}static detect(t){if("function"!=typeof t)return!1;for(;t;){if(t===this)return!0;t=t.superclass}return!1}static detectInstance(t){return t instanceof this}static metaForProperty(t){return P(this.proto(),t)._meta||{}}static eachComputedProperty(t,e=this){this.proto();let n={};_(this.prototype).forEachDescriptors((r,i)=>{if(i.enumerable){let s=i._meta||n;t.call(e,r,s)}})}static get PrototypeMixin(){let t=Ml.get(this);return void 0===t&&(t=_l.create(),t.ownerConstructor=this,Ml.set(this,t)),t}static get superclass(){let t=Object.getPrototypeOf(this);return t!==Function.prototype?t:void 0}static proto(){let t=this.prototype;if(!Pl.has(t)){Pl.add(t);let e=this.superclass;e&&e.proto(),Ml.has(this)&&this.PrototypeMixin.apply(t)}return t}static toString(){return`<${Xa(this)||"(unknown)"}:constructor>`}static isClass=!0;static isMethod=!1;static _onLookup;static _lazyInjections};function zl(...t){let e={};for(let n of t){let t=Object.keys(n);for(let r=0,i=t.length;r<i;r++){let i=t[r];e[i]=n[i]}}return e}var Dl=a({default:()=>jl}),jl=_l.create({get(t){return hr(this,t)},getProperties(...t){return zr(this,...t)},set(t,e){return mr(this,t,e)},setProperties(t){return Dr(this,t)},beginPropertyChanges(){return Vn(),this},endPropertyChanges(){return Wn(),this},notifyPropertyChange(t){return qn(this,t),this},addObserver(t,e,n,r){return pn(this,t,e,n,r),this},removeObserver(t,e,n,r){return fn(this,t,e,n,r),this},hasObserverFor(t){return an(this,`${t}:change`)},incrementProperty(t,e=1){return mr(this,t,(parseFloat(hr(this,t))||0)+e)},decrementProperty(t,e=1){return mr(this,t,(hr(this,t)||0)-e)},toggleProperty(t){return mr(this,t,!hr(this,t))},cacheFor(t){let e=w(this);return null!==e?e.valueFor(t):void 0}}),Ul=a({action:()=>Vl,computed:()=>Xn,default:()=>Bl,defineProperty:()=>Dn,get:()=>hr,getProperties:()=>zr,notifyPropertyChange:()=>qn,observer:()=>Wl,set:()=>mr,setProperties:()=>Dr,trySet:()=>vr}),Bl=class extends(Fl.extend(jl)){get _debugContainerKey(){let t=Xa(this);return void 0!==t&&t.fullName}},$l=new WeakMap;function ql(t,e,n){var r;if(null!=(r=t)&&void 0!==r.constructor&&"function"==typeof r.constructor.proto&&t.constructor.proto(),!Object.prototype.hasOwnProperty.call(t,"actions")){let e=t.actions;t.actions=e?Object.assign({},e):{}}return t.actions[e]=n,{get(){let t=$l.get(this);void 0===t&&(t=new Map,$l.set(this,t));let e=t.get(n);return void 0===e&&(e=n.bind(this),t.set(n,e)),e}}}function Vl(...t){let e;if(!C(t)){e=t[0];let n=function(t,n){return ql(t,n,e)};return O(n),n}let[n,r,i]=t;return e=i?.value,ql(n,r,e)}function Wl(...t){let e,n,r,i=t.pop();"function"==typeof i?(e=i,n=t,r=!N._DEFAULT_ASYNC_OBSERVERS):(e=i.fn,n=i.dependentKeys,r=i.sync);let s=[];for(let o of n)Fn(o,t=>s.push(t));return Je(e,{paths:s,sync:r}),e}function Hl(t){if(!(t instanceof MouseEvent))return!1;let e=t.shiftKey||t.metaKey||t.altKey||t.ctrlKey,n=0!==t.button;return!e&&!n}function Gl(t){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: "'+t+'"'}function Zl(t){let e=t.lookup("-view-registry:main"),n=[];return Object.keys(e).forEach(t=>{let r=e[t];null===r.parentView&&n.push(r)}),n}function Kl(t){return""!==t.tagName&&t.elementId?t.elementId:ll(t)}O(Vl);var Yl=new WeakMap,Xl=new WeakMap;function Jl(t){return Yl.get(t)||null}function Ql(t){return Xl.get(t)||null}function tc(t,e){Yl.set(t,e)}function ec(t,e){Xl.set(t,e)}function nc(t){Yl.delete(t)}function rc(t){Xl.delete(t)}var ic=new WeakMap;function sc(t){return function(t,e){let n=[],r=ic.get(t);return void 0!==r&&r.forEach(t=>{let r=e[t];!r||r.isDestroying||r.isDestroyed||n.push(r)}),n}(t,Br(t).lookup("-view-registry:main"))}function oc(t,e){let n=ic.get(t);void 0===n&&(n=function(t){let e=new Set;return ic.set(t,e),e}(t)),n.add(Kl(e))}function ac(t){return t.renderer.getBounds(t)}function lc(t){let e=ac(t),n=document.createRange();return n.setStartBefore(e.firstNode),n.setEndAfter(e.lastNode),n}function cc(t){return lc(t).getClientRects()}function uc(t){return lc(t).getBoundingClientRect()}var hc="ember-application",dc=class extends Bl{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(t,e){let n=this.finalEventNameMapping={...hr(this,"events"),...t};this._reverseEventNameMapping=Object.keys(n).reduce((t,e)=>{let r=n[e];return r?{...t,[r]:e}:t},{});let r=this.lazyEvents;null!=e&&mr(this,"rootElement",e);let i=hr(this,"rootElement"),s="string"!=typeof i?i:document.querySelector(i);s.classList.add(hc),this._sanitizedRootElement=s;for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&r.set(o,n[o]??null);this._didSetup=!0}setupHandlerForBrowserEvent(t){this.setupHandler(this._sanitizedRootElement,t,this.finalEventNameMapping[t]??null)}setupHandlerForEmberEvent(t){let e=this._reverseEventNameMapping?.[t];e&&this.setupHandler(this._sanitizedRootElement,e,t)}setupHandler(t,e,n){if(null===n||!this.lazyEvents.has(e))return;let r=(t,e)=>{let r=Jl(t),i=!0;return r&&(i=r.handleEvent(n,e)),i},i=this._eventHandlers[e]=t=>{let e=t.target;do{if(Jl(e)){if(!1===r(e,t)){t.preventDefault(),t.stopPropagation();break}if(!0===t.cancelBubble)break}e=e.parentNode}while(e instanceof Element)};t.addEventListener(e,i),this.lazyEvents.delete(e)}destroy(){if(!1===this._didSetup)return;let t=this._sanitizedRootElement;if(t){for(let e in this._eventHandlers)t.removeEventListener(e,this._eventHandlers[e]);return t.classList.remove(hc),this._super(...arguments)}}toString(){return"(EventDispatcher)"}},pc=/^[^:]+:[^:]+$/,fc=class{_failSet;resolver;fallback;registrations;_normalizeCache;_options;_resolveCache;_typeOptions;constructor(t={}){this.fallback=t.fallback||null,this.resolver=t.resolver||null,this.registrations=Mo(t.registrations||null),this._normalizeCache=Mo(null),this._resolveCache=Mo(null),this._failSet=new Set,this._options=Mo(null),this._typeOptions=Mo(null)}container(t){return new Va(this,t)}register(t,e,n={}){let r=this.normalize(t);this._failSet.delete(r),this.registrations[r]=e,this._options[r]=n}unregister(t){let e=this.normalize(t);delete this.registrations[e],delete this._resolveCache[e],delete this._options[e],this._failSet.delete(e)}resolve(t){let e=function(t,e){let n,r=e,i=t._resolveCache[r];return void 0!==i?i:t._failSet.has(r)?void 0:(t.resolver&&(n=t.resolver.resolve(r)),void 0===n&&(n=t.registrations[r]),void 0===n?t._failSet.add(r):t._resolveCache[r]=n,n)}(this,this.normalize(t));return void 0===e&&null!==this.fallback&&(e=this.fallback.resolve(t)),e}describe(t){return null!==this.resolver&&this.resolver.lookupDescription?this.resolver.lookupDescription(t):null!==this.fallback?this.fallback.describe(t):t}normalizeFullName(t){return null!==this.resolver&&this.resolver.normalize?this.resolver.normalize(t):null!==this.fallback?this.fallback.normalizeFullName(t):t}normalize(t){return this._normalizeCache[t]||(this._normalizeCache[t]=this.normalizeFullName(t))}makeToString(t,e){return null!==this.resolver&&this.resolver.makeToString?this.resolver.makeToString(t,e):null!==this.fallback?this.fallback.makeToString(t,e):"string"==typeof t?t:t.name??"(unknown class)"}has(t){return!!this.isValidFullName(t)&&function(t,e){return void 0!==t.resolve(e)}(this,this.normalize(t))}optionsForType(t,e){this._typeOptions[t]=e}getOptionsForType(t){let e=this._typeOptions[t];return void 0===e&&null!==this.fallback&&(e=this.fallback.getOptionsForType(t)),e}options(t,e){let n=this.normalize(t);this._options[n]=e}getOptions(t){let e=this.normalize(t),n=this._options[e];return void 0===n&&null!==this.fallback&&(n=this.fallback.getOptions(t)),n}getOption(t,e){let n=this._options[t];if(void 0!==n&&void 0!==n[e])return n[e];let r=t.split(":")[0];return n=this._typeOptions[r],n&&void 0!==n[e]?n[e]:null!==this.fallback?this.fallback.getOption(t,e):void 0}knownForType(t){let e,n,r=Mo(null),i=Object.keys(this.registrations);for(let s of i)s.split(":")[0]===t&&(r[s]=!0);return null!==this.fallback&&(e=this.fallback.knownForType(t)),null!==this.resolver&&this.resolver.knownForType&&(n=this.resolver.knownForType(t)),Object.assign({},e,r,n)}isValidFullName(t){return pc.test(t)}},gc=Mo(null),mc=`${Math.random()}${Date.now()}`.replace(".","");function yc([t]){let e=gc[t];if(e)return e;let[n,r]=t.split(":");return gc[t]=tl(`${n}:${r}-${mc}`)}var vc=a({default:()=>bc,on:()=>ln}),bc=_l.create({on(t,e,n){return rn(this,t,e,n),this},one(t,e,n){return rn(this,t,e,n,!0),this},trigger(t,...e){on(this,t,e)},off(t,e,n){return sn(this,t,e,n),this},has(t){return an(this,t)}}),wc=_l.create(),_c=a({default:()=>xc}),xc=_l.create(wc),Cc={"[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:Sc}=Object.prototype;function kc(t){if(null===t)return"null";if(void 0===t)return"undefined";let e=Cc[Sc.call(t)]||"object";return"function"===e?Fl.detect(t)&&(e="class"):"object"===e&&(t instanceof Error?e="error":t instanceof Fl?e="instance":t instanceof Date&&(e="date")),e}var Ec=_l.create({compare:null}),Rc={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 Tc(t,e){return Math.sign(t-e)}function Lc(t,e){if(t===e)return 0;let n=kc(t),r=kc(e);if("instance"===n&&Ic(t)&&t.constructor.compare)return t.constructor.compare(t,e);if("instance"===r&&Ic(e)&&e.constructor.compare)return-1*e.constructor.compare(e,t);let i=Tc(Rc[n],Rc[r]);if(0!==i)return i;switch(n){case"boolean":return Tc(Number(t),Number(e));case"number":return Tc(t,e);case"string":return Tc(t.localeCompare(e),0);case"array":{let n=t.length,r=e.length,i=Math.min(n,r);for(let s=0;s<i;s++){let n=Lc(t[s],e[s]);if(0!==n)return n}return Tc(n,r)}case"instance":return Ic(t)&&t.compare?t.compare(t,e):0;case"date":return Tc(t.getTime(),e.getTime());default:return 0}}function Ic(t){return Ec.detect(t)}function Pc(t){if(!t||t.setInterval)return!1;if(Array.isArray(t)||sr(t))return!0;let e=kc(t);if("array"===e)return!0;let n=t.length;return"number"==typeof n&&n==n&&"object"===e}var Mc=a({A:()=>Yc,MutableArray:()=>Gc,NativeArray:()=>Zc,default:()=>Hc,isArray:()=>Pc,makeArray:()=>Rl,removeAt:()=>$c,uniqBy:()=>Nc}),Ac=Object.freeze([]),Oc=t=>t;function Nc(t,e=Oc){let n=Yc(),r=new Set,i="function"==typeof e?e:t=>hr(t,e);return t.forEach(t=>{let e=i(t);r.has(e)||(r.add(e),n.push(t))}),n}function Fc(...t){let e=2===t.length,[n,r]=t;return e?t=>r===hr(t,n):t=>Boolean(hr(t,n))}function zc(t,e,n){let r=t.length;for(let i=n;i<r;i++)if(e(Me(t,i),i,t))return i;return-1}function Dc(t,e,n=null){let r=zc(t,e.bind(n),0);return-1===r?void 0:Me(t,r)}function jc(t,e,n=null){return-1!==zc(t,e.bind(n),0)}function Uc(t,e,n=null){let r=e.bind(n);return-1===zc(t,(t,e,n)=>!r(t,e,n),0)}function Bc(t,e,n=0,r){let i=t.length;return n<0&&(n+=i),zc(t,r&&e!=e?t=>t!=t:t=>t===e,n)}function $c(t,e,n){return Rr(t,e,n??1,Ac),t}function qc(t,e,n){return Rr(t,e,0,[n]),n}function Vc(t){let e=Xn(t);return e.enumerable=!1,e}function Wc(t){return this.map(e=>hr(e,t))}var Hc=_l.create(wc,{init(){this._super(...arguments),ir.add(this)},objectsAt(t){return t.map(t=>Me(this,t))},"[]":Vc({get(){return this},set(t,e){return this.replace(0,this.length,e),this}}),firstObject:Vc(function(){return Me(this,0)}).readOnly(),lastObject:Vc(function(){return Me(this,this.length-1)}).readOnly(),slice(t=0,e){let n,r=Yc(),i=this.length;for(t<0&&(t=i+t),n=void 0===e||e>i?i:e<0?i+e:e;t<n;)r[r.length]=Me(this,t++);return r},indexOf(t,e){return Bc(this,t,e,!1)},lastIndexOf(t,e){let n=this.length;(void 0===e||e>=n)&&(e=n-1),e<0&&(e+=n);for(let r=e;r>=0;r--)if(Me(this,r)===t)return r;return-1},forEach(t,e=null){let n=this.length;for(let r=0;r<n;r++){let n=this.objectAt(r);t.call(e,n,r,this)}return this},getEach:Wc,setEach(t,e){return this.forEach(n=>mr(n,t,e))},map(t,e=null){let n=Yc();return this.forEach((r,i,s)=>n[i]=t.call(e,r,i,s)),n},mapBy:Wc,filter(t,e=null){let n=Yc();return this.forEach((r,i,s)=>{t.call(e,r,i,s)&&n.push(r)}),n},reject(t,e=null){return this.filter(function(){return!t.apply(e,arguments)})},filterBy(){return this.filter(Fc(...arguments))},rejectBy(){return this.reject(Fc(...arguments))},find(t,e=null){return Dc(this,t,e)},findBy(){return Dc(this,Fc(...arguments))},every(t,e=null){return Uc(this,t,e)},isEvery(){return Uc(this,Fc(...arguments))},any(t,e=null){return jc(this,t,e)},isAny(){return jc(this,Fc(...arguments))},reduce(t,e){let n=e,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=t(n,this.objectAt(i),i,this);return n},invoke(t,...e){let n=Yc();return this.forEach(r=>n.push(r[t]?.(...e))),n},toArray(){return this.map(t=>t)},compact(){return this.filter(t=>null!=t)},includes(t,e){return-1!==Bc(this,t,e,!0)},sortBy(){let t=arguments;return this.toArray().sort((e,n)=>{for(let r=0;r<t.length;r++){let i=t[r],s=Lc(hr(e,i),hr(n,i));if(s)return s}return 0})},uniq(){return Nc(this)},uniqBy(t){return Nc(this,t)},without(t){if(!this.includes(t))return this;let e=t==t?e=>e!==t:t=>t==t;return this.filter(e)}}),Gc=_l.create(Hc,xc,{clear(){let t=this.length;return 0===t||this.replace(0,t,Ac),this},insertAt(t,e){return qc(this,t,e),this},removeAt(t,e){return $c(this,t,e)},pushObject(t){return qc(this,this.length,t)},pushObjects(t){return this.replace(this.length,0,t),this},popObject(){let t=this.length;if(0===t)return null;let e=Me(this,t-1);return this.removeAt(t-1,1),e},shiftObject(){if(0===this.length)return null;let t=Me(this,0);return this.removeAt(0),t},unshiftObject(t){return qc(this,0,t)},unshiftObjects(t){return this.replace(0,0,t),this},reverseObjects(){let t=this.length;if(0===t)return this;let e=this.toArray().reverse();return this.replace(0,t,e),this},setObjects(t){if(0===t.length)return this.clear();let e=this.length;return this.replace(0,e,t),this},removeObject(t){let e=this.length||0;for(;--e>=0;)Me(this,e)===t&&this.removeAt(e);return this},removeObjects(t){Vn();for(let e=t.length-1;e>=0;e--)this.removeObject(t[e]);return Wn(),this},addObject(t){return this.includes(t)||this.pushObject(t),this},addObjects(t){return Vn(),t.forEach(t=>this.addObject(t)),Wn(),this}}),Zc=_l.create(Gc,jl,{objectAt(t){return this[t]},replace(t,e,n=Ac){return Lr(this,t,e,n),this}}),Kc=["length"];Zc.keys().forEach(t=>{Array.prototype[t]&&Kc.push(t)}),Zc=Zc.without(...Kc);var Yc=function(t){return sr(t)?t:Zc.apply(t??[])},Xc=class extends Bl{},Jc=a({ControllerMixin:()=>tu,default:()=>eu,inject:()=>nu}),Qc=Symbol("MODEL"),tu=_l.create(kl,{isController:!0,concatenatedProperties:["queryParams"],target:null,store:null,init(){this._super(...arguments);let t=Br(this);t&&(this.namespace=t.lookup("application:main"),this.target=t.lookup("router:main"))},model:Xn({get(){return this[Qc]},set(t,e){return this[Qc]=e}}),queryParams:null,_qpDelegate:null,_qpChanged(t,e){let n=e.indexOf(".[]"),r=-1===n?e:e.slice(0,n);(0,t._qpDelegate)(r,hr(t,r))}}),eu=class extends(Xc.extend(tu)){};function nu(...t){return qr("controller",...t)}var ru=!1;function iu(){return ru}function su(t){ru=Boolean(t)}var ou=Symbol("ENGINE_PARENT");function au(t){return t[ou]}var lu=_l.create({__container__:null,ownerInjection(){return this.__container__.ownerInjection()},lookup(t,e){return this.__container__.lookup(t,e)},destroy(){let t=this.__container__;t&&xs(()=>{t.destroy(),Es("destroy",t,"finalizeDestroy")}),this._super()},factoryFor(t){return this.__container__.factoryFor(t)}}),cu=_l.create({__registry__:null,resolveRegistration(t){return this.__registry__.resolve(t)},register:uu("register"),unregister:uu("unregister"),hasRegistration:uu("has"),registeredOption:uu("getOption"),registerOptions:uu("options"),registeredOptions:uu("getOptions"),registerOptionsForType:uu("optionsForType"),registeredOptionsForType:uu("getOptionsForType")});function uu(t){return function(...e){return this.__registry__[t](...e)}}var hu=class extends(Bl.extend(cu,lu)){static setupRegistry(t,e){}[ou];_booted=!1;init(t){super.init(t),ll(this),this.base??=this.application;let e=this.__registry__=new fc({fallback:this.base.__registry__});this.__container__=e.container({owner:this}),this._booted=!1}_bootPromise=null;boot(t){return this._bootPromise||(this._bootPromise=new $a.Promise(e=>{e(this._bootSync(t))})),this._bootPromise}_bootSync(t){return this._booted||(this.cloneParentDependencies(),this.setupRegistry(t),this.base.runInstanceInitializers(this),this._booted=!0),this}setupRegistry(t=this.__container__.lookup("-environment:main")){this.constructor.setupRegistry(this.__registry__,t)}unregister(t){this.__container__.reset(t),this.__registry__.unregister(t)}buildChildEngineInstance(t,e={}){let n=this.lookup(`engine:${t}`);if(!n)throw new Error(`You attempted to mount the engine '${t}', but it is not registered with its parent.`);let r=n.buildInstance(e);return r[ou]=this,r}cloneParentDependencies(){const t=au(this);["route:basic","service:-routing"].forEach(e=>{let n=t.resolveRegistration(e);this.register(e,n)});let e=t.lookup("-environment:main");this.register("-environment:main",e,{instantiate:!1});let n=["router:main",yc`-bucket-cache:main`,"-view-registry:main","renderer:-dom","service:-document"];e.isInteractive&&n.push("event_dispatcher:main"),n.forEach(e=>{let n=t.lookup(e);this.register(e,n,{instantiate:!1})})}},du=function(t,e,n){let{get:r}=n;return void 0!==r&&(n.get=function(){let t,n=Kt(this,e),i=Vt(()=>{t=r.call(this)});return ft(n,i),Ft(i),t}),n};function pu(...t){if(C(t)){let[e,n,r]=t;return du(0,n,r)}{const e=t[0];let n=function(t,n){return du(0,n,e)};return O(n),n}}O(pu);var fu={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},gu=fu.Empty;function mu(t){return gu|yu(t,"dynamicLayout")|yu(t,"dynamicTag")|yu(t,"prepareArgs")|yu(t,"createArgs")|yu(t,"attributeHook")|yu(t,"elementHook")|yu(t,"dynamicScope")|yu(t,"createCaller")|yu(t,"updateHook")|yu(t,"createInstance")|yu(t,"wrapped")|yu(t,"willDestroy")|yu(t,"hasSubOwner")}function yu(t,e){return t[e]?fu[e]:gu}function vu(t,e,n){return!!(e&n)}function bu(t,e){return!!(t&e)}function wu(t,e={}){return{hasValue:Boolean(e.hasValue),hasDestroyable:Boolean(e.hasDestroyable),hasScheduledEffect:Boolean(e.hasScheduledEffect)}}function _u(t){return t.capabilities.hasValue}function xu(t){return t.capabilities.hasDestroyable}var Cu=class{constructor(t){this.factory=t}helperManagerDelegates=new WeakMap;undefinedDelegate=null;getDelegateForOwner(t){let e=this.helperManagerDelegates.get(t);if(void 0===e){let{factory:n}=this;e=n(t),this.helperManagerDelegates.set(t,e)}return e}getDelegateFor(t){if(void 0===t){let{undefinedDelegate:t}=this;if(null===t){let{factory:e}=this;this.undefinedDelegate=t=e(void 0)}return t}return this.getDelegateForOwner(t)}getHelper(t){return(e,n)=>{let r=this.getDelegateFor(n);const i=Pe(e),s=r.createHelper(t,i);if(_u(r)){let t=ge(()=>r.getValue(s),null);return xu(r)&&tt(t,r.getDestroyable(s)),t}if(xu(r)){let t=pe(void 0);return tt(t,r.getDestroyable(s)),t}return ce}}},Su=class{capabilities={hasValue:!0,hasDestroyable:!1,hasScheduledEffect:!1};createHelper(t,e){return{fn:t,args:e}}getValue({fn:t,args:e}){return Object.keys(e.named).length>0?t(...e.positional,e.named):t(...e.positional)}getDebugName(t){return t.name?`(helper function ${t.name})`:"(anonymous helper function)"}},ku=new WeakMap,Eu=new WeakMap,Ru=new WeakMap,Tu=Object.getPrototypeOf;function Lu(t,e,n){return t.set(n,e),n}function Iu(t,e){let n=e;for(;null!==n;){const e=t.get(n);if(void 0!==e)return e;n=Tu(n)}}function Pu(t,e){return Lu(Eu,t,e)}function Mu(t){const e=Iu(Eu,t);return void 0===e?null:e}function Au(t,e){return Lu(Ru,t,e)}var Ou=new Cu(()=>new Su);function Nu(t){let e=Iu(Ru,t);return void 0===e&&"function"==typeof t&&(e=Ou),e||null}function Fu(t,e){return Lu(ku,t,e)}function zu(t){const e=Iu(ku,t);return void 0===e?null:e}function Du(t){return void 0!==Iu(ku,t)}function ju(t){return function(t){return"function"==typeof t}(t)||void 0!==Iu(Ru,t)}function Uu(t){return void 0!==Iu(Eu,t)}var Bu=Object.create;function $u(){var t=Bu(null);return t.__=void 0,delete t.__,t}var qu=function(t,e,n){this.path=t,this.matcher=e,this.delegate=n};qu.prototype.to=function(t,e){var n=this.delegate;if(n&&n.willAddRoute&&(t=n.willAddRoute(this.matcher.target,t)),this.matcher.add(this.path,t),e){if(0===e.length)throw new Error("You must have an argument in the function passed to `to`");this.matcher.addChild(this.path,t,e,this.delegate)}};var Vu=function(t){this.routes=$u(),this.children=$u(),this.target=t};function Wu(t,e,n){return function(r,i){var s=t+r;if(!i)return new qu(s,e,n);i(Wu(s,e,n))}}function Hu(t,e,n){for(var r=0,i=0;i<t.length;i++)r+=t[i].path.length;var s={path:e=e.substr(r),handler:n};t.push(s)}function Gu(t,e,n,r){for(var i=e.routes,s=Object.keys(i),o=0;o<s.length;o++){var a=s[o],l=t.slice();Hu(l,a,i[a]);var c=e.children[a];c?Gu(l,c,n,r):n.call(r,l)}}function Zu(t){return t.split("/").map(Yu).join("/")}Vu.prototype.add=function(t,e){this.routes[t]=e},Vu.prototype.addChild=function(t,e,n,r){var i=new Vu(e);this.children[t]=i;var s=Wu(t,i,r);r&&r.contextEntered&&r.contextEntered(e,s),n(s)};var Ku=/%|\//g;function Yu(t){return t.length<3||-1===t.indexOf("%")?t:decodeURIComponent(t).replace(Ku,encodeURIComponent)}var Xu=/%(?:2(?:4|6|B|C)|3(?:B|D|A)|40)/g;function Ju(t){return encodeURIComponent(t).replace(Xu,decodeURIComponent)}var Qu=/(\/|\.|\*|\+|\?|\||\(|\)|\[|\]|\{|\}|\\)/g,th=Array.isArray,eh=Object.prototype.hasOwnProperty;function nh(t,e){if("object"!=typeof t||null===t)throw new Error("You must pass an object as the second argument to `generate`.");if(!eh.call(t,e))throw new Error("You must provide param `"+e+"` to `generate`.");var n=t[e],r="string"==typeof n?n:""+n;if(0===r.length)throw new Error("You must provide a param `"+e+"`.");return r}var rh=[];rh[0]=function(t,e){for(var n=e,r=t.value,i=0;i<r.length;i++){var s=r.charCodeAt(i);n=n.put(s,!1,!1)}return n},rh[1]=function(t,e){return e.put(47,!0,!0)},rh[2]=function(t,e){return e.put(-1,!1,!0)},rh[4]=function(t,e){return e};var ih=[];ih[0]=function(t){return t.value.replace(Qu,"\\$1")},ih[1]=function(){return"([^/]+)"},ih[2]=function(){return"(.+)"},ih[4]=function(){return""};var sh=[];sh[0]=function(t){return t.value},sh[1]=function(t,e){var n=nh(e,t.value);return gh.ENCODE_AND_DECODE_PATH_SEGMENTS?Ju(n):n},sh[2]=function(t,e){return nh(e,t.value)},sh[4]=function(){return""};var oh=Object.freeze({}),ah=Object.freeze([]);function lh(t,e,n){e.length>0&&47===e.charCodeAt(0)&&(e=e.substr(1));for(var r=e.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]++,t.push({type:l,value:Yu(c)})}return{names:i||ah,shouldDecodes:s||ah}}function ch(t,e,n){return t.char===e&&t.negate===n}var uh=function(t,e,n,r,i){this.states=t,this.id=e,this.char=n,this.negate=r,this.nextStates=i?e:null,this.pattern="",this._regex=void 0,this.handlers=void 0,this.types=void 0};function hh(t,e){return t.negate?t.char!==e&&-1!==t.char:t.char===e||-1===t.char}function dh(t,e){for(var n=[],r=0,i=t.length;r<i;r++){var s=t[r];n=n.concat(s.match(e))}return n}uh.prototype.regex=function(){return this._regex||(this._regex=new RegExp(this.pattern)),this._regex},uh.prototype.get=function(t,e){var n=this.nextStates;if(null!==n)if(th(n))for(var r=0;r<n.length;r++){var i=this.states[n[r]];if(ch(i,t,e))return i}else{var s=this.states[n];if(ch(s,t,e))return s}},uh.prototype.put=function(t,e,n){var r;if(r=this.get(t,e))return r;var i=this.states;return r=new uh(i,i.length,t,e,n),i[i.length]=r,null==this.nextStates?this.nextStates=r.id:th(this.nextStates)?this.nextStates.push(r.id):this.nextStates=[this.nextStates,r.id],r},uh.prototype.match=function(t){var e=this.nextStates;if(!e)return[];var n=[];if(th(e))for(var r=0;r<e.length;r++){var i=this.states[e[r]];hh(i,t)&&n.push(i)}else{var s=this.states[e];hh(s,t)&&n.push(s)}return n};var ph=function(t){this.length=0,this.queryParams=t||{}};function fh(t){var e;t=t.replace(/\+/gm,"%20");try{e=decodeURIComponent(t)}catch(d8){e=""}return e}ph.prototype.splice=Array.prototype.splice,ph.prototype.slice=Array.prototype.slice,ph.prototype.push=Array.prototype.push;var gh=function(){this.names=$u();var t=[],e=new uh(t,0,-1,!0,!1);t[0]=e,this.states=t,this.rootState=e};function mh(){let t=new Error("TransitionAborted");return t.name="TransitionAborted",t.code="TRANSITION_ABORTED",t}function yh(t){if("object"==typeof(e=t)&&null!==e&&"boolean"==typeof e.isAborted&&t.isAborted)throw mh();var e}gh.prototype.add=function(t,e){for(var n,r=this.rootState,i="^",s=[0,0,0],o=new Array(t.length),a=[],l=!0,c=0,u=0;u<t.length;u++){for(var h=t[u],d=lh(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=rh[g.type](g,r),i+=ih[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 e&&null!==e&&e.as&&(n=e.as),n&&(this.names[n]={segments:a,handlers:o})},gh.prototype.handlersFor=function(t){var e=this.names[t];if(!e)throw new Error("There is no route named "+t);for(var n=new Array(e.handlers.length),r=0;r<e.handlers.length;r++){var i=e.handlers[r];n[r]=i}return n},gh.prototype.hasRoute=function(t){return!!this.names[t]},gh.prototype.generate=function(t,e){var n=this.names[t],r="";if(!n)throw new Error("There is no route named "+t);for(var i=n.segments,s=0;s<i.length;s++){var o=i[s];4!==o.type&&(r+="/",r+=sh[o.type](o,e))}return"/"!==r.charAt(0)&&(r="/"+r),e&&e.queryParams&&(r+=this.generateQueryString(e.queryParams)),r},gh.prototype.generateQueryString=function(t){var e=[],n=Object.keys(t);n.sort();for(var r=0;r<n.length;r++){var i=n[r],s=t[i];if(null!=s){var o=encodeURIComponent(i);if(th(s))for(var a=0;a<s.length;a++){var l=i+"[]="+encodeURIComponent(s[a]);e.push(l)}else o+="="+encodeURIComponent(s),e.push(o)}}return 0===e.length?"":"?"+e.join("&")},gh.prototype.parseQueryString=function(t){for(var e=t.split("&"),n={},r=0;r<e.length;r++){var i=e[r].split("="),s=fh(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]?fh(i[1]):""),a?n[s].push(l):n[s]=l}return n},gh.prototype.recognize=function(t){var e,n=[this.rootState],r={},i=!1,s=t.indexOf("#");-1!==s&&(t=t.substr(0,s));var o=t.indexOf("?");if(-1!==o){var a=t.substr(o+1,t.length);t=t.substr(0,o),r=this.parseQueryString(a)}"/"!==t.charAt(0)&&(t="/"+t);var l=t;gh.ENCODE_AND_DECODE_PATH_SEGMENTS?t=Zu(t):(t=decodeURI(t),l=decodeURI(l));var c=t.length;c>1&&"/"===t.charAt(c-1)&&(t=t.substr(0,c-1),l=l.substr(0,l.length-1),i=!0);for(var u=0;u<t.length&&(n=dh(n,t.charCodeAt(u))).length;u++);for(var h=[],d=0;d<n.length;d++)n[d].handlers&&h.push(n[d]);n=function(t){return t.sort(function(t,e){var n=t.types||[0,0,0],r=n[0],i=n[1],s=n[2],o=e.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+="/"),e=function(t,e,n){var r=t.handlers,i=t.regex();if(!i||!r)throw new Error("state not initialized");var s=e.match(i),o=1,a=new ph(n);a.length=r.length;for(var l=0;l<r.length;l++){var c=r[l],u=c.names,h=c.shouldDecodes,d=oh,p=!1;if(u!==ah&&h!==ah)for(var f=0;f<u.length;f++){p=!0;var g=u[f],m=s&&s[o++];d===oh&&(d={}),gh.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)),e},gh.VERSION="0.3.4",gh.ENCODE_AND_DECODE_PATH_SEGMENTS=!0,gh.Normalizer={normalizeSegment:Yu,normalizePath:Zu,encodePathSegment:Ju},gh.prototype.map=function(t,e){var n=new Vu;t(Wu("",n,this.delegate)),Gu([],n,function(t){e?e(this,t):this.add(t)},this)};var vh=Array.prototype.slice,bh=Object.prototype.hasOwnProperty;function wh(t,e){for(let n in e)bh.call(e,n)&&(t[n]=e[n])}function _h(t){let e,n,r=t&&t.length;if(r&&r>0){let i=t[r-1];if(function(t){if(t&&"object"==typeof t){let e=t;return"queryParams"in e&&Object.keys(e.queryParams).every(t=>"string"==typeof t)}return!1}(i))return n=i.queryParams,e=vh.call(t,0,r-1),[e,n]}return[t,null]}function xh(t){for(let e in t){let n=t[e];if("number"==typeof n)t[e]=String(n);else if(Array.isArray(n))for(let t=0,e=n.length;t<e;t++)n[t]=String(n[t])}}function Ch(t,...e){if(t.log)if(2===e.length){let[n,r]=e;t.log("Transition #"+n+": "+r)}else{let[n]=e;t.log(n)}}function Sh(t){return"string"==typeof t||t instanceof String||"number"==typeof t||t instanceof Number}function kh(t,e){for(let n=0,r=t.length;n<r&&!1!==e(t[n]);n++);}function Eh(t,e){let n,r={all:{},changed:{},removed:{}};wh(r.all,e);let i=!1;for(n in xh(t),xh(e),t)bh.call(t,n)&&(bh.call(e,n)||(i=!0,r.removed[n]=t[n]));for(n in e)if(bh.call(e,n)){let s=t[n],o=e[n];if(Rh(s)&&Rh(o))if(s.length!==o.length)r.changed[n]=e[n],i=!0;else for(let t=0,a=s.length;t<a;t++)s[t]!==o[t]&&(r.changed[n]=e[n],i=!0);else t[n]!==e[n]&&(r.changed[n]=e[n],i=!0)}return i?r:void 0}function Rh(t){return Array.isArray(t)}function Th(t){return"Router: "+t}var Lh="__STATE__-2619860001345920-3322w3",Ih="__PARAMS__-261986232992830203-23323",Ph="__QPS__-2619863929824844-32323",Mh="__RDS__-2619863929824844-32323",Ah=class t{[Lh];from=null;to=void 0;router;data;intent;resolvedModels;[Ph];promise;error;[Ih];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;[Mh];constructor(t,e,n,r,i){if(this[Lh]=n||t.state,this.intent=e,this.router=t,this.data=e&&e.data||{},this.resolvedModels={},this[Ph]={},this.promise=void 0,this.error=void 0,this[Ih]={},this.routeInfos=[],this.targetName=void 0,this.pivotHandler=void 0,this.sequence=-1,r)return this.promise=ia.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[Ih]=n.params,this[Ph]=n.queryParams,this.routeInfos=n.routeInfos;let e=n.routeInfos.length;e&&(this.targetName=n.routeInfos[e-1].name);for(let t=0;t<e;++t){let e=n.routeInfos[t];if(!e.isResolved)break;this.pivotHandler=e.route}this.sequence=t.currentSequence++,this.promise=n.resolve(this).catch(t=>{throw this.router.transitionDidError(t,this)},Th("Handle Abort"))}else this.promise=ia.resolve(this[Lh]),this[Ih]={}}then(t,e,n){return this.promise.then(t,e,n)}catch(t,e){return this.promise.catch(t,e)}finally(t,e){return this.promise.finally(t,e)}abort(){this.rollback();let e=new t(this.router,void 0,void 0,void 0);return e.to=this.from,e.from=this.from,e.isAborted=!0,this.router.routeWillChange(e),this.router.routeDidChange(e),this}rollback(){this.isAborted||(Ch(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(t){this[Mh]=t,this.rollback(),this.router.routeWillChange(t)}retry(){this.abort();let t=this.router.transitionByIntent(this.intent,!1);return null!==this.urlMethod&&t.method(this.urlMethod),t}method(t){return this.urlMethod=t,this}send(t=!1,e,n,r,i){this.trigger(t,e,n,r,i)}trigger(t=!1,e,...n){"string"==typeof t&&(e=t,t=!1),this.router.triggerEvent(this[Lh].routeInfos.slice(0,this.resolveIndex+1),t,e,n)}followRedirects(){return this.promise.catch(t=>this[Mh]?this[Mh].followRedirects():ia.reject(t))}toString(){return"Transition (sequence "+this.sequence+")"}log(t){Ch(this.router,this.sequence,t)}};function Oh(t){return Ch(t.router,t.sequence,"detected abort."),mh()}function Nh(t){return"object"==typeof t&&t instanceof Ah&&t.isTransition}var Fh=function(){function t(e){let n=Error.call(this,e);this.name="UnrecognizedURLError",this.message=e||"UnrecognizedURL",Error.captureStackTrace?Error.captureStackTrace(this,t):this.stack=n.stack}return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}();function zh(t,e){let n=t.factoryFor("controller:basic").class;n=class extends n{toString(){return`(generated ${e} controller)`}};let r=`controller:${e}`;return t.register(r,n),t.factoryFor(r)}function Dh(t,e){zh(t,e);let n=`controller:${e}`;return t.lookup(n)}var jh=/\./g;function Uh(t){let e,n,r=(t=t.slice())[t.length-1];return function(t){if(t&&"object"==typeof t){let e=t.queryParams;if(e&&"object"==typeof e)return Object.keys(e).every(t=>"string"==typeof t)}return!1}(r)?(t.pop(),e=r.queryParams):e={},"string"==typeof t[0]&&(n=t.shift()),{routeName:n,models:t,queryParams:e}}function Bh(t,e){if(e._namesStashed)return;let n,r=e[e.length-1].name,i=t._routerMicrolib.recognizer.handlersFor(r);for(let s=0;s<e.length;++s){let t=e[s],r=i[s].names;r.length&&(n=t),t._names=r,t.route._stashNames(t,n)}e._namesStashed=!0}function $h(t,e){let n=t.split("."),r="";for(let i=0;i<n.length;i++){let t=n.slice(0,i+1).join(".");if(0!==e.indexOf(t))break;r=t}return r}function qh(t,e=[],n){let r="";for(let i of e){let e,s=$h(t,i);if(n)if(s&&s in n){let t=0===i.indexOf(s)?i.substring(s.length+1):i;e=hr(n[s],t)}else e=hr(n,i);r+=`::${i}:${e}`}return t+r.replace(jh,"-")}function Vh(t,e){let n="string"==typeof t?{[t]:{as:null}}:t;for(let r in n){if(!Object.prototype.hasOwnProperty.call(n,r))return;let t=n[r],i="string"==typeof t?{as:t}:t;e[r]={...e[r]||{as:null,scope:"model"},...i}}}function Wh(t){return"string"==typeof t&&(""===t||"/"===t[0])}function Hh(t,e){let n=0,r=0;for(let i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(t[i]!==e[i])return!1;n++}for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&r++;return n===r}var Gh=new WeakMap;function Zh(t,e,n,r){let i={configurable:!0,enumerable:!0,writable:!0,initializer:null};r&&(i.initializer=r);for(let s of n)i=s(t,e,i)||i;void 0===i.initializer?Object.defineProperty(t,e,i):function(t,e,n){let r=Gh.get(t);r||(r=new Map,Gh.set(t,r)),r.set(e,n)}(t,e,i)}function Kh(t,e,n){let r={...Object.getOwnPropertyDescriptor(t,e)};for(let i of n)r=i(t,e,r)||r;void 0!==r.initializer&&(r.value=r.initializer?r.initializer.call(t):void 0,r.initializer=void 0),Object.defineProperty(t,e,r)}function Yh(t,e){let n=function(t,e){var n;let r=t.prototype;for(;r;){let t=null==(n=Gh.get(r))?void 0:n.get(e);if(t)return t;r=Object.getPrototypeOf(r)}}(t.constructor,e);n&&Object.defineProperty(t,e,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(t):void 0})}var Xh=Symbol("render"),Jh=Symbol("render-state"),Qh=class extends(Bl.extend(kl,bc)){static isRouteFactory=!0;context={};_bucketCache;_internalName;_names;_router;constructor(t){if(super(t),t){let e=t.lookup("router:main"),n=t.lookup(yc`-bucket-cache:main`);this._router=e,this._bucketCache=n,this._topLevelViewTemplate=t.lookup("template:-outlet"),this._environment=t.lookup("-environment:main")}}serialize(t,e){if(e.length<1||!t)return;let n={};if(1===e.length){let[r]=e;"object"==typeof t&&r in t?n[r]=hr(t,r):/_id$/.test(r)?n[r]=hr(t,"id"):nr(t)&&(n[r]=hr(t,r))}else n=zr(t,e);return n}_setRouteName(t){this.routeName=t;let e=Br(this);this.fullRouteName=id(e,t)}_stashNames(t,e){if(this._names)return;let n=this._names=t._names;n.length||(n=(t=e)&&t._names||[]);let r=hr(this,"_qp").qps,i=new Array(n.length);for(let s=0;s<n.length;++s)i[s]=`${t.name}.${n[s]}`;for(let s of r)"model"===s.scope&&(s.parts=i)}_activeQPChanged(t,e){this._router._activeQPChanged(t.scopedPropertyName,e)}_updatingQPChanged(t){this._router._updatingQPChanged(t.urlKey)}paramsFor(t){let e=Br(this).lookup(`route:${t}`);if(void 0===e)return{};let n=this._router._routerMicrolib.activeTransition,r=n?n[Lh]:this._router._routerMicrolib.state,i=e.fullRouteName,s={...r.params[i]},o=nd(e,r);return Object.entries(o).reduce((t,[e,n])=>(t[e]=n,t),s)}serializeQueryParamKey(t){return t}serializeQueryParam(t,e,n){return this._router._serializeQueryParam(t,n)}deserializeQueryParam(t,e,n){return this._router._deserializeQueryParam(t,n)}_optionsForQueryParam(t){const e=hr(this,"queryParams");return hr(e,t.urlKey)||hr(e,t.prop)||e[t.urlKey]||e[t.prop]||{}}resetController(t,e,n){return this}exit(t){this.deactivate(t),this.trigger("deactivate",t),this.teardownViews()}_internalReset(t,e){let n=this.controller;n._qpDelegate=hr(this,"_qp").states.inactive,this.resetController(n,t,e)}enter(t){this[Jh]=void 0,this.activate(t),this.trigger("activate",t)}deactivate(t){}activate(t){}intermediateTransitionTo(...t){let[e,...n]=function(t,e){let n,r=Br(t),i=r.mountPoint;if(r.routable&&"string"==typeof e[0]){if(n=e[0],Wh(n))throw new Error("Programmatic transitions by URL cannot be used within an Engine. Please use the route name instead.");n=`${i}.${n}`,e[0]=n}return e}(this,t);this._router.intermediateTransitionTo(e,...n)}refresh(){return this._router._routerMicrolib.refresh(this)}setup(t,e){let n=this.controllerName||this.routeName,r=this.controllerFor(n,!0)??this.generateController(n),i=hr(this,"_qp");if(!this.controller){let t=i.propertyNames;!function(t,e){e.forEach(e=>{if(void 0===P(t,e)){let n=gr(t,e);null===n||"function"!=typeof n.get&&"function"!=typeof n.set||Dn(t,e,pu({get:n.get,set:n.set}))}pn(t,`${e}.[]`,t,t._qpChanged,!1)})}(r,t),this.controller=r}if(r._qpDelegate=i.states.allowOverrides,e){Bh(this._router,e[Lh].routeInfos);let t=this._bucketCache,n=e[Ih];i.propertyNames.forEach(e=>{let s=i.map[e];s.values=n;let o=qh(s.route.fullRouteName,s.parts,s.values),a=t.lookup(o,e,s.undecoratedDefaultValue);mr(r,e,a)});let s=nd(this,e[Lh]);Dr(r,s)}this.setupController(r,t,e),this._environment.options.shouldRender&&this[Xh](),_n(!1)}_qpChanged(t,e,n){if(!n)return;let r=this._bucketCache,i=qh(n.route.fullRouteName,n.parts,n.values);r.stash(i,t,e)}beforeModel(t){}afterModel(t,e){}redirect(t,e){}contextDidChange(){this.currentModel=this.context}model(t,e){let n,r,i=hr(this,"_qp").map;for(let s in t){if("queryParams"===s||i&&s in i)continue;let t=s.match(/^(.*)_id$/);null!==t&&(n=t[1]),r=!0}if(!n){if(r)return Object.assign({},t);if(e.resolveIndex<1)return;return e[Lh].routeInfos[e.resolveIndex-1].context}}deserialize(t,e){return this.model(this._paramsFor(this.routeName,t),e)}setupController(t,e,n){t&&void 0!==e&&mr(t,"model",e)}controllerFor(t,e=!1){let n=Br(this),r=n.lookup(`route:${t}`);return r&&r.controllerName&&(t=r.controllerName),n.lookup(`controller:${t}`)}generateController(t){return Dh(Br(this),t)}modelFor(t){let e,n=Br(this),r=this._router&&this._router._routerMicrolib?this._router._routerMicrolib.activeTransition:void 0;e=n.routable&&void 0!==r?id(n,t):t;let i=n.lookup(`route:${e}`);if(null!=r){let t=i&&i.routeName||e;if(Object.prototype.hasOwnProperty.call(r.resolvedModels,t))return r.resolvedModels[t]}return i?.currentModel}[Jh]=void 0;[Xh](){this[Jh]=function(t){let e,n=Br(t),r=t.routeName,i=n.lookup(`controller:${t.controllerName||r}`),s=t.currentModel,o=n.lookup(`template:${t.templateName||r}`);return e=o?Du(o)?o:o(n):t._topLevelViewTemplate(n),{owner:n,name:r,controller:i,model:s,template:e}}(this),Is(this._router,"_setOutlets")}willDestroy(){this.teardownViews()}teardownViews(){this[Jh]&&(this[Jh]=void 0,Is(this._router,"_setOutlets"))}buildRouteInfoMetadata(){}_paramsFor(t,e){return void 0!==this._router._routerMicrolib.activeTransition?this.paramsFor(t):e}get _store(){const t=Br(this);return this.routeName,{find(e,n){let r=t.factoryFor(`model:${e}`);if(r)return r=r.class,r.find(n)}}}static{Kh(this.prototype,"_store",[Xn])}get _qp(){let t={},e=this.controllerName||this.routeName,n=Br(this),r=n.lookup(`controller:${e}`),i=hr(this,"queryParams"),s=Object.keys(i).length>0;r?t=function(t,e){let n={},r={defaultValue:!0,type:!0,scope:!0,as:!0};for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]={...t[i],...e[i]},r[i]=!0);for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&!r[i]&&(n[i]={...e[i],...t[i]});return n}(function(t){let e={};for(let n of t)Vh(n,e);return e}(hr(r,"queryParams")||[]),i):s&&(r=Dh(n,e),t=i);let o=[],a={},l=[];for(let c in t){if(!Object.prototype.hasOwnProperty.call(t,c))continue;if("unknownProperty"===c||"_super"===c)continue;let n,i=t[c],s=i.scope||"model";"controller"===s&&(n=[]);let u=i.as||this.serializeQueryParamKey(c),h=hr(r,c);h=rd(h);let d=i.type||kc(h),p=this.serializeQueryParam(h,u,d),f=`${e}:${c}`,g={undecoratedDefaultValue:hr(r,c),defaultValue:h,serializedDefaultValue:p,serializedValue:p,type:d,urlKey:u,prop:c,scopedPropertyName:f,controllerName:e,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:(t,e)=>{let n=a[t];this._qpChanged(t,e,n)},active:(t,e)=>{let n=a[t];return this._qpChanged(t,e,n),this._activeQPChanged(n,e)},allowOverrides:(t,e)=>{let n=a[t];return this._qpChanged(t,e,n),this._updatingQPChanged(n)}}}}static{Kh(this.prototype,"_qp",[Xn])}};function td(t){return t[Jh]}function ed(t,e){if(e.fullQueryParams)return e.fullQueryParams;let n=e.routeInfos.every(t=>t.route),r={...e.queryParams};return t._deserializeQueryParams(e.routeInfos,r),n&&(e.fullQueryParams=r),r}function nd(t,e){e.queryParamsFor=e.queryParamsFor||{};let n=t.fullRouteName,r=e.queryParamsFor[n];if(r)return r;let i=ed(t._router,e),s=e.queryParamsFor[n]={},o=hr(t,"_qp").qps;for(let a of o){let t=a.prop in i;s[a.prop]=t?i[a.prop]:rd(a.defaultValue)}return s}function rd(t){return Array.isArray(t)?Yc(t.slice()):t}function id(t,e){if(t.routable){let n=t.mountPoint;return"application"===e?n:`${n}.${e}`}return e}var sd=Qh.prototype.serialize;Qh.reopen({mergedProperties:["queryParams"],queryParams:{},templateName:null,controllerName:null,send(...t){if(this._router&&this._router._routerMicrolib||!iu())this._router.send(...t);else{let e=t.shift(),n=this.actions[e];if(n)return n.apply(this,t)}},actions:{queryParamsDidChange(t,e,n){let r=hr(this,"_qp").map,i=Object.keys(t).concat(Object.keys(n));for(let s of i){let t=r[s];if(t&&hr(this._optionsForQueryParam(t),"refreshModel")&&this._router.currentState){this.refresh();break}}return!0},finalizeQueryParamChange(t,e,n){if("application"!==this.fullRouteName)return!0;if(!n)return;let r,i=n[Lh].routeInfos,s=this._router,o=s._queryParamsFor(i),a=s._qpUpdates,l=!1;Bh(s,i);for(let c of o.qps){let i,s,o=c.route,u=o.controller,h=c.urlKey in t&&c.urlKey;if(a.has(c.urlKey)?(i=hr(u,c.prop),s=o.serializeQueryParam(i,c.urlKey,c.type)):h?(s=t[h],void 0!==s&&(i=o.deserializeQueryParam(s,c.urlKey,c.type))):(s=c.serializedDefaultValue,i=rd(c.defaultValue)),u._qpDelegate=hr(o,"_qp").states.inactive,s!==c.serializedValue){if(n.queryParamsOnly&&!1!==r){let t=hr(o._optionsForQueryParam(c),"replace");t?r=!0:!1===t&&(r=!1)}mr(u,c.prop,i),l=!0}c.serializedValue=s,c.serializedDefaultValue!==s&&e.push({value:s,visible:!0,key:h||c.urlKey})}!0===l&&_n(!1),r&&n.method("replace"),o.qps.forEach(t=>{let e=hr(t.route,"_qp");t.route.controller._qpDelegate=hr(e,"states.active")}),s._qpUpdates.clear()}}});var od=0;function ad(t){return"function"==typeof t}var ld=class t{parent;matches;enableLoadingSubstates;explicitIndex=!1;options;constructor(t=null,e){this.parent=t,this.enableLoadingSubstates=Boolean(e&&e.enableLoadingSubstates),this.matches=[],this.options=e}route(e,n,r){let i,s=null,o=`/_unused_dummy_error_path_route_${e}/:error`;if(ad(n)?(i={},s=n):ad(r)?(i=n,s=r):i=n||{},this.enableLoadingSubstates&&(ud(this,`${e}_loading`,{resetNamespace:i.resetNamespace}),ud(this,`${e}_error`,{resetNamespace:i.resetNamespace,path:o})),s){let n=cd(this,e,i.resetNamespace),r=new t(n,this.options);ud(r,"loading"),ud(r,"error",{path:o}),s.call(r),ud(this,e,i,r.generate())}else ud(this,e,i)}push(t,e,n,r){let i=e.split(".");if(this.options.engineInfo){let t=e.slice(this.options.engineInfo.fullName.length+1),n=Object.assign({localFullName:t},this.options.engineInfo);r&&(n.serializeMethod=r),this.options.addRouteForEngine(e,n)}else if(r)throw new Error(`Defining a route serializer on route '${e}' outside an Engine is not allowed.`);""!==t&&"/"!==t&&"index"!==i[i.length-1]||(this.explicitIndex=!0),this.matches.push(t,e,n)}generate(){let t=this.matches;return this.explicitIndex||this.route("index",{path:"/"}),e=>{for(let n=0;n<t.length;n+=3)e(t[n]).to(t[n+1],t[n+2])}}mount(e,n={}){let r=this.options.resolveRouteMap(e),i=e;n.as&&(i=n.as);let s,o=cd(this,i,n.resetNamespace),a={name:e,instanceId:od++,mountPoint:o,fullName:o},l=n.path;"string"!=typeof l&&(l=`/${i}`);let c=`/_unused_dummy_error_path_route_${i}/:error`;if(r){let e=!1,n=this.options.engineInfo;n&&(e=!0,this.options.engineInfo=a);let i=Object.assign({engineInfo:a},this.options),l=new t(o,i);ud(l,"loading"),ud(l,"error",{path:c}),r.class.call(l),s=l.generate(),e&&(this.options.engineInfo=n)}let u=Object.assign({localFullName:"application"},a);if(this.enableLoadingSubstates){let t=`${i}_loading`,e="application_loading",r=Object.assign({localFullName:e},a);ud(this,t,{resetNamespace:n.resetNamespace}),this.options.addRouteForEngine(t,r),t=`${i}_error`,e="application_error",r=Object.assign({localFullName:e},a),ud(this,t,{resetNamespace:n.resetNamespace,path:c}),this.options.addRouteForEngine(t,r)}this.options.addRouteForEngine(o,u),this.push(l,o,s)}};function cd(t,e,n){return function(t){return"application"!==t.parent}(t)&&!0!==n?`${t.parent}.${e}`:e}function ud(t,e,n={},r){let i=cd(t,e,n.resetNamespace);"string"!=typeof n.path&&(n.path=`/${e}`),t.push(n.path,i,r,n.serialize)}var hd=class{router;emberRouter;routerJsState;constructor(t,e,n){this.emberRouter=t,this.router=e,this.routerJsState=n}isActiveIntent(t,e,n){let r=this.routerJsState;if(!this.router.isActiveIntent(t,e,void 0,r))return!1;if(void 0!==n&&Object.keys(n).length>0){let i=Object.assign({},n);return this.emberRouter._prepareQueryParams(t,e,i),Hh(i,r.queryParams)}return!0}},dd=new WeakMap;function pd(t,e={},n={includeAttributes:!1,localizeMapUpdates:!1}){const r=new WeakMap;return t.map((i,s)=>{let{name:o,params:a,paramNames:l,context:c,route:u}=i,h=i;if(dd.has(h)&&n.includeAttributes){let t=dd.get(h);t=function(t,e){let n={get metadata(){return gd(t)}};return!Object.isExtensible(e)||e.hasOwnProperty("metadata")?Object.freeze(Object.assign({},e,n)):Object.assign(e,n)}(u,t);let e=fd(t,c);return r.set(h,t),n.localizeMapUpdates||dd.set(h,e),e}const d=n.localizeMapUpdates?r:dd;let p={find(e,n){let r,i=[];3===e.length&&(i=t.map(t=>d.get(t)));for(let s=0;t.length>s;s++)if(r=d.get(t[s]),e.call(n,r,s,i))return r},get name(){return o},get paramNames(){return l},get metadata(){return gd(i.route)},get parent(){let e=t[s-1];return void 0===e?null:d.get(e)},get child(){let e=t[s+1];return void 0===e?null:d.get(e)},get localName(){let t=this.name.split(".");return t[t.length-1]},get params(){return a},get queryParams(){return e}};return n.includeAttributes&&(p=fd(p,c)),r.set(i,p),n.localizeMapUpdates||dd.set(i,p),p})}function fd(t,e){let n={get attributes(){return e}};return!Object.isExtensible(t)||t.hasOwnProperty("attributes")?Object.freeze(Object.assign({},t,n)):Object.assign(t,n)}function gd(t){return null!=t&&void 0!==t.buildRouteInfoMetadata?t.buildRouteInfoMetadata():null}var md=class{_routePromise=void 0;_route=null;router;params={};isResolved=!1;constructor(t,e,n,r){this.name=e,this.paramNames=n,this.router=t,r&&this._processRoute(r)}getModel(t){return ia.resolve(this.context)}serialize(t){return this.params||{}}resolve(t){return ia.resolve(this.routePromise).then(e=>(yh(t),e)).then(()=>this.runBeforeModelHook(t)).then(()=>yh(t)).then(()=>this.getModel(t)).then(e=>(yh(t),e)).then(e=>this.runAfterModelHook(t,e)).then(e=>this.becomeResolved(t,e))}becomeResolved(t,e){let n,r=this.serialize(e);t&&(this.stashResolvedModel(t,e),t[Ih]=t[Ih]||{},t[Ih][this.name]=r);let i=e===this.context;!("context"in this)&&i||(n=e);let s=dd.get(this),o=new yd(this.router,this.name,this.paramNames,r,this.route,n);return void 0!==s&&dd.set(o,s),o}shouldSupersede(t){if(!t)return!0;let e=t.context===this.context;return t.name!==this.name||"context"in this&&!e||this.hasOwnProperty("params")&&!function(t,e){if(t===e)return!0;if(!t||!e)return!1;for(let n in t)if(t.hasOwnProperty(n)&&t[n]!==e[n])return!1;return!0}(this.params,t.params)}get route(){return null!==this._route?this._route:this.fetchRoute()}set route(t){this._route=t}get routePromise(){return this._routePromise||this.fetchRoute(),this._routePromise}set routePromise(t){this._routePromise=t}log(t,e){t.log&&t.log(this.name+": "+e)}updateRoute(t){return t._internalName=this.name,this.route=t}runBeforeModelHook(t){let e;return t.trigger&&t.trigger(!0,"willResolveModel",t,this.route),this.route&&void 0!==this.route.beforeModel&&(e=this.route.beforeModel(t)),Nh(e)&&(e=null),ia.resolve(e)}runAfterModelHook(t,e){let n,r=this.name;var i;return this.stashResolvedModel(t,e),void 0!==this.route&&void 0!==this.route.afterModel&&(n=this.route.afterModel(e,t)),n=Nh(i=n)?null:i,ia.resolve(n).then(()=>t.resolvedModels[r])}stashResolvedModel(t,e){t.resolvedModels=t.resolvedModels||{},t.resolvedModels[this.name]=e}fetchRoute(){let t=this.router.getRoute(this.name);return this._processRoute(t)}_processRoute(t){return this.routePromise=ia.resolve(t),function(t){return null!==t&&"object"==typeof t&&"function"==typeof t.then}(t)?(this.routePromise=this.routePromise.then(t=>this.updateRoute(t)),void(this.route=void 0)):t?this.updateRoute(t):void 0}},yd=class extends md{isResolved;context;constructor(t,e,n,r,i,s){super(t,e,n,i),this.params=r,this.isResolved=!0,this.context=s}resolve(t){return t&&t.resolvedModels&&(t.resolvedModels[this.name]=this.context),ia.resolve(this)}},vd=class extends md{params={};constructor(t,e,n,r,i){super(t,e,n,i),r&&(this.params=r)}getModel(t){let e=this.params;t&&t[Ph]&&(e={},wh(e,this.params),e.queryParams=t[Ph]);let n,r=this.route;return r.deserialize?n=r.deserialize(e,t):r.model&&(n=r.model(e,t)),n&&Nh(n)&&(n=void 0),ia.resolve(n)}},bd=class extends md{serializer;constructor(t,e,n,r){super(t,e,n),this.context=r,this.serializer=this.router.getSerializer(e)}getModel(t){return void 0!==this.router.log&&this.router.log(this.name+": resolving provided model"),super.getModel(t)}serialize(t){let{paramNames:e,context:n}=this;t||(t=n);let r={};if(Sh(t))return r[e[0]]=t,r;if(this.serializer)return this.serializer.call(null,t,e);if(void 0!==this.route&&this.route.serialize)return this.route.serialize(t,e);if(1!==e.length)return;let i=e[0];return/_id$/.test(i)?r[i]=t.id:r[i]=t,r}},wd=class{data;router;constructor(t,e={}){this.router=t,this.data=e}preTransitionState};function _d(t,e,n){let r=t.routeInfos,i=e.resolveIndex>=r.length?r.length-1:e.resolveIndex,s=e.isAborted;throw new kd(n,t.routeInfos[i].route,s,t)}function xd(t,e){if(e.resolveIndex===t.routeInfos.length)return;let n=t.routeInfos[e.resolveIndex],r=Cd.bind(null,t,e);return n.resolve(e).then(r,null,t.promiseLabel("Proceed"))}function Cd(t,e,n){let r=t.routeInfos[e.resolveIndex].isResolved;if(t.routeInfos[e.resolveIndex++]=n,!r){let{route:t}=n;void 0!==t&&t.redirect&&t.redirect(n.context,e)}return yh(e),xd(t,e)}var Sd=class{routeInfos=[];queryParams={};params={};promiseLabel(t){let e="";return kh(this.routeInfos,function(t){return""!==e&&(e+="."),e+=t.name,!0}),Th("'"+e+"': "+t)}resolve(t){let e=this.params;kh(this.routeInfos,t=>(e[t.name]=t.params||{},!0)),t.resolveIndex=0;let n=xd.bind(null,this,t),r=_d.bind(null,this,t);return ia.resolve(null,this.promiseLabel("Start transition")).then(n,null,this.promiseLabel("Resolve route")).catch(r,this.promiseLabel("Handle error")).then(()=>this)}},kd=class{constructor(t,e,n,r){this.error=t,this.route=e,this.wasAborted=n,this.state=r}},Ed=class extends wd{name;pivotHandler;contexts;queryParams;preTransitionState=void 0;constructor(t,e,n,r=[],i={},s){super(t,s),this.name=e,this.pivotHandler=n,this.contexts=r,this.queryParams=i}applyToState(t,e){let n=this.router.recognizer.handlersFor(this.name),r=n[n.length-1].handler;return this.applyToHandlers(t,n,r,e,!1)}applyToHandlers(t,e,n,r,i){let s,o,a=new Sd,l=this.contexts.slice(0),c=e.length;if(this.pivotHandler)for(s=0,o=e.length;s<o;++s)if(e[s].handler===this.pivotHandler._internalName){c=s;break}for(s=e.length-1;s>=0;--s){let o=e[s],u=o.handler,h=t.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 t=h&&h.context;o.names.length>0&&void 0!==h.context&&d.context===t&&(d.params=h&&h.params),d.context=t}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),wh(a.queryParams,this.queryParams||{}),r&&t.queryParams&&wh(a.queryParams,t.queryParams),a}invalidateChildren(t,e){for(let n=e,r=t.length;n<r;++n)if(t[n].isResolved){let{name:e,params:r,route:i,paramNames:s}=t[n];t[n]=new vd(this.router,e,s,r,i)}}getHandlerInfoForDynamicSegment(t,e,n,r,i,s){let o;if(n.length>0){if(o=n[n.length-1],Sh(o))return this.createParamHandlerInfo(t,e,n,r);n.pop()}else{if(r&&r.name===t)return r;if(!this.preTransitionState)return r;o=this.preTransitionState.routeInfos[s]?.context}return new bd(this.router,t,e,o)}createParamHandlerInfo(t,e,n,r){let i={},s=e.length,o=[];for(;s--;){let a=r&&t===r.name&&r.params||{},l=n[n.length-1],c=e[s];Sh(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 ${t}. Missing params: ${o}`);return new vd(this.router,t,e,i)}},Rd=class extends wd{preTransitionState;url;constructor(t,e,n){super(t,n),this.url=e,this.preTransitionState=void 0}applyToState(t){let e,n,r=new Sd,i=this.router.recognizer.recognize(this.url);if(!i)throw new Fh(this.url);let s=!1,o=this.url;function a(t){if(t&&t.inaccessibleByURL)throw new Fh(o);return t}for(e=0,n=i.length;e<n;++e){let n=i[e],o=n.handler,l=[];this.router.recognizer.hasRoute(o)&&(l=this.router.recognizer.handlersFor(o)[e].names);let c=new vd(this.router,o,l,n.params),u=c.route;u?a(u):c.routePromise=c.routePromise.then(a);let h=t.routeInfos[e];s||c.shouldSupersede(h)?(s=!0,r.routeInfos[e]=c):r.routeInfos[e]=h}return wh(r.queryParams,i.queryParams),r}},Td=class{_lastQueryParams={};log;state=void 0;oldState=void 0;activeTransition=void 0;currentRouteInfos=void 0;_changedQueryParams=void 0;currentSequence=0;recognizer;constructor(t){this.log=t,this.recognizer=new gh,this.reset()}map(t){this.recognizer.map(t,function(t,e){for(let n=e.length-1,r=!0;n>=0&&r;--n){let i=e[n],s=i.handler;t.add(e,{as:s}),r="/"===i.path||""===i.path||".index"===s.slice(-6)}})}hasRoute(t){return this.recognizer.hasRoute(t)}queryParamsTransition(t,e,n,r){if(this.fireQueryParamDidChange(r,t),!e&&this.activeTransition)return this.activeTransition;{let t=new Ah(this,void 0,void 0);return t.queryParamsOnly=!0,n.queryParams=this.finalizeQueryParamChange(r.routeInfos,r.queryParams,t),t[Ph]=r.queryParams,this.toReadOnlyInfos(t,r),this.routeWillChange(t),t.promise=t.promise.then(e=>(t.isAborted||(this._updateURL(t,n),this.didTransition(this.currentRouteInfos),this.toInfos(t,r.routeInfos,!0),this.routeDidChange(t)),e),null,Th("Transition complete")),t}}transitionByIntent(t,e){try{return this.getTransitionByIntent(t,e)}catch(n){return new Ah(this,t,void 0,n,void 0)}}recognize(t){let e=new Rd(this,t),n=this.generateNewState(e);if(null===n)return n;let r=pd(n.routeInfos,n.queryParams,{includeAttributes:!1,localizeMapUpdates:!0});return r[r.length-1]}recognizeAndLoad(t){let e=new Rd(this,t),n=this.generateNewState(e);if(null===n)return ia.reject(`URL ${t} was not recognized`);let r=new Ah(this,e,n,void 0);return r.then(()=>{let t=pd(n.routeInfos,r[Ph],{includeAttributes:!0,localizeMapUpdates:!1});return t[t.length-1]})}generateNewState(t){try{return t.applyToState(this.state,!1)}catch(e){return null}}getTransitionByIntent(t,e){let n,r=Boolean(this.activeTransition),i=r?this.activeTransition[Lh]:this.state,s=t.applyToState(i,e),o=Eh(i.queryParams,s.queryParams);if(Ld(s.routeInfos,i.routeInfos)){if(o){let t=this.queryParamsTransition(o,r,i,s);return t.queryParamsOnly=!0,t}return this.activeTransition||new Ah(this,void 0,void 0)}if(e){let t=new Ah(this,void 0,s);return t.isIntermediate=!0,this.toReadOnlyInfos(t,s),this.setupContexts(s,t),this.routeWillChange(t),this.activeTransition}return n=new Ah(this,t,s,void 0,this.activeTransition),function(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n<r;++n){if(t[n].name!==e[n].name)return!1;if(!Id(t[n].params,e[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(t=>this.finalizeTransition(n,t),null,Th("Settle transition promise when transition is finalized")),r||this.notifyExistingHandlers(s,n),this.fireQueryParamDidChange(s,o),n}doTransition(t,e=[],n=!1){let r,i=e[e.length-1],s={};if(i&&Object.prototype.hasOwnProperty.call(i,"queryParams")&&(s=e.pop().queryParams),void 0===t){Ch(this,"Updating query params");let{routeInfos:t}=this.state;r=new Ed(this,t[t.length-1].name,void 0,[],s)}else"/"===t.charAt(0)?(Ch(this,"Attempting URL transition to "+t),r=new Rd(this,t)):(Ch(this,"Attempting transition to "+t),r=new Ed(this,t,void 0,e,s));return this.transitionByIntent(r,n)}finalizeTransition(t,e){try{Ch(t.router,t.sequence,"Resolved all models on destination route; finalizing transition.");let n=e.routeInfos;return this.setupContexts(e,t),t.isAborted?(this.state.routeInfos=this.currentRouteInfos,ia.reject(Oh(t))):(this._updateURL(t,e),t.isActive=!1,this.activeTransition=void 0,this.triggerEvent(this.currentRouteInfos,!0,"didTransition",[]),this.didTransition(this.currentRouteInfos),this.toInfos(t,e.routeInfos,!0),this.routeDidChange(t),Ch(this,t.sequence,"TRANSITION COMPLETE."),n[n.length-1].route)}catch(r){if("object"!=typeof(n=r)||null===n||"TRANSITION_ABORTED"!==n.code){let e=t[Lh].routeInfos;t.trigger(!0,"error",r,t,e[e.length-1].route),t.abort()}throw r}var n}setupContexts(t,e){let n,r,i,s=this.partitionRoutes(this.state,t);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,e),void 0!==i.exit&&i.exit(e));let o=this.oldState=this.state;this.state=t;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,e);for(n=0,r=s.updatedContext.length;n<r;n++)this.routeEnteredOrUpdated(a,s.updatedContext[n],!1,e);for(n=0,r=s.entered.length;n<r;n++)this.routeEnteredOrUpdated(a,s.entered[n],!0,e)}catch(l){throw this.state=o,this.currentRouteInfos=o.routeInfos,l}this.state.queryParams=this.finalizeQueryParamChange(a,t.queryParams,e)}fireQueryParamDidChange(t,e){e&&(this._changedQueryParams=e.all,this.triggerEvent(t.routeInfos,!0,"queryParamsDidChange",[e.changed,e.all,e.removed]),this._changedQueryParams=void 0)}routeEnteredOrUpdated(t,e,n,r){let i=e.route,s=e.context;function o(i){return n&&void 0!==i.enter&&i.enter(r),yh(r),i.context=s,void 0!==i.contextDidChange&&i.contextDidChange(),void 0!==i.setup&&i.setup(s,r),yh(r),t.push(e),i}return void 0===i?e.routePromise=e.routePromise.then(o):o(i),!0}partitionRoutes(t,e){let n,r,i,s=t.routeInfos,o=e.routeInfos,a={updatedContext:[],exited:[],entered:[],unchanged:[],reset:[]},l=!1;for(r=0,i=o.length;r<i;r++){let t=s[r],e=o[r];t&&t.route===e.route||(n=!0),n?(a.entered.push(e),t&&a.exited.unshift(t)):l||t.context!==e.context?(l=!0,a.updatedContext.push(e)):a.unchanged.push(t)}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(t,e){let n=t.urlMethod;if(!n)return;let{routeInfos:r}=e,{name:i}=r[r.length-1],s={};for(let o=r.length-1;o>=0;--o){let t=r[o];wh(s,t.params),t.route.inaccessibleByURL&&(n=null)}if(n){s.queryParams=t._visibleQueryParams||e.queryParams;let r=this.recognizer.generate(i,s),o=t.isCausedByInitialTransition,a="replace"===n&&!t.isCausedByAbortingTransition,l=t.queryParamsOnly&&"replace"===n,c="replace"===n&&t.isCausedByAbortingReplaceTransition;o||a||l||c?this.replaceURL(r):this.updateURL(r)}}finalizeQueryParamChange(t,e,n){for(let s in e)e.hasOwnProperty(s)&&null===e[s]&&delete e[s];let r=[];this.triggerEvent(t,!0,"finalizeQueryParamChange",[e,r,n]),n&&(n._visibleQueryParams={});let i={};for(let s=0,o=r.length;s<o;++s){let t=r[s];i[t.key]=t.value,n&&!1!==t.visible&&(n._visibleQueryParams[t.key]=t.value)}return i}toReadOnlyInfos(t,e){let n=this.state.routeInfos;this.fromInfos(t,n),this.toInfos(t,e.routeInfos),this._lastQueryParams=e.queryParams}fromInfos(t,e){if(void 0!==t&&e.length>0){let n=pd(e,Object.assign({},this._lastQueryParams),{includeAttributes:!0,localizeMapUpdates:!1});t.from=n[n.length-1]||null}}toInfos(t,e,n=!1){if(void 0!==t&&e.length>0){let r=pd(e,Object.assign({},t[Ph]),{includeAttributes:n,localizeMapUpdates:!1});t.to=r[r.length-1]||null}}notifyExistingHandlers(t,e){let n,r,i,s,o=this.state.routeInfos;for(r=o.length,n=0;n<r&&(i=o[n],s=t.routeInfos[n],s&&i.name===s.name);n++)s.isResolved;this.triggerEvent(o,!0,"willTransition",[e]),this.routeWillChange(e),this.willTransition(o,t.routeInfos,e)}reset(){this.state&&kh(this.state.routeInfos.slice().reverse(),function(t){let e=t.route;return void 0!==e&&void 0!==e.exit&&e.exit(),!0}),this.oldState=void 0,this.state=new Sd,this.currentRouteInfos=void 0}handleURL(t){return"/"!==t.charAt(0)&&(t="/"+t),this.doTransition(t).method(null)}transitionTo(t,...e){return"object"==typeof t?(e.push(t),this.doTransition(void 0,e,!1)):this.doTransition(t,e)}intermediateTransitionTo(t,...e){return this.doTransition(t,e,!0)}refresh(t){let e=this.activeTransition,n=e?e[Lh]:this.state,r=n.routeInfos;void 0===t&&(t=r[0].route),Ch(this,"Starting a refresh transition");let i=r[r.length-1].name,s=new Ed(this,i,t,[],this._changedQueryParams||n.queryParams),o=this.transitionByIntent(s,!1);return e&&"replace"===e.urlMethod&&o.method(e.urlMethod),o}replaceWith(t){return this.doTransition(t).method("replace")}generate(t,...e){let n=_h(e),r=n[0],i=n[1],s=new Ed(this,t,void 0,r).applyToState(this.state,!1),o={};for(let a=0,l=s.routeInfos.length;a<l;++a)wh(o,s.routeInfos[a].serialize());return o.queryParams=i,this.recognizer.generate(t,o)}applyIntent(t,e){let n=new Ed(this,t,void 0,e),r=this.activeTransition&&this.activeTransition[Lh]||this.state;return n.applyToState(r,!1)}isActiveIntent(t,e,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!==t);++u);if(u===c.length)return!1;let h=new Sd;h.routeInfos=a.slice(0,u+1),c=c.slice(0,u+1);let d=Ld(new Ed(this,l,void 0,e).applyToHandlers(h,c,l,!0,!0).routeInfos,h.routeInfos);if(!n||!d)return d;let p={};wh(p,n);let f=o.queryParams;for(let g in f)f.hasOwnProperty(g)&&p.hasOwnProperty(g)&&(p[g]=f[g]);return d&&!Eh(p,n)}isActive(t,...e){let[n,r]=_h(e);return this.isActiveIntent(t,n,r)}trigger(t,...e){this.triggerEvent(this.currentRouteInfos,!1,t,e)}};function Ld(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n<r;++n)if(t[n]!==e[n])return!1;return!0}function Id(t,e){if(t===e)return!0;if(!t||!e)return!1;let n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let i=0,s=n.length;i<s;++i){let r=n[i];if(t[r]!==e[r])return!1}return!0}function Pd(){return this}var{slice:Md}=Array.prototype,Ad=class extends(Bl.extend(bc)){_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(t){return this.dslCallbacks||(this.dslCallbacks=[],this.reopenClass({dslCallbacks:this.dslCallbacks})),this.dslCallbacks.push(t),this}static _routePath(t){let e,n,r,i=[];function s(t,e){for(let n=0;n<t.length;++n)if(t[n]!==e[n])return!1;return!0}for(let o=1;o<t.length;o++){for(e=t[o].name,n=e.split("."),r=Md.call(i);r.length&&!s(r,n);)r.shift();i.push(...n.slice(r.length))}return i.join(".")}constructor(t){super(t),this._resetQueuedQueryParameterChanges(),this.namespace=t.lookup("application:main");let e=t.lookup(yc`-bucket-cache:main`);this._bucketCache=e;let n=t.lookup("service:router");this._routerService=n}_initRouterJs(){let t=hr(this,"location"),e=this;const n=Po(this);let r=Object.create(null),i=this._routerMicrolib=new class extends Td{getRoute(t){let i=t,s=n,o=e._engineInfoByRoute[i];o&&(s=e._getEngineInstance(o),i=o.localFullName);let a=`route:${i}`,l=s.lookup(a);if(r[t])return l;if(r[t]=!0,!l){let t=s.factoryFor("route:basic").class;s.register(a,class extends t{}),l=s.lookup(a)}if(l._setRouteName(i),o&&!function(t){return t.serialize===sd}(l))throw new Error("Defining a custom serialize method on an Engine route is not supported.");return l}getSerializer(t){let n=e._engineInfoByRoute[t];if(n)return n.serializeMethod||sd}updateURL(n){Is(()=>{t.setURL(n),mr(e,"currentURL",n)})}didTransition(t){e.didTransition(t)}willTransition(t,n){e.willTransition(t,n)}triggerEvent(t,n,r,i){return jd.bind(e)(t,n,r,i)}routeWillChange(t){e.trigger("routeWillChange",t),e._routerService.trigger("routeWillChange",t),t.isIntermediate&&e.set("currentRoute",t.to)}routeDidChange(t){e.set("currentRoute",t.to),Is(()=>{e.trigger("routeDidChange",t),e._routerService.trigger("routeDidChange",t)})}transitionDidError(t,n){return t.wasAborted||n.isAborted?Oh(n):(n.trigger(!1,"error",t.error,n,t.route),e._isErrorHandled(t.error)?(n.rollback(),this.routeDidChange(n),t.error):(n.abort(),t.error))}replaceURL(n){t.replaceURL?Is(()=>{t.replaceURL(n),mr(e,"currentURL",n)}):this.updateURL(n)}},s=this.constructor.dslCallbacks||[Pd],o=this._buildDSL();o.route("application",{path:"/",resetNamespace:!0,overrideNameAssertion:!0},function(){for(let t=0;t<s.length;t++)s[t].call(this)}),i.map(o.generate())}_buildDSL(){let t=this._hasModuleBasedResolver(),e=this;const n=Po(this);return new ld(null,{enableLoadingSubstates:t,resolveRouteMap:t=>n.factoryFor(`route-map:${t}`),addRouteForEngine(t,n){e._engineInfoByRoute[t]||(e._engineInfoByRoute[t]=n)}})}_resetQueuedQueryParameterChanges(){this._queuedQPChanges={}}_hasModuleBasedResolver(){let t=hr(Po(this),"application.__registry__.resolver.moduleBasedResolver");return Boolean(t)}startRouting(){if(this.setupRouter()){let t=hr(this,"initialURL");void 0===t&&(t=hr(this,"location").getURL());let e=this.handleURL(t);if(e&&e.error)throw e.error}}setupRouter(){if(this._didSetupRouter)return!1;this._didSetupRouter=!0,this._setupLocation();let t=hr(this,"location");return!hr(t,"cancelRouterSetup")&&(this._initRouterJs(),t.onUpdateURL(t=>{this.handleURL(t)}),!0)}_setOutlets(){if(this.isDestroying||this.isDestroyed)return;let t=this._routerMicrolib.currentRouteInfos;if(!t)return;let e=null,n=null;for(let r of t){let t=td(r.route);if(!t)break;{let r={render:t,outlets:{main:void 0}};n?n.outlets.main=r:e=r,n=r}}if(null!==e)if(this._toplevelView)this._toplevelView.setOutletState(e);else{let t=Po(this),n=t.factoryFor("view:-outlet"),r=t.lookup("application:main"),i=t.lookup("-environment:main"),s=t.lookup("template:-outlet");this._toplevelView=n.create({environment:i,template:s,application:r}),this._toplevelView.setOutletState(e),t.lookup("-application-instance:main").didCreateRootView(this._toplevelView)}}handleURL(t){let e=t.split(/#(.+)?/)[0];return this._doURLTransition("handleURL",e)}_doURLTransition(t,e){this._initialTransitionStarted=!0;let n=this._routerMicrolib[t](e||"/");return $d(n,this),n}transitionTo(...t){if(Wh(t[0]))return this._doURLTransition("transitionTo",t[0]);let{routeName:e,models:n,queryParams:r}=Uh(t);return this._doTransition(e,n,r)}intermediateTransitionTo(t,...e){this._routerMicrolib.intermediateTransitionTo(t,...e),Bd(this)}replaceWith(...t){return this.transitionTo(...t).method("replace")}generate(t,...e){let n=this._routerMicrolib.generate(t,...e);return this.location.formatURL(n)}isActive(t){return this._routerMicrolib.isActive(t)}isActiveIntent(t,e,n){return this.currentState.isActiveIntent(t,e,n)}send(t,...e){this._routerMicrolib.trigger(t,...e)}hasRoute(t){return this._routerMicrolib.hasRoute(t)}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 t=this._engineInstances;for(let e in t){let n=t[e];for(let t in n)_s(n[t],"destroy")}}_activeQPChanged(t,e){this._queuedQPChanges[t]=e,Is(this,this._fireQueryParamTransition)}_updatingQPChanged(t){this._qpUpdates.add(t)}_fireQueryParamTransition(){this.transitionTo({queryParams:this._queuedQPChanges}),this._resetQueuedQueryParameterChanges()}_setupLocation(){let t=this.location,e=this.rootURL,n=Po(this);"string"==typeof t&&(t=mr(this,"location",n.lookup(`location:${t}`))),null!==t&&"object"==typeof t&&(e&&mr(t,"rootURL",e),"function"==typeof t.initState&&t.initState())}_serializeQueryParams(t,e){qd(this,t,e,(t,n,r)=>{if(r)delete e[t],e[r.urlKey]=r.route.serializeQueryParam(n,r.urlKey,r.type);else{if(void 0===n)return;e[t]=this._serializeQueryParam(n,kc(n))}})}_serializeQueryParam(t,e){return null==t?t:"array"===e?JSON.stringify(t):`${t}`}_deserializeQueryParams(t,e){qd(this,t,e,(t,n,r)=>{r&&(delete e[t],e[r.prop]=r.route.deserializeQueryParam(n,r.urlKey,r.type))})}_deserializeQueryParam(t,e){return null==t?t:"boolean"===e?"true"===t:"number"===e?Number(t).valueOf():"array"===e?Yc(JSON.parse(t)):t}_pruneDefaultQueryParamValues(t,e){let n=this._queryParamsFor(t);for(let r in e){let t=n.map[r];t&&t.serializedDefaultValue===e[r]&&delete e[r]}}_doTransition(t,e,n,r){let i=t||function(t){let e=t.activeTransition?t.activeTransition[Lh].routeInfos:t.state.routeInfos;return e[e.length-1].name}(this._routerMicrolib);this._initialTransitionStarted=!0;let s={};this._processActiveTransitionQueryParams(i,e,s,n),Object.assign(s,n),this._prepareQueryParams(i,e,s,Boolean(r));let o=this._routerMicrolib.transitionTo(i,...e,{queryParams:s});return $d(o,this),o}_processActiveTransitionQueryParams(t,e,n,r){if(!this._routerMicrolib.activeTransition)return;let i={},s=this._qpUpdates,o=ed(this,this._routerMicrolib.activeTransition[Lh]);for(let a in o)s.has(a)||(i[a]=o[a]);this._fullyScopeQueryParams(t,e,r),this._fullyScopeQueryParams(t,e,i),Object.assign(n,i)}_prepareQueryParams(t,e,n,r){let i=Ud(this,t,e);this._hydrateUnsuppliedQueryParams(i,n,Boolean(r)),this._serializeQueryParams(i.routeInfos,n),r||this._pruneDefaultQueryParamValues(i.routeInfos,n)}_getQPMeta(t){let e=t.route;return e&&hr(e,"_qp")}_queryParamsFor(t){let e=t[t.length-1].name,n=this._qpCache[e];if(void 0!==n)return n;let r,i=!0,s={},o=[];for(let l of t)if(r=this._getQPMeta(l),r){for(let t of r.qps)o.push(t);Object.assign(s,r.map)}else i=!1;let a={qps:o,map:s};return i&&(this._qpCache[e]=a),a}_fullyScopeQueryParams(t,e,n){let r,i=Ud(this,t,e).routeInfos;for(let s of i)if(r=this._getQPMeta(s),r)for(let t of r.qps){let e=t.prop in n&&t.prop||t.scopedPropertyName in n&&t.scopedPropertyName||t.urlKey in n&&t.urlKey;e&&e!==t.scopedPropertyName&&(n[t.scopedPropertyName]=n[e],delete n[e])}}_hydrateUnsuppliedQueryParams(t,e,n){let r,i,s,o=t.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 e&&i.prop||i.scopedPropertyName in e&&i.scopedPropertyName||i.urlKey in e&&i.urlKey,s)s!==i.scopedPropertyName&&(e[i.scopedPropertyName]=e[s],delete e[s]);else{let n=qh(i.route.fullRouteName,i.parts,t.params);e[i.scopedPropertyName]=a.lookup(n,i.prop,i.defaultValue)}}_scheduleLoadingEvent(t,e){this._cancelSlowTransitionTimer(),this._slowTransitionTimer=Ps("routerTransitions",this,this._handleSlowTransition,t,e)}currentState=null;targetState=null;_handleSlowTransition(t,e){if(!this._routerMicrolib.activeTransition)return;let n=new hd(this,this._routerMicrolib,this._routerMicrolib.activeTransition[Lh]);this.set("targetState",n),t.trigger(!0,"loading",t,e)}_cancelSlowTransitionTimer(){this._slowTransitionTimer&&As(this._slowTransitionTimer),this._slowTransitionTimer=null}_markErrorAsHandled(t){this._handledErrors.add(t)}_isErrorHandled(t){return this._handledErrors.has(t)}_clearHandledError(t){this._handledErrors.delete(t)}_getEngineInstance({name:t,instanceId:e,mountPoint:n}){let r=this._engineInstances,i=r[t];i||(i=Object.create(null),r[t]=i);let s=i[e];return s||(s=Po(this).buildChildEngineInstance(t,{routable:!0,mountPoint:n}),s.boot(),i[e]=s),s}};function Od(t,e){for(let n=t.length-1;n>=0;--n){let r=t[n],i=r.route;if(void 0!==i&&!0!==e(i,r))return}}var Nd={willResolveModel(t,e,n){this._scheduleLoadingEvent(e,n)},error(t,e,n){let r=this,i=t[t.length-1];Od(t,(t,n)=>{if(n!==i){let n=zd(t,"error");if(n)return r._markErrorAsHandled(e),r.intermediateTransitionTo(n,e),!1}let s=Fd(t,"error");return!s||(r._markErrorAsHandled(e),r.intermediateTransitionTo(s,e),!1)}),function(t,e){let n,r=[];n=t&&"object"==typeof t&&"object"==typeof t.errorThrown?t.errorThrown:t,e&&r.push(e),n&&(n.message&&r.push(n.message),n.stack&&r.push(n.stack),"string"==typeof n&&r.push(n)),console.error(...r)}(e,`Error while processing route: ${n.targetName}`)},loading(t,e){let n=this,r=t[t.length-1];Od(t,(t,i)=>{if(i!==r){let e=zd(t,"loading");if(e)return n.intermediateTransitionTo(e),!1}let s=Fd(t,"loading");return s?(n.intermediateTransitionTo(s),!1):e.pivotHandler!==t})}};function Fd(t,e){let n=Po(t),{routeName:r,fullRouteName:i,_router:s}=t,o=`${i}_${e}`;return Dd(n,s,`${r}_${e}`,o)?o:""}function zd(t,e){let n=Po(t),{routeName:r,fullRouteName:i,_router:s}=t,o="application"===i?e:`${i}.${e}`;return Dd(n,s,"application"===r?e:`${r}.${e}`,o)?o:""}function Dd(t,e,n,r){let i=e.hasRoute(r),s=t.factoryFor(`template:${n}`)||t.factoryFor(`route:${n}`);return i&&s}function jd(t,e,n,r){if(!t){if(e)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=t.length-1;c>=0;c--)if(i=t[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=Nd[n];if(l)l.call(this,t,...r);else if(!a&&!e)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 Ud(t,e,n){let r=t._routerMicrolib.applyIntent(e,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 Bd(t){let e=t._routerMicrolib.currentRouteInfos;if(0===e.length)return;let n=Ad._routePath(e),r=e[e.length-1].name,i=t.location.getURL();mr(t,"currentPath",n),mr(t,"currentRouteName",r),mr(t,"currentURL",i)}function $d(t,e){let n=new hd(e,e._routerMicrolib,t[Lh]);e.currentState||e.set("currentState",n),e.set("targetState",n),t.promise=t.catch(t=>{if(!e._isErrorHandled(t))throw t;e._clearHandledError(t)},"Transition Error")}function qd(t,e,n,r){let i=t._queryParamsFor(e);for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&r(s,n[s],i.map[s])}function Vd(t){return void 0!==t.hash?t.hash.substring(0):""}Ad.reopen({didTransition:function(){Bd(this),this._cancelSlowTransitionTimer(),this.notifyPropertyChange("url"),this.set("currentState",this.targetState)},willTransition:function(){},rootURL:"/",location:"hash",url:Xn(function(){let t=hr(this,"location");if("string"!=typeof t)return t.getURL()})});var Wd=class extends Bl{_hashchangeHandler;_location;init(){this.location=this._location??window.location,this._hashchangeHandler=void 0}getHash(){return Vd(this.location)}getURL(){let t=this.getHash().substring(1),e=t;return"/"!==e[0]&&(e="/",t&&(e+=`#${t}`)),e}setURL(t){this.location.hash=t,this.lastSetURL=t}replaceURL(t){this.location.replace(`#${t}`),this.lastSetURL=t}lastSetURL=null;onUpdateURL(t){this._removeEventListener(),this._hashchangeHandler=Cs(this,function(){let e=this.getURL();this.lastSetURL!==e&&(this.lastSetURL=null,t(e))}),window.addEventListener("hashchange",this._hashchangeHandler)}formatURL(t){return`#${t}`}willDestroy(){this._removeEventListener()}_removeEventListener(){this._hashchangeHandler&&window.removeEventListener("hashchange",this._hashchangeHandler)}};function Hd(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){let e,n;return e=16*Math.random()|0,n="x"===t?e:3&e|8,n.toString(16)})}var Gd=class extends Bl{history;_popstateHandler;rootURL="/";getHash(){return Vd(this.location)}init(){this._super(...arguments);let t=document.querySelector("base"),e="";null!==t&&t.hasAttribute("href")&&(e=t.getAttribute("href")??""),this.baseURL=e,this.location=this.location??window.location,this._popstateHandler=void 0}initState(){let t=this.history??window.history;this.history=t;let{state:e}=t,n=this.formatURL(this.getURL());e&&e.path===n||this.replaceState(n)}getURL(){let{location:t,rootURL:e,baseURL:n}=this,r=t.pathname;e=e.replace(/\/$/,""),n=n.replace(/\/$/,"");let i=r.replace(new RegExp(`^${n}(?=/|$)`),"").replace(new RegExp(`^${e}(?=/|$)`),"").replace(/\/\//g,"/");return i+=(t.search||"")+this.getHash(),i}setURL(t){let{state:e}=this.history;t=this.formatURL(t),e&&e.path===t||this.pushState(t)}replaceURL(t){let{state:e}=this.history;t=this.formatURL(t),e&&e.path===t||this.replaceState(t)}pushState(t){let e={path:t,uuid:Hd()};this.history.pushState(e,"",t)}replaceState(t){let e={path:t,uuid:Hd()};this.history.replaceState(e,"",t)}onUpdateURL(t){this._removeEventListener(),this._popstateHandler=()=>{t(this.getURL())},window.addEventListener("popstate",this._popstateHandler)}formatURL(t){let{rootURL:e,baseURL:n}=this;return""!==t?(e=e.replace(/\/$/,""),n=n.replace(/\/$/,"")):"/"===n[0]&&"/"===e[0]&&(n=n.replace(/\/$/,"")),n+e+t}willDestroy(){this._removeEventListener()}_removeEventListener(){this._popstateHandler&&window.removeEventListener("popstate",this._popstateHandler)}},Zd=class extends Bl{updateCallback;initState(){this._super(...arguments);let{rootURL:t}=this}getURL(){let{path:t,rootURL:e}=this;return e=e.replace(/\/$/,""),t.replace(new RegExp(`^${e}(?=/|$)`),"")}setURL(t){this.path=t}onUpdateURL(t){this.updateCallback=t}handleURL(t){this.path=t,this.updateCallback&&this.updateCallback(t)}formatURL(t){let{rootURL:e}=this;return""!==t&&(e=e.replace(/\/$/,"")),e+t}};function Kd(t,e){return(t,...n)=>{let r=function(t,e){let n=[];function r(t){n.push(t)}for(let i of e)Fn(i,r);return n}(0,[t,...n]);return Xn(...r,function(){let t=r.length-1;for(let n=0;n<t;n++){let t=hr(this,r[n]);if(!e(t))return t}return hr(this,r[t])})}}function Yd(t){return br(t).readOnly()}Zd.reopen({path:"",rootURL:"/"}),Kd(0,t=>t),Kd(0,t=>!t);var Xd=/[ _]/g,Jd=new or(1e3,t=>function(t){return ip.get(t)}(t).replace(Xd,"-")),Qd=/^(-|_)+(.)?/,tp=/(.)(-|_|\.|\s)+(.)?/g,ep=/(^|\/|\.)([a-z])/g,np=new or(1e3,t=>{let e=(t,e,n)=>n?`_${n.toUpperCase()}`:"",n=(t,e,n,r)=>e+(r?r.toUpperCase():""),r=t.split("/");for(let i=0;i<r.length;i++)r[i]=r[i].replace(Qd,e).replace(tp,n);return r.join("/").replace(ep,t=>t.toUpperCase())}),rp=/([a-z\d])([A-Z])/g,ip=new or(1e3,t=>t.replace(rp,"$1_$2").toLowerCase());function sp(t){return Jd.get(t)}function op(t){return Object.hasOwnProperty.call(t.since,"enabled")||N._ALL_DEPRECATIONS_ENABLED}var ap=parseFloat(N._OVERRIDE_DEPRECATION_VERSION??"7.2.0");function lp(t){return function(t,e=ap){let n=t.replace(/(\.0+)/g,"");return e>=parseFloat(n)}(t.until)}function cp(t){return{options:t,test:!op(t),isEnabled:op(t)||lp(t),isRemoved:lp(t)}}var up={DEPRECATE_IMPORT_EMBER:t=>cp({id:`deprecate-import-${sp(t).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-${sp(t).toLowerCase()}-from-ember`}),DEPRECATE_IMPORT_INJECT:cp({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"})},hp=a({default:()=>fp,inject:()=>dp,service:()=>pp});function dp(...t){return function(t,e){const{options:n}=e;if(e.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,up.DEPRECATE_IMPORT_INJECT),qr("service",...t)}function pp(...t){return qr("service",...t)}var fp=class extends Xc{static isServiceFactory=!0},gp=Symbol("ROUTER");function mp(t,e){return"/"===e?t:t.substring(e.length)}var yp=class extends(fp.extend(bc)){[gp];get _router(){let t=this[gp];if(void 0!==t)return t;let e=Br(this).lookup("router:main");return this[gp]=e}willDestroy(){super.willDestroy(),this[gp]=void 0}transitionTo(...t){if(Wh(t[0]))return this._router._doURLTransition("transitionTo",t[0]);let{routeName:e,models:n,queryParams:r}=Uh(t);return this._router._doTransition(e,n,r,!0)}replaceWith(...t){return this.transitionTo(...t).method("replace")}urlFor(t,...e){return this._router.setupRouter(),this._router.generate(t,...e)}isActive(...t){let{routeName:e,models:n,queryParams:r}=Uh(t);this._router.setupRouter();let i=this._router._routerMicrolib;if(Ft(Kt(this._router,"currentURL")),!i.isActiveIntent(e,n))return!1;if(Object.keys(r).length>0){let t=e;r=Object.assign({},r),this._router._prepareQueryParams(t,n,r,!0);let s=Object.assign({},i.state.queryParams);return this._router._prepareQueryParams(t,n,s,!0),Hh(r,s)}return!0}recognize(t){this._router.setupRouter();let e=mp(t,this.rootURL);return this._router._routerMicrolib.recognize(e)}recognizeAndLoad(t){this._router.setupRouter();let e=mp(t,this.rootURL);return this._router._routerMicrolib.recognizeAndLoad(e)}refresh(t){if(!t)return this._router._routerMicrolib.refresh();let e=Br(this).lookup(`route:${t}`);return this._router._routerMicrolib.refresh(e)}static{Zh(this.prototype,"currentRouteName",[Yd("_router.currentRouteName")])}#o=void Yh(this,"currentRouteName");static{Zh(this.prototype,"currentURL",[Yd("_router.currentURL")])}#a=void Yh(this,"currentURL");static{Zh(this.prototype,"location",[Yd("_router.location")])}#l=void Yh(this,"location");static{Zh(this.prototype,"rootURL",[Yd("_router.rootURL")])}#c=void Yh(this,"rootURL");static{Zh(this.prototype,"currentRoute",[Yd("_router.currentRoute")])}#u=void Yh(this,"currentRoute")},vp=class extends fp{[gp];get router(){let t=this[gp];if(void 0!==t)return t;let e=Br(this).lookup("router:main");return e.setupRouter(),this[gp]=e}hasRoute(t){return this.router.hasRoute(t)}transitionTo(t,e,n,r){let i=this.router._doTransition(t,e,n);return r&&i.method("replace"),i}normalizeQueryParams(t,e,n){this.router._prepareQueryParams(t,e,n)}_generateURL(t,e,n){let r={};return n&&(Object.assign(r,n),this.normalizeQueryParams(t,e,r)),this.router.generate(t,...e,{queryParams:r})}generateURL(t,e,n){if(this.router._initialTransitionStarted)return this._generateURL(t,e,n);try{return this._generateURL(t,e,n)}catch(r){return}}isActiveForRoute(t,e,n,r){let i=this.router._routerMicrolib.recognizer.handlersFor(n),s=i[i.length-1].handler,o=function(t,e){let n=0;for(let r=0;r<e.length&&(n+=e[r].names.length,e[r].handler!==t);r++);return n}(n,i);return t.length>o&&(n=s),r.isActiveIntent(n,t,e)}};vp.reopen({targetState:Yd("router.targetState"),currentState:Yd("router.currentState"),currentRouteName:Yd("router.currentRouteName"),currentPath:Yd("router.currentPath")});var bp=class{cache;constructor(){this.cache=new Map}has(t){return this.cache.has(t)}stash(t,e,n){let r=this.cache.get(t);void 0===r&&(r=new Map,this.cache.set(t,r)),r.set(e,n)}lookup(t,e,n){if(!this.has(t))return n;let r=this.cache.get(t);return r.has(e)?r.get(e):n}},wp=Ao?self:null,_p=Ao?self.location:null,xp=Ao?self.history:null,Cp=Ao?self.navigator.userAgent:"Lynx (textmode)",Sp=!(!Ao||"object"!=typeof chrome||"object"==typeof opera),kp=!!Ao&&/Firefox|FxiOS/.test(Cp),Ep=Object.freeze(Object.defineProperty({__proto__:null,hasDOM:Ao,history:xp,isChrome:Sp,isFirefox:kp,location:_p,userAgent:Cp,window:wp},Symbol.toStringTag,{value:"Module"})),Rp=-536870913;function Tp(t){return(t|=0)<0?function(t){return t&Rp}(t):function(t){return~t}(t)}function Lp(t){return(t|=0)>Rp?function(t){return~t}(t):function(t){return 536870912|t}(t)}function Ip(t){if("number"==typeof t)return t;{let e=t.errors[0];throw new Error(`Compile Error: ${e.problem} @ ${e.span.start}..${e.span.end}`)}}function Pp(t){if("error"===t.result)throw new Error(`Compile Error: ${t.problem} @ ${t.span.start}..${t.span.end}`);return t}[1,-1].forEach(t=>Lp(Tp(t)));var Mp=new WeakMap,Ap=Reflect.getPrototypeOf;function Op(t,e){return Mp.set(e,t),e}function Np(t){let e=t;for(;null!==e;){let t=Mp.get(e);if(void 0!==t)return t;e=Ap(e)}}var Fp=Object.assign;function zp(t){return Object.values(t)}function Dp(t){return Object.entries(t)}function jp(t){return Object.keys(t)}var Up=Object.freeze([]);function Bp(){return Up}var $p=Bp(),qp=Bp();function Vp(t){return t===Up}function*Wp(t){for(let e=t.length-1;e>=0;e--)yield t[e]}function*Hp(t){let e=0;for(const n of t)yield[e++,n]}function*Gp(t,e){for(let n=0;n<t.length;n++)yield[n,t[n],e[n]]}function*Zp(t,e){for(let n=0;n<t.length;n++)yield[n<e.length?"retain":"pop",n,t[n],e[n]];for(let n=t.length;n<e.length;n++)yield["push",n,void 0,e[n]]}function Kp(){}var Yp=class{constructor(t){this.buffer=t}size=0;encode(t,e,...n){if(t>255)throw new Error(`Opcode type over 8-bits. Got ${t}.`);let r=t|e|arguments.length-2<<8;this.buffer.push(r);for(const i of n)this.buffer.push(i);this.size=this.buffer.length}patch(t,e){if(-1!==this.buffer[t+1])throw new Error("Trying to patch operand in populated slot instead of a reserved slot.");this.buffer[t+1]=e}},Xp=32,Jp=31;function Qp(t){return e=>{if(!function(t){return Array.isArray(t)&&2===t.length}(e))return!1;let n=e[0];return n===Jp||n===Xp||n===t}}var tf=Qp(39),ef=Qp(38),nf=Qp(37),rf=Qp(35);function sf(t,e,n,r){let{symbols:{upvars:i}}=n,s=i[t[1]],o=e?.lookupBuiltInHelper?.(s)??null;return r.helper(o,s)}var of=1004,af=1005,lf=1010,cf=1e3,uf=1001,hf=1002;function df(t){return{type:1,value:t}}function pf(t){return{type:5,value:t}}function ff(t){return{type:7,value:t}}function gf(t){return{type:8,value:t}}var mf=class{labels=ne();targets=[];label(t,e){this.labels[t]=e}target(t,e){this.targets.push({at:t,target:e})}patch(t){let{targets:e,labels:n}=this;for(const{at:r,target:i}of e){let e=n[i]-r;Kp(t.getbyaddr(r)),t.setbyaddr(r,e)}}};function yf(t,e,n,r){let{program:{constants:i},resolver:s}=e;if(function(t){return t<1e3}(r[0])){let[e,...n]=r;t.push(i,e,...n)}else switch(r[0]){case cf:return t.label(r[1]);case uf:return t.startLabels();case hf:return t.stopLabels();case of:return function(t,e,n,[,r,i]){if(tf(r),r[0]===Xp){let{scopeValues:t,owner:s,symbols:{lexical:o}}=n,a=t[r[1]];i(e.component(a,s,!1,o?.at(r[1])))}else{let{symbols:{upvars:s},owner:o}=n,a=s[r[1]],l=t?.lookupComponent?.(a,o)??null;i(e.resolvedComponent(l,a))}}(s,i,n,r);case 1003:return function(t,e,n,[,r,i]){ef(r);let s=r[0];if(s===Xp){let{scopeValues:t,symbols:{lexical:s}}=n,o=t[r[1]];i(e.modifier(o,s?.at(r[1])??void 0))}else if(s===Jp){let{symbols:{upvars:s}}=n,o=s[r[1]],a=t?.lookupBuiltInModifier?.(o)??null;i(e.modifier(a,o))}else{let{symbols:{upvars:s},owner:o}=n,a=s[r[1]],l=t?.lookupModifier?.(a,o)??null;i(e.modifier(l))}}(s,i,n,r);case af:return function(t,e,n,[,r,i]){nf(r);let s=r[0];if(s===Xp){let{scopeValues:t}=n,s=t[r[1]];i(e.helper(s))}else if(s===Jp)i(sf(r,t,n,e));else{let{symbols:{upvars:s},owner:o}=n,a=s[r[1]],l=t?.lookupHelper?.(a,o)??null;i(e.helper(l,a))}}(s,i,n,r);case 1007:return function(t,e,n,[,r,{ifComponent:i,ifHelper:s}]){rf(r);let o=r[0];if(o===Xp){let{scopeValues:t,owner:o,symbols:{lexical:a}}=n,l=t[r[1]],c=e.component(l,o,!0,a?.at(r[1]));if(null!==c)return void i(c);s(e.helper(l,null,!0))}else if(o===Jp)s(sf(r,t,n,e));else{let{symbols:{upvars:o},owner:a}=n,l=o[r[1]],c=t?.lookupComponent?.(l,a)??null;if(null!==c)i(e.resolvedComponent(c,l));else{let n=t?.lookupHelper?.(l,a)??null;s(e.helper(n,l))}}}(s,i,n,r);case 1008:return function(t,e,n,[,r,{ifComponent:i,ifHelper:s,ifValue:o}]){rf(r);let a=r[0];if(a===Xp){let{scopeValues:t,owner:a,symbols:{lexical:l}}=n,c=t[r[1]];if("function"!=typeof c&&("object"!=typeof c||null===c))return void o(e.value(c));let u=e.component(c,a,!0,l?.at(r[1]));if(null!==u)return void i(u);let h=e.helper(c,null,!0);if(null!==h)return void s(h);o(e.value(c))}else if(a===Jp)s(sf(r,t,n,e));else{let{symbols:{upvars:o},owner:a}=n,l=o[r[1]],c=t?.lookupComponent?.(l,a)??null;if(null!==c)return void i(e.resolvedComponent(c,l));let u=t?.lookupHelper?.(l,a)??null;null!==u&&s(e.helper(u,l))}}(s,i,n,r);case lf:{let[,t,e]=r;e(n.symbols.upvars[t],n.moduleName);break}case 1011:{let[,t,e]=r,s=n.scopeValues[t];e(i.value(s));break}default:throw new Error(`Unexpected high level opcode ${r[0]}`)}}var vf=class{labelsStack=new se;encoder=new Yp([]);errors=[];handle;constructor(t,e,n){this.heap=t,this.meta=e,this.stdlib=n,this.handle=t.malloc()}error(t){this.encoder.encode(30,0),this.errors.push(t)}commit(t){let e=this.handle;return this.heap.pushMachine(5),this.heap.finishMalloc(e,t),Qt(this.errors)?{errors:this.errors,handle:e}:e}push(t,e,...n){let{heap:r}=this,i=e|((s=e)>=0&&s<=15?1024:0)|n.length<<8;var s;r.pushRaw(i);for(let o=0;o<n.length;o++){let e=n[o];r.pushRaw(this.operand(t,e))}}operand(t,e){if("number"==typeof e)return e;if("object"==typeof e&&null!==e){if(Array.isArray(e))return t.array(e);switch(e.type){case 1:return this.currentLabels.target(this.heap.offset,e.value),-1;case 2:return t.value(this.meta.isStrictMode);case 3:case 6:case 7:case 8:return t.value(e.value);case 4:return t.value((n=e.value,r=this.meta,new tg(n[0],r,{parameters:n[1]||Up})));case 5:return this.stdlib[e.value]}}var n,r;return t.value(e)}get currentLabels(){return this.labelsStack.current}label(t){this.currentLabels.label(t,this.heap.offset+1)}startLabels(){this.labelsStack.push(new mf)}stopLabels(){this.labelsStack.pop().patch(this.heap)}};function bf(t,e){return{evaluation:t,encoder:new vf(t.program.heap,e,t.stdlib),meta:e}}var wf=class{names={};funcs=[];add(t,e){this.names[t]=this.funcs.push(e)-1}compile(t,e){let n=e[0],r=this.names[n],i=this.funcs[r];e[0],i(t,e)}},_f=new wf;function xf(t,e){if(void 0!==e&&0!==e.length)for(let n=0;n<e.length;n++)t(22,e[n])}function Cf(t,e){Array.isArray(e)?_f.compile(t,e):(kf(t,e),t(31))}function Sf(t,e){kf(t,e),t(31)}function kf(t,e){let n=e;var r;"number"==typeof n&&(n=(r=n)%1==0&&r<=536870911&&r>=-536870912?Tp(n):function(t){return{type:6,value:t}}(n)),t(30,n)}function Ef(t,e,n,r){t(0),Of(t,n,r,!1),t(16,e),t(1),t(36,8)}function Rf(t,e,n,r){t(0),Of(t,e,n,!1),t(33,2,1),t(107),r?(t(36,8),r(),t(1),t(34,1)):(t(1),t(34,1),t(36,8))}function Tf(t,e,n,r,i){t(0),Of(t,r,i,!1),t(86),Cf(t,n),t(77,e,{type:2,value:void 0}),t(1),t(36,8)}function Lf(t,e,n){Of(t,n,null,!0),t(23,e),t(24),t(61),t(64),t(40),t(1)}function If(t,e){!function(t,e){null!==e?t(63,ff({parameters:e})):kf(t,null)}(t,e&&e[1]),t(62),Af(t,e)}function Pf(t,e){t(0),Af(t,e),t(61),t(2),t(1)}function Mf(t,e,n){let r=e[1],i=r.length,s=Math.min(n,i);if(0!==s){if(t(0),s){t(39);for(let e=0;e<s;e++)t(33,2,n-e),t(19,r[e])}Af(t,e),t(61),t(2),s&&t(40),t(1)}else Pf(t,e)}function Af(t,e){null===e?kf(t,null):t(28,{type:4,value:e})}function Of(t,e,n,r){if(null===e&&null===n)return void t(83);let i=Nf(t,e)<<4;r&&(i|=8);let s=$p;if(n){s=n[0];let e=n[1];for(let n=0;n<e.length;n++)Cf(t,e[n])}t(82,s,$p,i)}function Nf(t,e){if(null===e)return 0;for(let n=0;n<e.length;n++)Cf(t,e[n]);return e.length}function Ff(t){let[,e,n]=t.block,r=t.scope?.()??null;return{symbols:{locals:e,upvars:n,lexical:r?Object.keys(r):void 0},scopeValues:r?Object.values(r):null,isStrictMode:t.isStrictMode,moduleName:t.moduleName,owner:t.owner,size:e.length}}_f.add(29,(t,[,e])=>{for(let n of e)Cf(t,n);t(27,e.length)}),_f.add(28,(t,[,e,n,r])=>{nf(e)?t(af,e,e=>{Ef(t,e,n,r)}):(Cf(t,e),Rf(t,n,r))}),_f.add(50,(t,[,e,n,r,i])=>{Tf(t,n,e,r,i)}),_f.add(30,(t,[,e,n])=>{t(21,e),xf(t,n)}),_f.add(Xp,(t,[,e,n])=>{t(1011,e,e=>{t(29,e),xf(t,n)})}),_f.add(Jp,(t,e)=>{t(lf,e[1],()=>{t(af,e,e=>{Ef(t,e,null,null)})})}),_f.add(37,(t,e)=>{t(lf,e[1],()=>{t(af,e,e=>{Ef(t,e,null,null)})})}),_f.add(27,t=>Sf(t,void 0)),_f.add(48,(t,[,e])=>{Cf(t,e),t(25)}),_f.add(49,(t,[,e])=>{Cf(t,e),t(24),t(61),t(26)}),_f.add(52,(t,[,e,n,r])=>{Cf(t,r),Cf(t,n),Cf(t,e),t(109)}),_f.add(51,(t,[,e])=>{Cf(t,e),t(110)}),_f.add(53,(t,[,e])=>{Cf(t,e),t(111)}),_f.add(54,(t,[,e])=>{t(0),Of(t,e,null,!1),t(112),t(1),t(36,8)});var zf=class t{names;constructor(t){this.blocks=t,this.names=t?Object.keys(t):[]}get(t){return this.blocks&&this.blocks[t]||null}has(t){let{blocks:e}=this;return null!==e&&t in e}with(e,n){let{blocks:r}=this;return new t(r?Fp({},r,{[e]:n}):{[e]:n})}get hasAny(){return null!==this.blocks}},Df=new zf(null);function jf(t){if(null===t)return Df;let e=ne(),[n,r]=t;for(const[i,s]of Hp(n))e[s]=Xt(r[i]);return new zf(e)}function Uf(t,e,n){let r=[],i=0;n(function(t,e){r.push({match:t,callback:e,label:"CLAUSE"+i++})}),t(69,1),e(),t(uf);for(let s of r.slice(0,-1))t(67,df(s.label),s.match);for(let s=r.length-1;s>=0;s--){let e=Xt(r[s]);t(cf,e.label),t(34,1),e.callback(),0!==s&&t(4,df("END"))}t(cf,"END"),t(hf),t(70)}function Bf(t,e,n){t(uf),t(0),t(6,df("ENDINITIAL")),t(69,e()),n(),t(cf,"FINALLY"),t(70),t(5),t(cf,"ENDINITIAL"),t(1),t(hf)}function $f(t,e,n,r){return Bf(t,e,()=>{t(66,df("ELSE")),n(),t(4,df("FINALLY")),t(cf,"ELSE"),void 0!==r&&r()})}var qf="&attrs";function Vf(t,e,n,r,i,s){let{compilable:o,capabilities:a,handle:l}=e,c=n?[n,[]]:null,u=jf(s);o?(t(78,l),function(t,{capabilities:e,layout:n,elementBlock:r,positional:i,named:s,blocks:o}){let{symbolTable:a}=n;if(bu(e,fu.prepareArgs))return void Hf(t,{capabilities:e,elementBlock:r,positional:i,named:s,atNames:!0,blocks:o,layout:n});t(36,4),t(33,3,1),t(35,4),t(0);let{symbols:l}=a,c=[],u=[],h=[],d=o.names;if(null!==r){let e=l.indexOf(qf);-1!==e&&(If(t,r),c.push(e))}for(const p of d){let e=l.indexOf(`&${p}`);-1!==e&&(If(t,o.get(p)),c.push(e))}if(bu(e,fu.createArgs)){let e=Nf(t,i)<<4;e|=8;let n=$p;if(null!==s){n=s[0];let e=s[1];for(let r=0;r<e.length;r++){let i=l.indexOf(Xt(n[r]));Cf(t,e[r]),u.push(i)}}t(82,n,$p,e),u.push(-1)}else if(null!==s){let e=s[0],n=s[1];for(let r=0;r<n.length;r++){let i=Xt(e[r]),s=l.indexOf(i);-1!==s&&(Cf(t,n[r]),u.push(s),h.push(i))}}t(97,4),bu(e,fu.dynamicScope)&&t(59),bu(e,fu.createInstance)&&t(87,0|o.has("default")),t(88,4),bu(e,fu.createArgs)?t(90,4):t(90,4,h),t(37,l.length+1,Object.keys(o).length>0?1:0),t(19,0);for(const p of Wp(u))-1===p?t(34,1):t(19,p+1);null!==i&&t(34,i.length);for(const p of Wp(c))t(20,p+1);t(28,gf(n)),t(61),t(2),t(100,4),t(1),t(40),bu(e,fu.dynamicScope)&&t(60),t(98),t(35,4)}(t,{capabilities:a,layout:o,elementBlock:c,positional:r,named:i,blocks:u})):(t(78,l),Hf(t,{capabilities:a,elementBlock:c,positional:r,named:i,atNames:!0,blocks:u}))}function Wf(t,e,n,r,i,s,o,a){let l=n?[n,[]]:null,c=jf(s);Bf(t,()=>(Cf(t,e),t(33,3,0),2),()=>{t(66,df("ELSE")),a?t(81):t(80,{type:2,value:void 0}),t(79),Hf(t,{capabilities:!0,elementBlock:l,positional:r,named:i,atNames:o,blocks:c}),t(cf,"ELSE")})}function Hf(t,{capabilities:e,elementBlock:n,positional:r,named:i,atNames:s,blocks:o,layout:a}){let l=Boolean(o),c=!0===e||bu(e,fu.prepareArgs)||0!==i?.[0].length,u=o.with("attrs",n);t(36,4),t(33,3,1),t(35,4),t(0),function(t,e,n,r,i){let s=r.names;for(const l of s)If(t,r.get(l));let o=Nf(t,e)<<4;i&&(o|=8),r.hasAny&&(o|=7);let a=Up;if(n){a=n[0];let e=n[1];for(let n=0;n<e.length;n++)Cf(t,e[n])}t(82,a,s,o)}(t,r,i,u,s),t(85,4),Gf(t,u.has("default"),l,c,()=>{a?(t(63,ff(a.symbolTable)),t(28,gf(a)),t(61)):t(92,4),t(95,4)}),t(35,4)}function Gf(t,e,n,r,i=null){t(97,4),t(59),t(87,0|e),i&&i(),t(88,4),t(90,4),t(38,4),t(19,0),r&&t(17,4),n&&t(18,4),t(34,1),t(96,4),t(100,4),t(1),t(40),t(60),t(98)}var Zf=new wf,Kf=["class","id","value","name","type","style","href"],Yf=["div","span","p","a"];function Xf(t){return"string"==typeof t?t:Yf[t]}function Jf(t){return"string"==typeof t?t:Kf[t]}function Qf(t){return null===t?null:[t[0].map(t=>`@${t}`),t[1]]}Zf.add(3,(t,e)=>t(42,e[1])),Zf.add(13,t=>t(55)),Zf.add(12,t=>t(54)),Zf.add(4,(t,[,e,n,r])=>{ef(e)?t(1003,e,e=>{t(0),Of(t,n,r,!1),t(57,e),t(1)}):(Cf(t,e),t(0),Of(t,n,r,!1),t(33,2,1),t(108),t(1))}),Zf.add(14,(t,[,e,n,r])=>{t(51,Jf(e),n,r??null)}),Zf.add(24,(t,[,e,n,r])=>{t(105,Jf(e),n,r??null)}),Zf.add(15,(t,[,e,n,r])=>{Cf(t,n),t(52,Jf(e),!1,r??null)}),Zf.add(22,(t,[,e,n,r])=>{Cf(t,n),t(52,Jf(e),!0,r??null)}),Zf.add(16,(t,[,e,n,r])=>{Cf(t,n),t(53,Jf(e),!1,r??null)}),Zf.add(23,(t,[,e,n,r])=>{Cf(t,n),t(53,Jf(e),!0,r??null)}),Zf.add(10,(t,[,e])=>{t(48,Xf(e))}),Zf.add(11,(t,[,e])=>{t(89),t(48,Xf(e))}),Zf.add(8,(t,[,e,n,r,i])=>{tf(e)?t(of,e,e=>{Vf(t,e,n,null,r,i)}):Wf(t,e,n,null,r,i,!0,!0)}),Zf.add(18,(t,[,e,n])=>Lf(t,e,n)),Zf.add(17,(t,[,e])=>Lf(t,e,null)),Zf.add(26,(t,[,e,n,r])=>{t(103,function(t,e,n){return{type:3,value:{locals:t,upvars:e,lexical:n}}}(e,n,r))}),Zf.add(1,(t,[,e])=>{if(Array.isArray(e))if(rf(e))t(1008,e,{ifComponent(e){Vf(t,e,null,null,null,null)},ifHelper(e){t(0),Ef(t,e,null,null),t(3,pf("cautious-non-dynamic-append")),t(1)},ifValue(e){t(0),t(29,e),t(3,pf("cautious-non-dynamic-append")),t(1)}});else if(28===e[0]){let[,n,r,i]=e;rf(n)?t(1007,n,{ifComponent(e){Vf(t,e,null,r,Qf(i),null)},ifHelper(e){t(0),Ef(t,e,r,i),t(3,pf("cautious-non-dynamic-append")),t(1)}}):Uf(t,()=>{Cf(t,n),t(106)},e=>{e(0,()=>{t(68),t(81),t(79),Hf(t,{capabilities:!0,elementBlock:null,positional:r,named:i,atNames:!1,blocks:jf(null)})}),e(1,()=>{Rf(t,r,i,()=>{t(3,pf("cautious-non-dynamic-append"))})})})}else t(0),Cf(t,e),t(3,pf("cautious-append")),t(1);else t(41,null==e?"":String(e))}),Zf.add(2,(t,[,e])=>{Array.isArray(e)?(t(0),Cf(t,e),t(3,pf("trusting-append")),t(1)):t(41,null==e?"":String(e))}),Zf.add(6,(t,[,e,n,r,i])=>{tf(e)?t(of,e,e=>{Vf(t,e,null,n,Qf(r),i)}):Wf(t,e,null,n,r,i,!1,!1)}),Zf.add(40,(t,[,e,n,r,i])=>{$f(t,()=>(Cf(t,n),void 0===i?Sf(t,void 0):Cf(t,i),Cf(t,r),t(33,3,0),4),()=>{t(50),Pf(t,e),t(56)})}),Zf.add(41,(t,[,e,n,r])=>$f(t,()=>(Cf(t,e),t(71),1),()=>{Pf(t,n)},r?()=>{Pf(t,r)}:void 0)),Zf.add(42,(t,[,e,n,r,i])=>Bf(t,()=>(n?Cf(t,n):Sf(t,null),Cf(t,e),2),()=>{t(72,df("BODY"),df("ELSE")),t(0),t(33,2,1),t(6,df("ITER")),t(cf,"ITER"),t(74,df("BREAK")),t(cf,"BODY"),Mf(t,r,2),t(34,2),t(4,df("FINALLY")),t(cf,"BREAK"),t(1),t(73),t(4,df("FINALLY")),t(cf,"ELSE"),i&&Pf(t,i)})),Zf.add(44,(t,[,e,n])=>{Mf(t,n,Nf(t,e))}),Zf.add(45,(t,[,e,n])=>{if(e){let[r,i]=e;Nf(t,i),function(t,e,n){t(59),t(58,e),n(),t(60)}(t,r,()=>{Pf(t,n)})}else Pf(t,n)}),Zf.add(46,(t,[,e,n,r,i])=>{tf(e)?t(of,e,e=>{Vf(t,e,null,n,Qf(r),i)}):Wf(t,e,null,n,r,i,!1,!1)});var tg=class{compiled=new WeakMap;constructor(t,e,n,r="plain block"){this.statements=t,this.meta=e,this.symbolTable=n,this.moduleName=r}compile(t){return function(t,e){if(t.compiled.has(e))return t.compiled.get(e);t.compiled.set(e,-1);let{statements:n,meta:r}=t,i=function(t,e,n){let r=Zf,i=bf(n,e),{encoder:s,evaluation:o}=i;function a(...t){yf(s,o,e,t)}for(const l of t)r.compile(a,l);return i.encoder.commit(e.size)}(n,r,e);return t.compiled.set(e,i),i}(this,t)}},eg=class{symbolTable;compiled=null;attrsBlockNumber;meta;constructor(t,e){this.layout=t,this.moduleName=e;let{block:n}=t,[,r]=n;r=r.slice();let i=r.indexOf(qf);this.attrsBlockNumber=-1===i?r.push(qf):i+1,this.symbolTable={symbols:r},this.meta=Ff(t)}compile(t){if(null!==this.compiled)return this.compiled;let e=Ff(this.layout),n=bf(t,e),{encoder:r,evaluation:i}=n;var s,o,a;s=function(...t){yf(r,i,e,t)},o=this.layout,a=this.attrsBlockNumber,s(uf),function(t,e,n){t(36,5),n(),t(35,5)}(s,0,()=>{s(91,4),s(31),s(33,3,0)}),s(66,df("BODY")),s(36,5),s(89),s(49),s(99,4),Lf(s,a,null),s(54),s(cf,"BODY"),Pf(s,[o.block[0],[]]),s(36,5),s(66,df("END")),s(55),s(cf,"END"),s(35,5),s(hf);let l=n.encoder.commit(e.size);return"number"!=typeof l||(this.compiled=l),l}},ng=0,rg={cacheHit:0,cacheMiss:0};function ig({id:t,moduleName:e,block:n,scope:r,isStrictMode:i}){let s,o=t||"client-"+ng++,a=null,l=new WeakMap,c=t=>{if(void 0===s&&(s=JSON.parse(n)),void 0===t)return null===a?(rg.cacheMiss++,a=new sg({id:o,block:s,moduleName:e,owner:null,scope:r,isStrictMode:i})):rg.cacheHit++,a;let c=l.get(t);return void 0===c?(rg.cacheMiss++,c=new sg({id:o,block:s,moduleName:e,owner:t,scope:r,isStrictMode:i}),l.set(t,c)):rg.cacheHit++,c};return c.__id=o,c.__meta={moduleName:e},c}var sg=class{result="ok";layout=null;wrappedLayout=null;constructor(t){this.parsedLayout=t}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(t,e){let[n,r]=t.block;return new tg(n,Ff(t),{symbols:r},e)}(Fp({},this.parsedLayout),this.moduleName)}asWrappedLayout(){return this.wrappedLayout?this.wrappedLayout:this.wrappedLayout=new eg(Fp({},this.parsedLayout),this.moduleName)}},og=class{offset=0;constructor(t){this.heap=t}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)}},ag=1048576,lg=class{offset=0;heap;handleTable;handleState;constructor(){this.heap=new Int32Array(ag),this.handleTable=[],this.handleState=[]}entries(){return this.offset}pushRaw(t){this.sizeCheck(),this.heap[this.offset++]=t}pushOp(t){this.pushRaw(t)}pushMachine(t){this.pushRaw(1024|t)}sizeCheck(){let{heap:t}=this;if(this.offset===this.heap.length){let e=new Int32Array(t.length+ag);e.set(t,0),this.heap=e}}getbyaddr(t){return this.heap[t]}setbyaddr(t,e){this.heap[t]=e}malloc(){return this.handleTable.push(this.offset),this.handleTable.length-1}finishMalloc(t){}size(){return this.offset}getaddr(t){return this.handleTable[t]}sizeof(t){return this.handleTable,-1}free(t){this.handleState[t]=1}compact(){let t=0,{handleTable:e,handleState:n,heap:r}=this;for(let i=0;i<length;i++){let s=Xt(e[i]),o=Xt(e[i+1])-Xt(s),a=n[i];if(2!==a)if(1===a)n[i]=2,t+=o;else if(0===a){for(let e=s;e<=i+o;e++)r[e-t]=Xt(r[e]);e[i]=s-t}else 3===a&&(e[i]=s-t)}this.offset=this.offset-t}},cg=class{_opcode;constructor(t,e){this.constants=t,this.heap=e,this._opcode=new og(this.heap)}opcode(t){return this._opcode.offset=t,this._opcode}},ug={id:"1b32f5c2-7623-43d6-a0ad-9672898920a1",moduleName:"__default__.hbs",block:JSON.stringify([[[18,1,null]],["&default"],[]]),scope:null,isStrictMode:!0},hg=Object.freeze([]),dg=[!1,!0,null,void 0,hg],pg=dg.indexOf(hg),fg=class{reifiedArrs={[pg]:hg};defaultTemplate=ig(ug)();helperDefinitionCount=0;modifierDefinitionCount=0;componentDefinitionCount=0;values=dg.slice();indexMap=new Map(this.values.map((t,e)=>[t,e]));helperDefinitionCache=new WeakMap;modifierDefinitionCache=new WeakMap;componentDefinitionCache=new WeakMap;value(t){let e=this.indexMap,n=e.get(t);return void 0===n&&(n=this.values.push(t)-1,e.set(t,n)),n}array(t){if(0===t.length)return pg;let e=new Array(t.length);for(let n=0;n<t.length;n++)e[n]=this.value(t[n]);return this.value(e)}toPool(){return this.values}hasHandle(t){return this.values.length>t}helper(t,e=null,n){let r=this.helperDefinitionCache.get(t);if(void 0===r){let e=Nu(t);if(null===e)return this.helperDefinitionCache.set(t,null),null;let n="function"==typeof e?e:e.getHelper(t);r=this.value(n),this.helperDefinitionCache.set(t,r),this.helperDefinitionCount++}return r}modifier(t,e=null,n){let r=this.modifierDefinitionCache.get(t);if(void 0===r){let n=Mu(t);if(null===n)return this.modifierDefinitionCache.set(t,null),null;let i={resolvedName:e,manager:n,state:t};r=this.value(i),this.modifierDefinitionCache.set(t,r),this.modifierDefinitionCount++}return r}component(t,e,n,r){let i=this.componentDefinitionCache.get(t);if(void 0===i){let n=zu(t);if(null===n)return this.componentDefinitionCache.set(t,null),null;let s,o=mu(n.getCapabilities(t)),a=Np(t),l=null;s=vu(0,o,fu.dynamicLayout)?a?.(e):a?.(e)??this.defaultTemplate,void 0!==s&&(s=Pp(s),l=vu(0,o,fu.wrapped)?s.asWrappedLayout():s.asLayout()),i={resolvedName:null,handle:-1,manager:n,capabilities:o,state:t,compilable:l},i.handle=this.value(i),r&&(i.debugName=r),this.componentDefinitionCache.set(t,i),this.componentDefinitionCount++}return i}resolvedComponent(t,e){let n=this.componentDefinitionCache.get(t);if(void 0===n){let{manager:r,state:i,template:s}=t,o=mu(r.getCapabilities(t)),a=null;vu(0,o,fu.dynamicLayout)||(s=s??this.defaultTemplate),null!==s&&(s=Pp(s),a=vu(0,o,fu.wrapped)?s.asWrappedLayout():s.asLayout()),n={resolvedName:e,handle:-1,manager:r,capabilities:o,state:i,compilable:a},n.handle=this.value(n),this.componentDefinitionCache.set(t,n),this.componentDefinitionCount++}return n}getValue(t){return this.values[t]}getArray(t){let e=this.reifiedArrs,n=e[t];if(void 0===n){let r=this.getValue(t);n=new Array(r.length);for(const[t,e]of Hp(r))n[t]=this.getValue(e);e[t]=n}return n}},gg=class{constructor(t,e){this.element=t,this.nextSibling=e}},mg=class{constructor(t,e,n){this.parentNode=t,this.first=e,this.last=n}parentElement(){return this.parentNode}firstNode(){return this.first}lastNode(){return this.last}};function yg(t,e){let n=t.parentElement(),r=t.firstNode(),i=t.lastNode(),s=r;for(;;){let t=s.nextSibling;if(n.insertBefore(s,e),s===i)return t;s=Jt(t)}}function vg(t){let e=t.parentElement(),n=t.firstNode(),r=t.lastNode(),i=n;for(;;){let t=i.nextSibling;if(e.removeChild(i),i===r)return t;i=Jt(t)}}function bg(t){return wg(t)?"":String(t)}function wg(t){return null==t||"function"!=typeof t.toString}function _g(t){return null!==t&&"object"==typeof t}function xg(t){return _g(t)&&"function"==typeof t.toHTML}function Cg(t){return"string"==typeof t}function Sg(t,e){let n,r;if(e in t)r=e,n="prop";else{let i=e.toLowerCase();i in t?(n="prop",r=i):(n="attr",r=e)}return"prop"!==n||"style"!==r.toLowerCase()&&!function(t,e){let n=Eg[t.toUpperCase()];return!(!n||!n[e.toLowerCase()])}(t.tagName,r)||(n="attr"),{normalized:r,type:n}}var kg,Eg={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}},Rg="http://www.w3.org/1998/Math/MathML",Tg=["javascript:","vbscript:"],Lg=["A","AREA","BODY","LINK","IMG","IFRAME","BASE","FORM","BUTTON","INPUT"],Ig=["EMBED"],Pg=["IFRAME","OBJECT"],Mg=["href","src","background","action","formaction","xlink:href"],Ag=["src"],Og=["src","data"];function Ng(t,e){return-1!==t.indexOf(e)}function Fg(t,e){return(null===t||Ng(Lg,t.toUpperCase()))&&Ng(Mg,e)}function zg(t,e){return null!==t&&Ng(Ig,t.toUpperCase())&&Ng(Ag,e)}function Dg(t,e){return null!==t&&Ng(Pg,t.toUpperCase())&&Ng(Og,e)}function jg(t,e){return Fg(t,e)||zg(t,e)||Dg(t,e)}function Ug(t){return kg||(kg=function(){const t=URL;if("object"==typeof t&&null!==t&&"function"==typeof t.parse){let e=t;return t=>{let n=null;return"string"==typeof t&&(n=e.parse(t.replace(/[\t\n\r]/gu,"")).protocol),null===n?":":n}}if("function"==typeof t)return e=>{try{return new t(e).protocol}catch{return":"}};throw new Error('@glimmer/runtime needs a valid "globalThis.URL"')}()),kg(t)}function Bg(t,e,n){if(null==n)return n;if(xg(n))return n.toHTML();const r=t.tagName;let i=bg(n);if(Fg(r,e)){let t=Ug(i);if(Ng(Tg,t))return`unsafe:${i}`}if(Dg(r,e)){let t=Ug(i);if("data:"===t||Ng(Tg,t))return`unsafe:${i}`}return zg(r,e)?`unsafe:${i}`:i}function $g(t,e,n){const{tagName:r,namespaceURI:i}=t,s={element:t,name:e,namespace:n};if("http://www.w3.org/2000/svg"===i)return qg(r,e,s);const{type:o,normalized:a}=Sg(t,e);return"attr"===o?qg(r,a,s):function(t,e,n){return jg(t,e)?new Gg(e,n):function(t,e){return("INPUT"===t||"TEXTAREA"===t)&&"value"===e}(t,e)?new Kg(e,n):function(t,e){return"OPTION"===t&&"selected"===e}(t,e)?new Yg(e,n):new Hg(e,n)}(r,a,s)}function qg(t,e,n){return jg(t,e)?new Zg(n):new Wg(n)}var Vg=class{constructor(t){this.attribute=t}},Wg=class extends Vg{set(t,e,n){const r=Xg(e);if(null!==r){const{name:e,namespace:n}=this.attribute;t.__setAttribute(e,r,n)}}update(t,e){const n=Xg(t),{element:r,name:i}=this.attribute;null===n?r.removeAttribute(i):r.setAttribute(i,n)}},Hg=class extends Vg{constructor(t,e){super(e),this.normalizedName=t}value;set(t,e,n){null!=e&&(this.value=e,t.__setProperty(this.normalizedName,e))}update(t,e){const{element:n}=this.attribute;this.value!==t&&(n[this.normalizedName]=this.value=t,null==t&&this.removeAttribute())}removeAttribute(){const{element:t,namespace:e}=this.attribute;e?t.removeAttributeNS(e,this.normalizedName):t.removeAttribute(this.normalizedName)}},Gg=class extends Hg{set(t,e,n){const{element:r,name:i}=this.attribute,s=Bg(r,i,e);super.set(t,s,n)}update(t,e){const{element:n,name:r}=this.attribute,i=Bg(n,r,t);super.update(i,e)}},Zg=class extends Wg{set(t,e,n){const{element:r,name:i}=this.attribute,s=Bg(r,i,e);super.set(t,s,n)}update(t,e){const{element:n,name:r}=this.attribute,i=Bg(n,r,t);super.update(i,e)}},Kg=class extends Hg{set(t,e){const n=bg(e);t.__setProperty("value",n),""===e&&"INPUT"===this.attribute.element.tagName&&t.__setAttribute("value","",null)}update(t){const e=this.attribute.element,n=e.value,r=bg(t);n!==r&&(e.value=r)}},Yg=class extends Hg{set(t,e){null!=e&&!1!==e&&t.__setProperty("selected",!0)}update(t){this.attribute.element.selected=!!t}};function Xg(t){return!1===t||null==t||void 0===t.toString?null:!0===t?"":"function"==typeof t?null:String(t)}var Jg=class{constructor(t){this.node=t}firstNode(){return this.node}},Qg=class{constructor(t){this.node=t}lastNode(){return this.node}},tm=class{dom;updateOperations;constructing=null;operations=null;env;cursors=new se;modifierStack=new se;blockStack=new se;static forInitialRender(t,e){return new this(t,e.element,e.nextSibling).initialize()}static resume(t,e){let n=new this(t,e.parentElement(),e.reset(t)).initialize();return n.pushBlock(e),n}constructor(t,e,n){this.pushElement(e,n),this.env=t,this.dom=t.getAppendOperations(),this.updateOperations=t.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 rm(this.element))}pushBlockList(t){return this.pushBlock(new im(this.element,t))}pushBlock(t,e=!1){let n=this.blockStack.current;return null!==n&&(e||n.didAppendBounds(t)),this.__openBlock(),this.blockStack.push(t),t}popBlock(){return this.block().finalize(this),this.__closeBlock(),this.blockStack.pop()}__openBlock(){}__closeBlock(){}openElement(t){let e=this.__openElement(t);return this.constructing=e,e}__openElement(t){return this.dom.createElement(t,this.element)}flushElement(t){let e=this.element,n=this.constructing;this.__flushElement(e,n),this.constructing=null,this.operations=null,this.pushModifiers(t),this.pushElement(n,null),this.didOpenElement(n)}__flushElement(t,e){this.dom.insertBefore(t,e,this.nextSibling)}closeElement(){return this.willCloseElement(),this.popElement(),this.popModifiers()}pushRemoteElement(t,e,n){return this.__pushRemoteElement(t,e,n)}__pushRemoteElement(t,e,n){if(this.pushElement(t,n),void 0===n)for(;t.lastChild;)t.removeChild(t.lastChild);let r=new nm(t);return this.pushBlock(r,!0)}popRemoteElement(){const t=this.popBlock();return this.popElement(),t}pushElement(t,e=null){this.cursors.push(new gg(t,e))}pushModifiers(t){this.modifierStack.push(t)}popModifiers(){return this.modifierStack.pop()}didAppendBounds(t){return this.block().didAppendBounds(t),t}didAppendNode(t){return this.block().didAppendNode(t),t}didOpenElement(t){return this.block().openElement(t),t}willCloseElement(){this.block().closeElement()}appendText(t){return this.didAppendNode(this.__appendText(t))}__appendText(t){let{dom:e,element:n,nextSibling:r}=this,i=e.createTextNode(t);return e.insertBefore(n,i,r),i}__appendNode(t){return this.dom.insertBefore(this.element,t,this.nextSibling),t}__appendFragment(t){let e=t.firstChild;if(e){let n=new mg(this.element,e,t.lastChild);return this.dom.insertBefore(this.element,t,this.nextSibling),n}{const t=this.__appendComment("");return new mg(this.element,t,t)}}__appendHTML(t){return this.dom.insertHTMLBefore(this.element,this.nextSibling,t)}appendDynamicHTML(t){let e=this.trustedContent(t);this.didAppendBounds(e)}appendDynamicText(t){let e=this.untrustedContent(t);return this.didAppendNode(e),e}appendDynamicFragment(t){let e=this.__appendFragment(t);this.didAppendBounds(e)}appendDynamicNode(t){let e=this.__appendNode(t),n=new mg(this.element,e,e);this.didAppendBounds(n)}trustedContent(t){return this.__appendHTML(t)}untrustedContent(t){return this.__appendText(t)}appendComment(t){return this.didAppendNode(this.__appendComment(t))}__appendComment(t){let{dom:e,element:n,nextSibling:r}=this,i=e.createComment(t);return e.insertBefore(n,i,r),i}__setAttribute(t,e,n){this.dom.setAttribute(this.constructing,t,e,n)}__setProperty(t,e){this.constructing[t]=e}setStaticAttribute(t,e,n){this.__setAttribute(t,e,n)}setDynamicAttribute(t,e,n,r){let i=$g(this.constructing,t,r);return i.set(this,e,this.env),i}},em=class{first=null;last=null;nesting=0;constructor(t){this.parent=t}parentElement(){return this.parent}firstNode(){return this.first.firstNode()}lastNode(){return this.last.lastNode()}openElement(t){this.didAppendNode(t),this.nesting++}closeElement(){this.nesting--}didAppendNode(t){0===this.nesting&&(this.first||(this.first=new Jg(t)),this.last=new Qg(t))}didAppendBounds(t){0===this.nesting&&(this.first||(this.first=t),this.last=t)}finalize(t){null===this.first&&t.appendComment("")}},nm=class extends em{constructor(t){super(t),et(this,()=>{this.parentElement()===this.firstNode().parentNode&&vg(this)})}},rm=class extends em{constructor(t){super(t)}reset(){nt(this);let t=vg(this);return this.first=null,this.last=null,this.nesting=0,t}},im=class{constructor(t,e){this.parent=t,this.boundList=e,this.parent=t,this.boundList=e}parentElement(){return this.parent}firstNode(){return this.boundList[0].firstNode()}lastNode(){let t=this.boundList;return t[t.length-1].lastNode()}openElement(t){}closeElement(){}didAppendNode(t){}didAppendBounds(t){}finalize(t){this.boundList.length}};function sm(t,e){return tm.forInitialRender(t,e)}var om={foreignObject:1,desc:1,title:1},am=Object.create(null),lm=class{constructor(t){this.document=t,this.setupUselessElement()}setupUselessElement(){this.uselessElement=this.document.createElement("div")}createElement(t,e){let n,r,i,s;if(e?(n="http://www.w3.org/2000/svg"===e.namespaceURI||"svg"===t,i=e.namespaceURI===Rg||"math"===t,r=!!om[e.tagName]):(n="svg"===t,i="math"===t,r=!1),!i&&!n||r)return this.document.createElement(t);if(am[t])throw new Error(`Cannot create a ${t} inside an SVG context`);return s=i?Rg:"http://www.w3.org/2000/svg",this.document.createElementNS(s,t)}insertBefore(t,e,n){t.insertBefore(e,n)}insertHTMLBefore(t,e,n){if(""===n){const n=this.createComment("");return t.insertBefore(n,e),new mg(t,n,n)}const r=e?e.previousSibling:t.lastChild;let i;if(null===e)t.insertAdjacentHTML("beforeend",n),i=t.lastChild;else if(e instanceof HTMLElement)e.insertAdjacentHTML("beforebegin",n),i=e.previousSibling;else{const{uselessElement:r}=this;t.insertBefore(r,e),r.insertAdjacentHTML("beforebegin",n),i=r.previousSibling,t.removeChild(r)}const s=r?r.nextSibling:t.firstChild;return new mg(t,s,i)}createTextNode(t){return this.document.createTextNode(t)}createComment(t){return this.document.createComment(t)}},cm=class extends lm{createElementNS(t,e){return this.document.createElementNS(t,e)}setAttribute(t,e,n,r=null){r?t.setAttributeNS(r,e,n):t.setAttribute(e,n)}};function um(t){return t}function hm(t){return"getDebugCustomRenderTree"in t}new class{validate(t){switch(t){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 dm=Symbol("TYPE"),pm=Symbol("INNER"),fm=Symbol("OWNER"),gm=Symbol("ARGS"),mm=Symbol("RESOLVED"),ym=new WeakSet;function vm(t){return ym.has(t)}function bm(t,e){return vm(t)&&t[dm]===e}var wm=class{[dm];[pm];[fm];[gm];[mm];constructor(t,e,n,r,i=!1){ym.add(this),this[dm]=t,this[pm]=e,this[fm]=n,this[gm]=r,this[mm]=i}};function _m(t){let e,n,r,i,s,o=t;for(;;){let{[gm]:t,[pm]:a}=o;if(null!==t){let{named:r,positional:i}=t;i.length>0&&(e=void 0===e?i:i.concat(e)),void 0===n&&(n=[]),n.unshift(r)}if(!vm(a)){r=a,i=o[fm],s=o[mm];break}o=a}return{definition:r,owner:i,resolved:s,positional:e,named:n}}function xm(t,e,n,r,i=!1){return new wm(t,e,n,r,i)}var Cm=0,Sm=class{id=Cm++;value;constructor(t){this.value=t}get(){return this.value}release(){this.value=null}toString(){let t=`Ref ${this.id}`;if(null===this.value)return`${t} (released)`;try{return`${t}: ${this.value}`}catch{return t}}},km=class{stack=new se;refs=new WeakMap;roots=new Set;nodes=new WeakMap;begin(){this.reset()}create(t,e){let n=Fp({},e,{bounds:null,refs:new Set});this.nodes.set(t,n),this.appendChild(n,t),this.enter(t)}update(t){this.enter(t)}didRender(t,e){this.nodeFor(t).bounds=e,this.exit()}willDestroy(t){this.refs.get(t).release()}commit(){this.reset()}capture(){return this.captureRefs(this.roots)}reset(){if(0!==this.stack.size){let t=this.stack.toArray()[0],e=this.refs.get(t);for(void 0!==e&&this.roots.delete(e);!this.stack.isEmpty();)this.stack.pop()}}enter(t){this.stack.push(t)}exit(){this.stack.pop()}nodeFor(t){return this.nodes.get(t)}appendChild(t,e){let n=this.stack.current,r=new Sm(e);if(this.refs.set(e,r),n){let e=this.nodeFor(n);e.refs.add(r),t.parent=e}else this.roots.add(r)}captureRefs(t){let e=[];return t.forEach(n=>{let r=n.get();r?e.push(this.captureNode(`render-node:${n.id}`,r)):t.delete(n)}),e}captureNode(t,e){let n=this.nodeFor(e),{type:r,name:i,args:s,instance:o,refs:a}=n,l=this.captureBounds(n),c=this.captureRefs(a);return{id:t,type:r,name:i,args:sy(s),instance:o,bounds:l,children:c}}captureBounds(t){let e=t.bounds;return{parentElement:e.parentElement(),firstNode:e.firstNode(),lastNode:e.lastNode()}}},Em=new class{evaluateOpcode=new Array(113).fill(null);constructor(){}add(t,e,n="syscall"){this.evaluateOpcode[t]={syscall:"machine"!==n,evaluate:e}}evaluate(t,e,n){let r=this.evaluateOpcode[n];r.syscall?(e.isMachine,r.syscall,e.isMachine,e.type,r.evaluate(t,e)):(e.isMachine,r.syscall,e.isMachine,e.type,r.evaluate(t.lowlevel,e))}};Em.add(39,t=>t.pushChildScope()),Em.add(40,t=>t.popScope()),Em.add(59,t=>t.pushDynamicScope()),Em.add(60,t=>t.popDynamicScope()),Em.add(28,(t,{op1:e})=>{t.stack.push(t.constants.getValue(e))}),Em.add(29,(t,{op1:e})=>{t.stack.push(pe(t.constants.getValue(e)))}),Em.add(30,(t,{op1:e})=>{let n=t.stack;if(e>=0){let r=t.constants.getValue(e);n.push(r)}else n.push(Lp(e))}),Em.add(31,t=>{let e,n=t.stack,r=um(n.pop());e=void 0===r?ce:null===r?ue:!0===r?he:!1===r?de:le(r),n.push(e)}),Em.add(33,(t,{op1:e,op2:n})=>{let r=um(t.fetchValue(um(e)))-n;t.stack.dup(r)}),Em.add(34,(t,{op1:e})=>{t.stack.pop(e)}),Em.add(35,(t,{op1:e})=>{t.load(um(e))}),Em.add(36,(t,{op1:e})=>{t.fetch(um(e))}),Em.add(58,(t,{op1:e})=>{let n=t.constants.getArray(e);t.bindDynamicScope(n)}),Em.add(69,(t,{op1:e})=>{t.enter(e)}),Em.add(70,t=>{t.exit()}),Em.add(63,(t,{op1:e})=>{t.stack.push(t.constants.getValue(e))}),Em.add(62,t=>{t.stack.push(t.scope())}),Em.add(61,t=>{let e=t.stack,n=e.pop();n?e.push(t.compile(n)):e.push(null)}),Em.add(64,t=>{let{stack:e}=t,n=um(e.pop()),r=um(e.pop()),i=um(e.pop()),s=um(e.pop());if(null===i||null===n)return t.lowlevel.pushFrame(),void t.pushScope(r??t.scope());let o=r;{let t=i.parameters,e=t.length;if(e>0){o=o.child();for(let n=0;n<e;n++)o.bindSymbol(Xt(t[n]),s.at(n))}}t.lowlevel.pushFrame(),t.pushScope(o),t.call(n)}),Em.add(65,(t,{op1:e})=>{let n=um(t.stack.pop()),r=Boolean(_e(n));be(n)?r&&t.lowlevel.goto(e):(r&&t.lowlevel.goto(e),t.updateWith(new Rm(n)))}),Em.add(66,(t,{op1:e})=>{let n=um(t.stack.pop()),r=Boolean(_e(n));be(n)?r||t.lowlevel.goto(e):(r||t.lowlevel.goto(e),t.updateWith(new Rm(n)))}),Em.add(67,(t,{op1:e,op2:n})=>{um(t.stack.peek())===n&&t.lowlevel.goto(e)}),Em.add(68,t=>{let e=um(t.stack.peek());be(e)||t.updateWith(new Rm(e))}),Em.add(71,t=>{let{stack:e}=t,n=um(e.pop());e.push(ge(()=>B(_e(n))))});var Rm=class{last;constructor(t){this.ref=t,this.last=_e(t)}evaluate(t){let{last:e,ref:n}=this;e!==_e(n)&&t.throw()}},Tm=class{last;constructor(t,e){this.ref=t,this.filter=e,this.last=e(_e(t))}evaluate(t){let{last:e,ref:n,filter:r}=this;e!==r(_e(n))&&t.throw()}},Lm=class{tag=yt;lastRevision=1;target;finalize(t,e){this.target=e,this.didModify(t)}evaluate(t){let{tag:e,target:n,lastRevision:r}=this;!t.alwaysRevalidate&&ut(e,r)&&(Ft(e),t.goto(n))}didModify(t){this.tag=t,this.lastRevision=ct(this.tag),Ft(t)}},Im=class{constructor(t){this.debugLabel=t}evaluate(){It(this.debugLabel)}},Pm=class{constructor(t){this.target=t}evaluate(){let t=Pt();this.target.didModify(t)}};Em.add(41,(t,{op1:e})=>{t.tree().appendText(t.constants.getValue(e))}),Em.add(42,(t,{op1:e})=>{t.tree().appendComment(t.constants.getValue(e))}),Em.add(48,(t,{op1:e})=>{t.tree().openElement(t.constants.getValue(e))}),Em.add(49,t=>{let e=um(_e(um(t.stack.pop())));t.tree().openElement(e)}),Em.add(50,t=>{let e=um(t.stack.pop()),n=um(t.stack.pop()),r=um(t.stack.pop()),i=um(_e(e)),s=um(_e(n)),o=_e(r);be(e)||t.updateWith(new Rm(e)),void 0===s||be(n)||t.updateWith(new Rm(n));let a=t.tree().pushRemoteElement(i,o,s);if(t.associateDestroyable(a),void 0!==t.env.debugRenderTree){let r=Xm(void 0===s?{}:{insertBefore:n},[e]);t.env.debugRenderTree.create(a,{type:"keyword",name:"in-element",args:r,instance:null}),et(a,()=>{t.env.debugRenderTree?.willDestroy(a)})}}),Em.add(56,t=>{let e=t.tree().popRemoteElement();void 0!==t.env.debugRenderTree&&t.env.debugRenderTree.didRender(e,e)}),Em.add(54,t=>{let e=um(t.fetchValue(6)),n=null;e&&(n=e.flush(t),t.loadValue(6,null)),t.tree().flushElement(n)}),Em.add(55,t=>{let e=t.tree().closeElement();null!==e&&e.forEach(e=>{t.env.scheduleInstallModifier(e);const n=e.manager.getDestroyable(e.state);null!==n&&t.associateDestroyable(n)})}),Em.add(57,(t,{op1:e})=>{let n=um(t.stack.pop());if(!t.env.isInteractive)return;let r=t.getOwner(),i=t.constants.getValue(e),{manager:s}=i,{constructing:o}=t.tree(),a=n.capture(),l=s.create(r,o,i.state,a),c={manager:s,state:l,definition:i};um(t.fetchValue(6)).addModifier(t,c,a);let u=s.getTag(l);return null!==u?(Ft(u),t.updateWith(new Mm(u,c))):void 0}),Em.add(108,t=>{let{stack:e}=t,n=um(e.pop()),r=um(e.pop());if(!t.env.isInteractive)return;let i=r.capture(),{positional:s,named:o}=i,{constructing:a}=t.tree(),l=t.getOwner(),c=ge(()=>{let t,e,r=_e(n);if(!ie(r))return;if(bm(r,2)){let{definition:n,owner:a,positional:l,named:c}=_m(r);e=n,t=a,void 0!==l&&(i.positional=l.concat(s)),void 0!==c&&(i.named=Object.assign({},...c,o))}else e=r,t=l;let c=Mu(e);if(null===c)throw new Error("BUG: modifier manager expected");let u={resolvedName:null,manager:c,state:e};return{manager:c,state:c.create(t,a,u.state,i),definition:u}}),u=_e(c),h=null;return void 0!==u&&(um(t.fetchValue(6)).addModifier(t,u,i),h=u.manager.getTag(u.state),null!==h&&Ft(h)),!be(n)||h?t.updateWith(new Am(h,u,c)):void 0});var Mm=class{lastUpdated;constructor(t,e){this.tag=t,this.modifier=e,this.lastUpdated=ct(t)}evaluate(t){let{modifier:e,tag:n,lastUpdated:r}=this;Ft(n),ut(n,r)||(t.env.scheduleUpdateModifier(e),this.lastUpdated=ct(n))}},Am=class{lastUpdated;constructor(t,e,n){this.tag=t,this.instance=e,this.instanceRef=n,this.lastUpdated=ct(t??xt)}evaluate(t){let{tag:e,lastUpdated:n,instance:r,instanceRef:i}=this,s=_e(i);if(s!==r){if(void 0!==r){let t=r.manager.getDestroyable(r.state);null!==t&&nt(t)}if(void 0!==s){let{manager:n,state:r}=s,i=n.getDestroyable(r);null!==i&&tt(this,i),e=n.getTag(r),null!==e&&(this.lastUpdated=ct(e)),this.tag=e,t.env.scheduleInstallModifier(s)}this.instance=s}else null===e||ut(e,n)||(t.env.scheduleUpdateModifier(r),this.lastUpdated=ct(e));null!==e&&Ft(e)}};Em.add(51,(t,{op1:e,op2:n,op3:r})=>{let i=t.constants.getValue(e),s=t.constants.getValue(n),o=r?t.constants.getValue(r):null;t.tree().setStaticAttribute(i,s,o)}),Em.add(52,(t,{op1:e,op2:n,op3:r})=>{let i=t.constants.getValue(e),s=t.constants.getValue(n),o=um(t.stack.pop()),a=_e(o),l=r?t.constants.getValue(r):null,c=t.tree().setDynamicAttribute(i,a,s,l);be(o)||t.updateWith(new Om(o,c,t.env))});var Om=class{updateRef;constructor(t,e,n){let r=!1;this.updateRef=ge(()=>{let i=_e(t);r?e.update(i,n):r=!0}),_e(this.updateRef)}evaluate(){_e(this.updateRef)}};Em.add(78,(t,{op1:e})=>{let n=t.constants.getValue(e),{manager:r,capabilities:i}=n,s={definition:n,manager:r,capabilities:i,state:null,handle:null,table:null,lookup:null};t.stack.push(s)}),Em.add(80,(t,{op1:e})=>{let n,r=t.stack,i=um(_e(um(r.pop()))),s=t.constants,o=t.getOwner();if(s.getValue(e),t.loadValue(7,null),"string"==typeof i){let e=function(t,e,n,r){let i=t?.lookupComponent?.(n,r)??null;return e.resolvedComponent(i,n)}(t.context.resolver,s,i,o);n=e}else n=vm(i)?i:s.component(i,o);r.push(n)}),Em.add(81,t=>{let e,n=t.stack,r=_e(um(n.pop())),i=t.constants;e=vm(r)?r:i.component(r,t.getOwner(),!0),n.push(e)}),Em.add(79,t=>{let e,n,{stack:r}=t,i=r.pop();vm(i)?n=e=null:(n=i.manager,e=i.capabilities),r.push({definition:i,capabilities:e,manager:n,state:null,handle:null,table:null})}),Em.add(82,(t,{op1:e,op2:n,op3:r})=>{let i=t.stack,s=t.constants.getArray(e),o=r>>4,a=8&r,l=7&r?t.constants.getArray(n):$p;t.args.setup(i,s,l,o,!!a),i.push(t.args)}),Em.add(83,t=>{let{stack:e}=t;e.push(t.args.empty(e))}),Em.add(86,t=>{let e=t.stack,n=um(e.pop()).capture();e.push(n)}),Em.add(85,(t,{op1:e})=>{let n=t.stack,r=t.fetchValue(um(e)),i=um(n.pop()),{definition:s}=r;if(bm(s,0)){s.manager;let e=t.constants,{definition:n,owner:o,resolved:a,positional:l,named:c}=_m(s);if(a)s=n;else if("string"==typeof n){let r=t.context.resolver?.lookupComponent?.(n,o)??null;s=e.resolvedComponent(r,n)}else s=e.component(n,o);void 0!==c&&i.named.merge(Fp({},...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,t.loadValue(7,o)}let{manager:o,state:a}=s;if(!vu(0,r.capabilities,fu.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:t,named:e}=u,r=t.length;for(let i=0;i<r;i++)n.push(t[i]);let s=Object.keys(e);for(let i=0;i<s.length;i++)n.push(e[Xt(s[i])]);i.setup(n,s,c,r,!1)}n.push(i)}),Em.add(87,(t,{op1:e})=>{let n=um(t.fetchValue(4)),{definition:r,manager:i,capabilities:s}=n;if(!vu(0,s,fu.createInstance))return;let o=null;vu(0,s,fu.dynamicScope)&&(o=t.dynamicScope());let a=1&e,l=null;vu(0,s,fu.createArgs)&&(l=um(t.stack.peek()));let c=null;vu(0,s,fu.createCaller)&&(c=t.getSelf());let u=i.create(t.getOwner(),r.state,l,t.env,o,c,!!a);n.state=u,vu(0,s,fu.updateHook)&&t.updateWith(new jm(u,i,o))}),Em.add(88,(t,{op1:e})=>{let{manager:n,state:r,capabilities:i}=um(t.fetchValue(um(e))),s=n.getDestroyable(r);s&&t.associateDestroyable(s)}),Em.add(97,(t,{op1:e})=>{t.beginCacheGroup(void 0),t.tree().pushAppendingBlock()}),Em.add(89,t=>{t.loadValue(6,new Nm)}),Em.add(53,(t,{op1:e,op2:n,op3:r})=>{let i=t.constants.getValue(e),s=t.constants.getValue(n),o=um(t.stack.pop()),a=r?t.constants.getValue(r):null;um(t.fetchValue(6)).setAttribute(i,o,s,a)}),Em.add(105,(t,{op1:e,op2:n,op3:r})=>{let i=t.constants.getValue(e),s=t.constants.getValue(n),o=r?t.constants.getValue(r):null;um(t.fetchValue(6)).setStaticAttribute(i,s,o)});var Nm=class{attributes=ne();classes=[];modifiers=[];setAttribute(t,e,n,r){let i={value:e,namespace:r,trusting:n};"class"===t&&this.classes.push(e),this.attributes[t]=i}setStaticAttribute(t,e,n){let r={value:e,namespace:n};"class"===t&&this.classes.push(e),this.attributes[t]=r}addModifier(t,e,n){if(this.modifiers.push(e),void 0!==t.env.debugRenderTree){const{manager:r,definition:i,state:s}=e;if(null===s||"object"!=typeof s&&"function"!=typeof s)return;let{element:o,constructing:a}=t.tree(),l=i.resolvedName??r.getDebugName(i.state),c=r.getDebugInstance(s),u=new mg(o,a,a);t.env.debugRenderTree.create(s,{type:"modifier",name:l,args:n,instance:c}),t.env.debugRenderTree.didRender(s,u),t.associateDestroyable(s),t.updateWith(new Bm(s)),t.updateWith(new $m(s,u)),et(s,()=>{t.env.debugRenderTree?.willDestroy(s)})}}flush(t){let e,n=this.attributes;for(let r in this.attributes){if("type"===r){e=n[r];continue}let i=Xt(this.attributes[r]);"class"===r?zm(t,"class",Fm(this.classes),i.namespace,i.trusting):zm(t,r,i.value,i.namespace,i.trusting)}return void 0!==e&&zm(t,"type",e.value,e.namespace,e.trusting),this.modifiers}};function Fm(t){return 0===t.length?"":1===t.length?t[0]:function(t){return t.every(t=>"string"==typeof t)}(t)?t.join(" "):(e=t,ge(()=>{let t=[];for(const n of e){let e=bg("string"==typeof n?n:_e(n));e&&t.push(e)}return 0===t.length?null:t.join(" ")}));var e}function zm(t,e,n,r,i=!1){if("string"==typeof n)t.tree().setStaticAttribute(e,n,r);else{let s=t.tree().setDynamicAttribute(e,_e(n),i,r);be(n)||t.updateWith(new Om(n,s,t.env))}}function Dm(t,e,n,r,i){let s=n.table.symbols.indexOf(t),o=r.get(e);-1!==s&&i.scope().bindBlock(s+1,o),n.lookup&&(n.lookup[t]=o)}Em.add(99,(t,{op1:e})=>{let{definition:n,state:r}=um(t.fetchValue(um(e))),{manager:i}=n,s=um(t.fetchValue(6));i.didCreateElement(r,t.tree().constructing,s)}),Em.add(90,(t,{op1:e,op2:n})=>{let{definition:r,state:i}=um(t.fetchValue(um(e))),{manager:s}=r,o=s.getSelf(i);if(void 0!==t.env.debugRenderTree){let r,s=um(t.fetchValue(um(e))),{definition:a,manager:l}=s;if(t.stack.peek()===t.args)r=t.args.capture();else{let e=t.constants.getArray(n);t.args.setup(t.stack,e,[],0,!0),r=t.args.capture()}let c=a.compilable;if(null===c){vu(0,s.capabilities,fu.dynamicLayout);let e=t.context.resolver;c=null===e?null:l.getDynamicLayout(i,e)}if(t.associateDestroyable(s),hm(l))l.getDebugCustomRenderTree(s.definition.state,s.state,r).forEach(e=>{let{bucket:n}=e;t.env.debugRenderTree.create(n,e),et(s,()=>{t.env.debugRenderTree?.willDestroy(n)}),t.updateWith(new Bm(n))});else{let e=function(t,e=t.manager){return t.resolvedName??t.debugName??e.getDebugName(t.state)}(a,l);t.env.debugRenderTree.create(s,{type:"component",name:e,args:r,instance:_e(o)}),et(s,()=>{t.env.debugRenderTree?.willDestroy(s)}),t.updateWith(new Bm(s))}}t.stack.push(o)}),Em.add(91,(t,{op1:e})=>{let{definition:n,state:r}=um(t.fetchValue(um(e))),{manager:i}=n,s=i.getTagName(r);t.stack.push(s)}),Em.add(92,(t,{op1:e})=>{let n=um(t.fetchValue(um(e))),{manager:r,definition:i}=n,{stack:s}=t,{compilable:o}=i;if(null===o){let{capabilities:e}=n;vu(0,e,fu.dynamicLayout);let i=t.context.resolver;o=null===i?null:r.getDynamicLayout(n.state,i),null===o&&(o=vu(0,e,fu.wrapped)?Pp(t.constants.defaultTemplate).asWrappedLayout():Pp(t.constants.defaultTemplate).asLayout())}let a=o.compile(t.context);s.push(o.symbolTable),s.push(a)}),Em.add(75,(t,{op1:e})=>{let n=um(t.stack.pop()),r=um(t.stack.pop()),{manager:i,capabilities:s}=n,o={definition:n,manager:i,capabilities:s,state:null,handle:r.handle,table:r.symbolTable,lookup:null};t.loadValue(um(e),o)}),Em.add(95,(t,{op1:e})=>{let{stack:n}=t,r=um(n.pop()),i=um(n.pop()),s=um(t.fetchValue(um(e)));s.handle=r,s.table=i}),Em.add(38,(t,{op1:e})=>{let n,{table:r,manager:i,capabilities:s,state:o}=um(t.fetchValue(um(e)));vu(0,s,fu.hasSubOwner)?(n=i.getOwner(o),t.loadValue(7,null)):(n=t.fetchValue(7),null===n?n=t.getOwner():t.loadValue(7,null)),t.pushRootScope(r.symbols.length+1,n)}),Em.add(17,(t,{op1:e})=>{let n=um(t.fetchValue(um(e))),r=t.scope(),i=um(t.stack.peek()),s=i.named.atNames;for(let o=s.length-1;o>=0;o--){let t=Xt(s[o]),e=n.table.symbols.indexOf(t),a=i.named.get(t,!0);-1!==e&&r.bindSymbol(e+1,a),n.lookup&&(n.lookup[t]=a)}}),Em.add(18,(t,{op1:e})=>{let n=um(t.fetchValue(um(e))),{blocks:r}=um(t.stack.peek());for(const[i]of Hp(r.names))Dm(Xt(r.symbolNames[i]),Xt(r.names[i]),n,r,t)}),Em.add(96,(t,{op1:e})=>{let n=um(t.fetchValue(um(e)));t.call(n.handle)}),Em.add(100,(t,{op1:e})=>{let n=um(t.fetchValue(um(e))),{manager:r,state:i,capabilities:s}=n,o=t.tree().popBlock();void 0!==t.env.debugRenderTree&&(hm(r)?r.getDebugCustomRenderTree(n.definition.state,i,ly).reverse().forEach(e=>{let{bucket:n}=e;t.env.debugRenderTree.didRender(n,o),t.updateWith(new $m(n,o))}):(t.env.debugRenderTree.didRender(n,o),t.updateWith(new $m(n,o)))),vu(0,s,fu.createInstance)&&(um(r).didRenderLayout(i,o),t.env.didCreate(n),t.updateWith(new Um(n,o)))}),Em.add(98,t=>{t.commitCacheGroup()});var jm=class{constructor(t,e,n){this.component=t,this.manager=e,this.dynamicScope=n}evaluate(t){let{component:e,manager:n,dynamicScope:r}=this;n.update(e,r)}},Um=class{constructor(t,e){this.component=t,this.bounds=e}evaluate(t){let{component:e,bounds:n}=this,{manager:r,state:i}=e;r.didUpdateLayout(i,n),t.env.didUpdate(e)}},Bm=class{constructor(t){this.bucket=t}evaluate(t){t.env.debugRenderTree?.update(this.bucket)}},$m=class{constructor(t,e){this.bucket=t,this.bounds=e}evaluate(t){t.env.debugRenderTree?.didRender(this.bucket,this.bounds)}},qm=(new class{validate(t){return"object"==typeof t&&null!==t&&oe in t}expected(){return"Reference"}},class{stack=null;positional=new Wm;named=new Hm;blocks=new Km;constructor(){}empty(t){let e=t.registers[3]+1;return this.named.empty(t,e),this.positional.empty(t,e),this.blocks.empty(t,e),this}setup(t,e,n,r,i){this.stack=t;let s=this.named,o=e.length,a=t.registers[3]-o+1;s.setup(t,a,o,e,i);let l=a-r;this.positional.setup(t,l,r);let c=this.blocks,u=n.length,h=l-3*u;c.setup(t,h,u,n)}get base(){return this.blocks.base}get length(){return this.positional.length+this.named.length+3*this.blocks.length}at(t){return this.positional.at(t)}realloc(t){let{stack:e}=this;if(t>0&&null!==e){let{positional:n,named:r}=this,i=n.base+t;for(let t=n.length+r.length-1;t>=0;t--)e.copy(t+n.base,t+i);n.base+=t,r.base+=t,e.registers[3]+=t}}capture(){let t=0===this.positional.length?ay:this.positional.capture();return{named:0===this.named.length?oy:this.named.capture(),positional:t}}clear(){let{stack:t,length:e}=this;e>0&&null!==t&&t.pop(e)}}),Vm=Bp(),Wm=class{base=0;length=0;stack=null;_references=null;constructor(){}empty(t,e){this.stack=t,this.base=e,this.length=0,this._references=Vm}setup(t,e,n){this.stack=t,this.base=e,this.length=n,this._references=0===n?Vm:null}at(t){let{base:e,length:n,stack:r}=this;return t<0||t>=n?ce:um(r.get(t,e))}capture(){return this.references}prepend(t){let e=t.length;if(e>0){let{base:n,length:r,stack:i}=this;this.base=n-=e,this.length=r+e;for(let s=0;s<e;s++)i.set(t[s],s,n);this._references=null}}get references(){let t=this._references;if(!t){let{stack:e,base:n,length:r}=this;t=this._references=e.slice(n,n+r)}return t}},Hm=class{base=0;length=0;_references=null;_names=$p;_atNames=$p;constructor(){}empty(t,e){this.stack=t,this.base=e,this.length=0,this._references=Vm,this._names=$p,this._atNames=$p}setup(t,e,n,r,i){this.stack=t,this.base=e,this.length=n,0===n?(this._references=Vm,this._names=$p,this._atNames=$p):(this._references=null,i?(this._names=null,this._atNames=r):(this._names=r,this._atNames=null))}get names(){let t=this._names;return t||(t=this._names=this._atNames.map(this.toSyntheticName)),t}get atNames(){let t=this._atNames;return t||(t=this._atNames=this._names.map(this.toAtName)),t}has(t){return-1!==this.names.indexOf(t)}get(t,e=!1){let{base:n,stack:r}=this,i=(e?this.atNames:this.names).indexOf(t);return-1===i?ce:r.get(i,n)}capture(){let{names:t,references:e}=this,n=ne();for(const[r,i]of Hp(t))n[i]=Xt(e[r]);return n}merge(t){let e=Object.keys(t);if(e.length>0){let{names:n,length:r,stack:i}=this,s=n.slice();for(const o of e)-1===s.indexOf(o)&&(r=s.push(o),i.push(t[o]));this.length=r,this._references=null,this._names=s,this._atNames=null}}get references(){let t=this._references;if(!t){let{base:e,length:n,stack:r}=this;t=this._references=r.slice(e,e+n)}return t}toSyntheticName(t){return t.slice(1)}toAtName(t){return`@${t}`}};function Gm(t){return`&${t}`}var Zm=Bp(),Km=class{internalValues=null;_symbolNames=null;internalTag=null;names=$p;length=0;base=0;constructor(){}empty(t,e){this.stack=t,this.names=$p,this.base=e,this.length=0,this._symbolNames=null,this.internalTag=yt,this.internalValues=Zm}setup(t,e,n,r){this.stack=t,this.names=r,this.base=e,this.length=n,this._symbolNames=null,0===n?(this.internalTag=yt,this.internalValues=Zm):(this.internalTag=null,this.internalValues=null)}get values(){let t=this.internalValues;if(!t){let{base:e,length:n,stack:r}=this;t=this.internalValues=r.slice(e,e+3*n)}return t}has(t){return-1!==this.names.indexOf(t)}get(t){let e=this.names.indexOf(t);if(-1===e)return null;let{base:n,stack:r}=this,i=um(r.get(3*e,n)),s=um(r.get(3*e+1,n)),o=um(r.get(3*e+2,n));return null===o?null:[o,s,i]}capture(){return new Ym(this.names,this.values)}get symbolNames(){let t=this._symbolNames;return null===t&&(t=this._symbolNames=this.names.map(Gm)),t}},Ym=class{length;constructor(t,e){this.names=t,this.values=e,this.length=t.length}has(t){return-1!==this.names.indexOf(t)}get(t){let e=this.names.indexOf(t);return-1===e?null:[this.values[3*e+2],this.values[3*e+1],this.values[3*e]]}};function Xm(t,e){return{named:t,positional:e}}function Jm(t){let e=ne();for(const[n,r]of Object.entries(t))e[n]=_e(r);return e}function Qm(t){return t.map(_e)}function ty(t){return{named:Jm(t.named),positional:Qm(t.positional)}}var ey=Symbol("ARGUMENT_ERROR");function ny(t){return null!==t&&"object"==typeof t&&t[ey]}function ry(t){return{[ey]:!0,error:t}}function iy(t){let e=ne();for(const[r,i]of Object.entries(t))try{e[r]=_e(i)}catch(n){e[r]=ry(n)}return e}function sy(t){return{named:iy(t.named),positional:(e=t.positional,e.map(t=>{try{return _e(t)}catch(e){return ry(e)}}))};var e}var oy=Object.freeze(Object.create(null)),ay=Vm,ly=Xm(oy,ay),cy=a({FALSE_REFERENCE:()=>de,NULL_REFERENCE:()=>ue,REFERENCE:()=>oe,TRUE_REFERENCE:()=>he,UNDEFINED_REFERENCE:()=>ce,childRefFor:()=>Ce,childRefFromParts:()=>Se,createComputeRef:()=>ge,createConstRef:()=>pe,createDebugAliasRef:()=>{},createInvokableRef:()=>ve,createIteratorItemRef:()=>vy,createIteratorRef:()=>yy,createPrimitiveRef:()=>le,createReadOnlyRef:()=>me,createUnboundRef:()=>fe,isConstRef:()=>be,isInvokableRef:()=>ye,isUpdatableRef:()=>we,updateRef:()=>xe,valueForRef:()=>_e}),uy={},hy=(t,e)=>e,dy=(t,e)=>String(e),py=t=>null===t?uy:t,fy=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(t,e){ie(t)?this.weakMap.set(t,e):this.primitiveMap.set(t,e)}get(t){return ie(t)?this.weakMap.get(t):this.primitiveMap.get(t)}},gy=new fy;function my(t){let e=new fy;return(n,r)=>{let i=t(n,r),s=e.get(i)||0;return e.set(i,s+1),0===s?i:function(t,e){let n=gy.get(t);void 0===n&&(n=[],gy.set(t,n));let r=n[e];return void 0===r&&(r={value:t,count:e},n[e]=r),r}(i,s)}}function yy(t,e){return ge(()=>{let n=_e(t),r=function(t){switch(t){case"@key":return my(hy);case"@index":return my(dy);case"@identity":return my(py);default:return e=t,my(t=>null==t?t:V(t,e))}var e}(e);if(Array.isArray(n))return new wy(n,r);let i=U(n);return null===i?new wy(Up,()=>null):new by(i,r)})}function vy(t){let e=t,n=gt();return ge(()=>(Ft(n),e),t=>{e!==t&&(e=t,pt(n))})}var by=class{constructor(t,e){this.inner=t,this.keyFor=e}isEmpty(){return this.inner.isEmpty()}next(){let t=this.inner.next();return null!==t&&(t.key=this.keyFor(t.value,t.memo)),t}},wy=class{current;pos=0;constructor(t,e){this.iterator=t,this.keyFor=e,0===t.length?this.current={kind:"empty"}:this.current={kind:"first",value:t[this.pos]}}isEmpty(){return"empty"===this.current.kind}next(){let t,e=this.current;if("first"===e.kind)this.current={kind:"progress"},t=e.value;else{if(this.pos>=this.iterator.length-1)return null;t=this.iterator[++this.pos]}let{keyFor:n}=this;return{key:n(t,this.pos),value:t,memo:this.pos}}},_y=class t{bucket;constructor(t){this.bucket=t?Fp({},t):{}}get(t){return this.bucket[t]}set(t,e){return this.bucket[t]=e}child(){return new t(this.bucket)}},xy=class t{static root(e,{self:n,size:r=0}){let i=new Array(r+1).fill(ce);return new t(e,i,null).init({self:n})}static sized(e,n=0){let r=new Array(n+1).fill(ce);return new t(e,r,null)}owner;slots;callerScope;constructor(t,e,n){this.owner=t,this.slots=e,this.callerScope=n}init({self:t}){return this.slots[0]=t,this}snapshot(){return this.slots.slice()}getSelf(){return this.get(0)}getSymbol(t){return this.get(t)}getBlock(t){let e=this.get(t);return e===ce?null:e}bind(t,e){this.set(t,e)}bindSelf(t){this.set(0,t)}bindSymbol(t,e){this.set(t,e)}bindBlock(t,e){this.set(t,e)}bindCallerScope(t){this.callerScope=t}getCallerScope(){return this.callerScope}child(){return new t(this.owner,this.slots.slice(),this.callerScope)}get(t){if(t>=this.slots.length)throw new RangeError(`BUG: cannot get $${t} from scope; length=${this.slots.length}`);return this.slots[t]}set(t,e){if(t>=this.slots.length)throw new RangeError(`BUG: cannot get $${t} from scope; length=${this.slots.length}`);this.slots[t]=e}};["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(t=>am[t]=1);var Cy=/[\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 Sy(t){return Cy.test(t)}var ky=class extends lm{namespace;constructor(t){super(t),this.document=t,this.namespace=null}setAttribute(t,e,n){t.setAttribute(e,n)}removeAttribute(t,e){t.removeAttribute(e)}insertAfter(t,e,n){this.insertBefore(t,e,n.nextSibling)}},Ey=ky,Ry=Symbol("TRANSACTION"),Ty=class{scheduledInstallModifiers=[];scheduledUpdateModifiers=[];createdComponents=[];updatedComponents=[];didCreate(t){this.createdComponents.push(t)}didUpdate(t){this.updatedComponents.push(t)}scheduleInstallModifier(t){this.scheduledInstallModifiers.push(t)}scheduleUpdateModifier(t){this.scheduledUpdateModifiers.push(t)}commit(){let{createdComponents:t,updatedComponents:e}=this;for(const{manager:i,state:s}of t)i.didCreate(s);for(const{manager:i,state:s}of e)i.didUpdate(s);let{scheduledInstallModifiers:n,scheduledUpdateModifiers:r}=this;for(const{manager:i,state:s,definition:o}of n){let t=i.getTag(s);if(null!==t){let e=Vt(()=>i.install(s));ft(t,e)}else i.install(s)}for(const{manager:i,state:s,definition:o}of r){let t=i.getTag(s);if(null!==t){let e=Vt(()=>i.update(s));ft(t,e)}else i.update(s)}}},Ly=class{[Ry]=null;updateOperations;isInteractive;isArgumentCaptureError;debugRenderTree;constructor(t,e){this.delegate=e,this.isInteractive=e.isInteractive,this.debugRenderTree=this.delegate.enableDebugTooling?new km:void 0,this.isArgumentCaptureError=this.delegate.enableDebugTooling?ny:void 0,t.appendOperations?(this.appendOperations=t.appendOperations,this.updateOperations=t.updateOperations):t.document&&(this.appendOperations=new cm(t.document),this.updateOperations=new ky(t.document))}getAppendOperations(){return this.appendOperations}getDOM(){return this.updateOperations}begin(){this[Ry],this.debugRenderTree?.begin(),this[Ry]=new Ty}get transaction(){return this[Ry]}didCreate(t){this.transaction.didCreate(t)}didUpdate(t){this.transaction.didUpdate(t)}scheduleInstallModifier(t){this.isInteractive&&this.transaction.scheduleInstallModifier(t)}scheduleUpdateModifier(t){this.isInteractive&&this.transaction.scheduleUpdateModifier(t)}commit(){let t=this.transaction;this[Ry]=null,t.commit(),this.debugRenderTree?.commit(),this.delegate.onTransactionCommit()}};function Iy(t,e,n,r){return{env:new Ly(t,e),program:new cg(n.constants,n.heap),resolver:r}}function Py(t,e){if(t[Ry])e();else{t.begin();try{e()}finally{t.commit()}}}function My(t){return"string"==typeof t?t:"function"!=typeof t.toString?"":String(t)}function Ay(t){let e,n=Nu(t);return e=null===n?null:"function"==typeof n?n:n.getHelper(t),e}function Oy(t){return t===ce}Em.add(77,(t,{op1:e,op2:n})=>{let r=t.stack,i=r.pop(),s=r.pop(),o=t.getOwner();t.context.resolver,t.loadValue(8,function(t,e,n,r){let i,s;return ge(()=>{let o=_e(e);return o===i||(s=bm(o,t)?r?xm(t,o,n,r):r:0===t&&"string"==typeof o&&o||ie(o)?xm(t,o,n,r):null,i=o),s})}(e,i,o,s))}),Em.add(107,t=>{let e,n=t.stack,r=n.pop(),i=n.pop().capture(),s=t.getOwner(),o=ge(()=>{void 0!==e&&nt(e);let t=_e(r);if(bm(t,1)){let{definition:n,owner:r,positional:s,named:a}=_m(t),l=Ay(n);void 0!==a&&(i.named=Fp({},...a,i.named)),void 0!==s&&(i.positional=s.concat(i.positional)),e=l(i,r),tt(o,e)}else ie(t)?(e=Ay(t)(i,s),rt(e)&&tt(o,e)):e=ce}),a=ge(()=>(_e(o),_e(e)));t.associateDestroyable(o),t.loadValue(8,a)}),Em.add(16,(t,{op1:e})=>{let n=t.stack,r=t.constants.getValue(e)(n.pop().capture(),t.getOwner(),t.dynamicScope());rt(r)&&t.associateDestroyable(r),t.loadValue(8,r)}),Em.add(21,(t,{op1:e})=>{let n=t.referenceForSymbol(e);t.stack.push(n)}),Em.add(19,(t,{op1:e})=>{let n=t.stack.pop();t.scope().bindSymbol(e,n)}),Em.add(20,(t,{op1:e})=>{let n=t.stack.pop(),r=t.stack.pop(),i=t.stack.pop();t.scope().bindBlock(e,[n,r,i])}),Em.add(37,(t,{op1:e})=>{t.pushRootScope(e,t.getOwner())}),Em.add(22,(t,{op1:e})=>{let n=t.constants.getValue(e),r=t.stack.pop();t.stack.push(Ce(r,n))}),Em.add(23,(t,{op1:e})=>{let{stack:n}=t,r=t.scope().getBlock(e);n.push(r)}),Em.add(24,t=>{let{stack:e}=t,n=e.pop();if(n&&!Oy(n)){let[t,r,i]=n;e.push(i),e.push(r),e.push(t)}else e.push(null),e.push(null),e.push(null)}),Em.add(25,t=>{let{stack:e}=t,n=e.pop();n&&!Oy(n)?e.push(he):e.push(de)}),Em.add(26,t=>{t.stack.pop(),t.stack.pop();let e=t.stack.pop(),n=e&&e.parameters.length;t.stack.push(n?he:de)}),Em.add(27,(t,{op1:e})=>{let n=new Array(e);for(let i=e;i>0;i--)n[i-1]=um(t.stack.pop());var r;t.stack.push((r=n,ge(()=>{const t=[];for(const e of r){const n=_e(e);null!=n&&t.push(My(n))}return t.length>0?t.join(""):null})))}),Em.add(109,t=>{let e=t.stack.pop(),n=t.stack.pop(),r=t.stack.pop();t.stack.push(ge(()=>B(_e(e))?_e(n):_e(r)))}),Em.add(110,t=>{let e=t.stack.pop();t.stack.push(ge(()=>!B(_e(e))))}),Em.add(111,t=>{let e=t.dynamicScope(),n=t.stack,r=n.pop();n.push(ge(()=>{let t=String(_e(r));return _e(e.get(t))}))}),Em.add(112,t=>{let{positional:e}=t.stack.pop().capture();t.loadValue(8,ge(()=>{console.log(...Qm(e))}))});var Ny=class{constructor(t,e,n){this.node=t,this.reference=e,this.lastValue=n}evaluate(){let t,e=_e(this.reference),{lastValue:n}=this;e!==n&&(t=wg(e)?"":Cg(e)?e:String(e),t!==n)&&(this.node.nodeValue=this.lastValue=t)}};function Fy(t){return function(t){return Cg(t)||wg(t)||"boolean"==typeof t||"number"==typeof t}(t)?2:bm(t,0)||Du(t)?0:bm(t,1)||ju(t)?1:xg(t)?4:function(t){return _g(t)&&11===t.nodeType}(t)?5:function(t){return _g(t)&&"number"==typeof t.nodeType}(t)?6:2}function zy(t){return ie(t)?bm(t,0)||Du(t)?0:1:2}function Dy(t,e){console.info("Use `context`, and `get(<path>)` to debug this template."),e("this")}Em.add(76,t=>{let e=t.stack.peek();t.stack.push(Fy(_e(e))),be(e)||t.updateWith(new Tm(e,Fy))}),Em.add(106,t=>{let e=t.stack.peek();t.stack.push(zy(_e(e))),be(e)||t.updateWith(new Tm(e,zy))}),Em.add(43,t=>{let e=_e(t.stack.pop()),n=wg(e)?"":String(e);t.tree().appendDynamicHTML(n)}),Em.add(44,t=>{let e=_e(t.stack.pop()).toHTML(),n=wg(e)?"":e;t.tree().appendDynamicHTML(n)}),Em.add(47,t=>{let e=t.stack.pop(),n=_e(e),r=wg(n)?"":String(n),i=t.tree().appendDynamicText(r);be(e)||t.updateWith(new Ny(i,e,r))}),Em.add(45,t=>{let e=_e(t.stack.pop());t.tree().appendDynamicFragment(e)}),Em.add(46,t=>{let e=_e(t.stack.pop());t.tree().appendDynamicNode(e)});var jy=Dy;function Uy(t){jy=t}function By(){jy=Dy}var $y=class{#h;constructor(t,e){this.scope=t,this.#h=e}get(t){let e,{scope:n}=this,r=this.#h,i=t.split("."),[s,...o]=t.split(".");return"this"===s?e=n.getSelf():r.locals[s]?e=n.getSymbol(r.locals[s]):(e=this.scope.getSelf(),o=i),o.reduce((t,e)=>Ce(t,e),e)}};Em.add(103,(t,{op1:e})=>{let n=t.constants.getValue(e),r=new $y(t.scope(),n);jy(_e(t.getSelf()),t=>_e(r.get(t)))}),Em.add(72,(t,{op1:e,op2:n})=>{let r=t.stack,i=r.pop(),s=_e(r.pop()),o=yy(i,null===s?"@identity":String(s)),a=_e(o);t.updateWith(new Tm(o,t=>t.isEmpty())),a.isEmpty()?t.lowlevel.goto(n+1):(t.enterList(o,e),t.stack.push(a))}),Em.add(73,t=>{t.exitList()}),Em.add(74,(t,{op1:e})=>{let n=t.stack.peek().next();null!==n?t.registerItem(t.enterItem(n)):t.lowlevel.goto(e)});var qy=class{currentOpSize=0;registers;context;constructor(t,e,n,r){this.stack=t,this.externs=n,this.context=e,this.registers=r}fetchRegister(t){return this.registers[t]}loadRegister(t,e){this.registers[t]=e}setPc(t){this.registers[0]=t}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(t){this.setPc(this.target(t))}target(t){return this.registers[0]+t-this.currentOpSize}call(t){this.registers[1]=this.registers[0],this.setPc(this.context.program.heap.getaddr(t))}returnTo(t){this.registers[1]=this.target(t)}return(){this.setPc(this.registers[1])}nextStatement(){let{registers:t,context:e}=this,n=t[0];if(-1===n)return null;let r=e.program.opcode(n),i=this.currentOpSize=r.size;return this.registers[0]+=i,r}evaluateOuter(t,e){this.evaluateInner(t,e)}evaluateInner(t,e){t.isMachine?this.evaluateMachine(t,e):this.evaluateSyscall(t,e)}evaluateMachine(t,e){switch(t.type){case 0:return void this.pushFrame();case 1:return void this.popFrame();case 3:return void this.call(t.op1);case 2:return void e.call(this.stack.pop());case 4:return void this.goto(t.op1);case 5:return void e.return();case 6:return void this.returnTo(t.op1)}}evaluateSyscall(t,e){Em.evaluate(e,t,t.type)}},Vy=class{env;dom;alwaysRevalidate;frameStack=new se;constructor(t,{alwaysRevalidate:e=!1}){this.env=t,this.dom=t.getDOM(),this.alwaysRevalidate=e}execute(t,e){this._execute(t,e)}_execute(t,e){let{frameStack:n}=this;for(this.try(t,e);!n.isEmpty();){let t=this.frame.nextStatement();void 0!==t?t.evaluate(this):n.pop()}}get frame(){return this.frameStack.current}goto(t){this.frame.goto(t)}try(t,e){this.frameStack.push(new Ky(t,e))}throw(){this.frame.handleException(),this.frameStack.pop()}},Wy=class{children;bounds;constructor(t,e,n,r){this.state=t,this.context=e,this.children=r,this.bounds=n}parentElement(){return this.bounds.parentElement()}firstNode(){return this.bounds.firstNode()}lastNode(){return this.bounds.lastNode()}evaluate(t){t.try(this.children,null)}},Hy=class extends Wy{type="try";evaluate(t){t.try(this.children,this)}handleException(){let{state:t,bounds:e,context:{env:n}}=this;!function(t){let{children:e}=Q(t);X(e,nt)}(this);let r=tm.resume(n,e),i=t.evaluate(r),s=this.children=[],o=i.execute(t=>{t.updateWith(this),t.pushUpdating(s)});tt(this,o.drop)}},Gy=class extends Hy{retained=!1;index=-1;constructor(t,e,n,r,i,s){super(t,e,n,[]),this.key=r,this.memo=i,this.value=s}shouldRemove(){return!this.retained}reset(){this.retained=!1}},Zy=class extends Wy{type="list-block";opcodeMap=new Map;marker=null;lastIterator;constructor(t,e,n,r,i){super(t,e,n,r),this.iterableRef=i,this.lastIterator=_e(i)}initializeChild(t){t.index=this.children.length-1,this.opcodeMap.set(t.key,t)}evaluate(t){let e=_e(this.iterableRef);if(this.lastIterator!==e){let{bounds:n}=this,{dom:r}=t,i=this.marker=r.createComment("");r.insertAfter(n.parentElement(),i,n.lastNode()),this.sync(e),this.parentElement().removeChild(i),this.marker=null,this.lastIterator=e}super.evaluate(t)}sync(t){let{opcodeMap:e,children:n}=this,r=0,i=0;for(this.children=this.bounds.boundList=[];;){let s=t.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(e.has(a)){let t=e.get(a);if(t.index<i)this.moveItem(t,s,o);else{i=t.index;let e=!1;for(let t=r+1;t<i;t++)if(!Xt(n[t]).retained){e=!0;break}e?(this.moveItem(t,s,o),r++):(this.retainItem(t,s),r=i+1)}}else this.insertItem(s,o)}for(const s of n)s.retained?s.reset():this.deleteItem(s)}retainItem(t,e){let{children:n}=this;xe(t.memo,e.memo),xe(t.value,e.value),t.retained=!0,t.index=n.length,n.push(t)}insertItem(t,e){let{opcodeMap:n,bounds:r,state:i,children:s,context:{env:o}}=this,{key:a}=t,l=void 0===e?this.marker:e.firstNode(),c=tm.forInitialRender(o,{element:r.parentElement(),nextSibling:l});i.evaluate(c).execute(e=>{let r=e.enterItem(t);r.index=s.length,s.push(r),n.set(a,r),tt(this,r)})}moveItem(t,e,n){let r,i,{children:s}=this;xe(t.memo,e.memo),xe(t.value,e.value),t.retained=!0,void 0===n?yg(t,this.marker):(r=t.lastNode().nextSibling,i=n.firstNode(),r!==i&&yg(t,i)),t.index=s.length,s.push(t)}deleteItem(t){nt(t),vg(t),this.opcodeMap.delete(t.key)}},Ky=class{current=0;constructor(t,e){this.ops=t,this.exceptionHandler=e}goto(t){this.current=t}nextStatement(){return this.ops[this.current++]}handleException(){this.exceptionHandler&&this.exceptionHandler.handleException()}},Yy=class{constructor(t,e,n,r){this.env=t,this.updating=e,this.bounds=n,this.drop=r,tt(this,r),et(this,()=>vg(this.bounds))}rerender({alwaysRevalidate:t=!1}={alwaysRevalidate:!1}){let{env:e,updating:n}=this;new Vy(e,{alwaysRevalidate:t}).execute(n,this)}parentElement(){return this.bounds.parentElement()}firstNode(){return this.bounds.firstNode()}lastNode(){return this.bounds.lastNode()}handleException(){}},Xy=class{static restore(t,e){const n=new this(t.slice(),function(t){return[0,-1,t,0]}(t.length-1));return n.registers[0]=e,n.registers[3]=t.length-1,n.registers[2]=-1,n}registers;constructor(t=[],e){this.stack=t,this.registers=e}push(t){this.stack[++this.registers[3]]=t}dup(t=this.registers[3]){this.stack[++this.registers[3]]=this.stack[t]}copy(t,e){this.stack[e]=this.stack[t]}pop(t=1){let e=this.stack[this.registers[3]];return this.registers[3]-=t,e}peek(t=0){return this.stack[this.registers[3]-t]}get(t,e=this.registers[2]){return this.stack[e+t]}set(t,e,n=this.registers[2]){this.stack[n+e]=t}slice(t,e){return this.stack.slice(t,e)}capture(t){let e=this.registers[3]+1,n=e-t;return this.stack.slice(n,e)}reset(){this.stack.length=0}},Jy=class{drop={};scope=new se;dynamicScope=new se;updating=new se;cache=new se;list=new se;destroyable=new se;constructor(t,e){this.scope.push(t),this.dynamicScope.push(e),this.destroyable.push(this.drop)}},Qy=class t{#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(t){let e=this.fetchValue(t);this.stack.push(e)}load(t){let e=this.stack.pop();this.loadValue(t,e)}loadValue(t,e){this.#p[t]=e}fetchValue(t){return function(t){return t<=3}(t)?this.lowlevel.fetchRegister(t):this.#p[t]}call(t){null!==t&&this.lowlevel.call(t)}return(){this.lowlevel.return()}#f;context;constructor({scope:t,dynamicScope:e,stack:n,pc:r},i,s){let o=Xy.restore(n,r);this.#f=s,this.context=i,this.#d=new Jy(t,e),this.args=new qm,this.lowlevel=new qy(o,i,void 0,o.registers),this.pushUpdating()}static initial(e,n){let r=xy.root(n.owner,n.scope??{self:ce,size:0});const i=function(t,e,n){return{pc:t,scope:e,dynamicScope:n,stack:[]}}(e.program.heap.getaddr(n.handle),r,n.dynamicScope);return new t(i,e,n.tree)}compile(t){return Ip(t.compile(this.context))}get constants(){return this.context.program.constants}get program(){return this.context.program}get env(){return this.context.env}captureClosure(t,e=this.lowlevel.fetchRegister(0)){return{pc:e,scope:this.scope(),dynamicScope:this.dynamicScope(),stack:this.stack.capture(t)}}capture(t,e=this.lowlevel.fetchRegister(0)){return new tv(this.captureClosure(t,e),this.context)}beginCacheGroup(t){let e=this.updating(),n=new Lm;e.push(n),e.push(new Im(t)),this.#d.cache.push(n),It()}commitCacheGroup(){let t=this.updating(),e=this.#d.cache.pop(),n=Pt();t.push(new Pm(e)),e.finalize(n,t.length)}enter(t){let e=this.capture(t),n=this.tree().pushResettableBlock(),r=new Hy(e,this.context,n,[]);this.didEnter(r)}enterItem({key:t,value:e,memo:n}){let{stack:r}=this,i=vy(e),s=vy(n);r.push(i),r.push(s);let o=this.capture(2),a=this.tree().pushResettableBlock(),l=new Gy(o,this.context,a,t,s,i);return this.didEnter(l),l}registerItem(t){this.listBlock().initializeChild(t)}enterList(t,e){let n=[],r=this.lowlevel.target(e),i=this.capture(0,r),s=this.tree().pushBlockList(n),o=new Zy(i,this.context,s,n,t);this.#d.list.push(o),this.didEnter(o)}didEnter(t){this.associateDestroyable(t),this.#d.destroyable.push(t),this.updateWith(t),this.pushUpdating(t.children)}exit(){this.#d.destroyable.pop(),this.#f.popBlock(),this.popUpdating()}exitList(){this.exit(),this.#d.list.pop()}pushRootScope(t,e){let n=xy.sized(e,t);return this.#d.scope.push(n),n}pushChildScope(){this.#d.scope.push(this.scope().child())}pushScope(t){this.#d.scope.push(t)}popScope(){this.#d.scope.pop()}pushDynamicScope(){let t=this.dynamicScope().child();return this.#d.dynamicScope.push(t),t}bindDynamicScope(t){let e=this.dynamicScope();for(const n of Wp(t))e.set(n,this.stack.pop())}pushUpdating(t=[]){this.#d.updating.push(t)}popUpdating(){return this.#d.updating.pop()}updateWith(t){this.updating().push(t)}listBlock(){return this.#d.list.current}associateDestroyable(t){tt(this.#d.destroyable.current,t)}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(t){return this.scope().getSymbol(t)}execute(t){return this._execute(t)}_execute(t){let e;t&&t(this);do{e=this.next()}while(!e.done);return e.value}next(){let t,{env:e}=this,n=this.lowlevel.nextStatement();return null!==n?(this.lowlevel.evaluateOuter(n,this),t={done:!1,value:null}):(this.stack.reset(),t={done:!0,value:new Yy(e,this.popUpdating(),this.#f.popBlock(),this.#d.drop)}),t}},tv=class{state;context;constructor(t,e){this.state=t,this.context=e}evaluate(t){return new Qy(this.state,this.context,t)}},ev=class{constructor(t){this.vm=t}next(){return this.vm.next()}sync(){return this.vm.execute()}};function nv(t,e){let n;return Py(t,()=>n=e.sync()),n}function rv(t,e,n,r,i,s=new _y){let o=Ip(i.compile(t)),a=i.symbolTable.symbols.length,l=Qy.initial(t,{scope:{self:n,size:a},dynamicScope:s,tree:r,handle:o,owner:e});return new ev(l)}function iv(t,e,n,r,i={},s=new _y){return function(t,e,n,r,i){const s=Object.keys(i).map(t=>[t,i[t]]),o=["main","else","attrs"],a=s.map(([t])=>`@${t}`);let l=t.constants.component(r,n,void 0,"{ROOT}");t.lowlevel.pushFrame();for(let h=0;h<3*o.length;h++)t.stack.push(null);t.stack.push(null),s.forEach(([,e])=>{t.stack.push(e)}),t.args.setup(t.stack,a,o,0,!0);const c=l.compilable,u={handle:Ip(c.compile(e)),symbolTable:c.symbolTable};return t.stack.push(t.args),t.stack.push(u),t.stack.push(l),new ev(t)}(Qy.initial(t,{tree:e,handle:t.stdlib.main,dynamicScope:s,owner:n}),t,n,r,function(t){const e=pe(t);return Object.keys(t).reduce((t,n)=>(t[n]=Ce(e,n),t),{})}(i))}var sv=a({_instrumentStart:()=>dv,flaggedInstrument:()=>uv,instrument:()=>cv,reset:()=>gv,subscribe:()=>pv,subscribers:()=>ov,unsubscribe:()=>fv}),ov=[],av={},lv=()=>performance.now();function cv(t,e,n,r){let i,s,o;if(arguments.length<=3&&"function"==typeof e?(s=e,o=n):(i=e,s=n,o=r),0===ov.length)return s.call(o);let a=i||{},l=dv(t,()=>a);return l===hv?s.call(o):function(t,e,n,r){try{return t.call(r)}catch(i){throw n.exception=i,i}finally{e()}}(s,l,a,o)}function uv(t,e,n){return n()}function hv(){}function dv(t,e,n){if(0===ov.length)return hv;let r=av[t];if(r||(r=function(t){let e=[];for(let n of ov)n.regex.test(t)&&e.push(n.object);return av[t]=e,e}(t)),0===r.length)return hv;let i,s=e(n),o=N.STRUCTURED_PROFILE;o&&(i=`${t}: ${s.object}`,console.time(i));let a=[],l=lv();for(let u of r)a.push(u.before(t,l,s));const c=r;return function(){let e=lv();for(let n=0;n<c.length;n++){let r=c[n];"function"==typeof r.after&&r.after(t,e,s,a[n])}o&&console.timeEnd(i)}}function pv(t,e){let n=t.split("."),r=[];for(let o of n)"*"===o?r.push("[^\\.]*"):r.push(o);let i=r.join("\\.");i=`${i}(\\..*)?`;let s={pattern:t,regex:new RegExp(`^${i}$`),object:e};return ov.push(s),av={},s}function fv(t){let e=0;for(let n=0;n<ov.length;n++)ov[n]===t&&(e=n);ov.splice(e,1),av={}}function gv(){ov.length=0,av={}}var mv=Symbol("MUTABLE_CELL");function yv(t){if("error"===t.result)throw new Error(`Compile Error: ${t.problem} @ ${t.span.start}..${t.span.end}`);return t}function vv(t,e){return"attrs"===e[0]&&(e.shift(),1===e.length)?Ce(t,e[0]):Se(t,e)}function bv(t){let e=t.indexOf(":");return-1===e?[t,t,!0]:[t.substring(0,e),t.substring(e+1),!1]}function wv(t,e,n,r){let[i,s,o]=n;if("id"===s){let e=hr(t,i);null==e&&(e=t.elementId);let n=le(e);return void r.setAttribute("id",n,!0,null)}let a=i.indexOf(".")>-1?vv(e,i.split(".")):Ce(e,i);r.setAttribute(s,a,!1,null)}function _v(t,e){let n;return ge(()=>{let r=_e(t);return!0===r?n||(n=sp(e)):r||0===r?String(r):null})}function xv(){}var Cv=class{classRef=null;rootRef;argsRevision;constructor(t,e,n,r,i,s){this.component=t,this.args=e,this.argsTag=n,this.finalizer=r,this.hasWrappedElement=i,this.isInteractive=s,this.classRef=null,this.argsRevision=null===e?0:ct(n),this.rootRef=pe(t),et(this,()=>this.willDestroy(),!0),et(this,()=>this.component.destroy())}willDestroy(){let{component:t,isInteractive:e}=this;if(e){Mt(),t.trigger("willDestroyElement"),t.trigger("willClearRender"),At();let e=Ql(t);e&&(nc(e),rc(t))}t.renderer.unregister(t)}finalize(){let{finalizer:t}=this;t(),this.finalizer=xv}};function Sv(t){let e=Object.create(null),n=Object.create(null);for(let r in t){let i=t[r],s=_e(i);we(i)?e[r]=new Ev(i,s):e[r]=s,n[r]=s}return n.attrs=e,n}var kv=Symbol("REF"),Ev=class{value;[mv];[kv];constructor(t,e){this[mv]=!0,this[kv]=t,this.value=e}update(t){xe(this[kv],t)}},Rv=new WeakMap,Tv=Symbol("DIRTY_TAG"),Lv=Symbol("IS_DISPATCHING_ATTRS"),Iv=Symbol("BOUNDS"),Pv=le("ember-view"),Mv=class{templateFor(t){let e,{layout:n,layoutName:r}=t,i=Br(t);if(void 0===n){if(void 0===r)return null;e=i.lookup(`template:${r}`)}else{if("function"!=typeof n)return null;e=n}return yv(e(i)).asWrappedLayout()}getDynamicLayout(t){return this.templateFor(t.component)}getTagName(t){let{component:e,hasWrappedElement:n}=t;return n?e&&e.tagName||"div":null}getCapabilities(){return Nv}prepareArgs(t,e){if(e.named.has("__ARGS__")){let{__ARGS__:t,...n}=e.named.capture(),r=_e(t);return{positional:r.positional,named:{...n,...r.named}}}const{positionalParams:n}=t.class??t;if(null==n||0===e.positional.length)return null;let r;if("string"==typeof n){let t=e.positional.capture();r={[n]:ge(()=>Qm(t))},Object.assign(r,e.named.capture())}else{if(!(Array.isArray(n)&&n.length>0))return null;{const t=Math.min(n.length,e.positional.length);r={},Object.assign(r,e.named.capture());for(let i=0;i<t;i++)r[n[i]]=e.positional.at(i)}}return{positional:Up,named:r}}create(t,e,n,{isInteractive:r},i,s){let o=i.view,a=n.named.capture();It();let l=Sv(a),c=Pt();!function(t,e){t.named.has("id")&&(e.elementId=e.id)}(n,l),l.parentView=o,l._target=_e(s),$r(l,t),Mt();let u=e.create(l);Rv.set(u,a);let h=dv("render.component",Av,u);i.view=u,null!=o&&oc(o,u),u.trigger("didReceiveAttrs");let d=""!==u.tagName;d||(r&&u.trigger("willRender"),u._transitionTo("hasElement"),r&&u.trigger("willInsertElement"));let p=new Cv(u,a,c,h,d,r);return n.named.has("class")&&(p.classRef=n.named.get("class")),r&&d&&u.trigger("willRender"),At(),Ft(p.argsTag),Ft(u[Tv]),p}getDebugName(t){return t.fullName||t.normalizedName||t.class?.name||t.name}getSelf({rootRef:t}){return t}didCreateElement({component:t,classRef:e,isInteractive:n,rootRef:r},i,s){ec(t,i),tc(i,t);let{attributeBindings:o,classNames:a,classNameBindings:l}=t;if(o&&o.length)!function(t,e,n,r){let i=[],s=t.length-1;for(;-1!==s;){let o=bv(t[s]),a=o[1];-1===i.indexOf(a)&&(i.push(a),wv(e,n,o,r)),s--}if(-1===i.indexOf("id")){let t=e.elementId?e.elementId:ll(e);r.setAttribute("id",le(t),!1,null)}}(o,t,r,s);else{let e=t.elementId?t.elementId:ll(t);s.setAttribute("id",le(e),!1,null)}if(e){const t=_v(e);s.setAttribute("class",t,!1,null)}a&&a.length&&a.forEach(t=>{s.setAttribute("class",le(t),!1,null)}),l&&l.length&&l.forEach(t=>{!function(t,e,n){let[r,i,s]=e.split(":");if(""===r)n.setAttribute("class",le(i),!0,null);else{let e,o=r.indexOf(".")>-1,a=o?r.split("."):[],l=o?vv(t,a):Ce(t,r);e=void 0===i?_v(l,o?a[a.length-1]:r):function(t,e,n){return ge(()=>_e(t)?e:n)}(l,i,s),n.setAttribute("class",e,!1,null)}}(r,t,s)}),s.setAttribute("class",Pv,!1,null),"ariaRole"in t&&s.setAttribute("role",Ce(r,"ariaRole"),!1,null),t._transitionTo("hasElement"),n&&(Mt(),t.trigger("willInsertElement"),At())}didRenderLayout(t,e){t.component[Iv]=e,t.finalize()}didCreate({component:t,isInteractive:e}){e&&(t._transitionTo("inDOM"),t.trigger("didInsertElement"),t.trigger("didRender"))}update(t){let{component:e,args:n,argsTag:r,argsRevision:i,isInteractive:s}=t;if(t.finalizer=dv("render.component",Ov,e),Mt(),null!==n&&!ut(r,i)){It();let i=Sv(n);r=t.argsTag=Pt(),t.argsRevision=ct(r),e[Lv]=!0,e.setProperties(i),e[Lv]=!1,e.trigger("didUpdateAttrs"),e.trigger("didReceiveAttrs")}s&&(e.trigger("willUpdate"),e.trigger("willRender")),At(),Ft(r),Ft(e[Tv])}didUpdateLayout(t){t.finalize()}didUpdate({component:t,isInteractive:e}){e&&(t.trigger("didUpdate"),t.trigger("didRender"))}getDestroyable(t){return t}};function Av(t){return t.instrumentDetails({initialRender:!0})}function Ov(t){return t.instrumentDetails({initialRender:!1})}var Nv={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},Fv=new Mv;function zv(t){return t===Fv}function Dv(t){let e=hr(t,"content");return ft(Ne(t),Ne(e)),e}function jv(t,e,n){let r=Zt(t),i=Kt(t,e,r);if(e in t)return i;{let s=[i,Kt(t,"content",r)],o=Dv(t);return Yt(o)&&s.push(Oe(o,e,n)),Ct(s)}}var Uv=_l.create({content:null,init(){this._super(...arguments),rr(this),Ne(this),Re(this,jv)},willDestroy(){this.set("content",null),this._super(...arguments)},isTruthy:Xn("content",function(){return Boolean(hr(this,"content"))}),unknownProperty(t){let e=Dv(this);return e?hr(e,t):void 0},setUnknownProperty(t,e){let n=_(this);return n.isInitializing()||n.isPrototypeMeta(this)?(Dn(this,t,null,e),e):mr(Dv(this),t,e)}});function Bv(t){return Au(t,{})}var $v=class{__string;constructor(t){this.__string=t}toString(){return`${this.__string}`}toHTML(){return this.toString()}},qv=function(t){return null==t?t="":"string"!=typeof t&&(t=String(t)),new $v(t)};function Vv(t){return Au(t,{})}var Wv=Vv(({positional:t})=>ge(()=>Qm(t),null)),Hv=Vv(({positional:t})=>{let e=t[0];return ge(()=>(...n)=>{let[r,...i]=Qm(t);if(ye(e)){let t=i.length>0?i[0]:n[0];return void xe(e,t)}return r.call(null,...i,...n)},null)}),Gv=Vv(({named:t})=>{let e=ge(()=>Jm(t),null),n=new Map;for(let r in t)n.set(r,t[r]);return e.children=n,e}),Zv=t=>(t=>null==t||"function"!=typeof t.toString)(t)?"":String(t),Kv=Vv(({positional:t})=>ge(()=>Qm(t).map(Zv).join(""),null)),Yv=Vv(({positional:t})=>{let e=t[0]??ce,n=t[1]??ce;return ge(()=>{let t=_e(e);if(re(t))return V(t,String(_e(n)))},t=>{let r=_e(e);if(re(r))return W(r,String(_e(n)),t)})}),Xv=class{tag=mt();element;args;listener=null;constructor(t,e){this.element=t,this.args=e,et(this,()=>{let{element:t,listener:e}=this;if(e){let{eventName:n,callback:r,options:i}=e;tb(t,n,r,i)}})}updateListener(){let t,e,n,{element:r,args:i,listener:s}=this,o=i.positional[0],a=o?_e(o):void 0,l=i.positional[1],c=l?_e(l):void 0;{let{once:r,passive:s,capture:o}=i.named;r&&(t=_e(r)),s&&(e=_e(s)),o&&(n=_e(o))}let u,h=!1;if(h=null===s||a!==s.eventName||c!==s.userProvidedCallback||t!==s.once||e!==s.passive||n!==s.capture,h&&(void 0===t&&void 0===e&&void 0===n||(u={once:t,passive:e,capture:n})),h){let i=c;this.listener={eventName:a,callback:i,userProvidedCallback:c,once:t,passive:e,capture:n,options:u},s&&tb(r,s.eventName,s.callback,s.options),function(t,e,n,r){Jv++,t.addEventListener(e,n,r)}(r,a,i,u)}}},Jv=0,Qv=0;function tb(t,e,n,r){Qv++,t.removeEventListener(e,n,r)}var eb,nb=Pu(new class{getDebugName(){return"on"}getDebugInstance(){return null}get counters(){return{adds:Jv,removes:Qv}}create(t,e,n,r){return new Xv(e,r)}getTag({tag:t}){return t}install(t){t.updateListener()}update(t){t.updateListener()}getDestroyable(t){return t}},{}),rb={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},ib=class{getCapabilities(){return rb}getDebugName({name:t}){return t}getSelf(){return ue}getDestroyable(){return null}},sb=new ib,ob=class{constructor(t="@glimmer/component/template-only",e="(unknown template-only component)"){this.moduleName=t,this.name=e}toString(){return this.moduleName}};function ab(t,e){return new ob(t,e)}Fu(sb,ob.prototype);var lb={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 cb(t,e={}){let n=Boolean(e.updateHook);return{asyncLifeCycleCallbacks:Boolean(e.asyncLifecycleCallbacks),destructor:Boolean(e.destructor),updateHook:n}}function ub(t){return t.capabilities.asyncLifeCycleCallbacks}function hb(t){return t.capabilities.updateHook}var db=class{componentManagerDelegates=new WeakMap;constructor(t){this.factory=t}getDelegateFor(t){let{componentManagerDelegates:e}=this,n=e.get(t);if(void 0===n){let{factory:r}=this;n=r(t),e.set(t,n)}return n}create(t,e,n){let r=this.getDelegateFor(t),i=Pe(n.capture()),s=r.createComponent(e,i);return new pb(s,r,i)}getDebugName(t){return"function"==typeof t?t.name:t.toString()}update(t){let{delegate:e}=t;if(hb(e)){let{component:n,args:r}=t;e.updateComponent(n,r)}}didCreate({component:t,delegate:e}){ub(e)&&e.didCreateComponent(t)}didUpdate({component:t,delegate:e}){(function(t){return ub(t)&&hb(t)})(e)&&e.didUpdateComponent(t)}didRenderLayout(){}didUpdateLayout(){}getSelf({component:t,delegate:e}){return pe(e.getContext(t))}getDestroyable(t){const{delegate:e}=t;if(function(t){return t.capabilities.destructor}(e)){const{component:n}=t;return et(t,()=>e.destroyComponent(n)),t}return null}getCapabilities(){return lb}},pb=class{constructor(t,e,n){this.component=t,this.delegate=e,this.args=n}};function fb(t,e={}){return{disableAutoTracking:Boolean(e.disableAutoTracking)}}var gb=class{componentManagerDelegates=new WeakMap;constructor(t){this.factory=t}getDelegateFor(t){let{componentManagerDelegates:e}=this,n=e.get(t);if(void 0===n){let{factory:r}=this;n=r(t),e.set(t,n)}return n}create(t,e,n,r){let i,s=this.getDelegateFor(t),o=Pe(r),a=s.createModifier(n,o);return i={tag:mt(),element:e,delegate:s,args:o,modifier:a},et(i,()=>s.destroyModifier(a,o)),i}getDebugName(t){return"function"==typeof t?t.name||t.toString():"<unknown>"}getDebugInstance({modifier:t}){return t}getTag({tag:t}){return t}install({element:t,args:e,modifier:n,delegate:r}){let{capabilities:i}=r;i.disableAutoTracking?Wt(()=>r.installModifier(n,t,e)):r.installModifier(n,t,e)}update({args:t,modifier:e,delegate:n}){let{capabilities:r}=n;r.disableAutoTracking?Wt(()=>n.updateModifier(e,t)):n.updateModifier(e,t)}getDestroyable(t){return t}};function mb(t,e){return Fu(new db(t),e)}function yb(t,e){return Pu(new gb(t),e)}function vb(t,e){return Au(new Cu(t),e)}var bb=Symbol("RECOMPUTE_TAG"),wb=Symbol("IS_CLASSIC_HELPER"),_b=class extends Xc{static isHelperFactory=!0;static[wb]=!0;static helper=Eb;init(t){super.init(t),this[bb]=gt()}recompute(){xs(()=>pt(this[bb]))}},xb=class{capabilities=wu(0,{hasValue:!0,hasDestroyable:!0});ownerInjection;constructor(t){let e={};$r(e,t),this.ownerInjection=e}createHelper(t,e){return{instance:(n=t,null!=n&&"class"in n?t.create():t.create(this.ownerInjection)),args:e};var n}getDestroyable({instance:t}){return t}getValue({instance:t,args:e}){let{positional:n,named:r}=e,i=t.compute(n,r);return Ft(t[bb]),i}getDebugName(t){return eb((t.class||t).prototype)}};vb(t=>new xb(t),_b);var Cb=Nu(_b),Sb=class{isHelperFactory=!0;constructor(t){this.compute=t}create(){return{compute:this.compute}}},kb=new class{capabilities=wu(0,{hasValue:!0});createHelper(t,e){return()=>t.compute.call(null,e.positional,e.named)}getValue(t){return t()}getDebugName(t){return eb(t.compute)}};function Eb(t){return new Sb(t)}vb(()=>kb,Sb.prototype);var Rb=Bv(()=>pe("30000000-1000-4000-2000-100000000000".replace(/[0-3]/g,t=>(4*t^16*Math.random()>>(2&t)).toString(16)))),Tb=class{constructor(t,e,n,r,i){this.main=t,this.trustingGuardedAppend=e,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(t){return t?this.trustingGuardedAppend:this.cautiousGuardedAppend}};function Lb(t,e,n){Uf(t,()=>t(76),r=>{r(2,()=>{e?(t(68),t(43)):t(47)}),"number"==typeof n?(r(0,()=>{t(68),t(81),t(79),function(t){t(36,4),t(33,3,1),t(35,4),t(0),t(83),t(85,4),Gf(t,!1,!1,!0,()=>{t(92,4),t(95,4)}),t(35,4)}(t)}),r(1,()=>{Rf(t,null,null,()=>{t(3,n)})})):(r(0,()=>{t(47)}),r(1,()=>{t(47)})),r(4,()=>{t(68),t(44)}),r(5,()=>{t(68),t(45)}),r(6,()=>{t(68),t(46)})})}var Ib={symbols:{locals:null,upvars:null},moduleName:"stdlib",scopeValues:null,isStrictMode:!0,owner:null,size:0};function Pb(t,e){let n=new vf(t.program.heap,Ib);e(function(...e){yf(n,t,Ib,e)});let r=n.commit(0);if("number"!=typeof r)throw new Error("Unexpected errors compiling std");return r}var Mb=class{constants;heap;resolver;stdlib;createOp;env;program;constructor({constants:t,heap:e},n,r){this.constants=t,this.heap=e,this.resolver=r.resolver,this.createOp=n,this.env=r.env,this.program=r.program,this.stdlib=function(t){let e=Pb(t,t=>function(t){t(75,4),Gf(t,!1,!1,!0)}(t)),n=Pb(t,t=>Lb(t,!0,null)),r=Pb(t,t=>Lb(t,!1,null)),i=Pb(t,t=>Lb(t,!0,n)),s=Pb(t,t=>Lb(t,!1,r));return new Tb(e,i,s,n,r)}(this)}};function Ab(t){return{object:`${t.name}:main`}}var Ob,Nb={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},Fb=mu(Nb),zb=new class{create(t,e,n,r,i){let s=i.get("outletState"),o=e.ref;i.set("outletState",o);let a={finalize:dv("render.outlet",Ab,e)};if(void 0!==r.debugRenderTree){let t=_e(s)?.render?.owner,e=_e(o)?.render?.owner;if(t&&t!==e){let t=e,{mountPoint:n}=t;n&&(a.engine={mountPoint:n,instance:t})}}return a}getDebugName({name:t}){return`{{outlet}} for ${t}`}getDebugCustomRenderTree(t,e){let n=[];return n.push({bucket:e,type:"outlet",name:"main",args:ly,instance:void 0}),e.engine&&n.push({bucket:e.engine,type:"engine",name:e.engine.mountPoint,args:ly,instance:e.engine.instance}),n}getCapabilities(){return Nb}getSelf(){return ce}didCreate(){}didUpdate(){}didRenderLayout(t){t.finalize()}didUpdateLayout(){}getDestroyable(){return null}},Db=ig({id:null,block:'[[[8,[30,1],null,[["@controller","@model"],[[30,2],[30,3]]],null]],["@Component","@controller","@model"],[]]',moduleName:"(unknown template module)",isStrictMode:!0}),jb=class{handle=-1;resolvedName=null;manager=zb;capabilities=Fb;compilable;constructor(t,e){this.state=e,this.compilable=yv(Db(t)).asLayout()}},Ub=class extends Mv{component;constructor(t){super(),this.component=t}create(t,e,n,{isInteractive:r},i){let s=this.component,o=dv("render.component",Av,s);i.view=s;let a=""!==s.tagName;a||(r&&s.trigger("willRender"),s._transitionTo("hasElement"),r&&s.trigger("willInsertElement"));let l=new Cv(s,null,yt,o,a,r);return Ft(s[Tv]),l}},Bb={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},$b=class{handle=-1;resolvedName="-top-level";state;manager;capabilities=mu(Bb);compilable=null;constructor(t){this.manager=new Ub(t);let e=Xa(t);this.state=e}},qb=class{constructor(t){this.inner=t}},Vb=Bv(({positional:t})=>{const e=t[0];return ge(()=>{let t=_e(e);return Ft(Ne(t)),nr(t)&&(t=Dv(t)),new qb(t)})}),Wb=class{position=0;constructor(t){this.length=t}isEmpty(){return!1}memoFor(t){return t}next(){let{length:t,position:e}=this;if(e>=t)return null;let n=this.valueFor(e),r=this.memoFor(e);return this.position++,{value:n,memo:r}}},Hb=class extends Wb{static from(t){return t.length>0?new this(t):null}static fromForEachable(t){let e=[];return t.forEach(t=>e.push(t)),this.from(e)}constructor(t){super(t.length),this.array=t}valueFor(t){return this.array[t]}},Gb=class extends Wb{static from(t){return t.length>0?new this(t):null}constructor(t){super(t.length),this.array=t}valueFor(t){return Me(this.array,t)}},Zb=class extends Wb{static fromIndexable(t){let e=Object.keys(t);if(0===e.length)return null;{let n=[];for(let r of e){let e;e=t[r],Nt()&&(Ft(Kt(t,r)),Array.isArray(e)&&Ft(Kt(e,"[]"))),n.push(e)}return new this(e,n)}}static fromForEachable(t){let e=[],n=[],r=0,i=!1;return t.forEach(function(t,s){i=i||arguments.length>=2,i&&e.push(s),n.push(t),r++}),0===r?null:i?new this(e,n):new Hb(n)}constructor(t,e){super(e.length),this.keys=t,this.values=e}valueFor(t){return this.values[t]}memoFor(t){return this.keys[t]}},Kb=class{static from(t){let e=t[Symbol.iterator](),n=e.next(),{done:r}=n;return r?null:new this(e,n)}position=0;constructor(t,e){this.iterable=t,this.result=e}isEmpty(){return!1}next(){let{iterable:t,result:e,position:n}=this;if(e.done)return null;let r=this.valueFor(e,n),i=this.memoFor(e,n);return this.position++,this.result=t.next(),{value:r,memo:i}}},Yb=class extends Kb{valueFor(t){return t.value}memoFor(t,e){return e}},Xb=class extends Kb{valueFor(t){return t.value[1]}memoFor(t){return t.value[0]}};function Jb(t){return null!=t&&"function"==typeof t.forEach}function Qb(t){return null!=t&&"function"==typeof t[Symbol.iterator]}Ob={scheduleRevalidate(){ws.ensureInstance()},toBool:function(t){return nr(t)?(Ft(Oe(t,"content")),Boolean(hr(t,"isTruthy"))):Pc(t)?(Ft(Oe(t,"[]")),0!==t.length):function(t){return null!==t&&"object"==typeof t&&"function"==typeof t.toHTML}(t)?Boolean(t.toString()):Boolean(t)},toIterator:function(t){return t instanceof qb?function(t){return null===(e=t)||"object"!=typeof e&&"function"!=typeof e?null:Array.isArray(t)||sr(t)?Zb.fromIndexable(t):Qb(t)?Xb.from(t):Jb(t)?Zb.fromForEachable(t):Zb.fromIndexable(t);var e}(t.inner):function(t){return Yt(t)?Array.isArray(t)?Hb.from(t):sr(t)?Gb.from(t):Qb(t)?Yb.from(t):Jb(t)?Hb.fromForEachable(t):null:null}(t)},getProp:dr,setProp:yr,getPath:hr,setPath:mr,scheduleDestroy(t,e){Es("actions",null,e,t)},scheduleDestroyed(t){Es("destroy",null,t)},warnIfStyleNotTrusted(t){},assert(t,e,n){},deprecate(t,e,n){}},H=Ob.scheduleRevalidate,D=Ob.scheduleDestroy,j=Ob.scheduleDestroyed,U=Ob.toIterator,B=Ob.toBool,$=Ob.getProp,q=Ob.setProp,V=Ob.getPath,W=Ob.setPath;var tw=class{enableDebugTooling=N._DEBUG_RENDER_TREE;constructor(t,e){this.owner=t,this.isInteractive=e}onTransactionCommit(){}},ew=Bv(({positional:t,named:e})=>{const n=t[0];let r=e.type,i=e.loc,s=e.original;return _e(r),_e(i),_e(s),ge(()=>_e(n))}),nw=Bv(t=>t.positional[0]),rw=Bv(({positional:t})=>ge(()=>{let e=t[0],n=t[1],r=_e(e).split("."),i=r[r.length-1],s=_e(n);return!0===s?sp(i):s||0===s?String(s):""})),iw=Bv(({positional:t},e)=>{let n=_e(t[0]);return pe(e.factoryFor(n)?.class)}),sw=Bv(({positional:t})=>{const e=t[0];return ge(()=>{let t=_e(e);return Yt(t)&&Ft(Oe(t,"[]")),t})}),ow=Bv(({positional:t})=>ve(t[0])),aw=Bv(({positional:t})=>me(t[0])),lw=Bv(({positional:t,named:e})=>fe(_e(t[0]))),cw={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},uw=new class{getDynamicLayout(t){return yv(t.engine.lookup("template:application")(t.engine)).asLayout()}getCapabilities(){return cw}getOwner(t){return t.engine}create(t,{name:e},n,r){let i=t.buildChildEngineInstance(e);i.boot();let s,o,a,l,c=i.factoryFor("controller:application")||zh(i,"application");if(n.named.has("model")&&(l=n.named.get("model")),void 0===l)s=c.create(),o=pe(s),a={engine:i,controller:s,self:o,modelRef:l};else{let t=_e(l);s=c.create({model:t}),o=pe(s),a={engine:i,controller:s,self:o,modelRef:l}}return r.debugRenderTree&&tt(i,s),a}getDebugName({name:t}){return t}getDebugCustomRenderTree(t,e,n){return[{bucket:e.engine,instance:e.engine,type:"engine",name:t.name,args:n},{bucket:e.controller,instance:e.controller,type:"route-template",name:"application",args:n}]}getSelf({self:t}){return t}getDestroyable(t){return t.engine}didCreate(){}didUpdate(){}didRenderLayout(){}didUpdateLayout(){}update(t){let{controller:e,modelRef:n}=t;void 0!==n&&e.set("model",_e(n))}},hw=class{handle=-1;state;manager=uw;compilable=null;capabilities=mu(cw);constructor(t){this.resolvedName=t,this.state={name:t}}},dw=Bv((t,e)=>{let n,r,i,s=t.positional[0];return n=Xm(t.named,ay),ge(()=>{let t=_e(s);return"string"==typeof t?(r===t||(r=t,i=xm(0,new hw(t),e,n,!0)),i):(i=null,r=null,null)})}),pw={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},fw=mu(pw),gw=new class{create(t,e,n){let r=n.named.get("controller");return{self:r,controller:_e(r)}}getSelf({self:t}){return t}getDebugName({name:t}){return`route-template (${t})`}getDebugCustomRenderTree({name:t},e,n){return[{bucket:e,type:"route-template",name:t,args:n,instance:e.controller}]}getCapabilities(){return pw}didRenderLayout(){}didUpdateLayout(){}didCreate(){}didUpdate(){}getDestroyable(){return null}},mw=class{handle=-1;resolvedName;state;manager=gw;capabilities=fw;compilable;constructor(t,e){let n=yv(e);this.resolvedName=t,this.state={name:t},this.compilable=n.asLayout()}};function yw(t,e,n){return xm(0,new mw(e,n),t,null,!0)}var vw=Bv((t,e,n)=>{let r=ge(()=>_e(n.get("outletState"))?.outlets?.main),i=null,s=null;return ge(()=>{let t=_e(r),n=function(t,e){if(void 0===e)return null;let n=e.render;if(void 0===n)return null;let r=n.template;return null==r?null:{ref:t,name:n.name,template:r,controller:n.controller}}(r,t);if(!function(t,e){return null!==t&&null!==e&&t.template===e.template&&t.controller===e.controller}(n,i))if(i=n,null!==n){let o,a=t?.render?.owner??e,l=ne(),c=n.template;o=Du(c)?c:yw(a,n.name,c),l.Component=pe(o),l.controller=pe(n.controller);let u=Se(r,["render","model"]),h=_e(u);l.model=ge(()=>(i===n&&(h=_e(u)),h));let d=Xm(l,ay);s=xm(0,new jb(e,n),a,d,!0)}else s=null;return s})});function bw(t){return{object:`component:${t}`}}var ww={mut:ow,readonly:aw,unbound:lw,"-hash":Gv,"-each-in":Vb,"-normalize-class":rw,"-resolve":iw,"-track-array":sw,"-mount":dw,"-outlet":vw,"-in-el-null":nw},_w={...ww,array:Wv,concat:Kv,fn:Hv,get:Yv,hash:Gv,"unique-id":Rb};_w["-disallow-dynamic-resolution"]=ew;var xw={},Cw={...xw,on:nb},Sw=class{componentDefinitionCache=new Map;lookupPartial(){return null}lookupHelper(t,e){let n=_w[t];if(void 0!==n)return n;let r=e.factoryFor(`helper:${t}`);if(void 0===r)return null;let i=r.class;return void 0===i?null:"function"==typeof i&&!0===i[wb]?(Au(Cb,r),r):i}lookupBuiltInHelper(t){return ww[t]??null}lookupModifier(t,e){let n=Cw[t];if(void 0!==n)return n;let r=e.factoryFor(`modifier:${t}`);return void 0===r?null:r.class||null}lookupBuiltInModifier(t){return xw[t]??null}lookupComponent(t,e){let n=function(t,e){let n=function(t,e){let n=`component:${t}`;return e.factoryFor(n)||null}(e,t);if(null!=(r=n)&&"function"==typeof r.create&&n.class){let t=Np(n.class);if(void 0!==t)return{component:n,layout:t}}var r;return null===n?null:{component:n,layout:null}}(e,t);if(null===n)return null;let r,i=null;r=null===n.component?i=n.layout(e):n.component;let s=this.componentDefinitionCache.get(r);if(void 0!==s)return s;null===i&&null!==n.layout&&(i=n.layout(e));let o=dv("render.getComponentDefinition",bw,t),a=null;if(null===n.component)a={state:ab(void 0,t),manager:sb,template:i};else{let t=n.component,e=t.class,r=zu(e);a={state:zv(r)?t:e,manager:r,template:i}}return o(),this.componentDefinitionCache.set(r,a),a}},kw="-top-level",Ew=class t{static extend(e){return class extends t{static create(t){return t?super.create(Object.assign({},e,t)):super.create(e)}}}static reopenClass(t){Object.assign(this,t)}static create(e){let{environment:n,application:r,template:i}=e,s=Br(e),o=i(s);return new t(n,s,o,r)}ref;state;constructor(t,e,n,r){this._environment=t,this.owner=e,this.template=n,this.namespace=r;let i=gt(),s={outlets:{main:void 0},render:{owner:e,name:kw,controller:void 0,model:void 0,template:n}},o=this.ref=ge(()=>(Ft(i),s),t=>{pt(i),s.outlets.main=t});this.state={ref:o,name:kw,template:n,controller:void 0}}appendTo(t){let e;e=this._environment.hasDOM&&"string"==typeof t?document.querySelector(t):t,Es("render",this.owner.lookup("renderer:-dom"),"appendOutletView",this,e)}rerender(){}setOutletState(t){xe(this.ref,t)}destroy(){}},Rw=class t{constructor(t,e){this.view=t,this.outletState=e}child(){return new t(this.view,this.outletState)}get(t){return this.outletState}set(t,e){return this.outletState=e,e}},Tw=()=>{},Lw=class{type="component";#g;#m;constructor(t,e,n){this.#m=()=>{let r=iv(t.context,t.builder(t.env,n.into),t.owner,e,n?.args),i=this.#g=r.sync();tt(this,this.#g),this.#m=()=>{if(!it(i)&&!st(i))return i.rerender({alwaysRevalidate:!1})}}}isFor(t){return!1}render(){this.#m()}destroy(){nt(this)}get destroyed(){return st(this)}get result(){return this.#g}},Iw=class{type="classic";id;result;destroyed;render;env;constructor(t,e,n,r,i,s,o,a){this.root=t,this.id=t instanceof Ew?ll(t):Kl(t),this.result=void 0,this.destroyed=!1,this.env=e.env,this.render=()=>{let t=yv(r).asLayout(),l=rv(e,n,i,a(e.env,{element:s,nextSibling:null}),t,o),c=this.result=l.sync();tt(this,c),this.render=()=>{if(!it(c)&&!st(c))return c.rerender({alwaysRevalidate:!1})}}}isFor(t){return this.root===t}destroy(){let{result:t,env:e}=this;this.destroyed=!0,this.root=null,this.result=void 0,this.render=void 0,void 0!==t&&Py(e,()=>nt(t))}},Pw=[];function Mw(t){let e=Pw.indexOf(t);Pw.splice(e,1)}var Aw=null,Ow=0;ws.on("begin",function(){for(let t of Pw)t.rerender()}),ws.on("end",function(){for(let t of Pw)if(!t.isValid()){if(Ow>N._RERENDER_LOOP_LIMIT)throw Ow=0,t.destroy(),new Error("infinite rendering invalidation detected");return Ow++,ws.join(null,Tw)}Ow=0,function(){if(null!==Aw){let t=Aw.resolve;Aw=null,ws.join(null,t)}}()});var Nw=class t{static create(e,n){const r=new t(e,n);return tt(n,r),r}#y;#v=-1;#b=!1;#w=!1;#_=[];#x=[];constructor(t,e){this.#y=t,et(this,()=>{this.clearAllRoots(e)})}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(t,e){let n=this.#_;return n.push(t),tt(this,t),1===n.length&&function(t){Pw.push(t)}(e),this.#C(e),t}#C(t){if(this.#b)return;this.#b=!0;let e=!1;try{this.renderRoots(t),e=!0}finally{e||(this.#v=ct(xt)),this.#b=!1}}renderRoots(t){let e,n=this.#_,r=this.#x;do{e=n.length,Py(this.context.env,()=>{for(let t=0;t<n.length;t++){let i=n[t];i.destroyed?r.push(i):t>=e||i.render()}this.#v=ct(xt)})}while(n.length>e);for(;r.length;){let t=r.pop(),e=n.indexOf(t);n.splice(e,1)}0===this.#_.length&&Mw(t)}scheduleRevalidate(t){ws.scheduleOnce("render",this,this.revalidate,t)}isValid(){return this.#w||0===this.#_.length||ut(xt,this.#v)}revalidate(t){this.isValid()||this.#C(t)}clearAllRoots(t){let e=this.#_;for(let n of e)nt(n);this.#x.length=0,this.#_=[],e.length&&Mw(t)}},Fw=class t{static strict(e,n,r){return new t(e,{hasDOM:Ao,...r},n,new Sw,sm)}state;constructor(t,e,n,r,i){let s={constants:new fg,heap:new lg},o=Iy({document:n},new tw(t,e.isInteractive),s,r),a=new Mb(s,t=>new og(t),o);this.state=Nw.create({owner:t,context:a,builder:i},this)}get debugRenderTree(){let{debugRenderTree:t}=this.state.env;return t}isValid(){return this.state.isValid()}destroy(){nt(this)}render(t,e){const n=new Lw(this.state,t,{args:e.args,into:(r=e.into,"element"in r?r:{element:r,nextSibling:null})});var r;return this.state.renderRoot(n,this)}rerender(){this.state.scheduleRevalidate(this)}},zw=class extends Fw{static strict(t,e,n){return new Fw(t,{hasDOM:Ao,...n},e,new Sw,sm)}_rootTemplate;_viewRegistry;static create(t){let{_viewRegistry:e}=t,n=Br(t),r=n.lookup("service:-document"),i=n.lookup("-environment:main"),s=n.lookup(yc`template:-root`),o=n.lookup("service:-dom-builder");return new this(n,r,i,s,e,o)}constructor(t,e,n,r,i,s=sm,o=new Sw){super(t,n,e,o,s),this._rootTemplate=r(t),this._viewRegistry=i||t.lookup("-view-registry:main")}appendOutletView(t,e){let n=new jb((r=t).owner,r.state);var r;let{name:i,template:s}=t.state,o=ne();o.Component=pe(yw(t.owner,i,s)),o.controller=ce,o.model=ce;let a=Xm(o,ay);this._appendDefinition(t,xm(0,n,t.owner,a,!0),e)}appendTo(t,e){let n=new $b(t);this._appendDefinition(t,xm(0,n,this.state.owner,null,!0),e)}_appendDefinition(t,e,n){let r=pe(e),i=new Rw(null,ce),s=new Iw(t,this.state.context,this.state.owner,this._rootTemplate,r,n,i,this.state.builder);this.state.renderRoot(s,this)}cleanupRootFor(t){if(st(this))return;let e=this.state.roots,n=e.length;for(;n--;){let r=e[n];"classic"===r.type&&r.isFor(t)&&(r.destroy(),e.splice(n,1))}}remove(t){t._transitionTo("destroying"),this.cleanupRootFor(t),this.state.isInteractive&&t.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(t){let e=Kl(t);this._viewRegistry[e]=t}unregister(t){delete this._viewRegistry[Kl(t)]}getElement(t){if(this._isInteractive)return Ql(t);throw new Error("Accessing `this.element` is not allowed in non-interactive environments (such as FastBoot).")}getBounds(t){let e=t[Iv];return{parentElement:e.parentElement(),firstNode:e.firstNode(),lastNode:e.lastNode()}}},Dw=class extends hu{rootElement=null;init(t){super.init(t),this.application._watchInstance(this),this.register("-application-instance:main",this,{instantiate:!1})}_bootSync(t){return this._booted||(t=new jw(t),this.setupRegistry(t),t.rootElement?this.rootElement=t.rootElement:this.rootElement=this.application.rootElement,t.location&&mr(this.router,"location",t.location),this.application.runInstanceInitializers(this),t.isInteractive&&this.setupEventDispatcher(),this._booted=!0),this}setupRegistry(t){this.constructor.setupRegistry(this.__registry__,t)}_router;get router(){if(!this._router){let t=this.lookup("router:main");this._router=t}return this._router}didCreateRootView(t){t.appendTo(this.rootElement)}startRouting(){this.router.startRouting()}setupRouter(){this.router.setupRouter()}handleURL(t){return this.setupRouter(),this.router.handleURL(t)}setupEventDispatcher(){let t=this.lookup("event_dispatcher:main"),e=hr(this.application,"customEvents"),n=hr(this,"customEvents"),r=Object.assign({},e,n);return t.setup(r,this.rootElement),t}getURL(){return this.router.url}visit(t){this.setupRouter();let e=this.__container__.lookup("-environment:main"),n=this.router,r=hr(n,"location");return r.setURL(t),n.handleURL(r.getURL()).followRedirects().then(()=>e.options.shouldRender?function(){if(null===Aw){let t;Aw={promise:new Promise(e=>t=e),resolve:t},ys()||ws.schedule("actions",null,Tw)}return Aw.promise}().then(()=>this):this,t=>{throw t.error&&t.error instanceof Error?t.error:"TransitionAborted"===t.name?new Error(t.message):t})}willDestroy(){super.willDestroy(),this.application._unwatchInstance(this)}static setupRegistry(t,e={}){let n=e instanceof jw?e:new jw(e);t.register("-environment:main",n.toEnvironment(),{instantiate:!1}),t.register("service:-document",n.document,{instantiate:!1}),super.setupRegistry(t,n)}},jw=class{isInteractive;_renderMode;isBrowser;location=null;shouldRender;document;rootElement;constructor(t={}){this.isInteractive=Boolean(Ao),this._renderMode=t._renderMode,void 0!==t.isBrowser?this.isBrowser=Boolean(t.isBrowser):this.isBrowser=Boolean(Ao),this.isBrowser||(this.isInteractive=!1,this.location="none"),void 0!==t.shouldRender?this.shouldRender=Boolean(t.shouldRender):this.shouldRender=!0,this.shouldRender||(this.isInteractive=!1),t.document?this.document=t.document:this.document="undefined"!=typeof document?document:null,t.rootElement&&(this.rootElement=t.rootElement),void 0!==t.location&&(this.location=t.location),void 0!==t.isInteractive&&(this.isInteractive=Boolean(t.isInteractive))}toEnvironment(){return{...Ep,hasDOM:this.isBrowser,isInteractive:this.isInteractive,_renderMode:this._renderMode,options:this}}},Uw=a({default:()=>Bw}),Bw=class extends Bl{static NAMESPACES=li;static NAMESPACES_BY_ID=ci;static processAll=gi;static byName=pi;init(t){super.init(t),ui(this)}toString(){let t=hr(this,"name")||hr(this,"modulePrefix");if(t)return t;di();let e=ri(this);return void 0===e&&(e=ll(this),ni(this,e)),e}nameClasses(){fi(this)}destroy(){return hi(this),super.destroy()}};Bw.prototype.isNamespace=!0;var $w=function(){function t(){this._vertices=new qw}return t.prototype.add=function(t,e,n,r){if(!t)throw new Error("argument `key` is required");var i=this._vertices,s=i.add(t);if(s.val=e,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)},t.prototype.addEdges=function(t,e,n,r){this.add(t,e,n,r)},t.prototype.each=function(t){this._vertices.walk(t)},t.prototype.topsort=function(t){this.each(t)},t}(),qw=function(){function t(){this.length=0,this.stack=new Vw,this.path=new Vw,this.result=new Vw}return t.prototype.add=function(t){if(!t)throw new Error("missing key");for(var e,n=0|this.length,r=0;r<n;r++)if((e=this[r]).key===t)return e;return this.length=n+1,this[n]={idx:n,key:t,val:void 0,out:!1,flag:!1,length:0}},t.prototype.addEdge=function(t,e){this.check(t,e.key);for(var n=0|e.length,r=0;r<n;r++)if(e[r]===t.idx)return;e.length=n+1,e[n]=t.idx,t.out=!0},t.prototype.walk=function(t){this.reset();for(var e=0;e<this.length;e++){var n=this[e];n.out||this.visit(n,"")}this.each(this.result,t)},t.prototype.check=function(t,e){if(t.key===e)throw new Error("cycle detected: "+e+" <- "+e);if(0!==t.length){for(var n=0;n<t.length;n++)if(this[t[n]].key===e)throw new Error("cycle detected: "+e+" <- "+t.key+" <- "+e);if(this.reset(),this.visit(t,e),this.path.length>0){var r="cycle detected: "+e;throw this.each(this.path,function(t){r+=" <- "+t}),new Error(r)}}},t.prototype.reset=function(){this.stack.length=0,this.path.length=0,this.result.length=0;for(var t=0,e=this.length;t<e;t++)this[t].flag=!1},t.prototype.visit=function(t,e){var n=this,r=n.stack,i=n.path,s=n.result;for(r.push(t.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),e===a.key)break;r.push(~o),this.pushIncoming(a)}else i.pop(),s.push(~o)}},t.prototype.pushIncoming=function(t){for(var e=this.stack,n=t.length-1;n>=0;n--){var r=t[n];this[r].flag||e.push(r)}},t.prototype.each=function(t,e){for(var n=0,r=t.length;n<r;n++){var i=this[t[n]];e(i.key,i.val)}},t}(),Vw=function(){function t(){this.length=0}return t.prototype.push=function(t){this[this.length++]=0|t},t.prototype.pop=function(){return 0|this[--this.length]},t}(),Ww=class extends Bl{constructor(t){super(t),this.resolver=Br(this).lookup("resolver-for-debugging:main")}resolver;canCatalogEntriesByType(t){return"model"!==t&&"template"!==t}catalogEntriesByType(t){let e=Bw.NAMESPACES,n=[],r=new RegExp(`${function(t){return np.get(t)}(t)}$`);return e.forEach(t=>{for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&r.test(e)&&"class"===kc(t[e])&&n.push(sp(e.replace(r,"")))}),n}},Hw=nb;function Gw(){}var Zw=class{static toString(){return"internal component"}constructor(t,e,n){this.owner=t,this.args=e,this.caller=n,$r(this,t)}get id(){return ll(this)}get class(){return"ember-view"}validateArguments(){for(let t of Object.keys(this.args.named))this.isSupportedArgument(t)||this.onUnsupportedArgument(t)}named(t){let e=this.args.named[t];return e?_e(e):void 0}positional(t){let e=this.args.positional[t];return e?_e(e):void 0}listenerFor(t){return this.named(t)||Gw}isSupportedArgument(t){return!1}onUnsupportedArgument(t){}toString(){return`<${this.constructor}:${ll(this)}>`}},Kw=new WeakMap;function Yw(t,e){let n={create(){throw void 0},toString:()=>t.toString()};return Kw.set(n,t),Fu(Jw,n),Op(e,n),n}var Xw={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},Jw=new class{getCapabilities(){return Xw}create(t,e,n,r,i,s){let o=new(a=e,Kw.get(a))(t,n.capture(),_e(s));var a;return Wt(o.validateArguments.bind(o)),o}didCreate(){}didUpdate(){}didRenderLayout(){}didUpdateLayout(){}getDebugName(t){return t.toString()}getSelf(t){return pe(t)}getDestroyable(t){return t}},Qw=ig({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:Hw}),isStrictMode:!0}),t_=Object.freeze({});function e_(t){return function(t){return t.target}(t).value}function n_(t){return void 0===t?new i_(void 0):be(t)?new i_(_e(t)):we(t)?new s_(t):new o_(t)}var r_,i_=class{static{Zh(this.prototype,"value",[Wr])}#S=void Yh(this,"value");constructor(t){this.value=t}get(){return this.value}set(t){this.value=t}},s_=class{constructor(t){this.reference=t}get(){return _e(this.reference)}set(t){xe(this.reference,t)}},o_=class{local;upstream;lastUpstreamValue=t_;constructor(t){this.upstream=new s_(t)}get(){let t=this.upstream.get();return t!==this.lastUpstreamValue&&(this.lastUpstreamValue=t,this.local=new i_(t)),this.local.get()}set(t){this.local.set(t)}},a_=class extends Zw{validateArguments(){super.validateArguments()}_value=n_(this.args.named.value);get value(){return this._value.get()}set value(t){this._value.set(t)}valueDidChange(t){this.value=e_(t)}static{Kh(this.prototype,"valueDidChange",[Vl])}change(t){this.valueDidChange(t)}input(t){this.valueDidChange(t)}keyUp(t){switch(t.key){case"Enter":this.listenerFor("enter")(t),this.listenerFor("insert-newline")(t);break;case"Escape":this.listenerFor("escape-press")(t)}}static{Kh(this.prototype,"keyUp",[Vl])}listenerFor(t){let e=super.listenerFor(t);return this.isVirtualEventListener(t,e)?function(t){return e=>t(e_(e),e)}(e):e}isVirtualEventListener(t,e){return-1!==["enter","insert-newline","escape-press"].indexOf(t)}};if(Ao){const t=Object.create(null),e=document.createElement("input");t[""]=!1,t.text=!0,t.checkbox=!0,r_=n=>{let r=t[n];if(void 0===r){try{e.type=n,r=e.type===n}catch(i){r=!1}finally{e.type="text"}t[n]=r}return r}}else r_=t=>""!==t;var l_=class extends a_{static toString(){return"Input"}get class(){return this.isCheckbox?"ember-checkbox ember-view":"ember-text-field ember-view"}get type(){let t=this.named("type");return null==t?"text":r_(t)?t:"text"}get isCheckbox(){return"checkbox"===this.named("type")}_checked=n_(this.args.named.checked);get checked(){return this.isCheckbox?this._checked.get():void 0}set checked(t){this._checked.set(t)}change(t){this.isCheckbox?this.checkedDidChange(t):super.change(t)}static{Kh(this.prototype,"change",[Vl])}input(t){this.isCheckbox||super.input(t)}static{Kh(this.prototype,"input",[Vl])}checkedDidChange(t){let e=t.target;this.checked=e.checked}static{Kh(this.prototype,"checkedDidChange",[Vl])}isSupportedArgument(t){return-1!==["type","value","checked","enter","insert-newline","escape-press"].indexOf(t)||super.isSupportedArgument(t)}},c_=Yw(l_,Qw),u_=ig({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:Hw}),isStrictMode:!0}),h_=class extends a_{static toString(){return"Textarea"}get class(){return"ember-text-area ember-view"}change(t){super.change(t)}static{Kh(this.prototype,"change",[Vl])}input(t){super.input(t)}static{Kh(this.prototype,"input",[Vl])}isSupportedArgument(t){return-1!==["type","value","enter","insert-newline","escape-press"].indexOf(t)||super.isSupportedArgument(t)}},d_=Yw(h_,u_),p_=ig({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:Hw}),isStrictMode:!0}),f_=[],g_={};function m_(t){return null==t}function y_(t){return"object"==typeof t&&null!==t&&!0===t.isQueryParams}var v_=class extends Zw{static toString(){return"LinkTo"}static{Zh(this.prototype,"routing",[pp("-routing")])}#k=void Yh(this,"routing");validateArguments(){super.validateArguments()}get class(){let t="ember-view";return this.isActive?(t+=this.classFor("active"),!1===this.willBeActive&&(t+=" ember-transitioning-out")):this.willBeActive&&(t+=" ember-transitioning-in"),this.isLoading&&(t+=this.classFor("loading")),this.isDisabled&&(t+=this.classFor("disabled")),t}get href(){if(this.isLoading)return"#";let{routing:t,route:e,models:n,query:r}=this;return Ft(Kt(t,"currentState")),t.generateURL(e,n,r)}click(t){if(!Hl(t))return;let e=t.currentTarget,n=e instanceof SVGAElement?e.target.baseVal:e.target;if(""!==n&&"_self"!==n)return;if(this.preventDefault(t),this.isDisabled)return;if(this.isLoading)return;let{routing:r,route:i,models:s,query:o,replace:a}=this,l={transition:void 0};uv(0,0,()=>{l.transition=r.transitionTo(i,s,o,a)})}static{Kh(this.prototype,"click",[Vl])}get route(){if("route"in this.args.named){let t=this.named("route");return t&&this.namespaceRoute(t)}return this.currentRoute}currentRouteCache=Bt(()=>(Ft(Kt(this.routing,"currentState")),Wt(()=>this.routing.currentRouteName)));get currentRoute(){return $t(this.currentRouteCache)}get models(){return"models"in this.args.named?this.named("models"):"model"in this.args.named?[this.named("model")]:f_}get query(){return"query"in this.args.named?{...this.named("query")}:g_}get replace(){return!0===this.named("replace")}get isActive(){return this.isActiveForState(this.routing.currentState)}get willBeActive(){let t=this.routing.currentState,e=this.routing.targetState;return t===e?null:this.isActiveForState(e)}get isLoading(){return m_(this.route)||this.models.some(t=>m_(t))}get isDisabled(){return Boolean(this.named("disabled"))}get isEngine(){return void 0!==au(this.owner)}get engineMountPoint(){return this.owner.mountPoint}classFor(t){let e=this.named(`${t}Class`);return!0===e||m_(e)?` ${t}`:e?` ${e}`:""}namespaceRoute(t){let{engineMountPoint:e}=this;return void 0===e?t:"application"===t?e:`${e}.${t}`}isActiveForState(t){if(m_(t))return!1;if(this.isLoading)return!1;let e=this.named("current-when");if("boolean"==typeof e)return e;if("string"==typeof e){let{routing:n}=this;return e.split(" ").some(e=>n.isActiveForRoute([],void 0,this.namespaceRoute(e),t))}{let{route:e,models:n,query:r,routing:i}=this;return i.isActiveForRoute(n,r,e,t)}}preventDefault(t){t.preventDefault()}isSupportedArgument(t){return-1!==["route","model","models","query","replace","disabled","current-when","activeClass","loadingClass","disabledClass"].indexOf(t)||super.isSupportedArgument(t)}},{prototype:b_}=v_,w_=(t,e)=>t?Object.getOwnPropertyDescriptor(t,e)||w_(Object.getPrototypeOf(t),e):null;{let t=b_.onUnsupportedArgument;Object.defineProperty(b_,"onUnsupportedArgument",{configurable:!0,enumerable:!1,value:function(e){"href"===e||t.call(this,e)}})}{let t=w_(b_,"models").get;Object.defineProperty(b_,"models",{configurable:!0,enumerable:!1,get:function(){let e=t.call(this);return e.length>0&&!("query"in this.args.named)&&y_(e[e.length-1])&&(e=e.slice(0,-1)),e}});let e=w_(b_,"query").get;Object.defineProperty(b_,"query",{configurable:!0,enumerable:!1,get:function(){if("query"in this.args.named){let t=e.call(this);return y_(t)?t.values??g_:t}{let e=t.call(this);if(e.length>0){let t=e[e.length-1];if(y_(t)&&null!==t.values)return t.values}return g_}}})}{let t=b_.onUnsupportedArgument;Object.defineProperty(b_,"onUnsupportedArgument",{configurable:!0,enumerable:!1,value:function(e){"params"!==e&&t.call(this,e)}})}var __=Yw(v_,p_),x_="%+b:0%";function C_(t){return t.nodeValue===x_}var S_=class extends gg{candidate=null;openBlockDepth;injectedOmittedNode=!1;constructor(t,e,n){super(t,e),this.startingBlockDepth=n,this.openBlockDepth=n-1}},k_=class extends tm{unmatchedAttributes=null;blockDepth=0;startingBlockOffset;constructor(t,e,n){if(super(t,e,n),n)throw new Error("Rehydration with nextSibling not supported");let r=this.currentCursor.element.firstChild;for(;null!==r&&!E_(r);)r=r.nextSibling;this.candidate=r;const i=T_(r);if(0!==i){const t=i-1,e=this.dom.createComment(`%+b:${t}%`);r.parentNode.insertBefore(e,this.candidate);let n=r.nextSibling;for(;null!==n&&(!R_(n)||T_(n)!==i);)n=n.nextSibling;const s=this.dom.createComment(`%-b:${t}%`);r.parentNode.insertBefore(s,n.nextSibling),this.candidate=e,this.startingBlockOffset=t}else this.startingBlockOffset=0}get currentCursor(){return this.cursors.current}get candidate(){return this.currentCursor?this.currentCursor.candidate:null}set candidate(t){this.currentCursor.candidate=t}disableRehydration(t){const e=this.currentCursor;e.candidate=null,e.nextSibling=t}enableRehydration(t){const e=this.currentCursor;e.candidate=t,e.nextSibling=null}pushElement(t,e=null){const n=new S_(t,e,this.blockDepth||0);null!==this.candidate&&(n.candidate=t.firstChild,this.candidate=t.nextSibling),this.cursors.push(n)}clearMismatch(t){let e=t;const n=this.currentCursor;if(null!==n){const t=n.openBlockDepth;if(t>=n.startingBlockDepth)for(;e&&!(R_(e)&&t>=L_(e,this.startingBlockOffset));)e=this.remove(e);else for(;null!==e;)e=this.remove(e);this.disableRehydration(e)}}__openBlock(){const{currentCursor:t}=this;if(null===t)return;const e=this.blockDepth;this.blockDepth++;const{candidate:n}=t;if(null===n)return;const{tagName:r}=t.element;E_(n)&&L_(n,this.startingBlockOffset)===e?(this.candidate=this.remove(n),t.openBlockDepth=e):"TITLE"!==r&&"SCRIPT"!==r&&"STYLE"!==r&&this.clearMismatch(n)}__closeBlock(){const{currentCursor:t}=this;if(null===t)return;const e=t.openBlockDepth;this.blockDepth--;const{candidate:n}=t;let r=!1;if(null!==n)if(r=!0,R_(n)&&L_(n,this.startingBlockOffset)===e){const e=this.remove(n);this.candidate=e,t.openBlockDepth--}else this.clearMismatch(n),r=!1;if(!r){const e=t.nextSibling;if(null!==e&&R_(e)&&L_(e,this.startingBlockOffset)===this.blockDepth){const n=this.remove(e);this.enableRehydration(n),t.openBlockDepth--}}}__appendNode(t){const{candidate:e}=this;return e||super.__appendNode(t)}__appendHTML(t){const e=this.markerBounds();if(e){const t=e.firstNode(),n=e.lastNode(),r=new mg(this.element,t.nextSibling,n.previousSibling),i=this.remove(t);return this.remove(n),null!==i&&M_(i)&&(this.candidate=this.remove(i),null!==this.candidate&&this.clearMismatch(this.candidate)),r}return super.__appendHTML(t)}remove(t){const e=t.parentNode,n=t.nextSibling;return e.removeChild(t),n}markerBounds(){const t=this.candidate;if(t&&P_(t)){const e=t;let n=e.nextSibling;for(;!P_(n);)n=Jt(n.nextSibling);return new mg(this.element,e,n)}return null}__appendText(t){const{candidate:e}=this;return e?3===e.nodeType?(e.nodeValue!==t&&(e.nodeValue=t),this.candidate=e.nextSibling,e):8===(n=e).nodeType&&"%|%"===n.nodeValue||M_(e)&&""===t?(this.candidate=this.remove(e),this.__appendText(t)):(this.clearMismatch(e),super.__appendText(t)):super.__appendText(t);var n}__appendComment(t){const e=this.candidate;return e&&8===e.nodeType?(e.nodeValue!==t&&(e.nodeValue=t),this.candidate=e.nextSibling,e):(e&&this.clearMismatch(e),super.__appendComment(t))}__openElement(t){const e=this.candidate;if(e&&I_(e)&&function(t,e){return"http://www.w3.org/2000/svg"===t.namespaceURI?t.tagName===e:t.tagName===e.toUpperCase()}(e,t))return this.unmatchedAttributes=[].slice.call(e.attributes),e;if(e){if(I_(e)&&"TBODY"===e.tagName)return this.pushElement(e,null),this.currentCursor.injectedOmittedNode=!0,this.__openElement(t);this.clearMismatch(e)}return super.__openElement(t)}__setAttribute(t,e,n){const r=this.unmatchedAttributes;if(r){const n=A_(r,t);if(n)return n.value!==e&&(n.value=e),void r.splice(r.indexOf(n),1)}return super.__setAttribute(t,e,n)}__setProperty(t,e){const n=this.unmatchedAttributes;if(n){const r=A_(n,t);if(r)return r.value!==e&&(r.value=e),void n.splice(n.indexOf(r),1)}return super.__setProperty(t,e)}__flushElement(t,e){const{unmatchedAttributes:n}=this;if(n){for(const t of n)this.constructing.removeAttribute(t.name);this.unmatchedAttributes=null}else super.__flushElement(t,e)}willCloseElement(){const{candidate:t,currentCursor:e}=this;null!==t&&this.clearMismatch(t),e&&e.injectedOmittedNode&&this.popElement(),super.willCloseElement()}getMarker(t,e){const n=t.querySelector(`script[glmr="${e}"]`);return n?(function(t){t.nodeType}(r=n),r):null;var r}__pushRemoteElement(t,e,n){const r=this.getMarker(t,e);if(!r||r.parentNode,void 0===n){for(;null!==t.firstChild&&t.firstChild!==r;)this.remove(t.firstChild);n=null}const i=new S_(t,null,this.blockDepth);this.cursors.push(i),null===r?this.disableRehydration(n):this.candidate=this.remove(r);const s=new nm(t);return this.pushBlock(s,!0)}didAppendBounds(t){if(super.didAppendBounds(t),this.candidate){const e=t.lastNode();this.candidate=e.nextSibling}return t}};function E_(t){return 8===t.nodeType&&0===t.nodeValue.lastIndexOf("%+b:",0)}function R_(t){return 8===t.nodeType&&0===t.nodeValue.lastIndexOf("%-b:",0)}function T_(t){return parseInt(t.nodeValue.slice(4),10)}function L_(t,e){return T_(t)-e}function I_(t){return 1===t.nodeType}function P_(t){return 8===t.nodeType&&"%glmr%"===t.nodeValue}function M_(t){return 8===t.nodeType&&"% %"===t.nodeValue}function A_(t,e){for(const n of t)if(n.name===e)return n}function O_(t,e){return k_.forInitialRender(t,e)}var N_=new WeakMap,F_=class extends tm{serializeBlockDepth=0;__openBlock(){let{tagName:t}=this.element;if("TITLE"!==t&&"SCRIPT"!==t&&"STYLE"!==t){let t=this.serializeBlockDepth++;this.__appendComment(`%+b:${t}%`)}super.__openBlock()}__closeBlock(){let{tagName:t}=this.element;if(super.__closeBlock(),"TITLE"!==t&&"SCRIPT"!==t&&"STYLE"!==t){let t=--this.serializeBlockDepth;this.__appendComment(`%-b:${t}%`)}}__appendHTML(t){let{tagName:e}=this.element;if("TITLE"===e||"SCRIPT"===e||"STYLE"===e)return super.__appendHTML(t);let n=this.__appendComment("%glmr%");if("TABLE"===e){let e=t.indexOf("<");e>-1&&"tr"===t.slice(e+1,e+3)&&(t=`<tbody>${t}</tbody>`)}""===t?this.__appendComment("% %"):super.__appendHTML(t);let r=this.__appendComment("%glmr%");return new mg(this.element,n,r)}__appendText(t){let{tagName:e}=this.element,n=function(t){let{element:e,nextSibling:n}=t;return null===n?e.lastChild:n.previousSibling}(this);return"TITLE"===e||"SCRIPT"===e||"STYLE"===e?super.__appendText(t):""===t?this.__appendComment("% %"):(n&&3===n.nodeType&&this.__appendComment("%|%"),super.__appendText(t))}closeElement(){return N_.has(this.element)&&(N_.delete(this.element),super.closeElement()),super.closeElement()}openElement(t){return"tr"===t&&"TBODY"!==this.element.tagName&&"THEAD"!==this.element.tagName&&"TFOOT"!==this.element.tagName&&(this.openElement("tbody"),N_.set(this.constructing,!0),this.flushElement(null)),super.openElement(t)}pushRemoteElement(t,e,n=null){let{dom:r}=this,i=r.createElement("script");return i.setAttribute("glmr",e),r.insertBefore(t,i,n),super.pushRemoteElement(t,e,n)}};function z_(t,e){return F_.forInitialRender(t,e)}var D_=ig({id:null,block:'[[[46,[30,0],null,null,null]],[],["component"]]',moduleName:"packages/@ember/-internals/glimmer/lib/templates/root.hbs",isStrictMode:!0}),j_=ig({id:null,block:'[[[46,[28,[32,0],null,null],null,null,null]],[],["component"]]',moduleName:"packages/@ember/-internals/glimmer/lib/templates/outlet.hbs",scope:()=>({outletHelper:vw}),isStrictMode:!0});function U_(t){t.register("service:-dom-builder",{create(t){switch(Br(t).lookup("-environment:main")._renderMode){case"serialize":return z_.bind(null);case"rehydrate":return O_.bind(null);default:return sm.bind(null)}}}),t.register(yc`template:-root`,D_),t.register("renderer:-dom",zw)}var B_=class t{moduleBasedResolver=!0;#E=new Map;original;static create({namespace:e}){return new t(e.modules)}constructor(t){this.addModules(t)}addModules(t){for(let[e,n]of Object.entries(t))this.#E.set(this.#R(e),n)}#R(t){return t.replace($_,"").replace(q_,"")}#T(t){return"config"===t?t:t+"s"}resolve(t){let[e,n]=t.split(":");n=this.#L(e,n);for(let r of[this.#I,this.#P,this.#M,this.#A]){let t=r.call(this,e,n);if(t)return this.#O(t.hit)}}#O(t){return t&&t.default&&(t=t.default),t}normalize(t){let[e,n]=t.split(":");return n=this.#L(e,n),`${e}:${n}`}#L(t,e){return"component"===t||"helper"===t||"modifier"===t||"template"===t&&0===e.indexOf("components/")?e.replace(/_/g,"-"):function(t){return t.replace(V_,"$1_$2").toLowerCase().replace(W_,"-")}(e.replace(/\./g,"/"))}#I(t,e){if("resolver"===t&&"current"===e)return{hit:{create:()=>this}}}#P(t,e){if("main"===e){let e=this.#E.get(t);if(e)return{hit:e}}}#M(t,e){let n=`${this.#T(t)}/${e}`,r=this.#E.get(n);if(r)return{hit:r}}#A(t,e){if("component"!==t)return;let n=`${this.#T(t)}/${e}/index`,r=this.#E.get(n);return r?{hit:r}:void 0}},$_=/\.\w{1,4}$/,q_=/^\.\//,V_=/([a-z\d])([A-Z])/g,W_=/[ _]/g,H_=class extends(Bw.extend(cu)){static initializers=Object.create(null);static instanceInitializers=Object.create(null);static initializer=Z_("initializers");static instanceInitializer=Z_("instanceInitializers");static buildRegistry(t){let e=new fc({resolver:G_(t)});return e.set=mr,e.register("application:main",t,{instantiate:!1}),function(t){t.optionsForType("component",{singleton:!1}),t.optionsForType("view",{singleton:!1}),t.register("controller:basic",eu,{instantiate:!1}),t.register("service:-routing",vp),t.register("resolver-for-debugging:main",t.resolver,{instantiate:!1}),t.register("container-debug-adapter:main",Ww)}(e),function(t){t.optionsForType("template",{instantiate:!1}),t.register("view:-outlet",Ew),t.register("template:-outlet",j_),t.optionsForType("helper",{instantiate:!1}),t.register("component:input",c_),t.register("component:link-to",__),t.register("component:textarea",d_)}(e),e}Resolver=B_;init(t){super.init(t),this.buildRegistry()}_initializersRan=!1;ensureInitializers(){this._initializersRan||(this.runInitializers(),this._initializersRan=!0)}buildInstance(t={}){return this.ensureInitializers(),hu.create({...t,base:this})}buildRegistry(){return this.__registry__=this.constructor.buildRegistry(this)}initializer(t){this.constructor.initializer(t)}instanceInitializer(t){this.constructor.instanceInitializer(t)}runInitializers(){this._runInitializer("initializers",(t,e)=>{e.initialize(this)})}runInstanceInitializers(t){this._runInitializer("instanceInitializers",(e,n)=>{n.initialize(t)})}_runInitializer(t,e){let n,r=hr(this.constructor,t),i=function(t){let e=[];for(let n in t)e.push(n);return e}(r),s=new $w;for(let o of i)n=r[o],s.add(n.name,n,n.before,n.after);s.topsort(e)}};function G_(t){let e={namespace:t};return t.Resolver.create(e)}function Z_(t){return function(e){let n=this.superclass;if(void 0!==n[t]&&n[t]===this[t]){let e={[t]:Object.create(this[t])};this.reopenClass(e)}this[t][e.name]=e}}var K_=a({default:()=>J_,getOwner:()=>Y_,setOwner:()=>X_}),Y_=Po,X_=$r,J_=class extends H_{static buildRegistry(t){let e=super.buildRegistry(t);return function(t){t.register("router:main",Ad),t.register("-view-registry:main",{create:()=>Mo(null)}),t.register("route:basic",Qh),t.register("event_dispatcher:main",dc),t.register("location:hash",Wd),t.register("location:history",Gd),t.register("location:none",Zd),t.register(yc`-bucket-cache:main`,{create:()=>new bp}),t.register("service:router",yp)}(e),U_(e),e}static initializer=Z_("initializers");static instanceInitializer=Z_("instanceInitializers");init(t){super.init(t),this.rootElement??="body",this._document??=null,this.eventDispatcher??=null,this.customEvents??=null,this.autoboot??=!0,this._document??=Ao?window.document:null,this._readinessDeferrals=1,this._booted=!1,this._applicationInstances=new Set,this.autoboot=Boolean(this.autoboot),this.autoboot&&(this.Router=(this.Router||Ad).extend(),this._buildDeprecatedInstance(),this.waitForDOMReady())}buildInstance(t={}){return Dw.create({...t,base:this,application:this})}_watchInstance(t){this._applicationInstances.add(t)}_unwatchInstance(t){return this._applicationInstances.delete(t)}Router;__deprecatedInstance__;__container__;_buildDeprecatedInstance(){let t=this.buildInstance();this.__deprecatedInstance__=t,this.__container__=t.__container__}waitForDOMReady(){const t=this._document;if(null===t||"loading"!==t.readyState)Es("actions",this,this.domReady);else{let e=()=>{t.removeEventListener("DOMContentLoaded",e),_s(this,this.domReady)};t.addEventListener("DOMContentLoaded",e)}}domReady(){this.isDestroying||this.isDestroyed||this._bootSync()}deferReadiness(){this._readinessDeferrals++}advanceReadiness(){this._readinessDeferrals--,0===this._readinessDeferrals&&Is(this,this.didBecomeReady)}_bootPromise=null;boot(){if(this._bootPromise)return this._bootPromise;try{this._bootSync()}catch(t){}return this._bootPromise}_bootResolver=null;_bootSync(){if(this._booted||this.isDestroying||this.isDestroyed)return;let t=this._bootResolver=$a.defer();this._bootPromise=t.promise;try{this.runInitializers(),this.advanceReadiness()}catch(d8){throw t.reject(d8),d8}}reset(){let t=this.__deprecatedInstance__;this._readinessDeferrals=1,this._bootPromise=null,this._bootResolver=null,this._booted=!1,xs(this,function(){_s(t,"destroy"),this._buildDeprecatedInstance(),Es("actions",this,"_bootSync")})}didBecomeReady(){if(!this.isDestroying&&!this.isDestroyed)try{if(this.autoboot){let t=this.__deprecatedInstance__;t._bootSync(),this.ready(),t.startRouting()}this._bootResolver.resolve(this),this._booted=!0}catch(d8){throw this._bootResolver.reject(d8),d8}}ready(){return this}willDestroy(){super.willDestroy(),this._applicationInstances.size&&(this._applicationInstances.forEach(t=>t.destroy()),this._applicationInstances.clear())}visit(t,e){return this.boot().then(()=>{let n=this.buildInstance();return n.boot(e).then(()=>n.visit(t)).catch(t=>{throw _s(n,"destroy"),t})})}},Q_=Object.assign({},{});function tx(){return ex.global}var ex=globalThis.__embroider_macros__runtime_config__||={};ex.packages||={},ex.global||={};Object.assign(ex.packages,{}),Object.assign(ex.global,{});var nx="undefined"!=typeof window?window._embroider_macros_runtime_config:void 0;if(nx){let t={config:function(t){return ex.packages[t]},getGlobalConfig:tx,setConfig(t,e){ex.packages[t]=e},setGlobalConfig(t,e){ex.global[t]=e}};for(let e of nx)e(t)}var rx=a({default:()=>ix,enterTestMode:()=>sx}),ix={modulePrefix:"marco",environment:"production",rootURL:"/",locationType:"history",EmberENV:{},APP:{}};function sx(){ix.locationType="none",ix.APP.rootElement="#ember-testing",ix.APP.autoboot=!1;const t=tx()["@embroider/macros"];t&&(t.isTesting=!0)}var ox=()=>{},ax=()=>{};function lx(t){let e=t.lookup("renderer:-dom");if(!e)throw new Error("BUG: owner is missing renderer");return e.debugRenderTree.capture()}var cx=a({_warnIfUsingStrippedFeatureFlags:()=>{},assert:()=>Sn,captureRenderTree:()=>lx,debug:()=>px,debugFreeze:()=>gx,debugSeal:()=>fx,deprecate:()=>wx,deprecateFunc:()=>bx,getDebugFunction:()=>vx,info:()=>hx,inspect:()=>Mn,isTesting:()=>iu,registerDeprecationHandler:()=>ox,registerWarnHandler:()=>ax,runInDebug:()=>mx,setDebugFunction:()=>yx,setTesting:()=>su,warn:()=>dx}),ux=()=>{},hx=ux,dx=ux,px=ux,fx=ux,gx=ux,mx=ux,yx=ux,vx=ux,bx=function(){return arguments[arguments.length-1]};function wx(){}var _x,xx=a({});_x={throwOnUnhandled:!1,workflow:[]},self.deprecationWorkflow=self.deprecationWorkflow||{},self.deprecationWorkflow.deprecationLog={messages:new Set},self.deprecationWorkflow.flushDeprecations=t=>function({handler:t="silence",config:e={}}={}){let n=self.deprecationWorkflow.deprecationLog.messages,r=e.workflow??[],i=n.values().filter(t=>!r.some(e=>e.matchId===t)).map(e=>({handler:t,matchId:e})),s={...e,workflow:[...r,...i]};return`import setupDeprecationWorkflow from 'ember-cli-deprecation-workflow';\n\nsetupDeprecationWorkflow(${JSON.stringify(s,void 0,2)});`}({config:_x,...t}),function(){const t="TEST_WAITERS",e="undefined"!=typeof Symbol?Symbol.for(t):t,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[e];void 0===r&&(r=n[e]=new Map)}();var Cx=class{name;constructor(t){this.name=t}beginAsync(){return this}endAsync(){}waitUntil(){return!0}debugInfo(){return[]}reset(){}};function Sx(t){return new Cx(t)}Sx("@ember/test-waiters:promise-waiter"),Sx("@ember/test-waiters:generator-waiter");var kx,Ex=a({assertDestroyablesDestroyed:()=>{},associateDestroyableChild:()=>tt,destroy:()=>nt,enableDestroyableTracking:()=>{},isDestroyed:()=>st,isDestroying:()=>it,registerDestructor:()=>Rx,unregisterDestructor:()=>Tx});function Rx(t,e){return et(t,e)}function Tx(t,e){return function(t,e,n=!1){let r=Q(t),i=n?"eagerDestructors":"destructors";r[i]=J(r[i],e)}(t,e)}(kx=Io,kx?.__esModule?kx:{default:kx,...kx}).getOwner;var Lx=Ad,Ix=a({default:()=>Px}),Px=class extends Lx{location=ix.locationType;rootURL=ix.rootURL};function Mx(t){return 0===t||3===t||1e4<=t&&t<2e4}function Ax(t){return 3e4<=t&&t<4e4}function Ox(t,e){const n=e instanceof Array?e:[e];return function(t){if(!(t instanceof Object))return!1;if("number"!=typeof t.kind)return!1;if("string"!=typeof t.content)return!1;if("number"!=typeof t.created_at)return!1;if("string"!=typeof t.pubkey)return!1;if(!t.pubkey.match(/^[a-f0-9]{64}$/))return!1;if(!Array.isArray(t.tags))return!1;for(let e=0;e<t.tags.length;e++){let n=t.tags[e];if(!Array.isArray(n))return!1;for(let t=0;t<n.length;t++)if("string"!=typeof n[t])return!1}return!0}(t)&&n.includes(t.kind)||!1}function Nx(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function Fx(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function zx(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}Px.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,jx=t=>t instanceof Uint8Array,Ux=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),Bx=(t,e)=>t<<32-e|t>>>e;if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");function $x(t){if("string"==typeof t&&(t=function(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}(t)),!jx(t))throw new Error("expected Uint8Array, got "+typeof t);return t}var qx=class{clone(){return this._cloneInto()}};function Vx(t){const e=e=>t().update($x(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function Wx(t=32){if(Dx&&"function"==typeof Dx.getRandomValues)return Dx.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}var Hx=class extends qx{constructor(t,e,n,r){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Ux(this.buffer)}update(t){zx(this);const{view:e,buffer:n,blockLen:r}=this,i=(t=$x(t)).length;for(let s=0;s<i;){const o=Math.min(r-this.pos,i-s);if(o===r){const e=Ux(t);for(;r<=i-s;s+=r)this.process(e,s);continue}n.set(t.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===r&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){zx(this),function(t,e){Fx(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}(t,this),this.finished=!0;const{buffer:e,view:n,blockLen:r,isLE:i}=this;let{pos:s}=this;e[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++)e[u]=0;!function(t,e,n,r){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,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;t.setUint32(e+l,o,r),t.setUint32(e+c,a,r)}(n,r-8,BigInt(8*this.length),i),this.process(n,0);const o=Ux(t),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:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:n,length:r,finished:i,destroyed:s,pos:o}=this;return t.length=r,t.pos=o,t.finished=i,t.destroyed=s,r%e&&t.buffer.set(n),t}},Gx=(t,e,n)=>t&e^~t&n,Zx=(t,e,n)=>t&e^t&n^e&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]),Yx=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Xx=new Uint32Array(64),Jx=class extends Hx{constructor(){super(64,32,8,!1),this.A=0|Yx[0],this.B=0|Yx[1],this.C=0|Yx[2],this.D=0|Yx[3],this.E=0|Yx[4],this.F=0|Yx[5],this.G=0|Yx[6],this.H=0|Yx[7]}get(){const{A:t,B:e,C:n,D:r,E:i,F:s,G:o,H:a}=this;return[t,e,n,r,i,s,o,a]}set(t,e,n,r,i,s,o,a){this.A=0|t,this.B=0|e,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(t,e){for(let u=0;u<16;u++,e+=4)Xx[u]=t.getUint32(e,!1);for(let u=16;u<64;u++){const t=Xx[u-15],e=Xx[u-2],n=Bx(t,7)^Bx(t,18)^t>>>3,r=Bx(e,17)^Bx(e,19)^e>>>10;Xx[u]=r+Xx[u-7]+n+Xx[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 t=c+(Bx(o,6)^Bx(o,11)^Bx(o,25))+Gx(o,a,l)+Kx[u]+Xx[u]|0,e=(Bx(n,2)^Bx(n,13)^Bx(n,22))+Zx(n,r,i)|0;c=l,l=a,a=o,o=s+t|0,s=i,i=r,r=n,n=t+e|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(){Xx.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},Qx=Vx(()=>new Jx),tC=a({bitGet:()=>wC,bitLen:()=>bC,bitMask:()=>xC,bitSet:()=>_C,bytesToHex:()=>oC,bytesToNumberBE:()=>uC,bytesToNumberLE:()=>hC,concatBytes:()=>mC,createHmacDrbg:()=>kC,ensureBytes:()=>gC,equalBytes:()=>yC,hexToBytes:()=>cC,hexToNumber:()=>lC,numberToBytesBE:()=>dC,numberToBytesLE:()=>pC,numberToHexUnpadded:()=>aC,numberToVarBytesBE:()=>fC,utf8ToBytes:()=>vC,validateObject:()=>RC}),eC=BigInt(0),nC=BigInt(1),rC=BigInt(2),iC=t=>t instanceof Uint8Array,sC=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function oC(t){if(!iC(t))throw new Error("Uint8Array expected");let e="";for(let n=0;n<t.length;n++)e+=sC[t[n]];return e}function aC(t){const e=t.toString(16);return 1&e.length?`0${e}`:e}function lC(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);return BigInt(""===t?"0":`0x${t}`)}function cC(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);const e=t.length;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(e/2);for(let r=0;r<n.length;r++){const e=2*r,i=t.slice(e,e+2),s=Number.parseInt(i,16);if(Number.isNaN(s)||s<0)throw new Error("Invalid byte sequence");n[r]=s}return n}function uC(t){return lC(oC(t))}function hC(t){if(!iC(t))throw new Error("Uint8Array expected");return lC(oC(Uint8Array.from(t).reverse()))}function dC(t,e){return cC(t.toString(16).padStart(2*e,"0"))}function pC(t,e){return dC(t,e).reverse()}function fC(t){return cC(aC(t))}function gC(t,e,n){let r;if("string"==typeof e)try{r=cC(e)}catch(s){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${s}`)}else{if(!iC(e))throw new Error(`${t} must be hex string or Uint8Array`);r=Uint8Array.from(e)}const i=r.length;if("number"==typeof n&&i!==n)throw new Error(`${t} expected ${n} bytes, got ${i}`);return r}function mC(...t){const e=new Uint8Array(t.reduce((t,e)=>t+e.length,0));let n=0;return t.forEach(t=>{if(!iC(t))throw new Error("Uint8Array expected");e.set(t,n),n+=t.length}),e}function yC(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function vC(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}function bC(t){let e;for(e=0;t>eC;t>>=nC,e+=1);return e}function wC(t,e){return t>>BigInt(e)&nC}var _C=(t,e,n)=>t|(n?nC:eC)<<BigInt(e),xC=t=>(rC<<BigInt(t-1))-nC,CC=t=>new Uint8Array(t),SC=t=>Uint8Array.from(t);function kC(t,e,n){if("number"!=typeof t||t<2)throw new Error("hashLen must be a number");if("number"!=typeof e||e<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=CC(t),i=CC(t),s=0;const o=()=>{r.fill(1),i.fill(0),s=0},a=(...t)=>n(i,r,...t),l=(t=CC())=>{i=a(SC([0]),t),r=a(),0!==t.length&&(i=a(SC([1]),t),r=a())},c=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let t=0;const n=[];for(;t<e;){r=a();const e=r.slice();n.push(e),t+=r.length}return mC(...n)};return(t,e)=>{let n;for(o(),l(t);!(n=e(c()));)l();return o(),n}}var EC={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||t instanceof Uint8Array,isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function RC(t,e,n={}){const r=(e,n,r)=>{const i=EC[n];if("function"!=typeof i)throw new Error(`Invalid validator "${n}", expected function`);const s=t[e];if(!(r&&void 0===s||i(s,t)))throw new Error(`Invalid param ${String(e)}=${s} (${typeof s}), expected ${n}`)};for(const[i,s]of Object.entries(e))r(i,s,!1);for(const[i,s]of Object.entries(n))r(i,s,!0);return t}var TC=BigInt(0),LC=BigInt(1),IC=BigInt(2),PC=BigInt(3),MC=BigInt(4),AC=BigInt(5),OC=BigInt(8);function NC(t,e){const n=t%e;return n>=TC?n:e+n}function FC(t,e,n){if(n<=TC||e<TC)throw new Error("Expected power/modulo > 0");if(n===LC)return TC;let r=LC;for(;e>TC;)e&LC&&(r=r*t%n),t=t*t%n,e>>=LC;return r}function zC(t,e,n){let r=t;for(;e-- >TC;)r*=r,r%=n;return r}function DC(t,e){if(t===TC||e<=TC)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=NC(t,e),r=e,i=TC,s=LC,o=LC,a=TC;for(;n!==TC;){const t=r/n,e=r%n,l=i-o*t,c=s-a*t;r=n,n=e,i=o,s=a,o=l,a=c}if(r!==LC)throw new Error("invert: does not exist");return NC(i,e)}BigInt(9),BigInt(16);var jC=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function UC(t,e){const n=void 0!==e?e:t.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function BC(t){if("bigint"!=typeof t)throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function $C(t){const e=BC(t);return e+Math.ceil(e/2)}var qC=BigInt(0),VC=BigInt(1);function WC(t){return function(t){const e=jC.reduce((t,e)=>(t[e]="function",t),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});RC(t,e)}(t.Fp),RC(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...UC(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}var{bytesToNumberBE:HC,hexToBytes:GC}=tC,ZC={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(t){const{Err:e}=ZC;if(t.length<2||2!==t[0])throw new e("Invalid signature integer tag");const n=t[1],r=t.subarray(2,n+2);if(!n||r.length!==n)throw new e("Invalid signature integer: wrong length");if(128&r[0])throw new e("Invalid signature integer: negative");if(0===r[0]&&!(128&r[1]))throw new e("Invalid signature integer: unnecessary leading zero");return{d:HC(r),l:t.subarray(n+2)}},toSig(t){const{Err:e}=ZC,n="string"==typeof t?GC(t):t;if(!(n instanceof Uint8Array))throw new Error("ui8a expected");let r=n.length;if(r<2||48!=n[0])throw new e("Invalid signature tag");if(n[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:i,l:s}=ZC._parseInt(n.subarray(2)),{d:o,l:a}=ZC._parseInt(s);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s:o}},hexFromSig(t){const e=t=>8&Number.parseInt(t[0],16)?"00"+t:t,n=t=>{const e=t.toString(16);return 1&e.length?`0${e}`:e},r=e(n(t.s)),i=e(n(t.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),YC=BigInt(1),XC=BigInt(3);var JC=class extends qx{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");Nx(t.outputLen),Nx(t.blockLen)}(t);const n=$x(e);if(this.iHash=t.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?t.create().update(n).digest():n);for(let s=0;s<i.length;s++)i[s]^=54;this.iHash.update(i),this.oHash=t.create();for(let s=0;s<i.length;s++)i[s]^=106;this.oHash.update(i),i.fill(0)}update(t){return zx(this),this.iHash.update(t),this}digestInto(t){zx(this),Fx(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:n,finished:r,destroyed:i,blockLen:s,outputLen:o}=this;return t.finished=r,t.destroyed=i,t.blockLen=s,t.outputLen=o,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},QC=(t,e,n)=>new JC(t,e).update(n).digest();function tS(t){return{hash:t,hmac:(e,...n)=>QC(t,e,function(...t){const e=new Uint8Array(t.reduce((t,e)=>t+e.length,0));let n=0;return t.forEach(t=>{if(!jx(t))throw new Error("Uint8Array expected");e.set(t,n),n+=t.length}),e}(...n)),randomBytes:Wx}}QC.create=(t,e)=>new JC(t,e);var eS=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),nS=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),rS=BigInt(1),iS=BigInt(2),sS=(t,e)=>(t+e/iS)/e;function oS(t){const e=eS,n=BigInt(3),r=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),l=BigInt(88),c=t*t*t%e,u=c*c*t%e,h=zC(u,n,e)*u%e,d=zC(h,n,e)*u%e,p=zC(d,iS,e)*c%e,f=zC(p,i,e)*p%e,g=zC(f,s,e)*f%e,m=zC(g,a,e)*g%e,y=zC(m,l,e)*m%e,v=zC(y,a,e)*g%e,b=zC(v,n,e)*u%e,w=zC(b,o,e)*f%e,_=zC(w,r,e)*c%e,x=zC(_,iS,e);if(!aS.eql(aS.sqr(x),t))throw new Error("Cannot find square root");return x}var aS=function(t,e,n=!1,r={}){if(t<=TC)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:s}=UC(t,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=function(t){if(t%MC===PC){const e=(t+LC)/MC;return function(t,n){const r=t.pow(n,e);if(!t.eql(t.sqr(r),n))throw new Error("Cannot find square root");return r}}if(t%OC===AC){const e=(t-AC)/OC;return function(t,n){const r=t.mul(n,IC),i=t.pow(r,e),s=t.mul(n,i),o=t.mul(t.mul(s,IC),i),a=t.mul(s,t.sub(o,t.ONE));if(!t.eql(t.sqr(a),n))throw new Error("Cannot find square root");return a}}return function(t){const e=(t-LC)/IC;let n,r,i;for(n=t-LC,r=0;n%IC===TC;n/=IC,r++);for(i=IC;i<t&&FC(i,e,t)!==t-LC;i++);if(1===r){const e=(t+LC)/MC;return function(t,n){const r=t.pow(n,e);if(!t.eql(t.sqr(r),n))throw new Error("Cannot find square root");return r}}const s=(n+LC)/IC;return function(t,o){if(t.pow(o,e)===t.neg(t.ONE))throw new Error("Cannot find square root");let a=r,l=t.pow(t.mul(t.ONE,i),n),c=t.pow(o,s),u=t.pow(o,n);for(;!t.eql(u,t.ONE);){if(t.eql(u,t.ZERO))return t.ZERO;let e=1;for(let r=t.sqr(u);e<a&&!t.eql(r,t.ONE);e++)r=t.sqr(r);const n=t.pow(l,LC<<BigInt(a-e-1));l=t.sqr(n),c=t.mul(c,n),u=t.mul(u,l),a=e}return c}}(t)}(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:s,MASK:xC(i),ZERO:TC,ONE:LC,create:e=>NC(e,t),isValid:e=>{if("bigint"!=typeof e)throw new Error("Invalid field element: expected bigint, got "+typeof e);return TC<=e&&e<t},is0:t=>t===TC,isOdd:t=>(t&LC)===LC,neg:e=>NC(-e,t),eql:(t,e)=>t===e,sqr:e=>NC(e*e,t),add:(e,n)=>NC(e+n,t),sub:(e,n)=>NC(e-n,t),mul:(e,n)=>NC(e*n,t),pow:(t,e)=>function(t,e,n){if(n<TC)throw new Error("Expected power > 0");if(n===TC)return t.ONE;if(n===LC)return e;let r=t.ONE,i=e;for(;n>TC;)n&LC&&(r=t.mul(r,i)),i=t.sqr(i),n>>=LC;return r}(a,t,e),div:(e,n)=>NC(e*DC(n,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>DC(e,t),sqrt:r.sqrt||(t=>o(a,t)),invertBatch:t=>function(t,e){const n=new Array(e.length),r=e.reduce((e,r,i)=>t.is0(r)?e:(n[i]=e,t.mul(e,r)),t.ONE),i=t.inv(r);return e.reduceRight((e,r,i)=>t.is0(r)?e:(n[i]=t.mul(e,n[i]),t.mul(e,r)),i),n}(a,t),cmov:(t,e,n)=>n?e:t,toBytes:t=>n?pC(t,s):dC(t,s),fromBytes:t=>{if(t.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${t.length}`);return n?hC(t):uC(t)}});return Object.freeze(a)}(eS,void 0,void 0,{sqrt:oS}),lS=function(t,e){const n=e=>function(t){const e=function(t){const e=WC(t);return RC(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}(t),{Fp:n,n:r}=e,i=n.BYTES+1,s=2*n.BYTES+1;function o(t){return NC(t,r)}function a(t){return DC(t,r)}const{ProjectivePoint:l,normPrivateKeyToScalar:c,weierstrassEquation:u,isWithinCurveOrder:h}=function(t){const e=function(t){const e=WC(t);RC(e,{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}=e;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({...e})}(t),{Fp:n}=e,r=e.toBytes||((t,e)=>{const r=e.toAffine();return mC(Uint8Array.from([4]),n.toBytes(r.x),n.toBytes(r.y))}),i=e.fromBytes||(t=>{const e=t.subarray(1);return{x:n.fromBytes(e.subarray(0,n.BYTES)),y:n.fromBytes(e.subarray(n.BYTES,2*n.BYTES))}});function s(t){const{a:r,b:i}=e,s=n.sqr(t),o=n.mul(s,t);return n.add(n.add(o,n.mul(t,r)),i)}if(!n.eql(n.sqr(e.Gy),s(e.Gx)))throw new Error("bad generator point: equation left != right");function o(t){return"bigint"==typeof t&&KC<t&&t<e.n}function a(t){if(!o(t))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function l(t){const{allowedPrivateKeyLengths:n,nByteLength:r,wrapPrivateKey:i,n:s}=e;if(n&&"bigint"!=typeof t){if(t instanceof Uint8Array&&(t=oC(t)),"string"!=typeof t||!n.includes(t.length))throw new Error("Invalid key");t=t.padStart(2*r,"0")}let o;try{o="bigint"==typeof t?t:uC(gC("private key",t,r))}catch(d8){throw new Error(`private key must be ${r} bytes, hex or bigint, not ${typeof t}`)}return i&&(o=NC(o,s)),a(o),o}const c=new Map;function u(t){if(!(t instanceof h))throw new Error("ProjectivePoint expected")}class h{constructor(t,e,r){if(this.px=t,this.py=e,this.pz=r,null==t||!n.isValid(t))throw new Error("x required");if(null==e||!n.isValid(e))throw new Error("y required");if(null==r||!n.isValid(r))throw new Error("z required")}static fromAffine(t){const{x:e,y:r}=t||{};if(!t||!n.isValid(e)||!n.isValid(r))throw new Error("invalid affine point");if(t instanceof h)throw new Error("projective point not allowed");const i=t=>n.eql(t,n.ZERO);return i(e)&&i(r)?h.ZERO:new h(e,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(t){const e=n.invertBatch(t.map(t=>t.pz));return t.map((t,n)=>t.toAffine(e[n])).map(h.fromAffine)}static fromHex(t){const e=h.fromAffine(i(gC("pointHex",t)));return e.assertValidity(),e}static fromPrivateKey(t){return h.BASE.multiply(l(t))}_setWindowSize(t){this._WINDOW_SIZE=t,c.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:t,y:r}=this.toAffine();if(!n.isValid(t)||!n.isValid(r))throw new Error("bad point: x or y not FE");const i=n.sqr(r),o=s(t);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:t}=this.toAffine();if(n.isOdd)return!n.isOdd(t);throw new Error("Field doesn't support isOdd")}equals(t){u(t);const{px:e,py:r,pz:i}=this,{px:s,py:o,pz:a}=t,l=n.eql(n.mul(e,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:t,b:r}=e,i=n.mul(r,XC),{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(t,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(t,f),g=n.sub(d,f),g=n.mul(t,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(t){u(t);const{px:r,py:i,pz:s}=this,{px:o,py:a,pz:l}=t;let c=n.ZERO,d=n.ZERO,p=n.ZERO;const f=e.a,g=n.mul(e.b,XC);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(t){return this.add(t.negate())}is0(){return this.equals(h.ZERO)}wNAF(t){return p.wNAFCached(this,c,t,t=>{const e=n.invertBatch(t.map(t=>t.pz));return t.map((t,n)=>t.toAffine(e[n])).map(h.fromAffine)})}multiplyUnsafe(t){const r=h.ZERO;if(t===KC)return r;if(a(t),t===YC)return this;const{endo:i}=e;if(!i)return p.unsafeLadder(this,t);let{k1neg:s,k1:o,k2neg:l,k2:c}=i.splitScalar(t),u=r,d=r,f=this;for(;o>KC||c>KC;)o&YC&&(u=u.add(f)),c&YC&&(d=d.add(f)),f=f.double(),o>>=YC,c>>=YC;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(t){a(t);let r,i,s=t;const{endo:o}=e;if(o){const{k1neg:t,k1:e,k2neg:a,k2:l}=o.splitScalar(s);let{p:c,f:u}=this.wNAF(e),{p:d,f:f}=this.wNAF(l);c=p.constTimeNegate(t,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:t,f:e}=this.wNAF(s);r=t,i=e}return h.normalizeZ([r,i])[0]}multiplyAndAddUnsafe(t,e,n){const r=h.BASE,i=(t,e)=>e!==KC&&e!==YC&&t.equals(r)?t.multiply(e):t.multiplyUnsafe(e),s=i(this,e).add(i(t,n));return s.is0()?void 0:s}toAffine(t){const{px:e,py:r,pz:i}=this,s=this.is0();null==t&&(t=s?n.ONE:n.inv(i));const o=n.mul(e,t),a=n.mul(r,t),l=n.mul(i,t);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:t,isTorsionFree:n}=e;if(t===YC)return!0;if(n)return n(h,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:t,clearCofactor:n}=e;return t===YC?this:n?n(h,this):this.multiplyUnsafe(e.h)}toRawBytes(t=!0){return this.assertValidity(),r(h,this,t)}toHex(t=!0){return oC(this.toRawBytes(t))}}h.BASE=new h(e.Gx,e.Gy,n.ONE),h.ZERO=new h(n.ZERO,n.ONE,n.ZERO);const d=e.nBitLength,p=function(t,e){const n=(t,e)=>{const n=e.negate();return t?n:e},r=t=>({windows:Math.ceil(e/t)+1,windowSize:2**(t-1)});return{constTimeNegate:n,unsafeLadder(e,n){let r=t.ZERO,i=e;for(;n>qC;)n&VC&&(r=r.add(i)),i=i.double(),n>>=VC;return r},precomputeWindow(t,e){const{windows:n,windowSize:i}=r(e),s=[];let o=t,a=o;for(let r=0;r<n;r++){a=o,s.push(a);for(let t=1;t<i;t++)a=a.add(o),s.push(a);o=a.double()}return s},wNAF(e,i,s){const{windows:o,windowSize:a}=r(e);let l=t.ZERO,c=t.BASE;const u=BigInt(2**e-1),h=2**e,d=BigInt(e);for(let t=0;t<o;t++){const e=t*a;let r=Number(s&u);s>>=d,r>a&&(r-=h,s+=VC);const o=e,p=e+Math.abs(r)-1,f=t%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(t,e,n,r){const i=t._WINDOW_SIZE||1;let s=e.get(t);return s||(s=this.precomputeWindow(t,i),1!==i&&e.set(t,r(s))),this.wNAF(i,s,n)}}}(h,e.endo?Math.ceil(d/2):d);return{CURVE:e,ProjectivePoint:h,normPrivateKeyToScalar:l,weierstrassEquation:s,isWithinCurveOrder:o}}({...e,toBytes(t,e,r){const i=e.toAffine(),s=n.toBytes(i.x),o=mC;return r?o(Uint8Array.from([e.hasEvenY()?2:3]),s):o(Uint8Array.from([4]),s,n.toBytes(i.y))},fromBytes(t){const e=t.length,r=t[0],o=t.subarray(1);if(e!==i||2!==r&&3!==r){if(e===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 ${e} was invalid. Expected ${i} compressed bytes or ${s} uncompressed bytes`)}{const t=uC(o);if(!(KC<(a=t)&&a<n.ORDER))throw new Error("Point is not on curve");const e=u(t);let i=n.sqrt(e);return!(1&~r)!=((i&YC)===YC)&&(i=n.neg(i)),{x:t,y:i}}var a}}),d=t=>oC(dC(t,e.nByteLength));function p(t){return t>r>>YC}const f=(t,e,n)=>uC(t.slice(e,n));class g{constructor(t,e,n){this.r=t,this.s=e,this.recovery=n,this.assertValidity()}static fromCompact(t){const n=e.nByteLength;return t=gC("compactSignature",t,2*n),new g(f(t,0,n),f(t,n,2*n))}static fromDER(t){const{r:e,s:n}=ZC.toSig(gC("DER",t));return new g(e,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(t){return new g(this.r,this.s,t)}recoverPublicKey(t){const{r:r,s:i,recovery:s}=this,c=b(gC("msgHash",t));if(null==s||![0,1,2,3].includes(s))throw new Error("recovery id invalid");const u=2===s||3===s?r+e.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 cC(this.toDERHex())}toDERHex(){return ZC.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return cC(this.toCompactHex())}toCompactHex(){return d(this.r)+d(this.s)}}const m={isValidPrivateKey(t){try{return c(t),!0}catch(d8){return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const t=$C(e.n);return function(t,e,n=!1){const r=t.length,i=BC(e),s=$C(e);if(r<16||r<s||r>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${r}`);const o=NC(n?uC(t):hC(t),e-LC)+LC;return n?pC(o,i):dC(o,i)}(e.randomBytes(t),e.n)},precompute:(t=8,e=l.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)};function y(t){const e=t instanceof Uint8Array,n="string"==typeof t,r=(e||n)&&t.length;return e?r===i||r===s:n?r===2*i||r===2*s:t instanceof l}const v=e.bits2int||function(t){const n=uC(t),r=8*t.length-e.nBitLength;return r>0?n>>BigInt(r):n},b=e.bits2int_modN||function(t){return o(v(t))},w=xC(e.nBitLength);function _(t){if("bigint"!=typeof t)throw new Error("bigint expected");if(!(KC<=t&&t<w))throw new Error(`bigint expected < 2^${e.nBitLength}`);return dC(t,e.nByteLength)}const x={lowS:e.lowS,prehash:!1},C={lowS:e.lowS,prehash:!1};return l.BASE._setWindowSize(8),{CURVE:e,getPublicKey:function(t,e=!0){return l.fromPrivateKey(t).toRawBytes(e)},getSharedSecret:function(t,e,n=!0){if(y(t))throw new Error("first arg must be private key");if(!y(e))throw new Error("second arg must be public key");return l.fromHex(e).multiply(c(t)).toRawBytes(n)},sign:function(t,r,i=x){const{seed:s,k2sig:u}=function(t,r,i=x){if(["recovered","canonical"].some(t=>t in i))throw new Error("sign() legacy options not supported");const{hash:s,randomBytes:u}=e;let{lowS:d,prehash:f,extraEntropy:m}=i;null==d&&(d=!0),t=gC("msgHash",t),f&&(t=gC("prehashed msgHash",s(t)));const y=b(t),w=c(r),C=[_(w),_(y)];if(null!=m){const t=!0===m?u(n.BYTES):m;C.push(gC("extraEntropy",t))}const S=mC(...C),k=y;return{seed:S,k2sig:function(t){const e=v(t);if(!h(e))return;const n=a(e),r=l.BASE.multiply(e).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&YC),u=s;return d&&p(s)&&(u=function(t){return p(t)?o(-t):t}(s),c^=1),new g(i,u,c)}}}(t,r,i),d=e;return kC(d.hash.outputLen,d.nByteLength,d.hmac)(s,u)},verify:function(t,n,r,i=C){const s=t;if(n=gC("msgHash",n),r=gC("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 ZC.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:t,s:e}=s;h=new g(t,e)}}d=l.fromHex(r)}catch(d8){if("PARSE"===d8.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(c&&h.hasHighS())return!1;u&&(n=e.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}}({...t,...tS(e)});return Object.freeze({...n(e),create:n})}({a:BigInt(0),b:BigInt(7),Fp:aS,n:nS,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=nS,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-rS*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,o=BigInt("0x100000000000000000000000000000000"),a=sS(s*t,e),l=sS(-r*t,e);let c=NC(t-a*n-l*i,e),u=NC(-a*r-l*s,e);const h=c>o,d=u>o;if(h&&(c=e-c),d&&(u=e-u),c>o||u>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:h,k1:c,k2neg:d,k2:u}}}},Qx),cS=BigInt(0),uS=t=>"bigint"==typeof t&&cS<t&&t<eS,hS={};function dS(t,...e){let n=hS[t];if(void 0===n){const e=Qx(Uint8Array.from(t,t=>t.charCodeAt(0)));n=mC(e,e),hS[t]=n}return Qx(mC(n,...e))}var pS=t=>t.toRawBytes(!0).slice(1),fS=t=>dC(t,32),gS=t=>NC(t,eS),mS=t=>NC(t,nS),yS=lS.ProjectivePoint;function vS(t){let e=lS.utils.normPrivateKeyToScalar(t),n=yS.fromPrivateKey(e);return{scalar:n.hasEvenY()?e:mS(-e),bytes:pS(n)}}function bS(t){if(!uS(t))throw new Error("bad x: need 0 < x < p");const e=gS(t*t);let n=oS(gS(e*t+BigInt(7)));n%iS!==cS&&(n=gS(-n));const r=new yS(t,n,rS);return r.assertValidity(),r}function wS(...t){return mS(uC(dS("BIP0340/challenge",...t)))}function _S(t){return vS(t).bytes}function xS(t,e,n=Wx(32)){const r=gC("message",t),{bytes:i,scalar:s}=vS(e),o=gC("auxRand",n,32),a=dS("BIP0340/nonce",fS(s^uC(dS("BIP0340/aux",o))),i,r),l=mS(uC(a));if(l===cS)throw new Error("sign failed: k is zero");const{bytes:c,scalar:u}=vS(l),h=wS(c,i,r),d=new Uint8Array(64);if(d.set(c,0),d.set(fS(mS(u+h*s)),32),!CS(d,r,i))throw new Error("sign: Invalid signature produced");return d}function CS(t,e,n){const r=gC("signature",t,64),i=gC("message",e),s=gC("publicKey",n,32);try{const t=bS(uC(s)),e=uC(r.subarray(0,32));if(!uS(e))return!1;const n=uC(r.subarray(32,64));if(!(t=>"bigint"==typeof t&&cS<t&&t<nS)(n))return!1;const c=wS(fS(e),pS(t),i),u=(o=t,a=n,l=mS(-c),yS.BASE.multiplyAndAddUnsafe(o,a,l));return!(!u||!u.hasEvenY()||u.toAffine().x!==e)}catch(d8){return!1}var o,a,l}var SS=(()=>({getPublicKey:_S,sign:xS,verify:CS,utils:{randomPrivateKey:lS.utils.randomPrivateKey,lift_x:bS,pointToBytes:pS,numberToBytesBE:dC,bytesToNumberBE:uC,taggedHash:dS,mod:NC}}))(),kS="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,ES=t=>t instanceof Uint8Array,RS=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),TS=(t,e)=>t<<32-e|t>>>e;if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");var LS=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function IS(t){if(!ES(t))throw new Error("Uint8Array expected");let e="";for(let n=0;n<t.length;n++)e+=LS[t[n]];return e}function PS(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);const e=t.length;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(e/2);for(let r=0;r<n.length;r++){const e=2*r,i=t.slice(e,e+2),s=Number.parseInt(i,16);if(Number.isNaN(s)||s<0)throw new Error("Invalid byte sequence");n[r]=s}return n}function MS(t){if("string"==typeof t&&(t=function(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}(t)),!ES(t))throw new Error("expected Uint8Array, got "+typeof t);return t}function AS(...t){const e=new Uint8Array(t.reduce((t,e)=>t+e.length,0));let n=0;return t.forEach(t=>{if(!ES(t))throw new Error("Uint8Array expected");e.set(t,n),n+=t.length}),e}var OS=class{clone(){return this._cloneInto()}};function NS(t){const e=e=>t().update(MS(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function FS(t=32){if(kS&&"function"==typeof kS.getRandomValues)return kS.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}function zS(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function DS(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}var jS,US,BS,$S,qS,VS,WS,HS,GS,ZS,KS,YS,XS,JS,QS,tk,ek,nk,rk,ik,sk,ok,ak,lk,ck,uk,hk,dk,pk={number:zS,bool:function(t){if("boolean"!=typeof t)throw new Error(`Expected boolean, not ${t}`)},bytes:DS,hash:function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");zS(t.outputLen),zS(t.blockLen)},exists:function(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")},output:function(t,e){DS(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}},fk=class extends OS{constructor(t,e,n,r){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=RS(this.buffer)}update(t){pk.exists(this);const{view:e,buffer:n,blockLen:r}=this,i=(t=MS(t)).length;for(let s=0;s<i;){const o=Math.min(r-this.pos,i-s);if(o===r){const e=RS(t);for(;r<=i-s;s+=r)this.process(e,s);continue}n.set(t.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===r&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){pk.exists(this),pk.output(t,this),this.finished=!0;const{buffer:e,view:n,blockLen:r,isLE:i}=this;let{pos:s}=this;e[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++)e[u]=0;!function(t,e,n,r){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,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;t.setUint32(e+l,o,r),t.setUint32(e+c,a,r)}(n,r-8,BigInt(8*this.length),i),this.process(n,0);const o=RS(t),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:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:n,length:r,finished:i,destroyed:s,pos:o}=this;return t.length=r,t.pos=o,t.finished=i,t.destroyed=s,r%e&&t.buffer.set(n),t}},gk=(t,e,n)=>t&e^~t&n,mk=(t,e,n)=>t&e^t&n^e&n,yk=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]),vk=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),bk=new Uint32Array(64),wk=class extends fk{constructor(){super(64,32,8,!1),this.A=0|vk[0],this.B=0|vk[1],this.C=0|vk[2],this.D=0|vk[3],this.E=0|vk[4],this.F=0|vk[5],this.G=0|vk[6],this.H=0|vk[7]}get(){const{A:t,B:e,C:n,D:r,E:i,F:s,G:o,H:a}=this;return[t,e,n,r,i,s,o,a]}set(t,e,n,r,i,s,o,a){this.A=0|t,this.B=0|e,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(t,e){for(let u=0;u<16;u++,e+=4)bk[u]=t.getUint32(e,!1);for(let u=16;u<64;u++){const t=bk[u-15],e=bk[u-2],n=TS(t,7)^TS(t,18)^t>>>3,r=TS(e,17)^TS(e,19)^e>>>10;bk[u]=r+bk[u-7]+n+bk[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 t=c+(TS(o,6)^TS(o,11)^TS(o,25))+gk(o,a,l)+yk[u]+bk[u]|0,e=(TS(n,2)^TS(n,13)^TS(n,22))+mk(n,r,i)|0;c=l,l=a,a=o,o=s+t|0,s=i,i=r,r=n,n=t+e|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(){bk.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},_k=class extends wk{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}},xk=NS(()=>new wk),Ck=(NS(()=>new _k),a({assertNumber:()=>Sk,base16:()=>$S,base32:()=>qS,base32crockford:()=>WS,base32hex:()=>VS,base58:()=>KS,base58check:()=>tk,base58flickr:()=>YS,base58xmr:()=>QS,base58xrp:()=>XS,base64:()=>HS,base64url:()=>GS,bech32:()=>rk,bech32m:()=>ik,bytes:()=>dk,bytesToString:()=>ck,hex:()=>ok,str:()=>uk,stringToBytes:()=>hk,utf8:()=>sk,utils:()=>BS}));function Sk(t){if(!Number.isSafeInteger(t))throw new Error(`Wrong integer: ${t}`)}function kk(...t){const e=(t,e)=>n=>t(e(n));return{encode:Array.from(t).reverse().reduce((t,n)=>t?e(t,n.encode):n.encode,void 0),decode:t.reduce((t,n)=>t?e(t,n.decode):n.decode,void 0)}}function Ek(t){return{encode:e=>{if(!Array.isArray(e)||e.length&&"number"!=typeof e[0])throw new Error("alphabet.encode input should be an array of numbers");return e.map(e=>{if(Sk(e),e<0||e>=t.length)throw new Error(`Digit index outside alphabet: ${e} (alphabet: ${t.length})`);return t[e]})},decode:e=>{if(!Array.isArray(e)||e.length&&"string"!=typeof e[0])throw new Error("alphabet.decode input should be array of strings");return e.map(e=>{if("string"!=typeof e)throw new Error(`alphabet.decode: not string element=${e}`);const n=t.indexOf(e);if(-1===n)throw new Error(`Unknown letter: "${e}". Allowed: ${t}`);return n})}}}function Rk(t=""){if("string"!=typeof t)throw new Error("join separator should be string");return{encode:e=>{if(!Array.isArray(e)||e.length&&"string"!=typeof e[0])throw new Error("join.encode input should be array of strings");for(let t of e)if("string"!=typeof t)throw new Error(`join.encode: non-string input=${t}`);return e.join(t)},decode:e=>{if("string"!=typeof e)throw new Error("join.decode input should be string");return e.split(t)}}}function Tk(t,e="="){if(Sk(t),"string"!=typeof e)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 t of n)if("string"!=typeof t)throw new Error(`padding.encode: non-string input=${t}`);for(;n.length*t%8;)n.push(e);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 t of n)if("string"!=typeof t)throw new Error(`padding.decode: non-string input=${t}`);let r=n.length;if(r*t%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;r>0&&n[r-1]===e;r--)if(!((r-1)*t%8))throw new Error("Invalid padding: string has too much padding");return n.slice(0,r)}}}function Lk(t){if("function"!=typeof t)throw new Error("normalize fn should be function");return{encode:t=>t,decode:e=>t(e)}}function Ik(t,e,n){if(e<2)throw new Error(`convertRadix: wrong from=${e}, 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(t))throw new Error("convertRadix: data should be array");if(!t.length)return[];let r=0;const i=[],s=Array.from(t);for(s.forEach(t=>{if(Sk(t),t<0||t>=e)throw new Error(`Wrong integer: ${t}`)});;){let t=0,o=!0;for(let i=r;i<s.length;i++){const a=s[i],l=e*t+a;if(!Number.isSafeInteger(l)||e*t/e!==t||l-a!==e*t)throw new Error("convertRadix: carry overflow");if(t=l%n,s[i]=Math.floor(l/n),!Number.isSafeInteger(s[i])||s[i]*n+t!==l)throw new Error("convertRadix: carry overflow");o&&(s[i]?o=!1:r=i)}if(i.push(t),o)break}for(let o=0;o<t.length-1&&0===t[o];o++)i.push(0);return i.reverse()}function Pk(t,e,n,r){if(!Array.isArray(t))throw new Error("convertRadix2: data should be array");if(e<=0||e>32)throw new Error(`convertRadix2: wrong from=${e}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(US(e,n)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${n} carryBits=${US(e,n)}`);let i=0,s=0;const o=2**n-1,a=[];for(const l of t){if(Sk(l),l>=2**e)throw new Error(`convertRadix2: invalid data word=${l} from=${e}`);if(i=i<<e|l,s+e>32)throw new Error(`convertRadix2: carry overflow pos=${s} from=${e}`);for(s+=e;s>=n;s-=n)a.push((i>>s-n&o)>>>0);i&=2**s-1}if(i=i<<n-s&o,!r&&s>=e)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 Mk(t){return Sk(t),{encode:e=>{if(!(e instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return Ik(Array.from(e),256,t)},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(Ik(e,t,256))}}}function Ak(t,e=!1){if(Sk(t),t<=0||t>32)throw new Error("radix2: bits should be in (0..32]");if(US(8,t)>32||US(t,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 Pk(Array.from(n),8,t,!e)},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(Pk(n,t,8,e))}}}function Ok(t){if("function"!=typeof t)throw new Error("unsafeWrapper fn should be function");return function(...e){try{return t.apply(null,e)}catch(n){}}}function Nk(t,e){if(Sk(t),"function"!=typeof e)throw new Error("checksum fn should be function");return{encode(n){if(!(n instanceof Uint8Array))throw new Error("checksum.encode: input should be Uint8Array");const r=e(n).slice(0,t),i=new Uint8Array(n.length+t);return i.set(n),i.set(r,n.length),i},decode(n){if(!(n instanceof Uint8Array))throw new Error("checksum.decode: input should be Uint8Array");const r=n.slice(0,-t),i=e(r).slice(0,t),s=n.slice(-t);for(let e=0;e<t;e++)if(i[e]!==s[e])throw new Error("Invalid checksum");return r}}}function Fk(t){const e=t>>25;let n=(33554431&t)<<5;for(let r=0;r<nk.length;r++)1==(e>>r&1)&&(n^=nk[r]);return n}function zk(t,e,n=1){const r=t.length;let i=1;for(let s=0;s<r;s++){const e=t.charCodeAt(s);if(e<33||e>126)throw new Error(`Invalid prefix (${t})`);i=Fk(i)^e>>5}i=Fk(i);for(let s=0;s<r;s++)i=Fk(i)^31&t.charCodeAt(s);for(let s of e)i=Fk(i)^s;for(let s=0;s<6;s++)i=Fk(i);return i^=n,ek.encode(Pk([i%2**30],30,5,!1))}function Dk(t){const e="bech32"===t?1:734539939,n=Ak(5),r=n.decode,i=n.encode,s=Ok(r);function o(t,n=90){if("string"!=typeof t)throw new Error("bech32.decode input should be string, not "+typeof t);if(t.length<8||!1!==n&&t.length>n)throw new TypeError(`Wrong string length: ${t.length} (${t}). Expected (8..${n})`);const r=t.toLowerCase();if(t!==r&&t!==t.toUpperCase())throw new Error("String must be lowercase or uppercase");const i=(t=r).lastIndexOf("1");if(0===i||-1===i)throw new Error('Letter "1" must be present between prefix and data only');const s=t.slice(0,i),o=t.slice(i+1);if(o.length<6)throw new Error("Data must be at least 6 characters long");const a=ek.decode(o).slice(0,-6),l=zk(s,a,e);if(!o.endsWith(l))throw new Error(`Invalid checksum in ${t}: expected "${l}"`);return{prefix:s,words:a}}return{encode:function(t,n,r=90){if("string"!=typeof t)throw new Error("bech32.encode prefix should be string, not "+typeof t);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=t.length+7+n.length;if(!1!==r&&i>r)throw new TypeError(`Length ${i} exceeds limit ${r}`);return`${t=t.toLowerCase()}1${ek.encode(n)}${zk(t,n,e)}`},decode:o,decodeToBytes:function(t){const{prefix:e,words:n}=o(t,!1);return{prefix:e,words:n,bytes:r(n)}},decodeUnsafe:Ok(o),fromWords:r,fromWordsUnsafe:s,toWords:i}}var jk=((t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(r){throw n=[r],r}})(()=>{jS=(t,e)=>e?jS(e,t%e):t,US=(t,e)=>t+(e-jS(t,e)),BS={alphabet:Ek,chain:kk,checksum:Nk,radix:Mk,radix2:Ak,join:Rk,padding:Tk},$S=kk(Ak(4),Ek("0123456789ABCDEF"),Rk("")),qS=kk(Ak(5),Ek("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),Tk(5),Rk("")),VS=kk(Ak(5),Ek("0123456789ABCDEFGHIJKLMNOPQRSTUV"),Tk(5),Rk("")),WS=kk(Ak(5),Ek("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),Rk(""),Lk(t=>t.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),HS=kk(Ak(6),Ek("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Tk(6),Rk("")),GS=kk(Ak(6),Ek("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),Tk(6),Rk("")),KS=(ZS=t=>kk(Mk(58),Ek(t),Rk("")))("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),YS=ZS("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),XS=ZS("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"),JS=[0,2,3,5,6,7,9,10,11],QS={encode(t){let e="";for(let n=0;n<t.length;n+=8){const r=t.subarray(n,n+8);e+=KS.encode(r).padStart(JS[r.length],"1")}return e},decode(t){let e=[];for(let n=0;n<t.length;n+=11){const r=t.slice(n,n+11),i=JS.indexOf(r.length),s=KS.decode(r);for(let t=0;t<s.length-i;t++)if(0!==s[t])throw new Error("base58xmr: wrong padding");e=e.concat(Array.from(s.slice(s.length-i)))}return Uint8Array.from(e)}},tk=t=>kk(Nk(4,e=>t(t(e))),KS),ek=kk(Ek("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),Rk("")),nk=[996825010,642813549,513874426,1027748829,705979059],rk=Dk("bech32"),ik=Dk("bech32m"),sk={encode:t=>(new TextDecoder).decode(t),decode:t=>(new TextEncoder).encode(t)},ok=kk(Ak(4),Ek("0123456789abcdef"),Rk(""),Lk(t=>{if("string"!=typeof t||t.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof t} with length ${t.length}`);return t.toLowerCase()})),ak={utf8:sk,hex:ok,base16:$S,base32:qS,base64:HS,base64url:GS,base58:KS,base58xmr:QS},lk=`Invalid encoding type. Available types: ${Object.keys(ak).join(", ")}`,ck=(t,e)=>{if("string"!=typeof t||!ak.hasOwnProperty(t))throw new TypeError(lk);if(!(e instanceof Uint8Array))throw new TypeError("bytesToString() expects Uint8Array");return ak[t].encode(e)},uk=ck,hk=(t,e)=>{if(!ak.hasOwnProperty(t))throw new TypeError(lk);if("string"!=typeof e)throw new TypeError("stringToBytes() expects string");return ak[t].decode(e)},dk=hk});function Uk(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`positive integer expected, not ${t}`)}function Bk(t){if("boolean"!=typeof t)throw new Error(`boolean expected, not ${t}`)}function $k(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}function qk(t,...e){if(!$k(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function Vk(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Wk(t,e){qk(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}jk();var Hk=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Gk=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),Zk=t=>new DataView(t.buffer,t.byteOffset,t.byteLength);if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");var Kk=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Yk(t){qk(t);let e="";for(let n=0;n<t.length;n++)e+=Kk[t[n]];return e}function Xk(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:void 0}function Jk(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);const e=t.length,n=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let i=0,s=0;i<n;i++,s+=2){const e=Xk(t.charCodeAt(s)),n=Xk(t.charCodeAt(s+1));if(void 0===e||void 0===n){const e=t[s]+t[s+1];throw new Error('hex string expected, got non-hex character "'+e+'" at index '+s)}r[i]=16*e+n}return r}function Qk(t){if("string"==typeof t)t=function(t){if("string"!=typeof t)throw new Error("string expected, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}(t);else{if(!$k(t))throw new Error("Uint8Array expected, got "+typeof t);t=t.slice()}return t}function tE(t,e){if(t.length!==e.length)return!1;let n=0;for(let r=0;r<t.length;r++)n|=t[r]^e[r];return 0===n}var eE=(t,e)=>(Object.assign(e,t),e);function nE(t,e,n,r){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,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;t.setUint32(e+l,o,r),t.setUint32(e+c,a,r)}var rE=16,iE=new Uint8Array(16),sE=Gk(iE),oE=(t,e,n,r)=>({s3:n<<31|r>>>1,s2:e<<31|n>>>1,s1:t<<31|e>>>1,s0:t>>>1^225<<24&-(1&r)}),aE=t=>(t>>>0&255)<<24|(t>>>8&255)<<16|(t>>>16&255)<<8|t>>>24&255,lE=class{constructor(t,e){this.blockLen=rE,this.outputLen=rE,this.s0=0,this.s1=0,this.s2=0,this.s3=0,this.finished=!1,qk(t=Qk(t),16);const n=Zk(t);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:aE(r),s1:aE(i),s2:aE(s),s3:aE(o)}),({s0:r,s1:i,s2:s,s3:o}=oE(r,i,s,o));const l=(t=>t>65536?8:t>1024?4:2)(e||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 t=0;t<u;t++){let e=0,n=0,r=0,i=0;for(let s=0;s<l;s++){if(!(t>>>l-s-1&1))continue;const{s0:o,s1:c,s2:u,s3:h}=a[l*d+s];e^=o,n^=c,r^=u,i^=h}h.push({s0:e,s1:n,s2:r,s3:i})}this.t=h}_updateBlock(t,e,n,r){t^=this.s0,e^=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[t,e,n,r])for(let t=0;t<4;t++){const e=p>>>8*t&255;for(let t=8/i-1;t>=0;t--){const n=e>>>i*t&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(t){t=Qk(t),Vk(this);const e=Gk(t),n=Math.floor(t.length/rE),r=t.length%rE;for(let i=0;i<n;i++)this._updateBlock(e[4*i+0],e[4*i+1],e[4*i+2],e[4*i+3]);return r&&(iE.set(t.subarray(n*rE)),this._updateBlock(sE[0],sE[1],sE[2],sE[3]),sE.fill(0)),this}destroy(){const{t:t}=this;for(const e of t)e.s0=0,e.s1=0,e.s2=0,e.s3=0}digestInto(t){Vk(this),Wk(t,this),this.finished=!0;const{s0:e,s1:n,s2:r,s3:i}=this,s=Gk(t);return s[0]=e,s[1]=n,s[2]=r,s[3]=i,t}digest(){const t=new Uint8Array(rE);return this.digestInto(t),this.destroy(),t}},cE=class extends lE{constructor(t,e){const n=function(t){t.reverse();const e=1&t[15];let n=0;for(let r=0;r<t.length;r++){const e=t[r];t[r]=e>>>1|n,n=(1&e)<<7}return t[0]^=225&-e,t}((t=Qk(t)).slice());super(n,e),n.fill(0)}update(t){t=Qk(t),Vk(this);const e=Gk(t),n=t.length%rE,r=Math.floor(t.length/rE);for(let i=0;i<r;i++)this._updateBlock(aE(e[4*i+3]),aE(e[4*i+2]),aE(e[4*i+1]),aE(e[4*i+0]));return n&&(iE.set(t.subarray(r*rE)),this._updateBlock(aE(sE[3]),aE(sE[2]),aE(sE[1]),aE(sE[0])),sE.fill(0)),this}digestInto(t){Vk(this),Wk(t,this),this.finished=!0;const{s0:e,s1:n,s2:r,s3:i}=this,s=Gk(t);return s[0]=e,s[1]=n,s[2]=r,s[3]=i,t.reverse()}};function uE(t){const e=(e,n)=>t(n,e.length).update(Qk(e)).digest(),n=t(new Uint8Array(16),0);return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=(e,n)=>t(e,n),e}var hE=uE((t,e)=>new lE(t,e)),dE=uE((t,e)=>new cE(t,e)),pE=16,fE=new Uint8Array(pE);function gE(t){return t<<1^283&-(t>>7)}function mE(t,e){let n=0;for(;e>0;e>>=1)n^=t&-(1&e),t=gE(t);return n}var yE=(()=>{let t=new Uint8Array(256);for(let n=0,r=1;n<256;n++,r^=gE(r))t[n]=r;const e=new Uint8Array(256);e[0]=99;for(let n=0;n<255;n++){let r=t[255-n];r|=r<<8,e[t[n]]=255&(r^r>>4^r>>5^r>>6^r>>7^99)}return e})(),vE=yE.map((t,e)=>yE.indexOf(e)),bE=t=>t<<24|t>>>8,wE=t=>t<<8|t>>>24;function _E(t,e){if(256!==t.length)throw new Error("Wrong sbox length");const n=new Uint32Array(256).map((n,r)=>e(t[r])),r=n.map(wE),i=r.map(wE),s=i.map(wE),o=new Uint32Array(65536),a=new Uint32Array(65536),l=new Uint16Array(65536);for(let c=0;c<256;c++)for(let e=0;e<256;e++){const u=256*c+e;o[u]=n[c]^r[e],a[u]=i[c]^s[e],l[u]=t[c]<<8|t[e]}return{sbox:t,sbox2:l,T0:n,T1:r,T2:i,T3:s,T01:o,T23:a}}var xE=_E(yE,t=>mE(t,3)<<24|t<<16|t<<8|mE(t,2)),CE=_E(vE,t=>mE(t,11)<<24|mE(t,13)<<16|mE(t,9)<<8|mE(t,14)),SE=(()=>{const t=new Uint8Array(16);for(let e=0,n=1;e<16;e++,n=gE(n))t[e]=n;return t})();function kE(t){qk(t);const e=t.length;if(![16,24,32].includes(e))throw new Error(`aes: wrong key size: should be 16, 24 or 32, got: ${e}`);const{sbox2:n}=xE,r=Gk(t),i=r.length,s=t=>TE(n,t,t,t,t),o=new Uint32Array(e+28);o.set(r);for(let a=i;a<o.length;a++){let t=o[a-1];a%i===0?t=s(bE(t))^SE[a/i-1]:i>6&&a%i===4&&(t=s(t)),o[a]=o[a-i]^t}return o}function EE(t){const e=kE(t),n=e.slice(),r=e.length,{sbox2:i}=xE,{T0:s,T1:o,T2:a,T3:l}=CE;for(let c=0;c<r;c+=4)for(let t=0;t<4;t++)n[c+t]=e[r-c-4+t];e.fill(0);for(let c=4;c<r-4;c++){const t=n[c],e=TE(i,t,t,t,t);n[c]=s[255&e]^o[e>>>8&255]^a[e>>>16&255]^l[e>>>24]}return n}function RE(t,e,n,r,i,s){return t[n<<8&65280|r>>>8&255]^e[i>>>8&65280|s>>>24&255]}function TE(t,e,n,r,i){return t[255&e|65280&n]|t[r>>>16&255|i>>>16&65280]<<16}function LE(t,e,n,r,i){const{sbox2:s,T01:o,T23:a}=xE;let l=0;e^=t[l++],n^=t[l++],r^=t[l++],i^=t[l++];const c=t.length/4-2;for(let u=0;u<c;u++){const s=t[l++]^RE(o,a,e,n,r,i),c=t[l++]^RE(o,a,n,r,i,e),u=t[l++]^RE(o,a,r,i,e,n),h=t[l++]^RE(o,a,i,e,n,r);e=s,n=c,r=u,i=h}return{s0:t[l++]^TE(s,e,n,r,i),s1:t[l++]^TE(s,n,r,i,e),s2:t[l++]^TE(s,r,i,e,n),s3:t[l++]^TE(s,i,e,n,r)}}function IE(t,e,n,r,i){const{sbox2:s,T01:o,T23:a}=CE;let l=0;e^=t[l++],n^=t[l++],r^=t[l++],i^=t[l++];const c=t.length/4-2;for(let u=0;u<c;u++){const s=t[l++]^RE(o,a,e,i,r,n),c=t[l++]^RE(o,a,n,e,i,r),u=t[l++]^RE(o,a,r,n,e,i),h=t[l++]^RE(o,a,i,r,n,e);e=s,n=c,r=u,i=h}return{s0:t[l++]^TE(s,e,i,r,n),s1:t[l++]^TE(s,n,e,i,r),s2:t[l++]^TE(s,r,n,e,i),s3:t[l++]^TE(s,i,r,n,e)}}function PE(t,e){if(!e)return new Uint8Array(t);if(qk(e),e.length<t)throw new Error(`aes: wrong destination length, expected at least ${t}, got: ${e.length}`);return e}function ME(t,e,n,r,i){qk(n,pE),qk(r),i=PE(r.length,i);const s=n,o=Gk(s),a=Zk(s),l=Gk(r),c=Gk(i),u=e?0:12,h=r.length;let d=a.getUint32(u,e),{s0:p,s1:f,s2:g,s3:m}=LE(t,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,e),({s0:p,s1:f,s2:g,s3:m}=LE(t,o[0],o[1],o[2],o[3]));const y=pE*Math.floor(l.length/4);if(y<h){const t=new Uint32Array([p,f,g,m]),e=Hk(t);for(let n=y,s=0;n<h;n++,s++)i[n]=r[n]^e[s]}return i}function AE(t){if(qk(t),t.length%pE!==0)throw new Error("aes/(cbc-ecb).decrypt ciphertext should consist of blocks with size 16")}function OE(t,e,n){let r=t.length;const i=r%pE;if(!e&&0!==i)throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");const s=Gk(t);if(e){let t=pE-i;t||(t=pE),r+=t}const o=PE(r,n);return{b:s,o:Gk(o),out:o}}function NE(t,e){if(!e)return t;const n=t.length;if(!n)throw new Error("aes/pcks5: empty ciphertext not allowed");const r=t[n-1];if(r<=0||r>16)throw new Error(`aes/pcks5: wrong padding byte: ${r}`);const i=t.subarray(0,-r);for(let s=0;s<r;s++)if(t[n-s-1]!==r)throw new Error("aes/pcks5: wrong padding");return i}function FE(t){const e=new Uint8Array(16),n=Gk(e);e.set(t);const r=pE-t.length;for(let i=pE-r;i<pE;i++)e[i]=r;return n}eE({blockSize:16,nonceLength:16},function(t,e){function n(n,r){const i=kE(t),s=e.slice(),o=function(t,e,n,r){qk(e,pE),qk(n);const i=n.length;r=PE(i,r);const s=e,o=Gk(s);let{s0:a,s1:l,s2:c,s3:u}=LE(t,o[0],o[1],o[2],o[3]);const h=Gk(n),d=Gk(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 e=1;for(let t=s.length-1;t>=0;t--)e=e+(255&s[t])|0,s[t]=255&e,e>>>=8;({s0:a,s1:l,s2:c,s3:u}=LE(t,o[0],o[1],o[2],o[3]))}const p=pE*Math.floor(h.length/4);if(p<i){const t=new Uint32Array([a,l,c,u]),e=Hk(t);for(let s=p,o=0;s<i;s++,o++)r[s]=n[s]^e[o]}return r}(i,s,n,r);return i.fill(0),s.fill(0),o}return qk(t),qk(e,pE),{encrypt:(t,e)=>n(t,e),decrypt:(t,e)=>n(t,e)}}),eE({blockSize:16},function(t,e={}){qk(t);const n=!e.disablePadding;return{encrypt:(e,r)=>{qk(e);const{b:i,o:s,out:o}=OE(e,n,r),a=kE(t);let l=0;for(;l+4<=i.length;){const{s0:t,s1:e,s2:n,s3:r}=LE(a,i[l+0],i[l+1],i[l+2],i[l+3]);s[l++]=t,s[l++]=e,s[l++]=n,s[l++]=r}if(n){const t=FE(e.subarray(4*l)),{s0:n,s1:r,s2:i,s3:o}=LE(a,t[0],t[1],t[2],t[3]);s[l++]=n,s[l++]=r,s[l++]=i,s[l++]=o}return a.fill(0),o},decrypt:(e,r)=>{AE(e);const i=EE(t),s=PE(e.length,r),o=Gk(e),a=Gk(s);for(let t=0;t+4<=o.length;){const{s0:e,s1:n,s2:r,s3:s}=IE(i,o[t+0],o[t+1],o[t+2],o[t+3]);a[t++]=e,a[t++]=n,a[t++]=r,a[t++]=s}return i.fill(0),NE(s,n)}}});var zE=eE({blockSize:16,nonceLength:16},function(t,e,n={}){qk(t),qk(e,16);const r=!n.disablePadding;return{encrypt:(n,i)=>{const s=kE(t),{b:o,o:a,out:l}=OE(n,r,i),c=Gk(e);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}=LE(s,u,h,d,p)),a[f++]=u,a[f++]=h,a[f++]=d,a[f++]=p;if(r){const t=FE(n.subarray(4*f));u^=t[0],h^=t[1],d^=t[2],p^=t[3],({s0:u,s1:h,s2:d,s3:p}=LE(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)=>{AE(n);const s=EE(t),o=Gk(e),a=PE(n.length,i),l=Gk(n),c=Gk(a);let u=o[0],h=o[1],d=o[2],p=o[3];for(let t=0;t+4<=l.length;){const e=u,n=h,r=d,i=p;u=l[t+0],h=l[t+1],d=l[t+2],p=l[t+3];const{s0:o,s1:a,s2:f,s3:g}=IE(s,u,h,d,p);c[t++]=o^e,c[t++]=a^n,c[t++]=f^r,c[t++]=g^i}return s.fill(0),NE(a,r)}}});function DE(t,e,n,r,i){const s=t.create(n,r.length+(i?.length||0));i&&s.update(i),s.update(r);const o=new Uint8Array(16),a=Zk(o);return i&&nE(a,0,BigInt(8*i.length),e),nE(a,8,BigInt(8*r.length),e),s.update(o),s.digest()}eE({blockSize:16,nonceLength:16},function(t,e){function n(n,r,i){const s=kE(t),o=n.length;i=PE(o,i);const a=Gk(n),l=Gk(i),c=r?l:a,u=Gk(e);let h=u[0],d=u[1],p=u[2],f=u[3];for(let t=0;t+4<=a.length;){const{s0:e,s1:n,s2:r,s3:i}=LE(s,h,d,p,f);l[t+0]=a[t+0]^e,l[t+1]=a[t+1]^n,l[t+2]=a[t+2]^r,l[t+3]=a[t+3]^i,h=c[t++],d=c[t++],p=c[t++],f=c[t++]}const g=pE*Math.floor(a.length/4);if(g<o){({s0:h,s1:d,s2:p,s3:f}=LE(s,h,d,p,f));const t=Hk(new Uint32Array([h,d,p,f]));for(let e=g,r=0;e<o;e++,r++)i[e]=n[e]^t[r];t.fill(0)}return s.fill(0),i}return qk(t),qk(e,16),{encrypt:(t,e)=>n(t,!0,e),decrypt:(t,e)=>n(t,!1,e)}}),eE({blockSize:16,nonceLength:12,tagLength:16},function(t,e,n){if(qk(e),0===e.length)throw new Error("aes/gcm: empty nonce");function r(t,e,r){const i=DE(hE,!1,t,r,n);for(let n=0;n<e.length;n++)i[n]^=e[n];return i}function i(){const n=kE(t),r=fE.slice(),i=fE.slice();if(ME(n,!1,i,i,r),12===e.length)i.set(e);else{const t=fE.slice();nE(Zk(t),8,BigInt(8*e.length),!1),hE.create(r).update(e).update(t).digestInto(i)}return{xk:n,authKey:r,counter:i,tagMask:ME(n,!1,i,fE)}}return{encrypt:t=>{qk(t);const{xk:e,authKey:n,counter:s,tagMask:o}=i(),a=new Uint8Array(t.length+16);ME(e,!1,s,t,a);const l=r(n,o,a.subarray(0,a.length-16));return a.set(l,t.length),e.fill(0),a},decrypt:t=>{if(qk(t),t.length<16)throw new Error("aes/gcm: ciphertext less than tagLen (16)");const{xk:e,authKey:n,counter:s,tagMask:o}=i(),a=t.subarray(0,-16),l=t.subarray(-16);if(!tE(r(n,o,a),l))throw new Error("aes/gcm: invalid ghash tag");const c=ME(e,!1,s,a);return n.fill(0),o.fill(0),e.fill(0),c}}});var jE=(t,e,n)=>r=>{if(!Number.isSafeInteger(r)||e>r||r>n)throw new Error(`${t}: invalid value=${r}, must be [${e}..${n}]`)},UE=(eE({blockSize:16,nonceLength:12,tagLength:16},function(t,e,n){const r=jE("AAD",0,2**36),i=jE("plaintext",0,2**36),s=jE("nonce",12,12),o=jE("ciphertext",16,2**36+16);function a(){const n=t.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=kE(t),i=new Uint8Array(n),s=new Uint8Array(16),o=Gk(e);let a=0,l=o[0],c=o[1],u=o[2],h=0;for(const t of[s,i].map(Gk)){const e=Gk(t);for(let t=0;t<e.length;t+=2){const{s0:n,s1:i}=LE(r,a,l,c,u);e[t+0]=n,e[t+1]=i,a=++h}}return r.fill(0),{authKey:s,encKey:kE(i)}}function l(t,r,i){const s=DE(dE,!0,r,i,n);for(let n=0;n<12;n++)s[n]^=e[n];s[15]&=127;const o=Gk(s);let a=o[0],l=o[1],c=o[2],u=o[3];return({s0:a,s1:l,s2:c,s3:u}=LE(t,a,l,c,u)),o[0]=a,o[1]=l,o[2]=c,o[3]=u,s}function c(t,e,n){let r=e.slice();return r[15]|=128,ME(t,!0,r,n)}return qk(e),s(e.length),n&&(qk(n),r(n.length)),{encrypt:t=>{qk(t),i(t.length);const{encKey:e,authKey:n}=a(),r=l(e,n,t),s=new Uint8Array(t.length+16);return s.set(r,t.length),s.set(c(e,r,t)),e.fill(0),n.fill(0),s},decrypt:t=>{qk(t),o(t.length);const e=t.subarray(-16),{encKey:n,authKey:r}=a(),i=c(n,e,t.subarray(0,-16)),s=l(n,r,i);if(n.fill(0),r.fill(0),!tE(e,s))throw new Error("invalid polyval tag");return i}}}),(t,e)=>255&t[e++]|(255&t[e++])<<8),BE=class{constructor(t){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,qk(t=Qk(t),32);const e=UE(t,0),n=UE(t,2),r=UE(t,4),i=UE(t,6),s=UE(t,8),o=UE(t,10),a=UE(t,12),l=UE(t,14);this.r[0]=8191&e,this.r[1]=8191&(e>>>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]=UE(t,16+2*c)}process(t,e,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=UE(t,e+0),y=UE(t,e+2),v=UE(t,e+4),b=UE(t,e+6),w=UE(t,e+8),_=UE(t,e+10),x=UE(t,e+12),C=UE(t,e+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 z=O+S*l+k*a+E*o+R*(5*g)+T*(5*f);O=z>>>13,z&=8191,z+=L*(5*p)+I*(5*d)+P*(5*h)+M*(5*u)+A*(5*c),O+=z>>>13,z&=8191;let D=O+S*c+k*l+E*a+R*o+T*(5*g);O=D>>>13,D&=8191,D+=L*(5*f)+I*(5*p)+P*(5*d)+M*(5*h)+A*(5*u),O+=D>>>13,D&=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]=z,i[3]=D,i[4]=j,i[5]=U,i[6]=B,i[7]=$,i[8]=q,i[9]=V}finalize(){const{h:t,pad:e}=this,n=new Uint16Array(10);let r=t[1]>>>13;t[1]&=8191;for(let o=2;o<10;o++)t[o]+=r,r=t[o]>>>13,t[o]&=8191;t[0]+=5*r,r=t[0]>>>13,t[0]&=8191,t[1]+=r,r=t[1]>>>13,t[1]&=8191,t[2]+=r,n[0]=t[0]+5,r=n[0]>>>13,n[0]&=8191;for(let o=1;o<10;o++)n[o]=t[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++)t[o]=t[o]&i|n[o];t[0]=65535&(t[0]|t[1]<<13),t[1]=65535&(t[1]>>>3|t[2]<<10),t[2]=65535&(t[2]>>>6|t[3]<<7),t[3]=65535&(t[3]>>>9|t[4]<<4),t[4]=65535&(t[4]>>>12|t[5]<<1|t[6]<<14),t[5]=65535&(t[6]>>>2|t[7]<<11),t[6]=65535&(t[7]>>>5|t[8]<<8),t[7]=65535&(t[8]>>>8|t[9]<<5);let s=t[0]+e[0];t[0]=65535&s;for(let o=1;o<8;o++)s=(t[o]+e[o]|0)+(s>>>16)|0,t[o]=65535&s}update(t){Vk(this);const{buffer:e,blockLen:n}=this,r=(t=Qk(t)).length;for(let i=0;i<r;){const s=Math.min(n-this.pos,r-i);if(s!==n)e.set(t.subarray(i,i+s),this.pos),this.pos+=s,i+=s,this.pos===n&&(this.process(e,0,!1),this.pos=0);else for(;n<=r-i;i+=n)this.process(t,i)}return this}destroy(){this.h.fill(0),this.r.fill(0),this.buffer.fill(0),this.pad.fill(0)}digestInto(t){Vk(this),Wk(t,this),this.finished=!0;const{buffer:e,h:n}=this;let{pos:r}=this;if(r){for(e[r++]=1;r<16;r++)e[r]=0;this.process(e,0,!0)}this.finalize();let i=0;for(let s=0;s<8;s++)t[i++]=n[s]>>>0,t[i++]=n[s]>>>8;return t}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}},$E=function(t){const e=(e,n)=>t(n).update(Qk(e)).digest(),n=t(new Uint8Array(32));return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=e=>t(e),e}(t=>new BE(t)),qE=t=>Uint8Array.from(t.split("").map(t=>t.charCodeAt(0))),VE=qE("expand 16-byte k"),WE=qE("expand 32-byte k"),HE=Gk(VE),GE=Gk(WE);function ZE(t,e){return t<<e|t>>>32-e}function KE(t){return t.byteOffset%4==0}GE.slice();var YE=2**32-1,XE=new Uint32Array;function JE(t,e){const{allowShortKeys:n,extendNonceFn:r,counterLength:i,counterRight:s,rounds:o}=function(t,e){if(null==e||"object"!=typeof e)throw new Error("options must be defined");return Object.assign({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},e)}(0,e);if("function"!=typeof t)throw new Error("core must be a function");return Uk(i),Uk(o),Bk(s),Bk(n),(e,a,l,c,u=0)=>{qk(e),qk(a),qk(l);const h=l.length;if(c||(c=new Uint8Array(h)),qk(c),Uk(u),u<0||u>=YE)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=e.length;if(32===g)p=e.slice(),d.push(p),f=GE;else{if(16!==g||!n)throw new Error(`arx: invalid 32-byte key, got length=${g}`);p=new Uint8Array(32),p.set(e),p.set(e,16),f=HE,d.push(p)}KE(a)||(a=a.slice(),d.push(a));const m=Gk(p);if(r){if(24!==a.length)throw new Error("arx: extended nonce must be 24 bytes");r(f,m,Gk(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 t=new Uint8Array(12);t.set(a,s?0:12-a.length),a=t,d.push(a)}const v=Gk(a);for(function(t,e,n,r,i,s,o,a){const l=i.length,c=new Uint8Array(64),u=Gk(c),h=KE(i)&&KE(s),d=h?Gk(i):XE,p=h?Gk(s):XE;for(let f=0;f<l;o++){if(t(e,n,r,u,o,a),o>=YE)throw new Error("arx: counter overflow");const g=Math.min(64,l-f);if(h&&64===g){const t=f/4;if(f%4!=0)throw new Error("arx: invalid block position");for(let e,n=0;n<16;n++)e=t+n,p[e]=d[e]^u[n];f+=64;continue}for(let t,e=0;e<g;e++)t=f+e,s[t]=i[t]^c[e];f+=g}}(t,f,m,v,l,c,u,o);d.length>0;)d.pop().fill(0);return c}}function QE(t,e,n,r,i,s=20){let o=t[0],a=t[1],l=t[2],c=t[3],u=e[0],h=e[1],d=e[2],p=e[3],f=e[4],g=e[5],m=e[6],y=e[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,z=_;for(let j=0;j<s;j+=2)x=x+E|0,O=ZE(O^x,16),I=I+O|0,E=ZE(E^I,12),x=x+E|0,O=ZE(O^x,8),I=I+O|0,E=ZE(E^I,7),C=C+R|0,N=ZE(N^C,16),P=P+N|0,R=ZE(R^P,12),C=C+R|0,N=ZE(N^C,8),P=P+N|0,R=ZE(R^P,7),S=S+T|0,F=ZE(F^S,16),M=M+F|0,T=ZE(T^M,12),S=S+T|0,F=ZE(F^S,8),M=M+F|0,T=ZE(T^M,7),k=k+L|0,z=ZE(z^k,16),A=A+z|0,L=ZE(L^A,12),k=k+L|0,z=ZE(z^k,8),A=A+z|0,L=ZE(L^A,7),x=x+R|0,z=ZE(z^x,16),M=M+z|0,R=ZE(R^M,12),x=x+R|0,z=ZE(z^x,8),M=M+z|0,R=ZE(R^M,7),C=C+T|0,O=ZE(O^C,16),A=A+O|0,T=ZE(T^A,12),C=C+T|0,O=ZE(O^C,8),A=A+O|0,T=ZE(T^A,7),S=S+L|0,N=ZE(N^S,16),I=I+N|0,L=ZE(L^I,12),S=S+L|0,N=ZE(N^S,8),I=I+N|0,L=ZE(L^I,7),k=k+E|0,F=ZE(F^k,16),P=P+F|0,E=ZE(E^P,12),k=k+E|0,F=ZE(F^k,8),P=P+F|0,E=ZE(E^P,7);let D=0;r[D++]=o+x|0,r[D++]=a+C|0,r[D++]=l+S|0,r[D++]=c+k|0,r[D++]=u+E|0,r[D++]=h+R|0,r[D++]=d+T|0,r[D++]=p+L|0,r[D++]=f+I|0,r[D++]=g+P|0,r[D++]=m+M|0,r[D++]=y+A|0,r[D++]=v+O|0,r[D++]=b+N|0,r[D++]=w+F|0,r[D++]=_+z|0}var tR=JE(QE,{counterRight:!1,counterLength:4,allowShortKeys:!1}),eR=JE(QE,{counterRight:!1,counterLength:8,extendNonceFn:function(t,e,n,r){let i=t[0],s=t[1],o=t[2],a=t[3],l=e[0],c=e[1],u=e[2],h=e[3],d=e[4],p=e[5],f=e[6],g=e[7],m=n[0],y=n[1],v=n[2],b=n[3];for(let _=0;_<20;_+=2)i=i+l|0,m=ZE(m^i,16),d=d+m|0,l=ZE(l^d,12),i=i+l|0,m=ZE(m^i,8),d=d+m|0,l=ZE(l^d,7),s=s+c|0,y=ZE(y^s,16),p=p+y|0,c=ZE(c^p,12),s=s+c|0,y=ZE(y^s,8),p=p+y|0,c=ZE(c^p,7),o=o+u|0,v=ZE(v^o,16),f=f+v|0,u=ZE(u^f,12),o=o+u|0,v=ZE(v^o,8),f=f+v|0,u=ZE(u^f,7),a=a+h|0,b=ZE(b^a,16),g=g+b|0,h=ZE(h^g,12),a=a+h|0,b=ZE(b^a,8),g=g+b|0,h=ZE(h^g,7),i=i+c|0,b=ZE(b^i,16),f=f+b|0,c=ZE(c^f,12),i=i+c|0,b=ZE(b^i,8),f=f+b|0,c=ZE(c^f,7),s=s+u|0,m=ZE(m^s,16),g=g+m|0,u=ZE(u^g,12),s=s+u|0,m=ZE(m^s,8),g=g+m|0,u=ZE(u^g,7),o=o+h|0,y=ZE(y^o,16),d=d+y|0,h=ZE(h^d,12),o=o+h|0,y=ZE(y^o,8),d=d+y|0,h=ZE(h^d,7),a=a+l|0,v=ZE(v^a,16),p=p+v|0,l=ZE(l^p,12),a=a+l|0,v=ZE(v^a,8),p=p+v|0,l=ZE(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}),nR=new Uint8Array(16),rR=(t,e)=>{t.update(e);const n=e.length%16;n&&t.update(nR.subarray(n))},iR=new Uint8Array(32);function sR(t,e,n,r,i){const s=t(e,n,iR),o=$E.create(s);i&&rR(o,i),rR(o,r);const a=new Uint8Array(16),l=Zk(a);nE(l,0,BigInt(i?i.length:0),!0),nE(l,8,BigInt(r.length),!0),o.update(a);const c=o.digest();return s.fill(0),c}var oR=t=>(e,n,r)=>(qk(e,32),qk(n),{encrypt:(i,s)=>{const o=i.length,a=o+16;s?qk(s,a):s=new Uint8Array(a),t(e,n,i,s,1);const l=sR(t,e,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?qk(s,a):s=new Uint8Array(a);const l=i.subarray(0,-16);if(!tE(i.subarray(-16),sR(t,e,n,l,r)))throw new Error("invalid tag");return t(e,n,l,s,1),s}}),aR=(oR(tR),oR(eR),class extends OS{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,pk.hash(t);const n=MS(e);if(this.iHash=t.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?t.create().update(n).digest():n);for(let s=0;s<i.length;s++)i[s]^=54;this.iHash.update(i),this.oHash=t.create();for(let s=0;s<i.length;s++)i[s]^=106;this.oHash.update(i),i.fill(0)}update(t){return pk.exists(this),this.iHash.update(t),this}digestInto(t){pk.exists(this),pk.bytes(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:n,finished:r,destroyed:i,blockLen:s,outputLen:o}=this;return t.finished=r,t.destroyed=i,t.blockLen=s,t.outputLen=o,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}),lR=(t,e,n)=>new aR(t,e).update(n).digest();lR.create=(t,e)=>new aR(t,e);var cR=new Uint8Array([0]),uR=new Uint8Array,hR=Object.defineProperty,dR=(t,e)=>{for(var n in e)hR(t,n,{get:e[n],enumerable:!0})},pR=Symbol("verified");function fR(t){if(!(t instanceof Object))return!1;if("number"!=typeof t.kind)return!1;if("string"!=typeof t.content)return!1;if("number"!=typeof t.created_at)return!1;if("string"!=typeof t.pubkey)return!1;if(!t.pubkey.match(/^[a-f0-9]{64}$/))return!1;if(!Array.isArray(t.tags))return!1;for(let e=0;e<t.tags.length;e++){let n=t.tags[e];if(!Array.isArray(n))return!1;for(let t=0;t<n.length;t++)if("string"!=typeof n[t])return!1}return!0}dR({},{Queue:()=>xR,QueueNode:()=>_R,binarySearch:()=>wR,bytesToHex:()=>IS,hexToBytes:()=>PS,insertEventIntoAscendingList:()=>bR,insertEventIntoDescendingList:()=>vR,normalizeURL:()=>yR,utf8Decoder:()=>gR,utf8Encoder:()=>mR});var gR=new TextDecoder("utf-8"),mR=new TextEncoder;function yR(t){try{-1===t.indexOf("://")&&(t="wss://"+t);let e=new URL(t);return"http:"===e.protocol?e.protocol="ws:":"https:"===e.protocol&&(e.protocol="wss:"),e.pathname=e.pathname.replace(/\/+/g,"/"),e.pathname.endsWith("/")&&(e.pathname=e.pathname.slice(0,-1)),("80"===e.port&&"ws:"===e.protocol||"443"===e.port&&"wss:"===e.protocol)&&(e.port=""),e.searchParams.sort(),e.hash="",e.toString()}catch(e){throw new Error(`Invalid URL: ${t}`)}}function vR(t,e){const[n,r]=wR(t,t=>e.id===t.id?0:e.created_at===t.created_at?-1:t.created_at-e.created_at);return r||t.splice(n,0,e),t}function bR(t,e){const[n,r]=wR(t,t=>e.id===t.id?0:e.created_at===t.created_at?-1:e.created_at-t.created_at);return r||t.splice(n,0,e),t}function wR(t,e){let n=0,r=t.length-1;for(;n<=r;){const i=Math.floor((n+r)/2),s=e(t[i]);if(0===s)return[i,!0];s<0?r=i-1:n=i+1}return[n,!1]}var _R=class{value;next=null;prev=null;constructor(t){this.value=t}},xR=class{first;last;constructor(){this.first=null,this.last=null}enqueue(t){const e=new _R(t);return this.last?this.last===this.first?(this.last=e,this.last.prev=this.first,this.first.next=e):(e.prev=this.last,this.last.next=e,this.last=e):(this.first=e,this.last=e),!0}dequeue(){if(!this.first)return null;if(this.first===this.last){const t=this.first;return this.first=null,this.last=null,t.value}const t=this.first;return this.first=t.next,this.first&&(this.first.prev=null),t.value}};function CR(t){return IS(xk(mR.encode(function(t){if(!fR(t))throw new Error("can't serialize event with wrong or missing properties");return JSON.stringify([0,t.pubkey,t.created_at,t.kind,t.tags,t.content])}(t))))}var SR=new class{generateSecretKey(){return SS.utils.randomPrivateKey()}getPublicKey(t){return IS(SS.getPublicKey(t))}finalizeEvent(t,e){const n=t;return n.pubkey=IS(SS.getPublicKey(e)),n.id=CR(n),n.sig=IS(SS.sign(CR(n),e)),n[pR]=!0,n}verifyEvent(t){if("boolean"==typeof t[pR])return t[pR];const e=CR(t);if(e!==t.id)return t[pR]=!1,!1;try{const n=SS.verify(t.sig,e,t.pubkey);return t[pR]=n,n}catch(nD){return t[pR]=!1,!1}}},kR=SR.generateSecretKey,ER=SR.getPublicKey,RR=SR.finalizeEvent,TR=SR.verifyEvent,LR={};function IR(t){return t<1e4&&0!==t&&3!==t}function PR(t){return 0===t||3===t||1e4<=t&&t<2e4}function MR(t){return 2e4<=t&&t<3e4}function AR(t){return 3e4<=t&&t<4e4}function OR(t){return IR(t)?"regular":PR(t)?"replaceable":MR(t)?"ephemeral":AR(t)?"parameterized":"unknown"}function NR(t,e){const n=e instanceof Array?e:[e];return fR(t)&&n.includes(t.kind)||!1}dR(LR,{Application:()=>oL,BadgeAward:()=>VR,BadgeDefinition:()=>QT,BlockedRelaysList:()=>MT,BlossomServerList:()=>jT,BookmarkList:()=>LT,Bookmarksets:()=>YT,Calendar:()=>pL,CalendarEventRSVP:()=>fL,ChannelCreation:()=>tT,ChannelHideMessage:()=>rT,ChannelMessage:()=>nT,ChannelMetadata:()=>eT,ChannelMuteUser:()=>iT,ChatMessage:()=>WR,ClassifiedListing:()=>cL,ClientAuth:()=>$T,Comment:()=>cT,CommunitiesList:()=>IT,CommunityDefinition:()=>vL,CommunityPostApproval:()=>yT,Contacts:()=>jR,CreateOrUpdateProduct:()=>nL,CreateOrUpdateStall:()=>eL,Curationsets:()=>XT,Date:()=>hL,DirectMessageRelaysList:()=>zT,DraftClassifiedListing:()=>uL,DraftLong:()=>iL,Emojisets:()=>sL,EncryptedDirectMessage:()=>UR,EventDeletion:()=>BR,FavoriteRelays:()=>OT,FileMessage:()=>KR,FileMetadata:()=>lT,FileServerPreference:()=>DT,Followsets:()=>GT,ForumThread:()=>HR,GenericRepost:()=>YR,Genericlists:()=>ZT,GiftWrap:()=>oT,GroupMetadata:()=>bL,HTTPAuth:()=>HT,Handlerinformation:()=>yL,Handlerrecommendation:()=>mL,Highlights:()=>ST,InterestsList:()=>NT,Interestsets:()=>tL,JobFeedback:()=>wT,JobRequest:()=>vT,JobResult:()=>bT,Label:()=>mT,LightningPubRPC:()=>BT,LiveChatMessage:()=>uT,LiveEvent:()=>aL,LongFormArticle:()=>rL,Metadata:()=>FR,Mutelist:()=>ET,NWCWalletInfo:()=>UT,NWCWalletRequest:()=>qT,NWCWalletResponse:()=>VT,NormalVideo:()=>JR,NostrConnect:()=>WT,OpenTimestamps:()=>sT,Photo:()=>XR,Pinlist:()=>RT,Poll:()=>aT,PollResponse:()=>kT,PrivateDirectMessage:()=>ZR,ProblemTracker:()=>pT,ProfileBadges:()=>JT,PublicChatsList:()=>PT,Reaction:()=>qR,RecommendRelay:()=>DR,RelayList:()=>TT,RelayReview:()=>gL,Relaysets:()=>KT,Report:()=>fT,Reporting:()=>gT,Repost:()=>$R,Seal:()=>GR,SearchRelaysList:()=>AT,ShortTextNote:()=>zR,ShortVideo:()=>QR,Time:()=>dL,UserEmojiList:()=>FT,UserStatuses:()=>lL,Voice:()=>hT,VoiceComment:()=>dT,Zap:()=>CT,ZapGoal:()=>_T,ZapRequest:()=>xT,classifyKind:()=>OR,isAddressableKind:()=>AR,isEphemeralKind:()=>MR,isKind:()=>NR,isRegularKind:()=>IR,isReplaceableKind:()=>PR});var FR=0,zR=1,DR=2,jR=3,UR=4,BR=5,$R=6,qR=7,VR=8,WR=9,HR=11,GR=13,ZR=14,KR=15,YR=16,XR=20,JR=21,QR=22,tT=40,eT=41,nT=42,rT=43,iT=44,sT=1040,oT=1059,aT=1068,lT=1063,cT=1111,uT=1311,hT=1222,dT=1244,pT=1971,fT=1984,gT=1984,mT=1985,yT=4550,vT=5999,bT=6999,wT=7e3,_T=9041,xT=9734,CT=9735,ST=9802,kT=1018,ET=1e4,RT=10001,TT=10002,LT=10003,IT=10004,PT=10005,MT=10006,AT=10007,OT=10012,NT=10015,FT=10030,zT=10050,DT=10096,jT=10063,UT=13194,BT=21e3,$T=22242,qT=23194,VT=23195,WT=24133,HT=27235,GT=3e4,ZT=30001,KT=30002,YT=30003,XT=30004,JT=30008,QT=30009,tL=30015,eL=30017,nL=30018,rL=30023,iL=30024,sL=30030,oL=30078,aL=30311,lL=30315,cL=30402,uL=30403,hL=31922,dL=31923,pL=31924,fL=31925,gL=31987,mL=31989,yL=31990,vL=34550,bL=39e3;function wL(t,e){let n=e.length+3,r=t.indexOf(`"${e}":`)+n,i=t.slice(r).indexOf('"')+r+1;return t.slice(i,i+64)}function _L(t,e){let n=e.length,r=t.indexOf(`"${e}":`)+n+3,i=t.slice(r),s=Math.min(i.indexOf(","),i.indexOf("}"));return parseInt(i.slice(0,s),10)}function xL(t){let e=t.slice(0,22).indexOf('"EVENT"');if(-1===e)return null;let n=t.slice(e+7+1).indexOf('"');if(-1===n)return null;let r=e+7+1+n,i=t.slice(r+1,80).indexOf('"');if(-1===i)return null;let s=r+1+i;return t.slice(r+1,s)}function CL(t,e){return e===wL(t,"id")}function SL(t,e){return e===wL(t,"pubkey")}function kL(t,e){return e===_L(t,"kind")}function EL(t,e){return{kind:$T,created_at:Math.floor(Date.now()/1e3),tags:[["relay",t],["challenge",e]],content:""}}dR({},{getHex64:()=>wL,getInt:()=>_L,getSubscriptionId:()=>xL,matchEventId:()=>CL,matchEventKind:()=>kL,matchEventPubkey:()=>SL}),dR({},{makeAuthEvent:()=>EL});try{WebSocket}catch{}try{WebSocket}catch{}dR({},{BECH32_REGEX:()=>LL,Bech32MaxSize:()=>TL,NostrTypeGuard:()=>RL,decode:()=>PL,decodeNostrURI:()=>IL,encodeBytes:()=>zL,naddrEncode:()=>UL,neventEncode:()=>jL,noteEncode:()=>NL,nprofileEncode:()=>DL,npubEncode:()=>OL,nsecEncode:()=>AL});var RL={isNProfile:t=>/^nprofile1[a-z\d]+$/.test(t||""),isNEvent:t=>/^nevent1[a-z\d]+$/.test(t||""),isNAddr:t=>/^naddr1[a-z\d]+$/.test(t||""),isNSec:t=>/^nsec1[a-z\d]{58}$/.test(t||""),isNPub:t=>/^npub1[a-z\d]{58}$/.test(t||""),isNote:t=>/^note1[a-z\d]+$/.test(t||""),isNcryptsec:t=>/^ncryptsec1[a-z\d]+$/.test(t||"")},TL=5e3,LL=/[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/;function IL(t){try{return t.startsWith("nostr:")&&(t=t.substring(6)),PL(t)}catch(e){return{type:"invalid",data:null}}}function PL(t){let{prefix:e,words:n}=rk.decode(t,TL),r=new Uint8Array(rk.fromWords(n));switch(e){case"nprofile":{let t=ML(r);if(!t[0]?.[0])throw new Error("missing TLV 0 for nprofile");if(32!==t[0][0].length)throw new Error("TLV 0 should be 32 bytes");return{type:"nprofile",data:{pubkey:IS(t[0][0]),relays:t[1]?t[1].map(t=>gR.decode(t)):[]}}}case"nevent":{let t=ML(r);if(!t[0]?.[0])throw new Error("missing TLV 0 for nevent");if(32!==t[0][0].length)throw new Error("TLV 0 should be 32 bytes");if(t[2]&&32!==t[2][0].length)throw new Error("TLV 2 should be 32 bytes");if(t[3]&&4!==t[3][0].length)throw new Error("TLV 3 should be 4 bytes");return{type:"nevent",data:{id:IS(t[0][0]),relays:t[1]?t[1].map(t=>gR.decode(t)):[],author:t[2]?.[0]?IS(t[2][0]):void 0,kind:t[3]?.[0]?parseInt(IS(t[3][0]),16):void 0}}}case"naddr":{let t=ML(r);if(!t[0]?.[0])throw new Error("missing TLV 0 for naddr");if(!t[2]?.[0])throw new Error("missing TLV 2 for naddr");if(32!==t[2][0].length)throw new Error("TLV 2 should be 32 bytes");if(!t[3]?.[0])throw new Error("missing TLV 3 for naddr");if(4!==t[3][0].length)throw new Error("TLV 3 should be 4 bytes");return{type:"naddr",data:{identifier:gR.decode(t[0][0]),pubkey:IS(t[2][0]),kind:parseInt(IS(t[3][0]),16),relays:t[1]?t[1].map(t=>gR.decode(t)):[]}}}case"nsec":return{type:e,data:r};case"npub":case"note":return{type:e,data:IS(r)};default:throw new Error(`unknown prefix ${e}`)}}function ML(t){let e={},n=t;for(;n.length>0;){let t=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 ${t}`);e[t]=e[t]||[],e[t].push(i)}return e}function AL(t){return zL("nsec",t)}function OL(t){return zL("npub",PS(t))}function NL(t){return zL("note",PS(t))}function FL(t,e){let n=rk.toWords(e);return rk.encode(t,n,TL)}function zL(t,e){return FL(t,e)}function DL(t){return FL("nprofile",BL({0:[PS(t.pubkey)],1:(t.relays||[]).map(t=>mR.encode(t))}))}function jL(t){let e;return void 0!==t.kind&&(e=function(t){const e=new Uint8Array(4);return e[0]=t>>24&255,e[1]=t>>16&255,e[2]=t>>8&255,e[3]=255&t,e}(t.kind)),FL("nevent",BL({0:[PS(t.id)],1:(t.relays||[]).map(t=>mR.encode(t)),2:t.author?[PS(t.author)]:[],3:e?[new Uint8Array(e)]:[]}))}function UL(t){let e=new ArrayBuffer(4);return new DataView(e).setUint32(0,t.kind,!1),FL("naddr",BL({0:[mR.encode(t.identifier)],1:(t.relays||[]).map(t=>mR.encode(t)),2:[PS(t.pubkey)],3:[new Uint8Array(e)]}))}function BL(t){let e=[];return Object.entries(t).reverse().forEach(([t,n])=>{n.forEach(n=>{let r=new Uint8Array(n.length+2);r.set([parseInt(t)],0),r.set([n.length],1),r.set(n,2),e.push(r)})}),AS(...e)}var $L={};function qL(t,e,n){const r=t instanceof Uint8Array?IS(t):t,i=WL(lS.getSharedSecret(r,"02"+e));let s=Uint8Array.from(FS(16)),o=mR.encode(n),a=zE(i,s).encrypt(o);return`${HS.encode(new Uint8Array(a))}?iv=${HS.encode(new Uint8Array(s.buffer))}`}function VL(t,e,n){const r=t instanceof Uint8Array?IS(t):t;let[i,s]=n.split("?iv="),o=WL(lS.getSharedSecret(r,"02"+e)),a=HS.decode(s),l=HS.decode(i),c=zE(o,a).decrypt(l);return gR.decode(c)}function WL(t){return t.slice(1,33)}dR($L,{decrypt:()=>VL,encrypt:()=>qL}),dR({},{NIP05_REGEX:()=>GL,isNip05:()=>ZL,isValid:()=>JL,queryProfile:()=>XL,searchDomain:()=>YL,useFetchImplementation:()=>KL});var HL,GL=/^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/,ZL=t=>GL.test(t||"");try{HL=fetch}catch(Snt){}function KL(t){HL=t}async function YL(t,e=""){try{const n=`https://${t}/.well-known/nostr.json?name=${e}`,r=await HL(n,{redirect:"manual"});if(200!==r.status)throw Error("Wrong response code");return(await r.json()).names}catch(Snt){return{}}}async function XL(t){const e=t.match(GL);if(!e)return null;const[,n="_",r]=e;try{const t=`https://${r}/.well-known/nostr.json?name=${n}`,e=await HL(t,{redirect:"manual"});if(200!==e.status)throw Error("Wrong response code");const i=await e.json(),s=i.names[n];return s?{pubkey:s,relays:i.relays?.[s]}:null}catch(i){return null}}async function JL(t,e){const n=await XL(e);return!!n&&n.pubkey===t}function QL(t){const e={reply:void 0,root:void 0,mentions:[],profiles:[],quotes:[]};let n,r;for(let i=t.tags.length-1;i>=0;i--){const s=t.tags[i];if("e"===s[0]&&s[1]){const[t,i,o,a,l]=s,c={id:i,relays:o?[o]:[],author:l};if("root"===a){e.root=c;continue}if("reply"===a){e.reply=c;continue}if("mention"===a){e.mentions.push(c);continue}n?r=c:n=c,e.mentions.push(c);continue}if("q"===s[0]&&s[1]){const[t,n,r]=s;e.quotes.push({id:n,relays:r?[r]:[]})}"p"===s[0]&&s[1]&&e.profiles.push({pubkey:s[1],relays:s[2]?[s[2]]:[]})}return e.root||(e.root=r||n||e.reply),e.reply||(e.reply=n||e.root),[e.reply,e.root].forEach(t=>{if(!t)return;let n=e.mentions.indexOf(t);if(-1!==n&&e.mentions.splice(n,1),t.author){let n=e.profiles.find(e=>e.pubkey===t.author);n&&n.relays&&(t.relays||(t.relays=[]),n.relays.forEach(e=>{-1===t.relays?.indexOf(e)&&t.relays.push(e)}),n.relays=t.relays)}}),e.mentions.forEach(t=>{if(t.author){let n=e.profiles.find(e=>e.pubkey===t.author);n&&n.relays&&(t.relays||(t.relays=[]),n.relays.forEach(e=>{-1===t.relays.indexOf(e)&&t.relays.push(e)}),n.relays=t.relays)}}),e}function tI(){}async function eI(t){return await(await fetch(t.replace("ws://","http://").replace("wss://","https://"),{headers:{Accept:"application/nostr+json"}})).json()}function nI(t){let e=0;for(let n=0;n<64;n+=8){const r=parseInt(t.substring(n,n+8),16);if(0!==r){e+=Math.clz32(r);break}e+=32}return e}function rI(t,e){let n=0;const r=t,i=["nonce",n.toString(),e.toString()];for(r.tags.push(i);;){const t=Math.floor((new Date).getTime()/1e3);if(t!==r.created_at&&(n=0,r.created_at=t),i[1]=(++n).toString(),r.id=iI(r),nI(r.id)>=e)break}return r}function iI(t){return IS(xk(mR.encode(JSON.stringify([0,t.pubkey,t.created_at,t.kind,t.tags,t.content]))))}dR({},{parse:()=>QL}),dR({},{fetchRelayInformation:()=>eI,useFetchImplementation:()=>tI}),dR({},{fastEventHash:()=>iI,getPow:()=>nI,minePow:()=>rI}),dR({},{unwrapEvent:()=>LI,unwrapManyEvents:()=>II,wrapEvent:()=>RI,wrapManyEvents:()=>TI}),dR({},{createRumor:()=>wI,createSeal:()=>_I,createWrap:()=>xI,unwrapEvent:()=>kI,unwrapManyEvents:()=>EI,wrapEvent:()=>CI,wrapManyEvents:()=>SI});var sI={};dR(sI,{decrypt:()=>pI,encrypt:()=>dI,getConversationKey:()=>lI,v2:()=>fI});var oI=1,aI=65535;function lI(t,e){const n=lS.getSharedSecret(t,"02"+e).subarray(1,33);return r=xk,i=n,s="nip44-v2",pk.hash(r),void 0===s&&(s=new Uint8Array(r.outputLen)),lR(r,MS(s),MS(i));var r,i,s}function cI(t,e){const n=function(t,e,n,r=32){if(pk.hash(t),pk.number(r),r>255*t.outputLen)throw new Error("Length should be <= 255*HashLen");const i=Math.ceil(r/t.outputLen);void 0===n&&(n=uR);const s=new Uint8Array(i*t.outputLen),o=lR.create(t,e),a=o._cloneInto(),l=new Uint8Array(o.outputLen);for(let c=0;c<i;c++)cR[0]=c+1,a.update(0===c?uR:l).update(n).update(cR).digestInto(l),s.set(l,t.outputLen*c),o._cloneInto(a);return o.destroy(),a.destroy(),l.fill(0),cR.fill(0),s.slice(0,r)}(xk,t,e,76);return{chacha_key:n.subarray(0,32),chacha_nonce:n.subarray(32,44),hmac_key:n.subarray(44,76)}}function uI(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("expected positive integer");if(t<=32)return 32;const e=1<<Math.floor(Math.log2(t-1))+1,n=e<=256?32:e/8;return n*(Math.floor((t-1)/n)+1)}function hI(t,e,n){if(32!==n.length)throw new Error("AAD associated data must be 32 bytes");const r=AS(n,e);return lR(xk,t,r)}function dI(t,e,n=FS(32)){const{chacha_key:r,chacha_nonce:i,hmac_key:s}=cI(e,n),o=function(t){const e=mR.encode(t),n=e.length;return AS(function(t){if(!Number.isSafeInteger(t)||t<oI||t>aI)throw new Error("invalid plaintext size: must be between 1 and 65535 bytes");const e=new Uint8Array(2);return new DataView(e.buffer).setUint16(0,t,!1),e}(n),e,new Uint8Array(uI(n)-n))}(t),a=tR(r,i,o),l=hI(s,a,n);return HS.encode(AS(new Uint8Array([2]),n,a,l))}function pI(t,e){const{nonce:n,ciphertext:r,mac:i}=function(t){if("string"!=typeof t)throw new Error("payload must be a valid string");const e=t.length;if(e<132||e>87472)throw new Error("invalid payload length: "+e);if("#"===t[0])throw new Error("unknown encryption version");let n;try{n=HS.decode(t)}catch(d8){throw new Error("invalid base64: "+d8.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)}}(t),{chacha_key:s,chacha_nonce:o,hmac_key:a}=cI(e,n);if(!tE(hI(a,r,n),i))throw new Error("invalid MAC");return function(t){const e=new DataView(t.buffer).getUint16(0),n=t.subarray(2,2+e);if(e<oI||e>aI||n.length!==e||t.length!==2+uI(e))throw new Error("invalid padding");return gR.decode(n)}(tR(s,o,r))}var fI={utils:{getConversationKey:lI,calcPaddedLen:uI},encrypt:dI,decrypt:pI},gI=()=>Math.round(Date.now()/1e3),mI=()=>Math.round(gI()-172800*Math.random()),yI=(t,e)=>lI(t,e),vI=(t,e,n)=>dI(JSON.stringify(t),yI(e,n)),bI=(t,e)=>JSON.parse(pI(t.content,yI(e,t.pubkey)));function wI(t,e){const n={created_at:gI(),content:"",tags:[],...t,pubkey:ER(e)};return n.id=CR(n),n}function _I(t,e,n){return RR({kind:GR,content:vI(t,e,n),created_at:mI(),tags:[]},e)}function xI(t,e){const n=kR();return RR({kind:oT,content:vI(t,n,e),created_at:mI(),tags:[["p",e]]},n)}function CI(t,e,n){return xI(_I(wI(t,e),e,n),n)}function SI(t,e,n){if(!n||0===n.length)throw new Error("At least one recipient is required.");const r=[CI(t,e,ER(e))];return n.forEach(n=>{r.push(CI(t,e,n))}),r}function kI(t,e){return bI(bI(t,e),e)}function EI(t,e){let n=[];return t.forEach(t=>{n.push(kI(t,e))}),n.sort((t,e)=>t.created_at-e.created_at),n}function RI(t,e,n,r,i){return CI(function(t,e,n,r){const i={created_at:Math.ceil(Date.now()/1e3),kind:ZR,tags:[],content:e};return(Array.isArray(t)?t:[t]).forEach(({publicKey:t,relayUrl:e})=>{i.tags.push(e?["p",t,e]:["p",t])}),r&&i.tags.push(["e",r.eventId,r.relayUrl||"","reply"]),n&&i.tags.push(["subject",n]),i}(e,n,r,i),t,e.publicKey)}function TI(t,e,n,r,i){if(!e||0===e.length)throw new Error("At least one recipient is required.");return[{publicKey:ER(t)},...e].map(e=>RI(t,e,n,r,i))}var LI=kI,II=EI;function PI(t,e,n,r){let i;const s=[...t.tags??[],["e",e.id,n],["p",e.pubkey]];return e.kind===zR?i=$R:(i=YR,s.push(["k",String(e.kind)])),RR({kind:i,tags:s,content:""===t.content||e.tags?.find(t=>"-"===t[0])?"":JSON.stringify(e),created_at:t.created_at},r)}function MI(t){if(![$R,YR].includes(t.kind))return;let e,n;for(let r=t.tags.length-1;r>=0&&(void 0===e||void 0===n);r--){const i=t.tags[r];i.length>=2&&("e"===i[0]&&void 0===e?e=i:"p"===i[0]&&void 0===n&&(n=i))}return void 0!==e?{id:e[1],relays:[e[2],n?.[2]].filter(t=>"string"==typeof t),author:n?.[1]}:void 0}function AI(t,{skipVerification:e}={}){const n=MI(t);if(void 0===n||""===t.content)return;let r;try{r=JSON.parse(t.content)}catch(d8){return}return r.id===n.id&&(e||TR(r))?r:void 0}dR({},{finishRepostEvent:()=>PI,getRepostedEvent:()=>AI,getRepostedEventPointer:()=>MI}),dR({},{NOSTR_URI_REGEX:()=>OI,parse:()=>FI,test:()=>NI});var OI=new RegExp(`nostr:(${LL.source})`);function NI(t){return"string"==typeof t&&new RegExp(`^${OI.source}$`).test(t)}function FI(t){const e=t.match(new RegExp(`^${OI.source}$`));if(!e)throw new Error(`Invalid Nostr URI: ${t}`);return{uri:e[0],value:e[1],decoded:PL(e[1])}}function zI(t,e,n){const r=e.tags.filter(t=>t.length>=2&&("e"===t[0]||"p"===t[0]));return RR({...t,kind:qR,tags:[...t.tags??[],...r,["e",e.id],["p",e.pubkey]],content:t.content??"+"},n)}function DI(t){if(t.kind!==qR)return;let e,n;for(let r=t.tags.length-1;r>=0&&(void 0===e||void 0===n);r--){const i=t.tags[r];i.length>=2&&("e"===i[0]&&void 0===e?e=i:"p"===i[0]&&void 0===n&&(n=i))}return void 0!==e&&void 0!==n?{id:e[1],relays:[e[2],n[2]].filter(t=>void 0!==t),author:n[1]}:void 0}dR({},{finishReactionEvent:()=>zI,getReactedEventPointer:()=>DI}),dR({},{parse:()=>$I});var jI=/\W/m,UI=/[^\w\/] |[^\w\/]$|$|,| /m,BI=42;function*$I(t){let e=[];if("string"!=typeof t){for(let n=0;n<t.tags.length;n++){const r=t.tags[n];"emoji"===r[0]&&r.length>=3&&e.push({type:"emoji",shortcode:r[1],url:r[2]})}t=t.content}const n=t.length;let r=0,i=0;t:for(;i<n;){const o=t.indexOf(":",i),a=t.indexOf("#",i);if(-1===o&&-1===a)break t;if(-1===o||a>=0&&a<o){if(0===a||" "===t[a-1]){const e=t.slice(a+1,a+BI).match(jI),s=e?a+1+e.index:n;yield{type:"text",text:t.slice(r,a)},yield{type:"hashtag",value:t.slice(a+1,s)},i=s,r=i;continue t}i=a+1}else if("nostr"===t.slice(o-5,o)){const e=t.slice(o+60).match(jI),a=e?o+60+e.index:n;try{let e,{data:n,type:s}=PL(t.slice(o+1,a));switch(s){case"npub":e={pubkey:n};break;case"note":e={id:n};break;case"nsec":i=a+1;continue;default:e=n}r!==o-5&&(yield{type:"text",text:t.slice(r,o-5)}),yield{type:"reference",pointer:e},i=a,r=i;continue t}catch(s){i=o+1;continue t}}else if("https"===t.slice(o-5,o)||"http"===t.slice(o-4,o)){const e=t.slice(o+4).match(UI),a=e?o+4+e.index:n,l="s"===t[o-1]?5:4;try{let e=new URL(t.slice(o-l,a));if(-1===e.hostname.indexOf("."))throw new Error("invalid url");if(r!==o-l&&(yield{type:"text",text:t.slice(r,o-l)}),/\.(png|jpe?g|gif|webp|heic|svg)$/i.test(e.pathname)){yield{type:"image",url:e.toString()},i=a,r=i;continue t}if(/\.(mp4|avi|webm|mkv|mov)$/i.test(e.pathname)){yield{type:"video",url:e.toString()},i=a,r=i;continue t}if(/\.(mp3|aac|ogg|opus|wav|flac)$/i.test(e.pathname)){yield{type:"audio",url:e.toString()},i=a,r=i;continue t}yield{type:"url",url:e.toString()},i=a,r=i;continue t}catch(s){i=a+1;continue t}}else{if("wss"!==t.slice(o-3,o)&&"ws"!==t.slice(o-2,o)){for(let n=0;n<e.length;n++){const s=e[n];if(":"===t[o+s.shortcode.length+1]&&t.slice(o+1,o+s.shortcode.length+1)===s.shortcode){r!==o&&(yield{type:"text",text:t.slice(r,o)}),yield s,i=o+s.shortcode.length+2,r=i;continue t}}i=o+1;continue t}{const e=t.slice(o+4).match(UI),a=e?o+4+e.index:n,l="s"===t[o-1]?3:2;try{let e=new URL(t.slice(o-l,a));if(-1===e.hostname.indexOf("."))throw new Error("invalid ws url");r!==o-l&&(yield{type:"text",text:t.slice(r,o-l)}),yield{type:"relay",url:e.toString()},i=a,r=i;continue t}catch(s){i=a+1;continue t}}}}r!==n&&(yield{type:"text",text:t.slice(r)})}dR({},{channelCreateEvent:()=>qI,channelHideMessageEvent:()=>HI,channelMessageEvent:()=>WI,channelMetadataEvent:()=>VI,channelMuteUserEvent:()=>GI});var qI=(t,e)=>{let n;if("object"==typeof t.content)n=JSON.stringify(t.content);else{if("string"!=typeof t.content)return;n=t.content}return RR({kind:tT,tags:[...t.tags??[]],content:n,created_at:t.created_at},e)},VI=(t,e)=>{let n;if("object"==typeof t.content)n=JSON.stringify(t.content);else{if("string"!=typeof t.content)return;n=t.content}return RR({kind:eT,tags:[["e",t.channel_create_event_id],...t.tags??[]],content:n,created_at:t.created_at},e)},WI=(t,e)=>{const n=[["e",t.channel_create_event_id,t.relay_url,"root"]];return t.reply_to_channel_message_event_id&&n.push(["e",t.reply_to_channel_message_event_id,t.relay_url,"reply"]),RR({kind:nT,tags:[...n,...t.tags??[]],content:t.content,created_at:t.created_at},e)},HI=(t,e)=>{let n;if("object"==typeof t.content)n=JSON.stringify(t.content);else{if("string"!=typeof t.content)return;n=t.content}return RR({kind:rT,tags:[["e",t.channel_message_event_id],...t.tags??[]],content:n,created_at:t.created_at},e)},GI=(t,e)=>{let n;if("object"==typeof t.content)n=JSON.stringify(t.content);else{if("string"!=typeof t.content)return;n=t.content}return RR({kind:iT,tags:[["p",t.pubkey_to_mute],...t.tags??[]],content:n,created_at:t.created_at},e)};dR({},{EMOJI_SHORTCODE_REGEX:()=>YI,matchAll:()=>JI,regex:()=>XI,replaceAll:()=>QI});var ZI,KI,YI=/:(\w+):/,XI=()=>new RegExp(`\\B${YI.source}\\B`,"g");function*JI(t){const e=t.matchAll(XI());for(const r of e)try{const[t,e]=r;yield{shortcode:t,name:e,start:r.index,end:r.index+t.length}}catch(n){}}function QI(t,e){return t.replaceAll(XI(),(t,n)=>e({shortcode:t,name:n}))}dR({},{useFetchImplementation:()=>tP,validateGithub:()=>eP});try{ZI=fetch}catch{}function tP(t){ZI=t}async function eP(t,e,n){try{return await(await ZI(`https://gist.github.com/${e}/${n}/raw`)).text()===`Verifying that I control the following Nostr public key: ${t}`}catch(Snt){return!1}}function nP(t){const{host:e,pathname:n,searchParams:r}=new URL(t),i=n||e,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 rP(t,e,n){const r=qL(e,t,JSON.stringify({method:"pay_invoice",params:{invoice:n}}));return RR({kind:qT,created_at:Math.round(Date.now()/1e3),content:r,tags:[["p",t]]},e)}function iP(t){return t=(t=t.trim().toLowerCase()).normalize("NFKC"),Array.from(t).map(t=>/\p{Letter}/u.test(t)||/\p{Number}/u.test(t)?t:"-").join("")}dR({},{makeNwcRequestEvent:()=>rP,parseConnectionString:()=>nP}),dR({},{normalizeIdentifier:()=>iP}),dR({},{getSatoshisAmountFromBolt11:()=>uP,getZapEndpoint:()=>oP,makeZapReceipt:()=>cP,makeZapRequest:()=>aP,useFetchImplementation:()=>sP,validateZapRequest:()=>lP});try{KI=fetch}catch{}function sP(t){KI=t}async function oP(t){try{let e="",{lud06:n,lud16:r}=JSON.parse(t.content);if(r){let[t,n]=r.split("@");e=new URL(`/.well-known/lnurlp/${t}`,`https://${n}`).toString()}else{if(!n)return null;{let{words:t}=rk.decode(n,1e3),r=rk.fromWords(t);e=gR.decode(r)}}let i=await(await KI(e)).json();if(i.allowsNostr&&i.nostrPubkey)return i.callback}catch(nD){}return null}function aP(t){let e={kind:9734,created_at:Math.round(Date.now()/1e3),content:t.comment||"",tags:[["p","pubkey"in t?t.pubkey:t.event.pubkey],["amount",t.amount.toString()],["relays",...t.relays]]};if("event"in t){if(e.tags.push(["e",t.event.id]),PR(t.event.kind)){const n=["a",`${t.event.kind}:${t.event.pubkey}:`];e.tags.push(n)}else if(AR(t.event.kind)){let n=t.event.tags.find(([t,e])=>"d"===t&&e);if(!n)throw new Error("d tag not found or is empty");const r=["a",`${t.event.kind}:${t.event.pubkey}:${n[1]}`];e.tags.push(r)}e.tags.push(["k",t.event.kind.toString()])}return e}function lP(t){let e;try{e=JSON.parse(t)}catch(nD){return"Invalid zap request JSON."}if(!fR(e))return"Zap request is not a valid Nostr event.";if(!TR(e))return"Invalid signature on zap request.";let n=e.tags.find(([t,e])=>"p"===t&&e);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=e.tags.find(([t,e])=>"e"===t&&e);return r&&!r[1].match(/^[a-f0-9]{64}$/)?"Zap request 'e' tag is not valid hex.":e.tags.find(([t,e])=>"relays"===t&&e)?null:"Zap request doesn't have a 'relays' tag."}function cP({zapRequest:t,preimage:e,bolt11:n,paidAt:r}){let i=JSON.parse(t),s=i.tags.filter(([t])=>"e"===t||"p"===t||"a"===t),o={kind:9735,created_at:Math.round(r.getTime()/1e3),content:"",tags:[...s,["P",i.pubkey],["bolt11",n],["description",t]]};return e&&o.tags.push(["preimage",e]),o}function uP(t){if(t.length<50)return 0;const e=(t=t.substring(0,50)).lastIndexOf("1");if(-1===e)return 0;const n=t.substring(0,e);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}}dR({},{Negentropy:()=>vP,NegentropyStorageVector:()=>yP,NegentropySync:()=>_P});var hP=32,dP=class{_raw;length;constructor(t){"number"==typeof t?(this._raw=new Uint8Array(t),this.length=0):t instanceof Uint8Array?(this._raw=new Uint8Array(t),this.length=t.length):(this._raw=new Uint8Array(512),this.length=0)}unwrap(){return this._raw.subarray(0,this.length)}get capacity(){return this._raw.byteLength}extend(t){if(t instanceof dP&&(t=t.unwrap()),"number"!=typeof t.length)throw Error("bad length");const e=t.length+this.length;if(this.capacity<e){const t=this._raw,n=Math.max(2*this.capacity,e);this._raw=new Uint8Array(n),this._raw.set(t)}this._raw.set(t,this.length),this.length+=t.length}shift(){const t=this._raw[0];return this._raw=this._raw.subarray(1),this.length--,t}shiftN(t=1){const e=this._raw.subarray(0,t);return this._raw=this._raw.subarray(t),this.length-=t,e}};function pP(t){let e=0;for(;;){if(0===t.length)throw Error("parse ends prematurely");let n=t.shift();if(e=e<<7|127&n,!(128&n))break}return e}function fP(t){if(0===t)return new dP(new Uint8Array([0]));let e=[];for(;0!==t;)e.push(127&t),t>>>=7;e.reverse();for(let n=0;n<e.length-1;n++)e[n]|=128;return new dP(new Uint8Array(e))}function gP(t,e){if(t.length<e)throw Error("parse ends prematurely");return t.shiftN(e)}var mP=class{buf;constructor(){this.setToZero()}setToZero(){this.buf=new Uint8Array(hP)}add(t){let e=0,n=0,r=new DataView(this.buf.buffer),i=new DataView(t.buffer);for(let s=0;s<8;s++){let t=4*s,o=r.getUint32(t,!0);o+=e,o+=i.getUint32(t,!0),o>4294967295&&(n=1),r.setUint32(t,4294967295&o,!0),e=n,n=0}}negate(){let t=new DataView(this.buf.buffer);for(let n=0;n<8;n++){let e=4*n;t.setUint32(e,~t.getUint32(e,!0))}let e=new Uint8Array(hP);e[0]=1,this.add(e)}getFingerprint(t){let e=new dP;return e.extend(this.buf),e.extend(fP(t)),xk(e.unwrap()).subarray(0,16)}},yP=class{items;sealed;constructor(){this.items=[],this.sealed=!1}insert(t,e){if(this.sealed)throw Error("already sealed");const n=Jk(e);if(n.byteLength!==hP)throw Error("bad id size for added item");this.items.push({timestamp:t,id:n})}seal(){if(this.sealed)throw Error("already sealed");this.sealed=!0,this.items.sort(wP);for(let t=1;t<this.items.length;t++)if(0===wP(this.items[t-1],this.items[t]))throw Error("duplicate item inserted")}unseal(){this.sealed=!1}size(){return this._checkSealed(),this.items.length}getItem(t){if(this._checkSealed(),t>=this.items.length)throw Error("out of range");return this.items[t]}iterate(t,e,n){this._checkSealed(),this._checkBounds(t,e);for(let r=t;r<e&&n(this.items[r],r);++r);}findLowerBound(t,e,n){return this._checkSealed(),this._checkBounds(t,e),this._binarySearch(this.items,t,e,t=>wP(t,n)<0)}fingerprint(t,e){let n=new mP;return n.setToZero(),this.iterate(t,e,t=>(n.add(t.id),!0)),n.getFingerprint(e-t)}_checkSealed(){if(!this.sealed)throw Error("not sealed")}_checkBounds(t,e){if(t>e||e>this.items.length)throw Error("bad range")}_binarySearch(t,e,n,r){let i=n-e;for(;i>0;){let n=e,s=Math.floor(i/2);n+=s,r(t[n])?(e=++n,i-=s+1):i=s}return e}},vP=class{storage;frameSizeLimit;lastTimestampIn;lastTimestampOut;constructor(t,e=6e4){if(e<4096)throw Error("frameSizeLimit too small");this.storage=t,this.frameSizeLimit=e,this.lastTimestampIn=0,this.lastTimestampOut=0}_bound(t,e){return{timestamp:t,id:e||new Uint8Array(0)}}initiate(){let t=new dP;return t.extend(new Uint8Array([97])),this.splitRange(0,this.storage.size(),this._bound(Number.MAX_VALUE),t),Yk(t.unwrap())}reconcile(t,e,n){const r=new dP(Jk(t));this.lastTimestampIn=this.lastTimestampOut=0;let i=new dP;i.extend(new Uint8Array([97]));let s=gP(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 t=new dP,s=()=>{c&&(c=!1,t.extend(this.encodeBound(a)),t.extend(fP(0)))},u=this.decodeBound(r),h=pP(r),d=l,p=this.storage.findLowerBound(l,o,u);if(0===h)c=!0;else if(1===h)0!==bP(gP(r,16),this.storage.fingerprint(d,p))?(s(),this.splitRange(d,p,u,t)):c=!0;else{if(2!==h)throw Error("unexpected mode");{let t=pP(r),i={};for(let e=0;e<t;e++){let t=gP(r,hP);i[Yk(t)]=t}if(c=!0,this.storage.iterate(d,p,t=>{let n=t.id;const r=Yk(n);return i[r]?delete i[Yk(n)]:e?.(r),!0}),n)for(let e of Object.values(i))n(Yk(e))}}if(this.exceededFrameSizeLimit(i.length+t.length)){let t=this.storage.fingerprint(p,o);i.extend(this.encodeBound(this._bound(Number.MAX_VALUE))),i.extend(fP(1)),i.extend(t);break}i.extend(t),l=p,a=u}return 1===i.length?null:Yk(i.unwrap())}splitRange(t,e,n,r){let i=e-t;if(i<32)r.extend(this.encodeBound(n)),r.extend(fP(2)),r.extend(fP(i)),this.storage.iterate(t,e,t=>(r.extend(t.id),!0));else{let s=Math.floor(i/16),o=i%16,a=t;for(let t=0;t<16;t++){let i,l=s+(t<o?1:0),c=this.storage.fingerprint(a,a+l);if(a+=l,a===e)i=n;else{let t,e;this.storage.iterate(a-1,a+1,(n,r)=>(r===a-1?t=n:e=n,!0)),i=this.getMinimalBound(t,e)}r.extend(this.encodeBound(i)),r.extend(fP(1)),r.extend(c)}}}exceededFrameSizeLimit(t){return t>this.frameSizeLimit-200}decodeTimestampIn(t){let e=pP(t);return e=0===e?Number.MAX_VALUE:e-1,this.lastTimestampIn===Number.MAX_VALUE||e===Number.MAX_VALUE?(this.lastTimestampIn=Number.MAX_VALUE,Number.MAX_VALUE):(e+=this.lastTimestampIn,this.lastTimestampIn=e,e)}decodeBound(t){let e=this.decodeTimestampIn(t),n=pP(t);if(n>hP)throw Error("bound key too long");return{timestamp:e,id:gP(t,n)}}encodeTimestampOut(t){if(t===Number.MAX_VALUE)return this.lastTimestampOut=Number.MAX_VALUE,fP(0);let e=t;return t-=this.lastTimestampOut,this.lastTimestampOut=e,fP(t+1)}encodeBound(t){let e=new dP;return e.extend(this.encodeTimestampOut(t.timestamp)),e.extend(fP(t.id.length)),e.extend(t.id),e}getMinimalBound(t,e){if(e.timestamp!==t.timestamp)return this._bound(e.timestamp);{let n=0,r=e.id,i=t.id;for(let t=0;t<hP&&r[t]===i[t];t++)n++;return this._bound(e.timestamp,e.id.subarray(0,n+1))}}};function bP(t,e){for(let n=0;n<t.byteLength;n++){if(t[n]<e[n])return-1;if(t[n]>e[n])return 1}return t.byteLength>e.byteLength?1:t.byteLength<e.byteLength?-1:0}function wP(t,e){return t.timestamp===e.timestamp?bP(t.id,e.id):t.timestamp-e.timestamp}var _P=class{relay;storage;neg;filter;subscription;onhave;onneed;constructor(t,e,n,r={}){this.relay=t,this.storage=e,this.neg=new vP(e),this.onhave=r.onhave,this.onneed=r.onneed,this.filter=n,this.subscription=this.relay.prepareSubscription([{}],{label:r.label||"negentropy"}),this.subscription.oncustom=t=>{switch(t[0]){case"NEG-MSG":t.length<3&&console.warn(`got invalid NEG-MSG from ${this.relay.url}: ${t}`);try{const e=this.neg.reconcile(t[2],this.onhave,this.onneed);e?this.relay.send(`["NEG-MSG", "${this.subscription.id}", "${e}"]`):(this.close(),r.onclose?.())}catch(d8){console.error("negentropy reconcile error:",d8),r?.onclose?.(`reconcile error: ${d8}`)}break;case"NEG-CLOSE":{const e=t[2];console.warn("negentropy error:",e),r.onclose?.(e);break}case"NEG-ERR":r.onclose?.()}}}async start(){const t=this.neg.initiate();this.relay.send(`["NEG-OPEN","${this.subscription.id}",${JSON.stringify(this.filter)},"${t}"]`)}close(){this.relay.send(`["NEG-CLOSE","${this.subscription.id}"]`),this.subscription.close()}};dR({},{getToken:()=>CP,hashPayload:()=>IP,unpackEventFromToken:()=>kP,validateEvent:()=>MP,validateEventKind:()=>RP,validateEventMethodTag:()=>LP,validateEventPayloadTag:()=>PP,validateEventTimestamp:()=>EP,validateEventUrlTag:()=>TP,validateToken:()=>SP});var xP="Nostr ";async function CP(t,e,n,r=!1,i){const s={kind:HT,tags:[["u",t],["method",e]],created_at:Math.round((new Date).getTime()/1e3),content:""};i&&s.tags.push(["payload",IP(i)]);const o=await n(s);return(r?xP:"")+HS.encode(mR.encode(JSON.stringify(o)))}async function SP(t,e,n){return await MP(await kP(t).catch(t=>{throw t}),e,n).catch(t=>{throw t})}async function kP(t){if(!t)throw new Error("Missing token");t=t.replace(xP,"");const e=gR.decode(HS.decode(t));if(!e||0===e.length||!e.startsWith("{"))throw new Error("Invalid token");return JSON.parse(e)}function EP(t){return!!t.created_at&&Math.round((new Date).getTime()/1e3)-t.created_at<60}function RP(t){return t.kind===HT}function TP(t,e){const n=t.tags.find(t=>"u"===t[0]);return!!n&&n.length>0&&n[1]===e}function LP(t,e){const n=t.tags.find(t=>"method"===t[0]);return!!n&&n.length>0&&n[1].toLowerCase()===e.toLowerCase()}function IP(t){return IS(xk(mR.encode(JSON.stringify(t))))}function PP(t,e){const n=t.tags.find(t=>"payload"===t[0]);if(!n)return!1;const r=IP(e);return n.length>0&&n[1]===r}async function MP(t,e,n,r){if(!TR(t))throw new Error("Invalid nostr event, signature invalid");if(!RP(t))throw new Error("Invalid nostr event, kind invalid");if(!EP(t))throw new Error("Invalid nostr event, created_at timestamp invalid");if(!TP(t,e))throw new Error("Invalid nostr event, url tag invalid");if(!LP(t,n))throw new Error("Invalid nostr event, method tag invalid");if(Boolean(r)&&"object"==typeof r&&Object.keys(r).length>0&&!PP(t,r))throw new Error("Invalid nostr event, payload tag does not match request body hash");return!0}var AP=Symbol("verified");new TextDecoder("utf-8");var OP=new TextEncoder;function NP(t){return IS(xk(OP.encode(function(t){if(!function(t){if(!(t instanceof Object))return!1;if("number"!=typeof t.kind)return!1;if("string"!=typeof t.content)return!1;if("number"!=typeof t.created_at)return!1;if("string"!=typeof t.pubkey)return!1;if(!t.pubkey.match(/^[a-f0-9]{64}$/))return!1;if(!Array.isArray(t.tags))return!1;for(let e=0;e<t.tags.length;e++){let n=t.tags[e];if(!Array.isArray(n))return!1;for(let t=0;t<n.length;t++)if("string"!=typeof n[t])return!1}return!0}(t))throw new Error("can't serialize event with wrong or missing properties");return JSON.stringify([0,t.pubkey,t.created_at,t.kind,t.tags,t.content])}(t))))}var FP=new class{generateSecretKey(){return SS.utils.randomPrivateKey()}getPublicKey(t){return IS(SS.getPublicKey(t))}finalizeEvent(t,e){const n=t;return n.pubkey=IS(SS.getPublicKey(e)),n.id=NP(n),n.sig=IS(SS.sign(NP(n),e)),n[AP]=!0,n}verifyEvent(t){if("boolean"==typeof t[AP])return t[AP];const e=NP(t);if(e!==t.id)return t[AP]=!1,!1;try{const n=SS.verify(t.sig,e,t.pubkey);return t[AP]=n,n}catch(nD){return t[AP]=!1,!1}}},zP=FP.generateSecretKey,DP=FP.getPublicKey,jP=FP.finalizeEvent,UP=FP.verifyEvent;function BP(t,e,n){if(Reflect.has(t,e))return Reflect.get(t,e);{const r=n();return Reflect.set(t,e,r),r}}function $P(t,e){const[n,r]=qP(t,t=>e.id===t.id?0:e.created_at===t.created_at?-1:t.created_at-e.created_at);return r||t.splice(n,0,e),t}function qP(t,e){let n=0,r=t.length-1;for(;n<=r;){const i=Math.floor((n+r)/2),s=e(t[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 VP=Symbol.for("event-store"),WP=Symbol.for("event-uid"),HP=Symbol.for("replaceable-address"),GP=Symbol.for("from-cache"),ZP=Symbol.for("replaceable-identifier");function KP(t){return null!=t&&64===t.id?.length&&"string"==typeof t.sig&&"string"==typeof t.pubkey&&64===t.pubkey.length&&"string"==typeof t.content&&Array.isArray(t.tags)&&"number"==typeof t.created_at&&t.created_at>0}function YP(t){return Mx(t)||Ax(t)}function XP(t){return YP(t.kind)?BP(t,HP,()=>JP(t.kind,t.pubkey,tM(t))):null}function JP(t,e,n){return t+":"+e+":"+(n??"")}function QP(t){Reflect.set(t,GP,!0)}function tM(t){return BP(t,ZP,()=>t.tags.find(t=>"d"===t[0])?.[1]??"")}var eM=Symbol.for("encrypted-content"),nM={[LR.EncryptedDirectMessage]:"nip04",[LR.Seal]:"nip44",[LR.GiftWrap]:"nip44"};function rM(t,e){return nM[t]=e,t}function iM(t,e,n){const r=n??nM[t];if(!r)throw new Error(`Event kind ${t} does not support encrypted content`);const i=e[r];if(!i)throw new Error(`Signer does not support ${r} encryption`);return i}var sM=new Set([eM]);function oM(t){return t}function aM(...t){return cM(t.filter(t=>!!t),sM)}function lM(...t){return cM(t.filter(t=>!!t))}function cM(t,e){return 0===t.length?oM:async function(n){return t.reduce(async(t,n)=>{const r=await n(await t);if(e&&"object"==typeof r&&null!==r&&"object"==typeof t&&null!==t){const t=Reflect.ownKeys(r).filter(t=>"symbol"==typeof t);for(const n of t)e.has(n)||Reflect.deleteProperty(r,n)}return r},n)}}function uM(){return Math.round(Date.now()/1e3)}var hM=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&n[t]];return e};function dM(t,e){return void 0!==t[0]&&void 0!==t[1]&&(!e||t[0]===e)}function pM(t){return dM(t,"e")}function fM(t){return dM(t,"p")}function gM(t){return dM(t,"r")}function mM(t){return dM(t,"a")}var yM=(t,...e)=>e.reduce((t,e)=>{const n=[];for(const r of t)try{const t=e(r);if(void 0===t)continue;n.push(t)}catch(d8){}return n},t);function vM(t,e=2){for(let n=(t=t.slice()).length-1;n>=0;n--)void 0!==t[n]&&null!==t[n]&&""!==t[n]||(n+1===t.length&&n>=e?t.pop():t[n]="");return t}jk();var bM=new TextDecoder("utf-8"),wM=(new TextEncoder,5e3);function _M(t){let e={},n=t;for(;n.length>0;){let t=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 ${t}`);e[t]=e[t]||[],e[t].push(i)}return e}function xM(t,e="https:"){return/^[a-zA-Z][a-zA-Z0-9+.-]+:/.test(t)?t:e+"//"+t}function CM(t){const e="string"==typeof t?new URL(xM(t,"http:")):new URL(t);return"ws:"===e.protocol?e.protocol="http:":("wss:"===e.protocol||"http:"!==e.protocol)&&(e.protocol="https:"),"string"==typeof t?e.toString():e}function SM(t){let e=new URL(t);return e.pathname=e.pathname.replace(/\/+/g,"/"),("80"!==e.port||"ws:"!==e.protocol&&"http:"!==e.protocol)&&("443"!==e.port||"wss:"!==e.protocol&&"https:"!==e.protocol)||(e.port=""),"string"==typeof t?e.toString():e}var kM=Symbol.for("seen-relays");function EM(t){return SM(function(t){const e="string"==typeof t?new URL(xM(t,"wss:")):new URL(t);return"http:"===e.protocol?e.protocol="ws:":("https:"===e.protocol||"ws:"!==e.protocol)&&(e.protocol="wss:"),"string"==typeof t?e.toString():e}(t))}function RM(t,e){let n=Reflect.get(t,kM);return n?(n.add(e),n):(n=new Set([e]),Reflect.set(t,kM,n),n)}var TM=/^wss?:\/\/([-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}|localhost)\b([-a-zA-Z0-9()@:%_\+.~#?&\/\/=]*)$/;function LM(t){return t.length>=8&&TM.test(t)}function IM(...t){const e=new Set;for(const n of t)if(n)if("string"==typeof n)try{e.add(EM(n))}catch(d8){}else if(Reflect.has(n,Symbol.iterator))for(const t of n)try{e.add(EM(t))}catch(d8){}return Array.from(e)}function PM(t){return!!t&&64===t.length&&!!t.toLowerCase().match(/^[0-9a-f]{64}$/)}function MM(t,e=!1){const n=t.split(":"),r=n[0]?parseInt(n[0]):void 0,i=n[1];if(void 0===r)return null;if(void 0===i||""===i||!PM(i))return null;const s=n.slice(2).join(":");return e&&""===s?null:{kind:r,pubkey:i,identifier:s}}function AM(t){const e=t[1];if(!e||!PM(e))return null;const n={id:e};return t[2]&&LM(t[2])&&(n.relays=[SM(t[2])]),n}function OM(t){if(!t[1])return null;const e=MM(t[1]);return e?(t[2]&&LM(t[2])&&(e.relays=[SM(t[2])]),e):null}function NM(t){const e=t[1];if(!e||!PM(e))return null;const n={pubkey:e};return t[2]&&LM(t[2])&&(n.relays=[SM(t[2])]),n}function FM(t){return"object"==typeof t&&null!==t&&"id"in t&&"string"==typeof t.id}function zM(t){return t.kind+":"+t.pubkey+":"+t.identifier}function DM(t,e){return FM(e)?t.id===e.id&&(!e.author||t.pubkey===e.author):t.kind===e.kind&&t.pubkey===e.pubkey&&tM(t)===(e.identifier??"")}function jM(t){return vM(["a",zM(t),t.relays?.[0]])}function UM(t){return vM(["e",t.id,t.relays?.[0]])}function BM(t){return vM(["p",t.pubkey,t.relays?.[0]])}var $M=eM,qM=iM,VM=new Set([rM(LR.DraftLong,"nip04")]);function WM(t,e){return VM.add(rM(t,e)),t}function HM(t){return function(t){return void 0!==nM[t]}(t)&&VM.has(t)}function GM(t){if(HM(t.kind))return $M in t?Reflect.get(t,$M):function(t){return Reflect.get(t,eM)}(t)}function ZM(t,e){if(!HM(t.kind))throw new Error("Event kind does not support hidden content");!function(t,e){Reflect.set(t,eM,e),function(t){if(!KP(t))return;const e=function(t){return Reflect.get(t,VP)}(t);e&&e.update(t)}(t)}(t,e)}var KM=Symbol.for("hidden-tags"),YM=new Set([WM(LR.BookmarkList,"nip04"),WM(LR.InterestsList,"nip04"),WM(LR.Mutelist,"nip04"),WM(LR.CommunitiesList,"nip04"),WM(LR.PublicChatsList,"nip04"),WM(LR.SearchRelaysList,"nip04"),WM(10009,"nip04"),WM(LR.Bookmarksets,"nip04"),WM(LR.Relaysets,"nip04"),WM(LR.Followsets,"nip04"),WM(LR.Curationsets,"nip04"),WM(LR.Interestsets,"nip04")]);function XM(t){return HM(t)&&YM.has(t)}function JM(t,e){return YM.add(WM(t,e)),t}function QM(t){return XM(t.kind)&&function(t){return HM(t.kind)&&function(t){return t.content.length>0}(t)}(t)}function tA(t){if(!XM(t.kind))return;if(KM in t)return t[KM];const e=GM(t);if(void 0===e)return;const n=JSON.parse(e);if(!Array.isArray(n))throw new Error("Content is not an array of tags");const r=n.filter(t=>Array.isArray(t)).map(t=>t.map(t=>String(t)));return Reflect.set(t,KM,r),r}var eA=Symbol.for("public-contacts"),nA=Symbol.for("hidden-contacts"),rA=function(t,e){return rA=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},rA(t,e)};function iA(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}rA(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var sA=function(){return sA=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},sA.apply(this,arguments)};function oA(t,e){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=e.call(t,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 aA(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function lA(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,s=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(r=s.next()).done;)o.push(r.value)}catch(d8){i={error:d8}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}return o}function cA(t,e,n){if(n||2===arguments.length)for(var r,i=0,s=e.length;i<s;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}function uA(t){return this instanceof uA?(this.v=t,this):new uA(t)}function hA(t){return"function"==typeof t}function dA(t){var e=t(function(t){Error.call(t),t.stack=(new Error).stack});return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var pA=dA(function(t){return function(e){t(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map(function(t,e){return e+1+") "+t.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=e}});function fA(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var gA=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var e;return t.prototype.unsubscribe=function(){var t,e,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=aA(s),a=o.next();!a.done;a=o.next())a.value.remove(this)}catch(p){t={error:p}}finally{try{a&&!a.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}else s.remove(this);var l=this.initialTeardown;if(hA(l))try{l()}catch(f){i=f instanceof pA?f.errors:[f]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var u=aA(c),h=u.next();!h.done;h=u.next()){var d=h.value;try{vA(d)}catch(nD){i=null!=i?i:[],nD instanceof pA?i=cA(cA([],lA(i)),lA(nD.errors)):i.push(nD)}}}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 pA(i)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)vA(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(e)}},t.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},t.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},t.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&fA(e,t)},t.prototype.remove=function(e){var n=this._finalizers;n&&fA(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=((e=new t).closed=!0,e),t}(),mA=gA.EMPTY;function yA(t){return t instanceof gA||t&&"closed"in t&&hA(t.remove)&&hA(t.add)&&hA(t.unsubscribe)}function vA(t){hA(t)?t():t.unsubscribe()}var bA={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=bA.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,cA([t,e],lA(n))):setTimeout.apply(void 0,cA([t,e],lA(n)))},clearTimeout:function(t){var e=bA.delegate;return((null==e?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function wA(t){bA.setTimeout(function(){throw t})}function _A(){}var xA=CA("C",void 0,void 0);function CA(t,e,n){return{kind:t,value:e,error:n}}function SA(t){t()}var kA=function(t){function e(e){var n=t.call(this)||this;return n.isStopped=!1,e?(n.destination=e,yA(e)&&e.add(n)):n.destination=IA,n}return iA(e,t),e.create=function(t,e,n){return new RA(t,e,n)},e.prototype.next=function(t){this.isStopped?LA(function(t){return CA("N",t,void 0)}(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?LA(function(t){return CA("E",void 0,t)}(t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?LA(xA,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(gA);Function.prototype.bind;var EA=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(d8){TA(d8)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(d8){TA(d8)}else TA(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(d8){TA(d8)}},t}(),RA=function(t){function e(e,n,r){var i,s=t.call(this)||this;return i=hA(e)||!e?{next:null!=e?e:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:e,s.destination=new EA(i),s}return iA(e,t),e}(kA);function TA(t){wA(t)}function LA(){}var IA={closed:!0,next:_A,error:function(t){throw t},complete:_A},PA="function"==typeof Symbol&&Symbol.observable||"@@observable";function MA(t){return t}var AA=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var r,i=this,s=(r=t)&&r instanceof kA||function(t){return t&&hA(t.next)&&hA(t.error)&&hA(t.complete)}(r)&&yA(r)?t:new RA(t,e,n);return SA(function(){var t=i,e=t.operator,n=t.source;s.add(e?e.call(s,n):n?i._subscribe(s):i._trySubscribe(s))}),s},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(nD){t.error(nD)}},t.prototype.forEach=function(t,e){var n=this;return new(e=OA(e))(function(e,r){var i=new RA({next:function(e){try{t(e)}catch(nD){r(nD),i.unsubscribe()}},error:r,complete:e});n.subscribe(i)})},t.prototype._subscribe=function(t){var e;return null===(e=this.source)||void 0===e?void 0:e.subscribe(t)},t.prototype[PA]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return(0===(n=t).length?MA:1===n.length?n[0]:function(t){return n.reduce(function(t,e){return e(t)},t)})(this);var n},t.prototype.toPromise=function(t){var e=this;return new(t=OA(t))(function(t,n){var r;e.subscribe(function(t){return r=t},function(t){return n(t)},function(){return t(r)})})},t.create=function(e){return new t(e)},t}();function OA(t){var e;return null!==(e=null!=t?t:void 0)&&void 0!==e?e:Promise}function NA(t){return function(e){if(function(t){return hA(null==t?void 0:t.lift)}(e))return e.lift(function(e){try{return t(e,this)}catch(nD){this.error(nD)}});throw new TypeError("Unable to lift unknown Observable type")}}function FA(t,e,n,r,i){return new zA(t,e,n,r,i)}var zA=function(t){function e(e,n,r,i,s,o){var a=t.call(this,e)||this;return a.onFinalize=s,a.shouldUnsubscribe=o,a._next=n?function(t){try{n(t)}catch(nD){e.error(nD)}}:t.prototype._next,a._error=i?function(t){try{i(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,a._complete=r?function(){try{r()}catch(nD){e.error(nD)}finally{this.unsubscribe()}}:t.prototype._complete,a}return iA(e,t),e.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}},e}(kA),DA=dA(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),jA=function(t){function e(){var e=t.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return iA(e,t),e.prototype.lift=function(t){var e=new UA(this,this);return e.operator=t,e},e.prototype._throwIfClosed=function(){if(this.closed)throw new DA},e.prototype.next=function(t){var e=this;SA(function(){var n,r;if(e._throwIfClosed(),!e.isStopped){e.currentObservers||(e.currentObservers=Array.from(e.observers));try{for(var i=aA(e.currentObservers),s=i.next();!s.done;s=i.next())s.value.next(t)}catch(o){n={error:o}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}})},e.prototype.error=function(t){var e=this;SA(function(){if(e._throwIfClosed(),!e.isStopped){e.hasError=e.isStopped=!0,e.thrownError=t;for(var n=e.observers;n.length;)n.shift().error(t)}})},e.prototype.complete=function(){var t=this;SA(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var e=t.observers;e.length;)e.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(e){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var e=this,n=this,r=n.hasError,i=n.isStopped,s=n.observers;return r||i?mA:(this.currentObservers=null,s.push(t),new gA(function(){e.currentObservers=null,fA(s,t)}))},e.prototype._checkFinalizedStatuses=function(t){var e=this,n=e.hasError,r=e.thrownError,i=e.isStopped;n?t.error(r):i&&t.complete()},e.prototype.asObservable=function(){var t=new AA;return t.source=this,t},e.create=function(t,e){return new UA(t,e)},e}(AA),UA=function(t){function e(e,n){var r=t.call(this)||this;return r.destination=e,r.source=n,r}return iA(e,t),e.prototype.next=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.next)||void 0===n||n.call(e,t)},e.prototype.error=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.error)||void 0===n||n.call(e,t)},e.prototype.complete=function(){var t,e;null===(e=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===e||e.call(t)},e.prototype._subscribe=function(t){var e,n;return null!==(n=null===(e=this.source)||void 0===e?void 0:e.subscribe(t))&&void 0!==n?n:mA},e}(jA),BA=function(t){function e(e){var n=t.call(this)||this;return n._value=e,n}return iA(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(e){var n=t.prototype._subscribe.call(this,e);return!n.closed&&e.next(this._value),n},e.prototype.getValue=function(){var t=this,e=t.hasError,n=t.thrownError,r=t._value;if(e)throw n;return this._throwIfClosed(),r},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},e}(jA),$A={now:function(){return($A.delegate||Date).now()},delegate:void 0},qA=function(t){function e(e,n,r){void 0===e&&(e=1/0),void 0===n&&(n=1/0),void 0===r&&(r=$A);var i=t.call(this)||this;return i._bufferSize=e,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,e),i._windowTime=Math.max(1,n),i}return iA(e,t),e.prototype.next=function(e){var n=this,r=n.isStopped,i=n._buffer,s=n._infiniteTimeWindow,o=n._timestampProvider,a=n._windowTime;r||(i.push(e),!s&&i.push(o.now()+a)),this._trimBuffer(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var e=this._innerSubscribe(t),n=this._infiniteTimeWindow,r=this._buffer.slice(),i=0;i<r.length&&!t.closed;i+=n?1:2)t.next(r[i]);return this._checkFinalizedStatuses(t),e},e.prototype._trimBuffer=function(){var t=this,e=t._bufferSize,n=t._timestampProvider,r=t._buffer,i=t._infiniteTimeWindow,s=(i?1:2)*e;if(e<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)}},e}(jA),VA=function(t){function e(){return t.call(this)||this}return iA(e,t),e.prototype.schedule=function(t,e){return void 0===e&&(e=0),this},e}(gA),WA={setInterval:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=WA.delegate;return(null==i?void 0:i.setInterval)?i.setInterval.apply(i,cA([t,e],lA(n))):setInterval.apply(void 0,cA([t,e],lA(n)))},clearInterval:function(t){var e=WA.delegate;return((null==e?void 0:e.clearInterval)||clearInterval)(t)},delegate:void 0},HA=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r.pending=!1,r}return iA(e,t),e.prototype.schedule=function(t,e){var n;if(void 0===e&&(e=0),this.closed)return this;this.state=t;var r=this.id,i=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(i,r,e)),this.pending=!0,this.delay=e,this.id=null!==(n=this.id)&&void 0!==n?n:this.requestAsyncId(i,this.id,e),this},e.prototype.requestAsyncId=function(t,e,n){return void 0===n&&(n=0),WA.setInterval(t.flush.bind(t,this),n)},e.prototype.recycleAsyncId=function(t,e,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return e;null!=e&&WA.clearInterval(e)},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(t,e);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t){var e,n=!1;try{this.work(t)}catch(r){n=!0,e=r||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),e},e.prototype.unsubscribe=function(){if(!this.closed){var e=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,fA(r,this),null!=e&&(this.id=this.recycleAsyncId(n,e,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(VA),GA=function(){function t(e,n){void 0===n&&(n=t.now),this.schedulerActionCtor=e,this.now=n}return t.prototype.schedule=function(t,e,n){return void 0===e&&(e=0),new this.schedulerActionCtor(this,t).schedule(n,e)},t.now=$A.now,t}(),ZA=function(t){function e(e,n){void 0===n&&(n=GA.now);var r=t.call(this,e,n)||this;return r.actions=[],r._active=!1,r}return iA(e,t),e.prototype.flush=function(t){var e=this.actions;if(this._active)e.push(t);else{var n;this._active=!0;do{if(n=t.execute(t.state,t.delay))break}while(t=e.shift());if(this._active=!1,n){for(;t=e.shift();)t.unsubscribe();throw n}}},e}(GA),KA=new ZA(HA),YA=KA,XA=new AA(function(t){return t.complete()});function JA(t){return t&&hA(t.schedule)}function QA(t){return t[t.length-1]}function tO(t){return JA(QA(t))?t.pop():void 0}function eO(t,e){return"number"==typeof QA(t)?t.pop():e}var nO=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function rO(t){return hA(null==t?void 0:t.then)}function iO(t){return hA(t[PA])}function sO(t){return Symbol.asyncIterator&&hA(null==t?void 0:t[Symbol.asyncIterator])}function oO(t){return new TypeError("You provided "+(null!==t&&"object"==typeof t?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var aO="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function lO(t){return hA(null==t?void 0:t[aO])}function cO(t){return function(e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=function(){var e,n,r;return oA(this,function(i){switch(i.label){case 0:e=t.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,uA(e.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,uA(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,uA(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}})}.apply(e,n||[]),s=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),o("next"),o("throw"),o("return",function(t){return function(e){return Promise.resolve(e).then(t,c)}}),r[Symbol.asyncIterator]=function(){return this},r;function o(t,e){i[t]&&(r[t]=function(e){return new Promise(function(n,r){s.push([t,e,n,r])>1||a(t,e)})},e&&(r[t]=e(r[t])))}function a(t,e){try{(n=i[t](e)).value instanceof uA?Promise.resolve(n.value.v).then(l,c):u(s[0][2],n)}catch(r){u(s[0][3],r)}var n}function l(t){a("next",t)}function c(t){a("throw",t)}function u(t,e){t(e),s.shift(),s.length&&a(s[0][0],s[0][1])}}(this,arguments)}function uO(t){return hA(null==t?void 0:t.getReader)}function hO(t){if(t instanceof AA)return t;if(null!=t){if(iO(t))return r=t,new AA(function(t){var e=r[PA]();if(hA(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(nO(t))return function(t){return new AA(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}(t);if(rO(t))return n=t,new AA(function(t){n.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,wA)});if(sO(t))return dO(t);if(lO(t))return e=t,new AA(function(t){var n,r;try{for(var i=aA(e),s=i.next();!s.done;s=i.next()){var o=s.value;if(t.next(o),t.closed)return}}catch(a){n={error:a}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.complete()});if(uO(t))return dO(cO(t))}var e,n,r;throw oO(t)}function dO(t){return new AA(function(e){(function(t,e){var n,r,i,s;return function(t,e,n,r){return new(n||(n=Promise))(function(e,i){function s(t){try{a(r.next(t))}catch(e){i(e)}}function o(t){try{a(r.throw(t))}catch(e){i(e)}}function a(t){var r;t.done?e(t.value):(r=t.value,r instanceof n?r:new n(function(t){t(r)})).then(s,o)}a((r=r.apply(t,[])).next())})}(this,0,void 0,function(){var o,a;return oA(this,function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),n=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=aA(t),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise(function(r,i){!function(t,e,n,r){Promise.resolve(r).then(function(e){t({value:e,done:n})},e)}(r,i,(e=t[n](e)).done,e.value)})}}}(t),l.label=1;case 1:return[4,n.next()];case 2:if((r=l.sent()).done)return[3,4];if(o=r.value,e.next(o),e.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 e.complete(),[2]}})})})(t,e).catch(function(t){return e.error(t)})})}function pO(t,e,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var s=e.schedule(function(){n(),i?t.add(this.schedule(null,r)):this.unsubscribe()},r);if(t.add(s),!i)return s}function fO(t,e){return void 0===e&&(e=0),NA(function(n,r){n.subscribe(FA(r,function(n){return pO(r,t,function(){return r.next(n)},e)},function(){return pO(r,t,function(){return r.complete()},e)},function(n){return pO(r,t,function(){return r.error(n)},e)}))})}function gO(t,e){return void 0===e&&(e=0),NA(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function mO(t,e){if(!t)throw new Error("Iterable cannot be null");return new AA(function(n){pO(n,e,function(){var r=t[Symbol.asyncIterator]();pO(n,e,function(){r.next().then(function(t){t.done?n.complete():n.next(t.value)})},0,!0)})})}function yO(t,e){return e?function(t,e){if(null!=t){if(iO(t))return function(t,e){return hO(t).pipe(gO(e),fO(e))}(t,e);if(nO(t))return function(t,e){return new AA(function(n){var r=0;return e.schedule(function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())})})}(t,e);if(rO(t))return function(t,e){return hO(t).pipe(gO(e),fO(e))}(t,e);if(sO(t))return mO(t,e);if(lO(t))return function(t,e){return new AA(function(n){var r;return pO(n,e,function(){r=t[aO](),pO(n,e,function(){var t,e,i;try{e=(t=r.next()).value,i=t.done}catch(nD){return void n.error(nD)}i?n.complete():n.next(e)},0,!0)}),function(){return hA(null==r?void 0:r.return)&&r.return()}})}(t,e);if(uO(t))return function(t,e){return mO(cO(t),e)}(t,e)}throw oO(t)}(t,e):hO(t)}function vO(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return yO(t,tO(t))}function bO(t,e){var n=hA(t)?t:function(){return t},r=function(t){return t.error(n())};return new AA(e?function(t){return e.schedule(r,0,t)}:r)}function wO(t){return!!t&&(t instanceof AA||hA(t.lift)&&hA(t.subscribe))}var _O=dA(function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}});function xO(t,e){var n="object"==typeof e;return new Promise(function(r,i){var s,o=!1;t.subscribe({next:function(t){s=t,o=!0},error:i,complete:function(){o?r(s):n?r(e.defaultValue):i(new _O)}})})}function CO(t,e){var n="object"==typeof e;return new Promise(function(r,i){var s=new RA({next:function(t){r(t),s.unsubscribe()},error:i,complete:function(){n?r(e.defaultValue):i(new _O)}});t.subscribe(s)})}function SO(t){return t instanceof Date&&!isNaN(t)}var kO=dA(function(t){return function(e){void 0===e&&(e=null),t(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=e}});function EO(t,e){var n=SO(t)?{first:t}:"number"==typeof t?{each:t}:t,r=n.first,i=n.each,s=n.with,o=void 0===s?RO:s,a=n.scheduler,l=void 0===a?null!=e?e:KA:a,c=n.meta,u=void 0===c?null:c;if(null==r&&null==i)throw new TypeError("No timeout provided.");return NA(function(t,e){var n,s,a=null,c=0,h=function(t){s=pO(e,l,function(){try{n.unsubscribe(),hO(o({meta:u,lastValue:a,seen:c})).subscribe(e)}catch(nD){e.error(nD)}},t)};n=t.subscribe(FA(e,function(t){null==s||s.unsubscribe(),c++,e.next(a=t),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 RO(t){throw new kO(t)}function TO(t,e){return NA(function(n,r){var i=0;n.subscribe(FA(r,function(n){r.next(t.call(e,n,i++))}))})}var LO=Array.isArray,IO=Array.isArray,PO=Object.getPrototypeOf,MO=Object.prototype,AO=Object.keys;function OO(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=tO(t),r=function(t){return hA(QA(t))?t.pop():void 0}(t),i=function(t){if(1===t.length){var e=t[0];if(IO(e))return{args:e,keys:null};if((r=e)&&"object"==typeof r&&PO(r)===MO){var n=AO(e);return{args:n.map(function(t){return e[t]}),keys:n}}}var r;return{args:t,keys:null}}(t),s=i.args,o=i.keys;if(0===s.length)return yO([],n);var a=new AA(function(t,e,n){return void 0===n&&(n=MA),function(r){NO(e,function(){for(var i=t.length,s=new Array(i),o=i,a=i,l=function(i){NO(e,function(){var l=yO(t[i],e),c=!1;l.subscribe(FA(r,function(t){s[i]=t,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(t){return function(t,e){return t.reduce(function(t,n,r){return t[n]=e[r],t},{})}(o,t)}:MA));return r?a.pipe(function(t){return TO(function(e){return function(t,e){return LO(e)?t.apply(void 0,cA([],lA(e))):t(e)}(t,e)})}(r)):a}function NO(t,e,n){t?pO(n,t,e):e()}function FO(t,e,n){return void 0===n&&(n=1/0),hA(e)?FO(function(n,r){return TO(function(t,i){return e(n,t,r,i)})(hO(t(n,r)))},n):("number"==typeof e&&(n=e),NA(function(e,r){return function(t,e,n,r){var i=[],s=0,o=0,a=!1,l=function(){!a||i.length||s||e.complete()},c=function(t){s++;var a=!1;hO(n(t,o++)).subscribe(FA(e,function(t){e.next(t)},function(){a=!0},void 0,function(){if(a)try{s--;for(var t=function(){var t=i.shift();c(t)};i.length&&s<r;)t();l()}catch(nD){e.error(nD)}}))};return t.subscribe(FA(e,function(t){return s<r?c(t):i.push(t)},function(){a=!0,l()})),function(){}}(e,r,t,n)}))}function zO(t){return void 0===t&&(t=1/0),FO(MA,t)}function DO(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return zO(1)(yO(t,tO(t)))}function jO(t){return new AA(function(e){hO(t()).subscribe(e)})}function UO(t,e,n){void 0===t&&(t=0),void 0===n&&(n=YA);var r=-1;return null!=e&&(JA(e)?n=e:r=e),new AA(function(e){var i=SO(t)?+t-n.now():t;i<0&&(i=0);var s=0;return n.schedule(function(){e.closed||(e.next(s++),0<=r?this.schedule(void 0,r):e.complete())},i)})}function BO(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=tO(t),r=eO(t,1/0),i=t;return i.length?1===i.length?hO(i[0]):zO(r)(yO(i,n)):XA}var $O=new AA(_A),qO=Array.isArray;function VO(t){return 1===t.length&&qO(t[0])?t[0]:t}function WO(t,e){return NA(function(n,r){var i=0;n.subscribe(FA(r,function(n){return t.call(e,n,i++)&&r.next(n)}))})}function HO(t){for(var e,n,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var s=null!==(e=tO(r))&&void 0!==e?e:KA,o=null!==(n=r[0])&&void 0!==n?n:null,a=r[1]||1/0;return NA(function(e,n){var r=[],i=!1,l=function(t){var e=t.buffer;t.subs.unsubscribe(),fA(r,t),n.next(e),i&&c()},c=function(){if(r){var e=new gA;n.add(e);var i={buffer:[],subs:e};r.push(i),pO(e,s,function(){return l(i)},t)}};null!==o&&o>=0?pO(n,s,c,o,!0):i=!0,c();var u=FA(n,function(t){var e,n,i=r.slice();try{for(var s=aA(i),o=s.next();!o.done;o=s.next()){var c=o.value,u=c.buffer;u.push(t),a<=u.length&&l(c)}}catch(h){e={error:h}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.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});e.subscribe(u)})}function GO(t){return NA(function(e,n){var r,i=null,s=!1;i=e.subscribe(FA(n,void 0,void 0,function(o){r=hO(t(o,GO(t)(e))),i?(i.unsubscribe(),i=null,r.subscribe(n)):s=!0})),s&&(i.unsubscribe(),i=null,r.subscribe(n))})}function ZO(t,e,n,r,i){return function(s,o){var a=n,l=e,c=0;s.subscribe(FA(o,function(e){var n=c++;l=a?t(l,e,n):(a=!0,e),r&&o.next(l)},i&&function(){a&&o.next(l),o.complete()}))}}var KO=function(t,e){return t.push(e),t},YO={connector:function(){return new jA}};function XO(t,e){void 0===e&&(e=YO);var n=e.connector;return NA(function(e,r){var i,s=n();hO(t((i=s,new AA(function(t){return i.subscribe(t)})))).subscribe(r),r.add(e.subscribe(s))})}function JO(t){return t<=0?function(){return XA}:NA(function(e,n){var r=0;e.subscribe(FA(n,function(e){++r<=t&&(n.next(e),t<=r&&n.complete())}))})}function QO(){return NA(function(t,e){t.subscribe(FA(e,_A))})}function tN(t,e){return void 0===e&&(e=MA),t=null!=t?t:eN,NA(function(n,r){var i,s=!0;n.subscribe(FA(r,function(n){var o=e(n);!s&&t(i,o)||(s=!1,i=o,r.next(n))}))})}function eN(t,e){return t===e}function nN(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return DO(e,vO.apply(void 0,cA([],lA(t))))}}function rN(t){return NA(function(e,n){try{e.subscribe(n)}finally{n.add(t)}})}function iN(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=tO(t),r=eO(t,1/0);return NA(function(e,i){zO(r)(yO(cA([e],lA(t)),n)).subscribe(i)})}function sN(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return iN.apply(void 0,cA([],lA(t)))}function oN(t){var e,n,r=1/0;return null!=t&&("object"==typeof t?(e=t.count,r=void 0===e?1/0:e,n=t.delay):r=t),r<=0?function(){return XA}:NA(function(t,e){var i,s=0,o=function(){if(null==i||i.unsubscribe(),i=null,null!=n){var t="number"==typeof n?UO(n):hO(n(s)),r=FA(e,function(){r.unsubscribe(),a()});t.subscribe(r)}else a()},a=function(){var n=!1;i=t.subscribe(FA(e,void 0,function(){++s<r?i?o():n=!0:e.complete()})),n&&o()};a()})}function aN(t){var e;void 0===t&&(t=1/0);var n=(e=t&&"object"==typeof t?t:{count:t}).count,r=void 0===n?1/0:n,i=e.delay,s=e.resetOnSuccess,o=void 0!==s&&s;return r<=0?MA:NA(function(t,e){var n,s=0,a=function(){var l=!1;n=t.subscribe(FA(e,function(t){o&&(s=0),e.next(t)},void 0,function(t){if(s++<r){var o=function(){n?(n.unsubscribe(),n=null,a()):l=!0};if(null!=i){var c="number"==typeof i?UO(i):hO(i(t,s)),u=FA(e,function(){u.unsubscribe(),o()},function(){e.complete()});c.subscribe(u)}else o()}else e.error(t)})),l&&(n.unsubscribe(),n=null,a())};a()})}function lN(t,e){return NA(ZO(t,e,arguments.length>=2,!0))}function cN(t){void 0===t&&(t={});var e=t.connector,n=void 0===e?function(){return new jA}:e,r=t.resetOnError,i=void 0===r||r,s=t.resetOnComplete,o=void 0===s||s,a=t.resetOnRefCountZero,l=void 0===a||a;return function(t){var e,r,s,a=0,c=!1,u=!1,h=function(){null==r||r.unsubscribe(),r=void 0},d=function(){h(),e=s=void 0,c=u=!1},p=function(){var t=e;d(),null==t||t.unsubscribe()};return NA(function(t,f){a++,u||c||h();var g=s=null!=s?s:n();f.add(function(){0!==--a||u||c||(r=uN(p,l))}),g.subscribe(f),!e&&a>0&&(e=new RA({next:function(t){return g.next(t)},error:function(t){u=!0,h(),r=uN(d,i,t),g.error(t)},complete:function(){c=!0,h(),r=uN(d,o),g.complete()}}),hO(t).subscribe(e))})(t)}}function uN(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!0!==e){if(!1!==e){var i=new RA({next:function(){i.unsubscribe(),t()}});return hO(e.apply(void 0,cA([],lA(n)))).subscribe(i)}}else t()}function hN(t,e,n){var r,i,s,o,a=!1;return t&&"object"==typeof t?(r=t.bufferSize,o=void 0===r?1/0:r,i=t.windowTime,e=void 0===i?1/0:i,a=void 0!==(s=t.refCount)&&s,n=t.scheduler):o=null!=t?t:1/0,cN({connector:function(){return new qA(o,e,n)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:a})}function dN(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=tO(t);return NA(function(e,r){(n?DO(t,e,n):DO(t,e)).subscribe(r)})}function pN(t,e){return NA(function(n,r){var i=null,s=0,o=!1,a=function(){return o&&!i&&r.complete()};n.subscribe(FA(r,function(n){null==i||i.unsubscribe();var o=0,l=s++;hO(t(n,l)).subscribe(i=FA(r,function(t){return r.next(e?e(n,t,l,o++):t)},function(){i=null,a()}))},function(){o=!0,a()}))})}function fN(t){return NA(function(e,n){hO(t).subscribe(FA(n,function(){return n.complete()},_A)),!n.closed&&e.subscribe(n)})}function gN(t,e){return void 0===e&&(e=!1),NA(function(n,r){var i=0;n.subscribe(FA(r,function(n){var s=t(n,i++);(s||e)&&r.next(n),!s&&r.complete()}))})}function mN(t,e,n){var r=hA(t)||e||n?{next:t,error:e,complete:n}:t;return r?NA(function(t,e){var n;null===(n=r.subscribe)||void 0===n||n.call(r);var i=!0;t.subscribe(FA(e,function(t){var n;null===(n=r.next)||void 0===n||n.call(r,t),e.next(t)},function(){var t;i=!1,null===(t=r.complete)||void 0===t||t.call(r),e.complete()},function(t){var n;i=!1,null===(n=r.error)||void 0===n||n.call(r,t),e.error(t)},function(){var t,e;i&&(null===(t=r.unsubscribe)||void 0===t||t.call(r)),null===(e=r.finalize)||void 0===e||e.call(r)}))}):MA}var yN=o((t,e)=>{var n=1e3,r=60*n,i=60*r,s=24*i,o=7*s;function a(t,e,n,r){var i=e>=1.5*n;return Math.round(t/n)+" "+r+(i?"s":"")}e.exports=function(t,e){e=e||{};var l,c,u=typeof t;if("string"===u&&t.length>0)return function(t){if(!((t=String(t)).length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var a=parseFloat(e[1]);switch((e[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}}}}(t);if("number"===u&&isFinite(t))return e.long?(l=t,(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(t){var e=Math.abs(t);return e>=s?Math.round(t/s)+"d":e>=i?Math.round(t/i)+"h":e>=r?Math.round(t/r)+"m":e>=n?Math.round(t/n)+"s":t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}}),vN=o((t,e)=>{e.exports=function(t){function e(t){let r,i,s,o=null;function a(...t){if(!a.enabled)return;const n=a,i=Number(new Date);n.diff=i-(r||i),n.prev=r,n.curr=i,r=i,t[0]=e.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");let s=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,(r,i)=>{if("%%"===r)return"%";s++;const o=e.formatters[i];if("function"==typeof o){const e=t[s];r=o.call(n,e),t.splice(s,1),s--}return r}),e.formatArgs.call(n,t),(n.log||e.log).apply(n,t)}return a.namespace=t,a.useColors=e.useColors(),a.color=e.selectColor(t),a.extend=n,a.destroy=e.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(i!==e.namespaces&&(i=e.namespaces,s=e.enabled(t)),s),set:t=>{o=t}}),"function"==typeof e.init&&e.init(a),a}function n(t,n){const r=e(this.namespace+(void 0===n?":":n)+t);return r.log=this.log,r}function r(t,e){let n=0,r=0,i=-1,s=0;for(;n<t.length;)if(r<e.length&&(e[r]===t[n]||"*"===e[r]))"*"===e[r]?(i=r,s=n,r++):(n++,r++);else{if(-1===i)return!1;r=i+1,s++,n=s}for(;r<e.length&&"*"===e[r];)r++;return r===e.length}return e.debug=e,e.default=e,e.coerce=function(t){return t instanceof Error?t.stack||t.message:t},e.disable=function(){const t=[...e.names,...e.skips.map(t=>"-"+t)].join(",");return e.enable(""),t},e.enable=function(t){e.save(t),e.namespaces=t,e.names=[],e.skips=[];const n=("string"==typeof t?t:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const r of n)"-"===r[0]?e.skips.push(r.slice(1)):e.names.push(r)},e.enabled=function(t){for(const n of e.skips)if(r(t,n))return!1;for(const n of e.names)if(r(t,n))return!0;return!1},e.humanize=yN(),e.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(t).forEach(n=>{e[n]=t[n]}),e.names=[],e.skips=[],e.formatters={},e.selectColor=function(t){let n=0;for(let e=0;e<t.length;e++)n=(n<<5)-n+t.charCodeAt(e),n|=0;return e.colors[Math.abs(n)%e.colors.length]},e.enable(e.load()),e}}),bN=o((t,e)=>{t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,t=>{"%%"!==t&&(r++,"%c"===t&&(i=r))}),t.splice(i,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(d8){}},t.load=function(){let e;try{e=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch(d8){}return!e&&"undefined"!=typeof process&&"env"in process&&(e={}.DEBUG),e},t.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 t;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&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(d8){}}(),t.destroy=(()=>{let t=!1;return()=>{t||(t=!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`."))}})(),t.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"],t.log=console.debug||console.log||(()=>{}),e.exports=vN()(t);var{formatters:n}=e.exports;n.j=function(t){try{return JSON.stringify(t)}catch(d8){return"[UnexpectedJSONParseError]: "+d8.message}}}),wN=c(bN(),1),_N=(0,wN.default)("applesauce"),xN=_N.extend("event-cache"),CN=Symbol("expiration-timestamp");function SN(t){return BP(t,CN,()=>{const e=t.tags.find(t=>"expiration"===t[0])?.[1];return e?parseInt(e):void 0})}var kN=o((t,e)=>{e.exports=function t(e,n){if(e===n)return!0;if(e&&n&&"object"==typeof e&&"object"==typeof n){if(e.constructor!==n.constructor)return!1;var r,i,s;if(Array.isArray(e)){if((r=e.length)!=n.length)return!1;for(i=r;0!==i--;)if(!t(e[i],n[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if((r=(s=Object.keys(e)).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(!t(e[o],n[o]))return!1}return!0}return e!=e&&n!=n}}),EN=c(kN(),1),RN="abcdefghijklmnopqrstuvwxyz",TN=new Set((RN+RN.toUpperCase()).split("")),LN=Symbol.for("indexable-tags");function IN(t){let e=Reflect.get(t,LN);if(!e){const n=new Set;for(const e of t.tags)e.length>=2&&1===e[0].length&&TN.has(e[0])&&n.add(e[0]+":"+e[1]);e=n,Reflect.set(t,LN,n)}return e}function PN(t,e){if(t.ids&&-1===t.ids.indexOf(e.id))return!1;if(t.kinds&&-1===t.kinds.indexOf(e.kind))return!1;if(t.authors&&-1===t.authors.indexOf(e.pubkey))return!1;if(t.since&&e.created_at<t.since)return!1;if(t.until&&e.created_at>t.until)return!1;for(let n in t)if("&"===n[0]){let r=n.slice(1),i=t[n];if(i&&i.length>0){const t=IN(e);for(const e of i)if(!t.has(r+":"+e))return!1}}for(let n in t)if("#"===n[0]){let r=n.slice(1),i=t[n];if(i){const n=t[`&${r}`],s=n?i.filter(t=>!n.includes(t)):i;if(0===s.length)continue;const o=IN(e);if(!1===s.some(t=>o.has(r+":"+t)))return!1}}return!0}function MN(t,e){for(let n=0;n<t.length;n++)if(PN(t[n],e))return!0;return!1}function AN(t,e){return(0,EN.default)(t,e)}var ON=class{first=null;items=Object.create(null);last=null;max;resetTtl;size;ttl;constructor(t=0,e=0,n=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=n,this.size=0,this.ttl=e}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(t){if(this.has(t)){const e=this.items[t];delete this.items[t],this.size--,null!==e.prev&&(e.prev.next=e.next),null!==e.next&&(e.next.prev=e.prev),this.first===e&&(this.first=e.next),this.last===e&&(this.last=e.prev)}return this}entries(t=this.keys()){return t.map(t=>[t,this.get(t)])}evict(t=!1){if(t||this.size>0){const t=this.first;delete this.items[t.key],0===--this.size?(this.first=null,this.last=null):(this.first=t.next,this.first.prev=null)}return this}expiresAt(t){let e;return this.has(t)&&(e=this.items[t].expiry),e}get(t){let e;if(this.has(t)){const n=this.items[t];this.ttl>0&&n.expiry<=Date.now()?this.delete(t):(e=n.value,this.set(t,e,!0))}return e}has(t){return t in this.items}keys(){const t=[];let e=this.first;for(;null!==e;)t.push(e.key),e=e.next;return t}set(t,e,n=!1,r=this.resetTtl){let i;if(n||this.has(t)){if(i=this.items[t],i.value=e,!1===n&&r&&(i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==i){const t=this.last,e=i.next,n=i.prev;this.first===i&&(this.first=i.next),i.next=null,i.prev=this.last,t.next=i,null!==n&&(n.next=e),null!==e&&(e.prev=n)}}else this.max>0&&this.size===this.max&&this.evict(!0),i=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e},1===++this.size?this.first=i:this.last.next=i;return this.last=i,this}values(t=this.keys()){return t.map(t=>this.get(t))}},NN=Symbol.for("mailboxes-inboxes"),FN=Symbol.for("mailboxes-outboxes");function zN(t){return BP(t,NN,()=>{const e=[];for(const n of t.tags)if(gM(n))try{const[,t,r]=n;!t||!LM(t)||e.includes(t)||"read"!==r&&void 0!==r||e.push(SM(t))}catch{}return e})}function DN(t){return BP(t,FN,()=>{const e=[];for(const n of t.tags)if(gM(n))try{const[t,r,i]=n;"r"!==t||!LM(r)||e.includes(r)||"write"!==i&&void 0!==i||e.push(SM(r))}catch{}return e})}var jN=Symbol.for("profile-content");function UN(t){return BP(t,jN,()=>{const e=function(t){try{return JSON.parse(t)}catch(d8){return}}(t.content);if(e)return e.nip05&&"string"!=typeof e.nip05&&(e.nip05=String(e.nip05)),e.website&&e.website?.length>0&&!1===e.website?.startsWith("http")&&(e.website="https://"+e.website),e})}function BN(t){return!(!t||t.kind!==LR.Metadata&&t.kind!==LR.Handlerinformation||!UN(t))}function $N(t,e){return Object.fromEntries(Array.from(Object.entries(t)).map(([t,n])=>[t,{authors:n.map(t=>t.pubkey),...e}]))}function qN(t,e,n=!0){return async r=>{const i="string"==typeof t?{pubkey:t}:{...t};if(!i.relays?.[0]&&e){const t="string"==typeof e?e:await e(i.pubkey);t&&(i.relays=[t])}return n&&(r=r.filter(t=>!("p"===t[0]&&t[1]===i.pubkey))),[...r,BM(i)]}}function VN(t,e=!0){return n=>function(t,e,n=!0){const r=t.find(t=>t[0]===e[0]);return r?n?t.map(t=>t===r?e:t):t:[...t,e]}(n,t,e)}function WN(t,e=!0){return HN(VN(t,e))}function HN(...t){return async e=>({...e,tags:await lM(...t)(Array.from(e.tags))})}function GN(t,...e){return 0===(e=e.filter(t=>!!t)).length?t=>t:async n=>{if(!t)throw new Error("Missing signer for hidden tags");if(!XM(n.kind))throw new Error("Event kind does not support hidden tags");let r,i;if(QM(n)?(i=tA(n),void 0===i&&(QM(n)?(r=await t.getPublicKey(),i=await async function(t,e,n){if(!XM(t.kind))throw new Error("Event kind does not support hidden tags");if(function(t){if(!XM(t.kind))return!1;try{return KM in t||function(t){return!!HM(t.kind)&&function(t){return!0===Reflect.has(t,eM)}(t)&&!0===Reflect.has(t,$M)}(t)&&void 0!==tA(t)}catch{}return!1}(t))return t[KM];await async function(t,e,n){if(!HM(t.kind))throw new Error("Event kind does not support hidden content");if($M in t)return Reflect.get(t,$M);const r=await iM(t.kind,e,n).decrypt(t.pubkey,t.content);return ZM(t,r),r}(t,e,n);const r=tA(t);if(void 0===r)throw new Error("Failed to unlock hidden tags");return function(t,e){if(!XM(t.kind))throw new Error("Event kind does not support hidden tags");Reflect.set(t,KM,e),ZM(t,JSON.stringify(e))}(t,r),r}({...n,pubkey:r},t)):i=[])):i=[],void 0===i)throw new Error("Failed to find hidden tags");const s=await lM(...e)(i),o=function(t,e){return qM(t,e)}(n.kind,t);r||(r=await t.getPublicKey());const a=JSON.stringify(s),l=await o.encrypt(r,a);return{...n,content:l,[eM]:a}}}function ZN(t){return WN(["alt",t])}function KN(t){return WN(["expiration",t.toString()],!0)}function YN(t=!0){return HN(t?VN(["-"]):t=>t.filter(t=>!("-"===t[0])))}function XN(t){return async e=>{if(!t)throw new Error("Missing signer");Reflect.deleteProperty(e,"id"),Reflect.deleteProperty(e,"sig");const n=await t.getPublicKey(),r={...e,pubkey:n};return Reflect.has(e,eM)&&Reflect.set(r,eM,Reflect.get(e,eM)),r}}function JN(t){const e=Ax(t)?[["d",hM()]]:[];return{kind:t,created_at:uM(),tags:e,content:""}}var QN=class t extends Promise{static fromKind(e){return new t(t=>t({kind:e,created_at:uM(),tags:[],content:""}))}static fromEvent(e){return new t(t=>t(function(t){return{kind:t.kind,created_at:uM(),tags:Array.from(t.tags),content:t.content}}(e)))}_signerRef={};get signer(){return this._signerRef.signer}set signer(t){this._signerRef.signer=t}chain(t){const e=new(0,this.constructor)(e=>e(this.then(async e=>{const n=await t(e);for(const t of Reflect.ownKeys(n))"symbol"!=typeof t||sM.has(t)||Reflect.deleteProperty(n,t);return n})));return e._signerRef=this._signerRef,e}as(t){return this._signerRef.signer=t,this}strip(){return new t(t=>t(this.then(t=>({content:t.content,tags:t.tags,created_at:t.created_at,kind:t.kind}))))}stamp(e=this.signer){return new t((t,n)=>{if(!e)return n(new Error("Signer required for stamping"));t(this.then(t=>XN(e)(t)))})}async sign(t=this.signer){if(!t)throw new Error("Missing signer");this.signer||(this.signer=t);const e=await(this),n=await function(t){return async e=>{if(!t)throw new Error("Missing signer");const n=await XN(t)(e),r=await t.signEvent(n);if(Reflect.has(e,"pubkey")&&Reflect.get(e,"pubkey")!==r.pubkey)throw new Error("Signer modified pubkey");if(!Ox(r,e.kind))throw new Error("Signer modified event kind");return Reflect.has(e,eM)&&Reflect.set(r,eM,Reflect.get(e,eM)),r}}(t)(e);if(Reflect.has(e,"pubkey")&&Reflect.get(e,"pubkey")!==n.pubkey)throw new Error("Signer modified pubkey");if(Ox(n,e.kind))return n;throw new Error("Signer modified event kind")}kind(e){return new t(t=>({...t,kind:e}))}content(t){return this.chain(e=>({...e,content:t}))}created(t=uM()){return t instanceof Date&&(t=Math.floor(t.getTime()/1e3)),this.chain(e=>({...e,created_at:t}))}meta(t){return this.chain(function(t){return aM(t?.protected?YN(!0):t=>t,t?.expiration?KN(t.expiration):t=>t,t?.alt?ZN(t.alt):t=>t)}(t))}alt(t){return this.chain(ZN(t))}expiration(t){return this.chain(KN(t))}contentWarning(t){return this.chain(function(t){return e=>{let n=Array.from(e.tags);return n=n.filter(t=>"content-warning"!==t[0]),"string"==typeof t?n.push(["content-warning",t]):!0===t&&n.push(["content-warning"]),{...e,tags:n}}}(t))}protected(t){return this.chain(YN(t))}modifyTags(...t){let e;return e=this.chain(n=>function(t,e){let n=[],r=[];return void 0===t?n=r=[]:Array.isArray(t)?n=t:"function"==typeof t?n=[t]:("function"==typeof t.public?n=[t.public]:t.public&&(n=t.public),"function"==typeof t.hidden?r=[t.hidden]:t.hidden&&(r=t.hidden)),aM(n.length>0?HN(...n):void 0,r.length>0?GN(e,...r):void 0)}(t[0],e.signer)(n)),e}modifyPublicTags(...t){return this.chain(HN(...t))}modifyHiddenTags(...t){let e;return e=this.chain(n=>GN(e.signer,...t)(n)),e}encryptedContent(t,e,n){let r;return r=this.chain(i=>{const s=r.signer;if(!s)throw new Error("Signer required for encrypted content");return function(t,e,n,r){return async i=>{if(!n)throw new Error("Signer required for encrypted content");const s=await iM(i.kind,n,r).encrypt(t,e);return{...i,content:s,[eM]:e}}}(t,e,s,n)(i)}),r}},tF=o((t,e)=>{function n(t,e){var n,r;if(0===e.length)return t;for(n=0,r=e.length;n<r;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t<0?-2*t:t}function r(t,e,i,s){var o,a=n(n(n(t,i),(o=e,Object.prototype.toString.call(o))),typeof e);if(null===e)return n(a,"null");if(void 0===e)return n(a,"undefined");if("object"==typeof e||"function"==typeof e){if(-1!==s.indexOf(e))return n(a,"[Circular]"+i);s.push(e);var l=function(t,e,n){return Object.keys(e).sort().reduce(function(t,i){return r(t,e[i],i,n)},t)}(a,e,s);if(!("valueOf"in e)||"function"!=typeof e.valueOf)return l;try{return n(l,String(e.valueOf()))}catch(nD){return n(l,"[valueOf exception]"+(nD.stack||nD.message))}}return n(a,e.toString())}e.exports=function(t){return function(t){for(;t.length<8;)t="0"+t;return t}(r(0,t,"",[]).toString(16))}}),eF=c(tF(),1),nF=class{deleted$;deletedSubject=new jA;deletedIds=new Map;deletedIdentifiers=new Map;constructor(){this.deleted$=this.deletedSubject.asObservable()}add(t){if(t.kind!==LR.EventDeletion)return[];const e=t.pubkey,n=[],r=function(t){return t.tags.filter(pM).map(AM).filter(t=>null!==t).map(e=>(e.author=t.pubkey,e))}(t);if(r.length>0){let i=this.deletedIds.get(e);i||(i=new Set,this.deletedIds.set(e,i));for(const e of r){i.add(e.id);const r={pointer:e,until:t.created_at};n.push(r),this.deletedSubject.next(r)}}const i=function(t){return t.tags.filter(mM).map(OM).filter(t=>null!==t).filter(e=>e.pubkey===t.pubkey)}(t);if(i.length>0){let r=this.deletedIdentifiers.get(e);r||(r=new Map,this.deletedIdentifiers.set(e,r));for(const e of i){const i=e.kind+"|"+e.identifier;r.set(i,t.created_at);const s={pointer:e,until:t.created_at};n.push(s),this.deletedSubject.next(s)}}return n}check(t){const e=t.pubkey;if(Mx(t.kind)||Ax(t.kind)){const n=this.deletedIdentifiers.get(e);if(!n)return!1;const r=tM(t),i=t.kind+"|"+r,s=n.get(i);return void 0!==s&&s>=t.created_at}{const n=this.deletedIds.get(e);return!!n&&n.has(t.id)}}filter(t){return t.filter(t=>!1===this.check(t))}},rF=class{log=_N.extend("EventMemory");kinds=new Map;authors=new Map;tags=new ON;created_at=[];kindAuthor=new Map;events=new ON;replaceable=new Map;get size(){return this.events.size}hasEvent(t){return this.events.has(t)}getEvent(t){return this.events.get(t)}hasReplaceable(t,e,n){const r=this.replaceable.get(JP(t,e,n));return!!r&&r.length>0}getReplaceable(t,e,n){const r=JP(t,e,n);return this.replaceable.get(r)?.[0]}getReplaceableHistory(t,e,n){const r=JP(t,e,n);return this.replaceable.get(r)}getByFilters(t){return Array.from(this.getEventsForFilters(Array.isArray(t)?t:[t]))}getTimeline(t){const e=[],n=this.getByFilters(t);for(const r of n)$P(e,r);return e}add(t){const e=t.id,n=this.events.get(e);if(n)return n;this.events.set(e,t),this.getKindIndex(t.kind).add(t),this.getAuthorsIndex(t.pubkey).add(t),this.getKindAuthorIndex(t.kind,t.pubkey).add(t);for(const r of IN(t))this.tags.has(r)&&this.getTagIndex(r).add(t);if($P(this.created_at,t),YP(t.kind)){const e=t.tags.find(t=>"d"===t[0])?.[1],n=JP(t.kind,t.pubkey,e);let r=this.replaceable.get(n);this.replaceable.has(n)||(r=[],this.replaceable.set(n,r)),$P(r,t)}return t}remove(t){let e="string"==typeof t?this.events.get(t):t;if(!e)return!1;const n=e.id;if(!this.events.has(n))return!1;const r=this.authors.get(e.pubkey);r&&(r.delete(e),0===r.size&&this.authors.delete(e.pubkey));const i=this.kinds.get(e.kind);i&&(i.delete(e),0===i.size&&this.kinds.delete(e.kind));const s=`${e.kind}:${e.pubkey}`,o=this.kindAuthor.get(s);o&&(o.delete(e),0===o.size&&this.kindAuthor.delete(s));for(const a of IN(e))if(this.tags.has(a)){const t=this.getTagIndex(a);t.delete(e),0===t.size&&this.tags.delete(a)}if(this.removeFromSortedArray(this.created_at,e),this.events.delete(n),YP(e.kind)){const t=e.tags.find(t=>"d"===t[0])?.[1],n=JP(e.kind,e.pubkey,t),r=this.replaceable.get(n);r&&(this.removeFromSortedArray(r,e),0===r.length&&this.replaceable.delete(n))}return this.claims.delete(e),!0}removeByFilters(t){const e=this.getByFilters(t);let n=0;for(const r of e)this.remove(r)&&n++;return n}update(t){}claims=new WeakMap;touch(t){this.events.has(t.id)&&this.events.set(t.id,t)}claim(t){const e=this.claims.get(t)||0;this.claims.set(t,e+1),this.touch(t)}isClaimed(t){const e=this.claims.get(t);return void 0!==e&&e>0}removeClaim(t){const e=this.claims.get(t);if(void 0!==e&&e>0){const n=e-1;0===n?this.claims.delete(t):this.claims.set(t,n)}}clearClaim(t){this.claims.delete(t)}*unclaimed(){let t=this.events.first;for(;t;){const e=t.value;this.isClaimed(e)||(yield e),t=t.next}return 0}prune(t){let e=0;const n=this.unclaimed();for(const r of n)if(this.remove(r),e++,t&&e>=t)break;return e}getKindIndex(t){return this.kinds.has(t)||this.kinds.set(t,new Set),this.kinds.get(t)}getAuthorsIndex(t){return this.authors.has(t)||this.authors.set(t,new Set),this.authors.get(t)}getKindAuthorIndex(t,e){const n=`${t}:${e}`;return this.kindAuthor.has(n)||this.kindAuthor.set(n,new Set),this.kindAuthor.get(n)}getTagIndex(t){if(!this.tags.has(t)){const e=new Set,n=Date.now();for(const i of this.events.values())IN(i).has(t)&&e.add(i);const r=Date.now()-n;r>100&&this.log(`Built index ${t} took ${r}ms`),this.tags.set(t,e)}return this.tags.get(t)}removeFromSortedArray(t,e){if(0===t.length)return;const n=qP(t,t=>t.created_at-e.created_at);if(n){let r=n[0],i=!1;if(t[r]===e)return void t.splice(r,1);for(let n=r-1;n>=0&&t[n].created_at===e.created_at;n--)if(t[n]===e){t.splice(n,1),i=!0;break}if(i)return;for(let n=r+1;n<t.length&&t[n].created_at===e.created_at;n++)if(t[n]===e)return void t.splice(n,1)}const r=t.indexOf(e);-1!==r&&t.splice(r,1)}*iterateAuthors(t){for(const e of t){const t=this.authors.get(e);if(t)for(const e of t)yield e}}*iterateTag(t,e){for(const n of e){const e=this.getTagIndex(t+":"+n);if(e)for(const t of e)yield t}}*iterateKinds(t){for(const e of t){const t=this.kinds.get(e);if(t)for(const e of t)yield e}}*iterateTime(t,e){if(0===this.created_at.length)return;let n=0,r=this.created_at.length-1,i=e?qP(this.created_at,t=>t.created_at-e):void 0;i&&(n=Math.max(0,Math.min(i[0],this.created_at.length-1)));const s=t?qP(this.created_at,e=>e.created_at-t):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!==e&&n.created_at>e)){if(void 0!==t&&n.created_at<t)break;yield n}}}*iterateIds(t){for(const e of t)this.events.has(e)&&(yield this.events.get(e))}getEventsForFilter(t){if(t.search)return new Set;let e=!0,n=new Set;const r=t=>{const r=t instanceof Set?t:new Set(t);if(e)n=r,e=!1;else for(const e of n)r.has(e)||n.delete(e);return n};t.ids&&r(this.iterateIds(t.ids));let i=null;void 0!==t.since&&(i=Array.from(this.iterateTime(t.since,t.until)),r(i));for(const s of TN){const e=t[`&${s}`];if(e?.length)for(const t of e)r(this.iterateTag(s,[t]))}for(const s of TN){const e=t[`#${s}`];if(e?.length){const n=t[`&${s}`],i=n?e.filter(t=>!n.includes(t)):e;i.length>0&&r(this.iterateTag(s,i))}}if(t.authors&&t.kinds&&t.authors.length*t.kinds.length<=20){const e=new Set;for(const n of t.kinds)for(const r of t.authors){const t=`${n}:${r}`,i=this.kindAuthor.get(t);if(i)for(const n of i)e.add(n)}r(e)}else t.authors&&r(this.iterateAuthors(t.authors)),t.kinds&&r(this.iterateKinds(t.kinds));if(void 0===t.since&&void 0!==t.until&&(i=Array.from(this.iterateTime(t.since,t.until)),r(i)),e)return new Set(this.events.values());if(t.limit&&i){const e=new Set;for(const r of i){if(e.size>=t.limit)break;n.has(r)&&e.add(r)}return e}return n}getEventsForFilters(t){if(0===t.length)return new Set;let e=new Set;for(const n of t){const t=this.getEventsForFilter(n);for(const n of t)e.add(n)}return e}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 iF(t){return e=>{const n=new Set;return e.pipe(mN(e=>{if(void 0!==e)if(Array.isArray(e))for(const r of e)n.has(r)||(n.add(r),t.claim(r));else n.has(e)||(n.add(e),t.claim(e))}),rN(()=>{for(const e of n)t.removeClaim(e)}))}}function sF(t){return e=>{let n;return e.pipe(mN(e=>{n!==e&&(n&&t.removeClaim(n),e&&t.claim(e),n=e)}),rN(()=>{n&&t.removeClaim(n)}))}}function oF(t,e){return pN(n=>n?vO(n):t.eventLoader?yO(t.eventLoader(e)).pipe(dN(void 0)):vO(n))}function aF(t){return"string"==typeof t&&(t={id:t}),e=>BO(jO(()=>function(t,e){const n=t.getEvent(e.id);return n instanceof Promise?yO(n):vO(n)}(e,t)).pipe(e.eventLoader?oF(e,t):MA),e.insert$.pipe(WO(e=>e.id===t.id)),e.remove$.pipe(WO(e=>e.id===t.id),JO(1),TO(()=>{}))).pipe(tN((t,e)=>t?.id===e?.id),sF(e))}function lF(t){return e=>{let n;return BO(jO(()=>function(t,e){const n=t.getReplaceable(e.kind,e.pubkey,e.identifier);return n instanceof Promise?yO(n):vO(n)}(e,t)).pipe(e.eventLoader?oF(e,t):MA),e.insert$.pipe(WO(e=>e.pubkey==t.pubkey&&e.kind===t.kind&&(void 0===t.identifier||tM(e)===t.identifier)))).pipe(mN(t=>n=t),sN(e.remove$.pipe(WO(t=>t.id===n?.id),TO(()=>{}))),tN((t,e)=>void 0===t||void 0===e?t===e:e.created_at<t.created_at),sF(e))}}function cF(t,e){return t=Array.isArray(t)?t:[t],n=>{const r=new Map,i=t=>e?t.id:function(t){let e=Reflect.get(t,WP);return e||(e=YP(t.kind)?XP(t)??t.id:t.id,Reflect.set(t,WP,e)),e}(t);return jO(()=>{const e=n.getTimeline(t);return e instanceof Promise?yO(e):vO(e)}).pipe(iF(n),sN(n.insert$.pipe(WO(e=>MN(t,e)),iF(n))),sN(n.remove$.pipe(WO(e=>MN(t,e)),TO(t=>t.id))),lN((t,n)=>{if("string"==typeof n){const e=t.find(t=>t.id===n);if(e){const t=i(e);r.get(t)?.id===n&&r.delete(t)}return t.filter(t=>t.id!==n)}if(Array.isArray(n)){r.clear();for(const t of n)r.set(i(t),t);return[...n]}let s=[...t];const o=i(n),a=r.get(o);if(a&&(!YP(n.kind)||!e&&n.created_at<a.created_at))return[...t];if(!e&&YP(n.kind)){if(r.set(o,n),a){const t=s.indexOf(a);-1!==t&&s.splice(t,1)}}else r.set(o,n);return $P(s,n),s},[]),tN(),rN(()=>r.clear()))}}function uF(t,e=!1){return t=Array.isArray(t)?t:[t],n=>{const r=e?XA:jO(()=>function(t,e){const n=t.getByFilters(e);return n instanceof Promise?yO(n).pipe(FO(t=>yO(t))):yO(n)}(n,t));return BO(r,n.insert$.pipe(WO(e=>MN(t,e))))}}function hF(t){return"string"==typeof t&&(t={pubkey:t}),e=>{return e.replaceable({kind:LR.Contacts,pubkey:t.pubkey,relays:t.relays}).pipe((n=e,t=>{let e;return BO(t.pipe(mN(t=>e=t)),n.update$.pipe(WO(t=>t.id===e?.id)))}),TO(t=>{return t?function(...t){const e=new Map;for(const n of t)if(Array.isArray(n))for(const t of n)t&&e.set(t.pubkey,t);else n&&e.set(n.pubkey,n);return Array.from(e.values())}(function(t){return BP(t,eA,()=>yM(t.tags,t=>fM(t)?t:void 0,t=>NM(t)??void 0))}(e=t),function(t){if(nA in t)return t[nA];const e=tA(t);if(!e)return;const n=yM(e,t=>fM(t)?t:void 0,t=>NM(t)??void 0);return Reflect.set(t,nA,n),n}(e)):[];var e}));var n}}function dF(t){return"string"==typeof t&&(t={pubkey:t}),e=>e.replaceable({kind:LR.RelayList,pubkey:t.pubkey,relays:t.relays}).pipe(TO(t=>t&&{inboxes:zN(t),outboxes:DN(t)}))}function pF(t){return"string"==typeof t&&(t={pubkey:t}),e=>e.replaceable({kind:LR.Metadata,pubkey:t.pubkey,relays:t.relays}).pipe(WO(BN),TO(t=>t&&UN(t)))}var fF=class{models=new Map;modelKeepWarm=6e4;destroy$=new qA(1);model(t,...e){let n=this.models.get(t);n||(n=new Map,this.models.set(t,n));const r=t.getKey?t.getKey(...e):(0,eF.default)(e);let i=n.get(r);if(!i){const s=()=>{n.get(r)===i&&n.delete(r)};i=t(...e)(this).pipe(rN(s),cN({connector:()=>new qA(1),resetOnComplete:()=>BO(UO(this.modelKeepWarm),this.destroy$),resetOnRefCountZero:()=>BO(UO(this.modelKeepWarm),this.destroy$)}),fN(this.destroy$)),n.set(r,i)}return i}filters(t,e=!1){return Array.isArray(t)||(t=[t]),this.model(uF,t,e)}event(t){return"string"==typeof t||FM(t)?this.model(aF,t):this.replaceable(t)}replaceable(...t){let e;if(1===t.length)e=t[0];else if(3===t.length||2===t.length){let[n,r,i]=t;e={kind:n,pubkey:r,identifier:i}}if(!e)throw new Error("Invalid arguments, expected address pointer or kind, pubkey, identifier");return this.model(lF,e)}addressable(t){return this.replaceable(t)}timeline(t,e=!1){return this.model(cF,t,e)}profile(t){return this.model(pF,t)}contacts(t){return"string"==typeof t&&(t={pubkey:t}),this.model(hF,t)}mailboxes(t){return"string"==typeof t&&(t={pubkey:t}),this.model(dF,t)}dispose(){this.destroy$.next(),this.destroy$.complete()}},gF=class{expired$;expiredSubject;expirations=new Map;timer=null;nextCheck=null;constructor(){this.expiredSubject=new jA,this.expired$=this.expiredSubject.asObservable()}track(t){const e=SN(t);if(!e||!Number.isFinite(e))return;const n=uM();if(e<=n)return;if(this.expirations.set(t.id,e),this.timer&&this.nextCheck&&this.nextCheck<=e)return;this.timer&&clearTimeout(this.timer);const r=e-n;r>0&&(this.timer=setTimeout(this.emitNotifications.bind(this),1e3*r+10),this.nextCheck=e)}forget(t){this.expirations.delete(t)}check(t){const e=SN(t);return!!e&&e<=uM()}dispose(){this.timer&&clearTimeout(this.timer),this.timer=null,this.nextCheck=null,this.expirations.clear(),this.expiredSubject.complete()}[Symbol.dispose](){this.dispose()}emitNotifications(){const t=uM();let e=1/0;for(const[n,r]of this.expirations)r<=t?(this.expirations.delete(n),this.expiredSubject.next(n)):r<e&&(e=r);if(e!==1/0){this.timer&&clearTimeout(this.timer),this.nextCheck=null,this.timer=null;const n=e-t;n>0&&(this.timer=setTimeout(this.emitNotifications.bind(this),1e3*n+10),this.nextCheck=e)}}},mF=class t extends fF{database;memory;deletes;expiration;keepOldVersions=!1;keepExpired=!1;keepDeleted=!1;_verifyEventMethod=UP;get verifyEvent(){return this._verifyEventMethod}set verifyEvent(t){this._verifyEventMethod=t,void 0===t&&console.warn("[applesauce-core] EventStore.verifyEvent is undefined; signature checks are disabled.")}insert$=new jA;update$=new jA;remove$=new jA;eventLoader;internalSubscriptions=new gA;constructor(t){super(),t?.database?(this.database=t.database,this.memory=new rF):this.database=this.memory=new rF,void 0!==t?.keepDeleted&&(this.keepDeleted=t.keepDeleted),void 0!==t?.keepExpired&&(this.keepExpired=t.keepExpired),void 0!==t?.keepOldVersions&&(this.keepOldVersions=t.keepOldVersions),t?.verifyEvent&&(this.verifyEvent=t.verifyEvent),this.deletes=t?.deleteManager??new nF,this.internalSubscriptions.add(this.deletes.deleted$.subscribe(this.handleDeleteNotification.bind(this))),this.expiration=t?.expirationManager??new gF,this.internalSubscriptions.add(this.expiration.expired$.subscribe(this.handleExpiredNotification.bind(this)))}mapToMemory(t){if(void 0!==t)return this.memory?this.memory.add(t):t}handleDeleteNotification({pointer:t,until:e}){if(!this.keepDeleted)if(FM(t)){const n=this.getEvent(t.id);n&&e>=n.created_at&&DM(n,t)&&this.remove(n)}else if(function(t){return"object"==typeof t&&null!==t&&"identifier"in t&&"pubkey"in t&&"kind"in t&&"string"==typeof t.identifier&&"string"==typeof t.pubkey&&"number"==typeof t.kind}(t)){const n=this.getReplaceableHistory(t.kind,t.pubkey,t.identifier);if(n)for(const r of n)e>=r.created_at&&DM(r,t)&&this.remove(r)}}handleExpiredNotification(t){this.keepExpired||this.remove(t)}static copySymbolsToDuplicateEvent(t,e){if(t.kind!==e.kind)throw new Error("Source and destination events must have the same kind");if((n=t.kind)<1e4&&0!==n&&3!==n&&t.id!==e.id)throw new Error("Source and destination events must have the same ID");var n;if(YP(t.kind)&&t.pubkey!==e.pubkey&&tM(t)!==tM(e))throw new Error("Source and destination events must have the same pubkey and replaceable identifier");let r=!1;const i=(s=t,Reflect.get(s,kM));var s;if(i){for(const t of i)RM(e,t);r=!0}const o=[GP,AP,eM];for(const a of o)a in t&&!(a in e)&&(Reflect.set(e,a,Reflect.get(t,a)),r=!0);return r}add(e,n){if(e.kind===LR.EventDeletion)return this.deletes.add(e),e;if(this.deletes.check(e))return e;const r=SN(e);if(!1===this.keepExpired&&r&&r<=uM())return null;n&&RM(e,n);const i=YP(e.kind)?tM(e):void 0;if(!1===this.keepOldVersions&&YP(e.kind)){const n=this.database.getReplaceableHistory(e.kind,e.pubkey,i);if(n&&n.length>0){let r=n[0];for(const t of n)(t.created_at>r.created_at||t.created_at===r.created_at&&t.id<r.id)&&(r=t);if(!(e.created_at>r.created_at||e.created_at===r.created_at&&e.id<r.id))return t.copySymbolsToDuplicateEvent(e,r)&&this.update(r),r}}if(this.verifyEvent&&!1===this.verifyEvent(e))return null;const s=this.memory.add(e);if(s&&s!==e)return t.copySymbolsToDuplicateEvent(e,s)&&this.update(s),s;const o=this.mapToMemory(this.database.add(e));if(o===e?(Reflect.set(o,VP,this),this.insert$.next(o)):t.copySymbolsToDuplicateEvent(e,o)&&this.update(o),!1===this.keepOldVersions&&YP(e.kind)){const t=this.database.getReplaceableHistory(e.kind,e.pubkey,i);if(t&&t.length>0){let e=t[0];for(const r of t)(r.created_at>e.created_at||r.created_at===e.created_at&&r.id<e.id)&&(e=r);const n=t.filter(t=>t!==e);for(const t of n)this.remove(t);if(n.length>0)return e}}return!1===this.keepExpired&&void 0!==r&&this.expiration.track(o),o}remove(t){const e="string"==typeof t?t:t.id;let n=this.memory.getEvent(e);this.expiration.forget(e),n&&Reflect.deleteProperty(n,VP),this.memory!==this.database&&this.memory.remove(t);const r=this.database.remove(t);return r&&n&&this.remove$.next(n),r}removeByFilters(t){const e=this.getByFilters(t);for(const r of e)this.expiration.forget(r.id);this.memory!==this.database&&this.memory.removeByFilters(t);const n=this.database.removeByFilters(t);for(const r of e)this.remove$.next(r);return n}update(t){return!!this.database.add(t)&&(this.database.update?.(t),this.update$.next(t),!0)}hasEvent(t){return"string"==typeof t?this.memory.hasEvent(t)||this.database.hasEvent(t):FM(t)?this.memory.hasEvent(t.id)||this.database.hasEvent(t.id):this.hasReplaceable(t.kind,t.pubkey,t.identifier)}getEvent(t){return"string"==typeof t?this.memory.getEvent(t)??this.mapToMemory(this.database.getEvent(t)):FM(t)?this.memory.getEvent(t.id)??this.mapToMemory(this.database.getEvent(t.id)):this.getReplaceable(t.kind,t.pubkey,t.identifier)}hasReplaceable(t,e,n){return this.memory.hasReplaceable(t,e,n)||this.database.hasReplaceable(t,e,n)}getReplaceable(t,e,n){return this.memory.getReplaceable(t,e,n)??this.mapToMemory(this.database.getReplaceable(t,e,n))}getReplaceableHistory(t,e,n){return this.memory.getReplaceableHistory(t,e,n)??this.database.getReplaceableHistory(t,e,n)?.map(t=>this.mapToMemory(t)??t)}getByFilters(t){const e=this.database.getByFilters(t);return this.memory?e.map(t=>this.mapToMemory(t)):e}getTimeline(t){const e=this.database.getTimeline(t);return this.memory?e.map(t=>this.mapToMemory(t)):e}touch(t){return this.memory.touch(t)}claim(t){return this.memory.claim(t)}isClaimed(t){return this.memory.isClaimed(t)??!1}removeClaim(t){return this.memory.removeClaim(t)}clearClaim(t){return this.memory.clearClaim(t)}unclaimed(){return this.memory.unclaimed()||function*(){}()}prune(t){return this.memory.prune(t)??0}dispose(){const t=this.eventLoader;t&&"function"==typeof t[Symbol.dispose]&&t[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 yF(t,e=!0){return n=>{const r=n.pipe(cN());return r.pipe(FO(e=>{if("string"==typeof e)return XA;const n=t.add(e);return n instanceof Promise?yO(n):vO(n)}),GO(()=>vO(null)),WO(t=>null!==t),e?NA(function(t,e){var n=new Set;t.subscribe(FA(e,function(t){var r=t;n.has(r)||(n.add(r),e.next(t))}))}):MA,sN(r.pipe(WO(t=>"string"==typeof t))))}}function vF(t){return yF(t,!0)}var bF=class extends Error{};function wF(t,e){return EO({first:t,with:()=>bO(()=>new bF(e??"Timeout"))})}function _F(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&"Uint8Array"===t.constructor.name&&"BYTES_PER_ELEMENT"in t&&1===t.BYTES_PER_ELEMENT}var xF=t=>t?`"${t}" `:"";function CF(t,e,n=""){if(_F(t)&&(void 0===e||t.length===e))return t;void 0!==e&&function(t,e=""){if("number"!=typeof t)throw new TypeError(xF(e)+"expected number, got "+typeof t);if(!Number.isSafeInteger(t)||t<0)throw new RangeError(xF(e)+"expected integer >= 0, got "+t)}(e,"length");const r=_F(t),i=void 0!==e?` of length ${e}`:"",s=r?`length=${t.length}`:"type="+typeof t,o=xF(n)+"expected Uint8Array"+i+", got "+s;if(!r)throw new TypeError(o);throw new RangeError(o)}var SF=(t,e)=>{if(null===t||"object"!=typeof t||Array.isArray(t))throw new TypeError(("object"===e?"":`"${e}" `)+"expected object, got type="+typeof t)};function kF(t,e=!0){if(t.destroyed)throw new Error("hash was destroyed");if(e&&t.finished)throw new Error("digest() was already called")}function EF(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function RF(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function TF(t,e){return t<<32-e|t>>>e}function LF(t,e={}){if("function"!=typeof t)throw new TypeError('"hashCons" expected function, got type='+typeof t);e=function(t,e,n="opts"){return SF(t,"defaults"),void 0!==e&&SF(e,n),Object.assign(t,e)}({},e,"info");const n=(e,n)=>t(n).update(e).digest(),r=t(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.canXOF=r.canXOF,n.create=e=>t(e),Object.assign(n,e),Object.freeze(n)}var IF=t=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,t])});function PF(t,e,n){return t&e^~t&n}function MF(t,e,n){return t&e^t&n^e&n}var AF=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,e,n,r){this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(t),this.view=RF(this.buffer)}update(t){kF(this),CF(t);const{view:e,buffer:n,blockLen:r}=this,i=t.length;let s=!1;for(let o=0;o<i;){const a=Math.min(r-this.pos,i-o);if(a===r){const e=RF(t);for(;r<=i-o;o+=r)this.process(e,o);s=!0;continue}n.set(0===o&&a===i?t:t.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===r&&(this.process(e,0),this.pos=0,s=!0)}return this.length+=t.length,s&&this.roundClean(),this}digestInto(t){kF(this),function(t,e){CF(t,void 0,"output");const n=e.outputLen;if(!(t.length>=n))throw new RangeError('"output" expected length >= '+n)}(t,this),this.finished=!0;const{buffer:e,view:n,blockLen:r,isLE:i}=this;let{pos:s}=this;e[s++]=128,e.fill(0,s),this.padOffset>r-s&&(this.process(n,0),e.fill(0)),function(t,e,n,r){const i=(t=>t/2**32|0)(n),s=(t=>t>>>0)(n);t.setUint32(e,r?s:i,r),t.setUint32(e+4,r?i:s,r)}(n,r-8,8*this.length,i),this.process(n,0),this.roundClean();const o=t===e?n:RF(t),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:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}_cloneIntoMeta(t){const{buffer:e,length:n,finished:r,destroyed:i,pos:s}=this;return t.destroyed=i,t.finished=r,t.length=n,t.pos=s,s&&t.buffer.set(e),t}clone(){return this._cloneInto()}},OF=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),NF=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]),FF=new Uint32Array(64),zF=class extends AF{A=0;B=0;C=0;D=0;E=0;F=0;G=0;H=0;constructor(t,e){super(64,t,8,!1),this.A=0|e[0],this.B=0|e[1],this.C=0|e[2],this.D=0|e[3],this.E=0|e[4],this.F=0|e[5],this.G=0|e[6],this.H=0|e[7]}get(){const{A:t,B:e,C:n,D:r,E:i,F:s,G:o,H:a}=this;return[t,e,n,r,i,s,o,a]}set(t,e,n,r,i,s,o,a){this.A=0|t,this.B=0|e,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(t){return(t||=new this.constructor).set(...this.get()),this._cloneIntoMeta(t)}process(t,e){for(let u=0;u<16;u++,e+=4)FF[u]=t.getUint32(e,!1);for(let u=16;u<64;u++){const t=FF[u-15],e=FF[u-2],n=TF(t,7)^TF(t,18)^t>>>3,r=TF(e,17)^TF(e,19)^e>>>10;FF[u]=r+FF[u-7]+n+FF[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 t=c+(TF(o,6)^TF(o,11)^TF(o,25))+PF(o,a,l)+NF[u]+FF[u]|0,e=(TF(n,2)^TF(n,13)^TF(n,22))+MF(n,r,i)|0;c=l,l=a,a=o,o=s+t|0,s=i,i=r,r=n,n=t+e|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(){EF(FF)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),EF(this.buffer)}},DF=class extends zF{constructor(){super(32,OF)}},jF=LF(()=>new DF,IF(1)),UF=new WeakMap;function BF(t,e,n,r){let i={configurable:!0,enumerable:!0,writable:!0,initializer:null};r&&(i.initializer=r);for(let s of n)i=s(t,e,i)||i;void 0===i.initializer?Object.defineProperty(t,e,i):function(t,e,n){let r=UF.get(t);r||(r=new Map,UF.set(t,r)),r.set(e,n)}(t,e,i)}function $F(t,e,n){let r={...Object.getOwnPropertyDescriptor(t,e)};for(let i of n)r=i(t,e,r)||r;void 0!==r.initializer&&(r.value=r.initializer?r.initializer.call(t):void 0,r.initializer=void 0),Object.defineProperty(t,e,r)}function qF(t,e){let n=function(t,e){var n;let r=t.prototype;for(;r;){let t=null==(n=UF.get(r))?void 0:n.get(e);if(t)return t;r=Object.getPrototypeOf(r)}}(t.constructor,e);n&&Object.defineProperty(t,e,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(t):void 0})}var VF=a({DEFAULT_BLOSSOM_SERVER:()=>WF,default:()=>GF}),WF="https://blossom.nostr.build";function HF(t,e){let n=t||"https://blossom.nostr.build";return n.endsWith("/")&&(n=n.slice(0,-1)),e.startsWith("/")?`${n}${e}`:`${n}/${e}`}var GF=class extends fp{static{BF(this.prototype,"nostrAuth",[pp])}#N=void qF(this,"nostrAuth");static{BF(this.prototype,"nostrData",[pp])}#F=void qF(this,"nostrData");static{BF(this.prototype,"settings",[pp])}#z=void qF(this,"settings");get servers(){const t=this.nostrData.blossomServers,e=t.length?t:[WF];return this.settings.nostrPhotoFallbackUploads?e:[e[0]]}async _getAuthHeader(t,e,n){const r=Math.floor(Date.now()/1e3),i=new URL(n).hostname,s=await QN.fromKind(24242).content("upload"===t?"Upload photo for place":"Delete photo").modifyPublicTags(()=>[["t",t],["x",e],["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(t,e,n,r){const i=HF(n,"upload");r&&r("signing");const s=await this._getAuthHeader("upload",e,n);r&&r("uploading");const o=await fetch(i,{method:"PUT",headers:{Authorization:s,"X-SHA-256":e},body:t});if(!o.ok){const t=await o.text();throw new Error(`Upload failed (${o.status}): ${t}`)}return o.json()}async upload(t,e={sequential:!1}){if(!this.nostrAuth.isConnected)throw new Error("Not connected");const n=await t.arrayBuffer();let r;r="undefined"!=typeof crypto&&crypto.subtle&&crypto.subtle.digest?await crypto.subtle.digest("SHA-256",n):jF(new Uint8Array(n));const i=function(t){return Array.from(new Uint8Array(t)).map(t=>t.toString(16).padStart(2,"0")).join("")}(r),s=this.servers,o=s[0],a=s.slice(1),l=[];let c;if(e.sequential){c=await this._uploadToServer(t,i,o,e.onProgress);for(const n of a)try{const r=await this._uploadToServer(t,i,n,e.onProgress);l.push(r.url)}catch(d8){console.warn(`Fallback upload to ${n} failed:`,d8)}}else{const n=this._uploadToServer(t,i,o,e.onProgress),r=a.map(n=>this._uploadToServer(t,i,n,e.onProgress));c=await n;const s=await Promise.allSettled(r);for(let t=0;t<s.length;t++){const e=s[t];"fulfilled"===e.status?l.push(e.value.url):console.warn(`Fallback upload to ${a[t]} failed:`,e.reason)}}return{url:c.url,fallbackUrls:l,hash:i,type:t.type}}async _deleteFromServer(t,e){const n=HF(e,t),r=await this._getAuthHeader("delete",t,e),i=await fetch(n,{method:"DELETE",headers:{Authorization:r}});if(!i.ok){const t=await i.text();throw new Error(t||i.statusText)}}async delete(t){if(!this.nostrAuth.isConnected)throw new Error("Not connected");const e=this.servers,n=e[0],r=e.slice(1),i=this._deleteFromServer(t,n),s=r.map(e=>this._deleteFromServer(t,e));await i;const o=await Promise.allSettled(s);for(let a=0;a<o.length;a++){const t=o[a];"rejected"===t.status&&console.warn(`Fallback delete from ${r[a]} failed:`,t.reason)}}},ZF=a({ContributionEntry:()=>YF,groupPhotoContributions:()=>JF}),KF=3600,YF=class{type="photo";placeIdentifier;osmType;osmId;photos;createdAt;eventCount;static{BF(this.prototype,"placeName",[Wr],function(){return null})}#D=void qF(this,"placeName");static{BF(this.prototype,"placeNameLoading",[Wr],function(){return!0})}#j=void qF(this,"placeNameLoading");constructor({placeIdentifier:t,osmType:e,osmId:n,photos:r,createdAt:i,eventCount:s}){this.placeIdentifier=t,this.osmType=e,this.osmId=n,this.photos=r,this.createdAt=i,this.eventCount=s}};function XF(t){const e=t.tags||[],n=e.filter(t=>"t"===t[0]).map(t=>t[1]).filter(Boolean),r=e.find(t=>"imeta"===t[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[t,e]=p.substring(4).split("x").map(Number);t&&e&&(l=t/e,t>e&&(a=!0))}else if(p.startsWith("alt ")){const t=p.substring(4).trim();c="A photo of a place"===t?null:t||null}if(!i)return null;const u=e.find(t=>"i"===t[0])?.[1],h=e.find(t=>"published_at"===t[0])?.[1],d=h?Number(h):null;return{eventId:t.id,pubkey:t.pubkey,createdAt:t.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 JF(t,e=3){if(!t||0===t.length)return[];const n=function(t){const e=new Set;for(const n of t)if(5===n.kind)for(const t of n.tags||[])"e"===t[0]&&t[1]&&e.add(t[1]);return t.filter(t=>360===t.kind&&!e.has(t.id))}(t);if(0===n.length)return[];const r=new Map;for(const o of n){const t=(o.tags||[]).find(t=>"i"===t[0])?.[1];t&&(r.has(t)||r.set(t,[]),r.get(t).push(o))}const i=e*KF,s=[];for(const[o,a]of r){const t=[...a].sort((t,e)=>e.created_at-t.created_at);let e=[],n=null;for(const r of t)null!==n&&n-r.created_at>i&&(s.push(QF(o,e)),e=[]),e.push(r),n=r.created_at;e.length>0&&s.push(QF(o,e))}return s.filter(t=>t.photos.length>0).sort((t,e)=>e.createdAt-t.createdAt)}function QF(t,e){const n=e.map(XF).filter(Boolean).sort((t,e)=>t.createdAt-e.createdAt),r=e.reduce((t,e)=>e.created_at>t?e.created_at:t,0),[,i,s]=t.split(":");return new YF({placeIdentifier:t,osmType:i,osmId:s,photos:n,createdAt:r,eventCount:e.length})}var tz=a({default:()=>nz}),ez="contributions-name-cache",nz=class extends fp{static{BF(this.prototype,"nostrData",[pp])}#F=void qF(this,"nostrData");static{BF(this.prototype,"nostrAuth",[pp])}#N=void qF(this,"nostrAuth");static{BF(this.prototype,"storage",[pp])}#U=void qF(this,"storage");static{BF(this.prototype,"osm",[pp])}#B=void qF(this,"osm");static{BF(this.prototype,"localForage",[pp])}#$=void qF(this,"localForage");static{BF(this.prototype,"items",[Wr],function(){return[]})}#q=void qF(this,"items");_sub=null;_pendingBatchPromise=null;_lastBatchSignature="";_unresolvable=new Set;async _resolveCachedName(t){const e=this.storage.findPlaceById(t.osmId);return e?.title?e.title:await this.localForage.get(ez,t.placeIdentifier)||(await this.osm.getCachedOsmObject(t.osmType,t.osmId))?.title||null}async _resolveFromCache(t){const e=t.filter(t=>t.placeNameLoading);0!==e.length?(await Promise.all(e.map(async t=>{const e=await this._resolveCachedName(t);e&&(t.placeName=e,t.placeNameLoading=!1)})),this.items=[...this.items],this._maybeBatchFetchNames(this.items)):this._maybeBatchFetchNames(this.items)}async load(t){t?(this._sub=this.nostrData.store.timeline([{kinds:[360,5],authors:[t]}]).subscribe(t=>{this._updateItems(t)}),await this.nostrData.loadMyContributions(t)):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(t){const e=JF(t);for(const n of e){const t=this.storage.findPlaceById(n.osmId);t?.title&&(n.placeName=t.title,n.placeNameLoading=!1)}this.items=e,this._resolveFromCache(e)}_isUnresolvable(t){return this._unresolvable.has(t.placeIdentifier)}_maybeBatchFetchNames(t){const e=t.filter(t=>t.placeNameLoading&&!this._isUnresolvable(t));for(const r of t)r.placeNameLoading&&this._isUnresolvable(r)&&(r.placeName=this._fallbackName(r),r.placeNameLoading=!1);if(0===e.length)return void(this.items.some(t=>!t.placeNameLoading)&&(this.items=[...this.items]));const n=e.map(t=>t.placeIdentifier).sort().join("|");n===this._lastBatchSignature&&this._pendingBatchPromise||(this._lastBatchSignature=n,this._pendingBatchPromise=this._batchResolveNames(e).then(t=>{for(const e of this.items)e.placeNameLoading&&(t.has(e.placeIdentifier)?(e.placeName=t.get(e.placeIdentifier),e.placeNameLoading=!1):(this._unresolvable.add(e.placeIdentifier),e.placeName=this._fallbackName(e),e.placeNameLoading=!1));this.items=[...this.items]}).catch(t=>{console.error("[contributions] Batch name resolution failed",t);for(const e of this.items)e.placeNameLoading&&(this._unresolvable.add(e.placeIdentifier),e.placeName=this._fallbackName(e),e.placeNameLoading=!1);this.items=[...this.items]}).finally(()=>{this._pendingBatchPromise=null}))}_fallbackName(t){return`OSM ${t.osmType} ${t.osmId}`}async _batchResolveNames(t){const e=new Map,n=[];for(const s of t){const t=await this._resolveCachedName(s);t?e.set(s.placeIdentifier,t):n.push({osmType:s.osmType,osmId:s.osmId})}if(0===n.length)return e;const r=await this.osm.fetchOsmObjectsBatch(n),i=[];for(const s of t){if(e.has(s.placeIdentifier))continue;const t=`${s.osmType}:${s.osmId}`,n=r.get(t);n?.title&&(e.set(s.placeIdentifier,n.title),i.push(this.localForage.set(ez,s.placeIdentifier,n.title)))}return await Promise.all(i),e}};function rz(t){return new Worker("/assets/image-processor-TE4QOxly.js",{name:t?.name})}var iz=a({default:()=>sz}),sz=class extends fp{_worker=null;_callbacks=new Map;_msgId=0;constructor(){super(...arguments),this._initWorker()}_initWorker(){if(!this._worker&&void 0!==rz)try{this._worker=new rz,this._worker.onmessage=this._handleMessage.bind(this),this._worker.onerror=this._handleError.bind(this)}catch(t){console.warn("Failed to initialize image-processor worker:",t)}}_handleMessage(t){const{id:e,success:n,blob:r,dim:i,blurhash:s,error:o}=t.data,a=this._callbacks.get(e);a&&(this._callbacks.delete(e),n?a.resolve({blob:r,dim:i,blurhash:s}):a.reject(new Error(o)))}_handleError(t){console.error("Image Processor Worker Error:",t);for(const[,e]of this._callbacks.entries())e.reject(new Error("Worker crashed"));this._callbacks.clear(),this._worker.terminate(),this._worker=null,this._initWorker()}_getImageDimensions(t){return new Promise((e,n)=>{const r=new Image,i=URL.createObjectURL(t);r.onload=()=>{const t={width:r.width,height:r.height};URL.revokeObjectURL(i),e(t)},r.onerror=()=>{URL.revokeObjectURL(i),n(new Error("Could not read image dimensions"))},r.src=i})}async process(t,e,n,r=!1){if(!this._worker)throw new Error("Image processor worker is not available.");try{const{width:i,height:s}=await this._getImageDimensions(t);let o=i,a=s;return i>s?i>e&&(a=Math.round(s*(e/i)),o=e):s>e&&(o=Math.round(i*(e/s)),a=e),new Promise((e,i)=>{const s=++this._msgId;this._callbacks.set(s,{resolve:e,reject:i}),this._worker.postMessage({type:"PROCESS_IMAGE",id:s,file:t,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()}},oz=o((t,e)=>{!function(n){"object"==typeof t&&void 0!==e?e.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 t(e,n,r){function i(o,a){if(!n[o]){if(!e[o]){var l="function"==typeof u&&u;if(!a&&l)return l(o,!0);if(s)return s(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var h=n[o]={exports:{}};e[o][0].call(h.exports,function(t){return i(e[o][1][t]||t)},h,h.exports,t,e,n,r)}return n[o].exports}for(var s="function"==typeof u&&u,o=0;o<r.length;o++)i(r[o]);return i}({1:[function(t,e){(function(t){var n,r,i=t.MutationObserver||t.WebKitMutationObserver;if(i){var s=0,o=new i(u),a=t.document.createTextNode("");o.observe(a,{characterData:!0}),n=function(){a.data=s=++s%2}}else if(t.setImmediate||void 0===t.MessageChannel)n="document"in t&&"onreadystatechange"in t.document.createElement("script")?function(){var e=t.document.createElement("script");e.onreadystatechange=function(){u(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},t.document.documentElement.appendChild(e)}:function(){setTimeout(u,0)};else{var l=new t.MessageChannel;l.port1.onmessage=u,n=function(){l.port2.postMessage(0)}}var c=[];function u(){var t,e;r=!0;for(var n=c.length;n;){for(e=c,c=[],t=-1;++t<n;)e[t]();n=c.length}r=!1}e.exports=function(t){1!==c.push(t)||r||n()}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(t,e){var n=t(1);function r(){}var i={},s=["REJECTED"],o=["FULFILLED"],a=["PENDING"];function l(t){if("function"!=typeof t)throw new TypeError("resolver must be a function");this.state=a,this.queue=[],this.outcome=void 0,t!==r&&d(this,t)}function c(t,e,n){this.promise=t,"function"==typeof e&&(this.onFulfilled=e,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function u(t,e,r){n(function(){var n;try{n=e(r)}catch(s){return i.reject(t,s)}n===t?i.reject(t,new TypeError("Cannot resolve promise with itself")):i.resolve(t,n)})}function h(t){var e=t&&t.then;if(t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof e)return function(){e.apply(t,arguments)}}function d(t,e){var n=!1;function r(e){n||(n=!0,i.reject(t,e))}function s(e){n||(n=!0,i.resolve(t,e))}var o=p(function(){e(s,r)});"error"===o.status&&r(o.value)}function p(t,e){var n={};try{n.value=t(e),n.status="success"}catch(r){n.status="error",n.value=r}return n}e.exports=l,l.prototype.catch=function(t){return this.then(null,t)},l.prototype.then=function(t,e){if("function"!=typeof t&&this.state===o||"function"!=typeof e&&this.state===s)return this;var n=new this.constructor(r);return this.state!==a?u(n,this.state===o?t:e,this.outcome):this.queue.push(new c(n,t,e)),n},c.prototype.callFulfilled=function(t){i.resolve(this.promise,t)},c.prototype.otherCallFulfilled=function(t){u(this.promise,this.onFulfilled,t)},c.prototype.callRejected=function(t){i.reject(this.promise,t)},c.prototype.otherCallRejected=function(t){u(this.promise,this.onRejected,t)},i.resolve=function(t,e){var n=p(h,e);if("error"===n.status)return i.reject(t,n.value);var r=n.value;if(r)d(t,r);else{t.state=o,t.outcome=e;for(var s=-1,a=t.queue.length;++s<a;)t.queue[s].callFulfilled(e)}return t},i.reject=function(t,e){t.state=s,t.outcome=e;for(var n=-1,r=t.queue.length;++n<r;)t.queue[n].callRejected(e);return t},l.resolve=function(t){return t instanceof this?t:i.resolve(new this(r),t)},l.reject=function(t){var e=new this(r);return i.reject(e,t)},l.all=function(t){var e=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var n=t.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(t[l],l);return c;function u(t,r){e.resolve(t).then(function(t){o[r]=t,++a!==n||s||(s=!0,i.resolve(c,o))},function(t){s||(s=!0,i.reject(c,t))})}},l.race=function(t){var e=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var n=t.length,s=!1;if(!n)return this.resolve([]);for(var o=-1,a=new this(r);++o<n;)l(t[o]);return a;function l(t){e.resolve(t).then(function(t){s||(s=!0,i.resolve(a,t))},function(t){s||(s=!0,i.reject(a,t))})}}},{1:1}],3:[function(t){(function(e){"function"!=typeof e.Promise&&(e.Promise=t(2))}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(t,e){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},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(t){return}}();function i(t,e){t=t||[],e=e||{};try{return new Blob(t,e)}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<t.length;r+=1)n.append(t[r]);return n.getBlob(e.type)}}"undefined"==typeof Promise&&t(3);var s=Promise;function o(t,e){e&&t.then(function(t){e(null,t)},function(t){e(t)})}function a(t,e,n){"function"==typeof e&&t.then(e),"function"==typeof n&&t.catch(n)}function l(t){return"string"!=typeof t&&(console.warn(t+" used as a key, but it is not a string."),t=String(t)),t}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(t){for(var e=t.length,n=new ArrayBuffer(e),r=new Uint8Array(n),i=0;i<e;i++)r[i]=t.charCodeAt(i);return n}function y(t){var e=d[t.name],n={};n.promise=new s(function(t,e){n.resolve=t,n.reject=e}),e.deferredOperations.push(n),e.dbReady?e.dbReady=e.dbReady.then(function(){return n.promise}):e.dbReady=n.promise}function v(t){var e=d[t.name].deferredOperations.pop();if(e)return e.resolve(),e.promise}function b(t,e){var n=d[t.name].deferredOperations.pop();if(n)return n.reject(e),n.promise}function w(t,e){return new s(function(n,i){if(d[t.name]=d[t.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},t.db){if(!e)return n(t.db);y(t),t.db.close()}var s=[t.name];e&&s.push(t.version);var o=r.open.apply(r,s);e&&(o.onupgradeneeded=function(e){var n=o.result;try{n.createObjectStore(t.storeName),e.oldVersion<=1&&n.createObjectStore(u)}catch(r){if("ConstraintError"!==r.name)throw r;console.warn('The database "'+t.name+'" has been upgraded from version '+e.oldVersion+" to version "+e.newVersion+', but the storage "'+t.storeName+'" already exists.')}}),o.onerror=function(t){t.preventDefault(),i(o.error)},o.onsuccess=function(){var e=o.result;e.onversionchange=function(t){t.target.close()},n(e),v(t)}})}function _(t){return w(t,!1)}function x(t){return w(t,!0)}function C(t,e){if(!t.db)return!0;var n=!t.db.objectStoreNames.contains(t.storeName),r=t.version<t.db.version,i=t.version>t.db.version;if(r&&(t.version!==e&&console.warn('The database "'+t.name+"\" can't be downgraded from version "+t.db.version+" to version "+t.version+"."),t.version=t.db.version),i||n){if(n){var s=t.db.version+1;s>t.version&&(t.version=s)}return!0}return!1}function S(t){return i([m(atob(t.data))],{type:t.type})}function k(t){return t&&t.__local_forage_encoded_blob}function E(t){var e=this,n=e._initReady().then(function(){var t=d[e._dbInfo.name];if(t&&t.dbReady)return t.dbReady});return a(n,t,t),n}function R(t,e,n,r){void 0===r&&(r=1);try{n(null,t.db.transaction(t.storeName,e))}catch(nD){if(r>0&&(!t.db||"InvalidStateError"===nD.name||"NotFoundError"===nD.name))return s.resolve().then(function(){if(!t.db||"NotFoundError"===nD.name&&!t.db.objectStoreNames.contains(t.storeName)&&t.version<=t.db.version)return t.db&&(t.version=t.db.version+1),x(t)}).then(function(){return function(t){y(t);for(var e=d[t.name],n=e.forages,r=0;r<n.length;r++){var i=n[r];i._dbInfo.db&&(i._dbInfo.db.close(),i._dbInfo.db=null)}return t.db=null,_(t).then(function(e){return t.db=e,C(t)?x(t):e}).then(function(r){t.db=e.db=r;for(var i=0;i<n.length;i++)n[i]._dbInfo.db=r}).catch(function(e){throw b(t,e),e})}(t).then(function(){R(t,e,n,r-1)})}).catch(n);n(nD)}}var T={_driver:"asyncStorage",_initStorage:function(t){var e=this,n={db:null};if(t)for(var r in t)n[r]=t[r];var i=d[n.name];i||(i={forages:[],db:null,dbReady:null,deferredOperations:[]},d[n.name]=i),i.forages.push(e),e._initReady||(e._initReady=e.ready,e.ready=E);var o=[];function a(){return s.resolve()}for(var l=0;l<i.forages.length;l++){var c=i.forages[l];c!==e&&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(t){return n.db=t,C(n,e._defaultConfig.version)?x(n):t}).then(function(t){n.db=i.db=t,e._dbInfo=n;for(var r=0;r<u.length;r++){var s=u[r];s!==e&&(s._dbInfo.db=n.db,s._dbInfo.version=n.version)}})},_support:function(){try{if(!r||!r.open)return!1;var t="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),e="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!t||e)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(n){return!1}}(),iterate:function(t,e){var n=this,r=new s(function(e,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=t(r,n.key,a++);void 0!==i?e(i):n.continue()}else e()},o.onerror=function(){r(o.error)}}catch(l){r(l)}})}).catch(r)});return o(r,e),r},getItem:function(t,e){var n=this;t=l(t);var r=new s(function(e,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(t);o.onsuccess=function(){var t=o.result;void 0===t&&(t=null),k(t)&&(t=S(t)),e(t)},o.onerror=function(){r(o.error)}}catch(a){r(a)}})}).catch(r)});return o(r,e),r},setItem:function(t,e,n){var r=this;t=l(t);var a=new s(function(n,o){var a;r.ready().then(function(){return a=r._dbInfo,"[object Blob]"===p.call(e)?function(t){return"boolean"==typeof h?s.resolve(h):function(t){return new s(function(e){var n=t.transaction(u,g),r=i([""]);n.objectStore(u).put(r,"key"),n.onabort=function(t){t.preventDefault(),t.stopPropagation(),e(!1)},n.oncomplete=function(){var t=navigator.userAgent.match(/Chrome\/(\d+)/);e(navigator.userAgent.match(/Edge\//)||!t||parseInt(t[1],10)>=43)}}).catch(function(){return!1})}(t).then(function(t){return h=t})}(a.db).then(function(t){return t?e:(n=e,new s(function(t,e){var r=new FileReader;r.onerror=e,r.onloadend=function(e){t({__local_forage_encoded_blob:!0,data:btoa(e.target.result||""),type:n.type})},r.readAsBinaryString(n)}));var n}):e}).then(function(e){R(r._dbInfo,g,function(i,s){if(i)return o(i);try{var a=s.objectStore(r._dbInfo.storeName);null===e&&(e=void 0);var l=a.put(e,t);s.oncomplete=function(){void 0===e&&(e=null),n(e)},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(t,e){var n=this;t=l(t);var r=new s(function(e,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(t);s.oncomplete=function(){e()},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,e),r},clear:function(t){var e=this,n=new s(function(t,n){e.ready().then(function(){R(e._dbInfo,g,function(r,i){if(r)return n(r);try{var s=i.objectStore(e._dbInfo.storeName).clear();i.oncomplete=function(){t()},i.onabort=i.onerror=function(){n(s.error?s.error:s.transaction.error)}}catch(o){n(o)}})}).catch(n)});return o(n,t),n},length:function(t){var e=this,n=new s(function(t,n){e.ready().then(function(){R(e._dbInfo,f,function(r,i){if(r)return n(r);try{var s=i.objectStore(e._dbInfo.storeName).count();s.onsuccess=function(){t(s.result)},s.onerror=function(){n(s.error)}}catch(o){n(o)}})}).catch(n)});return o(n,t),n},key:function(t,e){var n=this,r=new s(function(e,r){t<0?e(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===t||a?e(n.key):(a=!0,n.advance(t)):e(null)},l.onerror=function(){r(l.error)}}catch(c){r(c)}})}).catch(r)});return o(r,e),r},keys:function(t){var e=this,n=new s(function(t,n){e.ready().then(function(){R(e._dbInfo,f,function(r,i){if(r)return n(r);try{var s=i.objectStore(e._dbInfo.storeName).openKeyCursor(),o=[];s.onsuccess=function(){var e=s.result;e?(o.push(e.key),e.continue()):t(o)},s.onerror=function(){n(s.error)}}catch(a){n(a)}})}).catch(n)});return o(n,t),n},dropInstance:function(t,e){e=c.apply(this,arguments);var n,i=this.config();if((t="function"!=typeof t&&t||{}).name||(t.name=t.name||i.name,t.storeName=t.storeName||i.storeName),t.name){var a=t.name===i.name&&this._dbInfo.db?s.resolve(this._dbInfo.db):_(t).then(function(e){var n=d[t.name],r=n.forages;n.db=e;for(var i=0;i<r.length;i++)r[i]._dbInfo.db=e;return e});n=t.storeName?a.then(function(e){if(e.objectStoreNames.contains(t.storeName)){var n=e.version+1;y(t);var i=d[t.name],o=i.forages;e.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(e,i){var s=r.open(t.name,n);s.onerror=function(t){s.result.close(),i(t)},s.onupgradeneeded=function(){s.result.deleteObjectStore(t.storeName)},s.onsuccess=function(){var t=s.result;t.close(),e(t)}}).then(function(t){i.db=t;for(var e=0;e<o.length;e++){var n=o[e];n._dbInfo.db=t,v(n._dbInfo)}}).catch(function(e){throw(b(t,e)||s.resolve()).catch(function(){}),e})}}):a.then(function(e){y(t);var n=d[t.name],i=n.forages;e.close();for(var o=0;o<i.length;o++)i[o]._dbInfo.db=null;return new s(function(e,n){var i=r.deleteDatabase(t.name);i.onerror=function(){var t=i.result;t&&t.close(),n(i.error)},i.onblocked=function(){console.warn('dropInstance blocked for database "'+t.name+'" until all open connections are closed')},i.onsuccess=function(){var t=i.result;t&&t.close(),e(t)}}).then(function(t){n.db=t;for(var e=0;e<i.length;e++)v(i[e]._dbInfo)}).catch(function(e){throw(b(t,e)||s.resolve()).catch(function(){}),e})})}else n=s.reject("Invalid arguments");return o(n,e),n}},L="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",I=/^~~local_forage_type~([^~]+)~/,P="__lfsc__:",M="arbf",A="blob",O="si08",N="ui08",F="uic8",z="si16",D="si32",j="ur16",U="ui32",B="fl32",$="fl64",q=Object.prototype.toString;function V(t){var e,n,r,i,s,o=.75*t.length,a=t.length,l=0;"="===t[t.length-1]&&(o--,"="===t[t.length-2]&&o--);var c=new ArrayBuffer(o),u=new Uint8Array(c);for(e=0;e<a;e+=4)n=L.indexOf(t[e]),r=L.indexOf(t[e+1]),i=L.indexOf(t[e+2]),s=L.indexOf(t[e+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(t){var e,n=new Uint8Array(t),r="";for(e=0;e<n.length;e+=3)r+=L[n[e]>>2],r+=L[(3&n[e])<<4|n[e+1]>>4],r+=L[(15&n[e+1])<<2|n[e+2]>>6],r+=L[63&n[e+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(t,e){var n="";if(t&&(n=q.call(t)),t&&("[object ArrayBuffer]"===n||t.buffer&&"[object ArrayBuffer]"===q.call(t.buffer))){var r,i=P;t instanceof ArrayBuffer?(r=t,i+=M):(r=t.buffer,"[object Int8Array]"===n?i+=O:"[object Uint8Array]"===n?i+=N:"[object Uint8ClampedArray]"===n?i+=F:"[object Int16Array]"===n?i+=z:"[object Uint16Array]"===n?i+=j:"[object Int32Array]"===n?i+=D:"[object Uint32Array]"===n?i+=U:"[object Float32Array]"===n?i+=B:"[object Float64Array]"===n?i+=$:e(new Error("Failed to get type for BinaryArray"))),e(i+W(r))}else if("[object Blob]"===n){var s=new FileReader;s.onload=function(){var n="~~local_forage_type~"+t.type+"~"+W(this.result);e(P+A+n)},s.readAsArrayBuffer(t)}else try{e(JSON.stringify(t))}catch(o){console.error("Couldn't convert value into a JSON string: ",t),e(null,o)}},deserialize:function(t){if(t.substring(0,9)!==P)return JSON.parse(t);var e,n=t.substring(13),r=t.substring(9,13);if(r===A&&I.test(n)){var s=n.match(I);e=s[1],n=n.substring(s[0].length)}var o=V(n);switch(r){case M:return o;case A:return i([o],{type:e});case O:return new Int8Array(o);case N:return new Uint8Array(o);case F:return new Uint8ClampedArray(o);case z:return new Int16Array(o);case j:return new Uint16Array(o);case D: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(t,e,n,r){t.executeSql("CREATE TABLE IF NOT EXISTS "+e.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,r)}function Z(t,e,n,r,i,s){t.executeSql(n,r,i,function(t,o){o.code===o.SYNTAX_ERR?t.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[e.storeName],function(t,a){a.rows.length?s(t,o):G(t,e,function(){t.executeSql(n,r,i,s)},s)},s):s(t,o)},s)}function K(t,e,n,r){var i=this;t=l(t);var a=new s(function(s,o){i.ready().then(function(){void 0===e&&(e=null);var a=e,l=i._dbInfo;l.serializer.serialize(e,function(e,c){c?o(c):l.db.transaction(function(n){Z(n,l,"INSERT OR REPLACE INTO "+l.storeName+" (key, value) VALUES (?, ?)",[t,e],function(){s(a)},function(t,e){o(e)})},function(e){if(e.code===e.QUOTA_ERR){if(r>0)return void s(K.apply(i,[t,a,n,r-1]));o(e)}})})}).catch(o)});return o(a,n),a}var Y={_driver:"webSQLStorage",_initStorage:function(t){var e=this,n={db:null};if(t)for(var r in t)n[r]="string"!=typeof t[r]?t[r].toString():t[r];var i=new s(function(t,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(){e._dbInfo=n,t()},function(t,e){r(e)})},r)});return n.serializer=H,i},_support:"function"==typeof openDatabase,iterate:function(t,e){var n=this,r=new s(function(e,r){n.ready().then(function(){var i=n._dbInfo;i.db.transaction(function(n){Z(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=t(c,l.key,a+1)))return void e(c)}e()},function(t,e){r(e)})})}).catch(r)});return o(r,e),r},getItem:function(t,e){var n=this;t=l(t);var r=new s(function(e,r){n.ready().then(function(){var i=n._dbInfo;i.db.transaction(function(n){Z(n,i,"SELECT * FROM "+i.storeName+" WHERE key = ? LIMIT 1",[t],function(t,n){var r=n.rows.length?n.rows.item(0).value:null;r&&(r=i.serializer.deserialize(r)),e(r)},function(t,e){r(e)})})}).catch(r)});return o(r,e),r},setItem:function(t,e,n){return K.apply(this,[t,e,n,1])},removeItem:function(t,e){var n=this;t=l(t);var r=new s(function(e,r){n.ready().then(function(){var i=n._dbInfo;i.db.transaction(function(n){Z(n,i,"DELETE FROM "+i.storeName+" WHERE key = ?",[t],function(){e()},function(t,e){r(e)})})}).catch(r)});return o(r,e),r},clear:function(t){var e=this,n=new s(function(t,n){e.ready().then(function(){var r=e._dbInfo;r.db.transaction(function(e){Z(e,r,"DELETE FROM "+r.storeName,[],function(){t()},function(t,e){n(e)})})}).catch(n)});return o(n,t),n},length:function(t){var e=this,n=new s(function(t,n){e.ready().then(function(){var r=e._dbInfo;r.db.transaction(function(e){Z(e,r,"SELECT COUNT(key) as c FROM "+r.storeName,[],function(e,n){var r=n.rows.item(0).c;t(r)},function(t,e){n(e)})})}).catch(n)});return o(n,t),n},key:function(t,e){var n=this,r=new s(function(e,r){n.ready().then(function(){var i=n._dbInfo;i.db.transaction(function(n){Z(n,i,"SELECT key FROM "+i.storeName+" WHERE id = ? LIMIT 1",[t+1],function(t,n){e(n.rows.length?n.rows.item(0).key:null)},function(t,e){r(e)})})}).catch(r)});return o(r,e),r},keys:function(t){var e=this,n=new s(function(t,n){e.ready().then(function(){var r=e._dbInfo;r.db.transaction(function(e){Z(e,r,"SELECT key FROM "+r.storeName,[],function(e,n){for(var r=[],i=0;i<n.rows.length;i++)r.push(n.rows.item(i).key);t(r)},function(t,e){n(e)})})}).catch(n)});return o(n,t),n},dropInstance:function(t,e){e=c.apply(this,arguments);var n=this.config();(t="function"!=typeof t&&t||{}).name||(t.name=t.name||n.name,t.storeName=t.storeName||n.storeName);var r,i=this;return r=t.name?new s(function(e){var r;r=t.name===n.name?i._dbInfo.db:openDatabase(t.name,"","",0),t.storeName?e({db:r,storeNames:[t.storeName]}):e(function(t){return new s(function(e,n){t.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);e({db:t,storeNames:i})},function(t,e){n(e)})},function(t){n(t)})})}(r))}).then(function(t){return new s(function(e,n){t.db.transaction(function(r){function i(t){return new s(function(e,n){r.executeSql("DROP TABLE IF EXISTS "+t,[],function(){e()},function(t,e){n(e)})})}for(var o=[],a=0,l=t.storeNames.length;a<l;a++)o.push(i(t.storeNames[a]));s.all(o).then(function(){e()}).catch(function(t){n(t)})},function(t){n(t)})})}):s.reject("Invalid arguments"),o(r,e),r}};function X(t,e){var n=t.name+"/";return t.storeName!==e.storeName&&(n+=t.storeName+"/"),n}var J={_driver:"localStorageWrapper",_initStorage:function(t){var e={};if(t)for(var n in t)e[n]=t[n];return e.keyPrefix=X(t,this._defaultConfig),!function(){var t="_localforage_support_test";try{return localStorage.setItem(t,!0),localStorage.removeItem(t),!1}catch(e){return!0}}()||localStorage.length>0?(this._dbInfo=e,e.serializer=H,s.resolve()):s.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(t){return!1}}(),iterate:function(t,e){var n=this,r=n.ready().then(function(){for(var e=n._dbInfo,r=e.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=e.serializer.deserialize(c)),void 0!==(c=t(c,l.substring(i),o++)))return c}}});return o(r,e),r},getItem:function(t,e){var n=this;t=l(t);var r=n.ready().then(function(){var e=n._dbInfo,r=localStorage.getItem(e.keyPrefix+t);return r&&(r=e.serializer.deserialize(r)),r});return o(r,e),r},setItem:function(t,e,n){var r=this;t=l(t);var i=r.ready().then(function(){void 0===e&&(e=null);var n=e;return new s(function(i,s){var o=r._dbInfo;o.serializer.serialize(e,function(e,r){if(r)s(r);else try{localStorage.setItem(o.keyPrefix+t,e),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(t,e){var n=this;t=l(t);var r=n.ready().then(function(){var e=n._dbInfo;localStorage.removeItem(e.keyPrefix+t)});return o(r,e),r},clear:function(t){var e=this,n=e.ready().then(function(){for(var t=e._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var r=localStorage.key(n);0===r.indexOf(t)&&localStorage.removeItem(r)}});return o(n,t),n},length:function(t){var e=this.keys().then(function(t){return t.length});return o(e,t),e},key:function(t,e){var n=this,r=n.ready().then(function(){var e,r=n._dbInfo;try{e=localStorage.key(t)}catch(d8){e=null}return e&&(e=e.substring(r.keyPrefix.length)),e});return o(r,e),r},keys:function(t){var e=this,n=e.ready().then(function(){for(var t=e._dbInfo,n=localStorage.length,r=[],i=0;i<n;i++){var s=localStorage.key(i);0===s.indexOf(t.keyPrefix)&&r.push(s.substring(t.keyPrefix.length))}return r});return o(n,t),n},dropInstance:function(t,e){if(e=c.apply(this,arguments),!(t="function"!=typeof t&&t||{}).name){var n=this.config();t.name=t.name||n.name,t.storeName=t.storeName||n.storeName}var r,i=this;return r=t.name?new s(function(e){t.storeName?e(X(t,i._defaultConfig)):e(t.name+"/")}).then(function(t){for(var e=localStorage.length-1;e>=0;e--){var n=localStorage.key(e);0===n.indexOf(t)&&localStorage.removeItem(n)}}):s.reject("Invalid arguments"),o(r,e),r}},Q=function(t,e){return t===e||"number"==typeof t&&"number"==typeof e&&isNaN(t)&&isNaN(e)},tt=function(t,e){for(var n=t.length,r=0;r<n;){if(Q(t[r],e))return!0;r++}return!1},et=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},nt={},rt={},it={INDEXEDDB:T,WEBSQL:Y,LOCALSTORAGE:J},st=[it.INDEXEDDB._driver,it.WEBSQL._driver,it.LOCALSTORAGE._driver],ot=["dropInstance"],at=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ot),lt={description:"",driver:st.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function ct(t,e){t[e]=function(){var n=arguments;return t.ready().then(function(){return t[e].apply(t,n)})}}function ut(){for(var t=1;t<arguments.length;t++){var e=arguments[t];if(e)for(var n in e)e.hasOwnProperty(n)&&(et(e[n])?arguments[0][n]=e[n].slice():arguments[0][n]=e[n])}return arguments[0]}e.exports=new(function(){function t(e){for(var n in function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),it)if(it.hasOwnProperty(n)){var r=it[n],i=r._driver;this[n]=i,nt[i]||this.defineDriver(r)}this._defaultConfig=ut({},lt),this._config=ut({},this._defaultConfig,e),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return t.prototype.config=function(t){if("object"===(void 0===t?"undefined":n(t))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var e in t){if("storeName"===e&&(t[e]=t[e].replace(/\W/g,"_")),"version"===e&&"number"!=typeof t[e])return new Error("Database version must be a number.");this._config[e]=t[e]}return!("driver"in t)||!t.driver||this.setDriver(this._config.driver)}return"string"==typeof t?this._config[t]:this._config},t.prototype.defineDriver=function(t,e,n){var r=new s(function(e,n){try{var r=t._driver,i=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!t._driver)return void n(i);for(var a=at.concat("_initStorage"),l=0,c=a.length;l<c;l++){var u=a[l];if((!tt(ot,u)||t[u])&&"function"!=typeof t[u])return void n(i)}!function(){for(var e=function(t){return function(){var e=new Error("Method "+t+" is not implemented by the current driver"),n=s.reject(e);return o(n,arguments[arguments.length-1]),n}},n=0,r=ot.length;n<r;n++){var i=ot[n];t[i]||(t[i]=e(i))}}();var h=function(n){nt[r]&&console.info("Redefining LocalForage driver: "+r),nt[r]=t,rt[r]=n,e()};"_support"in t?t._support&&"function"==typeof t._support?t._support().then(h,n):h(!!t._support):h(!0)}catch(d){n(d)}});return a(r,e,n),r},t.prototype.driver=function(){return this._driver||null},t.prototype.getDriver=function(t,e,n){var r=nt[t]?s.resolve(nt[t]):s.reject(new Error("Driver not found."));return a(r,e,n),r},t.prototype.getSerializer=function(t){var e=s.resolve(H);return a(e,t),e},t.prototype.ready=function(t){var e=this,n=e._driverSet.then(function(){return null===e._ready&&(e._ready=e._initDriver()),e._ready});return a(n,t,t),n},t.prototype.setDriver=function(t,e,n){var r=this;et(t)||(t=[t]);var i=this._getSupportedDrivers(t);function o(){r._config.driver=r.driver()}function l(t){return r._extend(t),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 t=i[0];return r._dbInfo=null,r._ready=null,r.getDriver(t).then(function(t){r._driver=t._driver,o(),r._wrapLibraryMethodsWithReady(),r._initDriver=function(t){return function(){var e=0;return function n(){for(;e<t.length;){var i=t[e];return e++,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 t=new Error("No available storage method found.");return r._driverSet=s.reject(t),r._driverSet}),a(this._driverSet,e,n),this._driverSet},t.prototype.supports=function(t){return!!rt[t]},t.prototype._extend=function(t){ut(this,t)},t.prototype._getSupportedDrivers=function(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n];this.supports(i)&&e.push(i)}return e},t.prototype._wrapLibraryMethodsWithReady=function(){for(var t=0,e=at.length;t<e;t++)ct(this,at[t])},t.prototype.createInstance=function(e){return new t(e)},t}())},{3:3}]},{},[4])(4)})}),az=a({default:()=>cz}),lz=c(oz(),1),cz=class extends fp{_instances=new Map;_instance(t){let e=this._instances.get(t);return e||(e=lz.default.createInstance({name:"marco",storeName:t}),this._instances.set(t,e)),e}async get(t,e){return this._instance(t).getItem(e)}async set(t,e,n){return this._instance(t).setItem(e,n)}async remove(t,e){return this._instance(t).removeItem(e)}async keys(t){return this._instance(t).keys()}async clear(t){return this._instance(t).clear()}async iterate(t,e){return this._instance(t).iterate(e)}},uz=a({default:()=>hz}),hz=class extends fp{static{BF(this.prototype,"nostrData",[pp])}#F=void qF(this,"nostrData");static{BF(this.prototype,"selectedPlace",[Wr],function(){return null})}#V=void qF(this,"selectedPlace");static{BF(this.prototype,"isSearching",[Wr],function(){return!1})}#W=void qF(this,"isSearching");static{BF(this.prototype,"isCreating",[Wr],function(){return!1})}#H=void qF(this,"isCreating");static{BF(this.prototype,"creationCoordinates",[Wr],function(){return null})}#G=void qF(this,"creationCoordinates");static{BF(this.prototype,"returnToSearch",[Wr],function(){return!1})}#Z=void qF(this,"returnToSearch");static{BF(this.prototype,"returnToRoute",[Wr],function(){return null})}#K=void qF(this,"returnToRoute");static{BF(this.prototype,"currentCenter",[Wr],function(){return null})}#Y=void qF(this,"currentCenter");static{BF(this.prototype,"currentBounds",[Wr],function(){return null})}#X=void qF(this,"currentBounds");static{BF(this.prototype,"currentZoom",[Wr],function(){return null})}#J=void qF(this,"currentZoom");static{BF(this.prototype,"searchBoxHasFocus",[Wr],function(){return!1})}#Q=void qF(this,"searchBoxHasFocus");static{BF(this.prototype,"selectionOptions",[Wr],function(){return{}})}#tt=void qF(this,"selectionOptions");static{BF(this.prototype,"preventNextZoom",[Wr],function(){return!1})}#et=void qF(this,"preventNextZoom");static{BF(this.prototype,"searchResults",[Wr],function(){return[]})}#nt=void qF(this,"searchResults");static{BF(this.prototype,"currentSearch",[Wr],function(){return null})}#rt=void qF(this,"currentSearch");static{BF(this.prototype,"loadingState",[Wr],function(){return null})}#it=void qF(this,"loadingState");static{BF(this.prototype,"isSidebarVisible",[Wr],function(){return!1})}#st=void qF(this,"isSidebarVisible");static{BF(this.prototype,"isSidebarOpening",[Wr],function(){return!1})}#ot=void qF(this,"isSidebarOpening");scrollPositions={};saveScrollPosition(t,e){this.scrollPositions[t]=e}static{$F(this.prototype,"saveScrollPosition",[Vl])}getScrollPosition(t){return this.scrollPositions[t]||0}static{$F(this.prototype,"getScrollPosition",[Vl])}showSidebar(){this.isSidebarVisible||(this.isSidebarVisible=!0,this.isSidebarOpening=!0,setTimeout(()=>{this.isSidebarOpening=!1},250))}hideSidebar(){this.isSidebarVisible=!1,this.isSidebarOpening=!1}selectPlace(t,e={}){this.selectedPlace=t,this.selectionOptions=e,this.nostrData.loadPhotosForPlace(t)}clearSelection(){this.selectedPlace=null,this.selectionOptions={},this.preventNextZoom=!1,this.nostrData.loadPhotosForPlace(null)}setSearchResults(t){this.searchResults=t||[]}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(t,e){this.creationCoordinates={lat:t,lon:e}}setSearchBoxFocus(t){this.searchBoxHasFocus=t}updateCenter(t,e){this.currentCenter={lat:t,lon:e}}updateZoom(t){this.currentZoom=t}updateBounds(t){this.currentBounds=t}startLoading(t,e){this.loadingState={type:t,value:e}}stopLoading(t=null,e=null){t||e?this.loadingState&&this.loadingState.type===t&&this.loadingState.value===e&&(this.loadingState=null):this.loadingState=null}};function dz(){let t,e;const n=new Promise((n,r)=>{t=n,e=r});return n.resolve=t,n.reject=e,n}"navigator"in globalThis&&navigator.userAgent.includes("Android")&&navigator.clipboard&&navigator.clipboard.readText;var pz=class extends Error{},fz=class{get nip04(){return window.nostr?.nip04}get nip44(){return window.nostr?.nip44}pubkey=void 0;async getPublicKey(){if(!window.nostr)throw new pz("Signer extension missing");if(this.pubkey)return this.pubkey;const t=await window.nostr.getPublicKey();if(!PM(t))throw new Error("Extension returned an invalid public key");return this.pubkey=t,this.pubkey}async signEvent(t){if(!window.nostr)throw new pz("Signer extension missing");const e=await window.nostr.signEvent(t);if(!UP(e))throw new Error("Extension returned an invalid event");return e}};function gz(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&"Uint8Array"===t.constructor.name&&"BYTES_PER_ELEMENT"in t&&1===t.BYTES_PER_ELEMENT}function mz(t,e){return!!Array.isArray(e)&&(0===e.length||(t?e.every(t=>"string"==typeof t):e.every(t=>Number.isSafeInteger(t))))}function yz(t){if("function"!=typeof t)throw new TypeError("function expected");return!0}function vz(t,e){if("string"!=typeof e)throw new TypeError(`${t}: string expected`);return!0}function bz(t){if("number"!=typeof t)throw new TypeError("number expected, got "+typeof t);if(!Number.isSafeInteger(t))throw new RangeError(`invalid integer: ${t}`)}function wz(t){if(!Array.isArray(t))throw new TypeError("array expected")}function _z(t,e){if(!mz(!0,e))throw new TypeError(`${t}: array of strings expected`)}function xz(t,e){if(!mz(!1,e))throw new TypeError(`${t}: array of numbers expected`)}function Cz(...t){const e=t=>t,n=(t,e)=>n=>t(e(n));return{encode:t.map(t=>t.encode).reduceRight(n,e),decode:t.map(t=>t.decode).reduce(n,e)}}function Sz(t){const e="string"==typeof t?t.split(""):t,n=e.length;_z("alphabet",e);const r=new Map(e.map((t,e)=>[t,e]));return{encode:r=>(wz(r),r.map(r=>{if(!Number.isSafeInteger(r)||r<0||r>=n)throw new Error(`alphabet.encode: digit index outside alphabet "${r}". Allowed: ${t}`);return e[r]})),decode:e=>(wz(e),e.map(e=>{vz("alphabet.decode",e);const n=r.get(e);if(void 0===n)throw new Error(`Unknown letter: "${e}". Allowed: ${t}`);return n}))}}function kz(t=""){return vz("join",t),{encode:e=>(_z("join.decode",e),e.join(t)),decode:e=>(vz("join.decode",e),e.split(t))}}function Ez(t,e="="){return bz(t),vz("padding",e),{encode(n){for(_z("padding.encode",n);n.length*t%8;)n.push(e);return n},decode(n){_z("padding.decode",n);let r=n.length;if(r*t%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;r>0&&n[r-1]===e;r--)if((r-1)*t%8==0)throw new Error("padding: invalid, string has too much padding");return n.slice(0,r)}}}function Rz(t){return yz(t),{encode:t=>t,decode:e=>t(e)}}var Tz=(t,e)=>0===e?t:Tz(e,t%e),Lz=(t,e)=>t+(e-Tz(t,e)),Iz=(()=>{let t=[];for(let e=0;e<40;e++)t.push(2**e);return t})();function Pz(t,e,n,r){if(wz(t),e<=0||e>32)throw new RangeError(`convertRadix2: wrong from=${e}`);if(n<=0||n>32)throw new RangeError(`convertRadix2: wrong to=${n}`);if(Lz(e,n)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${n} carryBits=${Lz(e,n)}`);let i=0,s=0;const o=Iz[e],a=Iz[n]-1,l=[];for(const c of t){if(bz(c),c>=o)throw new Error(`convertRadix2: invalid data word=${c} from=${e}`);if(i=i<<e|c,s+e>32)throw new Error(`convertRadix2: carry overflow pos=${s} from=${e}`);for(s+=e;s>=n;s-=n)l.push((i>>s-n&a)>>>0);const t=Iz[s];if(void 0===t)throw new Error("invalid carry");i&=t-1}if(i=i<<n-s&a,!r&&s>=e)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 Mz(t,e=!1){if(bz(t),t<=0||t>32)throw new RangeError("radix2: bits should be in (0..32]");if(Lz(8,t)>32||Lz(t,8)>32)throw new RangeError("radix2: carry overflow");return{encode:n=>{if(!gz(n))throw new TypeError("radix2.encode input should be Uint8Array");return Pz(Array.from(n),8,t,!e)},decode:n=>(xz("radix2.decode",n),Uint8Array.from(Pz(n,t,8,e)))}}function Az(t){return yz(t),function(...e){try{return t.apply(null,e)}catch(n){}}}Cz(Mz(4),Sz("0123456789ABCDEF"),kz("")),Cz(Mz(5),Sz("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),Ez(5),kz("")),Cz(Mz(5),Sz("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),kz("")),Cz(Mz(5),Sz("0123456789ABCDEFGHIJKLMNOPQRSTUV"),Ez(5),kz("")),Cz(Mz(5),Sz("0123456789ABCDEFGHIJKLMNOPQRSTUV"),kz("")),Cz(Mz(5),Sz("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),kz(""),Rz(t=>t.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")));var Oz=(()=>"function"==typeof Uint8Array.from([]).toBase64&&"function"==typeof Uint8Array.fromBase64)(),Nz=(Oz||Cz(Mz(6),Sz("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Ez(6),kz("")),Cz(Mz(6),Sz("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),kz("")),Oz||Cz(Mz(6),Sz("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),Ez(6),kz("")),Cz(Mz(6),Sz("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),kz("")),Cz(Sz("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),kz(""))),Fz=[996825010,642813549,513874426,1027748829,705979059];function zz(t){const e=t>>25;let n=(33554431&t)<<5;for(let r=0;r<Fz.length;r++)1==(e>>r&1)&&(n^=Fz[r]);return n}function Dz(t,e,n=1){const r=t.length;let i=1;for(let s=0;s<r;s++){const e=t.charCodeAt(s);if(e<33||e>126)throw new Error(`Invalid prefix (${t})`);i=zz(i)^e>>5}i=zz(i);for(let s=0;s<r;s++)i=zz(i)^31&t.charCodeAt(s);for(let s of e)i=zz(i)^s;for(let s=0;s<6;s++)i=zz(i);return i^=n,Nz.encode(Pz([i%Iz[30]],30,5,!1))}function jz(t){const e="bech32"===t?1:734539939,n=Mz(5),r=n.decode,i=n.encode,s=Az(r);function o(t,n,r=90){vz("bech32.encode prefix",t),gz(n)&&(n=Array.from(n)),xz("bech32.encode",n);const i=t.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=t.toLowerCase(),a=Dz(o,n,e);return`${o}1${Nz.encode(n)}${a}`}function a(t,n=90){vz("bech32.decode input",t);const r=t.length;if(r<8||!1!==n&&r>n)throw new TypeError(`invalid string length: ${r} (${t}). Expected (8..${n})`);const i=t.toLowerCase();if(t!==i&&t!==t.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=Nz.decode(a).slice(0,-6),c=Dz(o,l,e);if(!a.endsWith(c))throw new Error(`Invalid checksum in ${t}: expected "${c}"`);return{prefix:o,words:l}}return{encode:o,decode:a,encodeFromBytes:function(t,e){return o(t,i(e))},decodeToBytes:function(t){const{prefix:e,words:n}=a(t,!1);return{prefix:e,words:n,bytes:r(n)}},decodeUnsafe:Az(a),fromWords:r,fromWordsUnsafe:s,toWords:i}}var Uz,Bz,$z=Object.freeze(jz("bech32")),qz=(jz("bech32m"),(()=>"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)()||Cz(Mz(4),Sz("0123456789abcdef"),kz(""),Rz(t=>{if("string"!=typeof t||t.length%2!=0)throw new TypeError(`hex.decode: expected string, got ${typeof t} with length ${t.length}`);return t.toLowerCase()})),new TextEncoder),Vz=new TextDecoder;function Wz(t){if(!PM(t.remote))throw new Error("Invalid nbunksec: remote is not a valid hex key");if(!PM(t.clientKey))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 function(t){try{const e=[],n=PS(t.pubkey);e.push(new Uint8Array([0,n.length]),n);const r=PS(t.local_key);e.push(new Uint8Array([1,r.length]),r);for(const a of t.relays){const t=qz.encode(a);e.push(new Uint8Array([2,t.length]),t)}if(t.secret){const n=qz.encode(t.secret);e.push(new Uint8Array([3,n.length]),n)}const i=e.reduce((t,e)=>t+e.length,0),s=new Uint8Array(i);let o=0;for(const t of e)s.set(t,o),o+=t.length;return $z.encode("nbunksec",$z.toWords(s),!1)}catch(d8){throw new Error(`Failed to encode bunker info: ${d8}`)}}({pubkey:t.remote,local_key:t.clientKey,relays:t.relays,secret:t.bunkerSecret??t.secret})}WM(LR.NostrConnect,"nip44"),function(t){t.GetPublicKey="get_public_key",t.SignEvent="sign_event",t.Ping="ping",t.Nip04Encrypt="nip04_encrypt",t.Nip04Decrypt="nip04_decrypt",t.Nip44Encrypt="nip44_encrypt",t.Nip44Decrypt="nip44_decrypt",t.SwitchRelays="switch_relays"}(Uz||(Uz={})),function(t){t.Connect="connect",t.CreateAccount="create_account",t.GetPublicKey="get_public_key",t.SignEvent="sign_event",t.Ping="ping",t.Nip04Encrypt="nip04_encrypt",t.Nip04Decrypt="nip04_decrypt",t.Nip44Encrypt="nip44_encrypt",t.Nip44Decrypt="nip44_decrypt",t.SwitchRelays="switch_relays",t.Logout="logout"}(Bz||(Bz={}));var Hz=class t{key;constructor(t){this.key=t||zP()}async getPublicKey(){return DP(this.key)}async signEvent(t){return jP(t,this.key)}nip04={encrypt:async(t,e)=>$L.encrypt(this.key,t,e),decrypt:async(t,e)=>$L.decrypt(this.key,t,e)};nip44={encrypt:async(t,e)=>sI.v2.encrypt(e,sI.v2.utils.getConversationKey(this.key,t)),decrypt:async(t,e)=>sI.v2.decrypt(e,sI.v2.utils.getConversationKey(this.key,t))};static fromKey(e){const n=function(t){if(t instanceof Uint8Array)return 32!==t.length?null:t;if(PM(t))return PS(t);try{const e=function(t){let{prefix:e,words:n}=rk.decode(t,5e3),r=new Uint8Array(rk.fromWords(n));switch(e){case"nprofile":{let t=_M(r);if(!t[0]?.[0])throw new Error("missing TLV 0 for nprofile");if(32!==t[0][0].length)throw new Error("TLV 0 should be 32 bytes");return{type:"nprofile",data:{pubkey:IS(t[0][0]),relays:t[1]?t[1].map(t=>bM.decode(t)):[]}}}case"nevent":{let t=_M(r);if(!t[0]?.[0])throw new Error("missing TLV 0 for nevent");if(32!==t[0][0].length)throw new Error("TLV 0 should be 32 bytes");if(t[2]&&32!==t[2][0].length)throw new Error("TLV 2 should be 32 bytes");if(t[3]&&4!==t[3][0].length)throw new Error("TLV 3 should be 4 bytes");return{type:"nevent",data:{id:IS(t[0][0]),relays:t[1]?t[1].map(t=>bM.decode(t)):[],author:t[2]?.[0]?IS(t[2][0]):void 0,kind:t[3]?.[0]?parseInt(IS(t[3][0]),16):void 0}}}case"naddr":{let t=_M(r);if(!t[0]?.[0])throw new Error("missing TLV 0 for naddr");if(!t[2]?.[0])throw new Error("missing TLV 2 for naddr");if(32!==t[2][0].length)throw new Error("TLV 2 should be 32 bytes");if(!t[3]?.[0])throw new Error("missing TLV 3 for naddr");if(4!==t[3][0].length)throw new Error("TLV 3 should be 4 bytes");return{type:"naddr",data:{identifier:bM.decode(t[0][0]),pubkey:IS(t[2][0]),kind:parseInt(IS(t[3][0]),16),relays:t[1]?t[1].map(t=>bM.decode(t)):[]}}}case"nsec":return{type:e,data:r};case"npub":case"note":return{type:e,data:IS(r)};default:throw new Error(`unknown prefix ${e}`)}}(t);return"nsec"!==e.type?null:e.data}catch{return null}}(e);if(!n)throw new Error("Invalid private key");return new t(n)}};async function Gz(t){window.open(t,"auth","width=400,height=600,resizable=no,status=no,location=no,toolbar=no,menubar=no")}var Zz=class t{static subscriptionMethod=void 0;static publishMethod=void 0;static pool=void 0;publishMethod;subscriptionMethod;log=_N.extend("NostrConnectSigner");signer;listening=!1;isConnected=!1;pubkey;relays;remote;get clientPubkey(){return DP(this.signer.key)}onAuth=Gz;verifyEvent=UP;connectSecret;bunkerSecret;get secret(){return this.connectSecret}set secret(t){this.connectSecret=t}nip04;nip44;constructor(e){this.relays=e.relays,this.pubkey=e.pubkey,this.remote=e.remote,this.connectSecret=e.connectSecret||e.secret||hM(12),this.bunkerSecret=e.bunkerSecret;const{subscriptionMethod:n,publishMethod:r}=function(t,e){const n=t.subscriptionMethod||t.pool?.subscription.bind(t.pool)||e?.subscriptionMethod||e?.pool?.subscription.bind(e.pool);if(!n)throw new Error("Missing subscriptionMethod, either pass a method or set subscriptionMethod globally on the class");const r=t.publishMethod||t.pool?.publish.bind(t.pool)||e?.publishMethod||e?.pool?.publish.bind(e.pool);if(!r)throw new Error("Missing publishMethod, either pass a method or set publishMethod globally on the class");return{subscriptionMethod:n,publishMethod:r}}(e,t);this.subscriptionMethod=(t,e)=>n(t,e),this.publishMethod=(t,e)=>r(t,e),e.onAuth&&(this.onAuth=e.onAuth),this.signer=e?.signer||new Hz,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 t=await this.signer.getPublicKey();this.req=yO(this.subscriptionMethod(this.relays,[{kinds:[LR.NostrConnect],"#p":[t]}])).pipe(oN(),aN(),WO(t=>"string"!=typeof t)).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(t){if(this.verifyEvent(t)&&(!this.remote||t.pubkey===this.remote))try{const n=GM(t)??(function(t){const e=t.length;return!(e<28)&&"?"==t[e-28]&&"i"==t[e-27]&&"v"==t[e-26]&&"="==t[e-25]}(t.content)?await this.signer.nip04.decrypt(t.pubkey,t.content):await this.signer.nip44.decrypt(t.pubkey,t.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",t.pubkey,r.result),this.isConnected=!0,this.remote=t.pubkey,this.waitingPromise?.resolve(),void(this.waitingPromise=null);if(r.id){const t=this.requests.get(r.id);if(!t)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(e){t.reject(e)}}else t.reject(new Error(r.error));else r.result&&(this.log("Got Response",r.id,r.result),t.resolve(r.result))}}catch(e){}}async createRequestEvent(t,e=this.remote,n=LR.NostrConnect){if(!e)throw new Error("Missing target pubkey");return await this.signer.signEvent({kind:n,created_at:uM(),tags:[["p",e]],content:t})}async makeRequest(t,e,n=LR.NostrConnect){if(!this.remote)throw new Error("Missing remote signer pubkey");const r=hM(8),i={id:r,method:t,params:e},s=await this.signer.nip44.encrypt(this.remote,JSON.stringify(i)),o=await this.createRequestEvent(s,this.remote,n);this.log(`Sending ${r} (${t}) ${JSON.stringify(e)}`);const a=dz();this.requests.set(r,a);const l=this.publishMethod?.(this.relays,o);return l instanceof Promise?await l:"subscribe"in l&&await new Promise(t=>l.subscribe({complete:t})),this.log(`Sent ${r} (${t})`),a}async connect(t,e){if(!this.remote&&this.pubkey&&(this.remote=this.pubkey),!this.remote)throw new Error("Missing remote signer pubkey");await this.open();try{void 0!==t&&(this.bunkerSecret=t);const n=await this.makeRequest(Bz.Connect,[this.remote,this.bunkerSecret||"",e?.join(",")??""]);return this.isConnected=!0,n}catch(n){throw this.isConnected=!1,this.close(),n}}waitingPromise=null;waitForSigner(t){return this.isConnected?Promise.resolve():(this.open(),this.waitingPromise=dz(),t?.addEventListener("abort",()=>{this.waitingPromise?.reject(new Error("Aborted")),this.waitingPromise=null,this.close()},!0),this.waitingPromise)}async createAccount(t,e,n,r){if(!this.remote)throw new Error("Remote pubkey must be set");await this.open();try{const i=await this.makeRequest(Bz.CreateAccount,[t,e,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 t=await this.makeRequest(Bz.GetPublicKey,[]);if(!PM(t))throw new Error("Remote signer returned an invalid public key");return t}async signEvent(t){await this.requireConnection();const e=await this.makeRequest(Bz.SignEvent,[JSON.stringify(t)]),n=JSON.parse(e);if(!this.verifyEvent(n))throw new Error("Invalid event");return n}async nip04Encrypt(t,e){return await this.requireConnection(),this.makeRequest(Bz.Nip04Encrypt,[t,e])}async nip04Decrypt(t,e){await this.requireConnection();const n=await this.makeRequest(Bz.Nip04Decrypt,[t,e]);return n.startsWith('["')&&n.endsWith('"]')?JSON.parse(n)[0]:n}async nip44Encrypt(t,e){return await this.requireConnection(),this.makeRequest(Bz.Nip44Encrypt,[t,e])}async nip44Decrypt(t,e){await this.requireConnection();const n=await this.makeRequest(Bz.Nip44Decrypt,[t,e]);return n.startsWith('["')&&n.endsWith('"]')?JSON.parse(n)[0]:n}async ping(){return await this.requireConnection(),this.makeRequest(Bz.Ping,[])}async switchRelays(){await this.requireConnection();const t=await this.makeRequest(Bz.SwitchRelays,[]);return null!==t&&Array.isArray(t)&&t.length>0&&(this.log("Switching relays from",this.relays,"to",t),this.relays=t,this.listening&&(await this.close(),await this.open())),t}async logout(){try{this.isConnected&&this.remote&&await this.makeRequest(Bz.Logout,[])}catch(d8){this.log("Failed to send logout request",d8)}finally{this.isConnected=!1,await this.close()}}getNostrConnectURI(t){return function(t){const e=new URLSearchParams,n=t.connectSecret??t.secret;if(!n)throw new Error("Invalid nostrconnect URI: missing secret");e.set("secret",n),t.metadata?.name&&e.set("name",t.metadata.name),t.metadata?.url&&e.set("url",String(t.metadata.url)),t.metadata?.image&&e.set("image",t.metadata.image),t.metadata?.permissions&&e.set("perms",t.metadata.permissions.join(","));for(const r of t.relays)e.append("relay",r);return`nostrconnect://${t.client}?`+e.toString()}({client:DP(this.signer.key),connectSecret:this.connectSecret,relays:this.relays,metadata:t})}getNbunksec(){if(!this.remote)throw new Error("Cant create nbunksec when remote signer is not set");return Wz({remote:this.remote,clientKey:IS(this.signer.key),relays:this.relays,bunkerSecret:this.bunkerSecret})}static parseBunkerURI(t){return function(t){const e=new URL(t),n=e.host||e.pathname.replace("//","");if(!PM(n))throw new Error("Invalid bunker URI: remote is not a valid hex key");const r=e.searchParams.getAll("relay");if(0===r.length)throw new Error("Invalid bunker URI: missing relays");const i=e.searchParams.get("secret")??void 0;return{remote:n,relays:r,secret:i,bunkerSecret:i}}(t)}static parseNbunksec(t){return function(t){const e=function(t){try{const{prefix:e,words:n}=$z.decode(t,!1);if("nbunksec"!==e)throw new Error(`Invalid prefix: ${e}`);const r=$z.fromWords(n);let i=0;const s={pubkey:"",local_key:"",relays:[]};for(;i<r.length;){const t=r[i],e=r[i+1];i+=2;const n=r.slice(i,i+e);switch(i+=e,t){case 0:s.pubkey=IS(n);break;case 1:s.local_key=IS(n);break;case 2:s.relays.push(Vz.decode(n));break;case 3:s.secret=Vz.decode(n);break;default:throw new Error(`Unknown type: ${t}`)}}return s}catch(d8){throw new Error(`Failed to decode bunker info: ${d8}`)}}(t);if(!PM(e.pubkey))throw new Error("Invalid nbunksec: remote is not a valid hex key");if(!PM(e.local_key))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{remote:e.pubkey,clientKey:e.local_key,relays:e.relays,secret:e.secret,bunkerSecret:e.secret}}(t)}static createNbunksec(t){return Wz(t)}static buildSigningPermissions(t){return function(t){return[Uz.GetPublicKey,...t.map(t=>`${Uz.SignEvent}:${t}`)]}(t)}static async fromBunkerURI(e,n){const{remote:r,relays:i,bunkerSecret:s}=t.parseBunkerURI(e),o=new t({relays:i,remote:r,bunkerSecret:s,...n});return await o.connect(s,n?.permissions),o}static async fromNbunksec(e,n){const{remote:r,clientKey:i,relays:s,bunkerSecret:o}=t.parseNbunksec(e),a=new t({relays:s,remote:r,signer:new Hz(PS(i)),bunkerSecret:o,...n});return await a.connect(o,n?.permissions),a}},Kz=Object.freeze({p:115792089237316195423570985008687907853269984665640564039457584007908834671663n,n:115792089237316195423570985008687907852837564279074904382605163141518161494337n,h:1n,a:0n,b:7n,Gx:55066263022277343669578718895168534326250603453777594175500187360389116729240n,Gy:32670510020758816978083085130507043184471273380659243275938904335757337482424n}),{p:Yz,n:Xz,Gx:Jz,Gy:Qz,b:tD}=Kz,eD={publicKey:33,publicKeyUncompressed:65,signature:64,seed:48},nD=(t="",e=Error)=>{const n=new e(t),{captureStackTrace:r}=Error;throw"function"==typeof r&&r(n,nD),n},rD=(t,e,n="")=>{const r=(i=t)instanceof Uint8Array||ArrayBuffer.isView(i)&&"Uint8Array"===i.constructor.name&&1===i.BYTES_PER_ELEMENT;var i;const s=t?.length,o=void 0!==e;return!r||o&&s!==e?nD((n&&`"${n}" `)+"expected Uint8Array"+(o?` of length ${e}`:"")+", got "+(r?`length=${s}`:"type="+typeof t),r?RangeError:TypeError):t},iD=t=>new Uint8Array(t),sD=(t,e)=>t.toString(16).padStart(e,"0"),oD=t=>{let e="";for(const n of rD(t))e+=sD(n,2);return e},aD=t=>t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:void 0,lD=t=>{const e="hex invalid";if("string"!=typeof t)return nD(e);const n=t.length,r=n/2;if(n%2)return nD(e);const i=iD(r);for(let s=0,o=0;s<r;s++,o+=2){const n=aD(t.charCodeAt(o)),r=aD(t.charCodeAt(o+1));if(void 0===n||void 0===r)return nD(e);i[s]=16*n+r}return i},cD=(...t)=>{let e=0;for(const i of t)e+=rD(i).length;const n=iD(e);let r=0;for(const i of t)n.set(i,r),r+=i.length;return n},uD=BigInt,hD=(t,e,n,r="bad number: out of range")=>"bigint"!=typeof t?nD(r,TypeError):e<=t&&t<n?t:nD(r,RangeError),dD=(t,e=Yz)=>{const n=t%e;return n>=0n?n:e+n},pD=t=>t instanceof bD?t:nD("Point expected"),fD=t=>dD(dD(t*t)*t+tD),gD=t=>hD(t,0n,Yz),mD=t=>hD(t,1n,Yz),yD=t=>!(1n&t),vD=t=>Uint8Array.of(t),bD=class t{static BASE;static ZERO;X;Y;Z;constructor(t,e,n){this.X=gD(t),this.Y=mD(e),this.Z=gD(n),Object.freeze(this)}static CURVE(){return Kz}static fromAffine(e){const{x:n,y:r}=e;return 0n===n&&0n===r?_D:new t(n,r,1n)}static fromBytes(e){rD(e);const{publicKey:n,publicKeyUncompressed:r}=eD;let i;const s=e.length,o=e[0],a=e.subarray(1),l=xD(a,0,32);if(s===n&&(2===o||3===o)){let e=(t=>{const e=fD(mD(t));let n=1n;for(let r=e,i=(Yz+1n)/4n;i>0n;i>>=1n)1n&i&&(n=n*r%Yz),r=r*r%Yz;return dD(n*n)!==e&&nD("sqrt invalid"),yD(n)?n:dD(-n)})(l);3===o&&(e=dD(-e)),i=new t(l,e,1n)}return s===r&&4===o&&(i=new t(l,xD(a,32,64),1n)),i?i.assertValidity():nD("bad point: not on curve")}static fromHex(e){return t.fromBytes(lD(e))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}equals(t){const{X:e,Y:n,Z:r}=this,{X:i,Y:s,Z:o}=pD(t),a=dD(e*o),l=dD(i*r),c=dD(n*o),u=dD(s*r);return a===l&&c===u}is0(){return this.equals(_D)}negate(){return new t(this.X,dD(-this.Y),this.Z)}double(){return this.add(this)}add(e){const{X:n,Y:r,Z:i}=this,{X:s,Y:o,Z:a}=pD(e);let l=0n,c=0n,u=0n;const h=dD(3n*tD);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 t(l,c,u)}subtract(t){return this.add(pD(t).negate())}multiply(t,e=!0){if(!e&&0n===t)return _D;if((t=>{hD(t,1n,Xz)})(t),1n===t)return this;if(this.equals(wD))return TD(t).p;let n=_D,r=wD;for(let i=this;t>0n;i=i.double(),t>>=1n)1n&t?n=n.add(i):e&&(r=r.add(i));return n}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:e,Z:n}=this;if(this.equals(_D))return{x:0n,y:0n};if(1n===n)return{x:t,y:e};const r=((t,e)=>{(0n===t||e<=0n)&&nD("no inverse n="+t+" mod="+e);let n=dD(t,e),r=e,i=0n,s=1n,o=1n,a=0n;for(;0n!==n;){const t=r/n,e=r%n,l=i-o*t,c=s-a*t;r=n,n=e,i=o,s=a,o=l,a=c}return 1n===r?dD(i,e):nD("no inverse")})(n,Yz);return 1n!==dD(n*r)&&nD("inverse invalid"),{x:dD(t*r),y:dD(e*r)}}assertValidity(){const{x:t,y:e}=this.toAffine();return mD(t),mD(e),dD(e*e)===fD(t)?this:nD("bad point: not on curve")}toBytes(t=!0){const{x:e,y:n}=this.assertValidity().toAffine(),r=SD(e);return t?cD((t=>vD(yD(t)?2:3))(n),r):cD(vD(4),r,SD(n))}toHex(t){return oD(this.toBytes(t))}},wD=new bD(Jz,Qz,1n),_D=new bD(0n,1n,0n);bD.BASE=wD,bD.ZERO=_D;var xD=(t,e,n)=>(t=>uD("0x"+(oD(t)||"0")))(t.subarray(e,n)),CD=2n**256n,SD=t=>lD(sD(hD(t,0n,CD),64)),kD=Math.ceil(32)+1,ED=void 0,RD=(t,e)=>{const n=e.negate();return t?n:e},TD=t=>{const e=ED||(ED=(()=>{const t=[];let e=wD,n=e;for(let r=0;r<kD;r++){n=e,t.push(n);for(let r=1;r<128;r++)n=n.add(e),t.push(n);e=n.double()}return t})());let n=_D,r=wD;const i=uD(255),s=uD(8);for(let o=0;o<kD;o++){let a=Number(t&i);t>>=s,a>128&&(a-=256,t+=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(RD(h,e[c])):n=n.add(RD(d,e[u]))}return 0n!==t&&nD("invalid wnaf"),{p:n,f:r}};function LD(t){return bD.fromHex(t).toHex().substring(2)}var ID=new TextDecoder("utf-8"),PD=new TextEncoder;function MD(t){return btoa(String.fromCharCode(...t))}function AD(t){return new Uint8Array(atob(t).split("").map(t=>t.charCodeAt(0)))}(class t{log=_N.extend("SerialPortSigner");writer=null;pubkey;get isConnected(){return!!this.writer}verifyEvent=UP;nip04;constructor(){this.nip04={encrypt:this.nip04Encrypt.bind(this),decrypt:this.nip04Decrypt.bind(this)}}lastCommand=null;async callMethodOnDevice(e,n,r={}){if(!t.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=dz();return this.lastCommand=i,this.sendCommand(e,n),setTimeout(()=>{i.reject(new Error("Device timeout")),this.lastCommand===i&&(this.lastCommand=null)},6e3),this.lastCommand}async connectToDevice({onConnect:e,onDisconnect:n,onError:r,onDone:i}){let s,o=await window.navigator.serial.requestPort();await o.open({baudRate:9600}),await new Promise(t=>setTimeout(t,1e3)),(async()=>{for(;o&&o.readable;){const e=new window.TextDecoderStream;o.readable.pipeTo(e.writable),s=e.readable.getReader();const n=this.readFromSerialPort(s);try{for(;;){const{value:e,done:r}=await n("\n");if(e){const{method:n,data:r}=this.parseResponse(e);if("/ping"===n&&this.log("Pong"),-1===t.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(d8){if(d8 instanceof Error)throw this.writer=null,r&&r(d8),this.lastCommand&&(this.lastCommand.reject(d8),this.lastCommand=null),d8}}})();const a=new window.TextEncoderStream;a.readable.pipeTo(o.writable),this.writer=a.writable.getWriter(),await this.sendCommand(t.METHOD_PING),await this.sendCommand(t.METHOD_PING,[window.location.host]),e&&e(),o.addEventListener("disconnect",()=>{this.log("Disconnected"),this.lastCommand=null,this.writer=null,n&&n()})}async sendCommand(t,e=[]){if(!this.writer)return;this.log("Send command",t,e);const n=[t].concat(e).join(" ");await this.writer.write(n+"\n")}readFromSerialPort(t){let e,n=[];return async(r="\n")=>{if(n.length)return{value:n.shift().trim(),done:!1};const i=[];for(e&&(i.push(e),e=void 0);;){const{value:s,done:o}=await t.read();if(s){const t=s.split(r);if(t.length>1)return i.push(t.shift()),e=t.pop(),n=t,{value:i.join("").trim(),done:!1};i.push(s)}if(o)return{value:i.join("").trim(),done:!0}}}}parseResponse(t){const e=t.split(" ")[0];return{method:e,data:t.substring(e.length).trim()}}async nip04Encrypt(e,n){const r=PS(await this.callMethodOnDevice(t.METHOD_SHARED_SECRET,[LD(e)]));let i=Uint8Array.from(window.crypto.getRandomValues(new Uint8Array(16))),s=PD.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`${MD(new Uint8Array(a))}?iv=${MD(new Uint8Array(i.buffer))}`}async nip04Decrypt(e,n){let[r,i]=n.split("?iv=");const s=PS(await this.callMethodOnDevice(t.METHOD_SHARED_SECRET,[LD(e)]));let o=await crypto.subtle.importKey("raw",s,{name:"AES-CBC"},!1,["decrypt"]),a=AD(r),l=AD(i),c=await crypto.subtle.decrypt({name:"AES-CBC",iv:l},o,a);return ID.decode(c)}async getPublicKey(){const e=await this.callMethodOnDevice(t.METHOD_PUBLIC_KEY,[]);return this.pubkey=e,e}async restore(e){await this.callMethodOnDevice(t.METHOD_RESTORE,[IS(e)])}async signEvent(e){const n=e.pubkey||this.pubkey;if(!n)throw new Error("Unknown signer pubkey");const r={...e,id:NP({...e,pubkey:n})},i=await this.callMethodOnDevice(t.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(t.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=[t.METHOD_PUBLIC_KEY,t.METHOD_SIGN_MESSAGE,t.METHOD_SHARED_SECRET,t.METHOD_RESTORE]});var OD=a({isMobile:()=>ND});function ND(){return"undefined"!=typeof navigator&&/Mobi|Android|iPhone|iPad/i.test(navigator.userAgent)}var FD,zD=a({default:()=>VD}),DD="marco:nostr_pubkey",jD="marco:nostr_signer_type",UD="marco:nostr_connect_local_key",BD="marco:nostr_connect_remote_pubkey",$D="marco:nostr_connect_relay",qD="wss://nostr.kosmos.org",VD=class extends fp{static{BF(this.prototype,"nostrRelay",[pp])}#at=void qF(this,"nostrRelay");static{BF(this.prototype,"nostrData",[pp])}#F=void qF(this,"nostrData");static{BF(this.prototype,"pubkey",[Wr],function(){return null})}#lt=void qF(this,"pubkey");static{BF(this.prototype,"signerType",[Wr],function(){return null})}#ct=void qF(this,"signerType");static{BF(this.prototype,"connectStatus",[Wr],function(){return null})}#ut=void qF(this,"connectStatus");static{BF(this.prototype,"connectUri",[Wr],function(){return null})}#ht=void qF(this,"connectUri");_signerInstance=null;constructor(){super(...arguments),"undefined"!=typeof localStorage&&(localStorage.debug="applesauce:*");const t=localStorage.getItem(DD),e=localStorage.getItem(jD);t&&(this.pubkey=t,this.signerType=e||"extension",this._verifyPubkey())}async _verifyPubkey(){if("extension"===this.signerType){if(void 0===window.nostr)return void this.disconnect();try{const t=await(new fz).getPublicKey();t!==this.pubkey&&(this.pubkey=t,localStorage.setItem(DD,this.pubkey)),this.nostrData.loadProfile(this.pubkey)}catch(t){console.warn("Failed to verify extension nostr pubkey, logging out",t),this.disconnect()}}else if("connect"===this.signerType)try{await this._initConnectSigner()}catch(t){console.warn("Failed to verify connect nostr pubkey, logging out",t),this.disconnect()}}get isMobile(){return ND()}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 fz:(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 fz,this.pubkey=await this._signerInstance.getPublicKey(),this.signerType="extension",localStorage.setItem(DD,this.pubkey),localStorage.setItem(jD,"extension"),this.nostrData.loadProfile(this.pubkey),this.pubkey}catch(d8){throw console.error("Failed to get public key from extension:",d8),d8}}_getLocalSigner(){let t,e=localStorage.getItem(UD);return e?t=Hz.fromKey(e):(t=new Hz,e=Array.from(t.key).map(t=>t.toString(16).padStart(2,"0")).join(""),localStorage.setItem(UD,e)),t}async connectWithApp(){this.connectStatus="waiting";try{const e=this._getLocalSigner(),n=qD;localStorage.setItem($D,n),this._signerInstance=new Zz({pool:this.nostrRelay.pool,relays:[n],signer:e,onAuth:async t=>{confirm(`Your signer app requests authentication via a web page. Open it now?\n\nURL: ${t}`)&&window.open(t,"_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(t){throw console.error("Error while waiting for remote signer ack:",t),t}return this.pubkey=await this._signerInstance.getPublicKey(),this.signerType="connect",this.connectStatus="connected",localStorage.setItem(DD,this.pubkey),localStorage.setItem(jD,"connect"),localStorage.setItem(BD,this._signerInstance.remote),this.nostrData.loadProfile(this.pubkey),this.pubkey}catch(d8){throw this.connectStatus=null,console.error("Failed to connect via Nostr Connect:",d8),d8}}async _initConnectSigner(){const t=localStorage.getItem(BD),e=localStorage.getItem($D)||qD;if(!t)throw new Error("Missing Nostr Connect remote pubkey.");const n=this._getLocalSigner();if(this._signerInstance=new Zz({pool:this.nostrRelay.pool,relays:[e],signer:n,remote:t,onAuth:async t=>{confirm(`Your signer app requests authentication via a web page. Open it now?\n\nURL: ${t}`)&&window.open(t,"_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(t){if(!this.signer)throw new Error("Not connected or extension missing. Please connect Nostr again.");return await this.signer.signEvent(t)}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(DD),localStorage.removeItem(jD),localStorage.removeItem(UD),localStorage.removeItem(BD),localStorage.removeItem($D)}};function WD(t){return Array.from(new Set(t))}function HD(t){const e={};e.kinds=WD(t.map(t=>t.kind)),e.authors=WD(t.map(t=>t.pubkey));const n=WD(t.map(t=>t.identifier).filter(t=>void 0!==t));return n.length>0&&(e["#d"]=n),e}function GD(t){const e=t.filter(t=>Mx(t.kind)),n=t.filter(t=>Ax(t.kind)),r=[],i=t=>{if(0===t.length)return;const e=function(t){const e=new Set(t.map(t=>t.kind));return new Set(t.map(t=>t.pubkey)).size<e.size?function(t){const e=new Map;for(const n of t)e.has(n.pubkey)?e.get(n.pubkey).push(n):e.set(n.pubkey,[n]);return e}(t):function(t){const e=new Map;for(const n of t)e.has(n.kind)?e.get(n.kind).push(n):e.set(n.kind,[n]);return e}(t)}(t);r.push(...Array.from(e.values()).map(HD))};return i(e),i(n),r}function ZD(t){return Ax(t.kind)?void 0!==t.identifier:Mx(t.kind)}function KD(t,e){return function(t,e){const n=t(e);if(wO(n))return n;if(n instanceof Promise)return yO(n).pipe(pN(t=>Array.isArray(t)?yO(t):vO(t)),mN(t=>QP(t)));if(Array.isArray(n)){for(const t of n)QP(t);return yO(n)}return QP(n),vO(n)}(t,e)}function YD(t,e){return wO(t)?t.pipe(JO(1),pN(e)):e(t)}function XD(t,e,n,r,i){const s=new jA,o=new jA,a=s.pipe(t,WO(t=>t.length>0),TO(t=>e(t).pipe(fN(o),cN({resetOnRefCountZero:!1,resetOnComplete:!1,resetOnError:!1}))),fN(o),cN()),l=()=>{o.next(),o.complete(),s.complete()};return i?.signal&&(i.signal.aborted?l():i.signal.addEventListener("abort",l,{once:!0})),Object.assign(t=>new AA(e=>{const i=a.pipe(JO(1),zO(),WO(e=>n(t,e)),r??MA).subscribe(e);return s.next(t),i}),{stop:l,[Symbol.dispose]:l})}function JD(t){return(e,n)=>function(t,e,n){if("function"==typeof t)return t(e,n);if("object"==typeof t&&"request"in t)return t.request(e,n);throw new Error("Invalid upstream pool")}(t,e,n)}function QD(t){return(...e)=>{return n=t(...e),new AA(t=>{let e;const r=i=>{const s=i?n.next(i):n.next(),o=n=>{if(n.done)return t.complete();const i=[];wO(n.value)?e=n.value.subscribe({next:e=>{i.push(e),t.next(e)},error:e=>{t.error(e)},complete:()=>{r(i)}}):(i.push(n.value),t.next(n.value),r(i))};s instanceof Promise?s.then(o,e=>t.error(e)):o(s)};return r(),()=>e?.unsubscribe()}).pipe(cN());var n}}function tj(t,e){return n=>YD(e,e=>0===e.length?XA:t(e,GD(n)))}function ej(t){const e={...t};return t.relays&&(e.relays=[...t.relays]),e}function nj(t,e){return n=>YD(e,e=>t(e,[{ids:n.map(t=>t.id)}]))}function rj(t,e){return nj(t,[e])}function ij(t,e=rj){const n=new Map;return r=>{const i=function(t){let e=new Map;for(const n of t){let t=IM(n.relays,void 0);for(const r of t)e.has(r)?e.get(r)?.push(n):e.set(r,[n])}return e}(r);return BO(...Array.from(i).map(([r,i])=>(r=>{let i=n.get(r);return i||(i=e(t,r),n.set(r,i)),i})(r)(i)))}}!function(t){t.Error="error",t.Missing="missing",t.Found="found"}(FD||(FD={}));var sj,oj,aj=(t,e)=>e.some(e=>t instanceof e),lj=new WeakMap,cj=new WeakMap,uj=new WeakMap,hj={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return lj.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return pj(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function dj(t){hj=t(hj)}function pj(t){if(t instanceof IDBRequest)return function(t){const e=new Promise((e,n)=>{const r=()=>{t.removeEventListener("success",i),t.removeEventListener("error",s)},i=()=>{e(pj(t.result)),r()},s=()=>{n(t.error),r()};t.addEventListener("success",i),t.addEventListener("error",s)});return uj.set(e,t),e}(t);if(cj.has(t))return cj.get(t);const e=function(t){return"function"==typeof t?(e=t,(oj||(oj=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(fj(this),t),pj(this.request)}:function(...t){return pj(e.apply(fj(this),t))}):(t instanceof IDBTransaction&&function(t){if(lj.has(t))return;const e=new Promise((e,n)=>{const r=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",s),t.removeEventListener("abort",s)},i=()=>{e(),r()},s=()=>{n(t.error||new DOMException("AbortError","AbortError")),r()};t.addEventListener("complete",i),t.addEventListener("error",s),t.addEventListener("abort",s)});lj.set(t,e)}(t),aj(t,sj||(sj=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(t,hj):t);var e}(t);return e!==t&&(cj.set(t,e),uj.set(e,t)),e}var fj=t=>uj.get(t),gj=["get","getKey","getAll","getAllKeys","count"],mj=["put","add","delete","clear"],yj=new Map;function vj(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(yj.get(e))return yj.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=mj.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!gj.includes(n))return;const s=async function(t,...e){const s=this.transaction(t,i?"readwrite":"readonly");let o=s.store;return r&&(o=o.index(e.shift())),(await Promise.all([o[n](...e),i&&s.done]))[0]};return yj.set(e,s),s}dj(t=>({...t,get:(e,n,r)=>vj(e,n)||t.get(e,n,r),has:(e,n)=>!!vj(e,n)||t.has(e,n)}));var bj=["continue","continuePrimaryKey","advance"],wj={},_j=new WeakMap,xj=new WeakMap,Cj={get(t,e){if(!bj.includes(e))return t[e];let n=wj[e];return n||(n=wj[e]=function(...t){_j.set(this,xj.get(this)[e](...t))}),n}};async function*Sj(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;const n=new Proxy(e,Cj);for(xj.set(n,e),uj.set(n,fj(e));e;)yield n,e=await(_j.get(n)||e.continue()),_j.delete(n)}function kj(t,e){return e===Symbol.asyncIterator&&aj(t,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===e&&aj(t,[IDBIndex,IDBObjectStore])}function Ej(t){return 0===t||3===t||t>=1e4&&t<2e4}function Rj(t){return t>=3e4&&t<4e4}function Tj(t){return t>=2e4&&t<3e4}dj(t=>({...t,get:(e,n,r)=>kj(e,n)?Sj:t.get(e,n,r),has:(e,n)=>kj(e,n)||t.has(e,n)}));var Lj=Symbol.for("indexable-tags");function Ij(t,e){if(t.ids&&-1===t.ids.indexOf(e.id))return!1;if(t.kinds&&-1===t.kinds.indexOf(e.kind))return!1;if(t.authors&&-1===t.authors.indexOf(e.pubkey))return!1;if(t.since&&e.created_at<t.since)return!1;if(t.until&&e.created_at>t.until)return!1;const n=function(t){let e=Reflect.get(t,Lj);if(!e){e=new Set;for(const n of t.tags)n.length>=2&&1===n[0].length&&e.add(n[0]+":"+n[1]);Reflect.set(t,Lj,e)}return e}(e);for(const r in t)if("&"===r[0]){const e=r.slice(1),i=t[r];if(i&&i.length>0)for(const t of i)if(!n.has(e+":"+t))return!1}for(const r in t)if("#"===r[0]){const e=r.slice(1),i=t[r];if(i){const r=t[`&${e}`],s=r?i.filter(t=>!r.includes(t)):i;if(0===s.length)continue;if(!s.some(t=>n.has(e+":"+t)))return!1}}return!0}function Pj(t,e){for(let n=0;n<t.length;n++)if(Ij(t[n],e))return!0;return!1}var Mj="abcdefghijklmnopqrstuvwxyz",Aj=(Mj+Mj.toUpperCase()).split(""),Oj=Symbol.for("event-uid");function Nj(t){return t.tags.filter(t=>t.length>=2&&1===t[0].length&&Aj.includes(t[0])).map(t=>t[0]+t[1])}function Fj(t){if(Reflect.has(t,Oj))return Reflect.get(t,Oj);let e;if(Ej(t.kind)||Rj(t.kind)){const n=t.tags.find(t=>"d"===t[0])?.[1];e=t.kind+":"+t.pubkey+":"+(n??"")}else e=t.id;return Reflect.set(t,Oj,e),e}async function zj(t="nostr-idb",e){return await function(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=pj(o);return r&&o.addEventListener("upgradeneeded",t=>{r(pj(o.result),t.oldVersion,t.newVersion,pj(o.transaction),t)}),n&&o.addEventListener("blocked",t=>n(t.oldVersion,t.newVersion,t)),a.then(t=>{s&&t.addEventListener("close",()=>s()),i&&t.addEventListener("versionchange",t=>i(t.oldVersion,t.newVersion,t))}).catch(()=>{}),a}(t,3,{...e,async upgrade(t,n,r,i,s){if(0===n){const e=t.createObjectStore("events");e.createIndex("id","event.id",{unique:!0}),e.createIndex("pubkey","event.pubkey"),e.createIndex("kind","event.kind"),e.createIndex("created_at","event.created_at"),e.createIndex("tags","tags",{multiEntry:!0}),t.createObjectStore("used",{keyPath:"uid"}).createIndex("date","date")}1===n&&(t.deleteObjectStore("events"),t.deleteObjectStore("used"),t.deleteObjectStore("seen")),n<=2&&await async function(t){const e=t.objectStore("events");let n=await e.openCursor();const r=[];for(;n;){const t=n.primaryKey,e=n.value,i=e.event;if(Ej(i.kind)||Rj(i.kind)){const n=Fj(i);t!==n&&r.push({oldKey:t,newKey:n,value:e})}n=await n.continue()}for(const{oldKey:i,newKey:s,value:o}of r)await e.delete(i),await e.put(o,s)}(i),e?.upgrade&&e.upgrade(t,n,r,i,s)}})}function Dj(t,e){return e.created_at-t.created_at}var jj=a({countEventsForFilters:()=>Kj,getEventsForFilters:()=>Zj,getIdsForFilter:()=>Hj,getIdsForFilters:()=>Gj,queryForKinds:()=>Vj,queryForPubkeys:()=>Uj,queryForTag:()=>Bj,queryForTagAnd:()=>$j,queryForTime:()=>Wj});function Uj(t,e=[],n){const r=[],i=new Set;if(n)for(const l of e){const t=n.getPubkeyIndex(l);if(t){for(const e of t)i.add(e);r.push(l)}}if(r.length===e.length)return Promise.resolve(i);const s=t.transaction("events","readonly"),o=s.objectStore("events").index("pubkey"),a=e.filter(t=>!r.includes(t)).map(t=>o.getAllKeys(t).then(e=>((t,e)=>{for(const n of e)i.add(n);n&&n.setPubkeyIndex(t,new Set(e))})(t,e)));return s.commit(),Promise.all(a).then(()=>i)}function Bj(t,e,n,r){const i=[],s=new Set;if(r)for(const c of n){const t=r.getTagIndex(e+c);if(t){for(const e of t)s.add(e);i.push(c)}}if(i.length===n.length)return Promise.resolve(s);const o=t.transaction("events","readonly"),a=o.objectStore("events").index("tags"),l=n.map(t=>a.getAllKeys(e+t).then(n=>((t,n)=>{for(const e of n)s.add(e);r&&r.setTagIndex(e+t,new Set(n))})(t,n)));return o.commit(),Promise.all(l).then(()=>s)}function $j(t,e,n,r){if(0===n.length)return Promise.resolve(new Set);if(1===n.length)return Bj(t,e,n,r);const i=[],s=[];if(r)for(const c of n){const t=r.getTagIndex(e+c);t&&(s.push(t),i.push(c))}if(i.length===n.length)return Promise.resolve(qj(s));const o=t.transaction("events","readonly"),a=o.objectStore("events").index("tags"),l=n.filter(t=>!i.includes(t)).map(t=>a.getAllKeys(e+t).then(n=>((t,n)=>{const i=new Set(n);s.push(i),r&&r.setTagIndex(e+t,i)})(t,n)));return o.commit(),Promise.all(l).then(()=>qj(s))}function qj(t){if(0===t.length)return new Set;const e=t.slice().sort((t,e)=>t.size-e.size);let n=e[0];for(let r=1;r<e.length;r++){const t=e[r],i=new Set;for(const e of n)t.has(e)&&i.add(e);if(n=i,0===n.size)return n}return n}function Vj(t,e=[],n){const r=[],i=new Set;if(n)for(const l of e){const t=n.getKindIndex(l);if(t){for(const e of t)i.add(e);r.push(l)}}if(r.length===e.length)return Promise.resolve(i);const s=t.transaction("events","readonly"),o=s.objectStore("events").index("kind"),a=e.filter(t=>!r.includes(t)).map(t=>o.getAllKeys(t).then(e=>((t,e)=>{for(const n of e)i.add(n);n&&n.setKindIndex(t,new Set(e))})(t,e)));return s.commit(),Promise.all(a).then(()=>i)}async function Wj(t,e,n){let r;if(void 0!==e&&void 0!==n)r=IDBKeyRange.bound(e,n);else if(void 0!==e)r=IDBKeyRange.lowerBound(e);else{if(void 0===n)throw new Error("Missing since or until");r=IDBKeyRange.upperBound(n)}return(await t.getAllKeysFromIndex("events","created_at",r)).reverse()}async function Hj(t,e,n){if(e.search)return new Set;if(e.ids)return new Set(e.ids);let r=null;const i=t=>{const e=t instanceof Set?t:new Set(t);if(r)for(const n of r)e.has(n)||r.delete(n);else r=e;return r};let s=null;void 0!==e.since&&(s=await Wj(t,e.since,e.until),i(s));for(const o of Aj){const r=e[`&${o}`],s=e[`#${o}`];if(r?.length&&i(await $j(t,o,r,n)),s?.length){const e=r?.length?s.filter(t=>!r.includes(t)):s;e.length>0&&i(await Bj(t,o,e,n))}}if(e.authors&&i(await Uj(t,e.authors,n)),e.kinds&&i(await Vj(t,e.kinds,n)),void 0===e.since&&void 0!==e.until&&(s=await Wj(t,e.since,e.until),i(s)),e.limit&&s){const t=new Set;for(const n of s){if(t.size>=e.limit)break;r.has(n)&&t.add(n)}return t}if(null===r)throw new Error("Empty filter");return r}async function Gj(t,e,n){if(0===e.length)throw new Error("No Filters");let r=new Set;for(const i of e){const e=await Hj(t,i,n);for(const t of e)r.add(t)}return r}async function Zj(t,e,n,r){const i=await Gj(t,e,n);return await async function(t,e,n,r){const i=[];let s=[];if(r)for(const d of e){const t=r.get(d);t?i.push(t):s.push(d)}else s=e;const o=t.transaction("events","readonly"),a=o.objectStore("events"),l=t=>t&&i.push(t.event),c=Array.from(s).map(t=>a.get(t).then(l));o.commit();const u=await Promise.all(c).then(()=>i.sort(Dj));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}(t,Array.from(i),e,r)}async function Kj(t,e,n){return(await Gj(t,e,n)).size}var Yj=wN.default("nostr-idb"),Xj=Yj.extend("prune");async function Jj(t,e,n){const r=t.transaction("events","readwrite"),i=r.objectStore("events"),s=await i.get(e);if(!s)return await r.commit(),!1;if(await i.delete(e),await r.commit(),n){const t=s.event;n.removeEvent(t)}return!0}var Qj=Yj.extend("WriteQueue"),tU=class{db;queuedIds=new Set;eventQueue=[];lastUsedQueue=new Set;processEvents=null;constructor(t){this.db=t}addEvent(t){const e=Fj(t);this.queuedIds.has(e)||(this.eventQueue.push(t),this.queuedIds.add(e),this.touch(t))}addEvents(t){const e=t.filter(t=>!this.queuedIds.has(Fj(t)));if(0!==e.length){this.eventQueue.push(...e);for(const t of e)this.queuedIds.add(Fj(t));this.touch(e)}}touch(t){if(Array.isArray(t))for(const e of t)this.lastUsedQueue.add(Fj(e));else this.lastUsedQueue.add(Fj(t))}matchPending(t){return this.eventQueue.filter(e=>Pj(t,e))}async flush(t=1e3){if(this.eventQueue.length>0){let e=[];for(let n=0;n<t;n++){const t=this.eventQueue.shift();if(!t)break;e.push(t),this.queuedIds.delete(Fj(t))}this.processEvents&&(e=await this.processEvents(e)||e),await async function(t,e){const n=(e=e.filter(t=>function(t){if("object"!=typeof t||null===t)return!1;if("number"!=typeof t.kind)return!1;if("string"!=typeof t.content)return!1;if("number"!=typeof t.created_at)return!1;if("string"!=typeof t.id)return!1;if(!/^[a-f0-9]{64}$/.test(t.id))return!1;if("string"!=typeof t.pubkey)return!1;if(!/^[a-f0-9]{64}$/.test(t.pubkey))return!1;if(!Array.isArray(t.tags))return!1;for(const e of t.tags){if(!Array.isArray(e))return!1;for(const t of e)if("string"!=typeof t)return!1}return!0}(t))).filter(t=>Ej(t.kind)||Rj(t.kind)),r={};if(n.length>0){const e=t.transaction("events","readonly"),i=n.map(t=>{const n=Fj(t);return e.store.get(n).then(t=>t&&(r[n]=t.event.created_at))});e.commit(),await Promise.all(i)}const i=t.transaction("events","readwrite");for(const s of e){const t=Fj(s);(!r[t]||s.created_at>r[t])&&i.objectStore("events").put({event:s,tags:Nj(s)},t)}await i.commit()}(this.db,e),Qj(`Wrote ${e.length} to database`),this.eventQueue.length>0&&Qj(`${this.eventQueue.length} left`)}this.lastUsedQueue.size>0&&(await async function(t,e){const n=t.transaction("used","readwrite"),r=Math.floor((new Date).valueOf()/1e3);for(const i of e)n.objectStore("used").put({uid:i,date:r});await n.commit()}(this.db,this.lastUsedQueue),this.lastUsedQueue.clear())}clear(){this.eventQueue=[]}},eU=Yj.extend("cache:indexes"),nU=class extends Set{type;key;constructor(t,e,n){super(t),this.type=e,this.key=n}},rU=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(t){const e=this.lastUsed.indexOf(t);-1!==e&&this.lastUsed.splice(e,e+1),this.lastUsed.push(t)}getKindIndex(t){const e=this.kinds.get(t);return e&&this.useIndex(e),e}setKindIndex(t,e){const n=new nU(e,"kind",t);this.kinds.set(t,n),this.useIndex(n),this.pruneIndexes()}getPubkeyIndex(t){const e=this.pubkeys.get(t);return e&&this.useIndex(e),e}setPubkeyIndex(t,e){const n=new nU(e,"pubkey",t);this.pubkeys.set(t,n),this.useIndex(n),this.pruneIndexes()}getTagIndex(t){const e=this.tags.get(t);return e&&this.useIndex(e),e}setTagIndex(t,e){const n=new nU(e,"tag",t);this.tags.set(t,n),this.useIndex(n),this.pruneIndexes()}addEventToIndexes(t){const e=Fj(t);this.getKindIndex(t.kind)?.add(e),this.getPubkeyIndex(t.pubkey)?.add(e);const n=Nj(t);for(const r of n)this.getTagIndex(r)?.add(e)}removeEvent(t){const e=Fj(t);this.getKindIndex(t.kind)?.delete(e),this.getPubkeyIndex(t.pubkey)?.delete(e);const n=Nj(t);for(const r of n)this.getTagIndex(r)?.delete(e)}clear(){this.kinds.clear(),this.pubkeys.clear(),this.tags.clear(),this.lastUsed=[]}pruneIndexes(){for(;this.lastUsed.length>0&&this.lastUsed.length>this.max;){const t=this.lastUsed.shift();if(!t)return;switch(eU(`Forgetting ${t.type}:${t.key}`),t.type){case"kind":this.kinds.delete(t.key);break;case"pubkey":this.pubkeys.delete(t.key);break;case"tag":this.tags.delete(t.key)}}}},iU={},sU=function(t,e){let n=Promise.resolve();if(e&&e.length>0){const t=document.getElementsByTagName("link"),i=document.querySelector("meta[property=csp-nonce]"),s=i?.nonce||i?.getAttribute("nonce");r=e.map(e=>{var n;if(n=e=function(t){return"/"+t}(e),(e=import.meta.resolve?import.meta.resolve(n):new URL(n,import.meta.url).href)in iU)return;iU[e]=!0;const r=e.endsWith(".css");for(let s=t.length-1;s>=0;s--){const n=t[s];if(n.href===e&&(!r||"stylesheet"===n.rel))return}const i=document.createElement("link");return i.rel=r?"stylesheet":"modulepreload",r||(i.as="script"),i.crossOrigin="",i.href=e,s&&i.setAttribute("nonce",s),document.head.appendChild(i),r?new Promise((t,n)=>{i.addEventListener("load",t),i.addEventListener("error",()=>n(new Error(`Unable to preload CSS for ${e}`)))}):void 0}),n=Promise.all(r.map(t=>Promise.resolve(t).then(t=>({status:"fulfilled",value:t}),t=>({status:"rejected",reason:t}))))}var r;function i(t){const e=new Event("vite:preloadError",{cancelable:!0});if(e.payload=t,window.dispatchEvent(e),!e.defaultPrevented)throw t}return n.then(e=>{for(const t of e||[])"rejected"===t.status&&i(t.reason);return t().catch(i)})},oU={batchWrite:1e3,writeInterval:100,cacheIndexes:1e3,pruneInterval:6e4,maxEvents:1e4},aU=Yj.extend("nostridb"),lU=class{options;running=!1;writeInterval;pruneInterval;eventMap=new Map;writeQueue=null;indexCache;db=null;baseEoseTimeout=4400;subscriptions=new Map;constructor(t,e={}){this.options={...oU,...e},t&&(this.db=t,this.writeQueue=new tU(t)),this.indexCache=new rU,this.indexCache.max=this.options.cacheIndexes,this.start()}async getDb(){return this.db||(this.db=await zj()),this.db}async getWriteQueue(){if(this.writeQueue)return this.writeQueue;const t=await this.getDb();return this.writeQueue=new tU(t),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;aU("Starting"),this.running=!0;const t=await this.getDb();await this.flush(),this.pruneInterval=setInterval(()=>{!async function(t,e){const n=await function(t){return t.transaction("events","readonly").store.count()}(t);if(n<=e)return;const r=n-e;if(r<=0)return;Xj(`Pruning database to ${e}`);const i=(await t.getAll("used")).sort((t,e)=>t.date-e.date),s=[];let o=r;for(const u of i){if(o<=0)break;const t=u.uid;s.push(t),o--}if(0===s.length)return;const a=t.transaction("events","readwrite"),l=t.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`)}(t,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,aU("Stopped"))}async add(t){Tj(t.kind)||((await this.getWriteQueue()).addEvent(t),this.indexCache.addEventToIndexes(t));const e=Fj(t);if(!this.eventMap.has(e)){Tj(t.kind)||this.eventMap.set(e,t);for(const[e,n]of this.subscriptions)n.event&&Pj(n.filters,t)&&n.event(t)}return!0}async event(t){return(await(await this.getDb()).get("events",t))?.event}async replaceable(t,e,n){return this.event([t,e,n??""].join(":"))}async count(t){const e=Array.isArray(t)?t:[t],n=await this.getDb();return await Kj(n,e)}async query(t){const e=Array.isArray(t)?t:[t],n=await this.getDb(),r=(await this.getWriteQueue()).matchPending(e),i=await Zj(n,e,this.indexCache,this.eventMap);this.addToEventMaps(i);const s=new Set(r.map(t=>Fj(t)));return r.length>0?[...i.filter(t=>!s.has(Fj(t))),...r].sort(Dj):i}async*subscribe(t){const e=Array.isArray(t)?t:[t],n=[],r=new Set;let i=null,s=!1;const o=this.subscribeInternal(e,{event:t=>{const e=Fj(t);if(!r.has(e)&&(r.add(e),n.push(t),i)){const t=i;i=null,t()}},complete:()=>{if(s=!0,i){const t=i;i=null,t()}}});try{for(;;){for(;n.length>0;)yield n.shift();if(s)break;await new Promise(t=>{i=t})}}finally{o.close()}}async supports(){return[]}async deleteEvent(t){const e=await this.getDb(),n=await Jj(e,t,this.indexCache);return this.eventMap.delete(t),n}async deleteReplaceable(t,e,n){const r=await this.getDb(),i=await async function(t,e,n,r,i){if(!Ej(n)&&!Rj(n))throw new Error(`Kind ${n} is not replaceable`);return await Jj(t,`${n}:${e}:${r??""}`,i)}(r,t,e,n,this.indexCache);if(i){const r=`${e}:${t}:${n??""}`;this.eventMap.delete(r)}return i}async deleteByFilters(t){const e=Array.isArray(t)?t:[t],n=await this.getDb(),r=await this.getEventIdsForFilters(e),i=await async function(t,e,n){const r=await Gj(t,e,n);return await async function(t,e,n){if(0===e.length)return 0;const r=t.transaction("events","readwrite"),i=r.objectStore("events");let s=0;const o=[];for(const a of e){const t=await i.get(a);t&&(o.push(t.event),await i.delete(a),s++)}if(await r.commit(),n&&o.length>0)for(const a of o)n.removeEvent(a);return s}(t,Array.from(r),n)}(n,e,this.indexCache);if(i>0)for(const s of r)this.eventMap.delete(s);return i}async deleteAllEvents(){const t=await this.getDb();await async function(t,e){const n=t.transaction("events","readwrite");await n.objectStore("events").clear(),await n.commit(),e&&e.clear()}(t,this.indexCache),this.eventMap.clear()}async getEventIdsForFilters(t){const e=await this.getDb(),{getIdsForFilters:n}=await sU(async()=>{const{getIdsForFilters:t}=await Promise.resolve().then(()=>jj);return{getIdsForFilters:t}},void 0),r=await n(e,t,this.indexCache);return Array.from(r)}addToEventMaps(t){for(const e of t)this.eventMap.set(Fj(e),e)}subscribeInternal(t,e){const n=((t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((t,e)=>t+((e&=63)<36?e.toString(36):e<62?(e-26).toString(36).toUpperCase():e>62?"-":"_"),""))(),r={id:n,filters:t,closed:!1,close:()=>this.unsubscribe(n),...e};return this.subscriptions.set(n,r),this.executeSubscription(r),r}async executeSubscription(t){const e=(new Date).valueOf();aU(`Running ${t.id}`,t.filters);const n=(await this.getWriteQueue()).matchPending(t.filters);return new Promise(async r=>{const i=await this.getDb(),s=setTimeout(()=>{t.eose&&!t.closed&&t.eose(),r()},this.baseEoseTimeout);Zj(i,t.filters,this.indexCache,this.eventMap).then(i=>{if(clearTimeout(s),this.addToEventMaps(i),t.event&&!t.closed){const r=new Set(n.map(t=>Fj(t))),s=n.length>0?[...i.filter(t=>!r.has(Fj(t))),...n].sort(Dj):i;for(const e of s)try{t.event(e)}catch(d8){aU("event handler failed with error",d8)}const o=(new Date).valueOf()-e;aU(`Finished ${t.id} took ${o}ms and got ${s.length} events`)}t.eose&&!t.closed&&t.eose(),r()})})}unsubscribe(t){const e=this.subscriptions.get(t);e&&(aU(`Closing ${t}`),e.closed=!0,e.complete?.(),this.subscriptions.delete(t))}},cU=a({excludeRequiredRelays:()=>pU,mergeRequiredRelays:()=>dU,normalizeRelayUrl:()=>uU,parsePlacePhotos:()=>fU,uniqNormalizedRelays:()=>hU});function uU(t){if(!t)return"";let e=t.trim().toLowerCase();if(!e)return"";for(e.startsWith("ws://")||e.startsWith("wss://")||(e="wss://"+e);e.endsWith("/");)e=e.slice(0,-1);return e}function hU(t=[]){return Array.from(new Set(t.map(uU).filter(Boolean)))}function dU(t=[],e=[]){const n=new Set(t.filter(Boolean)),r=[...t.filter(Boolean)];for(const i of hU(e))n.has(i)||r.push(i);return r}function pU(t=[],e=[]){const n=new Set(e.filter(Boolean));return hU(t).filter(t=>!n.has(t))}function fU(t){if(!t||0===t.length)return[];const e=[...t].sort((t,e)=>t.created_at-e.created_at),n=[];for(const i of e){const t=i.tags.filter(t=>"t"===t[0]).map(t=>t[1]).filter(Boolean),e=i.tags.filter(t=>"imeta"===t[0]);for(const r of e){let e=null,s=null,o=null,a=!1,l=16/9,c=null,u=i.tags.find(t=>"i"===t[0])?.[1];const h=i.tags.find(t=>"published_at"===t[0])?.[1],d=h?Number(h):null;for(const t of r.slice(1))if(t.startsWith("url "))e=t.substring(4);else if(t.startsWith("thumb "))s=t.substring(6);else if(t.startsWith("blurhash "))o=t.substring(9);else if(t.startsWith("dim ")){const[e,n]=t.substring(4).split("x").map(Number);e&&n&&(l=e/n,e>n&&(a=!0))}else if(t.startsWith("alt ")){const e=t.substring(4).trim();c="A photo of a place"===e?null:e||null}e&&n.push({eventId:i.id,pubkey:i.pubkey,createdAt:i.created_at,publishedAt:d&&d>0?d:null,url:e,thumbUrl:s,blurhash:o,isLandscape:a,aspectRatio:l,placeIdentifier:u,tags:t,alt:c})}}if(0===n.length)return[];const r=n.findIndex(t=>t.isLandscape);if(r>0){const[t]=n.splice(r,1);n.unshift(t)}return n}var gU="0123456789bcdefghjkmnpqrstuvwxyz",mU=class t{static encode(e,n,r){if(void 0===r){for(let r=1;r<=12;r++){const i=t.encode(e,n,r),s=t.decode(i);if(s.lat==e&&s.lon==n)return i}r=12}if(e=Number(e),n=Number(n),r=Number(r),isNaN(e)||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 t=(u+h)/2;n>=t?(i=2*i+1,u=t):(i*=2,h=t)}else{const t=(l+c)/2;e>=t?(i=2*i+1,l=t):(i*=2,c=t)}o=!o,5==++s&&(a+=gU.charAt(i),s=0,i=0)}return a}static decode(e){const n=t.bounds(e),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(t){if(0==t.length)throw new Error("Invalid geohash");t=t.toLowerCase();let e=!0,n=-90,r=90,i=-180,s=180;for(let o=0;o<t.length;o++){const a=t.charAt(o),l=gU.indexOf(a);if(-1==l)throw new Error("Invalid geohash");for(let t=4;t>=0;t--){const o=l>>t&1;if(e){const t=(i+s)/2;1==o?i=t:s=t}else{const t=(n+r)/2;1==o?n=t:r=t}e=!e}}return{sw:{lat:n,lon:i},ne:{lat:r,lon:s}}}static adjacent(e,n){if(e=e.toLowerCase(),n=n.toLowerCase(),0==e.length)throw new Error("Invalid geohash");if(-1=="nsew".indexOf(n))throw new Error("Invalid direction");const r=e.slice(-1);let i=e.slice(0,-1);const s=e.length%2;return-1!={n:["prxz","bcfguvyz"],s:["028b","0145hjnp"],e:["bcfguvyz","prxz"],w:["0145hjnp","028b"]}[n][s].indexOf(r)&&""!=i&&(i=t.adjacent(i,n)),i+gU.charAt({n:["p0r21436x8zb9dcf5h7kjnmqesgutwvy","bc01fg45238967deuvhjyznpkmstqrwx"],s:["14365h7k9dcfesgujnmqp0r2twvyx8zb","238967debc01fg45kmstqrwxuvhjyznp"],e:["bc01fg45238967deuvhjyznpkmstqrwx","p0r21436x8zb9dcf5h7kjnmqesgutwvy"],w:["238967debc01fg45kmstqrwxuvhjyznp","14365h7k9dcfesgujnmqp0r2twvyx8zb"]}[n][s].indexOf(r))}static neighbours(e){return{n:t.adjacent(e,"n"),ne:t.adjacent(t.adjacent(e,"n"),"e"),e:t.adjacent(e,"e"),se:t.adjacent(t.adjacent(e,"s"),"e"),s:t.adjacent(e,"s"),sw:t.adjacent(t.adjacent(e,"s"),"w"),w:t.adjacent(e,"w"),nw:t.adjacent(t.adjacent(e,"n"),"w")}}},yU=a({getGeohashPrefixesInBbox:()=>vU});function vU(t){const{minLat:e,minLon:n,maxLat:r,maxLon:i}=t,s=new Set;if(Math.abs(r-e)>20||Math.abs(i-n)>20)return console.debug("BBox too large for 4-char geohash scanning, aborting fine scan."),[];for(let a=e;a<=r+.1;a+=.1)for(let t=n;t<=i+.1;t+=.1){const e=Math.min(a,r),n=Math.min(t,i);try{const t=mU.encode(e,n,4);s.add(t)}catch(o){}}try{s.add(mU.encode(e,n,4))}catch(o){}try{s.add(mU.encode(r,i,4))}catch(o){}try{s.add(mU.encode(e,i,4))}catch(o){}try{s.add(mU.encode(r,n,4))}catch(o){}return Array.from(s)}var bU=a({default:()=>CU}),wU=["wss://relay.primal.net","wss://nos.lol","wss://relay.damus.io"],_U=["wss://nostr.kosmos.org"],xU=[],CU=class extends fp{static{BF(this.prototype,"nostrRelay",[pp])}#at=void qF(this,"nostrRelay");static{BF(this.prototype,"nostrAuth",[pp])}#N=void qF(this,"nostrAuth");static{BF(this.prototype,"settings",[pp])}#z=void qF(this,"settings");store=new mF;static{BF(this.prototype,"profile",[Wr],function(){return null})}#dt=void qF(this,"profile");static{BF(this.prototype,"mailboxes",[Wr],function(){return null})}#pt=void qF(this,"mailboxes");static{BF(this.prototype,"blossomServers",[Wr],function(){return[]})}#ft=void qF(this,"blossomServers");static{BF(this.prototype,"placePhotos",[Wr],function(){return[]})}#gt=void qF(this,"placePhotos");static{BF(this.prototype,"myContributionEvents",[Wr],function(){return[]})}#mt=void qF(this,"myContributionEvents");static{BF(this.prototype,"profiles",[Wr],function(){return{}})}#yt=void qF(this,"profiles");static{BF(this.prototype,"zapReceipts",[Wr],function(){return{}})}#vt=void qF(this,"zapReceipts");_profileSub=null;_mailboxesSub=null;_blossomSub=null;_photosSub=null;_contributionsSub=null;_profileModelSubs=new Map;_zapReceiptsSub=null;_zapReceiptsNetworkSub=null;_zapRefreshTimer=null;_lastPhotoIds=new Set;_requestSub=null;_cachePromise=null;_currentPlaceEntityId=null;loadedGeohashPrefixes=new Set;constructor(){super(...arguments),function(t,e,n){const r=function(t,e){const n=function(t,e){const n=JD(t);return XD(HO(e?.bufferTime??1e3,void 0,e?.bufferSize??200),function(...t){return QD(function*(e){if(0===(e=function(t){let e=new Map;for(let n of t){let t=e.get(n.id);t&&n.relays?t.relays?t.relays=[...t.relays,...n.relays.filter(e=>!t.relays.includes(e))]:t.relays=[...n.relays]:t||e.set(n.id,{...n})}return Array.from(e.values())}(e)).length)return;const n=new Set;let r=Array.from(e);for(const i of t)if(void 0!==i&&(yield i(r).pipe(GO(()=>XA),mN(t=>n.add(t.id))),r=r.filter(t=>!n.has(t.id)),0===r.length))return})}(e?.cacheRequest?function(t){return e=>(e=e.filter(t=>!1!==t.cache),0===e.length?XA:KD(t,[{ids:e.map(t=>t.id)}]))}(e.cacheRequest):void 0,!1!==e?.followRelayHints?ij(n):void 0,e?.extraRelays?nj(n,e.extraRelays):void 0),(t,e)=>e.id===t.id,null===e?.eventStore?MA:vF(e?.eventStore||new rF),{signal:e?.signal})}(t,{bufferTime:e?.bufferTime,bufferSize:e?.bufferSize,eventStore:e?.eventStore,cacheRequest:e?.cacheRequest,followRelayHints:e?.followRelayHints,extraRelays:e?.extraRelays,signal:e?.signal}),r=function(t,e){const n=JD(t);return XD(HO(e?.bufferTime??1e3,void 0,e?.bufferSize??200),function(...t){return QD(function*(e){if(0===(e=function(t){const e=new Map;for(const n of t){const t=JP(n.kind,n.pubkey,n.identifier);if(e.has(t)){const r=e.get(t);n.relays&&n.relays.length>0&&(r.relays?r.relays=IM(r.relays,n.relays):r.relays=n.relays),!1===n.cache&&(r.cache=!1)}else e.set(t,ej(n))}return Array.from(e.values())}(e.filter(ZD))).length)return;let n=Array.from(e);for(const r of t){if(void 0===r)continue;const t=yield r(n).pipe(GO(()=>XA)),e=new Set(t.filter(t=>YP(t.kind)).map(t=>XP(t)));if(n=n.filter(t=>!e.has(JP(t.kind,t.pubkey,t.identifier))),0===n.length)return}})}(e?.cacheRequest?function(t){return e=>(e=e.filter(t=>!1!==t.cache),0===e.length?XA:KD(t,GD(e)))}(e.cacheRequest):void 0,!1!==e?.followRelayHints?function(t){return e=>{const n=IM(...e.map(t=>t.relays));return 0===n.length?XA:t(n,GD(e))}}(n):void 0,e?.extraRelays?tj(n,e.extraRelays):void 0,e?.lookupRelays?tj(n,e.lookupRelays):void 0),(t,e)=>e.kind===t.kind&&e.pubkey===t.pubkey&&(void 0===t.identifier||tM(e)===t.identifier),null===e?.eventStore?MA:vF(e?.eventStore||new rF),{signal:e?.signal})}(t,{bufferTime:e?.bufferTime,bufferSize:e?.bufferSize,eventStore:e?.eventStore,cacheRequest:e?.cacheRequest,followRelayHints:e?.followRelayHints,extraRelays:e?.extraRelays,lookupRelays:e?.lookupRelays,signal:e?.signal}),i=()=>{n.stop(),r.stop()};return Object.assign(t=>FM(t)?n(t):r(t),{stop:i,[Symbol.dispose]:i})}(e,{...n,eventStore:t});t.eventLoader=r}(this.store,this.nostrRelay.pool,{cacheRequest:t=>this.cache?yO(this.cache.query(t)):XA,lookupRelays:wU}),this._cachePromise=zj("applesauce-events").then(async t=>{this.cache=new lU(t,{cacheIndexes:1e3,maxEvents:1e4}),await this.cache.start(),this._stopPersisting=function(t,e,n){const r=n?.batchTime??5e3,i=t.insert$.pipe(WO(t=>{return e=t,!(!0===Reflect.get(e,GP));var e}),n?.maxBatchSize?HO(r,void 0,n?.maxBatchSize??100):HO(r),WO(t=>t.length>0)).subscribe(t=>{e(t).then(()=>xN(`Saved ${t.length} events to cache`)).catch(e=>xN(`Failed to save ${t.length} events to cache`,e))});return()=>i.unsubscribe()}(this.store,async t=>{const e=t.filter(t=>0===t.kind||5===t.kind||10002===t.kind||10063===t.kind||360===t.kind||9735===t.kind);e.length>0&&await Promise.all(e.map(t=>this.cache.add(t)))},{batchTime:1e3,maxBatchSize:100})}),this.nostrRelay.pool.relays$.subscribe(()=>{})}get requiredReadRelays(){return _U}get requiredWriteRelays(){return xU}get mailboxReadRelays(){return(this.mailboxes?.inboxes||[]).map(uU).filter(Boolean)}get mailboxWriteRelays(){return(this.mailboxes?.outboxes||[]).map(uU).filter(Boolean)}get configuredReadRelays(){return pU(hU([...this.mailboxReadRelays,...this.settings.nostrReadRelays||[]]),this.settings.nostrReadRelayExclusions||[])}get configuredWriteRelays(){return pU(hU([...this.mailboxWriteRelays,...this.settings.nostrWriteRelays||[]]),this.settings.nostrWriteRelayExclusions||[])}get activeReadRelays(){return dU(this.requiredReadRelays,this.configuredReadRelays)}get activeWriteRelays(){return dU(this.requiredWriteRelays,this.configuredWriteRelays)}async loadPlacesInBounds(t){const e=vU(t).filter(t=>!this.loadedGeohashPrefixes.has(t));if(0!==e.length){console.debug("[nostr-data] Loading place photos for prefixes:",e);try{await this._cachePromise;const t=await this.cache.query([{kinds:[360],"#g":e}]);if(t&&t.length>0)for(const e of t)this.store.add(e)}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":e}]).subscribe({next:t=>{this.store.add(t)},error:t=>{console.error("[nostr-data] Error fetching place photos by geohash:",t)}});for(const t of e)this.loadedGeohashPrefixes.add(t)}}async loadPhotosForPlace(t){const e=t&&t.osmId&&t.osmType?`osm:${t.osmType}:${t.osmId}`:null;if((!e||e!==this._currentPlaceEntityId)&&(this._photosSub&&(this._photosSub.unsubscribe(),this._photosSub=null),this._cleanupZapReceiptSubs(),this._clearZapRefreshTimer(),this.placePhotos=[],this.zapReceipts={},this._lastPhotoIds=new Set,this._clearProfileSubs(),this._currentPlaceEntityId=e,e)){this._photosSub=this.store.timeline([{kinds:[360],"#i":[e]}]).subscribe(t=>{this.placePhotos=t;const e=[...new Set(t.map(t=>t.pubkey))];this.loadProfiles(e),this._scheduleZapReceiptRefresh(t)});try{await this._cachePromise;const t=await this.cache.query([{kinds:[360,5],"#i":[e]}]);if(t&&t.length>0)for(const e of t)this.store.add(e)}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":[e]}]).subscribe({next:t=>{this.store.add(t)},error:t=>{console.error("[nostr-data] Error fetching place photos for place:",t)}})}}async loadMyContributions(t){if(!t)return;this.myContributionEvents=[],this._contributionsSub&&(this._contributionsSub.unsubscribe(),this._contributionsSub=null);const e=[{kinds:[360,5],authors:[t]}];this._contributionsSub=this.store.timeline(e).subscribe(t=>{this.myContributionEvents=t});try{await this._cachePromise;const t=await this.cache.query(e);if(t&&t.length>0)for(const e of t)this.store.add(e)}catch(n){console.warn("[nostr-data] Failed to read my contributions from local Nostr IDB cache",n)}this.nostrRelay.pool.request(this.activeReadRelays,e).subscribe({next:t=>{this.store.add(t)},error:t=>{console.error("[nostr-data] Error fetching my contribution events:",t)}})}loadProfiles(t){const e=t.filter(t=>t&&!this._profileModelSubs.has(t));for(const n of e){const t=this.store.model(pF,n).subscribe(t=>{this.profiles={...this.profiles,[n]:t}});this._profileModelSubs.set(n,t)}}getProfile(t){return this.profiles[t]}_clearProfileSubs(){for(const t of this._profileModelSubs.values())t.unsubscribe();this._profileModelSubs.clear(),this.profiles={}}async loadProfile(t){if(!t)return;this.profile=null,this.mailboxes=null,this.blossomServers=[],this._cleanupSubscriptions(),this._profileSub=this.store.model(pF,t).subscribe(t=>{this.profile=t}),this._mailboxesSub=this.store.model(dF,t).subscribe(t=>{this.mailboxes=t}),this._blossomSub=this.store.replaceable(10063,t).subscribe(t=>{t&&t.tags?this.blossomServers=t.tags.filter(t=>"server"===t[0]&&t[1]).map(t=>t[1]):this.blossomServers=[]});try{await this._cachePromise;const e=await this.cache.query([{authors:[t],kinds:[0,10002,10063]}]);if(e&&e.length>0)for(const t of e)this.store.add(t)}catch(n){console.warn("Failed to read from local Nostr IDB cache",n)}const e=Array.from(new Set([...wU,...this.activeWriteRelays]));this._requestSub=this.nostrRelay.pool.request(e,[{authors:[t],kinds:[0,10002,10063]}]).subscribe({next:t=>{this.store.add(t)},error:t=>{console.error("Error fetching profile events:",t)}})}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 t=function(t,e){return function(t,e){let n=rk.toWords(e);return rk.encode("npub",n,wM)}(0,e)}(0,PS(this.nostrAuth.pubkey));return`${t.slice(0,9)}...${t.slice(-4)}`}catch{return this.nostrAuth.pubkey}return"Not connected"}async clearCache(){await this._cachePromise,this.cache&&await this.cache.deleteAllEvents()}_scheduleZapReceiptRefresh(t){const e=new Set(t.map(t=>t.id));let n=!1;if(e.size!==this._lastPhotoIds.size)n=!0;else for(const r of e)if(!this._lastPhotoIds.has(r)){n=!0;break}n&&(this._lastPhotoIds=e,this._clearZapRefreshTimer(),this._zapRefreshTimer=setTimeout(()=>{this._zapRefreshTimer=null,this._refreshZapReceiptSubscription([...e])},100))}_clearZapRefreshTimer(){this._zapRefreshTimer&&(clearTimeout(this._zapRefreshTimer),this._zapRefreshTimer=null)}_refreshZapReceiptSubscription(t){if(this._cleanupZapReceiptSubs(),!t||0===t.length)return;const e=[];for(let n=0;n<t.length;n+=100)e.push({kinds:[9735],"#e":t.slice(n,n+100)});this._zapReceiptsSub=this.store.timeline(e).subscribe(t=>{this._updateZapReceipts(t)}),this._cachePromise.then(()=>this.cache.query(e)).then(t=>{if(t&&t.length>0)for(const e of t)this.store.add(e)}).catch(t=>{console.warn("[nostr-data] Failed to read zap receipts from cache",t)}),this._zapReceiptsNetworkSub=this.nostrRelay.pool.request(this.activeReadRelays,e).subscribe({next:t=>{this.store.add(t)},error:t=>{console.error("[nostr-data] Error fetching zap receipts:",t)}})}_updateZapReceipts(t){const e={};for(const n of t)for(const t of n.tags)"e"===t[0]&&t[1]&&(e[t[1]]||(e[t[1]]=[]),e[t[1]].push(n));this.zapReceipts={...this.zapReceipts,...e}}_cleanupZapReceiptSubs(){this._zapReceiptsSub&&(this._zapReceiptsSub.unsubscribe(),this._zapReceiptsSub=null),this._zapReceiptsNetworkSub&&(this._zapReceiptsNetworkSub.unsubscribe(),this._zapReceiptsNetworkSub=null)}_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),this._cleanupZapReceiptSubs(),this._clearZapRefreshTimer()}willDestroy(){super.willDestroy(...arguments),this._cleanupSubscriptions(),this._clearProfileSubs(),this._stopPersisting&&this._stopPersisting(),this.cache&&this.cache.stop()}};function SU(t,e=t=>!!t){return XO(n=>{const r=e?n.pipe(t,WO(e),JO(1)):n.pipe(t,JO(1));return n.pipe(fN(r))})}function kU(t){return GO(e=>vO({ok:!1,from:t.url,message:e?.message||"Unknown error"}))}var EU,RU=class t{relays$=new BA([]);status$;get relays(){if(this.relays$ instanceof BA)return this.relays$.value;throw new Error("This group was created with an observable, relays are not available")}constructor(t){this.relays$=Array.isArray(t)?new BA(t):t,this.status$=this.relays$.pipe(pN(t=>0===t.length?vO({}):BO(...t.map(t=>t.status$)).pipe(lN((t,e)=>({...t,[e.url]:e}),{}),dN({}))),hN(1))}get controlled(){return this.relays$ instanceof BA==0}has(t){if(this.controlled)throw new Error("This group was created with an observable, relays are not available");return"string"==typeof t?this.relays.some(e=>e.url===t):this.relays.includes(t)}add(t){this.has(t)||this.relays$.next([...this.relays,t])}remove(t){this.has(t)&&this.relays$.next(this.relays.filter(e=>e!==t))}internalSubscription(t){const e=new WeakMap;return this.relays$.pipe(function(t){return NA((e,n)=>{let r=null,i=!1;const s=()=>{i&&!r&&n.complete()};e.subscribe(FA(n,e=>{const i=r,o=r=FA(n,t=>n.next(t),()=>{r!==o&&null!==r||(r=null,s())});yO(t(e)).subscribe(r),i?.unsubscribe()},()=>{i=!0,s()}))})}(n=>{const r=[];for(const i of n){if(e.has(i)){r.push(e.get(i));continue}const n=t(i).pipe(GO(t=>vO({type:"ERROR",from:i.url,error:t})));r.push(n),e.set(i,n)}return BO(...r)}),cN())}internalPublish(t){const e=new WeakMap;return this.relays$.pipe(JO(1),pN(n=>{const r=[];for(const i of n){if(e.has(i)){r.push(e.get(i));continue}const n=t(i).pipe(kU(i));r.push(n),e.set(i,n)}return BO(...r)}),cN())}req(t,e){return this.internalSubscription(n=>n.req(t,e))}event(t){return this.internalPublish(e=>e.event(t))}async negentropy(t,e,n,r){const i=(await Promise.all(this.relays.map(async t=>[t,await t.getSupported()]))).filter(([t,e])=>e?.includes(77)).map(([t])=>t);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(t,e,n,r))),!0}publish(t,e){return xO(this.internalPublish(n=>yO(n.publish(t,e))).pipe(NA(function(t,e){(function(t,e){return NA(ZO(t,e,arguments.length>=2,!1,!0))})(KO,[])(t).subscribe(e)}),(n=[],NA(function(t,e){var r=!1;t.subscribe(FA(e,function(t){r=!0,e.next(t)},function(){r||e.next(n),e.complete()}))}))));var n}request(e,n){const r=n?.complete??t.completeOnAny(t.completeAfterFirstRelay(5e3),t.completeOnAllEose());return this.internalSubscription(t=>t.req(e,{...n,reconnect:n?.reconnect??t.requestReconnect})).pipe(r?SU(r):MA,EO({first:n?.timeout??3e4}),WO(t=>"EVENT"===t.type),TO(t=>t.event),null===n?.eventStore?MA:vF(n?.eventStore??new rF),cN())}subscription(t,e){return this.internalSubscription(n=>n.req(t,{...e,reconnect:e?.reconnect??n.subscriptionReconnect})).pipe(WO(t=>"EVENT"===t.type),TO(t=>t.event),null===e?.eventStore?MA:vF(e?.eventStore??new rF),cN())}count(t,e=hM()){return this.relays$.pipe(pN(n=>OO(Object.fromEntries(n.map(n=>[n.url,n.count(t,e)])))),cN())}sync(t,e,n){return jO(async()=>{const t=(await Promise.all(this.relays.map(async t=>[t,await t.getSupported()]))).filter(([t,e])=>e?.includes(77)).map(([t])=>t);if(0===t.length)throw new Error("No relays support NIP-77 negentropy sync");return t}).pipe(pN(r=>BO(...r.map(r=>r.sync(t,e,n)))),cN())}static completeAfterFirstRelay(t=5e3){return e=>e.pipe(WO(t=>"EOSE"===t.type)).pipe(JO(1),pN(()=>UO(t)),TO(()=>!0))}static completeOnAllEose(){return t=>t.pipe(WO(t=>"OPEN"===t.type||"EOSE"===t.type||"ERROR"===t.type),lN((t,e)=>t.set(e.from,e.type),new Map),TO(t=>Array.from(t.values()).every(t=>"OPEN"!==t)))}static completeOnAny(...t){return XO(e=>BO(...t.map(t=>e.pipe(t))))}static completeOnAll(...t){return XO(e=>OO(t.map(t=>e.pipe(t))).pipe(TO(t=>t.every(t=>!!t))))}},TU={url:"",deserializer:function(t){return JSON.parse(t.data)},serializer:function(t){return JSON.stringify(t)}},LU=function(t){function e(e,n){var r=t.call(this)||this;if(r._socket=null,e instanceof AA)r.destination=n,r.source=e;else{var i=r._config=sA({},TU);if(r._output=new jA,"string"==typeof e)i.url=e;else for(var s in e)e.hasOwnProperty(s)&&(i[s]=e[s]);if(!i.WebSocketCtor&&WebSocket)i.WebSocketCtor=WebSocket;else if(!i.WebSocketCtor)throw new Error("no WebSocket constructor can be found");r.destination=new qA}return r}return iA(e,t),e.prototype.lift=function(t){var n=new e(this._config,this.destination);return n.operator=t,n.source=this,n},e.prototype._resetState=function(){this._socket=null,this.source||(this.destination=new qA),this._output=new jA},e.prototype.multiplex=function(t,e,n){var r=this;return new AA(function(i){try{r.next(t())}catch(nD){i.error(nD)}var s=r.subscribe({next:function(t){try{n(t)&&i.next(t)}catch(nD){i.error(nD)}},error:function(t){return i.error(t)},complete:function(){return i.complete()}});return function(){try{r.next(e())}catch(nD){i.error(nD)}s.unsubscribe()}})},e.prototype._connectSocket=function(){var t=this,e=this._config,n=e.WebSocketCtor,r=e.protocol,i=e.url,s=e.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 gA(function(){t._socket=null,a&&1===a.readyState&&a.close()});a.onopen=function(e){if(!t._socket)return a.close(),void t._resetState();var n=t._config.openObserver;n&&n.next(e);var r=t.destination;t.destination=kA.create(function(e){if(1===a.readyState)try{var n=t._config.serializer;a.send(n(e))}catch(c){t.destination.error(c)}},function(e){var n=t._config.closingObserver;n&&n.next(void 0),e&&e.code?a.close(e.code,e.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 }")),t._resetState()},function(){var e=t._config.closingObserver;e&&e.next(void 0),a.close(),t._resetState()}),r&&r instanceof qA&&l.add(r.subscribe(t.destination))},a.onerror=function(e){t._resetState(),o.error(e)},a.onclose=function(e){a===t._socket&&t._resetState();var n=t._config.closeObserver;n&&n.next(e),e.wasClean?o.complete():o.error(e)},a.onmessage=function(e){try{var n=t._config.deserializer;o.next(n(e))}catch(nD){o.error(nD)}}},e.prototype._subscribe=function(t){var e=this,n=this.source;return n?n.subscribe(t):(this._socket||this._connectSocket(),this._output.subscribe(t),t.add(function(){var t=e._socket;0===e._output.observers.length&&(!t||1!==t.readyState&&0!==t.readyState||t.close(),e._resetState())}),t)},e.prototype.unsubscribe=function(){var e=this._socket;!e||1!==e.readyState&&0!==e.readyState||e.close(),this._resetState(),t.prototype.unsubscribe.call(this)},e}(UA),IU="auth-required:",PU={count:3,delay:(t,e)=>UO(1e3*e),resetOnSuccess:!0};function MU(t){return"number"==typeof t?{...PU,count:t}:{...PU,...t??{}}}!function(t){t[t.RECEIVE=1]="RECEIVE",t[t.SEND=2]="SEND",t[t.BOTH=3]="BOTH"}(EU||(EU={}));var AU=class extends Error{reason;constructor(t){super(t),this.reason=t,this.name="RelayClosedError"}},OU=class extends AU{constructor(t){super(t),this.name="AuthRequiredError"}},NU={"auth-required":OU,unsupported:AU,error:AU,blocked:AU,restricted:AU,"rate-limited":AU,pow:AU,invalid:AU,duplicate:AU,mute:AU};function FU(t){const e=NU[t.split(":")[0]];return e?new e(t):null}var zU={ids:["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"],limit:0},DU=class t{url;log=_N.extend("Relay");socket;_ready$=new BA(!0);ready$=this._ready$.asObservable();reconnectTimer;attempts$=new BA(0);connected$=new BA(!1);challenge$=new BA(null);authenticated$;authenticatedAs$;authentication$=new BA(null);authenticationResponse$=new BA(null);notices$=new BA([]);error$=new BA(null);message$;notice$;lastMessageReceivedAt=0;_lastMessageAt$=new BA(0);lastMessageAt$=this._lastMessageAt$.asObservable();status$;information$;_nip11=null;icon$;limitations$;supported$;open$=new jA;close$=new jA;closing$=new jA;reqs$=new BA({});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 BA(!1);receivedAuthRequiredForEvent=new BA(!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 gA;reconnectSubscription=null;destroy$=new qA(1);constructor(e,n){var r;this.url=e,this.log=this.log.extend(e),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=MU(n?.subscriptionReconnect),this.requestReconnect=MU(n?.requestReconnect),this.publishRetry={...PU,...n?.publishRetry??{}},this.authenticated$=this.authenticationResponse$.pipe(TO(t=>!0===t?.ok)),this.authenticatedAs$=OO([this.authenticated$,this.authentication$]).pipe(TO(([t,e])=>t&&e?e.pubkey:null)),this.reconnectTimer=t.createReconnectTimer(e),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(t=>{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(),t.wasClean||this.startReconnectTimer(t)})),this.socket=(r={url:e,openObserver:this.open$,closeObserver:this.close$,closingObserver:this.closing$,WebSocketCtor:n?.WebSocket},new LU(r)),this.information$=jO(()=>(this.log("Fetching NIP-11 information document"),t.fetchInformationDocument(this.url))).pipe(GO(()=>vO(null)),mN(t=>this._nip11=t),hN(1)),this.limitations$=this.information$.pipe(TO(t=>t?t.limitation:null)),this.supported$=this.information$.pipe(TO(t=>t&&Array.isArray(t.supported_nips)?t.supported_nips.filter(t=>"number"==typeof t):null)),this.icon$=this.information$.pipe(TO(t=>t?.icon||new URL("/favicon.ico",CM(this.url)).toString())),this.authRequiredForRead$=this.receivedAuthRequiredForReq,this.authRequiredForPublish$=this.receivedAuthRequiredForEvent,this.internalSubscriptions.add(this.authRequiredForRead$.pipe(WO(t=>!0===t),JO(1)).subscribe(()=>this.log("Auth required for REQ"))),this.internalSubscriptions.add(this.authRequiredForPublish$.pipe(WO(t=>!0===t),JO(1)).subscribe(()=>this.log("Auth required for EVENT"))),this.status$=OO({url:vO(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(hN(1));const i=this.socket.pipe(WO(t=>Array.isArray(t)&&"NOTICE"===t[0]),TO(t=>t[1]),lN((t,e)=>[...t,e],[]),mN(t=>this.notices$.next(t))),s=this.socket.pipe(WO(t=>"AUTH"===t[0]),TO(t=>t[1]),mN(t=>{this.log("Received AUTH challenge",t),this.challenge$.next(t)})),o=new jA,a=this.socket.pipe(mN(t=>{const e=Date.now();this.lastMessageReceivedAt=e,this._lastMessageAt$.next(e),o.next(t)}));this.message$=o.asObservable(),this.notice$=this.message$.pipe(WO(t=>Array.isArray(t)&&"NOTICE"===t[0]),TO(t=>t[1]));const l=this.connected$.pipe(pN(t=>t&&this.enablePing?UO(this.pingFrequency,this.pingFrequency).pipe(FO(()=>{if(Date.now()-this.lastMessageReceivedAt<this.pingFrequency)return $O;const t="ping:"+hM();return this.send(["REQ",t,zU]),this.message$.pipe(WO(e=>Array.isArray(e)&&("EOSE"===e[0]||"CLOSED"===e[0])&&e[1]===t),JO(1),EO({first:this.pingTimeout,with:()=>{const t=Date.now(),e=this.onUnresponsive?.({url:this.url,lastMessageAt:this.lastMessageReceivedAt,now:t,attempts:this.attempts$.value})??"reconnect",n=new Error(`Relay ping timeout after ${this.pingTimeout}ms`);return"reconnect"===e?(this.log("Relay connection has become unresponsive, triggering reconnect"),this.startReconnectTimer(n)):"close"===e?(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)"),$O}}),rN(()=>this.send(["CLOSE",t])))})):$O),GO(()=>$O));this.watchTower=this.ready$.pipe(pN(t=>t?BO(a,i,s,l).pipe(QO(),GO(t=>(this.startReconnectTimer(t instanceof Error?t:new Error("Connection error")),$O)),cN({resetOnRefCountZero:()=>UO(this.keepAlive).pipe(fN(this.destroy$))})):$O),cN())}startReconnectTimer(t){this.ready&&(this.error$.next(t instanceof Error?t:new Error("Connection error")),this._ready$.next(!1),this.reconnectSubscription?.unsubscribe(),this.reconnectSubscription=this.reconnectTimer(t,this.attempts$.value).pipe(JO(1)).subscribe(()=>{this.reconnectSubscription=null,this._ready$.next(!0)}))}waitForAuth(t,e){return OO([t,this.authenticated$]).pipe(sN(this.watchTower),WO(([t,e])=>!t||e),JO(1),pN(()=>e))}waitForReady(t){return this.ready?t:this.ready$.pipe(WO(t=>t),JO(1),pN(()=>t))}multiplex(t,e,n){return this.socket.multiplex(t,e,n)}send(t){this.socket.next(t)}req(t,e){const n=e?.id??hM(),r=e?.waitForAuth??!0;let i;if("function"==typeof t){const e=t(this);i=(wO(e)?e:BO(vO(e),$O)).pipe(TO(t=>Array.isArray(t)?t:[t]))}else i=(wO(t)?t:BO(vO(t),$O)).pipe(TO(t=>Array.isArray(t)?t:[t]));const s=i.pipe(QO(),nN(!0));let o=!1,a=!1;const l=this.socket.pipe(WO(t=>Array.isArray(t)&&("EVENT"===t[0]||"CLOSED"===t[0]||"EOSE"===t[0])&&t[1]===n),TO(t=>"EVENT"===t[0]&&"object"==typeof t[2]?{type:"EVENT",from:this.url,id:t[1],event:t[2]}:"CLOSED"===t[0]?{type:"CLOSED",from:this.url,id:t[1],reason:t[2]??""}:{type:"EOSE",from:this.url,id:t[1]}),mN(t=>{if("CLOSED"===t.type){o=!0;const e=FU(t.reason);if(e)throw e;a=!0}}),gN(t=>"CLOSED"!==t.type,!0),cN()),c=i.pipe(TO(t=>(o=!1,a=!1,this.socket.next(["REQ",n,...t]),this.reqs$.next({...this.reqs$.value,[n]:t}),{type:"OPEN",id:n,filters:t,from:this.url})),rN(()=>{o||this.socket.next(["CLOSE",n]);const{[n]:t,...e}=this.reqs$.value;this.reqs$.next(e)}),pN(t=>l.pipe(dN(t)))),u=BO(this.watchTower,c).pipe(fN(l.pipe(QO(),nN(!0))),fN(s),mN(t=>{"EVENT"===t.type&&RM(t.event,this.url)}),cN()),h=r?this.waitForAuth(this.authRequiredForRead$,u):u;return jO(()=>this.waitForReady(h)).pipe(aN({delay:t=>t instanceof OU?(this.log("Auth required for REQ"),this.receivedAuthRequiredForReq.next(!0),r?this.authenticated$.pipe(WO(t=>t),JO(1)):bO(()=>t)):bO(()=>t)}),this.customConnectionRetryOperator(e?.reconnect),this.customRepeatOperator(e?.resubscribe,()=>a),cN())}count(t,e=hM()){let n=!1;const r=this.socket.pipe(WO(t=>Array.isArray(t)&&("COUNT"===t[0]||"CLOSED"===t[0])&&t[1]===e),TO(t=>{if("COUNT"===t[0])return t[2];if("CLOSED"===t[0]){n=!0;const e=FU(t[2]??"");if(e)throw e}return null}),gN(t=>null!==t,!0),WO(t=>null!==t),cN()),i=jO(()=>(n=!1,this.socket.next(Array.isArray(t)?["COUNT",e,...t]:["COUNT",e,t]),r)).pipe(rN(()=>{n||this.socket.next(["CLOSE",e])})),s=BO(this.watchTower,i).pipe(fN(r.pipe(QO(),nN(!0))),JO(1),GO(t=>(t instanceof OU&&!this.receivedAuthRequiredForReq.value&&(this.log("Auth required for COUNT"),this.receivedAuthRequiredForReq.next(!0)),bO(()=>t))),EO({first:1e4,with:()=>bO(()=>new Error("COUNT timeout"))}));return this.waitForReady(this.waitForAuth(this.authRequiredForRead$,s)).pipe(cN())}event(t,e="EVENT"){const n=jO(()=>(this.socket.next([e,t]),this.socket.pipe(WO(e=>"OK"===e[0]&&e[1]===t.id),TO(t=>({ok:t[2],message:t[3],from:this.url}))))).pipe(cN()),r=BO(this.watchTower,n).pipe(fN(n.pipe(QO(),nN(!0))),JO(1),mN(({ok:t,message:e})=>{!1===t&&e?.startsWith(IU)&&!this.receivedAuthRequiredForEvent.value&&(this.log("Auth required for publish"),this.receivedAuthRequiredForEvent.next(!0))}),EO({first:this.eventTimeout,with:()=>vO({ok:!1,from:this.url,message:"Timeout"})}));return"AUTH"===e?this.waitForReady(r).pipe(cN()):this.waitForReady(this.waitForAuth(this.authRequiredForPublish$,r)).pipe(cN())}auth(t){return this.authentication$.next(t),xO(this.event(t,"AUTH").pipe(mN(t=>this.authenticationResponse$.next(t))))}async negentropy(t,e,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 sU(async()=>{const{buildStorageVector:t,buildStorageFromFilter:e,negentropySync:n}=await import("./negentropy-vHp2OmZI.js");return{buildStorageVector:t,buildStorageFromFilter:e,negentropySync:n}},[]);return o(Array.isArray(t)?i(t):await s(t,e),this.socket,e,n,r)}authenticate(t){if(!this.challenge)throw new Error("Have not received authentication challenge");const e=t.signEvent(function(t,e){return{kind:22242,created_at:Math.floor(Date.now()/1e3),tags:[["relay",t],["challenge",e]],content:""}}(this.url,this.challenge));return xO((e instanceof Promise?yO(e):vO(e)).pipe(pN(t=>this.auth(t))))}customRetryOperator(t,e){return!1===t||void 0===t?MA:"number"==typeof t?aN({...e,count:t}):!0===t?e?aN(e):aN():aN({...e,...t})}customConnectionRetryOperator(t,e){if(!1===t||void 0===t)return MA;const n="number"==typeof t?{...e,count:t}:!0===t?e??{}:{...e,...t};return aN({...n,delay:(t,e)=>t instanceof AU?bO(()=>t):"number"==typeof n.delay?UO(n.delay):"function"==typeof n.delay?n.delay(t,e):vO(null)})}customRepeatOperator(t,e){if(!1===t||void 0===t)return MA;const n=n=>{if(e&&!e())return XA;if("object"==typeof t){if("number"==typeof t.delay)return UO(t.delay);if("function"==typeof t.delay)return t.delay(n)}return vO(null)};return oN(!0===t?{delay:n}:"number"==typeof t?{count:t,delay:n}:{...t,delay:n})}customTimeoutOperator(t,e){return!1===t?MA:wF(!0===t?e:t??e)}subscription(t,e){return this.req(t,{...e,reconnect:e?.reconnect??this.subscriptionReconnect}).pipe(WO(t=>"EOSE"===t.type||"EVENT"===t.type),TO(t=>"EOSE"===t.type?"EOSE":t.event),cN())}request(t,e){return this.req(t,{...e,reconnect:e?.reconnect??this.requestReconnect}).pipe(e?.complete?SU(e?.complete):MA,EO({first:e?.timeout??3e4}),gN(t=>"EOSE"!==t.type),WO(t=>"EVENT"===t.type),TO(t=>t.event),cN())}publish(t,e){return xO(this.event(t).pipe(FO(t=>!1===t.ok&&t.message?.startsWith(IU)?bO(()=>new OU(t.message??"")):vO(t)),this.customRetryOperator(e?.retries??e?.reconnect??!0,this.publishRetry),this.customTimeoutOperator(e?.timeout,this.publishTimeout)))}sync(t,e,n=EU.RECEIVE){return new AA(r=>{const i=new AbortController;let s=!1;return this.negentropy(t,e,async(e,i)=>{if(n&EU.SEND&&e.length>0){const n=await(async e=>Array.isArray(t)?t.filter(t=>e.includes(t.id)):t.getByFilters({ids:e}))(e);await Promise.allSettled(n.map(async t=>{const e=await xO(this.event(t));return e.ok&&RM(t,this.url),e}))}n&EU.RECEIVE&&i.length>0&&await xO(this.req({ids:i}).pipe(gN(t=>"EOSE"!==t.type),WO(t=>"EVENT"===t.type),TO(t=>t.event),Reflect.has(t,"add")?yF(t):MA,mN(t=>r.next(t))))},{signal:i.signal}).then(()=>{s||r.complete()}).catch(t=>{s||r.error(t)}),()=>{s||(s=!0,i.abort())}}).pipe(cN())}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 CO(this.information$)}async getLimitations(){return CO(this.limitations$)}async getSupported(){return CO(this.supported$)}static fetchInformationDocument(t){return yO(fetch(CM(t),{headers:{Accept:"application/nostr+json"}}).then(t=>t.json())).pipe(GO(()=>vO(null)),wF(1e4))}static createReconnectTimer(t){return(t,e=0)=>UO(Math.min(1e3*Math.pow(1.5,e),3e5))}static afterOpen(t){return e=>e.pipe(WO(t=>"OPEN"===t.type),pN(()=>e.pipe(t)))}static completeOr(...t){return e=>OO(t.map(t=>e.pipe(t,dN(!1)))).pipe(TO(t=>t.some(t=>!!t)))}static completeAnd(...t){return e=>OO(t.map(t=>e.pipe(t,dN(!1)))).pipe(TO(t=>t.every(t=>!!t)))}static defaultComplete(t,e=1e4){return this.completeOr(()=>UO(t),this.afterOpen(()=>UO(e)))}},jU=class{options;relays$=new BA(new Map);get relays(){return this.relays$.value}status$;ignoreOffline=!1;add$=new jA;remove$=new jA;constructor(t){this.options=t,this.status$=this.relays$.pipe(TO(t=>Array.from(t.values())),pN(t=>0===t.length?vO({}):BO(...t.map(t=>t.status$)).pipe(lN((t,e)=>({...t,[e.url]:e}),{}),dN({}))),hN(1))}relay(t){t=SM(t);let e=this.relays.get(t);return e||(e=new DU(t,this.options),this.relays.set(t,e),this.relays$.next(this.relays),this.add$.next(e),e)}group(t,e=this.ignoreOffline){let n=Array.isArray(t)?t.map(t=>this.relay(t)):t.pipe(TO(t=>t.map(t=>this.relay(t))));return e&&(n=(Array.isArray(n)?vO(n):n).pipe(pN(t=>0===t.length?vO([]):OO(t.map(t=>t.ready$.pipe(WO(t=>t),JO(1),TO(()=>t),dN(null)))).pipe(TO(t=>t.filter(t=>null!==t)))))),new RU(n)}remove(t,e=!0){let n;if("string"==typeof t){if(n=this.relays.get(t),!n)return}else{if(!Array.from(this.relays.values()).some(e=>e===t))return;n=t}e&&n?.close(),this.relays.delete(n.url),this.relays$.next(this.relays),this.remove$.next(n)}close(){for(const t of[...this.relays.values()])this.remove(t,!0)}req(t,e,n){return this.group(t).req(e,n)}event(t,e){return this.group(t).event(e)}negentropy(t,e,n,r,i){return this.group(t).negentropy(e,n,r,i)}publish(t,e,n){return this.group(t).publish(e,n)}request(t,e,n){return this.group(t).request(e,n)}subscription(t,e,n){return this.group(t).subscription(e,n)}subscriptionMap(t,e){const n=wO(t)?t:vO(t);return this.group(n.pipe(TO(t=>Object.keys(t)))).subscription(t=>n.pipe(TO(e=>e[t.url]),tN(AN)),e)}outboxSubscription(t,e,n){const r=wO(t)?t.pipe(TO(t=>$N(t,e))):$N(t,e);return this.subscriptionMap(r,n)}count(t,e,n){return this.group(t,!1).count(e,n)}sync(t,e,n,r){return this.group(t,!1).sync(e,n,r)}},UU=a({default:()=>BU}),BU=class extends fp{pool=new jU({enablePing:!0});async publish(t,e){if(!t||0===t.length)throw new Error("No relays provided to publish the event.");const n=await this.pool.publish(t,e);if(!n.some(t=>t.ok))throw new Error(`Failed to publish event. Responses: ${JSON.stringify(n)}`);return n}},$U=(new rF,Symbol.for("seal")),qU=Symbol.for("rumor"),VU=Symbol.for("gift-wrap");sM.add(VU),sM.add($U),sM.add(qU),WM(30078,"nip44");var WU=o((t,n)=>{var{bech32:r,hex:i,utf8:o}=(jk(),(t=>s.call(t,"module.exports")?t["module.exports"]:l(e({},"__esModule",{value:!0}),t))(Ck)),a={bech32:"bc",pubKeyHash:0,scriptHash:5,validWitnessVersions:[0]},c={bech32:"tb",pubKeyHash:111,scriptHash:196,validWitnessVersions:[0]},u={bech32:"tbs",pubKeyHash:111,scriptHash:196,validWitnessVersions:[0]},h={bech32:"bcrt",pubKeyHash:111,scriptHash:196,validWitnessVersions:[0]},d={bech32:"sb",pubKeyHash:63,scriptHash:123,validWitnessVersions:[0]},p=["option_data_loss_protect","initial_routing_sync","option_upfront_shutdown_script","gossip_queries","var_onion_optin","gossip_queries_ex","option_static_remotekey","payment_secret","basic_mpp","option_support_large_channel"],f={m:BigInt(1e3),u:BigInt(1e6),n:BigInt(1e9),p:BigInt(1e12)},g=BigInt("2100000000000000000"),m=BigInt(1e11),y={payment_hash:1,payment_secret:16,description:13,payee:19,description_hash:23,expiry:6,min_final_cltv_expiry:24,fallback_address:9,route_hint:3,feature_bits:5,metadata:27},v={};for(let e=0,s=Object.keys(y);e<s.length;e++){const t=s[e],n=y[s[e]].toString();v[n]=t}var b={1:t=>i.encode(r.fromWordsUnsafe(t)),16:t=>i.encode(r.fromWordsUnsafe(t)),13:t=>o.encode(r.fromWordsUnsafe(t)),19:t=>i.encode(r.fromWordsUnsafe(t)),23:t=>i.encode(r.fromWordsUnsafe(t)),27:t=>i.encode(r.fromWordsUnsafe(t)),6:_,24:_,3:function(t){const e=[];let n,s,o,a,l,c=r.fromWordsUnsafe(t);for(;c.length>0;)n=i.encode(c.slice(0,33)),s=i.encode(c.slice(33,41)),o=parseInt(i.encode(c.slice(41,45)),16),a=parseInt(i.encode(c.slice(45,49)),16),l=parseInt(i.encode(c.slice(49,51)),16),c=c.slice(51),e.push({pubkey:n,short_channel_id:s,fee_base_msat:o,fee_proportional_millionths:a,cltv_expiry_delta:l});return e},5:function(t){const e=t.slice().reverse().map(t=>[!!(1&t),!!(2&t),!!(4&t),!!(8&t),!!(16&t)]).reduce((t,e)=>t.concat(e),[]);for(;e.length<2*p.length;)e.push(!1);const n={};p.forEach((t,r)=>{let i;i=e[2*r]?"required":e[2*r+1]?"supported":"unsupported",n[t]=i});const r=e.slice(2*p.length);return n.extra_bits={start_bit:2*p.length,bits:r,has_required:r.reduce((t,e,n)=>n%2!=0?t||!1:t||e,!1)},n}};function w(t){return e=>({tagCode:parseInt(t),words:r.encode("unknown",e,Number.MAX_SAFE_INTEGER)})}function _(t){return t.reverse().reduce((t,e,n)=>t+e*Math.pow(32,n),0)}function x(t,e){let n,r;if(t.slice(-1).match(/^[munp]$/))n=t.slice(-1),r=t.slice(0,-1);else{if(t.slice(-1).match(/^[^munp0-9]$/))throw new Error("Not a valid multiplier for the amount");r=t}if(!r.match(/^\d+$/))throw new Error("Not a valid human readable amount");const i=BigInt(r),s=n?i*m/f[n]:i*m;if("p"===n&&i%BigInt(10)!==BigInt(0)||s>g)throw new Error("Amount is outside of valid range");return e?s.toString():s}n.exports={decode:function(t,e){if("string"!=typeof t)throw new Error("Lightning Payment Request must be string");if("ln"!==t.slice(0,2).toLowerCase())throw new Error("Not a proper lightning payment request");const n=[],s=r.decode(t,Number.MAX_SAFE_INTEGER);t=t.toLowerCase();const o=s.prefix;let l=s.words,p=t.slice(o.length+1),f=l.slice(-104);l=l.slice(0,-104);let g=o.match(/^ln(\S+?)(\d*)([a-zA-Z]?)$/);if(g&&!g[2]&&(g=o.match(/^ln(\S+)$/)),!g)throw new Error("Not a proper lightning payment request");n.push({name:"lightning_network",letters:"ln"});const m=g[1];let C;if(e){if(void 0===e.bech32||void 0===e.pubKeyHash||void 0===e.scriptHash||!Array.isArray(e.validWitnessVersions))throw new Error("Invalid network");C=e}else switch(m){case a.bech32:C=a;break;case c.bech32:C=c;break;case u.bech32:C=u;break;case h.bech32:C=h;break;case d.bech32:C=d}if(!C||C.bech32!==m)throw new Error("Unknown coin bech32 prefix");n.push({name:"coin_network",letters:m,value:C});const S=g[2];let k;S?(k=x(S+g[3],!0),n.push({name:"amount",letters:g[2]+g[3],value:k})):k=null,n.push({name:"separator",letters:"1"});const E=_(l.slice(0,7));let R,T,L,I;for(l=l.slice(7),n.push({name:"timestamp",letters:p.slice(0,7),value:E}),p=p.slice(7);l.length>0;){const t=l[0].toString();R=v[t]||"unknown_tag",T=b[t]||w(t),l=l.slice(1),L=_(l.slice(0,2)),l=l.slice(2),I=l.slice(0,L),l=l.slice(L),n.push({name:R,tag:p[0],letters:p.slice(0,3+L),value:T(I)}),p=p.slice(3+L)}n.push({name:"signature",letters:p.slice(0,104),value:i.encode(r.fromWordsUnsafe(f))}),p=p.slice(104),n.push({name:"checksum",letters:p});let P={paymentRequest:t,sections:n,get expiry(){let t=n.find(t=>"expiry"===t.name);if(t)return M("timestamp")+t.value},get route_hints(){return n.filter(t=>"route_hint"===t.name).map(t=>t.value)}};for(let r in y)"route_hint"!==r&&Object.defineProperty(P,r,{get:()=>M(r)});return P;function M(t){let e=n.find(e=>e.name===t);return e?e.value:void 0}},hrpToMillisat:x}}),HU=WU();function GU(t){const e=(0,HU.decode)(t),n=e.sections.find(t=>"timestamp"===t.name)?.value??0,r=e.sections.find(t=>"description"===t.name)?.value??"",i=parseInt(e.sections.find(t=>"amount"===t.name)?.value??"0"),s=e.sections.find(t=>"payment_hash"===t.name);return{paymentRequest:e.paymentRequest,description:r,amount:i,timestamp:n,expiry:n+e.expiry,paymentHash:s?.value}}var ZU=class t extends QN{static create(e,n,r){return new t(t=>t(JN(LR.ZapRequest))).eventTarget(e).amount(n).relays(r)}static profile(e,n,r,i){return new t(t=>t(JN(LR.ZapRequest))).amount(n).relays(r).profileTarget(e,i)}static event(e,n,r,i){return new t(t=>t(JN(LR.ZapRequest))).amount(n).relays(r).eventTarget(e,i)}relays(t){return this.chain((e=t,WN(["relays",...e],!0)));var e}eventTarget(t,e){return this.chain(function(t,e){return HN(lM(VN(["k",String(t.kind)],!0),function(t,e,n=!0){return async r=>{const i="string"==typeof t?{id:t}:KP(t)?{id:(s=t).id,kind:s.kind,author:s.pubkey,relays:void 0}:t;var s;if(!i.relays?.[0]&&e){const t="string"==typeof e?e:await e(i.id);t&&(i.relays=[t])}return n&&(r=r.filter(t=>!("e"===t[0]&&t[1]===i.id))),[...r,UM(i)]}}(t,e,!0),YP(t.kind)?function(t,e,n=!0){const r="string"==typeof t?MM(t):KP(t)?Ax((i=t).kind)||Mx(i.kind)?{identifier:tM(i),kind:i.kind,pubkey:i.pubkey,relays:void 0}:null:t;var i;if(!r)throw new Error("Unable to resolve address pointer");return async i=>{const s="string"==typeof t?t:zM(r);if(!r.relays?.[0]&&e){const t="string"==typeof e?e:await e(r.pubkey);t&&(r.relays=[t])}return n&&(i=i.filter(t=>!("a"===t[0]&&t[1]===s))),[...i,jM(r)]}}(t,e,!0):t=>t,qN({pubkey:t.pubkey},e,!0)))}(t,e))}profileTarget(t,e){return this.chain(function(t,e){return HN(qN(t,e,!0))}(t,e))}amount(t){return this.chain(function(t){return WN(["amount",t.toString()],!0)}(t))}lnurl(t){return this.chain(function(t){return WN(["lnurl",t],!0)}(t))}message(t){return this.content(t)}};JM(10086,"nip04"),JM(10017,"nip44"),JM(10018,"nip44"),JM(LR.UserEmojiList,"nip44"),_N.extend("EncryptedContentCache");var KU,YU=new TextDecoder;!function(t){t.nudity="nudity",t.malware="malware",t.profanity="profanity",t.illegal="illegal",t.spam="spam",t.impersonation="impersonation",t.other="other"}(KU||(KU={})),JM(10040,"nip44");var XU=a({default:()=>tB}),JU=["wss://relay.damus.io","wss://nos.lol","wss://relay.primal.net"],QU=["wss://relay.primal.net","wss://nos.lol","wss://relay.damus.io"],tB=class extends fp{static{BF(this.prototype,"nostrAuth",[pp])}#N=void qF(this,"nostrAuth");static{BF(this.prototype,"nostrData",[pp])}#F=void qF(this,"nostrData");static{BF(this.prototype,"nostrRelay",[pp])}#at=void qF(this,"nostrRelay");static{BF(this.prototype,"recipientRelays",[Wr],function(){return null})}#bt=void qF(this,"recipientRelays");getLightningAddress(t){const e=this.nostrData.getProfile(t);return e?.lud16||e?.lud06||null}async resolveLnurl(t){const e=(n=t).includes("@")?function(t){let[e,n]=t.split("@");if(e&&n)return new URL(`https://${n}/.well-known/lnurlp/${e}`)}(n):function(t){try{const{words:e,prefix:n}=$z.decode(t);if("lnurl"!==n)return;const r=YU.decode($z.fromWords(e));return new URL(r)}catch(d8){}}(n);var n;if(!e)throw new Error("Invalid lightning address or LNURL");const r=await fetch(e.toString());if(!r.ok)throw new Error(`Failed to fetch LNURL pay endpoint: ${r.statusText}`);const i=await r.json();if(!i.callback)throw new Error("Invalid LNURL pay endpoint: missing callback");if(!i.allowsNostr)throw new Error("This lightning address does not support Nostr zaps");return{callback:i.callback,minSendable:i.minSendable??1e3,maxSendable:i.maxSendable??1e11,allowsNostr:!!i.allowsNostr,nostrPubkey:i.nostrPubkey}}async loadRecipientRelays(t){if(!t)return this._fallbackRelays();const e=await this._getMailboxesFromStore(t);if(e?.length)return this.recipientRelays=e,e;const n=await this._fetchMailboxesFromNetwork(t);if(n?.length)return this.recipientRelays=n,n;const r=this._fallbackRelays();return this.recipientRelays=r,r}async _getMailboxesFromStore(t){try{const e=await CO(this.nostrData.store.replaceable(10002,t).pipe(EO(500),GO(()=>vO(null))));if(e)return zN(e)}catch{}return null}async _fetchMailboxesFromNetwork(t){const e=this.nostrData.activeReadRelays?.length?this.nostrData.activeReadRelays:QU;try{const n=await CO(this.nostrRelay.pool.request(e,[{kinds:[10002],authors:[t]}]).pipe(EO(1e4),GO(()=>vO(null))));if(n)return this.nostrData.store.add(n),zN(n)}catch{}return null}_fallbackRelays(){const t=this.nostrData.mailboxReadRelays||[];return[...new Set([...t,...JU])].slice(0,5)}getZapRelays(){return this.recipientRelays?.length?this.recipientRelays.slice(0,5):this._fallbackRelays()}async createZapRequest(t,e,n){const r=this.nostrData.store.getEvent(t.eventId);if(!r)throw new Error("Photo event not found in store");const i=this.getZapRelays(),s=this.nostrAuth.signer;if(!s)throw new Error("Nostr signer not available. Please connect Nostr.");return await ZU.event(r,e,i).message(n||"").as(s).sign()}async fetchInvoice(t,e,n){const r=new URL(t);return r.searchParams.set("amount",n.toString()),r.searchParams.set("nostr",JSON.stringify(e)),await async function(t){const{pr:e}=await fetch(t).then(t=>t.json()),n=t.searchParams.get("amount");if(!n)throw new Error("Missing amount");if(e){if(GU(e).amount!==parseInt(n))throw new Error("Incorrect amount");return e}throw new Error("Failed to get invoice")}(r)}parseInvoice(t){return GU(t)}subscribeForZapReceipt(t,e,n){const r=e.eventId,i=this.getZapRelays(),s=Math.floor(Date.now()/1e3)-10;return this.nostrRelay.pool.subscription(i,{kinds:[9735],"#e":[r],since:s}).subscribe({next:e=>{this.nostrData.store.add(e);const r=e.tags.find(t=>"description"===t[0]);if(r)try{JSON.parse(r[1]).id===t.id&&n(e)}catch{}},error:t=>{console.error("[nostr-zap] Receipt subscription error:",t)}})}hasWebLN(){return"undefined"!=typeof window&&void 0!==window.webln}async payWithWebln(t){if(!this.hasWebLN())throw new Error("WebLN not available");return await window.webln.enable(),await window.webln.sendPayment(t)}async zap(t,e,n){const r=t?.pubkey;if(!r)throw new Error("Photo has no pubkey");this.recipientRelays||await this.loadRecipientRelays(r);const i=this.getLightningAddress(r);if(!i)throw new Error("This user has no lightning address set in their profile");const s=await this.resolveLnurl(i);if(e<s.minSendable||e>s.maxSendable)throw new Error(`Amount must be between ${s.minSendable} and ${s.maxSendable} millisats`);const o=await this.createZapRequest(t,e,n);return{invoice:await this.fetchInvoice(s.callback,o,e),zapRequest:o}}},eB=class{},nB=class extends eB{constructor(t){super(),this.message=t}},rB=class extends eB{},iB=class extends eB{},sB=class extends eB{},oB=class extends eB{},aB=class extends eB{},lB=class extends eB{},cB={invalid_request:class extends eB{},invalid_grant:class extends aB{},unauthorized_client:class extends oB{},access_denied:class extends oB{},unsupported_response_type:class extends oB{},invalid_scope:class extends eB{},server_error:class extends oB{},temporarily_unavailable:class extends oB{},invalid_client:class extends aB{},unsupported_grant_type:class extends aB{},invalid_token:class extends eB{}},uB=t=>{const e=cB[t];return e?new e:new nB(t)},hB="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",dB=t=>{const e=t.slice(7).replace(/"/g,"").split(",").map(t=>{const[e,n]=t.trim().split("=");return{[e]:n}}).reduce((t,e)=>({...t,...e}),{});return{realm:e.realm,error:e.error,errorDescription:e.error_description,errorUri:e.error_uri}},pB=t=>{let e=btoa(t);return e=e.replace(/\+/g,"-"),e=e.replace(/\//g,"_"),e=e.replace(/=/g,""),e},fB=(t,e)=>{let n=e.split("?");if(n.length<2)return;n=n[1].split("#");const r=n[0].split("&");for(const i of r){const[e,n]=i.split("=");if(e===t)return decodeURIComponent(n)}},gB=t=>Object.entries(t).map(([t,e])=>`${t}=${encodeURIComponent(e)}`).join("&"),mB="WWW-Authenticate",yB=class{constructor(t,e){this.state={},this.config=t,this.storage=e||bB,this.ready=new Promise(t=>this.setReady=t),this.recoverState()}async reset(){this.state={},await this.saveState(),this.authCodeForAccessTokenPromise=void 0,this.refreshTokenForAccessTokenPromise=void 0}async requestAuthorizationCode(t){const{clientId:e,extraAuthorizationParams:n,redirectUrl:r,scopes:i}=this.config,{codeChallenge:s,codeVerifier:o}=await(async()=>{const t=new Uint32Array(96);crypto.getRandomValues(t);const e=pB(Array.from(t).map(t=>hB[t%66]).join("")),n=await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e)),r=new Uint8Array(n);let i="";const s=r.byteLength;for(let o=0;o<s;o++)i+=String.fromCharCode(r[o]);return{codeChallenge:pB(i),codeVerifier:e}})(),a=(()=>{const t=new Uint32Array(32);return crypto.getRandomValues(t),Array.from(t).map(t=>hB[t%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(e)}&redirect_uri=${encodeURIComponent(r)}&state=${a}&code_challenge=${encodeURIComponent(s)}&code_challenge_method=S256`;if(i&&(l+=`&scope=${encodeURIComponent(i.join(" "))}`),n||t){const e={...n,...t};l+=`&${gB(e)}`}location.replace(l)}isReturningFromAuthServer(){return!!fB("code",location.href)}async receiveCode(){await this.ready;const t=fB("error",location.href);if(t)throw uB(t);if(fB("state",location.href)!==this.state.stateQueryParam)throw console.warn('"state" parameter doesn\'t match the one sent! Possible malicious activity.'),new sB;if(this.state.authorizationCode=fB("code",location.href),!this.state.authorizationCode)throw new iB;this.saveState()}async getTokens(t){const{accessToken:e,authorizationCode:n,idToken:r,refreshToken:i,scopes:s}=this.state;if(n)return this.exchangeAuthCodeForAccessToken(t);if(!e)throw new rB;if(this.isAccessTokenExpired()){if(this.config.onAccessTokenExpiry)return this.config.onAccessTokenExpiry();throw new lB}return Promise.resolve({accessToken:e,idToken:r,refreshToken:i,scopes:s})}async exchangeAuthCodeForAccessToken(t){this.authCodeForAccessTokenPromise||(this.authCodeForAccessTokenPromise=this.fetchAccessTokenUsingCode(t));const e=await this.authCodeForAccessTokenPromise;return this.authCodeForAccessTokenPromise=void 0,this.state.authorizationCode=void 0,this.setTokens(e)}async exchangeRefreshTokenForAccessToken(){this.refreshTokenForAccessTokenPromise||(this.refreshTokenForAccessTokenPromise=this.fetchAccessTokenUsingRefreshToken());const t=await this.refreshTokenForAccessTokenPromise;return this.refreshTokenForAccessTokenPromise=void 0,this.setTokens(t)}makeRetryFetchFunction(t){return async(e,...n)=>{const r=await t(e,...n);if(401===r.status){const i=r.headers.get(mB.toLowerCase());if(i&&"invalid_token"===dB(i).error)return await this.exchangeRefreshTokenForAccessToken(),e=await this.requestInterceptor(e),t(e,...n)}return r}}decorateFetchWithInterceptors(t){return async(e,...n)=>{"string"==typeof e&&(e=new Request(e)),e=await this.requestInterceptor(e);const r=await t(e,...n);return this.responseInterceptor(r)}}async requestInterceptor(t){const e=await this.getTokens();return t.headers.set("Authorization",`Bearer ${e.accessToken}`),t}async responseInterceptor(t){if(401!==t.status)return t;const e=t.headers.get(mB.toLowerCase());if(e){const t=dB(e).error;throw"invalid_grant"===t&&this.config.onInvalidGrant&&await this.config.onInvalidGrant(),"invalid_token"===t&&this.config.onInvalidToken&&await this.config.onInvalidToken(),uB(t)}return t}getGrantedScopes(){return this.state.scopes}isAuthorized(){return!!this.state.accessToken}isAccessTokenExpired(){const{accessTokenExpiry:t}=this.state;return Boolean(t&&new Date>=new Date(t))}async fetchAccessTokenUsingCode(t){const{authorizationCode:e,codeVerifier:n=""}=this.state,{clientId:r,redirectUrl:i}=this.config;n?e||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:e,redirect_uri:i,client_id:r,code_verifier:n,...t},a=new URLSearchParams(o).toString();return this.makeTokenRequest(s,a)}fetchAccessTokenUsingRefreshToken(){const{extraRefreshParams:t,clientId:e,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=${e}`;return t&&(s=`${s}&${gB(t)}`),this.makeTokenRequest(i,s)}async makeTokenRequest(t,e){const n=await fetch(t,{method:"POST",body:e,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(),uB(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(t){const{accessToken:e,expiresIn:n,idToken:r,refreshToken:i,scope:s}=t;return this.state.accessToken=e,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 t={...this.state};this.config.storeRefreshToken||delete t.refreshToken,await this.storage.saveState(JSON.stringify(t))}},vB="oauth2authcodepkce-state",bB={saveState:t=>localStorage.setItem(vB,t),loadState:()=>localStorage.getItem(vB)},wB=a({default:()=>xB}),_B=class{saveState(t){localStorage.setItem("marco:osm_auth_state",t)}loadState(){const t=localStorage.getItem("marco:osm_auth_state");if(!t)return!1;try{return JSON.parse(t),t}catch(e){return console.warn("Failed to parse OSM auth state",e),!1}}},xB=class extends fp{static{BF(this.prototype,"isConnected",[Wr],function(){return!1})}#wt=void qF(this,"isConnected");static{BF(this.prototype,"userDisplayName",[Wr],function(){return null})}#_t=void qF(this,"userDisplayName");oauthClient;constructor(){super(...arguments);const t="https://www.openstreetmap.org",e=`${window.location.origin}/oauth/osm/callback`;this.oauthClient=new yB({scopes:["read_prefs","write_api"],authorizationUrl:`${t}/oauth2/authorize`,tokenUrl:`${t}/oauth2/token`,clientId:"jIn8l5mT8FZOGYiIYXG1Yvj_2FZKB9TJ1edZwOJPsRU",redirectUrl:e,storeRefreshToken:!0,onAccessTokenExpiry(){return this.exchangeRefreshTokenForAccessToken()}},new _B),this.restoreSession()}async restoreSession(){try{await this.oauthClient.ready}catch(t){console.warn("oauthClient.ready failed",t)}if(await this.oauthClient.isAuthorized()){this.isConnected=!0;const t=localStorage.getItem("marco:osm_user_display_name");t?this.userDisplayName=t: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 t=await this.oauthClient.getTokens(),e=await fetch("https://api.openstreetmap.org/api/0.6/user/details.json",{headers:{Authorization:`Bearer ${t.accessToken}`}});if(e.ok){const t=await e.json();console.debug("OSM data:",t);const n=t.user.display_name;this.userDisplayName=n,localStorage.setItem("marco:osm_user_display_name",n)}else console.error("Failed to fetch OSM user info",e.status)}catch(t){console.error("Error fetching OSM user info",t)}}},CB=a({capitalize:()=>kB,formatRelativeDate:()=>EB,humanizeOsmTag:()=>SB});function SB(t){return"string"==typeof t&&t?t.replace(/[_-]/g," ").replace(/\w\S*/g,t=>t.replace(/^\w/,t=>t.toUpperCase())):""}function kB(t){return"string"==typeof t&&t?t.charAt(0).toUpperCase()+t.slice(1):""}function EB(t){if(!t)return"";const e=new Date(1e3*t),n=new Date-e,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`:e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}var RB=a({getLocalizedName:()=>TB,getPlaceType:()=>IB});function TB(t,e="Untitled Place"){if(!t)return e;const n=navigator.languages||[navigator.language||"en"];for(const r of n){if(!r)continue;const e=`name:${r.split("-")[0]}`;if(t[e])return t[e]}return t.name?t.name:t["name:en"]?t["name:en"]:e}var LB=["amenity","shop","tourism","historic","leisure","office","craft","building","landuse","public_transport","highway","aeroway","waterway","natural","place","border_type","admin_title"];function IB(t){if(!t)return null;let e=null;for(const n of LB){const r=t[n];if(r){if("yes"===r){e||(e=n);continue}return SB(r)}}return e?SB(e):null}var PB=a({POI_CATEGORIES:()=>MB,getCategoryById:()=>AB}),MB=[{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 AB(t){return MB.find(e=>e.id===t)}var OB,NB=a({default:()=>FB}),FB=class t extends fp{static{BF(this.prototype,"settings",[pp])}#z=void qF(this,"settings");static{BF(this.prototype,"localForage",[pp])}#$=void qF(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(t,e){return`${t}:${e}`}async _readLocalCache(e,n){const r=this._buildCacheKey(e,n);try{const e=await this.localForage.get(t.STORE_NAME,r);if(!e)return null;const n="string"==typeof e?JSON.parse(e):e;return!n||"number"!=typeof n.timestamp||Date.now()-n.timestamp>t.CACHE_TTL_MS?(await this.localForage.remove(t.STORE_NAME,r),null):n.data}catch{try{await this.localForage.remove(t.STORE_NAME,r)}catch{}return null}}async _writeLocalCache(e,n,r){if(!r)return;const i=this._buildCacheKey(e,n);try{await this.localForage.set(t.STORE_NAME,i,{data:r,timestamp:Date.now()})}catch(s){console.debug("[osm] Failed to write IndexedDB cache entry",s)}}async getCachedOsmObject(e,n){if(!e||!n)return null;const r=this._buildCacheKey(e,n),i=this.cachedPlaces.get(r);return i&&Date.now()-i.timestamp<t.IN_MEMORY_TTL_MS?i.data:this._readLocalCache(e,n)}_storeInMemoryAndLocalStorage(e,n,r,i){i&&i.title?(this.cachedPlaces.set(e,{data:i,timestamp:Date.now()}),setTimeout(()=>{this.cachedPlaces.delete(e)},t.IN_MEMORY_TTL_MS),this._writeLocalCache(n,r,i)):console.debug(`[osm] Skipping cache write for ${e}: data has no title`)}cancelAll(){this.controller&&(this.controller.abort(),this.controller=null)}async getNearbyPois(t,e,n=50){const r=`${t},${e},${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(([t,e])=>`["${t}"!~"^(${e.join("|")})$"]`).join(""),a=`\n[out:json][timeout:25];\n(\n node(around:${n},${t},${e})\n [${s}]${o}[~"^name"~"."];\n way(around:${n},${t},${e})\n [${s}]${o}[~"^name"~"."];\n relation(around:${n},${t},${e})\n [${s}]${o}[~"^name"~"."];\n);\nout center;\n `.trim(),l=`${this.settings.overpassApi}?data=${encodeURIComponent(a)}`;try{const t=await this.fetchWithRetry(l,{signal:i});if(!t.ok)throw new Error("Overpass request failed");const e=(await t.json()).elements.map(this.normalizePoi);return this.lastQueryKey=r,this.cachedResults=e,e}catch(c){if("AbortError"===c.name)return console.debug("Overpass request aborted"),[];throw c}}async getCategoryPois(t,e,n,r){const i=AB(e);if(!i||!t)return[];const s=n&&r?`cat:${e}:${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}=t,h=[],d=i.types||["node","way","relation"];i.filter.forEach(t=>{d.forEach(e=>{h.push(`${e}${t}[~"^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 t=await this.fetchWithRetry(f,{signal:o});if(!t.ok)throw new Error("Overpass request failed");const e=(await t.json()).elements.map(this.normalizePoi);return s&&(this.lastQueryKey=s,this.cachedResults=e),e}catch(g){if("AbortError"===g.name)return console.debug("Category search aborted"),[];throw console.error("Category search failed",g),g}}normalizePoi(t){const e=t.tags||{},n=IB(e)||"Point of Interest";return{title:TB(e),lat:t.lat||t.center?.lat,lon:t.lon||t.center?.lon,url:e.website,osmId:String(t.id),osmType:t.type,osmTags:e,description:e.description,source:"osm",type:n}}async fetchWithRetry(t,e={},n=3){try{const r=await fetch(t,e);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(t=>setTimeout(t,1e3)),this.fetchWithRetry(t,e,n-1)):r}catch(r){if(n>0&&"AbortError"!==r.name)return console.debug(`Retrying Overpass request... (${n} left)`),await new Promise(t=>setTimeout(t,1e3)),this.fetchWithRetry(t,e,n-1);throw r}}async getPoiById(t,e=null){let n;n="node"===e?`[out:json][timeout:25];node(${t});out center;`:"way"===e?`[out:json][timeout:25];way(${t});out center;`:`\n[out:json][timeout:25];\n(\n node(${t});\n way(${t});\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(e,n,{forceFresh:r=!1}={}){if(!e||!n)return null;const i=this._buildCacheKey(n,e);if(r)return this._fetchAndCacheOsmObject(e,n,i);const s=this.cachedPlaces.get(i);if(s&&Date.now()-s.timestamp<t.IN_MEMORY_TTL_MS)return console.debug(`Using in-memory cached OSM object for ${i}`),s.data;const o=await this._readLocalCache(n,e);return o?(console.debug(`Using IndexedDB cached OSM object for ${i}`),this._refreshOsmObject(e,n,i).catch(t=>{console.debug("[osm] Background refresh failed for",i,t)}),o):this._fetchAndCacheOsmObject(e,n,i)}async _refreshOsmObject(t,e,n){const r=await this._fetchOsmObjectFromApi(t,e);return r&&this._storeInMemoryAndLocalStorage(n,e,t,r),r}async _fetchAndCacheOsmObject(t,e,n){const r=await this._fetchOsmObjectFromApi(t,e);return r&&this._storeInMemoryAndLocalStorage(n,e,t,r),r}async _fetchOsmObjectFromApi(t,e){let n;if("node"===e)n=`https://www.openstreetmap.org/api/0.6/node/${t}.json`;else if("way"===e)n=`https://www.openstreetmap.org/api/0.6/way/${t}/full.json`;else{if("relation"!==e)return console.error("Unknown OSM type:",e),null;n=`https://www.openstreetmap.org/api/0.6/relation/${t}/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,t,e)}catch(r){return console.error("Failed to fetch OSM object:",r),null}}async fetchOsmObjectsBatch(t){const e=new Map;if(!t||0===t.length)return e;const n=[];for(const{osmType:s,osmId:o}of t){if(!s||!o)continue;const t=this._buildCacheKey(s,o),r=await this.getCachedOsmObject(s,o);r?e.set(t,r):n.push({osmType:s,osmId:o,cacheKey:t})}if(0===n.length)return e;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,e));return await Promise.allSettled(i),e}async _fetchOsmObjectsByType(t,e,n){for(let i=0;i<e.length;i+=50){const s=e.slice(i,i+50),o=s.map(t=>t.osmId).join(","),a="way"===t?"ways":t+"s",l=`https://www.openstreetmap.org/api/0.6/${a}.json?${a}=${o}`;try{const e=await this.fetchWithRetry(l);if(!e.ok){console.warn(`[osm] Batch fetch failed for ${t} (${e.status})`,o);continue}const r=await e.json();for(const i of s){const e=this.normalizeOsmApiData(r.elements,i.osmId,t);e&&n.set(i.cacheKey,e)}}catch(r){console.error(`[osm] Batch fetch error for ${t}:`,r)}}}normalizeOsmApiData(t,e,n){if(!t||0===t.length)return null;let r=t.find(t=>String(t.id)===String(e)&&t.type===n);if(!r)return null;let i=r;if("relation"===n&&r.members){const e=r.members.find(t=>"label"===t.role&&"node"===t.type),n=r.members.find(t=>"admin_centre"===t.role&&"node"===t.type),s=e||n;if(s){const e=t.find(t=>String(t.id)===String(s.ref)&&"node"===t.type);e&&(i=e)}}let s=i.lat,o=i.lon,a=null,l=null;if("way"===n&&r.nodes){const e=new Map;t.forEach(t=>{"node"===t.type&&e.set(t.id,[t.lon,t.lat])});const n=r.nodes.map(t=>e.get(t)).filter(Boolean);if(n.length>0){if(i===r){const t=n.reduce((t,e)=>t+e[1],0),e=n.reduce((t,e)=>t+e[0],0);s=t/n.length,o=e/n.length}const t=n.map(t=>t[1]),e=n.map(t=>t[0]);if(a={minLat:Math.min(...t),maxLat:Math.max(...t),minLon:Math.min(...e),maxLon:Math.max(...e)},n.length>1){const t=n[0],e=n[n.length-1];l=t[0]===e[0]&&t[1]===e[1]?{type:"Polygon",coordinates:[n]}:{type:"LineString",coordinates:n}}}}else if("relation"===n&&r.members){const e=[],n=new Map;t.forEach(t=>{"node"===t.type&&n.set(t.id,t)});const c=[];if(r.members.forEach(r=>{if("node"===r.type){const t=n.get(r.ref);t&&e.push(t)}else if("way"===r.type){const i=t.find(t=>"way"===t.type&&t.id===r.ref);if(i&&i.nodes){const t=[];i.nodes.forEach(r=>{const i=n.get(r);i&&(e.push(i),t.push([i.lon,i.lat]))}),t.length>1&&c.push(t)}}}),e.length>0){if(i===r){const t=e.reduce((t,e)=>t+e.lat,0),n=e.reduce((t,e)=>t+e.lon,0);s=t/e.length,o=n/e.length}const t=e.map(t=>t.lat),n=e.map(t=>t.lon);a={minLat:Math.min(...t),maxLat:Math.max(...t),minLon:Math.min(...n),maxLon:Math.max(...n)}}c.length>0&&(l={type:"MultiLineString",coordinates:c})}const c=i.tags||{},u=IB(c)||"Point of Interest";return{title:TB(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}}},zB=a({default:()=>DB}),DB=class extends fp{static{BF(this.prototype,"settings",[pp])}#z=void qF(this,"settings");controller=null;cancelAll(){this.controller&&(this.controller.abort(),this.controller=null)}get baseUrl(){return this.settings.photonApi}async search(t,e,n,r=10){if(!t||t.length<2)return[];this.controller&&this.controller.abort(),this.controller=new AbortController;const i=this.controller.signal,s=new URLSearchParams({q:t,limit:String(r)});e&&n&&(s.append("lat",parseFloat(e).toFixed(4)),s.append("lon",parseFloat(n).toFixed(4)));const o=`${this.baseUrl}?${s.toString()}`;try{const t=await this.fetchWithRetry(o,{signal:i});if(!t.ok)throw new Error(`Photon request failed with status ${t.status}`);const e=await t.json();return e.features?e.features.map(t=>this.normalizeFeature(t)):[]}catch(a){return"AbortError"===a.name||console.error("Photon search error:",a),[]}}normalizeFeature(t){const e=t.properties||{},n=(t.geometry||{}).coordinates||[],r=n[0],i=n[1],s=[];e.street&&s.push(e.housenumber?`${e.street} ${e.housenumber}`:e.street),e.city&&e.city!==e.name&&s.push(e.city),e.state&&e.state!==e.city&&s.push(e.state),e.country&&s.push(e.country);const o=s.join(", "),a=e.name||o||"Unknown Place",l={...e};e.osm_key&&e.osm_value&&(l[e.osm_key]=e.osm_value);const c=IB(l)||SB(e.osm_value);return{title:a,lat:i,lon:r,osmId:e.osm_id,osmType:{N:"node",W:"way",R:"relation"}[e.osm_type]||e.osm_type,osmTags:l,description:e.name?o:s.slice(1).join(", "),source:"photon",type:c}}async fetchWithRetry(t,e={},n=3){try{const r=await fetch(t,e);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(t=>setTimeout(t,1e3)),this.fetchWithRetry(t,e,n-1)):r}catch(r){if(n>0&&"AbortError"!==r.name)return console.debug(`Retrying Photon request... (${n} left)`,r),await new Promise(t=>setTimeout(t,1e3)),this.fetchWithRetry(t,e,n-1);throw r}}},jB=a({default:()=>BB}),UB={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},BB=class extends fp{static{BF(this.prototype,"overpassApi",[Wr],function(){return UB.overpassApi})}#xt=void qF(this,"overpassApi");static{BF(this.prototype,"mapKinetic",[Wr],function(){return UB.mapKinetic})}#Ct=void qF(this,"mapKinetic");static{BF(this.prototype,"photonApi",[Wr],function(){return UB.photonApi})}#St=void qF(this,"photonApi");static{BF(this.prototype,"showQuickSearchButtons",[Wr],function(){return UB.showQuickSearchButtons})}#kt=void qF(this,"showQuickSearchButtons");static{BF(this.prototype,"nostrPhotoFallbackUploads",[Wr],function(){return UB.nostrPhotoFallbackUploads})}#Et=void qF(this,"nostrPhotoFallbackUploads");static{BF(this.prototype,"nostrReadRelays",[Wr],function(){return UB.nostrReadRelays})}#Rt=void qF(this,"nostrReadRelays");static{BF(this.prototype,"nostrWriteRelays",[Wr],function(){return UB.nostrWriteRelays})}#Tt=void qF(this,"nostrWriteRelays");static{BF(this.prototype,"nostrReadRelayExclusions",[Wr],function(){return UB.nostrReadRelayExclusions})}#Lt=void qF(this,"nostrReadRelayExclusions");static{BF(this.prototype,"nostrWriteRelayExclusions",[Wr],function(){return UB.nostrWriteRelayExclusions})}#It=void qF(this,"nostrWriteRelayExclusions");static{BF(this.prototype,"experimentalEnablePhotoDeletion",[Wr],function(){return UB.experimentalEnablePhotoDeletion})}#Pt=void qF(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 t={};const e=localStorage.getItem("marco:settings");if(e)try{t=JSON.parse(e)}catch(r){console.error("Failed to parse settings from localStorage",r)}else{const e=localStorage.getItem("marco:overpass-api");e&&(t.overpassApi=e);const n=localStorage.getItem("marco:map-kinetic");null!==n&&(t.mapKinetic="true"===n);const r=localStorage.getItem("marco:show-quick-search");null!==r&&(t.showQuickSearchButtons="true"===r);const i=localStorage.getItem("marco:nostr-photo-fallback-uploads");null!==i&&(t.nostrPhotoFallbackUploads="true"===i);const s=localStorage.getItem("marco:photon-api");s&&(t.photonApi=s)}const n={...UB,...t};this.overpassApis.some(t=>t.url===n.overpassApi)||(n.overpassApi=UB.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 t={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(t))}update(t,e){t in UB&&(this[t]=e,this.saveSettings())}},$B=o((t,e)=>{var n,r;n=t,r=function(){return function(){var t={548:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Access=void 0;class n{constructor(t){this.rs=t,this.reset(!1)}get scopes(){return Object.keys(this.scopeModeMap).map(t=>({name:t,mode:this.scopeModeMap[t]}))}get scopeParameter(){return this.scopes.map(t=>`${this._scopeNameForParameter(t)}:${t.mode}`).join(" ")}claim(t,e){if("string"!=typeof t||-1!==t.indexOf("/")||0===t.length)throw new Error("Scope should be a non-empty string without forward slashes");if("string"!=typeof e||!e.match(/^rw?$/))throw new Error("Mode should be either 'r' or 'rw'");this._adjustRootPaths(t),this.scopeModeMap[t]=e,this._notifyChange()}get(t){return this.scopeModeMap[t]}remove(t){const e={};for(const n in this.scopeModeMap)e[n]=this.scopeModeMap[n];this.reset(!1),delete e[t];for(const n in e)this._adjustRootPaths(n),this.scopeModeMap[n]=e[n];this._notifyChange()}checkPermission(t,e){const n=this.get(t);return n&&("r"===e||"rw"===n)}checkPathPermission(t,e){if(this.checkPermission("*",e))return!0;const n=this._getModuleName(t);return!!this.checkPermission(n,e)}reset(t=!0){this.rootPaths=[],this.scopeModeMap={},t&&this._notifyChange()}_getModuleName(t){if("/"!==t[0])throw new Error("Path should start with a slash");const e=t.replace(/^\/public/,"").match(/^\/([^/]*)\//);return e?e[1]:"*"}_adjustRootPaths(t){"*"in this.scopeModeMap||"*"===t?this.rootPaths=["/"]:t in this.scopeModeMap||(this.rootPaths.push("/"+t+"/"),this.rootPaths.push("/public/"+t+"/"))}_scopeNameForParameter(t){if("*"===t.name&&this.storageType){if("2012.04"===this.storageType)return"";if(this.storageType.match(/remotestorage-0[01]/))return"root"}return t.name}setStorageType(t){this.storageType=t}_notifyChange(){this.rs&&"function"==typeof this.rs._checkScopeChange&&this.rs._checkScopeChange()}static _rs_init(){}}e.Access=n,e.default=n},275:function(t,e,n){var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,s){function o(t){try{l(r.next(t))}catch(t){s(t)}}function a(t){try{l(r.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((r=r.apply(t,e||[])).next())})},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.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(t){const e=t||d.getLocation().href,n={};for(const[s,o]of new URL(e).searchParams)n[s]=o;const r=e.indexOf("#");if(-1===r)return n;const i=e.substring(r+1);return i.includes("=")?i.split("&").reduce(function(t,e){const n=e.split("=");if("state"===n[0]&&n[1].match(/rsDiscovery/)){let e=decodeURIComponent(n[1]);const r=e.substr(e.indexOf("rsDiscovery=")).split("&")[0].split("=")[1];t.rsDiscovery=JSON.parse(atob(r)),e=e.replace(new RegExp("&?rsDiscovery="+r),""),e.length>0&&(t.state=e)}else t[decodeURIComponent(n[0])]=decodeURIComponent(n[1]);return t},n):n}class d{static authorize(t,e){if((0,o.default)("[Authorize] authURL = ",e.authURL,"scope = ",e.scope,"redirectUri = ",e.redirectUri,"clientId = ",e.clientId,"response_type =",e.response_type),!e.scope)throw new Error("Cannot authorize due to undefined or empty scope; did you forget to access.claim()?");if("function"==typeof t._rememberPendingScope&&t._rememberPendingScope(e.scope),!(0,a.localStorageAvailable)()&&"remotestorage"===t.backend){e.redirectUri+=e.redirectUri.indexOf("#")>0?"&":"#";const n={userAddress:t.remote.userAddress,href:t.remote.href,storageApi:t.remote.storageApi,properties:t.remote.properties};e.redirectUri+="rsDiscovery="+(0,a.toBase64)(JSON.stringify(n))}const n=function(t){const e=new URL(t.redirectUri);t.state||(t.state=e.hash?e.hash.substring(1):""),t.response_type||(t.response_type="token");const n=new URL(t.authURL);n.searchParams.set("redirect_uri",t.redirectUri.replace(/#.*$/,"")),n.searchParams.set("scope",t.scope),n.searchParams.set("client_id",t.clientId);for(const r of["state","response_type","code_challenge","code_challenge_method","token_access_type"]){const e=t[r];e&&n.searchParams.set(r,e)}return n.href}(e);a.globalContext.cordova&&(d.getLocation().href.startsWith("file:")||"string"==typeof s.default.cordovaRedirectUri&&e.redirectUri===s.default.cordovaRedirectUri)?d.openWindow(n,e.redirectUri,"location=yes,clearsessioncache=yes,clearcache=yes").then(n=>{t.remote.configure({token:n.access_token}),"function"==typeof t._completeAuthorization&&t._completeAuthorization(n.scope||e.scope)}):d.setLocation(n)}static refreshAccessToken(t,e,n){return r(this,void 0,void 0,function*(){var t,r,i;yield e.configure({token:null,tokenType:null});const s=new URLSearchParams({grant_type:"refresh_token",client_id:e.clientId,refresh_token:n}),a=yield(0,c.requestWithTimeout)("POST",e.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 e.configure({refreshToken:null}),new l.default("refresh token rejected:"+JSON.stringify(a.response));{(0,o.default)(`[Authorize] access token good for ${null===(t=null==a?void 0:a.response)||void 0===t?void 0:t.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 e.configure(n)}})}static setLocation(t){if("string"==typeof t)document.location.href=t;else{if("object"!=typeof t)throw"Invalid location "+t;document.location.href=t.href}}static _rs_supported(){return"undefined"!=typeof document}static _rs_cleanup(t){t.removeEventListener("features-loaded",u)}}e.Authorize=d,d.IMPLIED_FAKE_TOKEN=!1,d.getLocation=function(){return document.location},d.openWindow=function(t,e,n){return new Promise((r,i)=>{const s=open(t,"_blank",n);function o(){i("Authorization was canceled")}s&&!s.closed?(s.addEventListener("loadstart",function(t){if(0!==t.url.indexOf(e))return;s.removeEventListener("exit",o),s.close();const n=h(t.url);n?r(n):i("Authorization error")}),s.addEventListener("exit",o)):i("Authorization popup was blocked")})},d._rs_init=function(t){const e=h(),n=function(t){return"string"==typeof t.access_token||"string"==typeof t.code||"string"==typeof t.error||"string"==typeof t.remotestorage||"object"==typeof t.rsDiscovery}(e);let i;n&&(i=d.getLocation(),i.hash=""),u=function(){let s=!1;if(n){if(e.error)throw"function"==typeof t._forgetPendingScope&&t._forgetPendingScope(),"access_denied"===e.error?new l.default("Authorization failed: access denied",{code:"access_denied"}):new l.default(`Authorization failed: ${e.error}`);e.rsDiscovery&&t.remote.configure(e.rsDiscovery),e.access_token&&(t.remote.configure({token:e.access_token}),"function"==typeof t._completeAuthorization&&t._completeAuthorization(e.scope),s=!0),e.remotestorage&&(t.connect(e.remotestorage),s=!0),e.state&&(i=d.getLocation(),d.setLocation(i.href.split("#")[0]+"#"+e.state)),e.code&&(function(e){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:e,grant_type:"authorization_code",client_id:t.remote.clientId,redirect_uri:h,code_verifier:u}),f=yield(0,c.requestWithTimeout)("POST",t.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 e={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};e.token?(t.remote.configure(e),"function"==typeof t._completeAuthorization&&t._completeAuthorization(null===(l=null==f?void 0:f.response)||void 0===l?void 0:l.scope)):t._emit("error",new Error(`no access_token in "successful" response: ${f.response}`)),sessionStorage.removeItem("remotestorage:codeVerifier");break}default:"function"==typeof t._forgetPendingScope&&t._forgetPendingScope(),t._emit("error",new Error(`${f.statusText}: ${f.response}`))}})}(e.code),s=!0),s||t.remote.stopWaitingForToken()}else t.remote.stopWaitingForToken()},t.on("features-loaded",u)},e.default=d},424:function(t,e,n){var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,s){function o(t){try{l(r.next(t))}catch(t){s(t)}}function a(t){try{l(r.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((r=r.apply(t,e||[])).next())})},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.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(t,e){if(this.schemas={configurable:!0,get(){return h.Types.inScope(this.moduleName)}},"/"!==e[e.length-1])throw"Not a folder: "+e;"/"===e&&(this.makePath=t=>("/"===t[0]?"":"/")+t),this.storage=t,this.base=e,this.moduleName=function(t){const e=t.split("/");return t.length>2?e[1]:"root"}(this.base),this.addEvents(["change"]),this.on=this.on.bind(this),t.onChange(this.base,this._fireChange.bind(this))}scope(t){return new h(this.storage,this.makePath(t))}getListing(t,e){return r(this,void 0,void 0,function*(){if("string"!=typeof t)t="";else if(t.length>0&&!(0,u.isFolder)(t))return Promise.reject("Not a folder: "+t);return this.storage.get(this.makePath(t),e).then(t=>404===t.statusCode?{}:t.body)})}getAll(t,e){return r(this,void 0,void 0,function*(){if("string"!=typeof t)t="";else if(t.length>0&&!(0,u.isFolder)(t))return Promise.reject("Not a folder: "+t);return this.storage.get(this.makePath(t),e).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(t+r),e).then(t=>{if("string"==typeof t.body)try{t.body=JSON.parse(t.body)}catch(t){}"object"==typeof t.body&&(n.body[r]=t.body)}));return Promise.all(i).then(()=>n.body)}})})}getFile(t,e){return r(this,void 0,void 0,function*(){return"string"!=typeof t?Promise.reject("Argument 'path' of baseClient.getFile must be a string"):this.storage.get(this.makePath(t),e).then(t=>({data:t.body,contentType:t.contentType,revision:t.revision}))})}storeFile(t,e,n){return r(this,void 0,void 0,function*(){return"string"!=typeof t?Promise.reject("Argument 'contentType' of baseClient.storeFile must be a string"):"string"!=typeof e?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(e),"rw")||console.warn("WARNING: Editing a document to which only read access ('r') was claimed"),this.storage.put(this.makePath(e),n,t).then(t=>200===t.statusCode||201===t.statusCode?t.revision:Promise.reject("Request (PUT "+this.makePath(e)+") failed with status: "+t.statusCode)))})}getObject(t,e){return r(this,void 0,void 0,function*(){return"string"!=typeof t?Promise.reject("Argument 'path' of baseClient.getObject must be a string"):this.storage.get(this.makePath(t),e).then(e=>{if("object"==typeof e.body)return e.body;if("string"==typeof e.body)try{return JSON.parse(e.body)}catch(e){throw new Error("Not valid JSON: "+this.makePath(t))}else if(void 0!==e.body&&200===e.statusCode)return Promise.reject("Not an object: "+this.makePath(t))})})}storeObject(t,e,n){return r(this,void 0,void 0,function*(){if("string"!=typeof t)return Promise.reject("Argument 'typeAlias' of baseClient.storeObject must be a string");if("string"!=typeof e)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,t);try{const t=this.validate(n);if(!t.valid)return Promise.reject(t)}catch(t){return Promise.reject(t)}return this.storage.put(this.makePath(e),JSON.stringify(n),"application/json; charset=UTF-8").then(t=>200===t.statusCode||201===t.statusCode?t.revision:Promise.reject("Request (PUT "+this.makePath(e)+") failed with status: "+t.statusCode))})}remove(t){return r(this,void 0,void 0,function*(){return"string"!=typeof t?Promise.reject("Argument 'path' of baseClient.remove must be a string"):(this.storage.access.checkPathPermission(this.makePath(t),"rw")||console.warn("WARNING: Removing a document to which only read access ('r') was claimed"),this.storage.delete(this.makePath(t),this.storage.connected))})}getItemURL(t){return r(this,void 0,void 0,function*(){if("string"!=typeof t)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(t)):this.storage.remote.href+(0,u.cleanPath)(this.makePath(t))})}cache(t,e="ALL"){if("string"!=typeof t)throw"Argument 'path' of baseClient.cache must be a string";if("string"!=typeof e)throw"Argument 'strategy' of baseClient.cache must be a string or undefined";if("FLUSH"!==e&&"SEEN"!==e&&"ALL"!==e)throw'Argument \'strategy\' of baseclient.cache must be one of ["FLUSH", "SEEN", "ALL"]';return this.storage.caching.set(this.makePath(t),e),this}declareType(t,e,n){let r;if(n&&"string"==typeof e)r=e;else if(n||"string"==typeof e){if(!n&&"string"==typeof e)throw new Error("declareType() requires a JSON Schema object to be passed, in order to validate object types/formats")}else n=e,r=this._defaultTypeURI(t);h.Types.declare(this.moduleName,t,r,n)}validate(t){const e=h.Types.getSchema(t["@context"]);if(e)return s.default.validateResult(t,e);throw new a.default(t["@context"])}_defaultTypeURI(t){return"http://remotestorage.io/spec/modules/"+encodeURIComponent(this.moduleName)+"/"+encodeURIComponent(t)}_attachType(t,e){t["@context"]=h.Types.resolveAlias(this.moduleName+"/"+e)||this._defaultTypeURI(e)}makePath(t){return this.base+(t||"")}_fireChange(t){c.default.changeEvents[t.origin]&&(["new","old","lastCommon"].forEach(function(e){if((!t[e+"ContentType"]||/^application\/(.*)json(.*)/.exec(t[e+"ContentType"]))&&"string"==typeof t[e+"Value"])try{t[e+"Value"]=JSON.parse(t[e+"Value"])}catch(t){}}),this._emit("change",t))}static _rs_init(){}}e.BaseClient=h,h.Types=o.default,(0,u.applyMixins)(h,[l.default]),e.default=h},285:function(t,e,n){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Caching=void 0;const i=n(746),s=r(n(334));class o{constructor(t){this.pendingActivations=[],this._access=t.access,this.reset()}set(t,e){if("string"!=typeof t)throw new Error("path should be a string");if(!(0,i.isFolder)(t))throw new Error("path should be a folder");if(!this._access.checkPathPermission(t,"r"))throw new Error('No access to path "'+t+'". You must claim access to it first.');if(void 0===e||!e.match(/^(FLUSH|SEEN|ALL)$/))throw new Error("strategy should be 'FLUSH', 'SEEN', or 'ALL'");this._rootPaths[t]=e,"ALL"===e&&(this.activateHandler?this.activateHandler(t):this.pendingActivations.push(t))}enable(t){this.set(t,"ALL")}disable(t){this.set(t,"FLUSH")}onActivate(t){(0,s.default)("[Caching] Setting activate handler",t,this.pendingActivations),this.activateHandler=t;for(let e=0;e<this.pendingActivations.length;e++)t(this.pendingActivations[e]);this.pendingActivations=[]}resetActivationHandler(){this.activateHandler=void 0,this.pendingActivations=[]}checkPath(t){return void 0!==this._rootPaths[t]?this._rootPaths[t]:"/"===t?"SEEN":this.checkPath((0,i.containingFolder)(t))}reset(){this._rootPaths={}}static _rs_init(){}}e.Caching=o,e.default=o},496:function(t,e,n){var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,s){function o(t){try{l(r.next(t))}catch(t){s(t)}}function a(t){try{l(r.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((r=r.apply(t,e||[])).next())})},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const s=i(n(451)),o=i(n(93)),a=i(n(28)),l=i(n(334)),c=n(746);function u(t){if("object"==typeof t&&"string"==typeof t.path)if((0,c.isFolder)(t.path)){if(t.local&&t.local.itemsMap)return t.local;if(t.common&&t.common.itemsMap)return t.common}else{if(t.local){if(t.local.body&&t.local.contentType)return t.local;if(!1===t.local.body)return}if(t.common&&t.common.body&&t.common.contentType)return t.common}}function h(t,e){for(const n in t){if(t[n]&&t[n].remote)return!0;const r=u(t[n]);if(r&&r.timestamp&&(new Date).getTime()-r.timestamp<=e)return!1;if(!r)return!0}return!0}function d(t){const e={path:t,common:{}};return(0,c.isFolder)(t)&&(e.common.itemsMap={}),e}function p(t,e){return t.common||(t.common={itemsMap:{}}),t.common.itemsMap||(t.common.itemsMap={}),t.local||(t.local=(0,c.deepClone)(t.common)),t.local.itemsMap||(t.local.itemsMap=t.common.itemsMap),t.local.itemsMap[e]=!0,t}class f{constructor(){this._updateNodesRunning=!1,this._updateNodesQueued=[],(new s.default).isBrowser()&&c.globalContext.BroadcastChannel&&(this.broadcastChannel=new BroadcastChannel("remotestorage:changes"),this.broadcastChannel.onmessage=t=>{this.emitChange(t.data)})}get(t,e,n){return r(this,void 0,void 0,function*(){return"number"==typeof e?this.getNodes((0,c.pathsFromRoot)(t)).then(r=>{const i=u(r[t]);return h(r,e)?n(t):i?{statusCode:200,body:i.body||i.itemsMap,contentType:(0,c.stripLegacyCharsetBinary)(i.contentType||null)}:{statusCode:404}}):this.getNodes([t]).then(e=>{const n=u(e[t]);if(n){if((0,c.isFolder)(t))for(const t in n.itemsMap)n.itemsMap.hasOwnProperty(t)&&!1===n.itemsMap[t]&&delete n.itemsMap[t];return{statusCode:200,body:n.body||n.itemsMap,contentType:(0,c.stripLegacyCharsetBinary)(n.contentType||null)}}return{statusCode:404}})})}put(t,e,n){return r(this,void 0,void 0,function*(){const r=(0,c.pathsFromRoot)(t);return this._updateNodes(r,function(t,r){try{for(let i=0,s=t.length;i<s;i++){const s=t[i];let o,a=r[s];a||(r[s]=a=d(s)),0===i?(o=u(a),a.local={body:e,contentType:n,previousBody:o?o.body:void 0,previousContentType:o?o.contentType:void 0}):a=p(a,t[i-1].substring(s.length))}return r}catch(t){throw(0,l.default)("[Cachinglayer] Error during PUT",r,t),t}})})}delete(t,e){return r(this,void 0,void 0,function*(){const n=(0,c.pathsFromRoot)(t);return this._updateNodes(n,function(t,n){for(let r=0,i=t.length;r<i;r++){const i=t[r],s=n[i];let o;if(s)if(0===r)o=u(s),s.local={body:!e&&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 e=t[r-1].substring(i.length);if(delete s.local.itemsMap[e],Object.getOwnPropertyNames(s.local.itemsMap).length>0)break}else console.error("Cannot delete non-existing node "+i)}return n})})}flush(t){return this._getAllDescendentPaths(t).then(t=>this.getNodes(t)).then(t=>{for(const e in t){const n=t[e];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}),t[e]=void 0}return this.setNodes(t)})}emitChange(t){a.default.changeEvents[t.origin]&&this._emit("change",t)}fireInitial(){a.default.changeEvents.local&&this.forAllNodes(t=>{if((0,c.isDocument)(t.path)){const e=u(t);e&&this.emitChange({path:t.path,origin:"local",oldValue:void 0,oldContentType:void 0,newValue:e.body,newContentType:e.contentType})}}).then(()=>{this._emit("local-events-done")})}onDiff(t){this.diffHandler=t}_updateNodes(t,e){return new Promise((n,r)=>{this._doUpdateNodes(t,e,{resolve:n,reject:r})})}_doUpdateNodes(t,e,n){return r(this,void 0,void 0,function*(){if(this._updateNodesRunning)return void this._updateNodesQueued.push({paths:t,cb:e,promise:n});this._updateNodesRunning=!0;try{let r=yield this.getNodes(t);const i=(0,c.deepClone)(r),s=[];r=e(t,r);for(const t in r){const e=r[t];(0,c.equal)(e,i[t])?delete r[t]:(0,c.isDocument)(t)&&((0,c.equal)(e.local.body,e.local.previousBody)&&e.local.contentType===e.local.previousContentType||s.push({path:t,origin:"window",oldValue:e.local.previousBody,newValue:!1===e.local.body?void 0:e.local.body,oldContentType:e.local.previousContentType,newContentType:e.local.contentType}),void 0===e.local.body?r[t]=void 0:(delete e.local.previousBody,delete e.local.previousContentType))}yield this.setNodes(r),this._emitChangeEvents(s),n.resolve({statusCode:200})}catch(t){n.reject(t)}this._updateNodesRunning=!1;const r=this._updateNodesQueued.shift();r&&(yield this._doUpdateNodes(r.paths,r.cb,r.promise))})}_emitChangeEvents(t){for(let e=0,n=t.length;e<n;e++){const n=t[e];this.emitChange(n),this.diffHandler&&this.diffHandler(n.path),this.broadcastChannel&&"window"===n.origin&&this.broadcastChannel.postMessage(n)}}_getAllDescendentPaths(t){return(0,c.isFolder)(t)?this.getNodes([t]).then(e=>{const n=[t],r=u(e[t]),i=Object.keys(r.itemsMap).map(e=>this._getAllDescendentPaths(t+e).then(t=>{for(let e=0,r=t.length;e<r;e++)n.push(t[e])}));return Promise.all(i).then(()=>n)}):Promise.resolve([t])}_getInternals(){return{getLatest:u,makeNode:d,isOutdated:h}}}(0,c.applyMixins)(f,[o.default]),t.exports=f},28:function(t){t.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(t,e,n){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};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(t){if(t in u)return Promise.resolve(u[t]);const e=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((t,e)=>{n=setTimeout(()=>{e(new Error("timed out"))},s.default.discovery.timeout)});return Promise.race([e.lookup(t),r]).then(e=>{if(clearTimeout(n),"object"!=typeof e.idx.links.remotestorage||"number"!=typeof e.idx.links.remotestorage.length||e.idx.links.remotestorage.length<=0)throw(0,o.default)("[Discover] WebFinger record for "+t+" does not have remotestorage defined in the links section ",JSON.stringify(e.object)),new Error("WebFinger record for "+t+" does not have remotestorage defined in the links section.");const r=e.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[t]={href:r.href,storageApi:a,authURL:s,properties:i},l&&localStorage.setItem(c,JSON.stringify({cache:u})),u[t]}).catch(t=>{throw clearTimeout(n),t})};(h.DiscoveryError=function(t){this.name="DiscoveryError",this.message=t,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 t=JSON.parse(localStorage.getItem(c));t&&(u=t.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)},t.exports=h},706:function(t,e,n){var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,s){function o(t){try{l(r.next(t))}catch(t){s(t)}}function a(t){try{l(r.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((r=r.apply(t,e||[])).next())})},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};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(t){return("/remotestorage/"+t).replace(/\/+$/,"").replace(/\/+/g,"/")}const v=/[\u007f-\uffff]/g;function b(t){return JSON.stringify(t).replace(v,function(t){return"\\u"+("000"+t.charCodeAt(0).toString(16)).slice(-4)})}function w(t,e){return new RegExp("^"+e.join("\\/")+"(\\/|$)").test(t.error_summary)}class _ extends h.RemoteBase{constructor(t){if(super(t),this.online=!0,this.storageApi="draft-dejong-remotestorage-19",this._initialFetchDone=!1,this.addEvents(["connected","not-connected"]),this.clientId=t.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 t=(0,c.getJSONFromLocalStorage)(f);t&&this.configure(t),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:t,codeChallenge:e,state:n}=yield(0,c.generateCodeVerifier)();sessionStorage.setItem("remotestorage:codeVerifier",t),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:e,code_challenge_method:"S256",token_access_type:"offline"})}}catch(t){throw this.rs._emit("error",t),this.rs.setBackend(void 0),t}})}configure(t){return r(this,void 0,void 0,function*(){void 0!==t.userAddress&&(this.userAddress=t.userAddress),void 0!==t.token&&(this.token=t.token),void 0!==t.refreshToken&&(this.refreshToken=t.refreshToken),void 0!==t.tokenType&&(this.tokenType=t.tokenType);const e=()=>{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"),e();else try{const t=yield this.info();this.userAddress=t.email,this._emit("connected"),e()}catch(t){this.connected=!1,this.rs._emit("error",new Error("Could not fetch user info.")),e.apply(this)}else(()=>{this.connected=!1,p&&(localStorage.removeItem(f),localStorage.removeItem(`${f}:shares`)),this.rs.setBackend(void 0)})()})}_getFolder(t){const e=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(t){return Promise.reject(t)}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:e.get(t+s)};else{const e=new Date(r.server_modified);n[s]={ETag:r.rev,"Content-Length":r.size,"Last-Modified":e.toUTCString()},this._revCache.set(t+s,r.rev)}}catch(e){console.error(`[Dropbox] folder “${t}” has entry ${JSON.stringify(r)}:`,e)}return n},{});return i.has_more?r(i.cursor).then(function(t){return Object.assign(s,t)}):Promise.resolve(s)},r=t=>{const e={body:{cursor:t}};return this._request("POST",m,e).then(n)};return this._request("POST",g,{body:{path:y(t)}}).then(n).then(function(n){return Promise.resolve({statusCode:200,body:n,contentType:"application/json; charset=UTF-8",revision:e.get(t)})})}get(t,e={}){if(!this.connected)return Promise.reject("not connected (path: "+t+")");const n=this._revCache.get(t);if(null===n)return Promise.resolve({statusCode:404});if(e&&e.ifNoneMatch){if(!this._initialFetchDone)return this.fetchDelta().then(()=>this.get(t,e));if(n&&n===e.ifNoneMatch)return Promise.resolve({statusCode:304})}if("/"===t.slice(-1))return this._getFolder(t);const r={headers:{"Dropbox-API-Arg":b({path:y(t)})},responseType:"arraybuffer"};return e&&e.ifNoneMatch&&(r.headers["If-None-Match"]=e.ifNoneMatch),this._request("GET","https://content.dropboxapi.com/2/files/download",r).then(e=>{const n=e.status;let r,i,s,o;return 200!==n&&409!==n?Promise.resolve({statusCode:n}):(r=e.getResponseHeader("Dropbox-API-Result"),(0,c.getTextFromArrayBuffer)(e.response,"UTF-8").then(a=>{i=a,409===n&&(r=i);try{r=JSON.parse(r)}catch(t){return Promise.reject(t)}if(409===n)return w(r,["path","not_found"])?{statusCode:404}:Promise.reject(new Error('API error while downloading file ("'+t+'"): '+r.error_summary));if(s=e.getResponseHeader("Content-Type"),o=r.rev,this._revCache.set(t,o),this._shareIfNeeded(t),(0,c.shouldBeTreatedAsBinary)(a,s))i=e.response;else try{i=JSON.parse(i),s="application/json; charset=UTF-8"}catch(t){}return{statusCode:n,body:i,contentType:(0,c.stripLegacyCharsetBinary)(s),revision:o}}))})}put(t,e,n){return r(this,arguments,void 0,function*(t,e,n,r={}){if(!this.connected)throw new Error("not connected (path: "+t+")");const i=this._revCache.get(t);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(e.length>157286400)throw new Error("Cannot upload file larger than 150MB");const s={body:e,contentType:n,path:t};if(r&&(r.ifMatch||"*"===r.ifNoneMatch)){const e=yield this._getMetadata(t);if(r&&"*"===r.ifNoneMatch&&e)return{statusCode:412,revision:e.rev};if(r&&r.ifMatch&&e&&e.rev!==r.ifMatch)return{statusCode:412,revision:e.rev}}const o=yield this._uploadSimple(s);return this._shareIfNeeded(t),o})}delete(t){return r(this,arguments,void 0,function*(t,e={}){if(!this.connected)throw new Error("not connected (path: "+t+")");const n=this._revCache.get(t);if((null==e?void 0:e.ifMatch)&&n&&e.ifMatch!==n)return{statusCode:412,revision:n};if(null==e?void 0:e.ifMatch){const n=yield this._getMetadata(t);if((null==e?void 0:e.ifMatch)&&n&&n.rev!==e.ifMatch)return{statusCode:412,revision:n.rev}}return this._deleteSimple(t)})}_shareIfNeeded(t){if(t.match(/^\/public\/.*[^/]$/)&&void 0===this._itemRefs[t])return this.share(t)}getItemURL(t){return r(this,void 0,void 0,function*(){if(t.match(/^\/public\/.*[^/]$/))return this._itemRefs[t]?this._itemRefs[t]:this.share(t)})}share(t){const e={body:{path:y(t)}};return this._request("POST","https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings",e).then(e=>{if(200!==e.status&&409!==e.status)return Promise.reject(new Error("Invalid response status:"+e.status));let n;try{n=JSON.parse(e.responseText)}catch(t){return Promise.reject(new Error("Invalid response body: "+e.responseText))}return 409===e.status?w(n,["shared_link_already_exists"])?this._getSharedLink(t):Promise.reject(new Error("API error: "+n.error_summary)):Promise.resolve(n.url)}).then(e=>(this._itemRefs[t]=e,p&&localStorage.setItem("remotestorage:dropbox:shares",JSON.stringify(this._itemRefs)),Promise.resolve(e)),e=>(e.message='Sharing Dropbox file or folder ("'+t+'") failed: '+e.message,Promise.reject(e)))}info(){return this._request("POST","https://api.dropboxapi.com/2/users/get_current_account",{}).then(function(t){let e;try{const n=JSON.parse(t.responseText);e=null==n?void 0:n.email}catch(e){return Promise.reject(new Error("Could not query current account info: Invalid API response: "+t.responseText))}return Promise.resolve({email:e})})}_request(t,e,n){return r(this,arguments,void 0,function*(t,e,n,r=1){if(this.isForbiddenRequestMethod(t,e))throw`Don't use ${t} 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:t,isFolder:(0,c.isFolder)(e)});try{const i=yield(0,u.requestWithTimeout)(t,e,n);return this.online||(this.online=!0,this.rs._emit("network-online")),this.rs._emit("wire-done",{method:t,isFolder:(0,c.isFolder)(e),success:!0}),401===(null==i?void 0:i.status)&&this.refreshToken?r>=3?(console.error(`Abandoned after ${r} attempts: ${t} ${e}`),i):(this.rs._emit("wire-busy",{method:t,isFolder:(0,c.isFolder)(e)}),yield d.default.refreshAccessToken(this.rs,this,this.refreshToken),this.rs._emit("wire-done",{method:t,isFolder:(0,c.isFolder)(e),success:!0}),this._request(t,e,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: ${t} ${e}`),i):(yield new Promise(t=>setTimeout(t,(0,u.retryAfterMs)(i))),this._request(t,e,n,r+1))):i}catch(n){throw this.online&&(this.online=!1,this.rs._emit("network-offline")),this.rs._emit("wire-done",{method:t,isFolder:(0,c.isFolder)(e),success:!1}),n}})}fetchDelta(...t){if(this._fetchDeltaPromise)return this._fetchDeltaPromise;const e=t=>r(this,void 0,void 0,function*(){let n,r;"string"==typeof t?(n=m,r={cursor:t}):(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(t){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(t||this._revCache.deactivatePropagation(),s.entries.forEach(t=>{const e=t.path_display.slice(14);"deleted"===t[".tag"]?(this._revCache.delete(e),this._revCache.delete(e+"/")):"file"===t[".tag"]&&this._revCache.set(e,t.rev)}),this._fetchDeltaCursor=s.cursor,s.has_more)return e(s.cursor);this._revCache.activatePropagation(),this._initialFetchDone=!0}catch(t){if("timeout"===t)return;throw t}});return this._fetchDeltaPromise=e(this._fetchDeltaCursor).catch(t=>("object"==typeof t&&"message"in t?t.message="Dropbox: fetchDelta: "+t.message:t=`Dropbox: fetchDelta: ${t}`,this.rs._emit("error",t),this._fetchDeltaPromise=null,Promise.reject(t))).then(()=>(this._fetchDeltaPromise=null,Promise.resolve(t))),this._fetchDeltaPromise}_getMetadata(t){const e={path:y(t)};return this._request("POST","https://api.dropboxapi.com/2/files/get_metadata",{body:e}).then(t=>{if(200!==t.status&&409!==t.status)return Promise.reject(new Error("Invalid response status:"+t.status));let e;try{e=JSON.parse(t.responseText)}catch(e){return Promise.reject(new Error("Invalid response body: "+t.responseText))}return 409===t.status?w(e,["path","not_found"])?Promise.resolve():Promise.reject(new Error("API error: "+e.error_summary)):Promise.resolve(e)}).then(void 0,e=>(e.message='Could not load metadata for file or folder ("'+t+'"): '+e.message,Promise.reject(e)))}_uploadSimple(t){const e={path:y(t.path),mode:{".tag":"overwrite",update:void 0},mute:!0};return t.ifMatch&&(e.mode={".tag":"update",update:t.ifMatch}),this._request("POST","https://content.dropboxapi.com/2/files/upload",{body:t.body,headers:{"Content-Type":"application/octet-stream","Dropbox-API-Arg":b(e)}}).then(e=>{if(200!==e.status&&409!==e.status)return Promise.resolve({statusCode:e.status});let n;try{n=JSON.parse(e.responseText)}catch(t){return Promise.reject(new Error("Invalid API result: "+e.responseText))}return 409===e.status?w(n,["path","conflict"])?this._getMetadata(t.path).then(function(t){return Promise.resolve({statusCode:412,revision:t.rev})}):(this.rs._emit("error",new Error(n.error_summary)),Promise.resolve({statusCode:e.status})):(this._revCache.set(t.path,n.rev),Promise.resolve({statusCode:e.status,revision:n.rev}))})}_deleteSimple(t){const e={path:y(t)};return this._request("POST","https://api.dropboxapi.com/2/files/delete",{body:e}).then(t=>{if(200!==t.status&&409!==t.status)return Promise.resolve({statusCode:t.status});let e;try{e=JSON.parse(t.responseText)}catch(e){return Promise.reject(new Error("Invalid response body: "+t.responseText))}if(409===t.status){if(w(e,["path_lookup","not_found"]))return Promise.resolve({statusCode:404});this.rs._emit("error",new Error(e.error_summary))}return Promise.resolve({statusCode:t.status,revision:200===t.status?e.rev:void 0})}).then(e=>(200!==e.statusCode&&404!==e.statusCode||(this._revCache.delete(t),delete this._itemRefs[t]),Promise.resolve(e)),e=>(e.message='Could not delete Dropbox file or folder ("'+t+'"): '+e.message,Promise.reject(e)))}_getSharedLink(t){return r(this,void 0,void 0,function*(){const e={body:{path:y(t),direct_only:!0}};return this._request("POST","https://api.dropboxapi.com/2/sharing/list_shared_links",e).then(t=>{if(200!==t.status&&409!==t.status)return Promise.reject(new Error("Invalid response status: "+t.status));let e;try{e=JSON.parse(t.responseText)}catch(e){return Promise.reject(new Error("Invalid response body: "+t.responseText))}return 409===t.status?Promise.reject(new Error("API error: "+(null==e?void 0:e.error_summary)||0)):e.links.length?Promise.resolve(e.links[0].url):Promise.reject(new Error("No links returned"))},e=>(e.message='Could not get link to a shared file or folder ("'+t+'"): '+e.message,Promise.reject(e)))})}static _rs_init(t){p=(0,c.localStorageAvailable)(),t.apiKeys.dropbox&&(t.dropbox=new _(t)),"dropbox"===t.backend&&S(t)}static _rs_supported(){return!0}static _rs_cleanup(t){(function(t){(function(t){t._origRemote&&(t.remote=t._origRemote,delete t._origRemote)})(t),function(t){t._dropboxOrigSync&&(t.sync.sync=t._dropboxOrigSync,delete t._dropboxOrigSync)}(t),C(t)})(t),p&&localStorage.removeItem(f),t.setBackend(void 0)}}function x(t,...e){t._dropboxOrigSync||(t._dropboxOrigSync=t.sync.sync.bind(t.sync),t.sync.sync=function(){return this.dropbox.fetchDelta(t,...e).then(t._dropboxOrigSync,function(e){t._emit("error",new a.default(e)),t._emit("sync-done",{completed:!1})})}.bind(t))}function C(t){t._dropboxOrigSyncCycle&&(t.syncCycle=t._dropboxOrigSyncCycle,delete t._dropboxOrigSyncCycle)}function S(t){(function(t){t._origRemote||(t._origRemote=t.remote,t.remote=t.dropbox)})(t),t.sync?x(t):function(t,...e){t._dropboxOrigSyncCycle||(t._dropboxOrigSyncCycle=t.syncCycle,t.syncCycle=()=>{if(!t.sync)throw new Error("expected sync to be initialized by now");x(t),t._dropboxOrigSyncCycle(t,...e),C(t)})}(t)}(0,c.applyMixins)(_,[s.default]),t.exports=_},451:function(t,e,n){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};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]),t.exports=a},93:function(t,e,n){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.EventHandling=void 0;const i=r(n(334));class s{addEvents(t){t.forEach(t=>this._addEvent(t))}addEventListener(t,e){if("string"!=typeof t)throw new Error("Argument eventName should be a string");if("function"!=typeof e)throw new Error("Argument handler should be a function");(0,i.default)("[EventHandling] Adding event listener",t),this._validateEvent(t),this._handlers[t].push(e)}on(t,e){return this.addEventListener(t,e)}removeEventListener(t,e){this._validateEvent(t);const n=this._handlers[t].length;for(let r=0;r<n;r++)if(this._handlers[t][r]===e)return void this._handlers[t].splice(r,1)}_emit(t,...e){this._validateEvent(t),this._handlers[t].slice().forEach(t=>{t(...e)})}_validateEvent(t){if(!(t in this._handlers))throw new Error("Unknown event: "+t)}_delegateEvent(t,e){e.on(t,e=>{this._emit(t,e)})}_addEvent(t){void 0===this._handlers&&(this._handlers={}),this._handlers[t]=[]}}e.EventHandling=s,e.default=s},545:function(t,e,n){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};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));t.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(t=>{this.featureModules[t]&&delete this.featureModules[t]}),this._allLoaded=!1;for(const t in this.featureModules)this.loadFeature(t)},hasFeature(t){for(let e=this.features.length-1;e>=0;e--)if(this.features[e].name===t)return this.features[e].supported;return!1},loadFeature(t){const e=this.featureModules[t],n=!e._rs_supported||e._rs_supported();(0,o.default)(`[RemoteStorage] [FEATURE ${t}] initializing ...`),"object"==typeof n?n.then(()=>{this.featureSupported(t,!0),this.initFeature(t)},()=>{this.featureSupported(t,!1)}):"boolean"==typeof n?(this.featureSupported(t,n),n&&this.initFeature(t)):this.featureSupported(t,!1)},initFeature(t){const e=this.featureModules[t];let n;try{n=e._rs_init(this)}catch(e){return void this.featureFailed(t,e)}"object"==typeof n&&"function"==typeof n.then?n.then(()=>{this.featureInitialized(t)},e=>{this.featureFailed(t,e)}):this.featureInitialized(t)},featureFailed(t,e){(0,o.default)(`[RemoteStorage] [FEATURE ${t}] initialization failed (${e})`),this.featureDone()},featureSupported(t,e){(0,o.default)(`[RemoteStorage] [FEATURE ${t}]${e?"":"not "} supported`),e||this.featureDone()},featureInitialized(t){(0,o.default)(`[RemoteStorage] [FEATURE ${t}] initialized`),this.features.push({name:t,init:this.featureModules[t]._rs_init,supported:!0,cleanup:this.featureModules[t]._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(t=>{if(this.features.some(e=>e.name===t))return this.features.local=this.featureModules[t],!0})},_fireReady(){try{this.readyFired||(this._emit("ready"),this.readyFired=!0)}catch(t){console.error("'ready' failed: ",t,t.stack),this._emit("error",t)}},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(t){(0,a.logError)(t),this._emit("error",t)}this._processPending()},_collectCleanupFunctions(){this._cleanups=[];for(let t=0;t<this.features.length;t++){const e=this.features[t].cleanup;"function"==typeof e&&this._cleanups.push(e)}}}},801:function(t,e,n){var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,s){function o(t){try{l(r.next(t))}catch(t){s(t)}}function a(t){try{l(r.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((r=r.apply(t,e||[])).next())})};const i=(this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}})(n(93)),s=n(746),o=n(368),a=n(684),l="remotestorage:googledrive",c="application/vnd.google-apps.folder";let u;function h(t){return"/"===t.substr(-1)&&(t=t.substr(0,t.length-1)),decodeURIComponent(t)}function d(t){return t.replace(/[^\/]+\/?$/,"")}function p(t){const e=t.split("/");return"/"===t.substr(-1)?e[e.length-2]+"/":e[e.length-1]}function f(t){return(0,s.cleanPath)(`/remotestorage/${t}`)}class g{constructor(t){this._items={},this.maxAge=t,this._items={}}get(t){const e=this._items[t],n=(new Date).getTime();return e&&e.t>=n-this.maxAge?e.v:void 0}set(t,e){this._items[t]={v:e,t:(new Date).getTime()}}}class m extends a.RemoteBase{constructor(t,e){if(super(t),this.online=!0,this.storageApi="draft-dejong-remotestorage-19",this.addEvents(["connected","not-connected"]),this.clientId=e,this._fileIdCache=new g(300),u=(0,s.localStorageAvailable)(),u){const t=(0,s.getJSONFromLocalStorage)(l);t&&this.configure(t)}}configure(t){void 0!==t.userAddress&&(this.userAddress=t.userAddress),void 0!==t.token&&(this.token=t.token);const e=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"),e.apply(this)):this.info().then(t=>{this.userAddress=t.user.emailAddress,this._emit("connected"),e.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(t,e={}){return(0,s.isFolder)(t)?this._getFolder(f(t)):this._getFile(f(t),e)}put(t,e,n,r={}){const i=f(t);function s(t){if(t.status>=200&&t.status<300){const e=JSON.parse(t.responseText),n=this.stripQuotes(e.etag);return Promise.resolve({statusCode:200,contentType:e.mimeType,revision:n})}return 412===t.status?Promise.resolve({statusCode:412,revision:"conflict"}):Promise.reject("PUT failed with status "+t.status+" ("+t.responseText+")")}return this._getFileId(i).then(t=>t?r&&"*"===r.ifNoneMatch?s({status:412}):this._updateFile(t,i,e,n,r).then(s):this._createFile(i,e,n).then(s))}delete(t,e={}){const n=f(t);return this._getFileId(n).then(t=>t?this._getMeta(t).then(n=>{let r;return"object"==typeof n&&"string"==typeof n.etag&&(r=this.stripQuotes(n.etag)),e&&e.ifMatch&&e.ifMatch!==r?{statusCode:412,revision:r}:this._request("DELETE","https://www.googleapis.com/drive/v2/files/"+t,{}).then(t=>200===t.status||204===t.status?{statusCode:200}:Promise.reject("Delete failed: "+t.status+" ("+t.responseText+")"))}):Promise.resolve({statusCode:200}))}info(){return this._request("GET","https://www.googleapis.com/drive/v2/about?fields=user",{}).then(function(t){try{const e=JSON.parse(t.responseText);return Promise.resolve(e)}catch(t){return Promise.reject(t)}})}_updateFile(t,e,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/"+t+"?uploadType=resumable",{body:JSON.stringify(s),headers:o}).then(t=>412===t.status?t:this._request("PUT",t.getResponseHeader("Location"),{body:r.match(/^application\/json/)?JSON.stringify(n):n}))}_createFile(t,e,n){return this._getParentId(t).then(r=>{const i={title:h(p(t)),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(t=>this._request("POST",t.getResponseHeader("Location"),{body:n.match(/^application\/json/)?JSON.stringify(e):e}))})}_getFile(t,e){return this._getFileId(t).then(t=>this._getMeta(t).then(t=>{let n;if("object"==typeof t&&"string"==typeof t.etag&&(n=this.stripQuotes(t.etag)),e&&e.ifNoneMatch&&n===e.ifNoneMatch)return Promise.resolve({statusCode:304});if(!t.downloadUrl){if(!t.exportLinks||!t.exportLinks["text/html"])return Promise.resolve({statusCode:200,body:"",contentType:t.mimeType,revision:n});t.mimeType+=";export=text/html",t.downloadUrl=t.exportLinks["text/html"]}return this._request("GET",t.downloadUrl,{responseType:"arraybuffer"}).then(e=>(0,s.getTextFromArrayBuffer)(e.response,"UTF-8").then(function(r){let i=r;if(t.mimeType.match(/^application\/json/))try{i=JSON.parse(i)}catch(t){}else(0,s.shouldBeTreatedAsBinary)(r,t.mimeType)&&(i=e.response);return{statusCode:200,body:i,contentType:(0,s.stripLegacyCharsetBinary)(t.mimeType),revision:n}}))}))}_getFolder(t){return this._getFileId(t).then(e=>{let n,r,i;if(!e)return Promise.resolve({statusCode:404});const o="'"+e+"' 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(e=>{var o;if(200!==e.status)return Promise.reject("request failed or something: "+e.status);try{n=JSON.parse(e.responseText)}catch(t){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(t+(0,s.cleanPath)(a.title)+"/",a.id),i[a.title+"/"]={ETag:r}):(this._fileIdCache.set(t+(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(t){const e=d(t);return this._getFileId(e).then(t=>t?Promise.resolve(t):this._createFolder(e))}_createFolder(t){return this._getParentId(t).then(e=>this._request("POST","https://www.googleapis.com/drive/v2/files",{body:JSON.stringify({title:h(p(t)),mimeType:c,parents:[{id:e}]}),headers:{"Content-Type":"application/json; charset=UTF-8"}}).then(t=>{const e=JSON.parse(t.responseText);return Promise.resolve(e.id)}))}_getFileId(t){let e;return"/"===t?Promise.resolve("root"):(e=this._fileIdCache.get(t))?Promise.resolve(e):this._getFolder(d(t)).then(()=>(e=this._fileIdCache.get(t),e?Promise.resolve(e):"/"===t.substr(-1)?this._createFolder(t).then(()=>this._getFileId(t)):Promise.resolve()))}_getMeta(t){return this._request("GET","https://www.googleapis.com/drive/v2/files/"+t,{}).then(function(e){return 200===e.status?Promise.resolve(JSON.parse(e.responseText)):Promise.reject("request (getting metadata for "+t+") failed with status: "+e.status)})}_request(t,e,n){return this.isForbiddenRequestMethod(t,e)?Promise.reject(`Don't use ${t} on directories!`):(n.headers||(n.headers={}),n.headers.Authorization="Bearer "+this.token,this.rs._emit("wire-busy",{method:t,isFolder:(0,s.isFolder)(e)}),(0,o.requestWithTimeout)(t,e,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:t,isFolder:(0,s.isFolder)(e),success:!0}),Promise.resolve(n)),n=>(this.online&&(this.online=!1,this.rs._emit("network-offline")),this.rs._emit("wire-done",{method:t,isFolder:(0,s.isFolder)(e),success:!1}),Promise.reject(n))))}getItemURL(t){return r(this,void 0,void 0,function*(){throw new Error("getItemURL is not implemented for Google Drive yet")})}static _rs_init(t){const e=t.apiKeys.googledrive;e&&(t.googledrive=new m(t,e.clientId),"googledrive"===t.backend&&(t._origRemote=t.remote,t.remote=t.googledrive))}static _rs_supported(){return!0}static _rs_cleanup(t){t.setBackend(void 0),t._origRemote&&(t.remote=t._origRemote,delete t._origRemote)}}(0,s.applyMixins)(m,[i.default]),t.exports=m},567:function(t,e,n){var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,s){function o(t){try{l(r.next(t))}catch(t){s(t)}}function a(t){try{l(r.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((r=r.apply(t,e||[])).next())})},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};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(t){super(),this.addEvents(["change","local-events-done"]),this.db=t||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(t){return r(this,void 0,void 0,function*(){const e=[],n={};for(let r=0,i=t.length;r<i;r++)void 0!==this.changesQueued[t[r]]?n[t[r]]=(0,l.deepClone)(this.changesQueued[t[r]]||void 0):void 0!==this.changesRunning[t[r]]?n[t[r]]=(0,l.deepClone)(this.changesRunning[t[r]]||void 0):e.push(t[r]);return e.length>0?this.getNodesFromDb(e).then(function(t){for(const e in n)t[e]=n[e];return t}):n})}setNodes(t){return r(this,void 0,void 0,function*(){for(const e in t)this.changesQueued[e]=t[e]||!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(t){return new Promise((e,n)=>{const r=this.db.transaction(["nodes"],"readonly"),i=r.objectStore("nodes"),s={};this.getsRunning++,t.map(t=>{i.get(t).onsuccess=e=>{s[t]=e.target.result}}),r.oncomplete=()=>{e(s),this.getsRunning--},r.onerror=r.onabort=()=>{n("get transaction error/abort"),this.getsRunning--}})}setNodesInDb(t){return r(this,void 0,void 0,function*(){return new Promise((e,n)=>{const r=this.db.transaction(["nodes"],"readwrite"),i=r.objectStore("nodes"),s=(new Date).getTime();this.putsRunning++,(0,a.default)("[IndexedDB] Starting puts",t,this.putsRunning);for(const o in t){const e=t[o];if("object"==typeof e)try{i.put(e)}catch(t){throw(0,a.default)("[IndexedDB] Error while putting",e,t),t}else try{i.delete(o)}catch(t){throw(0,a.default)("[IndexedDB] Error while removing",i,e,t),t}}r.oncomplete=()=>{this.putsRunning--,(0,a.default)("[IndexedDB] Finished puts",t,this.putsRunning,(new Date).getTime()-s+"ms"),e()},r.onerror=()=>{this.putsRunning--,n("transaction error")},r.onabort=()=>{n("transaction abort"),this.putsRunning--}})})}reset(t){const e=this.db.name;this.db.close(),h.clean(e,()=>{h.open(e,(n,r)=>{n?(0,a.default)(`[IndexedDB] Error while resetting database ${e}:`,n):this.db=r,"function"==typeof t&&t(self)})})}forAllNodes(t){return r(this,void 0,void 0,function*(){return new Promise(e=>{this.db.transaction(["nodes"],"readonly").objectStore("nodes").openCursor().onsuccess=n=>{const r=n.target.result;r?(t(r.value),r.continue()):e()}})})}closeDB(){0===this.putsRunning?this.db.close():setTimeout(this.closeDB.bind(this),100)}static open(t,e){const n=setTimeout(function(){e("timeout trying to open db")},1e4);try{const r=indexedDB.open(t,2);r.onerror=function(){(0,a.default)("[IndexedDB] Opening DB failed",r),clearTimeout(n),e(r.error)},r.onupgradeneeded=function(t){const e=r.result;(0,a.default)("[IndexedDB] Upgrade: from ",t.oldVersion," to ",t.newVersion),e.objectStoreNames.contains("nodes")||((0,a.default)("[IndexedDB] Creating object store: nodes"),e.createObjectStore("nodes",{keyPath:"path"})),e.objectStoreNames.contains("changes")||((0,a.default)("[IndexedDB] Creating object store: changes"),e.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(t,function(){h.open(t,e)});e(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(t,function(){h.open(t,e)})}}static clean(t,e){const n=indexedDB.deleteDatabase(t);n.onblocked=function(e){console.warn(`Deleting IndexedDB database "${t}" is blocked by another open connection`,e)},n.onsuccess=function(){(0,a.default)(`[IndexedDB] Deleted database "${t}"`),e()},n.onerror=n.onabort=function(e){console.error('Failed to remove database "'+t+'"',e)}}static _rs_init(t){return new Promise((e,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=e=>{t._emit("error",h.eventToError(e))},e()}})})}static _rs_supported(){return new Promise((t,e)=>{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(){e()},n.onsuccess=function(){n.result.close(),indexedDB.deleteDatabase("rs-check"),t()}}catch(t){e()}else e()})}static _rs_cleanup(t){return new Promise(e=>{t.local instanceof h&&t.local.closeDB(),h.clean(c,e)})}static eventToError(t){var e;const n=null==t?void 0:t.target,r=null==n?void 0:n.error;if(r)return r;if(null===(e=null==n?void 0:n.db)||void 0===e?void 0:e.name){const t=n.objectStoreNames,e=t?Array.from(t).join(", "):"";return new Error(`Error in store(s) “${e}” in database “${n.db.name}”`)}return new Error("Unknown IndexedDB error")}diffHandler(){}}(0,l.applyMixins)(h,[s.default]),t.exports=h},365:function(t,e,n){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};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(t){const e={};for(let n=0,r=t.length;n<r;n++)e[t[n]]=(0,o.deepClone)(this._storage[t[n]]);return Promise.resolve(e)}setNodes(t){for(const e in t)void 0===t[e]?delete this._storage[e]:this._storage[e]=t[e];return Promise.resolve()}forAllNodes(t){for(const e in this._storage)t(this._storage[e]);return Promise.resolve()}diffHandler(){}static _rs_init(){}static _rs_supported(){return!0}static _rs_cleanup(){}}(0,o.applyMixins)(a,[i.default]),t.exports=a},794:function(t,e,n){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const i=r(n(496)),s=r(n(93)),o=r(n(334)),a=n(746),l="remotestorage:cache:nodes:";function c(t){return t.substr(0,26)===l||"remotestorage:cache:changes:"===t.substr(0,28)}function u(t){return t.substr(0,26)===l}class h extends i.default{constructor(){super(),this.addEvents(["change","local-events-done"])}diffHandler(...t){}getNodes(t){const e={};for(let n=0,i=t.length;n<i;n++)try{const r=JSON.parse(localStorage.getItem(l+t[n]));e[t[n]]=r||void 0}catch(r){(0,o.default)(`[LocalStorage] Failed to get node: ${r.message}`),e[t[n]]=void 0}return Promise.resolve(e)}setNodes(t){for(const e in t)localStorage.setItem(l+e,JSON.stringify(t[e]));return Promise.resolve()}forAllNodes(t){let e;for(let n=0,r=localStorage.length;n<r;n++)if(u(localStorage.key(n))){try{e=JSON.parse(localStorage.getItem(localStorage.key(n)))}catch(t){e=void 0}e&&t(e)}return Promise.resolve()}static _rs_init(){}static _rs_supported(){return(0,a.localStorageAvailable)()}static _rs_cleanup(){const t=[];(0,o.default)("[LocalStorage] Starting cleanup");for(let e=0,n=localStorage.length;e<n;e++){const n=localStorage.key(e);c(n)&&t.push(n)}for(const e in t)(0,o.default)("[LocalStorage] Removing",e),localStorage.removeItem(e)}}(0,a.applyMixins)(h,[s.default]),t.exports=h},334:function(t,e,n){const r=(this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}})(n(28));t.exports=function(...t){r.default.logging&&console.log(...t)}},684:function(t,e,n){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.RemoteBase=void 0;const i=r(n(93)),s=n(746);class o extends i.default{constructor(t){super(),this.rs=t,this.connected=!1}stopWaitingForToken(){this.connected||this._emit("not-connected")}addQuotes(t){return"string"!=typeof t?t:"*"===t?"*":'"'+t+'"'}stripQuotes(t){return"string"!=typeof t?t:t.replace(/^["']|["']$/g,"")}isForbiddenRequestMethod(t,e){return("PUT"===t||"DELETE"===t)&&(0,s.isFolder)(e)}}e.RemoteBase=o},423:function(t,e,n){var r,i=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),s=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||(r=function(t){return r=Object.getOwnPropertyNames||function(t){var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[e.length]=n);return e},r(t)},function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n=r(t),o=0;o<n.length;o++)"default"!==n[o]&&i(e,t,n[o]);return s(e,t),e}),a=this&&this.__rest||function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n},l=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.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(t){if("string"!=typeof t)return null;const e=t.trim().split(/\s+/).filter(Boolean);return 0===e.length?null:Array.from(new Set(e)).sort().join(" ")}function L(t){const e=(0,h.getJSONFromLocalStorage)(t);return"object"==typeof e&&null!==e?e:null}function I(t){return 403!==t.statusCode&&401!==t.statusCode||this._emit("error",new _.default),Promise.resolve(t)}function P(t){return"number"==typeof t&&t>=2e3&&t<=36e5}var M;!function(t){t.GOOGLE="googledrive",t.DROPBOX="dropbox"}(M||(M={}));class A{constructor(t){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 t&&null!==t){const e=t,{discovery:n}=e,r=a(e,["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 t=localStorage.getItem("remotestorage:backend");"dropbox"===t||"googledrive"===t?this.setBackend(t):this.setBackend("remotestorage")}this._authorizedScope=this._loadAuthorizedScope(),this._scopeChangeRequired=!1,this._scopeChangeEvent=null;const e=this.on;this.on=function(t,n){const r=e.call(this,t,n);if("scope-change-required"===t&&this._scopeChangeRequired&&this._scopeChangeEvent&&setTimeout(()=>{n(this._scopeChangeEvent)},0),this._allLoaded)switch(t){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(t){if(this.access.setStorageType(this.remote.storageApi),void 0===t.scope&&(t.scope=this.access.scopeParameter),S.cordova&&"string"==typeof c.default.cordovaRedirectUri)t.redirectUri=c.default.cordovaRedirectUri;else{const e=p.default.getLocation();let n=e.origin;"/"!==e.pathname&&(n+=e.pathname),t.redirectUri=n}void 0===t.clientId&&(t.clientId=t.redirectUri.match(/^(https?:\/\/[^/]+)/)[0]),p.default.authorize(this,t)}impliedauth(t,e){t=t||this.remote.storageApi,e=e||String(document.location),(0,u.default)("ImpliedAuth proceeding due to absent authURL; storageApi = "+t+" redirectUri = "+e),this.remote.configure({token:p.default.IMPLIED_FAKE_TOKEN}),document.location.href=e}connect(t,e){if(this.setBackend("remotestorage"),t.indexOf("@")<0&&!t.match(/^(https?:\/\/)?[^\s\/$\.?#]+\.[^\s]*$/))this._emit("error",new A.DiscoveryError("Not a valid user address or URL."));else{if(t.indexOf("@")<0&&!t.match(/^https?:\/\//)&&(t=`https://${t}`),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:t}),this._emit("connecting"),A.Discover(t).then(n=>{if(this._emit("authing"),n.userAddress=t,this.remote.configure(n),!this.remote.connected)if(n.authURL)if(void 0===e)this.authorize({authURL:n.authURL});else{if("string"!=typeof e)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:e}),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 t=this._cleanups.length;let e=0;const n=()=>{e++,e>=t&&(this._init(),(0,u.default)('Cleanups done, emitting "disconnected" event'),this._emit("disconnected"))};t>0?this._cleanups.forEach(t=>{const e=t(this);"object"==typeof e&&"function"==typeof e.then?e.then(n):n()}):n()}setBackend(t){if(this.backend=t,k&&(void 0!==t?localStorage.setItem("remotestorage:backend",t):localStorage.removeItem("remotestorage:backend")),void 0===t)return this._authorizedScope=null,this._scopeChangeRequired=!1,void(this._scopeChangeEvent=null);this._authorizedScope=this._loadAuthorizedScope(),this._checkScopeChange()}_rememberPendingScope(t){const e=T(t);k&&(e&&this.backend?localStorage.setItem(R,JSON.stringify({backend:this.backend,scope:e})):localStorage.removeItem(R))}_forgetPendingScope(){k&&localStorage.removeItem(R)}_rememberAuthorizedScope(t){const e=T(t);k?e&&this.backend?(localStorage.setItem(E,JSON.stringify({backend:this.backend,scope:e})),this._authorizedScope=e,this._checkScopeChange()):(localStorage.removeItem(E),this._authorizedScope=null,this._checkScopeChange()):(this._authorizedScope=e,this._checkScopeChange())}_completeAuthorization(t){const e=this._loadPendingScope()||T(t);this._forgetPendingScope(),e?this._rememberAuthorizedScope(e):this._checkScopeChange()}_checkScopeChange(){const t=T(this.access.scopeParameter),e=this._authorizedScope||this._loadAuthorizedScope(),n=!(!t||!e||t===e),r=n&&(!this._scopeChangeRequired||!this._scopeChangeEvent||this._scopeChangeEvent.requestedScope!==t||this._scopeChangeEvent.authorizedScope!==e);this._scopeChangeRequired=n,n?(this._scopeChangeEvent=this._buildScopeChangeEvent(t,e),r&&this._emit("scope-change-required",this._scopeChangeEvent)):this._scopeChangeEvent=null}_loadAuthorizedScope(){if(!k||!this.backend)return null;const t=L(E);return t&&t.backend===this.backend?T(t.scope):null}_loadPendingScope(){if(!k||!this.backend)return null;const t=L(R);return t&&t.backend===this.backend?T(t.scope):null}_buildScopeChangeEvent(t=T(this.access.scopeParameter),e=this._authorizedScope){return{requestedScope:t||"",authorizedScope:e||"",reauthorize:this.reauthorize.bind(this)}}onChange(t,e){this._pathHandlers.change[t]||(this._pathHandlers.change[t]=[]),this._pathHandlers.change[t].push(e)}enableLog(){c.default.logging=!0}disableLog(){c.default.logging=!1}log(...t){u.default.apply(A,t)}setApiKeys(t){const e=[M.GOOGLE,M.DROPBOX];if("object"!=typeof t||!Object.keys(t).every(t=>e.includes(t)))return console.error("setApiKeys() was called with invalid arguments"),!1;Object.keys(t).forEach(e=>{const n=t[e];if(n){switch(e){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[e]}),k&&localStorage.setItem("remotestorage:api-keys",JSON.stringify(this.apiKeys))}setCordovaRedirectUri(t){if("string"!=typeof t||!t.match(/http(s)?:\/\//))throw new Error("Cordova redirect URI must be a URI string");c.default.cordovaRedirectUri=t}_setGPD(t,e){function n(t){return function(...n){return t.apply(e,n).then(I.bind(this))}}this.get=n(t.get),this.put=n(t.put),this.delete=n(t.delete)}_pendingGPD(t){return(...e)=>{const n=Array.prototype.slice.call(e);return new Promise((e,r)=>{this._pending.push({method:t,args:n,promise:{resolve:e,reject:r}})})}}_processPending(){this._pending.forEach(t=>{try{this[t.method](...t.args).then(t.promise.resolve,t.promise.reject)}catch(e){t.promise.reject(e)}}),this._pending=[]}_bindChange(t){t.on("change",this._dispatchEvent.bind(this,"change"))}_dispatchEvent(t,e){Object.keys(this._pathHandlers[t]).forEach(n=>{const r=n.length;e.path.substr(0,r)===n&&this._pathHandlers[t][n].forEach(t=>{const r={};for(const n in e)r[n]=e[n];r.relativePath=e.path.replace(new RegExp("^"+n),"");try{t(r)}catch(t){console.error("'change' handler failed: ",t,t.stack),this._emit("error",t)}})})}scope(t){if("string"!=typeof t)throw"Argument 'path' of baseClient.scope must be a string";return this.access.checkPathPermission(t,"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,t)}getSyncInterval(){return c.default.syncInterval}setSyncInterval(t){if(!P(t))throw t+" is not a valid sync interval";const e=c.default.syncInterval;c.default.syncInterval=t,this._emit("sync-interval-change",{oldValue:e,newValue:t})}getBackgroundSyncInterval(){return c.default.backgroundSyncInterval}setBackgroundSyncInterval(t){if(!P(t))throw t+" is not a valid sync interval";const e=c.default.backgroundSyncInterval;c.default.backgroundSyncInterval=t,this._emit("sync-interval-change",{oldValue:e,newValue:t})}getCurrentSyncInterval(){return c.default.isBackground?c.default.backgroundSyncInterval:c.default.syncInterval}getRequestTimeout(){return c.default.requestTimeout}setRequestTimeout(t){if("number"!=typeof t)throw t+" is not a valid request timeout";c.default.requestTimeout=t}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(t){const e=t.name,n=t.builder;if(Object.defineProperty(this,e,{configurable:!0,get:function(){const t=this._loadModule(e,n);return Object.defineProperty(this,e,{value:t}),t}}),-1!==e.indexOf("-")){const t=e.replace(/\-[a-z]/g,function(t){return t[1].toUpperCase()});Object.defineProperty(this,t,{get:function(){return this[e]}})}}_loadModule(t,e){if(e)return e(new f.default(this,"/"+t+"/"),new f.default(this,"/public/"+t+"/")).exports;throw"Unknown module: "+t}}e.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 t=new d.default(this);return Object.defineProperty(this,"access",{value:t,writable:!0,configurable:!0}),t}}),Object.defineProperty(A.prototype,"caching",{configurable:!0,get:function(){const t=new g.default(this);return Object.defineProperty(this,"caching",{value:t,writable:!0,configurable:!0}),t}}),(0,h.applyMixins)(A,[m.EventHandling]),e.default=A},368:function(t,e,n){var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,s){function o(t){try{l(r.next(t))}catch(t){s(t)}}function a(t){try{l(r.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((r=r.apply(t,e||[])).next())})},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.isArrayBufferView=void 0,e.retryAfterMs=function(t){const e=1e3*parseInt(t.getResponseHeader("Retry-After"));return e>=1e3?e:Math.max(1500,Math.min(6e4,Math.round(o.default.syncInterval/(2.9+.2*Math.random()))))},e.requestWithTimeout=function(t,n,i){return r(this,void 0,void 0,function*(){return"function"==typeof fetch?function(t,e,n){return r(this,void 0,void 0,function*(){const r="function"==typeof AbortController?new AbortController:null;let i;const a=new Promise((t,e)=>{i=setTimeout(()=>{r&&r.abort(),e("timeout")},o.default.requestTimeout)});let l;const c={},u=fetch(e,{method:t,headers:n.headers,body:n.body,signal:r?r.signal:void 0}).then(t=>{switch((0,s.default)("[requests fetch]",t),t.headers.forEach((t,e)=>{c[e.toUpperCase()]=t}),l={readyState:4,status:t.status,statusText:t.statusText,response:void 0,getResponseHeader:t=>c[t.toUpperCase()]||null,responseType:n.responseType,responseURL:e},n.responseType){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"json":return t.json();case void 0:case"":case"text":return t.text();default:throw new Error("responseType 'document' is not currently supported using fetch")}}).then(t=>(l.response=t,n.responseType&&"text"!==n.responseType||(l.responseText=t),l)).finally(()=>{clearTimeout(i)});return Promise.race([u,a])})}(t,n,i):"function"==typeof XMLHttpRequest?function(t,n,i){return r(this,void 0,void 0,function*(){return new Promise((r,a)=>{(0,s.default)("[requests XHR]",t,n);let l=!1;const c=setTimeout(()=>{l=!0,a("timeout")},o.default.requestTimeout),u=new XMLHttpRequest;if(u.open(t,n,!0),i.responseType&&(u.responseType=i.responseType),i.headers)for(const t in i.headers)u.setRequestHeader(t,i.headers[t]);u.onload=()=>{l||(clearTimeout(c),r(u))},u.onerror=t=>{l||(clearTimeout(c),a(t))};let h=i.body;"object"==typeof h&&!(0,e.isArrayBufferView)(h)&&h instanceof ArrayBuffer&&(h=new Uint8Array(h)),u.send(h)})})}(t,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)e.isArrayBufferView=function(t){return t&&t instanceof(n.g||window).ArrayBufferView};else{const t=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];e.isArrayBufferView=function(e){for(let n=0;n<8;n++)if(e instanceof t[n])return!0;return!1}}},941:function(t){t.exports=class{constructor(t){this._itemsRev={},this._storage={},this._canPropagate=!1,this.defaultValue=t,this.activatePropagation()}get(t){t=t.toLowerCase();let e=this._storage[t];return void 0===e&&(e=this.defaultValue,this._storage[t]=e),e}set(t,e){return t=t.toLowerCase(),this._storage[t]===e||(this._storage[t]=e,e||delete this._itemsRev[t],this._updateParentFolderItemRev(t,e),this._canPropagate&&this._propagate(t)),e}delete(t){return this.set(t,null)}deactivatePropagation(){return this._canPropagate=!1,!0}activatePropagation(){return this._canPropagate||(this._generateFolderRev("/"),this._canPropagate=!0),!0}_hashCode(t){let e=0;if(0===t.length)return e;for(let n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n),e|=0;return e}_generateHash(t){const e=t.sort().join("|");return""+this._hashCode(e)}_updateParentFolderItemRev(t,e){if("/"!==t){const n=this._getParentFolder(t);this._itemsRev[n]||(this._itemsRev[n]={});const r=this._itemsRev[n];e?r[t]=e:delete r[t],this._updateParentFolderItemRev(n,this.defaultValue)}}_getParentFolder(t){return t.substr(0,t.lastIndexOf("/",t.length-2)+1)}_propagate(t){if("/"!==t){const e=this._getParentFolder(t),n=this._itemsRev[e],r=[];for(const t in n)r.push(n[t]);const i=this._generateHash(r);this.set(e,i)}}_generateFolderRev(t){const e=this._itemsRev[t];let n=this.defaultValue;if(e){const t=[];for(const n in e){let r;r="/"===n.substr(-1)?this._generateFolderRev(n):e[n],t.push(r)}t.length>0&&(n=this._generateHash(t))}return this.set(t,n),n}}},491:function(t){class e extends Error{constructor(t){super();const e=new Error("Schema not found: "+t);return e.name="SchemaNotFound",e}}t.exports=e},982:function(t){class e extends Error{constructor(t){super(),this.name="SyncError",this.message="Sync failed: ","string"==typeof t?this.message+=t:(this.message+=t.message,this.stack=t.stack,this.originalError=t)}}t.exports=e},313:function(t,e,n){var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,s){function o(t){try{l(r.next(t))}catch(t){s(t)}}function a(t){try{l(r.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((r=r.apply(t,e||[])).next())})},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.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(t,e,n){return{action:t,path:e,promise:n}}function m(t,e){return t.common.revision!==e&&(!t.remote||t.remote.revision!==e)}function y(t){return!!t.common&&!!t.common.revision}class v{constructor(t){this.numThreads=10,this._tasks={},this._running={},this._timeStarted={},this._finishedTasks=[],this.rs=t,this.rs.local.onDiff(t=>{this.addTask(t),this.doTasks()}),this.rs.caching.onActivate(t=>{this.addTask(t),this.doTasks()}),this.addEvents(["done","req-done"])}now(){return(new Date).getTime()}queueGetRequest(t){return r(this,void 0,void 0,function*(){return new Promise((e,n)=>{this.rs.remote.connected?this.rs.remote.online?(this.addTask(t,function(){this.rs.local.get(t).then(t=>e(t))}.bind(this)),this.doTasks()):n("cannot fulfill maxAge requirement - remote is not online"):n("cannot fulfill maxAge requirement - remote is not connected")})})}corruptServerItemsMap(t){if("object"!=typeof t||Array.isArray(t))return!0;for(const e in t){const n=t[e];if("object"!=typeof n)return!0;if("string"!=typeof n.ETag)return!0;if((0,d.isFolder)(e)){if(-1!==e.substring(0,e.length-1).indexOf("/"))return!0}else if(-1!==e.indexOf("/"))return!0}return!1}corruptItemsMap(t){if("object"!=typeof t||Array.isArray(t))return!0;for(const e in t)if("boolean"!=typeof t[e])return!0;return!1}corruptRevision(t){return"object"!=typeof t||Array.isArray(t)||t.revision&&"string"!=typeof t.revision||t.body&&"string"!=typeof t.body&&"object"!=typeof t.body||t.contentType&&"string"!=typeof t.contentType||t.contentLength&&"number"!=typeof t.contentLength||t.timestamp&&"number"!=typeof t.timestamp||t.itemsMap&&this.corruptItemsMap(t.itemsMap)}isCorrupt(t){return"object"!=typeof t||Array.isArray(t)||"string"!=typeof t.path||this.corruptRevision(t.common)||t.local&&this.corruptRevision(t.local)||t.remote&&this.corruptRevision(t.remote)||t.push&&this.corruptRevision(t.push)}hasTasks(){return Object.keys(this._tasks).length>0}collectDiffTasks(){return r(this,void 0,void 0,function*(){let t=0;return this.rs.local.forAllNodes(e=>{t>100||(this.isCorrupt(e)?((0,l.default)("[Sync] WARNING: corrupt node in local cache",e),"object"==typeof e&&e.path&&(this.addTask(e.path),t++)):(this.needsFetch(e)&&this.rs.access.checkPathPermission(e.path,"r")||(0,d.isDocument)(e.path)&&this.needsPush(e)&&this.rs.access.checkPathPermission(e.path,"rw"))&&(this.addTask(e.path),t++))}).then(()=>t)})}inConflict(t){return!(!t.local||!t.remote||void 0===t.remote.body&&!t.remote.itemsMap)}needsRefresh(t){return!!t.common&&(!t.common.timestamp||this.now()-t.common.timestamp>s.default.syncInterval)}needsFetch(t){return!!this.inConflict(t)||!(!t.common||void 0!==t.common.itemsMap||void 0!==t.common.body)||!(!t.remote||void 0!==t.remote.itemsMap||void 0!==t.remote.body)}needsPush(t){return!this.inConflict(t)&&(!(!t.local||t.push)||void 0)}needsRemotePut(t){return!(!t.local||void 0===t.local.body||!1===t.local.body)}needsRemoteDelete(t){return t.local&&!1===t.local.body}getParentPath(t){const e=t.match(/^(.*\/)([^\/]+\/?)$/);if(e)return e[1];throw new Error('Not a valid path: "'+t+'"')}deleteChildPathsFromTasks(){for(const t in this._tasks){const e=(0,d.pathsFromRoot)(t);for(let n=1;n<e.length;n++)this._tasks[e[n]]&&(Array.isArray(this._tasks[t])&&this._tasks[t].length&&Array.prototype.push.apply(this._tasks[e[n]],this._tasks[t]),delete this._tasks[t])}}collectRefreshTasks(){return r(this,void 0,void 0,function*(){yield this.rs.local.forAllNodes(t=>{let e;if(this.needsRefresh(t)){try{e=this.getParentPath(t.path)}catch(t){}e&&this.rs.access.checkPathPermission(e,"r")?this.addTask(e):this.rs.access.checkPathPermission(t.path,"r")&&this.addTask(t.path)}}),this.deleteChildPathsFromTasks()})}flush(t){for(const e in t)"FLUSH"===this.rs.caching.checkPath(e)&&t[e]&&!t[e].local&&((0,l.default)("[Sync] Flushing",e),t[e]=void 0);return t}doTask(t){return r(this,void 0,void 0,function*(){return this.rs.local.getNodes([t]).then(e=>{const n=e[t];return void 0===n||function(t){return!(!t.remote||!t.remote.revision||t.remote.itemsMap||t.remote.body)}(n)?g("get",t,this.rs.remote.get(t)):this.needsRemotePut(n)?(n.push=(0,d.deepClone)(n.local),n.push.timestamp=this.now(),this.rs.local.setNodes(this.flush(e)).then(()=>{let e;return e=y(n)?{ifMatch:n.common.revision}:{ifNoneMatch:"*"},g("put",t,this.rs.remote.put(t,n.push.body,n.push.contentType,e))})):this.needsRemoteDelete(n)?(n.push={body:!1,timestamp:this.now()},this.rs.local.setNodes(this.flush(e)).then(()=>y(n)?g("delete",t,this.rs.remote.delete(t,{ifMatch:n.common.revision})):g("get",t,this.rs.remote.get(t)))):y(n)?g("get",t,this.rs.remote.get(t,{ifNoneMatch:n.common.revision})):g("get",t,this.rs.remote.get(t))})})}autoMergeFolder(t){if(t.remote.itemsMap&&(t.common=t.remote,delete t.remote,t.common.itemsMap)){for(const e in t.common.itemsMap)t.local.itemsMap[e]||(t.local.itemsMap[e]=!1);for(const e in t.local.itemsMap)t.common.itemsMap[e]||this.addTask(t.path+e);(0,d.equal)(t.local.itemsMap,t.common.itemsMap)&&delete t.local}return t}autoMergeDocument(t){var e;return function(t){return(!t.remote||!t.remote.revision||t.remote.revision===t.common.revision)&&(void 0===t.common.body&&!1===t.remote.body||t.remote.body===t.common.body&&t.remote.contentType===t.common.contentType)}(t)?delete(t=function(t){return t.remote&&!1===t.remote.body&&t.local&&!1===t.local.body&&delete t.local,t}(t)).remote:void 0!==t.remote.body&&(!1===t.remote.body&&!1===(null===(e=t.local)||void 0===e?void 0:e.body)||((0,l.default)("[Sync] Emitting conflict event"),setTimeout(this.rs.local.emitChange.bind(this.rs.local),10,{origin:"conflict",path:t.path,oldValue:t.local.body,newValue:t.remote.body,lastCommonValue:t.common.body,oldContentType:t.local.contentType,newContentType:t.remote.contentType,lastCommonContentType:t.common.contentType})),!1===t.remote.body?t.common={}:t.common=t.remote,delete t.remote,delete t.local),t}autoMerge(t){if(t.remote){if(t.local)return(0,d.isFolder)(t.path)?this.autoMergeFolder(t):this.autoMergeDocument(t);if((0,d.isFolder)(t.path))void 0!==t.remote.itemsMap&&(t.common=t.remote,delete t.remote);else if(void 0!==t.remote.body){const e={origin:"remote",path:t.path,oldValue:!1===t.common.body?void 0:t.common.body,newValue:!1===t.remote.body?void 0:t.remote.body,oldContentType:t.common.contentType,newContentType:t.remote.contentType};if(void 0===e.oldValue&&void 0===e.newValue||this.rs.local.emitChange(e),!1===t.remote.body)return;t.common=t.remote,delete t.remote}return t}t.common.body&&this.rs.local.emitChange({origin:"remote",path:t.path,oldValue:t.common.body,newValue:void 0,oldContentType:t.common.contentType,newContentType:void 0})}updateCommonTimestamp(t,e){return r(this,void 0,void 0,function*(){return this.rs.local.getNodes([t]).then(n=>(n[t]&&n[t].common&&n[t].common.revision===e&&(n[t].common.timestamp=this.now()),this.rs.local.setNodes(this.flush(n))))})}markChildren(t,e,n,i){return r(this,void 0,void 0,function*(){const r=[],s={},o={};for(const n in e)r.push(t+n),s[t+n]=e[n];for(const e in i)r.push(t+e);const a=yield this.rs.local.getNodes(r);let l,c;for(const e in a)if(c=a[e],s[e])c&&c.common?m(c,s[e].ETag)&&(n[e]=(0,d.deepClone)(c),n[e].remote={revision:s[e].ETag,timestamp:this.now()},n[e]=this.autoMerge(n[e])):(l=this.rs.caching.checkPath(e),"ALL"===l&&(n[e]={path:e,common:{timestamp:this.now()},remote:{revision:s[e].ETag,timestamp:this.now()}})),n[e]&&s[e]["Content-Type"]&&(n[e].remote.contentType=s[e]["Content-Type"]),n[e]&&s[e]["Content-Length"]&&(n[e].remote.contentLength=s[e]["Content-Length"]);else if(i[e.substring(t.length)]&&c&&c.common){if(c.common.itemsMap)for(const t in c.common.itemsMap)o[e+t]=!0;if(c.local&&c.local.itemsMap)for(const t in c.local.itemsMap)o[e+t]=!0;if(c.remote||(0,d.isFolder)(e))n[e]=void 0;else if(n[e]=this.autoMerge(c),void 0===n[e]){const r=n[this.getParentPath(e)],i=e.substring(t.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(t,e){return r(this,void 0,void 0,function*(){if(0===t.length)return e;const n=yield this.rs.local.getNodes(t),r={};function i(t,e){if(t&&t.itemsMap)for(const n in t.itemsMap)r[e+n]=!0}for(const t in n){const r=n[t];r&&((0,d.isFolder)(t)?(i(r.common,t),i(r.local,t)):r.common&&void 0!==r.common.body&&(e[t]=(0,d.deepClone)(r),e[t].remote={body:!1,timestamp:this.now()},e[t]=this.autoMerge(e[t])))}const s=yield this.markRemoteDeletions(Object.keys(r),e);s&&(yield this.rs.local.setNodes(this.flush(s)))})}completeFetch(t,e,n,i){return r(this,void 0,void 0,function*(){let r,s;const o=(0,d.pathsFromRoot)(t);(0,d.isFolder)(t)?r=[t]:(s=o[1],r=[t,s]);const a=yield this.rs.local.getNodes(r),l=a[s],c={};let u,h=a[t];function p(t){if(t&&t.itemsMap)for(u in t.itemsMap)e[u]||(c[u]=!0)}if("object"==typeof h&&h.path===t&&"object"==typeof h.common||(h={path:t,common:{}},a[t]=h),h.remote={revision:i,timestamp:this.now()},(0,d.isFolder)(t))for(u in p(h.common),p(h.remote),h.remote.itemsMap={},e)h.remote.itemsMap[u]=!0;else h.remote.body=e,h.remote.contentType=n,l&&l.local&&l.local.itemsMap&&(u=t.substring(s.length),!1!==e?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[t]=this.autoMerge(h),{toBeSaved:a,missingChildren:c}})}completePush(t,e,n,i){return r(this,void 0,void 0,function*(){const r=yield this.rs.local.getNodes([t]),s=r[t];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[t]=this.autoMerge(s)):(s.common={revision:i,timestamp:this.now()},"put"===e?(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"===e&&(!1===s.local.body?r[t]=void 0:delete s.push)),yield this.rs.local.setNodes(this.flush(r))})}dealWithFailure(t){return r(this,void 0,void 0,function*(){const e=yield this.rs.local.getNodes([t]);if(e[t])return delete e[t].push,this.rs.local.setNodes(this.flush(e))})}interpretStatus(t){const e={statusCode:t,successful:void 0,conflict:void 0,unAuth:void 0,notFound:void 0,changed:void 0,networkProblems:void 0};return"string"!=typeof t||"offline"!==t&&"timeout"!==t?"number"==typeof t?(e.successful=2===Math.floor(t/100)||304===t||412===t||404===t,e.conflict=412===t,e.unAuth=401===t&&this.rs.remote.token!==c.default.IMPLIED_FAKE_TOKEN||402===t||403===t,e.notFound=404===t,e.changed=304!==t,e):void 0:(e.successful=!1,e.networkProblems=!0,e)}handleGetResponse(t,e,n,i,s){return r(this,void 0,void 0,function*(){if(e.notFound&&(n=!!(0,d.isFolder)(t)&&{}),e.changed){const e=yield this.completeFetch(t,n,i,s);if((0,d.isFolder)(t)){if(this.corruptServerItemsMap(n))return(0,l.default)("[Sync] WARNING: Discarding corrupt folder description from server for "+t),!1;yield this.markChildren(t,n,e.toBeSaved,e.missingChildren)}else yield this.rs.local.setNodes(this.flush(e.toBeSaved))}else yield this.updateCommonTimestamp(t,s);return!0})}handleResponse(t,e,n){return r(this,void 0,void 0,function*(){const r=this.interpretStatus(n.statusCode);if(r.successful){if("get"===e)return this.handleGetResponse(t,r,n.body,n.contentType,n.revision);if("put"===e||"delete"===e)return this.completePush(t,e,r.conflict,n.revision).then(function(){return!0});throw new Error(`cannot handle response for unknown action ${e}`)}{let e;return e=r.unAuth?new h.default:r.networkProblems?new u.default("Network request failed."):new Error("HTTP response code "+r.statusCode+" received."),this.dealWithFailure(t).then(()=>{throw this.rs._emit("error",e),e})}})}finishTask(t){return r(this,arguments,void 0,function*(t,e=!0){if(void 0===t.action)return void delete this._running[t.path];if(e&&((0,l.default)("[Sync] queue finished task:",t.path),this._finishedTasks.push(t),this._finishedTasks.length>1))return void(0,l.default)("[Sync] delaying finished task:",t.path);let n;(0,l.default)("[Sync] run task:",t.path);try{n=yield t.promise}catch(e){(0,l.default)("[Sync] wire client rejects its promise",t.path,t.action,e),n={statusCode:"offline"}}try{const e=yield this.handleResponse(t.path,t.action,n);this.finishSuccessfulTask(t,e)}catch(e){this.finishUnsuccessfulTask(t,e)}})}finishSuccessfulTask(t,e){return r(this,void 0,void 0,function*(){if(this._finishedTasks.shift(),delete this._timeStarted[t.path],delete this._running[t.path],e&&this._tasks[t.path]){for(let e=0;e<this._tasks[t.path].length;e++)this._tasks[t.path][e]();delete this._tasks[t.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(t,e){return r(this,void 0,void 0,function*(){(0,l.default)("[Sync]",e.message),this._finishedTasks.shift(),delete this._timeStarted[t.path],delete this._running[t.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 t=this.tasksWanted()-Object.keys(this._running).length;if(t<=0)return!0;this.hasTasks()&&!this.done&&this.rs._emit("sync-started");let e,n=0;for(e in this._tasks)if(!this._running[e]&&(this._timeStarted[e]=this.now(),this._running[e]=this.doTask(e).then(this.finishTask.bind(this)),n++,n>=t))break;return n>=t}collectTasks(){return r(this,arguments,void 0,function*(t=!0){if(!this.hasTasks()&&!this.stopped)return(yield this.collectDiffTasks())>0?void 0:t?this.collectRefreshTasks():void 0})}addTask(t,e){this._tasks[t]||(this._tasks[t]=[]),"function"==typeof e&&this._tasks[t].push(e)}sync(){return r(this,void 0,void 0,function*(){if(this.done=!1,!this.doTasks()){try{yield this.collectTasks()}catch(t){throw(0,l.default)("[Sync] Sync error",t),new Error("Local cache unavailable")}this.doTasks()}})}static _rs_init(t){p=function(){const e=new o.default;e.isBrowser()&&function(t,e){function n(t){const n=e.getCurrentSyncInterval();s.default.isBackground=!t;const r=e.getCurrentSyncInterval();e._emit("sync-interval-change",{oldValue:n,newValue:r})}t.on("background",()=>n(!1)),t.on("foreground",()=>n(!0))}(e,t),t.sync||(t.sync=new v(t),t.syncStopped&&((0,l.default)("[Sync] Initializing with sync stopped"),t.sync.stopped=!0,delete t.syncStopped)),t.setupSyncCycle()},f=function(){t.removeEventListener("connected",f),t.startSync()},t.on("ready",p),t.on("connected",f)}static _rs_cleanup(t){t.stopSync(),t.removeEventListener("ready",p),t.removeEventListener("connected",f),t.caching.resetActivationHandler(),t.sync=void 0,delete t.sync}}e.Sync=v,(0,d.applyMixins)(v,[a.default]),e.default=v},370:function(t,e,n){var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,s){function o(t){try{l(r.next(t))}catch(t){s(t)}}function a(t){try{l(r.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((r=r.apply(t,e||[])).next())})};const i=(this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}})(n(334));function s(t){return"dropbox"===this.backend&&!!t.match(/^\/public\/.*[^\/]$/)}const o={get:function(t,e){if(this.local){if(void 0===e)e="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 e&&!1!==e)return Promise.reject("Argument 'maxAge' must be 'false' or a number");return this.local.get(t,e,this.sync.queueGetRequest.bind(this.sync))}return this.remote.get(t);var n},put:function(t,e,n){return s.bind(this)(t)?o._wrapBusyDone.call(this,this.remote.put(t,e,n)):this.local?this.local.put(t,e,n):o._wrapBusyDone.call(this,this.remote.put(t,e,n))},delete:function(t,e){return this.local?this.local.delete(t,e):o._wrapBusyDone.call(this,this.remote.delete(t,e))},_wrapBusyDone:function(t){return r(this,void 0,void 0,function*(){return this._emit("wire-busy"),t.then(t=>(this._emit("wire-done",{success:!0}),Promise.resolve(t)),t=>(this._emit("wire-done",{success:!1}),Promise.reject(t)))})}};t.exports=o},613:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BaseClientTypes=void 0;class n{constructor(){this.uris={},this.schemas={},this.aliases={}}declare(t,e,n,r){const i=t+"/"+e;if(r.extends){const e=r.extends.split("/"),n=1===e.length?t+"/"+e.shift():e.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(t){return this.uris[t]}getSchema(t){return this.schemas[t]}inScope(t){const e=t.length,n={};for(const r in this.uris)if(r.substr(0,e+1)===t+"/"){const t=this.uris[r];n[t]=this.schemas[t]}return n}}e.BaseClientTypes=n,e.default=new n},503:function(t){class e extends Error{constructor(t,e={}){super(),this.name="Unauthorized",this.message=void 0===t?"App authorization expired or revoked.":t,void 0!==e.code&&(this.code=e.code),this.stack=(new Error).stack}}t.exports=e},746:function(t,e,n){var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,s){function o(t){try{l(r.next(t))}catch(t){s(t)}}function a(t){try{l(r.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((r=r.apply(t,e||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.toBase64=e.getTextFromArrayBuffer=e.stripLegacyCharsetBinary=e.shouldBeTreatedAsBinary=e.getJSONFromLocalStorage=e.localStorageAvailable=e.pathsFromRoot=e.deepClone=e.equal=e.bindAll=e.cleanPath=e.baseName=e.isDocument=e.isFolder=e.containingFolder=e.extend=e.getGlobalContext=e.globalContext=e.logError=void 0,e.generateCodeVerifier=function(){return r(this,arguments,void 0,function*(t=128){const e=new Uint8Array(t);crypto.getRandomValues(e);const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=Array.from(e).map(t=>n[t%66]),i=r.join(""),s=Uint8Array.from(r.map(t=>t.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(e),{codeVerifier:i,codeChallenge:o,state:Array.from(e).map(t=>n[t%66]).join("")}})},e.applyMixins=function(t,e){e.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(n=>{Object.defineProperty(t.prototype,n,Object.getOwnPropertyDescriptor(e.prototype,n))})})},e.logError=t=>{"string"==typeof t?console.error(t):console.error(t.message,t.stack)},e.globalContext="undefined"!=typeof window?window:"object"==typeof self?self:n.g,e.getGlobalContext=()=>"undefined"!=typeof window?window:"object"==typeof self?self:n.g,e.extend=(...t)=>{const e=t[0];return Array.prototype.slice.call(t,1).forEach(function(t){for(const n in t)e[n]=t[n]}),e},e.containingFolder=t=>{if(""===t)return"/";if(!t)throw"Path not given!";return t.replace(/\/+/g,"/").replace(/[^\/]+\/?$/,"")},e.isFolder=t=>"/"===t.slice(-1),e.isDocument=t=>!(0,e.isFolder)(t),e.baseName=t=>{const n=t.split("/");return(0,e.isFolder)(t)?n[n.length-2]+"/":n[n.length-1]},e.cleanPath=t=>t.replace(/\/+/g,"/").split("/").map(encodeURIComponent).join("/").replace(/'/g,"%27"),e.bindAll=t=>{for(const e in this)"function"==typeof t[e]&&(t[e]=t[e].bind(t))},e.equal=(t,n,r=[])=>{let i;if(typeof t!=typeof n)return!1;if("number"==typeof t||"boolean"==typeof t||"string"==typeof t)return t===n;if("function"==typeof t)return t.toString()===n.toString();if(t instanceof ArrayBuffer&&n instanceof ArrayBuffer&&(t=new Uint8Array(t),n=new Uint8Array(n)),null===t||null===n)return t===n;if(t instanceof Array){if(t.length!==n.length)return!1;for(let i=0,s=t.length;i<s;i++)if(!(0,e.equal)(t[i],n[i],r))return!1}else{for(i in t)if(t.hasOwnProperty(i)&&!(i in n))return!1;for(i in n){if(!n.hasOwnProperty(i))continue;if(!(i in t))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,e.equal)(t[i],n[i],s))return!1}}return!0},e.deepClone=t=>void 0===t?void 0:"function"==typeof structuredClone?structuredClone(t):JSON.parse(JSON.stringify(t)),e.pathsFromRoot=t=>{const e=[t],n=t.replace(/\/$/,"").split("/");for(;n.length>1;)n.pop(),e.push(n.join("/")+"/");return e},e.localStorageAvailable=()=>{const t=(0,e.getGlobalContext)();if(!("localStorage"in t))return!1;try{return t.localStorage.setItem("rs-check","1"),t.localStorage.removeItem("rs-check"),!0}catch(t){return!1}},e.getJSONFromLocalStorage=t=>{const n=(0,e.getGlobalContext)();try{return JSON.parse(n.localStorage.getItem(t))}catch(t){}},e.shouldBeTreatedAsBinary=(t,e)=>!!(e&&e.match(/charset=binary/)||/[\x00-\x08\x0E-\x1F\x80-\x9F\uFFFD]/.test(t)),e.stripLegacyCharsetBinary=t=>t?t.replace(/\s*;\s*charset=binary\b/i,""):t,e.getTextFromArrayBuffer=(t,n)=>new Promise(r=>{if("undefined"==typeof Blob||"undefined"==typeof FileReader)r(Buffer.from(t).toString(n));else{let i;const s=e.globalContext;if(s.BlobBuilder=s.BlobBuilder||s.WebKitBlobBuilder,void 0!==s.BlobBuilder){const e=new s.BlobBuilder;e.append(t),i=e.getBlob()}else i=new Blob([t]);const o=new FileReader;"function"==typeof o.addEventListener?o.addEventListener("loadend",function(t){r(t.target.result)}):o.onloadend=function(t){r(t.target.result)},o.readAsText(i,n)}}),e.toBase64=t=>{const n=(0,e.getGlobalContext)();return"btoa"in n?n.btoa(t):Buffer.from(t).toString("base64")}},600:function(t,e,n){var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,s){function o(t){try{l(r.next(t))}catch(t){s(t)}}function a(t){try{l(r.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(o,a)}l((r=r.apply(t,e||[])).next())})},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};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(t){if(super(t),this._revisionCache={},d=(0,c.localStorageAvailable)(),this.addEvents(["connected","not-connected"]),d){const t=function(){const{userAddress:t,href:e,storageApi:n,token:r,properties:i}=(0,c.getJSONFromLocalStorage)(p)||{};return{userAddress:t,href:e,storageApi:n,token:r,properties:i}}();t&&setTimeout(()=>{this.configure(t)},0)}this.connected&&setTimeout(this._emit.bind(this),0,"connected")}_request(t,e,n,i,o,h,d){return r(this,void 0,void 0,function*(){if(this.isForbiddenRequestMethod(t,e))return Promise.reject(`Don't use ${t} on directories!`);let r;return n!==s.default.IMPLIED_FAKE_TOKEN&&(i.Authorization="Bearer "+n),this.rs._emit("wire-busy",{method:t,isFolder:(0,c.isFolder)(e)}),(0,u.requestWithTimeout)(t,e,{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:t,isFolder:(0,c.isFolder)(e),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(t){return[201,204,304].indexOf(t)>=0}(n.status)||200===n.status&&"GET"!==t)return r=this.stripQuotes(n.getResponseHeader("ETag")),(0,l.default)("[WireClient] Successful request",r),Promise.resolve({statusCode:n.status,revision:r});{const t=n.getResponseHeader("Content-Type");r=h?this.stripQuotes(n.getResponseHeader("ETag")):200===n.status?d:void 0;const e=function(t){let e,n="utf-8";return t&&(e=t.match(/charset=(.+)$/),e&&(n=e[1])),n}(t);return(0,c.shouldBeTreatedAsBinary)(n.response,t)?((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)(t),revision:r})):(0,c.getTextFromArrayBuffer)(n.response,e).then(e=>((0,l.default)("[WireClient] Successful request",r),Promise.resolve({statusCode:n.status,body:e,contentType:(0,c.stripLegacyCharsetBinary)(t),revision:r})))}var i},n=>(this.online&&(this.online=!1,this.rs._emit("network-offline")),this.rs._emit("wire-done",{method:t,isFolder:(0,c.isFolder)(e),success:!1}),Promise.reject(n)))})}configure(t){if("object"!=typeof t)throw new Error("WireClient configure settings parameter should be an object");if(void 0!==t.userAddress&&(this.userAddress=t.userAddress),void 0!==t.href&&(this.href=t.href),void 0!==t.storageApi&&(this.storageApi=t.storageApi),void 0!==t.token&&(this.token=t.token),void 0!==t.properties&&(this.properties=t.properties),"string"==typeof this.storageApi){const t=f[this.storageApi]||5;this.supportsRevs=t>=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(t,e={}){if(!this.connected)return Promise.reject("not connected (path: "+t+")");const n={};return this.supportsRevs&&e.ifNoneMatch&&(n["If-None-Match"]=this.addQuotes(e.ifNoneMatch)),this._request("GET",this.href+(0,c.cleanPath)(t),this.token,n,void 0,this.supportsRevs,this._revisionCache[t]).then(e=>{if(!(0,c.isFolder)(t))return Promise.resolve(e);let n={};if(void 0!==e.body)try{e.body=JSON.parse(e.body)}catch(e){return Promise.reject("Folder description at "+this.href+(0,c.cleanPath)(t)+" is not JSON")}if(200===e.statusCode&&"object"==typeof e.body){if(0===Object.keys(e.body).length)e.statusCode=404;else if("http://remotestorage.io/spec/folder-description"===(r=e.body)["@context"]&&"object"==typeof r.items){for(const n in e.body.items)this._revisionCache[t+n]=e.body.items[n].ETag;n=e.body.items}else Object.keys(e.body).forEach(r=>{this._revisionCache[t+r]=e.body[r],n[r]={ETag:e.body[r]}});return e.body=n,Promise.resolve(e)}return Promise.resolve(e);var r})}put(t,e,n,r={}){if(!this.connected)return Promise.reject("not connected (path: "+t+")");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)(t),this.token,i,e,this.supportsRevs)}delete(t,e={}){if(!this.connected)throw new Error("not connected (path: "+t+")");e||(e={});const n={};return this.supportsRevs&&e.ifMatch&&(n["If-Match"]=this.addQuotes(e.ifMatch)),this._request("DELETE",this.href+(0,c.cleanPath)(t),this.token,n,void 0,this.supportsRevs)}static _rs_init(t){t.remote=new g(t),t.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]),t.exports=g},439:function(t,e){var n;void 0===(n=function(){var t,e,n,r;Object.keys||(Object.keys=(t=Object.prototype.hasOwnProperty,e=!{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)t.call(i,o)&&s.push(o);if(e)for(var a=0;a<r;a++)t.call(i,n[a])&&s.push(n[a]);return s})),Object.create||(Object.create=function(){function t(){}return function(e){if(1!==arguments.length)throw new Error("Object.create implementation only accepts one parameter.");return t.prototype=e,new t}}()),Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),Array.prototype.indexOf||(Array.prototype.indexOf=function(t){if(null===this)throw new TypeError;var e=Object(this),n=e.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 e&&e[i]===t)return i;return-1}),Object.isFrozen||(Object.isFrozen=function(t){for(var e="tv4_test_frozen_key";t.hasOwnProperty(e);)e+=Math.random();try{return t[e]=!0,delete t[e],!1}catch(t){return!0}});var i={"+":!0,"#":!0,".":!0,"/":!0,";":!0,"?":!0,"&":!0},s={"*":!0};function o(t){return encodeURI(t).replace(/%25[0-9][0-9]/g,function(t){return"%"+t.substring(3)})}function a(t){var e="";i[t.charAt(0)]&&(e=t.charAt(0),t=t.substring(1));var n="",r="",a=!0,l=!1,c=!1;"+"===e?a=!1:"."===e?(r=".",n="."):"/"===e?(r="/",n="/"):"#"===e?(r="#",a=!1):";"===e?(r=";",n=";",l=!0,c=!0):"?"===e?(r="?",n="&",l=!0):"&"===e&&(r="&",n="&",l=!0);for(var u=[],h=t.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(t){for(var e="",i=0,s=0;s<d.length;s++){var u=d[s],h=t(u.name);if(null==h||Array.isArray(h)&&0===h.length||"object"==typeof h&&0===Object.keys(h).length)i++;else if(e+=s===i?r:n||",",Array.isArray(h)){l&&(e+=u.name+"=");for(var p=0;p<h.length;p++)p>0&&(e+=u.suffices["*"]&&n||",",u.suffices["*"]&&l&&(e+=u.name+"=")),e+=a?encodeURIComponent(h[p]).replace(/!/g,"%21"):o(h[p])}else if("object"==typeof h){l&&!u.suffices["*"]&&(e+=u.name+"=");var f=!0;for(var g in h)f||(e+=u.suffices["*"]&&n||","),f=!1,e+=a?encodeURIComponent(g).replace(/!/g,"%21"):o(g),e+=u.suffices["*"]?"=":",",e+=a?encodeURIComponent(h[g]).replace(/!/g,"%21"):o(h[g])}else l&&(e+=u.name,c&&""===h||(e+="=")),null!=u.truncate&&(h=h.substring(0,u.truncate)),e+=a?encodeURIComponent(h).replace(/!/g,"%21"):o(h)}return e};return w.varNames=u,{prefix:r,substitution:w}}function l(t){if(!(this instanceof l))return new l(t);for(var e=t.split("{"),n=[e.shift()],r=[],i=[],s=[];e.length>0;){var o=e.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(t){for(var e=n[0],r=0;r<i.length;r++)e+=(0,i[r])(t),e+=n[r+1];return e},this.varNames=s,this.template=t}l.prototype={toString:function(){return this.template},fillFromObject:function(t){return this.fill(function(e){return t[e]})}};var c=function(t,e,n,r,i){if(this.missing=[],this.missingMap={},this.formatValidators=t?Object.create(t.formatValidators):{},this.schemas=t?Object.create(t.schemas):{},this.collectMultiple=e,this.errors=[],this.handleError=e?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={},t)for(var s in t.definedKeywords)this.definedKeywords[s]=t.definedKeywords[s].slice(0)};function u(t,e){if(t===e)return!0;if(t&&e&&"object"==typeof t&&"object"==typeof e){if(Array.isArray(t)!==Array.isArray(e))return!1;if(Array.isArray(t)){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!u(t[n],e[n]))return!1}else{var r;for(r in t)if(void 0===e[r]&&void 0!==t[r])return!1;for(r in e)if(void 0===t[r]&&void 0!==e[r])return!1;for(r in t)if(!u(t[r],e[r]))return!1}return!0}return!1}c.prototype.defineKeyword=function(t,e){this.definedKeywords[t]=this.definedKeywords[t]||[],this.definedKeywords[t].push(e)},c.prototype.createError=function(t,e,n,r,i,s,o){var a=new x(t,e,n,r,i);return a.message=this.errorReporter(a,s,o),a},c.prototype.returnError=function(t){return t},c.prototype.collectError=function(t){return t&&this.errors.push(t),null},c.prototype.prefixErrors=function(t,e,n){for(var r=t;r<this.errors.length;r++)this.errors[r]=this.errors[r].prefixWith(e,n);return this},c.prototype.banUnknownProperties=function(t,e){for(var n in this.unknownPropertyPaths){var r=this.createError(v.UNKNOWN_PROPERTY,{path:n},n,"",null,t,e),i=this.handleError(r);if(i)return i}return null},c.prototype.addFormat=function(t,e){if("object"==typeof t){for(var n in t)this.addFormat(n,t[n]);return this}this.formatValidators[t]=e},c.prototype.resolveRefs=function(t,e){if(void 0!==t.$ref){if((e=e||{})[t.$ref])return this.createError(v.CIRCULAR_REFERENCE,{urls:Object.keys(e).join(", ")},"","",null,void 0,t);e[t.$ref]=!0,t=this.getSchema(t.$ref,e)}return t},c.prototype.getSchema=function(t,e){var n;if(void 0!==this.schemas[t])return n=this.schemas[t],this.resolveRefs(n,e);var r=t,i="";if(-1!==t.indexOf("#")&&(i=t.substring(t.indexOf("#")+1),r=t.substring(0,t.indexOf("#"))),"object"==typeof this.schemas[r]){n=this.schemas[r];var s=decodeURIComponent(i);if(""===s)return this.resolveRefs(n,e);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,e)}void 0===this.missing[r]&&(this.missing.push(r),this.missing[r]=r,this.missingMap[r]=r)},c.prototype.searchSchemas=function(t,e){if(Array.isArray(t))for(var n=0;n<t.length;n++)this.searchSchemas(t[n],e);else if(t&&"object"==typeof t)for(var r in"string"==typeof t.id&&function(t,e){if(e.substring(0,t.length)===t){var n=e.substring(t.length);if(e.length>0&&"/"===e.charAt(t.length-1)||"#"===n.charAt(0)||"?"===n.charAt(0))return!0}return!1}(e,t.id)&&void 0===this.schemas[t.id]&&(this.schemas[t.id]=t),t)if("enum"!==r)if("object"==typeof t[r])this.searchSchemas(t[r],e);else if("$ref"===r){var i=g(t[r]);i&&void 0===this.schemas[i]&&void 0===this.missingMap[i]&&(this.missingMap[i]=i)}},c.prototype.addSchema=function(t,e){if("string"!=typeof t||void 0===e){if("object"!=typeof t||"string"!=typeof t.id)return;t=(e=t).id}t===g(t)+"#"&&(t=g(t)),this.schemas[t]=e,delete this.missingMap[t],m(e,t),this.searchSchemas(e,t)},c.prototype.getSchemaMap=function(){var t={};for(var e in this.schemas)t[e]=this.schemas[e];return t},c.prototype.getSchemaUris=function(t){var e=[];for(var n in this.schemas)t&&!t.test(n)||e.push(n);return e},c.prototype.getMissingUris=function(t){var e=[];for(var n in this.missingMap)t&&!t.test(n)||e.push(n);return e},c.prototype.dropSchemas=function(){this.schemas={},this.reset()},c.prototype.reset=function(){this.missing=[],this.missingMap={},this.errors=[]},c.prototype.validateAll=function(t,e,n,r,i){var s;if(!(e=this.resolveRefs(e)))return null;if(e instanceof x)return this.errors.push(e),e;var o,a=this.errors.length,l=null,c=null;if(this.checkRecursive&&t&&"object"==typeof t){if(s=!this.scanned.length,t[this.validatedSchemasKey]){var u=t[this.validatedSchemasKey].indexOf(e);if(-1!==u)return this.errors=this.errors.concat(t[this.validationErrorsKey][u]),null}if(Object.isFrozen(t)&&-1!==(o=this.scannedFrozen.indexOf(t))){var h=this.scannedFrozenSchemas[o].indexOf(e);if(-1!==h)return this.errors=this.errors.concat(this.scannedFrozenValidationErrors[o][h]),null}if(this.scanned.push(t),Object.isFrozen(t))-1===o&&(o=this.scannedFrozen.length,this.scannedFrozen.push(t),this.scannedFrozenSchemas.push([])),l=this.scannedFrozenSchemas[o].length,this.scannedFrozenSchemas[o][l]=e,this.scannedFrozenValidationErrors[o][l]=[];else{if(!t[this.validatedSchemasKey])try{Object.defineProperty(t,this.validatedSchemasKey,{value:[],configurable:!0}),Object.defineProperty(t,this.validationErrorsKey,{value:[],configurable:!0})}catch(e){t[this.validatedSchemasKey]=[],t[this.validationErrorsKey]=[]}c=t[this.validatedSchemasKey].length,t[this.validatedSchemasKey][c]=e,t[this.validationErrorsKey][c]=[]}}var d=this.errors.length,p=this.validateBasic(t,e,i)||this.validateNumeric(t,e,i)||this.validateString(t,e,i)||this.validateArray(t,e,i)||this.validateObject(t,e,i)||this.validateCombinations(t,e,i)||this.validateHypermedia(t,e,i)||this.validateFormat(t,e,i)||this.validateDefinedKeywords(t,e,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&&(t[this.validationErrorsKey][c]=this.errors.slice(a)),this.handleError(p)},c.prototype.validateFormat=function(t,e){if("string"!=typeof e.format||!this.formatValidators[e.format])return null;var n=this.formatValidators[e.format].call(null,t,e);return"string"==typeof n||"number"==typeof n?this.createError(v.FORMAT_CUSTOM,{message:n},"","/format",null,t,e):n&&"object"==typeof n?this.createError(v.FORMAT_CUSTOM,{message:n.message||"?"},n.dataPath||"",n.schemaPath||"/format",null,t,e):null},c.prototype.validateDefinedKeywords=function(t,e,n){for(var r in this.definedKeywords)if(void 0!==e[r])for(var i=this.definedKeywords[r],s=0;s<i.length;s++){var o=(0,i[s])(t,e[r],e,n);if("string"==typeof o||"number"==typeof o)return this.createError(v.KEYWORD_CUSTOM,{key:r,message:o},"","",null,t,e).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,t,e)}}return null},c.prototype.validateBasic=function(t,e,n){var r;return(r=this.validateType(t,e,n))||(r=this.validateEnum(t,e,n))?r.prefixWith(null,"type"):null},c.prototype.validateType=function(t,e){if(void 0===e.type)return null;var n=typeof t;null===t?n="null":Array.isArray(t)&&(n="array");var r=e.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&&t%1==0)return null}return this.createError(v.INVALID_TYPE,{type:n,expected:r.join("/")},"","",null,t,e)},c.prototype.validateEnum=function(t,e){if(void 0===e.enum)return null;for(var n=0;n<e.enum.length;n++)if(u(t,e.enum[n]))return null;return this.createError(v.ENUM_MISMATCH,{value:"undefined"!=typeof JSON?JSON.stringify(t):t},"","",null,t,e)},c.prototype.validateNumeric=function(t,e,n){return this.validateMultipleOf(t,e,n)||this.validateMinMax(t,e,n)||this.validateNaN(t,e,n)||null};var h=Math.pow(2,-51),d=1-h;function p(t){var e=String(t).replace(/^\s+|\s+$/g,"").match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);return e?{href:e[0]||"",protocol:e[1]||"",authority:e[2]||"",host:e[3]||"",hostname:e[4]||"",port:e[5]||"",pathname:e[6]||"",search:e[7]||"",hash:e[8]||""}:null}function f(t,e){return e=p(e||""),t=p(t||""),e&&t?(e.protocol||t.protocol)+(e.protocol||e.authority?e.authority:t.authority)+(n=e.protocol||e.authority||"/"===e.pathname.charAt(0)?e.pathname:e.pathname?(t.authority&&!t.pathname?"/":"")+t.pathname.slice(0,t.pathname.lastIndexOf("/")+1)+e.pathname:t.pathname,r=[],n.replace(/^(\.\.?(\/|$))+/,"").replace(/\/(\.(\/|$))+/g,"/").replace(/\/\.\.$/,"/../").replace(/\/?[^\/]*/g,function(t){"/.."===t?r.pop():r.push(t)}),r.join("").replace(/^\//,"/"===n.charAt(0)?"/":""))+(e.protocol||e.authority||e.pathname?e.search:e.search||t.search)+e.hash:null;var n,r}function g(t){return t.split("#")[0]}function m(t,e){if(t&&"object"==typeof t)if(void 0===e?e=t.id:"string"==typeof t.id&&(e=f(e,t.id),t.id=e),Array.isArray(t))for(var n=0;n<t.length;n++)m(t[n],e);else for(var r in"string"==typeof t.$ref&&(t.$ref=f(e,t.$ref)),t)"enum"!==r&&m(t[r],e)}function y(t){var e=C[t=t||"en"];return function(t){var n=e[t.code]||_[t.code];if("string"!=typeof n)return"Unknown error code "+t.code+": "+JSON.stringify(t.messageParams);var r=t.params;return n.replace(/\{([^{}]*)\}/g,function(t,e){var n=r[e];return"string"==typeof n||"number"==typeof n?n:t})}}c.prototype.validateMultipleOf=function(t,e){var n=e.multipleOf||e.divisibleBy;if(void 0===n)return null;if("number"==typeof t){var r=t/n%1;if(r>=h&&r<d)return this.createError(v.NUMBER_MULTIPLE_OF,{value:t,multipleOf:n},"","",null,t,e)}return null},c.prototype.validateMinMax=function(t,e){if("number"!=typeof t)return null;if(void 0!==e.minimum){if(t<e.minimum)return this.createError(v.NUMBER_MINIMUM,{value:t,minimum:e.minimum},"","/minimum",null,t,e);if(e.exclusiveMinimum&&t===e.minimum)return this.createError(v.NUMBER_MINIMUM_EXCLUSIVE,{value:t,minimum:e.minimum},"","/exclusiveMinimum",null,t,e)}if(void 0!==e.maximum){if(t>e.maximum)return this.createError(v.NUMBER_MAXIMUM,{value:t,maximum:e.maximum},"","/maximum",null,t,e);if(e.exclusiveMaximum&&t===e.maximum)return this.createError(v.NUMBER_MAXIMUM_EXCLUSIVE,{value:t,maximum:e.maximum},"","/exclusiveMaximum",null,t,e)}return null},c.prototype.validateNaN=function(t,e){return"number"!=typeof t?null:!0===isNaN(t)||t===1/0||t===-1/0?this.createError(v.NUMBER_NOT_A_NUMBER,{value:t},"","/type",null,t,e):null},c.prototype.validateString=function(t,e,n){return this.validateStringLength(t,e,n)||this.validateStringPattern(t,e,n)||null},c.prototype.validateStringLength=function(t,e){return"string"!=typeof t?null:void 0!==e.minLength&&t.length<e.minLength?this.createError(v.STRING_LENGTH_SHORT,{length:t.length,minimum:e.minLength},"","/minLength",null,t,e):void 0!==e.maxLength&&t.length>e.maxLength?this.createError(v.STRING_LENGTH_LONG,{length:t.length,maximum:e.maxLength},"","/maxLength",null,t,e):null},c.prototype.validateStringPattern=function(t,e){if("string"!=typeof t||"string"!=typeof e.pattern&&!(e.pattern instanceof RegExp))return null;var n;if(e.pattern instanceof RegExp)n=e.pattern;else{var r,i="",s=e.pattern.match(/^\/(.+)\/([img]*)$/);s?(r=s[1],i=s[2]):r=e.pattern,n=new RegExp(r,i)}return n.test(t)?null:this.createError(v.STRING_PATTERN,{pattern:e.pattern},"","/pattern",null,t,e)},c.prototype.validateArray=function(t,e,n){return Array.isArray(t)&&(this.validateArrayLength(t,e,n)||this.validateArrayUniqueItems(t,e,n)||this.validateArrayItems(t,e,n))||null},c.prototype.validateArrayLength=function(t,e){var n;return void 0!==e.minItems&&t.length<e.minItems&&(n=this.createError(v.ARRAY_LENGTH_SHORT,{length:t.length,minimum:e.minItems},"","/minItems",null,t,e),this.handleError(n))||void 0!==e.maxItems&&t.length>e.maxItems&&(n=this.createError(v.ARRAY_LENGTH_LONG,{length:t.length,maximum:e.maxItems},"","/maxItems",null,t,e),this.handleError(n))?n:null},c.prototype.validateArrayUniqueItems=function(t,e){if(e.uniqueItems)for(var n=0;n<t.length;n++)for(var r=n+1;r<t.length;r++)if(u(t[n],t[r])){var i=this.createError(v.ARRAY_UNIQUE,{match1:n,match2:r},"","/uniqueItems",null,t,e);if(this.handleError(i))return i}return null},c.prototype.validateArrayItems=function(t,e,n){if(void 0===e.items)return null;var r,i;if(Array.isArray(e.items)){for(i=0;i<t.length;i++)if(i<e.items.length){if(r=this.validateAll(t[i],e.items[i],[i],["items",i],n+"/"+i))return r}else if(void 0!==e.additionalItems)if("boolean"==typeof e.additionalItems){if(!e.additionalItems&&(r=this.createError(v.ARRAY_ADDITIONAL_ITEMS,{},"/"+i,"/additionalItems",null,t,e),this.handleError(r)))return r}else if(r=this.validateAll(t[i],e.additionalItems,[i],["additionalItems"],n+"/"+i))return r}else for(i=0;i<t.length;i++)if(r=this.validateAll(t[i],e.items,[i],["items"],n+"/"+i))return r;return null},c.prototype.validateObject=function(t,e,n){return"object"!=typeof t||null===t||Array.isArray(t)?null:this.validateObjectMinMaxProperties(t,e,n)||this.validateObjectRequiredProperties(t,e,n)||this.validateObjectProperties(t,e,n)||this.validateObjectDependencies(t,e,n)||null},c.prototype.validateObjectMinMaxProperties=function(t,e){var n,r=Object.keys(t);return void 0!==e.minProperties&&r.length<e.minProperties&&(n=this.createError(v.OBJECT_PROPERTIES_MINIMUM,{propertyCount:r.length,minimum:e.minProperties},"","/minProperties",null,t,e),this.handleError(n))||void 0!==e.maxProperties&&r.length>e.maxProperties&&(n=this.createError(v.OBJECT_PROPERTIES_MAXIMUM,{propertyCount:r.length,maximum:e.maxProperties},"","/maxProperties",null,t,e),this.handleError(n))?n:null},c.prototype.validateObjectRequiredProperties=function(t,e){if(void 0!==e.required)for(var n=0;n<e.required.length;n++){var r=e.required[n];if(void 0===t[r]){var i=this.createError(v.OBJECT_REQUIRED,{key:r},"","/required/"+n,null,t,e);if(this.handleError(i))return i}}return null},c.prototype.validateObjectProperties=function(t,e,n){var r;for(var i in t){var s=n+"/"+i.replace(/~/g,"~0").replace(/\//g,"~1"),o=!1;if(void 0!==e.properties&&void 0!==e.properties[i]&&(o=!0,r=this.validateAll(t[i],e.properties[i],[i],["properties",i],s)))return r;if(void 0!==e.patternProperties)for(var a in e.patternProperties)if(new RegExp(a).test(i)&&(o=!0,r=this.validateAll(t[i],e.patternProperties[a],[i],["patternProperties",a],s)))return r;if(o)this.trackUnknownProperties&&(this.knownPropertyPaths[s]=!0,delete this.unknownPropertyPaths[s]);else if(void 0!==e.additionalProperties){if(this.trackUnknownProperties&&(this.knownPropertyPaths[s]=!0,delete this.unknownPropertyPaths[s]),"boolean"==typeof e.additionalProperties){if(!e.additionalProperties&&(r=this.createError(v.OBJECT_ADDITIONAL_PROPERTIES,{key:i},"","/additionalProperties",null,t,e).prefixWith(i,null),this.handleError(r)))return r}else if(r=this.validateAll(t[i],e.additionalProperties,[i],["additionalProperties"],s))return r}else this.trackUnknownProperties&&!this.knownPropertyPaths[s]&&(this.unknownPropertyPaths[s]=!0)}return null},c.prototype.validateObjectDependencies=function(t,e,n){var r;if(void 0!==e.dependencies)for(var i in e.dependencies)if(void 0!==t[i]){var s=e.dependencies[i];if("string"==typeof s){if(void 0===t[s]&&(r=this.createError(v.OBJECT_DEPENDENCY_KEY,{key:i,missing:s},"","",null,t,e).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===t[a]&&(r=this.createError(v.OBJECT_DEPENDENCY_KEY,{key:i,missing:a},"","/"+o,null,t,e).prefixWith(null,i).prefixWith(null,"dependencies"),this.handleError(r)))return r}else if(r=this.validateAll(t,s,[],["dependencies",i],n))return r}return null},c.prototype.validateCombinations=function(t,e,n){return this.validateAllOf(t,e,n)||this.validateAnyOf(t,e,n)||this.validateOneOf(t,e,n)||this.validateNot(t,e,n)||null},c.prototype.validateAllOf=function(t,e,n){if(void 0===e.allOf)return null;for(var r,i=0;i<e.allOf.length;i++){var s=e.allOf[i];if(r=this.validateAll(t,s,[],["allOf",i],n))return r}return null},c.prototype.validateAnyOf=function(t,e,n){if(void 0===e.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<e.anyOf.length;l++){this.trackUnknownProperties&&(this.unknownPropertyPaths={},this.knownPropertyPaths={});var c=e.anyOf[l],u=this.errors.length,h=this.validateAll(t,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,t,e)):void 0},c.prototype.validateOneOf=function(t,e,n){if(void 0===e.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<e.oneOf.length;l++){this.trackUnknownProperties&&(this.unknownPropertyPaths={},this.knownPropertyPaths={});var c=e.oneOf[l],u=this.errors.length,h=this.validateAll(t,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,t,e);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,t,e)):(this.errors=this.errors.slice(0,a),null)},c.prototype.validateNot=function(t,e,n){if(void 0===e.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(t,e.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,t,e):null},c.prototype.validateHypermedia=function(t,e,n){if(!e.links)return null;for(var r,i=0;i<e.links.length;i++){var s=e.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 t)){a=!1;break}if(a){var u={$ref:o.fillFromObject(t)};if(r=this.validateAll(t,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(t,e,n,r,i){if(Error.call(this),void 0===t)throw new Error("No error code supplied: "+r);this.message="",this.params=e,this.code=t,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(t,e){if(null!==t&&(t=t.replace(/~/g,"~0").replace(/\//g,"~1"),this.dataPath="/"+t+this.dataPath),null!==e&&(e=e.replace(/~/g,"~0").replace(/\//g,"~1"),this.schemaPath="/"+e+this.schemaPath),null!==this.subErrors)for(var n=0;n<this.subErrors.length;n++)this.subErrors[n].prefixWith(t,e);return this};var C={},S=function t(e){var n,r,i=new c,s={setErrorReporter:function(t){return"string"==typeof t?this.language(t):(r=t,!0)},addFormat:function(){i.addFormat.apply(i,arguments)},language:function(t){return t?(C[t]||(t=t.split("-")[0]),!!C[t]&&(n=t,t)):n},addLanguage:function(t,e){var n;for(n in v)e[n]&&!e[v[n]]&&(e[v[n]]=e[n]);var r=t.split("-")[0];if(C[r])for(n in C[t]=Object.create(C[r]),e)void 0===C[r][n]&&(C[r][n]=e[n]),C[t][n]=e[n];else C[t]=e,C[r]=e;return this},freshApi:function(e){var n=t();return e&&n.language(e),n},validate:function(t,e,s,o){var a=y(n),l=new c(i,!1,r?function(t,e,n){return r(t,e,n)||a(t,e,n)}:a,s,o);"string"==typeof e&&(e={$ref:e}),l.addSchema("",e);var u=l.validateAll(t,e,null,null,"");return!u&&o&&(u=l.banUnknownProperties(t,e)),this.error=u,this.missing=l.missing,this.valid=null===u,this.valid},validateResult:function(){var t={toString:function(){return this.valid?"valid":this.error.message}};return this.validate.apply(t,arguments),t},validateMultiple:function(t,e,s,o){var a=y(n),l=new c(i,!0,r?function(t,e,n){return r(t,e,n)||a(t,e,n)}:a,s,o);"string"==typeof e&&(e={$ref:e}),l.addSchema("",e),l.validateAll(t,e,null,null,""),o&&l.banUnknownProperties(t,e);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(t,e,n){if("string"!=typeof t||!/^[A-Z]+(_[A-Z]+)*$/.test(t))throw new Error("Code name must be a string in UPPER_CASE_WITH_UNDERSCORES");if("number"!=typeof e||e%1!=0||e<1e4)throw new Error("Code number must be an integer > 10000");if(void 0!==v[t])throw new Error("Error already defined: "+t+" as "+v[t]);if(void 0!==b[e])throw new Error("Error code already used: "+b[e]+" as "+e);for(var r in v[t]=e,b[e]=t,_[t]=_[e]=n,C){var i=C[r];i[t]&&(i[e]=i[e]||i[t])}},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(e||"en"),s}();return S.addLanguage("en-gb",_),S.tv4=S,S}.apply(e,[]))||(t.exports=n)},713:function(t){!function(){{const e=function(){var t={"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"},e={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(t){const e=t.match(s);return e?e.slice(1).map(Number):null}function h(t){const[e,n]=t;return 0===e||10===e||127===e||172===e&&n>=16&&n<=31||192===e&&168===n||169===e&&254===n||e>=224&&e<=239||e>=240}class d extends Error{status;constructor(t,e){super(t),this.name="WebFingerError",this.status=e}}class p{static default;config;constructor(t={}){this.config={tls_only:void 0===t.tls_only||t.tls_only,uri_fallback:void 0!==t.uri_fallback&&t.uri_fallback,request_timeout:void 0!==t.request_timeout?t.request_timeout:1e4,allow_private_addresses:void 0!==t.allow_private_addresses&&t.allow_private_addresses}}async fetchJRD(t,e=0){if(e>3)throw new d("too many redirects");const n=new AbortController,r=setTimeout(()=>{n.abort()},this.config.request_timeout);try{const i=await fetch(t,{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,t)}catch{throw new d("invalid redirect URL")}try{await this.resolveAndValidateHost(s.host)}catch(t){if(t instanceof d)throw new d("redirect to private or internal address blocked");throw t}return clearTimeout(r),this.fetchJRD(s.toString(),e+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(t){if(n.signal.aborted)throw new d("request timed out");throw t}finally{clearTimeout(r)}}static isValidJSON(t){try{JSON.parse(t)}catch{return!1}return!0}static isLocalhost(t){return o.test(t)}static isPrivateAddress(t){let e=t;if(e.startsWith("[")&&e.includes("]:"))e=e.substring(1,e.lastIndexOf("]:"));else if(e.startsWith("[")&&e.endsWith("]"))e=e.substring(1,e.length-1);else if(e.includes(":")&&1===(e.match(/:/g)||[]).length){const t=e.split(":"),n=t[0],r=t[1];if(r&&!a.test(r))throw new d("invalid host format");(n.match(i)||n.match(l))&&(e=n)}if("localhost"===e||"127.0.0.1"===e||e.match(c)||"::1"===e||"localhost.localdomain"===e)return!0;const n=u(e);if(n)return h(n);const r=function(t){let e=t.toLowerCase();const n=u(e.substring(e.lastIndexOf(":")+1));if(n&&(e=`${e.substring(0,e.lastIndexOf(":"))}:${(n[0]<<8|n[1]).toString(16)}:${(n[2]<<8|n[3]).toString(16)}`),!/^[0-9a-f:]+$/.test(e)||e.indexOf("::")!==e.lastIndexOf("::"))return null;const r=e.includes("::"),[i="",s=""]=e.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(t=>Number.parseInt(t,16));return 8===c.length&&c.every(t=>t>=0&&t<=65535)?c:null}(e);if(r){const t=r.slice(0,5).every(t=>0===t)&&65535===r[5],e=r.slice(0,6).every(t=>0===t);if(t||e)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(t){if(t.startsWith("[")){const e=t.lastIndexOf("]:");if(-1!==e){const n=t.substring(e+2);if(!a.test(n))throw new d("invalid host format");return n}return}if(1===(t.match(/:/g)||[]).length){const[,e=""]=t.split(":");if(!e||!a.test(e))throw new d("invalid host format");return e}}static parseAddress(t){const e=t.replace(/ /g,"");if(e.includes("://")){let t;try{t=new URL(e)}catch{throw new d("invalid URI format")}if(!t.hostname)throw new d("could not determine host from address");return{host:t.host}}const n=e.split("@");if(2!==n.length||!n[1])throw new d("invalid useraddress format");return{host:n[1]}}async resolveAndValidateHost(t){const e=p.normalizeHost(t);if(!this.config.allow_private_addresses){if(p.isPrivateAddress(e.host))throw new d("private or internal addresses are not allowed");await this.validateDNSResolution(e.hostname)}return e}static normalizeHost(t){const e=t.split("/")[0];if(!e||0===e.length)throw new d("invalid host format");if(/[?# @]/.test(e))throw new d("invalid characters in host");const n=p.getExplicitPort(e);let r;try{r=new URL(`http://${e}`)}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(e))}};(Array.isArray(i.links)?i.links:[]).map(function(e){if(Object.prototype.hasOwnProperty.call(t,String(e.rel))){const n=t[String(e.rel)];if(s.idx.links[n]){const t={href:String(e.href||""),rel:String(e.rel||"")};Object.keys(e).map(function(n){"object"==typeof e[n]&&null!==e[n]?t[n]=e[n]:t[n]=String(e[n])}),s.idx.links[n].push(t)}}});const o=i.properties||{};for(const t in o)Object.prototype.hasOwnProperty.call(o,t)&&"http://packetizer.com/ns/name"===t&&(s.idx.properties.name=o[t]);return s}async validateDNSResolution(t){if(!t.match(i)&&!t.includes(":")&&"localhost"!==t&&"undefined"!=typeof process&&process.versions?.node){const e="function"==typeof process.getBuiltinModule?process.getBuiltinModule("node:dns")?.promises:null;if(e)try{const[n,r]=await Promise.allSettled([e.resolve4(t).catch(()=>[]),e.resolve6(t).catch(()=>[])]),i="fulfilled"===n.status?n.value:[],s="fulfilled"===r.status?r.value:[];for(const e of[...i,...s])if(p.isPrivateAddress(e))throw new d(`hostname ${t} resolves to private address ${e}`)}catch(t){if(t instanceof d)throw t}}}async lookup(t){if(!t)throw new d("address is required");const{host:e}=p.parseAddress(t),{host:r}=await this.resolveAndValidateHost(e);let i=0,s="https";p.isLocalhost(r)&&(s="http");const o=async t=>{if(this.config.uri_fallback&&i!==n.length-1)return i+=1,a();if(this.config.tls_only||"https"!==s)throw t instanceof Error?t:new d(String(t));return i=0,s="http",a()},a=async()=>{const e=(()=>{let e="";return t.split("://")[1]||(e="acct:"),s+"://"+r+"/.well-known/"+n[i]+"?resource="+e+t})();try{const t=await this.fetchJRD(e);return p.processJRD(e,t)}catch(t){return await o(t)}};return a()}async lookupLink(t,n){if(Object.prototype.hasOwnProperty.call(e,n)){const e=(await this.lookup(t)).idx.links[n];return 0===e.length?Promise.reject('no links found with rel="'+n+'"'):Promise.resolve(e[0])}return Promise.reject("unsupported rel "+n)}}return p.default=p,p}();t.exports=e,t.exports.default=e}}("undefined"!=typeof self&&self)}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var s=e[r]={exports:{}};return t[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(t){if("object"==typeof window)return window}}(),n(423).default}()},"object"==typeof t&&"object"==typeof e?e.exports=r():"function"==typeof define&&define.amd?define("RemoteStorage",[],r):"object"==typeof t?t.RemoteStorage=r():n.RemoteStorage=r()}),qB=c($B(),1),VB="0123456789ABCDEFGHJKMNPQRSTVWXYZ";!function(t){t.Base32IncorrectEncoding="B32_ENC_INVALID",t.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",t.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",t.EncodeTimeNegative="ENC_TIME_NEG",t.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",t.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",t.PRNGDetectFailure="PRNG_DETECT",t.ULIDInvalid="ULID_INVALID",t.Unexpected="UNEXPECTED",t.UUIDInvalid="UUID_INVALID"}(OB||(OB={}));var WB=class extends Error{constructor(t,e){super(`${e} (${t})`),this.name="ULIDError",this.code=t}};function HB(t){const e=Math.floor(32*t())%32;return VB.charAt(e)}var GB={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"]},ZB={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"]},KB={name:"places",builder:function(t){function e(t,e){return`${t.substring(0,2)}/${t.substring(2,4)}/${e}`}t.declareType("place",GB),t.declareType("list",ZB);const n={async getAll(){const e=await t.getAll("_lists/");return e?Object.values(e):[]},async get(e){const n=`_lists/${e}`;return t.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=e(n.geohash,n.id);return await t.getObject(r)});return(await Promise.all(i)).filter(t=>!!t)},async create(e,n,r){const i=`_lists/${e}`;let s=await t.getObject(i);const o=(new Date).toISOString();return s?(s.title=n,r&&(s.color=r),s.updatedAt=o):s={id:e,title:n,color:r,placeRefs:[],createdAt:o,updatedAt:o},await t.storeObject("list",i,s),s},async delete(e){await t.remove(`_lists/${e}`)},async addPlace(e,n,r){const i=`_lists/${e}`,s=await t.getObject(i);if(!s)throw new Error(`List not found: ${e}`);return-1===s.placeRefs.findIndex(t=>t.id===n)&&(s.placeRefs.push({id:n,geohash:r}),s.updatedAt=(new Date).toISOString(),await t.storeObject("list",i,s)),s},async removePlace(e,n){const r=`_lists/${e}`,i=await t.getObject(r);if(!i)throw new Error(`List not found: ${e}`);const s=i.placeRefs.findIndex(t=>t.id===n);return-1!==s&&(i.placeRefs.splice(s,1),i.updatedAt=(new Date).toISOString(),await t.storeObject("list",r,i)),i},async initDefaults(){for(const t of[{id:"to-go",title:"Want to go",color:"#2e9e4f"},{id:"to-do",title:"To do",color:"#2a7fff"}])await this.get(t.id)||await this.create(t.id,t.title,t.color)}};return{exports:{lists:n,store:async function(n){const r=function(t){const e=(new Date).toISOString(),n=t.id||function(t,e){const n=e||function(){const t="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:null,e=t&&(t.crypto||t.msCrypto)||null;if("function"==typeof e?.getRandomValues)return()=>{const t=new Uint8Array(1);return e.getRandomValues(t),t[0]/256};if("function"==typeof e?.randomBytes)return()=>e.randomBytes(1).readUInt8()/256;throw new WB(OB.PRNGDetectFailure,"Failed to find a reliable PRNG")}();return function(t,e=10){if(isNaN(t))throw new WB(OB.EncodeTimeValueMalformed,`Time must be a number: ${t}`);if(t>0xffffffffffff)throw new WB(OB.EncodeTimeSizeExceeded,`Cannot encode a time larger than 281474976710655: ${t}`);if(t<0)throw new WB(OB.EncodeTimeNegative,`Time must be positive: ${t}`);if(!1===Number.isInteger(t))throw new WB(OB.EncodeTimeValueMalformed,`Time must be an integer: ${t}`);let n,r="";for(let i=e;i>0;i--)n=t%32,r=VB.charAt(n)+r,t=(t-n)/32;return r}(!t||isNaN(t)?Date.now():t,10)+function(t,e){let n="";for(;t>0;t--)n=HB(e)+n;return n}(16,n)}(),r="number"==typeof t.lat?t.lat:0,i="number"==typeof t.lon?t.lon:0,s=t.title||"Untitled Place",o=t.geohash||mU.encode(r,i,10),a={...t,id:n,lat:r,lon:i,geohash:o,title:s,tags:t.tags||[],createdAt:t.createdAt||e,updatedAt:t.id?e:void 0};return Object.keys(a).forEach(t=>{void 0===a[t]&&delete a[t]}),a}(n),i=e(r.geohash,r.id);return await t.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 e=>{const n=e.placeRefs.findIndex(t=>t.id===r);-1!==n&&(e.placeRefs.splice(n,1),e.updatedAt=(new Date).toISOString(),await t.storeObject("list",`_lists/${e.id}`,e))}));const o=e(i,r);return t.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=e(r,n);return t.getObject(i)},listByPrefix:async function(e){let n="";return e.length>=2&&(n+=e.substring(0,2)+"/"),e.length>=4&&(n+=e.substring(2,4)+"/"),t.getAll(n)},getPlaces:async function(e){const n=[],r=async e=>{const r=await t.getAll(e,!1);r&&Object.values(r).forEach(t=>{t&&"object"==typeof t&&!t.toString().endsWith("/")&&n.push(t)})};if(e&&e.length>0){const t=e.map(async t=>{if(t.length<4)return;const e=t.substring(0,2),n=t.substring(2,4);await r(`${e}/${n}/`)});await Promise.all(t)}else{const e=t=>{if(!t||"object"!=typeof t)return[];let e=t;return t.items&&"object"==typeof t.items&&(e=t.items),Object.keys(e).filter(t=>t.endsWith("/")&&!t.startsWith("@"))},n=e(await t.getListing("",!1));await Promise.all(n.map(async n=>{const i=await t.getListing(n,!1),s=e(i);await Promise.all(s.map(async t=>{await r(n+t)}))}))}return n}}}}},YB=o((t,e)=>{var n,r;n=self,r=()=>(()=>{var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function r(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}t.d(e,{default:()=>i});const i=function(){return t=function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.rs=e,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},e=[{key:"log",value:function(){if(this.logging){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];(t=console).debug.apply(t,["[RS-WIDGET] "].concat(n))}}},{key:"eventHandler",value:function(t,e){var n=this;switch(this.log("EVENT: ",t),t){case"ready":this.setState(this.state);break;case"sync-started":case"sync-req-done":this.handleSyncStarted();break;case"sync-done":if(this.online&&(null==e||!e.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(t){return n.eventHandler("sync-req-done",t)}),this.rs.on("sync-done",function(t){return n.eventHandler("sync-done",t)})):(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==e?void 0:e.name)?this.handleDiscoveryError(e):"SyncError"===(null==e?void 0:e.name)?this.handleSyncError(e):"Unauthorized"===(null==e?void 0:e.name)?this.handleUnauthorized(e):console.debug('Encountered unhandled error: "'.concat(e,'"'))}}},{key:"setState",value:function(t){if(t){this.log("Setting state ",t);var e=this.parentContainerEl.querySelector(".rs-box.rs-selected");e&&(e.classList.remove("rs-selected"),e.setAttribute("aria-hidden","true"));var n=this.parentContainerEl.querySelector(".rs-box.rs-box-"+t);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(t||this.state)),this.state=t}}},{key:"setInitialState",value:function(){this.skipInitial?this.showChooseOrSignIn():this.setState("initial")}},{key:"createHtmlTemplate",value:function(){var t=document.createElement("div");t.id="remotestorage-widget",t.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 e=document.createElement("style");return e.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',t.appendChild(e),t}},{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 t=this;this.rs.on("connected",function(){return t.eventHandler("connected")}),this.rs.on("ready",function(){return t.eventHandler("ready")}),this.rs.on("disconnected",function(){return t.eventHandler("disconnected")}),this.rs.on("network-online",function(){return t.eventHandler("network-online")}),this.rs.on("network-offline",function(){return t.eventHandler("network-offline")}),this.rs.on("error",function(e){return t.eventHandler("error",e)}),this.setEventListeners(),this.setClickHandlers()}},{key:"attach",value:function(t){var e=this.createHtmlTemplate(t);if(this.parentContainerEl,t instanceof HTMLElement)this.parentContainerEl=t;else if("string"==typeof t){if(this.parentContainerEl=document.getElementById(t),!this.parentContainerEl)throw new Error('Failed to find target DOM element with id="'+t+'"')}else{if(t)throw new Error("Unknown element type. Expected instance of HTMLElement or type of string.");this.parentContainerEl=document.body}this.parentContainerEl.appendChild(e),this.setupElements(),this.setupHandlers(),this.setInitialState(),this.setModalClass()}},{key:"setEventListeners",value:function(){var t=this;this.rsSignInForm.addEventListener("submit",function(e){e.preventDefault();var n=t.parentContainerEl.querySelector("input[name=rs-user-address]").value.trim();t.disableConnectButton(),t.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 t=this;this.rsInitial.addEventListener("click",function(){return t.showChooseOrSignIn()}),this.rsChooseRemoteStorageButton.addEventListener("click",function(){t.setState("sign-in"),t.rsAddressInput.focus()}),this.rsChooseDropboxButton.addEventListener("click",function(){return t.rs.dropbox.connect()}),this.rsChooseGoogleDriveButton.addEventListener("click",function(){return t.rs.googledrive.connect()}),this.rsDisconnectButton.addEventListener("click",function(){return t.rs.disconnect()}),this.rsErrorReconnectLink.addEventListener("click",function(){return t.rs.reconnect()}),this.rsErrorDisconnectButton.addEventListener("click",function(){return t.rs.disconnect()}),this.rs.hasFeature("Sync")&&this.rsSyncButton.addEventListener("click",function(){t.rsSyncButton.classList.contains("rs-rotate")?(t.rs.stopSync(),t.rsSyncButton.classList.remove("rs-rotate")):(t.rsConnectedLabel.textContent="Synchronizing",t.rs.startSync(),t.rsSyncButton.classList.add("rs-rotate"))}),document.addEventListener("click",function(){return t.close()}),this.rsWidget.addEventListener("click",function(t){return t.stopPropagation()}),this.rsLogo.addEventListener("click",function(){return t.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 t=this.parentContainerEl.querySelector(".rs-box.rs-selected");t&&t.setAttribute("aria-hidden","false")}},{key:"close",value:function(){var t=this;if("error"!==this.state){if(!this.leaveOpen&&this.active){this.closed=!0,this.rsWidget.classList.add("rs-closed");var e=this.parentContainerEl.querySelector(".rs-box.rs-selected");e&&e.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(){t.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(t){this.rsWidget.classList.remove("rs-backend-remotestorage"),this.rsWidget.classList.remove("rs-backend-dropbox"),this.rsWidget.classList.remove("rs-backend-googledrive"),t&&this.rsWidget.classList.add("rs-backend-".concat(t))}},{key:"showErrorBox",value:function(t){this.rsErrorBox.innerHTML=t,this.setState("error")}},{key:"hideErrorBox",value:function(){this.rsErrorBox.innerHTML="",this.close()}},{key:"handleSyncStarted",value:function(){var t=this;this.syncInProgress=!0,this.rsSyncButton.classList.add("rs-rotate"),setTimeout(function(){t.syncInProgress&&(t.rsConnectedLabel.textContent="Synchronizing")},1e3)}},{key:"handleDiscoveryError",value:function(t){var e=this.parentContainerEl.querySelector(".rs-sign-in-error");e.innerHTML=t.message,e.classList.remove("rs-hidden"),e.classList.add("rs-visible"),this.enableConnectButton()}},{key:"handleSyncError",value:function(){this.setOffline()}},{key:"handleUnauthorized",value:function(t){t.code&&"access_denied"===t.code?this.rs.disconnect():(this.open(),this.showErrorBox(t.message+" "),this.rsErrorBox.appendChild(this.rsErrorReconnectLink),this.rsErrorReconnectLink.classList.remove("rs-hidden"))}},{key:"updateLastSyncedStatus",value:function(){var t=new Date;this.online?(this.lastSynced=t,this.rsConnectedLabel.textContent="Synced"):this.rsWidget.classList.contains("rs-state-unauthorized")||(this.rsConnectedLabel.textContent="Offline")}},{key:"isSmallScreen",value:function(){return window.innerWidth<421}}],e&&function(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,r(i.key),i)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();return e.default})(),"object"==typeof t&&"object"==typeof e?e.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof t?t.Widget=r():n.Widget=r()}),XB=c(YB(),1),JB=new WeakMap;function QB(t,e,...n){if(t[e],t.isDestroying)return;"boolean"==typeof n[n.length-1]&&n[n.length-2];let r=JB.get(t);var i;let s;r||(r=new Map,JB.set(t,r),Rx(t,(i=r,function(){0!==i.size&&i.forEach(t=>As(t.cancelId))}))),s=r.has(e)?r.get(e).debouncedTask:(...n)=>{r.delete(e),t[e](...n)};let o=Os(t,s,...n);r.set(e,{debouncedTask:s,cancelId:o})}var t$=a({default:()=>e$}),e$=class extends fp{static{BF(this.prototype,"osm",[pp])}#B=void qF(this,"osm");static{BF(this.prototype,"toast",[pp])}#Mt=void qF(this,"toast");rs;widget;static{BF(this.prototype,"placesInView",[Wr],function(){return[]})}#At=void qF(this,"placesInView");static{BF(this.prototype,"savedPlaces",[Wr],function(){return[]})}#Ot=void qF(this,"savedPlaces");static{BF(this.prototype,"loadedPrefixes",[Wr],function(){return[]})}#Nt=void qF(this,"loadedPrefixes");static{BF(this.prototype,"currentBbox",[Wr],function(){return null})}#Ft=void qF(this,"currentBbox");static{BF(this.prototype,"lists",[Wr],function(){return[]})}#zt=void qF(this,"lists");static{BF(this.prototype,"version",[Wr],function(){return 0})}#Dt=void qF(this,"version");static{BF(this.prototype,"initialSyncDone",[Wr],function(){return!1})}#jt=void qF(this,"initialSyncDone");static{BF(this.prototype,"connected",[Wr],function(){return!1})}#Ut=void qF(this,"connected");static{BF(this.prototype,"userAddress",[Wr],function(){return null})}#Bt=void qF(this,"userAddress");static{BF(this.prototype,"isWidgetOpen",[Wr],function(){return!1})}#$t=void qF(this,"isWidgetOpen");isNewConnection=!0;constructor(){super(...arguments),this.checkInitialConnectionState(),this.rs=new qB.default({modules:[KB]}),this.rs.access.claim("places","rw"),this.rs.caching.enable("/places/"),window.remoteStorage=this.rs,this.widget=new XB.default(this.rs,{leaveOpen:!0,skipInitial:!0}),this.rs.on("ready",()=>{}),this.rs.on("error",t=>{t&&(console.info("[rs] Error —",`${t.name}: ${t.message}`),"Unauthorized"===t.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",t=>{t.relativePath.startsWith("_lists/")?this.loadLists():(this.handlePlaceChange(t),QB(this,"reloadCurrentView",200))})}checkInitialConnectionState(){this.isNewConnection=!0;try{if(window.localStorage)for(const t of["remotestorage:wireclient","remotestorage:dropbox","remotestorage:googledrive"]){const e=window.localStorage.getItem(t);if(e){const t=JSON.parse(e);if(t&&t.token){this.isNewConnection=!1;break}}}}catch(t){console.warn("Failed to check localStorage for existing connection:",t)}}handlePlaceChange(t){const{newValue:e,relativePath:n}=t,r=n.split("/"),i=r[r.length-1];if(e){const t={...e,id:i},n=this.savedPlaces.findIndex(t=>t.id===i);if(-1!==n){const e=[...this.savedPlaces];e[n]=t,this.savedPlaces=e}else this.savedPlaces=[...this.savedPlaces,t]}else this.savedPlaces=this.savedPlaces.filter(t=>t.id!==i)}get places(){return this.rs.places}notifyChange(){this.version++,QB(this,"reloadCurrentView",200)}reloadCurrentView(){if(!this.currentBbox)return;const t=vU(this.currentBbox);console.debug("Reloading view due to changes, prefixes:",t),this.loadAllPlaces(t)}async loadLists(){try{if(!this.places.lists)return;await this.places.lists.initDefaults();const t=await this.places.lists.getAll();this.lists=t||[],this.lists.forEach(t=>{"to-go"===t.id?t.icon="bookmark":"to-do"===t.id&&(t.icon="check-square")}),this.refreshPlaceListAssociations()}catch(t){console.error("Failed to load lists:",t)}}refreshPlaceListAssociations(){const t=new Map;this.lists.forEach(e=>{e.placeRefs&&Array.isArray(e.placeRefs)&&e.placeRefs.forEach(n=>{n.id&&(t.has(n.id)||t.set(n.id,[]),t.get(n.id).push(e.id))})});const e=e=>(e._listIds=t.get(e.id)||[],e);this.savedPlaces=this.savedPlaces.map(t=>e({...t})),this.placesInView=this.placesInView.map(t=>e({...t}))}async togglePlaceList(t,e,n){if(!t)return;let r=t;if(!t.id||!t.geohash){if(!n)return;r=await this.storePlace(t)}try{return n?await this.places.lists.addPlace(e,r.id,r.geohash):await this.places.lists.removePlace(e,r.id),await this.loadLists(),this.findPlaceById(r.id)}catch(i){throw console.error("Failed to toggle place in list:",i),i}}async getPlacesInList(t){return this.places&&this.places.lists?this.places.lists.getPlaces(t):[]}async loadPlacesInBounds(t){const e=vU(t).filter(t=>!this.loadedPrefixes.includes(t));0!==e.length&&(console.debug("Loading new prefixes:",e),await this.loadAllPlaces(e),this.loadedPrefixes=[...this.loadedPrefixes,...e],this.currentBbox=t)}async loadAllPlaces(t=null){try{const e=await this.places.getPlaces(t);if(e&&Array.isArray(e)){if(t){const n=new Set(t),r=this.placesInView.filter(t=>{if(!t.lat||!t.lon)return!1;try{const e=mU.encode(t.lat,t.lon,4);return!n.has(e)}catch{return!0}});this.placesInView=[...r,...e]}else this.placesInView=e;this.refreshPlaceListAssociations()}else t||(this.placesInView=[]);console.debug("Loaded saved places:",this.placesInView.length)}catch(e){console.error("Failed to load places:",e)}}findPlaceById(t){if(!t)return;const e=String(t);let n=this.savedPlaces.find(t=>t.id&&String(t.id)===e);return n||(n=this.placesInView.find(t=>t.id&&String(t.id)===e),n||(n=this.savedPlaces.find(t=>t.osmId&&String(t.osmId)===e),n||(n=this.placesInView.find(t=>t.osmId&&String(t.osmId)===e),n)))}isPlaceSaved(t){return!!this.findPlaceById(t)}async storePlace(t){const e=await this.places.store(t);return this.savedPlaces.some(t=>t.id===e.id)?this.savedPlaces=this.savedPlaces.map(t=>t.id===e.id?e:t):this.savedPlaces=[...this.savedPlaces,e],this.placesInView.some(t=>t.id===e.id)?this.placesInView=this.placesInView.map(t=>t.id===e.id?e:t):this.placesInView=[...this.placesInView,e],e}async updatePlace(t){const e=await this.places.store(t),n=this.savedPlaces.findIndex(t=>t.id===e.id);if(-1!==n){const t=[...this.savedPlaces];t[n]=e,this.savedPlaces=t}return this.placesInView=this.placesInView.map(t=>t.id===e.id?e:t),e}async removePlace(t){await this.places.remove(t.id,t.geohash),this.savedPlaces=this.savedPlaces.filter(e=>e.id!==t.id),this.placesInView.length>0&&(this.placesInView=this.placesInView.filter(e=>e.id!==t.id))}async refreshPlace(t){if(!(t&&t.id&&t.osmId&&t.osmType))return null;try{console.debug(`Checking for updates for ${t.title} (${t.osmId})`);const e=await this.osm.fetchOsmObject(t.osmId,t.osmType,{forceFresh:!0});if(!e)return console.warn("Could not fetch fresh data for",t.osmId),null;let n=!1;const r={},i=Math.abs(t.lat-e.lat),s=Math.abs(t.lon-e.lon);(i>1e-5||s>1e-5)&&(n=!0,r.lat=e.lat,r.lon=e.lon);const o=t.osmTags||{},a=e.osmTags||{},l=new Set([...Object.keys(o),...Object.keys(a)]);for(const t of l)if(o[t]!==a[t]){n=!0,r.osmTags=a;break}if(!n)return console.debug("No changes detected for",t.title),null;console.debug("Changes detected:",r);const c={...t,...r},u=TB(o),h=TB(a);return t.title===u&&u!==h&&(c.title=h),await this.updatePlace(c)}catch(e){return console.error("Failed to refresh place:",e),null}}showConnectWidget(){this.isWidgetOpen=!0,document.querySelector(".rs-widget")||this.widget.attach("rs-widget-container")}static{$F(this.prototype,"showConnectWidget",[Vl])}closeWidget(){this.isWidgetOpen=!1}static{$F(this.prototype,"closeWidget",[Vl])}disconnect(){this.rs.disconnect(),this.isWidgetOpen=!1}static{$F(this.prototype,"disconnect",[Vl])}},n$=a({default:()=>r$}),r$=class extends fp{static{BF(this.prototype,"message",[Wr],function(){return null})}#qt=void qF(this,"message");static{BF(this.prototype,"isVisible",[Wr],function(){return!1})}#Vt=void qF(this,"isVisible");timeoutId=null;show(t,e=3e3){this.message=t,this.isVisible=!0,this.timeoutId&&clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isVisible=!1},e)}},i$=a({getDistance:()=>s$});function s$(t,e,n,r){const i=t*Math.PI/180,s=n*Math.PI/180,o=(n-t)*Math.PI/180,a=(r-e)*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 o$=a({getIcon:()=>c$,isIconFilled:()=>u$}),a$={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>'},l$=["fork-and-knife","wikipedia","whatsapp","cup-and-saucer","coffee-bean","shopping-basket","person-sleeping-in-bed","loading-ring","nostrich"];function c$(t){return a$[t]}function u$(t){return l$.includes(t)}var h$=a({POI_ICON_RULES:()=>d$,getIconNameForTags:()=>p$,getIconSvgForTags:()=>f$}),d$=[{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 p$(t){if(!t)return null;for(const e of d$){let n=!0;for(const[r,i]of Object.entries(e.tags)){const e=t[r];if(!e){n=!1;break}const s=e.split(";").map(t=>t.trim());if(!0!==i&&!s.includes(i)){n=!1;break}}if(n)return e.icon}return null}function f$(t){const e=p$(t);return e?c$(e):null}var g$=a({getMatchingPoiCategories:()=>m$,getMatchingPoiCategoryIds:()=>y$});function m$(t,e){return Array.isArray(e)&&t?e.filter(e=>!!Array.isArray(e.filter)&&e.filter.some(e=>function(t,e){const n=function(t){if(!t)return[];const e=t.match(/\[[^\]]+\]/g);return e?e.map(t=>function(t){const e=t.match(/^"([^"]+)"$/);if(e)return{type:"presence",key:e[1]};const n=t.match(/^"([^"]+)"\s*=\s*"([^"]*)"$/);if(n)return{type:"equals",key:n[1],value:n[2]};const r=t.match(/^"([^"]+)"\s*~\s*"([^"]*)"$/);if(r)return{type:"regex",key:r[1],pattern:r[2],regex:new RegExp(r[2])};const i=t.match(/^"([^"]+)"\s*!~\s*"([^"]*)"$/);return i?{type:"not-regex",key:i[1],pattern:i[2],regex:new RegExp(i[2])}:null}(t.slice(1,-1).trim())).filter(Boolean):[]}(e);return 0!==n.length&&n.every(e=>function(t,e){const n=function(t,e){if(!t||!e)return[];const n=t[e];return null==n?[]:String(n).split(";").map(t=>t.trim()).filter(Boolean)}(t,e.key);switch(e.type){case"presence":return n.length>0;case"equals":return n.some(t=>t===e.value);case"regex":return n.some(t=>e.regex.test(t));case"not-regex":return 0===n.length||!n.some(t=>e.regex.test(t));default:return!1}}(t,e))}(t,e))):[]}function y$(t,e){return m$(t,e).map(t=>t.id)}var v$=a({CATEGORY_TAGS:()=>b$,getSuggestedPhotoTags:()=>w$}),b$={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 w$(t){const e=y$(t?.osmTags||t?.tags||{},MB),n=[];for(const r of e){const t=b$[r];if(Array.isArray(t))for(const e of t)n.includes(e)||n.push(e)}return 0===n.length?[]:n}var _$=a({mapToStorageSchema:()=>x$});function x$(t){return{title:t.title||TB(t.osmTags,"Untitled Place"),lat:t.lat,lon:t.lon,tags:[],url:t.osmTags?.website,osmId:String(t.osmId||t.id),osmType:t.osmType,osmTags:t.osmTags||{},description:t.description}}var C$=a({getSocialInfo:()=>k$}),S$=(t,...e)=>{for(const n of e)if(t[n])return t[n];return null};function k$(t,e){if(!t)return null;const n=`${e}.com`,r=S$(t,`contact:${e}`,e);if(!r)return null;if(r.startsWith("http"))try{const t=new URL(r);return"facebook"===e&&"/profile.php"===t.pathname&&t.searchParams.has("id")?{url:r,username:t.searchParams.get("id")}:{url:r,username:t.pathname.replace(/^\/|\/$/g,"")||r}}catch{return{url:r,username:r}}const i=r.replace(/^@/,"");return{url:`https://${n}/${i}`,username:i}}var E$,R$,T$,L$,I$,P$=["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","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],M$=t=>{let e=0;for(let n=0;n<t.length;n++){let r=t[n];e=83*e+P$.indexOf(r)}return e},A$=(t,e)=>{var n="";for(let r=1;r<=e;r++){let i=Math.floor(t)/Math.pow(83,e-r)%83;n+=P$[Math.floor(i)]}return n},O$=t=>{let e=t/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},N$=t=>{let e=Math.max(0,Math.min(1,t));return e<=.0031308?Math.trunc(12.92*e*255+.5):Math.trunc(255*(1.055*Math.pow(e,.4166666666666667)-.055)+.5)},F$=(t,e)=>(t=>t<0?-1:1)(t)*Math.pow(Math.abs(t),e),z$=class extends Error{constructor(t){super(t),this.name="ValidationError",this.message=t}},D$=t=>{let e=t>>8&255,n=255&t;return[O$(t>>16),O$(e),O$(n)]},j$=(t,e)=>{let n=Math.floor(t/361),r=Math.floor(t/19)%19,i=t%19;return[F$((n-9)/9,2)*e,F$((r-9)/9,2)*e,F$((i-9)/9,2)*e]},U$=(t,e,n,r)=>{let i=0,s=0,o=0,a=4*e;for(let c=0;c<e;c++){let e=4*c;for(let l=0;l<n;l++){let n=e+l*a,u=r(c,l);i+=u*O$(t[n]),s+=u*O$(t[n+1]),o+=u*O$(t[n+2])}}let l=1/(e*n);return[i*l,s*l,o*l]},B$=a({});function $$(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function q$(t,e,n,r){n&&Object.defineProperty(t,e,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(r):void 0})}function V$(t,e,n,r,i){var s={};return Object.keys(r).forEach(function(t){s[t]=r[t]}),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(t,e,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(t,e,s),s=null),s}self.onmessage=async t=>{if("PROCESS_IMAGE"!==t.data?.type)return;const{id:e,file:n,targetWidth:r,targetHeight:i,quality:s,computeBlurhash:o}=t.data;try{let t,c;try{const e=await createImageBitmap(n,{resizeWidth:r,resizeHeight:i,resizeQuality:"high"});if(t=new OffscreenCanvas(r,i),c=t.getContext("2d"),!c)throw new Error("Failed to get 2d context from OffscreenCanvas");c.drawImage(e,0,0,r,i),e.close()}catch(a){console.warn("Hardware resize failed, falling back to stepped software scaling:",a);const e=await n.arrayBuffer(),s=new Blob([e],{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 t=new OffscreenCanvas(Math.floor(.5*h.width),Math.floor(.5*h.height)),e=t.getContext("2d");e.imageSmoothingEnabled=!0,e.imageSmoothingQuality="high",e.drawImage(h,0,0,t.width,t.height),h=t}t=new OffscreenCanvas(r,i),c=t.getContext("2d"),c.imageSmoothingEnabled=!0,c.imageSmoothingQuality="high",c.drawImage(h,0,0,r,i),o.close()}let u=null;if(o)try{u=((t,e,n)=>{if(e*n*4!==t.length)throw new z$("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=U$(t,e,n,(t,r)=>s*Math.cos(Math.PI*i*t/e)*Math.cos(Math.PI*l*r/n));r.push(o)}let i,s=r[0],o=r.slice(1),a="";if(a+=A$(21,1),o.length>0){let t=Math.max(...o.map(t=>Math.max(...t))),e=Math.floor(Math.max(0,Math.min(82,Math.floor(166*t-.5))));i=(e+1)/166,a+=A$(e,1)}else i=1,a+=A$(0,1);return a+=A$((t=>(N$(t[0])<<16)+(N$(t[1])<<8)+N$(t[2]))(s),4),o.forEach(t=>{a+=A$(((t,e)=>19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*F$(t[0]/e,.5)+9.5))))*19+19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*F$(t[1]/e,.5)+9.5))))+Math.floor(Math.max(0,Math.min(18,Math.floor(9*F$(t[2]/e,.5)+9.5)))))(t,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 t.convertToBlob({type:"image/jpeg",quality:s}),d=`${r}x${i}`;self.postMessage({id:e,success:!0,blob:h,dim:d,blurhash:u})}catch(d8){self.postMessage({id:e,success:!1,error:d8.message})}};var W$="undefined"!=typeof FastBoot,H$="routeDidChange",G$=["separator","prepend","replace"],Z$=(E$=pp("router"),R$=pp("-document"),T$=class extends fp{constructor(t){if(super(t),q$(this,"router",L$,this),q$(this,"document",I$,this),$$(this,"tokens",[]),$$(this,"_defaultConfig",{separator:" | ",prepend:!0,replace:null}),$$(this,"scheduleTitleUpdate",()=>{Ps("afterRender",this,this._updateTitle)}),this._validateExistingTitleElement(),function(t){return"resolveRegistration"in t}(t)){const n=t.resolveRegistration("config:environment");"object"==typeof(e=n)&&null!==e&&"pageTitle"in e&&G$.forEach(t=>{if(!function(t){if(null==t)return!0;if(!ur(t)&&"number"==typeof t.size)return!t.size;if("object"==typeof t){let e=hr(t,"size");if("number"==typeof e)return!e;let n=hr(t,"length");if("number"==typeof n)return!n}return"number"==typeof t.length&&"function"!=typeof t&&!t.length}(n.pageTitle[t])){const e=n.pageTitle[t];this._defaultConfig[t]=e}})}var e;this.router.on(H$,this.scheduleTitleUpdate)}applyTokenDefaults(t){const e=this._defaultConfig.separator,n=this._defaultConfig.prepend,r=this._defaultConfig.replace;t.previous??=null,t.next??=null,null==t.separator&&(t.separator=e),null==t.prepend&&null!=n&&(t.prepend=n),null==t.replace&&null!=r&&(t.replace=r)}inheritFromPrevious(t){const e=t.previous;e&&(null==t.separator&&(t.separator=e.separator),null==t.prepend&&(t.prepend=e.prepend))}push(t){const e=this._findTokenById(t.id);if(e){const n=this.tokens.indexOf(e),r=[...this.tokens];return t.previous=e.previous,t.next=e.next,this.inheritFromPrevious(t),this.applyTokenDefaults(t),r.splice(n,1,t),void(this.tokens=r)}const n=this.tokens.slice(-1)[0];n&&(t.previous=n??null,n.next=t,this.inheritFromPrevious(t)),this.applyTokenDefaults(t),this.tokens=[...this.tokens,t]}remove(t){const e=this._findTokenById(t);if(!e)return;const{next:n,previous:r}=e;n&&(n.previous=r),r&&(r.next=n),e.previous=e.next=null;const i=[...this.tokens];i.splice(i.indexOf(e),1),this.tokens=i}get visibleTokens(){const t=this.tokens;let e=t?t.length:0;const n=[];for(;e--;){const r=t[e];if(r){if(r.replace){n.unshift(r);break}n.unshift(r)}}return n}get sortedTokens(){const t=this.visibleTokens;if(!t)return[];let e=!0,n=[];const r=[n],i=[];return t.forEach(t=>{t.front?i.unshift(t):t.prepend?(e&&(e=!1,n=[],r.push(n)),n.unshift(t)):(e||(e=!0,n=[],r.push(n)),n.push(t))}),i.concat(r.reduce((t,e)=>t.concat(e),[]))}toString(){const t=this.sortedTokens,e=[];for(let n=0,r=t.length;n<r;n++){const i=t[n];i&&i.title&&(e.push(i.title),n+1<r&&e.push(i.separator))}return e.join("")}willDestroy(){super.willDestroy(),this.router.off(H$,this.scheduleTitleUpdate)}_updateTitle(){const t=this.toString();W$?this.updateFastbootTitle(t):this.document.title=t,this.titleDidUpdate(t)}_validateExistingTitleElement(){W$||document.head.querySelectorAll("title").length}_findTokenById(t){return this.tokens.find(e=>e.id===t)}updateFastbootTitle(t){if(!W$)return;const e=this.document.head,n=e.childNodes;for(let s=0;s<n.length;s++){const t=n[s];t&&"title"===t.nodeName.toLowerCase()&&e.removeChild(t)}const r=this.document.createElement("title"),i=this.document.createTextNode(t);r.appendChild(i),e.appendChild(r)}titleDidUpdate(t){}},L$=V$(T$.prototype,"router",[E$],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),I$=V$(T$.prototype,"document",[R$],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),T$),K$=a({default:()=>Z$}),Y$=_l.create({target:null,action:null,actionContext:null,actionContextObject:Xn("actionContext",function(){let t=hr(this,"actionContext");if("string"==typeof t){let e=hr(this,t);return void 0===e&&(e=hr(Jr.lookup,t)),e}return t}),triggerAction(t={}){let{action:e,target:n,actionContext:r}=t;e=e||hr(this,"action"),n=n||function(t){let e=hr(t,"target");if(e){if("string"==typeof e){let n=hr(t,e);return void 0===n&&(n=hr(Jr.lookup,e)),n}return e}return t._target?t._target:null}(this),void 0===r&&(r=hr(this,"actionContextObject")||this);let i=Array.isArray(r)?r:[r];if(n&&e){let t;if(t=null!=(s=n)&&"object"==typeof s&&"function"==typeof s.send?n.send(e,...i):n[e](...i),!1!==t)return!0}var s;return!1}}),X$=_l.create({send(t,...e){let n=this.actions&&this.actions[t];if(n&&!0!==n.apply(this,e))return;let r=hr(this,"target");r&&r.send(...arguments)}}),J$=Object.freeze({appendChild(){throw new Error("You can't use appendChild outside of the rendering process")},handleEvent:()=>!0,rerender(){},destroy(){}}),Q$=Object.freeze({...J$}),tq=Object.freeze({...J$,rerender(t){t.renderer.rerender()},destroy(t){t.renderer.remove(t)},handleEvent:(t,e,n)=>!t.has(e)||uv(0,0,()=>xs(t,t.trigger,e,n))}),eq=Object.freeze({...tq,enter(t){t.renderer.register(t)}}),nq=Object.freeze({...J$,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")}}),rq=Object.freeze({preRender:Q$,inDOM:eq,hasElement:tq,destroying:nq}),iq=class extends(Xc.extend(bc,kl)){isView=!0;_superTrigger;_superHas;init(t){super.init(t),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{Zh(this.prototype,"renderer",[qr("renderer","-dom")])}#Wt=void Yh(this,"renderer");instrumentDetails(t){return t.object=this.toString(),t.containerKey=this._debugContainerKey,t.view=this,t}_trigger(t,...e){this._superTrigger(t,...e);let n=this[t];if("function"==typeof n)return n.apply(this,e)}_has(t){return"function"==typeof this[t]||this._superHas(t)}static isViewFactory=!0};iq.prototype._states=rq;var sq=a({Input:()=>c_,Textarea:()=>d_,capabilities:()=>cb,default:()=>lq,getComponentTemplate:()=>Np,setComponentManager:()=>cq,setComponentTemplate:()=>Op}),oq=new WeakMap,aq=Object.freeze([]),lq=class extends(iq.extend(Y$,X$,{didReceiveAttrs(){},didRender(){},didUpdate(){},didUpdateAttrs(){},willRender(){},willUpdate(){}},{concatenatedProperties:["attributeBindings","classNames","classNameBindings"],classNames:aq,classNameBindings:aq})){isComponent=!0;init(t){super.init(t),this._superRerender=this.rerender,this.rerender=this._rerender,this[Lv]=!1,this[Tv]=gt(),this[Iv]=null;const e=this._dispatcher;if(e){let t=oq.get(e);t||(t=new WeakSet,oq.set(e,t));let n=Object.getPrototypeOf(this);t.has(n)||(e.lazyEvents.forEach((t,n)=>{null!==t&&"function"==typeof this[t]&&e.setupHandlerForBrowserEvent(n)}),t.add(n))}this.elementId||""===this.tagName||(this.elementId=ll(this))}__dispatcher;get _dispatcher(){if(void 0===this.__dispatcher){let t=Br(this);if(t.lookup("-environment:main").isInteractive){let e=t.lookup("event_dispatcher:main");this.__dispatcher=e}else this.__dispatcher=null}return this.__dispatcher}on(t,e,n){return this._dispatcher?.setupHandlerForEmberEvent(t),super.on(t,e,n)}_rerender(){pt(this[Tv]),this._superRerender()}[Bn](t,e){if(this[Lv])return;let n=Rv.get(this),r=void 0!==n?n[t]:void 0;void 0!==r&&we(r)&&xe(r,2===arguments.length?e:hr(this,t))}getAttr(t){return this.get(t)}readDOMAttr(t){let e=Ql(this),n="http://www.w3.org/2000/svg"===e.namespaceURI,{type:r,normalized:i}=Sg(e,t);return n||"attr"===r?e.getAttribute(i):e[i]}get childViews(){return sc(this)}static{Kh(this.prototype,"childViews",[S({configurable:!1,enumerable:!1})])}appendChild(t){oc(this,t)}_transitionTo(t){let e=this._currentState,n=this._currentState=this._states[t];this._state=t,e&&e.exit&&e.exit(this),n.enter&&n.enter(this)}nearestOfType(t){let e=this.parentView;for(;e;){if(t.detect(e.constructor))return e;e=e.parentView}}nearestWithProperty(t){let e=this.parentView;for(;e;){if(t in e)return e;e=e.parentView}}rerender(){return this._currentState.rerender(this)}get element(){return this.renderer.getElement(this)}static{Kh(this.prototype,"element",[S({configurable:!1,enumerable:!1})])}appendTo(t){let e;return e=Ao&&"string"==typeof t?document.querySelector(t):t,this.renderer.appendTo(this,e),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(t,e){return this._currentState.handleEvent(this,t,e)}static isComponentFactory=!0;static toString(){return"@ember/component"}};function cq(t,e){return mb(t,e)}lq.reopenClass({positionalParams:[]}),Fu(Fv,lq);var uq=a({default:()=>vq}),hq=new WeakMap,dq=new WeakMap,pq=class{constructor(t,e){this.args=e,hq.set(this,!1),dq.set(this,!1)}args;get isDestroying(){return hq.get(this)||!1}get isDestroyed(){return dq.get(this)||!1}willDestroy(){}},fq=class{owner;constructor(t){this.owner=t}createComponent(t,e){return new t(this.owner,e.named)}getContext(t){return t}},gq=cb(0,{destructor:!0,asyncLifecycleCallbacks:!1,updateHook:!1});function mq(t){t.isDestroyed||(nt(t),function(t){dq.set(t,!0)}(t))}var yq=class extends fq{capabilities=gq;destroyComponent(t){t.isDestroying||(function(t){hq.set(t,!0)}(t),Es("actions",t,t.willDestroy),Es("destroy",this,mq,t))}},vq=class extends pq{constructor(t,e){super(t,e),$r(this,t)}};cq(t=>new yq(t),vq);var bq=yb,wq=class extends vq{get svg(){return c$(this.args.name)}get size(){return this.args.size||16}get color(){return this.args.color||"#898989"}get style(){return qv(`width:${this.size}px;height:${this.size}px;color:${this.color}`)}get title(){return this.args.title||""}get isFilled(){return this.args.filled||u$(this.args.name)}static{Op(ig({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:qv}),isStrictMode:!0}),this)}};function _q(t){return $t(t.argsCache)}var xq=class{argsCache;constructor(t,e=()=>ly){let n=Bt(()=>e(t));this.argsCache=n}get named(){return _q(this).named||oy}get positional(){return _q(this).positional||ay}};function Cq(t,e,n){const r=Ur(t),i=Nu(e).getDelegateFor(r);let s,o=new xq(t,n),a=i.createHelper(e,o);if(!_u(i))throw new Error("TODO: unreachable, to be implemented with hasScheduledEffect");return s=Bt(()=>i.getValue(a)),tt(t,s),xu(i)&&tt(s,i.getDestroyable(a)),s}function Sq(t,e){return t===e}function kq(t,e){return t!==e}function Eq(t,e){return t>e}function Rq(t,e){return t>=e}function Tq(t,e){return t<e}function Lq(t,e){return t<=e}var Iq=Vv(({positional:t})=>ge(()=>{let e;for(let n=0;n<t.length;n++){let r=t[n];if(e=r?_e(r):r,!B(e))return e}return e},null)),Pq=Vv(({positional:t})=>ge(()=>{let e;for(let n=0;n<t.length;n++){let r=t[n];if(e=r?_e(r):r,B(e))return e}return e},null)),Mq=(...t)=>!B(t[0]),Aq={createInstance:!0,wrapped:!0},Oq=new class{getCapabilities(){return Aq}getDebugName(t){return`(element "${t.tagName}")`}getSelf(){return ue}getDestroyable(){return null}didCreateElement(){}create(t,e){return e.tagName||null}getTagName(t){return t}didRenderLayout(){}didUpdateLayout(){}didCreate(){}didUpdate(){}},Nq=class{constructor(t){this.tagName=t}toString(){return`(element "${this.tagName}")`}};Fu(Oq,Nq.prototype);var Fq=new Map;Bv(({positional:t,named:e})=>ge(()=>function(t){let e=Fq.get(t);return void 0===e&&(e=new Nq(t),Fq.set(t,e)),e}(_e(t[0])),null));var zq=Hv,Dq=Eq;function jq(t){return"object"==typeof t&&t&&"isTruthy"in t&&"boolean"==typeof t.isTruthy?t.isTruthy:Pc(t)?0!==t.length:!!t}var Uq=class extends _b{compute(t){for(let e=0,n=t.length;e<n;e++)if(!0===jq(t[e]))return t[e];return t[t.length-1]}},Bq=Eb(function([t]){return EB(t)}),$q=class extends vq{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 t=(this.item?.photos||[]).flatMap(t=>t.tags||[]);return[...new Set(t)]}static{Op(ig({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:Hw,fn:zq,or:Uq,__keyword__gt:Dq,formatRelativeDate:Bq}),isStrictMode:!0}),this)}},qq=ab,Vq=Op(ig({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:Hw,Icon:wq}),isStrictMode:!0}),qq()),Wq=class extends vq{get isTesting(){return"test"===ix.environment}get shouldPortal(){return!this.isTesting&&!this.args.inline}get destinationElement(){return document.getElementById("modal-portal")||document.body}stopProp(t){t.stopPropagation()}static{$F(this.prototype,"stopProp",[Vl])}close(){this.args.disableClose||this.args.onClose&&this.args.onClose()}static{$F(this.prototype,"close",[Vl])}static{Op(ig({id:null,block:'[[[41,[30,0,["shouldPortal"]],[[[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,2],[[30,0,["destinationElement"]]],null]]],[]],[[[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"]],[]]]],["@disableClose","&default"],["if","in-element","-in-el-null","yield"]]',moduleName:"(unknown template module)",scope:()=>({ModalContent:Vq}),isStrictMode:!0}),this)}},Hq=class extends _b{compute(t){for(let e=0,n=t.length;e<n;e++)if(!1===jq(t[e]))return t[e];return t[t.length-1]}};function Gq(t,e){return t===e}function Zq(...t){return t.every(t=>!jq(t))}var Kq=class{capabilities=fb();constructor(t){this.owner=t}createModifier(t,e){return{instance:new t(this.owner,e),element:null}}installModifier(t,e,n){(function(t,e){const n=t;return n.element=e,n})(t,e).instance.modify(e,n.positional,n.named)}updateModifier(t,e){t.instance.modify(t.element,e.positional,e.named)}destroyModifier({instance:t}){nt(t)}};bq(t=>new Kq(t),class{constructor(t,e){X_(this,t)}modify(t,e,n){}});var Yq=new class{capabilities=fb();createModifier(t){return{element:null,instance:t}}installModifier(t,e,n){const r=function(t,e){const n=t;return n.element=e,n}(t,e),{positional:i,named:s}=n,o=t.instance(e,i,s);"function"==typeof o&&(r.teardown=o)}updateModifier(t,e){"function"==typeof t.teardown&&t.teardown();const n=t.instance(t.element,e.positional,e.named);"function"==typeof n&&(t.teardown=n)}destroyModifier(t){"function"==typeof t.teardown&&t.teardown()}getDebugName(t){return t.instance.toString()}getDebugInstance(t){return t}};function Xq(t,e){return t.toString=()=>e?.name||t.name,bq(()=>Yq,t)}var Jq=o((t,e)=>{e.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}}),Qq=o(t=>{var e,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];t.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return 4*t+17},t.getSymbolTotalCodewords=function(t){return n[t]},t.getBCHDigit=function(t){let e=0;for(;0!==t;)e++,t>>>=1;return e},t.setToSJISFunction=function(t){if("function"!=typeof t)throw new Error('"toSJISFunc" is not a valid function.');e=t},t.isKanjiModeEnabled=function(){return void 0!==e},t.toSJIS=function(t){return e(t)}}),tV=o(t=>{t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2},t.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+e)}}(e)}catch(r){return n}}}),eV=o((t,e)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(t){const e=Math.floor(t/8);return 1==(this.buffer[e]>>>7-t%8&1)},put:function(t,e){for(let n=0;n<e;n++)this.putBit(1==(t>>>e-n-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}},e.exports=n}),nV=o((t,e)=>{function n(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}n.prototype.set=function(t,e,n,r){const i=t*this.size+e;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(t,e){return this.data[t*this.size+e]},n.prototype.xor=function(t,e,n){this.data[t*this.size+e]^=n},n.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]},e.exports=n}),rV=o(t=>{var e=Qq().getSymbolSize;t.getRowColCoords=function(t){if(1===t)return[];const n=Math.floor(t/7)+2,r=e(t),i=145===r?26:2*Math.ceil((r-13)/(2*n-2)),s=[r-7];for(let e=1;e<n-1;e++)s[e]=s[e-1]-i;return s.push(6),s.reverse()},t.getPositions=function(e){const n=[],r=t.getRowColCoords(e),i=r.length;for(let t=0;t<i;t++)for(let e=0;e<i;e++)0===t&&0===e||0===t&&e===i-1||t===i-1&&0===e||n.push([r[t],r[e]]);return n}}),iV=o(t=>{var e=Qq().getSymbolSize;t.getPositions=function(t){const n=e(t);return[[0,0],[n-7,0],[0,n-7]]}}),sV=o(t=>{function e(e,n,r){switch(e){case t.Patterns.PATTERN000:return(n+r)%2==0;case t.Patterns.PATTERN001:return n%2==0;case t.Patterns.PATTERN010:return r%3==0;case t.Patterns.PATTERN011:return(n+r)%3==0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case t.Patterns.PATTERN101:return n*r%2+n*r%3==0;case t.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case t.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}}t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},t.isValid=function(t){return null!=t&&""!==t&&!isNaN(t)&&t>=0&&t<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(t){const e=t.size;let n=0,r=0,i=0,s=null,o=null;for(let a=0;a<e;a++){r=i=0,s=o=null;for(let l=0;l<e;l++){let e=t.get(a,l);e===s?r++:(r>=5&&(n+=r-5+3),s=e,r=1),e=t.get(l,a),e===o?i++:(i>=5&&(n+=i-5+3),o=e,i=1)}r>=5&&(n+=r-5+3),i>=5&&(n+=i-5+3)}return n},t.getPenaltyN2=function(t){const e=t.size;let n=0;for(let r=0;r<e-1;r++)for(let i=0;i<e-1;i++){const e=t.get(r,i)+t.get(r,i+1)+t.get(r+1,i)+t.get(r+1,i+1);4!==e&&0!==e||n++}return 3*n},t.getPenaltyN3=function(t){const e=t.size;let n=0,r=0,i=0;for(let s=0;s<e;s++){r=i=0;for(let o=0;o<e;o++)r=r<<1&2047|t.get(s,o),o>=10&&(1488===r||93===r)&&n++,i=i<<1&2047|t.get(o,s),o>=10&&(1488===i||93===i)&&n++}return 40*n},t.getPenaltyN4=function(t){let e=0;const n=t.data.length;for(let r=0;r<n;r++)e+=t.data[r];return 10*Math.abs(Math.ceil(100*e/n/5)-10)},t.applyMask=function(t,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,e(t,s,i))},t.getBestMask=function(e,n){const r=Object.keys(t.Patterns).length;let i=0,s=1/0;for(let o=0;o<r;o++){n(o),t.applyMask(o,e);const r=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(o,e),r<s&&(s=r,i=o)}return i}}),oV=o(t=>{var e=tV(),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];t.getBlocksCount=function(t,r){switch(r){case e.L:return n[4*(t-1)+0];case e.M:return n[4*(t-1)+1];case e.Q:return n[4*(t-1)+2];case e.H:return n[4*(t-1)+3];default:return}},t.getTotalCodewordsCount=function(t,n){switch(n){case e.L:return r[4*(t-1)+0];case e.M:return r[4*(t-1)+1];case e.Q:return r[4*(t-1)+2];case e.H:return r[4*(t-1)+3];default:return}}}),aV=o(t=>{var e=new Uint8Array(512),n=new Uint8Array(256);!function(){let t=1;for(let r=0;r<255;r++)e[r]=t,n[t]=r,t<<=1,256&t&&(t^=285);for(let n=255;n<512;n++)e[n]=e[n-255]}(),t.log=function(t){if(t<1)throw new Error("log("+t+")");return n[t]},t.exp=function(t){return e[t]},t.mul=function(t,r){return 0===t||0===r?0:e[n[t]+n[r]]}}),lV=o(t=>{var e=aV();t.mul=function(t,n){const r=new Uint8Array(t.length+n.length-1);for(let i=0;i<t.length;i++)for(let s=0;s<n.length;s++)r[i+s]^=e.mul(t[i],n[s]);return r},t.mod=function(t,n){let r=new Uint8Array(t);for(;r.length-n.length>=0;){const t=r[0];for(let s=0;s<n.length;s++)r[s]^=e.mul(n[s],t);let i=0;for(;i<r.length&&0===r[i];)i++;r=r.slice(i)}return r},t.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=t.mul(r,new Uint8Array([1,e.exp(i)]));return r}}),cV=o((t,e)=>{var n=lV();function r(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(t){this.degree=t,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");const e=new Uint8Array(t.length+this.degree);e.set(t);const r=n.mod(e,this.genPoly),i=this.degree-r.length;if(i>0){const t=new Uint8Array(this.degree);return t.set(r,i),t}return r},e.exports=r}),uV=o(t=>{t.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}}),hV=o(t=>{var e="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+",n="(?:(?![A-Z0-9 $%*+\\-./:]|"+(e=e.replace(/u/g,"\\u"))+")(?:.|[\r\n]))+";t.KANJI=new RegExp(e,"g"),t.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),t.BYTE=new RegExp(n,"g"),t.NUMERIC=new RegExp("[0-9]+","g"),t.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");var r=new RegExp("^"+e+"$"),i=new RegExp("^[0-9]+$"),s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");t.testKanji=function(t){return r.test(t)},t.testNumeric=function(t){return i.test(t)},t.testAlphanumeric=function(t){return s.test(t)}}),dV=o(t=>{var e=uV(),n=hV();t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(t,n){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!e.isValid(n))throw new Error("Invalid version: "+n);return n>=1&&n<10?t.ccBits[0]:n<27?t.ccBits[1]:t.ccBits[2]},t.getBestModeForData=function(e){return n.testNumeric(e)?t.NUMERIC:n.testAlphanumeric(e)?t.ALPHANUMERIC:n.testKanji(e)?t.KANJI:t.BYTE},t.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")},t.isValid=function(t){return t&&t.bit&&t.ccBits},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+e)}}(e)}catch(r){return n}}}),pV=o(t=>{var e=Qq(),n=oV(),r=tV(),i=dV(),s=uV(),o=e.getBCHDigit(7973);function a(t,e){return i.getCharCountIndicator(t,e)+4}function l(t,e){let n=0;return t.forEach(function(t){const r=a(t.mode,e);n+=r+t.getBitsLength()}),n}t.from=function(t,e){return s.isValid(t)?parseInt(t,10):e},t.getCapacity=function(t,r,o){if(!s.isValid(t))throw new Error("Invalid QR Code version");void 0===o&&(o=i.BYTE);const l=8*(e.getSymbolTotalCodewords(t)-n.getTotalCodewordsCount(t,r));if(o===i.MIXED)return l;const c=l-a(o,t);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)}},t.getBestVersionForData=function(e,n){let s;const o=r.from(n,r.M);if(Array.isArray(e)){if(e.length>1)return function(e,n){for(let r=1;r<=40;r++)if(l(e,r)<=t.getCapacity(r,n,i.MIXED))return r}(e,o);if(0===e.length)return 1;s=e[0]}else s=e;return function(e,n,r){for(let i=1;i<=40;i++)if(n<=t.getCapacity(i,r,e))return i}(s.mode,s.getLength(),o)},t.getEncodedBits=function(t){if(!s.isValid(t)||t<7)throw new Error("Invalid QR Code version");let n=t<<12;for(;e.getBCHDigit(n)-o>=0;)n^=7973<<e.getBCHDigit(n)-o;return t<<12|n}}),fV=o(t=>{var e=Qq(),n=e.getBCHDigit(1335);t.getEncodedBits=function(t,r){const i=t.bit<<3|r;let s=i<<10;for(;e.getBCHDigit(s)-n>=0;)s^=1335<<e.getBCHDigit(s)-n;return 21522^(i<<10|s)}}),gV=o((t,e)=>{var n=dV();function r(t){this.mode=n.NUMERIC,this.data=t.toString()}r.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%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(t){let e,n,r;for(e=0;e+3<=this.data.length;e+=3)n=this.data.substr(e,3),r=parseInt(n,10),t.put(r,10);const i=this.data.length-e;i>0&&(n=this.data.substr(e),r=parseInt(n,10),t.put(r,3*i+1))},e.exports=r}),mV=o((t,e)=>{var n=dV(),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(t){this.mode=n.ALPHANUMERIC,this.data=t}i.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(t){let e;for(e=0;e+2<=this.data.length;e+=2){let n=45*r.indexOf(this.data[e]);n+=r.indexOf(this.data[e+1]),t.put(n,11)}this.data.length%2&&t.put(r.indexOf(this.data[e]),6)},e.exports=i}),yV=o((t,e)=>{var n=dV();function r(t){this.mode=n.BYTE,this.data="string"==typeof t?(new TextEncoder).encode(t):new Uint8Array(t)}r.getBitsLength=function(t){return 8*t},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(t){for(let e=0,n=this.data.length;e<n;e++)t.put(this.data[e],8)},e.exports=r}),vV=o((t,e)=>{var n=dV(),r=Qq();function i(t){this.mode=n.KANJI,this.data=t}i.getBitsLength=function(t){return 13*t},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(t){let e;for(e=0;e<this.data.length;e++){let n=r.toSJIS(this.data[e]);if(n>=33088&&n<=40956)n-=33088;else{if(!(n>=57408&&n<=60351))throw new Error("Invalid SJIS character: "+this.data[e]+"\nMake sure your charset is UTF-8");n-=49472}n=192*(n>>>8&255)+(255&n),t.put(n,13)}},e.exports=i}),bV=o((t,e)=>{var n={single_source_shortest_paths:function(t,e,r){var i={},s={};s[e]=0;var o,a,l,c,u,h,d,p=n.PriorityQueue.make();for(p.push(e,0);!p.empty();)for(l in a=(o=p.pop()).value,c=o.cost,u=t[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 ",e," to ",r,"."].join("");throw new Error(f)}return i},extract_shortest_path_from_predecessor_list:function(t,e){for(var n=[],r=e;r;)n.push(r),t[r],r=t[r];return n.reverse(),n},find_path:function(t,e,r){var i=n.single_source_shortest_paths(t,e,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(t){var e,r=n.PriorityQueue,i={};for(e in t=t||{},r)r.hasOwnProperty(e)&&(i[e]=r[e]);return i.queue=[],i.sorter=t.sorter||r.default_sorter,i},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var n={value:t,cost:e};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};void 0!==e&&(e.exports=n)}),wV=o(t=>{var e=dV(),n=gV(),r=mV(),i=yV(),s=vV(),o=hV(),a=Qq(),l=bV();function c(t){return unescape(encodeURIComponent(t)).length}function u(t,e,n){const r=[];let i;for(;null!==(i=t.exec(n));)r.push({data:i[0],index:i.index,mode:e,length:i[0].length});return r}function h(t){const n=u(o.NUMERIC,e.NUMERIC,t),r=u(o.ALPHANUMERIC,e.ALPHANUMERIC,t);let i,s;return a.isKanjiModeEnabled()?(i=u(o.BYTE,e.BYTE,t),s=u(o.KANJI,e.KANJI,t)):(i=u(o.BYTE_KANJI,e.BYTE,t),s=[]),n.concat(r,i,s).sort(function(t,e){return t.index-e.index}).map(function(t){return{data:t.data,mode:t.mode,length:t.length}})}function d(t,o){switch(o){case e.NUMERIC:return n.getBitsLength(t);case e.ALPHANUMERIC:return r.getBitsLength(t);case e.KANJI:return s.getBitsLength(t);case e.BYTE:return i.getBitsLength(t)}}function p(t,o){let l;const c=e.getBestModeForData(t);if(l=e.from(o,c),l!==e.BYTE&&l.bit<c.bit)throw new Error('"'+t+'" cannot be encoded with mode '+e.toString(l)+".\n Suggested mode is: "+e.toString(c));switch(l!==e.KANJI||a.isKanjiModeEnabled()||(l=e.BYTE),l){case e.NUMERIC:return new n(t);case e.ALPHANUMERIC:return new r(t);case e.KANJI:return new s(t);case e.BYTE:return new i(t)}}t.fromArray=function(t){return t.reduce(function(t,e){return"string"==typeof e?t.push(p(e,null)):e.data&&t.push(p(e.data,e.mode)),t},[])},t.fromString=function(n,r){const i=function(t,n){const r={},i={start:{}};let s=["start"];for(let o=0;o<t.length;o++){const a=t[o],l=[];for(let t=0;t<a.length;t++){const c=a[t],u=""+o+t;l.push(u),r[u]={node:c,lastCount:0},i[u]={};for(let t=0;t<s.length;t++){const o=s[t];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+e.getCharCountIndicator(c.mode,n))}}s=l}for(let e=0;e<s.length;e++)i[s[e]].end=0;return{map:i,table:r}}(function(t){const n=[];for(let r=0;r<t.length;r++){const i=t[r];switch(i.mode){case e.NUMERIC:n.push([i,{data:i.data,mode:e.ALPHANUMERIC,length:i.length},{data:i.data,mode:e.BYTE,length:i.length}]);break;case e.ALPHANUMERIC:n.push([i,{data:i.data,mode:e.BYTE,length:i.length}]);break;case e.KANJI:n.push([i,{data:i.data,mode:e.BYTE,length:c(i.data)}]);break;case e.BYTE:n.push([{data:i.data,mode:e.BYTE,length:c(i.data)}])}}return n}(h(n,a.isKanjiModeEnabled())),r),s=l.find_path(i.map,"start","end"),o=[];for(let t=1;t<s.length-1;t++)o.push(i.table[s[t]].node);return t.fromArray(o.reduce(function(t,e){const n=t.length-1>=0?t[t.length-1]:null;return n&&n.mode===e.mode?(t[t.length-1].data+=e.data,t):(t.push(e),t)},[]))},t.rawSplit=function(e){return t.fromArray(h(e,a.isKanjiModeEnabled()))}}),_V=o(t=>{var e=Qq(),n=tV(),r=eV(),i=nV(),s=rV(),o=iV(),a=sV(),l=oV(),c=cV(),u=pV(),h=fV(),d=dV(),p=wV();function f(t,e,n){const r=t.size,i=h.getEncodedBits(e,n);let s,o;for(s=0;s<15;s++)o=1==(i>>s&1),s<6?t.set(s,8,o,!0):s<8?t.set(s+1,8,o,!0):t.set(r-15+s,8,o,!0),s<8?t.set(8,r-s-1,o,!0):s<9?t.set(8,15-s-1+1,o,!0):t.set(8,15-s-1,o,!0);t.set(r-8,8,1,!0)}t.create=function(t,h){if(void 0===t||""===t)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&&e.setToSJISFunction(h.toSJISFunc)),function(t,n,h,g){let m;if(Array.isArray(t))m=p.fromArray(t);else{if("string"!=typeof t)throw new Error("Invalid data");{let e=n;if(!e){const n=p.rawSplit(t);e=u.getBestVersionForData(n,h)}m=p.fromString(t,e||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(t,n,i){const s=new r;i.forEach(function(e){s.put(e.mode.bit,4),s.put(e.getLength(),d.getCharCountIndicator(e.mode,t)),e.write(s)});const o=8*(e.getSymbolTotalCodewords(t)-l.getTotalCodewordsCount(t,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 e=0;e<a;e++)s.put(e%2?17:236,8);return function(t,n,r){const i=e.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(t.buffer);for(let e=0;e<o;e++){const t=e<a?h:d;m[e]=b.slice(g,g+t),y[e]=f.encode(m[e]),g+=t,v=Math.max(v,t)}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,t,n)}(n,h,m),b=e.getSymbolSize(n),w=new i(b);return function(t,e){const n=t.size,r=o.getPositions(e);for(let i=0;i<r.length;i++){const e=r[i][0],s=r[i][1];for(let r=-1;r<=7;r++)if(!(e+r<=-1||n<=e+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?t.set(e+r,s+i,!0,!0):t.set(e+r,s+i,!1,!0))}}(w,n),function(t){const e=t.size;for(let n=8;n<e-8;n++){const e=n%2==0;t.set(n,6,e,!0),t.set(6,n,e,!0)}}(w),function(t,e){const n=s.getPositions(e);for(let r=0;r<n.length;r++){const e=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?t.set(e+n,i+r,!0,!0):t.set(e+n,i+r,!1,!0)}}(w,n),f(w,h,0),n>=7&&function(t,e){const n=t.size,r=u.getEncodedBits(e);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),t.set(i,s,o,!0),t.set(s,i,o,!0)}(w,n),function(t,e){const n=t.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(!t.isReserved(i,a-n)){let r=!1;o<e.length&&(r=1==(e[o]>>>s&1)),t.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}}(t,g,y,m)}}),xV=o(t=>{function e(t){if("number"==typeof t&&(t=t.toString()),"string"!=typeof t)throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||5===e.length||e.length>8)throw new Error("Invalid hex color: "+t);3!==e.length&&4!==e.length||(e=Array.prototype.concat.apply([],e.map(function(t){return[t,t]}))),6===e.length&&e.push("F","F");const n=parseInt(e.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:"#"+e.slice(0,6).join("")}}t.getOptions=function(t){t||(t={}),t.color||(t.color={});const n=void 0===t.margin||null===t.margin||t.margin<0?4:t.margin,r=t.width&&t.width>=21?t.width:void 0,i=t.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:e(t.color.dark||"#000000ff"),light:e(t.color.light||"#ffffffff")},type:t.type,rendererOpts:t.rendererOpts||{}}},t.getScale=function(t,e){return e.width&&e.width>=t+2*e.margin?e.width/(t+2*e.margin):e.scale},t.getImageWidth=function(e,n){const r=t.getScale(e,n);return Math.floor((e+2*n.margin)*r)},t.qrToImageData=function(e,n,r){const i=n.modules.size,s=n.modules.data,o=t.getScale(i,r),a=Math.floor((i+2*r.margin)*o),l=r.margin*o,c=[r.color.light,r.color.dark];for(let t=0;t<a;t++)for(let n=0;n<a;n++){let u=4*(t*a+n),h=r.color.light;t>=l&&n>=l&&t<a-l&&n<a-l&&(h=c[s[Math.floor((t-l)/o)*i+Math.floor((n-l)/o)]?1:0]),e[u++]=h.r,e[u++]=h.g,e[u++]=h.b,e[u]=h.a}}}),CV=o(t=>{var e=xV();t.render=function(t,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(t){throw new Error("You need to specify a canvas element")}}()),i=e.getOptions(i);const o=e.getImageWidth(t.modules.size,i),a=s.getContext("2d"),l=a.createImageData(o,o);return e.qrToImageData(l.data,t,i),function(t,e,n){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=n,e.width=n,e.style.height=n+"px",e.style.width=n+"px"}(a,s,o),a.putImageData(l,0,0),s},t.renderToDataURL=function(e,n,r){let i=r;void 0!==i||n&&n.getContext||(i=n,n=void 0),i||(i={});const s=t.render(e,n,i),o=i.type||"image/png",a=i.rendererOpts||{};return s.toDataURL(o,a.quality)}}),SV=o(t=>{var e=xV();function n(t,e){const n=t.a/255,r=e+'="'+t.hex+'"';return n<1?r+" "+e+'-opacity="'+n.toFixed(2).slice(1)+'"':r}function r(t,e,n){let r=t+e;return void 0!==n&&(r+=" "+n),r}t.render=function(t,i,s){const o=e.getOptions(i),a=t.modules.size,l=t.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(t,e,n){let i="",s=0,o=!1,a=0;for(let l=0;l<t.length;l++){const c=Math.floor(l%e),u=Math.floor(l/e);c||o||(o=!0),t[l]?(a++,l>0&&c>0&&t[l-1]||(i+=o?r("M",c+n,.5+u+n):r("m",s,0),s=0,o=!1),c+1<e&&t[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}}),kV=o(t=>{var e=Jq(),n=_V(),r=CV(),i=SV();function s(t,r,i,s,o){const a=[].slice.call(arguments,1),l=a.length,c="function"==typeof a[l-1];if(!c&&!e())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(e,o){try{e(t(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 e=n.create(i,s);o(null,t(e,r,s))}catch(u){o(u)}}t.create=n.create,t.toCanvas=s.bind(null,r.render),t.toDataURL=s.bind(null,r.renderToDataURL),t.toString=s.bind(null,function(t,e,n){return i.render(t,n)})}),EV=c(kV(),1),RV=Xq((t,[e])=>{e&&EV.toCanvas(t,e,{width:256,margin:2,color:{dark:"#000000",light:"#ffffff"}}).catch(t=>{console.error("Failed to generate QR code",t)})}),TV=class extends vq{static{BF(this.prototype,"nostrAuth",[pp])}#N=void qF(this,"nostrAuth");static{BF(this.prototype,"toast",[pp])}#Mt=void qF(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(t){console.error(t),alert(t.message)}}static{$F(this.prototype,"connectExtension",[Vl])}async connectApp(){try{await this.nostrAuth.connectWithApp(),this.toast.show("Nostr connected successfully"),this.args.onConnect&&this.args.onConnect()}catch(t){console.error(t),alert(t.message)}}static{$F(this.prototype,"connectApp",[Vl])}async copyConnectUri(){const t=this.nostrAuth.connectUri;try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(t);else{const e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.opacity="0",document.body.appendChild(e),e.focus(),e.select();const n=document.execCommand("copy");if(document.body.removeChild(e),!n)throw new Error("Fallback copy failed")}this.toast.show("Connection link copied to clipboard")}catch(nD){console.error("Failed to copy text: ",nD),alert("Failed to copy link")}}static{$F(this.prototype,"copyConnectUri",[Vl])}static{Op(ig({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:Hw,eq:Gq,qrCode:RV}),isStrictMode:!0}),this)}},LV=Xq((t,[e])=>{t&&"number"==typeof e&&e>0&&requestAnimationFrame(()=>{t.scrollTop=e})}),IV=class extends vq{static{BF(this.prototype,"isNostrConnectModalOpen",[Wr],function(){return!1})}#Ht=void qF(this,"isNostrConnectModalOpen");openNostrConnectModal(t){t.preventDefault(),this.isNostrConnectModalOpen=!0}static{$F(this.prototype,"openNostrConnectModal",[Vl])}closeNostrConnectModal(){this.isNostrConnectModalOpen=!1}static{$F(this.prototype,"closeNostrConnectModal",[Vl])}onNostrConnected(){this.closeNostrConnectModal(),this.args.onNostrConnected?.()}static{$F(this.prototype,"onNostrConnected",[Vl])}static{Op(ig({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:Hw,Icon:wq,restoreScroll:LV,not:Zq,eq:Gq,ContributionPhoto:$q,Modal:Wq,NostrConnect:TV}),isStrictMode:!0}),this)}},PV=a({default:()=>MV}),MV=Op(ig({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:IV}),isStrictMode:!0}),qq()),AV=class{assert(){}async(t){Promise.resolve().then(t)}reportUncaughtRejection(){this.async(t=>{throw t})}defer(){let t={promise:null,resolve:null,reject:null};return t.promise=new Promise((e,n)=>{t.resolve=e,t.reject=n}),t}globalDebuggingEnabled(){return!1}},OV=new AV,NV=class{constructor(t){this.maxConcurrency=t||1}},FV="CANCELLED",zV="STARTED",DV="QUEUED",jV={type:zV},UV={type:DV},BV=t=>({type:FV,reason:t}),$V=BV("it belongs to a 'drop' Task that was already running"),qV=class{constructor(t){this.remainingSlots=t}step(){return this.remainingSlots>0?(this.remainingSlots--,jV):$V}},VV=class extends NV{makeReducer(){return new qV(this.maxConcurrency)}},WV=class{constructor(t){this.remainingSlots=t}step(){return this.remainingSlots>0?(this.remainingSlots--,jV):UV}},HV=class extends NV{makeReducer(){return new WV(this.maxConcurrency)}},GV=BV("it belongs to a 'keepLatest' Task that was already running"),ZV=class{constructor(t,e){this.remainingSlots=t,this.numToCancel=e}step(){return this.remainingSlots>0?(this.remainingSlots--,jV):this.numToCancel>0?(this.numToCancel--,GV):UV}},KV=class extends NV{makeReducer(t,e){let n=t+e;return new ZV(this.maxConcurrency,n-this.maxConcurrency-1)}},YV=BV("it belongs to a 'restartable' Task that was .perform()ed again"),XV=class{constructor(t){this.numToCancel=t}step(){return this.numToCancel>0?(this.numToCancel--,YV):jV}},JV=class extends NV{makeReducer(t,e){return new XV(t+e-this.maxConcurrency)}},QV=new class{step(){return jV}},tW=class{makeReducer(){return QV}},eW=new Map,nW=class{constructor(t,e,n){this.stateTracker=e,this.schedulerPolicy=t,this.initialTaskInstances=n,this.startingInstances=[]}process(){let[t,e,n]=this.filterFinishedTaskInstances(),r=this.schedulerPolicy.makeReducer(e,n),i=t.filter(t=>this.setTaskInstanceExecutionState(t,r.step()));return this.stateTracker.computeFinalStates(t=>this.applyState(t)),this.startingInstances.forEach(t=>t.start()),i}filterFinishedTaskInstances(){let t=0,e=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?t+=1:e+=1,!0)}),t,e]}setTaskInstanceExecutionState(t,e){let n=this.stateTracker.stateFor(t.task);switch(t.executor.counted||(t.executor.counted=!0,n.onPerformed(t)),e.type){case FV:return t.cancel(e.reason),!1;case zV:return t.executor.state.hasStarted||(this.startingInstances.push(t),n.onStart(t)),n.onRunning(t),!0;case DV:return n.onQueued(t),!0}}applyState(t){let{taskable:e}=t;if(!e.onState)return;const{guid:n}=e;if(eW.has(n)&&t.tag<eW.get(n))return;let r=Object.assign({numRunning:t.numRunning,numQueued:t.numQueued,numPerformedInc:t.numPerformedInc},t.attrs);e.onState(r,e),eW.set(n,t.tag)}},rW=class{constructor(t,e){this.taskable=t,this.numRunning=0,this.numQueued=0,this.numPerformedInc=0,this.attrs={},this.tag=e}onCompletion(t){let e=t.completionState;this.attrs.lastRunning=null,this.attrs.lastComplete=t,1===e?this.attrs.lastSuccessful=t:(2===e?this.attrs.lastErrored=t:3===e&&(this.attrs.lastCanceled=t),this.attrs.lastIncomplete=t)}onPerformed(t){this.numPerformedInc+=1,this.attrs.lastPerformed=t}onStart(t){this.attrs.last=t}onRunning(t){this.attrs.lastRunning=t,this.numRunning+=1}onQueued(){this.numQueued+=1}applyStateFrom(t){Object.assign(this.attrs,t.attrs),this.numRunning+=t.numRunning,this.numQueued+=t.numQueued,this.numPerformedInc+=t.numPerformedInc}},iW=new Map,sW=class{constructor(){this.states=new Map}stateFor(t){let e=t.guid,n=this.states.get(e);if(!n){let r=iW.has(e)?iW.get(e):0;n=new rW(t,++r),this.states.set(e,n),iW.set(e,r)}return n}computeFinalStates(t){this.forEachState(e=>t(e))}forEachState(t){this.states.forEach(e=>t(e))}},oW=new class{onCompletion(){}onPerformed(){}onStart(){}onRunning(){}onQueued(){}},aW=class{stateFor(){return oW}computeFinalStates(){}},lW=class{constructor(t,e){this.schedulerPolicy=t,this.stateTrackingEnabled=e,this.taskInstances=[]}cancelAll(t,e){let n=this.taskInstances.map(n=>{n.task.guids[t]&&n.executor.cancel(e)}).filter(t=>!!t);return Promise.all(n)}perform(t){t.onFinalize(()=>this.scheduleRefresh()),this.taskInstances.push(t),this.refresh()}scheduleRefresh(){Promise.resolve().then(()=>this.refresh())}refresh(){let t=this.stateTrackingEnabled?new sW:new aW,e=new nW(this.schedulerPolicy,t,this.taskInstances);this.taskInstances=e.process()}},cW=class{constructor(t,e,n){this.value=t,this.done=e,this.errored=n}},uW=class{constructor(t){this.done=!1,this.generatorFactory=t,this.iterator=null}step(t,e){try{let{value:n,done:r}=this.getIterator()[e](t);return r?this.finalize(n,!1):new cW(n,!1,!1)}catch(n){return this.finalize(n,!0)}}getIterator(){return this.iterator||this.done||(this.iterator=this.generatorFactory()),this.iterator}finalize(t,e){return this.done=!0,this.iterator=null,new cW(t,!0,e)}},hW="__ec_cancel__",dW="__ec_yieldable__",pW="next",fW="throw",gW="return",mW="cancel",yW=class{constructor(t,e){this._taskInstance=t,this._resumeIndex=e}getTaskInstance(){return this._taskInstance}cancel(){let t=this._taskInstance;t.proceed.call(t,this._resumeIndex,mW)}next(t){let e=this._taskInstance;e.proceed.call(e,this._resumeIndex,pW,t)}return(t){let e=this._taskInstance;e.proceed.call(e,this._resumeIndex,gW,t)}throw(t){let e=this._taskInstance;e.proceed.call(e,this._resumeIndex,fW,t)}},vW=class{constructor(){this[dW]=this[dW].bind(this)}onYield(){}_deferable(){let t={resolve:void 0,reject:void 0};return t.promise=new Promise((e,n)=>{t.resolve=e,t.reject=n}),t}_toPromise(){let t=this._deferable(),e=this[dW]({proceed(e,n,r){"next"==n||"return"==n?t.resolve(r):t.reject(r)}},0);return t.promise[hW]=e,t.promise}then(...t){return this._toPromise().then(...t)}catch(...t){return this._toPromise().catch(...t)}finally(...t){return this._toPromise().finally(...t)}[dW](t,e){let n=new yW(t,e);return this.onYield(n)}},bW=(new class extends vW{onYield(){}},{completionState:0,value:null,error:null,isSuccessful:!1,isError:!1,isCanceled:!1,hasStarted:!1,isFinished:!1}),wW=class{constructor(t,e){this.kind=t,this.reason=e,this.promise=new Promise(t=>{this.finalize=t})}},_W={},xW=[],CW=class{constructor({generatorFactory:t,env:e,debug:n}){this.generatorState=new uW(t),this.state=Object.assign({},bW),this.index=1,this.disposers=[],this.finalizeCallbacks=[],this.env=e,this.debug=n,this.cancelRequest=null}start(){this.state.hasStarted||this.cancelRequest||(this.setState({hasStarted:!0}),this.proceedSync(pW,void 0))}cancel(t){return this.requestCancel(t)?(this.state.hasStarted?this.proceedWithCancelAsync():this.finalizeWithCancel(),this.cancelRequest.promise):(t.finalize(),t.promise)}setState(t){Object.assign(this.state,t),this.taskInstance.setState(this.state)}proceedChecked(t,e,n){this.state.isFinished||this.advanceIndex(t)&&("cancel"===e?(this.requestCancel(new wW("yielded"),n),this.proceedWithCancelAsync()):this.proceedAsync(e,n))}proceedWithCancelAsync(){this.proceedAsync(gW,_W)}proceedAsync(t,e){this.advanceIndex(this.index),this.env.async(()=>this.proceedSync(t,e))}proceedSync(t,e){this.state.isFinished||(this.dispose(),this.generatorState.done?this.handleResolvedReturnedValue(t,e):this.handleResolvedContinueValue(t,e))}handleResolvedContinueValue(t,e){let n=this.index,r=this.generatorStep(e,t);this.advanceIndex(n)&&(r.errored?this.finalize(r.value,2):this.handleYieldedValue(r))}handleResolvedReturnedValue(t,e){switch(t){case pW:case gW:this.finalize(e,1);break;case fW:this.finalize(e,2)}}handleYieldedUnknownThenable(t){let e=this.index;t.then(t=>{this.proceedChecked(e,pW,t)},t=>{this.proceedChecked(e,fW,t)})}advanceIndex(t){if(this.index===t)return++this.index}handleYieldedValue(t){let e=t.value;e?(this.addDisposer(e[hW]),e.__ec_yieldable__?this.invokeYieldable(e):"function"==typeof e.then?this.handleYieldedUnknownThenable(e):this.proceedWithSimpleValue(e)):this.proceedWithSimpleValue(e)}proceedWithSimpleValue(t){this.proceedAsync(pW,t)}addDisposer(t){"function"==typeof t&&this.disposers.push(t)}dispose(){let t=this.disposers;0!==t.length&&(this.disposers=[],t.forEach(t=>t()))}generatorStep(t,e){xW.push(this);let n=this.generatorState.step(t,e);if(xW.pop(),this._expectsLinkedYield){let t=n.value;t&&"PERFORM_TYPE_LINKED"===t.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(t){this.finalizeCallbacks.push(t),this.state.isFinished&&this.runFinalizeCallbacks()}runFinalizeCallbacks(){this.finalizeCallbacks.forEach(t=>t()),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 t;this.asyncErrorsHandled||2!==this.state.completionState||(t=this.state.error)&&"TaskCancelation"===t.name||this.env.async(()=>{this.asyncErrorsHandled||this.env.reportUncaughtRejection(this.state.error)})}requestCancel(t){return!this.cancelRequest&&!this.state.isFinished&&(this.cancelRequest=t,!0)}finalize(t,e){if(this.cancelRequest)return this.finalizeWithCancel();let n={completionState:e};1===e?(n.isSuccessful=!0,n.value=t):2===e?(n.isError=!0,n.error=t):3===e&&(n.error=t),this.finalizeShared(n)}finalizeWithCancel(){let t=this.taskInstance.formatCancelReason(this.cancelRequest.reason),e=new Error(t);this.debugEnabled()&&console.log(t),e.name="TaskCancelation",this.finalizeShared({isCanceled:!0,completionState:3,error:e,cancelReason:t}),this.cancelRequest.finalize()}debugEnabled(){return this.debug||this.env.globalDebuggingEnabled()}finalizeShared(t){this.index++,t.isFinished=!0,this.setState(t),this.runFinalizeCallbacks()}invokeYieldable(t){try{let e=t[dW](this.taskInstance,this.index);this.addDisposer(e)}catch(e){this.env.reportUncaughtRejection(e)}}onYielded(t,e){this.asyncErrorsHandled=!0,this.onFinalize(()=>{let n=this.state.completionState;1===n?t.proceed(e,pW,this.state.value):2===n?t.proceed(e,fW,this.state.error):3===n&&t.proceed(e,mW,null)});let n=this.getPerformType();if("PERFORM_TYPE_UNLINKED"!==n)return()=>{this.detectSelfCancelLoop(n,t),this.cancel(new wW("parent_cancel"))}}getPerformType(){return this.taskInstance.performType||"PERFORM_TYPE_DEFAULT"}detectSelfCancelLoop(t,e){if("PERFORM_TYPE_DEFAULT"!==t)return;let n=e.executor&&e.executor.cancelRequest;!n||"lifespan_end"!==n.kind||this.cancelRequest||this.state.isFinished||this.taskInstance.selfCancelLoopWarning(e)}},SW={last:null,lastRunning:null,lastPerformed:null,lastSuccessful:null,lastComplete:null,lastErrored:null,lastCanceled:null,lastIncomplete:null,performCount:0};Object.freeze(SW);var kW=0,EW=class{constructor(t){this.context=t.context,this.debug=t.debug||!1,this.enabledModifiers=t.enabledModifiers,this.env=t.env,this.group=t.group,this.hasEnabledEvents=t.hasEnabledEvents,this.modifierOptions=t.modifierOptions,this.name=t.name,this.onStateCallback=t.onStateCallback,this.scheduler=t.scheduler,this.guid="ec_"+kW++,this.guids={},this.guids[this.guid]=!0,this.group&&Object.assign(this.guids,this.group.guids)}cancelAll(t){let{reason:e,cancelRequestKind:n,resetState:r}=t||{};e=e||".cancelAll() was explicitly called on the Task";let i=new wW(n||"explicit",e);return this.scheduler.cancelAll(this.guid,i).then(()=>{r&&this._resetState()})}get _isAlive(){return!0}_resetState(){this.setState(SW)}setState(){}};Object.assign(EW.prototype,SW),Object.assign(EW.prototype,{numRunning:0,numQueued:0,isRunning:!1,isQueued:!1,isIdle:!0,state:"idle"});var RW,TW,LW=class{constructor(t,e,n){this.task=t,this.performType=e,this.linkedObject=n}perform(...t){return this.task._performShared(t,this.performType,this.linkedObject)}},IW=class t extends EW{constructor(t){super(t),this.generatorFactory=t.generatorFactory,this.perform=this._perform.bind(this)}linked(){let t=xW[xW.length-1];if(!t)throw new Error("You can only call .linked() from within a task.");return new LW(this,"PERFORM_TYPE_LINKED",t)}unlinked(){return new LW(this,"PERFORM_TYPE_UNLINKED",null)}toString(){return`<Task:${this.name}>`}_clone(){return new t({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(...t){let e=this._clone();return e._curryArgs=[...this._curryArgs||[],...t],e}_perform(...t){return this._performShared(t,"PERFORM_TYPE_DEFAULT",null)}_performShared(t,e,n){let r=this._curryArgs?[...this._curryArgs,...t]:t,i=this._taskInstanceFactory(r,e,n);return"PERFORM_TYPE_LINKED"===e&&(n._expectsLinkedYield=!0),this._isAlive||i.cancel(),this.scheduler.perform(i),i}_taskInstanceOptions(t,e,n){return{args:t,executor:new CW({generatorFactory:()=>this.generatorFactory(t),env:this.env,debug:this.debug}),performType:e,hasEnabledEvents:this.hasEnabledEvents}}},PW={enqueue:(t,e)=>e&&t.setBufferPolicy(HV),debug:(t,e)=>e&&t.setDebug(e),drop:(t,e)=>e&&t.setBufferPolicy(VV),keepLatest:(t,e)=>e&&t.setBufferPolicy(KV),maxConcurrency:(t,e)=>t.setMaxConcurrency(e),onState:(t,e)=>t.setOnState(e),restartable:(t,e)=>e&&t.setBufferPolicy(JV)},MW=class{env=OV;_debug=null;_enabledModifiers=[];_hasSetConcurrencyConstraint=!1;_hasSetBufferPolicy=!1;_hasEnabledEvents=!1;_maxConcurrency=null;_onStateCallback=(t,e)=>e.setState(t);_schedulerPolicyClass=tW;constructor(t="<unknown>",e=null,n={}){this.name=t,this.taskDefinition=e,this.options=n,this._processModifierOptions(n)}createTask(t){let e=this.getTaskOptions(t);return new IW(Object.assign({generatorFactory:e=>this.taskDefinition.apply(t,e)},e))}getModifier(t){if(function(t){return t in PW}(t))return PW[t].bind(null,this)}getOptions(){return this.options}getScheduler(t,e){return new lW(t,e)}getTaskOptions(t){let e,n=this._onStateCallback,r=new this._schedulerPolicyClass(this._maxConcurrency);return e=this.getScheduler(r,n&&"function"==typeof n),{context:t,debug:this._debug,env:this.env,name:this.name,group:void 0,scheduler:e,hasEnabledEvents:this._hasEnabledEvents,onStateCallback:n,enabledModifiers:this._enabledModifiers,modifierOptions:this.getOptions()}}setBufferPolicy(t){return function(t){if(t._hasSetBufferPolicy)throw new Error(`Cannot set multiple buffer policies on a task. ${t._schedulerPolicyClass} has already been set for task '${t.name}'`)}(this),this._hasSetBufferPolicy=!0,this._hasSetConcurrencyConstraint=!0,this._schedulerPolicyClass=t,this}setDebug(t){return this._debug=t,this}setEvented(t){return this._hasEnabledEvents=t,this}setMaxConcurrency(t){return this._hasSetConcurrencyConstraint=!0,this._maxConcurrency=t,this}setName(t){return this.name=t,this}setOnState(t){return this._onStateCallback=t,this}setTaskDefinition(t){return this.taskDefinition=t,this}_processModifierOptions(t){if(t)for(let e of Object.keys(t)){let n=t[e],r=this.getModifier(e);"function"==typeof r&&r(n)&&this._enabledModifiers.push(e)}}},AW=a({EventTarget:()=>No,Promise:()=>ia,all:()=>la,allSettled:()=>ua,asap:()=>Ra,async:()=>Da,cast:()=>za,configure:()=>zo,default:()=>Ba,defer:()=>ya,denodeify:()=>oa,filter:()=>Sa,hash:()=>pa,hashSettled:()=>ga,map:()=>ba,off:()=>Ua,on:()=>ja,race:()=>ha,reject:()=>_a,resolve:()=>wa,rethrow:()=>ma}),OW=new class extends AV{assert(...t){}async(t){xs(()=>Es("actions",t))}reportUncaughtRejection(t){Ms(null,function(){throw t})}defer(){return ya()}globalDebuggingEnabled(){return!1}},NW=class extends lW{scheduleRefresh(){Is(this,this.refresh)}},FW=class{constructor({task:t,args:e,executor:n,performType:r,hasEnabledEvents:i}){this.task=t,this.args=e,this.performType=r,this.executor=n,this.executor.taskInstance=this,this.hasEnabledEvents=i}setState(){}formatCancelReason(){}selfCancelLoopWarning(){}onFinalize(t){this.executor.onFinalize(t)}proceed(t,e,n){this.executor.proceedChecked(t,e,n)}[dW](t,e){return this.executor.onYielded(t,e)}cancel(t=".cancel() was explicitly called"){this.executor.cancel(new wW("explicit",t))}then(...t){return this.executor.promise().then(...t)}catch(...t){return this.executor.promise().catch(...t)}finally(...t){return this.executor.promise().finally(...t)}toString(){return`${this.task} TaskInstance`}start(){return this.executor.start(),this}};function zW(t,e){return Object.keys(t).reduce((e,n)=>function(t,e,n){const r=Object.getOwnPropertyDescriptor(t,n);return r.initializer=r.initializer||(()=>t[n]),delete r.value,e[n]=Wr(e,n,r),e}(t,e,n),e)}Object.assign(FW.prototype,bW),Object.assign(FW.prototype,{state:"waiting",isDropped:!1,isRunning:!0}),RW=zW(SW,{}),RW=zW({numRunning:0,numQueued:0,isRunning:!1,isQueued:!1,isIdle:!0,state:"idle"},RW),TW=zW(bW,{}),TW=zW({state:"waiting",isDropped:!1,isRunning:!1},TW),Object.freeze(RW),Object.freeze(TW);var DW=class extends FW{setState(t){let e=this._recomputeState(t);Object.assign(this,{...t,isRunning:!t.isFinished,isDropped:"dropped"===e,state:e})}_recomputeState(t){return t.isDropped?"dropped":t.isCanceled?t.hasStarted?"canceled":"dropped":t.isFinished?"finished":t.hasStarted?"running":"waiting"}formatCancelReason(t){return`TaskInstance '${this.getName()}' was canceled because ${t}. 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(t){let e=`\`${t.getName()}\``,n=`\`${this.getName()}\``;console.warn(`ember-concurrency detected a potentially hazardous "self-cancel loop" between parent task ${e} and child task ${n}. If you want child task ${n} to be canceled when parent task ${e} is canceled, please change \`.perform()\` to \`.linked().perform()\`. If you want child task ${n} to keep running after parent task ${e} is canceled, change it to \`.unlinked().perform()\``)}triggerEvent(...t){if(!this.hasEnabledEvents)return;let e=this.task,n=e.context,r=e&&e.name;if(n&&n.trigger&&r){let[e,...i]=t;n.trigger(`${r}:${e}`,...i)}}};TW&&Object.defineProperties(DW.prototype,TW);var jW={_performCount:0,setState(t){this._performCount=this._performCount+(t.numPerformedInc||0);let e=t.numRunning>0,n=t.numQueued>0,r=Object.assign({},t,{performCount:this._performCount,isRunning:e,isQueued:n,isIdle:!e&&!n,state:e?"running":"idle"});Object.assign(this,r)},onState(t,e){e.onStateCallback&&e.onStateCallback(t,e)}},UW=class t extends IW{constructor(t){super(t),it(this.context)||Rx(this.context,()=>{this.cancelAll({reason:"the object it lives on was destroyed or unrendered",cancelRequestKind:"lifespan_end"})})}get _isAlive(){return!it(this.context)}_taskInstanceFactory(t,e,n){let r=this._taskInstanceOptions(t,e,n);return r.task=this,new DW(r)}_clone(){return new t({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})}};RW&&Object.defineProperties(UW.prototype,RW),Object.assign(UW.prototype,jW);var BW=class extends MW{env=OW;createTask(t){this.taskDefinition;let e=this.getTaskOptions(t);return new UW(Object.assign({generatorFactory:e=>this.taskDefinition.apply(t,e)},e))}getModifier(t){return super.getModifier(t)}getScheduler(t,e){return new NW(t,e)}get taskFn(){return this.taskDefinition}set taskFn(t){this.setTaskDefinition(t)}};function $W(t,e,n,r){let i=e;r&&(i=Object.assign({},i),i[r]=!0);const s=t();return new BW(n||"<unknown>",s.generator,i).createTask(s.context)}var qW=a({default:()=>VW}),VW=class extends eu{static{BF(this.prototype,"router",[pp])}#Gt=void qF(this,"router");static{BF(this.prototype,"mapUi",[pp])}#Zt=void qF(this,"mapUi");static{BF(this.prototype,"nostrAuth",[pp])}#N=void qF(this,"nostrAuth");static{BF(this.prototype,"contributions",[pp])}#Kt=void qF(this,"contributions");static{BF(this.prototype,"storage",[pp])}#U=void qF(this,"storage");loadContributionsTask=$W(()=>({context:this,generator:function*(t){t&&(yield this.contributions.load(t))}}),{restartable:!0},"loadContributionsTask",null);get scrollTop(){return this.mapUi.getScrollPosition("contributions")}get items(){return this.contributions.items}get isConnected(){return this.nostrAuth.isConnected}selectContribution(t){if(!t)return;const e=document.querySelector(".sidebar-content");e&&this.mapUi.saveScrollPosition("contributions",e.scrollTop),this.mapUi.returnToRoute={name:"contributions"},this.mapUi.showSidebar(),this.mapUi.preventNextZoom=!0,this.router.transitionTo(`/place/${t.placeIdentifier}`)}static{$F(this.prototype,"selectContribution",[Vl])}onNostrConnected(){this.loadContributionsTask.perform(this.nostrAuth.pubkey)}static{$F(this.prototype,"onNostrConnected",[Vl])}backToMenu(){this.router.transitionTo("menu")}static{$F(this.prototype,"backToMenu",[Vl])}close(){this.router.transitionTo("index")}static{$F(this.prototype,"close",[Vl])}},WW=a({default:()=>HW}),HW=class extends Qh{static{BF(this.prototype,"mapUi",[pp])}#Zt=void qF(this,"mapUi");static{BF(this.prototype,"nostrAuth",[pp])}#N=void qF(this,"nostrAuth");static{BF(this.prototype,"contributions",[pp])}#Kt=void qF(this,"contributions");activate(){this.mapUi.showSidebar()}setupController(t,e){super.setupController(t,e),t&&t.loadContributionsTask&&t.loadContributionsTask.perform(this.nostrAuth.pubkey)}deactivate(){this.contributions.stop()}},GW=a({default:()=>ZW}),ZW=Op(ig({id:null,block:'[[[46,[28,[31,1],null,null],null,null,null]],[],["component","-outlet"]]',moduleName:"(unknown template module)",isStrictMode:!0}),qq()),KW=a({default:()=>YW}),YW=class extends Qh{static{BF(this.prototype,"mapUi",[pp])}#Zt=void qF(this,"mapUi");activate(){this.mapUi.showSidebar()}},XW=class extends vq{static{BF(this.prototype,"title",[Wr],function(){return""})}#Yt=void qF(this,"title");static{BF(this.prototype,"description",[Wr],function(){return""})}#Xt=void qF(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(t){t.preventDefault(),this.args.onSave&&this.args.onSave({title:this.title,description:this.description})}static{$F(this.prototype,"handleSubmit",[Vl])}updateTitle(t){this.title=t.target.value}static{$F(this.prototype,"updateTitle",[Vl])}updateDescription(t){this.description=t.target.value}static{$F(this.prototype,"updateDescription",[Vl])}static{Op(ig({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:Hw}),isStrictMode:!0}),this)}},JW=Xq((t,[e])=>{const n=n=>{t&&!t.contains(n.target)&&e(n)},r=setTimeout(()=>{document.addEventListener("click",n)},0);return()=>{clearTimeout(r),document.removeEventListener("click",n)}}),QW=class extends vq{static{BF(this.prototype,"storage",[pp])}#U=void qF(this,"storage");static{BF(this.prototype,"router",[pp])}#Gt=void qF(this,"router");static{BF(this.prototype,"_forceClear",[Wr],function(){return!1})}#Jt=void qF(this,"_forceClear");get isSaved(){return this.args.isSaved}get placeListIds(){return this._forceClear?[]:this.args.place._listIds||[]}styleFor(t){return qv(`background-color: ${t}`)}isInList(t){return!!this.placeListIds&&this.placeListIds.includes(t.id)}static{$F(this.prototype,"isInList",[Vl])}async toggleSaved(){if(this.isSaved){const{osmId:t,osmType:e}=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),t&&e){const t={...this.args.place};delete t.id,delete t.createdAt,delete t._listIds,this.router.transitionTo("place",t)}else this.router.transitionTo("index");this.args.onClose&&this.args.onClose()}else await this.storage.storePlace(this.args.place)}static{$F(this.prototype,"toggleSaved",[Vl])}async toggleList(t){const e=!this.placeListIds.includes(t.id);e&&!this.isSaved&&await this.storage.storePlace(this.args.place);try{await this.storage.togglePlaceList(this.args.place,t.id,e)}catch(n){console.error(n),alert("Failed to update list: "+n.message)}}static{$F(this.prototype,"toggleList",[Vl])}static{Op(ig({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:JW,on:Hw,fn:zq}),isStrictMode:!0}),this)}},tH=class extends vq{renderBlurhash=Xq((t,[e,n,r])=>{if(!e||!t)return;const i=n||32,s=r||18;t.width=i,t.height=s;const o=t.getContext("2d");if(o)try{const t=((t,e,n)=>{(t=>{if(!t||t.length<6)throw new z$("The blurhash string must be at least 6 characters");let e=M$(t[0]),n=Math.floor(e/9)+1,r=e%9+1;if(t.length!==4+2*r*n)throw new z$(`blurhash length mismatch: length is ${t.length} but it should be ${4+2*r*n}`)})(t);let r=M$(t[0]),i=Math.floor(r/9)+1,s=r%9+1,o=(M$(t[1])+1)/166,a=new Array(s*i);for(let u=0;u<a.length;u++)if(0===u){let e=M$(t.substring(2,6));a[u]=D$(e)}else{let e=M$(t.substring(4+2*u,6+2*u));a[u]=j$(e,1*o)}let l=4*e,c=new Uint8ClampedArray(l*n);for(let u=0;u<n;u++)for(let t=0;t<e;t++){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*t*i/e)*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=N$(r),p=N$(o),f=N$(h);c[4*t+0+u*l]=d,c[4*t+1+u*l]=p,c[4*t+2+u*l]=f,c[4*t+3+u*l]=255}return c})(e,i,s),n=o.createImageData(i,s);n.data.set(t),o.putImageData(n,0,0)}catch(a){console.warn("Failed to decode blurhash:",a.message||a)}});static{Op(ig({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)}},eH=class extends vq{static{BF(this.prototype,"blossom",[pp])}#Qt=void qF(this,"blossom");static{BF(this.prototype,"imageProcessor",[pp])}#te=void qF(this,"imageProcessor");static{BF(this.prototype,"toast",[pp])}#Mt=void qF(this,"toast");static{BF(this.prototype,"thumbnailUrl",[Wr],function(){return""})}#ee=void qF(this,"thumbnailUrl");static{BF(this.prototype,"blurhash",[Wr],function(){return""})}#ne=void qF(this,"blurhash");static{BF(this.prototype,"error",[Wr],function(){return""})}#re=void qF(this,"error");static{BF(this.prototype,"statusText",[Wr],function(){return""})}#ie=void qF(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{$F(this.prototype,"showErrorToast",[Vl])}uploadTask=$W(()=>({context:this,generator:function*(t){this.error="",this.statusText="Processing";try{const e=yield this.imageProcessor.process(t,1920,.9,!0);this.blurhash=e.blurhash;const n=yield this.imageProcessor.process(t,350,.9,!1);let r,i;const s=ND(),o=t=>{"signing"===t&&(this.statusText="Signing photo upload"),"uploading"===t&&(this.statusText="Uploading photo")},a=t=>{"signing"===t&&(this.statusText="Signing thumbnail upload"),"uploading"===t&&(this.statusText="Uploading thumbnail")};if(s)r=yield this.blossom.upload(e.blob,{sequential:!0,onProgress:o}),i=yield this.blossom.upload(n.blob,{sequential:!0,onProgress:a});else{const t=this.blossom.upload(e.blob,{onProgress:o}),s=this.blossom.upload(n.blob,{onProgress:a});[r,i]=yield Promise.all([t,s])}this.args.onSuccess&&this.args.onSuccess({file:t,url:r.url,fallbackUrls:r.fallbackUrls,thumbUrl:i.url,blurhash:e.blurhash,type:"image/jpeg",dim:e.dim,hash:r.hash,thumbHash:i.hash})}catch(e){this.error=e.message}}}),null,"uploadTask",null);static{Op(ig({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:tH,Icon:wq,on:Hw,fn:zq}),isStrictMode:!0}),this)}},nH=Eb(function([t]){return kB(t)}),rH=Eb(function([t,e]){return!!Array.isArray(t)&&t.includes(e)}),iH=class extends vq{static{BF(this.prototype,"nostrAuth",[pp])}#N=void qF(this,"nostrAuth");static{BF(this.prototype,"nostrRelay",[pp])}#at=void qF(this,"nostrRelay");static{BF(this.prototype,"nostrData",[pp])}#F=void qF(this,"nostrData");static{BF(this.prototype,"blossom",[pp])}#Qt=void qF(this,"blossom");static{BF(this.prototype,"toast",[pp])}#Mt=void qF(this,"toast");static{BF(this.prototype,"file",[Wr],function(){return null})}#se=void qF(this,"file");static{BF(this.prototype,"uploadedPhoto",[Wr],function(){return null})}#oe=void qF(this,"uploadedPhoto");static{BF(this.prototype,"error",[Wr],function(){return""})}#re=void qF(this,"error");static{BF(this.prototype,"isPublishing",[Wr],function(){return!1})}#ae=void qF(this,"isPublishing");static{BF(this.prototype,"isDragging",[Wr],function(){return!1})}#le=void qF(this,"isDragging");static{BF(this.prototype,"selectedTags",[Wr],function(){return[]})}#ce=void qF(this,"selectedTags");static{BF(this.prototype,"altText",[Wr],function(){return""})}#ue=void qF(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 w$(this.place)}handleFileSelect(t){this.addFile(t.target.files[0]),t.target.value=""}static{$F(this.prototype,"handleFileSelect",[Vl])}handleDragOver(t){t.preventDefault(),this.isDragging=!0}static{$F(this.prototype,"handleDragOver",[Vl])}handleDragLeave(t){t.preventDefault(),this.isDragging=!1}static{$F(this.prototype,"handleDragLeave",[Vl])}handleDrop(t){t.preventDefault(),this.isDragging=!1,t.dataTransfer.files.length>0&&this.addFile(t.dataTransfer.files[0])}static{$F(this.prototype,"handleDrop",[Vl])}addFile(t){t&&t.type.startsWith("image/")?(this.error="",this.uploadedPhoto&&this.deletePhotoTask.perform(this.uploadedPhoto),this.file=t,this.uploadedPhoto=null,this.args.onUploadStateChange&&this.args.onUploadStateChange(!0)):this.error="Please select a valid image file."}handleUploadSuccess(t){this.uploadedPhoto=t}static{$F(this.prototype,"handleUploadSuccess",[Vl])}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{$F(this.prototype,"removeFile",[Vl])}toggleTag(t){this.selectedTags.includes(t)?this.selectedTags=[]:this.selectedTags=[t]}static{$F(this.prototype,"toggleTag",[Vl])}updateAltText(t){this.altText=t.target.value}static{$F(this.prototype,"updateAltText",[Vl])}deletePhotoTask=$W(()=>({context:this,generator:function*(t){try{t.hash&&(yield this.blossom.delete(t.hash)),t.thumbHash&&(yield this.blossom.delete(t.thumbHash))}catch(e){this.toast.show(`Failed to delete photo from server: ${e.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:t,lat:e,lon:n}=this.place,r=this.place.osmType||"node";if(t){this.error="",this.isPublishing=!0;try{const i=[["i",`osm:${r}:${t}`]];for(const t of this.selectedTags)i.push(["t",t]);e&&n&&(i.push(["g",mU.encode(e,n,4)]),i.push(["g",mU.encode(e,n,6)]),i.push(["g",mU.encode(e,n,7)]),i.push(["g",mU.encode(e,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 t of s.fallbackUrls)o.push(`fallback ${t}`);s.thumbUrl&&o.push(`thumb ${s.thumbUrl}`),s.blurhash&&o.push(`blurhash ${s.blurhash}`),i.push(o);const l=await QN.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{$F(this.prototype,"publish",[Vl])}static{Op(ig({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:eH,includes:rH,on:Hw,fn:zq,capitalize:nH,or:Uq,not:Zq,Icon:wq}),isStrictMode:!0}),this)}},sH=Xq((t,[e])=>{if(!e)return;let n;t.classList.remove("loaded"),t.classList.remove("loaded-instant");const r=()=>{const e=t.parentElement,n=e&&"PICTURE"===e.tagName?e.parentElement:e;if(n&&n.closest(".photo-carousel.gallery-main")){const t=n.querySelector(".place-header-photo-blur");t&&(t.style.opacity="0")}},i=()=>{t.classList.contains("loaded-instant")||t.classList.add("loaded"),r()};return t.addEventListener("load",i),n=new IntersectionObserver((n,i)=>{n.forEach(n=>{if(n.isIntersecting){i.unobserve(t);const n=new Image;n.src=e,n.complete&&(t.classList.add("loaded-instant"),r());const s=t.parentElement;s&&"PICTURE"===s.tagName&&s.querySelectorAll("source").forEach(t=>{t.dataset.srcset&&(t.srcset=t.dataset.srcset)}),t.dataset.src?t.src=t.dataset.src:t.src=e}})},{root:null,rootMargin:"100px 100%",threshold:0}),n.observe(t),()=>{t.removeEventListener("load",i),n&&n.disconnect()}}),oH=class extends vq{static{BF(this.prototype,"canScrollLeft",[Wr],function(){return!1})}#he=void qF(this,"canScrollLeft");static{BF(this.prototype,"canScrollRight",[Wr],function(){return!1})}#de=void qF(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=Xq((t,[e])=>{void 0!==e&&e!==this.lastResetKey&&(this.lastResetKey=e,t.scrollLeft=0,setTimeout(()=>this.updateScrollState(),50))});isProgrammaticScroll=!1;scrollToNewPhoto=Xq((t,[e])=>{if(e&&e!==this.lastEventId){const n=!this.lastEventId;if(this.lastEventId=e,this.internalEventId===e)return;this.internalEventId=e,this.isProgrammaticScroll=!0;const r=()=>{const r=t.querySelector(`[data-event-id="${e}"]`);if(r)if(n){const e=t.style.scrollBehavior;t.style.scrollBehavior="auto",t.scrollLeft=r.offsetLeft,setTimeout(()=>{t.style.scrollBehavior=e,this.isProgrammaticScroll=!1},50)}else t.scrollLeft=r.offsetLeft,setTimeout(()=>{this.isProgrammaticScroll=!1},500);else this.isProgrammaticScroll=!1};n?r():setTimeout(r,100)}});setupCarousel=Xq(t=>{let e,n;return this.carouselElement=t,setTimeout(()=>{this.updateScrollState()},50),window.ResizeObserver&&(e=new ResizeObserver(()=>this.updateScrollState()),e.observe(t)),this.args.onVisiblePhotoChange&&window.IntersectionObserver&&"test"!==ix.environment&&(n=new IntersectionObserver(t=>{if(!this.isProgrammaticScroll)for(let e of t)if(e.isIntersecting&&e.intersectionRatio>=.5){const t=e.target.dataset.eventId;this.internalEventId=t;const n=this.photos.find(e=>e.eventId===t);n&&this.args.onVisiblePhotoChange(n)}},{root:t,threshold:.5}),t.querySelectorAll(".carousel-slide").forEach(t=>n.observe(t))),()=>{e&&e.unobserve(t),n&&n.disconnect()}});updateScrollState(){if(!this.carouselElement)return;const{scrollLeft:t,scrollWidth:e,clientWidth:n}=this.carouselElement;this.canScrollLeft=t>1,this.canScrollRight=t+n<e-1}static{$F(this.prototype,"updateScrollState",[Vl])}scrollLeft(){this.carouselElement&&this.carouselElement.scrollBy({left:-this.carouselElement.clientWidth,behavior:"smooth"})}static{$F(this.prototype,"scrollLeft",[Vl])}scrollRight(){this.carouselElement&&this.carouselElement.scrollBy({left:this.carouselElement.clientWidth,behavior:"smooth"})}static{$F(this.prototype,"scrollRight",[Vl])}handlePhotoClick(t){this.args.onPhotoClick&&this.args.onPhotoClick(t)}static{$F(this.prototype,"handlePhotoClick",[Vl])}static{Op(ig({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:Hw,and:Hq,eq:Gq,fn:zq,Blurhash:tH,fadeInImage:sH,Icon:wq}),isStrictMode:!0}),this)}},aH=class extends vq{static{BF(this.prototype,"isOpen",[Wr],function(){return!1})}#pe=void qF(this,"isOpen");toggleMenu(t){t?.stopPropagation(),this.isOpen=!this.isOpen}static{$F(this.prototype,"toggleMenu",[Vl])}closeMenu(t){t?.stopPropagation(),this.isOpen=!1}static{$F(this.prototype,"closeMenu",[Vl])}get triggerIcon(){return this.args.triggerIcon||"more-vertical"}static{Op(ig({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:Hw,Icon:wq}),isStrictMode:!0}),this)}},lH=1e5,cH=Math.round((Math.log(100)-Math.log(10))/(Math.log(lH)-Math.log(10))*200),uH=class extends vq{static{BF(this.prototype,"nostrZap",[pp])}#fe=void qF(this,"nostrZap");static{BF(this.prototype,"nostrAuth",[pp])}#N=void qF(this,"nostrAuth");static{BF(this.prototype,"nostrData",[pp])}#F=void qF(this,"nostrData");static{BF(this.prototype,"toast",[pp])}#Mt=void qF(this,"toast");static{BF(this.prototype,"step",[Wr],function(){return"select-amount"})}#ge=void qF(this,"step");static{BF(this.prototype,"sliderPosition",[Wr],function(){return cH})}#me=void qF(this,"sliderPosition");static{BF(this.prototype,"message",[Wr],function(){return""})}#qt=void qF(this,"message");static{BF(this.prototype,"error",[Wr],function(){return null})}#re=void qF(this,"error");static{BF(this.prototype,"invoice",[Wr],function(){return null})}#ye=void qF(this,"invoice");static{BF(this.prototype,"lightningAddress",[Wr],function(){return null})}#ve=void qF(this,"lightningAddress");static{BF(this.prototype,"lnurlEndpoint",[Wr],function(){return null})}#be=void qF(this,"lnurlEndpoint");static{BF(this.prototype,"lnurlLoading",[Wr],function(){return!1})}#we=void qF(this,"lnurlLoading");static{BF(this.prototype,"lnurlError",[Wr],function(){return null})}#_e=void qF(this,"lnurlError");static{BF(this.prototype,"paymentNotDetected",[Wr],function(){return!1})}#xe=void qF(this,"paymentNotDetected");sliderSteps=200;sliderTicks=["10","100","1k","10k","100k"];_receiptSub=null;_receiptTimeout=null;_zapRequest=null;RECEIPT_TIMEOUT_MS=3e5;constructor(){super(...arguments),this._loadLightningInfo()}get photo(){return this.args.photo}get hasWebLN(){return this.nostrZap.hasWebLN()}get effectiveAmount(){return function(t){const e=t/200;return Math.round(Math.exp(Math.log(10)+(Math.log(lH)-Math.log(10))*e))}(this.sliderPosition)}get amountMsats(){return 1e3*this.effectiveAmount}get formattedAmount(){return this.effectiveAmount.toLocaleString()}get cannotZap(){return!this.canZap}get canZap(){return!!this.lnurlEndpoint&&!this.lnurlError&&!(this.effectiveAmount<=0)&&this.amountMsats>=this.lnurlEndpoint.minSendable&&this.amountMsats<=this.lnurlEndpoint.maxSendable}get minSats(){return this.lnurlEndpoint?Math.ceil(this.lnurlEndpoint.minSendable/1e3):1}get maxSats(){return this.lnurlEndpoint?Math.floor(this.lnurlEndpoint.maxSendable/1e3):lH}get lightningUri(){return this.invoice?`lightning:${this.invoice}`:""}get parsedInvoice(){if(!this.invoice)return null;try{return this.nostrZap.parseInvoice(this.invoice)}catch{return null}}async _loadLightningInfo(){const t=this.photo?.pubkey;if(!t)return;this.nostrZap.loadRecipientRelays(t).catch(()=>{});const e=this.nostrZap.getLightningAddress(t);if(e){this.lightningAddress=e,this.lnurlLoading=!0,this.lnurlError=null;try{this.lnurlEndpoint=await this.nostrZap.resolveLnurl(e)}catch(nD){this.lnurlError=nD instanceof Error?nD.message:"Failed to fetch lightning info"}finally{this.lnurlLoading=!1}}else this.lnurlError="This user has no lightning address set in their profile"}updateSlider(t){this.sliderPosition=Number(t.target.value)}static{$F(this.prototype,"updateSlider",[Vl])}updateMessage(t){this.message=t.target.value}static{$F(this.prototype,"updateMessage",[Vl])}handleClose(){this.args.onClose&&this.args.onClose()}static{$F(this.prototype,"handleClose",[Vl])}resetAndClose(){this._cleanupReceiptSub(),this.step="select-amount",this.error=null,this.invoice=null,this.paymentNotDetected=!1,this.handleClose()}static{$F(this.prototype,"resetAndClose",[Vl])}retry(){this.step="select-amount",this.error=null}static{$F(this.prototype,"retry",[Vl])}showInvoice(){this.step="awaiting-payment",this.error=null}static{$F(this.prototype,"showInvoice",[Vl])}performZap(){this.zapTask.perform()}static{$F(this.prototype,"performZap",[Vl])}performWebLNPay(){this.webLNPayTask.perform()}static{$F(this.prototype,"performWebLNPay",[Vl])}copyInvoice(){if(this.invoice)try{navigator.clipboard.writeText(this.invoice),this.toast.show("Invoice copied to clipboard")}catch{}}static{$F(this.prototype,"copyInvoice",[Vl])}_startReceiptSubscription(t){this._cleanupReceiptSub(),this._zapRequest=t,this.paymentNotDetected=!1,this._receiptSub=this.nostrZap.subscribeForZapReceipt(t,this.photo,()=>{this.step="success",this._cleanupReceiptSub()}),this._receiptTimeout=setTimeout(()=>{this.paymentNotDetected=!0},this.RECEIPT_TIMEOUT_MS)}_cleanupReceiptSub(){this._receiptSub&&(this._receiptSub.unsubscribe(),this._receiptSub=null),this._receiptTimeout&&(clearTimeout(this._receiptTimeout),this._receiptTimeout=null)}zapTask=$W(()=>({context:this,generator:function*(){if(this.canZap){this.step="fetching-invoice",this.error=null;try{const{invoice:t,zapRequest:e}=yield this.nostrZap.zap(this.photo,this.amountMsats,this.message);this.invoice=t,this.step="awaiting-payment",this._startReceiptSubscription(e)}catch(nD){console.error("Zap failed:",nD),this.error=nD instanceof Error?nD.message:"Failed to create zap",this.step="error"}}}}),null,"zapTask",null);webLNPayTask=$W(()=>({context:this,generator:function*(){if(this.invoice){this.step="paying-with-wallet",this.error=null;try{yield this.nostrZap.payWithWebln(this.invoice),this._cleanupReceiptSub(),this.step="success"}catch(nD){console.error("WebLN pay failed:",nD),this.error=nD instanceof Error?nD.message:"Failed to pay with wallet",this.step="wallet-pay-error"}}}}),null,"webLNPayTask",null);willDestroy(){this._cleanupReceiptSub(),super.willDestroy(...arguments)}static{Op(ig({id:null,block:'[[[8,[32,0],null,[["@inline","@onClose"],[true,[30,0,["resetAndClose"]]]],[["default"],[[[[1,"\\n "],[10,0],[14,0,"zap-photo-modal"],[12],[1,"\\n "],[10,"h2"],[12],[1,"Zap Photo"],[13],[1,"\\n\\n"],[1," "],[10,"section"],[14,0,"status"],[12],[1,"\\n"],[41,[30,0,["lnurlLoading"]],[[[1," "],[10,2],[14,0,"meta-info"],[12],[1,"Loading lightning address..."],[13],[1,"\\n"]],[]],[[[41,[30,0,["lightningAddress"]],[[[1," "],[10,0],[14,0,"lightning-address"],[12],[1,"\\n "],[10,1],[14,0,"lightning-badge"],[12],[1,"Lightning"],[13],[1,"\\n "],[10,1],[14,0,"lightning-address-text"],[12],[1,[30,0,["lightningAddress"]]],[13],[1,"\\n "],[13],[1,"\\n "]],[]],null]],[]]],[41,[30,0,["lnurlError"]],[[[1," "],[10,0],[14,0,"alert alert-error"],[12],[1,[30,0,["lnurlError"]]],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n\\n"],[41,[28,[32,1],[[30,0,["step"]],"select-amount"],null],[[[1," "],[10,"section"],[14,0,"slider"],[12],[1,"\\n "],[10,0],[14,0,"amount-display"],[12],[1,"\\n "],[10,1],[14,0,"amount-value zap-amount"],[12],[1,[30,0,["formattedAmount"]]],[13],[1,"\\n "],[10,1],[14,0,"amount-unit"],[12],[1,"sats"],[13],[1,"\\n "],[13],[1,"\\n\\n "],[11,"input"],[24,0,"zap-slider"],[24,"min","0"],[16,"max",[30,0,["sliderSteps"]]],[16,2,[30,0,["sliderPosition"]]],[24,"aria-label","Zap amount in sats"],[24,4,"range"],[4,[32,2],["input",[30,0,["updateSlider"]]],null],[12],[13],[1,"\\n\\n "],[10,0],[14,0,"slider-ticks"],[12],[1,"\\n"],[42,[28,[31,2],[[28,[31,2],[[30,0,["sliderTicks"]]],null]],null],null,[[[1," "],[10,1],[12],[1,[30,1]],[13],[1,"\\n"]],[1]],null],[1," "],[13],[1,"\\n\\n "],[13],[1,"\\n\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[12],[1,"Message (optional)"],[13],[1,"\\n "],[11,"input"],[24,0,"form-control"],[24,"placeholder","Say something nice..."],[24,"aria-label","Zap message"],[16,2,[30,0,["message"]]],[24,4,"text"],[4,[32,2],["input",[30,0,["updateMessage"]]],null],[12],[13],[1,"\\n "],[13],[1,"\\n\\n "],[10,0],[14,0,"edit-actions"],[12],[1,"\\n "],[11,"button"],[24,0,"btn btn-outline"],[24,4,"button"],[4,[32,2],["click",[30,0,["resetAndClose"]]],null],[12],[1,"\\n Cancel\\n "],[13],[1,"\\n "],[11,"button"],[24,0,"btn btn-primary"],[16,"disabled",[30,0,["cannotZap"]]],[24,4,"button"],[4,[32,2],["click",[30,0,["performZap"]]],null],[12],[1,"\\n Zap\\n "],[1,[30,0,["formattedAmount"]]],[1,"\\n sats\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[28,[32,1],[[30,0,["step"]],"fetching-invoice"],null],[[[1," "],[10,0],[14,0,"centered"],[12],[1,"\\n "],[8,[32,3],[[24,0,"spin-animation"]],[["@name","@size"],["loading-ring",32]],null],[1,"\\n "],[10,2],[12],[1,"Creating zap request and fetching invoice..."],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[28,[32,1],[[30,0,["step"]],"awaiting-payment"],null],[[[1," "],[10,2],[14,0,"zap-pay-prompt"],[12],[1,"\\n Scan to pay\\n "],[10,"strong"],[12],[1,[30,0,["formattedAmount"]]],[1," sats"],[13],[1,"\\n "],[13],[1,"\\n\\n "],[10,0],[14,0,"qr-code-container"],[12],[1,"\\n "],[11,"canvas"],[4,[32,4],[[30,0,["invoice"]]],null],[12],[13],[1,"\\n "],[13],[1,"\\n\\n"],[41,[30,0,["hasWebLN"]],[[[1," "],[11,"button"],[24,0,"btn btn-primary btn-full webln-pay-btn"],[24,4,"button"],[4,[32,2],["click",[30,0,["performWebLNPay"]]],null],[12],[1,"\\n Open in Lightning wallet\\n "],[13],[1,"\\n"]],[]],[[[1," "],[10,3],[15,6,[30,0,["lightningUri"]]],[14,0,"btn btn-primary btn-full"],[12],[1,"\\n Open in Lightning wallet\\n "],[13],[1,"\\n"]],[]]],[1,"\\n "],[11,"button"],[24,0,"btn btn-outline btn-full copy-invoice-btn"],[24,4,"button"],[4,[32,2],["click",[30,0,["copyInvoice"]]],null],[12],[1,"\\n Copy payment request\\n "],[13],[1,"\\n\\n"],[41,[30,0,["paymentNotDetected"]],[[[1," "],[10,2],[14,0,"meta-info"],[12],[1,"\\n Payment not detected yet. Keep the QR code open and try paying\\n again, or use a different Lightning wallet.\\n "],[13],[1,"\\n"]],[]],null]],[]],null],[1,"\\n"],[41,[28,[32,1],[[30,0,["step"]],"paying-with-wallet"],null],[[[1," "],[10,0],[14,0,"centered"],[12],[1,"\\n "],[8,[32,3],[[24,0,"spin-animation"]],[["@name","@size"],["loading-ring",32]],null],[1,"\\n "],[10,2],[12],[1,"Paying invoice with WebLN..."],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[28,[32,1],[[30,0,["step"]],"wallet-pay-error"],null],[[[1," "],[10,0],[14,0,"alert alert-error"],[12],[1,[30,0,["error"]]],[13],[1,"\\n "],[10,2],[14,0,"meta-info"],[12],[1,"\\n The WebLN payment failed. You can still scan the QR code with a\\n Lightning wallet.\\n "],[13],[1,"\\n "],[10,0],[14,0,"edit-actions"],[12],[1,"\\n "],[11,"button"],[24,0,"btn btn-outline"],[24,4,"button"],[4,[32,2],["click",[30,0,["resetAndClose"]]],null],[12],[1,"\\n Cancel\\n "],[13],[1,"\\n "],[11,"button"],[24,0,"btn btn-primary"],[24,4,"button"],[4,[32,2],["click",[30,0,["showInvoice"]]],null],[12],[1,"\\n Show Invoice\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[28,[32,1],[[30,0,["step"]],"success"],null],[[[1," "],[10,0],[14,0,"success zap-success"],[12],[1,"\\n "],[10,0],[14,0,"success-icon"],[12],[1,"⚡"],[13],[1,"\\n "],[10,"h4"],[12],[1,"Zap Sent!"],[13],[1,"\\n "],[10,2],[12],[1,"\\n You zapped\\n "],[10,"strong"],[12],[1,[30,0,["formattedAmount"]]],[1," sats"],[13],[1,"\\n"],[41,[30,0,["message"]],[[[1," with message: \\""],[1,[30,0,["message"]]],[1,"\\"\\n"]],[]],null],[1," "],[13],[1,"\\n "],[11,"button"],[24,0,"btn btn-primary"],[24,4,"button"],[4,[32,2],["click",[30,0,["resetAndClose"]]],null],[12],[1,"\\n Done\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[28,[32,1],[[30,0,["step"]],"error"],null],[[[1," "],[10,0],[14,0,"alert alert-error"],[12],[1,[30,0,["error"]]],[13],[1,"\\n "],[10,0],[14,0,"edit-actions"],[12],[1,"\\n "],[11,"button"],[24,0,"btn btn-outline"],[24,4,"button"],[4,[32,2],["click",[30,0,["resetAndClose"]]],null],[12],[1,"\\n Close\\n "],[13],[1,"\\n "],[11,"button"],[24,0,"btn btn-primary"],[24,4,"button"],[4,[32,2],["click",[30,0,["retry"]]],null],[12],[1,"\\n Try Again\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n"]],[]]]]]],["label"],["if","each","-track-array"]]',moduleName:"(unknown template module)",scope:()=>({Modal:Wq,eq:Gq,on:Hw,Icon:wq,qrCode:RV}),isStrictMode:!0}),this)}},hH=Op(ig({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"],[24,4,"button"],[4,[32,0],["click",[28,[32,2],[[30,9],[30,6]],null]],null],[12],[1,"Zap this photo"],[13],[1,"\\n"]],[]],null],[41,[30,10],[[[1," "],[11,"button"],[24,0,"dropdown-item text-danger"],[24,4,"button"],[4,[32,0],["click",[28,[32,2],[[30,11,["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,12],[30,13]],null],[[[1," "],[10,0],[14,0,"photo-gallery-uploader-info"],[12],[1,"\\n"],[41,[30,12],[[[1," "],[10,1],[14,0,"photo-gallery-uploader-name"],[12],[1,[30,12]],[13],[1,"\\n"]],[]],null],[41,[30,13],[[[1," "],[10,1],[14,0,"photo-gallery-uploader-date"],[12],[1,"\\n "],[1,[28,[32,4],[[30,13]],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,14]],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,15],[30,4,["eventId"]],[30,16],[30,17]]],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,15],[30,4,["eventId"]],[30,18],[30,17]]],null],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n\\n"],[41,[30,19],[[[1," "],[8,[32,7],null,[["@photo","@onClose"],[[30,4],[30,20]]],null],[1,"\\n"]],[]],null],[13]],["@handleBackgroundClick","@bindKeyboard","@handleKeydown","@currentPhoto","@triggerIcon","closeMenu","@copyEventId","@canZapPhoto","@openZap","@canDeletePhoto","@deletePhotoTask","@uploaderName","@photoDate","@handleClose","@photos","@handleVisiblePhotoChange","@placeName","@selectPhoto","@zapModalOpen","@closeZap"],["if"]]',moduleName:"(unknown template module)",scope:()=>({on:Hw,DropdownMenu:aH,fn:zq,or:Uq,formatRelativeDate:Bq,Icon:wq,PhotoCarousel:oH,ZapPhotoModal:uH}),isStrictMode:!0}),qq()),dH=class extends vq{get isTesting(){return"test"===ix.environment}get destinationElement(){return document.getElementById("modal-portal")||document.body}static{BF(this.prototype,"toast",[pp])}#Mt=void qF(this,"toast");static{BF(this.prototype,"nostrAuth",[pp])}#N=void qF(this,"nostrAuth");static{BF(this.prototype,"nostrData",[pp])}#F=void qF(this,"nostrData");static{BF(this.prototype,"nostrRelay",[pp])}#at=void qF(this,"nostrRelay");static{BF(this.prototype,"nostrZap",[pp])}#fe=void qF(this,"nostrZap");static{BF(this.prototype,"blossom",[pp])}#Qt=void qF(this,"blossom");static{BF(this.prototype,"settings",[pp])}#z=void qF(this,"settings");static{BF(this.prototype,"currentPhoto",[Wr],function(){return this.args.selectedPhoto||this.args.photos?.[0]})}#Ce=void qF(this,"currentPhoto");static{BF(this.prototype,"zapModalOpen",[Wr],function(){return!1})}#Se=void qF(this,"zapModalOpen");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 canZapPhoto(){return!this.isCreator&&this.nostrAuth.isConnected&&!!this.nostrZap.getLightningAddress(this.currentPhoto?.pubkey)}get uploaderName(){const t=this.currentPhoto?.pubkey;if(!t)return null;const e=this.nostrData.getProfile?.(t);return e&&(e.displayName||e.display_name||e.name)||null}get photoDate(){return this.currentPhoto?.publishedAt||this.currentPhoto?.createdAt||null}bindKeyboard=Xq((t,[e])=>(document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)));handleClose(){this.args.onClose&&this.args.onClose()}static{$F(this.prototype,"handleClose",[Vl])}handleBackgroundClick(t){t.target.closest(".thumbnail-strip-container")||t.target.closest(".carousel-nav-btn")||t.target.closest(".close-btn")||t.target.closest(".photo-gallery-header")||t.target.closest(".modal-overlay")||this.handleClose()}static{$F(this.prototype,"handleBackgroundClick",[Vl])}selectPhoto(t){this.currentPhoto=t}static{$F(this.prototype,"selectPhoto",[Vl])}handleVisiblePhotoChange(t){this.currentPhoto!==t&&(this.currentPhoto=t)}static{$F(this.prototype,"handleVisiblePhotoChange",[Vl])}handleKeydown(t){if(!this.args.photos||0===this.args.photos.length)return;if("Escape"===t.key)return void this.handleClose();const e=this.args.photos.indexOf(this.currentPhoto);-1!==e&&("ArrowLeft"===t.key&&e>0?this.currentPhoto=this.args.photos[e-1]:"ArrowRight"===t.key&&e<this.args.photos.length-1&&(this.currentPhoto=this.args.photos[e+1]))}static{$F(this.prototype,"handleKeydown",[Vl])}async copyEventId(t){if(this.currentPhoto?.eventId)try{await navigator.clipboard.writeText(this.currentPhoto.eventId),this.toast.show("Event ID copied to clipboard")}catch(nD){console.error("Failed to copy event ID:",nD),this.toast.show("Failed to copy event ID")}t()}static{$F(this.prototype,"copyEventId",[Vl])}openZap(t,e){e?.stopPropagation(),this.zapModalOpen=!0,t&&t()}static{$F(this.prototype,"openZap",[Vl])}closeZap(){this.zapModalOpen=!1}static{$F(this.prototype,"closeZap",[Vl])}deletePhotoTask=$W(()=>({context:this,generator:function*(t){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 QN.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 t=this.currentPhoto.url.match(i);if(t)try{yield this.blossom.delete(t[0])}catch(e){console.warn("Failed to delete main image from blossom:",e)}}if(this.currentPhoto.thumbUrl){const t=this.currentPhoto.thumbUrl.match(i);if(t)try{yield this.blossom.delete(t[0])}catch(e){console.warn("Failed to delete thumb image from blossom:",e)}}this.toast.show("Photo deleted successfully"),t&&t(),this.handleClose()}catch(e){console.error("Failed to delete photo:",e),this.toast.show("Failed to delete photo: "+e.message),t&&t()}else t&&t()}}),null,"deletePhotoTask",null);static{Op(ig({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","@openZap","@closeZap","@zapModalOpen","@canZapPhoto"],[[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"]],[30,0,["openZap"]],[30,0,["closeZap"]],[30,0,["zapModalOpen"]],[30,0,["canZapPhoto"]]]],null],[1,"\\n"]],[]],[[[40,[[[1," "],[8,[32,0],null,[["@handleBackgroundClick","@bindKeyboard","@handleKeydown","@copyEventId","@canDeletePhoto","@deletePhotoTask","@handleClose","@photos","@currentPhoto","@handleVisiblePhotoChange","@placeName","@selectPhoto","@uploaderName","@photoDate","@triggerIcon","@openZap","@closeZap","@zapModalOpen","@canZapPhoto"],[[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"]],[30,0,["openZap"]],[30,0,["closeZap"]],[30,0,["zapModalOpen"]],[30,0,["canZapPhoto"]]]],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:hH}),isStrictMode:!0}),this)}},pH=class extends vq{static{BF(this.prototype,"storage",[pp])}#U=void qF(this,"storage");static{BF(this.prototype,"nostrAuth",[pp])}#N=void qF(this,"nostrAuth");static{BF(this.prototype,"nostrData",[pp])}#F=void qF(this,"nostrData");static{BF(this.prototype,"mapUi",[pp])}#Zt=void qF(this,"mapUi");static{BF(this.prototype,"isEditing",[Wr],function(){return!1})}#ke=void qF(this,"isEditing");static{BF(this.prototype,"showLists",[Wr],function(){return!1})}#Ee=void qF(this,"showLists");static{BF(this.prototype,"isPhotoUploadActive",[Wr],function(){return!1})}#Re=void qF(this,"isPhotoUploadActive");static{BF(this.prototype,"isConnectingNostr",[Wr],function(){return!1})}#Te=void qF(this,"isConnectingNostr");static{BF(this.prototype,"isGalleryOpen",[Wr],function(){return!1})}#Le=void qF(this,"isGalleryOpen");static{BF(this.prototype,"selectedGalleryPhoto",[Wr],function(){return null})}#Ie=void qF(this,"selectedGalleryPhoto");static{BF(this.prototype,"isPhotoUploadModalOpen",[Wr],function(){return!1})}#Pe=void qF(this,"isPhotoUploadModalOpen");static{BF(this.prototype,"isNostrConnectModalOpen",[Wr],function(){return!1})}#Ht=void qF(this,"isNostrConnectModalOpen");static{BF(this.prototype,"newlyUploadedPhotoId",[Wr],function(){return null})}#Me=void qF(this,"newlyUploadedPhotoId");handleUploadStateChange(t){this.isPhotoUploadActive=t}static{$F(this.prototype,"handleUploadStateChange",[Vl])}openPhotoUploadModal(t){t&&t.preventDefault(),this.nostrAuth.isConnected?this.isPhotoUploadModalOpen=!0:this.isNostrConnectModalOpen=!0}static{$F(this.prototype,"openPhotoUploadModal",[Vl])}closePhotoUploadModal(t){this.isPhotoUploadActive||(this.isPhotoUploadModalOpen=!1,"string"==typeof t&&(this.newlyUploadedPhotoId=t,setTimeout(()=>{const t=document.querySelector(".sidebar-content");t&&(t.scrollTop=0)},50)))}static{$F(this.prototype,"closePhotoUploadModal",[Vl])}closeNostrConnectModal(){this.isNostrConnectModalOpen=!1}static{$F(this.prototype,"closeNostrConnectModal",[Vl])}onNostrConnected(){this.isNostrConnectModalOpen=!1,this.isPhotoUploadModalOpen=!0}static{$F(this.prototype,"onNostrConnected",[Vl])}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:x$(this.place)}get tags(){return this.place.osmTags||{}}get name(){return this.place.title||TB(this.tags)||"Unnamed Place"}get photos(){return fU(this.nostrData.placePhotos).map(t=>({...t,style:qv(`--slide-ratio: ${t.aspectRatio};`)}))}startEditing(){this.isSaved&&(this.isEditing=!0)}static{$F(this.prototype,"startEditing",[Vl])}cancelEditing(){this.isEditing=!1}static{$F(this.prototype,"cancelEditing",[Vl])}toggleLists(t){t&&t.stopPropagation(),this.showLists=!this.showLists}static{$F(this.prototype,"toggleLists",[Vl])}closeLists(){this.showLists=!1}static{$F(this.prototype,"closeLists",[Vl])}async saveChanges(t){this.args.onSave&&await this.args.onSave({...this.place,...t}),this.isEditing=!1}static{$F(this.prototype,"saveChanges",[Vl])}get type(){return IB(this.tags)}get address(){const t=this.tags,e=[],n=(...e)=>{for(const n of e)if(t[n])return t[n];return null};let r=n("addr:street","street");const i=n("addr:housenumber","housenumber");r&&(i&&(r=`${r} ${i}`),e.push(r));let s=n("addr:city","city");const o=n("addr:postcode","postcode");s&&(o&&(s=`${o} ${s}`),e.push(s));const a=n("addr:state","state"),l=n("addr:country","country");return a&&a!==s&&e.push(a),l&&e.push(l),0===e.length?null:e.join(", ")}formatMultiLine(t,e){if(!t)return null;const n=[...new Set(t.split(";").map(t=>t.trim()).filter(Boolean))];return 0===n.length?null:qv("phone"===e?n.map(t=>`<a href="tel:${t.replace(/[\s-]+/g,"")}">${t}</a>`).join("<br>"):"email"===e?n.map(t=>`<a href="mailto:${t}">${t}</a>`).join("<br>"):"whatsapp"===e?n.map(t=>`<a href="https://wa.me/${t.replace(/[\s()+.-]/g,"")}" target="_blank" rel="noopener noreferrer">${t}</a>`).join("<br>"):"url"===e?n.map(t=>`<a href="${t}" target="_blank" rel="noopener noreferrer">${this.getDomain(t)}</a>`).join("<br>"):n.join("<br>"))}get phone(){const t=[this.tags.phone,this.tags["contact:phone"],this.tags.mobile,this.tags["contact:mobile"]].filter(Boolean);return 0===t.length?null:this.formatMultiLine(t.join(";"),"phone")}get whatsapp(){const t=[this.tags.whatsapp,this.tags["contact:whatsapp"]].filter(Boolean);return 0===t.length?null:this.formatMultiLine(t.join(";"),"whatsapp")}get email(){const t=this.tags.email||this.tags["contact:email"];return this.formatMultiLine(t,"email")}get website(){const t=this.place.url||this.tags.website||this.tags["contact:website"];return this.formatMultiLine(t,"url")}getDomain(t){try{return new URL(t).hostname}catch{return t}}get openingHours(){const t=this.tags.opening_hours;return this.formatMultiLine(t)}get cuisine(){return this.tags.cuisine?this.tags.cuisine.split(";").map(t=>SB(t)).join(", "):null}get facebook(){return k$(this.tags,"facebook")}get instagram(){return k$(this.tags,"instagram")}get wikipedia(){const t=this.tags.wikipedia;return t?t.split(";").map(t=>t.trim()).filter(Boolean)[0]:null}get geoLink(){const t=this.place.lat,e=this.place.lon;return t&&e?`geo:${t},${e}?q=${t},${e}(${encodeURIComponent(this.name)})`:"#"}get visibleGeoLink(){const t=this.place.lat,e=this.place.lon;return t&&e?`${Number(t).toFixed(6)}, ${Number(e).toFixed(6)}`:""}get osmUrl(){const t=this.place.osmId;if(t)return`https://www.openstreetmap.org/${this.place.osmType||"node"}/${t}`;const e=this.place.lat,n=this.place.lon;if(!e||!n)return null;const r=this.mapUi.currentCenter?.lat??e,i=this.mapUi.currentCenter?.lon??n,s=this.mapUi.currentZoom??17,o=Math.round(s);return`https://www.openstreetmap.org/search?lat=${e}&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(t){this.selectedGalleryPhoto=t,this.isGalleryOpen=!0}static{$F(this.prototype,"openGallery",[Vl])}closeGallery(){this.isGalleryOpen=!1,this.selectedGalleryPhoto=null}static{$F(this.prototype,"closeGallery",[Vl])}static{Op(ig({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:XW,PhotoCarousel:oH,on:Hw,Icon:wq,PlaceListsManager:QW,Modal:Wq,PlacePhotoUpload:iH,NostrConnect:TV,PhotoGallery:dH}),isStrictMode:!0}),this)}},fH=Eb(function([t]){return SB(t)}),gH=class extends vq{static{BF(this.prototype,"storage",[pp])}#U=void qF(this,"storage");static{BF(this.prototype,"router",[pp])}#Gt=void qF(this,"router");static{BF(this.prototype,"mapUi",[pp])}#Zt=void qF(this,"mapUi");static{BF(this.prototype,"nostrData",[pp])}#F=void qF(this,"nostrData");createNewPlace(){const t=this.router.currentRoute.queryParams,e=t.lat,n=t.lon;e&&n?this.router.transitionTo("place.new",{queryParams:{lat:e,lon:n}}):this.router.transitionTo("place.new",{queryParams:{lat:0,lon:0}})}static{$F(this.prototype,"createNewPlace",[Vl])}selectPlace(t){this.args.onSelect&&this.args.onSelect(t)}static{$F(this.prototype,"selectPlace",[Vl])}clearSelection(){this.args.onSelect&&this.args.onSelect(null)}static{$F(this.prototype,"clearSelection",[Vl])}async toggleSave(t){if(t)if(t.createdAt)try{if(await this.storage.removePlace(t),console.debug("Place deleted:",t.title),this.args.onBookmarkChange&&this.args.onBookmarkChange(),this.args.onUpdate){const e={...t,id:void 0,geohash:void 0,createdAt:void 0};this.args.onUpdate(e)}this.args.onSelect&&this.args.onSelect(null),this.args.onClose&&this.args.onClose()}catch(e){console.error("Failed to delete:",e),alert("Failed to delete: "+e.message)}else{const e={title:TB(t.osmTags,"Untitled Place"),lat:t.lat,lon:t.lon,tags:[],url:t.osmTags.website,osmId:String(t.osmId||t.id),osmType:t.osmType,osmTags:t.osmTags};try{const t=await this.storage.storePlace(e);console.debug("Place saved:",e.title),this.args.onBookmarkChange&&this.args.onBookmarkChange(),this.args.onUpdate&&this.args.onUpdate(t),this.args.onSelect&&this.args.onSelect(t)}catch(d8){console.error("Failed to save place:",d8),alert("Failed to save place: "+d8.message)}}}static{$F(this.prototype,"toggleSave",[Vl])}async updateBookmark(t){try{const e=await this.storage.updatePlace(t);console.debug("Place updated:",e.title),this.args.onBookmarkChange&&this.args.onBookmarkChange(),this.args.onUpdate&&this.args.onUpdate(e)}catch(e){console.error("Failed to update place:",e),alert("Failed to update place: "+e.message)}}static{$F(this.prototype,"updateBookmark",[Vl])}get isNearbySearch(){const t=this.router.currentRoute.queryParams;return!t.q&&!t.category&&t.lat&&t.lon}get hasHeaderPhoto(){return this.args.selectedPlace&&this.nostrData.placePhotos&&this.nostrData.placePhotos.length>0}static{Op(ig({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:Hq,not:Zq,on:Hw,Icon:wq,or:Uq,restoreScroll:LV,PlaceDetails:pH,fn:zq,eq:Gq,humanizeOsmTag:fH,getPlaceType:IB}),isStrictMode:!0}),this)}},mH=a({default:()=>yH}),yH=Op(ig({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:gH}),isStrictMode:!0}),qq()),vH=a({default:()=>CH});function bH(t){const e=t.createdAt;if(!e)return 0;if("number"==typeof e)return e;const n=Date.parse(e);return isNaN(n)?0:n}var wH,_H,xH,CH=class extends eu{static{BF(this.prototype,"router",[pp])}#Gt=void qF(this,"router");static{BF(this.prototype,"mapUi",[pp])}#Zt=void qF(this,"mapUi");static{BF(this.prototype,"storage",[pp])}#U=void qF(this,"storage");static{BF(this.prototype,"model",[Wr])}#Ae=void qF(this,"model");static{BF(this.prototype,"loadedPlaces",[Wr],function(){return[]})}#Oe=void qF(this,"loadedPlaces");get listId(){return this.model?.list_id}loadPlacesTask=$W(()=>({context:this,generator:function*(t){this.loadedPlaces=[];try{this.loadedPlaces=yield this.storage.getPlacesInList(t)}catch(e){console.error("Failed to load places in list",t,e),this.loadedPlaces=[]}}}),{restartable:!0},"loadPlacesTask",null);get scrollTop(){return this.mapUi.getScrollPosition(`list-${this.listId}`)}get listColor(){const t=this.storage.lists.find(t=>t.id===this.listId);return t&&t.color?t.color:getComputedStyle(document.documentElement).getPropertyValue("--default-list-color").trim()}get listTitle(){const t=this.storage.lists.find(t=>t.id===this.listId);return t?t.title:"Collections"}get places(){const t=this.storage.lists.find(t=>t.id===this.listId),e=new Set(t?.placeRefs?.map(t=>t.id)||[]),n=this.storage.savedPlaces.filter(t=>e.has(t.id)),r=[],i=new Set;return n.forEach(t=>{r.push(t),i.add(t.id)}),this.loadedPlaces.forEach(t=>{e.has(t.id)&&!i.has(t.id)&&(r.push(t),i.add(t.id))}),r.sort((t,e)=>bH(e)-bH(t))}selectPlace(t){if(t){const e=document.querySelector(".sidebar-content");e&&this.mapUi.saveScrollPosition(`list-${this.listId}`,e.scrollTop),this.mapUi.returnToRoute={name:"lists.list",model:this.listId},this.mapUi.showSidebar(),this.mapUi.preventNextZoom=!0,this.router.transitionTo("place",t)}}static{$F(this.prototype,"selectPlace",[Vl])}close(){this.router.transitionTo("index")}static{$F(this.prototype,"close",[Vl])}backToLists(){this.router.transitionTo("lists.index")}static{$F(this.prototype,"backToLists",[Vl])}},SH=a({default:()=>kH}),kH=class extends Qh{static{BF(this.prototype,"storage",[pp])}#U=void qF(this,"storage");model(t){return{list_id:t.list_id}}setupController(t,e){console.debug("DEBUG: setupController controller is:",t),console.debug("DEBUG: controller.loadPlacesTask is:",t?.loadPlacesTask),t.model=e,super.setupController(t,e),t&&t.loadPlacesTask?t.loadPlacesTask.perform(e.list_id):console.error("DEBUG: ERROR! controller.loadPlacesTask is undefined!")}},EH=a({default:()=>RH}),RH=class extends vq{static{BF(this.prototype,"storage",[pp])}#U=void qF(this,"storage");static{BF(this.prototype,"router",[pp])}#Gt=void qF(this,"router");static{BF(this.prototype,"mapUi",[pp])}#Zt=void qF(this,"mapUi");styleFor(t){const e=t||getComputedStyle(document.documentElement).getPropertyValue("--default-list-color").trim();return qv(`background-color: ${e}`)}selectList(t){this.router.transitionTo("lists.list",t)}static{$F(this.prototype,"selectList",[Vl])}close(){this.router.transitionTo("index")}static{$F(this.prototype,"close",[Vl])}backToMenu(){this.router.transitionTo("menu")}static{$F(this.prototype,"backToMenu",[Vl])}static{Op(ig({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:Hw,Icon:wq,fn:zq}),isStrictMode:!0}),this)}},TH=a({default:()=>LH}),LH=class extends Qh{},IH=a({default:()=>PH}),PH=class extends vq{static{BF(this.prototype,"router",[pp])}#Gt=void qF(this,"router");static{BF(this.prototype,"mapUi",[pp])}#Zt=void qF(this,"mapUi");selectPlace(t){if(t){const e=document.querySelector(".sidebar-content");e&&this.mapUi.saveScrollPosition("search",e.scrollTop),this.mapUi.returnToSearch=!0,this.mapUi.showSidebar(),this.mapUi.preventNextZoom=!0,this.router.transitionTo("place",t)}}static{$F(this.prototype,"selectPlace",[Vl])}close(){this.mapUi.hideSidebar()}static{$F(this.prototype,"close",[Vl])}static{Op(ig({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:gH}),isStrictMode:!0}),this)}},MH=a({default:()=>AH}),AH=class extends eu{static{BF(this.prototype,"osm",[pp])}#B=void qF(this,"osm");static{BF(this.prototype,"photon",[pp])}#Ne=void qF(this,"photon");static{BF(this.prototype,"mapUi",[pp])}#Zt=void qF(this,"mapUi");static{BF(this.prototype,"storage",[pp])}#U=void qF(this,"storage");static{BF(this.prototype,"router",[pp])}#Gt=void qF(this,"router");static{BF(this.prototype,"toast",[pp])}#Mt=void qF(this,"toast");queryParams=["lat","lon","q","selected","category"];lat=null;lon=null;q=null;selected=null;category=null;fetchResultsTask=$W(()=>({context:this,generator:function*(t){const e=this.mapUi.currentSearch&&t.q===this.mapUi.currentSearch.q&&t.category===this.mapUi.currentSearch.category&&t.lat===this.mapUi.currentSearch.lat&&t.lon===this.mapUi.currentSearch.lon,n=this.mapUi.searchResults&&this.mapUi.searchResults.length>0;if(e&&n)return void(this.mapUi.isSidebarVisible&&this.mapUi.showSidebar());this.mapUi.hideSidebar(),this.mapUi.clearSearchResults();const r=t.lat?parseFloat(t.lat):null,i=t.lon?parseFloat(t.lon):null;let s=[],o=null,a=null;try{if(t.category&&r&&i){o="category",a=t.category,this.mapUi.startLoading(o,a);let e=this.mapUi.currentBounds;if(!e){const t=.01;e={minLat:r-t,maxLat:r+t,minLon:i-t,maxLon:i+t}}s=yield this.osm.getCategoryPois(e,t.category,r,i),s=s.map(t=>({...t,_distance:s$(r,i,t.lat,t.lon)})).sort((t,e)=>t._distance-e._distance)}else if(t.q){o="text",a=t.q,this.mapUi.startLoading(o,a),s=yield this.photon.search(t.q,r,i);const e=t.q.toLowerCase();let n=[];e.length>=3&&(n=this.storage.savedPlaces.filter(t=>t.title?.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e))),n.forEach(t=>{s.find(e=>t.osmId&&e.osmId===t.osmId||e.id&&e.id===t.id)||s.push(t)})}else if(r&&i){const t=50;s=yield this.osm.getNearbyPois(r,i,t),this.storage.savedPlaces.filter(e=>s$(r,i,e.lat,e.lon)<=t).forEach(t=>{s.find(e=>t.osmId&&e.osmId===t.osmId||e.id&&e.id===t.id)||s.push(t)}),s=s.map(t=>({...t,_distance:s$(r,i,t.lat,t.lon)})).sort((t,e)=>t._distance-e._distance)}}catch(d8){return console.error("Search request failed.",d8),this.toast.show("Search request failed. Please try again."),void this.mapUi.stopSearch()}finally{o&&a&&this.mapUi.stopLoading(o,a)}s=s.map(t=>this.storage.findPlaceById(t.osmId)||t);const l=t.selected||t.q;if(l&&s.length>0){let t=s.find(t=>t.osmTags&&(t.osmTags.name===l||t.osmTags["name:en"]===l));if(!t){const e=s[0];e._distance<=10&&(t=e)}if(t)return this.router.replaceWith("place",t),void this.mapUi.stopSearch()}this.mapUi.setSearchResults(s),this.mapUi.showSidebar(),this.mapUi.stopSearch()}}),{restartable:!0},"fetchResultsTask",null)},OH=a({default:()=>NH}),NH=class extends Qh{static{BF(this.prototype,"mapUi",[pp])}#Zt=void qF(this,"mapUi");static{BF(this.prototype,"toast",[pp])}#Mt=void qF(this,"toast");queryParams={lat:{refreshModel:!0},lon:{refreshModel:!0},q:{refreshModel:!0},selected:{refreshModel:!0},category:{refreshModel:!0}};model(t){return t}setupController(t,e){super.setupController(t,e),t.fetchResultsTask.perform(e);const{q:n,category:r,lat:i,lon:s}=this.paramsFor("search");this.mapUi.currentSearch={q:n,category:r,lat:i,lon:s}}resetController(t,e){e&&(t.fetchResultsTask.cancelAll(),this.mapUi.stopSearch())}error(t,e){return this.mapUi.stopSearch(),this.toast.show("Search request failed. Please try again."),e&&e.abort(),!1}static{$F(this.prototype,"error",[Vl])}},FH=a({cacheFor:()=>tr,guidFor:()=>ll}),zH=(wH=pp("page-title"),xH=V$((_H=class extends _b{constructor(t){super(t),q$(this,"tokens",xH,this),$$(this,"tokenId",ll(this)),this.tokens.push({id:this.tokenId})}compute(t,e){const n={...e,id:this.tokenId,title:t.join("")};return this.tokens.push(n),this.tokens.scheduleTitleUpdate(),""}willDestroy(){super.willDestroy(),this.tokens.remove(this.tokenId),this.tokens.scheduleTitleUpdate()}}).prototype,"tokens",[wH],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),_H),DH="add",jH="remove",UH="propertychange";function BH(t){for(const e in t)delete t[e]}function $H(t){let e;for(e in t)return!1;return!e}function qH(t,e,n,r,i){if(i){const i=n;n=function(s){return t.removeEventListener(e,n),i.call(r??this,s)}}else r&&r!==t&&(n=n.bind(r));const s={target:t,type:e,listener:n};return t.addEventListener(e,n),s}function VH(t,e,n,r){return qH(t,e,n,r,!0)}function WH(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),BH(t))}var HH="change",GH="contextmenu",ZH="click",KH="keydown",YH="keypress",XH="touchmove",JH="wheel",QH=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function tG(t,e){return t>e?1:t<e?-1:0}function eG(t,e){return t<e?1:t>e?-1:0}function nG(t,e,n){if(t[0]<=e)return 0;const r=t.length;if(e<=t[r-1])return r-1;if("function"==typeof n){for(let i=1;i<r;++i){const r=t[i];if(r===e)return i;if(r<e)return n(e,t[i-1],r)>0?i-1:i}return r-1}if(n>0){for(let n=1;n<r;++n)if(t[n]<e)return n-1;return r-1}if(n<0){for(let n=1;n<r;++n)if(t[n]<=e)return n;return r-1}for(let i=1;i<r;++i){if(t[i]==e)return i;if(t[i]<e)return t[i-1]-e<e-t[i]?i-1:i}return r-1}function rG(t,e,n){for(;e<n;){const r=t[e];t[e]=t[n],t[n]=r,++e,--n}}function iG(t,e){const n=Array.isArray(e)?e:[e],r=n.length;for(let i=0;i<r;i++)t[t.length]=n[i]}function sG(t,e){const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}function oG(){return!0}function aG(){return!1}function lG(){}function cG(t){let e,n,r;return function(){const i=Array.prototype.slice.call(arguments);return n&&this===r&&sG(i,n)||(r=this,n=i,e=t.apply(this,arguments)),e}}function uG(t){return function(){let e;try{e=t()}catch(nD){return Promise.reject(nD)}return e instanceof Promise?e:Promise.resolve(e)}()}var hG=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},dG=class extends QH{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const n=this.listeners_||(this.listeners_={}),r=n[t]||(n[t]=[]);r.includes(e)||r.push(e)}dispatchEvent(t){const e="string"==typeof t,n=e?t:t.type,r=this.listeners_&&this.listeners_[n];if(!r)return;const i=e?new hG(t):t;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 t=o[n];for(delete o[n];t--;)this.removeEventListener(n,lG);delete s[n]}return a}disposeInternal(){this.listeners_&&BH(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return!!this.listeners_&&(t?t in this.listeners_:Object.keys(this.listeners_).length>0)}removeEventListener(t,e){if(!this.listeners_)return;const n=this.listeners_[t];if(!n)return;const r=n.indexOf(e);-1!==r&&(this.pendingRemovals_&&t in this.pendingRemovals_?(n[r]=lG,++this.pendingRemovals_[t]):(n.splice(r,1),0===n.length&&delete this.listeners_[t]))}},pG=class extends dG{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(HH)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const n=t.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=qH(this,t[i],e);return r}return qH(this,t,e)}onceInternal(t,e){let n;if(Array.isArray(t)){const r=t.length;n=new Array(r);for(let i=0;i<r;++i)n[i]=VH(this,t[i],e)}else n=VH(this,t,e);return e.ol_key=n,n}unInternal(t,e){const n=e.ol_key;if(n)!function(t){if(Array.isArray(t))for(let e=0,n=t.length;e<n;++e)WH(t[e]);else WH(t)}(n);else if(Array.isArray(t))for(let r=0,i=t.length;r<i;++r)this.removeEventListener(t[r],e);else this.removeEventListener(t,e)}};function fG(){throw new Error("Unimplemented abstract method.")}pG.prototype.on,pG.prototype.once,pG.prototype.un;var gG=0;function mG(t){return t.ol_uid||(t.ol_uid=String(++gG))}var yG=class extends hG{constructor(t,e,n){super(t),this.key=e,this.oldValue=n}},vG=class extends pG{constructor(t){super(),this.on,this.once,this.un,mG(this),this.values_=null,void 0!==t&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let n;n=`change:${t}`,this.hasListener(n)&&this.dispatchEvent(new yG(n,t,e)),n=UH,this.hasListener(n)&&this.dispatchEvent(new yG(n,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,n){const r=this.values_||(this.values_={});if(n)r[t]=e;else{const n=r[t];r[t]=e,n!==e&&this.notify(t,n)}}setProperties(t,e){for(const n in t)this.set(n,t[n],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const n=this.values_[t];delete this.values_[t],$H(this.values_)&&(this.values_=null),e||this.notify(t,n)}}},bG="length",wG=class extends hG{constructor(t,e,n){super(t),this.element=e,this.index=n}},_G=class extends vG{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t??[],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(t){for(let e=0,n=t.length;e<n;++e)this.push(t[e]);return this}forEach(t){const e=this.array_;for(let n=0,r=e.length;n<r;++n)t(e[n],n,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(bG)}insertAt(t,e){if(t<0||t>this.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new wG(DH,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let n=0,r=e.length;n<r;++n)if(e[n]===t)return this.removeAt(n)}removeAt(t){if(t<0||t>=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new wG(jH,e,t)),e}setAt(t,e){if(t>=this.getLength())return void this.insertAt(t,e);if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const n=this.array_[t];this.array_[t]=e,this.dispatchEvent(new wG(jH,n,t)),this.dispatchEvent(new wG(DH,e,t))}updateLength_(){this.set(bG,this.array_.length)}assertUnique_(t,e){const n=this.array_;for(let r=0,i=n.length;r<i;++r)if(n[r]===t&&r!==e)throw new Error("Duplicate item added to a unique collection")}},xG=class extends hG{constructor(t,e,n){super(t),this.map=e,this.frameState=void 0!==n?n:null}},CG=class extends xG{constructor(t,e,n,r,i,s){super(t,e,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(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}},SG={SINGLECLICK:"singleclick",CLICK:ZH,DBLCLICK:"dblclick",POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},kG="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",EG=(kG.includes("safari")&&!kG.includes("chrom")&&(kG.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(kG)),kG.includes("webkit")&&!kG.includes("edge")),RG=kG.includes("macintosh"),TG="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,LG="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,IG="undefined"!=typeof Image&&Image.prototype.decode,PG="function"==typeof createImageBitmap,MG=function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}return t}(),AG="pointerdown",OG=class extends dG{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=void 0===e?1:e,this.down_=null;const n=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=n,this.pointerdownListenerKey_=qH(n,AG,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=qH(n,"pointermove",this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(XH,this.boundHandleTouchMove_,!!MG&&{passive:!1})}emulateClick_(t){let e=new CG(SG.CLICK,this.map_,t);this.dispatchEvent(e),void 0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new CG(SG.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const e=new CG(SG.SINGLECLICK,this.map_,t);this.dispatchEvent(e)},250)}updateActivePointers_(t){const e=t,n=e.pointerId;if(e.type==SG.POINTERUP||e.type==SG.POINTERCANCEL){delete this.trackedTouches_[n];for(const t in this.trackedTouches_)if(this.trackedTouches_[t].target!==e.target){delete this.trackedTouches_[t];break}}else e.type!=SG.POINTERDOWN&&e.type!=SG.POINTERMOVE||(this.trackedTouches_[n]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new CG(SG.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),0===this.activePointers_.length&&(this.dragListenerKeys_.forEach(WH),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return 0===t.button}handlePointerDown_(t){this.emulateClicks_=0===this.activePointers_.length,this.updateActivePointers_(t);const e=new CG(SG.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),0===this.dragListenerKeys_.length){const t=this.map_.getOwnerDocument();this.dragListenerKeys_.push(qH(t,SG.POINTERMOVE,this.handlePointerMove_,this),qH(t,SG.POINTERUP,this.handlePointerUp_,this),qH(this.element_,SG.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==t&&this.dragListenerKeys_.push(qH(this.element_.getRootNode(),SG.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new CG(SG.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!(!this.down_||!this.isMoving_(t));this.dispatchEvent(new CG(SG.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;e&&!e.defaultPrevented||"boolean"==typeof t.cancelable&&!0!==t.cancelable||t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(WH(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(XH,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(WH(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(WH),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},NG="postrender",FG="loadstart",zG="loadend",DG="layergroup",jG="size",UG="target",BG="view";function $G(t,e){if(!t)throw new Error(e)}var qG=1/0,VG=class{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,BH(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,n=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const r=this.keyFunction_(n);return delete this.queuedElements_[r],n}enqueue(t){$G(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=1/0&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(t){return 2*t+1}getRightChildIndex_(t){return 2*t+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return 0===this.elements_.length}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,n=this.priorities_,r=e.length,i=e[t],s=n[t],o=t;for(;t<r>>1;){const i=this.getLeftChildIndex_(t),s=this.getRightChildIndex_(t),o=s<r&&n[s]<n[i]?s:i;e[t]=e[o],n[t]=n[o],t=o}e[t]=i,n[t]=s,this.siftDown_(o,t)}siftDown_(t,e){const n=this.elements_,r=this.priorities_,i=n[e],s=r[e];for(;e>t;){const t=this.getParentIndex_(e);if(!(r[t]>s))break;n[e]=n[t],r[e]=r[t],e=t}n[e]=i,r[e]=s}reprioritize(){const t=this.priorityFunction_,e=this.elements_,n=this.priorities_;let r=0;const i=e.length;let s,o,a;for(o=0;o<i;++o)s=e[o],a=t(s),a==1/0?delete this.queuedElements_[this.keyFunction_(s)]:(n[r]=a,e[r++]=s);e.length=r,n.length=r,this.heapify_()}},WG=class extends VG{constructor(t,e){super(e=>t.apply(null,e),t=>t[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);return e&&t[0].addEventListener(HH,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,n=e.getState();if(2===n||3===n||4===n){3!==n&&e.removeEventListener(HH,this.boundHandleTileChange_);const t=e.getKey();t in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[t],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let n=0;for(;this.tilesLoading_<t&&n<e&&this.getCount()>0;){const t=this.dequeue()[0],e=t.getKey();0!==t.getState()||e in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[e]=!0,++this.tilesLoading_,++n,t.load())}}},HG={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function GG(t,e,n){return Math.min(Math.max(t,e),n)}function ZG(t,e,n,r,i,s){const o=i-n,a=s-r;if(0!==o||0!==a){const l=((t-n)*o+(e-r)*a)/(o*o+a*a);l>1?(n=i,r=s):l>0&&(n+=o*l,r+=a*l)}return KG(t,e,n,r)}function KG(t,e,n,r){const i=n-t,s=r-e;return i*i+s*s}function YG(t){return 180*t/Math.PI}function XG(t){return t*Math.PI/180}function JG(t,e){const n=t%e;return n*e<0?n+e:n}function QG(t,e,n){return t+n*(e-t)}function tZ(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}function eZ(t,e){return Math.floor(tZ(t,e))}function nZ(t,e){return Math.ceil(tZ(t,e))}function rZ(t,e,n){if(t>=e&&t<n)return t;const r=n-e;return((t-e)%r+r)%r+e}function iZ(t,e,n){return function(r,i,s,o,a){if(!r)return;if(!i&&!e)return r;const l=e?0:s[0]*i,c=e?0:s[1]*i,u=a?a[0]:0,h=a?a[1]:0;let d=t[0]+l/2+u,p=t[2]-l/2+u,f=t[1]+c/2+h,g=t[3]-c/2+h;d>p&&(d=(p+d)/2,p=d),f>g&&(f=(g+f)/2,g=f);let m=GG(r[0],d,p),y=GG(r[1],f,g);if(o&&n&&i){const t=30*i;m+=-t*Math.log(1+Math.max(0,d-r[0])/t)+t*Math.log(1+Math.max(0,r[0]-p)/t),y+=-t*Math.log(1+Math.max(0,f-r[1])/t)+t*Math.log(1+Math.max(0,r[1]-g)/t)}return[m,y]}}function sZ(t){return t}function oZ(t){const e=[1/0,1/0,-1/0,-1/0];for(let n=0,r=t.length;n<r;++n)wZ(e,t[n]);return e}function aZ(t,e,n){return n?(n[0]=t[0]-e,n[1]=t[1]-e,n[2]=t[2]+e,n[3]=t[3]+e,n):[t[0]-e,t[1]-e,t[2]+e,t[3]+e]}function lZ(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t.slice()}function cZ(t,e,n){let r,i;return r=e<t[0]?t[0]-e:t[2]<e?e-t[2]:0,i=n<t[1]?t[1]-n:t[3]<n?n-t[3]:0,r*r+i*i}function uZ(t,e){return dZ(t,e[0],e[1])}function hZ(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}function dZ(t,e,n){return t[0]<=e&&e<=t[2]&&t[1]<=n&&n<=t[3]}function pZ(t,e){const n=t[0],r=t[1],i=t[2],s=t[3],o=e[0],a=e[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 fZ(t,e,n,r,i){return i?(i[0]=t,i[1]=e,i[2]=n,i[3]=r,i):[t,e,n,r]}function gZ(t){return fZ(1/0,1/0,-1/0,-1/0,t)}function mZ(t,e){const n=t[0],r=t[1];return fZ(n,r,n,r,e)}function yZ(t,e,n,r,i){return _Z(gZ(i),t,e,n,r)}function vZ(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function bZ(t,e){return e[0]<t[0]&&(t[0]=e[0]),e[2]>t[2]&&(t[2]=e[2]),e[1]<t[1]&&(t[1]=e[1]),e[3]>t[3]&&(t[3]=e[3]),t}function wZ(t,e){e[0]<t[0]&&(t[0]=e[0]),e[0]>t[2]&&(t[2]=e[0]),e[1]<t[1]&&(t[1]=e[1]),e[1]>t[3]&&(t[3]=e[1])}function _Z(t,e,n,r,i){for(;n<r;n+=i)xZ(t,e[n],e[n+1]);return t}function xZ(t,e,n){t[0]=Math.min(t[0],e),t[1]=Math.min(t[1],n),t[2]=Math.max(t[2],e),t[3]=Math.max(t[3],n)}function CZ(t,e){let n;return n=e(kZ(t)),n||(n=e(EZ(t)),n||(n=e(NZ(t)),n||(n=e(OZ(t)),n||!1)))}function SZ(t){let e=0;return DZ(t)||(e=FZ(t)*PZ(t)),e}function kZ(t){return[t[0],t[1]]}function EZ(t){return[t[2],t[1]]}function RZ(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]}function TZ(t,e){let n;if("bottom-left"===e)n=kZ(t);else if("bottom-right"===e)n=EZ(t);else if("top-left"===e)n=OZ(t);else{if("top-right"!==e)throw new Error("Invalid corner");n=NZ(t)}return n}function LZ(t,e,n,r,i){const[s,o,a,l,c,u,h,d]=IZ(t,e,n,r);return fZ(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 IZ(t,e,n,r){const i=e*r[0]/2,s=e*r[1]/2,o=Math.cos(n),a=Math.sin(n),l=i*o,c=i*a,u=s*o,h=s*a,d=t[0],p=t[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 PZ(t){return t[3]-t[1]}function MZ(t,e,n){const r=n||[1/0,1/0,-1/0,-1/0];return zZ(t,e)?(t[0]>e[0]?r[0]=t[0]:r[0]=e[0],t[1]>e[1]?r[1]=t[1]:r[1]=e[1],t[2]<e[2]?r[2]=t[2]:r[2]=e[2],t[3]<e[3]?r[3]=t[3]:r[3]=e[3]):gZ(r),r}function AZ(t,e){if(!zZ(t,e))return[t.slice()];if(hZ(e,t))return[];const[n,r,i,s]=t,o=Math.max(n,e[0]),a=Math.max(r,e[1]),l=Math.min(i,e[2]),c=Math.min(s,e[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 OZ(t){return[t[0],t[3]]}function NZ(t){return[t[2],t[3]]}function FZ(t){return t[2]-t[0]}function zZ(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function DZ(t){return t[2]<t[0]||t[3]<t[1]}function jZ(t,e,n,r){if(DZ(t))return gZ(n);let i=[];if(r>1){const e=t[2]-t[0],n=t[3]-t[1];for(let s=0;s<r;++s)i.push(t[0]+e*s/r,t[1],t[2],t[1]+n*s/r,t[2]-e*s/r,t[3],t[0],t[3]-n*s/r)}else i=[t[0],t[1],t[2],t[1],t[2],t[3],t[0],t[3]];e(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(t,e,n){return fZ(Math.min.apply(null,t),Math.min.apply(null,e),Math.max.apply(null,t),Math.max.apply(null,e),n)}(s,o,n)}function UZ(t,e){const n=e.getExtent(),r=RZ(t);if(e.canWrapX()&&(r[0]<n[0]||r[0]>=n[2])){const e=FZ(n),i=Math.floor((r[0]-n[0])/e)*e;t[0]-=i,t[2]-=i}return t}function BZ(t,e,n){if(e.canWrapX()){const r=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[r[0],t[1],r[2],t[3]]];UZ(t,e);const i=FZ(r);if(FZ(t)>i&&!n)return[[r[0],t[1],r[2],t[3]]];if(t[0]<r[0])return[[t[0]+i,t[1],r[2],t[3]],[r[0],t[1],t[2],t[3]]];if(t[2]>r[2])return[[t[0],t[1],r[2],t[3]],[r[0],t[1],t[2]-i,t[3]]]}return[t]}function $Z(t,e){let n=[t];for(let r=0,i=e.length;r<i&&n.length>0;++r){const t=[];for(let i=0,s=n.length;i<s;++i)t.push(...AZ(n[i],e[r]));n=t}return n}function qZ(t,e){let n=!0;for(let r=t.length-1;r>=0;--r)if(t[r]!=e[r]){n=!1;break}return n}function VZ(t,e){const n=Math.cos(e),r=Math.sin(e),i=t[0]*n-t[1]*r,s=t[1]*n+t[0]*r;return t[0]=i,t[1]=s,t}function WZ(t,e){if(e.canWrapX()){const n=FZ(e.getExtent()),r=function(t,e,n){const r=e.getExtent();let i=0;return e.canWrapX()&&(t[0]<r[0]||t[0]>r[2])&&(n=n||FZ(r),i=Math.floor((t[0]-r[0])/n)),i}(t,e,n);r&&(t[0]-=r*n)}return t}function HZ(t){return Math.pow(t,3)}function GZ(t){return 1-HZ(1-t)}function ZZ(t){return 3*t*t-2*t*t*t}function KZ(t){return t}function YZ(t,e,n){n=n||6371008.8;const r=XG(t[1]),i=XG(e[1]),s=(i-r)/2,o=XG(e[0]-t[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 XZ(t,e,n,r){r=r||6371008.8;const i=XG(t[1]),s=XG(t[0]),o=e/r,a=Math.asin(Math.sin(i)*Math.cos(o)+Math.cos(i)*Math.sin(o)*Math.cos(n));return[YG(s+Math.atan2(Math.sin(n)*Math.sin(o)*Math.cos(i),Math.cos(o)-Math.sin(i)*Math.sin(a))),YG(a)]}function JZ(...t){console.warn(...t)}var QZ={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937},tK=class{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||QZ[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}},eK=6378137,nK=Math.PI*eK,rK=[-nK,-nK,nK,nK],iK=[-180,-85,180,85],sK=eK*Math.log(Math.tan(Math.PI/2)),oK=class extends tK{constructor(t){super({code:t,units:"m",extent:rK,global:!0,worldExtent:iK,getPointResolution:function(t,e){return t/Math.cosh(e[1]/eK)}})}},aK=[new oK("EPSG:3857"),new oK("EPSG:102100"),new oK("EPSG:102113"),new oK("EPSG:900913"),new oK("http://www.opengis.net/def/crs/EPSG/0/3857"),new oK("http://www.opengis.net/gml/srs/epsg.xml#3857")],lK=[-180,-90,180,90],cK=6378137*Math.PI/180,uK=class extends tK{constructor(t,e){super({code:t,units:"degrees",extent:lK,axisOrientation:e,global:!0,metersPerUnit:cK,worldExtent:lK})}},hK=[new uK("CRS:84"),new uK("EPSG:4326","neu"),new uK("urn:ogc:def:crs:OGC:1.3:CRS84"),new uK("urn:ogc:def:crs:OGC:2:84"),new uK("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new uK("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new uK("http://www.opengis.net/def/crs/EPSG/0/4326","neu")],dK={},pK={};function fK(t,e,n){const r=t.getCode(),i=e.getCode();r in pK||(pK[r]={}),pK[r][i]=n}function gK(t,e){return t in pK&&e in pK[t]?pK[t][e]:null}var mK=.9996,yK=.00669438,vK=yK*yK*yK,bK=yK/.99330562,wK=Math.sqrt(.99330562),_K=(1-wK)/(1+wK),xK=_K*_K,CK=xK*_K,SK=CK*_K,kK=SK*_K,EK=.9983242984503243,RK=35*vK/3072,TK=1.5*_K-27/32*CK+269/512*kK,LK=21/16*xK-55/32*SK,IK=151/96*CK-417/128*kK,PK=1097/512*SK,MK=6378137;function AK(t,e,n){const r=t-5e5,i=(n.north?e:e-1e7)/mK/(MK*EK),s=i+TK*Math.sin(2*i)+LK*Math.sin(4*i)+IK*Math.sin(6*i)+PK*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-yK*a,p=Math.sqrt(1-yK*a),f=bK*l**2,g=f*f,m=r/(MK/p*mK),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*bK))+w*m/720*(61+90*u+298*f+45*h-252*bK-3*g);let x=(m-v/6*(1+2*u+f)+w/120*(5-2*f+28*u-3*g+8*bK+24*h))/l;return x=rZ(x+XG(NK(n.number)),-Math.PI,Math.PI),[YG(x),YG(_)]}function OK(t,e,n){t=rZ(t,-180,180),e<-80?e=-80:e>84&&(e=84);const r=XG(e),i=Math.sin(r),s=Math.cos(r),o=i/s,a=o*o,l=a*a,c=XG(t),u=XG(NK(n.number)),h=MK/Math.sqrt(1-yK*i**2),d=bK*s**2,p=s*rZ(c-u,-Math.PI,Math.PI),f=p*p,g=f*p,m=g*p,y=m*p,v=y*p,b=MK*(EK*r-.002514607064228144*Math.sin(2*r)+26390466021299826e-22*Math.sin(4*r)-RK*Math.sin(6*r)),w=mK*h*(p+g/6*(1-a+d)+y/120*(5-18*a+l+72*d-58*bK))+5e5;let _=mK*(b+h*o*(f/2+m/24*(5-a+9*d+4*d**2)+v/720*(61-58*a+l+600*d-330*bK)));return n.north||(_+=1e7),[w,_]}function NK(t){return 6*(t-1)-180+3}var FK=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function zK(t){let e=0;for(const i of FK){const n=t.match(i);if(n){e=parseInt(n[1]);break}}if(!e)return null;let n=0,r=!1;return e>32700&&e<32761?n=e-32700:e>32600&&e<32661&&(r=!0,n=e-32600),n?{number:n,north:r}:null}function DK(t,e){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=t(i,s,e);r[a]=o[0],r[a+1]=o[1]}return r}}var jK,UK,BK,$K=[function(t){const e=zK(t.getCode());return e?{forward:DK(OK,e),inverse:DK(AK,e)}:null}],qK=[function(t){return zK(t)?new tK({code:t,units:"m"}):null}],VK=!0;function WK(t){VK=!(void 0===t||t)}function HK(t,e){if(void 0!==e)for(let n=0,r=t.length;n<r;++n)e[n]=t[n];else e=t.slice();return e}function GK(t,e){if(void 0!==e&&t!==e){for(let n=0,r=t.length;n<r;++n)e[n]=t[n];t=e}return t}function ZK(t){!function(t,e){dK[t]=e}(t.getCode(),t),fK(t,t,HK)}function KK(t){if("string"!=typeof t)return t;const e=dK[n=t]||dK[n.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null;var n;if(e)return e;for(const r of qK){const e=r(t);if(e)return e}return null}function YK(t,e,n,r){let i;const s=(t=KK(t)).getPointResolutionFunc();if(s){if(i=s(e,n),r&&r!==t.getUnits()){const e=t.getMetersPerUnit();e&&(i=i*e/QZ[r])}}else{const s=t.getUnits();if("degrees"==s&&!r||"degrees"==r)i=e;else{const o=nY(t,KK("EPSG:4326"));if(o||"degrees"===s){let t=[n[0]-e/2,n[1],n[0]+e/2,n[1],n[0],n[1]-e/2,n[0],n[1]+e/2];t=o(t,t,2),i=(YZ(t.slice(0,2),t.slice(2,4))+YZ(t.slice(4,6),t.slice(6,8)))/2}else i=e*t.getMetersPerUnit();const a=r?QZ[r]:t.getMetersPerUnit();void 0!==a&&(i/=a)}}return i}function XK(t){!function(t){t.forEach(ZK)}(t),t.forEach(function(e){t.forEach(function(t){e!==t&&fK(e,t,HK)})})}function JK(t,e){return t?"string"==typeof t?KK(t):t:KK(e)}function QK(t,e){return WK(),sY(t,"EPSG:4326",void 0!==e?e:"EPSG:3857")}function tY(t,e){const n=sY(t,void 0!==e?e:"EPSG:3857","EPSG:4326"),r=n[0];return(r<-180||r>180)&&(n[0]=JG(r+180,360)-180),n}function eY(t,e){if(t===e)return!0;const n=t.getUnits()===e.getUnits();return(t.getCode()===e.getCode()||nY(t,e)===HK)&&n}function nY(t,e){const n=t.getCode(),r=e.getCode();let i=gK(n,r);if(i)return i;let s=null,o=null;for(const l of $K)s||(s=l(t)),o||(o=l(e));if(!s&&!o)return null;const a="EPSG:4326";if(o)if(s)i=rY(s.inverse,o.forward);else{const t=gK(n,a);t&&(i=rY(t,o.forward))}else{const t=gK(a,r);t&&(i=rY(s.inverse,t))}return i&&(ZK(t),ZK(e),fK(t,e,i)),i}function rY(t,e){return function(n,r,i,s){return r=t(n,r,i,s),e(r,r,i,s)}}function iY(t,e){return nY(KK(t),KK(e))}function sY(t,e,n){const r=iY(e,n);if(!r){const t=KK(e).getCode(),r=KK(n).getCode();throw new Error(`No transform available between ${t} and ${r}`)}return r(t,void 0,t.length)}function oY(t,e,n,r){return jZ(t,iY(e,n),void 0,r)}function aY(t){return t}function lY(t){return VK&&!qZ(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(VK=!1,JZ("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t}function cY(t){return t}XK(aK),XK(hK),jK=aK,UK=function(t,e,n,r){const i=t.length;n=n>1?n:2,r=r??n,void 0===e&&(e=n>2?t.slice():new Array(i));for(let s=0;s<i;s+=r){e[s]=nK*t[s]/180;let n=eK*Math.log(Math.tan(Math.PI*(+t[s+1]+90)/360));n>sK?n=sK:n<-sK&&(n=-sK),e[s+1]=n}return e},BK=function(t,e,n,r){const i=t.length;n=n>1?n:2,r=r??n,void 0===e&&(e=n>2?t.slice():new Array(i));for(let s=0;s<i;s+=r)e[s]=180*t[s]/nK,e[s+1]=360*Math.atan(Math.exp(t[s+1]/eK))/Math.PI-90;return e},hK.forEach(function(t){jK.forEach(function(e){fK(t,e,UK),fK(e,t,BK)})});var uY=[1,0,0,1,0,0],hY=new Array(6);function dY(){return uY.slice(0)}function pY(t){return gY(t,1,0,0,1,0,0)}function fY(t,e){const n=t[0],r=t[1],i=t[2],s=t[3],o=t[4],a=t[5],l=e[0],c=e[1],u=e[2],h=e[3],d=e[4],p=e[5];return t[0]=n*l+i*c,t[1]=r*l+s*c,t[2]=n*u+i*h,t[3]=r*u+s*h,t[4]=n*d+i*p+o,t[5]=r*d+s*p+a,t}function gY(t,e,n,r,i,s,o){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=s,t[5]=o,t}function mY(t,e){const n=e[0],r=e[1];return e[0]=t[0]*n+t[2]*r+t[4],e[1]=t[1]*n+t[3]*r+t[5],e}function yY(t,e,n){return fY(t,gY(hY,e,0,0,n,0,0))}function vY(t,e,n,r,i,s,o,a){const l=Math.sin(s),c=Math.cos(s);return t[0]=r*c,t[1]=i*l,t[2]=-r*l,t[3]=i*c,t[4]=o*r*c-a*r*l+e,t[5]=o*i*l+a*i*c+n,t}function bY(t,e){const n=(r=e)[0]*r[3]-r[1]*r[2];var r;$G(0!==n,"Transformation matrix cannot be inverted");const i=e[0],s=e[1],o=e[2],a=e[3],l=e[4],c=e[5];return t[0]=a/n,t[1]=-s/n,t[2]=-o/n,t[3]=i/n,t[4]=(o*c-a*l)/n,t[5]=-(i*c-s*l)/n,t}var wY=[1e5,1e5,1e5,1e5,2,2];function _Y(t){return t.substring(7,t.length-1).split(",").map(parseFloat)}function xY(t,e,n,r,i,s,o){s=s||[],o=o||2;let a=0;for(let l=e;l<n;l+=r){const e=t[l],n=t[l+1];s[a++]=i[0]*e+i[2]*n+i[4],s[a++]=i[1]*e+i[3]*n+i[5];for(let r=2;r<o;r++)s[a++]=t[l+r]}return s&&s.length!=a&&(s.length=a),s}function CY(t,e,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=e;d<n;d+=r){const e=t[d]-c,n=t[d+1]-u;o[h++]=c+e*a-n*l,o[h++]=u+e*l+n*a;for(let i=d+2;i<d+r;++i)o[h++]=t[i]}return o&&o.length!=h&&(o.length=h),o}var SY=dY(),kY=[NaN,NaN],EY=class extends vG{constructor(){super(),this.extent_=[1/0,1/0,-1/0,-1/0],this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=cG((t,e,n)=>{if(!n)return this.getSimplifiedGeometry(e);const r=this.clone();return r.applyTransform(n),r.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return fG()}closestPointXY(t,e,n,r){return fG()}containsXY(t,e){return 0===this.closestPointXY(t,e,kY,Number.MIN_VALUE)}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return fG()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&gZ(t),this.extentRevision_=this.getRevision()}return function(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}(this.extent_,t)}rotate(t,e){fG()}scale(t,e,n){fG()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return fG()}getType(){return fG()}applyTransform(t){fG()}intersectsExtent(t){return fG()}translate(t,e){fG()}transform(t,e){const n=KK(t),r="tile-pixels"==n.getUnits()?function(t,r,i){const s=n.getExtent(),o=n.getWorldExtent(),a=PZ(o)/PZ(s);vY(SY,o[0],o[3],a,-a,0,0,0);const l=xY(t,0,t.length,i,SY,r),c=iY(n,e);return c?c(l,l,i):l}:iY(n,e);return this.applyTransform(r),this}},RY=class extends EY{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return yZ(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return fG()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=LY(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){fG()}setLayout(t,e,n){let r;if(t)r=LY(t);else{for(let t=0;t<n;++t){if(0===e.length)return this.layout="XY",void(this.stride=2);e=e[0]}r=e.length,t=TY(r)}this.layout=t,this.stride=r}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const n=this.getFlatCoordinates();if(n){const r=this.getStride();CY(n,0,n.length,r,t,e,n),this.changed()}}scale(t,e,n){void 0===e&&(e=t),n||(n=RZ(this.getExtent()));const r=this.getFlatCoordinates();if(r){const i=this.getStride();!function(t,e,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 e=t[h]-l,n=t[h+1]-c;a[u++]=l+i*e,a[u++]=c+s*n;for(let i=h+2;i<h+r;++i)a[u++]=t[i]}a&&a.length!=u&&(a.length=u)}(r,0,r.length,i,t,e,n,r),this.changed()}}translate(t,e){const n=this.getFlatCoordinates();if(n){const r=this.getStride();!function(t,e,n,r,i,s,o){o=o||[];let a=0;for(let l=0;l<n;l+=r){o[a++]=t[l]+i,o[a++]=t[l+1]+s;for(let e=l+2;e<l+r;++e)o[a++]=t[e]}o&&o.length!=a&&(o.length=a)}(n,0,n.length,r,t,e,n),this.changed()}}};function TY(t){let e;return 2==t?e="XY":3==t?e="XYZ":4==t&&(e="XYZM"),e}function LY(t){let e;return"XY"==t?e=2:"XYZ"==t||"XYM"==t?e=3:"XYZM"==t&&(e=4),e}function IY(t,e,n,r){let i=0;const s=t[n-r],o=t[n-r+1];let a=0,l=0;for(;e<n;e+=r){const n=t[e]-s,r=t[e+1]-o;i+=l*n-a*r,a=n,l=r}return i/2}function PY(t,e,n,r){let i=0;for(let s=0,o=n.length;s<o;++s){const o=n[s];i+=IY(t,e,o,r),e=o}return i}function MY(t,e,n,r,i,s,o){const a=t[e],l=t[e+1],c=t[n]-a,u=t[n+1]-l;let h;if(0===c&&0===u)h=e;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]=QG(t[e+i],t[n+i],d);return void(o.length=r)}h=e}}for(let d=0;d<r;++d)o[d]=t[h+d];o.length=r}function AY(t,e,n,r,i){let s=t[e],o=t[e+1];for(e+=r;e<n;e+=r){const n=t[e],r=t[e+1],a=KG(s,o,n,r);a>i&&(i=a),s=n,o=r}return i}function OY(t,e,n,r,i){for(let s=0,o=n.length;s<o;++s){const o=n[s];i=AY(t,e,o,r,i),e=o}return i}function NY(t,e,n,r,i,s,o,a,l,c,u){if(e==n)return c;let h,d;if(0===i){if(d=KG(o,a,t[e],t[e+1]),d<c){for(h=0;h<r;++h)l[h]=t[e+h];return l.length=r,d}return c}u=u||[NaN,NaN];let p=e+r;for(;p<n;)if(MY(t,p-r,p,r,o,a,u),d=KG(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&&(MY(t,n-r,e,r,o,a,u),d=KG(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 FY(t,e,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=NY(t,e,d,r,i,s,o,a,l,c,u),e=d}return c}function zY(t,e,n,r){for(let i=0,s=n.length;i<s;++i){const s=n[i];for(let n=0;n<r;++n)t[e++]=s[n]}return e}function DY(t,e,n,r,i){i=i||[];let s=0;for(let o=0,a=n.length;o<a;++o){const a=zY(t,e,n[o],r);i[s++]=a,e=a}return i.length=s,i}function jY(t,e,n,r,i){i=i||[];let s=0;for(let o=0,a=n.length;o<a;++o){const a=DY(t,e,n[o],r,i[s]);0===a.length&&(a[0]=e),i[s++]=a,e=a[a.length-1]}return i.length=s,i}function UY(t,e,n,r,i){i=void 0!==i?i:[];let s=0;for(let o=e;o<n;o+=r)i[s++]=t.slice(o,o+r);return i.length=s,i}function BY(t,e,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++]=UY(t,e,a,r,i[s]),e=a}return i.length=s,i}function $Y(t,e,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]===e?[]:BY(t,e,a,r,i[s]),e=a[a.length-1]}return i.length=s,i}function qY(t,e,n,r,i){return!CZ(i,function(i){return!VY(t,e,n,r,i[0],i[1])})}function VY(t,e,n,r,i,s){let o=0,a=t[n-r],l=t[n-r+1];for(;e<n;e+=r){const n=t[e],r=t[e+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 WY(t,e,n,r,i,s){if(0===n.length)return!1;if(!VY(t,e,n[0],r,i,s))return!1;for(let o=1,a=n.length;o<a;++o)if(VY(t,n[o-1],n[o],r,i,s))return!1;return!0}function HY(t,e,n,r,i){let s;for(e+=r;e<n;e+=r)if(s=i(t.slice(e-r,e),t.slice(e,e+r)),s)return s;return!1}function GY(t,e,n,r,i,s){return s=s??_Z([1/0,1/0,-1/0,-1/0],t,e,n,r),!!zZ(i,s)&&(s[0]>=i[0]&&s[2]<=i[2]||s[1]>=i[1]&&s[3]<=i[3]||HY(t,e,n,r,function(t,e){return function(t,e,n){let r=!1;const i=pZ(t,e),s=pZ(t,n);if(1===i||1===s)r=!0;else{const o=t[0],a=t[1],l=t[2],c=t[3],u=e[0],h=e[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,t,e)}))}function ZY(t,e,n,r,i){return!!(GY(t,e,n,r,i)||VY(t,e,n,r,i[0],i[1])||VY(t,e,n,r,i[0],i[3])||VY(t,e,n,r,i[2],i[1])||VY(t,e,n,r,i[2],i[3]))}function KY(t,e,n,r,i){if(!ZY(t,e,n[0],r,i))return!1;if(1===n.length)return!0;for(let s=1,o=n.length;s<o;++s)if(qY(t,n[s-1],n[s],r,i)&&!GY(t,n[s-1],n[s],r,i))return!1;return!0}function YY(t,e,n,r,i,s,o){const a=(n-e)/r;if(a<3){for(;e<n;e+=r)s[o++]=t[e],s[o++]=t[e+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const c=[e,n-r];let u=0;for(;c.length>0;){const n=c.pop(),s=c.pop();let o=0;const a=t[s],h=t[s+1],d=t[n],p=t[n+1];for(let e=s+r;e<n;e+=r){const n=ZG(t[e],t[e+1],a,h,d,p);n>o&&(u=e,o=n)}o>i&&(l[(u-e)/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++]=t[e+h*r],s[o++]=t[e+h*r+1]);return o}function XY(t,e,n,r,i,s,o,a){for(let l=0,c=n.length;l<c;++l){const c=n[l];o=YY(t,e,c,r,i,s,o),a.push(o),e=c}return o}function JY(t,e){return e*Math.round(t/e)}function QY(t,e,n,r,i,s,o){if(e==n)return o;let a,l,c=JY(t[e],i),u=JY(t[e+1],i);e+=r,s[o++]=c,s[o++]=u;do{if(a=JY(t[e],i),l=JY(t[e+1],i),(e+=r)==n)return s[o++]=a,s[o++]=l,o}while(a==c&&l==u);for(;e<n;){const n=JY(t[e],i),h=JY(t[e+1],i);if(e+=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 tX(t,e,n,r,i,s,o,a){for(let l=0,c=n.length;l<c;++l){const c=n[l];o=QY(t,e,c,r,i,s,o),a.push(o),e=c}return o}var eX=class t extends RY{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}clone(){return new t(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,n,r){return r<cZ(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(AY(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),NY(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,n,r))}getArea(){return IY(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return UY(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){const n=[];return n.length=YY(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,n,0),new t(n,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return GY(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=zY(this.flatCoordinates,0,t,this.stride),this.changed()}},nX=class t extends RY{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const e=new t(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(t,e,n,r){const i=this.flatCoordinates,s=KG(t,e,i[0],i[1]);if(s<r){const t=this.stride;for(let e=0;e<t;++e)n[e]=i[e];return n.length=t,s}return r}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return mZ(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return dZ(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=function(t,e,n){for(let r=0,i=n.length;r<i;++r)t[e++]=n[r];return e}(this.flatCoordinates,0,t,this.stride),this.changed()}};function rX(t,e,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=t[i-r],d=t[i-r+1],a=e;a<i;a+=r)h=t[a],p=t[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(tG),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,WY(t,e,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 iX(t,e,n,r,i){let s=[];for(let o=0,a=n.length;o<a;++o){const a=n[o];s=rX(t,e,a,r,i,2*o,s),e=a[a.length-1]}return s}function sX(t,e,n,r){for(;e<n-r;){for(let i=0;i<r;++i){const s=t[e+i];t[e+i]=t[n-r+i],t[n-r+i]=s}e+=r,n-=r}}function oX(t,e,n,r){let i=0,s=t[n-r],o=t[n-r+1];for(;e<n;e+=r){const n=t[e],r=t[e+1];i+=(n-s)*(r+o),s=n,o=r}return 0===i?void 0:i>0}function aX(t,e,n,r,i){i=void 0!==i&&i;for(let s=0,o=n.length;s<o;++s){const o=n[s],a=oX(t,e,o,r);if(0===s){if(i&&a||!i&&!a)return!1}else if(i&&!a||!i&&a)return!1;e=o}return!0}function lX(t,e,n,r,i){for(let s=0,o=n.length;s<o;++s){const o=n[s];if(!aX(t,e,o,r,i))return!1;o.length&&(e=o[o.length-1])}return!0}function cX(t,e,n,r,i){i=void 0!==i&&i;for(let s=0,o=n.length;s<o;++s){const o=n[s],a=oX(t,e,o,r);(0===s?i&&a||!i&&!a:i&&!a||!i&&a)&&sX(t,e,o,r),e=o}return e}function uX(t,e,n,r,i){for(let s=0,o=n.length;s<o;++s)e=cX(t,e,n[s],r,i);return e}function hX(t,e){const n=[];let r,i=0,s=0;for(let o=0,a=e.length;o<a;++o){const a=e[o],l=oX(t,i,a,2);if(void 0===r&&(r=l),l===r)n.push(e.slice(s,o+1));else{if(0===n.length)continue;n[n.length-1].push(e[s])}s=o+1,i=a}return n}var dX=class t extends RY{constructor(t,e,n){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,void 0!==e&&n?(this.setFlatCoordinates(e,t),this.ends_=n):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?iG(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const e=new t(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(t,e,n,r){return r<cZ(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(OY(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),FY(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,n,r))}containsXY(t,e){return WY(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return PY(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),cX(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,BY(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=RZ(this.getExtent());this.flatInteriorPoint_=rX(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new nX(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new eX(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=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 eX(e.slice(i,o),t);r.push(a),i=o}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;aX(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=cX(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){const n=[],r=[];return n.length=tX(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),n,0,r),new t(n,"XY",r)}getType(){return"Polygon"}intersectsExtent(t){return KY(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const n=DY(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===n.length?0:n[n.length-1],this.changed()}};function pX(t){if(DZ(t))throw new Error("Cannot create polygon from empty extent");const e=t[0],n=t[1],r=t[2],i=t[3],s=[e,n,e,i,r,i,r,n,e,n];return new dX(s,"XY",[s.length])}function fX(t,e,n,r){const i=FZ(e)/n[0],s=PZ(e)/n[1];return r?Math.min(t,Math.max(i,s)):Math.min(t,Math.min(i,s))}function gX(t,e,n){let r=Math.min(t,e);return r*=Math.log(1+50*Math.max(0,t/e-1))/50+1,n&&(r=Math.max(r,n),r/=Math.log(1+50*Math.max(0,n/t-1))/50+1),GG(r,n/2,2*e)}function mX(t,e,n,r,i){return n=void 0===n||n,function(s,o,a,l){if(void 0!==s){const o=r?fX(t,r,a,i):t;return n&&l?gX(s,o,e):GG(s,e,o)}}}function yX(t){if(void 0!==t)return 0}function vX(t){if(void 0!==t)return t}var bX=class extends vG{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=JK(t.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,t.projection&&WK(),t.center&&(t.center=lY(t.center,this.projection_)),t.extent&&(t.extent=cY(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const o in HG)delete e[o];this.setProperties(e,!0);const n=function(t){let e,n,r,i=void 0!==t.minZoom?t.minZoom:0,s=void 0!==t.maxZoom?t.maxZoom:28;const o=void 0!==t.zoomFactor?t.zoomFactor:2,a=void 0!==t.multiWorld&&t.multiWorld,l=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,c=void 0!==t.showFullExtent&&t.showFullExtent,u=JK(t.projection,"EPSG:3857"),h=u.getExtent();let d=t.constrainOnlyCenter,p=t.extent;if(a||p||!u.isGlobal()||(d=!1,p=h),void 0!==t.resolutions){const o=t.resolutions;n=o[i],r=void 0!==o[s]?o[s]:o[o.length-1],e=t.constrainResolution?function(t,e,n,r){return e=void 0===e||e,function(i,s,o,a){if(void 0!==i){const l=t[0],c=t[t.length-1],u=n?fX(l,n,o,r):l;if(a)return e?gX(i,u,c):GG(i,c,u);const h=Math.floor(nG(t,Math.min(u,i),s));return t[h]>u&&h<t.length-1?t[h+1]:t[h]}}}(o,l,!d&&p,c):mX(n,r,l,!d&&p,c)}else{const a=(h?Math.max(FZ(h),PZ(h)):360*QZ.degrees/u.getMetersPerUnit())/256/Math.pow(2,0),f=a/Math.pow(2,28);n=t.maxResolution,void 0!==n?i=0:n=a/Math.pow(o,i),r=t.minResolution,void 0===r&&(r=void 0!==t.maxZoom?void 0!==t.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),e=t.constrainResolution?function(t,e,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?fX(e,i,l,s):e;if(c)return r?gX(o,u,n):GG(o,n,u);const h=Math.ceil(Math.log(e/u)/Math.log(t)-1e-9),d=.499999999*-a+.5,p=Math.floor(Math.log(e/Math.min(u,o))/Math.log(t)+d);return GG(e/Math.pow(t,Math.max(h,p)),n,u)}}}(o,n,r,l,!d&&p,c):mX(n,r,l,!d&&p,c)}return{constraint:e,maxResolution:n,minResolution:r,minZoom:i,zoomFactor:o}}(t);this.maxResolution_=n.maxResolution,this.minResolution_=n.minResolution,this.zoomFactor_=n.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=n.minZoom;const r=function(t){if(void 0!==t.extent){const e=void 0===t.smoothExtentConstraint||t.smoothExtentConstraint;return iZ(t.extent,t.constrainOnlyCenter,e)}const e=JK(t.projection,"EPSG:3857");if(!0!==t.multiWorld&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,iZ(t,!1,!1)}return sZ}(t),i=n.constraint,s=function(t){if(void 0===t.enableRotation||t.enableRotation){const e=t.constrainRotation;return void 0===e||!0===e?function(){const t=XG(5);return function(e,n){return n||void 0===e?e:Math.abs(e)<=t?0:e}}():!1===e?vX:"number"==typeof e?function(t){const e=2*Math.PI/t;return function(t,n){return n?t:void 0!==t?t=Math.floor(t/e+.5)*e:void 0}}(e):vX}return yX}(t);this.constraints_={center:r,resolution:i,rotation:s},this.setRotation(void 0!==t.rotation?t.rotation:0),this.setCenterInternal(void 0!==t.center?t.center:null),void 0!==t.resolution?this.setResolution(t.resolution):void 0!==t.zoom&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const n=this.getCenterInternal();if(n){const r=t||[0,0,0,0];e=e||[0,0,0,0];const i=this.getResolution(),s=i/2*(r[3]-e[3]+e[1]-r[1]),o=i/2*(r[0]-e[0]+e[2]-r[2]);this.setCenterInternal([n[0]+s,n[1]-o])}}getUpdatedOptions_(t){const e=this.getProperties();return void 0!==e.resolution?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let n=0;n<e.length;++n){let t=arguments[n];t.center&&(t=Object.assign({},t),t.center=lY(t.center,this.getProjection())),t.anchor&&(t=Object.assign({},t),t.anchor=lY(t.anchor,this.getProjection())),e[n]=t}this.animateInternal.apply(this,e)}animateInternal(t){let e,n=arguments.length;n>1&&"function"==typeof arguments[n-1]&&(e=arguments[n-1],--n);let r=0;for(;r<n&&!this.isDef();++r){const t=arguments[r];t.center&&this.setCenterInternal(t.center),void 0!==t.zoom?this.setZoom(t.zoom):t.resolution&&this.setResolution(t.resolution),void 0!==t.rotation&&this.setRotation(t.rotation)}if(r===n)return void(e&&wX(e,!0));let i=Date.now(),s=this.targetCenter_.slice(),o=this.targetResolution_,a=this.targetRotation_;const l=[];for(;r<n;++r){const t=arguments[r],n={start:i,complete:!1,anchor:t.anchor,duration:void 0!==t.duration?t.duration:1e3,easing:t.easing||ZZ,callback:e};if(t.center&&(n.sourceCenter=s,n.targetCenter=t.center.slice(),s=n.targetCenter),void 0!==t.zoom?(n.sourceResolution=o,n.targetResolution=this.getResolutionForZoom(t.zoom),o=n.targetResolution):t.resolution&&(n.sourceResolution=o,n.targetResolution=t.resolution,o=n.targetResolution),void 0!==t.rotation){n.sourceRotation=a;const e=JG(t.rotation-a+Math.PI,2*Math.PI)-Math.PI;n.targetRotation=a+e,a=n.targetRotation}_X(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 t;this.setHint(0,-this.hints_[0]);for(let e=0,n=this.animations_.length;e<n;++e){const n=this.animations_[e];if(n[0].callback&&wX(n[0].callback,!1),!t)for(let e=0,r=n.length;e<r;++e){const r=n[e];if(!r.complete){t=r.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,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 t=Date.now();let e=!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=t-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 t=s.sourceCenter[0],e=s.sourceCenter[1],n=s.targetCenter[0],r=s.targetCenter[1];this.nextCenter_=s.targetCenter;const i=t+l*(n-t),o=e+l*(r-e);this.targetCenter_=[i,o]}if(s.sourceResolution&&s.targetResolution){const t=1===l?s.targetResolution:s.sourceResolution+l*(s.targetResolution-s.sourceResolution);if(s.anchor){const e=this.getViewportSize_(this.getRotation()),n=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(n,s.anchor)}this.nextResolution_=s.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==s.sourceRotation&&void 0!==s.targetRotation){const t=1===l?JG(s.targetRotation+Math.PI,2*Math.PI)-Math.PI:s.sourceRotation+l*(s.targetRotation-s.sourceRotation);if(s.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,s.anchor)}this.nextRotation_=s.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!s.complete)break}if(i){this.animations_[n]=null,this.setHint(0,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=r[0].callback;t&&wX(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let n;const r=this.getCenterInternal();var i,s;return void 0!==r&&(n=[r[0]-e[0],r[1]-e[1]],VZ(n,t-this.getRotation()),s=e,(i=n)[0]+=+s[0],i[1]+=+s[1]),n}calculateCenterZoom(t,e){let n;const r=this.getCenterInternal(),i=this.getResolution();return void 0!==r&&void 0!==i&&(n=[e[0]-t*(e[0]-r[0])/i,e[1]-t*(e[1]-r[1])/i]),n}getViewportSize_(t){const e=this.viewportSize_;if(t){const n=e[0],r=e[1];return[Math.abs(n*Math.cos(t))+Math.abs(r*Math.sin(t)),Math.abs(n*Math.sin(t))+Math.abs(r*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?aY(t,this.getProjection()):t}getCenterInternal(){return this.get(HG.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){return e=this.calculateExtentInternal(t),this.getProjection(),e;var e}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();$G(e,"The view center is not defined");const n=this.getResolution();$G(void 0!==n,"The view resolution is not defined");const r=this.getRotation();return $G(void 0!==r,"The view rotation is not defined"),LZ(e,n,r,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(HG.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(cY(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const n=FZ(t)/e[0],r=PZ(t)/e[1];return Math.max(n,r)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(e/n)/Math.log(t);return function(n){return e/Math.pow(t,n*r)}}getRotation(){return this.get(HG.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),n=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,i=Math.log(n/r)/e;return function(t){return Math.log(n/t)/e/i}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const n=this.padding_;return n&&(e=[e[0]-n[1]-n[3],e[1]-n[0]-n[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),n=this.getRotation();let r=this.getCenterInternal();const i=this.padding_;if(i){const t=this.getViewportSizeMinusPadding_();r=xX(r,this.getViewportSize_(),[t[0]/2+i[3],t[1]/2+i[0]],e,n)}return{center:r.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,n,r=this.minZoom_||0;if(this.resolutions_){const i=nG(this.resolutions_,t,1);r=i,e=this.resolutions_[i],n=i==this.resolutions_.length-1?2:e/this.resolutions_[i+1]}else e=this.maxResolution_,n=this.zoomFactor_;return r+Math.log(e/t)/Math.log(n)}getResolutionForZoom(t){if(this.resolutions_?.length){if(1===this.resolutions_.length)return this.resolutions_[0];const e=GG(Math.floor(t),0,this.resolutions_.length-2),n=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(n,GG(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let n;if($G(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t))$G(!DZ(t),"Cannot fit empty extent provided as `geometry`"),n=pX(cY(t,this.getProjection()));else if("Circle"===t.getType()){const e=cY(t.getExtent(),this.getProjection());n=pX(e),n.rotate(this.getRotation(),RZ(e))}else{const e=null;n=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(n,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),n=Math.cos(e),r=Math.sin(-e),i=t.getFlatCoordinates(),s=t.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 t=i[u]*n-i[u+1]*r,e=i[u]*r+i[u+1]*n;o=Math.min(o,t),a=Math.min(a,e),l=Math.max(l,t),c=Math.max(c,e)}return[o,a,l,c]}fitInternal(t,e){let n=(e=e||{}).size;n||(n=this.getViewportSizeMinusPadding_());const r=void 0!==e.padding?e.padding:[0,0,0,0],i=void 0!==e.nearest&&e.nearest;let s;s=void 0!==e.minResolution?e.minResolution:void 0!==e.maxZoom?this.getResolutionForZoom(e.maxZoom):0;const o=this.rotatedExtentForGeometry(t);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=RZ(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=e.callback?e.callback:lG;void 0!==e.duration?this.animateInternal({resolution:a,center:f,duration:e.duration,easing:e.easing},g):(this.targetResolution_=a,this.targetCenter_=f,this.applyTargetState_(!1,!0),wX(g,!0))}centerOn(t,e,n){this.centerOnInternal(lY(t,this.getProjection()),e,n)}centerOnInternal(t,e,n){this.setCenterInternal(xX(t,e,n,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,n,r){let i;const s=this.padding_;if(s&&t){const o=this.getViewportSizeMinusPadding_(-n),a=xX(t,r,[o[0]/2+s[3],o[1]/2+s[0]],e,n);i=[t[0]-a[0],t[1]-a[1]]}return i}isDef(){return!!this.getCenterInternal()&&void 0!==this.getResolution()}adjustCenter(t){const e=aY(this.targetCenter_,this.getProjection());this.setCenter([e[0]+t[0],e[1]+t[1]])}adjustCenterInternal(t){const e=this.targetCenter_;this.setCenterInternal([e[0]+t[0],e[1]+t[1]])}adjustResolution(t,e){e=e&&lY(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const n=this.getAnimating()||this.getInteracting(),r=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(this.targetResolution_*t,0,r,n);e&&(this.targetCenter_=this.calculateCenterZoom(i,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=lY(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const n=this.getAnimating()||this.getInteracting(),r=this.constraints_.rotation(this.targetRotation_+t,n);e&&(this.targetCenter_=this.calculateCenterRotate(r,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t?lY(t,this.getProjection()):t)}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const n=this.getAnimating()||this.getInteracting()||e,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(HG.ROTATION)!==r&&this.set(HG.ROTATION,r),this.get(HG.RESOLUTION)!==s&&(this.set(HG.RESOLUTION,s),this.set("zoom",this.getZoom(),!0)),o&&this.get(HG.CENTER)&&qZ(this.get(HG.CENTER),o)||this.set(HG.CENTER,o),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,n){t=void 0!==t?t:200;const r=e||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===t&&!this.cancelAnchor_)return this.targetResolution_=o,this.targetRotation_=i,this.targetCenter_=a,void this.applyTargetState_();n=n||(0===t?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,this.getResolution()===o&&this.getRotation()===i&&this.getCenterInternal()&&qZ(this.getCenterInternal(),a)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:i,center:a,resolution:o,duration:t,easing:GZ,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(1,1)}endInteraction(t,e,n){n=n&&lY(n,this.getProjection()),this.endInteractionInternal(t,e,n)}endInteractionInternal(t,e,n){this.getInteracting()&&(this.setHint(1,-1),this.resolveConstraints(t,e,n))}getConstrainedCenter(t,e){const n=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),n)}getConstrainedZoom(t,e){const n=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(n,e))}getConstrainedResolution(t,e){e=e||0;const n=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,n)}};function wX(t,e){setTimeout(function(){t(e)},0)}function _X(t){return!(t.sourceCenter&&t.targetCenter&&!qZ(t.sourceCenter,t.targetCenter))&&t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation}function xX(t,e,n,r,i){const s=Math.cos(-i);let o=Math.sin(-i),a=t[0]*s-t[1]*o,l=t[1]*s+t[0]*o;return a+=(e[0]/2-n[0])*r,l+=(n[1]-e[1]/2)*r,o=-o,[a*s-l*o,l*s+a*o]}var CX,SX="ol-hidden",kX="ol-unselectable",EX="ol-control",RX="ol-collapsed",TX=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"),LX=["style","variant","weight","size","lineHeight","family"],IX={normal:400,bold:700},PX=function(t){const e=t.match(TX);if(!e)return null;const n={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let r=0,i=LX.length;r<i;++r){const t=e[r+1];void 0!==t&&(n[LX[r]]="string"==typeof t?t.trim():t)}return isNaN(Number(n.weight))&&n.weight in IX&&(n.weight=IX[n.weight]),n.families=n.family.split(/,\s?/).map(t=>t.trim().replace(/^['"]|['"]$/g,"")),n};function MX(t,e,n,r){let i;return i=n&&n.length?n.shift():LG?new class extends OffscreenCanvas{style={}}(t??300,e??150):document.createElement("canvas"),t&&(i.width=t),e&&(i.height=e),i.getContext("2d",r)}function AX(){return CX||(CX=MX(1,1)),CX}function OX(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function NX(t){let e=t.offsetWidth;const n=getComputedStyle(t);return e+=parseInt(n.marginLeft,10)+parseInt(n.marginRight,10),e}function FX(t){let e=t.offsetHeight;const n=getComputedStyle(t);return e+=parseInt(n.marginTop,10)+parseInt(n.marginBottom,10),e}function zX(t,e){const n=e.parentNode;n&&n.replaceChild(t,e)}function DX(t){for(;t.lastChild;)t.lastChild.remove()}function jX(){return new Proxy({childNodes:[],appendChild:function(t){return this.childNodes.push(t),t},remove:function(){},removeChild:function(t){const e=this.childNodes.indexOf(t);if(-1===e)throw new Error("Node to remove was not found");return this.childNodes.splice(e,1),t},insertBefore:function(t,e){const n=this.childNodes.indexOf(e);if(-1===n)throw new Error("Reference node not found");return this.childNodes.splice(n,0,t),t},style:{}},{get:(t,e,n)=>"firstElementChild"===e?t.childNodes.length>0?t.childNodes[0]:null:Reflect.get(t,e,n)})}function UX(t){return"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas}var BX=class extends vG{constructor(t){super();const e=t.element;!e||t.target||e.style.pointerEvents||(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&this.element?.remove();for(let e=0,n=this.listenerKeys.length;e<n;++e)WH(this.listenerKeys[e]);if(this.listenerKeys.length=0,this.map_=t,t){const e=this.target_??t.getOverlayContainerStopEvent();this.element&&e.appendChild(this.element),this.render!==lG&&this.listenerKeys.push(qH(t,NG,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_="string"==typeof t?document.getElementById(t):t}},$X=class extends BX{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=void 0===t.collapsed||t.collapsed,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=void 0!==t.collapsible,this.collapsible_=void 0===t.collapsible||t.collapsible,this.collapsible_||(this.collapsed_=!1),this.attributions_=t.attributions;const e=void 0!==t.className?t.className:"ol-attribution",n=void 0!==t.tipLabel?t.tipLabel:"Attributions",r=void 0!==t.expandClassName?t.expandClassName:e+"-expand",i=void 0!==t.collapseLabel?t.collapseLabel:"›",s=void 0!==t.collapseClassName?t.collapseClassName:e+"-collapse";"string"==typeof i?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=i,this.collapseLabel_.className=s):this.collapseLabel_=i;const o=void 0!==t.label?t.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(ZH,this.handleClick_.bind(this),!1);const l=e+" "+kX+" "+EX+(this.collapsed_&&this.collapsible_?" "+RX:"")+(this.collapsible_?"":" ol-uncollapsible"),c=this.element;c.className=l,c.appendChild(this.toggleButton_),c.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=this.getMap().getAllLayers(),n=new Set(e.flatMap(e=>e.getAttributions(t)));if(void 0!==this.attributions_&&(Array.isArray(this.attributions_)?this.attributions_.forEach(t=>n.add(t)):n.add(this.attributions_)),!this.overrideCollapsible_){const t=!e.some(t=>!1===t.getSource()?.getAttributionsCollapsible());this.setCollapsible(t)}return Array.from(n)}async updateElement_(t){if(!t)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));const e=await Promise.all(this.collectSourceAttributions_(t).map(t=>uG(()=>t))),n=e.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!sG(e,this.renderedAttributions_)){DX(this.ulElement_);for(let t=0,n=e.length;t<n;++t){const n=document.createElement("li");n.innerHTML=e[t],this.ulElement_.appendChild(n)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(RX),this.collapsed_?zX(this.collapseLabel_,this.label_):zX(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}},qX=class extends BX{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});const e=void 0!==t.className?t.className:"ol-rotate",n=void 0!==t.label?t.label:"⇧",r=void 0!==t.compassClassName?t.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=t.tipLabel?t.tipLabel:"Reset rotation",s=document.createElement("button");s.className=e+"-reset",s.setAttribute("type","button"),s.title=i,s.appendChild(this.label_),s.addEventListener(ZH,this.handleClick_.bind(this),!1);const o=e+" "+kX+" "+EX,a=this.element;a.className=o,a.appendChild(s),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=void 0!==t.duration?t.duration:250,this.autoHide_=void 0===t.autoHide||t.autoHide,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(SX)}handleClick_(t){t.preventDefault(),void 0!==this.callResetNorth_?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const t=this.getMap().getView();if(!t)return;const e=t.getRotation();void 0!==e&&(this.duration_>0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:GZ}):t.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const n=e.viewState.rotation;if(n!=this.rotation_){const t="rotate("+n+"rad)";if(this.autoHide_){const t=this.element.classList.contains(SX);t||0!==n?t&&0!==n&&this.element.classList.remove(SX):this.element.classList.add(SX)}this.label_.style.transform=t}this.rotation_=n}},VX=class extends BX{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=void 0!==t.className?t.className:"ol-zoom",n=void 0!==t.delta?t.delta:1,r=void 0!==t.zoomInClassName?t.zoomInClassName:e+"-in",i=void 0!==t.zoomOutClassName?t.zoomOutClassName:e+"-out",s=void 0!==t.zoomInLabel?t.zoomInLabel:"+",o=void 0!==t.zoomOutLabel?t.zoomOutLabel:"–",a=void 0!==t.zoomInTipLabel?t.zoomInTipLabel:"Zoom in",l=void 0!==t.zoomOutTipLabel?t.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(ZH,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(ZH,this.handleClick_.bind(this,-n),!1);const h=e+" "+kX+" "+EX,d=this.element;d.className=h,d.appendChild(c),d.appendChild(u),this.duration_=void 0!==t.duration?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const e=this.getMap().getView();if(!e)return;const n=e.getZoom();if(void 0!==n){const r=e.getConstrainedZoom(n+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:r,duration:this.duration_,easing:GZ})):e.setZoom(r)}}};function WX(t){t=t||{};const e=new _G;return(void 0===t.zoom||t.zoom)&&e.push(new VX(t.zoomOptions)),(void 0===t.rotate||t.rotate)&&e.push(new qX(t.rotateOptions)),(void 0===t.attribution||t.attribution)&&e.push(new $X(t.attributionOptions)),e}var HX=class{constructor(t,e,n){this.decay_=t,this.minVelocity_=e,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let n=e-3;for(;n>0&&this.points_[n+2]>t;)n-=3;const r=this.points_[e+2]-this.points_[n+2];if(r<1e3/60)return!1;const i=this.points_[e]-this.points_[n],s=this.points_[e+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_}},GX="active",ZX=class extends vG{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(GX)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(GX,t)}setMap(t){this.map_=t}};function KX(t,e,n,r){const i=t.getZoom();if(void 0===i)return;const s=t.getConstrainedZoom(i+e),o=t.getResolutionForZoom(s);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:o,anchor:n,duration:void 0!==r?r:250,easing:GZ})}var YX=class extends ZX{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:250}handleEvent(t){let e=!1;if(t.type==SG.DBLCLICK){const n=t.originalEvent,r=t.map,i=t.coordinate,s=n.shiftKey?-this.delta_:this.delta_;KX(r.getView(),s,i,this.duration_),n.preventDefault(),e=!0}return!e}};function XX(t){const e=arguments;return function(t){let n=!0;for(let r=0,i=e.length;r<i&&(n=n&&e[r](t),n);++r);return n}}var JX=function(t){const e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},QX=function(t){const e=t.map.getTargetElement(),n=e.getRootNode();return!(n instanceof ShadowRoot?n.host:e).hasAttribute("tabindex")||function(t){const e=t.map.getTargetElement(),n=e.getRootNode(),r=t.map.getOwnerDocument().activeElement;return n instanceof ShadowRoot?n.host.contains(r):e.contains(r)}(t)},tJ=oG,eJ=function(t){const e=t.originalEvent;return"pointerId"in e&&0==e.button&&!(EG&&RG&&e.ctrlKey)},nJ=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},rJ=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},iJ=function(t){const e=t.originalEvent,n=e.target.tagName;return"INPUT"!==n&&"SELECT"!==n&&"TEXTAREA"!==n&&!e.target.isContentEditable},sJ=function(t){const e=t.originalEvent;return"pointerId"in e&&"mouse"==e.pointerType},oJ=function(t){const e=t.originalEvent;return"pointerId"in e&&e.isPrimary&&0===e.button},aJ=class extends ZX{constructor(t){super(t=t||{}),t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==SG.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==SG.POINTERUP){const e=this.handleUpEvent(t);this.handlingDownUpSequence=e&&this.targetPointers.length>0}}else if(t.type==SG.POINTERDOWN){const n=this.handleDownEvent(t);this.handlingDownUpSequence=n,e=this.stopDown(n)}else t.type==SG.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}};function lJ(t){const e=t.length;let n=0,r=0;for(let i=0;i<e;i++)n+=t[i].clientX,r+=t[i].clientY;return{clientX:n/e,clientY:r/e}}var cJ=class extends aJ{constructor(t){super({stopDown:aG}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:XX(nJ,oJ);this.condition_=t.onFocusOnly?XX(QX,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const n=this.targetPointers,r=e.getEventPixel(lJ(n));if(n.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(r[0],r[1]),this.lastCentroid){const e=[this.lastCentroid[0]-r[0],r[1]-this.lastCentroid[1]],n=t.map.getView();i=e,s=n.getResolution(),i[0]*=s,i[1]*=s,VZ(e,n.getRotation()),n.adjustCenterInternal(e)}}else this.kinetic_&&this.kinetic_.begin();var i,s;this.lastCentroid=r,this.lastPointersCount_=n.length,t.originalEvent.preventDefault()}handleUpEvent(t){const e=t.map,n=e.getView();if(0===this.targetPointers.length){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const t=this.kinetic_.getDistance(),r=this.kinetic_.getAngle(),i=n.getCenterInternal(),s=e.getPixelFromCoordinateInternal(i),o=e.getCoordinateFromPixelInternal([s[0]-t*Math.cos(r),s[1]-t*Math.sin(r)]);n.animateInternal({center:n.getConstrainedCenter(o),duration:500,easing:GZ})}return this.panning_&&(this.panning_=!1,n.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&this.condition_(t)){const e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},uJ=class extends aJ{constructor(t){t=t||{},super({stopDown:aG}),this.condition_=t.condition?t.condition:JX,this.lastAngle_=void 0,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!sJ(t))return;const e=t.map,n=e.getView();if(n.getConstraints().rotation===yX)return;const r=e.getSize(),i=t.pixel,s=Math.atan2(r[1]/2-i[1],i[0]-r[0]/2);if(void 0!==this.lastAngle_){const t=s-this.lastAngle_;n.adjustRotationInternal(-t)}this.lastAngle_=s}handleUpEvent(t){return!sJ(t)||(t.map.getView().endInteraction(this.duration_),!1)}handleDownEvent(t){return!(!sJ(t)||!eJ(t)||!this.condition_(t)||(t.map.getView().beginInteraction(),this.lastAngle_=void 0,0))}},hJ=class extends QH{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,n="px",r=this.element_.style;r.left=Math.min(t[0],e[0])+n,r.top=Math.min(t[1],e[1])+n,r.width=Math.abs(e[0]-t[0])+n,r.height=Math.abs(e[1]-t[1])+n}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const t=this.startPixel_,e=this.endPixel_,n=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);n[4]=n[0].slice(),this.geometry_?this.geometry_.setCoordinates([n]):this.geometry_=new dX([n])}getGeometry(){return this.geometry_}},dJ="boxcancel",pJ=class extends hG{constructor(t,e,n){super(t),this.coordinate=e,this.mapBrowserEvent=n}},fJ=class extends aJ{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new hJ(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??eJ,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,n){const r=n[0]-e[0],i=n[1]-e[1];return r*r+i*i>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new pJ("boxdrag",t.coordinate,t)))}handleUpEvent(t){if(!this.startPixel_)return!1;const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new pJ(e?"boxend":dJ,t.coordinate,t)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(t){return!!this.condition_(t)&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new pJ("boxstart",t.coordinate,t)),!0)}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new pJ(dJ,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new pJ(dJ,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}},gJ=class extends fJ{constructor(t){super({condition:(t=t||{}).condition?t.condition:rJ,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=void 0!==t.duration?t.duration:200,this.out_=void 0!==t.out&&t.out}onBoxEnd(t){const e=this.getMap().getView();let n=this.getGeometry();if(this.out_){const t=e.rotatedExtentForGeometry(n),r=e.getResolutionForExtentInternal(t),i=e.getResolution()/r;n=n.clone(),n.scale(i*i)}e.fitInternal(n,{duration:this.duration_,easing:GZ})}},mJ="ArrowLeft",yJ="ArrowRight",vJ="ArrowDown",bJ=class extends ZX{constructor(t){super(),t=t||{},this.defaultCondition_=function(t){return nJ(t)&&iJ(t)},this.condition_=void 0!==t.condition?t.condition:this.defaultCondition_,this.duration_=void 0!==t.duration?t.duration:100,this.pixelDelta_=void 0!==t.pixelDelta?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==KH){const n=t.originalEvent,r=n.key;if(this.condition_(t)&&(r==vJ||r==mJ||r==yJ||"ArrowUp"==r)){const i=t.map.getView(),s=i.getResolution()*this.pixelDelta_;let o=0,a=0;r==vJ?a=-s:r==mJ?o=-s:r==yJ?o=s:a=s;const l=[o,a];VZ(l,i.getRotation()),function(t,e,n){const r=t.getCenterInternal();if(r){const i=[r[0]+e[0],r[1]+e[1]];t.animateInternal({duration:void 0!==n?n:250,easing:KZ,center:t.getConstrainedCenter(i)})}}(i,l,this.duration_),n.preventDefault(),e=!0}}return!e}},wJ=class extends ZX{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(t){return!function(t){const e=t.originalEvent;return RG?e.metaKey:e.ctrlKey}(t)&&iJ(t)},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:100}handleEvent(t){let e=!1;if(t.type==KH||t.type==YH){const n=t.originalEvent,r=n.key;if(this.condition_(t)&&("+"===r||"-"===r)){const i=t.map,s="+"===r?this.delta_:-this.delta_;KX(i.getView(),s,void 0,this.duration_),n.preventDefault(),e=!0}}return!e}},_J=class extends ZX{constructor(t){super(t=t||{}),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=void 0!==t.maxDelta?t.maxDelta:1,this.duration_=void 0!==t.duration?t.duration:250,this.timeout_=void 0!==t.timeout?t.timeout:80,this.useAnchor_=void 0===t.useAnchor||t.useAnchor,this.constrainResolution_=void 0!==t.constrainResolution&&t.constrainResolution;const e=t.condition?t.condition:tJ;this.condition_=t.onFocusOnly?XX(QX,e):e,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(t){if(this.ctrlKeyListenerKeys_.forEach(WH),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(t),t){const e=t.getOwnerDocument();this.ctrlKeyListenerKeys_.push(qH(e,"keydown",t=>{"Control"===t.key&&(this.ctrlKeyPressed_=!0)}),qH(e,"keyup",t=>{"Control"===t.key&&(this.ctrlKeyPressed_=!1)}))}}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;const e=t.getView(),n=this.lastDelta_?this.lastDelta_>0?1:-1:0;e.endInteraction(this.constrainResolution_||e.getConstrainResolution()?100:void 0,n,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(t){if(!this.condition_(t))return!0;if(t.type!==JH)return!0;const e=t.map,n=t.originalEvent;n.preventDefault();const r=n.ctrlKey&&!this.ctrlKeyPressed_;n.ctrlKey||(this.ctrlKeyPressed_=!1),this.useAnchor_&&(this.lastAnchor_=t.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=e.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_?e.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,e),a),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let n=-GG(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),KX(e,n,this.lastAnchor_?t.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(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}},xJ=class extends aJ{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=aG),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==t.threshold?t.threshold:.3,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){let e=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 t=i-this.lastAngle_;this.rotationDelta_+=t,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=t}this.lastAngle_=i;const s=t.map,o=s.getView();o.getConstraints().rotation!==yX&&(this.anchor_=s.getCoordinateFromPixelInternal(s.getEventPixel(lJ(this.targetPointers))),this.rotating_&&(s.render(),o.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){return!(this.targetPointers.length<2&&(t.map.getView().endInteraction(this.duration_),1))}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}},CJ=class extends aJ{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=aG),super(e),this.anchor_=null,this.duration_=void 0!==t.duration?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=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_&&(e=this.lastDistance_/o),this.lastDistance_=o;const a=t.map,l=a.getView();1!=e&&(this.lastScaleDelta_=e),this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(lJ(this.targetPointers))),a.render(),l.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const e=t.map.getView(),n=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,n),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}};function SJ(t){t=t||{};const e=new _G,n=new HX(-.005,.05,100);return(void 0===t.altShiftDragRotate||t.altShiftDragRotate)&&e.push(new uJ),(void 0===t.doubleClickZoom||t.doubleClickZoom)&&e.push(new YX({delta:t.zoomDelta,duration:t.zoomDuration})),(void 0===t.dragPan||t.dragPan)&&e.push(new cJ({onFocusOnly:t.onFocusOnly,kinetic:n})),(void 0===t.pinchRotate||t.pinchRotate)&&e.push(new xJ),(void 0===t.pinchZoom||t.pinchZoom)&&e.push(new CJ({duration:t.zoomDuration})),(void 0===t.keyboard||t.keyboard)&&(e.push(new bJ),e.push(new wJ({delta:t.zoomDelta,duration:t.zoomDuration}))),(void 0===t.mouseWheelZoom||t.mouseWheelZoom)&&e.push(new _J({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration})),(void 0===t.shiftDragZoom||t.shiftDragZoom)&&e.push(new gJ({duration:t.zoomDuration})),e}var kJ="opacity",EJ="visible",RJ="extent",TJ="zIndex",LJ="maxResolution",IJ="minResolution",PJ="maxZoom",MJ="minZoom",AJ="source",OJ=class extends vG{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);"object"==typeof t.properties&&(delete e.properties,Object.assign(e,t.properties)),e[kJ]=void 0!==t.opacity?t.opacity:1,$G("number"==typeof e[kJ],"Layer opacity must be a number"),e[EJ]=void 0===t.visible||t.visible,e[TJ]=t.zIndex,e[LJ]=void 0!==t.maxResolution?t.maxResolution:1/0,e[IJ]=void 0!==t.minResolution?t.minResolution:0,e[MJ]=void 0!==t.minZoom?t.minZoom:-1/0,e[PJ]=void 0!==t.maxZoom?t.maxZoom:1/0,this.className_=void 0!==e.className?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:void 0===t||t},n=this.getZIndex();return e.opacity=GG(Math.round(100*this.getOpacity())/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==n||e.managed?n:1/0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return fG()}getLayerStatesArray(t){return fG()}getExtent(){return this.get(RJ)}getMaxResolution(){return this.get(LJ)}getMinResolution(){return this.get(IJ)}getMinZoom(){return this.get(MJ)}getMaxZoom(){return this.get(PJ)}getOpacity(){return this.get(kJ)}getSourceState(){return fG()}getVisible(){return this.get(EJ)}getZIndex(){return this.get(TJ)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(RJ,t)}setMaxResolution(t){this.set(LJ,t)}setMinResolution(t){this.set(IJ,t)}setMaxZoom(t){this.set(PJ,t)}setMinZoom(t){this.set(MJ,t)}setOpacity(t){$G("number"==typeof t,"Layer opacity must be a number"),this.set(kJ,t)}setVisible(t){this.set(EJ,t)}setZIndex(t){this.set(TJ,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},NJ="addlayer",FJ="removelayer",zJ=class extends hG{constructor(t,e){super(t),this.layer=e}},DJ="layers",jJ=class t extends OJ{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let n=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(DJ,this.handleLayersChanged_),n?Array.isArray(n)?n=new _G(n.slice(),{unique:!0}):$G("function"==typeof n.getArray,"Expected `layers` to be an array or a `Collection`"):n=new _G(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(WH),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(qH(t,DH,this.handleLayersAdd_,this),qH(t,jH,this.handleLayersRemove_,this));for(const n in this.listenerKeys_)this.listenerKeys_[n].forEach(WH);BH(this.listenerKeys_);const e=t.getArray();for(let n=0,r=e.length;n<r;n++){const t=e[n];this.registerLayerListeners_(t),this.dispatchEvent(new zJ(NJ,t))}this.changed()}registerLayerListeners_(e){const n=[qH(e,UH,this.handleLayerChange_,this),qH(e,HH,this.handleLayerChange_,this)];e instanceof t&&n.push(qH(e,NJ,this.handleLayerGroupAdd_,this),qH(e,FJ,this.handleLayerGroupRemove_,this)),this.listenerKeys_[mG(e)]=n}handleLayerGroupAdd_(t){this.dispatchEvent(new zJ(NJ,t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new zJ(FJ,t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new zJ(NJ,e)),this.changed()}handleLayersRemove_(t){const e=t.element,n=mG(e);this.listenerKeys_[n].forEach(WH),delete this.listenerKeys_[n],this.dispatchEvent(new zJ(FJ,e)),this.changed()}getLayers(){return this.get(DJ)}setLayers(t){const e=this.getLayers();if(e){const t=e.getArray();for(let e=0,n=t.length;e<n;++e)this.dispatchEvent(new zJ(FJ,t[e]))}this.set(DJ,t)}getLayersArray(t){return t=void 0!==t?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){const e=void 0!==t?t:[],n=e.length;this.getLayers().forEach(function(t){t.getLayerStatesArray(e)});const r=this.getLayerState();let i=r.zIndex;t||void 0!==r.zIndex||(i=0);for(let s=n,o=e.length;s<o;s++){const t=e[s];t.opacity*=r.opacity,t.visible=t.visible&&r.visible,t.maxResolution=Math.min(t.maxResolution,r.maxResolution),t.minResolution=Math.max(t.minResolution,r.minResolution),t.minZoom=Math.max(t.minZoom,r.minZoom),t.maxZoom=Math.min(t.maxZoom,r.maxZoom),void 0!==r.extent&&(void 0!==t.extent?t.extent=MZ(t.extent,r.extent):t.extent=r.extent),void 0===t.zIndex&&(t.zIndex=i)}return e}getSourceState(){return"ready"}},UJ="prerender",BJ="postrender",$J="precompose",qJ="rendercomplete",VJ=class extends OJ{constructor(t){const e=Object.assign({},t);delete e.source,super(e),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(AJ,this.handleSourcePropertyChange_);const n=t.source?t.source:null;this.setSource(n)}getLayersArray(t){return(t=t||[]).push(this),t}getLayerStatesArray(t){return(t=t||[]).push(this.getLayerState()),t}getSource(){return this.get(AJ)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),this.sourceReady_||"ready"!==this.getSource().getState()||(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(WH(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=qH(t,HH,this.handleSourceChange_,this),"ready"===t.getState()&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return this.renderer_&&this.rendered?this.renderer_.getData(t):null}isVisible(t){let e;const n=this.getMapInternal();let r;if(!t&&n&&(t=n.getView()),e=t instanceof bX?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&n&&(e.layerStatesArray=n.getLayerGroup().getLayerStatesArray()),e.layerStatesArray){if(r=e.layerStatesArray.find(t=>t.layer===this),!r)return!1}else r=this.getLayerState();const i=this.getExtent();return WJ(r,e.viewState)&&(!i||zZ(i,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];let n=e(t instanceof bX?t.getViewStateAndExtent():t);return Array.isArray(n)||(n=[n]),n}render(t,e){const n=this.getRenderer();return n.prepareFrame(t)?(this.rendered=!0,n.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set("map",t)}getMapInternal(){return this.get("map")}setMap(t){this.mapPrecomposeKey_&&(WH(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(WH(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=qH(t,$J,this.handlePrecompose_,this),this.mapRenderKey_=qH(this,HH,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,n=this.getLayerState(!1);$G(!e.some(t=>t.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(n)}setSource(t){this.set(AJ,t)}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 WJ(t,e){if(!t.visible)return!1;const n=e.resolution;if(n<t.minResolution||n>=t.maxResolution)return!1;const r=e.zoom;return r>t.minZoom&&r<=t.maxZoom}function HJ(t,e,n=0,r=t.length-1,i=ZJ){for(;r>n;){if(r-n>600){const s=r-n+1,o=e-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);HJ(t,e,Math.max(n,Math.floor(e-o*l/s+c)),Math.min(r,Math.floor(e+(s-o)*l/s+c)),i)}const s=t[e];let o=n,a=r;for(GJ(t,n,e),i(t[r],s)>0&&GJ(t,n,r);o<a;){for(GJ(t,o,a),o++,a--;i(t[o],s)<0;)o++;for(;i(t[a],s)>0;)a--}0===i(t[n],s)?GJ(t,n,a):(a++,GJ(t,a,r)),a<=e&&(n=a+1),e<=a&&(r=a-1)}}function GJ(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function ZJ(t,e){return t<e?-1:t>e?1:0}var KJ=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const n=[];if(!aQ(t,e))return n;const r=this.toBBox,i=[];for(;e;){for(let s=0;s<e.children.length;s++){const o=e.children[s],a=e.leaf?r(o):o;aQ(t,a)&&(e.leaf?n.push(o):oQ(t,a)?this._all(o,n):i.push(o))}e=i.pop()}return n}collides(t){let e=this.data;if(!aQ(t,e))return!1;const n=[];for(;e;){for(let r=0;r<e.children.length;r++){const i=e.children[r],s=e.leaf?this.toBBox(i):i;if(aQ(t,s)){if(e.leaf||oQ(t,s))return!0;n.push(i)}}e=n.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(let e=0;e<t.length;e++)this.insert(t[e]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const t=this.data;this.data=e,e=t}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=lQ([]),this}remove(t,e){if(!t)return this;let n=this.data;const r=this.toBBox(t),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=YJ(t,n.children,e);if(-1!==r)return n.children.splice(r,1),i.push(n),this._condense(i),this}l||n.leaf||!oQ(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(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const n=[];for(;t;)t.leaf?e.push(...t.children):n.push(...t.children),t=n.pop();return e}_build(t,e,n,r){const i=n-e+1;let s,o=this._maxEntries;if(i<=o)return s=lQ(t.slice(e,n+1)),XJ(s,this.toBBox),s;r||(r=Math.ceil(Math.log(i)/Math.log(o)),o=Math.ceil(i/Math.pow(o,r-1))),s=lQ([]),s.leaf=!1,s.height=r;const a=Math.ceil(i/o),l=a*Math.ceil(Math.sqrt(o));cQ(t,e,n,l,this.compareMinX);for(let c=e;c<=n;c+=l){const e=Math.min(c+l-1,n);cQ(t,c,e,a,this.compareMinY);for(let n=c;n<=e;n+=a){const i=Math.min(n+a-1,e);s.children.push(this._build(t,n,i,r-1))}}return XJ(s,this.toBBox),s}_chooseSubtree(t,e,n,r){for(;r.push(e),!e.leaf&&r.length-1!==n;){let n,r=1/0,i=1/0;for(let s=0;s<e.children.length;s++){const o=e.children[s],a=nQ(o),l=iQ(t,o)-a;l<i?(i=l,r=a<r?a:r,n=o):l===i&&a<r&&(r=a,n=o)}e=n||e.children[0]}return e}_insert(t,e,n){const r=n?t:this.toBBox(t),i=[],s=this._chooseSubtree(r,this.data,e,i);for(s.children.push(t),QJ(s,r);e>=0&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(r,i,e)}_split(t,e){const n=t[e],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);const s=this._chooseSplitIndex(n,i,r),o=lQ(n.children.splice(s,n.children.length-s));o.height=n.height,o.leaf=n.leaf,XJ(n,this.toBBox),XJ(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(n,o)}_splitRoot(t,e){this.data=lQ([t,e]),this.data.height=t.height+1,this.data.leaf=!1,XJ(this.data,this.toBBox)}_chooseSplitIndex(t,e,n){let r,i=1/0,s=1/0;for(let o=e;o<=n-e;o++){const e=JJ(t,0,o,this.toBBox),a=JJ(t,o,n,this.toBBox),l=sQ(e,a),c=nQ(e)+nQ(a);l<i?(i=l,r=o,s=c<s?c:s):l===i&&c<s&&(s=c,r=o)}return r||n-e}_chooseSplitAxis(t,e,n){const r=t.leaf?this.compareMinX:tQ,i=t.leaf?this.compareMinY:eQ;this._allDistMargin(t,e,n,r)<this._allDistMargin(t,e,n,i)&&t.children.sort(r)}_allDistMargin(t,e,n,r){t.children.sort(r);const i=this.toBBox,s=JJ(t,0,e,i),o=JJ(t,n-e,n,i);let a=rQ(s)+rQ(o);for(let l=e;l<n-e;l++){const e=t.children[l];QJ(s,t.leaf?i(e):e),a+=rQ(s)}for(let l=n-e-1;l>=e;l--){const e=t.children[l];QJ(o,t.leaf?i(e):e),a+=rQ(o)}return a}_adjustParentBBoxes(t,e,n){for(let r=n;r>=0;r--)QJ(e[r],t)}_condense(t){for(let e,n=t.length-1;n>=0;n--)0===t[n].children.length?n>0?(e=t[n-1].children,e.splice(e.indexOf(t[n]),1)):this.clear():XJ(t[n],this.toBBox)}};function YJ(t,e,n){if(!n)return e.indexOf(t);for(let r=0;r<e.length;r++)if(n(t,e[r]))return r;return-1}function XJ(t,e){JJ(t,0,t.children.length,e,t)}function JJ(t,e,n,r,i){i||(i=lQ(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let s=e;s<n;s++){const e=t.children[s];QJ(i,t.leaf?r(e):e)}return i}function QJ(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function tQ(t,e){return t.minX-e.minX}function eQ(t,e){return t.minY-e.minY}function nQ(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function rQ(t){return t.maxX-t.minX+(t.maxY-t.minY)}function iQ(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}function sQ(t,e){const n=Math.max(t.minX,e.minX),r=Math.max(t.minY,e.minY),i=Math.min(t.maxX,e.maxX),s=Math.min(t.maxY,e.maxY);return Math.max(0,i-n)*Math.max(0,s-r)}function oQ(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function aQ(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function lQ(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function cQ(t,e,n,r,i){const s=[e,n];for(;s.length;){if((n=s.pop())-(e=s.pop())<=r)continue;const o=e+Math.ceil((n-e)/r/2)*r;HJ(t,o,e,n,i),s.push(e,o,o,n)}}var uQ,hQ=[NaN,NaN,NaN,0],dQ=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,pQ=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,fQ=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,gQ=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function mQ(t,e){return t.endsWith("%")?Number(t.substring(0,t.length-1))/e:Number(t)}function yQ(t){throw new Error('failed to parse "'+t+'" as color')}function vQ(t){if(t.toLowerCase().startsWith("rgb")){const e=t.match(pQ)||t.match(dQ)||t.match(fQ);if(e){const t=e[4],n=100/255;return[GG(mQ(e[1],n)+.5|0,0,255),GG(mQ(e[2],n)+.5|0,0,255),GG(mQ(e[3],n)+.5|0,0,255),void 0!==t?GG(mQ(t,100),0,1):1]}yQ(t)}if(t.startsWith("#")){if(gQ.test(t)){const e=t.substring(1),n=e.length<=4?1:2,r=[0,0,0,255];for(let t=0,i=e.length;t<i;t+=n){let i=parseInt(e.substring(t,t+n),16);1===n&&(i+=i<<4),r[t/n]=i}return r[3]=r[3]/255,r}yQ(t)}const e=(uQ||(uQ=MX(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),uQ);e.fillStyle="#abcdef";let n=e.fillStyle;e.fillStyle=t,e.fillStyle===n&&(e.fillStyle="#fedcba",n=e.fillStyle,e.fillStyle=t,e.fillStyle===n&&yQ(t));const r=e.fillStyle;if(r.startsWith("#")||r.startsWith("rgba"))return vQ(r);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);const i=Array.from(e.getImageData(0,0,1,1).data);return i[3]=tZ(i[3]/255,3),i}var bQ={},wQ=0;function _Q(t){if(4===t.length)return t;const e=t.slice();return e[3]=1,e}function xQ(t){return t>.0031308?269.025*Math.pow(t,1/2.4)-14.025:3294.6*t}function CQ(t){return t>.2068965?Math.pow(t,3):108/841*(t-4/29)}function SQ(t){return t>10.314724?Math.pow((t+14.025)/269.025,2.4):t/3294.6}function kQ(t){return t>.0088564?Math.pow(t,1/3):t/(108/841)+4/29}function EQ(t){const e=SQ(t[0]),n=SQ(t[1]),r=SQ(t[2]),i=kQ(.222488403*e+.716873169*n+.06060791*r),s=500*(kQ(.452247074*e+.399439023*n+.148375274*r)-i),o=200*(i-kQ(.016863605*e+.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,t[3]]}function RQ(t){if("none"===t)return hQ;if(bQ.hasOwnProperty(t))return bQ[t];if(wQ>=1024){let t=0;for(const e in bQ)3&t++||(delete bQ[e],--wQ)}const e=vQ(t);4!==e.length&&yQ(t);for(const n of e)isNaN(n)&&yQ(t);return bQ[t]=e,++wQ,e}function TQ(t){return Array.isArray(t)?t:RQ(t)}function LQ(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let n=t[1];n!=(0|n)&&(n=n+.5|0);let r=t[2];return r!=(0|r)&&(r=r+.5|0),"rgba("+e+","+n+","+r+","+(void 0===t[3]?1:Math.round(1e3*t[3])/1e3)+")"}function IQ(t){return t[0]>0&&t[1]>0}function PQ(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}var MQ=0,AQ=1<<MQ++,OQ=1<<MQ++,NQ=1<<MQ++,FQ=1<<MQ++,zQ=1<<MQ++,DQ=1<<MQ++,jQ=Math.pow(2,6)-1,UQ={[AQ]:"boolean",[OQ]:"number",[NQ]:"string",[FQ]:"color",[zQ]:"number[]",[DQ]:"size"},BQ=Object.keys(UQ).map(Number).sort(tG);function $Q(t){const e=[];for(const n of BQ)qQ(t,n)&&e.push(UQ[n]);return 0===e.length?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function qQ(t,e){return(t&e)===e}function VQ(t,e){return!!(t&e)}function WQ(t,e){return t===e}var HQ=class{constructor(t,e){if(!function(t){return t in UQ}(t))throw new Error(`literal expressions must have a specific type, got ${$Q(t)}`);this.type=t,this.value=e}},GQ=class{constructor(t,e,...n){this.type=t,this.operator=e,this.args=n}};function ZQ(t){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:t}}function KQ(t,e,n){switch(typeof t){case"boolean":if(WQ(e,NQ))return new HQ(NQ,t?"true":"false");if(!qQ(e,AQ))throw new Error(`got a boolean, but expected ${$Q(e)}`);return new HQ(AQ,t);case"number":if(WQ(e,DQ))return new HQ(DQ,PQ(t));if(WQ(e,AQ))return new HQ(AQ,!!t);if(WQ(e,NQ))return new HQ(NQ,t.toString());if(!qQ(e,OQ))throw new Error(`got a number, but expected ${$Q(e)}`);return new HQ(OQ,t);case"string":if(WQ(e,FQ))return new HQ(FQ,RQ(t));if(WQ(e,AQ))return new HQ(AQ,!!t);if(!qQ(e,NQ))throw new Error(`got a string, but expected ${$Q(e)}`);return new HQ(NQ,t)}if(!Array.isArray(t))throw new Error("expression must be an array or a primitive value");if(0===t.length)throw new Error("empty expression");if("string"==typeof t[0])return function(t,e,n){const r=t[0],i=q0[r];if(!i)throw new Error(`unknown operator: ${r}`);return i(t,e,n)}(t,e,n);for(const r of t)if("number"!=typeof r)throw new Error("expected an array of numbers");if(WQ(e,DQ)){if(2!==t.length)throw new Error(`expected an array of two values for a size, got ${t.length}`);return new HQ(DQ,t)}if(WQ(e,FQ)){if(3===t.length)return new HQ(FQ,[...t,1]);if(4===t.length)return new HQ(FQ,t);throw new Error(`expected an array of 3 or 4 values for a color, got ${t.length}`)}if(!qQ(e,zQ))throw new Error(`got an array of numbers, but expected ${$Q(e)}`);return new HQ(zQ,t)}var YQ="get",XQ="var",JQ="concat",QQ="geometry-type",t0="line-metric",e0="any",n0="all",r0="!",i0="resolution",s0="zoom",o0="time",a0="==",l0="!=",c0=">",u0=">=",h0="<",d0="<=",p0="*",f0="/",g0="+",m0="-",y0="clamp",v0="%",b0="^",w0="abs",_0="floor",x0="ceil",C0="round",S0="sin",k0="cos",E0="atan",R0="sqrt",T0="match",L0="between",I0="interpolate",P0="coalesce",M0="case",A0="in",O0="number",N0="string",F0="array",z0="color",D0="id",j0="band",U0="palette",B0="to-string",$0="has",q0={[YQ]:J0(G0(1,1/0),V0),[XQ]:function(t,e,n){const r=t[1];if("string"!=typeof r)throw new Error("expected a string argument for var operation");let i=e;const s=n.inputVariables?.[r];if(void 0!==s){const t=KQ(s,jQ,n);if(!(t instanceof HQ))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${r}`);let o=t.type;if("string"==typeof s&&VQ(i,FQ)&&!VQ(i,NQ)?o=FQ:Array.isArray(s)&&2===s.length&&VQ(i,DQ)&&!VQ(i,zQ)&&(o=DQ),i&=o,0===i)throw new Error(`the type expected from the var operator (${$Q(e)}) did not have any overlap with the type of the corresponding style variables (${$Q(o)}), variable name: ${r}`)}if(n.variables.has(r)){const t=n.variables.get(r);if(i&=t,0===i)throw new Error(`a new type expected from the var operator (${$Q(e)}) did not have any overlap with the previous type expected for it (${$Q(t)}), variable name: ${r}`)}return n.variables.set(r,i),new GQ(i,"var",new HQ(NQ,r))},[$0]:J0(G0(1,1/0),V0),[D0]:J0(function(t,e,n){n.featureId=!0},H0),[JQ]:J0(G0(2,1/0),K0(NQ)),[QQ]:J0(function(t,e,n){n.geometryType=!0},H0),[t0]:J0(function(t,e,n){n.mCoordinate=!0},H0),[i0]:J0(W0,H0),[s0]:J0(W0,H0),[o0]:J0(W0,H0),[e0]:J0(G0(2,1/0),K0(AQ)),[n0]:J0(G0(2,1/0),K0(AQ)),[r0]:J0(G0(1,1),K0(AQ)),[a0]:J0(G0(2,2),Y0()),[l0]:J0(G0(2,2),Y0()),[c0]:J0(G0(2,2),K0(OQ)),[u0]:J0(G0(2,2),K0(OQ)),[h0]:J0(G0(2,2),K0(OQ)),[d0]:J0(G0(2,2),K0(OQ)),[p0]:J0(G0(2,1/0),Z0),[P0]:J0(G0(2,1/0),Z0),[f0]:J0(G0(2,2),K0(OQ)),[g0]:J0(G0(2,1/0),K0(OQ)),[m0]:J0(G0(2,2),K0(OQ)),[y0]:J0(G0(3,3),K0(OQ)),[v0]:J0(G0(2,2),K0(OQ)),[b0]:J0(G0(2,2),K0(OQ)),[w0]:J0(G0(1,1),K0(OQ)),[_0]:J0(G0(1,1),K0(OQ)),[x0]:J0(G0(1,1),K0(OQ)),[C0]:J0(G0(1,1),K0(OQ)),[S0]:J0(G0(1,1),K0(OQ)),[k0]:J0(G0(1,1),K0(OQ)),[E0]:J0(G0(1,2),K0(OQ)),[R0]:J0(G0(1,1),K0(OQ)),[T0]:J0(G0(4,1/0),X0,function(t,e,n){const r=t.length-1,i=KQ(t[t.length-1],e,n);let s=NQ|OQ|AQ;const o=new Array(r-2);for(let a=0;a<r-2;a+=2){try{s&=KQ(t[a+2],s,n).type}catch(nD){throw new Error(`failed to parse argument ${a+1} of match expression: ${nD.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 e=KQ(t[a+2],s,n);o[a]=e}catch(nD){throw new Error(`failed to parse argument ${a+1} of match expression: ${nD.message}`)}try{const e=KQ(t[a+3],i.type,n);o[a+1]=e}catch(nD){throw new Error(`failed to parse argument ${a+2} of match expression: ${nD.message}`)}}return[KQ(t[1],s,n),...o,i]}),[L0]:J0(G0(3,3),K0(OQ)),[I0]:J0(G0(6,1/0),X0,function(t,e,n){const r=t[1];let i;switch(r[0]){case"linear":i=1;break;case"exponential":const t=r[1];if("number"!=typeof t||t<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(t)} instead`);i=t;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(r)}`)}const s=new HQ(OQ,i);let o;try{o=KQ(t[2],OQ,n)}catch(nD){throw new Error(`failed to parse argument 1 in interpolate expression: ${nD.message}`)}const a=new Array(t.length-3);for(let l=0;l<a.length;l+=2){try{const e=KQ(t[l+3],OQ,n);a[l]=e}catch(nD){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${nD.message}`)}try{const r=KQ(t[l+4],e,n);a[l+1]=r}catch(nD){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${nD.message}`)}}return[s,o,...a]}),[M0]:J0(G0(3,1/0),function(t){const e=t[0],n=t.length-1;if(n%2==0)throw new Error(`expected an odd number of arguments for ${e}, got ${n} instead`)},function(t,e,n){const r=KQ(t[t.length-1],e,n),i=new Array(t.length-1);for(let s=0;s<i.length-1;s+=2){try{const e=KQ(t[s+1],AQ,n);i[s]=e}catch(nD){throw new Error(`failed to parse argument ${s} of case expression: ${nD.message}`)}try{const e=KQ(t[s+2],r.type,n);i[s+1]=e}catch(nD){throw new Error(`failed to parse argument ${s+1} of case expression: ${nD.message}`)}}return i[i.length-1]=r,i}),[A0]:J0(G0(2,2),function(t,e,n){let r,i=t[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]?NQ:OQ;const s=new Array(i.length);for(let o=0;o<s.length;o++)try{const t=KQ(i[o],r,n);s[o]=t}catch(nD){throw new Error(`failed to parse haystack item ${o} for "in" expression: ${nD.message}`)}return[KQ(t[1],r,n),...s]}),[O0]:J0(G0(1,1/0),K0(jQ)),[N0]:J0(G0(1,1/0),K0(jQ)),[F0]:J0(G0(1,1/0),K0(OQ)),[z0]:J0(G0(1,4),K0(OQ)),[j0]:J0(G0(1,3),K0(OQ)),[U0]:J0(G0(2,2),function(t,e,n){let r;try{r=KQ(t[1],OQ,n)}catch(nD){throw new Error(`failed to parse first argument in palette expression: ${nD.message}`)}const i=t[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 t;try{t=KQ(i[o],FQ,n)}catch(nD){throw new Error(`failed to parse color at index ${o} in palette expression: ${nD.message}`)}if(!(t instanceof HQ))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=t}return[r,...s]}),[B0]:J0(G0(1,1),K0(AQ|OQ|NQ|FQ))};function V0(t,e,n){const r=t.length-1,i=new Array(r);for(let s=0;s<r;++s){const r=t[s+1];switch(typeof r){case"number":i[s]=new HQ(OQ,r);break;case"string":i[s]=new HQ(NQ,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),e)}return i}function W0(t,e,n){n.mapState=!0}function H0(t){const e=t[0];if(1!==t.length)throw new Error(`expected no arguments for ${e} operation`);return[]}function G0(t,e){return function(n){const r=n[0],i=n.length-1;if(t===e){if(i!==t)throw new Error(`expected ${t} argument${1===t?"":"s"} for ${r}, got ${i}`)}else if(i<t||i>e)throw new Error(`expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${r}, got ${i}`)}}function Z0(t,e,n){const r=t.length-1,i=new Array(r);for(let s=0;s<r;++s){const r=KQ(t[s+1],e,n);i[s]=r}return i}function K0(t){return function(e,n,r){const i=e.length-1,s=new Array(i);for(let o=0;o<i;++o){const n=KQ(e[o+1],t,r);s[o]=n}return s}}function Y0(){return function(t,e,n){const r=t[0],i=t.length-1,s=new Array(i);let o=jQ;for(let a=0;a<i;++a)o&=KQ(t[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 e=KQ(t[a+1],o,n);s[a]=e}return s}}function X0(t){const e=t[0],n=t.length-1;if(n%2==1)throw new Error(`expected an even number of arguments for operation ${e}, got ${n} instead`)}function J0(...t){return function(e,n,r){const i=e[0];let s;for(let o=0;o<t.length;o++){const i=t[o](e,n,r);if(o==t.length-1){if(!i)throw new Error("expected last argument validator to return the parsed args");s=i}}return new GQ(n,i,...s)}}function Q0(t){if(!t)return"";const e=t.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return Q0(t.getGeometries()[0]);default:return""}}function t1(t,e,n){return e1(KQ(t,e,n),n)}function e1(t,e){if(t instanceof HQ){if(t.type===FQ&&"string"==typeof t.value){const e=RQ(t.value);return function(){return e}}return function(){return t.value}}const n=t.operator;switch(n){case O0:case N0:case P0:return function(t,e){const n=t.operator,r=t.args.length,i=new Array(r);for(let s=0;s<r;++s)i[s]=e1(t.args[s],e);switch(n){case P0:return t=>{for(let e=0;e<r;++e){const n=i[e](t);if(null!=n)return n}throw new Error("Expected one of the values to be non-null")};case O0:case N0:return t=>{for(let e=0;e<r;++e){const r=i[e](t);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}`)}}(t,e);case YQ:case XQ:case $0:return function(t){const e=t.args[0].value;switch(t.operator){case YQ:return n=>{const r=t.args;let i=n.properties[e];for(let t=1,e=r.length;t<e;++t)i=i[r[t].value];return i};case XQ:return t=>t.variables[e];case $0:return n=>{const r=t.args;if(!(e in n.properties))return!1;let i=n.properties[e];for(let t=1,e=r.length;t<e;++t){const e=r[t].value;if(!i||!Object.hasOwn(i,e))return!1;i=i[e]}return!0};default:throw new Error(`Unsupported accessor operator ${t.operator}`)}}(t);case"id":return t=>t.featureId;case QQ:return t=>t.geometryType;case JQ:{const n=t.args.map(t=>e1(t,e));return t=>"".concat(...n.map(e=>e(t).toString()))}case i0:return t=>t.resolution;case e0:case n0:case L0:case A0:case"!":return function(t,e){const n=t.operator,r=t.args.length,i=new Array(r);for(let s=0;s<r;++s)i[s]=e1(t.args[s],e);switch(n){case e0:return t=>{for(let e=0;e<r;++e)if(i[e](t))return!0;return!1};case n0:return t=>{for(let e=0;e<r;++e)if(!i[e](t))return!1;return!0};case L0:return t=>{const e=i[0](t),n=i[1](t),r=i[2](t);return e>=n&&e<=r};case A0:return t=>{const e=i[0](t);for(let n=1;n<r;++n)if(e===i[n](t))return!0;return!1};case"!":return t=>!i[0](t);default:throw new Error(`Unsupported logical operator ${n}`)}}(t,e);case a0:case l0:case"<":case d0:case">":case u0:return function(t,e){const n=t.operator,r=e1(t.args[0],e),i=e1(t.args[1],e);switch(n){case a0:return t=>r(t)===i(t);case l0:return t=>r(t)!==i(t);case"<":return t=>r(t)<i(t);case d0:return t=>r(t)<=i(t);case">":return t=>r(t)>i(t);case u0:return t=>r(t)>=i(t);default:throw new Error(`Unsupported comparison operator ${n}`)}}(t,e);case"*":case"/":case"+":case"-":case y0:case"%":case"^":case w0:case _0:case x0:case C0:case S0:case k0:case E0:case R0:return function(t,e){const n=t.operator,r=t.args.length,i=new Array(r);for(let s=0;s<r;++s)i[s]=e1(t.args[s],e);switch(n){case"*":return t=>{let e=1;for(let n=0;n<r;++n)e*=i[n](t);return e};case"/":return t=>i[0](t)/i[1](t);case"+":return t=>{let e=0;for(let n=0;n<r;++n)e+=i[n](t);return e};case"-":return t=>i[0](t)-i[1](t);case y0:return t=>{const e=i[0](t),n=i[1](t);if(e<n)return n;const r=i[2](t);return e>r?r:e};case"%":return t=>i[0](t)%i[1](t);case"^":return t=>Math.pow(i[0](t),i[1](t));case w0:return t=>Math.abs(i[0](t));case _0:return t=>Math.floor(i[0](t));case x0:return t=>Math.ceil(i[0](t));case C0:return t=>Math.round(i[0](t));case S0:return t=>Math.sin(i[0](t));case k0:return t=>Math.cos(i[0](t));case E0:return 2===r?t=>Math.atan2(i[0](t),i[1](t)):t=>Math.atan(i[0](t));case R0:return t=>Math.sqrt(i[0](t));default:throw new Error(`Unsupported numeric operator ${n}`)}}(t,e);case M0:return function(t,e){const n=t.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=e1(t.args[i],e);return t=>{for(let e=0;e<n-1;e+=2)if(r[e](t))return r[e+1](t);return r[n-1](t)}}(t,e);case T0:return function(t,e){const n=t.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=e1(t.args[i],e);return t=>{const e=r[0](t);for(let i=1;i<n-1;i+=2)if(e===r[i](t))return r[i+1](t);return r[n-1](t)}}(t,e);case I0:return function(t,e){const n=t.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=e1(t.args[i],e);return t=>{const e=r[0](t),i=r[1](t);let s,o;for(let a=2;a<n;a+=2){const n=r[a](t);let l=r[a+1](t);const c=Array.isArray(l);if(c&&(l=_Q(l)),n>=i)return 2===a?l:c?r1(e,i,s,o,n,l):n1(e,i,s,o,n,l);s=n,o=l}return o}}(t,e);case B0:return function(t,e){const n=t.operator,r=t.args.length,i=new Array(r);for(let s=0;s<r;++s)i[s]=e1(t.args[s],e);if(n===B0)return e=>{const n=i[0](e);return t.args[0].type===FQ?LQ(n):n.toString()};throw new Error(`Unsupported convert operator ${n}`)}(t,e);default:throw new Error(`Unsupported operator ${n}`)}}function n1(t,e,n,r,i,s){const o=i-n;if(0===o)return r;const a=e-n;return r+(1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1))*(s-r)}function r1(t,e,n,r,i,s){if(i-n===0)return r;const o=EQ(r),a=EQ(s);let l=a[2]-o[2];return l>180?l-=360:l<-180&&(l+=360),function(t){const e=(t[0]+16)/116,n=t[1],r=t[2]*Math.PI/180,i=CQ(e),s=CQ(e+n/500*Math.cos(r)),o=CQ(e-n/200*Math.sin(r)),a=xQ(3.021973625*s-1.617392459*i-.404875592*o),l=xQ(-.943766287*s+1.916279586*i+.027607165*o),c=xQ(.069407491*s-.22898585*i+1.159737864*o);return[GG(a+.5|0,0,255),GG(l+.5|0,0,255),GG(c+.5|0,0,255),t[3]]}([n1(t,e,n,o[0],i,a[0]),n1(t,e,n,o[1],i,a[1]),o[2]+n1(t,e,n,0,i,l),n1(t,e,n,r[3],i,s[3])])}var i1=class extends dG{constructor(t,e,n,r){super(),this.extent=t,this.pixelRatio_=n,this.resolution=e,this.state="function"==typeof r?0:r,this.image_=null,this.loader="function"==typeof r?r:null}changed(){this.dispatchEvent(HH)}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 t=this.getResolution(),e=Array.isArray(t)?t[0]:t;uG(()=>this.loader(this.getExtent(),e,this.getPixelRatio())).then(t=>{"image"in t&&(this.image_=t.image),"extent"in t&&(this.extent=t.extent),"resolution"in t&&(this.resolution=t.resolution),"pixelRatio"in t&&(this.pixelRatio_=t.pixelRatio),(t instanceof HTMLImageElement||PG&&t instanceof ImageBitmap||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement)&&(this.image_=t),this.state=2}).catch(t=>{this.state=3,console.error(t)}).finally(()=>this.changed())}}setImage(t){this.image_=t}setResolution(t){this.resolution=t}};function s1(t,e){return t+":"+(e?TQ(e):"null")}var o1=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 t=0;for(const e in this.cache_){const n=this.cache_[e];3&t++||n.hasListener()||(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e){const n=s1(t,e);return n in this.cache_?this.cache_[n]:null}getPattern(t,e){const n=s1(t,e);return n in this.patternCache_?this.patternCache_[n]:null}set(t,e,n,r){const i=s1(t,e),s=i in this.cache_;this.cache_[i]=n,r&&(0===n.getImageState()&&n.load(),1===n.getImageState()?n.ready().then(()=>{this.patternCache_[i]=AX().createPattern(n.getImage(1),"repeat")}):this.patternCache_[i]=AX().createPattern(n.getImage(1),"repeat")),s||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}},a1=null,l1=class extends dG{constructor(t,e,n,r,i){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.canvas_={},this.color_=i,this.imageState_=void 0===r?0:r,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,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_){a1||(a1=MX(1,1,void 0,{willReadFrequently:!0})),a1.drawImage(this.image_,0,0);try{a1.getImageData(0,0,1,1),this.tainted_=!1}catch{a1=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(HH)}handleImageError_(){this.imageState_=3,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=2,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}setImage(t){this.image_=t}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],n=MX(t,e);n.fillRect(0,0,t,e),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&&(t=this.image_,e=this.src_,e&&(t.src=e),t.src&&IG?new Promise((e,n)=>t.decode().then(()=>e(t)).catch(r=>t.complete&&t.width?e(t):n(r))):function(t){return new Promise((e,n)=>{function r(){s(),e(t)}function i(){s(),n(new Error("Image load error"))}function s(){t.removeEventListener("load",r),t.removeEventListener("error",i)}t.addEventListener("load",r),t.addEventListener("error",i)})}(t)).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}var t,e}replaceColor_(t){if(!this.color_||this.canvas_[t]||2!==this.imageState_)return;const e=this.image_,n=MX(Math.ceil(e.width*t),Math.ceil(e.height*t)),r=n.canvas;var i;n.scale(t,t),n.drawImage(e,0,0),n.globalCompositeOperation="multiply",n.fillStyle="string"==typeof(i=this.color_)?i:LQ(i),n.fillRect(0,0,r.width/t,r.height/t),n.globalCompositeOperation="destination-in",n.drawImage(e,0,0),this.canvas_[t]=r}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(2===this.imageState_||3===this.imageState_)t();else{const e=()=>{2!==this.imageState_&&3!==this.imageState_||(this.removeEventListener(HH,e),t())};this.addEventListener(HH,e)}})),this.ready_}};function c1(t,e,n,r,i,s){let o=void 0===e?void 0:o1.get(e,i);return o||(o=new l1(t,t&&"src"in t?t.src||void 0:e,n,r,i),o1.set(e,i,o,s)),s&&o&&!o1.getPattern(e,i)&&o1.set(e,i,o,s),o}function u1(t){return t?Array.isArray(t)?LQ(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return o1.getPattern(t.src,t.color);const e=t.src+":"+t.offset,n=o1.getPattern(e,t.color);if(n)return n;const r=o1.get(t.src,null);if(2!==r.getImageState())return null;const i=MX(t.size[0],t.size[1]);return i.drawImage(r.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),c1(i.canvas,e,void 0,2,t.color,!0),o1.getPattern(e,t.color)}(t):t:null}var h1,d1="#000",p1="round",f1=[],g1="round",m1="#000",y1="center",v1=[0,0,0,0],b1=new vG,w1=null,_1={},x1=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function C1(t,e,n){return`${t} ${e} 16px "${n}"`}var S1=function(){const t=100;let e,n;async function r(t){await n.ready;const e=PX(t),r=e.families[0].toLowerCase(),i=e.weight,s=[];return n.forEach(t=>{const n=t.family.replace(/^['"]|['"]$/g,"").toLowerCase(),o=IX[t.weight]||t.weight;n===r&&t.style===e.style&&o==i&&s.push(t)}),0!==s.length&&(await Promise.all(s.map(t=>t.load().then(()=>!0,()=>!1)))).some(t=>t)}async function i(){await n.ready;let s=!0;const o=b1.getProperties(),a=Object.keys(o).filter(e=>o[e]<t);for(let e=a.length-1;e>=0;--e){const n=a[e];let i=o[n];i<t&&(await r(n)?(BH(_1),b1.set(n,t)):(i+=10,b1.set(n,i,!0),i<t&&(s=!1)))}e=void 0,s||(e=setTimeout(i,100))}return async function(t){n||(n=LG?self.fonts:document.fonts);const r=PX(t);if(!r)return;const s=r.families;let o=!1;for(const e of s){if(x1.has(e))continue;const t=C1(r.style,r.weight,e);void 0===b1.get(t)&&(b1.set(t,0,!0),o=!0)}o&&(clearTimeout(e),e=setTimeout(i,100))}}(),k1=function(){let t;return function(e){let n=_1[e];if(null==n){if(LG){const t=PX(e),r=E1(e,"Žg");n=(isNaN(Number(t.lineHeight))?1.2:Number(t.lineHeight))*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)}else t||(t=document.createElement("div"),t.innerHTML="M",t.style.minHeight="0",t.style.maxHeight="none",t.style.height="auto",t.style.padding="0",t.style.border="none",t.style.position="absolute",t.style.display="block",t.style.left="-99999px"),t.style.font=e,document.body.appendChild(t),n=t.offsetHeight,document.body.removeChild(t);_1[e]=n}return n}}();function E1(t,e){return w1||(w1=MX(1,1)),t!=h1&&(w1.font=t,h1=w1.font),w1.measureText(e)}function R1(t,e){return E1(t,e).width}function T1(t,e,n){if(e in n)return n[e];const r=e.split("\n").reduce((e,n)=>Math.max(e,R1(t,n)),0);return n[e]=r,r}var L1=class t{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=PQ(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const e=this.getScale();return new t({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,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 fG()}getImage(t){return fG()}getHitDetectionImage(){return fG()}getPixelRatio(t){return 1}getImageState(){return fG()}getImageSize(){return fG()}getOrigin(){return fG()}getSize(){return fG()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=PQ(t)}listenImageChange(t){fG()}load(){fG()}unlistenImageChange(t){fG()}ready(){return Promise.resolve()}},I1=class t extends L1{constructor(t){super({opacity:1,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,rotation:void 0!==t.rotation?t.rotation:0,scale:void 0!==t.scale?t.scale:1,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=void 0!==t.fill?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius=t.radius,this.radius2_=t.radius2,this.angle_=void 0!==t.angle?t.angle:0,this.stroke_=void 0!==t.stroke?t.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 e=this.getScale(),n=new t({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(e)?e.slice():e,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return n.setOpacity(this.getOpacity()),n}getAnchor(){const t=this.size_,e=this.getDisplacement(),n=this.getScaleArray();return[t[0]/2-e[0]/n[0],t[1]/2+e[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){const e=this.fill_?.getKey(),n=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let r=o1.get(n,null)?.getImage(1);if(!r){const e=this.renderOptions_,i=Math.ceil(e.size*t),s=MX(i,i);this.draw_(e,s,t),r=s.canvas;const o=new l1(r,void 0,null,2,null);o1.set(n,null,o),createImageBitmap(r).then(t=>{o.setImage(t)})}return r}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(t){this.radius!==t&&(this.radius=t,this.render())}getRadius2(){return this.radius2_}setRadius2(t){this.radius2_!==t&&(this.radius2_=t,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,n){if(0===e||this.points_===1/0||"bevel"!==t&&"miter"!==t)return e;let r=this.radius,i=void 0===this.radius2_?r:this.radius2_;if(r<i){const t=r;r=i,i=t}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"===t&&u<=n)return u*e;const h=e/2/u,d=e/2*(l/c),p=Math.sqrt((r+h)*(r+h)+d*d)-r;if(void 0===this.radius2_||"bevel"===t)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 t=m*e/2-i-r;return 2*Math.max(p,t)}return 2*p}createRenderOptions(){let t,e=p1,n=g1,r=0,i=null,s=0,o=0;this.stroke_&&(t=u1(this.stroke_.getColor()??"#000"),o=this.stroke_.getWidth()??1,i=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,n=this.stroke_.getLineJoin()??"round",e=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:t,strokeWidth:o,size:Math.ceil(2*l+a),lineCap:e,lineDash:i,lineDashOffset:s,lineJoin:n,miterLimit:r}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,n){if(e.scale(n,n),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let t=this.fill_.getColor();null===t&&(t=d1),e.fillStyle=u1(t),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let n=this.fill_.getColor(),r=0;"string"==typeof n&&(n=TQ(n)),null===n?r=1:Array.isArray(n)&&(r=4===n.length?n[3]:1),0===r&&(e=MX(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const n=this.radius;if(e===1/0)t.arc(0,0,n,0,2*Math.PI);else{const r=void 0===this.radius2_?n:this.radius2_;void 0!==this.radius2_&&(e*=2);const i=this.angle_-Math.PI/2,s=2*Math.PI/e;for(let o=0;o<e;o++){const e=i+o*s,a=o%2==0?n:r;t.lineTo(a*Math.cos(e),a*Math.sin(e))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=d1,e.fill(),t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}},P1=class t extends I1{constructor(t){super({points:1/0,fill:(t=t||{radius:5}).fill,radius:t.radius,stroke:t.stroke,scale:void 0!==t.scale?t.scale:1,rotation:void 0!==t.rotation?t.rotation:0,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode})}clone(){const e=this.getScale(),n=new t({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return n.setOpacity(this.getOpacity()),n}},M1=class t{constructor(t){t=t||{},this.patternImage_=null,this.color_=null,void 0!==t.color&&this.setColor(t.color)}clone(){const e=this.getColor();return new t({color:Array.isArray(e)?e.slice():e||void 0})}getColor(){return this.color_}setColor(t){if(null!==t&&"object"==typeof t&&"src"in t){const e=c1(null,t.src,{crossOrigin:"anonymous"},void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then(()=>{this.patternImage_=null}),0===e.getImageState()&&e.load(),1===e.getImageState()&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?mG(t):"object"==typeof t&&"src"in t?t.src+":"+t.offset:TQ(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}};function A1(t,e,n,r){return void 0!==n&&void 0!==r?[n/t,r/e]:void 0!==n?n/t:void 0!==r?r/e:1}var O1=class t extends L1{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,n=void 0!==t.rotation?t.rotation:0,r=void 0!==t.scale?t.scale:1,i=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:n,scale:r,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:i,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.referrerPolicy_=t.referrerPolicy;const s=void 0!==t.img?t.img:null;let o,a=t.src;if($G(!(void 0!==a&&s),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!s||(a=s.src||mG(s)),$G(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),$G(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),"`width` or `height` cannot be provided together with `scale`"),void 0!==t.src?o=0:void 0!==s&&(o="complete"in s?s.complete?s.src?2:0:1:2),this.color_=void 0!==t.color?TQ(t.color):null,this.iconImage_=c1(s,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},o,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,this.initialOptions_,void 0!==t.width||void 0!==t.height){let e,n;if(t.size)[e,n]=t.size;else{const r=this.getImage(1);if(r.width&&r.height)e=r.width,n=r.height;else if(r instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const n=this.iconImage_.getSize();this.setScale(A1(n[0],n[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(A1(e,n,t.width,t.height))}}clone(){let e,n,r;return this.initialOptions_?(n=this.initialOptions_.width,r=this.initialOptions_.height):(e=this.getScale(),e=Array.isArray(e)?e.slice():e),new t({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:e,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 t=this.normalizedAnchor_;if(!t){t=this.anchor_;const e=this.getSize();if("fraction"==this.anchorXUnits_||"fraction"==this.anchorYUnits_){if(!e)return null;t=this.anchor_.slice(),"fraction"==this.anchorXUnits_&&(t[0]*=e[0]),"fraction"==this.anchorYUnits_&&(t[1]*=e[1])}if("top-left"!=this.anchorOrigin_){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),"top-right"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[0]=-t[0]+e[0]),"bottom-left"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[1]=-t[1]+e[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),n=this.getScaleArray();return[t[0]-e[0]/n[0],t[1]+e[1]/n[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(t){const e=t?TQ(t):null;if(this.color_===e||this.color_&&e&&this.color_.length===e.length&&this.color_.every((t,n)=>t===e[n]))return;this.color_=e;const n=this.getSrc(),r=void 0!==n?null:this.getHitDetectionImage(),i=void 0!==n?0:this.iconImage_.getImageState();this.iconImage_=c1(r,n,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},i,this.color_)}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if("top-left"!=this.offsetOrigin_){const e=this.getSize(),n=this.iconImage_.getSize();if(!e||!n)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=n[0]-e[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=n[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(t){this.iconImage_=c1(null,t,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},0,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();return this.size_?this.size_[0]*t[0]:2==this.iconImage_.getImageState()?this.iconImage_.getSize()[0]*t[0]:void 0}getHeight(){const t=this.getScaleArray();return this.size_?this.size_[1]*t[1]:2==this.iconImage_.getImageState()?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(HH,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(HH,t)}ready(){return this.iconImage_.ready()}},N1=class t{constructor(t){t=t||{},this.color_=void 0!==t.color?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=void 0!==t.lineDash?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.offset_=t.offset,this.width_=t.width}clone(){const e=this.getColor();return new t({color:Array.isArray(e)?e.slice():e||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(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setOffset(t){this.offset_=t}setWidth(t){this.width_=t}},F1=class t{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=j1,void 0!==t.geometry&&this.setGeometry(t.geometry),this.fill_=void 0!==t.fill?t.fill:null,this.image_=void 0!==t.image?t.image:null,this.renderer_=void 0!==t.renderer?t.renderer:null,this.hitDetectionRenderer_=void 0!==t.hitDetectionRenderer?t.hitDetectionRenderer:null,this.stroke_=void 0!==t.stroke?t.stroke:null,this.text_=void 0!==t.text?t.text:null,this.zIndex_=t.zIndex}clone(){let e=this.getGeometry();return e&&"object"==typeof e&&(e=e.clone()),new t({geometry:e??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=j1,this.geometry_=t}setZIndex(t){this.zIndex_=t}},z1=null;function D1(){if(!z1){const t=new M1({color:"rgba(255,255,255,0.4)"}),e=new N1({color:"#3399CC",width:1.25});z1=[new F1({image:new P1({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return z1}function j1(t){return t.getGeometry()}var U1=class t{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.keepUpright_=t.keepUpright,this.scale_=t.scale,this.scaleArray_=PQ(void 0!==t.scale?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=void 0!==t.fill?t.fill:new M1({color:"#333"}),this.maxAngle_=void 0!==t.maxAngle?t.maxAngle:Math.PI/4,this.placement_=void 0!==t.placement?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=void 0!==t.stroke?t.stroke:null,this.offsetX_=void 0!==t.offsetX?t.offsetX:0,this.offsetY_=void 0!==t.offsetY?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=void 0===t.padding?null:t.padding,this.declutterMode_=t.declutterMode}clone(){const e=this.getScale();return new t({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(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof M1?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(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=PQ(void 0!==t?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}};function B1(){return!0}function $1(t,e){e=e??ZQ();const n=t.length,r=new Array(n);for(let o=0;o<n;++o)r[o]=q1(t[o],e);const i={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""},s=new Array(n);return function(t,o){if(i.properties=t.getPropertiesInternal(),i.resolution=o,e.featureId){const e=t.getId();i.featureId=void 0!==e?e:null}e.geometryType&&(i.geometryType=Q0(t.getGeometry()));let a=0;for(let e=0;e<n;++e){const t=r[e](i);t&&(s[a]=t,a+=1)}return s.length=a,s}}function q1(t,e){const n=V1(t,"",e),r=W1(t,"",e),i=function(t,e){const n="text-",r=Z1(t,"text-value",e);if(!r)return null;const i=V1(t,n,e),s=V1(t,"text-background-",e),o=W1(t,n,e),a=W1(t,"text-background-",e),l=Z1(t,"text-font",e),c=G1(t,"text-max-angle",e),u=G1(t,"text-offset-x",e),h=G1(t,"text-offset-y",e),d=K1(t,"text-overflow",e),p=Z1(t,"text-placement",e),f=G1(t,"text-repeat",e),g=t2(t,"text-scale",e),m=K1(t,"text-rotate-with-view",e),y=G1(t,"text-rotation",e),v=Z1(t,"text-align",e),b=Z1(t,"text-justify",e),w=Z1(t,"text-baseline",e),_=K1(t,"text-keep-upright",e),x=X1(t,"text-padding",e),C=s2(t,"text-declutter-mode"),S=new U1({declutterMode:C});return function(t){if(S.setText(r(t)),i&&S.setFill(i(t)),s&&S.setBackgroundFill(s(t)),o&&S.setStroke(o(t)),a&&S.setBackgroundStroke(a(t)),l&&S.setFont(l(t)),c&&S.setMaxAngle(c(t)),u&&S.setOffsetX(u(t)),h&&S.setOffsetY(h(t)),d&&S.setOverflow(d(t)),p){const e=p(t);if("point"!==e&&"line"!==e)throw new Error("Expected point or line for text-placement");S.setPlacement(e)}if(f&&S.setRepeat(f(t)),g&&S.setScale(g(t)),m&&S.setRotateWithView(m(t)),y&&S.setRotation(y(t)),v){const e=v(t);if("left"!==e&&"center"!==e&&"right"!==e&&"end"!==e&&"start"!==e)throw new Error("Expected left, right, center, start, or end for text-align");S.setTextAlign(e)}if(b){const e=b(t);if("left"!==e&&"right"!==e&&"center"!==e)throw new Error("Expected left, right, or center for text-justify");S.setJustify(e)}if(w){const e=w(t);if("bottom"!==e&&"top"!==e&&"middle"!==e&&"alphabetic"!==e&&"hanging"!==e)throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");S.setTextBaseline(e)}return x&&S.setPadding(x(t)),_&&S.setKeepUpright(_(t)),S}}(t,e),s=function(t,e){return"icon-src"in t?function(t,e){const n="icon-src",r=a2(t[n],n),i=J1(t,"icon-anchor",e),s=t2(t,"icon-scale",e),o=G1(t,"icon-opacity",e),a=J1(t,"icon-displacement",e),l=G1(t,"icon-rotation",e),c=K1(t,"icon-rotate-with-view",e),u=r2(t,"icon-anchor-origin"),h=i2(t,"icon-anchor-x-units"),d=i2(t,"icon-anchor-y-units"),p=H1(t,"icon-color");let f,g=null;void 0!==p&&(Array.isArray(p)&&p.length>0&&"string"==typeof p[0]?g=Y1(t,"icon-color",e):f=c2(p,"icon-color"));const m=function(t,e){const n=t[e];if(void 0!==n){if("string"!=typeof n)throw new Error(`Expected a string for ${e}`);return n}}(t,"icon-cross-origin"),y=function(t,e){const n=t[e];if(void 0!==n)return o2(n,e)}(t,"icon-offset"),v=r2(t,"icon-offset-origin"),b=e2(t,"icon-width"),w={src:r,anchorOrigin:u,anchorXUnits:h,anchorYUnits:d,crossOrigin:m,offset:y,offsetOrigin:v,height:e2(t,"icon-height"),width:b,size:n2(t,"icon-size"),declutterMode:s2(t,"icon-declutter-mode")};let _=null;return function(t){if(_)g&&_.setColor(g(t));else{const e=g?g(t):f;_=new O1(void 0!==e?Object.assign({},w,{color:e}):Object.assign({},w))}return o&&_.setOpacity(o(t)),a&&_.setDisplacement(a(t)),l&&_.setRotation(l(t)),c&&_.setRotateWithView(c(t)),s&&_.setScale(s(t)),i&&_.setAnchor(i(t)),_}}(t,e):"shape-points"in t?function(t,e){const n="shape-",r="shape-points",i="shape-radius",s=l2(t[r],r);if(!(i in t))throw new Error(`Expected a number for ${i}`);const o=G1(t,i,e),a="number"==typeof t[i]?t[i]:5,l="shape-radius2",c=G1(t,l,e),u="number"==typeof t[l]?t[l]:void 0,h=V1(t,n,e),d=W1(t,n,e),p=t2(t,"shape-scale",e),f=J1(t,"shape-displacement",e),g=G1(t,"shape-rotation",e),m=K1(t,"shape-rotate-with-view",e),y=e2(t,"shape-angle"),v=s2(t,"shape-declutter-mode"),b=new I1({points:s,radius:a,radius2:u,angle:y,declutterMode:v});return function(t){return o&&b.setRadius(o(t)),c&&b.setRadius2(c(t)),h&&b.setFill(h(t)),d&&b.setStroke(d(t)),f&&b.setDisplacement(f(t)),g&&b.setRotation(g(t)),m&&b.setRotateWithView(m(t)),p&&b.setScale(p(t)),b}}(t,e):"circle-radius"in t?function(t,e){const n="circle-",r=V1(t,n,e),i=W1(t,n,e),s=G1(t,"circle-radius",e),o=t2(t,"circle-scale",e),a=J1(t,"circle-displacement",e),l=G1(t,"circle-rotation",e),c=K1(t,"circle-rotate-with-view",e),u=s2(t,"circle-declutter-mode"),h=new P1({radius:5,declutterMode:u});return function(t){return s&&h.setRadius(s(t)),r&&h.setFill(r(t)),i&&h.setStroke(i(t)),a&&h.setDisplacement(a(t)),l&&h.setRotation(l(t)),c&&h.setRotateWithView(c(t)),o&&h.setScale(o(t)),h}}(t,e):null}(t,e),o=G1(t,"z-index",e);if(!(n||r||i||s||$H(t)))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(t));const a=new F1;return function(t){let e=!0;if(n){const r=n(t);r&&(e=!1),a.setFill(r)}if(r){const n=r(t);n&&(e=!1),a.setStroke(n)}if(i){const n=i(t);n&&(e=!1),a.setText(n)}if(s){const n=s(t);n&&(e=!1),a.setImage(n)}return o&&a.setZIndex(o(t)),e?null:a}}function V1(t,e,n){let r;if(e+"fill-pattern-src"in t)r=function(t,e,n){const r=Z1(t,e+"pattern-src",n),i=Q1(t,e+"pattern-offset",n),s=Q1(t,e+"pattern-size",n),o=Y1(t,e+"color",n);return function(t){return{src:r(t),offset:i&&i(t),size:s&&s(t),color:o&&o(t)}}}(t,e+"fill-",n);else{if("none"===t[e+"fill-color"])return()=>null;r=Y1(t,e+"fill-color",n)}if(!r)return null;const i=new M1;return function(t){const e=r(t);return e===hQ?null:(i.setColor(e),i)}}function W1(t,e,n){const r=G1(t,e+"stroke-width",n),i=Y1(t,e+"stroke-color",n);if(!r&&!i)return null;const s=Z1(t,e+"stroke-line-cap",n),o=Z1(t,e+"stroke-line-join",n),a=X1(t,e+"stroke-line-dash",n),l=G1(t,e+"stroke-line-dash-offset",n),c=G1(t,e+"stroke-miter-limit",n),u=G1(t,e+"stroke-offset",n),h=new N1;return function(t){if(i){const e=i(t);if(e===hQ)return null;h.setColor(e)}if(r&&h.setWidth(r(t)),s){const e=s(t);if("butt"!==e&&"round"!==e&&"square"!==e)throw new Error("Expected butt, round, or square line cap");h.setLineCap(e)}if(o){const e=o(t);if("bevel"!==e&&"round"!==e&&"miter"!==e)throw new Error("Expected bevel, round, or miter line join");h.setLineJoin(e)}return a&&h.setLineDash(a(t)),l&&h.setLineDashOffset(l(t)),c&&h.setMiterLimit(c(t)),u&&h.setOffset(u(t)),h}}function H1(t,e){if(!(e in t))return;const n=t[e];return void 0===n?void 0:n}function G1(t,e,n){const r=H1(t,e);if(void 0===r)return;const i=t1(r,OQ,n);return function(t){return l2(i(t),e)}}function Z1(t,e,n){const r=H1(t,e);if(void 0===r)return null;const i=t1(r,NQ,n);return function(t){return a2(i(t),e)}}function K1(t,e,n){const r=H1(t,e);if(void 0===r)return null;const i=t1(r,AQ,n);return function(t){const n=i(t);if("boolean"!=typeof n)throw new Error(`Expected a boolean for ${e}`);return n}}function Y1(t,e,n){const r=H1(t,e);if(void 0===r)return null;const i=t1(r,FQ,n);return function(t){return c2(i(t),e)}}function X1(t,e,n){const r=H1(t,e);if(void 0===r)return null;if(Array.isArray(r)&&(0===r.length||"string"!=typeof r[0])){const t=r.map((t,r)=>{if("number"==typeof t)return()=>t;const i=t1(t,OQ,n);return function(t){return l2(i(t),`${e}[${r}]`)}});return function(e){const n=new Array(t.length);for(let r=0;r<t.length;++r)n[r]=t[r](e);return n}}const i=t1(r,zQ,n);return function(t){return o2(i(t),e)}}function J1(t,e,n){const r=H1(t,e);if(void 0===r)return null;const i=t1(r,zQ,n);return function(t){const n=o2(i(t),e);if(2!==n.length)throw new Error(`Expected two numbers for ${e}`);return n}}function Q1(t,e,n){const r=H1(t,e);if(void 0===r)return null;const i=t1(r,zQ,n);return function(t){return u2(i(t),e)}}function t2(t,e,n){const r=H1(t,e);if(void 0===r)return null;const i=t1(r,zQ|OQ,n);return function(t){return"number"==typeof(n=i(t))?n:u2(n,e);var n}}function e2(t,e){const n=t[e];if(void 0!==n){if("number"!=typeof n)throw new Error(`Expected a number for ${e}`);return n}}function n2(t,e){const n=t[e];if(void 0!==n){if("number"==typeof n)return PQ(n);if(!Array.isArray(n))throw new Error(`Expected a number or size array for ${e}`);if(2!==n.length||"number"!=typeof n[0]||"number"!=typeof n[1])throw new Error(`Expected a number or size array for ${e}`);return n}}function r2(t,e){const n=t[e];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 ${e}`);return n}}function i2(t,e){const n=t[e];if(void 0!==n){if("pixels"!==n&&"fraction"!==n)throw new Error(`Expected pixels or fraction for ${e}`);return n}}function s2(t,e){const n=t[e];if(void 0!==n){if("string"!=typeof n)throw new Error(`Expected a string for ${e}`);if("declutter"!==n&&"obstacle"!==n&&"none"!==n)throw new Error(`Expected declutter, obstacle, or none for ${e}`);return n}}function o2(t,e){if(!Array.isArray(t))throw new Error(`Expected an array for ${e}`);const n=t.length;for(let r=0;r<n;++r)if("number"!=typeof t[r])throw new Error(`Expected an array of numbers for ${e}`);return t}function a2(t,e){if("string"!=typeof t)throw new Error(`Expected a string for ${e}`);return t}function l2(t,e){if("number"!=typeof t)throw new Error(`Expected a number for ${e}`);return t}function c2(t,e){if("string"==typeof t)return t;const n=o2(t,e),r=n.length;if(r<3||r>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return n}function u2(t,e){const n=o2(t,e);if(2!==n.length)throw new Error(`Expected an array of two numbers for ${e}`);return n}var h2="renderOrder",d2=class extends VJ{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter?String(t.declutter):void 0,this.renderBuffer_=void 0!==t.renderBuffer?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=void 0!==t.updateWhileAnimating&&t.updateWhileAnimating,this.updateWhileInteracting_=void 0!==t.updateWhileInteracting&&t.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(h2)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const n=this.getDeclutter();n in t.declutter==0&&(t.declutter[n]=new KJ(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(h2,t)}setStyle(t){this.style_=void 0===t?D1:t;const e=function(t){if(void 0===t)return D1;if(!t)return null;if("function"==typeof t)return t;if(t instanceof F1)return t;if(Array.isArray(t)&&0===t.length)return[];if(Array.isArray(t)&&t[0]instanceof F1){const e=t.length,n=new Array(e);for(let r=0;r<e;++r){const e=t[r];if(!(e instanceof F1))throw new Error("Expected a list of style instances");n[r]=e}return n}return function(t,e){if(e=e??ZQ(),!Array.isArray(t))return $1([t],e);const n=t.length;if("style"in t[0]){const r=new Array(n);for(let e=0;e<n;++e){const n=t[e];if(!("style"in n))throw new Error("Expected a list of rules with a style property");r[e]=n}return function(t,e){const n=function(t,e){const n=t.length,r=new Array(n);for(let i=0;i<n;++i){const n=t[i],s="filter"in n?t1(n.filter,AQ,e):B1;let o;if(Array.isArray(n.style)){const t=n.style.length;o=new Array(t);for(let r=0;r<t;++r)o[r]=q1(n.style[r],e)}else o=[q1(n.style,e)];r[i]={filter:s,styles:o}}return function(e){const i=[];let s=!1;for(let o=0;o<n;++o)if((0,r[o].filter)(e)&&(!t[o].else||!s)){s=!0;for(const t of r[o].styles){const n=t(e);n&&i.push(n)}}return i}}(t,e=e??ZQ()),r={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""};return function(t,i){if(r.properties=t.getPropertiesInternal(),r.resolution=i,e.featureId){const e=t.getId();r.featureId=void 0!==e?e:null}return e.geometryType&&(r.geometryType=Q0(t.getGeometry())),n(r)}}(r,e)}return $1(t,e)}(t)}(t);this.styleFunction_=null===t?void 0:function(t){let e;if("function"==typeof t)e=t;else{let n;Array.isArray(t)?n=t:($G("function"==typeof t.getZIndex,"Expected an `Style` or an array of `Style`"),n=[t]),e=function(){return n}}return e}(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}},p2=class extends hG{constructor(t,e,n,r){super(t),this.inversePixelTransform=e,this.frameState=n,this.context=r}},f2=class extends QH{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){fG()}calculateMatrices2D(t){const e=t.viewState,n=t.coordinateToPixelTransform,r=t.pixelToCoordinateTransform;vY(n,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),bY(r,n)}forEachFeatureAtCoordinate(t,e,n,r,i,s,o,a){let l;const c=e.viewState;function u(t,e,n,r){return i.call(s,e,t?n:null,r)}const h=c.projection,d=WZ(t.slice(),h),p=[[0,0]];if(h.canWrapX()&&r){const t=FZ(h.getExtent());p.push([-t,0],[t,0])}const f=e.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()&&WJ(i,c)&&o.call(a,s)){const r=s.getRenderer(),o=s.getSource();if(r&&o){const s=o.getWrapX()?d:t,a=u.bind(null,i.managed);y[0]=s[0]+p[b][0],y[1]=s[1]+p[b][1],l=r.forEachFeatureAtCoordinate(y,e,n,a,m)}if(l)return l}}if(0===m.length)return;const v=1/m.length;return m.forEach((t,e)=>t.distanceSq+=e*v),m.sort((t,e)=>t.distanceSq-e.distanceSq),m.some(t=>l=t.callback(t.feature,t.layer,t.geometry)),l}hasFeatureAtCoordinate(t,e,n,r,i,s){return void 0!==this.forEachFeatureAtCoordinate(t,e,n,r,oG,this,i,s)}getMap(){return this.map_}renderFrame(t){fG()}scheduleExpireIconCache(t){o1.canExpireCache()&&t.postRenderFunctions.push(g2)}};function g2(){o1.expire()}var m2=class extends f2{constructor(t){super(t),this.fontChangeListenerKey_=qH(b1,UH,t.redrawText,t),this.element_=LG?jX():document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=kX+" ol-layers";const n=t.getViewport();n&&n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const n=this.getMap();if(n.hasListener(t)){const r=new p2(t,void 0,e);n.dispatchEvent(r)}}disposeInternal(){WH(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(t){if(!t)return void(this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1));this.calculateMatrices2D(t),this.dispatchRenderEvent($J,t);const e=t.layerStatesArray.sort((t,e)=>t.zIndex-e.zIndex);e.some(t=>t.layer instanceof d2&&t.layer.getDeclutter())&&(t.declutter={});const n=t.viewState;this.children_.length=0;const r=this.getMap().getTargetElement();let i;UX(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=e.length;a<l;++a){const r=e[a];t.layerIndex=a;const i=r.layer,l=i.getSourceState();if(!WJ(r,n)||"ready"!=l&&"undefined"!=l){i.unrender();continue}const c=i.render(t,o);c&&(c!==o&&(this.children_.push(c),o=c),s.push(r))}this.declutter(t,s),function(t,e){const n=t.childNodes;for(let r=0;;++r){const i=n[r],s=e[r];if(!i&&!s)break;i!==s&&(i?s?t.insertBefore(s,i):(t.removeChild(i),--r):t.appendChild(s))}}(this.element_,this.children_);for(const a of i?this.children_:[]){const t=a.firstElementChild||a,e=a.style.backgroundColor;if(e&&(!UX(t)||t.width>0)&&(i.fillStyle=e,i.fillRect(0,0,i.canvas.width,i.canvas.height)),!UX(t)||0===t.width)continue;i.save();const n=a.style.opacity||t.style.opacity;i.globalAlpha=""===n?1:Number(n);const r=t.style.transform;if(r)i.transform(..._Y(r));else{const e=parseFloat(t.style.width)/t.width,n=parseFloat(t.style.height)/t.height;i.transform(e,0,0,n,0,0)}i.drawImage(t,0,0),i.restore()}this.dispatchRenderEvent("postcompose",t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let n=e.length-1;n>=0;--n){const r=e[n],i=r.layer;i.getDeclutter()&&i.renderDeclutter(t,r)}e.forEach(e=>e.layer.renderDeferred(t))}}};function y2(t){t instanceof VJ?t.setMapInternal(null):t instanceof jJ&&t.getLayers().forEach(y2)}function v2(t,e){if(t instanceof VJ)t.setMapInternal(e);else if(t instanceof jJ){const n=t.getLayers().getArray();for(let t=0,r=n.length;t<r;++t)v2(n[t],e)}}var b2=class extends vG{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=function(t){let e=null;void 0!==t.keyboardEventTarget&&(e="string"==typeof t.keyboardEventTarget?document.getElementById(t.keyboardEventTarget):t.keyboardEventTarget);const n={},r=t.layers&&"function"==typeof t.layers.getLayers?t.layers:new jJ({layers:t.layers});let i,s,o;return n[DG]=r,n[UG]=t.target,n[BG]=t.view instanceof bX?t.view:new bX,void 0!==t.controls&&(Array.isArray(t.controls)?i=new _G(t.controls.slice()):($G("function"==typeof t.controls.getArray,"Expected `controls` to be an array or an `ol/Collection.js`"),i=t.controls)),void 0!==t.interactions&&(Array.isArray(t.interactions)?s=new _G(t.interactions.slice()):($G("function"==typeof t.interactions.getArray,"Expected `interactions` to be an array or an `ol/Collection.js`"),s=t.interactions)),void 0!==t.overlays?Array.isArray(t.overlays)?o=new _G(t.overlays.slice()):($G("function"==typeof t.overlays.getArray,"Expected `overlays` to be an array or an `ol/Collection.js`"),o=t.overlays):o=new _G,{controls:i,interactions:s,keyboardEventTarget:e,overlays:o,values:n}}(t);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=void 0!==t.maxTilesLoading?t.maxTilesLoading:16,this.pixelRatio_=void 0!==t.pixelRatio?t.pixelRatio:TG,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=dY(),this.pixelToCoordinateTransform_=dY(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,LG||(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_=t.moveTolerance,this.keyboardEventTarget_=e.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,LG||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=e.controls||(LG?new _G:WX()),this.interactions=e.interactions||(LG?new _G:SJ({onFocusOnly:!0})),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new WG(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(DG,this.handleLayerGroupChanged_),this.addChangeListener(BG,this.handleViewChanged_),this.addChangeListener(jG,this.handleSizeChanged_),this.addChangeListener(UG,this.handleTargetChanged_),this.setProperties(e.values);const n=this;!t.view||t.view instanceof bX||t.view.then(function(t){n.setView(new bX(t))}),this.controls.addEventListener(DH,t=>{t.element.setMap(this)}),this.controls.addEventListener(jH,t=>{t.element.setMap(null)}),this.interactions.addEventListener(DH,t=>{t.element.setMap(this)}),this.interactions.addEventListener(jH,t=>{t.element.setMap(null)}),this.overlays_.addEventListener(DH,t=>{this.addOverlayInternal_(t.element)}),this.overlays_.addEventListener(jH,t=>{const e=t.element.getId();void 0!==e&&delete this.overlayIdIndex_[e.toString()],t.element.setMap(null)}),this.controls.forEach(t=>{t.setMap(this)}),this.interactions.forEach(t=>{t.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){v2(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,n){if(!this.frameState_||!this.renderer_)return;const r=this.getCoordinateFromPixelInternal(t),i=void 0!==(n=void 0!==n?n:{}).hitTolerance?n.hitTolerance:0,s=void 0!==n.layerFilter?n.layerFilter:oG,o=!1!==n.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(r,this.frameState_,i,o,e,null,s,null)}getFeaturesAtPixel(t,e){const n=[];return this.forEachFeatureAtPixel(t,function(t){n.push(t)},e),n}getAllLayers(){const t=[];return function e(n){n.forEach(function(n){n instanceof jJ?e(n.getLayers()):t.push(n)})}(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const n=this.getCoordinateFromPixelInternal(t),r=void 0!==(e=void 0!==e?e:{}).layerFilter?e.layerFilter:oG,i=void 0!==e.hitTolerance?e.hitTolerance:0,s=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,i,s,r,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const e=this.viewport_.getBoundingClientRect(),n=this.getSize(),r=e.width/n[0],i=e.height/n[1],s="changedTouches"in t?t.changedTouches[0]:t;return[(s.clientX-e.left)/r,(s.clientY-e.top)/i]}getTarget(){return this.get(UG)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return aY(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?mY(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return void 0!==e?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(DG)}setLayers(t){const e=this.getLayerGroup();if(t instanceof _G)return void e.setLayers(t);const n=e.getLayers();n.clear(),n.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,n=t.length;e<n;++e){const n=t[e];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(t){const e=lY(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?mY(e.coordinateToPixelTransform,t.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(t){this.pixelRatio_!==t&&(this.pixelRatio_=t,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(jG)}getView(){return this.get(BG)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,n,r){return function(t,e,n,r,i){if(!t||!(n in t.wantedTiles))return qG;if(!t.wantedTiles[n][e.getKey()])return qG;const s=t.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_,t,e,n,r)}handleBrowserEvent(t,e){e=e||t.type;const n=new CG(e,this,t);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,n=e.type;if(n===AG||n===JH||n===KH){const t=this.getOwnerDocument(),n=this.viewport_.getRootNode?this.viewport_.getRootNode():t,r=e.target,i=n instanceof ShadowRoot?n.host===r?n.host.ownerDocument:n:n===t?t.documentElement:n;if(this.overlayContainerStopEvent_.contains(r)||!i.contains(r))return}if(t.frameState=this.frameState_,!1!==this.dispatchEvent(t)){const e=this.getInteractions().getArray().slice();for(let n=e.length-1;n>=0;n--){const r=e[n];if(r.getMap()===this&&r.getActive()&&this.getTargetElement()&&(!r.handleEvent(t)||t.propagationStopped))break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let n=this.maxTilesLoading_,r=n;const i=t?t.viewHints:void 0,s=!!i&&(i[0]||i[1]);if(s){const e=Date.now()-t.time>8;n=e?0:8,r=e?0:2}e.getTilesLoading()<n&&(s&&e.reprioritize(),e.loadMoreTiles(n,r))}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(qJ)&&this.renderer_.dispatchRenderEvent(qJ,t),!1===this.loaded_&&(this.loaded_=!0,this.dispatchEvent(new xG(zG,this,t)))):!0===this.loaded_&&(this.loaded_=!1,this.dispatchEvent(new xG(FG,this,t))));const n=this.postRenderFunctions_;if(t)for(let r=0,i=n.length;r<i;++r)n[r](this,t);n.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let t=0,e=this.targetChangeHandlerKeys_.length;t<e;++t)WH(this.targetChangeHandlerKeys_[t]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(GH,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(JH,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!UX(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);const t=this.targetElement_.getRootNode();t instanceof ShadowRoot&&this.resizeObserver_.unobserve(t.host),this.setSize(void 0)}const t=this.getTarget(),e="string"==typeof t?document.getElementById(t):t;if(this.targetElement_=e,e){if(UX(e)||e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new m2(this)),!UX(e)){this.mapBrowserEventHandler_=new OG(this,this.moveTolerance_);for(const e in SG)this.mapBrowserEventHandler_.addEventListener(SG[e],this.handleMapBrowserEvent.bind(this));let t;if(this.viewport_.addEventListener(GH,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(JH,this.boundHandleBrowserEvent_,!!MG&&{passive:!1}),this.keyboardEventTarget_)t=this.keyboardEventTarget_;else{const n=e.getRootNode();t=n instanceof ShadowRoot?n.host:e}if(this.targetChangeHandlerKeys_=[qH(t,KH,this.handleBrowserEvent,this),qH(t,YH,this.handleBrowserEvent,this)],!UX(e)){const t=e.getRootNode();t instanceof ShadowRoot&&this.resizeObserver_.observe(t.host),this.resizeObserver_?.observe(e)}}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_&&(WH(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(WH(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=qH(t,UH,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=qH(t,HH,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(WH),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new zJ("addlayer",t)),this.layerGroupPropertyListenerKeys_=[qH(t,UH,this.render,this),qH(t,HH,this.render,this),qH(t,"addlayer",this.handleLayerAdd_,this),qH(t,"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 t=this.frameState_.layerStatesArray;for(let e=0,n=t.length;e<n;++e){const n=t[e].layer;n.hasRenderer()&&n.getRenderer().handleFontsChanged()}}render(){this.renderer_&&void 0===this.animationDelayKey_&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){y2(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),n=this.getView(),r=this.frameState_;let i=null;if(void 0!==e&&IQ(e)&&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:LZ(s.center,s.resolution,s.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:s,viewHints:r,wantedTiles:{},mapId:mG(this),renderTargets:{}},s.nextCenter&&s.nextResolution){const t=isNaN(s.nextRotation)?s.rotation:s.nextRotation;i.nextExtent=LZ(s.nextCenter,s.nextResolution,t,e)}}this.frameState_=i,this.renderer_.renderFrame(i),i&&(i.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,i.postRenderFunctions),r&&(this.previousExtent_&&(DZ(this.previousExtent_)||vZ(i.extent,this.previousExtent_))||(this.dispatchEvent(new xG("movestart",this,r)),this.previousExtent_=gZ(this.previousExtent_))),!this.previousExtent_||i.viewHints[0]||i.viewHints[1]||vZ(i.extent,this.previousExtent_)||(this.dispatchEvent(new xG("moveend",this,i)),lZ(i.extent,this.previousExtent_))),this.dispatchEvent(new xG(NG,this,i)),this.renderComplete_=(this.hasListener(FG)||this.hasListener(zG)||this.hasListener(qJ))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new zJ("removelayer",e)),this.set(DG,t)}setSize(t){this.set(jG,t)}setTarget(t){this.set(UG,t)}setView(t){if(!t||t instanceof bX)return void this.set(BG,t);this.set(BG,new bX);const e=this;t.then(function(t){e.setView(new bX(t))})}updateSize(){const t=this.getTargetElement();let e;if(t){let n,r;if(UX(t)){const e=t.getContext("2d").getTransform();n=t.width/e.a,r=t.height/e.d}else{const e=getComputedStyle(t);n=t.offsetWidth-parseFloat(e.borderLeftWidth)-parseFloat(e.paddingLeft)-parseFloat(e.paddingRight)-parseFloat(e.borderRightWidth),r=t.offsetHeight-parseFloat(e.borderTopWidth)-parseFloat(e.paddingTop)-parseFloat(e.paddingBottom)-parseFloat(e.borderBottomWidth)}isNaN(n)||isNaN(r)||(e=[Math.max(0,n),Math.max(0,r)],!IQ(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&JZ("No map visible because the map container's width or height are 0."))}const n=this.getSize();!e||n&&sG(e,n)||(this.updateViewportSize_(e),this.setSize(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}},w2="element",_2="map",x2="offset",C2="position",S2="positioning",k2=class extends vG{constructor(t){super(),this.on,this.once,this.un,this.options=t,this.id=t.id,this.insertFirst=void 0===t.insertFirst||t.insertFirst,this.stopEvent=void 0===t.stopEvent||t.stopEvent,this.element=document.createElement("div"),this.element.className=void 0!==t.className?t.className:"ol-overlay-container ol-selectable",this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=!0===t.autoPan?{}:t.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(w2,this.handleElementChanged),this.addChangeListener(_2,this.handleMapChanged),this.addChangeListener(x2,this.handleOffsetChanged),this.addChangeListener(C2,this.handlePositionChanged),this.addChangeListener(S2,this.handlePositioningChanged),void 0!==t.element&&this.setElement(t.element),this.setOffset(void 0!==t.offset?t.offset:[0,0]),this.setPositioning(t.positioning||"top-left"),void 0!==t.position&&this.setPosition(t.position)}getElement(){return this.get(w2)}getId(){return this.id}getMap(){return this.get(_2)||null}getOffset(){return this.get(x2)}getPosition(){return this.get(C2)}getPositioning(){return this.get(S2)}handleElementChanged(){DX(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){this.mapPostrenderListenerKey&&(this.element?.remove(),WH(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=qH(t,NG,this.render,this),this.updatePixelPosition();const e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(t){this.set(w2,t)}setMap(t){this.set(_2,t)}setOffset(t){this.set(x2,t)}setPosition(t){this.set(C2,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(C2))return;const n=this.getRect(e.getTargetElement(),e.getSize()),r=this.getElement(),i=this.getRect(r,[NX(r),FX(r)]),s=void 0===(t=t||{}).margin?20:t.margin;if(!hZ(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=e.getView().getCenterInternal(),r=e.getPixelFromCoordinateInternal(n);if(!r)return;const i=[r[0]+c[0],r[1]+c[1]],s=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(i),duration:s.duration,easing:s.easing})}}}getRect(t,e){const n=t.getBoundingClientRect(),r=n.left+window.pageXOffset,i=n.top+window.pageYOffset;return[r,i,r+e[0],i+e[1]]}setPositioning(t){this.set(S2,t)}setVisible(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)}updatePixelPosition(){const t=this.getMap(),e=this.getPosition();if(!t||!t.isRendered()||!e)return void this.setVisible(!1);const n=t.getPixelFromCoordinate(e),r=t.getSize();this.updateRenderedPosition(n,r)}updateRenderedPosition(t,e){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(${t[0]+r[0]}px, ${t[1]+r[1]}px)`;this.rendered.transform_!=a&&(this.rendered.transform_=a,n.transform=a)}getOptions(){return this.options}},E2=class t extends vG{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if("function"==typeof t.getSimplifiedGeometry){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const e=new t,n=this.geometryName_;e.setGeometryName(n);const r=this.getPropertiesInternal();if(r){const t=this.getGeometry();for(const i in r)i===n&&t?e.set(i,t.clone()):e.set(i,r[i],!0)}const i=this.getStyle();return i&&e.setStyle(i),e}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_&&(WH(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=qH(t,HH,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?function(t){if("function"==typeof t)return t;let e;return Array.isArray(t)?e=t:($G("function"==typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[t]),function(){return e}}(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){t!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}};function R2(t,e,n,r,i,s,o){let a,l;const c=(n-e)/r;if(1===c)a=e;else if(2===c)a=e,l=i;else if(0!==c){let s=t[e],o=t[e+1],c=0;const u=[0];for(let i=e+r;i<n;i+=r){const e=t[i],n=t[i+1];c+=Math.sqrt((e-s)*(e-s)+(n-o)*(n-o)),u.push(c),s=e,o=n}const h=i*c,d=function(t,e,n){let r,i;n=n||tG;let s=0,o=t.length,a=!1;for(;s<o;)r=s+(o-s>>1),i=+n(t[r],e),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=e+(-d-2)*r):a=e+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?t[a+u]:QG(t[a+u],t[a+r+u],l);return s}function T2(t,e,n,r,i,s){if(n==e)return null;let o;if(i<t[e+r-1])return s?(o=t.slice(e,e+r),o[r-1]=i,o):null;if(t[n-1]<i)return s?(o=t.slice(n-r,n),o[r-1]=i,o):null;if(i==t[e+r-1])return t.slice(e,e+r);let a=e/r,l=n/r;for(;a<l;){const e=a+l>>1;i<t[(e+1)*r-1]?l=e:a=e+1}const c=t[a*r-1];if(i==c)return t.slice((a-1)*r,(a-1)*r+r);const u=(i-c)/(t[(a+1)*r-1]-c);o=[];for(let h=0;h<r-1;++h)o.push(QG(t[(a-1)*r+h],t[a*r+h],u));return o.push(i),o}function L2(t,e,n,r){let i=t[e],s=t[e+1],o=0;for(let a=e+r;a<n;a+=r){const e=t[a],n=t[a+1];o+=Math.sqrt((e-i)*(e-i)+(n-s)*(n-s)),i=e,s=n}return o}var I2=class t extends RY{constructor(t,e){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}appendCoordinate(t){iG(this.flatCoordinates,t),this.changed()}clone(){const e=new t(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(t,e,n,r){return r<cZ(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(AY(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),NY(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,n,r))}forEachSegment(t){return HY(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinateAtM(t,e){return"XYM"!=this.layout&&"XYZM"!=this.layout?null:(e=void 0!==e&&e,T2(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return UY(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return R2(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return L2(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(e){const n=[];return n.length=YY(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,n,0),new t(n,"XY")}getType(){return"LineString"}intersectsExtent(t){return GY(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,this.getExtent())}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=zY(this.flatCoordinates,0,t,this.stride),this.changed()}},P2=class t extends RY{constructor(t,e,n){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,e);else if(void 0!==e&&n)this.setFlatCoordinates(e,t),this.ends_=n;else{const e=t,n=[],r=[];for(let t=0,s=e.length;t<s;++t)iG(n,e[t].getFlatCoordinates()),r.push(n.length);const i=0===e.length?this.getLayout():e[0].getLayout();this.setFlatCoordinates(i,n),this.ends_=r}}appendLineString(t){iG(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const e=new t(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(t,e,n,r){return r<cZ(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(OY(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),FY(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,e,n,r))}getCoordinateAtM(t,e,n){return"XYM"!=this.layout&&"XYZM"!=this.layout||0===this.flatCoordinates.length?null:(e=void 0!==e&&e,n=void 0!==n&&n,function(t,e,n,r,i,s,o){if(o)return T2(t,e,n[n.length-1],r,i,s);let a;if(i<t[r-1])return s?(a=t.slice(0,r),a[r-1]=i,a):null;if(t[t.length-1]<i)return s?(a=t.slice(t.length-r),a[r-1]=i,a):null;for(let l=0,c=n.length;l<c;++l){const s=n[l];if(e!=s){if(i<t[e+r-1])return null;if(i<=t[s-1])return T2(t,e,s,r,i,!1);e=s}}return null}(this.flatCoordinates,0,this.ends_,this.stride,t,e,n))}getCoordinates(){return BY(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new I2(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLineStrings(){const t=this.flatCoordinates,e=this.ends_,n=this.layout,r=[];let i=0;for(let s=0,o=e.length;s<o;++s){const o=e[s],a=new I2(t.slice(i,o),n);r.push(a),i=o}return r}getLength(){const t=this.ends_;let e=0,n=0;for(let r=0,i=t.length;r<i;++r)n+=L2(this.flatCoordinates,e,t[r],this.stride),e=t[r];return n}getFlatMidpoints(){const t=[],e=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];iG(t,R2(e,n,o,i,.5)),n=o}return t}getSimplifiedGeometryInternal(e){const n=[],r=[];return n.length=XY(this.flatCoordinates,0,this.ends_,this.stride,e,n,0,r),new t(n,"XY",r)}getType(){return"MultiLineString"}intersectsExtent(t){return function(t,e,n,r,i){for(let s=0,o=n.length;s<o;++s){if(GY(t,e,n[s],r,i))return!0;e=n[s]}return!1}(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const n=DY(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===n.length?0:n[n.length-1],this.changed()}},M2=class t extends RY{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){iG(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){const e=new t(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(t,e,n,r){if(r<cZ(this.getExtent(),t,e))return r;const i=this.flatCoordinates,s=this.stride;for(let o=0,a=i.length;o<a;o+=s){const a=KG(t,e,i[o],i[o+1]);if(a<r){r=a;for(let t=0;t<s;++t)n[t]=i[o+t];n.length=s}}return r}getCoordinates(){return UY(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new nX(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,n=this.stride,r=[];for(let i=0,s=t.length;i<s;i+=n){const s=new nX(t.slice(i,i+n),e);r.push(s)}return r}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,n=this.stride;for(let r=0,i=e.length;r<i;r+=n)if(dZ(t,e[r],e[r+1]))return!0;return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=zY(this.flatCoordinates,0,t,this.stride),this.changed()}};function A2(t,e,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=yZ(t,e,a[0],r),i.push((s[0]+s[2])/2,(s[1]+s[3])/2),e=a[a.length-1]}return i}var O2=class t extends RY{constructor(t,e,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(t[0])){const r=t,i=[],s=[];for(let t=0,e=r.length;t<e;++t){const e=r[t],n=i.length,o=e.getEnds();for(let t=0,r=o.length;t<r;++t)o[t]+=n;iG(i,e.getFlatCoordinates()),s.push(o)}e=0===r.length?this.getLayout():r[0].getLayout(),t=i,n=s}void 0!==e&&n?(this.setFlatCoordinates(e,t),this.endss_=n):this.setCoordinates(t,e)}appendPolygon(t){let e;if(this.flatCoordinates){const n=this.flatCoordinates.length;iG(this.flatCoordinates,t.getFlatCoordinates()),e=t.getEnds().slice();for(let t=0,r=e.length;t<r;++t)e[t]+=n}else this.flatCoordinates=t.getFlatCoordinates().slice(),e=t.getEnds().slice(),this.endss_.push();this.endss_.push(e),this.changed()}clone(){const e=this.endss_.length,n=new Array(e);for(let t=0;t<e;++t)n[t]=this.endss_[t].slice();const r=new t(this.flatCoordinates.slice(),this.layout,n);return r.applyProperties(this),r}closestPointXY(t,e,n,r){return r<cZ(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(function(t,e,n,r,i){for(let s=0,o=n.length;s<o;++s){const o=n[s];i=OY(t,e,o,r,i),e=o[o.length-1]}return i}(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),function(t,e,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=FY(t,e,s,r,i,!0,o,a,l,c,u),e=s[s.length-1]}return c}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,0,t,e,n,r))}containsXY(t,e){return function(t,e,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(WY(t,e,a,r,i,s))return!0;e=a[a.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return function(t,e,n,r){let i=0;for(let s=0,o=n.length;s<o;++s){const o=n[s];i+=PY(t,e,o,r),e=o[o.length-1]}return i}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),uX(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,$Y(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const t=A2(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=iX(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new M2(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;lX(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=uX(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){const n=[],r=[];return n.length=function(t,e,n,r,i,s,o,a){for(let l=0,c=n.length;l<c;++l){const c=n[l],u=[];o=tX(t,e,c,r,i,s,o,u),a.push(u),e=c[c.length-1]}return o}(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(e),n,0,r),new t(n,"XY",r)}getPolygon(t){if(t<0||this.endss_.length<=t)return null;let e;if(0===t)e=0;else{const n=this.endss_[t-1];e=n[n.length-1]}const n=this.endss_[t].slice(),r=n[n.length-1];if(0!==e)for(let i=0,s=n.length;i<s;++i)n[i]-=e;return new dX(this.flatCoordinates.slice(e,r),this.layout,n)}getPolygons(){const t=this.layout,e=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 t=0,e=o.length;t<e;++t)o[t]-=i;const l=new dX(e.slice(i,a),t,o);r.push(l),i=a}return r}getType(){return"MultiPolygon"}intersectsExtent(t){return function(t,e,n,r,i){for(let s=0,o=n.length;s<o;++s){const o=n[s];if(KY(t,e,o,r,i))return!0;e=o[o.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);const n=jY(this.flatCoordinates,0,t,this.stride,this.endss_);if(0===n.length)this.flatCoordinates.length=0;else{const t=n[n.length-1];this.flatCoordinates.length=0===t.length?0:t[t.length-1]}this.changed()}},N2=class{drawCustom(t,e,n,r,i){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,n){}drawFeature(t,e,n){}drawGeometryCollection(t,e,n){}drawLineString(t,e,n){}drawMultiLineString(t,e,n){}drawMultiPoint(t,e,n){}drawMultiPolygon(t,e,n){}drawPoint(t,e,n){}drawPolygon(t,e,n){}drawText(t,e,n){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}},F2=11,z2=[8],D2=[12],j2=[1],U2=[3],B2=class extends N2{constructor(t,e,n,r){super(),this.tolerance=t,this.maxExtent=e,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(t){const e=this.pixelRatio;return 1==e?t:t.map(function(t){return t*e})}appendFlatPointCoordinates(t,e){const n=this.getBufferedMaxExtent(),r=this.tmpCoordinate_,i=this.coordinates;let s=i.length;for(let o=0,a=t.length;o<a;o+=e)r[0]=t[o],r[1]=t[o+1],uZ(n,r)&&(i[s++]=r[0],i[s++]=r[1]);return s}appendFlatLineCoordinates(t,e,n,r,i,s){const o=this.coordinates;let a=o.length;const l=this.getBufferedMaxExtent();s&&(e+=r);let c=t[e],u=t[e+1];const h=this.tmpCoordinate_;let d,p,f,g=!0;for(d=e+r;d<n;d+=r)h[0]=t[d],h[1]=t[d+1],f=pZ(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===e+r)&&(o[a++]=c,o[a++]=u),a}drawCustomCoordinates_(t,e,n,r,i){for(let s=0,o=n.length;s<o;++s){const o=n[s],a=this.appendFlatLineCoordinates(t,e,o,r,!1,!1);i.push(a),e=o}return e}drawCustom(t,e,n,r,i){this.beginGeometry(t,e,i);const s=t.getType(),o=t.getStride(),a=this.coordinates.length;let l,c,u,h,d;switch(s){case"MultiPolygon":l=t.getOrientedFlatCoordinates(),h=[];const e=t.getEndss();d=0;for(let t=0,n=e.length;t<n;++t){const n=[];d=this.drawCustomCoordinates_(l,d,e[t],o,n),h.push(n)}this.instructions.push([4,a,h,t,n,$Y,i]),this.hitDetectionInstructions.push([4,a,h,t,r||n,$Y,i]);break;case"Polygon":case"MultiLineString":u=[],l="Polygon"==s?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),d=this.drawCustomCoordinates_(l,0,t.getEnds(),o,u),this.instructions.push([4,a,u,t,n,BY,i]),this.hitDetectionInstructions.push([4,a,u,t,r||n,BY,i]);break;case"LineString":case"Circle":l=t.getFlatCoordinates(),c=this.appendFlatLineCoordinates(l,0,l.length,o,!1,!1),this.instructions.push([4,a,c,t,n,UY,i]),this.hitDetectionInstructions.push([4,a,c,t,r||n,UY,i]);break;case"MultiPoint":l=t.getFlatCoordinates(),c=this.appendFlatPointCoordinates(l,o),c>a&&(this.instructions.push([4,a,c,t,n,UY,i]),this.hitDetectionInstructions.push([4,a,c,t,r||n,UY,i]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),c=this.coordinates.length,this.instructions.push([4,a,c,t,n,void 0,i]),this.hitDetectionInstructions.push([4,a,c,t,r||n,void 0,i])}this.endGeometry(e)}beginGeometry(t,e,n){this.beginGeometryInstruction1_=[0,e,0,t,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[0,e,0,t,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const n=t.length;let r,i,s=-1;for(e=0;e<n;++e)r=t[e],i=r[0],7==i?s=e:0==i&&(r[2]=e,rG(this.hitDetectionInstructions,s,e),s=-1)}fillStyleToState(t,e={}){if(t){const n=t.getColor();e.fillPatternScale=n&&"object"==typeof n&&"src"in n?this.pixelRatio:1,e.fillStyle=u1(n||"#000")??void 0}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const n=t.getColor();e.strokeStyle=u1(n||m1);const r=t.getLineCap();e.lineCap=void 0!==r?r:p1;const i=t.getLineDash();e.lineDash=i?i.slice():f1;const s=t.getLineDashOffset();e.lineDashOffset=s||0;const o=t.getLineJoin();e.lineJoin=void 0!==o?o:g1;const a=t.getWidth();e.lineWidth=void 0!==a?a:1;const l=t.getMiterLimit();e.miterLimit=void 0!==l?l:10,e.strokeOffset=t.getOffset()??0,e.lineWidth>this.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0,e.strokeOffset=void 0;return e}setFillStrokeStyle(t,e){const n=this.state;this.fillStyleToState(t,n),this.strokeStyleToState(e,n)}createFill(t){const e=t.fillStyle,n=[10,e];return"string"!=typeof e&&n.push(t.fillPatternScale),n}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[F2,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const n=t.fillStyle;(void 0!==n&&"string"!=typeof n||t.currentFillStyle!=n)&&(this.instructions.push(e.call(this,t)),t.currentFillStyle=n)}updateStrokeStyle(t,e){const n=t.strokeStyle,r=t.lineCap,i=t.lineDash,s=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,l=t.miterLimit,c=t.strokeOffset;(t.currentStrokeStyle!=n||t.currentLineCap!=r||i!=t.currentLineDash&&!sG(t.currentLineDash,i)||t.currentLineDashOffset!=s||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=l||t.currentStrokeOffset!=c)&&(e.call(this,t),t.currentStrokeStyle=n,t.currentLineCap=r,t.currentLineDash=i,t.currentLineDashOffset=s,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=l,t.currentStrokeOffset=c)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[7,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=lZ(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;aZ(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},$2=class extends B2{constructor(t,e,n,r){super(t,e,n,r)}drawFlatCoordinatess_(t,e,n,r,i){const s=this.state,o=void 0!==s.fillStyle,a=void 0!==s.strokeStyle,l=n.length;this.instructions.push(j2),this.hitDetectionInstructions.push(j2);for(let c=0;c<l;++c){const s=n[c],o=this.coordinates.length,l=this.appendFlatLineCoordinates(t,e,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(U2),this.hitDetectionInstructions.push(U2)),e=s}return o&&(this.instructions.push(z2),this.hitDetectionInstructions.push(z2)),a&&(this.instructions.push(D2),this.hitDetectionInstructions.push(D2)),e}drawCircle(t,e,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(t,e,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,n),void 0!==r.fillStyle&&this.hitDetectionInstructions.push([10,d1]),void 0!==r.strokeStyle&&this.hitDetectionInstructions.push([F2,m1,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,f1,0]);const a=t.getFlatCoordinates(),l=t.getStride(),c=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,l,!1,!1);const u=[2,c,o];this.instructions.push(j2,u),this.hitDetectionInstructions.push(j2,u),void 0!==r.fillStyle&&(this.instructions.push(z2),this.hitDetectionInstructions.push(z2)),void 0!==r.strokeStyle&&(this.instructions.push(D2),this.hitDetectionInstructions.push(D2)),this.endGeometry(e)}drawPolygon(t,e,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(t,e,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,n),void 0!==r.fillStyle&&this.hitDetectionInstructions.push([10,d1]),void 0!==r.strokeStyle&&this.hitDetectionInstructions.push([F2,m1,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,f1,0]);const a=t.getEnds(),l=t.getOrientedFlatCoordinates(),c=t.getStride();this.drawFlatCoordinatess_(l,0,a,c,o),this.endGeometry(e)}drawMultiPolygon(t,e,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(t,e,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,n),void 0!==r.fillStyle&&this.hitDetectionInstructions.push([10,d1]),void 0!==r.strokeStyle&&this.hitDetectionInstructions.push([F2,m1,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,f1,0]);const a=t.getEndss(),l=t.getOrientedFlatCoordinates(),c=t.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(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(0!==t){const e=this.coordinates;for(let n=0,r=e.length;n<r;++n)e[n]=JY(e[n],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke)}handleStrokeOffset_(t){const e=this.state,n=e.fillStyle,r=e.strokeStyle,i=e.strokeOffset;return Math.abs(i)>0&&void 0!==n&&void 0!==r&&(e.strokeStyle=void 0,e.strokeOffset=0,t(),e.fillStyle=void 0,e.strokeStyle=r,e.strokeOffset=i,t(),e.fillStyle=n,!0)}},q2=0,V2=1;function W2(t,e,n,r,i,s,o,a){const l=o-i,c=a-s;let u=0,h=1;if(0===l){if(i<t||i>n)return!1}else{let e=(t-i)/l,r=(n-i)/l;if(e>r){const t=e;e=r,r=t}if(e>u&&(u=e),r<h&&(h=r),u>h)return!1}if(0===c){if(s<e||s>r)return!1}else{let t=(e-s)/c,n=(r-s)/c;if(t>n){const e=t;t=n,n=e}if(t>u&&(u=t),n<h&&(h=n),u>h)return!1}return q2=u,V2=h,!0}function H2(t,e,n,r,i){const s=[];let o=n,a=0,l=e.slice(n,2);for(;a<t&&o+i<r;){const[n,r]=l.slice(-2),c=e[o+i],u=e[o+i+1],h=Math.sqrt((c-n)*(c-n)+(u-r)*(u-r));if(a+=h,a>=t){const e=(t-a+h)/h,d=QG(n,c,e),p=QG(r,u,e);l.push(d,p),s.push(l),l=[d,p],a==t&&(o+=i),a=0}else if(a<t)l.push(e[o+i],e[o+i+1]),o+=i;else{const t=h-a,e=QG(n,c,t/h),d=QG(r,u,t/h);l.push(e,d),s.push(l),l=[e,d],a=0,o+=i}}return a>0&&s.push(l),s}function G2(t,e,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=e[o],r=e[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>t&&(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 Z2,K2={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},Y2={Circle:$2,Default:B2,Image:class extends B2{constructor(t,e,n,r){super(t,e,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(t,e,n){if(!this.image_||this.maxExtent&&!uZ(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,n);const r=t.getFlatCoordinates(),i=t.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(e)}drawMultiPoint(t,e,n){if(!this.image_)return;this.beginGeometry(t,e,n);const r=t.getFlatCoordinates(),i=[];for(let a=0,l=r.length;a<l;a+=t.getStride())this.maxExtent&&!uZ(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(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const n=t.getAnchor(),r=t.getSize(),i=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=n[0],this.anchorY_=n[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=r[1],this.opacity_=t.getOpacity(),this.originX_=i[0],this.originY_=i[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=r[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}},LineString:class extends B2{constructor(t,e,n,r){super(t,e,n,r)}drawFlatCoordinates_(t,e,n,r,i){const s=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,n,r,!1,!1);return this.instructions.push([9,s,o,i*this.pixelRatio]),this.hitDetectionInstructions.push([9,s,o,i]),n}drawLineString(t,e,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(t,e,n),this.hitDetectionInstructions.push([F2,m1,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,f1,0],j2);const a=t.getFlatCoordinates(),l=t.getStride();this.drawFlatCoordinates_(a,0,a.length,l,o),this.hitDetectionInstructions.push(D2),this.endGeometry(e)}drawMultiLineString(t,e,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(t,e,n),this.hitDetectionInstructions.push([F2,m1,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,f1,0],j2);const a=t.getEnds(),l=t.getFlatCoordinates(),c=t.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(D2),this.endGeometry(e)}finish(){const t=this.state;return null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&this.instructions.push(D2),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(D2),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(j2)}},Polygon:$2,Text:class extends B2{constructor(t,e,n,r){super(t,e,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[d1]={fillStyle:d1},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 t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,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=t.getType();let c=null,u=t.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=t.getFlatCoordinates();break;case"LineString":c=t.getFlatMidpoint();break;case"Circle":c=t.getCenter();break;case"MultiLineString":c=t.getFlatMidpoints(),u=2;break;case"Polygon":c=t.getFlatInteriorPoint(),s.overflow||r.push(c[2]/this.resolution),u=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();c=[];for(let t=0,n=e.length;t<n;t+=3)s.overflow||r.push(e[t+2]/this.resolution),c.push(e[t],e[t+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 t=a/2;r=r.filter((e,n)=>{const r=o[2*(t+n)]===c[n*u]&&o[2*(t+n)+1]===c[n*u+1];return r||--t,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(t,e,n);let p=s.padding;if(p!=v1&&(s.scale[0]<0||s.scale[1]<0)){let t=s.padding[0],e=s.padding[1],n=s.padding[2],r=s.padding[3];s.scale[0]<0&&(e=-e,r=-r),s.scale[1]<0&&(t=-t,n=-n),p=[t,e,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==v1?v1:p.map(function(t){return t*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]=d1),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_?d1:this.fillKey_,this.textOffsetX_,this.textOffsetY_,r]),this.endGeometry(e)}else{const r=t.getExtent();if(!zZ(this.maxExtent,r))return;let i;if(c=t.getFlatCoordinates(),"LineString"==l)i=[c.length];else if("MultiLineString"==l)i=t.getEnds();else if("Polygon"==l)i=t.getEnds().slice(0,1);else if("MultiPolygon"==l){const e=t.getEndss();i=[];for(let t=0,n=e.length;t<n;++t)i.push(e[t][0])}if(("LineString"==l||"MultiLineString"==l)&&!hZ(this.getBufferedMaxExtent(),r)){const t=function(t,e,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=e.length;f<g;++f){const r=e[f];let g=t[p],m=t[p+1],y=!1;for(let e=p+n;e<r;e+=n){const n=t[e],r=t[e+1];if(W2(i,s,o,a,g,m,n,r)){const t=n-g,e=r-m,i=g+q2*t,s=m+q2*e,o=g+V2*t,a=m+V2*e;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=t.flatCoordinates,i=t.ends,u=2,0===i.length)return}this.beginGeometry(t,e,n);const h=s.repeat,d=h?void 0:s.textAlign;let p=0;for(let t=0,e=i.length;t<e;++t){let e;e=h?H2(h*this.resolution,c,p,i[t],u):[c.slice(p,i[t])];for(let n=0,r=e.length;n<r;++n){const r=e[n];let l=0,c=r.length;if(null==d){const t=G2(s.maxAngle,r,0,r.length,2);l=t[0],c=t[1]}for(let t=l;t<c;t+=u)o.push(r[t],r[t+1]);const h=o.length;p=i[t],this.drawChars_(a,h),a=h}}this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,n=this.textFillState_,r=this.strokeKey_;t&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const i=this.textKey_;i in this.textStates||(this.textStates[i]={font:e.font,textAlign:e.textAlign||"center",justify:e.justify,textBaseline:e.textBaseline||"middle",scale:e.scale});const s=this.fillKey_;n&&(s in this.fillStates||(this.fillStates[s]={fillStyle:n.fillStyle}))}drawChars_(t,e){const n=this.textStrokeState_,r=this.textState_,i=this.strokeKey_,s=this.textKey_,o=this.fillKey_;this.saveTextStates_();const a=this.pixelRatio,l=K2[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,t,e,l,r.overflow,o,r.maxAngle,a,u,i,d*a,h,s,1,this.declutterMode_,this.textKeepUpright_,c]),this.hitDetectionInstructions.push([5,t,e,l,r.overflow,o?d1:o,r.maxAngle,a,u,i,d*a,h,s,1/a,this.declutterMode_,this.textKeepUpright_,c])}setTextStyle(t,e){let n,r,i;if(t){const e=t.getFill();e?(r=this.textFillState_,r||(r={},this.textFillState_=r),r.fillStyle=u1(e.getColor()||"#000")):(r=null,this.textFillState_=r);const s=t.getStroke();if(s){i=this.textStrokeState_,i||(i={},this.textStrokeState_=i);const t=s.getLineDash(),e=s.getLineDashOffset(),n=s.getWidth(),r=s.getMiterLimit();i.lineCap=s.getLineCap()||"round",i.lineDash=t?t.slice():f1,i.lineDashOffset=void 0===e?0:e,i.lineJoin=s.getLineJoin()||"round",i.lineWidth=void 0===n?1:n,i.miterLimit=void 0===r?10:r,i.strokeStyle=u1(s.getColor()||"#000")}else i=null,this.textStrokeState_=i;n=this.textState_;const o=t.getFont()||"10px sans-serif";S1(o);const a=t.getScaleArray();n.overflow=t.getOverflow(),n.font=o,n.maxAngle=t.getMaxAngle(),n.placement=t.getPlacement(),n.textAlign=t.getTextAlign(),n.repeat=t.getRepeat(),n.justify=t.getJustify(),n.textBaseline=t.getTextBaseline()||"middle",n.backgroundFill=t.getBackgroundFill(),n.backgroundStroke=t.getBackgroundStroke(),n.padding=t.getPadding()||v1,n.scale=void 0===a?[1,1]:a;const l=t.getOffsetX(),c=t.getOffsetY(),u=t.getRotateWithView(),h=t.getKeepUpright(),d=t.getRotation();this.text_=t.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:mG(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:"|"+mG(r.fillStyle):""}else this.text_="";this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}},X2=class{constructor(t,e,n,r){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=r,this.resolution_=n,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const n=this.buildersByZIndex_[e];for(const r in n){const i=n[r].finish();t[e][r]=i}}return t}getBuilder(t,e){const n=void 0!==t?t.toString():"0";let r=this.buildersByZIndex_[n];void 0===r&&(r={},this.buildersByZIndex_[n]=r);let i=r[e];return void 0===i&&(i=new(0,Y2[e])(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[e]=i),i}};function J2(t,e,n,r,i,s,o,a){o=o??[],a=a??r;const l=t[e+r],c=t[e+r+1],u=t[n-2*r],h=t[n-2*r+1];let d,p,f,g,m,y,v,b,w=0;for(let _=e;_<n;_+=r){f=d,g=p,m=void 0,y=void 0,_+r<n&&(m=t[_+r],y=t[_+r+1]),s&&_===e&&(f=u,g=h),s&&_===n-r&&(m=l,y=c),d=t[_],p=t[_+1],[v,b]=Q2(d,p,f,g,m,y,i),o[w++]=v,o[w++]=b;for(let e=2;e<a;e++)o[w++]=t[_+e]}return o.length!=w&&(o.length=w),o}function Q2(t,e,n,r,i,s,o){let a,l;void 0!==n&&void 0!==r?(a=t-n,l=e-r):void 0!==i&&void 0!==s?(a=i-t,l=s-e):(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[t+a*o,e+l*o];if(void 0===i||void 0===s)return[t+a*o,e+l*o];const d=function(t,e,n){const r=Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),i=[(e[0]-t[0])/r,(e[1]-t[1])/r],s=[-i[1],i[0]],o=Math.sqrt((n[0]-t[0])*(n[0]-t[0])+(n[1]-t[1])*(n[1]-t[1])),a=[(n[0]-t[0])/o,(n[1]-t[1])/o];let l=0===r||0===o?0:Math.acos(GG(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}([t,e],[n,r],[i,s]);if(Math.cos(d)>.998)return[t+u*o,e+h*o];const p=Math.cos(d/2),f=Math.sin(d/2);return[t+1/f*(f*a+p*l)*o,e+1/f*(-p*a+f*l)*o]}function t3(t,e,n=!1){for(let r=0,i=t.length-2;r<i;r+=e)for(let s=n&&0===r?t.length-3*e:t.length-2*e;s>r+e;s-=e){const n=t[r],i=t[r+1],o=t[r+e],a=t[r+e+1],l=t[s],c=t[s+1],u=t[s+e],h=t[s+e+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);t[r+e]=l,t[r+e+1]=c,t.splice(r+2*e,s-r-e);break}}return t}function e3(t,e,n,r,i,s,o,a,l,c,u,h,d=!0){let p=t[e],f=t[e+1],g=0,m=0,y=0,v=0;function b(){g=p,m=f,p=t[e+=r],f=t[e+1],v+=y,y=Math.sqrt((p-g)*(p-g)+(f-m)*(f-m))}do{b()}while(e<n-r&&v+y<s);let w=0===y?0:(s-v)/y;const _=QG(g,p,w),x=QG(m,f,w),C=e-r,S=v,k=s+a*l(c,i,u);for(;e<n-r&&v+y<k;)b();w=0===y?0:(k-v)/y;const E=QG(g,p,w),R=QG(m,f,w);let T=!1;if(d)if(h){const t=[_,x,E,R];CY(t,0,4,2,h,t,t),T=t[0]>t[2]}else T=_>E;const L=Math.PI,I=[],P=C+r===e;let M;if(y=0,v=S,p=t[e=C],f=t[e+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((Z2||(Z2=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Z2).segment(i),t=>t.segment);for(let O=0,N=A.length;O<N;){b();let t=Math.atan2(f-m,p-g);if(T&&(t+=t>0?-L:L),void 0!==M){let e=t-M;if(e+=e>L?-2*L:e<-L?2*L:0,Math.abs(e)>o)return null}M=t;const i=O;let h=0;for(;O<N;++O){const t=a*l(c,A[T?N-O-1:O],u);if(e+r<n&&v+y<s+h+t/2)break;h+=t}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 _=QG(g,p,w),x=QG(m,f,w);I.push([_,x,h/2,t,d]),s+=h}return I}var n3=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(AX(),{get:(t,e)=>{if("function"==typeof t[e])return this.pendingMethod_=e,this.pushMethodArgs_},set:(t,e,n)=>(this.push_(e,n),!0)})}push_(...t){const e=this.instructions_,n=this.zIndex+this.offset_;e[n]||(e[n]=[]),e[n].push(...t)}pushMethodArgs_=(...t)=>{this.push_(this.pendingMethod_,t)};pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(e=>{for(let n=0,r=e.length;n<r;++n){const r=e[n];if("function"==typeof r){r(t);continue}const i=e[++n];"function"==typeof t[r]?t[r](...i):t[r]="function"==typeof i?i(t):i}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},r3=[1/0,1/0,-1/0,-1/0],i3=[],s3=[],o3=[],a3=[];function l3(t){return t[3].declutterBox}var c3=new RegExp("["+String.fromCharCode(1425)+"-ࣿיִ-﷿ﹰ-ﻼࠀ--]");function u3(t,e){return"start"===e?e=c3.test(t)?"right":"left":"end"===e&&(e=c3.test(t)?"left":"right"),K2[e]}function h3(t,e,n){return n>0&&t.push("\n",""),t.push(e,""),t}function d3(t,e,n){return n%2==0&&(t+=e),t}var p3=class{constructor(t,e,n,r,i){this.overlaps=n,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=dY(),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 n3:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,n,r){const i=t+e+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[e],l=this.pixelRatio,c=[a.scale[0]*l,a.scale[1]*l],u=a.justify?K2[a.justify]:u3(Array.isArray(t)?t[0]:t,a.textAlign||"center"),h=r&&s.lineWidth?s.lineWidth:0,d=Array.isArray(t)?t:String(t).split("\n").reduce(h3,[]),{width:p,height:f,widths:g,heights:m,lineWidths:y}=function(t,e){const n=[],r=[],i=[];let s=0,o=0,a=0,l=0;for(let c=0,u=e.length;c<=u;c+=2){const h=e[c];if("\n"===h||c===u){s=Math.max(s,o),i.push(o),o=0,a+=l,l=0;continue}const d=e[c+1]||t.font,p=R1(d,h);n.push(p),o+=p;const f=k1(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 t=d[M];if("\n"===t){L+=T,T=0,S=u*v+C*h,++P;continue}const e=d[M+1]||a.font;e!==R&&(r&&k.push("font",e),n&&E.push("font",e),R=e),T=Math.max(T,m[I]);const i=[t,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_(t,e,n,r,i,s,o){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,n),t.lineTo.apply(t,r),t.lineTo.apply(t,i),t.lineTo.apply(t,e),s&&(this.alignAndScaleFill_=s[2],t.fillStyle=s[1],this.fill_(t)),o&&(this.setStrokeStyle_(t,o),t.stroke())}calculateImageOrLabelDimensions_(t,e,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>t?t-l:i,b=s+c>e?e-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)&&(i3[0]=x,a3[0]=x,i3[1]=C,s3[1]=C,s3[0]=x+w,o3[0]=s3[0],o3[1]=C+_,a3[1]=o3[1]),0!==u?(S=vY(dY(),n,r,1,1,u,-n,-r),mY(S,i3),mY(S,s3),mY(S,o3),mY(S,a3),fZ(Math.min(i3[0],s3[0],o3[0],a3[0]),Math.min(i3[1],s3[1],o3[1],a3[1]),Math.max(i3[0],s3[0],o3[0],a3[0]),Math.max(i3[1],s3[1],o3[1],a3[1]),r3)):fZ(Math.min(x,x+w),Math.min(C,C+_),Math.max(x,x+w),Math.max(C,C+_),r3),d&&(m=Math.round(m),y=Math.round(y)),{drawImageX:m,drawImageY:y,drawImageW:v,drawImageH:b,originX:l,originY:c,declutterBox:{minX:r3[0],minY:r3[1],maxX:r3[2],maxY:r3[3],value:g},canvasTransform:S,scale:h}}replayImageOrLabel_(t,e,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<=e[0]&&l.maxX+c>=0&&l.minY-c<=e[1]&&l.maxY+c>=0&&(a&&this.replayTextBackground_(t,i3,s3,o3,a3,s,o),function(t,e,n,r,i,s,o,a,l,c,u){t.save(),1!==n&&(void 0===t.globalAlpha?t.globalAlpha=t=>t.globalAlpha*=n:t.globalAlpha*=n),e&&t.transform.apply(t,e),r.contextInstructions?(t.translate(l,c),t.scale(u[0],u[1]),function(t,e){const n=t.contextInstructions;for(let r=0,i=n.length;r<i;r+=2)Array.isArray(n[r+1])?e[n[r]].apply(e,n[r+1]):e[n[r]]=n[r+1]}(r,t)):u[0]<0||u[1]<0?(t.translate(l,c),t.scale(u[0],u[1]),t.drawImage(r,i,s,o,a,0,0,o,a)):t.drawImage(r,i,s,o,a,l,c,o*u[0],a*u[1]),t.restore()}(t,r.canvasTransform,i,n,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const n=mY(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;t.save(),t.translate(n[0]%r,n[1]%r),1!==e&&t.scale(e,e)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],e[1]&&(t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6]))}drawLabelWithPointPlacement_(t,e,n,r){const i=this.textStates[e],s=this.createLabel(t,e,r,n),o=this.strokeStates[n],a=this.pixelRatio,l=u3(Array.isArray(t)?t[0]:t,i.textAlign||"center"),c=K2[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_(t,e,n,r,i,s,o,a){const l=this.zIndexContext_;let c;var u,h;this.pixelCoordinates_&&sG(n,this.renderedTransform_)?c=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),c=xY(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:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:A},F=this.instructions!=r||this.overlaps?0:200;let z,D,j,U;for(;d<p;){const n=r[d];switch(n[0]){case 0:z=n[1],U=n[3],z.getGeometry()?void 0===o||zZ(o,U.getExtent())?++d:d=n[2]+1:d=n[2],l&&(l.zIndex=n[4]);break;case 1:I>F&&(this.fill_(t),I=0),P>F&&(t.stroke(),P=0),I||P||(t.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);t.moveTo(r+B,u),t.arc(r,u,B,0,2*Math.PI,!0),++d;break;case 3:t.closePath(),++d;break;case 4:g=n[1],f=n[2];const $=n[3],q=n[4],V=n[5];N.geometry=$,N.feature=z,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],Z=n[8],K=n[9],Y=n[10];let X=n[11];const J=n[12];let Q=n[13];w=n[14]||"declutter";const tt=n[15];if(!k&&n.length>=20){E=n[19],R=n[20],T=n[21],L=n[22];const t=this.drawLabelWithPointPlacement_(E,R,T,L);k=t.label,n[3]=k;const e=n[23];y=(t.anchorX-e)*this.pixelRatio,n[4]=y;const r=n[24];v=(t.anchorY-r)*this.pixelRatio,n[5]=v,H=k.height,n[6]=H,Q=k.width,n[13]=Q}let et,nt,rt,it;n.length>25&&(et=n[25]),n.length>17?(nt=n[16],rt=n[17],it=n[18]):(nt=v1,rt=null,it=null),Y&&O?X+=A:Y||O||(X-=A);let st=0;for(;g<f;g+=2){if(et&&et[st++]<Q/this.pixelRatio)continue;const n=this.calculateImageOrLabelDimensions_(k.width,k.height,c[g],c[g+1],Q,H,y,v,Z,K,X,J,i,nt,!!rt||!!it,z),r=[t,e,k,n,G,rt,it];if(a){let t,e,i,s,o;if(tt){const n=f-g;if(!tt[n]){tt[n]={args:r,declutterMode:w};continue}const s=tt[n];t=s.args,e=s.declutterMode,delete tt[n],i=l3(t)}if(!t||"declutter"===e&&a.collides(i)||(s=!0),"declutter"===w&&a.collides(n.declutterBox)||(o=!0),"declutter"===e&&"declutter"===w){const t=s&&o;s=t,o=t}s&&("none"!==e&&a.insert(i),this.replayImageOrLabel_.apply(this,t)),o&&("none"!==w&&a.insert(n.declutterBox),this.replayImageOrLabel_.apply(this,r))}else this.replayImageOrLabel_.apply(this,r)}++d;break;case 5:const ot=n[1],at=n[2],lt=n[3],ct=n[4];L=n[5];const ut=n[6],ht=n[7],dt=n[8];T=n[9];const pt=n[10];E=n[11],Array.isArray(E)&&(E=E.reduce(d3,"")),R=n[12];const ft=[n[13],n[13]];w=n[14]||"declutter";const gt=n[15],mt=n[16],yt=this.textStates[R],vt=yt.font,bt=[yt.scale[0]*ht,yt.scale[1]*ht];let wt;vt in this.widths_?wt=this.widths_[vt]:(wt={},this.widths_[vt]=wt);const _t=L2(c,ot,at,2),xt=Math.abs(bt[0])*T1(vt,E,wt);if(ct||xt<=_t){const n=e3(c,ot,at,2,E,(_t-xt)*u3(E,this.textStates[R].textAlign),ut,Math.abs(bt[0]),T1,vt,wt,O?0:this.viewRotation_,gt);t: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]+(bt[0]<0?-pt:pt)-mt,v=lt*l.height+2*(.5-lt)*pt*bt[1]/bt[0]-dt;const s=this.calculateImageOrLabelDimensions_(l.width,l.height,c[0],c[1],l.width,l.height,y,v,0,0,c[3],ft,!1,v1,!1,z);if(a&&"declutter"===w&&a.collides(s.declutterBox))break t;r.push([t,e,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]-mt,v=lt*l.height-dt;const s=this.calculateImageOrLabelDimensions_(l.width,l.height,c[0],c[1],l.width,l.height,y,v,0,0,c[3],ft,!1,v1,!1,z);if(a&&"declutter"===w&&a.collides(s.declutterBox))break t;r.push([t,e,l,s,1,null,null])}a&&"none"!==w&&a.load(r.map(l3));for(let t=0,e=r.length;t<e;++t)this.replayImageOrLabel_.apply(this,r[t])}}++d;break;case 7:if(void 0!==s){z=n[1];const t=s(z,U,w);if(t)return t}++d;break;case 8:F?I++:this.fill_(t),++d;break;case 9:let Ct,St,kt;if(g=n[1],f=n[2],b=n[3],b){const t=(n[4]??!1)||Math.abs(c[g]-c[f-2])<1e-6&&Math.abs(c[g+1]-c[f-1])<1e-6;J2(c,g,f,2,b,t,m),t3(m,2,t),Ct=m,St=0,kt=Ct.length}else Ct=c,St=g,kt=f;D=Ct[St],j=Ct[St+1],t.moveTo(D,j),_=D+.5|0,x=j+.5|0;for(let e=St+2;e<kt;e+=2)D=Ct[e],j=Ct[e+1],C=D+.5|0,S=j+.5|0,e!=kt-2&&C===_&&S===x||(t.lineTo(D,j),_=C,x=S);++d;break;case 10:this.alignAndScaleFill_=n[2],I?(this.fill_(t),I=0,P&&(t.stroke(),P=0)):P&&n[1]&&(t.stroke(),P=0),t.fillStyle=n[1],++d;break;case F2:I&&n[1]&&(this.fill_(t),I=0),P&&(t.stroke(),P=0),this.setStrokeStyle_(t,n),++d;break;case 12:F?P++:t.stroke(),++d;break;default:++d}}I&&this.fill_(t),P&&t.stroke()}execute(t,e,n,r,i,s){this.viewRotation_=r,this.execute_(t,e,n,this.instructions,i,void 0,void 0,s)}executeHitDetection(t,e,n,r,i){return this.viewRotation_=n,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,r,i)}},f3=["Polygon","Circle","LineString","Image","Text","Default"],g3=["Image","Text"],m3=f3.filter(t=>!g3.includes(t)),y3=!1,v3=!1,b3=class{constructor(t,e,n,r,i,s,o){this.maxExtent_=t,this.overlaps_=r,this.pixelRatio_=n,this.resolution_=e,this.renderBuffer_=s,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=dY(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(i,o)}clip(t,e){const n=this.getClipCoords(e);t.beginPath(),t.moveTo(n[0],n[1]),t.lineTo(n[2],n[3]),t.lineTo(n[4],n[5]),t.lineTo(n[6],n[7]),t.clip()}createExecutors_(t,e){for(const n in t){let r=this.executorsByZIndex_[n];void 0===r&&(r={},this.executorsByZIndex_[n]=r);const i=t[n];for(const t in i){const n=i[t];r[t]=new p3(this.resolution_,this.pixelRatio_,this.overlaps_,n,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const n=this.executorsByZIndex_[e];for(let e=0,r=t.length;e<r;++e)if(t[e]in n)return!0}return!1}forEachFeatureAtCoordinate(t,e,n,r,i,s){!1===v3&&function(){let t=0;const e=e=>{const n=MX(1,1,null,{willReadFrequently:e});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 t=r>t?r:t,r};y3={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0}[t],v3=!0}();const o=2*(r=Math.round(r))+1,a=vY(this.hitDetectionTransform_,r+.5,r+.5,1/e,-1/e,-n,-t[0],-t[1]),l=!this.hitDetectionContext_;l&&(this.hitDetectionContext_=MX(o,o,null,{willReadFrequently:y3}));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],wZ(u,t),aZ(u,e*(this.renderBuffer_+r),u));const h=function(t){if(void 0!==w3[t])return w3[t];const e=2*t+1,n=t*t,r=new Array(n+1);for(let s=0;s<=t;++s)for(let i=0;i<=t;++i){const o=s*s+i*i;if(o>n)break;let a=r[o];a||(a=[],r[o]=a),a.push(4*((t+s)*e+(t+i))+3),s>0&&a.push(4*((t-s)*e+(t+i))+3),i>0&&(a.push(4*((t+s)*e+(t-i))+3),s>0&&a.push(4*((t-s)*e+(t-i))+3))}const i=[];for(let s=0,o=r.length;s<o;++s)r[s]&&i.push(...r[s]);return w3[t]=i,i}(r);let d;function p(t,e,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(t)){const n=(h[l]-3)/4,s=r-n%o,a=r-(n/o|0),c=i(t,e,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(tG),g=f.length-1;g>=0;--g){const t=f[g].toString();for(y=this.executorsByZIndex_[t],m=f3.length-1;m>=0;--m)if(d=f3[m],v=y[d],void 0!==v&&(b=v.executeHitDetection(c,a,n,p,u),b))return b}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const n=e[0],r=e[1],i=e[2],s=e[3],o=[n,r,n,s,i,s,i,r];return xY(o,0,8,2,t,o),o}isEmpty(){return $H(this.executorsByZIndex_)}execute(t,e,n,r,i,s,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(o?eG:tG),s=s||f3;const l=f3.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():t,d=this.maxExtent_&&"Image"!==u&&"Text"!==u;if(d&&(h.save(),this.clip(h,n)),s&&"Text"!==u&&"Image"!==u?s.pushFunction(t=>p.execute(t,e,n,r,i,o)):p.execute(h,e,n,r,i,o),d&&h.restore(),s){s.offset();const t=a[c]*l+f3.indexOf(u);this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(s)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(tG);for(let n=0,r=e.length;n<r;++n)t[e[n]].forEach(t=>{t.draw(this.renderedContext_),t.clear()}),t[e[n]].length=0}},w3={},_3=class extends N2{constructor(t,e,n,r,i,s,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=n,this.transform_=r,this.transformRotation_=r?tZ(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_=dY()}drawImages_(t,e,n,r){if(!this.image_)return;const i=xY(t,e,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 t=i[c]-this.imageAnchorX_,e=i[c+1]-this.imageAnchorY_;if(0!==l||1!=this.imageScale_[0]||1!=this.imageScale_[1]){const n=t+this.imageAnchorX_,r=e+this.imageAnchorY_;vY(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_,t,e,this.imageWidth_,this.imageHeight_)}1!=this.imageOpacity_&&(s.globalAlpha=a)}drawText_(t,e,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=xY(t,e,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_);e<n;e+=r){const t=i[e]+this.textOffsetX_,n=i[e+1]+this.textOffsetY_;0!==o||1!=this.textScale_[0]||1!=this.textScale_[1]?(s.save(),s.translate(t-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_,t,n),this.textFillState_&&s.fillText(this.text_,t,n))}}moveToLineTo_(t,e,n,r,i,s){const o=this.context_;let a=xY(t,e,n,r,this.transform_,this.pixelCoordinates_);if(Math.abs(s)>0){const t=a.length,e=i||Math.abs(a[0]-a[t-2])<1e-6&&Math.abs(a[1]-a[t-1])<1e-6;a=J2(a,0,t,2,s,e,a),t3(a,2,e)}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_(t,e,n,r,i){for(let s=0,o=n.length;s<o;++s)e=this.moveToLineTo_(t,e,n[s],r,!0,i);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),zZ(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=function(t,e,n){const r=t.getFlatCoordinates();if(!r)return null;const i=t.getStride();return xY(r,0,r.length,i,e,n)}(t,this.transform_,this.pixelCoordinates_),n=e[2]-e[0],r=e[3]-e[1],i=Math.sqrt(n*n+r*r),s=this.context_;s.beginPath(),s.arc(e[0],e[1],i,0,2*Math.PI),this.fillState_&&s.fill(),this.strokeState_&&s.stroke()}""!==this.text_&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t)}}drawFeature(t,e){const n=e.getGeometryFunction()(t);n&&(this.setStyle(e),this.drawGeometry(n))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let n=0,r=e.length;n<r;++n)this.drawGeometry(e[n])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),n=t.getStride();this.image_&&this.drawImages_(e,0,e.length,n),""!==this.text_&&this.drawText_(e,0,e.length,n)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),n=t.getStride();this.image_&&this.drawImages_(e,0,e.length,n),""!==this.text_&&this.drawText_(e,0,e.length,n)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),zZ(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,n=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(n,0,n.length,t.getStride(),!1,this.strokeState_.strokeOffset),e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if(zZ(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,n=t.getFlatCoordinates();let r=0;const i=t.getEnds(),s=t.getStride();e.beginPath();for(let t=0,o=i.length;t<o;++t)r=this.moveToLineTo_(n,r,i[t],s,!1,this.strokeState_.strokeOffset);e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoints();this.drawText_(e,0,e.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),zZ(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),zZ(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,n=t.getOrientedFlatCoordinates();let r=0;const i=t.getEndss(),s=t.getStride();e.beginPath();for(let t=0,o=i.length;t<o;++t){const e=i[t];r=this.drawRings_(n,r,e,s,this.strokeState_?.strokeOffset)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,n=this.contextFillState_;n?n.fillStyle!=t.fillStyle&&(n.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,n=this.contextStrokeState_;n?(n.lineCap!=t.lineCap&&(n.lineCap=t.lineCap,e.lineCap=t.lineCap),sG(n.lineDash,t.lineDash)||e.setLineDash(n.lineDash=t.lineDash),n.lineDashOffset!=t.lineDashOffset&&(n.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),n.lineJoin!=t.lineJoin&&(n.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),n.lineWidth!=t.lineWidth&&(n.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),n.miterLimit!=t.miterLimit&&(n.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),n.strokeStyle!=t.strokeStyle&&(n.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,n=this.contextTextState_,r=t.textAlign?t.textAlign:y1;n?(n.font!=t.font&&(n.font=t.font,e.font=t.font),n.textAlign!=r&&(n.textAlign=r,e.textAlign=r),n.textBaseline!=t.textBaseline&&(n.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=r,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:r,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(t){const e=t.getColor();this.fillState_={fillStyle:u1(e||d1)}}else this.fillState_=null;if(e){const t=e.getColor(),n=e.getLineCap(),r=e.getLineDash(),i=e.getLineDashOffset(),s=e.getLineJoin(),o=e.getWidth(),a=e.getMiterLimit(),l=r||f1,c=e.getOffset();this.strokeState_={lineCap:void 0!==n?n:p1,lineDash:1===this.pixelRatio_?l:l.map(t=>t*this.pixelRatio_),lineDashOffset:(i||0)*this.pixelRatio_,lineJoin:void 0!==s?s:g1,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:u1(t||m1),strokeOffset:(c??0)*this.pixelRatio_}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);const n=t.getPixelRatio(this.pixelRatio_),r=t.getAnchor(),i=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*n,this.imageAnchorY_=r[1]*n,this.imageHeight_=e[1]*n,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=i[0],this.imageOriginY_=i[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const s=t.getScaleArray();this.imageScale_=[s[0]*this.pixelRatio_/n,s[1]*this.pixelRatio_/n],this.imageWidth_=e[0]*n}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:u1(t||d1)}}else this.textFillState_=null;const n=t.getStroke();if(n){const t=n.getColor(),e=n.getLineCap(),r=n.getLineDash(),i=n.getLineDashOffset(),s=n.getLineJoin(),o=n.getWidth(),a=n.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:p1,lineDash:r||f1,lineDashOffset:i||0,lineJoin:void 0!==s?s:g1,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:u1(t||m1)}}else this.textStrokeState_=null;const r=t.getFont(),i=t.getOffsetX(),s=t.getOffsetY(),o=t.getRotateWithView(),a=t.getRotation(),l=t.getScaleArray(),c=t.getText(),u=t.getTextAlign(),h=t.getTextBaseline();this.textState_={font:void 0!==r?r:"10px sans-serif",textAlign:void 0!==u?u:y1,textBaseline:void 0!==h?h:"middle"},this.text_=void 0!==c?Array.isArray(c)?c.reduce((t,e,n)=>t+(n%2?" ":e),""):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_=""}},x3=.5;function C3(t,e,n,r,i,s,o,a,l){const c=i,u=MX(t[0]*x3,t[1]*x3);u.imageSmoothingEnabled=!1;const h=u.canvas,d=new _3(u,x3,i,null,o,a,l?nY(null,l):null),p=n.length,f=Math.floor(16777215/p),g={};for(let y=1;y<=p;++y){const t=n[y-1],e=t.getStyleFunction()||r;if(!e)continue;let i=e(t,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 e=i[n],r=e.getGeometryFunction()(t);if(!r||!zZ(c,r.getExtent()))continue;const s=e.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=e.getImage();if(u){const t=u.getImageSize();if(!t)continue;const e=MX(t[0],t[1],void 0,{alpha:!1}),n=e.canvas;e.fillStyle=o,e.fillRect(0,0,n.width,n.height),s.setImage(new O1({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 t=r.getGeometriesArrayRecursive();for(let e=0,n=t.length;e<n;++e){const n=t[e];d[n.getType().replace("Multi","")].push(n,s)}}else d[p.replace("Multi","")].push(r,s)}}const m=Object.keys(g).map(Number).sort(tG);for(let y=0,v=m.length;y<v;++y){const t=g[m[y]];for(const n in t){const r=t[n];for(let t=0,n=r.length;t<n;t+=2){d.setStyle(r[t+1]);for(let n=0,i=e.length;n<i;++n)d.setTransform(e[n]),d.drawGeometry(r[t])}}}return u.getImageData(0,0,h.width,h.height)}function S3(t,e,n){const r=[];if(n){const i=Math.floor(Math.round(t[0])*x3),s=Math.floor(Math.round(t[1])*x3),o=4*(GG(i,0,n.width-1)+GG(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/e.length);c&&c%u===0&&r.push(e[c/u-1])}return r}var k3={Point:function(t,e,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=t.getBuilder(n.getZIndex(),"Image");s.setImageStyle(o,c),s.drawPoint(e,r,i)}if(l){const s=t.getBuilder(n.getZIndex(),"Text");s.setTextStyle(a,c),s.drawText(e,r,i)}},LineString:function(t,e,n,r,i){const s=n.getStroke();if(s){const o=t.getBuilder(n.getZIndex(),"LineString");o.setFillStrokeStyle(null,s),o.drawLineString(e,r,i)}const o=n.getText();if(o&&o.getText()){const s=t.getBuilder(n.getZIndex(),"Text");s.setTextStyle(o),s.drawText(e,r,i)}},Polygon:function(t,e,n,r,i){const s=n.getFill(),o=n.getStroke();if(s||o){const a=t.getBuilder(n.getZIndex(),"Polygon");a.setFillStrokeStyle(s,o),a.drawPolygon(e,r,i)}const a=n.getText();if(a&&a.getText()){const s=t.getBuilder(n.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,r,i)}},MultiPoint:function(t,e,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=t.getBuilder(n.getZIndex(),"Image");s.setImageStyle(o,u),s.drawMultiPoint(e,r,i)}if(c){const s=t.getBuilder(n.getZIndex(),"Text");s.setTextStyle(l,u),s.drawText(e,r,i)}},MultiLineString:function(t,e,n,r,i){const s=n.getStroke();if(s){const o=t.getBuilder(n.getZIndex(),"LineString");o.setFillStrokeStyle(null,s),o.drawMultiLineString(e,r,i)}const o=n.getText();if(o&&o.getText()){const s=t.getBuilder(n.getZIndex(),"Text");s.setTextStyle(o),s.drawText(e,r,i)}},MultiPolygon:function(t,e,n,r,i){const s=n.getFill(),o=n.getStroke();if(o||s){const a=t.getBuilder(n.getZIndex(),"Polygon");a.setFillStrokeStyle(s,o),a.drawMultiPolygon(e,r,i)}const a=n.getText();if(a&&a.getText()){const s=t.getBuilder(n.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,r,i)}},GeometryCollection:function(t,e,n,r,i,s){const o=e.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a)(0,k3[o[a].getType()])(t,o[a],n,r,i,s)},Circle:function(t,e,n,r,i){const s=n.getFill(),o=n.getStroke();if(s||o){const a=t.getBuilder(n.getZIndex(),"Circle");a.setFillStrokeStyle(s,o),a.drawCircle(e,r,i)}const a=n.getText();if(a&&a.getText()){const s=t.getBuilder(n.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,r,i)}}};function E3(t,e){return parseInt(mG(t),10)-parseInt(mG(e),10)}function R3(t,e){const n=T3(t,e);return n*n}function T3(t,e){return.5*t/e}function L3(t,e,n,r,i,s,o,a){const l=[],c=n.getImage();if(c){let t=!0;const e=c.getImageState();2==e||3==e?t=!1:0==e&&c.load(),t&&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(t,e,n,r,i,s,o){const a=n.getGeometryFunction()(e);if(!a)return;const l=a.simplifyTransformed(r,i);n.getRenderer()?I3(t,l,n,e,o):(0,k3[l.getType()])(t,l,n,e,o,s)}(t,e,n,r,s,o,a),h}function I3(t,e,n,r,i){if("GeometryCollection"==e.getType()){const s=e.getGeometries();for(let e=0,o=s.length;e<o;++e)I3(t,s[e],n,r,i);return}t.getBuilder(n.getZIndex(),"Default").drawCustom(e,r,n.getRenderer(),n.getHitDetectionRenderer(),i)}var P3=class extends pG{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=5,this.renderedSourceKey_}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}updateStaleKeys(t){this.renderedSourceKey_?this.renderedSourceKey_!==t&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=t):this.renderedSourceKey_=t}getFeatures(t){return fG()}getData(t){return null}prepareFrame(t){return fG()}renderFrame(t,e){return fG()}forEachFeatureAtCoordinate(t,e,n,r,i){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;2!==e.getState()&&3!==e.getState()||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return 2!=e&&3!=e&&t.addEventListener(HH,this.boundHandleImageChange_),0==e&&(t.load(),e=t.getState()),2==e}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}},M3=[],A3=null,O3=class extends P3{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=dY(),this.pixelTransform=dY(),this.inversePixelTransform=dY(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,n){let r;A3||(A3=MX(1,1,void 0,{willReadFrequently:!0})),A3.clearRect(0,0,1,1);try{A3.drawImage(t,e,n,1,1,0,0,1,1),r=A3.getImageData(0,0,1,1).data}catch{return A3=null,null}return r}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,n,r,i){if(UX(t)&&0===this.pixelTransform[1]&&0===this.pixelTransform[2]&&0===this.pixelTransform[4]&&0===this.pixelTransform[5]&&t.width===r&&t.height===i){const e=t,r=e.getContext("2d");if(r)return this.container=t,this.context=r,this.containerReused=!0,void(n&&(r.fillStyle=n,r.fillRect(0,0,e.width,e.height)))}const s=this.getLayer().getClassName();let o,a;if(t&&t.className===s&&(!n||t&&t.style.backgroundColor&&sG(TQ(t.style.backgroundColor),TQ(n)))){const e=t.firstElementChild;UX(e)&&(a=e.getContext("2d"))}if(a&&function(t,e){const n=_Y(t),r=_Y(e);for(let i=0;i<6;++i)if(0!==Math.round((n[i]-r[i])*wY[i]))return!1;return!0}(a.canvas.style.transform,e)?(this.container=t,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=LG?jX():document.createElement("div"),o.className=s;let t=o.style;t.position="absolute",t.width="100%",t.height="100%",a=MX();const e=a.canvas;o.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=o,this.context=a}this.containerReused||!n||this.container.style.backgroundColor||(this.container.style.backgroundColor=n)}clipUnrotated(t,e,n){const r=OZ(n),i=NZ(n),s=EZ(n),o=kZ(n);mY(e.coordinateToPixelTransform,r),mY(e.coordinateToPixelTransform,i),mY(e.coordinateToPixelTransform,s),mY(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;mY(a,r),mY(a,i),mY(a,s),mY(a,o),t.save(),t.beginPath(),t.moveTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(i[0]),Math.round(i[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}prepareContainer(t,e){const n=t.extent,r=t.viewState.resolution,i=t.viewState.rotation,s=t.pixelRatio,o=Math.round(FZ(n)/r*s),a=Math.round(PZ(n)/r*s);vY(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/s,1/s,i,-o/2,-a/2),bY(this.inversePixelTransform,this.pixelTransform);const l="matrix("+this.pixelTransform.join(", ")+")",c=this.getBackground(t);if(this.useContainer(e,l,c,o,a),!this.containerReused){const t=this.context.canvas;t.width!=o||t.height!=a?(t.width=o,t.height=a):this.context.clearRect(0,0,o,a),l!==t.style.transform&&(t.style.transform=l)}}dispatchRenderEvent_(t,e,n){const r=this.getLayer();if(r.hasListener(t)){const i=new p2(t,this.inversePixelTransform,n,e);r.dispatchEvent(i)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(UJ,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(BJ,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new n3),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(UJ,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(BJ,this.context,t))}getRenderTransform(t,e,n,r,i,s,o){const a=i/2,l=s/2,c=r/e,u=-c,h=-t[0]+o,d=-t[1];return vY(this.tempTransform,a,l,c,u,-n,h,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}},N3=class extends O3{constructor(t){super(t),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(t,e,n){const r=e.extent,i=e.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=e.pixelRatio,p=e.viewHints,f=!(p[0]||p[1]),g=this.context,m=Math.round(FZ(r)/o*d),y=Math.round(PZ(r)/o*d),v=u.getWrapX()&&a.canWrapX(),b=v?FZ(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);e.declutter&&(r=r.slice(0)),t.execute(g,[g.canvas.width,g.canvas.height],r,l,f,void 0===n?f3:n?g3:m3,n?h&&e.declutter[h]:void 0)}while(++_<w)}setDrawContext_(){1!==this.opacity_&&(this.targetContext_=this.context,this.context=MX(this.context.canvas.width,this.context.canvas.height,M3))}resetDrawContext_(){if(1!==this.opacity_&&this.targetContext_){const t=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=t,OX(this.context),M3.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){this.replayGroup_&&this.getLayer().getDeclutter()&&this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,t,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(t,e){const n=t.layerStatesArray[t.layerIndex];this.opacity_=n.opacity;const r=t.viewState;this.prepareContainer(t,e);const i=this.context,s=this.replayGroup_;let o=s&&!s.isEmpty();if(!o&&!this.getLayer().hasListener(UJ)&&!this.getLayer().hasListener(BJ))return this.container;this.setDrawContext_(),this.preRender(i,t),r.projection,this.clipExtent_=null;let a=!1;if(o&&n.extent&&this.clipping){const e=n.extent;o=zZ(e,t.extent),o&&!hZ(e,t.extent)&&(t.declutter?this.clipExtent_=e:(this.clipUnrotated(i,t,e),a=!0))}return o&&this.renderWorlds(s,t,!this.getLayer().getDeclutter()&&void 0),a&&i.restore(),this.postRender(i,t),this.renderedRotation_!==r.rotation&&(this.renderedRotation_=r.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=this.frameState.size.slice(),e=this.renderedCenter_,n=this.renderedResolution_,r=this.renderedRotation_,i=this.renderedProjection_,s=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],l=t[0]*x3,c=t[1]*x3;a.push(this.getRenderTransform(e,n,r,x3,l,c,0).slice());const u=o.getSource(),h=i.getExtent();if(u.getWrapX()&&i.canWrapX()&&!hZ(h,s)){let t=s[0];const i=FZ(h);let o,u=0;for(;t<h[0];)--u,o=i*u,a.push(this.getRenderTransform(e,n,r,x3,l,c,o).slice()),t+=i;for(u=0,t=s[2];t>h[2];)++u,o=i*u,a.push(this.getRenderTransform(e,n,r,x3,l,c,o).slice()),t-=i}const d=null;this.hitDetectionImageData_=C3(t,a,this.renderedFeatures_,o.getStyleFunction(),s,n,r,R3(n,this.renderedPixelRatio_),d?i:null)}e(S3(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,n,r,i){if(!this.replayGroup_)return;const s=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),l={},c=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,s,o,n,function(t,e,n){const s=mG(t),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(t,a,e);o.geometry=e,o.distanceSq=n}}else{if(0===n)return l[s]=!0,r(t,a,e);i.push(l[s]={feature:t,layer:a,geometry:e,distanceSq:n,callback:r})}},c?e.declutter?.[c]?.all().map(t=>t.value):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),n=e.getSource();if(!n)return!1;const r=t.viewHints[0],i=t.viewHints[1],s=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!s&&r||!o&&i)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,l=t.viewState,c=l.projection,u=l.resolution,h=t.pixelRatio,d=e.getRevision(),p=e.getRenderBuffer();let f=e.getRenderOrder();void 0===f&&(f=E3);const g=l.center.slice(),m=aZ(a,p*u),y=m.slice(),v=[m.slice()],b=c.getExtent(),w=n.getWrapX()&&c.canWrapX();if(this.extendX_=!1,w){const t=n.getExtent();t&&!DZ(t)&&(this.extendX_=t[0]<b[0]||t[2]>b[2])}if(w&&(!hZ(b,t.extent)||this.extendX_)){const t=FZ(b),e=Math.max(FZ(m)/2,t);let n=b[0],r=b[2];this.extendX_&&(n-=t,r+=t),m[0]=n-e,m[2]=r+e,WZ(g,c);const i=UZ(v[0],c);i[0]<b[0]&&i[2]<b[2]?v.push([i[0]+t,i[1],i[2]+t,i[3]]):i[0]>b[0]&&i[2]>b[2]&&v.push([i[0]-t,i[1],i[2]-t,i[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedPixelRatio_===h&&this.renderedRevision_==d&&this.renderedRenderOrder_==f&&this.renderedFrameDeclutter_===!!t.declutter&&hZ(this.wrappedRenderedExtent_,m))return sG(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=g,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const _=new X2(T3(u,h),m,u,h);for(let L=0,I=v.length;L<I;++L)n.loadFeatures(v[L],u,c);const x=R3(u,h);let C=!0;const S=(t,n)=>{let r;const i=t.getStyleFunction()||e.getStyleFunction();if(i&&(r=i(t,u)),r){const e=this.renderFeature(t,x,r,_,undefined,this.getLayer().getDeclutter(),n);C=C&&!e}},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 b3(m,u,h,n.getOverlaps(),R,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=u,this.renderedRevision_=d,this.renderedRenderOrder_=f,this.renderedFrameDeclutter_=!!t.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(t,e,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=L3(r,t,n[l],e,this.boundHandleStyleImageChange_,i,s,o)||a;else a=L3(r,t,n,e,this.boundHandleStyleImageChange_,i,s,o);return a}},F3=class extends d2{constructor(t){super(t)}createRenderer(){return new N3(this)}};function z3(t,e,n,r,i,s,o){const a=new XMLHttpRequest;a.open("GET","function"==typeof t?t(n,r,i):t,!0),"arraybuffer"==e.getType()&&(a.responseType="arraybuffer"),a.withCredentials=!1,a.onload=function(){if(!a.status||a.status>=200&&a.status<300){const t=e.getType();try{let r;"text"==t||"json"==t?r=a.responseText:"xml"==t?r=a.responseXML||a.responseText:"arraybuffer"==t&&(r=a.response),r?s(e.readFeatures(r,{extent:n,featureProjection:i}),e.readProjection(r)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function D3(t,e){return function(n,r,i,s,o){z3(t,e,n,r,i,t=>{this.addFeatures(t),void 0!==s&&s(t)},()=>{this.changed(),void 0!==o&&o()})}}function j3(){return[[-1/0,-1/0,1/0,1/0]]}function U3(t){return[t]}var B3=dY(),$3=class t{constructor(t,e,n,r,i,s){this.styleFunction,this.extent_,this.id_=s,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=n||null,this.properties_=i,this.squaredTolerance_,this.stride_=r,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_="Point"===this.type_?mZ(this.flatCoordinates_):yZ(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=RZ(this.getExtent());this.flatInteriorPoints_=rX(this.flatCoordinates_,0,this.ends_,this.stride_,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=hX(this.flatCoordinates_,this.ends_),e=A2(this.flatCoordinates_,0,t,this.stride_);this.flatInteriorPoints_=iX(this.flatCoordinates_,0,t,this.stride_,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=R2(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const n=this.ends_;for(let r=0,i=n.length;r<i;++r){const i=n[r],s=R2(t,e,i,this.stride_,.5);iG(this.flatMidpoints_,s),e=i}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,e){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){const e=(t=KK(t)).getExtent(),n=t.getWorldExtent();if(e&&n){const t=PZ(n)/PZ(e);vY(B3,n[0],n[3],t,-t,0,0,0),xY(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,B3,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new t(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=cG((e,n)=>{if(e===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=YY(r,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,r,0),i=[r.length];break;case"MultiLineString":i=[],r.length=XY(r,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,r,0,i);break;case"Polygon":i=[],r.length=tX(r,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(e),r,0,i)}return i&&(this.simplifiedGeometry_=new t(this.type_,r,i,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=e,this.simplifiedGeometry_}),this}};$3.prototype.getFlatCoordinates=$3.prototype.getOrientedFlatCoordinates;var q3=class{constructor(t){this.rbush_=new KJ(t),this.items_={}}insert(t,e){const n={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(n),this.items_[mG(e)]=n}load(t,e){const n=new Array(e.length);for(let r=0,i=e.length;r<i;r++){const i=t[r],s=e[r],o={minX:i[0],minY:i[1],maxX:i[2],maxY:i[3],value:s};n[r]=o,this.items_[mG(s)]=o}this.rbush_.load(n)}remove(t){const e=mG(t),n=this.items_[e];return delete this.items_[e],null!==this.rbush_.remove(n)}update(t,e){const n=this.items_[mG(e)];vZ([n.minX,n.minY,n.maxX,n.maxY],t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map(function(t){return t.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let n;for(let r=0,i=t.length;r<i;r++)if(n=e(t[r]),n)return n;return n}isEmpty(){return $H(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return fZ(e.minX,e.minY,e.maxX,e.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(const e in t.items_)this.items_[e]=t.items_[e]}},V3=class extends vG{constructor(t){super(),this.projection=KK(t.projection),this.attributions_=W3(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible??!0,this.loading=!1,this.state_=void 0!==t.state?t.state:"ready",this.wrapX_=void 0!==t.wrapX&&t.wrapX,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise(function(t,n){e.viewResolver=t,e.viewRejector=n})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}ready(){const t=this.getState();return"ready"===t?Promise.resolve():"error"===t?Promise.reject(new Error("Source failed to load")):new Promise((t,e)=>{const n=()=>{const r=this.getState();"ready"===r?(this.un("change",n),t()):"error"===r&&(this.un("change",n),e(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(t){this.attributions_=W3(t),this.changed()}setState(t){this.state_=t,this.changed()}};function W3(t){return t?"function"==typeof t?t:(Array.isArray(t)||(t=[t]),()=>t):null}var H3="addfeature",G3="removefeature",Z3=class extends hG{constructor(t,e,n){super(t),this.feature=e,this.features=n}},K3=class extends V3{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===t.wrapX||t.wrapX}),this.on,this.once,this.un,this.loader_=lG,this.format_=t.format||null,this.overlaps_=void 0===t.overlaps||t.overlaps,this.url_=t.url,void 0!==t.loader?this.loader_=t.loader:void 0!==this.url_&&($G(this.format_,"`format` must be set when `url` is set"),this.loader_=D3(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:j3;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let n,r;this.featuresRtree_=e?new q3:null,this.loadedExtentsRtree_=new q3,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,Array.isArray(t.features)?r=t.features:t.features&&(n=t.features,r=n.getArray()),e||void 0!==n||(n=new _G(r)),void 0!==r&&this.addFeaturesInternal(r),void 0!==n&&this.bindFeaturesCollection_(n)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=mG(t);if(!this.addToIndex_(e,t))return void(this.featuresCollection_&&this.featuresCollection_.remove(t));this.setupChangeEvents_(e,t);const n=t.getGeometry();if(n){const e=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(e,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new Z3(H3,t))}setupChangeEvents_(t,e){e instanceof $3||(this.featureChangeKeys_[t]=[qH(e,HH,this.handleFeatureChange_,this),qH(e,UH,this.handleFeatureChange_,this)])}addToIndex_(t,e){let n=!0;if(void 0!==e.getId()){const t=String(e.getId());if(t in this.idIndex_)if(e instanceof $3){const r=this.idIndex_[t];r instanceof $3?Array.isArray(r)?r.push(e):this.idIndex_[t]=[r,e]:n=!1}else n=!1;else this.idIndex_[t]=e}return n&&($G(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),n}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],n=[],r=[];for(let i=0,s=t.length;i<s;i++){const e=t[i],r=mG(e);this.addToIndex_(r,e)&&n.push(e)}for(let i=0,s=n.length;i<s;i++){const t=n[i],s=mG(t);this.setupChangeEvents_(s,t);const o=t.getGeometry();if(o){const n=o.getExtent();e.push(n),r.push(t)}else this.nullGeometryFeatures_[s]=t}if(this.featuresRtree_&&this.featuresRtree_.load(e,r),this.hasListener(H3))for(let i=0,s=n.length;i<s;i++)this.dispatchEvent(new Z3(H3,n[i]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(H3,function(n){e||(e=!0,t.push(n.feature),e=!1)}),this.addEventListener(G3,function(n){e||(e=!0,t.remove(n.feature),e=!1)}),t.addEventListener(DH,t=>{e||(e=!0,this.addFeature(t.element),e=!1)}),t.addEventListener(jH,t=>{e||(e=!0,this.removeFeature(t.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const t in this.featureChangeKeys_)this.featureChangeKeys_[t].forEach(WH);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(t=>{this.removeFeatureInternal(t)});for(const t in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[t])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new Z3("clear");this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const n=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(n,function(n){const r=n.getGeometry();if(r instanceof $3||r.intersectsCoordinate(t))return e(n)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(n){const r=n.getGeometry();if(r instanceof $3||r.intersectsExtent(t)){const t=e(n);if(t)return t}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),$H(this.nullGeometryFeatures_)||iG(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(t){e.push(t)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const n=BZ(t,e);return[].concat(...n.map(t=>this.featuresRtree_.getInExtent(t)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const n=t[0],r=t[1];let i=null;const s=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];return e=e||oG,this.featuresRtree_.forEachInExtent(a,function(t){if(e(t)){const e=t.getGeometry(),l=o;if(o=e instanceof $3?0:e.closestPointXY(n,r,s,o),o<l){i=t;const e=Math.sqrt(o);a[0]=n-e,a[1]=r-e,a[2]=n+e,a[3]=r+e}}}),i}getExtent(t){return this.featuresRtree_?.getExtent(t)??null}getFeatureById(t){const e=this.idIndex_[t.toString()];return void 0!==e?e:null}getFeatureByUid(t){const e=this.uidIndex_[t];return void 0!==e?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){const e=t.target,n=mG(e),r=e.getGeometry();if(r){const t=r.getExtent();n in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[n],this.featuresRtree_&&this.featuresRtree_.insert(t,e)):this.featuresRtree_&&this.featuresRtree_.update(t,e)}else n in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[n]=e);const i=e.getId();if(void 0!==i){const t=i.toString();this.idIndex_[t]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[t]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[n]=e;this.changed(),this.dispatchEvent(new Z3("changefeature",e))}hasFeature(t){const e=t.getId();if(void 0!==e){const n=this.idIndex_[String(e)];return Array.isArray(n)?n.includes(t):n===t}return mG(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&$H(this.nullGeometryFeatures_):!this.featuresCollection_||0===this.featuresCollection_.getLength()}loadFeatures(t,e,n){const r=this.loadedExtentsRtree_,i=this.strategy_(t,e,n);for(let s=0,o=i.length;s<o;++s){const t=i[s];if(!r.forEachInExtent(t,function(e){return hZ(e.extent,t)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Z3("featuresloadstart"));const i=t=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Z3("featuresloadend",void 0,t))},s=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Z3("featuresloaderror"))};let o=!1;const a=this.loader_.call(this,t,e,n,t=>o||i(t),()=>o||s());a instanceof Promise?(o=!0,a.then(t=>{this.addFeatures(t),i(t)}).catch(s)):this.loader_.length<4&&(this.loading=!1),r.insert(t,{extent:t.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_,n=[];e.forEachInExtent(t,function(t){n.push(t)}),n.forEach(n=>{e.remove(n);const r=AZ(n.extent,t);for(const t of r)e.insert(t,{extent:t})})}removeFeatures(t){let e=!1;for(let n=0,r=t.length;n<r;++n)e=this.removeFeatureInternal(t[n])||e;e&&this.changed()}removeFeature(t){t&&this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=mG(t);if(!(e in this.uidIndex_))return!1;e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.featureChangeKeys_[e]?.forEach(WH),delete this.featureChangeKeys_[e];const n=t.getId();if(void 0!==n){const e=n.toString(),r=this.idIndex_[e];r===t?delete this.idIndex_[e]:Array.isArray(r)&&(r.splice(r.indexOf(t),1),1===r.length&&(this.idIndex_[e]=r[0]))}return delete this.uidIndex_[e],this.hasListener(G3)&&this.dispatchEvent(new Z3(G3,t)),!0}removeFromIdIndex_(t){for(const e in this.idIndex_)if(this.idIndex_[e]===t){delete this.idIndex_[e];break}}setLoader(t){this.loader_=t}setUrl(t){$G(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(D3(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}},Y3=class t extends EY{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(WH),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let e=0,n=t.length;e<n;++e)this.changeEventsKeys_.push(qH(t[e],HH,this.changed,this))}clone(){const e=new t(X3(this.geometries_));return e.applyProperties(this),e}closestPointXY(t,e,n,r){if(r<cZ(this.getExtent(),t,e))return r;const i=this.geometries_;for(let s=0,o=i.length;s<o;++s)r=i[s].closestPointXY(t,e,n,r);return r}containsXY(t,e){const n=this.geometries_;for(let r=0,i=n.length;r<i;++r)if(n[r].containsXY(t,e))return!0;return!1}computeExtent(t){gZ(t);const e=this.geometries_;for(let n=0,r=e.length;n<r;++n)bZ(t,e[n].getExtent());return t}getGeometries(){return X3(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let t=[];const e=this.geometries_;for(let n=0,r=e.length;n<r;++n)e[n].getType()===this.getType()?t=t.concat(e[n].getGeometriesArrayRecursive()):t.push(e[n]);return t}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 n=[],r=this.geometries_;let i=!1;for(let t=0,s=r.length;t<s;++t){const s=r[t],o=s.getSimplifiedGeometry(e);n.push(o),o!==s&&(i=!0)}return i?new t(n):(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getType(){return"GeometryCollection"}intersectsExtent(t){const e=this.geometries_;for(let n=0,r=e.length;n<r;++n)if(e[n].intersectsExtent(t))return!0;return!1}isEmpty(){return 0===this.geometries_.length}rotate(t,e){const n=this.geometries_;for(let r=0,i=n.length;r<i;++r)n[r].rotate(t,e);this.changed()}scale(t,e,n){n||(n=RZ(this.getExtent()));const r=this.geometries_;for(let i=0,s=r.length;i<s;++i)r[i].scale(t,e,n);this.changed()}setGeometries(t){this.setGeometriesArray(X3(t))}setGeometriesArray(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()}applyTransform(t){const e=this.geometries_;for(let n=0,r=e.length;n<r;++n)e[n].applyTransform(t);this.changed()}translate(t,e){const n=this.geometries_;for(let r=0,i=n.length;r<i;++r)n[r].translate(t,e);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}};function X3(t){return t.map(t=>t.clone())}var J3=class{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=E2,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let n=e.dataProjection?KK(e.dataProjection):this.readProjection(t);e.extent&&n&&"tile-pixels"===n.getUnits()&&(n=KK(n),n.setWorldExtent(e.extent)),e={dataProjection:n,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return fG()}readFeature(t,e){return fG()}readFeatures(t,e){return fG()}readGeometry(t,e){return fG()}readProjection(t){return fG()}writeFeature(t,e){return fG()}writeFeatures(t,e){return fG()}writeGeometry(t,e){return fG()}};function Q3(t,e,n){const r=n?KK(n.featureProjection):null,i=n?KK(n.dataProjection):null;let s=t;if(r&&i&&!eY(r,i)){e&&(s=t.clone());const n=e?r:i,o=e?i:r;"tile-pixels"===n.getUnits()?s.transform(n,o):s.applyTransform(iY(n,o))}if(e&&n&&void 0!==n.decimals){const e=Math.pow(10,n.decimals),r=function(t){for(let n=0,r=t.length;n<r;++n)t[n]=Math.round(t[n]*e)/e;return t};s===t&&(s=t.clone()),s.applyTransform(r)}return s}var t5={Point:nX,LineString:I2,Polygon:dX,MultiPoint:M2,MultiLineString:P2,MultiPolygon:O2};function e5(t,e){const n=t.geometry;if(!n)return[];if(Array.isArray(n))return n.map(e=>e5({...t,geometry:e})).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 Q3(new $3(r,"Polygon"===r?function(t,e,n){return Array.isArray(e[0])?(lX(t,0,e,n)||uX(t=t.slice(),0,e,n),t):(aX(t,0,e,n)||cX(t=t.slice(),0,e,n),t)}(n.flatCoordinates,n.ends,i):n.flatCoordinates,n.ends?.flat(),i,t.properties||{},t.id).enableSimplifyTransformed(),!1,e)}function n5(t,e){if(!t)return null;if(Array.isArray(t)){const n=t.map(t=>n5(t,e));return new Y3(n)}return Q3(new(0,t5[t.type])(t.flatCoordinates,t.layout||"XY",t.ends),!1,e)}var r5=class extends J3{constructor(){super()}getType(){return"json"}readFeature(t,e){return this.readFeatureFromObject(i5(t),this.getReadOptions(t,e))}readFeatures(t,e){return this.readFeaturesFromObject(i5(t),this.getReadOptions(t,e))}readFeatureFromObject(t,e){return fG()}readFeaturesFromObject(t,e){return fG()}readGeometry(t,e){return this.readGeometryFromObject(i5(t),this.getReadOptions(t,e))}readGeometryFromObject(t,e){return fG()}readProjection(t){return this.readProjectionFromObject(i5(t))}readProjectionFromObject(t){return fG()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return fG()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return fG()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return fG()}};function i5(t){return"string"==typeof t?JSON.parse(t)||null:null!==t?t:null}var s5=class extends r5{constructor(t){t=t||{},super(),this.dataProjection=KK(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=KK(t.featureProjection)),t.featureClass&&(this.featureClass=t.featureClass),this.geometryName_=t.geometryName,this.extractGeometryName_=t.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(t,e){let n=null;n="Feature"===t.type?t:{type:"Feature",geometry:t,properties:null};const r=o5(n.geometry);if(this.featureClass===$3)return e5({geometry:r,id:n.id,properties:n.properties},e);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(n5(r,e)),"id"in n&&i.setId(n.id),n.properties&&i.setProperties(n.properties,!0),i}readFeaturesFromObject(t,e){let n=null;if("FeatureCollection"===t.type){n=[];const r=t.features;for(let t=0,i=r.length;t<i;++t){const i=this.readFeatureFromObject(r[t],e);i&&n.push(i)}}else n=[this.readFeatureFromObject(t,e)];return n.flat()}readGeometryFromObject(t,e){return function(t,e){return n5(o5(t),e)}(t,e)}readProjectionFromObject(t){const e=t.crs;let n;if(e)if("name"==e.type)n=KK(e.properties.name);else{if("EPSG"!==e.type)throw new Error("Unknown SRS type");n=KK("EPSG:"+e.properties.code)}else n=this.dataProjection;return n}writeFeatureObject(t,e){e=this.adaptOptions(e);const n={type:"Feature",geometry:null,properties:null},r=t.getId();if(void 0!==r&&(n.id=r),!t.hasProperties())return n;const i=t.getProperties(),s=t.getGeometry();return s&&(n.geometry=a5(s,e),delete i[t.getGeometryName()]),$H(i)||(n.properties=i),n}writeFeaturesObject(t,e){e=this.adaptOptions(e);const n=[];for(let r=0,i=t.length;r<i;++r)n.push(this.writeFeatureObject(t[r],e));return{type:"FeatureCollection",features:n}}writeGeometryObject(t,e){return a5(t,this.adaptOptions(e))}};function o5(t){if(!t)return null;let e;switch(t.type){case"Point":e=function(t){const e=t.coordinates;return{type:"Point",flatCoordinates:e,layout:TY(e.length)}}(t);break;case"LineString":e=function(t){const e=t.coordinates,n=e.flat();return{type:"LineString",flatCoordinates:n,ends:[n.length],layout:TY(e[0]?.length||2)}}(t);break;case"Polygon":e=function(t){const e=t.coordinates,n=[],r=e[0]?.[0]?.length;return{type:"Polygon",flatCoordinates:n,ends:DY(n,0,e,r),layout:TY(r)}}(t);break;case"MultiPoint":e=function(t){const e=t.coordinates;return{type:"MultiPoint",flatCoordinates:e.flat(),layout:TY(e[0]?.length||2)}}(t);break;case"MultiLineString":e=function(t){const e=t.coordinates,n=e[0]?.[0]?.length||2,r=[];return{type:"MultiLineString",flatCoordinates:r,ends:DY(r,0,e,n),layout:TY(n)}}(t);break;case"MultiPolygon":e=function(t){const e=t.coordinates,n=[],r=e[0]?.[0]?.[0].length||2;return{type:"MultiPolygon",flatCoordinates:n,ends:jY(n,0,e,r),layout:TY(r)}}(t);break;case"GeometryCollection":e=function(t){return t.geometries.map(function(t){return o5(t)})}(t);break;default:throw new Error("Unsupported GeoJSON type: "+t.type)}return e}function a5(t,e){const n=(t=Q3(t,!0,e)).getType();let r;switch(n){case"Point":r=function(t){return{type:"Point",coordinates:t.getCoordinates()}}(t);break;case"LineString":r=function(t){return{type:"LineString",coordinates:t.getCoordinates()}}(t);break;case"Polygon":r=function(t,e){let n;return e&&(n=e.rightHanded),{type:"Polygon",coordinates:t.getCoordinates(n)}}(t,e);break;case"MultiPoint":r=function(t){return{type:"MultiPoint",coordinates:t.getCoordinates()}}(t);break;case"MultiLineString":r=function(t){return{type:"MultiLineString",coordinates:t.getCoordinates()}}(t);break;case"MultiPolygon":r=function(t,e){let n;return e&&(n=e.rightHanded),{type:"MultiPolygon",coordinates:t.getCoordinates(n)}}(t,e);break;case"GeometryCollection":r=function(t,e){return delete(e=Object.assign({},e)).featureProjection,{type:"GeometryCollection",geometries:t.getGeometriesArray().map(function(t){return a5(t,e)})}}(t,e);break;case"Circle":r={type:"GeometryCollection",geometries:[]};break;default:throw new Error("Unsupported geometry type: "+n)}return r}var l5="accuracy",c5="accuracyGeometry",u5="altitude",h5="altitudeAccuracy",d5="heading",p5="position",f5="projection",g5="speed",m5="tracking",y5="trackingOptions",v5=class extends hG{constructor(t){super("error"),this.code=t.code,this.message=t.message}},b5=class extends vG{constructor(t){super(),this.on,this.once,this.un,t=t||{},this.position_=null,this.transform_=GK,this.watchId_=void 0,this.addChangeListener(f5,this.handleProjectionChanged_),this.addChangeListener(m5,this.handleTrackingChanged_),void 0!==t.projection&&this.setProjection(t.projection),void 0!==t.trackingOptions&&this.setTrackingOptions(t.trackingOptions),this.setTracking(void 0!==t.tracking&&t.tracking)}disposeInternal(){this.setTracking(!1),super.disposeInternal()}handleProjectionChanged_(){const t=this.getProjection();t&&(this.transform_=nY(KK("EPSG:4326"),t),this.position_&&this.set(p5,this.transform_(this.position_)))}handleTrackingChanged_(){if("geolocation"in navigator){const t=this.getTracking();t&&void 0===this.watchId_?this.watchId_=navigator.geolocation.watchPosition(this.positionChange_.bind(this),this.positionError_.bind(this),this.getTrackingOptions()):t||void 0===this.watchId_||(navigator.geolocation.clearWatch(this.watchId_),this.watchId_=void 0)}}positionChange_(t){const e=t.coords;this.set(l5,e.accuracy),this.set(u5,null===e.altitude?void 0:e.altitude),this.set(h5,null===e.altitudeAccuracy?void 0:e.altitudeAccuracy),this.set(d5,null===e.heading?void 0:XG(e.heading)),this.position_?(this.position_[0]=e.longitude,this.position_[1]=e.latitude):this.position_=[e.longitude,e.latitude];const n=this.transform_(this.position_);this.set(p5,n.slice()),this.set(g5,null===e.speed?void 0:e.speed);const r=function(t,e,n){n=n||32;const r=[];for(let i=0;i<n;++i)iG(r,XZ(t,e,2*Math.PI*i/n,void 0));return r.push(r[0],r[1]),new dX(r,"XY",[r.length])}(this.position_,e.accuracy);r.applyTransform(this.transform_),this.set(c5,r),this.changed()}positionError_(t){this.dispatchEvent(new v5(t))}getAccuracy(){return this.get(l5)}getAccuracyGeometry(){return this.get(c5)||null}getAltitude(){return this.get(u5)}getAltitudeAccuracy(){return this.get(h5)}getHeading(){return this.get(d5)}getPosition(){return this.get(p5)}getProjection(){return this.get(f5)}getSpeed(){return this.get(g5)}getTracking(){return this.get(m5)}getTrackingOptions(){return this.get(y5)}setProjection(t){this.set(f5,KK(t))}setTracking(t){this.set(m5,t)}setTrackingOptions(t){this.set(y5,t)}},w5={$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"}]}}}}},_5=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function x5(t,e){const n={};for(const r in t)"ref"!==r&&(n[r]=t[r]);return _5.forEach(t=>{t in e&&(n[t]=e[t])}),n}function C5(t){t=t.slice();const e=Object.create(null);for(let n=0;n<t.length;n++)e[t[n].id]=t[n];for(let n=0;n<t.length;n++)"ref"in t[n]&&(t[n]=x5(t[n],e[t[n].ref]));return t}var S5=class{constructor(t,e,n,r){this.message=(t?`${t}: `:"")+n,r&&(this.identifier=r),null!=e&&e.__line__&&(this.line=e.__line__)}};function k5(t,...e){for(const n of e)for(const e in n)t[e]=n[e];return t}var E5=class extends Error{constructor(t,e){super(e),this.message=e,this.key=t}},R5=class t{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[n,r]of e)this.bindings[n]=r}concat(e){return new t(this,e)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}},T5={kind:"null"},L5={kind:"number"},I5={kind:"string"},P5={kind:"boolean"},M5={kind:"color"},A5={kind:"projectionDefinition"},O5={kind:"object"},N5={kind:"value"},F5={kind:"collator"},z5={kind:"formatted"},D5={kind:"padding"},j5={kind:"colorArray"},U5={kind:"numberArray"},B5={kind:"resolvedImage"},$5={kind:"variableAnchorOffsetCollection"};function q5(t,e){return{kind:"array",itemType:t,N:e}}function V5(t){if("array"===t.kind){const e=V5(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}var W5=[T5,L5,I5,P5,M5,A5,z5,O5,q5(N5),D5,U5,j5,B5,$5];function H5(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!H5(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of W5)if(!H5(t,e))return null}return`Expected ${V5(t)} but found ${V5(e)} instead.`}function G5(t,e){return e.some(e=>e.kind===t.kind)}function Z5(t,e){return e.some(e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t)}function K5(t,e){return"array"===t.kind&&"array"===e.kind?t.itemType.kind===e.itemType.kind&&"number"==typeof t.N:t.kind===e.kind}var Y5=.96422,X5=.82521,J5=4/29,Q5=6/29,t4=3*Q5*Q5,e4=Q5*Q5*Q5,n4=Math.PI/180,r4=180/Math.PI;function i4(t){return(t%=360)<0&&(t+=360),t}function s4([t,e,n,r]){let i,s;const o=a4((.2225045*(t=o4(t))+.7168786*(e=o4(e))+.0606169*(n=o4(n)))/1);t===e&&e===n?i=s=o:(i=a4((.4360747*t+.3850649*e+.1430804*n)/Y5),s=a4((.0139322*t+.0971045*e+.7141733*n)/X5));const a=116*o-16;return[a<0?0:a,500*(i-o),200*(o-s),r]}function o4(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function a4(t){return t>e4?Math.pow(t,1/3):t/t4+J5}function l4([t,e,n,r]){let i=(t+16)/116,s=isNaN(e)?i:i+e/500,o=isNaN(n)?i:i-n/200;return i=1*u4(i),s=Y5*u4(s),o=X5*u4(o),[c4(3.1338561*s-1.6168667*i-.4906146*o),c4(-.9787684*s+1.9161415*i+.033454*o),c4(.0719453*s-.2289914*i+1.4052427*o),r]}function c4(t){return(t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function u4(t){return t>Q5?t*t*t:t4*(t-J5)}var h4=Object.hasOwn||function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function d4(t,e){return h4(t,e)?t[e]:void 0}function p4(t){return parseInt(t.padEnd(2,t),16)/255}function f4(t,e){return g4(e?t/100:t,0,1)}function g4(t,e,n){return Math.min(Math.max(e,t),n)}function m4(t){return!t.some(Number.isNaN)}var y4={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 v4(t,e,n){return t+n*(e-t)}function b4(t,e,n){return t.map((t,r)=>v4(t,e[r],n))}var w4=class t{constructor(t,e,n,r=1,i=!0){this.r=t,this.g=e,this.b=n,this.a=r,i||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter("rgb",[t,e,n,r]))}static{this.black=new t(0,0,0,1)}static{this.white=new t(1,1,1,1)}static{this.transparent=new t(0,0,0,0)}static{this.red=new t(1,0,0,1)}static parse(e){if(e instanceof t)return e;if("string"!=typeof e)return;const n=function(t){if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];const e=d4(y4,t);if(e){const[t,n,r]=e;return[t/255,n/255,r/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){const e=t.length<6?1:2;let n=1;return[p4(t.slice(n,n+=e)),p4(t.slice(n,n+=e)),p4(t.slice(n,n+=e)),p4(t.slice(n,n+e)||"ff")]}if(t.startsWith("rgb")){const e=t.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(e){const[t,n,r,i,s,o,a,l,c,u,h,d]=e,p=[i||" ",a||" ",u].join("");if(" "===p||" /"===p||",,"===p||",,,"===p){const t=[r,o,c].join(""),e="%%%"===t?100:""===t?255:0;if(e){const t=[g4(+n/e,0,1),g4(+s/e,0,1),g4(+l/e,0,1),h?f4(+h,d):1];if(m4(t))return t}}return}}const n=t.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(n){const[t,e,r,i,s,o,a,l,c]=n,u=[r||" ",s||" ",a].join("");if(" "===u||" /"===u||",,"===u||",,,"===u){const t=[+e,g4(+i,0,100),g4(+o,0,100),l?f4(+l,c):1];if(m4(t))return function([t,e,n,r]){function i(r){const i=(r+t/30)%12,s=e*Math.min(n,1-n);return n-s*Math.max(-1,Math.min(i-3,9-i,1))}return t=i4(t),e/=100,n/=100,[i(0),i(8),i(4),r]}(t)}}}(e);return n?new t(...n,!1):void 0}get rgb(){const{r:t,g:e,b:n,a:r}=this,i=r||1/0;return this.overwriteGetter("rgb",[t/i,e/i,n/i,r])}get hcl(){return this.overwriteGetter("hcl",function(t){const[e,n,r,i]=s4(t),s=Math.sqrt(n*n+r*r);return[Math.round(1e4*s)?i4(Math.atan2(r,n)*r4):NaN,s,e,i]}(this.rgb))}get lab(){return this.overwriteGetter("lab",s4(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){const[t,e,n,r]=this.rgb;return`rgba(${[t,e,n].map(t=>Math.round(255*t)).join(",")},${r})`}static interpolate(e,n,r,i="rgb"){switch(i){case"rgb":{const[i,s,o,a]=b4(e.rgb,n.rgb,r);return new t(i,s,o,a,!1)}case"hcl":{const[i,s,o,a]=e.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 t=l-i;l>i&&t>180?t-=360:l<i&&i-l>180&&(t+=360),d=i+r*t}const[f,g,m,y]=function([t,e,n,r]){return t=isNaN(t)?0:t*n4,l4([n,Math.cos(t)*e,Math.sin(t)*e,r])}([d,p??v4(s,c,r),v4(o,u,r),v4(a,h,r)]);return new t(f,g,m,y,!1)}case"lab":{const[i,s,o,a]=l4(b4(e.lab,n.lab,r));return new t(i,s,o,a,!1)}}}},_4=class{constructor(t,e,n){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}},x4=["bottom","center","top"],C4=class{constructor(t,e,n,r,i,s){this.text=t,this.image=e,this.scale=n,this.fontStack=r,this.textColor=i,this.verticalAlign=s}},S4=class t{constructor(t){this.sections=t}static fromString(e){return new t([new C4(e,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(t=>0!==t.text.length||t.image&&0!==t.image.name.length)}static factory(e){return e instanceof t?e:t.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map(t=>t.text).join("")}},k4=class t{constructor(t){this.values=t.slice()}static parse(e){if(e instanceof t)return e;if("number"==typeof e)return new t([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const t of e)if("number"!=typeof t)return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,n,r){return new t(b4(e.values,n.values,r))}},E4=class t{constructor(t){this.values=t.slice()}static parse(e){if(e instanceof t)return e;if("number"==typeof e)return new t([e]);if(Array.isArray(e)){for(const t of e)if("number"!=typeof t)return;return new t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,n,r){return new t(b4(e.values,n.values,r))}},R4=class t{constructor(t){this.values=t.slice()}static parse(e){if(e instanceof t)return e;if("string"==typeof e){const n=w4.parse(e);if(!n)return;return new t([n])}if(!Array.isArray(e))return;const n=[];for(const t of e){if("string"!=typeof t)return;const e=w4.parse(t);if(!e)return;n.push(e)}return new t(n)}toString(){return JSON.stringify(this.values)}static interpolate(e,n,r,i="rgb"){const s=[];if(e.values.length!=n.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${n.values.length}), cannot interpolate.`);for(let t=0;t<e.values.length;t++)s.push(w4.interpolate(e.values[t],n.values[t],r,i));return new t(s)}},T4=class extends Error{constructor(t){super(t),this.name="RuntimeError"}toJSON(){return this.message}},L4=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),I4=class t{constructor(t){this.values=t.slice()}static parse(e){if(e instanceof t)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let t=0;t<e.length;t+=2){const n=e[t],r=e[t+1];if("string"!=typeof n||!L4.has(n))return;if(!Array.isArray(r)||2!==r.length||"number"!=typeof r[0]||"number"!=typeof r[1])return}return new t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,n,r){const i=e.values,s=n.values;if(i.length!==s.length)throw new T4(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${n.toString()}`);const o=[];for(let t=0;t<i.length;t+=2){if(i[t]!==s[t])throw new T4(`Cannot interpolate values containing mismatched anchors. from[${t}]: ${i[t]}, to[${t}]: ${s[t]}`);o.push(i[t]);const[e,n]=i[t+1],[a,l]=s[t+1];o.push([v4(e,a,r),v4(n,l,r)])}return new t(o)}},P4=class t{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(e){return e?new t({name:e,available:!1}):null}},M4=class t{constructor(t,e,n){this.from=t,this.to=e,this.transition=n}static interpolate(e,n,r){return new t(e,n,r)}static parse(e){return e instanceof t?e:Array.isArray(e)&&3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]&&"number"==typeof e[2]?new t(e[0],e[1],e[2]):"object"==typeof e&&"string"==typeof e.from&&"string"==typeof e.to&&"number"==typeof e.transition?new t(e.from,e.to,e.transition):"string"==typeof e?new t(e,e,1):void 0}};function A4(t,e,n,r){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof n&&n>=0&&n<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[t,e,n,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[t,e,n,r]:[t,e,n]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function O4(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof M4||t instanceof w4||t instanceof _4||t instanceof S4||t instanceof k4||t instanceof E4||t instanceof R4||t instanceof I4||t instanceof P4)return!0;if(Array.isArray(t)){for(const e of t)if(!O4(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!O4(t[e]))return!1;return!0}return!1}function N4(t){if(null===t)return T5;if("string"==typeof t)return I5;if("boolean"==typeof t)return P5;if("number"==typeof t)return L5;if(t instanceof w4)return M5;if(t instanceof M4)return A5;if(t instanceof _4)return F5;if(t instanceof S4)return z5;if(t instanceof k4)return D5;if(t instanceof E4)return U5;if(t instanceof R4)return j5;if(t instanceof I4)return $5;if(t instanceof P4)return B5;if(Array.isArray(t)){const e=t.length;let n;for(const r of t){const t=N4(r);if(n){if(n===t)continue;n=N5;break}n=t}return q5(n||N5,e)}return O5}function F4(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof w4||t instanceof M4||t instanceof S4||t instanceof k4||t instanceof E4||t instanceof R4||t instanceof I4||t instanceof P4?t.toString():JSON.stringify(t)}var z4=class t{constructor(t,e){this.type=t,this.value=e}static parse(e,n){if(2!==e.length)return n.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!O4(e[1]))return n.error("invalid value");const r=e[1];let i=N4(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 t(i,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},D4={string:I5,number:L5,boolean:P5,object:O5},j4=class t{constructor(t,e){this.type=t,this.args=e}static parse(e,n){if(e.length<2)return n.error("Expected at least one argument.");let r,i=1;const s=e[0];if("array"===s){let t,s;if(e.length>2){const r=e[1];if("string"!=typeof r||!(r in D4)||"object"===r)return n.error('The item type argument of "array" must be one of string, number, boolean',1);t=D4[r],i++}else t=N5;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return n.error('The length argument to "array" must be a positive integer literal',2);s=e[2],i++}r=q5(t,s)}else{if(!D4[s])throw new Error(`Types doesn't contain name = ${s}`);r=D4[s]}const o=[];for(;i<e.length;i++){const t=n.parse(e[i],i,N5);if(!t)return null;o.push(t)}return new t(r,o)}evaluate(t){for(let e=0;e<this.args.length;e++){const n=this.args[e].evaluate(t);if(!H5(this.type,N4(n)))return n;if(e===this.args.length-1)throw new T4(`Expected value to be of type ${V5(this.type)}, but found ${V5(N4(n))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}},U4={"to-boolean":P5,"to-color":M5,"to-number":L5,"to-string":I5},B4=class t{constructor(t,e){this.type=t,this.args=e}static parse(e,n){if(e.length<2)return n.error("Expected at least one argument.");const r=e[0];if(!U4[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!==e.length)return n.error("Expected one argument.");const i=U4[r],s=[];for(let t=1;t<e.length;t++){const r=n.parse(e[t],t,N5);if(!r)return null;s.push(r)}return new t(i,s)}evaluate(t){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(t));case"color":{let e,n;for(const r of this.args){if(e=r.evaluate(t),n=null,e instanceof w4)return e;if("string"==typeof e){const n=t.parseColor(e);if(n)return n}else if(Array.isArray(e)&&(n=e.length<3||e.length>4?`Invalid rgba value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:A4(e[0],e[1],e[2],e[3]),!n))return new w4(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new T4(n||`Could not parse color from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"padding":{let e;for(const n of this.args){e=n.evaluate(t);const r=k4.parse(e);if(r)return r}throw new T4(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"numberArray":{let e;for(const n of this.args){e=n.evaluate(t);const r=E4.parse(e);if(r)return r}throw new T4(`Could not parse numberArray from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"colorArray":{let e;for(const n of this.args){e=n.evaluate(t);const r=R4.parse(e);if(r)return r}throw new T4(`Could not parse colorArray from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"variableAnchorOffsetCollection":{let e;for(const n of this.args){e=n.evaluate(t);const r=I4.parse(e);if(r)return r}throw new T4(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"number":{let e=null;for(const n of this.args){if(e=n.evaluate(t),null===e)return 0;const r=Number(e);if(!isNaN(r))return r}throw new T4(`Could not convert ${JSON.stringify(e)} to number.`)}case"formatted":return S4.fromString(F4(this.args[0].evaluate(t)));case"resolvedImage":return P4.fromString(F4(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return F4(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}},$4=["Unknown","Point","LineString","Polygon"],q4=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?$4[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(t){let e=this._parseColorCache.get(t);return e||(e=w4.parse(t),this._parseColorCache.set(t,e)),e}},V4=class t{constructor(t,e,n=[],r,i=new R5,s=[]){this.registry=t,this.path=n,this.key=n.map(t=>`[${t}]`).join(""),this.scope=i,this.errors=s,this.expectedType=r,this._isConstant=e}parse(t,e,n,r,i={}){return e?this.concat(e,n,r)._parse(t,i):this._parse(t,i)}_parse(t,e){function n(t,e,n){return"assert"===n?new j4(e,[t]):"coerce"===n?new B4(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const i=t[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(t,this);if(!i)return null;if(this.expectedType){const t=this.expectedType,r=i.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==r.kind){if("projectionDefinition"===t.kind&&["string","array"].includes(r.kind)||["color","formatted","resolvedImage"].includes(t.kind)&&["value","string"].includes(r.kind)||["padding","numberArray"].includes(t.kind)&&["value","number","array"].includes(r.kind)||"colorArray"===t.kind&&["value","string","array"].includes(r.kind)||"variableAnchorOffsetCollection"===t.kind&&["value","array"].includes(r.kind))i=n(i,t,e.typeAnnotation||"coerce");else if(this.checkSubtype(t,r))return null}else i=n(i,t,e.typeAnnotation||"assert")}if(!(i instanceof z4)&&"resolvedImage"!==i.type.kind&&this._isConstant(i)){const t=new q4;try{i=new z4(i.type,i.evaluate(t))}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===t?this.error("'undefined' value invalid. Use null instead."):"object"==typeof t?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof t} instead.`)}concat(e,n,r){const i="number"==typeof e?this.path.concat(e):this.path,s=r?this.scope.concat(r):this.scope;return new t(this.registry,this._isConstant,i,n||null,s,this.errors)}error(t,...e){const n=`${this.key}${e.map(t=>`[${t}]`).join("")}`;this.errors.push(new E5(n,t))}checkSubtype(t,e){const n=H5(t,e);return n&&this.error(n),n}},W4=class t{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(e,n){if(e.length<4)return n.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const r=[];for(let t=1;t<e.length-1;t+=2){const i=e[t];if("string"!=typeof i)return n.error(`Expected string, but found ${typeof i} instead.`,t);if(/[^a-zA-Z0-9_]/.test(i))return n.error("Variable names must contain only alphanumeric characters or '_'.",t);const s=n.parse(e[t+1],t+1);if(!s)return null;r.push([i,s])}const i=n.parse(e[e.length-1],e.length-1,n.expectedType,r);return i?new t(r,i):null}outputDefined(){return this.result.outputDefined()}},H4=class t{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(e,n){if(2!==e.length||"string"!=typeof e[1])return n.error("'var' expression requires exactly one string literal argument.");const r=e[1];return n.scope.has(r)?new t(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(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}};function G4(t,e){const n=t.length-1;let r,i,s=0,o=n,a=0;for(;s<=o;)if(a=Math.floor((s+o)/2),r=t[a],i=t[a+1],r<=e){if(a===n||e<i)return a;s=a+1}else{if(!(r>e))throw new T4("Input is not a number.");o=a-1}return 0}var Z4=class t{constructor(t,e,n){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[r,i]of n)this.labels.push(r),this.outputs.push(i)}static parse(e,n){if(e.length-1<4)return n.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return n.error("Expected an even number of arguments.");const r=n.parse(e[1],1,L5);if(!r)return null;const i=[];let s=null;n.expectedType&&"value"!==n.expectedType.kind&&(s=n.expectedType);for(let t=1;t<e.length;t+=2){const r=1===t?-1/0:e[t],o=e[t+1],a=t,l=t+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 t(s,r,i)}evaluate(t){const e=this.labels,n=this.outputs;if(1===e.length)return n[0].evaluate(t);const r=this.input.evaluate(t);if(r<=e[0])return n[0].evaluate(t);const i=e.length;return r>=e[i-1]?n[i-1].evaluate(t):n[G4(e,r)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}},K4=class t{constructor(t,e,n,r,i){this.type=t,this.operator=e,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(t,e,n,r){let i=0;if("exponential"===t.name)i=Y4(e,t.base,n,r);else if("linear"===t.name)i=Y4(e,1,n,r);else if("cubic-bezier"===t.name){const s=t.controlPoints;i=function(t,e,n,r){const i=3*t,s=3*(n-t)-i,o=1-i-s,a=3*e,l=3*(r-e)-a,c=1-a-l;return function(t,e=1e-6){if(t<=0)return 0;if(t>=1)return 1;let n=t;for(let h=0;h<8;h++){const r=((o*n+s)*n+i)*n-t;if(Math.abs(r)<e)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=t;for(let a=0;a<20;a++){const a=((o*n+s)*n+i)*n;if(Math.abs(a-t)<e)break;t>a?r=n:u=n,n=.5*(r+u)}return((c*n+l)*n+a)*n}}(s[0],s[1],s[2],s[3])(Y4(e,1,n,r))}return i}static parse(e,n){let[r,i,s,...o]=e;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 t=i[1];if("number"!=typeof t)return n.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:t}}else{if("cubic-bezier"!==i[0])return n.error(`Unknown interpolation type ${String(i[0])}`,1,0);{const t=i.slice(1);if(4!==t.length||t.some(t=>"number"!=typeof t||t<0||t>1))return n.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:t}}}if(e.length-1<4)return n.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return n.error("Expected an even number of arguments.");if(s=n.parse(s,2,L5),!s)return null;const a=[];let l=null;"interpolate-hcl"!==r&&"interpolate-lab"!==r||n.expectedType==j5?n.expectedType&&"value"!==n.expectedType.kind&&(l=n.expectedType):l=M5;for(let t=0;t<o.length;t+=2){const e=o[t],r=o[t+1],i=t+3,s=t+4;if("number"!=typeof e)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]>=e)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([e,c])}return K5(l,L5)||K5(l,A5)||K5(l,M5)||K5(l,D5)||K5(l,U5)||K5(l,j5)||K5(l,$5)||K5(l,q5(L5))?new t(l,r,i,s,a):n.error(`Type ${V5(l)} is not interpolatable.`)}evaluate(e){const n=this.labels,r=this.outputs;if(1===n.length)return r[0].evaluate(e);const i=this.input.evaluate(e);if(i<=n[0])return r[0].evaluate(e);const s=n.length;if(i>=n[s-1])return r[s-1].evaluate(e);const o=G4(n,i),a=n[o],l=n[o+1],c=t.interpolationFactor(this.interpolation,i,a,l),u=r[o].evaluate(e),h=r[o+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return v4(u,h,c);case"color":return w4.interpolate(u,h,c);case"padding":return k4.interpolate(u,h,c);case"colorArray":return R4.interpolate(u,h,c);case"numberArray":return E4.interpolate(u,h,c);case"variableAnchorOffsetCollection":return I4.interpolate(u,h,c);case"array":return b4(u,h,c);case"projectionDefinition":return M4.interpolate(u,h,c)}case"interpolate-hcl":switch(this.type.kind){case"color":return w4.interpolate(u,h,c,"hcl");case"colorArray":return R4.interpolate(u,h,c,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return w4.interpolate(u,h,c,"lab");case"colorArray":return R4.interpolate(u,h,c,"lab")}}}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}};function Y4(t,e,n,r){const i=r-n,s=t-n;return 0===i?0:1===e?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}w4.interpolate,k4.interpolate,E4.interpolate,R4.interpolate,I4.interpolate;var X4=class t{constructor(t,e){this.type=t,this.args=e}static parse(e,n){if(e.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 t of e.slice(1)){const e=n.parse(t,1+s.length,r,void 0,{typeAnnotation:"omit"});if(!e)return null;r=r||e.type,s.push(e)}if(!r)throw new Error("No output type");return i&&s.some(t=>H5(i,t.type))?new t(N5,s):new t(r,s)}evaluate(t){let e,n=null,r=0;for(const i of this.args)if(r++,n=i.evaluate(t),n&&n instanceof P4&&!n.available&&(e||(e=n.name),n=null,r===this.args.length&&(n=e)),null!==n)break;return n}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}};function J4(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function Q4(t,e,n,r){return 0===r.compare(e,n)}function t6(t,e,n){const r="=="!==t&&"!="!==t;return class i{constructor(t,e,n){this.type=P5,this.lhs=t,this.rhs=e,this.collator=n,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const n=t[0];let s=e.parse(t[1],1,N5);if(!s)return null;if(!J4(n,s.type))return e.concat(1).error(`"${n}" comparisons are not supported for type '${V5(s.type)}'.`);let o=e.parse(t[2],2,N5);if(!o)return null;if(!J4(n,o.type))return e.concat(2).error(`"${n}" comparisons are not supported for type '${V5(o.type)}'.`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error(`Cannot compare types '${V5(s.type)}' and '${V5(o.type)}'.`);r&&("value"===s.type.kind&&"value"!==o.type.kind?s=new j4(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new j4(s.type,[o])));let a=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,F5),!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 e=N4(s),n=N4(o);if(e.kind!==n.kind||"string"!==e.kind&&"number"!==e.kind)throw new T4(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${n.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const t=N4(s),n=N4(o);if("string"!==t.kind||"string"!==n.kind)return e(i,s,o)}return this.collator?n(i,s,o,this.collator.evaluate(i)):e(i,s,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}var e6=t6("==",function(t,e,n){return e===n},Q4),n6=t6("!=",function(t,e,n){return e!==n},function(t,e,n,r){return!Q4(0,e,n,r)}),r6=t6("<",function(t,e,n){return e<n},function(t,e,n,r){return r.compare(e,n)<0}),i6=t6(">",function(t,e,n){return e>n},function(t,e,n,r){return r.compare(e,n)>0}),s6=t6("<=",function(t,e,n){return e<=n},function(t,e,n,r){return r.compare(e,n)<=0}),o6=t6(">=",function(t,e,n){return e>=n},function(t,e,n,r){return r.compare(e,n)>=0}),a6=class t{constructor(t,e,n){this.type=F5,this.locale=n,this.caseSensitive=t,this.diacriticSensitive=e}static parse(e,n){if(2!==e.length)return n.error("Expected one argument.");const r=e[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,P5);if(!i)return null;const s=n.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,P5);if(!s)return null;let o=null;return r.locale&&(o=n.parse(r.locale,1,I5),!o)?null:new t(i,s,o)}evaluate(t){return new _4(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}},l6=8192;function c6(t,e){const n=(180+t[0])/360,r=(i=t[1],(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360);var i;const s=Math.pow(2,e.z);return[Math.round(n*s*l6),Math.round(r*s*l6)]}function u6(t,e){const n=Math.pow(2,e.z);return[(i=(t[0]/l6+e.x)/n,360*i-180),(r=(t[1]/l6+e.y)/n,360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90)];var r,i}function h6(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function d6(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function p6(t,e,n){return e[1]>t[1]!=n[1]>t[1]&&t[0]<(n[0]-e[0])*(t[1]-e[1])/(n[1]-e[1])+e[0]}function f6(t,e,n){const r=t[0]-e[0],i=t[1]-e[1],s=t[0]-n[0],o=t[1]-n[1];return r*o-s*i===0&&r*s<=0&&i*o<=0}function g6(t,e,n,r){const i=[e[0]-t[0],e[1]-t[1]];return 0!==function(t,e){return t[0]*e[1]-t[1]*e[0]}([r[0]-n[0],r[1]-n[1]],i)&&!(!_6(t,e,n,r)||!_6(n,r,t,e))}function m6(t,e,n){for(const r of n)for(let n=0;n<r.length-1;++n)if(g6(t,e,r[n],r[n+1]))return!0;return!1}function y6(t,e,n=!1){let r=!1;for(const i of e)for(let e=0;e<i.length-1;e++){if(f6(t,i[e],i[e+1]))return n;p6(t,i[e],i[e+1])&&(r=!r)}return r}function v6(t,e){for(const n of e)if(y6(t,n))return!0;return!1}function b6(t,e){for(const n of t)if(!y6(n,e))return!1;for(let n=0;n<t.length-1;++n)if(m6(t[n],t[n+1],e))return!1;return!0}function w6(t,e){for(const n of e)if(b6(t,n))return!0;return!1}function _6(t,e,n,r){const i=t[0]-n[0],s=t[1]-n[1],o=e[0]-n[0],a=e[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 x6(t,e,n){const r=[];for(let i=0;i<t.length;i++){const s=[];for(let r=0;r<t[i].length;r++){const o=c6(t[i][r],n);h6(e,o),s.push(o)}r.push(s)}return r}function C6(t,e,n){const r=[];for(let i=0;i<t.length;i++){const s=x6(t[i],e,n);r.push(s)}return r}function S6(t,e,n,r){if(t[0]<n[0]||t[0]>n[2]){const e=.5*r;let i=t[0]-n[0]>e?-r:n[0]-t[0]>e?r:0;0===i&&(i=t[0]-n[2]>e?-r:n[2]-t[0]>e?r:0),t[0]+=i}h6(e,t)}function k6(t,e,n,r){const i=Math.pow(2,r.z)*l6,s=[r.x*l6,r.y*l6],o=[];for(const a of t)for(const t of a){const r=[t.x+s[0],t.y+s[1]];S6(r,e,n,i),o.push(r)}return o}function E6(t,e,n,r){const i=Math.pow(2,r.z)*l6,s=[r.x*l6,r.y*l6],o=[];for(const a of t){const t=[];for(const n of a){const r=[n.x+s[0],n.y+s[1]];h6(e,r),t.push(r)}o.push(t)}if(e[2]-e[0]<=i/2){!function(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}(e);for(const t of o)for(const r of t)S6(r,e,n,i)}return o}var R6=class t{constructor(t,e){this.type=P5,this.geojson=t,this.geometries=e}static parse(e,n){if(2!==e.length)return n.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(O4(e[1])){const n=e[1];if("FeatureCollection"===n.type){const e=[];for(const t of n.features){const{type:n,coordinates:r}=t.geometry;"Polygon"===n&&e.push(r),"MultiPolygon"===n&&e.push(...r)}if(e.length)return new t(n,{type:"MultiPolygon",coordinates:e})}else if("Feature"===n.type){const e=n.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new t(n,n.geometry)}else if("Polygon"===n.type||"MultiPolygon"===n.type)return new t(n,n)}return n.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const n=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if("Polygon"===e.type){const s=x6(e.coordinates,r,i),o=k6(t.geometry(),n,r,i);if(!d6(n,r))return!1;for(const t of o)if(!y6(t,s))return!1}if("MultiPolygon"===e.type){const s=C6(e.coordinates,r,i),o=k6(t.geometry(),n,r,i);if(!d6(n,r))return!1;for(const t of o)if(!v6(t,s))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const n=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if("Polygon"===e.type){const s=x6(e.coordinates,r,i),o=E6(t.geometry(),n,r,i);if(!d6(n,r))return!1;for(const t of o)if(!b6(t,s))return!1}if("MultiPolygon"===e.type){const s=C6(e.coordinates,r,i),o=E6(t.geometry(),n,r,i);if(!d6(n,r))return!1;for(const t of o)if(!w6(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},T6=class{constructor(t=[],e=(t,e)=>t<e?-1:t>e?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:n}=this,r=e[t];for(;t>0;){const i=t-1>>1,s=e[i];if(n(r,s)>=0)break;e[t]=s,t=i}e[t]=r}_down(t){const{data:e,compare:n}=this,r=this.length>>1,i=e[t];for(;t<r;){let r=1+(t<<1);const s=r+1;if(s<this.length&&n(e[s],e[r])<0&&(r=s),n(e[r],i)>=0)break;e[t]=e[r],t=r}e[t]=i}};function L6(t){let e=0;for(let n,r,i=0,s=t.length,o=s-1;i<s;o=i++)n=t[i],r=t[o],e+=(r.x-n.x)*(n.y+r.y);return e}var I6=Math.PI/180,P6=class{constructor(t){const e=6378.137*I6*1e3,n=Math.cos(t*I6),r=1/(1-.0066943799901413165*(1-n*n)),i=Math.sqrt(r);this.kx=e*i*n,this.ky=e*i*r*.9933056200098587}distance(t,e){const n=this.wrap(t[0]-e[0])*this.kx,r=(t[1]-e[1])*this.ky;return Math.sqrt(n*n+r*r)}pointOnLine(t,e){let n,r,i,s,o=1/0;for(let a=0;a<t.length-1;a++){let l=t[a][0],c=t[a][1],u=this.wrap(t[a+1][0]-l)*this.kx,h=(t[a+1][1]-c)*this.ky,d=0;0===u&&0===h||(d=(this.wrap(e[0]-l)*this.kx*u+(e[1]-c)*this.ky*h)/(u*u+h*h),d>1?(l=t[a+1][0],c=t[a+1][1]):d>0&&(l+=u/this.kx*d,c+=h/this.ky*d)),u=this.wrap(e[0]-l)*this.kx,h=(e[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(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}};function M6(t,e){return e[0]-t[0]}function A6(t){return t[1]-t[0]+1}function O6(t,e){return t[1]>=t[0]&&t[1]<e}function N6(t,e){if(t[0]>t[1])return[null,null];const n=A6(t);if(e){if(2===n)return[t,null];const e=Math.floor(n/2);return[[t[0],t[0]+e],[t[0]+e,t[1]]]}if(1===n)return[t,null];const r=Math.floor(n/2)-1;return[[t[0],t[0]+r],[t[0]+r+1,t[1]]]}function F6(t,e){if(!O6(e,t.length))return[1/0,1/0,-1/0,-1/0];const n=[1/0,1/0,-1/0,-1/0];for(let r=e[0];r<=e[1];++r)h6(n,t[r]);return n}function z6(t){const e=[1/0,1/0,-1/0,-1/0];for(const n of t)for(const t of n)h6(e,t);return e}function D6(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function j6(t,e,n){if(!D6(t)||!D6(e))return NaN;let r=0,i=0;return t[2]<e[0]&&(r=e[0]-t[2]),t[0]>e[2]&&(r=t[0]-e[2]),t[1]>e[3]&&(i=t[1]-e[3]),t[3]<e[1]&&(i=e[1]-t[3]),n.distance([0,0],[r,i])}function U6(t,e,n){const r=n.pointOnLine(e,t);return n.distance(t,r.point)}function B6(t,e,n,r,i){const s=Math.min(U6(t,[n,r],i),U6(e,[n,r],i)),o=Math.min(U6(n,[t,e],i),U6(r,[t,e],i));return Math.min(s,o)}function $6(t,e,n,r,i){if(!O6(e,t.length)||!O6(r,n.length))return 1/0;let s=1/0;for(let o=e[0];o<e[1];++o){const e=t[o],a=t[o+1];for(let t=r[0];t<r[1];++t){const r=n[t],o=n[t+1];if(g6(e,a,r,o))return 0;s=Math.min(s,B6(e,a,r,o,i))}}return s}function q6(t,e,n,r,i){if(!O6(e,t.length)||!O6(r,n.length))return NaN;let s=1/0;for(let o=e[0];o<=e[1];++o)for(let e=r[0];e<=r[1];++e)if(s=Math.min(s,i.distance(t[o],n[e])),0===s)return s;return s}function V6(t,e,n){if(y6(t,e,!0))return 0;let r=1/0;for(const i of e){const e=i[0],s=i[i.length-1];if(e!==s&&(r=Math.min(r,U6(t,[s,e],n)),0===r))return r;const o=n.pointOnLine(i,t);if(r=Math.min(r,n.distance(t,o.point)),0===r)return r}return r}function W6(t,e,n,r){if(!O6(e,t.length))return NaN;for(let s=e[0];s<=e[1];++s)if(y6(t[s],n,!0))return 0;let i=1/0;for(let s=e[0];s<e[1];++s){const e=t[s],o=t[s+1];for(const t of n)for(let n=0,s=t.length,a=s-1;n<s;a=n++){const s=t[a],l=t[n];if(g6(e,o,s,l))return 0;i=Math.min(i,B6(e,o,s,l,r))}}return i}function H6(t,e){for(const n of t)for(const t of n)if(y6(t,e,!0))return!0;return!1}function G6(t,e,n,r=1/0){const i=z6(t),s=z6(e);if(r!==1/0&&j6(i,s,n)>=r)return r;if(d6(i,s)){if(H6(t,e))return 0}else if(H6(e,t))return 0;let o=1/0;for(const a of t)for(let t=0,r=a.length,i=r-1;t<r;i=t++){const r=a[i],s=a[t];for(const t of e)for(let e=0,i=t.length,a=i-1;e<i;a=e++){const i=t[a],l=t[e];if(g6(r,s,i,l))return 0;o=Math.min(o,B6(r,s,i,l,n))}}return o}function Z6(t,e,n,r,i,s){if(!s)return;const o=j6(F6(r,s),i,n);o<e&&t.push([o,s,[0,0]])}function K6(t,e,n,r,i,s,o){if(!s||!o)return;const a=j6(F6(r,s),F6(i,o),n);a<e&&t.push([a,s,o])}function Y6(t,e,n,r,i=1/0){let s=Math.min(r.distance(t[0],n[0][0]),i);if(0===s)return s;const o=new T6([[0,[0,t.length-1],[0,0]]],M6),a=z6(n);for(;o.length>0;){const i=o.pop();if(i[0]>=s)continue;const l=i[1],c=e?50:100;if(A6(l)<=c){if(!O6(l,t.length))return NaN;if(e){const e=W6(t,l,n,r);if(isNaN(e)||0===e)return e;s=Math.min(s,e)}else for(let e=l[0];e<=l[1];++e){const i=V6(t[e],n,r);if(s=Math.min(s,i),0===s)return 0}}else{const n=N6(l,e);Z6(o,s,r,t,a,n[0]),Z6(o,s,r,t,a,n[1])}}return s}function X6(t,e,n,r,i,s=1/0){let o=Math.min(s,i.distance(t[0],n[0]));if(0===o)return o;const a=new T6([[0,[0,t.length-1],[0,n.length-1]]],M6);for(;a.length>0;){const s=a.pop();if(s[0]>=o)continue;const l=s[1],c=s[2],u=e?50:100,h=r?50:100;if(A6(l)<=u&&A6(c)<=h){if(!O6(l,t.length)&&O6(c,n.length))return NaN;let s;if(e&&r)s=$6(t,l,n,c,i),o=Math.min(o,s);else if(e&&!r){const e=t.slice(l[0],l[1]+1);for(let t=c[0];t<=c[1];++t)if(s=U6(n[t],e,i),o=Math.min(o,s),0===o)return o}else if(!e&&r){const e=n.slice(c[0],c[1]+1);for(let n=l[0];n<=l[1];++n)if(s=U6(t[n],e,i),o=Math.min(o,s),0===o)return o}else s=q6(t,l,n,c,i),o=Math.min(o,s)}else{const s=N6(l,e),u=N6(c,r);K6(a,o,i,t,n,s[0],u[0]),K6(a,o,i,t,n,s[0],u[1]),K6(a,o,i,t,n,s[1],u[0]),K6(a,o,i,t,n,s[1],u[1])}}return o}function J6(t){return"MultiPolygon"===t.type?t.coordinates.map(t=>({type:"Polygon",coordinates:t})):"MultiLineString"===t.type?t.coordinates.map(t=>({type:"LineString",coordinates:t})):"MultiPoint"===t.type?t.coordinates.map(t=>({type:"Point",coordinates:t})):[t]}var Q6=class t{constructor(t,e){this.type=L5,this.geojson=t,this.geometries=e}static parse(e,n){if(2!==e.length)return n.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(O4(e[1])){const n=e[1];if("FeatureCollection"===n.type)return new t(n,n.features.map(t=>J6(t.geometry)).flat());if("Feature"===n.type)return new t(n,J6(n.geometry));if("type"in n&&"coordinates"in n)return new t(n,J6(n))}return n.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const n=t.geometry(),r=n.flat().map(e=>u6([e.x,e.y],t.canonical));if(0===n.length)return NaN;const i=new P6(r[0][1]);let s=1/0;for(const o of e){switch(o.type){case"Point":s=Math.min(s,X6(r,!1,[o.coordinates],!1,i,s));break;case"LineString":s=Math.min(s,X6(r,!1,o.coordinates,!0,i,s));break;case"Polygon":s=Math.min(s,Y6(r,!1,o.coordinates,i,s))}if(0===s)return s}return s}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const n=t.geometry(),r=n.flat().map(e=>u6([e.x,e.y],t.canonical));if(0===n.length)return NaN;const i=new P6(r[0][1]);let s=1/0;for(const o of e){switch(o.type){case"Point":s=Math.min(s,X6(r,!0,[o.coordinates],!1,i,s));break;case"LineString":s=Math.min(s,X6(r,!0,o.coordinates,!0,i,s));break;case"Polygon":s=Math.min(s,Y6(r,!0,o.coordinates,i,s))}if(0===s)return s}return s}(t,this.geometries);if("Polygon"===t.geometryType())return function(t,e){const n=t.geometry();if(0===n.length||0===n[0].length)return NaN;const r=function(t){if(t.length<=1)return[t];const e=[];let n,r;for(const i of t){const t=L6(i);0!==t&&(i.area=Math.abs(t),void 0===r&&(r=t<0),r===t<0?(n&&e.push(n),n=[i]):n.push(i))}return n&&e.push(n),e}(n).map(e=>e.map(e=>e.map(e=>u6([e.x,e.y],t.canonical)))),i=new P6(r[0][0][0][1]);let s=1/0;for(const o of e)for(const t of r){switch(o.type){case"Point":s=Math.min(s,Y6([o.coordinates],!1,t,i,s));break;case"LineString":s=Math.min(s,Y6(o.coordinates,!0,t,i,s));break;case"Polygon":s=Math.min(s,G6(t,o.coordinates,i,s))}if(0===s)return s}return s}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},t8=class t{constructor(t){this.type=N5,this.key=t}static parse(e,n){if(2!==e.length)return n.error(`Expected 1 argument, but found ${e.length-1} instead.`);const r=e[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 e[1]} instead.`):new t(r)}evaluate(t){const e=t.globals?.globalState;return e&&0!==Object.keys(e).length?d4(e,this.key)??null:null}eachChild(){}outputDefined(){return!1}},e8={"==":e6,"!=":n6,">":i6,"<":r6,">=":o6,"<=":s6,array:j4,at:class t{constructor(t,e,n){this.type=t,this.index=e,this.input=n}static parse(e,n){if(3!==e.length)return n.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const r=n.parse(e[1],1,L5),i=n.parse(e[2],2,q5(n.expectedType||N5));if(!r||!i)return null;const s=i.type;return new t(s.itemType,r,i)}evaluate(t){const e=this.index.evaluate(t),n=this.input.evaluate(t);if(e<0)throw new T4(`Array index out of bounds: ${e} < 0.`);if(e>=n.length)throw new T4(`Array index out of bounds: ${e} > ${n.length-1}.`);if(e!==Math.floor(e))throw new T4(`Array index must be an integer, but found ${e} instead.`);return n[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}},boolean:j4,case:class t{constructor(t,e,n){this.type=t,this.branches=e,this.otherwise=n}static parse(e,n){if(e.length<4)return n.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.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 t=1;t<e.length-1;t+=2){const s=n.parse(e[t],t,P5);if(!s)return null;const o=n.parse(e[t+1],t+1,r);if(!o)return null;i.push([s,o]),r=r||o.type}const s=n.parse(e[e.length-1],e.length-1,r);if(!s)return null;if(!r)throw new Error("Can't infer output type");return new t(r,i,s)}evaluate(t){for(const[e,n]of this.branches)if(e.evaluate(t))return n.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,n]of this.branches)t(e),t(n);t(this.otherwise)}outputDefined(){return this.branches.every(([t,e])=>e.outputDefined())&&this.otherwise.outputDefined()}},coalesce:X4,collator:a6,format:class t{constructor(t){this.type=z5,this.sections=t}static parse(e,n){if(e.length<2)return n.error("Expected at least one argument.");const r=e[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 t=1;t<=e.length-1;++t){const r=e[t];if(s&&"object"==typeof r&&!Array.isArray(r)){s=!1;let t=null;if(r["font-scale"]&&(t=n.parse(r["font-scale"],1,L5),!t))return null;let e=null;if(r["text-font"]&&(e=n.parse(r["text-font"],1,q5(I5)),!e))return null;let o=null;if(r["text-color"]&&(o=n.parse(r["text-color"],1,M5),!o))return null;let a=null;if(r["vertical-align"]){if("string"==typeof r["vertical-align"]&&!x4.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,I5),!a)return null}const l=i[i.length-1];l.scale=t,l.font=e,l.textColor=o,l.verticalAlign=a}else{const r=n.parse(e[t],1,N5);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 t(i)}evaluate(t){return new S4(this.sections.map(e=>{const n=e.content.evaluate(t);return N4(n)===B5?new C4("",n,null,null,null,e.verticalAlign?e.verticalAlign.evaluate(t):null):new C4(F4(n),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null,e.verticalAlign?e.verticalAlign.evaluate(t):null)}))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor),e.verticalAlign&&t(e.verticalAlign)}outputDefined(){return!1}},image:class t{constructor(t){this.type=B5,this.input=t}static parse(e,n){if(2!==e.length)return n.error("Expected two arguments.");const r=n.parse(e[1],1,I5);return r?new t(r):n.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),n=P4.fromString(e);return n&&t.availableImages&&(n.available=t.availableImages.indexOf(e)>-1),n}eachChild(t){t(this.input)}outputDefined(){return!1}},in:class t{constructor(t,e){this.type=P5,this.needle=t,this.haystack=e}static parse(e,n){if(3!==e.length)return n.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const r=n.parse(e[1],1,N5),i=n.parse(e[2],2,N5);return r&&i?G5(r.type,[P5,I5,L5,T5,N5])?new t(r,i):n.error(`Expected first argument to be of type boolean, string, number or null, but found ${V5(r.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),n=this.haystack.evaluate(t);if(!n)return!1;if(!Z5(e,["boolean","string","number","null"]))throw new T4(`Expected first argument to be of type boolean, string, number or null, but found ${V5(N4(e))} instead.`);if(!Z5(n,["string","array"]))throw new T4(`Expected second argument to be of type array or string, but found ${V5(N4(n))} instead.`);return n.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}},"index-of":class t{constructor(t,e,n){this.type=L5,this.needle=t,this.haystack=e,this.fromIndex=n}static parse(e,n){if(e.length<=2||e.length>=5)return n.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const r=n.parse(e[1],1,N5),i=n.parse(e[2],2,N5);if(!r||!i)return null;if(!G5(r.type,[P5,I5,L5,T5,N5]))return n.error(`Expected first argument to be of type boolean, string, number or null, but found ${V5(r.type)} instead`);if(4===e.length){const s=n.parse(e[3],3,L5);return s?new t(r,i,s):null}return new t(r,i)}evaluate(t){const e=this.needle.evaluate(t),n=this.haystack.evaluate(t);if(!Z5(e,["boolean","string","number","null"]))throw new T4(`Expected first argument to be of type boolean, string, number or null, but found ${V5(N4(e))} instead.`);let r;if(this.fromIndex&&(r=this.fromIndex.evaluate(t)),Z5(n,["string"])){const t=n.indexOf(e,r);return-1===t?-1:[...n.slice(0,t)].length}if(Z5(n,["array"]))return n.indexOf(e,r);throw new T4(`Expected second argument to be of type array or string, but found ${V5(N4(n))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}},interpolate:K4,"interpolate-hcl":K4,"interpolate-lab":K4,length:class t{constructor(t){this.type=L5,this.input=t}static parse(e,n){if(2!==e.length)return n.error(`Expected 1 argument, but found ${e.length-1} instead.`);const r=n.parse(e[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 ${V5(r.type)} instead.`):new t(r):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return[...e].length;if(Array.isArray(e))return e.length;throw new T4(`Expected value to be of type string or array, but found ${V5(N4(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}},let:W4,literal:z4,match:class t{constructor(t,e,n,r,i,s){this.inputType=t,this.type=e,this.input=n,this.cases=r,this.outputs=i,this.otherwise=s}static parse(e,n){if(e.length<5)return n.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.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 t=2;t<e.length-1;t+=2){let a=e[t];const l=e[t+1];Array.isArray(a)||(a=[a]);const c=n.concat(t);if(0===a.length)return c.error("Expected at least one branch label.");for(const t of a){if("number"!=typeof t&&"string"!=typeof t)return c.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return c.error("Numeric branch labels must be integer values.");if(r){if(c.checkSubtype(r,N4(t)))return null}else r=N4(t);if(void 0!==s[String(t)])return c.error("Branch labels must be unique.");s[String(t)]=o.length}const u=n.parse(l,t,i);if(!u)return null;i=i||u.type,o.push(u)}const a=n.parse(e[1],1,N5);if(!a)return null;const l=n.parse(e[e.length-1],e.length-1,i);return l?"value"!==a.type.kind&&n.concat(1).checkSubtype(r,a.type)?null:new t(r,i,a,s,o,l):null}evaluate(t){const e=this.input.evaluate(t);return(N4(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}},number:j4,"number-format":class t{constructor(t,e,n,r,i,s){this.type=I5,this.number=t,this.locale=e,this.currency=n,this.unit=r,this.minFractionDigits=i,this.maxFractionDigits=s}static parse(e,n){if(3!==e.length)return n.error("Expected two arguments.");const r=n.parse(e[1],1,L5);if(!r)return null;const i=e[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,I5),!s))return null;let o=null;if(i.currency&&(o=n.parse(i.currency,1,I5),!o))return null;let a=null;if(i.unit&&(a=n.parse(i.unit,1,I5),!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,L5),!l))return null;let c=null;return i["max-fraction-digits"]&&(c=n.parse(i["max-fraction-digits"],1,L5),!c)?null:new t(r,s,o,a,l,c)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}},object:j4,slice:class t{constructor(t,e,n,r){this.type=t,this.input=e,this.beginIndex=n,this.endIndex=r}static parse(e,n){if(e.length<=2||e.length>=5)return n.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const r=n.parse(e[1],1,N5),i=n.parse(e[2],2,L5);if(!r||!i)return null;if(!G5(r.type,[q5(N5),I5,N5]))return n.error(`Expected first argument to be of type array or string, but found ${V5(r.type)} instead`);if(4===e.length){const s=n.parse(e[3],3,L5);return s?new t(r.type,r,i,s):null}return new t(r.type,r,i)}evaluate(t){const e=this.input.evaluate(t),n=this.beginIndex.evaluate(t);let r;if(this.endIndex&&(r=this.endIndex.evaluate(t)),Z5(e,["string"]))return[...e].slice(n,r).join("");if(Z5(e,["array"]))return e.slice(n,r);throw new T4(`Expected first argument to be of type array or string, but found ${V5(N4(e))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}},step:Z4,string:j4,"to-boolean":B4,"to-color":B4,"to-number":B4,"to-string":B4,var:H4,within:R6,distance:Q6,"global-state":t8},n8=class t{constructor(t,e,n,r){this.name=t,this.type=e,this._evaluate=n,this.args=r}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(e,n){const r=e[0],i=t.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(([t])=>!Array.isArray(t)||t.length===e.length-1);let l=null;for(const[c,u]of a){l=new V4(n.registry,a8,n.path,null,n.scope);const i=[];let o=!1;for(let t=1;t<e.length;t++){const n=e[t],r=Array.isArray(c)?c[t-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 t=0;t<i.length;t++){const e=Array.isArray(c)?c[t]:c.type,n=i[t];l.concat(t+1).checkSubtype(e,n.type)}if(0===l.errors.length)return new t(r,s,u,i)}}if(1===a.length)n.errors.push(...l.errors);else{const t=(a.length?a:o).map(([t])=>{return e=t,Array.isArray(e)?`(${e.map(V5).join(", ")})`:`(${V5(e.type)}...)`;var e}).join(" | "),r=[];for(let i=1;i<e.length;i++){const t=n.parse(e[i],1+r.length);if(!t)return null;r.push(V5(t.type))}n.error(`Expected arguments of type ${t}, but found (${r.join(", ")}) instead.`)}return null}static register(e,n){t.definitions=n;for(const r in n)e[r]=t}};function r8(t,[e,n,r,i]){e=e.evaluate(t),n=n.evaluate(t),r=r.evaluate(t);const s=i?i.evaluate(t):1,o=A4(e,n,r,s);if(o)throw new T4(o);return new w4(e/255,n/255,r/255,s,!1)}function i8(t,e){return t in e}function s8(t,e){const n=e[t];return void 0===n?null:n}function o8(t){return{type:t}}function a8(t){if(t instanceof H4)return a8(t.boundExpression);if(t instanceof n8&&"error"===t.name)return!1;if(t instanceof a6)return!1;if(t instanceof R6)return!1;if(t instanceof Q6)return!1;if(t instanceof t8)return!1;const e=t instanceof B4||t instanceof j4;let n=!0;return t.eachChild(t=>{n=e?n&&a8(t):n&&t instanceof z4}),!!n&&l8(t)&&u8(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function l8(t){if(t instanceof n8){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof R6)return!1;if(t instanceof Q6)return!1;let e=!0;return t.eachChild(t=>{e&&!l8(t)&&(e=!1)}),e}function c8(t){if(t instanceof n8&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild(t=>{e&&!c8(t)&&(e=!1)}),e}function u8(t,e){if(t instanceof n8&&e.indexOf(t.name)>=0)return!1;let n=!0;return t.eachChild(t=>{n&&!u8(t,e)&&(n=!1)}),n}function h8(t){return{result:"success",value:t}}function d8(t){return{result:"error",value:t}}function p8(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function f8(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function g8(t){return!!t.expression&&t.expression.interpolated}function m8(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function y8(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)&&N4(t)===O5}n8.register(e8,{error:[{kind:"error"},[I5],(t,[e])=>{throw new T4(e.evaluate(t))}],typeof:[I5,[N5],(t,[e])=>V5(N4(e.evaluate(t)))],"to-rgba":[q5(L5,4),[M5],(t,[e])=>{const[n,r,i,s]=e.evaluate(t).rgb;return[255*n,255*r,255*i,s]}],rgb:[M5,[L5,L5,L5],r8],rgba:[M5,[L5,L5,L5,L5],r8],has:{type:P5,overloads:[[[I5],(t,[e])=>i8(e.evaluate(t),t.properties())],[[I5,O5],(t,[e,n])=>i8(e.evaluate(t),n.evaluate(t))]]},get:{type:N5,overloads:[[[I5],(t,[e])=>s8(e.evaluate(t),t.properties())],[[I5,O5],(t,[e,n])=>s8(e.evaluate(t),n.evaluate(t))]]},"feature-state":[N5,[I5],(t,[e])=>s8(e.evaluate(t),t.featureState||{})],properties:[O5,[],t=>t.properties()],"geometry-type":[I5,[],t=>t.geometryType()],id:[N5,[],t=>t.id()],zoom:[L5,[],t=>t.globals.zoom],"heatmap-density":[L5,[],t=>t.globals.heatmapDensity||0],elevation:[L5,[],t=>t.globals.elevation||0],"line-progress":[L5,[],t=>t.globals.lineProgress||0],accumulated:[N5,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[L5,o8(L5),(t,e)=>{let n=0;for(const r of e)n+=r.evaluate(t);return n}],"*":[L5,o8(L5),(t,e)=>{let n=1;for(const r of e)n*=r.evaluate(t);return n}],"-":{type:L5,overloads:[[[L5,L5],(t,[e,n])=>e.evaluate(t)-n.evaluate(t)],[[L5],(t,[e])=>-e.evaluate(t)]]},"/":[L5,[L5,L5],(t,[e,n])=>e.evaluate(t)/n.evaluate(t)],"%":[L5,[L5,L5],(t,[e,n])=>e.evaluate(t)%n.evaluate(t)],ln2:[L5,[],()=>Math.LN2],pi:[L5,[],()=>Math.PI],e:[L5,[],()=>Math.E],"^":[L5,[L5,L5],(t,[e,n])=>Math.pow(e.evaluate(t),n.evaluate(t))],sqrt:[L5,[L5],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[L5,[L5],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[L5,[L5],(t,[e])=>Math.log(e.evaluate(t))],log2:[L5,[L5],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[L5,[L5],(t,[e])=>Math.sin(e.evaluate(t))],cos:[L5,[L5],(t,[e])=>Math.cos(e.evaluate(t))],tan:[L5,[L5],(t,[e])=>Math.tan(e.evaluate(t))],asin:[L5,[L5],(t,[e])=>Math.asin(e.evaluate(t))],acos:[L5,[L5],(t,[e])=>Math.acos(e.evaluate(t))],atan:[L5,[L5],(t,[e])=>Math.atan(e.evaluate(t))],min:[L5,o8(L5),(t,e)=>Math.min(...e.map(e=>e.evaluate(t)))],max:[L5,o8(L5),(t,e)=>Math.max(...e.map(e=>e.evaluate(t)))],abs:[L5,[L5],(t,[e])=>Math.abs(e.evaluate(t))],round:[L5,[L5],(t,[e])=>{const n=e.evaluate(t);return n<0?-Math.round(-n):Math.round(n)}],floor:[L5,[L5],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[L5,[L5],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[P5,[I5,N5],(t,[e,n])=>t.properties()[e.value]===n.value],"filter-id-==":[P5,[N5],(t,[e])=>t.id()===e.value],"filter-type-==":[P5,[I5],(t,[e])=>t.geometryType()===e.value],"filter-<":[P5,[I5,N5],(t,[e,n])=>{const r=t.properties()[e.value],i=n.value;return typeof r==typeof i&&r<i}],"filter-id-<":[P5,[N5],(t,[e])=>{const n=t.id(),r=e.value;return typeof n==typeof r&&n<r}],"filter->":[P5,[I5,N5],(t,[e,n])=>{const r=t.properties()[e.value],i=n.value;return typeof r==typeof i&&r>i}],"filter-id->":[P5,[N5],(t,[e])=>{const n=t.id(),r=e.value;return typeof n==typeof r&&n>r}],"filter-<=":[P5,[I5,N5],(t,[e,n])=>{const r=t.properties()[e.value],i=n.value;return typeof r==typeof i&&r<=i}],"filter-id-<=":[P5,[N5],(t,[e])=>{const n=t.id(),r=e.value;return typeof n==typeof r&&n<=r}],"filter->=":[P5,[I5,N5],(t,[e,n])=>{const r=t.properties()[e.value],i=n.value;return typeof r==typeof i&&r>=i}],"filter-id->=":[P5,[N5],(t,[e])=>{const n=t.id(),r=e.value;return typeof n==typeof r&&n>=r}],"filter-has":[P5,[N5],(t,[e])=>e.value in t.properties()],"filter-has-id":[P5,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[P5,[q5(I5)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[P5,[q5(N5)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[P5,[I5,q5(N5)],(t,[e,n])=>n.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[P5,[I5,q5(N5)],(t,[e,n])=>function(t,e,n,r){for(;n<=r;){const i=n+r>>1;if(e[i]===t)return!0;e[i]>t?r=i-1:n=i+1}return!1}(t.properties()[e.value],n.value,0,n.value.length-1)],all:{type:P5,overloads:[[[P5,P5],(t,[e,n])=>e.evaluate(t)&&n.evaluate(t)],[o8(P5),(t,e)=>{for(const n of e)if(!n.evaluate(t))return!1;return!0}]]},any:{type:P5,overloads:[[[P5,P5],(t,[e,n])=>e.evaluate(t)||n.evaluate(t)],[o8(P5),(t,e)=>{for(const n of e)if(n.evaluate(t))return!0;return!1}]]},"!":[P5,[P5],(t,[e])=>!e.evaluate(t)],"is-supported-script":[P5,[I5],(t,[e])=>{const n=t.globals&&t.globals.isSupportedScript;return!n||n(e.evaluate(t))}],upcase:[I5,[I5],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[I5,[I5],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[I5,o8(N5),(t,e)=>e.map(e=>F4(e.evaluate(t))).join("")],split:[q5(I5),[I5,I5],(t,[e,n])=>e.evaluate(t).split(n.evaluate(t))],join:[I5,[q5(I5),I5],(t,[e,n])=>e.evaluate(t).join(n.evaluate(t))],"resolved-locale":[I5,[F5],(t,[e])=>e.evaluate(t).resolvedLocale()]});var v8=class{constructor(t,e,n){this.expression=t,this._warningHistory={},this._evaluator=new q4,this._defaultValue=e?function(t){if("color"===t.type&&y8(t.default))return new w4(0,0,0,0);switch(t.type){case"color":return w4.parse(t.default)||null;case"padding":return k4.parse(t.default)||null;case"numberArray":return E4.parse(t.default)||null;case"colorArray":return R4.parse(t.default)||null;case"variableAnchorOffsetCollection":return I4.parse(t.default)||null;case"projectionDefinition":return M4.parse(t.default)||null;default:return void 0===t.default?null:t.default}}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null,this._globalState=n}evaluateWithoutErrorHandling(t,e,n,r,i,s){return this._globalState&&(t=E8(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=n,this._evaluator.canonical=r,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s,this.expression.evaluate(this._evaluator)}evaluate(t,e,n,r,i,s){this._globalState&&(t=E8(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=n||null,this._evaluator.canonical=r,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new T4(`Expected value to be one of ${Object.keys(this._enumValues).map(t=>JSON.stringify(t)).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(o){return this._warningHistory[o.message]||(this._warningHistory[o.message]=!0,"undefined"!=typeof console&&console.warn(o.message)),this._defaultValue}}};function b8(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in e8}function w8(t,e,n){const r=new V4(e8,a8,[],e?function(t){const e={color:M5,string:I5,number:L5,enum:I5,boolean:P5,formatted:z5,padding:D5,numberArray:U5,colorArray:j5,projectionDefinition:A5,resolvedImage:B5,variableAnchorOffsetCollection:$5};return"array"===t.type?q5(e[t.value]||N5,t.length):e[t.type]}(e):void 0),i=r.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return i?h8(new v8(i,e,n)):d8(r.errors)}var _8=class{constructor(t,e,n){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!c8(e.expression),this.globalStateRefs=k8(e.expression),this._globalState=n}evaluateWithoutErrorHandling(t,e,n,r,i,s){return this._globalState&&(t=E8(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,n,r,i,s)}evaluate(t,e,n,r,i,s){return this._globalState&&(t=E8(t,this._globalState)),this._styleExpression.evaluate(t,e,n,r,i,s)}},x8=class{constructor(t,e,n,r,i){this.kind=t,this.zoomStops=n,this._styleExpression=e,this.isStateDependent="camera"!==t&&!c8(e.expression),this.globalStateRefs=k8(e.expression),this.interpolationType=r,this._globalState=i}evaluateWithoutErrorHandling(t,e,n,r,i,s){return this._globalState&&(t=E8(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,n,r,i,s)}evaluate(t,e,n,r,i,s){return this._globalState&&(t=E8(t,this._globalState)),this._styleExpression.evaluate(t,e,n,r,i,s)}interpolationFactor(t,e,n){return this.interpolationType?K4.interpolationFactor(this.interpolationType,t,e,n):0}};function C8(t,e,n){const r=w8(t,e,n);if("error"===r.result)return r;const i=r.value.expression,s=l8(i);if(!s&&!p8(e))return d8([new E5("","data expressions not supported")]);const o=u8(i,["zoom"]);if(!o&&!f8(e))return d8([new E5("","zoom expressions not supported")]);const a=S8(i);if(!a&&!o)return d8([new E5("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof E5)return d8([a]);if(a instanceof K4&&!g8(e))return d8([new E5("",'"interpolate" expressions cannot be used with this property')]);if(!a)return h8(new _8(s?"constant":"source",r.value,n));const l=a instanceof K4?a.interpolation:void 0;return h8(new x8(s?"camera":"composite",r.value,a.labels,l,n))}function S8(t){let e=null;if(t instanceof W4)e=S8(t.result);else if(t instanceof X4){for(const n of t.args)if(e=S8(n),e)break}else(t instanceof Z4||t instanceof K4)&&t.input instanceof n8&&"zoom"===t.input.name&&(e=t);return e instanceof E5||t.eachChild(t=>{const n=S8(t);n instanceof E5?e=n:!e&&n?e=new E5("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&n&&e!==n&&(e=new E5("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function k8(t,e=new Set){return t instanceof t8&&e.add(t.key),t.eachChild(t=>{k8(t,e)}),e}function E8(t,e){const{zoom:n,heatmapDensity:r,elevation:i,lineProgress:s,isSupportedScript:o,accumulated:a}=t??{};return{zoom:n,heatmapDensity:r,elevation:i,lineProgress:s,isSupportedScript:o,accumulated:a,globalState:e}}function R8(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!R8(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}var T8={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function L8(t,e){return t<e?-1:t>e?1:0}function I8(t){if(!Array.isArray(t))return!1;if("within"===t[0]||"distance"===t[0])return!0;for(let e=1;e<t.length;e++)if(I8(t[e]))return!0;return!1}function P8(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?M8(t[1],t[2],"=="):"!="===e?N8(M8(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?M8(t[1],t[2],e):"any"===e?(n=t.slice(1),["any"].concat(n.map(P8))):"all"===e?["all"].concat(t.slice(1).map(P8)):"none"===e?["all"].concat(t.slice(1).map(P8).map(N8)):"in"===e?A8(t[1],t.slice(2)):"!in"===e?N8(A8(t[1],t.slice(2))):"has"===e?O8(t[1]):"!has"!==e||N8(O8(t[1]));var n}function M8(t,e,n){switch(t){case"$type":return[`filter-type-${n}`,e];case"$id":return[`filter-id-${n}`,e];default:return[`filter-${n}`,t,e]}}function A8(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",t,["literal",e.sort(L8)]]:["filter-in-small",t,["literal",e]]}}function O8(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function N8(t){return["!",t]}function F8(t){return"object"==typeof t?["literal",t]:t}function z8(t,e){let n=t.stops;if(!n)return function(t,e){const n=["get",t.property];if(void 0===t.default)return"string"===e.type?["string",n]:n;if("enum"===e.type)return["match",n,Object.keys(e.values),n,t.default];{const r=["color"===e.type?"to-color":e.type,n,F8(t.default)];return"array"===e.type&&r.splice(1,0,e.value,e.length||null),r}}(t,e);const r=n&&"object"==typeof n[0][0],i=r||void 0!==t.property,s=r||!i;return n=n.map(t=>!i&&e.tokens&&"string"==typeof t[1]?[t[0],V8(t[1])]:[t[0],F8(t[1])]),r?function(t,e,n){const r={},i={},s=[];for(let o=0;o<n.length;o++){const e=n[o],a=e[0].zoom;void 0===r[a]&&(r[a]={zoom:a,type:t.type,property:t.property,default:t.default},i[a]=[],s.push(a)),i[a].push([e[0].value,e[1]])}if("exponential"===q8({},e)){const n=[D8(t),["linear"],["zoom"]];for(const t of s)$8(n,t,U8(r[t],e,i[t]),!1);return n}{const t=["step",["zoom"]];for(const n of s)$8(t,n,U8(r[n],e,i[n]),!0);return B8(t),t}}(t,e,n):s?function(t,e,n,r=["zoom"]){const i=q8(t,e);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 e=void 0!==t.base?t.base:1;s=[D8(t),1===e?["linear"]:["exponential",e],r]}}for(const a of n)$8(s,a[0],a[1],o);return B8(s),s}(t,e,n):U8(t,e,n)}function D8(t){switch(t.colorSpace){case"hcl":return"interpolate-hcl";case"lab":return"interpolate-lab";default:return"interpolate"}}function j8(t,e){const n=F8((r=t.default,i=e.default,void 0!==r?r:void 0!==i?i:void 0));var r,i;return void 0===n&&"resolvedImage"===e.type?"":n}function U8(t,e,n){const r=q8(t,e),i=["get",t.property];if("categorical"===r&&"boolean"==typeof n[0][0]){const r=["case"];for(const t of n)r.push(["==",i,t[0]],t[1]);return r.push(j8(t,e)),r}if("categorical"===r){const r=["match",i];for(const t of n)$8(r,t[0],t[1],!1);return r.push(j8(t,e)),r}if("interval"===r){const e=["step",["number",i]];for(const t of n)$8(e,t[0],t[1],!0);return B8(e),void 0===t.default?e:["case",["==",["typeof",i],"number"],e,F8(t.default)]}if("exponential"===r){const e=void 0!==t.base?t.base:1,r=[D8(t),1===e?["linear"]:["exponential",e],["number",i]];for(const t of n)$8(r,t[0],t[1],!1);return void 0===t.default?r:["case",["==",["typeof",i],"number"],r,F8(t.default)]}throw new Error(`Unknown property function type ${r}`)}function B8(t){"step"===t[0]&&3===t.length&&(t.push(0),t.push(t[3]))}function $8(t,e,n,r){t.length>3&&e===t[t.length-2]||(r&&2===t.length||t.push(e),t.push(n))}function q8(t,e){return t.type?t.type:e.expression.interpolated?"exponential":"interval"}function V8(t){const e=["concat"],n=/{([^{}]+)}/g;let r=0;for(let i=n.exec(t);null!==i;i=n.exec(t)){const s=t.slice(r,n.lastIndex-i[0].length);r=n.lastIndex,s.length>0&&e.push(s),e.push(["get",i[1]])}if(1===e.length)return t;if(r<t.length)e.push(t.slice(r));else if(2===e.length)return["to-string",e[1]];return e}function W8(t){const e=t.key,n=t.value;return n?[new S5(e,n,"constants have been deprecated as of v8")]:[]}function H8(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function G8(t){if(Array.isArray(t))return t.map(G8);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const n in t)e[n]=G8(t[n]);return e}return H8(t)}function Z8(t){const e=t.key,n=t.value,r=t.valueSpec||{},i=t.objectElementValidators||{},s=t.style,o=t.styleSpec,a=t.validateSpec;let l=[];const c=m8(n);if("object"!==c)return[new S5(e,n,`object expected, ${c} found`)];for(const u in n){const t=u.split(".")[0],c=d4(r,t)||r["*"];let h;if(d4(i,t))h=i[t];else if(d4(r,t)){if(void 0===n[u])continue;h=a}else if(i["*"])h=i["*"];else{if(!r["*"]){l.push(new S5(e,n[u],`unknown property "${u}"`));continue}h=a}l=l.concat(h({key:(e?`${e}.`:e)+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 S5(e,n,`missing required property "${u}"`));return l}function K8(t){const e=t.value,n=t.valueSpec,r=t.validateSpec,i=t.style,s=t.styleSpec,o=t.key,a=t.arrayElementValidator||r;if("array"!==m8(e))return[new S5(o,e,`array expected, ${m8(e)} found`)];if(n.length&&e.length!==n.length)return[new S5(o,e,`array length ${n.length} expected, length ${e.length} found`)];let l={type:n.value,values:n.values};s.$version<7&&(l.function=n.function),"object"===m8(n.value)&&(l=n.value);let c=[];for(let u=0;u<e.length;u++)c=c.concat(a({array:e,arrayIndex:u,value:e[u],valueSpec:l,validateSpec:t.validateSpec,style:i,styleSpec:s,key:`${o}[${u}]`}));return c}function Y8(t){const e=t.key,n=t.value,r=t.valueSpec;let i=m8(n);return"number"===i&&n!=n&&(i="NaN"),"number"!==i?[new S5(e,n,`number expected, ${i} found`)]:"minimum"in r&&n<r.minimum?[new S5(e,n,`${n} is less than the minimum value ${r.minimum}`)]:"maximum"in r&&n>r.maximum?[new S5(e,n,`${n} is greater than the maximum value ${r.maximum}`)]:[]}function X8(t){const e=t.valueSpec,n=H8(t.value.type);let r,i,s,o={};const a="categorical"!==n&&void 0===t.value.property,l=!a,c="array"===m8(t.value.stops)&&"array"===m8(t.value.stops[0])&&"object"===m8(t.value.stops[0][0]),u=Z8({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===n)return[new S5(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const r=t.value;return e=e.concat(K8({key:t.key,value:r,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===m8(r)&&0===r.length&&e.push(new S5(t.key,r,"array must have at least one stop")),e},default:function(t){return t.validateSpec({key:t.key,value:t.value,valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===n&&a&&u.push(new S5(t.key,t.value,'missing required property "property"')),"identity"===n||t.value.stops||u.push(new S5(t.key,t.value,'missing required property "stops"')),"exponential"===n&&t.valueSpec.expression&&!g8(t.valueSpec)&&u.push(new S5(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!p8(t.valueSpec)?u.push(new S5(t.key,t.value,"property functions not supported")):a&&!f8(t.valueSpec)&&u.push(new S5(t.key,t.value,"zoom functions not supported"))),"categorical"!==n&&!c||void 0!==t.value.property||u.push(new S5(t.key,t.value,'"property" property is required')),u;function h(t){let n=[];const r=t.value,a=t.key;if("array"!==m8(r))return[new S5(a,r,`array expected, ${m8(r)} found`)];if(2!==r.length)return[new S5(a,r,`array length 2 expected, length ${r.length} found`)];if(c){if("object"!==m8(r[0]))return[new S5(a,r,`object expected, ${m8(r[0])} found`)];if(void 0===r[0].zoom)return[new S5(a,r,"object stop key must have zoom")];if(void 0===r[0].value)return[new S5(a,r,"object stop key must have value")];if(s&&s>H8(r[0].zoom))return[new S5(a,r[0].zoom,"stop zoom values must appear in ascending order")];H8(r[0].zoom)!==s&&(s=H8(r[0].zoom),i=void 0,o={}),n=n.concat(Z8({key:`${a}[0]`,value:r[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Y8,value:d}}))}else n=n.concat(d({key:`${a}[0]`,value:r[0],valueSpec:{},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},r));return b8(G8(r[1]))?n.concat([new S5(`${a}[1]`,r[1],"expressions are not allowed in function stops.")]):n.concat(t.validateSpec({key:`${a}[1]`,value:r[1],valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec}))}function d(t,s){const a=m8(t.value),l=H8(t.value),c=null!==t.value?t.value:s;if(r){if(a!==r)return[new S5(t.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 S5(t.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==n){let r=`number expected, ${a} found`;return p8(e)&&void 0===n&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new S5(t.key,c,r)]}return"categorical"!==n||"number"!==a||isFinite(l)&&Math.floor(l)===l?"categorical"!==n&&"number"===a&&void 0!==i&&l<i?[new S5(t.key,c,"stop domain values must appear in ascending order")]:(i=l,"categorical"===n&&l in o?[new S5(t.key,c,"stop domain values must be unique")]:(o[l]=!0,[])):[new S5(t.key,c,`integer expected, found ${l}`)]}}function J8(t){const e=("property"===t.expressionContext?C8:w8)(G8(t.value),t.valueSpec);if("error"===e.result)return e.value.map(e=>new S5(`${t.key}${e.key}`,t.value,e.message));const n=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!n.outputDefined())return[new S5(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!c8(n))return[new S5(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!c8(n))return[new S5(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!u8(n,["zoom","feature-state"]))return[new S5(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!l8(n))return[new S5(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Q8(t){const e=t.key,n=t.value,r=m8(n);return"string"!==r?[new S5(e,n,`color expected, ${r} found`)]:w4.parse(String(n))?[]:[new S5(e,n,`color expected, "${n}" found`)]}function t7(t){const e=t.key,n=t.value,r=t.valueSpec,i=[];return Array.isArray(r.values)?-1===r.values.indexOf(H8(n))&&i.push(new S5(e,n,`expected one of [${r.values.join(", ")}], ${JSON.stringify(n)} found`)):-1===Object.keys(r.values).indexOf(H8(n))&&i.push(new S5(e,n,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(n)} found`)),i}function e7(t){return R8(G8(t.value))?J8(k5({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):n7(t)}function n7(t){const e=t.value,n=t.key;if("array"!==m8(e))return[new S5(n,e,`array expected, ${m8(e)} found`)];const r=t.styleSpec;let i,s=[];if(e.length<1)return[new S5(n,e,"filter array must have at least 1 element")];switch(s=s.concat(t7({key:`${n}[0]`,value:e[0],valueSpec:r.filter_operator,style:t.style,styleSpec:t.styleSpec})),H8(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===H8(e[1])&&s.push(new S5(n,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&s.push(new S5(n,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(i=m8(e[1]),"string"!==i&&s.push(new S5(`${n}[1]`,e[1],`string expected, ${i} found`)));for(let o=2;o<e.length;o++)i=m8(e[o]),"$type"===H8(e[1])?s=s.concat(t7({key:`${n}[${o}]`,value:e[o],valueSpec:r.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==i&&"number"!==i&&"boolean"!==i&&s.push(new S5(`${n}[${o}]`,e[o],`string, number, or boolean expected, ${i} found`));break;case"any":case"all":case"none":for(let r=1;r<e.length;r++)s=s.concat(n7({key:`${n}[${r}]`,value:e[r],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":i=m8(e[1]),2!==e.length?s.push(new S5(n,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==i&&s.push(new S5(`${n}[1]`,e[1],`string expected, ${i} found`))}return s}function r7(t,e){const n=t.key,r=t.validateSpec,i=t.style,s=t.styleSpec,o=t.value,a=t.objectKey,l=s[`${e}_${t.layerType}`];if(!l)return[];const c=a.match(/^(.*)-transition$/);if("paint"===e&&c&&l[c[1]]&&l[c[1]].transition)return r({key:n,value:o,valueSpec:s.transition,style:i,styleSpec:s});const u=t.valueSpec||l[a];if(!u)return[new S5(n,o,`unknown property "${a}"`)];let h;if("string"===m8(o)&&p8(u)&&!u.tokens&&(h=/^{([^}]+)}$/.exec(o)))return[new S5(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"===t.layerType&&"text-font"===a&&y8(G8(o))&&"identity"===H8(o.type)&&d.push(new S5(n,o,'"text-font" does not support identity functions')),d.concat(r({key:t.key,value:o,valueSpec:u,style:i,styleSpec:s,expressionContext:"property",propertyType:e,propertyKey:a}))}function i7(t){return r7(t,"paint")}function s7(t){return r7(t,"layout")}function o7(t){let e=[];const n=t.value,r=t.key,i=t.style,s=t.styleSpec;if("object"!==m8(n))return[new S5(r,n,`object expected, ${m8(n)} found`)];n.type||n.ref||e.push(new S5(r,n,'either "type" or "ref" is required'));let o=H8(n.type);const a=H8(n.ref);if(n.id){const s=H8(n.id);for(let o=0;o<t.arrayIndex;o++){const t=i.layers[o];H8(t.id)===s&&e.push(new S5(r,n.id,`duplicate layer id "${n.id}", previously used at line ${t.id.__line__}`))}}if("ref"in n){let t;["type","source","source-layer","filter","layout"].forEach(t=>{t in n&&e.push(new S5(r,n[t],`"${t}" is prohibited for ref layers`))}),i.layers.forEach(e=>{H8(e.id)===a&&(t=e)}),t?t.ref?e.push(new S5(r,n.ref,"ref cannot reference another ref layer")):o=H8(t.type):e.push(new S5(r,n.ref,`ref layer "${a}" not found`))}else if("background"!==o)if(n.source){const t=i.sources&&i.sources[n.source],s=t&&H8(t.type);t?"vector"===s&&"raster"===o?e.push(new S5(r,n.source,`layer "${n.id}" requires a raster source`)):"raster-dem"!==s&&"hillshade"===o||"raster-dem"!==s&&"color-relief"===o?e.push(new S5(r,n.source,`layer "${n.id}" requires a raster-dem source`)):"raster"===s&&"raster"!==o?e.push(new S5(r,n.source,`layer "${n.id}" requires a vector source`)):"vector"!==s||n["source-layer"]?"raster-dem"===s&&"hillshade"!==o&&"color-relief"!==o?e.push(new S5(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&&t.lineMetrics||e.push(new S5(r,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new S5(r,n,`layer "${n.id}" must specify a "source-layer"`)):e.push(new S5(r,n.source,`source "${n.source}" not found`))}else e.push(new S5(r,n,'missing required property "source"'));return"raster"===o&&n.paint?.resampling&&n.paint?.["raster-resampling"]&&e.push(new S5(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".`)),e=e.concat(Z8({key:r,value:n,valueSpec:s.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${r}.type`,value:n.type,valueSpec:s.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:n,objectKey:"type"}),filter:e7,layout:t=>Z8({layer:n,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>s7(k5({layerType:o},t))}}),paint:t=>Z8({layer:n,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>i7(k5({layerType:o},t))}})}})),e}function a7(t){const e=t.value,n=t.key,r=m8(e);return"string"!==r?[new S5(n,e,`string expected, ${r} found`)]:[]}var l7={promoteId:function({key:t,value:e}){if("string"===m8(e))return a7({key:t,value:e});{const n=[];for(const r in e)n.push(...a7({key:`${t}.${r}`,value:e[r]}));return n}}};function c7(t){const e=t.value,n=t.key,r=t.styleSpec,i=t.style,s=t.validateSpec;if(!e.type)return[new S5(n,e,'"type" is required')];const o=H8(e.type);let a;switch(o){case"vector":case"raster":return a=Z8({key:n,value:e,valueSpec:r[`source_${o.replace("-","_")}`],style:t.style,styleSpec:r,objectElementValidators:l7,validateSpec:s}),a;case"raster-dem":return a=function(t){const e=t.sourceName??"",n=t.value,r=t.styleSpec,i=r.source_raster_dem,s=t.style;let o=[];const a=m8(n);if(void 0===n)return o;if("object"!==a)return o.push(new S5("source_raster_dem",n,`object expected, ${a} found`)),o;const l="custom"===H8(n.encoding),c=["redFactor","greenFactor","blueFactor","baseShift"],u=t.value.encoding?`"${t.value.encoding}"`:"Default";for(const h in n)!l&&c.includes(h)?o.push(new S5(h,n[h],`In "${e}": "${h}" is only valid when "encoding" is set to "custom". ${u} encoding found`)):i[h]?o=o.concat(t.validateSpec({key:h,value:n[h],valueSpec:i[h],validateSpec:t.validateSpec,style:s,styleSpec:r})):o.push(new S5(h,n[h],`unknown property "${h}"`));return o}({sourceName:n,value:e,style:t.style,styleSpec:r,validateSpec:s}),a;case"geojson":if(a=Z8({key:n,value:e,valueSpec:r.source_geojson,style:i,styleSpec:r,validateSpec:s,objectElementValidators:l7}),e.cluster)for(const t in e.clusterProperties){const[r,i]=e.clusterProperties[t],o="string"==typeof r?[r,["accumulated"],["get",t]]:r;a.push(...J8({key:`${n}.${t}.map`,value:i,validateSpec:s,expressionContext:"cluster-map"})),a.push(...J8({key:`${n}.${t}.reduce`,value:o,validateSpec:s,expressionContext:"cluster-reduce"}))}return a;case"video":return Z8({key:n,value:e,valueSpec:r.source_video,style:i,validateSpec:s,styleSpec:r});case"image":return Z8({key:n,value:e,valueSpec:r.source_image,style:i,validateSpec:s,styleSpec:r});case"canvas":return[new S5(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return t7({key:`${n}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:i,validateSpec:s,styleSpec:r})}}function u7(t){const e=t.value,n=t.styleSpec,r=n.light,i=t.style;let s=[];const o=m8(e);if(void 0===e)return s;if("object"!==o)return s=s.concat([new S5("light",e,`object expected, ${o} found`)]),s;for(const a in e){const o=a.match(/^(.*)-transition$/);s=o&&r[o[1]]&&r[o[1]].transition?s.concat(t.validateSpec({key:a,value:e[a],valueSpec:n.transition,validateSpec:t.validateSpec,style:i,styleSpec:n})):r[a]?s.concat(t.validateSpec({key:a,value:e[a],valueSpec:r[a],validateSpec:t.validateSpec,style:i,styleSpec:n})):s.concat([new S5(a,e[a],`unknown property "${a}"`)])}return s}function h7(t){const e=t.value,n=t.styleSpec,r=n.sky,i=t.style,s=m8(e);if(void 0===e)return[];if("object"!==s)return[new S5("sky",e,`object expected, ${s} found`)];let o=[];for(const a in e)o=r[a]?o.concat(t.validateSpec({key:a,value:e[a],valueSpec:r[a],style:i,styleSpec:n})):o.concat([new S5(a,e[a],`unknown property "${a}"`)]);return o}function d7(t){const e=t.value,n=t.styleSpec,r=n.terrain,i=t.style;let s=[];const o=m8(e);if(void 0===e)return s;if("object"!==o)return s=s.concat([new S5("terrain",e,`object expected, ${o} found`)]),s;for(const a in e)s=r[a]?s.concat(t.validateSpec({key:a,value:e[a],valueSpec:r[a],validateSpec:t.validateSpec,style:i,styleSpec:n})):s.concat([new S5(a,e[a],`unknown property "${a}"`)]);return s}function p7(t){let e=[];const n=t.value,r=t.key;if(Array.isArray(n)){const i=[],s=[];for(const o in n)n[o].id&&i.includes(n[o].id)&&e.push(new S5(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)&&e.push(new S5(r,n,`all the sprites' URLs must be unique, but ${n[o].url} is duplicated`)),s.push(n[o].url),e=e.concat(Z8({key:`${r}[${o}]`,value:n[o],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:t.validateSpec}));return e}return a7({key:r,value:n})}function f7(t){return Boolean(t)&&t.constructor===Object}function g7(t){return f7(t.value)?[]:[new S5(t.key,t.value,`object expected, ${m8(t.value)} found`)]}var m7={"*":()=>[],array:K8,boolean:function(t){const e=t.value,n=t.key,r=m8(e);return"boolean"!==r?[new S5(n,e,`boolean expected, ${r} found`)]:[]},number:Y8,color:Q8,constants:W8,enum:t7,filter:e7,function:X8,layer:o7,object:Z8,source:c7,light:u7,sky:h7,terrain:d7,projection:function(t){const e=t.value,n=t.styleSpec,r=n.projection,i=t.style,s=m8(e);if(void 0===e)return[];if("object"!==s)return[new S5("projection",e,`object expected, ${s} found`)];let o=[];for(const a in e)o=r[a]?o.concat(t.validateSpec({key:a,value:e[a],valueSpec:r[a],style:i,styleSpec:n})):o.concat([new S5(a,e[a],`unknown property "${a}"`)]);return o},projectionDefinition:function(t){const e=t.key;let n=t.value;n=n instanceof String?n.valueOf():n;const r=m8(n);return"array"!==r||function(t){return Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]}(n)||function(t){return!!["interpolate","step","literal"].includes(t[0])}(n)?["array","string"].includes(r)?[]:[new S5(e,n,`projection expected, invalid type "${r}" found`)]:[new S5(e,n,`projection expected, invalid array ${JSON.stringify(n)} found`)]},string:a7,formatted:function(t){return 0===a7(t).length?[]:J8(t)},resolvedImage:function(t){return 0===a7(t).length?[]:J8(t)},padding:function(t){const e=t.key,n=t.value;if("array"===m8(n)){if(n.length<1||n.length>4)return[new S5(e,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(t.validateSpec({key:`${e}[${s}]`,value:n[s],validateSpec:t.validateSpec,valueSpec:r}));return i}return Y8({key:e,value:n,valueSpec:{}})},numberArray:function(t){const e=t.key,n=t.value;if("array"===m8(n)){const r={type:"number"};if(n.length<1)return[new S5(e,n,"array length at least 1 expected, length 0 found")];let i=[];for(let s=0;s<n.length;s++)i=i.concat(t.validateSpec({key:`${e}[${s}]`,value:n[s],validateSpec:t.validateSpec,valueSpec:r}));return i}return Y8({key:e,value:n,valueSpec:{}})},colorArray:function(t){const e=t.key,n=t.value;if("array"===m8(n)){if(n.length<1)return[new S5(e,n,"array length at least 1 expected, length 0 found")];let t=[];for(let r=0;r<n.length;r++)t=t.concat(Q8({key:`${e}[${r}]`,value:n[r],valueSpec:{}}));return t}return Q8({key:e,value:n,valueSpec:{}})},variableAnchorOffsetCollection:function(t){const e=t.key,n=t.value,r=m8(n),i=t.styleSpec;if("array"!==r||n.length<1||n.length%2!=0)return[new S5(e,n,"variableAnchorOffsetCollection requires a non-empty array of even length")];let s=[];for(let o=0;o<n.length;o+=2)s=s.concat(t7({key:`${e}[${o}]`,value:n[o],valueSpec:i.layout_symbol["text-anchor"]})),s=s.concat(K8({key:`${e}[${o+1}]`,value:n[o+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:i}));return s},sprite:p7,state:g7,fontFaces:function(t){const e=t.key,n=t.value,r=t.validateSpec,i=t.styleSpec,s=t.style;if(!f7(n))return[new S5(e,n,`object expected, ${m8(n)} found`)];const o=[];for(const a in n){const t=n[a],l=m8(t);if("string"===l)o.push(...a7({key:`${e}.${a}`,value:t}));else if("array"===l){const n={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(const[l,c]of t.entries())o.push(...Z8({key:`${e}.${a}[${l}]`,value:c,valueSpec:n,styleSpec:i,style:s,validateSpec:r}))}else o.push(new S5(`${e}.${a}`,t,`string or array expected, ${l} found`))}return o}};function y7(t){const e=t.value,n=t.valueSpec,r=t.styleSpec;return t.validateSpec=y7,n.expression&&y8(H8(e))?X8(t):n.expression&&b8(G8(e))?J8(t):n.type&&m7[n.type]?m7[n.type](t):Z8(k5({},t,{valueSpec:n.type?r[n.type]:n}))}function v7(t){const e=t.value,n=t.key,r=a7(t);return r.length||(-1===e.indexOf("{fontstack}")&&r.push(new S5(n,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&r.push(new S5(n,e,'"glyphs" url must include a "{range}" token'))),r}function b7(t,e=w5){let n=[];return n=n.concat(y7({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:y7,objectElementValidators:{glyphs:v7,"*":()=>[]}})),t.constants&&(n=n.concat(W8({key:"constants",value:t.constants,style:t,styleSpec:e,validateSpec:y7}))),_7(n)}function w7(t){return function(e){return t(Object.assign({},e,{validateSpec:y7}))}}function _7(t){return[].concat(t).sort((t,e)=>t.line-e.line)}function x7(t){return function(...e){return _7(t.apply(this,e))}}b7.source=x7(w7(c7)),b7.sprite=x7(w7(p7)),b7.glyphs=x7(w7(v7)),b7.light=x7(w7(u7)),b7.sky=x7(w7(h7)),b7.terrain=x7(w7(d7)),b7.state=x7(w7(g7)),b7.layer=x7(w7(o7)),b7.filter=x7(w7(e7)),b7.paintProperty=x7(w7(i7)),b7.layoutProperty=x7(w7(s7));var C7=w5,S7=4294967296,k7="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8"),E7=class{constructor(t){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),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(t,e,n=this.length){let r;for(;r=this.nextField(n);)t(r,e,this);return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*S7;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*S7;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf,n=e[this.pos++];if(n<128)return n;let r,i=127&n;return r=e[this.pos++],i|=(127&r)<<7,r<128?i:(r=e[this.pos++],i|=(127&r)<<14,r<128?i:(r=e[this.pos++],i|=(127&r)<<21,r<128?i:(r=e[this.pos],i|=(15&r)<<28,function(t,e,n){const r=n.buf;let i,s;if(s=r[n.pos++],i=(112&s)>>4,s<128)return R7(t,i,e);if(s=r[n.pos++],i|=(127&s)<<3,s<128)return R7(t,i,e);if(s=r[n.pos++],i|=(127&s)<<10,s<128)return R7(t,i,e);if(s=r[n.pos++],i|=(127&s)<<17,s<128)return R7(t,i,e);if(s=r[n.pos++],i|=(127&s)<<24,s<128)return R7(t,i,e);if(s=r[n.pos++],i|=(1&s)<<31,s<128)return R7(t,i,e);throw new Error("Expected varint not more than 10 bytes")}(i,t,this))))}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return Boolean(this.readVarint())}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&k7?k7.decode(this.buf.subarray(e,t)):function(t,e,n){let r="",i=e;for(;i<n;){const e=t[i];let s,o,a,l=null,c=e>239?4:e>223?3:e>191?2:1;if(i+c>n)break;1===c?e<128&&(l=e):2===c?(s=t[i+1],128==(192&s)&&(l=(31&e)<<6|63&s,l<=127&&(l=null))):3===c?(s=t[i+1],o=t[i+2],128==(192&s)&&128==(192&o)&&(l=(15&e)<<12|(63&s)<<6|63&o,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===c&&(s=t[i+1],o=t[i+2],a=t[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&e)<<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,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const n=this.readPackedEnd();for(;this.pos<n;)t.push(this.readVarint(e));return t}readPackedSVarint(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFloat());return t}readPackedDouble(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed64());return t}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}nextField(t=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=t)return 0;const e=this.readVarint();return this.type=7&e,this._valueStart=this.pos,e>>>3}skip(t){const e=7&t;if(0===e)for(;this.buf[this.pos++]>127;);else if(2===e)this.pos=this.readVarint()+this.pos;else if(5===e)this.pos+=4;else{if(1!==e)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}};function R7(t,e,n){return n?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}var T7=class extends J3{constructor(t){super(),t=t||{},this.dataProjection=new tK({code:"",units:"tile-pixels"}),this.featureClass=t.featureClass?t.featureClass:$3,this.geometryName_=t.geometryName,this.layerName_=t.layerName?t.layerName:"layer",this.layers_=t.layers?t.layers:null,this.idProperty_=t.idProperty,this.supportedMediaTypes=["application/vnd.mapbox-vector-tile","application/x-protobuf"]}readRawGeometry_(t,e,n,r){t.pos=e.geometry;const i=t.readVarint()+t.pos;let s=1,o=0,a=0,l=0,c=0,u=0;for(;t.pos<i;){if(!o){const e=t.readVarint();s=7&e,o=e>>3}if(o--,1===s||2===s)a+=t.readSVarint(),l+=t.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_(t,e,n){const r=e.type;if(0===r)return null;let i;const s=e.properties;let o;this.idProperty_?(o=s[this.idProperty_],delete s[this.idProperty_]):o=e.id,s[this.layerName_]=e.layer.name;const a=[],l=[];this.readRawGeometry_(t,e,a,l);const c=function(t,e){let n;return 1===t?n=1===e?"Point":"MultiPoint":2===t?n=1===e?"LineString":"MultiLineString":3===t&&(n="Polygon"),n}(r,l.length);if(this.featureClass===$3)i=new this.featureClass(c,a,l,2,s,o),i.transform(n.dataProjection);else{let t;if("Polygon"==c){const e=hX(a,l);t=e.length>1?new O2(a,"XY",e):new dX(a,"XY",l)}else t="Point"===c?new nX(a,"XY"):"LineString"===c?new I2(a,"XY"):"MultiPoint"===c?new M2(a,"XY"):"MultiLineString"===c?new P2(a,"XY",l):null;i=new(0,this.featureClass),this.geometryName_&&i.setGeometryName(this.geometryName_);const e=Q3(t,!1,n);i.setGeometry(e),void 0!==o&&i.setId(o),i.setProperties(s,!0)}return i}getType(){return"arraybuffer"}readFeatures(t,e){const n=this.layers_,r=KK((e=this.adaptOptions(e)).dataProjection);r.setWorldExtent(e.extent),e.dataProjection=r;const i=new E7(t),s=i.readFields(L7,{}),o=[];for(const a in s){if(n&&!n.includes(a))continue;const t=s[a],l=t?[0,0,t.extent,t.extent]:null;r.setExtent(l);for(let n=0,r=t.length;n<r;++n){const r=M7(i,t,n),s=this.createFeature_(i,r,e);null!==s&&o.push(s)}}return o}readProjection(t){return this.dataProjection}setLayers(t){this.layers_=t}};function L7(t,e,n){if(3===t){const t={keys:[],values:[],features:[]},r=n.readVarint()+n.pos;n.readFields(I7,t,r),t.length=t.features.length,t.length&&(e[t.name]=t)}}function I7(t,e,n){if(15===t)e.version=n.readVarint();else if(1===t)e.name=n.readString();else if(5===t)e.extent=n.readVarint();else if(2===t)e.features.push(n.pos);else if(3===t)e.keys.push(n.readString());else if(4===t){let r=null;const i=n.readVarint()+n.pos;for(;n.pos<i;)r=1==(t=n.readVarint()>>3)?n.readString():2===t?n.readFloat():3===t?n.readDouble():4===t?n.readVarint(!0):5===t?n.readVarint():6===t?n.readSVarint():7===t?n.readBoolean():null;e.values.push(r)}}function P7(t,e,n){if(1==t)e.id=n.readVarint();else if(2==t){const t=n.readVarint()+n.pos;for(;n.pos<t;){const t=e.layer.keys[n.readVarint()],r=e.layer.values[n.readVarint()];e.properties[t]=r}}else 3==t?e.type=n.readVarint():4==t&&(e.geometry=n.pos)}function M7(t,e,n){t.pos=e.features[n];const r=t.readVarint()+t.pos,i={layer:e,type:0,properties:{}};return t.readFields(P7,i,r),i}var A7=class extends dG{constructor(t,e,n){super(),n=n||{},this.tileCoord=t,this.state=e,this.key="",this.transition_=void 0===n.transition?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(HH)}release(){this.setState(4)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(4!==this.state){if(3!==this.state&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){fG()}getAlpha(t,e){if(!this.transition_)return 1;let n=this.transitionStarts_[t];if(n){if(-1===n)return 1}else n=e,this.transitionStarts_[t]=n;const r=e-n+1e3/60;return r>=this.transition_?1:HZ(r/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}};function O7(t){return t instanceof Image||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageBitmap?t:null}var N7,F7=new Error("disposed"),z7=[256,256],D7=class extends A7{constructor(t){super(t.tileCoord,0,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null,this.controller_=t.controller||null}getSize(){if(this.size_)return this.size_;const t=O7(this.data_);return t?[t.width,t.height]:z7}getData(){return this.data_}getError(){return this.error_}load(){if(0!==this.state&&3!==this.state)return;this.state=1,this.changed();const t=this;this.loader_().then(function(e){t.data_=e,t.state=2,t.changed()}).catch(function(e){t.error_=e,t.state=3,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(F7),this.controller_=null),super.disposeInternal()}},j7=class extends A7{constructor(t,e,n,r,i,s){super(t,e,s),this.crossOrigin_=r?.crossOrigin,this.referrerPolicy_=r?.referrerPolicy,this.src_=n,this.key=n,this.image_,LG?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(t){this.image_=t,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 t=MX(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}(),this.changed()}handleImageLoad_(){if(LG)this.state=2;else{const t=this.image_;t.naturalWidth&&t.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(t,e,n){const r=t;let i=!0,s=!1,o=!1;const a=[VH(r,"load",function(){o=!0,s||e()})];return r.src&&IG?(s=!0,r.decode().then(function(){i&&e()}).catch(function(){i&&(o?e():n())})):a.push(VH(r,"error",n)),function(){i=!1,a.forEach(WH)}}(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()}},U7=class{constructor(t,e,n,r){this.minX=t,this.maxX=e,this.minY=n,this.maxY=r}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}};function B7(t,e,n,r,i){return void 0!==i?(i.minX=t,i.maxX=e,i.minY=n,i.maxY=r,i):new U7(t,e,n,r)}var $7=[];function q7(t,e,n,r,i){t.beginPath(),t.moveTo(0,0),t.lineTo(e,n),t.lineTo(r,i),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,r)+1,Math.max(n,i)),t.restore()}function V7(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function W7(t,e,n,r){const i=sY(n,e,t);let s=YK(e,r,n);const o=e.getMetersPerUnit();void 0!==o&&(s*=o);const a=t.getMetersPerUnit();void 0!==a&&(s/=a);const l=t.getExtent();if(!l||uZ(l,i)){const e=YK(t,s,i)/s;isFinite(e)&&e>0&&(s/=e)}return s}function H7(t,e,n,r,i,s,o,a,l,c,u,h,d,p){const f=MX(Math.round(n*t),Math.round(n*e),$7);if(h||(f.imageSmoothingEnabled=!1),0===l.length)return f.canvas;function g(t){return Math.round(t*n)/n}f.scale(n,n),f.globalCompositeOperation="lighter";const m=[1/0,1/0,-1/0,-1/0];let y;l.forEach(function(t){bZ(m,t.extent)});const v=n/r,b=(h?1:1+Math.pow(2,-24))/v;if(!d||1!==l.length||0!==c){if(y=MX(Math.round(FZ(m)*v),Math.round(PZ(m)*v),$7),h||(y.imageSmoothingEnabled=!1),i&&p){const t=(i[0]-m[0])*v,e=-(i[3]-m[3])*v,n=FZ(i)*v,r=PZ(i)*v;y.rect(t,e,n,r),y.clip()}l.forEach(function(t){if(t.image.width>0&&t.image.height>0){if(t.clipExtent){y.save();const e=(t.clipExtent[0]-m[0])*v,n=-(t.clipExtent[3]-m[3])*v,r=FZ(t.clipExtent)*v,i=PZ(t.clipExtent)*v;y.rect(h?e:Math.round(e),h?n:Math.round(n),h?r:Math.round(e+r)-Math.round(e),h?i:Math.round(n+i)-Math.round(n)),y.clip()}const e=(t.extent[0]-m[0])*v,n=-(t.extent[3]-m[3])*v,r=FZ(t.extent)*v,i=PZ(t.extent)*v;y.drawImage(t.image,c,c,t.image.width-2*c,t.image.height-2*c,h?e:Math.round(e),h?n:Math.round(n),h?r:Math.round(e+r)-Math.round(e),h?i:Math.round(n+i)-Math.round(n)),t.clipExtent&&y.restore()}})}const w=OZ(o);return a.getTriangles().forEach(function(t){const e=t.source,n=t.target;let r=e[0][0],i=e[0][1],o=e[1][0],a=e[1][1],c=e[2][0],u=e[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(t){const e=t.length;for(let r=0;r<e;r++){let n=r,i=Math.abs(t[r][r]);for(let o=r+1;o<e;o++){const e=Math.abs(t[o][r]);e>i&&(i=e,n=o)}if(0===i)return null;const s=t[n];t[n]=t[r],t[r]=s;for(let o=r+1;o<e;o++){const n=-t[o][r]/t[r][r];for(let i=r;i<e+1;i++)r==i?t[o][i]=0:t[o][i]+=n*t[r][i]}}const n=new Array(e);for(let r=e-1;r>=0;r--){n[r]=t[r][e]/t[r][r];for(let i=r-1;i>=0;i--)t[i][e]-=t[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===N7){const t=MX(6,6,$7);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",q7(t,4,5,4,0),q7(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;N7=V7(e,0)||V7(e,4)||V7(e,8),OX(t),$7.push(t.canvas)}return N7}()||!h){f.moveTo(v,_);const t=4,e=d-v,n=p-_;for(let r=0;r<t;r++)f.lineTo(v+g((r+1)*e/t),_+g(r*n/3)),3!=r&&f.lineTo(v+g((r+1)*e/t),_+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 t=l[0],e=t.extent;R=t.image,f.scale(FZ(e)/R.width,-PZ(e)/R.height)}f.drawImage(R,0,0),f.restore()}),y&&(OX(y),$7.push(y.canvas)),u&&(f.save(),f.globalCompositeOperation="source-over",f.strokeStyle="black",f.lineWidth=1,a.getTriangles().forEach(function(t){const e=t.target,n=(e[0][0]-w[0])/s,r=-(e[0][1]-w[1])/s,i=(e[1][0]-w[0])/s,o=-(e[1][1]-w[1])/s,a=(e[2][0]-w[0])/s,l=-(e[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 G7=class{constructor(t,e,n,r,i,s,o){this.sourceProj_=t,this.targetProj_=e;let a={};const l=o?(c=t=>mY(o,sY(t,this.targetProj_,this.sourceProj_)),function(t,e,n,r){const i=t.length;n=void 0!==n?n:2,r=r??n,e=void 0!==e?e:new Array(i);for(let s=0;s<i;s+=r){const i=c(t.slice(s,s+n)),o=i.length;for(let n=0,a=r;n<a;++n)e[s+n]=n>=o?t[s+n]:i[n]}return e}):iY(this.targetProj_,this.sourceProj_);var c;this.transformInv_=function(t){const e=t[0]+"/"+t[1];return a[e]||(a[e]=l(t)),a[e]},this.maxSourceExtent_=r,this.errorThresholdSquared_=i*i,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&FZ(r)>=FZ(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?FZ(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?FZ(this.targetProj_.getExtent()):null;const u=OZ(n),h=NZ(n),d=EZ(n),p=kZ(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(SZ(n)/(s*s*256*256)))):0);if(this.addQuad_(u,h,d,p,f,g,m,y,v),this.wrapsXInSource_){let t=1/0;this.triangles_.forEach(function(e){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])}),this.triangles_.forEach(e=>{if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-t>this.sourceWorldWidth_/2){const n=[[e.source[0][0],e.source[0][1]],[e.source[1][0],e.source[1][1]],[e.source[2][0],e.source[2][1]]];n[0][0]-t>this.sourceWorldWidth_/2&&(n[0][0]-=this.sourceWorldWidth_),n[1][0]-t>this.sourceWorldWidth_/2&&(n[1][0]-=this.sourceWorldWidth_),n[2][0]-t>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&&(e.source=n)}})}a={}}addTriangle_(t,e,n,r,i,s){this.triangles_.push({source:[r,i,s],target:[t,e,n]})}addQuad_(t,e,n,r,i,s,o,a,l){const c=oZ([i,s,o,a]),u=this.sourceWorldWidth_?FZ(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=FZ(oZ([t,e,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])&&!zZ(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 e=[(t[0]+n[0])/2,(t[1]+n[1])/2],r=this.transformInv_(e);let s;s=d?(JG(i[0],h)+JG(o[0],h))/2-JG(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(t[0]-n[0])<=Math.abs(t[1]-n[1])){const c=[(e[0]+n[0])/2,(e[1]+n[1])/2],u=this.transformInv_(c),h=[(r[0]+t[0])/2,(r[1]+t[1])/2],d=this.transformInv_(h);this.addQuad_(t,e,c,h,i,s,u,d,l-1),this.addQuad_(h,c,n,r,d,u,o,a,l-1)}else{const c=[(t[0]+e[0])/2,(t[1]+e[1])/2],u=this.transformInv_(c),h=[(n[0]+r[0])/2,(n[1]+r[1])/2],d=this.transformInv_(h);this.addQuad_(t,c,h,r,i,u,d,a,l-1),this.addQuad_(c,e,n,h,u,s,o,d,l-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}11&f||this.addTriangle_(t,n,r,i,o,a),14&f||this.addTriangle_(t,n,e,i,o,s),f&&(13&f||this.addTriangle_(e,r,t,s,a,i),7&f||this.addTriangle_(e,r,n,s,a,o))}calculateSourceExtent(){const t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach(function(e){const n=e.source;wZ(t,n[0]),wZ(t,n[1]),wZ(t,n[2])}),t}getTriangles(){return this.triangles_}},Z7=class extends A7{constructor(t,e,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_=e,this.targetTileGrid_=r,this.wrappedTileCoord_=s||i,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const d=r.getTileCoordExtent(this.wrappedTileCoord_),p=this.targetTileGrid_.getExtent();let f=this.sourceTileGrid_.getExtent();const g=p?MZ(d,p):d;if(0===SZ(g))return void(this.state=4);const m=t.getExtent();m&&(f=f?MZ(f,m):m);const y=r.getResolution(this.wrappedTileCoord_[0]),v=function(t,e,n,r){let i=W7(t,e,RZ(n),r);return(!isFinite(i)||i<=0)&&CZ(n,function(n){return i=W7(t,e,n,r),isFinite(i)&&i>0}),i}(t,n,g,y);if(!isFinite(v)||v<=0)return void(this.state=4);const b=void 0!==c?c:.5;if(this.triangulation_=new G7(t,n,g,f,v*b,y),0===this.triangulation_.getTriangles().length)return void(this.state=4);this.sourceZ_=e.getZForResolution(v);let w=this.triangulation_.calculateSourceExtent();if(f&&(t.canWrapX()?(w[1]=GG(w[1],f[1],f[3]),w[3]=GG(w[3],f[1],f[3])):w=MZ(w,f)),SZ(w)){let n=0,r=0;t.canWrapX()&&(n=FZ(m),r=Math.floor((w[0]-m[0])/n)),BZ(w.slice(),t,!0).forEach(t=>{const i=e.getTileRangeForExtentAndZ(t,this.sourceZ_);for(let e=i.minX;e<=i.maxX;e++)for(let t=i.minY;t<=i.maxY;t++){const i=r*n;this.sourceTiles_.push({getTile:()=>l(this.sourceZ_,e,t,o),offset:i})}++r}),0===this.sourceTiles_.length&&(this.state=4)}else this.state=4}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{const n=e.tile;if(n&&2==n.getState()){const r=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);r[0]+=e.offset,r[2]+=e.offset;const i=this.clipExtent_?.slice();i&&(i[0]+=e.offset,i[2]+=e.offset),t.push({extent:r,clipExtent:i,image:n.getImage()})}}),this.sourceTiles_.length=0,0===t.length)this.state=3;else{const e=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(e),r="number"==typeof n?n:n[0],i="number"==typeof n?n:n[1],s=this.targetTileGrid_.getResolution(e),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=H7(r,i,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),s,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=2}this.changed()}load(){for(const t of this.sourceTiles_)t.tile=t.getTile();if(0==this.state){this.state=1,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{const n=e.getState();if(0==n||1==n){t++;const n=qH(e,HH,()=>{const r=e.getState();2!=r&&3!=r&&4!=r||(WH(n),t--,0===t&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(n)}}),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:t}){0==t.getState()&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(WH),this.sourcesListenerKeys_=null}release(){this.canvas_&&(OX(this.canvas_.getContext("2d")),$7.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},K7=class{constructor(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const t=this.pop();t instanceof QH&&t.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const n=this.entries_[t];return $G(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(t){const e=this.entries_[t];return $G(void 0!==e,"Tried to get a value for a key that does not exist in the cache"),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e,n=0;for(e=this.newest_;e;e=e.older)t[n++]=e.key_;return t}getValues(){const t=new Array(this.count_);let e,n=0;for(e=this.newest_;e;e=e.older)t[n++]=e.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){return this.entries_[t]?.value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){$G(!(t in this.entries_),"Tried to set a value for a key that is used already");const n={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[t]=n,++this.count_}setSize(t){this.highWaterMark=t}};function Y7(t,e,n,r){return void 0!==r?(r[0]=t,r[1]=e,r[2]=n,r):[t,e,n]}function X7(t,e,n,r,i){return`${mG(t)},${e},${function(t,e,n){return t+"/"+e+"/"+n}(n,r,i)}`}function J7(t,e,n){if(!(n in t))return t[n]=new Set([e]),!0;const r=t[n],i=r.has(e);return i||r.add(e),!i}function Q7(t,e,n){const r=t[n];return!!r&&r.delete(e)}function t9(t,e){const n=t.layerStatesArray[t.layerIndex];n.extent&&(e=MZ(e,cY(n.extent,t.viewState.projection)));const r=n.layer.getRenderSource();if(!r.getWrapX()){const n=r.getTileGridForProjection(t.viewState.projection).getExtent();n&&(e=MZ(e,n))}return e}var e9=class extends O3{constructor(t,e){super(t),e=e||{},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 U7(0,0,0,0),this.tempTileCoord_=Y7(0,0,0);const n=void 0!==e.cacheSize?e.cacheSize:512;this.tileCache_=new K7(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=.5*n}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new K7(512)),this.sourceTileCache_}getOrCreateTile(t,e,n,r){const i=this.tileCache_,s=this.getLayer().getSource(),o=X7(s,s.getKey(),t,e,n);let a;if(i.containsKey(o))a=i.get(o);else{const l=r.viewState.projection,c=s.getProjection();if(a=s.getTile(t,e,n,r.pixelRatio,l,!c||eY(c,l)?void 0:this.getSourceTileCache()),!a)return null;i.set(o,a)}return a}getTile(t,e,n,r){return this.getOrCreateTile(t,e,n,r)||null}getData(t){const e=this.frameState;if(!e)return null;const n=this.getLayer(),r=mY(e.pixelToCoordinateTransform,t.slice()),i=n.getExtent();if(i&&!uZ(i,r))return null;const s=e.viewState,o=n.getRenderSource(),a=o.getTileGridForProjection(s.projection),l=o.getTilePixelRatio(e.pixelRatio);for(let c=a.getZForResolution(s.resolution);c>=a.getMinZoom();--c){const t=a.getTileCoordForCoordAndZ(r,c),n=this.getTile(c,t[1],t[2],e);if(!n||2!==n.getState())continue;const i=a.getOrigin(c),u=PQ(a.getTileSize(c)),h=a.getResolution(c);let d;if(n instanceof j7||n instanceof Z7)d=n.getImage();else{if(!(n instanceof D7))continue;if(d=O7(n.getData()),!d)continue}const p=Math.floor(l*((r[0]-i[0])/h-t[1]*u[0])),f=Math.floor(l*((i[1]-r[1])/h-t[2]*u[1])),g=Math.round(l*o.getGutterForProjection(s.projection));return this.getImageData(d,p+g,f+g)}return null}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const n=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==n&&(this.renderedSourceRevision_=n,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=n,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,n,r,i){const s=t.viewState,o=this.getLayer(),a=o.getRenderSource(),l=a.getTileGridForProjection(s.projection),c=mG(a);c in t.wantedTiles||(t.wantedTiles[c]={});const u=t.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?IZ(s.center,s.resolution,p,t.size):void 0;for(let g=n;g>=d;--g){const n=l.getTileRangeForExtentAndZ(e,g,this.tempTileRange_),i=l.getResolution(g);for(let e=n.minX;e<=n.maxX;++e)for(let s=n.minY;s<=n.maxY;++s){if(p&&!l.tileCoordIntersectsViewport([g,e,s],f))continue;const n=this.getTile(g,e,s,t);if(!n)continue;if(!J7(r,n,g))continue;const o=n.getKey();if(u[o]=!0,0===n.getState()&&!t.tileQueue.isKeyQueued(o)){const r=Y7(g,e,s,this.tempTileCoord_);t.tileQueue.enqueue([n,c,l.getTileCoordCenter(r),i])}}}}findStaleTile_(t,e){const n=this.tileCache_,r=t[0],i=t[1],s=t[2],o=this.getStaleKeys();for(let a=0;a<o.length;++a){const t=X7(this.getLayer().getSource(),o[a],r,i,s);if(n.containsKey(t)){const i=n.peek(t);if(2===i.getState())return i.endTransition(mG(this)),J7(e,i,r),!0}}return!1}findAltTiles_(t,e,n,r){const i=t.getTileRangeForTileCoordAndZ(e,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 t=i.minY;t<=i.maxY;++t){const e=X7(a,l,n,c,t);let i=!1;if(o.containsKey(e)){const t=o.peek(e);2===t.getState()&&(J7(r,t,n),i=!0)}i||(s=!1)}return s}renderFrame(t,e){this.renderComplete=!0;const n=t.layerStatesArray[t.layerIndex],r=t.viewState,i=r.projection,s=r.resolution,o=r.center,a=t.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=t.extent;const f=c.getTilePixelRatio(a);this.prepareContainer(t,e);const g=this.context.canvas.width,m=this.context.canvas.height;this.layerExtent=n.extent?n.extent:null,this.layerExtent&&(p=MZ(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(t.nextExtent&&this.enqueueTilesForNextExtent()){const e=u.getZForResolution(r.nextResolution,c.zDirection),n=t9(t,t.nextExtent);this.enqueueTiles(t,n,e,w,_)}const x=t9(t,p);if(this.enqueueTiles(t,x,h,w,0),_>0&&setTimeout(()=>{this.enqueueTiles(t,x,h-1,w,_-1)},0),!(h in w))return this.container;const C=mG(this),S=t.time;for(const P of w[h]){const e=P.getState();if(4===e)continue;const n=P.tileCoord;if(2===e&&1===P.getAlpha(C,S)){P.endTransition(C);continue}if(3!==e&&(this.renderComplete=!1),this.findStaleTile_(n,w)){Q7(w,P,h),t.animate=!0;continue}if(this.findAltTiles_(u,n,h+1,w))continue;const r=u.getMinZoom();for(let t=h-1;t>=r&&!this.findAltTiles_(u,n,t,w);--t);}const k=d/s*a/f,E=this.getRenderContext(t);vY(this.tempTransform,g/2,m/2,k,k,0,-g/2,-m/2),this.layerExtent&&this.clipUnrotated(E,t,this.layerExtent),c.getInterpolate()||(E.imageSmoothingEnabled=!1),this.preRender(E,t);const R=Object.keys(w).map(Number);R.sort(tG);const T=[],L=[],I=[];for(let P=R.length-1;P>=0;--P){const e=R[P],n=c.getTilePixelSize(e,a,i),r=u.getResolution(e)/d,s=n[0]*r*k,o=n[1]*r*k,l=u.getTileCoordForCoordAndZ(OZ(b),e),p=u.getTileCoordExtent(l),g=mY(this.tempTransform,[f*(p[0]-b[0])/d,f*(b[3]-p[3])/d]),m=f*c.getGutterForProjection(i);for(const i of w[e]){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=e===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(t.usedTiles,c,i);continue}const w=[p,f,p+y,f+v],_=[];for(let t=0,i=T.length;t<i;++t)e<L[t]&&zZ(w,T[t])&&_.push(T[t]);let x;_.length>0&&(x=$Z(w,_)),T.push(w),L.push(e),this.drawTile(i,t,p,f,y,v,m,b,x),this.renderedTiles.unshift(i),this.updateUsedTiles(t.usedTiles,c,i)}}for(let P=0,M=I.length;P<M;++P){const{tile:e,x:n,y:r,w:i,h:s,gutter:o}=I[P];this.drawTile(e,t,n,r,i,s,o,!0,void 0)}if(this.renderedResolution=d,this.extentChanged=!this.renderedExtent_||!vZ(this.renderedExtent_,b),this.renderedExtent_=b,this.renderedPixelRatio=a,this.postRender(this.context,t),this.layerExtent&&E.restore(),E.imageSmoothingEnabled=!0,this.renderComplete){const e=(t,e)=>{const n=mG(c),r=e.wantedTiles[n],i=r?Object.keys(r).length:0;this.updateCacheSize(i),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(e)}return this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,2*t)}drawTile(t,e,n,r,i,s,o,a,l){let c;if(t instanceof D7){if(c=O7(t.getData()),!c)throw new Error("Rendering array data is not yet supported")}else c=this.getTileImage(t);if(!c)return;const u=this.getRenderContext(e),h=mG(this),d=e.layerStatesArray[e.layerIndex],p=d.opacity*(a?t.getAlpha(h,e.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 t=g/i,e=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)*t,o+(h-r)*e,d*t,p*e,a,h,d,p)}}else u.drawImage(c,o,o,g,m,n,r,i,s);f&&u.restore(),p!==d.opacity?e.animate=!0:a&&t.endTransition(h)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}updateUsedTiles(t,e,n){const r=mG(e);r in t||(t[r]={}),t[r][n.getKey()]=!0}},n9="preload",r9="useInterimTilesOnError",i9=class extends VJ{constructor(t){t=t||{};const e=Object.assign({},t),n=t.cacheSize;delete t.cacheSize,delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=n,this.setPreload(void 0!==t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(n9)}setPreload(t){this.set(n9,t)}getUseInterimTilesOnError(){return this.get(r9)}setUseInterimTilesOnError(t){this.set(r9,t)}getData(t){return super.getData(t)}},s9=class extends i9{constructor(t){super(t)}createRenderer(){return new e9(this,{cacheSize:this.getCacheSize()})}},o9={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},a9={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]},l9=class extends e9{constructor(t,e){super(t,e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=dY(),this.tileClipContexts_=null}enqueueTilesForNextExtent(){return"vector"!==this.getLayer().getRenderMode()}drawTile(t,e,n,r,i,s,o,a,l){this.updateExecutorGroup_(t,e.pixelRatio,e.viewState.projection),this.tileImageNeedsRender_(t)&&this.renderTileImage_(t,e),super.drawTile(t,e,n,r,i,s,o,a,l)}getTile(t,e,n,r){const i=this.getOrCreateTile(t,e,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)===t;return u&&h?i.wantedResolution=o:i.wantedResolution||(i.wantedResolution=c.getResolution(t)),i}prepareFrame(t){const e=this.getLayer().getRevision();return this.renderedLayerRevision_!==e&&(this.renderedLayerRevision_=e,this.renderedTiles.length=0),super.prepareFrame(t)}updateExecutorGroup_(t,e,n){const r=this.getLayer(),i=r.getRevision(),s=r.getRenderOrder()||null,o=t.wantedResolution,a=t.getReplayState(r);if(!a.dirty&&a.renderedResolution===o&&a.renderedRevision==i&&a.renderedPixelRatio===e&&a.renderedRenderOrder==s)return;const l=r.getSource(),c=!!r.getDeclutter(),u=l.getTileGrid(),h=l.getTileGridForProjection(n).getTileCoordExtent(t.wrappedTileCoord),d=l.getSourceTiles(e,n,t),p=mG(r);delete t.hitDetectionImageData[p],t.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&&!eY(n,g)&&(y=oY(y,g,n,32));const v=MZ(h,y),b=aZ(v,r.getRenderBuffer()*o,this.tempExtent),w=vZ(y,v)?null:b,_=new X2(0,v,o,e),x=R3(o,e),C=function(t,e){let n;const i=t.getStyleFunction()||r.getStyleFunction();if(i&&(n=i(t,o)),n){const r=this.renderFeature(t,x,n,_,c,e);a.dirty=a.dirty||r}},S=i.getFeatures();s&&s!==a.renderedRenderOrder&&S.sort(s);for(let t=0,e=S.length;t<e;++t){let e=S[t];n&&i.projection&&!eY(n,i.projection)&&(e=e.clone(),e.getGeometry().applyTransform(iY(i.projection,n))),w&&!zZ(w,e.getGeometry().getExtent())||C.call(this,e,t)}const k=_.finish(),E="vector"!==r.getRenderMode()&&c&&1===d.length?null:v,R=new b3(E,o,e,l.getOverlaps(),k,r.getRenderBuffer(),!0);t.executorGroups[p].push(R)}a.renderedRevision=i,a.renderedPixelRatio=e,a.renderedRenderOrder=s,a.renderedResolution=o}forEachFeatureAtCoordinate(t,e,n,r,i){const s=e.viewState.resolution,o=e.viewState.rotation;n=null==n?0:n;const a=this.getLayer(),l=a.getSource().getTileGridForProjection(e.viewState.projection),c=a.getRenderBuffer(),u=oZ([t]);aZ(u,s*(c+n),u);const h={},d=function(t,e,n){let s=t.getId();void 0===s&&(s=mG(t));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(t,a,e);o.geometry=e,o.distanceSq=n}}else{if(0===n)return h[s]=!0,r(t,a,e);i.push(h[s]={feature:t,layer:a,geometry:e,distanceSq:n,callback:r})}},p=this.renderedTiles,f=mG(a),g=a.getDeclutter(),m=g?e.declutter?.[g]?.all().map(t=>t.value):null;let y;t:for(let v=p.length-1;v>=0;--v){const e=p[v];if(!zZ(l.getTileCoordExtent(e.wrappedTileCoord),u))continue;const r=e.executorGroups[f];for(let i=0,a=r.length;i<a;++i)if(y=r[i].forEachFeatureAtCoordinate(t,s,o,n,d,m),y)break t}return y}getFeatures(t){return 0===this.renderedTiles.length?Promise.resolve([]):new Promise(e=>{const n=this.getLayer(),r=n.getSource(),i=this.renderedProjection,s=i.getExtent(),o=this.renderedResolution,a=r.getTileGridForProjection(i),l=mY(this.renderedPixelToCoordinateTransform_,t.slice()),c=a.getTileCoordForCoordAndResolution(l,o).toString(),u=this.renderedTiles.find(t=>t.tileCoord.toString()===c&&2===t.getState());if(!u||u.loadingSourceTiles>0)return void e([]);r.getWrapX()&&i.canWrapX()&&!hZ(s,a.getTileCoordExtent(u.tileCoord))&&WZ(l,i);const h=mG(n),d=OZ(a.getTileCoordExtent(u.wrappedTileCoord)),p=[(l[0]-d[0])/o,(d[1]-l[1])/o],f=u.getSourceTiles().reduce((t,e)=>t.concat(e.getFeatures()),[]);let g=u.hitDetectionImageData[h];if(!g){const t=PQ(a.getTileSize(a.getZForResolution(o,r.zDirection))),e=this.renderedRotation_;g=C3(t,[this.getRenderTransform(a.getTileCoordCenter(u.wrappedTileCoord),o,0,x3,t[0]*x3,t[1]*x3,0)],f,n.getStyleFunction(),a.getTileCoordExtent(u.wrappedTileCoord),u.getReplayState(n).renderedResolution,e),u.hitDetectionImageData[h]=g}e(S3(p,f,g))})}getFeaturesInExtent(t){const e=[],n=this.getTileCache();if(0===n.getCount())return e;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(zZ(t,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();zZ(t,s.getExtent())&&e.push(i)}}}}),e}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&void 0!==this.renderedLayerRevision_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}renderDeclutter(t,e){const n=this.context,r=n.globalAlpha;n.globalAlpha=e.opacity;const i=t.viewHints,s=!(i[0]||i[1]),o=[this.context.canvas.width,this.context.canvas.height],a=this.getLayer().getDeclutter(),l=a?t.declutter?.[a]:void 0,c=mG(this.getLayer()),u=this.renderedTiles;for(let h=0,d=u.length;h<d;++h){const e=u[h],n=e.executorGroups[c];if(n)for(let r=n.length-1;r>=0;--r)n[r].execute(this.context,o,this.getTileRenderTransform(e,t),t.viewState.rotation,s,g3,l)}n.globalAlpha=r}renderDeferredInternal(t){const e=this.renderedTiles,n=mG(this.getLayer()),r=e.reduce((t,e,r)=>(e.executorGroups[n].forEach(e=>t.push({executorGroup:e,index:r})),t),[]),i=r.map(({executorGroup:t})=>t.getDeferredZIndexContexts()),s={};for(let a=0,l=r.length;a<l;++a){const t=r[a].executorGroup.getDeferredZIndexContexts();for(const e in t)s[e]=!0}const o=Object.keys(s).map(Number).sort(tG);this.layerExtent&&this.clipUnrotated(this.context,t,this.layerExtent),o.forEach(t=>{i.forEach((e,n)=>{e[t]&&(e[t].forEach(t=>{const{executorGroup:e,index:i}=r[n],s=e.getRenderedContext(),o=s.globalAlpha;s.globalAlpha=this.renderedOpacity_;const a=this.tileClipContexts_[i];a&&a.draw(s),t.draw(s),a&&s.restore(),s.globalAlpha=o,t.clear()}),e[t].length=0)})}),this.layerExtent&&this.context.restore()}getTileRenderTransform(t,e){const n=e.pixelRatio,r=e.viewState,i=r.center,s=r.resolution,o=r.rotation,a=e.size,l=Math.round(a[0]*n),c=Math.round(a[1]*n),u=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),h=t.tileCoord,d=u.getTileCoordExtent(t.wrappedTileCoord),p=u.getTileCoordExtent(h,this.tempExtent)[0]-d[0];return fY(yY(this.inversePixelTransform.slice(),1/n,1/n),this.getRenderTransform(i,s,o,n,l,c,p))}clipTileContext_(t,e,n,r,i,s){const o=[];for(let l=0,c=n.length;l<c;++l)i<r[l]&&zZ(e,n[l])&&o.push(n[l]);if(0===o.length)return!1;const a=$Z(e,o);t.save(),t.beginPath();for(let l=0,c=a.length;l<c;++l){const e=a[l],n=mY(s,[e[0],e[1]]),r=mY(s,[e[0],e[3]]),i=mY(s,[e[2],e[3]]),o=mY(s,[e[2],e[1]]);t.moveTo(n[0],n[1]),t.lineTo(r[0],r[1]),t.lineTo(i[0],i[1]),t.lineTo(o[0],o[1]),t.closePath()}return t.clip(),!0}postRender(t,e){const n=e.viewHints,r=!(n[0]||n[1]);this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation,this.renderedOpacity_=e.layerStatesArray[e.layerIndex].opacity;const i=this.getLayer(),s=i.getRenderMode(),o=t.globalAlpha;t.globalAlpha=this.renderedOpacity_;const a=i.getDeclutter(),l=a?a9[s].filter(t=>!g3.includes(t)):a9[s],c=e.viewState,u=c.rotation;this.layerExtent&&this.clipUnrotated(t,e,this.layerExtent);const h=i.getSource(),d=h.getTileGridForProjection(c.projection).getZForResolution(c.resolution,h.zDirection),p=this.renderedTiles,f=[],g=[],m=[],y=mG(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(t=>t.hasExecutors(l));if(0===s.length)continue;const o=this.getTileRenderTransform(n,e),c=n.tileCoord[0];let h=!1;const w=s[0].getClipCoords(uY);let _,x=t;if(w){const t=[w[0],w[1],w[4],w[5]];_=new n3,x=_.getContext(),d!==c&&(h=this.clipTileContext_(x,t,f,g,c,o)),f.push(t),g.push(c)}for(let i=0,d=s.length;i<d;++i)s[i].execute(t,[t.canvas.width,t.canvas.height],o,u,r,l,e.declutter?.[a]);h&&(x===t?x.restore():m[b]=_)}this.layerExtent&&t.restore(),t.globalAlpha=o,this.ready=v,this.tileClipContexts_=m,e.declutter||this.renderDeferredInternal(e),super.postRender(t,e)}renderFeature(t,e,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=L3(r,t,n[a],e,this.boundHandleStyleImageChange_,void 0,i,s)||o;else o=L3(r,t,n,e,this.boundHandleStyleImageChange_,void 0,i,s);return o}tileImageNeedsRender_(t){const e=this.getLayer();if("vector"===e.getRenderMode())return!1;const n=t.getReplayState(e),r=e.getRevision(),i=t.wantedResolution;return n.renderedTileResolution!==i||n.renderedTileRevision!==r}renderTileImage_(t,e){const n=this.getLayer(),r=t.getReplayState(n),i=n.getRevision(),s=t.executorGroups[mG(n)];r.renderedTileRevision=i;const o=t.wrappedTileCoord,a=o[0],l=n.getSource();let c=e.pixelRatio;const u=e.viewState.projection,h=l.getTileGridForProjection(u),d=h.getResolution(t.tileCoord[0]),p=e.pixelRatio/t.wantedResolution*d,f=h.getResolution(a),g=t.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 t=pY(this.tmpTransform_);yY(t,y,y),g.setTransform.apply(g,t)}const v=h.getTileCoordExtent(o,this.tempExtent),b=p/f,w=pY(this.tmpTransform_);yY(w,b,-b),function(t,e,n){fY(t,gY(hY,1,0,0,1,e,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,o9[n.getRenderMode()],null);r.renderedTileResolution=t.wantedResolution}},c9=class extends d2{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload;const n=void 0===t.cacheSize?0:t.cacheSize;delete t.cacheSize,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=n;const r=t.renderMode||"hybrid";$G("hybrid"==r||"vector"==r,"`renderMode` must be `'hybrid'` or `'vector'`"),this.renderMode_=r,this.setPreload(t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError),this.getBackground,this.setBackground}createRenderer(){return new l9(this,{cacheSize:this.cacheSize_})}getFeatures(t){return super.getFeatures(t)}getFeaturesInExtent(t){return this.getRenderer().getFeaturesInExtent(t)}getRenderMode(){return this.renderMode_}getPreload(){return this.get(n9)}getUseInterimTilesOnError(){return this.get(r9)}setPreload(t){this.set(n9,t)}setUseInterimTilesOnError(t){this.set(r9,t)}},u9=[0,0,0],h9=class{constructor(t){let e=t.minZoom;const n=t.resolutions;let r;if(void 0===e&&n&&(e=n.findIndex(t=>void 0!==t)),this.minZoom=void 0!==e?e:0,this.resolutions_=n,$G(function(t){const e=((t,e)=>e-t)||tG;return t.every(function(n,r){if(0===r)return!0;const i=e(t[r-1],n);return!(i>0||0===i)})}(this.resolutions_),"`resolutions` must be sorted in descending order"),!t.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!==t.origin?t.origin:null,this.origins_=null,void 0!==t.origins&&(this.origins_=t.origins,$G(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const i=t.extent;void 0===i||this.origin_||this.origins_||(this.origin_=OZ(i)),$G(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,void 0!==t.tileSizes&&(this.tileSizes_=t.tileSizes,$G(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=void 0!==t.tileSize?t.tileSize:this.tileSizes_?null:256,$G(!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!==t.tileRanges?this.fullTileRanges_=t.tileRanges:void 0!==t.sizes?this.fullTileRanges_=t.sizes.map((t,e)=>{const n=new U7(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1));if(i){const t=this.getTileRangeForExtentAndZ(i,e);n.minX=Math.max(t.minX,n.minX),n.maxX=Math.min(t.maxX,n.maxX),n.minY=Math.max(t.minY,n.minY),n.maxY=Math.min(t.maxY,n.maxY)}return n}):i&&this.calculateTileRanges_(i)}forEachTileCoord(t,e,n){const r=this.getTileRangeForExtentAndZ(t,e);for(let i=r.minX,s=r.maxX;i<=s;++i)for(let t=r.minY,o=r.maxY;t<=o;++t)n([e,i,t])}forEachTileCoordParentTileRange(t,e,n,r){let i,s,o,a=null,l=t[0]-1;for(2===this.zoomFactor_?(s=t[1],o=t[2]):a=this.getTileCoordExtent(t,r);l>=this.minZoom;){if(void 0!==s&&void 0!==o?(s=Math.floor(s/2),o=Math.floor(o/2),i=B7(s,s,o,o,n)):i=this.getTileRangeForExtentAndZ(a,l,n),e(l,i))return!0;--l}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getOrigins(){return this.origins_}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,n){if(t[0]<this.maxZoom){if(2===this.zoomFactor_){const n=2*t[1],r=2*t[2];return B7(n,n+1,r,r+1,e)}const r=this.getTileCoordExtent(t,n||this.tmpExtent_);return this.getTileRangeForExtentAndZ(r,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,n){if(e>this.maxZoom||e<this.minZoom)return null;const r=t[0],i=t[1],s=t[2];if(e===r)return B7(i,s,i,s,n);if(this.zoomFactor_){const t=Math.pow(this.zoomFactor_,e-r),o=Math.floor(i*t),a=Math.floor(s*t);return e<r?B7(o,o,a,a,n):B7(o,Math.floor(t*(i+1))-1,a,Math.floor(t*(s+1))-1,n)}const o=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(o,e,n)}getTileRangeForExtentAndZ(t,e,n){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,u9);const r=u9[1],i=u9[2];return this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,u9),B7(r,u9[1],i,u9[2],n)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),n=this.getResolution(t[0]),r=PQ(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*r[0]*n,e[1]-(t[2]+.5)*r[1]*n]}getTileCoordExtent(t,e){const n=this.getOrigin(t[0]),r=this.getResolution(t[0]),i=PQ(this.getTileSize(t[0]),this.tmpSize_),s=n[0]+t[1]*i[0]*r,o=n[1]-(t[2]+1)*i[1]*r;return fZ(s,o,s+i[0]*r,o+i[1]*r,e)}getTileCoordForCoordAndResolution(t,e,n){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,n)}getTileCoordForXYAndResolution_(t,e,n,r,i){const s=this.getZForResolution(n),o=n/this.getResolution(s),a=this.getOrigin(s),l=PQ(this.getTileSize(s),this.tmpSize_);let c=o*(t-a[0])/n/l[0],u=o*(a[1]-e)/n/l[1];return r?(c=nZ(c,5)-1,u=nZ(u,5)-1):(c=eZ(c,5),u=eZ(u,5)),Y7(s,c,u,i)}getTileCoordForXYAndZ_(t,e,n,r,i){const s=this.getOrigin(n),o=this.getResolution(n),a=PQ(this.getTileSize(n),this.tmpSize_);let l=(t-s[0])/o/a[0],c=(s[1]-e)/o/a[1];return r?(l=nZ(l,5)-1,c=nZ(c,5)-1):(l=eZ(l,5),c=eZ(c,5)),Y7(n,l,c,i)}getTileCoordForCoordAndZ(t,e,n){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,n)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){return GG(nG(this.resolutions_,t,e||0),this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return ZY(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,n=new Array(e);for(let r=this.minZoom;r<e;++r)n[r]=this.getTileRangeForExtentAndZ(t,r);this.fullTileRanges_=n}};function d9(t){let e=t.getDefaultTileGrid();return e||(e=function(t){return function(t,e,n,r){r=void 0!==r?r:"top-left";const i=f9(t,void 0,n);return new h9({extent:t,origin:TZ(t,r),resolutions:i,tileSize:n})}(g9(t),0,void 0,void 0)}(t),t.setDefaultTileGrid(e)),e}function p9(t){const e=t||{},n=e.extent||KK("EPSG:3857").getExtent(),r={extent:n,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:f9(n,e.maxZoom,e.tileSize,e.maxResolution)};return new h9(r)}function f9(t,e,n,r){e=void 0!==e?e:42,n=PQ(void 0!==n?n:256);const i=PZ(t),s=FZ(t);r=r>0?r:Math.max(s/n[0],i/n[1]);const o=e+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=r/Math.pow(2,l);return a}function g9(t){let e=(t=KK(t)).getExtent();if(!e){const n=180*QZ.degrees/t.getMetersPerUnit();e=fZ(-n,-n,n,n)}return e}var m9=/\{z\}/g,y9=/\{x\}/g,v9=/\{y\}/g,b9=/\{-y\}/g;function w9(t,e){return function(n){if(!n)return;let r;const i=n[0];if(e){const t=e.getFullTileRange(i);t&&(r=t.getHeight()-1)}return function(t,e,n,r,i){return t.replace(m9,e.toString()).replace(y9,n.toString()).replace(v9,r.toString()).replace(b9,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()})}(t,i,n[1],n[2],r)}}function _9(t,e){const n=t.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=w9(t[i],e);return function(t){return 1===t.length?t[0]:function(e,n,r){if(!e)return;const i=function(t){return function(t,e,n){return(e<<t)+n}(t[0],t[1],t[2])}(e);return t[JG(i,t.length)](e,n,r)}}(r)}var x9=class extends V3{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=void 0!==t.tilePixelRatio?t.tilePixelRatio:1,this.tileGrid=void 0!==t.tileGrid?t.tileGrid:null,this.tileGrid&&PQ(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),[256,256]),this.tmpSize=[0,0],this.key_=t.key||mG(this),this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,n,r,i,s){return fG()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:d9(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,n){const r=this.getTileGridForProjection(n),i=this.getTilePixelRatio(e),s=PQ(r.getTileSize(t),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(t,e){const n=void 0!==e?e:this.getProjection(),r=void 0!==e?this.getTileGridForProjection(n):this.tileGrid||this.getTileGridForProjection(n);return this.getWrapX()&&n.isGlobal()&&(t=function(t,e,n){const r=e[0],i=t.getTileCoordCenter(e),s=g9(n);if(!uZ(s,i)){const e=FZ(s),n=Math.ceil((s[0]-i[0])/e);return i[0]+=e*n,t.getTileCoordForCoordAndZ(i,r)}return e}(r,t,n)),function(t,e){const n=t[0],r=t[1],i=t[2];if(e.getMinZoom()>n||n>e.getMaxZoom())return!1;const s=e.getFullTileRange(n);return!s||s.containsXY(r,i)}(t,r)?t:null}clear(){}refresh(){this.clear(),super.refresh()}},C9=class extends hG{constructor(t,e){super(t),this.tile=e}},S9=class t extends x9{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===t.prototype.tileUrlFunction,this.tileLoadFunction=e.tileLoadFunction,e.tileUrlFunction&&(this.tileUrlFunction=e.tileUrlFunction),this.urls=null,e.urls?this.setUrls(e.urls):e.url&&this.setUrl(e.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(t){const e=t.target,n=mG(e),r=e.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 C9(i,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,void 0!==e?this.setKey(e):this.changed()}setUrl(t){const e=function(t){const e=[];let n=/\{([a-z])-([a-z])\}/.exec(t);if(n){const r=n[1].charCodeAt(0),i=n[2].charCodeAt(0);let s;for(s=r;s<=i;++s)e.push(t.replace(n[0],String.fromCharCode(s)));return e}if(n=/\{(\d+)-(\d+)\}/.exec(t),n){const r=parseInt(n[2],10);for(let i=parseInt(n[1],10);i<=r;i++)e.push(t.replace(n[0],i.toString()));return e}return e.push(t),e}(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(_9(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,n){}},k9=class extends S9{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:E9,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:void 0===t.interpolate||t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=void 0!==t.crossOrigin?t.crossOrigin:null,this.referrerPolicy=t.referrerPolicy,this.tileClass=void 0!==t.tileClass?t.tileClass:j7,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){return this.getProjection()&&t&&!eY(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||eY(e,t)))return this.tileGrid;const n=mG(t);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=d9(t)),this.tileGridForProjection[n]}createTile_(t,e,n,r,i,s){const o=[t,e,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(HH,this.handleTileChange.bind(this)),c}getTile(t,e,n,r,i,s){const o=this.getProjection();if(!o||!i||eY(o,i))return this.getTileInternal(t,e,n,r,o||i);const a=[t,e,n],l=this.getKey(),c=this.getTileGridForProjection(o),u=this.getTileGridForProjection(i),h=this.getTileCoordForTileUrlFunction(a,i),d=new Z7(o,c,i,u,a,h,this.getTilePixelRatio(r),this.getGutter(),(t,e,n,r)=>this.getTileInternal(t,e,n,r,o,s),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return d.key=l,d}getTileInternal(t,e,n,r,i,s){const o=this.getKey(),a=X7(this,o,t,e,n);if(s&&s.containsKey(a))return s.get(a);const l=this.createTile_(t,e,n,r,i,o);return s?.set(a,l),l}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const n=KK(t);if(n){const t=mG(n);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}};function E9(t,e){if(LG){const n=t.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:t.getReferrerPolicy()};return void fetch(e,s).then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.blob()}).then(t=>createImageBitmap(t)).then(e=>{const n=t.getImage();n.width=e.width,n.height=e.height,n.getContext("2d").drawImage(e,0,0),e.close?.(),n.dispatchEvent(new Event("load"))}).catch(()=>{t.getImage().dispatchEvent(new Event("error"))})}t.getImage().src=e}var R9=class extends k9{constructor(t){if(super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:KK("EPSG:3857"),reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.tileJSON_=null,this.tileSize_=t.tileSize,t.url)if(t.jsonp)!function(t,e,n){const r=document.createElement("script"),i="olc_"+mG(e);function s(){delete window[i],r.parentNode.removeChild(r)}r.async=!0,r.src=t+(t.includes("?")?"&":"?")+"callback="+i;const o=setTimeout(function(){s(),n&&n()},1e4);window[i]=function(t){clearTimeout(o),s(),e(t)},document.head.appendChild(r)}(t.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const e=new XMLHttpRequest;e.addEventListener("load",this.onXHRLoad_.bind(this)),e.addEventListener("error",this.onXHRError_.bind(this)),e.open("GET",t.url),e.send()}else{if(!t.tileJSON)throw new Error("Either `url` or `tileJSON` options must be provided");this.handleTileJSONResponse(t.tileJSON)}}onXHRLoad_(t){const e=t.target;if(!e.status||e.status>=200&&e.status<300){let t;try{t=JSON.parse(e.responseText)}catch{return void this.handleTileJSONError()}this.handleTileJSONResponse(t)}else this.handleTileJSONError()}onXHRError_(t){this.handleTileJSONError()}getTileJSON(){return this.tileJSON_}handleTileJSONResponse(t){const e=KK("EPSG:4326"),n=this.getProjection();let r;if(void 0!==t.bounds){const i=nY(e,n);r=jZ(t.bounds,i)}const i=g9(n),s=t.minzoom||0,o=p9({extent:i,maxZoom:t.maxzoom||22,minZoom:s,tileSize:this.tileSize_});if(this.tileGrid=o,this.tileUrlFunction=_9(t.tiles,o),t.attribution&&!this.getAttributions()){const e=void 0!==r?r:i;this.setAttributions(function(n){return zZ(e,n.extent)?[t.attribution]:null})}this.tileJSON_=t,this.setState("ready")}handleTileJSONError(){this.setState("error")}},T9=[],L9=class extends A7{constructor(t,e,n,r,i){super(t,e,{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_=MX(1,1,T9)),this.context_}hasContext(){return!!this.context_}getImage(){return this.hasContext()?this.getContext().canvas:null}getReplayState(t){const e=mG(t);return e in this.replayState_||(this.replayState_[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedPixelRatio:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[e]}load(){this.getSourceTiles()}release(){this.context_&&(OX(this.context_),T9.push(this.context_.canvas),this.context_=null),this.removeSourceTiles_(this),this.sourceTiles.length=0,super.release()}},I9=class extends A7{constructor(t,e,n,r,i,s){super(t,e,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(t,e){this.setFeatures(t)}onError(){this.setState(3)}setFeatures(t){this.features_=t,this.setState(2)}setLoader(t){this.loader_=t}},P9=class extends S9{constructor(t){const e=t.projection||"EPSG:3857",n=t.extent||g9(e),r=t.tileGrid||p9({extent:n,maxResolution:t.maxResolution,maxZoom:void 0!==t.maxZoom?t.maxZoom:22,minZoom:t.minZoom,tileSize:t.tileSize||512});super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,interpolate:!0,projection:e,state:t.state,tileGrid:r,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:M9,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:void 0===t.zDirection?1:t.zDirection}),this.format_=t.format?t.format:null,this.tileKeysBySourceTileUrl_={},this.sourceTiles_={},this.overlaps_=null==t.overlaps||t.overlaps,this.tileClass=t.tileClass?t.tileClass:I9,this.tileGrids_={}}getOverlaps(){return this.overlaps_}getSourceZ_(t,e,n){const r=this.projection,i=e&&r&&!eY(e,r)?t/r.getMetersPerUnit()*e.getMetersPerUnit():t;return this.tileGrid.getZForResolution(i,n)}getSourceTiles(t,e,n,r){if(0===n.getState()){n.setState(1);const i=n.wrappedTileCoord,s=this.getTileGridForProjection(e);let o=s.getTileCoordExtent(i);const a=i[0],l=s.getResolution(a);aZ(o,-l,o);const c=this.projection;e&&this.projection&&!eY(e,c)&&(o=oY(o,e,c));const u=this.tileGrid,h=u.getExtent();h&&MZ(o,h,o);const d=this.getSourceZ_(l,e,this.zDirection),p=r||this.tileUrlFunction;u.forEachTileCoord(o,d,r=>{const i=p(r,t,e);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 t=e=>{this.handleTileChange(e);const r=s.getState();if(2===r||3===r){const e=s.getKey();e in n.errorTileKeys?2===s.getState()&&delete n.errorTileKeys[e]:n.loadingSourceTiles--,3===r?n.errorTileKeys[e]=!0:s.removeEventListener(HH,t),0===n.loadingSourceTiles&&n.setState($H(n.errorTileKeys)?2:3)}};s.addEventListener(HH,t),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(t=>3===t.getState())?3:2)}return n.sourceTiles}removeSourceTiles(t){const e=t.getKey(),n=t.sourceTiles;for(let r=0,i=n.length;r<i;++r){const t=n[r].getTileUrl();if(!this.tileKeysBySourceTileUrl_[t])return;const i=this.tileKeysBySourceTileUrl_[t].indexOf(e);-1!==i&&(this.tileKeysBySourceTileUrl_[t].splice(i,1),0===this.tileKeysBySourceTileUrl_[t].length&&(delete this.tileKeysBySourceTileUrl_[t],delete this.sourceTiles_[t]))}}getTile(t,e,n,r,i){const s=[t,e,n];let o=this.getTileCoordForTileUrlFunction(s,i);const a=this.getTileGrid().getExtent(),l=this.projection,c=this.getTileGridForProjection(i);if(o&&a){const e=c.getTileCoordExtent(o);aZ(e,-c.getResolution(t),e),zZ(a,i&&l&&!eY(i,l)?oY(e,i,l):e)||(o=null)}let u=!0;if(null!==o){const e=this.tileGrid,n=c.getResolution(t),s=this.getSourceZ_(n,i,1),a=c.getTileCoordExtent(o);aZ(a,-n,a),e.forEachTileCoord(i&&l&&!eY(i,l)?oY(a,i,l):a,s,t=>{u=u&&!this.tileUrlFunction(t,r,l)})}const h=this.tileUrlFunction,d=new L9(s,u?4:0,o,t=>this.getSourceTiles(r,i,t,h),this.removeSourceTiles.bind(this));return d.key=this.getKey(),d}getTileGridForProjection(t){const e=t.getCode();let n=this.tileGrids_[e];if(!n){const r=this.projection;if(null!==r&&!eY(r,t))return d9(t);const i=this.tileGrid,s=i.getResolutions().slice(),o=s.map(function(t,e){return i.getOrigin(e)}),a=s.map(function(t,e){return i.getTileSize(e)}),l=43;for(let t=s.length;t<l;++t)s.push(s[t-1]/2),o.push(o[t-1]),a.push(a[t-1]);n=new h9({extent:i.getExtent(),origins:o,resolutions:s,tileSizes:a}),this.tileGrids_[e]=n}return n}getTilePixelRatio(t){return t}getTilePixelSize(t,e,n){const r=PQ(this.getTileGridForProjection(n).getTileSize(t),this.tmpSize);return[Math.round(r[0]*e),Math.round(r[1]*e)]}setOverlaps(t){this.overlaps_=t,this.changed()}};function M9(t,e){t.setLoader(function(n,r,i){z3(e,t.getFormat(),n,r,i,t.onLoad.bind(t),t.onError.bind(t))})}function A9(t,e){const n=e[0].evaluate(t),r=e[1].evaluate(t),i=e[2].evaluate(t),s=e[3]?e[3].evaluate(t):1;return w4.parse(`hsla(${n}, ${r}%, ${i}%, ${s})`)}function O9(t){if(Array.isArray(t)){if(0===t.length)return t;const e=t[0];if("literal"===e)return t;if("image"===e&&3===t.length&&"object"==typeof t[2]&&null!==t[2]&&!Array.isArray(t[2]))return["image-config",O9(t[1]),["literal",t[2]]];const n=t.length;for(let r=1;r<n;++r){const i=t[r],s=O9(i);if(s!==i){const i=[e];for(let e=1;e<r;++e)i.push(t[e]);i.push(s);for(let e=r+1;e<n;++e)i.push(O9(t[e]));return i}}}return t}var N9={},F9={zoom:0,distanceFromCenter:0};n8.register(e8,{...n8.definitions,pitch:[{kind:"number"},[],()=>F9.pitch||0],"distance-from-center":[{kind:"number"},[],()=>F9.distanceFromCenter||0],"to-hsla":[{kind:"array",itemType:{kind:"number"},N:4},[{kind:"string"}],(t,[e])=>function(t){const e=t[0]/255,n=t[1]/255,r=t[2]/255,i=t[3],s=Math.max(e,n,r),o=Math.min(e,n,r),a=(s+o)/2;let l,c;if(s===o)l=0,c=0;else{const t=s-o;switch(c=a>.5?t/(2-s-o):t/(s+o),s){case e:l=(n-r)/t+(n<r?6:0);break;case n:l=(r-e)/t+2;break;case r:l=(e-n)/t+4;break;default:l=0}l/=6}return[360*l,100*c,100*a,i]}(RQ(e.evaluate(t)))],hsl:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"}],A9],hsla:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"},{kind:"number"}],A9],"image-config":[{kind:"value"},[{kind:"string"},{kind:"value"}],(t,[e,n])=>e.evaluate(t)],"measure-light":[{kind:"number"},[{kind:"value"}],()=>1],config:[{kind:"value"},[{kind:"string"}],(t,[e])=>{const n=N9[e.evaluate(t)];return void 0===n?{}:n}]});var z9="https://api.mapbox.com";function D9(t){return 0!==t.indexOf("mapbox://")?"":t.slice(9)}function j9(t,e,n){const r=D9(t);if(!e||!r)return decodeURI(new URL(t,n).href);if(0!==r.indexOf("sprites/"))throw new Error(`unexpected sprites url: ${t}`);const i=r.slice(8);return`${z9}/styles/v1/${i}/sprite?access_token=${e}`}function U9(t,e){const n=D9(t);if(!n||!e)return decodeURI(new URL(t,location.href).href);if(0!==n.indexOf("styles/"))throw new Error(`unexpected style url: ${t}`);const r=n.slice(7);return`${z9}/styles/v1/${r}?&access_token=${e}`}var B9=["a","b","c","d"];function $9(t,e,n,r){const i=new URL(t,r||location.href),s=D9(t);return s?"mapbox.satellite"===s?[`https://api.mapbox.com/v4/${s}/{z}/{x}/{y}${window.devicePixelRatio>=1.5?"@2x":""}.webp?access_token=${e}`]:B9.map(t=>`https://${t}.tiles.mapbox.com/v4/${s}/{z}/{x}/{y}.vector.pbf?access_token=${e}`):e?(i.searchParams.has(n)||i.searchParams.set(n,e),[decodeURI(i.href)]):[decodeURI(i.href)]}var q9=class extends O3{constructor(t){super(t),this.image=null,this.renderedSourceRevision_=0}getImage(){return this.image?this.image.getImage():null}prepareFrame(t){const e=t.layerStatesArray[t.layerIndex],n=t.pixelRatio,r=t.viewState,i=r.resolution,s=this.getLayer().getSource(),o=t.viewHints;let a=t.extent;if(void 0!==e.extent&&(a=MZ(a,cY(e.extent,r.projection))),!o[0]&&!o[1]&&!DZ(a))if(s){this.getLayer().rendered||this.renderedSourceRevision_===s.getRevision()||(this.image=null),this.renderedSourceRevision_=s.getRevision();const t=r.projection,e=s.getImage(a,i,n,t);e&&(this.loadImage(e)?this.image=e:4===e.getState()&&(this.image=null))}else this.image=null;return!!this.image}getData(t){const e=this.frameState;if(!e)return null;const n=this.getLayer(),r=mY(e.pixelToCoordinateTransform,t.slice()),i=n.getExtent();if(i&&!uZ(i,r))return null;const s=this.image.getExtent(),o=this.image.getImage(),a=FZ(s),l=Math.floor(o.width*((r[0]-s[0])/a));if(l<0||l>=o.width)return null;const c=PZ(s),u=Math.floor(o.height*((s[3]-r[1])/c));return u<0||u>=o.height?null:this.getImageData(o,l,u)}renderFrame(t,e){const n=this.image,r=n.getExtent(),i=n.getResolution(),[s,o]=Array.isArray(i)?i:[i,i],a=n.getPixelRatio(),l=t.layerStatesArray[t.layerIndex],c=t.pixelRatio,u=t.viewState,h=u.center,d=u.resolution,p=c*s/(d*a),f=c*o/(d*a);this.prepareContainer(t,e);const g=this.context.canvas.width,m=this.context.canvas.height,y=this.getRenderContext(t);let v=!1,b=!0;if(l.extent){const e=cY(l.extent,u.projection);b=zZ(e,t.extent),v=b&&!hZ(e,t.extent),v&&this.clipUnrotated(y,t,e)}const w=n.getImage(),_=vY(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,t),b&&x>=.5&&C>=.5){const t=_[4],e=_[5],n=l.opacity;1!==n&&(y.save(),y.globalAlpha=n),y.drawImage(w,0,0,+w.width,+w.height,t,e,x,C),1!==n&&y.restore()}return this.postRender(this.context,t),v&&y.restore(),y.imageSmoothingEnabled=!0,this.container}},V9=class extends VJ{constructor(t){super(t=t||{})}},W9=class extends V9{constructor(t){super(t)}createRenderer(){return new q9(this)}getData(t){return super.getData(t)}},H9=class extends i1{constructor(t,e,n,r,i){super(t,e,n,void 0!==i?0:2),this.loader_=void 0!==i?i:null,this.canvas_=r,this.error_=null}getError(){return this.error_}handleLoad_(t){t?(this.error_=t,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 G9(t){return Array.isArray(t)?Math.min(...t):t}var Z9=class extends i1{constructor(t,e,n,r,i,s,o){let a=t.getExtent();a&&t.canWrapX()&&(a=a.slice(),a[0]=-1/0,a[2]=1/0);let l=e.getExtent();l&&e.canWrapX()&&(l=l.slice(),l[0]=-1/0,l[2]=1/0);const c=l?MZ(n,l):n,u=W7(t,e,RZ(c),r),h=new G7(t,e,c,a,.5*u,r),d=h.calculateSourceExtent(),p=DZ(d)?null:s(d,u,i),f=p?0:4,g=p?p.getPixelRatio():1;super(n,r,g,f),this.targetProj_=e,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 t=this.sourceImage_.getState();if(2==t){const t=FZ(this.targetExtent_)/this.targetResolution_,e=PZ(this.targetExtent_)/this.targetResolution_;this.canvas_=H7(t,e,this.sourcePixelRatio_,G9(this.sourceImage_.getResolution()),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_,!0)}this.state=t,this.changed()}load(){if(0==this.state){this.state=1,this.changed();const t=this.sourceImage_.getState();2==t||3==t?this.reproject_():(this.sourceListenerKey_=qH(this.sourceImage_,HH,()=>{const t=this.sourceImage_.getState();2!=t&&3!=t||(this.unlistenSource_(),this.reproject_())}),this.sourceImage_.load())}}unlistenSource_(){WH(this.sourceListenerKey_),this.sourceListenerKey_=null}},K9=class extends hG{constructor(t,e){super(t),this.image=e}},Y9=class extends V3{constructor(t){super({attributions:t.attributions,projection:t.projection,state:t.state,interpolate:void 0===t.interpolate||t.interpolate}),this.on,this.once,this.un,this.loader=t.loader||null,this.resolutions_=void 0!==t.resolutions?t.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=!!t.loader&&0===t.loader.length,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(t){this.resolutions_=t}findNearestResolution(t){const e=this.getResolutions();return e&&(t=e[nG(e,t,0)]),t}getImage(t,e,n,r){const i=this.getProjection();if(!i||!r||eY(i,r))return i&&(r=i),this.getImageInternal(t,e,n,r);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&eY(this.reprojectedImage_.getProjection(),r)&&this.reprojectedImage_.getResolution()==e&&vZ(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new Z9(i,r,t,e,n,(t,e,n)=>this.getImageInternal(t,e,n,i),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(t,e,n,r){if(this.loader){const i=function(t,e,n){const r=e/n,i=RZ(t),s=nZ(FZ(t)/r,4),o=nZ(PZ(t)/r,4);return LZ(i,r,0,[s+2*nZ(0*s/2,4),o+2*nZ(0*o/2,4)])}(t,e,n),s=this.findNearestResolution(e);if(this.image&&(this.static_||this.wantedProjection_===r&&(this.wantedExtent_&&hZ(this.wantedExtent_,i)||hZ(this.image.getExtent(),i))&&(this.wantedResolution_&&G9(this.wantedResolution_)===s||G9(this.image.getResolution())===s)))return this.image;this.wantedProjection_=r,this.wantedExtent_=i,this.wantedResolution_=s,this.image=new i1(i,s,n,this.loader),this.image.addEventListener(HH,this.handleImageChange.bind(this))}return this.image}handleImageChange(t){const e=t.target;let n;switch(e.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 K9(n,e))}};function X9(t){return function(e){const n=e.buffers,r=e.meta,i=e.imageOps,s=e.width,o=e.height,a=n.length,l=n[0].byteLength;if(i){const e=new Array(a);for(let t=0;t<a;++t)e[t]=new ImageData(new Uint8ClampedArray(n[t]),s,o);return t(e,r).data.buffer}const c=new Uint8ClampedArray(l),u=new Array(a),h=new Array(a);for(let t=0;t<a;++t)u[t]=new Uint8ClampedArray(n[t]),h[t]=[0,0,0,0];for(let d=0;d<l;d+=4){for(let t=0;t<a;++t){const e=u[t];h[t][0]=e[d],h[t][1]=e[d+1],h[t][2]=e[d+2],h[t][3]=e[d+3]}const e=t(h,r);c[d]=e[0],c[d+1]=e[1],c[d+2]=e[2],c[d+3]=e[3]}return c.buffer}}function J9(t,e){const n=Object.keys(t.lib||{}).map(function(e){return"const "+e+" = "+t.lib[e].toString()+";"}).concat(["const __minion__ = ("+X9.toString()+")(",t.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",e),r}var Q9=class extends QH{constructor(t){let e;super(),this.imageOps_=!!t.imageOps,e=0===t.threads?0:this.imageOps_?1:t.threads||1;const n=new Array(e);if(e)for(let r=0;r<e;++r)n[r]=J9(t,this.onWorkerMessage_.bind(this,r));else n[0]=function(t,e){const n=X9(t.operation);let r=!1;return{postMessage:function(t){setTimeout(function(){r||e({data:{buffer:n(t),meta:t.meta}})},0)},terminate:function(){r=!0}}}(t,this.onWorkerMessage_.bind(this,0));this.workers_=n,this.queue_=[],this.maxQueueLength_=t.queue||1/0,this.running_=0,this.dataLookup_={},this.job_=null}process(t,e,n){this.enqueue_({inputs:t,meta:e,callback:n}),this.dispatch_()}enqueue_(t){for(this.queue_.push(t);this.queue_.length>this.maxQueueLength_;)this.queue_.shift().callback(null,null)}dispatch_(){if(this.running_||0===this.queue_.length)return;const t=this.queue_.shift();this.job_=t;const e=t.inputs[0].width,n=t.inputs[0].height,r=t.inputs.map(function(t){return t.data.buffer}),i=this.workers_.length;if(this.running_=i,1===i)return void this.workers_[0].postMessage({buffers:r,meta:t.meta,imageOps:this.imageOps_,width:e,height:n},r);const s=t.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 t=0,e=r.length;t<e;++t)s.push(r[t].slice(i,i+o));this.workers_[a].postMessage({buffers:s,meta:t.meta,imageOps:this.imageOps_,width:e,height:n},s)}}onWorkerMessage_(t,e){this.disposed||(this.dataLookup_[t]=e.data,--this.running_,0===this.running_&&this.resolveJob_())}resolveJob_(){const t=this.job_,e=this.workers_.length;let n,r;if(1===e)n=new Uint8ClampedArray(this.dataLookup_[0].buffer),r=this.dataLookup_[0].meta;else{const i=t.inputs[0].data.length;n=new Uint8ClampedArray(i),r=new Array(e);const s=4*Math.ceil(i/4/e);for(let t=0;t<e;++t){const e=this.dataLookup_[t].buffer,i=t*s;n.set(new Uint8ClampedArray(e),i),r[t]=this.dataLookup_[t].meta}}this.job_=null,this.dataLookup_={},t.callback(null,new ImageData(n,t.inputs[0].width,t.inputs[0].height),r),this.dispatch_()}disposeInternal(){for(let t=0;t<this.workers_.length;++t)this.workers_[t].terminate();this.workers_.length=0}},ttt=class extends hG{constructor(t,e,n){super(t),this.extent=e.extent,this.resolution=e.viewState.resolution/e.pixelRatio,this.data=n}},ett=class extends Y9{constructor(t){super({interpolate:t.interpolate,projection:null}),this.on,this.once,this.un,this.processor_=null,this.operationType_=void 0!==t.operationType?t.operationType:"pixel",this.threads_=void 0!==t.threads?t.threads:1,this.layers_=function(t){const e=t.length,n=new Array(e);for(let r=0;r<e;++r)n[r]=itt(t[r]);return n}(t.sources);const e=this.changed.bind(this);for(let r=0,i=this.layers_.length;r<i;++r)this.layers_[r].addEventListener(HH,e);var n;this.useResolutions_=null!==t.resolutions,this.tileQueue_=new WG(function(){return 1},this.processSources_.bind(this)),this.requestedFrameState_,this.renderedImageCanvas_=null,this.renderedRevision_,this.frameState_={animate:!1,coordinateToPixelTransform:dY(),declutter:null,extent:null,index:0,layerIndex:0,layerStatesArray:(n=this.layers_,n.map(function(t){return t.getLayerState()})),pixelRatio:1,pixelToCoordinateTransform:dY(),postRenderFunctions:[],size:[0,0],tileQueue:this.tileQueue_,time:Date.now(),usedTiles:{},viewState:{rotation:0},viewHints:[],wantedTiles:{},mapId:mG(this),renderTargets:{}},this.setAttributions(function(e){const n=[];for(let r=0,i=t.sources.length;r<i;++r){const i=t.sources[r],s=i instanceof V3?i:i.getSource();if(!s)continue;const o=s.getAttributions()?.(e);"string"==typeof o?n.push(o):void 0!==o&&n.push(...o)}return n}),void 0!==t.operation&&this.setOperation(t.operation,t.lib)}setOperation(t,e){this.processor_&&this.processor_.dispose(),this.processor_=new Q9({operation:t,imageOps:"image"===this.operationType_,queue:1,lib:e,threads:this.threads_}),this.changed()}updateFrameState_(t,e,n){const r=Object.assign({},this.frameState_);r.viewState=Object.assign({},r.viewState);const i=RZ(t);r.size[0]=Math.ceil(FZ(t)/e),r.size[1]=Math.ceil(PZ(t)/e),r.extent=[i[0]-r.size[0]*e/2,i[1]-r.size[1]*e/2,i[0]+r.size[0]*e/2,i[1]+r.size[1]*e/2],r.time=Date.now();const s=r.viewState;return s.center=i,s.projection=n,s.resolution=e,r}allSourcesReady_(){let t,e=!0;for(let n=0,r=this.layers_.length;n<r;++n)if(t=this.layers_[n].getSource(),!t||"ready"!==t.getState()){e=!1;break}return e}getImage(t,e,n,r){if(!this.allSourcesReady_())return null;this.tileQueue_.loadMoreTiles(16,16),e=this.findNearestResolution(e);const i=this.updateFrameState_(t,e,r);if(this.requestedFrameState_=i,this.renderedImageCanvas_){const t=this.renderedImageCanvas_.getResolution(),n=this.renderedImageCanvas_.getExtent();e===t&&vZ(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 t=this.requestedFrameState_,e=this.layers_.length,n=new Array(e),r=new Array(e);for(let s=0;s<e;++s){const e=this.layers_[s].getSource();n[s]=e.getRevision(),t.layerIndex=s,t.renderTargets={};const i=rtt(this.layers_[s],t);if(!i)return;r[s]=i}const i={};this.dispatchEvent(new ttt("beforeoperations",t,i)),this.processor_.process(r,i,this.onWorkerComplete_.bind(this,t,n))}onWorkerComplete_(t,e,n,r,i){if(n||!r)return;const s=t.extent,o=t.viewState.resolution;if(o!==this.requestedFrameState_.viewState.resolution||!vZ(s,this.requestedFrameState_.extent))return;for(let l=0;l<this.layers_.length;++l){const t=this.layers_[l].getSource();if(e[l]!==t.getRevision())return}let a;this.renderedImageCanvas_?a=this.renderedImageCanvas_.getImage().getContext("2d"):(a=MX(t.size[0],t.size[1]),this.renderedImageCanvas_=new H9(s,o,1,a.canvas)),a.putImageData(r,0,0),t.animate?requestAnimationFrame(this.changed.bind(this)):this.changed(),this.renderedRevision_=this.getRevision(),this.dispatchEvent(new ttt("afteroperations",t,i))}getResolutions(t){if(!this.useResolutions_)return null;let e=super.getResolutions();if(!e)for(let n=0,r=this.layers_.length;n<r&&(e=this.layers_[n].getSource().getResolutions(t),!e);++n);return e}disposeInternal(){this.processor_&&this.processor_.dispose(),super.disposeInternal()}};ett.prototype.dispose;var ntt=null;function rtt(t,e){const n=t.getRenderer();if(!n)throw new Error("Unsupported layer type: "+t);if(!n.prepareFrame(e))return null;const r=e.size[0],i=e.size[1];if(0===r||0===i)return null;const s=n.renderFrame(e,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(ntt){const t=ntt.canvas;t.width!==r||t.height!==i?ntt=MX(r,i,void 0,{willReadFrequently:!0}):ntt.clearRect(0,0,r,i)}else ntt=MX(r,i,void 0,{willReadFrequently:!0});return ntt.drawImage(o,0,0,r,i),ntt.getImageData(0,0,r,i)}function itt(t){let e;return t instanceof V3?t instanceof x9?e=new s9({source:t}):t instanceof Y9&&(e=new W9({source:t})):e=t,e}function stt(t,e){const n=t[0],r=n.width,i=n.height,s=n.data,o=new Uint8ClampedArray(s.length),a=2*e.resolution,l=r-1,c=i-1,u=[0,0,0,0],h=Math.PI,d=e.encoding,p=e.exaggeration,f=e.zoom,g=e.method||"standard",m=e.accentColor,y=e.shadowColors||[e.shadowColor],v=e.highlightColors||[e.highlightColor],b=(e.azimuths||[e.sunAz]).map(t=>t*h/180),w=(e.altitudes||[45]).map(t=>t*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(t,e="mapbox"){return"mapbox"===e?.1*(256*t[0]*256+256*t[1]+t[2])-1e4:"terrarium"===e?256*t[0]+t[1]+t[2]/256-32768:0}function k(t,e){return 0!==t?Math.atan2(e,-t):h/2*(e>0?1:-1)}const E="igor"===g?function(t,e){const n=k(t*=2*p,e*=2*p),r=b[0]+h,i=Math.atan(Math.sqrt(t*t+e*e))*(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(t,e){t*=2*p,e*=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])-(e*r*s-t*i*s))/Math.sqrt(1+t*t+e*e),a=Math.max(0,Math.min(1,o));if(a>.5){const t=2*a-1,e=v[0];return[e.r*t,e.g*t,e.b*t,e.a*t]}const l=1-2*a,c=y[0];return[c.r*l,c.g*l,c.b*l,c.a*l]}:"combined"===g?function(t,e){t*=2*p,e*=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-(e*r*s-t*i*s))/Math.sqrt(1+t*t+e*e));a=Math.max(0,Math.min(h/2,a));const l=Math.atan(Math.sqrt(t*t+e*e))*(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(t,e){const n=(t*=2*p)*t+(e*=2*p)*e,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])-(e*-Math.cos(b[l])*n-t*-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 t=(2*u-1)/_;i+=d.r*t,s+=d.g*t,o+=d.b*t,a+=d.a*t}else{const t=(1-2*u)/_;i+=h.r*t,s+=h.g*t,o+=h.b*t,a+=h.a*t}}return[i,s,o,a]}:function(t,e){const n=b[0]+h,r=Math.atan(.625*Math.sqrt(t*t+e*e)),i=k(t,e),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,z;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),z=(N-O)/a*C;const t=E(F,z),e=t[3];A=4*(T*r+R),e>0&&(o[A]=t[0]/e*255,o[A+1]=t[1]/e*255,o[A+2]=t[2]/e*255),o[A+3]=255*e}return new ImageData(o,r,i)}function ott(t,e){const n=t[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=e.saturation)>0?1-1/(1.001-f):-f;var f;const g=(m=e.contrast)>0?1/(1-m):1+m;var m;const y=function(t){t*=Math.PI/180;const e=Math.sin(t),n=Math.cos(t);return[(2*n+1)/3,(-Math.sqrt(3)*e-n+1)/3,(Math.sqrt(3)*e-n+1)/3]}(e.hueRotate),v=y,b=[y[2],y[0],y[1]],w=[y[1],y[2],y[0]],_=e.brightnessLow,x=e.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 t=c[0],e=c[1],n=c[2],i=(t,e)=>{let n=0;for(let r=0;r<t.length;r++)n+=t[r]*e[r];return n};let a=i([t,e,n],v),l=i([t,e,n],b),f=i([t,e,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 att={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},ltt=" ",ctt=/(italic|oblique)$/i,utt={};function htt(t,e,n){var r=utt[t];if(!r){Array.isArray(t)||(t=[t]);for(var i,s,o=400,a="normal",l=[],c=0,u=t.length;c<u;++c){var h=t[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()):ctt.test(d)&&(d=d.replace(ctt,""),a=s?a:h[h.length-1].replace(d,""),s=!0),att){var f=h.length>1?h[h.length-2].toLowerCase():"";if(d==p||d==p.replace("-","")||f+"-"+d==p){o=i?o:att[p],h.pop(),f&&p.startsWith(f)&&h.pop();break}}i||"number"!=typeof d||(o=d,i=!0);var g=h.join(ltt).replace("Klokantech Noto Sans","Noto Sans").replace("DIN Pro","Barlow").replace("Arial Unicode MS","Arial");-1!==g.indexOf(ltt)&&(g='"'+g+'"'),l.push(g)}r=utt[t]=[a,o,l]}return r[0]+ltt+r[1]+ltt+e+"px"+(n?"/"+n:"")+ltt+r[2]}var dtt=Object.freeze({}),ptt={},ftt={},gtt=0;function mtt(t){return t.id||(t.id=gtt++),t.id}function ytt(t){let e=ptt[t.id];return e||(e={},ptt[mtt(t)]=e),e}function vtt(t){return t*Math.PI/180}var btt=function(){const t=[];for(let e=78271.51696402048;t.length<=24;e/=2)t.push(e);return t}();function wtt(t,e){if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas)return new OffscreenCanvas(t,e);const n=document.createElement("canvas");return n.width=t,n.height=e,n}function _tt(t,e){let n=0;const r=e.length;for(;n<r;++n)if(e[n]<t&&n+1<r){const r=e[n]/e[n+1];return n+Math.log(e[n]/t)/Math.log(r)}return r-1}function xtt(t,e){const n=Math.floor(t),r=Math.pow(2,t-n);return e[n]/r}var Ctt={};function Stt(t,e,n={},r){if(e in Ctt)return r&&(r.url=Ctt[e][0].url),Ctt[e][1];const i=n.transformRequest&&n.transformRequest(e,t)||e,s=function(){return delete Ctt[e],Promise.reject(new Error("Error fetching source "+e))},o=function(t){return delete Ctt[e],t.ok?t.json():Promise.reject(new Error("Error fetching source "+e))},a=uG(()=>i).then(t=>t instanceof Response?(r&&(r.url=t.url),o(t)):(t instanceof Request||(t=new Request(t)),t.headers.get("Accept")||t.headers.set("Accept","application/json"),r&&(r.url=t.url),fetch(t).then(o).catch(s))).catch(s);return Ctt[e]=[i,a],a}function ktt(t,e){if("string"!=typeof t)return Promise.resolve(t);if(!t.trim().startsWith("{"))return Stt("Style",t=U9(t,e.accessToken),e);try{const e=JSON.parse(t);return Promise.resolve(e)}catch(d8){return Promise.reject(d8)}}var Ett={};function Rtt(t,e,n={}){const r=[e,JSON.stringify(t)].toString();let i=Ett[r];if(!i||n.transformRequest){let s;n.transformRequest&&(s=(t,e)=>{const r=n.transformRequest&&n.transformRequest(e,"Tiles")||e;if(t instanceof I9)t.setLoader((e,n,i)=>{const s=function(n){n.arrayBuffer().then(n=>{const r=t.getFormat().readFeatures(n,{extent:e,featureProjection:i});t.setFeatures(r)})};uG(()=>r).then(e=>{if(e instanceof Response)return s(e);fetch(e).then(s).catch(()=>t.setState(3))}).catch(()=>t.setState(3))});else{const e=t.getImage();uG(()=>r).then(n=>{if("string"==typeof n)return void(e.src=n);const r=t=>t.blob().then(t=>{const n=URL.createObjectURL(t);e.addEventListener("load",()=>URL.revokeObjectURL(n)),e.addEventListener("error",()=>URL.revokeObjectURL(n)),e.src=n});if(n instanceof Response)return r(n);fetch(n).then(r).catch(()=>t.setState(3))}).catch(()=>t.setState(3))}});const o=t.url;if(o&&!t.tiles){const r=$9(o,n.accessToken,n.accessTokenParam||"access_token",e||location.href);if(o.startsWith("mapbox://"))i=Promise.resolve({tileJson:Object.assign({},t,{url:void 0,tiles:r}),tileLoadFunction:s});else{const t={};i=Stt("Source",r[0],n,t).then(function(e){return e.tiles=e.tiles.map(function(r){return"tms"===e.scheme&&(r=r.replace("{y}","{-y}")),$9(r,n.accessToken,n.accessTokenParam||"access_token",t.url)[0]}),Promise.resolve({tileJson:e,tileLoadFunction:s})})}}else t.tiles?(t=Object.assign({},t,{tiles:t.tiles.map(function(r){return"tms"===t.scheme&&(r=r.replace("{y}","{-y}")),$9(r,n.accessToken,n.accessTokenParam||"access_token",e||location.href)[0]})}),i=Promise.resolve({tileJson:Object.assign({},t),tileLoadFunction:s})):i=Promise.reject(new Error("source has no `tiles` nor `url`"));Ett[r]=i}return i}function Ttt(t,e,n,r){const i=[2*n*e.pixelRatio+e.width,2*n*e.pixelRatio+e.height],s=wtt(i[0],i[1]),o=s.getContext("2d");o.drawImage(t,e.x,e.y,e.width,e.height,n*e.pixelRatio,n*e.pixelRatio,e.width,e.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 t=0,r=a.height;t<r;++t)l[4*(t*u+c)+3]>0&&o.arc(c,t,n*e.pixelRatio,0,2*Math.PI);return o.fill(),s}function Ltt(t,e,n){const r=Math.max(0,Math.min(1,(n-t)/(e-t)));return r*r*(3-2*r)}function Itt(t,e,n){const r=wtt(e.width,e.height),i=r.getContext("2d");i.drawImage(t,e.x,e.y,e.width,e.height,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height),o=s.data;for(let a=0,l=s.width;a<l;++a)for(let t=0,e=s.height;t<e;++t){const e=4*(t*l+a),r=Ltt(.65,.85,o[e+3]/255);r>0?(o[e+0]=Math.round(255*n.r*r),o[e+1]=Math.round(255*n.g*r),o[e+2]=Math.round(255*n.b*r),o[e+3]=Math.round(255*r)):o[e+3]=0}return i.putImageData(s,0,0),r}var Ptt,Mtt=Array(256).join(" ");function Att(t,e){if(e>=.05){let n="";const r=t.split("\n"),i=Mtt.slice(0,Math.round(e/.1));for(let t=0,e=r.length;t<e;++t)t>0&&(n+="\n"),n+=r[t].split("").join(i);return n}return t}function Ott(){return Ptt||(Ptt=wtt(1,1).getContext("2d")),Ptt}function Ntt(t,e){if(/\d+ \d+/.test(t)){const[n,r]=t.split(" ").map(Number);return n<=e&&e<=r}return t==e}function Ftt(t,e){return Ott().measureText(t).width+(t.length-1)*e}var ztt={};function Dtt(t,e,n,r){if(-1!==t.indexOf("\n")){const i=t.split("\n"),s=[];for(let t=0,o=i.length;t<o;++t)s.push(Dtt(i[t],e,n,r));return s.join("\n")}const i=n+","+e+","+t+","+r;let s=ztt[i];if(!s){const o=t.split(" ");if(o.length>1){const t=Ott();t.font=e;const i=t.measureText("M").width*n;let a="";const l=[];for(let e=0,n=o.length;e<n;++e){const t=o[e],n=a+(a?" ":"")+t;Ftt(n,r)<=i?a=n:(a&&l.push(a),a=t)}a&&l.push(a);for(let e=0,n=l.length;e<n&&n>1;++e){const t=l[e];if(Ftt(t,r)<.35*i){const i=e>0?Ftt(l[e-1],r):1/0,s=e<n-1?Ftt(l[e+1],r):1/0;l.splice(e,1),n-=1,i<s?(l[e-1]+=" "+t,e-=1):l[e]=t+" "+l[e]}}for(let e=0,n=l.length-1;e<n;++e){const t=l[e],s=l[e+1];if(Ftt(t,r)>.7*i&&Ftt(s,r)<.6*i){const o=t.split(" "),a=o.pop();Ftt(a,r)<.2*i&&(l[e]=o.join(" "),l[e+1]=a+" "+s),n-=1}}s=l.join("\n")}else s=t;s=Att(s,r),ztt[i]=s}return s}b1.on("propertychange",()=>{for(const t in ztt)delete ztt[t]});var jtt,Utt,Btt=["Arial","Courier New","Times New Roman","Verdana","sans-serif","serif","monospace","cursive","fantasy"],$tt={},qtt={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},Vtt={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]},Wtt=function(t,e){let n=C8(t,e);if("error"===n.result){const r=O9(t);r!==t&&(n=C8(r,e))}if("error"===n.result){const r=n.value[0];return console.error("Error parsing expression:",t,r.key,r.message),{evaluate:()=>e.default}}return n.value};function Htt(t,e,n,r,i,s){const o=t.id;i||(i={},console.warn("No functionCache provided to getValue()")),i[o]||(i[o]={});const a=i[o];if(!a[n]){let r=(t[e]||dtt)[n];const i=C7[`${e}_${t.type}`]&&C7[`${e}_${t.type}`][n];void 0===r&&i&&(r=i.default);let s=b8(r);if(!s&&y8(r)&&(r=z8(r,i),s=!0),s){const t=Wtt(r,i);a[n]=t.evaluate.bind(t)}else{const t=i?i.type:typeof r;"color"!==t&&"colorArray"!==t||(r=w4.parse(r));let e=!1;if("array"===t)for(let n=0;n<r.length;++n){const t=r[n];if(b8(t)||y8(t)){e=!0;break}}if(e){const t=Object.assign({},i,{type:i.value}),e=[];for(let n=0;n<r.length;++n){let i=r[n];if(!b8(i)&&y8(i)&&(i=z8(i,t)),b8(i)){const n=Wtt(i,t);e.push(n.evaluate.bind(n))}else e.push(function(){return i})}a[n]=function(t,n,r){const i=[];for(let s=0;s<e.length;++s)i[s]=e[s](t,n,r);return i}}else a[n]=function(){return r}}}return a[n](F9,r,s)}function Gtt(t,e,n,r){return Htt(t,"layout",`${n}-allow-overlap`,e,r)?Htt(t,"layout",`${n}-ignore-placement`,e,r)?"none":"obstacle":"declutter"}function Ztt(t,e,n,r){if(r||console.warn("No filterCache provided to evaluateFilter()"),!(t in r))try{r[t]=function(t){if(null==t)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};R8(t)||(t=P8(t));const e=w8(t,T8,void 0);if("error"===e.result)throw new Error(e.value.map(t=>`${t.key}: ${t.message}`).join(", "));return{filter:(t,n,r)=>e.value.evaluate(t,n,{},r),needGeometry:I8(t),getGlobalStateRefs:()=>k8(e.value.expression)}}(e).filter}catch(i){console.warn("Filter will evaluate to false: "+i.message),r[t]=function(){return!1}}return r[t](F9,n)}function Ktt(t,e){if(t){if(0===t.a||0===e)return;const n=t.a;return e=void 0===e?1:e,0===n?"transparent":"rgba("+Math.round(255*t.r/n)+","+Math.round(255*t.g/n)+","+Math.round(255*t.b/n)+","+n*e+")"}return t}var Ytt=/\{[^{}}]*\}/g;function Xtt(t,e){return t.replace(Ytt,function(t){return e[t.slice(1,-1)]||""})}function Jtt(t,e){let n=t.split(":")[0];return n===t&&(n="default"),e[n]}var Qtt={},tet=w4.parse("#000000"),eet=w4.parse("#FFFFFF"),net=w4.parse("#000000"),ret=["raster-saturation","raster-contrast","raster-brightness-max","raster-brightness-min","raster-hue-rotate"],iet=["background","circle","fill","fill-extrusion","line","symbol","raster","hillshade"];function set(t,e=512){return t.getExtent()?p9({extent:t.getExtent(),tileSize:e,maxZoom:22}).getResolutions():btt}function oet(t,e){return e.accessToken||(e=Object.assign({},e),new URL(t).searchParams.forEach((t,n)=>{e.accessToken=t,e.accessTokenParam=n})),e}var aet=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function cet(t,e){if(!e.ref)return e;const n=t.find(t=>t.id===e.ref);if(!n)return e;const r=Object.assign({},e);for(const i of aet)!(i in r)&&i in n&&(r[i]=n[i]);return r}function uet(t,e,n){const r=new R9({tileJSON:e,tileSize:t.tileSize||e.tileSize||512}),i=r.getTileJSON(),s=r.getTileGrid(),o=KK(n.projection||"EPSG:3857"),a=function(t,e){const n=t.bounds;if(n){const t=QK([n[0],n[1]],e),r=QK([n[2],n[3]],e);return[t[0],t[1],r[0],r[1]]}return KK(e).getExtent()}(i,o),l=o.getExtent(),c=i.minzoom||0,u=i.maxzoom||22,h={attributions:r.getAttributions(),projection:o,tileGrid:new h9({origin:l?OZ(l):s.getOrigin(0),extent:a||s.getExtent(),minZoom:c,resolutions:set(o,e.tileSize).slice(0,u+1),tileSize:s.getTileSize(0)})};return Array.isArray(i.tiles)?h.urls=i.tiles:h.url=i.tiles,h}function het(t,e,n){return new Promise(function(r,i){Rtt(t,e,n).then(function({tileJson:e,tileLoadFunction:i}){const s=uet(t,e,n);s.tileLoadFunction=i,s.format=new T7({layerName:"mvt:layer"});const o=new P9(s);o.set("mapbox-source",t),r(o)}).catch(i)})}function det(t){return`{bbox-${(t?t.getCode():"EPSG:3857").toLowerCase().replace(/[^a-z0-9]/g,"-")}}`}function pet(t,e,n){const r=new s9;return function(t,e,n){return new Promise(function(r,i){Rtt(t,e,n).then(function({tileJson:e,tileLoadFunction:i}){const s=new R9({interpolate:void 0===n.interpolate||n.interpolate,transition:0,crossOrigin:"anonymous",tileJSON:e});s.tileGrid=uet(t,e,n).tileGrid,n.projection&&(s.projection=KK(n.projection));const o=s.getTileUrlFunction();i&&s.setTileLoadFunction(i),s.setTileUrlFunction(function(t,e,n){const r=det(n);let i=o(t,e,n);if(-1!=i.indexOf(r)){const e=s.getTileGrid().getTileCoordExtent(t);i=i.replace(r,e.toString())}return i}),s.set("mapbox-source",t),r(s)}).catch(function(t){i(t)})})}(t,e,n).then(function(t){r.setSource(t)}).catch(function(){r.setSource(void 0)}),r}function fet(t,e,n){const r=n.projection?new s5({dataProjection:n.projection}):new s5,i=t.data,s={};if("string"==typeof i){const[s]=$9(i,n.accessToken,n.accessTokenParam||"access_token",e||location.href);if(/\{bbox-[0-9a-z-]+\}/.test(s)){const e=(t,e,n)=>{const r=det(n);return s.replace(r,`${t.join(",")}`)},i=new K3({attributions:t.attribution,format:r,loader:(t,r,s,o,a)=>{Stt("GeoJSON","function"==typeof e?e(t,r,s):e,n).then(t=>{const e=i.getFormat().readFeatures(t,{featureProjection:s});i.addFeatures(e),o(e)}).catch(()=>{i.removeLoadedExtent(t),a()})},strategy:U3});return i.set("mapbox-source",t),i}const o=new K3({attributions:t.attribution,format:r,url:s,loader:(t,e,r,i,a)=>{Stt("GeoJSON",s,n).then(t=>{const e=o.getFormat().readFeatures(t,{featureProjection:r});o.addFeatures(e),i(e)}).catch(()=>{o.removeLoadedExtent(t),a()})}});return o}s.features=r.readFeatures(i,{featureProjection:"EPSG:3857"});const o=new K3(Object.assign({attributions:t.attribution,format:r},s));return o.set("mapbox-source",t),o}function get(t,e,n,r){n=cet(t.layers,n);const i=ytt(t),s=n.type;let o=n.source;const a=t.sources[o];let l;var c;return"background"==s?(l=function(t,e,n){const r=LG?{style:{}}:document.createElement("div");return r.className="ol-mapbox-style-background",r.style.position="absolute",r.style.width="100%",r.style.height="100%",new VJ({source:new V3({}),render(i){const s=function(t,e,n,r){const i={id:t.id,type:t.type},s=t.paint||{};let o;i.paint=s,F9.zoom=_tt(e,n.resolutions||btt),F9.distanceFromCenter=0;const a=Htt(i,"paint","background-color",dtt,r);return void 0!==s["background-opacity"]&&(o=Htt(i,"paint","background-opacity",dtt,r)),"none"===Htt(i,"layout","visibility",dtt,r)?void 0:Ktt(a,o)}(t,i.viewState.resolution,e,n);return r.style.backgroundColor=s,r}})}(n,r,i),o=void 0):"vector"==a.type?l=function(t,e,n){const r=new c9({declutter:!0,visible:!1});return het(t,e,n).then(function(t){r.setSource(t)}).catch(function(){r.setSource(void 0)}),r}(a,e,r):"raster"==a.type?(Object.keys(n.paint||{}).find(t=>ret.includes(t))?(c=pet(a,e,r),l=new W9({source:new ett({operationType:"image",operation:ott,sources:[c]})}),function(t,e,n,r){t.getSource().on("beforeoperations",function(t){F9.zoom=_tt(t.resolution,n.resolutions||btt),F9.distanceFromCenter=0;const i=t.data;i.saturation=Htt(e,"paint","raster-saturation",dtt,r),i.contrast=Htt(e,"paint","raster-contrast",dtt,r),i.brightnessHigh=Htt(e,"paint","raster-brightness-max",dtt,r),i.brightnessLow=Htt(e,"paint","raster-brightness-min",dtt,r),i.hueRotate=Htt(e,"paint","raster-hue-rotate",dtt,r)})}(l,n,r,i)):l=pet(a,e,r),l.setVisible(!n.layout||"none"!==Htt(n,"layout","visibility",dtt,i)),l.on("prerender",function(t,e,n){let r=null;return function(i){t.paint&&"raster-opacity"in t.paint&&i.frameState.viewState.zoom!==r&&(r=i.frameState.viewState.zoom,delete n[t.id],function(t,e,n,r){F9.zoom=n,F9.distanceFromCenter=0;const i=Htt(t,"paint","raster-opacity",dtt,r);e.setOpacity(i)}(t,e,r,n))}}(n,l,i))):"geojson"==a.type?l=function(t,e,n){return new F3({declutter:!0,source:fet(t,e,n),visible:!1})}(a,e,r):"raster-dem"==a.type&&"hillshade"==n.type&&(l=function(t){return new W9({source:new ett({operationType:"image",operation:stt,sources:[t]})})}(pet(a,e,r)),function(t,e,n,r,i){t.getSource().on("beforeoperations",function(t){const s=t.data;s.resolution=YK(r.projection||"EPSG:3857",t.resolution,RZ(t.extent),"m");const o=_tt(t.resolution,r.resolutions||btt);F9.zoom=o,F9.distanceFromCenter=0,s.zoom=o,s.encoding=e.encoding,s.method=Htt(n,"paint","hillshade-method",dtt,i)||"standard",s.exaggeration=Htt(n,"paint","hillshade-exaggeration",dtt,i);let a=Htt(n,"paint","hillshade-illumination-direction",dtt,i);null==a&&(a=335),s.azimuths=Array.isArray(a)?a:[a],s.sunAz=s.azimuths[0];let l=Htt(n,"paint","hillshade-illumination-altitude",dtt,i);function c(t){return t&&t.values?t.values[0]:t}function u(t){const e=n.paint?.[t];if(Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&void 0!==w4.parse(e[0]))return e.map(t=>w4.parse(t));let r=Htt(n,"paint",t,dtt,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]||eet,s.highlightColors||(s.highlightColors=[s.highlightColor]),s.shadowColors=u("hillshade-shadow-color"),s.shadowColor=s.shadowColors?.[0]||tet,s.shadowColors||(s.shadowColors=[s.shadowColor]),s.accentColor=c(Htt(n,"paint","hillshade-accent-color",dtt,i))||net})}(l,a,n,r,i),l.setVisible(!n.layout||"none"!==Htt(n,"layout","visibility",dtt,i))),l&&l.set("mapbox-source",o),l}function met(t,e,n,r){t.schema&&Object.assign(N9,Object.keys(t.schema).reduce((e,n)=>(e[n]=t.schema[n]?.default,e),{}));const i=[];let s=null;if(e instanceof b2){if(s=e.getView(),!s.isDef()&&!s.getRotation()&&!s.getResolutions()){const t=r.projection?KK(r.projection):s.getProjection();s=new bX(Object.assign(s.getProperties(),{maxResolution:btt[0]/QZ[t.getUnits()],projection:r.projection||s.getProjection()})),e.setView(s)}"center"in t&&!s.getCenter()&&s.setCenter(QK(t.center,s.getProjection())),"zoom"in t&&void 0===s.getZoom()&&s.setResolution(btt[0]/QZ[s.getProjection().getUnits()]/Math.pow(2,t.zoom)),s.getCenter()&&void 0!==s.getZoom()||s.fit(s.getProjection().getExtent(),{nearest:!0,size:e.getSize()})}e.set("mapbox-style",t),e.set("mapbox-metadata",{styleUrl:n,options:r});const o=t.layers;let a,l,c,u=[];for(let h=0,d=o.length;h<d;++h){const s=cet(o,o[h]),d=s.type;iet.includes(d)?(c=s.source,c&&c==l||(u.length&&(i.push(yet(a,u,t,n,e,r)),u=[]),a=get(t,n,s,r),a instanceof F3||a instanceof c9||(u=[]),l=a.get("mapbox-source")),u.push(s.id)):console.warn(`layers[${h}].type "${d}" not supported`)}return i.push(yet(a,u,t,n,e,r)),Promise.all(i)}function yet(t,e,n,r,i,s={}){let o=24,a=0;const l=n.layers;for(let c=0,u=l.length;c<u;++c){const t=l[c];-1!==e.indexOf(t.id)&&(o=Math.min("minzoom"in t?t.minzoom:0,o),a=Math.max("maxzoom"in t?t.maxzoom:24,a))}return new Promise(function(l,c){const u=function(){const u=t.getSource();if(u&&"error"!==u.getState()){if("getTileGrid"in u){const e=u.getTileGrid();if(e){const n=e.getMinZoom();(o>0||n>0)&&t.setMaxResolution(Math.min(xtt(Math.max(0,o-1e-12),btt),xtt(Math.max(0,n-1e-12),e.getResolutions()))),a<24&&t.setMinResolution(xtt(a,btt))}}else o>0&&t.setMaxResolution(xtt(Math.max(0,o-1e-12),btt));u instanceof K3||u instanceof P9?function(t,e,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 e||e.trim().startsWith("{")||(s=e),s&&(s=s.startsWith("data:")?location.href:U9(s,a.accessToken),a=oet(s,a)),new Promise(function(n,r){ktt(e,a).then(function(e){if(8!=e.version)return r(new Error("glStyle version 8 required."));if(!(t instanceof F3||t instanceof c9))return r(new Error("Can only apply to VectorLayer or VectorTileLayer"));const u=t instanceof c9?"vector":"geojson";if(l?o=Array.isArray(l)?e.layers.find(function(t){return t.id===l[0]}).source:l:(o=e.layers.find(function(t){return t.source&&e.sources[t.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(t instanceof c9)return het(e.sources[o],s,a).then(function(e){const n=t.getSource();n?e!==n&&(n.setTileUrlFunction(e.getTileUrlFunction()),"function"==typeof n.setUrls&&"function"==typeof e.getUrls&&n.setUrls(e.getUrls()),n.format_||(n.format_=e.format_),n.getAttributions()||n.setAttributions(e.getAttributions()),n.getTileLoadFunction()===M9&&n.setTileLoadFunction(e.getTileLoadFunction()),eY(n.getProjection(),e.getProjection())&&(n.tileGrid=e.getTileGrid())):t.setSource(e);const r=t.getSource().getTileGrid();!isFinite(t.getMaxResolution())&&!isFinite(t.getMinZoom())&&r.getMinZoom()>0&&t.setMaxResolution(xtt(Math.max(0,r.getMinZoom()-1e-12),r.getResolutions()))});const n=e.sources[o];let r=t.getSource();r&&r.get("mapbox-source")===n||(r=fet(n,s,a));const i=t.getSource();return i?r!==i&&(i.getAttributions()||i.setAttributions(r.getAttributions()),i.format_||(i.format_=r.getFormat()),i.url_=r.getUrl()):t.setSource(r),Promise.resolve()}let d,p;const f={},g={};function m(){if(p||e.sprite&&!f)p?(t.setStyle(p),h().then(n).catch(r)):r(new Error("Something went wrong trying to apply style."));else{if(a.projection&&!i){const t=KK(a.projection).getUnits();"m"!==t&&(i=btt.map(e=>e/QZ[t]))}let s;const c=t.getSource();c instanceof P9&&c.format_ instanceof T7&&(s=c.format_.layerName_),p=function(t,e,n,r=btt,i,s,o,a){if("string"==typeof e&&(e=JSON.parse(e)),e.schema)for(const b in e.schema){const t=e.schema[b];"default"in t&&(N9[b]=t.default)}if(8!=e.version)throw new Error("glStyle version 8 required.");Qtt[function(t,e){return mtt(t)+"."+mG(e)}(e,t)]=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 e=s[b];uG(()=>e).then(async e=>{let n;if("undefined"!=typeof Image){const r=new Image;if("string"==typeof e)r.crossOrigin="anonymous",r.src=e;else{let t;e instanceof Request?t=await fetch(e):e instanceof Response&&(t=e);const i=await t.blob();n=URL.createObjectURL(i),r.src=n}r.addEventListener("load",function e(){r.removeEventListener("load",e),l[b]={image:r,size:[r.width,r.height]},t.changed(),n&&URL.revokeObjectURL(n)}),r.addEventListener("error",function t(){URL.revokeObjectURL(n),r.removeEventListener("error",t)})}else if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope){const t=self;t.postMessage({action:"loadImage",src:e}),t.addEventListener("message",function(t){"imageLoaded"===t.data.action&&t.data.src===e&&(l[b]={image:t.data.image,size:[t.data.image.width,t.data.image.height]})})}})}const c=C5(e.layers),u={},h=[],d={},p={},f=ytt(e),g=function(t){let e=ftt[t.id];return e||(e={},ftt[mtt(t)]=e),e}(e);let m;for(let b=0,w=c.length;b<w;++b){const t=c[b],r=t.id;if("string"==typeof n&&t.source==n||Array.isArray(n)&&-1!==n.indexOf(r)){const n=t["source-layer"];if(m){if(t.source!==m)throw new Error(`Layer "${r}" does not use source "${m}`)}else{m=t.source;const n=e.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:t,index:b}),h.push(r)}}const y=[],v=function(n,s,c){const h=t.getSource?.()?.format_?.layerName_??"mvt:layer",m=n.getProperties(),v=u[m[h]];if(!v)return;let b=r.indexOf(s);-1==b&&(b=_tt(s,r)),F9.zoom=b,F9.distanceFromCenter=0;const w=n.getGeometry(),_=qtt[w.getType()],x=t.get("map");if(x&&x instanceof b2&&1===_){const t=x.getSize();if(t){const e=x.getView().getCenter(),n=RZ(w.getExtent());F9.distanceFromCenter=(C=e,S=n,Math.sqrt(function(t,e){const n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r}(C,S))/s/t[1])}}var C,S;const k={id:n.getId(),properties:m,type:_},E=t.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||dtt,C=h.paint||dtt;if("none"===Htt(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||Ztt(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=Htt(h,"paint",h.type+"-opacity",k,f,E),h.type+"-pattern"in C){const t=Htt(h,"paint",h.type+"-pattern",k,f,E);if(t){const e="string"==typeof t?Xtt(t,m):t.toString(),n=Jtt(e,l);if(i&&i[e]&&n){++T,w=y[T],w&&w.getFill()&&!w.getStroke()&&!w.getText()||(w=new F1({fill:new M1}),y[T]=w),g=w.getFill(),w.setZIndex(S);const t=e+"."+c;let r=p[t];if(!r){const s=i[e],o=wtt(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[t]=r}g.setColor(r)}}}else if(r=Ktt(Htt(h,"paint",h.type+"-color",k,f,E),c),h.type+"-outline-color"in C&&(b=Ktt(Htt(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 F1({fill:r?new M1:void 0,stroke:b?new N1:void 0}),y[T]=w),r&&(g=w.getFill(),g.setColor(r)),"fill-extrusion"===h.type){const t=Htt(h,"paint","fill-extrusion-height",k,f,E);if(t>0){const e=Math.max(.1,.9-Math.min(t,225)/280);if(b&&"transparent"!==b){const t=w4.parse(b);b=`rgba(${Math.round(255*t.r*e)},${Math.round(255*t.g*e)},${Math.round(255*t.b*e)},${t.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:Ktt(Htt(h,"paint","line-color",k,f,E),Htt(h,"paint","line-opacity",k,f,E));const t=Htt(h,"paint","line-width",k,f,E);r&&t>0&&(++T,w=y[T],w&&w.getStroke()&&!w.getFill()&&!w.getText()||(w=new F1({stroke:new N1}),y[T]=w),v=w.getStroke(),v.setLineCap(Htt(h,"layout","line-cap",k,f,E)),v.setLineJoin(Htt(h,"layout","line-join",k,f,E)),v.setMiterLimit(Htt(h,"layout","line-miter-limit",k,f,E)),v.setColor(r),v.setWidth(t),v.setLineDash(C["line-dasharray"]?Htt(h,"paint","line-dasharray",k,f,E).map(function(e){return e*t}):null),"function"==typeof v.setOffset&&v.setOffset(Htt(h,"paint","line-offset",k,f,E)),w.setZIndex(S))}let L,I,P,M,A,O,N,F,z,D=!1,j=null,U=0;if((1==_||2==_)&&"icon-image"in x){const e=Htt(h,"layout","icon-image",k,f,E);if(e){let r;L="string"==typeof e?Xtt(e,m):e.toString();const o=a?a(t,L):void 0,c=Jtt(L,l);if(i&&i[L]&&c||o){const t=Htt(h,"layout","icon-rotation-alignment",k,f,E);if(2==_){const e=n.getGeometry();if(e.getFlatMidpoint||e.getFlatMidpoints){const n=e.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"===e.getType()?e.getFlatMidpoints():e.getFlatMidpoint();if(Utt||(Utt=new $3("Point",jtt=[NaN,NaN],[],2,{},void 0)),r=Utt,jtt[0]=n[0],jtt[1]=n[1],"line"===Htt(h,"layout","symbol-placement",k,f,E)&&"map"===t){const t=e.getStride(),r=e.getFlatCoordinates();for(let e=0,i=r.length-t;e<i;e+=t){const i=r[e],s=r[e+1],o=r[e+t],a=r[e+t+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 e=Htt(h,"layout","icon-size",k,f,E),n=void 0!==C["icon-color"]?Htt(h,"paint","icon-color",k,f,E):null;if(!n||0!==n.a){const r=Htt(h,"paint","icon-halo-color",k,f,E),s=Htt(h,"paint","icon-halo-width",k,f,E);let a=`${L}.${e}.${s}.${r}`;if(null!==n&&(a+=`.${n}`),I=d[a],!I){const l=Gtt(h,k,"icon",f);let u;"icon-offset"in x&&(u=Htt(h,"layout","icon-offset",k,f,E).slice(0),u[0]*=e,u[1]*=-e);let p=n?[255*n.r,255*n.g,255*n.b,n.a]:void 0;if(o){const n={color:p,rotateWithView:"map"===t,displacement:u,declutterMode:l,scale:e};"string"==typeof o?n.src=o:(n.img=o,n.imgSize=[o.width,o.height]),I=new O1(n)}else{const o=i[L];let a,h,d;s?o.sdf?(a=Ttt(Itt(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=Ttt(c.image,o,s,r):(o.sdf&&(c.unSDFed||(c.image=Itt(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 O1({color:p,img:a,imgSize:c.size,size:h,offset:d,rotateWithView:"map"===t,scale:e/o.pixelRatio,displacement:u,declutterMode:l})}d[a]=I}}I&&(++T,w=y[T],w&&w.getImage()&&!w.getFill()&&!w.getStroke()||(w=new F1,y[T]=w),w.setGeometry(r),I.setRotation(U+vtt(Htt(h,"layout","icon-rotate",k,f,E))),I.setOpacity(Htt(h,"paint","icon-opacity",k,f,E)),I.setAnchor(Vtt[Htt(h,"layout","icon-anchor",k,f,E)]),w.setImage(I),j=w.getText(),w.setText(void 0),w.setZIndex(S),D=!0,P=!1)}else P=!0}}}if(1==_&&"circle"===h.type){++T,w=y[T],w&&w.getImage()&&!w.getFill()&&!w.getStroke()||(w=new F1,y[T]=w);const t="circle-radius"in C?Htt(h,"paint","circle-radius",k,f,E):5,e=Ktt(Htt(h,"paint","circle-stroke-color",k,f,E),Htt(h,"paint","circle-stroke-opacity",k,f,E)),n=Htt(h,"paint","circle-translate",k,f,E),r=Ktt(Htt(h,"paint","circle-color",k,f,E),Htt(h,"paint","circle-opacity",k,f,E)),i=Htt(h,"paint","circle-stroke-width",k,f,E),s=t+"."+e+"."+r+"."+i+"."+n[0]+"."+n[1];I=d[s],I||(I=new P1({radius:t,displacement:[n[0],-n[1]],stroke:e&&i>0?new N1({width:i,color:e}):void 0,fill:r?new M1({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),D=!0}if("text-field"in x){N=Math.round(Htt(h,"layout","text-size",k,f,E));const t=Htt(h,"layout","text-font",k,f,E);O=Htt(h,"layout","text-line-height",k,f,E),A=htt(o?o(t,e.metadata?e.metadata["ol:webfonts"]:void 0):t,N,O),A.includes("sans-serif")||(A+=",sans-serif"),F=Htt(h,"layout","text-letter-spacing",k,f,E),z=Htt(h,"layout","text-max-width",k,f,E);const n=Htt(h,"layout","text-field",k,f,E);M="object"==typeof n&&n.sections?1===n.sections.length?n.toString():n.sections.reduce((e,n)=>{const r=n.fontStack?n.fontStack.split(","):t,i=htt(o?o(r):r,N*(n.scale||1),O);let s=n.text;if("\n"===s)return e.push("\n",""),e;if(2==_)return e.push(Att(s,F),i),e;s=Dtt(s,i,z,F).split("\n");for(let t=0,o=s.length;t<o;++t)t>0&&e.push("\n",""),e.push(s[t],i);return e},[]):Xtt(n,m).trim(),c=Htt(h,"paint","text-opacity",k,f,E)}if(M&&c&&!P){D||(++T,w=y[T],w&&w.getText()&&!w.getFill()&&!w.getStroke()||(w=new F1,y[T]=w),w.setImage(void 0),w.setGeometry(void 0));const t=Gtt(h,k,"text",f);w.getText()||w.setText(j),j=w.getText(),(!j||"getDeclutterMode"in j&&j.getDeclutterMode()!==t)&&(j=new U1({padding:[2,2,2,2],declutterMode:t}),w.setText(j));const e=Htt(h,"layout","text-transform",k,f,E);"uppercase"==e?M=Array.isArray(M)?M.map((t,e)=>e%2?t:t.toUpperCase()):M.toUpperCase():"lowercase"==e&&(M=Array.isArray(M)?M.map((t,e)=>e%2?t:t.toLowerCase()):M.toLowerCase());const n=Array.isArray(M)?M:2==_?Att(M,F):Dtt(M,A,z,F);if(j.setText(n),j.setFont(A),j.setRotation(vtt(Htt(h,"layout","text-rotate",k,f,E))),"function"==typeof j.setKeepUpright){const t=Htt(h,"layout","text-keep-upright",k,f,E);j.setKeepUpright(t)}const r=Htt(h,"layout","text-anchor",k,f,E),i=D||1==_?"point":Htt(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 t=Htt(h,"layout","symbol-spacing",k,f,E);j.setRepeat(2*t)}j.setOverflow("point"===i);let o=Htt(h,"paint","text-halo-width",k,f,E);const a=Htt(h,"layout","text-offset",k,f,E),l=Htt(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 t=Htt(h,"layout","text-rotation-alignment",k,f,E);j.setRotateWithView("map"==t)}else j.setMaxAngle(vtt(Htt(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=Htt(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 M1;m.setColor(Ktt(Htt(h,"paint","text-color",k,f,E),c)),j.setFill(m);const v=Ktt(Htt(h,"paint","text-halo-color",k,f,E),c);if(v&&o>0){const t=j.getStroke()||new N1;t.setColor(v),o*=2;const e=.5*N;t.setWidth(o<=e?o:e),j.setStroke(t)}else j.setStroke(void 0);const b=Htt(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 t.setStyle(v),t.set("mapbox-layers",h),t.set("mapbox-source",m),t.set("mapbox-featurestate",t.get("mapbox-featurestate")||{}),v}(t,e,l,i,f,g,(t,e=a.webfonts)=>function(t,e="https://cdn.jsdelivr.net/npm/@fontsource/{font-family}/{fontweight}{-fontstyle}.css"){if(LG)return t;let n;for(let r=0,i=t.length;r<i;++r){const e=t[r];if(e in $tt)continue;$tt[e]=!0;const i=htt(e,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 t=0,r=n.length;t<r;++t){const r=n[t],i=r[0];if(Btt.includes(i))continue;const s=r[1],o=r[2];if(!(await document.fonts.load(`${o} ${s} 16px "${i}"`)).some(t=>t.family.replace(/^['"]|['"]$/g,"").toLowerCase()===i.toLowerCase()&&Ntt(t.weight,s)&&t.style===o)){const t=e.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="'+t+'"]')){const e=document.createElement("link");e.href=t,e.rel="stylesheet",document.head.appendChild(e)}}}})(),t):t}(t,e),a.getImage,s),t.getStyle()?h().then(n).catch(r):r(new Error(`Nothing to show for source [${o}]`))}}if(e.sprite){const t=function(t,e,n){if("string"==typeof t)return[{id:"default",url:j9(t,e,n)}];for(const r of t)r.url=j9(r.url,e,n);return t}(e.sprite,a.accessToken,s||location.href);d=LG?1:window.devicePixelRatio>=1.5?.5:1;const n=.5==d?"@2x":"";Promise.all(t.map(function(t){const e=new URL(t.url);let i=e.origin+e.pathname+n+".json"+e.search;return new Promise(function(t,n){Stt("Sprite",i,a).then(t).catch(function(){i=e.origin+e.pathname+".json"+e.search,Stt("Sprite",i,a).then(t).catch(n)})}).then(function(i){let s;if(void 0===i&&r(new Error("No sprites found.")),s=e.origin+e.pathname+n+".png"+e.search,a.transformRequest){const t=a.transformRequest(s,"SpriteImage")||s;(t instanceof Request||t instanceof Promise)&&(s=t)}g[t.id]=s;for(const e in i){const n="default"==t.id?e:`${t.id}:${e}`;f[n]=i[e]}}).catch(function(t){r(new Error(`Sprites cannot be loaded: ${i}: ${t.message}`))})})).then(m).catch(r)}else m()}).catch(r)})}(t,n,e,Object.assign({styleUrl:r},s)).then(function(){!function(t,e,n){function r(){const r=e.get("mapbox-style");if(!r)return;const i=C5(r.layers),s=t.get("mapbox-layers"),o=i.filter(function(t){return s.includes(t.id)}).some(function(t){return!t.layout||"visible"===Htt(t,"layout","visibility",dtt,n)});t.get("visible")!==o&&t.setVisible(o)}t.on("change",r),r()}(t,i,ytt(n)),l()}).catch(c):l()}else c(new Error("Error accessing data for source "+t.get("mapbox-source")))};t.set("mapbox-layers",e);const h=i.getLayers();-1===h.getArray().indexOf(t)&&h.push(t),t.getSource()?u():t.once("change:source",u)})}var vet=class extends vq{static{BF(this.prototype,"osm",[pp])}#B=void qF(this,"osm");static{BF(this.prototype,"storage",[pp])}#U=void qF(this,"storage");static{BF(this.prototype,"mapUi",[pp])}#Zt=void qF(this,"mapUi");static{BF(this.prototype,"router",[pp])}#Gt=void qF(this,"router");static{BF(this.prototype,"settings",[pp])}#z=void qF(this,"settings");static{BF(this.prototype,"nostrData",[pp])}#F=void qF(this,"nostrData");mapInstance;bookmarkSource;searchResultsSource;selectedShapeSource;searchOverlay;searchOverlayElement;selectedPinOverlay;selectedPinElement;crosshairElement;crosshairOverlay;ignoreNextMapClick=!1;setupMap=Xq(t=>{if(this.mapInstance)return;const e=new jJ;this.selectedShapeSource=new K3;const n=new F3({source:this.selectedShapeSource,style:new F1({stroke:new N1({color:"#3388ff",width:4}),fill:new M1({color:"rgba(51, 136, 255, 0.1)"})}),zIndex:5});this.bookmarkSource=new K3;const r=new F3({source:this.bookmarkSource,style:t=>{const e=t.get("originalPlace");let n=getComputedStyle(document.documentElement).getPropertyValue("--default-list-color").trim()||"#000000";if(e&&e._listIds&&e._listIds.length>0){const t=e._listIds[0],r=this.storage.lists.find(e=>e.id===t);r&&r.color&&(n=r.color)}return[new F1({image:new P1({radius:10,fill:new M1({color:"rgba(0, 0, 0, 0.2)"}),displacement:[0,-2]})}),new F1({image:new P1({radius:9,fill:new M1({color:n}),stroke:new N1({color:"#fff",width:2})})})]},zIndex:10});this.searchResultsSource=new K3;const i=new Map,s=new F3({source:this.searchResultsSource,style:t=>{const e=t.get("originalPlace"),n=this.mapUi.selectedPlace;if(n){const t=e.osmId&&n.osmId&&e.osmId===n.osmId,r=e.id&&n.id&&e.id===n.id,i=e.lat===n.lat&&e.lon===n.lon;if(t||r||i)return new F1({})}const r=p$(e.osmTags||e),s=r||"default";if(!i.has(s)){const t=getComputedStyle(document.documentElement).getPropertyValue("--marker-color-primary").trim()||"#ea4335";let e=`<circle cx="12" cy="12" r="8" fill="${t}"/>`;if(r){const n=c$(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)),e=`\n <circle cx="12" cy="12" r="8" fill="${t}"/>\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 ${e}\n </svg>\n `;i.set(s,"data:image/svg+xml;charset=utf-8,"+encodeURIComponent(n.trim()))}return new F1({image:new O1({src:i.get(s),anchor:[.5,.65],scale:1})})},zIndex:11});let o=[14.21683569,27.060114248],a=2.661,l=!1;try{const t=localStorage.getItem("marco:map-view");if(t){const e=JSON.parse(t);e.center&&Array.isArray(e.center)&&2===e.center.length&&"number"==typeof e.zoom&&(o=e.center,a=e.zoom,l=!0)}}catch(k){console.warn("Failed to restore map view:",k)}const c=new bX({center:QK(o),zoom:a,projection:"EPSG:3857"});this.mapInstance=new b2({target:t,layers:[e,n,s,r],view:c,controls:WX({zoom:!0,rotate:!0,attribution:!0}),interactions:SJ({dragPan:!1})});const u=tY(c.getCenter());this.mapUi.updateCenter(u[1],u[0]),this.mapUi.updateZoom(c.getZoom()),function(t,e,n={}){let r,i;if(LG){if(!(t instanceof b2||t instanceof jJ))throw new Error("ol-mapbox-style in a web worker requires a Map or a LayerGroup as first argument");i=t}else i="string"==typeof t||t instanceof HTMLElement?new b2({target:t}):t;if("string"==typeof e){const t=e.startsWith("data:")?location.href:U9(e,n.accessToken);n=oet(t,n),r=new Promise(function(r,s){ktt(e,n).then(function(e){met(e,i,t,n).then(function(){r(i)}).catch(s)}).catch(function(t){s(new Error(`Could not load ${e}: ${t.message}`))})})}else r=new Promise(function(t,r){met(e,i,!n.styleUrl||n.styleUrl.startsWith("data:")?location.href:U9(n.styleUrl,n.accessToken),n).then(function(){t(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 k2({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 k2({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 ',t.appendChild(this.crosshairElement),this.locationOverlayElement=document.createElement("div"),this.locationOverlayElement.className="search-pulse blue",this.locationOverlay=new k2({element:this.locationOverlayElement,positioning:"center-center",stopEvent:!1}),this.mapInstance.addOverlay(this.locationOverlay),t.addEventListener("pointerdown",()=>{this.mapUi.searchBoxHasFocus&&(this.ignoreNextMapClick=!0)},!0);const p=new b5({trackingOptions:{enableHighAccuracy:!0},projection:c.getProjection()}),f=new E2;f.setStyle(new F1({image:new P1({radius:6,fill:new M1({color:"#3399CC"}),stroke:new N1({color:"#fff",width:2})})}));const g=new K3({features:[f]}),m=new F3({source:g,zIndex:15});p.on("change:position",function(){const t=p.getPosition();f.setGeometry(t?new nX(t):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;">${c$("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 t=p.getPosition(),e=p.getAccuracyGeometry(),n=p.getAccuracy();if(console.debug("Geolocation change:",{coordinates:t,accuracy:n}),!t)return;const r=this.mapInstance.getSize(),i=this.mapInstance.getView();let s=null;if(this.locationOverlayElement){const e=i.getResolution(),r=2*(n||50)/YK(i.getProjection(),e,t);this.locationOverlayElement.style.width=`${r}px`,this.locationOverlayElement.style.height=`${r}px`,this.locationOverlay.setPosition(t)}if(n&&n<=20&&_(),e){const t=e.getExtent();s=3.162*i.getResolutionForExtent(t,r)}else n&&(s=6.325*n/Math.min(r[0],r[1])/YK(i.getProjection(),1,t));let o={center:t,duration:1e3};if(s){const t=i.getResolutionForZoom(17);o.resolution=Math.max(s,t)}else o.zoom=16;this.mapInstance.getView().animate(o)},C=()=>{console.debug("Getting current geolocation..."),_(),p.setTracking(!0);const t=p.getPosition();this.locationOverlayElement&&this.locationOverlayElement.classList.add("active"),t&&x(),w=p.on("change:position",x),b=setTimeout(()=>{_()},1e4)};v.addEventListener("click",C);const S=new BX({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",t=>{const e=this.mapInstance.getEventPixel(t.originalEvent),n=this.mapInstance.hasFeatureAtPixel(e,{hitTolerance:10});this.mapInstance.getTarget().style.cursor=n?"pointer":""}),this.storage.rs.on("ready",()=>{this.handleMapMove()})});updateInteractions=Xq(()=>{if(!this.mapInstance)return;this.mapInstance.getInteractions().getArray().slice().forEach(t=>{t instanceof cJ&&this.mapInstance.removeInteraction(t)});const t=!!this.settings.mapKinetic&&new HX(-.005,.05,100);this.settings.mapKinetic&&window.innerWidth<=768&&(t.minVelocity_=.25),this.mapInstance.addInteraction(new cJ({kinetic:t}))});updateSearchResults=Xq(()=>{if(!this.searchResultsSource)return;this.searchResultsSource.clear();const t=this.mapUi.searchResults;if(!t||0===t.length)return;const e=[];t.forEach(t=>{if(t.lat&&t.lon){const n=new E2({geometry:new nX(QK([t.lon,t.lat])),name:t.title,id:t.id,isSearchResult:!0,originalPlace:t});e.push(n)}}),e.length>0&&this.searchResultsSource.addFeatures(e)});updateSelectedPin=Xq(()=>{const t=this.mapUi.selectedPlace,e=this.mapUi.selectionOptions||{};if(this.searchResultsSource&&this.searchResultsSource.changed(),this.selectedPinOverlay&&this.selectedPinElement)if(this.selectedShapeSource&&this.selectedShapeSource.clear(),t&&t.lat&&t.lon){const r=QK([t.lon,t.lat]);if(this.selectedPinOverlay.setPosition(r),this.selectedPinElement.classList.remove("active"),this.selectedPinElement.offsetWidth,this.selectedPinElement.classList.add("active"),t.geojson&&this.selectedShapeSource)try{const e=(new s5).readFeature(t.geojson,{featureProjection:"EPSG:3857"});this.selectedShapeSource.addFeature(e)}catch(n){console.warn("Failed to render selected place shape:",n)}e.preventZoom?t.bbox&&!this.bboxFitsInView(t.bbox)?this.zoomToBbox(t.bbox):this.handlePinVisibility(r,{maintainZoom:!0}):t.bbox?this.zoomToBbox(t.bbox):this.handlePinVisibility(r)}else this.selectedPinElement.classList.remove("active"),this.selectedPinOverlay.setPosition(void 0)});bboxFitsInView(t){if(!this.mapInstance||!t)return!0;const e=this.mapInstance.getView(),n=this.mapInstance.getSize();return hZ(e.calculateExtent(n),[...QK([t.minLon,t.minLat]),...QK([t.maxLon,t.maxLat])])}zoomToBbox(t){if(!this.mapInstance||!t)return;const e=this.mapInstance.getView(),n=this.mapInstance.getSize(),r=[...QK([t.minLon,t.minLat]),...QK([t.maxLon,t.maxLat])];let i=[.15*n[1],.15*n[0],.15*n[1],.15*n[0]];if(n[0]<=768){const t=.5*n[1],e=.15*t,r=.5*n[1]+.15*t;i[0]=e,i[2]=r}else if(this.args.isSidebarOpen){const t=getComputedStyle(document.documentElement).getPropertyValue("--sidebar-width").trim(),e=parseInt(t,10)||360,r=n[0]-e;i[3]=e+.15*r,i[1]=.15*r}const s=e.getZoom();e.fit(r,{padding:i,duration:1e3,easing:t=>t*(2-t),maxZoom:Math.max(s,18)})}handlePinVisibility(t,e={}){if(!this.mapInstance)return;const n=this.mapInstance.getView().getZoom();if(!e.maintainZoom&&n<16)return void this.animateToSmartCenter(t,16);const r=this.mapInstance.getPixelFromCoordinate(t),i=this.mapInstance.getSize();if(!r||r[0]<0||r[0]>i[0]||r[1]<0||r[1]>i[1]){const n=e.maintainZoom?null:16;this.animateToSmartCenter(t,n)}else this.panIfObscured(t)}animateToSmartCenter(t,e=null){if(!this.mapInstance)return;const n=this.mapInstance.getSize(),r=this.mapInstance.getView();let i=r.getResolution();null!==e&&(i=r.getResolutionForZoom(e));let s=t;if(n[0]<=768){const e=n[1],r=document.querySelector(".app-header"),o=r?r.offsetHeight:60,a=(e/2-(o+(e/2-o)/2))*i;s=[t[0],t[1]-a]}else if(this.args.isSidebarOpen){const e=getComputedStyle(document.documentElement).getPropertyValue("--sidebar-width").trim(),n=(parseInt(e,10)||360)/2*i;s=[t[0]-n,t[1]]}const o={center:s,duration:1e3,easing:t=>t*(2-t)};null!==e&&(o.zoom=e),r.animate(o)}panIfObscured(t){if(!this.mapInstance)return;const e=this.mapInstance.getSize(),n=this.mapInstance.getPixelFromCoordinate(t);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(e[0]<=768){const t=e[1],r=t/2;n[1]>r&&(a=u+(t/2-u)/2,l=!0)}else if(this.args.isSidebarOpen){const t=getComputedStyle(document.documentElement).getPropertyValue("--sidebar-width").trim(),r=parseInt(t,10)||360;n[0]<r&&(o=r+(e[0]-r)/2,l=!0)}const h=u+20;if(a<h&&(a=h+30,l=!0),l){const t=n[0]-o,e=n[1]-a,l=i[0]+t*s,c=i[1]-e*s;r.animate({center:[l,c],duration:500,easing:t=>t*(2-t)})}}updateBookmarks=Xq(()=>{const t=this.storage.placesInView;this.loadBookmarks(t)});async loadBookmarks(t=[]){try{if(!this.bookmarkSource)return;t&&0!==t.length||(t=this.storage.placesInView),this.bookmarkSource.clear(),t&&Array.isArray(t)&&t.forEach(t=>{if(t.lat&&t.lon){const e=new E2({geometry:new nX(QK([t.lon,t.lat])),name:t.title,id:t.id,isBookmark:!0,originalPlace:t});this.bookmarkSource.addFeature(e)}})}catch(e){console.error("Failed to load bookmarks:",e)}}syncPulse=Xq(()=>{this.searchOverlayElement&&(this.mapUi.isSearching?this.searchOverlayElement.classList.add("active"):this.searchOverlayElement.classList.remove("active"))});syncCreationMode=Xq(()=>{if(this.crosshairElement&&this.mapInstance)if(this.mapUi.isCreating){this.crosshairElement.classList.add("visible");const t=this.mapUi.creationCoordinates;if(t&&t.lat&&t.lon){const e=QK([t.lon,t.lat]);this.animateToCrosshair(e)}}else this.crosshairElement.classList.remove("visible")});animateToCrosshair(t){if(!this.mapInstance||!this.crosshairElement)return;const e=this.mapInstance.getTargetElement().getBoundingClientRect(),n=this.crosshairElement.getBoundingClientRect(),r=n.left+n.width/2-e.left,i=n.top+n.height/2-e.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=t[0]-u,p=t[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:t=>t*(2-t)})}handleMapMove=async()=>{if(!this.mapInstance||this.isDestroying||this.isDestroyed)return;const t=this.mapInstance.getView(),e=tY(t.getCenter());if(this.mapUi.updateCenter(e[1],e[0]),this.mapUi.updateZoom(t.getZoom()),this.mapUi.isCreating){const t=this.mapInstance.getTargetElement().getBoundingClientRect(),e=this.crosshairElement.getBoundingClientRect(),n=e.left+e.width/2-t.left,r=e.top+e.height/2-t.top,i=tY(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]=tY([r[0],r[1]]),[o,a]=tY([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 t=this.mapInstance.getView(),e={center:tY(t.getCenter()),zoom:t.getZoom()};localStorage.setItem("marco:map-view",JSON.stringify(e))}catch(c){console.warn("Failed to save map view:",c)}}};handleMapClick=async t=>{if(this.ignoreNextMapClick)return void(this.ignoreNextMapClick=!1);const e=this.mapInstance.getFeaturesAtPixel(t.pixel,{hitTolerance:10});let n=null,r=null,i=null;if(e&&e.length>0){console.debug(`Found ${e.length} features in map layer:`);for(const n of e)console.debug(n);const t=e.find(t=>t.get("isBookmark")),s=e.find(t=>t.get("isSearchResult"));t?n=t.get("originalPlace"):s&&(r=s.get("originalPlace"));const o=e[0].getProperties();o.name&&(i=o.name)}const s=t=>{("search"===this.router.currentRouteName||this.mapUi.currentSearch&&this.mapUi.searchResults.length>0)&&(this.mapUi.returnToSearch=!0),this.mapUi.preventNextZoom=!0,this.mapUi.selectPlace(t,{preventZoom:!0}),this.mapUi.showSidebar(),this.router.transitionTo("place",t)};if(this.args.isSidebarOpen){const t=n||r;return t?(console.debug("Clicked feature while sidebar open (switching):",t),void s(t)):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]=tY(t.coordinate),l=i?30:50;if(this.searchOverlayElement){const e=this.mapInstance.getView(),n=2*l/YK(e.getProjection(),e.getResolution(),t.coordinate);this.searchOverlayElement.style.width=`${n}px`,this.searchOverlayElement.style.height=`${n}px`,this.searchOverlay.setPosition(t.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{Op(ig({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)}},bet=class extends vq{static{BF(this.prototype,"storage",[pp])}#U=void qF(this,"storage");static{BF(this.prototype,"osmAuth",[pp])}#Fe=void qF(this,"osmAuth");static{BF(this.prototype,"nostrAuth",[pp])}#N=void qF(this,"nostrAuth");static{BF(this.prototype,"nostrData",[pp])}#F=void qF(this,"nostrData");static{BF(this.prototype,"isNostrConnectModalOpen",[Wr],function(){return!1})}#Ht=void qF(this,"isNostrConnectModalOpen");connectRS(){this.args.onClose(),this.args.storage.showConnectWidget()}static{$F(this.prototype,"connectRS",[Vl])}disconnectRS(){this.args.storage.disconnect()}static{$F(this.prototype,"disconnectRS",[Vl])}connectOsm(){this.args.onClose(),this.osmAuth.login()}static{$F(this.prototype,"connectOsm",[Vl])}disconnectOsm(){this.osmAuth.logout()}static{$F(this.prototype,"disconnectOsm",[Vl])}openNostrConnectModal(){this.isNostrConnectModalOpen=!0}static{$F(this.prototype,"openNostrConnectModal",[Vl])}closeNostrConnectModal(){this.isNostrConnectModalOpen=!1}static{$F(this.prototype,"closeNostrConnectModal",[Vl])}disconnectNostr(){this.nostrAuth.disconnect()}static{$F(this.prototype,"disconnectNostr",[Vl])}static{Op(ig({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:wq,on:Hw,Modal:Wq,NostrConnect:TV}),isStrictMode:!0}),this)}};function wet(t){return t}function _et(t){return Object.keys(t).map(e=>t[e])}function xet(t){if(t)if(t instanceof DW)t.executor.asyncErrorsHandled=!0;else if(t instanceof vW)return t._toPromise();return t}function Cet(t,e,n){return function(r){let i=function(t,e){if(Array.isArray(t))return t.map(e);if("object"==typeof t&&null!==t){let n={};return Object.keys(t).forEach(r=>{n[r]=e(t[r])}),n}return t}(r,xet),s=n(i);Array.isArray(s);let o=Ba.defer();t[e](i).then(o.resolve,o.reject);let a=!1,l=()=>{a||(a=!0,s.forEach(t=>{t&&(t instanceof DW?t.cancel():"function"==typeof t.__ec_cancel__&&t[hW]())}))},c=o.promise.finally(l);return c[hW]=l,c}}Cet(Ba.Promise,"all",wet),Cet(Ba,"allSettled",wet),Cet(ia,"race",wet),Cet(Ba,"hash",_et),Cet(Ba,"hashSettled",_et);var ket=class extends vW{_deferable(){return OW.defer()}},Eet=class extends ket{constructor(t){super(),this.ms=t}onYield(t){let e=Ls(()=>t.next(),this.ms);return()=>As(e)}},Ret=class extends vq{static{BF(this.prototype,"photon",[pp])}#Ne=void qF(this,"photon");static{BF(this.prototype,"osm",[pp])}#B=void qF(this,"osm");static{BF(this.prototype,"storage",[pp])}#U=void qF(this,"storage");static{BF(this.prototype,"router",[pp])}#Gt=void qF(this,"router");static{BF(this.prototype,"mapUi",[pp])}#Zt=void qF(this,"mapUi");static{BF(this.prototype,"map",[pp])}#ze=void qF(this,"map");static{BF(this.prototype,"_internalQuery",[Wr],function(){return""})}#De=void qF(this,"_internalQuery");static{BF(this.prototype,"results",[Wr],function(){return[]})}#je=void qF(this,"results");static{BF(this.prototype,"isFocused",[Wr],function(){return!1})}#Ue=void qF(this,"isFocused");static{BF(this.prototype,"isLoading",[Wr],function(){return!1})}#Be=void qF(this,"isLoading");get query(){return this.args.query??this._internalQuery}set query(t){this._internalQuery=t}get showPopover(){return this.isFocused&&this.results.length>0}handleInput(t){const e=t.target.value;this.query=e,this.args.onQueryChange&&this.args.onQueryChange(e),e.length<2?this.results=[]:this.searchTask.perform(e)}static{$F(this.prototype,"handleInput",[Vl])}formatSavedPlace(t){const e=(t._listIds||[]).map(t=>this.storage.lists?.find(e=>e.id===t)?.title).filter(Boolean).join(", "),n=e?`Saved place (${e})`:"Saved place";return{source:"saved",id:t.id,title:t.title,icon:"bookmark",description:n,osmId:t.osmId,osmType:t.osmType,lat:t.lat,lon:t.lon}}searchTask=$W(()=>({context:this,generator:function*(t){yield new Eet(300);const e="string"==typeof t?t:this.query;if(!(e.length<2)){this.isLoading=!0;try{let t,n;this.mapUi.currentCenter&&({lat:t,lon:n}=this.mapUi.currentCenter);const r=e.toLowerCase(),i=MB.filter(t=>t.label.toLowerCase().includes(r)).map(t=>({source:"category",title:t.label,id:t.id,icon:"search"}));let s=[];r.length>=3&&(s=this.storage.savedPlaces.filter(t=>t.title&&t.title.toLowerCase().includes(r)).map(t=>this.formatSavedPlace(t)));const o=yield this.photon.search(e,t,n),a=new Set(s.map(t=>t.osmId).filter(Boolean)),l=o.filter(t=>!a.has(t.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{$F(this.prototype,"handleFocus",[Vl])}handleBlur(){setTimeout(()=>{this.isFocused=!1,this.mapUi.setSearchBoxFocus(!1)},300)}static{$F(this.prototype,"handleBlur",[Vl])}handleSubmit(t){if(t.preventDefault(),!this.query)return;let e={q:this.query,selected:null,category:null};if(this.mapUi.currentCenter){const{lat:t,lon:n}=this.mapUi.currentCenter;e.lat=parseFloat(t).toFixed(4),e.lon=parseFloat(n).toFixed(4)}this.router.transitionTo("search",{queryParams:e}),this.isFocused=!1}static{$F(this.prototype,"handleSubmit",[Vl])}selectResult(t){if("category"===t.source){this.query=t.title,this.args.onQueryChange&&this.args.onQueryChange(t.title),this.results=[];let e=null,n=null;return this.mapUi.currentCenter&&(({lat:e,lon:n}=this.mapUi.currentCenter),e=e?.toString(),n=n?.toString()),void this.router.transitionTo("search",{queryParams:{q:t.title,category:t.id,selected:null,lat:e,lon:n}})}if(this.query=t.title,this.args.onQueryChange&&this.args.onQueryChange(t.title),this.results=[],"saved"===t.source&&t.id&&!t.osmId)this.router.transitionTo("place",t.id);else if(t.osmId){const e=`osm:${t.osmType}:${t.osmId}`;this.router.transitionTo("place",e)}else this.router.transitionTo("search",{queryParams:{q:t.title,lat:t.lat,lon:t.lon,selected:null,category:null}})}static{$F(this.prototype,"selectResult",[Vl])}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{$F(this.prototype,"clear",[Vl])}static{Op(ig({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:Hw,Icon:wq,or:Uq,eq:Gq,fn:zq,humanizeOsmTag:fH}),isStrictMode:!0}),this)}},Tet=class extends vq{static{BF(this.prototype,"router",[pp])}#Gt=void qF(this,"router");static{BF(this.prototype,"mapUi",[pp])}#Zt=void qF(this,"mapUi");get categories(){return MB}searchCategory(t){this.args.onSelect&&this.args.onSelect(t);let e={category:t.id,q:null};if(this.mapUi.currentCenter){const{lat:t,lon:n}=this.mapUi.currentCenter;e.lat=parseFloat(t).toFixed(4),e.lon=parseFloat(n).toFixed(4)}this.router.transitionTo("search",{queryParams:e})}static{$F(this.prototype,"searchCategory",[Vl])}static{Op(ig({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:Hq,eq:Gq,on:Hw,fn:zq,Icon:wq}),isStrictMode:!0}),this)}},Let=Xq((t,[e])=>{let n=null;return async function(){if(e)try{const r=await caches.open("nostr-image-cache-v1"),i=await r.match(e);if(i){const e=await i.blob();return n=URL.createObjectURL(e),void(t.src=n)}const s=await fetch(e,{mode:"cors",credentials:"omit"});if(s.ok){const i=s.clone();await r.put(e,i);const o=await s.blob();n=URL.createObjectURL(o),t.src=n}else t.src=e}catch(d8){console.warn(`Failed to cache image ${e}, falling back to standard src`,d8),t.src=e}else t.src=""}(),()=>{n&&(URL.revokeObjectURL(n),n=null)}}),Iet=class extends vq{static{BF(this.prototype,"storage",[pp])}#U=void qF(this,"storage");static{BF(this.prototype,"settings",[pp])}#z=void qF(this,"settings");static{BF(this.prototype,"nostrAuth",[pp])}#N=void qF(this,"nostrAuth");static{BF(this.prototype,"nostrData",[pp])}#F=void qF(this,"nostrData");static{BF(this.prototype,"mapUi",[pp])}#Zt=void qF(this,"mapUi");static{BF(this.prototype,"router",[pp])}#Gt=void qF(this,"router");static{BF(this.prototype,"isUserMenuOpen",[Wr],function(){return!1})}#$e=void qF(this,"isUserMenuOpen");static{BF(this.prototype,"searchQuery",[Wr],function(){return""})}#qe=void qF(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 t=this.mapUi.currentSearch||this.router?.currentRoute?.queryParams;if(t?.q)this.searchQuery=t.q;else if(t?.category){const e=MB.find(e=>e.id===t.category);this.searchQuery=e?e.label:t.category}else this.searchQuery=""}static{$F(this.prototype,"syncSearchQuery",[Vl])}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 t=this.mapUi.currentZoom??13;return this.settings.showQuickSearchButtons&&t>=12}toggleUserMenu(){this.isUserMenuOpen=!this.isUserMenuOpen}static{$F(this.prototype,"toggleUserMenu",[Vl])}closeUserMenu(){this.isUserMenuOpen=!1}static{$F(this.prototype,"closeUserMenu",[Vl])}handleQueryChange(t){this.searchQuery=t}static{$F(this.prototype,"handleQueryChange",[Vl])}handleChipSelect(t){this.searchQuery=t.label}static{$F(this.prototype,"handleChipSelect",[Vl])}static{Op(ig({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:Ret,CategoryChips:Tet,on:Hw,and:Hq,cachedImage:Let,Icon:wq,UserMenu:bet}),isStrictMode:!0}),this)}},Pet=class extends vq{static{BF(this.prototype,"toast",[pp])}#Mt=void qF(this,"toast");static{Op(ig({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)}},Met=a({default:()=>Aet}),Aet=class extends vq{static{BF(this.prototype,"storage",[pp])}#U=void qF(this,"storage");static{BF(this.prototype,"mapUi",[pp])}#Zt=void qF(this,"mapUi");static{BF(this.prototype,"router",[pp])}#Gt=void qF(this,"router");get isSidebarOpen(){const t=this.router.currentRouteName;return this.mapUi.isSidebarVisible&&("place"===t||"place.new"===t||"search"===t||"menu"===t||"contributions"===t||t.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{$F(this.prototype,"toggleAppMenu",[Vl])}handleOutsideClick(){const t=this.router.currentRouteName;("search"===t||"place"===t||"menu"===t||"contributions"===t||t.startsWith("lists"))&&(this.mapUi.clearSelection(),this.mapUi.hideSidebar(),"menu"===t||"contributions"===t||t.startsWith("lists")?this.router.transitionTo("index"):"place"===t&&(this.mapUi.returnToSearch&&this.mapUi.currentSearch?this.router.transitionTo("search",{queryParams:this.mapUi.currentSearch}):this.router.transitionTo("index")))}static{$F(this.prototype,"handleOutsideClick",[Vl])}refreshBookmarks(){this.storage.notifyChange()}static{$F(this.prototype,"refreshBookmarks",[Vl])}static{Op(ig({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:zH,AppHeader:Iet,on:Hw,Map:vet,Toast:Pet}),isStrictMode:!0}),this)}},Oet=a({default:()=>Net}),Net=class extends Qh{static{BF(this.prototype,"osm",[pp])}#B=void qF(this,"osm");static{BF(this.prototype,"storage",[pp])}#U=void qF(this,"storage")},Fet=a({default:()=>zet}),zet=class extends Qh{static{BF(this.prototype,"mapUi",[pp])}#Zt=void qF(this,"mapUi");activate(){this.mapUi.clearSearchResults(),this.mapUi.hideSidebar()}},Det=Op(ig({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:qv,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:Hw,Icon:wq,fn:zq}),isStrictMode:!0}),qq()),jet=class extends vq{static{BF(this.prototype,"settings",[pp])}#z=void qF(this,"settings");static{Op(ig({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:wq,on:Hw,fn:zq}),isStrictMode:!0}),this)}},Uet=class extends vq{static{BF(this.prototype,"settings",[pp])}#z=void qF(this,"settings");static{Op(ig({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:wq,on:Hw,fn:zq,eq:Gq}),isStrictMode:!0}),this)}},Bet=t=>t?t.replace(/^wss?:\/\//,""):"",$et=class extends vq{static{BF(this.prototype,"settings",[pp])}#z=void qF(this,"settings");static{BF(this.prototype,"nostrData",[pp])}#F=void qF(this,"nostrData");static{BF(this.prototype,"toast",[pp])}#Mt=void qF(this,"toast");static{BF(this.prototype,"newReadRelay",[Wr],function(){return""})}#Ve=void qF(this,"newReadRelay");static{BF(this.prototype,"newWriteRelay",[Wr],function(){return""})}#We=void qF(this,"newWriteRelay");get customReadRelays(){return pU(this.settings.nostrReadRelays||[],this.nostrData.requiredReadRelays)}get customWriteRelays(){return pU(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(t=>({url:t,isRequired:this.requiredReadRelaySet.has(t)}))}get writeRelaysForDisplay(){return this.nostrData.activeWriteRelays.map(t=>({url:t,isRequired:this.requiredWriteRelaySet.has(t)}))}updateNewReadRelay(t){this.newReadRelay=t.target.value}static{$F(this.prototype,"updateNewReadRelay",[Vl])}updateNewWriteRelay(t){this.newWriteRelay=t.target.value}static{$F(this.prototype,"updateNewWriteRelay",[Vl])}addReadRelay(){const t=uU(this.newReadRelay);if(!t)return;const e=pU(dU(this.nostrData.requiredReadRelays,[...this.customReadRelays,t]),this.nostrData.requiredReadRelays),n=this.readRelayExclusions.filter(e=>uU(e)!==t);this.settings.update("nostrReadRelays",e.length>0?e:null),this.settings.update("nostrReadRelayExclusions",n.length>0?n:null),this.newReadRelay=""}static{$F(this.prototype,"addReadRelay",[Vl])}removeReadRelay(t){if(this.requiredReadRelaySet.has(t))return;const e=uU(t),n=this.customReadRelays.filter(t=>uU(t)!==e),r=this.mailboxReadRelaySet.has(e)?Array.from(new Set([...this.readRelayExclusions,e])):this.readRelayExclusions;this.settings.update("nostrReadRelays",n.length>0?n:null),this.settings.update("nostrReadRelayExclusions",r.length>0?r:null)}static{$F(this.prototype,"removeReadRelay",[Vl])}handleReadRelayKeydown(t){"Enter"===t.key&&this.addReadRelay()}static{$F(this.prototype,"handleReadRelayKeydown",[Vl])}handleWriteRelayKeydown(t){"Enter"===t.key&&this.addWriteRelay()}static{$F(this.prototype,"handleWriteRelayKeydown",[Vl])}resetReadRelays(){this.settings.update("nostrReadRelays",null),this.settings.update("nostrReadRelayExclusions",null)}static{$F(this.prototype,"resetReadRelays",[Vl])}addWriteRelay(){const t=uU(this.newWriteRelay);if(!t)return;const e=pU(dU(this.nostrData.requiredWriteRelays,[...this.customWriteRelays,t]),this.nostrData.requiredWriteRelays),n=this.writeRelayExclusions.filter(e=>uU(e)!==t);this.settings.update("nostrWriteRelays",e.length>0?e:null),this.settings.update("nostrWriteRelayExclusions",n.length>0?n:null),this.newWriteRelay=""}static{$F(this.prototype,"addWriteRelay",[Vl])}removeWriteRelay(t){if(this.requiredWriteRelaySet.has(t))return;const e=uU(t),n=this.customWriteRelays.filter(t=>uU(t)!==e),r=this.mailboxWriteRelaySet.has(e)?Array.from(new Set([...this.writeRelayExclusions,e])):this.writeRelayExclusions;this.settings.update("nostrWriteRelays",n.length>0?n:null),this.settings.update("nostrWriteRelayExclusions",r.length>0?r:null)}static{$F(this.prototype,"removeWriteRelay",[Vl])}resetWriteRelays(){this.settings.update("nostrWriteRelays",null),this.settings.update("nostrWriteRelayExclusions",null)}static{$F(this.prototype,"resetWriteRelays",[Vl])}async clearCache(){try{await this.nostrData.clearCache(),this.toast.show("Nostr cache cleared")}catch(t){this.toast.show(`Failed to clear Nostr cache: ${t.message}`)}}static{$F(this.prototype,"clearCache",[Vl])}static{Op(ig({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:wq,stripProtocol:Bet,on:Hw,fn:zq}),isStrictMode:!0}),this)}},qet=class extends vq{static{BF(this.prototype,"settings",[pp])}#z=void qF(this,"settings");static{Op(ig({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:wq,on:Hw,fn:zq}),isStrictMode:!0}),this)}},Vet=class extends vq{static{BF(this.prototype,"settings",[pp])}#z=void qF(this,"settings");updateSetting(t,e){let n=e.target.value;"true"===n&&(n=!0),"false"===n&&(n=!1),this.settings.update(t,n)}static{$F(this.prototype,"updateSetting",[Vl])}static{Op(ig({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:Hw,Icon:wq,AppMenuSettingsMapUi:jet,AppMenuSettingsApis:Uet,AppMenuSettingsNostr:$et,AppMenuSettingsExperimental:qet}),isStrictMode:!0}),this)}},Wet=Op(ig({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:Hw,Icon:wq}),isStrictMode:!0}),qq()),Het=class extends vq{static{BF(this.prototype,"router",[pp])}#Gt=void qF(this,"router");static{BF(this.prototype,"currentView",[Wr],function(){return"menu"})}#He=void qF(this,"currentView");setView(t){this.currentView=t}static{$F(this.prototype,"setView",[Vl])}goToSavedPlaces(){this.router.transitionTo("lists.index")}static{$F(this.prototype,"goToSavedPlaces",[Vl])}goToContributions(){this.router.transitionTo("contributions")}static{$F(this.prototype,"goToContributions",[Vl])}static{Op(ig({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:Gq,AppMenuHome:Det,AppMenuSettings:Vet,fn:zq,AppMenuAbout:Wet}),isStrictMode:!0}),this)}},Get=a({default:()=>Zet}),Zet=class extends vq{static{BF(this.prototype,"router",[pp])}#Gt=void qF(this,"router");close(){this.router.transitionTo("index")}static{$F(this.prototype,"close",[Vl])}static{Op(ig({id:null,block:'[[[8,[32,0],null,[["@onClose"],[[30,0,["close"]]]],null]],[],[]]',moduleName:"(unknown template module)",scope:()=>({AppMenu:Het}),isStrictMode:!0}),this)}},Ket=a({default:()=>Yet}),Yet=class extends Qh{static{BF(this.prototype,"mapUi",[pp])}#Zt=void qF(this,"mapUi");activate(){this.mapUi.showSidebar()}},Xet=a({default:()=>Jet}),Jet=class extends Qh{static{BF(this.prototype,"osmAuth",[pp])}#Fe=void qF(this,"osmAuth");static{BF(this.prototype,"router",[pp])}#Gt=void qF(this,"router");async model(){try{await this.osmAuth.handleCallback()}catch(t){console.error("Failed to handle OSM OAuth callback",t)}finally{this.router.transitionTo("index")}}},Qet=a({default:()=>tnt}),tnt=class extends vq{static{BF(this.prototype,"router",[pp])}#Gt=void qF(this,"router");static{BF(this.prototype,"storage",[pp])}#U=void qF(this,"storage");static{BF(this.prototype,"mapUi",[pp])}#Zt=void qF(this,"mapUi");static{BF(this.prototype,"localPlace",[Wr],function(){return null})}#Ge=void qF(this,"localPlace");constructor(){super(...arguments),this.localPlace=this.args.model}get place(){const t=this.args.model,e=t.osmId||t.id;return this.storage.findPlaceById(e)||(!this.localPlace||this.localPlace.osmId!==e&&this.localPlace.id!==e?t.createdAt?{...t,id:void 0,createdAt:void 0,geohash:void 0}:t:this.localPlace)}handleUpdate(t){console.debug("Updating local place state:",t),this.localPlace=t,this.storage.notifyChange()}static{$F(this.prototype,"handleUpdate",[Vl])}refreshMap(){this.storage.notifyChange()}static{$F(this.prototype,"refreshMap",[Vl])}navigateBack(t){if(null===t)if(this.mapUi.returnToRoute){this.mapUi.showSidebar();const{name:t,model:e}=this.mapUi.returnToRoute;void 0!==e?this.router.transitionTo(t,e):this.router.transitionTo(t)}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",t)}static{$F(this.prototype,"navigateBack",[Vl])}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{$F(this.prototype,"close",[Vl])}static{Op(ig({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:gH}),isStrictMode:!0}),this)}},ent=a({default:()=>nnt}),nnt=class extends Qh{static{BF(this.prototype,"storage",[pp])}#U=void qF(this,"storage");static{BF(this.prototype,"osm",[pp])}#B=void qF(this,"osm");static{BF(this.prototype,"mapUi",[pp])}#Zt=void qF(this,"mapUi");async model(t){const e=t.place_id;let n,r,i=!1;(e.startsWith("osm:node:")||e.startsWith("osm:way:")||e.startsWith("osm:relation:"))&&(i=!0,[,n,r]=e.split(":"),console.debug(`Fetching explicit OSM ${n}:`,r));let s=null;i&&(s=this.loadOsmPlace(r,n)),await this.waitForSync();let o=i?r:e,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:",e),null)}async waitForSync(){if(this.storage.initialSyncDone)return;console.debug("Waiting for initial storage sync...");const t=Date.now();for(;!this.storage.initialSyncDone;){if(Date.now()-t>5e3){console.warn("Timed out waiting for initial sync");break}await new Promise(t=>setTimeout(t,100))}}async afterModel(t){if(t&&t.osmId&&t.osmType&&"node"!==t.osmType&&!t.geojson){console.debug("Model missing geometry, fetching full OSM details...");const e=await this.loadOsmPlace(t.osmId,t.osmType);e&&(Object.assign(t,e),console.debug("Enriched model with full OSM details",t))}if(t){const e={preventZoom:this.mapUi.preventNextZoom};this.mapUi.selectPlace(t,e),this.mapUi.showSidebar(),this.mapUi.preventNextZoom=!1}this.mapUi.stopSearch()}deactivate(){this.mapUi.clearSelection(),this.mapUi.returnToSearch=!1,this.mapUi.returnToRoute=null}async loadOsmPlace(t,e=null){try{const n=await this.osm.fetchOsmObject(t,e);if(n)return console.debug("Found OSM POI:",n),n}catch(n){console.error("Failed to fetch POI",n)}return null}setupController(t,e){super.setupController(t,e),this.checkUpdates(e)}async checkUpdates(t){if(t&&t.osmId&&t.osmType){if(t.id){const e=await this.storage.refreshPlace(t);return void(e&&this.mapUi.selectPlace(e,{preventZoom:!0}))}try{const e=await this.osm.fetchOsmObject(t.osmId,t.osmType,{forceFresh:!0});e&&function(t,e){const n=Math.abs((t.lat??0)-(e.lat??0)),r=Math.abs((t.lon??0)-(e.lon??0));if(n>1e-5||r>1e-5)return!0;const i=t.osmTags||{},s=e.osmTags||{},o=new Set([...Object.keys(i),...Object.keys(s)]);for(const a of o)if(i[a]!==s[a])return!0;return!1}(t,e)&&(Object.assign(t,e),this.mapUi.selectPlace(t,{preventZoom:!0}))}catch(e){console.debug("[place] Fresh fetch failed for",t.osmId,e)}}}serialize(t){return t.osmId&&t.osmType?{place_id:`osm:${t.osmType}:${t.osmId}`}:t.id?{place_id:t.id}:{place_id:t.osmId}}},rnt=a({default:()=>int}),int=class extends vq{static{BF(this.prototype,"router",[pp])}#Gt=void qF(this,"router");static{BF(this.prototype,"storage",[pp])}#U=void qF(this,"storage");static{BF(this.prototype,"mapUi",[pp])}#Zt=void qF(this,"mapUi");get initialPlace(){return{title:"",description:""}}close(){this.router.transitionTo("index")}static{$F(this.prototype,"close",[Vl])}async savePlace(t){try{const e=this.mapUi.creationCoordinates||{lat:this.args.model.lat,lon:this.args.model.lon},n=parseFloat(e.lat.toFixed(6)),r=parseFloat(e.lon.toFixed(6)),i={title:t.title||"Untitled Place",description:t.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(e){console.error("Failed to create place:",e),alert("Failed to create place: "+e.message)}}static{$F(this.prototype,"savePlace",[Vl])}static{Op(ig({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:wq,on:Hw,PlaceEditForm:XW}),isStrictMode:!0}),this)}},snt=a({default:()=>ont}),ont=class extends Qh{static{BF(this.prototype,"mapUi",[pp])}#Zt=void qF(this,"mapUi");queryParams={lat:{refreshModel:!0},lon:{refreshModel:!0}};model(t){return{lat:parseFloat(t.lat),lon:parseFloat(t.lon)}}setupController(t,e){super.setupController(t,e),e.lat&&e.lon&&this.mapUi.updateCreationCoordinates(e.lat,e.lon),this.mapUi.startCreating(),this.mapUi.showSidebar()}deactivate(){this.mapUi.stopCreating()}},ant=Object.assign({},Q_,{"marco/config/environment":rx,"marco/deprecation-workflow":xx,"marco/router":Ix,"marco/services/blossom":VF,"marco/services/contributions":tz,"marco/services/image-processor":iz,"marco/services/local-forage":az,"marco/services/map-ui":uz,"marco/services/nostr-auth":zD,"marco/services/nostr-data":bU,"marco/services/nostr-relay":UU,"marco/services/nostr-zap":XU,"marco/services/osm-auth":wB,"marco/services/osm":NB,"marco/services/photon":zB,"marco/services/settings":jB,"marco/services/storage":t$,"marco/services/toast":n$,"marco/utils/contributions":ZF,"marco/utils/device":OD,"marco/utils/format-text":CB,"marco/utils/geo":i$,"marco/utils/geohash-coverage":yU,"marco/utils/icons":o$,"marco/utils/nostr":cU,"marco/utils/osm-icons":h$,"marco/utils/osm":RB,"marco/utils/photo-tag-suggestions":v$,"marco/utils/place-mapping":_$,"marco/utils/poi-categories":PB,"marco/utils/poi-category-matcher":g$,"marco/utils/social-links":C$,"marco/workers/image-processor":B$,"marco/services/page-title":K$,"marco/templates/contributions":PV,"marco/controllers/contributions":qW,"marco/routes/contributions":WW,"marco/templates/lists":GW,"marco/routes/lists":KW,"marco/templates/lists/list":mH,"marco/controllers/lists/list":vH,"marco/routes/lists/list":SH,"marco/templates/lists/index":EH,"marco/routes/lists/index":TH,"marco/templates/search":IH,"marco/controllers/search":MH,"marco/routes/search":OH,"marco/templates/application":Met,"marco/routes/application":Oet,"marco/routes/index":Fet,"marco/templates/menu":Get,"marco/routes/menu":Ket,"marco/routes/oauth/osm-callback":Xet,"marco/templates/place":Qet,"marco/routes/place":ent,"marco/templates/place/new":rnt,"marco/routes/place/new":snt},{}),lnt=class{constructor(t,e,n){this.limit=t,this.func=e,this.store=n,this.size=0,this.misses=0,this.hits=0,this.store=n||new Map}get(t){let e=this.store.get(t);return this.store.has(t)?(this.hits++,this.store.get(t)):(this.misses++,e=this.set(t,this.func(t)),e)}set(t,e){return this.limit>this.size&&(this.size++,this.store.set(t,e)),e}purge(){this.store.clear(),this.size=0,this.hits=0,this.misses=0}},cnt=/[ _]/g,unt=new lnt(1e3,t=>function(t){return bnt.get(t)}(t).replace(cnt,"-")),hnt=/^(\-|_)+(.)?/,dnt=/(.)(\-|\_|\.|\s)+(.)?/g,pnt=/(^|\/|\.)([a-z])/g,fnt=new lnt(1e3,t=>{const e=(t,e,n)=>n?`_${n.toUpperCase()}`:"",n=(t,e,n,r)=>e+(r?r.toUpperCase():""),r=t.split("/");for(let i=0;i<r.length;i++)r[i]=r[i].replace(hnt,e).replace(dnt,n);return r.join("/").replace(pnt,t=>t.toUpperCase())}),gnt=/([a-z\d])([A-Z]+)/g,mnt=/\-|\s+/g,ynt=new lnt(1e3,t=>t.replace(gnt,"$1_$2").replace(mnt,"_").toLowerCase()),vnt=/([a-z\d])([A-Z])/g,bnt=new lnt(1e3,t=>t.replace(vnt,"$1_$2").toLowerCase());function wnt(t){return fnt.get(t)}var _nt=class{constructor(t){this._entries=t||globalThis.requirejs.entries}moduleNames(){return Object.keys(this._entries)}has(t){return t in this._entries}get(...t){return globalThis.require(...t)}},xnt=class{static moduleBasedResolver=!0;moduleBasedResolver=!0;_deprecatedPodModulePrefix=!1;_normalizeCache=Object.create(null);static create(t){return new this(t)}moduleNameLookupPatterns=[this.podBasedModuleName,this.podBasedComponentsInSubdir,this.mainModuleName,this.defaultModuleName,this.nestedColocationComponentModuleName];static withModules(t){return class extends(this){static explicitModules=t}}constructor(t){if(Object.assign(this,t),!this._moduleRegistry){let t=this.constructor.explicitModules;t?this._moduleRegistry={moduleNames:()=>Object.keys(t),has:e=>Boolean(t[e]),get:e=>t[e],addModules(e){t=Object.assign({},t,e)}}:(void 0===globalThis.requirejs.entries&&(globalThis.requirejs.entries=globalThis.requirejs._eak_seen),this._moduleRegistry=new _nt)}this.pluralizedTypes=this.pluralizedTypes||Object.create(null),this.pluralizedTypes.config||(this.pluralizedTypes.config="config")}makeToString(t,e){return this.namespace.modulePrefix+"@"+e+":"}shouldWrapInClassFactory(){return!1}parseName(t){if(!0===t.parsedName)return t;let e,n,r,i=t.split("@");if(3===i.length){if(0===i[0].length){e=`@${i[1]}`;let t=i[2].split(":");n=t[0],r=t[1]}else e=`@${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 t=i[0].split(":");if(2===t.length)0===t[1].length?(n=t[0],r=`@${i[1]}`):(e=t[1],n=t[0],r=i[1]);else{let t=i[1].split(":");e=i[0],n=t[0],r=t[1]}"template"===n&&0===e.lastIndexOf("components/",0)&&(r=`components/${r}`,e=e.slice(11))}else i=t.split(":"),n=i[0],r=i[1];let s=r,o=this.namespace;return{parsedName:!0,fullName:t,prefix:e||this.prefix({type:n}),type:n,fullNameWithoutType:s,name:r,root:o,resolveMethodName:"resolve"+wnt(n)}}resolveOther(t){Cnt("`modulePrefix` must be defined",this.namespace.modulePrefix);let e=this.findModuleName(t);if(e){let r=this._extractDefaultExport(e,t);if(void 0===r)throw new Error(` Expected to find: '${t.fullName}' within '${e}' but got 'undefined'. Did you forget to 'export default' within '${e}'?`);return this.shouldWrapInClassFactory(r,t)&&(n=r,r={create:t=>"function"==typeof n.extend?n.extend(t):n}),r}var n}normalize(t){return this._normalizeCache[t]||(this._normalizeCache[t]=this._normalize(t))}resolve(t){if("resolver:current"===t)return{create:()=>this};let e,n=this.parseName(t),r=n.resolveMethodName;return"function"==typeof this[r]&&(e=this[r](n)),null==e&&(e=this.resolveOther(n)),e}addModules(t){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(t)}_normalize(t){let e=t.split(":");if(e.length>1){let t=e[0];return"component"===t||"helper"===t||"modifier"===t||"template"===t&&0===e[1].indexOf("components/")?t+":"+e[1].replace(/_/g,"-"):t+":"+function(t){return unt.get(t)}(e[1].replace(/\./g,"/"))}return t}pluralize(t){return this.pluralizedTypes[t]||(this.pluralizedTypes[t]=t+"s")}podBasedLookupWithPrefix(t,e){let n=e.fullNameWithoutType;return"template"===e.type&&(n=n.replace(/^components\//,"")),t+"/"+n+"/"+e.type}podBasedModuleName(t){let e=this.namespace.podModulePrefix||this.namespace.modulePrefix;return this.podBasedLookupWithPrefix(e,t)}podBasedComponentsInSubdir(t){let e=this.namespace.podModulePrefix||this.namespace.modulePrefix;if(e+="/components","component"===t.type||/^components/.test(t.fullNameWithoutType))return this.podBasedLookupWithPrefix(e,t)}resolveEngine(t){let e=t.fullNameWithoutType+"/engine";if(this._moduleRegistry.has(e))return this._extractDefaultExport(e)}resolveRouteMap(t){let e=t.fullNameWithoutType,n=e+"/routes";if(this._moduleRegistry.has(n)){let t=this._extractDefaultExport(n);return Cnt(`The route map for ${e} should be wrapped by 'buildRoutes' before exporting.`,t.isRouteMap),t}}resolveTemplate(t){return this.resolveOther(t)}mainModuleName(t){if("main"===t.fullNameWithoutType)return t.prefix+"/"+t.type}defaultModuleName(t){return t.prefix+"/"+this.pluralize(t.type)+"/"+t.fullNameWithoutType}nestedColocationComponentModuleName(t){if("component"===t.type)return t.prefix+"/"+this.pluralize(t.type)+"/"+t.fullNameWithoutType+"/index"}prefix(t){let e=this.namespace.modulePrefix;return this.namespace[t.type+"Prefix"]&&(e=this.namespace[t.type+"Prefix"]),e}findModuleName(t){let e,n=this.moduleNameLookupPatterns;for(let r=0,i=n.length;r<i;r++){let i=n[r].call(this,t);if(i&&(i=this.chooseModuleName(i)),i&&this._moduleRegistry.has(i)&&(e=i),e)return e}}chooseModuleName(t){let e=function(t){return ynt.get(t)}(t);if(t!==e&&this._moduleRegistry.has(t)&&this._moduleRegistry.has(e))throw new TypeError(`Ambiguous module names: '${t}' and '${e}'`);return this._moduleRegistry.has(t)?t:this._moduleRegistry.has(e)?e:void 0}knownForType(t){let e=this._moduleRegistry.moduleNames(),n=Object.create(null);for(let r=0,i=e.length;r<i;r++){let i=e[r],s=this.translateToContainerFullname(t,i);s&&(n[s]=!0)}return n}translateToContainerFullname(t,e){let n=this.prefix({type:t}),r=n+"/",i="/"+t,s=e.indexOf(r),o=e.indexOf(i);if(0===s&&o===e.length-i.length&&e.length>r.length+i.length)return t+":"+e.slice(s+r.length,o);let a=n+"/"+this.pluralize(t)+"/";return 0===e.indexOf(a)&&e.length>a.length?t+":"+e.slice(a.length):void 0}_extractDefaultExport(t){let e=this._moduleRegistry.get(t,null,null,!0);return e&&e.default&&(e=e.default),e}};function Cnt(t,e){if(!e)throw new Error(t)}(class extends J_{modulePrefix=ix.modulePrefix;podModulePrefix=ix.podModulePrefix;Resolver=xnt.withModules(ant);inspector=function(t){!function(t){globalThis.emberInspectorApps||(globalThis.emberInspectorApps=[]),globalThis.emberInspectorApps.push({app:t,name:`app-${globalThis.emberInspectorApps.length}`,loadCompatInspector:()=>sU(()=>import("./modules-4-12-Bd2khITt.js"),[])}),globalThis.dispatchEvent&&globalThis.dispatchEvent(new Event("Ember"))}(t)}(this)}).create(ix.APP);export{Hv as $,al as $n,it as $r,jp as $t,cx as A,dc as An,Xe as Ar,cm as At,fb as B,cc as Bn,ee as Br,gg as Bt,TO as C,Xc as Cn,or as Cr,oy as Ct,AA as D,xc as Dn,Xn as Dr,ty as Dt,FA as E,Ec as En,Bn as Er,xm as Et,O_ as F,sc as Fn,Oe as Fr,Wg as Ft,sb as G,ec as Gn,Yt as Gr,Bp as Gt,vb as H,Kl as Hn,re as Hr,Up as Ht,Uw as I,Jl as In,Ee as Ir,sm as It,ab as J,Dl as Jn,Ft as Jr,Wp as Jt,ob as K,Bl as Kn,Kt as Kr,Hp as Kt,db as L,Zl as Ln,Re as Lr,$g as Lt,k_ as M,nc as Mn,Je as Mr,tm as Mt,x_ as N,rc as Nn,en as Nr,nm as Nt,hM as O,_c as On,He as Or,Jm as Ot,C_ as P,Gl as Pn,Me as Pr,rm as Pt,Wv as Q,ol as Qn,st as Qr,Dp as Qt,gb as R,uc as Rn,se as Rr,Sg as Rt,VO as S,Jc as Sn,hr as Sr,ly as St,hO as T,Mc as Tn,rr as Tr,Xm as Tt,yb as U,Hl as Un,ie as Ur,qp as Ut,mb as V,Ql as Vn,te as Vr,vg as Vt,eb as W,tc as Wn,Qt as Wr,$p as Wt,Kv as X,kl as Xn,ct as Xr,Gp as Xt,nb as Y,Tl as Yn,ut as Yr,Zp as Yt,Yv as Z,_l as Zn,nt as Zr,Fp as Zt,X$ as _,mu as _n,Sr as _r,By as _t,Eq as a,w as ai,zu as an,Mo as ar,Ey as at,_N as b,cu as bn,br,cy as bt,Lq as c,xu as cn,gs as cr,Ly as ct,Pq as d,Uu as dn,ni as dr,Vy as dt,et as ei,zp as en,ll as er,Gv as et,Cq as f,_u as fn,Kr as fr,Py as ft,rq as g,Pu as gn,kr as gr,nv as gt,iq as h,Au as hn,Pr as hr,rv as ht,Sq as i,_ as ii,Cu as in,$a as ir,sv as it,K_ as j,oc as jn,Qe as jr,Vg as jt,Ex as k,vc as kn,Ve as kr,Qm as kt,kq as l,Du as ln,Ci as lr,qy as lt,sq as m,Fu as mn,Ar as mr,iv as mt,AW as n,p as ni,Op as nn,tl as nr,Dv as nt,Rq as o,b as oi,Nu as on,Io as or,ky as ot,uq as p,wu as pn,Dr as pr,Sy as pt,ib as q,Ul as qn,Ct as qr,Vp as qt,Iq as r,h as ri,hp as rn,qa as rr,mv as rt,Tq as s,a as si,Mu as sn,Gs as sr,_y as st,FH as t,m as ti,Np as tn,nl as tr,Uv as tt,Mq as u,ju as un,ri as ur,xy as ut,Y$ as v,bu as vn,Mr as vr,Iy as vt,CO as w,Gc as wn,nr as wr,ay as wt,cN as x,lu as xn,gr as xr,wm as xt,jF as y,vu as yn,Rr as yr,Uy as yt,cb as z,ac as zn,ne as zr,mg as zt}; |