@benev/tact 0.4.0-5 → 0.4.0-7

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.
Files changed (44) hide show
  1. package/README.md +100 -41
  2. package/package.json +1 -1
  3. package/s/index.html.ts +1 -1
  4. package/s/lib/input/evaluate/context.ts +5 -1
  5. package/s/lib/input/evaluate/evaluate.ts +27 -14
  6. package/s/lib/input/test.ts +41 -30
  7. package/s/lib/ui/deck/auto-gamepads.ts +1 -0
  8. package/s/lib/ui/deck/setup/deck.ts +33 -20
  9. package/s/lib/ui/deck/setup/tact.ts +23 -10
  10. package/s/lib/ui/deck/setup/types.ts +1 -0
  11. package/s/lib/ui/deck/setup/utils/broadcast-channel.ts +17 -0
  12. package/s/lib/ui/deck/setup/utils/kv.ts +20 -0
  13. package/s/lib/ui/deck/types.ts +1 -1
  14. package/s/lib/ui/views/customize/view.ts +3 -3
  15. package/x/demo/main.bundle.min.js +58 -58
  16. package/x/demo/main.bundle.min.js.map +4 -4
  17. package/x/gamepad/index.html +1 -1
  18. package/x/index.html +3 -3
  19. package/x/index.html.js +1 -1
  20. package/x/index.html.js.map +1 -1
  21. package/x/lib/input/evaluate/context.d.ts +3 -1
  22. package/x/lib/input/evaluate/context.js.map +1 -1
  23. package/x/lib/input/evaluate/evaluate.js +24 -11
  24. package/x/lib/input/evaluate/evaluate.js.map +1 -1
  25. package/x/lib/input/test.d.ts +3 -2
  26. package/x/lib/input/test.js +39 -22
  27. package/x/lib/input/test.js.map +1 -1
  28. package/x/lib/ui/deck/auto-gamepads.js +1 -0
  29. package/x/lib/ui/deck/auto-gamepads.js.map +1 -1
  30. package/x/lib/ui/deck/setup/deck.js +23 -13
  31. package/x/lib/ui/deck/setup/deck.js.map +1 -1
  32. package/x/lib/ui/deck/setup/tact.d.ts +2 -0
  33. package/x/lib/ui/deck/setup/tact.js +18 -7
  34. package/x/lib/ui/deck/setup/tact.js.map +1 -1
  35. package/x/lib/ui/deck/setup/types.d.ts +1 -0
  36. package/x/lib/ui/deck/setup/utils/broadcast-channel.d.ts +4 -0
  37. package/x/lib/ui/deck/setup/utils/broadcast-channel.js +10 -0
  38. package/x/lib/ui/deck/setup/utils/broadcast-channel.js.map +1 -0
  39. package/x/lib/ui/deck/setup/utils/kv.d.ts +5 -0
  40. package/x/lib/ui/deck/setup/utils/kv.js +12 -0
  41. package/x/lib/ui/deck/setup/utils/kv.js.map +1 -0
  42. package/x/lib/ui/deck/types.d.ts +1 -0
  43. package/x/lib/ui/views/customize/view.js +3 -3
  44. package/x/lib/ui/views/customize/view.js.map +1 -1
@@ -1,6 +1,6 @@
1
- var _s=Object.defineProperty;var Cs=(r,t)=>{for(var e in t)_s(r,e,{get:t[e],enumerable:!0})};function Pr(r){return r.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}function te(r,t={}){let{soft:e=!1,upgrade:o=!0}=t;for(let[s,n]of Object.entries(r)){let i=Pr(s),a=customElements.get(i);e&&a||(customElements.define(i,n),o&&document.querySelectorAll(i).forEach(c=>{c.constructor===HTMLElement&&customElements.upgrade(c)}))}}var ee=globalThis,re=ee.ShadowRoot&&(ee.ShadyCSS===void 0||ee.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,or=Symbol(),zr=new WeakMap,Bt=class{constructor(t,e,o){if(this._$cssResult$=!0,o!==or)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(re&&t===void 0){let o=e!==void 0&&e.length===1;o&&(t=zr.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),o&&zr.set(e,t))}return t}toString(){return this.cssText}},Or=r=>new Bt(typeof r=="string"?r:r+"",void 0,or),b=(r,...t)=>{let e=r.length===1?r[0]:t.reduce((o,s,n)=>o+(i=>{if(i._$cssResult$===!0)return i.cssText;if(typeof i=="number")return i;throw Error("Value passed to 'css' function must be a 'css' function result: "+i+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+r[n+1],r[0]);return new Bt(e,r,or)},oe=(r,t)=>{if(re)r.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let o=document.createElement("style"),s=ee.litNonce;s!==void 0&&o.setAttribute("nonce",s),o.textContent=e.cssText,r.appendChild(o)}},pt=re?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(let o of t.cssRules)e+=o.cssText;return Or(e)})(r):r;var{is:Es,defineProperty:Ms,getOwnPropertyDescriptor:Ps,getOwnPropertyNames:zs,getOwnPropertySymbols:Os,getPrototypeOf:Ts}=Object,se=globalThis,Tr=se.trustedTypes,Bs=Tr?Tr.emptyScript:"",js=se.reactiveElementPolyfillSupport,jt=(r,t)=>r,sr={toAttribute(r,t){switch(t){case Boolean:r=r?Bs: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}},jr=(r,t)=>!Es(r,t),Br={attribute:!0,type:String,converter:sr,reflect:!1,useDefault:!1,hasChanged:jr};Symbol.metadata??=Symbol("metadata"),se.litPropertyMetadata??=new WeakMap;var N=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=Br){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 o=Symbol(),s=this.getPropertyDescriptor(t,o,e);s!==void 0&&Ms(this.prototype,t,s)}}static getPropertyDescriptor(t,e,o){let{get:s,set:n}=Ps(this.prototype,t)??{get(){return this[e]},set(i){this[e]=i}};return{get:s,set(i){let a=s?.call(this);n?.call(this,i),this.requestUpdate(t,a,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Br}static _$Ei(){if(this.hasOwnProperty(jt("elementProperties")))return;let t=Ts(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(jt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(jt("properties"))){let e=this.properties,o=[...zs(e),...Os(e)];for(let s of o)this.createProperty(s,e[s])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[o,s]of e)this.elementProperties.set(o,s)}this._$Eh=new Map;for(let[e,o]of this.elementProperties){let s=this._$Eu(e,o);s!==void 0&&this._$Eh.set(s,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let o=new Set(t.flat(1/0).reverse());for(let s of o)e.unshift(pt(s))}else t!==void 0&&e.push(pt(t));return e}static _$Eu(t,e){let o=e.attribute;return o===!1?void 0:typeof o=="string"?o: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 o of e.keys())this.hasOwnProperty(o)&&(t.set(o,this[o]),delete this[o]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return oe(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,o){this._$AK(t,o)}_$ET(t,e){let o=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,o);if(s!==void 0&&o.reflect===!0){let n=(o.converter?.toAttribute!==void 0?o.converter:sr).toAttribute(e,o.type);this._$Em=t,n==null?this.removeAttribute(s):this.setAttribute(s,n),this._$Em=null}}_$AK(t,e){let o=this.constructor,s=o._$Eh.get(t);if(s!==void 0&&this._$Em!==s){let n=o.getPropertyOptions(s),i=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:sr;this._$Em=s;let a=i.fromAttribute(e,n.type);this[s]=a??this._$Ej?.get(s)??a,this._$Em=null}}requestUpdate(t,e,o,s=!1,n){if(t!==void 0){let i=this.constructor;if(s===!1&&(n=this[t]),o??=i.getPropertyOptions(t),!((o.hasChanged??jr)(n,e)||o.useDefault&&o.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,o))))return;this.C(t,e,o)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:o,reflect:s,wrapped:n},i){o&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,i??e??this[t]),n!==!0||i!==void 0)||(this._$AL.has(t)||(this.hasUpdated||o||(e=void 0),this._$AL.set(t,e)),s===!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[s,n]of this._$Ep)this[s]=n;this._$Ep=void 0}let o=this.constructor.elementProperties;if(o.size>0)for(let[s,n]of o){let{wrapped:i}=n,a=this[s];i!==!0||this._$AL.has(s)||a===void 0||this.C(s,void 0,n,a)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(o=>o.hostUpdate?.()),this.update(e)):this._$EM()}catch(o){throw t=!1,this._$EM(),o}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){}};N.elementStyles=[],N.shadowRootOptions={mode:"open"},N[jt("elementProperties")]=new Map,N[jt("finalized")]=new Map,js?.({ReactiveElement:N}),(se.reactiveElementVersions??=[]).push("2.1.2");var ir=globalThis,Dr=r=>r,ne=ir.trustedTypes,Rr=ne?ne.createPolicy("lit-html",{createHTML:r=>r}):void 0,ar="$lit$",I=`lit$${Math.random().toFixed(9).slice(2)}$`,cr="?"+I,Ds=`<${cr}>`,et=document,Rt=()=>et.createComment(""),Lt=r=>r===null||typeof r!="object"&&typeof r!="function",lr=Array.isArray,Ur=r=>lr(r)||typeof r?.[Symbol.iterator]=="function",nr=`[
2
- \f\r]`,Dt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Lr=/-->/g,Nr=/>/g,Y=RegExp(`>|${nr}(?:([^\\s"'>=/]+)(${nr}*=${nr}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Ir=/'/g,Hr=/"/g,qr=/^(?:script|style|textarea|title)$/i,ur=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),h=ur(1),f=ur(2),On=ur(3),rt=Symbol.for("lit-noChange"),w=Symbol.for("lit-nothing"),Vr=new WeakMap,tt=et.createTreeWalker(et,129);function Wr(r,t){if(!lr(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Rr!==void 0?Rr.createHTML(t):t}var Fr=(r,t)=>{let e=r.length-1,o=[],s,n=t===2?"<svg>":t===3?"<math>":"",i=Dt;for(let a=0;a<e;a++){let c=r[a],l,p,u=-1,m=0;for(;m<c.length&&(i.lastIndex=m,p=i.exec(c),p!==null);)m=i.lastIndex,i===Dt?p[1]==="!--"?i=Lr:p[1]!==void 0?i=Nr:p[2]!==void 0?(qr.test(p[2])&&(s=RegExp("</"+p[2],"g")),i=Y):p[3]!==void 0&&(i=Y):i===Y?p[0]===">"?(i=s??Dt,u=-1):p[1]===void 0?u=-2:(u=i.lastIndex-p[2].length,l=p[1],i=p[3]===void 0?Y:p[3]==='"'?Hr:Ir):i===Hr||i===Ir?i=Y:i===Lr||i===Nr?i=Dt:(i=Y,s=void 0);let _=i===Y&&r[a+1].startsWith("/>")?" ":"";n+=i===Dt?c+Ds:u>=0?(o.push(l),c.slice(0,u)+ar+c.slice(u)+I+_):c+I+(u===-2?a:_)}return[Wr(r,n+(r[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),o]},Nt=class r{constructor({strings:t,_$litType$:e},o){let s;this.parts=[];let n=0,i=0,a=t.length-1,c=this.parts,[l,p]=Fr(t,e);if(this.el=r.createElement(l,o),tt.currentNode=this.el.content,e===2||e===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(s=tt.nextNode())!==null&&c.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(let u of s.getAttributeNames())if(u.endsWith(ar)){let m=p[i++],_=s.getAttribute(u).split(I),X=/([.?@])?(.*)/.exec(m);c.push({type:1,index:n,name:X[2],strings:_,ctor:X[1]==="."?ae:X[1]==="?"?ce:X[1]==="@"?le:st}),s.removeAttribute(u)}else u.startsWith(I)&&(c.push({type:6,index:n}),s.removeAttribute(u));if(qr.test(s.tagName)){let u=s.textContent.split(I),m=u.length-1;if(m>0){s.textContent=ne?ne.emptyScript:"";for(let _=0;_<m;_++)s.append(u[_],Rt()),tt.nextNode(),c.push({type:2,index:++n});s.append(u[m],Rt())}}}else if(s.nodeType===8)if(s.data===cr)c.push({type:2,index:n});else{let u=-1;for(;(u=s.data.indexOf(I,u+1))!==-1;)c.push({type:7,index:n}),u+=I.length-1}n++}}static createElement(t,e){let o=et.createElement("template");return o.innerHTML=t,o}};function ot(r,t,e=r,o){if(t===rt)return t;let s=o!==void 0?e._$Co?.[o]:e._$Cl,n=Lt(t)?void 0:t._$litDirective$;return s?.constructor!==n&&(s?._$AO?.(!1),n===void 0?s=void 0:(s=new n(r),s._$AT(r,e,o)),o!==void 0?(e._$Co??=[])[o]=s:e._$Cl=s),s!==void 0&&(t=ot(r,s._$AS(r,t.values),s,o)),t}var ie=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:o}=this._$AD,s=(t?.creationScope??et).importNode(e,!0);tt.currentNode=s;let n=tt.nextNode(),i=0,a=0,c=o[0];for(;c!==void 0;){if(i===c.index){let l;c.type===2?l=new ht(n,n.nextSibling,this,t):c.type===1?l=new c.ctor(n,c.name,c.strings,this,t):c.type===6&&(l=new ue(n,this,t)),this._$AV.push(l),c=o[++a]}i!==c?.index&&(n=tt.nextNode(),i++)}return tt.currentNode=et,s}p(t){let e=0;for(let o of this._$AV)o!==void 0&&(o.strings!==void 0?(o._$AI(t,o,e),e+=o.strings.length-2):o._$AI(t[e])),e++}},ht=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,o,s){this.type=2,this._$AH=w,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=o,this.options=s,this._$Cv=s?.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=ot(this,t,e),Lt(t)?t===w||t==null||t===""?(this._$AH!==w&&this._$AR(),this._$AH=w):t!==this._$AH&&t!==rt&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Ur(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!==w&&Lt(this._$AH)?this._$AA.nextSibling.data=t:this.T(et.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:o}=t,s=typeof o=="number"?this._$AC(t):(o.el===void 0&&(o.el=Nt.createElement(Wr(o.h,o.h[0]),this.options)),o);if(this._$AH?._$AD===s)this._$AH.p(e);else{let n=new ie(s,this),i=n.u(this.options);n.p(e),this.T(i),this._$AH=n}}_$AC(t){let e=Vr.get(t.strings);return e===void 0&&Vr.set(t.strings,e=new Nt(t)),e}k(t){lr(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,o,s=0;for(let n of t)s===e.length?e.push(o=new r(this.O(Rt()),this.O(Rt()),this,this.options)):o=e[s],o._$AI(n),s++;s<e.length&&(this._$AR(o&&o._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let o=Dr(t).nextSibling;Dr(t).remove(),t=o}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},st=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,o,s,n){this.type=1,this._$AH=w,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=n,o.length>2||o[0]!==""||o[1]!==""?(this._$AH=Array(o.length-1).fill(new String),this.strings=o):this._$AH=w}_$AI(t,e=this,o,s){let n=this.strings,i=!1;if(n===void 0)t=ot(this,t,e,0),i=!Lt(t)||t!==this._$AH&&t!==rt,i&&(this._$AH=t);else{let a=t,c,l;for(t=n[0],c=0;c<n.length-1;c++)l=ot(this,a[o+c],e,c),l===rt&&(l=this._$AH[c]),i||=!Lt(l)||l!==this._$AH[c],l===w?t=w:t!==w&&(t+=(l??"")+n[c+1]),this._$AH[c]=l}i&&!s&&this.j(t)}j(t){t===w?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},ae=class extends st{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===w?void 0:t}},ce=class extends st{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==w)}},le=class extends st{constructor(t,e,o,s,n){super(t,e,o,s,n),this.type=5}_$AI(t,e=this){if((t=ot(this,t,e,0)??w)===rt)return;let o=this._$AH,s=t===w&&o!==w||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,n=t!==w&&(o===w||s);s&&this.element.removeEventListener(this.name,this,o),n&&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)}},ue=class{constructor(t,e,o){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=o}get _$AU(){return this._$AM._$AU}_$AI(t){ot(this,t)}},Gr={M:ar,P:I,A:cr,C:1,L:Fr,R:ie,D:Ur,V:ot,I:ht,H:st,N:ce,U:le,B:ae,F:ue},Rs=ir.litHtmlPolyfillSupport;Rs?.(Nt,ht),(ir.litHtmlVersions??=[]).push("3.3.3");var x=(r,t,e)=>{let o=e?.renderBefore??t,s=o._$litPart$;if(s===void 0){let n=e?.renderBefore??null;o._$litPart$=s=new ht(t.insertBefore(Rt(),n),n,void 0,e??{})}return s._$AI(r),s};var pr=globalThis,dt=class extends N{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=x(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return rt}};dt._$litElement$=!0,dt.finalized=!0,pr.litElementHydrateSupport?.({LitElement:dt});var Ls=pr.litElementPolyfillSupport;Ls?.({LitElement:dt});(pr.litElementVersions??=[]).push("4.2.2");var P={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},$={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),any:(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}"`)},entries:(r,t)=>{for(let[e,o]of t)$.any(r,e,o)},record:(r,t)=>$.entries(r,Object.entries(t))};function Kr(r,t={}){let e=document.createElement(r);return $.record(e,t),e}function Jr(r){let t=document.createDocumentFragment();return x(r,t),t.firstElementChild}function pe(r,t){let e=[];for(let[o,s]of Object.entries(t))if(typeof s=="function")r.addEventListener(o,s),e.push(()=>r.removeEventListener(o,s));else{let[n,i]=s;r.addEventListener(o,i,n),e.push(()=>r.removeEventListener(o,i))}return()=>e.forEach(o=>o())}function Zr(r,t){let e=new MutationObserver(t);return e.observe(r,{attributes:!0}),()=>e.disconnect()}var he=class{element;constructor(t){this.element=t}strings=new Proxy({},{get:(t,e)=>P.string(this.element,e),set:(t,e,o)=>$.string(this.element,e,o)});numbers=new Proxy({},{get:(t,e)=>P.number(this.element,e),set:(t,e,o)=>$.number(this.element,e,o)});booleans=new Proxy({},{get:(t,e)=>P.boolean(this.element,e),set:(t,e,o)=>$.boolean(this.element,e,o)})};var Qr=(r,t,e={})=>new Proxy(t,{get:(o,s)=>{switch(t[s]){case String:return P.string(r,s);case Number:return P.number(r,s);case Boolean:return P.boolean(r,s);default:throw new Error(`invalid attribute type for "${s}"`)}},set:(o,s,n)=>{try{switch(e.beforeSet?.(s),t[s]){case String:return $.string(r,s,n);case Number:return $.number(r,s,n);case Boolean:return $.boolean(r,s,n);default:throw new Error(`invalid attribute type for "${s}"`)}}finally{e.afterSet?.(s)}}});function mt(r){let t=new he(r);return{strings:t.strings,numbers:t.numbers,booleans:t.booleans,on:e=>Zr(r,e),spec:(e,o={})=>Qr(r,e,o)}}mt.get=P;mt.set=$;function Xr(r){return new hr(r)}var hr=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,o]of Object.entries(t))this.attr(e,o);return this}children(...t){return this.#e.push(...t),this}done(){let t=document.createElement(this.tagName);return $.entries(t,this.#t),t.append(...this.#e),t}};function ft(r,t=document){let e=t.querySelector(r);if(!e)throw new Error(`element not found (${r})`);return e}function de(r,t=document){return t.querySelector(r)}function me(r,t=document){return Array.from(t.querySelectorAll(r))}var fe=class r{element;#t;constructor(t){this.element=t}in(t){return new r(typeof t=="string"?ft(t,this.element):t)}require(t){return ft(t,this.element)}maybe(t){return de(t,this.element)}all(t){return me(t,this.element)}render(...t){return x(t,this.element)}get attrs(){return this.#t??=mt(this.element)}events(t){return pe(this.element,t)}};function g(r,t=document){return ft(r,t)}g.in=(r,t=document)=>new fe(t).in(r);g.need=ft;g.maybe=de;g.all=me;g.el=Kr;g.elmer=Xr;g.mk=Jr;g.events=pe;g.attrs=mt;g.register=te;g.render=(r,...t)=>x(t,r);var $e={};Cs($e,{DragAndDrops:()=>xr,Drops:()=>yr,files:()=>Gs,hasFiles:()=>Fs,outsideCurrentTarget:()=>qt});var Yr=Object.freeze({eq(r,t){if(r.length!==t.length)return!1;let e=0;for(let o=0;o<r.length;o++)e|=r[o]^t[o];return e===0},random(r){return crypto.getRandomValues(new Uint8Array(r))},concat(r){let t=0;for(let s of r)t+=s.byteLength;let e=new Uint8Array(t),o=0;for(let s of r)e.set(s,o),o+=s.byteLength;return e}});var v=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((o,s)=>[o,s])),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 l=0,p=0,u=[];for(let m of t){if(m===this.lexicon.padding?.character)continue;let _=this.lookup[m];if(_===void 0)throw new Error(`Invalid character: ${m}`);for(l=l<<e|_,p+=e;p>=8;)p-=8,u.push(l>>p&255)}return new Uint8Array(u)}let o=0n,s=BigInt(this.lexicon.characters.length);t.startsWith(this.negativePrefix)&&(t=t.slice(this.negativePrefix.length));let n=this.lexicon.characters[0],i=0;for(;t[i]===n;)i++;t=t.slice(i);for(let l of t){let p=this.lookup[l];if(p===void 0)throw new Error(`Invalid character: ${l}`);o=o*s+BigInt(p)}let a=new Uint8Array(i+(o===0n?0:this.countBytes(o))),c=a.length;for(;o>0n;)a[--c]=Number(o%256n),o=o/256n;return a}fromBytes(t){let e=Math.log2(this.lexicon.characters.length);if(Number.isInteger(e)){let c=0,l=0,p="";for(let u of t)for(c=c<<8|u,l+=8;l>=e;){l-=e;let m=c>>l&(1<<e)-1;p+=this.lexicon.characters[m]}if(l>0){let u=c<<e-l&(1<<e)-1;p+=this.lexicon.characters[u]}if(this.lexicon.padding)for(;p.length%this.lexicon.padding.size!==0;)p+=this.lexicon.padding.character;return p}if(t.length===0)return"";let o=this.lexicon.characters[0],s=0;for(;t[s]===0;)s++;let n=0n;for(let c of t.slice(s))n=(n<<8n)+BigInt(c);if(n===0n)return o.repeat(s);let i=BigInt(this.lexicon.characters.length),a="";for(;n>0n;)a=this.lexicon.characters[Number(n%i)]+a,n=n/i;return o.repeat(s)+a}toInteger(t){if(!t)return 0;let e=0n,o=!1,s=BigInt(this.lexicon.characters.length);t.startsWith(this.negativePrefix)&&(t=t.slice(this.negativePrefix.length),o=!0);for(let n of t){let i=this.lookup[n];if(i===void 0)throw new Error(`Invalid character: ${n}`);e=e*s+BigInt(i)}return Number(o?-e:e)}fromInteger(t){t=Math.floor(t);let e=t<0,o=BigInt(e?-t:t);if(o===0n)return this.lexicon.characters[0];let s=BigInt(this.lexicon.characters.length),n="";for(;o>0n;)n=this.lexicon.characters[Number(o%s)]+n,o=o/s;return e?`${this.negativePrefix}${n}`:n}random(t=32){return this.fromBytes(Yr.random(t))}countBytes(t){let e=0;for(;t>0n;)e++,t=t/256n;return e}};var ge=new v(v.lexicons.hex),Li=new v(v.lexicons.base2),Ni=new v(v.lexicons.base36),Ii=new v(v.lexicons.base58),Hi=new v(v.lexicons.base62),Vi=new v(v.lexicons.base64),Ui=new v(v.lexicons.base64url);function to(r,t){let e,o,s=[];function n(){e=[],o&&clearTimeout(o),o=void 0,s=[]}return n(),((...i)=>{e=i,o&&clearTimeout(o);let a=new Promise((c,l)=>{s.push({resolve:c,reject:l})});return o=setTimeout(()=>{Promise.resolve().then(()=>t(...e)).then(c=>{for(let{resolve:l}of s)l(c);n()}).catch(c=>{for(let{reject:l}of s)l(c);n()})},r),a})}function nt(){let r,t,e=new Promise((o,s)=>{r=o,t=s});return e.resolve=r,e.reject=t,e.promise=e,e.entangle=o=>(o.then(r,t),e),e}function gt(r){let t=null;return((...e)=>(t?t.params=e:(t={params:e,deferred:nt()},queueMicrotask(()=>{let{params:o,deferred:s}=t;t=null,Promise.resolve(r(...o)).then(s.resolve).catch(s.reject)})),t.deferred.promise))}function z(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(o=>z(o,new Set(t))):r.constructor===Object?e=Object.fromEntries(Object.entries(r).map(([o,s])=>[o,z(s,new Set(t))])):r instanceof Map?e=new Map(Array.from(r,([o,s])=>[o,z(s,new Set(t))])):r instanceof Set?e=new Set(Array.from(r,o=>z(o,new Set(t)))):r instanceof Date?e=new Date(r.getTime()):e=r,t.delete(r)):e=r,e}function C(r){return r!=null}var bt=r=>typeof r=="number",xt=r=>typeof r=="string";var It=r=>typeof r=="object"&&r!==null,be=r=>Array.isArray(r);function Ns(r){return r!=null}function Is(r){return r==null}var Zi=Object.freeze({happy:Ns,sad:Is,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 eo=(r,t)=>{function e(o,s,n){if(!It(o)||!It(s))return o===s;if(n.includes(o))throw new Error("forbidden circularity detected in deep equal comparison");let i=[...n,o];if(o instanceof Map&&s instanceof Map){if(o.size!==s.size)return!1;for(let[a,c]of o)if(!s.has(a)||!e(c,s.get(a),i))return!1}else if(o instanceof Set&&s instanceof Set){if(o.size!==s.size)return!1;for(let a of o)if(!Array.from(s).some(c=>e(a,c,i)))return!1}else{let a=Object.keys(o),c=Object.keys(s);if(a.length!==c.length)return!1;for(let l of a)if(!c.includes(l)||!e(o[l],s[l],i))return!1}return!0}return e(r,t,[])};function it(r){function t(e,o){if(!It(e)||o.includes(e))return e;let s=[...o,e];if(e instanceof Map)for(let n of e.entries())for(let i of n)t(i,s);else if(e instanceof Set)for(let n of e)t(n,s);else if(Array.isArray(e))for(let n of e)t(n,s);else for(let n of Object.values(e))t(n,s);return Object.freeze(e)}return t(r,[])}function ro(r){if(r.ok)return r.value;let{error:t}=r;throw t instanceof Error?t:typeof t=="string"?new Error(t):new Error("unknown")}function oo(r){if(r.ok)throw new Error("didn't get needed error");return r.error}var Hs=new TextEncoder;function dr(r){return r=Math.imul(r^r>>>15,r|1),r^=r+Math.imul(r^r>>>7,r|61),r^=r>>>14,r>>>0}function Vs(r){let t=2166136261;for(let e of Hs.encode(r))t^=e,t=Math.imul(t,16777619);return dr(t)}function so(...r){let t=2654435769;for(let e of r){let o=typeof e=="string"?Vs(e):e>>>0;t=t+1831565813>>>0,t^=dr(o),t=dr(t)}return t}function k(r,t="got failed"){if(r==null)throw new Error(t);return r}function yt(r,t,e){if(r.has(t))return r.get(t);{let o=e();return r.set(t,o),o}}function Ht(r,t){for(let[e,o]of t)r.set(e,o);return r}function xe(r,t){return t<=0?[]:r.length>t?r.slice(-t):r}async function mr(r){let t=[];for await(let e of r)t.push(e);return t}function wt(r){let t,e=!1,o=()=>{e=!0,clearTimeout(t)},s=async()=>{e||(await r(o),!e&&(t=setTimeout(s,0)))};return s(),o}function U(){let r=[],t=()=>{let o=r;r=[];for(let s=o.length-1;s>=0;s--)o[s]()};function e(){t()}return e.dispose=t,e.schedule=(...o)=>(r.push(...o),e),e.own=(o,s)=>(r.push(()=>s(o)),o),e.disposable=o=>(r.push(()=>o.dispose()),o),e.disposables=e.disposable,e}function E(r,t){let e=Object.entries(t);for(let[o,s]of e)r.addEventListener(o,s);return()=>{for(let[o,s]of e)r.removeEventListener(o,s)}}var vt=class{count;constructor(t=0){this.count=t}next(){return this.count++}};var $t=(r=0)=>new Promise(t=>setTimeout(t,r));var fr=(r,t)=>Object.fromEntries(Object.entries(r).map(([e,o])=>[e,t(o,e)])),Us=(r,t)=>Object.fromEntries(Object.entries(r).filter(([e,o])=>t(o,e)));function qs(r){return{map:t=>no(r,t),filter:t=>io(r,t)}}qs.pipe=Object.freeze({map:r=>(t=>no(t,r)),filter:r=>(t=>io(t,r))});var no=fr,io=Us;function q(r){let t=Ws(),e=o=>t.on(o);return Object.assign(e,t),r&&t.on(r),e}function Ws(){let r=new Set,t,e=()=>t??=nt(),o=a=>{let c=t;t=void 0,c?.resolve(a)};return{set:r,on:a=>(r.add(a),()=>{r.delete(a)}),publish:(...a)=>{o(a);for(let c of[...r])c(...a)},publishAsync:async(...a)=>{o(a),await Promise.all([...r].map(async c=>c(...a)))},next:e}}function W(r,...t){let e=r.length-1;return r.slice(0,e).reduce((o,s,n)=>o+s+t[n],"")+r[e]}function kt(r,t,e){return r?t():e?.()}function ye(r,t,e){return C(r)?t(r):e?.()}var we=class{#t=new Set;#e=[];#o=new WeakMap;#r=0;#s=new Set;read(t){this.#e.at(-1)?.add(t)}write(t){let e=this.#o.get(t);if(e){for(let o of e)this.#s.add(o);this.#r===0&&this.#n()}}observe(t){let e=new Set;this.#e.push(e);try{let o=t();return{seen:e,value:o}}finally{this.#e.pop()}}subscribe(t,e){let o=yt(this.#o,t,()=>new Set);return o.add(e),()=>{o.delete(e),o.size===0&&this.#o.delete(t)}}batch=t=>{this.#r++;try{return t()}finally{this.#r--,this.#r===0&&this.#n()}};#i(t){if(this.#t.has(t))throw new Error("circularity forbidden");this.#t.add(t);try{t()}finally{this.#t.delete(t)}}#n(){for(;this.#s.size>0;){let t=[...this.#s];this.#s.clear();for(let e of t)this.#i(e)}}};var d=globalThis[Symbol.for("e280.tracker.2")]??=new we;function S(r){let t;function e(){return arguments.length===0?(d.read(e),r):(r=arguments[0],d.write(e),t?.publish(r),r)}return e.get=()=>e(),e.set=o=>e(o),e.on=o=>(t??=q())(o),e}var O=class extends Map{get size(){return d.read(this),super.size}[Symbol.iterator](){return d.read(this),super[Symbol.iterator]()}forEach(t){d.read(this);for(let[e,o]of this)t(o,e,this);return this}keys(){return d.read(this),super.keys()}values(){return d.read(this),super.values()}entries(){return d.read(this),super.entries()}has(t){return d.read(this),super.has(t)}get(t){return d.read(this),super.get(t)}set(t,e){return super.set(t,e),d.write(this),this}delete(t){let e=super.delete(t);return d.write(this),e}clear(){return super.clear(),d.write(this),this}};var Vt=class extends Set{get size(){return d.read(this),super.size}[Symbol.iterator](){return d.read(this),super[Symbol.iterator]()}forEach(t){d.read(this);for(let e of this)t(e,e,this);return this}values(){return d.read(this),super.values()}has(t){return d.read(this),super.has(t)}add(t){return super.add(t),d.write(this),this}delete(t){let e=super.delete(t);return d.write(this),e}clear(){return super.clear(),d.write(this),this}};var Fa=d.batch;function co(r){return it(z(r))}var T=Symbol("optic");var Ut=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 ve=class r{[T];#t;#e;#o;#r=q();constructor(t){this[T]=t,this.#t=z(t.getState()),this.#e=new Ut(()=>z(t.getState())),this.#o=new Ut(()=>co(t.getState()))}get on(){return this.#r.on}update(){let t=this[T].getState();!eo(t,this.#t)&&(this.#e.invalidate(),this.#o.invalidate(),this.#t=z(t),d.write(this),this.#r.set.size&&this.#r.publish(this.#e.get()))}get state(){return d.read(this),this.#e.get()}get frozen(){return d.read(this),this.#o.get()}mutate(t){return this[T].mutate(t)}lens(t){let e=new r({getState:()=>t(this[T].getState()),mutate:o=>this[T].mutate(s=>o(t(s))),registerLens:this[T].registerLens});return this[T].registerLens(e),e}};function lo(r){if(!r.done)throw new Error("wait not done");return ro(r)}function uo(r){if(!r.done)throw new Error("wait not done");return oo(r)}var po=r=>!r.done;var br=r=>r.done&&r.ok;function ho(r,t){let{pending:e=()=>{},ok:o=()=>{},err:s=()=>{}}=t;return po(r)?e():br(r)?o(lo(r)):s(uo(r))}function Fs(r){return!!(r.dataTransfer&&r.dataTransfer.types.includes("Files"))}function Gs(r){return r.dataTransfer?Array.from(r.dataTransfer.files):[]}function qt(r){let t=r.currentTarget,e=r.relatedTarget;return!t||!e||!t.contains(e)}var xr=class{params;$draggy=S(void 0);$droppy=S(void 0);constructor(t){this.params=t}get dragging(){return this.$draggy()}get hovering(){return this.$droppy()}dragzone=t=>({draggable:"true",dragstart:e=>{this.$draggy(t())},dragend:e=>{this.$draggy(void 0),this.$droppy(void 0)}});dropzone=t=>({dragenter:e=>{},dragover:e=>{e.preventDefault(),this.$draggy()?this.$droppy(t()):this.params.backchannelDrops?.dragover(e)},dragleave:e=>{qt(e)&&this.$droppy(void 0),this.params.backchannelDrops?.dragleave(e)},drop:e=>{e.preventDefault();let{acceptDrop:o}=this.params,s=this.$draggy(),n=this.$droppy();try{s&&n?o(e,s,n):this.params.backchannelDrops?.drop(e)}finally{this.$draggy(void 0),this.$droppy(void 0)}}})};var yr=class{params;$indicator=S(!1);constructor(t){this.params=t}dragover=t=>{t.preventDefault(),this.$indicator(this.params.predicate(t))};dragleave=t=>{qt(t)&&this.$indicator(!1)};drop=t=>{t.preventDefault(),this.$indicator(!1),this.params.predicate(t)&&this.params.acceptDrop(t)}};var St=b`
1
+ var Ms=Object.defineProperty;var Ps=(r,t)=>{for(var e in t)Ms(r,e,{get:t[e],enumerable:!0})};function Pr(r){return r.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}function Yt(r,t={}){let{soft:e=!1,upgrade:o=!0}=t;for(let[s,n]of Object.entries(r)){let i=Pr(s),a=customElements.get(i);e&&a||(customElements.define(i,n),o&&document.querySelectorAll(i).forEach(c=>{c.constructor===HTMLElement&&customElements.upgrade(c)}))}}var te=globalThis,ee=te.ShadowRoot&&(te.ShadyCSS===void 0||te.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,or=Symbol(),zr=new WeakMap,Bt=class{constructor(t,e,o){if(this._$cssResult$=!0,o!==or)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(ee&&t===void 0){let o=e!==void 0&&e.length===1;o&&(t=zr.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),o&&zr.set(e,t))}return t}toString(){return this.cssText}},Or=r=>new Bt(typeof r=="string"?r:r+"",void 0,or),x=(r,...t)=>{let e=r.length===1?r[0]:t.reduce((o,s,n)=>o+(i=>{if(i._$cssResult$===!0)return i.cssText;if(typeof i=="number")return i;throw Error("Value passed to 'css' function must be a 'css' function result: "+i+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+r[n+1],r[0]);return new Bt(e,r,or)},re=(r,t)=>{if(ee)r.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let o=document.createElement("style"),s=te.litNonce;s!==void 0&&o.setAttribute("nonce",s),o.textContent=e.cssText,r.appendChild(o)}},pt=ee?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(let o of t.cssRules)e+=o.cssText;return Or(e)})(r):r;var{is:zs,defineProperty:Os,getOwnPropertyDescriptor:Ts,getOwnPropertyNames:Bs,getOwnPropertySymbols:Ds,getPrototypeOf:js}=Object,oe=globalThis,Tr=oe.trustedTypes,Rs=Tr?Tr.emptyScript:"",Ls=oe.reactiveElementPolyfillSupport,Dt=(r,t)=>r,sr={toAttribute(r,t){switch(t){case Boolean:r=r?Rs: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}},Dr=(r,t)=>!zs(r,t),Br={attribute:!0,type:String,converter:sr,reflect:!1,useDefault:!1,hasChanged:Dr};Symbol.metadata??=Symbol("metadata"),oe.litPropertyMetadata??=new WeakMap;var H=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=Br){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 o=Symbol(),s=this.getPropertyDescriptor(t,o,e);s!==void 0&&Os(this.prototype,t,s)}}static getPropertyDescriptor(t,e,o){let{get:s,set:n}=Ts(this.prototype,t)??{get(){return this[e]},set(i){this[e]=i}};return{get:s,set(i){let a=s?.call(this);n?.call(this,i),this.requestUpdate(t,a,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Br}static _$Ei(){if(this.hasOwnProperty(Dt("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(Dt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Dt("properties"))){let e=this.properties,o=[...Bs(e),...Ds(e)];for(let s of o)this.createProperty(s,e[s])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[o,s]of e)this.elementProperties.set(o,s)}this._$Eh=new Map;for(let[e,o]of this.elementProperties){let s=this._$Eu(e,o);s!==void 0&&this._$Eh.set(s,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let o=new Set(t.flat(1/0).reverse());for(let s of o)e.unshift(pt(s))}else t!==void 0&&e.push(pt(t));return e}static _$Eu(t,e){let o=e.attribute;return o===!1?void 0:typeof o=="string"?o: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 o of e.keys())this.hasOwnProperty(o)&&(t.set(o,this[o]),delete this[o]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return re(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,o){this._$AK(t,o)}_$ET(t,e){let o=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,o);if(s!==void 0&&o.reflect===!0){let n=(o.converter?.toAttribute!==void 0?o.converter:sr).toAttribute(e,o.type);this._$Em=t,n==null?this.removeAttribute(s):this.setAttribute(s,n),this._$Em=null}}_$AK(t,e){let o=this.constructor,s=o._$Eh.get(t);if(s!==void 0&&this._$Em!==s){let n=o.getPropertyOptions(s),i=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:sr;this._$Em=s;let a=i.fromAttribute(e,n.type);this[s]=a??this._$Ej?.get(s)??a,this._$Em=null}}requestUpdate(t,e,o,s=!1,n){if(t!==void 0){let i=this.constructor;if(s===!1&&(n=this[t]),o??=i.getPropertyOptions(t),!((o.hasChanged??Dr)(n,e)||o.useDefault&&o.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,o))))return;this.C(t,e,o)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:o,reflect:s,wrapped:n},i){o&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,i??e??this[t]),n!==!0||i!==void 0)||(this._$AL.has(t)||(this.hasUpdated||o||(e=void 0),this._$AL.set(t,e)),s===!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[s,n]of this._$Ep)this[s]=n;this._$Ep=void 0}let o=this.constructor.elementProperties;if(o.size>0)for(let[s,n]of o){let{wrapped:i}=n,a=this[s];i!==!0||this._$AL.has(s)||a===void 0||this.C(s,void 0,n,a)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(o=>o.hostUpdate?.()),this.update(e)):this._$EM()}catch(o){throw t=!1,this._$EM(),o}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){}};H.elementStyles=[],H.shadowRootOptions={mode:"open"},H[Dt("elementProperties")]=new Map,H[Dt("finalized")]=new Map,Ls?.({ReactiveElement:H}),(oe.reactiveElementVersions??=[]).push("2.1.2");var ir=globalThis,jr=r=>r,se=ir.trustedTypes,Rr=se?se.createPolicy("lit-html",{createHTML:r=>r}):void 0,ar="$lit$",V=`lit$${Math.random().toFixed(9).slice(2)}$`,cr="?"+V,Ns=`<${cr}>`,rt=document,Rt=()=>rt.createComment(""),Lt=r=>r===null||typeof r!="object"&&typeof r!="function",lr=Array.isArray,Ur=r=>lr(r)||typeof r?.[Symbol.iterator]=="function",nr=`[
2
+ \f\r]`,jt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Lr=/-->/g,Nr=/>/g,tt=RegExp(`>|${nr}(?:([^\\s"'>=/]+)(${nr}*=${nr}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Ir=/'/g,Hr=/"/g,qr=/^(?:script|style|textarea|title)$/i,ur=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),h=ur(1),g=ur(2),Dn=ur(3),ot=Symbol.for("lit-noChange"),v=Symbol.for("lit-nothing"),Vr=new WeakMap,et=rt.createTreeWalker(rt,129);function Wr(r,t){if(!lr(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Rr!==void 0?Rr.createHTML(t):t}var Fr=(r,t)=>{let e=r.length-1,o=[],s,n=t===2?"<svg>":t===3?"<math>":"",i=jt;for(let a=0;a<e;a++){let c=r[a],l,p,u=-1,d=0;for(;d<c.length&&(i.lastIndex=d,p=i.exec(c),p!==null);)d=i.lastIndex,i===jt?p[1]==="!--"?i=Lr:p[1]!==void 0?i=Nr:p[2]!==void 0?(qr.test(p[2])&&(s=RegExp("</"+p[2],"g")),i=tt):p[3]!==void 0&&(i=tt):i===tt?p[0]===">"?(i=s??jt,u=-1):p[1]===void 0?u=-2:(u=i.lastIndex-p[2].length,l=p[1],i=p[3]===void 0?tt:p[3]==='"'?Hr:Ir):i===Hr||i===Ir?i=tt:i===Lr||i===Nr?i=jt:(i=tt,s=void 0);let f=i===tt&&r[a+1].startsWith("/>")?" ":"";n+=i===jt?c+Ns:u>=0?(o.push(l),c.slice(0,u)+ar+c.slice(u)+V+f):c+V+(u===-2?a:f)}return[Wr(r,n+(r[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),o]},Nt=class r{constructor({strings:t,_$litType$:e},o){let s;this.parts=[];let n=0,i=0,a=t.length-1,c=this.parts,[l,p]=Fr(t,e);if(this.el=r.createElement(l,o),et.currentNode=this.el.content,e===2||e===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(s=et.nextNode())!==null&&c.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(let u of s.getAttributeNames())if(u.endsWith(ar)){let d=p[i++],f=s.getAttribute(u).split(V),z=/([.?@])?(.*)/.exec(d);c.push({type:1,index:n,name:z[2],strings:f,ctor:z[1]==="."?ie:z[1]==="?"?ae:z[1]==="@"?ce:nt}),s.removeAttribute(u)}else u.startsWith(V)&&(c.push({type:6,index:n}),s.removeAttribute(u));if(qr.test(s.tagName)){let u=s.textContent.split(V),d=u.length-1;if(d>0){s.textContent=se?se.emptyScript:"";for(let f=0;f<d;f++)s.append(u[f],Rt()),et.nextNode(),c.push({type:2,index:++n});s.append(u[d],Rt())}}}else if(s.nodeType===8)if(s.data===cr)c.push({type:2,index:n});else{let u=-1;for(;(u=s.data.indexOf(V,u+1))!==-1;)c.push({type:7,index:n}),u+=V.length-1}n++}}static createElement(t,e){let o=rt.createElement("template");return o.innerHTML=t,o}};function st(r,t,e=r,o){if(t===ot)return t;let s=o!==void 0?e._$Co?.[o]:e._$Cl,n=Lt(t)?void 0:t._$litDirective$;return s?.constructor!==n&&(s?._$AO?.(!1),n===void 0?s=void 0:(s=new n(r),s._$AT(r,e,o)),o!==void 0?(e._$Co??=[])[o]=s:e._$Cl=s),s!==void 0&&(t=st(r,s._$AS(r,t.values),s,o)),t}var ne=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:o}=this._$AD,s=(t?.creationScope??rt).importNode(e,!0);et.currentNode=s;let n=et.nextNode(),i=0,a=0,c=o[0];for(;c!==void 0;){if(i===c.index){let l;c.type===2?l=new ht(n,n.nextSibling,this,t):c.type===1?l=new c.ctor(n,c.name,c.strings,this,t):c.type===6&&(l=new le(n,this,t)),this._$AV.push(l),c=o[++a]}i!==c?.index&&(n=et.nextNode(),i++)}return et.currentNode=rt,s}p(t){let e=0;for(let o of this._$AV)o!==void 0&&(o.strings!==void 0?(o._$AI(t,o,e),e+=o.strings.length-2):o._$AI(t[e])),e++}},ht=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,o,s){this.type=2,this._$AH=v,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=o,this.options=s,this._$Cv=s?.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=st(this,t,e),Lt(t)?t===v||t==null||t===""?(this._$AH!==v&&this._$AR(),this._$AH=v):t!==this._$AH&&t!==ot&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Ur(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!==v&&Lt(this._$AH)?this._$AA.nextSibling.data=t:this.T(rt.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:o}=t,s=typeof o=="number"?this._$AC(t):(o.el===void 0&&(o.el=Nt.createElement(Wr(o.h,o.h[0]),this.options)),o);if(this._$AH?._$AD===s)this._$AH.p(e);else{let n=new ne(s,this),i=n.u(this.options);n.p(e),this.T(i),this._$AH=n}}_$AC(t){let e=Vr.get(t.strings);return e===void 0&&Vr.set(t.strings,e=new Nt(t)),e}k(t){lr(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,o,s=0;for(let n of t)s===e.length?e.push(o=new r(this.O(Rt()),this.O(Rt()),this,this.options)):o=e[s],o._$AI(n),s++;s<e.length&&(this._$AR(o&&o._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let o=jr(t).nextSibling;jr(t).remove(),t=o}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},nt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,o,s,n){this.type=1,this._$AH=v,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=n,o.length>2||o[0]!==""||o[1]!==""?(this._$AH=Array(o.length-1).fill(new String),this.strings=o):this._$AH=v}_$AI(t,e=this,o,s){let n=this.strings,i=!1;if(n===void 0)t=st(this,t,e,0),i=!Lt(t)||t!==this._$AH&&t!==ot,i&&(this._$AH=t);else{let a=t,c,l;for(t=n[0],c=0;c<n.length-1;c++)l=st(this,a[o+c],e,c),l===ot&&(l=this._$AH[c]),i||=!Lt(l)||l!==this._$AH[c],l===v?t=v:t!==v&&(t+=(l??"")+n[c+1]),this._$AH[c]=l}i&&!s&&this.j(t)}j(t){t===v?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},ie=class extends nt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===v?void 0:t}},ae=class extends nt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==v)}},ce=class extends nt{constructor(t,e,o,s,n){super(t,e,o,s,n),this.type=5}_$AI(t,e=this){if((t=st(this,t,e,0)??v)===ot)return;let o=this._$AH,s=t===v&&o!==v||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,n=t!==v&&(o===v||s);s&&this.element.removeEventListener(this.name,this,o),n&&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)}},le=class{constructor(t,e,o){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=o}get _$AU(){return this._$AM._$AU}_$AI(t){st(this,t)}},Kr={M:ar,P:V,A:cr,C:1,L:Fr,R:ne,D:Ur,V:st,I:ht,H:nt,N:ae,U:ce,B:ie,F:le},Is=ir.litHtmlPolyfillSupport;Is?.(Nt,ht),(ir.litHtmlVersions??=[]).push("3.3.3");var w=(r,t,e)=>{let o=e?.renderBefore??t,s=o._$litPart$;if(s===void 0){let n=e?.renderBefore??null;o._$litPart$=s=new ht(t.insertBefore(Rt(),n),n,void 0,e??{})}return s._$AI(r),s};var pr=globalThis,dt=class extends H{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=w(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return ot}};dt._$litElement$=!0,dt.finalized=!0,pr.litElementHydrateSupport?.({LitElement:dt});var Hs=pr.litElementPolyfillSupport;Hs?.({LitElement:dt});(pr.litElementVersions??=[]).push("4.2.2");var O={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},k={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),any:(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}"`)},entries:(r,t)=>{for(let[e,o]of t)k.any(r,e,o)},record:(r,t)=>k.entries(r,Object.entries(t))};function Gr(r,t={}){let e=document.createElement(r);return k.record(e,t),e}function Jr(r){let t=document.createDocumentFragment();return w(r,t),t.firstElementChild}function ue(r,t){let e=[];for(let[o,s]of Object.entries(t))if(typeof s=="function")r.addEventListener(o,s),e.push(()=>r.removeEventListener(o,s));else{let[n,i]=s;r.addEventListener(o,i,n),e.push(()=>r.removeEventListener(o,i))}return()=>e.forEach(o=>o())}function Zr(r,t){let e=new MutationObserver(t);return e.observe(r,{attributes:!0}),()=>e.disconnect()}var pe=class{element;constructor(t){this.element=t}strings=new Proxy({},{get:(t,e)=>O.string(this.element,e),set:(t,e,o)=>k.string(this.element,e,o)});numbers=new Proxy({},{get:(t,e)=>O.number(this.element,e),set:(t,e,o)=>k.number(this.element,e,o)});booleans=new Proxy({},{get:(t,e)=>O.boolean(this.element,e),set:(t,e,o)=>k.boolean(this.element,e,o)})};var Qr=(r,t,e={})=>new Proxy(t,{get:(o,s)=>{switch(t[s]){case String:return O.string(r,s);case Number:return O.number(r,s);case Boolean:return O.boolean(r,s);default:throw new Error(`invalid attribute type for "${s}"`)}},set:(o,s,n)=>{try{switch(e.beforeSet?.(s),t[s]){case String:return k.string(r,s,n);case Number:return k.number(r,s,n);case Boolean:return k.boolean(r,s,n);default:throw new Error(`invalid attribute type for "${s}"`)}}finally{e.afterSet?.(s)}}});function mt(r){let t=new pe(r);return{strings:t.strings,numbers:t.numbers,booleans:t.booleans,on:e=>Zr(r,e),spec:(e,o={})=>Qr(r,e,o)}}mt.get=O;mt.set=k;function Xr(r){return new hr(r)}var hr=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,o]of Object.entries(t))this.attr(e,o);return this}children(...t){return this.#e.push(...t),this}done(){let t=document.createElement(this.tagName);return k.entries(t,this.#t),t.append(...this.#e),t}};function ft(r,t=document){let e=t.querySelector(r);if(!e)throw new Error(`element not found (${r})`);return e}function he(r,t=document){return t.querySelector(r)}function de(r,t=document){return Array.from(t.querySelectorAll(r))}var me=class r{element;#t;constructor(t){this.element=t}in(t){return new r(typeof t=="string"?ft(t,this.element):t)}require(t){return ft(t,this.element)}maybe(t){return he(t,this.element)}all(t){return de(t,this.element)}render(...t){return w(t,this.element)}get attrs(){return this.#t??=mt(this.element)}events(t){return ue(this.element,t)}};function b(r,t=document){return ft(r,t)}b.in=(r,t=document)=>new me(t).in(r);b.need=ft;b.maybe=he;b.all=de;b.el=Gr;b.elmer=Xr;b.mk=Jr;b.events=ue;b.attrs=mt;b.register=Yt;b.render=(r,...t)=>w(t,r);var ye={};Ps(ye,{DragAndDrops:()=>xr,Drops:()=>wr,files:()=>Zs,hasFiles:()=>Js,outsideCurrentTarget:()=>qt});var Yr=Object.freeze({eq(r,t){if(r.length!==t.length)return!1;let e=0;for(let o=0;o<r.length;o++)e|=r[o]^t[o];return e===0},random(r){return crypto.getRandomValues(new Uint8Array(r))},concat(r){let t=0;for(let s of r)t+=s.byteLength;let e=new Uint8Array(t),o=0;for(let s of r)e.set(s,o),o+=s.byteLength;return e}});var $=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((o,s)=>[o,s])),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 l=0,p=0,u=[];for(let d of t){if(d===this.lexicon.padding?.character)continue;let f=this.lookup[d];if(f===void 0)throw new Error(`Invalid character: ${d}`);for(l=l<<e|f,p+=e;p>=8;)p-=8,u.push(l>>p&255)}return new Uint8Array(u)}let o=0n,s=BigInt(this.lexicon.characters.length);t.startsWith(this.negativePrefix)&&(t=t.slice(this.negativePrefix.length));let n=this.lexicon.characters[0],i=0;for(;t[i]===n;)i++;t=t.slice(i);for(let l of t){let p=this.lookup[l];if(p===void 0)throw new Error(`Invalid character: ${l}`);o=o*s+BigInt(p)}let a=new Uint8Array(i+(o===0n?0:this.countBytes(o))),c=a.length;for(;o>0n;)a[--c]=Number(o%256n),o=o/256n;return a}fromBytes(t){let e=Math.log2(this.lexicon.characters.length);if(Number.isInteger(e)){let c=0,l=0,p="";for(let u of t)for(c=c<<8|u,l+=8;l>=e;){l-=e;let d=c>>l&(1<<e)-1;p+=this.lexicon.characters[d]}if(l>0){let u=c<<e-l&(1<<e)-1;p+=this.lexicon.characters[u]}if(this.lexicon.padding)for(;p.length%this.lexicon.padding.size!==0;)p+=this.lexicon.padding.character;return p}if(t.length===0)return"";let o=this.lexicon.characters[0],s=0;for(;t[s]===0;)s++;let n=0n;for(let c of t.slice(s))n=(n<<8n)+BigInt(c);if(n===0n)return o.repeat(s);let i=BigInt(this.lexicon.characters.length),a="";for(;n>0n;)a=this.lexicon.characters[Number(n%i)]+a,n=n/i;return o.repeat(s)+a}toInteger(t){if(!t)return 0;let e=0n,o=!1,s=BigInt(this.lexicon.characters.length);t.startsWith(this.negativePrefix)&&(t=t.slice(this.negativePrefix.length),o=!0);for(let n of t){let i=this.lookup[n];if(i===void 0)throw new Error(`Invalid character: ${n}`);e=e*s+BigInt(i)}return Number(o?-e:e)}fromInteger(t){t=Math.floor(t);let e=t<0,o=BigInt(e?-t:t);if(o===0n)return this.lexicon.characters[0];let s=BigInt(this.lexicon.characters.length),n="";for(;o>0n;)n=this.lexicon.characters[Number(o%s)]+n,o=o/s;return e?`${this.negativePrefix}${n}`:n}random(t=32){return this.fromBytes(Yr.random(t))}countBytes(t){let e=0;for(;t>0n;)e++,t=t/256n;return e}};var fe=new $($.lexicons.hex),Hi=new $($.lexicons.base2),Vi=new $($.lexicons.base36),Ui=new $($.lexicons.base58),qi=new $($.lexicons.base62),Wi=new $($.lexicons.base64),Fi=new $($.lexicons.base64url);function to(r,t){let e,o,s=[];function n(){e=[],o&&clearTimeout(o),o=void 0,s=[]}return n(),((...i)=>{e=i,o&&clearTimeout(o);let a=new Promise((c,l)=>{s.push({resolve:c,reject:l})});return o=setTimeout(()=>{Promise.resolve().then(()=>t(...e)).then(c=>{for(let{resolve:l}of s)l(c);n()}).catch(c=>{for(let{reject:l}of s)l(c);n()})},r),a})}function it(){let r,t,e=new Promise((o,s)=>{r=o,t=s});return e.resolve=r,e.reject=t,e.promise=e,e.entangle=o=>(o.then(r,t),e),e}function gt(r){let t=null;return((...e)=>(t?t.params=e:(t={params:e,deferred:it()},queueMicrotask(()=>{let{params:o,deferred:s}=t;t=null,Promise.resolve(r(...o)).then(s.resolve).catch(s.reject)})),t.deferred.promise))}function T(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(o=>T(o,new Set(t))):r.constructor===Object?e=Object.fromEntries(Object.entries(r).map(([o,s])=>[o,T(s,new Set(t))])):r instanceof Map?e=new Map(Array.from(r,([o,s])=>[o,T(s,new Set(t))])):r instanceof Set?e=new Set(Array.from(r,o=>T(o,new Set(t)))):r instanceof Date?e=new Date(r.getTime()):e=r,t.delete(r)):e=r,e}function E(r){return r!=null}var bt=r=>typeof r=="number",xt=r=>typeof r=="string";var It=r=>typeof r=="object"&&r!==null,ge=r=>Array.isArray(r);function Vs(r){return r!=null}function Us(r){return r==null}var Yi=Object.freeze({happy:Vs,sad:Us,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 eo=(r,t)=>{function e(o,s,n){if(!It(o)||!It(s))return o===s;if(n.includes(o))throw new Error("forbidden circularity detected in deep equal comparison");let i=[...n,o];if(o instanceof Map&&s instanceof Map){if(o.size!==s.size)return!1;for(let[a,c]of o)if(!s.has(a)||!e(c,s.get(a),i))return!1}else if(o instanceof Set&&s instanceof Set){if(o.size!==s.size)return!1;for(let a of o)if(!Array.from(s).some(c=>e(a,c,i)))return!1}else{let a=Object.keys(o),c=Object.keys(s);if(a.length!==c.length)return!1;for(let l of a)if(!c.includes(l)||!e(o[l],s[l],i))return!1}return!0}return e(r,t,[])};function at(r){function t(e,o){if(!It(e)||o.includes(e))return e;let s=[...o,e];if(e instanceof Map)for(let n of e.entries())for(let i of n)t(i,s);else if(e instanceof Set)for(let n of e)t(n,s);else if(Array.isArray(e))for(let n of e)t(n,s);else for(let n of Object.values(e))t(n,s);return Object.freeze(e)}return t(r,[])}function ro(r){if(r.ok)return r.value;let{error:t}=r;throw t instanceof Error?t:typeof t=="string"?new Error(t):new Error("unknown")}function oo(r){if(r.ok)throw new Error("didn't get needed error");return r.error}var qs=new TextEncoder;function dr(r){return r=Math.imul(r^r>>>15,r|1),r^=r+Math.imul(r^r>>>7,r|61),r^=r>>>14,r>>>0}function Ws(r){let t=2166136261;for(let e of qs.encode(r))t^=e,t=Math.imul(t,16777619);return dr(t)}function so(...r){let t=2654435769;for(let e of r){let o=typeof e=="string"?Ws(e):e>>>0;t=t+1831565813>>>0,t^=dr(o),t=dr(t)}return t}function S(r,t="got failed"){if(r==null)throw new Error(t);return r}function wt(r,t,e){if(r.has(t))return r.get(t);{let o=e();return r.set(t,o),o}}function Ht(r,t){for(let[e,o]of t)r.set(e,o);return r}function no(r,t){return t<=0?[]:r.length>t?r.slice(-t):r}async function mr(r){let t=[];for await(let e of r)t.push(e);return t}function yt(r){let t,e=!1,o=()=>{e=!0,clearTimeout(t)},s=async()=>{e||(await r(o),!e&&(t=setTimeout(s,0)))};return s(),o}function M(){let r=[],t=()=>{let o=r;r=[];for(let s=o.length-1;s>=0;s--)o[s]()};function e(){t()}return e.dispose=t,e.schedule=(...o)=>(r.push(...o),e),e.own=(o,s)=>(r.push(()=>s(o)),o),e.disposable=o=>(r.push(()=>o.dispose()),o),e.disposables=e.disposable,e}function A(r,t){let e=Object.entries(t);for(let[o,s]of e)r.addEventListener(o,s);return()=>{for(let[o,s]of e)r.removeEventListener(o,s)}}var vt=class{count;constructor(t=0){this.count=t}next(){return this.count++}};var $t=(r=0)=>new Promise(t=>setTimeout(t,r));var fr=(r,t)=>Object.fromEntries(Object.entries(r).map(([e,o])=>[e,t(o,e)])),Fs=(r,t)=>Object.fromEntries(Object.entries(r).filter(([e,o])=>t(o,e)));function Ks(r){return{map:t=>io(r,t),filter:t=>ao(r,t)}}Ks.pipe=Object.freeze({map:r=>(t=>io(t,r)),filter:r=>(t=>ao(t,r))});var io=fr,ao=Fs;function W(r){let t=Gs(),e=o=>t.on(o);return Object.assign(e,t),r&&t.on(r),e}function Gs(){let r=new Set,t,e=()=>t??=it(),o=a=>{let c=t;t=void 0,c?.resolve(a)};return{set:r,on:a=>(r.add(a),()=>{r.delete(a)}),publish:(...a)=>{o(a);for(let c of[...r])c(...a)},publishAsync:async(...a)=>{o(a),await Promise.all([...r].map(async c=>c(...a)))},next:e}}function F(r,...t){let e=r.length-1;return r.slice(0,e).reduce((o,s,n)=>o+s+t[n],"")+r[e]}function kt(r,t,e){return r?t():e?.()}function be(r,t,e){return E(r)?t(r):e?.()}var xe=class{#t=new Set;#e=[];#o=new WeakMap;#r=0;#s=new Set;read(t){this.#e.at(-1)?.add(t)}write(t){let e=this.#o.get(t);if(e){for(let o of e)this.#s.add(o);this.#r===0&&this.#n()}}observe(t){let e=new Set;this.#e.push(e);try{let o=t();return{seen:e,value:o}}finally{this.#e.pop()}}subscribe(t,e){let o=wt(this.#o,t,()=>new Set);return o.add(e),()=>{o.delete(e),o.size===0&&this.#o.delete(t)}}batch=t=>{this.#r++;try{return t()}finally{this.#r--,this.#r===0&&this.#n()}};#i(t){if(this.#t.has(t))throw new Error("circularity forbidden");this.#t.add(t);try{t()}finally{this.#t.delete(t)}}#n(){for(;this.#s.size>0;){let t=[...this.#s];this.#s.clear();for(let e of t)this.#i(e)}}};var m=globalThis[Symbol.for("e280.tracker.2")]??=new xe;function _(r){let t;function e(){return arguments.length===0?(m.read(e),r):(r=arguments[0],m.write(e),t?.publish(r),r)}return e.get=()=>e(),e.set=o=>e(o),e.on=o=>(t??=W())(o),e}var B=class extends Map{get size(){return m.read(this),super.size}[Symbol.iterator](){return m.read(this),super[Symbol.iterator]()}forEach(t){m.read(this);for(let[e,o]of this)t(o,e,this);return this}keys(){return m.read(this),super.keys()}values(){return m.read(this),super.values()}entries(){return m.read(this),super.entries()}has(t){return m.read(this),super.has(t)}get(t){return m.read(this),super.get(t)}set(t,e){return super.set(t,e),m.write(this),this}delete(t){let e=super.delete(t);return m.write(this),e}clear(){return super.clear(),m.write(this),this}};var Vt=class extends Set{get size(){return m.read(this),super.size}[Symbol.iterator](){return m.read(this),super[Symbol.iterator]()}forEach(t){m.read(this);for(let e of this)t(e,e,this);return this}values(){return m.read(this),super.values()}has(t){return m.read(this),super.has(t)}add(t){return super.add(t),m.write(this),this}delete(t){let e=super.delete(t);return m.write(this),e}clear(){return super.clear(),m.write(this),this}};var Ja=m.batch;function lo(r){return at(T(r))}var D=Symbol("optic");var Ut=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 we=class r{[D];#t;#e;#o;#r=W();constructor(t){this[D]=t,this.#t=T(t.getState()),this.#e=new Ut(()=>T(t.getState())),this.#o=new Ut(()=>lo(t.getState()))}get on(){return this.#r.on}update(){let t=this[D].getState();!eo(t,this.#t)&&(this.#e.invalidate(),this.#o.invalidate(),this.#t=T(t),m.write(this),this.#r.set.size&&this.#r.publish(this.#e.get()))}get state(){return m.read(this),this.#e.get()}get frozen(){return m.read(this),this.#o.get()}mutate(t){return this[D].mutate(t)}lens(t){let e=new r({getState:()=>t(this[D].getState()),mutate:o=>this[D].mutate(s=>o(t(s))),registerLens:this[D].registerLens});return this[D].registerLens(e),e}};function uo(r){if(!r.done)throw new Error("wait not done");return ro(r)}function po(r){if(!r.done)throw new Error("wait not done");return oo(r)}var ho=r=>!r.done;var br=r=>r.done&&r.ok;function mo(r,t){let{pending:e=()=>{},ok:o=()=>{},err:s=()=>{}}=t;return ho(r)?e():br(r)?o(uo(r)):s(po(r))}function Js(r){return!!(r.dataTransfer&&r.dataTransfer.types.includes("Files"))}function Zs(r){return r.dataTransfer?Array.from(r.dataTransfer.files):[]}function qt(r){let t=r.currentTarget,e=r.relatedTarget;return!t||!e||!t.contains(e)}var xr=class{params;$draggy=_(void 0);$droppy=_(void 0);constructor(t){this.params=t}get dragging(){return this.$draggy()}get hovering(){return this.$droppy()}dragzone=t=>({draggable:"true",dragstart:e=>{this.$draggy(t())},dragend:e=>{this.$draggy(void 0),this.$droppy(void 0)}});dropzone=t=>({dragenter:e=>{},dragover:e=>{e.preventDefault(),this.$draggy()?this.$droppy(t()):this.params.backchannelDrops?.dragover(e)},dragleave:e=>{qt(e)&&this.$droppy(void 0),this.params.backchannelDrops?.dragleave(e)},drop:e=>{e.preventDefault();let{acceptDrop:o}=this.params,s=this.$draggy(),n=this.$droppy();try{s&&n?o(e,s,n):this.params.backchannelDrops?.drop(e)}finally{this.$draggy(void 0),this.$droppy(void 0)}}})};var wr=class{params;$indicator=_(!1);constructor(t){this.params=t}dragover=t=>{t.preventDefault(),this.$indicator(this.params.predicate(t))};dragleave=t=>{qt(t)&&this.$indicator(!1)};drop=t=>{t.preventDefault(),this.$indicator(!1),this.params.predicate(t)&&this.params.acceptDrop(t)}};var St=x`
4
4
  * {
5
5
  margin: 0;
6
6
  padding: 0;
@@ -14,18 +14,18 @@ var _s=Object.defineProperty;var Cs=(r,t)=>{for(var e in t)_s(r,e,{get:t[e],enum
14
14
  ::-webkit-scrollbar-track { background: transparent; }
15
15
  ::-webkit-scrollbar-thumb { background: #888; border-radius: 1em; }
16
16
  ::-webkit-scrollbar-thumb:hover { background: #999; }
17
- `;var ke=class r extends HTMLElement{static register(){g.register({SlyShadow:r},{soft:!0})}connectedCallback(){this.hasAttribute("view")||this.setAttribute("view","")}};var Wt=class{render;count=0;rendered=nt();constructor(t){this.render=t}doneRender(){this.count++,this.rendered.resolve(),this.rendered=nt()}},F=class extends Wt{host;shadow;constructor(t,e,o){super(t),this.host=e,this.shadow=o}};var wr=class{#t=[];get scope(){let t=this.#t.at(-1);if(!t)throw new Error("hooks must be called within a render fn");return t}increment(){let t=this.scope,e=t.position++;return{scope:t,position:e}}wrap(t,e){t.position=0,this.#t.push(t);try{return e()}finally{this.#t.pop()}}},M=globalThis[Symbol.for("e280.hooks")]??=new wr;var G=class{#t=[];clear(){this.#t.forEach(t=>t()),this.#t=[]}observe(t,e){let{seen:o,value:s}=d.observe(t);this.clear();for(let n of o){let i=d.subscribe(n,e);this.#t.push(i)}return s}};var Se=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 K=class{cx;position=0;values=new Map;mounts=new Se;constructor(t){this.cx=t}};var{I:eu}=Gr;var mo=r=>r.strings===void 0;var fo={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Ft=r=>(...t)=>({_$litDirective$:r,values:t}),Ae=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,o){this._$Ct=t,this._$AM=e,this._$Ci=o}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var Gt=(r,t)=>{let e=r._$AN;if(e===void 0)return!1;for(let o of e)o._$AO?.(t,!1),Gt(o,t);return!0},_e=r=>{let t,e;do{if((t=r._$AM)===void 0)break;e=t._$AN,e.delete(r),r=t}while(e?.size===0)},go=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),Xs(t)}};function Zs(r){this._$AN!==void 0?(_e(this),this._$AM=r,go(this)):this._$AM=r}function Qs(r,t=!1,e=0){let o=this._$AH,s=this._$AN;if(s!==void 0&&s.size!==0)if(t)if(Array.isArray(o))for(let n=e;n<o.length;n++)Gt(o[n],!1),_e(o[n]);else o!=null&&(Gt(o,!1),_e(o));else Gt(this,r)}var Xs=r=>{r.type==fo.CHILD&&(r._$AP??=Qs,r._$AQ??=Zs)},At=class extends Ae{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,o){super._$AT(t,e,o),go(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(Gt(this,t),_e(this))}setValue(t){if(mo(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(){}};function A(r){return Ft(class extends At{#t;#e=new Wt(gt(()=>{if(!this.#t)throw new Error("cannot render before props");if(this.isConnected){let e=this.render(...this.#t);this.setValue(e),this.#e.doneRender()}}));#o=new K(this.#e);#r=new G;update(e,o){let s=super.update(e,o);return this.isConnected&&this.#e.doneRender(),s}render(...e){return this.#t=e,this.#r.observe(()=>M.wrap(this.#o,()=>r(...this.#t)),this.#e.render)}disconnected(){this.#o.mounts.unmountAll(),this.#r.clear()}reconnected(){this.#o.mounts.remountAll(),this.#e.render()}})}function bo(r,t){for(let[e,o]of Object.entries(t))Ys(r,e,o)}function Ys(r,t,e){let o=r.getAttribute(t),s=tn(e);s!==o&&(s===null?r.removeAttribute(t):r.setAttribute(t,s))}function tn(r){return typeof r=="string"?r:typeof r=="number"?r.toString():r?"":null}function en(){ke.register();let r=document.createElement("sly-shadow"),t=r.attachShadow({mode:"open"});return{host:r,shadow:t}}function J(r){return yo(en,r)}J.setup=r=>(t=>yo(r,t));var xo=J;function yo(r,t){let e=Ft(class extends At{#t;#e;#o;#r=new G;constructor(s){super(s);let{host:n,shadow:i}=r(),a=gt(()=>{if(!this.#o)throw new Error("cannot render before props");if(!this.isConnected)return;let c=this.#s(this.#o);x(c,this.#t.shadow),this.#t.doneRender()});this.#t=new F(a,n,i),this.#e=new K(this.#t)}#s(s){return this.#o=s,this.#r.observe(()=>M.wrap(this.#e,()=>t(...this.#o)),this.#t.render)}render({props:s,children:n,attrs:i}){let{host:a}=this.#t;return this.isConnected&&(i&&bo(a,i),x(n,this.#t.host),x(this.#s(s),this.#t.shadow),this.#t.doneRender()),a}disconnected(){x(null,this.#t.shadow),x(null,this.#t.host),this.#e.mounts.unmountAll(),this.#r.clear()}reconnected(){this.#e.mounts.remountAll(),this.#t.render()}});function o(...s){return e({props:s})}return o.with=e,o}function wo(r){return class extends HTMLElement{#t;#e;#o=new G;#r=this.attachShadow({mode:"open"});constructor(){super();let t=gt(()=>{if(!this.isConnected)return;let e=this.#s();x(e,this.#t.shadow),this.#t.doneRender()});this.#t=new F(t,this,this.#r),this.#e=new K(this.#t)}#s(){return this.#o.observe(()=>M.wrap(this.#e,()=>r()),this.#t.render)}render(){x(this.#s(),this.#t.shadow),this.#t.doneRender()}connectedCallback(){this.#e.mounts.remountAll(),this.#t.render()}disconnectedCallback(){this.#e.mounts.unmountAll(),this.#o.clear()}}}function Z(r){return[J(r),(...o)=>wo(()=>r(...o))]}function y(r){let{scope:t,position:e}=M.increment();return yt(t.values,e,r)}function Kt(){return M.increment().scope.cx}function Ce(){let r=Kt();if(!(r instanceof F))throw new Error("this hook only works on shadow views (but was called in a light view)");return r}function Jt(){return Ce().host}function at(r){let{scope:t}=M.increment();return y(()=>t.mounts.mount(r))}function $o(){return Ce().shadow}function ko(r,t){oe(r,on(t))}function on(r){let t=[];if(Array.isArray(r)){let e=new Set(r.flat(1/0).reverse());for(let o of e)t.unshift(pt(o))}else r!==void 0&&t.push(pt(r));return t}function B(...r){let t=$o();y(()=>ko(t,r))}function _t(r=""){let t=Jt();y(()=>t.setAttribute("view",r))}function H(r){return y(()=>S(r))}var Ct=B;function So(r){return at(()=>r)}function j(r,t){return()=>nn({hz:r,frames:t})}var nn=J(({hz:r,frames:t})=>{_t("loading"),Ct(St,an);let e=H(0);return at(()=>wt(async()=>{await $t(1e3/r);let o=e()+1;e(o>=t.length?0:o)})),t.at(e())}),an=b`
17
+ `;var ve=class r extends HTMLElement{static register(){b.register({SlyShadow:r},{soft:!0})}connectedCallback(){this.hasAttribute("view")||this.setAttribute("view","")}};var Wt=class{render;count=0;rendered=it();constructor(t){this.render=t}doneRender(){this.count++,this.rendered.resolve(),this.rendered=it()}},K=class extends Wt{host;shadow;constructor(t,e,o){super(t),this.host=e,this.shadow=o}};var yr=class{#t=[];get scope(){let t=this.#t.at(-1);if(!t)throw new Error("hooks must be called within a render fn");return t}increment(){let t=this.scope,e=t.position++;return{scope:t,position:e}}wrap(t,e){t.position=0,this.#t.push(t);try{return e()}finally{this.#t.pop()}}},P=globalThis[Symbol.for("e280.hooks")]??=new yr;var G=class{#t=[];clear(){this.#t.forEach(t=>t()),this.#t=[]}observe(t,e){let{seen:o,value:s}=m.observe(t);this.clear();for(let n of o){let i=m.subscribe(n,e);this.#t.push(i)}return s}};var $e=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 J=class{cx;position=0;values=new Map;mounts=new $e;constructor(t){this.cx=t}};var{I:su}=Kr;var fo=r=>r.strings===void 0;var go={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Ft=r=>(...t)=>({_$litDirective$:r,values:t}),ke=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,o){this._$Ct=t,this._$AM=e,this._$Ci=o}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var Kt=(r,t)=>{let e=r._$AN;if(e===void 0)return!1;for(let o of e)o._$AO?.(t,!1),Kt(o,t);return!0},Se=r=>{let t,e;do{if((t=r._$AM)===void 0)break;e=t._$AN,e.delete(r),r=t}while(e?.size===0)},bo=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),en(t)}};function Ys(r){this._$AN!==void 0?(Se(this),this._$AM=r,bo(this)):this._$AM=r}function tn(r,t=!1,e=0){let o=this._$AH,s=this._$AN;if(s!==void 0&&s.size!==0)if(t)if(Array.isArray(o))for(let n=e;n<o.length;n++)Kt(o[n],!1),Se(o[n]);else o!=null&&(Kt(o,!1),Se(o));else Kt(this,r)}var en=r=>{r.type==go.CHILD&&(r._$AP??=tn,r._$AQ??=Ys)},At=class extends ke{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,o){super._$AT(t,e,o),bo(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(Kt(this,t),Se(this))}setValue(t){if(fo(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(){}};function C(r){return Ft(class extends At{#t;#e=new Wt(gt(()=>{if(!this.#t)throw new Error("cannot render before props");if(this.isConnected){let e=this.render(...this.#t);this.setValue(e),this.#e.doneRender()}}));#o=new J(this.#e);#r=new G;update(e,o){let s=super.update(e,o);return this.isConnected&&this.#e.doneRender(),s}render(...e){return this.#t=e,this.#r.observe(()=>P.wrap(this.#o,()=>r(...this.#t)),this.#e.render)}disconnected(){this.#o.mounts.unmountAll(),this.#r.clear()}reconnected(){this.#o.mounts.remountAll(),this.#e.render()}})}function xo(r,t){for(let[e,o]of Object.entries(t))rn(r,e,o)}function rn(r,t,e){let o=r.getAttribute(t),s=on(e);s!==o&&(s===null?r.removeAttribute(t):r.setAttribute(t,s))}function on(r){return typeof r=="string"?r:typeof r=="number"?r.toString():r?"":null}function sn(){ve.register();let r=document.createElement("sly-shadow"),t=r.attachShadow({mode:"open"});return{host:r,shadow:t}}function Z(r){return yo(sn,r)}Z.setup=r=>(t=>yo(r,t));var wo=Z;function yo(r,t){let e=Ft(class extends At{#t;#e;#o;#r=new G;constructor(s){super(s);let{host:n,shadow:i}=r(),a=gt(()=>{if(!this.#o)throw new Error("cannot render before props");if(!this.isConnected)return;let c=this.#s(this.#o);w(c,this.#t.shadow),this.#t.doneRender()});this.#t=new K(a,n,i),this.#e=new J(this.#t)}#s(s){return this.#o=s,this.#r.observe(()=>P.wrap(this.#e,()=>t(...this.#o)),this.#t.render)}render({props:s,children:n,attrs:i}){let{host:a}=this.#t;return this.isConnected&&(i&&xo(a,i),w(n,this.#t.host),w(this.#s(s),this.#t.shadow),this.#t.doneRender()),a}disconnected(){w(null,this.#t.shadow),w(null,this.#t.host),this.#e.mounts.unmountAll(),this.#r.clear()}reconnected(){this.#e.mounts.remountAll(),this.#t.render()}});function o(...s){return e({props:s})}return o.with=e,o}function vo(r){return class extends HTMLElement{#t;#e;#o=new G;#r=this.attachShadow({mode:"open"});constructor(){super();let t=gt(()=>{if(!this.isConnected)return;let e=this.#s();w(e,this.#t.shadow),this.#t.doneRender()});this.#t=new K(t,this,this.#r),this.#e=new J(this.#t)}#s(){return this.#o.observe(()=>P.wrap(this.#e,()=>r()),this.#t.render)}render(){w(this.#s(),this.#t.shadow),this.#t.doneRender()}connectedCallback(){this.#e.mounts.remountAll(),this.#t.render()}disconnectedCallback(){this.#e.mounts.unmountAll(),this.#o.clear()}}}function Q(r){return[Z(r),(...o)=>vo(()=>r(...o))]}function y(r){let{scope:t,position:e}=P.increment();return wt(t.values,e,r)}function Gt(){return P.increment().scope.cx}function Ae(){let r=Gt();if(!(r instanceof K))throw new Error("this hook only works on shadow views (but was called in a light view)");return r}function Jt(){return Ae().host}function ct(r){let{scope:t}=P.increment();return y(()=>t.mounts.mount(r))}function ko(){return Ae().shadow}function So(r,t){re(r,an(t))}function an(r){let t=[];if(Array.isArray(r)){let e=new Set(r.flat(1/0).reverse());for(let o of e)t.unshift(pt(o))}else r!==void 0&&t.push(pt(r));return t}function j(...r){let t=ko();y(()=>So(t,r))}function _t(r=""){let t=Jt();y(()=>t.setAttribute("view",r))}function U(r){return y(()=>_(r))}var Ct=j;function Ao(r){return ct(()=>r)}function R(r,t){return()=>ln({hz:r,frames:t})}var ln=Z(({hz:r,frames:t})=>{_t("loading"),Ct(St,un);let e=U(0);return ct(()=>yt(async()=>{await $t(1e3/r);let o=e()+1;e(o>=t.length?0:o)})),t.at(e())}),un=x`
18
18
  :host {
19
19
  font-family: monospace;
20
20
  white-space: pre;
21
21
  user-select: none;
22
22
  }
23
- `;var D=J(r=>(_t("error"),Ct(St,cn),typeof r=="string"?r:r instanceof Error?h`<strong>${r.name}:</strong> <span>${r.message}</span>`:"error")),cn=b`
23
+ `;var L=Z(r=>(_t("error"),Ct(St,pn),typeof r=="string"?r:r instanceof Error?h`<strong>${r.name}:</strong> <span>${r.message}</span>`:"error")),pn=x`
24
24
  :host {
25
25
  font-family: monospace;
26
26
  color: red;
27
27
  }
28
- `;function R(r,t){return(e,o)=>ho(e,{pending:r,err:t,ok:o})}var sd=R(j(10,[" "," ",". ",".. ","..."," .."," ."]),D);var ld=R(j(3,["\u{1F30E}","\u{1F30F}","\u{1F30D}"]),D);var md=R(j(10,["\u{1F312}","\u{1F313}","\u{1F314}","\u{1F315}","\u{1F316}","\u{1F317}","\u{1F318}","\u{1F311}","\u{1F311}","\u{1F311}"]),D);var yd=R(j(16,["|","/","-","\\"]),D);var Sd=R(j(20,[":....",":....","::...",".::..","..::.","...::","....:","....:","...::","..::.",".::..","::..."]),D);var _o=r=>r;var Co=r=>r,Eo=r=>r;var ln=_o({looking:{horizontal:["accumulate","pointer.x"],vertical:["accumulate","pointer.y"]},moving:{forward:"KeyW",backward:"KeyS",leftward:"KeyA",rightward:"KeyD"},interactions:{use:"KeyE"}}),Mo=Eo({standard:{label:"\u2328\uFE0Fstandard",bindings:ln},gamer:{label:"\u{1F3AE}gamer",bindings:{looking:{horizontal:["*",["dt"],"gamepad.axis.3",100],vertical:["*",["dt"],"gamepad.axis.4",100]},moving:{forward:["remap",0,-1,0,1,"gamepad.axis.2"],backward:["remap",0,1,0,1,"gamepad.axis.2"],leftward:["remap",0,-1,0,1,"gamepad.axis.1"],rightward:["remap",0,1,0,1,"gamepad.axis.1"]},interactions:{use:"gamepad.1"}}},micro:{label:"\u{1F9A0}micro",bindings:{looking:{horizontal:["*",["dt"],["+","gamepad.1",["-","gamepad.4"]],100],vertical:["*",["dt"],["+","gamepad.2",["-","gamepad.3"]],100]},moving:{forward:["remap",0,-1,0,1,"gamepad.axis.2"],backward:["remap",0,1,0,1,"gamepad.axis.2"],leftward:["remap",0,-1,0,1,"gamepad.axis.1"],rightward:["remap",0,1,0,1,"gamepad.axis.1"]},interactions:{use:["*","gamepad.5","gamepad.6"]}}}});function Po({start:r,end:t}){if(C(r)&&C(t))return IDBKeyRange.bound(r,t,!1,!0);if(C(r))return IDBKeyRange.lowerBound(r,!1);if(C(t))return IDBKeyRange.upperBound(t,!0)}async function zo(r){return new Promise((t,e)=>{r.onsuccess=()=>t(r.result),r.onerror=()=>e(r.error)})}function Oo({db:r,storeName:t}){let e=o=>(async s=>{let n=r.transaction(t,o),i=n.objectStore(t),a=new Promise((c,l)=>{n.onabort=()=>l(n.error??new Error("transaction aborted")),n.oncomplete=()=>c(void 0)});try{let c=await s(i,zo);return n.commit(),await a,c}catch(c){try{n.abort()}catch{}throw c}});return{readonly:e("readonly"),readwrite:e("readwrite")}}var Ee=class{#t;constructor(t){this.#t=Oo(t)}async commit(t){return this.#t.readwrite(async e=>{for(let[o,s]of t)s===void 0?e.delete(o):e.put(s,o)})}async getMany(t){return this.#t.readonly((e,o)=>Promise.all(t.map(s=>o(e.get(s)))))}async*entries(t={}){t.limit!==0&&(yield*await this.#t.readonly(async(e,o)=>{let s=[],n=t.reverse?"prev":"next",i=e.openCursor(Po(t),n),a=await o(i);for(;a&&(s.push([a.key,a.value]),!(t.limit!==void 0&&s.length>=t.limit));)a.continue(),a=await o(i);return s}))}};var To=(r,t)=>r<t?-1:r>t?1:0;function Bo(r,{start:t,end:e}){return!(t!==void 0&&r<t||e!==void 0&&r>=e)}function*vr(r,t){if(r.limit===0)return;let e=t.filter(([o,s])=>s!==void 0&&Bo(o,r)).sort(([o],[s])=>To(o,s));r.reverse&&e.reverse(),yield*e.slice(0,r.limit??1/0)}var Me=class{#t=new Map;async commit(t){for(let[e,o]of t)o===void 0?this.#t.delete(e):this.#t.set(e,structuredClone(o))}async getMany(t){return t.map(e=>structuredClone(this.#t.get(e)))}async*entries(t={}){yield*vr(t,[...this.#t.entries()].map(([e,o])=>[e,structuredClone(o)]))}};async function jo(r,t=r){return{db:await new Promise((o,s)=>{let n=indexedDB.open(r,1);n.onblocked=()=>s(new Error("idb blocked")),n.onerror=()=>s(n.error),n.onupgradeneeded=()=>n.result.createObjectStore(t),n.onsuccess=()=>o(n.result)}),storeName:t}}var Pe=class{#t;#e;constructor(t,e){this.#t=t,this.#e=e}set(t){return this.#e.set(this.#t,t)}delete(){return this.#e.delete(this.#t)}};var ze=class{kv;key;op;constructor(t,e){this.kv=t,this.key=e,this.op=new Pe(e,t.op)}async set(t){return this.kv.set(this.key,t)}async get(){return this.kv.get(this.key)}async has(){return await this.get()!==void 0}async need(){return k(await this.get(),`key not found "${this.key}"`)}async delete(){return this.kv.set(this.key,void 0)}};var Et=it({divisor:".",delimiter:":",chunkSize:1024});function Zt(r){for(let t=r.length-1;t>=0;t--){let e=r.charCodeAt(t);if(e<65535)return r.slice(0,t)+String.fromCharCode(e+1)}}var Oe=class{#t;#e=[{}];constructor(t,e){if(this.#t=t,e.length){let o=e.join(Et.divisor),s=o+".",n=o+":";this.#e=[{start:n,end:Zt(n)},{start:s,end:Zt(s)}]}}async count(){let t=0;for(let e of this.#e)for await(let o of this.#t.entries(e))t++;return t}async clear(){let t=[];for(let e of this.#e)for await(let[o]of this.#t.entries(e))t.push([o,void 0]),t.length>=1024&&(await this.#t.commit(t),t=[]);t.length&&await this.#t.commit(t)}};var Te=class{#t;constructor(t){this.#t=t}set(t,e){return[this.#t.prefix(t),e]}delete(t){return[this.#t.prefix(t),void 0]}};var{divisor:pn,delimiter:hn}=Et,Be=class{#t;#e;constructor(t){let{scopes:e}=t;this.#t=e.join(pn)+hn,this.#e=Zt(this.#t)}prefix=t=>this.#t+t;unprefix=t=>t.slice(this.#t.length);scan=t=>{let{start:e,end:o,limit:s,reverse:n}=t;return{start:this.#t+(e??""),end:o===void 0?this.#e:this.#t+o,limit:s,reverse:n}}};function Do(r){let t=r.limit;if(t!==void 0){if(!Number.isInteger(t))throw new Error("scan limit must be integer");if(t<0)throw new Error("scan limit must be positive")}return r}function Lo(r){for(let t of r){if(t==="")throw new Error("invalid scope empty string");Ro(t,"."),Ro(t,":")}return r}function Ro(r,t){if(r.includes(t))throw new Error(`invalid scope "${r}" contains illegal "${t}"`)}var je=class r{op;subtree;#t;#e;#o;#r;constructor(t=new Me,e={}){this.#t=t,this.#r={strict:!1,scopes:[],...e},Lo(this.#r.scopes),this.#e=new Be(this.#r),this.op=new Te(this.#e),this.subtree=new Oe(this.#t,this.#r.scopes),this.#o=this.#r.strict?o=>JSON.parse(JSON.stringify(o)):o=>o}cell(t){return new ze(this,t)}scope(...t){return new r(this.#t,{...this.#r,scopes:[...this.#r.scopes,...t]})}async commit(t){await this.#t.commit(t.map(([e,o])=>[e,o===void 0?void 0:this.#o(o)]))}async set(t,e){return this.commit([this.op.set(t,e)])}async setMany(t){return this.commit(t.map(([e,o])=>this.op.set(e,o)))}async delete(...t){return this.commit(t.map(e=>this.op.delete(e)))}async getMany(t){return t=t.map(e=>this.#e.prefix(e)),(await this.#t.getMany(t)).map(e=>e===void 0?void 0:e)}async get(t){let[e]=await this.getMany([t]);return e}async has(t){return await this.get(t)!==void 0}async need(t){return k(await this.get(t),`key not found "${t}"`)}async needMany(t){let e=await this.getMany(t);for(let[o,s]of t.entries())k(e[o],`key not found "${s}"`);return e}async*entries(t={}){t=Do(this.#e.scan(t));for await(let[e,o]of this.#t.entries(t)){let s=this.#e.unprefix(e);o!==void 0&&(yield[s,o])}}[Symbol.asyncIterator](){return this.entries()}async*keys(t={}){for await(let[e]of this.entries(t))yield e}async*values(t={}){for await(let[,e]of this.entries(t))yield e}async count(t={}){let e=0;for await(let o of this.keys(t))e++;return e}async clear(t={}){let e=[];for await(let[o]of this.entries(t))e.push(this.op.delete(o)),e.length>=Et.chunkSize&&(await this.commit(e),e=[]);e.length&&await this.commit(e)}};function No(r){let e=r.reduce((a,{intents:c})=>a+8+c.byteLength,0),o=new ArrayBuffer(e),s=new DataView(o),n=new Uint8Array(o),i=0;for(let{playerId:a,intents:c}of r)s.setUint32(i,a,!1),i+=4,s.setUint32(i,c.byteLength,!1),i+=4,n.set(new Uint8Array(c),i),i+=c.byteLength;return o}function Re(r,t){let e=4+t.length*6,o=new ArrayBuffer(e),s=new DataView(o),n=0;s.setUint32(n,r,!1),n+=4;for(let i of t)s.setUint16(n,i.id,!1),n+=2,s.setFloat32(n,i.value,!1),n+=4;return o}function ct(r){return!!(r===null||xt(r)||bt(r)||be(r))}function V(r){let t=[];function e(o,s){if(ct(o))t.push(s.join("."));else for(let[n,i]of Object.entries(o))e(i,[...s,n])}return e(r,["b"]),so(...t)}var Le=class{bindings;#t;#e=new vt;#o=new Vt;#r=new O;constructor(t){this.bindings=t,this.#t=V(t)}get playerIds(){return[...this.#r.keys()]}get controllers(){return{unassigned:[...this.#o],assigned:new Map([...this.#r].map(([t,e])=>[t,[...e.controllers]]))}}createPlayer(){let t=this.#e.next();return this.#r.set(t,{controllers:new Vt}),t}deletePlayer(t){return this.#r.get(t)?.controllers.forEach(e=>this.#o.add(e)),this.#r.delete(t),this}add(t){return this.unplug(t),this}remove(t){return this.unplug(t),this.#o.delete(t),this}unplug(t){this.#o.add(t);for(let e of this.#r.values())e.controllers.delete(t);return this}plug(t,e){return e??=this.playerIds.at(-1)??this.createPlayer(),this.unplug(t),k(this.#r.get(e)).controllers.add(t),this.#o.delete(t),this}encode(t,e=performance.now()){let o=new Map,{controllers:s}=k(this.#r.get(t));for(let i of s)for(let a of i.evaluate(e)){let c=o.get(a.id)??0;o.set(a.id,c+a.value)}let n=[...o].filter(([,i])=>i!==0).map(([i,a])=>({id:i,value:a}));return Re(this.#t,n)}encodeAll(t=performance.now()){for(let o of this.#o)o.clear();let e=Array.from(this.#r.keys()).map(o=>({playerId:o,intents:this.encode(o,t)}));return No(e)}};function $r(r,t){let{presets:e,customs:o,fallback:s}=r.profiles;return t===void 0?s.profile:o.get(t)??e.get(t)??k(e.get(s.key))}async function Ne(r,t,e){let{kvs:o,controllers:s,assignments:n}=r;t.bindings=$r(r,e).bindings,n.set(t,e),await ye(s.get(t)?.handle,async i=>{r.preferences.set(i,e),await o.preferences.set(i,e)})}function Io(r,t){return V(r)===V(t)}var Ie=class{#t;constructor(t){this.#t=t}#e(t){if(!Io(t,this.#t.bindings))throw new Error("incompatible bindings")}get presets(){return[...this.#t.profiles.presets]}get customs(){return[...this.#t.profiles.customs]}isPreset(t){return this.#t.profiles.presets.has(t)}get(t){return $r(this.#t,t)}async create(t,e){let{kvs:o,profiles:s}=this.#t;this.#e(e.bindings),s.customs.set(t,e),await o.profiles.set(t,e),this.#t.subby.publish()}async clone(t,e){let{label:o,bindings:s}=this.get(e);await this.create(t,{basedOn:e,bindings:s,label:`${o} copy`})}async delete(t){let{kvs:e,assignments:o,profiles:{customs:s,fallback:n}}=this.#t;s.delete(t),await e.profiles.delete(t);for(let[i,a]of o)a===t&&await Ne(this.#t,i,n.key);this.#t.subby.publish()}async update(t,e){let{kvs:o,assignments:s,profiles:{customs:n}}=this.#t;e.bindings&&this.#e(e.bindings);let i=this.get(t),a={...structuredClone(i),...e};n.set(t,a);for(let[c,l]of s)l===t&&(c.bindings=a.bindings);await o.profiles.set(t,a),this.#t.subby.publish()}};function Ho(r){let{presets:t}=r,e=k(Object.keys(t)[0],"missing presets"),o=k(t[e]),s=o.bindings,n=r.kv.scope(V(s).toString()),i={presets:new O,customs:new O,fallback:{key:e,profile:o}};return Ht(i.presets,Object.entries(t)),{subby:q(),kv:n,presets:t,bindings:s,idCounter:new vt,profiles:i,controllers:new O,assignments:new O,preferences:new O,kvs:{profiles:n.scope("profiles"),preferences:n.scope("preferences")}}}var He=class{#t;constructor(t){this.#t=t}async assign(t,e){await Ne(this.#t,t,e),this.#t.subby.publish()}assignedProfileKeyOf(t){let{assignments:e}=this.#t;return e.get(t)??this.#t.profiles.fallback.key}};var Ve=class{#t;profiles;assignments;presets;constructor(t){this.#t=Ho(t),this.profiles=new Ie(this.#t),this.assignments=new He(this.#t),this.presets=t.presets}get on(){return this.#t.subby.on}#e(t){let{preferences:e,assignments:o,controllers:s}=this.#t,n=k(s.get(t)),i=o.get(t)??e.get(n.handle)??n.defaultProfileKey;t.bindings=this.profiles.get(i).bindings,o.set(t,i)}async load(){let{kvs:t,controllers:e,preferences:o,profiles:{customs:s}}=this.#t;s.clear(),Ht(s,await mr(t.profiles)),o.clear(),Ht(o,await mr(t.preferences));for(let n of e.keys())this.#e(n)}get controllers(){return[...this.#t.controllers.keys()]}get fallbackProfileKey(){return this.#t.profiles.fallback.key}meta(t){return this.#t.controllers.get(t)}attach(t,e){let o=this.#t.idCounter.next();this.#t.controllers.set(t,{...e,id:o}),this.#e(t)}detach(t){this.#t.controllers.delete(t),this.#t.assignments.delete(t)}};function Qt(r){let[t,e]=Object.entries(r)[0];return{key:t,profile:e}}async function Vo(r){let t=r.kv??new je(new Ee(await jo("tact","kv"))),e=r.broadcastChannel??new BroadcastChannel("tact"),{maxPlayers:o}=r,{bindings:s}=Qt(r.presets).profile,n=new Le(s),i=new Ve({...r,kv:t});return await i.load(),e.onmessage=()=>i.load(),i.on(()=>e.postMessage({})),Co({hub:n,controls:i,maxPlayers:o})}var kr=1024,Ue=class{dispose;#t;#e=[];constructor(t){this.#t=t,this.dispose=t.onSample(e=>{this.#e.push(e),this.#e.length>kr&&console.warn(`tact sampler exceeded limit ${kr}`),this.#e=xe(this.#e,kr)})}take(){this.#t.poll?.();let t=this.#e;return this.#e=[],t}};var{min:mn,max:fn,abs:gn,sign:bn,floor:Uf,ceil:qf,pow:Wf}=Math;function lt(r,t=0,e=1){return r=mn(r,e),r=fn(r,t),r}function xn(r,t,e,o){let n=(e-t)*r;return o!==void 0&&gn(n)>o&&(n=bn(n)*o),t+n}function yn(r,t,e){return(r-t)/(e-t)}function Uo(r,t,e,o=0,s=1,n=!1){let i=yn(r,t,e);return n&&(i=lt(i)),xn(i,o,s)}var qe=class r{x;y;constructor(t=0,e=0){this.x=t,this.y=e}static new(t=0,e=0){return new this(t,e)}static zero(){return new this}static fill(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 new this().add(...t).divBy(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 rotation(t){return new this(Math.cos(t),Math.sin(t))}dup(){return new this.constructor(this.x,this.y)}*[Symbol.iterator](){yield this.x,yield this.y}array(){return[this.x,this.y]}toJSON(){return this.array()}toString(){return`(${this.constructor.name} x${this.x.toFixed(2)}, y${this.y.toFixed(2)})`}fill(t){return this.x=t,this.y=t,this}zero(){return this.fill(0)}set_(t,e){return this.x=t,this.y=e,this}set({x:t,y:e}){return this.x=t,this.y=e,this}from(t){if(Array.isArray(t)){let[e,o]=t;this.x=e,this.y=o}else{let{x:e,y:o}=t;this.x=e,this.y=o}return 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:o})=>this.equals_(e,o))}near_(t,e,o=1e-6){return Math.abs(this.x-t)<=o&&Math.abs(this.y-e)<=o}near({x:t,y:e},o=1e-6){return this.near_(t,e,o)}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 o=this.dot_(t,e),s=this.magnitude()*r.magnitude(t,e);if(s===0)return 0;let n=lt(o/s,-1,1);return Math.acos(n)}angleBetween({x:t,y:e}){return this.angleBetween_(t,e)}normalize(){return this.divBy(this.magnitude())}half(){return this.divBy(2)}double(){return this.mulBy(2)}abs(){return this.map(t=>Math.abs(t))}rotate(t){let{x:e,y:o}=this;return this.x=e*Math.cos(t)-o*Math.sin(t),this.y=e*Math.sin(t)+o*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().mulBy(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=lt(this.x,t.x,e.x),this.y=lt(this.y,t.y,e.y),this}clampBy(t=0,e=1){return this.x=lt(this.x,t,e),this.y=lt(this.y,t,e),this}negate(){return this.map(t=>t*-1)}addBy(t){return this.x+=t,this.y+=t,this}subBy(t){return this.x-=t,this.y-=t,this}mulBy(t){return this.x*=t,this.y*=t,this}scale(t){return this.x*=t,this.y*=t,this}divBy(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:o}of t)this.add_(e,o);return this}sub_(t,e){return this.x-=t,this.y-=e,this}sub(...t){for(let{x:e,y:o}of t)this.sub_(e,o);return this}mul_(t,e){return this.x*=t,this.y*=e,this}mul(...t){for(let{x:e,y:o}of t)this.mul_(e,o);return this}div_(t,e){return t!==0&&(this.x/=t),e!==0&&(this.y/=e),this}div(...t){for(let{x:e,y:o}of t)this.div_(e,o);return this}lerp_(t,e,o){return this.x+=(t-this.x)*o,this.y+=(e-this.y)*o,this}lerp(t,{x:e,y:o}){return this.lerp_(t,e,o)}reflect_(t,e){let o=2*this.dot_(t,e);return this.x-=o*t,this.y-=o*e,this}reflect({x:t,y:e}){return this.reflect_(t,e)}rotateAroundPoint_(t,e,o){let s=this.x-e,n=this.y-o,i=Math.cos(t),a=Math.sin(t);return this.x=i*s-a*n+e,this.y=a*s+i*n+o,this}rotateAroundPoint(t,{x:e,y:o}){return this.rotateAroundPoint_(t,e,o)}};function ut(r){return r!==0}function Sr(r,t){let e=o=>Sr(r,o);if(t===null)return 0;if(bt(t))return t;if(xt(t)){let o=r.latestValues.get(t)??0;return r.recentSamples.filter(s=>s.code===t).reduce((s,n)=>Math.abs(n.value)>Math.abs(s)?n.value:s,o)}else switch(t[0]){case"accumulate":{let o=t[1],s=0;for(let n of r.recentSamples)n.code===o&&(s+=n.value);return s}case"up":{let o=t[1],s=0,n=r.previousValues.get(o)??0;for(let i of r.recentSamples)i.code===o&&(ut(n)&&!ut(i.value)&&s++,n=i.value);return s}case"down":{let o=t[1],s=0,n=r.previousValues.get(o)??0;for(let i of r.recentSamples)i.code===o&&(!ut(n)&&ut(i.value)&&s++,n=i.value);return s}case"was":{let o=t[1];return r.previousValues.get(o)??0}case"since":{let o=t[1],s=r.previousValues.get(o)??0;return(r.latestValues.get(o)??0)-s}case"if":{let[,o,s,n]=t;return e(o)?e(s):C(n)?e(n):0}case"min":return Math.min(...t.slice(1).map(e));case"max":return Math.max(...t.slice(1).map(e));case"+":return t.slice(1).map(e).reduce((o,s)=>o+s,0);case"*":return t.slice(1).map(e).reduce((o,s)=>o*s,1);case"==":return+(e(t[1])===e(t[2]));case"!=":return+(e(t[1])!==e(t[2]));case">":return+(e(t[1])>e(t[2]));case"<":return+(e(t[1])<e(t[2]));case">=":return+(e(t[1])>=e(t[2]));case"<=":return+(e(t[1])<=e(t[2]));case"!":return+(e(t[1])===0);case"!!":return+(e(t[1])!==0);case"-":{let[,o,...s]=t;if(s.length===0)return-e(o);let n=e(o);for(let i of s)n-=e(i);return n}case"clamp":{let[,o,s,n]=t,i=e(n);return Math.min(s===null?1/0:e(s),Math.max(o===null?-1/0:e(o),i))}case"remap":{let[o,s,n,i,a]=t.slice(1).map(e);return Uo(a,o,s,n,i)}case"dt":return r.dt;case"held":{let[,o,s]=t,n=ut(e(s)),i=r.holding.get(t);return n&&!i&&(i={start:r.clock.time},r.holding.set(t,i)),!n&&i&&(i=void 0,r.holding.delete(t)),i&&r.clock.time-i.start>=o?1:0}case"taps":{let[,o,s,n]=t,i=e(n),a=r.clock.time,c=yt(r.tapping,t,()=>({events:[]}));for(let l=0;l<i;l++)c.events.push(a);return c.events=xe(c.events.filter(l=>l>=a-s),128),c.events.length>=o?(c.events=[],1):0}case"mod":{let[,...o]=t,s=l=>ut(r.latestValues.get(l)??0),n=s("ShiftLeft")||s("ShiftRight"),i=s("ControlLeft")||s("ControlRight"),a=s("AltLeft")||s("AltRight"),c=s("MetaLeft")||s("MetaRight");return o.includes("shift")!==n||o.includes("ctrl")!==i||o.includes("alt")!==a||o.includes("meta")!==c?0:1}default:throw new Error("unknown expression")}}var We=class{time;since=0;last;constructor(t=performance.now()){this.time=t}update(t=performance.now()){this.since=t-(this.time??t),this.last=this.time,this.time=t}};var Fe=class{dt=0;clock=new We;recentSamples=[];latestValues=new Map;previousValues=new Map;holding=new Map;tapping=new Map};function qo(){return{value:0,was:0,sum:0}}function Ar(r){let t=V(r),e=[],o=[];function s(i){if(ct(i)){let a=qo();return e.push(a),o.push(i),a}else return fr(i,s)}let n=s(r);return{hash:t,inputs:n,inputList:e,rootList:o}}var Mt=class{#t;#e;#o;#r;constructor(t){this.#e=it(structuredClone(t.bindings)),this.#o=Ar(this.#e),this.#t=new Ue(t.source),this.#r=new Fe}get bindings(){return this.#e}set bindings(t){let e=it(structuredClone(t)),o=Ar(e),s=this.#o.hash;if(o.hash!==s)throw new Error("incompatible bindings");this.#e=e,this.#o.rootList=o.rootList}*evaluate(t=performance.now()){let e=this.#t.take();this.#r.clock.update(t),this.#r.recentSamples=e,this.#r.dt=this.#r.clock.since/1e3;for(let{code:o,value:s}of e)this.#r.latestValues.set(o,s);for(let[o,s]of this.#o.rootList.entries()){let n=Sr(this.#r,s);n!==0&&(yield{id:o,value:n})}for(let{code:o,value:s}of e)this.#r.previousValues.set(o,s)}encode(t=performance.now()){return Re(this.#o.hash,[...this.evaluate(t)])}clear(){this.#t.take()}dispose(){return this.#t.dispose()}};var Ge=class{get;constructor(t){this.get=t}get gamepad(){return this.get()}};function Wo(r,t){let e=r;return()=>{let o=t();return o!=null&&(e=o),e}}function Ke(r){let t=new Map;function e(){o(),s()}function o(){for(let i of navigator.getGamepads())if(i?.connected&&!t.has(i.index)){let a=()=>navigator.getGamepads()[i.index],c=new Ge(Wo(i,a)),l=r(c);t.set(i.index,{pad:c,dispose:l})}}function s(){for(let[i,{pad:a,dispose:c}]of t)navigator.getGamepads()[a.gamepad.index]?.connected||(c(),t.delete(i))}e();let n=E(window,{gamepadconnected:e,gamepaddisconnected:e});return()=>{n();for(let{dispose:i}of t.values())i();t.clear()}}var L=class{onSample=q();dispose=U()};var Pt=class extends L{pad;#t=new Map;constructor(t){super(),this.pad=t}get gamepad(){return this.pad.gamepad}poll(){let t=this.gamepad;this.#o(t),this.#r(t)}#e(t,e){let o=this.#t.get(t)??0;e!==o&&(this.#t.set(t,e),this.onSample.publish({code:t,value:e}))}#o(t){let e=0;for(let[o,s]of t.buttons.entries()){let n=s.value;this.#e(`gamepad.${o+1}`,n),e=Math.max(e,n)}this.#e("gamepad.any",e>=.9?1:0)}#r(t){for(let[e,o]of t.axes.entries())this.#e(`gamepad.axis.${e+1}`,o)}};function Fo(r,t){return Ke(e=>{let o=new Pt(e),s=new Mt({source:o,bindings:r.bindings});r.plug(s);let n=t?.(s,o);return()=>{r.remove(s),n?.()}})}function Go(r,t){return r.length>t?r.slice(0,t)+"...":r}var Je=class extends L{#t;constructor(...t){super(),this.#t=t;for(let e of t)this.dispose.schedule(e.onSample(o=>this.onSample.publish(o)))}poll(){for(let t of this.#t)t.poll?.()}};var Ze=class{$hex=S("");clear=to(250,()=>{this.$hex.set("")});update(t){this.$hex(ge(new Uint8Array(t))),this.clear()}};function zt(r){return`pointer.${r+1}`}var Qe=class extends L{client=new qe;constructor(t=window){super(),this.dispose.schedule(E(t,this.#t))}#t={pointerdown:t=>{this.onSample.publish({code:zt(t.button),value:1})},pointerup:t=>{this.onSample.publish({code:zt(t.button),value:0})},pointermove:({clientX:t,clientY:e,movementX:o,movementY:s})=>{this.client.set_(t,e),o&&this.onSample.publish({code:"pointer.x",value:o}),s&&this.onSample.publish({code:"pointer.y",value:s})},wheel:({deltaX:t,deltaY:e})=>{t&&this.onSample.publish({code:"pointer.wheel.x",value:t}),e&&this.onSample.publish({code:"pointer.wheel.y",value:e})}}};var Xe=class extends L{#t=new Set;constructor(t=window){super(),this.dispose.schedule(E(t,this.#e)),this.dispose.schedule(E(window,this.#o))}#e={keydown:t=>{t.repeat||(this.#t.size===0&&this.onSample.publish({code:"keyboard.any",value:1}),this.onSample.publish({code:t.code,value:1}),this.#t.add(t.code))},keyup:t=>{this.onSample.publish({code:t.code,value:0}),this.#t.delete(t.code),this.#t.size===0&&this.onSample.publish({code:"keyboard.any",value:0})}};#o={blur:()=>{for(let t of this.#t)this.onSample.publish({code:t,value:0});this.#t.size&&this.onSample.publish({code:"keyboard.any",value:0}),this.#t.clear()}}};var Ko=W`@layer core {
28
+ `;function N(r,t){return(e,o)=>mo(e,{pending:r,err:t,ok:o})}var ad=N(R(10,[" "," ",". ",".. ","..."," .."," ."]),L);var hd=N(R(3,["\u{1F30E}","\u{1F30F}","\u{1F30D}"]),L);var bd=N(R(10,["\u{1F312}","\u{1F313}","\u{1F314}","\u{1F315}","\u{1F316}","\u{1F317}","\u{1F318}","\u{1F311}","\u{1F311}","\u{1F311}"]),L);var $d=N(R(16,["|","/","-","\\"]),L);var Cd=N(R(20,[":....",":....","::...",".::..","..::.","...::","....:","....:","...::","..::.",".::..","::..."]),L);var Co=r=>r;var Eo=r=>r,Mo=r=>r;var hn=Co({looking:{horizontal:["accumulate","pointer.x"],vertical:["accumulate","pointer.y"]},moving:{forward:"KeyW",backward:"KeyS",leftward:"KeyA",rightward:"KeyD"},interactions:{use:"KeyE"}}),Po=Mo({standard:{label:"\u2328\uFE0Fstandard",bindings:hn},gamer:{label:"\u{1F3AE}gamer",bindings:{looking:{horizontal:["*",["dt"],"gamepad.axis.3",100],vertical:["*",["dt"],"gamepad.axis.4",100]},moving:{forward:["remap",0,-1,0,1,"gamepad.axis.2"],backward:["remap",0,1,0,1,"gamepad.axis.2"],leftward:["remap",0,-1,0,1,"gamepad.axis.1"],rightward:["remap",0,1,0,1,"gamepad.axis.1"]},interactions:{use:"gamepad.1"}}},micro:{label:"\u{1F9A0}micro",bindings:{looking:{horizontal:["*",["dt"],["+","gamepad.1",["-","gamepad.4"]],100],vertical:["*",["dt"],["+","gamepad.2",["-","gamepad.3"]],100]},moving:{forward:["remap",0,-1,0,1,"gamepad.axis.2"],backward:["remap",0,1,0,1,"gamepad.axis.2"],leftward:["remap",0,-1,0,1,"gamepad.axis.1"],rightward:["remap",0,1,0,1,"gamepad.axis.1"]},interactions:{use:["*","gamepad.5","gamepad.6"]}}}});function zo(r){let e=r.reduce((a,{intents:c})=>a+8+c.byteLength,0),o=new ArrayBuffer(e),s=new DataView(o),n=new Uint8Array(o),i=0;for(let{playerId:a,intents:c}of r)s.setUint32(i,a,!1),i+=4,s.setUint32(i,c.byteLength,!1),i+=4,n.set(new Uint8Array(c),i),i+=c.byteLength;return o}function Ce(r,t){let e=4+t.length*6,o=new ArrayBuffer(e),s=new DataView(o),n=0;s.setUint32(n,r,!1),n+=4;for(let i of t)s.setUint16(n,i.id,!1),n+=2,s.setFloat32(n,i.value,!1),n+=4;return o}function lt(r){return!!(r===null||xt(r)||bt(r)||ge(r))}function q(r){let t=[];function e(o,s){if(lt(o))t.push(s.join("."));else for(let[n,i]of Object.entries(o))e(i,[...s,n])}return e(r,["b"]),so(...t)}var Ee=class{bindings;#t;#e=new vt;#o=new Vt;#r=new B;constructor(t){this.bindings=t,this.#t=q(t)}get playerIds(){return[...this.#r.keys()]}get controllers(){return{unassigned:[...this.#o],assigned:new Map([...this.#r].map(([t,e])=>[t,[...e.controllers]]))}}createPlayer(){let t=this.#e.next();return this.#r.set(t,{controllers:new Vt}),t}deletePlayer(t){return this.#r.get(t)?.controllers.forEach(e=>this.#o.add(e)),this.#r.delete(t),this}add(t){return this.unplug(t),this}remove(t){return this.unplug(t),this.#o.delete(t),this}unplug(t){this.#o.add(t);for(let e of this.#r.values())e.controllers.delete(t);return this}plug(t,e){return e??=this.playerIds.at(-1)??this.createPlayer(),this.unplug(t),S(this.#r.get(e)).controllers.add(t),this.#o.delete(t),this}encode(t,e=performance.now()){let o=new Map,{controllers:s}=S(this.#r.get(t));for(let i of s)for(let a of i.evaluate(e)){let c=o.get(a.id)??0;o.set(a.id,c+a.value)}let n=[...o].filter(([,i])=>i!==0).map(([i,a])=>({id:i,value:a}));return Ce(this.#t,n)}encodeAll(t=performance.now()){for(let o of this.#o)o.clear();let e=Array.from(this.#r.keys()).map(o=>({playerId:o,intents:this.encode(o,t)}));return zo(e)}};function Oo({start:r,end:t}){if(E(r)&&E(t))return IDBKeyRange.bound(r,t,!1,!0);if(E(r))return IDBKeyRange.lowerBound(r,!1);if(E(t))return IDBKeyRange.upperBound(t,!0)}async function To(r){return new Promise((t,e)=>{r.onsuccess=()=>t(r.result),r.onerror=()=>e(r.error)})}function Bo({db:r,storeName:t}){let e=o=>(async s=>{let n=r.transaction(t,o),i=n.objectStore(t),a=new Promise((c,l)=>{n.onabort=()=>l(n.error??new Error("transaction aborted")),n.oncomplete=()=>c(void 0)});try{let c=await s(i,To);return n.commit(),await a,c}catch(c){try{n.abort()}catch{}throw c}});return{readonly:e("readonly"),readwrite:e("readwrite")}}var Me=class{#t;constructor(t){this.#t=Bo(t)}async commit(t){return this.#t.readwrite(async e=>{for(let[o,s]of t)s===void 0?e.delete(o):e.put(s,o)})}async getMany(t){return this.#t.readonly((e,o)=>Promise.all(t.map(s=>o(e.get(s)))))}async*entries(t={}){t.limit!==0&&(yield*await this.#t.readonly(async(e,o)=>{let s=[],n=t.reverse?"prev":"next",i=e.openCursor(Oo(t),n),a=await o(i);for(;a&&(s.push([a.key,a.value]),!(t.limit!==void 0&&s.length>=t.limit));)a.continue(),a=await o(i);return s}))}};var Do=(r,t)=>r<t?-1:r>t?1:0;function jo(r,{start:t,end:e}){return!(t!==void 0&&r<t||e!==void 0&&r>=e)}function*vr(r,t){if(r.limit===0)return;let e=t.filter(([o,s])=>s!==void 0&&jo(o,r)).sort(([o],[s])=>Do(o,s));r.reverse&&e.reverse(),yield*e.slice(0,r.limit??1/0)}var Pe=class{#t=new Map;async commit(t){for(let[e,o]of t)o===void 0?this.#t.delete(e):this.#t.set(e,structuredClone(o))}async getMany(t){return t.map(e=>structuredClone(this.#t.get(e)))}async*entries(t={}){yield*vr(t,[...this.#t.entries()].map(([e,o])=>[e,structuredClone(o)]))}};async function Ro(r,t=r){return{db:await new Promise((o,s)=>{let n=indexedDB.open(r,1);n.onblocked=()=>s(new Error("idb blocked")),n.onerror=()=>s(n.error),n.onupgradeneeded=()=>n.result.createObjectStore(t),n.onsuccess=()=>o(n.result)}),storeName:t}}var ze=class{#t;#e;constructor(t,e){this.#t=t,this.#e=e}set(t){return this.#e.set(this.#t,t)}delete(){return this.#e.delete(this.#t)}};var Oe=class{kv;key;op;constructor(t,e){this.kv=t,this.key=e,this.op=new ze(e,t.op)}async set(t){return this.kv.set(this.key,t)}async get(){return this.kv.get(this.key)}async has(){return await this.get()!==void 0}async need(){return S(await this.get(),`key not found "${this.key}"`)}async delete(){return this.kv.set(this.key,void 0)}};var Et=at({divisor:".",delimiter:":",chunkSize:1024});function Zt(r){for(let t=r.length-1;t>=0;t--){let e=r.charCodeAt(t);if(e<65535)return r.slice(0,t)+String.fromCharCode(e+1)}}var Te=class{#t;#e=[{}];constructor(t,e){if(this.#t=t,e.length){let o=e.join(Et.divisor),s=o+".",n=o+":";this.#e=[{start:n,end:Zt(n)},{start:s,end:Zt(s)}]}}async count(){let t=0;for(let e of this.#e)for await(let o of this.#t.entries(e))t++;return t}async clear(){let t=[];for(let e of this.#e)for await(let[o]of this.#t.entries(e))t.push([o,void 0]),t.length>=1024&&(await this.#t.commit(t),t=[]);t.length&&await this.#t.commit(t)}};var Be=class{#t;constructor(t){this.#t=t}set(t,e){return[this.#t.prefix(t),e]}delete(t){return[this.#t.prefix(t),void 0]}};var{divisor:fn,delimiter:gn}=Et,De=class{#t;#e;constructor(t){let{scopes:e}=t;this.#t=e.join(fn)+gn,this.#e=Zt(this.#t)}prefix=t=>this.#t+t;unprefix=t=>t.slice(this.#t.length);scan=t=>{let{start:e,end:o,limit:s,reverse:n}=t;return{start:this.#t+(e??""),end:o===void 0?this.#e:this.#t+o,limit:s,reverse:n}}};function Lo(r){let t=r.limit;if(t!==void 0){if(!Number.isInteger(t))throw new Error("scan limit must be integer");if(t<0)throw new Error("scan limit must be positive")}return r}function Io(r){for(let t of r){if(t==="")throw new Error("invalid scope empty string");No(t,"."),No(t,":")}return r}function No(r,t){if(r.includes(t))throw new Error(`invalid scope "${r}" contains illegal "${t}"`)}var je=class r{op;subtree;#t;#e;#o;#r;constructor(t=new Pe,e={}){this.#t=t,this.#r={strict:!1,scopes:[],...e},Io(this.#r.scopes),this.#e=new De(this.#r),this.op=new Be(this.#e),this.subtree=new Te(this.#t,this.#r.scopes),this.#o=this.#r.strict?o=>JSON.parse(JSON.stringify(o)):o=>o}cell(t){return new Oe(this,t)}scope(...t){return new r(this.#t,{...this.#r,scopes:[...this.#r.scopes,...t]})}async commit(t){await this.#t.commit(t.map(([e,o])=>[e,o===void 0?void 0:this.#o(o)]))}async set(t,e){return this.commit([this.op.set(t,e)])}async setMany(t){return this.commit(t.map(([e,o])=>this.op.set(e,o)))}async delete(...t){return this.commit(t.map(e=>this.op.delete(e)))}async getMany(t){return t=t.map(e=>this.#e.prefix(e)),(await this.#t.getMany(t)).map(e=>e===void 0?void 0:e)}async get(t){let[e]=await this.getMany([t]);return e}async has(t){return await this.get(t)!==void 0}async need(t){return S(await this.get(t),`key not found "${t}"`)}async needMany(t){let e=await this.getMany(t);for(let[o,s]of t.entries())S(e[o],`key not found "${s}"`);return e}async*entries(t={}){t=Lo(this.#e.scan(t));for await(let[e,o]of this.#t.entries(t)){let s=this.#e.unprefix(e);o!==void 0&&(yield[s,o])}}[Symbol.asyncIterator](){return this.entries()}async*keys(t={}){for await(let[e]of this.entries(t))yield e}async*values(t={}){for await(let[,e]of this.entries(t))yield e}async count(t={}){let e=0;for await(let o of this.keys(t))e++;return e}async clear(t={}){let e=[];for await(let[o]of this.entries(t))e.push(this.op.delete(o)),e.length>=Et.chunkSize&&(await this.commit(e),e=[]);e.length&&await this.commit(e)}};async function Ho(r,t){let e=()=>{};if(!t){let o=await Ro(r,"kv"),s=new Me(o);t=new je(s),e=()=>o.db.close()}return{kv:t,dispose:e}}function $r(r,t){let{presets:e,customs:o,fallback:s}=r.profiles;return t===void 0?s.profile:o.get(t)??e.get(t)??S(e.get(s.key))}async function Re(r,t,e){let{kvs:o,controllers:s,assignments:n}=r;t.bindings=$r(r,e).bindings,n.set(t,e),await be(s.get(t)?.handle,async i=>{r.preferences.set(i,e),await o.preferences.set(i,e)})}function Vo(r,t){return q(r)===q(t)}var Le=class{#t;constructor(t){this.#t=t}#e(t){if(!Vo(t,this.#t.bindings))throw new Error("incompatible bindings")}get presets(){return[...this.#t.profiles.presets]}get customs(){return[...this.#t.profiles.customs]}isPreset(t){return this.#t.profiles.presets.has(t)}get(t){return $r(this.#t,t)}async create(t,e){let{kvs:o,profiles:s}=this.#t;this.#e(e.bindings),s.customs.set(t,e),await o.profiles.set(t,e),this.#t.subby.publish()}async clone(t,e){let{label:o,bindings:s}=this.get(e);await this.create(t,{basedOn:e,bindings:s,label:`${o} copy`})}async delete(t){let{kvs:e,assignments:o,profiles:{customs:s,fallback:n}}=this.#t;s.delete(t),await e.profiles.delete(t);for(let[i,a]of o)a===t&&await Re(this.#t,i,n.key);this.#t.subby.publish()}async update(t,e){let{kvs:o,assignments:s,profiles:{customs:n}}=this.#t;e.bindings&&this.#e(e.bindings);let i=this.get(t),a={...structuredClone(i),...e};n.set(t,a);for(let[c,l]of s)l===t&&(c.bindings=a.bindings);await o.profiles.set(t,a),this.#t.subby.publish()}};function Uo(r){let{presets:t}=r,e=S(Object.keys(t)[0],"missing presets"),o=S(t[e]),s=o.bindings,n=r.kv.scope(q(s).toString()),i={presets:new B,customs:new B,fallback:{key:e,profile:o}};return Ht(i.presets,Object.entries(t)),{subby:W(),kv:n,presets:t,bindings:s,idCounter:new vt,profiles:i,controllers:new B,assignments:new B,preferences:new B,kvs:{profiles:n.scope("profiles"),preferences:n.scope("preferences")}}}var Ne=class{#t;constructor(t){this.#t=t}async assign(t,e){await Re(this.#t,t,e),this.#t.subby.publish()}assignedProfileKeyOf(t){let{assignments:e}=this.#t;return e.get(t)??this.#t.profiles.fallback.key}};var Ie=class{#t;profiles;assignments;presets;constructor(t){this.#t=Uo(t),this.profiles=new Le(this.#t),this.assignments=new Ne(this.#t),this.presets=t.presets}get on(){return this.#t.subby.on}#e(t){let{preferences:e,assignments:o,controllers:s}=this.#t,n=S(s.get(t)),i=o.get(t)??e.get(n.handle)??n.defaultProfileKey;t.bindings=this.profiles.get(i).bindings,o.set(t,i)}async load(){let{kvs:t,controllers:e,preferences:o,profiles:{customs:s}}=this.#t;s.clear(),Ht(s,await mr(t.profiles)),o.clear(),Ht(o,await mr(t.preferences));for(let n of e.keys())this.#e(n)}get controllers(){return[...this.#t.controllers.keys()]}get fallbackProfileKey(){return this.#t.profiles.fallback.key}meta(t){return this.#t.controllers.get(t)}attach(t,e){let o=this.#t.idCounter.next();this.#t.controllers.set(t,{...e,id:o}),this.#e(t)}detach(t){this.#t.controllers.delete(t),this.#t.assignments.delete(t)}};function He(r){let[t,e]=Object.entries(r)[0];return{key:t,profile:e}}async function qo(r,t){let e=()=>{};if(!t){let o=new BroadcastChannel(r);t=o,e=()=>o.close()}return{broadcastChannel:t,dispose:e}}async function Wo(r){let{dispose:t,schedule:e,disposable:o}=M(),s=r.namespace?`tact_${r.namespace}`:"tact",{kv:n}=o(await Ho(s,r.kv)),{broadcastChannel:i}=o(await qo(s,r.broadcastChannel));try{let{maxPlayers:a}=r,{bindings:c}=He(r.presets).profile,l=new Ee(c),p=new Ie({...r,kv:n});return e(A(i,{message:()=>p.load()})),e(p.on(()=>i.postMessage({}))),await p.load(),Eo({hub:l,controls:p,maxPlayers:a,dispose:t})}catch(a){throw t(),a}}var kr=1024,Ve=class{dispose;#t;#e=[];constructor(t){this.#t=t,this.dispose=t.onSample(e=>{this.#e.push(e),this.#e.length>kr&&console.warn(`tact sampler exceeded limit ${kr}`),this.#e=no(this.#e,kr)})}take(){this.#t.poll?.();let t=this.#e;return this.#e=[],t}};var{min:bn,max:xn,abs:wn,sign:yn,floor:Qf,ceil:Xf,pow:Yf}=Math;function ut(r,t=0,e=1){return r=bn(r,e),r=xn(r,t),r}function vn(r,t,e,o){let n=(e-t)*r;return o!==void 0&&wn(n)>o&&(n=yn(n)*o),t+n}function $n(r,t,e){return(r-t)/(e-t)}function Fo(r,t,e,o=0,s=1,n=!1){let i=$n(r,t,e);return n&&(i=ut(i)),vn(i,o,s)}var Ue=class r{x;y;constructor(t=0,e=0){this.x=t,this.y=e}static new(t=0,e=0){return new this(t,e)}static zero(){return new this}static fill(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 new this().add(...t).divBy(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 rotation(t){return new this(Math.cos(t),Math.sin(t))}dup(){return new this.constructor(this.x,this.y)}*[Symbol.iterator](){yield this.x,yield this.y}array(){return[this.x,this.y]}toJSON(){return this.array()}toString(){return`(${this.constructor.name} x${this.x.toFixed(2)}, y${this.y.toFixed(2)})`}fill(t){return this.x=t,this.y=t,this}zero(){return this.fill(0)}set_(t,e){return this.x=t,this.y=e,this}set({x:t,y:e}){return this.x=t,this.y=e,this}from(t){if(Array.isArray(t)){let[e,o]=t;this.x=e,this.y=o}else{let{x:e,y:o}=t;this.x=e,this.y=o}return 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:o})=>this.equals_(e,o))}near_(t,e,o=1e-6){return Math.abs(this.x-t)<=o&&Math.abs(this.y-e)<=o}near({x:t,y:e},o=1e-6){return this.near_(t,e,o)}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 o=this.dot_(t,e),s=this.magnitude()*r.magnitude(t,e);if(s===0)return 0;let n=ut(o/s,-1,1);return Math.acos(n)}angleBetween({x:t,y:e}){return this.angleBetween_(t,e)}normalize(){return this.divBy(this.magnitude())}half(){return this.divBy(2)}double(){return this.mulBy(2)}abs(){return this.map(t=>Math.abs(t))}rotate(t){let{x:e,y:o}=this;return this.x=e*Math.cos(t)-o*Math.sin(t),this.y=e*Math.sin(t)+o*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().mulBy(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=ut(this.x,t.x,e.x),this.y=ut(this.y,t.y,e.y),this}clampBy(t=0,e=1){return this.x=ut(this.x,t,e),this.y=ut(this.y,t,e),this}negate(){return this.map(t=>t*-1)}addBy(t){return this.x+=t,this.y+=t,this}subBy(t){return this.x-=t,this.y-=t,this}mulBy(t){return this.x*=t,this.y*=t,this}scale(t){return this.x*=t,this.y*=t,this}divBy(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:o}of t)this.add_(e,o);return this}sub_(t,e){return this.x-=t,this.y-=e,this}sub(...t){for(let{x:e,y:o}of t)this.sub_(e,o);return this}mul_(t,e){return this.x*=t,this.y*=e,this}mul(...t){for(let{x:e,y:o}of t)this.mul_(e,o);return this}div_(t,e){return t!==0&&(this.x/=t),e!==0&&(this.y/=e),this}div(...t){for(let{x:e,y:o}of t)this.div_(e,o);return this}lerp_(t,e,o){return this.x+=(t-this.x)*o,this.y+=(e-this.y)*o,this}lerp(t,{x:e,y:o}){return this.lerp_(t,e,o)}reflect_(t,e){let o=2*this.dot_(t,e);return this.x-=o*t,this.y-=o*e,this}reflect({x:t,y:e}){return this.reflect_(t,e)}rotateAroundPoint_(t,e,o){let s=this.x-e,n=this.y-o,i=Math.cos(t),a=Math.sin(t);return this.x=i*s-a*n+e,this.y=a*s+i*n+o,this}rotateAroundPoint(t,{x:e,y:o}){return this.rotateAroundPoint_(t,e,o)}};function X(r){return r!==0}function Sr(r,t){let e=o=>Sr(r,o);if(t===null)return 0;if(bt(t))return t;if(xt(t)){let o=r.latestValues.get(t)??0;return r.recentSamples.filter(s=>s.code===t).reduce((s,n)=>Math.abs(n.value)>Math.abs(s)?n.value:s,o)}else switch(t[0]){case"accumulate":{let o=t[1],s=0;for(let n of r.recentSamples)n.code===o&&(s+=n.value);return s}case"up":{let o=t[1],s=0,n=r.previousValues.get(o)??0;for(let i of r.recentSamples)i.code===o&&(X(n)&&!X(i.value)&&s++,n=i.value);return s}case"down":{let o=t[1],s=0,n=r.previousValues.get(o)??0;for(let i of r.recentSamples)i.code===o&&(!X(n)&&X(i.value)&&s++,n=i.value);return s}case"was":{let o=t[1];return r.previousValues.get(o)??0}case"since":{let o=t[1],s=r.previousValues.get(o)??0;return(r.latestValues.get(o)??0)-s}case"if":{let[,o,s,n]=t;return e(o)?e(s):E(n)?e(n):0}case"min":return Math.min(...t.slice(1).map(e));case"max":return Math.max(...t.slice(1).map(e));case"+":return t.slice(1).map(e).reduce((o,s)=>o+s,0);case"*":return t.slice(1).map(e).reduce((o,s)=>o*s,1);case"==":return+(e(t[1])===e(t[2]));case"!=":return+(e(t[1])!==e(t[2]));case">":return+(e(t[1])>e(t[2]));case"<":return+(e(t[1])<e(t[2]));case">=":return+(e(t[1])>=e(t[2]));case"<=":return+(e(t[1])<=e(t[2]));case"!":return+(e(t[1])===0);case"!!":return+(e(t[1])!==0);case"-":{let[,o,...s]=t;if(s.length===0)return-e(o);let n=e(o);for(let i of s)n-=e(i);return n}case"clamp":{let[,o,s,n]=t,i=e(n);return Math.min(s===null?1/0:e(s),Math.max(o===null?-1/0:e(o),i))}case"remap":{let[o,s,n,i,a]=t.slice(1).map(e);return Fo(a,o,s,n,i)}case"dt":return r.dt;case"held":{let[,o,s]=t,n=X(e(s)),i=r.holding.get(t);return n&&!i&&(i={start:r.clock.time},r.holding.set(t,i)),!n&&i&&(i=void 0,r.holding.delete(t)),i&&r.clock.time-i.start>=o?1:0}case"taps":{let[,o,s,n]=t,i=X(e(n)),a=r.clock.time,c=wt(r.tapping,t,()=>({wasDown:!1,startedAt:null,count:0})),l=i&&!c.wasDown,p=!i&&c.wasDown;c.startedAt!==null&&a-c.startedAt>=s&&(c.startedAt=null,c.count=0);let u=0;return l&&c.startedAt===null&&(c.startedAt=a),p&&c.startedAt!==null&&(c.count++,c.count===o&&(u=1,c.count=0,c.startedAt=null)),c.wasDown=i,u}case"mod":{let[,...o]=t,s=l=>X(r.latestValues.get(l)??0),n=s("ShiftLeft")||s("ShiftRight"),i=s("ControlLeft")||s("ControlRight"),a=s("AltLeft")||s("AltRight"),c=s("MetaLeft")||s("MetaRight");return o.includes("shift")!==n||o.includes("ctrl")!==i||o.includes("alt")!==a||o.includes("meta")!==c?0:1}default:throw new Error("unknown expression")}}var qe=class{time;since=0;last;constructor(t=performance.now()){this.time=t}update(t=performance.now()){this.since=t-(this.time??t),this.last=this.time,this.time=t}};var We=class{dt=0;clock=new qe;recentSamples=[];latestValues=new Map;previousValues=new Map;holding=new Map;tapping=new Map};function Ko(){return{value:0,was:0,sum:0}}function Ar(r){let t=q(r),e=[],o=[];function s(i){if(lt(i)){let a=Ko();return e.push(a),o.push(i),a}else return fr(i,s)}let n=s(r);return{hash:t,inputs:n,inputList:e,rootList:o}}var Mt=class{#t;#e;#o;#r;constructor(t){this.#e=at(structuredClone(t.bindings)),this.#o=Ar(this.#e),this.#t=new Ve(t.source),this.#r=new We}get bindings(){return this.#e}set bindings(t){let e=at(structuredClone(t)),o=Ar(e),s=this.#o.hash;if(o.hash!==s)throw new Error("incompatible bindings");this.#e=e,this.#o.rootList=o.rootList}*evaluate(t=performance.now()){let e=this.#t.take();this.#r.clock.update(t),this.#r.recentSamples=e,this.#r.dt=this.#r.clock.since/1e3;for(let{code:o,value:s}of e)this.#r.latestValues.set(o,s);for(let[o,s]of this.#o.rootList.entries()){let n=Sr(this.#r,s);n!==0&&(yield{id:o,value:n})}for(let{code:o,value:s}of e)this.#r.previousValues.set(o,s)}encode(t=performance.now()){return Ce(this.#o.hash,[...this.evaluate(t)])}clear(){this.#t.take()}dispose(){return this.#t.dispose()}};var Fe=class{get;constructor(t){this.get=t}get gamepad(){return this.get()}};function Go(r,t){let e=r;return()=>{let o=t();return o!=null&&(e=o),e}}function Ke(r){let t=new Map;function e(){o(),s()}function o(){for(let i of navigator.getGamepads())if(i?.connected&&!t.has(i.index)){let a=()=>navigator.getGamepads()[i.index],c=new Fe(Go(i,a)),l=r(c);t.set(i.index,{pad:c,dispose:l})}}function s(){for(let[i,{pad:a,dispose:c}]of t)navigator.getGamepads()[a.gamepad.index]?.connected||(c(),t.delete(i))}e();let n=A(window,{gamepadconnected:e,gamepaddisconnected:e});return()=>{n();for(let{dispose:i}of t.values())i();t.clear()}}var I=class{onSample=W();dispose=M()};var Pt=class extends I{pad;#t=new Map;constructor(t){super(),this.pad=t}get gamepad(){return this.pad.gamepad}poll(){let t=this.gamepad;this.#o(t),this.#r(t)}#e(t,e){let o=this.#t.get(t)??0;e!==o&&(this.#t.set(t,e),this.onSample.publish({code:t,value:e}))}#o(t){let e=0;for(let[o,s]of t.buttons.entries()){let n=s.value;this.#e(`gamepad.${o+1}`,n),e=Math.max(e,n)}this.#e("gamepad.any",e>=.9?1:0)}#r(t){for(let[e,o]of t.axes.entries())this.#e(`gamepad.axis.${e+1}`,o)}};function Jo(r,t){return Ke(e=>{let o=new Pt(e),s=new Mt({source:o,bindings:r.bindings});r.plug(s);let n=t?.(s,o);return()=>{s.dispose(),r.remove(s),n?.()}})}function Zo(r,t){return r.length>t?r.slice(0,t)+"...":r}var Ge=class extends I{#t;constructor(...t){super(),this.#t=t;for(let e of t)this.dispose.schedule(e.onSample(o=>this.onSample.publish(o)))}poll(){for(let t of this.#t)t.poll?.()}};var Je=class{$hex=_("");clear=to(250,()=>{this.$hex.set("")});update(t){this.$hex(fe(new Uint8Array(t))),this.clear()}};function zt(r){return`pointer.${r+1}`}var Ze=class extends I{client=new Ue;constructor(t=window){super(),this.dispose.schedule(A(t,this.#t))}#t={pointerdown:t=>{this.onSample.publish({code:zt(t.button),value:1})},pointerup:t=>{this.onSample.publish({code:zt(t.button),value:0})},pointermove:({clientX:t,clientY:e,movementX:o,movementY:s})=>{this.client.set_(t,e),o&&this.onSample.publish({code:"pointer.x",value:o}),s&&this.onSample.publish({code:"pointer.y",value:s})},wheel:({deltaX:t,deltaY:e})=>{t&&this.onSample.publish({code:"pointer.wheel.x",value:t}),e&&this.onSample.publish({code:"pointer.wheel.y",value:e})}}};var Qe=class extends I{#t=new Set;constructor(t=window){super(),this.dispose.schedule(A(t,this.#e)),this.dispose.schedule(A(window,this.#o))}#e={keydown:t=>{t.repeat||(this.#t.size===0&&this.onSample.publish({code:"keyboard.any",value:1}),this.onSample.publish({code:t.code,value:1}),this.#t.add(t.code))},keyup:t=>{this.onSample.publish({code:t.code,value:0}),this.#t.delete(t.code),this.#t.size===0&&this.onSample.publish({code:"keyboard.any",value:0})}};#o={blur:()=>{for(let t of this.#t)this.onSample.publish({code:t,value:0});this.#t.size&&this.onSample.publish({code:"keyboard.any",value:0}),this.#t.clear()}}};var Qo=F`@layer core {
29
29
 
30
30
  ::selection {
31
31
  color: var(--selection);
@@ -55,14 +55,14 @@ a {
55
55
  }
56
56
  }
57
57
 
58
- }`;var Jo=W`@layer vars {
58
+ }`;var Xo=F`@layer vars {
59
59
 
60
60
  :is(:root, :host) {
61
- ${vn({bg:"#111",alpha:"#def",rounded:"0.5em",padding:"0.5em",prime:"#d068ff",code:"#3f1",link:"cyan",selection:"white","selection-bg":"#f70",lame:"#8888",angry:"#f50",zesty:"#cf0",happy:"#0fa",calm:"#0af",sad:"#74f",quirky:"#f49","inactive-opacity":"0.5","anim-duration":"150ms"})}
61
+ ${Sn({bg:"#111",alpha:"#def",rounded:"0.5em",padding:"0.5em",prime:"#d068ff",code:"#3f1",link:"cyan",selection:"white","selection-bg":"#f70",lame:"#8888",angry:"#f50",zesty:"#cf0",happy:"#0fa",calm:"#0af",sad:"#74f",quirky:"#f49","inactive-opacity":"0.5","anim-duration":"150ms"})}
62
62
  }
63
63
 
64
- }`;function wn([r,t]){return`--${r}: var(--shiny-${r}, ${t});`}function vn(r){return Object.entries(r).map(wn).join(`
65
- `)}var Zo=W`@layer reset {
64
+ }`;function kn([r,t]){return`--${r}: var(--shiny-${r}, ${t});`}function Sn(r){return Object.entries(r).map(kn).join(`
65
+ `)}var Yo=F`@layer reset {
66
66
 
67
67
  * {
68
68
  margin: 0;
@@ -78,15 +78,15 @@ a {
78
78
  ::-webkit-scrollbar-thumb { background: #888; border-radius: 1em; }
79
79
  ::-webkit-scrollbar-thumb:hover { background: #999; }
80
80
 
81
- }`;var Qo=W`
81
+ }`;var ts=F`
82
82
 
83
83
  @layer vars, reset, core, underlay, view, overlay;
84
84
 
85
- ${Jo}
86
- ${Zo}
87
- ${Ko}
85
+ ${Xo}
86
+ ${Yo}
87
+ ${Qo}
88
88
 
89
- `;var _r=new CSSStyleSheet;_r.replaceSync(Qo);var Ot=class{length=1;$index=S(0);constructor(t=0){this.$index(t)}clamp(t){return t=Math.min(t,this.length-1),t=Math.max(t,0),t}get index(){return this.clamp(this.$index())}async setIndex(t){return this.$index(t)}async shimmy(t){let e=this.clamp(this.index+t);return this.setIndex(e)}};var Xo=b`@layer view {
89
+ `;var _r=new CSSStyleSheet;_r.replaceSync(ts);var Ot=class{length=1;$index=_(0);constructor(t=0){this.$index(t)}clamp(t){return t=Math.min(t,this.length-1),t=Math.max(t,0),t}get index(){return this.clamp(this.$index())}async setIndex(t){return this.$index(t)}async shimmy(t){let e=this.clamp(this.index+t);return this.setIndex(e)}};var es=x`@layer view {
90
90
 
91
91
  :host {
92
92
  display: inline-flex;
@@ -128,10 +128,10 @@ slot[part="tabs"][data-snug] {
128
128
  }
129
129
  }
130
130
 
131
- } `;var Yo=xo((r={})=>{_t("shiny-tabs"),Ct(_r,Xo);let t=Jt(),e=y(()=>g.attrs(t).spec({index:Number})),o=y(()=>r.control??new Ot(e.index??0)),s=H([]),n=H([]);function i(l){let p=l.currentTarget;s(p.assignedElements())}function a(l){let p=l.currentTarget;n(p.assignedElements())}e.index=o.$index(),o.length=s().length;function c(l,p){let u=o.clamp(l+p);return u===l?!1:u===o.index}for(let[l,p]of s().entries()){let u=l===o.index,m=g.attrs(p);m.booleans.disabled=u,m.booleans["data-snug"]=r.snug,m.booleans["data-tabbed"]=u,m.booleans["data-first"]=l===0,m.booleans["data-last"]=l===o.length-1,m.booleans["data-next-is-tabbed"]=c(l,1),m.booleans["data-previous-is-tabbed"]=c(l,-1),p.onclick=()=>o.setIndex(l)}for(let[l,p]of n().entries()){let u=l===o.index;g.attrs(p).booleans["data-tabbed"]=u,g.attrs(p).booleans.hidden=!u}return h`
131
+ } `;var rs=wo((r={})=>{_t("shiny-tabs"),Ct(_r,es);let t=Jt(),e=y(()=>b.attrs(t).spec({index:Number})),o=y(()=>r.control??new Ot(e.index??0)),s=U([]),n=U([]);function i(l){let p=l.currentTarget;s(p.assignedElements())}function a(l){let p=l.currentTarget;n(p.assignedElements())}e.index=o.$index(),o.length=s().length;function c(l,p){let u=o.clamp(l+p);return u===l?!1:u===o.index}for(let[l,p]of s().entries()){let u=l===o.index,d=b.attrs(p);d.booleans.disabled=u,d.booleans["data-snug"]=r.snug,d.booleans["data-tabbed"]=u,d.booleans["data-first"]=l===0,d.booleans["data-last"]=l===o.length-1,d.booleans["data-next-is-tabbed"]=c(l,1),d.booleans["data-previous-is-tabbed"]=c(l,-1),p.onclick=()=>o.setIndex(l)}for(let[l,p]of n().entries()){let u=l===o.index;b.attrs(p).booleans["data-tabbed"]=u,b.attrs(p).booleans.hidden=!u}return h`
132
132
  <slot part=tabs ?data-snug="${r.snug}" @slotchange="${i}"></slot>
133
133
  <slot part=panels name=panel @slotchange="${a}"></slot>
134
- `});var ts=b`@layer view {
134
+ `});var os=x`@layer view {
135
135
 
136
136
  :host {
137
137
  display: block;
@@ -196,7 +196,7 @@ slot[part="tabs"][data-snug] {
196
196
  }
197
197
  }
198
198
 
199
- }`;var Q=b`
199
+ }`;var Y=x`
200
200
  @layer theme, view;
201
201
  @layer theme {
202
202
 
@@ -305,7 +305,7 @@ ${St}
305
305
  box-shadow: inset 0 0 1em oklch(from var(--chill) l c h / 20%);
306
306
  }
307
307
 
308
- }`;var Tt=f`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-GameController"><path d="M9 15l-2.968 2.968A2.362 2.362 0 0 1 2 16.298V15l1.357-6.784A4 4 0 0 1 7.279 5h9.442a4 4 0 0 1 3.922 3.216L22 15v1.297a2.362 2.362 0 0 1-4.032 1.67L15 15H9z"/><path d="M9 5l1 2h4l1-2"/></svg>`;var es=f`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-SettingsHorizontal"><path d="M3 5h4m14 0H11m-8 7h12m6 0h-2M3 19h2m16 0H9"/><circle cx="9" cy="5" r="2"/><circle cx="17" cy="12" r="2"/><circle cx="7" cy="19" r="2"/></svg>`;var rs=b`@layer view {
308
+ }`;var Tt=g`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-GameController"><path d="M9 15l-2.968 2.968A2.362 2.362 0 0 1 2 16.298V15l1.357-6.784A4 4 0 0 1 7.279 5h9.442a4 4 0 0 1 3.922 3.216L22 15v1.297a2.362 2.362 0 0 1-4.032 1.67L15 15H9z"/><path d="M9 5l1 2h4l1-2"/></svg>`;var ss=g`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-SettingsHorizontal"><path d="M3 5h4m14 0H11m-8 7h12m6 0h-2M3 19h2m16 0H9"/><circle cx="9" cy="5" r="2"/><circle cx="17" cy="12" r="2"/><circle cx="7" cy="19" r="2"/></svg>`;var ns=x`@layer view {
309
309
 
310
310
  .plate {
311
311
  user-select: none;
@@ -459,7 +459,7 @@ ${St}
459
459
  }
460
460
  }
461
461
 
462
- }`;var os=f`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-PersonAdd"><circle cx="12" cy="7" r="5"/><path d="M17 22H5.266a2 2 0 0 1-1.985-2.248l.39-3.124A3 3 0 0 1 6.649 14H7"/><path d="M19 14v4"/><path d="M17 16h4"/></svg>`;var Ye=f`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-XSmall"><path d="M17 17L7 7m10 0L7 17"/></svg>`;var Xt=A(r=>{let{dnd:t}=r.context,e=t.dropzone(()=>({playerId:r.playerId}));return h`
462
+ }`;var is=g`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-PersonAdd"><circle cx="12" cy="7" r="5"/><path d="M17 22H5.266a2 2 0 0 1-1.985-2.248l.39-3.124A3 3 0 0 1 6.649 14H7"/><path d="M19 14v4"/><path d="M17 16h4"/></svg>`;var Xe=g`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-XSmall"><path d="M17 17L7 7m10 0L7 17"/></svg>`;var Qt=C(r=>{let{dnd:t}=r.context,e=t.dropzone(()=>({playerId:r.playerId}));return h`
463
463
  <div class="${r.class}"
464
464
  theme-card="${r.themeCard??""}"
465
465
  data-drop-candidate
@@ -471,7 +471,7 @@ ${St}
471
471
 
472
472
  ${r.content}
473
473
  </div>
474
- `});var ss=f`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="currentColor" stroke-width="2" class="ai ai-DragVerticalFill"><path fill-rule="evenodd" clip-rule="evenodd" d="M16 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M16 10a2 2 0 1 1 0 4 2 2 0 0 1 0-4z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M8 18a2 2 0 1 1 0 4 2 2 0 0 1 0-4z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M16 18a2 2 0 1 1 0 4 2 2 0 0 1 0-4z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M8 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M8 10a2 2 0 1 1 0 4 2 2 0 0 1 0-4z"/></svg>`;function ns(r){return r*137.508}var tr=A((r,t,e)=>{let{profiles:o}=r.controls;function s(n){let i=n.currentTarget;e(i.value)}return h`
474
+ `});var as=g`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="currentColor" stroke-width="2" class="ai ai-DragVerticalFill"><path fill-rule="evenodd" clip-rule="evenodd" d="M16 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M16 10a2 2 0 1 1 0 4 2 2 0 0 1 0-4z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M8 18a2 2 0 1 1 0 4 2 2 0 0 1 0-4z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M16 18a2 2 0 1 1 0 4 2 2 0 0 1 0-4z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M8 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M8 10a2 2 0 1 1 0 4 2 2 0 0 1 0-4z"/></svg>`;function cs(r){return r*137.508}var Ye=C((r,t,e)=>{let{profiles:o}=r.controls;function s(n){let i=n.currentTarget;e(i.value)}return h`
475
475
  <select
476
476
  part=select
477
477
  theme-select
@@ -494,7 +494,7 @@ ${St}
494
494
  </option>
495
495
  `)}
496
496
  </select>
497
- `});var er=A((r,t)=>{let{deck:e,dnd:o}=r,{controls:s}=e,n=o.dragzone(()=>({controller:t})),i=s.assignments.assignedProfileKeyOf(t),a=s.meta(t)??{id:0,icon:Tt,handle:"controller",name:"controller",tooltip:"",defaultProfileKey:s.fallbackProfileKey},c=`--hue: ${ns(a?.id??0)};`;return h`
497
+ `});var tr=C((r,t)=>{let{deck:e,dnd:o}=r,{controls:s}=e,n=o.dragzone(()=>({controller:t})),i=s.assignments.assignedProfileKeyOf(t),a=s.meta(t)??{id:0,icon:Tt,handle:"controller",name:"controller",tooltip:"",defaultProfileKey:s.fallbackProfileKey},c=`--hue: ${cs(a?.id??0)};`;return h`
498
498
  <div class=controller
499
499
  style="${c}"
500
500
  theme-card
@@ -504,7 +504,7 @@ ${St}
504
504
  @dragend="${n.dragend}">
505
505
 
506
506
  <div class=griptape>
507
- ${ss}
507
+ ${as}
508
508
  </div>
509
509
 
510
510
  <h4 class=label title="${a.tooltip}">
@@ -512,43 +512,43 @@ ${St}
512
512
  <span class=name>${a.name}</span>
513
513
  </h4>
514
514
 
515
- ${tr(e,i,l=>{s.assignments.assign(t,l)})}
515
+ ${Ye(e,i,l=>{s.assignments.assign(t,l)})}
516
516
  </div>
517
- `});var is=A((r,t,e)=>{let{hub:o}=r.deck,s=()=>o.deletePlayer(t),n=o.controllers.assigned.get(t)??[];return Xt({class:"player",playerId:t,context:r,content:h`
517
+ `});var ls=C((r,t,e)=>{let{hub:o}=r.deck,s=()=>o.deletePlayer(t),n=o.controllers.assigned.get(t)??[];return Qt({class:"player",playerId:t,context:r,content:h`
518
518
  <h3>
519
519
  <span>player ${e+1}</span>
520
520
 
521
521
  ${kt(o.playerIds.length>1,()=>h`
522
522
  <button theme-button="naked angry" @click=${s}>
523
- ${Ye}
523
+ ${Xe}
524
524
  </button>
525
525
  `)}
526
526
  </h3>
527
527
 
528
528
  <div class=controllerlist>
529
- ${n.map(i=>er(r,i))}
529
+ ${n.map(i=>tr(r,i))}
530
530
  </div>
531
- `})});var Cr=Symbol("droppyNewPlayer");var[as,cs]=Z(r=>{B(Q,rs);let{hub:t}=r,e=t.controllers,o=()=>r.hub.createPlayer(),s=(i,a)=>is(n,i,a),n=y(()=>({deck:r,dnd:new $e.DragAndDrops({acceptDrop(i,a,c){c.playerId===Cr?t.plug(a.controller,t.createPlayer()):C(c.playerId)?t.plug(a.controller,c.playerId):t.unplug(a.controller)}})}));return h`
531
+ `})});var Cr=Symbol("droppyNewPlayer");var[us,ps]=Q(r=>{j(Y,ns);let{hub:t}=r,e=t.controllers,o=()=>r.hub.createPlayer(),s=(i,a)=>ls(n,i,a),n=y(()=>({deck:r,dnd:new ye.DragAndDrops({acceptDrop(i,a,c){c.playerId===Cr?t.plug(a.controller,t.createPlayer()):E(c.playerId)?t.plug(a.controller,c.playerId):t.unplug(a.controller)}})}));return h`
532
532
  <div class=plate ?data-drag-and-drop="${!!n.dnd.dragging}">
533
533
  <div class=playerlist>
534
534
  ${t.playerIds.map(s)}
535
535
 
536
- ${kt(t.playerIds.length<r.maxPlayers,()=>Xt({class:"player new",themeCard:"dull",playerId:Cr,context:n,content:h`
536
+ ${kt(t.playerIds.length<r.maxPlayers,()=>Qt({class:"player new",themeCard:"dull",playerId:Cr,context:n,content:h`
537
537
  <button theme-button=naked @click="${o}">
538
- ${os}
538
+ ${is}
539
539
  <span>add player</span>
540
540
  </button>
541
541
  `}))}
542
542
 
543
- ${Xt({class:"player unassigned",themeCard:"dull",playerId:null,context:n,content:h`
543
+ ${Qt({class:"player unassigned",themeCard:"dull",playerId:null,context:n,content:h`
544
544
  <h3>unassigned</h3>
545
545
  <div class=controllerlist>
546
- ${e.unassigned.map(i=>er(n,i))}
546
+ ${e.unassigned.map(i=>tr(n,i))}
547
547
  </div>
548
548
  `})}
549
549
  </div>
550
550
  </div>
551
- `});var ls=b`@layer view {
551
+ `});var hs=x`@layer view {
552
552
 
553
553
  .plate {
554
554
  display: flex;
@@ -688,7 +688,7 @@ ${St}
688
688
  }
689
689
  }
690
690
 
691
- }`;var us=f`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-Copy"><path d="M8 4v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7.242a2 2 0 0 0-.602-1.43L16.083 2.57A2 2 0 0 0 14.685 2H10a2 2 0 0 0-2 2z"/><path d="M16 18v2a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h2"/></svg>`;var ps=f`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-TrashCan"><path d="M4 6h16l-1.58 14.22A2 2 0 0 1 16.432 22H7.568a2 2 0 0 1-1.988-1.78L4 6z"/><path d="M7.345 3.147A2 2 0 0 1 9.154 2h5.692a2 2 0 0 1 1.81 1.147L18 6H6l1.345-2.853z"/><path d="M2 6h20"/><path d="M10 11v5"/><path d="M14 11v5"/></svg>`;function Er(){return ge.random(16)}var hs=f`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-KeyCap"><path d="M7 3s3 .5 5 .5 5-.5 5-.5l1 9s-3 1-6 1-6-1-6-1l1-9z"/><path d="M3.869 8.147l-.862 10.294c-.03.366.04.733.205 1.06l.197.393A2.01 2.01 0 0 0 5.206 21h13.588a2.01 2.01 0 0 0 1.797-1.106l.197-.392c.165-.328.236-.695.205-1.06l-.862-10.295a3.99 3.99 0 0 0-.79-2.068L17 3s-3 .5-5 .5S6.978 3 6.978 3l-2.32 3.08a3.99 3.99 0 0 0-.79 2.067z"/><path d="M6 12l-2.5 8M18 12l2.5 8"/></svg>`;var ds=f`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-Backspace"><path d="M17 15l-6-6m6 0l-6 6"/><path d="M7.4 4.8A2 2 0 0 1 9 4h11a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H9a2 2 0 0 1-1.6-.8l-4.5-6a2 2 0 0 1 0-2.4l4.5-6z"/></svg>`;var ms=f`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" class="ai ai-Cross"><path d="M20 20L4 4m16 0L4 20"/></svg>`;function fs(r,t){let e=new Set,o=new Set;function s(a){if(a==="ShiftLeft"||a==="ShiftRight")return"shift";if(a==="ControlLeft"||a==="ControlRight")return"ctrl";if(a==="MetaLeft"||a==="MetaRight")return"meta";if(a==="AltLeft"||a==="AltRight")return"alt"}let n=E(window,{blur:()=>i(),keydown:a=>{if(a.preventDefault(),a.code==="Escape")return i();e.add(a.code),o.add(a.code)},keyup:a=>{if(a.preventDefault(),e.delete(a.code),e.size===0){let c=new Set,l=new Set;for(let p of o){let u=s(p);u?l.add(u):c.add(p)}o.size===0||(c.size===0?r(["*",...o]):l.size>0?r(["*",["mod",...l],...c]):o.size>1?r(["*",...o]):r([...o][0])),i()}}}),i=()=>{n(),t()};return i}function gs(r,t){let{dispose:e,schedule:o}=U();o(t);let s=new Set,n=new Set,i=new Set;return o(E(window,{blur:()=>e()})),o(Ke(a=>{let c=new Pt(a);return s.add(c),c.onSample(l=>{if(l.code!=="gamepad.any")if(l.value>.9)n.add(l.code),i.add(l.code);else{if(!n.delete(l.code))return;n.size===0&&(i.size===1?r([...i][0]):i.size>1&&r(["*",...i]),e())}}),()=>{c.dispose(),s.delete(c)}})),o(wt(async()=>{for(let a of s)a.poll();await $t(16.67)})),e}function bs(r,t){let{dispose:e,schedule:o}=U();o(t);let s=new Set,n=new Set,i=a=>a.composedPath().some(c=>c instanceof Element&&c.matches("button.record"));return o(E(window,{blur:()=>e(),auxclick:a=>a.preventDefault(),mousedown:a=>{if(i(a))return;a.preventDefault();let c=zt(a.button);s.add(c),n.add(c)},mouseup:a=>{let c=zt(a.button);s.delete(c)&&(a.preventDefault(),s.size===0&&(n.size===1?r([...n][0]):n.size>1&&r(["*",...n]),e()))},contextmenu:a=>{a.preventDefault()}})),e}var xs=A((r,t,e,o)=>{let s=H(null),n=()=>s(null),i=()=>{let{dispose:p,schedule:u}=U();u(n),u(fs(t,p)),u(gs(t,p)),u(bs(t,p)),s(p)},a=()=>{s()?.(),n()};function c(){s()?a():i()}function l(){a(),e()}return So(a),h`
691
+ }`;var ds=g`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-Copy"><path d="M8 4v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7.242a2 2 0 0 0-.602-1.43L16.083 2.57A2 2 0 0 0 14.685 2H10a2 2 0 0 0-2 2z"/><path d="M16 18v2a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h2"/></svg>`;var ms=g`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-TrashCan"><path d="M4 6h16l-1.58 14.22A2 2 0 0 1 16.432 22H7.568a2 2 0 0 1-1.988-1.78L4 6z"/><path d="M7.345 3.147A2 2 0 0 1 9.154 2h5.692a2 2 0 0 1 1.81 1.147L18 6H6l1.345-2.853z"/><path d="M2 6h20"/><path d="M10 11v5"/><path d="M14 11v5"/></svg>`;function Er(){return fe.random(16)}var fs=g`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-KeyCap"><path d="M7 3s3 .5 5 .5 5-.5 5-.5l1 9s-3 1-6 1-6-1-6-1l1-9z"/><path d="M3.869 8.147l-.862 10.294c-.03.366.04.733.205 1.06l.197.393A2.01 2.01 0 0 0 5.206 21h13.588a2.01 2.01 0 0 0 1.797-1.106l.197-.392c.165-.328.236-.695.205-1.06l-.862-10.295a3.99 3.99 0 0 0-.79-2.068L17 3s-3 .5-5 .5S6.978 3 6.978 3l-2.32 3.08a3.99 3.99 0 0 0-.79 2.067z"/><path d="M6 12l-2.5 8M18 12l2.5 8"/></svg>`;var gs=g`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-Backspace"><path d="M17 15l-6-6m6 0l-6 6"/><path d="M7.4 4.8A2 2 0 0 1 9 4h11a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H9a2 2 0 0 1-1.6-.8l-4.5-6a2 2 0 0 1 0-2.4l4.5-6z"/></svg>`;var bs=g`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" class="ai ai-Cross"><path d="M20 20L4 4m16 0L4 20"/></svg>`;function xs(r,t){let e=new Set,o=new Set;function s(a){if(a==="ShiftLeft"||a==="ShiftRight")return"shift";if(a==="ControlLeft"||a==="ControlRight")return"ctrl";if(a==="MetaLeft"||a==="MetaRight")return"meta";if(a==="AltLeft"||a==="AltRight")return"alt"}let n=A(window,{blur:()=>i(),keydown:a=>{if(a.preventDefault(),a.code==="Escape")return i();e.add(a.code),o.add(a.code)},keyup:a=>{if(a.preventDefault(),e.delete(a.code),e.size===0){let c=new Set,l=new Set;for(let p of o){let u=s(p);u?l.add(u):c.add(p)}o.size===0||(c.size===0?r(["*",...o]):l.size>0?r(["*",["mod",...l],...c]):o.size>1?r(["*",...o]):r([...o][0])),i()}}}),i=()=>{n(),t()};return i}function ws(r,t){let{dispose:e,schedule:o}=M();o(t);let s=new Set,n=new Set,i=new Set;return o(A(window,{blur:()=>e()})),o(Ke(a=>{let c=new Pt(a);return s.add(c),c.onSample(l=>{if(l.code!=="gamepad.any")if(l.value>.9)n.add(l.code),i.add(l.code);else{if(!n.delete(l.code))return;n.size===0&&(i.size===1?r([...i][0]):i.size>1&&r(["*",...i]),e())}}),()=>{c.dispose(),s.delete(c)}})),o(yt(async()=>{for(let a of s)a.poll();await $t(16.67)})),e}function ys(r,t){let{dispose:e,schedule:o}=M();o(t);let s=new Set,n=new Set,i=a=>a.composedPath().some(c=>c instanceof Element&&c.matches("button.record"));return o(A(window,{blur:()=>e(),auxclick:a=>a.preventDefault(),mousedown:a=>{if(i(a))return;a.preventDefault();let c=zt(a.button);s.add(c),n.add(c)},mouseup:a=>{let c=zt(a.button);s.delete(c)&&(a.preventDefault(),s.size===0&&(n.size===1?r([...n][0]):n.size>1&&r(["*",...n]),e()))},contextmenu:a=>{a.preventDefault()}})),e}var vs=C((r,t,e,o)=>{let s=U(null),n=()=>s(null),i=()=>{let{dispose:p,schedule:u}=M();u(n),u(xs(t,p)),u(ws(t,p)),u(ys(t,p)),s(p)},a=()=>{s()?.(),n()};function c(){s()?a():i()}function l(){a(),e()}return Ao(a),h`
692
692
  <div class=recorder ?data-recording="${!!s()}">
693
693
  ${o}
694
694
  ${r?null:h`
@@ -697,18 +697,18 @@ ${St}
697
697
  theme-button=naked
698
698
  title="record a keypress"
699
699
  @click=${c}>
700
- ${s()?ms:hs}
700
+ ${s()?bs:fs}
701
701
  </button>
702
702
 
703
703
  <button
704
704
  theme-button=naked
705
705
  title="reset to default"
706
706
  @click=${l}>
707
- ${ds}
707
+ ${gs}
708
708
  </button>
709
709
  `}
710
710
  </div>
711
- `});var Mr=A((r,t,e)=>{if(!C(t))return h`
711
+ `});var Mr=C((r,t,e)=>{if(!E(t))return h`
712
712
  <div class=null>unset</div>
713
713
  `;if(bt(t))return h`
714
714
  <div class=number>
@@ -728,7 +728,7 @@ ${St}
728
728
  .value="${t}"
729
729
  ?readonly="${r}"
730
730
  @change="${o=>{let n=o.currentTarget.value;e(n)}}"/>
731
- `;if(be(t))return t[0]==="mod"?h`
731
+ `;if(ge(t))return t[0]==="mod"?h`
732
732
  <div class="bracket mod">
733
733
  ${t.slice(1).length===0?"unmodified":t.slice(1).join("+")}
734
734
 
@@ -736,7 +736,7 @@ ${St}
736
736
  <button
737
737
  theme-button=naked
738
738
  @click="${()=>e([t[0]])}">
739
- ${Ye}
739
+ ${Xe}
740
740
  </button>
741
741
  `:null}
742
742
  </div>
@@ -747,36 +747,36 @@ ${St}
747
747
  `}
748
748
  ${t.slice(1).map((o,s)=>Mr(r,o??null,n=>{let i=structuredClone(t);i[s+1]=n,e(i)}))}
749
749
  </div>
750
- `;throw new Error("unknown expression")});function rr(r,t,e,o){return ct(t)?Mr(r,t,o):Object.entries(t).map(([s,n])=>ct(n)?kn(r,t,e,o,s):$n(r,t,e,o,s))}function $n(r,t,e,o,s){return h`
750
+ `;throw new Error("unknown expression")});function er(r,t,e,o){return lt(t)?Mr(r,t,o):Object.entries(t).map(([s,n])=>lt(n)?_n(r,t,e,o,s):An(r,t,e,o,s))}function An(r,t,e,o,s){return h`
751
751
  <details class=group open>
752
752
  <summary>${s}</summary>
753
753
  <div class=children>
754
- ${rr(r,t[s],e[s],n=>o({...t,[s]:n}))}
754
+ ${er(r,t[s],e[s],n=>o({...t,[s]:n}))}
755
755
  </div>
756
756
  </details>
757
- `}function kn(r,t,e,o,s){let n=a=>o({...t,[s]:a});return h`
757
+ `}function _n(r,t,e,o,s){let n=a=>o({...t,[s]:a});return h`
758
758
  <div class=expression>
759
759
  <strong>${s}</strong>
760
- ${xs(r,n,()=>n(e[s]),rr(r,t[s],e[s],n))}
760
+ ${vs(r,n,()=>n(e[s]),er(r,t[s],e[s],n))}
761
761
  </div>
762
- `}var[ys,ws]=Z(r=>{B(Q,ls);let{controls:t,controls:{profiles:e}}=r,o=H(t.fallbackProfileKey),s=e.get(o()),n=e.isPreset(o()),i=s.basedOn?e.get(s.basedOn):s,a=u=>{let m=o();if(e.isPreset(m)){let _=m,X=Er();m=X,e.clone(X,_)}e.update(m,{bindings:u}),o(m)},c=(u,m)=>e.update(u,{label:m}),l=()=>{let u=Er();e.clone(u,o()),o.set(u)},p=()=>{e.delete(o()),o(t.fallbackProfileKey)};return h`
762
+ `}var[$s,ks]=Q(r=>{j(Y,hs);let{controls:t,controls:{profiles:e}}=r,o=U(t.fallbackProfileKey),s=e.get(o()),n=e.isPreset(o()),i=s.basedOn?e.get(s.basedOn):s,a=async u=>{let d=o();if(e.isPreset(d)){let f=d,z=Er();d=z,await e.clone(z,f)}await e.update(d,{bindings:u}),o(d)},c=(u,d)=>e.update(u,{label:d}),l=()=>{let u=Er();e.clone(u,o()),o.set(u)},p=()=>{e.delete(o()),o(t.fallbackProfileKey)};return h`
763
763
  <div class=plate theme-card>
764
764
  <header class=topbar>
765
765
  <div class=corner>
766
- ${tr(r,o(),o)}
766
+ ${Ye(r,o(),o)}
767
767
 
768
768
  <button title="copy this profile" theme-button=naked @click="${l}">
769
- ${us}
769
+ ${ds}
770
770
  </button>
771
771
 
772
772
  ${n?null:h`
773
773
  <button title="delete this profile" theme-button=naked @click="${p}">
774
- ${ps}
774
+ ${ms}
775
775
  </button>
776
776
  `}
777
777
 
778
778
  ${kt(n,()=>h`<small>readonly</small>`)}
779
- ${ye(s.basedOn,u=>h`<small>based on ${e.get(u).label}</small>`)}
779
+ ${be(s.basedOn,u=>h`<small>based on ${e.get(u).label}</small>`)}
780
780
  </div>
781
781
 
782
782
  <div class=tools>
@@ -785,34 +785,34 @@ ${St}
785
785
  type=text
786
786
  theme-input
787
787
  .value="${s.label}"
788
- @change="${u=>{let m=u.currentTarget;c(o(),m.value)}}"
788
+ @change="${u=>{let d=u.currentTarget;c(o(),d.value)}}"
789
789
  />
790
790
  `}
791
791
  </div>
792
792
  </header>
793
793
 
794
794
  <div class=bindings>
795
- ${rr(!1,s.bindings,i.bindings,a)}
795
+ ${er(!1,s.bindings,i.bindings,a)}
796
796
  </div>
797
797
  </div>
798
- `});var[yy,vs]=Z(r=>{B(Q,ts);let t={slot:"panel"},e=y(()=>new Ot);return y(()=>{window.location.hash.includes("bindings")&&e.setIndex(1)}),h`
798
+ `});var[Cw,Ss]=Q(r=>{j(Y,os);let t={slot:"panel"},e=y(()=>new Ot);return y(()=>{window.location.hash.includes("bindings")&&e.setIndex(1)}),h`
799
799
  <div class=deck theme-card>
800
- ${Yo.with({props:[{control:e}],children:h`
800
+ ${rs.with({props:[{control:e}],children:h`
801
801
  <button theme-button>
802
802
  ${Tt}
803
803
  <span>controllers</span>
804
804
  </button>
805
805
 
806
806
  <button theme-button>
807
- ${es}
807
+ ${ss}
808
808
  <span>customize</span>
809
809
  </button>
810
810
 
811
- ${as.with({attrs:t,props:[r]})}
812
- ${ys.with({attrs:t,props:[r]})}
811
+ ${us.with({attrs:t,props:[r]})}
812
+ ${$s.with({attrs:t,props:[r]})}
813
813
  `})}
814
814
  </div>
815
- `});var $s=b`@layer view {
815
+ `});var As=x`@layer view {
816
816
 
817
817
  :host {
818
818
  display: block;
@@ -833,9 +833,9 @@ output {
833
833
  text-overflow: ellipsis;
834
834
  }
835
835
 
836
- }`;var[Cy,ks]=Z(r=>(B(Q,$s),h`
836
+ }`;var[Dw,_s]=Q(r=>(j(Y,As),h`
837
837
  <slot></slot>
838
838
  <output class=viz>${r.$hex()}</output>
839
- `));var Ss=f`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-Devices"><path d="M10 15H4V6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v2"/><path d="M2 18h12"/><path d="M14 9.2c0-.663.597-1.2 1.333-1.2h5.334C21.403 8 22 8.537 22 9.2v9.6c0 .663-.597 1.2-1.333 1.2h-5.334C14.597 20 14 19.463 14 18.8V9.2z"/><path d="M18 17h.01"/></svg>`;async function As(r){let t=await Vo(r),e=new Ze,o={TactDeck:vs(t),TactCustomize:ws(t),TactControllers:cs(t),TactVisualizer:ks(e)};function s(a){return Fo(t.hub,(c,l)=>{let p=`${l.pad.gamepad.id} ${l.pad.gamepad.index+1}`;return t.controls.attach(c,{icon:Tt,handle:p,tooltip:p,name:Go(p,32),defaultProfileKey:a??Qt(t.controls.presets).key}),()=>t.controls.detach(c)})}function n(){let{key:a,profile:c}=Qt(t.controls.presets),l=new Mt({bindings:c.bindings,source:new Je(new Xe,new Qe)});return t.hub.plug(l),t.controls.attach(l,{icon:Ss,handle:"standard",name:"mouse/keyboard",tooltip:"",defaultProfileKey:a}),l}function i(){te(o)}return{deck:t,gamepads:s,mouseKeyboard:n,visualizer:e,elements:o,registerElements:i}}var Yt=await As({presets:Mo,maxPlayers:4});Yt.mouseKeyboard();Yt.gamepads("gamer");Yt.registerElements();wt(async()=>{let r=Yt.deck.hub.encodeAll();Yt.visualizer.update(r),await $t(1e3/60)});{let r=g('input[type="color"]');r.value="#ffbb00",r.oninput=()=>document.body.style.setProperty("--tact-prime",r.value)}
839
+ `));var Cs=g`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-Devices"><path d="M10 15H4V6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v2"/><path d="M2 18h12"/><path d="M14 9.2c0-.663.597-1.2 1.333-1.2h5.334C21.403 8 22 8.537 22 9.2v9.6c0 .663-.597 1.2-1.333 1.2h-5.334C14.597 20 14 19.463 14 18.8V9.2z"/><path d="M18 17h.01"/></svg>`;async function Es(r){let{dispose:t,schedule:e,disposable:o}=M(),s=o(await Wo(r)),n=He(s.controls.presets),i=new Je,a={TactDeck:Ss(s),TactCustomize:ks(s),TactControllers:ps(s),TactVisualizer:_s(i)};function c(u){let d=Jo(s.hub,(f,z)=>{let rr=`${z.pad.gamepad.id} ${z.pad.gamepad.index+1}`;return s.controls.attach(f,{icon:Tt,handle:rr,tooltip:rr,name:Zo(rr,32),defaultProfileKey:u??n.key}),()=>s.controls.detach(f)});return e(d),d}function l(){let{key:u,profile:d}=n,f=o(new Mt({bindings:d.bindings,source:o(new Ge(o(new Qe),o(new Ze)))}));return s.hub.plug(f),s.controls.attach(f,{icon:Cs,handle:"standard",name:"mouse/keyboard",tooltip:"",defaultProfileKey:u}),e(()=>{s.hub.remove(f),s.controls.detach(f)}),f}function p(){Yt(a)}return{deck:s,gamepads:c,mouseKeyboard:l,visualizer:i,elements:a,registerElements:p,encodeAll:s.hub.encodeAll.bind(s.hub),dispose:t}}var Xt=await Es({presets:Po,maxPlayers:4});Xt.mouseKeyboard();Xt.gamepads("gamer");Xt.registerElements();yt(async()=>{let r=Xt.deck.hub.encodeAll();Xt.visualizer.update(r),await $t(1e3/60)});{let r=b('input[type="color"]');r.value="#ffbb00",r.oninput=()=>document.body.style.setProperty("--tact-prime",r.value)}
840
840
  /*! For license information please see main.bundle.min.js.LEGAL.txt */
841
841
  //# sourceMappingURL=main.bundle.min.js.map