510ebdf885
The page is now web/ (Vue 3 + Vite + TypeScript), built into screen_manager/app/static with hashed file names; server.py serves index.html as built and /assets/. The Python API, the data and the firmware are unchanged. Your screens sit in a sidebar, the pages of a screen stand next to each other at the screen's own shape, the library sits on the right, and a tile's settings slide in as a drawer while the mockup stays in view. New screen, Firmware & USB, Alerts, Override YAML and Settings are pages of their own. Fonts moved to web/src/assets; the tests read the source through tests/editor_sources.py. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
28 lines
193 KiB
JavaScript
28 lines
193 KiB
JavaScript
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const r of l.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&s(r)}).observe(document,{childList:!0,subtree:!0});function n(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function s(o){if(o.ep)return;o.ep=!0;const l=n(o);fetch(o.href,l)}})();function So(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const be={},en=[],mt=()=>{},Yi=()=>!1,As=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Es=e=>e.startsWith("onUpdate:"),Oe=Object.assign,Co=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},ga=Object.prototype.hasOwnProperty,ve=(e,t)=>ga.call(e,t),ee=Array.isArray,Vt=e=>Gn(e)==="[object Map]",sn=e=>Gn(e)==="[object Set]",ei=e=>Gn(e)==="[object Date]",ne=e=>typeof e=="function",xe=e=>typeof e=="string",gt=e=>typeof e=="symbol",ge=e=>e!==null&&typeof e=="object",zi=e=>(ge(e)||ne(e))&&ne(e.then)&&ne(e.catch),Gi=Object.prototype.toString,Gn=e=>Gi.call(e),ya=e=>Gn(e).slice(8,-1),Ji=e=>Gn(e)==="[object Object]",To=e=>xe(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,En=So(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Ps=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},ba=/-\w/g,Be=Ps(e=>e.replace(ba,t=>t.slice(1).toUpperCase())),wa=/\B([A-Z])/g,Yt=Ps(e=>e.replace(wa,"-$1").toLowerCase()),Os=Ps(e=>e.charAt(0).toUpperCase()+e.slice(1)),Us=Ps(e=>e?`on${Os(e)}`:""),ht=(e,t)=>!Object.is(e,t),rs=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Xi=(e,t,n,s=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:s,value:n})},Is=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let ti;const Ms=()=>ti||(ti=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Ne(e){if(ee(e)){const t={};for(let n=0;n<e.length;n++){const s=e[n],o=xe(s)?xa(s):Ne(s);if(o)for(const l in o)t[l]=o[l]}return t}else if(xe(e)||ge(e))return e}const _a=/;(?![^(]*\))/g,ka=/:([^]+)/,$a=/"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;function xa(e){const t={};return e.replace($a,n=>n.startsWith("/*")?"":n).split(_a).forEach(n=>{if(n){const s=n.split(ka);s.length>1&&(t[s[0].trim()]=s[1].trim())}}),t}function re(e){let t="";if(xe(e))t=e;else if(ee(e))for(let n=0;n<e.length;n++){const s=re(e[n]);s&&(t+=s+" ")}else if(ge(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const Sa="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Ca=So(Sa);function Qi(e){return!!e||e===""}function Ta(e,t,n){if(e.length!==t.length)return!1;let s=!0;for(let o=0;s&&o<e.length;o++)s=yt(e[o],t[o],n);return s}function ni(e,t,n){if(e.size!==t.size)return!1;const s=Array.from(t),o=new Uint8Array(s.length);for(const l of e){let r=-1;for(let u=0;u<s.length;u++)if(!o[u]&&yt(l,s[u],n)){r=u;break}if(r<0)return!1;o[r]=1}return!0}function Aa(e,t,n){let s=Vt(e),o=Vt(t);if(s||o||(s=sn(e),o=sn(t),s||o))return s&&o?ni(e,t,n):!1;const l=Object.keys(e).length,r=Object.keys(t).length;if(l!==r)return!1;for(const u in e){const a=e.hasOwnProperty(u),c=t.hasOwnProperty(u);if(a&&!c||!a&&c||!yt(e[u],t[u],n))return!1}return String(e)===String(t)}function si(e,t,n,s){n||(n=[new Map,new Map]);const[o,l]=n;if(o.has(e)||l.has(t))return o.get(e)===t&&l.get(t)===e;o.set(e,t),l.set(t,e);const r=s(e,t,n);return o.delete(e),l.delete(t),r}function yt(e,t,n){if(e===t)return!0;let s=ei(e),o=ei(t);return s||o?s&&o?e.getTime()===t.getTime():!1:(s=gt(e),o=gt(t),s||o?e===t:(s=ee(e),o=ee(t),s||o?s&&o?si(e,t,n,Ta):!1:(s=ge(e),o=ge(t),s||o?!s||!o?!1:si(e,t,n,Aa):String(e)===String(t))))}function Ea(e,t){return e.findIndex(n=>yt(n,t))}const Zi=e=>!!(e&&e.__v_isRef===!0),y=e=>xe(e)?e:e==null?"":ee(e)||ge(e)&&(e.toString===Gi||!ne(e.toString))?Zi(e)?y(e.value):JSON.stringify(e,el,2):String(e),el=(e,t)=>Zi(t)?el(e,t.value):Vt(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[s,o],l)=>(n[Vs(s,l)+" =>"]=o,n),{})}:sn(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>Vs(n))}:gt(t)?Vs(t):ge(t)&&!ee(t)&&!Ji(t)?String(t):t,Vs=(e,t="")=>{var n;return gt(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};let Pe;class Pa{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!t&&Pe&&(Pe.active?(this.parent=Pe,this.index=(Pe.scopes||(Pe.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,n;if(this.scopes){const s=this.scopes.slice();for(t=0,n=s.length;t<n;t++)s[t].pause()}for(t=0,n=this.effects.length;t<n;t++)this.effects[t].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let t,n;if(this.scopes){const o=this.scopes.slice();for(t=0,n=o.length;t<n;t++)o[t].resume()}const s=this.effects.slice();for(t=0,n=s.length;t<n;t++)s[t].resume()}}run(t){if(this._active){const n=Pe;try{return Pe=this,t()}finally{Pe=n}}}on(){++this._on===1&&(this.prevScope=Pe,Pe=this)}off(){if(this._on>0&&--this._on===0){if(Pe===this)Pe=this.prevScope;else{let t=Pe;for(;t;){if(t.prevScope===this){t.prevScope=this.prevScope;break}t=t.prevScope}}this.prevScope=void 0}}stop(t){if(this._active){this._active=!1;let n,s;for(n=0,s=this.effects.length;n<s;n++)this.effects[n].stop();for(this.effects.length=0,n=0,s=this.cleanups.length;n<s;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){const o=this.scopes.slice();for(n=0,s=o.length;n<s;n++)o[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const o=this.parent.scopes.pop();o&&o!==this&&(this.parent.scopes[this.index]=o,o.index=this.index)}this.parent=void 0}}}function Oa(){return Pe}let we;const Ws=new WeakSet;class tl{constructor(t){this.fn=t,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Pe&&(Pe.active?Pe.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Ws.has(this)&&(Ws.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||sl(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,oi(this),ol(this);const t=we,n=st;we=this,st=!0;try{return this.fn()}finally{il(this),we=t,st=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)Po(t);this.deps=this.depsTail=void 0,oi(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Ws.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){io(this)&&this.run()}get dirty(){return io(this)}}let nl=0,Pn,On;function sl(e,t=!1){if(e.flags|=8,t){e.next=On,On=e;return}e.next=Pn,Pn=e}function Ao(){nl++}function Eo(){if(--nl>0)return;if(On){let t=On;for(On=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;Pn;){let t=Pn;for(Pn=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(s){e||(e=s)}t=n}}if(e)throw e}function ol(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function il(e){let t,n=e.depsTail,s=n;for(;s;){const o=s.prevDep;s.version===-1?(s===n&&(n=o),Po(s),Ia(s)):t=s,s.dep.activeLink=s.prevActiveLink,s.prevActiveLink=void 0,s=o}e.deps=t,e.depsTail=n}function io(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(ll(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function ll(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Rn)||(e.globalVersion=Rn,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!io(e))))return;e.flags|=2;const t=e.dep,n=we,s=st;we=e,st=!0;try{ol(e);const o=e.fn(e._value);(t.version===0||ht(o,e._value))&&(e.flags|=128,e._value=o,t.version++)}catch(o){throw t.version++,o}finally{we=n,st=s,il(e),e.flags&=-3}}function Po(e,t=!1){const{dep:n,prevSub:s,nextSub:o}=e;if(s&&(s.nextSub=o,e.prevSub=void 0),o&&(o.prevSub=s,e.nextSub=void 0),n.subs===e&&(n.subs=s,!s&&n.computed)){n.computed.flags&=-5;for(let l=n.computed.deps;l;l=l.nextDep)Po(l,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Ia(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let st=!0;const al=[];function Pt(){al.push(st),st=!1}function Ot(){const e=al.pop();st=e===void 0?!0:e}function oi(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=we;we=void 0;try{t()}finally{we=n}}}let Rn=0;class Ma{constructor(t,n){this.sub=t,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Oo{constructor(t){this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(t){if(!we||!st||we===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==we)n=this.activeLink=new Ma(we,this),we.deps?(n.prevDep=we.depsTail,we.depsTail.nextDep=n,we.depsTail=n):we.deps=we.depsTail=n,rl(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const s=n.nextDep;s.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=s),n.prevDep=we.depsTail,n.nextDep=void 0,we.depsTail.nextDep=n,we.depsTail=n,we.deps===n&&(we.deps=s)}return n}trigger(t){this.version++,Rn++,this.notify(t)}notify(t){Ao();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{Eo()}}}function rl(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let s=t.deps;s;s=s.nextDep)rl(s)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const lo=new WeakMap,tn=Symbol(""),ao=Symbol(""),Nn=Symbol("");function Ie(e,t,n){if(st&&we){let s=lo.get(e);s||lo.set(e,s=new Map);let o=s.get(n);o||(s.set(n,o=new Oo),o.map=s,o.key=n),o.track()}}function Tt(e,t,n,s,o,l){const r=lo.get(e);if(!r){Rn++;return}const u=a=>{a&&a.trigger()};if(Ao(),t==="clear")r.forEach(u);else{const a=ee(e),c=a&&To(n);if(a&&n==="length"){const f=Number(s);r.forEach((b,A)=>{(A==="length"||A===Nn||!gt(A)&&A>=f)&&u(b)})}else switch((n!==void 0||r.has(void 0))&&u(r.get(n)),c&&u(r.get(Nn)),t){case"add":a?c&&u(r.get("length")):(u(r.get(tn)),Vt(e)&&u(r.get(ao)));break;case"delete":a||(u(r.get(tn)),Vt(e)&&u(r.get(ao)));break;case"set":Vt(e)&&u(r.get(tn));break}}Eo()}function rn(e){const t=he(e);return t===e||(Ie(t,"iterate",Nn),Xe(e))?t:bt(e)?Wt(e)?t.map(n=>Kt(Ze(n))):t.map(Kt):t.map(Ze)}function Ds(e){return Ie(e=he(e),"iterate",Nn),e}function ft(e,t){return bt(e)?Kt(Wt(e)?Ze(t):t):Ze(t)}const Da={__proto__:null,[Symbol.iterator](){return Ks(this,Symbol.iterator,e=>ft(this,e))},concat(...e){return rn(this).concat(...e.map(t=>ee(t)?rn(t):t))},entries(){return Ks(this,"entries",e=>(e[1]=ft(this,e[1]),e))},every(e,t){return kt(this,"every",e,t,void 0,arguments)},filter(e,t){return kt(this,"filter",e,t,n=>n.map(s=>ft(this,s)),arguments)},find(e,t){return kt(this,"find",e,t,n=>ft(this,n),arguments)},findIndex(e,t){return kt(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return kt(this,"findLast",e,t,n=>ft(this,n),arguments)},findLastIndex(e,t){return kt(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return kt(this,"forEach",e,t,void 0,arguments)},includes(...e){return qs(this,"includes",e)},indexOf(...e){return qs(this,"indexOf",e)},join(e){return rn(this).join(e)},lastIndexOf(...e){return qs(this,"lastIndexOf",e)},map(e,t){return kt(this,"map",e,t,void 0,arguments)},pop(){return kn(this,"pop")},push(...e){return kn(this,"push",e)},reduce(e,...t){return ii(this,"reduce",e,t)},reduceRight(e,...t){return ii(this,"reduceRight",e,t)},shift(){return kn(this,"shift")},some(e,t){return kt(this,"some",e,t,void 0,arguments)},splice(...e){return kn(this,"splice",e)},toReversed(){return rn(this).toReversed()},toSorted(e){return rn(this).toSorted(e)},toSpliced(...e){return rn(this).toSpliced(...e)},unshift(...e){return kn(this,"unshift",e)},values(){return Ks(this,"values",e=>ft(this,e))}};function Ks(e,t,n){const s=Ds(e),o=s[t]();return s!==e&&!Xe(e)&&(o._next=o.next,o.next=()=>{const l=o._next();return l.done||(l.value=n(l.value)),l}),o}const La=Array.prototype;function kt(e,t,n,s,o,l){const r=Ds(e),u=r!==e&&!Xe(e),a=r[t];if(a!==La[t]){const b=a.apply(e,l);return u?Ze(b):b}let c=n;r!==e&&(u?c=function(b,A){return n.call(this,ft(e,b),A,e)}:n.length>2&&(c=function(b,A){return n.call(this,b,A,e)}));const f=a.call(r,c,s);return u&&o?o(f):f}function ii(e,t,n,s){const o=Ds(e),l=o!==e&&!Xe(e);let r=n,u=!1;o!==e&&(l?(u=s.length===0,r=function(c,f,b){return u&&(u=!1,c=ft(e,c)),n.call(this,c,ft(e,f),b,e)}):n.length>3&&(r=function(c,f,b){return n.call(this,c,f,b,e)}));const a=o[t](r,...s);return u?ft(e,a):a}function qs(e,t,n){const s=he(e);Ie(s,"iterate",Nn);const o=s[t](...n);return(o===-1||o===!1)&&Do(n[0])?(n[0]=he(n[0]),s[t](...n)):o}function kn(e,t,n=[]){Pt(),Ao();const s=he(e)[t].apply(e,n);return Eo(),Ot(),s}const Fa=So("__proto__,__v_isRef,__isVue"),ul=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(gt));function Ha(e){gt(e)||(e=String(e));const t=he(this);return Ie(t,"has",e),t.hasOwnProperty(e)}class cl{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,s){if(n==="__v_skip")return t.__v_skip;const o=this._isReadonly,l=this._isShallow;if(n==="__v_isReactive")return!o;if(n==="__v_isReadonly")return o;if(n==="__v_isShallow")return l;if(n==="__v_raw")return s===(o?l?Ya:hl:l?pl:fl).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(s)?t:void 0;const r=ee(t);if(!o){let a;if(r&&(a=Da[n]))return a;if(n==="hasOwnProperty")return Ha}const u=Reflect.get(t,n,Le(t)?t:s);if((gt(n)?ul.has(n):Fa(n))||(o||Ie(t,"get",n),l))return u;if(Le(u)){const a=r&&To(n)?u:u.value;return o&&ge(a)?uo(a):a}return ge(u)?o?uo(u):hn(u):u}}class dl extends cl{constructor(t=!1){super(!1,t)}set(t,n,s,o){let l=t[n];const r=ee(t)&&To(n);if(!this._isShallow){const c=bt(l);if(!Xe(s)&&!bt(s)&&(l=he(l),s=he(s)),!r&&Le(l)&&!Le(s))return c||(l.value=s),!0}const u=r?Number(n)<t.length:ve(t,n),a=Reflect.set(t,n,s,Le(t)?t:o);return t===he(o)&&a&&(u?ht(s,l)&&Tt(t,"set",n,s):Tt(t,"add",n,s)),a}deleteProperty(t,n){const s=ve(t,n);t[n];const o=Reflect.deleteProperty(t,n);return o&&s&&Tt(t,"delete",n,void 0),o}has(t,n){const s=Reflect.has(t,n);return(!gt(n)||!ul.has(n))&&Ie(t,"has",n),s}ownKeys(t){return Ie(t,"iterate",ee(t)?"length":tn),Reflect.ownKeys(t)}}class Ra extends cl{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const Na=new dl,ja=new Ra,Ba=new dl(!0);const ro=e=>e,ss=e=>Reflect.getPrototypeOf(e);function Ua(e,t,n){return function(...s){const o=this.__v_raw,l=he(o),r=Vt(l),u=e==="entries"||e===Symbol.iterator&&r,a=e==="keys"&&r,c=o[e](...s),f=n?ro:t?Kt:Ze;return!t&&Ie(l,"iterate",a?ao:tn),Oe(Object.create(c),{next(){const{value:b,done:A}=c.next();return A?{value:b,done:A}:{value:u?[f(b[0]),f(b[1])]:f(b),done:A}}})}}function os(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function Va(e,t){const n={get(o){const l=this.__v_raw,r=he(l),u=he(o);e||(ht(o,u)&&Ie(r,"get",o),Ie(r,"get",u));const{has:a}=ss(r),c=t?ro:e?Kt:Ze;if(a.call(r,o))return c(l.get(o));if(a.call(r,u))return c(l.get(u));l!==r&&l.get(o)},get size(){const o=this.__v_raw;return!e&&Ie(he(o),"iterate",tn),o.size},has(o){const l=this.__v_raw,r=he(l),u=he(o);return e||(ht(o,u)&&Ie(r,"has",o),Ie(r,"has",u)),o===u?l.has(o):l.has(o)||l.has(u)},forEach(o,l){const r=this,u=r.__v_raw,a=he(u),c=t?ro:e?Kt:Ze;return!e&&Ie(a,"iterate",tn),u.forEach((f,b)=>o.call(l,c(f),c(b),r))}};return Oe(n,e?{add:os("add"),set:os("set"),delete:os("delete"),clear:os("clear")}:{add(o){const l=he(this),r=ss(l),u=he(o),a=!t&&!Xe(o)&&!bt(o)?u:o;return r.has.call(l,a)||ht(o,a)&&r.has.call(l,o)||ht(u,a)&&r.has.call(l,u)||(l.add(a),Tt(l,"add",a,a)),this},set(o,l){!t&&!Xe(l)&&!bt(l)&&(l=he(l));const r=he(this),{has:u,get:a}=ss(r);let c=u.call(r,o);c||(o=he(o),c=u.call(r,o));const f=a.call(r,o);return r.set(o,l),c?ht(l,f)&&Tt(r,"set",o,l):Tt(r,"add",o,l),this},delete(o){const l=he(this),{has:r,get:u}=ss(l);let a=r.call(l,o);a||(o=he(o),a=r.call(l,o)),u&&u.call(l,o);const c=l.delete(o);return a&&Tt(l,"delete",o,void 0),c},clear(){const o=he(this),l=o.size!==0,r=o.clear();return l&&Tt(o,"clear",void 0,void 0),r}}),["keys","values","entries",Symbol.iterator].forEach(o=>{n[o]=Ua(o,e,t)}),n}function Io(e,t){const n=Va(e,t);return(s,o,l)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?s:Reflect.get(ve(n,o)&&o in s?n:s,o,l)}const Wa={get:Io(!1,!1)},Ka={get:Io(!1,!0)},qa={get:Io(!0,!1)};const fl=new WeakMap,pl=new WeakMap,hl=new WeakMap,Ya=new WeakMap;function za(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function hn(e){return bt(e)?e:Mo(e,!1,Na,Wa,fl)}function Ga(e){return Mo(e,!1,Ba,Ka,pl)}function uo(e){return Mo(e,!0,ja,qa,hl)}function Mo(e,t,n,s,o){if(!ge(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;const l=o.get(e);if(l)return l;const r=za(ya(e));if(r===0)return e;const u=new Proxy(e,r===2?s:n);return o.set(e,u),u}function Wt(e){return bt(e)?Wt(e.__v_raw):!!(e&&e.__v_isReactive)}function bt(e){return!!(e&&e.__v_isReadonly)}function Xe(e){return!!(e&&e.__v_isShallow)}function Do(e){return e?!!e.__v_raw:!1}function he(e){const t=e&&e.__v_raw;return t?he(t):e}function Ja(e){return!ve(e,"__v_skip")&&Object.isExtensible(e)&&Xi(e,"__v_skip",!0),e}const Ze=e=>ge(e)?hn(e):e,Kt=e=>ge(e)?uo(e):e;function Le(e){return e?e.__v_isRef===!0:!1}function fe(e){return Xa(e,!1)}function Xa(e,t){return Le(e)?e:new Qa(e,t)}class Qa{constructor(t,n){this.dep=new Oo,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:he(t),this._value=n?t:Ze(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,s=this.__v_isShallow||Xe(t)||bt(t);t=s?t:he(t),ht(t,n)&&(this._rawValue=t,this._value=s?t:Ze(t),this.dep.trigger())}}function v(e){return Le(e)?e.value:e}const Za={get:(e,t,n)=>t==="__v_raw"?e:v(Reflect.get(e,t,n)),set:(e,t,n,s)=>{const o=e[t];return Le(o)&&!Le(n)?(o.value=n,!0):Reflect.set(e,t,n,s)}};function vl(e){return Wt(e)?e:new Proxy(e,Za)}class er{constructor(t,n,s){this.fn=t,this.setter=n,this._value=void 0,this.dep=new Oo(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Rn-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=s}notify(){if(this.flags|=16,!(this.flags&8)&&we!==this)return sl(this,!0),!0}get value(){const t=this.dep.track();return ll(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function tr(e,t,n=!1){let s,o;return ne(e)?s=e:(s=e.get,o=e.set),new er(s,o,n)}const is={},hs=new WeakMap;let Qt;function nr(e,t=!1,n=Qt){if(n){let s=hs.get(n);s||hs.set(n,s=[]),s.push(e)}}function sr(e,t,n=be){const{immediate:s,deep:o,once:l,scheduler:r,augmentJob:u,call:a}=n,c=m=>o?m:Xe(m)||o===!1||o===0?At(m,1):At(m);let f,b,A,D,I=!1,R=!1;if(Le(e)?(b=()=>e.value,I=Xe(e)):Wt(e)?(b=()=>c(e),I=!0):ee(e)?(R=!0,I=e.some(m=>Wt(m)||Xe(m)),b=()=>e.map(m=>{if(Le(m))return m.value;if(Wt(m))return c(m);if(ne(m))return a?a(m,2):m()})):ne(e)?t?b=a?()=>a(e,2):e:b=()=>{if(A){Pt();try{A()}finally{Ot()}}const m=Qt;Qt=f;try{return a?a(e,3,[D]):e(D)}finally{Qt=m}}:b=mt,t&&o){const m=b,H=o===!0?1/0:o;b=()=>At(m(),H)}const T=Oa(),$=()=>{f.stop(),T&&T.active&&Co(T.effects,f)};if(l&&t){const m=t;t=(...H)=>{const C=m(...H);return $(),C}}let x=R?new Array(e.length).fill(is):is;const w=m=>{if(!(!(f.flags&1)||!f.dirty&&!m))if(t){const H=f.run();if(m||o||I||(R?H.some((C,L)=>ht(C,x[L])):ht(H,x))){A&&A();const C=Qt;Qt=f;try{const L=[H,x===is?void 0:R&&x[0]===is?[]:x,D];x=H,a?a(t,3,L):t(...L)}finally{Qt=C}}}else f.run()};return u&&u(w),f=new tl(b),f.scheduler=r?()=>r(w,!1):w,D=m=>nr(m,!1,f),A=f.onStop=()=>{const m=hs.get(f);if(m){if(a)a(m,4);else for(const H of m)H();hs.delete(f)}},t?s?w(!0):x=f.run():r?r(w.bind(null,!0),!0):f.run(),$.pause=f.pause.bind(f),$.resume=f.resume.bind(f),$.stop=$,$}function At(e,t=1/0,n){if(t<=0||!ge(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,Le(e))At(e.value,t,n);else if(ee(e))for(let s=0;s<e.length;s++)At(e[s],t,n);else if(sn(e)||Vt(e))e.forEach(s=>{At(s,t,n)});else if(Ji(e)){for(const s in e)At(e[s],t,n);for(const s of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,s)&&At(e[s],t,n)}return e}function Jn(e,t,n,s){try{return s?e(...s):e()}catch(o){Ls(o,t,n)}}function ot(e,t,n,s){if(ne(e)){const o=Jn(e,t,n,s);return o&&zi(o)&&o.catch(l=>{Ls(l,t,n)}),o}if(ee(e)){const o=[];for(let l=0;l<e.length;l++)o.push(ot(e[l],t,n,s));return o}}function Ls(e,t,n,s=!0){const o=t?t.vnode:null,{errorHandler:l,throwUnhandledErrorInProduction:r}=t&&t.appContext.config||be;if(t){let u=t.parent;const a=t.proxy,c=`https://vuejs.org/error-reference/#runtime-${n}`;for(;u;){const f=u.ec;if(f){for(let b=0;b<f.length;b++)if(f[b](e,a,c)===!1)return}u=u.parent}if(l){Pt(),Jn(l,null,10,[e,a,c]),Ot();return}}or(e,n,o,s,r)}function or(e,t,n,s=!0,o=!1){if(o)throw e;console.error(e)}const Re=[];let ct=-1;const cn=[];let Nt=null,un=0;const ml=Promise.resolve();let vs=null;function Lo(e){const t=vs||ml;return e?t.then(this?e.bind(this):e):t}function ir(e){let t=ct+1,n=Re.length;for(;t<n;){const s=t+n>>>1,o=Re[s],l=jn(o);l<e||l===e&&o.flags&2?t=s+1:n=s}return t}function Fo(e){if(!(e.flags&1)){const t=jn(e),n=Re[Re.length-1];!n||!(e.flags&2)&&t>=jn(n)?Re.push(e):Re.splice(ir(t),0,e),e.flags|=1,gl()}}function gl(){vs||(vs=ml.then(bl))}function lr(e){if(!ee(e))Nt&&e.id===-1?Nt.splice(un+1,0,e):e.flags&1||(cn.push(e),e.flags|=1);else for(let t=0;t<e.length;t++)cn.push(e[t]);gl()}function li(e,t,n=ct+1){for(;n<Re.length;n++){const s=Re[n];if(s&&s.flags&2){if(e&&s.id!==e.uid)continue;Re.splice(n,1),n--,s.flags&4&&(s.flags&=-2),s(),s.flags&4||(s.flags&=-2)}}}function yl(e){if(cn.length){const t=[...new Set(cn)].sort((n,s)=>jn(n)-jn(s));if(cn.length=0,Nt){for(let n=0;n<t.length;n++)Nt.push(t[n]);return}for(Nt=t,un=0;un<Nt.length;un++){const n=Nt[un];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Nt=null,un=0}}const jn=e=>e.id==null?e.flags&2?-1:1/0:e.id;function bl(e){try{for(ct=0;ct<Re.length;ct++){const t=Re[ct];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),Jn(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;ct<Re.length;ct++){const t=Re[ct];t&&(t.flags&=-2)}ct=-1,Re.length=0,yl(),vs=null,(Re.length||cn.length)&&bl()}}let qe=null,wl=null;function ms(e){const t=qe;return qe=e,wl=e&&e.type.__scopeId||null,t}function ar(e,t=qe,n){if(!t||e._n)return e;const s=(...o)=>{s._d&&yi(-1);const l=ms(t),r=nn.length;let u;try{u=e(...o)}finally{for(let a=nn.length;a>r;a--)Kl();ms(l),s._d&&yi(1)}return u};return s._n=!0,s._c=!0,s._d=!0,s}function Te(e,t){if(qe===null)return e;const n=js(qe),s=e.dirs||(e.dirs=[]);for(let o=0;o<t.length;o++){let[l,r,u,a=be]=t[o];l&&(ne(l)&&(l={mounted:l,updated:l}),l.deep&&At(r),s.push({dir:l,instance:n,value:r,oldValue:void 0,arg:u,modifiers:a}))}return e}function Jt(e,t,n,s){const o=e.dirs,l=t&&t.dirs;for(let r=0;r<o.length;r++){const u=o[r];l&&(u.oldValue=l[r].value);let a=u.dir[s];a&&(Pt(),ot(a,n,8,[e.el,u,e,t]),Ot())}}function rr(e,t){if(Me){let n=Me.provides;const s=Me.parent&&Me.parent.provides;s===n&&(n=Me.provides=Object.create(s)),n[e]=t}}function us(e,t,n=!1){const s=iu();if(s||dn){let o=dn?dn._context.provides:s?s.parent==null||s.ce?s.vnode.appContext&&s.vnode.appContext.provides:s.parent.provides:void 0;if(o&&e in o)return o[e];if(arguments.length>1)return n&&ne(t)?t.call(s&&s.proxy):t}}const ur=Symbol.for("v-scx"),cr=()=>us(ur);function In(e,t,n){return _l(e,t,n)}function _l(e,t,n=be){const{immediate:s,deep:o,flush:l,once:r}=n,u=Oe({},n),a=t&&s||!t&&l!=="post";let c;if(Vn){if(l==="sync"){const D=cr();c=D.__watcherHandles||(D.__watcherHandles=[])}else if(!a){const D=()=>{};return D.stop=mt,D.resume=mt,D.pause=mt,D}}const f=Me;u.call=(D,I,R)=>ot(D,f,I,R);let b=!1;l==="post"?u.scheduler=D=>{Ue(D,f&&f.suspense)}:l!=="sync"&&(b=!0,u.scheduler=(D,I)=>{I?D():Fo(D)}),u.augmentJob=D=>{t&&(D.flags|=4),b&&(D.flags|=2,f&&(D.id=f.uid,D.i=f))};const A=sr(e,t,u);return Vn&&(c?c.push(A):a&&A()),A}function dr(e,t,n){const s=this.proxy,o=xe(e)?e.includes(".")?kl(s,e):()=>s[e]:e.bind(s,s);let l;ne(t)?l=t:(l=t.handler,n=t);const r=Qn(this),u=_l(o,l.bind(s),n);return r(),u}function kl(e,t){const n=t.split(".");return()=>{let s=e;for(let o=0;o<n.length&&s;o++)s=s[n[o]];return s}}const fr=Symbol("_vte"),Fs=e=>e.__isTeleport,Ys=Symbol("_leaveCb");function pr(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==It){t=n;break}}return t}function $l(e){if(!Ro(e))return Fs(e.type)&&e.children?pr(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&ne(n.default))return n.default()}}function Ho(e,t){if(e.shapeFlag&6&&e.component){e.transition=t;const n=e.component.subTree;Ho(Fs(n.type)&&$l(n)||n,t)}else e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function $e(e,t){return ne(e)?Oe({name:e.name},t,{setup:e}):e}function xl(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function ai(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const gs=new WeakMap;function Mn(e,t,n,s,o=!1){if(ee(e)){e.forEach((R,T)=>Mn(R,t&&(ee(t)?t[T]:t),n,s,o));return}if(Dn(s)&&!o){s.shapeFlag&512&&s.type.__asyncResolved&&s.component.subTree.component&&Mn(e,t,n,s.component.subTree);return}const l=s.shapeFlag&4?js(s.component):s.el,r=o?null:l,{i:u,r:a}=e,c=t&&t.r,f=u.refs===be?u.refs={}:u.refs,b=u.setupState,A=he(b),D=b===be?Yi:R=>ai(f,R)?!1:ve(A,R),I=(R,T)=>!(T&&ai(f,T));if(c!=null&&c!==a){if(ri(t),xe(c))f[c]=null,D(c)&&(b[c]=null);else if(Le(c)){const R=t;I(c,R.k)&&(c.value=null),R.k&&(f[R.k]=null)}}if(ne(a))Jn(a,u,12,[r,f]);else{const R=xe(a),T=Le(a);if(R||T){const $=()=>{if(e.f){const x=R?D(a)?b[a]:f[a]:I()||!e.k?a.value:f[e.k];if(o)ee(x)&&Co(x,l);else if(ee(x))x.includes(l)||x.push(l);else if(R)f[a]=[l],D(a)&&(b[a]=f[a]);else{const w=[l];I(a,e.k)&&(a.value=w),e.k&&(f[e.k]=w)}}else R?(f[a]=r,D(a)&&(b[a]=r)):T&&(I(a,e.k)&&(a.value=r),e.k&&(f[e.k]=r))};if(r){const x=()=>{$(),gs.delete(e)};x.id=-1,gs.set(e,x),Ue(x,n)}else ri(e),$()}}}function ri(e){const t=gs.get(e);t&&(t.flags|=8,gs.delete(e))}Ms().requestIdleCallback;Ms().cancelIdleCallback;const Dn=e=>!!e.type.__asyncLoader,Ro=e=>e.type.__isKeepAlive;function hr(e,t){Sl(e,"a",t)}function vr(e,t){Sl(e,"da",t)}function Sl(e,t,n=Me){const s=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(Hs(t,s,n),n){let o=n.parent;for(;o&&o.parent;)Ro(o.parent.vnode)&&mr(s,t,n,o),o=o.parent}}function mr(e,t,n,s){const o=Hs(t,e,s,!0);Cl(()=>{Co(s[t],o)},n)}function Hs(e,t,n=Me,s=!1){if(n){const o=n[e]||(n[e]=[]),l=t.__weh||(t.__weh=(...r)=>{Pt();const u=Qn(n),a=ot(t,n,e,r);return u(),Ot(),a});return s?o.unshift(l):o.push(l),l}}const Lt=e=>(t,n=Me)=>{(!Vn||e==="sp")&&Hs(e,(...s)=>t(...s),n)},gr=Lt("bm"),bn=Lt("m"),yr=Lt("bu"),br=Lt("u"),Xn=Lt("bum"),Cl=Lt("um"),wr=Lt("sp"),_r=Lt("rtg"),kr=Lt("rtc");function $r(e,t=Me){Hs("ec",e,t)}const xr="components",Tl=Symbol.for("v-ndc");function Sr(e){return xe(e)?Cr(xr,e,!1)||e:e||Tl}function Cr(e,t,n=!0,s=!1){const o=qe||Me;if(o){const l=o.type;{const u=cu(l,!1);if(u&&(u===t||u===Be(t)||u===Os(Be(t))))return l}const r=ui(o[e]||l[e],t)||ui(o.appContext[e],t);return!r&&s?l:r}}function ui(e,t){return e&&(e[t]||e[Be(t)]||e[Os(Be(t))])}function le(e,t,n,s){let o;const l=n,r=ee(e);if(r||xe(e)){const u=r&&Wt(e);let a=!1,c=!1;u&&(a=!Xe(e),c=bt(e),e=Ds(e)),o=new Array(e.length);for(let f=0,b=e.length;f<b;f++)o[f]=t(a?c?Kt(Ze(e[f])):Ze(e[f]):e[f],f,void 0,l)}else if(typeof e=="number"){o=new Array(e);for(let u=0;u<e;u++)o[u]=t(u+1,u,void 0,l)}else if(ge(e))if(e[Symbol.iterator])o=Array.from(e,(u,a)=>t(u,a,void 0,l));else{const u=Object.keys(e);o=new Array(u.length);for(let a=0,c=u.length;a<c;a++){const f=u[a];o[a]=t(e[f],f,a,l)}}else o=[];return o}const co=e=>e?Gl(e)?js(e):co(e.parent):null,Ln=Oe(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>co(e.parent),$root:e=>co(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>El(e),$forceUpdate:e=>e.f||(e.f=()=>{Fo(e.update)}),$nextTick:e=>e.n||(e.n=Lo.bind(e.proxy)),$watch:e=>dr.bind(e)}),zs=(e,t)=>e!==be&&!e.__isScriptSetup&&ve(e,t),Tr={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:s,data:o,props:l,accessCache:r,type:u,appContext:a}=e;if(t[0]!=="$"){const A=r[t];if(A!==void 0)switch(A){case 1:return s[t];case 2:return o[t];case 4:return n[t];case 3:return l[t]}else{if(zs(s,t))return r[t]=1,s[t];if(o!==be&&ve(o,t))return r[t]=2,o[t];if(ve(l,t))return r[t]=3,l[t];if(n!==be&&ve(n,t))return r[t]=4,n[t];fo&&(r[t]=0)}}const c=Ln[t];let f,b;if(c)return t==="$attrs"&&Ie(e.attrs,"get",""),c(e);if((f=u.__cssModules)&&(f=f[t]))return f;if(n!==be&&ve(n,t))return r[t]=4,n[t];if(b=a.config.globalProperties,ve(b,t))return b[t]},set({_:e},t,n){const{data:s,setupState:o,ctx:l}=e;return zs(o,t)?(o[t]=n,!0):s!==be&&ve(s,t)?(s[t]=n,!0):ve(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(l[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:s,appContext:o,props:l,type:r}},u){let a;return!!(n[u]||e!==be&&u[0]!=="$"&&ve(e,u)||zs(t,u)||ve(l,u)||ve(s,u)||ve(Ln,u)||ve(o.config.globalProperties,u)||(a=r.__cssModules)&&a[u])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:ve(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function ci(e){return ee(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let fo=!0;function Ar(e){const t=El(e),n=e.proxy,s=e.ctx;fo=!1,t.beforeCreate&&di(t.beforeCreate,e,"bc");const{data:o,computed:l,methods:r,watch:u,provide:a,inject:c,created:f,beforeMount:b,mounted:A,beforeUpdate:D,updated:I,activated:R,deactivated:T,beforeDestroy:$,beforeUnmount:x,destroyed:w,unmounted:m,render:H,renderTracked:C,renderTriggered:L,errorCaptured:pe,serverPrefetch:Ae,expose:J,inheritAttrs:q,components:ae,directives:z,filters:B}=t;if(c&&Er(c,s,null),r)for(const ie in r){const ue=r[ie];ne(ue)&&(s[ie]=ue.bind(n))}if(o){const ie=o.call(n,n);ge(ie)&&(e.data=hn(ie))}if(fo=!0,l)for(const ie in l){const ue=l[ie],ze=ne(ue)?ue.bind(n,n):ne(ue.get)?ue.get.bind(n,n):mt,an=!ne(ue)&&ne(ue.set)?ue.set.bind(n):mt,_t=k({get:ze,set:an});Object.defineProperty(s,ie,{enumerable:!0,configurable:!0,get:()=>_t.value,set:We=>_t.value=We})}if(u)for(const ie in u)Al(u[ie],s,n,ie);if(a){const ie=ne(a)?a.call(n):a;Reflect.ownKeys(ie).forEach(ue=>{rr(ue,ie[ue])})}f&&di(f,e,"c");function oe(ie,ue){ee(ue)?ue.forEach(ze=>ie(ze.bind(n))):ue&&ie(ue.bind(n))}if(oe(gr,b),oe(bn,A),oe(yr,D),oe(br,I),oe(hr,R),oe(vr,T),oe($r,pe),oe(kr,C),oe(_r,L),oe(Xn,x),oe(Cl,m),oe(wr,Ae),ee(J))if(J.length){const ie=e.exposed||(e.exposed={});J.forEach(ue=>{Object.defineProperty(ie,ue,{get:()=>n[ue],set:ze=>n[ue]=ze,enumerable:!0})})}else e.exposed||(e.exposed={});H&&e.render===mt&&(e.render=H),q!=null&&(e.inheritAttrs=q),ae&&(e.components=ae),z&&(e.directives=z),Ae&&xl(e)}function Er(e,t,n=mt){ee(e)&&(e=po(e));for(const s in e){const o=e[s];let l;ge(o)?"default"in o?l=us(o.from||s,o.default,!0):l=us(o.from||s):l=us(o),Le(l)?Object.defineProperty(t,s,{enumerable:!0,configurable:!0,get:()=>l.value,set:r=>l.value=r}):t[s]=l}}function di(e,t,n){ot(ee(e)?e.map(s=>s.bind(t.proxy)):e.bind(t.proxy),t,n)}function Al(e,t,n,s){let o=s.includes(".")?kl(n,s):()=>n[s];if(xe(e)){const l=t[e];ne(l)&&In(o,l)}else if(ne(e))In(o,e.bind(n));else if(ge(e))if(ee(e))e.forEach(l=>Al(l,t,n,s));else{const l=ne(e.handler)?e.handler.bind(n):t[e.handler];ne(l)&&In(o,l,e)}}function El(e){const t=e.type,{mixins:n,extends:s}=t,{mixins:o,optionsCache:l,config:{optionMergeStrategies:r}}=e.appContext,u=l.get(t);let a;return u?a=u:!o.length&&!n&&!s?a=t:(a={},o.length&&o.forEach(c=>ys(a,c,r,!0)),ys(a,t,r)),ge(t)&&l.set(t,a),a}function ys(e,t,n,s=!1){const{mixins:o,extends:l}=t;l&&ys(e,l,n,!0),o&&o.forEach(r=>ys(e,r,n,!0));for(const r in t)if(!(s&&r==="expose")){const u=Pr[r]||n&&n[r];e[r]=u?u(e[r],t[r]):t[r]}return e}const Pr={data:fi,props:pi,emits:pi,methods:Sn,computed:Sn,beforeCreate:Fe,created:Fe,beforeMount:Fe,mounted:Fe,beforeUpdate:Fe,updated:Fe,beforeDestroy:Fe,beforeUnmount:Fe,destroyed:Fe,unmounted:Fe,activated:Fe,deactivated:Fe,errorCaptured:Fe,serverPrefetch:Fe,components:Sn,directives:Sn,watch:Ir,provide:fi,inject:Or};function fi(e,t){return t?e?function(){return Oe(ne(e)?e.call(this,this):e,ne(t)?t.call(this,this):t)}:t:e}function Or(e,t){return Sn(po(e),po(t))}function po(e){if(ee(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Fe(e,t){return e?[...new Set([].concat(e,t))]:t}function Sn(e,t){return e?Oe(Object.create(null),e,t):t}function pi(e,t){return e?ee(e)&&ee(t)?[...new Set([...e,...t])]:Oe(Object.create(null),ci(e),ci(t??{})):t}function Ir(e,t){if(!e)return t;if(!t)return e;const n=Oe(Object.create(null),e);for(const s in t)n[s]=Fe(e[s],t[s]);return n}function Pl(){return{app:null,config:{isNativeTag:Yi,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let Mr=0;function Dr(e,t){return function(s,o=null){ne(s)||(s=Oe({},s)),o!=null&&!ge(o)&&(o=null);const l=Pl(),r=new WeakSet,u=[];let a=!1;const c=l.app={_uid:Mr++,_component:s,_props:o,_container:null,_context:l,_instance:null,version:fu,get config(){return l.config},set config(f){},use(f,...b){return r.has(f)||(f&&ne(f.install)?(r.add(f),f.install(c,...b)):ne(f)&&(r.add(f),f(c,...b))),c},mixin(f){return l.mixins.includes(f)||l.mixins.push(f),c},component(f,b){return b?(l.components[f]=b,c):l.components[f]},directive(f,b){return b?(l.directives[f]=b,c):l.directives[f]},mount(f,b,A){if(!a){const D=c._ceVNode||_e(s,o);return D.appContext=l,A===!0?A="svg":A===!1&&(A=void 0),e(D,f,A),a=!0,c._container=f,f.__vue_app__=c,js(D.component)}},onUnmount(f){u.push(f)},unmount(){a&&(ot(u,c._instance,16),e(null,c._container),delete c._container.__vue_app__)},provide(f,b){return l.provides[f]=b,c},runWithContext(f){const b=dn;dn=c;try{return f()}finally{dn=b}}};return c}}let dn=null;const Lr=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${Be(t)}Modifiers`]||e[`${Yt(t)}Modifiers`];function Fr(e,t,...n){if(e.isUnmounted)return;const s=e.vnode.props||be;let o=n;const l=t.startsWith("update:"),r=l&&Lr(s,t.slice(7));r&&(r.trim&&(o=n.map(f=>xe(f)?f.trim():f)),r.number&&(o=o.map(Is)));let u,a=s[u=Us(t)]||s[u=Us(Be(t))];!a&&l&&(a=s[u=Us(Yt(t))]),a&&ot(a,e,6,o);const c=s[u+"Once"];if(c){if(!e.emitted)e.emitted={};else if(e.emitted[u])return;e.emitted[u]=!0,ot(c,e,6,o)}}const Hr=new WeakMap;function Ol(e,t,n=!1){const s=n?Hr:t.emitsCache,o=s.get(e);if(o!==void 0)return o;const l=e.emits;let r={},u=!1;if(!ne(e)){const a=c=>{const f=Ol(c,t,!0);f&&(u=!0,Oe(r,f))};!n&&t.mixins.length&&t.mixins.forEach(a),e.extends&&a(e.extends),e.mixins&&e.mixins.forEach(a)}return!l&&!u?(ge(e)&&s.set(e,null),null):(ee(l)?l.forEach(a=>r[a]=null):Oe(r,l),ge(e)&&s.set(e,r),r)}function Rs(e,t){return!e||!As(t)?!1:(t=t.slice(2),t=t==="Once"?t:t.replace(/Once$/,""),ve(e,t[0].toLowerCase()+t.slice(1))||ve(e,Yt(t))||ve(e,t))}function hi(e){const{type:t,vnode:n,proxy:s,withProxy:o,propsOptions:[l],slots:r,attrs:u,emit:a,render:c,renderCache:f,props:b,data:A,setupState:D,ctx:I,inheritAttrs:R}=e,T=ms(e);let $,x;try{if(n.shapeFlag&4){const m=o||s,H=m;$=pt(c.call(H,m,f,b,D,A,I)),x=u}else{const m=t;$=pt(m.length>1?m(b,{attrs:u,slots:r,emit:a}):m(b,null)),x=t.props?u:Rr(u)}}catch(m){nn.length=0,Ls(m,e,1),$=_e(It)}let w=$;if(x&&R!==!1){const m=Object.keys(x),{shapeFlag:H}=w;m.length&&H&7&&(l&&m.some(Es)&&(x=Nr(x,l)),w=vn(w,x,!1,!0))}if(n.dirs&&(w=vn(w,null,!1,!0),w.dirs=w.dirs?w.dirs.concat(n.dirs):n.dirs),n.transition){const m=Fs(w.type)&&$l(w)||w;Ho(m,n.transition)}return $=w,ms(T),$}const Rr=e=>{let t;for(const n in e)(n==="class"||n==="style"||As(n))&&((t||(t={}))[n]=e[n]);return t},Nr=(e,t)=>{const n={};for(const s in e)(!Es(s)||!(s.slice(9)in t))&&(n[s]=e[s]);return n};function jr(e,t,n){const{props:s,children:o,component:l}=e,{props:r,children:u,patchFlag:a}=t,c=l.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&a>=0){if(a&1024)return!0;if(a&16)return s?vi(s,r,c):!!r;if(a&8){const f=t.dynamicProps;for(let b=0;b<f.length;b++){const A=f[b];if(Il(r,s,A)&&!Rs(c,A))return!0}}}else return(o||u)&&(!u||!u.$stable)?!0:s===r?!1:s?r?vi(s,r,c):!0:!!r;return!1}function vi(e,t,n){const s=Object.keys(t);if(s.length!==Object.keys(e).length)return!0;for(let o=0;o<s.length;o++){const l=s[o];if(Il(t,e,l)&&!Rs(n,l))return!0}return!1}function Il(e,t,n){const s=e[n],o=t[n];return n==="style"&&ge(s)&&ge(o)?!yt(s,o):s!==o}function Br({vnode:e,parent:t,suspense:n},s){for(;t;){const o=t.subTree;if(o.suspense&&o.suspense.activeBranch===e&&(o.suspense.vnode.el=o.el=s,e=o),o===e)(e=t.vnode).el=s,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=s)}const Ml={},Dl=()=>Object.create(Ml),Ll=e=>Object.getPrototypeOf(e)===Ml;function Ur(e,t,n,s=!1){const o={},l=Dl();e.propsDefaults=Object.create(null),Fl(e,t,o,l);for(const r in e.propsOptions[0])r in o||(o[r]=void 0);n?e.props=s?o:Ga(o):e.type.props?e.props=o:e.props=l,e.attrs=l}function Vr(e,t,n,s){const{props:o,attrs:l,vnode:{patchFlag:r}}=e,u=he(o),[a]=e.propsOptions;let c=!1;if((s||r>0)&&!(r&16)){if(r&8){const f=e.vnode.dynamicProps;for(let b=0;b<f.length;b++){let A=f[b];if(Rs(e.emitsOptions,A))continue;const D=t[A];if(a)if(ve(l,A))D!==l[A]&&(l[A]=D,c=!0);else{const I=Be(A);o[I]=ho(a,u,I,D,e,!1)}else D!==l[A]&&(l[A]=D,c=!0)}}}else{Fl(e,t,o,l)&&(c=!0);let f;for(const b in u)(!t||!ve(t,b)&&((f=Yt(b))===b||!ve(t,f)))&&(a?n&&(n[b]!==void 0||n[f]!==void 0)&&(o[b]=ho(a,u,b,void 0,e,!0)):delete o[b]);if(l!==u)for(const b in l)(!t||!ve(t,b))&&(delete l[b],c=!0)}c&&Tt(e.attrs,"set","")}function Fl(e,t,n,s){const[o,l]=e.propsOptions;let r=!1,u;if(t)for(let a in t){if(En(a))continue;const c=t[a];let f;o&&ve(o,f=Be(a))?!l||!l.includes(f)?n[f]=c:(u||(u={}))[f]=c:Rs(e.emitsOptions,a)||(!(a in s)||c!==s[a])&&(s[a]=c,r=!0)}if(l){const a=he(n),c=u||be;for(let f=0;f<l.length;f++){const b=l[f];n[b]=ho(o,a,b,c[b],e,!ve(c,b))}}return r}function ho(e,t,n,s,o,l){const r=e[n];if(r!=null){const u=ve(r,"default");if(u&&s===void 0){const a=r.default;if(r.type!==Function&&!r.skipFactory&&ne(a)){const{propsDefaults:c}=o;if(n in c)s=c[n];else{const f=Qn(o);s=c[n]=a.call(null,t),f()}}else s=a;o.ce&&o.ce._setProp(n,s)}r[0]&&(l&&!u?s=!1:r[1]&&(s===""||s===Yt(n))&&(s=!0))}return s}const Wr=new WeakMap;function Hl(e,t,n=!1){const s=n?Wr:t.propsCache,o=s.get(e);if(o)return o;const l=e.props,r={},u=[];let a=!1;if(!ne(e)){const f=b=>{a=!0;const[A,D]=Hl(b,t,!0);Oe(r,A),D&&u.push(...D)};!n&&t.mixins.length&&t.mixins.forEach(f),e.extends&&f(e.extends),e.mixins&&e.mixins.forEach(f)}if(!l&&!a)return ge(e)&&s.set(e,en),en;if(ee(l))for(let f=0;f<l.length;f++){const b=Be(l[f]);mi(b)&&(r[b]=be)}else if(l)for(const f in l){const b=Be(f);if(mi(b)){const A=l[f],D=r[b]=ee(A)||ne(A)?{type:A}:Oe({},A),I=D.type;let R=!1,T=!0;if(ee(I))for(let $=0;$<I.length;++$){const x=I[$],w=ne(x)&&x.name;if(w==="Boolean"){R=!0;break}else w==="String"&&(T=!1)}else R=ne(I)&&I.name==="Boolean";D[0]=R,D[1]=T,(R||ve(D,"default"))&&u.push(b)}}const c=[r,u];return ge(e)&&s.set(e,c),c}function mi(e){return e[0]!=="$"&&!En(e)}const No=e=>e==="_"||e==="_ctx"||e==="$stable",jo=e=>ee(e)?e.map(pt):[pt(e)],Kr=(e,t,n)=>{if(t._n)return t;const s=ar((...o)=>jo(t(...o)),n);return s._c=!1,s},Rl=(e,t,n)=>{const s=e._ctx;for(const o in e){if(No(o))continue;const l=e[o];if(ne(l))t[o]=Kr(o,l,s);else if(l!=null){const r=jo(l);t[o]=()=>r}}},Nl=(e,t)=>{const n=jo(t);e.slots.default=()=>n},jl=(e,t,n)=>{for(const s in t)(n||!No(s))&&(e[s]=t[s])},qr=(e,t,n)=>{const s=e.slots=Dl();if(e.vnode.shapeFlag&32){const o=t._;o?(jl(s,t,n),n&&Xi(s,"_",o,!0)):Rl(t,s)}else t&&Nl(e,t)},Yr=(e,t,n)=>{const{vnode:s,slots:o}=e;let l=!0,r=be;if(s.shapeFlag&32){const u=t._;u?n&&u===1?l=!1:jl(o,t,n):(l=!t.$stable,Rl(t,o)),r=t}else t&&(Nl(e,t),r={default:1});if(l)for(const u in o)!No(u)&&r[u]==null&&delete o[u]},Ue=Qr;function zr(e){return Gr(e)}function Gr(e,t){const n=Ms();n.__VUE__=!0;const{insert:s,remove:o,patchProp:l,createElement:r,createText:u,createComment:a,setText:c,setElementText:f,parentNode:b,nextSibling:A,setScopeId:D=mt,insertStaticContent:I}=e,R=(p,_,S,F=null,E=null,O=null,U=void 0,j=null,N=!!_.dynamicChildren)=>{if(p===_)return;p&&!$n(p,_)&&(F=se(p),We(p,E,O,!0),p=null),_.patchFlag===-2&&(N=!1,_.dynamicChildren=null),_.dynamicChildren&&p&&p.dynamicChildren&&p.dynamicChildren.hasOnce&&(_.dynamicChildren===en&&(_.dynamicChildren=[]),_.dynamicChildren.hasOnce=!0);const{type:P,ref:X,shapeFlag:K}=_;switch(P){case Ns:T(p,_,S,F);break;case It:$(p,_,S,F);break;case cs:p==null&&x(_,S,F,U);break;case W:ae(p,_,S,F,E,O,U,j,N);break;default:K&1?H(p,_,S,F,E,O,U,j,N):K&6?z(p,_,S,F,E,O,U,j,N):(K&64||K&128)&&P.process(p,_,S,F,E,O,U,j,N,Gt)}X!=null&&E?Mn(X,p&&p.ref,O,_||p,!_):X==null&&p&&p.ref!=null&&Mn(p.ref,null,O,p,!0)},T=(p,_,S,F)=>{if(p==null)s(_.el=u(_.children),S,F);else{const E=_.el=p.el;_.children!==p.children&&c(E,_.children)}},$=(p,_,S,F)=>{p==null?s(_.el=a(_.children||""),S,F):_.el=p.el},x=(p,_,S,F)=>{[p.el,p.anchor]=I(p.children,_,S,F,p.el,p.anchor)},w=({el:p,anchor:_},S,F)=>{let E;for(;p&&p!==_;)E=A(p),s(p,S,F),p=E;s(_,S,F)},m=({el:p,anchor:_})=>{let S;for(;p&&p!==_;)S=A(p),o(p),p=S;o(_)},H=(p,_,S,F,E,O,U,j,N)=>{if(_.type==="svg"?U="svg":_.type==="math"&&(U="mathml"),p==null)C(_,S,F,E,O,U,j,N);else{const P=p.el&&p.el._isVueCE?p.el:null;try{P&&P._beginPatch(),Ae(p,_,E,O,U,j,N)}finally{P&&P._endPatch()}}},C=(p,_,S,F,E,O,U,j)=>{let N,P;const{props:X,shapeFlag:K,transition:G,dirs:te}=p;if(N=p.el=r(p.type,O,X&&X.is,X),K&8?f(N,p.children):K&16&&pe(p.children,N,null,F,E,Gs(p,O),U,j),te&&Jt(p,null,F,"created"),L(N,p,p.scopeId,U,F),X){for(const ye in X)ye!=="value"&&!En(ye)&&l(N,ye,null,X[ye],O,F);"value"in X&&l(N,"value",null,X.value,O),(P=X.onVnodeBeforeMount)&&ut(P,F,p)}te&&Jt(p,null,F,"beforeMount");const de=Jr(E,G);de&&G.beforeEnter(N),s(N,_,S),((P=X&&X.onVnodeMounted)||de||te)&&Ue(()=>{P&&ut(P,F,p),de&&G.enter(N),te&&Jt(p,null,F,"mounted")},E)},L=(p,_,S,F,E)=>{if(S&&D(p,S),F)for(let O=0;O<F.length;O++)D(p,F[O]);if(E){let O=E.subTree;if(_===O||Wl(O.type)&&(O.ssContent===_||O.ssFallback===_)){const U=E.vnode;L(p,U,U.scopeId,U.slotScopeIds,E.parent)}}},pe=(p,_,S,F,E,O,U,j,N=0)=>{for(let P=N;P<p.length;P++){const X=p[P]=j?St(p[P]):pt(p[P]);R(null,X,_,S,F,E,O,U,j)}},Ae=(p,_,S,F,E,O,U)=>{const j=_.el=p.el;let{patchFlag:N,dynamicChildren:P,dirs:X}=_;N|=p.patchFlag&16;const K=p.props||be,G=_.props||be;let te;if(S&&Xt(S,!1),(te=G.onVnodeBeforeUpdate)&&ut(te,S,_,p),X&&Jt(_,p,S,"beforeUpdate"),S&&Xt(S,!0),P&&(!p.dynamicChildren||p.dynamicChildren.length!==P.length)&&(N=0,U=!1,P=null),(K.innerHTML&&G.innerHTML==null||K.textContent&&G.textContent==null)&&f(j,""),P?J(p.dynamicChildren,P,j,S,F,Gs(_,E),O):U||ue(p,_,j,null,S,F,Gs(_,E),O,!1),N>0){if(N&16)q(j,K,G,S,E);else if(N&2&&K.class!==G.class&&l(j,"class",null,G.class,E),N&4&&l(j,"style",K.style,G.style,E),N&8){const de=_.dynamicProps;for(let ye=0;ye<de.length;ye++){const me=de[ye],Ce=K[me],Ee=G[me];(Ee!==Ce||me==="value")&&l(j,me,Ce,Ee,E,S)}}N&1&&p.children!==_.children&&f(j,_.children)}else!U&&P==null&&q(j,K,G,S,E);((te=G.onVnodeUpdated)||X)&&Ue(()=>{te&&ut(te,S,_,p),X&&Jt(_,p,S,"updated")},F)},J=(p,_,S,F,E,O,U)=>{for(let j=0;j<_.length;j++){const N=p[j],P=_[j],X=N.el&&(N.type===W||!$n(N,P)||N.shapeFlag&198)?b(N.el):S;R(N,P,X,null,F,E,O,U,!0)}},q=(p,_,S,F,E)=>{if(_!==S){if(_!==be)for(const O in _)!En(O)&&!(O in S)&&l(p,O,_[O],null,E,F);for(const O in S){if(En(O))continue;const U=S[O],j=_[O];U!==j&&O!=="value"&&l(p,O,j,U,E,F)}"value"in S&&l(p,"value",_.value,S.value,E)}},ae=(p,_,S,F,E,O,U,j,N)=>{const P=_.el=p?p.el:u(""),X=_.anchor=p?p.anchor:u("");let{patchFlag:K,dynamicChildren:G,slotScopeIds:te}=_;te&&(j=j?j.concat(te):te),p==null?(s(P,S,F),s(X,S,F),pe(_.children||[],S,X,E,O,U,j,N)):K>0&&K&64&&G&&p.dynamicChildren&&p.dynamicChildren.length===G.length?(J(p.dynamicChildren,G,S,E,O,U,j),(_.key!=null||E&&_===E.subTree)&&Bl(p,_,!0)):ue(p,_,S,X,E,O,U,j,N)},z=(p,_,S,F,E,O,U,j,N)=>{_.slotScopeIds=j,p==null?_.shapeFlag&512?E.ctx.activate(_,S,F,U,N):B(_,S,F,E,O,U,N):Y(p,_,N)},B=(p,_,S,F,E,O,U)=>{const j=p.component=ou(p,F,E);if(Ro(p)&&(j.ctx.renderer=Gt),lu(j,!1,U),j.asyncDep){if(E&&E.registerDep(j,oe,U),!p.el){const N=j.subTree=_e(It);$(null,N,_,S),p.placeholder=N.el}}else oe(j,p,_,S,E,O,U)},Y=(p,_,S)=>{const F=_.component=p.component;if(jr(p,_,S))if(F.asyncDep&&!F.asyncResolved){_.el=p.el,ie(F,_,S);return}else F.next=_,F.update();else _.el=p.el,F.vnode=_},oe=(p,_,S,F,E,O,U)=>{const j=()=>{if(p.isMounted){let{next:K,bu:G,u:te,parent:de,vnode:ye}=p;{const at=Ul(p);if(at){K&&(K.el=ye.el,ie(p,K,U)),at.asyncDep.then(()=>{Ue(()=>{p.isUnmounted||P()},E)});return}}let me=K,Ce;Xt(p,!1),K?(K.el=ye.el,ie(p,K,U)):K=ye,G&&rs(G),(Ce=K.props&&K.props.onVnodeBeforeUpdate)&&ut(Ce,de,K,ye),Xt(p,!0);const Ee=hi(p),lt=p.subTree;p.subTree=Ee,R(lt,Ee,b(lt.el),se(lt),p,E,O),K.el=Ee.el,me===null&&Br(p,Ee.el),te&&Ue(te,E),(Ce=K.props&&K.props.onVnodeUpdated)&&Ue(()=>ut(Ce,de,K,ye),E)}else{let K;const{el:G,props:te}=_,{bm:de,m:ye,parent:me,root:Ce,type:Ee}=p,lt=Dn(_);Xt(p,!1),de&&rs(de),!lt&&(K=te&&te.onVnodeBeforeMount)&&ut(K,me,_),Xt(p,!0);{Ce.ce&&Ce.ce._hasShadowRoot()&&Ce.ce._injectChildStyle(Ee,p.parent?p.parent.type:void 0);const at=p.subTree=hi(p);R(null,at,S,F,p,E,O),_.el=at.el}if(ye&&Ue(ye,E),!lt&&(K=te&&te.onVnodeMounted)){const at=_;Ue(()=>ut(K,me,at),E)}(_.shapeFlag&256||me&&Dn(me.vnode)&&me.vnode.shapeFlag&256)&&p.a&&Ue(p.a,E),p.isMounted=!0,_=S=F=null}};p.scope.on();const N=p.effect=new tl(j);p.scope.off();const P=p.update=N.run.bind(N),X=p.job=N.runIfDirty.bind(N);X.i=p,X.id=p.uid,N.scheduler=()=>Fo(X),Xt(p,!0),P()},ie=(p,_,S)=>{_.component=p;const F=p.vnode.props;p.vnode=_,p.next=null,Vr(p,_.props,F,S),Yr(p,_.children,S),Pt(),li(p),Ot()},ue=(p,_,S,F,E,O,U,j,N=!1)=>{const P=p&&p.children,X=p?p.shapeFlag:0,K=_.children,{patchFlag:G,shapeFlag:te}=_;if(G>0){if(G&128){an(P,K,S,F,E,O,U,j,N);return}else if(G&256){ze(P,K,S,F,E,O,U,j,N);return}}te&8?(X&16&&M(P,E,O),K!==P&&f(S,K)):X&16?te&16?an(P,K,S,F,E,O,U,j,N):M(P,E,O,!0):(X&8&&f(S,""),te&16&&pe(K,S,F,E,O,U,j,N))},ze=(p,_,S,F,E,O,U,j,N)=>{p=p||en,_=_||en;const P=p.length,X=_.length,K=Math.min(P,X);let G;for(G=0;G<K;G++){const te=_[G]=N?St(_[G]):pt(_[G]);R(p[G],te,S,null,E,O,U,j,N)}P>X?M(p,E,O,!0,!1,K):pe(_,S,F,E,O,U,j,N,K)},an=(p,_,S,F,E,O,U,j,N)=>{let P=0;const X=_.length;let K=p.length-1,G=X-1;for(;P<=K&&P<=G;){const te=p[P],de=_[P]=N?St(_[P]):pt(_[P]);if($n(te,de))R(te,de,S,null,E,O,U,j,N);else break;P++}for(;P<=K&&P<=G;){const te=p[K],de=_[G]=N?St(_[G]):pt(_[G]);if($n(te,de))R(te,de,S,null,E,O,U,j,N);else break;K--,G--}if(P>K){if(P<=G){const te=G+1,de=te<X?_[te].el:F;for(;P<=G;)R(null,_[P]=N?St(_[P]):pt(_[P]),S,de,E,O,U,j,N),P++}}else if(P>G)for(;P<=K;)We(p[P],E,O,!0),P++;else{const te=P,de=P,ye=new Map;for(P=de;P<=G;P++){const Ke=_[P]=N?St(_[P]):pt(_[P]);Ke.key!=null&&ye.set(Ke.key,P)}let me,Ce=0;const Ee=G-de+1;let lt=!1,at=0;const _n=new Array(Ee);for(P=0;P<Ee;P++)_n[P]=0;for(P=te;P<=K;P++){const Ke=p[P];if(Ce>=Ee){We(Ke,E,O,!0);continue}let rt;if(Ke.key!=null)rt=ye.get(Ke.key);else for(me=de;me<=G;me++)if(_n[me-de]===0&&$n(Ke,_[me])){rt=me;break}rt===void 0?We(Ke,E,O,!0):(_n[rt-de]=P+1,rt>=at?at=rt:lt=!0,R(Ke,_[rt],S,null,E,O,U,j,N),Ce++)}const Xo=lt?Xr(_n):en;for(me=Xo.length-1,P=Ee-1;P>=0;P--){const Ke=de+P,rt=_[Ke],Qo=_[Ke+1],Zo=Ke+1<X?Qo.el||Vl(Qo):F;_n[P]===0?R(null,rt,S,Zo,E,O,U,j,N):lt&&(me<0||P!==Xo[me]?_t(rt,S,Zo,2):me--)}}},_t=(p,_,S,F,E=null)=>{const{el:O,type:U,transition:j,children:N,shapeFlag:P}=p;if(P&6){_t(p.component.subTree,_,S,F);return}if(P&128){p.suspense.move(_,S,F);return}if(P&64){U.move(p,_,S,Gt);return}if(U===W){s(O,_,S);for(let K=0;K<N.length;K++)_t(N[K],_,S,F);s(p.anchor,_,S);return}if(U===cs){w(p,_,S);return}if(F!==2&&P&1&&j)if(F===0)j.persisted&&!O[Ys]?s(O,_,S):(j.beforeEnter(O),s(O,_,S),Ue(()=>j.enter(O),E));else{const{leave:K,delayLeave:G,afterLeave:te}=j,de=()=>{p.ctx.isUnmounted?o(O):s(O,_,S)},ye=()=>{const me=O._isLeaving||!!O[Ys];O._isLeaving&&O[Ys](!0),j.persisted&&!me?de():K(O,()=>{de(),te&&te()})};G?G(O,de,ye):ye()}else s(O,_,S)},We=(p,_,S,F=!1,E=!1)=>{const{type:O,props:U,ref:j,children:N,dynamicChildren:P,shapeFlag:X,patchFlag:K,dirs:G,cacheIndex:te,memo:de}=p;if((K===-2||P&&P.hasOnce)&&(E=!1),j!=null&&(Pt(),Mn(j,null,S,p,!0),Ot()),te!=null&&(!p.ctx||p.ctx===_)&&(_.renderCache[te]=void 0),X&256){_.ctx.deactivate(p);return}const ye=X&1&&G,me=!Dn(p);let Ce;if(me&&(Ce=U&&U.onVnodeBeforeUnmount)&&ut(Ce,_,p),X&6)ce(p.component,S,F);else{if(X&128){p.suspense.unmount(S,F);return}ye&&Jt(p,null,_,"beforeUnmount"),X&64?p.type.remove(p,_,S,Gt,F):P&&!P.hasOnce&&(O!==W||K>0&&K&64)?M(P,_,S,!1,!0):(O===W&&K&384||!E&&X&16)&&M(N,_,S),F&&ts(p)}const Ee=de!=null&&te==null;(me&&(Ce=U&&U.onVnodeUnmounted)||ye||Ee)&&Ue(()=>{Ce&&ut(Ce,_,p),ye&&Jt(p,null,_,"unmounted"),Ee&&(p.el=null)},S)},ts=p=>{const{type:_,el:S,anchor:F,transition:E}=p;if(_===W){ns(S,F);return}if(_===cs){m(p),E&&!E.persisted&&E.afterLeave&&E.afterLeave();return}const O=()=>{o(S),E&&!E.persisted&&E.afterLeave&&E.afterLeave()};if(p.shapeFlag&1&&E&&!E.persisted){const{leave:U,delayLeave:j}=E,N=()=>U(S,O);j?j(p.el,O,N):N()}else O()},ns=(p,_)=>{let S;for(;p!==_;)S=A(p),o(p),p=S;o(_)},ce=(p,_,S)=>{const{bum:F,scope:E,job:O,subTree:U,um:j,m:N,a:P}=p;gi(N),gi(P),F&&rs(F),E.stop(),O?(O.flags|=8,We(U,p,_,S)):p.vnode.el&&U&&(U.transition=p.vnode.transition,We(U,p,_,S)),j&&Ue(j,_),Ue(()=>{p.isUnmounted=!0},_)},M=(p,_,S,F=!1,E=!1,O=0)=>{for(let U=O;U<p.length;U++)We(p[U],_,S,F,E)},se=p=>{if(p.shapeFlag&6)return se(p.component.subTree);if(p.shapeFlag&128)return p.suspense.next();const _=A(p.anchor||p.el),S=_&&_[fr];return S?A(S):_};let Ge=!1;const wn=(p,_,S)=>{let F;p==null?_._vnode&&(We(_._vnode,null,null,!0),F=_._vnode.component):R(_._vnode||null,p,_,null,null,null,S),_._vnode=p,Ge||(Ge=!0,li(F),yl(),Ge=!1)},Gt={p:R,um:We,m:_t,r:ts,mt:B,mc:pe,pc:ue,pbc:J,n:se,o:e};return{render:wn,hydrate:void 0,createApp:Dr(wn)}}function Gs({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function Xt({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Jr(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Bl(e,t,n=!1){const s=e.children,o=t.children;if(ee(s)&&ee(o))for(let l=0;l<s.length;l++){const r=s[l];let u=o[l];u.shapeFlag&1&&!u.dynamicChildren&&((u.patchFlag<=0||u.patchFlag===32)&&(u=o[l]=St(o[l]),u.el=r.el),!n&&u.patchFlag!==-2&&Bl(r,u)),u.type===Ns&&(u.patchFlag===-1&&(u=o[l]=St(u)),u.el=r.el),u.type===It&&!u.el&&(u.el=r.el)}}function Xr(e){const t=e.slice(),n=[0];let s,o,l,r,u;const a=e.length;for(s=0;s<a;s++){const c=e[s];if(c!==0){if(o=n[n.length-1],e[o]<c){t[s]=o,n.push(s);continue}for(l=0,r=n.length-1;l<r;)u=l+r>>1,e[n[u]]<c?l=u+1:r=u;c<e[n[l]]&&(l>0&&(t[s]=n[l-1]),n[l]=s)}}for(l=n.length,r=n[l-1];l-- >0;)n[l]=r,r=t[r];return n}function Ul(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Ul(t)}function gi(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Vl(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Vl(t.subTree):null}const Wl=e=>e.__isSuspense;function Qr(e,t){t&&t.pendingBranch?ee(e)?t.effects.push(...e):t.effects.push(e):lr(e)}const W=Symbol.for("v-fgt"),Ns=Symbol.for("v-txt"),It=Symbol.for("v-cmt"),cs=Symbol.for("v-stc"),nn=[];let Ye=null;function h(e=!1){nn.push(Ye=e?null:[])}function Kl(){nn.pop(),Ye=nn[nn.length-1]||null}let Bn=1;function yi(e,t=!1){Bn+=e,e<0&&Ye&&t&&(Ye.hasOnce=!0)}function ql(e){return e.dynamicChildren=Bn>0?Ye||en:null,Kl(),Bn>0&&Ye&&Ye.push(e),e}function g(e,t,n,s,o,l){return ql(i(e,t,n,s,o,l,!0))}function Ve(e,t,n,s,o){return ql(_e(e,t,n,s,o,!0))}function Yl(e){return e?e.__v_isVNode===!0:!1}function $n(e,t){return e.type===t.type&&e.key===t.key}const zl=({key:e})=>e??null,ds=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?xe(e)||Le(e)||ne(e)?{i:qe,r:e,k:t,f:!!n}:e:null);function i(e,t=null,n=null,s=0,o=null,l=e===W?0:1,r=!1,u=!1){const a={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&zl(t),ref:t&&ds(t),scopeId:wl,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:l,patchFlag:s,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:qe};return u?(bs(a,n),l&128&&e.normalize(a)):n&&(a.shapeFlag|=xe(n)?8:16),Bn>0&&!r&&Ye&&(a.patchFlag>0||l&6)&&a.patchFlag!==32&&Ye.push(a),a}const _e=Zr;function Zr(e,t=null,n=null,s=0,o=null,l=!1){if((!e||e===Tl)&&(e=It),Yl(e)){const u=vn(e,t,!0);return n&&bs(u,n),Bn>0&&!l&&Ye&&(u.shapeFlag&6?Ye[Ye.indexOf(e)]=u:Ye.push(u)),u.patchFlag=-2,u}if(du(e)&&(e=e.__vccOpts),t){t=eu(t);let{class:u,style:a}=t;u&&!xe(u)&&(t.class=re(u)),ge(a)&&(Do(a)&&!ee(a)&&(a=Oe({},a)),t.style=Ne(a))}const r=xe(e)?1:Wl(e)?128:Fs(e)?64:ge(e)?4:ne(e)?2:0;return i(e,t,n,s,o,r,l,!0)}function eu(e){return e?Do(e)||Ll(e)?Oe({},e):e:null}function vn(e,t,n=!1,s=!1){const{props:o,ref:l,patchFlag:r,children:u,transition:a}=e,c=t?tu(o||{},t):o,f={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&zl(c),ref:t&&t.ref?n&&l?ee(l)?l.concat(ds(t)):[l,ds(t)]:ds(t):l,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:u,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==W?r===-1?16:r|16:r,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:a,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&vn(e.ssContent),ssFallback:e.ssFallback&&vn(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce,cacheIndex:e.cacheIndex};return a&&s&&Ho(f,a.clone(f)),f}function Q(e=" ",t=0){return _e(Ns,null,e,t)}function fs(e,t){const n=_e(cs,null,e);return n.staticCount=t,n}function V(e="",t=!1){return t?(h(),Ve(It,null,e)):_e(It,null,e)}function pt(e){return e==null||typeof e=="boolean"?_e(It):ee(e)?_e(W,null,e.slice()):Yl(e)?St(e):_e(Ns,null,String(e))}function St(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:vn(e)}function bs(e,t){let n=0;const{shapeFlag:s}=e;if(t==null)t=null;else if(ee(t))n=16;else if(typeof t=="object")if(s&65){const o=t.default;o&&(o._c&&(o._d=!1),bs(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!Ll(t)?t._ctx=qe:o===3&&qe&&(qe.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else if(ne(t)){if(s&65){bs(e,{default:t});return}t={default:t,_ctx:qe},n=32}else t=String(t),s&64?(n=16,t=[Q(t)]):n=8;e.children=t,e.shapeFlag|=n}function tu(...e){const t={};for(let n=0;n<e.length;n++){const s=e[n];for(const o in s)if(o==="class")t.class!==s.class&&(t.class=re([t.class,s.class]));else if(o==="style")t.style=Ne([t.style,s.style]);else if(As(o)){const l=t[o],r=s[o];r&&l!==r&&!(ee(l)&&l.includes(r))?t[o]=l?[].concat(l,r):r:r==null&&l==null&&!Es(o)&&(t[o]=r)}else o!==""&&(t[o]=s[o])}return t}function ut(e,t,n,s=null){ot(e,t,7,[n,s])}const nu=Pl();let su=0;function ou(e,t,n){const s=e.type,o=(t?t.appContext:e.appContext)||nu,l={uid:su++,vnode:e,type:s,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Pa(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(o.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Hl(s,o),emitsOptions:Ol(s,o),emit:null,emitted:null,propsDefaults:be,inheritAttrs:s.inheritAttrs,ctx:be,data:be,props:be,attrs:be,slots:be,refs:be,setupState:be,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return l.ctx={_:l},l.root=t?t.root:l,l.emit=Fr.bind(null,l),e.ce&&e.ce(l),l}let Me=null;const iu=()=>Me||qe;let ws,Un;{const e=Ms(),t=(n,s)=>{let o;return(o=e[n])||(o=e[n]=[]),o.push(s),l=>{o.length>1?o.forEach(r=>r(l)):o[0](l)}};ws=t("__VUE_INSTANCE_SETTERS__",n=>Me=n),Un=t("__VUE_SSR_SETTERS__",n=>Vn=n)}const Qn=e=>{const t=Me;return ws(e),e.scope.on(),()=>{e.scope.off(),ws(t)}},bi=()=>{Me&&Me.scope.off(),ws(null)};function Gl(e){return e.vnode.shapeFlag&4}let Vn=!1;function lu(e,t=!1,n=!1){t&&Un(t);const{props:s,children:o}=e.vnode,l=Gl(e);Ur(e,s,l,t),qr(e,o,n||t);const r=l?au(e,t):void 0;return t&&Un(!1),r}function au(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Tr);const{setup:s}=n;if(s){Pt();const o=e.setupContext=s.length>1?uu(e):null,l=Qn(e),r=Jn(s,e,0,[e.props,o]),u=zi(r);if(Ot(),l(),(u||e.sp)&&!Dn(e)&&xl(e),u){if(r.then(bi,bi),t)return r.then(a=>{Un(!0);try{wi(e,a,t)}finally{Un(!1)}}).catch(a=>{Ls(a,e,0)});e.asyncDep=r}else wi(e,r)}else Jl(e)}function wi(e,t,n){ne(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:ge(t)&&(e.setupState=vl(t)),Jl(e)}function Jl(e,t,n){const s=e.type;e.render||(e.render=s.render||mt);{const o=Qn(e);Pt();try{Ar(e)}finally{Ot(),o()}}}const ru={get(e,t){return Ie(e,"get",""),e[t]}};function uu(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,ru),slots:e.slots,emit:e.emit,expose:t}}function js(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(vl(Ja(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Ln)return Ln[n](e)},has(t,n){return n in t||n in Ln}})):e.proxy}function cu(e,t=!0){return ne(e)?e.displayName||e.name:e.name||t&&e.__name}function du(e){return ne(e)&&"__vccOpts"in e}const k=(e,t)=>tr(e,t,Vn),fu="3.5.43";let vo;const _i=typeof window<"u"&&window.trustedTypes;if(_i)try{vo=_i.createPolicy("vue",{createHTML:e=>e})}catch{}const Xl=vo?e=>vo.createHTML(e):e=>e,pu="http://www.w3.org/2000/svg",hu="http://www.w3.org/1998/Math/MathML",$t=typeof document<"u"?document:null,ki=$t&&$t.createElement("template"),vu={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,s)=>{const o=t==="svg"?$t.createElementNS(pu,e):t==="mathml"?$t.createElementNS(hu,e):n?$t.createElement(e,{is:n}):$t.createElement(e);return e==="select"&&s&&s.multiple!=null&&o.setAttribute("multiple",s.multiple),o},createText:e=>$t.createTextNode(e),createComment:e=>$t.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>$t.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,s,o,l){const r=n?n.previousSibling:t.lastChild;if(o&&(o===l||o.nextSibling))for(;t.insertBefore(o.cloneNode(!0),n),!(o===l||!(o=o.nextSibling)););else{ki.innerHTML=Xl(s==="svg"?`<svg>${e}</svg>`:s==="mathml"?`<math>${e}</math>`:e);const u=ki.content;if(s==="svg"||s==="mathml"){const a=u.firstChild;for(;a.firstChild;)u.appendChild(a.firstChild);u.removeChild(a)}t.insertBefore(u,n)}return[r?r.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},mu=Symbol("_vtc");function gu(e,t,n){const s=e[mu];s&&(t=(t?[t,...s]:[...s]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const $i=Symbol("_vod"),yu=Symbol("_vsh"),bu=Symbol(""),wu=/(?:^|;)\s*display\s*:/;function _u(e,t,n){const s=e.style,o=xe(n);let l=!1;if(n&&!o){if(t)if(xe(t))for(const r of t.split(";")){const u=r.slice(0,r.indexOf(":")).trim();n[u]==null&&Cn(s,u,"")}else for(const r in t)n[r]==null&&Cn(s,r,"");for(const r in n){r==="display"&&(l=!0);const u=n[r];u!=null?$u(e,r,!xe(t)&&t?t[r]:void 0,u)||Cn(s,r,u):Cn(s,r,"")}}else if(o){if(t!==n){const r=s[bu];r&&(n+=";"+r),s.cssText=n,l=wu.test(n)}}else t&&e.removeAttribute("style");$i in e&&(e[$i]=l?s.display:"",e[yu]&&(s.display="none"))}const ls=/\s*!important$/;function Cn(e,t,n){if(ee(n))n.forEach(s=>Cn(e,t,s));else if(n==null&&(n=""),t.startsWith("--"))ls.test(n)?e.setProperty(t,n.replace(ls,""),"important"):e.setProperty(t,n);else{const s=ku(e,t);ls.test(n)?e.setProperty(Yt(s),n.replace(ls,""),"important"):e[s]=n}}const xi=["Webkit","Moz","ms"],Js={};function ku(e,t){const n=Js[t];if(n)return n;let s=Be(t);if(s!=="filter"&&s in e)return Js[t]=s;s=Os(s);for(let o=0;o<xi.length;o++){const l=xi[o]+s;if(l in e)return Js[t]=l}return t}function $u(e,t,n,s){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&xe(s)&&n===s}const Si="http://www.w3.org/1999/xlink";function Ci(e,t,n,s,o,l=Ca(t)){s&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Si,t.slice(6,t.length)):e.setAttributeNS(Si,t,n):n==null||l&&!Qi(n)?e.removeAttribute(t):e.setAttribute(t,l?"":gt(n)?String(n):n)}function Ti(e,t,n,s,o){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Xl(n):n);return}const l=e.tagName;if(t==="value"&&l!=="PROGRESS"&&!l.includes("-")){const u=l==="OPTION"?e.getAttribute("value")||"":e.value,a=n==null?e.type==="checkbox"?"on":"":String(n);(u!==a||!("_value"in e))&&(e.value=a),n==null&&e.removeAttribute(t),e._value=n;return}let r=!1;if(n===""||n==null){const u=typeof e[t];u==="boolean"?n=Qi(n):n==null&&u==="string"?(n="",r=!0):u==="number"&&(n=0,r=!0)}try{e[t]=n}catch{}r&&e.removeAttribute(o||t)}function jt(e,t,n,s){e.addEventListener(t,n,s)}function xu(e,t,n,s){e.removeEventListener(t,n,s)}const Ai=Symbol("_vei");function Su(e,t,n,s,o=null){const l=e[Ai]||(e[Ai]={}),r=l[t];if(s&&r)r.value=s;else{const[u,a]=Au(t);if(s){const c=l[t]=Ou(s,o);jt(e,u,c,a)}else r&&(xu(e,u,r,a),l[t]=void 0)}}const Cu=/(Once|Passive|Capture)$/,Tu=/^on:?(?:Once|Passive|Capture)$/;function Au(e){let t,n;for(;(n=e.match(Cu))&&!Tu.test(e);)t||(t={}),e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===":"?e.slice(3):Yt(e.slice(2)),t]}let Xs=0;const Eu=Promise.resolve(),Pu=()=>Xs||(Eu.then(()=>Xs=0),Xs=Date.now());function Ou(e,t){const n=s=>{if(!s._vts)s._vts=Date.now();else if(s._vts<=n.attached)return;const o=n.value;if(ee(o)){const l=s.stopImmediatePropagation;s.stopImmediatePropagation=()=>{l.call(s),s._stopped=!0};const r=o.slice(),u=[s];for(let a=0;a<r.length&&!s._stopped;a++){const c=r[a];c&&ot(c,t,5,u)}}else ot(o,t,5,[s])};return n.value=e,n.attached=Pu(),n}const Ei=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Iu=(e,t,n,s,o,l)=>{const r=o==="svg";t==="class"?gu(e,s,r):t==="style"?_u(e,n,s):As(t)?Es(t)||Su(e,t,n,s,l):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):Mu(e,t,s,r))?(Ti(e,t,s),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Ci(e,t,s,r,l,t!=="value")):e._isVueCE&&(Du(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!xe(s)))?Ti(e,Be(t),s,l,t):(t==="true-value"?e._trueValue=s:t==="false-value"&&(e._falseValue=s),Ci(e,t,s,r))};function Mu(e,t,n,s){if(s)return!!(t==="innerHTML"||t==="textContent"||t in e&&Ei(t)&&ne(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const o=e.tagName;if(o==="IMG"||o==="VIDEO"||o==="CANVAS"||o==="SOURCE")return!1}return Ei(t)&&xe(n)?!1:t in e}function Du(e,t){const n=e._def.props;if(!n)return!1;const s=Be(t);return Array.isArray(n)?n.some(o=>Be(o)===s):Object.keys(n).some(o=>Be(o)===s)}const mn=e=>{const t=e.props["onUpdate:modelValue"]||!1;return ee(t)?n=>rs(t,n):t};function Lu(e){e.target.composing=!0}function Pi(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const vt=Symbol("_assign"),as=Symbol("_initialValue");function Qs(e,t,n){return t&&(e=e.trim()),n&&(e=Is(e)),e}const Je={created(e,{modifiers:{lazy:t,trim:n,number:s}},o){e.parentNode&&(e.type==="text"?e[as]=e.defaultValue.replace(/[\r\n]/g,""):e.type==="textarea"&&(e[as]=e.defaultValue.replace(/\r\n?/g,`
|
||
`))),e[vt]=mn(o);const l=s||o.props&&o.props.type==="number";jt(e,t?"change":"input",r=>{r.target.composing||e[vt](Qs(e.value,n,l))}),(n||l)&&jt(e,"change",()=>{e.value=Qs(e.value,n,l)}),t||(jt(e,"compositionstart",Lu),jt(e,"compositionend",Pi),jt(e,"change",Pi))},mounted(e,{value:t,modifiers:{trim:n,number:s}}){const o=t??"",l=e[as];delete e[as],l!==void 0&&(e.type==="text"||e.type==="textarea")&&e.value!==l?e[vt](Qs(e.value,n,s)):e.value=o},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:s,trim:o,number:l}},r){if(e[vt]=mn(r),e.composing)return;const u=(l||e.type==="number")&&!/^0\d/.test(e.value)?Is(e.value):e.value,a=t??"";if(u===a)return;const c=e.getRootNode();(c instanceof Document||c instanceof ShadowRoot)&&c.activeElement===e&&e.type!=="range"&&(s&&t===n||o&&e.value.trim()===a)||(e.value=a)}},Oi={created(e,{value:t},n){e.checked=yt(t,n.props.value),e[vt]=mn(n),jt(e,"change",()=>{e[vt](Wn(e))})},beforeUpdate(e,{value:t,oldValue:n},s){e[vt]=mn(s),t!==n&&(e.checked=yt(t,s.props.value))}},_s={deep:!0,created(e,{value:t,modifiers:{number:n}},s){e._modelValue=t,jt(e,"change",()=>{const o=Array.prototype.filter.call(e.options,a=>a.selected).map(a=>n?Is(Wn(a)):Wn(a)),l=e.multiple,r=l?sn(e._modelValue)?new Set(o):o:o[0],u=e._pendingValue=[l,l?ee(r)?o.slice():o:r];try{e[vt](r)}finally{Lo(()=>{e._pendingValue===u&&(e._pendingValue=void 0)})}}),e[vt]=mn(s)},mounted(e,{value:t}){Ii(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[vt]=mn(n)},updated(e,{value:t}){const n=e._pendingValue;e._pendingValue=void 0,(!n||n[0]!==e.multiple||!Fu(t,n[1],n[0]))&&Ii(e,t)}};function Fu(e,t,n){if(!n||ee(e))return yt(e,t);if(sn(e)){if(e.size!==t.length)return!1;for(const s of t)if(!e.has(s))return!1;return!0}return!1}function Ii(e,t){const n=e.multiple,s=ee(t);if(!(n&&!s&&!sn(t))){for(let o=0,l=e.options.length;o<l;o++){const r=e.options[o],u=Wn(r);if(n)if(s){const a=typeof u;a==="string"||a==="number"?r.selected=t.some(c=>String(c)===String(u)):r.selected=Ea(t,u)>-1}else r.selected=t.has(u);else if(yt(Wn(r),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Wn(e){return"_value"in e?e._value:e.value}const Hu=["ctrl","shift","alt","meta"],Ru={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>Hu.some(n=>e[`${n}Key`]&&!t.includes(n))},Ft=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),s=t.join(".");return n[s]||(n[s]=((o,...l)=>{for(let r=0;r<t.length;r++){const u=Ru[t[r]];if(u&&u(o,t))return}return e(o,...l)}))},Nu={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Ql=(e,t)=>{const n=e._withKeys||(e._withKeys={}),s=t.join(".");return n[s]||(n[s]=(o=>{if(!("key"in o))return;const l=Yt(o.key);if(t.some(r=>r===l||Nu[r]===l))return e(o)}))},ju=Oe({patchProp:Iu},vu);let Mi;function Bu(){return Mi||(Mi=zr(ju))}const Uu=((...e)=>{const t=Bu().createApp(...e),{mount:n}=t;return t.mount=s=>{const o=Wu(s);if(!o)return;const l=t._component;!ne(l)&&!l.render&&!l.template&&(l.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const r=n(o,!1,Vu(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),r},t});function Vu(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Wu(e){return xe(e)?document.querySelector(e):e}const Ku=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],qu=["Su","Mo","Tu","We","Th","Fr","Sa"],Zl={clock:"clock-outline",analog:"clock-outline",date:"calendar"},He=e=>JSON.stringify(e),ke=e=>String.fromCodePoint(parseInt(e,16));function Bo(e,t=new Date){let n=t.getHours();return e||(n=n%12||12),`${String(n).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}const Uo=(e=new Date)=>`${qu[e.getDay()]} ${e.getDate()} ${Ku[e.getMonth()]}`;function Yu(e,t=Math.floor(Date.now()/1e3)){const n=t-e,s=Math.abs(n),o=l=>Math.floor(s/l);return n<0?s<3600?`In ${Math.max(1,o(60))} min`:s<86400?o(3600)===1?"In 1 hour":`In ${o(3600)} hours`:s<172800?"Tomorrow":`In ${o(86400)} days`:s<60?"Just now":s<3600?`${o(60)} min ago`:s<86400?o(3600)===1?"1 hour ago":`${o(3600)} hours ago`:s<172800?"Yesterday":s<604800?`${o(86400)} days ago`:s<2592e3?o(604800)===1?"1 week ago":`${o(604800)} weeks ago`:s<31536e3?o(2592e3)===1?"1 month ago":`${o(2592e3)} months ago`:o(31536e3)===1?"1 year ago":`${o(31536e3)} years ago`}const zu={guition:{width:448,top:36,name:27,text:21,icon:26},cyd:{width:298,top:24,name:18,text:14,icon:18}},Di=document.createElement("canvas").getContext("2d"),mo=new Map,Gu=()=>mo.clear();function Zt(e,t){const n=`${t}|${e}`;let s=mo.get(n);if(!s){Di.font=t;const o=Di.measureText(e);s={left:-o.actualBoundingBoxLeft,right:o.actualBoundingBoxRight,top:-o.actualBoundingBoxAscent,bottom:o.actualBoundingBoxDescent,advance:o.width},mo.set(n,s)}return s}const Ju=e=>({name:`500 ${e.name}px "Bar Roboto"`,text:`400 ${e.text}px "Bar Roboto"`,icon:`${e.icon}px "Tile Icons"`});function Xu(e){return{icon:Math.max(2,Math.floor((e*4+5)/10)),item:Math.max(6,Math.floor((e*125+50)/100)),name:Math.max(8,Math.floor((e*16+5)/10))}}function ea(e,t,n,s){const o=Ju(t),l=Zt("0",o.text),r=Math.round(l.bottom-l.top),u=Xu(r),a=Zt(String.fromCodePoint(983376),o.icon),c=Math.round(a.bottom-a.top),f=e.map((m,H)=>{const C=s(m),L={index:H,item:m,view:C,shown:C.shown,width:0};return C.analog?(L.dial=c,L.width=c,L):(C.icon&&(L.icon={glyph:ke(C.icon),ink:Zt(ke(C.icon),o.icon)},L.width+=L.icon.ink.right-L.icon.ink.left),C.text&&(L.text={value:C.text,ink:Zt(C.text,o.text)},L.width+=(L.icon?u.icon:0)+L.text.ink.right-L.text.ink.left),L)}),b=f.filter(m=>m.shown),A=Zt(n,o.name).advance,D=Math.min(A,Math.floor(t.width*35/100)),I=m=>m.reduce((H,C)=>H+C.width,0)+Math.max(0,m.length-1)*u.item;let R=0;for(;R<b.length&&I(b.slice(R))+u.name+D>t.width;)R++;const T=b.slice(R),$=new Set(b.slice(0,R).map(m=>m.index));let x=t.width-I(T);for(const m of T)m.x=x,x+=m.width+u.item;const w=T.length?T[0].x-u.name:t.width;return{metrics:t,fonts:o,cap:r,zero:l,gaps:u,parts:f,placed:T,dropped:$,nameText:n,natural:A,nameRoom:w}}function Qu(e,t,n){if(Zt(e,t).advance<=n)return e;const s=[...e];for(;s.length&&Zt(s.join("")+"...",t).advance>n;)s.pop();return s.join("")+"..."}function Zu(e){"fonts"in document&&Promise.all([document.fonts.load('500 27px "Bar Roboto"',"Studio 0"),document.fonts.load('400 21px "Bar Roboto"',"Away 0"),document.fonts.load('26px "Tile Icons"',String.fromCodePoint(983376))]).then(()=>{Gu(),e()}).catch(()=>{})}let ta="";function ec(e){ta=e||""}async function Vo(e,t={}){const n=await fetch(`api/${e}`,{...t,headers:{"Content-Type":"application/json","X-Screen-CSRF":ta,...t.headers}});if(!n.ok){let s="That didn't work. Refresh the page and try again.";try{s=(await n.json()).error||s}catch{}throw new Error(s)}return n}const Mt=async e=>(await Vo(e)).json(),it=async(e,t,n,s={})=>{const l=await(await Vo(e,{method:t,body:n===void 0?void 0:JSON.stringify(n),...s})).text();return l?JSON.parse(l):null},Et=6,gn=8,Wo=gn*Et,Qe=e=>e.options?.size==="wide",Fn=(e,t)=>t?[e,e+1]:[e],go=e=>e-e%2,ks=e=>Math.floor(e/Et),wt=e=>e.tiles.map(t=>({tile:t,slot:t.slot}));function na(e){let t=0;return e.map(n=>{const s=Qe(n);s&&t%2===1&&t++;const o=t;return t+=s?2:1,o})}function tc(e){const t=na(e);return e.some((n,s)=>n.slot!==t[s])}function Ko(e){if(e.tiles.some(t=>!Number.isInteger(t.slot))){const t=na(e.tiles);e.tiles.forEach((n,s)=>n.slot=t[s])}e.tiles.sort((t,n)=>t.slot-n.slot)}function qo(e){const t=new Set;for(const{tile:n,slot:s}of e)for(const o of Fn(s,Qe(n)))t.add(o);return t}const Kn=(e,t,n)=>Number.isInteger(t)&&t>=0&&t+(n?1:0)<Wo&&!(n&&t%2)&&Fn(t,n).every(s=>!e.has(s));function nc(e,t){for(let n=0;n<Wo;n++)if(Kn(e,n,t))return n;return-1}function sa(e,t,n){let s=-1;for(let o=0;o<Wo;o++)Kn(e,o,t)&&(s<0||Math.abs(o-n)<=Math.abs(s-n))&&(s=o);return s}function oa(e,t,n){const s=Qe(t);if(s&&(n=go(n)),!Kn(new Set,n,s))return null;const o=Fn(n,s),l=e.includes(t)?Fn(t.slot,s):[],r=[{tile:t,slot:n}],u=[];for(const a of e)a!==t&&(Fn(a.slot,Qe(a)).some(c=>o.includes(c))?u.push(a):r.push({tile:a,slot:a.slot}));for(const a of u){const c=Qe(a),f=qo(r);let b=l.map(A=>c?go(A):A).find(A=>Kn(f,A,c));if(b===void 0&&(b=sa(f,c,a.slot)),b<0)return null;r.push({tile:a,slot:b})}return r.sort((a,c)=>a.slot-c.slot)}function zt(e,t=1){const n=Math.max(0,...e.map(({tile:s,slot:o})=>o+(Qe(s)?2:1)));return Math.min(gn,Math.max(1,Math.ceil(n/Et),t||1))}function sc(e){const t=e.split(".")[0];return t==="sun"?{options:{display:"sunpath",size:"wide"}}:t==="weather"?{options:{display:"forecast",size:"wide"}}:t==="screen"?{options:{display:"digital",size:"wide"}}:{}}const ia=e=>({entity:e,name:"",slot:-1,...sc(e)});function la(e,t){const n=e.entity.split(".")[0],s=t.controls?.[n],o=e.options||{};if(!s||o.size!=="wide"||(o.display||"standard")!=="standard"||o.inline==="slider")return null;const l=o.controls??s.default;return l==="none"?null:l}function oc(e,t){const n=la(e,t);return n?t.controls?.[e.entity.split(".")[0]]?.choices.find(s=>s.key===n)?.label.toLocaleLowerCase()||n:"none"}const yo=e=>(/^(\d+)\.(\d+)\.(\d+)$/.exec(e||"")||[]).slice(1).map(Number);function bo(e,t){const[n,s]=[yo(e),yo(t)];if(n.length!==3||s.length!==3)return!1;for(let o=0;o<3;o++)if(n[o]!==s[o])return n[o]>s[o];return!0}const ic=(e,t,n,s)=>bo(e,`${t}.${n}.${s}`);function lc(e){const t=yo(e);return t.length!==3?10:t[0]>0||t[1]>2||t[1]===2&&t[2]>=7?20:10}const aa={standard:"standard",watch:"large value",forecast:"weather forecast",graph:"graph",digital:"digital clock",analog:"analog clock",sunpath:"sun path"},Li=["light","switch","input_boolean","fan","media_player","climate"],ac=["light","fan","cover","number","input_number","media_player"],rc={light:["Light","☀","#ad7600","#fff3d3"],climate:["Climate","❄","#c86620","#ffebdc"],vacuum:["Vacuum","◉","#008577","#def3ed"],fan:["Fan","✣","#008aab","#def5fa"],cover:["Cover","▤","#8053af","#eee5f8"],media_player:["Media","▶","#007cad","#def2fc"],sensor:["Sensor","⌁","#3476b1","#e5effa"],binary_sensor:["Status","◈","#ad7600","#fff3d3"],switch:["Switch","⏻","#ad7600","#fff3d3"],input_boolean:["Switch","⏻","#ad7600","#fff3d3"],scene:["Scene","✦","#8053af","#eee5f8"],script:["Script","▷","#8053af","#eee5f8"],weather:["Weather","☁","#007cad","#def2fc"],number:["Value","±","#008577","#def3ed"],input_number:["Value","±","#008577","#def3ed"],select:["Select","≡","#5862af","#eaecfa"],input_select:["Select","≡","#5862af","#eaecfa"],button:["Action","↗","#5862af","#eaecfa"],input_button:["Action","↗","#5862af","#eaecfa"],screen:["Clock","◷","#25282c","#e9ecf1"],sun:["Sun","☼","#c86620","#ffebdc"],timer:["Timer","⏱","#008577","#def3ed"],person:["Person","☺","#2f7d32","#e1f2e2"],camera:["Camera","◧","#3d4a57","#e6ebf0"],image:["Image","◧","#3d4a57","#e6ebf0"]},xt=e=>rc[e.split(".")[0]]||["Entity","◇","#637184","#edf0f4"],d=hn({inventory:{screens:[],entities:[]},connected:!1,reachable:!0,selected:null,layout:null,dirty:!1,busy:!1,saved:0,tab:"layout",selectedTile:null,inspector:null,iconPickerOpen:!1,actionPickerOpen:!1,actionSearch:"",insertAt:-1,filter:"",search:"",capabilities:{},entityActions:{},topbarPreviews:{},topbarAdded:null,topbarOverflow:[],settingEdits:{},settingPending:!1,updating:[],toast:null,now:Date.now(),fontsVersion:0,route:location.hash,overrideProfile:null,overrideFriendly:"",drag:{active:!1,moving:null,preview:null},menuOpen:!1}),qt=k(()=>d.inventory.screens.find(e=>e.id===d.selected)),ra=k(()=>qt.value?.firmware||""),fn=(e,t,n)=>ic(ra.value,e,t,n),Hn=k(()=>lc(ra.value)),Yo=k(()=>qt.value?.board==="guition"),ua=k(()=>zu[Yo.value?"guition":"cyd"]),Zs=k(()=>d.selectedTile&&d.layout?d.layout.tiles.find(e=>e.entity===d.selectedTile):void 0);let Fi=0;function Se(e,t){d.toast={message:e,action:t},clearTimeout(Fi),Fi=window.setTimeout(()=>d.toast=null,t?8e3:5e3)}function uc(){d.toast=null}async function dt(e,t,n="API key"){try{if(!navigator.clipboard||!window.isSecureContext)throw new Error;await navigator.clipboard.writeText(e),Se(`${n} copied.`)}catch{if(t){const s=document.createRange();s.selectNodeContents(t);const o=window.getSelection();o?.removeAllRanges(),o?.addRange(s)}Se(document.execCommand("copy")?`${n} copied.`:`${n} is selected. Copy with Ctrl+C or Command+C.`)}}function $s(){const e="/config/integrations/dashboard";try{window.top.location.assign(e)}catch{window.open(e,"_blank")}}const cc=["","#settings","#new-screen","#firmware","#alerts","#override"],tt=k(()=>cc.includes(d.route)?d.route:"");function De(e){if(location.hash===e){d.route=e;return}location.hash=e}window.addEventListener("hashchange",()=>{d.route=location.hash,window.scrollTo(0,0)});function Zn(e){return d.inventory.entities.find(t=>t.id===e)?.name||d.inventory.builtin?.find(t=>t.id===e)?.name||e}let eo={source:null,byName:{}};function es(e){return eo.source!==d.inventory.icons&&(eo={source:d.inventory.icons,byName:Object.fromEntries((d.inventory.icons?.groups||[]).flatMap(t=>t.icons.map(n=>[n.name,n])))}),e?eo.byName[e]:void 0}function on(e){const t=d.inventory.icons;if(!t)return"F0335";const n=d.inventory.entities.find(o=>o.id===e),s=e.split(".")[0];return t.builtin?.[e]?t.builtin[e]:n?.icon?n.icon:s==="weather"?t.weather[n?.state||""]||t.weather.partlycloudy:s==="sun"?t.sun[n?.state||""]||t.sun.below_horizon:t.defaults[s]||t.fallback}const wo=e=>es(e.options?.icon)?.cp||on(e.entity),to=new Set;async function zo(e){const t=[...new Set(e)].filter(n=>!to.has(n)&&!n.startsWith("screen."));if(t.length){t.forEach(n=>to.add(n));try{for(let n=0;n<t.length;n+=40){const s=t.slice(n,n+40).map(o=>`entity=${encodeURIComponent(o)}`).join("&");Object.assign(d.capabilities,(await Mt(`capabilities?${s}`)).capabilities||{})}}catch{t.forEach(n=>to.delete(n))}}}const no=new Set;async function dc(e){if(!no.has(e)){no.add(e);try{d.entityActions[e]=(await Mt(`entity-actions?entity=${encodeURIComponent(e)}`)).actions}catch{no.delete(e)}}}function et(){d.dirty=!0,d.saved=0}function fc(e){if(e!==d.selected&&d.dirty&&!confirm("You have unsaved changes. Open a different screen anyway?"))return;e!==d.selected&&(Yn(),d.settingEdits={}),d.selected=e,d.selectedTile=null,d.inspector=null,d.tab="layout",d.menuOpen=!1;const t=d.inventory.screens.find(n=>n.id===e);if(!t){d.layout=null;return}d.layout=JSON.parse(JSON.stringify(t.layout)),Ko(d.layout),d.layout.pages=zt(wt(d.layout),d.layout.pages),d.insertAt=-1,d.dirty=!1,d.saved=0,Go(0),zo(d.layout.tiles.map(n=>n.entity)),De("")}function pc(e){const t=d.layout,n=t.tiles.map(o=>`${o.entity}@${o.slot}`).join();for(const{tile:o,slot:l}of e)o.slot=l,t.tiles.includes(o)||t.tiles.push(o);Ko(t),t.pages=zt(wt(t),t.pages);const s=t.tiles.map(o=>`${o.entity}@${o.slot}`).join()!==n;return s&&et(),s}function Bs(e,t){if(!d.layout)return!1;zo([e.entity]);const n=oa(d.layout.tiles,e,t);return n?pc(n):!1}function hc(e){const t=d.layout;if(!t||t.tiles.some(o=>o.entity===e)||t.tiles.length>=Hn.value)return;const n=ia(e),s=d.insertAt>=0?d.insertAt:nc(qo(wt(t)),Qe(n));d.insertAt=-1,s>=0&&Bs(n,s)&&_o(e)}function ca(e){const t=d.layout;if(!t)return;const n=t.tiles.indexOf(e);n<0||(t.tiles.splice(n,1),d.selectedTile===e.entity&&je(),et(),t.pages=zt(wt(t),t.pages),Se(`${e.name||Zn(e.entity)} removed`,{label:"Undo",run:()=>Bs(e,e.slot)}))}function Hi(){const e=d.layout;e&&(e.pages=Math.min(gn,zt(wt(e),e.pages)+1),et())}function vc(e){const t=d.layout;if(t){for(const n of t.tiles)ks(n.slot)>e&&(n.slot-=Et);t.pages=Math.max(1,zt(wt(t),t.pages)-1),et()}}function mc(){const e=d.layout;if(!e)return 1;const t=d.drag.preview||wt(e),n=zt(t,e.pages);return d.drag.active&&n<gn?n+1:n}function Ht(e,t,n){const s=e.entity.split(".")[0],o=d.capabilities[e.entity],l=Qe(e);e.options={...e.options,[t]:n},t==="display"&&n==="watch"&&(e.options.inline="none",d.inventory.controls?.[s]&&(e.options.controls="none")),t==="display"&&["forecast","sunpath"].includes(n)&&(e.options.size="wide"),t==="inline"&&n==="slider"&&(e.options.display="standard",d.inventory.controls?.[s]&&(e.options.controls="none")),t==="controls"&&n!=="none"&&(e.options.display="standard",e.options.inline="none");const r=d.inventory.controls?.[s];if(t==="size"&&n==="wide"&&o&&r&&!("controls"in e.options)&&!o.controls.includes(r.default)&&(e.options.controls=r.choices.find(u=>u.key!=="none"&&o.controls.includes(u.key))?.key||"none"),et(),d.layout&&Qe(e)&&!l){const u=qo(wt(d.layout).filter(f=>f.tile!==e)),a=go(e.slot),c=Kn(u,a,!0)?a:sa(u,!0,a);c>=0&&(e.slot=c),Ko(d.layout),d.layout.pages=zt(wt(d.layout),d.layout.pages)}}function _o(e){d.selectedTile!==e&&(d.iconPickerOpen=!1,d.actionPickerOpen=!1,d.actionSearch=""),d.selectedTile=e,d.inspector={kind:"tile"},zo([e])}function Ct(e){d.inspector?.kind==="bar"&&d.inspector.index===e||(d.iconPickerOpen=!1),d.selectedTile=null,d.inspector={kind:"bar",index:e}}function Ri(){d.selectedTile=null,d.inspector={kind:"bar-add"}}function je(){d.inspector=null,d.selectedTile=null}async function gc(){if(!(d.busy||!d.layout||!d.selected)){d.busy=!0;try{const{settings:e,...t}=d.layout;await it(`screens/${encodeURIComponent(d.selected)}`,"PUT",t),d.dirty=!1,d.saved=Date.now(),Se("Saved. Your screen is being updated."),await ln()}catch(e){Se(e.message)}finally{d.busy=!1}}}const Dt=()=>d.layout?.header?.items??(d.layout?.settings?.show_clock??!0?[{type:"clock"}]:[]),Bt=()=>d.inventory.header?.max_items||6;function qn(e){d.layout&&(d.layout.header={items:e},et(),Go())}let Ni=0;function Go(e=150){clearTimeout(Ni),Ni=window.setTimeout(async()=>{const t=Dt();if(t.some(n=>n.type==="entity"))try{const n=await it("header-preview","POST",{header:{items:t}});t.forEach((s,o)=>d.topbarPreviews[He(s)]=n.items[o])}catch{}},e)}function Tn(e){return e.type==="entity"?Zn(e.entity):d.inventory.header?.builtin.find(t=>t.type===e.type)?.label||e.type}function Rt(e){const t=new Date(d.now);if(e.type==="clock")return{text:Bo(yn().clock_24h!==!1,t),shown:!0};if(e.type==="date")return{text:Uo(t),shown:!0};if(e.type==="analog")return{analog:!0,shown:!0};const n=d.topbarPreviews[He(e)];return n?{icon:n.i||null,text:n.k==="ago"?Yu(n.e,Math.floor(d.now/1e3)):n.t,color:n.c?`#${n.c}`:null,shown:n.shown}:{icon:e.icon==="none"?null:es(e.icon)?.cp||on(e.entity),text:"…",shown:!0,loading:!0}}function so(e,t){const n=[...Dt()];return t<0||t>=n.length||e===t?!1:(n.splice(t,0,...n.splice(e,1)),qn(n),!0)}function ji(e){const t=[...Dt()],[n]=t.splice(e,1);n&&(d.inspector?.kind==="bar"&&je(),qn(t),Se(`${Tn(n)} removed from the top bar`,{label:"Undo",run:()=>{const s=[...Dt()];s.splice(Math.min(e,s.length),0,n),qn(s)}}))}function oo(e){const t=Dt();if(t.length>=Bt())return Se(`The top bar has room for ${Bt()} items.`);if(t.some(n=>He(n)===He(e)))return Se("This is already in the top bar.");d.topbarAdded={key:He(e),time:Date.now()},qn([...t,e]),Ct(t.length)}const yc=[{title:"Brightness",icon:"F0599",rows:[{key:"brightness",label:"Brightness",kind:"number",min:5,max:100,step:5,unit:"%"},{key:"dark_mode",label:"Dark mode",kind:"toggle"},{key:"standby_enabled",label:"Auto standby",kind:"toggle"},{key:"standby_seconds",label:"Standby after",kind:"duration",min:60,max:86400,needs:"standby_enabled"},{key:"standby_brightness",label:"Standby brightness",kind:"number",min:0,max:100,step:5,unit:"%",needs:"standby_enabled",cap:"brightness"}]},{title:"Night",icon:"F0594",rows:[{key:"night_enabled",label:"Night mode",kind:"toggle"},{key:"night_start",label:"Starts",kind:"moment",needs:"night_enabled"},{key:"night_end",label:"Ends",kind:"moment",needs:"night_enabled"},{key:"night_brightness",label:"Night brightness",kind:"number",min:0,max:100,step:5,unit:"%",needs:"night_enabled",cap:"brightness"}]},{title:"Screen",icon:"F0379",rows:[{key:"clock_24h",label:"Clock",kind:"choice",options:[[!1,"12 hour"],[!0,"24 hour"]]},{key:"auto_home",label:"Back to page 1",kind:"toggle"},{key:"auto_home_seconds",label:"After",kind:"duration",min:30,max:3600,needs:"auto_home"},{key:"home_on_standby",label:"Also on standby",kind:"toggle"},{key:"swipe_pages",label:"Swipe between pages",kind:"toggle"},{key:"rotation",label:"Rotation",kind:"choice",options:[[0,"0°"],[90,"90°"],[180,"180°"],[270,"270°"]]}]}],da=4e3;let Ut={},pn=null,xs=0,ps=null;const Jo=()=>qt.value?.settings;function yn(){const e=Jo(),t={...e?.values||{}};for(const[n,s]of Object.entries(d.settingEdits))t[n]=s.value;return t}const bc=e=>e<300?30:e<900?60:e<3600?300:e<7200?900:1800;function Bi(e,t,n,s,o){if(e.kind==="moment"){let u=s&&t%60?Math.floor(t/60)*60+(n>0?60:0):t+n*(s?60:15);return u%=1440,u<0?u+1440:u}const l=e.kind==="duration"?bc(n<0?t-1:t):e.step,r=e.cap?Math.min(e.max,o[e.cap]):e.max;return Math.min(r,Math.max(e.min,t+n*l))}function wc(e){if(e<60)return`${e} sec`;if(e<3600)return`${Math.floor(e/60)} min`;const t=Math.floor(e/3600),n=Math.floor(e%3600/60);return n?`${t} h ${String(n).padStart(2,"0")}`:`${t} h`}function _c(e,t){const n=Math.floor(e/60),s=String(e%60).padStart(2,"0");return t?`${String(n).padStart(2,"0")}:${s}`:`${n%12||12}:${s} ${n<12?"AM":"PM"}`}function kc(e,t){const n=t[e.key];return n==null?"—":e.kind==="number"?`${n}${e.unit||""}`:e.kind==="duration"?wc(n):e.kind==="moment"?_c(n,t.clock_24h!==!1):""}function An(e,t,n){if(pn&&pn!==d.selected&&Object.keys(Ut).length){Yn(),Se("Still saving the other screen's settings. Try again in a moment.");return}pn=d.selected;const s=yn();if(d.settingEdits[e]={value:t,at:Date.now()},Ut[e]=t,e==="brightness")for(const o of["standby_brightness","night_brightness"])s[o]>t&&(d.settingEdits[o]={value:t,at:Date.now()});d.settingPending=!0,clearTimeout(xs),xs=window.setTimeout(()=>Yn(),n)}async function Yn(e=!1){if(clearTimeout(xs),ps||!Object.keys(Ut).length||!pn)return;const t=pn,n=Ut;Ut={};const s=Vo(`screens/${encodeURIComponent(t)}/settings`,{method:"PUT",body:JSON.stringify({settings:n}),keepalive:e});ps=s;try{const o=await(await s).json(),l=d.inventory.screens.find(r=>r.id===t);l&&(l.settings=o)}catch(o){if(Se(o.message),t===d.selected)for(const l of Object.keys(n))delete d.settingEdits[l];if(t===d.selected&&n.brightness!==void 0)for(const l of["standby_brightness","night_brightness"])delete d.settingEdits[l]}finally{ps=null,Object.keys(Ut).length?xs=window.setTimeout(()=>Yn(),150):pn=null,d.settingPending=!!Object.keys(Ut).length,t===d.selected&&Ss(),setTimeout(()=>{t===d.selected&&Ss()},da+100)}}function Ss(){const e=Jo();for(const[t,n]of Object.entries(d.settingEdits))Ut[t]!==void 0||ps||(e&&e.values[t]===n.value||Date.now()-n.at>da)&&delete d.settingEdits[t]}const $c={install:"Building and installing…",verify:"Waiting for the screen to come back…",settle:"Checking that it stays stable…"};async function Ui(e,t){d.updating.push(e.id);try{await it(`screens/${encodeURIComponent(e.id)}/update`,"POST",t?{host:t}:{}),await ln()}catch(n){d.updating=d.updating.filter(s=>s!==e.id),Se(n.message)}}async function Vi(){try{await it("updates/run","POST"),await ln()}catch(e){Se(e.message)}}async function xc(e){try{await it("updates","PUT",{auto:e}),d.inventory.updates&&(d.inventory.updates.auto=e),Se(e?"Screens will now update automatically at night.":"Automatic updates are off.")}catch(t){Se(t.message)}}async function Sc(){try{d.inventory.claude_skill=await it("claude-skill","POST"),Se(d.inventory.claude_skill?.restart?"Skill installed. Restart Claude Code once so it finds the new skills folder.":"Skill installed. Claude Code picks it up right away.")}catch(e){Se(e.message)}}async function ln(e=!0){try{const t=await Mt(e?"inventory":"inventory?light=1");d.inventory=e?t:{...d.inventory,...t},t.csrf&&ec(t.csrf),d.connected=!!d.inventory.connected,d.reachable=!0;for(const n of d.inventory.screens)n.update?.state==="running"&&(d.updating=d.updating.filter(s=>s!==n.id));d.selected&&Ss()}catch{d.reachable=!1}}function Cc(e){d.inventory={...d.inventory,...e},d.connected=!!d.inventory.connected;for(const t of d.inventory.screens)t.update?.state==="running"&&(d.updating=d.updating.filter(n=>n!==t.id));d.selected&&Ss()}let Wi=0,ko=Date.now(),Cs=!1,xn=null;function Tc(){xn||typeof EventSource>"u"||(xn=new EventSource("api/events"),xn.onopen=()=>{Cs=!0,zn()},xn.onmessage=e=>{document.hidden||Cc(JSON.parse(e.data))},xn.onerror=()=>{Cs=!1,zn()})}function zn(){clearTimeout(Wi);const e=Cs?6e4:d.inventory.updates?.busy?3e3:1e4;Wi=window.setTimeout(async()=>{if(!document.hidden){const t=Date.now()-ko>=3e5;t&&(ko=Date.now()),(t||!Cs)&&await ln(t)}zn()},e)}let Ki=!1;function Ac(){Ki||(Ki=!0,ln(),Tc(),zn(),Zu(()=>d.fontsVersion++),setInterval(()=>{!d.layout||document.hidden||d.drag.active||(d.now=Date.now(),Go(0))},3e4),document.addEventListener("visibilitychange",async()=>{document.hidden||(ko=Date.now(),d.now=Date.now(),await ln(),zn())}),window.addEventListener("pagehide",()=>Yn(!0)),window.addEventListener("beforeunload",e=>{d.dirty&&(e.preventDefault(),e.returnValue="")}))}const Ec={class:"side"},Pc={id:"screens"},Oc=["aria-current","onClick"],Ic={class:"txt"},Mc={key:0,class:"pill"},Dc={key:1,class:"spin small"},Lc=["onSubmit"],Fc=["disabled","title","onClick"],Hc={id:"pending"},Rc={class:"pending-actions"},Nc=["onClick"],jc=["aria-current"],Bc={class:"more"},Uc=["aria-current"],Vc={class:"mdi"},Wc=["aria-current"],Kc={class:"mdi"},qc=["aria-current"],Yc={class:"mdi"},zc=$e({__name:"Sidebar",setup(e){const t=fe(null),n=fe("");function s(u){const a=u.update||{};return a.state==="running"||d.updating.includes(u.id)?{kind:"running",text:$c[a.phase||""]||"Starting update…"}:a.state==="queued"?{kind:"queued",text:"Queued for the update"}:a.available&&u.online?{kind:"available",text:`Update ${a.target}`}:a.result&&Date.now()/1e3-a.result.time<86400?{kind:a.result.state==="failed"?"failed":"done",text:a.result.message}:null}function o(u){const a=u.update||{};a.host&&a.profile?Ui(u):a.profile&&(t.value=u.id,n.value="")}function l(u){const a=n.value.trim();a&&(t.value=null,Ui(u,a))}const r=u=>u.installed?"Installed, but not yet in Home Assistant. Add the discovered ESPHome device under Settings → Devices & services, paste the API key there, and turn on “Allow the device to perform Home Assistant actions” under Configure.":u.downloaded?"Firmware downloaded, not yet in Home Assistant. Put it on the screen with ESPHome Web, then add the discovered ESPHome device under Settings → Devices & services, paste the API key there, and allow the Home Assistant actions under Configure.":`Not yet in Home Assistant. Already flashed? Add the ESPHome device under Settings → Devices & services, then allow the Home Assistant actions under Configure. Not flashed yet? Firmware & USB → ${u.file}.`;return(u,a)=>(h(),g("aside",Ec,[a[16]||(a[16]=i("div",{class:"brand"},[i("span",{class:"mark"},"▦"),i("span",null,"ESP Screens")],-1)),i("span",{id:"connection",class:re(["conn",{online:v(d).connected}]),role:"status"},y(v(d).reachable?v(d).connected?"Home Assistant connected":"Reconnecting to Home Assistant…":"Management page unreachable · retrying…"),3),a[17]||(a[17]=i("div",{class:"label"},"Screens",-1)),i("div",Pc,[(h(!0),g(W,null,le(v(d).inventory.screens,c=>(h(),g("div",{key:c.id,class:re(["screen-item",{selected:c.id===v(d).selected&&v(tt)===""}])},[i("button",{type:"button",class:"nav-item","aria-current":c.id===v(d).selected&&v(tt)===""?"true":"false",onClick:f=>v(fc)(c.id)},[i("span",{class:re(["dot",{off:!c.online}])},null,2),i("span",Ic,[i("span",null,y(c.name),1),i("small",null,y(c.online?"Online":"Offline")+y(c.area?" · "+c.area:"")+" · "+y(c.firmware||"unknown"),1)]),s(c)?.kind==="available"?(h(),g("span",Mc,"Update")):s(c)?.kind==="running"?(h(),g("span",Dc)):V("",!0)],8,Oc),s(c)?(h(),g("div",{key:0,class:re(["screen-update",s(c).kind])},[s(c).kind==="available"?(h(),g(W,{key:0},[t.value===c.id?(h(),g(W,{key:0},[a[9]||(a[9]=i("small",null,"The IP address, once; new firmware reports it itself.",-1)),i("form",{class:"screen-host",onSubmit:Ft(f=>l(c),["prevent"])},[Te(i("input",{"onUpdate:modelValue":a[0]||(a[0]=f=>n.value=f),placeholder:"IP address, e.g. 192.168.1.50",required:"",pattern:"[A-Za-z0-9][A-Za-z0-9.\\-]*","aria-label":"IP address",autofocus:""},null,512),[[Je,n.value]]),a[8]||(a[8]=i("button",{type:"submit",class:"btn mini primary"},"Start",-1)),i("button",{type:"button",class:"icon-btn","aria-label":"Cancel",onClick:a[1]||(a[1]=f=>t.value=null)},"✕")],40,Lc)],64)):(h(),g(W,{key:1},[i("small",null,y(s(c).text),1),i("button",{type:"button",class:"btn mini primary",disabled:!c.update?.profile,title:c.update?.profile?"":"No ESPHome profile found with this device name.",onClick:f=>o(c)},"Update",8,Fc)],64))],64)):(h(),g("small",{key:1,class:re({failed:s(c).kind==="failed"})},y(s(c).text),3))],2)):V("",!0)],2))),128))]),i("div",Hc,[(h(!0),g(W,null,le(v(d).inventory.pending||[],c=>(h(),g("div",{key:c.file,class:"pending"},[i("strong",null,y(c.friendly),1),i("small",null,y(r(c)),1),i("div",Rc,[i("button",{type:"button",class:"btn mini quiet",onClick:a[2]||(a[2]=(...f)=>v($s)&&v($s)(...f))},"Open Devices & services"),c.api_key?(h(),g("button",{key:0,type:"button",class:"btn mini quiet",onClick:f=>v(dt)(c.api_key)},"Copy API key",8,Nc)):V("",!0)])]))),128))]),i("button",{id:"new-screen",type:"button",class:"nav-item ghost","aria-current":v(tt)==="#new-screen"?"true":"false",onClick:a[3]||(a[3]=c=>v(De)("#new-screen"))},[...a[10]||(a[10]=[i("span",{class:"plus"},"+",-1),i("span",{class:"txt"},"New screen",-1)])],8,jc),a[18]||(a[18]=i("div",{class:"spacer"},null,-1)),i("div",Bc,[a[15]||(a[15]=i("div",{class:"label"},"More",-1)),i("button",{id:"open-firmware",type:"button",class:"nav-item","aria-current":v(tt)==="#firmware"?"true":"false",onClick:a[4]||(a[4]=c=>v(De)("#firmware"))},[i("span",Vc,y(v(ke)("F0241")),1),a[11]||(a[11]=i("span",{class:"txt"},"Firmware & USB",-1))],8,Uc),i("button",{id:"open-alerts",type:"button",class:"nav-item","aria-current":v(tt)==="#alerts"?"true":"false",onClick:a[5]||(a[5]=c=>v(De)("#alerts"))},[i("span",Kc,y(v(ke)("F0594")),1),a[12]||(a[12]=i("span",{class:"txt"},"Alerts",-1))],8,Wc),i("button",{id:"open-settings",type:"button",class:"nav-item","aria-current":v(tt)==="#settings"?"true":"false",onClick:a[6]||(a[6]=c=>v(De)("#settings"))},[i("span",Yc,y(v(ke)("F0493")),1),a[13]||(a[13]=i("span",{class:"txt"},"Settings",-1))],8,qc),i("button",{id:"refresh",type:"button",class:"nav-item ghost",onClick:a[7]||(a[7]=c=>v(ln)())},[...a[14]||(a[14]=[i("span",{class:"plus"},"↻",-1),i("span",{class:"txt"},"Refresh",-1)])])])]))}}),Gc={key:0,id:"toast",class:"toast",role:"status"},Jc=$e({__name:"Toast",setup(e){return(t,n)=>v(d).toast?(h(),g("div",Gc,[i("span",null,y(v(d).toast.message),1),v(d).toast.action?(h(),g("button",{key:0,type:"button",onClick:n[0]||(n[0]=s=>{v(d).toast.action.run(),v(uc)()})},y(v(d).toast.action.label),1)):V("",!0)])):V("",!0)}}),Z={source:null,element:null,ghost:null,timer:0,start:null,offset:{x:0,y:0},pointerId:null,suppressUntil:0,last:null,scroller:0,target:null},fa={mounted(e,t){e.__dragSource=t.value,e.addEventListener("pointerdown",s=>{const o=e.__dragSource;if(!(s.button!==0||e.disabled||s.target.closest(".remove"))){s.pointerType!=="touch"&&s.preventDefault(),Object.assign(Z,{source:o,element:e,start:{x:s.clientX,y:s.clientY},pointerId:s.pointerId});try{e.setPointerCapture(s.pointerId)}catch{}clearTimeout(Z.timer),s.pointerType==="touch"&&(Z.timer=window.setTimeout(()=>qi(s),260))}}),e.addEventListener("pointermove",s=>{if(d.drag.active||!Z.start||Z.element!==e)return;const o=Math.hypot(s.clientX-Z.start.x,s.clientY-Z.start.y);if(s.pointerType==="touch"){o>10&&(clearTimeout(Z.timer),Z.start=null);return}o>=6&&qi(s)});const n=()=>{Z.element===e&&!d.drag.active&&(clearTimeout(Z.timer),Z.start=null)};e.addEventListener("pointerup",n),e.addEventListener("pointercancel",n)},updated(e,t){e.__dragSource=t.value}};function qi(e){if(d.drag.active||!Z.start||!Z.source||!Z.element)return;d.drag.active=!0,d.drag.moving=Z.source.kind==="tile"?Z.source.tile:ia(Z.source.id),d.drag.preview=null,Z.target=null,getSelection()?.removeAllRanges();const t=Z.element.getBoundingClientRect(),n=Z.element.cloneNode(!0);n.classList.add("drag-ghost"),n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,Z.offset={x:e.clientX-t.left,y:e.clientY-t.top},document.body.append(n),Z.ghost=n,document.addEventListener("pointermove",$o),document.addEventListener("pointerup",Ts),document.addEventListener("pointercancel",Ts);try{Z.element.releasePointerCapture(Z.pointerId)}catch{}try{document.documentElement.setPointerCapture(Z.pointerId)}catch{}document.addEventListener("touchmove",pa,{passive:!1}),Z.scroller=window.setInterval(()=>{if(!Z.last)return;const s=document.querySelector(".canvas");if(!s)return;const o=s.getBoundingClientRect(),l=Z.last.x<o.left+60?-12:Z.last.x>o.right-60?12:0,r=Z.last.y<o.top+60?-12:Z.last.y>o.bottom-60?12:0;(l||r)&&(s.scrollBy(l,r),xo(ha(Z.last.x,Z.last.y)))},16),xo(-1),$o(e)}function pa(e){d.drag.active&&e.preventDefault()}function Ts(e){e.pointerId===Z.pointerId&&Xc(e.type==="pointerup")}function $o(e){!Z.ghost||e.pointerId!==Z.pointerId||(Z.last={x:e.clientX,y:e.clientY},Z.ghost.style.transform=`translate(${e.clientX-Z.offset.x}px, ${e.clientY-Z.offset.y}px)`,xo(ha(e.clientX,e.clientY)))}function ha(e,t){let n=null,s=1/0;for(const l of document.querySelectorAll(".pages [data-slot]")){const r=l.getBoundingClientRect(),u=Math.hypot(Math.max(r.left-e,0,e-r.right),Math.max(r.top-t,0,t-r.bottom));u<s&&(s=u,n={cell:l,r})}if(!n||s>16)return-1;let o=Number(n.cell.dataset.slot);return n.cell.classList.contains("wide")&&e>(n.r.left+n.r.right)/2&&(o+=1),o}function xo(e){Z.target===e||!d.layout||!d.drag.moving||(Z.target=e,d.drag.preview=e>=0?oa(d.layout.tiles,d.drag.moving,e):null)}function Xc(e){const t=d.drag.preview,n=d.drag.moving;document.removeEventListener("pointermove",$o),document.removeEventListener("pointerup",Ts),document.removeEventListener("pointercancel",Ts),document.removeEventListener("touchmove",pa);try{document.documentElement.releasePointerCapture(Z.pointerId)}catch{}if(Z.ghost?.remove(),Object.assign(Z,{ghost:null,suppressUntil:Date.now()+400,last:null,start:null,target:null,element:null,source:null}),clearInterval(Z.scroller),d.drag.active=!1,d.drag.preview=null,d.drag.moving=null,e&&t&&n&&d.layout){const s=d.layout.tiles.map(o=>`${o.entity}@${o.slot}`).join();for(const{tile:o,slot:l}of t)o.slot=l,d.layout.tiles.includes(o)||d.layout.tiles.push(o);d.layout.tiles.sort((o,l)=>o.slot-l.slot),d.layout.tiles.map(o=>`${o.entity}@${o.slot}`).join()!==s&&et(),s.includes(`${n.entity}@`)||Bs(n,n.slot)}}window.addEventListener("click",e=>{Date.now()<Z.suppressUntil&&(e.stopPropagation(),e.preventDefault())},!0);const Qc=["data-slot","tabindex","role","aria-label"],Zc={class:"clockface",viewBox:"0 0 60 60","aria-hidden":"true"},ed=["transform"],td=["transform"],nd=["transform"],sd={key:0,class:"lead"},od={class:"tx"},id={class:"nm"},ld={class:"st"},ad={class:"lead"},rd={class:"ic mdi"},ud={class:"tx"},cd={class:"nm"},dd={key:0,class:"st"},fd={key:0,class:"mini-slider"},pd={key:1,class:"ctl"},hd={key:0,class:"tog"},vd={key:1,class:"stp"},md={class:"mdi"},gd={class:"mdi"},yd={class:"key mdi"},bd={class:"key mdi"},wd={key:3,class:"stp"},_d={class:"mdi"},kd={class:"mdi"},$d={class:"key mdi"},xd={class:"key mdi"},Sd={class:"key mdi"},Cd={class:"key mdi"},Td={class:"key mdi"},Ad={class:"key mdi"},Ed={class:"key mdi"},Pd={class:"key mdi"},Od={class:"key mdi"},Id={class:"key mdi"},Md={class:"key mdi"},Dd={class:"key mdi"},Ld={class:"key mdi"},Fd={class:"key mdi"},Hd={class:"key mdi"},Rd={key:10,class:"run"},Nd={key:11,class:"range"},jd={class:"ic mdi"},Bd={class:"lead"},Ud={class:"nm"},Vd={key:0,class:"st"},Wd={key:1,class:"mini-slider"},Kd=["aria-label"],qd=$e({__name:"TileCard",props:{tile:{},slot:{},placeholder:{type:Boolean}},setup(e){const t=e,n=k(()=>t.tile.name||Zn(t.tile.entity)),s=k(()=>Qe(t.tile)),o=k(()=>d.inventory.backgrounds?.[t.tile.options?.background||""]?.color),l=k(()=>t.tile.options?.background==="none"),r=k(()=>t.tile.options?.display||"standard"),u=k(()=>r.value!=="standard"?aa[r.value]||r.value:""),a=k(()=>la(t.tile,d.inventory)),c=k(()=>t.tile.entity.split(".")[0]),f=k(()=>d.inventory.icons?.controls||{}),b=w=>f.value[w]?ke(f.value[w]):"",A=k(()=>d.selectedTile===t.tile.entity&&d.inspector?.kind==="tile"),D=k(()=>!t.placeholder&&d.layout?.tiles.includes(t.tile)),I=k(()=>`${n.value}, slot ${t.slot%Et+1} on page ${ks(t.slot)+1}. Enter: configure, arrow keys: move`),R=k(()=>new Date(d.now)),T=k(()=>(R.value.getHours()%12+R.value.getMinutes()/60)*30),$=k(()=>R.value.getMinutes()*6);async function x(w){if(w.key==="Enter"||w.key===" "){w.preventDefault(),_o(t.tile.entity);return}const m={ArrowLeft:-1,ArrowRight:1,ArrowUp:-2,ArrowDown:2}[w.key];m&&(w.preventDefault(),Bs(t.tile,t.tile.slot+(s.value?Math.sign(m)*2:m))&&(await Lo(),document.querySelector(`.pages [data-slot="${t.tile.slot}"]`)?.focus()))}return(w,m)=>Te((h(),g("div",{class:re(["tile",{wide:s.value,bare:l.value,placeholder:e.placeholder||!D.value,chosen:A.value}]),"data-slot":e.slot,style:Ne(o.value&&!l.value?{backgroundColor:o.value}:void 0),tabindex:D.value?0:-1,role:D.value?"button":void 0,"aria-label":D.value?I.value:void 0,onClick:m[1]||(m[1]=H=>D.value&&v(_o)(e.tile.entity)),onKeydown:m[2]||(m[2]=H=>D.value&&x(H))},[r.value==="analog"?(h(),g(W,{key:0},[(h(),g("svg",Zc,[m[3]||(m[3]=i("circle",{cx:"30",cy:"30",r:"27",fill:"#fff",stroke:"#c9ccd1"},null,-1)),(h(),g(W,null,le([0,90,180,270],H=>i("line",{key:H,x1:"30",y1:"5",x2:"30",y2:"9",stroke:"#1b1b1b","stroke-width":"1.5",transform:`rotate(${H} 30 30)`},null,8,ed)),64)),i("line",{x1:"30",y1:"30",x2:"30",y2:"16",stroke:"#1b1b1b","stroke-width":"2.4","stroke-linecap":"round",transform:`rotate(${T.value} 30 30)`},null,8,td),i("line",{x1:"30",y1:"30",x2:"30",y2:"11",stroke:"#1b1b1b","stroke-width":"1.6","stroke-linecap":"round",transform:`rotate(${$.value} 30 30)`},null,8,nd),m[4]||(m[4]=i("circle",{cx:"30",cy:"30",r:"1.8",fill:"#1b1b1b"},null,-1))])),s.value?(h(),g("span",sd,[i("span",od,[i("span",id,y(n.value),1),i("span",ld,y(u.value),1)])])):V("",!0)],64)):s.value?(h(),g(W,{key:1},[i("span",ad,[i("span",rd,y(v(ke)(v(wo)(e.tile))),1),i("span",ud,[i("span",cd,y(n.value),1),u.value?(h(),g("span",dd,y(u.value),1)):V("",!0)])]),e.tile.options?.inline==="slider"?(h(),g("span",fd)):V("",!0),a.value?(h(),g("span",pd,[a.value==="toggle"?(h(),g("span",hd)):a.value==="setpoint"?(h(),g("span",vd,[i("span",md,y(b("minus")||"−"),1),m[5]||(m[5]=i("b",null,"20°",-1)),i("span",gd,y(b("plus")||"+"),1)])):a.value==="stepper"&&c.value.endsWith("select")?(h(),g(W,{key:2},[i("span",yd,y(b("chevron-left")),1),i("span",bd,y(b("chevron-right")),1)],64)):a.value==="stepper"?(h(),g("span",wd,[i("span",_d,y(b("minus")||"−"),1),m[6]||(m[6]=i("b",null,"50",-1)),i("span",kd,y(b("plus")||"+"),1)])):a.value==="mode"?(h(),g(W,{key:4},[i("span",$d,y(b("power")),1),i("span",xd,y(b("fire")),1),i("span",Sd,y(b("snowflake")),1)],64)):a.value==="volume"?(h(),g(W,{key:5},[m[7]||(m[7]=i("span",{class:"range"},null,-1)),i("span",Cd,y(b("volume-high")),1)],64)):a.value==="playback"?(h(),g(W,{key:6},[i("span",Td,y(b("skip-previous")),1),i("span",Ad,y(b("play")),1),i("span",Ed,y(b("skip-next")),1)],64)):a.value==="buttons"&&c.value==="cover"?(h(),g(W,{key:7},[i("span",Pd,y(b("arrow-expand-horizontal")),1),i("span",Od,y(b("stop")),1),i("span",Id,y(b("arrow-collapse-horizontal")),1)],64)):a.value==="buttons"&&c.value==="vacuum"?(h(),g(W,{key:8},[i("span",Md,y(b("play")),1),i("span",Dd,y(b("stop")),1),i("span",Ld,y(b("home-map-marker")),1)],64)):a.value==="buttons"&&c.value==="timer"?(h(),g(W,{key:9},[i("span",Fd,y(b("play")),1),i("span",Hd,y(b("close")),1)],64)):a.value==="run"?(h(),g("span",Rd,y({scene:"Activate",script:"Run"}[c.value]||"Press"),1)):(h(),g("span",Nd))])):V("",!0)],64)):(h(),g(W,{key:2},[i("span",jd,y(v(ke)(v(wo)(e.tile))),1),i("span",Bd,[i("span",Ud,y(n.value),1),u.value?(h(),g("span",Vd,y(u.value),1)):V("",!0),e.tile.options?.inline==="slider"?(h(),g("span",Wd)):V("",!0)])],64)),D.value?(h(),g("button",{key:3,type:"button",class:"remove",title:"Remove tile","aria-label":`Remove ${n.value}`,onClick:m[0]||(m[0]=Ft(H=>v(ca)(e.tile),["stop"]))},"✕",8,Kd)):V("",!0)],46,Qc)),[[v(fa),{kind:"tile",tile:e.tile}]])}}),Yd=["viewBox","aria-label"],zd=["y"],Gd=["cx","cy","r","stroke","stroke-width"],Jd=["x1","y1","x2","y2","stroke","stroke-width"],Xd=["x","y","fill"],Qd=["x","y"],va=$e({__name:"TopbarSvg",props:{items:{},nameText:{},single:{type:Boolean}},setup(e,{expose:t}){const n=e,s=k(()=>{d.fontsVersion,d.now,d.topbarPreviews;const T=n.items||Dt();return ea(T,ua.value,n.nameText??(d.layout?.title||"Home"),Rt)}),o=k(()=>s.value.metrics),l=k(()=>n.single?Math.round(o.value.text*1.4):o.value.top+Math.round(o.value.name*.45)),r=k(()=>n.single?Math.round(o.value.text*1.05):o.value.top),u=k(()=>{if(!n.single)return s.value.placed;const T=s.value.parts[0];return T&&(T.x=0),T?[T]:[]}),a=k(()=>n.single?`-2 0 ${Math.max(1,u.value[0]?.width||1)+4} ${l.value}`:`0 0 ${o.value.width} ${l.value}`),c=k(()=>r.value+(s.value.zero.top+s.value.zero.bottom)/2),f=k(()=>Qu(s.value.nameText,s.value.fonts.name,Math.min(s.value.natural,s.value.nameRoom))),b=k(()=>new Date(d.now));function A(T){const $=b.value;return[[($.getHours()%12+$.getMinutes()/60)*30,T*.24],[$.getMinutes()*6,T*.34]].map(([x,w])=>{const m=x*Math.PI/180;return{x2:w*Math.sin(m),y2:-w*Math.cos(m)}})}const D=T=>T.x-T.icon.ink.left,I=T=>(T.icon?T.x+(T.icon.ink.right-T.icon.ink.left)+s.value.gaps.icon:T.x)-T.text.ink.left,R=k(()=>`${(Math.max(1,u.value[0]?.width||1)+4)*(26/o.value.icon)}px`);return t({lay:s}),(T,$)=>(h(),g("svg",{viewBox:a.value,role:"img","aria-label":e.single?"How it looks on the screen":`Top bar: ${s.value.nameText}`,style:Ne(e.single?{width:R.value}:void 0)},[e.single?V("",!0):(h(),g("text",{key:0,x:"0",y:o.value.top,fill:"#1b1b1b",style:Ne({font:s.value.fonts.name})},y(f.value),13,zd)),i("g",null,[(h(!0),g(W,null,le(u.value,x=>(h(),g(W,{key:x.index},[x.dial?(h(),g(W,{key:0},[i("circle",{cx:x.x+x.dial/2,cy:c.value,r:x.dial/2-Math.max(1,Math.round(x.dial/10))/2,fill:"none",stroke:x.view.color||"#46525e","stroke-width":Math.max(1,Math.round(x.dial/10))},null,8,Gd),(h(!0),g(W,null,le(A(x.dial),(w,m)=>(h(),g("line",{key:m,x1:x.x+x.dial/2,y1:c.value,x2:x.x+x.dial/2+w.x2,y2:c.value+w.y2,stroke:x.view.color||"#46525e","stroke-width":Math.max(1,Math.round(x.dial*.075)),"stroke-linecap":"round"},null,8,Jd))),128))],64)):(h(),g(W,{key:1},[x.icon?(h(),g("text",{key:0,x:D(x),y:c.value-(x.icon.ink.top+x.icon.ink.bottom)/2,fill:x.view.color||"#46525e",style:Ne({font:s.value.fonts.icon})},y(x.icon.glyph),13,Xd)):V("",!0),x.text?(h(),g("text",{key:1,x:I(x),y:r.value,fill:"#46525e",style:Ne({font:s.value.fonts.text})},y(x.text.value),13,Qd)):V("",!0)],64))],64))),128))])],12,Yd))}}),Zd={class:"page"},ef={class:"page-label"},tf={key:1},nf={class:"tiles"},sf=["data-slot","aria-label","onClick"],of=$e({__name:"DevicePage",props:{page:{},entries:{},pages:{},moving:{}},setup(e){const t=e,n=k(()=>new Map(t.entries.map(c=>[c.slot,c]))),s=k(()=>new Set(t.entries.filter(c=>Qe(c.tile)).map(c=>c.slot+1))),o=k(()=>Array.from({length:Et},(c,f)=>t.page*Et+f).filter(c=>!s.value.has(c))),l=k(()=>t.pages>1&&!t.entries.some(c=>ks(c.slot)===t.page)),r=k(()=>d.inspector?.kind==="bar"||d.inspector?.kind==="bar-add"),u=k(()=>t.entries.filter(c=>ks(c.slot)===t.page).reduce((c,f)=>c+(Qe(f.tile)?2:1),0));function a(c){const f=d.insertAt===c;d.insertAt=f?-1:c,d.insertAt>=0&&document.querySelector("#search")?.focus()}return(c,f)=>(h(),g("div",Zd,[i("div",ef,[i("span",null,"Page "+y(e.page+1),1),l.value?(h(),g("button",{key:0,type:"button",class:"btn mini",title:"The pages after this one shift up one slot",onClick:f[0]||(f[0]=b=>v(vc)(e.page))},"Remove page")):(h(),g("span",tf,y(u.value)+" / "+y(v(Et)),1))]),i("div",{class:re(["device",{cyd:!v(Yo)}])},[i("div",{class:re(["bar-wrap",{selected:r.value}]),title:"Edit top bar",role:"button",tabindex:"0",onClick:f[1]||(f[1]=b=>v(Ct)(0)),onKeydown:f[2]||(f[2]=Ql(Ft(b=>v(Ct)(0),["prevent"]),["enter"]))},[_e(va)],34),i("div",nf,[(h(!0),g(W,null,le(o.value,b=>(h(),g(W,{key:b},[n.value.get(b)?(h(),Ve(qd,{key:0,tile:n.value.get(b).tile,slot:b,placeholder:n.value.get(b).tile===e.moving},null,8,["tile","slot","placeholder"])):(h(),g("button",{key:1,type:"button",class:re(["cell",{"insert-here":v(d).insertAt===b}]),"data-slot":b,title:"Empty slot. Click to add a tile here, or drag one over.","aria-label":`Empty slot ${b%v(Et)+1} on page ${e.page+1}: add the next tile here`,onClick:A=>a(b)},[f[3]||(f[3]=i("span",null,"+",-1)),i("small",null,y(v(d).insertAt===b?"Next tile goes here":"Empty"),1)],10,sf))],64))),128))])],2)]))}}),lf={class:"library",id:"library"},af={class:"lib-head"},rf={class:"lib-title"},uf={class:"filters",id:"filters"},cf=["aria-pressed","onClick"],df={class:"lib-list",id:"results","aria-live":"polite"},ff=["title","disabled","onClick"],pf={class:"tx"},hf={key:0,class:"hint"},vf={key:1,class:"hint"},mf={class:"lib-foot"},gf=$e({__name:"Library",setup(e){const t=[["","All"],["light","Lights"],["climate","Climate"],["switch","Switches"],["binary_sensor","Status"],["button","Actions"],["script","Scripts"],["fan","Fans"],["cover","Covers"],["scene","Scenes"],["vacuum","Vacuum"],["sensor","Sensors"],["media_player","Media"],["weather","Weather"],["number","Values"],["select","Selects"],["person","People"],["timer","Timers"],["screen","Clock"]],n={switch:"input_boolean",number:"input_number",select:"input_select",weather:"sun",button:"input_button"},s=k(()=>new Set(d.layout?.tiles.map(u=>u.entity)||[])),o=k(()=>{const u=d.search.toLocaleLowerCase(),a=d.filter;return[...d.inventory.builtin||[],...d.inventory.entities].filter(c=>c.tile!==!1&&(Yo.value||!["camera","image"].includes(c.id.split(".")[0]))&&(!a||c.id.startsWith(a+".")||n[a]===c.id.split(".")[0])&&`${c.name} ${c.id} ${c.device||""} ${c.area||""}`.toLocaleLowerCase().includes(u))}),l=k(()=>(d.layout?.tiles.length||0)>=Hn.value),r=k(()=>d.inventory.entities.length);return(u,a)=>(h(),g("aside",lf,[i("div",af,[i("div",rf,[a[1]||(a[1]=Q("Library ",-1)),i("small",null,y(r.value)+" entities",1)]),Te(i("input",{id:"search","onUpdate:modelValue":a[0]||(a[0]=c=>v(d).search=c),type:"search",placeholder:"Search by name, device, or room…",autocomplete:"off","aria-label":"Add an entity"},null,512),[[Je,v(d).search]]),i("div",uf,[(h(),g(W,null,le(t,([c,f])=>i("button",{key:c,type:"button","aria-pressed":v(d).filter===c?"true":"false",onClick:b=>v(d).filter=c},[c?(h(),g("span",{key:0,class:"domain-icon",style:Ne({color:v(xt)(c+".")[2],background:v(xt)(c+".")[3]}),"aria-hidden":"true"},y(v(xt)(c+".")[1]),5)):V("",!0),Q(y(f),1)],8,cf)),64))])]),i("div",df,[(h(!0),g(W,null,le(o.value.slice(0,80),c=>Te((h(),g("button",{key:c.id,type:"button",class:"ent",title:c.id,disabled:s.value.has(c.id)||l.value,onClick:f=>v(hc)(c.id)},[i("span",{class:"av mdi",style:Ne({color:v(xt)(c.id)[2],background:v(xt)(c.id)[3]})},y(v(d).inventory.icons?v(ke)(v(on)(c.id)):v(xt)(c.id)[1]),5),i("span",pf,[i("b",null,y(c.name),1),i("small",null,y([v(xt)(c.id)[0],c.area,c.device].filter(Boolean).join(" · ")),1)]),i("span",{class:re(["add",{done:s.value.has(c.id)}])},y(s.value.has(c.id)?"✓":"+"),3)],8,ff)),[[v(fa),{kind:"entity",id:c.id}]])),128)),o.value.length?o.value.length>80?(h(),g("p",vf,y(o.value.length)+" results. Keep typing to narrow it down.",1)):V("",!0):(h(),g("p",hf,"No entities found. Try a different name."))]),i("div",mf,y(l.value?`This screen holds ${v(Hn)} tiles${v(Hn)===10?"; update its firmware for 20":""}.`:"Drag onto a page, or tap + to add to the first free slot."),1)]))}}),yf={class:"canvas-head"},bf={id:"count"},wf={key:0,id:"no-tiles"},_f={key:1},kf={key:2,id:"positions-hint",class:"warn"},$f={class:"pages",id:"layout-preview","aria-label":"Screen layout"},xf={class:"page-label"},Sf=["tabindex"],Cf=$e({__name:"LayoutView",setup(e){const t=k(()=>d.layout),n=k(()=>d.drag.preview||wt(t.value)),s=k(()=>zt(n.value,t.value.pages)),o=k(()=>mc()),l=k(()=>s.value<gn),r=k(()=>tc(t.value.tiles)&&!fn(0,2,26)?`Empty slots and fixed positions work from firmware 0.2.26. This screen (firmware ${qt.value?.firmware||"unknown"}) shifts the tiles up to the first free slot until that update.`:"");function u(a){a.target.closest(".device, .page-label, .canvas-head")||d.inspector&&je()}return(a,c)=>(h(),g(W,null,[i("div",{class:"canvas",id:"canvas",onClick:u},[i("div",yf,[i("b",bf,y(s.value)+" "+y(s.value===1?"page":"pages")+" · "+y(t.value.tiles.length)+" / "+y(v(Hn))+" tiles",1),t.value.tiles.length?(h(),g("span",_f,"Tap the top bar or a tile to change it. Drag to move; drop on the next page for a new one.")):(h(),g("span",wf,"Add your first light, scene, or device from the library.")),r.value?(h(),g("span",kf,y(r.value),1)):V("",!0)]),i("div",$f,[(h(!0),g(W,null,le(o.value,f=>(h(),Ve(of,{key:f,page:f-1,entries:n.value,pages:s.value,moving:v(d).drag.moving},null,8,["page","entries","pages","moving"]))),128)),i("div",{class:re(["page ghost",{disabled:!l.value}])},[i("div",xf,[i("span",null,"Page "+y(o.value+1),1)]),i("div",{class:re(["device",{cyd:v(qt)?.board!=="guition"}]),id:"add-page",role:"button",tabindex:l.value?0:-1,onClick:c[0]||(c[0]=f=>l.value&&v(Hi)()),onKeydown:c[1]||(c[1]=Ql(Ft(f=>l.value&&v(Hi)(),["prevent"]),["enter"]))},y(l.value?"+ Add page":`${v(gn)} pages is the most`),43,Sf)],2)])]),_e(gf)],64))}}),Tf={class:"status",id:"settings-status",role:"status"},Af={key:0,class:"set-grid",id:"settings-groups"},Ef={class:"mdi"},Pf=["data-setting","title","onClick"],Of=["id"],If={class:"s-control"},Mf=["id","aria-checked","aria-labelledby","disabled","onClick"],Df=["aria-labelledby"],Lf=["aria-pressed","disabled","onClick"],Ff={key:2,class:"step"},Hf=["aria-label","disabled","onPointerdown","onClick"],Rf={class:"mdi"},Nf=["id","aria-labelledby"],jf=["aria-label","disabled","onPointerdown","onClick"],Bf={class:"mdi"},Uf=$e({__name:"SettingsTab",setup(e){const t=k(()=>Jo()),n=k(()=>yn()),s=k(()=>t.value?.owner==="screen"&&!qt.value?.online),o=k(()=>yc.map(I=>({...I,rows:I.rows.filter(R=>t.value?.keys.includes(R.key))})).filter(I=>I.rows.length)),l=I=>s.value||!!t.value?.unavailable.includes(I.key),r=I=>I.needs?!!n.value[I.needs]:!0,u=k(()=>s.value?"This screen is offline. Its settings can change once it's back.":d.settingPending?"Saving…":t.value?.owner==="screen"?"Changes apply on the screen at once, and show up here when they change there.":"Changes apply at once. Firmware 0.2.49 lets the screen keep them itself."),a=(I,R)=>{const T=n.value[I.key];return l(I)||!r(I)||T===null||T===void 0?!0:I.kind!=="moment"&&Bi(I,T,R,!1,n.value)===T},c=new WeakMap;function f(I,R,T){const $=yn(),x=Bi(I,$[I.key],R,T,$);x!==$[I.key]&&An(I.key,x,600)}function b(I,R,T){const $=I.currentTarget;if($.disabled||I.button!==0)return;const x={timer:0,held:!1};c.set($,x);let w=0;x.timer=window.setTimeout(function m(){x.held=!0,w+=1,f(R,T,w>5),x.timer=window.setTimeout(m,180)},450)}function A(I){const R=c.get(I.currentTarget);R&&clearTimeout(R.timer)}function D(I,R,T){const $=c.get(I.currentTarget);if($?.held){$.held=!1;return}f(R,T,!1)}return(I,R)=>(h(),g("div",{class:re(["settings",{offline:s.value}]),id:"general-settings"},[i("span",Tf,y(u.value),1),t.value?(h(),g("div",Af,[(h(!0),g(W,null,le(o.value,T=>(h(),g("section",{key:T.title,class:"set-card"},[i("h4",null,[i("span",Ef,y(v(ke)(T.icon)),1),Q(y(T.title),1)]),(h(!0),g(W,null,le(T.rows,$=>(h(),g("div",{key:$.key,class:re(["srow",[`setting-${$.kind}`,{inactive:!r($)||l($)}]]),"data-setting":$.key,title:l($)&&!s.value?"This entity is off in Home Assistant, or the screen is restarting.":"",onClick:x=>$.kind==="toggle"&&x.target.closest(".srow")===x.currentTarget&&!x.target.closest("button")&&!l($)&&v(An)($.key,!n.value[$.key],150)},[i("span",{class:"s-label",id:`setting-label-${$.key}`},y($.label),9,Of),i("div",If,[$.kind==="toggle"?(h(),g("button",{key:0,type:"button",class:re(["switch",{unknown:n.value[$.key]===null||n.value[$.key]===void 0}]),role:"switch",id:`setting-${$.key}`,"aria-checked":n.value[$.key]?"true":"false","aria-labelledby":`setting-label-${$.key}`,disabled:l($),onClick:Ft(x=>v(An)($.key,!n.value[$.key],150),["stop"])},null,10,Mf)):$.kind==="choice"?(h(),g("div",{key:1,class:"seg",role:"group","aria-labelledby":`setting-label-${$.key}`},[(h(!0),g(W,null,le($.options,([x,w])=>(h(),g("button",{key:String(x),type:"button","aria-pressed":n.value[$.key]===x?"true":"false",disabled:l($),onClick:m=>v(An)($.key,x,150)},y(w),9,Lf))),128))],8,Df)):(h(),g("div",Ff,[i("button",{type:"button","aria-label":`${$.label} lower`,disabled:a($,-1),onPointerdown:x=>b(x,$,-1),onPointerup:A,onPointercancel:A,onPointerleave:A,onClick:x=>D(x,$,-1)},[i("span",Rf,y(v(ke)("F0374")),1)],40,Hf),i("output",{id:`setting-${$.key}`,"aria-labelledby":`setting-label-${$.key}`},y(v(kc)($,n.value)),9,Nf),i("button",{type:"button","aria-label":`${$.label} higher`,disabled:a($,1),onPointerdown:x=>b(x,$,1),onPointerup:A,onPointercancel:A,onPointerleave:A,onClick:x=>D(x,$,1)},[i("span",Bf,y(v(ke)("F0415")),1)],40,jf)]))])],10,Pf))),128))]))),128))])):V("",!0)],2))}}),Vf={class:"seg wrap",role:"group"},Wf=["disabled","aria-pressed","onClick"],nt=$e({__name:"Segmented",props:{choices:{},value:{},disabled:{type:Boolean}},emits:["pick"],setup(e,{emit:t}){const n=t;return(s,o)=>(h(),g("div",Vf,[(h(!0),g(W,null,le(e.choices,([l,r])=>(h(),g("button",{key:String(l),type:"button",disabled:e.disabled,"aria-pressed":String(l)===String(e.value)?"true":"false",onClick:u=>n("pick",l)},y(r),9,Wf))),128))]))}}),Kf={class:"f"},qf={key:0},Yf={key:1,class:"warn"},zf=["aria-expanded"],Gf={class:"tx"},Jf={key:0,class:"mono"},Xf={class:"link"},Qf={key:0,class:"picker"},Zf={class:"action-list"},ep=["aria-pressed","onClick"],tp={key:0,class:"hint"},np={key:1,class:"warn"},sp={class:"f-label"},op=["aria-label","value","onChange"],ip=["value"],lp={key:3,class:"action-number"},ap=["aria-label","value","onInput"],rp=["onClick"],up={key:4,class:"action-number"},cp=["aria-label","min","max","step","value","placeholder","onInput"],dp={key:0},fp=["aria-label","value","placeholder","onInput"],pp={key:6},hp={key:0,class:"warn"},vp={key:3},mp=$e({__name:"ActionPicker",props:{tile:{}},setup(e){const t=e,n=k(()=>d.entityActions[t.tile.entity]),s=k(()=>t.tile.options?.action),o=k(()=>n.value?.find(m=>m.action===s.value?.action)),l=k(()=>d.actionPickerOpen||!s.value),r=k(()=>{const m=d.actionSearch.trim().toLocaleLowerCase();return(n.value||[]).filter(H=>`${H.name} ${H.action} ${H.description}`.toLocaleLowerCase().includes(m))});n.value===void 0&&dc(t.tile.entity);function u(m){const H=m.action===s.value?.action;t.tile.options={...t.tile.options,action:H?s.value:{action:m.action}},d.actionPickerOpen=!1,et()}function a(m,H){const C={...t.tile.options?.action?.data||{}};H===void 0?delete C[m]:C[m]=H,t.tile.options={...t.tile.options,action:{action:s.value.action,...Object.keys(C).length?{data:C}:{}}},et()}const c=k(()=>{if(!o.value)return[];const m=t.tile.options?.action?.data||{};return o.value.fields.filter(H=>H.required&&m[H.key]===void 0).map(H=>H.name)}),f=m=>Object.keys(m.selector||{})[0]||"text",b=m=>(m.selector||{})[f(m)]||{},A=m=>m.example===void 0?"":typeof m.example=="string"?m.example:JSON.stringify(m.example);function D(m){const H=b(m),C=f(m);return Array.isArray(m.options)?m.options.map(L=>[L,L]):C==="select"&&Array.isArray(H.options)&&!H.multiple?H.options.map(L=>L&&typeof L=="object"?[String(L.value),String(L.label??L.value)]:[String(L),String(L)]):null}const I=m=>"#"+m.map(H=>Math.max(0,Math.min(255,Number(H)||0)).toString(16).padStart(2,"0")).join(""),R=m=>Array.isArray(m)&&m.length===3?I(m):"#ffffff",T=m=>m===void 0?"":typeof m=="string"?m:JSON.stringify(m);function $(m,H){const C=H.trim();if(!C)return a(m.key,void 0);if(f(m)==="text")return a(m.key,H);try{a(m.key,JSON.parse(C))}catch{a(m.key,H)}}function x(m,H){a(m.key,H===""||!Number.isFinite(Number(H))?void 0:Number(H))}const w=m=>b(m).unit_of_measurement||f(m)==="color_temp"&&b(m).unit||"";return(m,H)=>(h(),g("div",Kf,[H[3]||(H[3]=i("span",{class:"f-label"},"Action",-1)),n.value===void 0?(h(),g("small",qf,"Asking Home Assistant which actions this entity has…")):n.value===null?(h(),g("small",Yf,"Home Assistant isn't answering right now. Try again in a moment.")):(h(),g(W,{key:2},[i("button",{type:"button",class:"row","aria-expanded":l.value?"true":"false",onClick:H[0]||(H[0]=C=>v(d).actionPickerOpen=!l.value)},[i("span",Gf,[i("b",null,y(o.value?o.value.name:s.value?s.value.action:"Choose an action"),1),s.value?(h(),g("small",Jf,y(s.value.action),1)):V("",!0)]),i("span",Xf,y(l.value?"Close":"Change"),1)],8,zf),l.value?(h(),g("div",Qf,[Te(i("input",{"onUpdate:modelValue":H[1]||(H[1]=C=>v(d).actionSearch=C),type:"search",placeholder:"Search, for example toggle, position, or play","aria-label":"Search for an action"},null,512),[[Je,v(d).actionSearch]]),i("div",Zf,[(h(!0),g(W,null,le(r.value,C=>(h(),g("button",{key:C.action,type:"button",class:"action-choice","aria-pressed":C.action===s.value?.action?"true":"false",onClick:L=>u(C)},[i("strong",null,y(C.name),1),i("small",null,y(C.description?`${C.action} · ${C.description}`:C.action),1)],8,ep))),128)),r.value.length?V("",!0):(h(),g("p",tp,"No action found."))])])):V("",!0),s.value&&!o.value?(h(),g("small",np,"Home Assistant doesn't offer this action for this entity any more, so a tap does nothing. Choose another one.")):V("",!0),o.value&&!l.value?(h(),g(W,{key:2},[(h(!0),g(W,null,le(o.value.fields,C=>(h(),g("div",{key:C.key,class:"f"},[i("span",sp,y(C.required?C.name:`${C.name} (optional)`),1),f(C)==="boolean"?(h(),Ve(nt,{key:0,choices:[["","Not set"],["true","On"],["false","Off"]],value:s.value?.data?.[C.key]===void 0?"":String(s.value?.data?.[C.key]),onPick:L=>a(C.key,L===""?void 0:L==="true")},null,8,["value","onPick"])):D(C)&&D(C).length<=4?(h(),Ve(nt,{key:1,choices:[["","Not set"],...D(C)],value:s.value?.data?.[C.key]===void 0?"":String(s.value?.data?.[C.key]),onPick:L=>a(C.key,L===""?void 0:L)},null,8,["choices","value","onPick"])):D(C)?(h(),g("select",{key:2,"aria-label":C.name,value:String(s.value?.data?.[C.key]??""),onChange:L=>a(C.key,L.target.value===""?void 0:L.target.value)},[H[2]||(H[2]=i("option",{value:""},"Not set",-1)),(h(!0),g(W,null,le(D(C),([L,pe])=>(h(),g("option",{key:L,value:L},y(pe),9,ip))),128))],40,op)):f(C)==="color_rgb"?(h(),g("div",lp,[i("input",{type:"color","aria-label":C.name,value:R(s.value?.data?.[C.key]),onInput:L=>a(C.key,[1,3,5].map(pe=>parseInt(L.target.value.slice(pe,pe+2),16)))},null,40,ap),i("button",{type:"button",class:"btn quiet mini",onClick:L=>a(C.key,void 0)},"Not set",8,rp)])):f(C)==="number"||f(C)==="color_temp"?(h(),g("div",up,[i("input",{type:"number","aria-label":C.name,min:b(C).min,max:b(C).max,step:b(C).step==="any"?"any":b(C).step,value:s.value?.data?.[C.key]??"",placeholder:A(C),onInput:L=>x(C,L.target.value)},null,40,cp),w(C)?(h(),g("span",dp,y(w(C)),1)):V("",!0)])):(h(),g("input",{key:5,type:"text","aria-label":C.name,value:T(s.value?.data?.[C.key]),placeholder:A(C),onInput:L=>$(C,L.target.value)},null,40,fp)),C.description?(h(),g("small",pp,y(C.description),1)):V("",!0)]))),128)),c.value.length?(h(),g("small",hp,"Home Assistant needs "+y(c.value.join(", "))+".",1)):V("",!0)],64)):V("",!0),v(fn)(0,2,58)?V("",!0):(h(),g("small",vp,"The screen performs an action from firmware 0.2.58: press Update on the screen. Until then a tap works as Automatic."))],64))]))}}),gp={class:"f"},yp=["aria-expanded"],bp={class:"av mdi"},wp={class:"tx"},_p={class:"link"},kp={key:0,class:"picker"},$p=["aria-pressed","title"],xp={class:"mdi"},Sp=["aria-pressed"],Cp={class:"icon-list"},Tp={class:"icon-grid"},Ap=["title","aria-label","aria-pressed","onClick"],Ep={class:"mdi"},Pp={key:0,class:"hint"},Op={key:1},ma=$e({__name:"IconPicker",props:{selected:{},automatic:{},autoLabel:{},allowNone:{type:Boolean},note:{}},emits:["pick"],setup(e,{emit:t}){const n=e,s=t,o=fe(""),l=k(()=>es(n.selected)),r=k(()=>n.selected==="none"?"":ke(l.value?.cp||n.automatic)),u=k(()=>n.selected==="none"?"No icon":l.value?.label||n.autoLabel),a=k(()=>{const c=o.value.trim().toLocaleLowerCase();return(d.inventory.icons?.groups||[]).map(f=>({label:f.label,icons:f.icons.filter(b=>!c||`${b.label} ${b.name.replaceAll("-"," ")} ${f.label}`.toLocaleLowerCase().includes(c))})).filter(f=>f.icons.length)});return(c,f)=>(h(),g("div",gp,[f[5]||(f[5]=i("span",{class:"f-label"},"Icon",-1)),i("button",{type:"button",class:"row","aria-expanded":v(d).iconPickerOpen?"true":"false",onClick:f[0]||(f[0]=b=>v(d).iconPickerOpen=!v(d).iconPickerOpen)},[i("span",bp,y(r.value),1),i("span",wp,[i("b",null,y(u.value),1)]),i("span",_p,y(v(d).iconPickerOpen?"Close":"Change"),1)],8,yp),v(d).iconPickerOpen?(h(),g("div",kp,[Te(i("input",{"onUpdate:modelValue":f[1]||(f[1]=b=>o.value=b),type:"search",placeholder:"Search, for example lamp, music, or door","aria-label":"Search for an icon"},null,512),[[Je,o.value]]),i("button",{type:"button",class:"icon-choice icon-auto","aria-pressed":e.selected==="auto"?"true":"false",title:e.autoLabel,onClick:f[2]||(f[2]=b=>s("pick","auto"))},[i("span",xp,y(v(ke)(e.automatic)),1),i("span",null,y(e.autoLabel),1)],8,$p),e.allowNone?(h(),g("button",{key:0,type:"button",class:"icon-choice icon-auto","aria-pressed":e.selected==="none"?"true":"false",title:"No icon",onClick:f[3]||(f[3]=b=>s("pick","none"))},[...f[4]||(f[4]=[i("span",{class:"mdi"},null,-1),i("span",null,"No icon, text only",-1)])],8,Sp)):V("",!0),i("div",Cp,[(h(!0),g(W,null,le(a.value,b=>(h(),g("section",{key:b.label},[i("small",null,y(b.label),1),i("div",Tp,[(h(!0),g(W,null,le(b.icons,A=>(h(),g("button",{key:A.name,type:"button",class:"icon-choice",title:A.label,"aria-label":`Icon: ${A.label}`,"aria-pressed":e.selected===A.name?"true":"false",onClick:D=>s("pick",A.name)},[i("span",Ep,y(v(ke)(A.cp)),1)],8,Ap))),128))])]))),128)),a.value.length?V("",!0):(h(),g("p",Pp,"No icon found."))])])):V("",!0),e.note?(h(),g("small",Op,y(e.note),1)):V("",!0)]))}}),Ip={class:"dr-head"},Mp={class:"tx"},Dp={class:"mono"},Lp={class:"dr-body"},Fp={class:"f"},Hp=["value","placeholder"],Rp={class:"f"},Np={key:0,class:"warn"},jp={class:"f"},Bp={key:1,class:"f"},Up={key:2,class:"f"},Vp={key:4,class:"f"},Wp={key:0,class:"warn"},Kp={key:5,class:"f"},qp={class:"f"},Yp={class:"sw"},zp=["aria-label","aria-pressed","onClick"],Gp={class:"dr-foot"},Jp=$e({__name:"TileInspector",props:{tile:{}},setup(e){const t=e,n=k(()=>t.tile.entity.split(".")[0]),s=k(()=>Zn(t.tile.entity)),o=k(()=>d.capabilities[t.tile.entity]),l=(J,q)=>t.tile.options?.[J]??q,r=k(()=>l("display",n.value==="screen"?"digital":"standard")),u=k(()=>{const J=n.value==="screen"?[["digital","Digital clock"],["analog","Analog clock"]]:[["standard","Name and status"],["watch","Large value"]],q=o.value;return n.value==="weather"&&(!q||q.displays.includes("forecast")||r.value==="forecast")&&J.push(["forecast","Weather forecast"]),n.value==="sensor"&&(!q||q.displays.includes("graph")||r.value==="graph")&&J.push(["graph","Graph"]),n.value==="sun"&&J.push(["sunpath","Sun path"]),J}),a=k(()=>{const J=o.value;return J&&r.value==="graph"&&!J.displays.includes("graph")?"Home Assistant has no numbers for this entity, so the graph stays empty. Choose another display.":J&&r.value==="forecast"&&!J.displays.includes("forecast")?"This weather service has no daily forecast in Home Assistant. Choose another display.":""}),c=k(()=>l("size","single")),f=k(()=>d.inventory.controls?.[n.value]),b=k(()=>l("controls",f.value?.default)),A=k(()=>{const J=o.value;return(f.value?.choices||[]).filter(q=>!J||q.key==="none"||q.key===b.value||J.controls.includes(q.key)).map(q=>[q.key,q.label])}),D=k(()=>{const J=o.value;return J&&b.value!=="none"&&!J.controls.includes(b.value)?{text:"Home Assistant doesn't offer this control for this entity, so it stays empty on the screen. Choose another one.",warn:!0}:{text:fn(0,2,19)?"On the right of the double-width tile, like the rows in Home Assistant. Tapping the name works as set below.":"The screen shows direct control from firmware 0.2.19; until then the tile stays as it was.",warn:!1}}),I=k(()=>l("tap","auto")),R=k(()=>{const J=[["auto","Automatic"],["detail","Open control"],["none","View only"]];return((o.value?o.value.toggle:Li.includes(n.value))||I.value==="toggle")&&J.push(["toggle","On / off"]),J.push(["action","Perform action"]),J}),T=k(()=>I.value==="toggle"&&o.value&&!o.value.toggle?{text:"Home Assistant can't turn this on and off, so a tap does nothing. Choose another option.",warn:!0}:I.value==="toggle"&&!Li.includes(n.value)&&!fn(0,2,58)?{text:"The screen switches this from firmware 0.2.58: press Update on the screen. Until then a tap opens its card.",warn:!1}:I.value==="toggle"?{text:"Hold the tile to open its card.",warn:!1}:null),$=k(()=>l("inline","none")),x=k(()=>ac.includes(n.value)&&(!o.value||o.value.inline||$.value==="slider")),w=k(()=>$.value==="slider"&&o.value&&!o.value.inline),m=k(()=>l("history_hours",24)),H=k(()=>Object.entries(d.inventory.backgrounds||{})),C=k(()=>!!d.inventory.entities.find(J=>J.id===t.tile.entity)?.icon),L=k(()=>!!d.inventory.icons&&n.value!=="screen"&&!["forecast","sunpath"].includes(r.value));function pe(J){t.tile.name=J,et()}function Ae(){d.inspector={kind:"inspect",entity:t.tile.entity}}return(J,q)=>(h(),g(W,null,[i("div",Ip,[i("span",{class:"av mdi",style:Ne({color:v(xt)(e.tile.entity)[2],background:v(xt)(e.tile.entity)[3]})},y(v(ke)(v(wo)(e.tile))),5),i("span",Mp,[i("b",null,y(e.tile.name||s.value),1),i("small",Dp,y(e.tile.entity),1)]),i("button",{type:"button",class:"icon-btn","aria-label":"Close",onClick:q[0]||(q[0]=(...ae)=>v(je)&&v(je)(...ae))},"✕")]),i("div",Lp,[i("div",Fp,[q[10]||(q[10]=i("label",{class:"f-label",for:"tile-name"},"Name on the screen",-1)),i("input",{id:"tile-name",value:e.tile.name,placeholder:s.value,maxlength:"60",onInput:q[1]||(q[1]=ae=>pe(ae.target.value))},null,40,Hp)]),L.value?(h(),Ve(ma,{key:0,selected:e.tile.options?.icon||"auto",automatic:v(on)(e.tile.entity),"auto-label":`Automatic (${C.value?"from Home Assistant":"default"})`,note:v(fn)(0,2,18)?"":"The screen shows a chosen icon from firmware 0.2.18.",onPick:q[2]||(q[2]=ae=>v(Ht)(e.tile,"icon",ae))},null,8,["selected","automatic","auto-label","note"])):V("",!0),i("div",Rp,[q[11]||(q[11]=i("span",{class:"f-label"},"Display",-1)),_e(nt,{choices:u.value,value:r.value,onPick:q[3]||(q[3]=ae=>v(Ht)(e.tile,"display",ae))},null,8,["choices","value"]),a.value?(h(),g("small",Np,y(a.value),1)):V("",!0)]),i("div",jp,[q[12]||(q[12]=i("span",{class:"f-label"},"Width",-1)),_e(nt,{choices:[["single","Normal"],["wide","Double-width"]],value:c.value,onPick:q[4]||(q[4]=ae=>v(Ht)(e.tile,"size",ae))},null,8,["value"])]),f.value&&c.value==="wide"?(h(),g("div",Bp,[q[13]||(q[13]=i("span",{class:"f-label"},"Direct control on the tile",-1)),_e(nt,{choices:A.value,value:b.value,onPick:q[5]||(q[5]=ae=>v(Ht)(e.tile,"controls",ae))},null,8,["choices","value"]),i("small",{class:re({warn:D.value.warn})},y(D.value.text),3)])):V("",!0),n.value!=="screen"?(h(),g("div",Up,[q[14]||(q[14]=i("span",{class:"f-label"},"On tap",-1)),_e(nt,{choices:R.value,value:I.value,onPick:q[6]||(q[6]=ae=>v(Ht)(e.tile,"tap",ae))},null,8,["choices","value"]),T.value?(h(),g("small",{key:0,class:re({warn:T.value.warn})},y(T.value.text),3)):V("",!0)])):V("",!0),n.value!=="screen"&&I.value==="action"?(h(),Ve(mp,{key:3,tile:e.tile},null,8,["tile"])):V("",!0),x.value?(h(),g("div",Vp,[q[15]||(q[15]=i("span",{class:"f-label"},"Small slider on the tile",-1)),_e(nt,{choices:[["none","No"],["slider","Yes, control directly"]],value:$.value,onPick:q[7]||(q[7]=ae=>v(Ht)(e.tile,"inline",ae))},null,8,["value"]),w.value?(h(),g("small",Wp,"Home Assistant has nothing a slider can change for this entity. Choose No.")):V("",!0)])):V("",!0),n.value==="sensor"?(h(),g("div",Kp,[q[16]||(q[16]=i("span",{class:"f-label"},"History",-1)),_e(nt,{choices:[[1,"1 hour"],[6,"6 hours"],[24,"24 hours"]],value:m.value,onPick:q[8]||(q[8]=ae=>v(Ht)(e.tile,"history_hours",Number(ae)))},null,8,["value"])])):V("",!0),i("div",qp,[q[17]||(q[17]=i("span",{class:"f-label"},"Pastel background",-1)),i("div",Yp,[(h(!0),g(W,null,le(H.value,([ae,z])=>(h(),g("button",{key:ae,type:"button","aria-label":`Background: ${z.label}`,"aria-pressed":(e.tile.options?.background||"auto")===ae?"true":"false",onClick:B=>v(Ht)(e.tile,"background",ae)},[i("i",{class:re(z.color?"":ae==="none"?"none":"auto"),style:Ne(z.color?{background:z.color}:void 0)},null,6),Q(y(z.label),1)],8,zp))),128))])])]),i("div",Gp,[i("button",{type:"button",class:"btn danger",onClick:q[9]||(q[9]=ae=>v(ca)(e.tile))},"Remove"),q[18]||(q[18]=i("span",{class:"spacer"},null,-1)),n.value!=="screen"?(h(),g("button",{key:0,type:"button",class:"btn quiet",onClick:Ae},"Read current data")):V("",!0)])],64))}}),Xp={class:"dr-head"},Qp={class:"av mdi",style:{background:"var(--seg)",color:"var(--ink-2)"}},Zp={class:"tx"},eh={class:"dr-body"},th={class:"f"},nh=["value"],sh={class:"f"},oh={class:"f-label",id:"topbar-caption"},ih={style:{"text-transform":"none","letter-spacing":"0","font-weight":"500"}},lh={class:"items",id:"topbar-chips",role:"list","aria-labelledby":"topbar-caption"},ah=["data-index","aria-label","onPointerdown","onClick","onKeydown"],rh={class:"tx"},uh=["aria-label","onClick"],ch=["disabled","title"],dh={class:"live",id:"topbar-live"},fh={class:"f"},ph={class:"f"},hh={key:1,class:"f"},vh={key:2},mh={key:0,class:"dr-foot"},gh=["disabled"],yh=["disabled"],bh=$e({__name:"TopbarInspector",props:{index:{}},setup(e){const t=e,n=k(()=>Dt()),s=k(()=>n.value[t.index]),o=k(()=>(d.fontsVersion,d.now,d.topbarPreviews,ea(n.value,ua.value,d.layout?.title||"Home",Rt))),l=k(()=>o.value.dropped),r=k(()=>d.inventory.header?.min_firmware||"0.2.32"),u=k(()=>{const[z,B,Y]=r.value.split(".").map(Number);return fn(z,B,Y)}),a=k(()=>u.value?l.value.size?"Not everything fits next to the name: the screen drops the dashed items. Remove one or choose a shorter name.":"Drag to reorder; tap an item to configure it.":`Sensors, the date, and the analog clock appear from firmware ${r.value}; until that update, this screen shows the name and, if the time is in the bar, the clock.`),c=(z,B)=>{const Y=Rt(z);return Y.shown?l.value.has(B)?"Doesn't fit next to the name":Y.analog?"Dial":Y.text:"Hidden: not active right now"},f=z=>{const B=Rt(z);return B.analog||z.type!=="entity"?es(Zl[z.type])?.cp:B.icon},b=z=>d.topbarAdded?.key===He(z)&&Date.now()-d.topbarAdded.time<1200;function A(z){d.layout&&(d.layout.title=z,et())}function D(z){const B=[...n.value];B[t.index]={...B[t.index],...z},qn(B)}const I=k(()=>s.value?Rt(s.value).shown?l.value.has(t.index)?"Doesn't currently fit next to the name":"How it looks on the screen":"Hidden right now: not active":""),R=k(()=>yn().clock_24h!==!1),T=k(()=>({clock:Bo(R.value,new Date(d.now)),analog:"Small dial with the time",date:Uo(new Date(d.now))})),$=fe({index:-1,active:!1,moved:!1});let x=null,w=0,m=null,H=0;function C(z,B){z.button!==0||z.target.closest(".x")||(z.pointerType!=="touch"&&z.preventDefault(),$.value={index:B,active:!1,moved:!1},x={x:z.clientX,y:z.clientY},m=z.pointerId,clearTimeout(w),z.pointerType==="touch"&&(w=window.setTimeout(L,260)),document.addEventListener("pointermove",Ae),document.addEventListener("pointerup",J),document.addEventListener("pointercancel",J))}function L(){$.value.active=!0,document.addEventListener("touchmove",pe,{passive:!1})}function pe(z){$.value.active&&z.preventDefault()}function Ae(z){if(z.pointerId!==m||!x)return;if(!$.value.active){const oe=Math.hypot(z.clientX-x.x,z.clientY-x.y);if(z.pointerType==="touch"){oe>10&&(clearTimeout(w),x=null);return}if(oe<6)return;L()}const B=[...document.querySelectorAll(".items .item[data-index]")];let Y=$.value.index;if(B.forEach((oe,ie)=>{const ue=oe.getBoundingClientRect();ie<$.value.index&&z.clientY<ue.top+ue.height/2&&(Y=Math.min(Y,ie)),ie>$.value.index&&z.clientY>ue.top+ue.height/2&&(Y=Math.max(Y,ie))}),Y!==$.value.index&&d.layout){const oe=[...n.value];oe.splice(Y,0,...oe.splice($.value.index,1)),d.layout.header={items:oe};const ie=t.index===$.value.index;$.value.index=Y,$.value.moved=!0,ie&&Ct(Y)}}function J(z){z.pointerId===m&&(clearTimeout(w),document.removeEventListener("pointermove",Ae),document.removeEventListener("pointerup",J),document.removeEventListener("pointercancel",J),document.removeEventListener("touchmove",pe),$.value.active&&(H=Date.now()+400,$.value.moved&&et()),$.value={index:-1,active:!1,moved:!1},x=null,m=null)}function q(z){Date.now()<H||Ct(z)}function ae(z,B){if(z.key==="Enter"||z.key===" "){z.preventDefault(),Ct(B);return}const Y={ArrowUp:-1,ArrowDown:1}[z.key];Y&&so(B,B+Y)&&(t.index===B&&Ct(B+Y),z.preventDefault())}return(z,B)=>(h(),g(W,null,[i("div",Xp,[i("span",Qp,y(s.value?v(ke)(f(s.value)||"F0150"):v(ke)("F0150")),1),i("span",Zp,[i("b",null,y(s.value?s.value.type==="entity"?v(Zn)(s.value.entity):v(Tn)(s.value):"Top bar"),1),i("small",{class:re({mono:s.value?.type==="entity"})},y(s.value?s.value.type==="entity"?s.value.entity:"From the screen itself, also works without Home Assistant":`${n.value.length} of ${v(Bt)()} items`),3)]),i("button",{type:"button",class:"icon-btn","aria-label":"Close",onClick:B[0]||(B[0]=(...Y)=>v(je)&&v(je)(...Y))},"✕")]),i("div",eh,[i("div",th,[B[10]||(B[10]=i("label",{class:"f-label",for:"title"},"Left: name",-1)),i("input",{id:"title",value:v(d).layout?.title,maxlength:"60",placeholder:"For example: Living room",onInput:B[1]||(B[1]=Y=>A(Y.target.value))},null,40,nh)]),i("div",sh,[i("span",oh,[B[11]||(B[11]=Q("Right: time, sensors, or a clock ",-1)),i("span",ih," · "+y(n.value.length)+" / "+y(v(Bt)()),1)]),i("div",lh,[(h(!0),g(W,null,le(n.value,(Y,oe)=>(h(),g("div",{key:v(He)(Y)+oe,class:re(["item",{selected:oe===e.index,"is-hidden":!v(Rt)(Y).shown,"is-overflow":l.value.has(oe),"just-added":b(Y),"dragging-chip":$.value.active&&$.value.index===oe}]),role:"listitem",tabindex:"0","data-index":oe,"aria-label":`${v(Tn)(Y)}, slot ${oe+1}. Enter: configure, arrows: move`,onPointerdown:ie=>C(ie,oe),onClick:ie=>q(oe),onKeydown:ie=>ae(ie,oe)},[B[12]||(B[12]=i("span",{class:"grip","aria-hidden":"true"},"⋮⋮",-1)),i("span",{class:"av mdi",style:Ne(v(Rt)(Y).color?{color:v(Rt)(Y).color}:void 0)},y(f(Y)?v(ke)(f(Y)):""),5),i("span",rh,[i("b",null,y(v(Tn)(Y)),1),i("small",null,y(c(Y,oe)),1)]),i("button",{type:"button",class:"x","aria-label":`Remove ${v(Tn)(Y)} from the top bar`,onClick:Ft(ie=>v(ji)(oe),["stop"])},"✕",8,uh)],42,ah))),128)),i("button",{type:"button",class:"ghost-btn",id:"topbar-add",disabled:n.value.length>=v(Bt)(),title:n.value.length>=v(Bt)()?`Maximum ${v(Bt)()} items`:"Add the time, date, analog clock, or an entity",onClick:B[2]||(B[2]=(...Y)=>v(Ri)&&v(Ri)(...Y))},"+ Add time, date, or an entity",8,ch)]),i("small",{id:"topbar-hint",class:re({warn:l.value.size>0&&u.value})},y(a.value),3)]),s.value?(h(),g(W,{key:0},[i("div",dh,[i("small",null,y(I.value),1),_e(va,{items:[s.value],single:""},null,8,["items"])]),s.value.type==="entity"?(h(),g(W,{key:0},[i("div",fh,[B[13]||(B[13]=i("span",{class:"f-label"},"What to show",-1)),_e(nt,{choices:(v(d).inventory.header?.contents||[]).map(Y=>[Y.key,Y.label]),value:s.value.content,onPick:B[3]||(B[3]=Y=>D({content:Y}))},null,8,["choices","value"]),B[14]||(B[14]=i("small",null,"Last changed keeps counting on the screen itself: “Just now”, “5 min ago”, “Yesterday”.",-1))]),_e(ma,{selected:s.value.icon||"auto",automatic:v(d).topbarPreviews[v(He)(s.value)]?.auto_icon||v(on)(s.value.entity),"auto-label":"Automatic (like Home Assistant)","allow-none":"",onPick:B[4]||(B[4]=Y=>D({icon:Y}))},null,8,["selected","automatic"]),i("div",ph,[B[15]||(B[15]=i("span",{class:"f-label"},"Show",-1)),_e(nt,{choices:(v(d).inventory.header?.shows||[]).map(Y=>[Y.key,Y.label]),value:s.value.show,onPick:B[5]||(B[5]=Y=>D({show:Y}))},null,8,["choices","value"]),B[16]||(B[16]=i("small",null,"Only when active hides the item as long as it's off, closed, away, or 0. Handy for an open door, a running washing machine, or who's home.",-1))])],64)):s.value.type!=="date"?(h(),g("div",hh,[B[17]||(B[17]=i("span",{class:"f-label"},"Format",-1)),_e(nt,{choices:[["24","24 hour"],["12","12 hour"]],value:R.value?"24":"12",onPick:B[6]||(B[6]=Y=>v(An)("clock_24h",Y==="24",150))},null,8,["value"]),B[18]||(B[18]=i("small",null,"The screen's own clock setting: it applies at once to every clock on this screen, including the clock tiles.",-1))])):(h(),g("small",vh,y(T.value.date)+" today. The date follows the screen's own clock.",1))],64)):V("",!0)]),s.value?(h(),g("div",mh,[i("button",{type:"button",class:"btn danger",onClick:B[7]||(B[7]=Y=>v(ji)(e.index))},"Remove"),B[19]||(B[19]=i("span",{class:"spacer"},null,-1)),i("button",{type:"button",class:"btn quiet",disabled:e.index===0,onClick:B[8]||(B[8]=Y=>v(so)(e.index,e.index-1)&&v(Ct)(e.index-1))},"↑ Up",8,gh),i("button",{type:"button",class:"btn quiet",disabled:e.index>=n.value.length-1,onClick:B[9]||(B[9]=Y=>v(so)(e.index,e.index+1)&&v(Ct)(e.index+1))},"↓ Down",8,yh)])):V("",!0)],64))}}),wh={class:"dr-head"},_h={class:"tx"},kh={class:"dr-body"},$h={class:"f"},xh={class:"options"},Sh=["disabled","onClick"],Ch={class:"mdi"},Th={class:"tx"},Ah={key:0,class:"f"},Eh={class:"options"},Ph=["disabled","onClick"],Oh={class:"mdi"},Ih={class:"tx"},Mh={class:"f"},Dh={class:"options"},Lh=["disabled","onClick"],Fh={class:"mdi"},Hh={class:"tx"},Rh={key:0,class:"hint"},Nh={key:1,class:"hint"},jh={class:"dr-foot"},Bh=$e({__name:"TopbarAdd",setup(e){const t=fe(""),n=k(()=>new Set(Dt().map(He))),s=k(()=>yn().clock_24h!==!1),o=k(()=>({clock:Bo(s.value,new Date(d.now)),analog:"Small dial with the time",date:Uo(new Date(d.now))})),l=k(()=>d.inventory.header?.suggestions?.[d.selected||""]||[]),r=k(()=>{const a=t.value.trim().toLocaleLowerCase();return d.inventory.entities.filter(c=>`${c.name} ${c.id} ${c.area||""} ${c.device||""}`.toLocaleLowerCase().includes(a))}),u=a=>({type:"entity",entity:a,content:"state",icon:"auto",show:"always"});return(a,c)=>(h(),g(W,null,[i("div",wh,[c[4]||(c[4]=i("span",{class:"av",style:{background:"var(--seg)",color:"var(--ink-2)","font-size":"18px"}},"+",-1)),i("span",_h,[c[3]||(c[3]=i("b",null,"Add to the top bar",-1)),i("small",null,y(v(Dt)().length)+" of "+y(v(Bt)())+" slots used",1)]),i("button",{type:"button",class:"icon-btn","aria-label":"Close",onClick:c[0]||(c[0]=(...f)=>v(je)&&v(je)(...f))},"✕")]),i("div",kh,[i("div",$h,[c[5]||(c[5]=i("span",{class:"f-label"},"From the screen itself",-1)),i("div",xh,[(h(!0),g(W,null,le(v(d).inventory.header?.builtin||[],f=>(h(),g("button",{key:f.type,type:"button",class:"option",disabled:n.value.has(v(He)({type:f.type})),onClick:b=>v(oo)({type:f.type})},[i("span",Ch,y(v(ke)(v(es)(v(Zl)[f.type])?.cp||"F0150")),1),i("span",Th,[i("strong",null,y(f.label),1),i("small",null,y(n.value.has(v(He)({type:f.type}))?"Already added":o.value[f.type]),1)])],8,Sh))),128))])]),l.value.length?(h(),g("div",Ah,[c[6]||(c[6]=i("span",{class:"f-label"},"Suggestions from Home Assistant",-1)),i("div",Eh,[(h(!0),g(W,null,le(l.value,f=>(h(),g("button",{key:v(He)(f.item),type:"button",class:"option",disabled:n.value.has(v(He)(f.item)),onClick:b=>v(oo)(f.item)},[i("span",Oh,y(v(ke)(f.icon||v(on)(f.item.entity))),1),i("span",Ih,[i("strong",null,y(f.label),1),i("small",null,y(n.value.has(v(He)(f.item))?"Already added":[f.name,f.area].filter(Boolean).join(" · ")),1)])],8,Ph))),128))])])):V("",!0),i("div",Mh,[c[7]||(c[7]=i("label",{class:"f-label",for:"topbar-search"},"An entity",-1)),Te(i("input",{id:"topbar-search","onUpdate:modelValue":c[1]||(c[1]=f=>t.value=f),type:"search",placeholder:"Search by name, room, or entity, e.g. temperature or door","aria-label":"Search for an entity for the top bar"},null,512),[[Je,t.value]]),i("div",Dh,[(h(!0),g(W,null,le(r.value.slice(0,40),f=>(h(),g("button",{key:f.id,type:"button",class:"option",disabled:n.value.has(v(He)(u(f.id))),onClick:b=>v(oo)(u(f.id))},[i("span",Fh,y(v(ke)(v(on)(f.id))),1),i("span",Hh,[i("strong",null,y(f.name),1),i("small",null,y([f.area,f.id].filter(Boolean).join(" · ")),1)])],8,Lh))),128)),r.value.length?r.value.length>40?(h(),g("p",Nh,y(r.value.length)+" results. Keep typing to narrow it down.",1)):V("",!0):(h(),g("p",Rh,"No entities found."))])])]),i("div",jh,[c[8]||(c[8]=i("span",{class:"spacer"},null,-1)),i("button",{type:"button",class:"btn quiet",onClick:c[2]||(c[2]=(...f)=>v(je)&&v(je)(...f))},"Cancel")])],64))}}),Uh={class:"dr-head"},Vh={class:"tx"},Wh={class:"dr-body",id:"inspector-section"},Kh={id:"inspection-summary"},qh={key:0,class:"hint warn"},Yh={key:1,class:"hint"},zh={id:"inspection"},Gh=$e({__name:"InspectPanel",props:{entity:{}},setup(e){const t=e,n=fe(null),s=fe("Reading…"),o=fe("");async function l(){if(d.selected){n.value=null,o.value="",s.value="Fetching current HA status...";try{const u=await Mt(`screens/${encodeURIComponent(d.selected)}/inspect`),a=t.entity?u.tiles.filter(c=>c.entity===t.entity):u.tiles;n.value=a,s.value=JSON.stringify(t.entity?a[0]:u,null,2)}catch(u){o.value=u.message,s.value="",Se(u.message)}}}const r=u=>{const a=d.layout?.tiles.find(c=>c.entity===u)?.options||{};return`Small slider: ${a.inline==="slider"?"yes":"no"} · Display: ${aa[a.display||"standard"]||a.display} · Width: ${a.size==="wide"?"double":"normal"} · Control: ${oc({entity:u,options:a},d.inventory)} · Background: ${d.inventory.backgrounds?.[a.background||"auto"]?.label||"Default"}`};return bn(l),In(()=>t.entity,l),(u,a)=>(h(),g(W,null,[i("div",Uh,[a[2]||(a[2]=i("span",{class:"av",style:{background:"var(--seg)",color:"var(--ink-2)","font-size":"16px"}},"⌕",-1)),i("span",Vh,[a[1]||(a[1]=i("b",null,"Current data",-1)),i("small",{class:re({mono:e.entity})},y(e.entity||"Connection, status, and supported properties"),3)]),i("button",{type:"button",class:"icon-btn","aria-label":"Close",onClick:a[0]||(a[0]=(...c)=>v(je)&&v(je)(...c))},"✕")]),i("div",Wh,[i("div",Kh,[o.value?(h(),g("p",qh,y(o.value),1)):n.value?V("",!0):(h(),g("p",Yh,"Fetching current HA status...")),(h(!0),g(W,null,le(n.value||[],c=>(h(),g("article",{key:c.entity,class:"inspection-tile"},[i("strong",null,y(c.entity),1),i("span",null,"Status: "+y(c.word||c.state),1),i("small",null,y(r(c.entity)),1)]))),128))]),i("pre",zh,y(s.value),1)]),i("div",{class:"dr-foot"},[i("button",{type:"button",class:"btn quiet",onClick:l},"Read again"),a[3]||(a[3]=i("span",{class:"spacer"},null,-1))])],64))}}),Jh=["aria-hidden"],Xh=$e({__name:"Drawer",setup(e){const t=k(()=>!!(d.inspector&&(d.inspector.kind!=="tile"||Zs.value)));return(n,s)=>(h(),g("aside",{class:re(["drawer",{open:t.value}]),id:"tile-sheet","aria-hidden":t.value?"false":"true",onClick:s[0]||(s[0]=Ft(()=>{},["stop"]))},[v(d).inspector?(h(),g(W,{key:0},[v(d).inspector.kind==="tile"&&v(Zs)?(h(),Ve(Jp,{key:0,tile:v(Zs)},null,8,["tile"])):v(d).inspector.kind==="bar"?(h(),Ve(bh,{key:1,index:v(d).inspector.index},null,8,["index"])):v(d).inspector.kind==="bar-add"?(h(),Ve(Bh,{key:2})):v(d).inspector.kind==="inspect"?(h(),Ve(Gh,{key:3,entity:v(d).inspector.entity},null,8,["entity"])):V("",!0)],64)):V("",!0)],10,Jh))}}),Qh={class:"main-head"},Zh={class:"eyebrow",id:"screen-name"},ev=["title"],tv={class:"head-right"},nv={class:"seg",role:"tablist"},sv=["aria-pressed"],ov=["aria-pressed"],iv={key:1,id:"dirty",class:"chip dirty"},lv=["disabled"],av={key:0,class:"spin small"},rv=["aria-expanded"],uv={key:3,class:"menu",role:"menu"},cv=["disabled","title"],dv={class:"body",id:"body"},fv=$e({__name:"ScreenView",setup(e){const t=k(()=>qt.value),n=k(()=>t.value.online?`${t.value.delivery} · ${t.value.status}`:"Offline · changes are saved"),s=k(()=>t.value.update?.available&&t.value.online&&t.value.update?.profile);function o(){d.menuOpen=!1,d.overrideProfile=t.value.update?.profile||null,d.overrideFriendly=t.value.name,De("#override")}function l(){d.menuOpen=!1,d.selectedTile=null,d.inspector={kind:"inspect"}}function r(a){a.key==="Escape"&&(d.menuOpen?d.menuOpen=!1:d.inspector&&!a.target?.closest?.(".picker")&&je())}function u(a){d.menuOpen&&!a.target.closest(".head-right .menu, #more")&&(d.menuOpen=!1)}return bn(()=>{document.addEventListener("keydown",r),document.addEventListener("click",u)}),Xn(()=>{document.removeEventListener("keydown",r),document.removeEventListener("click",u)}),(a,c)=>(h(),g(W,null,[i("header",Qh,[i("div",null,[i("span",Zh,y(t.value.name),1),i("h1",null,y(v(d).layout?.title||"Home"),1)]),i("span",{id:"delivery",class:re(["chip",{off:!t.value.online}]),title:n.value},[c[6]||(c[6]=i("span",{class:"dot"},null,-1)),Q(y(n.value),1)],10,ev),i("div",tv,[i("div",nv,[i("button",{type:"button",id:"tab-layout",role:"tab","aria-pressed":v(d).tab==="layout"?"true":"false",onClick:c[0]||(c[0]=f=>v(d).tab="layout")},"Layout",8,sv),i("button",{type:"button",id:"tab-settings",role:"tab","aria-pressed":v(d).tab==="settings"?"true":"false",onClick:c[1]||(c[1]=f=>{v(d).tab="settings",v(je)()})},"Screen settings",8,ov)]),v(d).dirty?(h(),g("span",iv,"Unsaved changes")):(h(),g("span",{key:0,id:"dirty",class:re(["chip",{sent:v(d).saved}])},y(v(d).saved?"Saved · sent to screen":"All saved"),3)),v(d).dirty?(h(),g("button",{key:2,id:"save",type:"button",class:"btn primary",disabled:v(d).busy,onClick:c[2]||(c[2]=f=>v(gc)())},[v(d).busy?(h(),g("span",av)):V("",!0),Q(y(v(d).busy?"Saving…":"Save & send"),1)],8,lv)):V("",!0),i("button",{id:"more",type:"button",class:"icon-btn","aria-label":"More","aria-haspopup":"menu","aria-expanded":v(d).menuOpen?"true":"false",onClick:c[3]||(c[3]=Ft(f=>v(d).menuOpen=!v(d).menuOpen,["stop"]))},"···",8,rv),v(d).menuOpen?(h(),g("div",uv,[i("button",{type:"button",role:"menuitem",id:"inspect",onClick:l},[...c[7]||(c[7]=[Q("Read current data ",-1),i("small",null,"from Home Assistant",-1)])]),i("button",{type:"button",role:"menuitem",id:"open-override",disabled:!t.value.update?.profile,title:t.value.update?.profile?"":"No ESPHome profile found for this screen",onClick:o},[...c[8]||(c[8]=[Q("Override YAML ",-1),i("small",null,"advanced",-1)])],8,cv),i("button",{type:"button",role:"menuitem",onClick:c[4]||(c[4]=f=>{v(d).menuOpen=!1,v(De)("#firmware")})},"Firmware & USB"),s.value?(h(),g("button",{key:0,type:"button",role:"menuitem",onClick:c[5]||(c[5]=f=>{v(d).menuOpen=!1,a.$emit("update")})},[c[9]||(c[9]=Q("Update firmware ",-1)),i("small",null,y(t.value.update?.target),1)])):V("",!0)])):V("",!0)])]),i("div",dv,[v(d).tab==="layout"?(h(),Ve(Cf,{key:0})):(h(),Ve(Uf,{key:1})),_e(Xh)])],64))}}),pv={key:0,id:"choose",class:"empty"},hv={key:1,id:"empty",class:"empty"},vv=$e({__name:"EmptyState",setup(e){return(t,n)=>v(d).inventory.screens.length?(h(),g("section",pv,[...n[1]||(n[1]=[i("span",{class:"empty-icon"},"▦",-1),i("h2",null,"Choose a screen",-1),i("p",null,"Pick one of your screens on the left to change its tiles, top bar and settings.",-1)])])):(h(),g("section",hv,[n[2]||(n[2]=i("span",{class:"empty-icon"},"▦",-1)),n[3]||(n[3]=i("h2",null,"Start with a screen",-1)),n[4]||(n[4]=i("p",null,"Connect a CYD or Guition via USB to your Home Assistant machine. Profile, firmware, and the first flash happen in one go.",-1)),i("button",{id:"start",type:"button",class:"btn primary",onClick:n[0]||(n[0]=s=>v(De)("#new-screen"))},"Install new screen")]))}}),mv={class:"panel",id:"settings-view"},gv={class:"panel-head"},yv={class:"card-grid"},bv={class:"card"},wv={class:"tools"},_v={key:0,class:"card updates",id:"updates"},kv={id:"updates-hint"},$v={class:"check"},xv=["checked"],Sv={class:"card"},Cv={class:"tools"},Tv={class:"card",id:"claude"},Av={class:"actions"},Ev=["disabled"],Pv={id:"claude-path"},Ov=$e({__name:"AppSettingsView",setup(e){const t=k(()=>d.inventory.updates),n=k(()=>d.inventory.screens.filter(u=>u.update?.available).length),s=k(()=>t.value?t.value.busy?`Updating to firmware ${t.value.target}…`:d.inventory.screens.length?n.value?`Firmware ${t.value.target} is available for ${n.value} screen${n.value===1?"":"s"}.`:`All screens have firmware ${t.value.target}.`:`No screen paired yet. New screens get firmware ${t.value.target}.`:""),o=k(()=>d.inventory.claude_skill),l=fe(!1);async function r(){l.value=!0;try{await Sc()}finally{l.value=!1}}return(u,a)=>(h(),g("div",mv,[i("div",gv,[a[6]||(a[6]=i("div",{class:"tx"},[i("span",{class:"eyebrow"},"Settings"),i("h1",{id:"settings-title"},"Everything around your screens.")],-1)),i("button",{type:"button",class:"btn quiet",id:"close-settings",onClick:a[0]||(a[0]=c=>v(De)(""))},"← My screens")]),i("div",yv,[i("section",bv,[a[9]||(a[9]=i("h2",null,"Screens",-1)),a[10]||(a[10]=i("p",null,"Add a screen, or build and reinstall the firmware of one you already have.",-1)),i("div",wv,[i("button",{type:"button",class:"tool",onClick:a[1]||(a[1]=c=>v(De)("#new-screen"))},[...a[7]||(a[7]=[i("span",{class:"tool-icon"},"+",-1),i("span",{class:"tx"},[i("b",null,"New screen"),i("small",null,"Connect and install")],-1)])]),i("button",{type:"button",class:"tool",onClick:a[2]||(a[2]=c=>v(De)("#firmware"))},[...a[8]||(a[8]=[i("span",{class:"tool-icon"},"⇪",-1),i("span",{class:"tx"},[i("b",null,"Firmware & USB"),i("small",null,"Build and install via USB or Wi-Fi")],-1)])])])]),t.value?(h(),g("section",_v,[a[12]||(a[12]=i("h2",null,"Firmware updates",-1)),i("p",kv,y(s.value),1),t.value.pending&&!t.value.busy&&t.value.pending>=2?(h(),g("button",{key:0,id:"update-all",type:"button",class:"btn primary",onClick:a[3]||(a[3]=(...c)=>v(Vi)&&v(Vi)(...c))},"Update all "+y(t.value.pending)+" screens",1)):V("",!0),i("label",$v,[i("input",{type:"checkbox",id:"auto-update",checked:!!t.value.auto,onChange:a[4]||(a[4]=c=>v(xc)(c.target.checked))},null,40,xv),a[11]||(a[11]=i("span",null,[Q("Update automatically every night"),i("small",null,"Between 03:00 and 06:00, one screen at a time. Stops on an error and reports it in Home Assistant.")],-1))])])):V("",!0),i("section",Sv,[a[14]||(a[14]=i("h2",null,"Alerts",-1)),a[15]||(a[15]=i("p",null,"A card over the whole screen from an automation, on one screen or on all of them. The cheatsheet has the action names, fields, icons, and colors.",-1)),i("div",Cv,[i("button",{type:"button",class:"tool",onClick:a[5]||(a[5]=c=>v(De)("#alerts"))},[...a[13]||(a[13]=[i("span",{class:"tool-icon"},"!",-1),i("span",{class:"tx"},[i("b",null,"Alerts"),i("small",null,"Full-screen notifications, from an automation")],-1)])])])]),i("section",Tv,[a[18]||(a[18]=i("h2",null,"Claude",-1)),a[19]||(a[19]=i("p",null,'Teach Claude about ESP Screens, then ask: "Show an alert on all my screens when the mailbox is full." Claude knows the alert events, every field, color, and icon.',-1)),i("div",Av,[i("button",{type:"button",id:"claude-install",class:re(["btn",o.value?.installed&&o.value.current?"quiet":"primary"]),disabled:!o.value||l.value,onClick:r},y(!o.value||!o.value.installed?"Install for Claude Code":o.value.current?"Install again":"Update the skill"),11,Ev),i("span",{id:"claude-status",class:re(["chip",o.value&&o.value.installed?o.value.current?"good":"update":""]),role:"status"},y(o.value?o.value.installed?o.value.current?"● Installed":"Installed · a newer version is ready":"Not installed":"Loading…"),3)]),i("small",null,[a[16]||(a[16]=Q("For Claude Code in Home Assistant. Writes one file to ",-1)),i("code",Pv,y(o.value?.path||"/homeassistant/.claude/skills/esp-screens"),1),a[17]||(a[17]=Q("; installing again replaces it.",-1))]),a[20]||(a[20]=i("div",{class:"actions"},[i("a",{class:"btn quiet",id:"claude-download",href:"api/claude-skill.zip",download:"esp-screens.zip"},"Download for claude.ai"),i("small",null,"Upload the zip in Claude under Customize → Skills.")],-1))])])]))}}),Iv={class:"panel",id:"installer"},Mv={class:"panel-head"},Dv={class:"tx"},Lv={id:"install-title"},Fv={key:0},Hv={class:"boards"},Rv={class:"board"},Nv={class:"board"},jv={class:"field"},Bv={class:"node-line"},Uv={id:"node-preview"},Vv={key:0,class:"field",id:"node-label"},Wv={key:1,id:"wifi-fields",class:"wifi"},Kv={class:"hint",id:"wifi-status"},qv={key:0,class:"field",id:"wifi-ssid-label"},Yv={key:1,class:"field",id:"wifi-password-label"},zv={class:"field"},Gv={key:0,value:"usb"},Jv=["value"],Xv={id:"target-hint"},Qv={key:2,class:"hint",id:"install-note"},Zv={class:"actions"},em=["disabled"],tm={id:"install-status",class:"status-line error",role:"status"},nm={key:1,id:"install-progress",class:"card"},sm={class:"progress-head"},om={key:0,class:"spin",id:"progress-spin"},im={id:"progress-title"},lm={id:"progress-detail"},am={key:0,id:"install-download",class:"card",style:{background:"var(--surface-2)"}},rm=["href","download"],um={class:"steps",id:"download-steps"},cm={key:1,id:"install-result",class:"field"},dm={class:"key-box"},fm={class:"steps",id:"install-steps"},pm=["open"],hm={id:"install-log",class:"log"},vm={class:"actions"},mm="https://web.esphome.io/?dashboard_install",gm="Download · flash from your own computer",ym=$e({__name:"InstallerView",setup(e){const t=hn({board:"cyd",friendly_name:"",name:"",wifi_ssid:"",wifi_password:"",target:""}),n=hn({view:"setup",file:null,friendly:"",board:"cyd",target:"",apiKey:null,nodeEdited:!1,jobState:null,picked:!1,action:null}),s=fe(!1),o=fe(null),l=fe(null),r=fe([]),u=fe(""),a=fe(""),c=fe(!1),f=fe(!1),b=fe(null);let A=0;function D(ce){return ce.toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^[^a-z]+/,"").slice(0,30).replace(/-+$/,"")||"screen"}function I(ce){const M=ce.replace(/^\/dev\/serial\/by-id\/usb-/,"").replace(/-if\d+(-port\d+)?$/,"").replace(/_/g," ");return`USB · ${M===ce?ce.replace(/^\/dev\//,""):M}`}In(()=>t.friendly_name,()=>{n.nodeEdited||(t.name=D(t.friendly_name))});const R=k(()=>t.name||"…"),T=k(()=>o.value?.ports||[]),$=k(()=>o.value?.wifi),x=k(()=>$.value?.state==="new"||$.value?.state==="missing"),w=k(()=>$.value?.missing||[]),m=k(()=>$.value?.state==="new"?"Fill in once: ESP Screens saves this in ESPHome secrets.yaml, later screens use it automatically.":"Your ESPHome secrets.yaml is still missing Wi-Fi details. ESP Screens only fills in the missing lines."),H=k(()=>$.value?.state==="ready"?"Wi-Fi comes from your ESPHome secrets.yaml.":$.value?.state==="invalid"?"secrets.yaml in the ESPHome folder isn't valid YAML. Fix the file first; it won't be overwritten.":""),C=k(()=>t.target==="usb"?"Connect the screen with a USB data cable to the Home Assistant machine; the list refreshes on its own. Or choose Download to use your own computer.":t.target==="download"?"Download the firmware and put it on the screen from your own computer, in Chrome or Edge. After that, updates go over Wi-Fi.":t.target?T.value.length>1?"More than one board connected: choose this screen's port.":"Once over USB; after that, everything is wireless.":"The profile goes into the ESPHome folder. You can install later via Firmware & USB, or from ESPHome Device Builder."),L=k(()=>t.target==="download"?"Build & download":t.target?"Install":"Save profile"),pe=k(()=>o.value?.job?.state==="running"&&!(n.file&&o.value.job.file===n.file)),Ae=k(()=>c.value||$.value?.state==="invalid"||t.target==="usb"||!!t.target&&(pe.value||!o.value?.available));function J(){const ce=t.target;(ce==="download"||ce===""?n.picked:T.value.includes(ce))||(t.target=T.value[0]||"usb")}async function q(){let ce;try{ce=await Mt("firmware")}catch(Ge){u.value=Ge.message;return}o.value=ce;const M=ce.job,se=M&&n.file&&M.file===n.file;if(se&&(n.jobState=M.state),n.view==="setup"){if(se&&M.state==="running"){ae(M,ce.logs||[]);return}J(),u.value=pe.value?`A build or installation is already running (${M.file}). Wait for it to finish.`:!ce.available&&t.target?"The ESPHome CLI is missing from this installation; only saving the profile is possible.":H.value}else n.view==="progress"&&se&&(l.value=M,r.value=ce.logs||[],M.state!=="running"&&M.state!=="success"&&(f.value=!0))}function ae(ce,M){n.view="progress",n.jobState=ce.state,n.action=ce.action,l.value=ce,r.value=M}const z=k(()=>l.value?.state==="running"),B=k(()=>n.view==="done"||l.value?.state==="success"),Y=k(()=>n.action==="download"),oe=k(()=>n.view==="done"?"Profile saved.":z.value?"One moment…":B.value?Y.value?"Ready to download.":"Done.":"That didn't work."),ie=k(()=>n.view==="done"?`${n.file} is in the ESPHome folder`:z.value?l.value?.stage==="upload"?`Writing firmware to ${n.friendly}…`:"Building firmware…":B.value?Y.value?`Firmware for ${n.friendly} is ready`:`Firmware is on ${n.friendly}`:Y.value?"Build failed":"Install failed"),ue=k(()=>n.view==="done"?"Install it later from Firmware & USB: choose this profile, then the USB port of the Home Assistant machine, or Download to put the firmware on the screen from your own computer. Save the API key for pairing:":z.value?l.value?.stage==="upload"?"Don't disconnect the USB cable yet.":`A first build takes a few minutes on a Raspberry Pi. You can leave this page: the ${Y.value?"build":"installation"} keeps running and you'll find it again under New screen.`:B.value?Y.value?"Put it on the screen from your own computer, then pair the screen with Home Assistant.":`The screen boots up and connects to your Wi-Fi.${n.board==="cyd"?" The CYD first asks for a touch calibration: tap the crosshairs.":""} Pair it with Home Assistant now:`:r.value.filter(ce=>/error/i.test(ce)).pop()||r.value.filter(ce=>/failed/i.test(ce)).pop()||"See the log below."),ze=k(()=>({href:`api/firmware/profiles/${encodeURIComponent(n.file||"")}/download`,name:(n.file||"").replace(/\.yaml$/,"")+".factory.bin"})),an=k(()=>[["Go to Home Assistant → Settings → Devices & services.",` This happens outside ESP Screens. Home Assistant discovers ${n.friendly} as an ESPHome device; click Add. Not discovered? Add ESPHome manually with the screen's IP address. `],["Paste the API key"," above when Home Assistant asks for an encryption key."],["Allow HA actions:"," ESPHome integration → Configure → “Allow the device to perform Home Assistant actions”. Without this, the screen sees everything but controls nothing."],["Choose your tiles."," Back in ESP Screens, the screen appears in the list on the left within about thirty seconds; until then it's shown there as “not yet in Home Assistant”."]]);async function _t(ce){const M=ce.target;if(n.nodeEdited||(t.name=D(t.friendly_name)),!!M.reportValidity()){c.value=!0,a.value="";try{const se={board:t.board,friendly_name:t.friendly_name,name:t.name,target:t.target};x.value&&(w.value.includes("wifi_ssid")&&(se.wifi_ssid=t.wifi_ssid),w.value.includes("wifi_password")&&(se.wifi_password=t.wifi_password));const Ge=await it("firmware/profiles","POST",se);Object.assign(n,{file:Ge.file,apiKey:Ge.api_key,friendly:t.friendly_name.trim(),board:t.board,target:t.target}),t.wifi_password="",Ge.job?ae(Ge.job,[]):n.view="done"}catch(se){a.value=se.message}finally{c.value=!1}}}async function We(){try{if(!Y.value){const{ports:M}=await Mt("firmware");!M.includes(n.target)&&M.length===1&&(n.target=M[0])}const ce=await it("firmware/jobs","POST",Y.value?{file:n.file,action:"download"}:{file:n.file,action:"install",target:n.target});ae(ce,[])}catch(ce){Se(ce.message)}}function ts(){Object.assign(n,{view:"setup",file:null,apiKey:null,nodeEdited:!1,jobState:null,target:"",picked:!1,action:null}),Object.assign(t,{board:"cyd",friendly_name:"",name:"",wifi_ssid:"",wifi_password:"",target:""}),s.value=!1,l.value=null,r.value=[],a.value="",u.value="",f.value=!1,q()}function ns(){n.view==="progress"&&n.jobState!=="running"&&(n.view="done"),De("")}return bn(()=>{q(),A=window.setInterval(q,3e3)}),Xn(()=>clearInterval(A)),(ce,M)=>(h(),g("div",Iv,[i("div",Mv,[i("div",Dv,[M[13]||(M[13]=i("span",{class:"eyebrow"},"New screen",-1)),i("h1",Lv,y(n.view==="setup"?"Connect and install.":oe.value),1),n.view==="setup"?(h(),g("p",Fv,"ESP Screens creates the screen's own profile with unique keys and builds the firmware. Connect the screen with a USB data cable to the machine running Home Assistant, or download the firmware and put it on the screen from your own computer.")):V("",!0)]),i("button",{type:"button",class:"btn quiet",id:"close-install","aria-label":"Close",onClick:ns},"← Back")]),n.view==="setup"?(h(),g("form",{key:0,id:"install-form",class:"card",onSubmit:Ft(_t,["prevent"])},[i("fieldset",null,[M[16]||(M[16]=i("legend",null,"Which screen do you have?",-1)),i("div",Hv,[i("label",Rv,[Te(i("input",{type:"radio",name:"board",value:"cyd","onUpdate:modelValue":M[0]||(M[0]=se=>t.board=se)},null,512),[[Oi,t.board]]),M[14]||(M[14]=i("span",null,[i("b",null,"CYD · 2.8 inch"),i("small",null,"ESP32-2432S028 · 320 × 240")],-1))]),i("label",Nv,[Te(i("input",{type:"radio",name:"board",value:"guition","onUpdate:modelValue":M[1]||(M[1]=se=>t.board=se)},null,512),[[Oi,t.board]]),M[15]||(M[15]=i("span",null,[i("b",null,"Guition · 4 inch"),i("small",null,"ESP32-S3-4848S040 · 480 × 480 · GT911")],-1))])])]),i("div",jv,[M[18]||(M[18]=i("label",{class:"f-label",for:"friendly_name"},"Name",-1)),Te(i("input",{id:"friendly_name",name:"friendly_name","onUpdate:modelValue":M[2]||(M[2]=se=>t.friendly_name=se),required:"",maxlength:"60",placeholder:"Living room screen",autocomplete:"off"},null,512),[[Je,t.friendly_name]]),i("small",Bv,[M[17]||(M[17]=Q("Device name ",-1)),i("code",Uv,y(R.value),1),i("button",{type:"button",class:"btn link mini",id:"edit-node",onClick:M[3]||(M[3]=se=>{n.nodeEdited=!0,s.value=!0})},"customize")]),M[19]||(M[19]=i("small",null,"Every screen gets its own profile with its own keys. Four screens? Go through this four times with a different name.",-1))]),s.value?(h(),g("div",Vv,[M[20]||(M[20]=i("label",{class:"f-label",for:"node-name"},"Device name",-1)),Te(i("input",{id:"node-name",name:"name","onUpdate:modelValue":M[4]||(M[4]=se=>t.name=se),pattern:"[a-z][a-z0-9\\-]{0,29}",maxlength:"30",autocomplete:"off",onInput:M[5]||(M[5]=se=>n.nodeEdited=!0)},null,544),[[Je,t.name]]),M[21]||(M[21]=i("small",null,"Lowercase letters, digits, and dashes. A different name for each screen.",-1))])):V("",!0),x.value?(h(),g("fieldset",Wv,[M[24]||(M[24]=i("legend",null,"Wi-Fi",-1)),i("p",Kv,y(m.value),1),w.value.includes("wifi_ssid")?(h(),g("div",qv,[M[22]||(M[22]=i("label",{class:"f-label",for:"wifi_ssid"},"Wi-Fi name (2.4 GHz)",-1)),Te(i("input",{id:"wifi_ssid",name:"wifi_ssid","onUpdate:modelValue":M[6]||(M[6]=se=>t.wifi_ssid=se),autocomplete:"off"},null,512),[[Je,t.wifi_ssid]])])):V("",!0),w.value.includes("wifi_password")?(h(),g("div",Yv,[M[23]||(M[23]=i("label",{class:"f-label",for:"wifi_password"},"Wi-Fi password",-1)),Te(i("input",{id:"wifi_password",name:"wifi_password",type:"password","onUpdate:modelValue":M[7]||(M[7]=se=>t.wifi_password=se),autocomplete:"new-password"},null,512),[[Je,t.wifi_password]])])):V("",!0)])):V("",!0),i("div",zv,[M[26]||(M[26]=i("label",{class:"f-label",for:"install-target"},"Install via",-1)),Te(i("select",{id:"install-target",name:"target","onUpdate:modelValue":M[8]||(M[8]=se=>t.target=se),onChange:M[9]||(M[9]=se=>{n.picked=!0,q()})},[T.value.length?V("",!0):(h(),g("option",Gv,"USB · no board found on the Home Assistant machine yet")),(h(!0),g(W,null,le(T.value,se=>(h(),g("option",{key:se,value:se},y(I(se)),9,Jv))),128)),i("option",{value:"download"},y(gm)),M[25]||(M[25]=i("option",{value:""},"Later · save profile only",-1))],544),[[_s,t.target]]),i("small",Xv,y(C.value),1)]),u.value?(h(),g("p",Qv,y(u.value),1)):V("",!0),i("div",Zv,[i("button",{type:"submit",class:"btn primary",id:"install-go",disabled:Ae.value},y(L.value),9,em),i("span",tm,y(a.value),1)])],32)):(h(),g("div",nm,[i("div",sm,[z.value?(h(),g("span",om)):(h(),g("span",{key:1,class:re(["outcome",B.value?"ok":"bad"]),id:"progress-mark"},y(B.value?"✓":"✕"),3)),i("strong",im,y(ie.value),1)]),i("p",lm,y(ue.value),1),B.value&&Y.value&&n.view!=="done"?(h(),g("div",am,[i("a",{class:"btn primary",id:"download-firmware",href:ze.value.href,download:ze.value.name},"Download "+y(ze.value.name),9,rm),i("ol",um,[M[30]||(M[30]=i("li",null,[i("b",null,"Plug the screen into your computer"),Q(" with a USB data cable.")],-1)),i("li",null,[i("b",null,[M[27]||(M[27]=Q("Open ",-1)),i("a",{href:mm,target:"_blank",rel:"noopener"},"ESPHome Web")]),M[28]||(M[28]=Q(" in Chrome or Edge, click Connect and choose the screen's USB port.",-1))]),i("li",null,[M[29]||(M[29]=i("b",null,"Click Install",-1)),Q(" and select "+y(ze.value.name)+". The screen restarts and joins your Wi-Fi."+y(n.board==="cyd"?" The CYD first asks for a touch calibration: tap the crosshairs.":""),1)])]),M[31]||(M[31]=i("small",null,"The file holds your Wi-Fi password and the screen's keys: keep it to yourself.",-1))])):V("",!0),B.value?(h(),g("div",cm,[i("div",dm,[M[32]||(M[32]=i("span",null,"API key",-1)),i("code",{id:"api-key",ref_key:"keyBox",ref:b},y(n.apiKey||""),513),i("button",{type:"button",class:"btn quiet mini",id:"copy-key",onClick:M[10]||(M[10]=se=>v(dt)(n.apiKey||"",b.value))},"Copy")]),i("ol",fm,[(h(!0),g(W,null,le(an.value,([se,Ge],wn)=>(h(),g("li",{key:wn},[i("b",null,y(se),1),Q(y(Ge),1),wn===0?(h(),g("button",{key:0,type:"button",class:"btn quiet mini",onClick:M[11]||(M[11]=(...Gt)=>v($s)&&v($s)(...Gt))},"Open Devices & services")):V("",!0)]))),128))])])):V("",!0),n.view!=="done"?(h(),g("details",{key:2,id:"install-log-wrap",class:"log-wrap",open:f.value,onToggle:M[12]||(M[12]=se=>f.value=se.target.open)},[M[33]||(M[33]=i("summary",null,"ESPHome log",-1)),i("pre",hm,y(r.value.join(`
|
||
`)),1)],40,pm)):V("",!0),i("div",vm,[!z.value&&!B.value?(h(),g("button",{key:0,type:"button",class:"btn primary",id:"install-retry",onClick:We},"Retry")):V("",!0),i("button",{type:"button",class:"btn quiet",id:"install-close",onClick:ts},y(B.value?"Install another screen":"Start over"),1),i("button",{type:"button",class:re(["btn",B.value?"primary":"quiet"]),onClick:ns},y(B.value?"Done":"Close"),3)])]))]))}}),bm={class:"panel",id:"firmware-dialog"},wm={class:"panel-head"},_m={class:"card"},km={class:"card-grid"},$m={class:"field"},xm=["value"],Sm={class:"field"},Cm={key:0,value:"usb"},Tm=["value"],Am={key:0,class:"field",id:"firmware-host-label"},Em=["placeholder"],Pm={class:"actions"},Om=["disabled"],Im=["disabled"],Mm=["disabled"],Dm={key:0,class:"spin"},Lm={id:"firmware-status",class:"status-line",role:"status"},Fm={key:0,id:"firmware-download",class:"card",style:{background:"var(--surface-2)"}},Hm=["href","download"],Rm={id:"firmware-log",class:"log"},Nm="https://web.esphome.io/?dashboard_install",jm="Download · flash from your own computer",Bm=$e({__name:"FirmwareView",setup(e){const t=fe(null),n=fe(""),s=fe("ota"),o=fe("");let l=0;async function r(R=!1){try{const T=await Mt("firmware");t.value=T,(R||!n.value)&&(n.value=T.profiles[0]?.file||"");const $=T.ports||[];s.value.startsWith("/")&&!$.includes(s.value)&&(s.value=$[0]||"usb"),s.value==="usb"&&$.length&&(s.value=$[0])}catch(T){Se(T.message)}}const u=k(()=>t.value?.job?.state==="running"),a=k(()=>!t.value||u.value||!t.value.available||!t.value.profiles?.length),c=k(()=>a.value||s.value==="usb"),f=k(()=>t.value?.ports||[]),b=k(()=>t.value?t.value.available?t.value.job?`${t.value.job.file} · ${t.value.job.action} · ${t.value.job.state}`:"Choose the intended profile, then a USB port, an IP address, or Download.":"The ESPHome CLI is missing. Update the app to 0.2.0.":"Loading…"),A=k(()=>s.value==="download"&&!!n.value&&!!t.value?.downloads?.includes(n.value)),D=k(()=>({href:`api/firmware/profiles/${encodeURIComponent(n.value)}/download`,name:n.value.replace(/\.yaml$/,"")+".factory.bin"}));async function I(R){try{await it("firmware/jobs","POST",{file:n.value,action:R==="validate"?"validate":R==="build"?"build":s.value==="download"?"download":"install",target:s.value==="ota"?o.value.trim():s.value==="download"?"":s.value}),await r()}catch(T){Se(T.message)}}return bn(()=>{r(!0),l=window.setInterval(()=>r(),3e3)}),Xn(()=>clearInterval(l)),(R,T)=>(h(),g("div",bm,[i("div",wm,[T[7]||(T[7]=fs('<div class="tx"><span class="eyebrow">Firmware & USB</span><h1>Build and install screen firmware</h1><p>The built-in ESPHome CLI uses your own profile (YAML with keys) and secrets. Choose the screen's profile, then a USB port (screen connected to the Home Assistant machine), <b>Wi-Fi / OTA</b> with the hostname, or <b>Download</b> to put the firmware on the screen from your own computer. <b>Check</b> only validates, <b>Build only</b> compiles, <b>Build & install</b> puts the firmware on the screen. Your tiles stay as they are in ESP Screens. The first build takes a few minutes.</p></div>',1)),i("button",{type:"button",class:"btn quiet",id:"close-firmware",onClick:T[0]||(T[0]=$=>v(De)(""))},"← Back")]),i("div",_m,[i("div",km,[i("div",$m,[T[8]||(T[8]=i("label",{class:"f-label",for:"firmware-file"},"ESPHome profile",-1)),Te(i("select",{id:"firmware-file","onUpdate:modelValue":T[1]||(T[1]=$=>n.value=$)},[(h(!0),g(W,null,le(t.value?.profiles||[],$=>(h(),g("option",{key:$.file,value:$.file},y($.file),9,xm))),128))],512),[[_s,n.value]])]),i("div",Sm,[T[10]||(T[10]=i("label",{class:"f-label",for:"firmware-port"},"Install to",-1)),Te(i("select",{id:"firmware-port","onUpdate:modelValue":T[2]||(T[2]=$=>s.value=$)},[T[9]||(T[9]=i("option",{value:"ota"},"Wi-Fi / OTA",-1)),f.value.length?V("",!0):(h(),g("option",Cm,"USB · no board found on the Home Assistant machine yet")),(h(!0),g(W,null,le(f.value,$=>(h(),g("option",{key:$,value:$},y($),9,Tm))),128)),i("option",{value:"download"},y(jm))],512),[[_s,s.value]])]),s.value==="ota"?(h(),g("div",Am,[T[11]||(T[11]=i("label",{class:"f-label",for:"firmware-host"},"IP address or hostname",-1)),Te(i("input",{id:"firmware-host","onUpdate:modelValue":T[3]||(T[3]=$=>o.value=$),placeholder:n.value?n.value.replace(/\.yaml$/,".local"):"screen-livingroom.local"},null,8,Em),[[Je,o.value]])])):V("",!0)]),i("div",Pm,[i("button",{type:"button",class:"btn quiet",id:"firmware-validate",disabled:a.value,onClick:T[4]||(T[4]=$=>I("validate"))},"Check",8,Om),i("button",{type:"button",class:"btn quiet",id:"firmware-build",disabled:a.value,onClick:T[5]||(T[5]=$=>I("build"))},"Build only",8,Im),i("button",{type:"button",class:"btn primary",id:"firmware-install",disabled:c.value,onClick:T[6]||(T[6]=$=>I("install"))},y(s.value==="download"?"Build & download":"Build & install"),9,Mm),u.value?(h(),g("span",Dm)):V("",!0)]),i("p",Lm,y(b.value),1),A.value?(h(),g("div",Fm,[i("a",{class:"btn primary",id:"firmware-download-link",href:D.value.href,download:D.value.name},"Download "+y(D.value.name),9,Hm),i("small",null,[T[12]||(T[12]=Q("Put it on the screen with ",-1)),i("a",{href:Nm,target:"_blank",rel:"noopener"},"ESPHome Web"),T[13]||(T[13]=Q(" in Chrome or Edge: Connect, choose the screen's USB port, Install, and select this file. It holds your Wi-Fi password and the screen's keys: keep it to yourself.",-1))])])):V("",!0)]),i("pre",Rm,y((t.value?.logs||[]).join(`
|
||
`)),1)]))}}),Um={class:"panel wide alerts",id:"alerts-dialog"},Vm={class:"panel-head"},Wm={key:0,class:"hint"},Km={class:"alert-hero"},qm={class:"alert-mock",id:"alert-mock","aria-hidden":"true"},Ym={class:"mdi alert-mock-icon",id:"alert-mock-icon"},zm={class:"alerts-nav","aria-label":"Sections"},Gm=["data-jump","onClick"],Jm={id:"alerts-screens",class:"card"},Xm={id:"alerts-min-firmware"},Qm={id:"alerts-screen-list",class:"options"},Zm={key:0,class:"hint"},eg={class:"alert-screen-head"},tg={class:"copy-label"},ng=["onClick"],sg={id:"alerts-howto",class:"card"},og={class:"field"},ig=["value"],lg={key:0,value:""},ag={class:"copy-line"},rg={id:"alerts-example"},ug={id:"alerts-all",class:"card"},cg={id:"alerts-all-event"},dg={id:"alerts-all-dismiss"},fg={class:"copy-line"},pg={id:"alerts-all-example"},hg={id:"alerts-fields",class:"card"},vg={class:"table-scroll"},mg={id:"alerts-field-table"},gg={key:0},yg={id:"alerts-icons",class:"card"},bg={class:"chips",id:"alerts-suggested"},wg=["onClick"],_g={class:"mdi"},kg={class:"field"},$g={id:"alerts-icon-groups"},xg={class:"subhead"},Sg={class:"alert-icon-grid"},Cg=["title","onClick"],Tg={class:"mdi"},Ag={key:0},Eg={key:0,class:"hint"},Pg={id:"alerts-colors",class:"card"},Og={class:"swatches",id:"alerts-swatches"},Ig=["onClick"],Mg={id:"alerts-events",class:"card"},Dg={id:"alerts-event-name"},Lg={class:"table-scroll"},Fg={id:"alerts-ending-table"},Hg={class:"copy-line"},Rg={id:"alerts-wait-example"},Ng={id:"alerts-tips",class:"card"},jg={class:"alerts-list"},Bg=$e({__name:"AlertsView",setup(e){const t=k(()=>d.inventory.alerts),n=k(()=>d.inventory.icons),s=fe(""),o=fe(""),l=x=>`"${String(x).replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,r=x=>x.type==="string"?/^[a-z][a-z0-9-]*$/.test(x.example)?x.example:l(x.example):x.example===!0?"true":x.example===!1?"false":String(x.example),u=k(()=>d.inventory.screens.filter(x=>x.alert_action)),a=k(()=>s.value||u.value[0]?.alert_action||""),c=k(()=>{const x=(t.value?.fields||[]).map(w=>` ${w.name}: ${r(w)}`);return`action: ${a.value||"esphome.<device_name>_show_alert"}
|
||
data:
|
||
${x.join(`
|
||
`)}`}),f=k(()=>["# Doorbell: show the alert and wait until someone presses the button.","actions:",` - action: ${a.value||"esphome.<device_name>_show_alert"}`," data:",' title: "Someone is at the door"',' subtitle: "Door 3, back"'," icon: doorbell"," color: orange",' button_text: "Coming"'," timeout: 0"," flash: true"," - wait_for_trigger:"," - trigger: event",` event_type: ${t.value?.event||"esphome.screen_alert"}`," event_data:"," action: ok",' timeout: "00:05:00"'," - if:"," - condition: template",' value_template: "{{ wait.trigger is not none }}"'," then:"," - action: notify.notify"," data:",' message: "Someone is coming to the door."'].join(`
|
||
`)),b=k(()=>{const x=(t.value?.fields||[]).map(m=>` ${m.name}: ${r(m)}`),w=t.value?.camera;return w&&x.push(` # ${w.name}: ${w.example} # a Guition shows its picture on the card`),`event: ${t.value?.broadcast?.show||"esp_screens_show_alert"}
|
||
event_data:
|
||
${x.join(`
|
||
`)}`}),A=k(()=>{if(!t.value||!n.value)return[];const x=o.value.trim().toLowerCase();return[...n.value.groups,{label:"Also available: control and weather icons",icons:t.value.extra_icons}].map(m=>({label:m.label,icons:m.icons.filter(H=>!x||H.name.includes(x)||(H.label||"").toLowerCase().includes(x))})).filter(m=>m.icons.length)}),D=k(()=>t.value?.suggested_icons?.find(x=>x.name==="doorbell")),I=k(()=>t.value?.colors?.find(x=>x.name==="orange")),R={string:"text",int:"number",bool:"on / off"};function T(x){document.getElementById(x)?.scrollIntoView({behavior:"smooth",block:"start"})}const $=[["alerts-screens","Your screens"],["alerts-howto","In an automation"],["alerts-all","All screens"],["alerts-fields","The fields"],["alerts-icons","Icons"],["alerts-colors","Colors"],["alerts-behaviour","Behavior"],["alerts-events","Events"],["alerts-tips","Tips"]];return(x,w)=>(h(),g("div",Um,[i("div",Vm,[w[7]||(w[7]=i("div",{class:"tx"},[i("span",{class:"eyebrow"},"Alerts · cheatsheet"),i("h1",null,"A full-screen notification, from an automation."),i("p",null,[Q("Every screen has the "),i("code",null,"show_alert"),Q(" action. It places a card over everything, wakes the screen, and keeps the backlight at normal brightness until someone taps the button or the timeout runs out. Home Assistant itself shows no explanation or dropdowns for ESPHome actions; everything you can fill in is listed here.")])],-1)),i("button",{type:"button",class:"btn quiet",id:"close-alerts",onClick:w[0]||(w[0]=m=>v(De)(""))},"← Back")]),t.value?(h(),g(W,{key:1},[i("div",Km,[i("div",qm,[i("div",{class:"alert-mock-card",style:Ne(I.value?{background:I.value.color}:void 0)},[i("span",Ym,y(D.value?v(ke)(D.value.cp):""),1),w[8]||(w[8]=i("strong",{id:"alert-mock-title"},"Someone is at the door",-1)),w[9]||(w[9]=i("span",{id:"alert-mock-subtitle"},"Door 3, back",-1)),w[10]||(w[10]=i("span",{class:"fake",id:"alert-mock-button"},"Coming",-1))],4)]),i("nav",zm,[(h(),g(W,null,le($,([m,H])=>i("button",{key:m,type:"button","data-jump":m,onClick:C=>T(m)},y(H),9,Gm)),64))])]),i("section",Jm,[w[13]||(w[13]=i("h2",null,"Your screens",-1)),i("p",null,[w[11]||(w[11]=Q("Every screen has its own action, with the device name in it. From firmware ",-1)),i("code",Xm,y(t.value.min_firmware),1),w[12]||(w[12]=Q("; update an older screen with its Update button under Screens.",-1))]),i("div",Qm,[v(d).inventory.screens.length?V("",!0):(h(),g("p",Zm,"No screen paired yet. Install one via New screen; the action appears once Home Assistant sees the screen.")),(h(!0),g(W,null,le(v(d).inventory.screens,m=>(h(),g("div",{key:m.id,class:"alert-screen"},[i("div",eg,[i("strong",null,y(m.name),1),i("span",{class:re(["chip",v(bo)(m.firmware,t.value.min_firmware)&&m.alert_action?"good":"update"])},y(v(bo)(m.firmware,t.value.min_firmware)&&m.alert_action?`● firmware ${m.firmware}`:m.alert_action?`Update needed · firmware ${m.firmware||"unknown"}`:"Device name unknown · update the screen"),3)]),(h(!0),g(W,null,le([["Show alert",m.alert_action],["Dismiss alert",m.dismiss_action]],([H,C])=>(h(),g("div",{key:H,class:"copy-line"},[i("span",tg,y(H),1),i("code",null,y(C||"esphome.<device_name>_show_alert"),1),C?(h(),g("button",{key:0,type:"button",class:"btn quiet mini",onClick:L=>v(dt)(C,void 0,"Action name")},"Copy",8,ng)):V("",!0)]))),128))]))),128))])]),i("section",sg,[w[15]||(w[15]=fs('<h2>In an automation</h2><ol class="steps"><li><b>Add action</b> and search for <b>ESPHome</b>. Choose your screen's action: Home Assistant calls it "Performs the action show_alert of the node <i>device name</i>".</li><li><b>Fill in the fields.</b> Home Assistant asks for all seven; leave what you don't use empty (<code>""</code>, <code>0</code>, off).</li><li>Prefer YAML? Choose <b>Edit in YAML</b> on the action and paste the example below.</li></ol>',2)),i("div",og,[w[14]||(w[14]=i("label",{class:"f-label",for:"alerts-example-screen"},"Example for",-1)),Te(i("select",{id:"alerts-example-screen","onUpdate:modelValue":w[1]||(w[1]=m=>s.value=m),style:{"max-width":"360px"}},[(h(!0),g(W,null,le(u.value,m=>(h(),g("option",{key:m.id,value:m.alert_action},y(m.name),9,ig))),128)),u.value.length?V("",!0):(h(),g("option",lg,"a screen (not paired yet)"))],512),[[_s,s.value]])]),i("div",ag,[i("pre",rg,y(c.value),1),i("button",{type:"button",class:"btn quiet mini",id:"alerts-example-copy",onClick:w[2]||(w[2]=m=>v(dt)(c.value,void 0,"YAML"))},"Copy YAML")])]),i("section",ug,[w[23]||(w[23]=i("h2",null,"All screens at once",-1)),i("p",null,[w[16]||(w[16]=Q("Fire the event ",-1)),i("code",cg,y(t.value.broadcast?.show||"esp_screens_show_alert"),1),w[17]||(w[17]=Q(" with the same fields, and ESP Screens passes the alert on to every screen that is online, including screens you add later. ",-1)),i("code",dg,y(t.value.broadcast?.dismiss||"esp_screens_dismiss_alert"),1),w[18]||(w[18]=Q(" clears it everywhere. In an automation, add the ",-1)),w[19]||(w[19]=i("b",null,"Event",-1)),w[20]||(w[20]=Q(" action or paste the example under ",-1)),w[21]||(w[21]=i("b",null,"Edit in YAML",-1)),w[22]||(w[22]=Q(". Leave out the fields you don't use. ESP Screens has to be running for this.",-1))]),i("div",fg,[i("pre",pg,y(b.value),1),i("button",{type:"button",class:"btn quiet mini",id:"alerts-all-copy",onClick:w[3]||(w[3]=m=>v(dt)(b.value,void 0,"YAML"))},"Copy YAML")])]),i("section",hg,[w[27]||(w[27]=i("h2",null,"The fields",-1)),w[28]||(w[28]=i("p",null,"Text is free-form; the limit is in bytes, and an accented letter counts as two. What doesn't fit gets an ellipsis (title) or is dropped (subtitle).",-1)),i("div",vg,[i("table",mg,[w[26]||(w[26]=i("tr",null,[i("th",null,"Field"),i("th",null,"Type"),i("th",null,"What it does"),i("th",null,"Example"),i("th",null,"Limit")],-1)),(h(!0),g(W,null,le(t.value.fields,m=>(h(),g("tr",{key:m.name},[i("td",null,[i("code",null,y(m.name),1),i("small",null,y(m.label),1)]),i("td",null,y(R[m.type]||m.type),1),i("td",null,y(m.help),1),i("td",null,[i("code",null,y(typeof m.example=="string"?m.example:String(m.example)),1)]),i("td",null,y(t.value.limits.cyd[m.name]?`CYD ${t.value.limits.cyd[m.name]} · Guition ${t.value.limits.guition[m.name]} bytes`:m.type==="int"?"0 to 86400 s":"—"),1)]))),128)),t.value.camera?(h(),g("tr",gg,[i("td",null,[i("code",null,y(t.value.camera.name),1),i("small",null,y(t.value.camera.label),1)]),w[24]||(w[24]=i("td",null,"entity",-1)),i("td",null,y(t.value.camera.help),1),i("td",null,[i("code",null,y(t.value.camera.example),1)]),w[25]||(w[25]=i("td",null,"Guition, firmware 0.2.57+",-1))])):V("",!0)])])]),i("section",yg,[w[30]||(w[30]=i("h2",null,"Icons",-1)),w[31]||(w[31]=i("p",null,[Q("Fill in the name in "),i("code",null,"icon"),Q(", for example "),i("code",null,"doorbell"),Q(". "),i("code",null,"mdi:doorbell"),Q(" and the hex codepoint ("),i("code",null,"F12E6"),Q(") also work. Only these icons are included in the firmware; any other name shows the warning triangle. Tap an icon to copy its name.")],-1)),w[32]||(w[32]=i("p",{class:"subhead"},"Handy for notifications",-1)),i("div",bg,[(h(!0),g(W,null,le(t.value.suggested_icons,m=>(h(),g("button",{key:m.name,type:"button",class:"chip",onClick:H=>v(dt)(m.name,void 0,"Icon name")},[i("span",_g,y(v(ke)(m.cp)),1),i("code",null,y(m.name),1)],8,wg))),128))]),i("div",kg,[w[29]||(w[29]=i("label",{class:"f-label",for:"alerts-icon-search"},"Search for an icon",-1)),Te(i("input",{id:"alerts-icon-search","onUpdate:modelValue":w[4]||(w[4]=m=>o.value=m),type:"search",placeholder:"Search by name or description…",autocomplete:"off"},null,512),[[Je,o.value]])]),i("div",$g,[(h(!0),g(W,null,le(A.value,m=>(h(),g("div",{key:m.label,class:"field"},[i("p",xg,y(m.label)+" · "+y(m.icons.length),1),i("div",Sg,[(h(!0),g(W,null,le(m.icons,H=>(h(),g("button",{key:H.name,type:"button",class:"alert-icon",title:`Copy ${H.name}`,onClick:C=>v(dt)(H.name,void 0,"Icon name")},[i("span",Tg,y(v(ke)(H.cp)),1),i("code",null,y(H.name),1),H.label?(h(),g("small",Ag,y(H.label),1)):V("",!0)],8,Cg))),128))])]))),128)),A.value.length?V("",!0):(h(),g("p",Eg,'No icon for "'+y(o.value)+'". Unknown names show the warning triangle ('+y(t.value.fallback_icon)+").",1))])]),i("section",Pg,[w[34]||(w[34]=i("h2",null,"Colors",-1)),w[35]||(w[35]=i("p",null,[Q("Fill in the name in "),i("code",null,"color"),Q(". These are the pastel shades of the tiles, with dark text. Empty or unknown gives the white card. Tap to copy.")],-1)),i("div",Og,[i("button",{type:"button",class:"swatch",onClick:w[5]||(w[5]=m=>v(dt)("",void 0,"Empty color"))},[...w[33]||(w[33]=[i("i",{style:{background:"#ffffff"}},null,-1),i("span",null,[i("code",null,"empty"),i("small",null,"White (default)")],-1)])]),(h(!0),g(W,null,le(t.value.colors,m=>(h(),g("button",{key:m.name,type:"button",class:"swatch",onClick:H=>v(dt)(m.name,void 0,"Color name")},[i("i",{style:Ne({background:m.color})},null,4),i("span",null,[i("code",null,y(m.name),1),i("small",null,y(m.label)+" · "+y(m.color),1)])],8,Ig))),128))])]),w[56]||(w[56]=fs('<section id="alerts-behaviour" class="card"><h2>Behavior</h2><ul class="alerts-list"><li><b>Wakes the screen.</b> An alert immediately wakes a dimmed or dark screen and appears above every page, every open light card, and the standby layer.</li><li><b>On until the button.</b> As long as the card is showing, the backlight stays at normal brightness. Standby and night hours wait. After the button, the regular standby time starts again.</li><li><b>Timeout.</b> <code>timeout: 0</code> waits for the button, however long that takes. With <code>timeout: 60</code> the card disappears after a minute, but the button closes it sooner.</li><li><b>Blinking.</b> <code>flash: true</code> blinks the backlight four times when the alert arrives (about a second) and leaves the screen on afterward.</li><li><b>Replacing.</b> A new alert replaces the current one; there's no stack. The replaced alert reports itself as <code>replaced</code>.</li><li><b>Closing remotely.</b> <code>dismiss_alert</code> clears the card, for example if the door is already open. Without an alert, that action does nothing.</li><li><b>Tapping beside the card</b> does nothing; only the button closes it. That way a wake-up tap never accidentally dismisses the alert.</li></ul></section>',1)),i("section",Mg,[w[47]||(w[47]=i("h2",null,"Events",-1)),i("p",null,[w[36]||(w[36]=Q("Every end fires the event ",-1)),i("code",Dg,y(t.value.event),1),w[37]||(w[37]=Q(" with ",-1)),w[38]||(w[38]=i("code",null,"action",-1)),w[39]||(w[39]=Q(", ",-1)),w[40]||(w[40]=i("code",null,"title",-1)),w[41]||(w[41]=Q(", ",-1)),w[42]||(w[42]=i("code",null,"screen",-1)),w[43]||(w[43]=Q(" (the device name) and the ",-1)),w[44]||(w[44]=i("code",null,"device_id",-1)),w[45]||(w[45]=Q(" that Home Assistant adds. Visible under Settings → Tools → Events.",-1))]),i("div",Lg,[i("table",Fg,[w[46]||(w[46]=i("tr",null,[i("th",null,"action"),i("th",null,"When")],-1)),(h(!0),g(W,null,le(t.value.endings,m=>(h(),g("tr",{key:m.action},[i("td",null,[i("code",null,y(m.action),1)]),i("td",null,y(m.label),1)]))),128))])]),w[48]||(w[48]=i("p",{class:"subhead"},"Waiting until someone presses the button",-1)),i("div",Hg,[i("pre",Rg,y(f.value),1),i("button",{type:"button",class:"btn quiet mini",id:"alerts-wait-copy",onClick:w[6]||(w[6]=m=>v(dt)(f.value,void 0,"YAML"))},"Copy YAML")])]),i("section",Ng,[w[55]||(w[55]=i("h2",null,"Tips",-1)),i("ul",jg,[w[53]||(w[53]=fs("<li>Use a <b>color per kind of notification</b>: orange for the door, red for smoke or water, green for "done". The text always stays dark and readable.</li><li>Keep the title <b>short</b>; a screen shows about twenty characters on one line and ends a longer title with an ellipsis. Put details in the subtitle.</li><li>A <b>custom button text</b> turns the notification into a question: "Coming", "Seen", "Turn off". The event then tells you who responded.</li><li>For an alert that resolves itself (the door opens, the laundry gets taken out) close it in the same automation with <code>dismiss_alert</code>.</li>",4)),i("li",null,[w[49]||(w[49]=Q("Every screen? Fire ",-1)),i("code",null,y(t.value.broadcast?.show||"esp_screens_show_alert"),1),w[50]||(w[50]=Q(" once (see All screens at once). The screens still work independently and each reports with its own ",-1)),w[51]||(w[51]=i("code",null,"screen",-1)),w[52]||(w[52]=Q(".",-1))]),w[54]||(w[54]=i("li",null,[Q("Rather "),i("b",null,"ask Claude"),Q(" for the automation? Install the ESP Screens skill under Settings → Claude.")],-1))])])],64)):(h(),g("p",Wm,"The cheatsheet is still loading; one moment."))]))}}),Ug={class:"panel",id:"override-dialog"},Vg={class:"panel-head"},Wg={class:"tx"},Kg={id:"override-title"},qg={class:"notice"},Yg={class:"mdi"},zg={class:"file-row"},Gg={id:"override-file"},Jg={class:"yaml-editor",id:"yaml-editor-wrap"},Xg={class:"actions"},Qg={id:"override-count",class:"hint"},Zg={class:"actions"},ey=["disabled"],ty=["disabled"],ny=`# Hardware-specific changes for this screen.
|
||
# This file is kept when the shared firmware package updates.
|
||
# Do not add esphome:, api:, ota:, wifi: or packages: here.
|
||
|
||
# Example: a CYD with the ST7789V display controller.
|
||
# "!extend" changes the display the shared package already defines;
|
||
# a bare id would add a second, incomplete display and fail the build.
|
||
display:
|
||
- id: !extend my_display
|
||
model: ST7789V
|
||
`,sy=$e({__name:"OverrideView",setup(e){const t=k(()=>d.overrideProfile),n=fe(""),s=fe(""),o=fe(!1),l=fe("Loading…"),r=fe(""),u=fe(!1),a=fe(null),c=fe(null),f=k(()=>n.value.split(`
|
||
`).length),b=k(()=>Array.from({length:f.value},(C,L)=>L+1).join(`
|
||
`)),A=k(()=>`${n.value.length} characters · ${f.value} line${f.value===1?"":"s"}`);let D=!0;function I(C,L=""){l.value=C,r.value=L}async function R(){if(!t.value){I("No ESPHome profile was found for this screen.","error");return}I("Loading…");try{const C=await Mt(`firmware/profiles/${encodeURIComponent(t.value)}/override`);s.value=C.override_file,o.value=!!C.attached,n.value=C.exists&&C.content!==`{}
|
||
`?C.content:"",I(C.attached?"Changes here apply on the next build.":"Save once to attach this file to the profile.")}catch(C){I(C.message,"error")}}async function T(C=!1){if(!(!t.value||u.value)){u.value=!0,I("Checking and saving…");try{const L=await it(`firmware/profiles/${encodeURIComponent(t.value)}/override`,"PUT",{content:n.value});if(s.value=L.override_file,o.value=!0,!C){I("Saved. The override is kept during firmware updates.","ok"),Se("Override YAML saved.");return}I("Saved. ESPHome is checking the complete profile…"),await it("firmware/jobs","POST",{file:t.value,action:"validate"}),$()}catch(L){I(L.message,"error")}finally{u.value=!1}}}function $(){const C=Date.now(),L=t.value,pe=async()=>{if(!(!D||t.value!==L))try{const Ae=await Mt("firmware"),J=Ae.job;if(J&&J.file===L&&J.state==="running")I(`ESPHome is checking the profile… ${J.stage||""}`.trim());else if(J&&J.file===L&&J.state==="success"){I("The complete profile is valid. Safe to build and install.","ok");return}else if(J&&J.file===L&&J.state==="failed"){const q=(Ae.logs||[]).filter(ae=>/error|failed/i.test(ae)).pop();I(q||"ESPHome rejected the complete profile. See Firmware & USB for the full log.","error");return}Date.now()-C<72e5&&setTimeout(pe,1200)}catch(Ae){I(Ae.message,"error")}};pe()}function x(){(!n.value.trim()||confirm("Replace the current text with the example?"))&&(n.value=ny,I("Example loaded. Save it when you are ready."),a.value?.focus())}function w(){(!n.value.trim()||confirm("Clear the local override?"))&&(n.value="",I("The override will be empty after you save."),a.value?.focus())}function m(C){const L=a.value;if(C.key==="Tab"){C.preventDefault();const pe=L.selectionStart,Ae=L.selectionEnd;L.setRangeText(" ",pe,Ae,"end"),n.value=L.value}else(C.ctrlKey||C.metaKey)&&C.key.toLowerCase()==="s"&&(C.preventDefault(),T(!1))}function H(){c.value&&a.value&&(c.value.scrollTop=a.value.scrollTop)}return bn(R),Xn(()=>{D=!1}),(C,L)=>(h(),g("div",Ug,[i("div",Vg,[i("div",Wg,[L[4]||(L[4]=i("span",{class:"eyebrow"},"Advanced · local override",-1)),i("h1",Kg,"Override YAML"+y(v(d).overrideFriendly?` · ${v(d).overrideFriendly}`:""),1),L[5]||(L[5]=i("p",null,"This small file is yours. It is loaded after the shared screen package and stays in place when ESP Screen Manager updates. Change hardware-specific details here, such as a display model.",-1))]),i("button",{type:"button",class:"btn quiet",id:"close-override",onClick:L[0]||(L[0]=pe=>v(De)(""))},"← Back")]),i("div",qg,[i("span",Yg,y(v(ke)("F0493")),1),L[6]||(L[6]=i("div",null,[i("strong",null,"What is safe to change?"),i("span",null,"Display, touchscreen, substitutions, pins and other device details. Name, Wi-Fi, API, OTA and package links remain managed.")],-1))]),i("div",zg,[i("code",Gg,y(s.value||t.value||""),1),i("span",{id:"override-state",class:re(["chip",{good:o.value}])},y(o.value?"Active":"Ready to attach"),3)]),i("div",Jg,[i("div",{ref_key:"gutter",ref:c,class:"yaml-gutter",id:"override-gutter","aria-hidden":"true"},y(b.value),513),Te(i("textarea",{ref_key:"editor",ref:a,id:"override-editor","onUpdate:modelValue":L[1]||(L[1]=pe=>n.value=pe),spellcheck:"false",autocapitalize:"off",autocomplete:"off",autocorrect:"off","aria-label":"Local override YAML",placeholder:`# Example
|
||
display:
|
||
- id: !extend my_display
|
||
model: ST7789V`,onKeydown:m,onScroll:H},null,544),[[Je,n.value]])]),i("div",Xg,[i("button",{type:"button",class:"btn quiet mini",id:"override-example",onClick:x},"Use example"),i("button",{type:"button",class:"btn quiet mini",id:"override-empty",onClick:w},"Clear"),i("span",Qg,y(A.value),1)]),i("p",{id:"override-status",class:re(["status-line",r.value]),role:"status"},y(l.value),3),i("div",Zg,[i("button",{type:"button",class:"btn quiet",id:"override-check",disabled:u.value||!t.value,onClick:L[2]||(L[2]=pe=>T(!0))},"Save & check",8,ey),i("button",{type:"button",class:"btn primary",id:"override-save",disabled:u.value||!t.value,onClick:L[3]||(L[3]=pe=>T(!1))},"Save override",8,ty)])]))}}),oy={class:"main"},iy=$e({__name:"App",setup(e){const t=k(()=>tt.value==="#settings"?Ov:tt.value==="#new-screen"?ym:tt.value==="#firmware"?Bm:tt.value==="#alerts"?Bg:tt.value==="#override"?sy:qt.value&&d.layout?fv:vv);return(n,s)=>(h(),g("div",{class:re(["app",{dragging:v(d).drag.active}])},[_e(zc),i("main",oy,[(h(),Ve(Sr(t.value)))]),_e(Jc)],2))}});Uu(iy).mount("#app");Ac();
|