nostr-components 0.2.7 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +115 -186
- package/dist/assets/{base-styles-BSEzBDsk.js → base-styles-Dmuzg8I4.js} +2 -2
- package/dist/assets/{base-styles-BSEzBDsk.js.map → base-styles-Dmuzg8I4.js.map} +1 -1
- package/dist/assets/{copy-delegation-B7y2q5Kn.js → copy-delegation-xzt-t_do.js} +2 -2
- package/dist/assets/{copy-delegation-B7y2q5Kn.js.map → copy-delegation-xzt-t_do.js.map} +1 -1
- package/dist/assets/dialog-component-Da1ZIYh9.js.map +1 -1
- package/dist/assets/{dialog-likers-BqDn2P_3.js → dialog-likers-B15m_NxI.js} +5 -5
- package/dist/assets/dialog-likers-B15m_NxI.js.map +1 -0
- package/dist/assets/index.esm-ByUtE_cm.js +2159 -0
- package/dist/assets/index.esm-ByUtE_cm.js.map +1 -0
- package/dist/assets/nip05-utils-BNBHUmkr.js.map +1 -1
- package/dist/assets/nostr-login-service-D2FmscPI.js +2 -0
- package/dist/assets/nostr-login-service-D2FmscPI.js.map +1 -0
- package/dist/assets/nostr-service-CA0Qx4nJ.js +266 -0
- package/dist/assets/nostr-service-CA0Qx4nJ.js.map +1 -0
- package/dist/assets/{nostr-user-component-Cbs97dlK.js → nostr-user-component-r-MUbTL6.js} +2 -2
- package/dist/assets/{nostr-user-component-Cbs97dlK.js.map → nostr-user-component-r-MUbTL6.js.map} +1 -1
- package/dist/assets/{pure-DPo-pzxM.js → pure-DOoUcNQv.js} +2 -2
- package/dist/assets/pure-DOoUcNQv.js.map +1 -0
- package/dist/assets/theme-BN1Bvweb.js.map +1 -1
- package/dist/assets/{user-resolver-CMmbtY9Y.js → user-resolver-ArI0680e.js} +2 -2
- package/dist/assets/{user-resolver-CMmbtY9Y.js.map → user-resolver-ArI0680e.js.map} +1 -1
- package/dist/assets/utils--bxLbhGF.js.map +1 -1
- package/dist/assets/zap-utils-QRxLBOst.js +2 -0
- package/dist/assets/zap-utils-QRxLBOst.js.map +1 -0
- package/dist/components/nostr-comment.es.js +26 -26
- package/dist/components/nostr-comment.es.js.map +1 -1
- package/dist/components/nostr-dm.es.js +2 -2
- package/dist/components/nostr-dm.es.js.map +1 -1
- package/dist/components/nostr-follow-button.es.js +6 -7
- package/dist/components/nostr-follow-button.es.js.map +1 -1
- package/dist/components/nostr-like.es.js +16 -16
- package/dist/components/nostr-like.es.js.map +1 -1
- package/dist/components/nostr-live-chat.es.js +3 -3
- package/dist/components/nostr-live-chat.es.js.map +1 -1
- package/dist/components/nostr-post.es.js +19 -19
- package/dist/components/nostr-post.es.js.map +1 -1
- package/dist/components/nostr-profile-badge.es.js +2 -2
- package/dist/components/nostr-profile-badge.es.js.map +1 -1
- package/dist/components/nostr-profile.es.js +5 -5
- package/dist/components/nostr-profile.es.js.map +1 -1
- package/dist/components/nostr-zap.es.js +24 -24
- package/dist/components/nostr-zap.es.js.map +1 -1
- package/dist/nostr-components.es.js +1 -1
- package/dist/nostr-components.es.js.map +1 -1
- package/dist/nostr-components.umd.js +2669 -301
- package/dist/nostr-components.umd.js.map +1 -1
- package/dist/src/common/constants.d.ts +1 -1
- package/dist/src/common/nostr-login-service.d.ts +26 -0
- package/dist/src/nostr-dm/nostr-dm.d.ts +1 -1
- package/dist/src/nostr-like/like-utils.d.ts +2 -6
- package/dist/src/nostr-live-chat/nostr-live-chat.d.ts +1 -1
- package/dist/src/nostr-zap/zap-utils.d.ts +4 -0
- package/package.json +5 -2
- package/dist/assets/dialog-likers-BqDn2P_3.js.map +0 -1
- package/dist/assets/nostr-service-CnaPxjc6.js +0 -78
- package/dist/assets/nostr-service-CnaPxjc6.js.map +0 -1
- package/dist/assets/pure-DPo-pzxM.js.map +0 -1
- package/dist/assets/zap-utils-KFUD_vTU.js +0 -2
- package/dist/assets/zap-utils-KFUD_vTU.js.map +0 -1
|
@@ -0,0 +1,2159 @@
|
|
|
1
|
+
var he=Object.defineProperty;var re=e=>{throw TypeError(e)};var ue=(e,t,n)=>t in e?he(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var w=(e,t,n)=>ue(e,typeof t!="symbol"?t+"":t,n),oe=(e,t,n)=>t.has(e)||re("Cannot "+n);var W=(e,t,n)=>(oe(e,t,"read from private field"),n?n.call(e):t.get(e)),se=(e,t,n)=>t.has(e)?re("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ie=(e,t,n,r)=>(oe(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);var define_process_env_default={},BUILD={allRenderFn:!1,cmpDidLoad:!0,cmpDidUnload:!1,cmpDidUpdate:!0,cmpDidRender:!0,cmpWillLoad:!0,cmpWillUpdate:!0,cmpWillRender:!0,connectedCallback:!0,disconnectedCallback:!0,element:!0,event:!0,hasRenderFn:!0,lifecycle:!0,hostListener:!0,hostListenerTargetWindow:!0,hostListenerTargetDocument:!0,hostListenerTargetBody:!0,hostListenerTargetParent:!1,hostListenerTarget:!0,member:!0,method:!0,mode:!0,observeAttribute:!0,prop:!0,propMutable:!0,reflect:!0,scoped:!0,shadowDom:!0,slot:!0,cssAnnotations:!0,state:!0,style:!0,formAssociated:!1,svg:!0,updatable:!0,vdomAttribute:!0,vdomXlink:!0,vdomClass:!0,vdomFunctional:!0,vdomKey:!0,vdomListener:!0,vdomRef:!0,vdomPropOrAttr:!0,vdomRender:!0,vdomStyle:!0,vdomText:!0,watchCallback:!0,taskQueue:!0,hotModuleReplacement:!1,isDebug:!1,isDev:!1,isTesting:!1,hydrateServerSide:!1,hydrateClientSide:!1,lifecycleDOMEvents:!1,lazyLoad:!1,profile:!1,slotRelocation:!0,appendChildSlotFix:!1,cloneNodeFix:!1,hydratedAttribute:!1,hydratedClass:!0,scriptDataOpts:!1,scopedSlotTextContentFix:!1,shadowDomShim:!1,slotChildNodesFix:!1,invisiblePrehydration:!0,propBoolean:!0,propNumber:!0,propString:!0,constructableCSS:!0,cmpShouldUpdate:!0,devTools:!1,shadowDelegatesFocus:!0,initializeNextTick:!1,asyncLoading:!1,asyncQueue:!1,transformTagName:!1,attachStyles:!0,experimentalSlotFixes:!1},__defProp$1=Object.defineProperty,__export$1=(e,t)=>{for(var n in t)__defProp$1(e,n,{get:t[n],enumerable:!0})},hostRefs=new WeakMap,getHostRef=e=>hostRefs.get(e),registerHost=(e,t)=>{const n={$flags$:0,$hostElement$:e,$cmpMeta$:t,$instanceValues$:new Map};return hostRefs.set(e,n)},isMemberInElement=(e,t)=>t in e,consoleError=(e,t)=>(0,console.error)(e,t),styles=new Map,modeResolutionChain=[],SLOT_FB_CSS="slot-fb{display:contents}slot-fb[hidden]{display:none}",XLINK_NS="http://www.w3.org/1999/xlink",win=typeof window<"u"?window:{},doc=win.document||{head:{}},H=win.HTMLElement||class{},plt={$flags$:0,$resourcesUrl$:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,r)=>e.addEventListener(t,n,r),rel:(e,t,n,r)=>e.removeEventListener(t,n,r),ce:(e,t)=>new CustomEvent(e,t)},supportsListenerOptions=(()=>{let e=!1;try{doc.addEventListener("e",null,Object.defineProperty({},"passive",{get(){e=!0}}))}catch{}return e})(),promiseResolve=e=>Promise.resolve(e),supportsConstructableStylesheets=(()=>{try{return new CSSStyleSheet,typeof new CSSStyleSheet().replaceSync=="function"}catch{}return!1})(),queuePending=!1,queueDomReads=[],queueDomWrites=[],queueTask=(e,t)=>n=>{e.push(n),queuePending||(queuePending=!0,4&plt.$flags$?nextTick(flush):plt.raf(flush))},consume=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(n){consoleError(n)}e.length=0},flush=()=>{consume(queueDomReads),consume(queueDomWrites),(queuePending=queueDomReads.length>0)&&plt.raf(flush)},nextTick=e=>promiseResolve().then(e),writeTask=queueTask(queueDomWrites),EMPTY_OBJ={},SVG_NS="http://www.w3.org/2000/svg",HTML_NS="http://www.w3.org/1999/xhtml",isDef=e=>e!=null,isComplexType=e=>(e=typeof e)=="object"||e==="function";function queryNonceMetaTagContent(e){var t,n,r;return(r=(n=(t=e.head)==null?void 0:t.querySelector('meta[name="csp-nonce"]'))==null?void 0:n.getAttribute("content"))!=null?r:void 0}var result_exports={};__export$1(result_exports,{err:()=>err,map:()=>map,ok:()=>ok,unwrap:()=>unwrap$1,unwrapErr:()=>unwrapErr});var ok=e=>({isOk:!0,isErr:!1,value:e}),err=e=>({isOk:!1,isErr:!0,value:e});function map(e,t){if(e.isOk){const n=t(e.value);return n instanceof Promise?n.then(r=>ok(r)):ok(n)}if(e.isErr){const n=e.value;return err(n)}throw"should never get here"}var unwrap$1=e=>{if(e.isOk)return e.value;throw e.value},unwrapErr=e=>{if(e.isErr)return e.value;throw e.value},createTime=(e,t="")=>()=>{},h=(e,t,...n)=>{let r=null,o=null,s=null,i=!1,a=!1;const l=[],c=p=>{for(let g=0;g<p.length;g++)r=p[g],Array.isArray(r)?c(r):r!=null&&typeof r!="boolean"&&((i=typeof e!="function"&&!isComplexType(r))&&(r=String(r)),i&&a?l[l.length-1].$text$+=r:l.push(i?newVNode(null,r):r),a=i)};if(c(n),t){t.key&&(o=t.key),t.name&&(s=t.name);{const p=t.className||t.class;p&&(t.class=typeof p!="object"?p:Object.keys(p).filter(g=>p[g]).join(" "))}}if(typeof e=="function")return e(t===null?{}:t,l,vdomFnUtils);const d=newVNode(e,null);return d.$attrs$=t,l.length>0&&(d.$children$=l),d.$key$=o,d.$name$=s,d},newVNode=(e,t)=>({$flags$:0,$tag$:e,$text$:t,$elm$:null,$children$:null,$attrs$:null,$key$:null,$name$:null}),Host={},isHost=e=>e&&e.$tag$===Host,vdomFnUtils={forEach:(e,t)=>e.map(convertToPublic).forEach(t),map:(e,t)=>e.map(convertToPublic).map(t).map(convertToPrivate)},convertToPublic=e=>({vattrs:e.$attrs$,vchildren:e.$children$,vkey:e.$key$,vname:e.$name$,vtag:e.$tag$,vtext:e.$text$}),convertToPrivate=e=>{if(typeof e.vtag=="function"){const n={...e.vattrs};return e.vkey&&(n.key=e.vkey),e.vname&&(n.name=e.vname),h(e.vtag,n,...e.vchildren||[])}const t=newVNode(e.vtag,e.vtext);return t.$attrs$=e.vattrs,t.$children$=e.vchildren,t.$key$=e.vkey,t.$name$=e.vname,t},computeMode=e=>modeResolutionChain.map(t=>t(e)).find(t=>!!t),parsePropertyValue=(e,t)=>e==null||isComplexType(e)?e:4&t?e!=="false"&&(e===""||!!e):2&t?parseFloat(e):1&t?String(e):e,getElement=e=>e,createEvent=(e,t,n)=>{const r=getElement(e);return{emit:o=>emitEvent(r,t,{bubbles:!0,composed:!0,cancelable:!0,detail:o})}},emitEvent=(e,t,n)=>{const r=plt.ce(t,n);return e.dispatchEvent(r),r},rootAppliedStyles=new WeakMap,registerStyle=(e,t,n)=>{let r=styles.get(e);supportsConstructableStylesheets&&n?(r=r||new CSSStyleSheet,typeof r=="string"?r=t:r.replaceSync(t)):r=t,styles.set(e,r)},addStyle=(e,t,n)=>{var r;const o=getScopeId(t,n),s=styles.get(o);if(e=e.nodeType===11?e:doc,s)if(typeof s=="string"){e=e.head||e;let i,a=rootAppliedStyles.get(e);if(a||rootAppliedStyles.set(e,a=new Set),!a.has(o)){{i=doc.createElement("style"),i.innerHTML=s;const l=(r=plt.$nonce$)!=null?r:queryNonceMetaTagContent(doc);l!=null&&i.setAttribute("nonce",l),(!(1&t.$flags$)||1&t.$flags$&&e.nodeName!=="HEAD")&&e.insertBefore(i,e.querySelector("link"))}4&t.$flags$&&(i.innerHTML+=SLOT_FB_CSS),a&&a.add(o)}}else e.adoptedStyleSheets.includes(s)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,s]);return o},attachStyles=e=>{const t=e.$cmpMeta$,n=e.$hostElement$,r=t.$flags$;createTime("attachStyles",t.$tagName$);const o=addStyle(n.shadowRoot?n.shadowRoot:n.getRootNode(),t,e.$modeName$);10&r&&2&r&&(n["s-sc"]=o,n.classList.add(o+"-h"),2&r&&n.classList.add(o+"-s"))},getScopeId=(e,t)=>"sc-"+(t&&32&e.$flags$?e.$tagName$+"-"+t:e.$tagName$),setAccessor=(e,t,n,r,o,s)=>{if(n!==r){let i=isMemberInElement(e,t),a=t.toLowerCase();if(t==="class"){const l=e.classList,c=parseClassList(n),d=parseClassList(r);l.remove(...c.filter(p=>p&&!d.includes(p))),l.add(...d.filter(p=>p&&!c.includes(p)))}else if(t==="style"){for(const l in n)r&&r[l]!=null||(l.includes("-")?e.style.removeProperty(l):e.style[l]="");for(const l in r)n&&r[l]===n[l]||(l.includes("-")?e.style.setProperty(l,r[l]):e.style[l]=r[l])}else if(t!=="key"){if(t==="ref")r&&r(e);else if(e.__lookupSetter__(t)||t[0]!=="o"||t[1]!=="n"){const l=isComplexType(r);if((i||l&&r!==null)&&!o)try{if(e.tagName.includes("-"))e[t]=r;else{const d=r??"";t==="list"?i=!1:n!=null&&e[t]==d||(e[t]=d)}}catch{}let c=!1;a!==(a=a.replace(/^xlink\:?/,""))&&(t=a,c=!0),r==null||r===!1?r===!1&&e.getAttribute(t)!==""||(c?e.removeAttributeNS(XLINK_NS,t):e.removeAttribute(t)):(!i||4&s||o)&&!l&&(r=r===!0?"":r,c?e.setAttributeNS(XLINK_NS,t,r):e.setAttribute(t,r))}else if(t=t[2]==="-"?t.slice(3):isMemberInElement(win,a)?a.slice(2):a[2]+t.slice(3),n||r){const l=t.endsWith(CAPTURE_EVENT_SUFFIX);t=t.replace(CAPTURE_EVENT_REGEX,""),n&&plt.rel(e,t,n,l),r&&plt.ael(e,t,r,l)}}}},parseClassListRegex=/\s/,parseClassList=e=>e?e.split(parseClassListRegex):[],CAPTURE_EVENT_SUFFIX="Capture",CAPTURE_EVENT_REGEX=new RegExp(CAPTURE_EVENT_SUFFIX+"$"),updateElement=(e,t,n)=>{const r=t.$elm$.nodeType===11&&t.$elm$.host?t.$elm$.host:t.$elm$,o=e&&e.$attrs$||EMPTY_OBJ,s=t.$attrs$||EMPTY_OBJ;for(const i of sortedAttrNames(Object.keys(o)))i in s||setAccessor(r,i,o[i],void 0,n,t.$flags$);for(const i of sortedAttrNames(Object.keys(s)))setAccessor(r,i,o[i],s[i],n,t.$flags$)},scopeId,contentRef,hostTagName;function sortedAttrNames(e){return e.includes("ref")?[...e.filter(t=>t!=="ref"),"ref"]:e}var useNativeShadowDom=!1,checkSlotFallbackVisibility=!1,checkSlotRelocate=!1,isSvgMode=!1,createElm=(e,t,n,r)=>{var o;const s=t.$children$[n];let i,a,l,c=0;if(useNativeShadowDom||(checkSlotRelocate=!0,s.$tag$==="slot"&&(scopeId&&r.classList.add(scopeId+"-s"),s.$flags$|=s.$children$?2:1)),s.$text$!==null)i=s.$elm$=doc.createTextNode(s.$text$);else if(1&s.$flags$)i=s.$elm$=doc.createTextNode("");else{if(isSvgMode||(isSvgMode=s.$tag$==="svg"),i=s.$elm$=doc.createElementNS(isSvgMode?SVG_NS:HTML_NS,!useNativeShadowDom&&BUILD.slotRelocation&&2&s.$flags$?"slot-fb":s.$tag$),isSvgMode&&s.$tag$==="foreignObject"&&(isSvgMode=!1),updateElement(null,s,isSvgMode),i.getRootNode().querySelector("body")&&BUILD.scoped&&isDef(scopeId)&&i["s-si"]!==scopeId&&i.classList.add(i["s-si"]=scopeId),updateElementScopeIds(i,r),s.$children$)for(c=0;c<s.$children$.length;++c)a=createElm(e,s,c,i),a&&i.appendChild(a);s.$tag$==="svg"?isSvgMode=!1:i.tagName==="foreignObject"&&(isSvgMode=!0)}return i["s-hn"]=hostTagName,3&s.$flags$&&(i["s-sr"]=!0,i["s-cr"]=contentRef,i["s-sn"]=s.$name$||"",i["s-rf"]=(o=s.$attrs$)==null?void 0:o.ref,l=e&&e.$children$&&e.$children$[n],l&&l.$tag$===s.$tag$&&e.$elm$&&putBackInOriginalLocation(e.$elm$,!1)),i},putBackInOriginalLocation=(e,t)=>{plt.$flags$|=1;const n=Array.from(e.childNodes);e["s-sr"]&&BUILD.experimentalSlotFixes;for(let r=n.length-1;r>=0;r--){const o=n[r];o["s-hn"]!==hostTagName&&o["s-ol"]&&(insertBefore(parentReferenceNode(o),o,referenceNode(o)),o["s-ol"].remove(),o["s-ol"]=void 0,o["s-sh"]=void 0,checkSlotRelocate=!0),t&&putBackInOriginalLocation(o,t)}plt.$flags$&=-2},addVnodes=(e,t,n,r,o,s)=>{let i,a=e["s-cr"]&&e["s-cr"].parentNode||e;for(a.shadowRoot&&a.tagName===hostTagName&&(a=a.shadowRoot);o<=s;++o)r[o]&&(i=createElm(null,n,o,e),i&&(r[o].$elm$=i,insertBefore(a,i,referenceNode(t))))},removeVnodes=(e,t,n)=>{for(let r=t;r<=n;++r){const o=e[r];if(o){const s=o.$elm$;nullifyVNodeRefs(o),s&&(checkSlotFallbackVisibility=!0,s["s-ol"]?s["s-ol"].remove():putBackInOriginalLocation(s,!0),s.remove())}}},updateChildren=(e,t,n,r,o=!1)=>{let s,i,a=0,l=0,c=0,d=0,p=t.length-1,g=t[0],v=t[p],x=r.length-1,b=r[0],C=r[x];for(;a<=p&&l<=x;)if(g==null)g=t[++a];else if(v==null)v=t[--p];else if(b==null)b=r[++l];else if(C==null)C=r[--x];else if(isSameVnode(g,b,o))patch(g,b,o),g=t[++a],b=r[++l];else if(isSameVnode(v,C,o))patch(v,C,o),v=t[--p],C=r[--x];else if(isSameVnode(g,C,o))g.$tag$!=="slot"&&C.$tag$!=="slot"||putBackInOriginalLocation(g.$elm$.parentNode,!1),patch(g,C,o),insertBefore(e,g.$elm$,v.$elm$.nextSibling),g=t[++a],C=r[--x];else if(isSameVnode(v,b,o))g.$tag$!=="slot"&&C.$tag$!=="slot"||putBackInOriginalLocation(v.$elm$.parentNode,!1),patch(v,b,o),insertBefore(e,v.$elm$,g.$elm$),v=t[--p],b=r[++l];else{for(c=-1,d=a;d<=p;++d)if(t[d]&&t[d].$key$!==null&&t[d].$key$===b.$key$){c=d;break}c>=0?(i=t[c],i.$tag$!==b.$tag$?s=createElm(t&&t[l],n,c,e):(patch(i,b,o),t[c]=void 0,s=i.$elm$),b=r[++l]):(s=createElm(t&&t[l],n,l,e),b=r[++l]),s&&insertBefore(parentReferenceNode(g.$elm$),s,referenceNode(g.$elm$))}a>p?addVnodes(e,r[x+1]==null?null:r[x+1].$elm$,n,r,l,x):l>x&&removeVnodes(t,a,p)},isSameVnode=(e,t,n=!1)=>e.$tag$===t.$tag$&&(e.$tag$==="slot"?(!("$nodeId$"in e)||!n||e.$elm$.nodeType===8)&&e.$name$===t.$name$:!!n||e.$key$===t.$key$),referenceNode=e=>e&&e["s-ol"]||e,parentReferenceNode=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,patch=(e,t,n=!1)=>{const r=t.$elm$=e.$elm$,o=e.$children$,s=t.$children$,i=t.$tag$,a=t.$text$;let l;a===null?(isSvgMode=i==="svg"||i!=="foreignObject"&&isSvgMode,(i!=="slot"||useNativeShadowDom)&&updateElement(e,t,isSvgMode),o!==null&&s!==null?updateChildren(r,o,t,s,n):s!==null?(e.$text$!==null&&(r.textContent=""),addVnodes(r,null,t,s,0,s.length-1)):!n&&BUILD.updatable&&o!==null&&removeVnodes(o,0,o.length-1),isSvgMode&&i==="svg"&&(isSvgMode=!1)):(l=r["s-cr"])?l.parentNode.textContent=a:e.$text$!==a&&(r.data=a)},updateFallbackSlotVisibility=e=>{const t=e.childNodes;for(const n of t)if(n.nodeType===1){if(n["s-sr"]){const r=n["s-sn"];n.hidden=!1;for(const o of t)if(o!==n){if(o["s-hn"]!==n["s-hn"]||r!==""){if(o.nodeType===1&&(r===o.getAttribute("slot")||r===o["s-sn"])||o.nodeType===3&&r===o["s-sn"]){n.hidden=!0;break}}else if(o.nodeType===1||o.nodeType===3&&o.textContent.trim()!==""){n.hidden=!0;break}}}updateFallbackSlotVisibility(n)}},relocateNodes=[],markSlotContentForRelocation=e=>{let t,n,r;for(const o of e.childNodes){if(o["s-sr"]&&(t=o["s-cr"])&&t.parentNode){n=t.parentNode.childNodes;const s=o["s-sn"];for(r=n.length-1;r>=0;r--)if(t=n[r],!t["s-cn"]&&!t["s-nr"]&&t["s-hn"]!==o["s-hn"]&&!0)if(isNodeLocatedInSlot(t,s)){let i=relocateNodes.find(a=>a.$nodeToRelocate$===t);checkSlotFallbackVisibility=!0,t["s-sn"]=t["s-sn"]||s,i?(i.$nodeToRelocate$["s-sh"]=o["s-hn"],i.$slotRefNode$=o):(t["s-sh"]=o["s-hn"],relocateNodes.push({$slotRefNode$:o,$nodeToRelocate$:t})),t["s-sr"]&&relocateNodes.map(a=>{isNodeLocatedInSlot(a.$nodeToRelocate$,t["s-sn"])&&(i=relocateNodes.find(l=>l.$nodeToRelocate$===t),i&&!a.$slotRefNode$&&(a.$slotRefNode$=i.$slotRefNode$))})}else relocateNodes.some(i=>i.$nodeToRelocate$===t)||relocateNodes.push({$nodeToRelocate$:t})}o.nodeType===1&&markSlotContentForRelocation(o)}},isNodeLocatedInSlot=(e,t)=>e.nodeType===1?e.getAttribute("slot")===null&&t===""||e.getAttribute("slot")===t:e["s-sn"]===t||t==="",nullifyVNodeRefs=e=>{e.$attrs$&&e.$attrs$.ref&&e.$attrs$.ref(null),e.$children$&&e.$children$.map(nullifyVNodeRefs)},insertBefore=(e,t,n)=>{const r=e==null?void 0:e.insertBefore(t,n);return updateElementScopeIds(t,e),r},findScopeIds=e=>{const t=[];return e&&t.push(...e["s-scs"]||[],e["s-si"],e["s-sc"],...findScopeIds(e.parentElement)),t},updateElementScopeIds=(e,t,n=!1)=>{var r;if(e&&t&&e.nodeType===1){const o=new Set(findScopeIds(t).filter(Boolean));if(o.size&&((r=e.classList)==null||r.add(...e["s-scs"]=[...o]),e["s-ol"]||n))for(const s of Array.from(e.childNodes))updateElementScopeIds(s,e,!0)}},renderVdom=(e,t,n=!1)=>{var r,o,s,i,a;const l=e.$hostElement$,c=e.$cmpMeta$,d=e.$vnode$||newVNode(null,null),p=isHost(t)?t:h(null,null,t);if(hostTagName=l.tagName,c.$attrsToReflect$&&(p.$attrs$=p.$attrs$||{},c.$attrsToReflect$.map(([g,v])=>p.$attrs$[v]=l[g])),n&&p.$attrs$)for(const g of Object.keys(p.$attrs$))l.hasAttribute(g)&&!["key","ref","style","class"].includes(g)&&(p.$attrs$[g]=l[g]);if(p.$tag$=null,p.$flags$|=4,e.$vnode$=p,p.$elm$=d.$elm$=l.shadowRoot||l,scopeId=l["s-sc"],useNativeShadowDom=!!(1&c.$flags$),contentRef=l["s-cr"],checkSlotFallbackVisibility=!1,patch(d,p,n),plt.$flags$|=1,checkSlotRelocate){markSlotContentForRelocation(p.$elm$);for(const g of relocateNodes){const v=g.$nodeToRelocate$;if(!v["s-ol"]){const x=doc.createTextNode("");x["s-nr"]=v,insertBefore(v.parentNode,v["s-ol"]=x,v)}}for(const g of relocateNodes){const v=g.$nodeToRelocate$,x=g.$slotRefNode$;if(x){const b=x.parentNode;let C=x.nextSibling;{let _=(r=v["s-ol"])==null?void 0:r.previousSibling;for(;_;){let k=(o=_["s-nr"])!=null?o:null;if(k&&k["s-sn"]===v["s-sn"]&&b===k.parentNode){for(k=k.nextSibling;k===v||k!=null&&k["s-sr"];)k=k==null?void 0:k.nextSibling;if(!k||!k["s-nr"]){C=k;break}}_=_.previousSibling}}(!C&&b!==v.parentNode||v.nextSibling!==C)&&v!==C&&(!v["s-hn"]&&v["s-ol"]&&(v["s-hn"]=v["s-ol"].parentNode.nodeName),insertBefore(b,v,C),v.nodeType===1&&(v.hidden=(s=v["s-ih"])!=null&&s)),v&&typeof x["s-rf"]=="function"&&x["s-rf"](v)}else v.nodeType===1&&(n&&(v["s-ih"]=(i=v.hidden)!=null&&i),v.hidden=!0)}}if(checkSlotFallbackVisibility&&updateFallbackSlotVisibility(p.$elm$),plt.$flags$&=-2,relocateNodes.length=0,BUILD.experimentalScopedSlotChanges&&2&c.$flags$)for(const g of p.$elm$.childNodes)g["s-hn"]===hostTagName||g["s-sh"]||(n&&g["s-ih"]==null&&(g["s-ih"]=(a=g.hidden)!=null&&a),g.hidden=!0);contentRef=void 0},attachToAncestor=(e,t)=>{},scheduleUpdate=(e,t)=>(e.$flags$|=16,attachToAncestor(e,e.$ancestorComponent$),writeTask(()=>dispatchHooks(e,t))),dispatchHooks=(e,t)=>{const n=e.$hostElement$;createTime("scheduleUpdate",e.$cmpMeta$.$tagName$);const r=n;if(!r)throw new Error(`Can't render component <${n.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let o;return o=safeCall(r,t?"componentWillLoad":"componentWillUpdate"),o=enqueue(o,()=>safeCall(r,"componentWillRender")),enqueue(o,()=>updateComponent(e,r,t))},enqueue=(e,t)=>isPromisey(e)?e.then(t).catch(n=>{console.error(n),t()}):t(),isPromisey=e=>e instanceof Promise||e&&e.then&&typeof e.then=="function",updateComponent=async(e,t,n)=>{const r=e.$hostElement$;createTime("update",e.$cmpMeta$.$tagName$),r["s-rc"],n&&attachStyles(e),createTime("render",e.$cmpMeta$.$tagName$),callRender(e,t,r,n),postUpdateComponent(e)},renderingRef=null,callRender=(e,t,n,r)=>{try{renderingRef=t,t=t.render&&t.render(),e.$flags$&=-17,e.$flags$|=2,(BUILD.hasRenderFn||BUILD.reflect)&&(BUILD.vdomRender||BUILD.reflect)&&(BUILD.hydrateServerSide||renderVdom(e,t,r))}catch(o){consoleError(o,e.$hostElement$)}return renderingRef=null,null},getRenderingRef=()=>renderingRef,postUpdateComponent=e=>{const t=e.$cmpMeta$.$tagName$,n=e.$hostElement$,r=createTime("postUpdate",t),o=n;e.$ancestorComponent$,safeCall(o,"componentDidRender"),64&e.$flags$?(safeCall(o,"componentDidUpdate"),r()):(e.$flags$|=64,safeCall(o,"componentDidLoad"),r())},forceUpdate=e=>{{const t=getHostRef(e),n=t.$hostElement$.isConnected;return n&&(18&t.$flags$)==2&&scheduleUpdate(t,!1),n}},safeCall=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(r){consoleError(r)}},getValue=(e,t)=>getHostRef(e).$instanceValues$.get(t),setValue=(e,t,n,r)=>{const o=getHostRef(e),s=e,i=o.$instanceValues$.get(t),a=o.$flags$,l=s;n=parsePropertyValue(n,r.$members$[t][0]);const c=Number.isNaN(i)&&Number.isNaN(n);if(n!==i&&!c){if(o.$instanceValues$.set(t,n),r.$watchers$&&128&a){const d=r.$watchers$[t];d&&d.map(p=>{try{l[p](n,i,t)}catch(g){consoleError(g,s)}})}if((18&a)==2){if(l.componentShouldUpdate&&l.componentShouldUpdate(n,i,t)===!1)return;scheduleUpdate(o,!1)}}},proxyComponent=(e,t,n)=>{var r,o;const s=e.prototype;if(t.$members$||t.$watchers$||e.watchers){e.watchers&&!t.$watchers$&&(t.$watchers$=e.watchers);const i=Object.entries((r=t.$members$)!=null?r:{});i.map(([a,[l]])=>{(31&l||32&l)&&Object.defineProperty(s,a,{get(){return getValue(this,a)},set(c){setValue(this,a,c,t)},configurable:!0,enumerable:!0})});{const a=new Map;s.attributeChangedCallback=function(l,c,d){plt.jmp(()=>{var p;const g=a.get(l);if(this.hasOwnProperty(g))d=this[g],delete this[g];else{if(s.hasOwnProperty(g)&&typeof this[g]=="number"&&this[g]==d)return;if(g==null){const v=getHostRef(this),x=v==null?void 0:v.$flags$;if(x&&!(8&x)&&128&x&&d!==c){const b=this,C=(p=t.$watchers$)==null?void 0:p[l];C==null||C.forEach(_=>{b[_]!=null&&b[_].call(b,d,c,l)})}return}}this[g]=(d!==null||typeof this[g]!="boolean")&&d})},e.observedAttributes=Array.from(new Set([...Object.keys((o=t.$watchers$)!=null?o:{}),...i.filter(([l,c])=>15&c[0]).map(([l,c])=>{var d;const p=c[1]||l;return a.set(p,l),512&c[0]&&((d=t.$attrsToReflect$)==null||d.push([l,p])),p})]))}}return e},initializeComponent=async(e,t,n,r)=>{let o;if(!(32&t.$flags$)){t.$flags$|=32,n.$lazyBundleId$;{o=e.constructor;const s=e.localName;customElements.whenDefined(s).then(()=>t.$flags$|=128)}if(o&&o.style){let s;typeof o.style=="string"?s=o.style:typeof o.style!="string"&&(t.$modeName$=computeMode(e),t.$modeName$&&(s=o.style[t.$modeName$]));const i=getScopeId(n,t.$modeName$);styles.has(i)||(createTime("registerStyles",n.$tagName$),registerStyle(i,s,!!(1&n.$flags$)))}}t.$ancestorComponent$,scheduleUpdate(t,!0)},fireConnectedCallback=e=>{},connectedCallback=e=>{if(!(1&plt.$flags$)){const t=getHostRef(e),n=t.$cmpMeta$;createTime("connectedCallback",n.$tagName$),1&t.$flags$?(addHostEventListeners(e,t,n.$listeners$),t!=null&&t.$lazyInstance$?fireConnectedCallback(t.$lazyInstance$):t!=null&&t.$onReadyPromise$&&t.$onReadyPromise$.then(()=>fireConnectedCallback(t.$lazyInstance$))):(t.$flags$|=1,12&n.$flags$&&setContentReference(e),n.$members$&&Object.entries(n.$members$).map(([r,[o]])=>{if(31&o&&e.hasOwnProperty(r)){const s=e[r];delete e[r],e[r]=s}}),initializeComponent(e,t,n))}},setContentReference=e=>{const t=e["s-cr"]=doc.createComment("");t["s-cn"]=!0,insertBefore(e,t,e.firstChild)},disconnectedCallback=async e=>{if(!(1&plt.$flags$)){const t=getHostRef(e);t.$rmListeners$&&(t.$rmListeners$.map(n=>n()),t.$rmListeners$=void 0)}},proxyCustomElement=(e,t)=>{const n={$flags$:t[0],$tagName$:t[1]};n.$members$=t[2],n.$listeners$=t[3],n.$watchers$=e.$watchers$,n.$attrsToReflect$=[];const r=e.prototype.connectedCallback,o=e.prototype.disconnectedCallback;return Object.assign(e.prototype,{__registerHost(){registerHost(this,n)},connectedCallback(){const s=getHostRef(this);addHostEventListeners(this,s,n.$listeners$),connectedCallback(this),r&&r.call(this)},disconnectedCallback(){disconnectedCallback(this),o&&o.call(this)},__attachShadow(){if(this.shadowRoot){if(this.shadowRoot.mode!=="open")throw new Error(`Unable to re-use existing shadow root for ${n.$tagName$}! Mode is set to ${this.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else this.attachShadow({mode:"open",delegatesFocus:!!(16&n.$flags$)})}}),e.is=n.$tagName$,proxyComponent(e,n)},Fragment=(e,t)=>t,addHostEventListeners=(e,t,n,r)=>{n&&n.map(([o,s,i])=>{const a=getHostListenerTarget(e,o),l=hostListenerProxy(t,i),c=hostListenerOpts(o);plt.ael(a,s,l,c),(t.$rmListeners$=t.$rmListeners$||[]).push(()=>plt.rel(a,s,l,c))})},hostListenerProxy=(e,t)=>n=>{try{BUILD.lazyLoad||e.$hostElement$[t](n)}catch(r){consoleError(r)}},getHostListenerTarget=(e,t)=>4&t?doc:8&t?win:16&t?doc.body:e,hostListenerOpts=e=>supportsListenerOptions?{passive:!!(1&e),capture:!!(2&e)}:!!(2&e),CURRENT_MODULE,METHOD_MODULE;(function(e){e.WELCOME="welcome",e.WELCOME_LOGIN="welcome-login",e.WELCOME_SIGNUP="welcome-signup",e.INFO="info",e.LOGIN_BUNKER_URL="login-bunker-url",e.LOGIN_READ_ONLY="login-read-only",e.CONFIRM_LOGOUT="confirm-logout",e.IMPORT_FLOW="import",e.IMPORT_OTP="import-otp",e.LOGIN="login",e.SIGNUP="signup",e.LOCAL_SIGNUP="local-signup",e.EXTENSION="extension",e.LOADING="loading",e.PREVIOUSLY_LOGGED="switch-account",e.LOGIN_OTP="otp",e.CONNECT="connect",e.CONNECTION_STRING="connection-string",e.IFRAME="iframe"})(CURRENT_MODULE||(CURRENT_MODULE={})),function(e){e.LOGIN="login",e.SIGNUP="signup",e.LOGOUT="logout",e.CONFIRM="confirm"}(METHOD_MODULE||(METHOD_MODULE={}));const appendToMap=(e,t,n)=>{const r=e.get(t);r?r.includes(n)||r.push(n):e.set(t,[n])},debounce=(e,t)=>{let n;return(...r)=>{n&&clearTimeout(n),n=setTimeout(()=>{n=0,e(...r)},t)}},isConnected=e=>!("isConnected"in e)||e.isConnected,cleanupElements=debounce(e=>{for(let t of e.keys())e.set(t,e.get(t).filter(isConnected))},2e3),stencilSubscription=()=>{if(typeof getRenderingRef!="function")return{};const e=new Map;return{dispose:()=>e.clear(),get:t=>{const n=getRenderingRef();n&&appendToMap(e,t,n)},set:t=>{const n=e.get(t);n&&e.set(t,n.filter(forceUpdate)),cleanupElements(e)},reset:()=>{e.forEach(t=>t.forEach(forceUpdate)),cleanupElements(e)}}},unwrap=e=>typeof e=="function"?e():e,createObservableMap=(e,t=(n,r)=>n!==r)=>{const n=unwrap(e);let r=new Map(Object.entries(n??{}));const o={dispose:[],get:[],set:[],reset:[]},s=()=>{var d;r=new Map(Object.entries((d=unwrap(e))!==null&&d!==void 0?d:{})),o.reset.forEach(p=>p())},i=d=>(o.get.forEach(p=>p(d)),r.get(d)),a=(d,p)=>{const g=r.get(d);t(p,g,d)&&(r.set(d,p),o.set.forEach(v=>v(d,p,g)))},l=typeof Proxy>"u"?{}:new Proxy(n,{get:(d,p)=>i(p),ownKeys:d=>Array.from(r.keys()),getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0}),has:(d,p)=>r.has(p),set:(d,p,g)=>(a(p,g),!0)}),c=(d,p)=>(o[d].push(p),()=>{removeFromArray(o[d],p)});return{state:l,get:i,set:a,on:c,onChange:(d,p)=>{const g=c("set",(x,b)=>{x===d&&p(b)}),v=c("reset",()=>p(unwrap(e)[d]));return()=>{g(),v()}},use:(...d)=>{const p=d.reduce((g,v)=>(v.set&&g.push(c("set",v.set)),v.get&&g.push(c("get",v.get)),v.reset&&g.push(c("reset",v.reset)),v.dispose&&g.push(c("dispose",v.dispose)),g),[]);return()=>p.forEach(g=>g())},dispose:()=>{o.dispose.forEach(d=>d()),s()},reset:s,forceUpdate:d=>{const p=r.get(d);o.set.forEach(g=>g(d,p,p))}}},removeFromArray=(e,t)=>{const n=e.indexOf(t);n>=0&&(e[n]=e[e.length-1],e.length--)},createStore=(e,t)=>{const n=createObservableMap(e,t);return n.use(stencilSubscription()),n},{state,onChange,reset}=createStore({screen:CURRENT_MODULE.WELCOME,prevScreen:CURRENT_MODULE.WELCOME,path:[CURRENT_MODULE.WELCOME],error:"",isLoading:!1,isLoadingExtension:!1,isOTP:!1,authUrl:"",iframeUrl:"",njumpIframe:"",nlSignin:{loginName:""},nlSignup:{signupName:"",domain:"",servers:[{name:"@nsec.app",value:"nsec.app"},{name:"@highlighter.com",value:"highlighter.com"}]},nlSigninBunkerUrl:{loginName:""},nlSigninReadOnly:{loginName:""},nlSigninOTP:{loginName:"",code:""},nlImport:null});onChange("screen",()=>{state.error="",state.nlSignin.loginName="",state.nlSignup.signupName="",state.nlSignup.domain=""});const baseCss=`/*! tailwindcss v3.4.10 | MIT License | https://tailwindcss.com*/*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;color:#6b7280;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}[multiple],[type=date],[type=datetime-local],[type=email],[type=month],[type=number],[type=password],[type=search],[type=tel],[type=text],[type=time],[type=url],[type=week],input:where(:not([type])),select,textarea{--tw-shadow:0 0 #0000;appearance:none;background-color:#fff;border-color:#6b7280;border-radius:0;border-width:1px;font-size:1rem;line-height:1.5rem;padding:.5rem .75rem}[multiple]:focus,[type=date]:focus,[type=datetime-local]:focus,[type=email]:focus,[type=month]:focus,[type=number]:focus,[type=password]:focus,[type=search]:focus,[type=tel]:focus,[type=text]:focus,[type=time]:focus,[type=url]:focus,[type=week]:focus,input:where(:not([type])):focus,select:focus,textarea:focus{--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#2563eb;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);border-color:#2563eb;box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);outline:2px solid transparent;outline-offset:2px}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-date-and-time-value{min-height:1.5em;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-year-field{padding-bottom:0;padding-top:0}select{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");background-position:right .5rem center;background-repeat:no-repeat;background-size:1.5em 1.5em;padding-right:2.5rem;print-color-adjust:exact}[multiple],[size]:where(select:not([size="1"])){background-image:none;background-position:0 0;background-repeat:unset;background-size:initial;padding-right:.75rem;print-color-adjust:unset}[type=checkbox],[type=radio]{--tw-shadow:0 0 #0000;appearance:none;background-color:#fff;background-origin:border-box;border-color:#6b7280;border-width:1px;color:#2563eb;display:inline-block;flex-shrink:0;height:1rem;padding:0;print-color-adjust:exact;user-select:none;vertical-align:middle;width:1rem}[type=checkbox]{border-radius:0}[type=radio]{border-radius:100%}[type=checkbox]:focus,[type=radio]:focus{--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:2px;--tw-ring-offset-color:#fff;--tw-ring-color:#2563eb;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);outline:2px solid transparent;outline-offset:2px}[type=checkbox]:checked,[type=radio]:checked{background-color:currentColor;background-position:50%;background-repeat:no-repeat;background-size:100% 100%;border-color:transparent}[type=checkbox]:checked{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 16 16' fill='%23fff' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.207 4.793a1 1 0 0 1 0 1.414l-5 5a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L6.5 9.086l4.293-4.293a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E")}@media (forced-colors:active){[type=checkbox]:checked{appearance:auto}}[type=radio]:checked{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 16 16' fill='%23fff' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='8' cy='8' r='3'/%3E%3C/svg%3E")}@media (forced-colors:active){[type=radio]:checked{appearance:auto}}[type=checkbox]:checked:focus,[type=checkbox]:checked:hover,[type=radio]:checked:focus,[type=radio]:checked:hover{background-color:currentColor;border-color:transparent}[type=checkbox]:indeterminate{background-color:currentColor;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3E%3Cpath stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3E%3C/svg%3E");background-position:50%;background-repeat:no-repeat;background-size:100% 100%;border-color:transparent}@media (forced-colors:active){[type=checkbox]:indeterminate{appearance:auto}}[type=checkbox]:indeterminate:focus,[type=checkbox]:indeterminate:hover{background-color:currentColor;border-color:transparent}[type=file]{background:unset;border-color:inherit;border-radius:0;border-width:0;font-size:unset;line-height:inherit;padding:0}[type=file]:focus{outline:1px solid ButtonText;outline:1px auto -webkit-focus-ring-color}::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}.block{display:block}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.theme-default .nl-bg{--tw-bg-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);background-color:rgb(255 255 255/var(--tw-bg-opacity));box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.theme-default .dark .nl-bg{--tw-bg-opacity:1;--tw-shadow-color:rgba(51,65,85,.7);--tw-shadow:var(--tw-shadow-colored);background-color:rgb(31 41 55/var(--tw-bg-opacity))}.theme-default .nl-description,.theme-default .nl-logo,.theme-default .nl-title{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity))}.theme-default .dark .nl-description,.theme-default .dark .nl-logo,.theme-default .dark .nl-title{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.theme-default .nl-description a{--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity));text-decoration-line:underline}.theme-default .dark .nl-description a{--tw-text-opacity:1;color:rgb(191 219 254/var(--tw-text-opacity));text-decoration-line:underline}.theme-default .nl-action-button{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity));outline:2px solid transparent;outline-offset:2px}.theme-default .nl-action-button:hover{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.theme-default .dark .nl-action-button{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity));outline:2px solid transparent;outline-offset:2px}.theme-default .dark .nl-action-button:hover{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity))}.theme-default .nl-title{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity))}.theme-default .dark .nl-title{--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity))}.theme-default .nl-button{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-text-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);background-color:rgb(255 255 255/var(--tw-bg-opacity));border-color:rgb(229 231 235/var(--tw-border-opacity));border-width:1px;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);color:rgb(31 41 55/var(--tw-text-opacity))}.theme-default .nl-button:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity))}.theme-default .dark .nl-button{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(15 23 42/var(--tw-bg-opacity));border-color:rgb(55 65 81/var(--tw-border-opacity));color:rgb(209 213 219/var(--tw-text-opacity))}.theme-default .dark .nl-button:hover{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity))}.theme-default .nl-divider{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.theme-default .nl-divider:before{border-top-width:1px}.theme-default .nl-divider:after,.theme-default .nl-divider:before{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity));content:var(--tw-content)}.theme-default .dark .nl-divider{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}.theme-default .dark .nl-divider:after,.theme-default .dark .nl-divider:before{--tw-border-opacity:1;border-color:rgb(75 85 99/var(--tw-border-opacity));content:var(--tw-content)}.theme-default .nl-footer{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity))}.theme-default .dark .nl-footer{--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity))}.theme-default .nl-error{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity))}.theme-default .dark .nl-error{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity))}.theme-default .nl-input{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.theme-default .nl-input:focus{--tw-border-opacity:1;--tw-ring-opacity:1;--tw-ring-color:rgb(168 85 247/var(--tw-ring-opacity));border-color:rgb(168 85 247/var(--tw-border-opacity))}.theme-default .dark .nl-input{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity));color:rgb(156 163 175/var(--tw-text-opacity))}.theme-default .dark .nl-input:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(75 85 99/var(--tw-ring-opacity))}.theme-default .nl-select{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.theme-default .nl-select:focus{--tw-border-opacity:1;--tw-ring-opacity:1;--tw-ring-color:rgb(168 85 247/var(--tw-ring-opacity));border-color:rgb(168 85 247/var(--tw-border-opacity))}.theme-default .dark .nl-select{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity));color:rgb(156 163 175/var(--tw-text-opacity))}.theme-default .dark .nl-select:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(75 85 99/var(--tw-ring-opacity))}.theme-default .nl-select-list{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.theme-default .dark .nl-select-list{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity))}.theme-default .nl-select-option{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity))}.theme-default .nl-select-option:hover{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.theme-default .nl-select-option.active-option{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(209 213 219/var(--tw-bg-opacity));color:rgb(30 58 138/var(--tw-text-opacity))}.theme-default .dark .nl-select-option{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.theme-default .dark .nl-select-option:hover{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity));color:rgb(209 213 219/var(--tw-text-opacity))}.theme-default .nl-text-error{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity))}.theme-default .nl-text-success{--tw-text-opacity:1;color:rgb(45 212 191/var(--tw-text-opacity))}.theme-default .nl-banner{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-text-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);background-color:rgb(255 255 255/var(--tw-bg-opacity));border-color:rgb(229 231 235/var(--tw-border-opacity));border-width:1px;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);color:rgb(31 41 55/var(--tw-text-opacity))}.theme-default .dark .nl-banner{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(15 23 42/var(--tw-bg-opacity));border-color:rgb(55 65 81/var(--tw-border-opacity));color:rgb(209 213 219/var(--tw-text-opacity))}.theme-ocean .nl-bg{--tw-bg-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);background-color:rgb(191 219 254/var(--tw-bg-opacity));box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.theme-ocean .dark .nl-bg{--tw-bg-opacity:1;--tw-shadow-color:rgba(51,65,85,.7);--tw-shadow:var(--tw-shadow-colored);background-color:rgb(8 47 73/var(--tw-bg-opacity))}.theme-ocean .nl-description,.theme-ocean .nl-logo,.theme-ocean .nl-title{--tw-text-opacity:1;color:rgb(8 47 73/var(--tw-text-opacity))}.theme-ocean .dark .nl-description,.theme-ocean .dark .nl-logo,.theme-ocean .dark .nl-title{--tw-text-opacity:1;color:rgb(186 230 253/var(--tw-text-opacity))}.theme-ocean .nl-action-button{--tw-text-opacity:1;color:rgb(8 47 73/var(--tw-text-opacity));outline:2px solid transparent;outline-offset:2px}.theme-ocean .nl-action-button:hover{--tw-bg-opacity:1;background-color:rgb(224 242 254/var(--tw-bg-opacity))}.theme-ocean .dark .nl-action-button{--tw-text-opacity:1;color:rgb(186 230 253/var(--tw-text-opacity));outline:2px solid transparent;outline-offset:2px}.theme-ocean .dark .nl-action-button:hover{--tw-bg-opacity:1;background-color:rgb(12 74 110/var(--tw-bg-opacity))}.theme-ocean .nl-button{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-text-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);background-color:rgb(224 242 254/var(--tw-bg-opacity));border-color:rgb(186 230 253/var(--tw-border-opacity));border-width:1px;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);color:rgb(8 47 73/var(--tw-text-opacity))}.theme-ocean .nl-button:hover{--tw-bg-opacity:1;background-color:rgb(240 249 255/var(--tw-bg-opacity))}.theme-ocean .dark .nl-button{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(7 89 133/var(--tw-bg-opacity));border-color:rgb(8 47 73/var(--tw-border-opacity));color:rgb(186 230 253/var(--tw-text-opacity))}.theme-ocean .dark .nl-button:hover{--tw-bg-opacity:1;background-color:rgb(12 74 110/var(--tw-bg-opacity))}.theme-ocean .nl-divider{--tw-text-opacity:1;color:rgb(8 47 73/var(--tw-text-opacity))}.theme-ocean .nl-divider:after,.theme-ocean .nl-divider:before{--tw-border-opacity:1;border-color:rgb(8 47 73/var(--tw-border-opacity));content:var(--tw-content)}.theme-ocean .dark .nl-divider{--tw-text-opacity:1;color:rgb(186 230 253/var(--tw-text-opacity))}.theme-ocean .dark .nl-divider:after,.theme-ocean .dark .nl-divider:before{--tw-border-opacity:1;border-color:rgb(186 230 253/var(--tw-border-opacity));content:var(--tw-content)}.theme-ocean .nl-footer{--tw-text-opacity:1;color:rgb(8 47 73/var(--tw-text-opacity))}.theme-ocean .dark .nl-footer{--tw-text-opacity:1;color:rgb(186 230 253/var(--tw-text-opacity))}.theme-ocean .nl-error{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity))}.theme-ocean .dark .nl-error{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity))}.theme-ocean .nl-input{--tw-bg-opacity:1;background-color:rgb(224 242 254/var(--tw-bg-opacity))}.theme-ocean .nl-input:focus{--tw-border-opacity:1;--tw-ring-opacity:1;--tw-ring-color:rgb(14 165 233/var(--tw-ring-opacity));border-color:rgb(14 165 233/var(--tw-border-opacity))}.theme-ocean .dark .nl-input{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(12 74 110/var(--tw-bg-opacity));color:rgb(56 189 248/var(--tw-text-opacity))}.theme-ocean .dark .nl-input:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(2 132 199/var(--tw-ring-opacity))}.theme-ocean .nl-select{--tw-bg-opacity:1;background-color:rgb(224 242 254/var(--tw-bg-opacity))}.theme-ocean .nl-select:focus{--tw-border-opacity:1;--tw-ring-opacity:1;--tw-ring-color:rgb(14 165 233/var(--tw-ring-opacity));border-color:rgb(14 165 233/var(--tw-border-opacity))}.theme-ocean .dark .nl-select{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(12 74 110/var(--tw-bg-opacity));color:rgb(56 189 248/var(--tw-text-opacity))}.theme-ocean .dark .nl-select:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(2 132 199/var(--tw-ring-opacity))}.theme-ocean .nl-select-list{--tw-bg-opacity:1;background-color:rgb(224 242 254/var(--tw-bg-opacity))}.theme-ocean .dark .nl-select-list{--tw-bg-opacity:1;background-color:rgb(3 105 161/var(--tw-bg-opacity))}.theme-ocean .nl-select-option{--tw-text-opacity:1;color:rgb(7 89 133/var(--tw-text-opacity))}.theme-ocean .nl-select-option:hover{--tw-bg-opacity:1;background-color:rgb(186 230 253/var(--tw-bg-opacity))}.theme-ocean .dark .nl-select-option{--tw-text-opacity:1;color:rgb(56 189 248/var(--tw-text-opacity))}.theme-ocean .dark .nl-select-option:hover{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(7 89 133/var(--tw-bg-opacity));color:rgb(125 211 252/var(--tw-text-opacity))}.theme-ocean .nl-text-error{--tw-text-opacity:1;color:rgb(220 38 38/var(--tw-text-opacity))}.theme-ocean .dark .nl-text-error{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity))}.theme-ocean .nl-text-success{--tw-text-opacity:1;color:rgb(13 148 136/var(--tw-text-opacity))}.theme-ocean .dark .nl-text-success{--tw-text-opacity:1;color:rgb(45 212 191/var(--tw-text-opacity))}.theme-lemonade .nl-bg{--tw-bg-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);background-color:rgb(187 247 208/var(--tw-bg-opacity));box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.theme-lemonade .dark .nl-bg{--tw-bg-opacity:1;--tw-shadow-color:rgba(51,65,85,.7);--tw-shadow:var(--tw-shadow-colored);background-color:rgb(5 46 22/var(--tw-bg-opacity))}.theme-lemonade .nl-description,.theme-lemonade .nl-logo,.theme-lemonade .nl-title{--tw-text-opacity:1;color:rgb(5 46 22/var(--tw-text-opacity))}.theme-lemonade .dark .nl-description,.theme-lemonade .dark .nl-logo,.theme-lemonade .dark .nl-title{--tw-text-opacity:1;color:rgb(187 247 208/var(--tw-text-opacity))}.theme-lemonade .nl-action-button{--tw-text-opacity:1;color:rgb(5 46 22/var(--tw-text-opacity));outline:2px solid transparent;outline-offset:2px}.theme-lemonade .nl-action-button:hover{--tw-bg-opacity:1;background-color:rgb(220 252 231/var(--tw-bg-opacity))}.theme-lemonade .dark .nl-action-button{--tw-text-opacity:1;color:rgb(187 247 208/var(--tw-text-opacity));outline:2px solid transparent;outline-offset:2px}.theme-lemonade .dark .nl-action-button:hover{--tw-bg-opacity:1;background-color:rgb(20 83 45/var(--tw-bg-opacity))}.theme-lemonade .nl-button{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-text-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);background-color:rgb(220 252 231/var(--tw-bg-opacity));border-color:rgb(187 247 208/var(--tw-border-opacity));border-width:1px;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);color:rgb(5 46 22/var(--tw-text-opacity))}.theme-lemonade .nl-button:hover{--tw-bg-opacity:1;background-color:rgb(240 253 244/var(--tw-bg-opacity))}.theme-lemonade .dark .nl-button{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(22 101 52/var(--tw-bg-opacity));border-color:rgb(5 46 22/var(--tw-border-opacity));color:rgb(187 247 208/var(--tw-text-opacity))}.theme-lemonade .dark .nl-button:hover{--tw-bg-opacity:1;background-color:rgb(20 83 45/var(--tw-bg-opacity))}.theme-lemonade .nl-divider{--tw-text-opacity:1;color:rgb(5 46 22/var(--tw-text-opacity))}.theme-lemonade .nl-divider:after,.theme-lemonade .nl-divider:before{--tw-border-opacity:1;border-color:rgb(5 46 22/var(--tw-border-opacity));content:var(--tw-content)}.theme-lemonade .dark .nl-divider{--tw-text-opacity:1;color:rgb(187 247 208/var(--tw-text-opacity))}.theme-lemonade .dark .nl-divider:after,.theme-lemonade .dark .nl-divider:before{--tw-border-opacity:1;border-color:rgb(187 247 208/var(--tw-border-opacity));content:var(--tw-content)}.theme-lemonade .nl-footer{--tw-text-opacity:1;color:rgb(5 46 22/var(--tw-text-opacity))}.theme-lemonade .dark .nl-footer{--tw-text-opacity:1;color:rgb(187 247 208/var(--tw-text-opacity))}.theme-lemonade .nl-error{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity))}.theme-lemonade .dark .nl-error{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity))}.theme-lemonade .nl-input{--tw-bg-opacity:1;background-color:rgb(220 252 231/var(--tw-bg-opacity))}.theme-lemonade .nl-input:focus{--tw-border-opacity:1;--tw-ring-opacity:1;--tw-ring-color:rgb(34 197 94/var(--tw-ring-opacity));border-color:rgb(34 197 94/var(--tw-border-opacity))}.theme-lemonade .dark .nl-input{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(20 83 45/var(--tw-bg-opacity));color:rgb(74 222 128/var(--tw-text-opacity))}.theme-lemonade .dark .nl-input:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(22 163 74/var(--tw-ring-opacity))}.theme-lemonade .nl-select{--tw-bg-opacity:1;background-color:rgb(220 252 231/var(--tw-bg-opacity))}.theme-lemonade .nl-select:focus{--tw-border-opacity:1;--tw-ring-opacity:1;--tw-ring-color:rgb(34 197 94/var(--tw-ring-opacity));border-color:rgb(34 197 94/var(--tw-border-opacity))}.theme-lemonade .dark .nl-select{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(20 83 45/var(--tw-bg-opacity));color:rgb(74 222 128/var(--tw-text-opacity))}.theme-lemonade .dark .nl-select:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(22 163 74/var(--tw-ring-opacity))}.theme-lemonade .nl-select-list{--tw-bg-opacity:1;background-color:rgb(220 252 231/var(--tw-bg-opacity))}.theme-lemonade .dark .nl-select-list{--tw-bg-opacity:1;background-color:rgb(21 128 61/var(--tw-bg-opacity))}.theme-lemonade .nl-select-option{--tw-text-opacity:1;color:rgb(22 101 52/var(--tw-text-opacity))}.theme-lemonade .nl-select-option:hover{--tw-bg-opacity:1;background-color:rgb(187 247 208/var(--tw-bg-opacity))}.theme-lemonade .dark .nl-select-option{--tw-text-opacity:1;color:rgb(74 222 128/var(--tw-text-opacity))}.theme-lemonade .dark .nl-select-option:hover{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(22 101 52/var(--tw-bg-opacity));color:rgb(134 239 172/var(--tw-text-opacity))}.theme-lemonade .nl-text-error{--tw-text-opacity:1;color:rgb(220 38 38/var(--tw-text-opacity))}.theme-lemonade .dark .nl-text-error{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity))}.theme-lemonade .nl-text-success{--tw-text-opacity:1;color:rgb(13 148 136/var(--tw-text-opacity))}.theme-lemonade .dark .nl-text-success{--tw-text-opacity:1;color:rgb(45 212 191/var(--tw-text-opacity))}.theme-purple .nl-bg{--tw-bg-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);background-color:rgb(233 213 255/var(--tw-bg-opacity));box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.theme-purple .dark .nl-bg{--tw-bg-opacity:1;--tw-shadow-color:rgba(51,65,85,.7);--tw-shadow:var(--tw-shadow-colored);background-color:rgb(59 7 100/var(--tw-bg-opacity))}.theme-purple .nl-description,.theme-purple .nl-logo,.theme-purple .nl-title{--tw-text-opacity:1;color:rgb(59 7 100/var(--tw-text-opacity))}.theme-purple .dark .nl-description,.theme-purple .dark .nl-logo,.theme-purple .dark .nl-title{--tw-text-opacity:1;color:rgb(233 213 255/var(--tw-text-opacity))}.theme-purple .nl-action-button{--tw-text-opacity:1;color:rgb(59 7 100/var(--tw-text-opacity));outline:2px solid transparent;outline-offset:2px}.theme-purple .nl-action-button:hover{--tw-bg-opacity:1;background-color:rgb(243 232 255/var(--tw-bg-opacity))}.theme-purple .dark .nl-action-button{--tw-text-opacity:1;color:rgb(233 213 255/var(--tw-text-opacity));outline:2px solid transparent;outline-offset:2px}.theme-purple .dark .nl-action-button:hover{--tw-bg-opacity:1;background-color:rgb(88 28 135/var(--tw-bg-opacity))}.theme-purple .nl-button{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-text-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);background-color:rgb(243 232 255/var(--tw-bg-opacity));border-color:rgb(233 213 255/var(--tw-border-opacity));border-width:1px;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);color:rgb(59 7 100/var(--tw-text-opacity))}.theme-purple .nl-button:hover{--tw-bg-opacity:1;background-color:rgb(250 245 255/var(--tw-bg-opacity))}.theme-purple .dark .nl-button{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(107 33 168/var(--tw-bg-opacity));border-color:rgb(59 7 100/var(--tw-border-opacity));color:rgb(233 213 255/var(--tw-text-opacity))}.theme-purple .dark .nl-button:hover{--tw-bg-opacity:1;background-color:rgb(88 28 135/var(--tw-bg-opacity))}.theme-purple .nl-divider{--tw-text-opacity:1;color:rgb(59 7 100/var(--tw-text-opacity))}.theme-purple .nl-divider:after,.theme-purple .nl-divider:before{--tw-border-opacity:1;border-color:rgb(59 7 100/var(--tw-border-opacity));content:var(--tw-content)}.theme-purple .dark .nl-divider{--tw-text-opacity:1;color:rgb(233 213 255/var(--tw-text-opacity))}.theme-purple .dark .nl-divider:after,.theme-purple .dark .nl-divider:before{--tw-border-opacity:1;border-color:rgb(233 213 255/var(--tw-border-opacity));content:var(--tw-content)}.theme-purple .nl-footer{--tw-text-opacity:1;color:rgb(59 7 100/var(--tw-text-opacity))}.theme-purple .dark .nl-footer{--tw-text-opacity:1;color:rgb(233 213 255/var(--tw-text-opacity))}.theme-purple .nl-error{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity))}.theme-purple .dark .nl-error{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity))}.theme-purple .nl-input{--tw-bg-opacity:1;background-color:rgb(243 232 255/var(--tw-bg-opacity))}.theme-purple .nl-input:focus{--tw-border-opacity:1;--tw-ring-opacity:1;--tw-ring-color:rgb(168 85 247/var(--tw-ring-opacity));border-color:rgb(168 85 247/var(--tw-border-opacity))}.theme-purple .dark .nl-input{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(88 28 135/var(--tw-bg-opacity));color:rgb(192 132 252/var(--tw-text-opacity))}.theme-purple .dark .nl-input:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(147 51 234/var(--tw-ring-opacity))}.theme-purple .nl-select{--tw-bg-opacity:1;background-color:rgb(243 232 255/var(--tw-bg-opacity))}.theme-purple .nl-select:focus{--tw-border-opacity:1;--tw-ring-opacity:1;--tw-ring-color:rgb(168 85 247/var(--tw-ring-opacity));border-color:rgb(168 85 247/var(--tw-border-opacity))}.theme-purple .dark .nl-select{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(88 28 135/var(--tw-bg-opacity));color:rgb(192 132 252/var(--tw-text-opacity))}.theme-purple .dark .nl-select:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(147 51 234/var(--tw-ring-opacity))}.theme-purple .nl-select-list{--tw-bg-opacity:1;background-color:rgb(243 232 255/var(--tw-bg-opacity))}.theme-purple .dark .nl-select-list{--tw-bg-opacity:1;background-color:rgb(126 34 206/var(--tw-bg-opacity))}.theme-purple .nl-select-option{--tw-text-opacity:1;color:rgb(107 33 168/var(--tw-text-opacity))}.theme-purple .nl-select-option:hover{--tw-bg-opacity:1;background-color:rgb(233 213 255/var(--tw-bg-opacity))}.theme-purple .dark .nl-select-option{--tw-text-opacity:1;color:rgb(192 132 252/var(--tw-text-opacity))}.theme-purple .dark .nl-select-option:hover{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(107 33 168/var(--tw-bg-opacity));color:rgb(216 180 254/var(--tw-text-opacity))}.theme-purple .nl-text-error{--tw-text-opacity:1;color:rgb(220 38 38/var(--tw-text-opacity))}.theme-purple .dark .nl-text-error{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity))}.theme-purple .nl-text-success{--tw-text-opacity:1;color:rgb(13 148 136/var(--tw-text-opacity))}.theme-purple .dark .nl-text-success{--tw-text-opacity:1;color:rgb(45 212 191/var(--tw-text-opacity))}.theme-crab .nl-button{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-text-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);background-color:rgb(254 226 226/var(--tw-bg-opacity));border-color:rgb(254 202 202/var(--tw-border-opacity));border-width:1px;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);color:rgb(69 10 10/var(--tw-text-opacity))}.theme-crab .nl-button:hover{--tw-bg-opacity:1;background-color:rgb(254 242 242/var(--tw-bg-opacity))}.theme-crab .dark .nl-button{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(153 27 27/var(--tw-bg-opacity));border-color:rgb(69 10 10/var(--tw-border-opacity));color:rgb(254 202 202/var(--tw-text-opacity))}.theme-crab .dark .nl-button:hover{--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity))}.show-slow{display:none;opacity:0;transition:.1s}.isOpen .show-slow{display:block;opacity:1;transition:.2s;transition-delay:.2s}:host{display:block}.animate-spin-loading{animation:spin2 1s linear infinite;background:var(--qa-dark-color)}@keyframes spin2{to{transform:rotate(1turn)}}.active{animation:blink .7s infinite alternate}@keyframes blink{0%{opacity:1}to{opacity:0}}.sr-only{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.left-0{left:0}.start-0{inset-inline-start:0}.top-0{top:0}.z-\\[80\\]{z-index:80}.z-\\[81\\]{z-index:81}.mx-auto{margin-left:auto;margin-right:auto}.flex{display:flex}.h-5{height:20px}.h-7{height:28px}.h-full{height:100%}.w-5{width:20px}.w-7{width:28px}.w-full{width:100%}.max-w-96{max-width:384px}.flex-shrink-0{flex-shrink:0}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:4px}.gap-2{gap:8px}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.rounded-full{border-radius:9999px}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-transparent{border-color:transparent}.bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity))}.bg-opacity-75{--tw-bg-opacity:0.75}.p-4{padding:16px}.px-4{padding-left:16px;padding-right:16px}.py-3{padding-bottom:12px}.pt-3,.py-3{padding-top:12px}.text-center{text-align:center}.text-base{font-size:16px;line-height:24px}.text-sm{font-size:14px;line-height:20px}.font-bold{font-weight:700}.font-light{font-weight:300}.font-semibold{font-weight:600}.text-blue-400{--tw-text-opacity:1;color:rgb(96 165 250/var(--tw-text-opacity))}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.dark\\:focus\\:outline-none:focus:is(.dark *){outline:2px solid transparent;outline-offset:2px}.dark\\:focus\\:ring-1:focus:is(.dark *){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.dark\\:focus\\:ring-gray-600:focus:is(.dark *){--tw-ring-opacity:1;--tw-ring-color:rgb(75 85 99/var(--tw-ring-opacity))}@media (min-width:640px){.sm\\:mx-auto{margin-left:auto;margin-right:auto}.sm\\:w-full{width:100%}.sm\\:max-w-lg{max-width:512px}}.ml-auto,.mx-auto{margin-left:auto}.mr-auto{margin-right:auto}.mt-3{margin-top:12px}.w-60{width:240px}.pt-2{padding-top:8px}.text-4xl{font-size:36px;line-height:40px}.text-lg{font-size:18px;line-height:28px}.mt-0{margin-top:0}.inline-flex{display:inline-flex}.h-4{height:16px}.max-h-0{max-height:0}.max-h-\\[500px\\]{max-height:500px}.w-4{width:16px}.max-w-52{max-width:208px}.max-w-7{max-width:28px}.rotate-0{--tw-rotate:0deg}.rotate-0,.rotate-180{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate:180deg}.gap-0\\.5{gap:2px}.gap-3{gap:12px}.gap-x-3\\.5{column-gap:14px}.overflow-hidden,.truncate{overflow:hidden}.truncate{text-overflow:ellipsis;white-space:nowrap}.rounded-lg{border-radius:.5rem}.border-b-\\[1px\\]{border-bottom-width:1px}.border-dashed{border-style:dashed}.border-blue-500{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity))}.border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}.border-gray-400{--tw-border-opacity:1;border-color:rgb(156 163 175/var(--tw-border-opacity))}.p-2{padding:8px}.px-3{padding-left:12px;padding-right:12px}.py-2{padding-bottom:8px;padding-top:8px}.pb-1{padding-bottom:4px}.pb-1\\.5{padding-bottom:6px}.pb-5{padding-bottom:20px}.pe-4{padding-inline-end:16px}.ps-4{padding-inline-start:16px}.pt-5{padding-top:20px}.text-3xl{font-size:30px;line-height:36px}.font-medium{font-weight:500}.uppercase{text-transform:uppercase}.text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity))}.decoration-dashed{text-decoration-style:dashed}.duration-300{transition-duration:.3s}.duration-\\[0\\.25s\\]{transition-duration:.25s}.ease-in{transition-timing-function:cubic-bezier(.4,0,1,1)}.hover\\:bg-gray-300:hover{--tw-bg-opacity:1;background-color:rgb(209 213 219/var(--tw-bg-opacity))}.mb-0\\.5{margin-bottom:2px}.mb-2{margin-bottom:8px}.mb-5{margin-bottom:20px}.ml-auto{margin-left:auto}.inline-block{display:inline-block}.w-72{width:288px}.max-w-72{max-width:288px}.border-\\[3px\\]{border-width:3px}.border-current{border-color:currentColor}.border-t-transparent{border-top-color:transparent}.pb-2{padding-bottom:8px}.text-2xl{font-size:24px;line-height:32px}.text-slate-900{--tw-text-opacity:1;color:rgb(15 23 42/var(--tw-text-opacity))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.dark\\:text-gray-300:is(.dark *){--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity))}.h-12{height:48px}.w-12{width:48px}.text-green-800{--tw-text-opacity:1;color:rgb(22 101 52/var(--tw-text-opacity))}.dark\\:text-green-200:is(.dark *){--tw-text-opacity:1;color:rgb(187 247 208/var(--tw-text-opacity))}.mb-10{margin-bottom:40px}.mt-10{margin-top:40px}.h-20{height:80px}.w-20{width:80px}.border-\\[4px\\]{border-width:4px}.pointer-events-none{pointer-events:none}.inset-y-0{bottom:0;top:0}.ps-11{padding-inline-start:44px}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}.disabled\\:pointer-events-none:disabled{pointer-events:none}.disabled\\:opacity-50:disabled{opacity:.5}.peer:disabled~.peer-disabled\\:pointer-events-none{pointer-events:none}.peer:disabled~.peer-disabled\\:opacity-50{opacity:.5}.dark\\:border-transparent:is(.dark *){border-color:transparent}.w-auto{width:auto}.border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}.border-orange-300{--tw-border-opacity:1;border-color:rgb(253 186 116/var(--tw-border-opacity))}.border-red-300{--tw-border-opacity:1;border-color:rgb(252 165 165/var(--tw-border-opacity))}.border-teal-300{--tw-border-opacity:1;border-color:rgb(94 234 212/var(--tw-border-opacity))}.border-yellow-300{--tw-border-opacity:1;border-color:rgb(253 224 71/var(--tw-border-opacity))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.bg-orange-100{--tw-bg-opacity:1;background-color:rgb(255 237 213/var(--tw-bg-opacity))}.bg-red-100{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity))}.bg-teal-100{--tw-bg-opacity:1;background-color:rgb(204 251 241/var(--tw-bg-opacity))}.bg-yellow-100{--tw-bg-opacity:1;background-color:rgb(254 249 195/var(--tw-bg-opacity))}.px-1{padding-left:4px;padding-right:4px}.text-\\[10px\\]{font-size:10px}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.text-orange-600{--tw-text-opacity:1;color:rgb(234 88 12/var(--tw-text-opacity))}.text-red-600{--tw-text-opacity:1;color:rgb(220 38 38/var(--tw-text-opacity))}.text-teal-600{--tw-text-opacity:1;color:rgb(13 148 136/var(--tw-text-opacity))}.text-yellow-500{--tw-text-opacity:1;color:rgb(234 179 8/var(--tw-text-opacity))}.right-\\[-2px\\]{right:-2px}.right-\\[-3px\\]{right:-3px}.top-\\[-2px\\]{top:-2px}.top-\\[-3px\\]{top:-3px}.h-1\\.5{height:6px}.h-3{height:12px}.h-6{height:24px}.w-1\\.5{width:6px}.w-3{width:12px}.max-w-6{max-width:24px}.border-2{border-width:2px}.border-blue-200{--tw-border-opacity:1;border-color:rgb(191 219 254/var(--tw-border-opacity))}.border-white{--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity))}.bg-green-500{--tw-bg-opacity:1;background-color:rgb(34 197 94/var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.pb-3{padding-bottom:12px}.pt-0{padding-top:0}.text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity))}.hover\\:bg-gray-400:hover{--tw-bg-opacity:1;background-color:rgb(156 163 175/var(--tw-bg-opacity))}.hover\\:text-red-600:hover{--tw-text-opacity:1;color:rgb(220 38 38/var(--tw-text-opacity))}.group:hover .group-hover\\:border-blue-400{--tw-border-opacity:1;border-color:rgb(96 165 250/var(--tw-border-opacity))}.mt-1{margin-top:4px}.hidden{display:none}.min-w-\\[15rem\\]{min-width:15rem}.overflow-hidden,.truncate{overflow:hidden}.shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.before\\:absolute:before{content:var(--tw-content);position:absolute}.before\\:-top-4:before{content:var(--tw-content);top:-16px}.before\\:start-0:before{content:var(--tw-content);inset-inline-start:0}.before\\:h-4:before{content:var(--tw-content);height:16px}.before\\:w-full:before{content:var(--tw-content);width:100%}.after\\:absolute:after{content:var(--tw-content);position:absolute}.after\\:-bottom-4:after{bottom:-16px;content:var(--tw-content)}.after\\:start-0:after{content:var(--tw-content);inset-inline-start:0}.after\\:h-4:after{content:var(--tw-content);height:16px}.after\\:w-full:after{content:var(--tw-content);width:100%}.end-0{inset-inline-end:0}.h-\\[20px\\]{height:20px}.w-\\[20px\\]{width:20px}.border-\\[2px\\]{border-width:2px}.pe-11{padding-inline-end:44px}.right-0{right:0}.right-2{right:8px}.top-2{top:8px}.top-52{top:208px}.z-0{z-index:0}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.m-auto{margin:auto}.ml-0{margin-left:0}.ml-\\[2px\\]{margin-left:2px}.mr-0{margin-right:0}.mr-2{margin-right:8px}.mr-3\\.5{margin-right:14px}.mt-2{margin-top:8px}.grid{display:grid}.h-0{height:0}.h-8{height:32px}.h-\\[46px\\]{height:46px}.h-auto{height:auto}.w-0{width:0}.w-16{width:64px}.w-52{width:208px}.w-6{width:24px}.w-8{width:32px}.w-\\[48px\\]{width:48px}.min-w-40{min-width:160px}.max-w-40{max-width:160px}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.place-items-center{place-items:center}.gap-x-2{column-gap:8px}.text-nowrap{text-wrap:nowrap}.rounded-r-lg{border-bottom-right-radius:.5rem;border-top-right-radius:.5rem}.rounded-r-none{border-bottom-right-radius:0;border-top-right-radius:0}.border-\\[0px\\]{border-width:0}.p-3{padding:12px}.px-2{padding-left:8px;padding-right:8px}.py-2\\.5{padding-bottom:10px;padding-top:10px}.pl-\\[11px\\]{padding-left:11px}.text-xs{font-size:12px;line-height:16px}.text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity))}.opacity-0{opacity:0}.transition-all{transition-duration:.15s;transition-property:all}.ease-in-out,.transition-all{transition-timing-function:cubic-bezier(.4,0,.2,1)}.hover\\:right-2:hover{right:8px}.hover\\:rounded-r-lg:hover{border-bottom-right-radius:.5rem;border-top-right-radius:.5rem}.border-t-\\[1px\\]{border-top-width:1px}.first\\:border-none:first-child{border-style:none}.first\\:pt-0:first-child{padding-top:0}`,buttonBaseCss=baseCss,ButtonBaseStyle0=buttonBaseCss,ButtonBase=proxyCustomElement(class extends H{constructor(){super(),this.__registerHost(),this.theme="default",this.darkMode=!1,this.titleBtn="Open modal",this.disabled=!1}componentDidRender(){const e=this.element.querySelector("svg");e&&(e.classList.add("flex-shrink-0","w-4","h-4","block"),e.removeAttribute("style"))}render(){return h("div",{key:"1048576f0a9839c56cac030b1de7899b25b5f39e",class:`theme-${this.theme}`},h("div",{key:"ea29f74a1f7e4268802c6e4aaca5867dfd2e4c9b",class:"animate-spin-loading active"}),h("button",{key:"71f84d47b11aa3971818b686f8dddb74e0d36eb0",disabled:this.disabled,type:"button",class:"nl-button py-2.5 px-3 w-full inline-flex justify-center items-center gap-x-2 text-sm font-medium rounded-lg disabled:opacity-50 disabled:pointer-events-none dark:focus:outline-none dark:focus:ring-1 dark:focus:ring-gray-600"},h("slot",{key:"91a91994e20dc10e3bbb2576e4214fa98533be8e",name:"icon-start"}),this.titleBtn))}get element(){return this}static get style(){return ButtonBaseStyle0}},[4,"button-base",{theme:[1025],darkMode:[1028,"dark-mode"],titleBtn:[1,"title-btn"],disabled:[4]}]);function defineCustomElement$q(){typeof customElements>"u"||["button-base"].forEach(e=>{e==="button-base"&&(customElements.get(e)||customElements.define(e,ButtonBase))})}defineCustomElement$q();const nlConfirmLogoutCss=baseCss,NlConfirmLogoutStyle0=nlConfirmLogoutCss,NlConfirmLogout$1=proxyCustomElement(class extends H{constructor(){super(),this.__registerHost(),this.handleLogoutBanner=createEvent(this,"handleLogoutBanner"),this.handleBackUpModal=createEvent(this,"handleBackUpModal"),this.nlCloseModal=createEvent(this,"nlCloseModal"),this.titleModal="Delete keys?",this.description="Your profile keys are stored in this browser tab and will be deleted if you log out, and your profile will be inaccessible."}handleLogout(){this.handleLogoutBanner.emit(METHOD_MODULE.LOGOUT),this.nlCloseModal.emit()}handleCancel(){this.nlCloseModal.emit()}handleBackUp(){state.path=[CURRENT_MODULE.IMPORT_FLOW]}render(){return h("div",{key:"fe605f38f9d0a440fe53e21f19288c41e4762c22",class:"p-4 overflow-y-auto"},h("h1",{key:"84d14a59035515b2fd612d262400a038887a10d7",class:"nl-title font-bold text-center text-4xl"},this.titleModal),h("p",{key:"83ef73271c76309561be95e0207f8130d75a161c",class:"nl-description font-light text-center text-lg pt-2 max-w-96 mx-auto"},this.description),h("div",{key:"fce0f132846beb95dd9e41357f5ab87be7229a56",class:"mt-3 ml-auto mr-auto w-60 flex flex-col gap-2"},h("button-base",{key:"c4fc722a7c98d84e797963ed7fe928164411b701",onClick:()=>this.handleBackUp(),titleBtn:"Backup keys",theme:"lemonade"}),h("button-base",{key:"39df385a9a8dc3fcd74f4196d4191bc4a308a16d",onClick:()=>this.handleLogout(),theme:"crab",titleBtn:"Logout and delete keys"})))}static get style(){return NlConfirmLogoutStyle0}},[0,"nl-confirm-logout",{titleModal:[1,"title-modal"],description:[1]}]);function defineCustomElement$p(){typeof customElements>"u"||["nl-confirm-logout","button-base"].forEach(e=>{switch(e){case"nl-confirm-logout":customElements.get(e)||customElements.define(e,NlConfirmLogout$1);break;case"button-base":customElements.get(e)||defineCustomElement$q()}})}defineCustomElement$p();const nlConnectCss=baseCss,NlConnectStyle0=nlConnectCss,NlConnect=proxyCustomElement(class extends H{constructor(){super(),this.__registerHost(),this.nlNostrConnect=createEvent(this,"nlNostrConnect"),this.titleWelcome="Connect to key store",this.authMethods=[],this.hasOTP=!1,this.connectionStringServices=[],this.isOpenAdvancedLogin=!1}handleChangeScreen(e){state.path=[...state.path,e]}handleOpenAdvanced(){this.isOpenAdvancedLogin=!this.isOpenAdvancedLogin}allowAuthMethod(e){return!this.authMethods.length||this.authMethods.includes(e)}componentWillLoad(){}handleOpenLink(e,t){e.preventDefault(),this.nlNostrConnect.emit(t)}handleConnectionString(){this.handleChangeScreen(CURRENT_MODULE.CONNECTION_STRING)}render(){const e=(this.isOpenAdvancedLogin?"rotate-180":"rotate-0")+" duration-300 flex-shrink-0 w-4 h-4 text-blue-500";return h(Fragment,{key:"1927cf668a1188fe3d7646e4a7854046b5476f31"},h("div",{key:"0428eec0130c32c6ac0386f5bbc7ebf5d693a459",class:"p-4 overflow-y-auto"},h("h1",{key:"e7bb4180be357e4208c319f3cf508ed93b409d87",class:"nl-title font-bold text-center text-3xl"},this.titleWelcome)),h("div",{key:"9860c1c264fe6da144590f17067139006f4e1c96",class:"p-4"},!!this.connectionStringServices.length&&h("div",{key:"dacc446ecd659a60f90f336c513aea08d464c53f",class:"max-w-96 mx-auto pt-5"},h("p",{key:"58eee01671daa814da10883363384feb3fc0026e",class:"nl-description font-medium text-sm pb-1.5"},"Select key store:"),h("ul",{key:"cbb8cd144d9b84dc6d6555f31e6d1838002301ea",class:"p-2 rounded-lg border border-gray-200 flex flex-col w-full gap-0.5"},this.connectionStringServices.map(t=>h("li",null,h("a",{href:t.link,target:"_blank",onClick:n=>this.handleOpenLink(n,t),class:"flex items-center gap-x-3.5 w-full hover:bg-gray-300 flex cursor-pointer items-center gap-x-3.5 py-2 px-3 rounded-lg text-sm justify-between"},h("div",{class:"w-full max-w-7 h-7 flex relative"},h("div",{class:"uppercase font-bold w-full h-full rounded-full border border-gray-400 flex justify-center items-center"},t.img?h("img",{class:"w-full rounded-full",src:t.img,alt:t.name}):h("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"#9ca3af",class:"w-4 h-4 block"},h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z"})))),h("div",{class:"overflow-hidden flex flex-col w-full"},h("div",{class:"nl-title truncate overflow-hidden"},t.name)))))))),h("div",{key:"654367c0e9106d1e840fedf349dc25f0452d4d4f",class:"ps-4 pe-4 overflow-y-auto"},h("p",{key:"42a2ede70e15abbe98ac04cc0ff6a50d4afd5aad",class:"nl-error font-light text-center text-sm max-w-96 mx-auto"},state.error)),h("div",{key:"a923dcb9b50dd9377711a15fc1900570db8becbe",class:"max-w-52 mx-auto pb-5"},(this.allowAuthMethod("connect")||this.allowAuthMethod("readOnly"))&&h("div",{key:"ad3520c80d4052b6579893e09d3683ec002027ba",class:"flex justify-center"},h("div",{key:"7232d7a387c3cb437ef2c7cb5c8622fea4b14416",onClick:()=>this.handleOpenAdvanced(),class:"text-blue-500 mt-3 decoration-dashed cursor-pointer inline-flex gap-2 items-center pb-1 border-dashed border-b-[1px] border-blue-500 text-sm font-light"},"Advanced",h("svg",{key:"e687b41e6e2cf3605edec3a51376228db029dcc4",class:e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},h("path",{key:"39aa6f5a53580a306f0667efb5a4cd3280cdced1",d:"m6 9 6 6 6-6"})))),h("div",{key:"dce6ddf9e7079e169f9a1e85d847f53b2897e238",class:(this.isOpenAdvancedLogin?"max-h-[500px] mt-3 duration-300":"max-h-0 mt-0 duration-[0.25s]")+" transition-max-height ease-in flex gap-3 flex-col overflow-hidden"},this.allowAuthMethod("connect")&&h("button-base",{key:"e2f193770cd51db143fed6bc398bb9131f6a61e8",titleBtn:"User name",onClick:()=>this.handleChangeScreen(CURRENT_MODULE.LOGIN)},h("svg",{key:"99d92ddfd0c142f556b77ad3cf7e9a3f2b7a74f7",style:{display:"none"},slot:"icon-start",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},h("path",{key:"60c43b645f481548a1e6cc01ba8b28d645e132d7","stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 6a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0ZM4.501 20.118a7.5 7.5 0 0 1 14.998 0A17.933 17.933 0 0 1 12 21.75c-2.676 0-5.216-.584-7.499-1.632Z"}))),this.allowAuthMethod("connect")&&h("button-base",{key:"e36f778cfbb4a55ba6d2a020365c70471728e2f1",titleBtn:"Connection string",onClick:()=>this.handleConnectionString()},h("svg",{key:"d7e13e1643d7ce8f339813a36d9d6633398120ca",style:{display:"none"},slot:"icon-start",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},h("path",{key:"67e838e2045708e9ca5f13c705c59097747dec0f","stroke-linecap":"round","stroke-linejoin":"round",d:"M3.75 4.875c0-.621.504-1.125 1.125-1.125h4.5c.621 0 1.125.504 1.125 1.125v4.5c0 .621-.504 1.125-1.125 1.125h-4.5A1.125 1.125 0 0 1 3.75 9.375v-4.5ZM3.75 14.625c0-.621.504-1.125 1.125-1.125h4.5c.621 0 1.125.504 1.125 1.125v4.5c0 .621-.504 1.125-1.125 1.125h-4.5a1.125 1.125 0 0 1-1.125-1.125v-4.5ZM13.5 4.875c0-.621.504-1.125 1.125-1.125h4.5c.621 0 1.125.504 1.125 1.125v4.5c0 .621-.504 1.125-1.125 1.125h-4.5A1.125 1.125 0 0 1 13.5 9.375v-4.5Z"}),h("path",{key:"3d7c3636ce9148b8e668aebb43260cf69991004c","stroke-linecap":"round","stroke-linejoin":"round",d:"M6.75 6.75h.75v.75h-.75v-.75ZM6.75 16.5h.75v.75h-.75v-.75ZM16.5 6.75h.75v.75h-.75v-.75ZM13.5 13.5h.75v.75h-.75v-.75ZM13.5 19.5h.75v.75h-.75v-.75ZM19.5 13.5h.75v.75h-.75v-.75ZM19.5 19.5h.75v.75h-.75v-.75ZM16.5 16.5h.75v.75h-.75v-.75Z"}))),this.allowAuthMethod("connect")&&h("button-base",{key:"54157a016b76d351aa93f0f98b1cdfb6c3548561",onClick:()=>this.handleChangeScreen(CURRENT_MODULE.LOGIN_BUNKER_URL),titleBtn:"Bunker URL"},h("svg",{key:"6c637c9fc47729887720b2c76a40d0287f68bb5f",style:{display:"none"},slot:"icon-start",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},h("path",{key:"45eccf5015bb2afaf15a4159a213505fe5e18de1","stroke-linecap":"round","stroke-linejoin":"round",d:"M13.19 8.688a4.5 4.5 0 0 1 1.242 7.244l-4.5 4.5a4.5 4.5 0 0 1-6.364-6.364l1.757-1.757m13.35-.622 1.757-1.757a4.5 4.5 0 0 0-6.364-6.364l-4.5 4.5a4.5 4.5 0 0 0 1.242 7.244"}))))))}static get style(){return NlConnectStyle0}},[0,"nl-connect",{titleWelcome:[1,"title-welcome"],authMethods:[16],hasOTP:[4,"has-o-t-p"],connectionStringServices:[16],isOpenAdvancedLogin:[32]}]);function defineCustomElement$o(){typeof customElements>"u"||["nl-connect","button-base"].forEach(e=>{switch(e){case"nl-connect":customElements.get(e)||customElements.define(e,NlConnect);break;case"button-base":customElements.get(e)||defineCustomElement$q()}})}defineCustomElement$o();const nlIframeCss=baseCss,NlIframeStyle0=nlIframeCss,NlConfirmLogout=proxyCustomElement(class extends H{constructor(){super(),this.__registerHost(),this.nlCloseModal=createEvent(this,"nlCloseModal"),this.titleModal="Confirm",this.description="Your profile keys are stored in this browser tab and will be deleted if you log out, and your profile will be inaccessible.",this.iframeUrl=""}handleCancel(){this.nlCloseModal.emit()}render(){return h("div",{key:"36ee9fd43bbb16768b7634783781ecffb1c9432a",class:"p-4 overflow-y-auto"},h("div",{key:"1634e1fd37bc44030f22bfdab9f7deec2806731b",class:"mt-3 flex flex-col gap-2"},this.iframeUrl&&h("iframe",{key:"2b1ab3032b152fb109f3531bb7600bb76aa1a562",src:this.iframeUrl,style:{width:"100%",height:"600px",border:"1px solid #ccc",borderRadius:"8px"}})))}static get style(){return NlIframeStyle0}},[0,"nl-iframe",{titleModal:[1,"title-modal"],description:[1],iframeUrl:[1,"iframe-url"]}]);function defineCustomElement$n(){typeof customElements>"u"||["nl-iframe"].forEach(e=>{e==="nl-iframe"&&(customElements.get(e)||customElements.define(e,NlConfirmLogout))})}defineCustomElement$n();const nlSelectCss=baseCss,NlSelectStyle0=nlSelectCss,NlSelect=proxyCustomElement(class extends H{constructor(){super(),this.__registerHost(),this.selectDomain=createEvent(this,"selectDomain"),this.isOpen=!1,this.value=null,this.options=void 0,this.selected=void 0,this.mode=!1,this.darkMode=!1,this.themeState="default",this.theme="default"}handleWindowClick(){this.wrapperRef.querySelector(".listClass")&&(this.isOpen=!1)}toggleDropdown(){this.isOpen=!this.isOpen,this.calculateDropdownPosition()}watchPropHandler(e){this.themeState=e}watchModeHandler(e){this.mode=e}connectedCallback(){this.themeState=this.theme,this.mode=this.darkMode,this.value=this.options[this.selected],this.selectDomain.emit(this.value.value)}calculateDropdownPosition(){if(this.isOpen&&this.buttonRef){const e=this.buttonRef.getBoundingClientRect();this.ulRef.style.top=`${e.height}px`}}handleChange(e){this.value=e,this.isOpen=!1,this.selectDomain.emit(this.value.value)}render(){const e=(this.isOpen?"listClass":"hidden")+" min-w-[15rem] nl-select-list absolute left-0 shadow-md rounded-lg p-2 mt-1 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full",t=(this.isOpen?"rotate-180":"rotate-0")+" duration-300 flex-shrink-0 w-4 h-4 text-gray-500";return h("div",{key:"c86084c50712455e04682a4392e490bc0e20eb1d",class:`theme-${this.themeState}`},h("div",{key:"a90d9b4af52845a9971c39cec69c13493d511381",class:"relative",ref:n=>this.wrapperRef=n},h("button",{key:"1391137997bf8fcd0a5466cd9fa20c79b4ce27ba",ref:n=>this.buttonRef=n,onClick:()=>this.toggleDropdown(),type:"button",class:"nl-select peer py-3 px-4 flex items-center w-full justify-between border-transparent rounded-lg text-sm disabled:opacity-50 disabled:pointer-events-none dark:border-transparent"},h("span",{key:"224425ab92ba3599595924972e98a0fc9cb1a189",class:"truncate overflow-hidden"},this.value.name),h("svg",{key:"8eb2a2b552cb9ea36fb1abc61d804efb423afda6",class:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},h("path",{key:"feea1a7f54f4a111b7bf01e3945445311b97ab82",d:"m6 9 6 6 6-6"}))),h("ul",{key:"fca4982f04f4133d5c2a2f613a7e7d977dd5c241",ref:n=>this.ulRef=n,class:e},this.options.map(n=>h("li",{onClick:()=>this.handleChange(n),class:"nl-select-option flex cursor-pointer items-center gap-x-3.5 py-2 px-3 rounded-lg text-sm"},n.name)))))}get element(){return this}static get watchers(){return{theme:["watchPropHandler"],darkMode:["watchModeHandler"]}}static get style(){return NlSelectStyle0}},[0,"nl-select",{options:[16],selected:[2],darkMode:[4,"dark-mode"],theme:[1],isOpen:[32],value:[32],mode:[32],themeState:[32]},[[8,"click","handleWindowClick"]],{theme:["watchPropHandler"],darkMode:["watchModeHandler"]}]);function defineCustomElement$m(){typeof customElements>"u"||["nl-select"].forEach(e=>{e==="nl-select"&&(customElements.get(e)||customElements.define(e,NlSelect))})}defineCustomElement$m();const nlImportFlowCss=baseCss,NlImportFlowStyle0=nlImportFlowCss,NlImportFlow$1=proxyCustomElement(class extends H{constructor(){super(),this.__registerHost(),this.nlImportAccount=createEvent(this,"nlImportAccount"),this.nlExportKeys=createEvent(this,"nlExportKeys"),this.titleInfo="Back up your keys",this.titleImport="Choose a service",this.services=[],this.isContinued=!1,this.isKeyBackup=!1,this.isCopy=!1}handleDomainSelect(e){const t=this.services.find(n=>n.domain===e.detail);state.nlImport=t}handleCreateAccount(e){e.preventDefault(),this.nlImportAccount.emit(state.nlImport)}handleContinue(){this.isContinued=!0}handleContinueKeyBackup(){this.isKeyBackup=!0}async copyToClipboard(){this.nlExportKeys.emit(),this.isCopy=!0,setTimeout(()=>{this.isCopy=!1},1500)}render(){if(!this.isContinued&&!this.isKeyBackup)return h("div",{class:"p-4 overflow-y-auto"},h("h1",{class:"nl-title font-bold text-center text-2xl"},this.titleInfo),h("p",{class:"nl-description font-light text-sm pt-2 pb-2 max-w-96 mx-auto"},"Nostr profiles are controlled by cryptographic keys.",h("br",null),h("br",null),"Your keys are currently only stored in this browser tab, and may be lost if you close it.",h("br",null),h("br",null),"You should backup your keys.",h("br",null),h("br",null),"We recommend to import your keys into a key store service, to protect them and to use with other apps."),h("div",{class:"ml-auto mr-auto mb-2 w-72"},h("button-base",{onClick:()=>this.handleContinue(),titleBtn:"Import to key store"})),h("div",{class:"ml-auto mr-auto w-72"},h("button-base",{onClick:()=>this.handleContinueKeyBackup(),titleBtn:"Export keys"})));if(this.isKeyBackup)return h("div",{class:"p-4 overflow-y-auto"},h("h1",{class:"nl-title font-bold text-center text-2xl"},"Key export"),h("p",{class:"nl-description font-light text-sm pt-2 pb-2 max-w-96 mx-auto"},"Copy your keys and store them in a safe place, like a password manager.",h("br",null),h("br",null),"You can sign into other Nostr apps by pasting your keys into them.",h("br",null),h("br",null),"Your keys must be kept secret, never share them with anyone."),h("div",{class:"max-w-72 mx-auto"},h("div",{class:"ml-auto mr-auto mb-2 w-72"},h("button-base",{onClick:()=>this.copyToClipboard(),titleBtn:this.isCopy?"Copied!":"Copy to clipboard"}))));const e=this.services.filter(t=>t.canImport).map(t=>({name:t.domain,value:t.domain}));return h(Fragment,null,h("div",{class:"p-4 overflow-y-auto"},h("h1",{class:"nl-title font-bold text-center text-2xl"},this.titleImport),h("p",{class:"nl-description font-light text-center text-sm pt-2 max-w-96 mx-auto"},"Your Nostr keys will be imported into the service you choose. You will manage your keys on their website.")),h("div",{class:"max-w-72 mx-auto mb-5"},h("div",{class:"mb-0.5"},h("nl-select",{onSelectDomain:t=>this.handleDomainSelect(t),selected:0,options:e})),h("p",{class:"nl-title font-light text-sm mb-2"},"Default provider is a fine choice to start with."),h("div",{class:"ps-4 pe-4 overflow-y-auto"},h("p",{class:"nl-error font-light text-center text-sm max-w-96 mx-auto"},state.error)),h("button-base",{disabled:state.isLoading,onClick:t=>this.handleCreateAccount(t),titleBtn:"Start importing"},state.isLoading?h("span",{slot:"icon-start",class:"animate-spin-loading inline-block w-4 h-4 border-[3px] border-current border-t-transparent text-slate-900 dark:text-gray-300 rounded-full",role:"status","aria-label":"loading"}):h("svg",{slot:"icon-start",style:{display:"none"},xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M18 7.5v3m0 0v3m0-3h3m-3 0h-3m-2.25-4.125a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0ZM3 19.235v-.11a6.375 6.375 0 0 1 12.75 0v.109A12.318 12.318 0 0 1 9.374 21c-2.331 0-4.512-.645-6.374-1.766Z"})))))}static get style(){return NlImportFlowStyle0}},[0,"nl-import-flow",{titleInfo:[1025,"title-info"],titleImport:[1,"title-import"],services:[16],isContinued:[32],isKeyBackup:[32],isCopy:[32]}]);function defineCustomElement$l(){typeof customElements>"u"||["nl-import-flow","button-base","nl-select"].forEach(e=>{switch(e){case"nl-import-flow":customElements.get(e)||customElements.define(e,NlImportFlow$1);break;case"button-base":customElements.get(e)||defineCustomElement$q();break;case"nl-select":customElements.get(e)||defineCustomElement$m()}})}defineCustomElement$l();const nlInfoCss=baseCss,NlInfoStyle0=nlInfoCss,NlInfo=proxyCustomElement(class extends H{constructor(){super(),this.__registerHost()}render(){return h("div",{key:"7463f42c27643903a9d6fb0160fbabe833679fcb",class:"p-4 overflow-y-auto"},h("svg",{key:"86c5f04f87b21553f3512d289425996b46eb6c57",class:"w-12 h-12 mx-auto mb-2",width:"225",height:"224",viewBox:"0 0 225 224",fill:"none",xmlns:"http://www.w3.org/2000/svg"},h("rect",{key:"6be61e0b2ff3d3f13e617e9b1df073fbe3b5678b",width:"224.047",height:"224",rx:"64",fill:"#6951FA"}),h("path",{key:"0c0aff7d5143022fe857de141cdae31397c3c2f4",d:"M162.441 135.941V88.0593C170.359 85.1674 176 77.5348 176 68.6696C176 57.2919 166.708 48 155.33 48C143.953 48 134.661 57.2444 134.661 68.6696C134.661 77.5822 140.302 85.1674 148.219 88.0593V135.941C147.698 136.13 147.176 136.367 146.655 136.604L87.3956 77.3452C88.6282 74.6904 89.2919 71.7511 89.2919 68.6696C89.2919 57.2444 80.0474 48 68.6696 48C57.2919 48 48 57.2444 48 68.6696C48 77.5822 53.6415 85.1674 61.5585 88.0593V135.941C53.6415 138.833 48 146.465 48 155.33C48 166.708 57.2444 176 68.6696 176C80.0948 176 89.3393 166.708 89.3393 155.33C89.3393 146.418 83.6978 138.833 75.7807 135.941V88.0593C76.3022 87.8696 76.8237 87.6326 77.3452 87.3956L136.604 146.655C135.372 149.31 134.708 152.249 134.708 155.33C134.708 166.708 143.953 176 155.378 176C166.803 176 176.047 166.708 176.047 155.33C176.047 146.418 170.406 138.833 162.489 135.941H162.441Z",fill:"white"})),h("h1",{key:"3a89ee5051e2d74945347dec6055749cec126f27",class:"nl-title font-bold text-center text-4xl"},"Nostr ",h("span",{key:"96a49c22dffa4a30639f387a949d7695604c6a1f",class:"font-light"},"Login")),h("p",{key:"a6dded720da9db673173a1ff02bc5544e6a66d38",class:"text-green-800 dark:text-green-200 font-light text-center text-lg pt-2 max-w-96 mx-auto"},"Version: 1.7.11"),h("p",{key:"9d9dbd36ade753d30db448139dc057921f29697d",class:"nl-description font-light text-center text-lg pt-2 max-w-96 mx-auto"},"Learn more about Nostr"," ",h("a",{key:"1811ad4f1acda7f5235566ea6f2ce8e70c62c91c",target:"_blank",href:"https://nostr.how"},"here"),".",h("br",{key:"127a6127e71f43caa1c262c6ec8108a5a6f40774"}),"This is an"," ",h("a",{key:"0e18839f8577229533eb2d2ef00f8657e6396aa1",target:"_blank",href:"https://github.com/nostrband/nostr-login"},"open-source")," ","tool by"," ",h("a",{key:"9affd14ad9dedae3e5d269a1477343eae63cd46b",target:"_blank",href:"https://nostr.band"},"Nostr.Band"),"."))}static get style(){return NlInfoStyle0}},[0,"nl-info"]);function defineCustomElement$k(){typeof customElements>"u"||["nl-info"].forEach(e=>{e==="nl-info"&&(customElements.get(e)||customElements.define(e,NlInfo))})}defineCustomElement$k();const nlInfoExtensionCss=baseCss,NlInfoExtensionStyle0=nlInfoExtensionCss,NlInfoExtension=proxyCustomElement(class extends H{constructor(){super(),this.__registerHost()}render(){return h("div",{key:"9335feb745c6d09a213a2e771c40262036341b54",class:"p-4 overflow-y-auto"},state.isLoadingExtension?h("div",null,h("h1",{class:"nl-title font-bold text-center text-4xl"},"Signing in..."),h("div",{class:"mt-10 mb-10 ml-auto mr-auto w-20"},h("span",{slot:"icon-start",class:"animate-spin-loading ml-auto mr-auto inline-block w-20 h-20 border-[4px] border-current border-t-transparent text-slate-900 dark:text-gray-300 rounded-full",role:"status","aria-label":"loading"})),h("div",{class:"ps-4 pe-4 overflow-y-auto"},h("p",{class:"nl-error font-light text-center text-sm max-w-96 mx-auto"},state.error))):h("div",null,h("h1",{class:"nl-title font-bold text-center text-4xl"},"Install browser extension!"),h("p",{class:"nl-description font-light text-center text-lg pt-2 max-w-96 mx-auto"},"Try"," ",h("a",{href:"https://getalby.com",target:"_blank"},"Alby"),","," ",h("a",{href:"https://chromewebstore.google.com/detail/nos2x/kpgefcfmnafjgpblomihpgmejjdanjjp",target:"_blank"},"nos2x")," ","or"," ",h("a",{href:"https://apps.apple.com/us/app/nostore/id1666553677",target:"_blank"},"Nostore"))))}static get style(){return NlInfoExtensionStyle0}},[0,"nl-info-extension"]);function defineCustomElement$j(){typeof customElements>"u"||["nl-info-extension"].forEach(e=>{e==="nl-info-extension"&&(customElements.get(e)||customElements.define(e,NlInfoExtension))})}defineCustomElement$j();const nlLoadingCss=baseCss,NlLoadingStyle0=nlLoadingCss,NlLoading=proxyCustomElement(class extends H{constructor(){super(),this.__registerHost(),this.stopFetchHandler=createEvent(this,"stopFetchHandler"),this.handleContinue=createEvent(this,"handleContinue"),this.path=void 0}handleStop(e){e.preventDefault(),this.stopFetchHandler.emit()}handleContinueClick(e){e.preventDefault(),this.handleContinue.emit()}render(){let e="Connecting...",t="Establishing connection to your key storage.";state.njumpIframe?(e="",t=""):this.path===CURRENT_MODULE.LOCAL_SIGNUP?(e="Creating...",t="Publishing your profile on Nostr."):state.authUrl&&(state.isLoading?(e="Confirming...",t="Please confirm the connection in your key storage app."):(e="Almost ready!",t="Continue to confirm the connection to your key storage."));const n=this.path!==CURRENT_MODULE.LOCAL_SIGNUP,r=!state.isLoading&&state.iframeUrl&&state.authUrl,o=state.iframeUrl?`${state.iframeUrl}?connect=${encodeURIComponent(state.authUrl)}`:"";return h("div",{key:"ff7ae663f31e7c0e10a0f10d45314519f08d5199",class:"p-4 overflow-y-auto"},e&&h("h1",{key:"86c13915dd489fd9182263edd47835cbe6c0c24a",class:"nl-title font-bold text-center text-4xl"},e),t&&h("p",{key:"23b2cc3700b833e0c4575c4b5833dce77b51af78",class:"nl-description font-light text-center text-lg pt-2 max-w-96 mx-auto"},t),!state.njumpIframe&&!state.authUrl&&state.isLoading&&h("div",{key:"8f7da53775a410de55c26a706d70a5954ff3231c",class:"mt-10 mb-10 ml-auto mr-auto w-20"},h("span",{key:"15e94a6bf7a0a4471e2d4e6bd0bce5eb5cd3dc0a",slot:"icon-start",class:"animate-spin-loading ml-auto mr-auto inline-block w-20 h-20 border-[4px] border-current border-t-transparent text-slate-900 dark:text-gray-300 rounded-full",role:"status","aria-label":"loading"})),h("div",{key:"c32c535e64608e4d7bc11df9d0ee5360604ec9ea",class:"ps-4 pe-4 overflow-y-auto"},h("p",{key:"73e123470d5d0466a2690cd9ba947663e550afda",class:"nl-error font-light text-center text-sm max-w-96 mx-auto"},state.error)),o&&h("div",{key:"e6778c319037c8621aff5d34d1d2b3f0cbfc1c1e",class:"mt-3 ml-auto mr-auto w-72 flex justify-center"},h("iframe",{key:"d202f154ef014e96eae19e3f97432113a71127d4",src:o,width:"180px",height:"80px",style:{display:r?"block":"none",border:"0"}})),state.njumpIframe&&h("div",{key:"8fdc700c3983574930b14ea04448fb8123dfb83a",class:"mt-3 ml-auto mr-auto flex justify-center"},h("iframe",{key:"eafaf5df4a3ecbfba3d191c3e1b1c63181bdb41b",srcdoc:state.njumpIframe,width:"600px",style:{border:"0",height:"80vh",borderRadius:"8px"}})),!r&&n&&h("div",{key:"1557f1de773239d199e10249c45bc3684dee1773",class:"mt-3 ml-auto mr-auto w-72"},h("button-base",{key:"1f33346f69d5b2a670f0e507e48855376b82e679",onClick:s=>{state.authUrl&&!state.isLoading?this.handleContinueClick(s):this.handleStop(s)},titleBtn:state.isLoading?"Cancel":"Continue"})))}static get style(){return NlLoadingStyle0}},[0,"nl-loading",{path:[1]}]);function defineCustomElement$i(){typeof customElements>"u"||["nl-loading","button-base"].forEach(e=>{switch(e){case"nl-loading":customElements.get(e)||customElements.define(e,NlLoading);break;case"button-base":customElements.get(e)||defineCustomElement$q()}})}defineCustomElement$i();const nlLocalSignupCss=baseCss,NlLocalSignupStyle0=nlLocalSignupCss,NlLocalSignup=proxyCustomElement(class extends H{constructor(){super(),this.__registerHost(),this.nlLocalSignup=createEvent(this,"nlLocalSignup"),this.nlSignupNjump=createEvent(this,"nlSignupNjump"),this.fetchHandler=createEvent(this,"fetchHandler"),this.titleSignup="Create Nostr profile",this.description="Choose any username, you can always change it later.",this.descriptionNjump="Proceed to creating your Nostr profile in a new tab.",this.signupNjump=!1,this.isAvailable=!1}handleInputChange(e){state.nlSignup.signupName=e.target.value}handleCreateAccount(e){e.preventDefault(),this.signupNjump?this.nlSignupNjump.emit():this.nlLocalSignup.emit(`${state.nlSignup.signupName}`)}render(){return h(Fragment,{key:"6ea0144cad11803864f8d6b5bc7896d8d9b413cf"},h("div",{key:"be257a544937601e20521adac8ec98b46a6c8af5",class:"p-4 overflow-y-auto"},h("h1",{key:"c8e91ccc003d0a6e344010a41bb47eeec1abdbf0",class:"nl-title font-bold text-center text-2xl"},this.titleSignup),h("p",{key:"e71ee5aa6ac01059b63ee2245800c3659301ec06",class:"nl-description font-light text-center text-sm pt-2 max-w-96 mx-auto"},this.signupNjump?this.descriptionNjump:this.description)),h("div",{key:"516c8c44b6936554b96151a4fe4a9b6af614b554",class:"max-w-72 mx-auto"},!this.signupNjump&&h("div",{key:"a74e48d36f120fe249abfd57131c2bfde7f3dce4",class:"relative mb-2"},h("input",{key:"b77730184df9033291010d4e8ead166be726e8d9",onInput:e=>this.handleInputChange(e),type:"text",class:"nl-input peer py-3 px-4 ps-11 block w-full border-transparent rounded-lg text-sm disabled:opacity-50 disabled:pointer-events-none dark:border-transparent",placeholder:"Enter username",value:state.nlSignup.signupName}),h("div",{key:"cc061801a575391e879759c5873e8256fc68f547",class:"absolute inset-y-0 start-0 flex items-center pointer-events-none ps-4 peer-disabled:opacity-50 peer-disabled:pointer-events-none"},h("svg",{key:"909c6728e8f26012647a3c9b3de8f4b16ae31e80",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:this.isAvailable?"#00cc00":"currentColor",class:"flex-shrink-0 w-4 h-4 text-gray-500"},h("path",{key:"0306f3c147c376bbd7b01b3e2eca178f339ac167","stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 6a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0ZM4.501 20.118a7.5 7.5 0 0 1 14.998 0A17.933 17.933 0 0 1 12 21.75c-2.676 0-5.216-.584-7.499-1.632Z"})))),h("div",{key:"77368eeb60108aeec228e83aa206ef2b2d3fa27a",class:"ps-4 pe-4 overflow-y-auto"},h("p",{key:"e87a1ae66cfaf9a75cb723a29e57c5e0ff54aabd",class:"nl-error font-light text-center text-sm max-w-96 mx-auto"},state.error)),h("button-base",{key:"99ce9506bf5db9c26d916314e1e5700bf515f1b7",disabled:state.isLoading,onClick:e=>this.handleCreateAccount(e),titleBtn:this.signupNjump?"Get started":"Create profile"},state.isLoading?h("span",{slot:"icon-start",class:"animate-spin-loading inline-block w-4 h-4 border-[3px] border-current border-t-transparent text-slate-900 dark:text-gray-300 rounded-full",role:"status","aria-label":"loading"}):h("svg",{slot:"icon-start",style:{display:"none"},xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M18 7.5v3m0 0v3m0-3h3m-3 0h-3m-2.25-4.125a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0ZM3 19.235v-.11a6.375 6.375 0 0 1 12.75 0v.109A12.318 12.318 0 0 1 9.374 21c-2.331 0-4.512-.645-6.374-1.766Z"})))))}static get style(){return NlLocalSignupStyle0}},[0,"nl-local-signup",{titleSignup:[1,"title-signup"],description:[1],descriptionNjump:[1,"description-njump"],signupNjump:[4,"signup-njump"],isAvailable:[32]}]);function defineCustomElement$h(){typeof customElements>"u"||["nl-local-signup","button-base"].forEach(e=>{switch(e){case"nl-local-signup":customElements.get(e)||customElements.define(e,NlLocalSignup);break;case"button-base":customElements.get(e)||defineCustomElement$q()}})}defineCustomElement$h();const NlLoginStatus=proxyCustomElement(class extends H{constructor(){super(),this.__registerHost(),this.info=void 0}render(){let e="",t="";if(this.info.authMethod==="extension")e="Extension",t="border-yellow-300 text-yellow-500 bg-yellow-100";else if(this.info.authMethod==="readOnly")e="Read only",t="border-gray-300 text-gray-400 bg-gray-100";else if(this.info.authMethod==="connect")e="Connect",t="border-teal-300 text-teal-600 bg-teal-100";else if(this.info.authMethod==="local")e="Temporary",t="border-red-300 text-red-600 bg-red-100";else{if(this.info.authMethod!=="otp")throw console.log("unknown auth method",this.info),new Error("Unknown auth method");e="Delegated",t="border-orange-300 text-orange-600 bg-orange-100"}return h("div",{key:"f0e9b20820467a4c427fa60bd1879e3ac7cc7f62"},h("span",{key:"4c96936eac7dbe558e398f9cff963873659f4aec",class:`${t} rounded-xl border w-auto text-[10px] px-1 `},e))}},[0,"nl-login-status",{info:[16]}]);function defineCustomElement$g(){typeof customElements>"u"||["nl-login-status"].forEach(e=>{e==="nl-login-status"&&(customElements.get(e)||customElements.define(e,NlLoginStatus))})}defineCustomElement$g();const nlOtpMigrateCss=baseCss,NlOtpMigrateStyle0=nlOtpMigrateCss,NlImportFlow=proxyCustomElement(class extends H{constructor(){super(),this.__registerHost(),this.nlImportAccount=createEvent(this,"nlImportAccount"),this.titleInfo="Import keys to storage service",this.titleImport="Choose a service",this.textImport="You will be prompted to import keys to the chosen service, and this website will connect to your keys.",this.services=[]}handleDomainSelect(e){const t=this.services.find(n=>n.domain===e.detail);state.nlImport=t}handleCreateAccount(e){e.preventDefault(),this.nlImportAccount.emit(state.nlImport)}render(){const e=this.services.filter(t=>t.canImport).map(t=>({name:t.domain,value:t.domain}));return h(Fragment,{key:"8295d7fd819696a264100c3c1834a7e943f3f60e"},h("div",{key:"4d0e48726fccfe24be45db8ef328b25b4778763c",class:"p-4 overflow-y-auto"},h("h1",{key:"8a035ea913fa770188e62557971649a223fe7ed8",class:"nl-title font-bold text-center text-2xl"},this.titleImport),h("p",{key:"ad9c8565205acafeea8ab3991cc405ae84a6c95a",class:"nl-description font-light text-center text-sm pt-2 max-w-96 mx-auto"},this.textImport)),h("div",{key:"7ee07d8ac0fc0278f342e794686126465b643278",class:"max-w-72 mx-auto mb-5"},h("div",{key:"677ca636b72bcefc6092e2e09b8c0ad445a956f6",class:"mb-0.5"},h("nl-select",{key:"8ec042faaa8319c0d683818cfa5321c20b2e6a57",onSelectDomain:t=>this.handleDomainSelect(t),selected:0,options:e})),h("p",{key:"d6348d95a65a003047e0961a9b8b86835bcebf1f",class:"nl-title font-light text-sm mb-2"},"Default provider is a fine choice to start with."),h("div",{key:"df09b9b23fd192407f797d8b191a30ca3a649142",class:"ps-4 pe-4 overflow-y-auto"},h("p",{key:"77901d809985d421f9be1e7ff6e5263db52aa37f",class:"nl-error font-light text-center text-sm max-w-96 mx-auto"},state.error)),h("button-base",{key:"87eb6648d8d5e4e4990f745c507bcaacddc6676a",disabled:state.isLoading,onClick:t=>this.handleCreateAccount(t),titleBtn:"Start importing"},state.isLoading?h("span",{slot:"icon-start",class:"animate-spin-loading inline-block w-4 h-4 border-[3px] border-current border-t-transparent text-slate-900 dark:text-gray-300 rounded-full",role:"status","aria-label":"loading"}):h("svg",{slot:"icon-start",style:{display:"none"},xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M18 7.5v3m0 0v3m0-3h3m-3 0h-3m-2.25-4.125a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0ZM3 19.235v-.11a6.375 6.375 0 0 1 12.75 0v.109A12.318 12.318 0 0 1 9.374 21c-2.331 0-4.512-.645-6.374-1.766Z"})))))}static get style(){return NlOtpMigrateStyle0}},[0,"nl-otp-migrate",{titleInfo:[1025,"title-info"],titleImport:[1,"title-import"],textImport:[1,"text-import"],services:[16]}]);function defineCustomElement$f(){typeof customElements>"u"||["nl-otp-migrate","button-base","nl-select"].forEach(e=>{switch(e){case"nl-otp-migrate":customElements.get(e)||customElements.define(e,NlImportFlow);break;case"button-base":customElements.get(e)||defineCustomElement$q();break;case"nl-select":customElements.get(e)||defineCustomElement$m()}})}defineCustomElement$f();const nlPreviouslyLoggedCss=baseCss,NlPreviouslyLoggedStyle0=nlPreviouslyLoggedCss,NlPreviouslyLogged=proxyCustomElement(class extends H{constructor(){super(),this.__registerHost(),this.nlSwitchAccount=createEvent(this,"nlSwitchAccount"),this.nlLoginRecentAccount=createEvent(this,"nlLoginRecentAccount"),this.nlRemoveRecent=createEvent(this,"nlRemoveRecent"),this.titlePage="Your profiles",this.description="Switch between active profiles or choose a recent one for fast login.",this.accounts=[],this.recents=[]}handleGoToWelcome(){state.path=[CURRENT_MODULE.WELCOME]}switchToWelcomeIfEmpty(){this.recents.length||this.accounts.length||(state.path=[CURRENT_MODULE.WELCOME])}watchAccounts(){this.switchToWelcomeIfEmpty()}watchRecents(){this.switchToWelcomeIfEmpty()}handleRemoveRecent(e){this.nlRemoveRecent.emit(e)}handleSwitch(e){this.nlSwitchAccount.emit(e)}handleLoginRecentAccount(e){this.nlLoginRecentAccount.emit(e)}render(){return h(Fragment,{key:"cd2b0c3c8949cf948e41ded42e7f75ef079fccc4"},h("div",{key:"32115943896e66bc20490610e26bd01f9e14457a",class:"p-4 pt-0 overflow-y-auto"},h("h1",{key:"a889d10b7704cdc080f48cde372f505896b456b6",class:"nl-title font-bold text-center text-4xl"},this.titlePage),h("p",{key:"030784a7a9b4366bd4dcf1755b470f2bfbdf4c14",class:"nl-description font-light text-center text-lg pt-2 max-w-96 mx-auto"},this.description)),h("div",{key:"a8c2afeeebc96527e1ca5b36cb3a2a544f6d50b4",class:"p-4"},!!this.accounts.length&&h("div",{key:"1f504e1448c1c60c9cf97eb5e18328d8935af54d",class:"max-w-96 mx-auto"},h("p",{key:"fed353027e7847653d869bef971229b6e862b6f3",class:"nl-description font-medium text-sm pb-1.5"},"Active profiles"),h("ul",{key:"d8aa546725b5248e180d88bb384521076eeb3a30",class:"p-2 rounded-lg border border-blue-200 flex flex-col w-full gap-0.5"},this.accounts.map(e=>{const t=!!(e!=null&&e.picture),n=e.name||e.nip05||e.pubkey,r=!!n;return h("li",{onClick:()=>this.handleSwitch(e),class:"group hover:bg-gray-400 flex cursor-pointer gap-x-3.5 py-2 px-3 rounded-lg text-sm items-center justify-between"},h("div",{class:"flex items-center gap-x-3.5 w-full"},h("div",{class:"w-full max-w-7 h-7 flex relative"},h("div",{class:"absolute top-[-2px] right-[-2px] bg-white border-2 border-white rounded-xl"},h("div",{class:"active h-1.5 w-1.5 bg-green-500 rounded-xl"})),h("div",{class:"group-hover:border-blue-400 uppercase font-bold w-full h-full rounded-full border border-gray-400 flex justify-center items-center"},t?h("img",{class:"w-full rounded-full",src:e.picture,alt:"Logo"}):r?n[0]:h("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-full"},h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M17.982 18.725A7.488 7.488 0 0 0 12 15.75a7.488 7.488 0 0 0-5.982 2.975m11.963 0a9 9 0 1 0-11.963 0m11.963 0A8.966 8.966 0 0 1 12 21a8.966 8.966 0 0 1-5.982-2.275M15 9.75a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})))),h("div",{class:"overflow-hidden flex flex-col w-full"},h("div",{class:"nl-title truncate overflow-hidden"},n),h("nl-login-status",{info:e}))))}))),!!this.recents.length&&h("div",{key:"15a0033a26712020d4cdc0665335047215dcb6fc",class:"max-w-96 mx-auto pt-5"},h("p",{key:"95d4c1270ebe75291b4ccb0b98ad8002a6e6d6b3",class:"nl-description font-medium text-sm pb-1.5"},"Recent profiles"),h("ul",{key:"9e126af579e621e51c9b3cc66585b0285c941e52",class:"p-2 rounded-lg border border-gray-200 flex flex-col w-full gap-0.5"},this.recents.map(e=>{const t=!!(e!=null&&e.picture),n=e.name||e.nip05||e.pubkey,r=!!n;return h("li",{onClick:()=>this.handleLoginRecentAccount(e),class:"flex items-center gap-x-3.5 w-full hover:bg-gray-400 flex cursor-pointer items-center gap-x-3.5 py-2 px-3 rounded-lg text-sm justify-between"},h("div",{class:"w-full max-w-7 h-7 flex relative"},h("div",{class:"absolute top-[-3px] right-[-3px] bg-white border border-white rounded-xl"},h("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-3 h-3"},h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))),h("div",{class:"uppercase font-bold w-full h-full rounded-full border border-gray-400 flex justify-center items-center"},t?h("img",{class:"w-full rounded-full",src:e.picture,alt:"Logo"}):r?n[0]:h("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-full"},h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M17.982 18.725A7.488 7.488 0 0 0 12 15.75a7.488 7.488 0 0 0-5.982 2.975m11.963 0a9 9 0 1 0-11.963 0m11.963 0A8.966 8.966 0 0 1 12 21a8.966 8.966 0 0 1-5.982-2.275M15 9.75a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})))),h("div",{class:"overflow-hidden flex flex-col w-full"},h("div",{class:"nl-title truncate overflow-hidden"},n),h("nl-login-status",{info:e})),h("svg",{onClick:o=>{o.stopPropagation(),this.handleRemoveRecent(e)},xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-full max-w-6 h-6 text-red-500 hover:text-red-600 ml-auto"},h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"})))})))),h("div",{key:"4c1788fd1722ec954333fc024b502b56c397c5b8",class:"p-4 overflow-y-auto"},h("p",{key:"6f7ab030e88c3cb08b45533c465ab4dc4ca1cacb",class:"nl-footer font-light text-center text-sm max-w-96 mx-auto"},"You can also"," ",h("span",{key:"bf4e2b5222afab40c8098ebd22025596df85bf7f",onClick:()=>this.handleGoToWelcome(),class:"cursor-pointer pb-3 text-blue-500"},"add another profile"))))}static get watchers(){return{accounts:["watchAccounts"],recents:["watchRecents"]}}static get style(){return NlPreviouslyLoggedStyle0}},[0,"nl-previously-logged",{titlePage:[1,"title-page"],description:[1],accounts:[16],recents:[16]},void 0,{accounts:["watchAccounts"],recents:["watchRecents"]}]);function defineCustomElement$e(){typeof customElements>"u"||["nl-previously-logged","nl-login-status"].forEach(e=>{switch(e){case"nl-previously-logged":customElements.get(e)||customElements.define(e,NlPreviouslyLogged);break;case"nl-login-status":customElements.get(e)||defineCustomElement$g()}})}defineCustomElement$e();const nlSigninCss=baseCss,NlSigninStyle0=nlSigninCss,NlSignin=proxyCustomElement(class extends H{constructor(){super(),this.__registerHost(),this.nlLogin=createEvent(this,"nlLogin"),this.nlCheckLogin=createEvent(this,"nlCheckLogin"),this.titleLogin="Connect to key store",this.description="Please enter your user name.",this.isGood=!1}handleInputChange(e){state.nlSignin.loginName=e.target.value,this.nlCheckLogin.emit(e.target.value)}handleLogin(e){e.preventDefault(),this.nlLogin.emit(state.nlSignin.loginName)}render(){return h(Fragment,{key:"9375186e2638a4ec14c0fd6bd4954c68a6695d0a"},h("div",{key:"915342c0300b6ac7f6c5c84060117cf4b54c1bb2",class:"p-4 overflow-y-auto"},h("h1",{key:"c43f028b47c5ac566afda65cca1728fdade271a8",class:"nl-title font-bold text-center text-2xl"},this.titleLogin),h("p",{key:"d55111de6c8da0e06b957eb97fc66c3f25dd19a0",class:"nl-description font-light text-center text-sm pt-2 max-w-96 mx-auto"},this.description)),h("div",{key:"4105fbbe19bf83b1eb23d2b75bf936abc121db52",class:"max-w-72 mx-auto"},h("div",{key:"319964a6a9cdce3e2857a3722212f9f2c14a9657",class:"relative mb-2"},h("input",{key:"5016006907ecde3717f9ef32a04a5a93e5e8dd1c",onInput:e=>this.handleInputChange(e),type:"text",class:"nl-input peer py-3 px-4 ps-11 block w-full border-transparent rounded-lg text-sm disabled:opacity-50 disabled:pointer-events-none dark:border-transparent",placeholder:"name@domain.com",value:state.nlSignin.loginName}),h("div",{key:"1a02c7e5b6ece79557e05c67f10fae224b3eab13",class:"absolute inset-y-0 start-0 flex items-center pointer-events-none ps-4 peer-disabled:opacity-50 peer-disabled:pointer-events-none"},h("svg",{key:"4ed7bc02af0383f5d378132df916a40eab90594d",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:this.isGood?"#00cc00":"currentColor",class:"flex-shrink-0 w-4 h-4 text-gray-500"},h("path",{key:"f6d18366b44aaa84f72a7f4c8c6bc4de9d914254","stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 6a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0ZM4.501 20.118a7.5 7.5 0 0 1 14.998 0A17.933 17.933 0 0 1 12 21.75c-2.676 0-5.216-.584-7.499-1.632Z"})))),h("div",{key:"9325a0734cee2e749f8d0bd24177f0ae98031769",class:"ps-4 pe-4 overflow-y-auto"},h("p",{key:"692b415ff9e06d6c79cd893bb01eadb6cc0dcaf6",class:"nl-error font-light text-center text-sm max-w-96 mx-auto"},state.error)),h("button-base",{key:"b53079a6c2d6551ab18f9abe46d28bcfa3ee1e63",titleBtn:"Connect",disabled:state.isLoading,onClick:e=>this.handleLogin(e)},state.isLoading?h("span",{slot:"icon-start",class:"animate-spin-loading inline-block w-4 h-4 border-[3px] border-current border-t-transparent text-slate-900 dark:text-gray-300 rounded-full",role:"status","aria-label":"loading"}):h("svg",{style:{display:"none"},slot:"icon-start",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 9V5.25A2.25 2.25 0 0 1 10.5 3h6a2.25 2.25 0 0 1 2.25 2.25v13.5A2.25 2.25 0 0 1 16.5 21h-6a2.25 2.25 0 0 1-2.25-2.25V15M12 9l3 3m0 0-3 3m3-3H2.25"})))))}static get style(){return NlSigninStyle0}},[0,"nl-signin",{titleLogin:[1,"title-login"],description:[1],isGood:[32]}]);function defineCustomElement$d(){typeof customElements>"u"||["nl-signin","button-base"].forEach(e=>{switch(e){case"nl-signin":customElements.get(e)||customElements.define(e,NlSignin);break;case"button-base":customElements.get(e)||defineCustomElement$q()}})}defineCustomElement$d();const nlSigninBunkerUrlCss=baseCss,NlSigninBunkerUrlStyle0=nlSigninBunkerUrlCss,NlSigninBunkerUrl=proxyCustomElement(class extends H{constructor(){super(),this.__registerHost(),this.nlLogin=createEvent(this,"nlLogin"),this.nlCheckLogin=createEvent(this,"nlCheckLogin"),this.titleLogin="Connect with bunker url",this.description="Please enter a bunker url provided by key store.",this.isGood=!1}handleInputChange(e){state.nlSigninBunkerUrl.loginName=e.target.value,this.nlCheckLogin.emit(e.target.value)}handleLogin(e){e.preventDefault(),this.nlLogin.emit(state.nlSigninBunkerUrl.loginName)}render(){return h(Fragment,{key:"3a422253215916369f1c65894fd90e17732a735e"},h("div",{key:"ace79364c3c4c858b43746a5c5e05f925c78402b",class:"p-4 overflow-y-auto"},h("h1",{key:"1c7cdc50eff87cac91f4387b96f89109ca84f7cd",class:"nl-title font-bold text-center text-2xl"},this.titleLogin),h("p",{key:"dd25754386d05d8cc4035e29b9aa555de08756e1",class:"nl-description font-light text-center text-sm pt-2 max-w-96 mx-auto"},this.description)),h("div",{key:"1684b906cd07ec17d55db1f1f1aad37ba9b72121",class:"max-w-72 mx-auto"},h("div",{key:"ec6a77d2793a0e4ea383991ddcc593c8235e3443",class:"relative mb-2"},h("input",{key:"2f8440550f9db57b131556c5d4e88228cc2db277",onInput:e=>this.handleInputChange(e),type:"text",class:"nl-input peer py-3 px-4 ps-11 block w-full border-transparent rounded-lg text-sm disabled:opacity-50 disabled:pointer-events-none dark:border-transparent",placeholder:"bunker://...",value:state.nlSigninBunkerUrl.loginName}),h("div",{key:"7718e520a18b35bdd89b6c4f835e01c304b9dcbb",class:"absolute inset-y-0 start-0 flex items-center pointer-events-none ps-4 peer-disabled:opacity-50 peer-disabled:pointer-events-none"},h("svg",{key:"f0c09de6a0cc3040cd7a52815e83318e270706b4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:this.isGood?"#00cc00":"currentColor",class:"flex-shrink-0 w-4 h-4 text-gray-500"},h("path",{key:"93069f3407609c925ee8d14bea26245cf12afe9b","stroke-linecap":"round","stroke-linejoin":"round",d:"M13.19 8.688a4.5 4.5 0 0 1 1.242 7.244l-4.5 4.5a4.5 4.5 0 0 1-6.364-6.364l1.757-1.757m13.35-.622 1.757-1.757a4.5 4.5 0 0 0-6.364-6.364l-4.5 4.5a4.5 4.5 0 0 0 1.242 7.244"})))),h("div",{key:"94a2a34d9275dbf6fa9819f71eb819f1fcffcdf0",class:"ps-4 pe-4 overflow-y-auto"},h("p",{key:"9bfbaadcac84780014802805aa82ff8b079dd698",class:"nl-error font-light text-center text-sm max-w-96 mx-auto"},state.error)),h("button-base",{key:"30534a179e1fbdfd3849de2b7d2dcc9b15351444",titleBtn:"Connect",disabled:state.isLoading,onClick:e=>this.handleLogin(e)},state.isLoading?h("span",{slot:"icon-start",class:"animate-spin-loading inline-block w-4 h-4 border-[3px] border-current border-t-transparent text-slate-900 dark:text-gray-300 rounded-full",role:"status","aria-label":"loading"}):h("svg",{style:{display:"none"},slot:"icon-start",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 9V5.25A2.25 2.25 0 0 1 10.5 3h6a2.25 2.25 0 0 1 2.25 2.25v13.5A2.25 2.25 0 0 1 16.5 21h-6a2.25 2.25 0 0 1-2.25-2.25V15M12 9l3 3m0 0-3 3m3-3H2.25"})))))}static get style(){return NlSigninBunkerUrlStyle0}},[0,"nl-signin-bunker-url",{titleLogin:[1,"title-login"],description:[1],isGood:[32]}]);function defineCustomElement$c(){typeof customElements>"u"||["nl-signin-bunker-url","button-base"].forEach(e=>{switch(e){case"nl-signin-bunker-url":customElements.get(e)||customElements.define(e,NlSigninBunkerUrl);break;case"button-base":customElements.get(e)||defineCustomElement$q()}})}defineCustomElement$c();var browser$1={},canPromise$1=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},qrcode={},utils$1$1={};let toSJISFunction;const CODEWORDS_COUNT=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];utils$1$1.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return 4*e+17},utils$1$1.getSymbolTotalCodewords=function(e){return CODEWORDS_COUNT[e]},utils$1$1.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},utils$1$1.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');toSJISFunction=e},utils$1$1.isKanjiModeEnabled=function(){return toSJISFunction!==void 0},utils$1$1.toSJIS=function(e){return toSJISFunction(e)};var errorCorrectionLevel={},exports$1;function BitBuffer$1(){this.buffer=[],this.length=0}exports$1=errorCorrectionLevel,exports$1.L={bit:1},exports$1.M={bit:0},exports$1.Q={bit:3},exports$1.H={bit:2},exports$1.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},exports$1.from=function(e,t){if(exports$1.isValid(e))return e;try{return function(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"l":case"low":return exports$1.L;case"m":case"medium":return exports$1.M;case"q":case"quartile":return exports$1.Q;case"h":case"high":return exports$1.H;default:throw new Error("Unknown EC Level: "+n)}}(e)}catch{return t}},BitBuffer$1.prototype={get:function(e){const t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var bitBuffer=BitBuffer$1;function BitMatrix$1(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}BitMatrix$1.prototype.set=function(e,t,n,r){const o=e*this.size+t;this.data[o]=n,r&&(this.reservedBit[o]=!0)},BitMatrix$1.prototype.get=function(e,t){return this.data[e*this.size+t]},BitMatrix$1.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},BitMatrix$1.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var bitMatrix=BitMatrix$1,alignmentPattern={};(function(e){const t=utils$1$1.getSymbolSize;e.getRowColCoords=function(n){if(n===1)return[];const r=Math.floor(n/7)+2,o=t(n),s=o===145?26:2*Math.ceil((o-13)/(2*r-2)),i=[o-7];for(let a=1;a<r-1;a++)i[a]=i[a-1]-s;return i.push(6),i.reverse()},e.getPositions=function(n){const r=[],o=e.getRowColCoords(n),s=o.length;for(let i=0;i<s;i++)for(let a=0;a<s;a++)i===0&&a===0||i===0&&a===s-1||i===s-1&&a===0||r.push([o[i],o[a]]);return r}})(alignmentPattern);var finderPattern={};const getSymbolSize=utils$1$1.getSymbolSize,FINDER_PATTERN_SIZE=7;finderPattern.getPositions=function(e){const t=getSymbolSize(e);return[[0,0],[t-FINDER_PATTERN_SIZE,0],[0,t-FINDER_PATTERN_SIZE]]};var maskPattern={};(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t=3,n=3,r=40,o=10;function s(i,a,l){switch(i){case e.Patterns.PATTERN000:return(a+l)%2==0;case e.Patterns.PATTERN001:return a%2==0;case e.Patterns.PATTERN010:return l%3==0;case e.Patterns.PATTERN011:return(a+l)%3==0;case e.Patterns.PATTERN100:return(Math.floor(a/2)+Math.floor(l/3))%2==0;case e.Patterns.PATTERN101:return a*l%2+a*l%3==0;case e.Patterns.PATTERN110:return(a*l%2+a*l%3)%2==0;case e.Patterns.PATTERN111:return(a*l%3+(a+l)%2)%2==0;default:throw new Error("bad maskPattern:"+i)}}e.isValid=function(i){return i!=null&&i!==""&&!isNaN(i)&&i>=0&&i<=7},e.from=function(i){return e.isValid(i)?parseInt(i,10):void 0},e.getPenaltyN1=function(i){const a=i.size;let l=0,c=0,d=0,p=null,g=null;for(let v=0;v<a;v++){c=d=0,p=g=null;for(let x=0;x<a;x++){let b=i.get(v,x);b===p?c++:(c>=5&&(l+=t+(c-5)),p=b,c=1),b=i.get(x,v),b===g?d++:(d>=5&&(l+=t+(d-5)),g=b,d=1)}c>=5&&(l+=t+(c-5)),d>=5&&(l+=t+(d-5))}return l},e.getPenaltyN2=function(i){const a=i.size;let l=0;for(let c=0;c<a-1;c++)for(let d=0;d<a-1;d++){const p=i.get(c,d)+i.get(c,d+1)+i.get(c+1,d)+i.get(c+1,d+1);p!==4&&p!==0||l++}return l*n},e.getPenaltyN3=function(i){const a=i.size;let l=0,c=0,d=0;for(let p=0;p<a;p++){c=d=0;for(let g=0;g<a;g++)c=c<<1&2047|i.get(p,g),g>=10&&(c===1488||c===93)&&l++,d=d<<1&2047|i.get(g,p),g>=10&&(d===1488||d===93)&&l++}return l*r},e.getPenaltyN4=function(i){let a=0;const l=i.data.length;for(let c=0;c<l;c++)a+=i.data[c];return Math.abs(Math.ceil(100*a/l/5)-10)*o},e.applyMask=function(i,a){const l=a.size;for(let c=0;c<l;c++)for(let d=0;d<l;d++)a.isReserved(d,c)||a.xor(d,c,s(i,d,c))},e.getBestMask=function(i,a){const l=Object.keys(e.Patterns).length;let c=0,d=1/0;for(let p=0;p<l;p++){a(p),e.applyMask(p,i);const g=e.getPenaltyN1(i)+e.getPenaltyN2(i)+e.getPenaltyN3(i)+e.getPenaltyN4(i);e.applyMask(p,i),g<d&&(d=g,c=p)}return c}})(maskPattern);var errorCorrectionCode={};const ECLevel$1=errorCorrectionLevel,EC_BLOCKS_TABLE=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],EC_CODEWORDS_TABLE=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];errorCorrectionCode.getBlocksCount=function(e,t){switch(t){case ECLevel$1.L:return EC_BLOCKS_TABLE[4*(e-1)+0];case ECLevel$1.M:return EC_BLOCKS_TABLE[4*(e-1)+1];case ECLevel$1.Q:return EC_BLOCKS_TABLE[4*(e-1)+2];case ECLevel$1.H:return EC_BLOCKS_TABLE[4*(e-1)+3];default:return}},errorCorrectionCode.getTotalCodewordsCount=function(e,t){switch(t){case ECLevel$1.L:return EC_CODEWORDS_TABLE[4*(e-1)+0];case ECLevel$1.M:return EC_CODEWORDS_TABLE[4*(e-1)+1];case ECLevel$1.Q:return EC_CODEWORDS_TABLE[4*(e-1)+2];case ECLevel$1.H:return EC_CODEWORDS_TABLE[4*(e-1)+3];default:return}};var polynomial={},galoisField={};const EXP_TABLE=new Uint8Array(512),LOG_TABLE=new Uint8Array(256);(function(){let e=1;for(let t=0;t<255;t++)EXP_TABLE[t]=e,LOG_TABLE[e]=t,e<<=1,256&e&&(e^=285);for(let t=255;t<512;t++)EXP_TABLE[t]=EXP_TABLE[t-255]})(),galoisField.log=function(e){if(e<1)throw new Error("log("+e+")");return LOG_TABLE[e]},galoisField.exp=function(e){return EXP_TABLE[e]},galoisField.mul=function(e,t){return e===0||t===0?0:EXP_TABLE[LOG_TABLE[e]+LOG_TABLE[t]]},function(e){const t=galoisField;e.mul=function(n,r){const o=new Uint8Array(n.length+r.length-1);for(let s=0;s<n.length;s++)for(let i=0;i<r.length;i++)o[s+i]^=t.mul(n[s],r[i]);return o},e.mod=function(n,r){let o=new Uint8Array(n);for(;o.length-r.length>=0;){const s=o[0];for(let a=0;a<r.length;a++)o[a]^=t.mul(r[a],s);let i=0;for(;i<o.length&&o[i]===0;)i++;o=o.slice(i)}return o},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let o=0;o<n;o++)r=e.mul(r,new Uint8Array([1,t.exp(o)]));return r}}(polynomial);const Polynomial=polynomial;function ReedSolomonEncoder$1(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}ReedSolomonEncoder$1.prototype.initialize=function(e){this.degree=e,this.genPoly=Polynomial.generateECPolynomial(this.degree)},ReedSolomonEncoder$1.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const t=new Uint8Array(e.length+this.degree);t.set(e);const n=Polynomial.mod(t,this.genPoly),r=this.degree-n.length;if(r>0){const o=new Uint8Array(this.degree);return o.set(n,r),o}return n};var reedSolomonEncoder=ReedSolomonEncoder$1,version={},mode={},versionCheck={isValid:function(e){return!isNaN(e)&&e>=1&&e<=40}},regex$1={};const numeric="[0-9]+",alphanumeric="[A-Z $%*+\\-./:]+";let kanji="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";kanji=kanji.replace(/u/g,"\\u");const byte="(?:(?![A-Z0-9 $%*+\\-./:]|"+kanji+`)(?:.|[\r
|
|
2
|
+
]))+`;regex$1.KANJI=new RegExp(kanji,"g"),regex$1.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),regex$1.BYTE=new RegExp(byte,"g"),regex$1.NUMERIC=new RegExp(numeric,"g"),regex$1.ALPHANUMERIC=new RegExp(alphanumeric,"g");const TEST_KANJI=new RegExp("^"+kanji+"$"),TEST_NUMERIC=new RegExp("^"+numeric+"$"),TEST_ALPHANUMERIC=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");regex$1.testKanji=function(e){return TEST_KANJI.test(e)},regex$1.testNumeric=function(e){return TEST_NUMERIC.test(e)},regex$1.testAlphanumeric=function(e){return TEST_ALPHANUMERIC.test(e)},function(e){const t=versionCheck,n=regex$1;e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(r,o){if(!r.ccBits)throw new Error("Invalid mode: "+r);if(!t.isValid(o))throw new Error("Invalid version: "+o);return o>=1&&o<10?r.ccBits[0]:o<27?r.ccBits[1]:r.ccBits[2]},e.getBestModeForData=function(r){return n.testNumeric(r)?e.NUMERIC:n.testAlphanumeric(r)?e.ALPHANUMERIC:n.testKanji(r)?e.KANJI:e.BYTE},e.toString=function(r){if(r&&r.id)return r.id;throw new Error("Invalid mode")},e.isValid=function(r){return r&&r.bit&&r.ccBits},e.from=function(r,o){if(e.isValid(r))return r;try{return function(s){if(typeof s!="string")throw new Error("Param is not a string");switch(s.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+s)}}(r)}catch{return o}}}(mode),function(e){const t=utils$1$1,n=errorCorrectionCode,r=errorCorrectionLevel,o=mode,s=versionCheck,i=t.getBCHDigit(7973);function a(c,d){return o.getCharCountIndicator(c,d)+4}function l(c,d){let p=0;return c.forEach(function(g){const v=a(g.mode,d);p+=v+g.getBitsLength()}),p}e.from=function(c,d){return s.isValid(c)?parseInt(c,10):d},e.getCapacity=function(c,d,p){if(!s.isValid(c))throw new Error("Invalid QR Code version");p===void 0&&(p=o.BYTE);const g=8*(t.getSymbolTotalCodewords(c)-n.getTotalCodewordsCount(c,d));if(p===o.MIXED)return g;const v=g-a(p,c);switch(p){case o.NUMERIC:return Math.floor(v/10*3);case o.ALPHANUMERIC:return Math.floor(v/11*2);case o.KANJI:return Math.floor(v/13);case o.BYTE:default:return Math.floor(v/8)}},e.getBestVersionForData=function(c,d){let p;const g=r.from(d,r.M);if(Array.isArray(c)){if(c.length>1)return function(v,x){for(let b=1;b<=40;b++)if(l(v,b)<=e.getCapacity(b,x,o.MIXED))return b}(c,g);if(c.length===0)return 1;p=c[0]}else p=c;return function(v,x,b){for(let C=1;C<=40;C++)if(x<=e.getCapacity(C,b,v))return C}(p.mode,p.getLength(),g)},e.getEncodedBits=function(c){if(!s.isValid(c)||c<7)throw new Error("Invalid QR Code version");let d=c<<12;for(;t.getBCHDigit(d)-i>=0;)d^=7973<<t.getBCHDigit(d)-i;return c<<12|d}}(version);var formatInfo={};const Utils$3=utils$1$1,G15=1335,G15_MASK=21522,G15_BCH=Utils$3.getBCHDigit(G15);formatInfo.getEncodedBits=function(e,t){const n=e.bit<<3|t;let r=n<<10;for(;Utils$3.getBCHDigit(r)-G15_BCH>=0;)r^=G15<<Utils$3.getBCHDigit(r)-G15_BCH;return(n<<10|r)^G15_MASK};var segments={};const Mode$4=mode;function NumericData(e){this.mode=Mode$4.NUMERIC,this.data=e.toString()}NumericData.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},NumericData.prototype.getLength=function(){return this.data.length},NumericData.prototype.getBitsLength=function(){return NumericData.getBitsLength(this.data.length)},NumericData.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);const o=this.data.length-t;o>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,3*o+1))};var numericData=NumericData;const Mode$3=mode,ALPHA_NUM_CHARS=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function AlphanumericData(e){this.mode=Mode$3.ALPHANUMERIC,this.data=e}AlphanumericData.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},AlphanumericData.prototype.getLength=function(){return this.data.length},AlphanumericData.prototype.getBitsLength=function(){return AlphanumericData.getBitsLength(this.data.length)},AlphanumericData.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=45*ALPHA_NUM_CHARS.indexOf(this.data[t]);n+=ALPHA_NUM_CHARS.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(ALPHA_NUM_CHARS.indexOf(this.data[t]),6)};var alphanumericData=AlphanumericData;const Mode$2=mode;function ByteData(e){this.mode=Mode$2.BYTE,this.data=typeof e=="string"?new TextEncoder().encode(e):new Uint8Array(e)}ByteData.getBitsLength=function(e){return 8*e},ByteData.prototype.getLength=function(){return this.data.length},ByteData.prototype.getBitsLength=function(){return ByteData.getBitsLength(this.data.length)},ByteData.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)};var byteData=ByteData;const Mode$1=mode,Utils$2=utils$1$1;function KanjiData(e){this.mode=Mode$1.KANJI,this.data=e}KanjiData.getBitsLength=function(e){return 13*e},KanjiData.prototype.getLength=function(){return this.data.length},KanjiData.prototype.getBitsLength=function(){return KanjiData.getBitsLength(this.data.length)},KanjiData.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=Utils$2.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else{if(!(n>=57408&&n<=60351))throw new Error("Invalid SJIS character: "+this.data[t]+`
|
|
3
|
+
Make sure your charset is UTF-8`);n-=49472}n=192*(n>>>8&255)+(255&n),e.put(n,13)}};var kanjiData=KanjiData,dijkstra={exports:{}};(function(e){var t={single_source_shortest_paths:function(n,r,o){var s={},i={};i[r]=0;var a,l,c,d,p,g,v,x=t.PriorityQueue.make();for(x.push(r,0);!x.empty();)for(c in l=(a=x.pop()).value,d=a.cost,p=n[l]||{})p.hasOwnProperty(c)&&(g=d+p[c],v=i[c],(i[c]===void 0||v>g)&&(i[c]=g,x.push(c,g),s[c]=l));if(o!==void 0&&i[o]===void 0){var b=["Could not find a path from ",r," to ",o,"."].join("");throw new Error(b)}return s},extract_shortest_path_from_predecessor_list:function(n,r){for(var o=[],s=r;s;)o.push(s),s=n[s];return o.reverse(),o},find_path:function(n,r,o){var s=t.single_source_shortest_paths(n,r,o);return t.extract_shortest_path_from_predecessor_list(s,o)},PriorityQueue:{make:function(n){var r,o=t.PriorityQueue,s={};for(r in n=n||{},o)o.hasOwnProperty(r)&&(s[r]=o[r]);return s.queue=[],s.sorter=n.sorter||o.default_sorter,s},default_sorter:function(n,r){return n.cost-r.cost},push:function(n,r){var o={value:n,cost:r};this.queue.push(o),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(dijkstra),function(e){const t=mode,n=numericData,r=alphanumericData,o=byteData,s=kanjiData,i=regex$1,a=utils$1$1,l=dijkstra.exports;function c(x){return unescape(encodeURIComponent(x)).length}function d(x,b,C){const _=[];let k;for(;(k=x.exec(C))!==null;)_.push({data:k[0],index:k.index,mode:b,length:k[0].length});return _}function p(x){const b=d(i.NUMERIC,t.NUMERIC,x),C=d(i.ALPHANUMERIC,t.ALPHANUMERIC,x);let _,k;return a.isKanjiModeEnabled()?(_=d(i.BYTE,t.BYTE,x),k=d(i.KANJI,t.KANJI,x)):(_=d(i.BYTE_KANJI,t.BYTE,x),k=[]),b.concat(C,_,k).sort(function($,N){return $.index-N.index}).map(function($){return{data:$.data,mode:$.mode,length:$.length}})}function g(x,b){switch(b){case t.NUMERIC:return n.getBitsLength(x);case t.ALPHANUMERIC:return r.getBitsLength(x);case t.KANJI:return s.getBitsLength(x);case t.BYTE:return o.getBitsLength(x)}}function v(x,b){let C;const _=t.getBestModeForData(x);if(C=t.from(b,_),C!==t.BYTE&&C.bit<_.bit)throw new Error('"'+x+'" cannot be encoded with mode '+t.toString(C)+`.
|
|
4
|
+
Suggested mode is: `+t.toString(_));switch(C!==t.KANJI||a.isKanjiModeEnabled()||(C=t.BYTE),C){case t.NUMERIC:return new n(x);case t.ALPHANUMERIC:return new r(x);case t.KANJI:return new s(x);case t.BYTE:return new o(x)}}e.fromArray=function(x){return x.reduce(function(b,C){return typeof C=="string"?b.push(v(C,null)):C.data&&b.push(v(C.data,C.mode)),b},[])},e.fromString=function(x,b){const C=function(N){const T=[];for(let L=0;L<N.length;L++){const B=N[L];switch(B.mode){case t.NUMERIC:T.push([B,{data:B.data,mode:t.ALPHANUMERIC,length:B.length},{data:B.data,mode:t.BYTE,length:B.length}]);break;case t.ALPHANUMERIC:T.push([B,{data:B.data,mode:t.BYTE,length:B.length}]);break;case t.KANJI:T.push([B,{data:B.data,mode:t.BYTE,length:c(B.data)}]);break;case t.BYTE:T.push([{data:B.data,mode:t.BYTE,length:c(B.data)}])}}return T}(p(x,a.isKanjiModeEnabled())),_=function(N,T){const L={},B={start:{}};let E=["start"];for(let m=0;m<N.length;m++){const y=N[m],S=[];for(let R=0;R<y.length;R++){const A=y[R],U=""+m+R;S.push(U),L[U]={node:A,lastCount:0},B[U]={};for(let I=0;I<E.length;I++){const M=E[I];L[M]&&L[M].node.mode===A.mode?(B[M][U]=g(L[M].lastCount+A.length,A.mode)-g(L[M].lastCount,A.mode),L[M].lastCount+=A.length):(L[M]&&(L[M].lastCount=A.length),B[M][U]=g(A.length,A.mode)+4+t.getCharCountIndicator(A.mode,T))}}E=S}for(let m=0;m<E.length;m++)B[E[m]].end=0;return{map:B,table:L}}(C,b),k=l.find_path(_.map,"start","end"),$=[];for(let N=1;N<k.length-1;N++)$.push(_.table[k[N]].node);return e.fromArray(function(N){return N.reduce(function(T,L){const B=T.length-1>=0?T[T.length-1]:null;return B&&B.mode===L.mode?(T[T.length-1].data+=L.data,T):(T.push(L),T)},[])}($))},e.rawSplit=function(x){return e.fromArray(p(x,a.isKanjiModeEnabled()))}}(segments);const Utils$1=utils$1$1,ECLevel=errorCorrectionLevel,BitBuffer=bitBuffer,BitMatrix=bitMatrix,AlignmentPattern=alignmentPattern,FinderPattern=finderPattern,MaskPattern=maskPattern,ECCode=errorCorrectionCode,ReedSolomonEncoder=reedSolomonEncoder,Version=version,FormatInfo=formatInfo,Mode=mode,Segments=segments;function setupFinderPattern(e,t){const n=e.size,r=FinderPattern.getPositions(t);for(let o=0;o<r.length;o++){const s=r[o][0],i=r[o][1];for(let a=-1;a<=7;a++)if(!(s+a<=-1||n<=s+a))for(let l=-1;l<=7;l++)i+l<=-1||n<=i+l||(a>=0&&a<=6&&(l===0||l===6)||l>=0&&l<=6&&(a===0||a===6)||a>=2&&a<=4&&l>=2&&l<=4?e.set(s+a,i+l,!0,!0):e.set(s+a,i+l,!1,!0))}}function setupTimingPattern(e){const t=e.size;for(let n=8;n<t-8;n++){const r=n%2==0;e.set(n,6,r,!0),e.set(6,n,r,!0)}}function setupAlignmentPattern(e,t){const n=AlignmentPattern.getPositions(t);for(let r=0;r<n.length;r++){const o=n[r][0],s=n[r][1];for(let i=-2;i<=2;i++)for(let a=-2;a<=2;a++)i===-2||i===2||a===-2||a===2||i===0&&a===0?e.set(o+i,s+a,!0,!0):e.set(o+i,s+a,!1,!0)}}function setupVersionInfo(e,t){const n=e.size,r=Version.getEncodedBits(t);let o,s,i;for(let a=0;a<18;a++)o=Math.floor(a/3),s=a%3+n-8-3,i=(r>>a&1)==1,e.set(o,s,i,!0),e.set(s,o,i,!0)}function setupFormatInfo(e,t,n){const r=e.size,o=FormatInfo.getEncodedBits(t,n);let s,i;for(s=0;s<15;s++)i=(o>>s&1)==1,s<6?e.set(s,8,i,!0):s<8?e.set(s+1,8,i,!0):e.set(r-15+s,8,i,!0),s<8?e.set(8,r-s-1,i,!0):s<9?e.set(8,15-s-1+1,i,!0):e.set(8,15-s-1,i,!0);e.set(r-8,8,1,!0)}function setupData(e,t){const n=e.size;let r=-1,o=n-1,s=7,i=0;for(let a=n-1;a>0;a-=2)for(a===6&&a--;;){for(let l=0;l<2;l++)if(!e.isReserved(o,a-l)){let c=!1;i<t.length&&(c=(t[i]>>>s&1)==1),e.set(o,a-l,c),s--,s===-1&&(i++,s=7)}if(o+=r,o<0||n<=o){o-=r,r=-r;break}}}function createData(e,t,n){const r=new BitBuffer;n.forEach(function(i){r.put(i.mode.bit,4),r.put(i.getLength(),Mode.getCharCountIndicator(i.mode,e)),i.write(r)});const o=8*(Utils$1.getSymbolTotalCodewords(e)-ECCode.getTotalCodewordsCount(e,t));for(r.getLengthInBits()+4<=o&&r.put(0,4);r.getLengthInBits()%8!=0;)r.putBit(0);const s=(o-r.getLengthInBits())/8;for(let i=0;i<s;i++)r.put(i%2?17:236,8);return createCodewords(r,e,t)}function createCodewords(e,t,n){const r=Utils$1.getSymbolTotalCodewords(t),o=r-ECCode.getTotalCodewordsCount(t,n),s=ECCode.getBlocksCount(t,n),i=s-r%s,a=Math.floor(r/s),l=Math.floor(o/s),c=l+1,d=a-l,p=new ReedSolomonEncoder(d);let g=0;const v=new Array(s),x=new Array(s);let b=0;const C=new Uint8Array(e.buffer);for(let T=0;T<s;T++){const L=T<i?l:c;v[T]=C.slice(g,g+L),x[T]=p.encode(v[T]),g+=L,b=Math.max(b,L)}const _=new Uint8Array(r);let k,$,N=0;for(k=0;k<b;k++)for($=0;$<s;$++)k<v[$].length&&(_[N++]=v[$][k]);for(k=0;k<d;k++)for($=0;$<s;$++)_[N++]=x[$][k];return _}function createSymbol(e,t,n,r){let o;if(Array.isArray(e))o=Segments.fromArray(e);else{if(typeof e!="string")throw new Error("Invalid data");{let c=t;if(!c){const d=Segments.rawSplit(e);c=Version.getBestVersionForData(d,n)}o=Segments.fromString(e,c||40)}}const s=Version.getBestVersionForData(o,n);if(!s)throw new Error("The amount of data is too big to be stored in a QR Code");if(t){if(t<s)throw new Error(`
|
|
5
|
+
The chosen QR Code version cannot contain this amount of data.
|
|
6
|
+
Minimum version required to store current data is: `+s+`.
|
|
7
|
+
`)}else t=s;const i=createData(t,n,o),a=Utils$1.getSymbolSize(t),l=new BitMatrix(a);return setupFinderPattern(l,t),setupTimingPattern(l),setupAlignmentPattern(l,t),setupFormatInfo(l,n,0),t>=7&&setupVersionInfo(l,t),setupData(l,i),isNaN(r)&&(r=MaskPattern.getBestMask(l,setupFormatInfo.bind(null,l,n))),MaskPattern.applyMask(r,l),setupFormatInfo(l,n,r),{modules:l,version:t,errorCorrectionLevel:n,maskPattern:r,segments:o}}qrcode.create=function(e,t){if(e===void 0||e==="")throw new Error("No input text");let n,r,o=ECLevel.M;return t!==void 0&&(o=ECLevel.from(t.errorCorrectionLevel,ECLevel.M),n=Version.from(t.version),r=MaskPattern.from(t.maskPattern),t.toSJISFunc&&Utils$1.setToSJISFunction(t.toSJISFunc)),createSymbol(e,n,o,r)};var canvas={},utils$3={};(function(e){function t(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let r=n.slice().replace("#","").split("");if(r.length<3||r.length===5||r.length>8)throw new Error("Invalid hex color: "+n);r.length!==3&&r.length!==4||(r=Array.prototype.concat.apply([],r.map(function(s){return[s,s]}))),r.length===6&&r.push("F","F");const o=parseInt(r.join(""),16);return{r:o>>24&255,g:o>>16&255,b:o>>8&255,a:255&o,hex:"#"+r.slice(0,6).join("")}}e.getOptions=function(n){n||(n={}),n.color||(n.color={});const r=n.margin===void 0||n.margin===null||n.margin<0?4:n.margin,o=n.width&&n.width>=21?n.width:void 0,s=n.scale||4;return{width:o,scale:o?4:s,margin:r,color:{dark:t(n.color.dark||"#000000ff"),light:t(n.color.light||"#ffffffff")},type:n.type,rendererOpts:n.rendererOpts||{}}},e.getScale=function(n,r){return r.width&&r.width>=n+2*r.margin?r.width/(n+2*r.margin):r.scale},e.getImageWidth=function(n,r){const o=e.getScale(n,r);return Math.floor((n+2*r.margin)*o)},e.qrToImageData=function(n,r,o){const s=r.modules.size,i=r.modules.data,a=e.getScale(s,o),l=Math.floor((s+2*o.margin)*a),c=o.margin*a,d=[o.color.light,o.color.dark];for(let p=0;p<l;p++)for(let g=0;g<l;g++){let v=4*(p*l+g),x=o.color.light;p>=c&&g>=c&&p<l-c&&g<l-c&&(x=d[i[Math.floor((p-c)/a)*s+Math.floor((g-c)/a)]?1:0]),n[v++]=x.r,n[v++]=x.g,n[v++]=x.b,n[v]=x.a}}})(utils$3),function(e){const t=utils$3;e.render=function(n,r,o){let s=o,i=r;s!==void 0||r&&r.getContext||(s=r,r=void 0),r||(i=function(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}()),s=t.getOptions(s);const a=t.getImageWidth(n.modules.size,s),l=i.getContext("2d"),c=l.createImageData(a,a);return t.qrToImageData(c.data,n,s),function(d,p,g){d.clearRect(0,0,p.width,p.height),p.style||(p.style={}),p.height=g,p.width=g,p.style.height=g+"px",p.style.width=g+"px"}(l,i,a),l.putImageData(c,0,0),i},e.renderToDataURL=function(n,r,o){let s=o;s!==void 0||r&&r.getContext||(s=r,r=void 0),s||(s={});const i=e.render(n,r,s),a=s.type||"image/png",l=s.rendererOpts||{};return i.toDataURL(a,l.quality)}}(canvas);var svgTag={};const Utils=utils$3;function getColorAttrib(e,t){const n=e.a/255,r=t+'="'+e.hex+'"';return n<1?r+" "+t+'-opacity="'+n.toFixed(2).slice(1)+'"':r}function svgCmd(e,t,n){let r=e+t;return n!==void 0&&(r+=" "+n),r}function qrToPath(e,t,n){let r="",o=0,s=!1,i=0;for(let a=0;a<e.length;a++){const l=Math.floor(a%t),c=Math.floor(a/t);l||s||(s=!0),e[a]?(i++,a>0&&l>0&&e[a-1]||(r+=s?svgCmd("M",l+n,.5+c+n):svgCmd("m",o,0),o=0,s=!1),l+1<t&&e[a+1]||(r+=svgCmd("h",i),i=0)):o++}return r}svgTag.render=function(e,t,n){const r=Utils.getOptions(t),o=e.modules.size,s=e.modules.data,i=o+2*r.margin,a=r.color.light.a?"<path "+getColorAttrib(r.color.light,"fill")+' d="M0 0h'+i+"v"+i+'H0z"/>':"",l="<path "+getColorAttrib(r.color.dark,"stroke")+' d="'+qrToPath(s,o,r.margin)+'"/>',c='viewBox="0 0 '+i+" "+i+'"',d='<svg xmlns="http://www.w3.org/2000/svg" '+(r.width?'width="'+r.width+'" height="'+r.width+'" ':"")+c+' shape-rendering="crispEdges">'+a+l+`</svg>
|
|
8
|
+
`;return typeof n=="function"&&n(null,d),d};const canPromise=canPromise$1,QRCode=qrcode,CanvasRenderer=canvas,SvgRenderer=svgTag;function renderCanvas(e,t,n,r,o){const s=[].slice.call(arguments,1),i=s.length,a=typeof s[i-1]=="function";if(!a&&!canPromise())throw new Error("Callback required as last argument");if(!a){if(i<1)throw new Error("Too few arguments provided");return i===1?(n=t,t=r=void 0):i!==2||t.getContext||(r=n,n=t,t=void 0),new Promise(function(l,c){try{const d=QRCode.create(n,r);l(e(d,t,r))}catch(d){c(d)}})}if(i<2)throw new Error("Too few arguments provided");i===2?(o=n,n=t,t=r=void 0):i===3&&(t.getContext&&o===void 0?(o=r,r=void 0):(o=r,r=n,n=t,t=void 0));try{const l=QRCode.create(n,r);o(null,e(l,t,r))}catch(l){o(l)}}browser$1.create=QRCode.create,browser$1.toCanvas=renderCanvas.bind(null,CanvasRenderer.render),browser$1.toDataURL=renderCanvas.bind(null,CanvasRenderer.renderToDataURL),browser$1.toString=renderCanvas.bind(null,function(e,t,n){return SvgRenderer.render(e,n)});const nlSigninConnectionStringCss=baseCss,NlSigninConnectionStringStyle0=nlSigninConnectionStringCss,NlSigninConnectionString=proxyCustomElement(class extends H{constructor(){super(),this.__registerHost(),this.nlNostrConnectDefault=createEvent(this,"nlNostrConnectDefault"),this.titleLogin="Connection string",this.description="Scan or copy the connection string with key store app",this.connectionString="",this.isCopy=!1}componentDidLoad(){this.nlNostrConnectDefault.emit(),this.generateQRCode()}async generateQRCode(){if(this.connectionString&&this.canvasElement)try{await browser$1.toCanvas(this.canvasElement,this.connectionString)}catch(e){console.error("Error generating QR Code:",e)}}async copyToClipboard(){try{await navigator.clipboard.writeText(this.connectionString),this.isCopy=!0,setTimeout(()=>{this.isCopy=!1},1500)}catch(e){console.error("Failed to copy connectionString: ",e)}}render(){return h(Fragment,{key:"9e20dbd8f95690337ccab2aad02aeecc12fe6534"},h("div",{key:"fcfcc5448dae58c119375f42d2183e536c31b7fd",class:"p-4 overflow-y-auto"},h("h1",{key:"efd74afef7798a7cc1d31104f48b5ccdf2ce9084",class:"nl-title font-bold text-center text-2xl"},this.titleLogin),h("p",{key:"39c6d7154037338efba5ba4443adc7b2ba8214f7",class:"nl-description font-light text-center text-sm pt-2 max-w-96 mx-auto"},this.description)),h("canvas",{key:"0243600d2c4720b74ed733b9fdbd3f0fe7d336e8",class:"mx-auto mb-2",ref:e=>this.canvasElement=e}),h("div",{key:"44b629d494394d9213fa9ca4610b1339ce28eed6",class:"px-4"},h("div",{key:"2a3898b77f6c9b9569c42a514556eb1ac7eab25e",class:"max-w-72 mx-auto"},h("div",{key:"0cab83e4b918a3d93ba5a150c88f251a3c7aad02",class:"relative mb-2"},h("input",{key:"bb0d74e79dd801a318025f50c55a27bc4ca46b24",type:"text",class:"nl-input peer py-3 px-4 pe-11 ps-11 block w-full border-transparent rounded-lg text-sm disabled:opacity-50 disabled:pointer-events-none dark:border-transparent",placeholder:"npub or name@domain",value:this.connectionString,disabled:!0}),h("div",{key:"646c7de454027c53b3ba7961e8dd84da34003e8b",class:"absolute inset-y-0 start-0 flex items-center pointer-events-none ps-4 peer-disabled:opacity-50 peer-disabled:pointer-events-none"},h("svg",{key:"235f51d1d29644ddc3d0b6bd4fbf703280c682d5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"flex-shrink-0 w-4 h-4 text-gray-500"},h("path",{key:"d2f9f1d2c4c8ad459780016104ad3096a6b2bac6","stroke-linecap":"round","stroke-linejoin":"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),h("path",{key:"fc00b8344aa02d311103947bf1199df3447a1b8a","stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))),this.isCopy?h("div",{class:"absolute inset-y-0 end-0 flex items-center p-2 rounded-lg"},h("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"#00cc00",class:"flex-shrink-0 w-4 h-4 text-gray-500"},h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))):h("div",{class:"absolute inset-y-0 end-0 flex items-center cursor-pointer p-2 rounded-lg",onClick:()=>this.copyToClipboard()},h("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"flex-shrink-0 w-4 h-4 text-gray-500"},h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M16.5 8.25V6a2.25 2.25 0 0 0-2.25-2.25H6A2.25 2.25 0 0 0 3.75 6v8.25A2.25 2.25 0 0 0 6 16.5h2.25m8.25-8.25H18a2.25 2.25 0 0 1 2.25 2.25V18A2.25 2.25 0 0 1 18 20.25h-7.5A2.25 2.25 0 0 1 8.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 0 0-2.25 2.25v6"})))),h("div",{key:"1e454d90b8df857894adfc03f08a6aa96913c251",class:"mt-10 justify-center items-center flex gap-2"},h("span",{key:"8b003638e347f886377e595db7fc23616067ee52",slot:"icon-start",class:"animate-spin-loading inline-block w-[20px] h-[20px] border-[2px] border-current border-t-transparent text-slate-900 dark:text-gray-300 rounded-full",role:"status","aria-label":"loading"}),h("span",{key:"5543d1eb3f1a8247e10219410aff9d77e5f527fd",class:"nl-footer"},"Waiting for connection")))))}static get style(){return NlSigninConnectionStringStyle0}},[0,"nl-signin-connection-string",{titleLogin:[1,"title-login"],description:[1],connectionString:[1,"connection-string"],isCopy:[32]}]);function defineCustomElement$b(){typeof customElements>"u"||["nl-signin-connection-string"].forEach(e=>{e==="nl-signin-connection-string"&&(customElements.get(e)||customElements.define(e,NlSigninConnectionString))})}defineCustomElement$b();const nlSigninOtpCss=baseCss,NlSigninOtpStyle0=nlSigninOtpCss,NlSigninOtp=proxyCustomElement(class extends H{constructor(){super(),this.__registerHost(),this.nlLoginOTPUser=createEvent(this,"nlLoginOTPUser"),this.nlLoginOTPCode=createEvent(this,"nlLoginOTPCode"),this.nlCheckLogin=createEvent(this,"nlCheckLogin"),this.titleLogin="Log in with DM",this.description="Please enter your user name or npub, and we will send you a direct message with a one-time code.",this.titleLoginOTP="Enter the code",this.descriptionOTP="Please enter the one-time code we sent to you as a direct message on Nostr.",this.isGood=!1}handleInputChange(e){state.isOTP?state.nlSigninOTP.code=e.target.value:(state.nlSigninOTP.loginName=e.target.value,this.nlCheckLogin.emit(state.nlSigninOTP.loginName))}handleLogin(e){e.preventDefault(),state.isOTP?this.nlLoginOTPCode.emit(state.nlSigninOTP.code):this.nlLoginOTPUser.emit(state.nlSigninOTP.loginName)}render(){return h(Fragment,{key:"908b593238b5fa1b577cee0a8149e013a2cd4e81"},h("div",{key:"2d57c60631a906fc566d5f1f76cdac11773436c5",class:"p-4 overflow-y-auto"},h("h1",{key:"b08c82e952dbc3af15e25c48f318677a68f46d19",class:"nl-title font-bold text-center text-2xl"},state.isOTP?this.titleLoginOTP:this.titleLogin),h("p",{key:"64f6ec549cd2fc9c4b3672c5463d183d9626c20b",class:"nl-description font-light text-center text-sm pt-2 max-w-96 mx-auto"},state.isOTP?this.descriptionOTP:this.description)),h("div",{key:"5e9bf1ba4a6a72788f605ef44f98cdafeb67e0d0",class:"max-w-72 mx-auto"},h("div",{key:"3986a554e56c5457abf19162ecdafe0cc72ceade",class:"relative mb-2"},h("input",{key:"139d115f54a0253fac37eb6bbbba5f00cec6e3b6",onInput:e=>this.handleInputChange(e),type:"text",class:"nl-input peer py-3 px-4 ps-11 block w-full border-transparent rounded-lg text-sm disabled:opacity-50 disabled:pointer-events-none dark:border-transparent",placeholder:state.isOTP?"code from direct message":"npub or name@domain",value:state.isOTP?state.nlSigninOTP.code:state.nlSigninOTP.loginName}),h("div",{key:"bae2734dbce11c6c9a9f59b2ba1a57841213e8f0",class:"absolute inset-y-0 start-0 flex items-center pointer-events-none ps-4 peer-disabled:opacity-50 peer-disabled:pointer-events-none"},h("svg",{key:"8dc6fc177553d183873eae6c4ef31509d45c5784",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:this.isGood?"#00cc00":"currentColor",class:"flex-shrink-0 w-4 h-4 text-gray-500"},h("path",{key:"dd9d07329ee6ae0491c009adffc673cf6a4103d3","stroke-linecap":"round","stroke-linejoin":"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),h("path",{key:"0357daa2fb59eb3c2cbaf62e49d69e42dde16b85","stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})))),h("div",{key:"91a36d9e0420b28eca1edcd1ec8759c25b2d51b3",class:"ps-4 pe-4 overflow-y-auto"},h("p",{key:"e462b623f95c800d1589d3eef07d2216b70bdd64",class:"nl-error font-light text-center text-sm max-w-96 mx-auto"},state.error)),h("button-base",{key:"c6b89e573097ac7d40c0648a2e87222d48e72b40",titleBtn:"Log in",disabled:state.isLoading,onClick:e=>this.handleLogin(e)},state.isLoading&&h("span",{key:"0be64571f00987f716e986af9cb043e3eb22b796",slot:"icon-start",class:"animate-spin-loading inline-block w-4 h-4 border-[3px] border-current border-t-transparent text-slate-900 dark:text-gray-300 rounded-full",role:"status","aria-label":"loading"}))))}static get style(){return NlSigninOtpStyle0}},[0,"nl-signin-otp",{titleLogin:[1,"title-login"],description:[1],titleLoginOTP:[1,"title-login-o-t-p"],descriptionOTP:[1,"description-o-t-p"],isGood:[32]}]);function defineCustomElement$a(){typeof customElements>"u"||["nl-signin-otp","button-base"].forEach(e=>{switch(e){case"nl-signin-otp":customElements.get(e)||customElements.define(e,NlSigninOtp);break;case"button-base":customElements.get(e)||defineCustomElement$q()}})}defineCustomElement$a();const nlSigninReadOnlyCss=baseCss,NlSigninReadOnlyStyle0=nlSigninReadOnlyCss,NlSigninReadOnly=proxyCustomElement(class extends H{constructor(){super(),this.__registerHost(),this.nlLoginReadOnly=createEvent(this,"nlLoginReadOnly"),this.nlCheckLogin=createEvent(this,"nlCheckLogin"),this.titleLogin="Log in to read only",this.description="Please enter the user name or npub of any Nostr user.",this.isGood=!1}handleInputChange(e){state.nlSigninReadOnly.loginName=e.target.value,this.nlCheckLogin.emit(e.target.value)}handleLogin(e){e.preventDefault(),this.nlLoginReadOnly.emit(state.nlSigninReadOnly.loginName)}render(){return h(Fragment,{key:"5333cc7e682b148d2b2c9d3756c9fa561a9a3e86"},h("div",{key:"ed025d719382b9b4ac11a24d3814419a6f51c774",class:"p-4 overflow-y-auto"},h("h1",{key:"8b8c0c1e839b3db4529e1c6acc8ef18e29a7abee",class:"nl-title font-bold text-center text-2xl"},this.titleLogin),h("p",{key:"36f9334b55aea6c5e46bc6e143388b757a6be867",class:"nl-description font-light text-center text-sm pt-2 max-w-96 mx-auto"},this.description)),h("div",{key:"3197bd6ac9835cdb4a9b64ff0dea262ddb92ef13",class:"max-w-72 mx-auto"},h("div",{key:"f804f5111ac8f9aaa17b404c22d58ea875273382",class:"relative mb-2"},h("input",{key:"7828eb7e49e92a0578a73439ae16de63caa57597",onInput:e=>this.handleInputChange(e),type:"text",class:"nl-input peer py-3 px-4 ps-11 block w-full border-transparent rounded-lg text-sm disabled:opacity-50 disabled:pointer-events-none dark:border-transparent",placeholder:"npub or name@domain",value:state.nlSigninReadOnly.loginName}),h("div",{key:"1557e4f05bac2eefc05e22806cb0024e5430c7f4",class:"absolute inset-y-0 start-0 flex items-center pointer-events-none ps-4 peer-disabled:opacity-50 peer-disabled:pointer-events-none"},h("svg",{key:"dfd2f9eeb07d815807bdb4885680001d3d5a1a2c",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:this.isGood?"#00cc00":"currentColor",class:"flex-shrink-0 w-4 h-4 text-gray-500"},h("path",{key:"beb199e08cbb0d385314e4a3fcb521bbc05e7d2d","stroke-linecap":"round","stroke-linejoin":"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),h("path",{key:"988fe07d787ff2fbb15c620681b2996fcd0ff382","stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})))),h("div",{key:"652f082e184f5d871629f8054a2474c80adddf4b",class:"ps-4 pe-4 overflow-y-auto"},h("p",{key:"5583f0eb95400902d72728989f32c3afaf31fc77",class:"nl-error font-light text-center text-sm max-w-96 mx-auto"},state.error)),h("button-base",{key:"e708d09f4e1625af23d8f432c8523662ad1c82dd",titleBtn:"Log in",disabled:state.isLoading,onClick:e=>this.handleLogin(e)},state.isLoading&&h("span",{key:"5422a05cd6a2b0309fd78f95bf89b0ff03ab69e9",slot:"icon-start",class:"animate-spin-loading inline-block w-4 h-4 border-[3px] border-current border-t-transparent text-slate-900 dark:text-gray-300 rounded-full",role:"status","aria-label":"loading"}))))}static get style(){return NlSigninReadOnlyStyle0}},[0,"nl-signin-read-only",{titleLogin:[1,"title-login"],description:[1],isGood:[32]}]);function defineCustomElement$9(){typeof customElements>"u"||["nl-signin-read-only","button-base"].forEach(e=>{switch(e){case"nl-signin-read-only":customElements.get(e)||customElements.define(e,NlSigninReadOnly);break;case"button-base":customElements.get(e)||defineCustomElement$q()}})}defineCustomElement$9();const nlSignupCss=baseCss,NlSignupStyle0=nlSignupCss,NlSignup=proxyCustomElement(class extends H{constructor(){super(),this.__registerHost(),this.nlSignup=createEvent(this,"nlSignup"),this.nlCheckSignup=createEvent(this,"nlCheckSignup"),this.fetchHandler=createEvent(this,"fetchHandler"),this.titleSignup="Create keys with key store",this.description="Choose some username and a key store service.",this.bunkers="nsec.app,highlighter.com",this.isAvailable=!1}formatServers(e){return e.split(",").map(t=>({name:"@"+t,value:t}))}handleInputChange(e){state.nlSignup.signupName=e.target.value,this.nlCheckSignup.emit(`${e.target.value}@${state.nlSignup.domain}`)}handleDomainSelect(e){state.nlSignup.domain=e.detail,this.nlCheckSignup.emit(`${state.nlSignup.signupName}@${e.detail}`)}handleCreateAccount(e){e.preventDefault(),this.nlSignup.emit(`${state.nlSignup.signupName}@${state.nlSignup.domain}`)}watchBunkersHandler(e){state.nlSignup.servers=this.formatServers(e)}componentWillLoad(){state.nlSignup.servers=this.formatServers(this.bunkers)}render(){return h(Fragment,{key:"558e55ea3a7177a7e035e82c1bbdf522fb2efeb4"},h("div",{key:"8f04f68da63de9317a9ea7e1b425a54fef58905e",class:"p-4 overflow-y-auto"},h("h1",{key:"a8bc4c25348f8d0416679212ba2344a3ca9a78f0",class:"nl-title font-bold text-center text-2xl"},this.titleSignup),h("p",{key:"4e978b75b8ad51e1bc9b0ab5412bd96c21343d9d",class:"nl-description font-light text-center text-sm pt-2 max-w-96 mx-auto"},this.description)),h("div",{key:"34b45813498214aedea41061bb60b170cdf1bc35",class:"max-w-72 mx-auto"},h("div",{key:"7a9cc7d8acacebf5001d98982e9f140164a2daf3",class:"relative mb-2"},h("input",{key:"e7f48804f026d19d8bff09c59854dd55de8b6f54",onInput:e=>this.handleInputChange(e),type:"text",class:"nl-input peer py-3 px-4 ps-11 block w-full border-transparent rounded-lg text-sm disabled:opacity-50 disabled:pointer-events-none dark:border-transparent",placeholder:"Name",value:state.nlSignup.signupName}),h("div",{key:"1a3c7346fa66174c33110c7523e6598c091abeae",class:"absolute inset-y-0 start-0 flex items-center pointer-events-none ps-4 peer-disabled:opacity-50 peer-disabled:pointer-events-none"},h("svg",{key:"edaa9b8e76f3bc2c4a34d8d1fe20536571ef5749",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:this.isAvailable?"#00cc00":"currentColor",class:"flex-shrink-0 w-4 h-4 text-gray-500"},h("path",{key:"3e0d1b3d4c9d6b2d4ffc44e699c1545b68173d67","stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 6a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0ZM4.501 20.118a7.5 7.5 0 0 1 14.998 0A17.933 17.933 0 0 1 12 21.75c-2.676 0-5.216-.584-7.499-1.632Z"})))),h("div",{key:"c0b07eb2e657adf2dbfc95fa3bf6351a6beda00a",class:"mb-2"},h("nl-select",{key:"632e99d1d1e074ed8f9383c0f7bd38f3415a3305",onSelectDomain:e=>this.handleDomainSelect(e),selected:0,options:state.nlSignup.servers})),h("div",{key:"96cc25d6bf9e12eb950e81dc046bebd2998f117f",class:"ps-4 pe-4 overflow-y-auto"},h("p",{key:"7cd9f343b92a75efb8c26db31afa19a734893449",class:"nl-error font-light text-center text-sm max-w-96 mx-auto"},state.error)),h("button-base",{key:"491cbb2cad036c958624947160014d3a0f12125e",disabled:state.isLoading,onClick:e=>this.handleCreateAccount(e),titleBtn:"Create profile"},state.isLoading?h("span",{slot:"icon-start",class:"animate-spin-loading inline-block w-4 h-4 border-[3px] border-current border-t-transparent text-slate-900 dark:text-gray-300 rounded-full",role:"status","aria-label":"loading"}):h("svg",{slot:"icon-start",style:{display:"none"},xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M18 7.5v3m0 0v3m0-3h3m-3 0h-3m-2.25-4.125a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0ZM3 19.235v-.11a6.375 6.375 0 0 1 12.75 0v.109A12.318 12.318 0 0 1 9.374 21c-2.331 0-4.512-.645-6.374-1.766Z"})))))}static get watchers(){return{bunkers:["watchBunkersHandler"]}}static get style(){return NlSignupStyle0}},[0,"nl-signup",{titleSignup:[1,"title-signup"],description:[1],bunkers:[1],isAvailable:[32]},void 0,{bunkers:["watchBunkersHandler"]}]);function defineCustomElement$8(){typeof customElements>"u"||["nl-signup","button-base","nl-select"].forEach(e=>{switch(e){case"nl-signup":customElements.get(e)||customElements.define(e,NlSignup);break;case"button-base":customElements.get(e)||defineCustomElement$q();break;case"nl-select":customElements.get(e)||defineCustomElement$m()}})}defineCustomElement$8();const nlWelcomeCss=baseCss,NlWelcomeStyle0=nlWelcomeCss,NlWelcome=proxyCustomElement(class extends H{constructor(){super(),this.__registerHost(),this.titleWelcome="Welcome to Nostr!",this.description="This website is part of the Nostr network. Log in with your Nostr profile or sign up to join."}handleChangeScreen(e){state.path=[...state.path,e]}render(){return h(Fragment,{key:"9fbfb07f267912a84a036ab844d3dc3e4fecb2aa"},h("div",{key:"04b7452fb9481f99e793a3a64b5febd0d644cb70",class:"p-4 overflow-y-auto"},h("h1",{key:"32ec61d34e5abead821096f50ebfceb65ac06ceb",class:"nl-title font-bold text-center text-4xl"},this.titleWelcome),h("p",{key:"fa5272e74078d89100f42a9b0f25c30eb5746460",class:"nl-description font-light text-center text-lg pt-2 max-w-96 mx-auto"},this.description)),h("div",{key:"9745a35fa223d2481e77258c5f40793174f5cc70",class:"max-w-52 mx-auto pb-5"},h("div",{key:"f395ddcb3e75049fde79d0b9bc797e3cef6d4e30",class:"flex gap-3 flex-col mb-2"},h("button-base",{key:"367ccec38380c93a7ab812436093ce643209ae2e",titleBtn:"Log in",onClick:()=>this.handleChangeScreen(CURRENT_MODULE.WELCOME_LOGIN)},h("svg",{key:"ce6f3533b3a83145deb79257f68f2e8749122571",style:{display:"none"},slot:"icon-start",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},h("path",{key:"38cc63a69adc25366f4bc78cd966624e4da8234e","stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z"})))),h("button-base",{key:"f3bc1f5b2b971a2c25b18b00e83a1e0f66800c05",onClick:()=>this.handleChangeScreen(CURRENT_MODULE.WELCOME_SIGNUP),titleBtn:"Sign up"},h("svg",{key:"b10cd84902c819733453a9642bd3e28dc4057c04",style:{display:"none"},slot:"icon-start",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},h("path",{key:"e8e2a4bfdcc92971a44f076a97c0b9043377cbe9","stroke-linecap":"round","stroke-linejoin":"round",d:"M18 7.5v3m0 0v3m0-3h3m-3 0h-3m-2.25-4.125a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0ZM3 19.235v-.11a6.375 6.375 0 0 1 12.75 0v.109A12.318 12.318 0 0 1 9.374 21c-2.331 0-4.512-.645-6.374-1.766Z"})))))}static get style(){return NlWelcomeStyle0}},[0,"nl-welcome",{titleWelcome:[1,"title-welcome"],description:[1]}]);function defineCustomElement$7(){typeof customElements>"u"||["nl-welcome","button-base"].forEach(e=>{switch(e){case"nl-welcome":customElements.get(e)||customElements.define(e,NlWelcome);break;case"button-base":customElements.get(e)||defineCustomElement$q()}})}defineCustomElement$7();const nlWelcomeSigninCss=baseCss,NlWelcomeSigninStyle0=nlWelcomeSigninCss,NlWelcomeSignIn=proxyCustomElement(class extends H{constructor(){super(),this.__registerHost(),this.nlLoginExtension=createEvent(this,"nlLoginExtension"),this.titleWelcome="Log in",this.hasExtension=!1,this.authMethods=[],this.hasOTP=!1}handleChangeScreen(e){state.path=[...state.path,e],e===CURRENT_MODULE.EXTENSION&&this.nlLoginExtension.emit()}allowAuthMethod(e){return!this.authMethods.length||this.authMethods.includes(e)}renderSignInWithExtension(){return h("button-base",{onClick:()=>this.handleChangeScreen(CURRENT_MODULE.EXTENSION),titleBtn:"With extension"},h("svg",{style:{display:"none"},slot:"icon-start",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3 8.25V18a2.25 2.25 0 0 0 2.25 2.25h13.5A2.25 2.25 0 0 0 21 18V8.25m-18 0V6a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 6v2.25m-18 0h18M5.25 6h.008v.008H5.25V6ZM7.5 6h.008v.008H7.5V6Zm2.25 0h.008v.008H9.75V6Z"})))}render(){return h(Fragment,{key:"f698abf1cdb2942897307d83ddf20097338f9c1a"},h("div",{key:"42973b807c9817b1014898729cd3bcf7f0920c7c",class:"p-4 overflow-y-auto"},h("h1",{key:"d0b9a8616ecd00db2db2eee058d151ff1819b225",class:"nl-title font-bold text-center text-3xl"},this.titleWelcome)),h("div",{key:"f3485be619b6faec7d5ed1829016d84a63fe13f1",class:"max-w-52 mx-auto pb-5"},h("div",{key:"171aa182f0a4c432ffe38295ae0a83c294f51cb0",class:"flex gap-3 flex-col"},this.allowAuthMethod("connect")&&h("button-base",{key:"cd223659a29446bdb8464fb88f4f72b552ca6d60",titleBtn:"Connect",onClick:()=>this.handleChangeScreen(CURRENT_MODULE.CONNECT)},h("svg",{key:"858a77a88d412cf623b8aa334bc3e53f396078fb",style:{display:"none"},slot:"icon-start",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},h("path",{key:"375dd64c3d8ce48de145cf3c24b641209c127742","stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 9V5.25A2.25 2.25 0 0 1 10.5 3h6a2.25 2.25 0 0 1 2.25 2.25v13.5A2.25 2.25 0 0 1 16.5 21h-6a2.25 2.25 0 0 1-2.25-2.25V15M12 9l3 3m0 0-3 3m3-3H2.25"}))),this.allowAuthMethod("readOnly")&&h("button-base",{key:"6add4933d6818a8dbd711b60eb185d9f53abbdce",onClick:()=>this.handleChangeScreen(CURRENT_MODULE.LOGIN_READ_ONLY),titleBtn:"Read only"},h("svg",{key:"ef8c543ad07afa3e67040bf3898cbf6d450f8a35",style:{display:"none"},slot:"icon-start",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},h("path",{key:"06ed2df6d62c64e688a1da01af5e394c08a2e4b5","stroke-linecap":"round","stroke-linejoin":"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),h("path",{key:"17b825cc04238a369ac7fff9e18311eb449fee7c","stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))),this.hasOTP&&this.allowAuthMethod("otp")&&h("button-base",{key:"a93f338de78f40ff7574e6a039294d88aedaf759",titleBtn:"One-time code",onClick:()=>this.handleChangeScreen(CURRENT_MODULE.LOGIN_OTP)},h("svg",{key:"2aa34c15e0b701071b74870645a3786b2ca85483",style:{display:"none"},slot:"icon-start",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},h("path",{key:"4af17a7966a64ce8168d9f1faa146bfc7b737201","stroke-linecap":"round","stroke-linejoin":"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))),this.hasExtension&&this.allowAuthMethod("extension")&&this.renderSignInWithExtension(),!this.allowAuthMethod("connect")&&!this.hasExtension&&h("p",{key:"502d09cbd29c35f132158b57a71afcb1a05a80ea",class:"nl-description font-light text-center text-lg pt-2 max-w-96 mx-auto"},"No Nostr extension!"),!this.allowAuthMethod("connect")&&this.hasExtension&&!this.allowAuthMethod("extension")&&h("p",{key:"82762e76ad0fde7b87815398a7d821143f12c7e7",class:"nl-description font-light text-center text-lg pt-2 max-w-96 mx-auto"},"Use advanced options."))))}static get style(){return NlWelcomeSigninStyle0}},[0,"nl-welcome-signin",{titleWelcome:[1,"title-welcome"],hasExtension:[4,"has-extension"],authMethods:[16],hasOTP:[4,"has-o-t-p"]}]);function defineCustomElement$6(){typeof customElements>"u"||["nl-welcome-signin","button-base"].forEach(e=>{switch(e){case"nl-welcome-signin":customElements.get(e)||customElements.define(e,NlWelcomeSignIn);break;case"button-base":customElements.get(e)||defineCustomElement$q()}})}defineCustomElement$6();const nlWelcomeSignupCss=baseCss,NlWelcomeSignupStyle0=nlWelcomeSignupCss,NlWelcomeSignUp=proxyCustomElement(class extends H{constructor(){super(),this.__registerHost(),this.titleWelcome="Sign up",this.description="Nostr profiles are based on cryptographic keys. You can create keys right here, or with a key storage app."}handleChangeScreen(e){state.path=[...state.path,e]}render(){return h(Fragment,{key:"ed92b261515733ad30246febe996bec581f392ee"},h("div",{key:"f8e1c53b93a766e1c086b0c0fca9fae98f6e492c",class:"p-4 overflow-y-auto"},h("h1",{key:"8766733352e5a129016b6a9cdfeeeac06af00be1",class:"nl-title font-bold text-center text-3xl"},this.titleWelcome),h("p",{key:"b758d37bcd4e09eaf981ef3057a437872b5ca5cb",class:"nl-description font-light text-center text-lg pt-2 max-w-96 mx-auto"},this.description)),h("div",{key:"ffb223d49d4f380406cb4eec4d9f166b7ba7694c",class:"max-w-52 mx-auto pb-5"},h("div",{key:"871ce44d253799caf575263f6e3d42227f9e24ad",class:"flex gap-3 flex-col"},h("button-base",{key:"345b1aaebcc7c72811ab1a7e9a010c011066e1fb",onClick:()=>this.handleChangeScreen(CURRENT_MODULE.LOCAL_SIGNUP),titleBtn:"Create keys"},h("svg",{key:"17f0f693941020e1ad09c64e8e80ca08fd082673",style:{display:"none"},slot:"icon-start",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},h("path",{key:"0720ef9137e48e3b814ea1efa463925dfb3ee5e1","stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z"}))),h("button-base",{key:"09f0ac2ad4b759b29001d28d735a74300fee2c36",onClick:()=>this.handleChangeScreen(CURRENT_MODULE.SIGNUP),titleBtn:"With key store"},h("svg",{key:"207439f7318c9dfd7ed8a70da9099ed1a8121871",style:{display:"none"},slot:"icon-start",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},h("path",{key:"9331b09772ce53fe1802a00063646f68ffb8971a","stroke-linecap":"round","stroke-linejoin":"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"}))))))}static get style(){return NlWelcomeSignupStyle0}},[0,"nl-welcome-signup",{titleWelcome:[1,"title-welcome"],description:[1]}]);function defineCustomElement$5(){typeof customElements>"u"||["nl-welcome-signup","button-base"].forEach(e=>{switch(e){case"nl-welcome-signup":customElements.get(e)||customElements.define(e,NlWelcomeSignUp);break;case"button-base":customElements.get(e)||defineCustomElement$q()}})}defineCustomElement$5();const nlAuthCss=baseCss,NlAuthStyle0=nlAuthCss,NlAuth=proxyCustomElement(class extends H{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.nlCloseModal=createEvent(this,"nlCloseModal"),this.nlChangeDarkMode=createEvent(this,"nlChangeDarkMode"),this.nlNostrConnectDefaultCancel=createEvent(this,"nlNostrConnectDefaultCancel"),this.prevPath="",this.theme="default",this.bunkers="",this.startScreen=CURRENT_MODULE.WELCOME,this.authMethods=[],this.hasExtension=!1,this.hasOTP=!1,this.isLoading=!1,this.isLoadingExtension=!1,this.isOTP=!1,this.authUrl="",this.iframeUrl="",this.error="",this.localSignup=!1,this.signupNjump=!1,this.njumpIframe="",this.accounts=[],this.recents=[],this.darkMode=!1,this.welcomeTitle="",this.welcomeDescription="",this.connectionString="",this.connectionStringServices=[]}watchLoadingHandler(e){state.isLoading=e}watchLoadingExtensionHandler(e){state.isLoadingExtension=e}watchOTPHandler(e){state.isOTP=e}watchAuthUrlHandler(e){state.authUrl=e}watchIframeUrlHandler(e){state.iframeUrl=e}watchNjumpIframeHandler(e){state.njumpIframe=e}watchErrorHandler(e){state.error=e}handleClose(){this.nlCloseModal.emit()}handleChangeDarkMode(){this.nlChangeDarkMode.emit(!this.darkMode)}componentWillLoad(){state.path=[this.startScreen],state.error="",state.iframeUrl="",state.authUrl="",state.isLoading=!1,state.isLoadingExtension=!1,state.isOTP=!1,console.log("path",state.path)}handleClickToBack(){state.path.pop(),state.path=[...state.path],state.isLoading=!1,state.isLoadingExtension=!1,state.authUrl="",state.isOTP=!1}switchSignSignUpStrategy(e){CURRENT_MODULE.LOCAL_SIGNUP!==e?state.path=[CURRENT_MODULE.WELCOME,e]:state.path=[CURRENT_MODULE.WELCOME,CURRENT_MODULE.WELCOME_SIGNUP,e]}render(){const e="w-full h-full fixed top-0 start-0 z-[80] overflow-x-hidden overflow-y-auto flex items-center "+(this.darkMode?"dark":""),t=state.path.at(-1);t!==this.prevPath&&this.prevPath===CURRENT_MODULE.CONNECTION_STRING&&this.nlNostrConnectDefaultCancel.emit(),this.prevPath=t;const n=state.isOTP||t!==CURRENT_MODULE.INFO&&t!==CURRENT_MODULE.CONFIRM_LOGOUT&&t!==CURRENT_MODULE.IMPORT_FLOW&&t!==CURRENT_MODULE.WELCOME&&t!==CURRENT_MODULE.EXTENSION&&t!==CURRENT_MODULE.IFRAME&&t!==CURRENT_MODULE.PREVIOUSLY_LOGGED,r=t!==CURRENT_MODULE.IFRAME&&(!this.authMethods.length||!this.localSignup&&this.authMethods.includes("connect")||this.localSignup&&this.authMethods.includes("local"));return h("div",{class:`theme-${this.theme}`,dir:"ltr"},h("div",{class:e},h("div",{onClick:()=>this.handleClose(),class:"absolute top-0 left-0 w-full h-full bg-gray-500 bg-opacity-75 z-[80]"}),h("div",{class:"nl-bg relative z-[81] w-full flex flex-col rounded-xl sm:max-w-lg sm:w-full sm:mx-auto"},h("div",{class:"flex justify-between items-center py-3 px-4"},h("div",{class:"flex gap-2 items-center"},h("svg",{class:"w-7 h-7",width:"225",height:"224",viewBox:"0 0 225 224",fill:"none",xmlns:"http://www.w3.org/2000/svg"},h("rect",{width:"224.047",height:"224",rx:"64",fill:"#6951FA"}),h("path",{d:"M162.441 135.941V88.0593C170.359 85.1674 176 77.5348 176 68.6696C176 57.2919 166.708 48 155.33 48C143.953 48 134.661 57.2444 134.661 68.6696C134.661 77.5822 140.302 85.1674 148.219 88.0593V135.941C147.698 136.13 147.176 136.367 146.655 136.604L87.3956 77.3452C88.6282 74.6904 89.2919 71.7511 89.2919 68.6696C89.2919 57.2444 80.0474 48 68.6696 48C57.2919 48 48 57.2444 48 68.6696C48 77.5822 53.6415 85.1674 61.5585 88.0593V135.941C53.6415 138.833 48 146.465 48 155.33C48 166.708 57.2444 176 68.6696 176C80.0948 176 89.3393 166.708 89.3393 155.33C89.3393 146.418 83.6978 138.833 75.7807 135.941V88.0593C76.3022 87.8696 76.8237 87.6326 77.3452 87.3956L136.604 146.655C135.372 149.31 134.708 152.249 134.708 155.33C134.708 166.708 143.953 176 155.378 176C166.803 176 176.047 166.708 176.047 155.33C176.047 146.418 170.406 138.833 162.489 135.941H162.441Z",fill:"white"})),h("p",{class:"font-bold nl-logo text-base"},"Nostr ",h("span",{class:"font-light"},"Login"))),h("div",{class:"flex gap-1"},h("button",{onClick:()=>this.handleChangeDarkMode(),type:"button",class:"nl-action-button flex justify-center items-center w-7 h-7 text-sm font-semibold rounded-full border border-transparent"},h("span",{class:"sr-only"},"Change theme"),this.darkMode?h("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"flex-shrink-0 w-5 h-5"},h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 3v2.25m6.364.386-1.591 1.591M21 12h-2.25m-.386 6.364-1.591-1.591M12 18.75V21m-4.773-4.227-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z"})):h("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"flex-shrink-0 w-5 h-5"},h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M21.752 15.002A9.72 9.72 0 0 1 18 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 0 0 3 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 0 0 9.002-5.998Z"}))),!state.isLoading&&h("button",{onClick:()=>state.path=[...state.path,CURRENT_MODULE.INFO],type:"button",class:"nl-action-button flex justify-center items-center w-7 h-7 text-sm font-semibold rounded-full border border-transparent"},h("span",{class:"sr-only"},"Info"),h("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"flex-shrink-0 w-5 h-5"},h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"}))),h("button",{onClick:()=>this.handleClose(),type:"button",class:"nl-action-button flex justify-center items-center w-7 h-7 text-sm font-semibold rounded-full border border-transparent"},h("span",{class:"sr-only"},"Close"),h("svg",{class:"flex-shrink-0 w-5 h-5",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},h("path",{d:"M18 6 6 18"}),h("path",{d:"m6 6 12 12"}))))),state.path.length>1&&!state.isLoading&&h("div",{class:"p-4"},h("button",{onClick:()=>this.handleClickToBack(),type:"button",class:"nl-action-button flex justify-center items-center w-7 h-7 text-sm font-semibold rounded-full border border-transparent dark:focus:outline-none dark:focus:ring-1 dark:focus:ring-gray-600","data-hs-overlay":"#hs-vertically-centered-modal"},h("span",{class:"sr-only"},"Back"),h("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"flex-shrink-0 w-5 h-5"},h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"})))),state.isLoading||state.authUrl?h("nl-loading",{path:t}):h(Fragment,null,(()=>{if(state.isOTP)return h("nl-signin-otp",null);switch(t){case CURRENT_MODULE.WELCOME:return h("nl-welcome",{titleWelcome:this.welcomeTitle||void 0,description:this.welcomeDescription||void 0});case CURRENT_MODULE.LOGIN:return h("nl-signin",null);case CURRENT_MODULE.SIGNUP:return h("nl-signup",{bunkers:this.bunkers});case CURRENT_MODULE.LOCAL_SIGNUP:return h("nl-local-signup",{signupNjump:this.signupNjump});case CURRENT_MODULE.CONFIRM_LOGOUT:return h("nl-confirm-logout",null);case CURRENT_MODULE.IMPORT_FLOW:return h("nl-import-flow",{services:this.connectionStringServices});case CURRENT_MODULE.IMPORT_OTP:return h("nl-otp-migrate",{services:this.connectionStringServices});case CURRENT_MODULE.INFO:return h("nl-info",null);case CURRENT_MODULE.EXTENSION:return h("nl-info-extension",null);case CURRENT_MODULE.LOGIN_READ_ONLY:return h("nl-signin-read-only",null);case CURRENT_MODULE.LOGIN_BUNKER_URL:return h("nl-signin-bunker-url",null);case CURRENT_MODULE.LOGIN_OTP:return h("nl-signin-otp",null);case CURRENT_MODULE.WELCOME_LOGIN:return h("nl-welcome-signin",{hasOTP:this.hasOTP,authMethods:this.authMethods,hasExtension:this.hasExtension});case CURRENT_MODULE.WELCOME_SIGNUP:return h("nl-welcome-signup",null);case CURRENT_MODULE.CONNECTION_STRING:return h("nl-signin-connection-string",{connectionString:this.connectionString});case CURRENT_MODULE.CONNECT:return h("nl-connect",{connectionStringServices:this.connectionStringServices,authMethods:this.authMethods});case CURRENT_MODULE.PREVIOUSLY_LOGGED:return h("nl-previously-logged",{accounts:this.accounts,recents:this.recents});case CURRENT_MODULE.IFRAME:return h("nl-iframe",{iframeUrl:this.authUrl});default:return h("nl-welcome",null)}})(),n&&h(Fragment,null,t===CURRENT_MODULE.WELCOME_SIGNUP||t===CURRENT_MODULE.SIGNUP||t===CURRENT_MODULE.LOCAL_SIGNUP?h("div",{class:"p-4 overflow-y-auto"},h("p",{class:"nl-footer font-light text-center text-sm pt-3 max-w-96 mx-auto"},"If you already have a profile please"," ",h("span",{onClick:()=>this.switchSignSignUpStrategy(CURRENT_MODULE.WELCOME_LOGIN),class:"cursor-pointer text-blue-400"},"log in"),".")):r&&h("div",{class:"p-4 overflow-y-auto"},h("p",{class:"nl-footer font-light text-center text-sm pt-3 max-w-96 mx-auto"},"If you don't have a profile please"," ",h("span",{onClick:()=>this.localSignup?this.switchSignSignUpStrategy(CURRENT_MODULE.LOCAL_SIGNUP):this.switchSignSignUpStrategy(CURRENT_MODULE.WELCOME_SIGNUP),class:"cursor-pointer text-blue-400"},"sign up"),".")))))))}static get watchers(){return{isLoading:["watchLoadingHandler"],isLoadingExtension:["watchLoadingExtensionHandler"],isOTP:["watchOTPHandler"],authUrl:["watchAuthUrlHandler"],iframeUrl:["watchIframeUrlHandler"],njumpIframe:["watchNjumpIframeHandler"],error:["watchErrorHandler"]}}static get style(){return NlAuthStyle0}},[1,"nl-auth",{theme:[1025],bunkers:[1],startScreen:[1,"start-screen"],authMethods:[16],hasExtension:[4,"has-extension"],hasOTP:[4,"has-o-t-p"],isLoading:[4,"is-loading"],isLoadingExtension:[4,"is-loading-extension"],isOTP:[4,"is-o-t-p"],authUrl:[1,"auth-url"],iframeUrl:[1,"iframe-url"],error:[1],localSignup:[4,"local-signup"],signupNjump:[4,"signup-njump"],njumpIframe:[1,"njump-iframe"],accounts:[1040],recents:[1040],darkMode:[1028,"dark-mode"],welcomeTitle:[1,"welcome-title"],welcomeDescription:[1,"welcome-description"],connectionString:[1,"connection-string"],connectionStringServices:[16]},void 0,{isLoading:["watchLoadingHandler"],isLoadingExtension:["watchLoadingExtensionHandler"],isOTP:["watchOTPHandler"],authUrl:["watchAuthUrlHandler"],iframeUrl:["watchIframeUrlHandler"],njumpIframe:["watchNjumpIframeHandler"],error:["watchErrorHandler"]}]);function defineCustomElement$4(){typeof customElements>"u"||["nl-auth","button-base","nl-confirm-logout","nl-connect","nl-iframe","nl-import-flow","nl-info","nl-info-extension","nl-loading","nl-local-signup","nl-login-status","nl-otp-migrate","nl-previously-logged","nl-select","nl-signin","nl-signin-bunker-url","nl-signin-connection-string","nl-signin-otp","nl-signin-read-only","nl-signup","nl-welcome","nl-welcome-signin","nl-welcome-signup"].forEach(e=>{switch(e){case"nl-auth":customElements.get(e)||customElements.define(e,NlAuth);break;case"button-base":customElements.get(e)||defineCustomElement$q();break;case"nl-confirm-logout":customElements.get(e)||defineCustomElement$p();break;case"nl-connect":customElements.get(e)||defineCustomElement$o();break;case"nl-iframe":customElements.get(e)||defineCustomElement$n();break;case"nl-import-flow":customElements.get(e)||defineCustomElement$l();break;case"nl-info":customElements.get(e)||defineCustomElement$k();break;case"nl-info-extension":customElements.get(e)||defineCustomElement$j();break;case"nl-loading":customElements.get(e)||defineCustomElement$i();break;case"nl-local-signup":customElements.get(e)||defineCustomElement$h();break;case"nl-login-status":customElements.get(e)||defineCustomElement$g();break;case"nl-otp-migrate":customElements.get(e)||defineCustomElement$f();break;case"nl-previously-logged":customElements.get(e)||defineCustomElement$e();break;case"nl-select":customElements.get(e)||defineCustomElement$m();break;case"nl-signin":customElements.get(e)||defineCustomElement$d();break;case"nl-signin-bunker-url":customElements.get(e)||defineCustomElement$c();break;case"nl-signin-connection-string":customElements.get(e)||defineCustomElement$b();break;case"nl-signin-otp":customElements.get(e)||defineCustomElement$a();break;case"nl-signin-read-only":customElements.get(e)||defineCustomElement$9();break;case"nl-signup":customElements.get(e)||defineCustomElement$8();break;case"nl-welcome":customElements.get(e)||defineCustomElement$7();break;case"nl-welcome-signin":customElements.get(e)||defineCustomElement$6();break;case"nl-welcome-signup":customElements.get(e)||defineCustomElement$5()}})}defineCustomElement$4();const NlButton=proxyCustomElement(class extends H{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.theme="default",this.darkMode=!1,this.titleBtn="Open modal",this.disabled=!1}render(){return h("button-base",{key:"9f7936090efc7263cce71d1ad89490d7f5445991",theme:this.theme,darkMode:this.darkMode,titleBtn:this.titleBtn,disabled:this.disabled})}},[1,"nl-button",{theme:[1],darkMode:[4,"dark-mode"],titleBtn:[1,"title-btn"],disabled:[4]}]);function defineCustomElement$3(){typeof customElements>"u"||["nl-button","button-base"].forEach(e=>{switch(e){case"nl-button":customElements.get(e)||customElements.define(e,NlButton);break;case"button-base":customElements.get(e)||defineCustomElement$q()}})}defineCustomElement$3();const nlChangeAccountCss=baseCss,NlChangeAccountStyle0=nlChangeAccountCss,NLChangeAccount=proxyCustomElement(class extends H{constructor(){super(),this.__registerHost(),this.handleOpenWelcomeModal=createEvent(this,"handleOpenWelcomeModal"),this.handleSwitchAccount=createEvent(this,"handleSwitchAccount"),this.isOpen=!1,this.options=[],this.accounts=[],this.currentAccount=null,this.mode=!1,this.darkMode=!1,this.themeState="default",this.theme="default"}handleWindowClick(){this.wrapperRef.querySelector(".listClass")&&(this.isOpen=!1)}toggleDropdown(){this.isOpen=!this.isOpen,this.calculateDropdownPosition()}watchPropHandler(e){this.themeState=e}watchModeHandler(e){this.mode=e}watchAccountsHandler(e){this.options=e}connectedCallback(){this.themeState=this.theme,this.mode=this.darkMode}calculateDropdownPosition(){if(this.isOpen&&this.buttonRef){const e=this.buttonRef.getBoundingClientRect();this.ulRef.style.top=`${e.height}px`}}handleChange(e){this.handleSwitchAccount.emit(e)}handleOpenModal(){this.handleOpenWelcomeModal.emit()}render(){const e=(this.isOpen?"listClass flex flex-col gap-2":"hidden")+" w-full nl-select-list absolute z-10 left-0 shadow-md rounded-lg p-2 mt-1 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full",t=(this.isOpen?"rotate-180":"rotate-0")+" duration-300 flex-shrink-0 w-4 h-4 text-gray-500",n=this.options&&this.currentAccount?this.options.filter(r=>r.pubkey!==this.currentAccount.pubkey||r.authMethod!==this.currentAccount.authMethod):[];return h("div",{key:"4e15e39f7ac6a552bfc772396e3e9ef8eeca95cc",class:`theme-${this.themeState}`},h("div",{key:"eae10769ce35dc4cc072d2361c1ee1390c79c822",class:"relative",ref:r=>this.wrapperRef=r},h("button",{key:"e585a44168809f27b99201f7e13bd5db5e4f6569",ref:r=>this.buttonRef=r,onClick:()=>this.toggleDropdown(),type:"button",class:"nl-select peer py-3 px-4 flex items-center w-full justify-between border-transparent rounded-lg text-sm disabled:opacity-50 disabled:pointer-events-none dark:border-transparent"},h("span",{key:"006ed9a67b57227d4dab51f0b6bcb8290cd9d3ac",class:"text-gray-500"},"Switch profile"),h("svg",{key:"5f824a479165929698fab31b8837b89418587652",class:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},h("path",{key:"600914907723c9f8d01a15da357ccb825c1d1e6a",d:"m6 9 6 6 6-6"}))),h("ul",{key:"9b5b68724a3bce995e6b8b0a9d0eb653baedf79a",ref:r=>this.ulRef=r,class:e},this.options&&n.map(r=>{const o=!!(r!=null&&r.picture),s=r.name||r.nip05||r.pubkey;return h("li",{onClick:()=>this.handleChange(r),class:"nl-select-option flex cursor-pointer items-center gap-x-3.5 py-2 px-3 rounded-lg text-sm"},h("div",{class:"uppercase font-bold w-full max-w-6 h-6 rounded-full border border-gray-400 flex justify-center items-center"},o?h("img",{class:"w-full rounded-full",src:r.picture,alt:"Logo"}):!!s?s[0]:h("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-full"},h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M17.982 18.725A7.488 7.488 0 0 0 12 15.75a7.488 7.488 0 0 0-5.982 2.975m11.963 0a9 9 0 1 0-11.963 0m11.963 0A8.966 8.966 0 0 1 12 21a8.966 8.966 0 0 1-5.982-2.275M15 9.75a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))),h("div",{class:"overflow-hidden flex flex-col w-full"},h("div",{class:"truncate overflow-hidden"},s),h("nl-login-status",{info:r})))}),h("li",{key:"936f2b75ca2dfca3483650d5d62fc50182cfc8f2",class:"first:pt-0 pt-2 border-t-[1px] first:border-none border-gray-300"},h("div",{key:"be0b4f29e70d8e2bc9fd1cc04c0fb43ad3dd5cac",onClick:()=>this.handleOpenModal(),class:"nl-select-option flex cursor-pointer items-center gap-x-3.5 py-2 px-3 rounded-lg text-sm"},h("div",{key:"bdd2a67e5763726666fcea91b0e7de67fe855994",class:"uppercase font-bold w-6 h-6 rounded-full border border-gray-400 flex justify-center items-center"},h("svg",{key:"f3a258f3e510ccb83b95bf3abecf65c248c8b0f1",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-4 h-4"},h("path",{key:"dafaa898f3e042531a923a9a77b94511895c6102","stroke-linecap":"round","stroke-linejoin":"round",d:"M12 4.5v15m7.5-7.5h-15"}))),"Add profile")))))}get element(){return this}static get watchers(){return{theme:["watchPropHandler"],darkMode:["watchModeHandler"],accounts:["watchAccountsHandler"]}}static get style(){return NlChangeAccountStyle0}},[0,"nl-change-account",{accounts:[16],currentAccount:[16],darkMode:[4,"dark-mode"],theme:[1],isOpen:[32],options:[32],mode:[32],themeState:[32]},[[8,"click","handleWindowClick"]],{theme:["watchPropHandler"],darkMode:["watchModeHandler"],accounts:["watchAccountsHandler"]}]);function defineCustomElement$2(){typeof customElements>"u"||["nl-change-account","nl-login-status"].forEach(e=>{switch(e){case"nl-change-account":customElements.get(e)||customElements.define(e,NLChangeAccount);break;case"nl-login-status":customElements.get(e)||defineCustomElement$g()}})}defineCustomElement$2();const nlDialogCss=baseCss,NlDialogStyle0=nlDialogCss,NlDialog=proxyCustomElement(class extends H{constructor(){super(),this.__registerHost(),this.__attachShadow()}componentDidLoad(){var e;(e=this.dialogElement)===null||e===void 0||e.showModal()}disconnectedCallback(){var e;(e=this.dialogElement)===null||e===void 0||e.close()}render(){return h("dialog",{key:"2f2dfe3ccb1f617f4a8220cf19e832de98dccce5",ref:e=>this.dialogElement=e,class:"m-auto nl-banner-dialog",style:{border:"0",backgroundColor:"transparent"}},h("slot",{key:"fcf90b01dd2cbbaae8eb97cca3ec67e75cd61d63"}))}static get style(){return NlDialogStyle0}},[1,"nl-dialog"]);function defineCustomElement$1(){typeof customElements>"u"||["nl-dialog"].forEach(e=>{e==="nl-dialog"&&(customElements.get(e)||customElements.define(e,NlDialog))})}defineCustomElement$1();const nlBannerCss=baseCss,NlBannerStyle0=nlBannerCss,NlBanner=proxyCustomElement(class extends H{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.handleNotifyConfirmBanner=createEvent(this,"handleNotifyConfirmBanner"),this.handleNotifyConfirmBannerIframe=createEvent(this,"handleNotifyConfirmBannerIframe"),this.handleLoginBanner=createEvent(this,"handleLoginBanner"),this.handleLogoutBanner=createEvent(this,"handleLogoutBanner"),this.handleOpenWelcomeModal=createEvent(this,"handleOpenWelcomeModal"),this.handleConfirmLogout=createEvent(this,"handleConfirmLogout"),this.handleImportModal=createEvent(this,"handleImportModal"),this.theme="default",this.darkMode=!1,this.hiddenMode=!1,this.titleBanner="",this.isOpen=!1,this.isLoading=!1,this.notify=null,this.userInfo=null,this.accounts=[],this.isUserImgError=!1,this.domain="",this.mode="",this.url="",this.isOpenConfirm=!1}watchNotifyHandler(e){var t,n,r,o;this.isOpen=!0,this.isOpenConfirm=!0,this.domain=((t=this.userInfo)===null||t===void 0?void 0:t.domain)||((o=(r=(n=this.userInfo)===null||n===void 0?void 0:n.nip05)===null||r===void 0?void 0:r.split("@"))===null||o===void 0?void 0:o[1])||"",this.mode=e.mode,this.url=e.url,this.mode||(this.isOpenConfirm=!1,this.isOpen=!1)}handleOpen(){this.userInfo?this.isOpen=!0:this.handleOpenWelcomeModal.emit()}handleClose(){this.isOpen=!1}handleLogin(){this.handleLoginBanner.emit(METHOD_MODULE.LOGIN),this.handleClose()}handleSignup(){this.handleLoginBanner.emit(METHOD_MODULE.SIGNUP),this.handleClose()}handleImport(){this.handleImportModal.emit(),this.handleClose()}handleLogout(){if(localStorage.getItem("backupKey"))return this.handleLogoutBanner.emit(METHOD_MODULE.LOGOUT),this.handleClose(),void localStorage.removeItem("backupKey");this.userInfo.authMethod==="local"?this.handleConfirmLogout.emit():this.handleLogoutBanner.emit(METHOD_MODULE.LOGOUT),this.handleClose()}handleConfirm(){switch(this.mode){case"authUrl":this.handleNotifyConfirmBanner.emit(this.url);break;case"iframeAuthUrl":this.handleNotifyConfirmBannerIframe.emit(this.url)}this.handleClose()}render(){var e,t,n,r,o,s;const i=!!(!((e=this.userInfo)===null||e===void 0)&&e.picture),a=((t=this.userInfo)===null||t===void 0?void 0:t.name)||((o=(r=(n=this.userInfo)===null||n===void 0?void 0:n.nip05)===null||r===void 0?void 0:r.split("@"))===null||o===void 0?void 0:o[0])||((s=this.userInfo)===null||s===void 0?void 0:s.pubkey)||"",l=!!a,c=this.userInfo&&this.userInfo.authMethod==="local",d=localStorage.getItem("backupKey"),p=h("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-full"},h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M17.982 18.725A7.488 7.488 0 0 0 12 15.75a7.488 7.488 0 0 0-5.982 2.975m11.963 0a9 9 0 1 0-11.963 0m11.963 0A8.966 8.966 0 0 1 12 21a8.966 8.966 0 0 1-5.982-2.275M15 9.75a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})),g=h(Fragment,null,h("div",{class:"block w-[48px] h-[46px] relative z-10"},h("div",{onClick:()=>this.handleOpen(),class:"flex w-52 h-[46px] items-center pl-[11px]"},h("span",{class:(this.isLoading?"w-5 h-5 border-[2px] mr-3.5 ml-[2px] opacity-1":"w-0 h-0 border-[0px] mr-0 opacity-0 ml-0")+" animate-spin transition-all duration-300 ease-in-out inline-block border-current border-t-transparent text-slate-900 dark:text-gray-300 rounded-full",role:"status","aria-label":"loading"}),this.userInfo?h("div",{class:"uppercase font-bold w-6 h-6 mr-2 rounded-full border border-gray-200 flex justify-center items-center"},i?this.isUserImgError?p:h("img",{class:"w-full rounded-full",src:this.userInfo.picture,alt:"Logo",onError:()=>this.isUserImgError=!0}):l?a[0]:p):h("div",{class:"flex justify-center items-center"},h("svg",{class:"w-6 h-6",width:"225",height:"224",viewBox:"0 0 225 224",fill:"none",xmlns:"http://www.w3.org/2000/svg"},h("rect",{width:"224.047",height:"224",rx:"64",fill:"#6951FA"}),h("path",{d:"M162.441 135.941V88.0593C170.359 85.1674 176 77.5348 176 68.6696C176 57.2919 166.708 48 155.33 48C143.953 48 134.661 57.2444 134.661 68.6696C134.661 77.5822 140.302 85.1674 148.219 88.0593V135.941C147.698 136.13 147.176 136.367 146.655 136.604L87.3956 77.3452C88.6282 74.6904 89.2919 71.7511 89.2919 68.6696C89.2919 57.2444 80.0474 48 68.6696 48C57.2919 48 48 57.2444 48 68.6696C48 77.5822 53.6415 85.1674 61.5585 88.0593V135.941C53.6415 138.833 48 146.465 48 155.33C48 166.708 57.2444 176 68.6696 176C80.0948 176 89.3393 166.708 89.3393 155.33C89.3393 146.418 83.6978 138.833 75.7807 135.941V88.0593C76.3022 87.8696 76.8237 87.6326 77.3452 87.3956L136.604 146.655C135.372 149.31 134.708 152.249 134.708 155.33C134.708 166.708 143.953 176 155.378 176C166.803 176 176.047 166.708 176.047 155.33C176.047 146.418 170.406 138.833 162.489 135.941H162.441Z",fill:"white"})),this.isOpen&&h("span",{class:"px-2"},h("b",null,"Nostr")," Login")),this.isOpen&&l&&h("div",{class:"show-slow truncate w-16 text-xs"},a),this.isOpen&&l&&h("nl-login-status",{info:this.userInfo}))),h("button",{onClick:()=>this.handleClose(),type:"button",class:(this.isOpen?"z-20":"z-0")+" nl-action-button absolute right-2 top-2 z-0 show-slow grid place-items-center w-7 h-7 text-sm font-semibold rounded-full border border-transparent"},h("span",{class:"sr-only"},"Close"),h("svg",{class:"flex-shrink-0 w-5 h-5",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},h("path",{d:"M18 6 6 18"}),h("path",{d:"m6 6 12 12"}))),h("div",{class:"p-3 show-slow"},this.isOpenConfirm?h("div",null,h("div",{class:"w-8 h-8 p-1/2 rounded-full border border-gray-200 bg-white mb-2 mt-2 show-slow m-auto"},h("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"#5a68ff",class:"w-full"},h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"}))),h("p",{class:"mb-2 text-center max-w-40 min-w-40 mx-auto"},this.mode==="timeout"?"Keys not responding, check your key storage app":`Confirmation required at ${this.domain}`),this.mode==="timeout"?h("a",{onClick:()=>this.handleClose(),href:`https://${this.domain}`,target:"_blank",class:"nl-button text-nowrap py-2.5 px-3 w-full inline-flex justify-center items-center gap-x-2 text-sm font-medium rounded-lg disabled:opacity-50 disabled:pointer-events-none dark:focus:outline-none dark:focus:ring-1 dark:focus:ring-gray-600"},"Go to ",this.domain):this.mode==="rebind"?h("iframe",{src:this.url,width:"180",height:"80",frameBorder:"0"}):h("button-base",{onClick:()=>this.handleConfirm(),titleBtn:"Confirm"})):h("div",null,h("div",null,this.titleBanner&&h("p",{class:"mb-2 text-center show-slow max-w-40 min-w-40 mx-auto"},this.titleBanner),c&&h(Fragment,null,!d&&h("p",{class:"mb-2 text-center show-slow text-red-400 max-w-40 min-w-40 mx-auto"},"Your profile may be lost if you close this tab"),h("div",{class:"mb-2"},h("button-base",{onClick:()=>this.handleImport(),theme:"lemonade",titleBtn:"Back up profile"}))),h("div",{class:"mb-2"},h("nl-change-account",{currentAccount:this.userInfo,accounts:this.accounts})),this.userInfo?h("button-base",{onClick:()=>this.handleLogout(),titleBtn:"Log out"}):h("div",null,h("button-base",{onClick:()=>this.handleLogin(),titleBtn:"Log in"},h("svg",{style:{display:"none"},slot:"icon-start",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"flex-shrink-0 w-4 h-4"},h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z"}))),h("button-base",{onClick:()=>this.handleSignup(),titleBtn:"Sign up"},h("svg",{style:{display:"none"},slot:"icon-start",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"flex-shrink-0 w-4 h-4"},h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M18 7.5v3m0 0v3m0-3h3m-3 0h-3m-2.25-4.125a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0ZM3 19.235v-.11a6.375 6.375 0 0 1 12.75 0v.109A12.318 12.318 0 0 1 9.374 21c-2.331 0-4.512-.645-6.374-1.766Z"})))))))),v=function b(C,_){_=_||document.body;const k=Array.from(_.querySelectorAll(C)),$=function(N){b(C,N).forEach(T=>{k.includes(T)||k.push(T)})};_.shadowRoot&&$(_.shadowRoot);for(const N of Array.from(_.querySelectorAll("*")))N.shadowRoot&&$(N.shadowRoot);return k}("dialog"),x=!!v.find(b=>b.open&&!b.classList.contains("nl-banner-dialog"));return h("div",{class:`theme-${this.theme} ${!this.isOpen&&this.hiddenMode?"hidden":""}`},h("div",{class:this.darkMode&&"dark",dir:"ltr"},this.isOpenConfirm&&x?h("nl-dialog",null,h("div",{class:`nl-banner ${this.isOpen?"w-52 h-auto right-2 rounded-r-lg isOpen ":"rounded-r-none hover:rounded-r-lg cursor-pointer"} z-50 w-12 h-12 fixed top-52 right-0 inline-block gap-x-2 text-sm font-medium rounded-lg hover:right-2 transition-all duration-300 ease-in-out`},g)):h("div",{class:`nl-banner ${this.isOpen?"w-52 h-auto right-2 rounded-r-lg isOpen":"rounded-r-none hover:rounded-r-lg cursor-pointer"} z-50 w-12 h-12 fixed top-52 right-0 inline-block gap-x-2 text-sm font-medium rounded-lg hover:right-2 transition-all duration-300 ease-in-out`},g)))}static get watchers(){return{notify:["watchNotifyHandler"]}}static get style(){return NlBannerStyle0}},[1,"nl-banner",{theme:[1025],darkMode:[1028,"dark-mode"],hiddenMode:[1028,"hidden-mode"],titleBanner:[1,"title-banner"],isOpen:[1028,"is-open"],isLoading:[4,"is-loading"],notify:[16],userInfo:[16],accounts:[1040],isUserImgError:[32],domain:[32],mode:[32],url:[32],isOpenConfirm:[32]},void 0,{notify:["watchNotifyHandler"]}]);function defineCustomElement(){typeof customElements>"u"||["nl-banner","button-base","nl-change-account","nl-dialog","nl-login-status"].forEach(e=>{switch(e){case"nl-banner":customElements.get(e)||customElements.define(e,NlBanner);break;case"button-base":customElements.get(e)||defineCustomElement$q();break;case"nl-change-account":customElements.get(e)||defineCustomElement$2();break;case"nl-dialog":customElements.get(e)||defineCustomElement$1();break;case"nl-login-status":customElements.get(e)||defineCustomElement$g()}})}defineCustomElement();var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var lib$1={},types={};Object.defineProperty(types,"__esModule",{value:!0});var ee={},taskCollection$1={},taskCollection={},bakeCollection={};(function(exports$1){Object.defineProperty(exports$1,"__esModule",{value:!0}),exports$1.bakeCollectionVariadic=exports$1.bakeCollectionAwait=exports$1.bakeCollection=exports$1.BAKED_EMPTY_FUNC=void 0,exports$1.BAKED_EMPTY_FUNC=function(){};var FORLOOP_FALLBACK=1500;function generateArgsDefCode(e){var t="";if(e===0)return t;for(var n=0;n<e-1;++n)t+="arg"+String(n)+", ";return t+="arg"+String(e-1)}function generateBodyPartsCode(e,t){for(var n="",r="",o=0;o<t;++o)n+="var f".concat(o," = collection[").concat(o,`];
|
|
9
|
+
`),r+="f".concat(o,"(").concat(e,`)
|
|
10
|
+
`);return{funcDefCode:n,funcCallCode:r}}function generateBodyPartsVariadicCode(e){for(var t="",n="",r=0;r<e;++r)t+="var f".concat(r," = collection[").concat(r,`];
|
|
11
|
+
`),n+="f".concat(r,`.apply(undefined, arguments)
|
|
12
|
+
`);return{funcDefCode:t,funcCallCode:n}}function bakeCollection(collection,fixedArgsNum){if(collection.length===0)return exports$1.BAKED_EMPTY_FUNC;if(collection.length===1)return collection[0];var funcFactoryCode;if(collection.length<FORLOOP_FALLBACK){var argsDefCode=generateArgsDefCode(fixedArgsNum),_a=generateBodyPartsCode(argsDefCode,collection.length),funcDefCode=_a.funcDefCode,funcCallCode=_a.funcCallCode;funcFactoryCode=`(function(collection) {
|
|
13
|
+
`.concat(funcDefCode,`
|
|
14
|
+
collection = undefined;
|
|
15
|
+
return (function(`).concat(argsDefCode,`) {
|
|
16
|
+
`).concat(funcCallCode,`
|
|
17
|
+
});
|
|
18
|
+
})`)}else{var argsDefCode=generateArgsDefCode(fixedArgsNum);funcFactoryCode=collection.length%10==0?`(function(collection) {
|
|
19
|
+
return (function(`.concat(argsDefCode,`) {
|
|
20
|
+
for (var i = 0; i < collection.length; i += 10) {
|
|
21
|
+
collection[i](`).concat(argsDefCode,`);
|
|
22
|
+
collection[i+1](`).concat(argsDefCode,`);
|
|
23
|
+
collection[i+2](`).concat(argsDefCode,`);
|
|
24
|
+
collection[i+3](`).concat(argsDefCode,`);
|
|
25
|
+
collection[i+4](`).concat(argsDefCode,`);
|
|
26
|
+
collection[i+5](`).concat(argsDefCode,`);
|
|
27
|
+
collection[i+6](`).concat(argsDefCode,`);
|
|
28
|
+
collection[i+7](`).concat(argsDefCode,`);
|
|
29
|
+
collection[i+8](`).concat(argsDefCode,`);
|
|
30
|
+
collection[i+9](`).concat(argsDefCode,`);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
})`):collection.length%4==0?`(function(collection) {
|
|
34
|
+
return (function(`.concat(argsDefCode,`) {
|
|
35
|
+
for (var i = 0; i < collection.length; i += 4) {
|
|
36
|
+
collection[i](`).concat(argsDefCode,`);
|
|
37
|
+
collection[i+1](`).concat(argsDefCode,`);
|
|
38
|
+
collection[i+2](`).concat(argsDefCode,`);
|
|
39
|
+
collection[i+3](`).concat(argsDefCode,`);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
})`):collection.length%3==0?`(function(collection) {
|
|
43
|
+
return (function(`.concat(argsDefCode,`) {
|
|
44
|
+
for (var i = 0; i < collection.length; i += 3) {
|
|
45
|
+
collection[i](`).concat(argsDefCode,`);
|
|
46
|
+
collection[i+1](`).concat(argsDefCode,`);
|
|
47
|
+
collection[i+2](`).concat(argsDefCode,`);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
})`):`(function(collection) {
|
|
51
|
+
return (function(`.concat(argsDefCode,`) {
|
|
52
|
+
for (var i = 0; i < collection.length; ++i) {
|
|
53
|
+
collection[i](`).concat(argsDefCode,`);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
})`)}var funcFactory=eval(funcFactoryCode);return funcFactory(collection)}function bakeCollectionAwait(collection,fixedArgsNum){if(collection.length===0)return exports$1.BAKED_EMPTY_FUNC;if(collection.length===1)return collection[0];var funcFactoryCode;if(collection.length<FORLOOP_FALLBACK){var argsDefCode=generateArgsDefCode(fixedArgsNum),_a=generateBodyPartsCode(argsDefCode,collection.length),funcDefCode=_a.funcDefCode,funcCallCode=_a.funcCallCode;funcFactoryCode=`(function(collection) {
|
|
57
|
+
`.concat(funcDefCode,`
|
|
58
|
+
collection = undefined;
|
|
59
|
+
return (function(`).concat(argsDefCode,`) {
|
|
60
|
+
return Promise.all([ `).concat(funcCallCode,` ]);
|
|
61
|
+
});
|
|
62
|
+
})`)}else{var argsDefCode=generateArgsDefCode(fixedArgsNum);funcFactoryCode=`(function(collection) {
|
|
63
|
+
return (function(`.concat(argsDefCode,`) {
|
|
64
|
+
var promises = Array(collection.length);
|
|
65
|
+
for (var i = 0; i < collection.length; ++i) {
|
|
66
|
+
promises[i] = collection[i](`).concat(argsDefCode,`);
|
|
67
|
+
}
|
|
68
|
+
return Promise.all(promises);
|
|
69
|
+
});
|
|
70
|
+
})`)}var funcFactory=eval(funcFactoryCode);return funcFactory(collection)}function bakeCollectionVariadic(collection){if(collection.length===0)return exports$1.BAKED_EMPTY_FUNC;if(collection.length===1)return collection[0];var funcFactoryCode;if(collection.length<FORLOOP_FALLBACK){var _a=generateBodyPartsVariadicCode(collection.length),funcDefCode=_a.funcDefCode,funcCallCode=_a.funcCallCode;funcFactoryCode=`(function(collection) {
|
|
71
|
+
`.concat(funcDefCode,`
|
|
72
|
+
collection = undefined;
|
|
73
|
+
return (function() {
|
|
74
|
+
`).concat(funcCallCode,`
|
|
75
|
+
});
|
|
76
|
+
})`)}else funcFactoryCode=`(function(collection) {
|
|
77
|
+
return (function() {
|
|
78
|
+
for (var i = 0; i < collection.length; ++i) {
|
|
79
|
+
collection[i].apply(undefined, arguments);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
})`;var funcFactory=eval(funcFactoryCode);return funcFactory(collection)}exports$1.bakeCollection=bakeCollection,exports$1.bakeCollectionAwait=bakeCollectionAwait,exports$1.bakeCollectionVariadic=bakeCollectionVariadic})(bakeCollection);var __spreadArray$1=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r,o=0,s=t.length;o<s;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(taskCollection,"__esModule",{value:!0}),taskCollection.TaskCollection=taskCollection._fast_remove_single=void 0;var bake_collection_1=bakeCollection;function push_norebuild(e,t){var n,r=this.length;if(r>1)t?((n=this._tasks).push.apply(n,arguments),this.length+=arguments.length):(this._tasks.push(e),this.length++);else if(t){var o;r===1?((o=Array(1+arguments.length)).push(o),o.push.apply(o,arguments),this._tasks=o):((o=Array(arguments.length)).push.apply(o,arguments),this._tasks=o),this.length+=arguments.length}else this._tasks=r===1?[this._tasks,e]:e,this.length++}function push_rebuild(e,t){var n,r=this.length;if(r>1)t?((n=this._tasks).push.apply(n,arguments),this.length+=arguments.length):(this._tasks.push(e),this.length++);else if(t){var o;r===1?((o=Array(1+arguments.length)).push(o),o.push.apply(o,arguments),this._tasks=o):((o=Array(arguments.length)).push.apply(o,arguments),this._tasks=o),this.length+=arguments.length}else this._tasks=r===1?[this._tasks,e]:e,this.length++;this.firstEmitBuildStrategy?this.call=rebuild_on_first_call:this.rebuild()}function _fast_remove_single(e,t){t!==-1&&(t===0?e.shift():t===e.length-1?e.length=e.length-1:e.splice(t,1))}function removeLast_norebuild(e){this.length!==0&&(this.length===1?this._tasks===e&&(this.length=0):(_fast_remove_single(this._tasks,this._tasks.lastIndexOf(e)),this._tasks.length===1?(this._tasks=this._tasks[0],this.length=1):this.length=this._tasks.length))}function removeLast_rebuild(e){if(this.length!==0){if(this.length===1)return this._tasks===e&&(this.length=0),this.firstEmitBuildStrategy?void(this.call=bake_collection_1.BAKED_EMPTY_FUNC):void this.rebuild();_fast_remove_single(this._tasks,this._tasks.lastIndexOf(e)),this._tasks.length===1?(this._tasks=this._tasks[0],this.length=1):this.length=this._tasks.length,this.firstEmitBuildStrategy?this.call=rebuild_on_first_call:this.rebuild()}}function insert_norebuild(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this.length===0?(this._tasks=n,this.length=1):this.length===1?(n.unshift(this._tasks),this._tasks=n,this.length=this._tasks.length):((t=this._tasks).splice.apply(t,__spreadArray$1([e,0],n,!1)),this.length=this._tasks.length)}function insert_rebuild(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this.length===0?(this._tasks=n,this.length=1):this.length===1?(n.unshift(this._tasks),this._tasks=n,this.length=this._tasks.length):((t=this._tasks).splice.apply(t,__spreadArray$1([e,0],n,!1)),this.length=this._tasks.length),this.firstEmitBuildStrategy?this.call=rebuild_on_first_call:this.rebuild()}function rebuild_noawait(){this.length===0?this.call=bake_collection_1.BAKED_EMPTY_FUNC:this.length===1?this.call=this._tasks:this.call=(0,bake_collection_1.bakeCollection)(this._tasks,this.argsNum)}function rebuild_await(){this.length===0?this.call=bake_collection_1.BAKED_EMPTY_FUNC:this.length===1?this.call=this._tasks:this.call=(0,bake_collection_1.bakeCollectionAwait)(this._tasks,this.argsNum)}function rebuild_on_first_call(){this.rebuild(),this.call.apply(void 0,arguments)}taskCollection._fast_remove_single=_fast_remove_single;var TaskCollection=function(e,t,n,r){t===void 0&&(t=!0),n===void 0&&(n=null),r===void 0&&(r=!1),this.awaitTasks=r,this.call=bake_collection_1.BAKED_EMPTY_FUNC,this.argsNum=e,this.firstEmitBuildStrategy=!0,this.rebuild=r?rebuild_await.bind(this):rebuild_noawait.bind(this),this.setAutoRebuild(t),n?typeof n=="function"?(this._tasks=n,this.length=1):(this._tasks=n,this.length=n.length):(this._tasks=null,this.length=0),t&&this.rebuild()};function fastClear(){this._tasks=null,this.length=0,this.call=bake_collection_1.BAKED_EMPTY_FUNC}function clear(){this._tasks=null,this.length=0,this.call=bake_collection_1.BAKED_EMPTY_FUNC}function growArgsNum(e){this.argsNum<e&&(this.argsNum=e,this.firstEmitBuildStrategy?this.call=rebuild_on_first_call:this.rebuild())}function setAutoRebuild(e){e?(this.push=push_rebuild.bind(this),this.insert=insert_rebuild.bind(this),this.removeLast=removeLast_rebuild.bind(this)):(this.push=push_norebuild.bind(this),this.insert=insert_norebuild.bind(this),this.removeLast=removeLast_norebuild.bind(this))}function tasksAsArray(){return this.length===0?[]:this.length===1?[this._tasks]:this._tasks}function setTasks(e){e.length===0?(this.length=0,this.call=bake_collection_1.BAKED_EMPTY_FUNC):e.length===1?(this.length=1,this.call=e[0],this._tasks=e[0]):(this.length=e.length,this._tasks=e,this.firstEmitBuildStrategy?this.call=rebuild_on_first_call:this.rebuild())}taskCollection.TaskCollection=TaskCollection,TaskCollection.prototype.fastClear=fastClear,TaskCollection.prototype.clear=clear,TaskCollection.prototype.growArgsNum=growArgsNum,TaskCollection.prototype.setAutoRebuild=setAutoRebuild,TaskCollection.prototype.tasksAsArray=tasksAsArray,TaskCollection.prototype.setTasks=setTasks,function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(r,o,s,i){i===void 0&&(i=s);var a=Object.getOwnPropertyDescriptor(o,s);a&&!("get"in a?!o.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return o[s]}}),Object.defineProperty(r,i,a)}:function(r,o,s,i){i===void 0&&(i=s),r[i]=o[s]}),n=commonjsGlobal&&commonjsGlobal.__exportStar||function(r,o){for(var s in r)s==="default"||Object.prototype.hasOwnProperty.call(o,s)||t(o,r,s)};Object.defineProperty(e,"__esModule",{value:!0}),n(taskCollection,e)}(taskCollection$1);var utils$2={};function nullObj(){var e={__proto__:null,prototype:null};return e}Object.defineProperty(utils$2,"__esModule",{value:!0}),utils$2.nullObj=void 0,utils$2.nullObj=nullObj;var __spreadArray=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r,o=0,s=t.length;o<s;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(ee,"__esModule",{value:!0}),ee.EventEmitter=void 0;var task_collection_1=taskCollection$1,utils_1=utils$2;function emit(e,t,n,r,o,s){var i=this.events[e];return!!i&&i.length!==0&&(i.argsNum<6?i.call(t,n,r,o,s):i.call.apply(void 0,arguments),!0)}function emitHasOnce(e,t,n,r,o,s){var i=this.events[e];if(i){if(i.length===0)return!1;i.argsNum<6?i.call(t,n,r,o,s):i.call.apply(void 0,arguments)}var a=this.onceEvents[e];if(a){if(typeof a=="function")this.onceEvents[e]=void 0,arguments.length<6?a(t,n,r,o,s):a.apply(void 0,arguments);else{var l=a;if(this.onceEvents[e]=void 0,arguments.length<6)for(var c=0;c<l.length;++c)l[c](t,n,r,o,s);else for(c=0;c<l.length;++c)l[c].apply(void 0,arguments)}return!0}return!!i}var EventEmitter=function(){function e(){this.events=(0,utils_1.nullObj)(),this.onceEvents=(0,utils_1.nullObj)(),this._symbolKeys=new Set,this.maxListeners=1/0}return Object.defineProperty(e.prototype,"_eventsCount",{get:function(){return this.eventNames().length},enumerable:!1,configurable:!0}),e}();function once(e,t){switch(this.emit===emit&&(this.emit=emitHasOnce),typeof this.onceEvents[e]){case"undefined":this.onceEvents[e]=t,typeof e=="symbol"&&this._symbolKeys.add(e);break;case"function":this.onceEvents[e]=[this.onceEvents[e],t];break;case"object":this.onceEvents[e].push(t)}return this}function addListener(e,t,n){if(n===void 0&&(n=t.length),typeof t!="function")throw new TypeError("The listener must be a function");var r=this.events[e];return r?(r.push(t),r.growArgsNum(n),this.maxListeners!==1/0&&this.maxListeners<=r.length&&console.warn('Maximum event listeners for "'.concat(String(e),'" event!'))):(this.events[e]=new task_collection_1.TaskCollection(n,!0,t,!1),typeof e=="symbol"&&this._symbolKeys.add(e)),this}function removeListener(e,t){var n=this.events[e];n&&n.removeLast(t);var r=this.onceEvents[e];return r&&(typeof r=="function"?this.onceEvents[e]=void 0:typeof r=="object"&&(r.length===1&&r[0]===t?this.onceEvents[e]=void 0:(0,task_collection_1._fast_remove_single)(r,r.lastIndexOf(t)))),this}function addListenerBound(e,t,n,r){n===void 0&&(n=this),r===void 0&&(r=t.length),this.boundFuncs||(this.boundFuncs=new Map);var o=t.bind(n);return this.boundFuncs.set(t,o),this.addListener(e,o,r)}function removeListenerBound(e,t){var n,r,o=(n=this.boundFuncs)===null||n===void 0?void 0:n.get(t);return(r=this.boundFuncs)===null||r===void 0||r.delete(t),this.removeListener(e,o)}function hasListeners(e){return this.events[e]&&!!this.events[e].length}function prependListener(e,t,n){if(n===void 0&&(n=t.length),typeof t!="function")throw new TypeError("The listener must be a function");var r=this.events[e];return r&&r instanceof task_collection_1.TaskCollection?(r.insert(0,t),r.growArgsNum(n),this.maxListeners!==1/0&&this.maxListeners<=r.length&&console.warn('Maximum event listeners for "'.concat(String(e),'" event!'))):(r=this.events[e]=new task_collection_1.TaskCollection(n,!0,t,!1),typeof e=="symbol"&&this._symbolKeys.add(e)),this}function prependOnceListener(e,t){this.emit===emit&&(this.emit=emitHasOnce);var n=this.onceEvents[e];return n?typeof n!="object"?(this.onceEvents[e]=[t,n],typeof e=="symbol"&&this._symbolKeys.add(e)):(n.unshift(t),this.maxListeners!==1/0&&this.maxListeners<=n.length&&console.warn('Maximum event listeners for "'.concat(String(e),'" once event!'))):(this.onceEvents[e]=[t],typeof e=="symbol"&&this._symbolKeys.add(e)),this}function removeAllListeners(e){return e===void 0?(this.events=(0,utils_1.nullObj)(),this.onceEvents=(0,utils_1.nullObj)(),this._symbolKeys=new Set):(this.events[e]=void 0,this.onceEvents[e]=void 0,typeof e=="symbol"&&this._symbolKeys.delete(e)),this}function setMaxListeners(e){return this.maxListeners=e,this}function getMaxListeners(){return this.maxListeners}function listeners(e){return this.emit===emit?this.events[e]?this.events[e].tasksAsArray().slice():[]:this.events[e]&&this.onceEvents[e]?__spreadArray(__spreadArray([],this.events[e].tasksAsArray(),!0),typeof this.onceEvents[e]=="function"?[this.onceEvents[e]]:this.onceEvents[e],!0):this.events[e]?this.events[e].tasksAsArray():this.onceEvents[e]?typeof this.onceEvents[e]=="function"?[this.onceEvents[e]]:this.onceEvents[e]:[]}function eventNames(){var e=this;if(this.emit===emit){var t=Object.keys(this.events);return __spreadArray(__spreadArray([],t,!0),Array.from(this._symbolKeys),!0).filter(function(r){return r in e.events&&e.events[r]&&e.events[r].length})}t=Object.keys(this.events).filter(function(r){return e.events[r]&&e.events[r].length});var n=Object.keys(this.onceEvents).filter(function(r){return e.onceEvents[r]&&e.onceEvents[r].length});return __spreadArray(__spreadArray(__spreadArray([],t,!0),n,!0),Array.from(this._symbolKeys).filter(function(r){return r in e.events&&e.events[r]&&e.events[r].length||r in e.onceEvents&&e.onceEvents[r]&&e.onceEvents[r].length}),!0)}function listenerCount(e){return this.emit===emit?this.events[e]&&this.events[e].length||0:(this.events[e]&&this.events[e].length||0)+(this.onceEvents[e]&&this.onceEvents[e].length||0)}function number$3(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function bool$3(e){if(typeof e!="boolean")throw new Error(`Expected boolean, not ${e}`)}function bytes$3(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 hash$3(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number$3(e.outputLen),number$3(e.blockLen)}function exists$3(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 output$3(e,t){bytes$3(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}ee.EventEmitter=EventEmitter,EventEmitter.prototype.emit=emit,EventEmitter.prototype.on=addListener,EventEmitter.prototype.once=once,EventEmitter.prototype.addListener=addListener,EventEmitter.prototype.removeListener=removeListener,EventEmitter.prototype.addListenerBound=addListenerBound,EventEmitter.prototype.removeListenerBound=removeListenerBound,EventEmitter.prototype.hasListeners=hasListeners,EventEmitter.prototype.prependListener=prependListener,EventEmitter.prototype.prependOnceListener=prependOnceListener,EventEmitter.prototype.off=removeListener,EventEmitter.prototype.removeAllListeners=removeAllListeners,EventEmitter.prototype.setMaxListeners=setMaxListeners,EventEmitter.prototype.getMaxListeners=getMaxListeners,EventEmitter.prototype.listeners=listeners,EventEmitter.prototype.eventNames=eventNames,EventEmitter.prototype.listenerCount=listenerCount,function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(r,o,s,i){i===void 0&&(i=s);var a=Object.getOwnPropertyDescriptor(o,s);a&&!("get"in a?!o.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return o[s]}}),Object.defineProperty(r,i,a)}:function(r,o,s,i){i===void 0&&(i=s),r[i]=o[s]}),n=commonjsGlobal&&commonjsGlobal.__exportStar||function(r,o){for(var s in r)s==="default"||Object.prototype.hasOwnProperty.call(o,s)||t(o,r,s)};Object.defineProperty(e,"__esModule",{value:!0}),n(types,e),n(ee,e)}(lib$1);const assert$3={number:number$3,bool:bool$3,bytes:bytes$3,hash:hash$3,exists:exists$3,output:output$3},crypto$3=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,u8a$3=e=>e instanceof Uint8Array,createView$2=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),rotr$2=(e,t)=>e<<32-t|e>>>t,isLE$3=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE$3)throw new Error("Non little-endian hardware is not supported");function utf8ToBytes$4(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function toBytes$3(e){if(typeof e=="string"&&(e=utf8ToBytes$4(e)),!u8a$3(e))throw new Error("expected Uint8Array, got "+typeof e);return e}function concatBytes$3(...e){const t=new Uint8Array(e.reduce((r,o)=>r+o.length,0));let n=0;return e.forEach(r=>{if(!u8a$3(r))throw new Error("Uint8Array expected");t.set(r,n),n+=r.length}),t}Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));let Hash$2=class{clone(){return this._cloneInto()}};function wrapConstructor$2(e){const t=r=>e().update(toBytes$3(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function randomBytes$2(e=32){if(crypto$3&&typeof crypto$3.getRandomValues=="function")return crypto$3.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}function setBigUint64$2(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const o=BigInt(32),s=BigInt(4294967295),i=Number(n>>o&s),a=Number(n&s),l=r?4:0,c=r?0:4;e.setUint32(t+l,i,r),e.setUint32(t+c,a,r)}let SHA2$2=class extends Hash$2{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=createView$2(this.buffer)}update(e){assert$3.exists(this);const{view:t,buffer:n,blockLen:r}=this,o=(e=toBytes$3(e)).length;for(let s=0;s<o;){const i=Math.min(r-this.pos,o-s);if(i!==r)n.set(e.subarray(s,s+i),this.pos),this.pos+=i,s+=i,this.pos===r&&(this.process(t,0),this.pos=0);else{const a=createView$2(e);for(;r<=o-s;s+=r)this.process(a,s)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){assert$3.exists(this),assert$3.output(e,this),this.finished=!0;const{buffer:t,view:n,blockLen:r,isLE:o}=this;let{pos:s}=this;t[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>r-s&&(this.process(n,0),s=0);for(let d=s;d<r;d++)t[d]=0;setBigUint64$2(n,r-8,BigInt(8*this.length),o),this.process(n,0);const i=createView$2(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=a/4,c=this.get();if(l>c.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<l;d++)i.setUint32(4*d,c[d],o)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:n,length:r,finished:o,destroyed:s,pos:i}=this;return e.length=r,e.pos=i,e.finished=o,e.destroyed=s,r%t&&e.buffer.set(n),e}};const Chi$2=(e,t,n)=>e&t^~e&n,Maj$2=(e,t,n)=>e&t^e&n^t&n,SHA256_K$2=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]),IV$2=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_W$2=new Uint32Array(64);let SHA256$2=class extends SHA2$2{constructor(){super(64,32,8,!1),this.A=0|IV$2[0],this.B=0|IV$2[1],this.C=0|IV$2[2],this.D=0|IV$2[3],this.E=0|IV$2[4],this.F=0|IV$2[5],this.G=0|IV$2[6],this.H=0|IV$2[7]}get(){const{A:e,B:t,C:n,D:r,E:o,F:s,G:i,H:a}=this;return[e,t,n,r,o,s,i,a]}set(e,t,n,r,o,s,i,a){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|o,this.F=0|s,this.G=0|i,this.H=0|a}process(e,t){for(let d=0;d<16;d++,t+=4)SHA256_W$2[d]=e.getUint32(t,!1);for(let d=16;d<64;d++){const p=SHA256_W$2[d-15],g=SHA256_W$2[d-2],v=rotr$2(p,7)^rotr$2(p,18)^p>>>3,x=rotr$2(g,17)^rotr$2(g,19)^g>>>10;SHA256_W$2[d]=x+SHA256_W$2[d-7]+v+SHA256_W$2[d-16]|0}let{A:n,B:r,C:o,D:s,E:i,F:a,G:l,H:c}=this;for(let d=0;d<64;d++){const p=c+(rotr$2(i,6)^rotr$2(i,11)^rotr$2(i,25))+Chi$2(i,a,l)+SHA256_K$2[d]+SHA256_W$2[d]|0,g=(rotr$2(n,2)^rotr$2(n,13)^rotr$2(n,22))+Maj$2(n,r,o)|0;c=l,l=a,a=i,i=s+p|0,s=o,o=r,r=n,n=p+g|0}n=n+this.A|0,r=r+this.B|0,o=o+this.C|0,s=s+this.D|0,i=i+this.E|0,a=a+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(n,r,o,s,i,a,l,c)}roundClean(){SHA256_W$2.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},SHA224$1=class extends SHA256$2{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 sha256$2=wrapConstructor$2(()=>new SHA256$2);wrapConstructor$2(()=>new SHA224$1);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$4=BigInt(0),_1n$4=BigInt(1),_2n$2=BigInt(2),u8a$2=e=>e instanceof Uint8Array,hexes$2=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function bytesToHex$2(e){if(!u8a$2(e))throw new Error("Uint8Array expected");let t="";for(let n=0;n<e.length;n++)t+=hexes$2[e[n]];return t}function numberToHexUnpadded(e){const t=e.toString(16);return 1&t.length?`0${t}`:t}function hexToNumber(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return BigInt(e===""?"0":`0x${e}`)}function hexToBytes$2(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 n=new Uint8Array(t/2);for(let r=0;r<n.length;r++){const o=2*r,s=e.slice(o,o+2),i=Number.parseInt(s,16);if(Number.isNaN(i)||i<0)throw new Error("Invalid byte sequence");n[r]=i}return n}function bytesToNumberBE(e){return hexToNumber(bytesToHex$2(e))}function bytesToNumberLE(e){if(!u8a$2(e))throw new Error("Uint8Array expected");return hexToNumber(bytesToHex$2(Uint8Array.from(e).reverse()))}function numberToBytesBE(e,t){return hexToBytes$2(e.toString(16).padStart(2*t,"0"))}function numberToBytesLE(e,t){return numberToBytesBE(e,t).reverse()}function numberToVarBytesBE(e){return hexToBytes$2(numberToHexUnpadded(e))}function ensureBytes$1(e,t,n){let r;if(typeof t=="string")try{r=hexToBytes$2(t)}catch(s){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${s}`)}else{if(!u8a$2(t))throw new Error(`${e} must be hex string or Uint8Array`);r=Uint8Array.from(t)}const o=r.length;if(typeof n=="number"&&o!==n)throw new Error(`${e} expected ${n} bytes, got ${o}`);return r}function concatBytes$2(...e){const t=new Uint8Array(e.reduce((r,o)=>r+o.length,0));let n=0;return e.forEach(r=>{if(!u8a$2(r))throw new Error("Uint8Array expected");t.set(r,n),n+=r.length}),t}function equalBytes$1(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function utf8ToBytes$3(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function bitLen(e){let t;for(t=0;e>_0n$4;e>>=_1n$4,t+=1);return t}function bitGet(e,t){return e>>BigInt(t)&_1n$4}const bitSet=(e,t,n)=>e|(n?_1n$4:_0n$4)<<BigInt(t),bitMask=e=>(_2n$2<<BigInt(e-1))-_1n$4,u8n=e=>new Uint8Array(e),u8fr=e=>Uint8Array.from(e);function createHmacDrbg(e,t,n){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 n!="function")throw new Error("hmacFn must be a function");let r=u8n(e),o=u8n(e),s=0;const i=()=>{r.fill(1),o.fill(0),s=0},a=(...d)=>n(o,r,...d),l=(d=u8n())=>{o=a(u8fr([0]),d),r=a(),d.length!==0&&(o=a(u8fr([1]),d),r=a())},c=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const p=[];for(;d<t;){r=a();const g=r.slice();p.push(g),d+=r.length}return concatBytes$2(...p)};return(d,p)=>{let g;for(i(),l(d);!(g=p(c()));)l();return i(),g}}const validatorFns={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",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 validateObject(e,t,n={}){const r=(o,s,i)=>{const a=validatorFns[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);const l=e[o];if(!(i&&l===void 0||a(l,e)))throw new Error(`Invalid param ${String(o)}=${l} (${typeof l}), expected ${s}`)};for(const[o,s]of Object.entries(t))r(o,s,!1);for(const[o,s]of Object.entries(n))r(o,s,!0);return e}var ut=Object.freeze({__proto__:null,bitGet,bitLen,bitMask,bitSet,bytesToHex:bytesToHex$2,bytesToNumberBE,bytesToNumberLE,concatBytes:concatBytes$2,createHmacDrbg,ensureBytes:ensureBytes$1,equalBytes:equalBytes$1,hexToBytes:hexToBytes$2,hexToNumber,numberToBytesBE,numberToBytesLE,numberToHexUnpadded,numberToVarBytesBE,utf8ToBytes:utf8ToBytes$3,validateObject});/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$3=BigInt(0),_1n$3=BigInt(1),_2n$1=BigInt(2),_3n$1=BigInt(3),_4n=BigInt(4),_5n=BigInt(5),_8n=BigInt(8);function mod(e,t){const n=e%t;return n>=_0n$3?n:t+n}function pow(e,t,n){if(n<=_0n$3||t<_0n$3)throw new Error("Expected power/modulo > 0");if(n===_1n$3)return _0n$3;let r=_1n$3;for(;t>_0n$3;)t&_1n$3&&(r=r*e%n),e=e*e%n,t>>=_1n$3;return r}function pow2(e,t,n){let r=e;for(;t-- >_0n$3;)r*=r,r%=n;return r}function invert(e,t){if(e===_0n$3||t<=_0n$3)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let n=mod(e,t),r=t,o=_0n$3,s=_1n$3;for(;n!==_0n$3;){const i=r%n,a=o-s*(r/n);r=n,n=i,o=s,s=a}if(r!==_1n$3)throw new Error("invert: does not exist");return mod(o,t)}function tonelliShanks(e){const t=(e-_1n$3)/_2n$1;let n,r,o;for(n=e-_1n$3,r=0;n%_2n$1===_0n$3;n/=_2n$1,r++);for(o=_2n$1;o<e&&pow(o,t,e)!==e-_1n$3;o++);if(r===1){const i=(e+_1n$3)/_4n;return function(a,l){const c=a.pow(l,i);if(!a.eql(a.sqr(c),l))throw new Error("Cannot find square root");return c}}const s=(n+_1n$3)/_2n$1;return function(i,a){if(i.pow(a,t)===i.neg(i.ONE))throw new Error("Cannot find square root");let l=r,c=i.pow(i.mul(i.ONE,o),n),d=i.pow(a,s),p=i.pow(a,n);for(;!i.eql(p,i.ONE);){if(i.eql(p,i.ZERO))return i.ZERO;let g=1;for(let x=i.sqr(p);g<l&&!i.eql(x,i.ONE);g++)x=i.sqr(x);const v=i.pow(c,_1n$3<<BigInt(l-g-1));c=i.sqr(v),d=i.mul(d,v),p=i.mul(p,c),l=g}return d}}function FpSqrt(e){if(e%_4n===_3n$1){const t=(e+_1n$3)/_4n;return function(n,r){const o=n.pow(r,t);if(!n.eql(n.sqr(o),r))throw new Error("Cannot find square root");return o}}if(e%_8n===_5n){const t=(e-_5n)/_8n;return function(n,r){const o=n.mul(r,_2n$1),s=n.pow(o,t),i=n.mul(r,s),a=n.mul(n.mul(i,_2n$1),s),l=n.mul(i,n.sub(a,n.ONE));if(!n.eql(n.sqr(l),r))throw new Error("Cannot find square root");return l}}return tonelliShanks(e)}BigInt(9),BigInt(16);const FIELD_FIELDS=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function validateField(e){const t=FIELD_FIELDS.reduce((n,r)=>(n[r]="function",n),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});return validateObject(e,t)}function FpPow(e,t,n){if(n<_0n$3)throw new Error("Expected power > 0");if(n===_0n$3)return e.ONE;if(n===_1n$3)return t;let r=e.ONE,o=t;for(;n>_0n$3;)n&_1n$3&&(r=e.mul(r,o)),o=e.sqr(o),n>>=_1n$3;return r}function FpInvertBatch(e,t){const n=new Array(t.length),r=t.reduce((s,i,a)=>e.is0(i)?s:(n[a]=s,e.mul(s,i)),e.ONE),o=e.inv(r);return t.reduceRight((s,i,a)=>e.is0(i)?s:(n[a]=e.mul(s,n[a]),e.mul(s,i)),o),n}function nLength(e,t){const n=t!==void 0?t:e.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function Field(e,t,n=!1,r={}){if(e<=_0n$3)throw new Error(`Expected Fp ORDER > 0, got ${e}`);const{nBitLength:o,nByteLength:s}=nLength(e,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const i=FpSqrt(e),a=Object.freeze({ORDER:e,BITS:o,BYTES:s,MASK:bitMask(o),ZERO:_0n$3,ONE:_1n$3,create:l=>mod(l,e),isValid:l=>{if(typeof l!="bigint")throw new Error("Invalid field element: expected bigint, got "+typeof l);return _0n$3<=l&&l<e},is0:l=>l===_0n$3,isOdd:l=>(l&_1n$3)===_1n$3,neg:l=>mod(-l,e),eql:(l,c)=>l===c,sqr:l=>mod(l*l,e),add:(l,c)=>mod(l+c,e),sub:(l,c)=>mod(l-c,e),mul:(l,c)=>mod(l*c,e),pow:(l,c)=>FpPow(a,l,c),div:(l,c)=>mod(l*invert(c,e),e),sqrN:l=>l*l,addN:(l,c)=>l+c,subN:(l,c)=>l-c,mulN:(l,c)=>l*c,inv:l=>invert(l,e),sqrt:r.sqrt||(l=>i(a,l)),invertBatch:l=>FpInvertBatch(a,l),cmov:(l,c,d)=>d?c:l,toBytes:l=>n?numberToBytesLE(l,s):numberToBytesBE(l,s),fromBytes:l=>{if(l.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${l.length}`);return n?bytesToNumberLE(l):bytesToNumberBE(l)}});return Object.freeze(a)}function hashToPrivateScalar(e,t,n=!1){const r=(e=ensureBytes$1("privateHash",e)).length,o=nLength(t).nByteLength+8;if(o<24||r<o||r>1024)throw new Error(`hashToPrivateScalar: expected ${o}-1024 bytes of input, got ${r}`);return mod(n?bytesToNumberLE(e):bytesToNumberBE(e),t-_1n$3)+_1n$3}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$2=BigInt(0),_1n$2=BigInt(1);function wNAF(e,t){const n=(o,s)=>{const i=s.negate();return o?i:s},r=o=>({windows:Math.ceil(t/o)+1,windowSize:2**(o-1)});return{constTimeNegate:n,unsafeLadder(o,s){let i=e.ZERO,a=o;for(;s>_0n$2;)s&_1n$2&&(i=i.add(a)),a=a.double(),s>>=_1n$2;return i},precomputeWindow(o,s){const{windows:i,windowSize:a}=r(s),l=[];let c=o,d=c;for(let p=0;p<i;p++){d=c,l.push(d);for(let g=1;g<a;g++)d=d.add(c),l.push(d);c=d.double()}return l},wNAF(o,s,i){const{windows:a,windowSize:l}=r(o);let c=e.ZERO,d=e.BASE;const p=BigInt(2**o-1),g=2**o,v=BigInt(o);for(let x=0;x<a;x++){const b=x*l;let C=Number(i&p);i>>=v,C>l&&(C-=g,i+=_1n$2);const _=b,k=b+Math.abs(C)-1,$=x%2!=0,N=C<0;C===0?d=d.add(n($,s[_])):c=c.add(n(N,s[k]))}return{p:c,f:d}},wNAFCached(o,s,i,a){const l=o._WINDOW_SIZE||1;let c=s.get(o);return c||(c=this.precomputeWindow(o,l),l!==1&&s.set(o,a(c))),this.wNAF(l,c,i)}}}function validateBasic(e){return validateField(e.Fp),validateObject(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...nLength(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function validatePointOpts(e){const t=validateBasic(e);validateObject(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:o}=t;if(n){if(!r.eql(o,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}const{bytesToNumberBE:b2n,hexToBytes:h2b}=ut,DER={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(e){const{Err:t}=DER;if(e.length<2||e[0]!==2)throw new t("Invalid signature integer tag");const n=e[1],r=e.subarray(2,n+2);if(!n||r.length!==n)throw new t("Invalid signature integer: wrong length");if(128&r[0])throw new t("Invalid signature integer: negative");if(r[0]===0&&!(128&r[1]))throw new t("Invalid signature integer: unnecessary leading zero");return{d:b2n(r),l:e.subarray(n+2)}},toSig(e){const{Err:t}=DER,n=typeof e=="string"?h2b(e):e;if(!(n instanceof Uint8Array))throw new Error("ui8a expected");let r=n.length;if(r<2||n[0]!=48)throw new t("Invalid signature tag");if(n[1]!==r-2)throw new t("Invalid signature: incorrect length");const{d:o,l:s}=DER._parseInt(n.subarray(2)),{d:i,l:a}=DER._parseInt(s);if(a.length)throw new t("Invalid signature: left bytes after parsing");return{r:o,s:i}},hexFromSig(e){const t=c=>8&Number.parseInt(c[0],16)?"00"+c:c,n=c=>{const d=c.toString(16);return 1&d.length?`0${d}`:d},r=t(n(e.s)),o=t(n(e.r)),s=r.length/2,i=o.length/2,a=n(s),l=n(i);return`30${n(i+s+4)}02${l}${o}02${a}${r}`}},_0n$1=BigInt(0),_1n$1=BigInt(1);BigInt(2);const _3n=BigInt(3);function weierstrassPoints(e){const t=validatePointOpts(e),{Fp:n}=t,r=t.toBytes||((x,b,C)=>{const _=b.toAffine();return concatBytes$2(Uint8Array.from([4]),n.toBytes(_.x),n.toBytes(_.y))}),o=t.fromBytes||(x=>{const b=x.subarray(1);return{x:n.fromBytes(b.subarray(0,n.BYTES)),y:n.fromBytes(b.subarray(n.BYTES,2*n.BYTES))}});function s(x){const{a:b,b:C}=t,_=n.sqr(x),k=n.mul(_,x);return n.add(n.add(k,n.mul(x,b)),C)}if(!n.eql(n.sqr(t.Gy),s(t.Gx)))throw new Error("bad generator point: equation left != right");function i(x){return typeof x=="bigint"&&_0n$1<x&&x<t.n}function a(x){if(!i(x))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function l(x){const{allowedPrivateKeyLengths:b,nByteLength:C,wrapPrivateKey:_,n:k}=t;if(b&&typeof x!="bigint"){if(x instanceof Uint8Array&&(x=bytesToHex$2(x)),typeof x!="string"||!b.includes(x.length))throw new Error("Invalid key");x=x.padStart(2*C,"0")}let $;try{$=typeof x=="bigint"?x:bytesToNumberBE(ensureBytes$1("private key",x,C))}catch{throw new Error(`private key must be ${C} bytes, hex or bigint, not ${typeof x}`)}return _&&($=mod($,k)),a($),$}const c=new Map;function d(x){if(!(x instanceof p))throw new Error("ProjectivePoint expected")}class p{constructor(b,C,_){if(this.px=b,this.py=C,this.pz=_,b==null||!n.isValid(b))throw new Error("x required");if(C==null||!n.isValid(C))throw new Error("y required");if(_==null||!n.isValid(_))throw new Error("z required")}static fromAffine(b){const{x:C,y:_}=b||{};if(!b||!n.isValid(C)||!n.isValid(_))throw new Error("invalid affine point");if(b instanceof p)throw new Error("projective point not allowed");const k=$=>n.eql($,n.ZERO);return k(C)&&k(_)?p.ZERO:new p(C,_,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(b){const C=n.invertBatch(b.map(_=>_.pz));return b.map((_,k)=>_.toAffine(C[k])).map(p.fromAffine)}static fromHex(b){const C=p.fromAffine(o(ensureBytes$1("pointHex",b)));return C.assertValidity(),C}static fromPrivateKey(b){return p.BASE.multiply(l(b))}_setWindowSize(b){this._WINDOW_SIZE=b,c.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint)return;throw new Error("bad point: ZERO")}const{x:b,y:C}=this.toAffine();if(!n.isValid(b)||!n.isValid(C))throw new Error("bad point: x or y not FE");const _=n.sqr(C),k=s(b);if(!n.eql(_,k))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:b}=this.toAffine();if(n.isOdd)return!n.isOdd(b);throw new Error("Field doesn't support isOdd")}equals(b){d(b);const{px:C,py:_,pz:k}=this,{px:$,py:N,pz:T}=b,L=n.eql(n.mul(C,T),n.mul($,k)),B=n.eql(n.mul(_,T),n.mul(N,k));return L&&B}negate(){return new p(this.px,n.neg(this.py),this.pz)}double(){const{a:b,b:C}=t,_=n.mul(C,_3n),{px:k,py:$,pz:N}=this;let T=n.ZERO,L=n.ZERO,B=n.ZERO,E=n.mul(k,k),m=n.mul($,$),y=n.mul(N,N),S=n.mul(k,$);return S=n.add(S,S),B=n.mul(k,N),B=n.add(B,B),T=n.mul(b,B),L=n.mul(_,y),L=n.add(T,L),T=n.sub(m,L),L=n.add(m,L),L=n.mul(T,L),T=n.mul(S,T),B=n.mul(_,B),y=n.mul(b,y),S=n.sub(E,y),S=n.mul(b,S),S=n.add(S,B),B=n.add(E,E),E=n.add(B,E),E=n.add(E,y),E=n.mul(E,S),L=n.add(L,E),y=n.mul($,N),y=n.add(y,y),E=n.mul(y,S),T=n.sub(T,E),B=n.mul(y,m),B=n.add(B,B),B=n.add(B,B),new p(T,L,B)}add(b){d(b);const{px:C,py:_,pz:k}=this,{px:$,py:N,pz:T}=b;let L=n.ZERO,B=n.ZERO,E=n.ZERO;const m=t.a,y=n.mul(t.b,_3n);let S=n.mul(C,$),R=n.mul(_,N),A=n.mul(k,T),U=n.add(C,_),I=n.add($,N);U=n.mul(U,I),I=n.add(S,R),U=n.sub(U,I),I=n.add(C,k);let M=n.add($,T);return I=n.mul(I,M),M=n.add(S,A),I=n.sub(I,M),M=n.add(_,k),L=n.add(N,T),M=n.mul(M,L),L=n.add(R,A),M=n.sub(M,L),E=n.mul(m,I),L=n.mul(y,A),E=n.add(L,E),L=n.sub(R,E),E=n.add(R,E),B=n.mul(L,E),R=n.add(S,S),R=n.add(R,S),A=n.mul(m,A),I=n.mul(y,I),R=n.add(R,A),A=n.sub(S,A),A=n.mul(m,A),I=n.add(I,A),S=n.mul(R,I),B=n.add(B,S),S=n.mul(M,I),L=n.mul(U,L),L=n.sub(L,S),S=n.mul(U,R),E=n.mul(M,E),E=n.add(E,S),new p(L,B,E)}subtract(b){return this.add(b.negate())}is0(){return this.equals(p.ZERO)}wNAF(b){return v.wNAFCached(this,c,b,C=>{const _=n.invertBatch(C.map(k=>k.pz));return C.map((k,$)=>k.toAffine(_[$])).map(p.fromAffine)})}multiplyUnsafe(b){const C=p.ZERO;if(b===_0n$1)return C;if(a(b),b===_1n$1)return this;const{endo:_}=t;if(!_)return v.unsafeLadder(this,b);let{k1neg:k,k1:$,k2neg:N,k2:T}=_.splitScalar(b),L=C,B=C,E=this;for(;$>_0n$1||T>_0n$1;)$&_1n$1&&(L=L.add(E)),T&_1n$1&&(B=B.add(E)),E=E.double(),$>>=_1n$1,T>>=_1n$1;return k&&(L=L.negate()),N&&(B=B.negate()),B=new p(n.mul(B.px,_.beta),B.py,B.pz),L.add(B)}multiply(b){a(b);let C,_,k=b;const{endo:$}=t;if($){const{k1neg:N,k1:T,k2neg:L,k2:B}=$.splitScalar(k);let{p:E,f:m}=this.wNAF(T),{p:y,f:S}=this.wNAF(B);E=v.constTimeNegate(N,E),y=v.constTimeNegate(L,y),y=new p(n.mul(y.px,$.beta),y.py,y.pz),C=E.add(y),_=m.add(S)}else{const{p:N,f:T}=this.wNAF(k);C=N,_=T}return p.normalizeZ([C,_])[0]}multiplyAndAddUnsafe(b,C,_){const k=p.BASE,$=(T,L)=>L!==_0n$1&&L!==_1n$1&&T.equals(k)?T.multiply(L):T.multiplyUnsafe(L),N=$(this,C).add($(b,_));return N.is0()?void 0:N}toAffine(b){const{px:C,py:_,pz:k}=this,$=this.is0();b==null&&(b=$?n.ONE:n.inv(k));const N=n.mul(C,b),T=n.mul(_,b),L=n.mul(k,b);if($)return{x:n.ZERO,y:n.ZERO};if(!n.eql(L,n.ONE))throw new Error("invZ was invalid");return{x:N,y:T}}isTorsionFree(){const{h:b,isTorsionFree:C}=t;if(b===_1n$1)return!0;if(C)return C(p,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:b,clearCofactor:C}=t;return b===_1n$1?this:C?C(p,this):this.multiplyUnsafe(t.h)}toRawBytes(b=!0){return this.assertValidity(),r(p,this,b)}toHex(b=!0){return bytesToHex$2(this.toRawBytes(b))}}p.BASE=new p(t.Gx,t.Gy,n.ONE),p.ZERO=new p(n.ZERO,n.ONE,n.ZERO);const g=t.nBitLength,v=wNAF(p,t.endo?Math.ceil(g/2):g);return{CURVE:t,ProjectivePoint:p,normPrivateKeyToScalar:l,weierstrassEquation:s,isWithinCurveOrder:i}}function validateOpts(e){const t=validateBasic(e);return validateObject(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function weierstrass(e){const t=validateOpts(e),{Fp:n,n:r}=t,o=n.BYTES+1,s=2*n.BYTES+1;function i(m){return mod(m,r)}function a(m){return invert(m,r)}const{ProjectivePoint:l,normPrivateKeyToScalar:c,weierstrassEquation:d,isWithinCurveOrder:p}=weierstrassPoints({...t,toBytes(m,y,S){const R=y.toAffine(),A=n.toBytes(R.x),U=concatBytes$2;return S?U(Uint8Array.from([y.hasEvenY()?2:3]),A):U(Uint8Array.from([4]),A,n.toBytes(R.y))},fromBytes(m){const y=m.length,S=m[0],R=m.subarray(1);if(y!==o||S!==2&&S!==3){if(y===s&&S===4)return{x:n.fromBytes(R.subarray(0,n.BYTES)),y:n.fromBytes(R.subarray(n.BYTES,2*n.BYTES))};throw new Error(`Point of length ${y} was invalid. Expected ${o} compressed bytes or ${s} uncompressed bytes`)}{const U=bytesToNumberBE(R);if(!(_0n$1<(A=U)&&A<n.ORDER))throw new Error("Point is not on curve");const I=d(U);let M=n.sqrt(I);return!(1&~S)!=((M&_1n$1)===_1n$1)&&(M=n.neg(M)),{x:U,y:M}}var A}}),g=m=>bytesToHex$2(numberToBytesBE(m,t.nByteLength));function v(m){return m>r>>_1n$1}const x=(m,y,S)=>bytesToNumberBE(m.slice(y,S));class b{constructor(y,S,R){this.r=y,this.s=S,this.recovery=R,this.assertValidity()}static fromCompact(y){const S=t.nByteLength;return y=ensureBytes$1("compactSignature",y,2*S),new b(x(y,0,S),x(y,S,2*S))}static fromDER(y){const{r:S,s:R}=DER.toSig(ensureBytes$1("DER",y));return new b(S,R)}assertValidity(){if(!p(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!p(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(y){return new b(this.r,this.s,y)}recoverPublicKey(y){const{r:S,s:R,recovery:A}=this,U=$(ensureBytes$1("msgHash",y));if(A==null||![0,1,2,3].includes(A))throw new Error("recovery id invalid");const I=A===2||A===3?S+t.n:S;if(I>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const M=1&A?"03":"02",P=l.fromHex(M+g(I)),D=a(I),O=i(-U*D),j=i(R*D),K=l.BASE.multiplyAndAddUnsafe(P,O,j);if(!K)throw new Error("point at infinify");return K.assertValidity(),K}hasHighS(){return v(this.s)}normalizeS(){return this.hasHighS()?new b(this.r,i(-this.s),this.recovery):this}toDERRawBytes(){return hexToBytes$2(this.toDERHex())}toDERHex(){return DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return hexToBytes$2(this.toCompactHex())}toCompactHex(){return g(this.r)+g(this.s)}}const C={isValidPrivateKey(m){try{return c(m),!0}catch{return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>numberToBytesBE(hashToPrivateScalar(t.randomBytes(n.BYTES+8),r),t.nByteLength),precompute:(m=8,y=l.BASE)=>(y._setWindowSize(m),y.multiply(BigInt(3)),y)};function _(m){const y=m instanceof Uint8Array,S=typeof m=="string",R=(y||S)&&m.length;return y?R===o||R===s:S?R===2*o||R===2*s:m instanceof l}const k=t.bits2int||function(m){const y=bytesToNumberBE(m),S=8*m.length-t.nBitLength;return S>0?y>>BigInt(S):y},$=t.bits2int_modN||function(m){return i(k(m))},N=bitMask(t.nBitLength);function T(m){if(typeof m!="bigint")throw new Error("bigint expected");if(!(_0n$1<=m&&m<N))throw new Error(`bigint expected < 2^${t.nBitLength}`);return numberToBytesBE(m,t.nByteLength)}function L(m,y,S=B){if(["recovered","canonical"].some(F=>F in S))throw new Error("sign() legacy options not supported");const{hash:R,randomBytes:A}=t;let{lowS:U,prehash:I,extraEntropy:M}=S;U==null&&(U=!0),m=ensureBytes$1("msgHash",m),I&&(m=ensureBytes$1("prehashed msgHash",R(m)));const P=$(m),D=c(y),O=[T(D),T(P)];if(M!=null){const F=M===!0?A(n.BYTES):M;O.push(ensureBytes$1("extraEntropy",F,n.BYTES))}const j=concatBytes$2(...O),K=P;return{seed:j,k2sig:function(F){const G=k(F);if(!p(G))return;const Y=a(G),q=l.BASE.multiply(G).toAffine(),V=i(q.x);if(V===_0n$1)return;const Z=i(Y*i(K+V*D));if(Z===_0n$1)return;let J=(q.x===V?0:2)|Number(q.y&_1n$1),X=Z;return U&&v(Z)&&(X=function(te){return v(te)?i(-te):te}(Z),J^=1),new b(V,X,J)}}}const B={lowS:t.lowS,prehash:!1},E={lowS:t.lowS,prehash:!1};return l.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(m,y=!0){return l.fromPrivateKey(m).toRawBytes(y)},getSharedSecret:function(m,y,S=!0){if(_(m))throw new Error("first arg must be private key");if(!_(y))throw new Error("second arg must be public key");return l.fromHex(y).multiply(c(m)).toRawBytes(S)},sign:function(m,y,S=B){const{seed:R,k2sig:A}=L(m,y,S),U=t;return createHmacDrbg(U.hash.outputLen,U.nByteLength,U.hmac)(R,A)},verify:function(m,y,S,R=E){var q;const A=m;if(y=ensureBytes$1("msgHash",y),S=ensureBytes$1("publicKey",S),"strict"in R)throw new Error("options.strict was renamed to lowS");const{lowS:U,prehash:I}=R;let M,P;try{if(typeof A=="string"||A instanceof Uint8Array)try{M=b.fromDER(A)}catch(V){if(!(V instanceof DER.Err))throw V;M=b.fromCompact(A)}else{if(typeof A!="object"||typeof A.r!="bigint"||typeof A.s!="bigint")throw new Error("PARSE");{const{r:V,s:Z}=A;M=new b(V,Z)}}P=l.fromHex(S)}catch(V){if(V.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(U&&M.hasHighS())return!1;I&&(y=t.hash(y));const{r:D,s:O}=M,j=$(y),K=a(O),F=i(j*K),G=i(D*K),Y=(q=l.BASE.multiplyAndAddUnsafe(P,F,G))==null?void 0:q.toAffine();return!!Y&&i(Y.x)===D},ProjectivePoint:l,Signature:b,utils:C}}BigInt(4);let HMAC$2=class extends Hash$2{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,assert$3.hash(e);const n=toBytes$3(t);if(this.iHash=e.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 r=this.blockLen,o=new Uint8Array(r);o.set(n.length>r?e.create().update(n).digest():n);for(let s=0;s<o.length;s++)o[s]^=54;this.iHash.update(o),this.oHash=e.create();for(let s=0;s<o.length;s++)o[s]^=106;this.oHash.update(o),o.fill(0)}update(e){return assert$3.exists(this),this.iHash.update(e),this}digestInto(e){assert$3.exists(this),assert$3.bytes(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:n,finished:r,destroyed:o,blockLen:s,outputLen:i}=this;return e.finished=r,e.destroyed=o,e.blockLen=s,e.outputLen=i,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const hmac$2=(e,t,n)=>new HMAC$2(e,t).update(n).digest();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function getHash(e){return{hash:e,hmac:(t,...n)=>hmac$2(e,t,concatBytes$3(...n)),randomBytes:randomBytes$2}}function createCurve(e,t){const n=r=>weierstrass({...e,...getHash(r)});return Object.freeze({...n(t),create:n})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */hmac$2.create=(e,t)=>new HMAC$2(e,t);const secp256k1P=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),secp256k1N=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),_1n=BigInt(1),_2n=BigInt(2),divNearest=(e,t)=>(e+t/_2n)/t;function sqrtMod(e){const t=secp256k1P,n=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),a=BigInt(44),l=BigInt(88),c=e*e*e%t,d=c*c*e%t,p=pow2(d,n,t)*d%t,g=pow2(p,n,t)*d%t,v=pow2(g,_2n,t)*c%t,x=pow2(v,o,t)*v%t,b=pow2(x,s,t)*x%t,C=pow2(b,a,t)*b%t,_=pow2(C,l,t)*C%t,k=pow2(_,a,t)*b%t,$=pow2(k,n,t)*d%t,N=pow2($,i,t)*x%t,T=pow2(N,r,t)*c%t,L=pow2(T,_2n,t);if(!Fp.eql(Fp.sqr(L),e))throw new Error("Cannot find square root");return L}const Fp=Field(secp256k1P,void 0,void 0,{sqrt:sqrtMod}),secp256k1=createCurve({a:BigInt(0),b:BigInt(7),Fp,n:secp256k1N,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=secp256k1N,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-_1n*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,i=BigInt("0x100000000000000000000000000000000"),a=divNearest(s*e,t),l=divNearest(-r*e,t);let c=mod(e-a*n-l*o,t),d=mod(-a*r-l*s,t);const p=c>i,g=d>i;if(p&&(c=t-c),g&&(d=t-d),c>i||d>i)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:p,k1:c,k2neg:g,k2:d}}}},sha256$2),_0n=BigInt(0),fe=e=>typeof e=="bigint"&&_0n<e&&e<secp256k1P,ge=e=>typeof e=="bigint"&&_0n<e&&e<secp256k1N,TAGGED_HASH_PREFIXES={};function taggedHash(e,...t){let n=TAGGED_HASH_PREFIXES[e];if(n===void 0){const r=sha256$2(Uint8Array.from(e,o=>o.charCodeAt(0)));n=concatBytes$2(r,r),TAGGED_HASH_PREFIXES[e]=n}return sha256$2(concatBytes$2(n,...t))}const pointToBytes=e=>e.toRawBytes(!0).slice(1),numTo32b=e=>numberToBytesBE(e,32),modP=e=>mod(e,secp256k1P),modN=e=>mod(e,secp256k1N),Point$1=secp256k1.ProjectivePoint,GmulAdd=(e,t,n)=>Point$1.BASE.multiplyAndAddUnsafe(e,t,n);function schnorrGetExtPubKey(e){let t=secp256k1.utils.normPrivateKeyToScalar(e),n=Point$1.fromPrivateKey(t);return{scalar:n.hasEvenY()?t:modN(-t),bytes:pointToBytes(n)}}function lift_x(e){if(!fe(e))throw new Error("bad x: need 0 < x < p");const t=modP(e*e);let n=sqrtMod(modP(t*e+BigInt(7)));n%_2n!==_0n&&(n=modP(-n));const r=new Point$1(e,n,_1n);return r.assertValidity(),r}function challenge(...e){return modN(bytesToNumberBE(taggedHash("BIP0340/challenge",...e)))}function schnorrGetPublicKey(e){return schnorrGetExtPubKey(e).bytes}function schnorrSign(e,t,n=randomBytes$2(32)){const r=ensureBytes$1("message",e),{bytes:o,scalar:s}=schnorrGetExtPubKey(t),i=ensureBytes$1("auxRand",n,32),a=numTo32b(s^bytesToNumberBE(taggedHash("BIP0340/aux",i))),l=taggedHash("BIP0340/nonce",a,o,r),c=modN(bytesToNumberBE(l));if(c===_0n)throw new Error("sign failed: k is zero");const{bytes:d,scalar:p}=schnorrGetExtPubKey(c),g=challenge(d,o,r),v=new Uint8Array(64);if(v.set(d,0),v.set(numTo32b(modN(p+g*s)),32),!schnorrVerify(v,r,o))throw new Error("sign: Invalid signature produced");return v}function schnorrVerify(e,t,n){const r=ensureBytes$1("signature",e,64),o=ensureBytes$1("message",t),s=ensureBytes$1("publicKey",n,32);try{const i=lift_x(bytesToNumberBE(s)),a=bytesToNumberBE(r.subarray(0,32));if(!fe(a))return!1;const l=bytesToNumberBE(r.subarray(32,64));if(!ge(l))return!1;const c=challenge(numTo32b(a),pointToBytes(i),o),d=GmulAdd(i,l,modN(-c));return!(!d||!d.hasEvenY()||d.toAffine().x!==a)}catch{return!1}}const schnorr={getPublicKey:schnorrGetPublicKey,sign:schnorrSign,verify:schnorrVerify,utils:{randomPrivateKey:secp256k1.utils.randomPrivateKey,lift_x,pointToBytes,numberToBytesBE,bytesToNumberBE,taggedHash,mod}},crypto$2=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,u8a$1=e=>e instanceof Uint8Array,createView$1=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),rotr$1=(e,t)=>e<<32-t|e>>>t,isLE$2=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE$2)throw new Error("Non little-endian hardware is not supported");const hexes$1=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function bytesToHex$1(e){if(!u8a$1(e))throw new Error("Uint8Array expected");let t="";for(let n=0;n<e.length;n++)t+=hexes$1[e[n]];return t}function hexToBytes$1(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 n=new Uint8Array(t/2);for(let r=0;r<n.length;r++){const o=2*r,s=e.slice(o,o+2),i=Number.parseInt(s,16);if(Number.isNaN(i)||i<0)throw new Error("Invalid byte sequence");n[r]=i}return n}function utf8ToBytes$2(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function toBytes$2(e){if(typeof e=="string"&&(e=utf8ToBytes$2(e)),!u8a$1(e))throw new Error("expected Uint8Array, got "+typeof e);return e}function concatBytes$1(...e){const t=new Uint8Array(e.reduce((r,o)=>r+o.length,0));let n=0;return e.forEach(r=>{if(!u8a$1(r))throw new Error("Uint8Array expected");t.set(r,n),n+=r.length}),t}let Hash$1=class{clone(){return this._cloneInto()}};function wrapConstructor$1(e){const t=r=>e().update(toBytes$2(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function randomBytes$1(e=32){if(crypto$2&&typeof crypto$2.getRandomValues=="function")return crypto$2.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}function number$2(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function bool$2(e){if(typeof e!="boolean")throw new Error(`Expected boolean, not ${e}`)}function bytes$2(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 hash$2(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number$2(e.outputLen),number$2(e.blockLen)}function exists$2(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 output$2(e,t){bytes$2(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const assert$2={number:number$2,bool:bool$2,bytes:bytes$2,hash:hash$2,exists:exists$2,output:output$2};function setBigUint64$1(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const o=BigInt(32),s=BigInt(4294967295),i=Number(n>>o&s),a=Number(n&s),l=r?4:0,c=r?0:4;e.setUint32(t+l,i,r),e.setUint32(t+c,a,r)}let SHA2$1=class extends Hash$1{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=createView$1(this.buffer)}update(e){assert$2.exists(this);const{view:t,buffer:n,blockLen:r}=this,o=(e=toBytes$2(e)).length;for(let s=0;s<o;){const i=Math.min(r-this.pos,o-s);if(i!==r)n.set(e.subarray(s,s+i),this.pos),this.pos+=i,s+=i,this.pos===r&&(this.process(t,0),this.pos=0);else{const a=createView$1(e);for(;r<=o-s;s+=r)this.process(a,s)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){assert$2.exists(this),assert$2.output(e,this),this.finished=!0;const{buffer:t,view:n,blockLen:r,isLE:o}=this;let{pos:s}=this;t[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>r-s&&(this.process(n,0),s=0);for(let d=s;d<r;d++)t[d]=0;setBigUint64$1(n,r-8,BigInt(8*this.length),o),this.process(n,0);const i=createView$1(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=a/4,c=this.get();if(l>c.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<l;d++)i.setUint32(4*d,c[d],o)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:n,length:r,finished:o,destroyed:s,pos:i}=this;return e.length=r,e.pos=i,e.finished=o,e.destroyed=s,r%t&&e.buffer.set(n),e}};const Chi$1=(e,t,n)=>e&t^~e&n,Maj$1=(e,t,n)=>e&t^e&n^t&n,SHA256_K$1=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]),IV$1=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_W$1=new Uint32Array(64);let SHA256$1=class extends SHA2$1{constructor(){super(64,32,8,!1),this.A=0|IV$1[0],this.B=0|IV$1[1],this.C=0|IV$1[2],this.D=0|IV$1[3],this.E=0|IV$1[4],this.F=0|IV$1[5],this.G=0|IV$1[6],this.H=0|IV$1[7]}get(){const{A:e,B:t,C:n,D:r,E:o,F:s,G:i,H:a}=this;return[e,t,n,r,o,s,i,a]}set(e,t,n,r,o,s,i,a){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|o,this.F=0|s,this.G=0|i,this.H=0|a}process(e,t){for(let d=0;d<16;d++,t+=4)SHA256_W$1[d]=e.getUint32(t,!1);for(let d=16;d<64;d++){const p=SHA256_W$1[d-15],g=SHA256_W$1[d-2],v=rotr$1(p,7)^rotr$1(p,18)^p>>>3,x=rotr$1(g,17)^rotr$1(g,19)^g>>>10;SHA256_W$1[d]=x+SHA256_W$1[d-7]+v+SHA256_W$1[d-16]|0}let{A:n,B:r,C:o,D:s,E:i,F:a,G:l,H:c}=this;for(let d=0;d<64;d++){const p=c+(rotr$1(i,6)^rotr$1(i,11)^rotr$1(i,25))+Chi$1(i,a,l)+SHA256_K$1[d]+SHA256_W$1[d]|0,g=(rotr$1(n,2)^rotr$1(n,13)^rotr$1(n,22))+Maj$1(n,r,o)|0;c=l,l=a,a=i,i=s+p|0,s=o,o=r,r=n,n=p+g|0}n=n+this.A|0,r=r+this.B|0,o=o+this.C|0,s=s+this.D|0,i=i+this.E|0,a=a+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(n,r,o,s,i,a,l,c)}roundClean(){SHA256_W$1.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};class SHA224 extends SHA256$1{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 sha256$1=wrapConstructor$1(()=>new SHA256$1);/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function assertNumber(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function chain$1(...e){const t=(n,r)=>o=>n(r(o));return{encode:Array.from(e).reverse().reduce((n,r)=>n?t(n,r.encode):r.encode,void 0),decode:e.reduce((n,r)=>n?t(n,r.decode):r.decode,void 0)}}function alphabet$1(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(n=>{if(assertNumber(n),n<0||n>=e.length)throw new Error(`Digit index outside alphabet: ${n} (alphabet: ${e.length})`);return e[n]})},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(n=>{if(typeof n!="string")throw new Error(`alphabet.decode: not string element=${n}`);const r=e.indexOf(n);if(r===-1)throw new Error(`Unknown letter: "${n}". Allowed: ${e}`);return r})}}}function join$1(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 n of t)if(typeof n!="string")throw new Error(`join.encode: non-string input=${n}`);return t.join(e)},decode:t=>{if(typeof t!="string")throw new Error("join.decode input should be string");return t.split(e)}}}function padding$1(e,t="="){if(assertNumber(e),typeof t!="string")throw new Error("padding chr should be string");return{encode(n){if(!Array.isArray(n)||n.length&&typeof n[0]!="string")throw new Error("padding.encode input should be array of strings");for(let r of n)if(typeof r!="string")throw new Error(`padding.encode: non-string input=${r}`);for(;n.length*e%8;)n.push(t);return n},decode(n){if(!Array.isArray(n)||n.length&&typeof n[0]!="string")throw new Error("padding.encode input should be array of strings");for(let o of n)if(typeof o!="string")throw new Error(`padding.decode: non-string input=${o}`);let r=n.length;if(r*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;r>0&&n[r-1]===t;r--)if(!((r-1)*e%8))throw new Error("Invalid padding: string has too much padding");return n.slice(0,r)}}}function normalize$1(e){if(typeof e!="function")throw new Error("normalize fn should be function");return{encode:t=>t,decode:t=>e(t)}}function convertRadix$1(e,t,n){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: wrong to=${n}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let r=0;const o=[],s=Array.from(e);for(s.forEach(i=>{if(assertNumber(i),i<0||i>=t)throw new Error(`Wrong integer: ${i}`)});;){let i=0,a=!0;for(let l=r;l<s.length;l++){const c=s[l],d=t*i+c;if(!Number.isSafeInteger(d)||t*i/t!==i||d-c!=t*i)throw new Error("convertRadix: carry overflow");if(i=d%n,s[l]=Math.floor(d/n),!Number.isSafeInteger(s[l])||s[l]*n+i!==d)throw new Error("convertRadix: carry overflow");a&&(s[l]?a=!1:r=l)}if(o.push(i),a)break}for(let i=0;i<e.length-1&&e[i]===0;i++)o.push(0);return o.reverse()}wrapConstructor$1(()=>new SHA224);const gcd$1=(e,t)=>t?gcd$1(t,e%t):e,radix2carry$1=(e,t)=>e+(t-gcd$1(e,t));function convertRadix2$1(e,t,n,r){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(radix2carry$1(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${radix2carry$1(t,n)}`);let o=0,s=0;const i=2**n-1,a=[];for(const l of e){if(assertNumber(l),l>=2**t)throw new Error(`convertRadix2: invalid data word=${l} from=${t}`);if(o=o<<t|l,s+t>32)throw new Error(`convertRadix2: carry overflow pos=${s} from=${t}`);for(s+=t;s>=n;s-=n)a.push((o>>s-n&i)>>>0);o&=2**s-1}if(o=o<<n-s&i,!r&&s>=t)throw new Error("Excess padding");if(!r&&o)throw new Error(`Non-zero padding: ${o}`);return r&&s>0&&a.push(o>>>0),a}function radix$1(e){return assertNumber(e),{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return convertRadix$1(Array.from(t),256,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(convertRadix$1(t,e,256))}}}function radix2$1(e,t=!1){if(assertNumber(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(radix2carry$1(8,e)>32||radix2carry$1(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!(n instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return convertRadix2$1(Array.from(n),8,e,!t)},decode:n=>{if(!Array.isArray(n)||n.length&&typeof n[0]!="number")throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(convertRadix2$1(n,e,8,t))}}}function unsafeWrapper$1(e){if(typeof e!="function")throw new Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch{}}}const base16=chain$1(radix2$1(4),alphabet$1("0123456789ABCDEF"),join$1("")),base32=chain$1(radix2$1(5),alphabet$1("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),padding$1(5),join$1(""));chain$1(radix2$1(5),alphabet$1("0123456789ABCDEFGHIJKLMNOPQRSTUV"),padding$1(5),join$1("")),chain$1(radix2$1(5),alphabet$1("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),join$1(""),normalize$1(e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")));const base64$1=chain$1(radix2$1(6),alphabet$1("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),padding$1(6),join$1("")),base64url=chain$1(radix2$1(6),alphabet$1("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),padding$1(6),join$1("")),genBase58$1=e=>chain$1(radix$1(58),alphabet$1(e),join$1("")),base58$1=genBase58$1("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");genBase58$1("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),genBase58$1("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const XMR_BLOCK_LEN=[0,2,3,5,6,7,9,10,11],base58xmr={encode(e){let t="";for(let n=0;n<e.length;n+=8){const r=e.subarray(n,n+8);t+=base58$1.encode(r).padStart(XMR_BLOCK_LEN[r.length],"1")}return t},decode(e){let t=[];for(let n=0;n<e.length;n+=11){const r=e.slice(n,n+11),o=XMR_BLOCK_LEN.indexOf(r.length),s=base58$1.decode(r);for(let i=0;i<s.length-o;i++)if(s[i]!==0)throw new Error("base58xmr: wrong padding");t=t.concat(Array.from(s.slice(s.length-o)))}return Uint8Array.from(t)}},BECH_ALPHABET$1=chain$1(alphabet$1("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),join$1("")),POLYMOD_GENERATORS$1=[996825010,642813549,513874426,1027748829,705979059];function bech32Polymod$1(e){const t=e>>25;let n=(33554431&e)<<5;for(let r=0;r<POLYMOD_GENERATORS$1.length;r++)(t>>r&1)==1&&(n^=POLYMOD_GENERATORS$1[r]);return n}function bechChecksum$1(e,t,n=1){const r=e.length;let o=1;for(let s=0;s<r;s++){const i=e.charCodeAt(s);if(i<33||i>126)throw new Error(`Invalid prefix (${e})`);o=bech32Polymod$1(o)^i>>5}o=bech32Polymod$1(o);for(let s=0;s<r;s++)o=bech32Polymod$1(o)^31&e.charCodeAt(s);for(let s of t)o=bech32Polymod$1(o)^s;for(let s=0;s<6;s++)o=bech32Polymod$1(o);return o^=n,BECH_ALPHABET$1.encode(convertRadix2$1([o%2**30],30,5,!1))}function genBech32$1(e){const t=e==="bech32"?1:734539939,n=radix2$1(5),r=n.decode,o=n.encode,s=unsafeWrapper$1(r);function i(a,l=90){if(typeof a!="string")throw new Error("bech32.decode input should be string, not "+typeof a);if(a.length<8||l!==!1&&a.length>l)throw new TypeError(`Wrong string length: ${a.length} (${a}). Expected (8..${l})`);const c=a.toLowerCase();if(a!==c&&a!==a.toUpperCase())throw new Error("String must be lowercase or uppercase");const d=(a=c).lastIndexOf("1");if(d===0||d===-1)throw new Error('Letter "1" must be present between prefix and data only');const p=a.slice(0,d),g=a.slice(d+1);if(g.length<6)throw new Error("Data must be at least 6 characters long");const v=BECH_ALPHABET$1.decode(g).slice(0,-6),x=bechChecksum$1(p,v,t);if(!g.endsWith(x))throw new Error(`Invalid checksum in ${a}: expected "${x}"`);return{prefix:p,words:v}}return{encode:function(a,l,c=90){if(typeof a!="string")throw new Error("bech32.encode prefix should be string, not "+typeof a);if(!Array.isArray(l)||l.length&&typeof l[0]!="number")throw new Error("bech32.encode words should be array of numbers, not "+typeof l);const d=a.length+7+l.length;if(c!==!1&&d>c)throw new TypeError(`Length ${d} exceeds limit ${c}`);return`${a=a.toLowerCase()}1${BECH_ALPHABET$1.encode(l)}${bechChecksum$1(a,l,t)}`},decode:i,decodeToBytes:function(a){const{prefix:l,words:c}=i(a,!1);return{prefix:l,words:c,bytes:r(c)}},decodeUnsafe:unsafeWrapper$1(i),fromWords:r,fromWordsUnsafe:s,toWords:o}}const bech32$1=genBech32$1("bech32");genBech32$1("bech32m");const utf8={encode:e=>new TextDecoder().decode(e),decode:e=>new TextEncoder().encode(e)},hex=chain$1(radix2$1(4),alphabet$1("0123456789abcdef"),join$1(""),normalize$1(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()})),CODERS={utf8,hex,base16,base32,base64:base64$1,base64url,base58:base58$1,base58xmr};Object.keys(CODERS).join(", ");const wordlist=`abandon
|
|
83
|
+
ability
|
|
84
|
+
able
|
|
85
|
+
about
|
|
86
|
+
above
|
|
87
|
+
absent
|
|
88
|
+
absorb
|
|
89
|
+
abstract
|
|
90
|
+
absurd
|
|
91
|
+
abuse
|
|
92
|
+
access
|
|
93
|
+
accident
|
|
94
|
+
account
|
|
95
|
+
accuse
|
|
96
|
+
achieve
|
|
97
|
+
acid
|
|
98
|
+
acoustic
|
|
99
|
+
acquire
|
|
100
|
+
across
|
|
101
|
+
act
|
|
102
|
+
action
|
|
103
|
+
actor
|
|
104
|
+
actress
|
|
105
|
+
actual
|
|
106
|
+
adapt
|
|
107
|
+
add
|
|
108
|
+
addict
|
|
109
|
+
address
|
|
110
|
+
adjust
|
|
111
|
+
admit
|
|
112
|
+
adult
|
|
113
|
+
advance
|
|
114
|
+
advice
|
|
115
|
+
aerobic
|
|
116
|
+
affair
|
|
117
|
+
afford
|
|
118
|
+
afraid
|
|
119
|
+
again
|
|
120
|
+
age
|
|
121
|
+
agent
|
|
122
|
+
agree
|
|
123
|
+
ahead
|
|
124
|
+
aim
|
|
125
|
+
air
|
|
126
|
+
airport
|
|
127
|
+
aisle
|
|
128
|
+
alarm
|
|
129
|
+
album
|
|
130
|
+
alcohol
|
|
131
|
+
alert
|
|
132
|
+
alien
|
|
133
|
+
all
|
|
134
|
+
alley
|
|
135
|
+
allow
|
|
136
|
+
almost
|
|
137
|
+
alone
|
|
138
|
+
alpha
|
|
139
|
+
already
|
|
140
|
+
also
|
|
141
|
+
alter
|
|
142
|
+
always
|
|
143
|
+
amateur
|
|
144
|
+
amazing
|
|
145
|
+
among
|
|
146
|
+
amount
|
|
147
|
+
amused
|
|
148
|
+
analyst
|
|
149
|
+
anchor
|
|
150
|
+
ancient
|
|
151
|
+
anger
|
|
152
|
+
angle
|
|
153
|
+
angry
|
|
154
|
+
animal
|
|
155
|
+
ankle
|
|
156
|
+
announce
|
|
157
|
+
annual
|
|
158
|
+
another
|
|
159
|
+
answer
|
|
160
|
+
antenna
|
|
161
|
+
antique
|
|
162
|
+
anxiety
|
|
163
|
+
any
|
|
164
|
+
apart
|
|
165
|
+
apology
|
|
166
|
+
appear
|
|
167
|
+
apple
|
|
168
|
+
approve
|
|
169
|
+
april
|
|
170
|
+
arch
|
|
171
|
+
arctic
|
|
172
|
+
area
|
|
173
|
+
arena
|
|
174
|
+
argue
|
|
175
|
+
arm
|
|
176
|
+
armed
|
|
177
|
+
armor
|
|
178
|
+
army
|
|
179
|
+
around
|
|
180
|
+
arrange
|
|
181
|
+
arrest
|
|
182
|
+
arrive
|
|
183
|
+
arrow
|
|
184
|
+
art
|
|
185
|
+
artefact
|
|
186
|
+
artist
|
|
187
|
+
artwork
|
|
188
|
+
ask
|
|
189
|
+
aspect
|
|
190
|
+
assault
|
|
191
|
+
asset
|
|
192
|
+
assist
|
|
193
|
+
assume
|
|
194
|
+
asthma
|
|
195
|
+
athlete
|
|
196
|
+
atom
|
|
197
|
+
attack
|
|
198
|
+
attend
|
|
199
|
+
attitude
|
|
200
|
+
attract
|
|
201
|
+
auction
|
|
202
|
+
audit
|
|
203
|
+
august
|
|
204
|
+
aunt
|
|
205
|
+
author
|
|
206
|
+
auto
|
|
207
|
+
autumn
|
|
208
|
+
average
|
|
209
|
+
avocado
|
|
210
|
+
avoid
|
|
211
|
+
awake
|
|
212
|
+
aware
|
|
213
|
+
away
|
|
214
|
+
awesome
|
|
215
|
+
awful
|
|
216
|
+
awkward
|
|
217
|
+
axis
|
|
218
|
+
baby
|
|
219
|
+
bachelor
|
|
220
|
+
bacon
|
|
221
|
+
badge
|
|
222
|
+
bag
|
|
223
|
+
balance
|
|
224
|
+
balcony
|
|
225
|
+
ball
|
|
226
|
+
bamboo
|
|
227
|
+
banana
|
|
228
|
+
banner
|
|
229
|
+
bar
|
|
230
|
+
barely
|
|
231
|
+
bargain
|
|
232
|
+
barrel
|
|
233
|
+
base
|
|
234
|
+
basic
|
|
235
|
+
basket
|
|
236
|
+
battle
|
|
237
|
+
beach
|
|
238
|
+
bean
|
|
239
|
+
beauty
|
|
240
|
+
because
|
|
241
|
+
become
|
|
242
|
+
beef
|
|
243
|
+
before
|
|
244
|
+
begin
|
|
245
|
+
behave
|
|
246
|
+
behind
|
|
247
|
+
believe
|
|
248
|
+
below
|
|
249
|
+
belt
|
|
250
|
+
bench
|
|
251
|
+
benefit
|
|
252
|
+
best
|
|
253
|
+
betray
|
|
254
|
+
better
|
|
255
|
+
between
|
|
256
|
+
beyond
|
|
257
|
+
bicycle
|
|
258
|
+
bid
|
|
259
|
+
bike
|
|
260
|
+
bind
|
|
261
|
+
biology
|
|
262
|
+
bird
|
|
263
|
+
birth
|
|
264
|
+
bitter
|
|
265
|
+
black
|
|
266
|
+
blade
|
|
267
|
+
blame
|
|
268
|
+
blanket
|
|
269
|
+
blast
|
|
270
|
+
bleak
|
|
271
|
+
bless
|
|
272
|
+
blind
|
|
273
|
+
blood
|
|
274
|
+
blossom
|
|
275
|
+
blouse
|
|
276
|
+
blue
|
|
277
|
+
blur
|
|
278
|
+
blush
|
|
279
|
+
board
|
|
280
|
+
boat
|
|
281
|
+
body
|
|
282
|
+
boil
|
|
283
|
+
bomb
|
|
284
|
+
bone
|
|
285
|
+
bonus
|
|
286
|
+
book
|
|
287
|
+
boost
|
|
288
|
+
border
|
|
289
|
+
boring
|
|
290
|
+
borrow
|
|
291
|
+
boss
|
|
292
|
+
bottom
|
|
293
|
+
bounce
|
|
294
|
+
box
|
|
295
|
+
boy
|
|
296
|
+
bracket
|
|
297
|
+
brain
|
|
298
|
+
brand
|
|
299
|
+
brass
|
|
300
|
+
brave
|
|
301
|
+
bread
|
|
302
|
+
breeze
|
|
303
|
+
brick
|
|
304
|
+
bridge
|
|
305
|
+
brief
|
|
306
|
+
bright
|
|
307
|
+
bring
|
|
308
|
+
brisk
|
|
309
|
+
broccoli
|
|
310
|
+
broken
|
|
311
|
+
bronze
|
|
312
|
+
broom
|
|
313
|
+
brother
|
|
314
|
+
brown
|
|
315
|
+
brush
|
|
316
|
+
bubble
|
|
317
|
+
buddy
|
|
318
|
+
budget
|
|
319
|
+
buffalo
|
|
320
|
+
build
|
|
321
|
+
bulb
|
|
322
|
+
bulk
|
|
323
|
+
bullet
|
|
324
|
+
bundle
|
|
325
|
+
bunker
|
|
326
|
+
burden
|
|
327
|
+
burger
|
|
328
|
+
burst
|
|
329
|
+
bus
|
|
330
|
+
business
|
|
331
|
+
busy
|
|
332
|
+
butter
|
|
333
|
+
buyer
|
|
334
|
+
buzz
|
|
335
|
+
cabbage
|
|
336
|
+
cabin
|
|
337
|
+
cable
|
|
338
|
+
cactus
|
|
339
|
+
cage
|
|
340
|
+
cake
|
|
341
|
+
call
|
|
342
|
+
calm
|
|
343
|
+
camera
|
|
344
|
+
camp
|
|
345
|
+
can
|
|
346
|
+
canal
|
|
347
|
+
cancel
|
|
348
|
+
candy
|
|
349
|
+
cannon
|
|
350
|
+
canoe
|
|
351
|
+
canvas
|
|
352
|
+
canyon
|
|
353
|
+
capable
|
|
354
|
+
capital
|
|
355
|
+
captain
|
|
356
|
+
car
|
|
357
|
+
carbon
|
|
358
|
+
card
|
|
359
|
+
cargo
|
|
360
|
+
carpet
|
|
361
|
+
carry
|
|
362
|
+
cart
|
|
363
|
+
case
|
|
364
|
+
cash
|
|
365
|
+
casino
|
|
366
|
+
castle
|
|
367
|
+
casual
|
|
368
|
+
cat
|
|
369
|
+
catalog
|
|
370
|
+
catch
|
|
371
|
+
category
|
|
372
|
+
cattle
|
|
373
|
+
caught
|
|
374
|
+
cause
|
|
375
|
+
caution
|
|
376
|
+
cave
|
|
377
|
+
ceiling
|
|
378
|
+
celery
|
|
379
|
+
cement
|
|
380
|
+
census
|
|
381
|
+
century
|
|
382
|
+
cereal
|
|
383
|
+
certain
|
|
384
|
+
chair
|
|
385
|
+
chalk
|
|
386
|
+
champion
|
|
387
|
+
change
|
|
388
|
+
chaos
|
|
389
|
+
chapter
|
|
390
|
+
charge
|
|
391
|
+
chase
|
|
392
|
+
chat
|
|
393
|
+
cheap
|
|
394
|
+
check
|
|
395
|
+
cheese
|
|
396
|
+
chef
|
|
397
|
+
cherry
|
|
398
|
+
chest
|
|
399
|
+
chicken
|
|
400
|
+
chief
|
|
401
|
+
child
|
|
402
|
+
chimney
|
|
403
|
+
choice
|
|
404
|
+
choose
|
|
405
|
+
chronic
|
|
406
|
+
chuckle
|
|
407
|
+
chunk
|
|
408
|
+
churn
|
|
409
|
+
cigar
|
|
410
|
+
cinnamon
|
|
411
|
+
circle
|
|
412
|
+
citizen
|
|
413
|
+
city
|
|
414
|
+
civil
|
|
415
|
+
claim
|
|
416
|
+
clap
|
|
417
|
+
clarify
|
|
418
|
+
claw
|
|
419
|
+
clay
|
|
420
|
+
clean
|
|
421
|
+
clerk
|
|
422
|
+
clever
|
|
423
|
+
click
|
|
424
|
+
client
|
|
425
|
+
cliff
|
|
426
|
+
climb
|
|
427
|
+
clinic
|
|
428
|
+
clip
|
|
429
|
+
clock
|
|
430
|
+
clog
|
|
431
|
+
close
|
|
432
|
+
cloth
|
|
433
|
+
cloud
|
|
434
|
+
clown
|
|
435
|
+
club
|
|
436
|
+
clump
|
|
437
|
+
cluster
|
|
438
|
+
clutch
|
|
439
|
+
coach
|
|
440
|
+
coast
|
|
441
|
+
coconut
|
|
442
|
+
code
|
|
443
|
+
coffee
|
|
444
|
+
coil
|
|
445
|
+
coin
|
|
446
|
+
collect
|
|
447
|
+
color
|
|
448
|
+
column
|
|
449
|
+
combine
|
|
450
|
+
come
|
|
451
|
+
comfort
|
|
452
|
+
comic
|
|
453
|
+
common
|
|
454
|
+
company
|
|
455
|
+
concert
|
|
456
|
+
conduct
|
|
457
|
+
confirm
|
|
458
|
+
congress
|
|
459
|
+
connect
|
|
460
|
+
consider
|
|
461
|
+
control
|
|
462
|
+
convince
|
|
463
|
+
cook
|
|
464
|
+
cool
|
|
465
|
+
copper
|
|
466
|
+
copy
|
|
467
|
+
coral
|
|
468
|
+
core
|
|
469
|
+
corn
|
|
470
|
+
correct
|
|
471
|
+
cost
|
|
472
|
+
cotton
|
|
473
|
+
couch
|
|
474
|
+
country
|
|
475
|
+
couple
|
|
476
|
+
course
|
|
477
|
+
cousin
|
|
478
|
+
cover
|
|
479
|
+
coyote
|
|
480
|
+
crack
|
|
481
|
+
cradle
|
|
482
|
+
craft
|
|
483
|
+
cram
|
|
484
|
+
crane
|
|
485
|
+
crash
|
|
486
|
+
crater
|
|
487
|
+
crawl
|
|
488
|
+
crazy
|
|
489
|
+
cream
|
|
490
|
+
credit
|
|
491
|
+
creek
|
|
492
|
+
crew
|
|
493
|
+
cricket
|
|
494
|
+
crime
|
|
495
|
+
crisp
|
|
496
|
+
critic
|
|
497
|
+
crop
|
|
498
|
+
cross
|
|
499
|
+
crouch
|
|
500
|
+
crowd
|
|
501
|
+
crucial
|
|
502
|
+
cruel
|
|
503
|
+
cruise
|
|
504
|
+
crumble
|
|
505
|
+
crunch
|
|
506
|
+
crush
|
|
507
|
+
cry
|
|
508
|
+
crystal
|
|
509
|
+
cube
|
|
510
|
+
culture
|
|
511
|
+
cup
|
|
512
|
+
cupboard
|
|
513
|
+
curious
|
|
514
|
+
current
|
|
515
|
+
curtain
|
|
516
|
+
curve
|
|
517
|
+
cushion
|
|
518
|
+
custom
|
|
519
|
+
cute
|
|
520
|
+
cycle
|
|
521
|
+
dad
|
|
522
|
+
damage
|
|
523
|
+
damp
|
|
524
|
+
dance
|
|
525
|
+
danger
|
|
526
|
+
daring
|
|
527
|
+
dash
|
|
528
|
+
daughter
|
|
529
|
+
dawn
|
|
530
|
+
day
|
|
531
|
+
deal
|
|
532
|
+
debate
|
|
533
|
+
debris
|
|
534
|
+
decade
|
|
535
|
+
december
|
|
536
|
+
decide
|
|
537
|
+
decline
|
|
538
|
+
decorate
|
|
539
|
+
decrease
|
|
540
|
+
deer
|
|
541
|
+
defense
|
|
542
|
+
define
|
|
543
|
+
defy
|
|
544
|
+
degree
|
|
545
|
+
delay
|
|
546
|
+
deliver
|
|
547
|
+
demand
|
|
548
|
+
demise
|
|
549
|
+
denial
|
|
550
|
+
dentist
|
|
551
|
+
deny
|
|
552
|
+
depart
|
|
553
|
+
depend
|
|
554
|
+
deposit
|
|
555
|
+
depth
|
|
556
|
+
deputy
|
|
557
|
+
derive
|
|
558
|
+
describe
|
|
559
|
+
desert
|
|
560
|
+
design
|
|
561
|
+
desk
|
|
562
|
+
despair
|
|
563
|
+
destroy
|
|
564
|
+
detail
|
|
565
|
+
detect
|
|
566
|
+
develop
|
|
567
|
+
device
|
|
568
|
+
devote
|
|
569
|
+
diagram
|
|
570
|
+
dial
|
|
571
|
+
diamond
|
|
572
|
+
diary
|
|
573
|
+
dice
|
|
574
|
+
diesel
|
|
575
|
+
diet
|
|
576
|
+
differ
|
|
577
|
+
digital
|
|
578
|
+
dignity
|
|
579
|
+
dilemma
|
|
580
|
+
dinner
|
|
581
|
+
dinosaur
|
|
582
|
+
direct
|
|
583
|
+
dirt
|
|
584
|
+
disagree
|
|
585
|
+
discover
|
|
586
|
+
disease
|
|
587
|
+
dish
|
|
588
|
+
dismiss
|
|
589
|
+
disorder
|
|
590
|
+
display
|
|
591
|
+
distance
|
|
592
|
+
divert
|
|
593
|
+
divide
|
|
594
|
+
divorce
|
|
595
|
+
dizzy
|
|
596
|
+
doctor
|
|
597
|
+
document
|
|
598
|
+
dog
|
|
599
|
+
doll
|
|
600
|
+
dolphin
|
|
601
|
+
domain
|
|
602
|
+
donate
|
|
603
|
+
donkey
|
|
604
|
+
donor
|
|
605
|
+
door
|
|
606
|
+
dose
|
|
607
|
+
double
|
|
608
|
+
dove
|
|
609
|
+
draft
|
|
610
|
+
dragon
|
|
611
|
+
drama
|
|
612
|
+
drastic
|
|
613
|
+
draw
|
|
614
|
+
dream
|
|
615
|
+
dress
|
|
616
|
+
drift
|
|
617
|
+
drill
|
|
618
|
+
drink
|
|
619
|
+
drip
|
|
620
|
+
drive
|
|
621
|
+
drop
|
|
622
|
+
drum
|
|
623
|
+
dry
|
|
624
|
+
duck
|
|
625
|
+
dumb
|
|
626
|
+
dune
|
|
627
|
+
during
|
|
628
|
+
dust
|
|
629
|
+
dutch
|
|
630
|
+
duty
|
|
631
|
+
dwarf
|
|
632
|
+
dynamic
|
|
633
|
+
eager
|
|
634
|
+
eagle
|
|
635
|
+
early
|
|
636
|
+
earn
|
|
637
|
+
earth
|
|
638
|
+
easily
|
|
639
|
+
east
|
|
640
|
+
easy
|
|
641
|
+
echo
|
|
642
|
+
ecology
|
|
643
|
+
economy
|
|
644
|
+
edge
|
|
645
|
+
edit
|
|
646
|
+
educate
|
|
647
|
+
effort
|
|
648
|
+
egg
|
|
649
|
+
eight
|
|
650
|
+
either
|
|
651
|
+
elbow
|
|
652
|
+
elder
|
|
653
|
+
electric
|
|
654
|
+
elegant
|
|
655
|
+
element
|
|
656
|
+
elephant
|
|
657
|
+
elevator
|
|
658
|
+
elite
|
|
659
|
+
else
|
|
660
|
+
embark
|
|
661
|
+
embody
|
|
662
|
+
embrace
|
|
663
|
+
emerge
|
|
664
|
+
emotion
|
|
665
|
+
employ
|
|
666
|
+
empower
|
|
667
|
+
empty
|
|
668
|
+
enable
|
|
669
|
+
enact
|
|
670
|
+
end
|
|
671
|
+
endless
|
|
672
|
+
endorse
|
|
673
|
+
enemy
|
|
674
|
+
energy
|
|
675
|
+
enforce
|
|
676
|
+
engage
|
|
677
|
+
engine
|
|
678
|
+
enhance
|
|
679
|
+
enjoy
|
|
680
|
+
enlist
|
|
681
|
+
enough
|
|
682
|
+
enrich
|
|
683
|
+
enroll
|
|
684
|
+
ensure
|
|
685
|
+
enter
|
|
686
|
+
entire
|
|
687
|
+
entry
|
|
688
|
+
envelope
|
|
689
|
+
episode
|
|
690
|
+
equal
|
|
691
|
+
equip
|
|
692
|
+
era
|
|
693
|
+
erase
|
|
694
|
+
erode
|
|
695
|
+
erosion
|
|
696
|
+
error
|
|
697
|
+
erupt
|
|
698
|
+
escape
|
|
699
|
+
essay
|
|
700
|
+
essence
|
|
701
|
+
estate
|
|
702
|
+
eternal
|
|
703
|
+
ethics
|
|
704
|
+
evidence
|
|
705
|
+
evil
|
|
706
|
+
evoke
|
|
707
|
+
evolve
|
|
708
|
+
exact
|
|
709
|
+
example
|
|
710
|
+
excess
|
|
711
|
+
exchange
|
|
712
|
+
excite
|
|
713
|
+
exclude
|
|
714
|
+
excuse
|
|
715
|
+
execute
|
|
716
|
+
exercise
|
|
717
|
+
exhaust
|
|
718
|
+
exhibit
|
|
719
|
+
exile
|
|
720
|
+
exist
|
|
721
|
+
exit
|
|
722
|
+
exotic
|
|
723
|
+
expand
|
|
724
|
+
expect
|
|
725
|
+
expire
|
|
726
|
+
explain
|
|
727
|
+
expose
|
|
728
|
+
express
|
|
729
|
+
extend
|
|
730
|
+
extra
|
|
731
|
+
eye
|
|
732
|
+
eyebrow
|
|
733
|
+
fabric
|
|
734
|
+
face
|
|
735
|
+
faculty
|
|
736
|
+
fade
|
|
737
|
+
faint
|
|
738
|
+
faith
|
|
739
|
+
fall
|
|
740
|
+
false
|
|
741
|
+
fame
|
|
742
|
+
family
|
|
743
|
+
famous
|
|
744
|
+
fan
|
|
745
|
+
fancy
|
|
746
|
+
fantasy
|
|
747
|
+
farm
|
|
748
|
+
fashion
|
|
749
|
+
fat
|
|
750
|
+
fatal
|
|
751
|
+
father
|
|
752
|
+
fatigue
|
|
753
|
+
fault
|
|
754
|
+
favorite
|
|
755
|
+
feature
|
|
756
|
+
february
|
|
757
|
+
federal
|
|
758
|
+
fee
|
|
759
|
+
feed
|
|
760
|
+
feel
|
|
761
|
+
female
|
|
762
|
+
fence
|
|
763
|
+
festival
|
|
764
|
+
fetch
|
|
765
|
+
fever
|
|
766
|
+
few
|
|
767
|
+
fiber
|
|
768
|
+
fiction
|
|
769
|
+
field
|
|
770
|
+
figure
|
|
771
|
+
file
|
|
772
|
+
film
|
|
773
|
+
filter
|
|
774
|
+
final
|
|
775
|
+
find
|
|
776
|
+
fine
|
|
777
|
+
finger
|
|
778
|
+
finish
|
|
779
|
+
fire
|
|
780
|
+
firm
|
|
781
|
+
first
|
|
782
|
+
fiscal
|
|
783
|
+
fish
|
|
784
|
+
fit
|
|
785
|
+
fitness
|
|
786
|
+
fix
|
|
787
|
+
flag
|
|
788
|
+
flame
|
|
789
|
+
flash
|
|
790
|
+
flat
|
|
791
|
+
flavor
|
|
792
|
+
flee
|
|
793
|
+
flight
|
|
794
|
+
flip
|
|
795
|
+
float
|
|
796
|
+
flock
|
|
797
|
+
floor
|
|
798
|
+
flower
|
|
799
|
+
fluid
|
|
800
|
+
flush
|
|
801
|
+
fly
|
|
802
|
+
foam
|
|
803
|
+
focus
|
|
804
|
+
fog
|
|
805
|
+
foil
|
|
806
|
+
fold
|
|
807
|
+
follow
|
|
808
|
+
food
|
|
809
|
+
foot
|
|
810
|
+
force
|
|
811
|
+
forest
|
|
812
|
+
forget
|
|
813
|
+
fork
|
|
814
|
+
fortune
|
|
815
|
+
forum
|
|
816
|
+
forward
|
|
817
|
+
fossil
|
|
818
|
+
foster
|
|
819
|
+
found
|
|
820
|
+
fox
|
|
821
|
+
fragile
|
|
822
|
+
frame
|
|
823
|
+
frequent
|
|
824
|
+
fresh
|
|
825
|
+
friend
|
|
826
|
+
fringe
|
|
827
|
+
frog
|
|
828
|
+
front
|
|
829
|
+
frost
|
|
830
|
+
frown
|
|
831
|
+
frozen
|
|
832
|
+
fruit
|
|
833
|
+
fuel
|
|
834
|
+
fun
|
|
835
|
+
funny
|
|
836
|
+
furnace
|
|
837
|
+
fury
|
|
838
|
+
future
|
|
839
|
+
gadget
|
|
840
|
+
gain
|
|
841
|
+
galaxy
|
|
842
|
+
gallery
|
|
843
|
+
game
|
|
844
|
+
gap
|
|
845
|
+
garage
|
|
846
|
+
garbage
|
|
847
|
+
garden
|
|
848
|
+
garlic
|
|
849
|
+
garment
|
|
850
|
+
gas
|
|
851
|
+
gasp
|
|
852
|
+
gate
|
|
853
|
+
gather
|
|
854
|
+
gauge
|
|
855
|
+
gaze
|
|
856
|
+
general
|
|
857
|
+
genius
|
|
858
|
+
genre
|
|
859
|
+
gentle
|
|
860
|
+
genuine
|
|
861
|
+
gesture
|
|
862
|
+
ghost
|
|
863
|
+
giant
|
|
864
|
+
gift
|
|
865
|
+
giggle
|
|
866
|
+
ginger
|
|
867
|
+
giraffe
|
|
868
|
+
girl
|
|
869
|
+
give
|
|
870
|
+
glad
|
|
871
|
+
glance
|
|
872
|
+
glare
|
|
873
|
+
glass
|
|
874
|
+
glide
|
|
875
|
+
glimpse
|
|
876
|
+
globe
|
|
877
|
+
gloom
|
|
878
|
+
glory
|
|
879
|
+
glove
|
|
880
|
+
glow
|
|
881
|
+
glue
|
|
882
|
+
goat
|
|
883
|
+
goddess
|
|
884
|
+
gold
|
|
885
|
+
good
|
|
886
|
+
goose
|
|
887
|
+
gorilla
|
|
888
|
+
gospel
|
|
889
|
+
gossip
|
|
890
|
+
govern
|
|
891
|
+
gown
|
|
892
|
+
grab
|
|
893
|
+
grace
|
|
894
|
+
grain
|
|
895
|
+
grant
|
|
896
|
+
grape
|
|
897
|
+
grass
|
|
898
|
+
gravity
|
|
899
|
+
great
|
|
900
|
+
green
|
|
901
|
+
grid
|
|
902
|
+
grief
|
|
903
|
+
grit
|
|
904
|
+
grocery
|
|
905
|
+
group
|
|
906
|
+
grow
|
|
907
|
+
grunt
|
|
908
|
+
guard
|
|
909
|
+
guess
|
|
910
|
+
guide
|
|
911
|
+
guilt
|
|
912
|
+
guitar
|
|
913
|
+
gun
|
|
914
|
+
gym
|
|
915
|
+
habit
|
|
916
|
+
hair
|
|
917
|
+
half
|
|
918
|
+
hammer
|
|
919
|
+
hamster
|
|
920
|
+
hand
|
|
921
|
+
happy
|
|
922
|
+
harbor
|
|
923
|
+
hard
|
|
924
|
+
harsh
|
|
925
|
+
harvest
|
|
926
|
+
hat
|
|
927
|
+
have
|
|
928
|
+
hawk
|
|
929
|
+
hazard
|
|
930
|
+
head
|
|
931
|
+
health
|
|
932
|
+
heart
|
|
933
|
+
heavy
|
|
934
|
+
hedgehog
|
|
935
|
+
height
|
|
936
|
+
hello
|
|
937
|
+
helmet
|
|
938
|
+
help
|
|
939
|
+
hen
|
|
940
|
+
hero
|
|
941
|
+
hidden
|
|
942
|
+
high
|
|
943
|
+
hill
|
|
944
|
+
hint
|
|
945
|
+
hip
|
|
946
|
+
hire
|
|
947
|
+
history
|
|
948
|
+
hobby
|
|
949
|
+
hockey
|
|
950
|
+
hold
|
|
951
|
+
hole
|
|
952
|
+
holiday
|
|
953
|
+
hollow
|
|
954
|
+
home
|
|
955
|
+
honey
|
|
956
|
+
hood
|
|
957
|
+
hope
|
|
958
|
+
horn
|
|
959
|
+
horror
|
|
960
|
+
horse
|
|
961
|
+
hospital
|
|
962
|
+
host
|
|
963
|
+
hotel
|
|
964
|
+
hour
|
|
965
|
+
hover
|
|
966
|
+
hub
|
|
967
|
+
huge
|
|
968
|
+
human
|
|
969
|
+
humble
|
|
970
|
+
humor
|
|
971
|
+
hundred
|
|
972
|
+
hungry
|
|
973
|
+
hunt
|
|
974
|
+
hurdle
|
|
975
|
+
hurry
|
|
976
|
+
hurt
|
|
977
|
+
husband
|
|
978
|
+
hybrid
|
|
979
|
+
ice
|
|
980
|
+
icon
|
|
981
|
+
idea
|
|
982
|
+
identify
|
|
983
|
+
idle
|
|
984
|
+
ignore
|
|
985
|
+
ill
|
|
986
|
+
illegal
|
|
987
|
+
illness
|
|
988
|
+
image
|
|
989
|
+
imitate
|
|
990
|
+
immense
|
|
991
|
+
immune
|
|
992
|
+
impact
|
|
993
|
+
impose
|
|
994
|
+
improve
|
|
995
|
+
impulse
|
|
996
|
+
inch
|
|
997
|
+
include
|
|
998
|
+
income
|
|
999
|
+
increase
|
|
1000
|
+
index
|
|
1001
|
+
indicate
|
|
1002
|
+
indoor
|
|
1003
|
+
industry
|
|
1004
|
+
infant
|
|
1005
|
+
inflict
|
|
1006
|
+
inform
|
|
1007
|
+
inhale
|
|
1008
|
+
inherit
|
|
1009
|
+
initial
|
|
1010
|
+
inject
|
|
1011
|
+
injury
|
|
1012
|
+
inmate
|
|
1013
|
+
inner
|
|
1014
|
+
innocent
|
|
1015
|
+
input
|
|
1016
|
+
inquiry
|
|
1017
|
+
insane
|
|
1018
|
+
insect
|
|
1019
|
+
inside
|
|
1020
|
+
inspire
|
|
1021
|
+
install
|
|
1022
|
+
intact
|
|
1023
|
+
interest
|
|
1024
|
+
into
|
|
1025
|
+
invest
|
|
1026
|
+
invite
|
|
1027
|
+
involve
|
|
1028
|
+
iron
|
|
1029
|
+
island
|
|
1030
|
+
isolate
|
|
1031
|
+
issue
|
|
1032
|
+
item
|
|
1033
|
+
ivory
|
|
1034
|
+
jacket
|
|
1035
|
+
jaguar
|
|
1036
|
+
jar
|
|
1037
|
+
jazz
|
|
1038
|
+
jealous
|
|
1039
|
+
jeans
|
|
1040
|
+
jelly
|
|
1041
|
+
jewel
|
|
1042
|
+
job
|
|
1043
|
+
join
|
|
1044
|
+
joke
|
|
1045
|
+
journey
|
|
1046
|
+
joy
|
|
1047
|
+
judge
|
|
1048
|
+
juice
|
|
1049
|
+
jump
|
|
1050
|
+
jungle
|
|
1051
|
+
junior
|
|
1052
|
+
junk
|
|
1053
|
+
just
|
|
1054
|
+
kangaroo
|
|
1055
|
+
keen
|
|
1056
|
+
keep
|
|
1057
|
+
ketchup
|
|
1058
|
+
key
|
|
1059
|
+
kick
|
|
1060
|
+
kid
|
|
1061
|
+
kidney
|
|
1062
|
+
kind
|
|
1063
|
+
kingdom
|
|
1064
|
+
kiss
|
|
1065
|
+
kit
|
|
1066
|
+
kitchen
|
|
1067
|
+
kite
|
|
1068
|
+
kitten
|
|
1069
|
+
kiwi
|
|
1070
|
+
knee
|
|
1071
|
+
knife
|
|
1072
|
+
knock
|
|
1073
|
+
know
|
|
1074
|
+
lab
|
|
1075
|
+
label
|
|
1076
|
+
labor
|
|
1077
|
+
ladder
|
|
1078
|
+
lady
|
|
1079
|
+
lake
|
|
1080
|
+
lamp
|
|
1081
|
+
language
|
|
1082
|
+
laptop
|
|
1083
|
+
large
|
|
1084
|
+
later
|
|
1085
|
+
latin
|
|
1086
|
+
laugh
|
|
1087
|
+
laundry
|
|
1088
|
+
lava
|
|
1089
|
+
law
|
|
1090
|
+
lawn
|
|
1091
|
+
lawsuit
|
|
1092
|
+
layer
|
|
1093
|
+
lazy
|
|
1094
|
+
leader
|
|
1095
|
+
leaf
|
|
1096
|
+
learn
|
|
1097
|
+
leave
|
|
1098
|
+
lecture
|
|
1099
|
+
left
|
|
1100
|
+
leg
|
|
1101
|
+
legal
|
|
1102
|
+
legend
|
|
1103
|
+
leisure
|
|
1104
|
+
lemon
|
|
1105
|
+
lend
|
|
1106
|
+
length
|
|
1107
|
+
lens
|
|
1108
|
+
leopard
|
|
1109
|
+
lesson
|
|
1110
|
+
letter
|
|
1111
|
+
level
|
|
1112
|
+
liar
|
|
1113
|
+
liberty
|
|
1114
|
+
library
|
|
1115
|
+
license
|
|
1116
|
+
life
|
|
1117
|
+
lift
|
|
1118
|
+
light
|
|
1119
|
+
like
|
|
1120
|
+
limb
|
|
1121
|
+
limit
|
|
1122
|
+
link
|
|
1123
|
+
lion
|
|
1124
|
+
liquid
|
|
1125
|
+
list
|
|
1126
|
+
little
|
|
1127
|
+
live
|
|
1128
|
+
lizard
|
|
1129
|
+
load
|
|
1130
|
+
loan
|
|
1131
|
+
lobster
|
|
1132
|
+
local
|
|
1133
|
+
lock
|
|
1134
|
+
logic
|
|
1135
|
+
lonely
|
|
1136
|
+
long
|
|
1137
|
+
loop
|
|
1138
|
+
lottery
|
|
1139
|
+
loud
|
|
1140
|
+
lounge
|
|
1141
|
+
love
|
|
1142
|
+
loyal
|
|
1143
|
+
lucky
|
|
1144
|
+
luggage
|
|
1145
|
+
lumber
|
|
1146
|
+
lunar
|
|
1147
|
+
lunch
|
|
1148
|
+
luxury
|
|
1149
|
+
lyrics
|
|
1150
|
+
machine
|
|
1151
|
+
mad
|
|
1152
|
+
magic
|
|
1153
|
+
magnet
|
|
1154
|
+
maid
|
|
1155
|
+
mail
|
|
1156
|
+
main
|
|
1157
|
+
major
|
|
1158
|
+
make
|
|
1159
|
+
mammal
|
|
1160
|
+
man
|
|
1161
|
+
manage
|
|
1162
|
+
mandate
|
|
1163
|
+
mango
|
|
1164
|
+
mansion
|
|
1165
|
+
manual
|
|
1166
|
+
maple
|
|
1167
|
+
marble
|
|
1168
|
+
march
|
|
1169
|
+
margin
|
|
1170
|
+
marine
|
|
1171
|
+
market
|
|
1172
|
+
marriage
|
|
1173
|
+
mask
|
|
1174
|
+
mass
|
|
1175
|
+
master
|
|
1176
|
+
match
|
|
1177
|
+
material
|
|
1178
|
+
math
|
|
1179
|
+
matrix
|
|
1180
|
+
matter
|
|
1181
|
+
maximum
|
|
1182
|
+
maze
|
|
1183
|
+
meadow
|
|
1184
|
+
mean
|
|
1185
|
+
measure
|
|
1186
|
+
meat
|
|
1187
|
+
mechanic
|
|
1188
|
+
medal
|
|
1189
|
+
media
|
|
1190
|
+
melody
|
|
1191
|
+
melt
|
|
1192
|
+
member
|
|
1193
|
+
memory
|
|
1194
|
+
mention
|
|
1195
|
+
menu
|
|
1196
|
+
mercy
|
|
1197
|
+
merge
|
|
1198
|
+
merit
|
|
1199
|
+
merry
|
|
1200
|
+
mesh
|
|
1201
|
+
message
|
|
1202
|
+
metal
|
|
1203
|
+
method
|
|
1204
|
+
middle
|
|
1205
|
+
midnight
|
|
1206
|
+
milk
|
|
1207
|
+
million
|
|
1208
|
+
mimic
|
|
1209
|
+
mind
|
|
1210
|
+
minimum
|
|
1211
|
+
minor
|
|
1212
|
+
minute
|
|
1213
|
+
miracle
|
|
1214
|
+
mirror
|
|
1215
|
+
misery
|
|
1216
|
+
miss
|
|
1217
|
+
mistake
|
|
1218
|
+
mix
|
|
1219
|
+
mixed
|
|
1220
|
+
mixture
|
|
1221
|
+
mobile
|
|
1222
|
+
model
|
|
1223
|
+
modify
|
|
1224
|
+
mom
|
|
1225
|
+
moment
|
|
1226
|
+
monitor
|
|
1227
|
+
monkey
|
|
1228
|
+
monster
|
|
1229
|
+
month
|
|
1230
|
+
moon
|
|
1231
|
+
moral
|
|
1232
|
+
more
|
|
1233
|
+
morning
|
|
1234
|
+
mosquito
|
|
1235
|
+
mother
|
|
1236
|
+
motion
|
|
1237
|
+
motor
|
|
1238
|
+
mountain
|
|
1239
|
+
mouse
|
|
1240
|
+
move
|
|
1241
|
+
movie
|
|
1242
|
+
much
|
|
1243
|
+
muffin
|
|
1244
|
+
mule
|
|
1245
|
+
multiply
|
|
1246
|
+
muscle
|
|
1247
|
+
museum
|
|
1248
|
+
mushroom
|
|
1249
|
+
music
|
|
1250
|
+
must
|
|
1251
|
+
mutual
|
|
1252
|
+
myself
|
|
1253
|
+
mystery
|
|
1254
|
+
myth
|
|
1255
|
+
naive
|
|
1256
|
+
name
|
|
1257
|
+
napkin
|
|
1258
|
+
narrow
|
|
1259
|
+
nasty
|
|
1260
|
+
nation
|
|
1261
|
+
nature
|
|
1262
|
+
near
|
|
1263
|
+
neck
|
|
1264
|
+
need
|
|
1265
|
+
negative
|
|
1266
|
+
neglect
|
|
1267
|
+
neither
|
|
1268
|
+
nephew
|
|
1269
|
+
nerve
|
|
1270
|
+
nest
|
|
1271
|
+
net
|
|
1272
|
+
network
|
|
1273
|
+
neutral
|
|
1274
|
+
never
|
|
1275
|
+
news
|
|
1276
|
+
next
|
|
1277
|
+
nice
|
|
1278
|
+
night
|
|
1279
|
+
noble
|
|
1280
|
+
noise
|
|
1281
|
+
nominee
|
|
1282
|
+
noodle
|
|
1283
|
+
normal
|
|
1284
|
+
north
|
|
1285
|
+
nose
|
|
1286
|
+
notable
|
|
1287
|
+
note
|
|
1288
|
+
nothing
|
|
1289
|
+
notice
|
|
1290
|
+
novel
|
|
1291
|
+
now
|
|
1292
|
+
nuclear
|
|
1293
|
+
number
|
|
1294
|
+
nurse
|
|
1295
|
+
nut
|
|
1296
|
+
oak
|
|
1297
|
+
obey
|
|
1298
|
+
object
|
|
1299
|
+
oblige
|
|
1300
|
+
obscure
|
|
1301
|
+
observe
|
|
1302
|
+
obtain
|
|
1303
|
+
obvious
|
|
1304
|
+
occur
|
|
1305
|
+
ocean
|
|
1306
|
+
october
|
|
1307
|
+
odor
|
|
1308
|
+
off
|
|
1309
|
+
offer
|
|
1310
|
+
office
|
|
1311
|
+
often
|
|
1312
|
+
oil
|
|
1313
|
+
okay
|
|
1314
|
+
old
|
|
1315
|
+
olive
|
|
1316
|
+
olympic
|
|
1317
|
+
omit
|
|
1318
|
+
once
|
|
1319
|
+
one
|
|
1320
|
+
onion
|
|
1321
|
+
online
|
|
1322
|
+
only
|
|
1323
|
+
open
|
|
1324
|
+
opera
|
|
1325
|
+
opinion
|
|
1326
|
+
oppose
|
|
1327
|
+
option
|
|
1328
|
+
orange
|
|
1329
|
+
orbit
|
|
1330
|
+
orchard
|
|
1331
|
+
order
|
|
1332
|
+
ordinary
|
|
1333
|
+
organ
|
|
1334
|
+
orient
|
|
1335
|
+
original
|
|
1336
|
+
orphan
|
|
1337
|
+
ostrich
|
|
1338
|
+
other
|
|
1339
|
+
outdoor
|
|
1340
|
+
outer
|
|
1341
|
+
output
|
|
1342
|
+
outside
|
|
1343
|
+
oval
|
|
1344
|
+
oven
|
|
1345
|
+
over
|
|
1346
|
+
own
|
|
1347
|
+
owner
|
|
1348
|
+
oxygen
|
|
1349
|
+
oyster
|
|
1350
|
+
ozone
|
|
1351
|
+
pact
|
|
1352
|
+
paddle
|
|
1353
|
+
page
|
|
1354
|
+
pair
|
|
1355
|
+
palace
|
|
1356
|
+
palm
|
|
1357
|
+
panda
|
|
1358
|
+
panel
|
|
1359
|
+
panic
|
|
1360
|
+
panther
|
|
1361
|
+
paper
|
|
1362
|
+
parade
|
|
1363
|
+
parent
|
|
1364
|
+
park
|
|
1365
|
+
parrot
|
|
1366
|
+
party
|
|
1367
|
+
pass
|
|
1368
|
+
patch
|
|
1369
|
+
path
|
|
1370
|
+
patient
|
|
1371
|
+
patrol
|
|
1372
|
+
pattern
|
|
1373
|
+
pause
|
|
1374
|
+
pave
|
|
1375
|
+
payment
|
|
1376
|
+
peace
|
|
1377
|
+
peanut
|
|
1378
|
+
pear
|
|
1379
|
+
peasant
|
|
1380
|
+
pelican
|
|
1381
|
+
pen
|
|
1382
|
+
penalty
|
|
1383
|
+
pencil
|
|
1384
|
+
people
|
|
1385
|
+
pepper
|
|
1386
|
+
perfect
|
|
1387
|
+
permit
|
|
1388
|
+
person
|
|
1389
|
+
pet
|
|
1390
|
+
phone
|
|
1391
|
+
photo
|
|
1392
|
+
phrase
|
|
1393
|
+
physical
|
|
1394
|
+
piano
|
|
1395
|
+
picnic
|
|
1396
|
+
picture
|
|
1397
|
+
piece
|
|
1398
|
+
pig
|
|
1399
|
+
pigeon
|
|
1400
|
+
pill
|
|
1401
|
+
pilot
|
|
1402
|
+
pink
|
|
1403
|
+
pioneer
|
|
1404
|
+
pipe
|
|
1405
|
+
pistol
|
|
1406
|
+
pitch
|
|
1407
|
+
pizza
|
|
1408
|
+
place
|
|
1409
|
+
planet
|
|
1410
|
+
plastic
|
|
1411
|
+
plate
|
|
1412
|
+
play
|
|
1413
|
+
please
|
|
1414
|
+
pledge
|
|
1415
|
+
pluck
|
|
1416
|
+
plug
|
|
1417
|
+
plunge
|
|
1418
|
+
poem
|
|
1419
|
+
poet
|
|
1420
|
+
point
|
|
1421
|
+
polar
|
|
1422
|
+
pole
|
|
1423
|
+
police
|
|
1424
|
+
pond
|
|
1425
|
+
pony
|
|
1426
|
+
pool
|
|
1427
|
+
popular
|
|
1428
|
+
portion
|
|
1429
|
+
position
|
|
1430
|
+
possible
|
|
1431
|
+
post
|
|
1432
|
+
potato
|
|
1433
|
+
pottery
|
|
1434
|
+
poverty
|
|
1435
|
+
powder
|
|
1436
|
+
power
|
|
1437
|
+
practice
|
|
1438
|
+
praise
|
|
1439
|
+
predict
|
|
1440
|
+
prefer
|
|
1441
|
+
prepare
|
|
1442
|
+
present
|
|
1443
|
+
pretty
|
|
1444
|
+
prevent
|
|
1445
|
+
price
|
|
1446
|
+
pride
|
|
1447
|
+
primary
|
|
1448
|
+
print
|
|
1449
|
+
priority
|
|
1450
|
+
prison
|
|
1451
|
+
private
|
|
1452
|
+
prize
|
|
1453
|
+
problem
|
|
1454
|
+
process
|
|
1455
|
+
produce
|
|
1456
|
+
profit
|
|
1457
|
+
program
|
|
1458
|
+
project
|
|
1459
|
+
promote
|
|
1460
|
+
proof
|
|
1461
|
+
property
|
|
1462
|
+
prosper
|
|
1463
|
+
protect
|
|
1464
|
+
proud
|
|
1465
|
+
provide
|
|
1466
|
+
public
|
|
1467
|
+
pudding
|
|
1468
|
+
pull
|
|
1469
|
+
pulp
|
|
1470
|
+
pulse
|
|
1471
|
+
pumpkin
|
|
1472
|
+
punch
|
|
1473
|
+
pupil
|
|
1474
|
+
puppy
|
|
1475
|
+
purchase
|
|
1476
|
+
purity
|
|
1477
|
+
purpose
|
|
1478
|
+
purse
|
|
1479
|
+
push
|
|
1480
|
+
put
|
|
1481
|
+
puzzle
|
|
1482
|
+
pyramid
|
|
1483
|
+
quality
|
|
1484
|
+
quantum
|
|
1485
|
+
quarter
|
|
1486
|
+
question
|
|
1487
|
+
quick
|
|
1488
|
+
quit
|
|
1489
|
+
quiz
|
|
1490
|
+
quote
|
|
1491
|
+
rabbit
|
|
1492
|
+
raccoon
|
|
1493
|
+
race
|
|
1494
|
+
rack
|
|
1495
|
+
radar
|
|
1496
|
+
radio
|
|
1497
|
+
rail
|
|
1498
|
+
rain
|
|
1499
|
+
raise
|
|
1500
|
+
rally
|
|
1501
|
+
ramp
|
|
1502
|
+
ranch
|
|
1503
|
+
random
|
|
1504
|
+
range
|
|
1505
|
+
rapid
|
|
1506
|
+
rare
|
|
1507
|
+
rate
|
|
1508
|
+
rather
|
|
1509
|
+
raven
|
|
1510
|
+
raw
|
|
1511
|
+
razor
|
|
1512
|
+
ready
|
|
1513
|
+
real
|
|
1514
|
+
reason
|
|
1515
|
+
rebel
|
|
1516
|
+
rebuild
|
|
1517
|
+
recall
|
|
1518
|
+
receive
|
|
1519
|
+
recipe
|
|
1520
|
+
record
|
|
1521
|
+
recycle
|
|
1522
|
+
reduce
|
|
1523
|
+
reflect
|
|
1524
|
+
reform
|
|
1525
|
+
refuse
|
|
1526
|
+
region
|
|
1527
|
+
regret
|
|
1528
|
+
regular
|
|
1529
|
+
reject
|
|
1530
|
+
relax
|
|
1531
|
+
release
|
|
1532
|
+
relief
|
|
1533
|
+
rely
|
|
1534
|
+
remain
|
|
1535
|
+
remember
|
|
1536
|
+
remind
|
|
1537
|
+
remove
|
|
1538
|
+
render
|
|
1539
|
+
renew
|
|
1540
|
+
rent
|
|
1541
|
+
reopen
|
|
1542
|
+
repair
|
|
1543
|
+
repeat
|
|
1544
|
+
replace
|
|
1545
|
+
report
|
|
1546
|
+
require
|
|
1547
|
+
rescue
|
|
1548
|
+
resemble
|
|
1549
|
+
resist
|
|
1550
|
+
resource
|
|
1551
|
+
response
|
|
1552
|
+
result
|
|
1553
|
+
retire
|
|
1554
|
+
retreat
|
|
1555
|
+
return
|
|
1556
|
+
reunion
|
|
1557
|
+
reveal
|
|
1558
|
+
review
|
|
1559
|
+
reward
|
|
1560
|
+
rhythm
|
|
1561
|
+
rib
|
|
1562
|
+
ribbon
|
|
1563
|
+
rice
|
|
1564
|
+
rich
|
|
1565
|
+
ride
|
|
1566
|
+
ridge
|
|
1567
|
+
rifle
|
|
1568
|
+
right
|
|
1569
|
+
rigid
|
|
1570
|
+
ring
|
|
1571
|
+
riot
|
|
1572
|
+
ripple
|
|
1573
|
+
risk
|
|
1574
|
+
ritual
|
|
1575
|
+
rival
|
|
1576
|
+
river
|
|
1577
|
+
road
|
|
1578
|
+
roast
|
|
1579
|
+
robot
|
|
1580
|
+
robust
|
|
1581
|
+
rocket
|
|
1582
|
+
romance
|
|
1583
|
+
roof
|
|
1584
|
+
rookie
|
|
1585
|
+
room
|
|
1586
|
+
rose
|
|
1587
|
+
rotate
|
|
1588
|
+
rough
|
|
1589
|
+
round
|
|
1590
|
+
route
|
|
1591
|
+
royal
|
|
1592
|
+
rubber
|
|
1593
|
+
rude
|
|
1594
|
+
rug
|
|
1595
|
+
rule
|
|
1596
|
+
run
|
|
1597
|
+
runway
|
|
1598
|
+
rural
|
|
1599
|
+
sad
|
|
1600
|
+
saddle
|
|
1601
|
+
sadness
|
|
1602
|
+
safe
|
|
1603
|
+
sail
|
|
1604
|
+
salad
|
|
1605
|
+
salmon
|
|
1606
|
+
salon
|
|
1607
|
+
salt
|
|
1608
|
+
salute
|
|
1609
|
+
same
|
|
1610
|
+
sample
|
|
1611
|
+
sand
|
|
1612
|
+
satisfy
|
|
1613
|
+
satoshi
|
|
1614
|
+
sauce
|
|
1615
|
+
sausage
|
|
1616
|
+
save
|
|
1617
|
+
say
|
|
1618
|
+
scale
|
|
1619
|
+
scan
|
|
1620
|
+
scare
|
|
1621
|
+
scatter
|
|
1622
|
+
scene
|
|
1623
|
+
scheme
|
|
1624
|
+
school
|
|
1625
|
+
science
|
|
1626
|
+
scissors
|
|
1627
|
+
scorpion
|
|
1628
|
+
scout
|
|
1629
|
+
scrap
|
|
1630
|
+
screen
|
|
1631
|
+
script
|
|
1632
|
+
scrub
|
|
1633
|
+
sea
|
|
1634
|
+
search
|
|
1635
|
+
season
|
|
1636
|
+
seat
|
|
1637
|
+
second
|
|
1638
|
+
secret
|
|
1639
|
+
section
|
|
1640
|
+
security
|
|
1641
|
+
seed
|
|
1642
|
+
seek
|
|
1643
|
+
segment
|
|
1644
|
+
select
|
|
1645
|
+
sell
|
|
1646
|
+
seminar
|
|
1647
|
+
senior
|
|
1648
|
+
sense
|
|
1649
|
+
sentence
|
|
1650
|
+
series
|
|
1651
|
+
service
|
|
1652
|
+
session
|
|
1653
|
+
settle
|
|
1654
|
+
setup
|
|
1655
|
+
seven
|
|
1656
|
+
shadow
|
|
1657
|
+
shaft
|
|
1658
|
+
shallow
|
|
1659
|
+
share
|
|
1660
|
+
shed
|
|
1661
|
+
shell
|
|
1662
|
+
sheriff
|
|
1663
|
+
shield
|
|
1664
|
+
shift
|
|
1665
|
+
shine
|
|
1666
|
+
ship
|
|
1667
|
+
shiver
|
|
1668
|
+
shock
|
|
1669
|
+
shoe
|
|
1670
|
+
shoot
|
|
1671
|
+
shop
|
|
1672
|
+
short
|
|
1673
|
+
shoulder
|
|
1674
|
+
shove
|
|
1675
|
+
shrimp
|
|
1676
|
+
shrug
|
|
1677
|
+
shuffle
|
|
1678
|
+
shy
|
|
1679
|
+
sibling
|
|
1680
|
+
sick
|
|
1681
|
+
side
|
|
1682
|
+
siege
|
|
1683
|
+
sight
|
|
1684
|
+
sign
|
|
1685
|
+
silent
|
|
1686
|
+
silk
|
|
1687
|
+
silly
|
|
1688
|
+
silver
|
|
1689
|
+
similar
|
|
1690
|
+
simple
|
|
1691
|
+
since
|
|
1692
|
+
sing
|
|
1693
|
+
siren
|
|
1694
|
+
sister
|
|
1695
|
+
situate
|
|
1696
|
+
six
|
|
1697
|
+
size
|
|
1698
|
+
skate
|
|
1699
|
+
sketch
|
|
1700
|
+
ski
|
|
1701
|
+
skill
|
|
1702
|
+
skin
|
|
1703
|
+
skirt
|
|
1704
|
+
skull
|
|
1705
|
+
slab
|
|
1706
|
+
slam
|
|
1707
|
+
sleep
|
|
1708
|
+
slender
|
|
1709
|
+
slice
|
|
1710
|
+
slide
|
|
1711
|
+
slight
|
|
1712
|
+
slim
|
|
1713
|
+
slogan
|
|
1714
|
+
slot
|
|
1715
|
+
slow
|
|
1716
|
+
slush
|
|
1717
|
+
small
|
|
1718
|
+
smart
|
|
1719
|
+
smile
|
|
1720
|
+
smoke
|
|
1721
|
+
smooth
|
|
1722
|
+
snack
|
|
1723
|
+
snake
|
|
1724
|
+
snap
|
|
1725
|
+
sniff
|
|
1726
|
+
snow
|
|
1727
|
+
soap
|
|
1728
|
+
soccer
|
|
1729
|
+
social
|
|
1730
|
+
sock
|
|
1731
|
+
soda
|
|
1732
|
+
soft
|
|
1733
|
+
solar
|
|
1734
|
+
soldier
|
|
1735
|
+
solid
|
|
1736
|
+
solution
|
|
1737
|
+
solve
|
|
1738
|
+
someone
|
|
1739
|
+
song
|
|
1740
|
+
soon
|
|
1741
|
+
sorry
|
|
1742
|
+
sort
|
|
1743
|
+
soul
|
|
1744
|
+
sound
|
|
1745
|
+
soup
|
|
1746
|
+
source
|
|
1747
|
+
south
|
|
1748
|
+
space
|
|
1749
|
+
spare
|
|
1750
|
+
spatial
|
|
1751
|
+
spawn
|
|
1752
|
+
speak
|
|
1753
|
+
special
|
|
1754
|
+
speed
|
|
1755
|
+
spell
|
|
1756
|
+
spend
|
|
1757
|
+
sphere
|
|
1758
|
+
spice
|
|
1759
|
+
spider
|
|
1760
|
+
spike
|
|
1761
|
+
spin
|
|
1762
|
+
spirit
|
|
1763
|
+
split
|
|
1764
|
+
spoil
|
|
1765
|
+
sponsor
|
|
1766
|
+
spoon
|
|
1767
|
+
sport
|
|
1768
|
+
spot
|
|
1769
|
+
spray
|
|
1770
|
+
spread
|
|
1771
|
+
spring
|
|
1772
|
+
spy
|
|
1773
|
+
square
|
|
1774
|
+
squeeze
|
|
1775
|
+
squirrel
|
|
1776
|
+
stable
|
|
1777
|
+
stadium
|
|
1778
|
+
staff
|
|
1779
|
+
stage
|
|
1780
|
+
stairs
|
|
1781
|
+
stamp
|
|
1782
|
+
stand
|
|
1783
|
+
start
|
|
1784
|
+
state
|
|
1785
|
+
stay
|
|
1786
|
+
steak
|
|
1787
|
+
steel
|
|
1788
|
+
stem
|
|
1789
|
+
step
|
|
1790
|
+
stereo
|
|
1791
|
+
stick
|
|
1792
|
+
still
|
|
1793
|
+
sting
|
|
1794
|
+
stock
|
|
1795
|
+
stomach
|
|
1796
|
+
stone
|
|
1797
|
+
stool
|
|
1798
|
+
story
|
|
1799
|
+
stove
|
|
1800
|
+
strategy
|
|
1801
|
+
street
|
|
1802
|
+
strike
|
|
1803
|
+
strong
|
|
1804
|
+
struggle
|
|
1805
|
+
student
|
|
1806
|
+
stuff
|
|
1807
|
+
stumble
|
|
1808
|
+
style
|
|
1809
|
+
subject
|
|
1810
|
+
submit
|
|
1811
|
+
subway
|
|
1812
|
+
success
|
|
1813
|
+
such
|
|
1814
|
+
sudden
|
|
1815
|
+
suffer
|
|
1816
|
+
sugar
|
|
1817
|
+
suggest
|
|
1818
|
+
suit
|
|
1819
|
+
summer
|
|
1820
|
+
sun
|
|
1821
|
+
sunny
|
|
1822
|
+
sunset
|
|
1823
|
+
super
|
|
1824
|
+
supply
|
|
1825
|
+
supreme
|
|
1826
|
+
sure
|
|
1827
|
+
surface
|
|
1828
|
+
surge
|
|
1829
|
+
surprise
|
|
1830
|
+
surround
|
|
1831
|
+
survey
|
|
1832
|
+
suspect
|
|
1833
|
+
sustain
|
|
1834
|
+
swallow
|
|
1835
|
+
swamp
|
|
1836
|
+
swap
|
|
1837
|
+
swarm
|
|
1838
|
+
swear
|
|
1839
|
+
sweet
|
|
1840
|
+
swift
|
|
1841
|
+
swim
|
|
1842
|
+
swing
|
|
1843
|
+
switch
|
|
1844
|
+
sword
|
|
1845
|
+
symbol
|
|
1846
|
+
symptom
|
|
1847
|
+
syrup
|
|
1848
|
+
system
|
|
1849
|
+
table
|
|
1850
|
+
tackle
|
|
1851
|
+
tag
|
|
1852
|
+
tail
|
|
1853
|
+
talent
|
|
1854
|
+
talk
|
|
1855
|
+
tank
|
|
1856
|
+
tape
|
|
1857
|
+
target
|
|
1858
|
+
task
|
|
1859
|
+
taste
|
|
1860
|
+
tattoo
|
|
1861
|
+
taxi
|
|
1862
|
+
teach
|
|
1863
|
+
team
|
|
1864
|
+
tell
|
|
1865
|
+
ten
|
|
1866
|
+
tenant
|
|
1867
|
+
tennis
|
|
1868
|
+
tent
|
|
1869
|
+
term
|
|
1870
|
+
test
|
|
1871
|
+
text
|
|
1872
|
+
thank
|
|
1873
|
+
that
|
|
1874
|
+
theme
|
|
1875
|
+
then
|
|
1876
|
+
theory
|
|
1877
|
+
there
|
|
1878
|
+
they
|
|
1879
|
+
thing
|
|
1880
|
+
this
|
|
1881
|
+
thought
|
|
1882
|
+
three
|
|
1883
|
+
thrive
|
|
1884
|
+
throw
|
|
1885
|
+
thumb
|
|
1886
|
+
thunder
|
|
1887
|
+
ticket
|
|
1888
|
+
tide
|
|
1889
|
+
tiger
|
|
1890
|
+
tilt
|
|
1891
|
+
timber
|
|
1892
|
+
time
|
|
1893
|
+
tiny
|
|
1894
|
+
tip
|
|
1895
|
+
tired
|
|
1896
|
+
tissue
|
|
1897
|
+
title
|
|
1898
|
+
toast
|
|
1899
|
+
tobacco
|
|
1900
|
+
today
|
|
1901
|
+
toddler
|
|
1902
|
+
toe
|
|
1903
|
+
together
|
|
1904
|
+
toilet
|
|
1905
|
+
token
|
|
1906
|
+
tomato
|
|
1907
|
+
tomorrow
|
|
1908
|
+
tone
|
|
1909
|
+
tongue
|
|
1910
|
+
tonight
|
|
1911
|
+
tool
|
|
1912
|
+
tooth
|
|
1913
|
+
top
|
|
1914
|
+
topic
|
|
1915
|
+
topple
|
|
1916
|
+
torch
|
|
1917
|
+
tornado
|
|
1918
|
+
tortoise
|
|
1919
|
+
toss
|
|
1920
|
+
total
|
|
1921
|
+
tourist
|
|
1922
|
+
toward
|
|
1923
|
+
tower
|
|
1924
|
+
town
|
|
1925
|
+
toy
|
|
1926
|
+
track
|
|
1927
|
+
trade
|
|
1928
|
+
traffic
|
|
1929
|
+
tragic
|
|
1930
|
+
train
|
|
1931
|
+
transfer
|
|
1932
|
+
trap
|
|
1933
|
+
trash
|
|
1934
|
+
travel
|
|
1935
|
+
tray
|
|
1936
|
+
treat
|
|
1937
|
+
tree
|
|
1938
|
+
trend
|
|
1939
|
+
trial
|
|
1940
|
+
tribe
|
|
1941
|
+
trick
|
|
1942
|
+
trigger
|
|
1943
|
+
trim
|
|
1944
|
+
trip
|
|
1945
|
+
trophy
|
|
1946
|
+
trouble
|
|
1947
|
+
truck
|
|
1948
|
+
true
|
|
1949
|
+
truly
|
|
1950
|
+
trumpet
|
|
1951
|
+
trust
|
|
1952
|
+
truth
|
|
1953
|
+
try
|
|
1954
|
+
tube
|
|
1955
|
+
tuition
|
|
1956
|
+
tumble
|
|
1957
|
+
tuna
|
|
1958
|
+
tunnel
|
|
1959
|
+
turkey
|
|
1960
|
+
turn
|
|
1961
|
+
turtle
|
|
1962
|
+
twelve
|
|
1963
|
+
twenty
|
|
1964
|
+
twice
|
|
1965
|
+
twin
|
|
1966
|
+
twist
|
|
1967
|
+
two
|
|
1968
|
+
type
|
|
1969
|
+
typical
|
|
1970
|
+
ugly
|
|
1971
|
+
umbrella
|
|
1972
|
+
unable
|
|
1973
|
+
unaware
|
|
1974
|
+
uncle
|
|
1975
|
+
uncover
|
|
1976
|
+
under
|
|
1977
|
+
undo
|
|
1978
|
+
unfair
|
|
1979
|
+
unfold
|
|
1980
|
+
unhappy
|
|
1981
|
+
uniform
|
|
1982
|
+
unique
|
|
1983
|
+
unit
|
|
1984
|
+
universe
|
|
1985
|
+
unknown
|
|
1986
|
+
unlock
|
|
1987
|
+
until
|
|
1988
|
+
unusual
|
|
1989
|
+
unveil
|
|
1990
|
+
update
|
|
1991
|
+
upgrade
|
|
1992
|
+
uphold
|
|
1993
|
+
upon
|
|
1994
|
+
upper
|
|
1995
|
+
upset
|
|
1996
|
+
urban
|
|
1997
|
+
urge
|
|
1998
|
+
usage
|
|
1999
|
+
use
|
|
2000
|
+
used
|
|
2001
|
+
useful
|
|
2002
|
+
useless
|
|
2003
|
+
usual
|
|
2004
|
+
utility
|
|
2005
|
+
vacant
|
|
2006
|
+
vacuum
|
|
2007
|
+
vague
|
|
2008
|
+
valid
|
|
2009
|
+
valley
|
|
2010
|
+
valve
|
|
2011
|
+
van
|
|
2012
|
+
vanish
|
|
2013
|
+
vapor
|
|
2014
|
+
various
|
|
2015
|
+
vast
|
|
2016
|
+
vault
|
|
2017
|
+
vehicle
|
|
2018
|
+
velvet
|
|
2019
|
+
vendor
|
|
2020
|
+
venture
|
|
2021
|
+
venue
|
|
2022
|
+
verb
|
|
2023
|
+
verify
|
|
2024
|
+
version
|
|
2025
|
+
very
|
|
2026
|
+
vessel
|
|
2027
|
+
veteran
|
|
2028
|
+
viable
|
|
2029
|
+
vibrant
|
|
2030
|
+
vicious
|
|
2031
|
+
victory
|
|
2032
|
+
video
|
|
2033
|
+
view
|
|
2034
|
+
village
|
|
2035
|
+
vintage
|
|
2036
|
+
violin
|
|
2037
|
+
virtual
|
|
2038
|
+
virus
|
|
2039
|
+
visa
|
|
2040
|
+
visit
|
|
2041
|
+
visual
|
|
2042
|
+
vital
|
|
2043
|
+
vivid
|
|
2044
|
+
vocal
|
|
2045
|
+
voice
|
|
2046
|
+
void
|
|
2047
|
+
volcano
|
|
2048
|
+
volume
|
|
2049
|
+
vote
|
|
2050
|
+
voyage
|
|
2051
|
+
wage
|
|
2052
|
+
wagon
|
|
2053
|
+
wait
|
|
2054
|
+
walk
|
|
2055
|
+
wall
|
|
2056
|
+
walnut
|
|
2057
|
+
want
|
|
2058
|
+
warfare
|
|
2059
|
+
warm
|
|
2060
|
+
warrior
|
|
2061
|
+
wash
|
|
2062
|
+
wasp
|
|
2063
|
+
waste
|
|
2064
|
+
water
|
|
2065
|
+
wave
|
|
2066
|
+
way
|
|
2067
|
+
wealth
|
|
2068
|
+
weapon
|
|
2069
|
+
wear
|
|
2070
|
+
weasel
|
|
2071
|
+
weather
|
|
2072
|
+
web
|
|
2073
|
+
wedding
|
|
2074
|
+
weekend
|
|
2075
|
+
weird
|
|
2076
|
+
welcome
|
|
2077
|
+
west
|
|
2078
|
+
wet
|
|
2079
|
+
whale
|
|
2080
|
+
what
|
|
2081
|
+
wheat
|
|
2082
|
+
wheel
|
|
2083
|
+
when
|
|
2084
|
+
where
|
|
2085
|
+
whip
|
|
2086
|
+
whisper
|
|
2087
|
+
wide
|
|
2088
|
+
width
|
|
2089
|
+
wife
|
|
2090
|
+
wild
|
|
2091
|
+
will
|
|
2092
|
+
win
|
|
2093
|
+
window
|
|
2094
|
+
wine
|
|
2095
|
+
wing
|
|
2096
|
+
wink
|
|
2097
|
+
winner
|
|
2098
|
+
winter
|
|
2099
|
+
wire
|
|
2100
|
+
wisdom
|
|
2101
|
+
wise
|
|
2102
|
+
wish
|
|
2103
|
+
witness
|
|
2104
|
+
wolf
|
|
2105
|
+
woman
|
|
2106
|
+
wonder
|
|
2107
|
+
wood
|
|
2108
|
+
wool
|
|
2109
|
+
word
|
|
2110
|
+
work
|
|
2111
|
+
world
|
|
2112
|
+
worry
|
|
2113
|
+
worth
|
|
2114
|
+
wrap
|
|
2115
|
+
wreck
|
|
2116
|
+
wrestle
|
|
2117
|
+
wrist
|
|
2118
|
+
write
|
|
2119
|
+
wrong
|
|
2120
|
+
yard
|
|
2121
|
+
year
|
|
2122
|
+
yellow
|
|
2123
|
+
you
|
|
2124
|
+
young
|
|
2125
|
+
youth
|
|
2126
|
+
zebra
|
|
2127
|
+
zero
|
|
2128
|
+
zone
|
|
2129
|
+
zoo`.split(`
|
|
2130
|
+
`);function number$1(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function bool$1(e){if(typeof e!="boolean")throw new Error(`Expected boolean, not ${e}`)}function isBytes$2(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function bytes$1(e,...t){if(!isBytes$2(e))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 hash$1(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number$1(e.outputLen),number$1(e.blockLen)}function exists$1(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 output$1(e,t){bytes$1(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const assert$1={number:number$1,bool:bool$1,bytes:bytes$1,hash:hash$1,exists:exists$1,output:output$1},crypto$1=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function isBytes$1(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}const createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),rotr=(e,t)=>e<<32-t|e>>>t,isLE$1=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE$1)throw new Error("Non little-endian hardware is not supported");const hexes=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function bytesToHex(e){if(!isBytes$1(e))throw new Error("Uint8Array expected");let t="";for(let n=0;n<e.length;n++)t+=hexes[e[n]];return t}const asciis={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function asciiToBase16(e){return e>=asciis._0&&e<=asciis._9?e-asciis._0:e>=asciis._A&&e<=asciis._F?e-(asciis._A-10):e>=asciis._a&&e<=asciis._f?e-(asciis._a-10):void 0}function hexToBytes(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let o=0,s=0;o<n;o++,s+=2){const i=asciiToBase16(e.charCodeAt(s)),a=asciiToBase16(e.charCodeAt(s+1));if(i===void 0||a===void 0){const l=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+s)}r[o]=16*i+a}return r}function utf8ToBytes$1(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function toBytes$1(e){if(typeof e=="string"&&(e=utf8ToBytes$1(e)),!isBytes$1(e))throw new Error("expected Uint8Array, got "+typeof e);return e}function concatBytes(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];if(!isBytes$1(o))throw new Error("Uint8Array expected");t+=o.length}const n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){const s=e[r];n.set(s,o),o+=s.length}return n}class Hash{clone(){return this._cloneInto()}}const toStr={}.toString;function checkOpts$1(e,t){if(t!==void 0&&toStr.call(t)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(e,t)}function wrapConstructor(e){const t=r=>e().update(toBytes$1(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function randomBytes(e=32){if(crypto$1&&typeof crypto$1.getRandomValues=="function")return crypto$1.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}let HMAC$1=class extends Hash{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,hash$1(e);const n=toBytes$1(t);if(this.iHash=e.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 r=this.blockLen,o=new Uint8Array(r);o.set(n.length>r?e.create().update(n).digest():n);for(let s=0;s<o.length;s++)o[s]^=54;this.iHash.update(o),this.oHash=e.create();for(let s=0;s<o.length;s++)o[s]^=106;this.oHash.update(o),o.fill(0)}update(e){return exists$1(this),this.iHash.update(e),this}digestInto(e){exists$1(this),bytes$1(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:n,finished:r,destroyed:o,blockLen:s,outputLen:i}=this;return e.finished=r,e.destroyed=o,e.blockLen=s,e.outputLen=i,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const hmac$1=(e,t,n)=>new HMAC$1(e,t).update(n).digest();function pbkdf2Init(e,t,n,r){hash$1(e);const o=checkOpts$1({dkLen:32,asyncTick:10},r),{c:s,dkLen:i,asyncTick:a}=o;if(number$1(s),number$1(i),number$1(a),s<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const l=toBytes$1(t),c=toBytes$1(n),d=new Uint8Array(i),p=hmac$1.create(e,l),g=p._cloneInto().update(c);return{c:s,dkLen:i,asyncTick:a,DK:d,PRF:p,PRFSalt:g}}function pbkdf2Output(e,t,n,r,o){return e.destroy(),t.destroy(),r&&r.destroy(),o.fill(0),n}function pbkdf2(e,t,n,r){const{c:o,dkLen:s,DK:i,PRF:a,PRFSalt:l}=pbkdf2Init(e,t,n,r);let c;const d=new Uint8Array(4),p=createView(d),g=new Uint8Array(a.outputLen);for(let v=1,x=0;x<s;v++,x+=a.outputLen){const b=i.subarray(x,x+a.outputLen);p.setInt32(0,v,!1),(c=l._cloneInto(c)).update(d).digestInto(g),b.set(g.subarray(0,b.length));for(let C=1;C<o;C++){a._cloneInto(c).update(g).digestInto(g);for(let _=0;_<b.length;_++)b[_]^=g[_]}}return pbkdf2Output(a,l,i,c,g)}function setBigUint64(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const o=BigInt(32),s=BigInt(4294967295),i=Number(n>>o&s),a=Number(n&s),l=r?4:0,c=r?0:4;e.setUint32(t+l,i,r),e.setUint32(t+c,a,r)}hmac$1.create=(e,t)=>new HMAC$1(e,t);class SHA2 extends Hash{constructor(t,n,r,o){super(),this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=createView(this.buffer)}update(t){exists$1(this);const{view:n,buffer:r,blockLen:o}=this,s=(t=toBytes$1(t)).length;for(let i=0;i<s;){const a=Math.min(o-this.pos,s-i);if(a!==o)r.set(t.subarray(i,i+a),this.pos),this.pos+=a,i+=a,this.pos===o&&(this.process(n,0),this.pos=0);else{const l=createView(t);for(;o<=s-i;i+=o)this.process(l,i)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){exists$1(this),output$1(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>o-i&&(this.process(r,0),i=0);for(let p=i;p<o;p++)n[p]=0;setBigUint64(r,o-8,BigInt(8*this.length),s),this.process(r,0);const a=createView(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=l/4,d=this.get();if(c>d.length)throw new Error("_sha2: outputLen bigger than state");for(let p=0;p<c;p++)a.setUint32(4*p,d[p],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:o,finished:s,destroyed:i,pos:a}=this;return t.length=o,t.pos=a,t.finished=s,t.destroyed=i,o%n&&t.buffer.set(r),t}}const Chi=(e,t,n)=>e&t^~e&n,Maj=(e,t,n)=>e&t^e&n^t&n,SHA256_K=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]),IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_W=new Uint32Array(64);class SHA256 extends SHA2{constructor(){super(64,32,8,!1),this.A=0|IV[0],this.B=0|IV[1],this.C=0|IV[2],this.D=0|IV[3],this.E=0|IV[4],this.F=0|IV[5],this.G=0|IV[6],this.H=0|IV[7]}get(){const{A:t,B:n,C:r,D:o,E:s,F:i,G:a,H:l}=this;return[t,n,r,o,s,i,a,l]}set(t,n,r,o,s,i,a,l){this.A=0|t,this.B=0|n,this.C=0|r,this.D=0|o,this.E=0|s,this.F=0|i,this.G=0|a,this.H=0|l}process(t,n){for(let p=0;p<16;p++,n+=4)SHA256_W[p]=t.getUint32(n,!1);for(let p=16;p<64;p++){const g=SHA256_W[p-15],v=SHA256_W[p-2],x=rotr(g,7)^rotr(g,18)^g>>>3,b=rotr(v,17)^rotr(v,19)^v>>>10;SHA256_W[p]=b+SHA256_W[p-7]+x+SHA256_W[p-16]|0}let{A:r,B:o,C:s,D:i,E:a,F:l,G:c,H:d}=this;for(let p=0;p<64;p++){const g=d+(rotr(a,6)^rotr(a,11)^rotr(a,25))+Chi(a,l,c)+SHA256_K[p]+SHA256_W[p]|0,v=(rotr(r,2)^rotr(r,13)^rotr(r,22))+Maj(r,o,s)|0;d=c,c=l,l=a,a=i+g|0,i=s,s=o,o=r,r=g+v|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,a=a+this.E|0,l=l+this.F|0,c=c+this.G|0,d=d+this.H|0,this.set(r,o,s,i,a,l,c,d)}roundClean(){SHA256_W.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const sha256=wrapConstructor(()=>new SHA256),U32_MASK64=BigInt(2**32-1),_32n=BigInt(32);function fromBig(e,t=!1){return t?{h:Number(e&U32_MASK64),l:Number(e>>_32n&U32_MASK64)}:{h:0|Number(e>>_32n&U32_MASK64),l:0|Number(e&U32_MASK64)}}function split(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let o=0;o<e.length;o++){const{h:s,l:i}=fromBig(e[o],t);[n[o],r[o]]=[s,i]}return[n,r]}const toBig=(e,t)=>BigInt(e>>>0)<<_32n|BigInt(t>>>0),shrSH=(e,t,n)=>e>>>n,shrSL=(e,t,n)=>e<<32-n|t>>>n,rotrSH=(e,t,n)=>e>>>n|t<<32-n,rotrSL=(e,t,n)=>e<<32-n|t>>>n,rotrBH=(e,t,n)=>e<<64-n|t>>>n-32,rotrBL=(e,t,n)=>e>>>n-32|t<<64-n,rotr32H=(e,t)=>t,rotr32L=(e,t)=>e,rotlSH=(e,t,n)=>e<<n|t>>>32-n,rotlSL=(e,t,n)=>t<<n|e>>>32-n,rotlBH=(e,t,n)=>t<<n-32|e>>>64-n,rotlBL=(e,t,n)=>e<<n-32|t>>>64-n;function add(e,t,n,r){const o=(t>>>0)+(r>>>0);return{h:e+n+(o/2**32|0)|0,l:0|o}}const add3L=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),add3H=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,add4L=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),add4H=(e,t,n,r,o)=>t+n+r+o+(e/2**32|0)|0,add5L=(e,t,n,r,o)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(o>>>0),add5H=(e,t,n,r,o,s)=>t+n+r+o+s+(e/2**32|0)|0,u64={fromBig,split,toBig,shrSH,shrSL,rotrSH,rotrSL,rotrBH,rotrBL,rotr32H,rotr32L,rotlSH,rotlSL,rotlBH,rotlBL,add,add3L,add3H,add4L,add4H,add5H,add5L},[SHA512_Kh,SHA512_Kl]=u64.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),SHA512_W_H=new Uint32Array(80),SHA512_W_L=new Uint32Array(80);class SHA512 extends SHA2{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:n,Bh:r,Bl:o,Ch:s,Cl:i,Dh:a,Dl:l,Eh:c,El:d,Fh:p,Fl:g,Gh:v,Gl:x,Hh:b,Hl:C}=this;return[t,n,r,o,s,i,a,l,c,d,p,g,v,x,b,C]}set(t,n,r,o,s,i,a,l,c,d,p,g,v,x,b,C){this.Ah=0|t,this.Al=0|n,this.Bh=0|r,this.Bl=0|o,this.Ch=0|s,this.Cl=0|i,this.Dh=0|a,this.Dl=0|l,this.Eh=0|c,this.El=0|d,this.Fh=0|p,this.Fl=0|g,this.Gh=0|v,this.Gl=0|x,this.Hh=0|b,this.Hl=0|C}process(t,n){for(let $=0;$<16;$++,n+=4)SHA512_W_H[$]=t.getUint32(n),SHA512_W_L[$]=t.getUint32(n+=4);for(let $=16;$<80;$++){const N=0|SHA512_W_H[$-15],T=0|SHA512_W_L[$-15],L=u64.rotrSH(N,T,1)^u64.rotrSH(N,T,8)^u64.shrSH(N,T,7),B=u64.rotrSL(N,T,1)^u64.rotrSL(N,T,8)^u64.shrSL(N,T,7),E=0|SHA512_W_H[$-2],m=0|SHA512_W_L[$-2],y=u64.rotrSH(E,m,19)^u64.rotrBH(E,m,61)^u64.shrSH(E,m,6),S=u64.rotrSL(E,m,19)^u64.rotrBL(E,m,61)^u64.shrSL(E,m,6),R=u64.add4L(B,S,SHA512_W_L[$-7],SHA512_W_L[$-16]),A=u64.add4H(R,L,y,SHA512_W_H[$-7],SHA512_W_H[$-16]);SHA512_W_H[$]=0|A,SHA512_W_L[$]=0|R}let{Ah:r,Al:o,Bh:s,Bl:i,Ch:a,Cl:l,Dh:c,Dl:d,Eh:p,El:g,Fh:v,Fl:x,Gh:b,Gl:C,Hh:_,Hl:k}=this;for(let $=0;$<80;$++){const N=u64.rotrSH(p,g,14)^u64.rotrSH(p,g,18)^u64.rotrBH(p,g,41),T=u64.rotrSL(p,g,14)^u64.rotrSL(p,g,18)^u64.rotrBL(p,g,41),L=p&v^~p&b,B=g&x^~g&C,E=u64.add5L(k,T,B,SHA512_Kl[$],SHA512_W_L[$]),m=u64.add5H(E,_,N,L,SHA512_Kh[$],SHA512_W_H[$]),y=0|E,S=u64.rotrSH(r,o,28)^u64.rotrBH(r,o,34)^u64.rotrBH(r,o,39),R=u64.rotrSL(r,o,28)^u64.rotrBL(r,o,34)^u64.rotrBL(r,o,39),A=r&s^r&a^s&a,U=o&i^o&l^i&l;_=0|b,k=0|C,b=0|v,C=0|x,v=0|p,x=0|g,{h:p,l:g}=u64.add(0|c,0|d,0|m,0|y),c=0|a,d=0|l,a=0|s,l=0|i,s=0|r,i=0|o;const I=u64.add3L(y,R,U);r=u64.add3H(I,m,S,A),o=0|I}({h:r,l:o}=u64.add(0|this.Ah,0|this.Al,0|r,0|o)),{h:s,l:i}=u64.add(0|this.Bh,0|this.Bl,0|s,0|i),{h:a,l}=u64.add(0|this.Ch,0|this.Cl,0|a,0|l),{h:c,l:d}=u64.add(0|this.Dh,0|this.Dl,0|c,0|d),{h:p,l:g}=u64.add(0|this.Eh,0|this.El,0|p,0|g),{h:v,l:x}=u64.add(0|this.Fh,0|this.Fl,0|v,0|x),{h:b,l:C}=u64.add(0|this.Gh,0|this.Gl,0|b,0|C),{h:_,l:k}=u64.add(0|this.Hh,0|this.Hl,0|_,0|k),this.set(r,o,s,i,a,l,c,d,p,g,v,x,b,C,_,k)}roundClean(){SHA512_W_H.fill(0),SHA512_W_L.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const sha512=wrapConstructor(()=>new SHA512);/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function isBytes(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function chain(...e){const t=r=>r,n=(r,o)=>s=>r(o(s));return{encode:e.map(r=>r.encode).reduceRight(n,t),decode:e.map(r=>r.decode).reduce(n,t)}}function alphabet(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(n=>{if(n<0||n>=e.length)throw new Error(`Digit index outside alphabet: ${n} (alphabet: ${e.length})`);return e[n]})},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(n=>{if(typeof n!="string")throw new Error(`alphabet.decode: not string element=${n}`);const r=e.indexOf(n);if(r===-1)throw new Error(`Unknown letter: "${n}". Allowed: ${e}`);return r})}}}function join(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 n of t)if(typeof n!="string")throw new Error(`join.encode: non-string input=${n}`);return t.join(e)},decode:t=>{if(typeof t!="string")throw new Error("join.decode input should be string");return t.split(e)}}}function padding(e,t="="){if(typeof t!="string")throw new Error("padding chr should be string");return{encode(n){if(!Array.isArray(n)||n.length&&typeof n[0]!="string")throw new Error("padding.encode input should be array of strings");for(let r of n)if(typeof r!="string")throw new Error(`padding.encode: non-string input=${r}`);for(;n.length*e%8;)n.push(t);return n},decode(n){if(!Array.isArray(n)||n.length&&typeof n[0]!="string")throw new Error("padding.encode input should be array of strings");for(let o of n)if(typeof o!="string")throw new Error(`padding.decode: non-string input=${o}`);let r=n.length;if(r*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;r>0&&n[r-1]===t;r--)if(!((r-1)*e%8))throw new Error("Invalid padding: string has too much padding");return n.slice(0,r)}}}function convertRadix(e,t,n){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: wrong to=${n}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let r=0;const o=[],s=Array.from(e);for(s.forEach(i=>{if(i<0||i>=t)throw new Error(`Wrong integer: ${i}`)});;){let i=0,a=!0;for(let l=r;l<s.length;l++){const c=s[l],d=t*i+c;if(!Number.isSafeInteger(d)||t*i/t!==i||d-c!=t*i)throw new Error("convertRadix: carry overflow");i=d%n;const p=Math.floor(d/n);if(s[l]=p,!Number.isSafeInteger(p)||p*n+i!==d)throw new Error("convertRadix: carry overflow");a&&(p?a=!1:r=l)}if(o.push(i),a)break}for(let i=0;i<e.length-1&&e[i]===0;i++)o.push(0);return o.reverse()}const gcd=(e,t)=>t?gcd(t,e%t):e,radix2carry=(e,t)=>e+(t-gcd(e,t));function convertRadix2(e,t,n,r){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(radix2carry(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${radix2carry(t,n)}`);let o=0,s=0;const i=2**n-1,a=[];for(const l of e){if(l>=2**t)throw new Error(`convertRadix2: invalid data word=${l} from=${t}`);if(o=o<<t|l,s+t>32)throw new Error(`convertRadix2: carry overflow pos=${s} from=${t}`);for(s+=t;s>=n;s-=n)a.push((o>>s-n&i)>>>0);o&=2**s-1}if(o=o<<n-s&i,!r&&s>=t)throw new Error("Excess padding");if(!r&&o)throw new Error(`Non-zero padding: ${o}`);return r&&s>0&&a.push(o>>>0),a}function radix(e){return{encode:t=>{if(!isBytes(t))throw new Error("radix.encode input should be Uint8Array");return convertRadix(Array.from(t),256,e)},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("radix.decode input should be array of numbers");return Uint8Array.from(convertRadix(t,e,256))}}}function radix2(e,t=!1){if(e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(radix2carry(8,e)>32||radix2carry(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!isBytes(n))throw new Error("radix2.encode input should be Uint8Array");return convertRadix2(Array.from(n),8,e,!t)},decode:n=>{if(!Array.isArray(n)||n.length&&typeof n[0]!="number")throw new Error("radix2.decode input should be array of numbers");return Uint8Array.from(convertRadix2(n,e,8,t))}}}function unsafeWrapper(e){if(typeof e!="function")throw new Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch{}}}function checksum(e,t){if(typeof t!="function")throw new Error("checksum fn should be function");return{encode(n){if(!isBytes(n))throw new Error("checksum.encode: input should be Uint8Array");const r=t(n).slice(0,e),o=new Uint8Array(n.length+e);return o.set(n),o.set(r,n.length),o},decode(n){if(!isBytes(n))throw new Error("checksum.decode: input should be Uint8Array");const r=n.slice(0,-e),o=t(r).slice(0,e),s=n.slice(-e);for(let i=0;i<e;i++)if(o[i]!==s[i])throw new Error("Invalid checksum");return r}}}const utils$1={alphabet,chain,checksum,convertRadix,convertRadix2,radix,radix2,join,padding},base64=chain(radix2(6),alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),padding(6),join("")),genBase58=e=>chain(radix(58),alphabet(e),join("")),base58=genBase58("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),createBase58check=e=>chain(checksum(4,t=>e(e(t))),base58),base58check$1=createBase58check,BECH_ALPHABET=chain(alphabet("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),join("")),POLYMOD_GENERATORS=[996825010,642813549,513874426,1027748829,705979059];function bech32Polymod(e){const t=e>>25;let n=(33554431&e)<<5;for(let r=0;r<POLYMOD_GENERATORS.length;r++)(t>>r&1)==1&&(n^=POLYMOD_GENERATORS[r]);return n}function bechChecksum(e,t,n=1){const r=e.length;let o=1;for(let s=0;s<r;s++){const i=e.charCodeAt(s);if(i<33||i>126)throw new Error(`Invalid prefix (${e})`);o=bech32Polymod(o)^i>>5}o=bech32Polymod(o);for(let s=0;s<r;s++)o=bech32Polymod(o)^31&e.charCodeAt(s);for(let s of t)o=bech32Polymod(o)^s;for(let s=0;s<6;s++)o=bech32Polymod(o);return o^=n,BECH_ALPHABET.encode(convertRadix2([o%2**30],30,5,!1))}function genBech32(e){const n=radix2(5),r=n.decode,o=n.encode,s=unsafeWrapper(r);function i(a,l=90){if(typeof a!="string")throw new Error("bech32.decode input should be string, not "+typeof a);if(a.length<8||l!==!1&&a.length>l)throw new TypeError(`Wrong string length: ${a.length} (${a}). Expected (8..${l})`);const c=a.toLowerCase();if(a!==c&&a!==a.toUpperCase())throw new Error("String must be lowercase or uppercase");const d=(a=c).lastIndexOf("1");if(d===0||d===-1)throw new Error('Letter "1" must be present between prefix and data only');const p=a.slice(0,d),g=a.slice(d+1);if(g.length<6)throw new Error("Data must be at least 6 characters long");const v=BECH_ALPHABET.decode(g).slice(0,-6),x=bechChecksum(p,v,1);if(!g.endsWith(x))throw new Error(`Invalid checksum in ${a}: expected "${x}"`);return{prefix:p,words:v}}return{encode:function(a,l,c=90){if(typeof a!="string")throw new Error("bech32.encode prefix should be string, not "+typeof a);if(!Array.isArray(l)||l.length&&typeof l[0]!="number")throw new Error("bech32.encode words should be array of numbers, not "+typeof l);const d=a.length+7+l.length;if(c!==!1&&d>c)throw new TypeError(`Length ${d} exceeds limit ${c}`);const p=a.toLowerCase(),g=bechChecksum(p,l,1);return`${p}1${BECH_ALPHABET.encode(l)}${g}`},decode:i,decodeToBytes:function(a){const{prefix:l,words:c}=i(a,!1);return{prefix:l,words:c,bytes:r(c)}},decodeUnsafe:unsafeWrapper(i),fromWords:r,fromWordsUnsafe:s,toWords:o}}const bech32=genBech32(),isJapanese=e=>e[0]==="あいこくしん";function nfkd(e){if(typeof e!="string")throw new TypeError("Invalid mnemonic type: "+typeof e);return e.normalize("NFKD")}function normalize(e){const t=nfkd(e),n=t.split(" ");if(![12,15,18,21,24].includes(n.length))throw new Error("Invalid mnemonic");return{nfkd:t,words:n}}function assertEntropy(e){assert$1.bytes(e,16,20,24,28,32)}function generateMnemonic(e,t=128){if(assert$1.number(t),t%32!=0||t>256)throw new TypeError("Invalid entropy");return entropyToMnemonic(randomBytes(t/8),e)}const calcChecksum=e=>{const t=8-e.length/4;return new Uint8Array([sha256(e)[0]>>t<<t])};function getCoder(e){if(!Array.isArray(e)||e.length!==2048||typeof e[0]!="string")throw new Error("Worlist: expected array of 2048 strings");return e.forEach(t=>{if(typeof t!="string")throw new Error(`Wordlist: non-string element: ${t}`)}),utils$1.chain(utils$1.checksum(1,calcChecksum),utils$1.radix2(11,!0),utils$1.alphabet(e))}function mnemonicToEntropy(e,t){const{words:n}=normalize(e),r=getCoder(t).decode(n);return assertEntropy(r),r}function entropyToMnemonic(e,t){return assertEntropy(e),getCoder(t).encode(e).join(isJapanese(t)?" ":" ")}function validateMnemonic(e,t){try{mnemonicToEntropy(e,t)}catch{return!1}return!0}const salt=e=>nfkd(`mnemonic${e}`);function mnemonicToSeedSync(e,t=""){return pbkdf2(sha512,normalize(e).nfkd,salt(t),{c:2048,dkLen:64})}const Rho=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Id=Uint8Array.from({length:16},(e,t)=>t),Pi=Id.map(e=>(9*e+5)%16);let idxL=[Id],idxR=[Pi];for(let e=0;e<4;e++)for(let t of[idxL,idxR])t.push(t[e].map(n=>Rho[n]));const shifts=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(e=>new Uint8Array(e)),shiftsL=idxL.map((e,t)=>e.map(n=>shifts[t][n])),shiftsR=idxR.map((e,t)=>e.map(n=>shifts[t][n])),Kl=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),Kr=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),rotl$1=(e,t)=>e<<t|e>>>32-t;function f(e,t,n,r){return e===0?t^n^r:e===1?t&n|~t&r:e===2?(t|~n)^r:e===3?t&r|n&~r:t^(n|~r)}const BUF=new Uint32Array(16);class RIPEMD160 extends SHA2{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:t,h1:n,h2:r,h3:o,h4:s}=this;return[t,n,r,o,s]}set(t,n,r,o,s){this.h0=0|t,this.h1=0|n,this.h2=0|r,this.h3=0|o,this.h4=0|s}process(t,n){for(let v=0;v<16;v++,n+=4)BUF[v]=t.getUint32(n,!0);let r=0|this.h0,o=r,s=0|this.h1,i=s,a=0|this.h2,l=a,c=0|this.h3,d=c,p=0|this.h4,g=p;for(let v=0;v<5;v++){const x=4-v,b=Kl[v],C=Kr[v],_=idxL[v],k=idxR[v],$=shiftsL[v],N=shiftsR[v];for(let T=0;T<16;T++){const L=rotl$1(r+f(v,s,a,c)+BUF[_[T]]+b,$[T])+p|0;r=p,p=c,c=0|rotl$1(a,10),a=s,s=L}for(let T=0;T<16;T++){const L=rotl$1(o+f(x,i,l,d)+BUF[k[T]]+C,N[T])+g|0;o=g,g=d,d=0|rotl$1(l,10),l=i,i=L}}this.set(this.h1+a+d|0,this.h2+c+g|0,this.h3+p+o|0,this.h4+r+i|0,this.h0+s+l|0)}roundClean(){BUF.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const ripemd160=wrapConstructor(()=>new RIPEMD160),Point=secp256k1.ProjectivePoint,base58check=base58check$1(sha256);function bytesToNumber(e){return BigInt(`0x${bytesToHex(e)}`)}function numberToBytes(e){return hexToBytes(e.toString(16).padStart(64,"0"))}const MASTER_SECRET=utf8ToBytes$1("Bitcoin seed"),BITCOIN_VERSIONS={private:76066276,public:76067358},HARDENED_OFFSET=2147483648,hash160=e=>ripemd160(sha256(e)),fromU32=e=>createView(e).getUint32(0,!1),toU32=e=>{if(!Number.isSafeInteger(e)||e<0||e>2**32-1)throw new Error(`Invalid number=${e}. Should be from 0 to 2 ** 32 - 1`);const t=new Uint8Array(4);return createView(t).setUint32(0,e,!1),t};class HDKey{get fingerprint(){if(!this.pubHash)throw new Error("No publicKey set!");return fromU32(this.pubHash)}get identifier(){return this.pubHash}get pubKeyHash(){return this.pubHash}get privateKey(){return this.privKeyBytes||null}get publicKey(){return this.pubKey||null}get privateExtendedKey(){const t=this.privateKey;if(!t)throw new Error("No private key");return base58check.encode(this.serialize(this.versions.private,concatBytes(new Uint8Array([0]),t)))}get publicExtendedKey(){if(!this.pubKey)throw new Error("No public key");return base58check.encode(this.serialize(this.versions.public,this.pubKey))}static fromMasterSeed(t,n=BITCOIN_VERSIONS){if(bytes$1(t),8*t.length<128||8*t.length>512)throw new Error(`HDKey: wrong seed length=${t.length}. Should be between 128 and 512 bits; 256 bits is advised)`);const r=hmac$1(sha512,MASTER_SECRET,t);return new HDKey({versions:n,chainCode:r.slice(32),privateKey:r.slice(0,32)})}static fromExtendedKey(t,n=BITCOIN_VERSIONS){const r=base58check.decode(t),o=createView(r),s=o.getUint32(0,!1),i={versions:n,depth:r[4],parentFingerprint:o.getUint32(5,!1),index:o.getUint32(9,!1),chainCode:r.slice(13,45)},a=r.slice(45),l=a[0]===0;if(s!==n[l?"private":"public"])throw new Error("Version mismatch");return new HDKey(l?{...i,privateKey:a.slice(1)}:{...i,publicKey:a})}static fromJSON(t){return HDKey.fromExtendedKey(t.xpriv)}constructor(t){if(this.depth=0,this.index=0,this.chainCode=null,this.parentFingerprint=0,!t||typeof t!="object")throw new Error("HDKey.constructor must not be called directly");if(this.versions=t.versions||BITCOIN_VERSIONS,this.depth=t.depth||0,this.chainCode=t.chainCode,this.index=t.index||0,this.parentFingerprint=t.parentFingerprint||0,!this.depth&&(this.parentFingerprint||this.index))throw new Error("HDKey: zero depth with non-zero index/parent fingerprint");if(t.publicKey&&t.privateKey)throw new Error("HDKey: publicKey and privateKey at same time.");if(t.privateKey){if(!secp256k1.utils.isValidPrivateKey(t.privateKey))throw new Error("Invalid private key");this.privKey=typeof t.privateKey=="bigint"?t.privateKey:bytesToNumber(t.privateKey),this.privKeyBytes=numberToBytes(this.privKey),this.pubKey=secp256k1.getPublicKey(t.privateKey,!0)}else{if(!t.publicKey)throw new Error("HDKey: no public or private key provided");this.pubKey=Point.fromHex(t.publicKey).toRawBytes(!0)}this.pubHash=hash160(this.pubKey)}derive(t){if(!/^[mM]'?/.test(t))throw new Error('Path must start with "m" or "M"');if(/^[mM]'?$/.test(t))return this;const n=t.replace(/^[mM]'?\//,"").split("/");let r=this;for(const o of n){const s=/^(\d+)('?)$/.exec(o);if(!s||s.length!==3)throw new Error(`Invalid child index: ${o}`);let i=+s[1];if(!Number.isSafeInteger(i)||i>=HARDENED_OFFSET)throw new Error("Invalid index");s[2]==="'"&&(i+=HARDENED_OFFSET),r=r.deriveChild(i)}return r}deriveChild(t){if(!this.pubKey||!this.chainCode)throw new Error("No publicKey or chainCode set");let n=toU32(t);if(t>=HARDENED_OFFSET){const a=this.privateKey;if(!a)throw new Error("Could not derive hardened child key");n=concatBytes(new Uint8Array([0]),a,n)}else n=concatBytes(this.pubKey,n);const r=hmac$1(sha512,this.chainCode,n),o=bytesToNumber(r.slice(0,32)),s=r.slice(32);if(!secp256k1.utils.isValidPrivateKey(o))throw new Error("Tweak bigger than curve order");const i={versions:this.versions,chainCode:s,depth:this.depth+1,parentFingerprint:this.fingerprint,index:t};try{if(this.privateKey){const a=mod(this.privKey+o,secp256k1.CURVE.n);if(!secp256k1.utils.isValidPrivateKey(a))throw new Error("The tweak was out of range or the resulted private key is invalid");i.privateKey=a}else{const a=Point.fromHex(this.pubKey).add(Point.fromPrivateKey(o));if(a.equals(Point.ZERO))throw new Error("The tweak was equal to negative P, which made the result key invalid");i.publicKey=a.toRawBytes(!0)}return new HDKey(i)}catch{return this.deriveChild(t+1)}}sign(t){if(!this.privateKey)throw new Error("No privateKey set!");return bytes$1(t,32),secp256k1.sign(t,this.privKey).toCompactRawBytes()}verify(t,n){if(bytes$1(t,32),bytes$1(n,64),!this.publicKey)throw new Error("No publicKey set!");let r;try{r=secp256k1.Signature.fromCompact(n)}catch{return!1}return secp256k1.verify(r,t,this.publicKey)}wipePrivateData(){return this.privKey=void 0,this.privKeyBytes&&(this.privKeyBytes.fill(0),this.privKeyBytes=void 0),this}toJSON(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}}serialize(t,n){if(!this.chainCode)throw new Error("No chainCode set");return bytes$1(n,33),concatBytes(toU32(t),new Uint8Array([this.depth]),toU32(this.parentFingerprint),toU32(this.index),this.chainCode,n)}}/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */const u8a=e=>e instanceof Uint8Array,u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE)throw new Error("Non little-endian hardware is not supported");function utf8ToBytes(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function toBytes(e){if(typeof e=="string"&&(e=utf8ToBytes(e)),!u8a(e))throw new Error("expected Uint8Array, got "+typeof e);return e}const isPlainObject=e=>Object.prototype.toString.call(e)==="[object Object]"&&e.constructor===Object;function checkOpts(e,t){if(t!==void 0&&(typeof t!="object"||!isPlainObject(t)))throw new Error("options must be object or undefined");return Object.assign(e,t)}function ensureBytes(e,t){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");if(e.length!==t)throw new Error(`Uint8Array length ${t} expected`)}function equalBytes(e,t){if(e.length!==t.length)throw new Error("equalBytes: Different size of Uint8Arrays");let n=!0;for(let r=0;r<e.length;r++)n&&(n=e[r]===t[r]);return n}function number(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function bool(e){if(typeof e!="boolean")throw new Error(`Expected boolean, not ${e}`)}function bytes(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 hash(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("hash must be wrapped by utils.wrapConstructor");number(e.outputLen),number(e.blockLen)}function exists(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 output(e,t){bytes(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const assert={number,bool,bytes,hash,exists,output},u8to16=(e,t)=>255&e[t++]|(255&e[t++])<<8;class Poly1305{constructor(t){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,ensureBytes(t=toBytes(t),32);const n=u8to16(t,0),r=u8to16(t,2),o=u8to16(t,4),s=u8to16(t,6),i=u8to16(t,8),a=u8to16(t,10),l=u8to16(t,12),c=u8to16(t,14);this.r[0]=8191&n,this.r[1]=8191&(n>>>13|r<<3),this.r[2]=7939&(r>>>10|o<<6),this.r[3]=8191&(o>>>7|s<<9),this.r[4]=255&(s>>>4|i<<12),this.r[5]=i>>>1&8190,this.r[6]=8191&(i>>>14|a<<2),this.r[7]=8065&(a>>>11|l<<5),this.r[8]=8191&(l>>>8|c<<8),this.r[9]=c>>>5&127;for(let d=0;d<8;d++)this.pad[d]=u8to16(t,16+2*d)}process(t,n,r=!1){const o=r?0:2048,{h:s,r:i}=this,a=i[0],l=i[1],c=i[2],d=i[3],p=i[4],g=i[5],v=i[6],x=i[7],b=i[8],C=i[9],_=u8to16(t,n+0),k=u8to16(t,n+2),$=u8to16(t,n+4),N=u8to16(t,n+6),T=u8to16(t,n+8),L=u8to16(t,n+10),B=u8to16(t,n+12),E=u8to16(t,n+14);let m=s[0]+(8191&_),y=s[1]+(8191&(_>>>13|k<<3)),S=s[2]+(8191&(k>>>10|$<<6)),R=s[3]+(8191&($>>>7|N<<9)),A=s[4]+(8191&(N>>>4|T<<12)),U=s[5]+(T>>>1&8191),I=s[6]+(8191&(T>>>14|L<<2)),M=s[7]+(8191&(L>>>11|B<<5)),P=s[8]+(8191&(B>>>8|E<<8)),D=s[9]+(E>>>5|o),O=0,j=O+m*a+y*(5*C)+S*(5*b)+R*(5*x)+A*(5*v);O=j>>>13,j&=8191,j+=U*(5*g)+I*(5*p)+M*(5*d)+P*(5*c)+D*(5*l),O+=j>>>13,j&=8191;let K=O+m*l+y*a+S*(5*C)+R*(5*b)+A*(5*x);O=K>>>13,K&=8191,K+=U*(5*v)+I*(5*g)+M*(5*p)+P*(5*d)+D*(5*c),O+=K>>>13,K&=8191;let F=O+m*c+y*l+S*a+R*(5*C)+A*(5*b);O=F>>>13,F&=8191,F+=U*(5*x)+I*(5*v)+M*(5*g)+P*(5*p)+D*(5*d),O+=F>>>13,F&=8191;let G=O+m*d+y*c+S*l+R*a+A*(5*C);O=G>>>13,G&=8191,G+=U*(5*b)+I*(5*x)+M*(5*v)+P*(5*g)+D*(5*p),O+=G>>>13,G&=8191;let Y=O+m*p+y*d+S*c+R*l+A*a;O=Y>>>13,Y&=8191,Y+=U*(5*C)+I*(5*b)+M*(5*x)+P*(5*v)+D*(5*g),O+=Y>>>13,Y&=8191;let q=O+m*g+y*p+S*d+R*c+A*l;O=q>>>13,q&=8191,q+=U*a+I*(5*C)+M*(5*b)+P*(5*x)+D*(5*v),O+=q>>>13,q&=8191;let V=O+m*v+y*g+S*p+R*d+A*c;O=V>>>13,V&=8191,V+=U*l+I*a+M*(5*C)+P*(5*b)+D*(5*x),O+=V>>>13,V&=8191;let Z=O+m*x+y*v+S*g+R*p+A*d;O=Z>>>13,Z&=8191,Z+=U*c+I*l+M*a+P*(5*C)+D*(5*b),O+=Z>>>13,Z&=8191;let J=O+m*b+y*x+S*v+R*g+A*p;O=J>>>13,J&=8191,J+=U*d+I*c+M*l+P*a+D*(5*C),O+=J>>>13,J&=8191;let X=O+m*C+y*b+S*x+R*v+A*g;O=X>>>13,X&=8191,X+=U*p+I*d+M*c+P*l+D*a,O+=X>>>13,X&=8191,O=(O<<2)+O|0,O=O+j|0,j=8191&O,O>>>=13,K+=O,s[0]=j,s[1]=K,s[2]=F,s[3]=G,s[4]=Y,s[5]=q,s[6]=V,s[7]=Z,s[8]=J,s[9]=X}finalize(){const{h:t,pad:n}=this,r=new Uint16Array(10);let o=t[1]>>>13;t[1]&=8191;for(let a=2;a<10;a++)t[a]+=o,o=t[a]>>>13,t[a]&=8191;t[0]+=5*o,o=t[0]>>>13,t[0]&=8191,t[1]+=o,o=t[1]>>>13,t[1]&=8191,t[2]+=o,r[0]=t[0]+5,o=r[0]>>>13,r[0]&=8191;for(let a=1;a<10;a++)r[a]=t[a]+o,o=r[a]>>>13,r[a]&=8191;r[9]-=8192;let s=(1^o)-1;for(let a=0;a<10;a++)r[a]&=s;s=~s;for(let a=0;a<10;a++)t[a]=t[a]&s|r[a];t[0]=65535&(t[0]|t[1]<<13),t[1]=65535&(t[1]>>>3|t[2]<<10),t[2]=65535&(t[2]>>>6|t[3]<<7),t[3]=65535&(t[3]>>>9|t[4]<<4),t[4]=65535&(t[4]>>>12|t[5]<<1|t[6]<<14),t[5]=65535&(t[6]>>>2|t[7]<<11),t[6]=65535&(t[7]>>>5|t[8]<<8),t[7]=65535&(t[8]>>>8|t[9]<<5);let i=t[0]+n[0];t[0]=65535&i;for(let a=1;a<8;a++)i=(t[a]+n[a]|0)+(i>>>16)|0,t[a]=65535&i}update(t){assert.exists(this);const{buffer:n,blockLen:r}=this,o=(t=toBytes(t)).length;for(let s=0;s<o;){const i=Math.min(r-this.pos,o-s);if(i!==r)n.set(t.subarray(s,s+i),this.pos),this.pos+=i,s+=i,this.pos===r&&(this.process(n,0,!1),this.pos=0);else for(;r<=o-s;s+=r)this.process(t,s)}return this}destroy(){this.h.fill(0),this.r.fill(0),this.buffer.fill(0),this.pad.fill(0)}digestInto(t){assert.exists(this),assert.output(t,this),this.finished=!0;const{buffer:n,h:r}=this;let{pos:o}=this;if(o){for(n[o++]=1;o<16;o++)n[o]=0;this.process(n,0,!0)}this.finalize();let s=0;for(let i=0;i<8;i++)t[s++]=r[i]>>>0,t[s++]=r[i]>>>8;return t}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}}function wrapConstructorWithKey(e){const t=(r,o)=>e(o).update(toBytes(r)).digest(),n=e(new Uint8Array(32));return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}wrapConstructorWithKey(e=>new Poly1305(e));const sigma16=utf8ToBytes("expand 16-byte k"),sigma32=utf8ToBytes("expand 32-byte k"),sigma16_32=u32(sigma16),sigma32_32=u32(sigma32),isAligned32=e=>!(e.byteOffset%4),salsaBasic=e=>{const{core:t,rounds:n,counterRight:r,counterLen:o,allow128bitKeys:s,extendNonceFn:i,blockLen:a}=checkOpts({rounds:20,counterRight:!1,counterLen:8,allow128bitKeys:!0,blockLen:64},e);assert.number(o),assert.number(n),assert.number(a),assert.bool(r),assert.bool(s);const l=a/4;if(a%4!=0)throw new Error("Salsa/ChaCha: blockLen must be aligned to 4 bytes");return(c,d,p,g,v=0)=>{if(assert.bytes(c),assert.bytes(d),assert.bytes(p),g||(g=new Uint8Array(p.length)),assert.bytes(g),assert.number(v),v<0||v>=2**32-1)throw new Error("Salsa/ChaCha: counter overflow");if(g.length<p.length)throw new Error(`Salsa/ChaCha: output (${g.length}) is shorter than data (${p.length})`);const x=[];let b,C;if(c.length===32)b=c,C=sigma32_32;else{if(c.length!==16||!s)throw new Error(`Salsa/ChaCha: invalid 32-byte key, got length=${c.length}`);b=new Uint8Array(32),b.set(c),b.set(c,16),C=sigma16_32,x.push(b)}if(i){if(d.length<=16)throw new Error("Salsa/ChaCha: extended nonce must be bigger than 16 bytes");b=i(C,b,d.subarray(0,16),new Uint8Array(32)),x.push(b),d=d.subarray(16)}const _=16-o;if(d.length!==_)throw new Error(`Salsa/ChaCha: nonce must be ${_} or 16 bytes`);if(_!==12){const m=new Uint8Array(12);m.set(d,r?0:12-d.length),x.push(d=m)}const k=new Uint8Array(a),$=u32(k),N=u32(b),T=u32(d),L=isAligned32(p)&&u32(p),B=isAligned32(g)&&u32(g);x.push($);const E=p.length;for(let m=0,y=v;m<E;y++){if(t(C,N,T,$,y,n),y>=2**32-1)throw new Error("Salsa/ChaCha: counter overflow");const S=Math.min(a,E-m);if(S===a&&B&&L){const R=m/4;if(m%4!=0)throw new Error("Salsa/ChaCha: invalid block position");for(let A=0;A<l;A++)B[R+A]=L[R+A]^$[A];m+=a}else{for(let R=0;R<S;R++)g[m+R]=p[m+R]^k[R];m+=S}}for(let m=0;m<x.length;m++)x[m].fill(0);return g}},rotl=(e,t)=>e<<t|e>>>32-t;function chachaCore(e,t,n,r,o,s=20){let i=e[0],a=e[1],l=e[2],c=e[3],d=t[0],p=t[1],g=t[2],v=t[3],x=t[4],b=t[5],C=t[6],_=t[7],k=o,$=n[0],N=n[1],T=n[2],L=i,B=a,E=l,m=c,y=d,S=p,R=g,A=v,U=x,I=b,M=C,P=_,D=k,O=$,j=N,K=T;for(let G=0;G<s;G+=2)L=L+y|0,D=rotl(D^L,16),U=U+D|0,y=rotl(y^U,12),L=L+y|0,D=rotl(D^L,8),U=U+D|0,y=rotl(y^U,7),B=B+S|0,O=rotl(O^B,16),I=I+O|0,S=rotl(S^I,12),B=B+S|0,O=rotl(O^B,8),I=I+O|0,S=rotl(S^I,7),E=E+R|0,j=rotl(j^E,16),M=M+j|0,R=rotl(R^M,12),E=E+R|0,j=rotl(j^E,8),M=M+j|0,R=rotl(R^M,7),m=m+A|0,K=rotl(K^m,16),P=P+K|0,A=rotl(A^P,12),m=m+A|0,K=rotl(K^m,8),P=P+K|0,A=rotl(A^P,7),L=L+S|0,K=rotl(K^L,16),M=M+K|0,S=rotl(S^M,12),L=L+S|0,K=rotl(K^L,8),M=M+K|0,S=rotl(S^M,7),B=B+R|0,D=rotl(D^B,16),P=P+D|0,R=rotl(R^P,12),B=B+R|0,D=rotl(D^B,8),P=P+D|0,R=rotl(R^P,7),E=E+A|0,O=rotl(O^E,16),U=U+O|0,A=rotl(A^U,12),E=E+A|0,O=rotl(O^E,8),U=U+O|0,A=rotl(A^U,7),m=m+y|0,j=rotl(j^m,16),I=I+j|0,y=rotl(y^I,12),m=m+y|0,j=rotl(j^m,8),I=I+j|0,y=rotl(y^I,7);let F=0;r[F++]=i+L|0,r[F++]=a+B|0,r[F++]=l+E|0,r[F++]=c+m|0,r[F++]=d+y|0,r[F++]=p+S|0,r[F++]=g+R|0,r[F++]=v+A|0,r[F++]=x+U|0,r[F++]=b+I|0,r[F++]=C+M|0,r[F++]=_+P|0,r[F++]=k+D|0,r[F++]=$+O|0,r[F++]=N+j|0,r[F++]=T+K|0}const chacha20=salsaBasic({core:chachaCore,counterRight:!1,counterLen:4,allow128bitKeys:!1});class HMAC extends Hash$1{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,assert$2.hash(t);const r=toBytes$2(n);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,s=new Uint8Array(o);s.set(r.length>o?t.create().update(r).digest():r);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),s.fill(0)}update(t){return assert$2.exists(this),this.iHash.update(t),this}digestInto(t){assert$2.exists(this),assert$2.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:n,iHash:r,finished:o,destroyed:s,blockLen:i,outputLen:a}=this;return t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=a,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const hmac=(e,t,n)=>new HMAC(e,t).update(n).digest();function extract$1(e,t,n){return assert$2.hash(e),n===void 0&&(n=new Uint8Array(e.outputLen)),hmac(e,toBytes$2(n),toBytes$2(t))}hmac.create=(e,t)=>new HMAC(e,t);const HKDF_COUNTER$1=new Uint8Array([0]),EMPTY_BUFFER$1=new Uint8Array;function expand$1(e,t,n,r=32){if(assert$2.hash(e),assert$2.number(r),r>255*e.outputLen)throw new Error("Length should be <= 255*HashLen");const o=Math.ceil(r/e.outputLen),s=new Uint8Array(o*e.outputLen),i=hmac.create(e,t),a=i._cloneInto(),l=new Uint8Array(i.outputLen);for(let c=0;c<o;c++)HKDF_COUNTER$1[0]=c+1,a.update(c===0?EMPTY_BUFFER$1:l).update(n).update(HKDF_COUNTER$1).digestInto(l),s.set(l,e.outputLen*c),i._cloneInto(a);return i.destroy(),a.destroy(),l.fill(0),HKDF_COUNTER$1.fill(0),s.slice(0,r)}const hkdf=(e,t,n,r,o)=>expand$1(e,extract$1(e,t,n),r,o);var __defProp=Object.defineProperty,__export=(e,t)=>{for(var n in t)__defProp(e,n,{get:t[n],enumerable:!0})};function generatePrivateKey(){return bytesToHex$1(schnorr.utils.randomPrivateKey())}function getPublicKey(e){return bytesToHex$1(schnorr.getPublicKey(e))}var utils_exports={};__export(utils_exports,{MessageNode:()=>MessageNode,MessageQueue:()=>MessageQueue,insertEventIntoAscendingList:()=>insertEventIntoAscendingList,insertEventIntoDescendingList:()=>insertEventIntoDescendingList,normalizeURL:()=>normalizeURL,utf8Decoder:()=>utf8Decoder,utf8Encoder:()=>utf8Encoder});var utf8Decoder=new TextDecoder("utf-8"),utf8Encoder=new TextEncoder;function normalizeURL(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 insertEventIntoDescendingList(e,t){var i;let n,r=0,o=e.length-1,s=r;if(o<0)s=0;else if(t.created_at<e[o].created_at)s=o+1;else if(t.created_at>=e[r].created_at)s=r;else for(;;){if(o<=r+1){s=o;break}if(n=Math.floor(r+(o-r)/2),e[n].created_at>t.created_at)r=n;else{if(!(e[n].created_at<t.created_at)){s=n;break}o=n}}return((i=e[s])==null?void 0:i.id)!==t.id?[...e.slice(0,s),t,...e.slice(s)]:e}function insertEventIntoAscendingList(e,t){var i;let n,r=0,o=e.length-1,s=r;if(o<0)s=0;else if(t.created_at>e[o].created_at)s=o+1;else if(t.created_at<=e[r].created_at)s=r;else for(;;){if(o<=r+1){s=o;break}if(n=Math.floor(r+(o-r)/2),e[n].created_at<t.created_at)r=n;else{if(!(e[n].created_at>t.created_at)){s=n;break}o=n}}return((i=e[s])==null?void 0:i.id)!==t.id?[...e.slice(0,s),t,...e.slice(s)]:e}var MessageNode=class{constructor(e){w(this,"_value");w(this,"_next");this._value=e,this._next=null}get value(){return this._value}set value(e){this._value=e}get next(){return this._next}set next(e){this._next=e}},MessageQueue=class{constructor(){w(this,"_first");w(this,"_last");w(this,"_size");this._first=null,this._last=null,this._size=0}get first(){return this._first}set first(e){this._first=e}get last(){return this._last}set last(e){this._last=e}get size(){return this._size}set size(e){this._size=e}enqueue(e){const t=new MessageNode(e);return this._size!==0&&this._last?(this._last.next=t,this._last=t):(this._first=t,this._last=t),this._size++,!0}dequeue(){if(this._size===0||!this._first)return null;let e=this._first;return this._first=e.next,e.next=null,this._size--,e.value}},verifiedSymbol=Symbol("verified");function getBlankEvent(e=255){return{kind:e,content:"",tags:[],created_at:0}}function finishEvent(e,t){const n=e;return n.pubkey=getPublicKey(t),n.id=getEventHash(n),n.sig=getSignature(n,t),n[verifiedSymbol]=!0,n}function serializeEvent(e){if(!validateEvent(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 getEventHash(e){return bytesToHex$1(sha256$1(utf8Encoder.encode(serializeEvent(e))))}var isRecord=e=>e instanceof Object;function validateEvent(e){if(!isRecord(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 n=e.tags[t];if(!Array.isArray(n))return!1;for(let r=0;r<n.length;r++)if(typeof n[r]=="object")return!1}return!0}function verifySignature(e){if(typeof e[verifiedSymbol]=="boolean")return e[verifiedSymbol];const t=getEventHash(e);if(t!==e.id)return e[verifiedSymbol]=!1;try{return e[verifiedSymbol]=schnorr.verify(e.sig,t,e.pubkey)}catch{return e[verifiedSymbol]=!1}}function getSignature(e,t){return bytesToHex$1(schnorr.sign(getEventHash(e),t))}function matchFilter(e,t){if(e.ids&&e.ids.indexOf(t.id)===-1&&!e.ids.some(n=>t.id.startsWith(n))||e.kinds&&e.kinds.indexOf(t.kind)===-1||e.authors&&e.authors.indexOf(t.pubkey)===-1&&!e.authors.some(n=>t.pubkey.startsWith(n)))return!1;for(let n in e)if(n[0]==="#"){let r=e[`#${n.slice(1)}`];if(r&&!t.tags.find(([o,s])=>o===n.slice(1)&&r.indexOf(s)!==-1))return!1}return!(e.since&&t.created_at<e.since)&&!(e.until&&t.created_at>e.until)}function matchFilters(e,t){for(let n=0;n<e.length;n++)if(matchFilter(e[n],t))return!0;return!1}var fakejson_exports={};function getHex64(e,t){let n=t.length+3,r=e.indexOf(`"${t}":`)+n,o=e.slice(r).indexOf('"')+r+1;return e.slice(o,o+64)}function getInt(e,t){let n=t.length,r=e.indexOf(`"${t}":`)+n+3,o=e.slice(r),s=Math.min(o.indexOf(","),o.indexOf("}"));return parseInt(o.slice(0,s),10)}function getSubscriptionId(e){let t=e.slice(0,22).indexOf('"EVENT"');if(t===-1)return null;let n=e.slice(t+7+1).indexOf('"');if(n===-1)return null;let r=t+7+1+n,o=e.slice(r+1,80).indexOf('"');if(o===-1)return null;let s=r+1+o;return e.slice(r+1,s)}function matchEventId(e,t){return t===getHex64(e,"id")}function matchEventPubkey(e,t){return t===getHex64(e,"pubkey")}function matchEventKind(e,t){return t===getInt(e,"kind")}__export(fakejson_exports,{getHex64:()=>getHex64,getInt:()=>getInt,getSubscriptionId:()=>getSubscriptionId,matchEventId:()=>matchEventId,matchEventKind:()=>matchEventKind,matchEventPubkey:()=>matchEventPubkey});var newListeners=()=>({connect:[],disconnect:[],error:[],notice:[],auth:[]});function relayInit(e,t={}){let{listTimeout:n=3e3,getTimeout:r=3e3,countTimeout:o=3e3}=t;var s,i,a={},l=newListeners(),c={},d={};function p(){return(s==null?void 0:s.readyState)===1}async function g(b){let C=JSON.stringify(b);if(p()||(await new Promise(_=>setTimeout(_,1e3)),p()))try{s.send(C)}catch(_){console.log(_)}}const v=(b,{verb:C="REQ",skipVerification:_=!1,alreadyHaveEvent:k=null,id:$=Math.random().toString().slice(2)}={})=>{let N=$;a[N]={id:N,filters:b,skipVerification:_,alreadyHaveEvent:k},g([C,N,...b]);let T={sub:(L,B={})=>v(L||b,{skipVerification:B.skipVerification||_,alreadyHaveEvent:B.alreadyHaveEvent||k,id:N}),unsub:()=>{delete a[N],delete c[N],g(["CLOSE",N])},on:(L,B)=>{c[N]=c[N]||{event:[],count:[],eose:[]},c[N][L].push(B)},off:(L,B)=>{let E=c[N],m=E[L].indexOf(B);m>=0&&E[L].splice(m,1)},get events(){return eventsGenerator(T)}};return T};function x(b,C){return new Promise((_,k)=>{if(!b.id)return void k(new Error(`event ${b} has no id`));let $=b.id;g([C,b]),d[$]={resolve:_,reject:k}})}return{url:e,sub:v,on:(b,C)=>{l[b].push(C),b==="connect"&&(s==null?void 0:s.readyState)===1&&C()},off:(b,C)=>{let _=l[b].indexOf(C);_!==-1&&l[b].splice(_,1)},list:(b,C)=>new Promise(_=>{let k=v(b,C),$=[],N=setTimeout(()=>{k.unsub(),_($)},n);k.on("eose",()=>{k.unsub(),clearTimeout(N),_($)}),k.on("event",T=>{$.push(T)})}),get:(b,C)=>new Promise(_=>{let k=v([b],C),$=setTimeout(()=>{k.unsub(),_(null)},r);k.on("event",N=>{k.unsub(),clearTimeout($),_(N)})}),count:b=>new Promise(C=>{let _=v(b,{...v,verb:"COUNT"}),k=setTimeout(()=>{_.unsub(),C(null)},o);_.on("count",$=>{_.unsub(),clearTimeout(k),C($)})}),async publish(b){await x(b,"EVENT")},async auth(b){await x(b,"AUTH")},connect:async function(){p()||await async function(){return i||(i=new Promise((b,C)=>{try{s=new WebSocket(e)}catch(N){C(N)}s.onopen=()=>{l.connect.forEach(N=>N()),b()},s.onerror=()=>{i=void 0,l.error.forEach(N=>N()),C()},s.onclose=async()=>{i=void 0,l.disconnect.forEach(N=>N())};let _,k=new MessageQueue;function $(){var L,B,E;if(k.size===0)return clearInterval(_),void(_=null);var N=k.dequeue();if(!N)return;let T=getSubscriptionId(N);if(T){let m=a[T];if(m&&m.alreadyHaveEvent&&m.alreadyHaveEvent(getHex64(N,"id"),e))return}try{let m=JSON.parse(N);switch(m[0]){case"EVENT":{let A=m[1],U=m[2];return void(validateEvent(U)&&a[A]&&(a[A].skipVerification||verifySignature(U))&&matchFilters(a[A].filters,U)&&(a[A],(((L=c[A])==null?void 0:L.event)||[]).forEach(I=>I(U))))}case"COUNT":let y=m[1],S=m[2];return void(a[y]&&(((B=c[y])==null?void 0:B.count)||[]).forEach(A=>A(S)));case"EOSE":{let A=m[1];return void(A in c&&(c[A].eose.forEach(U=>U()),c[A].eose=[]))}case"OK":{let A=m[1],U=m[2],I=m[3]||"";if(A in d){let{resolve:M,reject:P}=d[A];U?M(null):P(new Error(I))}return}case"NOTICE":let R=m[1];return void l.notice.forEach(A=>A(R));case"AUTH":{let A=m[1];return void((E=l.auth)==null?void 0:E.forEach(U=>U(A)))}}}catch{return}}s.onmessage=N=>{k.enqueue(N.data),_||(_=setInterval($,0))}}),i)}()},close(){l=newListeners(),c={},d={},(s==null?void 0:s.readyState)===WebSocket.OPEN&&s.close()},get status(){return(s==null?void 0:s.readyState)??3}}}async function*eventsGenerator(e){let t;const n=[],r=o=>{t?(t(o),t=void 0):n.push(o)};e.on("event",r);try{for(;;)n.length>0?yield n.shift():yield await new Promise(s=>{t=s})}finally{e.off("event",r)}}var nip19_exports={};__export(nip19_exports,{BECH32_REGEX:()=>BECH32_REGEX,decode:()=>decode,naddrEncode:()=>naddrEncode,neventEncode:()=>neventEncode,noteEncode:()=>noteEncode,nprofileEncode:()=>nprofileEncode,npubEncode:()=>npubEncode,nrelayEncode:()=>nrelayEncode,nsecEncode:()=>nsecEncode});var Bech32MaxSize=5e3,BECH32_REGEX=/[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/;function integerToUint8Array(e){const t=new Uint8Array(4);return t[0]=e>>24&255,t[1]=e>>16&255,t[2]=e>>8&255,t[3]=255&e,t}function decode(e){var o,s,i,a,l,c,d,p;let{prefix:t,words:n}=bech32$1.decode(e,Bech32MaxSize),r=new Uint8Array(bech32$1.fromWords(n));switch(t){case"nprofile":{let g=parseTLV(r);if(!((o=g[0])!=null&&o[0]))throw new Error("missing TLV 0 for nprofile");if(g[0][0].length!==32)throw new Error("TLV 0 should be 32 bytes");return{type:"nprofile",data:{pubkey:bytesToHex$1(g[0][0]),relays:g[1]?g[1].map(v=>utf8Decoder.decode(v)):[]}}}case"nevent":{let g=parseTLV(r);if(!((s=g[0])!=null&&s[0]))throw new Error("missing TLV 0 for nevent");if(g[0][0].length!==32)throw new Error("TLV 0 should be 32 bytes");if(g[2]&&g[2][0].length!==32)throw new Error("TLV 2 should be 32 bytes");if(g[3]&&g[3][0].length!==4)throw new Error("TLV 3 should be 4 bytes");return{type:"nevent",data:{id:bytesToHex$1(g[0][0]),relays:g[1]?g[1].map(v=>utf8Decoder.decode(v)):[],author:(i=g[2])!=null&&i[0]?bytesToHex$1(g[2][0]):void 0,kind:(a=g[3])!=null&&a[0]?parseInt(bytesToHex$1(g[3][0]),16):void 0}}}case"naddr":{let g=parseTLV(r);if(!((l=g[0])!=null&&l[0]))throw new Error("missing TLV 0 for naddr");if(!((c=g[2])!=null&&c[0]))throw new Error("missing TLV 2 for naddr");if(g[2][0].length!==32)throw new Error("TLV 2 should be 32 bytes");if(!((d=g[3])!=null&&d[0]))throw new Error("missing TLV 3 for naddr");if(g[3][0].length!==4)throw new Error("TLV 3 should be 4 bytes");return{type:"naddr",data:{identifier:utf8Decoder.decode(g[0][0]),pubkey:bytesToHex$1(g[2][0]),kind:parseInt(bytesToHex$1(g[3][0]),16),relays:g[1]?g[1].map(v=>utf8Decoder.decode(v)):[]}}}case"nrelay":{let g=parseTLV(r);if(!((p=g[0])!=null&&p[0]))throw new Error("missing TLV 0 for nrelay");return{type:"nrelay",data:utf8Decoder.decode(g[0][0])}}case"nsec":case"npub":case"note":return{type:t,data:bytesToHex$1(r)};default:throw new Error(`unknown prefix ${t}`)}}function parseTLV(e){let t={},n=e;for(;n.length>0;){let r=n[0],o=n[1];if(!o)throw new Error(`malformed TLV ${r}`);let s=n.slice(2,2+o);if(n=n.slice(2+o),s.length<o)throw new Error(`not enough data to read on TLV ${r}`);t[r]=t[r]||[],t[r].push(s)}return t}function nsecEncode(e){return encodeBytes("nsec",e)}function npubEncode(e){return encodeBytes("npub",e)}function noteEncode(e){return encodeBytes("note",e)}function encodeBech32(e,t){let n=bech32$1.toWords(t);return bech32$1.encode(e,n,Bech32MaxSize)}function encodeBytes(e,t){return encodeBech32(e,hexToBytes$1(t))}function nprofileEncode(e){return encodeBech32("nprofile",encodeTLV({0:[hexToBytes$1(e.pubkey)],1:(e.relays||[]).map(t=>utf8Encoder.encode(t))}))}function neventEncode(e){let t;return e.kind!=null&&(t=integerToUint8Array(e.kind)),encodeBech32("nevent",encodeTLV({0:[hexToBytes$1(e.id)],1:(e.relays||[]).map(n=>utf8Encoder.encode(n)),2:e.author?[hexToBytes$1(e.author)]:[],3:t?[new Uint8Array(t)]:[]}))}function naddrEncode(e){let t=new ArrayBuffer(4);return new DataView(t).setUint32(0,e.kind,!1),encodeBech32("naddr",encodeTLV({0:[utf8Encoder.encode(e.identifier)],1:(e.relays||[]).map(n=>utf8Encoder.encode(n)),2:[hexToBytes$1(e.pubkey)],3:[new Uint8Array(t)]}))}function nrelayEncode(e){return encodeBech32("nrelay",encodeTLV({0:[utf8Encoder.encode(e)]}))}function encodeTLV(e){let t=[];return Object.entries(e).forEach(([n,r])=>{r.forEach(o=>{let s=new Uint8Array(o.length+2);s.set([parseInt(n)],0),s.set([o.length],1),s.set(o,2),t.push(s)})}),concatBytes$1(...t)}var nip04_exports={};async function encrypt$1(e,t,n){const r=getNormalizedX(secp256k1.getSharedSecret(e,"02"+t));let o=Uint8Array.from(randomBytes$1(16)),s=utf8Encoder.encode(n),i=await crypto.subtle.importKey("raw",r,{name:"AES-CBC"},!1,["encrypt"]),a=await crypto.subtle.encrypt({name:"AES-CBC",iv:o},i,s);return`${base64$1.encode(new Uint8Array(a))}?iv=${base64$1.encode(new Uint8Array(o.buffer))}`}async function decrypt$1(e,t,n){let[r,o]=n.split("?iv="),s=getNormalizedX(secp256k1.getSharedSecret(e,"02"+t)),i=await crypto.subtle.importKey("raw",s,{name:"AES-CBC"},!1,["decrypt"]),a=base64$1.decode(r),l=base64$1.decode(o),c=await crypto.subtle.decrypt({name:"AES-CBC",iv:l},i,a);return utf8Decoder.decode(c)}function getNormalizedX(e){return e.slice(1,33)}__export(nip04_exports,{decrypt:()=>decrypt$1,encrypt:()=>encrypt$1}),typeof crypto<"u"&&!crypto.subtle&&crypto.webcrypto&&(crypto.subtle=crypto.webcrypto.subtle);var nip05_exports={};__export(nip05_exports,{NIP05_REGEX:()=>NIP05_REGEX$1,queryProfile:()=>queryProfile,searchDomain:()=>searchDomain,useFetchImplementation:()=>useFetchImplementation});var NIP05_REGEX$1=/^(?:([\w.+-]+)@)?([\w.-]+)$/,_fetch;try{_fetch=fetch}catch{}function useFetchImplementation(e){_fetch=e}async function searchDomain(e,t=""){try{return(await(await _fetch(`https://${e}/.well-known/nostr.json?name=${t}`)).json()).names}catch{return{}}}async function queryProfile(e){const t=e.match(NIP05_REGEX$1);if(!t)return null;const[n,r="_",o]=t;try{const s=await _fetch(`https://${o}/.well-known/nostr.json?name=${r}`),{names:i,relays:a}=parseNIP05Result$1(await s.json()),l=i[r];return l?{pubkey:l,relays:a==null?void 0:a[l]}:null}catch{return null}}function parseNIP05Result$1(e){const t={names:{}};for(const[n,r]of Object.entries(e.names))typeof n=="string"&&typeof r=="string"&&(t.names[n]=r);if(e.relays){t.relays={};for(const[n,r]of Object.entries(e.relays))typeof n=="string"&&Array.isArray(r)&&(t.relays[n]=r.filter(o=>typeof o=="string"))}return t}var nip06_exports={};function privateKeyFromSeedWords(e,t){let n=HDKey.fromMasterSeed(mnemonicToSeedSync(e,t)).derive("m/44'/1237'/0'/0/0").privateKey;if(!n)throw new Error("could not derive private key");return bytesToHex$1(n)}function generateSeedWords(){return generateMnemonic(wordlist)}function validateWords(e){return validateMnemonic(e,wordlist)}__export(nip06_exports,{generateSeedWords:()=>generateSeedWords,privateKeyFromSeedWords:()=>privateKeyFromSeedWords,validateWords:()=>validateWords});var nip10_exports={};function parse(e){const t={reply:void 0,root:void 0,mentions:[],profiles:[]},n=[];for(const r of e.tags)r[0]==="e"&&r[1]&&n.push(r),r[0]==="p"&&r[1]&&t.profiles.push({pubkey:r[1],relays:r[2]?[r[2]]:[]});for(let r=0;r<n.length;r++){const o=n[r],[s,i,a,l]=o,c={id:i,relays:a?[a]:[]},d=r===0,p=r===n.length-1;l!=="root"?l!=="reply"?l!=="mention"?d?t.root=c:p?t.reply=c:t.mentions.push(c):t.mentions.push(c):t.reply=c:t.root=c}return t}__export(nip10_exports,{parse:()=>parse});var nip13_exports={};function getPow(e){let t=0;for(let n=0;n<e.length;n++){const r=parseInt(e[n],16);if(r!==0){t+=Math.clz32(r)-28;break}t+=4}return t}function minePow(e,t){let n=0;const r=e,o=["nonce",n.toString(),t.toString()];for(r.tags.push(o);;){const s=Math.floor(new Date().getTime()/1e3);if(s!==r.created_at&&(n=0,r.created_at=s),o[1]=(++n).toString(),r.id=getEventHash(r),getPow(r.id)>=t)break}return r}__export(nip13_exports,{getPow:()=>getPow,minePow:()=>minePow});var nip18_exports={};function finishRepostEvent(e,t,n,r){return finishEvent({kind:6,tags:[...e.tags??[],["e",t.id,n],["p",t.pubkey]],content:e.content===""?"":JSON.stringify(t),created_at:e.created_at},r)}function getRepostedEventPointer(e){if(e.kind!==6)return;let t,n;for(let r=e.tags.length-1;r>=0&&(t===void 0||n===void 0);r--){const o=e.tags[r];o.length>=2&&(o[0]==="e"&&t===void 0?t=o:o[0]==="p"&&n===void 0&&(n=o))}return t!==void 0?{id:t[1],relays:[t[2],n==null?void 0:n[2]].filter(r=>typeof r=="string"),author:n==null?void 0:n[1]}:void 0}function getRepostedEvent(e,{skipVerification:t}={}){const n=getRepostedEventPointer(e);if(n===void 0||e.content==="")return;let r;try{r=JSON.parse(e.content)}catch{return}return r.id===n.id&&(t||verifySignature(r))?r:void 0}__export(nip18_exports,{finishRepostEvent:()=>finishRepostEvent,getRepostedEvent:()=>getRepostedEvent,getRepostedEventPointer:()=>getRepostedEventPointer});var nip21_exports={};__export(nip21_exports,{NOSTR_URI_REGEX:()=>NOSTR_URI_REGEX,parse:()=>parse2,test:()=>test});var NOSTR_URI_REGEX=new RegExp(`nostr:(${BECH32_REGEX.source})`);function test(e){return typeof e=="string"&&new RegExp(`^${NOSTR_URI_REGEX.source}$`).test(e)}function parse2(e){const t=e.match(new RegExp(`^${NOSTR_URI_REGEX.source}$`));if(!t)throw new Error(`Invalid Nostr URI: ${e}`);return{uri:t[0],value:t[1],decoded:decode(t[1])}}var nip25_exports={};function finishReactionEvent(e,t,n){const r=t.tags.filter(o=>o.length>=2&&(o[0]==="e"||o[0]==="p"));return finishEvent({...e,kind:7,tags:[...e.tags??[],...r,["e",t.id],["p",t.pubkey]],content:e.content??"+"},n)}function getReactedEventPointer(e){if(e.kind!==7)return;let t,n;for(let r=e.tags.length-1;r>=0&&(t===void 0||n===void 0);r--){const o=e.tags[r];o.length>=2&&(o[0]==="e"&&t===void 0?t=o:o[0]==="p"&&n===void 0&&(n=o))}return t!==void 0&&n!==void 0?{id:t[1],relays:[t[2],n[2]].filter(r=>r!==void 0),author:n[1]}:void 0}__export(nip25_exports,{finishReactionEvent:()=>finishReactionEvent,getReactedEventPointer:()=>getReactedEventPointer});var nip26_exports={};function createDelegation(e,t){let n=[];(t.kind||-1)>=0&&n.push(`kind=${t.kind}`),t.until&&n.push(`created_at<${t.until}`),t.since&&n.push(`created_at>${t.since}`);let r=n.join("&");if(r==="")throw new Error("refusing to create a delegation without any conditions");let o=sha256$1(utf8Encoder.encode(`nostr:delegation:${t.pubkey}:${r}`)),s=bytesToHex$1(schnorr.sign(o,e));return{from:getPublicKey(e),to:t.pubkey,cond:r,sig:s}}function getDelegator(e){let t=e.tags.find(a=>a[0]==="delegation"&&a.length>=4);if(!t)return null;let n=t[1],r=t[2],o=t[3],s=r.split("&");for(let a=0;a<s.length;a++){let[l,c,d]=s[a].split(/\b/);if((l!=="kind"||c!=="="||e.kind!==parseInt(d))&&!(l==="created_at"&&c==="<"&&e.created_at<parseInt(d)||l==="created_at"&&c===">"&&e.created_at>parseInt(d)))return null}let i=sha256$1(utf8Encoder.encode(`nostr:delegation:${e.pubkey}:${r}`));return schnorr.verify(o,i,n)?n:null}__export(nip26_exports,{createDelegation:()=>createDelegation,getDelegator:()=>getDelegator});var nip27_exports={};__export(nip27_exports,{matchAll:()=>matchAll,regex:()=>regex,replaceAll:()=>replaceAll});var regex=()=>new RegExp(`\\b${NOSTR_URI_REGEX.source}\\b`,"g");function*matchAll(e){const t=e.matchAll(regex());for(const n of t)try{const[r,o]=n;yield{uri:r,value:o,decoded:decode(o),start:n.index,end:n.index+r.length}}catch{}}function replaceAll(e,t){return e.replaceAll(regex(),(n,r)=>t({uri:n,value:r,decoded:decode(r)}))}var nip28_exports={};__export(nip28_exports,{channelCreateEvent:()=>channelCreateEvent,channelHideMessageEvent:()=>channelHideMessageEvent,channelMessageEvent:()=>channelMessageEvent,channelMetadataEvent:()=>channelMetadataEvent,channelMuteUserEvent:()=>channelMuteUserEvent});var channelCreateEvent=(e,t)=>{let n;if(typeof e.content=="object")n=JSON.stringify(e.content);else{if(typeof e.content!="string")return;n=e.content}return finishEvent({kind:40,tags:[...e.tags??[]],content:n,created_at:e.created_at},t)},channelMetadataEvent=(e,t)=>{let n;if(typeof e.content=="object")n=JSON.stringify(e.content);else{if(typeof e.content!="string")return;n=e.content}return finishEvent({kind:41,tags:[["e",e.channel_create_event_id],...e.tags??[]],content:n,created_at:e.created_at},t)},channelMessageEvent=(e,t)=>{const n=[["e",e.channel_create_event_id,e.relay_url,"root"]];return e.reply_to_channel_message_event_id&&n.push(["e",e.reply_to_channel_message_event_id,e.relay_url,"reply"]),finishEvent({kind:42,tags:[...n,...e.tags??[]],content:e.content,created_at:e.created_at},t)},channelHideMessageEvent=(e,t)=>{let n;if(typeof e.content=="object")n=JSON.stringify(e.content);else{if(typeof e.content!="string")return;n=e.content}return finishEvent({kind:43,tags:[["e",e.channel_message_event_id],...e.tags??[]],content:n,created_at:e.created_at},t)},channelMuteUserEvent=(e,t)=>{let n;if(typeof e.content=="object")n=JSON.stringify(e.content);else{if(typeof e.content!="string")return;n=e.content}return finishEvent({kind:44,tags:[["p",e.pubkey_to_mute],...e.tags??[]],content:n,created_at:e.created_at},t)},nip39_exports={},_fetch2;__export(nip39_exports,{useFetchImplementation:()=>useFetchImplementation2,validateGithub:()=>validateGithub});try{_fetch2=fetch}catch{}function useFetchImplementation2(e){_fetch2=e}async function validateGithub(e,t,n){try{return await(await _fetch2(`https://gist.github.com/${t}/${n}/raw`)).text()===`Verifying that I control the following Nostr public key: ${e}`}catch{return!1}}var nip42_exports={};__export(nip42_exports,{authenticate:()=>authenticate});var authenticate=async({challenge:e,relay:t,sign:n})=>{const r={kind:22242,created_at:Math.floor(Date.now()/1e3),tags:[["relay",t.url],["challenge",e]],content:""};return t.auth(await n(r))},nip44_exports={};__export(nip44_exports,{decrypt:()=>decrypt2,encrypt:()=>encrypt2,utils:()=>utils});var utils={v2:{maxPlaintextSize:65408,minCiphertextSize:100,maxCiphertextSize:102400,getConversationKey:(e,t)=>secp256k1.getSharedSecret(e,"02"+t).subarray(1,33),getMessageKeys(e,t){const n=hkdf(sha256$1,e,t,"nip44-v2",76);return{encryption:n.subarray(0,32),nonce:n.subarray(32,44),auth:n.subarray(44,76)}},calcPadding(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("expected positive integer");if(e<=32)return 32;const t=1<<Math.floor(Math.log2(e-1))+1,n=t<=256?32:t/8;return n*(Math.floor((e-1)/n)+1)},pad(e){const t=utf8Encoder.encode(e),n=t.length;if(n<1||n>=utils.v2.maxPlaintextSize)throw new Error("invalid plaintext length: must be between 1b and 64KB");const r=utils.v2.calcPadding(n),o=new Uint8Array(r-n),s=new Uint8Array(2);return new DataView(s.buffer).setUint16(0,n),concatBytes$1(s,t,o)},unpad(e){const t=new DataView(e.buffer).getUint16(0),n=e.subarray(2,2+t);if(t===0||n.length!==t||e.length!==2+utils.v2.calcPadding(t))throw new Error("invalid padding");return utf8Decoder.decode(n)}}};function encrypt2(e,t,n={}){const r=n.version??2;if(r!==2)throw new Error("unknown encryption version "+r);const o=n.salt??randomBytes$1(32);ensureBytes(o,32);const s=utils.v2.getMessageKeys(e,o),i=utils.v2.pad(t),a=chacha20(s.encryption,s.nonce,i),l=hmac(sha256$1,s.auth,a);return base64$1.encode(concatBytes$1(new Uint8Array([r]),o,a,l))}function decrypt2(e,t){const n=utils.v2;ensureBytes(e,32);const r=t.length;if(r<n.minCiphertextSize||r>=n.maxCiphertextSize)throw new Error("invalid ciphertext length: "+r);if(t[0]==="#")throw new Error("unknown encryption version");let o;try{o=base64$1.decode(t)}catch(p){throw new Error("invalid base64: "+p.message)}const s=o.subarray(0,1)[0];if(s!==2)throw new Error("unknown encryption version "+s);const i=o.subarray(1,33),a=o.subarray(33,-32),l=o.subarray(-32),c=n.getMessageKeys(e,i);if(!equalBytes(hmac(sha256$1,c.auth,a),l))throw new Error("invalid MAC");const d=chacha20(c.encryption,c.nonce,a);return n.unpad(d)}var nip47_exports={};function parseConnectionString(e){const{pathname:t,searchParams:n}=new URL(e),r=t,o=n.get("relay"),s=n.get("secret");if(!r||!o||!s)throw new Error("invalid connection string");return{pubkey:r,relay:o,secret:s}}async function makeNwcRequestEvent({pubkey:e,secret:t,invoice:n}){const r={method:"pay_invoice",params:{invoice:n}},o=await encrypt$1(t,e,JSON.stringify(r));return finishEvent({kind:23194,created_at:Math.round(Date.now()/1e3),content:o,tags:[["p",e]]},t)}__export(nip47_exports,{makeNwcRequestEvent:()=>makeNwcRequestEvent,parseConnectionString:()=>parseConnectionString});var nip57_exports={},_fetch3;__export(nip57_exports,{getZapEndpoint:()=>getZapEndpoint,makeZapReceipt:()=>makeZapReceipt,makeZapRequest:()=>makeZapRequest,useFetchImplementation:()=>useFetchImplementation3,validateZapRequest:()=>validateZapRequest});try{_fetch3=fetch}catch{}function useFetchImplementation3(e){_fetch3=e}async function getZapEndpoint(e){try{let t="",{lud06:n,lud16:r}=JSON.parse(e.content);if(n){let{words:i}=bech32$1.decode(n,1e3),a=bech32$1.fromWords(i);t=utf8Decoder.decode(a)}else{if(!r)return null;{let[i,a]=r.split("@");t=`https://${a}/.well-known/lnurlp/${i}`}}let o=await _fetch3(t),s=await o.json();if(s.allowsNostr&&s.nostrPubkey)return s.callback}catch{}return null}function makeZapRequest({profile:e,event:t,amount:n,relays:r,comment:o=""}){if(!n)throw new Error("amount not given");if(!e)throw new Error("profile not given");let s={kind:9734,created_at:Math.round(Date.now()/1e3),content:o,tags:[["p",e],["amount",n.toString()],["relays",...r]]};return t&&s.tags.push(["e",t]),s}function validateZapRequest(e){let t;try{t=JSON.parse(e)}catch{return"Invalid zap request JSON."}if(!validateEvent(t))return"Zap request is not a valid Nostr event.";if(!verifySignature(t))return"Invalid signature on zap request.";let n=t.tags.find(([o,s])=>o==="p"&&s);if(!n)return"Zap request doesn't have a 'p' tag.";if(!n[1].match(/^[a-f0-9]{64}$/))return"Zap request 'p' tag is not valid hex.";let r=t.tags.find(([o,s])=>o==="e"&&s);return r&&!r[1].match(/^[a-f0-9]{64}$/)?"Zap request 'e' tag is not valid hex.":t.tags.find(([o,s])=>o==="relays"&&s)?null:"Zap request doesn't have a 'relays' tag."}function makeZapReceipt({zapRequest:e,preimage:t,bolt11:n,paidAt:r}){let o=JSON.parse(e).tags.filter(([i])=>i==="e"||i==="p"||i==="a"),s={kind:9735,created_at:Math.round(r.getTime()/1e3),content:"",tags:[...o,["bolt11",n],["description",e]]};return t&&s.tags.push(["preimage",t]),s}var nip98_exports={};__export(nip98_exports,{getToken:()=>getToken,unpackEventFromToken:()=>unpackEventFromToken,validateEvent:()=>validateEvent2,validateToken:()=>validateToken});var _authorizationScheme="Nostr ";async function getToken(e,t,n,r=!1){if(!e||!t)throw new Error("Missing loginUrl or httpMethod");const o=getBlankEvent(27235);o.tags=[["u",e],["method",t]],o.created_at=Math.round(new Date().getTime()/1e3);const s=await n(o);return(r?_authorizationScheme:"")+base64$1.encode(utf8Encoder.encode(JSON.stringify(s)))}async function validateToken(e,t,n){const r=await unpackEventFromToken(e).catch(o=>{throw o});return await validateEvent2(r,t,n).catch(o=>{throw o})}async function unpackEventFromToken(e){if(!e)throw new Error("Missing token");e=e.replace(_authorizationScheme,"");const t=utf8Decoder.decode(base64$1.decode(e));if(!t||t.length===0||!t.startsWith("{"))throw new Error("Invalid token");return JSON.parse(t)}async function validateEvent2(e,t,n){if(!e)throw new Error("Invalid nostr event");if(!verifySignature(e))throw new Error("Invalid nostr event, signature invalid");if(e.kind!==27235)throw new Error("Invalid nostr event, kind invalid");if(!e.created_at)throw new Error("Invalid nostr event, created_at invalid");if(Math.round(new Date().getTime()/1e3)-e.created_at>60)throw new Error("Invalid nostr event, expired");const r=e.tags.find(s=>s[0]==="u");if((r==null?void 0:r.length)!==1&&(r==null?void 0:r[1])!==t)throw new Error("Invalid nostr event, url tag invalid");const o=e.tags.find(s=>s[0]==="method");if((o==null?void 0:o.length)!==1&&(o==null?void 0:o[1].toLowerCase())!==n.toLowerCase())throw new Error("Invalid nostr event, method tag invalid");return!0}var browser={exports:{}},ms,hasRequiredMs;function requireMs(){if(hasRequiredMs)return ms;hasRequiredMs=1;var e=1e3,t=60*e,n=60*t,r=24*n,o=7*r,s=365.25*r;function i(a,l,c,d){var p=l>=1.5*c;return Math.round(a/c)+" "+d+(p?"s":"")}return ms=function(a,l){l=l||{};var c=typeof a;if(c==="string"&&a.length>0)return function(d){if(!((d=String(d)).length>100)){var p=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(d);if(p){var g=parseFloat(p[1]);switch((p[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return g*s;case"weeks":case"week":case"w":return g*o;case"days":case"day":case"d":return g*r;case"hours":case"hour":case"hrs":case"hr":case"h":return g*n;case"minutes":case"minute":case"mins":case"min":case"m":return g*t;case"seconds":case"second":case"secs":case"sec":case"s":return g*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return g;default:return}}}}(a);if(c==="number"&&isFinite(a))return l.long?function(d){var p=Math.abs(d);return p>=r?i(d,p,r,"day"):p>=n?i(d,p,n,"hour"):p>=t?i(d,p,t,"minute"):p>=e?i(d,p,e,"second"):d+" ms"}(a):function(d){var p=Math.abs(d);return p>=r?Math.round(d/r)+"d":p>=n?Math.round(d/n)+"h":p>=t?Math.round(d/t)+"m":p>=e?Math.round(d/e)+"s":d+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))}}function setup(e){function t(o){let s,i,a,l=null;function c(...d){if(!c.enabled)return;const p=c,g=Number(new Date),v=g-(s||g);p.diff=v,p.prev=s,p.curr=g,s=g,d[0]=t.coerce(d[0]),typeof d[0]!="string"&&d.unshift("%O");let x=0;d[0]=d[0].replace(/%([a-zA-Z%])/g,(b,C)=>{if(b==="%%")return"%";x++;const _=t.formatters[C];if(typeof _=="function"){const k=d[x];b=_.call(p,k),d.splice(x,1),x--}return b}),t.formatArgs.call(p,d),(p.log||t.log).apply(p,d)}return c.namespace=o,c.useColors=t.useColors(),c.color=t.selectColor(o),c.extend=n,c.destroy=t.destroy,Object.defineProperty(c,"enabled",{enumerable:!0,configurable:!1,get:()=>l!==null?l:(i!==t.namespaces&&(i=t.namespaces,a=t.enabled(o)),a),set:d=>{l=d}}),typeof t.init=="function"&&t.init(c),c}function n(o,s){const i=t(this.namespace+(s===void 0?":":s)+o);return i.log=this.log,i}function r(o){return o.toString().substring(2,o.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(o){return o instanceof Error?o.stack||o.message:o},t.disable=function(){const o=[...t.names.map(r),...t.skips.map(r).map(s=>"-"+s)].join(",");return t.enable(""),o},t.enable=function(o){let s;t.save(o),t.namespaces=o,t.names=[],t.skips=[];const i=(typeof o=="string"?o:"").split(/[\s,]+/),a=i.length;for(s=0;s<a;s++)i[s]&&((o=i[s].replace(/\*/g,".*?"))[0]==="-"?t.skips.push(new RegExp("^"+o.slice(1)+"$")):t.names.push(new RegExp("^"+o+"$")))},t.enabled=function(o){if(o[o.length-1]==="*")return!0;let s,i;for(s=0,i=t.skips.length;s<i;s++)if(t.skips[s].test(o))return!1;for(s=0,i=t.names.length;s<i;s++)if(t.names[s].test(o))return!0;return!1},t.humanize=requireMs(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(o=>{t[o]=e[o]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(o){let s=0;for(let i=0;i<o.length;i++)s=(s<<5)-s+o.charCodeAt(i),s|=0;return t.colors[Math.abs(s)%t.colors.length]},t.enable(t.load()),t}var common=setup;(function(e,t){t.formatArgs=function(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const o="color: "+this.color;r.splice(1,0,o,"color: inherit");let s=0,i=0;r[0].replace(/%[a-zA-Z%]/g,a=>{a!=="%%"&&(s++,a==="%c"&&(i=s))}),r.splice(i,0,o)},t.save=function(r){try{r?t.storage.setItem("debug",r):t.storage.removeItem("debug")}catch{}},t.load=function(){let r;try{r=t.storage.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=define_process_env_default.DEBUG),r},t.useColors=function(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch{}}(),t.destroy=(()=>{let r=!1;return()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=common(t);const{formatters:n}=e.exports;n.j=function(r){try{return JSON.stringify(r)}catch(o){return"[UnexpectedJSONParseError]: "+o.message}}})(browser,browser.exports);var browserExports=browser.exports,debug3=getDefaultExportFromCjs(browserExports),dist={},LRUCache$1={},LRUCacheNode$1={};Object.defineProperty(LRUCacheNode$1,"__esModule",{value:!0}),LRUCacheNode$1.LRUCacheNode=void 0;class LRUCacheNode{constructor(t,n,r){const{entryExpirationTimeInMS:o=null,next:s=null,prev:i=null,onEntryEvicted:a,onEntryMarkedAsMostRecentlyUsed:l,clone:c,cloneFn:d}=r??{};if(typeof o=="number"&&(o<=0||Number.isNaN(o)))throw new Error("entryExpirationTimeInMS must either be null (no expiry) or greater than 0");this.clone=c!=null&&c,this.cloneFn=d??this.defaultClone,this.key=t,this.internalValue=this.clone?this.cloneFn(n):n,this.created=Date.now(),this.entryExpirationTimeInMS=o,this.next=s,this.prev=i,this.onEntryEvicted=a,this.onEntryMarkedAsMostRecentlyUsed=l}get value(){return this.clone?this.cloneFn(this.internalValue):this.internalValue}get isExpired(){return typeof this.entryExpirationTimeInMS=="number"&&Date.now()-this.created>this.entryExpirationTimeInMS}invokeOnEvicted(){if(this.onEntryEvicted){const{key:t,value:n,isExpired:r}=this;this.onEntryEvicted({key:t,value:n,isExpired:r})}}invokeOnEntryMarkedAsMostRecentlyUsed(){if(this.onEntryMarkedAsMostRecentlyUsed){const{key:t,value:n}=this;this.onEntryMarkedAsMostRecentlyUsed({key:t,value:n})}}defaultClone(t){return typeof t=="boolean"||typeof t=="string"||typeof t=="number"?t:JSON.parse(JSON.stringify(t))}}LRUCacheNode$1.LRUCacheNode=LRUCacheNode,Object.defineProperty(LRUCache$1,"__esModule",{value:!0}),LRUCache$1.LRUCache=void 0;const LRUCacheNode_1=LRUCacheNode$1;class LRUCache{constructor(t){this.lookupTable=new Map,this.head=null,this.tail=null;const{maxSize:n=25,entryExpirationTimeInMS:r=null,onEntryEvicted:o,onEntryMarkedAsMostRecentlyUsed:s,cloneFn:i,clone:a}=t??{};if(Number.isNaN(n)||n<=0)throw new Error("maxSize must be greater than 0.");if(typeof r=="number"&&(r<=0||Number.isNaN(r)))throw new Error("entryExpirationTimeInMS must either be null (no expiry) or greater than 0");this.maxSizeInternal=n,this.entryExpirationTimeInMS=r,this.onEntryEvicted=o,this.onEntryMarkedAsMostRecentlyUsed=s,this.clone=a,this.cloneFn=i}get size(){return this.cleanCache(),this.lookupTable.size}get remainingSize(){return this.maxSizeInternal-this.size}get newest(){return this.head?this.head.isExpired?(this.removeNodeFromListAndLookupTable(this.head),this.newest):this.mapNodeToEntry(this.head):null}get oldest(){return this.tail?this.tail.isExpired?(this.removeNodeFromListAndLookupTable(this.tail),this.oldest):this.mapNodeToEntry(this.tail):null}get maxSize(){return this.maxSizeInternal}set maxSize(t){if(Number.isNaN(t)||t<=0)throw new Error("maxSize must be greater than 0.");this.maxSizeInternal=t,this.enforceSizeLimit()}set(t,n,r){const o=this.lookupTable.get(t);o&&this.removeNodeFromListAndLookupTable(o);const s=new LRUCacheNode_1.LRUCacheNode(t,n,{entryExpirationTimeInMS:this.entryExpirationTimeInMS,onEntryEvicted:this.onEntryEvicted,onEntryMarkedAsMostRecentlyUsed:this.onEntryMarkedAsMostRecentlyUsed,clone:this.clone,cloneFn:this.cloneFn,...r});return this.setNodeAsHead(s),this.lookupTable.set(t,s),this.enforceSizeLimit(),this}get(t){const n=this.lookupTable.get(t);return n?n.isExpired?(this.removeNodeFromListAndLookupTable(n),null):(this.setNodeAsHead(n),n.value):null}peek(t){const n=this.lookupTable.get(t);return n?n.isExpired?(this.removeNodeFromListAndLookupTable(n),null):n.value:null}delete(t){const n=this.lookupTable.get(t);return!!n&&this.removeNodeFromListAndLookupTable(n)}has(t){const n=this.lookupTable.get(t);return!!n&&(!n.isExpired||(this.removeNodeFromListAndLookupTable(n),!1))}clear(){this.head=null,this.tail=null,this.lookupTable.clear()}find(t){let n=this.head;for(;n;){if(n.isExpired){const o=n.next;this.removeNodeFromListAndLookupTable(n),n=o;continue}const r=this.mapNodeToEntry(n);if(t(r))return this.setNodeAsHead(n),r;n=n.next}return null}forEach(t){let n=this.head,r=0;for(;n;)if(n.isExpired){const o=n.next;this.removeNodeFromListAndLookupTable(n),n=o}else t(n.value,n.key,r),n=n.next,r++}*values(){let t=this.head;for(;t;)if(t.isExpired){const n=t.next;this.removeNodeFromListAndLookupTable(t),t=n}else yield t.value,t=t.next}*keys(){let t=this.head;for(;t;)if(t.isExpired){const n=t.next;this.removeNodeFromListAndLookupTable(t),t=n}else yield t.key,t=t.next}*entries(){let t=this.head;for(;t;)if(t.isExpired){const n=t.next;this.removeNodeFromListAndLookupTable(t),t=n}else yield this.mapNodeToEntry(t),t=t.next}*[Symbol.iterator](){let t=this.head;for(;t;)if(t.isExpired){const n=t.next;this.removeNodeFromListAndLookupTable(t),t=n}else yield this.mapNodeToEntry(t),t=t.next}enforceSizeLimit(){let t=this.tail;for(;t!==null&&this.size>this.maxSizeInternal;){const n=t.prev;this.removeNodeFromListAndLookupTable(t),t=n}}mapNodeToEntry({key:t,value:n}){return{key:t,value:n}}setNodeAsHead(t){this.removeNodeFromList(t),this.head?(t.next=this.head,this.head.prev=t,this.head=t):(this.head=t,this.tail=t),t.invokeOnEntryMarkedAsMostRecentlyUsed()}removeNodeFromList(t){t.prev!==null&&(t.prev.next=t.next),t.next!==null&&(t.next.prev=t.prev),this.head===t&&(this.head=t.next),this.tail===t&&(this.tail=t.prev),t.next=null,t.prev=null}removeNodeFromListAndLookupTable(t){return t.invokeOnEvicted(),this.removeNodeFromList(t),this.lookupTable.delete(t.key)}cleanCache(){if(!this.entryExpirationTimeInMS)return;const t=[];for(const n of this.lookupTable.values())n.isExpired&&t.push(n);t.forEach(n=>this.removeNodeFromListAndLookupTable(n))}}LRUCache$1.LRUCache=LRUCache,function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(r,o,s,i){i===void 0&&(i=s);var a=Object.getOwnPropertyDescriptor(o,s);a&&!("get"in a?!o.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return o[s]}}),Object.defineProperty(r,i,a)}:function(r,o,s,i){i===void 0&&(i=s),r[i]=o[s]}),n=commonjsGlobal&&commonjsGlobal.__exportStar||function(r,o){for(var s in r)s==="default"||Object.prototype.hasOwnProperty.call(o,s)||t(o,r,s)};Object.defineProperty(e,"__esModule",{value:!0}),n(LRUCache$1,e)}(dist);var lib={};(function(e){function t(E){if(!Number.isSafeInteger(E))throw new Error(`Wrong integer: ${E}`)}function n(...E){const m=(y,S)=>R=>y(S(R));return{encode:Array.from(E).reverse().reduce((y,S)=>y?m(y,S.encode):S.encode,void 0),decode:E.reduce((y,S)=>y?m(y,S.decode):S.decode,void 0)}}function r(E){return{encode:m=>{if(!Array.isArray(m)||m.length&&typeof m[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return m.map(y=>{if(t(y),y<0||y>=E.length)throw new Error(`Digit index outside alphabet: ${y} (alphabet: ${E.length})`);return E[y]})},decode:m=>{if(!Array.isArray(m)||m.length&&typeof m[0]!="string")throw new Error("alphabet.decode input should be array of strings");return m.map(y=>{if(typeof y!="string")throw new Error(`alphabet.decode: not string element=${y}`);const S=E.indexOf(y);if(S===-1)throw new Error(`Unknown letter: "${y}". Allowed: ${E}`);return S})}}}function o(E=""){if(typeof E!="string")throw new Error("join separator should be string");return{encode:m=>{if(!Array.isArray(m)||m.length&&typeof m[0]!="string")throw new Error("join.encode input should be array of strings");for(let y of m)if(typeof y!="string")throw new Error(`join.encode: non-string input=${y}`);return m.join(E)},decode:m=>{if(typeof m!="string")throw new Error("join.decode input should be string");return m.split(E)}}}function s(E,m="="){if(t(E),typeof m!="string")throw new Error("padding chr should be string");return{encode(y){if(!Array.isArray(y)||y.length&&typeof y[0]!="string")throw new Error("padding.encode input should be array of strings");for(let S of y)if(typeof S!="string")throw new Error(`padding.encode: non-string input=${S}`);for(;y.length*E%8;)y.push(m);return y},decode(y){if(!Array.isArray(y)||y.length&&typeof y[0]!="string")throw new Error("padding.encode input should be array of strings");for(let R of y)if(typeof R!="string")throw new Error(`padding.decode: non-string input=${R}`);let S=y.length;if(S*E%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;S>0&&y[S-1]===m;S--)if(!((S-1)*E%8))throw new Error("Invalid padding: string has too much padding");return y.slice(0,S)}}}function i(E){if(typeof E!="function")throw new Error("normalize fn should be function");return{encode:m=>m,decode:m=>E(m)}}function a(E,m,y){if(m<2)throw new Error(`convertRadix: wrong from=${m}, base cannot be less than 2`);if(y<2)throw new Error(`convertRadix: wrong to=${y}, base cannot be less than 2`);if(!Array.isArray(E))throw new Error("convertRadix: data should be array");if(!E.length)return[];let S=0;const R=[],A=Array.from(E);for(A.forEach(U=>{if(t(U),U<0||U>=m)throw new Error(`Wrong integer: ${U}`)});;){let U=0,I=!0;for(let M=S;M<A.length;M++){const P=A[M],D=m*U+P;if(!Number.isSafeInteger(D)||m*U/m!==U||D-P!=m*U)throw new Error("convertRadix: carry overflow");if(U=D%y,A[M]=Math.floor(D/y),!Number.isSafeInteger(A[M])||A[M]*y+U!==D)throw new Error("convertRadix: carry overflow");I&&(A[M]?I=!1:S=M)}if(R.push(U),I)break}for(let U=0;U<E.length-1&&E[U]===0;U++)R.push(0);return R.reverse()}/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.bytes=e.stringToBytes=e.str=e.bytesToString=e.hex=e.utf8=e.bech32m=e.bech32=e.base58check=e.base58xmr=e.base58xrp=e.base58flickr=e.base58=e.base64url=e.base64=e.base32crockford=e.base32hex=e.base32=e.base16=e.utils=e.assertNumber=void 0,e.assertNumber=t;const l=(E,m)=>m?l(m,E%m):E,c=(E,m)=>E+(m-l(E,m));function d(E,m,y,S){if(!Array.isArray(E))throw new Error("convertRadix2: data should be array");if(m<=0||m>32)throw new Error(`convertRadix2: wrong from=${m}`);if(y<=0||y>32)throw new Error(`convertRadix2: wrong to=${y}`);if(c(m,y)>32)throw new Error(`convertRadix2: carry overflow from=${m} to=${y} carryBits=${c(m,y)}`);let R=0,A=0;const U=2**y-1,I=[];for(const M of E){if(t(M),M>=2**m)throw new Error(`convertRadix2: invalid data word=${M} from=${m}`);if(R=R<<m|M,A+m>32)throw new Error(`convertRadix2: carry overflow pos=${A} from=${m}`);for(A+=m;A>=y;A-=y)I.push((R>>A-y&U)>>>0);R&=2**A-1}if(R=R<<y-A&U,!S&&A>=m)throw new Error("Excess padding");if(!S&&R)throw new Error(`Non-zero padding: ${R}`);return S&&A>0&&I.push(R>>>0),I}function p(E){return t(E),{encode:m=>{if(!(m instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return a(Array.from(m),256,E)},decode:m=>{if(!Array.isArray(m)||m.length&&typeof m[0]!="number")throw new Error("radix.decode input should be array of strings");return Uint8Array.from(a(m,E,256))}}}function g(E,m=!1){if(t(E),E<=0||E>32)throw new Error("radix2: bits should be in (0..32]");if(c(8,E)>32||c(E,8)>32)throw new Error("radix2: carry overflow");return{encode:y=>{if(!(y instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return d(Array.from(y),8,E,!m)},decode:y=>{if(!Array.isArray(y)||y.length&&typeof y[0]!="number")throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(d(y,E,8,m))}}}function v(E){if(typeof E!="function")throw new Error("unsafeWrapper fn should be function");return function(...m){try{return E.apply(null,m)}catch{}}}function x(E,m){if(t(E),typeof m!="function")throw new Error("checksum fn should be function");return{encode(y){if(!(y instanceof Uint8Array))throw new Error("checksum.encode: input should be Uint8Array");const S=m(y).slice(0,E),R=new Uint8Array(y.length+E);return R.set(y),R.set(S,y.length),R},decode(y){if(!(y instanceof Uint8Array))throw new Error("checksum.decode: input should be Uint8Array");const S=y.slice(0,-E),R=m(S).slice(0,E),A=y.slice(-E);for(let U=0;U<E;U++)if(R[U]!==A[U])throw new Error("Invalid checksum");return S}}}e.utils={alphabet:r,chain:n,checksum:x,radix:p,radix2:g,join:o,padding:s},e.base16=n(g(4),r("0123456789ABCDEF"),o("")),e.base32=n(g(5),r("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),s(5),o("")),e.base32hex=n(g(5),r("0123456789ABCDEFGHIJKLMNOPQRSTUV"),s(5),o("")),e.base32crockford=n(g(5),r("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),o(""),i(E=>E.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),e.base64=n(g(6),r("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),s(6),o("")),e.base64url=n(g(6),r("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),s(6),o(""));const b=E=>n(p(58),r(E),o(""));e.base58=b("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),e.base58flickr=b("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),e.base58xrp=b("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const C=[0,2,3,5,6,7,9,10,11];e.base58xmr={encode(E){let m="";for(let y=0;y<E.length;y+=8){const S=E.subarray(y,y+8);m+=e.base58.encode(S).padStart(C[S.length],"1")}return m},decode(E){let m=[];for(let y=0;y<E.length;y+=11){const S=E.slice(y,y+11),R=C.indexOf(S.length),A=e.base58.decode(S);for(let U=0;U<A.length-R;U++)if(A[U]!==0)throw new Error("base58xmr: wrong padding");m=m.concat(Array.from(A.slice(A.length-R)))}return Uint8Array.from(m)}},e.base58check=E=>n(x(4,m=>E(E(m))),e.base58);const _=n(r("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),o("")),k=[996825010,642813549,513874426,1027748829,705979059];function $(E){const m=E>>25;let y=(33554431&E)<<5;for(let S=0;S<k.length;S++)(m>>S&1)==1&&(y^=k[S]);return y}function N(E,m,y=1){const S=E.length;let R=1;for(let A=0;A<S;A++){const U=E.charCodeAt(A);if(U<33||U>126)throw new Error(`Invalid prefix (${E})`);R=$(R)^U>>5}R=$(R);for(let A=0;A<S;A++)R=$(R)^31&E.charCodeAt(A);for(let A of m)R=$(R)^A;for(let A=0;A<6;A++)R=$(R);return R^=y,_.encode(d([R%2**30],30,5,!1))}function T(E){const m=E==="bech32"?1:734539939,y=g(5),S=y.decode,R=y.encode,A=v(S);function U(I,M=90){if(typeof I!="string")throw new Error("bech32.decode input should be string, not "+typeof I);if(I.length<8||M!==!1&&I.length>M)throw new TypeError(`Wrong string length: ${I.length} (${I}). Expected (8..${M})`);const P=I.toLowerCase();if(I!==P&&I!==I.toUpperCase())throw new Error("String must be lowercase or uppercase");const D=(I=P).lastIndexOf("1");if(D===0||D===-1)throw new Error('Letter "1" must be present between prefix and data only');const O=I.slice(0,D),j=I.slice(D+1);if(j.length<6)throw new Error("Data must be at least 6 characters long");const K=_.decode(j).slice(0,-6),F=N(O,K,m);if(!j.endsWith(F))throw new Error(`Invalid checksum in ${I}: expected "${F}"`);return{prefix:O,words:K}}return{encode:function(I,M,P=90){if(typeof I!="string")throw new Error("bech32.encode prefix should be string, not "+typeof I);if(!Array.isArray(M)||M.length&&typeof M[0]!="number")throw new Error("bech32.encode words should be array of numbers, not "+typeof M);const D=I.length+7+M.length;if(P!==!1&&D>P)throw new TypeError(`Length ${D} exceeds limit ${P}`);return`${I=I.toLowerCase()}1${_.encode(M)}${N(I,M,m)}`},decode:U,decodeToBytes:function(I){const{prefix:M,words:P}=U(I,!1);return{prefix:M,words:P,bytes:S(P)}},decodeUnsafe:v(U),fromWords:S,fromWordsUnsafe:A,toWords:R}}e.bech32=T("bech32"),e.bech32m=T("bech32m"),e.utf8={encode:E=>new TextDecoder().decode(E),decode:E=>new TextEncoder().encode(E)},e.hex=n(g(4),r("0123456789abcdef"),o(""),i(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()}));const L={utf8:e.utf8,hex:e.hex,base16:e.base16,base32:e.base32,base64:e.base64,base64url:e.base64url,base58:e.base58,base58xmr:e.base58xmr},B=`Invalid encoding type. Available types: ${Object.keys(L).join(", ")}`;e.bytesToString=(E,m)=>{if(typeof E!="string"||!L.hasOwnProperty(E))throw new TypeError(B);if(!(m instanceof Uint8Array))throw new TypeError("bytesToString() expects Uint8Array");return L[E].encode(m)},e.str=e.bytesToString,e.stringToBytes=(E,m)=>{if(!L.hasOwnProperty(E))throw new TypeError(B);if(typeof m!="string")throw new TypeError("stringToBytes() expects string");return L[E].decode(m)},e.bytes=e.stringToBytes})(lib),BigInt(1e3),BigInt(1e6),BigInt(1e9),BigInt(1e12),BigInt("2100000000000000000"),BigInt(1e11);const TAGCODES={payment_hash:1,payment_secret:16,description:13,payee:19,description_hash:23,expiry:6,min_final_cltv_expiry:24,fallback_address:9,route_hint:3,feature_bits:5,metadata:27};for(let e=0,t=Object.keys(TAGCODES);e<t.length;e++)t[e],TAGCODES[t[e]].toString();var NDKRelayConnectivity=class{constructor(e){w(this,"ndkRelay");w(this,"_status");w(this,"relay");w(this,"connectedAt");w(this,"_connectionStats",{attempts:0,success:0,durations:[]});w(this,"debug");w(this,"updateConnectionStats",{connected:()=>{this._connectionStats.success++,this._connectionStats.connectedAt=Date.now()},disconnected:()=>{this._connectionStats.connectedAt&&(this._connectionStats.durations.push(Date.now()-this._connectionStats.connectedAt),this._connectionStats.durations.length>100&&this._connectionStats.durations.shift()),this._connectionStats.connectedAt=void 0},attempt:()=>{this._connectionStats.attempts++}});this.ndkRelay=e,this._status=3,this.relay=relayInit(this.ndkRelay.url),this.debug=this.ndkRelay.debug.extend("connectivity"),this.relay.on("notice",t=>this.handleNotice(t))}async initiateAuth(e={limit:1}){this.debug("Initiating authentication");const t=this.relay.sub([e],{id:"auth-test"});t.on("eose",()=>{t.unsub(),this._status=1,this.ndkRelay.emit("ready"),this.debug("Authentication not required"),t.unsub()}),this.debug("Authentication request started")}async connect(){const e=()=>{this.updateConnectionStats.connected(),this.ndkRelay.authRequired?(this._status=6,this.ndkRelay.emit("connect"),this.initiateAuth()):(this._status=1,this.ndkRelay.emit("connect"),this.ndkRelay.emit("ready"))},t=()=>{this.updateConnectionStats.disconnected(),this._status===1&&(this._status=3,this.handleReconnection()),this.ndkRelay.emit("disconnect")},n=async r=>{this.debug("Relay requested authentication",{havePolicy:!!this.ndkRelay.authPolicy}),this.ndkRelay.authPolicy?this._status!==7&&(this._status=7,await this.ndkRelay.authPolicy(this.ndkRelay,r),this._status===7&&(this.debug("Authentication policy finished"),this._status=1,this.ndkRelay.emit("ready"))):await this.ndkRelay.emit("auth",r)};try{this.updateConnectionStats.attempt(),this._status=0,this.relay.off("connect",e),this.relay.off("disconnect",t),this.relay.on("connect",e),this.relay.on("disconnect",t),this.relay.on("auth",n),await this.relay.connect()}catch(r){throw this.debug("Failed to connect",r),this._status=3,r}}disconnect(){this._status=2,this.relay.close()}get status(){return this._status}isAvailable(){return this._status===1}isFlapping(){const e=this._connectionStats.durations;if(e.length%3!=0)return!1;const t=e.reduce((r,o)=>r+o,0)/e.length,n=e.map(r=>Math.pow(r-t,2)).reduce((r,o)=>r+o,0)/e.length;return Math.sqrt(n)<1e3}async handleNotice(e){(e.includes("oo many")||e.includes("aximum"))&&(this.disconnect(),setTimeout(()=>this.connect(),2e3),this.debug(this.relay.url,"Relay complaining?",e)),this.ndkRelay.emit("notice",this,e)}handleReconnection(e=0){if(this.isFlapping())return this.ndkRelay.emit("flapping",this,this._connectionStats),void(this._status=5);const t=this.connectedAt?Math.max(0,6e4-(Date.now()-this.connectedAt)):0;setTimeout(()=>{this._status=4,this.connect().then(()=>{this.debug("Reconnected")}).catch(n=>{this.debug("Reconnect failed",n),e<5?setTimeout(()=>{this.handleReconnection(e+1)},6e4):this.debug("Reconnect failed after 5 attempts")})},t)}get connectionStats(){return this._connectionStats}},NDKRelayPublisher=class{constructor(e){w(this,"ndkRelay");this.ndkRelay=e}async publish(e,t=2500){const n=()=>new Promise((a,l)=>{try{this.publishEvent(e,t).then(c=>a(c)).catch(c=>l(c))}catch(c){l(c)}}),r=new Promise((a,l)=>{setTimeout(()=>l(new Error("Timeout")),t)}),o=()=>{n().then(a=>s(a)).catch(a=>i(a))};let s,i;return this.ndkRelay.status===1?Promise.race([n(),r]):Promise.race([new Promise((a,l)=>{s=a,i=l,this.ndkRelay.once("connect",o)}),r]).finally(()=>{this.ndkRelay.removeListener("connect",o)})}async publishEvent(e,t){const n=await e.toNostrEvent(),r=this.ndkRelay.connectivity.relay.publish(n);let o;const s=new Promise((a,l)=>{r.then(()=>{clearTimeout(o),this.ndkRelay.emit("published",e),a(!0)}).catch(c=>{clearTimeout(o),this.ndkRelay.debug("Publish failed",c,e.id),this.ndkRelay.emit("publish:failed",e,c),l(c)})});if(!t||e.isEphemeral())return s;const i=new Promise((a,l)=>{o=setTimeout(()=>{this.ndkRelay.debug("Publish timed out",e.rawEvent()),this.ndkRelay.emit("publish:failed",e,"Timeout"),l(new Error("Publish operation timed out"))},t)});return Promise.race([s,i])}async auth(e){return this.ndkRelay.connectivity.relay.auth(e.rawEvent())}};function calculateGroupableId(e){const t=[];for(const n of e){if(n.since||n.until)return null;const r=Object.keys(n||{}).sort().join("-");t.push(r)}return t.join("|")}function mergeFilters(e){const t={};return e.forEach(n=>{Object.entries(n).forEach(([r,o])=>{Array.isArray(o)?t[r]===void 0?t[r]=[...o]:t[r]=Array.from(new Set([...t[r],...o])):t[r]=o})}),t}var MAX_SUBID_LENGTH=20;function queryFullyFilled(e){return!(!filterIncludesIds(e.filter)||!resultHasAllRequestedIds(e))}function compareFilter(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const[n,r]of Object.entries(e)){const o=t[n];if(!o)return!1;if(Array.isArray(r)&&Array.isArray(o)){const s=r;for(const i of o){const a=i;if(!s.includes(a))return!1}}else if(o!==r)return!1}return!0}function filterIncludesIds(e){return!!e.ids}function resultHasAllRequestedIds(e){const t=e.filter.ids;return!!t&&t.length===e.eventFirstSeen.size}function generateSubId(e,t){var a;const n=e.map(l=>l.subId).filter(Boolean),r=[],o=new Set,s=new Set;if(n.length>0)r.push(Array.from(new Set(n)).join(","));else{for(const l of t)for(const c of Object.keys(l))c==="kinds"?(a=l.kinds)==null||a.forEach(d=>s.add(d)):o.add(c);s.size>0&&r.push("kinds:"+Array.from(s).join(",")),o.size>0&&r.push(Array.from(o).join(","))}let i=r.join("-");return i.length>MAX_SUBID_LENGTH&&(i=i.substring(0,MAX_SUBID_LENGTH)),n.length!==1&&(i+="-"+Math.floor(999*Math.random()).toString()),i}function filterFromId(e){let t;if(e.match(NIP33_A_REGEX)){const[n,r,o]=e.split(":"),s={authors:[r],kinds:[parseInt(n)]};return o&&(s["#d"]=[o]),s}try{switch(t=nip19_exports.decode(e),t.type){case"nevent":return{ids:[t.data.id]};case"note":return{ids:[t.data]};case"naddr":return{authors:[t.data.pubkey],"#d":[t.data.identifier],kinds:[t.data.kind]}}}catch{}return{ids:[e]}}function isNip33AValue(e){return e.match(NIP33_A_REGEX)!==null}var NIP33_A_REGEX=/^(\d+):([0-9A-Fa-f]+)(?::(.*))?$/;function relaysFromBech32(e){try{const t=nip19_exports.decode(e);if(["naddr","nevent"].includes(t==null?void 0:t.type)){const n=t.data;if(n!=null&&n.relays)return n.relays.map(r=>new NDKRelay(r))}}catch{}return[]}var NDKGroupedSubscriptions=class extends lib$1.EventEmitter{constructor(t,n){super();w(this,"subscriptions");w(this,"req");w(this,"debug");this.subscriptions=t,this.debug=n||this.subscriptions[0].subscription.debug.extend("grouped");for(const r of t)this.handleSubscriptionClosure(r)}addSubscription(t){this.subscriptions.push(t),this.handleSubscriptionClosure(t)}eventReceived(t){for(const n of this.subscriptions)n.eventReceived(t)}eoseReceived(t){Array.from(this.subscriptions).forEach(async n=>{n.subscription.eoseReceived(t)})}handleSubscriptionClosure(t){t.subscription.on("close",()=>{const n=this.subscriptions.findIndex(r=>r.subscription===t.subscription);this.subscriptions.splice(n,1),this.subscriptions.length<=0&&this.emit("close")})}map(t){return this.subscriptions.map(t)}[Symbol.iterator](){let t=0;const n=this.subscriptions;return{next:()=>t<n.length?{value:n[t++],done:!1}:{value:null,done:!0}}}},NDKSubscriptionFilters=class{constructor(e,t,n){w(this,"subscription");w(this,"filters",[]);w(this,"ndkRelay");this.subscription=e,this.filters=t,this.ndkRelay=n}eventReceived(e){this.eventMatchesLocalFilter(e)&&this.subscription.eventReceived(e,this.ndkRelay,!1)}eventMatchesLocalFilter(e){const t=e.rawEvent();return this.filters.some(n=>matchFilter(n,t))}};function findMatchingActiveSubscriptions(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length&&compareFilter(e[n],t[n]);n++)return e[n]}var NDKRelaySubscriptions=class{constructor(e){w(this,"ndkRelay");w(this,"delayedItems",new Map);w(this,"delayedTimers",new Map);w(this,"activeSubscriptions",new Map);w(this,"activeSubscriptionsByGroupId",new Map);w(this,"executionTimeoutsByGroupId",new Map);w(this,"debug");w(this,"groupingDebug");w(this,"conn");this.ndkRelay=e,this.conn=e.connectivity,this.debug=e.debug.extend("subscriptions"),this.groupingDebug=e.debug.extend("grouping")}subscribe(e,t){const n=calculateGroupableId(t),r=new NDKSubscriptionFilters(e,t,this.ndkRelay);if(!n||!e.isGroupable())return void this.executeSubscriptions(n,new NDKGroupedSubscriptions([r]),t);const o=this.activeSubscriptionsByGroupId.get(n);if(o&&findMatchingActiveSubscriptions(o.filters,t)){const a=this.activeSubscriptions.get(o.sub);return void(a==null?void 0:a.addSubscription(new NDKSubscriptionFilters(e,t,this.ndkRelay)))}let s=this.delayedItems.get(n);s?s.addSubscription(r):(s=new NDKGroupedSubscriptions([r]),this.delayedItems.set(n,s),s.once("close",()=>{this.delayedItems.get(n)&&this.delayedItems.delete(n)}));let i=this.executionTimeoutsByGroupId.get(n);i&&e.opts.groupableDelayType!=="at-most"||(i=setTimeout(()=>{this.executeGroup(n,e)},e.opts.groupableDelay),this.executionTimeoutsByGroupId.set(n,i)),this.delayedTimers.has(n)?this.delayedTimers.get(n).push(i):this.delayedTimers.set(n,[i])}executeGroup(e,t){const n=this.delayedItems.get(e);this.delayedItems.delete(e);const r=this.delayedTimers.get(e);if(this.delayedTimers.delete(e),r)for(const o of r)clearTimeout(o);if(n){const o=n.subscriptions[0].filters.length,s=[];for(let i=0;i<o;i++){const a=n.map(l=>l.filters[i]);s.push(mergeFilters(a))}this.executeSubscriptions(e,n,s)}}executeSubscriptionsWhenConnected(e,t,n){const r=()=>{this.debug("new relay coming online for active subscription",{relay:this.ndkRelay.url,mergeFilters}),this.executeSubscriptionsConnected(e,t,n)};this.ndkRelay.once("ready",r),t.once("close",()=>{this.ndkRelay.removeListener("ready",r)})}executeSubscriptions(e,t,n){this.conn.isAvailable()?this.executeSubscriptionsConnected(e,t,n):this.executeSubscriptionsWhenConnected(e,t,n)}executeSubscriptionsConnected(e,t,n){const r=[];for(const{subscription:a}of t)r.push(a);const o=generateSubId(r,n);t.req=n;const s={id:o};(this.ndkRelay.trusted||r.every(a=>a.opts.skipVerification))&&(s.skipVerification=!0);const i=this.conn.relay.sub(n,s);return this.activeSubscriptions.set(i,t),e&&this.activeSubscriptionsByGroupId.set(e,{filters:n,sub:i}),i.on("event",a=>{const l=new NDKEvent(void 0,a);l.relay=this.ndkRelay;const c=this.activeSubscriptions.get(i);c==null||c.eventReceived(l)}),i.on("eose",()=>{const a=this.activeSubscriptions.get(i);a==null||a.eoseReceived(this.ndkRelay)}),t.once("close",()=>{i.unsub(),this.activeSubscriptions.delete(i),e&&this.activeSubscriptionsByGroupId.delete(e)}),this.executeSubscriptionsWhenConnected(e,t,n),i}executedFilters(){const e=new Map;for(const[,t]of this.activeSubscriptions)e.set(t.req,t.map(n=>n.subscription));return e}},NDKRelay=class extends lib$1.EventEmitter{constructor(t,n){super();w(this,"url");w(this,"scores");w(this,"connectivity");w(this,"subs");w(this,"publisher");w(this,"authPolicy");w(this,"authRequired",!1);w(this,"trusted",!1);w(this,"complaining",!1);w(this,"debug");this.url=t,this.scores=new Map,this.debug=debug3(`ndk:relay:${t}`),this.connectivity=new NDKRelayConnectivity(this),this.subs=new NDKRelaySubscriptions(this),this.publisher=new NDKRelayPublisher(this),this.authPolicy=n}get status(){return this.connectivity.status}get connectionStats(){return this.connectivity.connectionStats}async connect(){return this.connectivity.connect()}disconnect(){this.status!==3&&this.connectivity.disconnect()}subscribe(t,n){this.subs.subscribe(t,n)}async publish(t,n=2500){return this.publisher.publish(t,n)}async auth(t){return this.publisher.auth(t)}scoreSlowerEvent(t){}tagReference(t){const n=["r",this.url];return t&&n.push(t),n}referenceTags(){return[["r",this.url]]}activeSubscriptions(){return this.subs.executedFilters()}},PublishError=class extends Error{constructor(t,n){super(t);w(this,"errors");this.errors=n}},NDKRelaySet=class ae{constructor(t,n){w(this,"relays");w(this,"debug");w(this,"ndk");this.relays=t,this.ndk=n,this.debug=n.debug.extend("relayset")}addRelay(t){this.relays.add(t)}static fromRelayUrls(t,n){const r=new Set;for(const o of t){const s=n.pool.relays.get(o);if(s)r.add(s);else{const i=new NDKRelay(o);n.pool.useTemporaryRelay(i),r.add(i)}}return new ae(new Set(r),n)}async publish(t,n){const r=new Set,o=new Map,s=t.isEphemeral(),i=Array.from(this.relays).map(a=>new Promise(l=>{a.publish(t,n).then(()=>{r.add(a),l()}).catch(c=>{s||(o.set(a,c),this.debug("error publishing to relay",{relay:a.url,err:c})),l()})}));if(await Promise.all(i),r.size===0&&!s)throw new PublishError("No relay was able to receive the event",o);return r}size(){return this.relays.size}};function calculateRelaySetFromEvent(e,t){var r;const n=new Set;return(r=e.pool)==null||r.relays.forEach(o=>n.add(o)),new NDKRelaySet(n,e)}function getWriteRelaysFor(e,t){var n;if(e.outboxTracker)return(n=e.outboxTracker.data.get(t))==null?void 0:n.writeRelays}function calculateRelaySetsFromFilter(e,t){var o,s;const n=new Map,r=new Set;if(t.forEach(i=>{i.authors&&i.authors.forEach(a=>r.add(a))}),r.size>0){const i=new Map;for(const a of r){const l=getWriteRelaysFor(e,a);l&&l.size>0?(e.debug(`Adding ${l.size} relays for ${a}`),l.forEach(c=>{const d=i.get(c)||[];d.push(a),i.set(c,d)})):(o=e.explicitRelayUrls)==null||o.forEach(c=>{const d=i.get(c)||[];d.push(a),i.set(c,d)})}for(const a of i.keys())n.set(a,[]);for(const a of t)if(a.authors)for(const[l,c]of i.entries()){const d=a.authors.filter(p=>c.includes(p));n.set(l,[...n.get(l),{...a,authors:d}])}else for(const l of i.keys())n.set(l,[...n.get(l),a])}else(s=e.explicitRelayUrls)==null||s.forEach(i=>{n.set(i,t)});return n}function calculateRelaySetsFromFilters(e,t){return calculateRelaySetsFromFilter(e,t)}var DEFAULT_RELAYS=["wss://nos.lol","wss://relay.nostr.band","wss://relay.f7z.io","wss://relay.damus.io","wss://nostr.mom","wss://no.str.cr"],Zap=class extends lib$1.EventEmitter{constructor(t){var n;super();w(this,"ndk");w(this,"zappedEvent");w(this,"zappedUser");this.ndk=t.ndk,this.zappedEvent=t.zappedEvent,this.zappedUser=t.zappedUser||this.ndk.getUser({hexpubkey:(n=this.zappedEvent)==null?void 0:n.pubkey})}async getZapEndpoint(){let t,n,r,o;if(this.zappedUser&&(this.zappedUser.profile||await this.zappedUser.fetchProfile({groupable:!1}),t=(this.zappedUser.profile||{}).lud06,n=(this.zappedUser.profile||{}).lud16),n&&!n.startsWith("LNURL")){const[s,i]=n.split("@");r=`https://${i}/.well-known/lnurlp/${s}`}else if(t){const{words:s}=bech32.decode(t,1e3),i=bech32.fromWords(s);r=new TextDecoder("utf-8").decode(i)}if(!r)throw new Error("No zap endpoint found");try{const s=this.ndk.httpFetch||fetch,i=await s(r);if(i.status!==200){const l=await i.text();throw new Error(`Unable to fetch zap endpoint ${r}: ${l}`)}const a=await i.json();return a!=null&&a.allowsNostr&&(a!=null&&a.nostrPubkey||a!=null&&a.nostrPubKey)&&(o=a.callback),o}catch(s){throw new Error(`Unable to fetch zap endpoint ${r}: ${s}`)}}async createZapRequest(t,n,r,o,s){const i=await this.generateZapRequest(t,n,r,o);if(!i)return null;const{event:a,zapEndpoint:l}=i;if(!a)throw new Error("No zap request event found");let c;await a.sign(s);try{c=await this.getInvoice(a,t,l)}catch(d){throw new Error("Failed to get invoice: "+d)}return c}async getInvoice(t,n,r){return(await(await fetch(`${r}?`+new URLSearchParams({amount:n.toString(),nostr:JSON.stringify(t.rawEvent())}))).json()).pr}async generateZapRequest(t,n,r,o,s){const i=await this.getZapEndpoint();if(!i)throw new Error("No zap endpoint found");if(!this.zappedEvent&&!this.zappedUser)throw new Error("No zapped event or user found");const a=nip57_exports.makeZapRequest({profile:this.zappedUser.pubkey,event:null,amount:t,comment:n||"",relays:o??this.relays()});if(this.zappedEvent){const c=this.zappedEvent.referenceTags();a.tags.push(...c)}a.tags.push(["lnurl",i]);const l=new NDKEvent(this.ndk,a);return r&&(l.tags=l.tags.concat(r)),{event:l,zapEndpoint:i}}relays(){var n,r;let t=[];return(r=(n=this.ndk)==null?void 0:n.pool)!=null&&r.relays&&(t=this.ndk.pool.urls()),t.length||(t=DEFAULT_RELAYS),t}};function mergeTags(e,t){const n=new Map,r=(o,s)=>o.every((i,a)=>i===s[a]);return e.concat(t).forEach(o=>{for(let[s,i]of n)if(r(i,o)||r(o,i))return void(o.length>=i.length&&n.set(s,o));n.set((s=>s.join(","))(o),o)}),Array.from(n.values())}async function generateContentTags(e,t=[]){let n=[];const r=o=>{t.find(s=>s[0]===o[0]&&s[1]===o[1])||t.push(o)};return e=e.replace(/(@|nostr:)(npub|nprofile|note|nevent|naddr)[a-zA-Z0-9]+/g,o=>{try{const s=o.split(/(@|nostr:)/)[2],{type:i,data:a}=nip19_exports.decode(s);let l;switch(i){case"npub":l=["p",a];break;case"nprofile":l=["p",a.pubkey];break;case"note":n.push(new Promise(async c=>{r(["e",a,await maybeGetEventRelayUrl(s),"mention"]),c()}));break;case"nevent":n.push(new Promise(async c=>{let{id:d,relays:p,author:g}=a;p&&p.length!==0||(p=[await maybeGetEventRelayUrl(s)]),r(["e",d,p[0],"mention"]),g&&r(["p",g]),c()}));break;case"naddr":n.push(new Promise(async c=>{const d=[a.kind,a.pubkey,a.identifier].join(":");let p=a.relays??[];p.length===0&&(p=[await maybeGetEventRelayUrl(s)]),r(["a",d,p[0],"mention"]),r(["p",a.pubkey]),c()}));break;default:return o}return l&&r(l),`nostr:${s}`}catch{return o}}),await Promise.all(n),{content:e=e.replace(/#(\w+)/g,(o,s)=>{const i=["t",s];return t.find(a=>a[0]===i[0]&&a[1]===i[1])||t.push(i),o}),tags:t}}async function maybeGetEventRelayUrl(e){return""}function isReplaceable(){if(this.kind===void 0)throw new Error("Kind not set");return this.kind>=1e4&&this.kind<2e4}function isEphemeral(){if(this.kind===void 0)throw new Error("Kind not set");return this.kind>=2e4&&this.kind<3e4}function isParamReplaceable(){if(this.kind===void 0)throw new Error("Kind not set");return this.kind>=3e4&&this.kind<4e4}async function encrypt(e,t){if(!this.ndk)throw new Error("No NDK instance found!");if(t||(await this.ndk.assertSigner(),t=this.ndk.signer),!e){const n=this.getMatchingTags("p");if(n.length!==1)throw new Error("No recipient could be determined and no explicit recipient was provided");e=this.ndk.getUser({hexpubkey:n[0][1]})}this.content=await(t==null?void 0:t.encrypt(e,this.content))}async function decrypt(e,t){if(!this.ndk)throw new Error("No NDK instance found!");t||(await this.ndk.assertSigner(),t=this.ndk.signer),e||(e=this.author),this.content=await(t==null?void 0:t.decrypt(e,this.content))}function encode(){return this.isParamReplaceable()?nip19_exports.naddrEncode({kind:this.kind,pubkey:this.pubkey,identifier:this.replaceableDTag(),relays:this.relay?[this.relay.url]:[]}):this.relay?nip19_exports.neventEncode({id:this.tagId(),relays:[this.relay.url],author:this.pubkey}):nip19_exports.noteEncode(this.tagId())}async function repost(e=!0,t){if(!t&&e){if(!this.ndk)throw new Error("No NDK instance found");this.ndk.assertSigner(),t=this.ndk.signer}const n=new NDKEvent(this.ndk,{kind:getKind(this),content:""});return n.tag(this),n.kind===16&&n.tags.push(["k",`${this.kind}`]),t&&await n.sign(t),e&&await n.publish(),n}function getKind(e){return e.kind===1?6:16}var NDKEvent=class Q extends lib$1.EventEmitter{constructor(n,r){super();w(this,"ndk");w(this,"created_at");w(this,"content","");w(this,"tags",[]);w(this,"kind");w(this,"id","");w(this,"sig");w(this,"pubkey","");w(this,"_author");w(this,"relay");w(this,"isReplaceable",isReplaceable.bind(this));w(this,"isEphemeral",isEphemeral.bind(this));w(this,"isParamReplaceable",isParamReplaceable.bind(this));w(this,"encode",encode.bind(this));w(this,"encrypt",encrypt.bind(this));w(this,"decrypt",decrypt.bind(this));w(this,"repost",repost.bind(this));this.ndk=n,this.created_at=r==null?void 0:r.created_at,this.content=(r==null?void 0:r.content)||"",this.tags=(r==null?void 0:r.tags)||[],this.id=(r==null?void 0:r.id)||"",this.sig=r==null?void 0:r.sig,this.pubkey=(r==null?void 0:r.pubkey)||"",this.kind=r==null?void 0:r.kind}rawEvent(){return{created_at:this.created_at,content:this.content,tags:this.tags,kind:this.kind,pubkey:this.pubkey,id:this.id,sig:this.sig}}set author(n){this.pubkey=n.hexpubkey,this._author=void 0}get author(){if(this._author)return this._author;if(!this.ndk)throw new Error("No NDK instance found");const n=this.ndk.getUser({hexpubkey:this.pubkey});return this._author=n,n}tag(n,r){let o=[];if(n instanceof NDKUser){const s=["p",n.pubkey];r&&s.push(r),o.push(s)}else if(n instanceof Q){const s=n,i=(s==null?void 0:s.pubkey)===this.pubkey;o=s.referenceTags(r,i);for(const a of s.getMatchingTags("p"))a[1]!==this.pubkey&&(this.tags.find(l=>l[0]==="p"&&l[1]===a[1])||this.tags.push(["p",a[1]]))}else o=[n];this.tags=mergeTags(this.tags,o)}async toNostrEvent(n){var i,a;if(!n&&this.pubkey===""){const l=await((a=(i=this.ndk)==null?void 0:i.signer)==null?void 0:a.user());this.pubkey=(l==null?void 0:l.hexpubkey)||""}this.created_at||(this.created_at=Math.floor(Date.now()/1e3));const r=this.rawEvent(),{content:o,tags:s}=await this.generateTags();r.content=o||"",r.tags=s;try{this.id=getEventHash(r)}catch{}return this.id&&(r.id=this.id),this.sig&&(r.sig=this.sig),r}getMatchingTags(n){return this.tags.filter(r=>r[0]===n)}tagValue(n){const r=this.getMatchingTags(n);if(r.length!==0)return r[0][1]}get alt(){return this.tagValue("alt")}set alt(n){this.removeTag("alt"),n&&this.tags.push(["alt",n])}removeTag(n){this.tags=this.tags.filter(r=>r[0]!==n)}async sign(n){var o;n?this.author=await n.user():((o=this.ndk)==null||o.assertSigner(),n=this.ndk.signer),await this.generateTags(),this.isReplaceable()&&(this.created_at=Math.floor(Date.now()/1e3));const r=await this.toNostrEvent();return this.sig=await n.sign(r),this.sig}async publish(n,r){if(this.sig||await this.sign(),!this.ndk)throw new Error("NDKEvent must be associated with an NDK instance to publish");return n||(n=this.ndk.devWriteRelaySet||calculateRelaySetFromEvent(this.ndk)),n.publish(this,r)}async generateTags(){var s,i;let n=[];const r=await generateContentTags(this.content,this.tags),o=r.content;if(n=r.tags,this.kind&&this.isParamReplaceable()&&!this.getMatchingTags("d")[0]){const a=this.tagValue("title");let l=[...Array(a?6:16)].map(()=>Math.random().toString(36)[2]).join("");a&&a.length>0&&(l=a.replace(/[^a-z0-9]+/gi,"-").replace(/^-|-$/g,"")+"-"+l),n.push(["d",l])}if(((s=this.ndk)!=null&&s.clientName||(i=this.ndk)!=null&&i.clientNip89)&&!this.tagValue("client")){const a=["client",this.ndk.clientName??""];this.ndk.clientNip89&&a.push(this.ndk.clientNip89),n.push(a)}return{content:o||"",tags:n}}muted(){var s,i;const n=(s=this.ndk)==null?void 0:s.mutedIds.get(this.pubkey);if(n&&n==="p")return"author";const r=this.tagReference(),o=(i=this.ndk)==null?void 0:i.mutedIds.get(r[1]);return o&&o===r[0]?"event":null}replaceableDTag(){if(this.kind&&this.kind>=3e4&&this.kind<=4e4){const n=this.getMatchingTags("d")[0];return n?n[1]:""}throw new Error("Event is not a parameterized replaceable event")}deduplicationKey(){return this.kind===0||this.kind===3||this.kind&&this.kind>=1e4&&this.kind<2e4?`${this.kind}:${this.pubkey}`:this.tagId()}tagId(){return this.isParamReplaceable()?this.tagAddress():this.id}tagAddress(){if(!this.isParamReplaceable())throw new Error("This must only be called on replaceable events");const n=this.replaceableDTag();return`${this.kind}:${this.pubkey}:${n}`}tagReference(n){let r;return r=this.isParamReplaceable()?["a",this.tagAddress()]:["e",this.tagId()],this.relay?r.push(this.relay.url):r.push(""),n&&r.push(n),r}referenceTags(n,r){var s;let o=[];return o=this.isParamReplaceable()?[["a",this.tagAddress()],["e",this.id]]:[["e",this.id]],(s=this.relay)!=null&&s.url?o=o.map(i=>{var a;return i.push((a=this.relay)==null?void 0:a.url),i}):n&&(o=o.map(i=>(i.push(""),i))),n&&o.forEach(i=>i.push(n)),r||o.push(...this.author.referenceTags()),o}filter(){return this.isParamReplaceable()?{"#a":[this.tagId()]}:{"#e":[this.tagId()]}}async zap(n,r,o,s,i){if(!this.ndk)throw new Error("No NDK instance found");i||this.ndk.assertSigner();const a=new Zap({ndk:this.ndk,zappedEvent:this,zappedUser:s}),l=Array.from(this.ndk.pool.relays.keys());return await a.createZapRequest(n,r,o,l,i)}async delete(n){if(!this.ndk)throw new Error("No NDK instance found");this.ndk.assertSigner();const r=new Q(this.ndk,{kind:5,content:n||""});return r.tag(this),await r.publish(),r}async react(n,r=!0){if(!this.ndk)throw new Error("No NDK instance found");this.ndk.assertSigner();const o=new Q(this.ndk,{kind:7,content:n});return o.tag(this),r?await o.publish():await o.sign(),o}get isValid(){return!0}},READ_MARKER="read",WRITE_MARKER="write",NDKRelayList=class le extends NDKEvent{constructor(t,n){super(t,n),this.kind??(this.kind=10002)}static from(t){return new le(t.ndk,t.rawEvent())}get readRelayUrls(){return this.getMatchingTags("r").filter(t=>!t[2]||t[2]&&t[2]===READ_MARKER).map(t=>t[1])}set readRelayUrls(t){for(const n of t)this.tags.push(["r",n,READ_MARKER])}get writeRelayUrls(){return this.getMatchingTags("r").filter(t=>!t[2]||t[2]&&t[2]===WRITE_MARKER).map(t=>t[1])}set writeRelayUrls(t){for(const n of t)this.tags.push(["r",n,WRITE_MARKER])}get bothRelayUrls(){return this.getMatchingTags("r").filter(t=>!t[2]).map(t=>t[1])}set bothRelayUrls(t){for(const n of t)this.tags.push(["r",n])}get relays(){return this.getMatchingTags("r").map(t=>t[1])}},NDKSubscriptionCacheUsage=(e=>(e.ONLY_CACHE="ONLY_CACHE",e.CACHE_FIRST="CACHE_FIRST",e.PARALLEL="PARALLEL",e.ONLY_RELAY="ONLY_RELAY",e))(NDKSubscriptionCacheUsage||{}),defaultOpts={closeOnEose:!1,cacheUsage:"CACHE_FIRST",groupable:!0,groupableDelay:100,groupableDelayType:"at-most"},NDKSubscription=class extends lib$1.EventEmitter{constructor(t,n,r,o,s){super();w(this,"subId");w(this,"filters");w(this,"opts");w(this,"pool");w(this,"skipVerification",!1);w(this,"skipValidation",!1);w(this,"relayFilters");w(this,"relaySet");w(this,"ndk");w(this,"debug");w(this,"eoseDebug");w(this,"eventFirstSeen",new Map);w(this,"eosesSeen",new Set);w(this,"eventsPerRelay",new Map);w(this,"lastEventReceivedAt");w(this,"internalId");w(this,"eoseTimeout");if(this.ndk=t,this.pool=(r==null?void 0:r.pool)||t.pool,this.opts={...defaultOpts,...r||{}},this.filters=n instanceof Array?n:[n],this.subId=s||(r==null?void 0:r.subId),this.internalId=Math.random().toString(36).substring(7),this.relaySet=o,this.debug=t.debug.extend(`subscription[${(r==null?void 0:r.subId)??this.internalId}]`),this.eoseDebug=this.debug.extend("eose"),this.skipVerification=(r==null?void 0:r.skipVerification)||!1,this.skipValidation=(r==null?void 0:r.skipValidation)||!1,this.opts.closeOnEose||this.debug("Creating a permanent subscription",this.opts,JSON.stringify(this.filters)),this.opts.cacheUsage==="ONLY_CACHE"&&!this.opts.closeOnEose)throw new Error("Cannot use cache-only options with a persistent subscription")}get filter(){return this.filters[0]}isGroupable(){var t;return((t=this.opts)==null?void 0:t.groupable)||!1}shouldQueryCache(){var t;return((t=this.opts)==null?void 0:t.cacheUsage)!=="ONLY_RELAY"}shouldQueryRelays(){var t;return((t=this.opts)==null?void 0:t.cacheUsage)!=="ONLY_CACHE"}shouldWaitForCache(){var t;return this.opts.closeOnEose&&!!((t=this.ndk.cacheAdapter)!=null&&t.locking)&&this.opts.cacheUsage!=="PARALLEL"}async start(){let t;this.shouldQueryCache()&&(t=this.startWithCache(),this.shouldWaitForCache()&&(await t,queryFullyFilled(this)))?this.emit("eose",this):this.shouldQueryRelays()?this.startWithRelays():this.emit("eose",this)}stop(){this.emit("close",this),this.removeAllListeners()}hasAuthorsFilter(){return this.filters.some(t=>{var n;return(n=t.authors)==null?void 0:n.length})}async startWithCache(){var t;if((t=this.ndk.cacheAdapter)!=null&&t.query){const n=this.ndk.cacheAdapter.query(this);this.ndk.cacheAdapter.locking&&await n}}startWithRelays(){if(this.relaySet){this.relayFilters=new Map;for(const t of this.relaySet.relays)this.relayFilters.set(t.url,this.filters)}else this.relayFilters=calculateRelaySetsFromFilters(this.ndk,this.filters);if(this.relayFilters&&this.relayFilters.size!==0)for(const[t,n]of this.relayFilters)this.pool.getRelay(t).subscribe(this,n);else this.debug("No relays to subscribe to",this.ndk.explicitRelayUrls)}eventReceived(t,n,r=!1){if(n&&(t.relay=n),n||(n=t.relay),this.skipValidation||t.isValid){if(!r&&n){let o=this.eventsPerRelay.get(n);if(o||(o=new Set,this.eventsPerRelay.set(n,o)),o.add(t.id),this.eventFirstSeen.has(t.id)){const s=Date.now()-(this.eventFirstSeen.get(t.id)||0);return n.scoreSlowerEvent(s),void this.emit("event:dup",t,n,s,this)}this.ndk.cacheAdapter&&this.ndk.cacheAdapter.setEvent(t,this.filters,n),this.eventFirstSeen.set(t.id,Date.now())}else this.eventFirstSeen.set(t.id,0);t.ndk||(t.ndk=this.ndk),this.emit("event",t,n,this),this.lastEventReceivedAt=Date.now()}else this.debug("Event failed validation",t)}eoseReceived(t){var o,s,i;this.eosesSeen.add(t),this.eoseDebug(`received from ${t.url}`);let n=this.lastEventReceivedAt?Date.now()-this.lastEventReceivedAt:void 0;const r=this.eosesSeen.size===((o=this.relayFilters)==null?void 0:o.size);if(queryFullyFilled(this))this.emit("eose"),this.eoseDebug("Query fully filled"),(s=this.opts)!=null&&s.closeOnEose&&this.stop();else if(r)this.emit("eose"),this.eoseDebug("All EOSEs seen"),(i=this.opts)!=null&&i.closeOnEose&&this.stop();else{let a=1e3;const l=this.eosesSeen.size/this.relayFilters.size;if(this.eosesSeen.size>=2&&l>=.5){a*=1-l,this.eoseTimeout&&clearTimeout(this.eoseTimeout);const c=()=>{var d;n=this.lastEventReceivedAt?Date.now()-this.lastEventReceivedAt:void 0,n!==void 0&&n<20?this.eoseTimeout=setTimeout(c,a):(this.emit("eose"),(d=this.opts)!=null&&d.closeOnEose&&this.stop())};this.eoseTimeout=setTimeout(c,a)}}}};async function follows(e,t,n=3){if(!this.ndk)throw new Error("NDK not set");const r=Array.from(await this.ndk.fetchEvents({kinds:[n],authors:[this.pubkey]},e||{groupable:!1}))[0];if(r){const o=new Set;return r.tags.forEach(s=>{var i,a;if(s[0]==="p")try{o.add(s[1]),t&&((a=(i=this.ndk)==null?void 0:i.outboxTracker)==null||a.trackUsers([s[1]]))}catch{}}),[...o].reduce((s,i)=>{const a=new NDKUser({pubkey:i});return a.ndk=this.ndk,s.add(a),s},new Set)}return new Set}function profileFromEvent(e){const t={};let n;try{n=JSON.parse(e.content)}catch(r){throw new Error(`Failed to parse profile event: ${r}`)}return Object.keys(n).forEach(r=>{switch(r){case"name":t.name=n.name;break;case"display_name":t.displayName=n.display_name;break;case"image":case"picture":t.image=n.image||n.picture;break;case"banner":t.banner=n.banner;break;case"bio":t.bio=n.bio;break;case"nip05":t.nip05=n.nip05;break;case"lud06":t.lud06=n.lud06;break;case"lud16":t.lud16=n.lud16;break;case"about":t.about=n.about;break;case"zapService":t.zapService=n.zapService;break;case"website":t.website=n.website;break;default:t[r]=n[r]}}),t}function serializeProfile(e){const t={};for(const[n,r]of Object.entries(e))switch(n){case"username":case"name":t.name=r;break;case"displayName":t.display_name=r;break;case"image":case"picture":t.picture=r;break;case"bio":case"about":t.about=r;break;default:t[n]=r}return JSON.stringify(t)}var NDKList=class ce extends NDKEvent{constructor(n,r){super(n,r);w(this,"_encryptedTags");w(this,"encryptedTagsLength");this.kind??(this.kind=30001)}static from(n){return new ce(n.ndk,n.rawEvent())}get title(){const n=this.tagValue("title")||this.tagValue("name");return this.kind!==3||n?this.kind!==1e4||n?this.kind!==10001||n?this.kind!==10002||n?this.kind!==10003||n?this.kind!==10004||n?this.kind!==10005||n?this.kind!==10006||n?this.kind!==10007||n?this.kind!==10015||n?this.kind!==10030||n?n??this.tagValue("d"):"Emojis":"Interests":"Search Relays":"Blocked Relays":"Public Chats":"Communities":"Bookmarks":"Relay Metadata":"Pinned Notes":"Mute":"Contacts"}set title(n){if(this.removeTag("title"),this.removeTag("name"),!n)throw new Error("Title cannot be empty");this.tags.push(["title",n])}get name(){const n=this.tagValue("name");return this.kind!==3||n?this.kind!==1e4||n?this.kind!==10001||n?this.kind!==10002||n?this.kind!==10003||n?this.kind!==10004||n?this.kind!==10005||n?this.kind!==10006||n?this.kind!==10007||n?this.kind!==10015||n?this.kind!==10030||n?n??this.tagValue("d"):"Emojis":"Interests":"Search Relays":"Blocked Relays":"Public Chats":"Communities":"Bookmarks":"Relay Metadata":"Pinned Notes":"Mute":"Contacts"}set name(n){if(this.removeTag("name"),!n)throw new Error("Name cannot be empty");this.tags.push(["title",n])}get description(){return this.tagValue("description")}set description(n){n?this.tags.push(["description",n]):this.removeTag("description")}isEncryptedTagsCacheValid(){return!(!this._encryptedTags||this.encryptedTagsLength!==this.content.length)}async encryptedTags(n=!0){if(n&&this.isEncryptedTagsCacheValid())return this._encryptedTags;if(!this.ndk)throw new Error("NDK instance not set");if(!this.ndk.signer)throw new Error("NDK signer not set");const r=await this.ndk.signer.user();try{if(this.content.length>0)try{const o=await this.ndk.signer.decrypt(r,this.content),s=JSON.parse(o);return s&&s[0]?(this.encryptedTagsLength=this.content.length,this._encryptedTags=s):(this.encryptedTagsLength=this.content.length,this._encryptedTags=[])}catch{console.log(`error decrypting ${this.content}`)}}catch{}return[]}validateTag(n){return!0}get items(){return this.tags.filter(n=>!["d","L","l","title","name","description","summary","image","thumb","alt","expiration","subject"].includes(n[0]))}async addItem(n,r=void 0,o=!1){if(!this.ndk)throw new Error("NDK instance not set");if(!this.ndk.signer)throw new Error("NDK signer not set");let s;if(n instanceof NDKEvent)s=n.referenceTags();else if(n instanceof NDKUser)s=n.referenceTags();else if(n instanceof NDKRelay)s=n.referenceTags();else{if(!Array.isArray(n))throw new Error("Invalid object type");s=[n]}if(r&&s[0].push(r),o){const i=await this.ndk.signer.user(),a=await this.encryptedTags();a.push(...s),this._encryptedTags=a,this.encryptedTagsLength=this.content.length,this.content=JSON.stringify(a),await this.encrypt(i)}else this.tags.push(...s);this.created_at=Math.floor(Date.now()/1e3),this.emit("change")}async removeItem(n,r){if(!this.ndk)throw new Error("NDK instance not set");if(!this.ndk.signer)throw new Error("NDK signer not set");if(r){const o=await this.ndk.signer.user(),s=await this.encryptedTags();s.splice(n,1),this._encryptedTags=s,this.encryptedTagsLength=this.content.length,this.content=JSON.stringify(s),await this.encrypt(o)}else this.tags.splice(n,1);return this.created_at=Math.floor(Date.now()/1e3),this.emit("change"),this}},lists_default=NDKList;async function pin(e,t,n){if(!this.ndk)throw new Error("No NDK instance found");if(this.ndk.assertSigner(),!t){const r=await this.ndk.fetchEvents({kinds:[10001],authors:[this.pubkey]},{cacheUsage:"ONLY_RELAY"});t=r.size>0?lists_default.from(Array.from(r)[0]):new NDKEvent(this.ndk,{kind:10001})}return t.tag(e),n&&await t.publish(),t}var NIP05_REGEX=/^(?:([\w.+-]+)@)?([\w.-]+)$/;async function getNip05For(e,t=fetch,n={}){const r=e.match(NIP05_REGEX);if(!r)return null;const[o,s="_",i]=r;try{const a=await t(`https://${i}/.well-known/nostr.json?name=${s}`,n),{names:l,relays:c,nip46:d}=parseNIP05Result(await a.json()),p=l[s];return p?{pubkey:p,relays:c==null?void 0:c[p],nip46:d==null?void 0:d[p]}:null}catch{return null}}function parseNIP05Result(e){const t={names:{}};for(const[n,r]of Object.entries(e.names))typeof n=="string"&&typeof r=="string"&&(t.names[n]=r);if(e.relays){t.relays={};for(const[n,r]of Object.entries(e.relays))typeof n=="string"&&Array.isArray(r)&&(t.relays[n]=r.filter(o=>typeof o=="string"))}if(e.nip46){t.nip46={};for(const[n,r]of Object.entries(e.relays))typeof n=="string"&&Array.isArray(r)&&(t.nip46[n]=r.filter(o=>typeof o=="string"))}return t}var NDKUser=class ne{constructor(t){w(this,"ndk");w(this,"profile");w(this,"_npub");w(this,"_pubkey");w(this,"relayUrls",[]);w(this,"nip46Urls",[]);w(this,"follows",follows.bind(this));w(this,"pin",pin.bind(this));t.npub&&(this._npub=t.npub),t.hexpubkey&&(this._pubkey=t.hexpubkey),t.pubkey&&(this._pubkey=t.pubkey),t.relayUrls&&(this.relayUrls=t.relayUrls),t.nip46Urls&&(this.nip46Urls=t.nip46Urls)}get npub(){if(!this._npub){if(!this._pubkey)throw new Error("hexpubkey not set");this._npub=nip19_exports.npubEncode(this.pubkey)}return this._npub}set npub(t){this._npub=t}get hexpubkey(){return this.pubkey}set hexpubkey(t){this._pubkey=t}get pubkey(){if(!this._pubkey){if(!this._npub)throw new Error("npub not set");this._pubkey=nip19_exports.decode(this.npub).data}return this._pubkey}set pubkey(t){this._pubkey=t}static async fromNip05(t,n,r=!1){if(n!=null&&n.cacheAdapter&&n.cacheAdapter.loadNip05){const i=await n.cacheAdapter.loadNip05(t);if(i){const a=new ne({pubkey:i.pubkey,relayUrls:i.relays,nip46Urls:i.nip46});return a.ndk=n,a}}let o={};r&&(o.cache="no-cache");const s=await getNip05For(t,n==null?void 0:n.httpFetch,o);if(s&&(n!=null&&n.cacheAdapter)&&n.cacheAdapter.saveNip05&&(n==null||n.cacheAdapter.saveNip05(t,s)),s){const i=new ne({pubkey:s.pubkey,relayUrls:s.relays,nip46Urls:s.nip46});return i.ndk=n,i}}async fetchProfile(t){if(!this.ndk)throw new Error("NDK not set");this.profile||(this.profile={});let n=null;if(this.ndk.cacheAdapter&&this.ndk.cacheAdapter.fetchProfile&&(t==null?void 0:t.cacheUsage)!=="ONLY_RELAY"){const o=await this.ndk.cacheAdapter.fetchProfile(this.pubkey);if(o)return this.profile=o,o}!t&&this.ndk.cacheAdapter&&this.ndk.cacheAdapter.locking&&(n=await this.ndk.fetchEvents({kinds:[0],authors:[this.pubkey]},{cacheUsage:"ONLY_CACHE",closeOnEose:!0,groupable:!1}),t={cacheUsage:"ONLY_RELAY",closeOnEose:!0,groupable:!0,groupableDelay:250}),n&&n.size!==0||(n=await this.ndk.fetchEvents({kinds:[0],authors:[this.pubkey]},t));const r=Array.from(n).sort((o,s)=>o.created_at-s.created_at);return r.length===0?null:(this.profile=profileFromEvent(r[0]),this.profile&&this.ndk.cacheAdapter&&this.ndk.cacheAdapter.saveProfile&&this.ndk.cacheAdapter.saveProfile(this.pubkey,this.profile),this.profile)}async relayList(){if(!this.ndk)throw new Error("NDK not set");const t=this.ndk.outboxPool||this.ndk.pool,n=new Set;for(const s of t.relays.values())n.add(s);const r=new NDKRelaySet(n,this.ndk),o=await this.ndk.fetchEvent({kinds:[10002],authors:[this.pubkey]},{closeOnEose:!0,pool:t,groupable:!0,subId:`relay-list-${this.pubkey.slice(0,6)}`},r);return o?NDKRelayList.from(o):await this.relayListFromKind3()}async relayListFromKind3(){if(!this.ndk)throw new Error("NDK not set");const t=await this.ndk.fetchEvent({kinds:[3],authors:[this.pubkey]});if(t)try{const n=JSON.parse(t.content),r=new NDKRelayList(this.ndk),o=new Set,s=new Set;for(const[i,a]of Object.entries(n))if(a){const l=a;l.write&&s.add(i),l.read&&o.add(i)}else o.add(i),s.add(i);return r.readRelayUrls=Array.from(o),r.writeRelayUrls=Array.from(s),r}catch{}}tagReference(){return["p",this.pubkey]}referenceTags(t){const n=[["p",this.pubkey]];return t&&n[0].push("",t),n}async publish(){if(!this.ndk)throw new Error("No NDK instance found");if(!this.profile)throw new Error("No profile available");this.ndk.assertSigner(),await new NDKEvent(this.ndk,{kind:0,content:serializeProfile(this.profile)}).publish()}async follow(t,n,r=3){if(!this.ndk)throw new Error("No NDK instance found");if(this.ndk.assertSigner(),n||(n=await this.follows(void 0,void 0,r)),n.has(t))return!1;n.add(t);const o=new NDKEvent(this.ndk,{kind:r});for(const s of n)o.tag(s);return await o.publish(),!0}async validateNip05(t){if(!this.ndk)throw new Error("No NDK instance found");const n=await getNip05For(t);return n===null?null:n.pubkey===this.pubkey}async zap(t,n,r,o){if(!this.ndk)throw new Error("No NDK instance found");o||this.ndk.assertSigner();const s=new Zap({ndk:this.ndk,zappedUser:this}),i=Array.from(this.ndk.pool.relays.keys());return await s.createZapRequest(t,n,r,i,o)}},NDKPrivateKeySigner=class de{constructor(t){w(this,"_user");w(this,"privateKey");t&&(this.privateKey=t,this._user=new NDKUser({hexpubkey:getPublicKey(this.privateKey)}))}static generate(){const t=generatePrivateKey();return new de(t)}async blockUntilReady(){if(!this._user)throw new Error("NDKUser not initialized");return this._user}async user(){return await this.blockUntilReady(),this._user}async sign(t){if(!this.privateKey)throw Error("Attempted to sign without a private key");return getSignature(t,this.privateKey)}async encrypt(t,n){if(!this.privateKey)throw Error("Attempted to encrypt without a private key");const r=t.hexpubkey;return await nip04_exports.encrypt(this.privateKey,r,n)}async decrypt(t,n){if(!this.privateKey)throw Error("Attempted to decrypt without a private key");const r=t.hexpubkey;return await nip04_exports.decrypt(this.privateKey,r,n)}},NDKNostrRpc=class extends lib$1.EventEmitter{constructor(t,n,r){super();w(this,"ndk");w(this,"signer");w(this,"debug");this.ndk=t,this.signer=n,this.debug=r.extend("rpc")}subscribe(t){const n=this.ndk.subscribe(t,{closeOnEose:!1,groupable:!1});return n.on("event",async r=>{try{const o=await this.parseEvent(r);o.method?this.emit("request",o):this.emit(`response-${o.id}`,o)}catch(o){this.debug("error parsing event",o,r.rawEvent())}}),new Promise((r,o)=>{n.on("eose",()=>r(n))})}async parseEvent(t){const n=this.ndk.getUser({hexpubkey:t.pubkey});n.ndk=this.ndk;const r=await this.signer.decrypt(n,t.content),o=JSON.parse(r),{id:s,method:i,params:a,result:l,error:c}=o;return i?{id:s,pubkey:t.pubkey,method:i,params:a,event:t}:{id:s,result:l,error:c,event:t}}async sendResponse(t,n,r,o=24133,s){const i={id:t,result:r};s&&(i.error=s);const a=await this.signer.user(),l=this.ndk.getUser({hexpubkey:n}),c=new NDKEvent(this.ndk,{kind:o,content:JSON.stringify(i),tags:[["p",n]],pubkey:a.hexpubkey});c.content=await this.signer.encrypt(l,c.content),await c.sign(this.signer),await c.publish()}async sendRequest(t,n,r=[],o=24133,s){const i=Math.random().toString(36).substring(7),a=await this.signer.user(),l=this.ndk.getUser({hexpubkey:t}),c={id:i,method:n,params:r},d=new Promise(g=>{const v=x=>{x.result==="auth_url"?(this.once(`response-${i}`,v),this.emit("authUrl",x.error)):s&&s(x)};this.once(`response-${i}`,v)}),p=new NDKEvent(this.ndk,{kind:o,content:JSON.stringify(c),tags:[["p",t]],pubkey:a.pubkey});return p.content=await this.signer.encrypt(l,p.content),await p.sign(this.signer),this.debug(`sending ${n} request to`,t),await p.publish(),d}},NDKNip46Signer=class extends lib$1.EventEmitter{constructor(t,n,r){let o,s;super();w(this,"ndk");w(this,"remoteUser");w(this,"remotePubkey");w(this,"token");w(this,"localSigner");w(this,"nip05");w(this,"rpc");w(this,"debug");w(this,"relayUrls",[]);if(n.includes("#")){const i=n.split("#");o=new NDKUser({npub:i[0]}).pubkey,s=i[1]}else n.startsWith("npub")?o=new NDKUser({npub:n}).pubkey:n.match(/\./)?this.nip05=n:o=n;this.ndk=t,o&&(this.remotePubkey=o),this.token=s,this.debug=t.debug.extend("nip46:signer"),this.remoteUser=new NDKUser({pubkey:o}),this.localSigner=r||NDKPrivateKeySigner.generate(),this.rpc=new NDKNostrRpc(t,this.localSigner,this.debug),this.rpc.on("authUrl",(...i)=>{this.emit("authUrl",...i)}),this.localSigner.user().then(i=>{this.rpc.subscribe({kinds:[24133,24134],"#p":[i.pubkey]})})}async user(){return this.remoteUser}async blockUntilReady(){const t=await this.localSigner.user(),n=this.ndk.getUser({pubkey:this.remotePubkey});if(this.nip05&&!this.remotePubkey&&NDKUser.fromNip05(this.nip05).then(r=>{r&&(this.remoteUser=r,this.remotePubkey=r.pubkey,this.relayUrls=r.nip46Urls)}),!this.remotePubkey)throw new Error("Remote pubkey not set");return new Promise((r,o)=>{setTimeout(()=>{const s=[t.pubkey];this.token&&s.push(this.token),this.rpc.sendRequest(this.remotePubkey,"connect",s,24133,i=>{i.result==="ack"?r(n):o(i.error)})},100)})}async encrypt(t,n){return this.debug("asking for encryption"),new Promise((r,o)=>{this.rpc.sendRequest(this.remotePubkey,"nip04_encrypt",[t.pubkey,n],24133,s=>{s.error?o(s.error):r(s.result)})})}async decrypt(t,n){return this.debug("asking for decryption"),new Promise((r,o)=>{this.rpc.sendRequest(this.remotePubkey,"nip04_decrypt",[t.pubkey,n],24133,s=>{if(s.error)o(s.error);else{const i=JSON.parse(s.result);r(i[0])}})})}async sign(t){return this.debug("asking for a signature"),new Promise((n,r)=>{this.rpc.sendRequest(this.remotePubkey,"sign_event",[JSON.stringify(t)],24133,o=>{if(this.debug("got a response",o),o.error)r(o.error);else{const s=JSON.parse(o.result);n(s.sig)}})})}async createAccount(t,n,r){this.debug("asking to create an account");const o=[];return t&&o.push(t),n&&o.push(n),r&&o.push(r),new Promise((s,i)=>{this.rpc.sendRequest(this.remotePubkey,"create_account",o,24134,a=>{if(this.debug("got a response",a),a.error)i(a.error);else{const l=a.result;s(l)}})})}};function dedup(e,t){return e.created_at>t.created_at?e:t}var OutboxItem=class{constructor(e){w(this,"type");w(this,"relayUrlScores");w(this,"readRelays");w(this,"writeRelays");this.type=e,this.relayUrlScores=new Map,this.readRelays=new Set,this.writeRelays=new Set}},OutboxTracker=class extends lib$1.EventEmitter{constructor(t){super();w(this,"data");w(this,"ndk");w(this,"debug");this.ndk=t,this.debug=t.debug.extend("outbox-tracker"),this.data=new dist.LRUCache({maxSize:1e5,entryExpirationTimeInMS:5e3})}trackUsers(t){for(const n of t){const r=getKeyFromItem(n);if(this.data.has(r))continue;const o=this.track(n,"user"),s=n instanceof NDKUser?n:new NDKUser({hexpubkey:n});s.ndk=this.ndk,s.relayList().then(i=>{if(i){o.readRelays=new Set(i.readRelayUrls),o.writeRelays=new Set(i.writeRelayUrls);for(const a of o.readRelays)this.ndk.pool.blacklistRelayUrls.has(a)&&(this.debug(`removing blacklisted relay ${a} from read relays`),o.readRelays.delete(a));for(const a of o.writeRelays)this.ndk.pool.blacklistRelayUrls.has(a)&&(this.debug(`removing blacklisted relay ${a} from write relays`),o.writeRelays.delete(a));this.data.set(r,o),this.debug(`Adding ${o.readRelays.size} read relays and ${o.writeRelays.size} write relays for ${s.hexpubkey}`)}})}}track(t,n){const r=getKeyFromItem(t);n??(n=getTypeFromItem(t));let o=this.data.get(r);return o||(o=new OutboxItem(n)),this.data.set(r,o),o}};function getKeyFromItem(e){return e instanceof NDKUser?e.hexpubkey:e}function getTypeFromItem(e){return e instanceof NDKUser?"user":"kind"}var NDKPool=class extends lib$1.EventEmitter{constructor(t=[],n=[],r,o){super();w(this,"relays",new Map);w(this,"blacklistRelayUrls");w(this,"debug");w(this,"temporaryRelayTimers",new Map);w(this,"flappingRelays",new Set);w(this,"backoffTimes",new Map);this.debug=o??r.debug.extend("pool");for(const s of t){const i=new NDKRelay(s);this.addRelay(i,!1)}this.blacklistRelayUrls=new Set(n)}useTemporaryRelay(t,n=6e5){const r=this.relays.has(t.url);r||this.addRelay(t);const o=this.temporaryRelayTimers.get(t.url);if(o&&clearTimeout(o),!r||o){const s=setTimeout(()=>{this.removeRelay(t.url)},n);this.temporaryRelayTimers.set(t.url,s)}}addRelay(t,n=!0){var o;const r=t.url;(o=this.blacklistRelayUrls)!=null&&o.has(r)?this.debug(`Relay ${r} is blacklisted`):(t.on("notice",async(s,i)=>this.emit("notice",s,i)),t.on("connect",()=>this.handleRelayConnect(r)),t.on("ready",()=>this.handleRelayReady(t)),t.on("disconnect",async()=>this.emit("relay:disconnect",t)),t.on("flapping",()=>this.handleFlapping(t)),t.on("auth",async s=>this.emit("relay:auth",t,s)),this.relays.set(r,t),n&&t.connect().catch(s=>{this.debug(`Failed to connect to relay ${r}`,s)}))}removeRelay(t){const n=this.relays.get(t);if(n)return n.disconnect(),this.relays.delete(t),this.emit("relay:disconnect",n),!0;const r=this.temporaryRelayTimers.get(t);return r&&(clearTimeout(r),this.temporaryRelayTimers.delete(t)),!1}getRelay(t,n=!0){let r=this.relays.get(t);return r||(r=new NDKRelay(t),this.addRelay(r,n)),r}handleRelayConnect(t){this.debug(`Relay ${t} connected`),this.emit("relay:connect",this.relays.get(t)),this.stats().connected===this.relays.size&&this.emit("connect")}handleRelayReady(t){this.debug(`Relay ${t.url} ready`),this.emit("relay:ready",t)}async connect(t){const n=[];this.debug(`Connecting to ${this.relays.size} relays${t?`, timeout ${t}...`:""}`);for(const r of this.relays.values())if(t){const o=new Promise((s,i)=>{setTimeout(()=>i(`Timed out after ${t}ms`),t)});n.push(Promise.race([r.connect(),o]).catch(s=>{this.debug(`Failed to connect to relay ${r.url}: ${s??"No reason specified"}`)}))}else n.push(r.connect());t&&setTimeout(()=>{const r=this.stats().connected===this.relays.size,o=this.stats().connected>0;!r&&o&&this.emit("connect")},t),await Promise.all(n)}checkOnFlappingRelays(){if(this.flappingRelays.size/this.relays.size>=.8)for(const t of this.flappingRelays)this.backoffTimes.set(t,0)}handleFlapping(t){this.debug(`Relay ${t.url} is flapping`);let n=this.backoffTimes.get(t.url)||5e3;n*=2,this.backoffTimes.set(t.url,n),this.debug(`Backoff time for ${t.url} is ${n}ms`),setTimeout(()=>{this.debug(`Attempting to reconnect to ${t.url}`),t.connect(),this.checkOnFlappingRelays()},n),t.disconnect(),this.emit("flapping",t)}size(){return this.relays.size}stats(){const t={total:0,connected:0,disconnected:0,connecting:0};for(const n of this.relays.values())t.total++,n.status===1?t.connected++:n.status===3?t.disconnected++:n.status===0&&t.connecting++;return t}connectedRelays(){return Array.from(this.relays.values()).filter(t=>t.status===1)}urls(){return Array.from(this.relays.keys())}};function correctRelaySet(e,t){const n=t.connectedRelays();if(!Array.from(e.relays).some(r=>n.map(o=>o.url).includes(r.url)))for(const r of n)e.addRelay(r);if(n.length===0)for(const r of t.relays.values())e.addRelay(r);return e}var SPEC_PATH="/.well-known/nostr/nip96.json",Nip96=class{constructor(e,t){w(this,"ndk");w(this,"spec");w(this,"url");w(this,"nip98Required",!1);this.url=`https://${e}${SPEC_PATH}`,this.ndk=t}async prepareUpload(e,t="POST"){if(this.validateHttpFetch(),this.spec||await this.fetchSpec(),!this.spec)throw new Error("Failed to fetch NIP96 spec");let n={};return this.nip98Required&&(n={Authorization:await this.generateNip98Header(this.spec.api_url,t,e)}),{url:this.spec.api_url,headers:n}}async xhrUpload(e,t){const n="POST",{url:r,headers:o}=await this.prepareUpload(t,n);e.open(n,r,!0),o.Authorization&&e.setRequestHeader("Authorization",o.Authorization);const s=new FormData;return s.append("file",t),new Promise((i,a)=>{e.onload=function(){e.status>=200&&e.status<300?i(JSON.parse(e.responseText)):a(new Error(e.statusText))},e.onerror=function(){a(new Error("Network Error"))},e.send(s)})}async upload(e){const t="POST",{url:n,headers:r}=await this.prepareUpload(e,t),o=new FormData;o.append("file",e);const s=await this.ndk.httpFetch(this.spec.api_url,{method:t,headers:r,body:o});if(s.status!==200)throw new Error(`Failed to upload file to ${n}`);const i=await s.json();if(i.status!=="success")throw new Error(i.message);return i}validateHttpFetch(){if(!this.ndk)throw new Error("NDK is required to fetch NIP96 spec");if(!this.ndk.httpFetch)throw new Error("NDK must have an httpFetch method to fetch NIP96 spec")}async fetchSpec(){this.validateHttpFetch();const e=await this.ndk.httpFetch(this.url);if(e.status!==200)throw new Error(`Failed to fetch NIP96 spec from ${this.url}`);const t=await e.json();if(!t)throw new Error(`Failed to parse NIP96 spec from ${this.url}`);this.spec=t,this.nip98Required=this.spec.plans.free.is_nip98_required}async generateNip98Header(e,t,n){const r=new NDKEvent(this.ndk,{kind:27235,tags:[["u",e],["method",t]]});if(["POST","PUT","PATCH"].includes(t)){const o=await this.calculateSha256(n);r.tags.push(["payload",o])}return await r.sign(),`Nostr ${btoa(JSON.stringify(r.rawEvent()))}`}async calculateSha256(e){const t=await e.arrayBuffer(),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(r=>r.toString(16).padStart(2,"0")).join("")}},DEFAULT_OUTBOX_RELAYS=["wss://purplepag.es","wss://relay.snort.social"],DEFAULT_BLACKLISTED_RELAYS=["wss://brb.io"],NDK=class extends lib$1.EventEmitter{constructor(t={}){super();w(this,"explicitRelayUrls");w(this,"pool");w(this,"outboxPool");w(this,"_signer");w(this,"_activeUser");w(this,"cacheAdapter");w(this,"debug");w(this,"devWriteRelaySet");w(this,"outboxTracker");w(this,"mutedIds");w(this,"clientName");w(this,"clientNip89");w(this,"relayAuthDefaultPolicy");w(this,"httpFetch");w(this,"autoConnectUserRelays",!0);w(this,"autoFetchUserMutelist",!0);this.debug=t.debug||debug3("ndk"),this.explicitRelayUrls=t.explicitRelayUrls||[],this.pool=new NDKPool(t.explicitRelayUrls||[],t.blacklistRelayUrls,this),this.debug(`Starting with explicit relays: ${JSON.stringify(this.explicitRelayUrls)}`),this.pool.on("relay:auth",async(n,r)=>{this.relayAuthDefaultPolicy&&await this.relayAuthDefaultPolicy(n,r)}),this.autoConnectUserRelays=t.autoConnectUserRelays??!0,this.autoFetchUserMutelist=t.autoFetchUserMutelist??!0,this.clientName=t.clientName,this.clientNip89=t.clientNip89,this.relayAuthDefaultPolicy=t.relayAuthDefaultPolicy,t.enableOutboxModel&&(this.outboxPool=new NDKPool(t.outboxRelayUrls||DEFAULT_OUTBOX_RELAYS,t.blacklistRelayUrls||DEFAULT_BLACKLISTED_RELAYS,this,this.debug.extend("outbox-pool")),this.outboxTracker=new OutboxTracker(this)),this.signer=t.signer,this.cacheAdapter=t.cacheAdapter,this.mutedIds=t.mutedIds||new Map,t.devWriteRelayUrls&&(this.devWriteRelaySet=NDKRelaySet.fromRelayUrls(t.devWriteRelayUrls,this));try{this.httpFetch=fetch}catch{}}addExplicitRelay(t,n,r=!0){let o;return o=typeof t=="string"?new NDKRelay(t,n):t,this.pool.addRelay(o,r),this.explicitRelayUrls.push(o.url),o}toJSON(){return{relayCount:this.pool.relays.size}.toString()}get activeUser(){return this._activeUser}set activeUser(t){var r;const n=((r=this._activeUser)==null?void 0:r.pubkey)!==(t==null?void 0:t.pubkey);if(this._activeUser=t,t&&n){const o=async c=>{const d=await c.relayList();if(d){this.debug("Connecting to user relays",{npub:c.npub,relays:d.relays});for(const p of d.relays){let g=this.pool.relays.get(p);g||(g=new NDKRelay(p),this.pool.addRelay(g))}}else this.debug("No relay list found for user",{npub:c.npub})},s=async c=>{const d=await this.fetchEvents([{kinds:[1e4],authors:[c.pubkey]},{kinds:[3e4],authors:[c.pubkey],"#d":["mute"],limit:1}]);if(d)for(const p of d){const g=lists_default.from(p);for(const v of g.items)this.mutedIds.set(v[1],v[0])}else this.debug("No mute list found for user",{npub:c.npub})},i=[];this.autoConnectUserRelays&&i.push(o),this.autoFetchUserMutelist&&i.push(s);const a=async c=>{for(const d of i)await d(c)},l=this.outboxPool||this.pool;l.connectedRelays.length>0?a(t):(this.debug("Waiting for connection to main relays"),l.once("relay:ready",c=>{this.debug("New relay ready",c==null?void 0:c.url),a(t)}))}else t||(this.mutedIds=new Map)}get signer(){return this._signer}set signer(t){this._signer=t,this.emit("signer:ready",t),t==null||t.user().then(n=>{n.ndk=this,this.activeUser=n})}async connect(t){this._signer&&this.autoConnectUserRelays&&(this.debug("Attempting to connect to user relays specified by signer"),this._signer.relays)&&(await this._signer.relays()).forEach(r=>this.pool.addRelay(r));const n=[this.pool.connect(t)];return this.outboxPool&&n.push(this.outboxPool.connect(t)),this.debug("Connecting to relays",{timeoutMs:t}),Promise.allSettled(n).then(()=>{})}getUser(t){const n=new NDKUser(t);return n.ndk=this,n}async getUserFromNip05(t,n=!1){return NDKUser.fromNip05(t,this,n)}subscribe(t,n,r,o=!0){var i;const s=new NDKSubscription(this,t,n,r);if(r)for(const a of r.relays)this.pool.useTemporaryRelay(a);if(this.outboxPool&&s.hasAuthorsFilter()){const a=s.filters.filter(l=>{var c;return l.authors&&((c=l.authors)==null?void 0:c.length)>0}).map(l=>l.authors).flat();(i=this.outboxTracker)==null||i.trackUsers(a)}return o&&s.start(),s}async publish(t,n,r){return this.debug("Deprecated: Use `event.publish()` instead"),t.publish(n,r)}async fetchEvent(t,n,r){let o,s;if(r instanceof NDKRelay?s=new NDKRelaySet(new Set([r]),this):r instanceof NDKRelaySet&&(s=r),!r&&typeof t=="string"&&!isNip33AValue(t)){const i=relaysFromBech32(t);i.length>0&&(s=new NDKRelaySet(new Set(i),this),s=correctRelaySet(s,this.pool))}if(o=typeof t=="string"?filterFromId(t):t,!o)throw new Error(`Invalid filter: ${JSON.stringify(t)}`);return new Promise(i=>{const a=this.subscribe(o,{...n||{},closeOnEose:!0},s,!1);a.on("event",l=>{l.ndk=this,i(l)}),a.on("eose",()=>{i(null)}),a.start()})}async fetchEvents(t,n,r){return new Promise(o=>{const s=new Map,i=this.subscribe(t,{...n||{},closeOnEose:!0},r,!1),a=l=>{const c=l.deduplicationKey(),d=s.get(c);d&&(l=dedup(d,l)),l.ndk=this,s.set(c,l)};i.on("event",a),i.on("event:dup",a),i.on("eose",()=>{o(new Set(s.values()))}),i.start()})}assertSigner(){if(!this.signer)throw this.emit("signerRequired"),new Error("Signer required")}getNip96(t){return new Nip96(t,this)}};const LOCAL_STORE_KEY="__nostrlogin_nip46",LOGGED_IN_ACCOUNTS="__nostrlogin_accounts",RECENT_ACCOUNTS="__nostrlogin_recent",OUTBOX_RELAYS$1=["wss://purplepag.es","wss://relay.nos.social","wss://user.kindpag.es","wss://relay.damus.io","wss://nos.lol"],DEFAULT_SIGNUP_RELAYS=["wss://relay.damus.io/","wss://nos.lol/","wss://relay.primal.net/"],localStorageSetItem=(e,t)=>{localStorage.setItem(e,t)},localStorageGetItem=e=>{const t=window.localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch{}return null},localStorageRemoveItem=e=>{localStorage.removeItem(e)},fetchProfile=async(e,t)=>{const n=new NDKUser({pubkey:e.pubkey});return n.ndk=t,await n.fetchProfile()},prepareSignupRelays=e=>{const t=(e||"").split(",").map(n=>n.trim()).filter(n=>n.startsWith("ws"));return t.length||t.push(...DEFAULT_SIGNUP_RELAYS),t},createProfile=async(e,t,n,r,o)=>{const s={name:e.name},i=new NDKEvent(t,{kind:0,created_at:Math.floor(Date.now()/1e3),pubkey:e.pubkey,content:JSON.stringify(s),tags:[]});window.location.hostname&&i.tags.push(["client",window.location.hostname]);const a=new NDKEvent(t,{kind:10002,created_at:Math.floor(Date.now()/1e3),pubkey:e.pubkey,content:"",tags:[]}),l=prepareSignupRelays(r);for(const d of l)a.tags.push(["r",d]);await i.sign(n),console.log("signed profile",i),await a.sign(n),console.log("signed relays",a);const c=o&&o.length?o:OUTBOX_RELAYS$1;await i.publish(NDKRelaySet.fromRelayUrls(c,t)),console.log("published profile",i),await a.publish(NDKRelaySet.fromRelayUrls(c,t)),console.log("published relays",a)},bunkerUrlToInfo=(e,t="")=>{const n=new URL(e);return{pubkey:"",signerPubkey:n.hostname||n.pathname.split("//")[1],sk:t||generatePrivateKey(),relays:n.searchParams.getAll("relay"),token:n.searchParams.get("secret")||"",authMethod:"connect"}},isBunkerUrl=e=>e.startsWith("bunker://"),getBunkerUrl=async(e,t)=>{if(!e)return"";if(isBunkerUrl(e))return e;if(e.includes("@")){const[n,r]=e.toLocaleLowerCase().split("@"),o=t.devOverrideBunkerOrigin||`https://${r}`,s=`${o}/.well-known/nostr.json?name=_`,i=`${o}/.well-known/nostr.json?name=${n}`,a=await fetch(s),l=await a.json(),c=l.names._,d=l.nip46[c],p=await fetch(i),g=(await p.json()).names[n];if(!d.length)throw new Error("Bunker relay not provided");return`bunker://${g}?relay=${d[0]}`}throw new Error("Invalid user name or bunker url")},checkNip05=async e=>{let t=!1,n="",r="";return await(async()=>{if(!e||!e.includes("@"))return;const[o,s]=e.toLocaleLowerCase().split("@");if(!o)return;if(!new RegExp(/^[\w-.]+@([\w-]+\.)+[\w-]{2,8}$/g).test(e))return void(n="Invalid name");if(!s)return void(n="Select service");const i=`https://${s}/.well-known/nostr.json?name=${o.toLowerCase()}`;try{const a=await fetch(i),l=await a.json();if(l.names[o])return void(r=l.names[o])}catch{}t=!0})(),{available:t,taken:r!="",error:n,pubkey:r}},upgradeInfo=e=>{"typeAuthMethod"in e&&delete e.typeAuthMethod,e.authMethod||("extension"in e&&e.extension?e.authMethod="extension":"readOnly"in e&&e.readOnly?e.authMethod="readOnly":e.authMethod="connect"),e.nip05&&isBunkerUrl(e.nip05)&&(e.bunkerUrl=e.nip05,e.nip05=""),e.authMethod!=="connect"||e.signerPubkey||(e.signerPubkey=e.pubkey)},localStorageAddAccount=e=>{localStorageSetItem(LOCAL_STORE_KEY,JSON.stringify(e));const t=localStorageGetItem(LOGGED_IN_ACCOUNTS)||[],n=localStorageGetItem(RECENT_ACCOUNTS)||[];t.forEach(i=>upgradeInfo(i)),n.forEach(i=>upgradeInfo(i));const r=t,o=t.findIndex(i=>i.pubkey===e.pubkey&&i.authMethod===e.authMethod);o!==-1?r[o]=e:r.push(e);const s=n.filter(i=>i.pubkey!==e.pubkey||i.authMethod!==e.authMethod);localStorageSetItem(RECENT_ACCOUNTS,JSON.stringify(s)),localStorageSetItem(LOGGED_IN_ACCOUNTS,JSON.stringify(r))},localStorageRemoveCurrentAccount=()=>{const e=localStorageGetItem(LOCAL_STORE_KEY);if(!e)return;upgradeInfo(e);const t={...e};delete t.sk,delete t.otpData;const n=localStorageGetItem(LOGGED_IN_ACCOUNTS)||[],r=localStorageGetItem(RECENT_ACCOUNTS)||[];n.forEach(i=>upgradeInfo(i)),r.forEach(i=>upgradeInfo(i));const o=r;if(t.authMethod==="connect"&&t.bunkerUrl&&t.bunkerUrl.includes("secret="))console.log("nostr login bunker conn with a secret not saved to recent");else if(t.authMethod==="local")console.log("nostr login temporary local keys not save to recent");else{const i=r.findIndex(a=>a.pubkey===t.pubkey&&a.authMethod===t.authMethod);i!==-1?o[i]=t:o.push(t)}const s=n.filter(i=>i.pubkey!==e.pubkey||i.authMethod!==e.authMethod);localStorageSetItem(RECENT_ACCOUNTS,JSON.stringify(o)),localStorageSetItem(LOGGED_IN_ACCOUNTS,JSON.stringify(s)),localStorageRemoveItem(LOCAL_STORE_KEY)},localStorageRemoveRecent=e=>{const t=localStorageGetItem(RECENT_ACCOUNTS)||[];t.forEach(r=>upgradeInfo(r));const n=t.filter(r=>r.pubkey!==e.pubkey||r.authMethod!==e.authMethod);localStorageSetItem(RECENT_ACCOUNTS,JSON.stringify(n))},localStorageGetRecents=()=>{const e=localStorageGetItem(RECENT_ACCOUNTS)||[];return e.forEach(t=>upgradeInfo(t)),e},localStorageGetAccounts=()=>{const e=localStorageGetItem(LOGGED_IN_ACCOUNTS)||[];return e.forEach(t=>upgradeInfo(t)),e},localStorageGetCurrent=()=>{const e=localStorageGetItem(LOCAL_STORE_KEY);return e&&upgradeInfo(e),e},getDarkMode=e=>{const t=localStorage.getItem("nl-dark-mode");return t?!!JSON.parse(t):e.darkMode!==void 0?e.darkMode:!(!window.matchMedia||!window.matchMedia("(prefers-color-scheme: dark)").matches)},getIcon=async()=>document.location.origin+"/favicon.ico";class NostrRpc extends NDKNostrRpc{constructor(n,r){super(n,r,n.debug.extend("nip46:signer:rpc"));w(this,"_ndk");w(this,"_signer");w(this,"requests",new Set);w(this,"sub");w(this,"_useNip44",!1);this._ndk=n,this._signer=r}async subscribe(n){var r;return n.kinds=(r=n.kinds)==null?void 0:r.filter(o=>o===24133),this.sub=await super.subscribe(n),this.sub}stop(){this.sub&&(this.sub.stop(),this.sub=void 0)}setUseNip44(n){this._useNip44=n}isNip04(n){const r=n.length;return!(r<28)&&n[r-28]==="?"&&n[r-27]==="i"&&n[r-26]==="v"&&n[r-25]==="="}async parseEvent(n){const r=this._ndk.getUser({pubkey:n.pubkey});r.ndk=this._ndk;const o=this.isNip04(n.content)?this._signer.decrypt:this._signer.decryptNip44,s=await o.call(this._signer,r,n.content),i=JSON.parse(s),{id:a,method:l,params:c,result:d,error:p}=i;return l?{id:a,pubkey:n.pubkey,method:l,params:c,event:n}:{id:a,result:d,error:p,event:n}}async parseNostrConnectReply(n,r){const o=new NDKEvent(this._ndk,n),s=await this.parseEvent(o);if(console.log("nostr connect parsedEvent",s),s.method)throw new Error("Bad nostr connect reply");{const i=s;if(i.result!==r)throw new Error(i.error);return o.pubkey}}async listen(n){const r=this._signer.pubkey;console.log("nostr-login listening for conn to",r);const o=await this.subscribe({kinds:[24133],"#p":[r]});return new Promise((s,i)=>{o.on("event",async a=>{try{const l=await this.parseEvent(a);if(!l.method){const c=l;if(c.result==="auth_url")return;c.result==="ack"||c.result===n?s(a.pubkey):i(c.error)}}catch(l){console.log("error parsing event",l,a.rawEvent())}this.stop()})})}async connect(n,r,o){return new Promise((s,i)=>{const a=[n,r||"",o||""];this.sendRequest(n,"connect",a,24133,l=>{l.result==="ack"?s():i(l.error)})})}getId(){return Math.random().toString(36).substring(7)}async sendRequest(n,r,o=[],s=24133,i){const a=this.getId();this.setResponseHandler(a,i);const l=await this.createRequestEvent(a,n,r,o,s);console.log("sendRequest",{event:l,method:r,remotePubkey:n,params:o}),await l.publish()}setResponseHandler(n,r){let o=!1;const s=Date.now();return new Promise(()=>{const i=a=>{a.result==="auth_url"?(this.once(`response-${n}`,i),o||(o=!0,this.emit("authUrl",a.error))):r&&this.requests.has(n)&&(this.requests.delete(n),console.log("nostr-login processed nip46 request in",Date.now()-s,"ms"),r(a))};this.once(`response-${n}`,i)})}async createRequestEvent(n,r,o,s=[],i=24133){this.requests.add(n);const a=await this._signer.user(),l=this._ndk.getUser({pubkey:r}),c={id:n,method:o,params:s},d=new NDKEvent(this._ndk,{kind:i,content:JSON.stringify(c),tags:[["p",r]],pubkey:a.pubkey}),p=this._useNip44&&o!=="create_account"?this._signer.encryptNip44:this._signer.encrypt;return d.content=await p.call(this._signer,l,d.content),await d.sign(this._signer),d}}class IframeNostrRpc extends NostrRpc{constructor(n,r,o){super(n,r);w(this,"peerOrigin");w(this,"iframePort");w(this,"iframeRequests",new Map);this._ndk=n,this.peerOrigin=o}async subscribe(n){return this.peerOrigin?new NDKSubscription(this._ndk,{},{closeOnEose:!0,cacheUsage:NDKSubscriptionCacheUsage.ONLY_CACHE}):super.subscribe(n)}setWorkerIframePort(n){if(!this.peerOrigin)throw new Error("Unexpected iframe port");this.iframePort=n,setInterval(()=>{console.log("iframe-nip46 ping"),this.iframePort.postMessage("ping")},5e3),n.onmessage=async r=>{if(console.log("iframe-nip46 got response",r.data),typeof r.data=="string"&&r.data.startsWith("errorNoKey")){const o=r.data.split(":")[1],{id:s="",pubkey:i=""}=this.iframeRequests.get(o)||{};s&&i&&this.requests.has(s)&&this.emit(`iframeRestart-${i}`)}else try{const o=r.data;if(!validateEvent(o))throw new Error("Invalid event from iframe");if(!verifySignature(o))throw new Error("Invalid event signature from iframe");const s=new NDKEvent(this._ndk,o),i=await this.parseEvent(s);i.method||(console.log("parsed response",i),this.emit(`response-${i.id}`,i))}catch(o){console.log("error parsing event",o,r.data)}}}async sendRequest(n,r,o=[],s=24133,i){const a=this.getId(),l=await this.createRequestEvent(a,n,r,o,s);this.setResponseHandler(a,i),this.iframePort?(this.iframeRequests.set(l.id,{id:a,pubkey:n}),console.log("iframe-nip46 sending request to",this.peerOrigin,l.rawEvent()),this.iframePort.postMessage(l.rawEvent())):await l.publish()}}class ReadyListener{constructor(t,n){w(this,"origin");w(this,"messages");w(this,"promise");this.origin=n,this.messages=t,this.promise=new Promise(r=>{console.log(new Date,"started listener for",this.messages);const o=async s=>{const i=new URL(n).hostname,a=new URL(s.origin).hostname;(a===i||a.endsWith("."+i))&&Array.isArray(s.data)&&s.data.length&&this.messages.includes(s.data[0])&&(console.log(new Date,"got ready message from",s.origin,s.data),window.removeEventListener("message",o),r(s.data))};window.addEventListener("message",o)})}async wait(){console.log(new Date,"waiting for",this.messages);const t=await this.promise;return console.log(new Date,"finished waiting for",this.messages,t),t}}class Nip46Signer extends NDKNip46Signer{constructor(n,r,o,s){super(n,o,r);w(this,"_userPubkey","");w(this,"_rpc");this._rpc=new IframeNostrRpc(n,r,s),this._rpc.setUseNip44(!0),this._rpc.on("authUrl",i=>{this.emit("authUrl",i)}),this.rpc=this._rpc}get userPubkey(){return this._userPubkey}async setSignerPubkey(n,r=!1){console.log("setSignerPubkey",n),this.remotePubkey=n,this._rpc.on(`iframeRestart-${n}`,()=>{this.emit("iframeRestart")}),await this.initUserPubkey(r?n:"")}async initUserPubkey(n){if(this._userPubkey)throw new Error("Already called initUserPubkey");this._userPubkey=n||await new Promise((r,o)=>{if(!this.remotePubkey)throw new Error("Signer pubkey not set");console.log("get_public_key",this.remotePubkey),this._rpc.sendRequest(this.remotePubkey,"get_public_key",[],24133,s=>{r(s.result)})})}async listen(n){const r=await this.rpc.listen(n);await this.setSignerPubkey(r)}async connect(n,r){if(!this.remotePubkey)throw new Error("No signer pubkey");await this._rpc.connect(this.remotePubkey,n,r),await this.setSignerPubkey(this.remotePubkey)}async setListenReply(n,r){const o=await this._rpc.parseNostrConnectReply(n,r);await this.setSignerPubkey(o,!0)}async createAccount2({bunkerPubkey:n,name:r,domain:o,perms:s=""}){const i=[r,o,"",s],a=await new Promise(l=>{this.rpc.sendRequest(n,"create_account",i,void 0,l)});if(console.log("create_account pubkey",a),a.result==="error")throw new Error(a.error);return a.result}}class BannerManager extends lib$1.EventEmitter{constructor(n){super();w(this,"banner",null);w(this,"iframeReady");w(this,"params");this.params=n}onAuthUrl(n,r){this.banner&&(this.banner.notify=n?{mode:r?"iframeAuthUrl":"authUrl",url:n}:{mode:""})}onIframeRestart(n){this.banner&&(this.iframeReady=new ReadyListener(["rebinderDone","rebinderError"],new URL(n).origin),this.banner.notify={mode:"rebind",url:n})}onUserInfo(n){this.banner&&(this.banner.userInfo=n)}onCallTimeout(){this.banner&&(this.banner.notify={mode:"timeout"})}onCallStart(){this.banner&&(this.banner.isLoading=!0)}async onCallEnd(){this.banner&&(this.iframeReady&&(await this.iframeReady.wait(),this.iframeReady=void 0),this.banner.isLoading=!1,this.banner.notify={mode:""})}onUpdateAccounts(n){this.banner&&(this.banner.accounts=n)}onDarkMode(n){this.banner&&(this.banner.darkMode=n)}launchAuthBanner(n){this.banner=document.createElement("nl-banner"),this.banner.setAttribute("dark-mode",String(getDarkMode(n))),n.theme&&this.banner.setAttribute("theme",n.theme),n.noBanner&&this.banner.setAttribute("hidden-mode","true"),this.banner.addEventListener("handleLoginBanner",r=>{this.emit("launch",r.detail)}),this.banner.addEventListener("handleConfirmLogout",()=>{this.emit("onConfirmLogout")}),this.banner.addEventListener("handleLogoutBanner",async()=>{this.emit("logout")}),this.banner.addEventListener("handleImportModal",r=>{this.emit("import")}),this.banner.addEventListener("handleNotifyConfirmBanner",r=>{this.emit("onAuthUrlClick",r.detail)}),this.banner.addEventListener("handleNotifyConfirmBannerIframe",r=>{this.emit("onIframeAuthUrlClick",r.detail)}),this.banner.addEventListener("handleSwitchAccount",r=>{this.emit("onSwitchAccount",r.detail)}),this.banner.addEventListener("handleOpenWelcomeModal",()=>{this.emit("launch"),this.banner&&(this.banner.isOpen=!1)}),document.body.appendChild(this.banner)}}function extract(e,t,n){return hash$1(e),hmac$1(e,toBytes$1(n),toBytes$1(t))}const HKDF_COUNTER=new Uint8Array([0]),EMPTY_BUFFER=new Uint8Array;function expand(e,t,n,r=32){if(hash$1(e),number$1(r),r>255*e.outputLen)throw new Error("Length should be <= 255*HashLen");const o=Math.ceil(r/e.outputLen);n===void 0&&(n=EMPTY_BUFFER);const s=new Uint8Array(o*e.outputLen),i=hmac$1.create(e,t),a=i._cloneInto(),l=new Uint8Array(i.outputLen);for(let c=0;c<o;c++)HKDF_COUNTER[0]=c+1,a.update(c===0?EMPTY_BUFFER:l).update(n).update(HKDF_COUNTER).digestInto(l),s.set(l,e.outputLen*c),i._cloneInto(a);return i.destroy(),a.destroy(),l.fill(0),HKDF_COUNTER.fill(0),s.slice(0,r)}const decoder=new TextDecoder,u={minPlaintextSize:1,maxPlaintextSize:65535,utf8Encode:utf8ToBytes$1,utf8Decode:e=>decoder.decode(e),getConversationKey(e,t){const n=secp256k1.getSharedSecret(e,"02"+t).subarray(1,33);return extract(sha256,n,"nip44-v2")},getMessageKeys(e,t){const n=expand(sha256,e,t,76);return{chacha_key:n.subarray(0,32),chacha_nonce:n.subarray(32,44),hmac_key:n.subarray(44,76)}},calcPaddedLen(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("expected positive integer");if(e<=32)return 32;const t=1<<Math.floor(Math.log2(e-1))+1,n=t<=256?32:t/8;return n*(Math.floor((e-1)/n)+1)},writeU16BE(e){if(!Number.isSafeInteger(e)||e<u.minPlaintextSize||e>u.maxPlaintextSize)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},pad(e){const t=u.utf8Encode(e),n=t.length;return concatBytes(u.writeU16BE(n),t,new Uint8Array(u.calcPaddedLen(n)-n))},unpad(e){const t=new DataView(e.buffer).getUint16(0),n=e.subarray(2,2+t);if(t<u.minPlaintextSize||t>u.maxPlaintextSize||n.length!==t||e.length!==2+u.calcPaddedLen(t))throw new Error("invalid padding");return u.utf8Decode(n)},hmacAad(e,t,n){if(n.length!==32)throw new Error("AAD associated data must be 32 bytes");const r=concatBytes(n,t);return hmac$1(sha256,e,r)},decodePayload(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 n;try{n=base64.decode(e)}catch(s){throw new Error("invalid base64: "+s.message)}const r=n.length;if(r<99||r>65603)throw new Error("invalid data length: "+r);const o=n[0];if(o!==2)throw new Error("unknown encryption version "+o);return{nonce:n.subarray(1,33),ciphertext:n.subarray(33,-32),mac:n.subarray(-32)}}};function encryptNip44(e,t,n=randomBytes(32)){const{chacha_key:r,chacha_nonce:o,hmac_key:s}=u.getMessageKeys(t,n),i=u.pad(e),a=chacha20(r,o,i),l=u.hmacAad(s,a,n);return base64.encode(concatBytes(new Uint8Array([2]),n,a,l))}function decryptNip44(e,t){const{nonce:n,ciphertext:r,mac:o}=u.decodePayload(e),{chacha_key:s,chacha_nonce:i,hmac_key:a}=u.getMessageKeys(t,n);if(!equalBytes(u.hmacAad(a,r,n),o))throw new Error("invalid MAC");const l=chacha20(s,i,r);return u.unpad(l)}class Nip44{constructor(){w(this,"cache",new Map)}createKey(t,n){return u.getConversationKey(t,n)}getKey(t,n,r){const o=getPublicKey(t)+n;let s=this.cache.get(o);if(s)return s;const i=this.createKey(t,n);return this.cache.set(o,i),i}encrypt(t,n,r){return encryptNip44(r,this.getKey(t,n))}decrypt(t,n,r){return decryptNip44(r,this.getKey(t,n))}}class PrivateKeySigner extends NDKPrivateKeySigner{constructor(n){super(n);w(this,"nip44",new Nip44);w(this,"_pubkey");this._pubkey=getPublicKey(n)}get pubkey(){return this._pubkey}encryptNip44(n,r){return Promise.resolve(this.nip44.encrypt(this.privateKey,n.pubkey,r))}decryptNip44(n,r){return Promise.resolve(this.nip44.decrypt(this.privateKey,n.pubkey,r))}}const OUTBOX_RELAYS=["wss://user.kindpag.es","wss://purplepag.es","wss://relay.nos.social"],DEFAULT_NOSTRCONNECT_RELAY="wss://relay.nsec.app/",NOSTRCONNECT_APPS=[{name:"Nsec.app",domain:"nsec.app",canImport:!0,img:"https://nsec.app/assets/favicon.ico",link:"https://use.nsec.app/<nostrconnect>",relay:"wss://relay.nsec.app/"},{name:"Amber",img:"https://raw.githubusercontent.com/greenart7c3/Amber/refs/heads/master/assets/android-icon.svg",link:"<nostrconnect>",relay:"wss://relay.nsec.app/"},{name:"Other key stores",img:"",link:"<nostrconnect>",relay:"wss://relay.nsec.app/"}];class AuthNostrService extends lib$1.EventEmitter{constructor(n){super();w(this,"ndk");w(this,"profileNdk");w(this,"signer",null);w(this,"localSigner",null);w(this,"params");w(this,"signerPromise");w(this,"signerErrCallback");w(this,"readyPromise");w(this,"readyCallback");w(this,"nip44Codec",new Nip44);w(this,"nostrConnectKey","");w(this,"nostrConnectSecret","");w(this,"iframe");w(this,"starterReady");w(this,"nip04");w(this,"nip44");this.params=n,this.ndk=new NDK({enableOutboxModel:!1}),this.profileNdk=new NDK({enableOutboxModel:!0,explicitRelayUrls:OUTBOX_RELAYS}),this.profileNdk.connect(),this.nip04={encrypt:this.encrypt04.bind(this),decrypt:this.decrypt04.bind(this)},this.nip44={encrypt:this.encrypt44.bind(this),decrypt:this.decrypt44.bind(this)}}isIframe(){return!!this.iframe}async waitReady(){if(this.signerPromise)try{await this.signerPromise}catch{}if(this.readyPromise)try{await this.readyPromise}catch{}}cancelNostrConnect(){this.releaseSigner(),this.resetAuth()}async nostrConnect(n,{domain:r="",link:o="",iframeUrl:s="",importConnect:i=!1}={}){n=n||DEFAULT_NOSTRCONNECT_RELAY;const a={authMethod:"connect",pubkey:"",signerPubkey:"",sk:this.nostrConnectKey,domain:r,relays:[n],iframeUrl:s};if(console.log("nostrconnect info",a,o),o&&!s&&window.open(o,"_blank","width=400,height=700"),await this.initSigner(a,{listen:!0}),!a.pubkey||!a.signerPubkey)throw new Error("Bad remote pubkey");return a.bunkerUrl=`bunker://${a.signerPubkey}?relay=${n}`,i||this.onAuth("login",a),a}async createNostrConnect(n){this.nostrConnectKey=generatePrivateKey(),this.nostrConnectSecret=Math.random().toString(36).substring(7);const r=getPublicKey(this.nostrConnectKey),o=encodeURIComponent(document.location.host),s=encodeURIComponent(document.location.origin);return`nostrconnect://${r}?image=${encodeURIComponent(await getIcon())}&url=${s}&name=${o}&perms=${encodeURIComponent(this.params.optionsModal.perms||"")}&secret=${this.nostrConnectSecret}${n?`&relay=${n}`:""}`}async getNostrConnectServices(){const n=await this.createNostrConnect(),r=NOSTRCONNECT_APPS.map(o=>({...o}));for(const o of r){let s=DEFAULT_NOSTRCONNECT_RELAY;if(o.link.startsWith("https://")){let a=o.domain||new URL(o.link).hostname;try{const l=await(await fetch(`https://${a}/.well-known/nostr.json`)).json(),c=l.names._,d=l.nip46[c];d&&d.length&&(s=d[0]),o.iframeUrl=l.nip46.iframe_url||""}catch(l){console.log("Bad app info",l,o)}}const i=n+"&relay="+s;o.iframeUrl?o.link=i:o.link=o.link.replace("<nostrconnect>",i)}return[n,r]}async localSignup(n,r){const o=!r,s={pubkey:getPublicKey(r=r||generatePrivateKey()),sk:r,name:n,authMethod:"local"};console.log(`localSignup name: ${n}`),await this.setLocal(s,o)}async setLocal(n,r){this.releaseSigner(),this.localSigner=new PrivateKeySigner(n.sk),r&&await createProfile(n,this.profileNdk,this.localSigner,this.params.optionsModal.signupRelays,this.params.optionsModal.outboxRelays),this.onAuth(r?"signup":"login",n)}prepareImportUrl(n){var r,o;if(((r=this.params.userInfo)==null?void 0:r.authMethod)==="otp")return n+"&import=true";if(!this.localSigner||((o=this.params.userInfo)==null?void 0:o.authMethod)!=="local")throw new Error("Most be local keys");return n+"#import="+nip19_exports.nsecEncode(this.localSigner.privateKey)}async importAndConnect(n){const{relay:r,domain:o,link:s,iframeUrl:i}=n;if(!o)throw new Error("Domain required");const a=await this.nostrConnect(r,{domain:o,link:s,importConnect:!0,iframeUrl:i});await this.logout(!0),this.localSigner=null,this.onAuth("login",a)}setReadOnly(n){const r={pubkey:n,authMethod:"readOnly"};this.onAuth("login",r)}setExtension(n){const r={pubkey:n,authMethod:"extension"};this.onAuth("login",r)}setOTP(n,r){const o={pubkey:n,authMethod:"otp",otpData:r};this.onAuth("login",o)}async setConnect(n){this.releaseSigner(),await this.startAuth(),await this.initSigner(n),this.onAuth("login",n),await this.endAuth()}async createAccount(n){var l;const[r,o]=n.split("@"),s=await getBunkerUrl(`_@${o}`,this.params.optionsModal);console.log("create account bunker's url",s);const i=bunkerUrlToInfo(s);if(!i.signerPubkey)throw new Error("Bad bunker url");const a=!!this.params.userInfo;return await this.initSigner(i,{eventToAddAccount:a}),{bunkerUrl:`bunker://${await this.signer.createAccount2({bunkerPubkey:i.signerPubkey,name:r,domain:o,perms:this.params.optionsModal.perms})}?relay=${(l=i.relays)==null?void 0:l[0]}`,sk:i.sk}}releaseSigner(){var n;this.signer=null,(n=this.signerErrCallback)==null||n.call(this,"cancelled"),this.localSigner=null;for(const r of this.ndk.pool.relays.keys())this.ndk.pool.removeRelay(r)}async logout(n=!1){n||this.releaseSigner(),localStorageRemoveCurrentAccount(),this.onAuth("logout"),this.emit("updateAccounts")}setUserInfo(n){this.params.userInfo=n,this.emit("onUserInfo",n),n&&(localStorageAddAccount(n),this.emit("updateAccounts"))}exportKeys(){return this.params.userInfo?this.params.userInfo.authMethod!=="local"?"":nip19_exports.nsecEncode(this.params.userInfo.sk):""}onAuth(n,r=null){if(n!=="logout"&&!r)throw new Error("No user info in onAuth");if(r&&this.params.userInfo&&(r.pubkey!==this.params.userInfo.pubkey||r.authMethod!==this.params.userInfo.authMethod)){const o=new CustomEvent("nlAuth",{detail:{type:"logout"}});console.log("nostr-login auth",o.detail),document.dispatchEvent(o)}this.setUserInfo(r),r&&fetchProfile(r,this.profileNdk).then(o=>{if(this.params.userInfo!==r)return;const s={...this.params.userInfo,picture:(o==null?void 0:o.image)||(o==null?void 0:o.picture),name:(o==null?void 0:o.name)||(o==null?void 0:o.displayName)||(o==null?void 0:o.nip05)||nip19_exports.npubEncode(r.pubkey)};this.setUserInfo(s)});try{const o=r?nip19_exports.npubEncode(r.pubkey):"",s={type:n};n==="logout"?(this.iframe&&this.iframe.remove(),this.iframe=void 0):(s.pubkey=r.pubkey,s.name=r.name,r.sk&&(s.localNsec=nip19_exports.nsecEncode(r.sk)),r.relays&&(s.relays=r.relays),r.otpData&&(s.otpData=r.otpData),s.method=r.authMethod||"connect");const i=new CustomEvent("nlAuth",{detail:s});console.log("nostr-login auth",s),document.dispatchEvent(i),this.params.optionsModal.onAuth&&this.params.optionsModal.onAuth(o,s)}catch(o){console.log("onAuth error",o)}}async createIframe(n){if(!n)return;const r=new URL(n);let o;const s="__nostr-login-worker-iframe-"+r.hostname.replaceAll(".","-");o=document.querySelector(`#${s}`),console.log("iframe",s,o),o||(o=document.createElement("iframe"),o.setAttribute("width","0"),o.setAttribute("height","0"),o.setAttribute("border","0"),o.style.display="none",o.id=s,document.body.append(o)),o.setAttribute("src",n);const i=new ReadyListener(["workerReady","workerError"],r.origin);await new Promise(l=>{o.addEventListener("load",l)});const a=await i.wait();return console.log("nostr-login iframe ready",n,a),{iframe:o,port:a[1]}}async sendNeedAuth(){const[n]=await this.getNostrConnectServices(),r=new CustomEvent("nlNeedAuth",{detail:{nostrconnect:n}});console.log("nostr-login need auth",n),document.dispatchEvent(r)}isAuthing(){return!!this.readyCallback}async startAuth(){if(console.log("startAuth"),this.readyCallback)throw new Error("Already started");this.readyPromise=new Promise(n=>this.readyCallback=n)}async endAuth(){if(console.log("endAuth",this.params.userInfo),this.params.userInfo&&this.params.userInfo.iframeUrl){const{iframe:n,port:r}=await this.createIframe(this.params.userInfo.iframeUrl)||{};if(this.iframe=n,!this.iframe||!r)return;this.signer.rpc.setWorkerIframePort(r)}this.readyCallback(),this.readyCallback=void 0}resetAuth(){this.readyCallback&&this.readyCallback(),this.readyCallback=void 0}async listen(n){if(!n.iframeUrl)return this.signer.listen(this.nostrConnectSecret);const r=await this.starterReady.wait();if(r[0]==="starterError")throw new Error(r[1]);return this.signer.setListenReply(r[1],this.nostrConnectSecret)}async connect(n,r){return this.signer.connect(n.token,r)}async initSigner(n,{listen:r=!1,connect:o=!1,eventToAddAccount:s=!1}={}){if(this.signerPromise)try{await this.signerPromise}catch{}console.log("initSigner info",n);const i=n.iframeUrl?new URL(n.iframeUrl).origin:void 0;return i&&(this.starterReady=new ReadyListener(["starterDone","starterError"],i)),this.emit("onIframeUrl",n.iframeUrl),this.signerPromise=new Promise(async(a,l)=>{this.signerErrCallback=l;try{if(n.relays&&!n.iframeUrl)for(const d of n.relays)this.ndk.addExplicitRelay(d,void 0);await this.ndk.connect();const c=new PrivateKeySigner(n.sk);this.signer=new Nip46Signer(this.ndk,c,n.signerPubkey,i),this.signer.on("iframeRestart",async()=>{const d=n.iframeUrl+(n.iframeUrl.includes("?")?"&":"?")+"pubkey="+n.pubkey+"&rebind="+c.pubkey;this.emit("iframeRestart",{pubkey:n.pubkey,iframeUrl:d})}),this.signer.on("authUrl",d=>{console.log("nostr login auth url",d),this.emit("onAuthUrl",{url:d,iframeUrl:n.iframeUrl,eventToAddAccount:s})}),r?await this.listen(n):o?await this.connect(n,this.params.optionsModal.perms):await this.signer.initUserPubkey(n.pubkey),n.pubkey=this.signer.userPubkey,n.signerPubkey=this.signer.remotePubkey,a()}catch(c){console.log("initSigner failure",c),this.signer=null,l(c)}}),this.signerPromise}async authNip46(n,{name:r,bunkerUrl:o,sk:s="",domain:i="",iframeUrl:a=""}){var l;try{const c=bunkerUrlToInfo(o,s);if(isBunkerUrl(r)?c.bunkerUrl=r:(c.nip05=r,c.domain=r.split("@")[1]),i&&(c.domain=i),a&&(c.iframeUrl=a),!c.signerPubkey||!c.sk||!((l=c.relays)!=null&&l[0]))throw new Error(`Bad bunker url ${o}`);const d=!!this.params.userInfo;console.log("authNip46",n,c),await this.initSigner(c,{connect:!0,eventToAddAccount:d}),this.onAuth(n,c)}catch(c){throw console.log("nostr login auth failed",c),c}}async signEvent(n){var r,o;return this.localSigner?(n.pubkey=getPublicKey(this.localSigner.privateKey),n.id=getEventHash(n),n.sig=await this.localSigner.sign(n)):(n.pubkey=(r=this.signer)==null?void 0:r.remotePubkey,n.id=getEventHash(n),n.sig=await((o=this.signer)==null?void 0:o.sign(n))),console.log("signed",{event:n}),n}async codec_call(n,r,o){return new Promise((s,i)=>{this.signer.rpc.sendRequest(this.signer.remotePubkey,n,[r,o],24133,a=>{a.error?i(a.error):s(a.result)})})}async encrypt04(n,r){return this.localSigner?this.localSigner.encrypt(new NDKUser({pubkey:n}),r):this.signer.encrypt(new NDKUser({pubkey:n}),r)}async decrypt04(n,r){return this.localSigner?this.localSigner.decrypt(new NDKUser({pubkey:n}),r):this.codec_call("nip04_decrypt",n,r)}async encrypt44(n,r){return this.localSigner?this.nip44Codec.encrypt(this.localSigner.privateKey,n,r):this.codec_call("nip44_encrypt",n,r)}async decrypt44(n,r){return this.localSigner?this.nip44Codec.decrypt(this.localSigner.privateKey,n,r):this.codec_call("nip44_decrypt",n,r)}}class ModalManager extends lib$1.EventEmitter{constructor(n,r,o){super();w(this,"modal",null);w(this,"params");w(this,"extensionService");w(this,"authNostrService");w(this,"launcherPromise");w(this,"accounts",[]);w(this,"recents",[]);w(this,"opt");this.params=n,this.extensionService=o,this.authNostrService=r}async waitReady(){if(this.launcherPromise){try{await this.launcherPromise}catch{}this.launcherPromise=void 0}}async launch(n){console.log("nostr-login launch",n),this.launcherPromise&&await this.waitReady(),this.authNostrService.isAuthing()&&this.authNostrService.resetAuth(),this.opt=n;const r=document.createElement("dialog");this.modal=document.createElement("nl-auth"),this.modal.accounts=this.accounts,this.modal.recents=this.recents,this.modal.setAttribute("dark-mode",String(getDarkMode(n))),n.theme&&this.modal.setAttribute("theme",n.theme),n.startScreen&&this.modal.setAttribute("start-screen",n.startScreen),n.bunkers?this.modal.setAttribute("bunkers",n.bunkers):this.modal.setAttribute("bunkers","nsec.app,highlighter.com"),n.methods!==void 0&&(this.modal.authMethods=n.methods),n.localSignup!==void 0&&(this.modal.localSignup=n.localSignup),n.signupNstart!==void 0&&(this.modal.signupNjump=n.signupNstart),n.title&&(this.modal.welcomeTitle=n.title),n.description&&(this.modal.welcomeDescription=n.description),this.modal.hasExtension=this.extensionService.hasExtension(),this.modal.hasOTP=!!n.otpRequestUrl&&!!n.otpReplyUrl,this.modal.isLoadingExtension=!1,this.modal.isLoading=!1,[this.modal.connectionString,this.modal.connectionStringServices]=await this.authNostrService.getNostrConnectServices(),r.appendChild(this.modal),document.body.appendChild(r);let o="";return this.launcherPromise=new Promise((s,i)=>{r.addEventListener("close",()=>{i(new Error("Closed")),this.authNostrService.resetAuth(),this.modal&&(document.body.removeChild(this.modal.parentNode),this.modal=null)});const a=async k=>{this.modal&&(this.modal.isLoading=!1),await this.authNostrService.endAuth(),r.close(),this.modal=null,k()},l=async(k,$)=>{this.modal&&(this.modal.isLoading=!0);try{$&&!$.start||await this.authNostrService.startAuth(),await k(),$&&!$.end||await a(s)}catch(N){console.log("error",N),this.modal&&(this.modal.isLoading=!1,this.modal.authUrl="",this.modal.iframeUrl="",N!=="cancelled"&&(this.modal.error=N.toString()))}},c=async(k,$)=>{await l(async()=>{const N=await getBunkerUrl(k,this.params.optionsModal);await this.authNostrService.authNip46("login",{name:k,bunkerUrl:N,domain:$})})},d=async k=>{await l(async()=>{const{bunkerUrl:$,sk:N}=await this.authNostrService.createAccount(k);await this.authNostrService.authNip46("signup",{name:k,bunkerUrl:$,sk:N})})},p=async()=>{try{await navigator.clipboard.writeText(this.authNostrService.exportKeys()),localStorageSetItem("backupKey","true")}catch(k){console.error("Failed to copy to clipboard: ",k)}},g=async k=>{await l(async()=>{const{iframeUrl:$}=k;k.link=this.authNostrService.prepareImportUrl(k.link),this.modal&&$&&(this.modal.authUrl=k.link,this.modal.iframeUrl=$,this.modal.isLoading=!1,console.log("nostrconnect authUrl",this.modal.authUrl,this.modal.iframeUrl)),await this.authNostrService.importAndConnect(k)})},v=async k=>{await l(async()=>{const{relay:$,domain:N,link:T,iframeUrl:L}=k||{};console.log("nostrConnect",k,$,N,T,L),this.modal&&(L&&(this.modal.authUrl=T,this.modal.iframeUrl=L,this.modal.isLoading=!1,console.log("nostrconnect authUrl",this.modal.authUrl,this.modal.iframeUrl)),k||(this.modal.isLoading=!1)),await this.authNostrService.nostrConnect($,{domain:N,link:T,iframeUrl:L})})},x=async k=>{await l(async()=>{if(!k)throw new Error("Please enter some nickname");await this.authNostrService.localSignup(k)})},b=async()=>{await l(async()=>{const k=new URL(window.location.href),$=k.hostname.toLocaleLowerCase().replace(/^www\./i,"").charAt(0).toUpperCase()+k.hostname.slice(1),N=prepareSignupRelays(this.params.optionsModal.signupRelays);return this.modal.njumpIframe=`
|
|
2131
|
+
<html><body>
|
|
2132
|
+
<script src='https://start.njump.me/modal.js'><\/script>
|
|
2133
|
+
<script>
|
|
2134
|
+
new NstartModal({
|
|
2135
|
+
baseUrl: 'https://start.njump.me',
|
|
2136
|
+
// Required parameters
|
|
2137
|
+
an: '${$}',
|
|
2138
|
+
// Optional parameters
|
|
2139
|
+
s: [${this.opt.followNpubs?`'${this.opt.followNpubs}'`:""}],
|
|
2140
|
+
afb: false, // forceBunker
|
|
2141
|
+
asb: false, // skipBunker
|
|
2142
|
+
aan: false, // avoidNsec
|
|
2143
|
+
aac: true, // avoidNcryptsec
|
|
2144
|
+
ahc: true, // hide close button
|
|
2145
|
+
arr: ${JSON.stringify(N)}, //readRelays
|
|
2146
|
+
awr: ${JSON.stringify(N)}, //writeRelays
|
|
2147
|
+
// Callbacks
|
|
2148
|
+
onComplete: (result) => {
|
|
2149
|
+
console.log('Login token:', result.nostrLogin);
|
|
2150
|
+
window.parent.location.href='${window.location.href}#nostr-login='+result.nostrLogin;
|
|
2151
|
+
},
|
|
2152
|
+
onCancel: () => {
|
|
2153
|
+
window.parent.location.href='${window.location.href}#nostr-login=null';
|
|
2154
|
+
},
|
|
2155
|
+
}).open();
|
|
2156
|
+
<\/script>
|
|
2157
|
+
</body></html>
|
|
2158
|
+
`.replaceAll("&","&"),new Promise((T,L)=>{const B=async E=>{if(console.log("nsecOrBunker",E),E.startsWith("nsec1")){let m;try{m=nip19_exports.decode(E)}catch{throw new Error("Bad nsec value")}if(m.type!=="nsec")throw new Error("Bad bech32 type");await this.authNostrService.localSignup("",m.data),T()}else E.startsWith("bunker:")?(await this.authNostrService.authNip46("login",{name:"",bunkerUrl:E}),T()):L(E==="null"?"Cancelled":"Unknown return value")};window.addEventListener("hashchange",async()=>{if(window.location.hash.startsWith("#nostr-login=")){const E=window.location.hash.split("#nostr-login=")[1],m=new URL(window.location.toString());m.hash="",window.history.replaceState({},"",m.toString()),B(E)}})})})};if(!this.modal)throw new Error("WTH?");this.modal.addEventListener("handleContinue",()=>{this.modal&&(this.modal.isLoading=!0,this.emit("onAuthUrlClick",this.modal.authUrl))}),this.modal.addEventListener("nlLogin",k=>{c(k.detail)}),this.modal.addEventListener("nlSignup",k=>{d(k.detail)}),this.modal.addEventListener("nlLocalSignup",k=>{x(k.detail)}),this.modal.addEventListener("nlSignupNjump",k=>{b()}),this.modal.addEventListener("nlImportAccount",k=>{g(k.detail)}),this.modal.addEventListener("nlExportKeys",k=>{p()}),this.modal.addEventListener("handleLogoutBanner",()=>{this.emit("onLogoutBanner")}),this.modal.addEventListener("nlNostrConnect",k=>{v(k.detail)}),this.modal.addEventListener("nlNostrConnectDefault",()=>{this.authNostrService.isAuthing()||v()}),this.modal.addEventListener("nlNostrConnectDefaultCancel",()=>{console.log("nlNostrConnectDefaultCancel"),this.authNostrService.cancelNostrConnect()}),this.modal.addEventListener("nlSwitchAccount",k=>{const $=k.detail;this.emit("onSwitchAccount",$),setTimeout(()=>r.close(),300)}),this.modal.addEventListener("nlLoginRecentAccount",async k=>{const $=k.detail;if($.authMethod==="readOnly")this.authNostrService.setReadOnly($.pubkey),r.close();else if($.authMethod==="otp")try{this.modal.dispatchEvent(new CustomEvent("nlLoginOTPUser",{detail:$.nip05||$.pubkey}))}catch(N){console.error(N)}else if($.authMethod==="extension")await this.extensionService.trySetExtensionForPubkey($.pubkey),r.close();else{const N=$.bunkerUrl||$.nip05;if(!N)throw new Error("Bad connect info");c(N,$.domain)}}),this.modal.addEventListener("nlRemoveRecent",k=>{localStorageRemoveRecent(k.detail),this.emit("updateAccounts")});const C=async k=>{let $="";if(k.includes("@")){const{error:N,pubkey:T}=await checkNip05(k);if(!T)throw new Error(N);$=T}else if(k.startsWith("npub")){const{type:N,data:T}=nip19_exports.decode(k);if(N!=="npub")throw new Error("Bad npub");$=T}else k.trim().length===64&&($=k.trim(),nip19_exports.npubEncode($));return $};this.modal.addEventListener("nlLoginReadOnly",async k=>{await l(async()=>{const $=k.detail,N=await C($);this.authNostrService.setReadOnly(N)})}),this.modal.addEventListener("nlLoginExtension",async()=>{if(!this.extensionService.hasExtension())throw new Error("No extension");await l(async()=>{this.modal&&(this.modal.isLoadingExtension=!0,await this.extensionService.setExtension(),this.modal.isLoadingExtension=!1)})}),this.modal.addEventListener("nlLoginOTPUser",async k=>{await l(async()=>{if(!this.modal)return;const $=k.detail,N=await C($),T=this.opt.otpRequestUrl+(this.opt.otpRequestUrl.includes("?")?"&":"?")+"pubkey="+N,L=await fetch(T);if(L.status!==200)throw console.warn("nostr-login: bad otp reply",L),new Error("Failed to send DM");this.modal.isOTP=!0,o=N,this.modal.isLoading=!1},{start:!0})}),this.modal.addEventListener("nlLoginOTPCode",async k=>{await l(async()=>{if(!this.modal)return;const $=k.detail,N=this.opt.otpReplyUrl+(this.opt.otpRequestUrl.includes("?")?"&":"?")+"pubkey="+o+"&code="+$,T=await fetch(N);if(T.status!==200)throw console.warn("nostr-login: bad otp reply",T),new Error("Invalid code");const L=await T.text();this.authNostrService.setOTP(o,L),this.modal.isOTP=!1},{end:!0})}),this.modal.addEventListener("nlCheckSignup",async k=>{const{available:$,taken:N,error:T}=await checkNip05(k.detail);this.modal&&(this.modal.error=String(T),!T&&N&&(this.modal.error="Already taken"),this.modal.signupNameIsAvailable=$)}),this.modal.addEventListener("nlCheckLogin",async k=>{const{available:$,taken:N,error:T}=await checkNip05(k.detail);this.modal&&(this.modal.error=String(T),$&&(this.modal.error="Name not found"),this.modal.loginIsGood=N)});const _=()=>{this.modal&&(this.modal.isLoading=!1),r.close(),i(new Error("Cancelled"))};this.modal.addEventListener("stopFetchHandler",_),this.modal.addEventListener("nlCloseModal",_),this.modal.addEventListener("nlChangeDarkMode",k=>{setDarkMode(k.detail),document.dispatchEvent(new CustomEvent("nlDarkMode",{detail:k.detail}))}),this.on("onIframeAuthUrlCallEnd",()=>{r.close(),this.modal=null,s()}),r.showModal()}),this.launcherPromise}async showIframeUrl(n){await this.waitReady(),this.launch({startScreen:"iframe"}).catch(()=>console.log("closed auth iframe")),this.modal.authUrl=n}connectModals(n){const r=async s=>{await this.launch(s)},o=document.getElementsByTagName("nl-button");for(let s=0;s<o.length;s++){const i=o[s].getAttribute("nl-theme"),a=o[s].getAttribute("start-screen"),l={...n};switch(i&&(l.theme=i),a){case"login":case"login-bunker-url":case"login-read-only":case"signup":case"switch-account":case"welcome":l.startScreen=a}o[s].addEventListener("click",function(){r(l)})}}onAuthUrl(n){this.modal&&(this.modal.authUrl=n,this.modal.isLoading=!1)}onIframeUrl(n){this.modal&&(console.log("modal iframe url",n),this.modal.iframeUrl=n)}onCallEnd(){var n;this.modal&&this.modal.authUrl&&((n=this.params.userInfo)!=null&&n.iframeUrl)&&this.emit("onIframeAuthUrlCallEnd")}onUpdateAccounts(n,r){this.accounts=n,this.recents=r,this.modal&&(this.modal.accounts=n,this.modal.recents=r)}onDarkMode(n){this.modal&&(this.modal.darkMode=n)}}var z;class Nostr{constructor(t){se(this,z);w(this,"nip04");w(this,"nip44");ie(this,z,t),this.getPublicKey=this.getPublicKey.bind(this),this.signEvent=this.signEvent.bind(this),this.getRelays=this.getRelays.bind(this),this.nip04={encrypt:this.encrypt04.bind(this),decrypt:this.decrypt04.bind(this)},this.nip44={encrypt:this.encrypt44.bind(this),decrypt:this.decrypt44.bind(this)}}async ensureAuth(){if(await W(this,z).waitReady(),!W(this,z).getUserInfo()&&(await W(this,z).launch(),!W(this,z).getUserInfo()))throw new Error("Rejected by user")}async getPublicKey(){await this.ensureAuth();const t=W(this,z).getUserInfo();if(t)return t.pubkey;throw new Error("No user")}async signEvent(t){return await this.ensureAuth(),W(this,z).wait(async()=>await W(this,z).getSigner().signEvent(t))}async getRelays(){return{}}async encrypt04(t,n){return await this.ensureAuth(),W(this,z).wait(async()=>await W(this,z).getSigner().nip04.encrypt(t,n))}async decrypt04(t,n){return await this.ensureAuth(),W(this,z).wait(async()=>await W(this,z).getSigner().nip04.decrypt(t,n))}async encrypt44(t,n){return await this.ensureAuth(),W(this,z).wait(async()=>await W(this,z).getSigner().nip44.encrypt(t,n))}async decrypt44(t,n){return await this.ensureAuth(),W(this,z).wait(async()=>await W(this,z).getSigner().nip44.decrypt(t,n))}}z=new WeakMap;class NostrExtensionService extends lib$1.EventEmitter{constructor(n){super();w(this,"params");w(this,"nostrExtension");this.params=n}startCheckingExtension(n){if(this.checkExtension(n))return;const r=setInterval(()=>{this.checkExtension(n)&&clearTimeout(r)},100)}checkExtension(n){return!(this.nostrExtension||!window.nostr||window.nostr===n)&&(this.initExtension(n),!0)}async initExtension(n,r){var o;this.nostrExtension=window.nostr,window.nostr=n,((o=this.params.userInfo)==null?void 0:o.authMethod)==="extension"&&await this.trySetExtensionForPubkey(this.params.userInfo.pubkey),r||setTimeout(()=>{window.nostr!==n&&this.nostrExtension!==window.nostr&&this.initExtension(n,!0)},300)}async setExtensionReadPubkey(n){window.nostr=this.nostrExtension;const r=await window.nostr.getPublicKey();n&&n!==r?this.emit("extensionLogout"):this.emit("extensionLogin",r)}async trySetExtensionForPubkey(n){if(this.nostrExtension)return this.setExtensionReadPubkey(n)}async setExtension(){return this.setExtensionReadPubkey()}unsetExtension(n){window.nostr===this.nostrExtension&&(window.nostr=n)}getExtension(){return this.nostrExtension}hasExtension(){return!!this.nostrExtension}}class NostrParams{constructor(){w(this,"userInfo");w(this,"optionsModal");this.userInfo=null,this.optionsModal={theme:"default",startScreen:"welcome",devOverrideBunkerOrigin:""}}}class Popup{constructor(){w(this,"popup",null)}openPopup(t){if((!this.popup||this.popup.closed)&&(this.popup=window.open(t,"_blank","width=400,height=700"),console.log("popup",this.popup),!this.popup))throw new Error("Popup blocked. Try again, please!")}closePopup(){var t;try{(t=this.popup)==null||t.close(),this.popup=null}catch{}}}const CALL_TIMEOUT=5e3;class ProcessManager extends lib$1.EventEmitter{constructor(){super();w(this,"callCount",0);w(this,"callTimer")}onAuthUrl(){this.callTimer&&clearTimeout(this.callTimer)}onIframeUrl(){this.callTimer&&clearTimeout(this.callTimer)}async wait(n){let r,o;this.callTimer||(this.callTimer=setTimeout(()=>this.emit("onCallTimeout"),CALL_TIMEOUT)),this.callCount||this.emit("onCallStart"),this.callCount++;try{o=await n()}catch(s){r=s}if(this.callCount--,this.emit("onCallEnd"),this.callTimer&&clearTimeout(this.callTimer),this.callTimer=void 0,r)throw r;return o}}class NostrLoginInitializer{constructor(){w(this,"extensionService");w(this,"params");w(this,"authNostrService");w(this,"nostr");w(this,"processManager");w(this,"popupManager");w(this,"bannerManager");w(this,"modalManager");w(this,"customLaunchCallback");w(this,"launch",async t=>{if(!t&&this.params.optionsModal.customNostrConnect)return this.launchCustomNostrConnect();const n=localStorageGetRecents(),r=localStorageGetAccounts(),o={...this.params.optionsModal};t&&t!=="default"?o.startScreen=t:(n!=null&&n.length||r!=null&&r.length)&&(o.startScreen="switch-account"),this.customLaunchCallback&&this.authNostrService.cancelNostrConnect();try{await this.modalManager.launch(o),this.fulfillCustomLaunchPromise()}catch(s){console.log("nostr-login failed",s)}});w(this,"init",async t=>{this.extensionService.startCheckingExtension(this.nostr),window.nostr=this.nostr,this.modalManager.connectModals(t),this.bannerManager.launchAuthBanner(t),t&&(this.params.optionsModal={...t});try{const r=localStorageGetCurrent();if(r){if(!r.pubkey)throw new Error("Bad stored info");await this.switchAccount(r)}}catch(r){console.log("nostr login init error",r),await logout()}this.updateAccounts();const n=new CustomEvent("nlReady");console.log("nostr-login ready"),document.dispatchEvent(n)});w(this,"logout",async()=>{this.extensionService.unsetExtension(this.nostr),await this.authNostrService.logout()});w(this,"setDarkMode",t=>{localStorageSetItem("nl-dark-mode",`${t}`),this.bannerManager.onDarkMode(t),this.modalManager.onDarkMode(t)});w(this,"setAuth",async t=>{if(!t.type)throw new Error("Invalid auth event");if(t.type!=="login"&&t.type!=="logout"&&t.type!=="signup")throw new Error("Invalid auth event");if(t.method&&t.method!=="connect"&&t.method!=="extension"&&t.method!=="local"&&t.method!=="otp"&&t.method!=="readOnly")throw new Error("Invalid auth event");if(t.type==="logout")return this.logout();if(!t.method||!t.pubkey)throw new Error("Invalid pubkey");const n={authMethod:t.method,pubkey:t.pubkey,relays:t.relays,sk:t.localNsec,otpData:t.otpData,name:t.name};await this.switchAccount(n,t.type==="signup")});w(this,"cancelNeedAuth",()=>{console.log("cancelNeedAuth"),this.fulfillCustomLaunchPromise(),this.authNostrService.cancelNostrConnect()});this.params=new NostrParams,this.processManager=new ProcessManager,this.popupManager=new Popup,this.bannerManager=new BannerManager(this.params),this.authNostrService=new AuthNostrService(this.params),this.extensionService=new NostrExtensionService(this.params),this.modalManager=new ModalManager(this.params,this.authNostrService,this.extensionService);const t={waitReady:async()=>{await this.authNostrService.waitReady(),await this.modalManager.waitReady()},getUserInfo:()=>this.params.userInfo,getSigner:()=>{if(this.params.userInfo.authMethod==="readOnly")throw new Error("Read only");return this.params.userInfo.authMethod==="extension"?this.extensionService.getExtension():this.authNostrService},launch:()=>this.launch(),wait:n=>this.processManager.wait(n)};this.nostr=new Nostr(t),this.processManager.on("onCallTimeout",()=>{this.bannerManager.onCallTimeout()}),this.processManager.on("onCallEnd",()=>{this.bannerManager.onCallEnd(),this.modalManager.onCallEnd()}),this.processManager.on("onCallStart",()=>{this.bannerManager.onCallStart()}),this.authNostrService.on("onIframeUrl",n=>{this.modalManager.onIframeUrl(n)}),this.authNostrService.on("iframeRestart",({iframeUrl:n})=>{this.processManager.onIframeUrl(),this.bannerManager.onIframeRestart(n)}),this.authNostrService.on("onAuthUrl",({url:n,iframeUrl:r,eventToAddAccount:o})=>{this.processManager.onAuthUrl(),o?this.modalManager.onAuthUrl(n):this.params.userInfo?this.bannerManager.onAuthUrl(n,r):this.modalManager.onAuthUrl(n)}),this.authNostrService.on("updateAccounts",()=>{this.updateAccounts()}),this.authNostrService.on("onUserInfo",n=>{this.bannerManager.onUserInfo(n)}),this.modalManager.on("onAuthUrlClick",n=>{this.openPopup(n)}),this.bannerManager.on("onIframeAuthUrlClick",n=>{this.modalManager.showIframeUrl(n)}),this.modalManager.on("onSwitchAccount",async n=>{this.switchAccount(n)}),this.modalManager.on("onLogoutBanner",async n=>{logout()}),this.bannerManager.on("onConfirmLogout",async()=>{this.launch("confirm-logout")}),this.modalManager.on("updateAccounts",()=>{this.updateAccounts()}),this.bannerManager.on("logout",()=>{logout()}),this.bannerManager.on("onAuthUrlClick",n=>{this.openPopup(n)}),this.bannerManager.on("onSwitchAccount",async n=>{this.switchAccount(n)}),this.bannerManager.on("import",()=>{this.launch("import")}),this.extensionService.on("extensionLogin",n=>{this.authNostrService.setExtension(n)}),this.extensionService.on("extensionLogout",()=>{logout()}),this.bannerManager.on("launch",n=>{this.launch(n)})}openPopup(t){this.popupManager.openPopup(t)}async switchAccount(t,n=!1){if(console.log("nostr login switch to info",t),this.extensionService.unsetExtension(this.nostr),t.authMethod==="readOnly")this.authNostrService.setReadOnly(t.pubkey);else if(t.authMethod==="otp")this.authNostrService.setOTP(t.pubkey,t.otpData||"");else if(t.authMethod==="local"&&t.sk)await this.authNostrService.setLocal(t,n);else if(t.authMethod==="extension")await this.extensionService.trySetExtensionForPubkey(t.pubkey);else{if(!(t.authMethod==="connect"&&t.sk&&t.relays&&t.relays[0]))throw new Error("Bad auth info");await this.authNostrService.setConnect(t)}}updateAccounts(){const t=localStorageGetAccounts(),n=localStorageGetRecents();this.bannerManager.onUpdateAccounts(t),this.modalManager.onUpdateAccounts(t,n)}async launchCustomNostrConnect(){try{this.authNostrService.isAuthing()&&this.authNostrService.cancelNostrConnect();const t=new Promise(n=>this.customLaunchCallback=n);await this.authNostrService.startAuth(),await this.authNostrService.sendNeedAuth();try{await this.authNostrService.nostrConnect(),await this.authNostrService.endAuth()}catch(n){n==="cancelled"&&await t}}catch(t){console.error("launchCustomNostrConnect",t)}}fulfillCustomLaunchPromise(){if(this.customLaunchCallback){const t=this.customLaunchCallback;this.customLaunchCallback=void 0,t()}}}const initializer=new NostrLoginInitializer,{init,launch,logout,setDarkMode,setAuth,cancelNeedAuth}=initializer;document.addEventListener("nlLogout",logout),document.addEventListener("nlLaunch",e=>{launch(e.detail||"")}),document.addEventListener("nlNeedAuthCancel",()=>{cancelNeedAuth()}),document.addEventListener("nlDarkMode",e=>{setDarkMode(!!e.detail)}),document.addEventListener("nlSetAuth",e=>{setAuth(e.detail)});export{NostrLoginInitializer,cancelNeedAuth,init,launch,logout,setAuth,setDarkMode};
|
|
2159
|
+
//# sourceMappingURL=index.esm-ByUtE_cm.js.map
|