lowlander 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +125 -38
  2. package/build/client/client.d.ts +5 -1
  3. package/build/client/client.js +15 -4
  4. package/build/client/client.js.map +1 -1
  5. package/build/dashboard/client/main.d.ts +1 -0
  6. package/build/dashboard/client/main.js +623 -0
  7. package/build/dashboard/client/main.js.map +1 -0
  8. package/build/dashboard/client/shim-server.d.ts +3 -0
  9. package/build/dashboard/client/shim-server.js +2 -0
  10. package/build/dashboard/client/shim-server.js.map +1 -0
  11. package/build/dashboard/dashboard.html +20 -0
  12. package/build/dashboard/index.d.ts +18 -0
  13. package/build/dashboard/index.d.ts.map +1 -0
  14. package/build/dashboard/index.js +50 -0
  15. package/build/dashboard/index.js.map +1 -0
  16. package/build/dashboard/serve.d.ts +18 -0
  17. package/build/dashboard/serve.d.ts.map +1 -0
  18. package/build/dashboard/serve.js +53 -0
  19. package/build/dashboard/serve.js.map +1 -0
  20. package/build/dashboard/server.d.ts +82 -0
  21. package/build/dashboard/server.d.ts.map +1 -0
  22. package/build/dashboard/server.js +248 -0
  23. package/build/dashboard/server.js.map +1 -0
  24. package/build/examples/helloworld/.edinburgh/commit_worker.log +3162 -0
  25. package/build/examples/helloworld/.edinburgh/data.mdb +0 -0
  26. package/build/examples/helloworld/.edinburgh/lock.mdb +0 -0
  27. package/build/examples/helloworld/client/index.html +1 -1
  28. package/build/examples/helloworld/client/js/base.css +1 -0
  29. package/build/examples/helloworld/client/js/base.js +217 -71
  30. package/build/examples/helloworld/client/js/base.js.map +1 -1
  31. package/build/examples/helloworld/server/api.d.ts +37 -26
  32. package/build/examples/helloworld/server/api.d.ts.map +1 -1
  33. package/build/examples/helloworld/server/api.js +38 -10
  34. package/build/examples/helloworld/server/api.js.map +1 -1
  35. package/build/examples/helloworld/server/main.d.ts +1 -1
  36. package/build/examples/helloworld/server/main.d.ts.map +1 -1
  37. package/build/examples/helloworld/server/main.js +6 -17
  38. package/build/examples/helloworld/server/main.js.map +1 -1
  39. package/build/server/password.d.ts +10 -0
  40. package/build/server/password.d.ts.map +1 -0
  41. package/build/server/password.js +38 -0
  42. package/build/server/password.js.map +1 -0
  43. package/build/server/protocol.d.ts +1 -0
  44. package/build/server/protocol.d.ts.map +1 -1
  45. package/build/server/protocol.js +1 -0
  46. package/build/server/protocol.js.map +1 -1
  47. package/build/server/server.d.ts +9 -9
  48. package/build/server/server.d.ts.map +1 -1
  49. package/build/server/server.js +21 -2
  50. package/build/server/server.js.map +1 -1
  51. package/build/server/wshandler.d.ts +7 -1
  52. package/build/server/wshandler.d.ts.map +1 -1
  53. package/build/server/wshandler.js +62 -14
  54. package/build/server/wshandler.js.map +1 -1
  55. package/build/tsconfig.client.tsbuildinfo +1 -1
  56. package/build/tsconfig.server.tsbuildinfo +1 -1
  57. package/client/client.ts +20 -6
  58. package/dashboard/build-bundle.ts +38 -0
  59. package/dashboard/client/index.html +12 -0
  60. package/dashboard/client/main.ts +566 -0
  61. package/dashboard/client/shim-server.ts +5 -0
  62. package/dashboard/index.ts +49 -0
  63. package/dashboard/server.ts +255 -0
  64. package/package.json +22 -11
  65. package/server/protocol.ts +1 -0
  66. package/server/server.ts +53 -17
  67. package/server/wshandler.ts +66 -13
  68. package/skill/SKILL.md +85 -4
  69. package/skill/createStreamType.md +1 -1
  70. package/skill/getStreamTypesForModel.md +7 -0
@@ -1,71 +1,217 @@
1
- import 'mdui/mdui.css';
2
- import 'mdui/components/button.js';
3
- import 'mdui/components/fab.js';
4
- import 'mdui/components/text-field.js';
5
- import { alert } from 'mdui/functions/alert.js';
6
- import { Connection } from 'lowlander/client';
7
- import A from 'aberdeen';
8
- import { setColorScheme } from 'mdui/functions/setColorScheme.js';
9
- // Generate a color scheme based on #0061a4 and set the <html> element to that color scheme
10
- setColorScheme('#ef6b00');
11
- A.setSpacingCssVars();
12
- const WEBSOCKET_URL = `ws://${location.hostname}:8080/`;
13
- // Create a WebSocket connection with type-safe RPC to the server API.
14
- const connection = new Connection(WEBSOCKET_URL);
15
- const api = connection.api;
16
- A('h2#Online');
17
- // Create a reactive scope to render online status
18
- A(() => {
19
- A(connection.isOnline() ? 'text=yes' : 'text=no');
20
- });
21
- // Simple RPC call - returns a PromiseProxy that resolves to the result.
22
- const sum = api.add(1234, 6753);
23
- A('h2#Answer');
24
- A.dump(sum);
25
- // Server proxy example - authenticate returns both a value and a stateful API object.
26
- const auth = api.authenticate('Frank');
27
- A('h2#AuthToken');
28
- A.dump(auth); // auth.value will become "secret" once authentication completes
29
- // Access the server-side UserAPI through the .serverProxy property.
30
- // Note that this proxy is usable immediately, even though the authentication
31
- // call is still in progress - the server will process requests in-order.
32
- // If authentication were to fail, so would any calls on the server proxy.
33
- const userApi = auth.serverProxy;
34
- // Call methods on the server proxy (returns PromiseProxy like regular RPC).
35
- const bio = userApi.getBio();
36
- A('h2#Bio');
37
- A.dump(bio); // bio.value will become "1:Frank"
38
- // Model streaming - returns a reactive proxy that updates when server-side model changes.
39
- const model = api.streamModel();
40
- A('h2#Model');
41
- A.dump(model); // Live model (and nested linked models) will appear in model.value
42
- A('h2#Toggle friend');
43
- const formBusy = A.proxy(false);
44
- const friendName = A.proxy('');
45
- A('form display:flex gap:$2', 'submit=', async (e) => {
46
- e.preventDefault();
47
- formBusy.value = true;
48
- const found = await userApi.toggleFriend(friendName.value).promise;
49
- formBusy.value = false;
50
- if (!found)
51
- alert({ description: 'No such person: ' + friendName.value });
52
- }, () => {
53
- A('mdui-text-field label="Person name" bind=', friendName);
54
- A(() => {
55
- if (formBusy.value)
56
- A('mdui-circular-progress');
57
- else
58
- A('mdui-button type=submit #Toggle friend');
59
- });
60
- });
61
- // Socket streaming - server pushes data via callbacks.
62
- const data = A.proxy([]);
63
- let dataIndex = 0;
64
- api.streamSomething(item => data[dataIndex++ % 20] = item);
65
- A('h2#Streamed data');
66
- A.dump(data);
67
- A('mdui-fab icon=admin_panel_settings text="Lowlander Admin" click=', async () => {
68
- const { showAdminModal } = await import('./admin');
69
- showAdminModal(api);
70
- });
71
- //# sourceMappingURL=base.js.map
1
+ function p(e,t,r,o){var i=arguments.length,n=i<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,r):o,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(e,t,r,o);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(n=(i<3?s(n):i>3?s(t,r,n):s(t,r))||n);return i>3&&n&&Object.defineProperty(t,r,n),n}var Hr=globalThis,jr=Hr.ShadowRoot&&(Hr.ShadyCSS===void 0||Hr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,oi=Symbol(),dn=new WeakMap,tr=class{constructor(t,r,o){if(this._$cssResult$=!0,o!==oi)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=r}get styleSheet(){let t=this.o,r=this.t;if(jr&&t===void 0){let o=r!==void 0&&r.length===1;o&&(t=dn.get(r)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),o&&dn.set(r,t))}return t}toString(){return this.cssText}},hn=e=>new tr(typeof e=="string"?e:e+"",void 0,oi),J=(e,...t)=>{let r=e.length===1?e[0]:t.reduce(((o,i,n)=>o+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+e[n+1]),e[0]);return new tr(r,e,oi)},mn=(e,t)=>{if(jr)e.adoptedStyleSheets=t.map((r=>r instanceof CSSStyleSheet?r:r.styleSheet));else for(let r of t){let o=document.createElement("style"),i=Hr.litNonce;i!==void 0&&o.setAttribute("nonce",i),o.textContent=r.cssText,e.appendChild(o)}},ii=jr?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let r="";for(let o of t.cssRules)r+=o.cssText;return hn(r)})(e):e;var{is:$a,defineProperty:Ta,getOwnPropertyDescriptor:Ra,getOwnPropertyNames:_a,getOwnPropertySymbols:Ma,getPrototypeOf:Ia}=Object,Ur=globalThis,fn=Ur.trustedTypes,Da=fn?fn.emptyScript:"",Oa=Ur.reactiveElementPolyfillSupport,er=(e,t)=>e,se={toAttribute(e,t){switch(t){case Boolean:e=e?Da:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=e!==null;break;case Number:r=e===null?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch{r=null}}return r}},Vr=(e,t)=>!$a(e,t),pn={attribute:!0,type:String,converter:se,reflect:!1,useDefault:!1,hasChanged:Vr};Symbol.metadata??=Symbol("metadata"),Ur.litPropertyMetadata??=new WeakMap;var Yt=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,r=pn){if(r.state&&(r.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((r=Object.create(r)).wrapped=!0),this.elementProperties.set(t,r),!r.noAccessor){let o=Symbol(),i=this.getPropertyDescriptor(t,o,r);i!==void 0&&Ta(this.prototype,t,i)}}static getPropertyDescriptor(t,r,o){let{get:i,set:n}=Ra(this.prototype,t)??{get(){return this[r]},set(s){this[r]=s}};return{get:i,set(s){let a=i?.call(this);n?.call(this,s),this.requestUpdate(t,a,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??pn}static _$Ei(){if(this.hasOwnProperty(er("elementProperties")))return;let t=Ia(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(er("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(er("properties"))){let r=this.properties,o=[..._a(r),...Ma(r)];for(let i of o)this.createProperty(i,r[i])}let t=this[Symbol.metadata];if(t!==null){let r=litPropertyMetadata.get(t);if(r!==void 0)for(let[o,i]of r)this.elementProperties.set(o,i)}this._$Eh=new Map;for(let[r,o]of this.elementProperties){let i=this._$Eu(r,o);i!==void 0&&this._$Eh.set(i,r)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let r=[];if(Array.isArray(t)){let o=new Set(t.flat(1/0).reverse());for(let i of o)r.unshift(ii(i))}else t!==void 0&&r.push(ii(t));return r}static _$Eu(t,r){let o=r.attribute;return o===!1?void 0:typeof o=="string"?o:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,r=this.constructor.elementProperties;for(let o of r.keys())this.hasOwnProperty(o)&&(t.set(o,this[o]),delete this[o]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return mn(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,r,o){this._$AK(t,o)}_$ET(t,r){let o=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,o);if(i!==void 0&&o.reflect===!0){let n=(o.converter?.toAttribute!==void 0?o.converter:se).toAttribute(r,o.type);this._$Em=t,n==null?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(t,r){let o=this.constructor,i=o._$Eh.get(t);if(i!==void 0&&this._$Em!==i){let n=o.getPropertyOptions(i),s=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:se;this._$Em=i;let a=s.fromAttribute(r,n.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(t,r,o){if(t!==void 0){let i=this.constructor,n=this[t];if(o??=i.getPropertyOptions(t),!((o.hasChanged??Vr)(n,r)||o.useDefault&&o.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,o))))return;this.C(t,r,o)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,r,{useDefault:o,reflect:i,wrapped:n},s){o&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,s??r??this[t]),n!==!0||s!==void 0)||(this._$AL.has(t)||(this.hasUpdated||o||(r=void 0),this._$AL.set(t,r)),i===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(r){Promise.reject(r)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,n]of this._$Ep)this[i]=n;this._$Ep=void 0}let o=this.constructor.elementProperties;if(o.size>0)for(let[i,n]of o){let{wrapped:s}=n,a=this[i];s!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,n,a)}}let t=!1,r=this._$AL;try{t=this.shouldUpdate(r),t?(this.willUpdate(r),this._$EO?.forEach((o=>o.hostUpdate?.())),this.update(r)):this._$EM()}catch(o){throw t=!1,this._$EM(),o}t&&this._$AE(r)}willUpdate(t){}_$AE(t){this._$EO?.forEach((r=>r.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((r=>this._$ET(r,this[r]))),this._$EM()}updated(t){}firstUpdated(t){}};Yt.elementStyles=[],Yt.shadowRootOptions={mode:"open"},Yt[er("elementProperties")]=new Map,Yt[er("finalized")]=new Map,Oa?.({ReactiveElement:Yt}),(Ur.reactiveElementVersions??=[]).push("2.1.1");var si=globalThis,qr=si.trustedTypes,gn=qr?qr.createPolicy("lit-html",{createHTML:e=>e}):void 0,ai="$lit$",Xt=`lit$${Math.random().toFixed(9).slice(2)}$`,li="?"+Xt,La=`<${li}>`,ve=document,or=()=>ve.createComment(""),ir=e=>e===null||typeof e!="object"&&typeof e!="function",ci=Array.isArray,An=e=>ci(e)||typeof e?.[Symbol.iterator]=="function",ni=`[
2
+ \f\r]`,rr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,yn=/-->/g,bn=/>/g,ye=RegExp(`>|${ni}(?:([^\\s"'>=/]+)(${ni}*=${ni}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),vn=/'/g,xn=/"/g,Cn=/^(?:script|style|textarea|title)$/i,ui=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}),b=ui(1),mc=ui(2),fc=ui(3),ot=Symbol.for("lit-noChange"),F=Symbol.for("lit-nothing"),wn=new WeakMap,be=ve.createTreeWalker(ve,129);function Pn(e,t){if(!ci(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return gn!==void 0?gn.createHTML(t):t}var kn=(e,t)=>{let r=e.length-1,o=[],i,n=t===2?"<svg>":t===3?"<math>":"",s=rr;for(let a=0;a<r;a++){let l=e[a],c,u,h=-1,f=0;for(;f<l.length&&(s.lastIndex=f,u=s.exec(l),u!==null);)f=s.lastIndex,s===rr?u[1]==="!--"?s=yn:u[1]!==void 0?s=bn:u[2]!==void 0?(Cn.test(u[2])&&(i=RegExp("</"+u[2],"g")),s=ye):u[3]!==void 0&&(s=ye):s===ye?u[0]===">"?(s=i??rr,h=-1):u[1]===void 0?h=-2:(h=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?ye:u[3]==='"'?xn:vn):s===xn||s===vn?s=ye:s===yn||s===bn?s=rr:(s=ye,i=void 0);let y=s===ye&&e[a+1].startsWith("/>")?" ":"";n+=s===rr?l+La:h>=0?(o.push(c),l.slice(0,h)+ai+l.slice(h)+Xt+y):l+Xt+(h===-2?a:y)}return[Pn(e,n+(e[r]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),o]},nr=class e{constructor({strings:t,_$litType$:r},o){let i;this.parts=[];let n=0,s=0,a=t.length-1,l=this.parts,[c,u]=kn(t,r);if(this.el=e.createElement(c,o),be.currentNode=this.el.content,r===2||r===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=be.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let h of i.getAttributeNames())if(h.endsWith(ai)){let f=u[s++],y=i.getAttribute(h).split(Xt),x=/([.?@])?(.*)/.exec(f);l.push({type:1,index:n,name:x[2],strings:y,ctor:x[1]==="."?Gr:x[1]==="?"?Kr:x[1]==="@"?Yr:we}),i.removeAttribute(h)}else h.startsWith(Xt)&&(l.push({type:6,index:n}),i.removeAttribute(h));if(Cn.test(i.tagName)){let h=i.textContent.split(Xt),f=h.length-1;if(f>0){i.textContent=qr?qr.emptyScript:"";for(let y=0;y<f;y++)i.append(h[y],or()),be.nextNode(),l.push({type:2,index:++n});i.append(h[f],or())}}}else if(i.nodeType===8)if(i.data===li)l.push({type:2,index:n});else{let h=-1;for(;(h=i.data.indexOf(Xt,h+1))!==-1;)l.push({type:7,index:n}),h+=Xt.length-1}n++}}static createElement(t,r){let o=ve.createElement("template");return o.innerHTML=t,o}};function xe(e,t,r=e,o){if(t===ot)return t;let i=o!==void 0?r._$Co?.[o]:r._$Cl,n=ir(t)?void 0:t._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),n===void 0?i=void 0:(i=new n(e),i._$AT(e,r,o)),o!==void 0?(r._$Co??=[])[o]=i:r._$Cl=i),i!==void 0&&(t=xe(e,i._$AS(e,t.values),i,o)),t}var Wr=class{constructor(t,r){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=r}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:r},parts:o}=this._$AD,i=(t?.creationScope??ve).importNode(r,!0);be.currentNode=i;let n=be.nextNode(),s=0,a=0,l=o[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new Oe(n,n.nextSibling,this,t):l.type===1?c=new l.ctor(n,l.name,l.strings,this,t):l.type===6&&(c=new Xr(n,this,t)),this._$AV.push(c),l=o[++a]}s!==l?.index&&(n=be.nextNode(),s++)}return be.currentNode=ve,i}p(t){let r=0;for(let o of this._$AV)o!==void 0&&(o.strings!==void 0?(o._$AI(t,o,r),r+=o.strings.length-2):o._$AI(t[r])),r++}},Oe=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,r,o,i){this.type=2,this._$AH=F,this._$AN=void 0,this._$AA=t,this._$AB=r,this._$AM=o,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,r=this._$AM;return r!==void 0&&t?.nodeType===11&&(t=r.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,r=this){t=xe(this,t,r),ir(t)?t===F||t==null||t===""?(this._$AH!==F&&this._$AR(),this._$AH=F):t!==this._$AH&&t!==ot&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):An(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!==F&&ir(this._$AH)?this._$AA.nextSibling.data=t:this.T(ve.createTextNode(t)),this._$AH=t}$(t){let{values:r,_$litType$:o}=t,i=typeof o=="number"?this._$AC(t):(o.el===void 0&&(o.el=nr.createElement(Pn(o.h,o.h[0]),this.options)),o);if(this._$AH?._$AD===i)this._$AH.p(r);else{let n=new Wr(i,this),s=n.u(this.options);n.p(r),this.T(s),this._$AH=n}}_$AC(t){let r=wn.get(t.strings);return r===void 0&&wn.set(t.strings,r=new nr(t)),r}k(t){ci(this._$AH)||(this._$AH=[],this._$AR());let r=this._$AH,o,i=0;for(let n of t)i===r.length?r.push(o=new e(this.O(or()),this.O(or()),this,this.options)):o=r[i],o._$AI(n),i++;i<r.length&&(this._$AR(o&&o._$AB.nextSibling,i),r.length=i)}_$AR(t=this._$AA.nextSibling,r){for(this._$AP?.(!1,!0,r);t!==this._$AB;){let o=t.nextSibling;t.remove(),t=o}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},we=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,r,o,i,n){this.type=1,this._$AH=F,this._$AN=void 0,this.element=t,this.name=r,this._$AM=i,this.options=n,o.length>2||o[0]!==""||o[1]!==""?(this._$AH=Array(o.length-1).fill(new String),this.strings=o):this._$AH=F}_$AI(t,r=this,o,i){let n=this.strings,s=!1;if(n===void 0)t=xe(this,t,r,0),s=!ir(t)||t!==this._$AH&&t!==ot,s&&(this._$AH=t);else{let a=t,l,c;for(t=n[0],l=0;l<n.length-1;l++)c=xe(this,a[o+l],r,l),c===ot&&(c=this._$AH[l]),s||=!ir(c)||c!==this._$AH[l],c===F?t=F:t!==F&&(t+=(c??"")+n[l+1]),this._$AH[l]=c}s&&!i&&this.j(t)}j(t){t===F?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Gr=class extends we{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===F?void 0:t}},Kr=class extends we{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==F)}},Yr=class extends we{constructor(t,r,o,i,n){super(t,r,o,i,n),this.type=5}_$AI(t,r=this){if((t=xe(this,t,r,0)??F)===ot)return;let o=this._$AH,i=t===F&&o!==F||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,n=t!==F&&(o===F||i);i&&this.element.removeEventListener(this.name,this,o),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},Xr=class{constructor(t,r,o){this.element=t,this.type=6,this._$AN=void 0,this._$AM=r,this.options=o}get _$AU(){return this._$AM._$AU}_$AI(t){xe(this,t)}},En={M:ai,P:Xt,A:li,C:1,L:kn,R:Wr,D:An,V:xe,I:Oe,H:we,N:Kr,U:Yr,B:Gr,F:Xr},Ba=si.litHtmlPolyfillSupport;Ba?.(nr,Oe),(si.litHtmlVersions??=[]).push("3.3.1");var Sn=(e,t,r)=>{let o=r?.renderBefore??t,i=o._$litPart$;if(i===void 0){let n=r?.renderBefore??null;o._$litPart$=i=new Oe(t.insertBefore(or(),n),n,void 0,r??{})}return i._$AI(e),i};var di=globalThis,ft=class extends Yt{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 r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Sn(r,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return ot}};ft._$litElement$=!0,ft.finalized=!0,di.litElementHydrateSupport?.({LitElement:ft});var Fa=di.litElementPolyfillSupport;Fa?.({LitElement:ft});(di.litElementVersions??=[]).push("4.2.1");var G=e=>(t,r)=>{r!==void 0?r.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)};var Na={attribute:!0,type:String,converter:se,reflect:!1,hasChanged:Vr},za=(e=Na,t,r)=>{let{kind:o,metadata:i}=r,n=globalThis.litPropertyMetadata.get(i);if(n===void 0&&globalThis.litPropertyMetadata.set(i,n=new Map),o==="setter"&&((e=Object.create(e)).wrapped=!0),n.set(r.name,e),o==="accessor"){let{name:s}=r;return{set(a){let l=t.get.call(this);t.set.call(this,a),this.requestUpdate(s,l,e)},init(a){return a!==void 0&&this.C(s,void 0,e,a),a}}}if(o==="setter"){let{name:s}=r;return function(a){let l=this[s];t.call(this,a),this.requestUpdate(s,l,e)}}throw Error("Unsupported decorator location: "+o)};function g(e){return(t,r)=>typeof r=="object"?za(e,t,r):((o,i,n)=>{let s=i.hasOwnProperty(n);return i.constructor.createProperty(n,o),s?Object.getOwnPropertyDescriptor(i,n):void 0})(e,t,r)}function qt(e){return g({...e,state:!0,attribute:!1})}var Le=(e,t,r)=>(r.configurable=!0,r.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(e,t,r),r);function $n(e){return(t,r)=>{let{slot:o,selector:i}=e??{},n="slot"+(o?`[name=${o}]`:":not([name])");return Le(t,r,{get(){let s=this.renderRoot?.querySelector(n),a=s?.assignedElements(e)??[];return i===void 0?a:a.filter((l=>l.matches(i)))}})}}var{I:eu}=En,Tn=e=>e===null||typeof e!="object"&&typeof e!="function";var Jr=e=>e.strings===void 0;var Ha={},Rn=(e,t=Ha)=>e._$AH=t;var yt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},bt=e=>(...t)=>({_$litDirective$:e,values:t}),Dt=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,r,o){this._$Ct=t,this._$AM=r,this._$Ci=o}_$AS(t,r){return this.update(t,r)}update(t,r){return this.render(...r)}};var sr=(e,t)=>{let r=e._$AN;if(r===void 0)return!1;for(let o of r)o._$AO?.(t,!1),sr(o,t);return!0},Qr=e=>{let t,r;do{if((t=e._$AM)===void 0)break;r=t._$AN,r.delete(e),e=t}while(r?.size===0)},_n=e=>{for(let t;t=e._$AM;e=t){let r=t._$AN;if(r===void 0)t._$AN=r=new Set;else if(r.has(e))break;r.add(e),Va(t)}};function ja(e){this._$AN!==void 0?(Qr(this),this._$AM=e,_n(this)):this._$AM=e}function Ua(e,t=!1,r=0){let o=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(o))for(let n=r;n<o.length;n++)sr(o[n],!1),Qr(o[n]);else o!=null&&(sr(o,!1),Qr(o));else sr(this,e)}var Va=e=>{e.type==yt.CHILD&&(e._$AP??=Ua,e._$AQ??=ja)},Be=class extends Dt{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,r,o){super._$AT(t,r,o),_n(this),this.isConnected=t._$AU}_$AO(t,r=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),r&&(sr(this,t),Qr(this))}setValue(t){if(Jr(this._$Ct))this._$Ct._$AI(t,this);else{let r=[...this._$Ct._$AH];r[this._$Ci]=t,this._$Ct._$AI(r,this,0)}}disconnected(){}reconnected(){}};var St=()=>new mi,mi=class{},hi=new WeakMap,vt=bt(class extends Be{render(e){return F}update(e,[t]){let r=t!==this.G;return r&&this.G!==void 0&&this.rt(void 0),(r||this.lt!==this.ct)&&(this.G=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),F}rt(e){if(this.isConnected||(e=void 0),typeof this.G=="function"){let t=this.ht??globalThis,r=hi.get(t);r===void 0&&(r=new WeakMap,hi.set(t,r)),r.get(this.G)!==void 0&&this.G.call(this.ht,void 0),r.set(this.G,e),e!==void 0&&this.G.call(this.ht,e)}else this.G.value=e}get lt(){return typeof this.G=="function"?hi.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var _=e=>e!==null&&e.toLowerCase()!=="false";var pt=b`${F}`;var Mn="important",qa=" !"+Mn,In=bt(class extends Dt{constructor(e){if(super(e),e.type!==yt.ATTRIBUTE||e.name!=="style"||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,r)=>{let o=e[r];return o==null?t:t+`${r=r.includes("-")?r:r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${o};`}),"")}update(e,[t]){let{style:r}=e.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let o of this.ft)t[o]==null&&(this.ft.delete(o),o.includes("-")?r.removeProperty(o):r[o]=null);for(let o in t){let i=t[o];if(i!=null){this.ft.add(o);let n=typeof i=="string"&&i.endsWith(qa);o.includes("-")||n?r.setProperty(o,n?i.slice(0,-11):i,n?Mn:""):r[o]=i}}return ot}});var Ae=class extends Dt{constructor(t){if(super(t),this.it=F,t.type!==yt.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===F||t==null)return this._t=void 0,this.it=t;if(t===ot)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;let r=[t];return r.raw=r,this._t={_$litType$:this.constructor.resultType,strings:r,values:[]}}};Ae.directiveName="unsafeHTML",Ae.resultType=1;var Eu=bt(Ae);var ar=class extends Ae{};ar.directiveName="unsafeSVG",ar.resultType=2;var Zr=bt(ar);var to=class{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}},eo=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise((t=>this.Z=t))}resume(){this.Z?.(),this.Y=this.Z=void 0}};var Dn=e=>!Tn(e)&&typeof e.then=="function",On=1073741823,fi=class extends Be{constructor(){super(...arguments),this._$Cwt=On,this._$Cbt=[],this._$CK=new to(this),this._$CX=new eo}render(...t){return t.find((r=>!Dn(r)))??ot}update(t,r){let o=this._$Cbt,i=o.length;this._$Cbt=r;let n=this._$CK,s=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<r.length&&!(a>this._$Cwt);a++){let l=r[a];if(!Dn(l))return this._$Cwt=a,l;a<i&&l===o[a]||(this._$Cwt=On,i=0,Promise.resolve(l).then((async c=>{for(;s.get();)await s.get();let u=n.deref();if(u!==void 0){let h=u._$Cbt.indexOf(l);h>-1&&h<u._$Cwt&&(u._$Cwt=h,u.setValue(c))}})))}return ot}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},Ln=bt(fi);function Bn(e){return e!==null&&typeof e=="object"&&"constructor"in e&&e.constructor===Object}function pi(e={},t={}){let r=["__proto__","constructor","prototype"];Object.keys(t).filter(o=>r.indexOf(o)<0).forEach(o=>{typeof e[o]>"u"?e[o]=t[o]:Bn(t[o])&&Bn(e[o])&&Object.keys(t[o]).length>0&&pi(e[o],t[o])})}var Fn={body:{},addEventListener(){},removeEventListener(){},activeElement:{blur(){},nodeName:""},querySelector(){return null},querySelectorAll(){return[]},getElementById(){return null},createEvent(){return{initEvent(){}}},createElement(){return{children:[],childNodes:[],style:{},setAttribute(){},getElementsByTagName(){return[]}}},createElementNS(){return{}},importNode(){return null},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function et(){let e=typeof document<"u"?document:{};return pi(e,Fn),e}var Wa={document:Fn,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState(){},pushState(){},go(){},back(){}},CustomEvent:function(){return this},addEventListener(){},removeEventListener(){},getComputedStyle(){return{getPropertyValue(){return""}}},Image(){},Date(){},screen:{},setTimeout(){},clearTimeout(){},matchMedia(){return{}},requestAnimationFrame(e){return typeof setTimeout>"u"?(e(),null):setTimeout(e,0)},cancelAnimationFrame(e){typeof setTimeout>"u"||clearTimeout(e)}};function $t(){let e=typeof window<"u"?window:{};return pi(e,Wa),e}var z=e=>typeof e=="function",q=e=>typeof e=="string",lr=e=>typeof e=="number",Nn=e=>typeof e=="boolean",H=e=>typeof e>"u",gi=e=>e===null,cr=e=>typeof Window<"u"&&e instanceof Window,ur=e=>typeof Document<"u"&&e instanceof Document,Ot=e=>typeof Element<"u"&&e instanceof Element,zn=e=>typeof Node<"u"&&e instanceof Node,Jt=e=>!z(e)&&!cr(e)&&lr(e.length),Tt=e=>typeof e=="object"&&e!==null,Ce=e=>ur(e)?e.documentElement:e,dr=e=>e.replace(/-([a-z])/g,(t,r)=>r.toUpperCase()),Qt=e=>e&&e.replace(/^./,e[0].toLowerCase()).replace(/[A-Z]/g,t=>"-"+t.toLowerCase()),ro=()=>!1,oo=()=>!0,E=(e,t)=>{for(let r=0;r<e.length;r+=1)if(t.call(e[r],e[r],r)===!1)return e;return e},K=(e,t)=>{let r=Object.keys(e);for(let o=0;o<r.length;o+=1){let i=r[o];if(t.call(e[i],i,e[i])===!1)return e}return e};var Q=class{constructor(t){return this.length=0,t?(E(t,(r,o)=>{this[o]=r}),this.length=t.length,this):this}};var Pe=(e=et())=>/complete|interactive/.test(e.readyState),hr=e=>et().createElement(e),io=(e,t)=>e.appendChild(t),no=e=>e.parentNode?e.parentNode.removeChild(e):e,so=(e,t)=>{let r=hr(t);return r.innerHTML=e,[].slice.call(r.childNodes)};var Ga=()=>{let e=function(t){if(!t)return new Q;if(t instanceof Q)return t;if(z(t)){let r=et();return Pe(r)?t.call(r,e):r.addEventListener("DOMContentLoaded",()=>t.call(r,e),{once:!0}),new Q([r])}if(q(t)){let r=t.trim();if(r.startsWith("<")&&r.endsWith(">")){let i="div";return K({li:"ul",tr:"tbody",td:"tr",th:"tr",tbody:"table",option:"select"},(s,a)=>{if(r.startsWith(`<${s}`))return i=a,!1}),new Q(so(r,i))}let o=et();return new Q(o.querySelectorAll(t))}return Jt(t)&&!zn(t)?new Q(t):new Q([t])};return e.fn=Q.prototype,e},m=Ga();var Hn=(e,t)=>e!==t&&Ce(e).contains(t);var jn=(e,t)=>(E(t,r=>{e.push(r)}),e);m.fn.each=function(e){return E(this,(t,r)=>e.call(t,r,t))};m.fn.get=function(e){return e===void 0?[].slice.call(this):this[e>=0?e:e+this.length]};m.fn.find=function(e){let t=[];return this.each((r,o)=>{jn(t,m(o.querySelectorAll(e)).get())}),new Q(t)};var Ka=$t().CustomEvent,ao=class extends Ka{constructor(t,r){super(t,r),this.data=r.data,this.namespace=r.namespace}},yi=new WeakMap,Ya=1,bi=e=>(yi.has(e)||yi.set(e,++Ya),yi.get(e)),Un=new Map,lo=e=>{let t=bi(e);return Un.get(t)||Un.set(t,[]).get(t)},co=e=>{let t=e.split(".");return{type:t[0],namespace:t.slice(1).sort().join(" ")}},Vn=e=>new RegExp("(?:^| )"+e.replace(" "," .* ?")+"(?: |$)"),Xa=(e,t,r,o)=>{let i=co(t);return lo(e).filter(n=>n&&(!i.type||n.type===i.type)&&(!i.namespace||Vn(i.namespace).test(n.namespace))&&(!r||bi(n.func)===bi(r))&&(!o||n.selector===o))},qn=(e,t,r,o,i)=>{let n=!1;Tt(o)&&o.useCapture&&(n=!0),t.split(" ").forEach(s=>{if(!s)return;let a=co(s),l=(h,f)=>{r.apply(f,h.detail===null?[h]:[h].concat(h.detail))===!1&&(h.preventDefault(),h.stopPropagation())},c=h=>{h.namespace&&!Vn(h.namespace).test(a.namespace)||(h.data=o,i?m(e).find(i).get().reverse().forEach(f=>{(f===h.target||Hn(f,h.target))&&l(h,f)}):l(h,e))},u={type:a.type,namespace:a.namespace,func:r,selector:i,id:lo(e).length,proxy:c};lo(e).push(u),e.addEventListener(u.type,c,n)})},Wn=(e,t,r,o)=>{let i=lo(e),n=s=>{delete i[s.id],e.removeEventListener(s.type,s.proxy,!1)};t?t.split(" ").forEach(s=>{s&&Xa(e,s,r,o).forEach(a=>{n(a)})}):i.forEach(s=>{n(s)})};m.fn.trigger=function(e,t=null,r){let{type:o,namespace:i}=co(e),n=new ao(o,{detail:t,data:null,namespace:i,bubbles:!0,cancelable:!1,composed:!0,...r});return this.each((s,a)=>{a.dispatchEvent(n)})};function uo(e,...t){return E(t,r=>{K(r,(o,i)=>{H(i)||(e[o]=i)})}),e}var Gn="ajaxStart",vi="ajaxSuccess",mr="ajaxError",ho="ajaxComplete",fr={},Kn=e=>["GET","HEAD"].includes(e),xi=(e,t)=>`${e}&${t}`.replace(/[&?]{1,2}/,"?"),Yn=e=>{let t=$t();return/^([\w-]+:)?\/\/([^/]+)/.test(e)&&RegExp.$2!==t.location.host},Xn=e=>e>=200&&e<300||[0,304].includes(e),Jn=e=>{let t={url:"",method:"GET",data:"",processData:!0,async:!0,cache:!0,username:"",password:"",headers:{},xhrFields:{},statusCode:{},dataType:"",contentType:"application/x-www-form-urlencoded",timeout:0,global:!0};return K(fr,(r,o)=>{!["beforeSend","success","error","complete","statusCode"].includes(r)&&!H(o)&&(t[r]=o)}),uo({},t,e)};var Qn=e=>{if(!Tt(e)&&!Array.isArray(e))return"";let t=[],r=(o,i)=>{let n;Tt(i)?K(i,(s,a)=>{n=Array.isArray(i)&&!Tt(a)?"":s,r(`${o}[${n}]`,a)}):(n=i==null||i===""?"=":`=${encodeURIComponent(i)}`,t.push(encodeURIComponent(o)+n))};return Array.isArray(e)?E(e,({name:o,value:i})=>r(o,i)):K(e,r),t.join("&")};var Zn=e=>{let t=et(),r=$t(),o=!1,i={},n={},s=Jn(e),a=s.method.toUpperCase(),{data:l,url:c}=s;c=c||r.location.toString();let{processData:u,async:h,cache:f,username:y,password:x,headers:P,xhrFields:R,statusCode:W,dataType:N,contentType:S,timeout:at,global:M}=s,X=Kn(a);l&&(X||u)&&!q(l)&&!(l instanceof ArrayBuffer)&&!(l instanceof Blob)&&!(l instanceof Document)&&!(l instanceof FormData)&&(l=Qn(l)),l&&X&&(c=xi(c,l),l=null);let $=(L,B,...Et)=>{M&&m(t).trigger(L,B==="success"?n:i);let ct,A;B in fr&&(ct=fr[B](...Et)),s[B]&&(A=s[B](...Et)),B==="beforeSend"&&[ct,A].includes(!1)&&(o=!0)};return(()=>{let L;return new Promise((B,Et)=>{let ct=lt=>Et(new Error(lt));X&&!f&&(c=xi(c,`_=${Date.now()}`));let A=new XMLHttpRequest;A.open(a,c,h,y,x),(S||l&&!X&&S!==!1)&&A.setRequestHeader("Content-Type",S),N==="json"&&A.setRequestHeader("Accept","application/json, text/javascript"),K(P,(lt,nt)=>{H(nt)||A.setRequestHeader(lt,nt+"")}),Yn(c)||A.setRequestHeader("X-Requested-With","XMLHttpRequest"),K(R,(lt,nt)=>{A[lt]=nt}),i.xhr=n.xhr=A,i.options=n.options=s;let it;if(A.onload=()=>{it&&clearTimeout(it);let lt=Xn(A.status),nt;if(lt)if(L=A.status===204||a==="HEAD"?"nocontent":A.status===304?"notmodified":"success",N==="json"||!N&&(A.getResponseHeader("content-type")||"").includes("json")){try{nt=a==="HEAD"?void 0:JSON.parse(A.responseText),n.response=nt}catch{L="parsererror",$(mr,"error",A,L),ct(L)}L!=="parsererror"&&($(vi,"success",nt,L,A),B(nt))}else nt=a==="HEAD"?void 0:A.responseType==="text"||A.responseType===""?A.responseText:A.response,n.response=nt,$(vi,"success",nt,L,A),B(nt);else L="error",$(mr,"error",A,L),ct(L);E([fr.statusCode??{},W],Mt=>{Mt[A.status]&&(lt?Mt[A.status](nt,L,A):Mt[A.status](A,L))}),$(ho,"complete",A,L)},A.onerror=()=>{it&&clearTimeout(it),$(mr,"error",A,A.statusText),$(ho,"complete",A,"error"),ct(A.statusText)},A.onabort=()=>{let lt="abort";it&&(lt="timeout",clearTimeout(it)),$(mr,"error",A,lt),$(ho,"complete",A,lt),ct(lt)},$(Gn,"beforeSend",A,s),o)return ct("cancel");at>0&&(it=r.setTimeout(()=>A.abort(),at)),A.send(l)})})()};var Rt=class extends ft{emit(t,r){let o=new CustomEvent(t,Object.assign({bubbles:!0,cancelable:!1,composed:!0,detail:{}},r));return this.dispatchEvent(o)}};var Lt=class{constructor(t,...r){this.slotNames=[],(this.host=t).addController(this),this.slotNames=r,this.onSlotChange=this.onSlotChange.bind(this)}hostConnected(){this.host.shadowRoot.addEventListener("slotchange",this.onSlotChange),Pe()||m(()=>{this.host.requestUpdate()})}hostDisconnected(){this.host.shadowRoot.removeEventListener("slotchange",this.onSlotChange)}test(t){return t==="[default]"?this.hasDefaultSlot():this.hasNamedSlot(t)}hasDefaultSlot(){return[...this.host.childNodes].some(t=>t.nodeType===t.TEXT_NODE&&t.textContent.trim()!==""||t.nodeType===t.ELEMENT_NODE&&!t.hasAttribute("slot"))}hasNamedSlot(t){return this.host.querySelector(`:scope > [slot="${t}"]`)!==null}onSlotChange(t){let r=t.target;(this.slotNames.includes("[default]")&&!r.name||r.name&&this.slotNames.includes(r.name))&&this.host.requestUpdate()}};var Bt=J`:host{box-sizing:border-box}:host *,:host ::after,:host ::before{box-sizing:inherit}:host :focus,:host :focus-visible,:host(:focus),:host(:focus-visible){outline:0}[hidden]{display:none!important}`;var ts=J`:host{display:inline-block;width:1em;height:1em;font-weight:400;font-family:'Material Icons';font-display:block;font-style:normal;line-height:1;direction:ltr;letter-spacing:normal;white-space:nowrap;text-transform:none;word-wrap:normal;-webkit-font-smoothing:antialiased;text-rendering:optimizelegibility;-moz-osx-font-smoothing:grayscale;font-size:1.5rem}::slotted(svg),svg{width:100%;height:100%;fill:currentcolor}`;var pr=class extends Rt{constructor(){super(...arguments),this.hasSlotController=new Lt(this,"[default]")}render(){let t=()=>{if(this.name){let[r,o]=this.name.split("--");return b`<span translate="no" style="${In({fontFamily:new Map([["outlined","Material Icons Outlined"],["filled","Material Icons"],["rounded","Material Icons Round"],["sharp","Material Icons Sharp"],["two-tone","Material Icons Two Tone"]]).get(o)})}">${r}</span>`}return this.src?b`${Ln(Zn({url:this.src}).then(Zr))}`:b``};return this.hasSlotController.test("[default]")?b`<slot></slot>`:t()}};pr.styles=[Bt,ts];p([g({reflect:!0})],pr.prototype,"name",void 0);p([g({reflect:!0})],pr.prototype,"src",void 0);pr=p([G("mdui-icon")],pr);var O=e=>e??F;function Fe(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let r=0,o;r<e.length;r++)(o=Fe(e[r]))!==""&&(t+=(t&&" ")+o);else for(let r in e)e[r]&&(t+=(t&&" ")+r);return t}var mo=(e,t,r)=>{let o=e.getAttribute(t);return gi(o)?r:o},wi=(e,t)=>{e.removeAttribute(t)},fo=(e,t,r)=>{gi(r)?wi(e,t):e.setAttribute(t,r)};var gr=(e,t)=>$t().getComputedStyle(e).getPropertyValue(Qt(t)),Ai=e=>gr(e,"box-sizing")==="border-box",po=(e,t,r)=>{let o=t==="width"?["Left","Right"]:["Top","Bottom"];return[0,1].reduce((i,n,s)=>{let a=r+o[s];return r==="border"&&(a+="Width"),i+parseFloat(gr(e,a)||"0")},0)},es=(e,t)=>{if(t==="width"||t==="height"){let r=e.getBoundingClientRect()[t];return Ai(e)?`${r}px`:`${r-po(e,t,"border")-po(e,t,"padding")}px`}return gr(e,t)},rs=["animation-iteration-count","column-count","fill-opacity","flex-grow","flex-shrink","font-weight","grid-area","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","line-height","opacity","order","orphans","widows","z-index","zoom"];E(["attr","prop","css"],(e,t)=>{let r=(i,n,s)=>{if(H(s))return;if(t===0)return fo(i,n,s);if(t===1){i[n]=s;return}n=Qt(n);let a=()=>n.startsWith("--")||rs.includes(n)?"":"px";i.style.setProperty(n,lr(s)?`${s}${a()}`:s)},o=(i,n)=>t===0?mo(i,n):t===1?i[n]:es(i,n);m.fn[e]=function(i,n){if(Tt(i))return K(i,(s,a)=>{this[e](s,a)}),this;if(arguments.length===1){let s=this[0];return Ot(s)?o(s,i):void 0}return this.each((s,a)=>{r(a,i,z(n)?n.call(a,s,o(a,i)):n)})}});var ke=new WeakMap,os=e=>{let t=[...e.elements],r=ke.get(e)||[],o=(i,n)=>i.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1;return[...t,...r].sort(o)};var ae=e=>[...new Set(e)];var Wt=class{constructor(t,r){this.defined=!1,(this.host=t).addController(this),this.relatedElements=r.relatedElements,this.needDomReady=r.needDomReady||!!r.relatedElements,this.onSlotChange=this.onSlotChange.bind(this)}hostConnected(){this.host.shadowRoot.addEventListener("slotchange",this.onSlotChange)}hostDisconnected(){this.host.shadowRoot.removeEventListener("slotchange",this.onSlotChange)}isDefined(){return this.defined?!0:(this.defined=(!this.needDomReady||Pe())&&!this.getUndefinedLocalNames().length,this.defined)}async whenDefined(){if(this.defined)return Promise.resolve();let t=et();this.needDomReady&&!Pe(t)&&await new Promise(o=>{t.addEventListener("DOMContentLoaded",()=>o(),{once:!0})});let r=this.getUndefinedLocalNames();if(r.length){let o=[];r.forEach(i=>{o.push(customElements.whenDefined(i))}),await Promise.all(o)}this.defined=!0}getScopeLocalNameSelector(){let t=this.relatedElements;return t?Array.isArray(t)?t.map(r=>`${r}:not(:defined)`).join(","):Object.keys(t).filter(r=>!t[r]).map(r=>`${r}:not(:defined)`).join(","):null}getGlobalLocalNameSelector(){let t=this.relatedElements;return!t||Array.isArray(t)?null:Object.keys(t).filter(r=>t[r]).map(r=>`${r}:not(:defined)`).join(",")}getUndefinedLocalNames(){let t=this.getScopeLocalNameSelector(),r=this.getGlobalLocalNameSelector(),o=t?[...this.host.querySelectorAll(t)]:[],i=r?[...et().querySelectorAll(r)]:[],n=[...o,...i].map(s=>s.localName);return ae(n)}onSlotChange(){let t=this.getScopeLocalNameSelector();t&&this.host.querySelectorAll(t).length&&(this.defined=!1)}};var yr=new WeakMap,Ne=new WeakMap,ze=class{constructor(t,r){(this.host=t).addController(this),this.definedController=new Wt(t,{needDomReady:!0}),this.options={form:o=>{let i=m(o).attr("form");return i?o.getRootNode().getElementById(i):o.closest("form")},name:o=>o.name,value:o=>o.value,defaultValue:o=>o.defaultValue,setValue:(o,i)=>o.value=i,disabled:o=>o.disabled,reportValidity:o=>z(o.reportValidity)?o.reportValidity():!0,...r},this.onFormData=this.onFormData.bind(this),this.onFormSubmit=this.onFormSubmit.bind(this),this.onFormReset=this.onFormReset.bind(this),this.reportFormValidity=this.reportFormValidity.bind(this)}hostConnected(){this.definedController.whenDefined().then(()=>{this.form=this.options.form(this.host),this.form&&this.attachForm(this.form)})}hostDisconnected(){this.detachForm()}hostUpdated(){this.definedController.whenDefined().then(()=>{let t=this.options.form(this.host);t||this.detachForm(),t&&this.form!==t&&(this.detachForm(),this.attachForm(t))})}getForm(){return this.form??null}reset(t){this.doAction("reset",t)}submit(t){this.doAction("submit",t)}attachForm(t){if(!t){this.form=void 0;return}this.form=t,ke.has(this.form)?ke.get(this.form).add(this.host):ke.set(this.form,new Set([this.host])),this.form.addEventListener("formdata",this.onFormData),this.form.addEventListener("submit",this.onFormSubmit),this.form.addEventListener("reset",this.onFormReset),yr.has(this.form)||(yr.set(this.form,this.form.reportValidity),this.form.reportValidity=()=>this.reportFormValidity())}detachForm(){this.form&&(ke.get(this.form).delete(this.host),this.form.removeEventListener("formdata",this.onFormData),this.form.removeEventListener("submit",this.onFormSubmit),this.form.removeEventListener("reset",this.onFormReset),yr.has(this.form)&&!ke.get(this.form).size&&(this.form.reportValidity=yr.get(this.form),yr.delete(this.form)))}doAction(t,r){if(!this.form)return;let o=m(`<button type="${t}">`).css({position:"absolute",width:0,height:0,clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap"}),i=o[0];r&&(i.name=r.name,i.value=r.value,["formaction","formenctype","formmethod","formnovalidate","formtarget"].forEach(n=>{o.attr(n,m(r).attr(n))})),this.form.append(i),i.click(),i.remove()}onFormData(t){let r=this.options.disabled(this.host),o=this.options.name(this.host),i=this.options.value(this.host),n=["mdui-button","mdui-button-icon","mdui-chip","mdui-fab","mdui-segmented-button"].includes(this.host.tagName.toLowerCase());!r&&!n&&q(o)&&o&&!H(i)&&(Array.isArray(i)?i.forEach(s=>{t.formData.append(o,s.toString())}):t.formData.append(o,i.toString()))}onFormSubmit(t){let r=this.options.disabled(this.host),o=this.options.reportValidity;this.form&&!this.form.noValidate&&!r&&!o(this.host)&&(t.preventDefault(),t.stopImmediatePropagation())}onFormReset(){this.form&&(this.options.setValue(this.host,this.options.defaultValue(this.host)),this.host.invalid=!1,Ne.has(this.form)?Ne.get(this.form).add(this.host):Ne.set(this.form,new Set([this.host])))}reportFormValidity(){if(this.form&&!this.form.noValidate){let t=os(this.form);for(let r of t)if(z(r.reportValidity)&&!r.reportValidity())return!1}return!0}};var is=e=>{class t extends e{renderAnchor({id:o,className:i,part:n,content:s=b`<slot></slot>`,refDirective:a,tabIndex:l}){return b`<a ${a} id="${O(o)}" class="_a ${i||""}" part="${O(n)}" href="${O(this.href)}" download="${O(this.download)}" target="${O(this.target)}" rel="${O(this.rel)}" tabindex="${O(l)}">${s}</a>`}}return p([g({reflect:!0})],t.prototype,"href",void 0),p([g({reflect:!0})],t.prototype,"download",void 0),p([g({reflect:!0})],t.prototype,"target",void 0),p([g({reflect:!0})],t.prototype,"rel",void 0),t};m.fn.removeAttr=function(e){let t=e.split(" ").filter(r=>r);return this.each(function(){E(t,r=>{wi(this,r)})})};var Ci=!0,ns=et();ns.addEventListener("pointerdown",()=>{Ci=!0});ns.addEventListener("keydown",()=>{Ci=!1});var go=e=>{class t extends e{constructor(){super(...arguments),this.autofocus=!1,this.focused=!1,this.focusVisible=!1,this.focusableDefinedController=new Wt(this,{relatedElements:[""]}),this._manipulatingTabindex=!1,this._tabIndex=0}get tabIndex(){let o=m(this);if(this.focusElement===this)return Number(o.attr("tabindex")||-1);let i=Number(o.attr("tabindex")||0);return this.focusDisabled||i<0?-1:this.focusElement?this.focusElement.tabIndex:i}set tabIndex(o){if(this._manipulatingTabindex){this._manipulatingTabindex=!1;return}let i=m(this);if(this.focusElement===this){o!==null&&(this._tabIndex=o),i.attr("tabindex",this.focusDisabled?null:o);return}let n=()=>{this.tabIndex===-1&&(this.tabIndex=0,this.focus({preventScroll:!0}))};if(o===-1?this.addEventListener("pointerdown",n):(this._manipulatingTabindex=!0,this.removeEventListener("pointerdown",n)),o===-1||this.focusDisabled){i.attr("tabindex",-1),o!==-1&&this.manageFocusElementTabindex(o);return}this.hasAttribute("tabindex")||(this._manipulatingTabindex=!1),this.manageFocusElementTabindex(o)}get focusDisabled(){throw new Error("Must implement focusDisabled getter!")}get focusElement(){throw new Error("Must implement focusElement getter!")}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{requestAnimationFrame(()=>{this.manageAutoFocus()})})}click(){this.focusDisabled||(this.focusElement!==this?this.focusElement.click():HTMLElement.prototype.click.apply(this))}focus(o){this.focusDisabled||!this.focusElement||(this.focusElement!==this?this.focusElement.focus(o):HTMLElement.prototype.focus.apply(this,[o]))}blur(){this.focusElement!==this?this.focusElement.blur():HTMLElement.prototype.blur.apply(this)}firstUpdated(o){super.firstUpdated(o),this.focusElement.addEventListener("focus",()=>{this.focused=!0,this.focusVisible=!Ci}),this.focusElement.addEventListener("blur",()=>{this.focused=!1,this.focusVisible=!1})}update(o){if(this._lastFocusDisabled===void 0||this._lastFocusDisabled!==this.focusDisabled){this._lastFocusDisabled=this.focusDisabled;let i=m(this);this.focusDisabled?i.removeAttr("tabindex"):this.focusElement===this?(this._manipulatingTabindex=!0,i.attr("tabindex",this._tabIndex)):this.tabIndex>-1&&i.removeAttr("tabindex")}super.update(o)}updated(o){super.updated(o),this.focused&&this.focusDisabled&&this.blur()}async manageFocusElementTabindex(o){this.focusElement||await this.updateComplete,o===null?this.focusElement.removeAttribute("tabindex"):this.focusElement.tabIndex=o}manageAutoFocus(){this.autofocus&&(this.dispatchEvent(new KeyboardEvent("keydown",{code:"Tab"})),this.focusElement.focus())}}return p([g({type:Boolean,reflect:!0,converter:_})],t.prototype,"autofocus",void 0),p([g({type:Boolean,reflect:!0,converter:_})],t.prototype,"focused",void 0),p([g({type:Boolean,reflect:!0,converter:_,attribute:"focus-visible"})],t.prototype,"focusVisible",void 0),p([g({type:Number,attribute:"tabindex"})],t.prototype,"tabIndex",null),t};var Ht=bt(class extends Dt{constructor(e){if(super(e),e.type!==yt.ATTRIBUTE||e.name!=="class"||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){if(this.st===void 0){this.st=new Set,e.strings!==void 0&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((o=>o!==""))));for(let o in t)t[o]&&!this.nt?.has(o)&&this.st.add(o);return this.render(t)}let r=e.element.classList;for(let o of this.st)o in t||(r.remove(o),this.st.delete(o));for(let o in t){let i=!!t[o];i===this.st.has(o)||this.nt?.has(o)||(i?(r.add(o),this.st.add(o)):(r.remove(o),this.st.delete(o)))}return ot}});var ss=J`:host{position:relative;display:inline-block;flex-shrink:0;width:2.5rem;height:2.5rem;stroke:rgb(var(--mdui-color-primary))}.progress{position:relative;display:inline-block;width:100%;height:100%;text-align:left;transition:opacity var(--mdui-motion-duration-medium1) var(--mdui-motion-easing-linear)}.determinate svg{transform:rotate(-90deg);fill:transparent}.determinate .track{stroke:transparent}.determinate .circle{stroke:inherit;transition:stroke-dashoffset var(--mdui-motion-duration-long2) var(--mdui-motion-easing-standard)}.indeterminate{font-size:0;letter-spacing:0;white-space:nowrap;animation:mdui-comp-circular-progress-rotate 1568ms var(--mdui-motion-easing-linear) infinite}.indeterminate .circle,.indeterminate .layer{position:absolute;width:100%;height:100%}.indeterminate .layer{animation:mdui-comp-circular-progress-layer-rotate 5332ms var(--mdui-motion-easing-standard) infinite both}.indeterminate .circle{fill:transparent;stroke:inherit}.indeterminate .gap-patch{position:absolute;top:0;left:47.5%;width:5%;height:100%;overflow:hidden}.indeterminate .gap-patch .circle{left:-900%;width:2000%;transform:rotate(180deg)}.indeterminate .clipper{position:relative;display:inline-block;width:50%;height:100%;overflow:hidden}.indeterminate .clipper .circle{width:200%}.indeterminate .clipper.left .circle{animation:mdui-comp-circular-progress-left-spin 1333ms var(--mdui-motion-easing-standard) infinite both}.indeterminate .clipper.right .circle{left:-100%;animation:mdui-comp-circular-progress-right-spin 1333ms var(--mdui-motion-easing-standard) infinite both}@keyframes mdui-comp-circular-progress-rotate{to{transform:rotate(360deg)}}@keyframes mdui-comp-circular-progress-layer-rotate{12.5%{transform:rotate(135deg)}25%{transform:rotate(270deg)}37.5%{transform:rotate(405deg)}50%{transform:rotate(540deg)}62.5%{transform:rotate(675deg)}75%{transform:rotate(810deg)}87.5%{transform:rotate(945deg)}100%{transform:rotate(1080deg)}}@keyframes mdui-comp-circular-progress-left-spin{0%{transform:rotate(265deg)}50%{transform:rotate(130deg)}100%{transform:rotate(265deg)}}@keyframes mdui-comp-circular-progress-right-spin{0%{transform:rotate(-265deg)}50%{transform:rotate(-130deg)}100%{transform:rotate(-265deg)}}`;var br=class extends Rt{constructor(){super(...arguments),this.max=1}render(){let t=!H(this.value);return b`<div class="progress ${Ht({determinate:t,indeterminate:!t})}">${t?this.renderDeterminate():this.renderInDeterminate()}</div>`}renderDeterminate(){let t=this.value,r=4,o=18,i=3.1415926,n=o+r/2,s=2*i*o,a=(1-t/Math.max(this.max??t,t))*s;return b`<svg viewBox="0 0 ${n*2} ${n*2}"><circle class="track" cx="${n}" cy="${n}" r="${o}" stroke-width="${r}"></circle><circle class="circle" cx="${n}" cy="${n}" r="${o}" stroke-dasharray="${2*i*o}" stroke-dashoffset="${a}" stroke-width="${r}"></circle></svg>`}renderInDeterminate(){let o=3.1415926,i=18+4/2,n=2*o*18,s=.5*n,a=l=>b`<svg class="circle" viewBox="0 0 ${i*2} ${i*2}"><circle cx="${i}" cy="${i}" r="${18}" stroke-dasharray="${n}" stroke-dashoffset="${s}" stroke-width="${l}"></circle></svg>`;return b`<div class="layer"><div class="clipper left">${a(4)}</div><div class="gap-patch">${a(4*.8)}</div><div class="clipper right">${a(4)}</div></div>`}};br.styles=[Bt,ss];p([g({type:Number,reflect:!0})],br.prototype,"max",void 0);p([g({type:Number})],br.prototype,"value",void 0);br=p([G("mdui-circular-progress")],br);m.fn.is=function(e){let t=!1;if(z(e))return this.each((o,i)=>{e.call(i,o,i)&&(t=!0)}),t;if(q(e))return this.each((o,i)=>{ur(i)||cr(i)||i.matches.call(i,e)&&(t=!0)}),t;let r=m(e);return this.each((o,i)=>{r.each((n,s)=>{i===s&&(t=!0)})}),t};m.fn.children=function(e){let t=[];return this.each((r,o)=>{E(o.childNodes,i=>{Ot(i)&&(!e||m(i).is(e))&&t.push(i)})}),new Q(ae(t))};m.fn.slice=function(...e){return new Q([].slice.apply(this,e))};m.fn.eq=function(e){let t=e===-1?this.slice(e):this.slice(e,+e+1);return new Q(t)};var as=(e,t,r,o,i)=>{let n=[],s;return e.each((a,l)=>{for(s=l[r];s&&Ot(s);){if(t===2){if(o&&m(s).is(o))break;(!i||m(s).is(i))&&n.push(s)}else if(t===0){(!o||m(s).is(o))&&n.push(s);break}else(!o||m(s).is(o))&&n.push(s);s=s[r]}}),new Q(ae(n))};E(["","s","sUntil"],(e,t)=>{m.fn[`parent${e}`]=function(r,o){let i=t?m(this.get().reverse()):this;return as(i,t,"parentNode",r,o)}});m.fn.index=function(e){return arguments.length?q(e)?m(e).get().indexOf(this[0]):this.get().indexOf(m(e)[0]):this.eq(0).parent().children().get().indexOf(this[0])};E(["add","remove","toggle"],e=>{m.fn[`${e}Class`]=function(t){return e==="remove"&&!arguments.length?this.each((r,o)=>{fo(o,"class","")}):this.each((r,o)=>{if(!Ot(o))return;let i=(z(t)?t.call(o,r,mo(o,"class","")):t).split(" ").filter(n=>n);E(i,n=>{o.classList[e](n)})})}});var ls=new WeakMap,yo=e=>ls.get(e)??{},cs=(e,t)=>{let r=yo(e),o=dr(t);return o in r?r[o]:void 0},Pi=(e,t)=>{let r=yo(e);K(t,(o,i)=>{r[dr(o)]=i}),ls.set(e,r)},us=(e,t,r)=>{Pi(e,{[t]:r})};var Ja=/^(?:{[\w\W]*\}|\[[\w\W]*\])$/,Qa=e=>e==="true"?!0:e==="false"?!1:e==="null"?null:e===+e+""?+e:Ja.test(e)?JSON.parse(e):e,ki=(e,t,r)=>{if(H(r)&&e.nodeType===1&&(r=e.dataset[t],q(r)))try{r=Qa(r)}catch{}return r};m.fn.data=function(e,t){if(H(e)){if(!this.length)return;let r=this[0],o=yo(r);return r.nodeType!==1||K(r.dataset,i=>{o[i]=ki(r,i,o[i])}),o}if(Tt(e))return this.each(function(){Pi(this,e)});if(arguments.length===2&&H(t))return this;if(!H(t))return this.each(function(){us(this,e,t)});if(this.length)return ki(this[0],dr(e),cs(this[0],e))};function ds(e,t){return Jt(e)?E(e,(r,o)=>t.call(r,o,r)):K(e,t)}function He(e,t){let r=$t(),o,i=[];return ds(e,(n,s)=>{o=t.call(r,s,n),o!=null&&i.push(o)}),[].concat(...i)}m.fn.map=function(e){return new Q(He(this,(t,r)=>e.call(t,r,t)))};m.fn.filter=function(e){if(z(e))return this.map((r,o)=>e.call(o,r,o)?o:void 0);if(q(e))return this.map((r,o)=>m(o).is(e)?o:void 0);let t=m(e);return this.map((r,o)=>t.get().includes(o)?o:void 0)};var hs=(e,t,r,o,i,n)=>{let s=a=>po(e,t.toLowerCase(),a)*n;return o===2&&i&&(r+=s("margin")),Ai(e)?(o===0&&(r-=s("border")),o===1&&(r-=s("border"),r-=s("padding"))):(o===0&&(r+=s("padding")),o===2&&(r+=s("border"),r+=s("padding"))),r},ms=(e,t,r,o)=>{let i=et(),n=`client${t}`,s=`scroll${t}`,a=`offset${t}`,l=`inner${t}`;if(cr(e))return r===2?e[l]:Ce(i)[n];if(ur(e)){let u=Ce(e);return Math.max(e.body[s],u[s],e.body[a],u[a],u[n])}let c=parseFloat(gr(e,t.toLowerCase())||"0");return hs(e,t,c,r,o,1)},Za=(e,t,r,o,i,n)=>{let s=z(n)?n.call(e,t,ms(e,r,o,i)):n;if(s==null)return;let a=m(e),l=r.toLowerCase();if(q(s)&&["auto","inherit",""].includes(s)){a.css(l,s);return}let c=s.toString().replace(/\b[0-9.]*/,""),u=parseFloat(s);s=hs(e,r,u,o,i,-1)+(c||"px"),a.css(l,s)};E(["Width","Height"],e=>{E([`inner${e}`,e.toLowerCase(),`outer${e}`],(t,r)=>{m.fn[t]=function(o,i){let n=arguments.length&&(r<2||!Nn(o)),s=o===!0||i===!0;return n?this.each((a,l)=>Za(l,a,e,r,s,o)):this.length?ms(this[0],e,r,s):void 0}})});m.fn.offsetParent=function(){let e=et();return this.map(function(){let t=this.offsetParent;for(;t&&m(t).css("position")==="static";)t=t.offsetParent;return t||e.documentElement})};var bo=(e,t)=>parseFloat(e.css(t));m.fn.position=function(){if(!this.length)return;let e=this.eq(0),t,r={left:0,top:0};if(e.css("position")==="fixed")t=e[0].getBoundingClientRect();else{t=e.offset();let o=e.offsetParent();r=o.offset(),r.top+=bo(o,"border-top-width"),r.left+=bo(o,"border-left-width")}return{top:t.top-r.top-bo(e,"margin-top"),left:t.left-r.left-bo(e,"margin-left")}};var fs=e=>{if(!e.getClientRects().length)return{top:0,left:0};let{top:t,left:r}=e.getBoundingClientRect(),{pageYOffset:o,pageXOffset:i}=e.ownerDocument.defaultView;return{top:t+o,left:r+i}},tl=(e,t,r)=>{let o=m(e),i=o.css("position");i==="static"&&o.css("position","relative");let n=fs(e),s=o.css("top"),a=o.css("left"),l,c;if((i==="absolute"||i==="fixed")&&(s+a).includes("auto")){let f=o.position();l=f.top,c=f.left}else l=parseFloat(s),c=parseFloat(a);let h=z(t)?t.call(e,r,uo({},n)):t;o.css({top:h.top!=null?h.top-n.top+l:void 0,left:h.left!=null?h.left-n.left+c:void 0})};m.fn.offset=function(e){return arguments.length?this.each(function(t){tl(this,e,t)}):this.length?fs(this[0]):void 0};m.fn.off=function(e,t,r){return Tt(e)?(K(e,(o,i)=>{this.off(o,t,i)}),this):((t===!1||z(t))&&(r=t,t=void 0),r===!1&&(r=ro),this.each(function(){Wn(this,e,r,t)}))};m.fn.on=function(e,t,r,o,i){if(Tt(e))return q(t)||(r=r||t,t=void 0),K(e,(n,s)=>{this.on(n,t,r,s,i)}),this;if(r==null&&o==null?(o=t,r=t=void 0):o==null&&(q(t)?(o=r,r=void 0):(o=r,r=t,t=void 0)),o===!1)o=ro;else if(!o)return this;if(i){let n=this,s=o;o=function(a,...l){return n.off(a.type,t,o),s.call(this,a,...l)}}return this.each(function(){qn(this,e,o,r,t)})};E(["insertBefore","insertAfter"],(e,t)=>{m.fn[e]=function(r){let o=t?m(this.get().reverse()):this,i=m(r),n=[];return i.each((s,a)=>{a.parentNode&&o.each((l,c)=>{let u=s?c.cloneNode(!0):c,h=t?a.nextSibling:a;n.push(u),a.parentNode.insertBefore(u,h)})}),m(t?n.reverse():n)}});m.fn.remove=function(e){return this.each((t,r)=>{(!e||m(r).is(e))&&no(r)})};E(["appendTo","prependTo"],(e,t)=>{m.fn[e]=function(r){let o=[],i=m(r).map((s,a)=>{let l=a.childNodes,c=l.length;if(c)return l[t?0:c-1];let u=hr("div");return io(a,u),o.push(u),u}),n=this[t?"insertBefore":"insertAfter"](i);return m(o).remove(),n}});var ps=J`:host{position:absolute;top:0;left:0;display:block;width:100%;height:100%;overflow:hidden;pointer-events:none}.surface{position:absolute;top:0;left:0;width:100%;height:100%;transition-duration:280ms;transition-property:background-color;pointer-events:none;transition-timing-function:var(--mdui-motion-easing-standard)}.hover{background-color:rgba(var(--mdui-comp-ripple-state-layer-color,var(--mdui-color-on-surface)),var(--mdui-state-layer-hover))}:host-context([focus-visible]) .focused{background-color:rgba(var(--mdui-comp-ripple-state-layer-color,var(--mdui-color-on-surface)),var(--mdui-state-layer-focus))}.dragged{background-color:rgba(var(--mdui-comp-ripple-state-layer-color,var(--mdui-color-on-surface)),var(--mdui-state-layer-dragged))}.wave{position:absolute;z-index:1;background-color:rgb(var(--mdui-comp-ripple-state-layer-color,var(--mdui-color-on-surface)));border-radius:50%;transform:translate3d(0,0,0) scale(.4);opacity:0;animation:225ms ease 0s 1 normal forwards running mdui-comp-ripple-radius-in,75ms ease 0s 1 normal forwards running mdui-comp-ripple-opacity-in;pointer-events:none}.out{transform:translate3d(var(--mdui-comp-ripple-transition-x,0),var(--mdui-comp-ripple-transition-y,0),0) scale(1);animation:150ms ease 0s 1 normal none running mdui-comp-ripple-opacity-out}@keyframes mdui-comp-ripple-radius-in{from{transform:translate3d(0,0,0) scale(.4);animation-timing-function:var(--mdui-motion-easing-standard)}to{transform:translate3d(var(--mdui-comp-ripple-transition-x,0),var(--mdui-comp-ripple-transition-y,0),0) scale(1)}}@keyframes mdui-comp-ripple-opacity-in{from{opacity:0;animation-timing-function:linear}to{opacity:var(--mdui-state-layer-pressed)}}@keyframes mdui-comp-ripple-opacity-out{from{animation-timing-function:linear;opacity:var(--mdui-state-layer-pressed)}to{opacity:0}}`;var Ee=class extends Rt{constructor(){super(...arguments),this.noRipple=!1,this.hover=!1,this.focused=!1,this.dragged=!1,this.surfaceRef=St()}startPress(t){if(this.noRipple)return;let r=m(this.surfaceRef.value),o=r.innerHeight(),i=r.innerWidth(),n,s;if(!t)n=i/2,s=o/2;else{let h=typeof TouchEvent<"u"&&t instanceof TouchEvent&&t.touches.length?t.touches[0]:t,f=r.offset();if(h.pageX<f.left||h.pageX>f.left+i||h.pageY<f.top||h.pageY>f.top+o)return;n=h.pageX-f.left,s=h.pageY-f.top}let a=Math.max(Math.pow(Math.pow(o,2)+Math.pow(i,2),.5),48),l=`${-n+i/2}px`,c=`${-s+o/2}px`,u=`translate3d(${l}, ${c}, 0) scale(1)`;m('<div class="wave"></div>').css({width:a,height:a,marginTop:-a/2,marginLeft:-a/2,left:n,top:s}).each((h,f)=>{f.style.setProperty("--mdui-comp-ripple-transition-x",l),f.style.setProperty("--mdui-comp-ripple-transition-y",c)}).prependTo(this.surfaceRef.value).each((h,f)=>f.clientLeft).css("transform",u).on("animationend",function(h){h.animationName==="mdui-comp-ripple-radius-in"&&m(this).data("filled",!0)})}endPress(){let t=m(this.surfaceRef.value).children().filter((o,i)=>!m(i).data("removing")).data("removing",!0),r=o=>{o.addClass("out").each((i,n)=>n.clientLeft).on("animationend",function(){m(this).remove()})};t.filter((o,i)=>!m(i).data("filled")).on("animationend",function(o){o.animationName==="mdui-comp-ripple-radius-in"&&r(m(this))}),r(t.filter((o,i)=>!!m(i).data("filled")))}startHover(){this.hover=!0}endHover(){this.hover=!1}startFocus(){this.focused=!0}endFocus(){this.focused=!1}startDrag(){this.dragged=!0}endDrag(){this.dragged=!1}render(){return b`<div ${vt(this.surfaceRef)} class="surface ${Ht({hover:this.hover,focused:this.focused,dragged:this.dragged})}"></div>`}};Ee.styles=[Bt,ps];p([g({type:Boolean,reflect:!0,converter:_,attribute:"no-ripple"})],Ee.prototype,"noRipple",void 0);p([qt()],Ee.prototype,"hover",void 0);p([qt()],Ee.prototype,"focused",void 0);p([qt()],Ee.prototype,"dragged",void 0);Ee=p([G("mdui-ripple")],Ee);var gs=e=>{class t extends e{constructor(){super(...arguments),this.noRipple=!1,this.rippleIndex=void 0,this.getRippleIndex=()=>this.rippleIndex}get rippleElement(){throw new Error("Must implement rippleElement getter!")}get rippleDisabled(){throw new Error("Must implement rippleDisabled getter!")}get rippleTarget(){return this}firstUpdated(o){super.firstUpdated(o);let i=m(this.rippleTarget),n=a=>{Jt(this.rippleTarget)&&(this.rippleIndex=i.index(a.target))};(Jt(this.rippleTarget)?this.rippleTarget:[this.rippleTarget]).forEach(a=>{a.addEventListener("pointerdown",l=>{n(l),this.startPress(l)}),a.addEventListener("pointerenter",l=>{n(l),this.startHover(l)}),a.addEventListener("pointerleave",l=>{n(l),this.endHover(l)}),a.addEventListener("focus",l=>{n(l),this.startFocus()}),a.addEventListener("blur",l=>{n(l),this.endFocus()})})}startHover(o){o.pointerType!=="mouse"||this.isRippleDisabled()||(this.getRippleTarget().setAttribute("hover",""),this.getRippleElement().startHover())}endHover(o){o.pointerType!=="mouse"||this.isRippleDisabled()||(this.getRippleTarget().removeAttribute("hover"),this.getRippleElement().endHover())}isRippleDisabled(){let o=this.rippleDisabled;if(!Array.isArray(o))return o;let i=this.getRippleIndex();return i!==void 0?o[i]:o.length?o[0]:!1}getRippleElement(){let o=this.rippleElement;if(!Jt(o))return o;let i=this.getRippleIndex();return i!==void 0?o[i]:o[0]}getRippleTarget(){let o=this.rippleTarget;if(!Jt(o))return o;let i=this.getRippleIndex();return i!==void 0?o[i]:o[0]}startFocus(){this.isRippleDisabled()||this.getRippleElement().startFocus()}endFocus(){this.isRippleDisabled()||this.getRippleElement().endFocus()}startPress(o){if(this.isRippleDisabled()||o.button)return;let i=this.getRippleTarget();if(i.setAttribute("pressed",""),["touch","pen"].includes(o.pointerType)){let n=!1,s=setTimeout(()=>{s=0,this.getRippleElement().startPress(o)},70),a=()=>{s&&(clearTimeout(s),s=0,this.getRippleElement().startPress(o)),n||(n=!0,this.endPress()),i.removeEventListener("pointerup",a),i.removeEventListener("pointercancel",a)},l=()=>{s&&(clearTimeout(s),s=0),i.removeEventListener("touchmove",l)};i.addEventListener("touchmove",l),i.addEventListener("pointerup",a),i.addEventListener("pointercancel",a)}if(o.pointerType==="mouse"&&o.button===0){let n=()=>{this.endPress(),i.removeEventListener("pointerup",n),i.removeEventListener("pointercancel",n),i.removeEventListener("pointerleave",n)};this.getRippleElement().startPress(o),i.addEventListener("pointerup",n),i.addEventListener("pointercancel",n),i.addEventListener("pointerleave",n)}}endPress(){this.isRippleDisabled()||(this.getRippleTarget().removeAttribute("pressed"),this.getRippleElement().endPress())}startDrag(){this.isRippleDisabled()||this.getRippleElement().startDrag()}endDrag(){this.isRippleDisabled()||this.getRippleElement().endDrag()}}return p([g({type:Boolean,reflect:!0,converter:_,attribute:"no-ripple"})],t.prototype,"noRipple",void 0),t};var ys=J`.button{position:relative;display:inline-flex;align-items:center;justify-content:center;height:100%;padding:0;overflow:hidden;color:inherit;font-size:inherit;font-family:inherit;font-weight:inherit;letter-spacing:inherit;white-space:nowrap;text-align:center;text-decoration:none;vertical-align:middle;background:0 0;border:none;outline:0;cursor:inherit;-webkit-user-select:none;user-select:none;touch-action:manipulation;zoom:1;-webkit-user-drag:none}`;var Z=class extends is(gs(go(Rt))){constructor(){super(...arguments),this.disabled=!1,this.loading=!1,this.name="",this.value="",this.type="button",this.formNoValidate=!1,this.formController=new ze(this)}get validity(){if(this.isButton())return this.focusElement.validity}get validationMessage(){if(this.isButton())return this.focusElement.validationMessage}get rippleDisabled(){return this.disabled||this.loading}get focusElement(){return this.isButton()?this.renderRoot?.querySelector("._button"):this.focusDisabled?this:this.renderRoot?.querySelector("._a")}get focusDisabled(){return this.disabled||this.loading}checkValidity(){if(this.isButton()){let t=this.focusElement.checkValidity();return t||this.emit("invalid",{bubbles:!1,cancelable:!0,composed:!1}),t}return!0}reportValidity(){if(this.isButton()){let t=!this.focusElement.reportValidity();return t&&this.emit("invalid",{bubbles:!1,cancelable:!0,composed:!1}),!t}return!0}setCustomValidity(t){this.isButton()&&this.focusElement.setCustomValidity(t)}firstUpdated(t){super.firstUpdated(t),this.addEventListener("click",()=>{this.type==="submit"&&this.formController.submit(this),this.type==="reset"&&this.formController.reset(this)})}renderLoading(){return this.loading?b`<mdui-circular-progress part="loading"></mdui-circular-progress>`:pt}renderButton({id:t,className:r,part:o,content:i=b`<slot></slot>`}){return b`<button id="${O(t)}" class="${Fe(["_button",r])}" part="${O(o)}" ?disabled="${this.rippleDisabled||this.focusDisabled}">${i}</button>`}isButton(){return!this.href}};Z.styles=[Bt,ys];p([g({type:Boolean,reflect:!0,converter:_})],Z.prototype,"disabled",void 0);p([g({type:Boolean,reflect:!0,converter:_})],Z.prototype,"loading",void 0);p([g({reflect:!0})],Z.prototype,"name",void 0);p([g({reflect:!0})],Z.prototype,"value",void 0);p([g({reflect:!0})],Z.prototype,"type",void 0);p([g({reflect:!0})],Z.prototype,"form",void 0);p([g({reflect:!0,attribute:"formaction"})],Z.prototype,"formAction",void 0);p([g({reflect:!0,attribute:"formenctype"})],Z.prototype,"formEnctype",void 0);p([g({reflect:!0,attribute:"formmethod"})],Z.prototype,"formMethod",void 0);p([g({type:Boolean,reflect:!0,converter:_,attribute:"formnovalidate"})],Z.prototype,"formNoValidate",void 0);p([g({reflect:!0,attribute:"formtarget"})],Z.prototype,"formTarget",void 0);var bs=J`:host{--shape-corner:var(--mdui-shape-corner-full);position:relative;display:inline-block;flex-shrink:0;overflow:hidden;text-align:center;border-radius:var(--shape-corner);cursor:pointer;-webkit-tap-highlight-color:transparent;transition:box-shadow var(--mdui-motion-duration-short4) var(--mdui-motion-easing-linear);min-width:3rem;height:2.5rem;color:rgb(var(--mdui-color-primary));font-size:var(--mdui-typescale-label-large-size);font-weight:var(--mdui-typescale-label-large-weight);letter-spacing:var(--mdui-typescale-label-large-tracking);line-height:var(--mdui-typescale-label-large-line-height)}.button{width:100%;padding:0 1rem}:host([full-width]:not([full-width=false i])){display:block}:host([variant=elevated]){box-shadow:var(--mdui-elevation-level1);background-color:rgb(var(--mdui-color-surface-container-low));--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}:host([variant=filled]){color:rgb(var(--mdui-color-on-primary));background-color:rgb(var(--mdui-color-primary));--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-primary)}:host([variant=tonal]){color:rgb(var(--mdui-color-on-secondary-container));background-color:rgb(var(--mdui-color-secondary-container));--mdui-comp-ripple-state-layer-color:var(
4
+ --mdui-color-on-secondary-container
5
+ )}:host([variant=outlined]){border:.0625rem solid rgb(var(--mdui-color-outline));--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}:host([variant=text]){--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}:host([variant=outlined][focus-visible]){border-color:rgb(var(--mdui-color-primary))}:host([variant=elevated][hover]){box-shadow:var(--mdui-elevation-level2)}:host([variant=filled][hover]),:host([variant=tonal][hover]){box-shadow:var(--mdui-elevation-level1)}:host([disabled]:not([disabled=false i])),:host([loading]:not([loading=false i])){cursor:default;pointer-events:none}:host([disabled]:not([disabled=false i])){color:rgba(var(--mdui-color-on-surface),38%);box-shadow:var(--mdui-elevation-level0)}:host([variant=elevated][disabled]:not([disabled=false i])),:host([variant=filled][disabled]:not([disabled=false i])),:host([variant=tonal][disabled]:not([disabled=false i])){background-color:rgba(var(--mdui-color-on-surface),12%)}:host([variant=outlined][disabled]:not([disabled=false i])){border-color:rgba(var(--mdui-color-on-surface),12%)}.label{display:inline-flex;padding-right:.5rem;padding-left:.5rem}.end-icon,.icon{display:inline-flex;font-size:1.28571429em}.end-icon mdui-icon,.icon mdui-icon,::slotted([slot=end-icon]),::slotted([slot=icon]){font-size:inherit}mdui-circular-progress{display:inline-flex;width:1.125rem;height:1.125rem}:host([variant=filled]) mdui-circular-progress{stroke:rgb(var(--mdui-color-on-primary))}:host([variant=tonal]) mdui-circular-progress{stroke:rgb(var(--mdui-color-on-secondary-container))}:host([disabled]:not([disabled=false i])) mdui-circular-progress{stroke:rgba(var(--mdui-color-on-surface),38%)}`;var Se=class extends Z{constructor(){super(...arguments),this.variant="filled",this.fullWidth=!1,this.rippleRef=St()}get rippleElement(){return this.rippleRef.value}render(){return b`<mdui-ripple ${vt(this.rippleRef)} .noRipple="${this.noRipple}"></mdui-ripple>${this.isButton()?this.renderButton({className:"button",part:"button",content:this.renderInner()}):this.disabled||this.loading?b`<span part="button" class="button _a">${this.renderInner()}</span>`:this.renderAnchor({className:"button",part:"button",content:this.renderInner()})}`}renderIcon(){return this.loading?this.renderLoading():b`<slot name="icon" part="icon" class="icon">${this.icon?b`<mdui-icon name="${this.icon}"></mdui-icon>`:pt}</slot>`}renderLabel(){return b`<slot part="label" class="label"></slot>`}renderEndIcon(){return b`<slot name="end-icon" part="end-icon" class="end-icon">${this.endIcon?b`<mdui-icon name="${this.endIcon}"></mdui-icon>`:pt}</slot>`}renderInner(){return[this.renderIcon(),this.renderLabel(),this.renderEndIcon()]}};Se.styles=[Z.styles,bs];p([g({reflect:!0})],Se.prototype,"variant",void 0);p([g({type:Boolean,reflect:!0,converter:_,attribute:"full-width"})],Se.prototype,"fullWidth",void 0);p([g({reflect:!0})],Se.prototype,"icon",void 0);p([g({reflect:!0,attribute:"end-icon"})],Se.prototype,"endIcon",void 0);Se=p([G("mdui-button")],Se);function Ft(e,t=!1){return(r,o)=>{let{update:i}=r;e in r&&(r.update=function(n){if(n.has(e)){let s=n.get(e),a=this[e];s!==a&&(!t||this.hasUpdated)&&this[o](s,a)}i.call(this,n)})}}var vs=(e=0)=>new Promise(t=>setTimeout(t,e));var xs=J`:host{--shape-corner-small:var(--mdui-shape-corner-small);--shape-corner-normal:var(--mdui-shape-corner-large);--shape-corner-large:var(--mdui-shape-corner-extra-large);position:relative;display:inline-block;flex-shrink:0;overflow:hidden;text-align:center;border-radius:var(--shape-corner-normal);cursor:pointer;-webkit-tap-highlight-color:transparent;transition-property:box-shadow;transition-timing-function:var(--mdui-motion-easing-emphasized);transition-duration:var(--mdui-motion-duration-medium4);width:3.5rem;height:3.5rem;box-shadow:var(--mdui-elevation-level3);font-size:var(--mdui-typescale-label-large-size);font-weight:var(--mdui-typescale-label-large-weight);letter-spacing:var(--mdui-typescale-label-large-tracking);line-height:var(--mdui-typescale-label-large-line-height)}.button{padding:0 1rem}:host([size=small]) .button{padding:0 .5rem}:host([size=large]) .button{padding:0 1.875rem}:host([lowered]){box-shadow:var(--mdui-elevation-level1)}:host([focus-visible]){box-shadow:var(--mdui-elevation-level3)}:host([lowered][focus-visible]){box-shadow:var(--mdui-elevation-level1)}:host([pressed]){box-shadow:var(--mdui-elevation-level3)}:host([lowered][pressed]){box-shadow:var(--mdui-elevation-level1)}:host([hover]){box-shadow:var(--mdui-elevation-level4)}:host([lowered][hover]){box-shadow:var(--mdui-elevation-level2)}:host([variant=primary]){color:rgb(var(--mdui-color-on-primary-container));background-color:rgb(var(--mdui-color-primary-container));--mdui-comp-ripple-state-layer-color:var(
6
+ --mdui-color-on-primary-container
7
+ )}:host([variant=surface]){color:rgb(var(--mdui-color-primary));background-color:rgb(var(--mdui-color-surface-container-high));--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}:host([variant=surface][lowered]){background-color:rgb(var(--mdui-color-surface-container-low))}:host([variant=secondary]){color:rgb(var(--mdui-color-on-secondary-container));background-color:rgb(var(--mdui-color-secondary-container));--mdui-comp-ripple-state-layer-color:var(
8
+ --mdui-color-on-secondary-container
9
+ )}:host([variant=tertiary]){color:rgb(var(--mdui-color-on-tertiary-container));background-color:rgb(var(--mdui-color-tertiary-container));--mdui-comp-ripple-state-layer-color:var(
10
+ --mdui-color-on-tertiary-container
11
+ )}:host([size=small]){border-radius:var(--shape-corner-small);width:2.5rem;height:2.5rem}:host([size=large]){border-radius:var(--shape-corner-large);width:6rem;height:6rem}:host([disabled]:not([disabled=false i])),:host([loading]:not([loading=false i])){cursor:default;pointer-events:none}:host([disabled]:not([disabled=false i])){color:rgba(var(--mdui-color-on-surface),38%);background-color:rgba(var(--mdui-color-on-surface),12%);box-shadow:var(--mdui-elevation-level0)}:host([extended]:not([extended=false i])){width:auto}.label{display:inline-flex;transition:opacity var(--mdui-motion-duration-short2) var(--mdui-motion-easing-linear) var(--mdui-motion-duration-short2);padding-left:.25rem;padding-right:.25rem}.has-icon .label{margin-left:.5rem}:host([size=small]) .has-icon .label{margin-left:.25rem}:host([size=large]) .has-icon .label{margin-left:1rem}:host(:not([extended])) .label,:host([extended=false i]) .label{opacity:0;transition-delay:0s;transition-duration:var(--mdui-motion-duration-short1)}:host([size=large]) .label{font-size:1.5em}.icon{display:inline-flex;font-size:1.71428571em}:host([size=large]) .icon{font-size:2.57142857em}.icon mdui-icon,::slotted([slot=icon]){font-size:inherit}mdui-circular-progress{display:inline-flex;width:1.5rem;height:1.5rem}:host([size=large]) mdui-circular-progress{width:2.25rem;height:2.25rem}:host([disabled]:not([disabled=false i])) mdui-circular-progress{stroke:rgba(var(--mdui-color-on-surface),38%)}`;var le=class extends Z{constructor(){super(...arguments),this.variant="primary",this.size="normal",this.extended=!1,this.rippleRef=St(),this.hasSlotController=new Lt(this,"icon"),this.definedController=new Wt(this,{relatedElements:[""]})}get rippleElement(){return this.rippleRef.value}async onExtendedChange(){let t=this.hasUpdated;this.extended?this.style.width=`${this.scrollWidth}px`:this.style.width="",await this.definedController.whenDefined(),await this.updateComplete,this.extended&&!t&&(this.style.width=`${this.scrollWidth}px`),t||(await vs(),this.style.transitionProperty="box-shadow, width, bottom, transform")}render(){let t=Fe({button:!0,"has-icon":this.icon||this.hasSlotController.test("icon")});return b`<mdui-ripple ${vt(this.rippleRef)} .noRipple="${this.noRipple}"></mdui-ripple>${this.isButton()?this.renderButton({className:t,part:"button",content:this.renderInner()}):this.disabled||this.loading?b`<span part="button" class="_a ${t}">${this.renderInner()}</span>`:this.renderAnchor({className:t,part:"button",content:this.renderInner()})}`}renderLabel(){return b`<slot part="label" class="label"></slot>`}renderIcon(){return this.loading?this.renderLoading():b`<slot name="icon" part="icon" class="icon">${this.icon?b`<mdui-icon name="${this.icon}"></mdui-icon>`:pt}</slot>`}renderInner(){return[this.renderIcon(),this.renderLabel()]}};le.styles=[Z.styles,xs];p([g({reflect:!0})],le.prototype,"variant",void 0);p([g({reflect:!0})],le.prototype,"size",void 0);p([g({reflect:!0})],le.prototype,"icon",void 0);p([g({type:Boolean,reflect:!0,converter:_})],le.prototype,"extended",void 0);p([Ft("extended")],le.prototype,"onExtendedChange",null);le=p([G("mdui-fab")],le);var Ei=bt(class extends Dt{constructor(e){if(super(e),e.type!==yt.PROPERTY&&e.type!==yt.ATTRIBUTE&&e.type!==yt.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!Jr(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[t]){if(t===ot||t===F)return t;let r=e.element,o=e.name;if(e.type===yt.PROPERTY){if(t===r[o])return ot}else if(e.type===yt.BOOLEAN_ATTRIBUTE){if(!!t===r.hasAttribute(o))return ot}else if(e.type===yt.ATTRIBUTE&&r.getAttribute(o)===t+"")return ot;return Rn(e),t}});function Nt(e,t,r){return e?t(e):r?.(e)}var vo="lit-localize-status";var ws=e=>typeof e!="string"&&"strTag"in e,Si=(e,t,r)=>{let o=e[0];for(let i=1;i<e.length;i++)o+=t[r?r[i-1]:i-1],o+=e[i];return o};var xo=(e=>ws(e)?Si(e.strings,e.values):e);var vr=xo;var wo=class{constructor(){this.settled=!1,this.promise=new Promise((t,r)=>{this._resolve=t,this._reject=r})}resolve(t){this.settled=!0,this._resolve(t)}reject(t){this.settled=!0,this._reject(t)}};var el=[];for(let e=0;e<256;e++)el[e]=(e>>4&15).toString(16)+(e&15).toString(16);var ol=new wo;ol.resolve();function As(e="value"){return(t,r)=>{let o=t.constructor,i=o.prototype.attributeChangedCallback;o.prototype.attributeChangedCallback=function(n,s,a){let l=o.getPropertyOptions(e),c=q(l.attribute)?l.attribute:e;if(n===c){let u=l.converter||se,f=(z(u)?u:u?.fromAttribute??se.fromAttribute)(a,l.type);this[e]!==f&&(this[r]=f)}i.call(this,n,s,a)}}}var il=0,Cs=()=>++il;var ce,$i,Ps=(e,t)=>{let r=m(e),o=Cs(),i={unobserve:()=>{r.each((n,s)=>{let a=ce.get(s),l=a.coArr.findIndex(c=>c.key===o);l!==-1&&a.coArr.splice(l,1),a.coArr.length?ce.set(s,a):($i.unobserve(s),ce.delete(s))})}};return ce||(ce=new WeakMap,$i=new ResizeObserver(n=>{n.forEach(s=>{let a=s.target,l=ce.get(a);l.entry=s,l.coArr.forEach(c=>{c.callback.call(i,s,i)})})})),r.each((n,s)=>{let a=ce.get(s)??{coArr:[]};a.coArr.length&&a.entry&&t.call(i,a.entry,i),a.coArr.push({callback:t,key:o}),ce.set(s,a),$i.observe(s)}),i};var ue=J`:host{display:inline-block;width:1em;height:1em;line-height:1;font-size:1.5rem}`;var de=e=>b`<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 24 24" fill="currentColor">${Zr(e)}</svg>`;var Ti=class extends ft{render(){return de('<path d="M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm3.59-13L12 10.59 8.41 7 7 8.41 10.59 12 7 15.59 8.41 17 12 13.41 15.59 17 17 15.59 13.41 12 17 8.41z"/>')}};Ti.styles=ue;Ti=p([G("mdui-icon-cancel--outlined")],Ti);var Ri=class extends ft{render(){return de('<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/>')}};Ri.styles=ue;Ri=p([G("mdui-icon-error")],Ri);var _i=class extends ft{render(){return de('<path d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46A11.804 11.804 0 0 0 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78 3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"/>')}};_i.styles=ue;_i=p([G("mdui-icon-visibility-off")],_i);var Mi=class extends ft{render(){return de('<path d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/>')}};Mi.styles=ue;Mi=p([G("mdui-icon-visibility")],Mi);var ks=!1,Ao=new Map,Co=(e,t)=>{ks||(ks=!0,$t().addEventListener(vo,i=>{i.detail.status==="ready"&&Ao.forEach(n=>{n.forEach(s=>s())})}));let r=Ao.get(e)||[];r.push(t),Ao.set(e,r)},he=e=>{Ao.delete(e)};var Es=J`:host{--shape-corner:var(--mdui-shape-corner-full);position:relative;display:inline-block;flex-shrink:0;overflow:hidden;text-align:center;border-radius:var(--shape-corner);cursor:pointer;-webkit-tap-highlight-color:transparent;font-size:1.5rem;width:2.5rem;height:2.5rem}:host([variant=standard]){color:rgb(var(--mdui-color-on-surface-variant));--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface-variant)}:host([variant=filled]){color:rgb(var(--mdui-color-primary));background-color:rgb(var(--mdui-color-surface-container-highest));--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}:host([variant=tonal]){color:rgb(var(--mdui-color-on-surface-variant));background-color:rgb(var(--mdui-color-surface-container-highest));--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface-variant)}:host([variant=outlined]){border:.0625rem solid rgb(var(--mdui-color-outline));color:rgb(var(--mdui-color-on-surface-variant));--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface-variant)}:host([variant=outlined][pressed]){color:rgb(var(--mdui-color-on-surface));--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}:host([variant=standard][selected]:not([selected=false i])){color:rgb(var(--mdui-color-primary));--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}:host([variant=filled]:not([selectable])),:host([variant=filled][selectable=false i]),:host([variant=filled][selected]:not([selected=false i])){color:rgb(var(--mdui-color-on-primary));background-color:rgb(var(--mdui-color-primary));--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-primary)}:host([variant=tonal]:not([selectable])),:host([variant=tonal][selectable=false i]),:host([variant=tonal][selected]:not([selected=false i])){color:rgb(var(--mdui-color-on-secondary-container));background-color:rgb(var(--mdui-color-secondary-container));--mdui-comp-ripple-state-layer-color:var(
12
+ --mdui-color-on-secondary-container
13
+ )}:host([variant=outlined][selected]:not([selected=false i])){border:none;color:rgb(var(--mdui-color-inverse-on-surface));background-color:rgb(var(--mdui-color-inverse-surface));--mdui-comp-ripple-state-layer-color:var(--mdui-color-inverse-on-surface)}:host([variant=filled][disabled]:not([disabled=false i])),:host([variant=outlined][disabled]:not([disabled=false i])),:host([variant=tonal][disabled]:not([disabled=false i])){background-color:rgba(var(--mdui-color-on-surface),.12);border-color:rgba(var(--mdui-color-on-surface),.12)}:host([disabled]:not([disabled=false i])),:host([loading]:not([loading=false i])){cursor:default;pointer-events:none}:host([disabled]:not([disabled=false i])){color:rgba(var(--mdui-color-on-surface),.38)!important}.button{float:left;width:100%}:host([loading]:not([loading=false i])) .button,:host([loading]:not([loading=false i])) mdui-ripple{opacity:0}.icon,.selected-icon mdui-icon,::slotted(*){font-size:inherit}mdui-circular-progress{display:flex;position:absolute;top:calc(50% - 1.5rem / 2);left:calc(50% - 1.5rem / 2);width:1.5rem;height:1.5rem}:host([variant=filled]:not([disabled])) mdui-circular-progress,:host([variant=filled][disabled=false i]) mdui-circular-progress{stroke:rgb(var(--mdui-color-on-primary))}:host([disabled]:not([disabled=false i])) mdui-circular-progress{stroke:rgba(var(--mdui-color-on-surface),38%)}`;var Zt=class extends Z{constructor(){super(...arguments),this.variant="standard",this.selectable=!1,this.selected=!1,this.rippleRef=St(),this.hasSlotController=new Lt(this,"[default]","selected-icon")}get rippleElement(){return this.rippleRef.value}onSelectedChange(){this.emit("change")}firstUpdated(t){super.firstUpdated(t),this.addEventListener("click",()=>{!this.selectable||this.disabled||(this.selected=!this.selected)})}render(){return b`<mdui-ripple ${vt(this.rippleRef)} .noRipple="${this.noRipple}"></mdui-ripple>${this.isButton()?this.renderButton({className:"button",part:"button",content:this.renderIcon()}):this.disabled||this.loading?b`<span part="button" class="button _a">${this.renderIcon()}</span>`:this.renderAnchor({className:"button",part:"button",content:this.renderIcon()})} ${this.renderLoading()}`}renderIcon(){let t=()=>this.hasSlotController.test("[default]")?b`<slot></slot>`:this.icon?b`<mdui-icon part="icon" class="icon" name="${this.icon}"></mdui-icon>`:pt,r=()=>this.hasSlotController.test("selected-icon")||this.selectedIcon?b`<slot name="selected-icon" part="selected-icon" class="selected-icon"><mdui-icon name="${this.selectedIcon}"></mdui-icon></slot>`:t();return this.selected?r():t()}};Zt.styles=[Z.styles,Es];p([g({reflect:!0})],Zt.prototype,"variant",void 0);p([g({reflect:!0})],Zt.prototype,"icon",void 0);p([g({reflect:!0,attribute:"selected-icon"})],Zt.prototype,"selectedIcon",void 0);p([g({type:Boolean,reflect:!0,converter:_})],Zt.prototype,"selectable",void 0);p([g({type:Boolean,reflect:!0,converter:_})],Zt.prototype,"selected",void 0);p([Ft("selected",!0)],Zt.prototype,"onSelectedChange",null);Zt=p([G("mdui-button-icon")],Zt);var Ss=J`:host{display:inline-block;width:100%}:host([disabled]:not([disabled=false i])){pointer-events:none}:host([type=hidden]){display:none}.container{position:relative;display:flex;align-items:center;height:100%;padding:.125rem .125rem .125rem 1rem;transition:box-shadow var(--mdui-motion-duration-short4) var(--mdui-motion-easing-standard)}.container.has-icon{padding-left:.75rem}.container.has-action,.container.has-right-icon,.container.has-suffix{padding-right:.75rem}:host([variant=filled]) .container{box-shadow:inset 0 -.0625rem 0 0 rgb(var(--mdui-color-on-surface-variant));background-color:rgb(var(--mdui-color-surface-container-highest));border-radius:var(--mdui-shape-corner-extra-small) var(--mdui-shape-corner-extra-small) 0 0}:host([variant=outlined]) .container{box-shadow:inset 0 0 0 .0625rem rgb(var(--mdui-color-outline));border-radius:var(--mdui-shape-corner-extra-small)}:host([variant=filled]) .container.invalid,:host([variant=filled]) .container.invalid-style{box-shadow:inset 0 -.0625rem 0 0 rgb(var(--mdui-color-error))}:host([variant=outlined]) .container.invalid,:host([variant=outlined]) .container.invalid-style{box-shadow:inset 0 0 0 .0625rem rgb(var(--mdui-color-error))}:host([variant=filled]:hover) .container{box-shadow:inset 0 -.0625rem 0 0 rgb(var(--mdui-color-on-surface))}:host([variant=outlined]:hover) .container{box-shadow:inset 0 0 0 .0625rem rgb(var(--mdui-color-on-surface))}:host([variant=filled]:hover) .container.invalid,:host([variant=filled]:hover) .container.invalid-style{box-shadow:inset 0 -.0625rem 0 0 rgb(var(--mdui-color-on-error-container))}:host([variant=outlined]:hover) .container.invalid,:host([variant=outlined]:hover) .container.invalid-style{box-shadow:inset 0 0 0 .0625rem rgb(var(--mdui-color-on-error-container))}:host([variant=filled][focused-style]) .container,:host([variant=filled][focused]) .container{box-shadow:inset 0 -.125rem 0 0 rgb(var(--mdui-color-primary))}:host([variant=outlined][focused-style]) .container,:host([variant=outlined][focused]) .container{box-shadow:inset 0 0 0 .125rem rgb(var(--mdui-color-primary))}:host([variant=filled][focused-style]) .container.invalid,:host([variant=filled][focused-style]) .container.invalid-style,:host([variant=filled][focused]) .container.invalid,:host([variant=filled][focused]) .container.invalid-style{box-shadow:inset 0 -.125rem 0 0 rgb(var(--mdui-color-error))}:host([variant=outlined][focused-style]) .container.invalid,:host([variant=outlined][focused-style]) .container.invalid-style,:host([variant=outlined][focused]) .container.invalid,:host([variant=outlined][focused]) .container.invalid-style{box-shadow:inset 0 0 0 .125rem rgb(var(--mdui-color-error))}:host([variant=filled][disabled]:not([disabled=false i])) .container{box-shadow:inset 0 -.0625rem 0 0 rgba(var(--mdui-color-on-surface),38%);background-color:rgba(var(--mdui-color-on-surface),4%)}:host([variant=outlined][disabled]:not([disabled=false i])) .container{box-shadow:inset 0 0 0 .125rem rgba(var(--mdui-color-on-surface),12%)}.action,.icon,.prefix,.right-icon,.suffix{display:flex;-webkit-user-select:none;user-select:none;color:rgb(var(--mdui-color-on-surface-variant))}:host([disabled]:not([disabled=false i])) .action,:host([disabled]:not([disabled=false i])) .icon,:host([disabled]:not([disabled=false i])) .prefix,:host([disabled]:not([disabled=false i])) .right-icon,:host([disabled]:not([disabled=false i])) .suffix{color:rgba(var(--mdui-color-on-surface),38%)}.invalid .right-icon,.invalid-style .right-icon{color:rgb(var(--mdui-color-error))}:host(:hover) .invalid .right-icon,:host(:hover) .invalid-style .right-icon{color:rgb(var(--mdui-color-on-error-container))}:host([focused-style]) .invalid .right-icon,:host([focused-style]) .invalid-style .right-icon,:host([focused]) .invalid .right-icon,:host([focused]) .invalid-style .right-icon{color:rgb(var(--mdui-color-error))}.action,.icon,.right-icon{font-size:1.5rem}.action mdui-button-icon,.icon mdui-button-icon,.right-icon mdui-button-icon,::slotted(mdui-button-icon[slot]){margin-left:-.5rem;margin-right:-.5rem}.action .i,.icon .i,.right-icon .i,::slotted([slot$=icon]){font-size:inherit}.has-icon .icon{margin-right:1rem}.has-prefix .prefix{padding-right:.125rem}.has-action .action{margin-left:.75rem}.has-suffix .suffix{padding-right:.25rem;padding-left:.125rem}.has-right-icon .right-icon{margin-left:.75rem}.prefix,.suffix{display:none;font-size:var(--mdui-typescale-body-large-size);font-weight:var(--mdui-typescale-body-large-weight);letter-spacing:var(--mdui-typescale-body-large-tracking);line-height:var(--mdui-typescale-body-large-line-height)}:host([variant=filled][label]) .prefix,:host([variant=filled][label]) .suffix{padding-top:1rem}.has-value .prefix,.has-value .suffix,:host([focused-style]) .prefix,:host([focused-style]) .suffix,:host([focused]) .prefix,:host([focused]) .suffix{display:flex}.input-container{display:flex;width:100%;height:100%}.label{position:absolute;pointer-events:none;max-width:calc(100% - 1rem);display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:1;transition:all var(--mdui-motion-duration-short4) var(--mdui-motion-easing-standard);top:1rem;color:rgb(var(--mdui-color-on-surface-variant));font-size:var(--mdui-typescale-body-large-size);font-weight:var(--mdui-typescale-body-large-weight);letter-spacing:var(--mdui-typescale-body-large-tracking);line-height:var(--mdui-typescale-body-large-line-height)}.invalid .label,.invalid-style .label{color:rgb(var(--mdui-color-error))}:host([variant=outlined]) .label{padding:0 .25rem;margin:0 -.25rem}:host([variant=outlined]:hover) .label{color:rgb(var(--mdui-color-on-surface))}:host([variant=filled]:hover) .invalid .label,:host([variant=filled]:hover) .invalid-style .label,:host([variant=outlined]:hover) .invalid .label,:host([variant=outlined]:hover) .invalid-style .label{color:rgb(var(--mdui-color-on-error-container))}:host([variant=filled][focused-style]) .label,:host([variant=filled][focused]) .label,:host([variant=outlined][focused-style]) .label,:host([variant=outlined][focused]) .label{color:rgb(var(--mdui-color-primary))}:host([variant=filled]) .has-value .label,:host([variant=filled][focused-style]) .label,:host([variant=filled][focused]) .label,:host([variant=filled][type=date]) .label,:host([variant=filled][type=datetime-local]) .label,:host([variant=filled][type=month]) .label,:host([variant=filled][type=time]) .label,:host([variant=filled][type=week]) .label{font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height);top:.25rem}:host([variant=outlined]) .has-value .label,:host([variant=outlined][focused-style]) .label,:host([variant=outlined][focused]) .label,:host([variant=outlined][type=date]) .label,:host([variant=outlined][type=datetime-local]) .label,:host([variant=outlined][type=month]) .label,:host([variant=outlined][type=time]) .label,:host([variant=outlined][type=week]) .label{font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height);top:-.5rem;left:.75rem;background-color:rgb(var(--mdui-color-background))}:host([variant=filled][focused-style]) .invalid .label,:host([variant=filled][focused-style]) .invalid-style .label,:host([variant=filled][focused]) .invalid .label,:host([variant=filled][focused]) .invalid-style .label,:host([variant=outlined][focused-style]) .invalid .label,:host([variant=outlined][focused-style]) .invalid-style .label,:host([variant=outlined][focused]) .invalid .label,:host([variant=outlined][focused]) .invalid-style .label{color:rgb(var(--mdui-color-error))}:host([variant=filled][disabled]:not([disabled=false i])) .label,:host([variant=outlined][disabled]:not([disabled=false i])) .label{color:rgba(var(--mdui-color-on-surface),38%)}.input{display:block;width:100%;border:none;outline:0;background:0 0;appearance:none;resize:none;cursor:inherit;font-family:inherit;padding:.875rem .875rem .875rem 0;font-size:var(--mdui-typescale-body-large-size);font-weight:var(--mdui-typescale-body-large-weight);letter-spacing:var(--mdui-typescale-body-large-tracking);line-height:var(--mdui-typescale-body-large-line-height);color:rgb(var(--mdui-color-on-surface));caret-color:rgb(var(--mdui-color-primary))}.has-action .input,.has-right-icon .input{padding-right:.25rem}.has-suffix .input{padding-right:0}.input.hide-input{opacity:0;height:0;min-height:0;width:0;padding:0!important;overflow:hidden}.input::placeholder{color:rgb(var(--mdui-color-on-surface-variant))}.invalid .input,.invalid-style .input{caret-color:rgb(var(--mdui-color-error))}:host([disabled]:not([disabled=false i])) .input{color:rgba(var(--mdui-color-on-surface),38%)}:host([end-aligned]:not([end-aligned=false i])) .input{text-align:right}textarea.input{padding-top:0;margin-top:.875rem}:host([variant=filled]) .label+.input{padding-top:1.375rem;padding-bottom:.375rem}:host([variant=filled]) .label+textarea.input{padding-top:0;margin-top:1.375rem}.supporting{display:flex;justify-content:space-between;padding:.25rem 1rem;color:rgb(var(--mdui-color-on-surface-variant))}.supporting.invalid,.supporting.invalid-style{color:rgb(var(--mdui-color-error))}.helper{display:block;opacity:1;transition:opacity var(--mdui-motion-duration-short4) var(--mdui-motion-easing-linear);font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height)}:host([disabled]:not([disabled=false i])) .helper{color:rgba(var(--mdui-color-on-surface),38%)}:host([helper-on-focus]:not([helper-on-focus=false i])) .helper{opacity:0}:host([helper-on-focus][focused-style]:not([helper-on-focus=false i])) .helper,:host([helper-on-focus][focused]:not([helper-on-focus=false i])) .helper{opacity:1}.error{font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height)}.counter{flex-wrap:nowrap;padding-left:1rem;font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height)}::-ms-reveal{display:none}.input[type=number]::-webkit-inner-spin-button,.input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;display:none}.input[type=number]{-moz-appearance:textfield}.input[type=search]::-webkit-search-cancel-button{-webkit-appearance:none}`;var w=class extends go(Rt){constructor(){super(...arguments),this.variant="filled",this.type="text",this.name="",this.value="",this.defaultValue="",this.helperOnFocus=!1,this.clearable=!1,this.endAligned=!1,this.readonly=!1,this.disabled=!1,this.required=!1,this.autosize=!1,this.counter=!1,this.togglePassword=!1,this.spellcheck=!1,this.invalid=!1,this.invalidStyle=!1,this.focusedStyle=!1,this.isPasswordVisible=!1,this.hasValue=!1,this.error="",this.inputRef=St(),this.formController=new ze(this),this.hasSlotController=new Lt(this,"icon","end-icon","helper","input"),this.readonlyButClearable=!1}get validity(){return this.inputRef.value.validity}get validationMessage(){return this.inputRef.value.validationMessage}get valueAsNumber(){return this.inputRef.value?.valueAsNumber??parseFloat(this.value)}set valueAsNumber(t){let r=document.createElement("input");r.type="number",r.valueAsNumber=t,this.value=r.value}get focusElement(){return this.inputRef.value}get focusDisabled(){return this.disabled}get isFocusedStyle(){return this.focused||this.focusedStyle}get isTextarea(){return this.rows&&this.rows>1||this.autosize}onDisabledChange(){this.inputRef.value.disabled=this.disabled,this.invalid=!this.inputRef.value.checkValidity()}async onValueChange(){if(this.hasValue=!["",null].includes(this.value),this.hasUpdated){await this.updateComplete,this.setTextareaHeight();let t=this.formController.getForm();t&&Ne.get(t)?.has(this)?(this.invalid=!1,Ne.get(t).delete(this)):this.invalid=!this.inputRef.value.checkValidity()}}onRowsChange(){this.setTextareaHeight()}async onMaxRowsChange(){if(!this.autosize)return;this.hasUpdated||await this.updateComplete;let t=m(this.inputRef.value);t.css("max-height",parseFloat(t.css("line-height"))*(this.maxRows??1)+parseFloat(t.css("padding-top"))+parseFloat(t.css("padding-bottom")))}async onMinRowsChange(){if(!this.autosize)return;this.hasUpdated||await this.updateComplete;let t=m(this.inputRef.value);t.css("min-height",parseFloat(t.css("line-height"))*(this.minRows??1)+parseFloat(t.css("padding-top"))+parseFloat(t.css("padding-bottom")))}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.setTextareaHeight(),this.observeResize=Ps(this.inputRef.value,()=>this.setTextareaHeight())})}disconnectedCallback(){super.disconnectedCallback(),this.observeResize?.unobserve(),he(this)}select(){this.inputRef.value.select()}setSelectionRange(t,r,o="none"){this.inputRef.value.setSelectionRange(t,r,o)}setRangeText(t,r,o,i="preserve"){this.inputRef.value.setRangeText(t,r,o,i),this.value!==this.inputRef.value.value&&(this.value=this.inputRef.value.value,this.setTextareaHeight(),this.emit("input"),this.emit("change"))}checkValidity(){let t=this.inputRef.value.checkValidity();return t||this.emit("invalid",{bubbles:!1,cancelable:!0,composed:!1}),t}reportValidity(){return this.invalid=!this.inputRef.value.reportValidity(),this.invalid&&(this.emit("invalid",{bubbles:!1,cancelable:!0,composed:!1}),this.focus()),!this.invalid}setCustomValidity(t){this.setCustomValidityInternal(t),he(this)}render(){let t=!!this.icon||this.hasSlotController.test("icon"),r=!!this.endIcon||this.hasSlotController.test("end-icon"),o=this.invalid||this.invalidStyle,i=this.type==="password"&&this.togglePassword&&!this.disabled,n=this.clearable&&!this.disabled&&(!this.readonly||this.readonlyButClearable)&&(typeof this.value=="number"||this.value.length>0),s=!!this.prefix||this.hasSlotController.test("prefix"),a=!!this.suffix||this.hasSlotController.test("suffix"),l=!!this.helper||this.hasSlotController.test("helper"),c=o&&!!(this.error||this.inputRef.value.validationMessage),u=this.counter&&!!this.maxlength,h=this.hasSlotController.test("input"),f={invalid:this.invalid,"invalid-style":this.invalidStyle},y=Ht({container:!0,"has-value":this.hasValue,"has-icon":t,"has-right-icon":r||o,"has-action":n||i,"has-prefix":s,"has-suffix":a,"is-firefox":navigator.userAgent.includes("Firefox"),...f});return b`<div part="container" class="${y}">${this.renderPrefix()}<div class="input-container">${this.renderLabel()} ${this.isTextarea?this.renderTextArea(h):this.renderInput(h)} ${Nt(h,()=>b`<slot name="input" class="input"></slot>`)}</div>${this.renderSuffix()}${this.renderClearButton(n)} ${this.renderTogglePasswordButton(i)} ${this.renderRightIcon(o)}</div>${Nt(c||l||u,()=>b`<div part="supporting" class="${Ht({supporting:!0,...f})}">${this.renderHelper(c,l)} ${this.renderCounter(u)}</div>`)}`}setCustomValidityInternal(t){this.inputRef.value.setCustomValidity(t),this.invalid=!this.inputRef.value.checkValidity(),this.requestUpdate()}onChange(){this.value=this.inputRef.value.value,this.isTextarea&&this.setTextareaHeight(),this.emit("change")}onClear(t){this.value="",this.emit("clear"),this.emit("input"),this.emit("change"),this.focus(),t.stopPropagation()}onInput(t){t.stopPropagation(),this.value=this.inputRef.value.value,this.isTextarea&&this.setTextareaHeight(),this.emit("input")}onInvalid(t){t.preventDefault()}onKeyDown(t){let r=t.metaKey||t.ctrlKey||t.shiftKey||t.altKey;t.key==="Enter"&&!r&&setTimeout(()=>{t.defaultPrevented||this.formController.submit()})}onTextAreaKeyUp(){if(this.pattern){let t=new RegExp(this.pattern);this.value&&!this.value.match(t)?(this.setCustomValidityInternal(this.getPatternErrorMsg()),Co(this,()=>{this.setCustomValidityInternal(this.getPatternErrorMsg())})):(this.setCustomValidityInternal(""),he(this))}}onTogglePassword(){this.isPasswordVisible=!this.isPasswordVisible}getPatternErrorMsg(){return vr("Please match the requested format.",{id:"components.textField.patternError"})}setTextareaHeight(){this.autosize?(this.inputRef.value.style.height="auto",this.inputRef.value.style.height=`${this.inputRef.value.scrollHeight}px`):this.inputRef.value.style.height=void 0}renderLabel(){return this.label?b`<label part="label" class="label">${this.label}</label>`:pt}renderPrefix(){return b`<slot name="icon" part="icon" class="icon">${this.icon?b`<mdui-icon name="${this.icon}" class="i"></mdui-icon>`:pt}</slot><slot name="prefix" part="prefix" class="prefix">${this.prefix}</slot>`}renderSuffix(){return b`<slot name="suffix" part="suffix" class="suffix">${this.suffix}</slot>`}renderRightIcon(t){return t?b`<slot name="error-icon" part="error-icon" class="right-icon">${this.errorIcon?b`<mdui-icon name="${this.errorIcon}" class="i"></mdui-icon>`:b`<mdui-icon-error class="i"></mdui-icon-error>`}</slot>`:b`<slot name="end-icon" part="end-icon" class="end-icon right-icon">${this.endIcon?b`<mdui-icon name="${this.endIcon}" class="i"></mdui-icon>`:pt}</slot>`}renderClearButton(t){return Nt(t,()=>b`<slot name="clear-button" part="clear-button" class="action" @click="${this.onClear}"><mdui-button-icon tabindex="-1"><slot name="clear-icon" part="clear-icon">${this.clearIcon?b`<mdui-icon name="${this.clearIcon}" class="i"></mdui-icon>`:b`<mdui-icon-cancel--outlined class="i"></mdui-icon-cancel--outlined>`}</slot></mdui-button-icon></slot>`)}renderTogglePasswordButton(t){return Nt(t,()=>b`<slot name="toggle-password-button" part="toggle-password-button" class="action" @click="${this.onTogglePassword}"><mdui-button-icon tabindex="-1">${this.isPasswordVisible?b`<slot name="show-password-icon" part="show-password-icon">${this.showPasswordIcon?b`<mdui-icon name="${this.showPasswordIcon}" class="i"></mdui-icon>`:b`<mdui-icon-visibility-off class="i"></mdui-icon-visibility-off>`}</slot>`:b`<slot name="hide-password-icon" part="hide-password-icon">${this.hidePasswordIcon?b`<mdui-icon name="${this.hidePasswordIcon}" class="i"></mdui-icon>`:b`<mdui-icon-visibility class="i"></mdui-icon-visibility>`}</slot>`}</mdui-button-icon></slot>`)}renderInput(t){return b`<input ${vt(this.inputRef)} part="input" class="input ${Ht({"hide-input":t})}" type="${this.type==="password"&&this.isPasswordVisible?"text":this.type}" name="${O(this.name)}" .value="${Ei(this.value)}" placeholder="${O(!this.label||this.isFocusedStyle||this.hasValue?this.placeholder:void 0)}" ?readonly="${this.readonly}" ?disabled="${this.disabled}" ?required="${this.required}" minlength="${O(this.minlength)}" maxlength="${O(this.maxlength)}" min="${O(this.min)}" max="${O(this.max)}" step="${O(this.step)}" autocapitalize="${O(this.type==="password"?"off":this.autocapitalize)}" autocomplete="${this.autocomplete}" autocorrect="${O(this.type==="password"?"off":this.autocorrect)}" spellcheck="${O(this.spellcheck)}" pattern="${O(this.pattern)}" enterkeyhint="${O(this.enterkeyhint)}" inputmode="${O(this.inputmode)}" @change="${this.onChange}" @input="${this.onInput}" @invalid="${this.onInvalid}" @keydown="${this.onKeyDown}">`}renderTextArea(t){return b`<textarea ${vt(this.inputRef)} part="input" class="input ${Ht({"hide-input":t})}" name="${O(this.name)}" .value="${Ei(this.value)}" placeholder="${O(!this.label||this.isFocusedStyle||this.hasValue?this.placeholder:void 0)}" ?readonly="${this.readonly}" ?disabled="${this.disabled}" ?required="${this.required}" minlength="${O(this.minlength)}" maxlength="${O(this.maxlength)}" rows="${this.rows??1}" autocapitalize="${O(this.autocapitalize)}" autocorrect="${O(this.autocorrect)}" spellcheck="${O(this.spellcheck)}" enterkeyhint="${O(this.enterkeyhint)}" inputmode="${O(this.inputmode)}" @change="${this.onChange}" @input="${this.onInput}" @invalid="${this.onInvalid}" @keydown="${this.onKeyDown}" @keyup="${this.onTextAreaKeyUp}"></textarea>`}renderHelper(t,r){return t?b`<div part="error" class="error">${this.error||this.inputRef.value.validationMessage}</div>`:r?b`<slot name="helper" part="helper" class="helper">${this.helper}</slot>`:b`<span></span>`}renderCounter(t){return t?b`<div part="counter" class="counter">${this.value.length}/${this.maxlength}</div>`:pt}};w.styles=[Bt,Ss];p([g({reflect:!0})],w.prototype,"variant",void 0);p([g({reflect:!0})],w.prototype,"type",void 0);p([g({reflect:!0})],w.prototype,"name",void 0);p([g()],w.prototype,"value",void 0);p([As()],w.prototype,"defaultValue",void 0);p([g({reflect:!0})],w.prototype,"label",void 0);p([g({reflect:!0})],w.prototype,"placeholder",void 0);p([g({reflect:!0})],w.prototype,"helper",void 0);p([g({type:Boolean,reflect:!0,converter:_,attribute:"helper-on-focus"})],w.prototype,"helperOnFocus",void 0);p([g({type:Boolean,reflect:!0,converter:_})],w.prototype,"clearable",void 0);p([g({reflect:!0,attribute:"clear-icon"})],w.prototype,"clearIcon",void 0);p([g({type:Boolean,reflect:!0,converter:_,attribute:"end-aligned"})],w.prototype,"endAligned",void 0);p([g({reflect:!0})],w.prototype,"prefix",void 0);p([g({reflect:!0})],w.prototype,"suffix",void 0);p([g({reflect:!0})],w.prototype,"icon",void 0);p([g({reflect:!0,attribute:"end-icon"})],w.prototype,"endIcon",void 0);p([g({reflect:!0,attribute:"error-icon"})],w.prototype,"errorIcon",void 0);p([g({reflect:!0})],w.prototype,"form",void 0);p([g({type:Boolean,reflect:!0,converter:_})],w.prototype,"readonly",void 0);p([g({type:Boolean,reflect:!0,converter:_})],w.prototype,"disabled",void 0);p([g({type:Boolean,reflect:!0,converter:_})],w.prototype,"required",void 0);p([g({type:Number,reflect:!0})],w.prototype,"rows",void 0);p([g({type:Boolean,reflect:!0,converter:_})],w.prototype,"autosize",void 0);p([g({type:Number,reflect:!0,attribute:"min-rows"})],w.prototype,"minRows",void 0);p([g({type:Number,reflect:!0,attribute:"max-rows"})],w.prototype,"maxRows",void 0);p([g({type:Number,reflect:!0})],w.prototype,"minlength",void 0);p([g({type:Number,reflect:!0})],w.prototype,"maxlength",void 0);p([g({type:Boolean,reflect:!0,converter:_})],w.prototype,"counter",void 0);p([g({type:Number,reflect:!0})],w.prototype,"min",void 0);p([g({type:Number,reflect:!0})],w.prototype,"max",void 0);p([g({type:Number,reflect:!0})],w.prototype,"step",void 0);p([g({reflect:!0})],w.prototype,"pattern",void 0);p([g({type:Boolean,reflect:!0,converter:_,attribute:"toggle-password"})],w.prototype,"togglePassword",void 0);p([g({reflect:!0,attribute:"show-password-icon"})],w.prototype,"showPasswordIcon",void 0);p([g({reflect:!0,attribute:"hide-password-icon"})],w.prototype,"hidePasswordIcon",void 0);p([g({reflect:!0})],w.prototype,"autocapitalize",void 0);p([g({reflect:!0})],w.prototype,"autocorrect",void 0);p([g({reflect:!0})],w.prototype,"autocomplete",void 0);p([g({reflect:!0})],w.prototype,"enterkeyhint",void 0);p([g({type:Boolean,reflect:!0,converter:_})],w.prototype,"spellcheck",void 0);p([g({reflect:!0})],w.prototype,"inputmode",void 0);p([qt()],w.prototype,"invalid",void 0);p([qt()],w.prototype,"invalidStyle",void 0);p([g({type:Boolean,reflect:!0,converter:_,attribute:"focused-style"})],w.prototype,"focusedStyle",void 0);p([qt()],w.prototype,"isPasswordVisible",void 0);p([qt()],w.prototype,"hasValue",void 0);p([qt()],w.prototype,"error",void 0);p([Ft("disabled",!0)],w.prototype,"onDisabledChange",null);p([Ft("value")],w.prototype,"onValueChange",null);p([Ft("rows",!0)],w.prototype,"onRowsChange",null);p([Ft("maxRows")],w.prototype,"onMaxRowsChange",null);p([Ft("minRows")],w.prototype,"onMinRowsChange",null);w=p([G("mdui-text-field")],w);function xr(e){return!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}E(["val","html","text"],(e,t)=>{let o=["value","innerHTML","textContent"][t],i=s=>{if(t===2)return He(s,c=>Ce(c)[o]).join("");if(!s.length)return;let a=s[0],l=m(a);return t===0&&l.is("select[multiple]")?He(l.find("option:checked"),c=>c.value):a[o]},n=(s,a)=>{if(H(a)){if(t!==0)return;a=""}t===1&&Ot(a)&&(a=a.outerHTML),s[o]=a};m.fn[e]=function(s){return arguments.length?this.each((a,l)=>{let c=m(l),u=z(s)?s.call(l,a,i(c)):s;t===0&&Array.isArray(u)?c.is("select[multiple]")?He(c.find("option"),h=>h.selected=u.includes(h.value)):l.checked=u.includes(l.value):n(l,u)}):i(this)}});var nl=e=>q(e)&&!(e.startsWith("<")&&e.endsWith(">"));E(["before","after"],(e,t)=>{m.fn[e]=function(...r){return t===1&&(r=r.reverse()),this.each((o,i)=>{let n=z(r[0])?[r[0].call(i,o,i.innerHTML)]:r;E(n,s=>{let a;nl(s)?a=m(so(s,"div")):o&&Ot(s)?a=m(s.cloneNode(!0)):a=m(s),a[t?"insertAfter":"insertBefore"](i)})})}});m.fn.clone=function(){return this.map(function(){return this.cloneNode(!0)})};E(["prepend","append"],(e,t)=>{m.fn[e]=function(...r){return this.each((o,i)=>{let n=i.childNodes,s=n.length,a=s?n[t?s-1:0]:hr("div");s||io(i,a);let l=z(r[0])?[r[0].call(i,o,i.innerHTML)]:r;o&&(l=l.map(c=>q(c)?c:m(c).clone())),m(a)[t?"after":"before"](...l),s||no(a)})}});var $e={};function $s(e,t){if(H($e[e])&&($e[e]=[]),H(t))return $e[e];$e[e].push(t)}function Ts(e){if(H($e[e])||!$e[e].length)return;$e[e].shift()()}function te(e,t,r){return e?new Promise(o=>{if(r.duration===1/0)throw new Error("Promise-based animations must be finite.");lr(r.duration)&&isNaN(r.duration)&&(r.duration=0),r.easing===""&&(r.easing="linear");let i=e.animate(t,r);i.addEventListener("cancel",o,{once:!0}),i.addEventListener("finish",o,{once:!0})}):Promise.resolve()}function Po(e){return e?Promise.all(e.getAnimations().map(t=>new Promise(r=>{let o=requestAnimationFrame(r);t.addEventListener("cancel",()=>o,{once:!0}),t.addEventListener("finish",()=>o,{once:!0}),t.cancel()}))):Promise.resolve()}function Rs(e){let t=$t(),r=e.localName;return e.getAttribute("tabindex")==="-1"||e.hasAttribute("disabled")||e.hasAttribute("aria-disabled")&&e.getAttribute("aria-disabled")!=="false"||r==="input"&&e.getAttribute("type")==="radio"&&!e.hasAttribute("checked")||e.offsetParent===null||t.getComputedStyle(e).visibility==="hidden"?!1:(r==="audio"||r==="video")&&e.hasAttribute("controls")||e.hasAttribute("tabindex")||e.hasAttribute("contenteditable")&&e.getAttribute("contenteditable")!=="false"?!0:["button","input","select","textarea","a","audio","video","summary"].includes(r)}function _s(e){let t=[];function r(n){n instanceof HTMLElement&&(t.push(n),n.shadowRoot!==null&&n.shadowRoot.mode==="open"&&r(n.shadowRoot)),[...n.children].forEach(a=>r(a))}r(e);let o=t.find(n=>Rs(n))??null,i=t.reverse().find(n=>Rs(n))??null;return{start:o,end:i}}var wr=[],ko=class{constructor(t){this.tabDirection="forward",this.element=t,this.handleFocusIn=this.handleFocusIn.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleKeyUp=this.handleKeyUp.bind(this)}activate(){wr.push(this.element),document.addEventListener("focusin",this.handleFocusIn),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}deactivate(){wr=wr.filter(t=>t!==this.element),document.removeEventListener("focusin",this.handleFocusIn),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)}isActive(){return wr[wr.length-1]===this.element}checkFocus(){if(this.isActive()&&!this.element.matches(":focus-within")){let{start:t,end:r}=_s(this.element),o=this.tabDirection==="forward"?t:r;typeof o?.focus=="function"&&o.focus({preventScroll:!0})}}handleFocusIn(){this.checkFocus()}handleKeyDown(t){t.key==="Tab"&&t.shiftKey&&(this.tabDirection="backward"),requestAnimationFrame(()=>this.checkFocus())}handleKeyUp(){this.tabDirection="forward"}};var Eo=(e,t)=>{let r=`--mdui-motion-easing-${t}`;return m(e).css(r).trim()},Ii=(e,t)=>{let r=`--mdui-motion-duration-${t}`,o=m(e).css(r).trim().toLowerCase();return o.endsWith("ms")?parseFloat(o):parseFloat(o)*1e3};var Di,sl=e=>{if(H(document))return 0;if(e||Di===void 0){let t=m("<div>").css({width:"100%",height:"200px"}),r=m("<div>").css({position:"absolute",top:"0",left:"0",pointerEvents:"none",visibility:"hidden",width:"200px",height:"150px",overflow:"hidden"}).append(t).appendTo(document.body),o=t[0].offsetWidth;r.css("overflow","scroll");let i=t[0].offsetWidth;o===i&&(i=r[0].clientWidth),r.remove(),Di=o-i}return Di},al=e=>e.scrollHeight>e.clientHeight,Ar=new WeakMap,Ms="mdui-lock-screen",Is=(e,t)=>{let r=et();t??=r.documentElement,Ar.has(t)||Ar.set(t,new Set),Ar.get(t).add(e);let i=m(t);al(t)&&i.css("width",`calc(100% - ${sl()}px)`),i.addClass(Ms)},Oi=(e,t)=>{let r=et();t??=r.documentElement;let o=Ar.get(t);o&&(o.delete(e),o.size===0&&(Ar.delete(t),m(t).removeClass(Ms).width("")))};var Ds=J`:host{--shape-corner:var(--mdui-shape-corner-extra-large);--z-index:2300;position:fixed;z-index:var(--z-index);display:none;align-items:center;justify-content:center;inset:0;padding:3rem}::slotted(mdui-top-app-bar[slot=header]){position:absolute;border-top-left-radius:var(--mdui-shape-corner-extra-large);border-top-right-radius:var(--mdui-shape-corner-extra-large);background-color:rgb(var(--mdui-color-surface-container-high))}:host([fullscreen]:not([fullscreen=false i])){--shape-corner:var(--mdui-shape-corner-none);padding:0}:host([fullscreen]:not([fullscreen=false i])) ::slotted(mdui-top-app-bar[slot=header]){border-top-left-radius:var(--mdui-shape-corner-none);border-top-right-radius:var(--mdui-shape-corner-none)}.overlay{position:fixed;inset:0;background-color:rgba(var(--mdui-color-scrim),.4)}.panel{--mdui-color-background:var(--mdui-color-surface-container-high);position:relative;display:flex;flex-direction:column;max-height:100%;border-radius:var(--shape-corner);outline:0;transform-origin:top;min-width:17.5rem;max-width:35rem;padding:1.5rem;background-color:rgb(var(--mdui-color-surface-container-high));box-shadow:var(--mdui-elevation-level3)}:host([fullscreen]:not([fullscreen=false i])) .panel{width:100%;max-width:100%;height:100%;max-height:100%;box-shadow:var(--mdui-elevation-level0)}.header{display:flex;flex-direction:column}.has-icon .header{align-items:center}.icon{display:flex;color:rgb(var(--mdui-color-secondary));font-size:1.5rem}.icon mdui-icon,::slotted([slot=icon]){font-size:inherit}.headline{display:flex;color:rgb(var(--mdui-color-on-surface));font-size:var(--mdui-typescale-headline-small-size);font-weight:var(--mdui-typescale-headline-small-weight);letter-spacing:var(--mdui-typescale-headline-small-tracking);line-height:var(--mdui-typescale-headline-small-line-height)}.icon+.headline{padding-top:1rem}.body{overflow:auto}.header+.body{margin-top:1rem}.description{display:flex;color:rgb(var(--mdui-color-on-surface-variant));font-size:var(--mdui-typescale-body-medium-size);font-weight:var(--mdui-typescale-body-medium-weight);letter-spacing:var(--mdui-typescale-body-medium-tracking);line-height:var(--mdui-typescale-body-medium-line-height)}:host([fullscreen]:not([fullscreen=false i])) .description{color:rgb(var(--mdui-color-on-surface))}.has-description.has-default .description{margin-bottom:1rem}.action{display:flex;justify-content:flex-end;padding-top:1.5rem}.action::slotted(:not(:first-child)){margin-left:.5rem}:host([stacked-actions]:not([stacked-actions=false i])) .action{flex-direction:column;align-items:end}:host([stacked-actions]:not([stacked-actions=false i])) .action::slotted(:not(:first-child)){margin-left:0;margin-top:.5rem}`;var xt=class extends Rt{constructor(){super(...arguments),this.open=!1,this.fullscreen=!1,this.closeOnEsc=!1,this.closeOnOverlayClick=!1,this.stackedActions=!1,this.overlayRef=St(),this.panelRef=St(),this.bodyRef=St(),this.hasSlotController=new Lt(this,"header","icon","headline","description","action","[default]"),this.definedController=new Wt(this,{relatedElements:["mdui-top-app-bar"]})}async onOpenChange(){let t=this.hasUpdated;if(!this.open&&!t)return;await this.definedController.whenDefined(),t||await this.updateComplete;let r=Array.from(this.panelRef.value.querySelectorAll(".header, .body, .actions")),o=Eo(this,"linear"),i=Eo(this,"emphasized-decelerate"),n=Eo(this,"emphasized-accelerate"),s=()=>Promise.all([Po(this.overlayRef.value),Po(this.panelRef.value),...r.map(a=>Po(a))]);if(this.open){if(t&&!this.emit("open",{cancelable:!0}))return;this.style.display="flex";let a=this.topAppBarElements??[];if(a.length){let c=a[0];c.scrollTarget||(c.scrollTarget=this.bodyRef.value),this.bodyRef.value.style.marginTop="0"}this.originalTrigger=document.activeElement,this.modalHelper.activate(),Is(this),await s(),requestAnimationFrame(()=>{let c=this.querySelector("[autofocus]");c?c.focus({preventScroll:!0}):this.panelRef.value.focus({preventScroll:!0})});let l=Ii(this,"medium4");await Promise.all([te(this.overlayRef.value,[{opacity:0},{opacity:1,offset:.3},{opacity:1}],{duration:t?l:0,easing:o}),te(this.panelRef.value,[{transform:"translateY(-1.875rem) scaleY(0)"},{transform:"translateY(0) scaleY(1)"}],{duration:t?l:0,easing:i}),te(this.panelRef.value,[{opacity:0},{opacity:1,offset:.1},{opacity:1}],{duration:t?l:0,easing:o}),...r.map(c=>te(c,[{opacity:0},{opacity:0,offset:.2},{opacity:1,offset:.8},{opacity:1}],{duration:t?l:0,easing:o}))]),t&&this.emit("opened")}else{if(!this.emit("close",{cancelable:!0}))return;this.modalHelper.deactivate(),await s();let l=Ii(this,"short4");await Promise.all([te(this.overlayRef.value,[{opacity:1},{opacity:0}],{duration:l,easing:o}),te(this.panelRef.value,[{transform:"translateY(0) scaleY(1)"},{transform:"translateY(-1.875rem) scaleY(0.6)"}],{duration:l,easing:n}),te(this.panelRef.value,[{opacity:1},{opacity:1,offset:.75},{opacity:0}],{duration:l,easing:o}),...r.map(u=>te(u,[{opacity:1},{opacity:0,offset:.75},{opacity:0}],{duration:l,easing:o}))]),this.style.display="none",Oi(this);let c=this.originalTrigger;typeof c?.focus=="function"&&setTimeout(()=>c.focus()),this.emit("closed")}}disconnectedCallback(){super.disconnectedCallback(),Oi(this),he(this)}firstUpdated(t){super.firstUpdated(t),this.modalHelper=new ko(this),this.addEventListener("keydown",r=>{this.open&&this.closeOnEsc&&r.key==="Escape"&&(r.stopPropagation(),this.open=!1)})}render(){let t=this.hasSlotController.test("action"),r=this.hasSlotController.test("[default]"),o=!!this.icon||this.hasSlotController.test("icon"),i=!!this.headline||this.hasSlotController.test("headline"),n=!!this.description||this.hasSlotController.test("description"),s=o||i||this.hasSlotController.test("header"),a=n||r;return b`<div ${vt(this.overlayRef)} part="overlay" class="overlay" @click="${this.onOverlayClick}" tabindex="-1"></div><div ${vt(this.panelRef)} part="panel" class="panel ${Ht({"has-icon":o,"has-description":n,"has-default":r})}" tabindex="0">${Nt(s,()=>b`<slot name="header" part="header" class="header">${Nt(o,()=>this.renderIcon())} ${Nt(i,()=>this.renderHeadline())}</slot>`)} ${Nt(a,()=>b`<div ${vt(this.bodyRef)} part="body" class="body">${Nt(n,()=>this.renderDescription())}<slot></slot></div>`)} ${Nt(t,()=>b`<slot name="action" part="action" class="action"></slot>`)}</div>`}onOverlayClick(){this.emit("overlay-click"),this.closeOnOverlayClick&&(this.open=!1)}renderIcon(){return b`<slot name="icon" part="icon" class="icon">${this.icon?b`<mdui-icon name="${this.icon}"></mdui-icon>`:pt}</slot>`}renderHeadline(){return b`<slot name="headline" part="headline" class="headline">${this.headline}</slot>`}renderDescription(){return b`<slot name="description" part="description" class="description">${this.description}</slot>`}};xt.styles=[Bt,Ds];p([g({reflect:!0})],xt.prototype,"icon",void 0);p([g({reflect:!0})],xt.prototype,"headline",void 0);p([g({reflect:!0})],xt.prototype,"description",void 0);p([g({type:Boolean,reflect:!0,converter:_})],xt.prototype,"open",void 0);p([g({type:Boolean,reflect:!0,converter:_})],xt.prototype,"fullscreen",void 0);p([g({type:Boolean,reflect:!0,converter:_,attribute:"close-on-esc"})],xt.prototype,"closeOnEsc",void 0);p([g({type:Boolean,reflect:!0,converter:_,attribute:"close-on-overlay-click"})],xt.prototype,"closeOnOverlayClick",void 0);p([g({type:Boolean,reflect:!0,converter:_,attribute:"stacked-actions"})],xt.prototype,"stackedActions",void 0);p([$n({slot:"header",selector:"mdui-top-app-bar",flatten:!0})],xt.prototype,"topAppBarElements",void 0);p([Ft("open")],xt.prototype,"onOpenChange",null);xt=p([G("mdui-dialog")],xt);var ll={onClick:oo},Os="mdui.functions.dialog.",So,Ls=e=>{let t=new xt,r=m(t),o=["headline","description","icon","closeOnEsc","closeOnOverlayClick","stackedActions"],i=["onOpen","onOpened","onClose","onClosed","onOverlayClick"];return Object.entries(e).forEach(([n,s])=>{if(o.includes(n))t[n]=s;else if(i.includes(n)){let a=Qt(n.slice(2));r.on(a,l=>{l.target===t&&s.call(t,t)})}}),e.body&&r.append(e.body),e.actions&&e.actions.forEach(n=>{let s=Object.assign({},ll,n);m(`<mdui-button
14
+ slot="action"
15
+ variant="text"
16
+ >${s.text}</mdui-button>`).appendTo(r).on("click",function(){let a=s.onClick.call(t,t);xr(a)?(this.loading=!0,a.then(()=>{t.open=!1}).finally(()=>{this.loading=!1})):a!==!1&&(t.open=!1)})}),r.appendTo("body").on("closed",n=>{n.target===t&&(r.remove(),e.queue&&(So=void 0,Ts(Os+e.queue)))}),e.queue?So?$s(Os+e.queue,()=>{t.open=!0,So=t}):(setTimeout(()=>{t.open=!0}),So=t):setTimeout(()=>{t.open=!0}),t};var Bs=()=>vr("OK",{id:"functions.alert.confirmText"}),Fs=e=>{let t=Object.assign({},{confirmText:Bs(),onConfirm:oo},e),r=["headline","description","icon","closeOnEsc","closeOnOverlayClick","queue","onOpen","onOpened","onClose","onClosed","onOverlayClick"];return new Promise((o,i)=>{let n=!1,s=Ls({...Object.fromEntries(r.filter(a=>!H(t[a])).map(a=>[a,t[a]])),actions:[{text:t.confirmText,onClick:a=>{let l=t.onConfirm.call(a,a);return xr(l)?l.then(()=>{n=!0}):l!==!1&&(n=!0),l}}]});e.confirmText||Co(s,()=>{m(s).find('[slot="action"]').text(Bs())}),m(s).on("close",a=>{a.target===s&&(n?o():i(),he(s))})})};var Mo=class{keyProp;tail;symbols;constructor(t){this.keyProp=t,this.tail={},this.symbols=[Symbol(0)]}add(t){if(this.symbols[0]in t)return!1;let r=1+(Math.clz32(Math.random()*4294967295)>>2);for(let a=this.symbols.length;a<r;a++)this.symbols.push(Symbol(a));let o=this.keyProp,i=t[o],n,s=this.tail;for(let a=this.symbols.length-1;a>=0;a--){let l=this.symbols[a];for(;(n=s[l])&&n[o]>i;)s=n;a<r&&(t[l]=s[l],s[l]=t)}return!0}has(t){return this.symbols[0]in t}fetchLast(){let t=this.tail[this.symbols[0]];if(t)return this.remove(t),t}isEmpty(){return this.tail[this.symbols[0]]===void 0}get(t){let r=this.keyProp,o,i=this.tail;for(let n=this.symbols.length-1;n>=0;n--){let s=this.symbols[n];for(;(o=i[s])&&o[r]>t;)i=o}return i[this.symbols[0]]?.[r]===t?i[this.symbols[0]]:void 0}*[Symbol.iterator](){let t=this.symbols[0],r=this.tail[t];for(;r;)yield r,r=r[t]}prev(t){return t[this.symbols[0]]}remove(t){if(!(this.symbols[0]in t))return!1;let r=this.keyProp,o=t[r],i,n=this.tail;for(let s=this.symbols.length-1;s>=0;s--){let a=this.symbols[s];for(;(i=n[a])&&i[r]>=o&&i!==t;)n=i;i===t&&(n[a]=i[a],delete i[a])}return i===t}clear(){let t=this.symbols[0],r=this.tail;for(;r;){let o=r[t];for(let i of this.symbols){if(!(i in r))break;delete r[i]}r=o}this.tail={}}},pe,Ue=0,_e;function Yi(e){if(!pe)pe=new Mo("prio"),queueMicrotask(Ws);else if(!(Ue&1)&&(Ue++,Ue>98))throw new Error("Too many recursive updates from observes");pe.add(e)}function Ws(){let e=Date.now();for(;pe;){let t=pe.fetchLast();if(!t)break;Ue&1&&Ue++,t.queueRun()}pe=void 0,Ue=0,e=Date.now()-e,e>9&&console.debug(`Aberdeen queue took ${e}ms`)}function Ns(e){let t="";for(let r of e){if(typeof r=="string"){t+=`${r}`;continue}if(typeof r!="number")throw new Error("onEach() sort key must be a string, number or an array of such");let o="",i=Math.abs(Math.round(r)),n=r<0;for(;i>0;)o=String.fromCharCode(n?65534-i%65533:2+i%65533)+o,i=Math.floor(i/65533);t+=String.fromCharCode(128+(n?-o.length:o.length))+o}return t}function cl(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCodePoint(65535-e.charCodeAt(r));return t}var Gs=0,Io=class{prio=--Gs;remove(){let t=this.getLastNode();t&&Lo(t,this.getPrecedingNode()),this.delete()}},Fi=class{queueRun;prio=--Gs;constructor(t){this.queueRun=t,Yi(this)}},Ve=class extends Io{cleaners;changes;constructor(t=[]){super(),this.cleaners=t}lastChild;redraw(){}getLastNode(){return $r(this.lastChild)}delete(){for(let t of this.cleaners)typeof t=="function"?t():t.delete(this);this.cleaners.length=0,pe?.remove(this),this.lastChild=void 0}onChange(t,r,o,i){this.changes||(this.changes=new Map,Yi(this));let n=this.changes.get(t);n||(n=new Map,this.changes.set(t,n)),n.has(r)?n.get(r)===o&&n.delete(r):n.set(r,i)}fetchHasChanges(){if(!this.changes)return!1;for(let t of this.changes.values())if(t.size>0)return delete this.changes,!0;return delete this.changes,!1}queueRun(){this.fetchHasChanges()&&(this.remove(),_e=this,this.redraw(),_e=void 0)}getInsertAfterNode(){return this.getLastNode()||this.getPrecedingNode()}getChildPrevSibling(){return this.lastChild}},Sr=class extends Ve{el;svg;prevSibling;constructor(t,r,o=!1){super(o?k.cleaners:[]),this.el=t,this.svg=r,t===k.el?(this.prevSibling=k.getChildPrevSibling(),k.lastChild=this):this.prevSibling=t.lastChild||void 0,o||k.cleaners.push(this)}getPrecedingNode(){return $r(this.prevSibling)}getChildPrevSibling(){return this.lastChild||this.prevSibling}},Do=class extends Sr{renderer;constructor(t,r,o){super(t,r),this.renderer=o,this.redraw()}redraw(){let t=k;k=this;try{this.renderer()}catch(r){Zi(r,!0)}k=t}},Oo=class extends Ve{el=document.body;svg=!1;getPrecedingNode(){}},Ni=class extends Ve{el;renderer;svg;constructor(t,r){super(),this.el=t,this.renderer=r,this.svg=t.namespaceURI==="http://www.w3.org/2000/svg",this.redraw(),k.cleaners.push(this)}redraw(){Do.prototype.redraw.call(this)}getPrecedingNode(){}delete(){Lo(this.getLastNode(),this.getPrecedingNode()),super.delete()}remove(){this.delete()}};function Lo(e,t){for(;e&&e!==t;){let r=e.previousSibling,o=Wi.get(e);o&&e instanceof Element?o!==!0&&(typeof o=="function"?o(e):bl(e,o),Wi.set(e,!0)):e.remove(),e=r}}function $r(e){return!e||e instanceof Node?e:e.getLastNode()||e.getPrecedingNode()}var zi=class extends Sr{renderer;result=st({value:void 0});constructor(t){super(k.el,k.svg),this.renderer=t,this.redraw()}redraw(){let t=k;k=this;try{this.result.value=this.renderer()}catch(r){Zi(r,!0)}k=t}},Hi=class extends Sr{key;target;svg=!1;constructor(t,r,o){super(t,t.namespaceURI==="http://www.w3.org/2000/svg"),this.key=r,this.target=o,this.redraw()}redraw(){let t=k;k=this,Gt(this.el,this.key,this.target.value),k=t}},ji=class extends Io{renderer;makeSortKey;parentElement=k.el;prevSibling;target;byIndex=new Map;sortedSet=new Mo("sortKey");changedIndexes=new Map;constructor(t,r,o){super(),this.renderer=r,this.makeSortKey=o;let i=this.target=t[I]||t;if(Y(i,ut,this),this.prevSibling=k.getChildPrevSibling(),k.lastChild=this,k.cleaners.push(this),i instanceof Array)for(let n=0;n<i.length;n++)new Cr(this,n,!1);else for(let n of i instanceof Map?i.keys():i instanceof Set?i.values():Object.keys(i))new Cr(this,n,!1)}getPrecedingNode(){return $r(this.prevSibling)}onChange(t,r,o,i){(!(t instanceof Array)||typeof r=="number")&&(this.changedIndexes.has(r)?this.changedIndexes.get(r)===o&&this.changedIndexes.delete(r):(this.changedIndexes.set(r,i),Yi(this)))}queueRun(){let t=this.changedIndexes;this.changedIndexes=new Map;for(let r of t.keys()){let o=this.byIndex.get(r);o&&o.remove(),(this.target instanceof Set||this.target instanceof Map?this.target.has(r):r in this.target)?new Cr(this,r,!0):this.byIndex.delete(r)}_e=void 0}delete(){for(let t of this.byIndex.values())t.delete();pe?.remove(this),this.byIndex.clear(),setTimeout(()=>{this.sortedSet.clear()},1)}getLastNode(){for(let t of this.sortedSet){let r=t.getActualLastNode();if(r)return r}}},Cr=class extends Ve{parent;itemIndex;sortKey;el;svg;constructor(t,r,o){super(),this.parent=t,this.itemIndex=r,this.el=t.parentElement,this.svg=k.svg,this.parent.byIndex.set(this.itemIndex,this),this.lastChild=this,o&&(_e=this),this.redraw()}getPrecedingNode(){this.parent.sortedSet.add(this);let t=this.parent.sortedSet.prev(this);return t?$r(t.lastChild):this.parent.getPrecedingNode()}getLastNode(){return this.getPrecedingNode()}getActualLastNode(){let t=this.lastChild;for(;t&&t!==this;){if(t instanceof Node)return t;let r=t.getLastNode();if(r)return r;t=t.getPrecedingNode()}}queueRun(){if(k!==We&&qs(4),!!this.fetchHasChanges()){if(this.sortKey!==void 0){let t=this.getActualLastNode();t&&Lo(t,this.getPrecedingNode())}this.delete(),this.lastChild=this,_e=this,this.redraw(),_e=void 0}}redraw(){let t,r=this.parent.target,o=this.itemIndex;r instanceof Set?t=o=st(o):r instanceof Map?(t=st(r.get(o)),o=st(o)):t=st(r[o]);let i=k;k=this;let n;try{this.parent.makeSortKey?n=this.parent.makeSortKey(t,o):n=o,n instanceof Array?n=Ns(n):typeof n!="string"&&n!=null&&(n=Ns([n])),this.sortKey!==n&&(this.parent.sortedSet.remove(this),this.sortKey=n),n!=null&&this.parent.renderer(t,o)}catch(s){Zi(s,n!=null)}k=i}getInsertAfterNode(){return this.sortKey==null&&qs(1),$r(this.lastChild)}remove(){if(this.sortKey!==void 0){let t=this.getActualLastNode();t&&Lo(t,this.getPrecedingNode()),this.parent.sortedSet.remove(this),this.sortKey=void 0}this.delete()}};function Te(e,t){if(e!==k.el){e.appendChild(t);return}let r=k.el,o=k.getInsertAfterNode();r.insertBefore(t,o?o.nextSibling:r.firstChild),k.lastChild=t}var We=new Oo,k=We;function ul(e){let t=k;k=new Oo;try{return e()}finally{k=t}}var ut=Symbol("any"),I=Symbol("target"),ee=Symbol("mapSize"),Ui=new WeakMap,Tr=0;function Y(e,t,r=k){if(r===We||Tr)return;let o=Ui.get(e);if(o||Ui.set(e,o=new Map),t!==ut&&o.get(ut)?.has(r))return;let i=o.get(t);i||o.set(t,i=new Set),!i.has(r)&&(i.add(r),r===k?k.cleaners.push(i):k.cleaners.push(()=>{i.delete(r)}))}function Ge(e,t,r){if(!e||typeof e!="object")throw new Error("A.onEach requires an object");e=e[I]||e,new ji(e,t,r)}function Vi(e){for(let t of Object.keys(e))return!1;return!0}var j=Symbol("empty");function Ro(e){let t=e[I]||e,r=k;if(t instanceof Array)return Y(t,"length",(i,n,s)=>{!n!=!s&&r.onChange(t,j,!n,!s)}),!t.length;if(t instanceof Map||t instanceof Set)return Y(t,ee,(i,n,s)=>{!n!=!s&&r.onChange(t,j,!n,!s)}),!t.size;let o=Vi(t);return Y(t,ut,(i,n,s)=>{if(n===j!=(s===j)){let a=Vi(t);r.onChange(t,j,a,o),o=a}}),o}function dl(e){if(e instanceof Array)return Fo(e,"length");if(e instanceof Map||e instanceof Set)return Fo(e,"size");let t=e[I]||e,r=0;for(let i of Object.keys(t))t[i]!==void 0&&r++;let o=Ho(r);return Y(t,ut,(i,n,s)=>{s===n||(s===j?o.value=++r:n===j&&(o.value=--r))}),o}function hl(e,t,r,o){if(r===o&&r!==void 0)return;let i=Ui.get(e);if(i!==void 0)for(let n of[t,ut]){let s=i.get(n);if(s)for(let a of s)typeof a=="function"?a(t,r,o):a.onChange(e,t,r,o)}}var U=hl,ml={get(e,t){return t===I?e:(Y(e,t),st(e[t]))},set(e,t,r){typeof r=="object"&&r&&(r=r[I]||r);let o=e.hasOwnProperty(t)?e[t]:j;return r!==o&&(e[t]=r,U(e,t,r,o)),!0},deleteProperty(e,t){let r=e.hasOwnProperty(t)?e[t]:j;return delete e[t],U(e,t,j,r),!0},has(e,t){return Y(e,t),e.hasOwnProperty(t)},ownKeys(e){return Y(e,ut),Reflect.ownKeys(e)}};function fl(e,t,r){typeof r=="object"&&r&&(r=r[I]||r);let o=e[t];if(o===void 0&&!e.hasOwnProperty(t)&&(o=j),r!==o){let i=e.length;if(t==="length"){e.length=r;for(let n=r;n<i;n++)U(e,n,j,e[n])}else{if(typeof t=="string"){let n=0|t;String(n)===t&&n>=0&&(t=n)}e[t]=r,U(e,t,r,o)}e.length!==i&&U(e,"length",e.length,i)}return!0}var pl={get(e,t){if(t===I)return e;if(typeof t=="string"){let r=0|t;String(r)===t&&r>=0&&(t=r)}return Y(e,t),st(e[t])},set:fl,deleteProperty(e,t){if(typeof t=="string"){let o=0|t;String(o)===t&&o>=0&&(t=o)}let r=e[t];return r===void 0&&!e.hasOwnProperty(t)&&(r=j),delete e[t],U(e,t,j,r),!0}};function Pr(e){return{[Symbol.iterator](){return this},next(){let t=e.next();return t.done?t:{done:!1,value:st(t.value)}}}}function qi(e){return{[Symbol.iterator](){return this},next(){let t=e.next();return t.done?t:{done:!1,value:[st(t.value[0]),st(t.value[1])]}}}}function fe(e){return typeof e=="object"&&e&&e[I]||e}var zs={get(e){let t=this[I];return e=fe(e),Y(t,e),st(t.get(e))},set(e,t){let r=this[I];e=fe(e),t=fe(t);let o=r.get(e);if(o===void 0&&!r.has(e)&&(o=j),t!==o){let i=r.size;r.set(e,t),U(r,e,t,o),U(r,ee,r.size,i)}return this},delete(e){let t=this[I];e=fe(e);let r=t.get(e);r===void 0&&!t.has(e)&&(r=j);let o=t.delete(e);return o&&(U(t,e,j,r),U(t,ee,t.size,t.size+1)),o},clear(){let e=this[I],t=e.size;for(let r of e.keys())U(e,r,void 0,e.get(r));e.clear(),U(e,ee,0,t)},has(e){let t=this[I];return e=fe(e),Y(t,e),t.has(e)},keys(){let e=this[I];return Y(e,ut),Pr(e.keys())},values(){let e=this[I];return Y(e,ut),Pr(e.values())},entries(){let e=this[I];return Y(e,ut),qi(e.entries())},[Symbol.iterator](){let e=this[I];return Y(e,ut),qi(e[Symbol.iterator]())}},Hs={add(e){let t=this[I];if(e=fe(e),!t.has(e)){let r=t.size;t.add(e),U(t,e,e,j),U(t,ee,t.size,r)}return this},delete(e){let t=this[I];if(e=fe(e),!t.has(e))return!1;let r=t.size;return t.delete(e),U(t,e,j,e),U(t,ee,t.size,r),!0},clear(){let e=this[I],t=e.size;if(t){for(let r of e.values())U(e,r,j,r);e.clear(),U(e,ee,0,t)}},has(e){let t=this[I];return e=fe(e),Y(t,e),t.has(e)},keys(){let e=this[I];return Y(e,ut),Pr(e.keys())},values(){let e=this[I];return Y(e,ut),Pr(e.values())},entries(){let e=this[I];return Y(e,ut),qi(e.entries())},[Symbol.iterator](){let e=this[I];return Y(e,ut),Pr(e[Symbol.iterator]())}},gl={get(e,t){return t===I?e:zs.hasOwnProperty(t)?zs[t]:t==="size"?(Y(e,ee),e.size):e[t]}},yl={get(e,t){return t===I?e:Hs.hasOwnProperty(t)?Hs[t]:t==="size"?(Y(e,ee),e.size):e[t]}},js=new WeakMap;function st(e){if(typeof e!="object"||!e||e[I]!==void 0||e[ge]||e instanceof Date)return e;let t=js.get(e);if(t)return t;let r;return e instanceof Array?r=pl:e instanceof Map?r=gl:e instanceof Set?r=yl:r=ml,t=new Proxy(e,r),js.set(e,t),t}function Ho(e){if(e instanceof Promise){let t=st({busy:!0});return e.then(r=>{t.value=r,t.busy=!1}).catch(r=>{t.error=r,t.busy=!1}),t}return st(typeof e=="object"&&e!==null?e:{value:e})}function Xi(e){return e&&(e[I]||e)}var Wi=new WeakMap;function bl(e,t){let r=t.split(".").filter(o=>o);e.classList.add(...r),setTimeout(()=>e.remove(),2e3)}function vl(e,t,r){return arguments.length>2?Ks(e,t,r,0):Ji(e,t,0)}function Ks(e,t,r,o){let i=ia(e,t);return r===i?!1:typeof i=="object"&&i!==null&&typeof r=="object"&&r!==null&&i.constructor===r.constructor?Ji(i,r,o):(r=Gi(r),e instanceof Map?e.set(t,r):e[t]=Gi(r),!0)}function xl(e,t,r){return arguments.length>2?Ks(e,t,r,Bo):Ji(e,t,Bo)}function Ji(e,t,r){let o=e[I];return o&&(e=o,r|=me),o=t[I],o&&(t=o,k!==We&&!Tr&&(r|=Re)),_o(e,t,r)}function _o(e,t,r){r&Re&&Y(t,ut);let o=!1;if(t instanceof Array&&e instanceof Array){let i=e.length,n=t.length;for(let s=0;s<n;s++){let a=e[s];a===void 0&&!e.hasOwnProperty(s)&&(a=j);let l=t[s];if(l===void 0&&!t.hasOwnProperty(s))delete e[s],r&me&&U(e,s,j,a),o=!0;else if(a!==l){if(typeof l=="object"&&l!==null){if(typeof a=="object"&&a!==null&&l.constructor===a.constructor&&!(ge in l)){o=_o(a,l,r)||o;continue}l=Er(l,r&Re)}e[s]=l,r&me&&U(e,s,l,a),o=!0}}if(n!==i){if(r&me){for(let s=n;s<i;s++){let a=e[s];delete e[s],U(e,s,j,a)}e.length=n,U(e,"length",n,i)}else e.length=n;o=!0}}else if(t instanceof Map&&e instanceof Map){for(let i of t.keys()){let n=t.get(i),s=e.get(i);if(s===void 0&&!e.has(i)&&(s=j),s!==n){if(typeof n=="object"&&n!==null){if(typeof s=="object"&&s!==null&&n.constructor===s.constructor&&!(ge in n)){o=_o(s,n,r)||o;continue}n=Er(n,r&Re)}e.set(i,n),r&me&&U(e,i,n,s),o=!0}}if(!(r&Bo)){for(let i of e.keys())if(!t.has(i)){let n=e.get(i);e.delete(i),r&me&&U(e,i,j,n),o=!0}}}else if(t.constructor===e.constructor){for(let i of Object.keys(t)){let n=t[i],s=e.hasOwnProperty(i)?e[i]:j;if(s!==n){if(typeof n=="object"&&n!==null){if(typeof s=="object"&&s!==null&&n.constructor===s.constructor&&!(ge in n)){o=_o(s,n,r)||o;continue}n=Er(n,r&Re)}e[i]=n,r&me&&U(e,i,n,s),o=!0}}if(!(r&Bo)){for(let i of Object.keys(e))if(!t.hasOwnProperty(i)){let n=e[i];delete e[i],r&me&&n!==void 0&&U(e,i,j,n),o=!0}}}else throw new Error(`Incompatible or non-object types: ${t?.constructor?.name||typeof t} vs ${e?.constructor?.name||typeof e}`);return o}var Bo=1,Re=32,me=64,ge=Symbol("OPAQUE"),wl=ge;Promise.prototype[ge]=!0;var kr=st({});function Al(e=1,t="rem"){for(let r=0;r<=12;r++)kr[r]=2**(r-3)*e+t}var Cl=/(\burl\([^)]*\))|("[^"]*")|(^| )\$([\w-]+)/g,Ys=/^\d/;function Xs(e){return e.indexOf("$")<0?e:e.replace(Cl,(t,r,o,i,n)=>{if(r||o)return t;let s=Ys.test(n)?`m${n}`:n;return`${i}var(--${s})`})}var $o;function Pl(){if(!$o){if(typeof window>"u"||!window.matchMedia)return!1;let e=window.matchMedia("(prefers-color-scheme: dark)");$o=Ho({value:e.matches}),e.addEventListener("change",()=>$o.value=e.matches)}return $o.value}function Er(e,t){if(ge in e)return e;if(t&Re&&Y(e,ut),e instanceof Array)return e.map(o=>Li(o,t));if(e instanceof Map){let o=new Map;for(let[i,n]of e)o.set(i,Li(n,t));return o}let r=Object.create(Object.getPrototypeOf(e));for(let o of Object.keys(e))r[o]=Li(e[o],t);return r}function Li(e,t){return typeof e=="object"&&e!==null?Er(e,t):e}function Gi(e){if(typeof e!="object"||e===null)return e;let t=0,r=e[I];return r&&(e=r,k!==We&&!Tr&&(t=Re)),Er(e,t)}var kl={get(e,t){if(t===I)return Fo(Xi(e.proxy),e.index);if(t==="value")return e.proxy[e.index]},set(e,t,r){return t==="value"?(e.proxy[e.index]=r,!0):!1}};function Fo(e,t){return new Proxy({proxy:e,index:t},kl)}function El(e,t){let r,o,i=e.getAttribute("type"),n=Xi(t).value;i==="checkbox"?(n===void 0&&(t.value=e.checked),r=()=>{e.checked=t.value},o=()=>{t.value=e.checked}):i==="radio"?(n===void 0&&e.checked&&(t.value=e.value),r=()=>{e.checked=t.value===e.value},o=()=>{e.checked&&(t.value=e.value)}):(o=()=>{t.value=i==="number"||i==="range"?e.value===""?null:+e.value:e.value},n===void 0&&o(),r=()=>{e.value=t.value,e.tagName==="SELECT"&&e.value!=t.value&&new Fi(()=>e.value=t.value)}),ra(r),e.addEventListener("input",o),Kt(()=>{e.removeEventListener("input",o)})}var Bi=/\*\*(.+?)\*\*|\*(.+?)\*|`(.+?)`|\[(.+?)\]\((.+?)\)/g,No={create:(e,t)=>{if(k===_e)if(typeof t=="function")t(e);else{let r=t.split(".").filter(o=>o);e.classList.add(...r),(async()=>(e.offsetHeight,e.classList.remove(...r)))()}},destroy:(e,t)=>{Wi.set(e,t)},html:(e,t)=>{if(e===k.el&&!e.firstChild)e.innerHTML=`${t}`;else{let r=document.createElement(k.el.tagName);for(r.innerHTML=`${t}`;r.firstChild;)Te(e,r.firstChild)}},text:(e,t)=>{Te(e,document.createTextNode(t))},rich:(e,t)=>{let r=0,o,i=String(t);for(Bi.lastIndex=0;(o=Bi.exec(i))!==null;){o.index>r&&Te(e,document.createTextNode(i.slice(r,o.index)));let n;if(o[1]!==void 0)n=document.createElement("strong"),n.textContent=o[1];else if(o[2]!==void 0)n=document.createElement("em"),n.textContent=o[2];else if(o[3]!==void 0)n=document.createElement("code"),n.textContent=o[3];else{let s=document.createElement("a");s.textContent=o[4],s.href=o[5],n=s}Te(e,n),r=Bi.lastIndex}r<i.length&&Te(e,document.createTextNode(i.slice(r)))}};function Sl(){No.create=No.destroy=()=>{}}function wt(...e){let t=k.el,r=k.svg,o=e.length;for(let i=0;i<o;i++){let n=e[i];if(!(n==null||n===!1))if(typeof n=="string"){let s=n.length,a=0;for(let l=0;l<s;l=a+1){a=je(n," .=:#",l);let c=n[a];if(c===":"){let u="$"+n.substring(l,a);if(a+1>=s){Gt(t,u,e[++i]);break}if(n[a+1]===" "){let h=je(n,";",a+2),f=n.substring(a+2,h).trim();Gt(t,u,f),a=h}else{let h=je(n," ",a+1),f=n.substring(a+1,h);Gt(t,u,f),a=h}}else if(c==="="){let u=n.substring(l,a);if(a+1>=s){Gt(t,u,e[++i]);break}let h=n[a+1];if(h==='"'||h==="'"||h==="`"){let f=je(n,h,a+2),y=n.substring(a+2,f);Gt(t,u,y),a=f}else{let f=je(n," ",a+1),y=n.substring(a+1,f);Gt(t,u,y),a=f}}else{if(a>l){let u=n.substring(l,a);r||=u==="svg";let h=r?document.createElementNS("http://www.w3.org/2000/svg",u):document.createElement(u);Te(t,h),t=h}if(c==="#"){let u=a+1<s?n.substring(a+1):e[++i];Gt(t,"text",u);break}if(c==="."){let u=je(n," #=.",a+1);if(n[u]==="="&&u+1>=s)Gt(t,n.substring(a,u),e[++i]),a=u;else{let h=n.substring(a+1,u);t.classList.add(h||e[++i]),a=u-1}}}}}else if(typeof n=="object")if(n.constructor!==Object)if(n instanceof Node)Te(t,n),n instanceof Element&&(t=n,r=n.namespaceURI==="http://www.w3.org/2000/svg");else throw new Error(`Unexpected argument: ${n}`);else for(let s of Object.keys(n))Gt(t,s,n[s]);else if(typeof n=="function")new Do(t,r,n);else throw new Error(`Unexpected argument: ${n}`)}return t}function je(e,t,r){if(t.length===1){let i=e.indexOf(t,r);return i>=0?i:e.length}let o=e.length;for(let i=r;i<o;i++)if(t.indexOf(e[i])>=0)return i;return o}var Js=0;function $l(e){let t=`.AbdStl${++Js}`,r=typeof e=="string"?Ki(e,t):zo(e,t);if(r){let o=Qs++;qe[o]=r,Kt(()=>delete qe[o])}return t}var qe=Ho({}),Qs=0;function Us(e,t){let r=[];for(let o of e.split(","))for(let i of t.split(","))r.push(i.includes("&")?i.trim().replace(/&/g,o):`${o} ${i.trim()}`.trim());return r.join(",")}function zo(e,t){let r="";for(let[o,i]of Object.entries(e))i&&typeof i=="object"?o.startsWith("@")?r+=`${o}{
17
+ ${zo(i,t)}}
18
+ `:r+=zo(i,Us(t,o)):typeof i=="string"&&(o.startsWith("@")?r+=`${o}{
19
+ ${Ki(i,t)}}
20
+ `:r+=Ki(i,Us(t,o)));return r}var Tl=/-([a-z])/g;function Vs(e){return e.replace(Tl,(t,r)=>r.toUpperCase())}var Rl=/^[a-zA-Z-]+$/;function Ki(e,t){let r="";for(let o=0,i=e.length;o<i;){for(;e[o]===" ";)o++;if(o>=i)break;let n=e.indexOf(":",o);if(n===-1)throw new Error(`Trailing data in style string: "${e.substring(o)}"`);let s=e.substring(o,n);if(!Rl.test(s))throw new Error(`Invalid CSS key: "${s}" in style string: "${e}"`);o=n+1;let a;if(e[o]===" "){o++;let u=e.indexOf(";",o);a=e.substring(o,u===-1?i:u).trim(),o=u===-1?i:u+1}else{let u=e.indexOf(" ",o);a=e.substring(o,u===-1?i:u),o=u===-1?i:u}let l=Xs(a),c=Zs[s]||s;r+=typeof c=="string"?`${c}:${l};`:c.map(u=>`${u}:${l};`).join("")}return r?`${t}{${r}}
21
+ `:""}function _l(e){let t=zo(e,"");if(t){let r=Qs++;qe[r]=t,Kt(()=>delete qe[r])}}var Zs={m:"margin",mt:"margin-top",mb:"margin-bottom",ml:"margin-left",mr:"margin-right",mh:["margin-left","margin-right"],mv:["margin-top","margin-bottom"],p:"padding",pt:"padding-top",pb:"padding-bottom",pl:"padding-left",pr:"padding-right",ph:["padding-left","padding-right"],pv:["padding-top","padding-bottom"],w:"width",h:"height",bg:"background",fg:"color",r:"border-radius"};function Gt(e,t,r){if(typeof r=="object"&&r!==null&&r[I])t==="bind"?El(e,r):new Hi(e,t,r);else if(t[0]==="."){let o=t.substring(1).split(".");r?e.classList.add(...o):e.classList.remove(...o)}else if(t[0]==="$"){t=t.substring(1);let o=r==null||r===!1?"":typeof r=="string"?Xs(r):String(r),i=Zs[t]||t;if(typeof i=="string")e.style[Vs(i)]=o;else for(let n of i)e.style[Vs(n)]=o}else r==null||(t in No?No[t](e,r):typeof r=="function"?(e.addEventListener(t,r),e===k.el&&Kt(()=>e.removeEventListener(t,r))):r===!0||r===!1||t==="value"||t==="selectedIndex"?e[t]=r:e.setAttribute(t,r))}function ta(e){return console.error("Error while in Aberdeen render:",e),!0}var ea=ta;function Ml(e){ea=e||ta}function Kt(e){k.cleaners.push(e)}function ra(e){return new zi(e).result}function oa(e,t){new Ni(e,t)}function Il(){We.remove(),Js=0}function ia(e,t){Tr++;try{return arguments.length===1?e():e instanceof Map?e.get(t):e[t]}finally{Tr--}}function Dl(e,t){let r;return e instanceof Array?r=st([]):e instanceof Map?r=st(new Map):r=st({}),Ge(e,(o,i)=>{let n=t(o,i);n!==void 0&&(r instanceof Map?(r.set(i,n),Kt(()=>{r.delete(i)})):(r[i]=n,Kt(()=>{delete r[i]})))}),r}function Ol(e,t){let r=st({});return Ge(e,(o,i)=>{let n=t(o,i);if(n){for(let s of Object.keys(n))r[s]=n[s];Kt(()=>{for(let s of Object.keys(n))delete r[s]})}}),r}function Ll(e,t){let r={},o=st(r);return Ge(e,(i,n)=>{let s=t(i,n);if(s!=null){let a=s instanceof Array?s:[s];if(a.length){for(let l of a)r[l]?o[l][n]=i:o[l]={[n]:i};Kt(()=>{for(let l of a)delete o[l][n],Vi(r[l])&&delete o[l]})}}}),o}function Bl(e){let t=To;To||=new Set;try{na(e,To)}finally{To=t}return e}var To;function na(e,t){if(e&&typeof e=="object"){let r=e.constructor.name||"unknown object";if(t.has(e)){wt(`#<${r}: circular reference>`);return}t.add(e),Kt(()=>t.delete(e));let o=e[Qi];o!==void 0?typeof o=="function"?o.call(e):wt(`#${o}`):wt(`#<${r}>`,"ul",()=>{Ge(e,(i,n)=>{wt("li",()=>{e instanceof Array||wt(`#${JSON.stringify(n)}: `),na(i,t)})})})}else wt(e===void 0?"#undefined":"#"+JSON.stringify(e))}var Qi=Symbol("CUSTOM_DUMP");Date.prototype[Qi]=function(){wt("#<Date> "+this.toISOString())};function qs(e){throw new Error(`Aberdeen internal error ${e}`)}function Zi(e,t){try{ea(e)===!1&&(t=!1)}catch(r){console.error(r)}try{t&&wt("div.aberdeen-error#Error")}catch{}}typeof document<"u"&&ul(()=>{wt(()=>{Ro(qe)&&Ro(kr)||oa(document.head,()=>{wt("style.abd",()=>{Ge(qe,e=>{wt("#",e)}),wt(()=>{if(Ro(kr))return;let e=":root{";for(let[t,r]of Object.entries(kr)){let o=Ys.test(String(t))?`m${t}`:t;e+=`--${o}:${r};`}e+=`}
22
+ `,wt("#",e)})})})})});var T=Object.assign(wt,{clean:Kt,clone:Gi,copy:vl,count:dl,cssVars:kr,CUSTOM_DUMP:Qi,darkMode:Pl,derive:ra,disableCreateDestroy:Sl,dump:Bl,insertCss:$l,insertGlobalCss:_l,invertString:cl,isEmpty:Ro,map:Dl,merge:xl,mount:oa,multiMap:Ol,OPAQUE:ge,NO_COPY:wl,onEach:Ge,partition:Ll,peek:ia,proxy:Ho,ref:Fo,runQueue:Ws,setErrorHandler:Ml,setSpacingCssVars:Al,unmountAll:Il,unproxy:Xi});var Fl=new TextEncoder,tn=new TextDecoder("utf-8",{fatal:!0}),Ke=Symbol("EOD"),Vo="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_$",la=new Uint8Array(128).fill(255);for(let e=0;e<Vo.length;++e)la[Vo.charCodeAt(e)]=e;var en=typeof process<"u"&&process?.stdout?.isTTY,jo=en?["\x1B[32m","\x1B[33m","\x1B[34m","\x1B[35m"]:[""],Nl=en?"\x1B[0m":"",sa=en?"\x1B[31m":"",aa={array:5,object:6,map:7,set:8,end:9},Uo=0,zl=typeof process<"u"?!!process.env?.DATAPACK_EXTENDED_LOGGING:!1,re=class e{buffer;dataView;readPos=0;writePos=0;static EOD=Ke;get _buffer(){return this.buffer}constructor(t=1900){t instanceof Uint8Array?(this.buffer=t,this.writePos=t.length):this.buffer=new Uint8Array(t)}writeMultiByteNumber(t,r,o=!1,i=!1){let n=0,s=t;for(;s>0;)n++,s=Math.floor(s/256);let a=i?~n&31:n;this.buffer[this.writePos++]=r<<5|a;let l=1;for(let c=0;c<n;c++)l*=256;for(let c=0;c<n;c++){l=Math.floor(l/256);let u=Math.floor(t/l)%256;o&&(u^=255),this.buffer[this.writePos++]=u}}readMultiByteNumber(t,r=!1){this.readPos+t>this.writePos&&this.notEnoughData("number");let o=0,i=1;for(let n=t-1;n>=0;n--){let s=this.buffer[this.readPos+n];r&&(s^=255),o+=s*i,i*=256}return this.readPos+=t,o}notEnoughData(t){throw new Error(`Not enough data to read a ${t} at position ${this.readPos} in
23
+ ${this.toString(!0)}`)}write(t){if(this.ensureCapacity(33),typeof t=="number")Number.isInteger(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER?t>=0?t<32?this.buffer[this.writePos++]=32|t:t<64?this.buffer[this.writePos++]=64|t-32:this.writeMultiByteNumber(t-64,3):this.writeMultiByteNumber(-t,0,!0,!0):(this.buffer[this.writePos++]=128,this.dataView||=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),this.dataView.setFloat64(this.writePos,t),this.writePos+=8);else if(t===void 0)this.buffer[this.writePos++]=129;else if(t===null)this.buffer[this.writePos++]=130;else if(t===!0)this.buffer[this.writePos++]=131;else if(t===!1)this.buffer[this.writePos++]=132;else if(typeof t=="string"){let r=Fl.encode(t);r.length<32?this.buffer[this.writePos++]=160|r.length:this.writeMultiByteNumber(r.length,6),this.ensureCapacity(r.length),this.buffer.set(r,this.writePos),this.writePos+=r.length}else if(t instanceof Uint8Array)this.writeMultiByteNumber(t.length,7),this.ensureCapacity(t.length),this.buffer.set(t,this.writePos),this.writePos+=t.length;else if(Array.isArray(t)||typeof t.length=="number"&&typeof t[Symbol.iterator]=="function"){this.buffer[this.writePos++]=133;for(let r of t)this.write(r);this.buffer[this.writePos++]=137}else if(t instanceof Map){this.buffer[this.writePos++]=135;for(let[r,o]of t)this.write(r),this.write(o);this.buffer[this.writePos++]=137}else if(t instanceof Set){this.buffer[this.writePos++]=136;for(let r of t)this.write(r);this.buffer[this.writePos++]=137}else if(t instanceof Date)this.buffer[this.writePos++]=140,this.write(Math.floor(t.getTime()/1e3));else if(typeof t=="object")t instanceof Rr?this.writeCustom(t.name,t.data):typeof t.toDataPack=="function"?t.toDataPack(this):this.writeAsObject(t);else throw new Error(`Unsupported data type: ${typeof t}`);return this}read(t){if(this.readPos>this.writePos)throw new Error("Not enough data");let r=this.buffer[this.readPos++],o=r>>5&7,i=r&31;switch(o){case 0:{let n=~i&31;return-this.readMultiByteNumber(n,!0)}case 1:return i;case 2:return i+32;case 3:return this.readMultiByteNumber(i)+64;case 4:switch(i){case 0:{this.readPos+8>this.writePos&&this.notEnoughData("float64"),this.dataView||=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength);let n=this.dataView.getFloat64(this.readPos);return this.readPos+=8,n}case 1:return;case 2:return null;case 3:return!0;case 4:return!1;case 5:{let n=[];for(;;){let s=this.read(t);if(s===Ke)break;n.push(s)}return n}case 6:{let n={};for(;;){let s=this.read(t);if(s===Ke)break;let a=this.read(t);n[s]=a}return n}case 7:{let n=new Map;for(;;){let s=this.read(t);if(s===Ke)break;let a=this.read(t);n.set(s,a)}return n}case 8:{let n=new Set;for(;;){let s=this.read(t);if(s===Ke)break;n.add(s)}return n}case 9:return Ke;case 10:return--this.readPos,this.readIdentifier();case 11:{let n=this.readPos,s=n;for(;s>=this.writePos&&this.notEnoughData("null-terminated string"),this.buffer[s]!==0;)s++;return this.readPos=s+1,tn.decode(this.buffer.subarray(n,s))}case 12:{let n=this.readPositiveInt();return new Date(n*1e3)}case 13:{let n=this.readString(),s=this.read();return t&&n in t?t[n](s):new Rr(n,s)}default:throw new Error(`Unknown type 4 subtype: ${i}`)}case 5:{let n=i;this.readPos+n>this.writePos&&this.notEnoughData("short string");let s=this.buffer.subarray(this.readPos,this.readPos+n);return this.readPos+=n,tn.decode(s)}case 6:{let n=this.readMultiByteNumber(i);this.readPos+n>this.writePos&&this.notEnoughData("string");let s=this.buffer.subarray(this.readPos,this.readPos+n);return this.readPos+=n,tn.decode(s)}case 7:{let n=this.readMultiByteNumber(i);this.readPos+n>this.writePos&&this.notEnoughData("blob");let s=this.buffer.slice(this.readPos,this.readPos+n);return this.readPos+=n,new Uint8Array(s)}default:throw new Error(`Unknown type: ${o}`)}}ensureCapacity(t){let r=this.writePos+t;if(r<=this.buffer.length)return;let o=Math.max(r,Math.floor(this.buffer.length*1.5)),i=new Uint8Array(o);i.set(this.buffer.subarray(0,this.writePos)),this.buffer=i,delete this.dataView}readNumber(){let t=this.read();if(typeof t!="number")throw new Error("Expected number but got "+typeof t);return t}readDate(){let t=this.read();if(!(t instanceof Date))throw new Error("Expected Date but got "+typeof t);return t}readPositiveInt(t){let r=this.read();if(typeof r!="number"||!Number.isInteger(r)||r<0||t!==void 0&&r>=t)throw new Error(`Expected positive integer < ${t} but got ${r}`);return r}readBoolean(){let t=this.read();if(typeof t!="boolean")throw new Error("Expected boolean but got "+typeof t);return t}readUint8Array(){let t=this.read();if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array but got "+typeof t);return t}readString(){let t=this.read();if(typeof t!="string")throw new Error("Expected string but got "+typeof t);return t}writeIdentifier(t){let r=0;if(typeof t=="number")r=t;else{if(t.length!==8)throw new Error(`Identifier must be exactly 8 characters, got ${t.length}`);let o;for(let i=0;i<8;i++){let n=t.charCodeAt(i);if(n>127||(o=la[n])===255)throw new Error(`Invalid base64 character: ${t[i]}`);r=r*64+o}}this.ensureCapacity(7),this.buffer[this.writePos++]=138;for(let o=5;o>=0;o--)this.buffer[this.writePos+o]=r%256,r=Math.floor(r/256);return this.writePos+=6,this}readIdentifier(){let t=this.readIdentifierNumber(),r="";for(let o=0;o<8;o++)r=Vo[t%64]+r,t=Math.floor(t/64);return r}readIdentifierNumber(){if(this.readPos+7>this.writePos&&this.notEnoughData("identifier"),this.buffer[this.readPos++]!==138)throw new Error("Invalid identifier header");let r=0;for(let o=0;o<6;o++)r=r*256+this.buffer[this.readPos++];return r}writeOrderedString(t){let r=new TextEncoder().encode(t);if(r.includes(0))throw new Error("String contains null character");return this.ensureCapacity(r.length+2),this.buffer[this.writePos++]=139,this.buffer.set(r,this.writePos),this.writePos+=r.length,this.buffer[this.writePos++]=0,this}toUint8Array(t=!0,r=0,o=this.writePos){return t?this.buffer.slice(r,o):this.buffer.subarray(r,o)}toBuffer(){return this.buffer.buffer.slice(0,this.writePos)}clone(t,r=0,o=this.writePos){if(t)return new e(this.buffer.slice(r,o));{let i=new e(this.buffer);return i.readPos=r,i.writePos=o,i}}writeCustom(t,r){this.buffer[this.writePos++]=141,this.write(t),this.write(r)}writeAsObject(t){this.buffer[this.writePos++]=134;for(let r of Object.keys(t))this.write(r),this.write(t[r]);return this.buffer[this.writePos++]=137,this}writeCollection(t,r){return this.writeCollectionBoundary(t),r(t==="array"||t==="set"?o=>{this.write(o)}:t==="object"?(o,i)=>{this.writeObjectKey(o),this.write(i)}:(o,i)=>{this.write(o),this.write(i)}),this.writeCollectionBoundary("end")}writeCollectionBoundary(t){let r=aa[t];if(!r)throw new Error(`Invalid collection type: ${t}`);return this.buffer[this.writePos++]=128|r,this}writeObjectKey(t){if(typeof t=="string"){let r=parseInt(t,10);r.toString()==t&&(t=r)}else typeof t!="number"&&(t=""+t);this.write(t)}readCollectionBoundary(t){this.readPos>=this.writePos&&this.notEnoughData("collection boundary");let r=this.buffer[this.readPos++],o=128|aa[t];if(r!==o)throw new Error(`Expected ${t} boundary but got byte ${r}`)}increment(){for(let t=this.writePos-1;t>=0;t--)if(this.buffer[t]===255)this.buffer[t]=0;else return this.buffer[t]++,this}toString(t=void 0,r=0,o=this.writePos){t===void 0&&(t=zl);let i=this.readPos;this.readPos=r;let n=0,s="",a="",l=Uo,c=l>0?jo[(l-1)%jo.length]:Nl;try{for(;this.readPos<o;){let u=jo[Uo++%jo.length];if(s+=u+Ye(this.read())+" ",t)for(a+=u;n<this.readPos;)a+=this.buffer[n].toString(16).padStart(2,"0")+" ",n++}}catch{if(!t)return this.readPos=i,Uo=l,this.toString(!0,r,o);for(s+=sa+"ERROR ",a+=sa;n<this.writePos;)a+=this.buffer[n].toString(16).padStart(2,"0")+" ",n++}return this.readPos=i,l||(Uo=0),t?"DataPack{"+a+c+"\u2192 "+s.trimEnd()+c+"}":"DataPack{"+s.trimEnd()+c+"}"}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}readAvailable(){return this.readPos<this.writePos}static generateIdentifier(){let t=Math.floor(+new Date*256+Math.random()*16384),r="";for(let o=0;o<8;o++)r=Vo[t&63]+r,t=Math.floor(t/64);return r}static createBuffer(...t){let r=new e;for(let o of t)r.write(o);return r.toBuffer()}static createUint8Array(...t){let r=new e;for(let o of t)r.write(o);return r.toUint8Array(!1)}};function Ye(e){if(e===void 0)return"undefined";if(typeof e=="object"&&e!==null){if(e instanceof Uint8Array)return new re(e).toString();if(e instanceof Array)return"["+e.map(t=>Ye(t)).join(", ")+"]";if(e instanceof Map)return"Map{"+Array.from(e.entries()).map(([t,r])=>`${Ye(t)}=>${Ye(r)}`).join(", ")+"}";if(e instanceof Set)return"Set{"+Array.from(e.values()).map(t=>Ye(t)).join(", ")+"}";if(typeof e=="object"&&e!==null)return"{"+Object.entries(e).map(([t,r])=>`${t}:${Ye(r)}`).join(", ")+"}"}return JSON.stringify(e)}var Rr=class{name;data;constructor(t,r){this.name=t,this.data=r}};re.prototype.CustomData=Rr;var oe={error:"e",response:"r",response_proxy:"p",response_model:"m",response_proxy_model:"q",model_data:"d"},rn={call:1,cancel:2};var At=0;var qo=Symbol(),Wo=class{constructor(t){this.url=t;this.api=new Proxy({connection:this,requestId:void 0},ca),this.connect()}url;ws;activeRequests=new Map;requestCounter=0;reconnectAttempts=0;_proxyCounter=0;onlineProxy=T.proxy(!1);streamCache=new Map;api;isOnline(){return this.onlineProxy.value}connect(){let t=this.ws=typeof this.url=="string"?new WebSocket(this.url):this.url();t.binaryType="arraybuffer",At>=1&&console.log(`[lowlander] Connecting to WebSocket at ${typeof this.url=="string"?this.url:"[custom WebSocket]"}`),t.onopen=()=>{if(t===this.ws){At>=1&&console.log("[lowlander] WebSocket connected"),this.onlineProxy.value=!0,this.reconnectAttempts=0;for(let r of this.activeRequests.values())r.resultProxy.busy=!0,this.ws.send(r.requestBuffer)}},t.onclose=()=>{t===this.ws&&(At>=1&&console.log("[lowlander] WebSocket disconnected"),this.reconnect())},t.onerror=r=>{t===this.ws&&(console.error("WebSocket error:",r),this.reconnect())},t.onmessage=r=>{if(t!==this.ws)return;let o=new re(new Uint8Array(r.data)),i=o.readPositiveInt(),n=this.activeRequests.get(i);if(!n)return;let s=T.unproxy(n.resultProxy),a=o.read();if(typeof a=="number"){let l=n.callbacks?.[a],c=[];for(;o.readAvailable();)c.push(o.read());l(...c);return}if(a===oe.model_data){n.database||=new Map,n.commitIds||=new Map;let l=o.readNumber(),c=o.readNumber(),u=o.read({model:function(y){let x=n.database.get(y);return x||console.error("Unknown linked model hash "+y),x}});At>=3&&console.log("[lowlander] incoming model_data",i,l,c,u),setTimeout(()=>this.pruneCommitIds(n,c),15e3);let h=n.commitIds.get(l);if(!u){if(h&&c<Math.max(...h.values()))return;n.database.delete(l),n.commitIds.set(l,new Map([[qo,c]]));return}let f=n.database.get(l);if(f){h||(h=new Map,n.commitIds.set(l,h));for(let y of Object.keys(u))c<(h.get(y)??h.get(qo)??-1)||(u[y]&&typeof u[y]=="object"?T.copy(f,y,u[y]):f[y]=u[y],h.set(y,c))}else{if(h&&c<(h.get(qo)??-1))return;let y=T.proxy(u);T.unproxy(y)[T.OPAQUE]=!1,n.database.set(l,y),n.commitIds.set(l,new Map([[qo,c]]))}return}if(a===oe.error){let l=o.readString();n.resultProxy.error=new Error(l),At>=2&&console.log(`[lowlander] incoming error requestId=${i} message=${l}`)}else if(a===oe.response||a===oe.response_proxy)n.resultProxy.value=o.read(),n.virtualSocketIds=o.read(),n.hasServerProxy=a===oe.response_proxy,At>=2&&console.log(`[lowlander] incoming response requestId=${i} value=${s.value} virtualSocketIds=${n.virtualSocketIds} hasServerProxy=${n.hasServerProxy}`);else if(a===oe.response_model||a===oe.response_proxy_model){n.virtualSocketIds=o.read();let l=o.readNumber(),c=o.read(),u=n.database?.get(l);n.hasServerProxy=a===oe.response_proxy_model,At>=2&&console.log(`[lowlander] incoming ${n.hasServerProxy?"response_proxy_model":"response_model"} requestId=${i} dbKey=${l} cacheMs=${c} obj=${u}`),u?n.resultProxy.value=T.proxy(u):n.resultProxy.error=new Error("Unknown database key "+l),c!==void 0&&n.cacheKey&&!this.streamCache.has(n.cacheKey)&&this.streamCache.set(n.cacheKey,{request:n,cacheKey:n.cacheKey,cacheMs:c,refCount:1})}else throw new Error("Unknown message type "+a);!n.hasServerProxy&&!n.virtualSocketIds?.length&&this.activeRequests.delete(i),n.hasServerProxy||delete n.resultProxy.serverProxy,n.resultProxy.busy=!1,n.resolve&&(s.error!=null?(console.error(s.error),n.reject(s.error)):n.resolve(s.value),delete n.resolve,delete n.reject)}}reconnect(){if(this.ws=void 0,this.onlineProxy.value=!1,typeof this.url!="string")return;let t=Math.min(500*Math.pow(2,this.reconnectAttempts),2e4);this.reconnectAttempts++,At>=1&&console.log(`[lowlander] Reconnecting in ${t}ms (attempt ${this.reconnectAttempts})`),setTimeout(this.connect.bind(this),t)}pruneCommitIds(t,r){if(t.commitIds)for(let[o,i]of t.commitIds){for(let[n,s]of i)s<=r&&i.delete(n);i.size||t.commitIds.delete(o)}}_createMethodStub(t,r){return(...o)=>{let n=o.some(f=>typeof f=="function")?void 0:(r??"")+":"+t+":"+JSON.stringify(o);if(n){let f=this.streamCache.get(n);if(f)return f.lingerTimeout&&(clearTimeout(f.lingerTimeout),f.lingerTimeout=void 0),f.refCount++,At>=2&&console.log(`[lowlander] reusing cached stream cacheKey=${n} refCount=${f.refCount}`),T.clean(()=>{f.refCount--,At>=2&&console.log(`[lowlander] clean cached consumer cacheKey=${n} refCount=${f.refCount}`),f.refCount<=0&&this.startLinger(f)}),f.request.resultProxy}let s={busy:!0},a=T.proxy(s),l=++this.requestCounter,c=new re;c.write(l).write(rn.call).write(r).write(t);let u;c.writeCollection("array",()=>{for(let f of o)typeof f=="function"?(u||=[],c.writeCustom("cb",u.length),u.push(f)):c.write(f)});let h={resultProxy:a,requestBuffer:c.toUint8Array(!0),requestId:l,connection:this,callbacks:u,cacheKey:n};return s.serverProxy=new Proxy(h,ca),s.promise=new Promise((f,y)=>{h.resolve=f,h.reject=y}),this.activeRequests.set(l,h),At>=2&&console.log(`[lowlander] outgoing call requestId=${l} method=${t} params=`,o),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(h.requestBuffer),T.clean(()=>{let f=n?this.streamCache.get(n):void 0;if(f&&f.request===h){f.refCount--,At>=2&&console.log(`[lowlander] clean stream owner cacheKey=${n} refCount=${f.refCount}`),f.refCount<=0&&this.startLinger(f);return}this.cancelRequest(h)}),a}}cancelRequest(t){if(this.activeRequests.delete(t.requestId),t.virtualSocketIds?.length||t.hasServerProxy){At>=2&&console.log(`[lowlander] outgoing cancel requestId=${t.requestId} virtualSocketIds=${t.virtualSocketIds} hasServerProxy=${t.hasServerProxy}`);let r=re.createUint8Array(++this.requestCounter,rn.cancel,t.requestId,t.virtualSocketIds);this.ws?.send(r)}}startLinger(t){t.lingerTimeout&&clearTimeout(t.lingerTimeout),At>=2&&console.log(`[lowlander] start linger cacheKey=${t.cacheKey} cacheMs=${t.cacheMs}`),t.lingerTimeout=setTimeout(()=>{t.refCount>0||(At>=2&&console.log(`[lowlander] linger expired cacheKey=${t.cacheKey}`),this.streamCache.delete(t.cacheKey),this.cancelRequest(t.request))},t.cacheMs)}},ca={get(e,t){if(typeof t=="symbol")return t===T.OPAQUE?!0:t===T.CUSTOM_DUMP?`<ServerProxy for #${e.requestId}>`:void 0;if(e.serverProxyCache?.has(t))return e.serverProxyCache.get(t);if(t==="then"||t==="catch"||t==="finally")return;if(t==="constructor")return{name:"ServerProxy-"+e.requestId};let r=e.connection._createMethodStub(t,e.requestId);return e.serverProxyCache||(e.serverProxyCache=new Map),e.serverProxyCache.set(t,r),r},has(e,t){return typeof t=="string"||t===T.NO_COPY}};function gt(e){return e<0?-1:e===0?0:1}function Me(e,t,r){return(1-r)*e+r*t}function ua(e,t,r){return r<e?e:r>t?t:r}function Xe(e,t,r){return r<e?e:r>t?t:r}function Go(e){return e=e%360,e<0&&(e=e+360),e}function _t(e){return e=e%360,e<0&&(e=e+360),e}function da(e,t){return _t(t-e)<=180?1:-1}function Ko(e,t){return 180-Math.abs(Math.abs(e-t)-180)}function _r(e,t){let r=e[0]*t[0][0]+e[1]*t[0][1]+e[2]*t[0][2],o=e[0]*t[1][0]+e[1]*t[1][1]+e[2]*t[1][2],i=e[0]*t[2][0]+e[1]*t[2][1]+e[2]*t[2][2];return[r,o,i]}var Hl=[[.41233895,.35762064,.18051042],[.2126,.7152,.0722],[.01932141,.11916382,.95034478]],jl=[[3.2413774792388685,-1.5376652402851851,-.49885366846268053],[-.9691452513005321,1.8758853451067872,.04156585616912061],[.05562093689691305,-.20395524564742123,1.0571799111220335]],Ul=[95.047,100,108.883];function Yo(e,t,r){return(255<<24|(e&255)<<16|(t&255)<<8|r&255)>>>0}function on(e){let t=De(e[0]),r=De(e[1]),o=De(e[2]);return Yo(t,r,o)}function Mr(e){return e>>16&255}function Ir(e){return e>>8&255}function Dr(e){return e&255}function ha(e,t,r){let o=jl,i=o[0][0]*e+o[0][1]*t+o[0][2]*r,n=o[1][0]*e+o[1][1]*t+o[1][2]*r,s=o[2][0]*e+o[2][1]*t+o[2][2]*r,a=De(i),l=De(n),c=De(s);return Yo(a,l,c)}function Vl(e){let t=Ie(Mr(e)),r=Ie(Ir(e)),o=Ie(Dr(e));return _r([t,r,o],Hl)}function ma(e){let t=jt(e),r=De(t);return Yo(r,r,r)}function Or(e){let t=Vl(e)[1];return 116*pa(t/100)-16}function jt(e){return 100*ql((e+16)/116)}function Lr(e){return pa(e/100)*116-16}function Ie(e){let t=e/255;return t<=.040449936?t/12.92*100:Math.pow((t+.055)/1.055,2.4)*100}function De(e){let t=e/100,r=0;return t<=.0031308?r=t*12.92:r=1.055*Math.pow(t,1/2.4)-.055,ua(0,255,Math.round(r*255))}function fa(){return Ul}function pa(e){let t=.008856451679035631,r=24389/27;return e>t?Math.pow(e,1/3):(r*e+16)/116}function ql(e){let t=.008856451679035631,r=24389/27,o=e*e*e;return o>t?o:(116*e-16)/r}var It=class e{static make(t=fa(),r=200/Math.PI*jt(50)/100,o=50,i=2,n=!1){let s=t,a=s[0]*.401288+s[1]*.650173+s[2]*-.051461,l=s[0]*-.250268+s[1]*1.204414+s[2]*.045854,c=s[0]*-.002079+s[1]*.048952+s[2]*.953127,u=.8+i/10,h=u>=.9?Me(.59,.69,(u-.9)*10):Me(.525,.59,(u-.8)*10),f=n?1:u*(1-1/3.6*Math.exp((-r-42)/92));f=f>1?1:f<0?0:f;let y=u,x=[f*(100/a)+1-f,f*(100/l)+1-f,f*(100/c)+1-f],P=1/(5*r+1),R=P*P*P*P,W=1-R,N=R*r+.1*W*W*Math.cbrt(5*r),S=jt(o)/t[1],at=1.48+Math.sqrt(S),M=.725/Math.pow(S,.2),X=M,$=[Math.pow(N*x[0]*a/100,.42),Math.pow(N*x[1]*l/100,.42),Math.pow(N*x[2]*c/100,.42)],rt=[400*$[0]/($[0]+27.13),400*$[1]/($[1]+27.13),400*$[2]/($[2]+27.13)],L=(2*rt[0]+rt[1]+.05*rt[2])*M;return new e(S,L,M,X,h,y,x,N,Math.pow(N,.25),at)}constructor(t,r,o,i,n,s,a,l,c,u){this.n=t,this.aw=r,this.nbb=o,this.ncb=i,this.c=n,this.nc=s,this.rgbD=a,this.fl=l,this.fLRoot=c,this.z=u}};It.DEFAULT=It.make();var Pt=class e{constructor(t,r,o,i,n,s,a,l,c){this.hue=t,this.chroma=r,this.j=o,this.q=i,this.m=n,this.s=s,this.jstar=a,this.astar=l,this.bstar=c}distance(t){let r=this.jstar-t.jstar,o=this.astar-t.astar,i=this.bstar-t.bstar,n=Math.sqrt(r*r+o*o+i*i);return 1.41*Math.pow(n,.63)}static fromInt(t){return e.fromIntInViewingConditions(t,It.DEFAULT)}static fromIntInViewingConditions(t,r){let o=(t&16711680)>>16,i=(t&65280)>>8,n=t&255,s=Ie(o),a=Ie(i),l=Ie(n),c=.41233895*s+.35762064*a+.18051042*l,u=.2126*s+.7152*a+.0722*l,h=.01932141*s+.11916382*a+.95034478*l,f=.401288*c+.650173*u-.051461*h,y=-.250268*c+1.204414*u+.045854*h,x=-.002079*c+.048952*u+.953127*h,P=r.rgbD[0]*f,R=r.rgbD[1]*y,W=r.rgbD[2]*x,N=Math.pow(r.fl*Math.abs(P)/100,.42),S=Math.pow(r.fl*Math.abs(R)/100,.42),at=Math.pow(r.fl*Math.abs(W)/100,.42),M=gt(P)*400*N/(N+27.13),X=gt(R)*400*S/(S+27.13),$=gt(W)*400*at/(at+27.13),rt=(11*M+-12*X+$)/11,L=(M+X-2*$)/9,B=(20*M+20*X+21*$)/20,Et=(40*M+20*X+$)/20,A=Math.atan2(L,rt)*180/Math.PI,it=A<0?A+360:A>=360?A-360:A,lt=it*Math.PI/180,nt=Et*r.nbb,Mt=100*Math.pow(nt/r.aw,r.c*r.z),Nr=4/r.c*Math.sqrt(Mt/100)*(r.aw+4)*r.fLRoot,Zo=it<20.14?it+360:it,ti=.25*(Math.cos(Zo*Math.PI/180+2)+3.8),ri=5e4/13*ti*r.nc*r.ncb*Math.sqrt(rt*rt+L*L)/(B+.305),zr=Math.pow(ri,.9)*Math.pow(1.64-Math.pow(.29,r.n),.73),ln=zr*Math.sqrt(Mt/100),cn=ln*r.fLRoot,Pa=50*Math.sqrt(zr*r.c/(r.aw+4)),ka=(1+100*.007)*Mt/(1+.007*Mt),un=1/.0228*Math.log(1+.0228*cn),Ea=un*Math.cos(lt),Sa=un*Math.sin(lt);return new e(it,ln,Mt,Nr,cn,Pa,ka,Ea,Sa)}static fromJch(t,r,o){return e.fromJchInViewingConditions(t,r,o,It.DEFAULT)}static fromJchInViewingConditions(t,r,o,i){let n=4/i.c*Math.sqrt(t/100)*(i.aw+4)*i.fLRoot,s=r*i.fLRoot,a=r/Math.sqrt(t/100),l=50*Math.sqrt(a*i.c/(i.aw+4)),c=o*Math.PI/180,u=(1+100*.007)*t/(1+.007*t),h=1/.0228*Math.log(1+.0228*s),f=h*Math.cos(c),y=h*Math.sin(c);return new e(o,r,t,n,s,l,u,f,y)}static fromUcs(t,r,o){return e.fromUcsInViewingConditions(t,r,o,It.DEFAULT)}static fromUcsInViewingConditions(t,r,o,i){let n=r,s=o,a=Math.sqrt(n*n+s*s),c=(Math.exp(a*.0228)-1)/.0228/i.fLRoot,u=Math.atan2(s,n)*(180/Math.PI);u<0&&(u+=360);let h=t/(1-(t-100)*.007);return e.fromJchInViewingConditions(h,c,u,i)}toInt(){return this.viewed(It.DEFAULT)}viewed(t){let r=this.chroma===0||this.j===0?0:this.chroma/Math.sqrt(this.j/100),o=Math.pow(r/Math.pow(1.64-Math.pow(.29,t.n),.73),1/.9),i=this.hue*Math.PI/180,n=.25*(Math.cos(i+2)+3.8),s=t.aw*Math.pow(this.j/100,1/t.c/t.z),a=n*(5e4/13)*t.nc*t.ncb,l=s/t.nbb,c=Math.sin(i),u=Math.cos(i),h=23*(l+.305)*o/(23*a+11*o*u+108*o*c),f=h*u,y=h*c,x=(460*l+451*f+288*y)/1403,P=(460*l-891*f-261*y)/1403,R=(460*l-220*f-6300*y)/1403,W=Math.max(0,27.13*Math.abs(x)/(400-Math.abs(x))),N=gt(x)*(100/t.fl)*Math.pow(W,1/.42),S=Math.max(0,27.13*Math.abs(P)/(400-Math.abs(P))),at=gt(P)*(100/t.fl)*Math.pow(S,1/.42),M=Math.max(0,27.13*Math.abs(R)/(400-Math.abs(R))),X=gt(R)*(100/t.fl)*Math.pow(M,1/.42),$=N/t.rgbD[0],rt=at/t.rgbD[1],L=X/t.rgbD[2],B=1.86206786*$-1.01125463*rt+.14918677*L,Et=.38752654*$+.62144744*rt-.00897398*L,ct=-.0158415*$-.03412294*rt+1.04996444*L;return ha(B,Et,ct)}static fromXyzInViewingConditions(t,r,o,i){let n=.401288*t+.650173*r-.051461*o,s=-.250268*t+1.204414*r+.045854*o,a=-.002079*t+.048952*r+.953127*o,l=i.rgbD[0]*n,c=i.rgbD[1]*s,u=i.rgbD[2]*a,h=Math.pow(i.fl*Math.abs(l)/100,.42),f=Math.pow(i.fl*Math.abs(c)/100,.42),y=Math.pow(i.fl*Math.abs(u)/100,.42),x=gt(l)*400*h/(h+27.13),P=gt(c)*400*f/(f+27.13),R=gt(u)*400*y/(y+27.13),W=(11*x+-12*P+R)/11,N=(x+P-2*R)/9,S=(20*x+20*P+21*R)/20,at=(40*x+20*P+R)/20,X=Math.atan2(N,W)*180/Math.PI,$=X<0?X+360:X>=360?X-360:X,rt=$*Math.PI/180,L=at*i.nbb,B=100*Math.pow(L/i.aw,i.c*i.z),Et=4/i.c*Math.sqrt(B/100)*(i.aw+4)*i.fLRoot,ct=$<20.14?$+360:$,A=1/4*(Math.cos(ct*Math.PI/180+2)+3.8),lt=5e4/13*A*i.nc*i.ncb*Math.sqrt(W*W+N*N)/(S+.305),nt=Math.pow(lt,.9)*Math.pow(1.64-Math.pow(.29,i.n),.73),Mt=nt*Math.sqrt(B/100),Nr=Mt*i.fLRoot,Zo=50*Math.sqrt(nt*i.c/(i.aw+4)),ti=(1+100*.007)*B/(1+.007*B),ei=Math.log(1+.0228*Nr)/.0228,ri=ei*Math.cos(rt),zr=ei*Math.sin(rt);return new e($,Mt,B,Et,Nr,Zo,ti,ri,zr)}xyzInViewingConditions(t){let r=this.chroma===0||this.j===0?0:this.chroma/Math.sqrt(this.j/100),o=Math.pow(r/Math.pow(1.64-Math.pow(.29,t.n),.73),1/.9),i=this.hue*Math.PI/180,n=.25*(Math.cos(i+2)+3.8),s=t.aw*Math.pow(this.j/100,1/t.c/t.z),a=n*(5e4/13)*t.nc*t.ncb,l=s/t.nbb,c=Math.sin(i),u=Math.cos(i),h=23*(l+.305)*o/(23*a+11*o*u+108*o*c),f=h*u,y=h*c,x=(460*l+451*f+288*y)/1403,P=(460*l-891*f-261*y)/1403,R=(460*l-220*f-6300*y)/1403,W=Math.max(0,27.13*Math.abs(x)/(400-Math.abs(x))),N=gt(x)*(100/t.fl)*Math.pow(W,1/.42),S=Math.max(0,27.13*Math.abs(P)/(400-Math.abs(P))),at=gt(P)*(100/t.fl)*Math.pow(S,1/.42),M=Math.max(0,27.13*Math.abs(R)/(400-Math.abs(R))),X=gt(R)*(100/t.fl)*Math.pow(M,1/.42),$=N/t.rgbD[0],rt=at/t.rgbD[1],L=X/t.rgbD[2],B=1.86206786*$-1.01125463*rt+.14918677*L,Et=.38752654*$+.62144744*rt-.00897398*L,ct=-.0158415*$-.03412294*rt+1.04996444*L;return[B,Et,ct]}};var Vt=class e{static sanitizeRadians(t){return(t+Math.PI*8)%(Math.PI*2)}static trueDelinearized(t){let r=t/100,o=0;return r<=.0031308?o=r*12.92:o=1.055*Math.pow(r,1/2.4)-.055,o*255}static chromaticAdaptation(t){let r=Math.pow(Math.abs(t),.42);return gt(t)*400*r/(r+27.13)}static hueOf(t){let r=_r(t,e.SCALED_DISCOUNT_FROM_LINRGB),o=e.chromaticAdaptation(r[0]),i=e.chromaticAdaptation(r[1]),n=e.chromaticAdaptation(r[2]),s=(11*o+-12*i+n)/11,a=(o+i-2*n)/9;return Math.atan2(a,s)}static areInCyclicOrder(t,r,o){let i=e.sanitizeRadians(r-t),n=e.sanitizeRadians(o-t);return i<n}static intercept(t,r,o){return(r-t)/(o-t)}static lerpPoint(t,r,o){return[t[0]+(o[0]-t[0])*r,t[1]+(o[1]-t[1])*r,t[2]+(o[2]-t[2])*r]}static setCoordinate(t,r,o,i){let n=e.intercept(t[i],r,o[i]);return e.lerpPoint(t,n,o)}static isBounded(t){return 0<=t&&t<=100}static nthVertex(t,r){let o=e.Y_FROM_LINRGB[0],i=e.Y_FROM_LINRGB[1],n=e.Y_FROM_LINRGB[2],s=r%4<=1?0:100,a=r%2===0?0:100;if(r<4){let l=s,c=a,u=(t-l*i-c*n)/o;return e.isBounded(u)?[u,l,c]:[-1,-1,-1]}else if(r<8){let l=s,c=a,u=(t-c*o-l*n)/i;return e.isBounded(u)?[c,u,l]:[-1,-1,-1]}else{let l=s,c=a,u=(t-l*o-c*i)/n;return e.isBounded(u)?[l,c,u]:[-1,-1,-1]}}static bisectToSegment(t,r){let o=[-1,-1,-1],i=o,n=0,s=0,a=!1,l=!0;for(let c=0;c<12;c++){let u=e.nthVertex(t,c);if(u[0]<0)continue;let h=e.hueOf(u);if(!a){o=u,i=u,n=h,s=h,a=!0;continue}(l||e.areInCyclicOrder(n,h,s))&&(l=!1,e.areInCyclicOrder(n,r,h)?(i=u,s=h):(o=u,n=h))}return[o,i]}static midpoint(t,r){return[(t[0]+r[0])/2,(t[1]+r[1])/2,(t[2]+r[2])/2]}static criticalPlaneBelow(t){return Math.floor(t-.5)}static criticalPlaneAbove(t){return Math.ceil(t-.5)}static bisectToLimit(t,r){let o=e.bisectToSegment(t,r),i=o[0],n=e.hueOf(i),s=o[1];for(let a=0;a<3;a++)if(i[a]!==s[a]){let l=-1,c=255;i[a]<s[a]?(l=e.criticalPlaneBelow(e.trueDelinearized(i[a])),c=e.criticalPlaneAbove(e.trueDelinearized(s[a]))):(l=e.criticalPlaneAbove(e.trueDelinearized(i[a])),c=e.criticalPlaneBelow(e.trueDelinearized(s[a])));for(let u=0;u<8&&!(Math.abs(c-l)<=1);u++){let h=Math.floor((l+c)/2),f=e.CRITICAL_PLANES[h],y=e.setCoordinate(i,f,s,a),x=e.hueOf(y);e.areInCyclicOrder(n,r,x)?(s=y,c=h):(i=y,n=x,l=h)}}return e.midpoint(i,s)}static inverseChromaticAdaptation(t){let r=Math.abs(t),o=Math.max(0,27.13*r/(400-r));return gt(t)*Math.pow(o,1/.42)}static findResultByJ(t,r,o){let i=Math.sqrt(o)*11,n=It.DEFAULT,s=1/Math.pow(1.64-Math.pow(.29,n.n),.73),l=.25*(Math.cos(t+2)+3.8)*(5e4/13)*n.nc*n.ncb,c=Math.sin(t),u=Math.cos(t);for(let h=0;h<5;h++){let f=i/100,y=r===0||i===0?0:r/Math.sqrt(f),x=Math.pow(y*s,1/.9),R=n.aw*Math.pow(f,1/n.c/n.z)/n.nbb,W=23*(R+.305)*x/(23*l+11*x*u+108*x*c),N=W*u,S=W*c,at=(460*R+451*N+288*S)/1403,M=(460*R-891*N-261*S)/1403,X=(460*R-220*N-6300*S)/1403,$=e.inverseChromaticAdaptation(at),rt=e.inverseChromaticAdaptation(M),L=e.inverseChromaticAdaptation(X),B=_r([$,rt,L],e.LINRGB_FROM_SCALED_DISCOUNT);if(B[0]<0||B[1]<0||B[2]<0)return 0;let Et=e.Y_FROM_LINRGB[0],ct=e.Y_FROM_LINRGB[1],A=e.Y_FROM_LINRGB[2],it=Et*B[0]+ct*B[1]+A*B[2];if(it<=0)return 0;if(h===4||Math.abs(it-o)<.002)return B[0]>100.01||B[1]>100.01||B[2]>100.01?0:on(B);i=i-(it-o)*i/(2*it)}return 0}static solveToInt(t,r,o){if(r<1e-4||o<1e-4||o>99.9999)return ma(o);t=_t(t);let i=t/180*Math.PI,n=jt(o),s=e.findResultByJ(i,r,n);if(s!==0)return s;let a=e.bisectToLimit(n,i);return on(a)}static solveToCam(t,r,o){return Pt.fromInt(e.solveToInt(t,r,o))}};Vt.SCALED_DISCOUNT_FROM_LINRGB=[[.001200833568784504,.002389694492170889,.0002795742885861124],[.0005891086651375999,.0029785502573438758,.0003270666104008398],[.00010146692491640572,.0005364214359186694,.0032979401770712076]];Vt.LINRGB_FROM_SCALED_DISCOUNT=[[1373.2198709594231,-1100.4251190754821,-7.278681089101213],[-271.815969077903,559.6580465940733,-32.46047482791194],[1.9622899599665666,-57.173814538844006,308.7233197812385]];Vt.Y_FROM_LINRGB=[.2126,.7152,.0722];Vt.CRITICAL_PLANES=[.015176349177441876,.045529047532325624,.07588174588720938,.10623444424209313,.13658714259697685,.16693984095186062,.19729253930674434,.2276452376616281,.2579979360165119,.28835063437139563,.3188300904430532,.350925934958123,.3848314933096426,.42057480301049466,.458183274052838,.4976837250274023,.5391024159806381,.5824650784040898,.6277969426914107,.6751227633498623,.7244668422128921,.775853049866786,.829304845476233,.8848452951698498,.942497089126609,1.0022825574869039,1.0642236851973577,1.1283421258858297,1.1946592148522128,1.2631959812511864,1.3339731595349034,1.407011200216447,1.4823302800086415,1.5599503113873272,1.6398909516233677,1.7221716113234105,1.8068114625156377,1.8938294463134073,1.9832442801866852,2.075074464868551,2.1693382909216234,2.2660538449872063,2.36523901573795,2.4669114995532007,2.5710888059345764,2.6777882626779785,2.7870270208169257,2.898822059350997,3.0131901897720907,3.1301480604002863,3.2497121605402226,3.3718988244681087,3.4967242352587946,3.624204428461639,3.754355295633311,3.887192587735158,4.022731918402185,4.160988767090289,4.301978482107941,4.445716283538092,4.592217266055746,4.741496401646282,4.893568542229298,5.048448422192488,5.20615066083972,5.3666897647573375,5.5300801301023865,5.696336044816294,5.865471690767354,6.037501145825082,6.212438385869475,6.390297286737924,6.571091626112461,6.7548350853498045,6.941541251256611,7.131223617812143,7.323895587840543,7.5195704746346665,7.7182615035334345,7.919981813454504,8.124744458384042,8.332562408825165,8.543448553206703,8.757415699253682,8.974476575321063,9.194643831691977,9.417930041841839,9.644347703669503,9.873909240696694,10.106627003236781,10.342513269534024,10.58158024687427,10.8238400726681,11.069304815507364,11.317986476196008,11.569896988756009,11.825048221409341,12.083451977536606,12.345119996613247,12.610063955123938,12.878295467455942,13.149826086772048,13.42466730586372,13.702830557985108,13.984327217668513,14.269168601521828,14.55736596900856,14.848930523210871,15.143873411576273,15.44220572664832,15.743938506781891,16.04908273684337,16.35764934889634,16.66964922287304,16.985093187232053,17.30399201960269,17.62635644741625,17.95219714852476,18.281524751807332,18.614349837764564,18.95068293910138,19.290534541298456,19.633915083172692,19.98083495742689,20.331304511189067,20.685334046541502,21.042933821039977,21.404114048223256,21.76888489811322,22.137256497705877,22.50923893145328,22.884842241736916,23.264076429332462,23.6469514538663,24.033477234264016,24.42366364919083,24.817520537484558,25.21505769858089,25.61628489293138,26.021211842414342,26.429848230738664,26.842203703840827,27.258287870275353,27.678110301598522,28.10168053274597,28.529008062403893,28.96010235337422,29.39497283293396,29.83362889318845,30.276079891419332,30.722335150426627,31.172403958865512,31.62629557157785,32.08401920991837,32.54558406207592,33.010999283389665,33.4802739966603,33.953417292456834,34.430438229418264,34.911345834551085,35.39614910352207,35.88485700094671,36.37747846067349,36.87402238606382,37.37449765026789,37.87891309649659,38.38727753828926,38.89959975977785,39.41588851594697,39.93615253289054,40.460400508064545,40.98864111053629,41.520882981230194,42.05713473317016,42.597404951718396,43.141702194811224,43.6900349931913,44.24241185063697,44.798841244188324,45.35933162437017,45.92389141541209,46.49252901546552,47.065252796817916,47.64207110610409,48.22299226451468,48.808024568002054,49.3971762874833,49.9904556690408,50.587870934119984,51.189430279724725,51.79514187861014,52.40501387947288,53.0190544071392,53.637271562750364,54.259673423945976,54.88626804504493,55.517063457223934,56.15206766869424,56.79128866487574,57.43473440856916,58.08241284012621,58.734331877617365,59.39049941699807,60.05092333227251,60.715611475655585,61.38457167773311,62.057811747619894,62.7353394731159,63.417162620860914,64.10328893648692,64.79372614476921,65.48848194977529,66.18756403501224,66.89098006357258,67.59873767827808,68.31084450182222,69.02730813691093,69.74813616640164,70.47333615344107,71.20291564160104,71.93688215501312,72.67524319850172,73.41800625771542,74.16517879925733,74.9167682708136,75.67278210128072,76.43322770089146,77.1981124613393,77.96744375590167,78.74122893956174,79.51947534912904,80.30219030335869,81.08938110306934,81.88105503125999,82.67721935322541,83.4778813166706,84.28304815182372,85.09272707154808,85.90692527145302,86.72564993000343,87.54890820862819,88.3767072518277,89.2090541872801,90.04595612594655,90.88742016217518,91.73345337380438,92.58406282226491,93.43925555268066,94.29903859396902,95.16341895893969,96.03240364439274,96.9059996312159,97.78421388448044,98.6670533535366,99.55452497210776];var V=class e{static from(t,r,o){return new e(Vt.solveToInt(t,r,o))}static fromInt(t){return new e(t)}toInt(){return this.argb}get hue(){return this.internalHue}set hue(t){this.setInternalState(Vt.solveToInt(t,this.internalChroma,this.internalTone))}get chroma(){return this.internalChroma}set chroma(t){this.setInternalState(Vt.solveToInt(this.internalHue,t,this.internalTone))}get tone(){return this.internalTone}set tone(t){this.setInternalState(Vt.solveToInt(this.internalHue,this.internalChroma,t))}constructor(t){this.argb=t;let r=Pt.fromInt(t);this.internalHue=r.hue,this.internalChroma=r.chroma,this.internalTone=Or(t),this.argb=t}setInternalState(t){let r=Pt.fromInt(t);this.internalHue=r.hue,this.internalChroma=r.chroma,this.internalTone=Or(t),this.argb=t}inViewingConditions(t){let o=Pt.fromInt(this.toInt()).xyzInViewingConditions(t),i=Pt.fromXyzInViewingConditions(o[0],o[1],o[2],It.make());return e.from(i.hue,i.chroma,Lr(o[1]))}};var Xo=class e{static harmonize(t,r){let o=V.fromInt(t),i=V.fromInt(r),n=Ko(o.hue,i.hue),s=Math.min(n*.5,15),a=_t(o.hue+s*da(o.hue,i.hue));return V.from(a,o.chroma,o.tone).toInt()}static hctHue(t,r,o){let i=e.cam16Ucs(t,r,o),n=Pt.fromInt(i),s=Pt.fromInt(t);return V.from(n.hue,s.chroma,Or(t)).toInt()}static cam16Ucs(t,r,o){let i=Pt.fromInt(t),n=Pt.fromInt(r),s=i.jstar,a=i.astar,l=i.bstar,c=n.jstar,u=n.astar,h=n.bstar,f=s+(c-s)*o,y=a+(u-a)*o,x=l+(h-l)*o;return Pt.fromUcs(f,y,x).toInt()}};var kt=class e{static ratioOfTones(t,r){return t=Xe(0,100,t),r=Xe(0,100,r),e.ratioOfYs(jt(t),jt(r))}static ratioOfYs(t,r){let o=t>r?t:r,i=o===r?t:r;return(o+5)/(i+5)}static lighter(t,r){if(t<0||t>100)return-1;let o=jt(t),i=r*(o+5)-5,n=e.ratioOfYs(i,o),s=Math.abs(n-r);if(n<r&&s>.04)return-1;let a=Lr(i)+.4;return a<0||a>100?-1:a}static darker(t,r){if(t<0||t>100)return-1;let o=jt(t),i=(o+5)/r-5,n=e.ratioOfYs(o,i),s=Math.abs(n-r);if(n<r&&s>.04)return-1;let a=Lr(i)-.4;return a<0||a>100?-1:a}static lighterUnsafe(t,r){let o=e.lighter(t,r);return o<0?100:o}static darkerUnsafe(t,r){let o=e.darker(t,r);return o<0?0:o}};var Je=class e{static isDisliked(t){let r=Math.round(t.hue)>=90&&Math.round(t.hue)<=111,o=Math.round(t.chroma)>16,i=Math.round(t.tone)<65;return r&&o&&i}static fixIfDisliked(t){return e.isDisliked(t)?V.from(t.hue,t.chroma,70):t}};var v=class e{static fromPalette(t){return new e(t.name??"",t.palette,t.tone,t.isBackground??!1,t.background,t.secondBackground,t.contrastCurve,t.toneDeltaPair)}constructor(t,r,o,i,n,s,a,l){if(this.name=t,this.palette=r,this.tone=o,this.isBackground=i,this.background=n,this.secondBackground=s,this.contrastCurve=a,this.toneDeltaPair=l,this.hctCache=new Map,!n&&s)throw new Error(`Color ${t} has secondBackgrounddefined, but background is not defined.`);if(!n&&a)throw new Error(`Color ${t} has contrastCurvedefined, but background is not defined.`);if(n&&!a)throw new Error(`Color ${t} has backgrounddefined, but contrastCurve is not defined.`)}getArgb(t){return this.getHct(t).toInt()}getHct(t){let r=this.hctCache.get(t);if(r!=null)return r;let o=this.getTone(t),i=this.palette(t).getHct(o);return this.hctCache.size>4&&this.hctCache.clear(),this.hctCache.set(t,i),i}getTone(t){let r=t.contrastLevel<0;if(this.toneDeltaPair){let o=this.toneDeltaPair(t),i=o.roleA,n=o.roleB,s=o.delta,a=o.polarity,l=o.stayTogether,u=this.background(t).getTone(t),h=a==="nearer"||a==="lighter"&&!t.isDark||a==="darker"&&t.isDark,f=h?i:n,y=h?n:i,x=this.name===f.name,P=t.isDark?1:-1,R=f.contrastCurve.get(t.contrastLevel),W=y.contrastCurve.get(t.contrastLevel),N=f.tone(t),S=kt.ratioOfTones(u,N)>=R?N:e.foregroundTone(u,R),at=y.tone(t),M=kt.ratioOfTones(u,at)>=W?at:e.foregroundTone(u,W);return r&&(S=e.foregroundTone(u,R),M=e.foregroundTone(u,W)),(M-S)*P>=s||(M=Xe(0,100,S+s*P),(M-S)*P>=s||(S=Xe(0,100,M-s*P))),50<=S&&S<60?P>0?(S=60,M=Math.max(M,S+s*P)):(S=49,M=Math.min(M,S+s*P)):50<=M&&M<60&&(l?P>0?(S=60,M=Math.max(M,S+s*P)):(S=49,M=Math.min(M,S+s*P)):P>0?M=60:M=49),x?S:M}else{let o=this.tone(t);if(this.background==null)return o;let i=this.background(t).getTone(t),n=this.contrastCurve.get(t.contrastLevel);if(kt.ratioOfTones(i,o)>=n||(o=e.foregroundTone(i,n)),r&&(o=e.foregroundTone(i,n)),this.isBackground&&50<=o&&o<60&&(kt.ratioOfTones(49,i)>=n?o=49:o=60),this.secondBackground){let[s,a]=[this.background,this.secondBackground],[l,c]=[s(t).getTone(t),a(t).getTone(t)],[u,h]=[Math.max(l,c),Math.min(l,c)];if(kt.ratioOfTones(u,o)>=n&&kt.ratioOfTones(h,o)>=n)return o;let f=kt.lighter(u,n),y=kt.darker(h,n),x=[];return f!==-1&&x.push(f),y!==-1&&x.push(y),e.tonePrefersLightForeground(l)||e.tonePrefersLightForeground(c)?f<0?100:f:x.length===1?x[0]:y<0?0:y}return o}}static foregroundTone(t,r){let o=kt.lighterUnsafe(t,r),i=kt.darkerUnsafe(t,r),n=kt.ratioOfTones(o,t),s=kt.ratioOfTones(i,t);if(e.tonePrefersLightForeground(t)){let l=Math.abs(n-s)<.1&&n<r&&s<r;return n>=r||n>=s||l?o:i}else return s>=r||s>=n?i:o}static tonePrefersLightForeground(t){return Math.round(t)<60}static toneAllowsLightForeground(t){return Math.round(t)<=49}static enableLightForeground(t){return e.tonePrefersLightForeground(t)&&!e.toneAllowsLightForeground(t)?49:t}};var D=class e{static fromInt(t){let r=V.fromInt(t);return e.fromHct(r)}static fromHct(t){return new e(t.hue,t.chroma,t)}static fromHueAndChroma(t,r){let o=new nn(t,r).create();return new e(t,r,o)}constructor(t,r,o){this.hue=t,this.chroma=r,this.keyColor=o,this.cache=new Map}tone(t){let r=this.cache.get(t);return r===void 0&&(r=V.from(this.hue,this.chroma,t).toInt(),this.cache.set(t,r)),r}getHct(t){return V.fromInt(this.tone(t))}},nn=class{constructor(t,r){this.hue=t,this.requestedChroma=r,this.chromaCache=new Map,this.maxChromaValue=200}create(){let i=0,n=100;for(;i<n;){let s=Math.floor((i+n)/2),a=this.maxChroma(s)<this.maxChroma(s+1);if(this.maxChroma(s)>=this.requestedChroma-.01)if(Math.abs(i-50)<Math.abs(n-50))n=s;else{if(i===s)return V.from(this.hue,this.requestedChroma,i);i=s}else a?i=s+1:n=s}return V.from(this.hue,this.requestedChroma,i)}maxChroma(t){if(this.chromaCache.has(t))return this.chromaCache.get(t);let r=V.from(this.hue,this.maxChromaValue,t).chroma;return this.chromaCache.set(t,r),r}};var C=class{constructor(t,r,o,i){this.low=t,this.normal=r,this.medium=o,this.high=i}get(t){return t<=-1?this.low:t<0?Me(this.low,this.normal,(t- -1)/1):t<.5?Me(this.normal,this.medium,(t-0)/.5):t<1?Me(this.medium,this.high,(t-.5)/.5):this.high}};var dt=class{constructor(t,r,o,i,n){this.roleA=t,this.roleB=r,this.delta=o,this.polarity=i,this.stayTogether=n}};var ht;(function(e){e[e.MONOCHROME=0]="MONOCHROME",e[e.NEUTRAL=1]="NEUTRAL",e[e.TONAL_SPOT=2]="TONAL_SPOT",e[e.VIBRANT=3]="VIBRANT",e[e.EXPRESSIVE=4]="EXPRESSIVE",e[e.FIDELITY=5]="FIDELITY",e[e.CONTENT=6]="CONTENT",e[e.RAINBOW=7]="RAINBOW",e[e.FRUIT_SALAD=8]="FRUIT_SALAD"})(ht||(ht={}));function Qe(e){return e.variant===ht.FIDELITY||e.variant===ht.CONTENT}function tt(e){return e.variant===ht.MONOCHROME}function Wl(e,t,r,o){let i=r,n=V.from(e,t,r);if(n.chroma<t){let s=n.chroma;for(;n.chroma<t;){i+=o?-1:1;let a=V.from(e,t,i);if(s>a.chroma||Math.abs(a.chroma-t)<.4)break;let l=Math.abs(a.chroma-t),c=Math.abs(n.chroma-t);l<c&&(n=a),s=Math.max(s,a.chroma)}}return i}var d=class e{static highestSurface(t){return t.isDark?e.surfaceBright:e.surfaceDim}};d.contentAccentToneDelta=15;d.primaryPaletteKeyColor=v.fromPalette({name:"primary_palette_key_color",palette:e=>e.primaryPalette,tone:e=>e.primaryPalette.keyColor.tone});d.secondaryPaletteKeyColor=v.fromPalette({name:"secondary_palette_key_color",palette:e=>e.secondaryPalette,tone:e=>e.secondaryPalette.keyColor.tone});d.tertiaryPaletteKeyColor=v.fromPalette({name:"tertiary_palette_key_color",palette:e=>e.tertiaryPalette,tone:e=>e.tertiaryPalette.keyColor.tone});d.neutralPaletteKeyColor=v.fromPalette({name:"neutral_palette_key_color",palette:e=>e.neutralPalette,tone:e=>e.neutralPalette.keyColor.tone});d.neutralVariantPaletteKeyColor=v.fromPalette({name:"neutral_variant_palette_key_color",palette:e=>e.neutralVariantPalette,tone:e=>e.neutralVariantPalette.keyColor.tone});d.background=v.fromPalette({name:"background",palette:e=>e.neutralPalette,tone:e=>e.isDark?6:98,isBackground:!0});d.onBackground=v.fromPalette({name:"on_background",palette:e=>e.neutralPalette,tone:e=>e.isDark?90:10,background:e=>d.background,contrastCurve:new C(3,3,4.5,7)});d.surface=v.fromPalette({name:"surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?6:98,isBackground:!0});d.surfaceDim=v.fromPalette({name:"surface_dim",palette:e=>e.neutralPalette,tone:e=>e.isDark?6:new C(87,87,80,75).get(e.contrastLevel),isBackground:!0});d.surfaceBright=v.fromPalette({name:"surface_bright",palette:e=>e.neutralPalette,tone:e=>e.isDark?new C(24,24,29,34).get(e.contrastLevel):98,isBackground:!0});d.surfaceContainerLowest=v.fromPalette({name:"surface_container_lowest",palette:e=>e.neutralPalette,tone:e=>e.isDark?new C(4,4,2,0).get(e.contrastLevel):100,isBackground:!0});d.surfaceContainerLow=v.fromPalette({name:"surface_container_low",palette:e=>e.neutralPalette,tone:e=>e.isDark?new C(10,10,11,12).get(e.contrastLevel):new C(96,96,96,95).get(e.contrastLevel),isBackground:!0});d.surfaceContainer=v.fromPalette({name:"surface_container",palette:e=>e.neutralPalette,tone:e=>e.isDark?new C(12,12,16,20).get(e.contrastLevel):new C(94,94,92,90).get(e.contrastLevel),isBackground:!0});d.surfaceContainerHigh=v.fromPalette({name:"surface_container_high",palette:e=>e.neutralPalette,tone:e=>e.isDark?new C(17,17,21,25).get(e.contrastLevel):new C(92,92,88,85).get(e.contrastLevel),isBackground:!0});d.surfaceContainerHighest=v.fromPalette({name:"surface_container_highest",palette:e=>e.neutralPalette,tone:e=>e.isDark?new C(22,22,26,30).get(e.contrastLevel):new C(90,90,84,80).get(e.contrastLevel),isBackground:!0});d.onSurface=v.fromPalette({name:"on_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?90:10,background:e=>d.highestSurface(e),contrastCurve:new C(4.5,7,11,21)});d.surfaceVariant=v.fromPalette({name:"surface_variant",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?30:90,isBackground:!0});d.onSurfaceVariant=v.fromPalette({name:"on_surface_variant",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?80:30,background:e=>d.highestSurface(e),contrastCurve:new C(3,4.5,7,11)});d.inverseSurface=v.fromPalette({name:"inverse_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?90:20});d.inverseOnSurface=v.fromPalette({name:"inverse_on_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?20:95,background:e=>d.inverseSurface,contrastCurve:new C(4.5,7,11,21)});d.outline=v.fromPalette({name:"outline",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?60:50,background:e=>d.highestSurface(e),contrastCurve:new C(1.5,3,4.5,7)});d.outlineVariant=v.fromPalette({name:"outline_variant",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?30:80,background:e=>d.highestSurface(e),contrastCurve:new C(1,1,3,4.5)});d.shadow=v.fromPalette({name:"shadow",palette:e=>e.neutralPalette,tone:e=>0});d.scrim=v.fromPalette({name:"scrim",palette:e=>e.neutralPalette,tone:e=>0});d.surfaceTint=v.fromPalette({name:"surface_tint",palette:e=>e.primaryPalette,tone:e=>e.isDark?80:40,isBackground:!0});d.primary=v.fromPalette({name:"primary",palette:e=>e.primaryPalette,tone:e=>tt(e)?e.isDark?100:0:e.isDark?80:40,isBackground:!0,background:e=>d.highestSurface(e),contrastCurve:new C(3,4.5,7,7),toneDeltaPair:e=>new dt(d.primaryContainer,d.primary,10,"nearer",!1)});d.onPrimary=v.fromPalette({name:"on_primary",palette:e=>e.primaryPalette,tone:e=>tt(e)?e.isDark?10:90:e.isDark?20:100,background:e=>d.primary,contrastCurve:new C(4.5,7,11,21)});d.primaryContainer=v.fromPalette({name:"primary_container",palette:e=>e.primaryPalette,tone:e=>Qe(e)?e.sourceColorHct.tone:tt(e)?e.isDark?85:25:e.isDark?30:90,isBackground:!0,background:e=>d.highestSurface(e),contrastCurve:new C(1,1,3,4.5),toneDeltaPair:e=>new dt(d.primaryContainer,d.primary,10,"nearer",!1)});d.onPrimaryContainer=v.fromPalette({name:"on_primary_container",palette:e=>e.primaryPalette,tone:e=>Qe(e)?v.foregroundTone(d.primaryContainer.tone(e),4.5):tt(e)?e.isDark?0:100:e.isDark?90:30,background:e=>d.primaryContainer,contrastCurve:new C(3,4.5,7,11)});d.inversePrimary=v.fromPalette({name:"inverse_primary",palette:e=>e.primaryPalette,tone:e=>e.isDark?40:80,background:e=>d.inverseSurface,contrastCurve:new C(3,4.5,7,7)});d.secondary=v.fromPalette({name:"secondary",palette:e=>e.secondaryPalette,tone:e=>e.isDark?80:40,isBackground:!0,background:e=>d.highestSurface(e),contrastCurve:new C(3,4.5,7,7),toneDeltaPair:e=>new dt(d.secondaryContainer,d.secondary,10,"nearer",!1)});d.onSecondary=v.fromPalette({name:"on_secondary",palette:e=>e.secondaryPalette,tone:e=>tt(e)?e.isDark?10:100:e.isDark?20:100,background:e=>d.secondary,contrastCurve:new C(4.5,7,11,21)});d.secondaryContainer=v.fromPalette({name:"secondary_container",palette:e=>e.secondaryPalette,tone:e=>{let t=e.isDark?30:90;return tt(e)?e.isDark?30:85:Qe(e)?Wl(e.secondaryPalette.hue,e.secondaryPalette.chroma,t,!e.isDark):t},isBackground:!0,background:e=>d.highestSurface(e),contrastCurve:new C(1,1,3,4.5),toneDeltaPair:e=>new dt(d.secondaryContainer,d.secondary,10,"nearer",!1)});d.onSecondaryContainer=v.fromPalette({name:"on_secondary_container",palette:e=>e.secondaryPalette,tone:e=>tt(e)?e.isDark?90:10:Qe(e)?v.foregroundTone(d.secondaryContainer.tone(e),4.5):e.isDark?90:30,background:e=>d.secondaryContainer,contrastCurve:new C(3,4.5,7,11)});d.tertiary=v.fromPalette({name:"tertiary",palette:e=>e.tertiaryPalette,tone:e=>tt(e)?e.isDark?90:25:e.isDark?80:40,isBackground:!0,background:e=>d.highestSurface(e),contrastCurve:new C(3,4.5,7,7),toneDeltaPair:e=>new dt(d.tertiaryContainer,d.tertiary,10,"nearer",!1)});d.onTertiary=v.fromPalette({name:"on_tertiary",palette:e=>e.tertiaryPalette,tone:e=>tt(e)?e.isDark?10:90:e.isDark?20:100,background:e=>d.tertiary,contrastCurve:new C(4.5,7,11,21)});d.tertiaryContainer=v.fromPalette({name:"tertiary_container",palette:e=>e.tertiaryPalette,tone:e=>{if(tt(e))return e.isDark?60:49;if(!Qe(e))return e.isDark?30:90;let t=e.tertiaryPalette.getHct(e.sourceColorHct.tone);return Je.fixIfDisliked(t).tone},isBackground:!0,background:e=>d.highestSurface(e),contrastCurve:new C(1,1,3,4.5),toneDeltaPair:e=>new dt(d.tertiaryContainer,d.tertiary,10,"nearer",!1)});d.onTertiaryContainer=v.fromPalette({name:"on_tertiary_container",palette:e=>e.tertiaryPalette,tone:e=>tt(e)?e.isDark?0:100:Qe(e)?v.foregroundTone(d.tertiaryContainer.tone(e),4.5):e.isDark?90:30,background:e=>d.tertiaryContainer,contrastCurve:new C(3,4.5,7,11)});d.error=v.fromPalette({name:"error",palette:e=>e.errorPalette,tone:e=>e.isDark?80:40,isBackground:!0,background:e=>d.highestSurface(e),contrastCurve:new C(3,4.5,7,7),toneDeltaPair:e=>new dt(d.errorContainer,d.error,10,"nearer",!1)});d.onError=v.fromPalette({name:"on_error",palette:e=>e.errorPalette,tone:e=>e.isDark?20:100,background:e=>d.error,contrastCurve:new C(4.5,7,11,21)});d.errorContainer=v.fromPalette({name:"error_container",palette:e=>e.errorPalette,tone:e=>e.isDark?30:90,isBackground:!0,background:e=>d.highestSurface(e),contrastCurve:new C(1,1,3,4.5),toneDeltaPair:e=>new dt(d.errorContainer,d.error,10,"nearer",!1)});d.onErrorContainer=v.fromPalette({name:"on_error_container",palette:e=>e.errorPalette,tone:e=>tt(e)?e.isDark?90:10:e.isDark?90:30,background:e=>d.errorContainer,contrastCurve:new C(3,4.5,7,11)});d.primaryFixed=v.fromPalette({name:"primary_fixed",palette:e=>e.primaryPalette,tone:e=>tt(e)?40:90,isBackground:!0,background:e=>d.highestSurface(e),contrastCurve:new C(1,1,3,4.5),toneDeltaPair:e=>new dt(d.primaryFixed,d.primaryFixedDim,10,"lighter",!0)});d.primaryFixedDim=v.fromPalette({name:"primary_fixed_dim",palette:e=>e.primaryPalette,tone:e=>tt(e)?30:80,isBackground:!0,background:e=>d.highestSurface(e),contrastCurve:new C(1,1,3,4.5),toneDeltaPair:e=>new dt(d.primaryFixed,d.primaryFixedDim,10,"lighter",!0)});d.onPrimaryFixed=v.fromPalette({name:"on_primary_fixed",palette:e=>e.primaryPalette,tone:e=>tt(e)?100:10,background:e=>d.primaryFixedDim,secondBackground:e=>d.primaryFixed,contrastCurve:new C(4.5,7,11,21)});d.onPrimaryFixedVariant=v.fromPalette({name:"on_primary_fixed_variant",palette:e=>e.primaryPalette,tone:e=>tt(e)?90:30,background:e=>d.primaryFixedDim,secondBackground:e=>d.primaryFixed,contrastCurve:new C(3,4.5,7,11)});d.secondaryFixed=v.fromPalette({name:"secondary_fixed",palette:e=>e.secondaryPalette,tone:e=>tt(e)?80:90,isBackground:!0,background:e=>d.highestSurface(e),contrastCurve:new C(1,1,3,4.5),toneDeltaPair:e=>new dt(d.secondaryFixed,d.secondaryFixedDim,10,"lighter",!0)});d.secondaryFixedDim=v.fromPalette({name:"secondary_fixed_dim",palette:e=>e.secondaryPalette,tone:e=>tt(e)?70:80,isBackground:!0,background:e=>d.highestSurface(e),contrastCurve:new C(1,1,3,4.5),toneDeltaPair:e=>new dt(d.secondaryFixed,d.secondaryFixedDim,10,"lighter",!0)});d.onSecondaryFixed=v.fromPalette({name:"on_secondary_fixed",palette:e=>e.secondaryPalette,tone:e=>10,background:e=>d.secondaryFixedDim,secondBackground:e=>d.secondaryFixed,contrastCurve:new C(4.5,7,11,21)});d.onSecondaryFixedVariant=v.fromPalette({name:"on_secondary_fixed_variant",palette:e=>e.secondaryPalette,tone:e=>tt(e)?25:30,background:e=>d.secondaryFixedDim,secondBackground:e=>d.secondaryFixed,contrastCurve:new C(3,4.5,7,11)});d.tertiaryFixed=v.fromPalette({name:"tertiary_fixed",palette:e=>e.tertiaryPalette,tone:e=>tt(e)?40:90,isBackground:!0,background:e=>d.highestSurface(e),contrastCurve:new C(1,1,3,4.5),toneDeltaPair:e=>new dt(d.tertiaryFixed,d.tertiaryFixedDim,10,"lighter",!0)});d.tertiaryFixedDim=v.fromPalette({name:"tertiary_fixed_dim",palette:e=>e.tertiaryPalette,tone:e=>tt(e)?30:80,isBackground:!0,background:e=>d.highestSurface(e),contrastCurve:new C(1,1,3,4.5),toneDeltaPair:e=>new dt(d.tertiaryFixed,d.tertiaryFixedDim,10,"lighter",!0)});d.onTertiaryFixed=v.fromPalette({name:"on_tertiary_fixed",palette:e=>e.tertiaryPalette,tone:e=>tt(e)?100:10,background:e=>d.tertiaryFixedDim,secondBackground:e=>d.tertiaryFixed,contrastCurve:new C(4.5,7,11,21)});d.onTertiaryFixedVariant=v.fromPalette({name:"on_tertiary_fixed_variant",palette:e=>e.tertiaryPalette,tone:e=>tt(e)?90:30,background:e=>d.tertiaryFixedDim,secondBackground:e=>d.tertiaryFixed,contrastCurve:new C(3,4.5,7,11)});var mt=class{constructor(t){this.sourceColorArgb=t.sourceColorArgb,this.variant=t.variant,this.contrastLevel=t.contrastLevel,this.isDark=t.isDark,this.sourceColorHct=V.fromInt(t.sourceColorArgb),this.primaryPalette=t.primaryPalette,this.secondaryPalette=t.secondaryPalette,this.tertiaryPalette=t.tertiaryPalette,this.neutralPalette=t.neutralPalette,this.neutralVariantPalette=t.neutralVariantPalette,this.errorPalette=D.fromHueAndChroma(25,84)}static getRotatedHue(t,r,o){let i=t.hue;if(r.length!==o.length)throw new Error(`mismatch between hue length ${r.length} & rotations ${o.length}`);if(o.length===1)return _t(t.hue+o[0]);let n=r.length;for(let s=0;s<=n-2;s++){let a=r[s],l=r[s+1];if(a<i&&i<l)return _t(i+o[s])}return i}getArgb(t){return t.getArgb(this)}getHct(t){return t.getHct(this)}get primaryPaletteKeyColor(){return this.getArgb(d.primaryPaletteKeyColor)}get secondaryPaletteKeyColor(){return this.getArgb(d.secondaryPaletteKeyColor)}get tertiaryPaletteKeyColor(){return this.getArgb(d.tertiaryPaletteKeyColor)}get neutralPaletteKeyColor(){return this.getArgb(d.neutralPaletteKeyColor)}get neutralVariantPaletteKeyColor(){return this.getArgb(d.neutralVariantPaletteKeyColor)}get background(){return this.getArgb(d.background)}get onBackground(){return this.getArgb(d.onBackground)}get surface(){return this.getArgb(d.surface)}get surfaceDim(){return this.getArgb(d.surfaceDim)}get surfaceBright(){return this.getArgb(d.surfaceBright)}get surfaceContainerLowest(){return this.getArgb(d.surfaceContainerLowest)}get surfaceContainerLow(){return this.getArgb(d.surfaceContainerLow)}get surfaceContainer(){return this.getArgb(d.surfaceContainer)}get surfaceContainerHigh(){return this.getArgb(d.surfaceContainerHigh)}get surfaceContainerHighest(){return this.getArgb(d.surfaceContainerHighest)}get onSurface(){return this.getArgb(d.onSurface)}get surfaceVariant(){return this.getArgb(d.surfaceVariant)}get onSurfaceVariant(){return this.getArgb(d.onSurfaceVariant)}get inverseSurface(){return this.getArgb(d.inverseSurface)}get inverseOnSurface(){return this.getArgb(d.inverseOnSurface)}get outline(){return this.getArgb(d.outline)}get outlineVariant(){return this.getArgb(d.outlineVariant)}get shadow(){return this.getArgb(d.shadow)}get scrim(){return this.getArgb(d.scrim)}get surfaceTint(){return this.getArgb(d.surfaceTint)}get primary(){return this.getArgb(d.primary)}get onPrimary(){return this.getArgb(d.onPrimary)}get primaryContainer(){return this.getArgb(d.primaryContainer)}get onPrimaryContainer(){return this.getArgb(d.onPrimaryContainer)}get inversePrimary(){return this.getArgb(d.inversePrimary)}get secondary(){return this.getArgb(d.secondary)}get onSecondary(){return this.getArgb(d.onSecondary)}get secondaryContainer(){return this.getArgb(d.secondaryContainer)}get onSecondaryContainer(){return this.getArgb(d.onSecondaryContainer)}get tertiary(){return this.getArgb(d.tertiary)}get onTertiary(){return this.getArgb(d.onTertiary)}get tertiaryContainer(){return this.getArgb(d.tertiaryContainer)}get onTertiaryContainer(){return this.getArgb(d.onTertiaryContainer)}get error(){return this.getArgb(d.error)}get onError(){return this.getArgb(d.onError)}get errorContainer(){return this.getArgb(d.errorContainer)}get onErrorContainer(){return this.getArgb(d.onErrorContainer)}get primaryFixed(){return this.getArgb(d.primaryFixed)}get primaryFixedDim(){return this.getArgb(d.primaryFixedDim)}get onPrimaryFixed(){return this.getArgb(d.onPrimaryFixed)}get onPrimaryFixedVariant(){return this.getArgb(d.onPrimaryFixedVariant)}get secondaryFixed(){return this.getArgb(d.secondaryFixed)}get secondaryFixedDim(){return this.getArgb(d.secondaryFixedDim)}get onSecondaryFixed(){return this.getArgb(d.onSecondaryFixed)}get onSecondaryFixedVariant(){return this.getArgb(d.onSecondaryFixedVariant)}get tertiaryFixed(){return this.getArgb(d.tertiaryFixed)}get tertiaryFixedDim(){return this.getArgb(d.tertiaryFixedDim)}get onTertiaryFixed(){return this.getArgb(d.onTertiaryFixed)}get onTertiaryFixedVariant(){return this.getArgb(d.onTertiaryFixedVariant)}};var zt=class e{static of(t){return new e(t,!1)}static contentOf(t){return new e(t,!0)}static fromColors(t){return e.createPaletteFromColors(!1,t)}static contentFromColors(t){return e.createPaletteFromColors(!0,t)}static createPaletteFromColors(t,r){let o=new e(r.primary,t);if(r.secondary){let i=new e(r.secondary,t);o.a2=i.a1}if(r.tertiary){let i=new e(r.tertiary,t);o.a3=i.a1}if(r.error){let i=new e(r.error,t);o.error=i.a1}if(r.neutral){let i=new e(r.neutral,t);o.n1=i.n1}if(r.neutralVariant){let i=new e(r.neutralVariant,t);o.n2=i.n2}return o}constructor(t,r){let o=V.fromInt(t),i=o.hue,n=o.chroma;r?(this.a1=D.fromHueAndChroma(i,n),this.a2=D.fromHueAndChroma(i,n/3),this.a3=D.fromHueAndChroma(i+60,n/2),this.n1=D.fromHueAndChroma(i,Math.min(n/12,4)),this.n2=D.fromHueAndChroma(i,Math.min(n/6,8))):(this.a1=D.fromHueAndChroma(i,Math.max(48,n)),this.a2=D.fromHueAndChroma(i,16),this.a3=D.fromHueAndChroma(i+60,24),this.n1=D.fromHueAndChroma(i,4),this.n2=D.fromHueAndChroma(i,8)),this.error=D.fromHueAndChroma(25,84)}};var Ze=class e{get primary(){return this.props.primary}get onPrimary(){return this.props.onPrimary}get primaryContainer(){return this.props.primaryContainer}get onPrimaryContainer(){return this.props.onPrimaryContainer}get secondary(){return this.props.secondary}get onSecondary(){return this.props.onSecondary}get secondaryContainer(){return this.props.secondaryContainer}get onSecondaryContainer(){return this.props.onSecondaryContainer}get tertiary(){return this.props.tertiary}get onTertiary(){return this.props.onTertiary}get tertiaryContainer(){return this.props.tertiaryContainer}get onTertiaryContainer(){return this.props.onTertiaryContainer}get error(){return this.props.error}get onError(){return this.props.onError}get errorContainer(){return this.props.errorContainer}get onErrorContainer(){return this.props.onErrorContainer}get background(){return this.props.background}get onBackground(){return this.props.onBackground}get surface(){return this.props.surface}get onSurface(){return this.props.onSurface}get surfaceVariant(){return this.props.surfaceVariant}get onSurfaceVariant(){return this.props.onSurfaceVariant}get outline(){return this.props.outline}get outlineVariant(){return this.props.outlineVariant}get shadow(){return this.props.shadow}get scrim(){return this.props.scrim}get inverseSurface(){return this.props.inverseSurface}get inverseOnSurface(){return this.props.inverseOnSurface}get inversePrimary(){return this.props.inversePrimary}static light(t){return e.lightFromCorePalette(zt.of(t))}static dark(t){return e.darkFromCorePalette(zt.of(t))}static lightContent(t){return e.lightFromCorePalette(zt.contentOf(t))}static darkContent(t){return e.darkFromCorePalette(zt.contentOf(t))}static lightFromCorePalette(t){return new e({primary:t.a1.tone(40),onPrimary:t.a1.tone(100),primaryContainer:t.a1.tone(90),onPrimaryContainer:t.a1.tone(10),secondary:t.a2.tone(40),onSecondary:t.a2.tone(100),secondaryContainer:t.a2.tone(90),onSecondaryContainer:t.a2.tone(10),tertiary:t.a3.tone(40),onTertiary:t.a3.tone(100),tertiaryContainer:t.a3.tone(90),onTertiaryContainer:t.a3.tone(10),error:t.error.tone(40),onError:t.error.tone(100),errorContainer:t.error.tone(90),onErrorContainer:t.error.tone(10),background:t.n1.tone(99),onBackground:t.n1.tone(10),surface:t.n1.tone(99),onSurface:t.n1.tone(10),surfaceVariant:t.n2.tone(90),onSurfaceVariant:t.n2.tone(30),outline:t.n2.tone(50),outlineVariant:t.n2.tone(80),shadow:t.n1.tone(0),scrim:t.n1.tone(0),inverseSurface:t.n1.tone(20),inverseOnSurface:t.n1.tone(95),inversePrimary:t.a1.tone(80)})}static darkFromCorePalette(t){return new e({primary:t.a1.tone(80),onPrimary:t.a1.tone(20),primaryContainer:t.a1.tone(30),onPrimaryContainer:t.a1.tone(90),secondary:t.a2.tone(80),onSecondary:t.a2.tone(20),secondaryContainer:t.a2.tone(30),onSecondaryContainer:t.a2.tone(90),tertiary:t.a3.tone(80),onTertiary:t.a3.tone(20),tertiaryContainer:t.a3.tone(30),onTertiaryContainer:t.a3.tone(90),error:t.error.tone(80),onError:t.error.tone(20),errorContainer:t.error.tone(30),onErrorContainer:t.error.tone(80),background:t.n1.tone(10),onBackground:t.n1.tone(90),surface:t.n1.tone(10),onSurface:t.n1.tone(90),surfaceVariant:t.n2.tone(30),onSurfaceVariant:t.n2.tone(80),outline:t.n2.tone(60),outlineVariant:t.n2.tone(30),shadow:t.n1.tone(0),scrim:t.n1.tone(0),inverseSurface:t.n1.tone(90),inverseOnSurface:t.n1.tone(20),inversePrimary:t.a1.tone(40)})}constructor(t){this.props=t}toJSON(){return{...this.props}}};var Br=class e extends mt{constructor(t,r,o){super({sourceColorArgb:t.toInt(),variant:ht.EXPRESSIVE,contrastLevel:o,isDark:r,primaryPalette:D.fromHueAndChroma(_t(t.hue+240),40),secondaryPalette:D.fromHueAndChroma(mt.getRotatedHue(t,e.hues,e.secondaryRotations),24),tertiaryPalette:D.fromHueAndChroma(mt.getRotatedHue(t,e.hues,e.tertiaryRotations),32),neutralPalette:D.fromHueAndChroma(t.hue+15,8),neutralVariantPalette:D.fromHueAndChroma(t.hue+15,12)})}};Br.hues=[0,21,51,121,151,191,271,321,360];Br.secondaryRotations=[45,95,45,20,45,90,45,45,45];Br.tertiaryRotations=[120,120,20,45,20,15,20,120,120];var Fr=class e extends mt{constructor(t,r,o){super({sourceColorArgb:t.toInt(),variant:ht.VIBRANT,contrastLevel:o,isDark:r,primaryPalette:D.fromHueAndChroma(t.hue,200),secondaryPalette:D.fromHueAndChroma(mt.getRotatedHue(t,e.hues,e.secondaryRotations),24),tertiaryPalette:D.fromHueAndChroma(mt.getRotatedHue(t,e.hues,e.tertiaryRotations),32),neutralPalette:D.fromHueAndChroma(t.hue,10),neutralVariantPalette:D.fromHueAndChroma(t.hue,12)})}};Fr.hues=[0,41,61,101,131,181,251,301,360];Fr.secondaryRotations=[18,15,10,12,15,18,15,12,12];Fr.tertiaryRotations=[35,30,20,25,30,35,30,25,25];var Yl={desired:4,fallbackColorARGB:4282549748,filter:!0};function Xl(e,t){return e.score>t.score?-1:e.score<t.score?1:0}var ie=class e{constructor(){}static score(t,r){let{desired:o,fallbackColorARGB:i,filter:n}={...Yl,...r},s=[],a=new Array(360).fill(0),l=0;for(let[y,x]of t.entries()){let P=V.fromInt(y);s.push(P);let R=Math.floor(P.hue);a[R]+=x,l+=x}let c=new Array(360).fill(0);for(let y=0;y<360;y++){let x=a[y]/l;for(let P=y-14;P<y+16;P++){let R=Go(P);c[R]+=x}}let u=new Array;for(let y of s){let x=Go(Math.round(y.hue)),P=c[x];if(n&&(y.chroma<e.CUTOFF_CHROMA||P<=e.CUTOFF_EXCITED_PROPORTION))continue;let R=P*100*e.WEIGHT_PROPORTION,W=y.chroma<e.TARGET_CHROMA?e.WEIGHT_CHROMA_BELOW:e.WEIGHT_CHROMA_ABOVE,N=(y.chroma-e.TARGET_CHROMA)*W,S=R+N;u.push({hct:y,score:S})}u.sort(Xl);let h=[];for(let y=90;y>=15;y--){h.length=0;for(let{hct:x}of u)if(h.find(R=>Ko(x.hue,R.hue)<y)||h.push(x),h.length>=o)break;if(h.length>=o)break}let f=[];h.length===0&&f.push(i);for(let y of h)f.push(y.toInt());return f}};ie.TARGET_CHROMA=48;ie.WEIGHT_PROPORTION=.7;ie.WEIGHT_CHROMA_ABOVE=.3;ie.WEIGHT_CHROMA_BELOW=.1;ie.CUTOFF_CHROMA=5;ie.CUTOFF_EXCITED_PROPORTION=.01;function Jo(e){e=e.replace("#","");let t=e.length===3,r=e.length===6,o=e.length===8;if(!t&&!r&&!o)throw new Error("unexpected hex "+e);let i=0,n=0,s=0;return t?(i=ne(e.slice(0,1).repeat(2)),n=ne(e.slice(1,2).repeat(2)),s=ne(e.slice(2,3).repeat(2))):r?(i=ne(e.slice(0,2)),n=ne(e.slice(2,4)),s=ne(e.slice(4,6))):o&&(i=ne(e.slice(2,4)),n=ne(e.slice(4,6)),s=ne(e.slice(6,8))),(255<<24|(i&255)<<16|(n&255)<<8|s&255)>>>0}function ne(e){return parseInt(e,16)}function ga(e,t){let r=t.value,o=r,i=e;t.blend&&(r=Xo.harmonize(o,i));let s=zt.of(r).a1;return{color:t,value:r,light:{color:s.tone(40),onColor:s.tone(100),colorContainer:s.tone(90),onColorContainer:s.tone(10)},dark:{color:s.tone(80),onColor:s.tone(20),colorContainer:s.tone(30),onColorContainer:s.tone(90)}}}var Jl=["light","dark"],ya="mdui-custom-color-scheme-",Ql=0,Zl=e=>{let t=Mr(e),r=Ir(e),o=Dr(e);return[t,r,o].join(", ")},tc=e=>{let t=m(e),r=t.get().map(i=>Array.from(i.classList)).flat();r=ae(r).filter(i=>i.startsWith(ya)),t.removeClass(r.join(" "));let o=r.filter(i=>m(`.${i}`).length===0);m(o.map(i=>`#${i}`).join(",")).remove()},ba=(e,t)=>{let r=et(),o=m(t?.target||r.documentElement),i={light:Ze.light(e).toJSON(),dark:Ze.dark(e).toJSON()},n=zt.of(e);Object.assign(i.light,{"surface-dim":n.n1.tone(87),"surface-bright":n.n1.tone(98),"surface-container-lowest":n.n1.tone(100),"surface-container-low":n.n1.tone(96),"surface-container":n.n1.tone(94),"surface-container-high":n.n1.tone(92),"surface-container-highest":n.n1.tone(90),"surface-tint-color":i.light.primary}),Object.assign(i.dark,{"surface-dim":n.n1.tone(6),"surface-bright":n.n1.tone(24),"surface-container-lowest":n.n1.tone(4),"surface-container-low":n.n1.tone(10),"surface-container":n.n1.tone(12),"surface-container-high":n.n1.tone(17),"surface-container-highest":n.n1.tone(22),"surface-tint-color":i.dark.primary}),(t?.customColors||[]).map(c=>{let u=Qt(c.name),h=ga(e,{name:u,value:Jo(c.value),blend:!0});Jl.forEach(f=>{i[f][u]=h[f].color,i[f][`on-${u}`]=h[f].onColor,i[f][`${u}-container`]=h[f].colorContainer,i[f][`on-${u}-container`]=h[f].onColorContainer})});let s=(c,u)=>Object.entries(i[c]).map(([h,f])=>u(Qt(h),Zl(f))).join(""),a=ya+`${e}-${Ql++}`,l=`.${a} {
24
+ ${s("light",(c,u)=>`--mdui-color-${c}-light: ${u};`)}
25
+ ${s("dark",(c,u)=>`--mdui-color-${c}-dark: ${u};`)}
26
+ ${s("light",c=>`--mdui-color-${c}: var(--mdui-color-${c}-light);`)}
27
+
28
+ color: rgb(var(--mdui-color-on-background));
29
+ background-color: rgb(var(--mdui-color-background));
30
+ }
31
+
32
+ .mdui-theme-dark .${a},
33
+ .mdui-theme-dark.${a} {
34
+ ${s("dark",c=>`--mdui-color-${c}: var(--mdui-color-${c}-dark);`)}
35
+ }
36
+
37
+ @media (prefers-color-scheme: dark) {
38
+ .mdui-theme-auto .${a},
39
+ .mdui-theme-auto.${a} {
40
+ ${s("dark",c=>`--mdui-color-${c}: var(--mdui-color-${c}-dark);`)}
41
+ }
42
+ }`;tc(o),m(r.head).append(`<style id="${a}">${l}</style>`),o.addClass(a)};var va=(e,t)=>{let r=Jo(e);ba(r,t)};va("#ef6b00");T.setSpacingCssVars();var ec=`ws://${location.hostname}:8080/`,xa=new Wo(ec),Qo=xa.api;T("h2#Online");T(()=>{T(xa.isOnline()?"text=yes":"text=no")});var rc=Qo.add(1234,6753);T("h2#Answer");T.dump(rc);var wa=Qo.authenticate("Frank");T("h2#AuthToken");T.dump(wa);var Aa=wa.serverProxy,oc=Aa.getBio();T("h2#Bio");T.dump(oc);var ic=Qo.streamModel();T("h2#Model");T.dump(ic);T("h2#Toggle friend");var sn=T.proxy(!1),an=T.proxy("");T("form display:flex gap:$2","submit=",async e=>{e.preventDefault(),sn.value=!0;let t=await Aa.toggleFriend(an.value).promise;sn.value=!1,t||Fs({description:"No such person: "+an.value})},()=>{T('mdui-text-field label="Person name" bind=',an),T(()=>{sn.value?T("mdui-circular-progress"):T("mdui-button type=submit #Toggle friend")})});var Ca=T.proxy([]),nc=0;Qo.streamSomething(e=>Ca[nc++%20]=e);T("h2#Streamed data");T.dump(Ca);
43
+ /*! Bundled license information:
44
+
45
+ @lit/reactive-element/css-tag.js:
46
+ (**
47
+ * @license
48
+ * Copyright 2019 Google LLC
49
+ * SPDX-License-Identifier: BSD-3-Clause
50
+ *)
51
+
52
+ @lit/reactive-element/reactive-element.js:
53
+ lit-html/lit-html.js:
54
+ lit-element/lit-element.js:
55
+ @lit/reactive-element/decorators/custom-element.js:
56
+ @lit/reactive-element/decorators/property.js:
57
+ @lit/reactive-element/decorators/state.js:
58
+ @lit/reactive-element/decorators/event-options.js:
59
+ @lit/reactive-element/decorators/base.js:
60
+ @lit/reactive-element/decorators/query.js:
61
+ @lit/reactive-element/decorators/query-all.js:
62
+ @lit/reactive-element/decorators/query-async.js:
63
+ @lit/reactive-element/decorators/query-assigned-nodes.js:
64
+ lit-html/directive.js:
65
+ lit-html/async-directive.js:
66
+ lit-html/directives/unsafe-html.js:
67
+ lit-html/directives/unsafe-svg.js:
68
+ lit-html/directives/until.js:
69
+ (**
70
+ * @license
71
+ * Copyright 2017 Google LLC
72
+ * SPDX-License-Identifier: BSD-3-Clause
73
+ *)
74
+
75
+ lit-html/is-server.js:
76
+ (**
77
+ * @license
78
+ * Copyright 2022 Google LLC
79
+ * SPDX-License-Identifier: BSD-3-Clause
80
+ *)
81
+
82
+ @lit/reactive-element/decorators/query-assigned-elements.js:
83
+ lit-html/directives/private-async-helpers.js:
84
+ lit-html/directives/when.js:
85
+ @lit/localize/internal/locale-status-event.js:
86
+ @lit/localize/internal/str-tag.js:
87
+ @lit/localize/internal/types.js:
88
+ @lit/localize/internal/default-msg.js:
89
+ @lit/localize/internal/localized-controller.js:
90
+ @lit/localize/internal/localized-decorator.js:
91
+ @lit/localize/internal/runtime-msg.js:
92
+ @lit/localize/init/runtime.js:
93
+ @lit/localize/init/transform.js:
94
+ (**
95
+ * @license
96
+ * Copyright 2021 Google LLC
97
+ * SPDX-License-Identifier: BSD-3-Clause
98
+ *)
99
+
100
+ lit-html/directive-helpers.js:
101
+ lit-html/directives/ref.js:
102
+ lit-html/directives/live.js:
103
+ @lit/localize/internal/deferred.js:
104
+ @lit/localize/internal/id-generation.js:
105
+ @lit/localize/lit-localize.js:
106
+ (**
107
+ * @license
108
+ * Copyright 2020 Google LLC
109
+ * SPDX-License-Identifier: BSD-3-Clause
110
+ *)
111
+
112
+ lit-html/directives/style-map.js:
113
+ lit-html/directives/if-defined.js:
114
+ lit-html/directives/class-map.js:
115
+ (**
116
+ * @license
117
+ * Copyright 2018 Google LLC
118
+ * SPDX-License-Identifier: BSD-3-Clause
119
+ *)
120
+
121
+ @lit/localize/internal/fnv1a64.js:
122
+ (**
123
+ * @license
124
+ * Copyright 2014 Travis Webb
125
+ * SPDX-License-Identifier: MIT
126
+ *)
127
+
128
+ @material/material-color-utilities/utils/math_utils.js:
129
+ @material/material-color-utilities/utils/color_utils.js:
130
+ @material/material-color-utilities/hct/viewing_conditions.js:
131
+ @material/material-color-utilities/hct/cam16.js:
132
+ @material/material-color-utilities/hct/hct_solver.js:
133
+ @material/material-color-utilities/hct/hct.js:
134
+ @material/material-color-utilities/blend/blend.js:
135
+ @material/material-color-utilities/palettes/tonal_palette.js:
136
+ @material/material-color-utilities/palettes/core_palette.js:
137
+ @material/material-color-utilities/quantize/lab_point_provider.js:
138
+ @material/material-color-utilities/quantize/quantizer_wsmeans.js:
139
+ @material/material-color-utilities/quantize/quantizer_map.js:
140
+ @material/material-color-utilities/quantize/quantizer_wu.js:
141
+ @material/material-color-utilities/quantize/quantizer_celebi.js:
142
+ @material/material-color-utilities/scheme/scheme.js:
143
+ @material/material-color-utilities/scheme/scheme_android.js:
144
+ @material/material-color-utilities/score/score.js:
145
+ @material/material-color-utilities/utils/string_utils.js:
146
+ @material/material-color-utilities/utils/image_utils.js:
147
+ @material/material-color-utilities/utils/theme_utils.js:
148
+ @material/material-color-utilities/index.js:
149
+ (**
150
+ * @license
151
+ * Copyright 2021 Google LLC
152
+ *
153
+ * Licensed under the Apache License, Version 2.0 (the "License");
154
+ * you may not use this file except in compliance with the License.
155
+ * You may obtain a copy of the License at
156
+ *
157
+ * http://www.apache.org/licenses/LICENSE-2.0
158
+ *
159
+ * Unless required by applicable law or agreed to in writing, software
160
+ * distributed under the License is distributed on an "AS IS" BASIS,
161
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
162
+ * See the License for the specific language governing permissions and
163
+ * limitations under the License.
164
+ *)
165
+
166
+ @material/material-color-utilities/contrast/contrast.js:
167
+ @material/material-color-utilities/dynamiccolor/dynamic_color.js:
168
+ @material/material-color-utilities/dynamiccolor/variant.js:
169
+ @material/material-color-utilities/dynamiccolor/material_dynamic_colors.js:
170
+ @material/material-color-utilities/dynamiccolor/dynamic_scheme.js:
171
+ @material/material-color-utilities/scheme/scheme_expressive.js:
172
+ @material/material-color-utilities/scheme/scheme_fruit_salad.js:
173
+ @material/material-color-utilities/scheme/scheme_monochrome.js:
174
+ @material/material-color-utilities/scheme/scheme_neutral.js:
175
+ @material/material-color-utilities/scheme/scheme_rainbow.js:
176
+ @material/material-color-utilities/scheme/scheme_tonal_spot.js:
177
+ @material/material-color-utilities/scheme/scheme_vibrant.js:
178
+ (**
179
+ * @license
180
+ * Copyright 2022 Google LLC
181
+ *
182
+ * Licensed under the Apache License, Version 2.0 (the "License");
183
+ * you may not use this file except in compliance with the License.
184
+ * You may obtain a copy of the License at
185
+ *
186
+ * http://www.apache.org/licenses/LICENSE-2.0
187
+ *
188
+ * Unless required by applicable law or agreed to in writing, software
189
+ * distributed under the License is distributed on an "AS IS" BASIS,
190
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
191
+ * See the License for the specific language governing permissions and
192
+ * limitations under the License.
193
+ *)
194
+
195
+ @material/material-color-utilities/dislike/dislike_analyzer.js:
196
+ @material/material-color-utilities/dynamiccolor/contrast_curve.js:
197
+ @material/material-color-utilities/dynamiccolor/tone_delta_pair.js:
198
+ @material/material-color-utilities/temperature/temperature_cache.js:
199
+ @material/material-color-utilities/scheme/scheme_content.js:
200
+ @material/material-color-utilities/scheme/scheme_fidelity.js:
201
+ (**
202
+ * @license
203
+ * Copyright 2023 Google LLC
204
+ *
205
+ * Licensed under the Apache License, Version 2.0 (the "License");
206
+ * you may not use this file except in compliance with the License.
207
+ * You may obtain a copy of the License at
208
+ *
209
+ * http://www.apache.org/licenses/LICENSE-2.0
210
+ *
211
+ * Unless required by applicable law or agreed to in writing, software
212
+ * distributed under the License is distributed on an "AS IS" BASIS,
213
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
214
+ * See the License for the specific language governing permissions and
215
+ * limitations under the License.
216
+ *)
217
+ */