@benev/tact 0.1.0-5 → 0.1.0

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.
@@ -1,6 +1,6 @@
1
- var ie=globalThis,oe=ie.ShadowRoot&&(ie.ShadyCSS===void 0||ie.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,hr=Symbol(),Cr=new WeakMap,Dt=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==hr)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(oe&&t===void 0){let s=e!==void 0&&e.length===1;s&&(t=Cr.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Cr.set(e,t))}return t}toString(){return this.cssText}},Pr=r=>new Dt(typeof r=="string"?r:r+"",void 0,hr),_=(r,...t)=>{let e=r.length===1?r[0]:t.reduce(((s,i,o)=>s+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[o+1]),r[0]);return new Dt(e,r,hr)},ne=(r,t)=>{if(oe)r.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(let e of t){let s=document.createElement("style"),i=ie.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=e.cssText,r.appendChild(s)}},nt=oe?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(let s of t.cssRules)e+=s.cssText;return Pr(e)})(r):r;var{is:Os,defineProperty:Rs,getOwnPropertyDescriptor:Ds,getOwnPropertyNames:Ts,getOwnPropertySymbols:zs,getPrototypeOf:js}=Object,ae=globalThis,Br=ae.trustedTypes,Ns=Br?Br.emptyScript:"",Ls=ae.reactiveElementPolyfillSupport,Tt=(r,t)=>r,pr={toAttribute(r,t){switch(t){case Boolean:r=r?Ns:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},Rr=(r,t)=>!Os(r,t),Or={attribute:!0,type:String,converter:pr,reflect:!1,useDefault:!1,hasChanged:Rr};Symbol.metadata??=Symbol("metadata"),ae.litPropertyMetadata??=new WeakMap;var L=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=Or){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){let s=Symbol(),i=this.getPropertyDescriptor(t,s,e);i!==void 0&&Rs(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){let{get:i,set:o}=Ds(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get:i,set(n){let c=i?.call(this);o?.call(this,n),this.requestUpdate(t,c,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Or}static _$Ei(){if(this.hasOwnProperty(Tt("elementProperties")))return;let t=js(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Tt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Tt("properties"))){let e=this.properties,s=[...Ts(e),...zs(e)];for(let i of s)this.createProperty(i,e[i])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[s,i]of e)this.elementProperties.set(s,i)}this._$Eh=new Map;for(let[e,s]of this.elementProperties){let i=this._$Eu(e,s);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let s=new Set(t.flat(1/0).reverse());for(let i of s)e.unshift(nt(i))}else t!==void 0&&e.push(nt(t));return e}static _$Eu(t,e){let s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ne(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){let s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(i!==void 0&&s.reflect===!0){let o=(s.converter?.toAttribute!==void 0?s.converter:pr).toAttribute(e,s.type);this._$Em=t,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){let s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){let o=s.getPropertyOptions(i),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:pr;this._$Em=i;let c=n.fromAttribute(e,o.type);this[i]=c??this._$Ej?.get(i)??c,this._$Em=null}}requestUpdate(t,e,s){if(t!==void 0){let i=this.constructor,o=this[t];if(s??=i.getPropertyOptions(t),!((s.hasChanged??Rr)(o,e)||s.useDefault&&s.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,s))))return;this.C(t,e,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:i,wrapped:o},n){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,n??e??this[t]),o!==!0||n!==void 0)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),i===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}let s=this.constructor.elementProperties;if(s.size>0)for(let[i,o]of s){let{wrapped:n}=o,c=this[i];n!==!0||this._$AL.has(i)||c===void 0||this.C(i,void 0,o,c)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((s=>s.hostUpdate?.())),this.update(e)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((e=>e.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((e=>this._$ET(e,this[e]))),this._$EM()}updated(t){}firstUpdated(t){}};L.elementStyles=[],L.shadowRootOptions={mode:"open"},L[Tt("elementProperties")]=new Map,L[Tt("finalized")]=new Map,Ls?.({ReactiveElement:L}),(ae.reactiveElementVersions??=[]).push("2.1.1");var dr=globalThis,ce=dr.trustedTypes,Dr=ce?ce.createPolicy("lit-html",{createHTML:r=>r}):void 0,mr="$lit$",H=`lit$${Math.random().toFixed(9).slice(2)}$`,fr="?"+H,Hs=`<${fr}>`,Q=document,jt=()=>Q.createComment(""),Nt=r=>r===null||typeof r!="object"&&typeof r!="function",gr=Array.isArray,Hr=r=>gr(r)||typeof r?.[Symbol.iterator]=="function",ur=`[
2
- \f\r]`,zt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Tr=/-->/g,zr=/>/g,J=RegExp(`>|${ur}(?:([^\\s"'>=/]+)(${ur}*=${ur}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),jr=/'/g,Nr=/"/g,Vr=/^(?:script|style|textarea|title)$/i,yr=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),v=yr(1),bi=yr(2),wi=yr(3),V=Symbol.for("lit-noChange"),S=Symbol.for("lit-nothing"),Lr=new WeakMap,Z=Q.createTreeWalker(Q,129);function qr(r,t){if(!gr(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Dr!==void 0?Dr.createHTML(t):t}var Ur=(r,t)=>{let e=r.length-1,s=[],i,o=t===2?"<svg>":t===3?"<math>":"",n=zt;for(let c=0;c<e;c++){let a=r[c],l,p,h=-1,u=0;for(;u<a.length&&(n.lastIndex=u,p=n.exec(a),p!==null);)u=n.lastIndex,n===zt?p[1]==="!--"?n=Tr:p[1]!==void 0?n=zr:p[2]!==void 0?(Vr.test(p[2])&&(i=RegExp("</"+p[2],"g")),n=J):p[3]!==void 0&&(n=J):n===J?p[0]===">"?(n=i??zt,h=-1):p[1]===void 0?h=-2:(h=n.lastIndex-p[2].length,l=p[1],n=p[3]===void 0?J:p[3]==='"'?Nr:jr):n===Nr||n===jr?n=J:n===Tr||n===zr?n=zt:(n=J,i=void 0);let m=n===J&&r[c+1].startsWith("/>")?" ":"";o+=n===zt?a+Hs:h>=0?(s.push(l),a.slice(0,h)+mr+a.slice(h)+H+m):a+H+(h===-2?c:m)}return[qr(r,o+(r[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]},Lt=class r{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let o=0,n=0,c=t.length-1,a=this.parts,[l,p]=Ur(t,e);if(this.el=r.createElement(l,s),Z.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=Z.nextNode())!==null&&a.length<c;){if(i.nodeType===1){if(i.hasAttributes())for(let h of i.getAttributeNames())if(h.endsWith(mr)){let u=p[n++],m=i.getAttribute(h).split(H),w=/([.?@])?(.*)/.exec(u);a.push({type:1,index:o,name:w[2],strings:m,ctor:w[1]==="."?he:w[1]==="?"?pe:w[1]==="@"?ue:et}),i.removeAttribute(h)}else h.startsWith(H)&&(a.push({type:6,index:o}),i.removeAttribute(h));if(Vr.test(i.tagName)){let h=i.textContent.split(H),u=h.length-1;if(u>0){i.textContent=ce?ce.emptyScript:"";for(let m=0;m<u;m++)i.append(h[m],jt()),Z.nextNode(),a.push({type:2,index:++o});i.append(h[u],jt())}}}else if(i.nodeType===8)if(i.data===fr)a.push({type:2,index:o});else{let h=-1;for(;(h=i.data.indexOf(H,h+1))!==-1;)a.push({type:7,index:o}),h+=H.length-1}o++}}static createElement(t,e){let s=Q.createElement("template");return s.innerHTML=t,s}};function tt(r,t,e=r,s){if(t===V)return t;let i=s!==void 0?e._$Co?.[s]:e._$Cl,o=Nt(t)?void 0:t._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(r),i._$AT(r,e,s)),s!==void 0?(e._$Co??=[])[s]=i:e._$Cl=i),i!==void 0&&(t=tt(r,i._$AS(r,t.values),i,s)),t}var le=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){let{el:{content:e},parts:s}=this._$AD,i=(t?.creationScope??Q).importNode(e,!0);Z.currentNode=i;let o=Z.nextNode(),n=0,c=0,a=s[0];for(;a!==void 0;){if(n===a.index){let l;a.type===2?l=new at(o,o.nextSibling,this,t):a.type===1?l=new a.ctor(o,a.name,a.strings,this,t):a.type===6&&(l=new de(o,this,t)),this._$AV.push(l),a=s[++c]}n!==a?.index&&(o=Z.nextNode(),n++)}return Z.currentNode=Q,i}p(t){let e=0;for(let s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}},at=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=S,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=tt(this,t,e),Nt(t)?t===S||t==null||t===""?(this._$AH!==S&&this._$AR(),this._$AH=S):t!==this._$AH&&t!==V&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Hr(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!==S&&Nt(this._$AH)?this._$AA.nextSibling.data=t:this.T(Q.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=Lt.createElement(qr(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(e);else{let o=new le(i,this),n=o.u(this.options);o.p(e),this.T(n),this._$AH=o}}_$AC(t){let e=Lr.get(t.strings);return e===void 0&&Lr.set(t.strings,e=new Lt(t)),e}k(t){gr(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,s,i=0;for(let o of t)i===e.length?e.push(s=new r(this.O(jt()),this.O(jt()),this,this.options)):s=e[i],s._$AI(o),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let s=t.nextSibling;t.remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},et=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,o){this.type=1,this._$AH=S,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=o,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=S}_$AI(t,e=this,s,i){let o=this.strings,n=!1;if(o===void 0)t=tt(this,t,e,0),n=!Nt(t)||t!==this._$AH&&t!==V,n&&(this._$AH=t);else{let c=t,a,l;for(t=o[0],a=0;a<o.length-1;a++)l=tt(this,c[s+a],e,a),l===V&&(l=this._$AH[a]),n||=!Nt(l)||l!==this._$AH[a],l===S?t=S:t!==S&&(t+=(l??"")+o[a+1]),this._$AH[a]=l}n&&!i&&this.j(t)}j(t){t===S?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},he=class extends et{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===S?void 0:t}},pe=class extends et{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==S)}},ue=class extends et{constructor(t,e,s,i,o){super(t,e,s,i,o),this.type=5}_$AI(t,e=this){if((t=tt(this,t,e,0)??S)===V)return;let s=this._$AH,i=t===S&&s!==S||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==S&&(s===S||i);i&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},de=class{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){tt(this,t)}},Ir={M:mr,P:H,A:fr,C:1,L:Ur,R:le,D:Hr,V:tt,I:at,H:et,N:pe,U:ue,B:he,F:de},Vs=dr.litHtmlPolyfillSupport;Vs?.(Lt,at),(dr.litHtmlVersions??=[]).push("3.3.1");var Ht=(r,t,e)=>{let s=e?.renderBefore??t,i=s._$litPart$;if(i===void 0){let o=e?.renderBefore??null;s._$litPart$=i=new at(t.insertBefore(jt(),o),o,void 0,e??{})}return i._$AI(r),i};var xr=globalThis,ct=class extends L{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Ht(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return V}};ct._$litElement$=!0,ct.finalized=!0,xr.litElementHydrateSupport?.({LitElement:ct});var qs=xr.litElementPolyfillSupport;qs?.({LitElement:ct});(xr.litElementVersions??=[]).push("4.2.1");var C=_`
1
+ var Js=Object.defineProperty;var Ys=(s,t)=>{for(var e in t)Js(s,e,{get:t[e],enumerable:!0})};var le=class{#t;constructor(t){this.#t=t.attachInternals().states}[Symbol.iterator](){return this.#t.values()}values(){return this.#t.values()}forEach(t){return this.#t.forEach(t),this}get size(){return this.#t.size}has(t){return this.#t.has(t)}add(...t){for(let e of t)this.#t.add(e);return this}delete(...t){for(let e of t)this.#t.delete(e);return this}clear(){return this.#t.clear(),this}assign(...t){return this.clear().add(...t)}};var pe=globalThis,ue=pe.ShadowRoot&&(pe.ShadyCSS===void 0||pe.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,xr=Symbol(),Hr=new WeakMap,Wt=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==xr)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(ue&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=Hr.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&Hr.set(e,t))}return t}toString(){return this.cssText}},Ur=s=>new Wt(typeof s=="string"?s:s+"",void 0,xr),E=(s,...t)=>{let e=s.length===1?s[0]:t.reduce(((r,i,o)=>r+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+s[o+1]),s[0]);return new Wt(e,s,xr)},me=(s,t)=>{if(ue)s.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(let e of t){let r=document.createElement("style"),i=pe.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=e.cssText,s.appendChild(r)}},ft=ue?s=>s:s=>s instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Ur(e)})(s):s;var{is:Xs,defineProperty:Zs,getOwnPropertyDescriptor:Qs,getOwnPropertyNames:ti,getOwnPropertySymbols:ei,getPrototypeOf:ri}=Object,de=globalThis,Vr=de.trustedTypes,si=Vr?Vr.emptyScript:"",ii=de.reactiveElementPolyfillSupport,Ft=(s,t)=>s,br={toAttribute(s,t){switch(t){case Boolean:s=s?si:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,t){let e=s;switch(t){case Boolean:e=s!==null;break;case Number:e=s===null?null:Number(s);break;case Object:case Array:try{e=JSON.parse(s)}catch{e=null}}return e}},Fr=(s,t)=>!Xs(s,t),Wr={attribute:!0,type:String,converter:br,reflect:!1,useDefault:!1,hasChanged:Fr};Symbol.metadata??=Symbol("metadata"),de.litPropertyMetadata??=new WeakMap;var V=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=Wr){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){let r=Symbol(),i=this.getPropertyDescriptor(t,r,e);i!==void 0&&Zs(this.prototype,t,i)}}static getPropertyDescriptor(t,e,r){let{get:i,set:o}=Qs(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get:i,set(n){let c=i?.call(this);o?.call(this,n),this.requestUpdate(t,c,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Wr}static _$Ei(){if(this.hasOwnProperty(Ft("elementProperties")))return;let t=ri(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Ft("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ft("properties"))){let e=this.properties,r=[...ti(e),...ei(e)];for(let i of r)this.createProperty(i,e[i])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,i]of e)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let i=this._$Eu(e,r);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let i of r)e.unshift(ft(i))}else t!==void 0&&e.push(ft(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return me(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,r){this._$AK(t,r)}_$ET(t,e){let r=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,r);if(i!==void 0&&r.reflect===!0){let o=(r.converter?.toAttribute!==void 0?r.converter:br).toAttribute(e,r.type);this._$Em=t,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){let r=this.constructor,i=r._$Eh.get(t);if(i!==void 0&&this._$Em!==i){let o=r.getPropertyOptions(i),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:br;this._$Em=i;let c=n.fromAttribute(e,o.type);this[i]=c??this._$Ej?.get(i)??c,this._$Em=null}}requestUpdate(t,e,r){if(t!==void 0){let i=this.constructor,o=this[t];if(r??=i.getPropertyOptions(t),!((r.hasChanged??Fr)(o,e)||r.useDefault&&r.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,r))))return;this.C(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:r,reflect:i,wrapped:o},n){r&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,n??e??this[t]),o!==!0||n!==void 0)||(this._$AL.has(t)||(this.hasUpdated||r||(e=void 0),this._$AL.set(t,e)),i===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[i,o]of r){let{wrapped:n}=o,c=this[i];n!==!0||this._$AL.has(i)||c===void 0||this.C(i,void 0,o,c)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((r=>r.hostUpdate?.())),this.update(e)):this._$EM()}catch(r){throw t=!1,this._$EM(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((e=>e.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((e=>this._$ET(e,this[e]))),this._$EM()}updated(t){}firstUpdated(t){}};V.elementStyles=[],V.shadowRootOptions={mode:"open"},V[Ft("elementProperties")]=new Map,V[Ft("finalized")]=new Map,ii?.({ReactiveElement:V}),(de.reactiveElementVersions??=[]).push("2.1.1");var vr=globalThis,fe=vr.trustedTypes,Gr=fe?fe.createPolicy("lit-html",{createHTML:s=>s}):void 0,$r="$lit$",W=`lit$${Math.random().toFixed(9).slice(2)}$`,Sr="?"+W,oi=`<${Sr}>`,ot=document,Kt=()=>ot.createComment(""),Jt=s=>s===null||typeof s!="object"&&typeof s!="function",kr=Array.isArray,Qr=s=>kr(s)||typeof s?.[Symbol.iterator]=="function",wr=`[
2
+ \f\r]`,Gt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Kr=/-->/g,Jr=/>/g,st=RegExp(`>|${wr}(?:([^\\s"'>=/]+)(${wr}*=${wr}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Yr=/'/g,Xr=/"/g,ts=/^(?:script|style|textarea|title)$/i,Ar=s=>(t,...e)=>({_$litType$:s,strings:t,values:e}),$=Ar(1),Ii=Ar(2),Hi=Ar(3),F=Symbol.for("lit-noChange"),_=Symbol.for("lit-nothing"),Zr=new WeakMap,it=ot.createTreeWalker(ot,129);function es(s,t){if(!kr(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return Gr!==void 0?Gr.createHTML(t):t}var rs=(s,t)=>{let e=s.length-1,r=[],i,o=t===2?"<svg>":t===3?"<math>":"",n=Gt;for(let c=0;c<e;c++){let a=s[c],h,p,l=-1,u=0;for(;u<a.length&&(n.lastIndex=u,p=n.exec(a),p!==null);)u=n.lastIndex,n===Gt?p[1]==="!--"?n=Kr:p[1]!==void 0?n=Jr:p[2]!==void 0?(ts.test(p[2])&&(i=RegExp("</"+p[2],"g")),n=st):p[3]!==void 0&&(n=st):n===st?p[0]===">"?(n=i??Gt,l=-1):p[1]===void 0?l=-2:(l=n.lastIndex-p[2].length,h=p[1],n=p[3]===void 0?st:p[3]==='"'?Xr:Yr):n===Xr||n===Yr?n=st:n===Kr||n===Jr?n=Gt:(n=st,i=void 0);let f=n===st&&s[c+1].startsWith("/>")?" ":"";o+=n===Gt?a+oi:l>=0?(r.push(h),a.slice(0,l)+$r+a.slice(l)+W+f):a+W+(l===-2?c:f)}return[es(s,o+(s[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},Yt=class s{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let o=0,n=0,c=t.length-1,a=this.parts,[h,p]=rs(t,e);if(this.el=s.createElement(h,r),it.currentNode=this.el.content,e===2||e===3){let l=this.el.content.firstChild;l.replaceWith(...l.childNodes)}for(;(i=it.nextNode())!==null&&a.length<c;){if(i.nodeType===1){if(i.hasAttributes())for(let l of i.getAttributeNames())if(l.endsWith($r)){let u=p[n++],f=i.getAttribute(l).split(W),v=/([.?@])?(.*)/.exec(u);a.push({type:1,index:o,name:v[2],strings:f,ctor:v[1]==="."?ye:v[1]==="?"?xe:v[1]==="@"?be:at}),i.removeAttribute(l)}else l.startsWith(W)&&(a.push({type:6,index:o}),i.removeAttribute(l));if(ts.test(i.tagName)){let l=i.textContent.split(W),u=l.length-1;if(u>0){i.textContent=fe?fe.emptyScript:"";for(let f=0;f<u;f++)i.append(l[f],Kt()),it.nextNode(),a.push({type:2,index:++o});i.append(l[u],Kt())}}}else if(i.nodeType===8)if(i.data===Sr)a.push({type:2,index:o});else{let l=-1;for(;(l=i.data.indexOf(W,l+1))!==-1;)a.push({type:7,index:o}),l+=W.length-1}o++}}static createElement(t,e){let r=ot.createElement("template");return r.innerHTML=t,r}};function nt(s,t,e=s,r){if(t===F)return t;let i=r!==void 0?e._$Co?.[r]:e._$Cl,o=Jt(t)?void 0:t._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(s),i._$AT(s,e,r)),r!==void 0?(e._$Co??=[])[r]=i:e._$Cl=i),i!==void 0&&(t=nt(s,i._$AS(s,t.values),i,r)),t}var ge=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){let{el:{content:e},parts:r}=this._$AD,i=(t?.creationScope??ot).importNode(e,!0);it.currentNode=i;let o=it.nextNode(),n=0,c=0,a=r[0];for(;a!==void 0;){if(n===a.index){let h;a.type===2?h=new gt(o,o.nextSibling,this,t):a.type===1?h=new a.ctor(o,a.name,a.strings,this,t):a.type===6&&(h=new we(o,this,t)),this._$AV.push(h),a=r[++c]}n!==a?.index&&(o=it.nextNode(),n++)}return it.currentNode=ot,i}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},gt=class s{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,i){this.type=2,this._$AH=_,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=nt(this,t,e),Jt(t)?t===_||t==null||t===""?(this._$AH!==_&&this._$AR(),this._$AH=_):t!==this._$AH&&t!==F&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Qr(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!==_&&Jt(this._$AH)?this._$AA.nextSibling.data=t:this.T(ot.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,i=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Yt.createElement(es(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(e);else{let o=new ge(i,this),n=o.u(this.options);o.p(e),this.T(n),this._$AH=o}}_$AC(t){let e=Zr.get(t.strings);return e===void 0&&Zr.set(t.strings,e=new Yt(t)),e}k(t){kr(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,i=0;for(let o of t)i===e.length?e.push(r=new s(this.O(Kt()),this.O(Kt()),this,this.options)):r=e[i],r._$AI(o),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let r=t.nextSibling;t.remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},at=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,o){this.type=1,this._$AH=_,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=_}_$AI(t,e=this,r,i){let o=this.strings,n=!1;if(o===void 0)t=nt(this,t,e,0),n=!Jt(t)||t!==this._$AH&&t!==F,n&&(this._$AH=t);else{let c=t,a,h;for(t=o[0],a=0;a<o.length-1;a++)h=nt(this,c[r+a],e,a),h===F&&(h=this._$AH[a]),n||=!Jt(h)||h!==this._$AH[a],h===_?t=_:t!==_&&(t+=(h??"")+o[a+1]),this._$AH[a]=h}n&&!i&&this.j(t)}j(t){t===_?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},ye=class extends at{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===_?void 0:t}},xe=class extends at{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==_)}},be=class extends at{constructor(t,e,r,i,o){super(t,e,r,i,o),this.type=5}_$AI(t,e=this){if((t=nt(this,t,e,0)??_)===F)return;let r=this._$AH,i=t===_&&r!==_||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,o=t!==_&&(r===_||i);i&&this.element.removeEventListener(this.name,this,r),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},we=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){nt(this,t)}},ss={M:$r,P:W,A:Sr,C:1,L:rs,R:ge,D:Qr,V:nt,I:gt,H:at,N:xe,U:be,B:ye,F:we},ni=vr.litHtmlPolyfillSupport;ni?.(Yt,gt),(vr.litHtmlVersions??=[]).push("3.3.1");var J=(s,t,e)=>{let r=e?.renderBefore??t,i=r._$litPart$;if(i===void 0){let o=e?.renderBefore??null;r._$litPart$=i=new gt(t.insertBefore(Kt(),o),o,void 0,e??{})}return i._$AI(s),i};var _r=globalThis,yt=class extends V{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=J(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return F}};yt._$litElement$=!0,yt.finalized=!0,_r.litElementHydrateSupport?.({LitElement:yt});var ai=_r.litElementPolyfillSupport;ai?.({LitElement:yt});(_r.litElementVersions??=[]).push("4.2.1");var P=E`
4
4
  @layer reset {
5
5
  * {
6
6
  margin: 0;
@@ -16,18 +16,18 @@ var ie=globalThis,oe=ie.ShadowRoot&&(ie.ShadyCSS===void 0||ie.ShadyCSS.nativeSha
16
16
  ::-webkit-scrollbar-thumb { background: #333; border-radius: 1em; }
17
17
  ::-webkit-scrollbar-thumb:hover { background: #444; }
18
18
  }
19
- `;var me=Object.freeze({eq(r,t){if(r.length!==t.length)return!1;for(let e=0;e<=r.length;e++)if(r.at(e)!==t.at(e))return!1;return!0},random(r){return crypto.getRandomValues(new Uint8Array(r))}});var q=Object.freeze({fromBytes(r){return[...r].map(t=>t.toString(16).padStart(2,"0")).join("")},toBytes(r){if(r.length%2!==0)throw new Error("must have even number of hex characters");let t=new Uint8Array(r.length/2);for(let e=0;e<r.length;e+=2)t[e/2]=parseInt(r.slice(e,e+2),16);return t},random(r=32){return this.fromBytes(me.random(r))},string(r){return q.fromBytes(r)},bytes(r){return q.toBytes(r)}});var br=["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"];var wr=["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"];var rt={defaults:{groupSize:4,wordSeparator:".",groupSeparator:" "},random(r,t){let e=me.random(r);return this.fromBytes(e,t)},fromBytes(r,t={}){let{groupSize:e=rt.defaults.groupSize,wordSeparator:s=rt.defaults.wordSeparator,groupSeparator:i=rt.defaults.groupSeparator}=t,o=[],n=[];r.forEach((a,l)=>{let p=l%2===0?br:wr;n.push(p[a]),n.length===2&&(o.push(n.join("")),n=[])}),n.length&&o.push(n.join(""));let c=[];for(let a=0;a<o.length;a+=e)c.push(o.slice(a,a+e).join(s));return c.join(i)},toBytes(r){let t=r.toLowerCase().replace(/[^a-z]/g,"");if(t.length/3%1!==0)throw new Error(`invalid triplet count, ${t.length} does not divide into triplets`);let s=[];for(let i=0;i<t.length;i+=3)s.push(t.slice(i,i+3));return new Uint8Array(s.map((i,o)=>{let c=(o%2===0?br:wr).findIndex(a=>a===i);if(c===-1)throw new Error(`unknown triplet ${i}`);return c}))},toHex(r){return q.fromBytes(rt.toBytes(r))},fromHex(r,t){return rt.fromBytes(q.toBytes(r),t)}};function z(r,t){let e,s,i=[];function o(){e=[],s&&clearTimeout(s),s=void 0,i=[]}return o(),((...n)=>{e=n,s&&clearTimeout(s);let c=new Promise((a,l)=>{i.push({resolve:a,reject:l})});return s=setTimeout(()=>{Promise.resolve().then(()=>t(...e)).then(a=>{for(let{resolve:l}of i)l(a);o()}).catch(a=>{for(let{reject:l}of i)l(a);o()})},r),c})}function lt(r,t=new Set){if(t.has(r))throw new Error("cannot clone circular reference");let e;return typeof r=="function"||r!==null&&typeof r=="object"?(t.add(r),Array.isArray(r)?e=r.map(s=>lt(s,new Set(t))):r.constructor===Object?e=Object.fromEntries(Object.entries(r).map(([s,i])=>[s,lt(i,new Set(t))])):r instanceof Map?e=new Map(Array.from(r,([s,i])=>[s,lt(i,new Set(t))])):r instanceof Set?e=new Set(Array.from(r,s=>lt(s,new Set(t)))):r instanceof Date?e=new Date(r.getTime()):e=r,t.delete(r)):e=r,e}var Vt=Object.freeze({happy:r=>r!=null,sad:r=>r==null,boolean:r=>typeof r=="boolean",number:r=>typeof r=="number",string:r=>typeof r=="string",bigint:r=>typeof r=="bigint",object:r=>typeof r=="object"&&r!==null,array:r=>Array.isArray(r),fn:r=>typeof r=="function",symbol:r=>typeof r=="symbol"});var Fr=(r,t)=>{function e(s,i,o){if(!Vt.object(s)||!Vt.object(i))return s===i;if(o.includes(s))throw new Error("forbidden circularity detected in deep equal comparison");let n=[...o,s];if(s instanceof Map&&i instanceof Map){if(s.size!==i.size)return!1;for(let[c,a]of s)if(!i.has(c)||!e(a,i.get(c),n))return!1}else if(s instanceof Set&&i instanceof Set){if(s.size!==i.size)return!1;for(let c of s)if(!Array.from(i).some(a=>e(c,a,n)))return!1}else{let c=Object.keys(s),a=Object.keys(i);if(c.length!==a.length)return!1;for(let l of c)if(!a.includes(l)||!e(s[l],i[l],n))return!1}return!0}return e(r,t,[])};function Wr(r){function t(e,s){if(!Vt.object(e)||s.includes(e))return e;let i=[...s,e];if(e instanceof Map)for(let o of e.entries())for(let n of o)t(n,i);else if(e instanceof Set)for(let o of e)t(o,i);else if(Array.isArray(e))for(let o of e)t(o,i);else for(let o of Object.values(e))t(o,i);return Object.freeze(e)}return t(r,[])}var fe={clone:lt,equal:Fr,freeze:Wr};function Kr(...r){return(...t)=>r.forEach(e=>e(...t))}function qt(){let r,t,e=new Promise((i,o)=>{r=i,t=o});function s(i){return i.then(r).catch(t),e}return{promise:e,resolve:r,reject:t,entangle:s}}var ge=class{getRefill;#t=[];constructor(t){this.getRefill=t,this.#e()}get currentStock(){return[...this.#t]}#e(){if(this.#t.length===0&&(this.#t=[...this.getRefill()]),this.#t.length===0)throw new Error("dispenser's getRefill returned an empty array")}takeAll(){let t=this.#t;return this.#t=[...this.getRefill()],t}takeRandom(){this.#e();let t=Math.floor(Math.random()*this.#t.length),[e]=this.#t.splice(t,1);return e}takeFirst(){return this.#e(),this.#t.shift()}takeLast(){return this.#e(),this.#t.pop()}shift=this.takeFirst.bind(this);pop=this.takeLast.bind(this)};function P(){let r=[];function t(){for(let e of r)e();r=[]}return t.schedule=e=>(r.push(e),t),t}function st(r,t){let e=Object.entries(t);for(let[s,i]of e)r.addEventListener(s,i);return()=>{for(let[s,i]of e)r.removeEventListener(s,i)}}function*Us(r){for(let t=0;t<r;t++)yield t}function ye(r){return[...Us(r)]}var k=class r extends Map{static require(t,e){if(t.has(e))return t.get(e);throw new Error(`required key not found: "${e}"`)}static guarantee(t,e,s){if(t.has(e))return t.get(e);{let i=s();return t.set(e,i),i}}array(){return[...this]}require(t){return r.require(this,t)}guarantee(t,e){return r.guarantee(this,t,e)}},xe=class r extends WeakMap{static require(t,e){if(t.has(e))return t.get(e);throw new Error("required key not found")}static guarantee(t,e,s){if(t.has(e))return t.get(e);{let i=s();return t.set(e,i),i}}require(t){return r.require(this,t)}guarantee(t,e){return r.guarantee(this,t,e)}};var ht=(r=0)=>new Promise(t=>setTimeout(t,r));function Ut(r){return{map:t=>It(r,t),filter:t=>Gr(r,t)}}Ut.pipe=Object.freeze({map:r=>(t=>It(t,r)),filter:r=>(t=>Gr(t,r))});var It=(r,t)=>Object.fromEntries(Object.entries(r).map(([e,s])=>[e,t(s,e)])),Gr=(r,t)=>Object.fromEntries(Object.entries(r).filter(([e,s])=>t(s,e)));function $r(r){return new vr(r)}var vr=class r{#t;static with=$r;constructor(t){this.#t=t}to(t){return new r(t(this.#t))}done(){return this.#t}line(...t){let e=this.#t;for(let s of t)e=s(e);return e}};function Yr(){let r=new Set;async function t(...a){await Promise.all([...r].map(l=>l(...a)))}function e(a){return r.add(a),()=>{r.delete(a)}}async function s(...a){return t(...a)}function i(a){return e(a)}async function o(a){let{promise:l,resolve:p}=qt(),h=i(async(...u)=>{a&&await a(...u),p(u),h()});return l}function n(){r.clear()}let c={pub:s,sub:i,publish:t,subscribe:e,on:e,next:o,clear:n};return Object.assign(i,c),Object.assign(s,c),c}function T(r){let t=Yr();return r&&t.sub(r),t.sub}function Ft(r){let t=Yr();return r&&t.sub(r),t.pub}function be(r){let t,e=!1,s=()=>{e=!0,clearTimeout(t)},i=async()=>{e||(await r(s),!e&&(t=setTimeout(i,0)))};return i(),s}var pt=class extends Set{array(){return[...this]}hasAll(...t){return t.every(e=>this.has(e))}adds(...t){for(let e of t)this.add(e);return this}deletes(...t){for(let e of t)this.delete(e);return this}clear(){return super.clear(),this}};function Is(r,t,e){e==null?r.removeAttribute(t):typeof e=="string"?r.setAttribute(t,e):typeof e=="number"?r.setAttribute(t,e.toString()):typeof e=="boolean"?e===!0?r.setAttribute(t,""):r.removeAttribute(t):console.warn(`invalid attribute "${t}" type is "${typeof e}"`)}function we(r,t){for(let[e,s]of t)Is(r,e,s)}function Xr(r,t){let e=document.createElement(r);return we(e,Object.entries(t)),e}function Jr(r,t){let e=new MutationObserver(t);return e.observe(r,{attributes:!0}),()=>e.disconnect()}var E={get:{string:(r,t)=>r.getAttribute(t)??void 0,number:(r,t)=>{let e=r.getAttribute(t);return e===null||!e?void 0:Number(e)},boolean:(r,t)=>r.getAttribute(t)!==null},set:{string:(r,t,e)=>(e===void 0?r.removeAttribute(t):r.setAttribute(t,e),!0),number:(r,t,e)=>(e===void 0?r.removeAttribute(t):r.setAttribute(t,e.toString()),!0),boolean:(r,t,e)=>(e?r.setAttribute(t,""):r.removeAttribute(t),!0)}};var Zr=(r,t)=>new Proxy(t,{get:(e,s)=>{switch(t[s]){case String:return E.get.string(r,s);case Number:return E.get.number(r,s);case Boolean:return E.get.boolean(r,s);default:throw new Error(`invalid attribute type for "${s}"`)}},set:(e,s,i)=>{switch(t[s]){case String:return E.set.string(r,s,i);case Number:return E.set.number(r,s,i);case Boolean:return E.set.boolean(r,s,i);default:throw new Error(`invalid attribute type for "${s}"`)}}});var ve=class{element;constructor(t){this.element=t}strings=new Proxy({},{get:(t,e)=>E.get.string(this.element,e),set:(t,e,s)=>E.set.string(this.element,e,s)});numbers=new Proxy({},{get:(t,e)=>E.get.number(this.element,e),set:(t,e,s)=>E.set.number(this.element,e,s)});booleans=new Proxy({},{get:(t,e)=>E.get.boolean(this.element,e),set:(t,e,s)=>E.set.boolean(this.element,e,s)})};function Wt(r){let t=new ve(r);return{strings:t.strings,numbers:t.numbers,booleans:t.booleans,on:e=>Jr(r,e),spec:e=>Zr(r,e)}}Wt.get=E.get;Wt.set=E.set;function Ar(r,t){let e=[];for(let[s,i]of Object.entries(t))if(typeof i=="function")r.addEventListener(s,i),e.push(()=>r.removeEventListener(s,i));else{let[o,n]=i;r.addEventListener(s,n,o),e.push(()=>r.removeEventListener(s,n))}return()=>e.forEach(s=>s())}function Qr(r){return r.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}function ts(r,t={}){let{soft:e=!1,upgrade:s=!0}=t;for(let[i,o]of Object.entries(r)){let n=Qr(i),c=customElements.get(n);e&&c||(customElements.define(n,o),s&&document.querySelectorAll(n).forEach(a=>{a.constructor===HTMLElement&&customElements.upgrade(a)}))}}function es(r,t){let e=r.querySelector(t);if(!e)throw new Error(`element not found (${t})`);return e}var $e=class r{element;constructor(t){this.element=t}in(t){return new r(typeof t=="string"?es(this.element,t):t)}require(t){let e=this.element.querySelector(t);if(!e)throw new Error(`element not found (${t})`);return e}maybe(t){return this.element.querySelector(t)}all(t){return Array.from(this.element.querySelectorAll(t))}render(...t){return Ht(t,this.element)}attrs(){return Wt(this.element)}events(t){return Ar(this.element,t)}};function f(r){return typeof r=="string"?es(document,r):new $e(r)}var I=new $e(document);f.in=I.in.bind(I);f.require=I.require.bind(I);f.maybe=I.maybe.bind(I);f.all=I.all.bind(I);f.el=Xr;f.events=Ar;f.attrs=Wt;f.register=ts;f.render=(r,...t)=>Ht(t,r);var Sr=class{#t=[];#e=new WeakMap;#r=[];#s=new Set;notifyRead(t){this.#t.at(-1)?.add(t)}async notifyWrite(t){if(this.#s.has(t))throw new Error("circularity forbidden");let e=this.#i(t).pub();return this.#r.at(-1)?.add(e),e}observe(t){this.#t.push(new Set);let e=t();return{seen:this.#t.pop(),result:e}}subscribe(t,e){return this.#i(t)(async()=>{let s=new Set;this.#r.push(s),this.#s.add(t),s.add(e()),this.#s.delete(t),await Promise.all(s),this.#r.pop()})}#i(t){let e=this.#e.get(t);return e||(e=T(),this.#e.set(t,e)),e}},M=globalThis[Symbol.for("e280.tracker")]??=new Sr;var ut=class{sneak;constructor(t){this.sneak=t}get(){return M.notifyRead(this),this.sneak}get value(){return this.get()}};var dt=class extends ut{on=T();dispose(){this.on.clear()}};function Ae(r,t=r){let{seen:e,result:s}=M.observe(r),i=z(0,t),o=[],n=()=>o.forEach(c=>c());for(let c of e){let a=M.subscribe(c,i);o.push(a)}return{result:s,dispose:n}}function mt(r,t){return r===t}var Se=class extends dt{#t;constructor(t,e){let s=e?.compare??mt,{result:i,dispose:o}=Ae(t,async()=>{let n=t();!s(this.sneak,n)&&(this.sneak=n,await Promise.all([M.notifyWrite(this),this.on.pub(n)]))});super(i),this.#t=o}toString(){return`(derived "${String(this.get())}")`}dispose(){super.dispose(),this.#t()}get core(){return this}fn(){let t=this;function e(){return t.get()}return e.core=t,e.get=t.get.bind(t),e.on=t.on,e.dispose=t.dispose.bind(t),e.fn=t.fn.bind(t),Object.defineProperty(e,"value",{get:()=>t.value}),Object.defineProperty(e,"sneak",{get:()=>t.sneak}),e}};var ke=class extends ut{#t;#e;#r=!1;#s;constructor(t,e){super(void 0),this.#t=t,this.#e=e?.compare??mt}toString(){return`($lazy "${String(this.get())}")`}get(){if(!this.#s){let{result:t,dispose:e}=Ae(this.#t,()=>this.#r=!0);this.#s=e,this.sneak=t}if(this.#r){this.#r=!1;let t=this.#t();!this.#e(this.sneak,t)&&(this.sneak=t,M.notifyWrite(this))}return super.get()}dispose(){this.#s&&this.#s()}get core(){return this}fn(){let t=this;function e(){return t.get()}return e.core=t,e.get=t.get.bind(t),e.dispose=t.dispose.bind(t),e.fn=t.fn.bind(t),Object.defineProperty(e,"value",{get:()=>t.value}),Object.defineProperty(e,"sneak",{get:()=>t.sneak}),e}};var _e=class extends dt{#t=!1;#e;constructor(t,e){super(t),this.#e=e?.compare??mt}toString(){return`($signal "${String(this.get())}")`}async set(t,e=!1){let s=this.sneak;return this.sneak=t,(e||!this.#e(s,t))&&await this.publish(),t}get value(){return this.get()}set value(t){this.set(t)}async publish(){if(this.#t)throw new Error("forbid circularity");let t=this.sneak,e=Promise.resolve();try{this.#t=!0,e=Promise.all([M.notifyWrite(this),this.on.publish(t)])}finally{this.#t=!1}return await e,t}get core(){return this}fn(){let t=this;function e(s){return arguments.length===0?t.get():t.set(arguments[0])}return e.core=t,e.get=t.get.bind(t),e.set=t.set.bind(t),e.on=t.on,e.dispose=t.dispose.bind(t),e.publish=t.publish.bind(t),e.fn=t.fn.bind(t),Object.defineProperty(e,"value",{get:()=>t.value,set:s=>t.value=s}),Object.defineProperty(e,"sneak",{get:()=>t.sneak,set:s=>t.sneak=s}),e}};function Fs(r,t){return new ke(r,t).fn()}function Ee(r,t){return new Se(r,t).fn()}function g(r,t){return new _e(r,t).fn()}g.lazy=Fs;g.derived=Ee;var F=class{#t=new k;effect(t,e){let{seen:s,result:i}=M.observe(t);for(let o of s)this.#t.guarantee(o,()=>M.subscribe(o,e));for(let[o,n]of this.#t)s.has(o)||(n(),this.#t.delete(o));return i}clear(){for(let t of this.#t.values())t();this.#t.clear()}};var ft=class{element;response;#t;constructor(t,e){this.element=t,this.response=e}start(){this.#t||(this.#t=f.attrs(this.element).on(this.response))}stop(){this.#t&&this.#t(),this.#t=void 0}};function Me(r,t){ne(r,Ks(t))}function Ks(r){let t=[];if(Array.isArray(r)){let e=new Set(r.flat(1/0).reverse());for(let s of e)t.unshift(nt(s))}else r!==void 0&&t.push(nt(r));return t}var it={status:r=>r[0],value:r=>r[0]==="ready"?r[1]:void 0,error:r=>r[0]==="error"?r[1]:void 0,select:(r,t)=>{switch(r[0]){case"loading":return t.loading();case"error":return t.error(r[1]);case"ready":return t.ready(r[1]);default:throw new Error("unknown op status")}},morph:(r,t)=>it.select(r,{loading:()=>["loading"],error:e=>["error",e],ready:e=>["ready",t(e)]}),all:(...r)=>{let t=[],e=[],s=0;for(let i of r)switch(i[0]){case"loading":s++;break;case"ready":t.push(i[1]);break;case"error":e.push(i[1]);break}return e.length>0?["error",e]:s===0?["ready",t]:["loading"]}};var gt=class{static loading(){return new this}static ready(t){return new this(["ready",t])}static error(t){return new this(["error",t])}static promise(t){let e=new this;return e.promise(t),e}static load(t){return this.promise(t())}static all(...t){let e=t.map(s=>s.pod);return it.all(...e)}signal;#t=0;#e=Ft();#r=Ft();constructor(t=["loading"]){this.signal=g(t)}get wait(){return new Promise((t,e)=>{this.#e.next().then(([s])=>t(s)),this.#r.next().then(([s])=>e(s))})}get then(){return this.wait.then.bind(this.wait)}get catch(){return this.wait.catch.bind(this.wait)}get finally(){return this.wait.finally.bind(this.wait)}async setLoading(){await this.signal.set(["loading"])}async setReady(t){await this.signal.set(["ready",t]),await this.#e(t)}async setError(t){await this.signal.set(["error",t]),await this.#r(t)}async promise(t){let e=++this.#t;await this.setLoading();try{let s=await t;return e===this.#t&&await this.setReady(s),s}catch(s){console.error(s),e===this.#t&&await this.setError(s)}}async load(t){return this.promise(t())}get pod(){return this.signal.get()}set pod(t){this.signal.set(t)}get status(){return this.signal.get()[0]}get value(){return it.value(this.signal.get())}get error(){return it.error(this.signal.get())}get isLoading(){return this.status==="loading"}get isReady(){return this.status==="ready"}get isError(){return this.status==="error"}require(){let t=this.signal.get();if(t[0]!=="ready")throw new Error("required value not ready");return t[1]}select(t){return it.select(this.signal.get(),t)}morph(t){return it.morph(this.pod,t)}};var Ce=class{#t=[];#e=[];mount(t){this.#t.push(t),this.#e.push(t())}unmountAll(){for(let t of this.#e)t();this.#e=[]}remountAll(){for(let t of this.#t)this.#e.push(t())}};var Pe=class{#t;#e;constructor(t){this.#t=t,this.#e=f.attrs(t.element)}get strings(){return this.#e.strings}get numbers(){return this.#e.numbers}get booleans(){return this.#e.booleans}spec(t){return this.#t.once(()=>this.#e.spec(t))}on(t){return this.#t.mount(()=>this.#e.on(t))}};var Kt=Symbol(),Gt=Symbol(),Yt=Symbol(),yt=class{element;shadow;renderNow;render;attrs;#t=0;#e=0;#r=new k;#s=qt();#i=new Ce;[Kt](t){this.#t++,this.#e=0,this.#s=qt();let e=t();return this.#s.resolve(),e}[Gt](){this.#i.unmountAll()}[Yt](){this.#i.remountAll()}constructor(t,e,s,i){this.element=t,this.shadow=e,this.renderNow=s,this.render=i,this.attrs=new Pe(this)}get renderCount(){return this.#t}get rendered(){return this.#s.promise}name(t){this.once(()=>this.element.setAttribute("view",t))}styles(...t){this.once(()=>Me(this.shadow,t))}css(...t){return this.styles(...t)}once(t){return this.#r.guarantee(this.#e++,t)}mount(t){return this.once(()=>this.#i.mount(t))}life(t){let e;return this.mount(()=>{let[s,i]=t();return e=s,i}),e}wake(t){return this.life(()=>[t(),()=>{}])}op=(()=>{let t=this;function e(s){return t.once(()=>gt.load(s))}return e.load=e,e.promise=s=>this.once(()=>gt.promise(s)),e})();signal=(()=>{let t=this;function e(s,i){return t.once(()=>g(s,i))}return e.derived=function(i,o){return t.once(()=>g.derived(i,o))},e.lazy=function(i,o){return t.once(()=>g.lazy(i,o))},e})();derived(t,e){return this.once(()=>g.derived(t,e))}lazy(t,e){return this.once(()=>g.lazy(t,e))}};var B=class extends HTMLElement{static styles;shadow;#t;#e=0;#r=new F;#s=new ft(this,()=>this.update());createShadow(){return this.attachShadow({mode:"open"})}constructor(){super(),this.shadow=this.createShadow(),this.#t=new yt(this,this.shadow,this.updateNow,this.update)}render(t){}updateNow=()=>{this.#t[Kt](()=>{f.render(this.shadow,this.#r.effect(()=>this.render(this.#t),this.update))})};update=z(0,this.updateNow);connectedCallback(){if(this.#e===0){let t=this.constructor.styles;t&&Me(this.shadow,t),this.updateNow()}else this.#t[Yt]();this.#s.start(),this.#e++}disconnectedCallback(){this.#t[Gt](),this.#r.clear(),this.#s.stop()}};var Be=class{#t;#e;constructor(t,e){this.#e=t,this.#t=e}attr(t,e){return this.#e.attrs.set(t,e),this}children(...t){return this.#e.children.push(...t),this}render(){return this.#t(this.#e)}};var Xt=class{props;attrs=new Map;children=[];constructor(t){this.props=t}};function rs(r,t,e,s){return class extends t{static view=xt(s,r);#t=new F;createShadow(){return this.attachShadow(r)}render(o){return s(o)(...this.#t.effect(()=>e(this),()=>this.update()))}}}var{I:Gs}=Ir;var is=r=>r.strings===void 0,ss=()=>document.createComment(""),bt=(r,t,e)=>{let s=r._$AA.parentNode,i=t===void 0?r._$AB:t._$AA;if(e===void 0){let o=s.insertBefore(ss(),i),n=s.insertBefore(ss(),i);e=new Gs(o,n,r,r.options)}else{let o=e._$AB.nextSibling,n=e._$AM,c=n!==r;if(c){let a;e._$AQ?.(r),e._$AM=r,e._$AP!==void 0&&(a=r._$AU)!==n._$AU&&e._$AP(a)}if(o!==i||c){let a=e._$AA;for(;a!==o;){let l=a.nextSibling;s.insertBefore(a,i),a=l}}}return e},W=(r,t,e=r)=>(r._$AI(t,e),r),Ys={},os=(r,t=Ys)=>r._$AH=t,ns=r=>r._$AH,Oe=r=>{r._$AR(),r._$AA.remove()};var Re={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Jt=r=>(...t)=>({_$litDirective$:r,values:t}),wt=class{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)}};var Zt=(r,t)=>{let e=r._$AN;if(e===void 0)return!1;for(let s of e)s._$AO?.(t,!1),Zt(s,t);return!0},De=r=>{let t,e;do{if((t=r._$AM)===void 0)break;e=t._$AN,e.delete(r),r=t}while(e?.size===0)},as=r=>{for(let t;t=r._$AM;r=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(r))break;e.add(r),Zs(t)}};function Xs(r){this._$AN!==void 0?(De(this),this._$AM=r,as(this)):this._$AM=r}function Js(r,t=!1,e=0){let s=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(s))for(let o=e;o<s.length;o++)Zt(s[o],!1),De(s[o]);else s!=null&&(Zt(s,!1),De(s));else Zt(this,r)}var Zs=r=>{r.type==Re.CHILD&&(r._$AP??=Js,r._$AQ??=Xs)},Te=class extends wt{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),as(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(Zt(this,t),De(this))}setValue(t){if(is(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var ze=class r extends HTMLElement{static#t=!1;static make(){return this.#t||(f.register({SlyView:r},{soft:!0,upgrade:!0}),this.#t=!0),document.createElement("sly-view")}};var je=class{viewFn;settings;#t=ze.make();#e=new F;#r;#s;#i;#o=new ft(this.#t,()=>this.#a());constructor(t,e){this.viewFn=t,this.settings=e,this.#s=this.#t.attachShadow(this.settings),this.#r=new yt(this.#t,this.#s,this.#n,this.#a)}update(t){return this.#i=t,this.#n(),this.#t}#n=()=>{this.#r[Kt](()=>{let t=this.#e.effect(()=>this.viewFn(this.#r)(...this.#i.props),()=>this.#a());we(this.#t,[...this.#i.attrs]),f.render(this.#s,t),f.render(this.#t,this.#i.children),this.#o.start()})};#a=z(0,this.#n);disconnected(){this.#r[Gt](),this.#e.clear(),this.#o.stop()}reconnected(){this.#r[Yt](),this.#o.start()}};function cs(r,t){return Jt(class extends Te{#t=new je(r,t);render(s){return this.#t.update(s)}disconnected(){this.#t.disconnected()}reconnected(){this.#t.reconnected()}})}function xt(r,t){let e=cs(r,t);function s(...i){return e(new Xt(i))}return s.props=(...i)=>new Be(new Xt(i),e),s.transmute=i=>xt(n=>{let c=r(n);return(...a)=>c(...i(...a))},t),s.component=(i=B)=>({props:o=>rs(t,i,o,r)}),s}function $(r){return xt(r,{mode:"open"})}$.settings=r=>({render:t=>xt(t,r)});$.render=$;$.component=r=>$(t=>()=>r(t)).component(B).props(()=>[]);function d(r,t){return()=>Qs({hz:r,frames:t})}var Qs=$(r=>({hz:t,frames:e})=>{r.name("loading"),r.styles(C,ti);let s=r.signal(0);return r.mount(()=>be(async()=>{await ht(1e3/t);let i=s.get()+1;s.set(i>=e.length?0:i)})),e.at(s.get())}),ti=_`
19
+ `;var xt=Object.freeze({eq(s,t){if(s.length!==t.length)return!1;let e=0;for(let r=0;r<s.length;r++)e|=s[r]^t[r];return e===0},random(s){return crypto.getRandomValues(new Uint8Array(s))}});var M=class{lexicon;static lexicons=Object.freeze({base2:{characters:"01"},hex:{characters:"0123456789abcdef",caseInsensitive:!0},base36:{characters:"0123456789abcdefghijklmnopqrstuvwxyz"},base58:{characters:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"},base62:{characters:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"},base64url:{negativePrefix:"~",characters:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"},base64:{characters:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",padding:{character:"=",size:4}}});lookup;negativePrefix;constructor(t){this.lexicon=t,this.lookup=Object.fromEntries([...t.characters].map((r,i)=>[r,i])),this.negativePrefix=t.negativePrefix??"-";let e=this.fromBytes.bind(this);return Object.setPrototypeOf(e,new.target.prototype),Object.assign(e,this),e}toBytes(t){this.lexicon.caseInsensitive&&(t=t.toLowerCase());let e=Math.log2(this.lexicon.characters.length);if(Number.isInteger(e)){let c=0,a=0,h=[];for(let p of t){if(p===this.lexicon.padding?.character)continue;let l=this.lookup[p];if(l===void 0)throw new Error(`Invalid character: ${p}`);for(c=c<<e|l,a+=e;a>=8;)a-=8,h.push(c>>a&255)}return new Uint8Array(h)}let r=0n,i=BigInt(this.lexicon.characters.length),o=!1;t.startsWith(this.negativePrefix)&&(t=t.slice(this.negativePrefix.length),o=!0);for(let c of t){let a=this.lookup[c];if(a===void 0)throw new Error(`Invalid character: ${c}`);r=r*i+BigInt(a)}let n=[];for(;r>0n;)n.unshift(Number(r%256n)),r=r/256n;return new Uint8Array(n)}fromBytes(t){let e=Math.log2(this.lexicon.characters.length);if(Number.isInteger(e)){let n=0,c=0,a="";for(let h of t)for(n=n<<8|h,c+=8;c>=e;){c-=e;let p=n>>c&(1<<e)-1;a+=this.lexicon.characters[p]}if(c>0){let h=n<<e-c&(1<<e)-1;a+=this.lexicon.characters[h]}if(this.lexicon.padding)for(;a.length%this.lexicon.padding.size!==0;)a+=this.lexicon.padding.character;return a}let r=0n;for(let n of t)r=(r<<8n)+BigInt(n);if(r===0n)return this.lexicon.characters[0];let i=BigInt(this.lexicon.characters.length),o="";for(;r>0n;)o=this.lexicon.characters[Number(r%i)]+o,r=r/i;return o}toInteger(t){if(!t)return 0;let e=0n,r=!1,i=BigInt(this.lexicon.characters.length);t.startsWith(this.negativePrefix)&&(t=t.slice(this.negativePrefix.length),r=!0);for(let o of t){let n=this.lookup[o];if(n===void 0)throw new Error(`Invalid character: ${o}`);e=e*i+BigInt(n)}return Number(r?-e:e)}fromInteger(t){t=Math.floor(t);let e=t<0,r=BigInt(e?-t:t);if(r===0n)return this.lexicon.characters[0];let i=BigInt(this.lexicon.characters.length),o="";for(;r>0n;)o=this.lexicon.characters[Number(r%i)]+o,r=r/i;return e?`${this.negativePrefix}${o}`:o}random(t=32){return this.fromBytes(xt.random(t))}};var Er=new M(M.lexicons.hex),ao=new M(M.lexicons.base2),co=new M(M.lexicons.base36),ho=new M(M.lexicons.base58),lo=new M(M.lexicons.base62),po=new M(M.lexicons.base64),uo=new M(M.lexicons.base64url);var Mr=["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"];var Pr=["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"];var bt={defaults:{groupSize:4,wordSeparator:".",groupSeparator:" "},random(s,t){let e=xt.random(s);return this.fromBytes(e,t)},fromBytes(s,t={}){let{groupSize:e=bt.defaults.groupSize,wordSeparator:r=bt.defaults.wordSeparator,groupSeparator:i=bt.defaults.groupSeparator}=t,o=[],n=[];s.forEach((a,h)=>{let p=h%2===0?Mr:Pr;n.push(p[a]),n.length===2&&(o.push(n.join("")),n=[])}),n.length&&o.push(n.join(""));let c=[];for(let a=0;a<o.length;a+=e)c.push(o.slice(a,a+e).join(r));return c.join(i)},toBytes(s){let t=s.toLowerCase().replace(/[^a-z]/g,"");if(t.length/3%1!==0)throw new Error(`invalid triplet count, ${t.length} does not divide into triplets`);let r=[];for(let i=0;i<t.length;i+=3)r.push(t.slice(i,i+3));return new Uint8Array(r.map((i,o)=>{let c=(o%2===0?Mr:Pr).findIndex(a=>a===i);if(c===-1)throw new Error(`unknown triplet ${i}`);return c}))},toHex(s){return Er.fromBytes(bt.toBytes(s))},fromHex(s,t){return bt.fromBytes(Er.toBytes(s),t)}},is=bt;var wt=Object.freeze({fromBytes(s){return[...s].map(t=>t.toString(16).padStart(2,"0")).join("")},toBytes(s){if(s.length%2!==0)throw new Error("must have even number of hex characters");let t=new Uint8Array(s.length/2);for(let e=0;e<s.length;e+=2)t[e/2]=parseInt(s.slice(e,e+2),16);return t},random(s=32){return this.fromBytes(xt.random(s))},string(s){return wt.fromBytes(s)},bytes(s){return wt.toBytes(s)}});function T(s,t){let e,r,i=[];function o(){e=[],r&&clearTimeout(r),r=void 0,i=[]}return o(),((...n)=>{e=n,r&&clearTimeout(r);let c=new Promise((a,h)=>{i.push({resolve:a,reject:h})});return r=setTimeout(()=>{Promise.resolve().then(()=>t(...e)).then(a=>{for(let{resolve:h}of i)h(a);o()}).catch(a=>{for(let{reject:h}of i)h(a);o()})},s),c})}function ct(){let s,t,e=new Promise((i,o)=>{s=i,t=o});function r(i){return i.then(s).catch(t),e}return{promise:e,resolve:s,reject:t,entangle:r}}function ve(s){let t=null;return((...e)=>(t?t.params=e:(t={params:e,deferred:ct()},queueMicrotask(()=>{let{params:r,deferred:i}=t;t=null,Promise.resolve(s(...r)).then(i.resolve).catch(i.reject)})),t.deferred.promise))}var C={};Ys(C,{clone:()=>Xt,equal:()=>ci,freeze:()=>hi});function Xt(s,t=new Set){if(t.has(s))throw new Error("cannot clone circular reference");let e;return typeof s=="function"||s!==null&&typeof s=="object"?(t.add(s),Array.isArray(s)?e=s.map(r=>Xt(r,new Set(t))):s.constructor===Object?e=Object.fromEntries(Object.entries(s).map(([r,i])=>[r,Xt(i,new Set(t))])):s instanceof Map?e=new Map(Array.from(s,([r,i])=>[r,Xt(i,new Set(t))])):s instanceof Set?e=new Set(Array.from(s,r=>Xt(r,new Set(t)))):s instanceof Date?e=new Date(s.getTime()):e=s,t.delete(s)):e=s,e}var Zt=Object.freeze({happy:s=>s!=null,sad:s=>s==null,boolean:s=>typeof s=="boolean",number:s=>typeof s=="number",string:s=>typeof s=="string",bigint:s=>typeof s=="bigint",object:s=>typeof s=="object"&&s!==null,array:s=>Array.isArray(s),fn:s=>typeof s=="function",symbol:s=>typeof s=="symbol"});var ci=(s,t)=>{function e(r,i,o){if(!Zt.object(r)||!Zt.object(i))return r===i;if(o.includes(r))throw new Error("forbidden circularity detected in deep equal comparison");let n=[...o,r];if(r instanceof Map&&i instanceof Map){if(r.size!==i.size)return!1;for(let[c,a]of r)if(!i.has(c)||!e(a,i.get(c),n))return!1}else if(r instanceof Set&&i instanceof Set){if(r.size!==i.size)return!1;for(let c of r)if(!Array.from(i).some(a=>e(c,a,n)))return!1}else{let c=Object.keys(r),a=Object.keys(i);if(c.length!==a.length)return!1;for(let h of c)if(!a.includes(h)||!e(r[h],i[h],n))return!1}return!0}return e(s,t,[])};function hi(s){function t(e,r){if(!Zt.object(e)||r.includes(e))return e;let i=[...r,e];if(e instanceof Map)for(let o of e.entries())for(let n of o)t(n,i);else if(e instanceof Set)for(let o of e)t(o,i);else if(Array.isArray(e))for(let o of e)t(o,i);else for(let o of Object.values(e))t(o,i);return Object.freeze(e)}return t(s,[])}var G=class s extends Map{static require(t,e){if(t.has(e))return t.get(e);throw new Error(`required key not found: "${e}"`)}static guarantee(t,e,r){if(t.has(e))return t.get(e);{let i=r();return t.set(e,i),i}}array(){return[...this]}require(t){return s.require(this,t)}guarantee(t,e){return s.guarantee(this,t,e)}},N=G;var Cr=class extends Set{array(){return[...this]}hasAll(...t){return t.every(e=>this.has(e))}adds(...t){for(let e of t)this.add(e);return this}deletes(...t){for(let e of t)this.delete(e);return this}clear(){return super.clear(),this}},$e=Cr;var Br=class s extends WeakMap{static require(t,e){if(t.has(e))return t.get(e);throw new Error("required key not found")}static guarantee(t,e,r){if(t.has(e))return t.get(e);{let i=r();return t.set(e,i),i}}require(t){return s.require(this,t)}guarantee(t,e){return s.guarantee(this,t,e)}},os=Br;function ns(...s){return(...t)=>s.forEach(e=>e(...t))}function*li(s){for(let t=0;t<s;t++)yield t}function Se(s){return[...li(s)]}function Or(s){let t,e=!1,r=()=>{e=!0,clearTimeout(t)},i=async()=>{e||(await s(r),!e&&(t=setTimeout(i,0)))};return i(),r}var as=Or;var ke=class{getRefill;#t=[];constructor(t){this.getRefill=t,this.#e()}get currentStock(){return[...this.#t]}#e(){if(this.#t.length===0&&(this.#t=[...this.getRefill()]),this.#t.length===0)throw new Error("dispenser's getRefill returned an empty array")}takeAll(){let t=this.#t;return this.#t=[...this.getRefill()],t}takeRandom(){this.#e();let t=Math.floor(Math.random()*this.#t.length),[e]=this.#t.splice(t,1);return e}takeFirst(){return this.#e(),this.#t.shift()}takeLast(){return this.#e(),this.#t.pop()}shift=this.takeFirst.bind(this);pop=this.takeLast.bind(this)};function O(){let s=[];function t(){for(let e of s)e();s=[]}return t.schedule=(...e)=>(s.push(...e),t),t}function ht(s,t){let e=Object.entries(t);for(let[r,i]of e)s.addEventListener(r,i);return()=>{for(let[r,i]of e)s.removeEventListener(r,i)}}var vt=(s=0)=>new Promise(t=>setTimeout(t,s));function Qt(s){return{map:t=>te(s,t),filter:t=>cs(s,t)}}Qt.pipe=Object.freeze({map:s=>(t=>te(t,s)),filter:s=>(t=>cs(t,s))});var te=(s,t)=>Object.fromEntries(Object.entries(s).map(([e,r])=>[e,t(r,e)])),cs=(s,t)=>Object.fromEntries(Object.entries(s).filter(([e,r])=>t(r,e)));function jr(s){return new Rr(s)}var Rr=class s{#t;static with=jr;constructor(t){this.#t=t}to(t){return new s(t(this.#t))}done(){return this.#t}line(...t){let e=this.#t;for(let r of t)e=r(e);return e}};function hs(){let s=new Set;async function t(...a){await Promise.all([...s].map(h=>h(...a)))}function e(a){return s.add(a),()=>{s.delete(a)}}async function r(...a){return t(...a)}function i(a){return e(a)}async function o(a){let{promise:h,resolve:p}=ct(),l=i(async(...u)=>{a&&await a(...u),p(u),l()});return h}function n(){s.clear()}let c={pub:r,sub:i,publish:t,subscribe:e,on:e,next:o,clear:n};return Object.assign(i,c),Object.assign(r,c),c}function B(s){let t=hs();return s&&t.sub(s),t.sub}function ee(s){let t=hs();return s&&t.sub(s),t.pub}var L={string:(s,t)=>s.getAttribute(t)??void 0,number:(s,t)=>{let e=s.getAttribute(t);return e===null||!e?void 0:Number(e)},boolean:(s,t)=>s.getAttribute(t)!==null},S={string:(s,t,e)=>(e===void 0?s.removeAttribute(t):s.setAttribute(t,e),!0),number:(s,t,e)=>(e===void 0?s.removeAttribute(t):s.setAttribute(t,e.toString()),!0),boolean:(s,t,e)=>(e?s.setAttribute(t,""):s.removeAttribute(t),!0),any:(s,t,e)=>{e==null?s.removeAttribute(t):typeof e=="string"?s.setAttribute(t,e):typeof e=="number"?s.setAttribute(t,e.toString()):typeof e=="boolean"?e===!0?s.setAttribute(t,""):s.removeAttribute(t):console.warn(`invalid attribute "${t}" type is "${typeof e}"`)},entries:(s,t)=>{for(let[e,r]of t)S.any(s,e,r)},record:(s,t)=>S.entries(s,Object.entries(t))};function ls(s,t={}){let e=document.createElement(s);return S.record(e,t),e}function ps(s){let t=document.createDocumentFragment();return J(s,t),t.firstElementChild}function $t(s,t){let e=[];for(let[r,i]of Object.entries(t))if(typeof i=="function")s.addEventListener(r,i),e.push(()=>s.removeEventListener(r,i));else{let[o,n]=i;s.addEventListener(r,n,o),e.push(()=>s.removeEventListener(r,n))}return()=>e.forEach(r=>r())}function us(s,t){let e=new MutationObserver(t);return e.observe(s,{attributes:!0}),()=>e.disconnect()}var ms=(s,t)=>new Proxy(t,{get:(e,r)=>{switch(t[r]){case String:return L.string(s,r);case Number:return L.number(s,r);case Boolean:return L.boolean(s,r);default:throw new Error(`invalid attribute type for "${r}"`)}},set:(e,r,i)=>{switch(t[r]){case String:return S.string(s,r,i);case Number:return S.number(s,r,i);case Boolean:return S.boolean(s,r,i);default:throw new Error(`invalid attribute type for "${r}"`)}}});var Ae=class{element;constructor(t){this.element=t}strings=new Proxy({},{get:(t,e)=>L.string(this.element,e),set:(t,e,r)=>S.string(this.element,e,r)});numbers=new Proxy({},{get:(t,e)=>L.number(this.element,e),set:(t,e,r)=>S.number(this.element,e,r)});booleans=new Proxy({},{get:(t,e)=>L.boolean(this.element,e),set:(t,e,r)=>S.boolean(this.element,e,r)})};function St(s){let t=new Ae(s);return{strings:t.strings,numbers:t.numbers,booleans:t.booleans,on:e=>us(s,e),spec:e=>ms(s,e)}}St.get=L;St.set=S;function ds(s){return new Dr(s)}var Dr=class{tagName;#t=new Map;#e=[];constructor(t){this.tagName=t}attr(t,e=!0){return this.#t.set(t,e),this}attrs(t){for(let[e,r]of Object.entries(t))this.attr(e,r);return this}children(...t){return this.#e.push(...t),this}done(){let t=document.createElement(this.tagName);return S.entries(t,this.#t),t.append(...this.#e),t}};function kt(s,t=document){let e=t.querySelector(s);if(!e)throw new Error(`element not found (${s})`);return e}function _e(s,t=document){return t.querySelector(s)}function Ee(s,t=document){return Array.from(t.querySelectorAll(s))}var Me=class s{element;#t;constructor(t){this.element=t}in(t){return new s(typeof t=="string"?kt(t,this.element):t)}require(t){return kt(t,this.element)}maybe(t){return _e(t,this.element)}all(t){return Ee(t,this.element)}render(...t){return J(t,this.element)}get attrs(){return this.#t??=St(this.element)}events(t){return $t(this.element,t)}};function fs(s){return s.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}function gs(s,t={}){let{soft:e=!1,upgrade:r=!0}=t;for(let[i,o]of Object.entries(s)){let n=fs(i),c=customElements.get(n);e&&c||(customElements.define(n,o),r&&document.querySelectorAll(n).forEach(a=>{a.constructor===HTMLElement&&customElements.upgrade(a)}))}}function d(s,t=document){return kt(s,t)}d.in=(s,t=document)=>new Me(t).in(s);d.require=kt;d.maybe=_e;d.all=Ee;d.el=ls;d.elmer=ds;d.mk=ps;d.events=$t;d.attrs=St;d.register=gs;d.render=(s,...t)=>J(t,s);function ys(s){return C.freeze(C.clone(s))}var zr=class{#t=[];#e=new WeakMap;#r=[];#s=new Set;notifyRead(t){this.#t.at(-1)?.add(t)}async notifyWrite(t){if(this.#s.has(t))throw new Error("circularity forbidden");let e=this.#i(t).pub();return this.#r.at(-1)?.add(e),e}observe(t){this.#t.push(new Set);let e=t();return{seen:this.#t.pop(),result:e}}subscribe(t,e){return this.#i(t)(async()=>{let r=new Set;this.#r.push(r),this.#s.add(t),r.add(e()),this.#s.delete(t),await Promise.all(r),this.#r.pop()})}#i(t){let e=this.#e.get(t);return e||(e=B(),this.#e.set(t,e)),e}},x=globalThis[Symbol.for("e280.tracker")]??=new zr;var q=Symbol("optic");var Pe=class{calculate;#t=!1;#e;constructor(t){this.calculate=t,this.#e=t()}get(){return this.#t&&(this.#t=!1,this.#e=this.calculate()),this.#e}invalidate(){this.#t=!0}};var Ce=class s{on=B();[q];#t;#e;#r=ve(()=>this.on.publish(this.state));constructor(t){this[q]=t,this.#t=C.clone(t.getState()),this.#e=new Pe(()=>ys(t.getState()))}async update(){let t=this[q].getState();!C.equal(t,this.#t)&&(this.#e.invalidate(),this.#t=C.clone(t),this.#r(),await x.notifyWrite(this))}get state(){return x.notifyRead(this),this.#e.get()}async mutate(t){return this[q].mutate(t)}lens(t){let e=new s({getState:()=>t(this[q].getState()),mutate:r=>this[q].mutate(i=>r(t(i))),registerLens:this[q].registerLens});return this[q].registerLens(e),e}};var At=class{sneak;constructor(t){this.sneak=t}get(){return x.notifyRead(this),this.sneak}get value(){return this.get()}};var _t=class extends At{on=B();dispose(){this.on.clear()}};function Be(s,t=s){let{seen:e,result:r}=x.observe(s),i=ve(t),o=[],n=()=>o.forEach(c=>c());for(let c of e){let a=x.subscribe(c,i);o.push(a)}return{result:r,dispose:n}}function Et(s,t){return s===t}var Oe=class extends _t{#t;constructor(t,e){let r=e?.compare??Et,{result:i,dispose:o}=Be(t,async()=>{let n=t();!r(this.sneak,n)&&(this.sneak=n,await Promise.all([x.notifyWrite(this),this.on.pub(n)]))});super(i),this.#t=o}toString(){return`(derived "${String(this.get())}")`}dispose(){super.dispose(),this.#t()}get core(){return this}fn(){let t=this;function e(){return t.get()}return e.core=t,e.get=t.get.bind(t),e.on=t.on,e.dispose=t.dispose.bind(t),e.fn=t.fn.bind(t),Object.defineProperty(e,"value",{get:()=>t.value}),Object.defineProperty(e,"sneak",{get:()=>t.sneak}),e}};var Re=class extends At{#t;#e;#r=!1;#s;constructor(t,e){super(void 0),this.#t=t,this.#e=e?.compare??Et}toString(){return`($lazy "${String(this.get())}")`}get(){if(!this.#s){let{result:t,dispose:e}=Be(this.#t,()=>this.#r=!0);this.#s=e,this.sneak=t}if(this.#r){this.#r=!1;let t=this.#t();!this.#e(this.sneak,t)&&(this.sneak=t,x.notifyWrite(this))}return super.get()}dispose(){this.#s&&this.#s()}get core(){return this}fn(){let t=this;function e(){return t.get()}return e.core=t,e.get=t.get.bind(t),e.dispose=t.dispose.bind(t),e.fn=t.fn.bind(t),Object.defineProperty(e,"value",{get:()=>t.value}),Object.defineProperty(e,"sneak",{get:()=>t.sneak}),e}};var je=class extends _t{#t=!1;#e;constructor(t,e){super(t),this.#e=e?.compare??Et}toString(){return`($signal "${String(this.get())}")`}async set(t,e=!1){let r=this.sneak;return this.sneak=t,(e||!this.#e(r,t))&&await this.publish(),t}get value(){return this.get()}set value(t){this.set(t)}async publish(){if(this.#t)throw new Error("forbid circularity");let t=this.sneak,e=Promise.resolve();try{this.#t=!0,e=Promise.all([x.notifyWrite(this),this.on.publish(t)])}finally{this.#t=!1}return await e,t}get core(){return this}fn(){let t=this;function e(r){return arguments.length===0?t.get():t.set(arguments[0])}return e.core=t,e.get=t.get.bind(t),e.set=t.set.bind(t),e.on=t.on,e.dispose=t.dispose.bind(t),e.publish=t.publish.bind(t),e.fn=t.fn.bind(t),Object.defineProperty(e,"value",{get:()=>t.value,set:r=>t.value=r}),Object.defineProperty(e,"sneak",{get:()=>t.sneak,set:r=>t.sneak=r}),e}};function pi(s,t){return new Re(s,t).fn()}function Tr(s,t){return new Oe(s,t).fn()}function g(s,t){return new je(s,t).fn()}g.lazy=pi;g.derived=Tr;var I=class{#t=new G;effect(t,e){let{seen:r,result:i}=x.observe(t);for(let o of r)this.#t.guarantee(o,()=>x.subscribe(o,e));for(let[o,n]of this.#t)r.has(o)||(n(),this.#t.delete(o));return i}clear(){for(let t of this.#t.values())t();this.#t.clear()}};var Y=class{element;response;#t;constructor(t,e){this.element=t,this.response=e}start(){this.#t||(this.#t=d.attrs(this.element).on(this.response))}stop(){this.#t&&this.#t(),this.#t=void 0}};function De(s,t){me(s,mi(t))}function mi(s){let t=[];if(Array.isArray(s)){let e=new Set(s.flat(1/0).reverse());for(let r of e)t.unshift(ft(r))}else s!==void 0&&t.push(ft(s));return t}var lt={status:s=>s[0],value:s=>s[0]==="ready"?s[1]:void 0,error:s=>s[0]==="error"?s[1]:void 0,select:(s,t)=>{switch(s[0]){case"loading":return t.loading();case"error":return t.error(s[1]);case"ready":return t.ready(s[1]);default:throw new Error("unknown op status")}},morph:(s,t)=>lt.select(s,{loading:()=>["loading"],error:e=>["error",e],ready:e=>["ready",t(e)]}),all:(...s)=>{let t=[],e=[],r=0;for(let i of s)switch(i[0]){case"loading":r++;break;case"ready":t.push(i[1]);break;case"error":e.push(i[1]);break}return e.length>0?["error",e]:r===0?["ready",t]:["loading"]}};var Mt=class{static loading(){return new this}static ready(t){return new this(["ready",t])}static error(t){return new this(["error",t])}static promise(t){let e=new this;return e.promise(t),e}static load(t){return this.promise(t())}static all(...t){let e=t.map(r=>r.pod);return lt.all(...e)}signal;#t=0;#e=ee();#r=ee();constructor(t=["loading"]){this.signal=g(t)}get wait(){return new Promise((t,e)=>{this.#e.next().then(([r])=>t(r)),this.#r.next().then(([r])=>e(r))})}get then(){return this.wait.then.bind(this.wait)}get catch(){return this.wait.catch.bind(this.wait)}get finally(){return this.wait.finally.bind(this.wait)}async setLoading(){await this.signal.set(["loading"])}async setReady(t){await this.signal.set(["ready",t]),await this.#e(t)}async setError(t){await this.signal.set(["error",t]),await this.#r(t)}async promise(t){let e=++this.#t;await this.setLoading();try{let r=await t;return e===this.#t&&await this.setReady(r),r}catch(r){console.error(r),e===this.#t&&await this.setError(r)}}async load(t){return this.promise(t())}get pod(){return this.signal.get()}set pod(t){this.signal.set(t)}get status(){return this.signal.get()[0]}get value(){return lt.value(this.signal.get())}get error(){return lt.error(this.signal.get())}get isLoading(){return this.status==="loading"}get isReady(){return this.status==="ready"}get isError(){return this.status==="error"}require(){let t=this.signal.get();if(t[0]!=="ready")throw new Error("required value not ready");return t[1]}select(t){return lt.select(this.signal.get(),t)}morph(t){return lt.morph(this.pod,t)}};var ze=class{#t=[];#e=[];mount(t){this.#t.push(t),this.#e.push(t())}unmountAll(){for(let t of this.#e)t();this.#e=[]}remountAll(){for(let t of this.#t)this.#e.push(t())}};function xs(s){let t=d.attrs(s.element);function e(r){return s.once(()=>t.spec(r))}return e.strings=t.strings,e.numbers=t.numbers,e.booleans=t.booleans,e.spec=r=>s.once(()=>t.spec(r)),e.on=r=>s.mount(()=>t.on(r)),e}var pt=Symbol(),ut=Symbol(),mt=Symbol(),X=class{element;shadow;renderNow;render;attrs;#t=0;#e=0;#r=new G;#s=ct();#i=new ze;[pt](t){this.#t++,this.#e=0,this.#s=ct();let e=t();return this.#s.resolve(),e}[ut](){this.#i.unmountAll()}[mt](){this.#i.remountAll()}constructor(t,e,r,i){this.element=t,this.shadow=e,this.renderNow=r,this.render=i,this.attrs=xs(this)}get renderCount(){return this.#t}get rendered(){return this.#s.promise}name(t){this.once(()=>this.element.setAttribute("view",t))}styles(...t){this.once(()=>De(this.shadow,t))}css(...t){return this.styles(...t)}once(t){return this.#r.guarantee(this.#e++,t)}mount(t){return this.once(()=>this.#i.mount(t))}wake(t){return this.life(()=>[t(),()=>{}])}life(t){let e=this.once(()=>({value:void 0}));return this.mount(()=>{let[r,i]=t();return e.value=r,i}),e.value}events(t){return this.mount(()=>$t(this.element,t))}states(){return this.once(()=>new le(this.element))}op=(()=>{let t=this;function e(r){return t.once(()=>Mt.load(r))}return e.load=e,e.promise=r=>this.once(()=>Mt.promise(r)),e})();signal=(()=>{let t=this;function e(r,i){return t.once(()=>g(r,i))}return e.derived=function(i,o){return t.once(()=>g.derived(i,o))},e.lazy=function(i,o){return t.once(()=>g.lazy(i,o))},e})();derived(t,e){return this.once(()=>g.derived(t,e))}lazy(t,e){return this.once(()=>g.lazy(t,e))}};var R=class extends HTMLElement{static styles;shadow;#t;#e=0;#r=new I;#s=new Y(this,()=>this.update());#i;createShadow(){return this.attachShadow({mode:"open"})}constructor(){super(),this.shadow=this.createShadow(),this.#t=new X(this,this.shadow,this.updateNow,this.update)}render(t){}updateNow=()=>{this.#t[pt](()=>{this.#i=d.render(this.shadow,this.#r.effect(()=>this.render(this.#t),this.update))})};update=T(0,this.updateNow);connectedCallback(){if(this.#e===0){let t=this.constructor.styles;t&&De(this.shadow,t),this.updateNow()}else this.#t[mt](),this.#i?.setConnected(!0);this.#s.start(),this.#e++}disconnectedCallback(){this.#i?.setConnected(!1),this.#t[ut](),this.#r.clear(),this.#s.stop()}};var Te=class{#t;#e;constructor(t,e){this.#e=t,this.#t=e}attr(t,e=!0){return this.#e.attrs.set(t,e),this}attrs(t){for(let[e,r]of Object.entries(t))this.#e.attrs.set(e,r);return this}children(...t){return this.#e.children.push(...t),this}render(){return this.#t(this.#e)}};var re=class{props;attrs=new Map;children=[];constructor(t){this.props=t}};function bs(s,t,e,r){return class extends t{static view=Pt(r,s);#t=new I;createShadow(){return this.attachShadow(s)}render(o){return r(o)(...this.#t.effect(()=>e(this),()=>this.update()))}}}var{I:di}=ss;var vs=s=>s.strings===void 0,ws=()=>document.createComment(""),Ct=(s,t,e)=>{let r=s._$AA.parentNode,i=t===void 0?s._$AB:t._$AA;if(e===void 0){let o=r.insertBefore(ws(),i),n=r.insertBefore(ws(),i);e=new di(o,n,s,s.options)}else{let o=e._$AB.nextSibling,n=e._$AM,c=n!==s;if(c){let a;e._$AQ?.(s),e._$AM=s,e._$AP!==void 0&&(a=s._$AU)!==n._$AU&&e._$AP(a)}if(o!==i||c){let a=e._$AA;for(;a!==o;){let h=a.nextSibling;r.insertBefore(a,i),a=h}}}return e},Z=(s,t,e=s)=>(s._$AI(t,e),s),fi={},$s=(s,t=fi)=>s._$AH=t,Ss=s=>s._$AH,Ne=s=>{s._$AR(),s._$AA.remove()};var Le={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},se=s=>(...t)=>({_$litDirective$:s,values:t}),Bt=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var ie=(s,t)=>{let e=s._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),ie(r,t);return!0},qe=s=>{let t,e;do{if((t=s._$AM)===void 0)break;e=t._$AN,e.delete(s),s=t}while(e?.size===0)},ks=s=>{for(let t;t=s._$AM;s=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(s))break;e.add(s),xi(t)}};function gi(s){this._$AN!==void 0?(qe(this),this._$AM=s,ks(this)):this._$AM=s}function yi(s,t=!1,e=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(r))for(let o=e;o<r.length;o++)ie(r[o],!1),qe(r[o]);else r!=null&&(ie(r,!1),qe(r));else ie(this,s)}var xi=s=>{s.type==Le.CHILD&&(s._$AP??=yi,s._$AQ??=gi)},Ie=class extends Bt{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),ks(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(ie(this,t),qe(this))}setValue(t){if(vs(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var He=class s extends HTMLElement{static#t=!1;static register(){this.#t||(d.register({SlyView:s},{soft:!0,upgrade:!0}),this.#t=!0)}static make(){return this.register(),document.createElement("sly-view")}};var Ue=class{viewFn;settings;#t;#e=new I;#r;#s;#i;#o;#n;#a;constructor(t,e,r){this.viewFn=e,this.settings=r,this.#t=t,this.#s=this.#t.attachShadow(this.settings),this.#r=new X(this.#t,this.#s,this.#c,this.#h),this.#o=new Y(this.#t,()=>this.#h())}update(t){return this.#i=t,this.#c(),this.#t}#c=()=>{this.#r[pt](()=>{let t=this.#e.effect(()=>this.viewFn(this.#r)(...this.#i.props),()=>this.#h());S.entries(this.#t,this.#i.attrs),this.#n=d.render(this.#s,t),this.#a=d.render(this.#t,this.#i.children),this.#o.start()})};#h=T(0,this.#c);disconnected(){this.#n?.setConnected(!1),this.#a?.setConnected(!1),this.#r[ut](),this.#e.clear(),this.#o.stop()}reconnected(){this.#r[mt](),this.#o.start(),this.#n?.setConnected(!0),this.#a?.setConnected(!0)}};function As(s,t){return se(class extends Ie{#t=He.make();#e=new Ue(this.#t,s,t);render(r){return this.#e.update(r)}disconnected(){this.#e.disconnected()}reconnected(){this.#e.reconnected()}})}var Ve=class{props;attrs=new Map;constructor(t){this.props=t}},We=class{viewFn;settings;#t;#e=new I;#r;#s;#i;#o;constructor(t,e,r){this.viewFn=e,this.settings=r,this.#t=t,this.#s=this.#t.attachShadow(this.settings),this.#r=new X(this.#t,this.#s,this.#n,this.#a),this.#o=new Y(this.#t,()=>this.#a())}update(t){return this.#i=t,this.#n(),this.#t}#n=()=>{this.#r[pt](()=>{let t=this.#e.effect(()=>this.viewFn(this.#r)(...this.#i.props),()=>this.#a());S.entries(this.#t,this.#i.attrs),d.render(this.#s,t),this.#o.start()})};#a=T(0,this.#n);disconnected(){this.#r[ut](),this.#e.clear(),this.#o.stop()}reconnected(){this.#r[mt](),this.#o.start()}};function Pt(s,t){let e=As(s,t);function r(...i){return e(new re(i))}return r.props=(...i)=>new Te(new re(i),e),r.transmute=i=>Pt(n=>{let c=s(n);return(...a)=>c(...i(...a))},t),r.component=(i=R)=>({props:o=>bs(t,i,o,s)}),r.naked=i=>{let o=new We(i,s,t);return{host:i,render:(...n)=>o.update(new Ve(n))}},r}function k(s){return Pt(s,{mode:"open"})}k.settings=s=>({render:t=>Pt(t,s)});k.render=k;k.component=s=>k(t=>()=>s(t)).component(R).props(()=>[]);function m(s,t){return()=>bi({hz:s,frames:t})}var bi=k(s=>({hz:t,frames:e})=>{s.name("loading"),s.styles(P,wi);let r=s.signal(0);return s.mount(()=>Or(async()=>{await vt(1e3/t);let i=r.get()+1;r.set(i>=e.length?0:i)})),e.at(r.get())}),wi=E`
20
20
  :host {
21
21
  font-family: monospace;
22
22
  white-space: pre;
23
23
  user-select: none;
24
24
  }
25
- `;var x=20,vt=10,$t=4,zc=d(x,["|","/","-","\\"]),jc=d(x,["\u2808","\u2810","\u2820","\u2880","\u2840","\u2804","\u2802","\u2801"]),Nc=d(x,["\u2B06\uFE0F","\u2197\uFE0F","\u27A1\uFE0F","\u2198\uFE0F","\u2B07\uFE0F","\u2199\uFE0F","\u2B05\uFE0F","\u2196\uFE0F"]),Lc=d(x,["\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B1\u25B0\u25B1\u25B1\u25B1","\u25B1\u25B1\u25B0\u25B1\u25B1","\u25B1\u25B1\u25B1\u25B0\u25B1","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B1","\u25B1\u25B1\u25B0\u25B1\u25B1","\u25B1\u25B0\u25B1\u25B1\u25B1"]),Hc=d(x,["\u25B1\u25B1\u25B0\u25B1\u25B1","\u25B1\u25B1\u25B1\u25B0\u25B1","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B1","\u25B1\u25B1\u25B0\u25B1\u25B1","\u25B1\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B1\u25B0\u25B1\u25B1\u25B1"]),Vc=d(x,["\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B1\u25B0\u25B0\u25B0\u25B1","\u25B1\u25B1\u25B0\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B0\u25B0\u25B0","\u25B1\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1"]),qc=d(x,["\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B1\u25B0\u25B0\u25B0\u25B0","\u25B1\u25B1\u25B0\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0"]),Uc=d(x,["\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581","\u2588\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581","\u2588\u2588\u2588\u2588\u2581","\u2588\u2588\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2588","\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2588"]),Ic=d(x,["\u2588\u2581\u2581\u2581\u2581","\u2588\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581","\u2588\u2588\u2588\u2588\u2581","\u2588\u2588\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2588","\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2588\u2588\u2588","\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581","\u2588\u2588\u2588\u2581\u2581","\u2588\u2588\u2581\u2581\u2581"]),Fc=d($t,["\u{1F6B6}","\u{1F3C3}"]),Wc=d(vt,["\u25F7","\u25F6","\u25F5","\u25F4"]),Kc=d(x,["=----","-=---","--=--","---=-","----=","----=","---=-","--=--","-=---","=----"]),Gc=d(x,["o----","-o---","--o--","---o-","----o","----o","---o-","--o--","-o---","o----"]),Yc=d(vt,["[ ]","[ ]","[= ]","[== ]","[===]","[ ==]","[ =]"]),Xc=d(vt,["[ ]","[ ]","[= ]","[== ]","[===]","[ ==]","[ =]","[ ]","[ ]","[ =]","[ ==]","[===]","[== ]","[= ]"]),Jc=d(vt,[" "," ",". ",".. ","..."," .."," ."]),Zc=d(x,[". ",". ",".. ","..."," .."," ."," ."," ..","...",".. "]),Qc=d(x,[".....",".....",":....","::...",":::..","::::.",":::::",":::::",".::::","..:::","...::","....:"]),tl=d(x,[":....",":....","::...",".::..","..::.","...::","....:","....:","...::","..::.",".::..","::..."]),el=d(x,[".....",".....","..:..",".:::.",".:::.",":::::",":::::","::.::",":...:"]),rl=d(x,[".....",".....","..:..",".:::.",".:::.",":::::",":::::","::.::",":...:",".....",".....",":...:","::.::",":::::",":::::",".:::.",".:::.","..:.."]),sl=d(x,["000","100","110","111","011","001"]),il=d(x,["11111","01111","00111","10011","11001","01100","00110","10011","11001","11100","11110"]),ol=d(x,["11111","01111","10111","11011","11101","11110","11111","11110","11101","11011","10111","01111"]),nl=d($t,["\u{1F539}","\u{1F535}"]),al=d(vt,["\u{1F642}","\u{1F642}","\u{1F617}","\u{1F619}","\u{1F618}","\u{1F618}","\u{1F619}"]),cl=d(x,["\u{1F550}","\u{1F551}","\u{1F552}","\u{1F553}","\u{1F554}","\u{1F555}","\u{1F556}","\u{1F557}","\u{1F558}","\u{1F559}","\u{1F55A}","\u{1F55B}"]),ll=d(x,["\u{1F91C} \u{1F91B}","\u{1F91C} \u{1F91B}","\u{1F91C} \u{1F91B}"," \u{1F91C} \u{1F91B} "," \u{1F91C}\u{1F91B} "," \u{1F91C}\u{1F91B} "," \u{1F91C}\u{1F4A5}\u{1F91B} ","\u{1F91C} \u{1F4A5} \u{1F91B}","\u{1F91C} \u2728 \u{1F91B}","\u{1F91C} \u2728 \u{1F91B}"]),ei=d($t,["\u{1F30E}","\u{1F30F}","\u{1F30D}"]),hl=d($t,["\u{1F513}","\u{1F512}"]),pl=d($t,["\u{1F505}","\u{1F506}"]),ul=d($t,["\u{1F508}","\u{1F508}","\u{1F509}","\u{1F50A}","\u{1F50A}","\u{1F509}"]),dl=d(vt,["\u{1F311}","\u{1F311}","\u{1F311}","\u{1F318}","\u{1F317}","\u{1F316}","\u{1F315}","\u{1F314}","\u{1F313}","\u{1F312}"]);var si=$(r=>t=>(r.name("error"),r.styles(C,ii),typeof t=="string"?t:t instanceof Error?v`<strong>${t.name}:</strong> <span>${t.message}</span>`:"error")),ii=_`
25
+ `;var b=20,Ot=10,Rt=4,Al=m(b,["|","/","-","\\"]),_l=m(b,["\u2808","\u2810","\u2820","\u2880","\u2840","\u2804","\u2802","\u2801"]),El=m(b,["\u2B06\uFE0F","\u2197\uFE0F","\u27A1\uFE0F","\u2198\uFE0F","\u2B07\uFE0F","\u2199\uFE0F","\u2B05\uFE0F","\u2196\uFE0F"]),Ml=m(b,["\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B1\u25B0\u25B1\u25B1\u25B1","\u25B1\u25B1\u25B0\u25B1\u25B1","\u25B1\u25B1\u25B1\u25B0\u25B1","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B1","\u25B1\u25B1\u25B0\u25B1\u25B1","\u25B1\u25B0\u25B1\u25B1\u25B1"]),Pl=m(b,["\u25B1\u25B1\u25B0\u25B1\u25B1","\u25B1\u25B1\u25B1\u25B0\u25B1","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B1","\u25B1\u25B1\u25B0\u25B1\u25B1","\u25B1\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B1\u25B0\u25B1\u25B1\u25B1"]),Cl=m(b,["\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B1\u25B0\u25B0\u25B0\u25B1","\u25B1\u25B1\u25B0\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B0\u25B0\u25B0","\u25B1\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1"]),Bl=m(b,["\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B1\u25B0\u25B0\u25B0\u25B0","\u25B1\u25B1\u25B0\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0"]),Ol=m(b,["\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581","\u2588\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581","\u2588\u2588\u2588\u2588\u2581","\u2588\u2588\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2588","\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2588"]),Rl=m(b,["\u2588\u2581\u2581\u2581\u2581","\u2588\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581","\u2588\u2588\u2588\u2588\u2581","\u2588\u2588\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2588","\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2588\u2588\u2588","\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581","\u2588\u2588\u2588\u2581\u2581","\u2588\u2588\u2581\u2581\u2581"]),jl=m(Rt,["\u{1F6B6}","\u{1F3C3}"]),Dl=m(Ot,["\u25F7","\u25F6","\u25F5","\u25F4"]),zl=m(b,["=----","-=---","--=--","---=-","----=","----=","---=-","--=--","-=---","=----"]),Tl=m(b,["o----","-o---","--o--","---o-","----o","----o","---o-","--o--","-o---","o----"]),Nl=m(Ot,["[ ]","[ ]","[= ]","[== ]","[===]","[ ==]","[ =]"]),Ll=m(Ot,["[ ]","[ ]","[= ]","[== ]","[===]","[ ==]","[ =]","[ ]","[ ]","[ =]","[ ==]","[===]","[== ]","[= ]"]),ql=m(Ot,[" "," ",". ",".. ","..."," .."," ."]),Il=m(b,[". ",". ",".. ","..."," .."," ."," ."," ..","...",".. "]),Hl=m(b,[".....",".....",":....","::...",":::..","::::.",":::::",":::::",".::::","..:::","...::","....:"]),Ul=m(b,[":....",":....","::...",".::..","..::.","...::","....:","....:","...::","..::.",".::..","::..."]),Vl=m(b,[".....",".....","..:..",".:::.",".:::.",":::::",":::::","::.::",":...:"]),Wl=m(b,[".....",".....","..:..",".:::.",".:::.",":::::",":::::","::.::",":...:",".....",".....",":...:","::.::",":::::",":::::",".:::.",".:::.","..:.."]),Fl=m(b,["000","100","110","111","011","001"]),Gl=m(b,["11111","01111","00111","10011","11001","01100","00110","10011","11001","11100","11110"]),Kl=m(b,["11111","01111","10111","11011","11101","11110","11111","11110","11101","11011","10111","01111"]),Jl=m(Rt,["\u{1F539}","\u{1F535}"]),Yl=m(Ot,["\u{1F642}","\u{1F642}","\u{1F617}","\u{1F619}","\u{1F618}","\u{1F618}","\u{1F619}"]),Xl=m(b,["\u{1F550}","\u{1F551}","\u{1F552}","\u{1F553}","\u{1F554}","\u{1F555}","\u{1F556}","\u{1F557}","\u{1F558}","\u{1F559}","\u{1F55A}","\u{1F55B}"]),Zl=m(b,["\u{1F91C} \u{1F91B}","\u{1F91C} \u{1F91B}","\u{1F91C} \u{1F91B}"," \u{1F91C} \u{1F91B} "," \u{1F91C}\u{1F91B} "," \u{1F91C}\u{1F91B} "," \u{1F91C}\u{1F4A5}\u{1F91B} ","\u{1F91C} \u{1F4A5} \u{1F91B}","\u{1F91C} \u2728 \u{1F91B}","\u{1F91C} \u2728 \u{1F91B}"]),vi=m(Rt,["\u{1F30E}","\u{1F30F}","\u{1F30D}"]),Ql=m(Rt,["\u{1F513}","\u{1F512}"]),tp=m(Rt,["\u{1F505}","\u{1F506}"]),ep=m(Rt,["\u{1F508}","\u{1F508}","\u{1F509}","\u{1F50A}","\u{1F50A}","\u{1F509}"]),rp=m(Ot,["\u{1F311}","\u{1F311}","\u{1F311}","\u{1F318}","\u{1F317}","\u{1F316}","\u{1F315}","\u{1F314}","\u{1F313}","\u{1F312}"]);var Si=k(s=>t=>(s.name("error"),s.styles(P,ki),typeof t=="string"?t:t instanceof Error?$`<strong>${t.name}:</strong> <span>${t.message}</span>`:"error")),ki=E`
26
26
  :host {
27
27
  font-family: monospace;
28
28
  color: red;
29
29
  }
30
- `;var y=class r{x;constructor(t){this.x=t}static new(t){return new this(t)}clone(){return new r(this.x)}set(t){return this.x=t,this}static isBetween(t,e=0,s=1){let i=Math.min(e,s),o=Math.max(e,s);return t>=i&&t<=o}isBetween(t=0,e=1){return r.isBetween(this.x,t,e)}static isNear(t,e,s=.01){return Math.abs(t-e)<=s}isNear(t,e=.01){return r.isNear(this.x,t,e)}static add(...t){let e=0;for(let s of t)e+=s;return e}add(...t){return this.x=r.add(this.x,...t),this}subtract(...t){for(let e of t)this.x-=e;return this}static atLeast(t,e=0){return Math.max(t,e)}atLeast(t=0){return this.x=r.atLeast(this.x,t),this}static atMost(t,e=1){return Math.min(t,e)}atMost(t=1){return this.x=r.atMost(this.x,t),this}static clamp(t,e=0,s=1){return t=r.atLeast(t,Math.min(e,s)),t=r.atMost(t,Math.max(e,s)),t}clamp(t=0,e=1){return this.x=r.clamp(this.x,t,e),this}static lerp(t,e,s,i){let n=(e-t)*s;return i!==void 0&&Math.abs(n)>i&&(n=Math.sign(n)*i),t+n}lerp(t,e,s){return this.x=r.lerp(this.x,t,e,s),this}static step(t,e,s){let i=e-t;return Math.abs(i)<=s?e:t+Math.sign(i)*s}step(t,e){return this.x=r.step(this.x,t,e),this}static creep(t,e,s,i){let o=t*(1-Math.exp(-e*s));if(i!==void 0){let n=i*s;Math.abs(o)>n&&(o=Math.sign(o)*n)}return o}static approach(t,e,s,i,o){let n=e-t,c=this.creep(n,s,i,o);return t+c}approach(t,e,s,i){return this.x=r.approach(this.x,t,e,s,i),this}static wrap(t,e=0,s=1){let i=Math.min(e,s),n=Math.max(e,s)-i,c=t-i,a=c<0?n- -c%n:c%n;return i+a}wrap(t=0,e=1){return this.x=r.wrap(this.x,t,e),this}static constrainProximity(t,e,s){let i=e-t,o=Math.abs(i),n=o>s?s:o,c=i<0?-n:n;return t+c}constrainProximity(t,e){return this.x=r.constrainProximity(this.x,t,e),this}static inverse(t){return 1-t}inverse(){return this.x=r.inverse(this.x),this}static center(t){return t*2-1}center(){return this.x=r.center(this.x),this}static uncenter(t){return(t+1)/2}uncenter(){return this.x=r.uncenter(this.x),this}static map(t,e,s){let o=(s-e)*t;return e+o}map(t,e){return this.x=r.map(this.x,t,e),this}static remap(t,e,s,i=0,o=1,n=!1){let a=(t-e)/(s-e)*(o-i)+i;return n?r.clamp(a,i,o):a}remap(t,e,s=0,i=1,o=!1){return this.x=r.remap(this.x,t,e,s,i,o),this}static magnify(t){return 4*Math.pow(t-.5,3)+.5}magnify(){return this.x=r.magnify(this.x),this}static floor(t){return Math.floor(t)}floor(){return this.x=r.floor(this.x),this}static ceil(t){return Math.ceil(t)}ceil(){return this.x=r.ceil(this.x),this}static round(t){return Math.round(t)}round(){return this.x=r.round(this.x),this}static smooth(t,e,s){return s<=1?e:t+(e-t)/s}smooth(t,e){return this.x=r.smooth(this.x,t,e),this}};var b=class r{x;y;constructor(t,e){this.x=t,this.y=e}static new(t,e){return new this(t,e)}static zero(){return new this(0,0)}static all(t){return new this(t,t)}static from(t){return Array.isArray(t)?new this(...t):new this(t.x,t.y)}static magnitudeSquared(t,e){return t*t+e*e}static magnitude(t,e){return Math.sqrt(this.magnitudeSquared(t,e))}static average(...t){return this.zero().add(...t).divideBy(t.length)}static min(...t){return new this(Math.min(...t.map(e=>e.x)),Math.min(...t.map(e=>e.y)))}static max(...t){return new this(Math.max(...t.map(e=>e.x)),Math.max(...t.map(e=>e.y)))}static fromAngle(t){return new this(Math.cos(t),Math.sin(t))}clone(){return new r(this.x,this.y)}*[Symbol.iterator](){yield this.x,yield this.y}toJSON(){return[this.x,this.y]}toString(){return`(Vec2 x${this.x.toFixed(2)}, y${this.y.toFixed(2)})`}set_(t,e){return this.x=t,this.y=e,this}set({x:t,y:e}){return this.x=t,this.y=e,this}magnitudeSquared(){return r.magnitudeSquared(this.x,this.y)}magnitude(){return r.magnitude(this.x,this.y)}rotation(){return Math.atan2(this.y,this.x)}equals_(t,e){return this.x===t&&this.y===e}equals(...t){return t.every(({x:e,y:s})=>this.equals_(e,s))}near_(t,e,s=1e-6){return Math.abs(this.x-t)<=s&&Math.abs(this.y-e)<=s}near({x:t,y:e},s=1e-6){return this.near_(t,e,s)}dot_(t,e){return this.x*t+this.y*e}dot({x:t,y:e}){return this.dot_(t,e)}distanceSquared_(t,e){return t=this.x-t,e=this.y-e,t*t+e*e}distanceSquared({x:t,y:e}){return this.distanceSquared_(t,e)}distance_(t,e){return Math.sqrt(this.distanceSquared_(t,e))}distance({x:t,y:e}){return this.distance_(t,e)}angleBetween_(t,e){let s=this.dot_(t,e),i=this.magnitude()*r.magnitude(t,e);if(i===0)return 0;let o=y.clamp(s/i,-1,1);return Math.acos(o)}angleBetween({x:t,y:e}){return this.angleBetween_(t,e)}normalize(){return this.divideBy(this.magnitude())}half(){return this.divideBy(2)}double(){return this.multiplyBy(2)}abs(){return this.map(t=>Math.abs(t))}rotate(t){let{x:e,y:s}=this;return this.x=e*Math.cos(t)-s*Math.sin(t),this.y=e*Math.sin(t)+s*Math.cos(t),this}perpendicular(){let{x:t,y:e}=this;return this.x=-e,this.y=t,this}clampMagnitude(t){return this.magnitude()>t&&this.normalize().multiplyBy(t),this}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}map(t){return this.x=t(this.x,0),this.y=t(this.y,1),this}morph(t){let e=t(this);return e&&e!==this&&this.set(e),this}clamp(t={x:0,y:0},e={x:1,y:1}){return this.x=y.clamp(this.x,t.x,e.x),this.y=y.clamp(this.y,t.y,e.y),this}clampBy(t=0,e=1){return this.x=y.clamp(this.x,t,e),this.y=y.clamp(this.y,t,e),this}negate(){return this.map(t=>t*-1)}addBy(t){return this.x+=t,this.y+=t,this}subtractBy(t){return this.x-=t,this.y-=t,this}multiplyBy(t){return this.x*=t,this.y*=t,this}divideBy(t){return t===0?this:(this.x/=t,this.y/=t,this)}add_(t,e){return this.x+=t,this.y+=e,this}add(...t){for(let{x:e,y:s}of t)this.add_(e,s);return this}subtract_(t,e){return this.x-=t,this.y-=e,this}subtract(...t){for(let{x:e,y:s}of t)this.subtract_(e,s);return this}multiply_(t,e){return this.x*=t,this.y*=e,this}multiply(...t){for(let{x:e,y:s}of t)this.multiply_(e,s);return this}divide_(t,e){return t!==0&&(this.x/=t),e!==0&&(this.y/=e),this}divide(...t){for(let{x:e,y:s}of t)this.divide_(e,s);return this}lerp_(t,e,s){return this.x+=(t-this.x)*s,this.y+=(e-this.y)*s,this}lerp({x:t,y:e},s){return this.lerp_(t,e,s)}approach_(t,e,s,i,o){return this.x=y.approach(this.x,t,s,i,o),this.y=y.approach(this.y,e,s,i,o),this}approach({x:t,y:e},s,i,o){return this.approach_(t,e,s,i,o)}reflect_(t,e){let s=2*this.dot_(t,e);return this.x-=s*t,this.y-=s*e,this}reflect({x:t,y:e}){return this.reflect_(t,e)}rotateAroundPoint_(t,e,s){let i=this.x-t,o=this.y-e,n=Math.cos(s),c=Math.sin(s);return this.x=n*i-c*o+t,this.y=c*i+n*o+e,this}rotateAroundPoint({x:t,y:e},s){return this.rotateAroundPoint_(t,e,s)}smooth_(t,e,s){return this.x=y.smooth(this.x,t,s),this.y=y.smooth(this.y,e,s),this}smooth({x:t,y:e},s){return this.smooth_(t,e,s)}};var Ne=class{state;players;constructor(t,e){this.state=t,this.players=e}tick(){for(let t of this.players){let{agent:e,port:{actions:s}}=t,i=1;e.position.y+=i*s.gameplay.up.value,e.position.y-=i*s.gameplay.down.value,e.position.x-=i*s.gameplay.left.value,e.position.x+=i*s.gameplay.right.value,e.position.clamp(b.zero(),this.state.arenaSize)}}};var Le=class{label="0";alive=!0;color="#444";position=b.zero()};var He=class{arenaSize=new b(200,100);agents=new Set;makeAgent(t){let e=new Le;return e.label=t,e.position.set_(.5,.5).multiply(this.arenaSize),this.agents.add(e),e}deleteAgent(t){return this.agents.delete(t),this}};var At=class{};function St(r,{start:t,end:e}){return!(t&&r<t||e&&r>e)}var Ve=class extends At{#t=new Map;async gets(...t){return t.map(e=>this.#t.get(e))}async hasKeys(...t){return t.map(e=>this.#t.has(e))}async*keys(t={}){if(t.limit===0)return;let e=0;for(let s of this.#t.keys())if(St(s,t)&&(yield s,e+=1),e>=(t.limit??1/0))break}async*entries(t={}){if(t.limit===0)return;let e=0;for(let[s,i]of this.#t.entries())if(St(s,t)&&(yield[s,i],e+=1),e>=(t.limit??1/0))break}async transaction(...t){for(let[e,s]of t)s===void 0?this.#t.delete(e):this.#t.set(e,s)}};function hs(r,t,e){let s=Object.entries(t);for(let[i,o]of s)r.addEventListener(i,o,e);return function(){for(let[o,n]of s)r.removeEventListener(o,n)}}var kt=class extends At{storage;static onStorageEvent=t=>hs(window,{storage:t});constructor(t=window.localStorage){super(),this.storage=t}async gets(...t){return t.map(e=>this.storage.getItem(e)??void 0)}async hasKeys(...t){return t.map(e=>this.storage.getItem(e)!==null)}async*keys(t={}){if(t.limit===0)return;let e=0;for(let s of Object.keys(this.storage))if(St(s,t)&&(yield s,e+=1),e>=(t.limit??1/0))break}async*entries(t={}){if(t.limit===0)return;let e=0;for(let[s,i]of Object.entries(this.storage))if(St(s,t)&&(yield[s,i],e+=1),e>=(t.limit??1/0))break}async transaction(...t){for(let[e,s]of t)s===void 0?this.storage.removeItem(e):this.storage.setItem(e,s)}};async function ps(r){let t=[];for await(let e of r)t.push(e);return t}var qe=class{kv;key;write;constructor(t,e){this.kv=t,this.key=e,this.write=new kr(t.write,e)}async set(t){return this.kv.set(this.key,t)}async get(){return this.kv.get(this.key)}async require(){return this.kv.require(this.key)}async guarantee(t){let e=await this.get();return e===void 0&&(e=await t(),await this.set(e)),e}},kr=class{key;#t;constructor(t,e){this.key=e,this.#t=t}set(t){return this.#t.set(this.key,t)}};var Qt={parse:r=>JSON.parse(r),stringify:r=>JSON.stringify(r)};var Ue=class{#t;constructor(t){this.#t=t}sets(...t){return t.map(([e,s])=>{let i=this.#t.prefix(e),o=s===void 0?void 0:Qt.stringify(s);return[i,o]})}set(t,e){return this.sets([t,e])}del(...t){return t.map(e=>[this.#t.prefix(e),void 0])}};function*us(r,t){if(r<=0)throw new Error("chunk size must be greater than zero");for(let e=0;e<t.length;e+=r)yield t.slice(e,e+r)}var Ie=class{#t;constructor(t){let{scopes:e,divisor:s,delimiter:i}=t;this.#t=e.length>0?e.join(s)+i:""}prefix=t=>this.#t+t;unprefix=t=>{let e=this.#t.length;return t.slice(e)};scan=t=>{let{limit:e}=t,s=this.#t+(t.start??""),i=this.#t+(t.end??"\xFF");return{limit:e,start:s,end:i}}};var Fe=class r{driver;static collect=ps;write;#t;#e;constructor(t=new Ve,e={}){this.driver=t,this.#t={scopes:[],divisor:".",delimiter:":",chunkSize:1e4,...e},this.#e=new Ie(this.#t),this.write=new Ue(this.#e)}async gets(...t){return(await this.driver.gets(...t.map(this.#e.prefix))).map(s=>s===void 0?s:Qt.parse(s))}async get(t){let[e]=await this.gets(t);return e}async requires(...t){let e=await this.gets(...t);for(let s of e)if(s===void 0)throw new Error("required key not found");return e}async require(t){let[e]=await this.requires(t);return e}async hasKeys(...t){return this.driver.hasKeys(...t.map(this.#e.prefix))}async has(t){let[e]=await this.hasKeys(t);return e}async*keys(t={}){for await(let e of this.driver.keys(this.#e.scan(t)))yield this.#e.unprefix(e)}async clear(t={}){let e=[];for await(let s of this.keys(t))e.push(s);for(let s of us(this.#t.chunkSize,e))await this.del(...s)}async*entries(t={}){for await(let[e,s]of this.driver.entries(this.#e.scan(t)))yield[this.#e.unprefix(e),Qt.parse(s)]}async*values(t){for await(let[,e]of this.entries(t))yield e}async transaction(t){let e=t(this.write).flat();return this.driver.transaction(...e)}async set(t,e){return this.transaction(s=>[s.set(t,e)])}async sets(...t){return this.transaction(e=>[e.sets(...t)])}async del(...t){return this.transaction(e=>[e.del(...t)])}async guarantee(t,e){let s=await this.get(t);return s===void 0&&(s=await e(),await this.transaction(i=>[i.set(t,s)])),s}async versionMigration(t,e,s){let i=this,o=await i.get(t)??0;typeof o!="number"&&(o=0),o!==e&&(await s(o),await i.set(t,e))}store(t){return new qe(this,t)}scope(t,e=this.#t.delimiter){return new r(this.driver,{...this.#t,delimiter:e,scopes:[...this.#t.scopes,t]})}flatten(){return new r(this.driver,{...this.#t,delimiter:""})}};var te=class r{profiles=new k;portProfiles=[];metaBindings=null;constructor(t){if(t){for(let e of t.profiles)this.profiles.set(e.id,e);this.portProfiles=t.portProfiles.map(e=>e&&(this.profiles.has(e)?e:null)),this.metaBindings=t.metaBindings}}toJSON(){return fe.clone({profiles:[...this.profiles.values()],portProfiles:this.portProfiles,metaBindings:this.metaBindings})}clone(){return new r(this.toJSON())}getProfile(t){return this.profiles.get(t)}getProfileForPort(t){let e=this.portProfiles.at(t);return e?this.getProfile(e):void 0}};var We=class{store;$catalog;static async load(t){let e=g(new te(await t.get()));return new this(t,e)}dispose=P();constructor(t,e){this.store=t,this.$catalog=e,this.dispose.schedule(kt.onStorageEvent(async()=>this.reload()))}async reload(){let t=new te(await this.store.get());await this.$catalog.set(t)}async save(t){await this.store.set(t.toJSON()),await this.$catalog(t)}async#t(t){let e=this.$catalog().clone(),s=t(e);return await this.store.set(e.toJSON()),await this.$catalog(e),s}async createProfile(t,e){return this.#t(s=>{let i=q.random(),o={id:i,label:t,bindings:e};return s.profiles.set(i,o),o})}async deleteProfile(t){return this.#t(e=>{e.profiles.delete(t)})}async assignPortProfile(t,e){return this.#t(s=>{s.portProfiles[t]=e})}};function O(r){return r>0}var Ke=class{on=T();onDown=T();#t=0;#e=0;get value(){return this.#t}set value(t){this.#e=this.#t,this.#t=t,this.on.publish(this),this.down&&this.onDown.publish(this)}get previous(){return this.#e}get changed(){return this.#t!==this.#e}get pressed(){return O(this.#t)}get down(){return!O(this.#e)&&O(this.#t)}get up(){return O(this.#e)&&!O(this.#t)}};var j=class extends k{constructor(t){if(super(),t)for(let[e,s]of t)this.set(e,s)}zero(){for(let t of this.keys())this.set(t,0);return this}mergeSample([t,e]){let s=this.get(t)??0;return e>s&&this.set(t,e),this}};function ds([,,r]){return{lastValue:0,holdStart:0,settings:li(r)}}function ci(){return{scale:1,invert:!1,clamp:null,range:null,bottom:null,top:null,timing:["direct"]}}function li(r={}){return{...ci(),...r}}var ms=(r,t,e)=>$r(e).line(function(i){let{settings:o}=t;if(o.clamp){let[n,c]=o.clamp;i=y.clamp(i,n,c)}if(o.range){let[n,c]=o.range;i=y.isBetween(i,n,c)?y.remap(i,n,c,0,1,!0):0}return o.bottom&&(i=i<o.bottom?0:i),o.top&&(i=Math.min(o.top,i)),i},function(i){return t.settings.invert?1-i:i},function(i){return t.settings.scale*i},function(i){let{settings:o}=t,n=(o.timing[0]==="direct"?void 0:o.timing[1])??250,c=!O(t.lastValue)&&O(i),a=O(t.lastValue)&&!O(i),l=r-t.holdStart>=n;switch(c&&(t.holdStart=r),t.lastValue=i,o.timing[0]){case"direct":return i;case"tap":return a&&!l?1:0;case"hold":return O(i)&&l?i:0;default:throw new Error("unknown bindings timing")}});function fs(r){return r.length>0?Math.max(...r):0}function gs(r){return r.length>0?Math.min(...r):0}var Ge=class{bindings;actions;#t=new Set;#e=new j;#r=0;#s=new k;#i=Ft();constructor(t){this.bindings=t,this.actions=It(t,(e,s)=>It(e,i=>{let o=new Ke;return this.#i.subscribe(()=>{o.value=this.#t.has(s)?this.#n()(i):0}),o}))}resolve(t,e,s){return this.#r=t,this.#t=e,this.#e=s,this.#i(),this.actions}#o(t,e,s){let i=this.#s.guarantee(t,()=>ds(["code",e,s])),o=this.#e.get(e)??0;return ms(this.#r,i,o)}#n=(t={count:0})=>e=>{let s=this.#n(t);if(typeof e=="string")return this.#o(t.count++,e);switch(e[0]){case"code":{let[,i,o]=e;return this.#o(t.count++,i,o)}case"and":{let[,...i]=e,o=i.map(s);return gs(o)}case"or":{let[,...i]=e,o=i.map(s);return fs(o)}case"not":{let[,i]=e;return s(i)>0?0:1}case"cond":{let[,i,o]=e;return s(o)>0?s(i):0}case"mods":{let[,i,o]=e,n=(a,...l)=>a?["or",...l]:["not",["or",...l]];return s(["cond",i,["and",n(o.ctrl??!1,"ControlLeft","ControlRight"),n(o.alt??!1,"AltLeft","AltRight"),n(o.meta??!1,"MetaLeft","MetaRight"),n(o.shift??!1,"ShiftLeft","ShiftRight")]])>0?s(i):0}}}};var K=class{*[Symbol.iterator](){for(let t of this.samples())yield t}};var _t=class extends K{devices=new pt;#t=new j;constructor(...t){super(),this.devices.adds(...t)}*samples(){this.#t.zero();for(let t of this.devices)for(let e of t.samples())this.#t.mergeSample(e);yield*this.#t.entries()}};var G=class extends Ge{#t=new _t;devices=this.#t.devices;modes=new pt;constructor(t){super(t),this.modes.adds(...Object.keys(t))}resolve(t=Date.now()){let e=new j(this.#t.samples());return super.resolve(t,this.modes,e)}};var ot="meta";var Et=()=>({[ot]:{revealOverlay:["or","Backslash","gamepad.beta","gamepad.gamma"],shimmyNext:["or","BracketRight",["and",["or","gamepad.beta","gamepad.gamma"],"gamepad.right"],["and",["or","gamepad.beta","gamepad.gamma"],"gamepad.bumper.right"]],shimmyPrevious:["or","BracketLeft",["and",["or","gamepad.beta","gamepad.gamma"],"gamepad.left"],["and",["or","gamepad.beta","gamepad.gamma"],"gamepad.bumper.left"]]}});var Ye=class{device;metaPort;constructor(t,e=Et()){this.device=t,this.metaPort=new G(e),this.metaPort.devices.add(t)}};var Xe=class{ports;metaBindings;on=T();#t=new k;metaPort;constructor(t,e=Et()){this.ports=t,this.metaBindings=e,this.metaPort=new G(e)}poll(t=Date.now()){return this.#r(t),this.#s(t),this.#i(t)}portByIndex(t){let e=this.ports.at(t);if(!e)throw new Error(`port ${t} not found`);return e}portByDevice(t){for(let e of this.ports)if(e.devices.has(t))return e}shimmy(t,e){let s=this.ports.findIndex(c=>c.devices.has(t)),i=Math.max(0,this.ports.length-1),o=y.clamp(s+e,0,i),n=this.portByIndex(o);return this.reassign(t,n),n}reassign(t,e=this.getLonelyPort()){this.ports.forEach(s=>s.devices.delete(t)),e.devices.add(t),this.#e()}unplug(t){this.ports.forEach(e=>e.devices.delete(t)),this.#t.delete(t),this.#e()}plug=(t,e=this.getLonelyPort())=>(this.unplug(t),this.#t.set(t,new Ye(t,this.metaBindings)),e.devices.add(t),this.#e(),()=>this.unplug(t));getLonelyPort(){let t=this.ports.at(0);for(let e of this.ports)e.devices.size<t.devices.size&&(t=e);return t}#e=z(0,()=>this.on.publish());#r(t){this.metaPort.devices.clear(),this.metaPort.devices.adds(...this.#t.keys()),this.metaPort.resolve(t)}#s(t){for(let e of this.#t.values()){let s=e.metaPort.resolve(t);s[ot].shimmyNext.down&&this.shimmy(e.device,1),s[ot].shimmyPrevious.down&&this.shimmy(e.device,-1)}}#i(t){return this.ports.map(e=>(e.resolve(t),e))}};function ys(r,t){let e=fe.clone(r);if(!t)return e;for(let[s,i]of Object.entries(e))for(let o of Object.keys(i)){let n=t[s]?.[o];n&&(i[o]=n)}return e}function ee(r){return r>=0?[r,0]:[0,Math.abs(r)]}function re(r){let[t,e]=ee(r.x),[s,i]=ee(r.y);return{up:i,down:s,left:e,right:t}}var U=class extends K{channel;$vector=g(b.zero());$breakdown=Ee(()=>re(this.$vector.get()));constructor(t="stick"){super(),this.channel=t}samples(){let{channel:t}=this,{up:e,down:s,left:i,right:o}=this.$breakdown.get();return[[`${t}.up`,e],[`${t}.down`,s],[`${t}.left`,i],[`${t}.right`,o]]}};var N=class extends K{on=T();sampleMap=new j;setSample(t,e){return this.sampleMap.set(t,e),this.on.pub(t,e),this}*samples(){for(let t of this.sampleMap)yield t}};var Mt=class extends N{stickLeft=new U;stickRight=new U;samples(){let t=this.stickLeft.$breakdown();this.setSample("gamepad.stick.left.up",t.up),this.setSample("gamepad.stick.left.down",t.down),this.setSample("gamepad.stick.left.left",t.left),this.setSample("gamepad.stick.left.right",t.right);let e=this.stickRight.$breakdown();return this.setSample("gamepad.stick.right.up",e.up),this.setSample("gamepad.stick.right.down",e.down),this.setSample("gamepad.stick.right.left",e.left),this.setSample("gamepad.stick.right.right",e.right),super.samples()}};var Je=class r extends N{client=new b(0,0);movement=new b(0,0);dispose=P();constructor(t=window){super(),this.dispose.schedule(st(t,{pointerdown:e=>{let s=r.buttonCode(e);this.setSample(s,1)},pointerup:e=>{let s=r.buttonCode(e);this.setSample(s,0)},pointermove:e=>{this.client.x=e.clientX,this.client.y=e.clientY,this.movement.x+=e.movementX,this.movement.y+=e.movementY},wheel:e=>{this.sampleMap.set("pointer.wheel.right",0),this.sampleMap.set("pointer.wheel.left",0),this.sampleMap.set("pointer.wheel.up",0),this.sampleMap.set("pointer.wheel.down",0);for(let[s,i]of r.wheelCodes(e))this.setSample(s,i)}}))}static buttonCode(t){switch(t.button){case 0:return"pointer.button.left";case 1:return"pointer.button.middle";case 2:return"pointer.button.right";default:return`pointer.button.${t.button+1}`}}static wheelCodes(t){let e=[];return t.deltaX&&e.push([t.deltaX>0?"pointer.wheel.right":"pointer.wheel.left",t.deltaX]),t.deltaY&&e.push([t.deltaY>0?"pointer.wheel.down":"pointer.wheel.up",t.deltaY]),e}samples(){return this.#t(),super.samples()}#t(){let[t,e]=this.movement,[s,i]=ee(t),[o,n]=ee(e);t&&(t>=0?this.setSample("pointer.move.right",Math.abs(i)):this.setSample("pointer.move.left",Math.abs(s))),e&&(e>=0?this.setSample("pointer.move.up",Math.abs(n)):this.setSample("pointer.move.down",Math.abs(o))),this.movement.set_(0,0)}};var Ze=class extends N{dispose=P();constructor(t=window){super(),this.dispose.schedule(st(t,this.#t)),this.dispose.schedule(st(window,this.#e))}#t={keydown:t=>{if(t.repeat)return null;this.setSample(t.code,1)},keyup:t=>{if(t.repeat)return null;this.setSample(t.code,0)}};#e={blur:()=>{this.sampleMap.zero()}}};var Y=class extends _t{keyboard=new Ze;pointer=new Je;vpad=new Mt;constructor(){super(),this.devices.add(this.keyboard).add(this.pointer).add(this.vpad)}};function se(r,t){let e=b.from(r),s=e.distance_(0,0),i=y.remap(s,t.x,t.y,0,1,!0);return e.normalize().multiplyBy(i)}var hi=["gamepad.a","gamepad.b","gamepad.x","gamepad.y","gamepad.bumper.left","gamepad.bumper.right","gamepad.trigger.left","gamepad.trigger.right","gamepad.alpha","gamepad.beta","gamepad.stick.left.click","gamepad.stick.right.click","gamepad.up","gamepad.down","gamepad.left","gamepad.right","gamepad.gamma"],Ct=class extends N{pad;range=new b(.2,.9);constructor(t){super(),this.pad=t}get gamepad(){return this.pad.gamepad}samples(){return this.#t(this.pad.gamepad),this.#e(this.pad.gamepad),super.samples()}#t(t){let e=0,s=i=>{e=Math.max(e,i)};for(let[i,o]of hi.entries()){let n=t.buttons.at(i)?.value??0;s(n),this.setSample(o,n)}this.setSample("gamepad.any",e)}#e(t){let[e=0,s=0,i=0,o=0]=t.axes,n=re(se(new b(e,s),this.range)),c=re(se(new b(i,o),this.range));this.setSample("gamepad.stick.left.up",n.up),this.setSample("gamepad.stick.left.down",n.down),this.setSample("gamepad.stick.left.left",n.left),this.setSample("gamepad.stick.left.right",n.right),this.setSample("gamepad.stick.right.up",c.up),this.setSample("gamepad.stick.right.down",c.down),this.setSample("gamepad.stick.right.left",c.left),this.setSample("gamepad.stick.right.right",c.right)}};var Qe=class{fallback="\u2754";#t=new Map;constructor(t=[[Y,"\u{1F4BB}"],[Ct,"\u{1F3AE}"],[Mt,"\u{1F4F1}"]]){this.add(...t)}get(t){return this.#t.get(t)??this.fallback}add(...t){for(let[e,s]of t)this.#t.set(e,s);return this}clear(){return this.#t.clear(),this}};var pi=r=>ye(r).map(t=>`hsl(${(t*(360/r)+180)%360}deg, 100%, 50%)`),tr=class extends ge{constructor(){super(()=>pi(12))}};var _r=class{icon;label;color;constructor(t,e,s){this.icon=t,this.label=e,this.color=s}},Pt=class{icons=new Qe;#t=new xe;#e=new tr;get(t){return this.#t.guarantee(t,()=>new _r(this.icons.get(t.constructor),q.random(4),this.#e.takeFirst()))}};var er=class{hub;deviceSkins;auto=!0;dispose=P();#t=Date.now();#e=g(!1);$manual=g(!1);$visible=g.derived(()=>this.$manual()||this.auto&&this.#e());$showLabels=g(!1);constructor(t,e=new Pt){this.hub=t,this.deviceSkins=e,this.dispose.schedule(t.on(async()=>{Date.now()-this.#t>100&&await this.bump()}))}#r=z(1500,()=>this.#e(!1));async bump(){await this.#e(!0),await this.#r()}async toggle(t=!this.$manual()){return this.$manual.set(t)}};var xs=_`
30
+ `;var y=class s{x;constructor(t){this.x=t}static new(t){return new this(t)}clone(){return new s(this.x)}set(t){return this.x=t,this}static isBetween(t,e=0,r=1){let i=Math.min(e,r),o=Math.max(e,r);return t>=i&&t<=o}isBetween(t=0,e=1){return s.isBetween(this.x,t,e)}static isNear(t,e,r=.01){return Math.abs(t-e)<=r}isNear(t,e=.01){return s.isNear(this.x,t,e)}static add(...t){let e=0;for(let r of t)e+=r;return e}add(...t){return this.x=s.add(this.x,...t),this}subtract(...t){for(let e of t)this.x-=e;return this}static atLeast(t,e=0){return Math.max(t,e)}atLeast(t=0){return this.x=s.atLeast(this.x,t),this}static atMost(t,e=1){return Math.min(t,e)}atMost(t=1){return this.x=s.atMost(this.x,t),this}static clamp(t,e=0,r=1){return t=s.atLeast(t,Math.min(e,r)),t=s.atMost(t,Math.max(e,r)),t}clamp(t=0,e=1){return this.x=s.clamp(this.x,t,e),this}static lerp(t,e,r,i){let n=(e-t)*r;return i!==void 0&&Math.abs(n)>i&&(n=Math.sign(n)*i),t+n}lerp(t,e,r){return this.x=s.lerp(this.x,t,e,r),this}static step(t,e,r){let i=e-t;return Math.abs(i)<=r?e:t+Math.sign(i)*r}step(t,e){return this.x=s.step(this.x,t,e),this}static creep(t,e,r,i){let o=t*(1-Math.exp(-e*r));if(i!==void 0){let n=i*r;Math.abs(o)>n&&(o=Math.sign(o)*n)}return o}static approach(t,e,r,i,o){let n=e-t,c=this.creep(n,r,i,o);return t+c}approach(t,e,r,i){return this.x=s.approach(this.x,t,e,r,i),this}static wrap(t,e=0,r=1){let i=Math.min(e,r),n=Math.max(e,r)-i,c=t-i,a=c<0?n- -c%n:c%n;return i+a}wrap(t=0,e=1){return this.x=s.wrap(this.x,t,e),this}static constrainProximity(t,e,r){let i=e-t,o=Math.abs(i),n=o>r?r:o,c=i<0?-n:n;return t+c}constrainProximity(t,e){return this.x=s.constrainProximity(this.x,t,e),this}static inverse(t){return 1-t}inverse(){return this.x=s.inverse(this.x),this}static center(t){return t*2-1}center(){return this.x=s.center(this.x),this}static uncenter(t){return(t+1)/2}uncenter(){return this.x=s.uncenter(this.x),this}static map(t,e,r){let o=(r-e)*t;return e+o}map(t,e){return this.x=s.map(this.x,t,e),this}static remap(t,e,r,i=0,o=1,n=!1){let a=(t-e)/(r-e)*(o-i)+i;return n?s.clamp(a,i,o):a}remap(t,e,r=0,i=1,o=!1){return this.x=s.remap(this.x,t,e,r,i,o),this}static magnify(t){return 4*Math.pow(t-.5,3)+.5}magnify(){return this.x=s.magnify(this.x),this}static floor(t){return Math.floor(t)}floor(){return this.x=s.floor(this.x),this}static ceil(t){return Math.ceil(t)}ceil(){return this.x=s.ceil(this.x),this}static round(t){return Math.round(t)}round(){return this.x=s.round(this.x),this}static smooth(t,e,r){return r<=1?e:t+(e-t)/r}smooth(t,e){return this.x=s.smooth(this.x,t,e),this}};var w=class s{x;y;constructor(t,e){this.x=t,this.y=e}static new(t,e){return new this(t,e)}static zero(){return new this(0,0)}static all(t){return new this(t,t)}static from(t){return Array.isArray(t)?new this(...t):new this(t.x,t.y)}static magnitudeSquared(t,e){return t*t+e*e}static magnitude(t,e){return Math.sqrt(this.magnitudeSquared(t,e))}static average(...t){return this.zero().add(...t).divideBy(t.length)}static min(...t){return new this(Math.min(...t.map(e=>e.x)),Math.min(...t.map(e=>e.y)))}static max(...t){return new this(Math.max(...t.map(e=>e.x)),Math.max(...t.map(e=>e.y)))}static fromAngle(t){return new this(Math.cos(t),Math.sin(t))}clone(){return new s(this.x,this.y)}*[Symbol.iterator](){yield this.x,yield this.y}toJSON(){return[this.x,this.y]}toString(){return`(Vec2 x${this.x.toFixed(2)}, y${this.y.toFixed(2)})`}set_(t,e){return this.x=t,this.y=e,this}set({x:t,y:e}){return this.x=t,this.y=e,this}magnitudeSquared(){return s.magnitudeSquared(this.x,this.y)}magnitude(){return s.magnitude(this.x,this.y)}rotation(){return Math.atan2(this.y,this.x)}equals_(t,e){return this.x===t&&this.y===e}equals(...t){return t.every(({x:e,y:r})=>this.equals_(e,r))}near_(t,e,r=1e-6){return Math.abs(this.x-t)<=r&&Math.abs(this.y-e)<=r}near({x:t,y:e},r=1e-6){return this.near_(t,e,r)}dot_(t,e){return this.x*t+this.y*e}dot({x:t,y:e}){return this.dot_(t,e)}distanceSquared_(t,e){return t=this.x-t,e=this.y-e,t*t+e*e}distanceSquared({x:t,y:e}){return this.distanceSquared_(t,e)}distance_(t,e){return Math.sqrt(this.distanceSquared_(t,e))}distance({x:t,y:e}){return this.distance_(t,e)}angleBetween_(t,e){let r=this.dot_(t,e),i=this.magnitude()*s.magnitude(t,e);if(i===0)return 0;let o=y.clamp(r/i,-1,1);return Math.acos(o)}angleBetween({x:t,y:e}){return this.angleBetween_(t,e)}normalize(){return this.divideBy(this.magnitude())}half(){return this.divideBy(2)}double(){return this.multiplyBy(2)}abs(){return this.map(t=>Math.abs(t))}rotate(t){let{x:e,y:r}=this;return this.x=e*Math.cos(t)-r*Math.sin(t),this.y=e*Math.sin(t)+r*Math.cos(t),this}perpendicular(){let{x:t,y:e}=this;return this.x=-e,this.y=t,this}clampMagnitude(t){return this.magnitude()>t&&this.normalize().multiplyBy(t),this}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}map(t){return this.x=t(this.x,0),this.y=t(this.y,1),this}morph(t){let e=t(this);return e&&e!==this&&this.set(e),this}clamp(t={x:0,y:0},e={x:1,y:1}){return this.x=y.clamp(this.x,t.x,e.x),this.y=y.clamp(this.y,t.y,e.y),this}clampBy(t=0,e=1){return this.x=y.clamp(this.x,t,e),this.y=y.clamp(this.y,t,e),this}negate(){return this.map(t=>t*-1)}addBy(t){return this.x+=t,this.y+=t,this}subtractBy(t){return this.x-=t,this.y-=t,this}multiplyBy(t){return this.x*=t,this.y*=t,this}divideBy(t){return t===0?this:(this.x/=t,this.y/=t,this)}add_(t,e){return this.x+=t,this.y+=e,this}add(...t){for(let{x:e,y:r}of t)this.add_(e,r);return this}subtract_(t,e){return this.x-=t,this.y-=e,this}subtract(...t){for(let{x:e,y:r}of t)this.subtract_(e,r);return this}multiply_(t,e){return this.x*=t,this.y*=e,this}multiply(...t){for(let{x:e,y:r}of t)this.multiply_(e,r);return this}divide_(t,e){return t!==0&&(this.x/=t),e!==0&&(this.y/=e),this}divide(...t){for(let{x:e,y:r}of t)this.divide_(e,r);return this}lerp_(t,e,r){return this.x+=(t-this.x)*r,this.y+=(e-this.y)*r,this}lerp({x:t,y:e},r){return this.lerp_(t,e,r)}approach_(t,e,r,i,o){return this.x=y.approach(this.x,t,r,i,o),this.y=y.approach(this.y,e,r,i,o),this}approach({x:t,y:e},r,i,o){return this.approach_(t,e,r,i,o)}reflect_(t,e){let r=2*this.dot_(t,e);return this.x-=r*t,this.y-=r*e,this}reflect({x:t,y:e}){return this.reflect_(t,e)}rotateAroundPoint_(t,e,r){let i=this.x-t,o=this.y-e,n=Math.cos(r),c=Math.sin(r);return this.x=n*i-c*o+t,this.y=c*i+n*o+e,this}rotateAroundPoint({x:t,y:e},r){return this.rotateAroundPoint_(t,e,r)}smooth_(t,e,r){return this.x=y.smooth(this.x,t,r),this.y=y.smooth(this.y,e,r),this}smooth({x:t,y:e},r){return this.smooth_(t,e,r)}};var Fe=class{state;players;constructor(t,e){this.state=t,this.players=e}tick(){for(let t of this.players){let{agent:e,port:{actions:r}}=t,i=1;e.position.y+=i*r.gameplay.up.value,e.position.y-=i*r.gameplay.down.value,e.position.x-=i*r.gameplay.left.value,e.position.x+=i*r.gameplay.right.value,e.position.clamp(w.zero(),this.state.arenaSize)}}};var Ge=class{label="0";alive=!0;color="#444";position=w.zero()};var Ke=class{arenaSize=new w(200,100);agents=new Set;makeAgent(t){let e=new Ge;return e.label=t,e.position.set_(.5,.5).multiply(this.arenaSize),this.agents.add(e),e}deleteAgent(t){return this.agents.delete(t),this}};var jt=class{};function Dt(s,{start:t,end:e}){return!(t&&s<t||e&&s>e)}var Je=class extends jt{#t=new Map;async gets(...t){return t.map(e=>this.#t.get(e))}async hasKeys(...t){return t.map(e=>this.#t.has(e))}async*keys(t={}){if(t.limit===0)return;let e=0;for(let r of this.#t.keys())if(Dt(r,t)&&(yield r,e+=1),e>=(t.limit??1/0))break}async*entries(t={}){if(t.limit===0)return;let e=0;for(let[r,i]of this.#t.entries())if(Dt(r,t)&&(yield[r,i],e+=1),e>=(t.limit??1/0))break}async transaction(...t){for(let[e,r]of t)r===void 0?this.#t.delete(e):this.#t.set(e,r)}};function Es(s,t,e){let r=Object.entries(t);for(let[i,o]of r)s.addEventListener(i,o,e);return function(){for(let[o,n]of r)s.removeEventListener(o,n)}}var zt=class extends jt{storage;static onStorageEvent=t=>Es(window,{storage:t});constructor(t=window.localStorage){super(),this.storage=t}async gets(...t){return t.map(e=>this.storage.getItem(e)??void 0)}async hasKeys(...t){return t.map(e=>this.storage.getItem(e)!==null)}async*keys(t={}){if(t.limit===0)return;let e=0;for(let r of Object.keys(this.storage))if(Dt(r,t)&&(yield r,e+=1),e>=(t.limit??1/0))break}async*entries(t={}){if(t.limit===0)return;let e=0;for(let[r,i]of Object.entries(this.storage))if(Dt(r,t)&&(yield[r,i],e+=1),e>=(t.limit??1/0))break}async transaction(...t){for(let[e,r]of t)r===void 0?this.storage.removeItem(e):this.storage.setItem(e,r)}};async function Ms(s){let t=[];for await(let e of s)t.push(e);return t}var Ye=class{kv;key;write;constructor(t,e){this.kv=t,this.key=e,this.write=new Nr(t.write,e)}async set(t){return this.kv.set(this.key,t)}async get(){return this.kv.get(this.key)}async require(){return this.kv.require(this.key)}async guarantee(t){let e=await this.get();return e===void 0&&(e=await t(),await this.set(e)),e}},Nr=class{key;#t;constructor(t,e){this.key=e,this.#t=t}set(t){return this.#t.set(this.key,t)}};var oe={parse:s=>JSON.parse(s),stringify:s=>JSON.stringify(s)};var Xe=class{#t;constructor(t){this.#t=t}sets(...t){return t.map(([e,r])=>{let i=this.#t.prefix(e),o=r===void 0?void 0:oe.stringify(r);return[i,o]})}set(t,e){return this.sets([t,e])}del(...t){return t.map(e=>[this.#t.prefix(e),void 0])}};function*Ps(s,t){if(s<=0)throw new Error("chunk size must be greater than zero");for(let e=0;e<t.length;e+=s)yield t.slice(e,e+s)}var Ze=class{#t;constructor(t){let{scopes:e,divisor:r,delimiter:i}=t;this.#t=e.length>0?e.join(r)+i:""}prefix=t=>this.#t+t;unprefix=t=>{let e=this.#t.length;return t.slice(e)};scan=t=>{let{limit:e}=t,r=this.#t+(t.start??""),i=this.#t+(t.end??"\xFF");return{limit:e,start:r,end:i}}};var Qe=class s{driver;static collect=Ms;write;#t;#e;constructor(t=new Je,e={}){this.driver=t,this.#t={scopes:[],divisor:".",delimiter:":",chunkSize:1e4,...e},this.#e=new Ze(this.#t),this.write=new Xe(this.#e)}async gets(...t){return(await this.driver.gets(...t.map(this.#e.prefix))).map(r=>r===void 0?r:oe.parse(r))}async get(t){let[e]=await this.gets(t);return e}async requires(...t){let e=await this.gets(...t);for(let r of e)if(r===void 0)throw new Error("required key not found");return e}async require(t){let[e]=await this.requires(t);return e}async hasKeys(...t){return this.driver.hasKeys(...t.map(this.#e.prefix))}async has(t){let[e]=await this.hasKeys(t);return e}async*keys(t={}){for await(let e of this.driver.keys(this.#e.scan(t)))yield this.#e.unprefix(e)}async clear(t={}){let e=[];for await(let r of this.keys(t))e.push(r);for(let r of Ps(this.#t.chunkSize,e))await this.del(...r)}async*entries(t={}){for await(let[e,r]of this.driver.entries(this.#e.scan(t)))yield[this.#e.unprefix(e),oe.parse(r)]}async*values(t){for await(let[,e]of this.entries(t))yield e}async transaction(t){let e=t(this.write).flat();return this.driver.transaction(...e)}async set(t,e){return this.transaction(r=>[r.set(t,e)])}async sets(...t){return this.transaction(e=>[e.sets(...t)])}async del(...t){return this.transaction(e=>[e.del(...t)])}async guarantee(t,e){let r=await this.get(t);return r===void 0&&(r=await e(),await this.transaction(i=>[i.set(t,r)])),r}async versionMigration(t,e,r){let i=this,o=await i.get(t)??0;typeof o!="number"&&(o=0),o!==e&&(await r(o),await i.set(t,e))}store(t){return new Ye(this,t)}scope(t,e=this.#t.delimiter){return new s(this.driver,{...this.#t,delimiter:e,scopes:[...this.#t.scopes,t]})}flatten(){return new s(this.driver,{...this.#t,delimiter:""})}};var ne=class s{profiles=new N;portProfiles=[];metaBindings=null;constructor(t){if(t){for(let e of t.profiles)this.profiles.set(e.id,e);this.portProfiles=t.portProfiles.map(e=>e&&(this.profiles.has(e)?e:null)),this.metaBindings=t.metaBindings}}toJSON(){return C.clone({profiles:[...this.profiles.values()],portProfiles:this.portProfiles,metaBindings:this.metaBindings})}clone(){return new s(this.toJSON())}getProfile(t){return this.profiles.get(t)}getProfileForPort(t){let e=this.portProfiles.at(t);return e?this.getProfile(e):void 0}};var tr=class{store;$catalog;static async load(t){let e=g(new ne(await t.get()));return new this(t,e)}dispose=O();constructor(t,e){this.store=t,this.$catalog=e,this.dispose.schedule(zt.onStorageEvent(async()=>this.reload()))}async reload(){let t=new ne(await this.store.get());await this.$catalog.set(t)}async save(t){await this.store.set(t.toJSON()),await this.$catalog(t)}async#t(t){let e=this.$catalog().clone(),r=t(e);return await this.store.set(e.toJSON()),await this.$catalog(e),r}async createProfile(t,e){return this.#t(r=>{let i=wt.random(),o={id:i,label:t,bindings:e};return r.profiles.set(i,o),o})}async deleteProfile(t){return this.#t(e=>{e.profiles.delete(t)})}async assignPortProfile(t,e){return this.#t(r=>{r.portProfiles[t]=e})}};function j(s){return s>0}var er=class{on=B();onDown=B();#t=0;#e=0;get value(){return this.#t}set value(t){this.#e=this.#t,this.#t=t,this.on.publish(this),this.down&&this.onDown.publish(this)}get previous(){return this.#e}get changed(){return this.#t!==this.#e}get pressed(){return j(this.#t)}get down(){return!j(this.#e)&&j(this.#t)}get up(){return j(this.#e)&&!j(this.#t)}};var H=class extends N{constructor(t){if(super(),t)for(let[e,r]of t)this.set(e,r)}zero(){for(let t of this.keys())this.set(t,0);return this}mergeSample([t,e]){let r=this.get(t)??0;return e>r&&this.set(t,e),this}};function Cs([,,s],t){return{lastValue:0,holdStart:t,settings:Pi(s)}}function Mi(){return{scale:1,invert:!1,clamp:null,range:null,bottom:null,top:null,timing:["direct"]}}function Pi(s={}){return{...Mi(),...s}}var Bs=(s,t,e)=>jr(e).line(function(i){let{settings:o}=t;if(o.clamp){let[n,c]=o.clamp;i=y.clamp(i,n,c)}if(o.range){let[n,c]=o.range;i=y.isBetween(i,n,c)?y.remap(i,n,c,0,1,!0):0}return o.bottom&&(i=i<o.bottom?0:i),o.top&&(i=Math.min(o.top,i)),i},function(i){return t.settings.invert?1-i:i},function(i){return t.settings.scale*i},function(i){let{settings:o}=t,n=(o.timing[0]==="direct"?void 0:o.timing[1])??250,c=!j(t.lastValue)&&j(i),a=j(t.lastValue)&&!j(i),h=s-t.holdStart>=n;switch(c&&(t.holdStart=s),t.lastValue=i,o.timing[0]){case"direct":return i;case"tap":return a&&!h?1:0;case"hold":return j(i)&&h?i:0;default:throw new Error("unknown bindings timing")}});function Os(s){return s.length>0?Math.max(...s):0}function Rs(s){return s.length>0?Math.min(...s):0}var rr=class{bindings;actions;#t=new Set;#e=new H;#r=0;#s=new G;#i=ee();constructor(t){this.bindings=t,this.actions=te(t,(e,r)=>te(e,i=>{let o=new er;return this.#i.subscribe(()=>{o.value=this.#t.has(r)?this.#n([])(i,r):0}),o}))}resolve(t,e,r){return this.#r=t,this.#t=e,this.#e=r,this.#i(),this.actions}#o(t,e,r){let i=this.#s.guarantee(t.join("/"),()=>Cs(["code",e,r],this.#r)),o=this.#e.get(e)??0;return Bs(this.#r,i,o)}#n=t=>(e,r)=>{let i=[...t,String(r),typeof e=="string"?e:e[0]],o=this.#n(i);if(typeof e=="string")return this.#o(i,e);switch(e[0]){case"code":{let[,n,c]=e;return this.#o(i,n,c)}case"and":{let[,...n]=e,c=n.map(o);return Rs(c)}case"or":{let[,...n]=e,c=n.map(o);return Os(c)}case"not":{let[,n]=e;return o(n,"subject")>0?0:1}case"cond":{let[,n,c]=e;return o(c,"guard")>0?o(n,"subject"):0}case"mods":{let[,n,c]=e,a=(p,...l)=>p?["or",...l]:["not",["or",...l]];return o(["cond",n,["and",a(c.ctrl??!1,"ControlLeft","ControlRight"),a(c.alt??!1,"AltLeft","AltRight"),a(c.meta??!1,"MetaLeft","MetaRight"),a(c.shift??!1,"ShiftLeft","ShiftRight")]],"guard")>0?o(n,"subject"):0}}}};var Q=class{*[Symbol.iterator](){for(let t of this.samples())yield t}};var Tt=class extends Q{devices=new $e;#t=new H;constructor(...t){super(),this.devices.adds(...t)}*samples(){this.#t.zero();for(let t of this.devices)for(let e of t.samples())this.#t.mergeSample(e);yield*this.#t.entries()}};var tt=class extends rr{#t=new Tt;devices=this.#t.devices;modes=new $e;constructor(t){super(t),this.modes.adds(...Object.keys(t))}resolve(t=Date.now()){let e=new H(this.#t.samples());return super.resolve(t,this.modes,e)}};var dt="meta";var Nt=()=>({[dt]:{revealOverlay:["or","Backslash","gamepad.beta","gamepad.gamma"],shimmyNext:["or","BracketRight",["and",["or","gamepad.beta","gamepad.gamma"],"gamepad.right"],["and",["or","gamepad.beta","gamepad.gamma"],"gamepad.bumper.right"]],shimmyPrevious:["or","BracketLeft",["and",["or","gamepad.beta","gamepad.gamma"],"gamepad.left"],["and",["or","gamepad.beta","gamepad.gamma"],"gamepad.bumper.left"]]}});var sr=class{device;metaPort;constructor(t,e=Nt()){this.device=t,this.metaPort=new tt(e),this.metaPort.devices.add(t)}};var ir=class{ports;metaBindings;on=B();#t=new N;metaPort;constructor(t,e=Nt()){this.ports=t,this.metaBindings=e,this.metaPort=new tt(e)}poll(t=Date.now()){return this.#r(t),this.#s(t),this.#i(t)}portByIndex(t){let e=this.ports.at(t);if(!e)throw new Error(`port ${t} not found`);return e}portByDevice(t){for(let e of this.ports)if(e.devices.has(t))return e}shimmy(t,e){let r=this.ports.findIndex(c=>c.devices.has(t)),i=Math.max(0,this.ports.length-1),o=y.clamp(r+e,0,i),n=this.portByIndex(o);return this.reassign(t,n),n}reassign(t,e=this.getLonelyPort()){this.ports.forEach(r=>r.devices.delete(t)),e.devices.add(t),this.#e()}unplug(t){this.ports.forEach(e=>e.devices.delete(t)),this.#t.delete(t),this.#e()}plug=(t,e=this.getLonelyPort())=>(this.unplug(t),this.#t.set(t,new sr(t,this.metaBindings)),e.devices.add(t),this.#e(),()=>this.unplug(t));getLonelyPort(){let t=this.ports.at(0);for(let e of this.ports)e.devices.size<t.devices.size&&(t=e);return t}#e=T(0,()=>this.on.publish());#r(t){this.metaPort.devices.clear(),this.metaPort.devices.adds(...this.#t.keys()),this.metaPort.resolve(t)}#s(t){for(let e of this.#t.values()){let r=e.metaPort.resolve(t);r[dt].shimmyNext.down&&this.shimmy(e.device,1),r[dt].shimmyPrevious.down&&this.shimmy(e.device,-1)}}#i(t){return this.ports.map(e=>(e.resolve(t),e))}};function js(s,t){let e=C.clone(s);if(!t)return e;for(let[r,i]of Object.entries(e))for(let o of Object.keys(i)){let n=t[r]?.[o];n&&(i[o]=n)}return e}function ae(s){return s>=0?[s,0]:[0,Math.abs(s)]}function ce(s){let[t,e]=ae(s.x),[r,i]=ae(s.y);return{up:i,down:r,left:e,right:t}}var K=class extends Q{channel;$vector=g(w.zero());$breakdown=Tr(()=>ce(this.$vector.get()));constructor(t="stick"){super(),this.channel=t}samples(){let{channel:t}=this,{up:e,down:r,left:i,right:o}=this.$breakdown.get();return[[`${t}.up`,e],[`${t}.down`,r],[`${t}.left`,i],[`${t}.right`,o]]}};var U=class extends Q{on=B();sampleMap=new H;setSample(t,e){return this.sampleMap.set(t,e),this.on.pub(t,e),this}*samples(){for(let t of this.sampleMap)yield t}};var Lt=class extends U{stickLeft=new K;stickRight=new K;samples(){let t=this.stickLeft.$breakdown();this.setSample("gamepad.stick.left.up",t.up),this.setSample("gamepad.stick.left.down",t.down),this.setSample("gamepad.stick.left.left",t.left),this.setSample("gamepad.stick.left.right",t.right);let e=this.stickRight.$breakdown();return this.setSample("gamepad.stick.right.up",e.up),this.setSample("gamepad.stick.right.down",e.down),this.setSample("gamepad.stick.right.left",e.left),this.setSample("gamepad.stick.right.right",e.right),super.samples()}};var or=class s extends U{client=new w(0,0);movement=new w(0,0);dispose=O();constructor(t=window){super(),this.dispose.schedule(ht(t,{pointerdown:e=>{let r=s.buttonCode(e);this.setSample(r,1)},pointerup:e=>{let r=s.buttonCode(e);this.setSample(r,0)},pointermove:e=>{this.client.x=e.clientX,this.client.y=e.clientY,this.movement.x+=e.movementX,this.movement.y+=e.movementY},wheel:e=>{this.sampleMap.set("pointer.wheel.right",0),this.sampleMap.set("pointer.wheel.left",0),this.sampleMap.set("pointer.wheel.up",0),this.sampleMap.set("pointer.wheel.down",0);for(let[r,i]of s.wheelCodes(e))this.setSample(r,i)}}))}static buttonCode(t){switch(t.button){case 0:return"pointer.button.left";case 1:return"pointer.button.middle";case 2:return"pointer.button.right";default:return`pointer.button.${t.button+1}`}}static wheelCodes(t){let e=[];return t.deltaX&&e.push([t.deltaX>0?"pointer.wheel.right":"pointer.wheel.left",t.deltaX]),t.deltaY&&e.push([t.deltaY>0?"pointer.wheel.down":"pointer.wheel.up",t.deltaY]),e}samples(){return this.#t(),super.samples()}#t(){let[t,e]=this.movement,[r,i]=ae(t),[o,n]=ae(e);t&&(t>=0?this.setSample("pointer.move.right",Math.abs(i)):this.setSample("pointer.move.left",Math.abs(r))),e&&(e>=0?this.setSample("pointer.move.up",Math.abs(n)):this.setSample("pointer.move.down",Math.abs(o))),this.movement.set_(0,0)}};var nr=class extends U{dispose=O();constructor(t=window){super(),this.dispose.schedule(ht(t,this.#t)),this.dispose.schedule(ht(window,this.#e))}#t={keydown:t=>{if(t.repeat)return null;this.setSample(t.code,1)},keyup:t=>{if(t.repeat)return null;this.setSample(t.code,0)}};#e={blur:()=>{this.sampleMap.zero()}}};var et=class extends Tt{keyboard=new nr;pointer=new or;vpad=new Lt;constructor(){super(),this.devices.add(this.keyboard).add(this.pointer).add(this.vpad)}};function he(s,t){let e=w.from(s),r=e.distance_(0,0),i=y.remap(r,t.x,t.y,0,1,!0);return e.normalize().multiplyBy(i)}var Ci=["gamepad.a","gamepad.b","gamepad.x","gamepad.y","gamepad.bumper.left","gamepad.bumper.right","gamepad.trigger.left","gamepad.trigger.right","gamepad.alpha","gamepad.beta","gamepad.stick.left.click","gamepad.stick.right.click","gamepad.up","gamepad.down","gamepad.left","gamepad.right","gamepad.gamma"],qt=class extends U{pad;range=new w(.2,.9);constructor(t){super(),this.pad=t}get gamepad(){return this.pad.gamepad}samples(){return this.#t(this.pad.gamepad),this.#e(this.pad.gamepad),super.samples()}#t(t){let e=0,r=i=>{e=Math.max(e,i)};for(let[i,o]of Ci.entries()){let n=t.buttons.at(i)?.value??0;r(n),this.setSample(o,n)}this.setSample("gamepad.any",e)}#e(t){let[e=0,r=0,i=0,o=0]=t.axes,n=ce(he(new w(e,r),this.range)),c=ce(he(new w(i,o),this.range));this.setSample("gamepad.stick.left.up",n.up),this.setSample("gamepad.stick.left.down",n.down),this.setSample("gamepad.stick.left.left",n.left),this.setSample("gamepad.stick.left.right",n.right),this.setSample("gamepad.stick.right.up",c.up),this.setSample("gamepad.stick.right.down",c.down),this.setSample("gamepad.stick.right.left",c.left),this.setSample("gamepad.stick.right.right",c.right)}};var ar=class{fallback="\u2754";#t=new Map;constructor(t=[[et,"\u{1F4BB}"],[qt,"\u{1F3AE}"],[Lt,"\u{1F4F1}"]]){this.add(...t)}get(t){return this.#t.get(t)??this.fallback}add(...t){for(let[e,r]of t)this.#t.set(e,r);return this}clear(){return this.#t.clear(),this}};var Bi=s=>Se(s).map(t=>`hsl(${(t*(360/s)+180)%360}deg, 100%, 50%)`),cr=class extends ke{constructor(){super(()=>Bi(12))}};var Lr=class{icon;label;color;constructor(t,e,r){this.icon=t,this.label=e,this.color=r}},It=class{icons=new ar;#t=new os;#e=new cr;get(t){return this.#t.guarantee(t,()=>new Lr(this.icons.get(t.constructor),wt.random(4),this.#e.takeFirst()))}};var hr=class{hub;deviceSkins;auto=!0;dispose=O();#t=Date.now();#e=g(!1);$manual=g(!1);$visible=g.derived(()=>this.$manual()||this.auto&&this.#e());$showLabels=g(!1);constructor(t,e=new It){this.hub=t,this.deviceSkins=e,this.dispose.schedule(t.on(async()=>{Date.now()-this.#t>100&&await this.bump()}))}#r=T(1500,()=>this.#e(!1));async bump(){await this.#e(!0),await this.#r()}async toggle(t=!this.$manual()){return this.$manual.set(t)}};var Ds=E`
31
31
 
32
32
  :host {
33
33
  --gap: 0.3em;
@@ -133,71 +133,71 @@ var ie=globalThis,oe=ie.ShadowRoot&&(ie.ShadyCSS===void 0||ie.ShadyCSS.nativeSha
133
133
  }
134
134
  }
135
135
 
136
- `;var Bt=class extends B{#t;get deck(){if(!this.#t)throw new Error(".deck was not set on component, but is required");return this.#t}set deck(t){this.#t=t}};var rr=class extends $(t=>e=>{t.css(C,xs),t.attrs.strings.deck="overlay";let{hub:s,deviceSkins:i,overlayVisibility:{$visible:o,$showLabels:n}}=e;function c(a){let l=i.get(a),p=`--color: ${l.color};`,h=()=>s.shimmy(a,1);return v`
136
+ `;var Ht=class extends R{#t;get deck(){if(!this.#t)throw new Error(".deck was not set on component, but is required");return this.#t}set deck(t){this.#t=t}};var lr=class extends k(t=>e=>{t.css(P,Ds),t.attrs.strings.deck="overlay";let{hub:r,deviceSkins:i,overlayVisibility:{$visible:o,$showLabels:n}}=e;function c(a){let h=i.get(a),p=`--color: ${h.color};`,l=()=>r.shimmy(a,1);return $`
137
137
  <div class=device style="${p}">
138
138
  <div class="primary row">
139
- <button @click="${()=>s.shimmy(a,-1)}">&lt;</button>
140
- <div class=icon>${l.icon}</div>
141
- <button @click="${h}">&gt;</button>
139
+ <button @click="${()=>r.shimmy(a,-1)}">&lt;</button>
140
+ <div class=icon>${h.icon}</div>
141
+ <button @click="${l}">&gt;</button>
142
142
  </div>
143
143
 
144
- ${n()?v`
144
+ ${n()?$`
145
145
  <div class="secondary row">
146
- <div class=label>${l.label}</div>
146
+ <div class=label>${h.label}</div>
147
147
  </div>
148
148
  `:null}
149
149
  </div>
150
- `}return v`
150
+ `}return $`
151
151
  <div class=portlist ?data-active="${o()}">
152
- ${s.ports.map((a,l)=>v`
152
+ ${r.ports.map((a,h)=>$`
153
153
  <div class=port>
154
- <header>P${l+1}</header>
154
+ <header>P${h+1}</header>
155
155
  ${a.devices.array().map(c)}
156
156
  </div>
157
157
  `)}
158
158
  </div>
159
- `}).component(Bt).props(t=>[t.deck]){};var bs=_`
159
+ `}).component(Ht).props(t=>[t.deck]){};var zs=E`
160
160
 
161
- `;var Ot=class extends $(t=>e=>{t.css(C,bs),t.attrs.strings.deck="bindings";let{db:s,hub:i}=e,o=s.$catalog(),n={id:"default",label:"default",bindings:e.baseBindings},c=[n,...o.profiles.values()],a=t.signal("default"),l=s.$catalog().getProfile(a())??n;function p(A,D){let Rt=o.getProfileForPort(D)??n;return v`
161
+ `;var Ut=class extends k(t=>e=>{t.css(P,zs),t.attrs.strings.deck="bindings";let{db:r,hub:i}=e,o=r.$catalog(),n={id:"default",label:"default",bindings:e.baseBindings},c=[n,...o.profiles.values()],a=t.signal("default"),h=r.$catalog().getProfile(a())??n;function p(A,z){let Vt=o.getProfileForPort(z)??n;return $`
162
162
  <div class=port>
163
- <span>port ${D+1}</span>
163
+ <span>port ${z+1}</span>
164
164
  <select>
165
- ${c.map(lr=>v`
165
+ ${c.map(yr=>$`
166
166
  <option
167
- data-id="${lr.id}"
168
- ?selected="${lr.id===Rt.id}">
169
- ${lr.label}
167
+ data-id="${yr.id}"
168
+ ?selected="${yr.id===Vt.id}">
169
+ ${yr.label}
170
170
  </option>
171
171
  `)}
172
172
  </select>
173
173
  </div>
174
- `}function h([A,D]){return v`
174
+ `}function l([A,z]){return $`
175
175
  <div class=bracket>
176
176
  <strong class=mode>${A}</strong>
177
- <div>${Object.entries(D).map(u)}</div>
177
+ <div>${Object.entries(z).map(u)}</div>
178
178
  </div>
179
- `}function u([A,D]){return v`
179
+ `}function u([A,z]){return $`
180
180
  <div class=bind>
181
181
  <span class=action>${A}</span>
182
182
  </div>
183
- `}let m=async()=>{let{bindings:A}=l,D=rt.random(4),Rt=await s.createProfile(D,A);a(Rt.id)},w=A=>async()=>{await s.deleteProfile(A)},R=A=>{let Rt=A.target.value;a(Rt)};return v`
183
+ `}let f=async()=>{let{bindings:A}=h,z=is.random(4),Vt=await r.createProfile(z,A);a(Vt.id)},v=A=>async()=>{await r.deleteProfile(A)},D=A=>{let Vt=A.target.value;a(Vt)};return $`
184
184
  <div class=portlist>
185
185
  ${i.ports.map(p)}
186
186
  </div>
187
187
 
188
188
  <div class=bindable>
189
- <select @input="${R}">
190
- ${c.map(A=>v`
191
- <option value="${A.id}" ?selected="${A.id===l.id}">${A.label}</option>
189
+ <select @input="${D}">
190
+ ${c.map(A=>$`
191
+ <option value="${A.id}" ?selected="${A.id===h.id}">${A.label}</option>
192
192
  `)}
193
193
  </select>
194
- <button @click="${m}">clone</button>
195
- <button ?disabled="${l.id===n.id}" @click="${w(l.id)}">delete</button>
194
+ <button @click="${f}">clone</button>
195
+ <button ?disabled="${h.id===n.id}" @click="${v(h.id)}">delete</button>
196
196
  <div class=bindings>
197
- ${Object.entries(l.bindings).map(h)}
197
+ ${Object.entries(h.bindings).map(l)}
198
198
  </div>
199
199
  </div>
200
- `}).component(Bt).props(t=>[t.deck]){};var ui={DeckOverlay:rr,DeckBindings:Ot},ws=r=>Ut(ui).map(t=>class extends t{deck=r});var sr=class{baseBindings;baseMetaBindings;hub;db;static async load(t){let e=await We.load(t.kv.store("catalog")),s=ye(t.portCount).map(o=>e.$catalog().getProfileForPort(o)).map(o=>ys(t.bindings,o?.bindings)).map(o=>new G(o)),i=new Xe(s,e.$catalog().metaBindings??t.metaBindings??Et());return new this(t.bindings,t.metaBindings,i,e)}dispose=P();deviceSkins=new Pt;primaryDevice=new Y;overlayVisibility;components=ws(this);views=Ut(this.components).map(t=>(...e)=>t.view(this,...e));registerComponents(){f.register(this.components)}constructor(t,e,s,i){this.baseBindings=t,this.baseMetaBindings=e,this.hub=s,this.db=i,this.overlayVisibility=new er(s,this.deviceSkins),this.dispose.schedule(s.metaPort.actions[ot].revealOverlay.on(o=>{o.pressed&&this.overlayVisibility.bump()}))}get catalog(){return this.db.$catalog()}};var Er=class{port;agent;constructor(t,e){this.port=t,this.agent=e}},ir=class{#t=new k;constructor(t,e){for(let[s,i]of t.ports.entries()){let o=(s+1).toString();this.#t.set(i,new Er(i,e.makeAgent(o)))}}[Symbol.iterator](){return this.#t.values()}require(t){return this.#t.require(t)}};var or=class{state;canvas=(()=>{let t=document.createElement("canvas");return t.width=200,t.height=100,t})();ctx=this.canvas.getContext("2d");constructor(t){this.state=t}percent(t){let e=Math.min(this.canvas.width,this.canvas.height);return Math.ceil(e*(t/100))}resolve(t){return t.clone().divide(this.state.arenaSize).morph(e=>{e.y=1-e.y}).multiply_(this.canvas.width,this.canvas.height)}render(){let{state:t}=this;this.#e();let e=[...t.agents].reverse(),s=e.filter(o=>!o.alive),i=e.filter(o=>o.alive);for(let o of s)this.#r(o);for(let o of i)this.#s(o)}#t(){let{ctx:t}=this;return t.imageSmoothingEnabled=!1,t.fillStyle="#000",t.strokeStyle="#000",t.lineWidth=1,t.font="10px sans-serif",t.textAlign="center",t.textBaseline="middle",t}#e(){let{canvas:t}=this,e=this.#t();e.fillStyle="#000",e.fillRect(0,0,t.width,t.height)}#r(t){let e=this.#t(),s=this.percent(10),{position:i}=t,[o,n]=this.resolve(i);e.font=`${s*1.3}px sans-serif`,e.textAlign="center",e.textBaseline="middle",e.fillStyle="#fff4",e.fillText(t.label,o,n)}#s(t){let e=this.#t(),s=this.percent(10),{color:i,position:o}=t,[n,c]=this.resolve(o);e.beginPath(),e.arc(n,c,s,0,Math.PI*2),e.fillStyle=i,e.fill(),e.lineWidth=this.percent(2),e.strokeStyle="#fff",e.stroke(),e.font=`${s*1.3}px sans-serif`,e.textAlign="center",e.textBaseline="middle",e.strokeStyle="#0004",e.strokeText(t.label,n,c),e.fillStyle="#fff",e.fillText(t.label,n,c)}};var X=class extends U{hub;constructor(t){super(),this.hub=t}shimmyNext=()=>this.hub.shimmy(this,1);shimmyPrevious=()=>this.hub.shimmy(this,-1)};var vs={gameplay:{up:["or","KeyW","ArrowUp","stick.up","gamepad.stick.left.up","gamepad.stick.right.up"],down:["or","KeyS","ArrowDown","stick.down","gamepad.stick.left.down","gamepad.stick.right.down"],left:["or","KeyA","ArrowLeft","stick.left","gamepad.stick.left.left","gamepad.stick.right.left"],right:["or","KeyD","ArrowRight","stick.right","gamepad.stick.left.right","gamepad.stick.right.right"]}};function $s(r,t){let e=r;return()=>{let s=t();return s!=null&&(e=s),e}}var Mr=class{get;constructor(t){this.get=t}get gamepad(){return this.get()}};function As(r){let t=new k;return st(window,{gamepadconnected:({gamepad:e})=>{let s=()=>navigator.getGamepads().at(e.index),i=new Mr($s(e,s)),o=r(i);t.set(e.index,{pad:i,dispose:o})},gamepaddisconnected:({gamepad:e})=>{let s=t.get(e.index);s&&(t.delete(e.index),s.dispose())}})}function Ss(r){return As(t=>r(new Ct(t)))}function ks(){let r=new kt(window.localStorage);return new Fe(r).scope("tact")}var nr=class{deck;static async load(){return new this(await sr.load({portCount:4,kv:ks(),bindings:vs}))}logic;dispose=P();state=new He;renderer=new or(this.state);constructor(t){this.deck=t,this.deck.deviceSkins.icons.add([X,"\u{1F518}"]),this.logic=new Ne(this.state,new ir(t.hub,this.state)),this.dispose.schedule(this.deck.hub.on(()=>{for(let e of this.logic.players){e.agent.alive=e.port.devices.size>0;let[s]=e.port.devices;e.agent.color=s?this.deck.deviceSkins.get(s).color:"#444"}})),this.plug(new Y),this.plug(new X(t.hub)),this.dispose.schedule(Ss(t.hub.plug))}plug(t){return this.deck.hub.plug(t),()=>this.unplug(t)}unplug(t){this.deck.hub.unplug(t)}loop(t){return be(async()=>{await ht(1e3/t),this.deck.hub.poll(),this.logic.tick(),this.renderer.render()})}};var _s=(r,t,e)=>{let s=new Map;for(let i=t;i<=e;i++)s.set(r[i],i);return s},Es=Jt(class extends wt{constructor(r){if(super(r),r.type!==Re.CHILD)throw Error("repeat() can only be used in text expressions")}dt(r,t,e){let s;e===void 0?e=t:t!==void 0&&(s=t);let i=[],o=[],n=0;for(let c of r)i[n]=s?s(c,n):n,o[n]=e(c,n),n++;return{values:o,keys:i}}render(r,t,e){return this.dt(r,t,e).values}update(r,[t,e,s]){let i=ns(r),{values:o,keys:n}=this.dt(t,e,s);if(!Array.isArray(i))return this.ut=n,o;let c=this.ut??=[],a=[],l,p,h=0,u=i.length-1,m=0,w=o.length-1;for(;h<=u&&m<=w;)if(i[h]===null)h++;else if(i[u]===null)u--;else if(c[h]===n[m])a[m]=W(i[h],o[m]),h++,m++;else if(c[u]===n[w])a[w]=W(i[u],o[w]),u--,w--;else if(c[h]===n[w])a[w]=W(i[h],o[w]),bt(r,a[w+1],i[h]),h++,w--;else if(c[u]===n[m])a[m]=W(i[u],o[m]),bt(r,i[h],i[u]),u--,m++;else if(l===void 0&&(l=_s(n,m,w),p=_s(c,h,u)),l.has(c[h]))if(l.has(c[u])){let R=p.get(n[m]),A=R!==void 0?i[R]:null;if(A===null){let D=bt(r,i[h]);W(D,o[m]),a[m]=D}else a[m]=W(A,o[m]),bt(r,i[h],A),i[R]=null;m++}else Oe(i[u]),u--;else Oe(i[h]),h++;for(;m<=w;){let R=bt(r,a[w+1]);W(R,o[m]),a[m++]=R}for(;h<=u;){let R=i[h++];R!==null&&Oe(R)}return this.ut=n,os(r,a),V}});var Ms=_`
200
+ `}).component(Ht).props(t=>[t.deck]){};var Oi={DeckOverlay:lr,DeckBindings:Ut},Ts=s=>Qt(Oi).map(t=>class extends t{deck=s});var pr=class{baseBindings;baseMetaBindings;hub;db;static async load(t){let e=await tr.load(t.kv.store("catalog")),r=Se(t.portCount).map(o=>e.$catalog().getProfileForPort(o)).map(o=>js(t.bindings,o?.bindings)).map(o=>new tt(o)),i=new ir(r,e.$catalog().metaBindings??t.metaBindings??Nt());return new this(t.bindings,t.metaBindings,i,e)}dispose=O();deviceSkins=new It;primaryDevice=new et;overlayVisibility;components=Ts(this);views=Qt(this.components).map(t=>(...e)=>t.view(this,...e));registerComponents(){d.register(this.components)}constructor(t,e,r,i){this.baseBindings=t,this.baseMetaBindings=e,this.hub=r,this.db=i,this.overlayVisibility=new hr(r,this.deviceSkins),this.dispose.schedule(r.metaPort.actions[dt].revealOverlay.on(o=>{o.pressed&&this.overlayVisibility.bump()}))}get catalog(){return this.db.$catalog()}};var qr=class{port;agent;constructor(t,e){this.port=t,this.agent=e}},ur=class{#t=new N;constructor(t,e){for(let[r,i]of t.ports.entries()){let o=(r+1).toString();this.#t.set(i,new qr(i,e.makeAgent(o)))}}[Symbol.iterator](){return this.#t.values()}require(t){return this.#t.require(t)}};var mr=class{state;canvas=(()=>{let t=document.createElement("canvas");return t.width=200,t.height=100,t})();ctx=this.canvas.getContext("2d");constructor(t){this.state=t}percent(t){let e=Math.min(this.canvas.width,this.canvas.height);return Math.ceil(e*(t/100))}resolve(t){return t.clone().divide(this.state.arenaSize).morph(e=>{e.y=1-e.y}).multiply_(this.canvas.width,this.canvas.height)}render(){let{state:t}=this;this.#e();let e=[...t.agents].reverse(),r=e.filter(o=>!o.alive),i=e.filter(o=>o.alive);for(let o of r)this.#r(o);for(let o of i)this.#s(o)}#t(){let{ctx:t}=this;return t.imageSmoothingEnabled=!1,t.fillStyle="#000",t.strokeStyle="#000",t.lineWidth=1,t.font="10px sans-serif",t.textAlign="center",t.textBaseline="middle",t}#e(){let{canvas:t}=this,e=this.#t();e.fillStyle="#000",e.fillRect(0,0,t.width,t.height)}#r(t){let e=this.#t(),r=this.percent(10),{position:i}=t,[o,n]=this.resolve(i);e.font=`${r*1.3}px sans-serif`,e.textAlign="center",e.textBaseline="middle",e.fillStyle="#fff4",e.fillText(t.label,o,n)}#s(t){let e=this.#t(),r=this.percent(10),{color:i,position:o}=t,[n,c]=this.resolve(o);e.beginPath(),e.arc(n,c,r,0,Math.PI*2),e.fillStyle=i,e.fill(),e.lineWidth=this.percent(2),e.strokeStyle="#fff",e.stroke(),e.font=`${r*1.3}px sans-serif`,e.textAlign="center",e.textBaseline="middle",e.strokeStyle="#0004",e.strokeText(t.label,n,c),e.fillStyle="#fff",e.fillText(t.label,n,c)}};var rt=class extends K{hub;constructor(t){super(),this.hub=t}shimmyNext=()=>this.hub.shimmy(this,1);shimmyPrevious=()=>this.hub.shimmy(this,-1)};var Ns={gameplay:{up:["or","KeyW","ArrowUp","stick.up","gamepad.stick.left.up","gamepad.stick.right.up"],down:["or","KeyS","ArrowDown","stick.down","gamepad.stick.left.down","gamepad.stick.right.down"],left:["or","KeyA","ArrowLeft","stick.left","gamepad.stick.left.left","gamepad.stick.right.left"],right:["or","KeyD","ArrowRight","stick.right","gamepad.stick.left.right","gamepad.stick.right.right"]}};function Ls(s,t){let e=s;return()=>{let r=t();return r!=null&&(e=r),e}}var Ir=class{get;constructor(t){this.get=t}get gamepad(){return this.get()}};function qs(s){let t=new N;return ht(window,{gamepadconnected:({gamepad:e})=>{let r=()=>navigator.getGamepads().at(e.index),i=new Ir(Ls(e,r)),o=s(i);t.set(e.index,{pad:i,dispose:o})},gamepaddisconnected:({gamepad:e})=>{let r=t.get(e.index);r&&(t.delete(e.index),r.dispose())}})}function Is(s){return qs(t=>s(new qt(t)))}function Hs(){let s=new zt(window.localStorage);return new Qe(s).scope("tact")}var dr=class{deck;static async load(){return new this(await pr.load({portCount:4,kv:Hs(),bindings:Ns}))}logic;dispose=O();state=new Ke;renderer=new mr(this.state);constructor(t){this.deck=t,this.deck.deviceSkins.icons.add([rt,"\u{1F518}"]),this.logic=new Fe(this.state,new ur(t.hub,this.state)),this.dispose.schedule(this.deck.hub.on(()=>{for(let e of this.logic.players){e.agent.alive=e.port.devices.size>0;let[r]=e.port.devices;e.agent.color=r?this.deck.deviceSkins.get(r).color:"#444"}})),this.plug(new et),this.plug(new rt(t.hub)),this.dispose.schedule(Is(t.hub.plug))}plug(t){return this.deck.hub.plug(t),()=>this.unplug(t)}unplug(t){this.deck.hub.unplug(t)}loop(t){return as(async()=>{await vt(1e3/t),this.deck.hub.poll(),this.logic.tick(),this.renderer.render()})}};var Us=(s,t,e)=>{let r=new Map;for(let i=t;i<=e;i++)r.set(s[i],i);return r},Vs=se(class extends Bt{constructor(s){if(super(s),s.type!==Le.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,t,e){let r;e===void 0?e=t:t!==void 0&&(r=t);let i=[],o=[],n=0;for(let c of s)i[n]=r?r(c,n):n,o[n]=e(c,n),n++;return{values:o,keys:i}}render(s,t,e){return this.dt(s,t,e).values}update(s,[t,e,r]){let i=Ss(s),{values:o,keys:n}=this.dt(t,e,r);if(!Array.isArray(i))return this.ut=n,o;let c=this.ut??=[],a=[],h,p,l=0,u=i.length-1,f=0,v=o.length-1;for(;l<=u&&f<=v;)if(i[l]===null)l++;else if(i[u]===null)u--;else if(c[l]===n[f])a[f]=Z(i[l],o[f]),l++,f++;else if(c[u]===n[v])a[v]=Z(i[u],o[v]),u--,v--;else if(c[l]===n[v])a[v]=Z(i[l],o[v]),Ct(s,a[v+1],i[l]),l++,v--;else if(c[u]===n[f])a[f]=Z(i[u],o[f]),Ct(s,i[l],i[u]),u--,f++;else if(h===void 0&&(h=Us(n,f,v),p=Us(c,l,u)),h.has(c[l]))if(h.has(c[u])){let D=p.get(n[f]),A=D!==void 0?i[D]:null;if(A===null){let z=Ct(s,i[l]);Z(z,o[f]),a[f]=z}else a[f]=Z(A,o[f]),Ct(s,i[l],A),i[D]=null;f++}else Ne(i[u]),u--;else Ne(i[l]),l++;for(;f<=v;){let D=Ct(s,a[v+1]);Z(D,o[f]),a[f++]=D}for(;l<=u;){let D=i[l++];D!==null&&Ne(D)}return this.ut=n,$s(s,a),F}});var Ws=E`
201
201
 
202
202
  :host {
203
203
  display: flex;
@@ -251,7 +251,7 @@ var ie=globalThis,oe=ie.ShadowRoot&&(ie.ShadyCSS===void 0||ie.ShadyCSS.nativeSha
251
251
  gap: 0.5em;
252
252
  }
253
253
 
254
- `;var Cs=_`
254
+ `;var Fs=E`
255
255
 
256
256
  :host {
257
257
  --color: #aaa;
@@ -290,7 +290,7 @@ button {
290
290
  padding: 0.2em;
291
291
  }
292
292
 
293
- `;var Ps=_`
293
+ `;var Gs=E`
294
294
 
295
295
  :host {
296
296
  --nub-size: 60%;
@@ -356,10 +356,10 @@ button {
356
356
  background: #fff8;
357
357
  }
358
358
 
359
- `;var di=$(r=>({$vector:t})=>{r.name("nub-stick"),r.css(C,Ps);let e=r.once(()=>new b(.2,.8)),s=r.signal(void 0);r.mount(()=>{function a(p){let h=r.element.getBoundingClientRect(),u=t.get();u.x=y.remap(p.clientX,h.left,h.right,-1,1),u.y=y.remap(p.clientY,h.top,h.bottom,-1,1),u.set(se(u,e)),t.publish()}function l(){s.value!==void 0&&(t.get().set_(0,0),t.publish(),ht(0).then(()=>{s.value!==void 0&&(r.element.releasePointerCapture(s.value),s.value=void 0)}))}return Kr(f.events(document.body,{click:[{capture:!0},p=>{s.value!==void 0&&(p.preventDefault(),p.stopPropagation())}]}),f.events(r.element,{pointerdown:p=>{s.value===void 0&&(s.value=p.pointerId,r.element.setPointerCapture(s.value),a(p))},pointermove:[{},p=>{s.value!==void 0&&a(p)}],pointerup:l,pointercancel:l}))});let i=t.get(),o=`width: ${e.x*100}%;`,n=`width: ${e.y*100}%;`,c=a=>{let l=a*.5,p=l*i.x*100,h=l*i.y*100;return`
359
+ `;var Ri=k(s=>({$vector:t})=>{s.name("nub-stick"),s.css(P,Gs);let e=s.once(()=>new w(.2,.8)),r=s.signal(void 0);s.mount(()=>{function a(p){let l=s.element.getBoundingClientRect(),u=t.get();u.x=y.remap(p.clientX,l.left,l.right,-1,1),u.y=y.remap(p.clientY,l.top,l.bottom,-1,1),u.set(he(u,e)),t.publish()}function h(){r.value!==void 0&&(t.get().set_(0,0),t.publish(),vt(0).then(()=>{r.value!==void 0&&(s.element.releasePointerCapture(r.value),r.value=void 0)}))}return ns(d.events(document.body,{click:[{capture:!0},p=>{r.value!==void 0&&(p.preventDefault(),p.stopPropagation())}]}),d.events(s.element,{pointerdown:p=>{r.value===void 0&&(r.value=p.pointerId,s.element.setPointerCapture(r.value),a(p))},pointermove:[{},p=>{r.value!==void 0&&a(p)}],pointerup:h,pointercancel:h}))});let i=t.get(),o=`width: ${e.x*100}%;`,n=`width: ${e.y*100}%;`,c=a=>{let h=a*.5,p=h*i.x*100,l=h*i.y*100;return`
360
360
  transform-origin: center center;
361
- transform: translate(${p}%, ${h}%);
362
- `};return v`
361
+ transform: translate(${p}%, ${l}%);
362
+ `};return $`
363
363
  <div class=frame>
364
364
  <div class=inner style="${o}"></div>
365
365
  </div>
@@ -379,24 +379,24 @@ button {
379
379
  <div class=frame style="${c(1)}">
380
380
  <div class=stick></div>
381
381
  </div>
382
- `}),ar=class extends di.component(class extends B{device=new U}).props(t=>[t.device]){};var Bs=$(r=>(t,e,s)=>{r.styles(C,Cs),r.attrs.strings.device="virtual";let i=()=>t.unplug(e);return v`
382
+ `}),fr=class extends Ri.component(class extends R{device=new K}).props(t=>[t.device]){};var Ks=k(s=>(t,e,r)=>{s.styles(P,Fs),s.attrs.strings.device="virtual";let i=()=>t.unplug(e);return $`
383
383
  <div class=box>
384
- ${ar.view(e)}
384
+ ${fr.view(e)}
385
385
 
386
386
  <button @click="${e.shimmyPrevious}">👈</button>
387
387
  <button @click="${i}">💀</button>
388
388
  <button @click="${e.shimmyNext}">👉</button>
389
389
  </div>
390
- `});var cr=class extends $(t=>e=>{t.css(C,Ms),t.mount(()=>e.loop(60)),t.mount(()=>e.deck.hub.on(t.render));let s=()=>e.plug(new X(e.deck.hub)),i=()=>e.deck.overlayVisibility.bump(),o=e.deck.hub.ports.flatMap(n=>n.devices.array()).filter(n=>n instanceof X).map(n=>({device:n,skin:e.deck.deviceSkins.get(n)})).sort((n,c)=>n.skin.label<c.skin.label?-1:1);return v`
390
+ `});var gr=class extends k(t=>e=>{t.css(P,Ws),t.mount(()=>e.loop(60)),t.mount(()=>e.deck.hub.on(t.render));let r=()=>e.plug(new rt(e.deck.hub)),i=()=>e.deck.overlayVisibility.bump(),o=e.deck.hub.ports.flatMap(n=>n.devices.array()).filter(n=>n instanceof rt).map(n=>({device:n,skin:e.deck.deviceSkins.get(n)})).sort((n,c)=>n.skin.label<c.skin.label?-1:1);return $`
391
391
  <div class=surface>
392
392
  ${e.renderer.canvas}
393
393
  ${e.deck.views.DeckOverlay()}
394
394
  </div>
395
395
 
396
396
  <div class=dlist>
397
- ${Es(o,n=>n.skin.label,({device:n,skin:c})=>Bs.props(e.deck.hub,n,c).attr("style",`--color: ${c.color};`).render())}
397
+ ${Vs(o,n=>n.skin.label,({device:n,skin:c})=>Ks.props(e.deck.hub,n,c).attr("style",`--color: ${c.color};`).render())}
398
398
 
399
- <button @click="${s}">
399
+ <button @click="${r}">
400
400
 
401
401
  </button>
402
402
 
@@ -405,8 +405,8 @@ button {
405
405
  </button>
406
406
  </div>
407
407
 
408
- ${Ot.view(e.deck)}
409
- `}).component(class extends B{game}).props(t=>[t.game]){};var mi=await nr.load();f.register({DemoTheater:class extends cr{game=mi}});console.log("\u{1F3AE} tact");
408
+ ${Ut.view(e.deck)}
409
+ `}).component(class extends R{game}).props(t=>[t.game]){};var ji=await dr.load();d.register({DemoTheater:class extends gr{game=ji}});console.log("\u{1F3AE} tact");
410
410
  /*! Bundled license information:
411
411
 
412
412
  @lit/reactive-element/css-tag.js: