UNPKG

@benev/praxis

Version:
66 lines (64 loc) 94.3 kB
class t{#t=!1;lock(t){this.#t=!0;const e=t();return this.#t=!1,e}get locked(){return this.#t}}const e=()=>new Map,s=()=>new Set;function n(t){return{guarantee:(e,s)=>function(t,e,s){if(t.has(e))return t.get(e);{const n=s();return t.set(e,n),n}}(t,e,s)}}class r{#e=new WeakMap;grab_keymap(t){const s=n(this.#e).guarantee(t,e);return{keymap:s,grab_symbolmap:t=>n(s).guarantee(t,e)}}clear(){this.#e=new WeakMap}}class i{#s=new Map;stop(t){const e=this.#s.get(t);e&&(this.#s.delete(t),e())}add(t,e){this.#s.set(t,e)}}class o{#n=[];record(t){const s=e();this.#n.push(s);const n=t();return this.#n.pop(),{payload:n,recording:s}}record_that_key_was_accessed(t,e){const r=this.#n.at(-1);if(r){n(r).guarantee(t,s).add(e)}}}class a extends Error{name=this.constructor.name}class c extends a{constructor(t){super(`forbidden circularity, rejected assignment to "${t}"`)}}class l extends a{constructor(t){super(`forbidden assignment to readonly property "${t}"`)}}function h(t){return new Proxy(t,{get:(t,e)=>t[e],set(t,e){throw new l(e)}})}function u(t,e){let s,n,r=[];function i(){s=[],n&&clearTimeout(n),n=void 0,r=[]}return i(),(...o)=>{s=o,n&&clearTimeout(n);const a=new Promise(((t,e)=>{r.push({resolve:t,reject:e})}));return n=setTimeout((()=>{Promise.resolve().then((()=>e(...s))).then((t=>{for(const{resolve:e}of r)e(t);i()})).catch((t=>{for(const{reject:e}of r)e(t);i()}))}),t),a}}class d{#r=new Map;#i=Promise.resolve();#o=u(0,(()=>{const t=[...this.#r.values()];this.#r.clear();for(const e of t)e()}));get wait(){return this.#i}add(t,e){this.#r.set(t,e),this.#i=this.#o()}}function p(t){return function(e){return()=>{const s="function"==typeof t?t():t;return e(s)}}}function f(t,e,s,n){const r=[];for(const[i,o]of e){const{grab_symbolmap:e}=s.grab_keymap(i);for(const s of o){const i=e(s);i.set(t,n),r.push((()=>i.delete(t)))}}return()=>r.forEach((t=>t()))}function m(t,e){return g.on_change(t,(()=>t.requestUpdate())),g.proxy(t,e)}var g;!function(t){t.proxy=(t,e)=>new Proxy(e,{get:(s,n)=>{const r=e[n],i=t.getAttribute(n);switch(r){case String:return i??void 0;case Number:return null!==i?Number(i):void 0;case Boolean:return null!==i;default:throw new Error(`invalid attribute type for "${n}"`)}},set:(s,n,r)=>{switch(e[n]){case String:return t.setAttribute(n,r),!0;case Number:return t.setAttribute(n,r.toString()),!0;case Boolean:return r?t.setAttribute(n,""):t.removeAttribute(n),!0;default:throw new Error(`invalid attribute type for "${n}"`)}}}),t.on_change=function(t,e){const s=new MutationObserver(e);return s.observe(t,{attributes:!0}),()=>s.disconnect()}}(g||(g={}));class y{#a;constructor(t){this.#a=t}get state(){return this.#a.getter(this.#a.parent.state)}transmute(t){this.#a.parent.transmute((e=>{const s=this.#a.getter(e),n=t(s);return this.#a.setter(e,n)}))}slice({getter:t,setter:e}){return new y({parent:this,getter:t,setter:e})}}const w=t=>"object"==typeof t&&null!==t;const b={clone:function t(e,s=new Set){if(s.has(e))throw new Error("cannot clone circular reference");let n;return"function"==typeof e||null!==e&&"object"==typeof e?(s.add(e),n=Array.isArray(e)?e.map((e=>t(e,new Set(s)))):e.constructor===Object?Object.fromEntries(Object.entries(e).map((([e,n])=>[e,t(n,new Set(s))]))):e instanceof Map?new Map(Array.from(e,(([e,n])=>[e,t(n,new Set(s))]))):e instanceof Set?new Set(Array.from(e,(e=>t(e,new Set(s))))):e instanceof Date?new Date(e.getTime()):e,s.delete(e)):n=e,n},equal:(t,e)=>function t(e,s,n){if(!w(e)||!w(s))return e===s;if(n.includes(e))throw new Error("forbidden circularity detected in deep equal comparison");const r=[...n,e];if(e instanceof Map&&s instanceof Map){if(e.size!==s.size)return!1;for(const[n,i]of e)if(!s.has(n)||!t(i,s.get(n),r))return!1}else if(e instanceof Set&&s instanceof Set){if(e.size!==s.size)return!1;for(const n of e)if(!Array.from(s).some((e=>t(n,e,r))))return!1}else{const n=Object.keys(e),i=Object.keys(s);if(n.length!==i.length)return!1;for(const o of n){if(!i.includes(o))return!1;if(!t(e[o],s[o],r))return!1}}return!0}(t,e,[]),freeze:function(t){return function t(e,s){if(!w(e)||s.includes(e))return e;const n=[...s,e];if(e instanceof Map)for(const s of e.entries())for(const e of s)t(e,n);else if(e instanceof Set)for(const s of e)t(s,n);else if(Array.isArray(e))for(const s of e)t(s,n);else for(const s of Object.values(e))t(s,n);return Object.freeze(e)}(t,[])}};class v{#c;#l;#h;#u=!1;#d(){return b.freeze(structuredClone(this.#c))}constructor(t,e=()=>{}){this.#c=structuredClone(t),this.#l=this.#d(),this.#h=e}get state(){return this.#l}transmute(t){if(this.#u)throw new Error("circular error");this.#u=!0,this.#c=t(structuredClone(this.#c)),this.#l=this.#d(),this.#h(),this.#u=!1}slice({getter:t,setter:e}){return new y({parent:this,getter:t,setter:e})}}const x=Error;var $;function _(t){return{map:e=>A(t,e),filter:e=>k(t,e)}}!function(t){function e(t){return"ready"===t.status?t.payload:void 0}function s(t,e){switch(t.status){case"loading":return e.loading();case"error":return e.error(t.reason);case"ready":return e.ready(t.payload);default:throw console.error("op",t),new x("invalid op status")}}t.loading=()=>({status:"loading"}),t.error=t=>({status:"error",reason:t}),t.ready=t=>({status:"ready",payload:t}),t.is=Object.freeze({loading:t=>"loading"===t.status,error:t=>"error"===t.status,ready:t=>"ready"===t.status}),t.payload=e,t.reason=function(t){return"error"===t.status?t.reason:void 0},t.select=s,t.load=async function(e,s){e(t.loading());try{const n=await s();return e(t.ready(n)),n}catch(s){const n=s instanceof x?s.message:"string"==typeof s?s:"error";throw e(t.error(n)),s}},t.morph=function(e,n){return s(e,{loading:()=>t.loading(),error:e=>t.error(e),ready:e=>t.ready(n(e))})},t.all=function(...s){const n=s.find(t.is.error);return n||(s.every(t.is.ready)?t.ready(s.map(e)):t.loading())}}($||($={})),_.pipe=Object.freeze({map:t=>e=>A(e,t),filter:t=>e=>k(e,t)});const A=(t,e)=>Object.fromEntries(Object.entries(t).map((([t,s])=>[t,e(s,t)]))),k=(t,e)=>Object.fromEntries(Object.entries(t).filter((([t,s])=>e(s,t)))),S=Symbol();class E extends Error{name=this.constructor.name}class C{static unwrap=t=>t instanceof C?t.value:t;#p;#f=!1;#i;#m=new Set;[S]=!1;constructor(t){this.#p=t,this.#i=Promise.resolve(t)}subscribe(t){return this.on(t)}on(t){return this.#m.add(t),()=>{this.#m.delete(t)}}once(t){const e=s=>{t(s),this.#m.delete(e)};return this.#m.add(e),()=>{this.#m.delete(e)}}clear(){return this.#m.clear()}#g=u(0,(()=>{const t=this.#p;this.#f=!0;for(const e of this.#m)e(t);return this.#f=!1,t}));async publish(){this.#i=this.#g(),await this.#i}get wait(){return this.#i}get value(){return this[S]=!0,this.#p}set value(t){if(this.#f)throw new E("you can't set a signal in a signal's subscription listener (infinite loop forbidden)");this.#p!==t&&(this.#p=t,this.publish())}setDeep(t){if(this.#f)throw new E("you can't set a signal in a signal's subscription listener (infinite loop forbidden)");b.equal(t,this.#p)||(this.#p=t,this.publish())}setAndPublish(t){if(this.#f)throw new E("you can't set a signal in a signal's subscription listener (infinite loop forbidden)");this.#p=t,this.publish()}setWithoutPublish(t){if(this.#f)throw new E("you can't set a signal in a signal's subscription listener (infinite loop forbidden)");this.#p=t}setValueNoPublish(t){return this.setWithoutPublish(t)}}class O extends C{#y=0;constructor(t){super(t)}async load(t){const e=++this.#y;return $.load((t=>{this.#y===e&&(this.value=t)}),t)}setLoading(){this.value=$.loading()}setError(t){this.value=$.error(t)}setReady(t){this.value=$.ready(t)}isLoading(){return $.is.loading(this.value)}isError(){return $.is.error(this.value)}isReady(){return $.is.ready(this.value)}get payload(){return $.payload(this.value)}select(t){return $.select(this.value,t)}}class M{#w=!0;#b;#v;#x=new Set;#$=new Set;constructor({all_signals:t,waiters:e}){this.#b=t,this.#v=e}#o=u(0,(t=>{if(this.#w)if("lean"in t)t.actor();else{const{payload:e,recording:s}=this.observe(t.collector);this.add_listeners(t,s),t.responder&&t.responder(e)}}));#_(){for(const t of this.#b)t[S]=!1}get#A(){return[...this.#b].filter((t=>t[S]&&!this.#x.has(t)))}observe(t){this.#_();return{payload:t(),recording:this.#A}}add_listeners(t,e){for(const s of e)this.#x.add(s),this.#$.add(s.on((()=>this.#v.add(this.#o(t)))))}shutdown(){this.#w=!1,this.#$.forEach((t=>t()))}}const j=new class{static readonly=h;static collectivize=p;#k=new r;#S=new o;#E=new t;#C=new i;#O=new d;#M=function(t,e,s,n,r){function i([s,r]){if("lean"in r)r.actor();else{const{payload:i,recording:o}=e.record(r.collector);n.add(s,f(s,o,t,r)),r.responder&&r.responder(i)}}return{get:(t,s)=>(e.record_that_key_was_accessed(t,s),t[s]),set:(e,n,o)=>{if(s.locked)throw new c(n);e[n]=o;const a=[...t.grab_keymap(e).grab_symbolmap(n)];for(const t of a){const[e]=t;r.add(e,(()=>s.lock((()=>i(t)))))}return!0}}}(this.#k,this.#S,this.#E,this.#C,this.#O);get wait(){return this.#O.wait}state(t){return new Proxy(t,this.#M)}reaction(t,e){const s=Symbol(),{recording:n}=this.#S.record((()=>this.#E.lock(t)));return this.#C.add(s,f(s,n,this.#k,{collector:t,responder:e})),()=>this.#C.stop(s)}lean(t){const e=Symbol();return{stop:()=>this.#C.stop(e),collect:s=>{const{payload:n,recording:r}=this.#S.record((()=>this.#E.lock(s)));return this.#C.add(e,f(e,r,this.#k,{lean:!0,actor:t})),n}}}clear(){this.#k.clear()}},P=new class{#j=new Set;#v=new Set;signal(t){const e=new C(t);return this.#j.add(e),e}computed(t){const e=this.signal(t());return this.reaction((()=>{e.value=t()})),e}async computedAsync(t,e){const s=await e(t()),n=this.signal(s);return this.reaction(t,(async t=>{n.value=await e(t)})),n}op(t=$.loading()){const e=new O(t);return this.#j.add(e),e}load(t){const e=this.op($.loading());return e.load(t),e}many(t){return _(t).map((t=>this.signal(t)))}reaction(t,e){const s=new M({waiters:this.#v,all_signals:this.#j}),n={collector:t,responder:e},{recording:r}=s.observe(n.collector);return s.add_listeners(n,r),()=>s.shutdown()}lean(t){const e=new M({waiters:this.#v,all_signals:this.#j}),s={lean:!0,actor:t};return{stop:()=>e.shutdown(),collect:t=>{const{payload:n,recording:r}=e.observe(t);return e.add_listeners(s,r),n}}}async#P(){return await Promise.all([...this.#j].map((t=>t.wait))).then((()=>Promise.all([...this.#v]))).then((()=>{this.#v.clear()}))}get wait(){return Promise.resolve().then((()=>this.#P())).then((()=>this.#P()))}},T=new class{#j;#T=new Set;#m=new Set;#R=new Map;#z=Promise.resolve();constructor(t){this.#j=t}get wait(){return this.#z}#B=u(0,(()=>{for(const t of this.#T)t();for(const t of this.#m)t()}));dispatch(){this.#z=this.#B()}computed(t){const e=this.#j.signal(t());return this.#T.add((()=>{e.value=t()})),e}track(t,e){let s=!0;const n=()=>{const n=t(),r=this.#R.get(t);!s&&b.equal(n,r)||(s=!1,this.#R.set(t,n),e(n))};n(),this.#m.add(n);return()=>this.#m.delete(n)}stateTree(t){return new v(t,(()=>this.dispatch()))}}(P);j.state.bind(j);const R=P.signal.bind(P);P.computed.bind(P),P.op.bind(P);const z=new class{flat;signals;#i=Promise.resolve();constructor(t,e){this.flat=t,this.signals=e}get wait(){return Promise.all([this.flat.wait,this.signals.wait]).then((()=>this.#i))}reaction(t,e){const s=e?()=>e(r()):()=>r(),n=this.lean(s),r=()=>n.collect(t);return r(),n.stop}lean(t){const e=this.flat.lean(t),s=this.signals.lean(t);return{stop(){e.stop(),s.stop()},collect:t=>e.collect((()=>s.collect(t)))}}}(j,P);let B=class t{static with(t){return new this(t)}#U;constructor(t){this.#U=t}to(e){return new t(e(this.#U))}done(){return this.#U}};var U;function q(t){return[t].flat().filter((t=>!!t))}!function(t){function e(...t){return function(e){return class extends e{static get styles(){return L(e.styles,t)}}}}function s(t=z){return function(e){return class extends e{#q=null;render(){return this.#q?.collect((()=>super.render()))}connectedCallback(){super.connectedCallback(),this.#q=t.lean((()=>this.requestUpdate()))}disconnectedCallback(){super.disconnectedCallback(),this.#q&&(this.#q.stop(),this.#q=null)}}}}t.css=e,t.css_deferred=function(t){return function(e){return class extends e{static get styles(){return L(e.styles,t())}}}},t.signals=function(t){return function(e){return class extends e{#q=null;render(){return this.#q?.collect((()=>super.render()))}connectedCallback(){super.connectedCallback(),this.#q=t.lean((()=>this.requestUpdate()))}disconnectedCallback(){super.disconnectedCallback(),this.#q&&(this.#q.stop(),this.#q=null)}}}},t.flat=function(t){return function(e){return class extends e{#q=null;render(){return this.#q?.collect((()=>super.render()))}connectedCallback(){super.connectedCallback(),this.#q=t.lean((()=>this.requestUpdate()))}disconnectedCallback(){super.disconnectedCallback(),this.#q&&(this.#q.stop(),this.#q=null)}}}},t.reactive=s,t.reactor=s,t.setup=function(...t){return function(n){return B.with(n).to(e(...t)).to(s()).done()}}}(U||(U={}));const H=t=>void 0!==t;function L(t,e){return[...q(t)??[],...q(e)].flat().filter(H)}var N;function D(t,e={}){const{soft:s=!1,upgrade:n=!0}=e;for(const[e,r]of Object.entries(t)){const t=e.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase(),i=customElements.get(t);s&&i||(customElements.define(t,r),n&&document.querySelectorAll(t).forEach((t=>{t.constructor===HTMLElement&&customElements.upgrade(t)})))}}!function(t){t.css=t=>e=>_(e).map((e=>U.css(t)(e))),t.flat=t=>e=>_(e).map((e=>U.flat(t)(e))),t.signals=t=>e=>_(e).map((e=>U.signals(t)(e))),t.reactive=(t=z)=>e=>_(e).map((e=>U.reactive(t)(e))),t.reactor=t.reactive,t.context=e=>s=>B.with(s).to(t.css(e.theme)).to(t.reactive()).done(),t.setup=(...t)=>e=>_(e).map((e=>U.setup(...t)(e)))}(N||(N={}));const I=D,V=globalThis,W=V.ShadowRoot&&(void 0===V.ShadyCSS||V.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,J=Symbol(),Z=new WeakMap; /** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */let F=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==J)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(W&&void 0===t){const s=void 0!==e&&1===e.length;s&&(t=Z.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Z.set(e,t))}return t}toString(){return this.cssText}};const K=t=>new F("string"==typeof t?t:t+"",void 0,J),G=(t,...e)=>{const s=1===t.length?t[0]:e.reduce(((e,s,n)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[n+1]),t[0]);return new F(s,t,J)},Y=(t,e)=>{if(W)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const s of e){const e=document.createElement("style"),n=V.litNonce;void 0!==n&&e.setAttribute("nonce",n),e.textContent=s.cssText,t.appendChild(e)}},X=W?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return K(e)})(t):t /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */,{is:Q,defineProperty:tt,getOwnPropertyDescriptor:et,getOwnPropertyNames:st,getOwnPropertySymbols:nt,getPrototypeOf:rt}=Object,it=globalThis,ot=it.trustedTypes,at=ot?ot.emptyScript:"",ct=it.reactiveElementPolyfillSupport,lt=(t,e)=>t,ht={toAttribute(t,e){switch(e){case Boolean:t=t?at:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},ut=(t,e)=>!Q(t,e),dt={attribute:!0,type:String,converter:ht,reflect:!1,useDefault:!1,hasChanged:ut};Symbol.metadata??=Symbol("metadata"),it.litPropertyMetadata??=new WeakMap;let pt=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=dt){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),n=this.getPropertyDescriptor(t,s,e);void 0!==n&&tt(this.prototype,t,n)}}static getPropertyDescriptor(t,e,s){const{get:n,set:r}=et(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:n,set(e){const i=n?.call(this);r?.call(this,e),this.requestUpdate(t,i,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??dt}static _$Ei(){if(this.hasOwnProperty(lt("elementProperties")))return;const t=rt(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(lt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(lt("properties"))){const t=this.properties,e=[...st(t),...nt(t)];for(const s of e)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const s=this._$Eu(t,e);void 0!==s&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(X(t))}else void 0!==t&&e.push(X(t));return e}static _$Eu(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Y(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){const s=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,s);if(void 0!==n&&!0===s.reflect){const r=(void 0!==s.converter?.toAttribute?s.converter:ht).toAttribute(e,s.type);this._$Em=t,null==r?this.removeAttribute(n):this.setAttribute(n,r),this._$Em=null}}_$AK(t,e){const s=this.constructor,n=s._$Eh.get(t);if(void 0!==n&&this._$Em!==n){const t=s.getPropertyOptions(n),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:ht;this._$Em=n,this[n]=r.fromAttribute(e,t.type)??this._$Ej?.get(n)??null,this._$Em=null}}requestUpdate(t,e,s){if(void 0!==t){const n=this.constructor,r=this[t];if(s??=n.getPropertyOptions(t),!((s.hasChanged??ut)(r,e)||s.useDefault&&s.reflect&&r===this._$Ej?.get(t)&&!this.hasAttribute(n._$Eu(t,s))))return;this.C(t,e,s)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:n,wrapped:r},i){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,i??e??this[t]),!0!==r||void 0!==i)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),!0===n&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,s]of t){const{wrapped:t}=s,n=this[e];!0!==t||this._$AL.has(e)||void 0===n||this.C(e,void 0,s,n)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}};pt.elementStyles=[],pt.shadowRootOptions={mode:"open"},pt[lt("elementProperties")]=new Map,pt[lt("finalized")]=new Map,ct?.({ReactiveElement:pt}),(it.reactiveElementVersions??=[]).push("2.1.0"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const ft=globalThis,mt=ft.trustedTypes,gt=mt?mt.createPolicy("lit-html",{createHTML:t=>t}):void 0,yt="$lit$",wt=`lit$${Math.random().toFixed(9).slice(2)}$`,bt="?"+wt,vt=`<${bt}>`,xt=document,$t=()=>xt.createComment(""),_t=t=>null===t||"object"!=typeof t&&"function"!=typeof t,At=Array.isArray,kt="[ \t\n\f\r]",St=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Et=/-->/g,Ct=/>/g,Ot=RegExp(`>|${kt}(?:([^\\s"'>=/]+)(${kt}*=${kt}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Mt=/'/g,jt=/"/g,Pt=/^(?:script|style|textarea|title)$/i,Tt=t=>(e,...s)=>({_$litType$:t,strings:e,values:s}),Rt=Tt(1),zt=Tt(2),Bt=Symbol.for("lit-noChange"),Ut=Symbol.for("lit-nothing"),qt=new WeakMap,Ht=xt.createTreeWalker(xt,129);function Lt(t,e){if(!At(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==gt?gt.createHTML(e):e}const Nt=(t,e)=>{const s=t.length-1,n=[];let r,i=2===e?"<svg>":3===e?"<math>":"",o=St;for(let e=0;e<s;e++){const s=t[e];let a,c,l=-1,h=0;for(;h<s.length&&(o.lastIndex=h,c=o.exec(s),null!==c);)h=o.lastIndex,o===St?"!--"===c[1]?o=Et:void 0!==c[1]?o=Ct:void 0!==c[2]?(Pt.test(c[2])&&(r=RegExp("</"+c[2],"g")),o=Ot):void 0!==c[3]&&(o=Ot):o===Ot?">"===c[0]?(o=r??St,l=-1):void 0===c[1]?l=-2:(l=o.lastIndex-c[2].length,a=c[1],o=void 0===c[3]?Ot:'"'===c[3]?jt:Mt):o===jt||o===Mt?o=Ot:o===Et||o===Ct?o=St:(o=Ot,r=void 0);const u=o===Ot&&t[e+1].startsWith("/>")?" ":"";i+=o===St?s+vt:l>=0?(n.push(a),s.slice(0,l)+yt+s.slice(l)+wt+u):s+wt+(-2===l?e:u)}return[Lt(t,i+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),n]};let Dt=class t{constructor({strings:e,_$litType$:s},n){let r;this.parts=[];let i=0,o=0;const a=e.length-1,c=this.parts,[l,h]=Nt(e,s);if(this.el=t.createElement(l,n),Ht.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=Ht.nextNode())&&c.length<a;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(yt)){const e=h[o++],s=r.getAttribute(t).split(wt),n=/([.?@])?(.*)/.exec(e);c.push({type:1,index:i,name:n[2],strings:s,ctor:"."===n[1]?Zt:"?"===n[1]?Ft:"@"===n[1]?Kt:Jt}),r.removeAttribute(t)}else t.startsWith(wt)&&(c.push({type:6,index:i}),r.removeAttribute(t));if(Pt.test(r.tagName)){const t=r.textContent.split(wt),e=t.length-1;if(e>0){r.textContent=mt?mt.emptyScript:"";for(let s=0;s<e;s++)r.append(t[s],$t()),Ht.nextNode(),c.push({type:2,index:++i});r.append(t[e],$t())}}}else if(8===r.nodeType)if(r.data===bt)c.push({type:2,index:i});else{let t=-1;for(;-1!==(t=r.data.indexOf(wt,t+1));)c.push({type:7,index:i}),t+=wt.length-1}i++}}static createElement(t,e){const s=xt.createElement("template");return s.innerHTML=t,s}};function It(t,e,s=t,n){if(e===Bt)return e;let r=void 0!==n?s._$Co?.[n]:s._$Cl;const i=_t(e)?void 0:e._$litDirective$;return r?.constructor!==i&&(r?._$AO?.(!1),void 0===i?r=void 0:(r=new i(t),r._$AT(t,s,n)),void 0!==n?(s._$Co??=[])[n]=r:s._$Cl=r),void 0!==r&&(e=It(t,r._$AS(t,e.values),r,n)),e}let Vt=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,n=(t?.creationScope??xt).importNode(e,!0);Ht.currentNode=n;let r=Ht.nextNode(),i=0,o=0,a=s[0];for(;void 0!==a;){if(i===a.index){let e;2===a.type?e=new Wt(r,r.nextSibling,this,t):1===a.type?e=new a.ctor(r,a.name,a.strings,this,t):6===a.type&&(e=new Gt(r,this,t)),this._$AV.push(e),a=s[++o]}i!==a?.index&&(r=Ht.nextNode(),i++)}return Ht.currentNode=xt,n}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}};class Wt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,n){this.type=2,this._$AH=Ut,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=It(this,t,e),_t(t)?t===Ut||null==t||""===t?(this._$AH!==Ut&&this._$AR(),this._$AH=Ut):t!==this._$AH&&t!==Bt&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>At(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==Ut&&_t(this._$AH)?this._$AA.nextSibling.data=t:this.T(xt.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,n="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=Dt.createElement(Lt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===n)this._$AH.p(e);else{const t=new Vt(n,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=qt.get(t.strings);return void 0===e&&qt.set(t.strings,e=new Dt(t)),e}k(t){At(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,n=0;for(const r of t)n===e.length?e.push(s=new Wt(this.O($t()),this.O($t()),this,this.options)):s=e[n],s._$AI(r),n++;n<e.length&&(this._$AR(s&&s._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class Jt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,n,r){this.type=1,this._$AH=Ut,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=r,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=Ut}_$AI(t,e=this,s,n){const r=this.strings;let i=!1;if(void 0===r)t=It(this,t,e,0),i=!_t(t)||t!==this._$AH&&t!==Bt,i&&(this._$AH=t);else{const n=t;let o,a;for(t=r[0],o=0;o<r.length-1;o++)a=It(this,n[s+o],e,o),a===Bt&&(a=this._$AH[o]),i||=!_t(a)||a!==this._$AH[o],a===Ut?t=Ut:t!==Ut&&(t+=(a??"")+r[o+1]),this._$AH[o]=a}i&&!n&&this.j(t)}j(t){t===Ut?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Zt extends Jt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===Ut?void 0:t}}let Ft=class extends Jt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==Ut)}};class Kt extends Jt{constructor(t,e,s,n,r){super(t,e,s,n,r),this.type=5}_$AI(t,e=this){if((t=It(this,t,e,0)??Ut)===Bt)return;const s=this._$AH,n=t===Ut&&s!==Ut||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,r=t!==Ut&&(s===Ut||n);n&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class Gt{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){It(this,t)}}const Yt=ft.litHtmlPolyfillSupport;Yt?.(Dt,Wt),(ft.litHtmlVersions??=[]).push("3.3.0");const Xt=(t,e,s)=>{const n=s?.renderBefore??e;let r=n._$litPart$;if(void 0===r){const t=s?.renderBefore??null;n._$litPart$=r=new Wt(e.insertBefore($t(),t),t,void 0,s??{})}return r._$AI(t),r /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */},Qt=globalThis;let te=class extends pt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Xt(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Bt}};te._$litElement$=!0,te.finalized=!0,Qt.litElementHydrateSupport?.({LitElement:te});const ee=Qt.litElementPolyfillSupport;ee?.({LitElement:te}),(Qt.litElementVersions??=[]).push("4.2.0");class se extends(function(t){return class extends t{#H=(new Set).add((()=>this.setup()));#L=new Set;register_setup(t){this.#H.add(t)}setup(){return()=>{}}connectedCallback(){for(const t of this.#H)this.#L.add(t())}disconnectedCallback(){for(const t of this.#L)t();this.#L.clear()}}}(HTMLElement)){}function ne(){let t,e;const s=new Promise(((s,n)=>{t=s,e=n}));return{promise:s,resolve:t,reject:e,entangle:function(n){return n.then(t).catch(e),s}}}function re(t,e){Y(t,function(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(X(t))}else void 0!==t&&e.push(X(t));return e}(e))}class ie extends se{static get styles(){}#N;#D=ne();#i=this.#D.promise;init(){}constructor(){super(),this.#N=this.attachShadow({mode:"open"});const t=this.constructor;re(this.#N,t.styles),this.init()}get root(){return this.#N}get updateComplete(){return this.#i.then((()=>!0))}render(){}#I=u(0,(()=>{const t=this.#N,e=this.render();e&&Xt(e,t,{host:this})}));async requestUpdate(){const t=this.#I();return this.#D&&(t.then(this.#D.resolve),this.#D=void 0),this.#i=t,t}connectedCallback(){super.connectedCallback(),this.requestUpdate()}}class oe extends se{#D=ne();#i=this.#D.promise;init(){}constructor(){super(),this.init()}get updateComplete(){return this.#i.then((()=>!0))}render(){}#I=u(0,(()=>{const t=this.render();Xt(t,this,{host:this})}));async requestUpdate(){const t=this.#I();return this.#D&&(t.then(this.#D.resolve),this.#D=void 0),this.#i=t,t}connectedCallback(){super.connectedCallback(),this.requestUpdate()}}const ae=Symbol();class ce{#p=0;pull(){return this.#p++}reset(){this.#p=0}}class le{[ae]={wrap:t=>(...e)=>(this.#V.reset(),t(...e)),disconnect:()=>{for(const t of this.#W)t();this.#W.clear();for(const t of this.#J)t();this.#J.clear(),this.#Z.clear();for(const{untrack:t}of this.#F.values())t();this.#F.clear()},reconnect:()=>{for(const t of this.#K.values())this.#W.add(t());for(const[t,e]of this.#G.entries()){const[s,n]=e();this.#Z.set(t,s),this.#J.add(n)}},afterRender:()=>{for(const t of this.#Y.values())t()}};#X;#Q;#V=new ce;constructor(t,e){this.#Q=t,this.#X=e}get context(){return this.#X}rerender(){this.#Q()}#K=new Map;#W=new Set;mount(t){const e=this.#V.pull();this.#K.has(e)||(this.#K.set(e,t),this.#W.add(t()))}#G=new Map;#Z=new Map;#J=new Set;init(t){const e=this.#V.pull();if(!this.#G.has(e)){this.#G.set(e,t);const[s,n]=t();return this.#Z.set(e,s),this.#J.add(n),s}return this.#Z.get(e)}#tt=new Map;once(t){const e=this.#V.pull();return n(this.#tt).guarantee(e,t)}#Y=new Map;defer(t){const e=this.signal(void 0),s=this.#V.pull();return this.#Y.has(s)||this.#Y.set(s,(()=>{e.value=t()})),e}#et=new Set;deferOnce(t){this.mount((()=>(this.#et.clear(),()=>{})));const e=this.signal(void 0),s=this.#V.pull();return this.#Y.has(s)||this.#Y.set(s,(()=>{this.#et.has(s)||(this.#et.add(s),e.value=t())})),e}#st=new Map;state(t){const e=this.#V.pull();return[n(this.#st).guarantee(e,(()=>"function"==typeof t?t():t)),t=>{this.#st.set(e,t),this.#Q()},()=>this.#st.get(e)]}#nt=new Map;flatstate(t){const e=this.#V.pull();return n(this.#nt).guarantee(e,(()=>j.state("function"==typeof t?t():t)))}#j=new Map;signal(t){const e=this.#V.pull();return n(this.#j).guarantee(e,(()=>P.signal("function"==typeof t?t():t)))}computed(t){const e=this.#V.pull();return n(this.#j).guarantee(e,(()=>P.computed(t)))}op(){const t=this.#V.pull();return n(this.#j).guarantee(t,(()=>P.op()))}load(t){const e=this.op();return this.once((()=>e.load(t))),e}#F=new Map;watch(t){const e=this.#V.pull(),{data:s}=n(this.#F).guarantee(e,(()=>{const e={data:t(),untrack:()=>{}};return e.untrack=T.track(t,(t=>{e.data=t,this.#Q()})),e}));return s}#rt=new Map;effect(t,e){e=e.map(C.unwrap);const s=this.#V.pull(),n=this.#rt.get(s);if(n){const[r,i]=n;b.equal(e,i)||(r(),this.#rt.set(s,[t(),e]))}else{this.#K.set(s,t);const n=t();this.#W.add(n),this.#rt.set(s,[n,e])}}}class he extends le{#it;get element(){return this.#it}#ot;get shadow(){return this.#ot}styles(...t){this.once((()=>re(this.shadow,[this.context.theme,...t])))}css(...t){return this.styles(...t)}constructor(t,e,s,n){super(s,n),this.#it=t,this.#ot=e}}function ue(t){let e;return function(s){return e||(e=m(t,s)),e}}class de extends he{attrs;constructor(t,e,s,n){super(t,e,s,n),this.attrs=ue(t)}}class pe extends le{#it;get element(){return this.#it}attrs;constructor(t,e,s){super(e,s),this.#it=t,this.attrs=ue(t)}}class fe extends de{}class me extends pe{}class ge extends le{element;name(t){this.once((()=>this.element.setAttribute("view",t)))}constructor(t,e,s){super(e,s),this.element=t}}class ye extends he{name(t){this.once((()=>this.element.setAttribute("view",t)))}}class we{#X;constructor(t){this.#X=t}get context(){if(this.#X)return this.#X;throw new Error("nexus.context was not set, but it's necessary")}set context(t){this.#X=t}}function be(t,e){const s=z.lean(e);return{stop:s.stop,render:(...e)=>s.collect((()=>t(...e)))}}const ve=t=>e=>class extends ie{#at=new fe(this,this.root,(()=>{this.requestUpdate()}),t.context);#ct=this.#at[ae].wrap((()=>e(this.#at)));#lt;render(){return this.updateComplete.then((()=>this.#at[ae].afterRender())),this.#lt?.render()}connectedCallback(){super.connectedCallback(),this.#at[ae].reconnect(),this.#lt=be(this.#ct,(()=>{this.requestUpdate()}))}disconnectedCallback(){super.disconnectedCallback(),this.#at[ae].disconnect(),this.#lt&&(this.#lt.stop(),this.#lt=void 0)}},xe=2; /** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause */class $e{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}} /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const _e=(t,e)=>{const s=t._$AN;if(void 0===s)return!1;for(const t of s)t._$AO?.(e,!1),_e(t,e);return!0},Ae=t=>{let e,s;do{if(void 0===(e=t._$AM))break;s=e._$AN,s.delete(t),t=e}while(0===s?.size)},ke=t=>{for(let e;e=t._$AM;t=e){let s=e._$AN;if(void 0===s)e._$AN=s=new Set;else if(s.has(t))break;s.add(t),Ce(e)}};function Se(t){void 0!==this._$AN?(Ae(this),this._$AM=t,ke(this)):this._$AM=t}function Ee(t,e=!1,s=0){const n=this._$AH,r=this._$AN;if(void 0!==r&&0!==r.size)if(e)if(Array.isArray(n))for(let t=s;t<n.length;t++)_e(n[t],!1),Ae(n[t]);else null!=n&&(_e(n,!1),Ae(n));else _e(this,t)}const Ce=t=>{t.type==xe&&(t._$AP??=Ee,t._$AQ??=Se)};class Oe extends $e{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),ke(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(_e(this,t),Ae(this))}setValue(t){if((t=>void 0===t.strings) /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}function Me(){const t=new Set;function e(e){return t.add(e),()=>{t.delete(e)}}return e.publish=e=>{for(const s of t)s(e)},e.clear=()=>t.clear(),e.once=e=>{const s=n=>{e(n),t.delete(s)};return t.add(s),()=>{t.delete(s)}},e}class je extends HTMLElement{static tag="slate-view";onConnected=Me();onDisconnected=Me();connectedCallback(){this.onConnected.publish()}disconnectedCallback(){this.onDisconnected.publish()}}function Pe(...t){const e=new Set,s=t.map((t=>t??"")).flatMap(Te);for(const t of s)e.add(t);return e}function Te(t){return t.split(/\s+/).map((t=>t.trim())).filter((t=>!!t))}function Re(t){return t.split(",").map((t=>t.trim())).filter((t=>!!t)).map((t=>t.includes(":")?t.split(":").map((t=>t.trim()))[1]:t))}function ze(t,e){const s=Pe(t.getAttribute("part")),n=Pe(t.getAttribute("data-gpart")),r=function(t,e){return Object.fromEntries(Object.entries(e).map((([e,s])=>[e,Array.from(t.querySelectorAll(`[${s}]`)).map((t=>t.getAttribute(s)))])))}(e,{part:"part",gpart:"data-gpart",exportparts:"exportparts",gexportparts:"gexportparts"}),i=new Set([...r.part.flatMap(Te),...r.exportparts.flatMap(Re)]),o=new Set([...r.gpart.flatMap(Te),...r.gexportparts.flatMap(Te)]);i.size&&t.setAttribute("exportparts",[...s].flatMap(function(t,e){return s=>[...t].flatMap((t=>[`${t}:${s}-${t}`,...e.has(t)?[t]:[]]))}(i,o)).join(", ")),(o.size||t.hasAttribute("data-gpart"))&&t.setAttribute("gexportparts",[...o,...[...n].flatMap((t=>[...i].map((e=>`${t}-${e}`))))].join(" "))}function Be(t,e={},s={}){const{content:n,attrs:r={}}=e,{attrs:i={}}=s;function o(e,s,n,r){e!==s&&(void 0===e?t.removeAttribute(n):t.setAttribute(n,r()))}r&&function(t,e){for(const[s,n]of Object.entries(e))"string"==typeof n?t.setAttribute(s,n):"number"==typeof n?t.setAttribute(s,n.toString()):"boolean"==typeof n?!0===n?t.setAttribute(s,""):t.removeAttribute(s):void 0===n?t.removeAttribute(s):console.warn(`invalid attribute type ${s} is ${typeof n}`)}(t,r),o(r.class,i?.class,"class",(()=>r.class)),o(r.part,i?.part,"part",(()=>r.part)),o(r.gpart,i?.gpart,"data-gpart",(()=>r.gpart)),n&&Xt(n,t,{host:t})}const Ue=t=>e=>(t=>(e,s={})=>({_$litDirective$:t,values:[{meta:s,props:e}]}))(class extends Oe{#U;#ht=!0;#N=function({afterRender:t,onConnected:e,onDisconnected:s}){const n=document.createElement(je.tag);n.onConnected(e),n.onDisconnected(s);const r=n.attachShadow({mode:"open"});let i=!1;return{container:n,shadow:r,set auto_exportparts(t){i=t},render_into_shadow:e=>(Xt(e,r),i&&ze(n,r),t(),n)}}({afterRender:()=>this.#at[ae].afterRender(),onDisconnected:()=>this.disconnected(),onConnected:()=>{this.#ht||this.reconnected(),this.#ht=!1}});#Q=u(0,(()=>{this.#U&&this.isConnected&&this.setValue(this.#N.render_into_shadow(this.render(this.#U)))}));#at=new ye(this.#N.container,this.#N.shadow,this.#Q,t.context);#ct=this.#at[ae].wrap(e(this.#at));#lt=be(this.#ct,this.#Q);update(t,e){return this.#N.render_into_shadow(this.render(...e))}render(t){return Be(this.#N.container,t.meta,this.#U?.meta),this.#U=t,this.#N.auto_exportparts=t.meta.auto_exportparts??!0,this.#lt?.render(...t.props)}reconnected(){this.#at[ae].reconnect(),this.#lt=be(this.#ct,this.#Q)}disconnected(){this.#at[ae].disconnect(),this.#lt&&(this.#lt.stop(),this.#lt=void 0)}}),qe=t=>e=>class extends oe{#at=new me(this,(()=>{this.requestUpdate()}),t.context);#ct=this.#at[ae].wrap((()=>e(this.#at)));#lt;render(){return this.updateComplete.then((()=>this.#at[ae].afterRender())),this.#lt?.render()}connectedCallback(){super.connectedCallback(),this.#lt=be(this.#ct,(()=>{this.requestUpdate()})),this.#at[ae].reconnect()}disconnectedCallback(){super.disconnectedCallback(),this.#lt&&(this.#lt.stop(),this.#lt=void 0),this.#at[ae].disconnect()}},He=t=>e=>(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends Oe{#ut;#it=document.createElement(je.tag);#dt(t){return Xt(t,this.#it),this.#at[ae].afterRender(),this.#it}#Q=u(0,(()=>{this.#ut&&this.isConnected&&this.setValue(this.#dt(this.render(...this.#ut)))}));#at=new ge(this.#it,this.#Q,t.context);#ct=this.#at[ae].wrap(e(this.#at));#lt=be(this.#ct,this.#Q);update(t,e){return this.#dt(this.render(...e))}render(...t){return this.#ut=t,this.#lt?.render(...t)}reconnected(){this.#at[ae].reconnect(),this.#lt=be(this.#ct,this.#Q)}disconnected(){this.#at[ae].disconnect(),this.#lt&&(this.#lt.stop(),this.#lt=void 0)}});G` @layer reset { * { margin: 0; padding: 0; box-sizing: border-box; scrollbar-width: thin; scrollbar-color: #888 transparent; } ::-webkit-scrollbar { width: 8px; } ::-webkit-scrollbar-track { background: transparent; } ::-webkit-scrollbar-thumb { background: #333; border-radius: 1em; } ::-webkit-scrollbar-thumb:hover { background: #444; } } `;const Le=(t,...e)=>Rt(t,...e.map(C.unwrap));const Ne=G` :host { display: contents; } `;"undefined"!=typeof process&&process.versions&&process.versions.node||"undefined"!=typeof Deno&&void 0!==Deno.version||I({SlateView:je},{soft:!0});const De=new class extends we{lightComponent;shadowComponent;lightView;shadowView;shadowComponentify;constructor(t){super(t),this.lightComponent=qe(this),this.shadowComponent=ve(this),this.lightView=He(this),this.shadowView=Ue(this),this.shadowComponentify=(t=>e=>t.shadowComponent((t=>(t.styles(Ne),e([])))))(this)}component=t=>U.setup(this.context.theme)(t);components=t=>N.setup(this.context.theme)(t)}(new class{theme=[]}),Ie=De;De.lightView,De.lightComponent;const Ve=De.shadowView,We=De.shadowComponent;function Je(t,e){const s=setInterval(e,t);return()=>clearInterval(s)}De.component,De.components,De.shadowComponentify,Je.hz=(t,e)=>Je(1e3/t,e);const Ze=G` :host { color: red; font-family: monospace; } `;Ie.shadowView((t=>e=>(t.name("error-indicator"),t.styles(Ze),Le`${e||"unknown error"}`)));const Fe=G` :host { font-family: monospace; } `;function Ke(t,e,s){const n=Object.entries(e);for(const[e,r]of n)t.addEventListener(e,r,s);return function(){for(const[e,s]of n)t.removeEventListener(e,s)}}Ie.shadowView((t=>(e,s)=>{t.name("loading-indicator"),t.styles(Fe);const n=t.signal(0);return t.mount((()=>Je.hz(e,(()=>{const t=n.value+1;n.value=t<s.length?t:0})))),Le`${s[n.value]}`}));const Ge=[..."aeiou"],Ye=[..."bcdfghjklmnprstvwxyz"],Xe=new Set(["fuc","sex","cum","dic","coc","pen","vag","pus","gay","fap","jiz","fag","cun","nig","jew","goy","sem","bal","fat","god","big","dog","cow","pet","vax","sis","rot","zog","ana","uti","cat","bag","cuc","fuk","fak","wet","cux","bug","gey","pig","rat","bat","dik","bed","boy","man","fem","men","nob","rub","fut","jap","tit","gun","job","nip","but","rim","guy","suc","dad","mom","buk","jis","peg","kox","ded","mum","son","nog","hun","wop","cuk"]);function Qe(t,e){const s=e.length-t;if(s<=0)return e;const n=e.length/s,r=[];let i=n;for(let t=0;t<e.length;t++)t>=Math.round(i)?i+=n:r.push(e[t]);return r.slice(0,t)}function ts(t){return[...new Set(t)]}const es=ts(Qe(256,Ye.map((t=>Ge.map((e=>Ye.map((s=>t+e+s)))))).flat(2).filter((t=>!Xe.has(t))))),ss=ts(Qe(256,Ge.map((t=>Ye.map((e=>Ge.map((s=>t+e+s)))))).flat(2).filter((t=>!Xe.has(t))))),ns=ts([...Qe(192,es),...Qe(64,ss)]);if(256!==es.length)throw new Error("xox not 256");if(256!==ss.length)throw new Error("oxo not 256");if(256!==ns.length)throw new Error("syllables not 256");new Set([..."अआइईउऊऋएऐओऔकखगघङचछजझञटठडढणतथदधनपफबभमयरलवशषसह",..."அஆஇஈஉஊஎஏஐஒஓகஙசஜஞடணதநபமயரலவழளறன",..."অআইঈউঊএঐওকখগঘঙচছজঝঞটঠডঢণতথদধনপফবভমযরলশষসহ",..."ਅਆਇਈਉਊਏਐਓਕਖਗਘਙਚਛਜਝਞਟਠਡਢਣਤਥਦਧਨਪਫਬਭਮਯਰਲਵਸਹ",..."അആഇഈഉഊഎഏഐഒഓകഖഗഘങചഛജഝഞടഠഡഢണതഥദധനപഫബഭമയരലവശസഹളഴറ",..."અઆઇઈઉઊએઐઓકખગઘઙચછજઝઞટઠડઢણતથદધનપફબભમયરલવશષસહ",..."ଅଆଇଈଉଊଏଐଓଔକଖଗଘଙଚଛଜଝଞଟଠଡଢଣତଥଦଧନପଫବଭମଯରଲଶଷସହ"]);var rs;!function(t){t.actualize=function t(e,s){return _(s).map((s=>"function"==typeof s?(...t)=>{e.transmute((e=>(s(e,(t=>{e=t}))(...t),e)))}:t(e,s)))},t.fn=function(){return t=>t},t.blueprint=function(){return t=>t},t.prepFn=t=>e=>(s,n)=>(...r)=>(e(t(s,n))(...r),s),t.prepBlueprint=e=>s=>s(t.prepFn(e)),t.prep=function(e){return{action:t.prepFn(e),blueprint:t.prepBlueprint(e)}}}(rs||(rs={}));const is={eq(t,e){if(t.length!==e.length)return!1;for(let s=0;s<=t.length;s++)if(t.at(s)!==e.at(s))return!1;return!0},random:t=>crypto.getRandomValues(new Uint8Array(t))},os={string:t=>[...t].map((t=>t.toString(16).padStart(2,"0"))).join(""),bytes(t){if(t.length%2!=0)throw new Error("must have even number of hex characters");const e=new Uint8Array(t.length/2);for(let s=0;s<t.length;s+=2)e[s/2]=parseInt(t.slice(s,s+2),16);return e},random(t=32){return this.string(is.random(t))}},as=["doz","mar","bin","wan","sam","lit","sig","hid","fid","lis","sog","dir","wac","sab","wis","sib","rig","sol","dop","mod","fog","lid","hop","dar","dor","lor","hod","fol","rin","tog","sil","mir","hol","pas","lac","rov","liv","dal","sat","lib","tab","han","tic","pid","tor","bol","fos","dot","los","dil","for","pil","ram","tir","win","tad","bic","dif","roc","wid","bis","das","mid","lop","ril","nar","dap","mol","san","loc","nov","sit","nid","tip","sic","rop","wit","nat","pan","min","rit","pod","mot","tam","tol","sav","pos","nap","nop","som","fin","fon","ban","mor","wor","sip","ron","nor","bot","wic","soc","wat","dol","mag","pic","dav","bid","bal","tim","tas","mal","lig","siv","tag","pad","sal","div","dac","tan","sid","fab","tar","mon","ran","nis","wol","mis","pal","las","dis","map","rab","tob","rol","lat","lon","nod","nav","fig","nom","nib","pag","sop","ral","bil","had","doc","rid","moc","pac","rav","rip","fal","tod","til","tin","hap","mic","fan","pat","tac","lab","mog","sim","son","pin","lom","ric","tap","fir","has","bos","bat","poc","hac","tid","hav","sap","lin","dib","hos","dab","bit","bar","rac","par","lod","dos","bor","toc","hil","mac","tom","dig","fil","fas","mit","hob","har","mig","hin","rad","mas","hal","rag","lag","fad","top","mop","hab","nil","nos","mil","fop","fam","dat","nol","din","hat","nac","ris","fot","rib","hoc","nim","lar","fit","wal","rap","sar","nal","mos","lan","don","dan","lad","dov","riv","bac","pol","lap","tal","pit","nam","bon","ros","ton","fod","pon","sov","noc","sor","lav","mat","mip","fip"],cs=["zod","nec","bud","wes","sev","per","sut","let","ful","pen","syt","dur","wep","ser","wyl","sun","ryp","syx","dyr","nup","heb","peg","lup","dep","dys","put","lug","hec","ryt","tyv","syd","nex","lun","mep","lut","sep","pes","del","sul","ped","tem","led","tul","met","wen","byn","hex","feb","pyl","dul","het","mev","rut","tyl","wyd","tep","bes","dex","sef","wyc","bur","der","nep","pur","rys","reb","den","nut","sub","pet","rul","syn","reg","tyd","sup","sem","wyn","rec","meg","net","sec","mul","nym","tev","web","sum","mut","nyx","rex","teb","fus","hep","ben","mus","wyx","sym","sel","ruc","dec","wex","syr","wet","dyl","myn","mes","det","bet","bel","tux","tug","myr","pel","syp","ter","meb","set","dut","deg","tex","sur","fel","tud","nux","rux","ren","wyt","nub","med","lyt","dus","neb","rum","tyn","seg","lyx","pun","res","red","fun","rev","ref","mec","ted","rus","bex","leb","dux","ryn","num","pyx","ryg","ryx","fep","tyr","tus","tyc","leg","nem","fer","mer","ten","lus","nus","syl","tec","mex","pub","rym","tuc","fyl","lep","deb","ber","mug","hut","tun","byl","sud","pem","dev","lur","def","bus","bep","run","mel","pex","dyt","byt","typ","lev","myl","wed","duc","fur","fex","nul","luc","len","ner","lex","rup","ned","lec","ryd","lyd","fen","wel","nyd","hus","rel","rud","nes","hes","fet","des","ret","dun","ler","nyr","seb","hul","ryl","lud","rem","lys","fyn","wer","ryc","sug","nys","nyl","lyn","dyn","dem","lux","fed","sed","bec","mun","lyr","tes","mud","nyt","byr","sen","weg","fyr","mur","tel","rep","teg","pec","nel","nev","fes"],ls={defaults:{groupSize:4,wordSeparator:".",groupSeparator:" "},random(t,e){const s=is.random(t);return this.fromBytes(s,e)},fromBytes(t,e={}){const{groupSize:s=ls.defaults.groupSize,wordSeparator:n=ls.defaults.wordSeparator,groupSeparator:r=ls.defaults.groupSeparator}=e,i=[];let o=[];t.forEach(((t,e)=>{const s=e%2==0?as:cs;o.push(s[t]),2===o.length&&(i.push(o.join("")),o=[])})),o.length&&i.push(o.join(""));const a=[];for(let t=0;t<i.length;t+=s)a.push(i.slice(t,t+s).join(n));return a.join(r)},toBytes(t){const e=t.toLowerCase().replace(/[^a-z]/g,"");if(e.length/3%1!=0)throw new Error(`invalid triplet count, ${e.length} does not divide into triplets`);const s=[];for(let t=0;t<e.length;t+=3)s.push(e.slice(t,t+3));return new Uint8Array(s.map(((t,e)=>{const s=(e%2==0?as:cs).findIndex((e=>e===t));if(-1===s)throw new Error(`unknown triplet ${t}`);return s})))},toHex:t=>os.string(ls.toBytes(t)),fromHex:(t,e)=>ls.fromBytes(os.bytes(t),e),string:(t,e={})=>ls.fromBytes(t,e),bytes:t=>ls.toBytes(t),hex:t=>ls.toHex(t)},hs="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",us=Object.freeze({string(t){let e=BigInt("0x"+os.string(t)),s="";for(;e>0;){const t=e%BigInt(58);e/=BigInt(58),s=hs[Number(t)]+s}for(const e of t){if(0!==e)break;s=hs[0]+s}return s},bytes(t){let e=BigInt(0);for(const s of t){const t=hs.indexOf(s);if(-1===t)throw new Error(`Invalid character '${s}' in base58 string`);e=e*BigInt(58)+BigInt(t)}let s=e.toString(16);s.length%2!=0&&(s="0"+s);const n=os.bytes(s);let r=0;for(const e of t){if(e!==hs[0])break;r++}const i=new Uint8Array(r+n.length);return i.set(n,r),i},random(t=32){return this.string(is.random(t))}}),ds={defaults:{delimiter:".",sigilBytes:4,previewBytes:8},build:{fromBytes(t,e={}){const{delimiter:s,previewBytes:n,sigilBytes:r}={...ds.defaults,...e},i=e=>t.length>0?ls.fromBytes(t.slice(0,e),{wordSeparator:s,groupSeparator:s}):"",o=i(r),a=i(n),c=t.length>n?us.string(t.slice(n)):"",l=[a,c].filter((t=>t.length>0)).join(s);return{bytes:t,thumbprint:l,preview:a,bulk:c,sigil:o}},fromHex(t,e){const s=os.bytes(t);return ds.build.fromBytes(s,e)}}},ps={string:t=>"function"==typeof btoa?btoa(String.fromCharCode(...t)):Buffer.from(t).toString("base64"),bytes:t=>"function"==typeof atob?Uint8Array.from(atob(t),(t=>t.charCodeAt(0))):Uint8Array.from(Buffer.from(t,"base64")),random(t=32){return this.