UNPKG

iobroker.nspanel-lovelace-ui

Version:

NsPanel Lovelace UI is a Firmware for the nextion screen inside of NSPanel in the Design of Lovelace UI Design.

30 lines (29 loc) 12.8 kB
import{h as x,_ as we,b as oe,d as Te,f as H,i as Z,e as ve,q as Re}from"./AdminComponentEasyAccessSet__loadShare__react__loadShare__.js-VQUi_FZ-.js";import{V as He,W as Ue,X as Ye,Y as Fe,T as V,P as Be,s as ze,c as Qe}from"./identifier-BUIOJqla.js";import{j as C,D as Xe}from"./createSvgIcon-CHdwYyrx.js";import{e as Je,d as je,R as We}from"./useSlot-Chpl3Bui.js";import{b as Le}from"./useTheme-7761-x-Y.js";import{G as Ze,a as et}from"./GlobalStyles-C2Ehq_Bw.js";const ee=new Map,tt=(e,t)=>{const o=Ue(e);return o.sheet=new t({key:o.key,nonce:o.sheet.nonce,container:o.sheet.container,speedy:o.sheet.isSpeedy,prepend:o.sheet.prepend,insertionPoint:o.sheet.insertionPoint}),o};let j;if(typeof document=="object"&&(j=document.querySelector('[name="emotion-insertion-point"]'),!j)){j=document.createElement("meta"),j.setAttribute("name","emotion-insertion-point"),j.setAttribute("content","");const e=document.querySelector("head");e&&e.prepend(j)}function ot(e,t){if(e||t){class o extends Ye{insert(s,n){return this.key&&this.key.endsWith("global")&&(this.before=j),super.insert(s,n)}}const r=tt({key:"css",insertionPoint:e?j:void 0},o);if(t){const c=r.insert;r.insert=(...s)=>(s[1].styles.match(/^@layer\s+[^{]*$/)||(s[1].styles=`@layer mui {${s[1].styles}}`),c(...s))}return r}}function xt(e){const{injectFirst:t,enableCssLayer:o,children:r}=e,c=x(()=>{const s=`${t}-${o}`;if(typeof document=="object"&&ee.has(s))return ee.get(s);const n=ot(t,o);return ee.set(s,n),n},[t,o]);return c?C.jsx(He,{value:c,children:r}):r}const Pe=we(null);function re(){return oe(Pe)}const rt=typeof Symbol=="function"&&Symbol.for,nt=rt?Symbol.for("mui.nested"):"__THEME_NESTED__";function st(e,t){return typeof t=="function"?t(e):{...e,...t}}function ct(e){const{children:t,theme:o}=e,r=re(),c=x(()=>{const s=r===null?{...o}:st(r,o);return s!=null&&(s[nt]=r!==null),s},[o,r]);return C.jsx(Pe.Provider,{value:c,children:t})}function it(e){const t=Le(),o=Je()||"",{modularCssLayers:r}=e;let c="mui.global, mui.components, mui.theme, mui.custom, mui.sx";return!r||t!==null?c="":typeof r=="string"?c=r.replace(/mui(?!\.)/g,c):c=`@layer ${c};`,je(()=>{var a,h;const s=document.querySelector("head");if(!s)return;const n=s.firstChild;if(c){if(n&&((a=n.hasAttribute)!=null&&a.call(n,"data-mui-layer-order"))&&n.getAttribute("data-mui-layer-order")===o)return;const y=document.createElement("style");y.setAttribute("data-mui-layer-order",o),y.textContent=c,s.prepend(y)}else(h=s.querySelector(`style[data-mui-layer-order="${o}"]`))==null||h.remove()},[c,o]),c?C.jsx(Ze,{styles:c}):null}const Me={};function xe(e,t,o,r=!1){return x(()=>{const c=e&&t[e]||t;if(typeof o=="function"){const s=o(c),n=e?{...t,[e]:s}:s;return r?()=>n:n}return e?{...t,[e]:o}:{...t,...o}},[e,t,o,r])}function Ie(e){const{children:t,theme:o,themeId:r}=e,c=Le(Me),s=re()||Me,n=xe(r,c,o),a=xe(r,s,o,!0),h=(r?n[r]:n).direction==="rtl",y=it(n);return C.jsx(ct,{theme:a,children:C.jsx(Fe.Provider,{value:n,children:C.jsx(We,{value:h,children:C.jsxs(Xe,{value:r?n[r].components:n.components,children:[y,t]})})})})}const ne="mode",se="color-scheme",lt="data-color-scheme";function dt(e){const{defaultMode:t="system",defaultLightColorScheme:o="light",defaultDarkColorScheme:r="dark",modeStorageKey:c=ne,colorSchemeStorageKey:s=se,attribute:n=lt,colorSchemeNode:a="document.documentElement",nonce:h}=e||{};let y="",p=n;if(n==="class"&&(p=".%s"),n==="data"&&(p="[data-%s]"),p.startsWith(".")){const f=p.substring(1);y+=`${a}.classList.remove('${f}'.replace('%s', light), '${f}'.replace('%s', dark)); ${a}.classList.add('${f}'.replace('%s', colorScheme));`}const $=p.match(/\[([^\]]+)\]/);if($){const[f,m]=$[1].split("=");m||(y+=`${a}.removeAttribute('${f}'.replace('%s', light)); ${a}.removeAttribute('${f}'.replace('%s', dark));`),y+=` ${a}.setAttribute('${f}'.replace('%s', colorScheme), ${m?`${m}.replace('%s', colorScheme)`:'""'});`}else y+=`${a}.setAttribute('${p}', colorScheme);`;return C.jsx("script",{suppressHydrationWarning:!0,nonce:typeof window>"u"?h:"",dangerouslySetInnerHTML:{__html:`(function() { try { let colorScheme = ''; const mode = localStorage.getItem('${c}') || '${t}'; const dark = localStorage.getItem('${s}-dark') || '${r}'; const light = localStorage.getItem('${s}-light') || '${o}'; if (mode === 'system') { // handle system mode const mql = window.matchMedia('(prefers-color-scheme: dark)'); if (mql.matches) { colorScheme = dark } else { colorScheme = light } } if (mode === 'light') { colorScheme = light; } if (mode === 'dark') { colorScheme = dark; } if (colorScheme) { ${y} } } catch(e){}})();`}},"mui-color-scheme-init")}function mt(){}const at=({key:e,storageWindow:t})=>(!t&&typeof window<"u"&&(t=window),{get(o){if(typeof window>"u")return;if(!t)return o;let r;try{r=t.localStorage.getItem(e)}catch{}return r||o},set:o=>{if(t)try{t.localStorage.setItem(e,o)}catch{}},subscribe:o=>{if(!t)return mt;const r=c=>{const s=c.newValue;c.key===e&&o(s)};return t.addEventListener("storage",r),()=>{t.removeEventListener("storage",r)}}});function te(){}function $e(e){if(typeof window<"u"&&typeof window.matchMedia=="function"&&e==="system")return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Ae(e,t){if(e.mode==="light"||e.mode==="system"&&e.systemMode==="light")return t("light");if(e.mode==="dark"||e.mode==="system"&&e.systemMode==="dark")return t("dark")}function ut(e){return Ae(e,t=>{if(t==="light")return e.lightColorScheme;if(t==="dark")return e.darkColorScheme})}function ht(e){const{defaultMode:t="light",defaultLightColorScheme:o,defaultDarkColorScheme:r,supportedColorSchemes:c=[],modeStorageKey:s=ne,colorSchemeStorageKey:n=se,storageWindow:a=typeof window>"u"?void 0:window,storageManager:h=at,noSsr:y=!1}=e,p=c.join(","),$=c.length>1,f=x(()=>h==null?void 0:h({key:s,storageWindow:a}),[h,s,a]),m=x(()=>h==null?void 0:h({key:`${n}-light`,storageWindow:a}),[h,n,a]),S=x(()=>h==null?void 0:h({key:`${n}-dark`,storageWindow:a}),[h,n,a]),[w,I]=Te(()=>{const i=(f==null?void 0:f.get(t))||t,l=(m==null?void 0:m.get(o))||o,d=(S==null?void 0:S.get(r))||r;return{mode:i,systemMode:$e(i),lightColorScheme:l,darkColorScheme:d}}),[L,F]=Te(y||!$);H(()=>{F(!0)},[]);const O=ut(w),K=Z(i=>{I(l=>{if(i===l.mode)return l;const d=i??t;return f==null||f.set(d),{...l,mode:d,systemMode:$e(d)}})},[f,t]),A=Z(i=>{i?typeof i=="string"?i&&!p.includes(i)?console.error(`\`${i}\` does not exist in \`theme.colorSchemes\`.`):I(l=>{const d={...l};return Ae(l,u=>{u==="light"&&(m==null||m.set(i),d.lightColorScheme=i),u==="dark"&&(S==null||S.set(i),d.darkColorScheme=i)}),d}):I(l=>{const d={...l},u=i.light===null?o:i.light,P=i.dark===null?r:i.dark;return u&&(p.includes(u)?(d.lightColorScheme=u,m==null||m.set(u)):console.error(`\`${u}\` does not exist in \`theme.colorSchemes\`.`)),P&&(p.includes(P)?(d.darkColorScheme=P,S==null||S.set(P)):console.error(`\`${P}\` does not exist in \`theme.colorSchemes\`.`)),d}):I(l=>(m==null||m.set(o),S==null||S.set(r),{...l,lightColorScheme:o,darkColorScheme:r}))},[p,m,S,o,r]),q=Z(i=>{w.mode==="system"&&I(l=>{const d=i!=null&&i.matches?"dark":"light";return l.systemMode===d?l:{...l,systemMode:d}})},[w.mode]),U=ve(q);return U.current=q,H(()=>{if(typeof window.matchMedia!="function"||!$)return;const i=(...d)=>U.current(...d),l=window.matchMedia("(prefers-color-scheme: dark)");return l.addListener(i),i(l),()=>{l.removeListener(i)}},[$]),H(()=>{if($){const i=(f==null?void 0:f.subscribe(u=>{(!u||["light","dark","system"].includes(u))&&K(u||t)}))||te,l=(m==null?void 0:m.subscribe(u=>{(!u||p.match(u))&&A({light:u})}))||te,d=(S==null?void 0:S.subscribe(u=>{(!u||p.match(u))&&A({dark:u})}))||te;return()=>{i(),l(),d()}}},[A,K,p,t,a,$,f,m,S]),{...w,mode:L?w.mode:void 0,systemMode:L?w.systemMode:void 0,colorScheme:L?O:void 0,setMode:K,setColorScheme:A}}const ft="*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}";function St(e){const{themeId:t,theme:o={},modeStorageKey:r=ne,colorSchemeStorageKey:c=se,disableTransitionOnChange:s=!1,defaultColorScheme:n,resolveTheme:a}=e,h={allColorSchemes:[],colorScheme:void 0,darkColorScheme:void 0,lightColorScheme:void 0,mode:void 0,setColorScheme:()=>{},setMode:()=>{},systemMode:void 0},y=we(void 0),p=()=>oe(y)||h,$={},f={};function m(L){var ge,be,_e,ke;const{children:F,theme:O,modeStorageKey:K=r,colorSchemeStorageKey:A=c,disableTransitionOnChange:q=s,storageManager:U,storageWindow:i=typeof window>"u"?void 0:window,documentNode:l=typeof document>"u"?void 0:document,colorSchemeNode:d=typeof document>"u"?void 0:document.documentElement,disableNestedContext:u=!1,disableStyleSheetGeneration:P=!1,defaultMode:Ve="system",noSsr:Oe}=L,B=ve(!1),z=re(),Q=oe(y),X=!!Q&&!u,ce=x(()=>O||(typeof o=="function"?o():o),[O]),ie=ce[t],k=ie||ce,{colorSchemes:v=$,components:le=f,cssVarPrefix:J}=k,de=Object.keys(v).filter(g=>!!v[g]).join(","),D=x(()=>de.split(","),[de]),me=typeof n=="string"?n:n.light,ae=typeof n=="string"?n:n.dark,Ke=v[me]&&v[ae]?Ve:((be=(ge=v[k.defaultColorScheme])==null?void 0:ge.palette)==null?void 0:be.mode)||((_e=k.palette)==null?void 0:_e.mode),{mode:qe,setMode:ue,systemMode:he,lightColorScheme:fe,darkColorScheme:Se,colorScheme:Ne,setColorScheme:ye}=ht({supportedColorSchemes:D,defaultLightColorScheme:me,defaultDarkColorScheme:ae,modeStorageKey:K,colorSchemeStorageKey:A,defaultMode:Ke,storageManager:U,storageWindow:i,noSsr:Oe});let W=qe,T=Ne;X&&(W=Q.mode,T=Q.colorScheme);const N=x(()=>{var R;const g=T||k.defaultColorScheme,b=((R=k.generateThemeVars)==null?void 0:R.call(k))||k.vars,_={...k,components:le,colorSchemes:v,cssVarPrefix:J,vars:b};if(typeof _.generateSpacing=="function"&&(_.spacing=_.generateSpacing()),g){const M=v[g];M&&typeof M=="object"&&Object.keys(M).forEach(E=>{M[E]&&typeof M[E]=="object"?_[E]={..._[E],...M[E]}:_[E]=M[E]})}return a?a(_):_},[k,T,le,v,J]),G=k.colorSchemeSelector;je(()=>{if(T&&d&&G&&G!=="media"){const g=G;let b=G;if(g==="class"&&(b=".%s"),g==="data"&&(b="[data-%s]"),g!=null&&g.startsWith("data-")&&!g.includes("%s")&&(b=`[${g}="%s"]`),b.startsWith("."))d.classList.remove(...D.map(_=>b.substring(1).replace("%s",_))),d.classList.add(b.substring(1).replace("%s",T));else{const _=b.replace("%s",T).match(/\[([^\]]+)\]/);if(_){const[R,M]=_[1].split("=");M||D.forEach(E=>{d.removeAttribute(R.replace(T,E))}),d.setAttribute(R,M?M.replace(/"|'/g,""):"")}else d.setAttribute(b,T)}}},[T,G,d,D]),H(()=>{let g;if(q&&B.current&&l){const b=l.createElement("style");b.appendChild(l.createTextNode(ft)),l.head.appendChild(b),window.getComputedStyle(l.body),g=setTimeout(()=>{l.head.removeChild(b)},1)}return()=>{clearTimeout(g)}},[T,q,l]),H(()=>(B.current=!0,()=>{B.current=!1}),[]);const Ge=x(()=>({allColorSchemes:D,colorScheme:T,darkColorScheme:Se,lightColorScheme:fe,mode:W,setColorScheme:ye,setMode:ue,systemMode:he}),[D,T,Se,fe,W,ye,ue,he,N.colorSchemeSelector]);let pe=!0;(P||k.cssVariables===!1||X&&(z==null?void 0:z.cssVarPrefix)===J)&&(pe=!1);const Ce=C.jsxs(Re,{children:[C.jsx(Ie,{themeId:ie?t:void 0,theme:N,children:F}),pe&&C.jsx(et,{styles:((ke=N.generateStyleSheets)==null?void 0:ke.call(N))||[]})]});return X?Ce:C.jsx(y.Provider,{value:Ge,children:Ce})}const S=typeof n=="string"?n:n.light,w=typeof n=="string"?n:n.dark;return{CssVarsProvider:m,useColorScheme:p,getInitColorSchemeScript:L=>dt({colorSchemeStorageKey:c,defaultLightColorScheme:S,defaultDarkColorScheme:w,modeStorageKey:r,...L})}}function yt({theme:e,...t}){const o=V in e?e[V]:void 0;return C.jsx(Ie,{...t,themeId:o?V:void 0,theme:o||e})}const Y={colorSchemeStorageKey:"mui-color-scheme",defaultLightColorScheme:"light",defaultDarkColorScheme:"dark",modeStorageKey:"mui-mode"},{CssVarsProvider:De,useColorScheme:$t,getInitColorSchemeScript:pt}=St({themeId:V,theme:()=>Qe({cssVariables:!0}),colorSchemeStorageKey:Y.colorSchemeStorageKey,modeStorageKey:Y.modeStorageKey,defaultColorScheme:{light:Y.defaultLightColorScheme,dark:Y.defaultDarkColorScheme},resolveTheme:e=>{const t={...e,typography:Be(e.palette,e.typography)};return t.unstable_sx=function(r){return ze({sx:r,theme:this})},t}});function Et(e){return C.jsx(De,{...e})}let Ee=!1;const wt=e=>(Ee||(console.warn(["MUI: The getInitColorSchemeScript function has been deprecated.","","You should use `import InitColorSchemeScript from '@mui/material/InitColorSchemeScript'`","and replace the function call with `<InitColorSchemeScript />` instead."].join(` `)),Ee=!0),pt(e)),Ct=De;function vt({theme:e,...t}){const o=x(()=>{if(typeof e=="function")return e;const r=V in e?e[V]:e;return"colorSchemes"in r?null:"vars"in r?e:{...e,vars:null}},[e]);return o?C.jsx(yt,{theme:o,...t}):C.jsx(Ct,{theme:e,...t})}export{Ct as C,Et as E,xt as S,vt as T,wt as g,$t as u};