Files
homeassistant_espscreen/screen_manager/app/static/assets/index-DfYonu9c.js
T
Max Gramser 1a6308aba7 Fix what a full test round of today's releases found: a ticking single clock, a switch that works in standby, no taps from a swipe (0.2.78)
A test and code-analysis round of 0.2.72 to 0.2.76 (suites at every tag, sanitizers, ESP32 and GitHub builds, host
harnesses on both boards, the editor in a browser, best practice checked against ESPHome, LVGL, Home Assistant and
Vue) found these, fixed here with Max's choices for the product questions:

- Firmware 0.2.65: the second hand of a single analog clock moves again; on a page that is one full on/off tile the
  waking push also switches it; on the Guition a flick is never a tap and a finger that slides off a tile doesn't tap
  it; Previous/Next react to a firm press; the same Go to page tile may sit on several pages; a layout the screen has
  no memory for is refused instead of crashing; 64-bit redraw mask for 48 tiles; Montserrat 14 no longer built.
- App: Save refuses a layout too long for one message or too big for eight pages; an offline screen keeps its
  firmware version from the device registry; HA refusals reach the editor; 128 KB requests; changelog out of the
  live stream; cached hashed assets; tini as init and a clean stop; changelog parsing without asterisks or crashes.
- Editor: clicking the open screen keeps unsaved edits, edits during a save stay unsaved, a Page row and phone
  dragging to other pages, repeated page tiles, limits from the server, HA's error messages, a type-checked build.
- tools/check.sh + GitHub Actions + a CYD flash budget; docs match 48 tiles and the new editor.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 17:25:23 +02:00

29 lines
220 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(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 a of l.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&s(a)}).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 Yo(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Te={},dn=[],At=()=>{},yl=()=>!1,js=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Bs=e=>e.startsWith("onUpdate:"),Ue=Object.assign,zo=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},Ga=Object.prototype.hasOwnProperty,be=(e,t)=>Ga.call(e,t),oe=Array.isArray,Gt=e=>cs(e)==="[object Map]",Rt=e=>cs(e)==="[object Set]",bi=e=>cs(e)==="[object Date]",ue=e=>typeof e=="function",Ie=e=>typeof e=="string",Et=e=>typeof e=="symbol",Se=e=>e!==null&&typeof e=="object",gl=e=>(Se(e)||ue(e))&&ue(e.then)&&ue(e.catch),bl=Object.prototype.toString,cs=e=>bl.call(e),Xa=e=>cs(e).slice(8,-1),wl=e=>cs(e)==="[object Object]",Jo=e=>Ie(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,qn=Yo(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Vs=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},Za=/-\w/g,ze=Vs(e=>e.replace(Za,t=>t.slice(1).toUpperCase())),Qa=/\B([A-Z])/g,on=Vs(e=>e.replace(Qa,"-$1").toLowerCase()),Ws=Vs(e=>e.charAt(0).toUpperCase()+e.slice(1)),lo=Vs(e=>e?`on${Ws(e)}`:""),Tt=(e,t)=>!Object.is(e,t),ks=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},_l=(e,t,n,s=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:s,value:n})},Ks=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let wi;const qs=()=>wi||(wi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Pe(e){if(oe(e)){const t={};for(let n=0;n<e.length;n++){const s=e[n],o=Ie(s)?sr(s):Pe(s);if(o)for(const l in o)t[l]=o[l]}return t}else if(Ie(e)||Se(e))return e}const er=/;(?![^(]*\))/g,tr=/:([^]+)/,nr=/"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;function sr(e){const t={};return e.replace(nr,n=>n.startsWith("/*")?"":n).split(er).forEach(n=>{if(n){const s=n.split(tr);s.length>1&&(t[s[0].trim()]=s[1].trim())}}),t}function ie(e){let t="";if(Ie(e))t=e;else if(oe(e))for(let n=0;n<e.length;n++){const s=ie(e[n]);s&&(t+=s+" ")}else if(Se(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const or="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",ir=Yo(or);function kl(e){return!!e||e===""}function lr(e,t,n){if(e.length!==t.length)return!1;let s=!0;for(let o=0;s&&o<e.length;o++)s=vt(e[o],t[o],n);return s}function _i(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 a=-1;for(let r=0;r<s.length;r++)if(!o[r]&&vt(l,s[r],n)){a=r;break}if(a<0)return!1;o[a]=1}return!0}function ar(e,t,n){let s=Gt(e),o=Gt(t);if(s||o||(s=Rt(e),o=Rt(t),s||o))return s&&o?_i(e,t,n):!1;const l=Object.keys(e).length,a=Object.keys(t).length;if(l!==a)return!1;for(const r in e){const d=e.hasOwnProperty(r),f=t.hasOwnProperty(r);if(d&&!f||!d&&f||!vt(e[r],t[r],n))return!1}return String(e)===String(t)}function ki(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 a=s(e,t,n);return o.delete(e),l.delete(t),a}function vt(e,t,n){if(e===t)return!0;let s=bi(e),o=bi(t);return s||o?s&&o?e.getTime()===t.getTime():!1:(s=Et(e),o=Et(t),s||o?e===t:(s=oe(e),o=oe(t),s||o?s&&o?ki(e,t,n,lr):!1:(s=Se(e),o=Se(t),s||o?!s||!o?!1:ki(e,t,n,ar):String(e)===String(t))))}function Go(e,t){return e.findIndex(n=>vt(n,t))}const $l=e=>!!(e&&e.__v_isRef===!0),v=e=>Ie(e)?e:e==null?"":oe(e)||Se(e)&&(e.toString===bl||!ue(e.toString))?$l(e)?v(e.value):JSON.stringify(e,xl,2):String(e),xl=(e,t)=>$l(t)?xl(e,t.value):Gt(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[s,o],l)=>(n[ao(s,l)+" =>"]=o,n),{})}:Rt(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>ao(n))}:Et(t)?ao(t):Se(t)&&!oe(t)&&!wl(t)?String(t):t,ao=(e,t="")=>{var n;return Et(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};let Re;class rr{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&&Re&&(Re.active?(this.parent=Re,this.index=(Re.scopes||(Re.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=Re;try{return Re=this,t()}finally{Re=n}}}on(){++this._on===1&&(this.prevScope=Re,Re=this)}off(){if(this._on>0&&--this._on===0){if(Re===this)Re=this.prevScope;else{let t=Re;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 ur(){return Re}let Ae;const ro=new WeakSet;class Sl{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,Re&&(Re.active?Re.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,ro.has(this)&&(ro.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Tl(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,$i(this),Al(this);const t=Ae,n=pt;Ae=this,pt=!0;try{return this.fn()}finally{El(this),Ae=t,pt=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)Qo(t);this.deps=this.depsTail=void 0,$i(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?ro.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Co(this)&&this.run()}get dirty(){return Co(this)}}let Cl=0,Yn,zn;function Tl(e,t=!1){if(e.flags|=8,t){e.next=zn,zn=e;return}e.next=Yn,Yn=e}function Xo(){Cl++}function Zo(){if(--Cl>0)return;if(zn){let t=zn;for(zn=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;Yn;){let t=Yn;for(Yn=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 Al(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function El(e){let t,n=e.depsTail,s=n;for(;s;){const o=s.prevDep;s.version===-1?(s===n&&(n=o),Qo(s),cr(s)):t=s,s.dep.activeLink=s.prevActiveLink,s.prevActiveLink=void 0,s=o}e.deps=t,e.depsTail=n}function Co(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Pl(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Pl(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Zn)||(e.globalVersion=Zn,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Co(e))))return;e.flags|=2;const t=e.dep,n=Ae,s=pt;Ae=e,pt=!0;try{Al(e);const o=e.fn(e._value);(t.version===0||Tt(o,e._value))&&(e.flags|=128,e._value=o,t.version++)}catch(o){throw t.version++,o}finally{Ae=n,pt=s,El(e),e.flags&=-3}}function Qo(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)Qo(l,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function cr(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let pt=!0;const Ol=[];function Ht(){Ol.push(pt),pt=!1}function Ut(){const e=Ol.pop();pt=e===void 0?!0:e}function $i(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Ae;Ae=void 0;try{t()}finally{Ae=n}}}let Zn=0;class dr{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 ei{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(!Ae||!pt||Ae===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Ae)n=this.activeLink=new dr(Ae,this),Ae.deps?(n.prevDep=Ae.depsTail,Ae.depsTail.nextDep=n,Ae.depsTail=n):Ae.deps=Ae.depsTail=n,Il(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=Ae.depsTail,n.nextDep=void 0,Ae.depsTail.nextDep=n,Ae.depsTail=n,Ae.deps===n&&(Ae.deps=s)}return n}trigger(t){this.version++,Zn++,this.notify(t)}notify(t){Xo();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{Zo()}}}function Il(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)Il(s)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const To=new WeakMap,fn=Symbol(""),Ao=Symbol(""),Qn=Symbol("");function je(e,t,n){if(pt&&Ae){let s=To.get(e);s||To.set(e,s=new Map);let o=s.get(n);o||(s.set(n,o=new ei),o.map=s,o.key=n),o.track()}}function Dt(e,t,n,s,o,l){const a=To.get(e);if(!a){Zn++;return}const r=d=>{d&&d.trigger()};if(Xo(),t==="clear")a.forEach(r);else{const d=oe(e),f=d&&Jo(n);if(d&&n==="length"){const c=Number(s);a.forEach((y,b)=>{(b==="length"||b===Qn||!Et(b)&&b>=c)&&r(y)})}else switch((n!==void 0||a.has(void 0))&&r(a.get(n)),f&&r(a.get(Qn)),t){case"add":d?f&&r(a.get("length")):(r(a.get(fn)),Gt(e)&&r(a.get(Ao)));break;case"delete":d||(r(a.get(fn)),Gt(e)&&r(a.get(Ao)));break;case"set":Gt(e)&&r(a.get(fn));break}}Zo()}function kn(e){const t=ve(e);return t===e||(je(t,"iterate",Qn),ut(e))?t:Pt(e)?Xt(e)?t.map(n=>Qt(ct(n))):t.map(Qt):t.map(ct)}function Ys(e){return je(e=ve(e),"iterate",Qn),e}function St(e,t){return Pt(e)?Qt(Xt(e)?ct(t):t):ct(t)}const fr={__proto__:null,[Symbol.iterator](){return uo(this,Symbol.iterator,e=>St(this,e))},concat(...e){return kn(this).concat(...e.map(t=>oe(t)?kn(t):t))},entries(){return uo(this,"entries",e=>(e[1]=St(this,e[1]),e))},every(e,t){return Ot(this,"every",e,t,void 0,arguments)},filter(e,t){return Ot(this,"filter",e,t,n=>n.map(s=>St(this,s)),arguments)},find(e,t){return Ot(this,"find",e,t,n=>St(this,n),arguments)},findIndex(e,t){return Ot(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Ot(this,"findLast",e,t,n=>St(this,n),arguments)},findLastIndex(e,t){return Ot(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Ot(this,"forEach",e,t,void 0,arguments)},includes(...e){return co(this,"includes",e)},indexOf(...e){return co(this,"indexOf",e)},join(e){return kn(this).join(e)},lastIndexOf(...e){return co(this,"lastIndexOf",e)},map(e,t){return Ot(this,"map",e,t,void 0,arguments)},pop(){return Fn(this,"pop")},push(...e){return Fn(this,"push",e)},reduce(e,...t){return xi(this,"reduce",e,t)},reduceRight(e,...t){return xi(this,"reduceRight",e,t)},shift(){return Fn(this,"shift")},some(e,t){return Ot(this,"some",e,t,void 0,arguments)},splice(...e){return Fn(this,"splice",e)},toReversed(){return kn(this).toReversed()},toSorted(e){return kn(this).toSorted(e)},toSpliced(...e){return kn(this).toSpliced(...e)},unshift(...e){return Fn(this,"unshift",e)},values(){return uo(this,"values",e=>St(this,e))}};function uo(e,t,n){const s=Ys(e),o=s[t]();return s!==e&&!ut(e)&&(o._next=o.next,o.next=()=>{const l=o._next();return l.done||(l.value=n(l.value)),l}),o}const pr=Array.prototype;function Ot(e,t,n,s,o,l){const a=Ys(e),r=a!==e&&!ut(e),d=a[t];if(d!==pr[t]){const y=d.apply(e,l);return r?ct(y):y}let f=n;a!==e&&(r?f=function(y,b){return n.call(this,St(e,y),b,e)}:n.length>2&&(f=function(y,b){return n.call(this,y,b,e)}));const c=d.call(a,f,s);return r&&o?o(c):c}function xi(e,t,n,s){const o=Ys(e),l=o!==e&&!ut(e);let a=n,r=!1;o!==e&&(l?(r=s.length===0,a=function(f,c,y){return r&&(r=!1,f=St(e,f)),n.call(this,f,St(e,c),y,e)}):n.length>3&&(a=function(f,c,y){return n.call(this,f,c,y,e)}));const d=o[t](a,...s);return r?St(e,d):d}function co(e,t,n){const s=ve(e);je(s,"iterate",Qn);const o=s[t](...n);return(o===-1||o===!1)&&si(n[0])?(n[0]=ve(n[0]),s[t](...n)):o}function Fn(e,t,n=[]){Ht(),Xo();const s=ve(e)[t].apply(e,n);return Zo(),Ut(),s}const hr=Yo("__proto__,__v_isRef,__isVue"),Ml=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Et));function vr(e){Et(e)||(e=String(e));const t=ve(this);return je(t,"has",e),t.hasOwnProperty(e)}class Ll{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?Sr:Rl:l?Nl:Fl).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(s)?t:void 0;const a=oe(t);if(!o){let d;if(a&&(d=fr[n]))return d;if(n==="hasOwnProperty")return vr}const r=Reflect.get(t,n,We(t)?t:s);if((Et(n)?Ml.has(n):hr(n))||(o||je(t,"get",n),l))return r;if(We(r)){const d=a&&Jo(n)?r:r.value;return o&&Se(d)?Po(d):d}return Se(r)?o?Po(r):bn(r):r}}class Dl extends Ll{constructor(t=!1){super(!1,t)}set(t,n,s,o){let l=t[n];const a=oe(t)&&Jo(n);if(!this._isShallow){const f=Pt(l);if(!ut(s)&&!Pt(s)&&(l=ve(l),s=ve(s)),!a&&We(l)&&!We(s))return f||(l.value=s),!0}const r=a?Number(n)<t.length:be(t,n),d=Reflect.set(t,n,s,We(t)?t:o);return t===ve(o)&&d&&(r?Tt(s,l)&&Dt(t,"set",n,s):Dt(t,"add",n,s)),d}deleteProperty(t,n){const s=be(t,n);t[n];const o=Reflect.deleteProperty(t,n);return o&&s&&Dt(t,"delete",n,void 0),o}has(t,n){const s=Reflect.has(t,n);return(!Et(n)||!Ml.has(n))&&je(t,"has",n),s}ownKeys(t){return je(t,"iterate",oe(t)?"length":fn),Reflect.ownKeys(t)}}class mr extends Ll{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const yr=new Dl,gr=new mr,br=new Dl(!0);const Eo=e=>e,ys=e=>Reflect.getPrototypeOf(e);function wr(e,t,n){return function(...s){const o=this.__v_raw,l=ve(o),a=Gt(l),r=e==="entries"||e===Symbol.iterator&&a,d=e==="keys"&&a,f=o[e](...s),c=n?Eo:t?Qt:ct;return!t&&je(l,"iterate",d?Ao:fn),Ue(Object.create(f),{next(){const{value:y,done:b}=f.next();return b?{value:y,done:b}:{value:r?[c(y[0]),c(y[1])]:c(y),done:b}}})}}function gs(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function _r(e,t){const n={get(o){const l=this.__v_raw,a=ve(l),r=ve(o);e||(Tt(o,r)&&je(a,"get",o),je(a,"get",r));const{has:d}=ys(a),f=t?Eo:e?Qt:ct;if(d.call(a,o))return f(l.get(o));if(d.call(a,r))return f(l.get(r));l!==a&&l.get(o)},get size(){const o=this.__v_raw;return!e&&je(ve(o),"iterate",fn),o.size},has(o){const l=this.__v_raw,a=ve(l),r=ve(o);return e||(Tt(o,r)&&je(a,"has",o),je(a,"has",r)),o===r?l.has(o):l.has(o)||l.has(r)},forEach(o,l){const a=this,r=a.__v_raw,d=ve(r),f=t?Eo:e?Qt:ct;return!e&&je(d,"iterate",fn),r.forEach((c,y)=>o.call(l,f(c),f(y),a))}};return Ue(n,e?{add:gs("add"),set:gs("set"),delete:gs("delete"),clear:gs("clear")}:{add(o){const l=ve(this),a=ys(l),r=ve(o),d=!t&&!ut(o)&&!Pt(o)?r:o;return a.has.call(l,d)||Tt(o,d)&&a.has.call(l,o)||Tt(r,d)&&a.has.call(l,r)||(l.add(d),Dt(l,"add",d,d)),this},set(o,l){!t&&!ut(l)&&!Pt(l)&&(l=ve(l));const a=ve(this),{has:r,get:d}=ys(a);let f=r.call(a,o);f||(o=ve(o),f=r.call(a,o));const c=d.call(a,o);return a.set(o,l),f?Tt(l,c)&&Dt(a,"set",o,l):Dt(a,"add",o,l),this},delete(o){const l=ve(this),{has:a,get:r}=ys(l);let d=a.call(l,o);d||(o=ve(o),d=a.call(l,o)),r&&r.call(l,o);const f=l.delete(o);return d&&Dt(l,"delete",o,void 0),f},clear(){const o=ve(this),l=o.size!==0,a=o.clear();return l&&Dt(o,"clear",void 0,void 0),a}}),["keys","values","entries",Symbol.iterator].forEach(o=>{n[o]=wr(o,e,t)}),n}function ti(e,t){const n=_r(e,t);return(s,o,l)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?s:Reflect.get(be(n,o)&&o in s?n:s,o,l)}const kr={get:ti(!1,!1)},$r={get:ti(!1,!0)},xr={get:ti(!0,!1)};const Fl=new WeakMap,Nl=new WeakMap,Rl=new WeakMap,Sr=new WeakMap;function Cr(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function bn(e){return Pt(e)?e:ni(e,!1,yr,kr,Fl)}function Tr(e){return ni(e,!1,br,$r,Nl)}function Po(e){return ni(e,!0,gr,xr,Rl)}function ni(e,t,n,s,o){if(!Se(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 a=Cr(Xa(e));if(a===0)return e;const r=new Proxy(e,a===2?s:n);return o.set(e,r),r}function Xt(e){return Pt(e)?Xt(e.__v_raw):!!(e&&e.__v_isReactive)}function Pt(e){return!!(e&&e.__v_isReadonly)}function ut(e){return!!(e&&e.__v_isShallow)}function si(e){return e?!!e.__v_raw:!1}function ve(e){const t=e&&e.__v_raw;return t?ve(t):e}function Ar(e){return!be(e,"__v_skip")&&Object.isExtensible(e)&&_l(e,"__v_skip",!0),e}const ct=e=>Se(e)?bn(e):e,Qt=e=>Se(e)?Po(e):e;function We(e){return e?e.__v_isRef===!0:!1}function pe(e){return Er(e,!1)}function Er(e,t){return We(e)?e:new Pr(e,t)}class Pr{constructor(t,n){this.dep=new ei,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:ve(t),this._value=n?t:ct(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,s=this.__v_isShallow||ut(t)||Pt(t);t=s?t:ve(t),Tt(t,n)&&(this._rawValue=t,this._value=s?t:ct(t),this.dep.trigger())}}function m(e){return We(e)?e.value:e}const Or={get:(e,t,n)=>t==="__v_raw"?e:m(Reflect.get(e,t,n)),set:(e,t,n,s)=>{const o=e[t];return We(o)&&!We(n)?(o.value=n,!0):Reflect.set(e,t,n,s)}};function Hl(e){return Xt(e)?e:new Proxy(e,Or)}class Ir{constructor(t,n,s){this.fn=t,this.setter=n,this._value=void 0,this.dep=new ei(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Zn-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=s}notify(){if(this.flags|=16,!(this.flags&8)&&Ae!==this)return Tl(this,!0),!0}get value(){const t=this.dep.track();return Pl(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function Mr(e,t,n=!1){let s,o;return ue(e)?s=e:(s=e.get,o=e.set),new Ir(s,o,n)}const bs={},As=new WeakMap;let un;function Lr(e,t=!1,n=un){if(n){let s=As.get(n);s||As.set(n,s=[]),s.push(e)}}function Dr(e,t,n=Te){const{immediate:s,deep:o,once:l,scheduler:a,augmentJob:r,call:d}=n,f=C=>o?C:ut(C)||o===!1||o===0?Ft(C,1):Ft(C);let c,y,b,k,I=!1,E=!1;if(We(e)?(y=()=>e.value,I=ut(e)):Xt(e)?(y=()=>f(e),I=!0):oe(e)?(E=!0,I=e.some(C=>Xt(C)||ut(C)),y=()=>e.map(C=>{if(We(C))return C.value;if(Xt(C))return f(C);if(ue(C))return d?d(C,2):C()})):ue(e)?t?y=d?()=>d(e,2):e:y=()=>{if(b){Ht();try{b()}finally{Ut()}}const C=un;un=c;try{return d?d(e,3,[k]):e(k)}finally{un=C}}:y=At,t&&o){const C=y,V=o===!0?1/0:o;y=()=>Ft(C(),V)}const x=ur(),S=()=>{c.stop(),x&&x.active&&zo(x.effects,c)};if(l&&t){const C=t;t=(...V)=>{const O=C(...V);return S(),O}}let M=E?new Array(e.length).fill(bs):bs;const G=C=>{if(!(!(c.flags&1)||!c.dirty&&!C))if(t){const V=c.run();if(C||o||I||(E?V.some((O,A)=>Tt(O,M[A])):Tt(V,M))){b&&b();const O=un;un=c;try{const A=[V,M===bs?void 0:E&&M[0]===bs?[]:M,k];M=V,d?d(t,3,A):t(...A)}finally{un=O}}}else c.run()};return r&&r(G),c=new Sl(y),c.scheduler=a?()=>a(G,!1):G,k=C=>Lr(C,!1,c),b=c.onStop=()=>{const C=As.get(c);if(C){if(d)d(C,4);else for(const V of C)V();As.delete(c)}},t?s?G(!0):M=c.run():a?a(G.bind(null,!0),!0):c.run(),S.pause=c.pause.bind(c),S.resume=c.resume.bind(c),S.stop=S,S}function Ft(e,t=1/0,n){if(t<=0||!Se(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,We(e))Ft(e.value,t,n);else if(oe(e))for(let s=0;s<e.length;s++)Ft(e[s],t,n);else if(Rt(e)||Gt(e))e.forEach(s=>{Ft(s,t,n)});else if(wl(e)){for(const s in e)Ft(e[s],t,n);for(const s of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,s)&&Ft(e[s],t,n)}return e}function ds(e,t,n,s){try{return s?e(...s):e()}catch(o){zs(o,t,n)}}function mt(e,t,n,s){if(ue(e)){const o=ds(e,t,n,s);return o&&gl(o)&&o.catch(l=>{zs(l,t,n)}),o}if(oe(e)){const o=[];for(let l=0;l<e.length;l++)o.push(mt(e[l],t,n,s));return o}}function zs(e,t,n,s=!0){const o=t?t.vnode:null,{errorHandler:l,throwUnhandledErrorInProduction:a}=t&&t.appContext.config||Te;if(t){let r=t.parent;const d=t.proxy,f=`https://vuejs.org/error-reference/#runtime-${n}`;for(;r;){const c=r.ec;if(c){for(let y=0;y<c.length;y++)if(c[y](e,d,f)===!1)return}r=r.parent}if(l){Ht(),ds(l,null,10,[e,d,f]),Ut();return}}Fr(e,n,o,s,a)}function Fr(e,t,n,s=!0,o=!1){if(o)throw e;console.error(e)}const Ye=[];let $t=-1;const Sn=[];let Yt=null,$n=0;const Ul=Promise.resolve();let Es=null;function Js(e){const t=Es||Ul;return e?t.then(this?e.bind(this):e):t}function Nr(e){let t=$t+1,n=Ye.length;for(;t<n;){const s=t+n>>>1,o=Ye[s],l=es(o);l<e||l===e&&o.flags&2?t=s+1:n=s}return t}function oi(e){if(!(e.flags&1)){const t=es(e),n=Ye[Ye.length-1];!n||!(e.flags&2)&&t>=es(n)?Ye.push(e):Ye.splice(Nr(t),0,e),e.flags|=1,jl()}}function jl(){Es||(Es=Ul.then(Vl))}function Rr(e){if(!oe(e))Yt&&e.id===-1?Yt.splice($n+1,0,e):e.flags&1||(Sn.push(e),e.flags|=1);else for(let t=0;t<e.length;t++)Sn.push(e[t]);jl()}function Si(e,t,n=$t+1){for(;n<Ye.length;n++){const s=Ye[n];if(s&&s.flags&2){if(e&&s.id!==e.uid)continue;Ye.splice(n,1),n--,s.flags&4&&(s.flags&=-2),s(),s.flags&4||(s.flags&=-2)}}}function Bl(e){if(Sn.length){const t=[...new Set(Sn)].sort((n,s)=>es(n)-es(s));if(Sn.length=0,Yt){for(let n=0;n<t.length;n++)Yt.push(t[n]);return}for(Yt=t,$n=0;$n<Yt.length;$n++){const n=Yt[$n];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Yt=null,$n=0}}const es=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Vl(e){try{for($t=0;$t<Ye.length;$t++){const t=Ye[$t];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),ds(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;$t<Ye.length;$t++){const t=Ye[$t];t&&(t.flags&=-2)}$t=-1,Ye.length=0,Bl(),Es=null,(Ye.length||Sn.length)&&Vl()}}let nt=null,Wl=null;function Ps(e){const t=nt;return nt=e,Wl=e&&e.type.__scopeId||null,t}function Hr(e,t=nt,n){if(!t||e._n)return e;const s=(...o)=>{s._d&&Ni(-1);const l=Ps(t),a=hn.length;let r;try{r=e(...o)}finally{for(let d=hn.length;d>a;d--)va();Ps(l),s._d&&Ni(1)}return r};return s._n=!0,s._c=!0,s._d=!0,s}function we(e,t){if(nt===null)return e;const n=eo(nt),s=e.dirs||(e.dirs=[]);for(let o=0;o<t.length;o++){let[l,a,r,d=Te]=t[o];l&&(ue(l)&&(l={mounted:l,updated:l}),l.deep&&Ft(a),s.push({dir:l,instance:n,value:a,oldValue:void 0,arg:r,modifiers:d}))}return e}function an(e,t,n,s){const o=e.dirs,l=t&&t.dirs;for(let a=0;a<o.length;a++){const r=o[a];l&&(r.oldValue=l[a].value);let d=r.dir[s];d&&(Ht(),mt(d,n,8,[e.el,r,e,t]),Ut())}}function Ur(e,t){if(Be){let n=Be.provides;const s=Be.parent&&Be.parent.provides;s===n&&(n=Be.provides=Object.create(s)),n[e]=t}}function $s(e,t,n=!1){const s=Nu();if(s||Cn){let o=Cn?Cn._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&&ue(t)?t.call(s&&s.proxy):t}}const jr=Symbol.for("v-scx"),Br=()=>$s(jr);function pn(e,t,n){return Kl(e,t,n)}function Kl(e,t,n=Te){const{immediate:s,deep:o,flush:l,once:a}=n,r=Ue({},n),d=t&&s||!t&&l!=="post";let f;if(ss){if(l==="sync"){const k=Br();f=k.__watcherHandles||(k.__watcherHandles=[])}else if(!d){const k=()=>{};return k.stop=At,k.resume=At,k.pause=At,k}}const c=Be;r.call=(k,I,E)=>mt(k,c,I,E);let y=!1;l==="post"?r.scheduler=k=>{Ge(k,c&&c.suspense)}:l!=="sync"&&(y=!0,r.scheduler=(k,I)=>{I?k():oi(k)}),r.augmentJob=k=>{t&&(k.flags|=4),y&&(k.flags|=2,c&&(k.id=c.uid,k.i=c))};const b=Dr(e,t,r);return ss&&(f?f.push(b):d&&b()),b}function Vr(e,t,n){const s=this.proxy,o=Ie(e)?e.includes(".")?ql(s,e):()=>s[e]:e.bind(s,s);let l;ue(t)?l=t:(l=t.handler,n=t);const a=fs(this),r=Kl(o,l.bind(s),n);return a(),r}function ql(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 Wr=Symbol("_vte"),Gs=e=>e.__isTeleport,fo=Symbol("_leaveCb");function Kr(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==jt){t=n;break}}return t}function Yl(e){if(!li(e))return Gs(e.type)&&e.children?Kr(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&&ue(n.default))return n.default()}}function ii(e,t){if(e.shapeFlag&6&&e.component){e.transition=t;const n=e.component.subTree;ii(Gs(n.type)&&Yl(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 Ee(e,t){return ue(e)?Ue({name:e.name},t,{setup:e}):e}function zl(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function Ci(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const Os=new WeakMap;function Jn(e,t,n,s,o=!1){if(oe(e)){e.forEach((E,x)=>Jn(E,t&&(oe(t)?t[x]:t),n,s,o));return}if(Gn(s)&&!o){s.shapeFlag&512&&s.type.__asyncResolved&&s.component.subTree.component&&Jn(e,t,n,s.component.subTree);return}const l=s.shapeFlag&4?eo(s.component):s.el,a=o?null:l,{i:r,r:d}=e,f=t&&t.r,c=r.refs===Te?r.refs={}:r.refs,y=r.setupState,b=ve(y),k=y===Te?yl:E=>Ci(c,E)?!1:be(b,E),I=(E,x)=>!(x&&Ci(c,x));if(f!=null&&f!==d){if(Ti(t),Ie(f))c[f]=null,k(f)&&(y[f]=null);else if(We(f)){const E=t;I(f,E.k)&&(f.value=null),E.k&&(c[E.k]=null)}}if(ue(d))ds(d,r,12,[a,c]);else{const E=Ie(d),x=We(d);if(E||x){const S=()=>{if(e.f){const M=E?k(d)?y[d]:c[d]:I()||!e.k?d.value:c[e.k];if(o)oe(M)&&zo(M,l);else if(oe(M))M.includes(l)||M.push(l);else if(E)c[d]=[l],k(d)&&(y[d]=c[d]);else{const G=[l];I(d,e.k)&&(d.value=G),e.k&&(c[e.k]=G)}}else E?(c[d]=a,k(d)&&(y[d]=a)):x&&(I(d,e.k)&&(d.value=a),e.k&&(c[e.k]=a))};if(a){const M=()=>{S(),Os.delete(e)};M.id=-1,Os.set(e,M),Ge(M,n)}else Ti(e),S()}}}function Ti(e){const t=Os.get(e);t&&(t.flags|=8,Os.delete(e))}qs().requestIdleCallback;qs().cancelIdleCallback;const Gn=e=>!!e.type.__asyncLoader,li=e=>e.type.__isKeepAlive;function qr(e,t){Jl(e,"a",t)}function Yr(e,t){Jl(e,"da",t)}function Jl(e,t,n=Be){const s=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(Xs(t,s,n),n){let o=n.parent;for(;o&&o.parent;)li(o.parent.vnode)&&zr(s,t,n,o),o=o.parent}}function zr(e,t,n,s){const o=Xs(t,e,s,!0);Gl(()=>{zo(s[t],o)},n)}function Xs(e,t,n=Be,s=!1){if(n){const o=n[e]||(n[e]=[]),l=t.__weh||(t.__weh=(...a)=>{Ht();const r=fs(n),d=mt(t,n,e,a);return r(),Ut(),d});return s?o.unshift(l):o.push(l),l}}const Wt=e=>(t,n=Be)=>{(!ss||e==="sp")&&Xs(e,(...s)=>t(...s),n)},Jr=Wt("bm"),_n=Wt("m"),Gr=Wt("bu"),Xr=Wt("u"),In=Wt("bum"),Gl=Wt("um"),Zr=Wt("sp"),Qr=Wt("rtg"),eu=Wt("rtc");function tu(e,t=Be){Xs("ec",e,t)}const nu="components",Xl=Symbol.for("v-ndc");function su(e){return Ie(e)?ou(nu,e,!1)||e:e||Xl}function ou(e,t,n=!0,s=!1){const o=nt||Be;if(o){const l=o.type;{const r=Bu(l,!1);if(r&&(r===t||r===ze(t)||r===Ws(ze(t))))return l}const a=Ai(o[e]||l[e],t)||Ai(o.appContext[e],t);return!a&&s?l:a}}function Ai(e,t){return e&&(e[t]||e[ze(t)]||e[Ws(ze(t))])}function le(e,t,n,s){let o;const l=n,a=oe(e);if(a||Ie(e)){const r=a&&Xt(e);let d=!1,f=!1;r&&(d=!ut(e),f=Pt(e),e=Ys(e)),o=new Array(e.length);for(let c=0,y=e.length;c<y;c++)o[c]=t(d?f?Qt(ct(e[c])):ct(e[c]):e[c],c,void 0,l)}else if(typeof e=="number"){o=new Array(e);for(let r=0;r<e;r++)o[r]=t(r+1,r,void 0,l)}else if(Se(e))if(e[Symbol.iterator])o=Array.from(e,(r,d)=>t(r,d,void 0,l));else{const r=Object.keys(e);o=new Array(r.length);for(let d=0,f=r.length;d<f;d++){const c=r[d];o[d]=t(e[c],c,d,l)}}else o=[];return o}const Oo=e=>e?ba(e)?eo(e):Oo(e.parent):null,Xn=Ue(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=>Oo(e.parent),$root:e=>Oo(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Ql(e),$forceUpdate:e=>e.f||(e.f=()=>{oi(e.update)}),$nextTick:e=>e.n||(e.n=Js.bind(e.proxy)),$watch:e=>Vr.bind(e)}),po=(e,t)=>e!==Te&&!e.__isScriptSetup&&be(e,t),iu={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:s,data:o,props:l,accessCache:a,type:r,appContext:d}=e;if(t[0]!=="$"){const b=a[t];if(b!==void 0)switch(b){case 1:return s[t];case 2:return o[t];case 4:return n[t];case 3:return l[t]}else{if(po(s,t))return a[t]=1,s[t];if(o!==Te&&be(o,t))return a[t]=2,o[t];if(be(l,t))return a[t]=3,l[t];if(n!==Te&&be(n,t))return a[t]=4,n[t];Io&&(a[t]=0)}}const f=Xn[t];let c,y;if(f)return t==="$attrs"&&je(e.attrs,"get",""),f(e);if((c=r.__cssModules)&&(c=c[t]))return c;if(n!==Te&&be(n,t))return a[t]=4,n[t];if(y=d.config.globalProperties,be(y,t))return y[t]},set({_:e},t,n){const{data:s,setupState:o,ctx:l}=e;return po(o,t)?(o[t]=n,!0):s!==Te&&be(s,t)?(s[t]=n,!0):be(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:a}},r){let d;return!!(n[r]||e!==Te&&r[0]!=="$"&&be(e,r)||po(t,r)||be(l,r)||be(s,r)||be(Xn,r)||be(o.config.globalProperties,r)||(d=a.__cssModules)&&d[r])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:be(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function Ei(e){return oe(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Io=!0;function lu(e){const t=Ql(e),n=e.proxy,s=e.ctx;Io=!1,t.beforeCreate&&Pi(t.beforeCreate,e,"bc");const{data:o,computed:l,methods:a,watch:r,provide:d,inject:f,created:c,beforeMount:y,mounted:b,beforeUpdate:k,updated:I,activated:E,deactivated:x,beforeDestroy:S,beforeUnmount:M,destroyed:G,unmounted:C,render:V,renderTracked:O,renderTriggered:A,errorCaptured:w,serverPrefetch:T,expose:te,inheritAttrs:$e,components:Me,directives:X,filters:j}=t;if(f&&au(f,s,null),a)for(const de in a){const he=a[de];ue(he)&&(s[de]=he.bind(n))}if(o){const de=o.call(n,n);Se(de)&&(e.data=bn(de))}if(Io=!0,l)for(const de in l){const he=l[de],Q=ue(he)?he.bind(n,n):ue(he.get)?he.get.bind(n,n):At,K=!ue(he)&&ue(he.set)?he.set.bind(n):At,B=$({get:Q,set:K});Object.defineProperty(s,de,{enumerable:!0,configurable:!0,get:()=>B.value,set:ne=>B.value=ne})}if(r)for(const de in r)Zl(r[de],s,n,de);if(d){const de=ue(d)?d.call(n):d;Reflect.ownKeys(de).forEach(he=>{Ur(he,de[he])})}c&&Pi(c,e,"c");function ce(de,he){oe(he)?he.forEach(Q=>de(Q.bind(n))):he&&de(he.bind(n))}if(ce(Jr,y),ce(_n,b),ce(Gr,k),ce(Xr,I),ce(qr,E),ce(Yr,x),ce(tu,w),ce(eu,O),ce(Qr,A),ce(In,M),ce(Gl,C),ce(Zr,T),oe(te))if(te.length){const de=e.exposed||(e.exposed={});te.forEach(he=>{Object.defineProperty(de,he,{get:()=>n[he],set:Q=>n[he]=Q,enumerable:!0})})}else e.exposed||(e.exposed={});V&&e.render===At&&(e.render=V),$e!=null&&(e.inheritAttrs=$e),Me&&(e.components=Me),X&&(e.directives=X),T&&zl(e)}function au(e,t,n=At){oe(e)&&(e=Mo(e));for(const s in e){const o=e[s];let l;Se(o)?"default"in o?l=$s(o.from||s,o.default,!0):l=$s(o.from||s):l=$s(o),We(l)?Object.defineProperty(t,s,{enumerable:!0,configurable:!0,get:()=>l.value,set:a=>l.value=a}):t[s]=l}}function Pi(e,t,n){mt(oe(e)?e.map(s=>s.bind(t.proxy)):e.bind(t.proxy),t,n)}function Zl(e,t,n,s){let o=s.includes(".")?ql(n,s):()=>n[s];if(Ie(e)){const l=t[e];ue(l)&&pn(o,l)}else if(ue(e))pn(o,e.bind(n));else if(Se(e))if(oe(e))e.forEach(l=>Zl(l,t,n,s));else{const l=ue(e.handler)?e.handler.bind(n):t[e.handler];ue(l)&&pn(o,l,e)}}function Ql(e){const t=e.type,{mixins:n,extends:s}=t,{mixins:o,optionsCache:l,config:{optionMergeStrategies:a}}=e.appContext,r=l.get(t);let d;return r?d=r:!o.length&&!n&&!s?d=t:(d={},o.length&&o.forEach(f=>Is(d,f,a,!0)),Is(d,t,a)),Se(t)&&l.set(t,d),d}function Is(e,t,n,s=!1){const{mixins:o,extends:l}=t;l&&Is(e,l,n,!0),o&&o.forEach(a=>Is(e,a,n,!0));for(const a in t)if(!(s&&a==="expose")){const r=ru[a]||n&&n[a];e[a]=r?r(e[a],t[a]):t[a]}return e}const ru={data:Oi,props:Ii,emits:Ii,methods:Un,computed:Un,beforeCreate:Ke,created:Ke,beforeMount:Ke,mounted:Ke,beforeUpdate:Ke,updated:Ke,beforeDestroy:Ke,beforeUnmount:Ke,destroyed:Ke,unmounted:Ke,activated:Ke,deactivated:Ke,errorCaptured:Ke,serverPrefetch:Ke,components:Un,directives:Un,watch:cu,provide:Oi,inject:uu};function Oi(e,t){return t?e?function(){return Ue(ue(e)?e.call(this,this):e,ue(t)?t.call(this,this):t)}:t:e}function uu(e,t){return Un(Mo(e),Mo(t))}function Mo(e){if(oe(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Ke(e,t){return e?[...new Set([].concat(e,t))]:t}function Un(e,t){return e?Ue(Object.create(null),e,t):t}function Ii(e,t){return e?oe(e)&&oe(t)?[...new Set([...e,...t])]:Ue(Object.create(null),Ei(e),Ei(t??{})):t}function cu(e,t){if(!e)return t;if(!t)return e;const n=Ue(Object.create(null),e);for(const s in t)n[s]=Ke(e[s],t[s]);return n}function ea(){return{app:null,config:{isNativeTag:yl,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 du=0;function fu(e,t){return function(s,o=null){ue(s)||(s=Ue({},s)),o!=null&&!Se(o)&&(o=null);const l=ea(),a=new WeakSet,r=[];let d=!1;const f=l.app={_uid:du++,_component:s,_props:o,_container:null,_context:l,_instance:null,version:Wu,get config(){return l.config},set config(c){},use(c,...y){return a.has(c)||(c&&ue(c.install)?(a.add(c),c.install(f,...y)):ue(c)&&(a.add(c),c(f,...y))),f},mixin(c){return l.mixins.includes(c)||l.mixins.push(c),f},component(c,y){return y?(l.components[c]=y,f):l.components[c]},directive(c,y){return y?(l.directives[c]=y,f):l.directives[c]},mount(c,y,b){if(!d){const k=f._ceVNode||_e(s,o);return k.appContext=l,b===!0?b="svg":b===!1&&(b=void 0),e(k,c,b),d=!0,f._container=c,c.__vue_app__=f,eo(k.component)}},onUnmount(c){r.push(c)},unmount(){d&&(mt(r,f._instance,16),e(null,f._container),delete f._container.__vue_app__)},provide(c,y){return l.provides[c]=y,f},runWithContext(c){const y=Cn;Cn=f;try{return c()}finally{Cn=y}}};return f}}let Cn=null;const pu=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${ze(t)}Modifiers`]||e[`${on(t)}Modifiers`];function hu(e,t,...n){if(e.isUnmounted)return;const s=e.vnode.props||Te;let o=n;const l=t.startsWith("update:"),a=l&&pu(s,t.slice(7));a&&(a.trim&&(o=n.map(c=>Ie(c)?c.trim():c)),a.number&&(o=o.map(Ks)));let r,d=s[r=lo(t)]||s[r=lo(ze(t))];!d&&l&&(d=s[r=lo(on(t))]),d&&mt(d,e,6,o);const f=s[r+"Once"];if(f){if(!e.emitted)e.emitted={};else if(e.emitted[r])return;e.emitted[r]=!0,mt(f,e,6,o)}}const vu=new WeakMap;function ta(e,t,n=!1){const s=n?vu:t.emitsCache,o=s.get(e);if(o!==void 0)return o;const l=e.emits;let a={},r=!1;if(!ue(e)){const d=f=>{const c=ta(f,t,!0);c&&(r=!0,Ue(a,c))};!n&&t.mixins.length&&t.mixins.forEach(d),e.extends&&d(e.extends),e.mixins&&e.mixins.forEach(d)}return!l&&!r?(Se(e)&&s.set(e,null),null):(oe(l)?l.forEach(d=>a[d]=null):Ue(a,l),Se(e)&&s.set(e,a),a)}function Zs(e,t){return!e||!js(t)?!1:(t=t.slice(2),t=t==="Once"?t:t.replace(/Once$/,""),be(e,t[0].toLowerCase()+t.slice(1))||be(e,on(t))||be(e,t))}function Mi(e){const{type:t,vnode:n,proxy:s,withProxy:o,propsOptions:[l],slots:a,attrs:r,emit:d,render:f,renderCache:c,props:y,data:b,setupState:k,ctx:I,inheritAttrs:E}=e,x=Ps(e);let S,M;try{if(n.shapeFlag&4){const C=o||s,V=C;S=Ct(f.call(V,C,c,y,k,b,I)),M=r}else{const C=t;S=Ct(C.length>1?C(y,{attrs:r,slots:a,emit:d}):C(y,null)),M=t.props?r:mu(r)}}catch(C){hn.length=0,zs(C,e,1),S=_e(jt)}let G=S;if(M&&E!==!1){const C=Object.keys(M),{shapeFlag:V}=G;C.length&&V&7&&(l&&C.some(Bs)&&(M=yu(M,l)),G=En(G,M,!1,!0))}if(n.dirs&&(G=En(G,null,!1,!0),G.dirs=G.dirs?G.dirs.concat(n.dirs):n.dirs),n.transition){const C=Gs(G.type)&&Yl(G)||G;ii(C,n.transition)}return S=G,Ps(x),S}const mu=e=>{let t;for(const n in e)(n==="class"||n==="style"||js(n))&&((t||(t={}))[n]=e[n]);return t},yu=(e,t)=>{const n={};for(const s in e)(!Bs(s)||!(s.slice(9)in t))&&(n[s]=e[s]);return n};function gu(e,t,n){const{props:s,children:o,component:l}=e,{props:a,children:r,patchFlag:d}=t,f=l.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&d>=0){if(d&1024)return!0;if(d&16)return s?Li(s,a,f):!!a;if(d&8){const c=t.dynamicProps;for(let y=0;y<c.length;y++){const b=c[y];if(na(a,s,b)&&!Zs(f,b))return!0}}}else return(o||r)&&(!r||!r.$stable)?!0:s===a?!1:s?a?Li(s,a,f):!0:!!a;return!1}function Li(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(na(t,e,l)&&!Zs(n,l))return!0}return!1}function na(e,t,n){const s=e[n],o=t[n];return n==="style"&&Se(s)&&Se(o)?!vt(s,o):s!==o}function bu({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 sa={},oa=()=>Object.create(sa),ia=e=>Object.getPrototypeOf(e)===sa;function wu(e,t,n,s=!1){const o={},l=oa();e.propsDefaults=Object.create(null),la(e,t,o,l);for(const a in e.propsOptions[0])a in o||(o[a]=void 0);n?e.props=s?o:Tr(o):e.type.props?e.props=o:e.props=l,e.attrs=l}function _u(e,t,n,s){const{props:o,attrs:l,vnode:{patchFlag:a}}=e,r=ve(o),[d]=e.propsOptions;let f=!1;if((s||a>0)&&!(a&16)){if(a&8){const c=e.vnode.dynamicProps;for(let y=0;y<c.length;y++){let b=c[y];if(Zs(e.emitsOptions,b))continue;const k=t[b];if(d)if(be(l,b))k!==l[b]&&(l[b]=k,f=!0);else{const I=ze(b);o[I]=Lo(d,r,I,k,e,!1)}else k!==l[b]&&(l[b]=k,f=!0)}}}else{la(e,t,o,l)&&(f=!0);let c;for(const y in r)(!t||!be(t,y)&&((c=on(y))===y||!be(t,c)))&&(d?n&&(n[y]!==void 0||n[c]!==void 0)&&(o[y]=Lo(d,r,y,void 0,e,!0)):delete o[y]);if(l!==r)for(const y in l)(!t||!be(t,y))&&(delete l[y],f=!0)}f&&Dt(e.attrs,"set","")}function la(e,t,n,s){const[o,l]=e.propsOptions;let a=!1,r;if(t)for(let d in t){if(qn(d))continue;const f=t[d];let c;o&&be(o,c=ze(d))?!l||!l.includes(c)?n[c]=f:(r||(r={}))[c]=f:Zs(e.emitsOptions,d)||(!(d in s)||f!==s[d])&&(s[d]=f,a=!0)}if(l){const d=ve(n),f=r||Te;for(let c=0;c<l.length;c++){const y=l[c];n[y]=Lo(o,d,y,f[y],e,!be(f,y))}}return a}function Lo(e,t,n,s,o,l){const a=e[n];if(a!=null){const r=be(a,"default");if(r&&s===void 0){const d=a.default;if(a.type!==Function&&!a.skipFactory&&ue(d)){const{propsDefaults:f}=o;if(n in f)s=f[n];else{const c=fs(o);s=f[n]=d.call(null,t),c()}}else s=d;o.ce&&o.ce._setProp(n,s)}a[0]&&(l&&!r?s=!1:a[1]&&(s===""||s===on(n))&&(s=!0))}return s}const ku=new WeakMap;function aa(e,t,n=!1){const s=n?ku:t.propsCache,o=s.get(e);if(o)return o;const l=e.props,a={},r=[];let d=!1;if(!ue(e)){const c=y=>{d=!0;const[b,k]=aa(y,t,!0);Ue(a,b),k&&r.push(...k)};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}if(!l&&!d)return Se(e)&&s.set(e,dn),dn;if(oe(l))for(let c=0;c<l.length;c++){const y=ze(l[c]);Di(y)&&(a[y]=Te)}else if(l)for(const c in l){const y=ze(c);if(Di(y)){const b=l[c],k=a[y]=oe(b)||ue(b)?{type:b}:Ue({},b),I=k.type;let E=!1,x=!0;if(oe(I))for(let S=0;S<I.length;++S){const M=I[S],G=ue(M)&&M.name;if(G==="Boolean"){E=!0;break}else G==="String"&&(x=!1)}else E=ue(I)&&I.name==="Boolean";k[0]=E,k[1]=x,(E||be(k,"default"))&&r.push(y)}}const f=[a,r];return Se(e)&&s.set(e,f),f}function Di(e){return e[0]!=="$"&&!qn(e)}const ai=e=>e==="_"||e==="_ctx"||e==="$stable",ri=e=>oe(e)?e.map(Ct):[Ct(e)],$u=(e,t,n)=>{if(t._n)return t;const s=Hr((...o)=>ri(t(...o)),n);return s._c=!1,s},ra=(e,t,n)=>{const s=e._ctx;for(const o in e){if(ai(o))continue;const l=e[o];if(ue(l))t[o]=$u(o,l,s);else if(l!=null){const a=ri(l);t[o]=()=>a}}},ua=(e,t)=>{const n=ri(t);e.slots.default=()=>n},ca=(e,t,n)=>{for(const s in t)(n||!ai(s))&&(e[s]=t[s])},xu=(e,t,n)=>{const s=e.slots=oa();if(e.vnode.shapeFlag&32){const o=t._;o?(ca(s,t,n),n&&_l(s,"_",o,!0)):ra(t,s)}else t&&ua(e,t)},Su=(e,t,n)=>{const{vnode:s,slots:o}=e;let l=!0,a=Te;if(s.shapeFlag&32){const r=t._;r?n&&r===1?l=!1:ca(o,t,n):(l=!t.$stable,ra(t,o)),a=t}else t&&(ua(e,t),a={default:1});if(l)for(const r in o)!ai(r)&&a[r]==null&&delete o[r]},Ge=Pu;function Cu(e){return Tu(e)}function Tu(e,t){const n=qs();n.__VUE__=!0;const{insert:s,remove:o,patchProp:l,createElement:a,createText:r,createComment:d,setText:f,setElementText:c,parentNode:y,nextSibling:b,setScopeId:k=At,insertStaticContent:I}=e,E=(g,_,P,H=null,L=null,F=null,Y=void 0,q=null,W=!!_.dynamicChildren)=>{if(g===_)return;g&&!Nn(g,_)&&(H=fe(g),ne(g,L,F,!0),g=null),_.patchFlag===-2&&(W=!1,_.dynamicChildren=null),_.dynamicChildren&&g&&g.dynamicChildren&&g.dynamicChildren.hasOnce&&(_.dynamicChildren===dn&&(_.dynamicChildren=[]),_.dynamicChildren.hasOnce=!0);const{type:D,ref:se,shapeFlag:J}=_;switch(D){case Qs:x(g,_,P,H);break;case jt:S(g,_,P,H);break;case xs:g==null&&M(_,P,H,Y);break;case U:Me(g,_,P,H,L,F,Y,q,W);break;default:J&1?V(g,_,P,H,L,F,Y,q,W):J&6?X(g,_,P,H,L,F,Y,q,W):(J&64||J&128)&&D.process(g,_,P,H,L,F,Y,q,W,ln)}se!=null&&L?Jn(se,g&&g.ref,F,_||g,!_):se==null&&g&&g.ref!=null&&Jn(g.ref,null,F,g,!0)},x=(g,_,P,H)=>{if(g==null)s(_.el=r(_.children),P,H);else{const L=_.el=g.el;_.children!==g.children&&f(L,_.children)}},S=(g,_,P,H)=>{g==null?s(_.el=d(_.children||""),P,H):_.el=g.el},M=(g,_,P,H)=>{[g.el,g.anchor]=I(g.children,_,P,H,g.el,g.anchor)},G=({el:g,anchor:_},P,H)=>{let L;for(;g&&g!==_;)L=b(g),s(g,P,H),g=L;s(_,P,H)},C=({el:g,anchor:_})=>{let P;for(;g&&g!==_;)P=b(g),o(g),g=P;o(_)},V=(g,_,P,H,L,F,Y,q,W)=>{if(_.type==="svg"?Y="svg":_.type==="math"&&(Y="mathml"),g==null)O(_,P,H,L,F,Y,q,W);else{const D=g.el&&g.el._isVueCE?g.el:null;try{D&&D._beginPatch(),T(g,_,L,F,Y,q,W)}finally{D&&D._endPatch()}}},O=(g,_,P,H,L,F,Y,q)=>{let W,D;const{props:se,shapeFlag:J,transition:ee,dirs:ae}=g;if(W=g.el=a(g.type,F,se&&se.is,se),J&8?c(W,g.children):J&16&&w(g.children,W,null,H,L,ho(g,F),Y,q),ae&&an(g,null,H,"created"),A(W,g,g.scopeId,Y,H),se){for(const Ce in se)Ce!=="value"&&!qn(Ce)&&l(W,Ce,null,se[Ce],F,H);"value"in se&&l(W,"value",null,se.value,F),(D=se.onVnodeBeforeMount)&&kt(D,H,g)}ae&&an(g,null,H,"beforeMount");const ye=Au(L,ee);ye&&ee.beforeEnter(W),s(W,_,P),((D=se&&se.onVnodeMounted)||ye||ae)&&Ge(()=>{D&&kt(D,H,g),ye&&ee.enter(W),ae&&an(g,null,H,"mounted")},L)},A=(g,_,P,H,L)=>{if(P&&k(g,P),H)for(let F=0;F<H.length;F++)k(g,H[F]);if(L){let F=L.subTree;if(_===F||ha(F.type)&&(F.ssContent===_||F.ssFallback===_)){const Y=L.vnode;A(g,Y,Y.scopeId,Y.slotScopeIds,L.parent)}}},w=(g,_,P,H,L,F,Y,q,W=0)=>{for(let D=W;D<g.length;D++){const se=g[D]=q?Mt(g[D]):Ct(g[D]);E(null,se,_,P,H,L,F,Y,q)}},T=(g,_,P,H,L,F,Y)=>{const q=_.el=g.el;let{patchFlag:W,dynamicChildren:D,dirs:se}=_;W|=g.patchFlag&16;const J=g.props||Te,ee=_.props||Te;let ae;if(P&&rn(P,!1),(ae=ee.onVnodeBeforeUpdate)&&kt(ae,P,_,g),se&&an(_,g,P,"beforeUpdate"),P&&rn(P,!0),D&&(!g.dynamicChildren||g.dynamicChildren.length!==D.length)&&(W=0,Y=!1,D=null),(J.innerHTML&&ee.innerHTML==null||J.textContent&&ee.textContent==null)&&c(q,""),D?te(g.dynamicChildren,D,q,P,H,ho(_,L),F):Y||he(g,_,q,null,P,H,ho(_,L),F,!1),W>0){if(W&16)$e(q,J,ee,P,L);else if(W&2&&J.class!==ee.class&&l(q,"class",null,ee.class,L),W&4&&l(q,"style",J.style,ee.style,L),W&8){const ye=_.dynamicProps;for(let Ce=0;Ce<ye.length;Ce++){const xe=ye[Ce],De=J[xe],Ne=ee[xe];(Ne!==De||xe==="value")&&l(q,xe,De,Ne,L,P)}}W&1&&g.children!==_.children&&c(q,_.children)}else!Y&&D==null&&$e(q,J,ee,P,L);((ae=ee.onVnodeUpdated)||se)&&Ge(()=>{ae&&kt(ae,P,_,g),se&&an(_,g,P,"updated")},H)},te=(g,_,P,H,L,F,Y)=>{for(let q=0;q<_.length;q++){const W=g[q],D=_[q],se=W.el&&(W.type===U||!Nn(W,D)||W.shapeFlag&198)?y(W.el):P;E(W,D,se,null,H,L,F,Y,!0)}},$e=(g,_,P,H,L)=>{if(_!==P){if(_!==Te)for(const F in _)!qn(F)&&!(F in P)&&l(g,F,_[F],null,L,H);for(const F in P){if(qn(F))continue;const Y=P[F],q=_[F];Y!==q&&F!=="value"&&l(g,F,q,Y,L,H)}"value"in P&&l(g,"value",_.value,P.value,L)}},Me=(g,_,P,H,L,F,Y,q,W)=>{const D=_.el=g?g.el:r(""),se=_.anchor=g?g.anchor:r("");let{patchFlag:J,dynamicChildren:ee,slotScopeIds:ae}=_;ae&&(q=q?q.concat(ae):ae),g==null?(s(D,P,H),s(se,P,H),w(_.children||[],P,se,L,F,Y,q,W)):J>0&&J&64&&ee&&g.dynamicChildren&&g.dynamicChildren.length===ee.length?(te(g.dynamicChildren,ee,P,L,F,Y,q),(_.key!=null||L&&_===L.subTree)&&da(g,_,!0)):he(g,_,P,se,L,F,Y,q,W)},X=(g,_,P,H,L,F,Y,q,W)=>{_.slotScopeIds=q,g==null?_.shapeFlag&512?L.ctx.activate(_,P,H,Y,W):j(_,P,H,L,F,Y,W):z(g,_,W)},j=(g,_,P,H,L,F,Y)=>{const q=g.component=Fu(g,H,L);if(li(g)&&(q.ctx.renderer=ln),Ru(q,!1,Y),q.asyncDep){if(L&&L.registerDep(q,ce,Y),!g.el){const W=q.subTree=_e(jt);S(null,W,_,P),g.placeholder=W.el}}else ce(q,g,_,P,L,F,Y)},z=(g,_,P)=>{const H=_.component=g.component;if(gu(g,_,P))if(H.asyncDep&&!H.asyncResolved){_.el=g.el,de(H,_,P);return}else H.next=_,H.update();else _.el=g.el,H.vnode=_},ce=(g,_,P,H,L,F,Y)=>{const q=()=>{if(g.isMounted){let{next:J,bu:ee,u:ae,parent:ye,vnode:Ce}=g;{const wt=fa(g);if(wt){J&&(J.el=Ce.el,de(g,J,Y)),wt.asyncDep.then(()=>{Ge(()=>{g.isUnmounted||D()},L)});return}}let xe=J,De;rn(g,!1),J?(J.el=Ce.el,de(g,J,Y)):J=Ce,ee&&ks(ee),(De=J.props&&J.props.onVnodeBeforeUpdate)&&kt(De,ye,J,Ce),rn(g,!0);const Ne=Mi(g),bt=g.subTree;g.subTree=Ne,E(bt,Ne,y(bt.el),fe(bt),g,L,F),J.el=Ne.el,xe===null&&bu(g,Ne.el),ae&&Ge(ae,L),(De=J.props&&J.props.onVnodeUpdated)&&Ge(()=>kt(De,ye,J,Ce),L)}else{let J;const{el:ee,props:ae}=_,{bm:ye,m:Ce,parent:xe,root:De,type:Ne}=g,bt=Gn(_);rn(g,!1),ye&&ks(ye),!bt&&(J=ae&&ae.onVnodeBeforeMount)&&kt(J,xe,_),rn(g,!0);{De.ce&&De.ce._hasShadowRoot()&&De.ce._injectChildStyle(Ne,g.parent?g.parent.type:void 0);const wt=g.subTree=Mi(g);E(null,wt,P,H,g,L,F),_.el=wt.el}if(Ce&&Ge(Ce,L),!bt&&(J=ae&&ae.onVnodeMounted)){const wt=_;Ge(()=>kt(J,xe,wt),L)}(_.shapeFlag&256||xe&&Gn(xe.vnode)&&xe.vnode.shapeFlag&256)&&g.a&&Ge(g.a,L),g.isMounted=!0,_=P=H=null}};g.scope.on();const W=g.effect=new Sl(q);g.scope.off();const D=g.update=W.run.bind(W),se=g.job=W.runIfDirty.bind(W);se.i=g,se.id=g.uid,W.scheduler=()=>oi(se),rn(g,!0),D()},de=(g,_,P)=>{_.component=g;const H=g.vnode.props;g.vnode=_,g.next=null,_u(g,_.props,H,P),Su(g,_.children,P),Ht(),Si(g),Ut()},he=(g,_,P,H,L,F,Y,q,W=!1)=>{const D=g&&g.children,se=g?g.shapeFlag:0,J=_.children,{patchFlag:ee,shapeFlag:ae}=_;if(ee>0){if(ee&128){K(D,J,P,H,L,F,Y,q,W);return}else if(ee&256){Q(D,J,P,H,L,F,Y,q,W);return}}ae&8?(se&16&&N(D,L,F),J!==D&&c(P,J)):se&16?ae&16?K(D,J,P,H,L,F,Y,q,W):N(D,L,F,!0):(se&8&&c(P,""),ae&16&&w(J,P,H,L,F,Y,q,W))},Q=(g,_,P,H,L,F,Y,q,W)=>{g=g||dn,_=_||dn;const D=g.length,se=_.length,J=Math.min(D,se);let ee;for(ee=0;ee<J;ee++){const ae=_[ee]=W?Mt(_[ee]):Ct(_[ee]);E(g[ee],ae,P,null,L,F,Y,q,W)}D>se?N(g,L,F,!0,!1,J):w(_,P,H,L,F,Y,q,W,J)},K=(g,_,P,H,L,F,Y,q,W)=>{let D=0;const se=_.length;let J=g.length-1,ee=se-1;for(;D<=J&&D<=ee;){const ae=g[D],ye=_[D]=W?Mt(_[D]):Ct(_[D]);if(Nn(ae,ye))E(ae,ye,P,null,L,F,Y,q,W);else break;D++}for(;D<=J&&D<=ee;){const ae=g[J],ye=_[ee]=W?Mt(_[ee]):Ct(_[ee]);if(Nn(ae,ye))E(ae,ye,P,null,L,F,Y,q,W);else break;J--,ee--}if(D>J){if(D<=ee){const ae=ee+1,ye=ae<se?_[ae].el:H;for(;D<=ee;)E(null,_[D]=W?Mt(_[D]):Ct(_[D]),P,ye,L,F,Y,q,W),D++}}else if(D>ee)for(;D<=J;)ne(g[D],L,F,!0),D++;else{const ae=D,ye=D,Ce=new Map;for(D=ye;D<=ee;D++){const et=_[D]=W?Mt(_[D]):Ct(_[D]);et.key!=null&&Ce.set(et.key,D)}let xe,De=0;const Ne=ee-ye+1;let bt=!1,wt=0;const Dn=new Array(Ne);for(D=0;D<Ne;D++)Dn[D]=0;for(D=ae;D<=J;D++){const et=g[D];if(De>=Ne){ne(et,L,F,!0);continue}let _t;if(et.key!=null)_t=Ce.get(et.key);else for(xe=ye;xe<=ee;xe++)if(Dn[xe-ye]===0&&Nn(et,_[xe])){_t=xe;break}_t===void 0?ne(et,L,F,!0):(Dn[_t-ye]=D+1,_t>=wt?wt=_t:bt=!0,E(et,_[_t],P,null,L,F,Y,q,W),De++)}const mi=bt?Eu(Dn):dn;for(xe=mi.length-1,D=Ne-1;D>=0;D--){const et=ye+D,_t=_[et],yi=_[et+1],gi=et+1<se?yi.el||pa(yi):H;Dn[D]===0?E(null,_t,P,gi,L,F,Y,q,W):bt&&(xe<0||D!==mi[xe]?B(_t,P,gi,2):xe--)}}},B=(g,_,P,H,L=null)=>{const{el:F,type:Y,transition:q,children:W,shapeFlag:D}=g;if(D&6){B(g.component.subTree,_,P,H);return}if(D&128){g.suspense.move(_,P,H);return}if(D&64){Y.move(g,_,P,ln);return}if(Y===U){s(F,_,P);for(let J=0;J<W.length;J++)B(W[J],_,P,H);s(g.anchor,_,P);return}if(Y===xs){G(g,_,P);return}if(H!==2&&D&1&&q)if(H===0)q.persisted&&!F[fo]?s(F,_,P):(q.beforeEnter(F),s(F,_,P),Ge(()=>q.enter(F),L));else{const{leave:J,delayLeave:ee,afterLeave:ae}=q,ye=()=>{g.ctx.isUnmounted?o(F):s(F,_,P)},Ce=()=>{const xe=F._isLeaving||!!F[fo];F._isLeaving&&F[fo](!0),q.persisted&&!xe?ye():J(F,()=>{ye(),ae&&ae()})};ee?ee(F,ye,Ce):Ce()}else s(F,_,P)},ne=(g,_,P,H=!1,L=!1)=>{const{type:F,props:Y,ref:q,children:W,dynamicChildren:D,shapeFlag:se,patchFlag:J,dirs:ee,cacheIndex:ae,memo:ye}=g;if((J===-2||D&&D.hasOnce)&&(L=!1),q!=null&&(Ht(),Jn(q,null,P,g,!0),Ut()),ae!=null&&(!g.ctx||g.ctx===_)&&(_.renderCache[ae]=void 0),se&256){_.ctx.deactivate(g);return}const Ce=se&1&&ee,xe=!Gn(g);let De;if(xe&&(De=Y&&Y.onVnodeBeforeUnmount)&&kt(De,_,g),se&6)me(g.component,P,H);else{if(se&128){g.suspense.unmount(P,H);return}Ce&&an(g,null,_,"beforeUnmount"),se&64?g.type.remove(g,_,P,ln,H):D&&!D.hasOnce&&(F!==U||J>0&&J&64)?N(D,_,P,!1,!0):(F===U&&J&384||!L&&se&16)&&N(W,_,P),H&&Qe(g)}const Ne=ye!=null&&ae==null;(xe&&(De=Y&&Y.onVnodeUnmounted)||Ce||Ne)&&Ge(()=>{De&&kt(De,_,g),Ce&&an(g,null,_,"unmounted"),Ne&&(g.el=null)},P)},Qe=g=>{const{type:_,el:P,anchor:H,transition:L}=g;if(_===U){Mn(P,H);return}if(_===xs){C(g),L&&!L.persisted&&L.afterLeave&&L.afterLeave();return}const F=()=>{o(P),L&&!L.persisted&&L.afterLeave&&L.afterLeave()};if(g.shapeFlag&1&&L&&!L.persisted){const{leave:Y,delayLeave:q}=L,W=()=>Y(P,F);q?q(g.el,F,W):W()}else F()},Mn=(g,_)=>{let P;for(;g!==_;)P=b(g),o(g),g=P;o(_)},me=(g,_,P)=>{const{bum:H,scope:L,job:F,subTree:Y,um:q,m:W,a:D}=g;Fi(W),Fi(D),H&&ks(H),L.stop(),F?(F.flags|=8,ne(Y,g,_,P)):g.vnode.el&&Y&&(Y.transition=g.vnode.transition,ne(Y,g,_,P)),q&&Ge(q,_),Ge(()=>{g.isUnmounted=!0},_)},N=(g,_,P,H=!1,L=!1,F=0)=>{for(let Y=F;Y<g.length;Y++)ne(g[Y],_,P,H,L)},fe=g=>{if(g.shapeFlag&6)return fe(g.component.subTree);if(g.shapeFlag&128)return g.suspense.next();const _=b(g.anchor||g.el),P=_&&_[Wr];return P?b(P):_};let at=!1;const Ln=(g,_,P)=>{let H;g==null?_._vnode&&(ne(_._vnode,null,null,!0),H=_._vnode.component):E(_._vnode||null,g,_,null,null,null,P),_._vnode=g,at||(at=!0,Si(H),Bl(),at=!1)},ln={p:E,um:ne,m:B,r:Qe,mt:j,mc:w,pc:he,pbc:te,n:fe,o:e};return{render:Ln,hydrate:void 0,createApp:fu(Ln)}}function ho({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 rn({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Au(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function da(e,t,n=!1){const s=e.children,o=t.children;if(oe(s)&&oe(o))for(let l=0;l<s.length;l++){const a=s[l];let r=o[l];r.shapeFlag&1&&!r.dynamicChildren&&((r.patchFlag<=0||r.patchFlag===32)&&(r=o[l]=Mt(o[l]),r.el=a.el),!n&&r.patchFlag!==-2&&da(a,r)),r.type===Qs&&(r.patchFlag===-1&&(r=o[l]=Mt(r)),r.el=a.el),r.type===jt&&!r.el&&(r.el=a.el)}}function Eu(e){const t=e.slice(),n=[0];let s,o,l,a,r;const d=e.length;for(s=0;s<d;s++){const f=e[s];if(f!==0){if(o=n[n.length-1],e[o]<f){t[s]=o,n.push(s);continue}for(l=0,a=n.length-1;l<a;)r=l+a>>1,e[n[r]]<f?l=r+1:a=r;f<e[n[l]]&&(l>0&&(t[s]=n[l-1]),n[l]=s)}}for(l=n.length,a=n[l-1];l-- >0;)n[l]=a,a=t[a];return n}function fa(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:fa(t)}function Fi(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function pa(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?pa(t.subTree):null}const ha=e=>e.__isSuspense;function Pu(e,t){t&&t.pendingBranch?oe(e)?t.effects.push(...e):t.effects.push(e):Rr(e)}const U=Symbol.for("v-fgt"),Qs=Symbol.for("v-txt"),jt=Symbol.for("v-cmt"),xs=Symbol.for("v-stc"),hn=[];let st=null;function p(e=!1){hn.push(st=e?null:[])}function va(){hn.pop(),st=hn[hn.length-1]||null}let ts=1;function Ni(e,t=!1){ts+=e,e<0&&st&&t&&(st.hasOnce=!0)}function ma(e){return e.dynamicChildren=ts>0?st||dn:null,va(),ts>0&&st&&st.push(e),e}function h(e,t,n,s,o,l){return ma(i(e,t,n,s,o,l,!0))}function Xe(e,t,n,s,o){return ma(_e(e,t,n,s,o,!0))}function ya(e){return e?e.__v_isVNode===!0:!1}function Nn(e,t){return e.type===t.type&&e.key===t.key}const ga=({key:e})=>e??null,Ss=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Ie(e)||We(e)||ue(e)?{i:nt,r:e,k:t,f:!!n}:e:null);function i(e,t=null,n=null,s=0,o=null,l=e===U?0:1,a=!1,r=!1){const d={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&ga(t),ref:t&&Ss(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:nt};return r?(Ms(d,n),l&128&&e.normalize(d)):n&&(d.shapeFlag|=Ie(n)?8:16),ts>0&&!a&&st&&(d.patchFlag>0||l&6)&&d.patchFlag!==32&&st.push(d),d}const _e=Ou;function Ou(e,t=null,n=null,s=0,o=null,l=!1){if((!e||e===Xl)&&(e=jt),ya(e)){const r=En(e,t,!0);return n&&Ms(r,n),ts>0&&!l&&st&&(r.shapeFlag&6?st[st.indexOf(e)]=r:st.push(r)),r.patchFlag=-2,r}if(Vu(e)&&(e=e.__vccOpts),t){t=Iu(t);let{class:r,style:d}=t;r&&!Ie(r)&&(t.class=ie(r)),Se(d)&&(si(d)&&!oe(d)&&(d=Ue({},d)),t.style=Pe(d))}const a=Ie(e)?1:ha(e)?128:Gs(e)?64:Se(e)?4:ue(e)?2:0;return i(e,t,n,s,o,a,l,!0)}function Iu(e){return e?si(e)||ia(e)?Ue({},e):e:null}function En(e,t,n=!1,s=!1){const{props:o,ref:l,patchFlag:a,children:r,transition:d}=e,f=t?Mu(o||{},t):o,c={__v_isVNode:!0,__v_skip:!0,type:e.type,props:f,key:f&&ga(f),ref:t&&t.ref?n&&l?oe(l)?l.concat(Ss(t)):[l,Ss(t)]:Ss(t):l,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:r,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==U?a===-1?16:a|16:a,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:d,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&En(e.ssContent),ssFallback:e.ssFallback&&En(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce,cacheIndex:e.cacheIndex};return d&&s&&ii(c,d.clone(c)),c}function Z(e=" ",t=0){return _e(Qs,null,e,t)}function Cs(e,t){const n=_e(xs,null,e);return n.staticCount=t,n}function R(e="",t=!1){return t?(p(),Xe(jt,null,e)):_e(jt,null,e)}function Ct(e){return e==null||typeof e=="boolean"?_e(jt):oe(e)?_e(U,null,e.slice()):ya(e)?Mt(e):_e(Qs,null,String(e))}function Mt(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:En(e)}function Ms(e,t){let n=0;const{shapeFlag:s}=e;if(t==null)t=null;else if(oe(t))n=16;else if(typeof t=="object")if(s&65){const o=t.default;o&&(o._c&&(o._d=!1),Ms(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!ia(t)?t._ctx=nt:o===3&&nt&&(nt.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else if(ue(t)){if(s&65){Ms(e,{default:t});return}t={default:t,_ctx:nt},n=32}else t=String(t),s&64?(n=16,t=[Z(t)]):n=8;e.children=t,e.shapeFlag|=n}function Mu(...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=ie([t.class,s.class]));else if(o==="style")t.style=Pe([t.style,s.style]);else if(js(o)){const l=t[o],a=s[o];a&&l!==a&&!(oe(l)&&l.includes(a))?t[o]=l?[].concat(l,a):a:a==null&&l==null&&!Bs(o)&&(t[o]=a)}else o!==""&&(t[o]=s[o])}return t}function kt(e,t,n,s=null){mt(e,t,7,[n,s])}const Lu=ea();let Du=0;function Fu(e,t,n){const s=e.type,o=(t?t.appContext:e.appContext)||Lu,l={uid:Du++,vnode:e,type:s,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new rr(!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:aa(s,o),emitsOptions:ta(s,o),emit:null,emitted:null,propsDefaults:Te,inheritAttrs:s.inheritAttrs,ctx:Te,data:Te,props:Te,attrs:Te,slots:Te,refs:Te,setupState:Te,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=hu.bind(null,l),e.ce&&e.ce(l),l}let Be=null;const Nu=()=>Be||nt;let Ls,ns;{const e=qs(),t=(n,s)=>{let o;return(o=e[n])||(o=e[n]=[]),o.push(s),l=>{o.length>1?o.forEach(a=>a(l)):o[0](l)}};Ls=t("__VUE_INSTANCE_SETTERS__",n=>Be=n),ns=t("__VUE_SSR_SETTERS__",n=>ss=n)}const fs=e=>{const t=Be;return Ls(e),e.scope.on(),()=>{e.scope.off(),Ls(t)}},Ri=()=>{Be&&Be.scope.off(),Ls(null)};function ba(e){return e.vnode.shapeFlag&4}let ss=!1;function Ru(e,t=!1,n=!1){t&&ns(t);const{props:s,children:o}=e.vnode,l=ba(e);wu(e,s,l,t),xu(e,o,n||t);const a=l?Hu(e,t):void 0;return t&&ns(!1),a}function Hu(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,iu);const{setup:s}=n;if(s){Ht();const o=e.setupContext=s.length>1?ju(e):null,l=fs(e),a=ds(s,e,0,[e.props,o]),r=gl(a);if(Ut(),l(),(r||e.sp)&&!Gn(e)&&zl(e),r){if(a.then(Ri,Ri),t)return a.then(d=>{ns(!0);try{Hi(e,d,t)}finally{ns(!1)}}).catch(d=>{zs(d,e,0)});e.asyncDep=a}else Hi(e,a)}else wa(e)}function Hi(e,t,n){ue(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Se(t)&&(e.setupState=Hl(t)),wa(e)}function wa(e,t,n){const s=e.type;e.render||(e.render=s.render||At);{const o=fs(e);Ht();try{lu(e)}finally{Ut(),o()}}}const Uu={get(e,t){return je(e,"get",""),e[t]}};function ju(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,Uu),slots:e.slots,emit:e.emit,expose:t}}function eo(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Hl(Ar(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Xn)return Xn[n](e)},has(t,n){return n in t||n in Xn}})):e.proxy}function Bu(e,t=!0){return ue(e)?e.displayName||e.name:e.name||t&&e.__name}function Vu(e){return ue(e)&&"__vccOpts"in e}const $=(e,t)=>Mr(e,t,ss),Wu="3.5.43";let Do;const Ui=typeof window<"u"&&window.trustedTypes;if(Ui)try{Do=Ui.createPolicy("vue",{createHTML:e=>e})}catch{}const _a=Do?e=>Do.createHTML(e):e=>e,Ku="http://www.w3.org/2000/svg",qu="http://www.w3.org/1998/Math/MathML",It=typeof document<"u"?document:null,ji=It&&It.createElement("template"),Yu={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"?It.createElementNS(Ku,e):t==="mathml"?It.createElementNS(qu,e):n?It.createElement(e,{is:n}):It.createElement(e);return e==="select"&&s&&s.multiple!=null&&o.setAttribute("multiple",s.multiple),o},createText:e=>It.createTextNode(e),createComment:e=>It.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>It.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,s,o,l){const a=n?n.previousSibling:t.lastChild;if(o&&(o===l||o.nextSibling))for(;t.insertBefore(o.cloneNode(!0),n),!(o===l||!(o=o.nextSibling)););else{ji.innerHTML=_a(s==="svg"?`<svg>${e}</svg>`:s==="mathml"?`<math>${e}</math>`:e);const r=ji.content;if(s==="svg"||s==="mathml"){const d=r.firstChild;for(;d.firstChild;)r.appendChild(d.firstChild);r.removeChild(d)}t.insertBefore(r,n)}return[a?a.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},zu=Symbol("_vtc");function Ju(e,t,n){const s=e[zu];s&&(t=(t?[t,...s]:[...s]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Bi=Symbol("_vod"),Gu=Symbol("_vsh"),Xu=Symbol(""),Zu=/(?:^|;)\s*display\s*:/;function Qu(e,t,n){const s=e.style,o=Ie(n);let l=!1;if(n&&!o){if(t)if(Ie(t))for(const a of t.split(";")){const r=a.slice(0,a.indexOf(":")).trim();n[r]==null&&jn(s,r,"")}else for(const a in t)n[a]==null&&jn(s,a,"");for(const a in n){a==="display"&&(l=!0);const r=n[a];r!=null?tc(e,a,!Ie(t)&&t?t[a]:void 0,r)||jn(s,a,r):jn(s,a,"")}}else if(o){if(t!==n){const a=s[Xu];a&&(n+=";"+a),s.cssText=n,l=Zu.test(n)}}else t&&e.removeAttribute("style");Bi in e&&(e[Bi]=l?s.display:"",e[Gu]&&(s.display="none"))}const ws=/\s*!important$/;function jn(e,t,n){if(oe(n))n.forEach(s=>jn(e,t,s));else if(n==null&&(n=""),t.startsWith("--"))ws.test(n)?e.setProperty(t,n.replace(ws,""),"important"):e.setProperty(t,n);else{const s=ec(e,t);ws.test(n)?e.setProperty(on(s),n.replace(ws,""),"important"):e[s]=n}}const Vi=["Webkit","Moz","ms"],vo={};function ec(e,t){const n=vo[t];if(n)return n;let s=ze(t);if(s!=="filter"&&s in e)return vo[t]=s;s=Ws(s);for(let o=0;o<Vi.length;o++){const l=Vi[o]+s;if(l in e)return vo[t]=l}return t}function tc(e,t,n,s){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&Ie(s)&&n===s}const Wi="http://www.w3.org/1999/xlink";function Ki(e,t,n,s,o,l=ir(t)){s&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Wi,t.slice(6,t.length)):e.setAttributeNS(Wi,t,n):n==null||l&&!kl(n)?e.removeAttribute(t):e.setAttribute(t,l?"":Et(n)?String(n):n)}function qi(e,t,n,s,o){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?_a(n):n);return}const l=e.tagName;if(t==="value"&&l!=="PROGRESS"&&!l.includes("-")){const r=l==="OPTION"?e.getAttribute("value")||"":e.value,d=n==null?e.type==="checkbox"?"on":"":String(n);(r!==d||!("_value"in e))&&(e.value=d),n==null&&e.removeAttribute(t),e._value=n;return}let a=!1;if(n===""||n==null){const r=typeof e[t];r==="boolean"?n=kl(n):n==null&&r==="string"?(n="",a=!0):r==="number"&&(n=0,a=!0)}try{e[t]=n}catch{}a&&e.removeAttribute(o||t)}function Nt(e,t,n,s){e.addEventListener(t,n,s)}function nc(e,t,n,s){e.removeEventListener(t,n,s)}const Yi=Symbol("_vei");function sc(e,t,n,s,o=null){const l=e[Yi]||(e[Yi]={}),a=l[t];if(s&&a)a.value=s;else{const[r,d]=lc(t);if(s){const f=l[t]=uc(s,o);Nt(e,r,f,d)}else a&&(nc(e,r,a,d),l[t]=void 0)}}const oc=/(Once|Passive|Capture)$/,ic=/^on:?(?:Once|Passive|Capture)$/;function lc(e){let t,n;for(;(n=e.match(oc))&&!ic.test(e);)t||(t={}),e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===":"?e.slice(3):on(e.slice(2)),t]}let mo=0;const ac=Promise.resolve(),rc=()=>mo||(ac.then(()=>mo=0),mo=Date.now());function uc(e,t){const n=s=>{if(!s._vts)s._vts=Date.now();else if(s._vts<=n.attached)return;const o=n.value;if(oe(o)){const l=s.stopImmediatePropagation;s.stopImmediatePropagation=()=>{l.call(s),s._stopped=!0};const a=o.slice(),r=[s];for(let d=0;d<a.length&&!s._stopped;d++){const f=a[d];f&&mt(f,t,5,r)}}else mt(o,t,5,[s])};return n.value=e,n.attached=rc(),n}const zi=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,cc=(e,t,n,s,o,l)=>{const a=o==="svg";t==="class"?Ju(e,s,a):t==="style"?Qu(e,n,s):js(t)?Bs(t)||sc(e,t,n,s,l):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):dc(e,t,s,a))?(qi(e,t,s),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Ki(e,t,s,a,l,t!=="value")):e._isVueCE&&(fc(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Ie(s)))?qi(e,ze(t),s,l,t):(t==="true-value"?e._trueValue=s:t==="false-value"&&(e._falseValue=s),Ki(e,t,s,a))};function dc(e,t,n,s){if(s)return!!(t==="innerHTML"||t==="textContent"||t in e&&zi(t)&&ue(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 zi(t)&&Ie(n)?!1:t in e}function fc(e,t){const n=e._def.props;if(!n)return!1;const s=ze(t);return Array.isArray(n)?n.some(o=>ze(o)===s):Object.keys(n).some(o=>ze(o)===s)}const en=e=>{const t=e.props["onUpdate:modelValue"]||!1;return oe(t)?n=>ks(t,n):t};function pc(e){e.target.composing=!0}function Ji(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const ot=Symbol("_assign"),_s=Symbol("_initialValue");function yo(e,t,n){return t&&(e=e.trim()),n&&(e=Ks(e)),e}const Fe={created(e,{modifiers:{lazy:t,trim:n,number:s}},o){e.parentNode&&(e.type==="text"?e[_s]=e.defaultValue.replace(/[\r\n]/g,""):e.type==="textarea"&&(e[_s]=e.defaultValue.replace(/\r\n?/g,`
`))),e[ot]=en(o);const l=s||o.props&&o.props.type==="number";Nt(e,t?"change":"input",a=>{a.target.composing||e[ot](yo(e.value,n,l))}),(n||l)&&Nt(e,"change",()=>{e.value=yo(e.value,n,l)}),t||(Nt(e,"compositionstart",pc),Nt(e,"compositionend",Ji),Nt(e,"change",Ji))},mounted(e,{value:t,modifiers:{trim:n,number:s}}){const o=t??"",l=e[_s];delete e[_s],l!==void 0&&(e.type==="text"||e.type==="textarea")&&e.value!==l?e[ot](yo(e.value,n,s)):e.value=o},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:s,trim:o,number:l}},a){if(e[ot]=en(a),e.composing)return;const r=(l||e.type==="number")&&!/^0\d/.test(e.value)?Ks(e.value):e.value,d=t??"";if(r===d)return;const f=e.getRootNode();(f instanceof Document||f instanceof ShadowRoot)&&f.activeElement===e&&e.type!=="range"&&(s&&t===n||o&&e.value.trim()===d)||(e.value=d)}},hc={deep:!0,created(e,t,n){e[ot]=en(n),Nt(e,"change",()=>{const s=e._modelValue,o=Pn(e),l=e.checked,a=e[ot];if(oe(s)){const r=Go(s,o),d=r!==-1;if(l&&!d)a(s.concat(o));else if(!l&&d){const f=[...s];f.splice(r,1),a(f)}}else if(Rt(s)){const r=new Set(s);l?r.add(o):r.delete(o),a(r)}else a(ka(e,l))})},mounted:Gi,beforeUpdate(e,t,n){e[ot]=en(n),Gi(e,t,n)}};function Gi(e,{value:t,oldValue:n},s){e._modelValue=t;let o;if(oe(t))o=Go(t,s.props.value)>-1;else if(Rt(t))o=t.has(s.props.value);else{if(t===n)return;o=vt(t,ka(e,!0))}e.checked!==o&&(e.checked=o)}const Xi={created(e,{value:t},n){e.checked=vt(t,n.props.value),e[ot]=en(n),Nt(e,"change",()=>{e[ot](Pn(e))})},beforeUpdate(e,{value:t,oldValue:n},s){e[ot]=en(s),t!==n&&(e.checked=vt(t,s.props.value))}},vn={deep:!0,created(e,{value:t,modifiers:{number:n}},s){e._modelValue=t,Nt(e,"change",()=>{const o=Array.prototype.filter.call(e.options,d=>d.selected).map(d=>n?Ks(Pn(d)):Pn(d)),l=e.multiple,a=l?Rt(e._modelValue)?new Set(o):o:o[0],r=e._pendingValue=[l,l?oe(a)?o.slice():o:a];try{e[ot](a)}finally{Js(()=>{e._pendingValue===r&&(e._pendingValue=void 0)})}}),e[ot]=en(s)},mounted(e,{value:t}){Zi(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[ot]=en(n)},updated(e,{value:t}){const n=e._pendingValue;e._pendingValue=void 0,(!n||n[0]!==e.multiple||!vc(t,n[1],n[0]))&&Zi(e,t)}};function vc(e,t,n){if(!n||oe(e))return vt(e,t);if(Rt(e)){if(e.size!==t.length)return!1;for(const s of t)if(!e.has(s))return!1;return!0}return!1}function Zi(e,t){const n=e.multiple,s=oe(t);if(!(n&&!s&&!Rt(t))){for(let o=0,l=e.options.length;o<l;o++){const a=e.options[o],r=Pn(a);if(n)if(s){const d=typeof r;d==="string"||d==="number"?a.selected=t.some(f=>String(f)===String(r)):a.selected=Go(t,r)>-1}else a.selected=t.has(r);else if(vt(Pn(a),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Pn(e){return"_value"in e?e._value:e.value}function ka(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const mc=["ctrl","shift","alt","meta"],yc={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)=>mc.some(n=>e[`${n}Key`]&&!t.includes(n))},dt=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),s=t.join(".");return n[s]||(n[s]=((o,...l)=>{for(let a=0;a<t.length;a++){const r=yc[t[a]];if(r&&r(o,t))return}return e(o,...l)}))},gc={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},$a=(e,t)=>{const n=e._withKeys||(e._withKeys={}),s=t.join(".");return n[s]||(n[s]=(o=>{if(!("key"in o))return;const l=on(o.key);if(t.some(a=>a===l||gc[a]===l))return e(o)}))},bc=Ue({patchProp:cc},Yu);let Qi;function wc(){return Qi||(Qi=Cu(bc))}const _c=((...e)=>{const t=wc().createApp(...e),{mount:n}=t;return t.mount=s=>{const o=$c(s);if(!o)return;const l=t._component;!ue(l)&&!l.render&&!l.template&&(l.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const a=n(o,!1,kc(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),a},t});function kc(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function $c(e){return Ie(e)?document.querySelector(e):e}const xc=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Sc=["Su","Mo","Tu","We","Th","Fr","Sa"],xa={clock:"clock-outline",analog:"clock-outline",date:"calendar"},qe=e=>JSON.stringify(e),ke=e=>String.fromCodePoint(parseInt(e,16));function ui(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 ci=(e=new Date)=>`${Sc[e.getDay()]} ${e.getDate()} ${xc[e.getMonth()]}`;function Cc(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 Tc={guition:{width:448,top:36,name:27,text:21,icon:26},cyd:{width:298,top:24,name:18,text:14,icon:18}};let Rn;const Fo=new Map,Ac=()=>Fo.clear();function cn(e,t){const n=`${t}|${e}`;let s=Fo.get(n);if(!s){if(Rn===void 0&&(Rn=document.createElement("canvas").getContext("2d")),Rn){Rn.font=t;const o=Rn.measureText(e);s={left:-o.actualBoundingBoxLeft,right:o.actualBoundingBoxRight,top:-o.actualBoundingBoxAscent,bottom:o.actualBoundingBoxDescent,advance:o.width}}else{const o=Number(/(\d+(?:\.\d+)?)px/.exec(t)?.[1]||14),l=[...e].length*o*.55;s={left:0,right:l,top:-o*.72,bottom:o*.02,advance:l}}Fo.set(n,s)}return s}const Ec=e=>({name:`500 ${e.name}px "Bar Roboto"`,text:`400 ${e.text}px "Bar Roboto"`,icon:`${e.icon}px "Tile Icons"`});function Pc(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 Sa(e,t,n,s){const o=Ec(t),l=cn("0",o.text),a=Math.round(l.bottom-l.top),r=Pc(a),d=cn(String.fromCodePoint(983376),o.icon),f=Math.round(d.bottom-d.top),c=e.map((C,V)=>{const O=s(C),A={index:V,item:C,view:O,shown:O.shown,width:0};return O.analog?(A.dial=f,A.width=f,A):(O.icon&&(A.icon={glyph:ke(O.icon),ink:cn(ke(O.icon),o.icon)},A.width+=A.icon.ink.right-A.icon.ink.left),O.text&&(A.text={value:O.text,ink:cn(O.text,o.text)},A.width+=(A.icon?r.icon:0)+A.text.ink.right-A.text.ink.left),A)}),y=c.filter(C=>C.shown),b=cn(n,o.name).advance,k=Math.min(b,Math.floor(t.width*35/100)),I=C=>C.reduce((V,O)=>V+O.width,0)+Math.max(0,C.length-1)*r.item;let E=0;for(;E<y.length&&I(y.slice(E))+r.name+k>t.width;)E++;const x=y.slice(E),S=new Set(y.slice(0,E).map(C=>C.index));let M=t.width-I(x);for(const C of x)C.x=M,M+=C.width+r.item;const G=x.length?x[0].x-r.name:t.width;return{metrics:t,fonts:o,cap:a,zero:l,gaps:r,parts:c,placed:x,dropped:S,nameText:n,natural:b,nameRoom:G}}function Oc(e,t,n){if(cn(e,t).advance<=n)return e;const s=[...e];for(;s.length&&cn(s.join("")+"...",t).advance>n;)s.pop();return s.join("")+"..."}function Ic(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(()=>{Ac(),e()}).catch(()=>{})}let Ca="";function Mc(e){Ca=e||""}async function di(e,t={}){const n=await fetch(`api/${e}`,{...t,headers:{"Content-Type":"application/json","X-Screen-CSRF":Ca,...t.headers}});if(!n.ok){let s="That didn't work. Refresh the page and try again.";try{const o=(await n.json())?.error;typeof o=="string"&&o.trim()&&(s=o)}catch{}throw new Error(s)}return n}const yt=async e=>(await di(e)).json(),it=async(e,t,n,s={})=>{const l=await(await di(e,{method:t,body:n===void 0?void 0:JSON.stringify(n),...s})).text();return l?JSON.parse(l):null},Le=6,Bt=8,os=Bt*Le,Lc=["single","wide","full"],tn=e=>e===!0?"wide":e===!1?"single":e,ps=e=>/^screen\.page_[1-8]$/.test(e)?Number(e.slice(-1)):0,Je=e=>Lc.includes(e.options?.size)?e.options.size:"single",No=e=>Je(e)!=="single",Ta=e=>Je(e)==="full",Aa=e=>e-e%Le,Ea=e=>e-e%2,ht=e=>Math.floor(e/Le),fi=e=>tn(e)==="full"?Le:tn(e)==="wide"?2:1,mn=(e,t)=>tn(t)==="full"?Array.from({length:Le},(n,s)=>Aa(e)+s):tn(t)==="wide"?[e,e+1]:[e],el=(e,t)=>tn(t)==="full"?Aa(e):tn(t)==="wide"?Ea(e):e,Ve=e=>e.tiles.map(t=>({tile:t,slot:t.slot}));function Pa(e){let t=0;return e.map(n=>{const s=Je(n);s==="full"&&t%Le?t+=Le-t%Le:s==="wide"&&t%2===1&&t++;const o=t;return t+=fi(s),o})}function Dc(e){const t=Pa(e);return e.some((n,s)=>n.slot!==t[s])}function to(e){if(e.tiles.some(t=>!Number.isInteger(t.slot))){const t=Pa(e.tiles);e.tiles.forEach((n,s)=>n.slot=t[s])}e.tiles.sort((t,n)=>t.slot-n.slot)}function Tn(e){const t=new Set;for(const{tile:n,slot:s}of e)for(const o of mn(s,Je(n)))t.add(o);return t}const is=(e,t,n)=>Number.isInteger(t)&&t>=0&&t<os&&(tn(n)==="full"?t%Le===0:tn(n)==="wide"?t+1<os&&!(t%2):!0)&&mn(t,n).every(s=>!e.has(s));function Ds(e,t,n=0){for(let s=n;s<os;s++)if(is(e,s,t))return s;return-1}function Oa(e,t,n){let s=-1;for(let o=0;o<os;o++)is(e,o,t)&&(s<0||Math.abs(o-n)<=Math.abs(s-n))&&(s=o);return s}function Ia(e,t,n){const s=Je(t);if(n=el(n,s),!is(new Set,n,s))return null;const o=mn(n,s),l=e.includes(t)?mn(t.slot,s):[],a=[{tile:t,slot:n}],r=[];for(const d of e)d!==t&&(mn(d.slot,Je(d)).some(f=>o.includes(f))?r.push(d):a.push({tile:d,slot:d.slot}));for(const d of r){const f=Je(d),c=Tn(a);let y=l.map(b=>el(b,f)).find(b=>is(c,b,f));if(y===void 0&&(y=Oa(c,f,d.slot)),y<0)return null;a.push({tile:d,slot:y})}return a.sort((d,f)=>d.slot-f.slot)}function gt(e,t=1){const n=Math.max(0,...e.map(({tile:s,slot:o})=>o+fi(Je(s))));return Math.min(Bt,Math.max(1,Math.ceil(n/Le),t||1))}function Fc(e){const t=e.split(".")[0];return t==="sun"?{options:{display:"sunpath",size:"wide"}}:t==="weather"?{options:{display:"forecast",size:"wide"}}:ps(e)?{}:t==="screen"?{options:{display:"digital",size:"wide"}}:{}}const Ma=e=>({entity:e,name:"",slot:-1,...Fc(e)});function La(e,t){const n=e.entity.split(".")[0],s=t.controls?.[n],o=e.options||{};if(!s||!["wide","full"].includes(o.size)||(o.display||"standard")!=="standard"||o.inline==="slider")return null;const l=o.controls??(o.size==="full"?"none":s.default);return l==="none"?null:l}function Nc(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 Ro=e=>(/^(\d+)\.(\d+)\.(\d+)$/.exec(e||"")||[]).slice(1).map(Number);function nn(e,t){const[n,s]=[Ro(e),Ro(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 Rc=(e,t,n,s)=>nn(e,`${t}.${n}.${s}`),Hc=os;function Uc(e){return Ro(e).length!==3?10:nn(e,"0.2.62")?Hc:nn(e,"0.2.7")?20:10}const Da={standard:"standard",watch:"large value",forecast:"weather forecast",graph:"graph",digital:"digital clock",analog:"analog clock",sunpath:"sun path"},jc={single:"normal",wide:"double",full:"full page"},tl=["light","switch","input_boolean","fan","media_player","climate"],Bc=["light","fan","cover","number","input_number","media_player"],Vc={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:["Screen","◷","#25282c","#e9ecf1"],sun:["Sun","☼","#c86620","#ffebdc"],timer:["Timer","⏱","#008577","#def3ed"],person:["Person","☺","#2f7d32","#e1f2e2"],camera:["Camera","◧","#3d4a57","#e6ebf0"],image:["Image","◧","#3d4a57","#e6ebf0"]},xt=e=>Vc[e.split(".")[0]]||["Entity","◇","#637184","#edf0f4"],u=bn({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,liveStates:{},room:"",hidePlaced:!1,palette:!1,firmwareJob:null}),lt=$(()=>u.inventory.screens.find(e=>e.id===u.selected)),ls=e=>(e&&"firmware_known"in e?e.firmware_known:e?.firmware)||"",Fa=$(()=>ls(lt.value)),Zt=(e,t,n)=>Rc(Fa.value,e,t,n),yn=$(()=>{const e=lt.value?.tile_limit;return typeof e=="number"&&Number.isInteger(e)&&e>0?e:Uc(Fa.value)}),nl=$(()=>{const e=lt.value?.full_page;return typeof e=="boolean"?e:Zt(0,2,62)}),Wc=$(()=>{const e=lt.value?.page_tiles_repeat;return typeof e=="boolean"?e:Zt(0,2,65)}),no=e=>Wc.value&&ps(e)>0,pi=$(()=>lt.value?.board==="guition"),Na=$(()=>Tc[pi.value?"guition":"cyd"]),go=$(()=>u.selectedTile&&u.layout?.tiles.includes(u.selectedTile)?u.selectedTile:void 0),hi=e=>!!u.selectedTile&&ve(u.selectedTile)===ve(e);let sl=0;function ge(e,t){u.toast={message:e,action:t},clearTimeout(sl),sl=window.setTimeout(()=>u.toast=null,t?8e3:5e3)}function Kc(){u.toast=null}async function ft(e,t,n="API key"){try{if(!navigator.clipboard||!window.isSecureContext)throw new Error;await navigator.clipboard.writeText(e),ge(`${n} copied.`)}catch{if(t){const s=document.createRange();s.selectNodeContents(t);const o=window.getSelection();o?.removeAllRanges(),o?.addRange(s)}ge(document.execCommand("copy")?`${n} copied.`:`${n} is selected. Copy with Ctrl+C or Command+C.`)}}function Fs(){const e="/config/integrations/dashboard";try{window.top.location.assign(e)}catch{window.open(e,"_blank")}}const qc=["","#settings","#new-screen","#firmware","#alerts","#override"],rt=$(()=>qc.includes(u.route)?u.route:"");function Oe(e){if(location.hash===e){u.route=e;return}location.hash=e}window.addEventListener("hashchange",()=>{u.route=location.hash,window.scrollTo(0,0)});function hs(e){return u.inventory.entities.find(t=>t.id===e)?.name||u.inventory.builtin?.find(t=>t.id===e)?.name||e}let bo={source:null,byName:{}};function vs(e){return bo.source!==u.inventory.icons&&(bo={source:u.inventory.icons,byName:Object.fromEntries((u.inventory.icons?.groups||[]).flatMap(t=>t.icons.map(n=>[n.name,n])))}),e?bo.byName[e]:void 0}function sn(e){const t=u.inventory.icons;if(!t)return"F0335";const n=u.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 Bn=e=>vs(e.options?.icon)?.cp||sn(e.entity),wo=new Set;async function so(e){const t=[...new Set(e)].filter(n=>!wo.has(n)&&!n.startsWith("screen."));if(t.length){t.forEach(n=>wo.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(u.capabilities,(await yt(`capabilities?${s}`)).capabilities||{})}}catch{t.forEach(n=>wo.delete(n))}}}const _o=new Set;async function Yc(e){if(!_o.has(e)){_o.add(e);try{u.entityActions[e]=(await yt(`entity-actions?entity=${encodeURIComponent(e)}`)).actions}catch{_o.delete(e)}}}let ko=!1;async function oo(){const e=[...new Set((u.layout?.tiles||[]).map(t=>t.entity).filter(t=>!t.startsWith("screen.")))];if(!(!e.length||ko)){ko=!0;try{for(let t=0;t<e.length;t+=60){const n=e.slice(t,t+60).map(s=>`entity=${encodeURIComponent(s)}`).join("&");Object.assign(u.liveStates,(await yt(`states?${n}`)).states||{})}}catch{}finally{ko=!1}}}function zc(e){const t=u.liveStates[e];if(t)return t;const n=u.inventory.entities.find(s=>s.id===e);return n?.state?{state:n.state,word:null,a:{}}:null}let Ho=0;function Ze(){u.dirty=!0,u.saved=0,Ho++}function Ra(e){if(e===u.selected&&u.layout&&u.dirty){He(),u.tab="layout",u.menuOpen=!1,Oe("");return}if(e!==u.selected&&u.dirty&&!confirm("You have unsaved changes. Open a different screen anyway?"))return;e!==u.selected&&(rs(),u.settingEdits={}),u.selected=e,u.selectedTile=null,u.inspector=null,u.tab="layout",u.menuOpen=!1;const t=u.inventory.screens.find(s=>s.id===e);if(!t){u.layout=null;return}const n=JSON.parse(JSON.stringify(t.layout));to(n),n.pages=gt(Ve(n),n.pages),u.layout=n,u.insertAt=-1,u.dirty=!1,u.saved=0,io(0),so(n.tiles.map(s=>s.entity)),oo(),Oe("")}function Jc(e){const t=u.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);to(t),t.pages=gt(Ve(t),t.pages);const s=t.tiles.map(o=>`${o.entity}@${o.slot}`).join()!==n;return s&&Ze(),s}function ms(e,t){if(!u.layout)return!1;so([e.entity]);const n=Ia(u.layout.tiles,e,t),s=n?Jc(n):!1;return s&&!u.liveStates[e.entity]&&oo(),s}function Ha(e){const t=u.layout;if(!t||!no(e)&&t.tiles.some(o=>o.entity===e)||t.tiles.length>=yn.value)return;const n=Ma(e),s=u.insertAt>=0?u.insertAt:Ds(Tn(Ve(t)),Je(n));u.insertAt=-1,s>=0&&ms(n,s)&&Uo(n)}function Ua(e){const t=u.layout;if(!t)return;const n=t.tiles.indexOf(e);n<0||(t.tiles.splice(n,1),hi(e)&&He(),Ze(),t.pages=gt(Ve(t),t.pages),ge(`${e.name||hs(e.entity)} removed`,{label:"Undo",run:()=>ms(e,e.slot)}))}function ol(){const e=u.layout;e&&(e.pages=Math.min(Bt,gt(Ve(e),e.pages)+1),Ze())}function Gc(e){const t=u.layout;if(t){for(const n of t.tiles)ht(n.slot)>e&&(n.slot-=Le);t.pages=Math.max(1,gt(Ve(t),t.pages)-1),Ze()}}function Xc(e,t){const n=u.layout;if(!n||!Number.isInteger(t)||t<0||t>=Bt||t===ht(e.slot))return!1;const s=Ds(Tn(Ve(n).filter(l=>l.tile!==e)),Je(e),t*Le),o=ms(e,s>=0&&ht(s)===t?s:t*Le);return o||ge(`There is no room for this tile on page ${t+1}.`),o}function Zc(){const e=u.layout;if(!e)return 1;const t=u.drag.preview||Ve(e),n=gt(t,e.pages);return u.drag.active&&n<Bt?n+1:n}function Kt(e,t,n){const s=e.entity.split(".")[0],o=u.capabilities[e.entity],l=No(e),a=Je(e);e.options={...e.options,[t]:n},t==="display"&&n==="watch"&&(e.options.inline="none",u.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",u.inventory.controls?.[s]&&(e.options.controls="none")),t==="controls"&&n!=="none"&&(e.options.display="standard",e.options.inline="none");const r=u.inventory.controls?.[s];t==="size"&&n==="wide"&&o&&r&&!("controls"in e.options)&&!o.controls.includes(r.default)&&(e.options.controls=r.choices.find(f=>f.key!=="none"&&o.controls.includes(f.key))?.key||"none"),Ze();const d=u.layout;if(d){if(Ta(e)&&a!=="full"){const f=ht(e.slot),c=d.tiles.filter(k=>k!==e&&ht(k.slot)===f),y=Tn(Ve(d).filter(k=>k.tile!==e&&!c.includes(k.tile))),b=[];for(const k of c){const I=Ds(y,Je(k),(f+1)*Le);if(I<0){b.length=0;break}b.push([k,I]);for(const E of mn(I,Je(k)))y.add(E)}if(b.length===c.length){for(const[k,I]of b)k.slot=I;e.slot=f*Le}else{const k=Ds(Tn(Ve(d).filter(I=>I.tile!==e)),"full");k>=0?e.slot=k:(e.options.size=a,ge("No page is free for a full-page tile. Free a page first."))}}else if(No(e)&&!l){const f=Tn(Ve(d).filter(b=>b.tile!==e)),c=Ea(e.slot),y=is(f,c,"wide")?c:Oa(f,"wide",c);y>=0&&(e.slot=y)}to(d),d.pages=gt(Ve(d),d.pages)}}function Qc(e,t){const n=`screen.page_${t}`,s=u.layout;return!s||n===e.entity||!ps(n)?!1:!no(n)&&s.tiles.some(o=>o.entity===n)?(ge(`This screen already has a tile that goes to page ${t}.`),!1):(e.entity=n,s.pages=Math.max(gt(Ve(s),s.pages),t),Ze(),!0)}function Uo(e){hi(e)||(u.iconPickerOpen=!1,u.actionPickerOpen=!1,u.actionSearch=""),u.selectedTile=e,u.inspector={kind:"tile"},so([e.entity])}function Lt(e){u.inspector?.kind==="bar"&&u.inspector.index===e||(u.iconPickerOpen=!1),u.selectedTile=null,u.inspector={kind:"bar",index:e}}function il(){u.selectedTile=null,u.inspector={kind:"bar-add"}}function He(){u.inspector=null,u.selectedTile=null}async function jo(){if(u.busy||!u.layout||!u.selected)return;u.busy=!0;const e=Ho,t=u.selected;try{const{settings:n,...s}=u.layout;await it(`screens/${encodeURIComponent(u.selected)}`,"PUT",s),u.selected!==t?ge(`Saved. ${u.inventory.screens.find(o=>o.id===t)?.name||"The screen"} is being updated.`):Ho===e?(u.dirty=!1,u.saved=Date.now(),ge("Saved. Your screen is being updated.")):ge("Saved. Your newest change isn't sent yet: press Save & send again."),await wn()}catch(n){ge(n.message)}finally{u.busy=!1}}const gn=e=>!!(e&&e.alert_action&&nn(ls(e),u.inventory.alerts?.min_firmware||"0.2.31"));async function ja(e){try{await it(`screens/${encodeURIComponent(e.id)}/identify`,"POST"),ge(`${e.name} blinks and shows a card for a few seconds.`)}catch(t){ge(t.message)}}async function ed(e,t){return await it("alerts/test","POST",{screen:e,data:t})}const td=["title","tiles","header","pages"];function Ba(e,t){const n=u.layout;if(!n)return;const s=(Array.isArray(e.tiles)?e.tiles:[]).filter(r=>!!(r&&typeof r=="object"&&typeof r.entity=="string"&&r.entity.includes("."))).map(r=>({entity:r.entity,name:typeof r.name=="string"?r.name:"",slot:Number.isInteger(r.slot)?r.slot:-1,...r.options&&typeof r.options=="object"?{options:{...r.options}}:{}})),o=new Set,l=s.filter(r=>no(r.entity)||!o.has(r.entity)&&o.add(r.entity)),a=l.slice(0,yn.value);n.tiles=a,e.header&&Array.isArray(e.header.items)?n.header={items:e.header.items.map(r=>({...r}))}:delete n.header,n.pages=Number.isInteger(e.pages)?e.pages:1,to(n),n.pages=gt(Ve(n),n.pages),He(),Ze(),so(a.map(r=>r.entity)),oo(),io(0),ge(a.length<l.length?`${t}: ${a.length} of ${l.length} tiles fit this screen's firmware. Save & send when it looks right.`:`${t}. Save & send when it looks right.`)}function nd(e){const t=u.inventory.screens.find(n=>n.id===e);!t||!u.layout||Ba(JSON.parse(JSON.stringify(t.layout)),`Layout of ${t.name} copied`)}function sd(){const e=u.layout;if(!e)return"";const t={esp_screens_layout:1};for(const n of td)e[n]!==void 0&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function Va(){const e=sd();if(!e)return;const t=`${(lt.value?.name||"screen").toLowerCase().replace(/[^a-z0-9]+/g,"-")}.layout.json`,n=URL.createObjectURL(new Blob([e],{type:"application/json"})),s=document.createElement("a");s.href=n,s.download=t,s.click(),setTimeout(()=>URL.revokeObjectURL(n),5e3),ft(e,void 0,"Layout JSON")}function od(e){let t;try{t=JSON.parse(e)}catch{ge("That isn't JSON. Export a layout first, or paste one from another ESP Screens.");return}if(!t||typeof t!="object"||!Array.isArray(t.tiles)){ge("No tiles in this file. Expected a layout exported from ESP Screens.");return}Ba(t,"Layout imported")}function ll(e){const t=u.inventory.updates?.target,n=u.inventory.changelog;if(!Array.isArray(n)||!t)return[];const s=ls(e),o=[];for(const l of n)if(!(nn(l.firmware,t)&&l.firmware!==t)&&!(s&&nn(s,l.firmware)))for(const a of l.lines)o.includes(a)||o.push(a);return o}let $o=!1;async function id(){if(!$o){$o=!0;try{const e=await yt("firmware");u.firmwareJob={job:e.job,logs:e.logs||[]}}catch{}finally{$o=!1}}}const Bo=()=>u.inventory.screens.some(e=>e.update?.state==="running")||u.updating.length>0;function xn(e){const t=e.update||{};if(!(t.state==="running"||u.updating.includes(e.id)))return null;const n=u.firmwareJob?.job?.stage;return t.phase==="verify"?{percent:78,text:Kn.verify}:t.phase==="settle"?{percent:92,text:Kn.settle}:t.phase==="install"||!t.phase?n==="upload"?{percent:66,text:"Writing the firmware over Wi-Fi…"}:n?{percent:40,text:"Building the firmware…"}:{percent:12,text:Kn.install}:{percent:12,text:Kn[t.phase]||"Starting update…"}}const Vt=()=>u.layout?.header?.items??(u.layout?.settings?.show_clock??!0?[{type:"clock"}]:[]),zt=()=>u.inventory.header?.max_items||6;function as(e){u.layout&&(u.layout.header={items:e},Ze(),io())}let al=0;function io(e=150){clearTimeout(al),al=window.setTimeout(async()=>{const t=Vt();if(t.some(n=>n.type==="entity"))try{const n=await it("header-preview","POST",{header:{items:t}});t.forEach((s,o)=>u.topbarPreviews[qe(s)]=n.items[o])}catch{}},e)}function Vn(e){return e.type==="entity"?hs(e.entity):u.inventory.header?.builtin.find(t=>t.type===e.type)?.label||e.type}function qt(e){const t=new Date(u.now);if(e.type==="clock")return{text:ui(On().clock_24h!==!1,t),shown:!0};if(e.type==="date")return{text:ci(t),shown:!0};if(e.type==="analog")return{analog:!0,shown:!0};const n=u.topbarPreviews[qe(e)];return n?{icon:n.i||null,text:n.k==="ago"?Cc(n.e,Math.floor(u.now/1e3)):n.t,color:n.c?`#${n.c}`:null,shown:n.shown}:{icon:e.icon==="none"?null:vs(e.icon)?.cp||sn(e.entity),text:"…",shown:!0,loading:!0}}function xo(e,t){const n=[...Vt()];return t<0||t>=n.length||e===t?!1:(n.splice(t,0,...n.splice(e,1)),as(n),!0)}function rl(e){const t=[...Vt()],[n]=t.splice(e,1);n&&(u.inspector?.kind==="bar"&&He(),as(t),ge(`${Vn(n)} removed from the top bar`,{label:"Undo",run:()=>{const s=[...Vt()];s.splice(Math.min(e,s.length),0,n),as(s)}}))}function So(e){const t=Vt();if(t.length>=zt())return ge(`The top bar has room for ${zt()} items.`);if(t.some(n=>qe(n)===qe(e)))return ge("This is already in the top bar.");u.topbarAdded={key:qe(e),time:Date.now()},as([...t,e]),Lt(t.length)}const ld=[{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°"]]}]}],Wa=4e3;let Jt={},An=null,Ns=0,Ts=null;const vi=()=>lt.value?.settings;function On(){const e=vi(),t={...e?.values||{}};for(const[n,s]of Object.entries(u.settingEdits))t[n]=s.value;return t}const ad=e=>e<300?30:e<900?60:e<3600?300:e<7200?900:1800;function ul(e,t,n,s,o){if(e.kind==="moment"){let r=s&&t%60?Math.floor(t/60)*60+(n>0?60:0):t+n*(s?60:15);return r%=1440,r<0?r+1440:r}const l=e.kind==="duration"?ad(n<0?t-1:t):e.step,a=e.cap?Math.min(e.max,o[e.cap]):e.max;return Math.min(a,Math.max(e.min,t+n*l))}function rd(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 ud(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 cd(e,t){const n=t[e.key];return n==null?"—":e.kind==="number"?`${n}${e.unit||""}`:e.kind==="duration"?rd(n):e.kind==="moment"?ud(n,t.clock_24h!==!1):""}function Wn(e,t,n){if(An&&An!==u.selected&&Object.keys(Jt).length){rs(),ge("Still saving the other screen's settings. Try again in a moment.");return}An=u.selected;const s=On();if(u.settingEdits[e]={value:t,at:Date.now()},Jt[e]=t,e==="brightness")for(const o of["standby_brightness","night_brightness"])s[o]>t&&(u.settingEdits[o]={value:t,at:Date.now()});u.settingPending=!0,clearTimeout(Ns),Ns=window.setTimeout(()=>rs(),n)}async function rs(e=!1){if(clearTimeout(Ns),Ts||!Object.keys(Jt).length||!An)return;const t=An,n=Jt;Jt={};const s=di(`screens/${encodeURIComponent(t)}/settings`,{method:"PUT",body:JSON.stringify({settings:n}),keepalive:e});Ts=s;try{const o=await(await s).json(),l=u.inventory.screens.find(a=>a.id===t);l&&(l.settings=o)}catch(o){if(ge(o.message),t===u.selected)for(const l of Object.keys(n))delete u.settingEdits[l];if(t===u.selected&&n.brightness!==void 0)for(const l of["standby_brightness","night_brightness"])delete u.settingEdits[l]}finally{Ts=null,Object.keys(Jt).length?Ns=window.setTimeout(()=>rs(),150):An=null,u.settingPending=!!Object.keys(Jt).length,t===u.selected&&Rs(),setTimeout(()=>{t===u.selected&&Rs()},Wa+100)}}function Rs(){const e=vi();for(const[t,n]of Object.entries(u.settingEdits))Jt[t]!==void 0||Ts||(e&&e.values[t]===n.value||Date.now()-n.at>Wa)&&delete u.settingEdits[t]}const Kn={install:"Building and installing…",verify:"Waiting for the screen to come back…",settle:"Checking that it stays stable…"};async function Vo(e,t){u.updating.push(e.id);try{await it(`screens/${encodeURIComponent(e.id)}/update`,"POST",t?{host:t}:{}),await wn()}catch(n){u.updating=u.updating.filter(s=>s!==e.id),ge(n.message)}}async function cl(){try{await it("updates/run","POST"),await wn()}catch(e){ge(e.message)}}async function dd(e){try{await it("updates","PUT",{auto:e}),u.inventory.updates&&(u.inventory.updates.auto=e),ge(e?"Screens will now update automatically at night.":"Automatic updates are off.")}catch(t){ge(t.message)}}async function fd(){try{u.inventory.claude_skill=await it("claude-skill","POST"),ge(u.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){ge(e.message)}}async function wn(e=!0){try{const t=await yt(e?"inventory":"inventory?light=1");u.inventory=e?t:{...u.inventory,...t},t.csrf&&Mc(t.csrf),u.connected=!!u.inventory.connected,u.reachable=!0;for(const n of u.inventory.screens)n.update?.state==="running"&&(u.updating=u.updating.filter(s=>s!==n.id));u.selected&&Rs()}catch{u.reachable=!1}}function pd(e){u.inventory={...u.inventory,...e},u.connected=!!u.inventory.connected;for(const t of u.inventory.screens)t.update?.state==="running"&&(u.updating=u.updating.filter(n=>n!==t.id));u.selected&&Rs()}let dl=0,Wo=Date.now(),Hs=!1,Hn=null;function hd(){Hn||typeof EventSource>"u"||(Hn=new EventSource("api/events"),Hn.onopen=()=>{Hs=!0,us()},Hn.onmessage=e=>{document.hidden||pd(JSON.parse(e.data))},Hn.onerror=()=>{Hs=!1,us()})}function us(){clearTimeout(dl);const e=Hs?6e4:u.inventory.updates?.busy?3e3:1e4;dl=window.setTimeout(async()=>{if(!document.hidden){const t=Date.now()-Wo>=3e5;t&&(Wo=Date.now()),(t||!Hs)&&await wn(t)}us()},e)}let fl=!1;function vd(){fl||(fl=!0,wn(),hd(),us(),Ic(()=>u.fontsVersion++),setInterval(()=>{!u.layout||document.hidden||u.drag.active||(u.now=Date.now(),io(0))},3e4),setInterval(()=>{!document.hidden&&u.layout&&u.tab==="layout"&&rt.value===""&&oo()},8e3),setInterval(()=>{!document.hidden&&Bo()?id():u.firmwareJob&&!Bo()&&(u.firmwareJob=null)},3e3),document.addEventListener("visibilitychange",async()=>{document.hidden||(Wo=Date.now(),u.now=Date.now(),await wn(),us())}),window.addEventListener("pagehide",()=>rs(!0)),window.addEventListener("beforeunload",e=>{u.dirty&&(e.preventDefault(),e.returnValue="")}))}const md={class:"side"},yd={id:"screens"},gd=["aria-current","onClick"],bd={class:"txt"},wd={key:0,class:"unsaved",role:"img","aria-label":"Unsaved changes",title:"Unsaved changes"},_d={key:1,class:"pill"},kd={key:2,class:"spin small"},$d=["onSubmit"],xd=["disabled","title","onClick"],Sd={key:2,class:"whatsnew"},Cd=["aria-valuenow"],Td={class:"progress-text"},Ad=["title"],Ed=["title"],Pd={id:"pending"},Od={class:"pending-actions"},Id=["onClick"],Md=["aria-current"],Ld={class:"more"},Dd=["aria-current"],Fd={class:"mdi"},Nd=["aria-current"],Rd={class:"mdi"},Hd=["aria-current"],Ud={class:"mdi"},jd=Ee({__name:"Sidebar",setup(e){const t=pe(null),n=pe("");function s(d){const f=d.update||{};return f.state==="running"||u.updating.includes(d.id)?{kind:"running",text:Kn[f.phase||""]||"Starting update…"}:f.state==="queued"?{kind:"queued",text:"Queued for the update"}:f.available&&d.online?{kind:"available",text:`Update ${f.target}`}:f.result&&Date.now()/1e3-f.result.time<86400?{kind:f.result.state==="failed"?"failed":"done",text:f.result.message}:null}function o(d){const f=d.update||{};f.host&&f.profile?Vo(d):f.profile&&(t.value=d.id,n.value="")}function l(d){const f=n.value.trim();f&&(t.value=null,Vo(d,f))}const a=()=>{const d=u.firmwareJob?.logs||[];return d.length?d[d.length-1]:""},r=d=>d.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.":d.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 → ${d.file}.`;return(d,f)=>(p(),h("aside",md,[f[20]||(f[20]=i("div",{class:"brand"},[i("span",{class:"mark"},"▦"),i("span",null,"ESP Screens")],-1)),i("span",{id:"connection",class:ie(["conn",{online:m(u).connected}]),role:"status"},v(m(u).reachable?m(u).connected?"Home Assistant connected":"Reconnecting to Home Assistant…":"Management page unreachable · retrying…"),3),i("button",{type:"button",class:"search-btn",id:"open-palette",onClick:f[0]||(f[0]=c=>m(u).palette=!0)},[...f[10]||(f[10]=[Z("⌕ Search",-1),i("kbd",null,"⌘K",-1)])]),f[21]||(f[21]=i("div",{class:"label"},"Screens",-1)),i("div",yd,[(p(!0),h(U,null,le(m(u).inventory.screens,c=>(p(),h("div",{key:c.id,class:ie(["screen-item",{selected:c.id===m(u).selected&&m(rt)===""}])},[i("button",{type:"button",class:"nav-item","aria-current":c.id===m(u).selected&&m(rt)===""?"true":"false",onClick:y=>m(Ra)(c.id)},[i("span",{class:ie(["dot",{off:!c.online}])},null,2),i("span",bd,[i("span",null,v(c.name),1),i("small",null,v(c.online?"Online":"Offline")+v(c.area?" · "+c.area:"")+" · "+v(c.firmware||"unknown"),1)]),c.id===m(u).selected&&m(u).dirty?(p(),h("span",wd)):R("",!0),s(c)?.kind==="available"?(p(),h("span",_d,"Update")):s(c)?.kind==="running"?(p(),h("span",kd)):R("",!0)],8,gd),s(c)?(p(),h("div",{key:0,class:ie(["screen-update",s(c).kind])},[s(c).kind==="available"?(p(),h(U,{key:0},[t.value===c.id?(p(),h(U,{key:0},[f[12]||(f[12]=i("small",null,"The IP address, once; new firmware reports it itself.",-1)),i("form",{class:"screen-host",onSubmit:dt(y=>l(c),["prevent"])},[we(i("input",{"onUpdate:modelValue":f[1]||(f[1]=y=>n.value=y),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),[[Fe,n.value]]),f[11]||(f[11]=i("button",{type:"submit",class:"btn mini primary"},"Start",-1)),i("button",{type:"button",class:"icon-btn","aria-label":"Cancel",onClick:f[2]||(f[2]=y=>t.value=null)},"✕")],40,$d)],64)):(p(),h(U,{key:1},[i("small",null,v(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:y=>o(c)},"Update",8,xd)],64)),m(ll)(c).length?(p(),h("details",Sd,[f[13]||(f[13]=i("summary",null,"What's new",-1)),i("ul",null,[(p(!0),h(U,null,le(m(ll)(c).slice(0,8),y=>(p(),h("li",{key:y},v(y),1))),128))])])):R("",!0)],64)):s(c).kind==="running"&&m(xn)(c)?(p(),h(U,{key:1},[i("div",{class:"progress",role:"progressbar","aria-valuenow":m(xn)(c).percent,"aria-valuemin":"0","aria-valuemax":"100"},[i("i",{style:Pe({width:m(xn)(c).percent+"%"})},null,4)],8,Cd),i("div",Td,[i("span",null,v(m(xn)(c).percent)+" %",1),i("span",{title:a()},v(m(xn)(c).text),9,Ad)]),a()?(p(),h("small",{key:0,title:a(),style:{"white-space":"nowrap",overflow:"hidden","text-overflow":"ellipsis"}},v(a()),9,Ed)):R("",!0),i("button",{type:"button",class:"btn link mini",style:{"justify-self":"start"},onClick:f[3]||(f[3]=y=>m(Oe)("#firmware"))},"Full log")],64)):(p(),h("small",{key:2,class:ie({failed:s(c).kind==="failed"})},v(s(c).text),3))],2)):R("",!0)],2))),128))]),i("div",Pd,[(p(!0),h(U,null,le(m(u).inventory.pending||[],c=>(p(),h("div",{key:c.file,class:"pending"},[i("strong",null,v(c.friendly),1),i("small",null,v(r(c)),1),i("div",Od,[i("button",{type:"button",class:"btn mini quiet",onClick:f[4]||(f[4]=(...y)=>m(Fs)&&m(Fs)(...y))},"Open Devices & services"),c.api_key?(p(),h("button",{key:0,type:"button",class:"btn mini quiet",onClick:y=>m(ft)(c.api_key)},"Copy API key",8,Id)):R("",!0)])]))),128))]),i("button",{id:"new-screen",type:"button",class:"nav-item ghost","aria-current":m(rt)==="#new-screen"?"true":"false",onClick:f[5]||(f[5]=c=>m(Oe)("#new-screen"))},[...f[14]||(f[14]=[i("span",{class:"plus"},"+",-1),i("span",{class:"txt"},"New screen",-1)])],8,Md),f[22]||(f[22]=i("div",{class:"spacer"},null,-1)),i("div",Ld,[f[19]||(f[19]=i("div",{class:"label"},"More",-1)),i("button",{id:"open-firmware",type:"button",class:"nav-item","aria-current":m(rt)==="#firmware"?"true":"false",onClick:f[6]||(f[6]=c=>m(Oe)("#firmware"))},[i("span",Fd,v(m(ke)("F0241")),1),f[15]||(f[15]=i("span",{class:"txt"},"Firmware & USB",-1))],8,Dd),i("button",{id:"open-alerts",type:"button",class:"nav-item","aria-current":m(rt)==="#alerts"?"true":"false",onClick:f[7]||(f[7]=c=>m(Oe)("#alerts"))},[i("span",Rd,v(m(ke)("F0594")),1),f[16]||(f[16]=i("span",{class:"txt"},"Alerts",-1))],8,Nd),i("button",{id:"open-settings",type:"button",class:"nav-item","aria-current":m(rt)==="#settings"?"true":"false",onClick:f[8]||(f[8]=c=>m(Oe)("#settings"))},[i("span",Ud,v(m(ke)("F0493")),1),f[17]||(f[17]=i("span",{class:"txt"},"Settings",-1))],8,Hd),i("button",{id:"refresh",type:"button",class:"nav-item ghost",onClick:f[9]||(f[9]=c=>m(wn)())},[...f[18]||(f[18]=[i("span",{class:"plus"},"↻",-1),i("span",{class:"txt"},"Refresh",-1)])])])]))}}),Bd={key:0,id:"toast",class:"toast",role:"status"},Vd=Ee({__name:"Toast",setup(e){return(t,n)=>m(u).toast?(p(),h("div",Bd,[i("span",null,v(m(u).toast.message),1),m(u).toast.action?(p(),h("button",{key:0,type:"button",onClick:n[0]||(n[0]=s=>{m(u).toast.action.run(),m(Kc)()})},v(m(u).toast.action.label),1)):R("",!0)])):R("",!0)}}),Wd={class:"palette-list"},Kd={class:"palette-group"},qd=["onMouseenter","onClick"],Yd={key:0,class:"mdi"},zd={key:1,class:"glyph"},Jd={class:"tx"},Gd={key:0},Xd={key:2,class:"hint-key"},Zd={key:0,class:"palette-empty"},Qd=Ee({__name:"CommandPalette",setup(e){const t=pe(""),n=pe(0),s=pe(null),o=$(()=>{const f=t.value.trim().toLocaleLowerCase(),c=[];for(const k of u.inventory.screens)c.push({group:"Screens",label:k.name,detail:`${k.online?"Online":"Offline"} · ${k.firmware||"unknown"}`,glyphText:"▦",run:()=>Ra(k.id)});const y=lt.value,b=[{group:"Actions",label:"New screen",detail:"Connect and install",glyphText:"+",run:()=>Oe("#new-screen")},{group:"Actions",label:"Firmware & USB",icon:"F0241",run:()=>Oe("#firmware")},{group:"Actions",label:"Alerts",detail:"Cheatsheet and a test alert",icon:"F0594",run:()=>Oe("#alerts")},{group:"Actions",label:"Settings",detail:"Updates, Claude",icon:"F0493",run:()=>Oe("#settings")}];if(y&&u.layout&&b.unshift({group:"Actions",label:"Save & send",detail:u.dirty?"Unsaved changes":"Nothing to save",key:"⌘S",run:()=>jo()},{group:"Actions",label:"Layout",detail:y.name,run:()=>{Oe(""),u.tab="layout"}},{group:"Actions",label:"Screen settings",detail:y.name,run:()=>{Oe(""),u.tab="settings"}},{group:"Actions",label:"Identify this screen",detail:gn(y)?"Blinks the backlight and shows a card":"Needs a newer firmware",run:()=>{gn(y)&&ja(y)}},{group:"Actions",label:"Export layout",detail:"Download and copy as JSON",run:Va}),c.push(...b),y&&u.layout&&f){const k=new Set(u.layout.tiles.map(E=>E.entity)),I=u.layout.tiles.length>=yn.value;for(const E of u.inventory.entities)if(!(E.tile===!1||k.has(E.id))&&`${E.name} ${E.id} ${E.area||""} ${E.device||""}`.toLocaleLowerCase().includes(f)&&(c.push({group:"Add to this screen",label:E.name,detail:[xt(E.id)[0],E.area].filter(Boolean).join(" · "),icon:u.inventory.icons?sn(E.id):void 0,run:()=>{I||Ha(E.id)}}),c.length>60))break}return f?c.filter(k=>`${k.label} ${k.detail||""}`.toLocaleLowerCase().includes(f)):c}),l=$(()=>{const f=[];return o.value.forEach((c,y)=>{(f.find(k=>k.group===c.group)||(f.push({group:c.group,items:[]}),f[f.length-1])).items.push({item:c,index:y})}),f});function a(){u.palette=!1}function r(f){a(),f.run()}function d(f){if(f.key==="Escape")f.preventDefault(),a();else if(f.key==="ArrowDown")f.preventDefault(),n.value=Math.min(o.value.length-1,n.value+1);else if(f.key==="ArrowUp")f.preventDefault(),n.value=Math.max(0,n.value-1);else if(f.key==="Enter"){f.preventDefault();const c=o.value[n.value];c&&r(c)}}return pn(t,()=>n.value=0),pn(()=>u.palette,async f=>{f&&(t.value="",n.value=0,await Js(),s.value?.focus())}),(f,c)=>m(u).palette?(p(),h("div",{key:0,class:"palette-backdrop",onClick:a},[i("div",{class:"palette",role:"dialog","aria-label":"Search",onClick:c[1]||(c[1]=dt(()=>{},["stop"])),onKeydown:d},[we(i("input",{ref_key:"input",ref:s,"onUpdate:modelValue":c[0]||(c[0]=y=>t.value=y),id:"palette-input",placeholder:"Search screens, entities, actions…","aria-label":"Search",autocomplete:"off"},null,512),[[Fe,t.value]]),i("div",Wd,[(p(!0),h(U,null,le(l.value,y=>(p(),h(U,{key:y.group},[i("div",Kd,v(y.group),1),(p(!0),h(U,null,le(y.items,({item:b,index:k})=>(p(),h("button",{key:k,type:"button",class:ie(["palette-item",{active:k===n.value}]),onMouseenter:I=>n.value=k,onClick:I=>r(b)},[b.icon?(p(),h("span",Yd,v(m(ke)(b.icon)),1)):(p(),h("span",zd,v(b.glyphText||"›"),1)),i("span",Jd,[i("span",null,v(b.label),1),b.detail?(p(),h("small",Gd,v(b.detail),1)):R("",!0)]),b.key?(p(),h("kbd",Xd,v(b.key),1)):R("",!0)],42,qd))),128))],64))),128)),o.value.length?R("",!0):(p(),h("p",Zd,"Nothing matches. Type part of a screen, entity or action."))])],32)])):R("",!0)}}),re={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},Ka={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(re,{source:o,element:e,start:{x:s.clientX,y:s.clientY},pointerId:s.pointerId});try{e.setPointerCapture(s.pointerId)}catch{}clearTimeout(re.timer),s.pointerType==="touch"&&(re.timer=window.setTimeout(()=>pl(s),260))}}),e.addEventListener("pointermove",s=>{if(u.drag.active||!re.start||re.element!==e)return;const o=Math.hypot(s.clientX-re.start.x,s.clientY-re.start.y);if(s.pointerType==="touch"){o>10&&(clearTimeout(re.timer),re.start=null);return}o>=6&&pl(s)});const n=()=>{re.element===e&&!u.drag.active&&(clearTimeout(re.timer),re.start=null)};e.addEventListener("pointerup",n),e.addEventListener("pointercancel",n)},updated(e,t){e.__dragSource=t.value}};function pl(e){if(u.drag.active||!re.start||!re.source||!re.element)return;u.drag.active=!0,u.drag.moving=re.source.kind==="tile"?re.source.tile:Ma(re.source.id),u.drag.preview=null,re.target=null,getSelection()?.removeAllRanges();const t=re.element.getBoundingClientRect(),n=re.element.cloneNode(!0);n.classList.add("drag-ghost"),n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,re.offset={x:e.clientX-t.left,y:e.clientY-t.top},document.body.append(n),re.ghost=n,document.addEventListener("pointermove",Ko),document.addEventListener("pointerup",Us),document.addEventListener("pointercancel",Us);try{re.element.releasePointerCapture(re.pointerId)}catch{}try{document.documentElement.setPointerCapture(re.pointerId)}catch{}document.addEventListener("touchmove",qa,{passive:!1}),re.scroller=window.setInterval(()=>{if(!re.last)return;const{x:s,y:o}=ef(document),l=s?ml(re.last.x,vl(s,"x")):0,a=o?ml(re.last.y,vl(o,"y")):0;l&&s.scrollBy(l,0),a&&o.scrollBy(0,a),(l||a)&&qo(Ya(re.last.x,re.last.y))},16),qo(-1),Ko(e)}function hl(e,t){if(!e)return!1;const n=t==="x"?e.scrollWidth>e.clientWidth:e.scrollHeight>e.clientHeight,s=getComputedStyle(e)[t==="x"?"overflowX":"overflowY"];return n&&(s==="auto"||s==="scroll")}function ef(e){const t=e.querySelector(".pages"),n=e.querySelector(".canvas");return{x:hl(t,"x")?t:n,y:hl(n,"y")?n:e.scrollingElement}}function vl(e,t){const n=t==="x"?window.innerWidth:window.innerHeight;if(e===e.ownerDocument.scrollingElement)return[0,n];const s=e.getBoundingClientRect();return t==="x"?[Math.max(s.left,0),Math.min(s.right,n)]:[Math.max(s.top,0),Math.min(s.bottom,n)]}function ml(e,[t,n]){return e<t+60?-12:e>n-60?12:0}function qa(e){u.drag.active&&e.preventDefault()}function Us(e){e.pointerId===re.pointerId&&tf(e.type==="pointerup")}function Ko(e){!re.ghost||e.pointerId!==re.pointerId||(re.last={x:e.clientX,y:e.clientY},re.ghost.style.transform=`translate(${e.clientX-re.offset.x}px, ${e.clientY-re.offset.y}px)`,qo(Ya(e.clientX,e.clientY)))}function Ya(e,t){let n=null,s=1/0;for(const l of document.querySelectorAll(".pages [data-slot]")){const a=l.getBoundingClientRect(),r=Math.hypot(Math.max(a.left-e,0,e-a.right),Math.max(a.top-t,0,t-a.bottom));r<s&&(s=r,n={cell:l,r:a})}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 qo(e){re.target===e||!u.layout||!u.drag.moving||(re.target=e,u.drag.preview=e>=0?Ia(u.layout.tiles,u.drag.moving,e):null)}function tf(e){const t=u.drag.preview,n=u.drag.moving;document.removeEventListener("pointermove",Ko),document.removeEventListener("pointerup",Us),document.removeEventListener("pointercancel",Us),document.removeEventListener("touchmove",qa);try{document.documentElement.releasePointerCapture(re.pointerId)}catch{}if(re.ghost?.remove(),Object.assign(re,{ghost:null,suppressUntil:Date.now()+400,last:null,start:null,target:null,element:null,source:null}),clearInterval(re.scroller),u.drag.active=!1,u.drag.preview=null,u.drag.moving=null,e&&t&&n&&u.layout){const s=u.layout.tiles.map(l=>`${l.entity}@${l.slot}`).join(),o=!u.layout.tiles.includes(n);for(const{tile:l,slot:a}of t)l.slot=a,u.layout.tiles.includes(l)||u.layout.tiles.push(l);u.layout.tiles.sort((l,a)=>l.slot-a.slot),u.layout.tiles.map(l=>`${l.entity}@${l.slot}`).join()!==s&&Ze(),o&&ms(n,n.slot)}}window.addEventListener("click",e=>{Date.now()<re.suppressUntil&&(e.stopPropagation(),e.preventDefault())},!0);const nf=["data-slot","tabindex","role","aria-label"],sf={class:"clockface",viewBox:"0 0 60 60","aria-hidden":"true"},of=["transform"],lf=["transform"],af=["transform"],rf={key:0,class:"lead"},uf={class:"tx"},cf={class:"nm"},df={class:"st"},ff={class:"ic mdi"},pf={class:"lead"},hf={class:"big"},vf={class:"nm"},mf={class:"lead"},yf={class:"nm"},gf={key:0,class:"goto"},bf={key:1,class:"big"},wf={key:0},_f={key:1,class:"ctl"},kf={key:1,class:"stp"},$f={class:"mdi"},xf={class:"mdi"},Sf={class:"key mdi"},Cf={class:"key mdi"},Tf={class:"key mdi"},Af={class:"key mdi"},Ef={class:"key mdi"},Pf={class:"key mdi"},Of={class:"key mdi"},If={key:5,class:"run"},Mf={class:"lead"},Lf={class:"tx"},Df={class:"nm"},Ff={key:0,class:"goto"},Nf={key:1,class:"big"},Rf={key:0},Hf={key:1,class:"ctl"},Uf={key:1,class:"stp"},jf={class:"mdi"},Bf={class:"mdi"},Vf={class:"key mdi"},Wf={class:"key mdi"},Kf={key:3,class:"stp"},qf={class:"mdi"},Yf={class:"mdi"},zf={class:"key mdi"},Jf={class:"key mdi"},Gf={class:"key mdi"},Xf={class:"key mdi"},Zf={class:"key mdi"},Qf={class:"key mdi"},ep={class:"key mdi"},tp={class:"key mdi"},np={class:"key mdi"},sp={class:"key mdi"},op={class:"key mdi"},ip={class:"key mdi"},lp={class:"key mdi"},ap={class:"key mdi"},rp={class:"key mdi"},up={key:10,class:"run"},cp={class:"tx"},dp={class:"nm"},fp={key:0,class:"goto"},pp={key:0,class:"big"},hp={key:0},vp=["aria-label"],mp=Ee({__name:"TileCard",props:{tile:{},slot:{},placeholder:{type:Boolean}},setup(e){const t=e,n=$(()=>t.tile.name||hs(t.tile.entity)),s=$(()=>Ta(t.tile)),o=$(()=>No(t.tile)&&!s.value),l=$(()=>ps(t.tile.entity)),a=$(()=>u.inventory.backgrounds?.[t.tile.options?.background||""]?.color),r=$(()=>t.tile.options?.background==="none"),d=$(()=>t.tile.options?.display||"standard"),f=$(()=>d.value!=="standard"?Da[d.value]||d.value:""),c=$(()=>La(t.tile,u.inventory)),y=$(()=>t.tile.entity.split(".")[0]),b=$(()=>u.inventory.icons?.controls||{}),k=Q=>b.value[Q]?ke(b.value[Q]):"",I=$(()=>hi(t.tile)&&u.inspector?.kind==="tile"),E=$(()=>!t.placeholder&&u.layout?.tiles.includes(t.tile)),x=$(()=>`${n.value}, slot ${t.slot%Le+1} on page ${ht(t.slot)+1}. Enter: configure, arrow keys: move`),S=$(()=>new Date(u.now)),M=$(()=>(S.value.getHours()%12+S.value.getMinutes()/60)*30),G=$(()=>S.value.getMinutes()*6),C=$(()=>y.value==="screen"?null:zc(t.tile.entity)),V=$(()=>!C.value||["unavailable","unknown",""].includes(C.value.state)),O=$(()=>!!C.value&&!V.value&&C.value.state!=="off"&&C.value.state!=="closed"&&C.value.state!=="standby"&&C.value.state!=="idle"&&C.value.state!=="docked"),A=$(()=>["light","switch","input_boolean","fan"].includes(y.value)&&C.value?.state==="on"),w=$(()=>C.value?.a?.unit_of_measurement),T=Q=>Q.charAt(0).toUpperCase()+Q.slice(1).replace(/_/g," "),te={"clear-night":"Clear, night",cloudy:"Cloudy",exceptional:"Exceptional",fog:"Fog",hail:"Hail",lightning:"Lightning","lightning-rainy":"Lightning, rainy",partlycloudy:"Partly cloudy",pouring:"Pouring",rainy:"Rainy",snowy:"Snowy","snowy-rainy":"Snowy, rainy",sunny:"Sunny",windy:"Windy","windy-variant":"Windy"},$e=["scene","script","button","input_button"],Me=$(()=>{const Q=C.value;if(!Q||$e.includes(y.value))return f.value;if(V.value)return Q.state==="unknown"?"Unknown":"Unavailable";const K=Q.a||{};return y.value==="climate"?`${K.current_temperature!==void 0?`${K.current_temperature}° · `:""}${Q.word||T(Q.state)}`:y.value==="weather"?`${Q.word||te[Q.state]||T(Q.state)}${K.temperature!==void 0?` · ${K.temperature}°`:""}`:y.value==="cover"&&K.current_position!==void 0&&K.current_position>0&&K.current_position<100?`${Q.word||T(Q.state)} · ${K.current_position} %`:y.value==="media_player"&&K.media_title?`${Q.word||T(Q.state)} · ${K.media_title}`:y.value==="sensor"?`${Q.state}${w.value?` ${w.value}`:""}`:(y.value==="timer",Q.word||T(Q.state))}),X=$(()=>C.value&&!V.value?C.value.state:"—"),j=$(()=>{const Q=C.value;if(!Q||V.value)return 0;const K=Q.a||{};if(y.value==="light")return Q.state==="on"?K.brightness!==void 0?Math.round(K.brightness/255*100):100:0;if(y.value==="fan")return Q.state==="on"?K.percentage??100:0;if(y.value==="cover")return K.current_position??(Q.state==="open"?100:0);if(y.value==="media_player")return Math.round((K.volume_level??0)*100);if(y.value==="number"||y.value==="input_number"){const B=Number(Q.state),ne=Number(K.min??0),Qe=Number(K.max??100);return Number.isFinite(B)&&Qe>ne?Math.round((B-ne)/(Qe-ne)*100):0}return 0}),z=$(()=>({background:`linear-gradient(to right, ${j.value?"#ffbf38":"#c9ccd1"} ${j.value}%, ${j.value?"#fff1d3":"#e6e8ec"} ${j.value}%)`})),ce=$(()=>({background:`linear-gradient(to right, #2196f3 ${j.value}%, #d3e8fb ${j.value}%)`})),de=$(()=>{const Q=C.value?.a?.temperature;return Q!=null?`${Q}°`:"—"});async function he(Q){if(Q.key==="Enter"||Q.key===" "){Q.preventDefault(),Uo(t.tile);return}const K={ArrowLeft:-1,ArrowRight:1,ArrowUp:-2,ArrowDown:2}[Q.key];K&&(Q.preventDefault(),ms(t.tile,t.tile.slot+(s.value?Math.sign(K)*Le:o.value?Math.sign(K)*2:K))&&(await Js(),document.querySelector(`.pages [data-slot="${t.tile.slot}"]`)?.focus()))}return(Q,K)=>we((p(),h("div",{class:ie(["tile",{wide:o.value,full:s.value,bare:r.value,placeholder:e.placeholder||!E.value,chosen:I.value}]),"data-slot":e.slot,style:Pe(a.value&&!r.value?{backgroundColor:a.value}:void 0),tabindex:E.value?0:-1,role:E.value?"button":void 0,"aria-label":E.value?x.value:void 0,onClick:K[1]||(K[1]=B=>E.value&&m(Uo)(e.tile)),onKeydown:K[2]||(K[2]=B=>E.value&&he(B))},[d.value==="analog"?(p(),h(U,{key:0},[(p(),h("svg",sf,[K[3]||(K[3]=i("circle",{cx:"30",cy:"30",r:"27",fill:"#fff",stroke:"#c9ccd1"},null,-1)),(p(),h(U,null,le([0,90,180,270],B=>i("line",{key:B,x1:"30",y1:"5",x2:"30",y2:"9",stroke:"#1b1b1b","stroke-width":"1.5",transform:`rotate(${B} 30 30)`},null,8,of)),64)),i("line",{x1:"30",y1:"30",x2:"30",y2:"16",stroke:"#1b1b1b","stroke-width":"2.4","stroke-linecap":"round",transform:`rotate(${M.value} 30 30)`},null,8,lf),i("line",{x1:"30",y1:"30",x2:"30",y2:"11",stroke:"#1b1b1b","stroke-width":"1.6","stroke-linecap":"round",transform:`rotate(${G.value} 30 30)`},null,8,af),K[4]||(K[4]=i("circle",{cx:"30",cy:"30",r:"1.8",fill:"#1b1b1b"},null,-1))])),o.value?(p(),h("span",rf,[i("span",uf,[i("span",cf,v(n.value),1),i("span",df,v(f.value),1)])])):R("",!0)],64)):d.value==="digital"&&y.value==="screen"?(p(),h(U,{key:1},[i("span",ff,v(m(ke)(m(Bn)(e.tile))),1),i("span",pf,[i("span",hf,v(String(S.value.getHours()).padStart(2,"0"))+":"+v(String(S.value.getMinutes()).padStart(2,"0")),1),i("span",vf,v(n.value),1)])],64)):s.value?(p(),h(U,{key:2},[i("span",{class:ie(["ic mdi",{lit:A.value}])},v(m(ke)(m(Bn)(e.tile))),3),i("span",mf,[i("span",yf,v(n.value),1),l.value?(p(),h("span",gf,"Page "+v(l.value)+" ›",1)):d.value==="watch"?(p(),h("span",bf,[Z(v(X.value),1),w.value&&!V.value?(p(),h("small",wf,v(w.value),1)):R("",!0)])):Me.value?(p(),h("span",{key:2,class:ie(["st",{off:V.value}])},v(Me.value),3)):R("",!0)]),e.tile.options?.inline==="slider"?(p(),h("span",{key:0,class:"mini-slider",style:Pe(z.value)},null,4)):R("",!0),c.value?(p(),h("span",_f,[c.value==="toggle"?(p(),h("span",{key:0,class:ie(["tog",{off:!O.value}])},null,2)):c.value==="setpoint"?(p(),h("span",kf,[i("span",$f,v(k("minus")||"−"),1),i("b",null,v(de.value),1),i("span",xf,v(k("plus")||"+"),1)])):c.value==="volume"?(p(),h(U,{key:2},[i("span",{class:"range",style:Pe(ce.value)},null,4),i("span",Sf,v(k("volume-high")),1)],64)):c.value==="playback"?(p(),h(U,{key:3},[i("span",Cf,v(k("skip-previous")),1),i("span",Tf,v(k(O.value?"pause":"play")||k("play")),1),i("span",Af,v(k("skip-next")),1)],64)):c.value==="buttons"&&y.value==="cover"?(p(),h(U,{key:4},[i("span",Ef,v(k("arrow-expand-horizontal")),1),i("span",Pf,v(k("stop")),1),i("span",Of,v(k("arrow-collapse-horizontal")),1)],64)):c.value==="run"?(p(),h("span",If,v({scene:"Activate",script:"Run"}[y.value]||"Press"),1)):(p(),h("span",{key:6,class:"range",style:Pe({background:`linear-gradient(to right, #2196f3 ${j.value}%, #d3e8fb ${j.value}%)`})},null,4))])):R("",!0)],64)):o.value?(p(),h(U,{key:3},[i("span",Mf,[i("span",{class:ie(["ic mdi",{lit:A.value}])},v(m(ke)(m(Bn)(e.tile))),3),i("span",Lf,[i("span",Df,v(n.value),1),l.value?(p(),h("span",Ff,"Page "+v(l.value)+" ›",1)):d.value==="watch"?(p(),h("span",Nf,[Z(v(X.value),1),w.value&&!V.value?(p(),h("small",Rf,v(w.value),1)):R("",!0)])):Me.value?(p(),h("span",{key:2,class:ie(["st",{off:V.value}])},v(Me.value),3)):R("",!0)])]),e.tile.options?.inline==="slider"?(p(),h("span",{key:0,class:"mini-slider",style:Pe(z.value)},null,4)):R("",!0),c.value?(p(),h("span",Hf,[c.value==="toggle"?(p(),h("span",{key:0,class:ie(["tog",{off:!O.value}])},null,2)):c.value==="setpoint"?(p(),h("span",Uf,[i("span",jf,v(k("minus")||"−"),1),i("b",null,v(de.value),1),i("span",Bf,v(k("plus")||"+"),1)])):c.value==="stepper"&&y.value.endsWith("select")?(p(),h(U,{key:2},[i("span",Vf,v(k("chevron-left")),1),i("span",Wf,v(k("chevron-right")),1)],64)):c.value==="stepper"?(p(),h("span",Kf,[i("span",qf,v(k("minus")||"−"),1),i("b",null,v(X.value),1),i("span",Yf,v(k("plus")||"+"),1)])):c.value==="mode"?(p(),h(U,{key:4},[i("span",zf,v(k("power")),1),i("span",Jf,v(k("fire")),1),i("span",Gf,v(k("snowflake")),1)],64)):c.value==="volume"?(p(),h(U,{key:5},[i("span",{class:"range",style:Pe(ce.value)},null,4),i("span",Xf,v(k("volume-high")),1)],64)):c.value==="playback"?(p(),h(U,{key:6},[i("span",Zf,v(k("skip-previous")),1),i("span",Qf,v(k(O.value?"pause":"play")||k("play")),1),i("span",ep,v(k("skip-next")),1)],64)):c.value==="buttons"&&y.value==="cover"?(p(),h(U,{key:7},[i("span",tp,v(k("arrow-expand-horizontal")),1),i("span",np,v(k("stop")),1),i("span",sp,v(k("arrow-collapse-horizontal")),1)],64)):c.value==="buttons"&&y.value==="vacuum"?(p(),h(U,{key:8},[i("span",op,v(k("play")),1),i("span",ip,v(k("stop")),1),i("span",lp,v(k("home-map-marker")),1)],64)):c.value==="buttons"&&y.value==="timer"?(p(),h(U,{key:9},[i("span",ap,v(k("play")),1),i("span",rp,v(k("close")),1)],64)):c.value==="run"?(p(),h("span",up,v({scene:"Activate",script:"Run"}[y.value]||"Press"),1)):(p(),h("span",{key:11,class:"range",style:Pe({background:`linear-gradient(to right, #2196f3 ${j.value}%, #d3e8fb ${j.value}%)`})},null,4))])):R("",!0)],64)):(p(),h(U,{key:4},[i("span",{class:ie(["head",{top:d.value==="watch"}])},[i("span",{class:ie(["ic mdi",{lit:A.value}])},v(m(ke)(m(Bn)(e.tile))),3),i("span",cp,[i("span",dp,v(n.value),1),l.value?(p(),h("span",fp,"Page "+v(l.value)+" ›",1)):d.value!=="watch"&&Me.value?(p(),h("span",{key:1,class:ie(["st",{off:V.value}])},v(Me.value),3)):R("",!0)])],2),d.value==="watch"?(p(),h("span",pp,[Z(v(X.value),1),w.value&&!V.value?(p(),h("small",hp,v(w.value),1)):R("",!0)])):R("",!0),e.tile.options?.inline==="slider"?(p(),h("span",{key:1,class:"mini-slider",style:Pe(z.value)},null,4)):R("",!0)],64)),E.value?(p(),h("button",{key:5,type:"button",class:"remove",title:"Remove tile","aria-label":`Remove ${n.value}`,onClick:K[0]||(K[0]=dt(B=>m(Ua)(e.tile),["stop"]))},"✕",8,vp)):R("",!0)],46,nf)),[[m(Ka),{kind:"tile",tile:e.tile}]])}}),yp=["viewBox","aria-label"],gp=["y"],bp=["cx","cy","r","stroke","stroke-width"],wp=["x1","y1","x2","y2","stroke","stroke-width"],_p=["x","y","fill"],kp=["x","y"],za=Ee({__name:"TopbarSvg",props:{items:{},nameText:{},single:{type:Boolean}},setup(e,{expose:t}){const n=e,s=$(()=>{u.fontsVersion,u.now,u.topbarPreviews;const x=n.items||Vt();return Sa(x,Na.value,n.nameText??(u.layout?.title||"Home"),qt)}),o=$(()=>s.value.metrics),l=$(()=>n.single?Math.round(o.value.text*1.4):o.value.top+Math.round(o.value.name*.45)),a=$(()=>n.single?Math.round(o.value.text*1.05):o.value.top),r=$(()=>{if(!n.single)return s.value.placed;const x=s.value.parts[0];return x&&(x.x=0),x?[x]:[]}),d=$(()=>n.single?`-2 0 ${Math.max(1,r.value[0]?.width||1)+4} ${l.value}`:`0 0 ${o.value.width} ${l.value}`),f=$(()=>a.value+(s.value.zero.top+s.value.zero.bottom)/2),c=$(()=>Oc(s.value.nameText,s.value.fonts.name,Math.min(s.value.natural,s.value.nameRoom))),y=$(()=>new Date(u.now));function b(x){const S=y.value;return[[(S.getHours()%12+S.getMinutes()/60)*30,x*.24],[S.getMinutes()*6,x*.34]].map(([M,G])=>{const C=M*Math.PI/180;return{x2:G*Math.sin(C),y2:-G*Math.cos(C)}})}const k=x=>x.x-x.icon.ink.left,I=x=>(x.icon?x.x+(x.icon.ink.right-x.icon.ink.left)+s.value.gaps.icon:x.x)-x.text.ink.left,E=$(()=>`${(Math.max(1,r.value[0]?.width||1)+4)*(26/o.value.icon)}px`);return t({lay:s}),(x,S)=>(p(),h("svg",{viewBox:d.value,role:"img","aria-label":e.single?"How it looks on the screen":`Top bar: ${s.value.nameText}`,style:Pe(e.single?{width:E.value}:void 0)},[e.single?R("",!0):(p(),h("text",{key:0,x:"0",y:o.value.top,fill:"#1b1b1b",style:Pe({font:s.value.fonts.name})},v(c.value),13,gp)),i("g",null,[(p(!0),h(U,null,le(r.value,M=>(p(),h(U,{key:M.index},[M.dial?(p(),h(U,{key:0},[i("circle",{cx:M.x+M.dial/2,cy:f.value,r:M.dial/2-Math.max(1,Math.round(M.dial/10))/2,fill:"none",stroke:M.view.color||"#46525e","stroke-width":Math.max(1,Math.round(M.dial/10))},null,8,bp),(p(!0),h(U,null,le(b(M.dial),(G,C)=>(p(),h("line",{key:C,x1:M.x+M.dial/2,y1:f.value,x2:M.x+M.dial/2+G.x2,y2:f.value+G.y2,stroke:M.view.color||"#46525e","stroke-width":Math.max(1,Math.round(M.dial*.075)),"stroke-linecap":"round"},null,8,wp))),128))],64)):(p(),h(U,{key:1},[M.icon?(p(),h("text",{key:0,x:k(M),y:f.value-(M.icon.ink.top+M.icon.ink.bottom)/2,fill:M.view.color||"#46525e",style:Pe({font:s.value.fonts.icon})},v(M.icon.glyph),13,_p)):R("",!0),M.text?(p(),h("text",{key:1,x:I(M),y:a.value,fill:"#46525e",style:Pe({font:s.value.fonts.text})},v(M.text.value),13,kp)):R("",!0)],64))],64))),128))])],12,yp))}}),$p={class:"page"},xp={class:"page-label"},Sp={key:1},Cp={class:"tiles"},Tp=["data-slot","aria-label","onClick"],Ap=Ee({__name:"DevicePage",props:{page:{},entries:{},pages:{},moving:{}},setup(e){const t=e,n=$(()=>new Map(t.entries.map(f=>[f.slot,f]))),s=$(()=>new Set(t.entries.flatMap(f=>mn(f.slot,Je(f.tile)).slice(1)))),o=$(()=>Array.from({length:Le},(f,c)=>t.page*Le+c).filter(f=>!s.value.has(f))),l=$(()=>t.pages>1&&!t.entries.some(f=>ht(f.slot)===t.page)),a=$(()=>u.inspector?.kind==="bar"||u.inspector?.kind==="bar-add"),r=$(()=>t.entries.filter(f=>ht(f.slot)===t.page).reduce((f,c)=>f+fi(Je(c.tile)),0));function d(f){const c=u.insertAt===f;u.insertAt=c?-1:f,u.insertAt>=0&&document.querySelector("#search")?.focus()}return(f,c)=>(p(),h("div",$p,[i("div",xp,[i("span",null,"Page "+v(e.page+1),1),l.value?(p(),h("button",{key:0,type:"button",class:"btn mini",title:"The pages after this one shift up one slot",onClick:c[0]||(c[0]=y=>m(Gc)(e.page))},"Remove page")):(p(),h("span",Sp,v(r.value)+" / "+v(m(Le)),1))]),i("div",{class:ie(["device",{cyd:!m(pi)}])},[i("div",{class:ie(["bar-wrap",{selected:a.value}]),title:"Edit top bar",role:"button",tabindex:"0",onClick:c[1]||(c[1]=y=>m(Lt)(0)),onKeydown:c[2]||(c[2]=$a(dt(y=>m(Lt)(0),["prevent"]),["enter"]))},[_e(za)],34),i("div",Cp,[(p(!0),h(U,null,le(o.value,y=>(p(),h(U,{key:y},[n.value.get(y)?(p(),Xe(mp,{key:0,tile:n.value.get(y).tile,slot:y,placeholder:n.value.get(y).tile===e.moving},null,8,["tile","slot","placeholder"])):(p(),h("button",{key:1,type:"button",class:ie(["cell",{"insert-here":m(u).insertAt===y}]),"data-slot":y,title:"Empty slot. Click to add a tile here, or drag one over.","aria-label":`Empty slot ${y%m(Le)+1} on page ${e.page+1}: add the next tile here`,onClick:b=>d(y)},[c[3]||(c[3]=i("span",null,"+",-1)),i("small",null,v(m(u).insertAt===y?"Next tile goes here":"Empty"),1)],10,Tp))],64))),128))])],2)]))}}),Ep={class:"library",id:"library"},Pp={class:"lib-head"},Op={class:"lib-title"},Ip={class:"filters",id:"filters"},Mp=["aria-pressed","onClick"],Lp={class:"lib-row"},Dp=["value"],Fp=["aria-pressed"],Np={class:"lib-list",id:"results","aria-live":"polite"},Rp=["title","disabled","onClick"],Hp={class:"tx"},Up={key:0,class:"hint"},jp={key:1,class:"hint"},Bp={class:"lib-foot"},Vp=Ee({__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","Screen"]],n={switch:"input_boolean",number:"input_number",select:"input_select",weather:"sun",button:"input_button"},s=$(()=>new Set(u.layout?.tiles.map(c=>c.entity)||[])),o=c=>s.value.has(c)&&!no(c),l=$(()=>[...new Set(u.inventory.entities.map(c=>c.area).filter(c=>!!c))].sort((c,y)=>c.localeCompare(y))),a=$(()=>{const c=u.search.toLocaleLowerCase(),y=u.filter,b=u.room;return[...u.inventory.builtin||[],...u.inventory.entities].filter(k=>k.tile!==!1&&(pi.value||!["camera","image"].includes(k.id.split(".")[0]))&&(!y||k.id.startsWith(y+".")||n[y]===k.id.split(".")[0])&&(!b||k.area===b)&&(!u.hidePlaced||!o(k.id))&&`${k.name} ${k.id} ${k.device||""} ${k.area||""}`.toLocaleLowerCase().includes(c))}),r=$(()=>(u.layout?.tiles.length||0)>=yn.value),d=$(()=>u.inventory.entities.length),f=c=>{const y=c.id.split(".")[0];return c.state==="unavailable"||c.state==="unknown"?"gone":["light","switch","input_boolean","fan"].includes(y)&&c.state==="on"?"on":""};return(c,y)=>(p(),h("aside",Ep,[i("div",Pp,[i("div",Op,[y[3]||(y[3]=Z("Library ",-1)),i("small",null,v(d.value)+" entities",1)]),we(i("input",{id:"search","onUpdate:modelValue":y[0]||(y[0]=b=>m(u).search=b),type:"search",placeholder:"Search by name, device, or room…",autocomplete:"off","aria-label":"Add an entity"},null,512),[[Fe,m(u).search]]),i("div",Ip,[(p(),h(U,null,le(t,([b,k])=>i("button",{key:b,type:"button","aria-pressed":m(u).filter===b?"true":"false",onClick:I=>m(u).filter=b},[b?(p(),h("span",{key:0,class:"domain-icon",style:Pe({color:m(xt)(b+".")[2],background:m(xt)(b+".")[3]}),"aria-hidden":"true"},v(m(xt)(b+".")[1]),5)):R("",!0),Z(v(k),1)],8,Mp)),64))]),i("div",Lp,[we(i("select",{id:"room","onUpdate:modelValue":y[1]||(y[1]=b=>m(u).room=b),"aria-label":"Room"},[y[4]||(y[4]=i("option",{value:""},"All rooms",-1)),(p(!0),h(U,null,le(l.value,b=>(p(),h("option",{key:b,value:b},v(b),9,Dp))),128))],512),[[vn,m(u).room]]),i("button",{type:"button",class:"chip-toggle",id:"hide-placed","aria-pressed":m(u).hidePlaced?"true":"false",title:"Hide what is already on this screen",onClick:y[2]||(y[2]=b=>m(u).hidePlaced=!m(u).hidePlaced)},"Hide placed",8,Fp)])]),i("div",Np,[(p(!0),h(U,null,le(a.value.slice(0,80),b=>we((p(),h("button",{key:b.id,type:"button",class:"ent",title:b.id,disabled:o(b.id)||r.value,onClick:k=>m(Ha)(b.id)},[i("span",{class:ie(["av mdi",f(b)]),style:Pe({color:m(xt)(b.id)[2],background:m(xt)(b.id)[3]})},v(m(u).inventory.icons?m(ke)(m(sn)(b.id)):m(xt)(b.id)[1]),7),i("span",Hp,[i("b",null,v(b.name),1),i("small",null,v([m(xt)(b.id)[0],b.area,b.device].filter(Boolean).join(" · ")),1)]),i("span",{class:ie(["add",{done:o(b.id)}])},v(o(b.id)?"✓":"+"),3)],8,Rp)),[[m(Ka),{kind:"entity",id:b.id}]])),128)),a.value.length?a.value.length>80?(p(),h("p",jp,v(a.value.length)+" results. Keep typing to narrow it down.",1)):R("",!0):(p(),h("p",Up,v(m(u).hidePlaced&&!m(u).search&&!m(u).filter&&!m(u).room?"Everything here is already on this screen.":"No entities found. Try a different name, room or filter."),1))]),i("div",Bp,v(r.value?`This screen holds ${m(yn)} tiles${m(yn)<48?"; update its firmware for 48":""}.`:"Drag onto a page, or tap + to add to the first free slot. ⌘K searches everything."),1)]))}}),Wp={class:"canvas-head"},Kp={id:"count"},qp={key:0,id:"no-tiles"},Yp={key:1},zp={key:2,id:"positions-hint",class:"warn"},Jp={class:"pages",id:"layout-preview","aria-label":"Screen layout"},Gp={class:"page-label"},Xp=["tabindex"],Zp=Ee({__name:"LayoutView",setup(e){const t=$(()=>u.layout),n=$(()=>u.drag.preview||Ve(t.value)),s=$(()=>gt(n.value,t.value.pages)),o=$(()=>Zc()),l=$(()=>s.value<Bt),a=$(()=>Dc(t.value.tiles)&&!Zt(0,2,26)?`Empty slots and fixed positions work from firmware 0.2.26. This screen (firmware ${lt.value?.firmware||"unknown"}) shifts the tiles up to the first free slot until that update.`:"");function r(d){d.target.closest(".device, .page-label, .canvas-head")||u.inspector&&He()}return(d,f)=>(p(),h(U,null,[i("div",{class:"canvas",id:"canvas",onClick:r},[i("div",Wp,[i("b",Kp,v(s.value)+" "+v(s.value===1?"page":"pages")+" · "+v(t.value.tiles.length)+" / "+v(m(yn))+" tiles",1),t.value.tiles.length?(p(),h("span",Yp,"Tap the top bar or a tile to change it. Drag to move; drop on the next page for a new one.")):(p(),h("span",qp,"Add your first light, scene, or device from the library.")),a.value?(p(),h("span",zp,v(a.value),1)):R("",!0)]),i("div",Jp,[(p(!0),h(U,null,le(o.value,c=>(p(),Xe(Ap,{key:c,page:c-1,entries:n.value,pages:s.value,moving:m(u).drag.moving},null,8,["page","entries","pages","moving"]))),128)),i("div",{class:ie(["page ghost",{disabled:!l.value}])},[i("div",Gp,[i("span",null,"Page "+v(o.value+1),1)]),i("div",{class:ie(["device",{cyd:m(lt)?.board!=="guition"}]),id:"add-page",role:"button",tabindex:l.value?0:-1,onClick:f[0]||(f[0]=c=>l.value&&m(ol)()),onKeydown:f[1]||(f[1]=$a(dt(c=>l.value&&m(ol)(),["prevent"]),["enter"]))},v(l.value?"+ Add page":`${m(Bt)} pages is the most`),43,Xp)],2)])]),_e(Vp)],64))}}),Qp={class:"status",id:"settings-status",role:"status"},eh={key:0,class:"set-grid",id:"settings-groups"},th={class:"mdi"},nh=["data-setting","title","onClick"],sh=["id"],oh={class:"s-control"},ih=["id","aria-checked","aria-labelledby","disabled","onClick"],lh=["aria-labelledby"],ah=["aria-pressed","disabled","onClick"],rh={key:2,class:"step"},uh=["aria-label","disabled","onPointerdown","onClick"],ch={class:"mdi"},dh=["id","aria-labelledby"],fh=["aria-label","disabled","onPointerdown","onClick"],ph={class:"mdi"},hh=Ee({__name:"SettingsTab",setup(e){const t=$(()=>vi()),n=$(()=>On()),s=$(()=>t.value?.owner==="screen"&&!lt.value?.online),o=$(()=>ld.map(I=>({...I,rows:I.rows.filter(E=>t.value?.keys.includes(E.key))})).filter(I=>I.rows.length)),l=I=>s.value||!!t.value?.unavailable.includes(I.key),a=I=>I.needs?!!n.value[I.needs]:!0,r=$(()=>s.value?"This screen is offline. Its settings can change once it's back.":u.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."),d=(I,E)=>{const x=n.value[I.key];return l(I)||!a(I)||x===null||x===void 0?!0:I.kind!=="moment"&&ul(I,x,E,!1,n.value)===x},f=new WeakMap;function c(I,E,x){const S=On(),M=ul(I,S[I.key],E,x,S);M!==S[I.key]&&Wn(I.key,M,600)}function y(I,E,x){const S=I.currentTarget;if(S.disabled||I.button!==0)return;const M={timer:0,held:!1};f.set(S,M);let G=0;M.timer=window.setTimeout(function C(){M.held=!0,G+=1,c(E,x,G>5),M.timer=window.setTimeout(C,180)},450)}function b(I){const E=f.get(I.currentTarget);E&&clearTimeout(E.timer)}function k(I,E,x){const S=f.get(I.currentTarget);if(S?.held){S.held=!1;return}c(E,x,!1)}return(I,E)=>(p(),h("div",{class:ie(["settings",{offline:s.value}]),id:"general-settings"},[i("span",Qp,v(r.value),1),t.value?(p(),h("div",eh,[(p(!0),h(U,null,le(o.value,x=>(p(),h("section",{key:x.title,class:"set-card"},[i("h4",null,[i("span",th,v(m(ke)(x.icon)),1),Z(v(x.title),1)]),(p(!0),h(U,null,le(x.rows,S=>(p(),h("div",{key:S.key,class:ie(["srow",[`setting-${S.kind}`,{inactive:!a(S)||l(S)}]]),"data-setting":S.key,title:l(S)&&!s.value?"This entity is off in Home Assistant, or the screen is restarting.":"",onClick:M=>S.kind==="toggle"&&M.target.closest(".srow")===M.currentTarget&&!M.target.closest("button")&&!l(S)&&m(Wn)(S.key,!n.value[S.key],150)},[i("span",{class:"s-label",id:`setting-label-${S.key}`},v(S.label),9,sh),i("div",oh,[S.kind==="toggle"?(p(),h("button",{key:0,type:"button",class:ie(["switch",{unknown:n.value[S.key]===null||n.value[S.key]===void 0}]),role:"switch",id:`setting-${S.key}`,"aria-checked":n.value[S.key]?"true":"false","aria-labelledby":`setting-label-${S.key}`,disabled:l(S),onClick:dt(M=>m(Wn)(S.key,!n.value[S.key],150),["stop"])},null,10,ih)):S.kind==="choice"?(p(),h("div",{key:1,class:"seg",role:"group","aria-labelledby":`setting-label-${S.key}`},[(p(!0),h(U,null,le(S.options,([M,G])=>(p(),h("button",{key:String(M),type:"button","aria-pressed":n.value[S.key]===M?"true":"false",disabled:l(S),onClick:C=>m(Wn)(S.key,M,150)},v(G),9,ah))),128))],8,lh)):(p(),h("div",rh,[i("button",{type:"button","aria-label":`${S.label} lower`,disabled:d(S,-1),onPointerdown:M=>y(M,S,-1),onPointerup:b,onPointercancel:b,onPointerleave:b,onClick:M=>k(M,S,-1)},[i("span",ch,v(m(ke)("F0374")),1)],40,uh),i("output",{id:`setting-${S.key}`,"aria-labelledby":`setting-label-${S.key}`},v(m(cd)(S,n.value)),9,dh),i("button",{type:"button","aria-label":`${S.label} higher`,disabled:d(S,1),onPointerdown:M=>y(M,S,1),onPointerup:b,onPointercancel:b,onPointerleave:b,onClick:M=>k(M,S,1)},[i("span",ph,v(m(ke)("F0415")),1)],40,fh)]))])],10,nh))),128))]))),128))])):R("",!0)],2))}}),vh={class:"seg wrap",role:"group"},mh=["disabled","aria-pressed","onClick"],tt=Ee({__name:"Segmented",props:{choices:{},value:{},disabled:{type:Boolean}},emits:["pick"],setup(e,{emit:t}){const n=t;return(s,o)=>(p(),h("div",vh,[(p(!0),h(U,null,le(e.choices,([l,a])=>(p(),h("button",{key:String(l),type:"button",disabled:e.disabled,"aria-pressed":String(l)===String(e.value)?"true":"false",onClick:r=>n("pick",l)},v(a),9,mh))),128))]))}}),yh={class:"f"},gh={key:0},bh={key:1,class:"warn"},wh=["aria-expanded"],_h={class:"tx"},kh={key:0,class:"mono"},$h={class:"link"},xh={key:0,class:"picker"},Sh={class:"action-list"},Ch=["aria-pressed","onClick"],Th={key:0,class:"hint"},Ah={key:1,class:"warn"},Eh={class:"f-label"},Ph=["aria-label","value","onChange"],Oh=["value"],Ih={key:3,class:"action-number"},Mh=["aria-label","value","onInput"],Lh=["onClick"],Dh={key:4,class:"action-number"},Fh=["aria-label","min","max","step","value","placeholder","onInput"],Nh={key:0},Rh=["aria-label","value","placeholder","onInput"],Hh={key:6},Uh={key:0,class:"warn"},jh={key:3},Bh=Ee({__name:"ActionPicker",props:{tile:{}},setup(e){const t=e,n=$(()=>u.entityActions[t.tile.entity]),s=$(()=>t.tile.options?.action),o=$(()=>n.value?.find(C=>C.action===s.value?.action)),l=$(()=>u.actionPickerOpen||!s.value),a=$(()=>{const C=u.actionSearch.trim().toLocaleLowerCase();return(n.value||[]).filter(V=>`${V.name} ${V.action} ${V.description}`.toLocaleLowerCase().includes(C))});n.value===void 0&&Yc(t.tile.entity);function r(C){const V=C.action===s.value?.action;t.tile.options={...t.tile.options,action:V?s.value:{action:C.action}},u.actionPickerOpen=!1,Ze()}function d(C,V){const O={...t.tile.options?.action?.data||{}};V===void 0?delete O[C]:O[C]=V,t.tile.options={...t.tile.options,action:{action:s.value.action,...Object.keys(O).length?{data:O}:{}}},Ze()}const f=$(()=>{if(!o.value)return[];const C=t.tile.options?.action?.data||{};return o.value.fields.filter(V=>V.required&&C[V.key]===void 0).map(V=>V.name)}),c=C=>Object.keys(C.selector||{})[0]||"text",y=C=>(C.selector||{})[c(C)]||{},b=C=>C.example===void 0?"":typeof C.example=="string"?C.example:JSON.stringify(C.example);function k(C){const V=y(C),O=c(C);return Array.isArray(C.options)?C.options.map(A=>[A,A]):O==="select"&&Array.isArray(V.options)&&!V.multiple?V.options.map(A=>A&&typeof A=="object"?[String(A.value),String(A.label??A.value)]:[String(A),String(A)]):null}const I=C=>"#"+C.map(V=>Math.max(0,Math.min(255,Number(V)||0)).toString(16).padStart(2,"0")).join(""),E=C=>Array.isArray(C)&&C.length===3?I(C):"#ffffff",x=C=>C===void 0?"":typeof C=="string"?C:JSON.stringify(C);function S(C,V){const O=V.trim();if(!O)return d(C.key,void 0);if(c(C)==="text")return d(C.key,V);try{d(C.key,JSON.parse(O))}catch{d(C.key,V)}}function M(C,V){d(C.key,V===""||!Number.isFinite(Number(V))?void 0:Number(V))}const G=C=>y(C).unit_of_measurement||c(C)==="color_temp"&&y(C).unit||"";return(C,V)=>(p(),h("div",yh,[V[3]||(V[3]=i("span",{class:"f-label"},"Action",-1)),n.value===void 0?(p(),h("small",gh,"Asking Home Assistant which actions this entity has…")):n.value===null?(p(),h("small",bh,"Home Assistant isn't answering right now. Try again in a moment.")):(p(),h(U,{key:2},[i("button",{type:"button",class:"row","aria-expanded":l.value?"true":"false",onClick:V[0]||(V[0]=O=>m(u).actionPickerOpen=!l.value)},[i("span",_h,[i("b",null,v(o.value?o.value.name:s.value?s.value.action:"Choose an action"),1),s.value?(p(),h("small",kh,v(s.value.action),1)):R("",!0)]),i("span",$h,v(l.value?"Close":"Change"),1)],8,wh),l.value?(p(),h("div",xh,[we(i("input",{"onUpdate:modelValue":V[1]||(V[1]=O=>m(u).actionSearch=O),type:"search",placeholder:"Search, for example toggle, position, or play","aria-label":"Search for an action"},null,512),[[Fe,m(u).actionSearch]]),i("div",Sh,[(p(!0),h(U,null,le(a.value,O=>(p(),h("button",{key:O.action,type:"button",class:"action-choice","aria-pressed":O.action===s.value?.action?"true":"false",onClick:A=>r(O)},[i("strong",null,v(O.name),1),i("small",null,v(O.description?`${O.action} · ${O.description}`:O.action),1)],8,Ch))),128)),a.value.length?R("",!0):(p(),h("p",Th,"No action found."))])])):R("",!0),s.value&&!o.value?(p(),h("small",Ah,"Home Assistant doesn't offer this action for this entity any more, so a tap does nothing. Choose another one.")):R("",!0),o.value&&!l.value?(p(),h(U,{key:2},[(p(!0),h(U,null,le(o.value.fields,O=>(p(),h("div",{key:O.key,class:"f"},[i("span",Eh,v(O.required?O.name:`${O.name} (optional)`),1),c(O)==="boolean"?(p(),Xe(tt,{key:0,choices:[["","Not set"],["true","On"],["false","Off"]],value:s.value?.data?.[O.key]===void 0?"":String(s.value?.data?.[O.key]),onPick:A=>d(O.key,A===""?void 0:A==="true")},null,8,["value","onPick"])):k(O)&&k(O).length<=4?(p(),Xe(tt,{key:1,choices:[["","Not set"],...k(O)],value:s.value?.data?.[O.key]===void 0?"":String(s.value?.data?.[O.key]),onPick:A=>d(O.key,A===""?void 0:A)},null,8,["choices","value","onPick"])):k(O)?(p(),h("select",{key:2,"aria-label":O.name,value:String(s.value?.data?.[O.key]??""),onChange:A=>d(O.key,A.target.value===""?void 0:A.target.value)},[V[2]||(V[2]=i("option",{value:""},"Not set",-1)),(p(!0),h(U,null,le(k(O),([A,w])=>(p(),h("option",{key:A,value:A},v(w),9,Oh))),128))],40,Ph)):c(O)==="color_rgb"?(p(),h("div",Ih,[i("input",{type:"color","aria-label":O.name,value:E(s.value?.data?.[O.key]),onInput:A=>d(O.key,[1,3,5].map(w=>parseInt(A.target.value.slice(w,w+2),16)))},null,40,Mh),i("button",{type:"button",class:"btn quiet mini",onClick:A=>d(O.key,void 0)},"Not set",8,Lh)])):c(O)==="number"||c(O)==="color_temp"?(p(),h("div",Dh,[i("input",{type:"number","aria-label":O.name,min:y(O).min,max:y(O).max,step:y(O).step==="any"?"any":y(O).step,value:s.value?.data?.[O.key]??"",placeholder:b(O),onInput:A=>M(O,A.target.value)},null,40,Fh),G(O)?(p(),h("span",Nh,v(G(O)),1)):R("",!0)])):(p(),h("input",{key:5,type:"text","aria-label":O.name,value:x(s.value?.data?.[O.key]),placeholder:b(O),onInput:A=>S(O,A.target.value)},null,40,Rh)),O.description?(p(),h("small",Hh,v(O.description),1)):R("",!0)]))),128)),f.value.length?(p(),h("small",Uh,"Home Assistant needs "+v(f.value.join(", "))+".",1)):R("",!0)],64)):R("",!0),m(Zt)(0,2,58)?R("",!0):(p(),h("small",jh,"The screen performs an action from firmware 0.2.58: press Update on the screen. Until then a tap works as Automatic."))],64))]))}}),Vh={class:"f"},Wh=["aria-expanded"],Kh={class:"av mdi"},qh={class:"tx"},Yh={class:"link"},zh={key:0,class:"picker"},Jh=["aria-pressed","title"],Gh={class:"mdi"},Xh=["aria-pressed"],Zh={class:"icon-list"},Qh={class:"icon-grid"},ev=["title","aria-label","aria-pressed","onClick"],tv={class:"mdi"},nv={key:0,class:"hint"},sv={key:1},Ja=Ee({__name:"IconPicker",props:{selected:{},automatic:{},autoLabel:{},allowNone:{type:Boolean},note:{}},emits:["pick"],setup(e,{emit:t}){const n=e,s=t,o=pe(""),l=$(()=>vs(n.selected)),a=$(()=>n.selected==="none"?"":ke(l.value?.cp||n.automatic)),r=$(()=>n.selected==="none"?"No icon":l.value?.label||n.autoLabel),d=$(()=>{const f=o.value.trim().toLocaleLowerCase();return(u.inventory.icons?.groups||[]).map(c=>({label:c.label,icons:c.icons.filter(y=>!f||`${y.label} ${y.name.replaceAll("-"," ")} ${c.label}`.toLocaleLowerCase().includes(f))})).filter(c=>c.icons.length)});return(f,c)=>(p(),h("div",Vh,[c[5]||(c[5]=i("span",{class:"f-label"},"Icon",-1)),i("button",{type:"button",class:"row","aria-expanded":m(u).iconPickerOpen?"true":"false",onClick:c[0]||(c[0]=y=>m(u).iconPickerOpen=!m(u).iconPickerOpen)},[i("span",Kh,v(a.value),1),i("span",qh,[i("b",null,v(r.value),1)]),i("span",Yh,v(m(u).iconPickerOpen?"Close":"Change"),1)],8,Wh),m(u).iconPickerOpen?(p(),h("div",zh,[we(i("input",{"onUpdate:modelValue":c[1]||(c[1]=y=>o.value=y),type:"search",placeholder:"Search, for example lamp, music, or door","aria-label":"Search for an icon"},null,512),[[Fe,o.value]]),i("button",{type:"button",class:"icon-choice icon-auto","aria-pressed":e.selected==="auto"?"true":"false",title:e.autoLabel,onClick:c[2]||(c[2]=y=>s("pick","auto"))},[i("span",Gh,v(m(ke)(e.automatic)),1),i("span",null,v(e.autoLabel),1)],8,Jh),e.allowNone?(p(),h("button",{key:0,type:"button",class:"icon-choice icon-auto","aria-pressed":e.selected==="none"?"true":"false",title:"No icon",onClick:c[3]||(c[3]=y=>s("pick","none"))},[...c[4]||(c[4]=[i("span",{class:"mdi"},null,-1),i("span",null,"No icon, text only",-1)])],8,Xh)):R("",!0),i("div",Zh,[(p(!0),h(U,null,le(d.value,y=>(p(),h("section",{key:y.label},[i("small",null,v(y.label),1),i("div",Qh,[(p(!0),h(U,null,le(y.icons,b=>(p(),h("button",{key:b.name,type:"button",class:"icon-choice",title:b.label,"aria-label":`Icon: ${b.label}`,"aria-pressed":e.selected===b.name?"true":"false",onClick:k=>s("pick",b.name)},[i("span",tv,v(m(ke)(b.cp)),1)],8,ev))),128))])]))),128)),d.value.length?R("",!0):(p(),h("p",nv,"No icon found."))])])):R("",!0),e.note?(p(),h("small",sv,v(e.note),1)):R("",!0)]))}}),ov={class:"dr-head"},iv={class:"tx"},lv={class:"mono"},av={class:"dr-body"},rv={class:"f"},uv=["value","placeholder"],cv={key:1,class:"f"},dv={key:2,class:"f"},fv={key:0,class:"warn"},pv={class:"f"},hv={key:0},vv={key:3,class:"f"},mv={key:4,class:"f"},yv={key:5,class:"f"},gv={key:7,class:"f"},bv={key:0,class:"warn"},wv={key:8,class:"f"},_v={class:"f"},kv={class:"sw"},$v=["aria-label","aria-pressed","onClick"],xv={class:"dr-foot"},Sv=Ee({__name:"TileInspector",props:{tile:{}},setup(e){const t=e,n=$(()=>t.tile.entity.split(".")[0]),s=$(()=>hs(t.tile.entity)),o=$(()=>ps(t.tile.entity)),l=$(()=>u.layout?gt(Ve(u.layout),u.layout.pages):1),a=$(()=>ht(t.tile.slot)+1),r=K=>!u.layout?.tiles.some(B=>ht(B.slot)===K-1),d=$(()=>{const K=Array.from({length:Math.min(Bt,l.value+1)},(B,ne)=>ne+1);return o.value>K.length&&K.push(o.value),K.map(B=>[B,r(B)?`${B} (empty)`:String(B)])}),f=$(()=>nl.value?o.value>l.value?{text:`This screen has no page ${o.value}, so a tap opens its last page. Choose another page.`,warn:!0}:{text:"A tap on the tile opens that page.",warn:!1}:{text:"Navigation tiles need firmware 0.2.62: press Update on the screen first.",warn:!1}),c=$(()=>!u.layout?.tiles.some(K=>ve(K)!==ve(t.tile)&&ht(K.slot)===a.value-1)),y=$(()=>{const K=Array.from({length:l.value},(B,ne)=>[ne+1,String(ne+1)]);return l.value<Bt&&!(c.value&&a.value===l.value)&&K.push([l.value+1,"New page"]),K}),b=$(()=>o.value?[["single","Normal"],["wide","Double-width"]]:[["single","Normal"],["wide","Double-width"],["full","Full page"]]),k=$(()=>o.value?"":nl.value?"Full page: one big button that lights up while on; a slider, controls or a graph sit at the bottom of it.":"A full-page tile needs firmware 0.2.62: press Update on the screen first."),I=$(()=>u.capabilities[t.tile.entity]),E=(K,B)=>t.tile.options?.[K]??B,x=$(()=>E("display",n.value==="screen"?"digital":"standard")),S=$(()=>{const K=n.value==="screen"?[["digital","Digital clock"],["analog","Analog clock"]]:[["standard","Name and status"],["watch","Large value"]],B=I.value;return n.value==="weather"&&(!B||B.displays.includes("forecast")||x.value==="forecast")&&K.push(["forecast","Weather forecast"]),n.value==="sensor"&&(!B||B.displays.includes("graph")||x.value==="graph")&&K.push(["graph","Graph"]),n.value==="sun"&&K.push(["sunpath","Sun path"]),K}),M=$(()=>{const K=I.value;return K&&x.value==="graph"&&!K.displays.includes("graph")?"Home Assistant has no numbers for this entity, so the graph stays empty. Choose another display.":K&&x.value==="forecast"&&!K.displays.includes("forecast")?"This weather service has no daily forecast in Home Assistant. Choose another display.":""}),G=$(()=>E("size","single")),C=$(()=>u.inventory.controls?.[n.value]),V=$(()=>E("controls",G.value==="full"?"none":C.value?.default)),O=$(()=>{const K=I.value;return(C.value?.choices||[]).filter(B=>!K||B.key==="none"||B.key===V.value||K.controls.includes(B.key)).map(B=>[B.key,B.label])}),A=$(()=>{const K=I.value;return K&&V.value!=="none"&&!K.controls.includes(V.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:Zt(0,2,19)?G.value==="full"?"At the bottom of the full-page tile; a tap anywhere else works as set below.":"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}}),w=$(()=>E("tap","auto")),T=$(()=>{const K=[["auto","Automatic"],["detail","Open control"],["none","View only"]];return((I.value?I.value.toggle:tl.includes(n.value))||w.value==="toggle")&&K.push(["toggle","On / off"]),K.push(["action","Perform action"]),K}),te=$(()=>w.value==="toggle"&&I.value&&!I.value.toggle?{text:"Home Assistant can't turn this on and off, so a tap does nothing. Choose another option.",warn:!0}:w.value==="toggle"&&!tl.includes(n.value)&&!Zt(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}:w.value==="toggle"?{text:"Hold the tile to open its card.",warn:!1}:null),$e=$(()=>E("inline","none")),Me=$(()=>Bc.includes(n.value)&&(!I.value||I.value.inline||$e.value==="slider")),X=$(()=>$e.value==="slider"&&I.value&&!I.value.inline),j=$(()=>E("history_hours",24)),z=$(()=>Object.entries(u.inventory.backgrounds||{})),ce=$(()=>!!u.inventory.entities.find(K=>K.id===t.tile.entity)?.icon),de=$(()=>!!u.inventory.icons&&(n.value!=="screen"||o.value>0)&&!["forecast","sunpath"].includes(x.value));function he(K){t.tile.name=K,Ze()}function Q(){u.inspector={kind:"inspect",entity:t.tile.entity}}return(K,B)=>(p(),h(U,null,[i("div",ov,[i("span",{class:"av mdi",style:Pe({color:m(xt)(e.tile.entity)[2],background:m(xt)(e.tile.entity)[3]})},v(m(ke)(m(Bn)(e.tile))),5),i("span",iv,[i("b",null,v(e.tile.name||s.value),1),i("small",lv,v(e.tile.entity),1)]),i("button",{type:"button",class:"icon-btn","aria-label":"Close",onClick:B[0]||(B[0]=(...ne)=>m(He)&&m(He)(...ne))},"✕")]),i("div",av,[i("div",rv,[B[12]||(B[12]=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:B[1]||(B[1]=ne=>he(ne.target.value))},null,40,uv)]),de.value?(p(),Xe(Ja,{key:0,selected:e.tile.options?.icon||"auto",automatic:m(sn)(e.tile.entity),"auto-label":`Automatic (${ce.value?"from Home Assistant":"default"})`,note:m(Zt)(0,2,18)?"":"The screen shows a chosen icon from firmware 0.2.18.",onPick:B[2]||(B[2]=ne=>m(Kt)(e.tile,"icon",ne))},null,8,["selected","automatic","auto-label","note"])):R("",!0),o.value?(p(),h("div",cv,[B[13]||(B[13]=i("span",{class:"f-label"},"Goes to page",-1)),_e(tt,{choices:d.value,value:o.value,onPick:B[3]||(B[3]=ne=>m(Qc)(e.tile,Number(ne)))},null,8,["choices","value"]),i("small",{class:ie({warn:f.value.warn})},v(f.value.text),3)])):(p(),h("div",dv,[B[14]||(B[14]=i("span",{class:"f-label"},"Display",-1)),_e(tt,{choices:S.value,value:x.value,onPick:B[4]||(B[4]=ne=>m(Kt)(e.tile,"display",ne))},null,8,["choices","value"]),M.value?(p(),h("small",fv,v(M.value),1)):R("",!0)])),i("div",pv,[B[15]||(B[15]=i("span",{class:"f-label"},"Size",-1)),_e(tt,{choices:b.value,value:G.value,onPick:B[5]||(B[5]=ne=>m(Kt)(e.tile,"size",ne))},null,8,["choices","value"]),k.value?(p(),h("small",hv,v(k.value),1)):R("",!0)]),y.value.length>1?(p(),h("div",vv,[B[16]||(B[16]=i("span",{class:"f-label"},"Page",-1)),_e(tt,{choices:y.value,value:a.value,onPick:B[6]||(B[6]=ne=>m(Xc)(e.tile,Number(ne)-1))},null,8,["choices","value"])])):R("",!0),C.value&&G.value!=="single"&&!o.value?(p(),h("div",mv,[B[17]||(B[17]=i("span",{class:"f-label"},"Direct control on the tile",-1)),_e(tt,{choices:O.value,value:V.value,onPick:B[7]||(B[7]=ne=>m(Kt)(e.tile,"controls",ne))},null,8,["choices","value"]),i("small",{class:ie({warn:A.value.warn})},v(A.value.text),3)])):R("",!0),n.value!=="screen"&&!o.value?(p(),h("div",yv,[B[18]||(B[18]=i("span",{class:"f-label"},"On tap",-1)),_e(tt,{choices:T.value,value:w.value,onPick:B[8]||(B[8]=ne=>m(Kt)(e.tile,"tap",ne))},null,8,["choices","value"]),te.value?(p(),h("small",{key:0,class:ie({warn:te.value.warn})},v(te.value.text),3)):R("",!0)])):R("",!0),n.value!=="screen"&&!o.value&&w.value==="action"?(p(),Xe(Bh,{key:6,tile:e.tile},null,8,["tile"])):R("",!0),Me.value&&!o.value?(p(),h("div",gv,[B[19]||(B[19]=i("span",{class:"f-label"},"Small slider on the tile",-1)),_e(tt,{choices:[["none","No"],["slider","Yes, control directly"]],value:$e.value,onPick:B[9]||(B[9]=ne=>m(Kt)(e.tile,"inline",ne))},null,8,["value"]),X.value?(p(),h("small",bv,"Home Assistant has nothing a slider can change for this entity. Choose No.")):R("",!0)])):R("",!0),n.value==="sensor"&&!o.value?(p(),h("div",wv,[B[20]||(B[20]=i("span",{class:"f-label"},"History",-1)),_e(tt,{choices:[[1,"1 hour"],[6,"6 hours"],[24,"24 hours"]],value:j.value,onPick:B[10]||(B[10]=ne=>m(Kt)(e.tile,"history_hours",Number(ne)))},null,8,["value"])])):R("",!0),i("div",_v,[B[21]||(B[21]=i("span",{class:"f-label"},"Pastel background",-1)),i("div",kv,[(p(!0),h(U,null,le(z.value,([ne,Qe])=>(p(),h("button",{key:ne,type:"button","aria-label":`Background: ${Qe.label}`,"aria-pressed":(e.tile.options?.background||"auto")===ne?"true":"false",onClick:Mn=>m(Kt)(e.tile,"background",ne)},[i("i",{class:ie(Qe.color?"":ne==="none"?"none":"auto"),style:Pe(Qe.color?{background:Qe.color}:void 0)},null,6),Z(v(Qe.label),1)],8,$v))),128))])])]),i("div",xv,[i("button",{type:"button",class:"btn danger",onClick:B[11]||(B[11]=ne=>m(Ua)(e.tile))},"Remove"),B[22]||(B[22]=i("span",{class:"spacer"},null,-1)),n.value!=="screen"?(p(),h("button",{key:0,type:"button",class:"btn quiet",onClick:Q},"Read current data")):R("",!0)])],64))}}),Cv={class:"dr-head"},Tv={class:"av mdi",style:{background:"var(--seg)",color:"var(--ink-2)"}},Av={class:"tx"},Ev={class:"dr-body"},Pv={class:"f"},Ov=["value"],Iv={class:"f"},Mv={class:"f-label",id:"topbar-caption"},Lv={style:{"text-transform":"none","letter-spacing":"0","font-weight":"500"}},Dv={class:"items",id:"topbar-chips",role:"list","aria-labelledby":"topbar-caption"},Fv=["data-index","aria-label","onPointerdown","onClick","onKeydown"],Nv={class:"tx"},Rv=["aria-label","onClick"],Hv=["disabled","title"],Uv={class:"live",id:"topbar-live"},jv={class:"f"},Bv={class:"f"},Vv={key:1,class:"f"},Wv={key:2},Kv={key:0,class:"dr-foot"},qv=["disabled"],Yv=["disabled"],zv=Ee({__name:"TopbarInspector",props:{index:{}},setup(e){const t=e,n=$(()=>Vt()),s=$(()=>n.value[t.index]),o=$(()=>(u.fontsVersion,u.now,u.topbarPreviews,Sa(n.value,Na.value,u.layout?.title||"Home",qt))),l=$(()=>o.value.dropped),a=$(()=>u.inventory.header?.min_firmware||"0.2.32"),r=$(()=>{const[X,j,z]=a.value.split(".").map(Number);return Zt(X,j,z)}),d=$(()=>r.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 ${a.value}; until that update, this screen shows the name and, if the time is in the bar, the clock.`),f=(X,j)=>{const z=qt(X);return z.shown?l.value.has(j)?"Doesn't fit next to the name":z.analog?"Dial":z.text:"Hidden: not active right now"},c=X=>{const j=qt(X);return j.analog||X.type!=="entity"?vs(xa[X.type])?.cp:j.icon},y=X=>u.topbarAdded?.key===qe(X)&&Date.now()-u.topbarAdded.time<1200;function b(X){u.layout&&(u.layout.title=X,Ze())}function k(X){const j=[...n.value];j[t.index]={...j[t.index],...X},as(j)}const I=$(()=>s.value?qt(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":""),E=$(()=>On().clock_24h!==!1),x=$(()=>({clock:ui(E.value,new Date(u.now)),analog:"Small dial with the time",date:ci(new Date(u.now))})),S=pe({index:-1,active:!1,moved:!1});let M=null,G=0,C=null,V=0;function O(X,j){X.button!==0||X.target.closest(".x")||(X.pointerType!=="touch"&&X.preventDefault(),S.value={index:j,active:!1,moved:!1},M={x:X.clientX,y:X.clientY},C=X.pointerId,clearTimeout(G),X.pointerType==="touch"&&(G=window.setTimeout(A,260)),document.addEventListener("pointermove",T),document.addEventListener("pointerup",te),document.addEventListener("pointercancel",te))}function A(){S.value.active=!0,document.addEventListener("touchmove",w,{passive:!1})}function w(X){S.value.active&&X.preventDefault()}function T(X){if(X.pointerId!==C||!M)return;if(!S.value.active){const ce=Math.hypot(X.clientX-M.x,X.clientY-M.y);if(X.pointerType==="touch"){ce>10&&(clearTimeout(G),M=null);return}if(ce<6)return;A()}const j=[...document.querySelectorAll(".items .item[data-index]")];let z=S.value.index;if(j.forEach((ce,de)=>{const he=ce.getBoundingClientRect();de<S.value.index&&X.clientY<he.top+he.height/2&&(z=Math.min(z,de)),de>S.value.index&&X.clientY>he.top+he.height/2&&(z=Math.max(z,de))}),z!==S.value.index&&u.layout){const ce=[...n.value];ce.splice(z,0,...ce.splice(S.value.index,1)),u.layout.header={items:ce};const de=t.index===S.value.index;S.value.index=z,S.value.moved=!0,de&&Lt(z)}}function te(X){X.pointerId===C&&(clearTimeout(G),document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",te),document.removeEventListener("pointercancel",te),document.removeEventListener("touchmove",w),S.value.active&&(V=Date.now()+400,S.value.moved&&Ze()),S.value={index:-1,active:!1,moved:!1},M=null,C=null)}function $e(X){Date.now()<V||Lt(X)}function Me(X,j){if(X.key==="Enter"||X.key===" "){X.preventDefault(),Lt(j);return}const z={ArrowUp:-1,ArrowDown:1}[X.key];z&&xo(j,j+z)&&(t.index===j&&Lt(j+z),X.preventDefault())}return(X,j)=>(p(),h(U,null,[i("div",Cv,[i("span",Tv,v(s.value?m(ke)(c(s.value)||"F0150"):m(ke)("F0150")),1),i("span",Av,[i("b",null,v(s.value?s.value.type==="entity"?m(hs)(s.value.entity):m(Vn)(s.value):"Top bar"),1),i("small",{class:ie({mono:s.value?.type==="entity"})},v(s.value?s.value.type==="entity"?s.value.entity:"From the screen itself, also works without Home Assistant":`${n.value.length} of ${m(zt)()} items`),3)]),i("button",{type:"button",class:"icon-btn","aria-label":"Close",onClick:j[0]||(j[0]=(...z)=>m(He)&&m(He)(...z))},"✕")]),i("div",Ev,[i("div",Pv,[j[10]||(j[10]=i("label",{class:"f-label",for:"title"},"Left: name",-1)),i("input",{id:"title",value:m(u).layout?.title,maxlength:"60",placeholder:"For example: Living room",onInput:j[1]||(j[1]=z=>b(z.target.value))},null,40,Ov)]),i("div",Iv,[i("span",Mv,[j[11]||(j[11]=Z("Right: time, sensors, or a clock ",-1)),i("span",Lv," · "+v(n.value.length)+" / "+v(m(zt)()),1)]),i("div",Dv,[(p(!0),h(U,null,le(n.value,(z,ce)=>(p(),h("div",{key:m(qe)(z)+ce,class:ie(["item",{selected:ce===e.index,"is-hidden":!m(qt)(z).shown,"is-overflow":l.value.has(ce),"just-added":y(z),"dragging-chip":S.value.active&&S.value.index===ce}]),role:"listitem",tabindex:"0","data-index":ce,"aria-label":`${m(Vn)(z)}, slot ${ce+1}. Enter: configure, arrows: move`,onPointerdown:de=>O(de,ce),onClick:de=>$e(ce),onKeydown:de=>Me(de,ce)},[j[12]||(j[12]=i("span",{class:"grip","aria-hidden":"true"},"⋮⋮",-1)),i("span",{class:"av mdi",style:Pe(m(qt)(z).color?{color:m(qt)(z).color}:void 0)},v(c(z)?m(ke)(c(z)):""),5),i("span",Nv,[i("b",null,v(m(Vn)(z)),1),i("small",null,v(f(z,ce)),1)]),i("button",{type:"button",class:"x","aria-label":`Remove ${m(Vn)(z)} from the top bar`,onClick:dt(de=>m(rl)(ce),["stop"])},"✕",8,Rv)],42,Fv))),128)),i("button",{type:"button",class:"ghost-btn",id:"topbar-add",disabled:n.value.length>=m(zt)(),title:n.value.length>=m(zt)()?`Maximum ${m(zt)()} items`:"Add the time, date, analog clock, or an entity",onClick:j[2]||(j[2]=(...z)=>m(il)&&m(il)(...z))},"+ Add time, date, or an entity",8,Hv)]),i("small",{id:"topbar-hint",class:ie({warn:l.value.size>0&&r.value})},v(d.value),3)]),s.value?(p(),h(U,{key:0},[i("div",Uv,[i("small",null,v(I.value),1),_e(za,{items:[s.value],single:""},null,8,["items"])]),s.value.type==="entity"?(p(),h(U,{key:0},[i("div",jv,[j[13]||(j[13]=i("span",{class:"f-label"},"What to show",-1)),_e(tt,{choices:(m(u).inventory.header?.contents||[]).map(z=>[z.key,z.label]),value:s.value.content,onPick:j[3]||(j[3]=z=>k({content:z}))},null,8,["choices","value"]),j[14]||(j[14]=i("small",null,"Last changed keeps counting on the screen itself: “Just now”, “5 min ago”, “Yesterday”.",-1))]),_e(Ja,{selected:s.value.icon||"auto",automatic:m(u).topbarPreviews[m(qe)(s.value)]?.auto_icon||m(sn)(s.value.entity),"auto-label":"Automatic (like Home Assistant)","allow-none":"",onPick:j[4]||(j[4]=z=>k({icon:z}))},null,8,["selected","automatic"]),i("div",Bv,[j[15]||(j[15]=i("span",{class:"f-label"},"Show",-1)),_e(tt,{choices:(m(u).inventory.header?.shows||[]).map(z=>[z.key,z.label]),value:s.value.show,onPick:j[5]||(j[5]=z=>k({show:z}))},null,8,["choices","value"]),j[16]||(j[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"?(p(),h("div",Vv,[j[17]||(j[17]=i("span",{class:"f-label"},"Format",-1)),_e(tt,{choices:[["24","24 hour"],["12","12 hour"]],value:E.value?"24":"12",onPick:j[6]||(j[6]=z=>m(Wn)("clock_24h",z==="24",150))},null,8,["value"]),j[18]||(j[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))])):(p(),h("small",Wv,v(x.value.date)+" today. The date follows the screen's own clock.",1))],64)):R("",!0)]),s.value?(p(),h("div",Kv,[i("button",{type:"button",class:"btn danger",onClick:j[7]||(j[7]=z=>m(rl)(e.index))},"Remove"),j[19]||(j[19]=i("span",{class:"spacer"},null,-1)),i("button",{type:"button",class:"btn quiet",disabled:e.index===0,onClick:j[8]||(j[8]=z=>m(xo)(e.index,e.index-1)&&m(Lt)(e.index-1))},"↑ Up",8,qv),i("button",{type:"button",class:"btn quiet",disabled:e.index>=n.value.length-1,onClick:j[9]||(j[9]=z=>m(xo)(e.index,e.index+1)&&m(Lt)(e.index+1))},"↓ Down",8,Yv)])):R("",!0)],64))}}),Jv={class:"dr-head"},Gv={class:"tx"},Xv={class:"dr-body"},Zv={class:"f"},Qv={class:"options"},em=["disabled","onClick"],tm={class:"mdi"},nm={class:"tx"},sm={key:0,class:"f"},om={class:"options"},im=["disabled","onClick"],lm={class:"mdi"},am={class:"tx"},rm={class:"f"},um={class:"options"},cm=["disabled","onClick"],dm={class:"mdi"},fm={class:"tx"},pm={key:0,class:"hint"},hm={key:1,class:"hint"},vm={class:"dr-foot"},mm=Ee({__name:"TopbarAdd",setup(e){const t=pe(""),n=$(()=>new Set(Vt().map(qe))),s=$(()=>On().clock_24h!==!1),o=$(()=>({clock:ui(s.value,new Date(u.now)),analog:"Small dial with the time",date:ci(new Date(u.now))})),l=$(()=>u.inventory.header?.suggestions?.[u.selected||""]||[]),a=$(()=>{const d=t.value.trim().toLocaleLowerCase();return u.inventory.entities.filter(f=>`${f.name} ${f.id} ${f.area||""} ${f.device||""}`.toLocaleLowerCase().includes(d))}),r=d=>({type:"entity",entity:d,content:"state",icon:"auto",show:"always"});return(d,f)=>(p(),h(U,null,[i("div",Jv,[f[4]||(f[4]=i("span",{class:"av",style:{background:"var(--seg)",color:"var(--ink-2)","font-size":"18px"}},"+",-1)),i("span",Gv,[f[3]||(f[3]=i("b",null,"Add to the top bar",-1)),i("small",null,v(m(Vt)().length)+" of "+v(m(zt)())+" slots used",1)]),i("button",{type:"button",class:"icon-btn","aria-label":"Close",onClick:f[0]||(f[0]=(...c)=>m(He)&&m(He)(...c))},"✕")]),i("div",Xv,[i("div",Zv,[f[5]||(f[5]=i("span",{class:"f-label"},"From the screen itself",-1)),i("div",Qv,[(p(!0),h(U,null,le(m(u).inventory.header?.builtin||[],c=>(p(),h("button",{key:c.type,type:"button",class:"option",disabled:n.value.has(m(qe)({type:c.type})),onClick:y=>m(So)({type:c.type})},[i("span",tm,v(m(ke)(m(vs)(m(xa)[c.type])?.cp||"F0150")),1),i("span",nm,[i("strong",null,v(c.label),1),i("small",null,v(n.value.has(m(qe)({type:c.type}))?"Already added":o.value[c.type]),1)])],8,em))),128))])]),l.value.length?(p(),h("div",sm,[f[6]||(f[6]=i("span",{class:"f-label"},"Suggestions from Home Assistant",-1)),i("div",om,[(p(!0),h(U,null,le(l.value,c=>(p(),h("button",{key:m(qe)(c.item),type:"button",class:"option",disabled:n.value.has(m(qe)(c.item)),onClick:y=>m(So)(c.item)},[i("span",lm,v(m(ke)(c.icon||m(sn)(c.item.entity))),1),i("span",am,[i("strong",null,v(c.label),1),i("small",null,v(n.value.has(m(qe)(c.item))?"Already added":[c.name,c.area].filter(Boolean).join(" · ")),1)])],8,im))),128))])])):R("",!0),i("div",rm,[f[7]||(f[7]=i("label",{class:"f-label",for:"topbar-search"},"An entity",-1)),we(i("input",{id:"topbar-search","onUpdate:modelValue":f[1]||(f[1]=c=>t.value=c),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),[[Fe,t.value]]),i("div",um,[(p(!0),h(U,null,le(a.value.slice(0,40),c=>(p(),h("button",{key:c.id,type:"button",class:"option",disabled:n.value.has(m(qe)(r(c.id))),onClick:y=>m(So)(r(c.id))},[i("span",dm,v(m(ke)(m(sn)(c.id))),1),i("span",fm,[i("strong",null,v(c.name),1),i("small",null,v([c.area,c.id].filter(Boolean).join(" · ")),1)])],8,cm))),128)),a.value.length?a.value.length>40?(p(),h("p",hm,v(a.value.length)+" results. Keep typing to narrow it down.",1)):R("",!0):(p(),h("p",pm,"No entities found."))])])]),i("div",vm,[f[8]||(f[8]=i("span",{class:"spacer"},null,-1)),i("button",{type:"button",class:"btn quiet",onClick:f[2]||(f[2]=(...c)=>m(He)&&m(He)(...c))},"Cancel")])],64))}}),ym={class:"dr-head"},gm={class:"tx"},bm={class:"dr-body",id:"inspector-section"},wm={id:"inspection-summary"},_m={key:0,class:"hint warn"},km={key:1,class:"hint"},$m={id:"inspection"},xm=Ee({__name:"InspectPanel",props:{entity:{}},setup(e){const t=e,n=pe(null),s=pe("Reading…"),o=pe("");async function l(){if(u.selected){n.value=null,o.value="",s.value="Fetching current HA status...";try{const r=await yt(`screens/${encodeURIComponent(u.selected)}/inspect`),d=t.entity?r.tiles.filter(f=>f.entity===t.entity):r.tiles;n.value=d,s.value=JSON.stringify(t.entity?d[0]:r,null,2)}catch(r){o.value=r.message,s.value="",ge(r.message)}}}const a=r=>{const d=u.layout?.tiles.find(f=>f.entity===r)?.options||{};return`Small slider: ${d.inline==="slider"?"yes":"no"} · Display: ${Da[d.display||"standard"]||d.display} · Size: ${jc[d.size]||"normal"} · Control: ${Nc({entity:r,options:d},u.inventory)} · Background: ${u.inventory.backgrounds?.[d.background||"auto"]?.label||"Default"}`};return _n(l),pn(()=>t.entity,l),(r,d)=>(p(),h(U,null,[i("div",ym,[d[2]||(d[2]=i("span",{class:"av",style:{background:"var(--seg)",color:"var(--ink-2)","font-size":"16px"}},"⌕",-1)),i("span",gm,[d[1]||(d[1]=i("b",null,"Current data",-1)),i("small",{class:ie({mono:e.entity})},v(e.entity||"Connection, status, and supported properties"),3)]),i("button",{type:"button",class:"icon-btn","aria-label":"Close",onClick:d[0]||(d[0]=(...f)=>m(He)&&m(He)(...f))},"✕")]),i("div",bm,[i("div",wm,[o.value?(p(),h("p",_m,v(o.value),1)):n.value?R("",!0):(p(),h("p",km,"Fetching current HA status...")),(p(!0),h(U,null,le(n.value||[],(f,c)=>(p(),h("article",{key:c,class:"inspection-tile"},[i("strong",null,v(f.entity),1),i("span",null,"Status: "+v(f.word||f.state),1),i("small",null,v(a(f.entity)),1)]))),128))]),i("pre",$m,v(s.value),1)]),i("div",{class:"dr-foot"},[i("button",{type:"button",class:"btn quiet",onClick:l},"Read again"),d[3]||(d[3]=i("span",{class:"spacer"},null,-1))])],64))}}),Sm=["aria-hidden"],Cm=Ee({__name:"Drawer",setup(e){const t=$(()=>!!(u.inspector&&(u.inspector.kind!=="tile"||go.value)));return(n,s)=>(p(),h("aside",{class:ie(["drawer",{open:t.value}]),id:"tile-sheet","aria-hidden":t.value?"false":"true",onClick:s[0]||(s[0]=dt(()=>{},["stop"]))},[m(u).inspector?(p(),h(U,{key:0},[m(u).inspector.kind==="tile"&&m(go)?(p(),Xe(Sv,{key:0,tile:m(go)},null,8,["tile"])):m(u).inspector.kind==="bar"?(p(),Xe(zv,{key:1,index:m(u).inspector.index},null,8,["index"])):m(u).inspector.kind==="bar-add"?(p(),Xe(mm,{key:2})):m(u).inspector.kind==="inspect"?(p(),Xe(xm,{key:3,entity:m(u).inspector.entity},null,8,["entity"])):R("",!0)],64)):R("",!0)],10,Sm))}}),Tm={class:"main-head"},Am={class:"eyebrow",id:"screen-name"},Em=["title"],Pm={class:"head-right"},Om={class:"seg",role:"tablist"},Im=["aria-pressed"],Mm=["aria-pressed"],Lm={key:1,id:"dirty",class:"chip dirty"},Dm=["disabled"],Fm={key:0,class:"spin small"},Nm=["aria-expanded"],Rm={key:3,class:"menu",role:"menu"},Hm=["disabled","title"],Um=["disabled","aria-expanded"],jm={key:0,class:"sub"},Bm=["onClick"],Vm=["disabled","title"],Wm={class:"body",id:"body"},Km=Ee({__name:"ScreenView",setup(e){const t=$(()=>lt.value),n=$(()=>t.value.online?`${t.value.delivery} · ${t.value.status}`:"Offline · changes are saved"),s=$(()=>t.value.update?.available&&t.value.online&&t.value.update?.profile&&t.value.update?.host),o=$(()=>u.inventory.screens.filter(E=>E.id!==t.value.id&&E.layout?.tiles?.length)),l=pe(!1),a=pe(null);function r(){u.menuOpen=!1,l.value=!1}function d(){r(),u.overrideProfile=t.value.update?.profile||null,u.overrideFriendly=t.value.name,Oe("#override")}function f(){r(),u.selectedTile=null,u.inspector={kind:"inspect"}}function c(E){r(),!(u.dirty&&!confirm("Replace the unsaved layout with a copy of the other screen's?"))&&nd(E)}function y(){r(),a.value?.click()}async function b(E){const x=E.target,S=x.files?.[0];x.value="",S&&(u.dirty&&!confirm("Replace the unsaved layout with the imported one?")||od(await S.text()))}function k(E){if(E.key==="Escape")if(u.menuOpen)r();else{if(u.palette)return;u.inspector&&!E.target?.closest?.(".picker")&&He()}else(E.metaKey||E.ctrlKey)&&E.key.toLowerCase()==="s"&&(E.preventDefault(),u.dirty&&jo())}function I(E){u.menuOpen&&!E.target.closest(".head-right .menu, #more")&&r()}return _n(()=>{document.addEventListener("keydown",k),document.addEventListener("click",I)}),In(()=>{document.removeEventListener("keydown",k),document.removeEventListener("click",I)}),(E,x)=>(p(),h(U,null,[i("header",Tm,[i("div",null,[i("span",Am,v(t.value.name),1),i("h1",null,v(m(u).layout?.title||"Home"),1)]),i("span",{id:"delivery",class:ie(["chip",{off:!t.value.online}]),title:n.value},[x[9]||(x[9]=i("span",{class:"dot"},null,-1)),Z(v(n.value),1)],10,Em),i("div",Pm,[i("div",Om,[i("button",{type:"button",id:"tab-layout",role:"tab","aria-pressed":m(u).tab==="layout"?"true":"false",onClick:x[0]||(x[0]=S=>m(u).tab="layout")},"Layout",8,Im),i("button",{type:"button",id:"tab-settings",role:"tab","aria-pressed":m(u).tab==="settings"?"true":"false",onClick:x[1]||(x[1]=S=>{m(u).tab="settings",m(He)()})},"Screen settings",8,Mm)]),m(u).dirty?(p(),h("span",Lm,"Unsaved changes")):(p(),h("span",{key:0,id:"dirty",class:ie(["chip",{sent:m(u).saved}])},v(m(u).saved?"Saved · sent to screen":"All saved"),3)),m(u).dirty?(p(),h("button",{key:2,id:"save",type:"button",class:"btn primary",disabled:m(u).busy,title:"⌘S",onClick:x[2]||(x[2]=S=>m(jo)())},[m(u).busy?(p(),h("span",Fm)):R("",!0),Z(v(m(u).busy?"Saving…":"Save & send"),1)],8,Dm)):R("",!0),i("button",{id:"more",type:"button",class:"icon-btn","aria-label":"More","aria-haspopup":"menu","aria-expanded":m(u).menuOpen?"true":"false",onClick:x[3]||(x[3]=dt(S=>{m(u).menuOpen=!m(u).menuOpen,l.value=!1},["stop"]))},"···",8,Nm),m(u).menuOpen?(p(),h("div",Rm,[i("button",{type:"button",role:"menuitem",id:"identify",disabled:!m(gn)(t.value)||!t.value.online,title:m(gn)(t.value)?"":"Needs firmware 0.2.31 or newer",onClick:x[4]||(x[4]=S=>{r(),m(ja)(t.value)})},[...x[10]||(x[10]=[Z("Identify ",-1),i("small",null,"blink the screen",-1)])],8,Hm),i("button",{type:"button",role:"menuitem",id:"inspect",onClick:f},[...x[11]||(x[11]=[Z("Read current data ",-1),i("small",null,"from Home Assistant",-1)])]),x[17]||(x[17]=i("div",{class:"sep"},null,-1)),i("button",{type:"button",role:"menuitem",id:"copy-layout",disabled:!o.value.length,"aria-expanded":l.value?"true":"false",onClick:x[5]||(x[5]=dt(S=>l.value=!l.value,["stop"]))},[x[12]||(x[12]=Z("Copy layout from… ",-1)),i("small",null,v(o.value.length?`${o.value.length} screen${o.value.length===1?"":"s"}`:"no other screen"),1)],8,Um),l.value?(p(),h("div",jm,[(p(!0),h(U,null,le(o.value,S=>(p(),h("button",{key:S.id,type:"button",role:"menuitem",onClick:M=>c(S.id)},[Z(v(S.name)+" ",1),i("small",null,v(S.layout.tiles.length)+" tiles",1)],8,Bm))),128))])):R("",!0),i("button",{type:"button",role:"menuitem",id:"export-layout",onClick:x[6]||(x[6]=S=>{r(),m(Va)()})},[...x[13]||(x[13]=[Z("Export layout ",-1),i("small",null,"JSON",-1)])]),i("button",{type:"button",role:"menuitem",id:"import-layout",onClick:y},[...x[14]||(x[14]=[Z("Import layout… ",-1),i("small",null,"JSON",-1)])]),x[18]||(x[18]=i("div",{class:"sep"},null,-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:d},[...x[15]||(x[15]=[Z("Override YAML ",-1),i("small",null,"advanced",-1)])],8,Vm),i("button",{type:"button",role:"menuitem",onClick:x[7]||(x[7]=S=>{r(),m(Oe)("#firmware")})},"Firmware & USB"),s.value?(p(),h("button",{key:1,type:"button",role:"menuitem",onClick:x[8]||(x[8]=S=>{r(),m(Vo)(t.value)})},[x[16]||(x[16]=Z("Update firmware ",-1)),i("small",null,v(t.value.update?.target),1)])):R("",!0)])):R("",!0),i("input",{ref_key:"fileInput",ref:a,type:"file",accept:"application/json,.json",hidden:"",onChange:b},null,544)])]),i("div",Wm,[m(u).tab==="layout"?(p(),Xe(Zp,{key:0})):(p(),Xe(hh,{key:1})),_e(Cm)])],64))}}),qm={key:0,id:"choose",class:"empty"},Ym={key:1,id:"empty",class:"empty"},zm=Ee({__name:"EmptyState",setup(e){return(t,n)=>m(u).inventory.screens.length?(p(),h("section",qm,[...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)])])):(p(),h("section",Ym,[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=>m(Oe)("#new-screen"))},"Install new screen")]))}}),Jm={class:"panel",id:"settings-view"},Gm={class:"panel-head"},Xm={class:"card-grid"},Zm={class:"card"},Qm={class:"tools"},ey={key:0,class:"card updates",id:"updates"},ty={id:"updates-hint"},ny=["aria-valuenow"],sy={class:"progress-text"},oy={key:0,class:"log-lines"},iy={key:2,class:"whatsnew"},ly={class:"check"},ay=["checked"],ry={class:"card"},uy={class:"tools"},cy={class:"card",id:"claude"},dy={class:"actions"},fy=["disabled"],py={id:"claude-path"},hy=Ee({__name:"AppSettingsView",setup(e){const t=$(()=>u.inventory.updates),n=$(()=>u.inventory.screens.filter(y=>y.update?.available).length),s=$(()=>t.value?t.value.busy?`Updating to firmware ${t.value.target}…`:u.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=$(()=>u.inventory.screens.find(y=>y.update?.state==="running"||u.updating.includes(y.id))),l=$(()=>o.value?xn(o.value):null),a=$(()=>(u.firmwareJob?.logs||[]).slice(-12).join(`
`)),r=$(()=>{const y=u.inventory.changelog,b=t.value?.target;return!Array.isArray(y)||!b?[]:y.filter(k=>k.firmware===b).flatMap(k=>k.lines).slice(0,10)}),d=$(()=>u.inventory.claude_skill),f=pe(!1);async function c(){f.value=!0;try{await fd()}finally{f.value=!1}}return(y,b)=>(p(),h("div",Jm,[i("div",Gm,[b[6]||(b[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:b[0]||(b[0]=k=>m(Oe)(""))},"← My screens")]),i("div",Xm,[i("section",Zm,[b[9]||(b[9]=i("h2",null,"Screens",-1)),b[10]||(b[10]=i("p",null,"Add a screen, or build and reinstall the firmware of one you already have.",-1)),i("div",Qm,[i("button",{type:"button",class:"tool",onClick:b[1]||(b[1]=k=>m(Oe)("#new-screen"))},[...b[7]||(b[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:b[2]||(b[2]=k=>m(Oe)("#firmware"))},[...b[8]||(b[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?(p(),h("section",ey,[b[12]||(b[12]=i("h2",null,"Firmware updates",-1)),i("p",ty,v(s.value),1),o.value&&l.value?(p(),h(U,{key:0},[i("div",{class:"progress",role:"progressbar","aria-valuenow":l.value.percent,"aria-valuemin":"0","aria-valuemax":"100"},[i("i",{style:Pe({width:l.value.percent+"%"})},null,4)],8,ny),i("div",sy,[i("span",null,v(o.value.name)+" · "+v(l.value.percent)+" %",1),i("span",null,v(l.value.text),1)]),a.value?(p(),h("pre",oy,v(a.value),1)):R("",!0)],64)):R("",!0),t.value.pending&&!t.value.busy&&t.value.pending>=2?(p(),h("button",{key:1,id:"update-all",type:"button",class:"btn primary",onClick:b[3]||(b[3]=(...k)=>m(cl)&&m(cl)(...k))},"Update all "+v(t.value.pending)+" screens",1)):R("",!0),r.value.length&&!m(Bo)()?(p(),h("details",iy,[i("summary",null,"What's new in firmware "+v(t.value.target),1),i("ul",null,[(p(!0),h(U,null,le(r.value,k=>(p(),h("li",{key:k},v(k),1))),128))])])):R("",!0),i("label",ly,[i("input",{type:"checkbox",id:"auto-update",checked:!!t.value.auto,onChange:b[4]||(b[4]=k=>m(dd)(k.target.checked))},null,40,ay),b[11]||(b[11]=i("span",null,[Z("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))])])):R("",!0),i("section",ry,[b[14]||(b[14]=i("h2",null,"Alerts",-1)),b[15]||(b[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, and a form to try one.",-1)),i("div",uy,[i("button",{type:"button",class:"tool",onClick:b[5]||(b[5]=k=>m(Oe)("#alerts"))},[...b[13]||(b[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",cy,[b[18]||(b[18]=i("h2",null,"Claude",-1)),b[19]||(b[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",dy,[i("button",{type:"button",id:"claude-install",class:ie(["btn",d.value?.installed&&d.value.current?"quiet":"primary"]),disabled:!d.value||f.value,onClick:c},v(!d.value||!d.value.installed?"Install for Claude Code":d.value.current?"Install again":"Update the skill"),11,fy),i("span",{id:"claude-status",class:ie(["chip",d.value&&d.value.installed?d.value.current?"good":"update":""]),role:"status"},v(d.value?d.value.installed?d.value.current?"● Installed":"Installed · a newer version is ready":"Not installed":"Loading…"),3)]),i("small",null,[b[16]||(b[16]=Z("For Claude Code in Home Assistant. Writes one file to ",-1)),i("code",py,v(d.value?.path||"/homeassistant/.claude/skills/esp-screens"),1),b[17]||(b[17]=Z("; installing again replaces it.",-1))]),b[20]||(b[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))])])]))}}),vy={class:"panel",id:"installer"},my={class:"panel-head"},yy={class:"tx"},gy={id:"install-title"},by={key:0},wy={class:"boards"},_y={class:"board"},ky={class:"board"},$y={class:"field"},xy={class:"node-line"},Sy={id:"node-preview"},Cy={key:0,class:"field",id:"node-label"},Ty={key:1,id:"wifi-fields",class:"wifi"},Ay={class:"hint",id:"wifi-status"},Ey={key:0,class:"field",id:"wifi-ssid-label"},Py={key:1,class:"field",id:"wifi-password-label"},Oy={class:"field"},Iy={key:0,value:"usb"},My=["value"],Ly={id:"target-hint"},Dy={key:2,class:"hint",id:"install-note"},Fy={class:"actions"},Ny=["disabled"],Ry={id:"install-status",class:"status-line error",role:"status"},Hy={key:1,id:"install-progress",class:"card"},Uy={class:"progress-head"},jy={key:0,class:"spin",id:"progress-spin"},By={id:"progress-title"},Vy={id:"progress-detail"},Wy={key:0,id:"install-download",class:"card",style:{background:"var(--surface-2)"}},Ky=["href","download"],qy={class:"steps",id:"download-steps"},Yy={key:1,id:"install-result",class:"field"},zy={class:"key-box"},Jy={class:"steps",id:"install-steps"},Gy=["open"],Xy={id:"install-log",class:"log"},Zy={class:"actions"},Qy="https://web.esphome.io/?dashboard_install",eg="Download · flash from your own computer",tg=Ee({__name:"InstallerView",setup(e){const t=bn({board:"cyd",friendly_name:"",name:"",wifi_ssid:"",wifi_password:"",target:""}),n=bn({view:"setup",file:null,friendly:"",board:"cyd",target:"",apiKey:null,nodeEdited:!1,jobState:null,picked:!1,action:null}),s=pe(!1),o=pe(null),l=pe(null),a=pe([]),r=pe(""),d=pe(""),f=pe(!1),c=pe(!1),y=pe(null);let b=0;function k(me){return me.toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^[^a-z]+/,"").slice(0,30).replace(/-+$/,"")||"screen"}function I(me){const N=me.replace(/^\/dev\/serial\/by-id\/usb-/,"").replace(/-if\d+(-port\d+)?$/,"").replace(/_/g," ");return`USB · ${N===me?me.replace(/^\/dev\//,""):N}`}pn(()=>t.friendly_name,()=>{n.nodeEdited||(t.name=k(t.friendly_name))});const E=$(()=>t.name||"…"),x=$(()=>o.value?.ports||[]),S=$(()=>o.value?.wifi),M=$(()=>S.value?.state==="new"||S.value?.state==="missing"),G=$(()=>S.value?.missing||[]),C=$(()=>S.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."),V=$(()=>S.value?.state==="ready"?"Wi-Fi comes from your ESPHome secrets.yaml.":S.value?.state==="invalid"?"secrets.yaml in the ESPHome folder isn't valid YAML. Fix the file first; it won't be overwritten.":""),O=$(()=>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?x.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."),A=$(()=>t.target==="download"?"Build & download":t.target?"Install":"Save profile"),w=$(()=>o.value?.job?.state==="running"&&!(n.file&&o.value.job.file===n.file)),T=$(()=>f.value||S.value?.state==="invalid"||t.target==="usb"||!!t.target&&(w.value||!o.value?.available));function te(){const me=t.target;(me==="download"||me===""?n.picked:x.value.includes(me))||(t.target=x.value[0]||"usb")}async function $e(){let me;try{me=await yt("firmware")}catch(at){r.value=at.message;return}o.value=me;const N=me.job,fe=N&&n.file&&N.file===n.file;if(fe&&(n.jobState=N.state),n.view==="setup"){if(fe&&N.state==="running"){Me(N,me.logs||[]);return}te(),r.value=w.value?`A build or installation is already running (${N.file}). Wait for it to finish.`:!me.available&&t.target?"The ESPHome CLI is missing from this installation; only saving the profile is possible.":V.value}else n.view==="progress"&&fe&&(l.value=N,a.value=me.logs||[],N.state!=="running"&&N.state!=="success"&&(c.value=!0))}function Me(me,N){n.view="progress",n.jobState=me.state,n.action=me.action,l.value=me,a.value=N}const X=$(()=>l.value?.state==="running"),j=$(()=>n.view==="done"||l.value?.state==="success"),z=$(()=>n.action==="download"),ce=$(()=>n.view==="done"?"Profile saved.":X.value?"One moment…":j.value?z.value?"Ready to download.":"Done.":"That didn't work."),de=$(()=>n.view==="done"?`${n.file} is in the ESPHome folder`:X.value?l.value?.stage==="upload"?`Writing firmware to ${n.friendly}…`:"Building firmware…":j.value?z.value?`Firmware for ${n.friendly} is ready`:`Firmware is on ${n.friendly}`:z.value?"Build failed":"Install failed"),he=$(()=>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:":X.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 ${z.value?"build":"installation"} keeps running and you'll find it again under New screen.`:j.value?z.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:`:a.value.filter(me=>/error/i.test(me)).pop()||a.value.filter(me=>/failed/i.test(me)).pop()||"See the log below."),Q=$(()=>({href:`api/firmware/profiles/${encodeURIComponent(n.file||"")}/download`,name:(n.file||"").replace(/\.yaml$/,"")+".factory.bin"})),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 B(me){const N=me.target;if(n.nodeEdited||(t.name=k(t.friendly_name)),!!N.reportValidity()){f.value=!0,d.value="";try{const fe={board:t.board,friendly_name:t.friendly_name,name:t.name,target:t.target};M.value&&(G.value.includes("wifi_ssid")&&(fe.wifi_ssid=t.wifi_ssid),G.value.includes("wifi_password")&&(fe.wifi_password=t.wifi_password));const at=await it("firmware/profiles","POST",fe);Object.assign(n,{file:at.file,apiKey:at.api_key,friendly:t.friendly_name.trim(),board:t.board,target:t.target}),t.wifi_password="",at.job?Me(at.job,[]):n.view="done"}catch(fe){d.value=fe.message}finally{f.value=!1}}}async function ne(){try{if(!z.value){const{ports:N}=await yt("firmware");!N.includes(n.target)&&N.length===1&&(n.target=N[0])}const me=await it("firmware/jobs","POST",z.value?{file:n.file,action:"download"}:{file:n.file,action:"install",target:n.target});Me(me,[])}catch(me){ge(me.message)}}function Qe(){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,a.value=[],d.value="",r.value="",c.value=!1,$e()}function Mn(){n.view==="progress"&&n.jobState!=="running"&&(n.view="done"),Oe("")}return _n(()=>{$e(),b=window.setInterval($e,3e3)}),In(()=>clearInterval(b)),(me,N)=>(p(),h("div",vy,[i("div",my,[i("div",yy,[N[13]||(N[13]=i("span",{class:"eyebrow"},"New screen",-1)),i("h1",gy,v(n.view==="setup"?"Connect and install.":ce.value),1),n.view==="setup"?(p(),h("p",by,"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.")):R("",!0)]),i("button",{type:"button",class:"btn quiet",id:"close-install","aria-label":"Close",onClick:Mn},"← Back")]),n.view==="setup"?(p(),h("form",{key:0,id:"install-form",class:"card",onSubmit:dt(B,["prevent"])},[i("fieldset",null,[N[16]||(N[16]=i("legend",null,"Which screen do you have?",-1)),i("div",wy,[i("label",_y,[we(i("input",{type:"radio",name:"board",value:"cyd","onUpdate:modelValue":N[0]||(N[0]=fe=>t.board=fe)},null,512),[[Xi,t.board]]),N[14]||(N[14]=i("span",null,[i("b",null,"CYD · 2.8 inch"),i("small",null,"ESP32-2432S028 · 320 × 240")],-1))]),i("label",ky,[we(i("input",{type:"radio",name:"board",value:"guition","onUpdate:modelValue":N[1]||(N[1]=fe=>t.board=fe)},null,512),[[Xi,t.board]]),N[15]||(N[15]=i("span",null,[i("b",null,"Guition · 4 inch"),i("small",null,"ESP32-S3-4848S040 · 480 × 480 · GT911")],-1))])])]),i("div",$y,[N[18]||(N[18]=i("label",{class:"f-label",for:"friendly_name"},"Name",-1)),we(i("input",{id:"friendly_name",name:"friendly_name","onUpdate:modelValue":N[2]||(N[2]=fe=>t.friendly_name=fe),required:"",maxlength:"60",placeholder:"Living room screen",autocomplete:"off"},null,512),[[Fe,t.friendly_name]]),i("small",xy,[N[17]||(N[17]=Z("Device name ",-1)),i("code",Sy,v(E.value),1),i("button",{type:"button",class:"btn link mini",id:"edit-node",onClick:N[3]||(N[3]=fe=>{n.nodeEdited=!0,s.value=!0})},"customize")]),N[19]||(N[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?(p(),h("div",Cy,[N[20]||(N[20]=i("label",{class:"f-label",for:"node-name"},"Device name",-1)),we(i("input",{id:"node-name",name:"name","onUpdate:modelValue":N[4]||(N[4]=fe=>t.name=fe),pattern:"[a-z][a-z0-9\\-]{0,29}",maxlength:"30",autocomplete:"off",onInput:N[5]||(N[5]=fe=>n.nodeEdited=!0)},null,544),[[Fe,t.name]]),N[21]||(N[21]=i("small",null,"Lowercase letters, digits, and dashes. A different name for each screen.",-1))])):R("",!0),M.value?(p(),h("fieldset",Ty,[N[24]||(N[24]=i("legend",null,"Wi-Fi",-1)),i("p",Ay,v(C.value),1),G.value.includes("wifi_ssid")?(p(),h("div",Ey,[N[22]||(N[22]=i("label",{class:"f-label",for:"wifi_ssid"},"Wi-Fi name (2.4 GHz)",-1)),we(i("input",{id:"wifi_ssid",name:"wifi_ssid","onUpdate:modelValue":N[6]||(N[6]=fe=>t.wifi_ssid=fe),autocomplete:"off"},null,512),[[Fe,t.wifi_ssid]])])):R("",!0),G.value.includes("wifi_password")?(p(),h("div",Py,[N[23]||(N[23]=i("label",{class:"f-label",for:"wifi_password"},"Wi-Fi password",-1)),we(i("input",{id:"wifi_password",name:"wifi_password",type:"password","onUpdate:modelValue":N[7]||(N[7]=fe=>t.wifi_password=fe),autocomplete:"new-password"},null,512),[[Fe,t.wifi_password]])])):R("",!0)])):R("",!0),i("div",Oy,[N[26]||(N[26]=i("label",{class:"f-label",for:"install-target"},"Install via",-1)),we(i("select",{id:"install-target",name:"target","onUpdate:modelValue":N[8]||(N[8]=fe=>t.target=fe),onChange:N[9]||(N[9]=fe=>{n.picked=!0,$e()})},[x.value.length?R("",!0):(p(),h("option",Iy,"USB · no board found on the Home Assistant machine yet")),(p(!0),h(U,null,le(x.value,fe=>(p(),h("option",{key:fe,value:fe},v(I(fe)),9,My))),128)),i("option",{value:"download"},v(eg)),N[25]||(N[25]=i("option",{value:""},"Later · save profile only",-1))],544),[[vn,t.target]]),i("small",Ly,v(O.value),1)]),r.value?(p(),h("p",Dy,v(r.value),1)):R("",!0),i("div",Fy,[i("button",{type:"submit",class:"btn primary",id:"install-go",disabled:T.value},v(A.value),9,Ny),i("span",Ry,v(d.value),1)])],32)):(p(),h("div",Hy,[i("div",Uy,[X.value?(p(),h("span",jy)):(p(),h("span",{key:1,class:ie(["outcome",j.value?"ok":"bad"]),id:"progress-mark"},v(j.value?"✓":"✕"),3)),i("strong",By,v(de.value),1)]),i("p",Vy,v(he.value),1),j.value&&z.value&&n.view!=="done"?(p(),h("div",Wy,[i("a",{class:"btn primary",id:"download-firmware",href:Q.value.href,download:Q.value.name},"Download "+v(Q.value.name),9,Ky),i("ol",qy,[N[30]||(N[30]=i("li",null,[i("b",null,"Plug the screen into your computer"),Z(" with a USB data cable.")],-1)),i("li",null,[i("b",null,[N[27]||(N[27]=Z("Open ",-1)),i("a",{href:Qy,target:"_blank",rel:"noopener"},"ESPHome Web")]),N[28]||(N[28]=Z(" in Chrome or Edge, click Connect and choose the screen's USB port.",-1))]),i("li",null,[N[29]||(N[29]=i("b",null,"Click Install",-1)),Z(" and select "+v(Q.value.name)+". The screen restarts and joins your Wi-Fi."+v(n.board==="cyd"?" The CYD first asks for a touch calibration: tap the crosshairs.":""),1)])]),N[31]||(N[31]=i("small",null,"The file holds your Wi-Fi password and the screen's keys: keep it to yourself.",-1))])):R("",!0),j.value?(p(),h("div",Yy,[i("div",zy,[N[32]||(N[32]=i("span",null,"API key",-1)),i("code",{id:"api-key",ref_key:"keyBox",ref:y},v(n.apiKey||""),513),i("button",{type:"button",class:"btn quiet mini",id:"copy-key",onClick:N[10]||(N[10]=fe=>m(ft)(n.apiKey||"",y.value))},"Copy")]),i("ol",Jy,[(p(!0),h(U,null,le(K.value,([fe,at],Ln)=>(p(),h("li",{key:Ln},[i("b",null,v(fe),1),Z(v(at),1),Ln===0?(p(),h("button",{key:0,type:"button",class:"btn quiet mini",onClick:N[11]||(N[11]=(...ln)=>m(Fs)&&m(Fs)(...ln))},"Open Devices & services")):R("",!0)]))),128))])])):R("",!0),n.view!=="done"?(p(),h("details",{key:2,id:"install-log-wrap",class:"log-wrap",open:c.value,onToggle:N[12]||(N[12]=fe=>c.value=fe.target.open)},[N[33]||(N[33]=i("summary",null,"ESPHome log",-1)),i("pre",Xy,v(a.value.join(`
`)),1)],40,Gy)):R("",!0),i("div",Zy,[!X.value&&!j.value?(p(),h("button",{key:0,type:"button",class:"btn primary",id:"install-retry",onClick:ne},"Retry")):R("",!0),i("button",{type:"button",class:"btn quiet",id:"install-close",onClick:Qe},v(j.value?"Install another screen":"Start over"),1),i("button",{type:"button",class:ie(["btn",j.value?"primary":"quiet"]),onClick:Mn},v(j.value?"Done":"Close"),3)])]))]))}}),ng={class:"panel",id:"firmware-dialog"},sg={class:"panel-head"},og={class:"card"},ig={class:"card-grid"},lg={class:"field"},ag=["value"],rg={class:"field"},ug={key:0,value:"usb"},cg=["value"],dg={key:0,class:"field",id:"firmware-host-label"},fg=["placeholder"],pg={class:"actions"},hg=["disabled"],vg=["disabled"],mg=["disabled"],yg={key:0,class:"spin"},gg={id:"firmware-status",class:"status-line",role:"status"},bg={key:0,id:"firmware-download",class:"card",style:{background:"var(--surface-2)"}},wg=["href","download"],_g={id:"firmware-log",class:"log"},kg="https://web.esphome.io/?dashboard_install",$g="Download · flash from your own computer",xg=Ee({__name:"FirmwareView",setup(e){const t=pe(null),n=pe(""),s=pe("ota"),o=pe("");let l=0;async function a(E=!1){try{const x=await yt("firmware");t.value=x,(E||!n.value)&&(n.value=x.profiles[0]?.file||"");const S=x.ports||[];s.value.startsWith("/")&&!S.includes(s.value)&&(s.value=S[0]||"usb"),s.value==="usb"&&S.length&&(s.value=S[0])}catch(x){ge(x.message)}}const r=$(()=>t.value?.job?.state==="running"),d=$(()=>!t.value||r.value||!t.value.available||!t.value.profiles?.length),f=$(()=>d.value||s.value==="usb"),c=$(()=>t.value?.ports||[]),y=$(()=>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…"),b=$(()=>s.value==="download"&&!!n.value&&!!t.value?.downloads?.includes(n.value)),k=$(()=>({href:`api/firmware/profiles/${encodeURIComponent(n.value)}/download`,name:n.value.replace(/\.yaml$/,"")+".factory.bin"}));async function I(E){try{await it("firmware/jobs","POST",{file:n.value,action:E==="validate"?"validate":E==="build"?"build":s.value==="download"?"download":"install",target:s.value==="ota"?o.value.trim():s.value==="download"?"":s.value}),await a()}catch(x){ge(x.message)}}return _n(()=>{a(!0),l=window.setInterval(()=>a(),3e3)}),In(()=>clearInterval(l)),(E,x)=>(p(),h("div",ng,[i("div",sg,[x[7]||(x[7]=Cs('<div class="tx"><span class="eyebrow">Firmware &amp; 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&#39;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 &amp; 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:x[0]||(x[0]=S=>m(Oe)(""))},"← Back")]),i("div",og,[i("div",ig,[i("div",lg,[x[8]||(x[8]=i("label",{class:"f-label",for:"firmware-file"},"ESPHome profile",-1)),we(i("select",{id:"firmware-file","onUpdate:modelValue":x[1]||(x[1]=S=>n.value=S)},[(p(!0),h(U,null,le(t.value?.profiles||[],S=>(p(),h("option",{key:S.file,value:S.file},v(S.file),9,ag))),128))],512),[[vn,n.value]])]),i("div",rg,[x[10]||(x[10]=i("label",{class:"f-label",for:"firmware-port"},"Install to",-1)),we(i("select",{id:"firmware-port","onUpdate:modelValue":x[2]||(x[2]=S=>s.value=S)},[x[9]||(x[9]=i("option",{value:"ota"},"Wi-Fi / OTA",-1)),c.value.length?R("",!0):(p(),h("option",ug,"USB · no board found on the Home Assistant machine yet")),(p(!0),h(U,null,le(c.value,S=>(p(),h("option",{key:S,value:S},v(S),9,cg))),128)),i("option",{value:"download"},v($g))],512),[[vn,s.value]])]),s.value==="ota"?(p(),h("div",dg,[x[11]||(x[11]=i("label",{class:"f-label",for:"firmware-host"},"IP address or hostname",-1)),we(i("input",{id:"firmware-host","onUpdate:modelValue":x[3]||(x[3]=S=>o.value=S),placeholder:n.value?n.value.replace(/\.yaml$/,".local"):"screen-livingroom.local"},null,8,fg),[[Fe,o.value]])])):R("",!0)]),i("div",pg,[i("button",{type:"button",class:"btn quiet",id:"firmware-validate",disabled:d.value,onClick:x[4]||(x[4]=S=>I("validate"))},"Check",8,hg),i("button",{type:"button",class:"btn quiet",id:"firmware-build",disabled:d.value,onClick:x[5]||(x[5]=S=>I("build"))},"Build only",8,vg),i("button",{type:"button",class:"btn primary",id:"firmware-install",disabled:f.value,onClick:x[6]||(x[6]=S=>I("install"))},v(s.value==="download"?"Build & download":"Build & install"),9,mg),r.value?(p(),h("span",yg)):R("",!0)]),i("p",gg,v(y.value),1),b.value?(p(),h("div",bg,[i("a",{class:"btn primary",id:"firmware-download-link",href:k.value.href,download:k.value.name},"Download "+v(k.value.name),9,wg),i("small",null,[x[12]||(x[12]=Z("Put it on the screen with ",-1)),i("a",{href:kg,target:"_blank",rel:"noopener"},"ESPHome Web"),x[13]||(x[13]=Z(" 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))])])):R("",!0)]),i("pre",_g,v((t.value?.logs||[]).join(`
`)),1)]))}}),Sg={class:"panel wide alerts",id:"alerts-dialog"},Cg={class:"panel-head"},Tg={key:0,class:"hint"},Ag={class:"alert-hero"},Eg={class:"alert-mock",id:"alert-mock","aria-hidden":"true"},Pg={class:"mdi alert-mock-icon",id:"alert-mock-icon"},Og={class:"alerts-nav","aria-label":"Sections"},Ig=["data-jump","onClick"],Mg={id:"alerts-try",class:"card"},Lg={class:"field"},Dg={value:"all"},Fg=["value","disabled"],Ng={class:"field"},Rg={class:"field"},Hg={class:"field"},Ug={id:"try-icons"},jg=["value"],Bg={class:"field"},Vg=["value"],Wg={class:"field"},Kg={class:"field"},qg={class:"check field"},Yg={class:"actions field wide"},zg=["disabled"],Jg={class:"status-line",id:"try-result",role:"status"},Gg={id:"alerts-screens",class:"card"},Xg={id:"alerts-min-firmware"},Zg={id:"alerts-screen-list",class:"options"},Qg={key:0,class:"hint"},eb={class:"alert-screen-head"},tb={class:"copy-label"},nb=["onClick"],sb={id:"alerts-howto",class:"card"},ob={class:"field"},ib=["value"],lb={key:0,value:""},ab={class:"copy-line"},rb={id:"alerts-example"},ub={id:"alerts-all",class:"card"},cb={id:"alerts-all-event"},db={id:"alerts-all-dismiss"},fb={class:"copy-line"},pb={id:"alerts-all-example"},hb={id:"alerts-fields",class:"card"},vb={class:"table-scroll"},mb={id:"alerts-field-table"},yb={key:0},gb={id:"alerts-icons",class:"card"},bb={class:"chips",id:"alerts-suggested"},wb=["onClick"],_b={class:"mdi"},kb={class:"field"},$b={id:"alerts-icon-groups"},xb={class:"subhead"},Sb={class:"alert-icon-grid"},Cb=["title","onClick"],Tb={class:"mdi"},Ab={key:0},Eb={key:0,class:"hint"},Pb={id:"alerts-colors",class:"card"},Ob={class:"swatches",id:"alerts-swatches"},Ib=["onClick"],Mb={id:"alerts-events",class:"card"},Lb={id:"alerts-event-name"},Db={class:"table-scroll"},Fb={id:"alerts-ending-table"},Nb={class:"copy-line"},Rb={id:"alerts-wait-example"},Hb={id:"alerts-tips",class:"card"},Ub={class:"alerts-list"},jb=Ee({__name:"AlertsView",setup(e){const t=$(()=>u.inventory.alerts),n=bn({screen:"all",title:"Someone is at the door",subtitle:"Door 3, back",icon:"doorbell",color:"orange",button_text:"Coming",timeout:30,flash:!0}),s=pe(!1),o=pe(""),l=$(()=>u.inventory.screens.filter(A=>gn(A)&&A.online));async function a(){s.value=!0,o.value="";try{const{screen:A,...w}=n,T=await ed(A,w),te=A==="all"?`${T.sent} screen${T.sent===1?"":"s"}`:u.inventory.screens.find($e=>$e.id===A)?.name||"the screen";o.value=T.sent?`Sent to ${te}.${T.skipped?` ${T.skipped} skipped (offline or old firmware).`:""}${T.unusable?.length?` Left empty: ${T.unusable.join(", ")}.`:""}`:"No screen could show it: check that a screen is online with firmware "+(t.value?.min_firmware||"0.2.31")+" or newer."}catch(A){o.value=A.message}finally{s.value=!1}}const r=$(()=>u.inventory.icons),d=pe(""),f=pe(""),c=A=>`"${String(A).replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,y=A=>A.type==="string"?/^[a-z][a-z0-9-]*$/.test(A.example)?A.example:c(A.example):A.example===!0?"true":A.example===!1?"false":String(A.example),b=$(()=>u.inventory.screens.filter(A=>A.alert_action)),k=$(()=>d.value||b.value[0]?.alert_action||""),I=$(()=>{const A=(t.value?.fields||[]).map(w=>` ${w.name}: ${y(w)}`);return`action: ${k.value||"esphome.<device_name>_show_alert"}
data:
${A.join(`
`)}`}),E=$(()=>["# Doorbell: show the alert and wait until someone presses the button.","actions:",` - action: ${k.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(`
`)),x=$(()=>{const A=(t.value?.fields||[]).map(T=>` ${T.name}: ${y(T)}`),w=t.value?.camera;return w&&A.push(` # ${w.name}: ${w.example} # a Guition shows its picture on the card`),`event: ${t.value?.broadcast?.show||"esp_screens_show_alert"}
event_data:
${A.join(`
`)}`}),S=$(()=>{if(!t.value||!r.value)return[];const A=f.value.trim().toLowerCase();return[...r.value.groups,{label:"Also available: control and weather icons",icons:t.value.extra_icons}].map(T=>({label:T.label,icons:T.icons.filter(te=>!A||te.name.includes(A)||(te.label||"").toLowerCase().includes(A))})).filter(T=>T.icons.length)}),M=$(()=>t.value?.suggested_icons?.find(A=>A.name==="doorbell")),G=$(()=>t.value?.colors?.find(A=>A.name==="orange")),C={string:"text",int:"number",bool:"on / off"};function V(A){document.getElementById(A)?.scrollIntoView({behavior:"smooth",block:"start"})}const O=[["alerts-try","Try it"],["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(A,w)=>(p(),h("div",Sg,[i("div",Cg,[w[15]||(w[15]=i("div",{class:"tx"},[i("span",{class:"eyebrow"},"Alerts · cheatsheet"),i("h1",null,"A full-screen notification, from an automation."),i("p",null,[Z("Every screen has the "),i("code",null,"show_alert"),Z(" 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]=T=>m(Oe)(""))},"← Back")]),t.value?(p(),h(U,{key:1},[i("div",Ag,[i("div",Eg,[i("div",{class:"alert-mock-card",style:Pe(G.value?{background:G.value.color}:void 0)},[i("span",Pg,v(M.value?m(ke)(M.value.cp):""),1),w[16]||(w[16]=i("strong",{id:"alert-mock-title"},"Someone is at the door",-1)),w[17]||(w[17]=i("span",{id:"alert-mock-subtitle"},"Door 3, back",-1)),w[18]||(w[18]=i("span",{class:"fake",id:"alert-mock-button"},"Coming",-1))],4)]),i("nav",Og,[(p(),h(U,null,le(O,([T,te])=>i("button",{key:T,type:"button","data-jump":T,onClick:$e=>V(T)},v(te),9,Ig)),64))])]),i("section",Mg,[w[28]||(w[28]=i("h2",null,"Try it",-1)),w[29]||(w[29]=i("p",null,"Send one alert now, with the same fields an automation sends. The screen shows the card and, with blinking on, flashes its backlight.",-1)),i("form",{class:"try-grid",onSubmit:dt(a,["prevent"])},[i("div",Lg,[w[19]||(w[19]=i("label",{class:"f-label",for:"try-screen"},"Screen",-1)),we(i("select",{id:"try-screen","onUpdate:modelValue":w[1]||(w[1]=T=>n.screen=T)},[i("option",Dg,"All screens ("+v(l.value.length)+" ready)",1),(p(!0),h(U,null,le(m(u).inventory.screens,T=>(p(),h("option",{key:T.id,value:T.id,disabled:!m(gn)(T)||!T.online},v(T.name)+v(m(gn)(T)&&T.online?"":" · not ready"),9,Fg))),128))],512),[[vn,n.screen]])]),i("div",Ng,[w[20]||(w[20]=i("label",{class:"f-label",for:"try-title"},"Title",-1)),we(i("input",{id:"try-title","onUpdate:modelValue":w[2]||(w[2]=T=>n.title=T),maxlength:"64"},null,512),[[Fe,n.title]])]),i("div",Rg,[w[21]||(w[21]=i("label",{class:"f-label",for:"try-subtitle"},"Subtitle",-1)),we(i("input",{id:"try-subtitle","onUpdate:modelValue":w[3]||(w[3]=T=>n.subtitle=T),maxlength:"240"},null,512),[[Fe,n.subtitle]])]),i("div",Hg,[w[22]||(w[22]=i("label",{class:"f-label",for:"try-icon"},"Icon",-1)),we(i("input",{id:"try-icon","onUpdate:modelValue":w[4]||(w[4]=T=>n.icon=T),list:"try-icons",placeholder:"doorbell"},null,512),[[Fe,n.icon]]),i("datalist",Ug,[(p(!0),h(U,null,le(t.value.suggested_icons,T=>(p(),h("option",{key:T.name,value:T.name},v(T.label||T.name),9,jg))),128))])]),i("div",Bg,[w[24]||(w[24]=i("label",{class:"f-label",for:"try-color"},"Color",-1)),we(i("select",{id:"try-color","onUpdate:modelValue":w[5]||(w[5]=T=>n.color=T)},[w[23]||(w[23]=i("option",{value:""},"White (default)",-1)),(p(!0),h(U,null,le(t.value.colors,T=>(p(),h("option",{key:T.name,value:T.name},v(T.label),9,Vg))),128))],512),[[vn,n.color]])]),i("div",Wg,[w[25]||(w[25]=i("label",{class:"f-label",for:"try-button"},"Button text",-1)),we(i("input",{id:"try-button","onUpdate:modelValue":w[6]||(w[6]=T=>n.button_text=T),maxlength:"16"},null,512),[[Fe,n.button_text]])]),i("div",Kg,[w[26]||(w[26]=i("label",{class:"f-label",for:"try-timeout"},"Timeout (seconds, 0 waits for the button)",-1)),we(i("input",{id:"try-timeout","onUpdate:modelValue":w[7]||(w[7]=T=>n.timeout=T),type:"number",min:"0",max:"86400"},null,512),[[Fe,n.timeout,void 0,{number:!0}]])]),i("label",qg,[we(i("input",{type:"checkbox",id:"try-flash","onUpdate:modelValue":w[8]||(w[8]=T=>n.flash=T)},null,512),[[hc,n.flash]]),w[27]||(w[27]=i("span",null,[Z("Blink the backlight"),i("small",null,"Four times when the alert arrives.")],-1))]),i("div",Yg,[i("button",{type:"submit",class:"btn primary",id:"try-send",disabled:s.value||!l.value.length},v(s.value?"Sending…":"Send alert"),9,zg),i("span",Jg,v(o.value),1)])],32)]),i("section",Gg,[w[32]||(w[32]=i("h2",null,"Your screens",-1)),i("p",null,[w[30]||(w[30]=Z("Every screen has its own action, with the device name in it. From firmware ",-1)),i("code",Xg,v(t.value.min_firmware),1),w[31]||(w[31]=Z("; update an older screen with its Update button under Screens.",-1))]),i("div",Zg,[m(u).inventory.screens.length?R("",!0):(p(),h("p",Qg,"No screen paired yet. Install one via New screen; the action appears once Home Assistant sees the screen.")),(p(!0),h(U,null,le(m(u).inventory.screens,T=>(p(),h("div",{key:T.id,class:"alert-screen"},[i("div",eb,[i("strong",null,v(T.name),1),i("span",{class:ie(["chip",m(nn)(m(ls)(T),t.value.min_firmware)&&T.alert_action?"good":"update"])},v(m(nn)(m(ls)(T),t.value.min_firmware)&&T.alert_action?`● firmware ${T.firmware}`:T.alert_action?`Update needed · firmware ${T.firmware||"unknown"}`:"Device name unknown · update the screen"),3)]),(p(!0),h(U,null,le([["Show alert",T.alert_action],["Dismiss alert",T.dismiss_action]],([te,$e])=>(p(),h("div",{key:te,class:"copy-line"},[i("span",tb,v(te),1),i("code",null,v($e||"esphome.<device_name>_show_alert"),1),$e?(p(),h("button",{key:0,type:"button",class:"btn quiet mini",onClick:Me=>m(ft)($e,void 0,"Action name")},"Copy",8,nb)):R("",!0)]))),128))]))),128))])]),i("section",sb,[w[34]||(w[34]=Cs('<h2>In an automation</h2><ol class="steps"><li><b>Add action</b> and search for <b>ESPHome</b>. Choose your screen&#39;s action: Home Assistant calls it &quot;Performs the action show_alert of the node <i>device name</i>&quot;.</li><li><b>Fill in the fields.</b> Home Assistant asks for all seven; leave what you don&#39;t use empty (<code>&quot;&quot;</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",ob,[w[33]||(w[33]=i("label",{class:"f-label",for:"alerts-example-screen"},"Example for",-1)),we(i("select",{id:"alerts-example-screen","onUpdate:modelValue":w[9]||(w[9]=T=>d.value=T),style:{"max-width":"360px"}},[(p(!0),h(U,null,le(b.value,T=>(p(),h("option",{key:T.id,value:T.alert_action},v(T.name),9,ib))),128)),b.value.length?R("",!0):(p(),h("option",lb,"a screen (not paired yet)"))],512),[[vn,d.value]])]),i("div",ab,[i("pre",rb,v(I.value),1),i("button",{type:"button",class:"btn quiet mini",id:"alerts-example-copy",onClick:w[10]||(w[10]=T=>m(ft)(I.value,void 0,"YAML"))},"Copy YAML")])]),i("section",ub,[w[42]||(w[42]=i("h2",null,"All screens at once",-1)),i("p",null,[w[35]||(w[35]=Z("Fire the event ",-1)),i("code",cb,v(t.value.broadcast?.show||"esp_screens_show_alert"),1),w[36]||(w[36]=Z(" 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",db,v(t.value.broadcast?.dismiss||"esp_screens_dismiss_alert"),1),w[37]||(w[37]=Z(" clears it everywhere. In an automation, add the ",-1)),w[38]||(w[38]=i("b",null,"Event",-1)),w[39]||(w[39]=Z(" action or paste the example under ",-1)),w[40]||(w[40]=i("b",null,"Edit in YAML",-1)),w[41]||(w[41]=Z(". Leave out the fields you don't use. ESP Screens has to be running for this.",-1))]),i("div",fb,[i("pre",pb,v(x.value),1),i("button",{type:"button",class:"btn quiet mini",id:"alerts-all-copy",onClick:w[11]||(w[11]=T=>m(ft)(x.value,void 0,"YAML"))},"Copy YAML")])]),i("section",hb,[w[46]||(w[46]=i("h2",null,"The fields",-1)),w[47]||(w[47]=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",vb,[i("table",mb,[w[45]||(w[45]=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)),(p(!0),h(U,null,le(t.value.fields,T=>(p(),h("tr",{key:T.name},[i("td",null,[i("code",null,v(T.name),1),i("small",null,v(T.label),1)]),i("td",null,v(C[T.type]||T.type),1),i("td",null,v(T.help),1),i("td",null,[i("code",null,v(typeof T.example=="string"?T.example:String(T.example)),1)]),i("td",null,v(t.value.limits.cyd[T.name]?`CYD ${t.value.limits.cyd[T.name]} · Guition ${t.value.limits.guition[T.name]} bytes`:T.type==="int"?"0 to 86400 s":"—"),1)]))),128)),t.value.camera?(p(),h("tr",yb,[i("td",null,[i("code",null,v(t.value.camera.name),1),i("small",null,v(t.value.camera.label),1)]),w[43]||(w[43]=i("td",null,"entity",-1)),i("td",null,v(t.value.camera.help),1),i("td",null,[i("code",null,v(t.value.camera.example),1)]),w[44]||(w[44]=i("td",null,"Guition, firmware 0.2.57+",-1))])):R("",!0)])])]),i("section",gb,[w[49]||(w[49]=i("h2",null,"Icons",-1)),w[50]||(w[50]=i("p",null,[Z("Fill in the name in "),i("code",null,"icon"),Z(", for example "),i("code",null,"doorbell"),Z(". "),i("code",null,"mdi:doorbell"),Z(" and the hex codepoint ("),i("code",null,"F12E6"),Z(") 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[51]||(w[51]=i("p",{class:"subhead"},"Handy for notifications",-1)),i("div",bb,[(p(!0),h(U,null,le(t.value.suggested_icons,T=>(p(),h("button",{key:T.name,type:"button",class:"chip",onClick:te=>m(ft)(T.name,void 0,"Icon name")},[i("span",_b,v(m(ke)(T.cp)),1),i("code",null,v(T.name),1)],8,wb))),128))]),i("div",kb,[w[48]||(w[48]=i("label",{class:"f-label",for:"alerts-icon-search"},"Search for an icon",-1)),we(i("input",{id:"alerts-icon-search","onUpdate:modelValue":w[12]||(w[12]=T=>f.value=T),type:"search",placeholder:"Search by name or description…",autocomplete:"off"},null,512),[[Fe,f.value]])]),i("div",$b,[(p(!0),h(U,null,le(S.value,T=>(p(),h("div",{key:T.label,class:"field"},[i("p",xb,v(T.label)+" · "+v(T.icons.length),1),i("div",Sb,[(p(!0),h(U,null,le(T.icons,te=>(p(),h("button",{key:te.name,type:"button",class:"alert-icon",title:`Copy ${te.name}`,onClick:$e=>m(ft)(te.name,void 0,"Icon name")},[i("span",Tb,v(m(ke)(te.cp)),1),i("code",null,v(te.name),1),te.label?(p(),h("small",Ab,v(te.label),1)):R("",!0)],8,Cb))),128))])]))),128)),S.value.length?R("",!0):(p(),h("p",Eb,'No icon for "'+v(f.value)+'". Unknown names show the warning triangle ('+v(t.value.fallback_icon)+").",1))])]),i("section",Pb,[w[53]||(w[53]=i("h2",null,"Colors",-1)),w[54]||(w[54]=i("p",null,[Z("Fill in the name in "),i("code",null,"color"),Z(". These are the pastel shades of the tiles, with dark text. Empty or unknown gives the white card. Tap to copy.")],-1)),i("div",Ob,[i("button",{type:"button",class:"swatch",onClick:w[13]||(w[13]=T=>m(ft)("",void 0,"Empty color"))},[...w[52]||(w[52]=[i("i",{style:{background:"#ffffff"}},null,-1),i("span",null,[i("code",null,"empty"),i("small",null,"White (default)")],-1)])]),(p(!0),h(U,null,le(t.value.colors,T=>(p(),h("button",{key:T.name,type:"button",class:"swatch",onClick:te=>m(ft)(T.name,void 0,"Color name")},[i("i",{style:Pe({background:T.color})},null,4),i("span",null,[i("code",null,v(T.name),1),i("small",null,v(T.label)+" · "+v(T.color),1)])],8,Ib))),128))])]),w[75]||(w[75]=Cs('<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&#39;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",Mb,[w[66]||(w[66]=i("h2",null,"Events",-1)),i("p",null,[w[55]||(w[55]=Z("Every end fires the event ",-1)),i("code",Lb,v(t.value.event),1),w[56]||(w[56]=Z(" with ",-1)),w[57]||(w[57]=i("code",null,"action",-1)),w[58]||(w[58]=Z(", ",-1)),w[59]||(w[59]=i("code",null,"title",-1)),w[60]||(w[60]=Z(", ",-1)),w[61]||(w[61]=i("code",null,"screen",-1)),w[62]||(w[62]=Z(" (the device name) and the ",-1)),w[63]||(w[63]=i("code",null,"device_id",-1)),w[64]||(w[64]=Z(" that Home Assistant adds. Visible under Settings → Tools → Events.",-1))]),i("div",Db,[i("table",Fb,[w[65]||(w[65]=i("tr",null,[i("th",null,"action"),i("th",null,"When")],-1)),(p(!0),h(U,null,le(t.value.endings,T=>(p(),h("tr",{key:T.action},[i("td",null,[i("code",null,v(T.action),1)]),i("td",null,v(T.label),1)]))),128))])]),w[67]||(w[67]=i("p",{class:"subhead"},"Waiting until someone presses the button",-1)),i("div",Nb,[i("pre",Rb,v(E.value),1),i("button",{type:"button",class:"btn quiet mini",id:"alerts-wait-copy",onClick:w[14]||(w[14]=T=>m(ft)(E.value,void 0,"YAML"))},"Copy YAML")])]),i("section",Hb,[w[74]||(w[74]=i("h2",null,"Tips",-1)),i("ul",Ub,[w[72]||(w[72]=Cs("<li>Use a <b>color per kind of notification</b>: orange for the door, red for smoke or water, green for &quot;done&quot;. 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: &quot;Coming&quot;, &quot;Seen&quot;, &quot;Turn off&quot;. 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[68]||(w[68]=Z("Every screen? Fire ",-1)),i("code",null,v(t.value.broadcast?.show||"esp_screens_show_alert"),1),w[69]||(w[69]=Z(" once (see All screens at once). The screens still work independently and each reports with its own ",-1)),w[70]||(w[70]=i("code",null,"screen",-1)),w[71]||(w[71]=Z(".",-1))]),w[73]||(w[73]=i("li",null,[Z("Rather "),i("b",null,"ask Claude"),Z(" for the automation? Install the ESP Screens skill under Settings → Claude.")],-1))])])],64)):(p(),h("p",Tg,"The cheatsheet is still loading; one moment."))]))}}),Bb={class:"panel",id:"override-dialog"},Vb={class:"panel-head"},Wb={class:"tx"},Kb={id:"override-title"},qb={class:"notice"},Yb={class:"mdi"},zb={class:"file-row"},Jb={id:"override-file"},Gb={class:"yaml-editor",id:"yaml-editor-wrap"},Xb={class:"actions"},Zb={id:"override-count",class:"hint"},Qb={class:"actions"},e1=["disabled"],t1=["disabled"],n1=`# 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
`,s1=Ee({__name:"OverrideView",setup(e){const t=$(()=>u.overrideProfile),n=pe(""),s=pe(""),o=pe(!1),l=pe("Loading…"),a=pe(""),r=pe(!1),d=pe(null),f=pe(null),c=$(()=>n.value.split(`
`).length),y=$(()=>Array.from({length:c.value},(O,A)=>A+1).join(`
`)),b=$(()=>`${n.value.length} characters · ${c.value} line${c.value===1?"":"s"}`);let k=!0;function I(O,A=""){l.value=O,a.value=A}async function E(){if(!t.value){I("No ESPHome profile was found for this screen.","error");return}I("Loading…");try{const O=await yt(`firmware/profiles/${encodeURIComponent(t.value)}/override`);s.value=O.override_file,o.value=!!O.attached,n.value=O.exists&&O.content!==`{}
`?O.content:"",I(O.attached?"Changes here apply on the next build.":"Save once to attach this file to the profile.")}catch(O){I(O.message,"error")}}async function x(O=!1){if(!(!t.value||r.value)){r.value=!0,I("Checking and saving…");try{const A=await it(`firmware/profiles/${encodeURIComponent(t.value)}/override`,"PUT",{content:n.value});if(s.value=A.override_file,o.value=!0,!O){I("Saved. The override is kept during firmware updates.","ok"),ge("Override YAML saved.");return}I("Saved. ESPHome is checking the complete profile…"),await it("firmware/jobs","POST",{file:t.value,action:"validate"}),S()}catch(A){I(A.message,"error")}finally{r.value=!1}}}function S(){const O=Date.now(),A=t.value,w=async()=>{if(!(!k||t.value!==A))try{const T=await yt("firmware"),te=T.job;if(te&&te.file===A&&te.state==="running")I(`ESPHome is checking the profile… ${te.stage||""}`.trim());else if(te&&te.file===A&&te.state==="success"){I("The complete profile is valid. Safe to build and install.","ok");return}else if(te&&te.file===A&&te.state==="failed"){const $e=(T.logs||[]).filter(Me=>/error|failed/i.test(Me)).pop();I($e||"ESPHome rejected the complete profile. See Firmware & USB for the full log.","error");return}Date.now()-O<72e5&&setTimeout(w,1200)}catch(T){I(T.message,"error")}};w()}function M(){(!n.value.trim()||confirm("Replace the current text with the example?"))&&(n.value=n1,I("Example loaded. Save it when you are ready."),d.value?.focus())}function G(){(!n.value.trim()||confirm("Clear the local override?"))&&(n.value="",I("The override will be empty after you save."),d.value?.focus())}function C(O){const A=d.value;if(O.key==="Tab"){O.preventDefault();const w=A.selectionStart,T=A.selectionEnd;A.setRangeText(" ",w,T,"end"),n.value=A.value}else(O.ctrlKey||O.metaKey)&&O.key.toLowerCase()==="s"&&(O.preventDefault(),x(!1))}function V(){f.value&&d.value&&(f.value.scrollTop=d.value.scrollTop)}return _n(E),In(()=>{k=!1}),(O,A)=>(p(),h("div",Bb,[i("div",Vb,[i("div",Wb,[A[4]||(A[4]=i("span",{class:"eyebrow"},"Advanced · local override",-1)),i("h1",Kb,"Override YAML"+v(m(u).overrideFriendly?` · ${m(u).overrideFriendly}`:""),1),A[5]||(A[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:A[0]||(A[0]=w=>m(Oe)(""))},"← Back")]),i("div",qb,[i("span",Yb,v(m(ke)("F0493")),1),A[6]||(A[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",zb,[i("code",Jb,v(s.value||t.value||""),1),i("span",{id:"override-state",class:ie(["chip",{good:o.value}])},v(o.value?"Active":"Ready to attach"),3)]),i("div",Gb,[i("div",{ref_key:"gutter",ref:f,class:"yaml-gutter",id:"override-gutter","aria-hidden":"true"},v(y.value),513),we(i("textarea",{ref_key:"editor",ref:d,id:"override-editor","onUpdate:modelValue":A[1]||(A[1]=w=>n.value=w),spellcheck:"false",autocapitalize:"off",autocomplete:"off",autocorrect:"off","aria-label":"Local override YAML",placeholder:`# Example
display:
- id: !extend my_display
model: ST7789V`,onKeydown:C,onScroll:V},null,544),[[Fe,n.value]])]),i("div",Xb,[i("button",{type:"button",class:"btn quiet mini",id:"override-example",onClick:M},"Use example"),i("button",{type:"button",class:"btn quiet mini",id:"override-empty",onClick:G},"Clear"),i("span",Zb,v(b.value),1)]),i("p",{id:"override-status",class:ie(["status-line",a.value]),role:"status"},v(l.value),3),i("div",Qb,[i("button",{type:"button",class:"btn quiet",id:"override-check",disabled:r.value||!t.value,onClick:A[2]||(A[2]=w=>x(!0))},"Save & check",8,e1),i("button",{type:"button",class:"btn primary",id:"override-save",disabled:r.value||!t.value,onClick:A[3]||(A[3]=w=>x(!1))},"Save override",8,t1)])]))}}),o1={class:"main"},i1=Ee({__name:"App",setup(e){const t=$(()=>rt.value==="#settings"?hy:rt.value==="#new-screen"?tg:rt.value==="#firmware"?xg:rt.value==="#alerts"?jb:rt.value==="#override"?s1:lt.value&&u.layout?Km:zm);function n(s){(s.metaKey||s.ctrlKey)&&s.key.toLowerCase()==="k"&&(s.preventDefault(),u.palette=!u.palette)}return _n(()=>document.addEventListener("keydown",n)),In(()=>document.removeEventListener("keydown",n)),(s,o)=>(p(),h("div",{class:ie(["app",{dragging:m(u).drag.active}])},[_e(jd),i("main",o1,[(p(),Xe(su(t.value)))]),_e(Vd),_e(Qd)],2))}});_c(i1).mount("#app");vd();