@benev/tact 0.3.0-4 → 0.3.0-5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@benev/tact",
3
- "version": "0.3.0-4",
3
+ "version": "0.3.0-5",
4
4
  "description": "🎮 keybindings and couch co-op",
5
5
  "license": "MIT",
6
6
  "author": "Chase Moskal <chasemoskal@gmail.com>",
@@ -23,13 +23,13 @@
23
23
  },
24
24
  "peerDependencies": {
25
25
  "@e280/sly": "^0.4.8",
26
- "@e280/strata": "^0.5.1",
26
+ "@e280/strata": "^0.5.2",
27
27
  "lit": "^3.3.3"
28
28
  },
29
29
  "dependencies": {
30
- "@benev/math": "^0.4.0-4",
30
+ "@benev/math": "^0.4.0-8",
31
31
  "@e280/kv": "^0.2.1",
32
- "@e280/stz": "^0.3.13"
32
+ "@e280/stz": "^0.4.2"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@e280/hottie": "^0.1.5",
@@ -1,6 +1,6 @@
1
1
 
2
2
  import {RMap} from "@e280/strata"
3
- import {inserts, need} from "@e280/stz"
3
+ import {need, setEntries} from "@e280/stz"
4
4
  import {Profile, ProfileKey} from "../types.js"
5
5
 
6
6
  export class Profiles {
@@ -8,7 +8,7 @@ export class Profiles {
8
8
 
9
9
  constructor(stock: Record<ProfileKey, Profile>, public custom: RMap<ProfileKey, Profile>) {
10
10
  this.stock = new RMap<ProfileKey, Profile>()
11
- inserts(this.stock, Object.entries(stock))
11
+ setEntries(this.stock, Object.entries(stock))
12
12
 
13
13
  if (this.stock.size === 0)
14
14
  throw new Error("must be at least one stock profile")
@@ -1,6 +1,6 @@
1
1
 
2
2
  import {RMap} from "@e280/strata"
3
- import {Cubby, inserts} from "@e280/stz"
3
+ import {Cubby, setEntries} from "@e280/stz"
4
4
  import {shiftLimit} from "../../utils/shift-limit.js"
5
5
  import {ControllerHandle, DeckState, Profile, ProfileKey} from "../types.js"
6
6
 
@@ -23,8 +23,8 @@ export class Settings {
23
23
  const state = await this.store.get()
24
24
  this.customProfiles.clear()
25
25
  this.profileAssignments.clear()
26
- inserts(this.customProfiles, state?.customProfiles ?? [])
27
- inserts(this.profileAssignments, state?.profileAssignments ?? [])
26
+ setEntries(this.customProfiles, state?.customProfiles ?? [])
27
+ setEntries(this.profileAssignments, state?.profileAssignments ?? [])
28
28
  }
29
29
  }
30
30
 
@@ -5,8 +5,8 @@ import {SamplerDevice} from "./sampler.js"
5
5
  import {splitAxis} from "../utils/split-axis.js"
6
6
 
7
7
  export class PointerDevice extends SamplerDevice {
8
- client = new Vec2(0, 0)
9
- movement = new Vec2(0, 0)
8
+ client = new Vec2()
9
+ movement = new Vec2()
10
10
  dispose = disposer()
11
11
 
12
12
  constructor(target: EventTarget = window) {
@@ -74,22 +74,14 @@ export class PointerDevice extends SamplerDevice {
74
74
  }
75
75
 
76
76
  #specialPreProcessing() {
77
- const [x, y] = this.movement
78
- const [left, right] = splitAxis(x)
77
+ const {x, y} = this.movement
78
+ const [right, left] = splitAxis(x)
79
79
  const [down, up] = splitAxis(y)
80
80
 
81
- if (x) {
82
- if (x >= 0)
83
- this.setSample(`pointer.move.right`, Math.abs(right))
84
- else
85
- this.setSample(`pointer.move.left`, Math.abs(left))
86
- }
87
- if (y) {
88
- if (y >= 0)
89
- this.setSample(`pointer.move.up`, Math.abs(up))
90
- else
91
- this.setSample(`pointer.move.down`, Math.abs(down))
92
- }
81
+ this.setSample("pointer.move.left", left)
82
+ this.setSample("pointer.move.right", right)
83
+ this.setSample("pointer.move.up", up)
84
+ this.setSample("pointer.move.down", down)
93
85
 
94
86
  this.movement.set_(0, 0)
95
87
  }
@@ -1,12 +1,12 @@
1
1
  import { RMap } from "@e280/strata";
2
- import { inserts, need } from "@e280/stz";
2
+ import { need, setEntries } from "@e280/stz";
3
3
  export class Profiles {
4
4
  custom;
5
5
  stock;
6
6
  constructor(stock, custom) {
7
7
  this.custom = custom;
8
8
  this.stock = new RMap();
9
- inserts(this.stock, Object.entries(stock));
9
+ setEntries(this.stock, Object.entries(stock));
10
10
  if (this.stock.size === 0)
11
11
  throw new Error("must be at least one stock profile");
12
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"profiles.js","sourceRoot":"","sources":["../../../s/deck/parts/profiles.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAA;AACjC,OAAO,EAAC,OAAO,EAAE,IAAI,EAAC,MAAM,WAAW,CAAA;AAGvC,MAAM,OAAO,QAAQ;IAGmC,MAAM;IAF7D,KAAK,CAAA;IAEL,YAAY,KAAkC,EAAS,MAAiC;sBAAjC,MAAM;QAC5D,IAAI,CAAC,KAAK,GAAG,IAAI,IAAI,EAAuB,CAAA;QAC5C,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;QAE1C,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;IACvD,CAAC;IAED,IAAI,GAAG;QACN,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,CAAA;IACvC,CAAC;IAED,YAAY,CAAC,GAAgB;QAC5B,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC1D,CAAC,CAAC,GAAG;YACL,CAAC,CAAC,IAAI,CAAC,SAAS,CAAA;IAClB,CAAC;IAED,IAAI,SAAS;QACZ,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;IACjC,CAAC;IAED,GAAG,CAAC,GAAgB;QACnB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAA;IACzC,CAAC;IAED,IAAI,CAAC,GAAe;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACrD,CAAC;CACD"}
1
+ {"version":3,"file":"profiles.js","sourceRoot":"","sources":["../../../s/deck/parts/profiles.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAA;AACjC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAC,MAAM,WAAW,CAAA;AAG1C,MAAM,OAAO,QAAQ;IAGmC,MAAM;IAF7D,KAAK,CAAA;IAEL,YAAY,KAAkC,EAAS,MAAiC;sBAAjC,MAAM;QAC5D,IAAI,CAAC,KAAK,GAAG,IAAI,IAAI,EAAuB,CAAA;QAC5C,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;QAE7C,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;IACvD,CAAC;IAED,IAAI,GAAG;QACN,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,CAAA;IACvC,CAAC;IAED,YAAY,CAAC,GAAgB;QAC5B,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC1D,CAAC,CAAC,GAAG;YACL,CAAC,CAAC,IAAI,CAAC,SAAS,CAAA;IAClB,CAAC;IAED,IAAI,SAAS;QACZ,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;IACjC,CAAC;IAED,GAAG,CAAC,GAAgB;QACnB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAA;IACzC,CAAC;IAED,IAAI,CAAC,GAAe;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACrD,CAAC;CACD"}
@@ -1,5 +1,5 @@
1
1
  import { RMap } from "@e280/strata";
2
- import { inserts } from "@e280/stz";
2
+ import { setEntries } from "@e280/stz";
3
3
  import { shiftLimit } from "../../utils/shift-limit.js";
4
4
  const limit = 256;
5
5
  export class Settings {
@@ -19,8 +19,8 @@ export class Settings {
19
19
  const state = await this.store.get();
20
20
  this.customProfiles.clear();
21
21
  this.profileAssignments.clear();
22
- inserts(this.customProfiles, state?.customProfiles ?? []);
23
- inserts(this.profileAssignments, state?.profileAssignments ?? []);
22
+ setEntries(this.customProfiles, state?.customProfiles ?? []);
23
+ setEntries(this.profileAssignments, state?.profileAssignments ?? []);
24
24
  }
25
25
  }
26
26
  //# sourceMappingURL=settings.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../s/deck/parts/settings.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAA;AACjC,OAAO,EAAQ,OAAO,EAAC,MAAM,WAAW,CAAA;AACxC,OAAO,EAAC,UAAU,EAAC,MAAM,4BAA4B,CAAA;AAGrD,MAAM,KAAK,GAAG,GAAG,CAAA;AAEjB,MAAM,OAAO,QAAQ;IAIA,KAAK;IAHzB,kBAAkB,GAAG,IAAI,IAAI,EAAgC,CAAA;IAC7D,cAAc,GAAG,IAAI,IAAI,EAAuB,CAAA;IAEhD,YAAoB,KAAuB;qBAAvB,KAAK;IAAqB,CAAC;IAE/C,KAAK,CAAC,IAAI;QACT,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;YACpB,cAAc,EAAE,UAAU,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC;YAC3D,kBAAkB,EAAE,UAAU,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,kBAAkB,CAAC,CAAC;SACnE,CAAC,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAI;QACT,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAA;QACpC,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAA;QAC3B,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAA;QAC/B,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,EAAE,cAAc,IAAI,EAAE,CAAC,CAAA;QACzD,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,KAAK,EAAE,kBAAkB,IAAI,EAAE,CAAC,CAAA;IAClE,CAAC;CACD"}
1
+ {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../s/deck/parts/settings.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAA;AACjC,OAAO,EAAQ,UAAU,EAAC,MAAM,WAAW,CAAA;AAC3C,OAAO,EAAC,UAAU,EAAC,MAAM,4BAA4B,CAAA;AAGrD,MAAM,KAAK,GAAG,GAAG,CAAA;AAEjB,MAAM,OAAO,QAAQ;IAIA,KAAK;IAHzB,kBAAkB,GAAG,IAAI,IAAI,EAAgC,CAAA;IAC7D,cAAc,GAAG,IAAI,IAAI,EAAuB,CAAA;IAEhD,YAAoB,KAAuB;qBAAvB,KAAK;IAAqB,CAAC;IAE/C,KAAK,CAAC,IAAI;QACT,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;YACpB,cAAc,EAAE,UAAU,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC;YAC3D,kBAAkB,EAAE,UAAU,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,kBAAkB,CAAC,CAAC;SACnE,CAAC,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAI;QACT,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAA;QACpC,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAA;QAC3B,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAA;QAC/B,UAAU,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,EAAE,cAAc,IAAI,EAAE,CAAC,CAAA;QAC5D,UAAU,CAAC,IAAI,CAAC,kBAAkB,EAAE,KAAK,EAAE,kBAAkB,IAAI,EAAE,CAAC,CAAA;IACrE,CAAC;CACD"}
@@ -1,6 +1,6 @@
1
- var Ir=Object.defineProperty;var Vr=(r,t)=>{for(var e in t)Ir(r,e,{get:t[e],enumerable:!0})};var _t=globalThis,St=_t.ShadowRoot&&(_t.ShadyCSS===void 0||_t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,pe=Symbol(),Oe=new WeakMap,at=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==pe)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(St&&t===void 0){let s=e!==void 0&&e.length===1;s&&(t=Oe.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Oe.set(e,t))}return t}toString(){return this.cssText}},Re=r=>new at(typeof r=="string"?r:r+"",void 0,pe),A=(r,...t)=>{let e=r.length===1?r[0]:t.reduce((s,o,n)=>s+(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.")})(o)+r[n+1],r[0]);return new at(e,r,pe)},Et=(r,t)=>{if(St)r.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let s=document.createElement("style"),o=_t.litNonce;o!==void 0&&s.setAttribute("nonce",o),s.textContent=e.cssText,r.appendChild(s)}},X=St?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(let s of t.cssRules)e+=s.cssText;return Re(e)})(r):r;var{is:Wr,defineProperty:Kr,getOwnPropertyDescriptor:Gr,getOwnPropertyNames:Fr,getOwnPropertySymbols:Yr,getPrototypeOf:Jr}=Object,Ct=globalThis,Le=Ct.trustedTypes,Xr=Le?Le.emptyScript:"",Qr=Ct.reactiveElementPolyfillSupport,ct=(r,t)=>r,he={toAttribute(r,t){switch(t){case Boolean:r=r?Xr: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}},De=(r,t)=>!Wr(r,t),Ne={attribute:!0,type:String,converter:he,reflect:!1,useDefault:!1,hasChanged:De};Symbol.metadata??=Symbol("metadata"),Ct.litPropertyMetadata??=new WeakMap;var T=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=Ne){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let s=Symbol(),o=this.getPropertyDescriptor(t,s,e);o!==void 0&&Kr(this.prototype,t,o)}}static getPropertyDescriptor(t,e,s){let{get:o,set:n}=Gr(this.prototype,t)??{get(){return this[e]},set(i){this[e]=i}};return{get:o,set(i){let c=o?.call(this);n?.call(this,i),this.requestUpdate(t,c,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Ne}static _$Ei(){if(this.hasOwnProperty(ct("elementProperties")))return;let t=Jr(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(ct("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ct("properties"))){let e=this.properties,s=[...Fr(e),...Yr(e)];for(let o of s)this.createProperty(o,e[o])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[s,o]of e)this.elementProperties.set(s,o)}this._$Eh=new Map;for(let[e,s]of this.elementProperties){let o=this._$Eu(e,s);o!==void 0&&this._$Eh.set(o,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let s=new Set(t.flat(1/0).reverse());for(let o of s)e.unshift(X(o))}else t!==void 0&&e.push(X(t));return e}static _$Eu(t,e){let s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Et(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){let s=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,s);if(o!==void 0&&s.reflect===!0){let n=(s.converter?.toAttribute!==void 0?s.converter:he).toAttribute(e,s.type);this._$Em=t,n==null?this.removeAttribute(o):this.setAttribute(o,n),this._$Em=null}}_$AK(t,e){let s=this.constructor,o=s._$Eh.get(t);if(o!==void 0&&this._$Em!==o){let n=s.getPropertyOptions(o),i=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:he;this._$Em=o;let c=i.fromAttribute(e,n.type);this[o]=c??this._$Ej?.get(o)??c,this._$Em=null}}requestUpdate(t,e,s,o=!1,n){if(t!==void 0){let i=this.constructor;if(o===!1&&(n=this[t]),s??=i.getPropertyOptions(t),!((s.hasChanged??De)(n,e)||s.useDefault&&s.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,s))))return;this.C(t,e,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:o,wrapped:n},i){s&&!(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||s||(e=void 0),this._$AL.set(t,e)),o===!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[o,n]of this._$Ep)this[o]=n;this._$Ep=void 0}let s=this.constructor.elementProperties;if(s.size>0)for(let[o,n]of s){let{wrapped:i}=n,c=this[o];i!==!0||this._$AL.has(o)||c===void 0||this.C(o,void 0,n,c)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(e)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};T.elementStyles=[],T.shadowRootOptions={mode:"open"},T[ct("elementProperties")]=new Map,T[ct("finalized")]=new Map,Qr?.({ReactiveElement:T}),(Ct.reactiveElementVersions??=[]).push("2.1.2");var fe=globalThis,je=r=>r,Mt=fe.trustedTypes,He=Mt?Mt.createPolicy("lit-html",{createHTML:r=>r}):void 0,me="$lit$",O=`lit$${Math.random().toFixed(9).slice(2)}$`,de="?"+O,Zr=`<${de}>`,q=document,pt=()=>q.createComment(""),ht=r=>r===null||typeof r!="object"&&typeof r!="function",ge=Array.isArray,Ve=r=>ge(r)||typeof r?.[Symbol.iterator]=="function",le=`[
2
- \f\r]`,ut=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ue=/-->/g,ze=/>/g,U=RegExp(`>|${le}(?:([^\\s"'>=/]+)(${le}*=${le}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),qe=/'/g,Be=/"/g,We=/^(?:script|style|textarea|title)$/i,xe=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),b=xe(1),zs=xe(2),qs=xe(3),B=Symbol.for("lit-noChange"),g=Symbol.for("lit-nothing"),Ie=new WeakMap,z=q.createTreeWalker(q,129);function Ke(r,t){if(!ge(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return He!==void 0?He.createHTML(t):t}var Ge=(r,t)=>{let e=r.length-1,s=[],o,n=t===2?"<svg>":t===3?"<math>":"",i=ut;for(let c=0;c<e;c++){let a=r[c],u,l,h=-1,f=0;for(;f<a.length&&(i.lastIndex=f,l=i.exec(a),l!==null);)f=i.lastIndex,i===ut?l[1]==="!--"?i=Ue:l[1]!==void 0?i=ze:l[2]!==void 0?(We.test(l[2])&&(o=RegExp("</"+l[2],"g")),i=U):l[3]!==void 0&&(i=U):i===U?l[0]===">"?(i=o??ut,h=-1):l[1]===void 0?h=-2:(h=i.lastIndex-l[2].length,u=l[1],i=l[3]===void 0?U:l[3]==='"'?Be:qe):i===Be||i===qe?i=U:i===Ue||i===ze?i=ut:(i=U,o=void 0);let m=i===U&&r[c+1].startsWith("/>")?" ":"";n+=i===ut?a+Zr:h>=0?(s.push(u),a.slice(0,h)+me+a.slice(h)+O+m):a+O+(h===-2?c:m)}return[Ke(r,n+(r[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]},lt=class r{constructor({strings:t,_$litType$:e},s){let o;this.parts=[];let n=0,i=0,c=t.length-1,a=this.parts,[u,l]=Ge(t,e);if(this.el=r.createElement(u,s),z.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(o=z.nextNode())!==null&&a.length<c;){if(o.nodeType===1){if(o.hasAttributes())for(let h of o.getAttributeNames())if(h.endsWith(me)){let f=l[i++],m=o.getAttribute(h).split(O),d=/([.?@])?(.*)/.exec(f);a.push({type:1,index:n,name:d[2],strings:m,ctor:d[1]==="."?Pt:d[1]==="?"?Tt:d[1]==="@"?Ot:V}),o.removeAttribute(h)}else h.startsWith(O)&&(a.push({type:6,index:n}),o.removeAttribute(h));if(We.test(o.tagName)){let h=o.textContent.split(O),f=h.length-1;if(f>0){o.textContent=Mt?Mt.emptyScript:"";for(let m=0;m<f;m++)o.append(h[m],pt()),z.nextNode(),a.push({type:2,index:++n});o.append(h[f],pt())}}}else if(o.nodeType===8)if(o.data===de)a.push({type:2,index:n});else{let h=-1;for(;(h=o.data.indexOf(O,h+1))!==-1;)a.push({type:7,index:n}),h+=O.length-1}n++}}static createElement(t,e){let s=q.createElement("template");return s.innerHTML=t,s}};function I(r,t,e=r,s){if(t===B)return t;let o=s!==void 0?e._$Co?.[s]:e._$Cl,n=ht(t)?void 0:t._$litDirective$;return o?.constructor!==n&&(o?._$AO?.(!1),n===void 0?o=void 0:(o=new n(r),o._$AT(r,e,s)),s!==void 0?(e._$Co??=[])[s]=o:e._$Cl=o),o!==void 0&&(t=I(r,o._$AS(r,t.values),o,s)),t}var kt=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:s}=this._$AD,o=(t?.creationScope??q).importNode(e,!0);z.currentNode=o;let n=z.nextNode(),i=0,c=0,a=s[0];for(;a!==void 0;){if(i===a.index){let u;a.type===2?u=new Q(n,n.nextSibling,this,t):a.type===1?u=new a.ctor(n,a.name,a.strings,this,t):a.type===6&&(u=new Rt(n,this,t)),this._$AV.push(u),a=s[++c]}i!==a?.index&&(n=z.nextNode(),i++)}return z.currentNode=q,o}p(t){let e=0;for(let s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}},Q=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,o){this.type=2,this._$AH=g,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=o,this._$Cv=o?.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=I(this,t,e),ht(t)?t===g||t==null||t===""?(this._$AH!==g&&this._$AR(),this._$AH=g):t!==this._$AH&&t!==B&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Ve(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!==g&&ht(this._$AH)?this._$AA.nextSibling.data=t:this.T(q.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:s}=t,o=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=lt.createElement(Ke(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===o)this._$AH.p(e);else{let n=new kt(o,this),i=n.u(this.options);n.p(e),this.T(i),this._$AH=n}}_$AC(t){let e=Ie.get(t.strings);return e===void 0&&Ie.set(t.strings,e=new lt(t)),e}k(t){ge(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,s,o=0;for(let n of t)o===e.length?e.push(s=new r(this.O(pt()),this.O(pt()),this,this.options)):s=e[o],s._$AI(n),o++;o<e.length&&(this._$AR(s&&s._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let s=je(t).nextSibling;je(t).remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},V=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,o,n){this.type=1,this._$AH=g,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=g}_$AI(t,e=this,s,o){let n=this.strings,i=!1;if(n===void 0)t=I(this,t,e,0),i=!ht(t)||t!==this._$AH&&t!==B,i&&(this._$AH=t);else{let c=t,a,u;for(t=n[0],a=0;a<n.length-1;a++)u=I(this,c[s+a],e,a),u===B&&(u=this._$AH[a]),i||=!ht(u)||u!==this._$AH[a],u===g?t=g:t!==g&&(t+=(u??"")+n[a+1]),this._$AH[a]=u}i&&!o&&this.j(t)}j(t){t===g?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Pt=class extends V{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===g?void 0:t}},Tt=class extends V{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==g)}},Ot=class extends V{constructor(t,e,s,o,n){super(t,e,s,o,n),this.type=5}_$AI(t,e=this){if((t=I(this,t,e,0)??g)===B)return;let s=this._$AH,o=t===g&&s!==g||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==g&&(s===g||o);o&&this.element.removeEventListener(this.name,this,s),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)}},Rt=class{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){I(this,t)}},Fe={M:me,P:O,A:de,C:1,L:Ge,R:kt,D:Ve,V:I,I:Q,H:V,N:Tt,U:Ot,B:Pt,F:Rt},ts=fe.litHtmlPolyfillSupport;ts?.(lt,Q),(fe.litHtmlVersions??=[]).push("3.3.3");var x=(r,t,e)=>{let s=e?.renderBefore??t,o=s._$litPart$;if(o===void 0){let n=e?.renderBefore??null;s._$litPart$=o=new Q(t.insertBefore(pt(),n),n,void 0,e??{})}return o._$AI(r),o};var ye=globalThis,Z=class extends T{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 B}};Z._$litElement$=!0,Z.finalized=!0,ye.litElementHydrateSupport?.({LitElement:Z});var es=ye.litElementPolyfillSupport;es?.({LitElement:Z});(ye.litElementVersions??=[]).push("4.2.2");var E={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},y={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,s]of t)y.any(r,e,s)},record:(r,t)=>y.entries(r,Object.entries(t))};function Ye(r,t={}){let e=document.createElement(r);return y.record(e,t),e}function Je(r){let t=document.createDocumentFragment();return x(r,t),t.firstElementChild}function Lt(r,t){let e=[];for(let[s,o]of Object.entries(t))if(typeof o=="function")r.addEventListener(s,o),e.push(()=>r.removeEventListener(s,o));else{let[n,i]=o;r.addEventListener(s,i,n),e.push(()=>r.removeEventListener(s,i))}return()=>e.forEach(s=>s())}function Xe(r,t){let e=new MutationObserver(t);return e.observe(r,{attributes:!0}),()=>e.disconnect()}var Nt=class{element;constructor(t){this.element=t}strings=new Proxy({},{get:(t,e)=>E.string(this.element,e),set:(t,e,s)=>y.string(this.element,e,s)});numbers=new Proxy({},{get:(t,e)=>E.number(this.element,e),set:(t,e,s)=>y.number(this.element,e,s)});booleans=new Proxy({},{get:(t,e)=>E.boolean(this.element,e),set:(t,e,s)=>y.boolean(this.element,e,s)})};var Qe=(r,t,e={})=>new Proxy(t,{get:(s,o)=>{switch(t[o]){case String:return E.string(r,o);case Number:return E.number(r,o);case Boolean:return E.boolean(r,o);default:throw new Error(`invalid attribute type for "${o}"`)}},set:(s,o,n)=>{try{switch(e.beforeSet?.(o),t[o]){case String:return y.string(r,o,n);case Number:return y.number(r,o,n);case Boolean:return y.boolean(r,o,n);default:throw new Error(`invalid attribute type for "${o}"`)}}finally{e.afterSet?.(o)}}});function tt(r){let t=new Nt(r);return{strings:t.strings,numbers:t.numbers,booleans:t.booleans,on:e=>Xe(r,e),spec:(e,s={})=>Qe(r,e,s)}}tt.get=E;tt.set=y;function Ze(r){return new we(r)}var we=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,s]of Object.entries(t))this.attr(e,s);return this}children(...t){return this.#e.push(...t),this}done(){let t=document.createElement(this.tagName);return y.entries(t,this.#t),t.append(...this.#e),t}};function et(r,t=document){let e=t.querySelector(r);if(!e)throw new Error(`element not found (${r})`);return e}function Dt(r,t=document){return t.querySelector(r)}function jt(r,t=document){return Array.from(t.querySelectorAll(r))}var Ht=class r{element;#t;constructor(t){this.element=t}in(t){return new r(typeof t=="string"?et(t,this.element):t)}require(t){return et(t,this.element)}maybe(t){return Dt(t,this.element)}all(t){return jt(t,this.element)}render(...t){return x(t,this.element)}get attrs(){return this.#t??=tt(this.element)}events(t){return Lt(this.element,t)}};function tr(r){return r.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}function er(r,t={}){let{soft:e=!1,upgrade:s=!0}=t;for(let[o,n]of Object.entries(r)){let i=tr(o),c=customElements.get(i);e&&c||(customElements.define(i,n),s&&document.querySelectorAll(i).forEach(a=>{a.constructor===HTMLElement&&customElements.upgrade(a)}))}}function w(r,t=document){return et(r,t)}w.in=(r,t=document)=>new Ht(t).in(r);w.need=et;w.maybe=Dt;w.all=jt;w.el=Ye;w.elmer=Ze;w.mk=Je;w.events=Lt;w.attrs=tt;w.register=er;w.render=(r,...t)=>x(t,r);function rr(r,t){let e,s,o=[];function n(){e=[],s&&clearTimeout(s),s=void 0,o=[]}return n(),((...i)=>{e=i,s&&clearTimeout(s);let c=new Promise((a,u)=>{o.push({resolve:a,reject:u})});return s=setTimeout(()=>{Promise.resolve().then(()=>t(...e)).then(a=>{for(let{resolve:u}of o)u(a);n()}).catch(a=>{for(let{reject:u}of o)u(a);n()})},r),c})}function W(){let r,t,e=new Promise((o,n)=>{r=o,t=n});function s(o){return o.then(r).catch(t),e}return{promise:e,resolve:r,reject:t,entangle:s}}function Ut(r){let t=null;return((...e)=>(t?t.params=e:(t={params:e,deferred:W()},queueMicrotask(()=>{let{params:s,deferred:o}=t;t=null,Promise.resolve(r(...s)).then(o.resolve).catch(o.reject)})),t.deferred.promise))}var $={};Vr($,{clone:()=>ft,equal:()=>os,freeze:()=>ns});function ft(r,t=new Set){if(t.has(r))throw new Error("cannot clone circular reference");let e;return typeof r=="function"||r!==null&&typeof r=="object"?(t.add(r),Array.isArray(r)?e=r.map(s=>ft(s,new Set(t))):r.constructor===Object?e=Object.fromEntries(Object.entries(r).map(([s,o])=>[s,ft(o,new Set(t))])):r instanceof Map?e=new Map(Array.from(r,([s,o])=>[s,ft(o,new Set(t))])):r instanceof Set?e=new Set(Array.from(r,s=>ft(s,new Set(t)))):r instanceof Date?e=new Date(r.getTime()):e=r,t.delete(r)):e=r,e}function rs(r){return r!=null}function ss(r){return r==null}var mt=Object.freeze({happy:rs,sad:ss,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 os=(r,t)=>{function e(s,o,n){if(!mt.object(s)||!mt.object(o))return s===o;if(n.includes(s))throw new Error("forbidden circularity detected in deep equal comparison");let i=[...n,s];if(s instanceof Map&&o instanceof Map){if(s.size!==o.size)return!1;for(let[c,a]of s)if(!o.has(c)||!e(a,o.get(c),i))return!1}else if(s instanceof Set&&o instanceof Set){if(s.size!==o.size)return!1;for(let c of s)if(!Array.from(o).some(a=>e(c,a,i)))return!1}else{let c=Object.keys(s),a=Object.keys(o);if(c.length!==a.length)return!1;for(let u of c)if(!a.includes(u)||!e(s[u],o[u],i))return!1}return!0}return e(r,t,[])};function ns(r){function t(e,s){if(!mt.object(e)||s.includes(e))return e;let o=[...s,e];if(e instanceof Map)for(let n of e.entries())for(let i of n)t(i,o);else if(e instanceof Set)for(let n of e)t(n,o);else if(Array.isArray(e))for(let n of e)t(n,o);else for(let n of Object.values(e))t(n,o);return Object.freeze(e)}return t(r,[])}function sr(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 or(r){if(r.ok)throw new Error("didn't get needed error");return r.error}function nr(r,t,e=typeof t=="string"?`needed key not found "${t}"`:"needed key not found"){if(r.has(t))return r.get(t);throw new Error(e)}function L(r,t,e){if(r.has(t))return r.get(t);{let s=e();return r.set(t,s),s}}function is(r,t){for(let[e,s]of t)r.set(e,s);return r}var dt=is;function ir(r){let t,e=!1,s=()=>{e=!0,clearTimeout(t)},o=async()=>{e||(await r(s),!e&&(t=setTimeout(o,0)))};return o(),s}function zt(){let r=[];function t(){let e=r;r=[];for(let s=e.length-1;s>=0;s--)e[s]()}return t.schedule=(...e)=>(r.push(...e),t),t.own=(e,s)=>(r.push(()=>s(e)),e),t}function K(r,t){let e=Object.entries(t);for(let[s,o]of e)r.addEventListener(s,o);return()=>{for(let[s,o]of e)r.removeEventListener(s,o)}}var ar=(r=0)=>new Promise(t=>setTimeout(t,r));function $e(r){return new be(r)}var be=class r{#t;static with=$e;constructor(t){this.#t=t}to(t){return new r(t(this.#t))}done(){return this.#t}line(...t){let e=this.#t;for(let s of t)e=s(e);return e}};function as(){let r=new Set;async function t(...a){await Promise.all([...r].map(u=>u(...a)))}function e(a){return r.add(a),()=>{r.delete(a)}}async function s(...a){return t(...a)}function o(a){return e(a)}async function n(a){let{promise:u,resolve:l}=W(),h=o(async(...f)=>{a&&await a(...f),l(f),h()});return u}function i(){r.clear()}let c={pub:s,sub:o,publish:t,subscribe:e,on:e,next:n,clear:i};return Object.assign(o,c),Object.assign(s,c),c}function cr(r){let t=as();return r&&t.sub(r),t.sub}var qt=class{#t=new Set;#e=[];#r=new WeakMap;#o=0;#s=new Set;read(t){this.#e.at(-1)?.add(t)}write(t){let e=this.#r.get(t);if(e){for(let s of e)this.#s.add(s);this.#o===0&&this.#n()}}observe(t){let e=new Set;this.#e.push(e);try{let s=t();return{seen:e,value:s}}finally{this.#e.pop()}}subscribe(t,e){let s=L(this.#r,t,()=>new Set);return s.add(e),()=>{s.delete(e),s.size===0&&this.#r.delete(t)}}batch=t=>{this.#o++;try{return t()}finally{this.#o--,this.#o===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 p=globalThis[Symbol.for("e280.tracker.2")]??=new qt;function N(r){function t(){return arguments.length===0?(p.read(t),r):(r=arguments[0],p.write(t),r)}return t.get=()=>t(),t.set=e=>t(e),t}function Ae(r,t){let{seen:e,value:s}=p.observe(r),o=[...e].map(i=>p.subscribe(i,t));return{value:s,dispose:()=>o.forEach(i=>i())}}function rt(r){let t,e=!0,s=!1,o=!1,n=()=>{},i=()=>{n(),n=()=>{},e=!0},c=()=>{(!e||s)&&(e=!0,p.write(u))},a=()=>{if(o)throw new Error("derived circularity forbidden");o=!0;try{let l=Ae(r,()=>c());n(),n=l.dispose,t=l.value,e=!1,s=!1}catch(l){throw s=!0,l}finally{o=!1}};function u(){return p.read(u),e&&a(),t}return u.get=()=>u(),u.dispose=i,u}var R=class extends Map{get size(){return p.read(this),super.size}[Symbol.iterator](){return p.read(this),super[Symbol.iterator]()}forEach(t){p.read(this);for(let[e,s]of this)t(s,e,this);return this}keys(){return p.read(this),super.keys()}values(){return p.read(this),super.values()}entries(){return p.read(this),super.entries()}has(t){return p.read(this),super.has(t)}get(t){return p.read(this),super.get(t)}set(t,e){return super.set(t,e),p.write(this),this}delete(t){let e=super.delete(t);return p.write(this),e}clear(){return super.clear(),p.write(this),this}};var gt=class extends Set{get size(){return p.read(this),super.size}[Symbol.iterator](){return p.read(this),super[Symbol.iterator]()}forEach(t){p.read(this);for(let e of this)t(e,e,this);return this}values(){return p.read(this),super.values()}has(t){return p.read(this),super.has(t)}add(t){return super.add(t),p.write(this),this}delete(t){let e=super.delete(t);return p.write(this),e}clear(){return super.clear(),p.write(this),this}};var jn=p.batch;function ur(r){return $.freeze($.clone(r))}var C=Symbol("optic");var xt=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 Bt=class r{[C];#t;#e;#r;constructor(t){this[C]=t,this.#t=$.clone(t.getState()),this.#e=new xt(()=>$.clone(t.getState())),this.#r=new xt(()=>ur(t.getState()))}update(){let t=this[C].getState();!$.equal(t,this.#t)&&(this.#e.invalidate(),this.#r.invalidate(),this.#t=$.clone(t),p.write(this))}get state(){return p.read(this),this.#e.get()}get frozen(){return p.read(this),this.#r.get()}mutate(t){return this[C].mutate(t)}lens(t){let e=new r({getState:()=>t(this[C].getState()),mutate:s=>this[C].mutate(o=>s(t(o))),registerLens:this[C].registerLens});return this[C].registerLens(e),e}};var It=class{key;storage;constructor(t,e=window.localStorage){this.key=t,this.storage=e}async get(){let t=this.storage.getItem(this.key);return t?JSON.parse(t):void 0}async set(t){let e=JSON.stringify(t);this.storage.setItem(this.key,e)}onStorageEvent(t){let e=s=>{s.storageArea===this.storage&&s.key===this.key&&t()};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)}};function pr(r){if(!r.done)throw new Error("wait not done");return sr(r)}function hr(r){if(!r.done)throw new Error("wait not done");return or(r)}var lr=r=>!r.done;var ve=r=>r.done&&r.ok;function fr(r,t){let{pending:e=()=>{},ok:s=()=>{},err:o=()=>{}}=t;return lr(r)?e():ve(r)?s(pr(r)):o(hr(r))}var Vt=A`
1
+ var Wr=Object.defineProperty;var Kr=(r,t)=>{for(var e in t)Wr(r,e,{get:t[e],enumerable:!0})};var _t=globalThis,St=_t.ShadowRoot&&(_t.ShadyCSS===void 0||_t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,pe=Symbol(),Oe=new WeakMap,it=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==pe)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(St&&t===void 0){let s=e!==void 0&&e.length===1;s&&(t=Oe.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Oe.set(e,t))}return t}toString(){return this.cssText}},Re=r=>new it(typeof r=="string"?r:r+"",void 0,pe),A=(r,...t)=>{let e=r.length===1?r[0]:t.reduce((s,o,n)=>s+(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.")})(o)+r[n+1],r[0]);return new it(e,r,pe)},Et=(r,t)=>{if(St)r.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let s=document.createElement("style"),o=_t.litNonce;o!==void 0&&s.setAttribute("nonce",o),s.textContent=e.cssText,r.appendChild(s)}},Y=St?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(let s of t.cssRules)e+=s.cssText;return Re(e)})(r):r;var{is:Gr,defineProperty:Fr,getOwnPropertyDescriptor:Yr,getOwnPropertyNames:Jr,getOwnPropertySymbols:Xr,getPrototypeOf:Qr}=Object,Ct=globalThis,Le=Ct.trustedTypes,Zr=Le?Le.emptyScript:"",ts=Ct.reactiveElementPolyfillSupport,at=(r,t)=>r,he={toAttribute(r,t){switch(t){case Boolean:r=r?Zr: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}},je=(r,t)=>!Gr(r,t),Ne={attribute:!0,type:String,converter:he,reflect:!1,useDefault:!1,hasChanged:je};Symbol.metadata??=Symbol("metadata"),Ct.litPropertyMetadata??=new WeakMap;var T=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=Ne){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let s=Symbol(),o=this.getPropertyDescriptor(t,s,e);o!==void 0&&Fr(this.prototype,t,o)}}static getPropertyDescriptor(t,e,s){let{get:o,set:n}=Yr(this.prototype,t)??{get(){return this[e]},set(i){this[e]=i}};return{get:o,set(i){let c=o?.call(this);n?.call(this,i),this.requestUpdate(t,c,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Ne}static _$Ei(){if(this.hasOwnProperty(at("elementProperties")))return;let t=Qr(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(at("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(at("properties"))){let e=this.properties,s=[...Jr(e),...Xr(e)];for(let o of s)this.createProperty(o,e[o])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[s,o]of e)this.elementProperties.set(s,o)}this._$Eh=new Map;for(let[e,s]of this.elementProperties){let o=this._$Eu(e,s);o!==void 0&&this._$Eh.set(o,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let s=new Set(t.flat(1/0).reverse());for(let o of s)e.unshift(Y(o))}else t!==void 0&&e.push(Y(t));return e}static _$Eu(t,e){let s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Et(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){let s=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,s);if(o!==void 0&&s.reflect===!0){let n=(s.converter?.toAttribute!==void 0?s.converter:he).toAttribute(e,s.type);this._$Em=t,n==null?this.removeAttribute(o):this.setAttribute(o,n),this._$Em=null}}_$AK(t,e){let s=this.constructor,o=s._$Eh.get(t);if(o!==void 0&&this._$Em!==o){let n=s.getPropertyOptions(o),i=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:he;this._$Em=o;let c=i.fromAttribute(e,n.type);this[o]=c??this._$Ej?.get(o)??c,this._$Em=null}}requestUpdate(t,e,s,o=!1,n){if(t!==void 0){let i=this.constructor;if(o===!1&&(n=this[t]),s??=i.getPropertyOptions(t),!((s.hasChanged??je)(n,e)||s.useDefault&&s.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,s))))return;this.C(t,e,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:o,wrapped:n},i){s&&!(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||s||(e=void 0),this._$AL.set(t,e)),o===!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[o,n]of this._$Ep)this[o]=n;this._$Ep=void 0}let s=this.constructor.elementProperties;if(s.size>0)for(let[o,n]of s){let{wrapped:i}=n,c=this[o];i!==!0||this._$AL.has(o)||c===void 0||this.C(o,void 0,n,c)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(e)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};T.elementStyles=[],T.shadowRootOptions={mode:"open"},T[at("elementProperties")]=new Map,T[at("finalized")]=new Map,ts?.({ReactiveElement:T}),(Ct.reactiveElementVersions??=[]).push("2.1.2");var fe=globalThis,De=r=>r,Mt=fe.trustedTypes,He=Mt?Mt.createPolicy("lit-html",{createHTML:r=>r}):void 0,me="$lit$",O=`lit$${Math.random().toFixed(9).slice(2)}$`,de="?"+O,es=`<${de}>`,z=document,ut=()=>z.createComment(""),pt=r=>r===null||typeof r!="object"&&typeof r!="function",ge=Array.isArray,Ve=r=>ge(r)||typeof r?.[Symbol.iterator]=="function",le=`[
2
+ \f\r]`,ct=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ue=/-->/g,ze=/>/g,H=RegExp(`>|${le}(?:([^\\s"'>=/]+)(${le}*=${le}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),qe=/'/g,Be=/"/g,We=/^(?:script|style|textarea|title)$/i,xe=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),b=xe(1),qs=xe(2),Bs=xe(3),q=Symbol.for("lit-noChange"),g=Symbol.for("lit-nothing"),Ie=new WeakMap,U=z.createTreeWalker(z,129);function Ke(r,t){if(!ge(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return He!==void 0?He.createHTML(t):t}var Ge=(r,t)=>{let e=r.length-1,s=[],o,n=t===2?"<svg>":t===3?"<math>":"",i=ct;for(let c=0;c<e;c++){let a=r[c],u,l,h=-1,f=0;for(;f<a.length&&(i.lastIndex=f,l=i.exec(a),l!==null);)f=i.lastIndex,i===ct?l[1]==="!--"?i=Ue:l[1]!==void 0?i=ze:l[2]!==void 0?(We.test(l[2])&&(o=RegExp("</"+l[2],"g")),i=H):l[3]!==void 0&&(i=H):i===H?l[0]===">"?(i=o??ct,h=-1):l[1]===void 0?h=-2:(h=i.lastIndex-l[2].length,u=l[1],i=l[3]===void 0?H:l[3]==='"'?Be:qe):i===Be||i===qe?i=H:i===Ue||i===ze?i=ct:(i=H,o=void 0);let m=i===H&&r[c+1].startsWith("/>")?" ":"";n+=i===ct?a+es:h>=0?(s.push(u),a.slice(0,h)+me+a.slice(h)+O+m):a+O+(h===-2?c:m)}return[Ke(r,n+(r[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]},ht=class r{constructor({strings:t,_$litType$:e},s){let o;this.parts=[];let n=0,i=0,c=t.length-1,a=this.parts,[u,l]=Ge(t,e);if(this.el=r.createElement(u,s),U.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(o=U.nextNode())!==null&&a.length<c;){if(o.nodeType===1){if(o.hasAttributes())for(let h of o.getAttributeNames())if(h.endsWith(me)){let f=l[i++],m=o.getAttribute(h).split(O),d=/([.?@])?(.*)/.exec(f);a.push({type:1,index:n,name:d[2],strings:m,ctor:d[1]==="."?Pt:d[1]==="?"?Tt:d[1]==="@"?Ot:I}),o.removeAttribute(h)}else h.startsWith(O)&&(a.push({type:6,index:n}),o.removeAttribute(h));if(We.test(o.tagName)){let h=o.textContent.split(O),f=h.length-1;if(f>0){o.textContent=Mt?Mt.emptyScript:"";for(let m=0;m<f;m++)o.append(h[m],ut()),U.nextNode(),a.push({type:2,index:++n});o.append(h[f],ut())}}}else if(o.nodeType===8)if(o.data===de)a.push({type:2,index:n});else{let h=-1;for(;(h=o.data.indexOf(O,h+1))!==-1;)a.push({type:7,index:n}),h+=O.length-1}n++}}static createElement(t,e){let s=z.createElement("template");return s.innerHTML=t,s}};function B(r,t,e=r,s){if(t===q)return t;let o=s!==void 0?e._$Co?.[s]:e._$Cl,n=pt(t)?void 0:t._$litDirective$;return o?.constructor!==n&&(o?._$AO?.(!1),n===void 0?o=void 0:(o=new n(r),o._$AT(r,e,s)),s!==void 0?(e._$Co??=[])[s]=o:e._$Cl=o),o!==void 0&&(t=B(r,o._$AS(r,t.values),o,s)),t}var kt=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:s}=this._$AD,o=(t?.creationScope??z).importNode(e,!0);U.currentNode=o;let n=U.nextNode(),i=0,c=0,a=s[0];for(;a!==void 0;){if(i===a.index){let u;a.type===2?u=new J(n,n.nextSibling,this,t):a.type===1?u=new a.ctor(n,a.name,a.strings,this,t):a.type===6&&(u=new Rt(n,this,t)),this._$AV.push(u),a=s[++c]}i!==a?.index&&(n=U.nextNode(),i++)}return U.currentNode=z,o}p(t){let e=0;for(let s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}},J=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,o){this.type=2,this._$AH=g,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=o,this._$Cv=o?.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=B(this,t,e),pt(t)?t===g||t==null||t===""?(this._$AH!==g&&this._$AR(),this._$AH=g):t!==this._$AH&&t!==q&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Ve(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!==g&&pt(this._$AH)?this._$AA.nextSibling.data=t:this.T(z.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:s}=t,o=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=ht.createElement(Ke(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===o)this._$AH.p(e);else{let n=new kt(o,this),i=n.u(this.options);n.p(e),this.T(i),this._$AH=n}}_$AC(t){let e=Ie.get(t.strings);return e===void 0&&Ie.set(t.strings,e=new ht(t)),e}k(t){ge(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,s,o=0;for(let n of t)o===e.length?e.push(s=new r(this.O(ut()),this.O(ut()),this,this.options)):s=e[o],s._$AI(n),o++;o<e.length&&(this._$AR(s&&s._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let s=De(t).nextSibling;De(t).remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},I=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,o,n){this.type=1,this._$AH=g,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=g}_$AI(t,e=this,s,o){let n=this.strings,i=!1;if(n===void 0)t=B(this,t,e,0),i=!pt(t)||t!==this._$AH&&t!==q,i&&(this._$AH=t);else{let c=t,a,u;for(t=n[0],a=0;a<n.length-1;a++)u=B(this,c[s+a],e,a),u===q&&(u=this._$AH[a]),i||=!pt(u)||u!==this._$AH[a],u===g?t=g:t!==g&&(t+=(u??"")+n[a+1]),this._$AH[a]=u}i&&!o&&this.j(t)}j(t){t===g?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Pt=class extends I{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===g?void 0:t}},Tt=class extends I{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==g)}},Ot=class extends I{constructor(t,e,s,o,n){super(t,e,s,o,n),this.type=5}_$AI(t,e=this){if((t=B(this,t,e,0)??g)===q)return;let s=this._$AH,o=t===g&&s!==g||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==g&&(s===g||o);o&&this.element.removeEventListener(this.name,this,s),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)}},Rt=class{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){B(this,t)}},Fe={M:me,P:O,A:de,C:1,L:Ge,R:kt,D:Ve,V:B,I:J,H:I,N:Tt,U:Ot,B:Pt,F:Rt},rs=fe.litHtmlPolyfillSupport;rs?.(ht,J),(fe.litHtmlVersions??=[]).push("3.3.3");var x=(r,t,e)=>{let s=e?.renderBefore??t,o=s._$litPart$;if(o===void 0){let n=e?.renderBefore??null;s._$litPart$=o=new J(t.insertBefore(ut(),n),n,void 0,e??{})}return o._$AI(r),o};var ye=globalThis,X=class extends T{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 q}};X._$litElement$=!0,X.finalized=!0,ye.litElementHydrateSupport?.({LitElement:X});var ss=ye.litElementPolyfillSupport;ss?.({LitElement:X});(ye.litElementVersions??=[]).push("4.2.2");var E={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},y={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,s]of t)y.any(r,e,s)},record:(r,t)=>y.entries(r,Object.entries(t))};function Ye(r,t={}){let e=document.createElement(r);return y.record(e,t),e}function Je(r){let t=document.createDocumentFragment();return x(r,t),t.firstElementChild}function Lt(r,t){let e=[];for(let[s,o]of Object.entries(t))if(typeof o=="function")r.addEventListener(s,o),e.push(()=>r.removeEventListener(s,o));else{let[n,i]=o;r.addEventListener(s,i,n),e.push(()=>r.removeEventListener(s,i))}return()=>e.forEach(s=>s())}function Xe(r,t){let e=new MutationObserver(t);return e.observe(r,{attributes:!0}),()=>e.disconnect()}var Nt=class{element;constructor(t){this.element=t}strings=new Proxy({},{get:(t,e)=>E.string(this.element,e),set:(t,e,s)=>y.string(this.element,e,s)});numbers=new Proxy({},{get:(t,e)=>E.number(this.element,e),set:(t,e,s)=>y.number(this.element,e,s)});booleans=new Proxy({},{get:(t,e)=>E.boolean(this.element,e),set:(t,e,s)=>y.boolean(this.element,e,s)})};var Qe=(r,t,e={})=>new Proxy(t,{get:(s,o)=>{switch(t[o]){case String:return E.string(r,o);case Number:return E.number(r,o);case Boolean:return E.boolean(r,o);default:throw new Error(`invalid attribute type for "${o}"`)}},set:(s,o,n)=>{try{switch(e.beforeSet?.(o),t[o]){case String:return y.string(r,o,n);case Number:return y.number(r,o,n);case Boolean:return y.boolean(r,o,n);default:throw new Error(`invalid attribute type for "${o}"`)}}finally{e.afterSet?.(o)}}});function Q(r){let t=new Nt(r);return{strings:t.strings,numbers:t.numbers,booleans:t.booleans,on:e=>Xe(r,e),spec:(e,s={})=>Qe(r,e,s)}}Q.get=E;Q.set=y;function Ze(r){return new we(r)}var we=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,s]of Object.entries(t))this.attr(e,s);return this}children(...t){return this.#e.push(...t),this}done(){let t=document.createElement(this.tagName);return y.entries(t,this.#t),t.append(...this.#e),t}};function Z(r,t=document){let e=t.querySelector(r);if(!e)throw new Error(`element not found (${r})`);return e}function jt(r,t=document){return t.querySelector(r)}function Dt(r,t=document){return Array.from(t.querySelectorAll(r))}var Ht=class r{element;#t;constructor(t){this.element=t}in(t){return new r(typeof t=="string"?Z(t,this.element):t)}require(t){return Z(t,this.element)}maybe(t){return jt(t,this.element)}all(t){return Dt(t,this.element)}render(...t){return x(t,this.element)}get attrs(){return this.#t??=Q(this.element)}events(t){return Lt(this.element,t)}};function tr(r){return r.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}function er(r,t={}){let{soft:e=!1,upgrade:s=!0}=t;for(let[o,n]of Object.entries(r)){let i=tr(o),c=customElements.get(i);e&&c||(customElements.define(i,n),s&&document.querySelectorAll(i).forEach(a=>{a.constructor===HTMLElement&&customElements.upgrade(a)}))}}function w(r,t=document){return Z(r,t)}w.in=(r,t=document)=>new Ht(t).in(r);w.need=Z;w.maybe=jt;w.all=Dt;w.el=Ye;w.elmer=Ze;w.mk=Je;w.events=Lt;w.attrs=Q;w.register=er;w.render=(r,...t)=>x(t,r);function rr(r,t){let e,s,o=[];function n(){e=[],s&&clearTimeout(s),s=void 0,o=[]}return n(),((...i)=>{e=i,s&&clearTimeout(s);let c=new Promise((a,u)=>{o.push({resolve:a,reject:u})});return s=setTimeout(()=>{Promise.resolve().then(()=>t(...e)).then(a=>{for(let{resolve:u}of o)u(a);n()}).catch(a=>{for(let{reject:u}of o)u(a);n()})},r),c})}function sr(){let r,t,e=new Promise((s,o)=>{r=s,t=o});return e.resolve=r,e.reject=t,e.promise=e,e.entangle=s=>(s.then(r,t),e),e}var $={};Kr($,{clone:()=>lt,equal:()=>is,freeze:()=>as});function lt(r,t=new Set){if(t.has(r))throw new Error("cannot clone circular reference");let e;return typeof r=="function"||r!==null&&typeof r=="object"?(t.add(r),Array.isArray(r)?e=r.map(s=>lt(s,new Set(t))):r.constructor===Object?e=Object.fromEntries(Object.entries(r).map(([s,o])=>[s,lt(o,new Set(t))])):r instanceof Map?e=new Map(Array.from(r,([s,o])=>[s,lt(o,new Set(t))])):r instanceof Set?e=new Set(Array.from(r,s=>lt(s,new Set(t)))):r instanceof Date?e=new Date(r.getTime()):e=r,t.delete(r)):e=r,e}function os(r){return r!=null}function ns(r){return r==null}var ft=Object.freeze({happy:os,sad:ns,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 is=(r,t)=>{function e(s,o,n){if(!ft.object(s)||!ft.object(o))return s===o;if(n.includes(s))throw new Error("forbidden circularity detected in deep equal comparison");let i=[...n,s];if(s instanceof Map&&o instanceof Map){if(s.size!==o.size)return!1;for(let[c,a]of s)if(!o.has(c)||!e(a,o.get(c),i))return!1}else if(s instanceof Set&&o instanceof Set){if(s.size!==o.size)return!1;for(let c of s)if(!Array.from(o).some(a=>e(c,a,i)))return!1}else{let c=Object.keys(s),a=Object.keys(o);if(c.length!==a.length)return!1;for(let u of c)if(!a.includes(u)||!e(s[u],o[u],i))return!1}return!0}return e(r,t,[])};function as(r){function t(e,s){if(!ft.object(e)||s.includes(e))return e;let o=[...s,e];if(e instanceof Map)for(let n of e.entries())for(let i of n)t(i,o);else if(e instanceof Set)for(let n of e)t(n,o);else if(Array.isArray(e))for(let n of e)t(n,o);else for(let n of Object.values(e))t(n,o);return Object.freeze(e)}return t(r,[])}function or(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 nr(r){if(r.ok)throw new Error("didn't get needed error");return r.error}function ir(r,t,e=typeof t=="string"?`needed key not found "${t}"`:"needed key not found"){if(r.has(t))return r.get(t);throw new Error(e)}function tt(r,t,e){if(r.has(t))return r.get(t);{let s=e();return r.set(t,s),s}}function mt(r,t){for(let[e,s]of t)r.set(e,s);return r}function Ut(){let r=[];function t(){let e=r;r=[];for(let s=e.length-1;s>=0;s--)e[s]()}return t.schedule=(...e)=>(r.push(...e),t),t.own=(e,s)=>(r.push(()=>s(e)),e),t}function V(r,t){let e=Object.entries(t);for(let[s,o]of e)r.addEventListener(s,o);return()=>{for(let[s,o]of e)r.removeEventListener(s,o)}}function $e(r){return new be(r)}var be=class r{#t;static with=$e;constructor(t){this.#t=t}to(t){return new r(t(this.#t))}done(){return this.#t}line(...t){let e=this.#t;for(let s of t)e=s(e);return e}};function cs(){let r=new Set;async function t(...a){await Promise.all([...r].map(u=>u(...a)))}function e(a){return r.add(a),()=>{r.delete(a)}}async function s(...a){return t(...a)}function o(a){return e(a)}async function n(a){let{promise:u,resolve:l}=sr(),h=o(async(...f)=>{a&&await a(...f),l(f),h()});return u}function i(){r.clear()}let c={pub:s,sub:o,publish:t,subscribe:e,on:e,next:n,clear:i};return Object.assign(o,c),Object.assign(s,c),c}function ar(r){let t=cs();return r&&t.sub(r),t.sub}var zt=class{#t=new Set;#e=[];#r=new WeakMap;#o=0;#s=new Set;read(t){this.#e.at(-1)?.add(t)}write(t){let e=this.#r.get(t);if(e){for(let s of e)this.#s.add(s);this.#o===0&&this.#n()}}observe(t){let e=new Set;this.#e.push(e);try{let s=t();return{seen:e,value:s}}finally{this.#e.pop()}}subscribe(t,e){let s=tt(this.#r,t,()=>new Set);return s.add(e),()=>{s.delete(e),s.size===0&&this.#r.delete(t)}}batch=t=>{this.#o++;try{return t()}finally{this.#o--,this.#o===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 p=globalThis[Symbol.for("e280.tracker.2")]??=new zt;function L(r){function t(){return arguments.length===0?(p.read(t),r):(r=arguments[0],p.write(t),r)}return t.get=()=>t(),t.set=e=>t(e),t}function Ae(r,t){let{seen:e,value:s}=p.observe(r),o=[...e].map(i=>p.subscribe(i,t));return{value:s,dispose:()=>o.forEach(i=>i())}}function et(r){let t,e=!0,s=!1,o=!1,n=()=>{},i=()=>{n(),n=()=>{},e=!0},c=()=>{(!e||s)&&(e=!0,p.write(u))},a=()=>{if(o)throw new Error("derived circularity forbidden");o=!0;try{let l=Ae(r,()=>c());n(),n=l.dispose,t=l.value,e=!1,s=!1}catch(l){throw s=!0,l}finally{o=!1}};function u(){return p.read(u),e&&a(),t}return u.get=()=>u(),u.dispose=i,u}var R=class extends Map{get size(){return p.read(this),super.size}[Symbol.iterator](){return p.read(this),super[Symbol.iterator]()}forEach(t){p.read(this);for(let[e,s]of this)t(s,e,this);return this}keys(){return p.read(this),super.keys()}values(){return p.read(this),super.values()}entries(){return p.read(this),super.entries()}has(t){return p.read(this),super.has(t)}get(t){return p.read(this),super.get(t)}set(t,e){return super.set(t,e),p.write(this),this}delete(t){let e=super.delete(t);return p.write(this),e}clear(){return super.clear(),p.write(this),this}};var dt=class extends Set{get size(){return p.read(this),super.size}[Symbol.iterator](){return p.read(this),super[Symbol.iterator]()}forEach(t){p.read(this);for(let e of this)t(e,e,this);return this}values(){return p.read(this),super.values()}has(t){return p.read(this),super.has(t)}add(t){return super.add(t),p.write(this),this}delete(t){let e=super.delete(t);return p.write(this),e}clear(){return super.clear(),p.write(this),this}};var Ln=p.batch;function cr(r){return $.freeze($.clone(r))}var C=Symbol("optic");var gt=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 qt=class r{[C];#t;#e;#r;constructor(t){this[C]=t,this.#t=$.clone(t.getState()),this.#e=new gt(()=>$.clone(t.getState())),this.#r=new gt(()=>cr(t.getState()))}update(){let t=this[C].getState();!$.equal(t,this.#t)&&(this.#e.invalidate(),this.#r.invalidate(),this.#t=$.clone(t),p.write(this))}get state(){return p.read(this),this.#e.get()}get frozen(){return p.read(this),this.#r.get()}mutate(t){return this[C].mutate(t)}lens(t){let e=new r({getState:()=>t(this[C].getState()),mutate:s=>this[C].mutate(o=>s(t(o))),registerLens:this[C].registerLens});return this[C].registerLens(e),e}};var Bt=class{key;storage;constructor(t,e=window.localStorage){this.key=t,this.storage=e}async get(){let t=this.storage.getItem(this.key);return t?JSON.parse(t):void 0}async set(t){let e=JSON.stringify(t);this.storage.setItem(this.key,e)}onStorageEvent(t){let e=s=>{s.storageArea===this.storage&&s.key===this.key&&t()};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)}};function ur(r){if(!r.done)throw new Error("wait not done");return or(r)}function pr(r){if(!r.done)throw new Error("wait not done");return nr(r)}var hr=r=>!r.done;var ve=r=>r.done&&r.ok;function lr(r,t){let{pending:e=()=>{},ok:s=()=>{},err:o=()=>{}}=t;return hr(r)?e():ve(r)?s(ur(r)):o(pr(r))}function xt(){let r,t,e=new Promise((o,n)=>{r=o,t=n});function s(o){return o.then(r).catch(t),e}return{promise:e,resolve:r,reject:t,entangle:s}}function It(r){let t=null;return((...e)=>(t?t.params=e:(t={params:e,deferred:xt()},queueMicrotask(()=>{let{params:s,deferred:o}=t;t=null,Promise.resolve(r(...s)).then(o.resolve).catch(o.reject)})),t.deferred.promise))}function fr(r,t,e){if(r.has(t))return r.get(t);{let s=e();return r.set(t,s),s}}function mr(r){let t,e=!1,s=()=>{e=!0,clearTimeout(t)},o=async()=>{e||(await r(s),!e&&(t=setTimeout(o,0)))};return o(),s}var dr=(r=0)=>new Promise(t=>setTimeout(t,r));var Vt=A`
4
4
  * {
5
5
  margin: 0;
6
6
  padding: 0;
@@ -14,24 +14,24 @@ var Ir=Object.defineProperty;var Vr=(r,t)=>{for(var e in t)Ir(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 Wt=class r extends HTMLElement{static register(){w.register({SlyShadow:r},{soft:!0})}connectedCallback(){this.hasAttribute("view")||this.setAttribute("view","")}};var Kt=class{render;count=0;rendered=W();constructor(t){this.render=t}doneRender(){this.count++,this.rendered.resolve(),this.rendered=W()}},D=class extends Kt{host;shadow;constructor(t,e,s){super(t),this.host=e,this.shadow=s}};var _e=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()}}},v=globalThis[Symbol.for("e280.hooks")]??=new _e;var G=class{#t=[];clear(){this.#t.forEach(t=>t()),this.#t=[]}observe(t,e){let{seen:s,value:o}=p.observe(t);this.clear();for(let n of s){let i=p.subscribe(n,e);this.#t.push(i)}return o}};var Gt=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 F=class{cx;position=0;values=new Map;mounts=new Gt;constructor(t){this.cx=t}};var{I:Ka}=Fe;var mr=r=>r.strings===void 0;var dr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Yt=r=>(...t)=>({_$litDirective$:r,values:t}),Ft=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var yt=(r,t)=>{let e=r._$AN;if(e===void 0)return!1;for(let s of e)s._$AO?.(t,!1),yt(s,t);return!0},Jt=r=>{let t,e;do{if((t=r._$AM)===void 0)break;e=t._$AN,e.delete(r),r=t}while(e?.size===0)},gr=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),ds(t)}};function fs(r){this._$AN!==void 0?(Jt(this),this._$AM=r,gr(this)):this._$AM=r}function ms(r,t=!1,e=0){let s=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(t)if(Array.isArray(s))for(let n=e;n<s.length;n++)yt(s[n],!1),Jt(s[n]);else s!=null&&(yt(s,!1),Jt(s));else yt(this,r)}var ds=r=>{r.type==dr.CHILD&&(r._$AP??=ms,r._$AQ??=fs)},wt=class extends Ft{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),gr(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(yt(this,t),Jt(this))}setValue(t){if(mr(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 xr(r){return class extends HTMLElement{#t;#e;#r=new G;#o=this.attachShadow({mode:"open"});constructor(){super();let t=Ut(()=>{if(!this.isConnected)return;let e=this.#s();x(e,this.#t.shadow),this.#t.doneRender()});this.#t=new D(t,this,this.#o),this.#e=new F(this.#t)}#s(){return this.#r.observe(()=>v.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.#r.clear()}}}function _(r){let{scope:t,position:e}=v.increment();return L(t.values,e,r)}function bt(){return v.increment().scope.cx}function Xt(){let r=bt();if(!(r instanceof D))throw new Error("this hook only works on shadow views (but was called in a light view)");return r}function Se(){return Xt().host}function st(r){let{scope:t}=v.increment();return _(()=>t.mounts.mount(r))}function wr(){return Xt().shadow}function br(r,t){Et(r,xs(t))}function xs(r){let t=[];if(Array.isArray(r)){let e=new Set(r.flat(1/0).reverse());for(let s of e)t.unshift(X(s))}else r!==void 0&&t.push(X(r));return t}function ot(...r){let t=wr();_(()=>br(t,r))}function nt(r=""){let t=Se();_(()=>t.setAttribute("view",r))}function $r(r){return _(()=>N(r))}var Qt=ot;function vr(r,t){for(let[e,s]of Object.entries(t))ws(r,e,s)}function ws(r,t,e){let s=r.getAttribute(t),o=bs(e);o!==s&&(o===null?r.removeAttribute(t):r.setAttribute(t,o))}function bs(r){return typeof r=="string"?r:typeof r=="number"?r.toString():r?"":null}function $s(){Wt.register();let r=document.createElement("sly-shadow"),t=r.attachShadow({mode:"open"});return{host:r,shadow:t}}function Y(r){return _r($s,r)}Y.setup=r=>(t=>_r(r,t));function _r(r,t){let e=Yt(class extends wt{#t;#e;#r;#o=new G;constructor(o){super(o);let{host:n,shadow:i}=r(),c=Ut(()=>{if(!this.#r)throw new Error("cannot render before props");if(!this.isConnected)return;let a=this.#s(this.#r);x(a,this.#t.shadow),this.#t.doneRender()});this.#t=new D(c,n,i),this.#e=new F(this.#t)}#s(o){return this.#r=o,this.#o.observe(()=>v.wrap(this.#e,()=>t(...this.#r)),this.#t.render)}render({props:o,children:n,attrs:i}){let{host:c}=this.#t;return this.isConnected&&(i&&vr(c,i),x(n,this.#t.host),x(this.#s(o),this.#t.shadow),this.#t.doneRender()),c}disconnected(){x(null,this.#t.shadow),x(null,this.#t.host),this.#e.mounts.unmountAll(),this.#o.clear()}reconnected(){this.#e.mounts.remountAll(),this.#t.render()}});function s(...o){return e({props:o})}return s.with=e,s}function M(r,t){return()=>As({hz:r,frames:t})}var As=Y(({hz:r,frames:t})=>{nt("loading"),Qt(Vt,vs);let e=$r(0);return st(()=>ir(async()=>{await ar(1e3/r);let s=e()+1;e(s>=t.length?0:s)})),t.at(e())}),vs=A`
17
+ `;var Wt=class r extends HTMLElement{static register(){w.register({SlyShadow:r},{soft:!0})}connectedCallback(){this.hasAttribute("view")||this.setAttribute("view","")}};var Kt=class{render;count=0;rendered=xt();constructor(t){this.render=t}doneRender(){this.count++,this.rendered.resolve(),this.rendered=xt()}},N=class extends Kt{host;shadow;constructor(t,e,s){super(t),this.host=e,this.shadow=s}};var _e=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()}}},v=globalThis[Symbol.for("e280.hooks")]??=new _e;var W=class{#t=[];clear(){this.#t.forEach(t=>t()),this.#t=[]}observe(t,e){let{seen:s,value:o}=p.observe(t);this.clear();for(let n of s){let i=p.subscribe(n,e);this.#t.push(i)}return o}};var Gt=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 Gt;constructor(t){this.cx=t}};var{I:Ya}=Fe;var gr=r=>r.strings===void 0;var xr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Yt=r=>(...t)=>({_$litDirective$:r,values:t}),Ft=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var yt=(r,t)=>{let e=r._$AN;if(e===void 0)return!1;for(let s of e)s._$AO?.(t,!1),yt(s,t);return!0},Jt=r=>{let t,e;do{if((t=r._$AM)===void 0)break;e=t._$AN,e.delete(r),r=t}while(e?.size===0)},yr=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),gs(t)}};function ms(r){this._$AN!==void 0?(Jt(this),this._$AM=r,yr(this)):this._$AM=r}function ds(r,t=!1,e=0){let s=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(t)if(Array.isArray(s))for(let n=e;n<s.length;n++)yt(s[n],!1),Jt(s[n]);else s!=null&&(yt(s,!1),Jt(s));else yt(this,r)}var gs=r=>{r.type==xr.CHILD&&(r._$AP??=ds,r._$AQ??=ms)},wt=class extends Ft{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),yr(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(yt(this,t),Jt(this))}setValue(t){if(gr(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 wr(r){return class extends HTMLElement{#t;#e;#r=new W;#o=this.attachShadow({mode:"open"});constructor(){super();let t=It(()=>{if(!this.isConnected)return;let e=this.#s();x(e,this.#t.shadow),this.#t.doneRender()});this.#t=new N(t,this,this.#o),this.#e=new K(this.#t)}#s(){return this.#r.observe(()=>v.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.#r.clear()}}}function _(r){let{scope:t,position:e}=v.increment();return fr(t.values,e,r)}function bt(){return v.increment().scope.cx}function Xt(){let r=bt();if(!(r instanceof N))throw new Error("this hook only works on shadow views (but was called in a light view)");return r}function Se(){return Xt().host}function rt(r){let{scope:t}=v.increment();return _(()=>t.mounts.mount(r))}function $r(){return Xt().shadow}function Ar(r,t){Et(r,ys(t))}function ys(r){let t=[];if(Array.isArray(r)){let e=new Set(r.flat(1/0).reverse());for(let s of e)t.unshift(Y(s))}else r!==void 0&&t.push(Y(r));return t}function st(...r){let t=$r();_(()=>Ar(t,r))}function ot(r=""){let t=Se();_(()=>t.setAttribute("view",r))}function vr(r){return _(()=>L(r))}var Qt=st;function Sr(r,t){for(let[e,s]of Object.entries(t))bs(r,e,s)}function bs(r,t,e){let s=r.getAttribute(t),o=$s(e);o!==s&&(o===null?r.removeAttribute(t):r.setAttribute(t,o))}function $s(r){return typeof r=="string"?r:typeof r=="number"?r.toString():r?"":null}function As(){Wt.register();let r=document.createElement("sly-shadow"),t=r.attachShadow({mode:"open"});return{host:r,shadow:t}}function G(r){return Er(As,r)}G.setup=r=>(t=>Er(r,t));function Er(r,t){let e=Yt(class extends wt{#t;#e;#r;#o=new W;constructor(o){super(o);let{host:n,shadow:i}=r(),c=It(()=>{if(!this.#r)throw new Error("cannot render before props");if(!this.isConnected)return;let a=this.#s(this.#r);x(a,this.#t.shadow),this.#t.doneRender()});this.#t=new N(c,n,i),this.#e=new K(this.#t)}#s(o){return this.#r=o,this.#o.observe(()=>v.wrap(this.#e,()=>t(...this.#r)),this.#t.render)}render({props:o,children:n,attrs:i}){let{host:c}=this.#t;return this.isConnected&&(i&&Sr(c,i),x(n,this.#t.host),x(this.#s(o),this.#t.shadow),this.#t.doneRender()),c}disconnected(){x(null,this.#t.shadow),x(null,this.#t.host),this.#e.mounts.unmountAll(),this.#o.clear()}reconnected(){this.#e.mounts.remountAll(),this.#t.render()}});function s(...o){return e({props:o})}return s.with=e,s}function M(r,t){return()=>vs({hz:r,frames:t})}var vs=G(({hz:r,frames:t})=>{ot("loading"),Qt(Vt,_s);let e=vr(0);return rt(()=>mr(async()=>{await dr(1e3/r);let s=e()+1;e(s>=t.length?0:s)})),t.at(e())}),_s=A`
18
18
  :host {
19
19
  font-family: monospace;
20
20
  white-space: pre;
21
21
  user-select: none;
22
22
  }
23
- `;var k=Y(r=>(nt("error"),Qt(Vt,_s),typeof r=="string"?r:r instanceof Error?b`<strong>${r.name}:</strong> <span>${r.message}</span>`:"error")),_s=A`
23
+ `;var k=G(r=>(ot("error"),Qt(Vt,Ss),typeof r=="string"?r:r instanceof Error?b`<strong>${r.name}:</strong> <span>${r.message}</span>`:"error")),Ss=A`
24
24
  :host {
25
25
  font-family: monospace;
26
26
  color: red;
27
27
  }
28
- `;function P(r,t){return(e,s)=>fr(e,{pending:r,err:t,ok:s})}var Up=P(M(10,[" "," ",". ",".. ","..."," .."," ."]),k);var Vp=P(M(3,["\u{1F30E}","\u{1F30F}","\u{1F30D}"]),k);var Yp=P(M(10,["\u{1F312}","\u{1F313}","\u{1F314}","\u{1F315}","\u{1F316}","\u{1F317}","\u{1F318}","\u{1F311}","\u{1F311}","\u{1F311}"]),k);var th=P(M(16,["|","/","-","\\"]),k);var nh=P(M(20,[":....",":....","::...",".::..","..::.","...::","....:","....:","...::","..::.",".::..","::..."]),k);var Zt=class{#t;#e;constructor(t){this.#t=t,this.#e=rt(()=>[...this.#t.controllers].filter(e=>this.#t.portAssignments.get(e)===this))}get controllers(){return this.#e()}plug(t){this.#t.portAssignments.set(t,this)}unplug(t){this.#t.portAssignments.delete(t)}resolveIntents(t){return this.controllers.flatMap(e=>e.resolveIntents(t))}};var te=class{ports=new gt;controllers=new gt;portAssignments=new R};function Sr(r){return r.length>0?Math.max(...r):0}function Er(r){return r.length>0?Math.min(...r):0}function Cr([,,r],t){return{lastValue:0,holdStart:t,settings:Es(r)}}function Ss(){return{scale:1,invert:!1,clamp:null,range:null,bottom:null,top:null,timing:["direct"]}}function Es(r={}){return{...Ss(),...r}}function it(r){return r!==0}var{min:Cs,max:Ms,abs:ks,sign:Ps,floor:Th,ceil:Oh,pow:Rh}=Math;function Mr(r,t=0,e=1){let s=Math.min(t,e),o=Math.max(t,e);return r>=s&&r<=o}function S(r,t=0,e=1){return r=Cs(r,e),r=Ms(r,t),r}function Ts(r,t,e,s){let n=(e-t)*r;return s!==void 0&&ks(n)>s&&(n=Ps(n)*s),t+n}function Os(r,t,e){return(r-t)/(e-t)}function kr(r,t,e,s=0,o=1,n=!1){let i=Os(r,t,e);return n&&(i=S(i)),Ts(i,s,o)}var $t=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 all(t){return new this(t,t)}static from(t){return Array.isArray(t)?new this(...t):new this(t.x,t.y)}static magnitudeSquared(t,e){return t*t+e*e}static magnitude(t,e){return Math.sqrt(this.magnitudeSquared(t,e))}static average(...t){return 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]}tuple(){return this.array()}toJSON(){return this.array()}toString(){return`(${this.constructor.name} x${this.x.toFixed(2)}, y${this.y.toFixed(2)})`}set_(t,e){return this.x=t,this.y=e,this}set({x:t,y:e}){return this.x=t,this.y=e,this}from(t){if(Array.isArray(t)){let[e,s]=t;this.x=e,this.y=s}else{let{x:e,y:s}=t;this.x=e,this.y=s}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:s})=>this.equals_(e,s))}near_(t,e,s=1e-6){return Math.abs(this.x-t)<=s&&Math.abs(this.y-e)<=s}near({x:t,y:e},s=1e-6){return this.near_(t,e,s)}dot_(t,e){return this.x*t+this.y*e}dot({x:t,y:e}){return this.dot_(t,e)}distanceSquared_(t,e){return t=this.x-t,e=this.y-e,t*t+e*e}distanceSquared({x:t,y:e}){return this.distanceSquared_(t,e)}distance_(t,e){return Math.sqrt(this.distanceSquared_(t,e))}distance({x:t,y:e}){return this.distance_(t,e)}angleBetween_(t,e){let s=this.dot_(t,e),o=this.magnitude()*r.magnitude(t,e);if(o===0)return 0;let n=S(s/o,-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:s}=this;return this.x=e*Math.cos(t)-s*Math.sin(t),this.y=e*Math.sin(t)+s*Math.cos(t),this}perpendicular(){let{x:t,y:e}=this;return this.x=-e,this.y=t,this}clampMagnitude(t){return this.magnitude()>t&&this.normalize().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=S(this.x,t.x,e.x),this.y=S(this.y,t.y,e.y),this}clampBy(t=0,e=1){return this.x=S(this.x,t,e),this.y=S(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:s}of t)this.add_(e,s);return this}sub_(t,e){return this.x-=t,this.y-=e,this}sub(...t){for(let{x:e,y:s}of t)this.sub_(e,s);return this}mul_(t,e){return this.x*=t,this.y*=e,this}mul(...t){for(let{x:e,y:s}of t)this.mul_(e,s);return this}div_(t,e){return t!==0&&(this.x/=t),e!==0&&(this.y/=e),this}div(...t){for(let{x:e,y:s}of t)this.div_(e,s);return this}lerp_(t,e,s){return this.x+=(t-this.x)*s,this.y+=(e-this.y)*s,this}lerp(t,{x:e,y:s}){return this.lerp_(t,e,s)}reflect_(t,e){let s=2*this.dot_(t,e);return this.x-=s*t,this.y-=s*e,this}reflect({x:t,y:e}){return this.reflect_(t,e)}rotateAroundPoint_(t,e,s){let o=this.x-e,n=this.y-s,i=Math.cos(t),c=Math.sin(t);return this.x=i*o-c*n+e,this.y=c*o+i*n+s,this}rotateAroundPoint(t,{x:e,y:s}){return this.rotateAroundPoint_(t,e,s)}};var Pr=(r,t,e)=>$e(e).line(function(o){let{settings:n}=t;if(n.clamp){let[i,c]=n.clamp;o=S(o,i,c)}if(n.range){let[i,c]=n.range;o=Mr(o,i,c)?kr(o,i,c,0,1,!0):0}return n.bottom&&(o=o<n.bottom?0:o),n.top&&(o=Math.min(n.top,o)),o},function(o){return t.settings.invert?1-o:o},function(o){return t.settings.scale*o},function(o){let{settings:n}=t,i=(n.timing[0]==="direct"?void 0:n.timing[1])??250,c=!it(t.lastValue)&&it(o),a=it(t.lastValue)&&!it(o);c&&(t.holdStart=r);let u=r-t.holdStart>=i;switch(t.lastValue=o,n.timing[0]){case"direct":return o;case"tap":return a&&!u?1:0;case"hold":return it(o)&&u?o:0;default:throw new Error("unknown bindings timing")}});var j=class extends Map{constructor(t){if(super(),t)for(let[e,s]of t)this.set(e,s)}zero(){for(let t of this.keys())this.set(t,0);return this}merge([t,e]){let s=this.get(t)??0;return e>s&&this.set(t,e),this}};function Ee([r],[t]){return r===t?0:r<t?-1:1}function Tr(r){r=structuredClone(r);let t=new Map;return Object.entries(r).sort(Ee).flatMap(([e,s])=>Object.entries(s).sort(Ee).map(([o,n])=>({mode:e,action:o,atom:n}))).forEach((e,s)=>{t.set(s,{...e,id:s})}),t}function Ce(r){let t=Tr(r),e=new j,s=new Map,o=new Map;for(let c of t.values())o.set(c.id,0);let n=(c,a,u,l)=>{let h=L(s,a.join("/"),()=>Cr(["code",u,l],c)),f=e.get(u)??0;return Pr(c,h,f)},i=(c,a)=>(u,l)=>{let h=[...a,String(l),typeof u=="string"?u:u[0]],f=i(c,h);if(typeof u=="string")return n(c,h,u);switch(u[0]){case"code":{let[,m,d]=u;return n(c,h,m,d)}case"and":{let[,...m]=u,d=m.map(f);return Er(d)}case"or":{let[,...m]=u,d=m.map(f);return Sr(d)}case"not":{let[,m]=u;return f(m,"subject")>0?0:1}case"cond":{let[,m,d]=u;return f(d,"guard")>0?f(m,"subject"):0}case"mods":{let[,m,d]=u,vt=(Br,...Te)=>Br?["or",...Te]:["not",["or",...Te]];return f(["cond",m,["and",vt(d.ctrl??!1,"ControlLeft","ControlRight"),vt(d.alt??!1,"AltLeft","AltRight"),vt(d.meta??!1,"MetaLeft","MetaRight"),vt(d.shift??!1,"ShiftLeft","ShiftRight")]],"guard")>0?f(m,"subject"):0}}};return(c,a)=>{e.zero();let u=[];for(let l of a)e.merge(l);for(let l of t.values()){let h=i(c,[])(l.atom,l.mode),f=o.get(l.id);h!==f&&(o.set(l.id,h),u.push([l.id,h]))}return u}}var ee=class{handle;device;#t;#e;constructor(t,e,s){this.handle=t,this.device=s,this.#t=e,this.#e=Ce(e)}get bindings(){return this.#t}set bindings(t){$.equal(this.#t,t)||(this.#t=t,this.#e=Ce(t))}resolveIntents(t){return this.#e(t,this.device.samples())}};var re=class{custom;stock;constructor(t,e){if(this.custom=e,this.stock=new R,dt(this.stock,Object.entries(t)),this.stock.size===0)throw new Error("must be at least one stock profile")}get all(){return[...this.stock,...this.custom]}normalizeKey(t){return t&&(this.stock.has(t)||this.custom.has(t))?t:this.defaultId}get defaultId(){return[...this.stock.keys()][0]}get(t){return this.need(this.normalizeKey(t))}need(t){return this.stock.get(t)??nr(this.custom,t)}};function Me(r,t){for(;t.length>r;)t.shift();return t}var Or=256,se=class{store;profileAssignments=new R;customProfiles=new R;constructor(t){this.store=t}async save(){await this.store.set({customProfiles:Me(Or,[...this.customProfiles]),profileAssignments:Me(Or,[...this.profileAssignments])})}async load(){let t=await this.store.get();this.customProfiles.clear(),this.profileAssignments.clear(),dt(this.customProfiles,t?.customProfiles??[]),dt(this.profileAssignments,t?.profileAssignments??[])}};var oe=class{profiles;settings;#t=new te;constructor(t){this.settings=new se(t.store),this.profiles=new re(t.stockProfiles,this.settings.customProfiles)}async load(){await this.settings.load();for(let t of this.#t.controllers.keys())this.#r(t)}#e=rr(100,()=>this.settings.save());get ports(){return[...this.#t.ports]}get controllers(){return[...this.#t.controllers]}get unassignedControllers(){return[...this.#t.controllers].filter(t=>!this.#t.portAssignments.get(t))}createPort(){let t=new Zt(this.#t);return this.#t.ports.add(t),t}deletePort(t){for(let e of t.controllers)t.unplug(e);this.#t.ports.delete(t)}createController(t,e,s){let o=L(this.settings.profileAssignments,t,()=>e),n=this.profiles.get(o),i=new ee(t,n.bindings,s);return this.#t.controllers.add(i),i}deleteController(t){this.#t.controllers.delete(t),this.#t.portAssignments.delete(t)}async assignControllerProfile(t,e){this.settings.profileAssignments.set(t.handle,e),this.#r(t),await this.#e()}queryController(t){let e=this.#t.portAssignments.get(t),s=this.settings.profileAssignments.get(t.handle),o=this.profiles.get(s);return{controller:t,port:e,profileKey:s,profile:o}}#r(t){let e=this.settings.profileAssignments.get(t.handle);t.bindings=this.profiles.get(e).bindings}};var ke=r=>r;var ne=class{set=new Set;#t=new j;constructor(...t){for(let e of t)this.set.add(e)}*samples(){this.#t.zero();for(let t of this.set)for(let e of t.samples())this.#t.merge(e);yield*this.#t}};var ie=class{get;constructor(t){this.get=t}get gamepad(){return this.get()}};function Rr(r,t){let e=r;return()=>{let s=t();return s!=null&&(e=s),e}}function Lr(r){let t=new Map;function e(){s(),o()}function s(){for(let i of navigator.getGamepads())if(i?.connected&&!t.has(i.index)){let c=()=>navigator.getGamepads()[i.index],a=new ie(Rr(i,c)),u=r(a);t.set(i.index,{pad:a,dispose:u})}}function o(){for(let[i,{pad:c,dispose:a}]of t)navigator.getGamepads()[c.gamepad.index]?.connected||(a(),t.delete(i))}e();let n=K(window,{gamepadconnected:e,gamepaddisconnected:e});return()=>{n();for(let{dispose:i}of t.values())i();t.clear()}}var H=class{on=cr();sampleMap=new j;setSample(t,e){return this.sampleMap.set(t,e),this.on.pub(t,e),this}zero(){for(let t of this.sampleMap.keys())this.setSample(t,0)}*samples(){yield*this.sampleMap}};function At(r){return r>=0?[r,0]:[0,Math.abs(r)]}var ae=class r extends H{client=new $t(0,0);movement=new $t(0,0);dispose=zt();constructor(t=window){super(),this.dispose.schedule(K(t,{pointerdown:e=>{let s=r.buttonCode(e);this.setSample(s,1)},pointerup:e=>{let s=r.buttonCode(e);this.setSample(s,0)},pointermove:e=>{this.client.x=e.clientX,this.client.y=e.clientY,this.movement.x+=e.movementX,this.movement.y+=e.movementY},wheel:e=>{this.sampleMap.set("pointer.wheel.right",0),this.sampleMap.set("pointer.wheel.left",0),this.sampleMap.set("pointer.wheel.up",0),this.sampleMap.set("pointer.wheel.down",0);for(let[s,o]of r.wheelCodes(e))this.setSample(s,o)}}))}static buttonCode(t){switch(t.button){case 0:return"pointer.button.left";case 1:return"pointer.button.middle";case 2:return"pointer.button.right";default:return`pointer.button.${t.button+1}`}}static wheelCodes(t){let e=[];return t.deltaX&&e.push([t.deltaX>0?"pointer.wheel.right":"pointer.wheel.left",t.deltaX]),t.deltaY&&e.push([t.deltaY>0?"pointer.wheel.down":"pointer.wheel.up",t.deltaY]),e}*samples(){this.#t(),yield*super.samples()}#t(){let[t,e]=this.movement,[s,o]=At(t),[n,i]=At(e);t&&(t>=0?this.setSample("pointer.move.right",Math.abs(o)):this.setSample("pointer.move.left",Math.abs(s))),e&&(e>=0?this.setSample("pointer.move.up",Math.abs(i)):this.setSample("pointer.move.down",Math.abs(n))),this.movement.set_(0,0)}};var ce=class extends H{pad;constructor(t){super(),this.pad=t}get gamepad(){return this.pad.gamepad}*samples(){this.#t(this.pad.gamepad),this.#e(this.pad.gamepad),yield*super.samples()}#t(t){let e=0;for(let[s,o]of t.buttons.entries()){let n=s+1,i=o.value;e=Math.max(e,i),this.setSample(`gamepad.button.${n}`,i)}this.setSample("gamepad.button.any",e)}#e(t){for(let[e,s]of t.axes.entries()){let o=e+1;this.setSample(`gamepad.axis.${o}`,s);let[n,i]=At(s);this.setSample(`gamepad.axis.${o}.neg`,n),this.setSample(`gamepad.axis.${o}.pos`,i)}}};var Nr=A`
28
+ `;function P(r,t){return(e,s)=>lr(e,{pending:r,err:t,ok:s})}var Bp=P(M(10,[" "," ",". ",".. ","..."," .."," ."]),k);var Gp=P(M(3,["\u{1F30E}","\u{1F30F}","\u{1F30D}"]),k);var Qp=P(M(10,["\u{1F312}","\u{1F313}","\u{1F314}","\u{1F315}","\u{1F316}","\u{1F317}","\u{1F318}","\u{1F311}","\u{1F311}","\u{1F311}"]),k);var sh=P(M(16,["|","/","-","\\"]),k);var ch=P(M(20,[":....",":....","::...",".::..","..::.","...::","....:","....:","...::","..::.",".::..","::..."]),k);var Zt=class{#t;#e;constructor(t){this.#t=t,this.#e=et(()=>[...this.#t.controllers].filter(e=>this.#t.portAssignments.get(e)===this))}get controllers(){return this.#e()}plug(t){this.#t.portAssignments.set(t,this)}unplug(t){this.#t.portAssignments.delete(t)}resolveIntents(t){return this.controllers.flatMap(e=>e.resolveIntents(t))}};var te=class{ports=new dt;controllers=new dt;portAssignments=new R};function Cr(r){return r.length>0?Math.max(...r):0}function Mr(r){return r.length>0?Math.min(...r):0}function kr([,,r],t){return{lastValue:0,holdStart:t,settings:Cs(r)}}function Es(){return{scale:1,invert:!1,clamp:null,range:null,bottom:null,top:null,timing:["direct"]}}function Cs(r={}){return{...Es(),...r}}function nt(r){return r!==0}var{min:Ms,max:ks,abs:Ps,sign:Ts,floor:Lh,ceil:Nh,pow:jh}=Math;function Pr(r,t=0,e=1){let s=Math.min(t,e),o=Math.max(t,e);return r>=s&&r<=o}function S(r,t=0,e=1){return r=Ms(r,e),r=ks(r,t),r}function Os(r,t,e,s){let n=(e-t)*r;return s!==void 0&&Ps(n)>s&&(n=Ts(n)*s),t+n}function Rs(r,t,e){return(r-t)/(e-t)}function Tr(r,t,e,s=0,o=1,n=!1){let i=Rs(r,t,e);return n&&(i=S(i)),Os(i,s,o)}var $t=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]}tuple(){return this.array()}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,s]=t;this.x=e,this.y=s}else{let{x:e,y:s}=t;this.x=e,this.y=s}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:s})=>this.equals_(e,s))}near_(t,e,s=1e-6){return Math.abs(this.x-t)<=s&&Math.abs(this.y-e)<=s}near({x:t,y:e},s=1e-6){return this.near_(t,e,s)}dot_(t,e){return this.x*t+this.y*e}dot({x:t,y:e}){return this.dot_(t,e)}distanceSquared_(t,e){return t=this.x-t,e=this.y-e,t*t+e*e}distanceSquared({x:t,y:e}){return this.distanceSquared_(t,e)}distance_(t,e){return Math.sqrt(this.distanceSquared_(t,e))}distance({x:t,y:e}){return this.distance_(t,e)}angleBetween_(t,e){let s=this.dot_(t,e),o=this.magnitude()*r.magnitude(t,e);if(o===0)return 0;let n=S(s/o,-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:s}=this;return this.x=e*Math.cos(t)-s*Math.sin(t),this.y=e*Math.sin(t)+s*Math.cos(t),this}perpendicular(){let{x:t,y:e}=this;return this.x=-e,this.y=t,this}clampMagnitude(t){return this.magnitude()>t&&this.normalize().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=S(this.x,t.x,e.x),this.y=S(this.y,t.y,e.y),this}clampBy(t=0,e=1){return this.x=S(this.x,t,e),this.y=S(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:s}of t)this.add_(e,s);return this}sub_(t,e){return this.x-=t,this.y-=e,this}sub(...t){for(let{x:e,y:s}of t)this.sub_(e,s);return this}mul_(t,e){return this.x*=t,this.y*=e,this}mul(...t){for(let{x:e,y:s}of t)this.mul_(e,s);return this}div_(t,e){return t!==0&&(this.x/=t),e!==0&&(this.y/=e),this}div(...t){for(let{x:e,y:s}of t)this.div_(e,s);return this}lerp_(t,e,s){return this.x+=(t-this.x)*s,this.y+=(e-this.y)*s,this}lerp(t,{x:e,y:s}){return this.lerp_(t,e,s)}reflect_(t,e){let s=2*this.dot_(t,e);return this.x-=s*t,this.y-=s*e,this}reflect({x:t,y:e}){return this.reflect_(t,e)}rotateAroundPoint_(t,e,s){let o=this.x-e,n=this.y-s,i=Math.cos(t),c=Math.sin(t);return this.x=i*o-c*n+e,this.y=c*o+i*n+s,this}rotateAroundPoint(t,{x:e,y:s}){return this.rotateAroundPoint_(t,e,s)}};var Or=(r,t,e)=>$e(e).line(function(o){let{settings:n}=t;if(n.clamp){let[i,c]=n.clamp;o=S(o,i,c)}if(n.range){let[i,c]=n.range;o=Pr(o,i,c)?Tr(o,i,c,0,1,!0):0}return n.bottom&&(o=o<n.bottom?0:o),n.top&&(o=Math.min(n.top,o)),o},function(o){return t.settings.invert?1-o:o},function(o){return t.settings.scale*o},function(o){let{settings:n}=t,i=(n.timing[0]==="direct"?void 0:n.timing[1])??250,c=!nt(t.lastValue)&&nt(o),a=nt(t.lastValue)&&!nt(o);c&&(t.holdStart=r);let u=r-t.holdStart>=i;switch(t.lastValue=o,n.timing[0]){case"direct":return o;case"tap":return a&&!u?1:0;case"hold":return nt(o)&&u?o:0;default:throw new Error("unknown bindings timing")}});var j=class extends Map{constructor(t){if(super(),t)for(let[e,s]of t)this.set(e,s)}zero(){for(let t of this.keys())this.set(t,0);return this}merge([t,e]){let s=this.get(t)??0;return e>s&&this.set(t,e),this}};function Ee([r],[t]){return r===t?0:r<t?-1:1}function Rr(r){r=structuredClone(r);let t=new Map;return Object.entries(r).sort(Ee).flatMap(([e,s])=>Object.entries(s).sort(Ee).map(([o,n])=>({mode:e,action:o,atom:n}))).forEach((e,s)=>{t.set(s,{...e,id:s})}),t}function Ce(r){let t=Rr(r),e=new j,s=new Map,o=new Map;for(let c of t.values())o.set(c.id,0);let n=(c,a,u,l)=>{let h=tt(s,a.join("/"),()=>kr(["code",u,l],c)),f=e.get(u)??0;return Or(c,h,f)},i=(c,a)=>(u,l)=>{let h=[...a,String(l),typeof u=="string"?u:u[0]],f=i(c,h);if(typeof u=="string")return n(c,h,u);switch(u[0]){case"code":{let[,m,d]=u;return n(c,h,m,d)}case"and":{let[,...m]=u,d=m.map(f);return Mr(d)}case"or":{let[,...m]=u,d=m.map(f);return Cr(d)}case"not":{let[,m]=u;return f(m,"subject")>0?0:1}case"cond":{let[,m,d]=u;return f(d,"guard")>0?f(m,"subject"):0}case"mods":{let[,m,d]=u,vt=(Vr,...Te)=>Vr?["or",...Te]:["not",["or",...Te]];return f(["cond",m,["and",vt(d.ctrl??!1,"ControlLeft","ControlRight"),vt(d.alt??!1,"AltLeft","AltRight"),vt(d.meta??!1,"MetaLeft","MetaRight"),vt(d.shift??!1,"ShiftLeft","ShiftRight")]],"guard")>0?f(m,"subject"):0}}};return(c,a)=>{e.zero();let u=[];for(let l of a)e.merge(l);for(let l of t.values()){let h=i(c,[])(l.atom,l.mode),f=o.get(l.id);h!==f&&(o.set(l.id,h),u.push([l.id,h]))}return u}}var ee=class{handle;device;#t;#e;constructor(t,e,s){this.handle=t,this.device=s,this.#t=e,this.#e=Ce(e)}get bindings(){return this.#t}set bindings(t){$.equal(this.#t,t)||(this.#t=t,this.#e=Ce(t))}resolveIntents(t){return this.#e(t,this.device.samples())}};var re=class{custom;stock;constructor(t,e){if(this.custom=e,this.stock=new R,mt(this.stock,Object.entries(t)),this.stock.size===0)throw new Error("must be at least one stock profile")}get all(){return[...this.stock,...this.custom]}normalizeKey(t){return t&&(this.stock.has(t)||this.custom.has(t))?t:this.defaultId}get defaultId(){return[...this.stock.keys()][0]}get(t){return this.need(this.normalizeKey(t))}need(t){return this.stock.get(t)??ir(this.custom,t)}};function Me(r,t){for(;t.length>r;)t.shift();return t}var Lr=256,se=class{store;profileAssignments=new R;customProfiles=new R;constructor(t){this.store=t}async save(){await this.store.set({customProfiles:Me(Lr,[...this.customProfiles]),profileAssignments:Me(Lr,[...this.profileAssignments])})}async load(){let t=await this.store.get();this.customProfiles.clear(),this.profileAssignments.clear(),mt(this.customProfiles,t?.customProfiles??[]),mt(this.profileAssignments,t?.profileAssignments??[])}};var oe=class{profiles;settings;#t=new te;constructor(t){this.settings=new se(t.store),this.profiles=new re(t.stockProfiles,this.settings.customProfiles)}async load(){await this.settings.load();for(let t of this.#t.controllers.keys())this.#r(t)}#e=rr(100,()=>this.settings.save());get ports(){return[...this.#t.ports]}get controllers(){return[...this.#t.controllers]}get unassignedControllers(){return[...this.#t.controllers].filter(t=>!this.#t.portAssignments.get(t))}createPort(){let t=new Zt(this.#t);return this.#t.ports.add(t),t}deletePort(t){for(let e of t.controllers)t.unplug(e);this.#t.ports.delete(t)}createController(t,e,s){let o=tt(this.settings.profileAssignments,t,()=>e),n=this.profiles.get(o),i=new ee(t,n.bindings,s);return this.#t.controllers.add(i),i}deleteController(t){this.#t.controllers.delete(t),this.#t.portAssignments.delete(t)}async assignControllerProfile(t,e){this.settings.profileAssignments.set(t.handle,e),this.#r(t),await this.#e()}queryController(t){let e=this.#t.portAssignments.get(t),s=this.settings.profileAssignments.get(t.handle),o=this.profiles.get(s);return{controller:t,port:e,profileKey:s,profile:o}}#r(t){let e=this.settings.profileAssignments.get(t.handle);t.bindings=this.profiles.get(e).bindings}};var ke=r=>r;var ne=class{set=new Set;#t=new j;constructor(...t){for(let e of t)this.set.add(e)}*samples(){this.#t.zero();for(let t of this.set)for(let e of t.samples())this.#t.merge(e);yield*this.#t}};var ie=class{get;constructor(t){this.get=t}get gamepad(){return this.get()}};function Nr(r,t){let e=r;return()=>{let s=t();return s!=null&&(e=s),e}}function jr(r){let t=new Map;function e(){s(),o()}function s(){for(let i of navigator.getGamepads())if(i?.connected&&!t.has(i.index)){let c=()=>navigator.getGamepads()[i.index],a=new ie(Nr(i,c)),u=r(a);t.set(i.index,{pad:a,dispose:u})}}function o(){for(let[i,{pad:c,dispose:a}]of t)navigator.getGamepads()[c.gamepad.index]?.connected||(a(),t.delete(i))}e();let n=V(window,{gamepadconnected:e,gamepaddisconnected:e});return()=>{n();for(let{dispose:i}of t.values())i();t.clear()}}var D=class{on=ar();sampleMap=new j;setSample(t,e){return this.sampleMap.set(t,e),this.on.pub(t,e),this}zero(){for(let t of this.sampleMap.keys())this.setSample(t,0)}*samples(){yield*this.sampleMap}};function At(r){return r>=0?[r,0]:[0,Math.abs(r)]}var ae=class r extends D{client=new $t;movement=new $t;dispose=Ut();constructor(t=window){super(),this.dispose.schedule(V(t,{pointerdown:e=>{let s=r.buttonCode(e);this.setSample(s,1)},pointerup:e=>{let s=r.buttonCode(e);this.setSample(s,0)},pointermove:e=>{this.client.x=e.clientX,this.client.y=e.clientY,this.movement.x+=e.movementX,this.movement.y+=e.movementY},wheel:e=>{this.sampleMap.set("pointer.wheel.right",0),this.sampleMap.set("pointer.wheel.left",0),this.sampleMap.set("pointer.wheel.up",0),this.sampleMap.set("pointer.wheel.down",0);for(let[s,o]of r.wheelCodes(e))this.setSample(s,o)}}))}static buttonCode(t){switch(t.button){case 0:return"pointer.button.left";case 1:return"pointer.button.middle";case 2:return"pointer.button.right";default:return`pointer.button.${t.button+1}`}}static wheelCodes(t){let e=[];return t.deltaX&&e.push([t.deltaX>0?"pointer.wheel.right":"pointer.wheel.left",t.deltaX]),t.deltaY&&e.push([t.deltaY>0?"pointer.wheel.down":"pointer.wheel.up",t.deltaY]),e}*samples(){this.#t(),yield*super.samples()}#t(){let{x:t,y:e}=this.movement,[s,o]=At(t),[n,i]=At(e);this.setSample("pointer.move.left",o),this.setSample("pointer.move.right",s),this.setSample("pointer.move.up",i),this.setSample("pointer.move.down",n),this.movement.set_(0,0)}};var ce=class extends D{pad;constructor(t){super(),this.pad=t}get gamepad(){return this.pad.gamepad}*samples(){this.#t(this.pad.gamepad),this.#e(this.pad.gamepad),yield*super.samples()}#t(t){let e=0;for(let[s,o]of t.buttons.entries()){let n=s+1,i=o.value;e=Math.max(e,i),this.setSample(`gamepad.button.${n}`,i)}this.setSample("gamepad.button.any",e)}#e(t){for(let[e,s]of t.axes.entries()){let o=e+1;this.setSample(`gamepad.axis.${o}`,s);let[n,i]=At(s);this.setSample(`gamepad.axis.${o}.neg`,n),this.setSample(`gamepad.axis.${o}.pos`,i)}}};var Dr=A`
29
29
 
30
30
  .plate {
31
31
  background: black;
32
32
  }
33
33
 
34
- `;var Dr=A`
34
+ `;var Hr=A`
35
35
 
36
36
  .deck {
37
37
  display: flex;
@@ -97,7 +97,7 @@ button[disabled] {
97
97
  opacity: 0.2;
98
98
  }
99
99
 
100
- `;var jr=Y((r,t={})=>{nt("desk"),ot(Dr);function e(c,a){let u=r.ports,l=r.queryController(c),h=u.indexOf(l.port),f=S(h+a,0,u.length-1),m=u.at(f);m&&m.plug(c)}function s(c,a){return b`
100
+ `;var Ur=G((r,t={})=>{ot("desk"),st(Hr);function e(c,a){let u=r.ports,l=r.queryController(c),h=u.indexOf(l.port),f=S(h+a,0,u.length-1),m=u.at(f);m&&m.plug(c)}function s(c,a){return b`
101
101
  <div class=port>
102
102
  <header>
103
103
  <span>P${a+1}</span>
@@ -156,10 +156,10 @@ button[disabled] {
156
156
  ${i.length>0?o(i):null}
157
157
  </div>
158
158
  </div>
159
- `});var Hr=(r,t={})=>xr(()=>(ot(Nr),b`
159
+ `});var zr=(r,t={})=>wr(()=>(st(Dr),b`
160
160
  <div class=plate>
161
- ${jr(r,t)}
161
+ ${Ur(r,t)}
162
162
  </div>
163
- `));var ue=class extends H{dispose=zt();constructor(t=window){super(),this.dispose.schedule(K(t,this.#t)),this.dispose.schedule(K(window,this.#e))}#t={keydown:t=>{if(t.repeat)return null;this.setSample(t.code,1),this.setSample("keyboard.any",1)},keyup:t=>{if(t.repeat)return null;this.setSample(t.code,0),this.setSample("keyboard.any",0)}};#e={blur:()=>{this.zero()}}};var Rs=ke({play:{action:["or","Space","pointer.button.left","gamepad.button.1"],up:["or","KeyW","gamepad.axis.2.pos"],down:["or","KeyS","gamepad.axis.2.neg"],left:["or","KeyA","gamepad.axis.1.pos"],right:["or","KeyD","gamepad.axis.1.neg"]}}),Ur=new It("tactDeck"),J=new oe({store:Ur,stockProfiles:{standard:{label:"\u{1F4DC}standard",bindings:Rs},micro:{label:"\u{1F9A0}micro",bindings:ke({play:{action:["or","Space","pointer.button.left","gamepad.button.1"],up:["or","KeyW","gamepad.axis.2.pos"],down:["or","KeyS","gamepad.axis.2.neg"],left:["or","KeyA","gamepad.axis.1.pos"],right:["or","KeyD","gamepad.axis.1.neg"]}})}}});await J.load();Ur.onStorageEvent(()=>J.load());var zr=J.createPort(),qr=J.createController("primary","standard",new ne(new ue,new ae));zr.plug(qr);var Pe=new Map().set(qr,"\u2328\uFE0F\u{1F5B1}keyboard+mouse");Lr(r=>{let t=`(${r.gamepad.index+1}) ${r.gamepad.id}`,e=J.createController(t,"standard",new ce(r));return Pe.set(e,`\u{1F3AE}${t}`),zr.plug(e),()=>J.deleteController(e)});w.register({DemoApp:Hr(J,{getControllerLabel:Pe.get.bind(Pe)})});
163
+ `));var ue=class extends D{dispose=Ut();constructor(t=window){super(),this.dispose.schedule(V(t,this.#t)),this.dispose.schedule(V(window,this.#e))}#t={keydown:t=>{if(t.repeat)return null;this.setSample(t.code,1),this.setSample("keyboard.any",1)},keyup:t=>{if(t.repeat)return null;this.setSample(t.code,0),this.setSample("keyboard.any",0)}};#e={blur:()=>{this.zero()}}};var Ls=ke({play:{action:["or","Space","pointer.button.left","gamepad.button.1"],up:["or","KeyW","gamepad.axis.2.pos"],down:["or","KeyS","gamepad.axis.2.neg"],left:["or","KeyA","gamepad.axis.1.pos"],right:["or","KeyD","gamepad.axis.1.neg"]}}),qr=new Bt("tactDeck"),F=new oe({store:qr,stockProfiles:{standard:{label:"\u{1F4DC}standard",bindings:Ls},micro:{label:"\u{1F9A0}micro",bindings:ke({play:{action:["or","Space","pointer.button.left","gamepad.button.1"],up:["or","KeyW","gamepad.axis.2.pos"],down:["or","KeyS","gamepad.axis.2.neg"],left:["or","KeyA","gamepad.axis.1.pos"],right:["or","KeyD","gamepad.axis.1.neg"]}})}}});await F.load();qr.onStorageEvent(()=>F.load());var Br=F.createPort(),Ir=F.createController("primary","standard",new ne(new ue,new ae));Br.plug(Ir);var Pe=new Map().set(Ir,"\u2328\uFE0F\u{1F5B1}keyboard+mouse");jr(r=>{let t=`(${r.gamepad.index+1}) ${r.gamepad.id}`,e=F.createController(t,"standard",new ce(r));return Pe.set(e,`\u{1F3AE}${t}`),Br.plug(e),()=>F.deleteController(e)});w.register({DemoApp:zr(F,{getControllerLabel:Pe.get.bind(Pe)})});
164
164
  /*! For license information please see main.bundle.min.js.LEGAL.txt */
165
165
  //# sourceMappingURL=main.bundle.min.js.map