fostr/dist2/code/index-COc6jZBc.js

1660 lines
176 KiB
JavaScript

(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&n(s)}).observe(document,{childList:!0,subtree:!0});function r(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(o){if(o.ep)return;o.ep=!0;const i=r(o);fetch(o.href,i)}})();var Ar="";function Sr(e){Ar=e}function ps(e=""){if(!Ar){const t=[...document.getElementsByTagName("script")],r=t.find(n=>n.hasAttribute("data-shoelace"));if(r)Sr(r.getAttribute("data-shoelace"));else{const n=t.find(i=>/shoelace(\.min)?\.js($|\?)/.test(i.src)||/shoelace-autoloader(\.min)?\.js($|\?)/.test(i.src));let o="";n&&(o=n.getAttribute("src")),Sr(o.split("/").slice(0,-1).join("/"))}}return Ar.replace(/\/$/,"")+(e?`/${e.replace(/^\//,"")}`:"")}var go=Object.defineProperty,gs=Object.defineProperties,bs=Object.getOwnPropertyDescriptor,ms=Object.getOwnPropertyDescriptors,Tn=Object.getOwnPropertySymbols,ys=Object.prototype.hasOwnProperty,ws=Object.prototype.propertyIsEnumerable,In=(e,t,r)=>t in e?go(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_e=(e,t)=>{for(var r in t||(t={}))ys.call(t,r)&&In(e,r,t[r]);if(Tn)for(var r of Tn(t))ws.call(t,r)&&In(e,r,t[r]);return e},bo=(e,t)=>gs(e,ms(t)),T=(e,t,r,n)=>{for(var o=n>1?void 0:n?bs(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&go(t,r,o),o},mo=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},vs=(e,t,r)=>(mo(e,t,"read from private field"),t.get(e)),xs=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Es=(e,t,r,n)=>(mo(e,t,"write to private field"),t.set(e,r),r);Sr("https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.16.0/cdn/");/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const Be=globalThis,qr=Be.ShadowRoot&&(Be.ShadyCSS===void 0||Be.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,jr=Symbol(),Mn=new WeakMap;let yo=class{constructor(t,r,n){if(this._$cssResult$=!0,n!==jr)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=r}get styleSheet(){let t=this.o;const r=this.t;if(qr&&t===void 0){const n=r!==void 0&&r.length===1;n&&(t=Mn.get(r)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&Mn.set(r,t))}return t}toString(){return this.cssText}};const _s=e=>new yo(typeof e=="string"?e:e+"",void 0,jr),ct=(e,...t)=>{const r=e.length===1?e[0]:t.reduce((n,o,i)=>n+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+e[i+1],e[0]);return new yo(r,e,jr)},$s=(e,t)=>{if(qr)e.adoptedStyleSheets=t.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet);else for(const r of t){const n=document.createElement("style"),o=Be.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=r.cssText,e.appendChild(n)}},Rn=qr?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let r="";for(const n of t.cssRules)r+=n.cssText;return _s(r)})(e):e;/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const{is:As,defineProperty:Ss,getOwnPropertyDescriptor:ks,getOwnPropertyNames:Ps,getOwnPropertySymbols:Cs,getPrototypeOf:Bs}=Object,Ve=globalThis,Nn=Ve.trustedTypes,Ls=Nn?Nn.emptyScript:"",Us=Ve.reactiveElementPolyfillSupport,me=(e,t)=>e,Ie={toAttribute(e,t){switch(t){case Boolean:e=e?Ls:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=e!==null;break;case Number:r=e===null?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch{r=null}}return r}},Fr=(e,t)=>!As(e,t),On={attribute:!0,type:String,converter:Ie,reflect:!1,hasChanged:Fr};Symbol.metadata??=Symbol("metadata"),Ve.litPropertyMetadata??=new WeakMap;class Yt extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,r=On){if(r.state&&(r.attribute=!1),this._$Ei(),this.elementProperties.set(t,r),!r.noAccessor){const n=Symbol(),o=this.getPropertyDescriptor(t,n,r);o!==void 0&&Ss(this.prototype,t,o)}}static getPropertyDescriptor(t,r,n){const{get:o,set:i}=ks(this.prototype,t)??{get(){return this[r]},set(s){this[r]=s}};return{get(){return o?.call(this)},set(s){const l=o?.call(this);i.call(this,s),this.requestUpdate(t,l,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??On}static _$Ei(){if(this.hasOwnProperty(me("elementProperties")))return;const t=Bs(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(me("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(me("properties"))){const r=this.properties,n=[...Ps(r),...Cs(r)];for(const o of n)this.createProperty(o,r[o])}const t=this[Symbol.metadata];if(t!==null){const r=litPropertyMetadata.get(t);if(r!==void 0)for(const[n,o]of r)this.elementProperties.set(n,o)}this._$Eh=new Map;for(const[r,n]of this.elementProperties){const o=this._$Eu(r,n);o!==void 0&&this._$Eh.set(o,r)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const r=[];if(Array.isArray(t)){const n=new Set(t.flat(1/0).reverse());for(const o of n)r.unshift(Rn(o))}else t!==void 0&&r.push(Rn(t));return r}static _$Eu(t,r){const n=r.attribute;return n===!1?void 0:typeof n=="string"?n:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,r=this.constructor.elementProperties;for(const n of r.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return $s(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,r,n){this._$AK(t,n)}_$EC(t,r){const n=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,n);if(o!==void 0&&n.reflect===!0){const i=(n.converter?.toAttribute!==void 0?n.converter:Ie).toAttribute(r,n.type);this._$Em=t,i==null?this.removeAttribute(o):this.setAttribute(o,i),this._$Em=null}}_$AK(t,r){const n=this.constructor,o=n._$Eh.get(t);if(o!==void 0&&this._$Em!==o){const i=n.getPropertyOptions(o),s=typeof i.converter=="function"?{fromAttribute:i.converter}:i.converter?.fromAttribute!==void 0?i.converter:Ie;this._$Em=o,this[o]=s.fromAttribute(r,i.type),this._$Em=null}}requestUpdate(t,r,n){if(t!==void 0){if(n??=this.constructor.getPropertyOptions(t),!(n.hasChanged??Fr)(this[t],r))return;this.P(t,r,n)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,r,n){this._$AL.has(t)||this._$AL.set(t,r),n.reflect===!0&&this._$Em!==t&&(this._$Ej??=new Set).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(r){Promise.reject(r)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[o,i]of this._$Ep)this[o]=i;this._$Ep=void 0}const n=this.constructor.elementProperties;if(n.size>0)for(const[o,i]of n)i.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.P(o,this[o],i)}let t=!1;const r=this._$AL;try{t=this.shouldUpdate(r),t?(this.willUpdate(r),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(r)):this._$EU()}catch(n){throw t=!1,this._$EU(),n}t&&this._$AE(r)}willUpdate(t){}_$AE(t){this._$EO?.forEach(r=>r.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&=this._$Ej.forEach(r=>this._$EC(r,this[r])),this._$EU()}updated(t){}firstUpdated(t){}}Yt.elementStyles=[],Yt.shadowRootOptions={mode:"open"},Yt[me("elementProperties")]=new Map,Yt[me("finalized")]=new Map,Us?.({ReactiveElement:Yt}),(Ve.reactiveElementVersions??=[]).push("2.0.4");/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const Wr=globalThis,Me=Wr.trustedTypes,Hn=Me?Me.createPolicy("lit-html",{createHTML:e=>e}):void 0,wo="$lit$",Ct=`lit$${Math.random().toFixed(9).slice(2)}$`,vo="?"+Ct,Ts=`<${vo}>`,qt=document,ye=()=>qt.createComment(""),we=e=>e===null||typeof e!="object"&&typeof e!="function",Kr=Array.isArray,Is=e=>Kr(e)||typeof e?.[Symbol.iterator]=="function",lr=`[
\f\r]`,de=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,zn=/-->/g,Vn=/>/g,Ot=RegExp(`>|${lr}(?:([^\\s"'>=/]+)(${lr}*=${lr}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Dn=/'/g,qn=/"/g,xo=/^(?:script|style|textarea|title)$/i,Ms=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}),G=Ms(1),jt=Symbol.for("lit-noChange"),F=Symbol.for("lit-nothing"),jn=new WeakMap,Vt=qt.createTreeWalker(qt,129);function Eo(e,t){if(!Kr(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Hn!==void 0?Hn.createHTML(t):t}const Rs=(e,t)=>{const r=e.length-1,n=[];let o,i=t===2?"<svg>":t===3?"<math>":"",s=de;for(let l=0;l<r;l++){const a=e[l];let c,u,d=-1,m=0;for(;m<a.length&&(s.lastIndex=m,u=s.exec(a),u!==null);)m=s.lastIndex,s===de?u[1]==="!--"?s=zn:u[1]!==void 0?s=Vn:u[2]!==void 0?(xo.test(u[2])&&(o=RegExp("</"+u[2],"g")),s=Ot):u[3]!==void 0&&(s=Ot):s===Ot?u[0]===">"?(s=o??de,d=-1):u[1]===void 0?d=-2:(d=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?Ot:u[3]==='"'?qn:Dn):s===qn||s===Dn?s=Ot:s===zn||s===Vn?s=de:(s=Ot,o=void 0);const g=s===Ot&&e[l+1].startsWith("/>")?" ":"";i+=s===de?a+Ts:d>=0?(n.push(c),a.slice(0,d)+wo+a.slice(d)+Ct+g):a+Ct+(d===-2?l:g)}return[Eo(e,i+(e[r]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),n]};class ve{constructor({strings:t,_$litType$:r},n){let o;this.parts=[];let i=0,s=0;const l=t.length-1,a=this.parts,[c,u]=Rs(t,r);if(this.el=ve.createElement(c,n),Vt.currentNode=this.el.content,r===2||r===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(o=Vt.nextNode())!==null&&a.length<l;){if(o.nodeType===1){if(o.hasAttributes())for(const d of o.getAttributeNames())if(d.endsWith(wo)){const m=u[s++],g=o.getAttribute(d).split(Ct),p=/([.?@])?(.*)/.exec(m);a.push({type:1,index:i,name:p[2],strings:g,ctor:p[1]==="."?Os:p[1]==="?"?Hs:p[1]==="@"?zs:De}),o.removeAttribute(d)}else d.startsWith(Ct)&&(a.push({type:6,index:i}),o.removeAttribute(d));if(xo.test(o.tagName)){const d=o.textContent.split(Ct),m=d.length-1;if(m>0){o.textContent=Me?Me.emptyScript:"";for(let g=0;g<m;g++)o.append(d[g],ye()),Vt.nextNode(),a.push({type:2,index:++i});o.append(d[m],ye())}}}else if(o.nodeType===8)if(o.data===vo)a.push({type:2,index:i});else{let d=-1;for(;(d=o.data.indexOf(Ct,d+1))!==-1;)a.push({type:7,index:i}),d+=Ct.length-1}i++}}static createElement(t,r){const n=qt.createElement("template");return n.innerHTML=t,n}}function te(e,t,r=e,n){if(t===jt)return t;let o=n!==void 0?r._$Co?.[n]:r._$Cl;const i=we(t)?void 0:t._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),i===void 0?o=void 0:(o=new i(e),o._$AT(e,r,n)),n!==void 0?(r._$Co??=[])[n]=o:r._$Cl=o),o!==void 0&&(t=te(e,o._$AS(e,t.values),o,n)),t}class Ns{constructor(t,r){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=r}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:r},parts:n}=this._$AD,o=(t?.creationScope??qt).importNode(r,!0);Vt.currentNode=o;let i=Vt.nextNode(),s=0,l=0,a=n[0];for(;a!==void 0;){if(s===a.index){let c;a.type===2?c=new $e(i,i.nextSibling,this,t):a.type===1?c=new a.ctor(i,a.name,a.strings,this,t):a.type===6&&(c=new Vs(i,this,t)),this._$AV.push(c),a=n[++l]}s!==a?.index&&(i=Vt.nextNode(),s++)}return Vt.currentNode=qt,o}p(t){let r=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(t,n,r),r+=n.strings.length-2):n._$AI(t[r])),r++}}class $e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,r,n,o){this.type=2,this._$AH=F,this._$AN=void 0,this._$AA=t,this._$AB=r,this._$AM=n,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const r=this._$AM;return r!==void 0&&t?.nodeType===11&&(t=r.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,r=this){t=te(this,t,r),we(t)?t===F||t==null||t===""?(this._$AH!==F&&this._$AR(),this._$AH=F):t!==this._$AH&&t!==jt&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Is(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==F&&we(this._$AH)?this._$AA.nextSibling.data=t:this.T(qt.createTextNode(t)),this._$AH=t}$(t){const{values:r,_$litType$:n}=t,o=typeof n=="number"?this._$AC(t):(n.el===void 0&&(n.el=ve.createElement(Eo(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===o)this._$AH.p(r);else{const i=new Ns(o,this),s=i.u(this.options);i.p(r),this.T(s),this._$AH=i}}_$AC(t){let r=jn.get(t.strings);return r===void 0&&jn.set(t.strings,r=new ve(t)),r}k(t){Kr(this._$AH)||(this._$AH=[],this._$AR());const r=this._$AH;let n,o=0;for(const i of t)o===r.length?r.push(n=new $e(this.O(ye()),this.O(ye()),this,this.options)):n=r[o],n._$AI(i),o++;o<r.length&&(this._$AR(n&&n._$AB.nextSibling,o),r.length=o)}_$AR(t=this._$AA.nextSibling,r){for(this._$AP?.(!1,!0,r);t&&t!==this._$AB;){const n=t.nextSibling;t.remove(),t=n}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}}class De{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,r,n,o,i){this.type=1,this._$AH=F,this._$AN=void 0,this.element=t,this.name=r,this._$AM=o,this.options=i,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=F}_$AI(t,r=this,n,o){const i=this.strings;let s=!1;if(i===void 0)t=te(this,t,r,0),s=!we(t)||t!==this._$AH&&t!==jt,s&&(this._$AH=t);else{const l=t;let a,c;for(t=i[0],a=0;a<i.length-1;a++)c=te(this,l[n+a],r,a),c===jt&&(c=this._$AH[a]),s||=!we(c)||c!==this._$AH[a],c===F?t=F:t!==F&&(t+=(c??"")+i[a+1]),this._$AH[a]=c}s&&!o&&this.j(t)}j(t){t===F?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Os extends De{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===F?void 0:t}}class Hs extends De{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==F)}}class zs extends De{constructor(t,r,n,o,i){super(t,r,n,o,i),this.type=5}_$AI(t,r=this){if((t=te(this,t,r,0)??F)===jt)return;const n=this._$AH,o=t===F&&n!==F||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,i=t!==F&&(n===F||o);o&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class Vs{constructor(t,r,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=r,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){te(this,t)}}const Ds=Wr.litHtmlPolyfillSupport;Ds?.(ve,$e),(Wr.litHtmlVersions??=[]).push("3.2.1");const qs=(e,t,r)=>{const n=r?.renderBefore??t;let o=n._$litPart$;if(o===void 0){const i=r?.renderBefore??null;n._$litPart$=o=new $e(t.insertBefore(ye(),i),i,void 0,r??{})}return o._$AI(e),o};/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/let gt=class extends Yt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=qs(r,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return jt}};gt._$litElement$=!0,gt.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:gt});const js=globalThis.litElementPolyfillSupport;js?.({LitElement:gt});(globalThis.litElementVersions??=[]).push("4.1.1");/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const qe=e=>(t,r)=>{r!==void 0?r.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const Fs={attribute:!0,type:String,converter:Ie,reflect:!1,hasChanged:Fr},Ws=(e=Fs,t,r)=>{const{kind:n,metadata:o}=r;let i=globalThis.litPropertyMetadata.get(o);if(i===void 0&&globalThis.litPropertyMetadata.set(o,i=new Map),i.set(r.name,e),n==="accessor"){const{name:s}=r;return{set(l){const a=t.get.call(this);t.set.call(this,l),this.requestUpdate(s,a,e)},init(l){return l!==void 0&&this.P(s,void 0,e),l}}}if(n==="setter"){const{name:s}=r;return function(l){const a=this[s];t.call(this,l),this.requestUpdate(s,a,e)}}throw Error("Unsupported decorator location: "+n)};function S(e){return(t,r)=>typeof r=="object"?Ws(e,t,r):((n,o,i)=>{const s=o.hasOwnProperty(i);return o.constructor.createProperty(i,s?{...n,wrapped:!0}:n),s?Object.getOwnPropertyDescriptor(o,i):void 0})(e,t,r)}/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/function Zr(e){return S({...e,state:!0,attribute:!1})}/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const Ks=(e,t,r)=>(r.configurable=!0,r.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(e,t,r),r);/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/function Zs(e,t){return(r,n,o)=>{const i=s=>s.renderRoot?.querySelector(e)??null;return Ks(r,n,{get(){return i(this)}})}}function Fn(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function _o(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function Gs(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Fn(e.outputLen),Fn(e.blockLen)}function Re(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Js(e,t){_o(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}const cr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const $o=e=>e instanceof Uint8Array,dr=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),ot=(e,t)=>e<<32-t|e>>>t,Ys=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!Ys)throw new Error("Non little-endian hardware is not supported");function Xs(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Gr(e){if(typeof e=="string"&&(e=Xs(e)),!$o(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}function Qs(...e){const t=new Uint8Array(e.reduce((n,o)=>n+o.length,0));let r=0;return e.forEach(n=>{if(!$o(n))throw new Error("Uint8Array expected");t.set(n,r),r+=n.length}),t}let Ao=class{clone(){return this._cloneInto()}};function ta(e){const t=n=>e().update(Gr(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function So(e=32){if(cr&&typeof cr.getRandomValues=="function")return cr.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}function ea(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);const o=BigInt(32),i=BigInt(4294967295),s=Number(r>>o&i),l=Number(r&i),a=n?4:0,c=n?0:4;e.setUint32(t+a,s,n),e.setUint32(t+c,l,n)}let ra=class extends Ao{constructor(t,r,n,o){super(),this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=dr(this.buffer)}update(t){Re(this);const{view:r,buffer:n,blockLen:o}=this;t=Gr(t);const i=t.length;for(let s=0;s<i;){const l=Math.min(o-this.pos,i-s);if(l===o){const a=dr(t);for(;o<=i-s;s+=o)this.process(a,s);continue}n.set(t.subarray(s,s+l),this.pos),this.pos+=l,s+=l,this.pos===o&&(this.process(r,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Re(this),Js(t,this),this.finished=!0;const{buffer:r,view:n,blockLen:o,isLE:i}=this;let{pos:s}=this;r[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>o-s&&(this.process(n,0),s=0);for(let d=s;d<o;d++)r[d]=0;ea(n,o-8,BigInt(this.length*8),i),this.process(n,0);const l=dr(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<c;d++)l.setUint32(4*d,u[d],i)}digest(){const{buffer:t,outputLen:r}=this;this.digestInto(t);const n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:r,buffer:n,length:o,finished:i,destroyed:s,pos:l}=this;return t.length=o,t.pos=l,t.finished=i,t.destroyed=s,o%r&&t.buffer.set(n),t}};const na=(e,t,r)=>e&t^~e&r,oa=(e,t,r)=>e&t^e&r^t&r,ia=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]),$t=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),At=new Uint32Array(64);let sa=class extends ra{constructor(){super(64,32,8,!1),this.A=$t[0]|0,this.B=$t[1]|0,this.C=$t[2]|0,this.D=$t[3]|0,this.E=$t[4]|0,this.F=$t[5]|0,this.G=$t[6]|0,this.H=$t[7]|0}get(){const{A:t,B:r,C:n,D:o,E:i,F:s,G:l,H:a}=this;return[t,r,n,o,i,s,l,a]}set(t,r,n,o,i,s,l,a){this.A=t|0,this.B=r|0,this.C=n|0,this.D=o|0,this.E=i|0,this.F=s|0,this.G=l|0,this.H=a|0}process(t,r){for(let d=0;d<16;d++,r+=4)At[d]=t.getUint32(r,!1);for(let d=16;d<64;d++){const m=At[d-15],g=At[d-2],p=ot(m,7)^ot(m,18)^m>>>3,h=ot(g,17)^ot(g,19)^g>>>10;At[d]=h+At[d-7]+p+At[d-16]|0}let{A:n,B:o,C:i,D:s,E:l,F:a,G:c,H:u}=this;for(let d=0;d<64;d++){const m=ot(l,6)^ot(l,11)^ot(l,25),g=u+m+na(l,a,c)+ia[d]+At[d]|0,h=(ot(n,2)^ot(n,13)^ot(n,22))+oa(n,o,i)|0;u=c,c=a,a=l,l=s+g|0,s=i,i=o,o=n,n=g+h|0}n=n+this.A|0,o=o+this.B|0,i=i+this.C|0,s=s+this.D|0,l=l+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(n,o,i,s,l,a,c,u)}roundClean(){At.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const kr=ta(()=>new sa);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ko=BigInt(0),je=BigInt(1),aa=BigInt(2),Fe=e=>e instanceof Uint8Array,la=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ee(e){if(!Fe(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=la[e[r]];return t}function Po(e){const t=e.toString(16);return t.length&1?`0${t}`:t}function Jr(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return BigInt(e===""?"0":`0x${e}`)}function re(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(t/2);for(let n=0;n<r.length;n++){const o=n*2,i=e.slice(o,o+2),s=Number.parseInt(i,16);if(Number.isNaN(s)||s<0)throw new Error("Invalid byte sequence");r[n]=s}return r}function X(e){return Jr(ee(e))}function Yr(e){if(!Fe(e))throw new Error("Uint8Array expected");return Jr(ee(Uint8Array.from(e).reverse()))}function Tt(e,t){return re(e.toString(16).padStart(t*2,"0"))}function Xr(e,t){return Tt(e,t).reverse()}function ca(e){return re(Po(e))}function Z(e,t,r){let n;if(typeof t=="string")try{n=re(t)}catch(i){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${i}`)}else if(Fe(t))n=Uint8Array.from(t);else throw new Error(`${e} must be hex string or Uint8Array`);const o=n.length;if(typeof r=="number"&&o!==r)throw new Error(`${e} expected ${r} bytes, got ${o}`);return n}function Ft(...e){const t=new Uint8Array(e.reduce((n,o)=>n+o.length,0));let r=0;return e.forEach(n=>{if(!Fe(n))throw new Error("Uint8Array expected");t.set(n,r),r+=n.length}),t}function da(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function ua(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function ha(e){let t;for(t=0;e>ko;e>>=je,t+=1);return t}function fa(e,t){return e>>BigInt(t)&je}const pa=(e,t,r)=>e|(r?je:ko)<<BigInt(t),Qr=e=>(aa<<BigInt(e-1))-je,ur=e=>new Uint8Array(e),Wn=e=>Uint8Array.from(e);function Co(e,t,r){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=ur(e),o=ur(e),i=0;const s=()=>{n.fill(1),o.fill(0),i=0},l=(...d)=>r(o,n,...d),a=(d=ur())=>{o=l(Wn([0]),d),n=l(),d.length!==0&&(o=l(Wn([1]),d),n=l())},c=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const m=[];for(;d<t;){n=l();const g=n.slice();m.push(g),d+=n.length}return Ft(...m)};return(d,m)=>{s(),a(d);let g;for(;!(g=m(c()));)a();return s(),g}}const ga={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||e instanceof Uint8Array,isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function Ae(e,t,r={}){const n=(o,i,s)=>{const l=ga[i];if(typeof l!="function")throw new Error(`Invalid validator "${i}", expected function`);const a=e[o];if(!(s&&a===void 0)&&!l(a,e))throw new Error(`Invalid param ${String(o)}=${a} (${typeof a}), expected ${i}`)};for(const[o,i]of Object.entries(t))n(o,i,!1);for(const[o,i]of Object.entries(r))n(o,i,!0);return e}const ba=Object.freeze(Object.defineProperty({__proto__:null,bitGet:fa,bitLen:ha,bitMask:Qr,bitSet:pa,bytesToHex:ee,bytesToNumberBE:X,bytesToNumberLE:Yr,concatBytes:Ft,createHmacDrbg:Co,ensureBytes:Z,equalBytes:da,hexToBytes:re,hexToNumber:Jr,numberToBytesBE:Tt,numberToBytesLE:Xr,numberToHexUnpadded:Po,numberToVarBytesBE:ca,utf8ToBytes:ua,validateObject:Ae},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const W=BigInt(0),j=BigInt(1),Ht=BigInt(2),ma=BigInt(3),Pr=BigInt(4),Kn=BigInt(5),Zn=BigInt(8);BigInt(9);BigInt(16);function K(e,t){const r=e%t;return r>=W?r:t+r}function ya(e,t,r){if(r<=W||t<W)throw new Error("Expected power/modulo > 0");if(r===j)return W;let n=j;for(;t>W;)t&j&&(n=n*e%r),e=e*e%r,t>>=j;return n}function Q(e,t,r){let n=e;for(;t-- >W;)n*=n,n%=r;return n}function Cr(e,t){if(e===W||t<=W)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=K(e,t),n=t,o=W,i=j;for(;r!==W;){const l=n/r,a=n%r,c=o-i*l;n=r,r=a,o=i,i=c}if(n!==j)throw new Error("invert: does not exist");return K(o,t)}function wa(e){const t=(e-j)/Ht;let r,n,o;for(r=e-j,n=0;r%Ht===W;r/=Ht,n++);for(o=Ht;o<e&&ya(o,t,e)!==e-j;o++);if(n===1){const s=(e+j)/Pr;return function(a,c){const u=a.pow(c,s);if(!a.eql(a.sqr(u),c))throw new Error("Cannot find square root");return u}}const i=(r+j)/Ht;return function(l,a){if(l.pow(a,t)===l.neg(l.ONE))throw new Error("Cannot find square root");let c=n,u=l.pow(l.mul(l.ONE,o),r),d=l.pow(a,i),m=l.pow(a,r);for(;!l.eql(m,l.ONE);){if(l.eql(m,l.ZERO))return l.ZERO;let g=1;for(let h=l.sqr(m);g<c&&!l.eql(h,l.ONE);g++)h=l.sqr(h);const p=l.pow(u,j<<BigInt(c-g-1));u=l.sqr(p),d=l.mul(d,p),m=l.mul(m,u),c=g}return d}}function va(e){if(e%Pr===ma){const t=(e+j)/Pr;return function(n,o){const i=n.pow(o,t);if(!n.eql(n.sqr(i),o))throw new Error("Cannot find square root");return i}}if(e%Zn===Kn){const t=(e-Kn)/Zn;return function(n,o){const i=n.mul(o,Ht),s=n.pow(i,t),l=n.mul(o,s),a=n.mul(n.mul(l,Ht),s),c=n.mul(l,n.sub(a,n.ONE));if(!n.eql(n.sqr(c),o))throw new Error("Cannot find square root");return c}}return wa(e)}const xa=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Ea(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=xa.reduce((n,o)=>(n[o]="function",n),t);return Ae(e,r)}function _a(e,t,r){if(r<W)throw new Error("Expected power > 0");if(r===W)return e.ONE;if(r===j)return t;let n=e.ONE,o=t;for(;r>W;)r&j&&(n=e.mul(n,o)),o=e.sqr(o),r>>=j;return n}function $a(e,t){const r=new Array(t.length),n=t.reduce((i,s,l)=>e.is0(s)?i:(r[l]=i,e.mul(i,s)),e.ONE),o=e.inv(n);return t.reduceRight((i,s,l)=>e.is0(s)?i:(r[l]=e.mul(i,r[l]),e.mul(i,s)),o),r}function Bo(e,t){const r=t!==void 0?t:e.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function Aa(e,t,r=!1,n={}){if(e<=W)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:o,nByteLength:i}=Bo(e,t);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=va(e),l=Object.freeze({ORDER:e,BITS:o,BYTES:i,MASK:Qr(o),ZERO:W,ONE:j,create:a=>K(a,e),isValid:a=>{if(typeof a!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof a}`);return W<=a&&a<e},is0:a=>a===W,isOdd:a=>(a&j)===j,neg:a=>K(-a,e),eql:(a,c)=>a===c,sqr:a=>K(a*a,e),add:(a,c)=>K(a+c,e),sub:(a,c)=>K(a-c,e),mul:(a,c)=>K(a*c,e),pow:(a,c)=>_a(l,a,c),div:(a,c)=>K(a*Cr(c,e),e),sqrN:a=>a*a,addN:(a,c)=>a+c,subN:(a,c)=>a-c,mulN:(a,c)=>a*c,inv:a=>Cr(a,e),sqrt:n.sqrt||(a=>s(l,a)),invertBatch:a=>$a(l,a),cmov:(a,c,u)=>u?c:a,toBytes:a=>r?Xr(a,i):Tt(a,i),fromBytes:a=>{if(a.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${a.length}`);return r?Yr(a):X(a)}});return Object.freeze(l)}function Lo(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function Uo(e){const t=Lo(e);return t+Math.ceil(t/2)}function Sa(e,t,r=!1){const n=e.length,o=Lo(t),i=Uo(t);if(n<16||n<i||n>1024)throw new Error(`expected ${i}-1024 bytes of input, got ${n}`);const s=r?X(e):Yr(e),l=K(s,t-j)+j;return r?Xr(l,o):Tt(l,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ka=BigInt(0),hr=BigInt(1);function Pa(e,t){const r=(o,i)=>{const s=i.negate();return o?s:i},n=o=>{const i=Math.ceil(t/o)+1,s=2**(o-1);return{windows:i,windowSize:s}};return{constTimeNegate:r,unsafeLadder(o,i){let s=e.ZERO,l=o;for(;i>ka;)i&hr&&(s=s.add(l)),l=l.double(),i>>=hr;return s},precomputeWindow(o,i){const{windows:s,windowSize:l}=n(i),a=[];let c=o,u=c;for(let d=0;d<s;d++){u=c,a.push(u);for(let m=1;m<l;m++)u=u.add(c),a.push(u);c=u.double()}return a},wNAF(o,i,s){const{windows:l,windowSize:a}=n(o);let c=e.ZERO,u=e.BASE;const d=BigInt(2**o-1),m=2**o,g=BigInt(o);for(let p=0;p<l;p++){const h=p*a;let f=Number(s&d);s>>=g,f>a&&(f-=m,s+=hr);const b=h,x=h+Math.abs(f)-1,A=p%2!==0,U=f<0;f===0?u=u.add(r(A,i[b])):c=c.add(r(U,i[x]))}return{p:c,f:u}},wNAFCached(o,i,s,l){const a=o._WINDOW_SIZE||1;let c=i.get(o);return c||(c=this.precomputeWindow(o,a),a!==1&&i.set(o,l(c))),this.wNAF(a,c,s)}}}function To(e){return Ea(e.Fp),Ae(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Bo(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ca(e){const t=To(e);Ae(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:r,Fp:n,a:o}=t;if(r){if(!n.eql(o,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}const{bytesToNumberBE:Ba,hexToBytes:La}=ba,Dt={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(e){const{Err:t}=Dt;if(e.length<2||e[0]!==2)throw new t("Invalid signature integer tag");const r=e[1],n=e.subarray(2,r+2);if(!r||n.length!==r)throw new t("Invalid signature integer: wrong length");if(n[0]&128)throw new t("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:Ba(n),l:e.subarray(r+2)}},toSig(e){const{Err:t}=Dt,r=typeof e=="string"?La(e):e;if(!(r instanceof Uint8Array))throw new Error("ui8a expected");let n=r.length;if(n<2||r[0]!=48)throw new t("Invalid signature tag");if(r[1]!==n-2)throw new t("Invalid signature: incorrect length");const{d:o,l:i}=Dt._parseInt(r.subarray(2)),{d:s,l}=Dt._parseInt(i);if(l.length)throw new t("Invalid signature: left bytes after parsing");return{r:o,s}},hexFromSig(e){const t=c=>Number.parseInt(c[0],16)&8?"00"+c:c,r=c=>{const u=c.toString(16);return u.length&1?`0${u}`:u},n=t(r(e.s)),o=t(r(e.r)),i=n.length/2,s=o.length/2,l=r(i),a=r(s);return`30${r(s+i+4)}02${a}${o}02${l}${n}`}},ht=BigInt(0),tt=BigInt(1);BigInt(2);const Gn=BigInt(3);BigInt(4);function Ua(e){const t=Ca(e),{Fp:r}=t,n=t.toBytes||((p,h,f)=>{const b=h.toAffine();return Ft(Uint8Array.from([4]),r.toBytes(b.x),r.toBytes(b.y))}),o=t.fromBytes||(p=>{const h=p.subarray(1),f=r.fromBytes(h.subarray(0,r.BYTES)),b=r.fromBytes(h.subarray(r.BYTES,2*r.BYTES));return{x:f,y:b}});function i(p){const{a:h,b:f}=t,b=r.sqr(p),x=r.mul(b,p);return r.add(r.add(x,r.mul(p,h)),f)}if(!r.eql(r.sqr(t.Gy),i(t.Gx)))throw new Error("bad generator point: equation left != right");function s(p){return typeof p=="bigint"&&ht<p&&p<t.n}function l(p){if(!s(p))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function a(p){const{allowedPrivateKeyLengths:h,nByteLength:f,wrapPrivateKey:b,n:x}=t;if(h&&typeof p!="bigint"){if(p instanceof Uint8Array&&(p=ee(p)),typeof p!="string"||!h.includes(p.length))throw new Error("Invalid key");p=p.padStart(f*2,"0")}let A;try{A=typeof p=="bigint"?p:X(Z("private key",p,f))}catch{throw new Error(`private key must be ${f} bytes, hex or bigint, not ${typeof p}`)}return b&&(A=K(A,x)),l(A),A}const c=new Map;function u(p){if(!(p instanceof d))throw new Error("ProjectivePoint expected")}class d{constructor(h,f,b){if(this.px=h,this.py=f,this.pz=b,h==null||!r.isValid(h))throw new Error("x required");if(f==null||!r.isValid(f))throw new Error("y required");if(b==null||!r.isValid(b))throw new Error("z required")}static fromAffine(h){const{x:f,y:b}=h||{};if(!h||!r.isValid(f)||!r.isValid(b))throw new Error("invalid affine point");if(h instanceof d)throw new Error("projective point not allowed");const x=A=>r.eql(A,r.ZERO);return x(f)&&x(b)?d.ZERO:new d(f,b,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(h){const f=r.invertBatch(h.map(b=>b.pz));return h.map((b,x)=>b.toAffine(f[x])).map(d.fromAffine)}static fromHex(h){const f=d.fromAffine(o(Z("pointHex",h)));return f.assertValidity(),f}static fromPrivateKey(h){return d.BASE.multiply(a(h))}_setWindowSize(h){this._WINDOW_SIZE=h,c.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:h,y:f}=this.toAffine();if(!r.isValid(h)||!r.isValid(f))throw new Error("bad point: x or y not FE");const b=r.sqr(f),x=i(h);if(!r.eql(b,x))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:h}=this.toAffine();if(r.isOdd)return!r.isOdd(h);throw new Error("Field doesn't support isOdd")}equals(h){u(h);const{px:f,py:b,pz:x}=this,{px:A,py:U,pz:C}=h,v=r.eql(r.mul(f,C),r.mul(A,x)),E=r.eql(r.mul(b,C),r.mul(U,x));return v&&E}negate(){return new d(this.px,r.neg(this.py),this.pz)}double(){const{a:h,b:f}=t,b=r.mul(f,Gn),{px:x,py:A,pz:U}=this;let C=r.ZERO,v=r.ZERO,E=r.ZERO,_=r.mul(x,x),V=r.mul(A,A),L=r.mul(U,U),k=r.mul(x,A);return k=r.add(k,k),E=r.mul(x,U),E=r.add(E,E),C=r.mul(h,E),v=r.mul(b,L),v=r.add(C,v),C=r.sub(V,v),v=r.add(V,v),v=r.mul(C,v),C=r.mul(k,C),E=r.mul(b,E),L=r.mul(h,L),k=r.sub(_,L),k=r.mul(h,k),k=r.add(k,E),E=r.add(_,_),_=r.add(E,_),_=r.add(_,L),_=r.mul(_,k),v=r.add(v,_),L=r.mul(A,U),L=r.add(L,L),_=r.mul(L,k),C=r.sub(C,_),E=r.mul(L,V),E=r.add(E,E),E=r.add(E,E),new d(C,v,E)}add(h){u(h);const{px:f,py:b,pz:x}=this,{px:A,py:U,pz:C}=h;let v=r.ZERO,E=r.ZERO,_=r.ZERO;const V=t.a,L=r.mul(t.b,Gn);let k=r.mul(f,A),O=r.mul(b,U),H=r.mul(x,C),D=r.add(f,b),y=r.add(A,U);D=r.mul(D,y),y=r.add(k,O),D=r.sub(D,y),y=r.add(f,x);let w=r.add(A,C);return y=r.mul(y,w),w=r.add(k,H),y=r.sub(y,w),w=r.add(b,x),v=r.add(U,C),w=r.mul(w,v),v=r.add(O,H),w=r.sub(w,v),_=r.mul(V,y),v=r.mul(L,H),_=r.add(v,_),v=r.sub(O,_),_=r.add(O,_),E=r.mul(v,_),O=r.add(k,k),O=r.add(O,k),H=r.mul(V,H),y=r.mul(L,y),O=r.add(O,H),H=r.sub(k,H),H=r.mul(V,H),y=r.add(y,H),k=r.mul(O,y),E=r.add(E,k),k=r.mul(w,y),v=r.mul(D,v),v=r.sub(v,k),k=r.mul(D,O),_=r.mul(w,_),_=r.add(_,k),new d(v,E,_)}subtract(h){return this.add(h.negate())}is0(){return this.equals(d.ZERO)}wNAF(h){return g.wNAFCached(this,c,h,f=>{const b=r.invertBatch(f.map(x=>x.pz));return f.map((x,A)=>x.toAffine(b[A])).map(d.fromAffine)})}multiplyUnsafe(h){const f=d.ZERO;if(h===ht)return f;if(l(h),h===tt)return this;const{endo:b}=t;if(!b)return g.unsafeLadder(this,h);let{k1neg:x,k1:A,k2neg:U,k2:C}=b.splitScalar(h),v=f,E=f,_=this;for(;A>ht||C>ht;)A&tt&&(v=v.add(_)),C&tt&&(E=E.add(_)),_=_.double(),A>>=tt,C>>=tt;return x&&(v=v.negate()),U&&(E=E.negate()),E=new d(r.mul(E.px,b.beta),E.py,E.pz),v.add(E)}multiply(h){l(h);let f=h,b,x;const{endo:A}=t;if(A){const{k1neg:U,k1:C,k2neg:v,k2:E}=A.splitScalar(f);let{p:_,f:V}=this.wNAF(C),{p:L,f:k}=this.wNAF(E);_=g.constTimeNegate(U,_),L=g.constTimeNegate(v,L),L=new d(r.mul(L.px,A.beta),L.py,L.pz),b=_.add(L),x=V.add(k)}else{const{p:U,f:C}=this.wNAF(f);b=U,x=C}return d.normalizeZ([b,x])[0]}multiplyAndAddUnsafe(h,f,b){const x=d.BASE,A=(C,v)=>v===ht||v===tt||!C.equals(x)?C.multiplyUnsafe(v):C.multiply(v),U=A(this,f).add(A(h,b));return U.is0()?void 0:U}toAffine(h){const{px:f,py:b,pz:x}=this,A=this.is0();h==null&&(h=A?r.ONE:r.inv(x));const U=r.mul(f,h),C=r.mul(b,h),v=r.mul(x,h);if(A)return{x:r.ZERO,y:r.ZERO};if(!r.eql(v,r.ONE))throw new Error("invZ was invalid");return{x:U,y:C}}isTorsionFree(){const{h,isTorsionFree:f}=t;if(h===tt)return!0;if(f)return f(d,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h,clearCofactor:f}=t;return h===tt?this:f?f(d,this):this.multiplyUnsafe(t.h)}toRawBytes(h=!0){return this.assertValidity(),n(d,this,h)}toHex(h=!0){return ee(this.toRawBytes(h))}}d.BASE=new d(t.Gx,t.Gy,r.ONE),d.ZERO=new d(r.ZERO,r.ONE,r.ZERO);const m=t.nBitLength,g=Pa(d,t.endo?Math.ceil(m/2):m);return{CURVE:t,ProjectivePoint:d,normPrivateKeyToScalar:a,weierstrassEquation:i,isWithinCurveOrder:s}}function Ta(e){const t=To(e);return Ae(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function Ia(e){const t=Ta(e),{Fp:r,n}=t,o=r.BYTES+1,i=2*r.BYTES+1;function s(y){return ht<y&&y<r.ORDER}function l(y){return K(y,n)}function a(y){return Cr(y,n)}const{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:d,isWithinCurveOrder:m}=Ua({...t,toBytes(y,w,$){const B=w.toAffine(),P=r.toBytes(B.x),I=Ft;return $?I(Uint8Array.from([w.hasEvenY()?2:3]),P):I(Uint8Array.from([4]),P,r.toBytes(B.y))},fromBytes(y){const w=y.length,$=y[0],B=y.subarray(1);if(w===o&&($===2||$===3)){const P=X(B);if(!s(P))throw new Error("Point is not on curve");const I=d(P);let z=r.sqrt(I);const R=(z&tt)===tt;return($&1)===1!==R&&(z=r.neg(z)),{x:P,y:z}}else if(w===i&&$===4){const P=r.fromBytes(B.subarray(0,r.BYTES)),I=r.fromBytes(B.subarray(r.BYTES,2*r.BYTES));return{x:P,y:I}}else throw new Error(`Point of length ${w} was invalid. Expected ${o} compressed bytes or ${i} uncompressed bytes`)}}),g=y=>ee(Tt(y,t.nByteLength));function p(y){const w=n>>tt;return y>w}function h(y){return p(y)?l(-y):y}const f=(y,w,$)=>X(y.slice(w,$));class b{constructor(w,$,B){this.r=w,this.s=$,this.recovery=B,this.assertValidity()}static fromCompact(w){const $=t.nByteLength;return w=Z("compactSignature",w,$*2),new b(f(w,0,$),f(w,$,2*$))}static fromDER(w){const{r:$,s:B}=Dt.toSig(Z("DER",w));return new b($,B)}assertValidity(){if(!m(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!m(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(w){return new b(this.r,this.s,w)}recoverPublicKey(w){const{r:$,s:B,recovery:P}=this,I=E(Z("msgHash",w));if(P==null||![0,1,2,3].includes(P))throw new Error("recovery id invalid");const z=P===2||P===3?$+t.n:$;if(z>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const R=P&1?"03":"02",et=c.fromHex(R+g(z)),Et=a(z),Kt=l(-I*Et),ce=l(B*Et),_t=c.BASE.multiplyAndAddUnsafe(et,Kt,ce);if(!_t)throw new Error("point at infinify");return _t.assertValidity(),_t}hasHighS(){return p(this.s)}normalizeS(){return this.hasHighS()?new b(this.r,l(-this.s),this.recovery):this}toDERRawBytes(){return re(this.toDERHex())}toDERHex(){return Dt.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return re(this.toCompactHex())}toCompactHex(){return g(this.r)+g(this.s)}}const x={isValidPrivateKey(y){try{return u(y),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const y=Uo(t.n);return Sa(t.randomBytes(y),t.n)},precompute(y=8,w=c.BASE){return w._setWindowSize(y),w.multiply(BigInt(3)),w}};function A(y,w=!0){return c.fromPrivateKey(y).toRawBytes(w)}function U(y){const w=y instanceof Uint8Array,$=typeof y=="string",B=(w||$)&&y.length;return w?B===o||B===i:$?B===2*o||B===2*i:y instanceof c}function C(y,w,$=!0){if(U(y))throw new Error("first arg must be private key");if(!U(w))throw new Error("second arg must be public key");return c.fromHex(w).multiply(u(y)).toRawBytes($)}const v=t.bits2int||function(y){const w=X(y),$=y.length*8-t.nBitLength;return $>0?w>>BigInt($):w},E=t.bits2int_modN||function(y){return l(v(y))},_=Qr(t.nBitLength);function V(y){if(typeof y!="bigint")throw new Error("bigint expected");if(!(ht<=y&&y<_))throw new Error(`bigint expected < 2^${t.nBitLength}`);return Tt(y,t.nByteLength)}function L(y,w,$=k){if(["recovered","canonical"].some(Nt=>Nt in $))throw new Error("sign() legacy options not supported");const{hash:B,randomBytes:P}=t;let{lowS:I,prehash:z,extraEntropy:R}=$;I==null&&(I=!0),y=Z("msgHash",y),z&&(y=Z("prehashed msgHash",B(y)));const et=E(y),Et=u(w),Kt=[V(Et),V(et)];if(R!=null){const Nt=R===!0?P(r.BYTES):R;Kt.push(Z("extraEntropy",Nt))}const ce=Ft(...Kt),_t=et;function ar(Nt){const Zt=v(Nt);if(!m(Zt))return;const Bn=a(Zt),nt=c.BASE.multiply(Zt).toAffine(),Gt=l(nt.x);if(Gt===ht)return;const Se=l(Bn*l(_t+Gt*Et));if(Se===ht)return;let Ln=(nt.x===Gt?0:2)|Number(nt.y&tt),Un=Se;return I&&p(Se)&&(Un=h(Se),Ln^=1),new b(Gt,Un,Ln)}return{seed:ce,k2sig:ar}}const k={lowS:t.lowS,prehash:!1},O={lowS:t.lowS,prehash:!1};function H(y,w,$=k){const{seed:B,k2sig:P}=L(y,w,$),I=t;return Co(I.hash.outputLen,I.nByteLength,I.hmac)(B,P)}c.BASE._setWindowSize(8);function D(y,w,$,B=O){const P=y;if(w=Z("msgHash",w),$=Z("publicKey",$),"strict"in B)throw new Error("options.strict was renamed to lowS");const{lowS:I,prehash:z}=B;let R,et;try{if(typeof P=="string"||P instanceof Uint8Array)try{R=b.fromDER(P)}catch(nt){if(!(nt instanceof Dt.Err))throw nt;R=b.fromCompact(P)}else if(typeof P=="object"&&typeof P.r=="bigint"&&typeof P.s=="bigint"){const{r:nt,s:Gt}=P;R=new b(nt,Gt)}else throw new Error("PARSE");et=c.fromHex($)}catch(nt){if(nt.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(I&&R.hasHighS())return!1;z&&(w=t.hash(w));const{r:Et,s:Kt}=R,ce=E(w),_t=a(Kt),ar=l(ce*_t),Nt=l(Et*_t),Zt=c.BASE.multiplyAndAddUnsafe(et,ar,Nt)?.toAffine();return Zt?l(Zt.x)===Et:!1}return{CURVE:t,getPublicKey:A,getSharedSecret:C,sign:H,verify:D,ProjectivePoint:c,Signature:b,utils:x}}let Io=class extends Ao{constructor(t,r){super(),this.finished=!1,this.destroyed=!1,Gs(t);const n=Gr(r);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,i=new Uint8Array(o);i.set(n.length>o?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 Re(this),this.iHash.update(t),this}digestInto(t){Re(this),_o(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:r,iHash:n,finished:o,destroyed:i,blockLen:s,outputLen:l}=this;return t=t,t.finished=o,t.destroyed=i,t.blockLen=s,t.outputLen=l,t.oHash=r._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const Mo=(e,t,r)=>new Io(e,t).update(r).digest();Mo.create=(e,t)=>new Io(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ma(e){return{hash:e,hmac:(t,...r)=>Mo(e,t,Qs(...r)),randomBytes:So}}function Ra(e,t){const r=n=>Ia({...e,...Ma(n)});return Object.freeze({...r(t),create:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const We=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Ne=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Ro=BigInt(1),Oe=BigInt(2),Jn=(e,t)=>(e+t/Oe)/t;function No(e){const t=We,r=BigInt(3),n=BigInt(6),o=BigInt(11),i=BigInt(22),s=BigInt(23),l=BigInt(44),a=BigInt(88),c=e*e*e%t,u=c*c*e%t,d=Q(u,r,t)*u%t,m=Q(d,r,t)*u%t,g=Q(m,Oe,t)*c%t,p=Q(g,o,t)*g%t,h=Q(p,i,t)*p%t,f=Q(h,l,t)*h%t,b=Q(f,a,t)*f%t,x=Q(b,l,t)*h%t,A=Q(x,r,t)*u%t,U=Q(A,s,t)*p%t,C=Q(U,n,t)*c%t,v=Q(C,Oe,t);if(!Br.eql(Br.sqr(v),e))throw new Error("Cannot find square root");return v}const Br=Aa(We,void 0,void 0,{sqrt:No}),se=Ra({a:BigInt(0),b:BigInt(7),Fp:Br,n:Ne,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=Ne,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-Ro*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=r,s=BigInt("0x100000000000000000000000000000000"),l=Jn(i*e,t),a=Jn(-n*e,t);let c=K(e-l*r-a*o,t),u=K(-l*n-a*i,t);const d=c>s,m=u>s;if(d&&(c=t-c),m&&(u=t-u),c>s||u>s)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:d,k1:c,k2neg:m,k2:u}}}},kr),Ke=BigInt(0),Oo=e=>typeof e=="bigint"&&Ke<e&&e<We,Na=e=>typeof e=="bigint"&&Ke<e&&e<Ne,Yn={};function He(e,...t){let r=Yn[e];if(r===void 0){const n=kr(Uint8Array.from(e,o=>o.charCodeAt(0)));r=Ft(n,n),Yn[e]=r}return kr(Ft(r,...t))}const tn=e=>e.toRawBytes(!0).slice(1),Lr=e=>Tt(e,32),fr=e=>K(e,We),xe=e=>K(e,Ne),en=se.ProjectivePoint,Oa=(e,t,r)=>en.BASE.multiplyAndAddUnsafe(e,t,r);function Ur(e){let t=se.utils.normPrivateKeyToScalar(e),r=en.fromPrivateKey(t);return{scalar:r.hasEvenY()?t:xe(-t),bytes:tn(r)}}function Ho(e){if(!Oo(e))throw new Error("bad x: need 0 < x < p");const t=fr(e*e),r=fr(t*e+BigInt(7));let n=No(r);n%Oe!==Ke&&(n=fr(-n));const o=new en(e,n,Ro);return o.assertValidity(),o}function zo(...e){return xe(X(He("BIP0340/challenge",...e)))}function Ha(e){return Ur(e).bytes}function za(e,t,r=So(32)){const n=Z("message",e),{bytes:o,scalar:i}=Ur(t),s=Z("auxRand",r,32),l=Lr(i^X(He("BIP0340/aux",s))),a=He("BIP0340/nonce",l,o,n),c=xe(X(a));if(c===Ke)throw new Error("sign failed: k is zero");const{bytes:u,scalar:d}=Ur(c),m=zo(u,o,n),g=new Uint8Array(64);if(g.set(u,0),g.set(Lr(xe(d+m*i)),32),!Vo(g,n,o))throw new Error("sign: Invalid signature produced");return g}function Vo(e,t,r){const n=Z("signature",e,64),o=Z("message",t),i=Z("publicKey",r,32);try{const s=Ho(X(i)),l=X(n.subarray(0,32));if(!Oo(l))return!1;const a=X(n.subarray(32,64));if(!Na(a))return!1;const c=zo(Lr(l),tn(s),o),u=Oa(s,a,xe(-c));return!(!u||!u.hasEvenY()||u.toAffine().x!==l)}catch{return!1}}const ue={getPublicKey:Ha,sign:za,verify:Vo,utils:{randomPrivateKey:se.utils.randomPrivateKey,lift_x:Ho,pointToBytes:tn,numberToBytesBE:Tt,bytesToNumberBE:X,taggedHash:He,mod:K}},pr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const rn=e=>e instanceof Uint8Array,gr=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),it=(e,t)=>e<<32-t|e>>>t,Va=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!Va)throw new Error("Non little-endian hardware is not supported");const Da=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Y(e){if(!rn(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=Da[e[r]];return t}function ne(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(t/2);for(let n=0;n<r.length;n++){const o=n*2,i=e.slice(o,o+2),s=Number.parseInt(i,16);if(Number.isNaN(s)||s<0)throw new Error("Invalid byte sequence");r[n]=s}return r}function qa(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Ee(e){if(typeof e=="string"&&(e=qa(e)),!rn(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}function Ze(...e){const t=new Uint8Array(e.reduce((n,o)=>n+o.length,0));let r=0;return e.forEach(n=>{if(!rn(n))throw new Error("Uint8Array expected");t.set(n,r),r+=n.length}),t}class Do{clone(){return this._cloneInto()}}function qo(e){const t=n=>e().update(Ee(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function jo(e=32){if(pr&&typeof pr.getRandomValues=="function")return pr.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}function Tr(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function ja(e){if(typeof e!="boolean")throw new Error(`Expected boolean, not ${e}`)}function Fo(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function Fa(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Tr(e.outputLen),Tr(e.blockLen)}function Wa(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Ka(e,t){Fo(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}const st={number:Tr,bool:ja,bytes:Fo,hash:Fa,exists:Wa,output:Ka};function Za(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);const o=BigInt(32),i=BigInt(4294967295),s=Number(r>>o&i),l=Number(r&i),a=n?4:0,c=n?0:4;e.setUint32(t+a,s,n),e.setUint32(t+c,l,n)}class Ga extends Do{constructor(t,r,n,o){super(),this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=gr(this.buffer)}update(t){st.exists(this);const{view:r,buffer:n,blockLen:o}=this;t=Ee(t);const i=t.length;for(let s=0;s<i;){const l=Math.min(o-this.pos,i-s);if(l===o){const a=gr(t);for(;o<=i-s;s+=o)this.process(a,s);continue}n.set(t.subarray(s,s+l),this.pos),this.pos+=l,s+=l,this.pos===o&&(this.process(r,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){st.exists(this),st.output(t,this),this.finished=!0;const{buffer:r,view:n,blockLen:o,isLE:i}=this;let{pos:s}=this;r[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>o-s&&(this.process(n,0),s=0);for(let d=s;d<o;d++)r[d]=0;Za(n,o-8,BigInt(this.length*8),i),this.process(n,0);const l=gr(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<c;d++)l.setUint32(4*d,u[d],i)}digest(){const{buffer:t,outputLen:r}=this;this.digestInto(t);const n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:r,buffer:n,length:o,finished:i,destroyed:s,pos:l}=this;return t.length=o,t.pos=l,t.finished=i,t.destroyed=s,o%r&&t.buffer.set(n),t}}const Ja=(e,t,r)=>e&t^~e&r,Ya=(e,t,r)=>e&t^e&r^t&r,Xa=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]),St=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),kt=new Uint32Array(64);class Wo extends Ga{constructor(){super(64,32,8,!1),this.A=St[0]|0,this.B=St[1]|0,this.C=St[2]|0,this.D=St[3]|0,this.E=St[4]|0,this.F=St[5]|0,this.G=St[6]|0,this.H=St[7]|0}get(){const{A:t,B:r,C:n,D:o,E:i,F:s,G:l,H:a}=this;return[t,r,n,o,i,s,l,a]}set(t,r,n,o,i,s,l,a){this.A=t|0,this.B=r|0,this.C=n|0,this.D=o|0,this.E=i|0,this.F=s|0,this.G=l|0,this.H=a|0}process(t,r){for(let d=0;d<16;d++,r+=4)kt[d]=t.getUint32(r,!1);for(let d=16;d<64;d++){const m=kt[d-15],g=kt[d-2],p=it(m,7)^it(m,18)^m>>>3,h=it(g,17)^it(g,19)^g>>>10;kt[d]=h+kt[d-7]+p+kt[d-16]|0}let{A:n,B:o,C:i,D:s,E:l,F:a,G:c,H:u}=this;for(let d=0;d<64;d++){const m=it(l,6)^it(l,11)^it(l,25),g=u+m+Ja(l,a,c)+Xa[d]+kt[d]|0,h=(it(n,2)^it(n,13)^it(n,22))+Ya(n,o,i)|0;u=c,c=a,a=l,l=s+g|0,s=i,i=o,o=n,n=g+h|0}n=n+this.A|0,o=o+this.B|0,i=i+this.C|0,s=s+this.D|0,l=l+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(n,o,i,s,l,a,c,u)}roundClean(){kt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class Qa extends Wo{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}}const ae=qo(()=>new Wo);qo(()=>new Qa);/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function le(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function yt(...e){const t=(o,i)=>s=>o(i(s)),r=Array.from(e).reverse().reduce((o,i)=>o?t(o,i.encode):i.encode,void 0),n=e.reduce((o,i)=>o?t(o,i.decode):i.decode,void 0);return{encode:r,decode:n}}function wt(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return t.map(r=>{if(le(r),r<0||r>=e.length)throw new Error(`Digit index outside alphabet: ${r} (alphabet: ${e.length})`);return e[r]})},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("alphabet.decode input should be array of strings");return t.map(r=>{if(typeof r!="string")throw new Error(`alphabet.decode: not string element=${r}`);const n=e.indexOf(r);if(n===-1)throw new Error(`Unknown letter: "${r}". Allowed: ${e}`);return n})}}}function vt(e=""){if(typeof e!="string")throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("join.encode input should be array of strings");for(let r of t)if(typeof r!="string")throw new Error(`join.encode: non-string input=${r}`);return t.join(e)},decode:t=>{if(typeof t!="string")throw new Error("join.decode input should be string");return t.split(e)}}}function Ge(e,t="="){if(le(e),typeof t!="string")throw new Error("padding chr should be string");return{encode(r){if(!Array.isArray(r)||r.length&&typeof r[0]!="string")throw new Error("padding.encode input should be array of strings");for(let n of r)if(typeof n!="string")throw new Error(`padding.encode: non-string input=${n}`);for(;r.length*e%8;)r.push(t);return r},decode(r){if(!Array.isArray(r)||r.length&&typeof r[0]!="string")throw new Error("padding.encode input should be array of strings");for(let o of r)if(typeof o!="string")throw new Error(`padding.decode: non-string input=${o}`);let n=r.length;if(n*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;n>0&&r[n-1]===t;n--)if(!((n-1)*e%8))throw new Error("Invalid padding: string has too much padding");return r.slice(0,n)}}}function Ko(e){if(typeof e!="function")throw new Error("normalize fn should be function");return{encode:t=>t,decode:t=>e(t)}}function Xn(e,t,r){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(r<2)throw new Error(`convertRadix: wrong to=${r}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let n=0;const o=[],i=Array.from(e);for(i.forEach(s=>{if(le(s),s<0||s>=t)throw new Error(`Wrong integer: ${s}`)});;){let s=0,l=!0;for(let a=n;a<i.length;a++){const c=i[a],u=t*s+c;if(!Number.isSafeInteger(u)||t*s/t!==s||u-c!==t*s)throw new Error("convertRadix: carry overflow");if(s=u%r,i[a]=Math.floor(u/r),!Number.isSafeInteger(i[a])||i[a]*r+s!==u)throw new Error("convertRadix: carry overflow");if(l)i[a]?l=!1:n=a;else continue}if(o.push(s),l)break}for(let s=0;s<e.length-1&&e[s]===0;s++)o.push(0);return o.reverse()}const Zo=(e,t)=>t?Zo(t,e%t):e,ze=(e,t)=>e+(t-Zo(e,t));function Ir(e,t,r,n){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(r<=0||r>32)throw new Error(`convertRadix2: wrong to=${r}`);if(ze(t,r)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${r} carryBits=${ze(t,r)}`);let o=0,i=0;const s=2**r-1,l=[];for(const a of e){if(le(a),a>=2**t)throw new Error(`convertRadix2: invalid data word=${a} from=${t}`);if(o=o<<t|a,i+t>32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${t}`);for(i+=t;i>=r;i-=r)l.push((o>>i-r&s)>>>0);o&=2**i-1}if(o=o<<r-i&s,!n&&i>=t)throw new Error("Excess padding");if(!n&&o)throw new Error(`Non-zero padding: ${o}`);return n&&i>0&&l.push(o>>>0),l}function tl(e){return le(e),{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return Xn(Array.from(t),2**8,e)},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("radix.decode input should be array of strings");return Uint8Array.from(Xn(t,e,2**8))}}}function It(e,t=!1){if(le(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(ze(8,e)>32||ze(e,8)>32)throw new Error("radix2: carry overflow");return{encode:r=>{if(!(r instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return Ir(Array.from(r),8,e,!t)},decode:r=>{if(!Array.isArray(r)||r.length&&typeof r[0]!="number")throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(Ir(r,e,8,t))}}}function Qn(e){if(typeof e!="function")throw new Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch{}}}const el=yt(It(4),wt("0123456789ABCDEF"),vt("")),rl=yt(It(5),wt("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),Ge(5),vt(""));yt(It(5),wt("0123456789ABCDEFGHIJKLMNOPQRSTUV"),Ge(5),vt(""));yt(It(5),wt("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),vt(""),Ko(e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")));const bt=yt(It(6),wt("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Ge(6),vt("")),nl=yt(It(6),wt("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),Ge(6),vt("")),nn=e=>yt(tl(58),wt(e),vt("")),Mr=nn("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");nn("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ");nn("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const to=[0,2,3,5,6,7,9,10,11],ol={encode(e){let t="";for(let r=0;r<e.length;r+=8){const n=e.subarray(r,r+8);t+=Mr.encode(n).padStart(to[n.length],"1")}return t},decode(e){let t=[];for(let r=0;r<e.length;r+=11){const n=e.slice(r,r+11),o=to.indexOf(n.length),i=Mr.decode(n);for(let s=0;s<i.length-o;s++)if(i[s]!==0)throw new Error("base58xmr: wrong padding");t=t.concat(Array.from(i.slice(i.length-o)))}return Uint8Array.from(t)}},Rr=yt(wt("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),vt("")),eo=[996825010,642813549,513874426,1027748829,705979059];function he(e){const t=e>>25;let r=(e&33554431)<<5;for(let n=0;n<eo.length;n++)(t>>n&1)===1&&(r^=eo[n]);return r}function ro(e,t,r=1){const n=e.length;let o=1;for(let i=0;i<n;i++){const s=e.charCodeAt(i);if(s<33||s>126)throw new Error(`Invalid prefix (${e})`);o=he(o)^s>>5}o=he(o);for(let i=0;i<n;i++)o=he(o)^e.charCodeAt(i)&31;for(let i of t)o=he(o)^i;for(let i=0;i<6;i++)o=he(o);return o^=r,Rr.encode(Ir([o%2**30],30,5,!1))}function Go(e){const t=e==="bech32"?1:734539939,r=It(5),n=r.decode,o=r.encode,i=Qn(n);function s(u,d,m=90){if(typeof u!="string")throw new Error(`bech32.encode prefix should be string, not ${typeof u}`);if(!Array.isArray(d)||d.length&&typeof d[0]!="number")throw new Error(`bech32.encode words should be array of numbers, not ${typeof d}`);const g=u.length+7+d.length;if(m!==!1&&g>m)throw new TypeError(`Length ${g} exceeds limit ${m}`);return u=u.toLowerCase(),`${u}1${Rr.encode(d)}${ro(u,d,t)}`}function l(u,d=90){if(typeof u!="string")throw new Error(`bech32.decode input should be string, not ${typeof u}`);if(u.length<8||d!==!1&&u.length>d)throw new TypeError(`Wrong string length: ${u.length} (${u}). Expected (8..${d})`);const m=u.toLowerCase();if(u!==m&&u!==u.toUpperCase())throw new Error("String must be lowercase or uppercase");u=m;const g=u.lastIndexOf("1");if(g===0||g===-1)throw new Error('Letter "1" must be present between prefix and data only');const p=u.slice(0,g),h=u.slice(g+1);if(h.length<6)throw new Error("Data must be at least 6 characters long");const f=Rr.decode(h).slice(0,-6),b=ro(p,f,t);if(!h.endsWith(b))throw new Error(`Invalid checksum in ${u}: expected "${b}"`);return{prefix:p,words:f}}const a=Qn(l);function c(u){const{prefix:d,words:m}=l(u,!1);return{prefix:d,words:m,bytes:n(m)}}return{encode:s,decode:l,decodeToBytes:c,decodeUnsafe:a,fromWords:n,fromWordsUnsafe:i,toWords:o}}const oe=Go("bech32");Go("bech32m");const il={encode:e=>new TextDecoder().decode(e),decode:e=>new TextEncoder().encode(e)},sl=yt(It(4),wt("0123456789abcdef"),vt(""),Ko(e=>{if(typeof e!="string"||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})),al={utf8:il,hex:sl,base16:el,base32:rl,base64:bt,base64url:nl,base58:Mr,base58xmr:ol};`${Object.keys(al).join(", ")}`;function br(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function no(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}function ll(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function ft(e,...t){if(!ll(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */const J=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),cl=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!cl)throw new Error("Non little-endian hardware is not supported");function dl(e,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(e,t)}function ul(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return r===0}const hl=(e,t)=>(Object.assign(t,e),t),Ut=16,fl=283;function on(e){return e<<1^fl&-(e>>7)}function Xt(e,t){let r=0;for(;t>0;t>>=1)r^=e&-(t&1),e=on(e);return r}const Nr=(()=>{let e=new Uint8Array(256);for(let r=0,n=1;r<256;r++,n^=on(n))e[r]=n;const t=new Uint8Array(256);t[0]=99;for(let r=0;r<255;r++){let n=e[255-r];n|=n<<8,t[e[r]]=(n^n>>4^n>>5^n>>6^n>>7^99)&255}return t})(),pl=Nr.map((e,t)=>Nr.indexOf(t)),gl=e=>e<<24|e>>>8,mr=e=>e<<8|e>>>24;function Jo(e,t){if(e.length!==256)throw new Error("Wrong sbox length");const r=new Uint32Array(256).map((c,u)=>t(e[u])),n=r.map(mr),o=n.map(mr),i=o.map(mr),s=new Uint32Array(256*256),l=new Uint32Array(256*256),a=new Uint16Array(256*256);for(let c=0;c<256;c++)for(let u=0;u<256;u++){const d=c*256+u;s[d]=r[c]^n[u],l[d]=o[c]^i[u],a[d]=e[c]<<8|e[u]}return{sbox:e,sbox2:a,T0:r,T1:n,T2:o,T3:i,T01:s,T23:l}}const sn=Jo(Nr,e=>Xt(e,3)<<24|e<<16|e<<8|Xt(e,2)),Yo=Jo(pl,e=>Xt(e,11)<<24|Xt(e,13)<<16|Xt(e,9)<<8|Xt(e,14)),bl=(()=>{const e=new Uint8Array(16);for(let t=0,r=1;t<16;t++,r=on(r))e[t]=r;return e})();function Xo(e){ft(e);const t=e.length;if(![16,24,32].includes(t))throw new Error(`aes: wrong key size: should be 16, 24 or 32, got: ${t}`);const{sbox2:r}=sn,n=J(e),o=n.length,i=l=>at(r,l,l,l,l),s=new Uint32Array(t+28);s.set(n);for(let l=o;l<s.length;l++){let a=s[l-1];l%o===0?a=i(gl(a))^bl[l/o-1]:o>6&&l%o===4&&(a=i(a)),s[l]=s[l-o]^a}return s}function ml(e){const t=Xo(e),r=t.slice(),n=t.length,{sbox2:o}=sn,{T0:i,T1:s,T2:l,T3:a}=Yo;for(let c=0;c<n;c+=4)for(let u=0;u<4;u++)r[c+u]=t[n-c-4+u];t.fill(0);for(let c=4;c<n-4;c++){const u=r[c],d=at(o,u,u,u,u);r[c]=i[d&255]^s[d>>>8&255]^l[d>>>16&255]^a[d>>>24]}return r}function Bt(e,t,r,n,o,i){return e[r<<8&65280|n>>>8&255]^t[o>>>8&65280|i>>>24&255]}function at(e,t,r,n,o){return e[t&255|r&65280]|e[n>>>16&255|o>>>16&65280]<<16}function oo(e,t,r,n,o){const{sbox2:i,T01:s,T23:l}=sn;let a=0;t^=e[a++],r^=e[a++],n^=e[a++],o^=e[a++];const c=e.length/4-2;for(let p=0;p<c;p++){const h=e[a++]^Bt(s,l,t,r,n,o),f=e[a++]^Bt(s,l,r,n,o,t),b=e[a++]^Bt(s,l,n,o,t,r),x=e[a++]^Bt(s,l,o,t,r,n);t=h,r=f,n=b,o=x}const u=e[a++]^at(i,t,r,n,o),d=e[a++]^at(i,r,n,o,t),m=e[a++]^at(i,n,o,t,r),g=e[a++]^at(i,o,t,r,n);return{s0:u,s1:d,s2:m,s3:g}}function yl(e,t,r,n,o){const{sbox2:i,T01:s,T23:l}=Yo;let a=0;t^=e[a++],r^=e[a++],n^=e[a++],o^=e[a++];const c=e.length/4-2;for(let p=0;p<c;p++){const h=e[a++]^Bt(s,l,t,o,n,r),f=e[a++]^Bt(s,l,r,t,o,n),b=e[a++]^Bt(s,l,n,r,t,o),x=e[a++]^Bt(s,l,o,n,r,t);t=h,r=f,n=b,o=x}const u=e[a++]^at(i,t,o,n,r),d=e[a++]^at(i,r,t,o,n),m=e[a++]^at(i,n,r,t,o),g=e[a++]^at(i,o,n,r,t);return{s0:u,s1:d,s2:m,s3:g}}function Qo(e,t){if(!t)return new Uint8Array(e);if(ft(t),t.length<e)throw new Error(`aes: wrong destination length, expected at least ${e}, got: ${t.length}`);return t}function wl(e){if(ft(e),e.length%Ut!==0)throw new Error(`aes/(cbc-ecb).decrypt ciphertext should consist of blocks with size ${Ut}`)}function vl(e,t,r){let n=e.length;const o=n%Ut;if(!t&&o!==0)throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");const i=J(e);if(t){let a=Ut-o;a||(a=Ut),n=n+a}const s=Qo(n,r),l=J(s);return{b:i,o:l,out:s}}function xl(e,t){if(!t)return e;const r=e.length;if(!r)throw new Error("aes/pcks5: empty ciphertext not allowed");const n=e[r-1];if(n<=0||n>16)throw new Error(`aes/pcks5: wrong padding byte: ${n}`);const o=e.subarray(0,-n);for(let i=0;i<n;i++)if(e[r-i-1]!==n)throw new Error("aes/pcks5: wrong padding");return o}function El(e){const t=new Uint8Array(16),r=J(t);t.set(e);const n=Ut-e.length;for(let o=Ut-n;o<Ut;o++)t[o]=n;return r}const ti=hl({blockSize:16,nonceLength:16},function(t,r,n={}){ft(t),ft(r,16);const o=!n.disablePadding;return{encrypt:(i,s)=>{const l=Xo(t),{b:a,o:c,out:u}=vl(i,o,s),d=J(r);let m=d[0],g=d[1],p=d[2],h=d[3],f=0;for(;f+4<=a.length;)m^=a[f+0],g^=a[f+1],p^=a[f+2],h^=a[f+3],{s0:m,s1:g,s2:p,s3:h}=oo(l,m,g,p,h),c[f++]=m,c[f++]=g,c[f++]=p,c[f++]=h;if(o){const b=El(i.subarray(f*4));m^=b[0],g^=b[1],p^=b[2],h^=b[3],{s0:m,s1:g,s2:p,s3:h}=oo(l,m,g,p,h),c[f++]=m,c[f++]=g,c[f++]=p,c[f++]=h}return l.fill(0),u},decrypt:(i,s)=>{wl(i);const l=ml(t),a=J(r),c=Qo(i.length,s),u=J(i),d=J(c);let m=a[0],g=a[1],p=a[2],h=a[3];for(let f=0;f+4<=u.length;){const b=m,x=g,A=p,U=h;m=u[f+0],g=u[f+1],p=u[f+2],h=u[f+3];const{s0:C,s1:v,s2:E,s3:_}=yl(l,m,g,p,h);d[f++]=C^b,d[f++]=v^x,d[f++]=E^A,d[f++]=_^U}return l.fill(0),xl(c,o)}}}),ei=e=>Uint8Array.from(e.split("").map(t=>t.charCodeAt(0))),_l=ei("expand 16-byte k"),$l=ei("expand 32-byte k"),Al=J(_l),ri=J($l);ri.slice();function M(e,t){return e<<t|e>>>32-t}function Or(e){return e.byteOffset%4===0}const ke=64,Sl=16,ni=2**32-1,io=new Uint32Array;function kl(e,t,r,n,o,i,s,l){const a=o.length,c=new Uint8Array(ke),u=J(c),d=Or(o)&&Or(i),m=d?J(o):io,g=d?J(i):io;for(let p=0;p<a;s++){if(e(t,r,n,u,s,l),s>=ni)throw new Error("arx: counter overflow");const h=Math.min(ke,a-p);if(d&&h===ke){const f=p/4;if(p%4!==0)throw new Error("arx: invalid block position");for(let b=0,x;b<Sl;b++)x=f+b,g[x]=m[x]^u[b];p+=ke;continue}for(let f=0,b;f<h;f++)b=p+f,i[b]=o[b]^c[f];p+=h}}function Pl(e,t){const{allowShortKeys:r,extendNonceFn:n,counterLength:o,counterRight:i,rounds:s}=dl({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return br(o),br(s),no(i),no(r),(l,a,c,u,d=0)=>{ft(l),ft(a),ft(c);const m=c.length;if(u||(u=new Uint8Array(m)),ft(u),br(d),d<0||d>=ni)throw new Error("arx: counter overflow");if(u.length<m)throw new Error(`arx: output (${u.length}) is shorter than data (${m})`);const g=[];let p=l.length,h,f;if(p===32)h=l.slice(),g.push(h),f=ri;else if(p===16&&r)h=new Uint8Array(32),h.set(l),h.set(l,16),f=Al,g.push(h);else throw new Error(`arx: invalid 32-byte key, got length=${p}`);Or(a)||(a=a.slice(),g.push(a));const b=J(h);if(n){if(a.length!==24)throw new Error("arx: extended nonce must be 24 bytes");n(f,b,J(a.subarray(0,16)),b),a=a.subarray(16)}const x=16-o;if(x!==a.length)throw new Error(`arx: nonce must be ${x} or 16 bytes`);if(x!==12){const U=new Uint8Array(12);U.set(a,i?0:12-a.length),a=U,g.push(a)}const A=J(a);for(kl(e,f,b,A,c,u,d,s);g.length>0;)g.pop().fill(0);return u}}function Cl(e,t,r,n,o,i=20){let s=e[0],l=e[1],a=e[2],c=e[3],u=t[0],d=t[1],m=t[2],g=t[3],p=t[4],h=t[5],f=t[6],b=t[7],x=o,A=r[0],U=r[1],C=r[2],v=s,E=l,_=a,V=c,L=u,k=d,O=m,H=g,D=p,y=h,w=f,$=b,B=x,P=A,I=U,z=C;for(let et=0;et<i;et+=2)v=v+L|0,B=M(B^v,16),D=D+B|0,L=M(L^D,12),v=v+L|0,B=M(B^v,8),D=D+B|0,L=M(L^D,7),E=E+k|0,P=M(P^E,16),y=y+P|0,k=M(k^y,12),E=E+k|0,P=M(P^E,8),y=y+P|0,k=M(k^y,7),_=_+O|0,I=M(I^_,16),w=w+I|0,O=M(O^w,12),_=_+O|0,I=M(I^_,8),w=w+I|0,O=M(O^w,7),V=V+H|0,z=M(z^V,16),$=$+z|0,H=M(H^$,12),V=V+H|0,z=M(z^V,8),$=$+z|0,H=M(H^$,7),v=v+k|0,z=M(z^v,16),w=w+z|0,k=M(k^w,12),v=v+k|0,z=M(z^v,8),w=w+z|0,k=M(k^w,7),E=E+O|0,B=M(B^E,16),$=$+B|0,O=M(O^$,12),E=E+O|0,B=M(B^E,8),$=$+B|0,O=M(O^$,7),_=_+H|0,P=M(P^_,16),D=D+P|0,H=M(H^D,12),_=_+H|0,P=M(P^_,8),D=D+P|0,H=M(H^D,7),V=V+L|0,I=M(I^V,16),y=y+I|0,L=M(L^y,12),V=V+L|0,I=M(I^V,8),y=y+I|0,L=M(L^y,7);let R=0;n[R++]=s+v|0,n[R++]=l+E|0,n[R++]=a+_|0,n[R++]=c+V|0,n[R++]=u+L|0,n[R++]=d+k|0,n[R++]=m+O|0,n[R++]=g+H|0,n[R++]=p+D|0,n[R++]=h+y|0,n[R++]=f+w|0,n[R++]=b+$|0,n[R++]=x+B|0,n[R++]=A+P|0,n[R++]=U+I|0,n[R++]=C+z|0}const oi=Pl(Cl,{counterRight:!1,counterLength:4,allowShortKeys:!1});class ii extends Do{constructor(t,r){super(),this.finished=!1,this.destroyed=!1,st.hash(t);const n=Ee(r);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,i=new Uint8Array(o);i.set(n.length>o?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 st.exists(this),this.iHash.update(t),this}digestInto(t){st.exists(this),st.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:r,iHash:n,finished:o,destroyed:i,blockLen:s,outputLen:l}=this;return t=t,t.finished=o,t.destroyed=i,t.blockLen=s,t.outputLen=l,t.oHash=r._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Je=(e,t,r)=>new ii(e,t).update(r).digest();Je.create=(e,t)=>new ii(e,t);function Bl(e,t,r){return st.hash(e),Je(e,Ee(r),Ee(t))}const yr=new Uint8Array([0]),so=new Uint8Array;function Ll(e,t,r,n=32){if(st.hash(e),st.number(n),n>255*e.outputLen)throw new Error("Length should be <= 255*HashLen");const o=Math.ceil(n/e.outputLen);r===void 0&&(r=so);const i=new Uint8Array(o*e.outputLen),s=Je.create(e,t),l=s._cloneInto(),a=new Uint8Array(s.outputLen);for(let c=0;c<o;c++)yr[0]=c+1,l.update(c===0?so:a).update(r).update(yr).digestInto(a),i.set(a,e.outputLen*c),s._cloneInto(l);return s.destroy(),l.destroy(),a.fill(0),yr.fill(0),i.slice(0,n)}var Ul=Object.defineProperty,q=(e,t)=>{for(var r in t)Ul(e,r,{get:t[r],enumerable:!0})},Jt=Symbol("verified"),Tl=e=>e instanceof Object;function an(e){if(!Tl(e)||typeof e.kind!="number"||typeof e.content!="string"||typeof e.created_at!="number"||typeof e.pubkey!="string"||!e.pubkey.match(/^[a-f0-9]{64}$/)||!Array.isArray(e.tags))return!1;for(let t=0;t<e.tags.length;t++){let r=e.tags[t];if(!Array.isArray(r))return!1;for(let n=0;n<r.length;n++)if(typeof r[n]=="object")return!1}return!0}var Il={};q(Il,{Queue:()=>li,QueueNode:()=>ai,binarySearch:()=>ln,insertEventIntoAscendingList:()=>Rl,insertEventIntoDescendingList:()=>Ml,normalizeURL:()=>si,utf8Decoder:()=>pt,utf8Encoder:()=>rt});var pt=new TextDecoder("utf-8"),rt=new TextEncoder;function si(e){e.indexOf("://")===-1&&(e="wss://"+e);let t=new URL(e);return t.pathname=t.pathname.replace(/\/+/g,"/"),t.pathname.endsWith("/")&&(t.pathname=t.pathname.slice(0,-1)),(t.port==="80"&&t.protocol==="ws:"||t.port==="443"&&t.protocol==="wss:")&&(t.port=""),t.searchParams.sort(),t.hash="",t.toString()}function Ml(e,t){const[r,n]=ln(e,o=>t.id===o.id?0:t.created_at===o.created_at?-1:o.created_at-t.created_at);return n||e.splice(r,0,t),e}function Rl(e,t){const[r,n]=ln(e,o=>t.id===o.id?0:t.created_at===o.created_at?-1:t.created_at-o.created_at);return n||e.splice(r,0,t),e}function ln(e,t){let r=0,n=e.length-1;for(;r<=n;){const o=Math.floor((r+n)/2),i=t(e[o]);if(i===0)return[o,!0];i<0?n=o-1:r=o+1}return[r,!1]}var ai=class{value;next=null;prev=null;constructor(e){this.value=e}},li=class{first;last;constructor(){this.first=null,this.last=null}enqueue(e){const t=new ai(e);return this.last?this.last===this.first?(this.last=t,this.last.prev=this.first,this.first.next=t):(t.prev=this.last,this.last.next=t,this.last=t):(this.first=t,this.last=t),!0}dequeue(){if(!this.first)return null;if(this.first===this.last){const t=this.first;return this.first=null,this.last=null,t.value}const e=this.first;return this.first=e.next,e.value}},Nl=class{generateSecretKey(){return ue.utils.randomPrivateKey()}getPublicKey(e){return Y(ue.getPublicKey(e))}finalizeEvent(e,t){const r=e;return r.pubkey=Y(ue.getPublicKey(t)),r.id=Le(r),r.sig=Y(ue.sign(Le(r),t)),r[Jt]=!0,r}verifyEvent(e){if(typeof e[Jt]=="boolean")return e[Jt];const t=Le(e);if(t!==e.id)return e[Jt]=!1,!1;try{const r=ue.verify(e.sig,t,e.pubkey);return e[Jt]=r,r}catch{return e[Jt]=!1,!1}}};function Ol(e){if(!an(e))throw new Error("can't serialize event with wrong or missing properties");return JSON.stringify([0,e.pubkey,e.created_at,e.kind,e.tags,e.content])}function Le(e){let t=ae(rt.encode(Ol(e)));return Y(t)}var Ye=new Nl,Hl=Ye.generateSecretKey,ci=Ye.getPublicKey,dt=Ye.finalizeEvent,Xe=Ye.verifyEvent,zl={};q(zl,{Application:()=>Dc,BadgeAward:()=>Gl,BadgeDefinition:()=>Mc,BlockedRelaysList:()=>wc,BookmarkList:()=>bc,Bookmarksets:()=>Uc,Calendar:()=>Gc,CalendarEventRSVP:()=>Jc,ChannelCreation:()=>gi,ChannelHideMessage:()=>yi,ChannelMessage:()=>mi,ChannelMetadata:()=>bi,ChannelMuteUser:()=>wi,ClassifiedListing:()=>Fc,ClientAuth:()=>xi,CommunitiesList:()=>mc,CommunityDefinition:()=>Qc,CommunityPostApproval:()=>ic,Contacts:()=>Wl,CreateOrUpdateProduct:()=>Oc,CreateOrUpdateStall:()=>Nc,Curationsets:()=>Tc,Date:()=>Kc,DirectMessageRelaysList:()=>_c,DraftClassifiedListing:()=>Wc,DraftLong:()=>zc,Emojisets:()=>Vc,EncryptedDirectMessage:()=>Kl,EventDeletion:()=>Zl,FileMetadata:()=>Ql,FileServerPreference:()=>$c,Followsets:()=>Cc,GenericRepost:()=>Yl,Genericlists:()=>Bc,GiftWrap:()=>vi,HTTPAuth:()=>un,Handlerinformation:()=>Xc,Handlerrecommendation:()=>Yc,Highlights:()=>hc,InterestsList:()=>xc,Interestsets:()=>Rc,JobFeedback:()=>lc,JobRequest:()=>sc,JobResult:()=>ac,Label:()=>oc,LightningPubRPC:()=>Sc,LiveChatMessage:()=>tc,LiveEvent:()=>qc,LongFormArticle:()=>Hc,Metadata:()=>ql,Mutelist:()=>fc,NWCWalletInfo:()=>Ac,NWCWalletRequest:()=>Ei,NWCWalletResponse:()=>kc,NostrConnect:()=>Pc,OpenTimestamps:()=>Xl,Pinlist:()=>pc,PrivateDirectMessage:()=>Jl,ProblemTracker:()=>ec,ProfileBadges:()=>Ic,PublicChatsList:()=>yc,Reaction:()=>dn,RecommendRelay:()=>Fl,RelayList:()=>gc,Relaysets:()=>Lc,Report:()=>rc,Reporting:()=>nc,Repost:()=>cn,Seal:()=>pi,SearchRelaysList:()=>vc,ShortTextNote:()=>jl,Time:()=>Zc,UserEmojiList:()=>Ec,UserStatuses:()=>jc,Zap:()=>uc,ZapGoal:()=>cc,ZapRequest:()=>dc,classifyKind:()=>Vl,isEphemeralKind:()=>hi,isKind:()=>Dl,isParameterizedReplaceableKind:()=>fi,isRegularKind:()=>di,isReplaceableKind:()=>ui});function di(e){return 1e3<=e&&e<1e4||[1,2,4,5,6,7,8,16,40,41,42,43,44].includes(e)}function ui(e){return[0,3].includes(e)||1e4<=e&&e<2e4}function hi(e){return 2e4<=e&&e<3e4}function fi(e){return 3e4<=e&&e<4e4}function Vl(e){return di(e)?"regular":ui(e)?"replaceable":hi(e)?"ephemeral":fi(e)?"parameterized":"unknown"}function Dl(e,t){const r=t instanceof Array?t:[t];return an(e)&&r.includes(e.kind)||!1}var ql=0,jl=1,Fl=2,Wl=3,Kl=4,Zl=5,cn=6,dn=7,Gl=8,pi=13,Jl=14,Yl=16,gi=40,bi=41,mi=42,yi=43,wi=44,Xl=1040,vi=1059,Ql=1063,tc=1311,ec=1971,rc=1984,nc=1984,oc=1985,ic=4550,sc=5999,ac=6999,lc=7e3,cc=9041,dc=9734,uc=9735,hc=9802,fc=1e4,pc=10001,gc=10002,bc=10003,mc=10004,yc=10005,wc=10006,vc=10007,xc=10015,Ec=10030,_c=10050,$c=10096,Ac=13194,Sc=21e3,xi=22242,Ei=23194,kc=23195,Pc=24133,un=27235,Cc=3e4,Bc=30001,Lc=30002,Uc=30003,Tc=30004,Ic=30008,Mc=30009,Rc=30015,Nc=30017,Oc=30018,Hc=30023,zc=30024,Vc=30030,Dc=30078,qc=30311,jc=30315,Fc=30402,Wc=30403,Kc=31922,Zc=31923,Gc=31924,Jc=31925,Yc=31989,Xc=31990,Qc=34550;function td(e,t){if(e.ids&&e.ids.indexOf(t.id)===-1||e.kinds&&e.kinds.indexOf(t.kind)===-1||e.authors&&e.authors.indexOf(t.pubkey)===-1)return!1;for(let r in e)if(r[0]==="#"){let n=r.slice(1),o=e[`#${n}`];if(o&&!t.tags.find(([i,s])=>i===r.slice(1)&&o.indexOf(s)!==-1))return!1}return!(e.since&&t.created_at<e.since||e.until&&t.created_at>e.until)}function ed(e,t){for(let r=0;r<e.length;r++)if(td(e[r],t))return!0;return!1}var rd={};q(rd,{getHex64:()=>Qe,getInt:()=>_i,getSubscriptionId:()=>$i,matchEventId:()=>nd,matchEventKind:()=>id,matchEventPubkey:()=>od});function Qe(e,t){let r=t.length+3,n=e.indexOf(`"${t}":`)+r,o=e.slice(n).indexOf('"')+n+1;return e.slice(o,o+64)}function _i(e,t){let r=t.length,n=e.indexOf(`"${t}":`)+r+3,o=e.slice(n),i=Math.min(o.indexOf(","),o.indexOf("}"));return parseInt(o.slice(0,i),10)}function $i(e){let t=e.slice(0,22).indexOf('"EVENT"');if(t===-1)return null;let r=e.slice(t+7+1).indexOf('"');if(r===-1)return null;let n=t+7+1+r,o=e.slice(n+1,80).indexOf('"');if(o===-1)return null;let i=n+1+o;return e.slice(n+1,i)}function nd(e,t){return t===Qe(e,"id")}function od(e,t){return t===Qe(e,"pubkey")}function id(e,t){return t===_i(e,"kind")}var sd={};q(sd,{makeAuthEvent:()=>Ai});function Ai(e,t){return{kind:xi,created_at:Math.floor(Date.now()/1e3),tags:[["relay",e],["challenge",t]],content:""}}async function ad(){return new Promise(e=>{const t=new MessageChannel,r=()=>{t.port1.removeEventListener("message",r),e()};t.port1.addEventListener("message",r),t.port2.postMessage(0),t.port1.start()})}var Si=class{url;_connected=!1;onclose=null;onnotice=e=>console.debug(`NOTICE from ${this.url}: ${e}`);_onauth=null;baseEoseTimeout=4400;connectionTimeout=4400;publishTimeout=4400;openSubs=new Map;connectionTimeoutHandle;connectionPromise;openCountRequests=new Map;openEventPublishes=new Map;ws;incomingMessageQueue=new li;queueRunning=!1;challenge;serial=0;verifyEvent;_WebSocket;constructor(e,t){this.url=si(e),this.verifyEvent=t.verifyEvent,this._WebSocket=t.websocketImplementation||WebSocket}static async connect(e,t){const r=new Si(e,t);return await r.connect(),r}closeAllSubscriptions(e){for(let[t,r]of this.openSubs)r.close(e);this.openSubs.clear();for(let[t,r]of this.openEventPublishes)r.reject(new Error(e));this.openEventPublishes.clear();for(let[t,r]of this.openCountRequests)r.reject(new Error(e));this.openCountRequests.clear()}get connected(){return this._connected}async connect(){return this.connectionPromise?this.connectionPromise:(this.challenge=void 0,this.connectionPromise=new Promise((e,t)=>{this.connectionTimeoutHandle=setTimeout(()=>{t("connection timed out"),this.connectionPromise=void 0,this.onclose?.(),this.closeAllSubscriptions("relay connection timed out")},this.connectionTimeout);try{this.ws=new this._WebSocket(this.url)}catch(r){t(r);return}this.ws.onopen=()=>{clearTimeout(this.connectionTimeoutHandle),this._connected=!0,e()},this.ws.onerror=r=>{t(r.message||"websocket error"),this._connected&&(this._connected=!1,this.connectionPromise=void 0,this.onclose?.(),this.closeAllSubscriptions("relay connection errored"))},this.ws.onclose=async()=>{this._connected&&(this._connected=!1,this.connectionPromise=void 0,this.onclose?.(),this.closeAllSubscriptions("relay connection closed"))},this.ws.onmessage=this._onmessage.bind(this)}),this.connectionPromise)}async runQueue(){for(this.queueRunning=!0;this.handleNext()!==!1;)await ad();this.queueRunning=!1}handleNext(){const e=this.incomingMessageQueue.dequeue();if(!e)return!1;const t=$i(e);if(t){const r=this.openSubs.get(t);if(!r)return;const n=Qe(e,"id"),o=r.alreadyHaveEvent?.(n);if(r.receivedEvent?.(this,n),o)return}try{let r=JSON.parse(e);switch(r[0]){case"EVENT":{const n=this.openSubs.get(r[1]),o=r[2];this.verifyEvent(o)&&ed(n.filters,o)&&n.onevent(o);return}case"COUNT":{const n=r[1],o=r[2],i=this.openCountRequests.get(n);i&&(i.resolve(o.count),this.openCountRequests.delete(n));return}case"EOSE":{const n=this.openSubs.get(r[1]);if(!n)return;n.receivedEose();return}case"OK":{const n=r[1],o=r[2],i=r[3],s=this.openEventPublishes.get(n);s&&(o?s.resolve(i):s.reject(new Error(i)),this.openEventPublishes.delete(n));return}case"CLOSED":{const n=r[1],o=this.openSubs.get(n);if(!o)return;o.closed=!0,o.close(r[2]);return}case"NOTICE":this.onnotice(r[1]);return;case"AUTH":{this.challenge=r[1],this._onauth?.(r[1]);return}}}catch{return}}async send(e){if(!this.connectionPromise)throw new Error("sending on closed connection");this.connectionPromise.then(()=>{this.ws?.send(e)})}async auth(e){if(!this.challenge)throw new Error("can't perform auth, no challenge was received");const t=await e(Ai(this.url,this.challenge)),r=new Promise((n,o)=>{this.openEventPublishes.set(t.id,{resolve:n,reject:o})});return this.send('["AUTH",'+JSON.stringify(t)+"]"),r}async publish(e){const t=new Promise((r,n)=>{this.openEventPublishes.set(e.id,{resolve:r,reject:n})});return this.send('["EVENT",'+JSON.stringify(e)+"]"),setTimeout(()=>{const r=this.openEventPublishes.get(e.id);r&&(r.reject(new Error("publish timed out")),this.openEventPublishes.delete(e.id))},this.publishTimeout),t}async count(e,t){this.serial++;const r=t?.id||"count:"+this.serial,n=new Promise((o,i)=>{this.openCountRequests.set(r,{resolve:o,reject:i})});return this.send('["COUNT","'+r+'",'+JSON.stringify(e).substring(1)),n}subscribe(e,t){const r=this.prepareSubscription(e,t);return r.fire(),r}prepareSubscription(e,t){this.serial++;const r=t.id||"sub:"+this.serial,n=new ld(this,r,e,t);return this.openSubs.set(r,n),n}close(){this.closeAllSubscriptions("relay connection closed by us"),this._connected=!1,this.ws?.close()}_onmessage(e){this.incomingMessageQueue.enqueue(e.data),this.queueRunning||this.runQueue()}},ld=class{relay;id;closed=!1;eosed=!1;filters;alreadyHaveEvent;receivedEvent;onevent;oneose;onclose;eoseTimeout;eoseTimeoutHandle;constructor(e,t,r,n){this.relay=e,this.filters=r,this.id=t,this.alreadyHaveEvent=n.alreadyHaveEvent,this.receivedEvent=n.receivedEvent,this.eoseTimeout=n.eoseTimeout||e.baseEoseTimeout,this.oneose=n.oneose,this.onclose=n.onclose,this.onevent=n.onevent||(o=>{console.warn(`onevent() callback not defined for subscription '${this.id}' in relay ${this.relay.url}. event received:`,o)})}fire(){this.relay.send('["REQ","'+this.id+'",'+JSON.stringify(this.filters).substring(1)),this.eoseTimeoutHandle=setTimeout(this.receivedEose.bind(this),this.eoseTimeout)}receivedEose(){this.eosed||(clearTimeout(this.eoseTimeoutHandle),this.eosed=!0,this.oneose?.())}close(e="closed by caller"){!this.closed&&this.relay.connected&&(this.relay.send('["CLOSE",'+JSON.stringify(this.id)+"]"),this.closed=!0),this.relay.openSubs.delete(this.id),this.onclose?.(e)}},ki;try{ki=WebSocket}catch{}var tr=class extends Si{constructor(e){super(e,{verifyEvent:Xe,websocketImplementation:ki})}static async connect(e){const t=new tr(e);return await t.connect(),t}},cd;try{cd=WebSocket}catch{}var dd={};q(dd,{BECH32_REGEX:()=>Pi,Bech32MaxSize:()=>hn,NostrTypeGuard:()=>ud,decode:()=>er,encodeBytes:()=>nr,naddrEncode:()=>yd,neventEncode:()=>md,noteEncode:()=>gd,nprofileEncode:()=>bd,npubEncode:()=>pd,nsecEncode:()=>fd});var ud={isNProfile:e=>/^nprofile1[a-z\d]+$/.test(e||""),isNEvent:e=>/^nevent1[a-z\d]+$/.test(e||""),isNAddr:e=>/^naddr1[a-z\d]+$/.test(e||""),isNSec:e=>/^nsec1[a-z\d]{58}$/.test(e||""),isNPub:e=>/^npub1[a-z\d]{58}$/.test(e||""),isNote:e=>/^note1[a-z\d]+$/.test(e||""),isNcryptsec:e=>/^ncryptsec1[a-z\d]+$/.test(e||"")},hn=5e3,Pi=/[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/;function hd(e){const t=new Uint8Array(4);return t[0]=e>>24&255,t[1]=e>>16&255,t[2]=e>>8&255,t[3]=e&255,t}function er(e){let{prefix:t,words:r}=oe.decode(e,hn),n=new Uint8Array(oe.fromWords(r));switch(t){case"nprofile":{let o=wr(n);if(!o[0]?.[0])throw new Error("missing TLV 0 for nprofile");if(o[0][0].length!==32)throw new Error("TLV 0 should be 32 bytes");return{type:"nprofile",data:{pubkey:Y(o[0][0]),relays:o[1]?o[1].map(i=>pt.decode(i)):[]}}}case"nevent":{let o=wr(n);if(!o[0]?.[0])throw new Error("missing TLV 0 for nevent");if(o[0][0].length!==32)throw new Error("TLV 0 should be 32 bytes");if(o[2]&&o[2][0].length!==32)throw new Error("TLV 2 should be 32 bytes");if(o[3]&&o[3][0].length!==4)throw new Error("TLV 3 should be 4 bytes");return{type:"nevent",data:{id:Y(o[0][0]),relays:o[1]?o[1].map(i=>pt.decode(i)):[],author:o[2]?.[0]?Y(o[2][0]):void 0,kind:o[3]?.[0]?parseInt(Y(o[3][0]),16):void 0}}}case"naddr":{let o=wr(n);if(!o[0]?.[0])throw new Error("missing TLV 0 for naddr");if(!o[2]?.[0])throw new Error("missing TLV 2 for naddr");if(o[2][0].length!==32)throw new Error("TLV 2 should be 32 bytes");if(!o[3]?.[0])throw new Error("missing TLV 3 for naddr");if(o[3][0].length!==4)throw new Error("TLV 3 should be 4 bytes");return{type:"naddr",data:{identifier:pt.decode(o[0][0]),pubkey:Y(o[2][0]),kind:parseInt(Y(o[3][0]),16),relays:o[1]?o[1].map(i=>pt.decode(i)):[]}}}case"nsec":return{type:t,data:n};case"npub":case"note":return{type:t,data:Y(n)};default:throw new Error(`unknown prefix ${t}`)}}function wr(e){let t={},r=e;for(;r.length>0;){let n=r[0],o=r[1],i=r.slice(2,2+o);if(r=r.slice(2+o),i.length<o)throw new Error(`not enough data to read on TLV ${n}`);t[n]=t[n]||[],t[n].push(i)}return t}function fd(e){return nr("nsec",e)}function pd(e){return nr("npub",ne(e))}function gd(e){return nr("note",ne(e))}function rr(e,t){let r=oe.toWords(t);return oe.encode(e,r,hn)}function nr(e,t){return rr(e,t)}function bd(e){let t=fn({0:[ne(e.pubkey)],1:(e.relays||[]).map(r=>rt.encode(r))});return rr("nprofile",t)}function md(e){let t;e.kind!==void 0&&(t=hd(e.kind));let r=fn({0:[ne(e.id)],1:(e.relays||[]).map(n=>rt.encode(n)),2:e.author?[ne(e.author)]:[],3:t?[new Uint8Array(t)]:[]});return rr("nevent",r)}function yd(e){let t=new ArrayBuffer(4);new DataView(t).setUint32(0,e.kind,!1);let r=fn({0:[rt.encode(e.identifier)],1:(e.relays||[]).map(n=>rt.encode(n)),2:[ne(e.pubkey)],3:[new Uint8Array(t)]});return rr("naddr",r)}function fn(e){let t=[];return Object.entries(e).reverse().forEach(([r,n])=>{n.forEach(o=>{let i=new Uint8Array(o.length+2);i.set([parseInt(r)],0),i.set([o.length],1),i.set(o,2),t.push(i)})}),Ze(...t)}var wd={};q(wd,{decrypt:()=>vd,encrypt:()=>Ci});async function Ci(e,t,r){const n=e instanceof Uint8Array?Y(e):e,o=se.getSharedSecret(n,"02"+t),i=Bi(o);let s=Uint8Array.from(jo(16)),l=rt.encode(r),a=ti(i,s).encrypt(l),c=bt.encode(new Uint8Array(a)),u=bt.encode(new Uint8Array(s.buffer));return`${c}?iv=${u}`}async function vd(e,t,r){const n=e instanceof Uint8Array?Y(e):e;let[o,i]=r.split("?iv="),s=se.getSharedSecret(n,"02"+t),l=Bi(s),a=bt.decode(i),c=bt.decode(o),u=ti(l,a).decrypt(c);return pt.decode(u)}function Bi(e){return e.slice(1,33)}var xd={};q(xd,{NIP05_REGEX:()=>pn,isNip05:()=>Ed,isValid:()=>Ad,queryProfile:()=>Li,searchDomain:()=>$d,useFetchImplementation:()=>_d});var pn=/^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/,Ed=e=>pn.test(e||""),or;try{or=fetch}catch{}function _d(e){or=e}async function $d(e,t=""){try{const r=`https://${e}/.well-known/nostr.json?name=${t}`,n=await or(r,{redirect:"manual"});if(n.status!==200)throw Error("Wrong response code");return(await n.json()).names}catch{return{}}}async function Li(e){const t=e.match(pn);if(!t)return null;const[,r="_",n]=t;try{const o=`https://${n}/.well-known/nostr.json?name=${r}`,i=await or(o,{redirect:"manual"});if(i.status!==200)throw Error("Wrong response code");const s=await i.json(),l=s.names[r];return l?{pubkey:l,relays:s.relays?.[l]}:null}catch{return null}}async function Ad(e,t){const r=await Li(t);return r?r.pubkey===e:!1}var Sd={};q(Sd,{parse:()=>kd});function kd(e){const t={reply:void 0,root:void 0,mentions:[],profiles:[]},r=[];for(const n of e.tags)n[0]==="e"&&n[1]&&r.push(n),n[0]==="p"&&n[1]&&t.profiles.push({pubkey:n[1],relays:n[2]?[n[2]]:[]});for(let n=0;n<r.length;n++){const o=r[n],[i,s,l,a]=o,c={id:s,relays:l?[l]:[]},u=n===0,d=n===r.length-1;if(a==="root"){t.root=c;continue}if(a==="reply"){t.reply=c;continue}if(a==="mention"){t.mentions.push(c);continue}if(u){t.root=c;continue}if(d){t.reply=c;continue}t.mentions.push(c)}return t}var Pd={};q(Pd,{fetchRelayInformation:()=>Bd,useFetchImplementation:()=>Cd});var Ui;try{Ui=fetch}catch{}function Cd(e){Ui=e}async function Bd(e){return await(await fetch(e.replace("ws://","http://").replace("wss://","https://"),{headers:{Accept:"application/nostr+json"}})).json()}var Ld={};q(Ld,{fastEventHash:()=>Ii,getPow:()=>Ti,minePow:()=>Ud});function Ti(e){let t=0;for(let r=0;r<64;r+=8){const n=parseInt(e.substring(r,r+8),16);if(n===0)t+=32;else{t+=Math.clz32(n);break}}return t}function Ud(e,t){let r=0;const n=e,o=["nonce",r.toString(),t.toString()];for(n.tags.push(o);;){const i=Math.floor(new Date().getTime()/1e3);if(i!==n.created_at&&(r=0,n.created_at=i),o[1]=(++r).toString(),n.id=Ii(n),Ti(n.id)>=t)break}return n}function Ii(e){return Y(ae(rt.encode(JSON.stringify([0,e.pubkey,e.created_at,e.kind,e.tags,e.content]))))}var Td={};q(Td,{finishRepostEvent:()=>Id,getRepostedEvent:()=>Md,getRepostedEventPointer:()=>Mi});function Id(e,t,r,n){return dt({kind:cn,tags:[...e.tags??[],["e",t.id,r],["p",t.pubkey]],content:e.content===""?"":JSON.stringify(t),created_at:e.created_at},n)}function Mi(e){if(e.kind!==cn)return;let t,r;for(let n=e.tags.length-1;n>=0&&(t===void 0||r===void 0);n--){const o=e.tags[n];o.length>=2&&(o[0]==="e"&&t===void 0?t=o:o[0]==="p"&&r===void 0&&(r=o))}if(t!==void 0)return{id:t[1],relays:[t[2],r?.[2]].filter(n=>typeof n=="string"),author:r?.[1]}}function Md(e,{skipVerification:t}={}){const r=Mi(e);if(r===void 0||e.content==="")return;let n;try{n=JSON.parse(e.content)}catch{return}if(n.id===r.id&&!(!t&&!Xe(n)))return n}var Rd={};q(Rd,{NOSTR_URI_REGEX:()=>ir,parse:()=>Od,test:()=>Nd});var ir=new RegExp(`nostr:(${Pi.source})`);function Nd(e){return typeof e=="string"&&new RegExp(`^${ir.source}$`).test(e)}function Od(e){const t=e.match(new RegExp(`^${ir.source}$`));if(!t)throw new Error(`Invalid Nostr URI: ${e}`);return{uri:t[0],value:t[1],decoded:er(t[1])}}var Hd={};q(Hd,{finishReactionEvent:()=>zd,getReactedEventPointer:()=>Vd});function zd(e,t,r){const n=t.tags.filter(o=>o.length>=2&&(o[0]==="e"||o[0]==="p"));return dt({...e,kind:dn,tags:[...e.tags??[],...n,["e",t.id],["p",t.pubkey]],content:e.content??"+"},r)}function Vd(e){if(e.kind!==dn)return;let t,r;for(let n=e.tags.length-1;n>=0&&(t===void 0||r===void 0);n--){const o=e.tags[n];o.length>=2&&(o[0]==="e"&&t===void 0?t=o:o[0]==="p"&&r===void 0&&(r=o))}if(!(t===void 0||r===void 0))return{id:t[1],relays:[t[2],r[2]].filter(n=>n!==void 0),author:r[1]}}var Dd={};q(Dd,{matchAll:()=>qd,regex:()=>gn,replaceAll:()=>jd});var gn=()=>new RegExp(`\\b${ir.source}\\b`,"g");function*qd(e){const t=e.matchAll(gn());for(const r of t)try{const[n,o]=r;yield{uri:n,value:o,decoded:er(o),start:r.index,end:r.index+n.length}}catch{}}function jd(e,t){return e.replaceAll(gn(),(r,n)=>t({uri:r,value:n,decoded:er(n)}))}var Fd={};q(Fd,{channelCreateEvent:()=>Wd,channelHideMessageEvent:()=>Gd,channelMessageEvent:()=>Zd,channelMetadataEvent:()=>Kd,channelMuteUserEvent:()=>Jd});var Wd=(e,t)=>{let r;if(typeof e.content=="object")r=JSON.stringify(e.content);else if(typeof e.content=="string")r=e.content;else return;return dt({kind:gi,tags:[...e.tags??[]],content:r,created_at:e.created_at},t)},Kd=(e,t)=>{let r;if(typeof e.content=="object")r=JSON.stringify(e.content);else if(typeof e.content=="string")r=e.content;else return;return dt({kind:bi,tags:[["e",e.channel_create_event_id],...e.tags??[]],content:r,created_at:e.created_at},t)},Zd=(e,t)=>{const r=[["e",e.channel_create_event_id,e.relay_url,"root"]];return e.reply_to_channel_message_event_id&&r.push(["e",e.reply_to_channel_message_event_id,e.relay_url,"reply"]),dt({kind:mi,tags:[...r,...e.tags??[]],content:e.content,created_at:e.created_at},t)},Gd=(e,t)=>{let r;if(typeof e.content=="object")r=JSON.stringify(e.content);else if(typeof e.content=="string")r=e.content;else return;return dt({kind:yi,tags:[["e",e.channel_message_event_id],...e.tags??[]],content:r,created_at:e.created_at},t)},Jd=(e,t)=>{let r;if(typeof e.content=="object")r=JSON.stringify(e.content);else if(typeof e.content=="string")r=e.content;else return;return dt({kind:wi,tags:[["p",e.pubkey_to_mute],...e.tags??[]],content:r,created_at:e.created_at},t)},Yd={};q(Yd,{EMOJI_SHORTCODE_REGEX:()=>Ri,matchAll:()=>Xd,regex:()=>bn,replaceAll:()=>Qd});var Ri=/:(\w+):/,bn=()=>new RegExp(`\\B${Ri.source}\\B`,"g");function*Xd(e){const t=e.matchAll(bn());for(const r of t)try{const[n,o]=r;yield{shortcode:n,name:o,start:r.index,end:r.index+n.length}}catch{}}function Qd(e,t){return e.replaceAll(bn(),(r,n)=>t({shortcode:r,name:n}))}var tu={};q(tu,{useFetchImplementation:()=>eu,validateGithub:()=>ru});var mn;try{mn=fetch}catch{}function eu(e){mn=e}async function ru(e,t,r){try{return await(await mn(`https://gist.github.com/${t}/${r}/raw`)).text()===`Verifying that I control the following Nostr public key: ${e}`}catch{return!1}}var nu={};q(nu,{decrypt:()=>xn,encrypt:()=>vn,getConversationKey:()=>yn,v2:()=>lu});var Ni=1,Oi=65535;function yn(e,t){const r=se.getSharedSecret(e,"02"+t).subarray(1,33);return Bl(ae,r,"nip44-v2")}function Hi(e,t){const r=Ll(ae,e,t,76);return{chacha_key:r.subarray(0,32),chacha_nonce:r.subarray(32,44),hmac_key:r.subarray(44,76)}}function wn(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("expected positive integer");if(e<=32)return 32;const t=1<<Math.floor(Math.log2(e-1))+1,r=t<=256?32:t/8;return r*(Math.floor((e-1)/r)+1)}function ou(e){if(!Number.isSafeInteger(e)||e<Ni||e>Oi)throw new Error("invalid plaintext size: must be between 1 and 65535 bytes");const t=new Uint8Array(2);return new DataView(t.buffer).setUint16(0,e,!1),t}function iu(e){const t=rt.encode(e),r=t.length,n=ou(r),o=new Uint8Array(wn(r)-r);return Ze(n,t,o)}function su(e){const t=new DataView(e.buffer).getUint16(0),r=e.subarray(2,2+t);if(t<Ni||t>Oi||r.length!==t||e.length!==2+wn(t))throw new Error("invalid padding");return pt.decode(r)}function zi(e,t,r){if(r.length!==32)throw new Error("AAD associated data must be 32 bytes");const n=Ze(r,t);return Je(ae,e,n)}function au(e){if(typeof e!="string")throw new Error("payload must be a valid string");const t=e.length;if(t<132||t>87472)throw new Error("invalid payload length: "+t);if(e[0]==="#")throw new Error("unknown encryption version");let r;try{r=bt.decode(e)}catch(i){throw new Error("invalid base64: "+i.message)}const n=r.length;if(n<99||n>65603)throw new Error("invalid data length: "+n);const o=r[0];if(o!==2)throw new Error("unknown encryption version "+o);return{nonce:r.subarray(1,33),ciphertext:r.subarray(33,-32),mac:r.subarray(-32)}}function vn(e,t,r=jo(32)){const{chacha_key:n,chacha_nonce:o,hmac_key:i}=Hi(t,r),s=iu(e),l=oi(n,o,s),a=zi(i,l,r);return bt.encode(Ze(new Uint8Array([2]),r,l,a))}function xn(e,t){const{nonce:r,ciphertext:n,mac:o}=au(e),{chacha_key:i,chacha_nonce:s,hmac_key:l}=Hi(t,r),a=zi(l,n,r);if(!ul(a,o))throw new Error("invalid MAC");const c=oi(i,s,n);return su(c)}var lu={utils:{getConversationKey:yn,calcPaddedLen:wn},encrypt:vn,decrypt:xn},cu={};q(cu,{makeNwcRequestEvent:()=>uu,parseConnectionString:()=>du});function du(e){const{pathname:t,searchParams:r}=new URL(e),n=t,o=r.get("relay"),i=r.get("secret");if(!n||!o||!i)throw new Error("invalid connection string");return{pubkey:n,relay:o,secret:i}}async function uu(e,t,r){const o=await Ci(t,e,JSON.stringify({method:"pay_invoice",params:{invoice:r}})),i={kind:Ei,created_at:Math.round(Date.now()/1e3),content:o,tags:[["p",e]]};return dt(i,t)}var hu={};q(hu,{getZapEndpoint:()=>pu,makeZapReceipt:()=>mu,makeZapRequest:()=>gu,useFetchImplementation:()=>fu,validateZapRequest:()=>bu});var En;try{En=fetch}catch{}function fu(e){En=e}async function pu(e){try{let t="",{lud06:r,lud16:n}=JSON.parse(e.content);if(r){let{words:s}=oe.decode(r,1e3),l=oe.fromWords(s);t=pt.decode(l)}else if(n){let[s,l]=n.split("@");t=new URL(`/.well-known/lnurlp/${s}`,`https://${l}`).toString()}else return null;let i=await(await En(t)).json();if(i.allowsNostr&&i.nostrPubkey)return i.callback}catch{}return null}function gu({profile:e,event:t,amount:r,relays:n,comment:o=""}){if(!r)throw new Error("amount not given");if(!e)throw new Error("profile not given");let i={kind:9734,created_at:Math.round(Date.now()/1e3),content:o,tags:[["p",e],["amount",r.toString()],["relays",...n]]};return t&&i.tags.push(["e",t]),i}function bu(e){let t;try{t=JSON.parse(e)}catch{return"Invalid zap request JSON."}if(!an(t))return"Zap request is not a valid Nostr event.";if(!Xe(t))return"Invalid signature on zap request.";let r=t.tags.find(([i,s])=>i==="p"&&s);if(!r)return"Zap request doesn't have a 'p' tag.";if(!r[1].match(/^[a-f0-9]{64}$/))return"Zap request 'p' tag is not valid hex.";let n=t.tags.find(([i,s])=>i==="e"&&s);return n&&!n[1].match(/^[a-f0-9]{64}$/)?"Zap request 'e' tag is not valid hex.":t.tags.find(([i,s])=>i==="relays"&&s)?null:"Zap request doesn't have a 'relays' tag."}function mu({zapRequest:e,preimage:t,bolt11:r,paidAt:n}){let o=JSON.parse(e),i=o.tags.filter(([l])=>l==="e"||l==="p"||l==="a"),s={kind:9735,created_at:Math.round(n.getTime()/1e3),content:"",tags:[...i,["P",o.pubkey],["bolt11",r],["description",e]]};return t&&s.tags.push(["preimage",t]),s}var yu={};q(yu,{createRumor:()=>Fi,createSeal:()=>Wi,createWrap:()=>Ki,unwrapEvent:()=>Zi,unwrapManyEvents:()=>xu,wrapEvent:()=>Hr,wrapManyEvents:()=>vu});var wu=2*24*60*60,Vi=()=>Math.round(Date.now()/1e3),Di=()=>Math.round(Vi()-Math.random()*wu),qi=(e,t)=>yn(e,t),ji=(e,t,r)=>vn(JSON.stringify(e),qi(t,r)),ao=(e,t)=>JSON.parse(xn(e.content,qi(t,e.pubkey)));function Fi(e,t){const r={created_at:Vi(),content:"",tags:[],...e,pubkey:ci(t)};return r.id=Le(r),r}function Wi(e,t,r){return dt({kind:pi,content:ji(e,t,r),created_at:Di(),tags:[]},t)}function Ki(e,t){const r=Hl();return dt({kind:vi,content:ji(e,r,t),created_at:Di(),tags:[["p",t]]},r)}function Hr(e,t,r){const n=Fi(e,t),o=Wi(n,t,r);return Ki(o,r)}function vu(e,t,r){if(!r||r.length===0)throw new Error("At least one recipient is required.");const n=ci(t),o=[Hr(e,t,n)];return r.forEach(i=>{o.push(Hr(e,t,i))}),o}function Zi(e,t){const r=ao(e,t);return ao(r,t)}function xu(e,t){let r=[];return e.forEach(n=>{r.push(Zi(n,t))}),r.sort((n,o)=>n.created_at-o.created_at),r}var Eu={};q(Eu,{getToken:()=>_u,hashPayload:()=>_n,unpackEventFromToken:()=>Ji,validateEvent:()=>rs,validateEventKind:()=>Xi,validateEventMethodTag:()=>ts,validateEventPayloadTag:()=>es,validateEventTimestamp:()=>Yi,validateEventUrlTag:()=>Qi,validateToken:()=>$u});var Gi="Nostr ";async function _u(e,t,r,n=!1,o){const i={kind:un,tags:[["u",e],["method",t]],created_at:Math.round(new Date().getTime()/1e3),content:""};o&&i.tags.push(["payload",_n(o)]);const s=await r(i);return(n?Gi:"")+bt.encode(rt.encode(JSON.stringify(s)))}async function $u(e,t,r){const n=await Ji(e).catch(i=>{throw i});return await rs(n,t,r).catch(i=>{throw i})}async function Ji(e){if(!e)throw new Error("Missing token");e=e.replace(Gi,"");const t=pt.decode(bt.decode(e));if(!t||t.length===0||!t.startsWith("{"))throw new Error("Invalid token");return JSON.parse(t)}function Yi(e){return e.created_at?Math.round(new Date().getTime()/1e3)-e.created_at<60:!1}function Xi(e){return e.kind===un}function Qi(e,t){const r=e.tags.find(n=>n[0]==="u");return r?r.length>0&&r[1]===t:!1}function ts(e,t){const r=e.tags.find(n=>n[0]==="method");return r?r.length>0&&r[1].toLowerCase()===t.toLowerCase():!1}function _n(e){const t=ae(rt.encode(JSON.stringify(e)));return Y(t)}function es(e,t){const r=e.tags.find(o=>o[0]==="payload");if(!r)return!1;const n=_n(t);return r.length>0&&r[1]===n}async function rs(e,t,r,n){if(!Xe(e))throw new Error("Invalid nostr event, signature invalid");if(!Xi(e))throw new Error("Invalid nostr event, kind invalid");if(!Yi(e))throw new Error("Invalid nostr event, created_at timestamp invalid");if(!Qi(e,t))throw new Error("Invalid nostr event, url tag invalid");if(!ts(e,r))throw new Error("Invalid nostr event, method tag invalid");if(n&&typeof n=="object"&&Object.keys(n).length>0&&!es(e,n))throw new Error("Invalid nostr event, payload tag does not match request body hash");return!0}var Au=ct`
:host {
--border-color: var(--sl-color-neutral-200);
--border-radius: var(--sl-border-radius-medium);
--border-width: 1px;
--padding: var(--sl-spacing-large);
display: inline-block;
}
.card {
display: flex;
flex-direction: column;
background-color: var(--sl-panel-background-color);
box-shadow: var(--sl-shadow-x-small);
border: solid var(--border-width) var(--border-color);
border-radius: var(--border-radius);
}
.card__image {
display: flex;
border-top-left-radius: var(--border-radius);
border-top-right-radius: var(--border-radius);
margin: calc(-1 * var(--border-width));
overflow: hidden;
}
.card__image::slotted(img) {
display: block;
width: 100%;
}
.card:not(.card--has-image) .card__image {
display: none;
}
.card__header {
display: block;
border-bottom: solid var(--border-width) var(--border-color);
padding: calc(var(--padding) / 2) var(--padding);
}
.card:not(.card--has-header) .card__header {
display: none;
}
.card:not(.card--has-image) .card__header {
border-top-left-radius: var(--border-radius);
border-top-right-radius: var(--border-radius);
}
.card__body {
display: block;
padding: var(--padding);
}
.card--has-footer .card__footer {
display: block;
border-top: solid var(--border-width) var(--border-color);
padding: var(--padding);
}
.card:not(.card--has-footer) .card__footer {
display: none;
}
`,ns=class{constructor(e,...t){this.slotNames=[],this.handleSlotChange=r=>{const n=r.target;(this.slotNames.includes("[default]")&&!n.name||n.name&&this.slotNames.includes(n.name))&&this.host.requestUpdate()},(this.host=e).addController(this),this.slotNames=t}hasDefaultSlot(){return[...this.host.childNodes].some(e=>{if(e.nodeType===e.TEXT_NODE&&e.textContent.trim()!=="")return!0;if(e.nodeType===e.ELEMENT_NODE){const t=e;if(t.tagName.toLowerCase()==="sl-visually-hidden")return!1;if(!t.hasAttribute("slot"))return!0}return!1})}hasNamedSlot(e){return this.host.querySelector(`:scope > [slot="${e}"]`)!==null}test(e){return e==="[default]"?this.hasDefaultSlot():this.hasNamedSlot(e)}hostConnected(){this.host.shadowRoot.addEventListener("slotchange",this.handleSlotChange)}hostDisconnected(){this.host.shadowRoot.removeEventListener("slotchange",this.handleSlotChange)}},sr=ct`
:host {
box-sizing: border-box;
}
:host *,
:host *::before,
:host *::after {
box-sizing: inherit;
}
[hidden] {
display: none !important;
}
`,Ue,Mt=class extends gt{constructor(){super(),xs(this,Ue,!1),this.initialReflectedProperties=new Map,Object.entries(this.constructor.dependencies).forEach(([e,t])=>{this.constructor.define(e,t)})}emit(e,t){const r=new CustomEvent(e,_e({bubbles:!0,cancelable:!1,composed:!0,detail:{}},t));return this.dispatchEvent(r),r}static define(e,t=this,r={}){const n=customElements.get(e);if(!n){try{customElements.define(e,t,r)}catch{customElements.define(e,class extends t{},r)}return}let o=" (unknown version)",i=o;"version"in t&&t.version&&(o=" v"+t.version),"version"in n&&n.version&&(i=" v"+n.version),!(o&&i&&o===i)&&console.warn(`Attempted to register <${e}>${o}, but <${e}>${i} has already been registered.`)}attributeChangedCallback(e,t,r){vs(this,Ue)||(this.constructor.elementProperties.forEach((n,o)=>{n.reflect&&this[o]!=null&&this.initialReflectedProperties.set(o,this[o])}),Es(this,Ue,!0)),super.attributeChangedCallback(e,t,r)}willUpdate(e){super.willUpdate(e),this.initialReflectedProperties.forEach((t,r)=>{e.has(r)&&this[r]==null&&(this[r]=t)})}};Ue=new WeakMap;Mt.version="2.18.0";Mt.dependencies={};T([S()],Mt.prototype,"dir",2);T([S()],Mt.prototype,"lang",2);/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const Su={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ku=e=>(...t)=>({_$litDirective$:e,values:t});let Pu=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,r,n){this._$Ct=t,this._$AM=r,this._$Ci=n}_$AS(t,r){return this.update(t,r)}update(t,r){return this.render(...r)}};/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const os=ku(class extends Pu{constructor(e){if(super(e),e.type!==Su.ATTRIBUTE||e.name!=="class"||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter(t=>e[t]).join(" ")+" "}update(e,[t]){if(this.st===void 0){this.st=new Set,e.strings!==void 0&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter(n=>n!=="")));for(const n in t)t[n]&&!this.nt?.has(n)&&this.st.add(n);return this.render(t)}const r=e.element.classList;for(const n of this.st)n in t||(r.remove(n),this.st.delete(n));for(const n in t){const o=!!t[n];o===this.st.has(n)||this.nt?.has(n)||(o?(r.add(n),this.st.add(n)):(r.remove(n),this.st.delete(n)))}return jt}});var is=class extends Mt{constructor(){super(...arguments),this.hasSlotController=new ns(this,"footer","header","image")}render(){return G`
<div
part="base"
class=${os({card:!0,"card--has-footer":this.hasSlotController.test("footer"),"card--has-image":this.hasSlotController.test("image"),"card--has-header":this.hasSlotController.test("header")})}
>
<slot name="image" part="image" class="card__image"></slot>
<slot name="header" part="header" class="card__header"></slot>
<slot part="body" class="card__body"></slot>
<slot name="footer" part="footer" class="card__footer"></slot>
</div>
`}};is.styles=[sr,Au];is.define("sl-card");var Cu=ct`
:host {
--track-width: 2px;
--track-color: rgb(128 128 128 / 25%);
--indicator-color: var(--sl-color-primary-600);
--speed: 2s;
display: inline-flex;
width: 1em;
height: 1em;
flex: none;
}
.spinner {
flex: 1 1 auto;
height: 100%;
width: 100%;
}
.spinner__track,
.spinner__indicator {
fill: none;
stroke-width: var(--track-width);
r: calc(0.5em - var(--track-width) / 2);
cx: 0.5em;
cy: 0.5em;
transform-origin: 50% 50%;
}
.spinner__track {
stroke: var(--track-color);
transform-origin: 0% 0%;
}
.spinner__indicator {
stroke: var(--indicator-color);
stroke-linecap: round;
stroke-dasharray: 150% 75%;
animation: spin var(--speed) linear infinite;
}
@keyframes spin {
0% {
transform: rotate(0deg);
stroke-dasharray: 0.05em, 3em;
}
50% {
transform: rotate(450deg);
stroke-dasharray: 1.375em, 1.375em;
}
100% {
transform: rotate(1080deg);
stroke-dasharray: 0.05em, 3em;
}
}
`;const zr=new Set,Qt=new Map;let zt,$n="ltr",An="en";const ss=typeof MutationObserver<"u"&&typeof document<"u"&&typeof document.documentElement<"u";if(ss){const e=new MutationObserver(ls);$n=document.documentElement.dir||"ltr",An=document.documentElement.lang||navigator.language,e.observe(document.documentElement,{attributes:!0,attributeFilter:["dir","lang"]})}function as(...e){e.map(t=>{const r=t.$code.toLowerCase();Qt.has(r)?Qt.set(r,Object.assign(Object.assign({},Qt.get(r)),t)):Qt.set(r,t),zt||(zt=t)}),ls()}function ls(){ss&&($n=document.documentElement.dir||"ltr",An=document.documentElement.lang||navigator.language),[...zr.keys()].map(e=>{typeof e.requestUpdate=="function"&&e.requestUpdate()})}let Bu=class{constructor(t){this.host=t,this.host.addController(this)}hostConnected(){zr.add(this.host)}hostDisconnected(){zr.delete(this.host)}dir(){return`${this.host.dir||$n}`.toLowerCase()}lang(){return`${this.host.lang||An}`.toLowerCase()}getTranslationData(t){var r,n;const o=new Intl.Locale(t.replace(/_/g,"-")),i=o?.language.toLowerCase(),s=(n=(r=o?.region)===null||r===void 0?void 0:r.toLowerCase())!==null&&n!==void 0?n:"",l=Qt.get(`${i}-${s}`),a=Qt.get(i);return{locale:o,language:i,region:s,primary:l,secondary:a}}exists(t,r){var n;const{primary:o,secondary:i}=this.getTranslationData((n=r.lang)!==null&&n!==void 0?n:this.lang());return r=Object.assign({includeFallback:!1},r),!!(o&&o[t]||i&&i[t]||r.includeFallback&&zt&&zt[t])}term(t,...r){const{primary:n,secondary:o}=this.getTranslationData(this.lang());let i;if(n&&n[t])i=n[t];else if(o&&o[t])i=o[t];else if(zt&&zt[t])i=zt[t];else return console.error(`No translation found for: ${String(t)}`),String(t);return typeof i=="function"?i(...r):i}date(t,r){return t=new Date(t),new Intl.DateTimeFormat(this.lang(),r).format(t)}number(t,r){return t=Number(t),isNaN(t)?"":new Intl.NumberFormat(this.lang(),r).format(t)}relativeTime(t,r,n){return new Intl.RelativeTimeFormat(this.lang(),n).format(t,r)}};var cs={$code:"en",$name:"English",$dir:"ltr",carousel:"Carousel",clearEntry:"Clear entry",close:"Close",copied:"Copied",copy:"Copy",currentValue:"Current value",error:"Error",goToSlide:(e,t)=>`Go to slide ${e} of ${t}`,hidePassword:"Hide password",loading:"Loading",nextSlide:"Next slide",numOptionsSelected:e=>e===0?"No options selected":e===1?"1 option selected":`${e} options selected`,previousSlide:"Previous slide",progress:"Progress",remove:"Remove",resize:"Resize",scrollToEnd:"Scroll to end",scrollToStart:"Scroll to start",selectAColorFromTheScreen:"Select a color from the screen",showPassword:"Show password",slideNum:e=>`Slide ${e}`,toggleColorFormat:"Toggle color format"};as(cs);var Lu=cs,ds=class extends Bu{};as(Lu);var us=class extends Mt{constructor(){super(...arguments),this.localize=new ds(this)}render(){return G`
<svg part="base" class="spinner" role="progressbar" aria-label=${this.localize.term("loading")}>
<circle class="spinner__track"></circle>
<circle class="spinner__indicator"></circle>
</svg>
`}};us.styles=[sr,Cu];var fe=new WeakMap,pe=new WeakMap,ge=new WeakMap,vr=new WeakSet,Pe=new WeakMap,Uu=class{constructor(e,t){this.handleFormData=r=>{const n=this.options.disabled(this.host),o=this.options.name(this.host),i=this.options.value(this.host),s=this.host.tagName.toLowerCase()==="sl-button";this.host.isConnected&&!n&&!s&&typeof o=="string"&&o.length>0&&typeof i<"u"&&(Array.isArray(i)?i.forEach(l=>{r.formData.append(o,l.toString())}):r.formData.append(o,i.toString()))},this.handleFormSubmit=r=>{var n;const o=this.options.disabled(this.host),i=this.options.reportValidity;this.form&&!this.form.noValidate&&((n=fe.get(this.form))==null||n.forEach(s=>{this.setUserInteracted(s,!0)})),this.form&&!this.form.noValidate&&!o&&!i(this.host)&&(r.preventDefault(),r.stopImmediatePropagation())},this.handleFormReset=()=>{this.options.setValue(this.host,this.options.defaultValue(this.host)),this.setUserInteracted(this.host,!1),Pe.set(this.host,[])},this.handleInteraction=r=>{const n=Pe.get(this.host);n.includes(r.type)||n.push(r.type),n.length===this.options.assumeInteractionOn.length&&this.setUserInteracted(this.host,!0)},this.checkFormValidity=()=>{if(this.form&&!this.form.noValidate){const r=this.form.querySelectorAll("*");for(const n of r)if(typeof n.checkValidity=="function"&&!n.checkValidity())return!1}return!0},this.reportFormValidity=()=>{if(this.form&&!this.form.noValidate){const r=this.form.querySelectorAll("*");for(const n of r)if(typeof n.reportValidity=="function"&&!n.reportValidity())return!1}return!0},(this.host=e).addController(this),this.options=_e({form:r=>{const n=r.form;if(n){const i=r.getRootNode().querySelector(`#${n}`);if(i)return i}return r.closest("form")},name:r=>r.name,value:r=>r.value,defaultValue:r=>r.defaultValue,disabled:r=>{var n;return(n=r.disabled)!=null?n:!1},reportValidity:r=>typeof r.reportValidity=="function"?r.reportValidity():!0,checkValidity:r=>typeof r.checkValidity=="function"?r.checkValidity():!0,setValue:(r,n)=>r.value=n,assumeInteractionOn:["sl-input"]},t)}hostConnected(){const e=this.options.form(this.host);e&&this.attachForm(e),Pe.set(this.host,[]),this.options.assumeInteractionOn.forEach(t=>{this.host.addEventListener(t,this.handleInteraction)})}hostDisconnected(){this.detachForm(),Pe.delete(this.host),this.options.assumeInteractionOn.forEach(e=>{this.host.removeEventListener(e,this.handleInteraction)})}hostUpdated(){const e=this.options.form(this.host);e||this.detachForm(),e&&this.form!==e&&(this.detachForm(),this.attachForm(e)),this.host.hasUpdated&&this.setValidity(this.host.validity.valid)}attachForm(e){e?(this.form=e,fe.has(this.form)?fe.get(this.form).add(this.host):fe.set(this.form,new Set([this.host])),this.form.addEventListener("formdata",this.handleFormData),this.form.addEventListener("submit",this.handleFormSubmit),this.form.addEventListener("reset",this.handleFormReset),pe.has(this.form)||(pe.set(this.form,this.form.reportValidity),this.form.reportValidity=()=>this.reportFormValidity()),ge.has(this.form)||(ge.set(this.form,this.form.checkValidity),this.form.checkValidity=()=>this.checkFormValidity())):this.form=void 0}detachForm(){if(!this.form)return;const e=fe.get(this.form);e&&(e.delete(this.host),e.size<=0&&(this.form.removeEventListener("formdata",this.handleFormData),this.form.removeEventListener("submit",this.handleFormSubmit),this.form.removeEventListener("reset",this.handleFormReset),pe.has(this.form)&&(this.form.reportValidity=pe.get(this.form),pe.delete(this.form)),ge.has(this.form)&&(this.form.checkValidity=ge.get(this.form),ge.delete(this.form)),this.form=void 0))}setUserInteracted(e,t){t?vr.add(e):vr.delete(e),e.requestUpdate()}doAction(e,t){if(this.form){const r=document.createElement("button");r.type=e,r.style.position="absolute",r.style.width="0",r.style.height="0",r.style.clipPath="inset(50%)",r.style.overflow="hidden",r.style.whiteSpace="nowrap",t&&(r.name=t.name,r.value=t.value,["formaction","formenctype","formmethod","formnovalidate","formtarget"].forEach(n=>{t.hasAttribute(n)&&r.setAttribute(n,t.getAttribute(n))})),this.form.append(r),r.click(),r.remove()}}getForm(){var e;return(e=this.form)!=null?e:null}reset(e){this.doAction("reset",e)}submit(e){this.doAction("submit",e)}setValidity(e){const t=this.host,r=!!vr.has(t),n=!!t.required;t.toggleAttribute("data-required",n),t.toggleAttribute("data-optional",!n),t.toggleAttribute("data-invalid",!e),t.toggleAttribute("data-valid",e),t.toggleAttribute("data-user-invalid",!e&&r),t.toggleAttribute("data-user-valid",e&&r)}updateValidity(){const e=this.host;this.setValidity(e.validity.valid)}emitInvalidEvent(e){const t=new CustomEvent("sl-invalid",{bubbles:!1,composed:!1,cancelable:!0,detail:{}});e||t.preventDefault(),this.host.dispatchEvent(t)||e?.preventDefault()}},Sn=Object.freeze({badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:!0,valueMissing:!1});Object.freeze(bo(_e({},Sn),{valid:!1,valueMissing:!0}));Object.freeze(bo(_e({},Sn),{valid:!1,customError:!0}));var Tu=ct`
:host {
display: inline-block;
position: relative;
width: auto;
cursor: pointer;
}
.button {
display: inline-flex;
align-items: stretch;
justify-content: center;
width: 100%;
border-style: solid;
border-width: var(--sl-input-border-width);
font-family: var(--sl-input-font-family);
font-weight: var(--sl-font-weight-semibold);
text-decoration: none;
user-select: none;
-webkit-user-select: none;
white-space: nowrap;
vertical-align: middle;
padding: 0;
transition:
var(--sl-transition-x-fast) background-color,
var(--sl-transition-x-fast) color,
var(--sl-transition-x-fast) border,
var(--sl-transition-x-fast) box-shadow;
cursor: inherit;
}
.button::-moz-focus-inner {
border: 0;
}
.button:focus {
outline: none;
}
.button:focus-visible {
outline: var(--sl-focus-ring);
outline-offset: var(--sl-focus-ring-offset);
}
.button--disabled {
opacity: 0.5;
cursor: not-allowed;
}
/* When disabled, prevent mouse events from bubbling up from children */
.button--disabled * {
pointer-events: none;
}
.button__prefix,
.button__suffix {
flex: 0 0 auto;
display: flex;
align-items: center;
pointer-events: none;
}
.button__label {
display: inline-block;
}
.button__label::slotted(sl-icon) {
vertical-align: -2px;
}
/*
* Standard buttons
*/
/* Default */
.button--standard.button--default {
background-color: var(--sl-color-neutral-0);
border-color: var(--sl-input-border-color);
color: var(--sl-color-neutral-700);
}
.button--standard.button--default:hover:not(.button--disabled) {
background-color: var(--sl-color-primary-50);
border-color: var(--sl-color-primary-300);
color: var(--sl-color-primary-700);
}
.button--standard.button--default:active:not(.button--disabled) {
background-color: var(--sl-color-primary-100);
border-color: var(--sl-color-primary-400);
color: var(--sl-color-primary-700);
}
/* Primary */
.button--standard.button--primary {
background-color: var(--sl-color-primary-600);
border-color: var(--sl-color-primary-600);
color: var(--sl-color-neutral-0);
}
.button--standard.button--primary:hover:not(.button--disabled) {
background-color: var(--sl-color-primary-500);
border-color: var(--sl-color-primary-500);
color: var(--sl-color-neutral-0);
}
.button--standard.button--primary:active:not(.button--disabled) {
background-color: var(--sl-color-primary-600);
border-color: var(--sl-color-primary-600);
color: var(--sl-color-neutral-0);
}
/* Success */
.button--standard.button--success {
background-color: var(--sl-color-success-600);
border-color: var(--sl-color-success-600);
color: var(--sl-color-neutral-0);
}
.button--standard.button--success:hover:not(.button--disabled) {
background-color: var(--sl-color-success-500);
border-color: var(--sl-color-success-500);
color: var(--sl-color-neutral-0);
}
.button--standard.button--success:active:not(.button--disabled) {
background-color: var(--sl-color-success-600);
border-color: var(--sl-color-success-600);
color: var(--sl-color-neutral-0);
}
/* Neutral */
.button--standard.button--neutral {
background-color: var(--sl-color-neutral-600);
border-color: var(--sl-color-neutral-600);
color: var(--sl-color-neutral-0);
}
.button--standard.button--neutral:hover:not(.button--disabled) {
background-color: var(--sl-color-neutral-500);
border-color: var(--sl-color-neutral-500);
color: var(--sl-color-neutral-0);
}
.button--standard.button--neutral:active:not(.button--disabled) {
background-color: var(--sl-color-neutral-600);
border-color: var(--sl-color-neutral-600);
color: var(--sl-color-neutral-0);
}
/* Warning */
.button--standard.button--warning {
background-color: var(--sl-color-warning-600);
border-color: var(--sl-color-warning-600);
color: var(--sl-color-neutral-0);
}
.button--standard.button--warning:hover:not(.button--disabled) {
background-color: var(--sl-color-warning-500);
border-color: var(--sl-color-warning-500);
color: var(--sl-color-neutral-0);
}
.button--standard.button--warning:active:not(.button--disabled) {
background-color: var(--sl-color-warning-600);
border-color: var(--sl-color-warning-600);
color: var(--sl-color-neutral-0);
}
/* Danger */
.button--standard.button--danger {
background-color: var(--sl-color-danger-600);
border-color: var(--sl-color-danger-600);
color: var(--sl-color-neutral-0);
}
.button--standard.button--danger:hover:not(.button--disabled) {
background-color: var(--sl-color-danger-500);
border-color: var(--sl-color-danger-500);
color: var(--sl-color-neutral-0);
}
.button--standard.button--danger:active:not(.button--disabled) {
background-color: var(--sl-color-danger-600);
border-color: var(--sl-color-danger-600);
color: var(--sl-color-neutral-0);
}
/*
* Outline buttons
*/
.button--outline {
background: none;
border: solid 1px;
}
/* Default */
.button--outline.button--default {
border-color: var(--sl-input-border-color);
color: var(--sl-color-neutral-700);
}
.button--outline.button--default:hover:not(.button--disabled),
.button--outline.button--default.button--checked:not(.button--disabled) {
border-color: var(--sl-color-primary-600);
background-color: var(--sl-color-primary-600);
color: var(--sl-color-neutral-0);
}
.button--outline.button--default:active:not(.button--disabled) {
border-color: var(--sl-color-primary-700);
background-color: var(--sl-color-primary-700);
color: var(--sl-color-neutral-0);
}
/* Primary */
.button--outline.button--primary {
border-color: var(--sl-color-primary-600);
color: var(--sl-color-primary-600);
}
.button--outline.button--primary:hover:not(.button--disabled),
.button--outline.button--primary.button--checked:not(.button--disabled) {
background-color: var(--sl-color-primary-600);
color: var(--sl-color-neutral-0);
}
.button--outline.button--primary:active:not(.button--disabled) {
border-color: var(--sl-color-primary-700);
background-color: var(--sl-color-primary-700);
color: var(--sl-color-neutral-0);
}
/* Success */
.button--outline.button--success {
border-color: var(--sl-color-success-600);
color: var(--sl-color-success-600);
}
.button--outline.button--success:hover:not(.button--disabled),
.button--outline.button--success.button--checked:not(.button--disabled) {
background-color: var(--sl-color-success-600);
color: var(--sl-color-neutral-0);
}
.button--outline.button--success:active:not(.button--disabled) {
border-color: var(--sl-color-success-700);
background-color: var(--sl-color-success-700);
color: var(--sl-color-neutral-0);
}
/* Neutral */
.button--outline.button--neutral {
border-color: var(--sl-color-neutral-600);
color: var(--sl-color-neutral-600);
}
.button--outline.button--neutral:hover:not(.button--disabled),
.button--outline.button--neutral.button--checked:not(.button--disabled) {
background-color: var(--sl-color-neutral-600);
color: var(--sl-color-neutral-0);
}
.button--outline.button--neutral:active:not(.button--disabled) {
border-color: var(--sl-color-neutral-700);
background-color: var(--sl-color-neutral-700);
color: var(--sl-color-neutral-0);
}
/* Warning */
.button--outline.button--warning {
border-color: var(--sl-color-warning-600);
color: var(--sl-color-warning-600);
}
.button--outline.button--warning:hover:not(.button--disabled),
.button--outline.button--warning.button--checked:not(.button--disabled) {
background-color: var(--sl-color-warning-600);
color: var(--sl-color-neutral-0);
}
.button--outline.button--warning:active:not(.button--disabled) {
border-color: var(--sl-color-warning-700);
background-color: var(--sl-color-warning-700);
color: var(--sl-color-neutral-0);
}
/* Danger */
.button--outline.button--danger {
border-color: var(--sl-color-danger-600);
color: var(--sl-color-danger-600);
}
.button--outline.button--danger:hover:not(.button--disabled),
.button--outline.button--danger.button--checked:not(.button--disabled) {
background-color: var(--sl-color-danger-600);
color: var(--sl-color-neutral-0);
}
.button--outline.button--danger:active:not(.button--disabled) {
border-color: var(--sl-color-danger-700);
background-color: var(--sl-color-danger-700);
color: var(--sl-color-neutral-0);
}
@media (forced-colors: active) {
.button.button--outline.button--checked:not(.button--disabled) {
outline: solid 2px transparent;
}
}
/*
* Text buttons
*/
.button--text {
background-color: transparent;
border-color: transparent;
color: var(--sl-color-primary-600);
}
.button--text:hover:not(.button--disabled) {
background-color: transparent;
border-color: transparent;
color: var(--sl-color-primary-500);
}
.button--text:focus-visible:not(.button--disabled) {
background-color: transparent;
border-color: transparent;
color: var(--sl-color-primary-500);
}
.button--text:active:not(.button--disabled) {
background-color: transparent;
border-color: transparent;
color: var(--sl-color-primary-700);
}
/*
* Size modifiers
*/
.button--small {
height: auto;
min-height: var(--sl-input-height-small);
font-size: var(--sl-button-font-size-small);
line-height: calc(var(--sl-input-height-small) - var(--sl-input-border-width) * 2);
border-radius: var(--sl-input-border-radius-small);
}
.button--medium {
height: auto;
min-height: var(--sl-input-height-medium);
font-size: var(--sl-button-font-size-medium);
line-height: calc(var(--sl-input-height-medium) - var(--sl-input-border-width) * 2);
border-radius: var(--sl-input-border-radius-medium);
}
.button--large {
height: auto;
min-height: var(--sl-input-height-large);
font-size: var(--sl-button-font-size-large);
line-height: calc(var(--sl-input-height-large) - var(--sl-input-border-width) * 2);
border-radius: var(--sl-input-border-radius-large);
}
/*
* Pill modifier
*/
.button--pill.button--small {
border-radius: var(--sl-input-height-small);
}
.button--pill.button--medium {
border-radius: var(--sl-input-height-medium);
}
.button--pill.button--large {
border-radius: var(--sl-input-height-large);
}
/*
* Circle modifier
*/
.button--circle {
padding-left: 0;
padding-right: 0;
}
.button--circle.button--small {
width: var(--sl-input-height-small);
border-radius: 50%;
}
.button--circle.button--medium {
width: var(--sl-input-height-medium);
border-radius: 50%;
}
.button--circle.button--large {
width: var(--sl-input-height-large);
border-radius: 50%;
}
.button--circle .button__prefix,
.button--circle .button__suffix,
.button--circle .button__caret {
display: none;
}
/*
* Caret modifier
*/
.button--caret .button__suffix {
display: none;
}
.button--caret .button__caret {
height: auto;
}
/*
* Loading modifier
*/
.button--loading {
position: relative;
cursor: wait;
}
.button--loading .button__prefix,
.button--loading .button__label,
.button--loading .button__suffix,
.button--loading .button__caret {
visibility: hidden;
}
.button--loading sl-spinner {
--indicator-color: currentColor;
position: absolute;
font-size: 1em;
height: 1em;
width: 1em;
top: calc(50% - 0.5em);
left: calc(50% - 0.5em);
}
/*
* Badges
*/
.button ::slotted(sl-badge) {
position: absolute;
top: 0;
right: 0;
translate: 50% -50%;
pointer-events: none;
}
.button--rtl ::slotted(sl-badge) {
right: auto;
left: 0;
translate: -50% -50%;
}
/*
* Button spacing
*/
.button--has-label.button--small .button__label {
padding: 0 var(--sl-spacing-small);
}
.button--has-label.button--medium .button__label {
padding: 0 var(--sl-spacing-medium);
}
.button--has-label.button--large .button__label {
padding: 0 var(--sl-spacing-large);
}
.button--has-prefix.button--small {
padding-inline-start: var(--sl-spacing-x-small);
}
.button--has-prefix.button--small .button__label {
padding-inline-start: var(--sl-spacing-x-small);
}
.button--has-prefix.button--medium {
padding-inline-start: var(--sl-spacing-small);
}
.button--has-prefix.button--medium .button__label {
padding-inline-start: var(--sl-spacing-small);
}
.button--has-prefix.button--large {
padding-inline-start: var(--sl-spacing-small);
}
.button--has-prefix.button--large .button__label {
padding-inline-start: var(--sl-spacing-small);
}
.button--has-suffix.button--small,
.button--caret.button--small {
padding-inline-end: var(--sl-spacing-x-small);
}
.button--has-suffix.button--small .button__label,
.button--caret.button--small .button__label {
padding-inline-end: var(--sl-spacing-x-small);
}
.button--has-suffix.button--medium,
.button--caret.button--medium {
padding-inline-end: var(--sl-spacing-small);
}
.button--has-suffix.button--medium .button__label,
.button--caret.button--medium .button__label {
padding-inline-end: var(--sl-spacing-small);
}
.button--has-suffix.button--large,
.button--caret.button--large {
padding-inline-end: var(--sl-spacing-small);
}
.button--has-suffix.button--large .button__label,
.button--caret.button--large .button__label {
padding-inline-end: var(--sl-spacing-small);
}
/*
* Button groups support a variety of button types (e.g. buttons with tooltips, buttons as dropdown triggers, etc.).
* This means buttons aren't always direct descendants of the button group, thus we can't target them with the
* ::slotted selector. To work around this, the button group component does some magic to add these special classes to
* buttons and we style them here instead.
*/
:host([data-sl-button-group__button--first]:not([data-sl-button-group__button--last])) .button {
border-start-end-radius: 0;
border-end-end-radius: 0;
}
:host([data-sl-button-group__button--inner]) .button {
border-radius: 0;
}
:host([data-sl-button-group__button--last]:not([data-sl-button-group__button--first])) .button {
border-start-start-radius: 0;
border-end-start-radius: 0;
}
/* All except the first */
:host([data-sl-button-group__button]:not([data-sl-button-group__button--first])) {
margin-inline-start: calc(-1 * var(--sl-input-border-width));
}
/* Add a visual separator between solid buttons */
:host(
[data-sl-button-group__button]:not(
[data-sl-button-group__button--first],
[data-sl-button-group__button--radio],
[variant='default']
):not(:hover)
)
.button:after {
content: '';
position: absolute;
top: 0;
inset-inline-start: 0;
bottom: 0;
border-left: solid 1px rgb(128 128 128 / 33%);
mix-blend-mode: multiply;
}
/* Bump hovered, focused, and checked buttons up so their focus ring isn't clipped */
:host([data-sl-button-group__button--hover]) {
z-index: 1;
}
/* Focus and checked are always on top */
:host([data-sl-button-group__button--focus]),
:host([data-sl-button-group__button][checked]) {
z-index: 2;
}
`,Iu={name:"default",resolver:e=>ps(`assets/icons/${e}.svg`)},Mu=Iu,lo={caret:`
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9"></polyline>
</svg>
`,check:`
<svg part="checked-icon" class="checkbox__icon" viewBox="0 0 16 16">
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round">
<g stroke="currentColor">
<g transform="translate(3.428571, 3.428571)">
<path d="M0,5.71428571 L3.42857143,9.14285714"></path>
<path d="M9.14285714,0 L3.42857143,9.14285714"></path>
</g>
</g>
</g>
</svg>
`,"chevron-down":`
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-down" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"/>
</svg>
`,"chevron-left":`
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-left" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z"/>
</svg>
`,"chevron-right":`
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-right" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"/>
</svg>
`,copy:`
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-copy" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M4 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V2Zm2-1a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H6ZM2 5a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-1h1v1a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h1v1H2Z"/>
</svg>
`,eye:`
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eye" viewBox="0 0 16 16">
<path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z"/>
<path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z"/>
</svg>
`,"eye-slash":`
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eye-slash" viewBox="0 0 16 16">
<path d="M13.359 11.238C15.06 9.72 16 8 16 8s-3-5.5-8-5.5a7.028 7.028 0 0 0-2.79.588l.77.771A5.944 5.944 0 0 1 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.134 13.134 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755-.165.165-.337.328-.517.486l.708.709z"/>
<path d="M11.297 9.176a3.5 3.5 0 0 0-4.474-4.474l.823.823a2.5 2.5 0 0 1 2.829 2.829l.822.822zm-2.943 1.299.822.822a3.5 3.5 0 0 1-4.474-4.474l.823.823a2.5 2.5 0 0 0 2.829 2.829z"/>
<path d="M3.35 5.47c-.18.16-.353.322-.518.487A13.134 13.134 0 0 0 1.172 8l.195.288c.335.48.83 1.12 1.465 1.755C4.121 11.332 5.881 12.5 8 12.5c.716 0 1.39-.133 2.02-.36l.77.772A7.029 7.029 0 0 1 8 13.5C3 13.5 0 8 0 8s.939-1.721 2.641-3.238l.708.709zm10.296 8.884-12-12 .708-.708 12 12-.708.708z"/>
</svg>
`,eyedropper:`
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eyedropper" viewBox="0 0 16 16">
<path d="M13.354.646a1.207 1.207 0 0 0-1.708 0L8.5 3.793l-.646-.647a.5.5 0 1 0-.708.708L8.293 5l-7.147 7.146A.5.5 0 0 0 1 12.5v1.793l-.854.853a.5.5 0 1 0 .708.707L1.707 15H3.5a.5.5 0 0 0 .354-.146L11 7.707l1.146 1.147a.5.5 0 0 0 .708-.708l-.647-.646 3.147-3.146a1.207 1.207 0 0 0 0-1.708l-2-2zM2 12.707l7-7L10.293 7l-7 7H2v-1.293z"></path>
</svg>
`,"grip-vertical":`
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-grip-vertical" viewBox="0 0 16 16">
<path d="M7 2a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0zM7 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0zM7 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-3 3a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-3 3a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"></path>
</svg>
`,indeterminate:`
<svg part="indeterminate-icon" class="checkbox__icon" viewBox="0 0 16 16">
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round">
<g stroke="currentColor" stroke-width="2">
<g transform="translate(2.285714, 6.857143)">
<path d="M10.2857143,1.14285714 L1.14285714,1.14285714"></path>
</g>
</g>
</g>
</svg>
`,"person-fill":`
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-person-fill" viewBox="0 0 16 16">
<path d="M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"/>
</svg>
`,"play-fill":`
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-play-fill" viewBox="0 0 16 16">
<path d="m11.596 8.697-6.363 3.692c-.54.313-1.233-.066-1.233-.697V4.308c0-.63.692-1.01 1.233-.696l6.363 3.692a.802.802 0 0 1 0 1.393z"></path>
</svg>
`,"pause-fill":`
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pause-fill" viewBox="0 0 16 16">
<path d="M5.5 3.5A1.5 1.5 0 0 1 7 5v6a1.5 1.5 0 0 1-3 0V5a1.5 1.5 0 0 1 1.5-1.5zm5 0A1.5 1.5 0 0 1 12 5v6a1.5 1.5 0 0 1-3 0V5a1.5 1.5 0 0 1 1.5-1.5z"></path>
</svg>
`,radio:`
<svg part="checked-icon" class="radio__icon" viewBox="0 0 16 16">
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g fill="currentColor">
<circle cx="8" cy="8" r="3.42857143"></circle>
</g>
</g>
</svg>
`,"star-fill":`
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-star-fill" viewBox="0 0 16 16">
<path d="M3.612 15.443c-.386.198-.824-.149-.746-.592l.83-4.73L.173 6.765c-.329-.314-.158-.888.283-.95l4.898-.696L7.538.792c.197-.39.73-.39.927 0l2.184 4.327 4.898.696c.441.062.612.636.282.95l-3.522 3.356.83 4.73c.078.443-.36.79-.746.592L8 13.187l-4.389 2.256z"/>
</svg>
`,"x-lg":`
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-lg" viewBox="0 0 16 16">
<path d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8 2.146 2.854Z"/>
</svg>
`,"x-circle-fill":`
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-circle-fill" viewBox="0 0 16 16">
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293 5.354 4.646z"></path>
</svg>
`},Ru={name:"system",resolver:e=>e in lo?`data:image/svg+xml,${encodeURIComponent(lo[e])}`:""},Nu=Ru,Ou=[Mu,Nu],Vr=[];function Hu(e){Vr.push(e)}function zu(e){Vr=Vr.filter(t=>t!==e)}function co(e){return Ou.find(t=>t.name===e)}var Vu=ct`
:host {
display: inline-block;
width: 1em;
height: 1em;
box-sizing: content-box !important;
}
svg {
display: block;
height: 100%;
width: 100%;
}
`;function kn(e,t){const r=_e({waitUntilFirstUpdate:!1},t);return(n,o)=>{const{update:i}=n,s=Array.isArray(e)?e:[e];n.update=function(l){s.forEach(a=>{const c=a;if(l.has(c)){const u=l.get(c),d=this[c];u!==d&&(!r.waitUntilFirstUpdate||this.hasUpdated)&&this[o](u,d)}}),i.call(this,l)}}}/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const Du=(e,t)=>e?._$litType$!==void 0;var be=Symbol(),Ce=Symbol(),xr,Er=new Map,xt=class extends Mt{constructor(){super(...arguments),this.initialRender=!1,this.svg=null,this.label="",this.library="default"}async resolveIcon(e,t){var r;let n;if(t?.spriteSheet)return this.svg=G`<svg part="svg">
<use part="use" href="${e}"></use>
</svg>`,this.svg;try{if(n=await fetch(e,{mode:"cors"}),!n.ok)return n.status===410?be:Ce}catch{return Ce}try{const o=document.createElement("div");o.innerHTML=await n.text();const i=o.firstElementChild;if(((r=i?.tagName)==null?void 0:r.toLowerCase())!=="svg")return be;xr||(xr=new DOMParser);const l=xr.parseFromString(i.outerHTML,"text/html").body.querySelector("svg");return l?(l.part.add("svg"),document.adoptNode(l)):be}catch{return be}}connectedCallback(){super.connectedCallback(),Hu(this)}firstUpdated(){this.initialRender=!0,this.setIcon()}disconnectedCallback(){super.disconnectedCallback(),zu(this)}getIconSource(){const e=co(this.library);return this.name&&e?{url:e.resolver(this.name),fromLibrary:!0}:{url:this.src,fromLibrary:!1}}handleLabelChange(){typeof this.label=="string"&&this.label.length>0?(this.setAttribute("role","img"),this.setAttribute("aria-label",this.label),this.removeAttribute("aria-hidden")):(this.removeAttribute("role"),this.removeAttribute("aria-label"),this.setAttribute("aria-hidden","true"))}async setIcon(){var e;const{url:t,fromLibrary:r}=this.getIconSource(),n=r?co(this.library):void 0;if(!t){this.svg=null;return}let o=Er.get(t);if(o||(o=this.resolveIcon(t,n),Er.set(t,o)),!this.initialRender)return;const i=await o;if(i===Ce&&Er.delete(t),t===this.getIconSource().url){if(Du(i)){if(this.svg=i,n){await this.updateComplete;const s=this.shadowRoot.querySelector("[part='svg']");typeof n.mutator=="function"&&s&&n.mutator(s)}return}switch(i){case Ce:case be:this.svg=null,this.emit("sl-error");break;default:this.svg=i.cloneNode(!0),(e=n?.mutator)==null||e.call(n,this.svg),this.emit("sl-load")}}}render(){return this.svg}};xt.styles=[sr,Vu];T([Zr()],xt.prototype,"svg",2);T([S({reflect:!0})],xt.prototype,"name",2);T([S()],xt.prototype,"src",2);T([S()],xt.prototype,"label",2);T([S({reflect:!0})],xt.prototype,"library",2);T([kn("label")],xt.prototype,"handleLabelChange",1);T([kn(["name","src","library"])],xt.prototype,"setIcon",1);/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const hs=Symbol.for(""),qu=e=>{if(e?.r===hs)return e?._$litStatic$},uo=(e,...t)=>({_$litStatic$:t.reduce((r,n,o)=>r+(i=>{if(i._$litStatic$!==void 0)return i._$litStatic$;throw Error(`Value passed to 'literal' function must be a 'literal' result: ${i}. Use 'unsafeStatic' to pass non-literal values, but
take care to ensure page security.`)})(n)+e[o+1],e[0]),r:hs}),ho=new Map,ju=e=>(t,...r)=>{const n=r.length;let o,i;const s=[],l=[];let a,c=0,u=!1;for(;c<n;){for(a=t[c];c<n&&(i=r[c],(o=qu(i))!==void 0);)a+=o+t[++c],u=!0;c!==n&&l.push(i),s.push(a),c++}if(c===n&&s.push(t[n]),u){const d=s.join("$$lit$$");(t=ho.get(d))===void 0&&(s.raw=s,ho.set(d,t=s)),r=l}return e(t,...r)},_r=ju(G);/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const ut=e=>e??F;var N=class extends Mt{constructor(){super(...arguments),this.formControlController=new Uu(this,{assumeInteractionOn:["click"]}),this.hasSlotController=new ns(this,"[default]","prefix","suffix"),this.localize=new ds(this),this.hasFocus=!1,this.invalid=!1,this.title="",this.variant="default",this.size="medium",this.caret=!1,this.disabled=!1,this.loading=!1,this.outline=!1,this.pill=!1,this.circle=!1,this.type="button",this.name="",this.value="",this.href="",this.rel="noreferrer noopener"}get validity(){return this.isButton()?this.button.validity:Sn}get validationMessage(){return this.isButton()?this.button.validationMessage:""}firstUpdated(){this.isButton()&&this.formControlController.updateValidity()}handleBlur(){this.hasFocus=!1,this.emit("sl-blur")}handleFocus(){this.hasFocus=!0,this.emit("sl-focus")}handleClick(){this.type==="submit"&&this.formControlController.submit(this),this.type==="reset"&&this.formControlController.reset(this)}handleInvalid(e){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(e)}isButton(){return!this.href}isLink(){return!!this.href}handleDisabledChange(){this.isButton()&&this.formControlController.setValidity(this.disabled)}click(){this.button.click()}focus(e){this.button.focus(e)}blur(){this.button.blur()}checkValidity(){return this.isButton()?this.button.checkValidity():!0}getForm(){return this.formControlController.getForm()}reportValidity(){return this.isButton()?this.button.reportValidity():!0}setCustomValidity(e){this.isButton()&&(this.button.setCustomValidity(e),this.formControlController.updateValidity())}render(){const e=this.isLink(),t=e?uo`a`:uo`button`;return _r`
<${t}
part="base"
class=${os({button:!0,"button--default":this.variant==="default","button--primary":this.variant==="primary","button--success":this.variant==="success","button--neutral":this.variant==="neutral","button--warning":this.variant==="warning","button--danger":this.variant==="danger","button--text":this.variant==="text","button--small":this.size==="small","button--medium":this.size==="medium","button--large":this.size==="large","button--caret":this.caret,"button--circle":this.circle,"button--disabled":this.disabled,"button--focused":this.hasFocus,"button--loading":this.loading,"button--standard":!this.outline,"button--outline":this.outline,"button--pill":this.pill,"button--rtl":this.localize.dir()==="rtl","button--has-label":this.hasSlotController.test("[default]"),"button--has-prefix":this.hasSlotController.test("prefix"),"button--has-suffix":this.hasSlotController.test("suffix")})}
?disabled=${ut(e?void 0:this.disabled)}
type=${ut(e?void 0:this.type)}
title=${this.title}
name=${ut(e?void 0:this.name)}
value=${ut(e?void 0:this.value)}
href=${ut(e&&!this.disabled?this.href:void 0)}
target=${ut(e?this.target:void 0)}
download=${ut(e?this.download:void 0)}
rel=${ut(e?this.rel:void 0)}
role=${ut(e?void 0:"button")}
aria-disabled=${this.disabled?"true":"false"}
tabindex=${this.disabled?"-1":"0"}
@blur=${this.handleBlur}
@focus=${this.handleFocus}
@invalid=${this.isButton()?this.handleInvalid:null}
@click=${this.handleClick}
>
<slot name="prefix" part="prefix" class="button__prefix"></slot>
<slot part="label" class="button__label"></slot>
<slot name="suffix" part="suffix" class="button__suffix"></slot>
${this.caret?_r` <sl-icon part="caret" class="button__caret" library="system" name="caret"></sl-icon> `:""}
${this.loading?_r`<sl-spinner part="spinner"></sl-spinner>`:""}
</${t}>
`}};N.styles=[sr,Tu];N.dependencies={"sl-icon":xt,"sl-spinner":us};T([Zs(".button")],N.prototype,"button",2);T([Zr()],N.prototype,"hasFocus",2);T([Zr()],N.prototype,"invalid",2);T([S()],N.prototype,"title",2);T([S({reflect:!0})],N.prototype,"variant",2);T([S({reflect:!0})],N.prototype,"size",2);T([S({type:Boolean,reflect:!0})],N.prototype,"caret",2);T([S({type:Boolean,reflect:!0})],N.prototype,"disabled",2);T([S({type:Boolean,reflect:!0})],N.prototype,"loading",2);T([S({type:Boolean,reflect:!0})],N.prototype,"outline",2);T([S({type:Boolean,reflect:!0})],N.prototype,"pill",2);T([S({type:Boolean,reflect:!0})],N.prototype,"circle",2);T([S()],N.prototype,"type",2);T([S()],N.prototype,"name",2);T([S()],N.prototype,"value",2);T([S()],N.prototype,"href",2);T([S()],N.prototype,"target",2);T([S()],N.prototype,"rel",2);T([S()],N.prototype,"download",2);T([S()],N.prototype,"form",2);T([S({attribute:"formaction"})],N.prototype,"formAction",2);T([S({attribute:"formenctype"})],N.prototype,"formEnctype",2);T([S({attribute:"formmethod"})],N.prototype,"formMethod",2);T([S({attribute:"formnovalidate",type:Boolean})],N.prototype,"formNoValidate",2);T([S({attribute:"formtarget"})],N.prototype,"formTarget",2);T([kn("disabled",{waitUntilFirstUpdate:!0})],N.prototype,"handleDisabledChange",1);N.define("sl-button");const fs=ct`
@media(min-width: 1000px) {
sl-card {
max-width: 70vw;
}
}
main {
margin-top: 70px;
padding: 12px;
}
.ProseMirror {
position: relative;
word-wrap: break-word;
white-space: pre-wrap;
-webkit-font-variant-ligatures: none;
font-variant-ligatures: none;
padding: 1rem;
line-height: 1.2;
outline: none;
font-family: var(
--markdown-editor-typography-font-family,
var(--mdc-typography-font-family, Montserrat, sans-serif)
);
font-size: var(
--markdown-editor-typography-font-size,
var(--mdc-typography-subtitle1-font-size, 1rem)
);
font-weight: var(
--markdown-editor-typography-font-weight,
var(--mdc-typography-subtitle1-font-weight, 400)
);
letter-spacing: var(
--markdown-editor-typography-letter-spacing,
var(--mdc-typography-subtitle1-letter-spacing, 0.009375em)
);
}
.ProseMirror pre {
white-space: pre-wrap;
}
.ProseMirror li {
position: relative;
}
.ProseMirror p:first-child,
.ProseMirror h1:first-child,
.ProseMirror h2:first-child,
.ProseMirror h3:first-child,
.ProseMirror h4:first-child,
.ProseMirror h5:first-child,
.ProseMirror h6:first-child {
margin-top: 10px;
}
.ProseMirror a {
color: var(--markdown-editor-typography-anchor-color, -webkit-link);
text-decoration: var(--markdown-editor-typography-anchor-text-decoration);
}
.ProseMirror p {
margin-bottom: 1em;
}
.ProseMirror-hideselection {
caret-color: transparent;
}
.ProseMirror-hideselection *::selection,
.ProseMirror-hideselection *::-moz-selection {
background: transparent;
}
.ProseMirror-selectednode {
outline: 2px solid #8cf;
}
/* Make sure li selections wrap around markers */
li.ProseMirror-selectednode {
outline: none;
}
li.ProseMirror-selectednode:after {
content: '';
position: absolute;
left: -32px;
right: -2px;
top: -2px;
bottom: -2px;
border: 2px solid #8cf;
pointer-events: none;
}
.ProseMirror-textblock-dropdown {
min-width: 3em;
}
.ProseMirror-menu {
margin: 0 -4px;
line-height: 1;
}
.ProseMirror-tooltip .ProseMirror-menu {
width: -webkit-fit-content;
width: fit-content;
white-space: pre;
}
.ProseMirror-menuitem {
margin: 0.25rem 0.25rem 0.25rem 0;
display: flex;
justify-content: center;
align-items: center;
border-radius: 4px;
overflow: hidden;
}
.ProseMirror-menuitem:hover {
background-color: #f5f5f5;
}
.ProseMirror-menuseparator {
margin: 0 8px;
}
.ProseMirror-menu-dropdown,
.ProseMirror-menu-dropdown-menu {
font-size: 90%;
white-space: nowrap;
}
.ProseMirror-menu-dropdown {
vertical-align: 1px;
cursor: pointer;
position: relative;
padding-right: 15px;
}
.ProseMirror-menu-dropdown-wrap {
padding: 1px 0 1px 4px;
display: inline-block;
position: relative;
}
.ProseMirror-menu-dropdown:after {
content: '';
border-left: 4px solid transparent;
border-right: 4px solid transparent;
border-top: 4px solid currentColor;
opacity: 0.6;
position: absolute;
right: 4px;
top: calc(50% - 2px);
}
.ProseMirror-menu-dropdown-menu,
.ProseMirror-menu-submenu {
position: absolute;
background: white;
color: #666;
border: 1px solid #aaa;
padding: 2px;
}
.ProseMirror-menu-dropdown-menu {
z-index: 1;
min-width: 6em;
}
.ProseMirror-menu-dropdown-item {
cursor: pointer;
}
.ProseMirror-menu-dropdown-item:hover {
background: #f2f2f2;
}
.ProseMirror-menu-dropdown-item > div {
padding: 0.375rem 0.5rem;
}
.ProseMirror-menu-submenu-wrap {
position: relative;
margin-right: -4px;
}
.ProseMirror-menu-submenu-label:after {
content: '';
border-top: 4px solid transparent;
border-bottom: 4px solid transparent;
border-left: 4px solid currentColor;
opacity: 0.6;
position: absolute;
right: 4px;
top: calc(50% - 4px);
}
.ProseMirror-menu-submenu {
display: none;
min-width: 4em;
left: 100%;
top: -3px;
}
.ProseMirror-menu-active {
background: #eee;
border-radius: 4px;
color: black;
}
.ProseMirror-menu-submenu-wrap:hover .ProseMirror-menu-submenu,
.ProseMirror-menu-submenu-wrap-active .ProseMirror-menu-submenu {
display: block;
}
.ProseMirror-menubar {
display: flex;
flex-wrap: wrap;
position: relative;
background: white;
min-height: 1em;
overflow: visible;
z-index: 2;
top: 0;
left: 0;
right: 0;
color: #666;
padding: 1px 6px;
border-top-left-radius: inherit;
border-top-right-radius: inherit;
border-bottom: 1px solid
var(--markdown-editor-outline-idle-border-color, rgba(0, 0, 0, 0.38));
box-sizing: border-box;
-moz-box-sizing: border-box;
}
.ProseMirror-icon {
display: inline-block;
line-height: 0.8;
vertical-align: -2px;
/* Compensate for padding */
padding: 2px 8px;
cursor: pointer;
}
.ProseMirror-menu-disabled {
color: rgba(0,0,0,0.37);
background-color: rgba(0,0,0,0.12);
cursor: not-allowed;
}
.ProseMirror-menu-disabled.ProseMirror-icon {
cursor: not-allowed;
}
.ProseMirror-icon svg {
fill: currentColor;
height: 1em;
}
.ProseMirror-icon span {
vertical-align: text-top;
}
.ProseMirror-gapcursor {
display: none;
pointer-events: none;
position: absolute;
}
.ProseMirror-gapcursor:after {
content: '';
display: block;
position: absolute;
top: -2px;
width: 20px;
border-top: 1px solid black;
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
}
@keyframes ProseMirror-cursor-blink {
to {
visibility: hidden;
}
}
.ProseMirror-focused .ProseMirror-gapcursor {
display: block;
}
/* Add space around the hr to make clicking it easier */
.ProseMirror-example-setup-style hr {
padding: 2px 10px;
border: none;
margin: 1em 0;
}
.ProseMirror-example-setup-style hr:after {
content: '';
display: block;
height: 1px;
background-color: silver;
line-height: 2px;
}
.ProseMirror ul,
.ProseMirror ol {
padding-left: 30px;
}
.ProseMirror blockquote {
padding-left: 1em;
border-left: 3px solid #eee;
margin-left: 0;
margin-right: 0;
}
.ProseMirror-example-setup-style img {
cursor: default;
}
.ProseMirror-invalid {
background: #ffc;
border: 1px solid #cc7;
border-radius: 4px;
padding: 5px 10px;
position: absolute;
min-width: 10em;
}
.ProseMirror h1.title.empty-node::before,
.ProseMirror h2.instructional-prompt.empty-node::before,
.ProseMirror h3.mechanical-promp.empty-node::before {
content: 'Enter title here...';
}
.ProseMirror div.passage-subtitle.empty-node:first-child::before {
content: 'Enter subtitle here...';
}
.ProseMirror div.passage-author.empty-node:first-child::before,
.ProseMirror div.passage-cast-title.empty-node:first-child::before,
.ProseMirror div.passage-act-title.empty-node:first-child::before,
.ProseMirror div.passage-scene-title.empty-node:first-child::before,
.ProseMirror div.passage-verse.empty-node:first-child::before,
.ProseMirror div.passage-footnotes.empty-node:first-child::before,
.ProseMirror div.paragraph.empty-node:first-child::before {
content: 'Enter text here...';
}
div[contenteditable]:focus h1.title.empty-node::before,
div[contenteditable]:focus h2.instructional-prompt.empty-node::before,
div[contenteditable]:focus h3.mechanical-promp.empty-node::before,
div[contenteditable]:focus
div.passage-subtitle.empty-node:first-child::before,
div[contenteditable]:focus div.passage-author.empty-node:first-child::before,
div[contenteditable]:focus
div.passage-cast-title.empty-node:first-child::before,
div[contenteditable]:focus
div.passage-act-title.empty-node:first-child::before,
div[contenteditable]:focus
div.passage-scene-title.empty-node:first-child::before,
div[contenteditable]:focus div.passage-verse.empty-node:first-child::before,
div[contenteditable]:focus
div.passage-footnotes.empty-node:first-child::before,
div[contenteditable]:focus div.paragraph.empty-node:first-child::before {
content: '';
}
.ProseMirror .empty-node::before {
position: absolute;
color: #aaa;
cursor: text;
font-style: italic;
}
#editor, .editor {
background: white;
color: black;
background-clip: padding-box;
padding: 5px 0;
}
#editor[disabled] .ProseMirror-menubar {
display: none!important;
}
drop-down-editor rich-text .inline-component-button,
expand-collapse rich-text .inline-component-button,
flip-reveal rich-text .inline-component-button,
hint-list rich-text .inline-component-button,
option-list rich-text .inline-component-button,
plankton-passage rich-text .inline-component-button {
pointer-events: none;
color: lightgray;
}
#ProseMirror-icon-collection path {
fill-rule: evenodd;
}
#welcomeBar {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
#welcomeCard,
#infoCard {
padding: 18px;
padding-top: 0px;
}
sl-card::part(footer) {
display: flex;
justify-content: flex-end;
}
@media(min-width: 750px) {
sl-card {
width: 70vw;
}
}
@media (horizontal-viewport-segments: 2) {
#welcomeBar {
flex-direction: row;
align-items: flex-start;
justify-content: space-between;
}
@media (horizontal-viewport-segments: 2) {
#welcomeBar {
flex-direction: row;
align-items: flex-start;
justify-content: space-between;
}
}
.boring {
background: grey;
}
.plus {
position: absolute;
padding: 8px;
background-color: #4CAF50;
color: red;
border: none;
cursor: pointer;
}
.plus:hover {
background-color: #45a049;
}
.ProseMirror-textblock-dropdown {
min-width: 3em;
}
}`;var Fu=Object.defineProperty,Wu=Object.getOwnPropertyDescriptor,Pn=(e,t,r,n)=>{for(var o=n>1?void 0:n?Wu(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&Fu(t,r,o),o};let ie=class extends gt{constructor(){super(...arguments),this.notes=[],this.relayName="",this.note=""}getUserLang(){return navigator.language||"en"}async firstUpdated(){console.log("Here are some recent notes from the neighborhood")}async connectedCallback(){super.connectedCallback(),await Promise.all([this.fetchNotes()])}async fetchNotes(){const e=await tr.connect("wss://notes.miguelalmodo.com");console.log(`connected to ${e.url}`),this.relayName=e.url;const t=e.subscribe([{kinds:[30023],limit:5}],{onevent:async r=>{console.log("Event received:",r),this.notes=[...this.notes,{content:r.content,date:new Date(r.created_at*1e3).toLocaleDateString()}],this.requestUpdate(),console.log(e)},oneose:()=>{t.close(),this.requestUpdate()}})}async displayLongNotes(){}share(){navigator.share&&navigator.share({title:"Nostr Micro Client",text:"Share this with your homie!",url:"https://miguelalmodo.com/"})}render(){return G`
<app-header ?enableBack="${!0}"></app-header>
<main> <div id="welcomeBar">
<sl-card id="WelcomeCard">
<section>
<header class="main-section-header">
<h2 class="main-section-h2">Recent Notes from ${this.relayName}</h2>
</header>
<table class="comment-wall">
${this.notes.map(e=>{const t=e.content.match(/https?:\/\/[^\s]+/),r=e.content.replace(t?.[0]||"","").trim(),n=/(?:https?:\/\/(?:www\.)?youtube\.com\/watch\?v=|https?:\/\/youtu\.be\/)([a-zA-Z0-9_-]{11})/,o=t?.[0].match(n),i=o?o[1]:null,s=i?`https://img.youtube.com/vi/${i}/maxresdefault.jpg`:null,l=/(https?:\/\/[^\s]+\.(?:jpg|jpeg|png|gif))/i,a=t?.find(c=>l.test(c));return G`
<tr>
<td><h3>${e.date}</h3></td>
<td>
<p>${r}</p>
${s?G`<img src="${s}" alt="YouTube thumbnail" style="max-width: 30%; height: 30%;">`:a?G`<img src="${a}" alt="Note image" style="max-width: 30%; height: 30%;">`:""}
</td>
</tr>
`})}
</table>
</section></main>
</sl-card>
`}};ie.styles=[fs,ct`
.comment-wall .main-section-header {
margin-bottom: 3px;
}
.comment-wall .main-section-h2 {
margin-bottom: 0;
}
#comment-counter {
margin-top: 0;
margin-left: 15px;
margin-bottom: 3px;
}
.comment-wall table {
margin: auto;
margin-bottom: 5px;
color: black;
}
.comment-wall th {
width: 158px;
padding: 3px;
vertical-align: top;
}
.comment-wall td {
vertical-align: top;
width: 269px;
padding: 3px;
}
.comment-wall figcaption,
.comment-wall figure {
margin: 0;
}
.comment-wall figcaption {
margin-bottom: 1em;
}
.comment-wall figure {
margin-bottom: 49.33px;
}
.comment-wall h3 {
font-size: 10pt;
margin: 0;
margin-bottom: 3em;
}
.comment-wall p {
font-weight: normal;
text-align: center;
margin: 0;
}
#add-comment {
text-align: right;
margin-right: 10px;
margin-bottom: 5px;
}
`];Pn([S({type:Array})],ie.prototype,"notes",2);Pn([S({type:String})],ie.prototype,"relayName",2);ie=Pn([qe("note-wall")],ie);const Ku=Object.freeze(Object.defineProperty({__proto__:null,get NoteWall(){return ie}},Symbol.toStringTag,{value:"Module"})),Zu="modulepreload",Gu=function(e){return"/"+e},fo={},Te=function(t,r,n){let o=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),l=s?.nonce||s?.getAttribute("nonce");o=Promise.allSettled(r.map(a=>{if(a=Gu(a),a in fo)return;fo[a]=!0;const c=a.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${a}"]${u}`))return;const d=document.createElement("link");if(d.rel=c?"stylesheet":Zu,c||(d.as="script"),d.crossOrigin="",d.href=a,l&&d.setAttribute("nonce",l),document.head.appendChild(d),c)return new Promise((m,g)=>{d.addEventListener("load",m),d.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${a}`)))})}))}function i(s){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=s,window.dispatchEvent(l),!l.defaultPrevented)throw s}return o.then(s=>{for(const l of s||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},Cn=Symbol.for("app-tools::log::1.x");globalThis[Cn]={setDebug:Ju,debug:"window"in globalThis?new URL(window.location.href).searchParams.has("app-tools-debug"):!1};function Ju(e){globalThis[Cn].debug=!!e}function Yu(e,t){globalThis[Cn].debug&&(console.groupCollapsed(`[app-tools] ${e}`),t&&console.log(t),console.groupEnd())}function Xu(e){return(t,r)=>{Yu(`${e}: ${t}`,r)}}const Pt=Xu("router");class Qu extends Event{constructor(t){super("route-changed"),this.context=t}}class th extends EventTarget{context={params:{},query:{},title:"",url:new URL(window.location.href)};constructor(t){super(),this.config=t,this.routes=t.routes.map(r=>({...r,urlPattern:new URLPattern({pathname:r.path,baseURL:window.location.href,search:"*",hash:"*"})})),Pt("Initialized routes",this.routes),queueMicrotask(()=>{this.navigate(new URL(window.location.href),{replace:!0})}),window.addEventListener("popstate",this._onPopState),window.addEventListener("click",this._onAnchorClick)}uninstall(){window.removeEventListener("popstate",this._onPopState),window.removeEventListener("click",this._onAnchorClick)}get url(){return new URL(window.location.href)}get fallback(){return new URL(this.config?.fallback||this.baseUrl.href.substring(window.location.origin.length),this.baseUrl)}get baseUrl(){return new URL("./",document.baseURI)}render(){return Pt(`Rendering route ${this.context.url.pathname}${this.context.url.search}${this.context.url.hash}`,{context:this.context,route:this.route}),this.route?.render?.(this.context)}_matchRoute(t){for(const r of this.routes){const n=r.urlPattern.exec(t);if(n){const{title:o}=r,i=Object.fromEntries(new URLSearchParams(t.search)),s=n?.pathname?.groups??{};return this.context={url:t,title:typeof o=="function"?o({params:s,query:i,url:t}):o,params:s,query:i},r}}return Pt(`No route matched for ${t.pathname}${t.search}${t.hash}`,t),null}_notifyUrlChanged(){this.dispatchEvent(new Qu(this.context))}_onPopState=()=>{this.navigate(new URL(window.location.href),{backNav:!0})};_onAnchorClick=t=>{if(t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey)return;const r=t.composedPath().find(i=>i.tagName==="A");if(!r||!r.href)return;const n=new URL(r.href);if(this.url.href===n.href||n.host!==window.location.host||r.hasAttribute("download")||r.href.includes("mailto:"))return;const o=r.getAttribute("target");o&&o!==""&&o!=="_self"||(t.preventDefault(),this.navigate(n))};_collectPlugins(t){return[...this.config?.plugins??[],...t?.plugins??[]]}async navigate(t,r={}){typeof t=="string"&&(t=new URL(t,this.baseUrl));let n=this._matchRoute(t)||this._matchRoute(this.fallback);Pt(`Navigating to ${t.pathname}${t.search}${t.hash}`,{context:this.context,route:this.route});let o=this._collectPlugins(n);for(const i of o)try{const s=await i?.shouldNavigate?.(this.context);s&&(await s.condition()||(t=new URL(s.redirect,this.baseUrl),n=this._matchRoute(t)||this._matchRoute(this.fallback),o=this._collectPlugins(n),Pt("Redirecting",{context:this.context,route:this.route})))}catch(s){throw Pt(`Plugin "${i.name}" error on shouldNavigate hook`,s),s}if(this.route=n,!this.route)throw new Error(`[ROUTER] No route or fallback matched for url ${t}`);for(const i of o)try{await i?.beforeNavigation?.(this.context)}catch(s){throw Pt(`Plugin "${i.name}" error on beforeNavigation hook`,s),s}r?.replace?window.history.replaceState(null,"",`${t.pathname}${t.search}${t.hash}`):r.backNav||window.history.pushState(null,"",`${t.pathname}${t.search}${t.hash}`),document.title=this.context.title,this._notifyUrlChanged();for(const i of o)try{await i?.afterNavigation?.(this.context)}catch(s){throw Pt(`Plugin "${i.name}" error on afterNavigation hook`,s),s}}}function $r(e){return{name:"lazy",beforeNavigation:()=>{e()}}}globalThis.URLPattern||await Te(()=>import("./index-CBloBB_n.js"),[]);const eh="/",po=new th({routes:[{path:Lt(),title:"Home",render:()=>G`<app-home></app-home>`},{path:Lt("about"),title:"About",plugins:[$r(()=>Te(()=>import("./app-about-BGKiJfUr.js"),[]))],render:()=>G`<app-about></app-about>`},{path:Lt("note-wall"),title:"Note Wall",plugins:[$r(()=>Te(()=>Promise.resolve().then(()=>Ku),void 0))],render:()=>G`<note-wall></note-wall>`},{path:Lt("write"),title:"Write",plugins:[$r(()=>Te(()=>import("./app-write-DLE2Mxxa.js"),[]))],render:()=>G`<app-write><app-write>`}]});function Lt(e){var t=eh;return e&&(t=t+e),t}var rh=Object.defineProperty,nh=Object.getOwnPropertyDescriptor,Wt=(e,t,r,n)=>{for(var o=n>1?void 0:n?nh(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&rh(t,r,o),o};let mt=class extends gt{constructor(){super(...arguments),this.message="Welcome to my demo!",this.nostrAddy="",this.bio="",this.profilePic="",this.isSignedIn=!1,this.publicKey=""}async firstUpdated(){console.log("Welcome to my home page")}connectedCallback(){super.connectedCallback(),this.addEventListener("user-state-changed",e=>{const t=e.detail;this.nostrAddy=t.nostrAddy,this.bio=t.bio,this.profilePic=t.profilePic,this.isSignedIn=t.isSignedIn})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("profile-updated",this.updateProfileFromEvent.bind(this)),window.removeEventListener("user-signed-out",this.handlesSignOut.bind(this))}updateProfileFromEvent(e){console.log("Profile updated event received:",e.detail);const t=e.detail;this.nostrAddy=t.nostrAddy,this.bio=t.bio,this.profilePic=t.profilePic,this.isSignedIn=!0,this.requestUpdate()}handlesSignOut(){this.profilePic="",this.bio="",this.nostrAddy="Guest",this.isSignedIn=!1,this.requestUpdate()}async fetchAndDisplayProfile(e){this.nostrAddy=e,this.bio="Loading profile info...",this.profilePic="/assets/img/loading_pfp.png";try{const r=(await tr.connect("wss://notes.miguelalmodo.com")).subscribe([{kinds:[0],authors:[e]}],{onevent:n=>{const o=JSON.parse(n.content);this.nostrAddy=o.nip05||"No address available",this.bio=o.about||"No bio available",this.profilePic=o.picture||"/assets/img/default_pfp.png",this.requestUpdate()},oneose:()=>r.close()})}catch(t){console.error("Error fetching profile:",t),this.displayGuestView()}}displayGuestView(){this.nostrAddy="",this.bio="Welcome, guest! Please sign in with a browser extension to view your profile.",this.profilePic="/assets/img/default_pfp.png",this.isSignedIn=!1}share(){navigator.share&&navigator.share({title:"A MiggyMofongo Project",text:"This is a personal progressive social web app",url:"https://miguelalmodo.com/dist2"})}render(){return G`
<app-header></app-header>
<main>
<div id="welcomeBar">
<sl-card id="welcomeCard">
<div slot="header">
<h2>Welcome to ${this.nostrAddy||"Guest"}'s Profile</h2>
</div>
<p>
You can upgrade your website into
a micro blog client with a social protocol to do things
like browse a feed, compose a note, or post to your network.
</p>
<div class="profile-picture-container">
<img class="profile-pic" src="${this.profilePic||"/assets/img/default_pfp.png"}" alt="Profile Picture" width="200px" height="200px">
<p class="personal-msg"><b>${this.bio||"Welcome, guest! Please sign in to view your profile."}</b></p>
</div>
<div class="nav-button-container">
<sl-button href="${Lt("about")}" variant="primary">About this Web App</sl-button>
<sl-button href="${Lt("note-wall")}" variant="primary">Feed</sl-button>
<sl-button href="${Lt("write")}" variant="primary">Compose a Note</sl-button>
</div>
${"share"in navigator?G`<sl-button slot="footer" variant="default" @click="${this.share}">
<sl-icon slot="prefix" name="share"></sl-icon>
Share this personal website with a friend!
</sl-button>`:null}
</sl-card>
</div>
</main>
`}};mt.styles=[fs,ct`
@media (horizontal-viewport-segments: 2) {
#welcomeBar {
flex-direction: row;
align-items: flex-start;
justify-content: space-between;
}
#welcomeCard {
margin-right: 64px;
}
}
/*
========================================
Profile Picture Container
========================================
*/
.profile-picture-container {
display: grid;
grid-template-columns: 400px 200px;
grid-template-rows: 250px;
grid-column-gap: 15px;
margin-bottom: 12px;
}
.profile-picture-container p {
margin: 0;
}
.profile-pic {
grid-area: 1/1;
margin-top: 25px;
margin-left: 100px;
margin-bottom: 10px;
border-radius: 50%;
}
.personal-msg {
grid-area: 1/2;
align-content: center;
align-items: center;
}
.nav-button-container {
justify-self: center;
align-self: end;
}
`];Wt([S()],mt.prototype,"message",2);Wt([S({type:String})],mt.prototype,"nostrAddy",2);Wt([S({type:String})],mt.prototype,"bio",2);Wt([S({type:String})],mt.prototype,"profilePic",2);Wt([S({type:Boolean})],mt.prototype,"isSignedIn",2);Wt([S({type:String})],mt.prototype,"publicKey",2);mt=Wt([qe("app-home")],mt);var oh=Object.defineProperty,ih=Object.getOwnPropertyDescriptor,Rt=(e,t,r,n)=>{for(var o=n>1?void 0:n?ih(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&oh(t,r,o),o};let lt=class extends gt{constructor(){super(...arguments),this.title="fostr",this.enableBack=!1,this.nostrAddy="",this.bio="",this.profilePic="",this.isSignedIn=!1,this.publicKey=""}connectedCallback(){super.connectedCallback();const e=localStorage.getItem("pubkey");e?(this.isSignedIn=!0,this.fetchProfileMetadata(e)):this.displayGuestView()}displayGuestView(){this.nostrAddy="",this.bio="Welcome, guest! Please sign in with a browser extension to view your profile.",this.profilePic="/public/assets/img/default_pfp.png",this.isSignedIn=!1,this.dispatchUserStateChanged()}async fetchProfileMetadata(e){try{const r=(await tr.connect("wss://notes.miguelalmodo.com")).subscribe([{kinds:[0],authors:[e]}],{onevent:n=>{const o=JSON.parse(n.content);this.profilePic=o.picture||"/assets/img/default_pfp.png",this.nostrAddy=o.nip05||"no addy available",this.bio=o.about||"bio not available",this.dispatchUserStateChanged()},oneose:()=>r.close()})}catch(t){console.error("Failed to fetch profile metadata:",t),this.displayGuestView()}}async signInWithNostr(){if(window.nostr)try{const e=await window.nostr.getPublicKey();this.isSignedIn=!0,localStorage.setItem("pubkey",e),await this.fetchProfileMetadata(e)}catch(e){console.error("Failed to sign in:",e),this.isSignedIn=!1}else alert("Nostr extension not detected. Please install a Nostr extension.")}signOut(){localStorage.removeItem("pubkey"),this.displayGuestView()}dispatchUserStateChanged(){this.dispatchEvent(new CustomEvent("user-state-changed",{detail:{isSignedIn:this.isSignedIn,nostrAddy:this.nostrAddy,bio:this.bio,profilePic:this.profilePic},bubbles:!0,composed:!0}))}render(){return G`
<header>
<div id="back-button-block">
${this.enableBack?G`<sl-button size="small" href="${Lt()}">
Back
</sl-button>`:null}
<h1>${this.title}</h1>
</div>
<sl-button variant="primary" @click="${this.isSignedIn?this.signOut:this.signInWithNostr}">
${this.isSignedIn?"Sign out":"Sign in"}
</sl-button>
</header>
`}};lt.styles=ct`
header {
display: flex;
justify-content: space-between;
align-items: center;
background: var(--app-color-primary);
color: white;
padding: 12px;
padding-top: 4px;
position: fixed;
left: env(titlebar-area-x, 0);
top: env(titlebar-area-y, 0);
height: env(titlebar-area-height, 30px);
width: env(titlebar-area-width, 100%);
-webkit-app-region: drag;
}
header h1 {
margin-top: 0;
margin-bottom: 0;
font-size: 12px;
font-weight: bold;
}
nav a {
margin-left: 10px;
}
#back-button-block {
display: flex;
justify-content: space-between;
align-items: center;
gap: 8px;
}
@media(prefers-color-scheme: light) {
header {
color: black;
}
nav a {
color: initial;
}
}
`;Rt([S({type:String})],lt.prototype,"title",2);Rt([S({type:Boolean})],lt.prototype,"enableBack",2);Rt([S({type:String})],lt.prototype,"nostrAddy",2);Rt([S({type:String})],lt.prototype,"bio",2);Rt([S({type:String})],lt.prototype,"profilePic",2);Rt([S({type:Boolean})],lt.prototype,"isSignedIn",2);Rt([S({type:String})],lt.prototype,"publicKey",2);lt=Rt([qe("app-header")],lt);var sh=Object.defineProperty,ah=Object.getOwnPropertyDescriptor,lh=(e,t,r,n)=>{for(var o=n>1?void 0:n?ah(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&sh(t,r,o),o};let Dr=class extends gt{firstUpdated(){po.addEventListener("route-changed",()=>{"startViewTransition"in document?document.startViewTransition(()=>this.requestUpdate()):this.requestUpdate()})}render(){return po.render()}};Dr.styles=ct`
main {
padding-left: 16px;
padding-right: 16px;
padding-bottom: 16px;
}
`;Dr=lh([qe("app-index")],Dr);export{Zs as e,ct as i,S as n,gt as r,fs as s,qe as t,G as x};
//# sourceMappingURL=index-COc6jZBc.js.map