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.

154 lines 582 kB
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-C9vfxzYy.js","./useTheme-7761-x-Y.js","./AdminComponentEasyAccessSet__loadShare__react__loadShare__.js_commonjs-proxy-xiMWmJG0.js","./AdminComponentEasyAccessSet__loadShare__react__loadShare__.js-VQUi_FZ-.js","./identifier-BUIOJqla.js"])))=>i.map(i=>d[i]);
import{a as c,j as Ka,_ as Qo,b as Xo,h as he,e as De,q as Jt,c as Te,f as Oe,i as pt,g as Zo,d as Dt,r as Cu,s as qa,m as Ya,l as Du,n as vu,o as Ga}from"./AdminComponentEasyAccessSet__loadShare__react__loadShare__.js-VQUi_FZ-.js";import{c as go}from"./AdminComponentEasyAccessSet__loadShare__react__loadShare__.js_commonjs-proxy-xiMWmJG0.js";function wu(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var n=e.default;if(typeof n=="function"){var t=function r(){var o=!1;try{o=this instanceof r}catch{}return o?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};t.prototype=n.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),t}function Eu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}import{U as ct,r as Ne,l as yn,N as xn,f as Ut,G as Pe,i as fe,a3 as ei,a4 as ti,_ as Ze,a5 as si,K as Be,d as Pr,e as xe,h as Gs,u as rs,x as _e,F as Ke,v as st,w as ze,s as jn,t as Ts,a6 as Qa,Y as bn,a0 as Xa,$ as Nt,Z as Ve,a2 as Cn,m as os,n as Qs,o as Cs,p as xu,q as Ds,a7 as Su,a8 as ku,S as Tu,L as ni,O as vr,T as Nr,J as Za,D as ri,g as Au,Q as Fu,H as Iu,y as _u,z as Ou,a9 as el,aa as tl,M as Pu,a1 as Nu,ab as yo,ac as Bu,ad as Mu,I as $u,a as Lu,b as Vu}from"./AdminComponentEasyAccessSet__loadShare___mf_0_mui_mf_1_material__loadShare__.js-wJy6KKQ1.js";import{ac as _n,a3 as vs,q as wr,an as Ru,ao as sl,ap as ju,aq as nl,ar as Uu,O as Wu,a0 as On,z as rl,as as ol,at as il,e as ts,J as oi,$ as Pn,au as al,R as ll,g as zu,av as Hu,aw as Ju,ax as Ku,ay as qu,aj as Er,az as fr,aA as mr,t as Ws,i as ii,h as Mt,aB as Yu,aC as Gu,aD as Qu,v as Xu,aE as cl,B as ul,w as hl,aF as ai,j as Zu,aG as eh,_ as th,a as dl,aH as sh,aI as nh,aJ as rh,aK as oh,aL as ih,aM as ah,aN as lh,aO as ch,aP as uh,U as hh,aQ as dh,p as ph,a4 as fh,aR as mh,aS as gh,aT as yh,aU as bh,L as Hi}from"./AdminComponentEasyAccessSet__loadShare___mf_0_mui_mf_1_icons_mf_2_material__loadShare__.js-CC-I_yso.js";import{a as x,d as ws,e as Es,f as je,g as Ch,A as Dh,h as vh,i as xr,j as wh,k as Eh,l as xh,m as li,n as Sh,o as kh,p as Th,q as Zn,r as Ah,s as Fh}from"./AdminComponentEasyAccessSet__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__.js-BK3yOUCT.js";import{R as Ih}from"./AdminComponentEasyAccessSet__loadShare__react_mf_2_dom__loadShare__.js-CYi6jjIv.js";import{b as _h,a as $t,d as Oh,r as pl}from"./identifier-BUIOJqla.js";import{C as Ph,D as fl}from"./index-BovB7wry.js";import{d as $o}from"./virtual_mf-REMOTE_ENTRY_ID_AdminComponentEasyAccessSet__customComponents_js-Yotbf65y.js";import{_ as k,j as I,c as as,g as Ae,a as Fe,b as Ie,d as Se,s as X}from"./createSvgIcon-CHdwYyrx.js";import{_ as Nh,f as Bh,a as pe,T as Mh,u as ke,b as xs,c as ce,d as Kt,e as tn,g as ut,G as $h,o as bo,P as Lh,r as Br}from"./useSlot-Chpl3Bui.js";import{u as ve,T as ls,I as sn,M as ml,a as gl,B as Vh,b as yl,c as Mr,v as Rh,d as jh,F as Uh,e as Wh,f as bl,g as $r,h as Cl,i as ci,j as zh,P as Hh,k as Dn,D as Jh,L as Kh,l as qh,C as Yh,m as Gh,n as Ji,o as Qh}from"./Dialog-BYWIfl38.js";import{P as w,u as Dl}from"./useTheme-7761-x-Y.js";import{E as ui}from"./Editor-CF36HkD3.js";import{_ as vl}from"./preload-helper-BDBacUwf.js";import"./_baseIsEqual-DAxlx-6j.js";import"./GlobalStyles-C2Ehq_Bw.js";const Xh=Object.freeze(Object.defineProperty({__proto__:null,get ConfigGeneric(){return F},get ConfigPanel(){return _s},get JsonConfig(){return KD},get JsonConfigComponent(){return Dr}},Symbol.toStringTag,{value:"Module"})),Lr=w.oneOfType([w.func,w.object]);function Zh(n,e){return n.classList?!!e&&n.classList.contains(e):(" "+(n.className.baseVal||n.className)+" ").indexOf(" "+e+" ")!==-1}function ed(n,e){n.classList?n.classList.add(e):Zh(n,e)||(typeof n.className=="string"?n.className=n.className+" "+e:n.setAttribute("class",(n.className&&n.className.baseVal||"")+" "+e))}function Ki(n,e){return n.replace(new RegExp("(^|\\s)"+e+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function td(n,e){n.classList?n.classList.remove(e):typeof n.className=="string"?n.className=Ki(n.className,e):n.setAttribute("class",Ki(n.className&&n.className.baseVal||"",e))}var sd=function(e,t){return e&&t&&t.split(" ").forEach(function(s){return ed(e,s)})},Co=function(e,t){return e&&t&&t.split(" ").forEach(function(s){return td(e,s)})},hi=(function(n){Nh(e,n);function e(){for(var s,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return s=n.call.apply(n,[this].concat(o))||this,s.appliedClasses={appear:{},enter:{},exit:{}},s.onEnter=function(a,l){var u=s.resolveArguments(a,l),d=u[0],h=u[1];s.removeClasses(d,"exit"),s.addClass(d,h?"appear":"enter","base"),s.props.onEnter&&s.props.onEnter(a,l)},s.onEntering=function(a,l){var u=s.resolveArguments(a,l),d=u[0],h=u[1],p=h?"appear":"enter";s.addClass(d,p,"active"),s.props.onEntering&&s.props.onEntering(a,l)},s.onEntered=function(a,l){var u=s.resolveArguments(a,l),d=u[0],h=u[1],p=h?"appear":"enter";s.removeClasses(d,p),s.addClass(d,p,"done"),s.props.onEntered&&s.props.onEntered(a,l)},s.onExit=function(a){var l=s.resolveArguments(a),u=l[0];s.removeClasses(u,"appear"),s.removeClasses(u,"enter"),s.addClass(u,"exit","base"),s.props.onExit&&s.props.onExit(a)},s.onExiting=function(a){var l=s.resolveArguments(a),u=l[0];s.addClass(u,"exit","active"),s.props.onExiting&&s.props.onExiting(a)},s.onExited=function(a){var l=s.resolveArguments(a),u=l[0];s.removeClasses(u,"exit"),s.addClass(u,"exit","done"),s.props.onExited&&s.props.onExited(a)},s.resolveArguments=function(a,l){return s.props.nodeRef?[s.props.nodeRef.current,a]:[a,l]},s.getClassNames=function(a){var l=s.props.classNames,u=typeof l=="string",d=u&&l?l+"-":"",h=u?""+d+a:l[a],p=u?h+"-active":l[a+"Active"],g=u?h+"-done":l[a+"Done"];return{baseClassName:h,activeClassName:p,doneClassName:g}},s}var t=e.prototype;return t.addClass=function(r,o,i){var a=this.getClassNames(o)[i+"ClassName"],l=this.getClassNames("enter"),u=l.doneClassName;o==="appear"&&i==="done"&&u&&(a+=" "+u),i==="active"&&r&&Bh(r),a&&(this.appliedClasses[o][i]=a,sd(r,a))},t.removeClasses=function(r,o){var i=this.appliedClasses[o],a=i.base,l=i.active,u=i.done;this.appliedClasses[o]={},a&&Co(r,a),l&&Co(r,l),u&&Co(r,u)},t.render=function(){var r=this.props;r.classNames;var o=pe(r,["classNames"]);return c.createElement(Mh,k({},o,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},e})(c.Component);hi.defaultProps={classNames:""};hi.propTypes={};var nd=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,rd=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,od=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,Do={Space_Separator:nd,ID_Start:rd,ID_Continue:od},He={isSpaceSeparator(n){return typeof n=="string"&&Do.Space_Separator.test(n)},isIdStartChar(n){return typeof n=="string"&&(n>="a"&&n<="z"||n>="A"&&n<="Z"||n==="$"||n==="_"||Do.ID_Start.test(n))},isIdContinueChar(n){return typeof n=="string"&&(n>="a"&&n<="z"||n>="A"&&n<="Z"||n>="0"&&n<="9"||n==="$"||n==="_"||n==="‌"||n==="‍"||Do.ID_Continue.test(n))},isDigit(n){return typeof n=="string"&&/[0-9]/.test(n)},isHexDigit(n){return typeof n=="string"&&/[0-9A-Fa-f]/.test(n)}};let Lo,it,Rt,Sr,is,Ft,et,di,Sn;var id=function(e,t){Lo=String(e),it="start",Rt=[],Sr=0,is=1,Ft=0,et=void 0,di=void 0,Sn=void 0;do et=ad(),ud[it]();while(et.type!=="eof");return typeof t=="function"?Vo({"":Sn},"",t):Sn};function Vo(n,e,t){const s=n[e];if(s!=null&&typeof s=="object")if(Array.isArray(s))for(let r=0;r<s.length;r++){const o=String(r),i=Vo(s,o,t);i===void 0?delete s[o]:Object.defineProperty(s,o,{value:i,writable:!0,enumerable:!0,configurable:!0})}else for(const r in s){const o=Vo(s,r,t);o===void 0?delete s[r]:Object.defineProperty(s,r,{value:o,writable:!0,enumerable:!0,configurable:!0})}return t.call(n,e,s)}let Ce,ye,vn,Vt,we;function ad(){for(Ce="default",ye="",vn=!1,Vt=1;;){we=Wt();const n=wl[Ce]();if(n)return n}}function Wt(){if(Lo[Sr])return String.fromCodePoint(Lo.codePointAt(Sr))}function W(){const n=Wt();return n===`
`?(is++,Ft=0):n?Ft+=n.length:Ft++,n&&(Sr+=n.length),n}const wl={default(){switch(we){case"	":case"\v":case"\f":case" ":case" ":case"\uFEFF":case`
`:case"\r":case"\u2028":case"\u2029":W();return;case"/":W(),Ce="comment";return;case void 0:return W(),$e("eof")}if(He.isSpaceSeparator(we)){W();return}return wl[it]()},comment(){switch(we){case"*":W(),Ce="multiLineComment";return;case"/":W(),Ce="singleLineComment";return}throw Le(W())},multiLineComment(){switch(we){case"*":W(),Ce="multiLineCommentAsterisk";return;case void 0:throw Le(W())}W()},multiLineCommentAsterisk(){switch(we){case"*":W();return;case"/":W(),Ce="default";return;case void 0:throw Le(W())}W(),Ce="multiLineComment"},singleLineComment(){switch(we){case`
`:case"\r":case"\u2028":case"\u2029":W(),Ce="default";return;case void 0:return W(),$e("eof")}W()},value(){switch(we){case"{":case"[":return $e("punctuator",W());case"n":return W(),us("ull"),$e("null",null);case"t":return W(),us("rue"),$e("boolean",!0);case"f":return W(),us("alse"),$e("boolean",!1);case"-":case"+":W()==="-"&&(Vt=-1),Ce="sign";return;case".":ye=W(),Ce="decimalPointLeading";return;case"0":ye=W(),Ce="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":ye=W(),Ce="decimalInteger";return;case"I":return W(),us("nfinity"),$e("numeric",1/0);case"N":return W(),us("aN"),$e("numeric",NaN);case'"':case"'":vn=W()==='"',ye="",Ce="string";return}throw Le(W())},identifierNameStartEscape(){if(we!=="u")throw Le(W());W();const n=Ro();switch(n){case"$":case"_":break;default:if(!He.isIdStartChar(n))throw qi();break}ye+=n,Ce="identifierName"},identifierName(){switch(we){case"$":case"_":case"‌":case"‍":ye+=W();return;case"\\":W(),Ce="identifierNameEscape";return}if(He.isIdContinueChar(we)){ye+=W();return}return $e("identifier",ye)},identifierNameEscape(){if(we!=="u")throw Le(W());W();const n=Ro();switch(n){case"$":case"_":case"‌":case"‍":break;default:if(!He.isIdContinueChar(n))throw qi();break}ye+=n,Ce="identifierName"},sign(){switch(we){case".":ye=W(),Ce="decimalPointLeading";return;case"0":ye=W(),Ce="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":ye=W(),Ce="decimalInteger";return;case"I":return W(),us("nfinity"),$e("numeric",Vt*(1/0));case"N":return W(),us("aN"),$e("numeric",NaN)}throw Le(W())},zero(){switch(we){case".":ye+=W(),Ce="decimalPoint";return;case"e":case"E":ye+=W(),Ce="decimalExponent";return;case"x":case"X":ye+=W(),Ce="hexadecimal";return}return $e("numeric",Vt*0)},decimalInteger(){switch(we){case".":ye+=W(),Ce="decimalPoint";return;case"e":case"E":ye+=W(),Ce="decimalExponent";return}if(He.isDigit(we)){ye+=W();return}return $e("numeric",Vt*Number(ye))},decimalPointLeading(){if(He.isDigit(we)){ye+=W(),Ce="decimalFraction";return}throw Le(W())},decimalPoint(){switch(we){case"e":case"E":ye+=W(),Ce="decimalExponent";return}if(He.isDigit(we)){ye+=W(),Ce="decimalFraction";return}return $e("numeric",Vt*Number(ye))},decimalFraction(){switch(we){case"e":case"E":ye+=W(),Ce="decimalExponent";return}if(He.isDigit(we)){ye+=W();return}return $e("numeric",Vt*Number(ye))},decimalExponent(){switch(we){case"+":case"-":ye+=W(),Ce="decimalExponentSign";return}if(He.isDigit(we)){ye+=W(),Ce="decimalExponentInteger";return}throw Le(W())},decimalExponentSign(){if(He.isDigit(we)){ye+=W(),Ce="decimalExponentInteger";return}throw Le(W())},decimalExponentInteger(){if(He.isDigit(we)){ye+=W();return}return $e("numeric",Vt*Number(ye))},hexadecimal(){if(He.isHexDigit(we)){ye+=W(),Ce="hexadecimalInteger";return}throw Le(W())},hexadecimalInteger(){if(He.isHexDigit(we)){ye+=W();return}return $e("numeric",Vt*Number(ye))},string(){switch(we){case"\\":W(),ye+=ld();return;case'"':if(vn)return W(),$e("string",ye);ye+=W();return;case"'":if(!vn)return W(),$e("string",ye);ye+=W();return;case`
`:case"\r":throw Le(W());case"\u2028":case"\u2029":hd(we);break;case void 0:throw Le(W())}ye+=W()},start(){switch(we){case"{":case"[":return $e("punctuator",W())}Ce="value"},beforePropertyName(){switch(we){case"$":case"_":ye=W(),Ce="identifierName";return;case"\\":W(),Ce="identifierNameStartEscape";return;case"}":return $e("punctuator",W());case'"':case"'":vn=W()==='"',Ce="string";return}if(He.isIdStartChar(we)){ye+=W(),Ce="identifierName";return}throw Le(W())},afterPropertyName(){if(we===":")return $e("punctuator",W());throw Le(W())},beforePropertyValue(){Ce="value"},afterPropertyValue(){switch(we){case",":case"}":return $e("punctuator",W())}throw Le(W())},beforeArrayValue(){if(we==="]")return $e("punctuator",W());Ce="value"},afterArrayValue(){switch(we){case",":case"]":return $e("punctuator",W())}throw Le(W())},end(){throw Le(W())}};function $e(n,e){return{type:n,value:e,line:is,column:Ft}}function us(n){for(const e of n){if(Wt()!==e)throw Le(W());W()}}function ld(){switch(Wt()){case"b":return W(),"\b";case"f":return W(),"\f";case"n":return W(),`
`;case"r":return W(),"\r";case"t":return W(),"	";case"v":return W(),"\v";case"0":if(W(),He.isDigit(Wt()))throw Le(W());return"\0";case"x":return W(),cd();case"u":return W(),Ro();case`
`:case"\u2028":case"\u2029":return W(),"";case"\r":return W(),Wt()===`
`&&W(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw Le(W());case void 0:throw Le(W())}return W()}function cd(){let n="",e=Wt();if(!He.isHexDigit(e)||(n+=W(),e=Wt(),!He.isHexDigit(e)))throw Le(W());return n+=W(),String.fromCodePoint(parseInt(n,16))}function Ro(){let n="",e=4;for(;e-- >0;){const t=Wt();if(!He.isHexDigit(t))throw Le(W());n+=W()}return String.fromCodePoint(parseInt(n,16))}const ud={start(){if(et.type==="eof")throw hs();vo()},beforePropertyName(){switch(et.type){case"identifier":case"string":di=et.value,it="afterPropertyName";return;case"punctuator":er();return;case"eof":throw hs()}},afterPropertyName(){if(et.type==="eof")throw hs();it="beforePropertyValue"},beforePropertyValue(){if(et.type==="eof")throw hs();vo()},beforeArrayValue(){if(et.type==="eof")throw hs();if(et.type==="punctuator"&&et.value==="]"){er();return}vo()},afterPropertyValue(){if(et.type==="eof")throw hs();switch(et.value){case",":it="beforePropertyName";return;case"}":er()}},afterArrayValue(){if(et.type==="eof")throw hs();switch(et.value){case",":it="beforeArrayValue";return;case"]":er()}},end(){}};function vo(){let n;switch(et.type){case"punctuator":switch(et.value){case"{":n={};break;case"[":n=[];break}break;case"null":case"boolean":case"numeric":case"string":n=et.value;break}if(Sn===void 0)Sn=n;else{const e=Rt[Rt.length-1];Array.isArray(e)?e.push(n):Object.defineProperty(e,di,{value:n,writable:!0,enumerable:!0,configurable:!0})}if(n!==null&&typeof n=="object")Rt.push(n),Array.isArray(n)?it="beforeArrayValue":it="beforePropertyName";else{const e=Rt[Rt.length-1];e==null?it="end":Array.isArray(e)?it="afterArrayValue":it="afterPropertyValue"}}function er(){Rt.pop();const n=Rt[Rt.length-1];n==null?it="end":Array.isArray(n)?it="afterArrayValue":it="afterPropertyValue"}function Le(n){return kr(n===void 0?`JSON5: invalid end of input at ${is}:${Ft}`:`JSON5: invalid character '${El(n)}' at ${is}:${Ft}`)}function hs(){return kr(`JSON5: invalid end of input at ${is}:${Ft}`)}function qi(){return Ft-=5,kr(`JSON5: invalid identifier character at ${is}:${Ft}`)}function hd(n){console.warn(`JSON5: '${El(n)}' in strings is not valid ECMAScript; consider escaping`)}function El(n){const e={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","	":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(e[n])return e[n];if(n<" "){const t=n.charCodeAt(0).toString(16);return"\\x"+("00"+t).substring(t.length)}return n}function kr(n){const e=new SyntaxError(n);return e.lineNumber=is,e.columnNumber=Ft,e}var dd=function(e,t,s){const r=[];let o="",i,a,l="",u;if(t!=null&&typeof t=="object"&&!Array.isArray(t)&&(s=t.space,u=t.quote,t=t.replacer),typeof t=="function")a=t;else if(Array.isArray(t)){i=[];for(const f of t){let y;typeof f=="string"?y=f:(typeof f=="number"||f instanceof String||f instanceof Number)&&(y=String(f)),y!==void 0&&i.indexOf(y)<0&&i.push(y)}}return s instanceof Number?s=Number(s):s instanceof String&&(s=String(s)),typeof s=="number"?s>0&&(s=Math.min(10,Math.floor(s)),l="          ".substr(0,s)):typeof s=="string"&&(l=s.substr(0,10)),d("",{"":e});function d(f,y){let b=y[f];switch(b!=null&&(typeof b.toJSON5=="function"?b=b.toJSON5(f):typeof b.toJSON=="function"&&(b=b.toJSON(f))),a&&(b=a.call(y,f,b)),b instanceof Number?b=Number(b):b instanceof String?b=String(b):b instanceof Boolean&&(b=b.valueOf()),b){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof b=="string")return h(b);if(typeof b=="number")return String(b);if(typeof b=="object")return Array.isArray(b)?m(b):p(b)}function h(f){const y={"'":.1,'"':.2},b={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","	":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};let C="";for(let v=0;v<f.length;v++){const E=f[v];switch(E){case"'":case'"':y[E]++,C+=E;continue;case"\0":if(He.isDigit(f[v+1])){C+="\\x00";continue}}if(b[E]){C+=b[E];continue}if(E<" "){let A=E.charCodeAt(0).toString(16);C+="\\x"+("00"+A).substring(A.length);continue}C+=E}const D=u||Object.keys(y).reduce((v,E)=>y[v]<y[E]?v:E);return C=C.replace(new RegExp(D,"g"),b[D]),D+C+D}function p(f){if(r.indexOf(f)>=0)throw TypeError("Converting circular structure to JSON5");r.push(f);let y=o;o=o+l;let b=i||Object.keys(f),C=[];for(const v of b){const E=d(v,f);if(E!==void 0){let A=g(v)+":";l!==""&&(A+=" "),A+=E,C.push(A)}}let D;if(C.length===0)D="{}";else{let v;if(l==="")v=C.join(","),D="{"+v+"}";else{let E=`,
`+o;v=C.join(E),D=`{
`+o+v+`,
`+y+"}"}}return r.pop(),o=y,D}function g(f){if(f.length===0)return h(f);const y=String.fromCodePoint(f.codePointAt(0));if(!He.isIdStartChar(y))return h(f);for(let b=y.length;b<f.length;b++)if(!He.isIdContinueChar(String.fromCodePoint(f.codePointAt(b))))return h(f);return f}function m(f){if(r.indexOf(f)>=0)throw TypeError("Converting circular structure to JSON5");r.push(f);let y=o;o=o+l;let b=[];for(let D=0;D<f.length;D++){const v=d(String(D),f);b.push(v!==void 0?v:"null")}let C;if(b.length===0)C="[]";else if(l==="")C="["+b.join(",")+"]";else{let D=`,
`+o,v=b.join(D);C=`[
`+o+v+`,
`+y+"]"}return r.pop(),o=y,C}};const pd={parse:id,stringify:dd};var xl=pd,pi={exports:{}};function fd(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var gr={exports:{}};const md={},gd=Object.freeze(Object.defineProperty({__proto__:null,default:md},Symbol.toStringTag,{value:"Module"})),yd=wu(gd);var bd=gr.exports,Yi;function Cd(){return Yi||(Yi=1,(function(n,e){(function(t,s){n.exports=s()})(bd,function(){var t=t||(function(s,r){var o;if(typeof window<"u"&&window.crypto&&(o=window.crypto),typeof self<"u"&&self.crypto&&(o=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(o=globalThis.crypto),!o&&typeof window<"u"&&window.msCrypto&&(o=window.msCrypto),!o&&typeof go<"u"&&go.crypto&&(o=go.crypto),!o&&typeof fd=="function")try{o=yd}catch{}var i=function(){if(o){if(typeof o.getRandomValues=="function")try{return o.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof o.randomBytes=="function")try{return o.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||(function(){function C(){}return function(D){var v;return C.prototype=D,v=new C,C.prototype=null,v}})(),l={},u=l.lib={},d=u.Base=(function(){return{extend:function(C){var D=a(this);return C&&D.mixIn(C),(!D.hasOwnProperty("init")||this.init===D.init)&&(D.init=function(){D.$super.init.apply(this,arguments)}),D.init.prototype=D,D.$super=this,D},create:function(){var C=this.extend();return C.init.apply(C,arguments),C},init:function(){},mixIn:function(C){for(var D in C)C.hasOwnProperty(D)&&(this[D]=C[D]);C.hasOwnProperty("toString")&&(this.toString=C.toString)},clone:function(){return this.init.prototype.extend(this)}}})(),h=u.WordArray=d.extend({init:function(C,D){C=this.words=C||[],D!=r?this.sigBytes=D:this.sigBytes=C.length*4},toString:function(C){return(C||g).stringify(this)},concat:function(C){var D=this.words,v=C.words,E=this.sigBytes,A=C.sigBytes;if(this.clamp(),E%4)for(var S=0;S<A;S++){var T=v[S>>>2]>>>24-S%4*8&255;D[E+S>>>2]|=T<<24-(E+S)%4*8}else for(var N=0;N<A;N+=4)D[E+N>>>2]=v[N>>>2];return this.sigBytes+=A,this},clamp:function(){var C=this.words,D=this.sigBytes;C[D>>>2]&=4294967295<<32-D%4*8,C.length=s.ceil(D/4)},clone:function(){var C=d.clone.call(this);return C.words=this.words.slice(0),C},random:function(C){for(var D=[],v=0;v<C;v+=4)D.push(i());return new h.init(D,C)}}),p=l.enc={},g=p.Hex={stringify:function(C){for(var D=C.words,v=C.sigBytes,E=[],A=0;A<v;A++){var S=D[A>>>2]>>>24-A%4*8&255;E.push((S>>>4).toString(16)),E.push((S&15).toString(16))}return E.join("")},parse:function(C){for(var D=C.length,v=[],E=0;E<D;E+=2)v[E>>>3]|=parseInt(C.substr(E,2),16)<<24-E%8*4;return new h.init(v,D/2)}},m=p.Latin1={stringify:function(C){for(var D=C.words,v=C.sigBytes,E=[],A=0;A<v;A++){var S=D[A>>>2]>>>24-A%4*8&255;E.push(String.fromCharCode(S))}return E.join("")},parse:function(C){for(var D=C.length,v=[],E=0;E<D;E++)v[E>>>2]|=(C.charCodeAt(E)&255)<<24-E%4*8;return new h.init(v,D)}},f=p.Utf8={stringify:function(C){try{return decodeURIComponent(escape(m.stringify(C)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(C){return m.parse(unescape(encodeURIComponent(C)))}},y=u.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new h.init,this._nDataBytes=0},_append:function(C){typeof C=="string"&&(C=f.parse(C)),this._data.concat(C),this._nDataBytes+=C.sigBytes},_process:function(C){var D,v=this._data,E=v.words,A=v.sigBytes,S=this.blockSize,T=S*4,N=A/T;C?N=s.ceil(N):N=s.max((N|0)-this._minBufferSize,0);var V=N*S,_=s.min(V*4,A);if(V){for(var $=0;$<V;$+=S)this._doProcessBlock(E,$);D=E.splice(0,V),v.sigBytes-=_}return new h.init(D,_)},clone:function(){var C=d.clone.call(this);return C._data=this._data.clone(),C},_minBufferSize:0});u.Hasher=y.extend({cfg:d.extend(),init:function(C){this.cfg=this.cfg.extend(C),this.reset()},reset:function(){y.reset.call(this),this._doReset()},update:function(C){return this._append(C),this._process(),this},finalize:function(C){C&&this._append(C);var D=this._doFinalize();return D},blockSize:16,_createHelper:function(C){return function(D,v){return new C.init(v).finalize(D)}},_createHmacHelper:function(C){return function(D,v){return new b.HMAC.init(C,v).finalize(D)}}});var b=l.algo={};return l})(Math);return t})})(gr)),gr.exports}var Dd=pi.exports;(function(n,e){(function(t,s){n.exports=s(Cd())})(Dd,function(t){return(function(s){var r=t,o=r.lib,i=o.WordArray,a=o.Hasher,l=r.algo,u=[];(function(){for(var f=0;f<64;f++)u[f]=s.abs(s.sin(f+1))*4294967296|0})();var d=l.MD5=a.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(f,y){for(var b=0;b<16;b++){var C=y+b,D=f[C];f[C]=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360}var v=this._hash.words,E=f[y+0],A=f[y+1],S=f[y+2],T=f[y+3],N=f[y+4],V=f[y+5],_=f[y+6],$=f[y+7],j=f[y+8],U=f[y+9],R=f[y+10],K=f[y+11],ae=f[y+12],se=f[y+13],de=f[y+14],ie=f[y+15],P=v[0],M=v[1],O=v[2],B=v[3];P=h(P,M,O,B,E,7,u[0]),B=h(B,P,M,O,A,12,u[1]),O=h(O,B,P,M,S,17,u[2]),M=h(M,O,B,P,T,22,u[3]),P=h(P,M,O,B,N,7,u[4]),B=h(B,P,M,O,V,12,u[5]),O=h(O,B,P,M,_,17,u[6]),M=h(M,O,B,P,$,22,u[7]),P=h(P,M,O,B,j,7,u[8]),B=h(B,P,M,O,U,12,u[9]),O=h(O,B,P,M,R,17,u[10]),M=h(M,O,B,P,K,22,u[11]),P=h(P,M,O,B,ae,7,u[12]),B=h(B,P,M,O,se,12,u[13]),O=h(O,B,P,M,de,17,u[14]),M=h(M,O,B,P,ie,22,u[15]),P=p(P,M,O,B,A,5,u[16]),B=p(B,P,M,O,_,9,u[17]),O=p(O,B,P,M,K,14,u[18]),M=p(M,O,B,P,E,20,u[19]),P=p(P,M,O,B,V,5,u[20]),B=p(B,P,M,O,R,9,u[21]),O=p(O,B,P,M,ie,14,u[22]),M=p(M,O,B,P,N,20,u[23]),P=p(P,M,O,B,U,5,u[24]),B=p(B,P,M,O,de,9,u[25]),O=p(O,B,P,M,T,14,u[26]),M=p(M,O,B,P,j,20,u[27]),P=p(P,M,O,B,se,5,u[28]),B=p(B,P,M,O,S,9,u[29]),O=p(O,B,P,M,$,14,u[30]),M=p(M,O,B,P,ae,20,u[31]),P=g(P,M,O,B,V,4,u[32]),B=g(B,P,M,O,j,11,u[33]),O=g(O,B,P,M,K,16,u[34]),M=g(M,O,B,P,de,23,u[35]),P=g(P,M,O,B,A,4,u[36]),B=g(B,P,M,O,N,11,u[37]),O=g(O,B,P,M,$,16,u[38]),M=g(M,O,B,P,R,23,u[39]),P=g(P,M,O,B,se,4,u[40]),B=g(B,P,M,O,E,11,u[41]),O=g(O,B,P,M,T,16,u[42]),M=g(M,O,B,P,_,23,u[43]),P=g(P,M,O,B,U,4,u[44]),B=g(B,P,M,O,ae,11,u[45]),O=g(O,B,P,M,ie,16,u[46]),M=g(M,O,B,P,S,23,u[47]),P=m(P,M,O,B,E,6,u[48]),B=m(B,P,M,O,$,10,u[49]),O=m(O,B,P,M,de,15,u[50]),M=m(M,O,B,P,V,21,u[51]),P=m(P,M,O,B,ae,6,u[52]),B=m(B,P,M,O,T,10,u[53]),O=m(O,B,P,M,R,15,u[54]),M=m(M,O,B,P,A,21,u[55]),P=m(P,M,O,B,j,6,u[56]),B=m(B,P,M,O,ie,10,u[57]),O=m(O,B,P,M,_,15,u[58]),M=m(M,O,B,P,se,21,u[59]),P=m(P,M,O,B,N,6,u[60]),B=m(B,P,M,O,K,10,u[61]),O=m(O,B,P,M,S,15,u[62]),M=m(M,O,B,P,U,21,u[63]),v[0]=v[0]+P|0,v[1]=v[1]+M|0,v[2]=v[2]+O|0,v[3]=v[3]+B|0},_doFinalize:function(){var f=this._data,y=f.words,b=this._nDataBytes*8,C=f.sigBytes*8;y[C>>>5]|=128<<24-C%32;var D=s.floor(b/4294967296),v=b;y[(C+64>>>9<<4)+15]=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,y[(C+64>>>9<<4)+14]=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360,f.sigBytes=(y.length+1)*4,this._process();for(var E=this._hash,A=E.words,S=0;S<4;S++){var T=A[S];A[S]=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360}return E},clone:function(){var f=a.clone.call(this);return f._hash=this._hash.clone(),f}});function h(f,y,b,C,D,v,E){var A=f+(y&b|~y&C)+D+E;return(A<<v|A>>>32-v)+y}function p(f,y,b,C,D,v,E){var A=f+(y&C|b&~C)+D+E;return(A<<v|A>>>32-v)+y}function g(f,y,b,C,D,v,E){var A=f+(y^b^C)+D+E;return(A<<v|A>>>32-v)+y}function m(f,y,b,C,D,v,E){var A=f+(b^(y|~C))+D+E;return(A<<v|A>>>32-v)+y}r.MD5=a._createHelper(d),r.HmacMD5=a._createHmacHelper(d)})(Math),t.MD5})})(pi);var vd=pi.exports;const Gi=Eu(vd),wd=window.innerWidth<=600?12:void 0;function wo(n){return Object.prototype.toString.call(n)==="[object Object]"}class F extends Ka{static DIFFERENT_VALUE="__different__";static DIFFERENT_LABEL="ra___different__";static NONE_VALUE="";static NONE_LABEL="ra_none";defaultValue;isError;lang;defaultSendToDone;sendToTimeout;noPlaceRequired;reportedHidden=!1;constructor(e){super(e),this.state={confirmDialog:!1,confirmNewValue:null,confirmAttr:null,confirmData:null,confirmCallback:null},this.isError={},e.schema&&(e.custom?this.defaultValue=e.schema.defaultFunc?this.executeCustom(e.schema.defaultFunc,e.data,e.customObj,e.oContext.instanceObj,e.arrayIndex,e.globalData):e.schema.default:e.schema.type!=="state"&&(this.defaultValue=e.schema.defaultFunc?this.execute(e.schema.defaultFunc,e.schema.default,e.data,e.arrayIndex,e.globalData):e.schema.default)),this.lang=x.getLanguage()}componentDidMount(){this.props.oContext.registerOnForceUpdate&&this.props.oContext.registerOnForceUpdate(this.props.attr,this.onUpdate);const e=["select","autocomplete","autocompleteSendTo"];if(this.defaultValue!==void 0){const t=F.getValue(this.props.data,this.props.attr);(t===void 0||e.includes(this.props.schema.type)&&(t===""||t===null))&&setTimeout(()=>{this.props.custom?this.props.onChange(this.props.attr,this.defaultValue,()=>setTimeout(()=>this.props.oContext.forceUpdate([this.props.attr],this.props.data),100)):(F.setValue(this.props.data,this.props.attr,this.defaultValue),this.props.onChange(this.props.data,void 0,()=>this.props.oContext.forceUpdate([this.props.attr],this.props.data)))},100)}else this.props.schema.defaultSendTo&&this.sendTo()}sendTo(){if(this.props.alive){this.defaultSendToDone=!0;let e=this.props.schema.data;if(e===void 0&&this.props.schema.jsonData){const t=this.getPattern(this.props.schema.jsonData,null,!0);try{e=JSON.parse(t)}catch{console.error(`Cannot parse json data: ${t}`)}}else e={attr:this.props.attr,value:F.getValue(this.props.data,this.props.attr)};e===void 0&&(e=null),this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.defaultSendTo,e).then(t=>{t!=null&&(this.props.custom?this.props.onChange(this.props.attr,t,()=>this.props.oContext.forceUpdate([this.props.attr],this.props.data)):(F.setValue(this.props.data,this.props.attr,t),this.props.onChange(this.props.data,void 0,()=>this.props.oContext.forceUpdate([this.props.attr],this.props.data))))})}else this.defaultSendToDone=!1,this.props.schema.allowSaveWithError||this.onError(this.props.attr,x.t("ra_Instance %s is not alive",this.props.oContext.instance.toString()))}componentWillUnmount(){this.props.oContext.registerOnForceUpdate&&this.props.oContext.registerOnForceUpdate(this.props.attr),this.sendToTimeout&&(clearTimeout(this.sendToTimeout),this.sendToTimeout=null)}onUpdate=e=>{const t=F.getValue(e||this.props.data,this.props.attr)||"";this.state.value!==t?this.setState({value:t}):this.forceUpdate()};static getValue(e,t){if(typeof t=="string")return F.getValue(e,t.split("."));if(t.length===1)return e[t[0]];const s=t.shift();if(typeof s=="string"&&typeof e[s]=="object")return F.getValue(e[s],t)}static setValue(e,t,s){if(typeof t=="string"){F.setValue(e,t.split("."),s);return}if(t.length===1)s===null?delete e[t[0]]:e[t[0]]=s;else{const r=t.shift();if(typeof r!="string")return;(!e[r]||typeof e[r]=="object")&&(e[r]=e[r]||{}),F.setValue(e[r],t,s)}}getText(e,t){if(!e)return"";if(typeof e=="string"){const s=t?e:x.t(e);return s.includes("${")?this.getPattern(s,null,t):s}return wo(e)?e.func?typeof e.func=="object"?this.getPattern(e.func[this.lang]||e.func.en||"",null,!0):this.getPattern(e.func,null,t):e[this.lang]||e.en||"":e.toString()}renderDialogConfirm(){if(!this.state.confirmDialog)return null;const e=this.state.confirmData||this.props.schema.confirm;let t=null;return e.type==="warning"?t=c.createElement(_n,null):e.type==="error"?t=c.createElement(vs,null):e.type==="info"&&(t=c.createElement(wr,null)),c.createElement(ws,{title:this.getText(e.title)||x.t("ra_Please confirm"),text:this.getText(e.text),ok:this.getText(e.ok)||x.t("ra_Ok"),cancel:this.getText(e.cancel)||x.t("ra_Cancel"),icon:t||void 0,onClose:s=>this.setState({confirmDialog:!1},()=>{if(s){if(this.state.confirmCallback){const o=this.state.confirmCallback;this.setState({confirmCallback:null},()=>o(!0));return}const r=JSON.parse(JSON.stringify(this.props.data));this.state.confirmDepAttr&&F.setValue(r,this.state.confirmDepAttr,this.state.confirmDepNewValue),F.setValue(r,this.state.confirmAttr,this.state.confirmNewValue),this.setState({confirmDialog:!1,confirmDepAttr:null,confirmDepNewValue:null,confirmNewValue:null,confirmAttr:null,confirmData:null},()=>this.props.onChange(r))}else{const r=this.state.confirmCallback;this.setState({confirmDialog:!1,confirmDepAttr:null,confirmDepNewValue:null,confirmNewValue:null,confirmAttr:null,confirmData:null,confirmCallback:null},()=>{r&&r(!1)})}})})}getIcon(e){e=e||this.props.schema.icon;let t=null;return e==="auth"?t=c.createElement(Ru,null):e==="send"?t=c.createElement(sl,null):e==="web"?t=c.createElement(ju,null):e==="warning"?t=c.createElement(_n,null):e==="error"?t=c.createElement(vs,null):e==="info"?t=c.createElement(wr,null):e==="search"?t=c.createElement(nl,null):e==="book"?t=c.createElement(Uu,null):e==="help"?t=c.createElement(Wu,null):e==="upload"?t=c.createElement(On,null):e==="edit"?t=c.createElement(rl,null):e==="user"?t=c.createElement(ol,null):e==="group"?t=c.createElement(il,null):e==="delete"?t=c.createElement(ts,null):e==="refresh"?t=c.createElement(oi,null):e==="add"?t=c.createElement(Pn,null):e==="unpair"?t=c.createElement(al,null):e==="pair"?t=c.createElement(ll,null):e==="save"?t=c.createElement(zu,null):e==="open"?t=c.createElement(Hu,null):e&&((e.endsWith(".png")||e.endsWith(".svg")||e.endsWith(".jpg"))&&!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`./adapter/${this.props.oContext.adapterName}/${e}`),t=c.createElement(Es,{src:e,style:{width:22,height:22}})),t}onChangeAsync(e,t){return new Promise(s=>{const r=this.onChange(e,t,s);r instanceof Promise&&r.catch(o=>console.error(`Cannot set value: ${o}`))})}onChange(e,t,s){const r=JSON.parse(JSON.stringify(this.props.data));if(F.setValue(r,e,t),this.props.schema.confirm&&this.execute(this.props.schema.confirm.condition,!1,r,this.props.arrayIndex,this.props.globalData))return new Promise(i=>{this.setState({confirmDialog:!0,confirmNewValue:t,confirmAttr:e,confirmData:null},()=>{typeof s=="function"?s():i()})});if(this.props.schema.confirmDependsOn)for(let i=0;i<this.props.schema.confirmDependsOn.length;i++){const a=this.props.schema.confirmDependsOn[i];if(a.confirm){const l=F.getValue(r,a.attr);if(this.execute(a.confirm.condition,!1,r,this.props.arrayIndex,this.props.globalData))return new Promise(u=>{this.setState({confirmDialog:!0,confirmNewValue:t,confirmAttr:e,confirmDepNewValue:l,confirmDepAttr:a.attr,confirmData:a.confirm},()=>{typeof s=="function"?s():u()})})}}const o=[];if(this.props.schema.onChangeDependsOn)for(let i=0;i<this.props.schema.onChangeDependsOn.length;i++){const a=this.props.schema.onChangeDependsOn[i];if(a.onChange){const l=F.getValue(r,a.attr);let u;this.props.custom?u=this.executeCustom(a.onChange.calculateFunc,r,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):u=this.execute(a.onChange.calculateFunc,l,r,this.props.arrayIndex,this.props.globalData),u!==l&&(F.setValue(r,a.attr,u),o.push(a.attr))}}if(this.props.schema.hiddenDependsOn)for(let i=0;i<this.props.schema.hiddenDependsOn.length;i++){const a=this.props.schema.hiddenDependsOn[i];a.hidden&&o.push(a.attr)}if(this.props.schema.labelDependsOn)for(let i=0;i<this.props.schema.labelDependsOn.length;i++){const a=this.props.schema.labelDependsOn[i];a.hidden&&o.push(a.attr)}if(this.props.schema.helpDependsOn)for(let i=0;i<this.props.schema.helpDependsOn.length;i++){const a=this.props.schema.helpDependsOn[i];a.hidden&&o.push(a.attr)}if(this.props.schema.onChange&&!this.props.schema.onChange.ignoreOwnChanges){const i=F.getValue(r,this.props.attr),a=this.props.custom?this.executeCustom(this.props.schema.onChange.calculateFunc,r,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):this.execute(this.props.schema.onChange.calculateFunc,i,r,this.props.arrayIndex,this.props.globalData);a!==i&&F.setValue(r,this.props.attr,a)}return this.props.custom?(this.props.onChange(e,t,()=>s&&s()),o!=null&&o.length&&o.forEach((i,a)=>setTimeout(()=>this.props.onChange(i,F.getValue(r,i)),a*50))):this.props.onChange(r,void 0,()=>{o.length&&this.props.oContext.forceUpdate(o,r),s&&s()}),Promise.resolve()}execute(e,t,s,r,o){let i;if(wo(e))i=e.func;else if(typeof e=="string")i=e;else return e;if(!i)return t;try{return new Function("data","originalData","_system","_alive","_common","_socket","_instance","arrayIndex","globalData","_changed",i.includes("return")?i:`return ${i}`)(s||this.props.data,this.props.originalData,this.props.oContext.systemConfig,this.props.alive,this.props.common,this.props.oContext.socket,this.props.oContext.instance,r,o,this.props.changed)}catch(a){return console.error(`Cannot execute ${JSON.stringify(e)}: ${a}`),t}}executeCustom(e,t,s,r,o,i){let a;if(wo(e))a=e.func;else if(typeof e=="string")a=e;else return e;if(!a)return null;try{return new Function("data","originalData","_system","instanceObj","customObj","_socket","arrayIndex","globalData","_changed",a.includes("return")?a:`return ${a}`)(t||this.props.data,this.props.originalData,this.props.oContext.systemConfig,r,s,this.props.oContext.socket,o,i,this.props.changed)}catch(l){return console.error(`Cannot execute ${a}: ${l}`),null}}calculate(e){let t,s,r,o;return this.props.custom?(t=e.validator?!this.executeCustom(e.validator,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):!1,e.disabled===!0?s=!0:s=e.disabled?this.executeCustom(e.disabled,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):!1,e.hidden===!0?r=!0:r=e.hidden?this.executeCustom(e.hidden,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):!1,o=e.defaultFunc?this.executeCustom(e.defaultFunc,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):e.default):(t=e.validator?!this.execute(e.validator,!1,this.props.data,this.props.arrayIndex,this.props.globalData):!1,e.disabled===!0?s=!0:s=e.disabled?this.execute(e.disabled,!1,this.props.data,this.props.arrayIndex,this.props.globalData):!1,e.hidden===!0?r=!0:r=e.hidden?this.execute(e.hidden,!1,this.props.data,this.props.arrayIndex,this.props.globalData):!1,o=e.defaultFunc?this.execute(e.defaultFunc,e.default,this.props.data,this.props.arrayIndex,this.props.globalData):e.default),{error:t,disabled:s,hidden:r,defaultValue:o}}onError(e,t){t?this.isError[e]=t:delete this.isError[e],this.props.onError&&this.props.onError(e,t)}renderItem(e,t,s){return this.getText(this.props.schema.label)||this.getText(this.props.schema.text)}renderHelp(e,t,s){return t?c.createElement("a",{href:t,target:"_blank",rel:"noreferrer",style:{color:this.props.oContext.themeType==="dark"?"#a147ff":"#5b238f",textDecoration:"underline"}},this.getText(e,s)):(e=this.getText(e,s)||"",e&&(e.includes("<a ")||e.includes("<br")||e.includes("<b>")||e.includes("<i>"))?je.renderTextWithA(e):e)}static escapeString(e,t){return typeof e!="string"?"":(e=e.replace(/`/g,"\\`"),e=e.replace(/\${([^}]+)}/g,(s,r)=>{if(r&&typeof r=="string"&&r.startsWith("data.")){const o=F.getValue(t,r.replace(/^data\./,""));if(typeof o=="string"&&(o.includes("\\")||o.includes('"')))return`\${${r}.replace(/\\\\/g, '\\\\\\\\').replace(/"/g, '\\\\"')}`}return s}),e)}getPattern(e,t,s){if(t=t||this.props.data,!e)return"";let r;typeof e=="object"?e.func?r=e.func:(console.log(`Object must be stringified: ${JSON.stringify(e)}`),r=JSON.stringify(e)):r=e;try{if(this.props.custom)return new Function("data","originalData","arrayIndex","globalData","_system","instanceObj","customObj","_socket","_changed",`return \`${F.escapeString(r,t)}\``)(t,this.props.originalData,this.props.arrayIndex,this.props.globalData,this.props.oContext.systemConfig,this.props.oContext.instanceObj,this.props.customObj,this.props.oContext.socket,this.props.changed);const i=new Function("data","originalData","arrayIndex","globalData","_system","_alive","_common","_socket","_changed",`return \`${F.escapeString(r,t)}\``)(t,this.props.originalData,this.props.arrayIndex,this.props.globalData,this.props.oContext.systemConfig,this.props.alive,this.props.common,this.props.oContext.socket,this.props.changed);return s?i:x.t(i)}catch(o){return console.error(`Cannot execute ${r}: ${o}`),r}}render(){const e=this.props.schema;if(!e||this.props.expertMode===!1&&e.expertMode)return null;this.props.alive&&this.defaultSendToDone===!1&&(this.sendToTimeout=setTimeout(()=>{this.sendToTimeout=null,this.sendTo()},200));const{error:t,disabled:s,hidden:r,defaultValue:o}=this.calculate(e);if(r){if(Object.keys(this.isError).length&&(setTimeout(l=>Object.keys(l).forEach(u=>this.props.onError(u)),100,JSON.parse(JSON.stringify(this.isError))),this.isError={}),e.hideOnlyControl){const l=c.createElement(ct,{size:{xs:e.xs||wd,sm:e.sm||void 0,md:e.md||void 0,lg:e.lg||void 0,xl:e.xl||void 0},style:{marginBottom:0,textAlign:"left",...e.style,...this.props.oContext.themeType==="dark"?e.darkStyle:{}}});return e.newLine?c.createElement(c.Fragment,null,c.createElement("div",{style:{flexBasis:"100%",height:0}}),l):l}return this.props.onHiddenChanged&&!this.reportedHidden&&(this.reportedHidden=!0,setTimeout(()=>this.props.onHiddenChanged(this.props.attr,!0),10)),null}this.props.onHiddenChanged&&this.reportedHidden&&(this.reportedHidden=!1,setTimeout(()=>this.props.onHiddenChanged(this.props.attr,!1),10)),e.validatorNoSaveOnError&&(t&&!Object.keys(this.isError).length?(this.isError={[this.props.attr]:e.validatorErrorText?x.t(e.validatorErrorText):!0},setTimeout(l=>Object.keys(l).forEach(u=>this.props.onError(u,l[u])),100,JSON.parse(JSON.stringify(this.isError)))):!t&&Object.keys(this.isError).length&&(setTimeout(l=>Object.keys(l).forEach(u=>this.props.onError(u)),100,JSON.parse(JSON.stringify(this.isError))),this.isError={}));const i=this.renderItem(t,s||this.props.commandRunning||this.props.disabled,o);if(this.noPlaceRequired)return i;const a=c.createElement(ct,{title:this.getText(e.tooltip),size:{xs:e.xs||12,sm:e.sm||void 0,md:e.md||void 0,lg:e.lg||void 0,xl:e.xl||void 0},style:{marginBottom:0,textAlign:"left",width:e.type==="divider"||e.type==="header"?e.width||"100%":void 0,...e.style,...this.props.oContext.themeType==="dark"?e.darkStyle:{}}},this.props.schema.defaultSendTo&&this.props.schema.button?c.createElement(ct,{container:!0,style:{width:"100%"}},c.createElement(ct,{flex:1},i),c.createElement(ct,null,c.createElement(Ne,{disabled:s,variant:"outlined",onClick:()=>this.sendTo(),title:this.props.schema.buttonTooltip?this.getText(this.props.schema.buttonTooltip,this.props.schema.buttonTooltipNoTranslation):x.t("ra_Request data by instance")},this.getText(this.props.schema.button)))):i);return e.newLine?c.createElement(c.Fragment,null,c.createElement("div",{style:{flexBasis:"100%",height:0}}),this.renderDialogConfirm(),a):this.state.confirmDialog?c.createElement(c.Fragment,null,this.renderDialogConfirm(),a):a}}const xt={fullWidth:{width:"100%"},accordionSummary:n=>({backgroundColor:n.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"rgba(0, 0, 0, 0.08)"}),accordionTitle:{},toolbar:n=>({backgroundColor:n.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"rgba(0, 0, 0, 0.08)",borderRadius:"3px"}),tooltip:{pointerEvents:"none"}};class Ed extends F{typingTimer=null;constructor(e){super(e),this.props.schema.items=this.props.schema.items||[]}componentDidMount(){super.componentDidMount();let e=F.getValue(this.props.data,this.props.attr)||[];Array.isArray(e)||(e=[]),this.setState({value:e,activeIndex:-1,iteration:0,accordionErrors:{}})}componentWillUnmount(){this.typingTimer&&(clearTimeout(this.typingTimer),this.typingTimer=null),super.componentWillUnmount()}onAccordionError=e=>(t,s)=>{const r={...this.state.accordionErrors};r[e]||(r[e]={}),s?r[e][t]=s:(delete r[e][t],Object.keys(r[e]).length===0&&delete r[e]),this.setState({accordionErrors:r}),this.props.onError(t,s)};hasAccordionErrors=e=>!!(this.state.accordionErrors[e]&&Object.keys(this.state.accordionErrors[e]).length>0);itemAccordion(e,t){const{value:s}=this.state,{schema:r}=this.props,o={type:"panel",items:r.items.reduce((i,a)=>(i[a.attr]=a,i),{}),style:{marginLeft:"-8px",marginTop:"10px",marginBottom:"10px"}};return c.createElement(_s,{oContext:this.props.oContext,index:t+this.state.iteration,arrayIndex:t,changed:this.props.changed,expertMode:this.props.expertMode,globalData:this.props.data,common:this.props.common,alive:this.props.alive,themeName:this.props.themeName,data:e,custom:!0,schema:o,originalData:this.props.originalData,onChange:(i,a)=>{const l=JSON.parse(JSON.stringify(s));l[t][i]=a,this.setState({value:l},()=>this.onChangeWrapper(l))},onError:this.onAccordionError(t),onHiddenChanged:this.props.onHiddenChanged,table:this.props.table})}onDelete=e=>()=>{const t=JSON.parse(JSON.stringify(this.state.value));t.splice(e,1),this.setState({value:t,iteration:this.state.iteration+1e4},()=>this.onChangeWrapper(t))};onClone=e=>()=>{const t=JSON.parse(JSON.stringify(this.state.value)),s=JSON.parse(JSON.stringify(t[e]));if(typeof this.props.schema.clone=="string"&&typeof s[this.props.schema.clone]=="string"){let r=1,o=s[this.props.schema.clone];const i=o.match(/(\d+)$/);for(i?(o=o.replace(i[0],""),r=parseInt(i[0],10)+1):o+="_";t.find(a=>a[this.props.schema.clone]===o+r.toString());)r++;s[this.props.schema.clone]=`${s[this.props.schema.clone]}_${r}`}t.splice(e,0,s),this.setState({value:t,activeIndex:-1,iteration:this.state.iteration+1e4},()=>this.onChangeWrapper(t))};onChangeWrapper=e=>{this.typingTimer&&clearTimeout(this.typingTimer),this.typingTimer=setTimeout(t=>{this.typingTimer=null;const s=this.onChange(this.props.attr,t);s instanceof Promise&&s.catch(r=>this.onError(r))},300,e)};onAdd=()=>{const{schema:e}=this.props,t=JSON.parse(JSON.stringify(this.state.value)),s=e.items&&e.items.reduce((r,o)=>{let i;return o.defaultFunc?this.props.custom?i=o.defaultFunc?this.executeCustom(o.defaultFunc,this.props.data,this.props.customObj,this.props.oContext.instanceObj,t.length,this.props.data):this.props.schema.default:i=o.defaultFunc?this.execute(o.defaultFunc,this.props.schema.default,this.props.data,t.length,this.props.data):this.props.schema.default:i=o.default===void 0?null:o.default,r[o.attr]=i,r},{});t.push(s),this.setState({value:t,activeIndex:t.length-1},()=>this.onChangeWrapper(t))};onMoveUp(e){const t=JSON.parse(JSON.stringify(this.state.value)),s=t[e];t.splice(e,1),t.splice(e-1,0,s);const r=this.state.activeIndex-1;this.setState({value:t,activeIndex:r,iteration:this.state.iteration+1e4},()=>this.onChangeWrapper(t))}onMoveDown(e){const t=JSON.parse(JSON.stringify(this.state.value)),s=t[e];t.splice(e,1),t.splice(e+1,0,s);const r=this.state.activeIndex+1;this.setState({value:t,activeIndex:r,iteration:this.state.iteration+1e4},()=>this.onChangeWrapper(t))}onExport=()=>{const{value:e}=this.state,t=JSON.stringify(e,null,2),s=`data:application/json;charset=utf-8,${encodeURIComponent(t)}`,r=`config_section_${new Date().toISOString().slice(0,19).replace(/:/g,"-")}.json`,o=document.createElement("a");o.setAttribute("href",s),o.setAttribute("download",r),o.click()};onImport=e=>{const t=document.createElement("input");t.type="file",t.accept=".json",t.onchange=s=>{var i;const r=(i=s.target.files)==null?void 0:i[0];if(!r)return;const o=new FileReader;o.onload=a=>{var l;try{const u=JSON.parse((l=a.target)==null?void 0:l.result);if(!Array.isArray(u)){alert(x.t("ra_Invalid JSON format. Expected an array."));return}let d;e?d=u:d=[...this.state.value,...u],this.setState({value:d,activeIndex:-1},()=>this.onChangeWrapper(d))}catch{alert(x.t("ra_Invalid JSON file."))}},o.readAsText(r)},t.click()};renderItem(){const{schema:e}=this.props,{value:t}=this.state;return t?c.createElement(yn,null,e.label||!e.noDelete?c.createElement(xn,{variant:"dense"},e.label?c.createElement(Ut,{variant:"h6",id:"tableTitle",component:"div"},this.getText(e.label)):null,e.noDelete?null:c.createElement(c.Fragment,null,c.createElement(Pe,{title:x.t("ra_Export configuration section")},c.createElement(fe,{size:"small",color:"primary",onClick:this.onExport},c.createElement(Ju,null))),c.createElement(Pe,{title:x.t("ra_Import and replace configuration section")},c.createElement(fe,{size:"small",color:"primary",onClick:()=>this.onImport(!0)},c.createElement(Ku,null))),c.createElement(Pe,{title:x.t("ra_Import and add configuration section")},c.createElement(fe,{size:"small",color:"primary",onClick:()=>this.onImport(!1)},c.createElement(qu,null))),c.createElement(fe,{size:"small",color:"primary",onClick:this.onAdd},c.createElement(Pn,null)))):null,t.map((s,r)=>c.createElement(ei,{key:`${s}_${r}`,expanded:this.state.activeIndex===r,onChange:(o,i)=>this.setState({activeIndex:i?r:-1})},c.createElement(ti,{expandIcon:c.createElement(Er,null),sx:je.getStyle(this.props.oContext.theme,xt.fullWidth,xt.accordionSummary)},c.createElement(Ze,{sx:{display:"flex",alignItems:"center",gap:1,width:"100%"}},c.createElement(Ut,{style:xt.accordionTitle},s[e.titleAttr]),this.hasAccordionErrors(r)&&c.createElement(vs,{sx:{fontSize:20,color:"error.main"}}))),c.createElement(si,{style:{...e.style,...this.props.oContext.themeType?e.darkStyle:void 0}},this.itemAccordion(t[r],r),c.createElement(xn,{sx:xt.toolbar},r?c.createElement(Pe,{title:x.t("ra_Move up"),slotProps:{popper:{sx:xt.tooltip}}},c.createElement(fe,{size:"small",onClick:()=>this.onMoveUp(r)},c.createElement(fr,null))):c.createElement("div",{style:xt.buttonEmpty}),r<t.length-1?c.createElement(Pe,{title:x.t("ra_Move down"),slotProps:{popper:{sx:xt.tooltip}}},c.createElement(fe,{size:"small",onClick:()=>this.onMoveDown(r)},c.createElement(mr,null))):c.createElement("div",{style:xt.buttonEmpty}),e.noDelete?null:c.createElement(Pe,{title:x.t("ra_Delete current row"),slotProps:{popper:{sx:xt.tooltip}}},c.createElement(fe,{size:"small",onClick:this.onDelete(r)},c.createElement(ts,null))),e.clone?c.createElement(Pe,{title:x.t("ra_Clone current row"),slotProps:{popper:{sx:xt.tooltip}}},c.createElement(fe,{size:"small",onClick:this.onClone(r)},c.createElement(Ws,null))):null)))),!e.noDelete&&t.length>0?c.createElement(xn,{variant:"dense",sx:xt.rootTool},c.createElement(fe,{size:"small",color:"primary",onClick:this.onAdd},c.createElement(Pn,null))):null,e.help?c.createElement(Be,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null):null}}const Qi={root:{width:"100%"},notAlive:{color:"#a30000"}};class xd extends F{aliveId=null;async componentDidMount(){super.componentDidMount();const e=this.getInstance();this.aliveId=`${e}.alive`;const t=await this.props.oContext.socket.getState(this.aliveId);this.setState({alive:!!(t&&t.val),instance:e},async()=>{await this.props.oContext.socket.subscribeState(this.aliveId,this.onAliveChanged)})}componentWillUnmount(){this.props.oContext.socket.unsubscribeState(this.aliveId,this.onAliveChanged)}onAliveChanged=(e,t)=>{e===this.aliveId&&this.state.alive!==!!(t!=null&&t.val)&&this.setState({alive:!!(t!=null&&t.val)})};getInstance(){let e=this.props.schema.instance||`${this.props.oContext.adapterName}.${this.props.oContext.instance}`;return e.includes("${")&&(e=this.getPattern(e,null,!0)),e&&!e.startsWith("system.adapter.")&&(e=`system.adapter.${e}`),e}renderItem(){if(this.getInstance()!==this.state.instance&&setTimeout(()=>{const t=this.getInstance();t?this.props.oContext.socket.getState(`${t}.alive`).then(s=>this.setState({alive:!!(s&&s.val),instance:t})):this.setState({alive:null,instance:t})},200),this.state.alive!==!1&&this.state.alive!==!0)return null;const e=this.state.instance.replace(/^system.adapter./,"");return c.createElement("div",{style:{...Qi.root,...this.state.alive?void 0:Qi.notAlive}},this.state.alive?this.props.schema.textAlive!==void 0?this.props.schema.textAlive?x.t(this.props.schema.textAlive,e):"":x.t("ra_Instance %s is alive",e):this.props.schema.textNotAlive!==void 0?this.props.schema.textNotAlive?x.t(this.props.schema.textNotAlive,e):"":x.t("ra_Instance %s is not alive",e))}}class Sd extends F{componentDidMount(){super.componentDidMount();const e=F.getValue(this.props.data,this.props.attr),t=this.props.schema.options.map(s=>typeof s=="string"?{label:s,value:s}:JSON.parse(JSON.stringify(s)));if(this.props.onFilterLabelUpdate&&this.props.table){const s={};for(const r of t)r.value!==F.DIFFERENT_VALUE&&(s[r.value]=r.label);this.props.onFilterLabelUpdate(this.props.attr,s)}Array.isArray(e)?(t.unshift({label:x.t(F.DIFFERENT_LABEL),value:F.DIFFERENT_VALUE}),this.setState({value:F.DIFFERENT_VALUE,selectOptions:t})):this.setState({value:e,selectOptions:t})}renderItem(e,t){if(!this.state.selectOptions)return null;let s;const r=JSON.parse(JSON.stringify(this.state.selectOptions));return Array.isArray(this.state.value)||this.state.value===F.DIFFERENT_VALUE?([...this.state.value].filter(i=>!r.find(a=>typeof a=="object"?a.value===i:a===i)).forEach(i=>r.push({label:i.toString(),value:i})),s={label:x.t(F.DIFFERENT_LABEL),value:F.DIFFERENT_VALUE},r.unshift(s)):(s=this.state.value!==null&&this.state.value!==void 0&&r.find(i=>typeof i=="object"?i.value==this.state.value:i==this.state.value),this.state.value!==null&&this.state.value!==void 0&&!s&&this.props.schema.freeSolo&&(s={value:this.state.value,label:this.state.value},r.push(s))),c.createElement(Pr,{fullWidth:!0,freeSolo:!!this.props.schema.freeSolo,value:s,options:r,isOptionEqualToValue:(i,a)=>i.value===a.value,filterOptions:(i,a)=>{const l=i.filter(u=>a.inputValue===""?!0:u.label.toLowerCase().includes(a.inputValue.toLowerCase())||u.value.toLowerCase().includes(a.inputValue.toLowerCase()));return this.props.schema.freeSolo&&a.inputValue!==""&&l.push({label:a.inputValue,value:a.inputValue}),l},onInputChange:i=>{if(!i||!this.props.schema.freeSolo)return;const a=i.target.value;a!==this.state.value&&this.setState({value:a},()=>this.onChange(this.props.attr,a))},onChange:(i,a)=>{const l=typeof a=="object"?a?a.value:"":a;l!==this.state.value&&this.setState({value:l},()=>this.onChange(this.props.attr,l))},getOptionLabel:i=>typeof i=="object"?(i==null?void 0:i.label)??"":"",renderInput:i=>c.createElement(xe,{variant:"standard",...i,error:!!e,placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation),disabled:t})})}}class kd extends F{initialized=!1;localContext;askInstance(){const e=F.getValue(this.props.data,this.props.attr),t=this.props.schema.options?this.props.schema.options.map(s=>typeof s=="string"?{label:s,value:s}:JSON.parse(JSON.stringify(s))):[];if(this.props.alive){let s=this.props.schema.data;if(s===void 0&&this.props.schema.jsonData){const r=this.getPattern(this.props.schema.jsonData,null,!0);try{typeof r=="string"&&(s=JSON.parse(r))}catch{console.error(`Cannot parse json data: ${JSON.stringify(s)}`)}}s===void 0&&(s=null),this.setState({loading:!0}),this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",s).then(r=>{r&&Array.isArray(r)&&r.forEach(o=>t.push(typeof o=="string"?{label:o,value:o}:JSON.parse(JSON.stringify(o)))),this.reportFilterLabels(t),Array.isArray(e)?(t.unshift({label:x.t(F.DIFFERENT_LABEL),value:F.DIFFERENT_VALUE}),this.setState({value:F.DIFFERENT_VALUE,selectOptions:t,loading:!1})):this.setState({value:e,selectOptions:t,loading:!1})}).catch(r=>{console.error("Error in autocompleteSendTo:",r),this.setState({loading:!1})})}else Array.isArray(e)?(t.unshift({label:x.t(F.DIFFERENT_LABEL),value:F.DIFFERENT_VALUE}),this.reportFilterLabels(t),this.setState({value:F.DIFFERENT_VALUE,selectOptions:t})):(this.reportFilterLabels(t),this.setState({value:e,selectOptions:t}))}reportFilterLabels(e){if(this.props.onFilterLabelUpdate&&this.props.table){const t={};for(const s of e)s.value!==F.DIFFERENT_VALUE&&(t[s.value]=s.label);this.props.onFilterLabelUpdate(this.props.attr,t)}}getContext(){const e={};return Array.isArray(this.props.schema.alsoDependsOn)&&this.props.schema.alsoDependsOn.forEach(t=>e[t]=F.getValue(this.props.data,t)),JSON.stringify(e)}renderItem(e,t){if(this.props.alive){const i=this.getContext();(i!==this.localContext||!this.initialized)&&(this.localContext=i,setTimeout(()=>this.askInstance(),this.initialized?300:50),this.initialized=!0)}let s;const r=this.state.selectOptions?JSON.parse(JSON.stringify(this.state.selectOptions)):[];return Array.isArray(this.state.value)||this.state.value===F.DIFFERENT_LABEL?([...this.state.value].filter(i=>!r.find(a=>a.value===i)).forEach(i=>r.push({label:i.toString(),value:i})),s={label:x.t(F.DIFFERENT_LABEL),value:F.DIFFERENT_VALUE},r.unshift(s)):(s=this.state.value!==null&&this.state.value!==void 0&&r.find(i=>i.value==this.state.value),this.state.value!==null&&this.state.value!==void 0&&!s&&this.props.schema.freeSolo&&(s={value:this.state.value,label:this.state.value},r.push(s)),s=s||null),r.length?c.createElement(Pr,{value:s,fullWidth:!0,freeSolo:!!this.props.schema.freeSolo,options:r,disabled:t,isOptionEqualToValue:(i,a)=>i.value===a.value,filterOptions:(i,a)=>{const l=i.filter(u=>a.inputValue===""?!0:u.label.toLowerCase().includes(a.inputValue.toLowerCase())||u.value.toLowerCase().includes(a.inputValue.toLowerCase()));return this.props.schema.freeSolo&&a.inputValue!==""&&l.push({label:a.inputValue,value:a.inputValue}),l},getOptionLabel:i=>(i==null?void 0:i.label)??"",onInputChange:i=>{if(!i||!this.props.schema.freeSolo)return;const a=i.target.value;a!==this.state.value&&this.setState({value:a},()=>this.onChange(this.props.attr,a))},onChange:(i,a)=>{const l=typeof a=="object"?a?a.value:"":a;l!==this.state.value&&this.setState({value:l},()=>this.onChange(this.props.attr,l))},renderInput:i=>c.createElement(xe,{variant:"standard",...i,error:!!e,placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation),disabled:t,slotProps:{input:{...i.InputProps,endAdornment:c.createElement(c.Fragment,null,this.state.loading?c.createElement(Gs,{position:"end"},c.createElement(rs,{size:20})):null,t?null:i.InputProps.endAdornment)}}})}):c.createElement(xe,{variant:"standard",fullWidth:!0,value:this.state.value===null||this.state.value===void 0?"":this.state.value,error:!!e,disabled:t,slotProps:{htmlInput:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0},input:{endAdornment:this.state.loading?c.createElement(Gs,{position:"end"},c.createElement(rs,{size:20})):null}},onChange:i=>{const a=i.target.value;this.setState({value:a},()=>this.onChange(this.props.attr,(a||"").trim()))},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}}const Eo={fullWidth:{width:"100%"},flex:{display:"flex"},button:{height:48,marginLeft:4,minWidth:48}};class Td extends F{componentDidMount(){super.componentDidMount();const{data:e,attr:t}=this.props,s=F.getValue(e,t)||"";this.setState({value:s,showDialog:!1})}renderItem(e,t){const{schema:s,attr:r}=this.props,{value:o,showDialog:i}=this.state;return c.createElement(_e,{style:Eo.fullWidth,variant:"standard"},s.label?c.createElement(Ke,{shrink:!0},this.getText(s.label)):null,c.createElement("div",{style:Eo.flex},c.createElement(xe,{variant:"standard",fullWidth:!0,value:o??"",error:!!e,disabled:t,placeholder:this.getText(s.placeholder),label:this.getText(s.label),helperText:this.renderHelp(s.help,s.helpLink,s.noTranslation),onChange:a=>{const l=a.target.value;this.setState({value:l},()=>this.onChange(r,l))}}),c.createElement(Ne,{color:"grey",disabled:t,style:Eo.button,size:"small",variant:"outlined",onClick:()=>this.setState({showDialog:!0})},"...")),i?c.createElement(Ch,{title:x.t("ra_Define schedule"),simple:s.simple,complex:s.complex,cron:o,onClose:()=>this.setState({showDialog:!1}),cancel:x.t("ra_Cancel"),ok:x.t("ra_Ok"),theme:this.props.oContext.theme,onOk:a=>this.setState({showDialog:!1,value:a},()=>this.onChange(r,a))}):null)}}class Ad extends F{async componentDidMount(){super.componentDidMount();const e=F.getValue(this.props.data,this.props.attr),s=(await this.props.oContext.socket.getCertificates()).filter(r=>{const o=this.props.attr.toLowerCase();return o.includes(r.type)||r.type==="public"&&o.includes("cert")||r.type==="private"&&(o.includes("priv")||o.includes("key"))?!0:!!(r.type==="chained"&&(o.includes("chain")||o.includes("ca")))}).map(r=>({label:r.name,value:r.name}));s.unshift({label:x.t(F.NONE_LABEL),value:F.NONE_VALUE}),this.setState({value:e,selectOptions:s})}renderItem(e,t){var r,o;if(!this.state.selectOptions)return null;const s=(r=this.state.selectOptions)==null?void 0:r.find(i=>i.value===this.state.value);return c.createElement(_e,{style:{width:"100%"},variant:"standard"},this.props.schema.label?c.createElement(Ke,{shrink:!0},this.getText(this.props.schema.label)):null,c.createElement(st,{variant:"standard",error:!!e,displayEmpty:!0,disabled:!!t,value:this.state.value,renderValue:()=>this.getText(s==null?void 0:s.label,this.props.schema.noTranslation!==!1),onChange:i=>this.setState({value:i.target.value},()=>this.onChange(this.props.attr,this.state.value))},(o=this.state.selectOptions)==null?void 0:o.map(i=>c.createElement(ze,{key:i.value,value:i.value,style:i.value===F.NONE_VALUE?{opacity:.5}:{}},this.getText(i.label,this.props.schema.noTranslation!==!1)))),this.props.schema.help?c.createElement(Be,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const un={fullWidth:{width:"100%"},leWidth:{width:620,marginBottom:10},certWidth:{width:200,marginRight:10}};class Fd extends F{async componentDidMount(){var a;super.componentDidMount();const e=await this.props.oContext.socket.getCertificates(),t=[],s=[],r=[];let o=[];const i=await this.props.oContext.socket.getObject("system.certificates");(a=i==null?void 0:i.native)!=null&&a.collections?o=Object.keys(i.native.collections):o=null,e.forEach(l=>{l.type==="public"?t.push({label:l.name,value:l.name}):l.type==="private"?s.push({label:l.name,value:l.name}):l.type==="chained"?r.push({label:l.name,value:l.name}):(t.push({label:l.name,value:l.name}),s.push({label:l.name,value:l.name}),r.push({label:l.name,value:l.name}))}),t.unshift({label:x.t(F.NONE_LABEL),value:F.NONE_VALUE}),s.unshift({label:x.t(F.NONE_LABEL),value:F.NONE_VALUE}),r.unshift({label:x.t(F.NONE_LABEL),value:F.NONE_VALUE}),this.setState({certsPublicOptions:t,certsChainOptions:r,certsPrivateOptions:s,collectionsOptions:o})}renderItem(e,t){var d,h,p,g,m,f,y;if(!this.state.certsPublicOptions||!this.state.certsPrivateOptions||!this.state.certsChainOptions)return null;const s=(F.getValue(this.props.data,this.props.schema.leCollectionName||"leCollection")||"false").toString(),r=F.getValue(this.props.data,this.props.schema.certPublicName||"certPublic"),o=F.getValue(this.props.data,this.props.schema.certPrivateName||"certPrivate"),i=F.getValue(this.props.data,this.props.schema.certChainedName||"certChained"),a=(d=this.state.certsPublicOptions)==null?void 0:d.find(b=>b.value===r),l=(h=this.state.certsPrivateOptions)==null?void 0:h.find(b=>b.value===o),u=(p=this.state.certsChainOptions)==null?void 0:p.find(b=>b.value===i);return c.createElement("div",{style:un.fullWidth},this.state.collectionsOptions?c.createElement(_e,{style:un.leWidth,variant:"standard"},c.createElement(Ke,{shrink:!0},"Let's encrypt"),c.createElement(st,{variant:"standard",error:!!e,displayEmpty:!0,disabled:!!t,value:s,onChange:b=>this.onChange(this.props.schema.leCollectionName||"leCollection",b.target.value==="false"?!1:b.target.value==="true"?!0:b.target.value)},c.createElement(ze,{key:"_false",value:"false",style:{fontWeight:"bold"}},x.t("ra_Do not use let's encrypt")),c.createElement(ze,{key:"_true",value:"true",style:{fontWeight:"bold"}},x.t("ra_Use all available let's encrypt certificates")),(g=this.state.collectionsOptions)==null?void 0:g.map(b=>c.createElement(ze,{key:b,value:b},b)))):null,this.state.collectionsOptions?c.createElement("br",null):null,this.state.collectionsOptions&&s!=="false"?c.createElement("div",null,x.t("ra_Fallback custom certificates")):null,c.createElement(_e,{style:un.certWidth,variant:"standard"},c.createElement(Ke,{shrink:!0},x.t("ra_Public certificate")),c.createElement(st,{variant:"standard",error:!!e,displayEmpty:!0,disabled:!!t,value:r||"",renderValue:()=>this.getText(a==null?void 0:a.label,!0),onChange:b=>this.onChange(this.props.schema.certPublicName||"certPublic",b.target.value)},(m=this.state.certsPublicOptions)==null?void 0:m.map((b,C)=>c.createElement(ze,{key:`${b.value}_${C}`,value:b.value,style:b.value===F.NONE_VALUE?{opacity:.5}:{}},this.getText(b.label,!0))))),c.createElement(_e,{style:un.certWidth,variant:"standard"},c.createElement(Ke,{shrink:!0},x.t("ra_Private certificate")),c.createElement(st,{variant:"standard",error:!!e,displayEmpty:!0,disabled:!!t,value:o||"",renderValue:()=>this.getText(l==null?void 0:l.label,!0),onChange:b=>this.onChange(this.props.schema.certPrivateName||"certPrivate",b.target.value)},(f=this.state.certsPrivateOptions)==null?void 0:f.map((b,C)=>c.createElement(ze,{key:`${b.value}_${C}`,value:b.value,style:b.value===F.NONE_VALUE?{opacity:.5}:{}},this.getText(b.label,!0))))),c.createElement(_e,{style:un.certWidth,variant:"standard"},c.createElement(Ke,{shrink:!0},x.t("ra_Chained certificate")),c.createElement(st,{variant:"standard",error:!!e,displayEmpty:!0,disabled:!!t,value:i||"",renderValue:()=>this.getText(u==null?void 0:u.label,!0),onChange:b=>this.onChange(this.props.schema.certChainedName||"certChained",b.target.value)},(y=this.state.certsChainOptions)==null?void 0:y.map((b,C)=>c.createElement(ze,{key:`${b.value}_${C}`,value:b.value,style:b.value===F.NONE_VALUE?{opacity:.5}:{}},this.getText(b.label,!0))))))}}class Id extends F{async componentDidMount(){var s;super.componentDidMount();let e;const t=await this.props.oContext.socket.getObject("system.certificates");(s=t==null?void 0:t.native)!=null&&s.collections?e=Object.keys(t.native.collections):e=[],this.setState({collectionsOptions:e})}renderItem(e,t){var r;if(!this.state.collectionsOptions)return null;const s=(F.getValue(this.props.data,this.props.schema.leCollectionName||"leCollection")||"false").toString();return c.createElement(_e,{style:{width:"100%"},variant:"standard"},this.props.schema.label?c.createElement(Ke,{shrink:!0},this.getText(this.props.schema.label)):null,c.createElement(st,{variant:"standard",error:!!e,displayEmpty:!0,disabled:!!t,value:s,onChange:o=>this.onChange(this.props.schema.leCollectionName||"leCollection",o.target.value==="false"?!1:o.target.value==="true"?!0:o.target.value)},c.createElement(ze,{key:"_false",value:"false",style:{fontWeight:"bold"}},x.t("ra_Do not use let's encrypt")),c.createElement(ze,{key:"_true",value:"true",style:{fontWeight:"bold"}},x.t("ra_Use all available let's encrypt certificates")),(r=this.state.collectionsOptions)==null?void 0:r.map(o=>c.createElement(ze,{key:o,value:o},o))),this.props.schema.help?c.createElement(Be,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class _d extends F{async componentDidMount(){super.componentDidMount();const e=await this.props.oContext.socket.getCurrentInstance();this.setState({requesting:!0},async()=>{const t=await this.props.oContext.socket.sendTo(e,"checkDocker",null);this.setState({requesting:!1,version:(t==null?void 0:t.version)||"",errorDocker:t?t.daemonRunning?"":x.t("ra_Docker is not installed or not running"):x.t("ra_No response from admin")})})}renderItem(e,t){const s=F.getValue(this.props.data,this.props.attr);return this.state.requesting?c.createElement(rs,null):this.state.errorDocker&&!s?c.createElement(Be,{style:{color:"orange"}},x.t("ra_Docker is not available"),": ",x.t(`ra_${this.state.errorDocker}`).replace(/^ra_/,"")):c.createElement(_e,{style:{width:"100%"},variant:"standard"},c.createElement(jn,{onClick:r=>{if(r.preventDefault(),r.stopPropagation(),!t){const o=this.onChange(this.props.attr,!s);o instanceof Promise&&o.catch(i=>console.error(`Cannot set value: ${i}`))}},control:c.createElement(Ts,{checked:!!s,onChange:r=>{this.onChange(this.props.attr,r.target.checked)},disabled:t||!!this.state.errorDocker&&!s}),label:this.getText(this.props.schema.label)}),this.props.schema.hideVersion?null:c.createElement(Be,null,this.state.errorDocker?this.state.errorDocker:this.state.version),this.props.schema.help?c.createElement(Be,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const ht={fullWidth:{width:"100%"},licLabel:{fontWeight:"bold",minWidth:100,marginRight:10,textTransform:"capitalize",display:"inline-block"},errorTitle:n=>({color:n.palette.mode==="dark"?"#e39191":"#b62020"}),okTitle:n=>({color:n.palette.mode==="dark"?"#6fd56f":"#007c00"}),errorText:n=>({color:n.palette.mode==="dark"?"#e39191":"#b62020",mb:"30px"})};class Zt extends F{componentDidMount(){super.componentDidMount(),this.setState({_error:"",running:!1,showLicenseData:null,foundSuitableLicense:!1,licenseOfflineCheck:!1,result:null,allLicenses:null,askForUpdate:!1,showLinkToProfile:!1})}renderErrorDialog(){if(this.state._error&&!this.state.showLicenseData){let e=this.state._error;return this.state.allLicenses&&(e=[c.createElement("div",{key:"error"},e)],e.push(c.createElement(Ne,{key:"button",variant:"contained",onClick:()=>window.open("https://iobroker.net/www/account/licenses","_blank")},x.t("iobroker.net"))),this.state.allLicenses.length?e.push(c.createElement(Qa,{key:"table"},c.createElement(bn,{size:"small"},c.createElement(Xa,null,c.createElement(Nt,null,c.createElement(Ve,null,x.t("ra_Product")),c.createElement(Ve,null,x.t("ra_Version")),c.createElement(Ve,null,"UUID"),c.createElement(Ve,null,x.t("ra_ValidTill")),c.createElement(Ve,null,x.t("ra_Commercial")),c.createElement(Ve,null,"ID"))),c.createElement(Cn,null,this.state.allLicenses.map(t=>c.createElement(Nt,{key:t.id},c.createElement(Ve,{sx:t.validName?null:ht.errorText},t.license.product),c.createElement(Ve,{sx:t.validVersion?null:ht.errorText},t.license.version),c.createElement(Ve,{sx:t.validUuid?null:ht.errorText},t.license.uuid||"--"),c.createElement(Ve,{sx:t.validTill?null:ht.errorText},t.license.validTill&&t.license.validTill!=="0000-00-00 00:00:00"?new Date(t.license.validTill).toLocaleDateString():"--"),c.createElement(Ve,null,t.license.invoice!=="free"?t.license.invoice==="MANUALLY_CREATED"?"✓":t.license.invoice:"-"),c.createElement(Ve,null,t.id))))))):(e.push(c.createElement("div",{key:"text1"},x.t("ra_No one license found in license manager"))),e.push(c.createElement("div",{key:"text2"},x.t("ra_Please create license"))))),c.createElement(os,{open:!0,maxWidth:"xl",fullWidth:this.props.fullWidth!==void 0?this.props.fullWidth:!0,onClick:()=>this.setState({_error:"",allLicenses:null})},c.createElement(Qs,null,x.t("ra_Error")),c.createElement(Cs,null,c.createElement(xu,null,e)),c.createElement(Ds,null,c.createElement(Ne,{variant:"contained",onClick:()=>this.setState({_error:"",allLicenses:null}),color:"primary",autoFocus:!0,startIcon:c.createElement(ii,null)},x.t("ra_Ok"))))}return null}renderMessageDialog(){if(this.state.showLicenseData){const e=[],t=this.state.showLicenseData;return Object.keys(t).forEach(s=>{if(!(t[s]===null||t[s]===void 0))if(typeof t[s]=="object"){const r=t[s];Object.keys(r).forEach(o=>{r[o]!==null&&r[o]!==void 0&&(typeof r[o]=="object"?e.push(c.createElement("div",{key:o},c.createElement("div",{style:ht.licLabel},o,":"),JSON.stringify(r[o],null,2))):e.push(c.createElement("div",{key:o},c.createElement("div",{style:ht.licLabel},s," -",o,":"),r[o].toString())))})}else e.push(c.createElement("div",{key:s},c.createElement("div",{style:ht.licLabel},s.replace(/_/g," "),":"),t[s].toString()))}),e.push(c.createElement("div",{key:"checked"},c.createElement("div",{style:ht.licLabel},x.t("ra_Checked"),":"),this.state.licenseOfflineCheck?x.t("ra_locally"):x.t("ra_via internet"))),c.createElement(os,{open:!0,onClose:()=>this.setState({showLicenseData:null})},c.createElement(Qs,null,c.createElement(Ze,{component:"span",sx:this.state.result?ht.okTitle:ht.errorTitle},x.t("ra_License %s",this.state.result?"OK":"INVALID"))),c.createElement(Cs,null,this.state.showLinkToProfile?c.createElement(Ne,{variant:"contained",onClick:()=>window.open("https://iobroker.net/www/account/licenses","_blank")},"https://iobroker.net"):null,this.state._error?c.createElement(Ze,{component:"div",sx:ht.errorText},this.state._error):null,e),c.createElement(Ds,null,c.createElement(Ne,{onClick:()=>this.setState({showLicenseData:null,_error:""}),color:"primary",variant:"contained"},x.t("ra_Close"))))}return null}static parseJwt(e){const s=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),r=decodeURIComponent(atob(s).split("").map(o=>`%${`00${o.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));try{return JSON.parse(r)}catch{return null}}static isVersionValid(e,t,s,r){if(!t||!e)return!0;let o=!0;const[i]=e.split(".");return t.startsWith(">=")?o=parseInt(i,10)>=parseInt(t.substring(2,10)):t.startsWith("<=")?o=parseInt(i,10)<=parseInt(t.substring(2,10)):t.startsWith(">")?o=parseInt(i,10)>parseInt(t.substring(1,10)):t.startsWith("<")?o=parseInt(i,10)<parseInt(t.substring(1,10)):t.startsWith("=")?o=parseInt(i,10)===parseInt(t.substring(1,10)):t.startsWith("==")?o=parseInt(i,10)===parseInt(t.substring(2,10)):t.startsWith("===")&&(o=parseInt(i,10)===parseInt(t.substring(3,10))),!0}async findInLicenseManager(e){var r,o,i,a;const t=await this.props.oContext.socket.getObject("system.licenses"),s=[];if((o=(r=t==null?void 0:t.native)==null?void 0:r.licenses)!=null&&o.length){let l=null;const u=Date.now();let d;if(this.props.schema.uuid){const p=await this.props.oContext.socket.getObject("system.meta.uuid");d=(i=p==null?void 0:p.native)==null?void 0:i.uuid}let h;if(this.props.schema.version){const p=await this.props.oContext.socket.getObject(`system.adapter.${e}`);h=(a=p==null?void 0:p.common)==null?void 0:a.version}t.native.licenses.forEach(p=>{const g=!p.validTill||p.validTill==="0000-00-00 00:00:00"||new Date(p.validTill).getTime()>u,m=(p.product||"").split("."),f=m[1]===e||e==="vis-2"&&m[1]==="vis",y=!d||!p.uuid||p.uuid===d,b=Zt.isVersionValid(h,p.version,p.invoice,e);(!l||p.invoice!=="free")&&g&&f&&y&&b&&(l=p),s.push({id:p.id,validName:f,validUuid:y,validVersion:b,validTill:g,license:p})}),l&&(s.find(p=>p.id===l.id).used=!0)}return s}async checkLicense(e,t){var a,l,u;let s;if(this.props.schema.uuid){const d=await this.props.oContext.socket.getObject("system.meta.uuid");s=(a=d==null?void 0:d.native)==null?void 0:a.uuid}let r;if(this.props.schema.version){const d=await this.props.oContext.socket.getObject(`system.adapter.${t}`);r=(l=d==null?void 0:d.common)==null?void 0:l.version}const o=new AbortController;let i=setTimeout(()=>{i=null,o.abort()},5e3);try{const d=await window.fetch("https://iobroker.net/api/v1/public/cert/",{method:"POST",body:JSON.stringify({json:e,uuid:s}),headers:{"Content-Type":"text/plain"},signal:o.signal});i&&clearTimeout(i);const h=await d.text();let p;try{p=JSON.parse(h)}catch{}if(p!=null&&p.error)try{const g=Zt.parseJwt(e),m=x.t(`ra_${g.error||p.error||"Unknown error"}`).replace(/^ra_/,"");return this.setState({_error:m,licenseOfflineCheck:!1,showLicenseData:g,result:!1,running:!1})}catch{return console.log("Cannot parse license"),this.setState({_error:p.error,result:!1,running:!1})}else{let g=null;try{g=Zt.parseJwt(e)}catch{}if(p){const m=p.validTill||p.valid_till;if(m&&m!=="0000-00-00 00:00:00"&&new Date(m).getTime()<Date.now())return this.setState({_error:x.t("ra_License expired on %s",new Date(m).toLocaleString()),licenseOfflineCheck:!1,showLicenseData:g,result:!1,running:!1});const f=(p.name||"").split(".");return f[1]===t||f[1]==="vis"&&t==="vis-2"?s&&!p.uuid&&t==="vis-2"?this.setState({_error:x.t("ra_License must be converted",p.uuid),showLinkToProfile:!0,licenseOfflineCheck:!1,showLicenseData:g,result:!1,running:!1}):s&&p.uuid&&p.uuid!==s?this.setState({_error:x.t('ra_Serial number (UUID) "%s" in license is for other device.',p.uuid),licenseOfflineCheck:!1,showLicenseData:g,result:!1,running:!1}):Zt.isVersionValid(r,p.version,p.invoice,t)?this.setState({licenseOfflineCheck:!1,showLicenseData:g,result:!0,running:!1}):this.setState({_error:x.t("ra_License is for version %s, but required version is %s",p.version,this.props.schema.version),licenseOfflineCheck:!1,showLicenseData:g,result:!1,running:!1}):this.setState({_error:x.t('ra_License for other product "%s"',p.name),licenseOfflineCheck:!1,showLicenseData:g,result:!1,running:!1})}throw new Error("ra_Invalid answer from server")}}catch(d){if(((u=d==null?void 0:d.response)==null?void 0:u.status)===404)return this.setState({_error:x.t("ra_License does not exist"),result:!1,running:!1});try{const h=Zt.parseJwt(e),p=(h.name||"").split(".");return h.valid_till&&h.valid_till!=="0000-00-00 00:00:00"&&new Date(h.valid_till).getTime()<Date.now()?this.setState({_error:x.t("ra_License expired on %s",new Date(h.valid_till).toLocaleString()),showLicenseData:h,licenseOfflineCheck:!0,running:!1,result:!1}):p[1]===t?s&&h.uuid&&h.uuid!==s?this.setState({_error:x.t('ra_Serial number (UUID) "%s" in license is for other device.',h.uuid),showLicenseData:h,licenseOfflineCheck:!0,result:!1,running:!1}):Zt.isVersionValid(r,h.version,h.invoice,t)?this.setState({running:!1,result:!0,licenseOfflineCheck:!0,showLicenseData:h}):this.setState({_error:x.t("ra_License is for version %s, but required version is %s",h.version,this.props.schema.version),licenseOfflineCheck:!0,showLicenseData:h,result:!1,running:!1}):this.setState({_error:x.t('ra_License for other product "%s"',h.name),licenseOfflineCheck:!0,showLicenseData:h,result:!1,running:!1})}catch{return this.setState({_error:x.t("ra_Cannot decode license"),result:!1,licenseOfflineCheck:!0,running:!1})}}}renderAskForUpdate(){return this.state.askForUpdate?c.createElement(ws,{text:x.t("ra_License not found in license manager. Do you want to read licenses from iobroker.net?"),ok:x.t("ra_Yes"),onClose:async e=>{if(e){this.setState({askForUpdate:!1});try{await this.props.oContext.socket.updateLicenses(null,null)}catch(t){window.alert(x.t("ra_Cannot read licenses: %s",t));return}await this._onClick(!0)}else this.setState({askForUpdate:!1,running:!1})}}):null}async _onClick(e){const t=this.props.oContext.adapterName==="vis-2"?"vis":this.props.oContext.adapterName;this.setState({running:!0});let s,r;if(this.props.data.useLicenseManager){if(r=await this.findInLicenseManager(t),s=r.find(o=>o.used),s&&(s=s.license.json),!s&&!e){this.setState({askForUpdate:!0});return}}else s=this.props.data.license;s?await this.checkLicense(s,t):this.props.data.useLicenseManager?this.setState({_error:x.t("ra_Suitable license not found in license manager"),result:!1,running:!1,allLicenses:r}):this.setState({_error:x.t("ra_Please enter the license"),result:!1,running:!1})}renderItem(){return c.createElement("div",{style:ht.fullWidth},c.createElement(Ne,{variant:this.props.schema.variant||"outlined",color:this.props.schema.color||"primary",style:ht.fullWidth,disabled:!this.props.data.license&&!this.props.data.useLicenseManager||this.state.running,startIcon:c.createElement(sl,null),onClick:()=>this._onClick()},this.state.running?c.createElement(rs,{size:20,style:{marginRight:8}}):null,this.getText(this.props.schema.label||"ra_Check license",this.props.schema.noTranslation)),this.renderMessageDialog(),this.renderErrorDialog(),this.renderAskForUpdate())}}class Od extends F{renderItem(e,t){const s=F.getValue(this.props.data,this.props.attr),r=Array.isArray(s);return c.createElement(_e,{style:{width:"100%"},variant:"standard"},c.createElement(jn,{onClick:o=>{if(o.preventDefault(),o.stopPropagation(),!t){const i=this.onChange(this.props.attr,!s);i instanceof Promise&&i.catch(a=>console.error(`Cannot set value: ${a}`))}},control:c.createElement(Ts,{indeterminate:r,checked:!!s,onChange:o=>{let i;r?i=this.onChange(this.props.attr,!0):i=this.onChange(this.props.attr,o.target.checked),i instanceof Promise&&i.catch(a=>console.error(`Cannot set value: ${a}`))},disabled:t||this.props.schema.readOnly}),label:this.getText(this.props.schema.label)}),c.createElement(Be,{style:{color:"red"}},e?this.props.schema.validatorErrorText?x.t(this.props.schema.validatorErrorText):x.t("ra_Error"):null),this.props.schema.help?c.createElement(Be,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Pd={standard:Tu,filled:ku,outlined:Su},Nd=n=>{const e=n.palette.mode==="light",t=e?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)";return{root:{},inputRoot:{display:"inline-flex",flexWrap:"wrap",flex:1,marginTop:0,minWidth:70,"&.mui-variant-outlined,&.mui-variant-filled":{boxSizing:"border-box"},"&.mui-variant-outlined":{paddingTop:"14px"},"&.mui-variant-filled":{paddingTop:"28px"}},input:{display:"inline-block",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",appearance:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",float:"left",flex:1},chipContainer:{display:"flex",flexFlow:"row wrap",alignItems:"center",cursor:"text",marginBottom:"-2px",minHeight:40},outlined:{"& input":{height:16,paddingTop:"4px",paddingBottom:"12px",marginTop:"4px",marginBottom:"4px"}},standard:{marginTop:"18px"},filled:{"& input":{height:22,marginBottom:"4px",marginTop:"4px",paddingTop:0},"$marginDense & input":{height:26}},labeled:{},label:{top:4,"&$outlined&:not($labelShrink)":{top:2,"$marginDense &":{top:5}},"&$filled&:not($labelShrink)":{top:15,"$marginDense &":{top:20}}},labelShrink:{top:0},helperText:{marginBottom:-20},focused:{},disabled:{},underline:{"&:after":{borderBottom:`2px solid ${n.palette.primary[e?"dark":"light"]}`,left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:n.transitions.create("transform",{duration:n.transitions.duration.shorter,easing:n.transitions.easing.easeOut}),pointerEvents:"none"},"&$focused:after":{transform:"scaleX(1)"},"&$error:after":{borderBottomColor:n.palette.error.main,transform:"scaleX(1)"},"&:before":{borderBottom:`1px solid ${t}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:n.transitions.create("border-bottom-color",{duration:n.transitions.duration.shorter}),pointerEvents:"none"},"&:hover:not($disabled):not($focused):not($error):before":{borderBottom:`2px solid ${n.palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${t}`}},"&$disabled:before":{borderBottomStyle:"dotted"}},error:{"&:after":{backgroundColor:n.palette.error.main,transform:"scaleX(1)"}},chip:{margin:"0 8px 8px 0",float:"left"},marginDense:{}}},tr={BACKSPACE:8,DELETE:46,LEFT_ARROW:37,RIGHT_ARROW:39},Bd=({value:n,isFocused:e,isDisabled:t,isReadOnly:s,handleClick:r,handleDelete:o,style:i},a)=>c.createElement(ni,{key:a,style:{...i,pointerEvents:t||s?"none":void 0,backgroundColor:e?_h[300]:void 0},onClick:r,onDelete:o,label:n});class Md extends c.Component{labelRef;labelNode=null;input;newChipKeyCodes;newChipKeys;actualInput=null;inputBlurTimeout=null;_keyPressed;_preventChipCreation;styles={};styleTheme=null;constructor(e){super(e),this.state={chips:e.defaultValue||[],focusedChip:null,inputValue:"",isFocused:!1,chipsUpdated:!1,prevPropsValue:[],variant:this.props.variant||"standard"},this.newChipKeyCodes=e.newChipKeyCodes||[13],this.newChipKeys=e.newChipKeys||["Enter"],this.labelRef=c.createRef(),this.input=c.createRef()}componentDidMount(){this.state.variant==="outlined"&&(this.labelNode=Ih.findDOMNode(this.labelRef.current),this.forceUpdate())}componentWillUnmount(){this.inputBlurTimeout&&clearTimeout(this.inputBlurTimeout)}static getDerivedStateFromProps(e,t){let s=null;return e.value&&e.value.length!==t.prevPropsValue.length&&(s={prevPropsValue:e.value},e.clearInputValueOnChange&&(s.inputValue="")),e.clearInputValueOnChange&&e.value&&e.value.length!==t.prevPropsValue.length&&(s={prevPropsValue:e.value,inputValue:""}),e.disabled&&(s={...s,focusedChip:null}),!t.chipsUpdated&&e.defaultValue&&(s={...s,chips:e.defaultValue}),s}focus=()=>{var e;(e=this.actualInput)==null||e.focus(),this.state.focusedChip&&this.setState({focusedChip:null})};handleInputBlur=e=>{this.props.onBlur&&this.props.onBlur(e),this.setState({isFocused:!1}),this.state.focusedChip&&this.setState({focusedChip:null});const t=e.target.value;let s;switch(this.props.blurBehavior||"clear"){case"add-or-clear":s={clearInputOnFail:!0};case"add":if(this.props.delayBeforeAdd){const r=(this.props.value||this.state.chips).length;this.inputBlurTimeout=setTimeout(()=>{const o=(this.props.value||this.state.chips).length;r===o?this.handleAddChip(t,s):this.clearInput()},150)}else this.handleAddChip(t,s);break;case"clear":this.clearInput();break}};handleInputFocus=e=>{var t,s;this.setState({isFocused:!0}),(s=(t=this.props).onFocus)==null||s.call(t,e)};handleKeyDown=e=>{const{focusedChip:t}=this.state;if(this._keyPressed=!1,this._preventChipCreation=!1,this.props.onKeyDown&&(this.props.onKeyDown(e),e.isDefaultPrevented()))return;const s=this.props.value||this.state.chips;if(this.newChipKeyCodes.includes(e.keyCode)||this.newChipKeys.includes(e.key)){this.handleAddChip(e.target.value)!==!1&&e.preventDefault();return}switch(e.keyCode){case tr.BACKSPACE:e.target.value===""&&(t?(this.handleDeleteChip(s[t],t),t&&this.setState({focusedChip:t-1})):this.setState({focusedChip:s.length-1}));break;case tr.DELETE:e.target.value===""&&t&&(this.handleDeleteChip(s[t],t),t<=s.length-1&&this.setState({focusedChip:t}));break;case tr.LEFT_ARROW:t===null&&e.target.value===""&&s.length?this.setState({focusedChip:s.length-1}):t!==null&&t>0&&this.setState({focusedChip:t-1});break;case tr.RIGHT_ARROW:t!==null&&t<s.length-1?this.setState({focusedChip:t+1}):this.setState({focusedChip:null});break;default:this.setState({focusedChip:null});break}};handleKeyUp=e=>{!this._preventChipCreation&&(this.newChipKeyCodes.includes(e.keyCode)||this.newChipKeys.includes(e.key))&&this._keyPressed?this.clearInput():this.updateInput(e.target.value),this.props.onKeyUp&&this.props.onKeyUp(e)};handleUpdateInput=e=>{(this.props.inputValue===null||this.props.inputValue===void 0)&&this.updateInput(e.target.value),this.props.onUpdateInput&&this.props.onUpdateInput(e)};handleAddChip(e,t){if(this.props.onBeforeAdd&&!this.props.onBeforeAdd(e))return this._preventChipCreation=!0,t&&t.clearInputOnFail&&this.clearInput(),!1;this.clearInput();const s=this.props.value||this.state.chips;return e.trim().length?((this.props.allowDuplicates||!s.includes(e))&&(this.props.value&&this.props.onAdd?this.props.onAdd(e):this.updateChips([...this.state.chips,e])),!0):!1}handleDeleteChip(e,t){if(this.props.value)this.props.onDelete&&this.props.onDelete(e,t);else{const s=this.state.chips.slice();if(s.splice(t,1)){let o=this.state.focusedChip;this.state.focusedChip===t?o=null:this.state.focusedChip!==null&&this.state.focusedChip>t&&(o=this.state.focusedChip-1),this.updateChips(s,{focusedChip:o})}}}updateChips(e,t={}){this.setState({chips:e,chipsUpdated:!0,...t}),this.props.onChange&&this.props.onChange(e)}clearInput(){this.updateInput("")}updateInput(e){this.setState({inputValue:e})}setActualInputRef=e=>{this.actualInput=e,this.props.inputRef&&this.props.inputRef(e)};render(){const{alwaysShowPlaceholder:e,chipRenderer:t=Bd,className:s,disabled:r,disableUnderline:o,error:i,FormHelperTextProps:a,fullWidth:l,fullWidthInput:u,helperText:d,id:h,InputProps:p={},InputLabelProps:g={},inputValue:m,label:f,placeholder:y,readOnly:b,required:C,rootRef:D,value:v,margin:E}=this.props,A=this.state.variant;this.styleTheme!==this.props.theme.palette.mode&&(this.styleTheme=this.props.theme.palette.mode,this.styles=je.getStyle(this.props.theme,Nd));let S=v||this.state.chips||[];Array.isArray(S)||(S=(S||"").toString().split(/[,\s]+/).map(U=>U.trim()));const T=m??this.state.inputValue,N=(this.props.value||T).length||T.length,V=typeof g.shrink=="boolean"?g.shrink:f!==null&&(N||this.state.isFocused||S.length),_=S.map((U,R)=>t({value:U,isDisabled:!!r,isReadOnly:!!b,isFocused:this.state.focusedChip===R,handleClick:()=>this.setState({focusedChip:R}),handleDelete:()=>this.handleDeleteChip(U,R),style:this.styles.chip},R.toString())),$={};A==="outlined"&&($.notched=!!V,$.labelWidth=V&&this.labelNode&&this.labelNode.offsetWidth||0),A!=="standard"?$.startAdornment=_:p.disableUnderline=!0;const j=Pd[A];return c.createElement(_e,{ref:D,fullWidth:l,className:s,sx:{...this.styles.root,...E==="dense"?this.styles.marginDense:{}},error:i,required:S.length>0?void 0:C,onClick:this.focus,disabled:r,variant:A,component:"div",margin:E},f&&c.createElement(Ke,{htmlFor:h,sx:{"&.MuiInputLabel-root":this.styles.label,"&.MuiInputLabel-shrink":this.styles.labelShrink},shrink:!!V,focused:this.state.isFocused,variant:A,ref:this.labelRef,required:C,component:"label",...g},f),c.createElement(Ze,{component:"div",id:"input-chip-container",sx:{...this.styles[A],...this.styles.chipContainer,...this.state.isFocused?this.styles.focused:void 0,...!o&&A==="standard"?this.styles.underline:void 0,...r?this.styles.disabled:void 0,...f?this.styles.labeled:void 0,...i?this.styles.error:void 0}},A==="standard"&&_,c.createElement(j,{ref:this.input,className:`mui-variant-${this.styles[A]} ${f?"mui-chip-with-label":"mui-chip-no-label"}`,sx:{"&.MuiInputBase-input":{...this.styles.input,...this.styles[A]},"&.MuiInputBase-root":{...this.styles.inputRoot}},id:h,value:T,onChange:this.handleUpdateInput,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onFocus:this.handleInputFocus,onBlur:this.handleInputBlur,inputRef:this.setActualInputRef,disabled:r,fullWidth:u,placeholder:!N&&(V||f===null||f===void 0)||e?y:void 0,readOnly:b,...p,...$})),d&&c.createElement(Be,{...a,className:a==null?void 0:a.className,style:this.styles.helperText},d))}}class Xi extends F{componentDidMount(){super.componentDidMount();const{data:e,attr:t}=this.props,s=F.getValue(e,t);if(this.props.schema.delimiter&&typeof s=="string"){const r=s.split(this.props.schema.delimiter).map(o=>o.trim()).filter(o=>o);this.setState({value:r})}else this.setState({value:s||[]})}renderItem(e,t){const{attr:s,schema:r}=this.props,{value:o}=this.state;return c.createElement(_e,{fullWidth:!0,variant:"standard"},c.createElement(Md,{value:o,disabled:!!t,label:this.getText(r.label),error:!!e,onAdd:i=>{const a=JSON.parse(JSON.stringify(o));a.push(i),this.setState({value:a},()=>{let l;this.props.schema.delimiter?l=this.onChange(s,a.join(`${this.props.schema.delimiter} `)):l=this.onChange(s,a),l instanceof Promise&&l.catch(u=>console.error(u))})},theme:this.props.oContext.theme,onDelete:(i,a)=>{const l=JSON.parse(JSON.stringify(o));l.splice(a,1),this.setState({value:l},()=>{let u;this.props.schema.delimiter?u=this.onChange(s,l.join(`${this.props.schema.delimiter} `)):u=this.onChange(s,l),u instanceof Promise&&u.catch(d=>console.error(d))})}}),c.createElement(Be,null,x.t("ra_Press ENTER Key to add new item")),this.props.schema.help?c.createElement(Be,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class $d extends F{renderColorDialog(){return!!this.state.showColorDialog&&c.createElement(os,{onClose:()=>this.setState({showColorDialog:!1}),open:this.state.showColorDialog},c.createElement(Ph,{color:this.state.colorDialogValue,onChange:e=>this.setState({colorDialogValue:e.hex},()=>this.onChange(this.props.attr,this.state.colorDialogValue))}))}renderItem(e,t){const s=F.getValue(this.props.data,this.props.attr);let r=je.isUseBright(s,null);return r===null&&(r=void 0),c.createElement(c.Fragment,null,this.renderColorDialog(),c.createElement(xe,{variant:"standard",disabled:!!t,style:{minWidth:100,width:"calc(100% - 8px)"},label:this.getText(this.props.schema.label),value:s||"",onClick:()=>!this.props.schema.readOnly&&this.setState({showColorDialog:!0,colorDialogValue:s||""}),onChange:o=>{const i=o.target.value,a=this.onChange(this.props.attr,i);a instanceof Promise&&a.catch(l=>console.error(`Cannot set value: ${l}`))},slotProps:{htmlInput:{style:{backgroundColor:s,color:r?"#FFF":"#000"},readOnly:this.props.schema.readOnly||!1},input:{endAdornment:!this.props.schema.readOnly&&s&&!this.props.schema.noClearButton?c.createElement(fe,{tabIndex:-1,size:"small",onClick:o=>{o.stopPropagation();const i=this.onChange(this.props.attr,"");i instanceof Promise&&i.catch(a=>console.error(`Cannot set value: ${a}`))}},c.createElement(Mt,null)):void 0},inputLabel:{shrink:!0}}}))}}const xo={width:{width:"calc(100% - 85px)"},width50:{width:120,marginRight:5}};class Ld extends F{componentDidMount(){super.componentDidMount();const e=F.getValue(this.props.data,this.props.attr);this.setState({value:e});const t={};this.props.schema.useSystemName&&(t.useSystem=!!F.getValue(this.props.data,this.props.schema.useSystemName)),this.props.schema.longitudeName&&this.props.schema.latitudeName?(t.longitude=F.getValue(this.props.data,this.props.schema.longitudeName),t.latitude=F.getValue(this.props.data,this.props.schema.latitudeName),!t.longitude&&!t.latitude&&this.props.schema.autoInit&&setTimeout(()=>this.getCoordinates(),300)):!F.getValue(this.props.data,this.props.attr)&&this.props.schema.autoInit&&setTimeout(()=>this.getCoordinates(),300),Object.keys(t).length&&setTimeout(()=>this.setState(t),50)}async getSystemCoordinates(){const e=await this.props.oContext.socket.getCompactSystemConfig();if(e!=null&&e.common&&(e.common.longitude||e.common.latitude))if(window.alert(x.t("ra_Used system settings")),this.props.schema.longitudeName&&this.props.schema.latitudeName)this.setState({longitude:e.common.longitude,latitude:e.common.latitude},async()=>{await this.onChange(this.props.schema.longitudeName,e.common.longitude),await this.onChange(this.props.schema.latitudeName,e.common.latitude)});else{const t=e.common.latitude+(this.props.schema.divider||",")+e.common.longitude;this.setState({value:t},()=>{const s=this.onChange(this.props.attr,t);s instanceof Promise&&s.catch(r=>console.error(`Cannot set value: ${r}`))})}else window.alert(x.t("ra_Cannot determine position: System settings are empty and GPS detection is disabled in browser"))}getCoordinates(){navigator.geolocation?navigator.geolocation.getCurrentPosition(async e=>{if(e!=null&&e.coords)if(this.props.schema.longitudeName&&this.props.schema.latitudeName)this.setState({longitude:e.coords.longitude,latitude:e.coords.latitude},async()=>{await this.onChange(this.props.schema.longitudeName,e.coords.longitude||""),await this.onChange(this.props.schema.latitudeName,e.coords.latitude||"")});else{const t=e.coords.latitude+(this.props.schema.divider||",")+e.coords.longitude;this.setState({value:t},()=>{const s=this.onChange(this.props.attr,t);s instanceof Promise&&s.catch(r=>console.error(`Cannot set value: ${r}`))})}else await this.getSystemCoordinates()},async e=>{console.error(`Cannot determine coordinates from browser: ${e.message}`),await this.getSystemCoordinates()}):this.getSystemCoordinates().catch(e=>{console.error(`Cannot determine coordinates: ${e}`)})}renderItem(e,t){return c.createElement(c.Fragment,null,this.props.schema.useSystemName?c.createElement(jn,{control:c.createElement(Ts,{checked:!!this.state.useSystem,onChange:s=>{const r=s.target.checked;r&&this.getSystemCoordinates().catch(o=>console.error(`Cannot determine coordinates: ${o}`)),this.setState({useSystem:r},()=>this.onChange(this.props.schema.useSystemName,r))}}),label:x.t("ra_Use system settings for position")}):null,this.props.schema.longitudeName&&this.props.schema.latitudeName?c.createElement(xe,{variant:"standard",style:xo.width50,value:this.state.longitude??"",error:!!e,disabled:this.state.useSystem||!!t,onChange:s=>{const r=s.target.value;this.setState({longitude:r},()=>{const o=this.onChange(this.props.schema.longitudeName,(r||"").trim());o instanceof Promise&&o.catch(i=>console.error(`Cannot set value: ${i}`))})},label:x.t("ra_Longitude")}):null,this.props.schema.longitudeName&&this.props.schema.latitudeName?c.createElement(xe,{variant:"standard",style:xo.width50,value:this.state.latitude??"",error:!!e,disabled:this.state.useSystem||!!t,onChange:s=>{const r=s.target.value;this.setState({latitude:r},()=>this.onChange(this.props.schema.latitudeName,(r||"").trim()))},label:x.t("ra_Latitude")}):null,!this.props.schema.longitudeName||!this.props.schema.latitudeName?c.createElement(xe,{variant:"standard",style:xo.width,value:this.state.value===null||this.state.value===void 0?"":this.state.value,error:!!e,disabled:!!t,slotProps:{htmlInput:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0,readOnly:this.state.useSystem}},onChange:s=>{const r=s.target.value;this.setState({value:r},()=>this.onChange(this.props.attr,(r||"").trim()))},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)}):null,this.state.useSystem?null:c.createElement(vr,{size:"small",onClick:()=>this.getCoordinates(),title:x.t("ra_Take browser position"),style:{marginRight:4}},c.createElement(Yu,null)),this.state.useSystem?null:c.createElement(vr,{size:"small",onClick:()=>this.getSystemCoordinates(),title:x.t("ra_Take position from system settings")},c.createElement(Gu,null)))}}$o.init({name:"iobroker_admin",shared:{"@iobroker/adapter-react-v5":{lib:()=>Dh,version:"*"},"@mui/icons-material":{lib:()=>Qu,version:"*"},"@iobroker/json-config":{lib:()=>Xh,version:"*"}},remotes:[]});class Nn extends F{static runningLoads={};constructor(e){super(e),Object.assign(this.state,{Component:null,error:""})}async componentDidMount(){if(!this.props.schema.url){console.error("URL is empty. Cannot load custom component!"),this.setState({error:"URL is empty. Cannot load custom component!"});return}let e;this.props.schema.url.startsWith("http:")||this.props.schema.url.startsWith("https:")?e=this.props.schema.url:this.props.schema.url.startsWith("./")?e=`${window.location.protocol}//${window.location.host}${this.props.schema.url.replace(/^\./,"")}`:e=`${window.location.protocol}//${window.location.host}/adapter/${this.props.oContext.adapterName}/${this.props.schema.url}`;const[t,s,...r]=this.props.schema.name.split("/"),o=r.join("/");if(!e){console.error('Cannot find URL for custom component! Please define "url" as "custom/customComponents.js" in the schema');return}if(!t||!s||!o){console.error('Invalid format of "name"! Please define "name" as "ConfigCustomBackItUpSet/Components/AdapterExist" in the schema');return}let i=Nn.runningLoads[`${e}!${s}`];if(!(i instanceof Promise)){let a;if(this.props.schema.i18n===!0){const l=e.lastIndexOf("/");let u;l!==-1?u=e.substring(0,l):u=e;const d=x.getLanguage(),h=`${u}/i18n/${d}.json`;a=fetch(h).then(p=>p.json()).then(p=>x.extendTranslations(p,d)).catch(p=>{if(d!=="en"){fetch(`${u}/i18n/en.json`).then(g=>g.json()).then(g=>x.extendTranslations(g,d)).catch(g=>console.log(`Cannot load i18n "${h}": ${g}`));return}console.log(`Cannot load i18n "${h}": ${p}`)})}else if(this.props.schema.i18n&&typeof this.props.schema.i18n=="object")try{x.extendTranslations(this.props.schema.i18n)}catch(l){console.error(`Cannot import i18n: ${l}`)}try{console.log(e,t,s,o),$o.registerRemotes([{name:t,entry:e,type:this.props.schema.bundlerType||void 0}]),i=$o.loadRemote(`${t}/${s}`),a instanceof Promise&&(i=Promise.all([i,a]).then(l=>l[0])),Nn.runningLoads[`${e}!${s}`]=i}catch(l){console.error(l),this.setState({error:`Cannot import from ${this.props.schema.url}: ${l}`})}}try{const a=(await i).default;if(a!=null&&a[o])this.setState({Component:a[o]});else{const l=Object.keys(a||{});console.error("URL is empty. Cannot load custom component!"),this.setState({error:`Component ${this.props.schema.name} not found in ${this.props.schema.url}. Found: ${l.join(", ")}`})}}catch(a){console.error(a),this.setState({error:`Cannot import from ${this.props.schema.url}: ${a}`})}}render(){const e=this.state.Component,t=this.props.schema||{},s=e?c.createElement(e,{...this.props,socket:this.props.oContext.socket,theme:this.props.oContext.theme,themeType:this.props.oContext.themeType,instance:this.props.oContext.instance,adapterName:this.props.oContext.adapterName,systemConfig:this.props.oContext.systemConfig,forceUpdate:this.props.oContext.forceUpdate}):this.state.error?c.createElement("div",null,this.state.error):c.createElement(Nr,null);return t.newLine?c.createElement(c.Fragment,null,c.createElement("div",{style:{flexBasis:"100%",height:0}}),s):s}}const Vd=["localeText"],jo=Qo(null),Rd=function(e){const{localeText:t}=e,s=pe(e,Vd),{utils:r,localeText:o}=Xo(jo)??{utils:void 0,localeText:void 0},i=ve({props:s,name:"MuiLocalizationProvider"}),{children:a,dateAdapter:l,dateFormats:u,dateLibInstance:d,adapterLocale:h,localeText:p}=i,g=he(()=>k({},p,o,t),[p,o,t]),m=he(()=>{if(!l)return r||null;const b=new l({locale:h,formats:u,instance:d});if(!b.isMUIAdapter)throw new Error(["MUI X: The date adapter should be imported from `@mui/x-date-pickers` or `@mui/x-date-pickers-pro`, not from `@date-io`","For example, `import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'` instead of `import AdapterDayjs from '@date-io/dayjs'`","More information on the installation documentation: https://mui.com/x/react-date-pickers/getting-started/#installation"].join(`
`));return b},[l,h,u,d,r]),f=he(()=>m?{minDate:m.date("1900-01-01T00:00:00.000"),maxDate:m.date("2099-12-31T00:00:00.000")}:null,[m]),y=he(()=>({utils:m,defaultDates:f,localeText:g}),[f,m,g]);return I.jsx(jo.Provider,{value:y,children:a})},jd=n=>({components:{MuiLocalizationProvider:{defaultProps:{localeText:k({},n)}}}}),Vr=n=>{const{utils:e,formatKey:t,contextTranslation:s,propsTranslation:r}=n;return o=>{const i=o!==null&&e.isValid(o)?e.format(o,t):null;return(r??s)(o,e,i)}},Sl={previousMonth:"Previous month",nextMonth:"Next month",openPreviousView:"Open previous view",openNextView:"Open next view",calendarViewSwitchingButtonAriaLabel:n=>n==="year"?"year view is open, switch to calendar view":"calendar view is open, switch to year view",start:"Start",end:"End",startDate:"Start date",startTime:"Start time",endDate:"End date",endTime:"End time",cancelButtonLabel:"Cancel",clearButtonLabel:"Clear",okButtonLabel:"OK",todayButtonLabel:"Today",datePickerToolbarTitle:"Select date",dateTimePickerToolbarTitle:"Select date & time",timePickerToolbarTitle:"Select time",dateRangePickerToolbarTitle:"Select date range",clockLabelText:(n,e,t,s)=>`Select ${n}. ${!s&&(e===null||!t.isValid(e))?"No time selected":`Selected time is ${s??t.format(e,"fullTime")}`}`,hoursClockNumberText:n=>`${n} hours`,minutesClockNumberText:n=>`${n} minutes`,secondsClockNumberText:n=>`${n} seconds`,selectViewText:n=>`Select ${n}`,calendarWeekNumberHeaderLabel:"Week number",calendarWeekNumberHeaderText:"#",calendarWeekNumberAriaLabelText:n=>`Week ${n}`,calendarWeekNumberText:n=>`${n}`,openDatePickerDialogue:(n,e,t)=>t||n!==null&&e.isValid(n)?`Choose date, selected date is ${t??e.format(n,"fullDate")}`:"Choose date",openTimePickerDialogue:(n,e,t)=>t||n!==null&&e.isValid(n)?`Choose time, selected time is ${t??e.format(n,"fullTime")}`:"Choose time",fieldClearLabel:"Clear",timeTableLabel:"pick time",dateTableLabel:"pick date",fieldYearPlaceholder:n=>"Y".repeat(n.digitAmount),fieldMonthPlaceholder:n=>n.contentType==="letter"?"MMMM":"MM",fieldDayPlaceholder:()=>"DD",fieldWeekDayPlaceholder:n=>n.contentType==="letter"?"EEEE":"EE",fieldHoursPlaceholder:()=>"hh",fieldMinutesPlaceholder:()=>"mm",fieldSecondsPlaceholder:()=>"ss",fieldMeridiemPlaceholder:()=>"aa",year:"Year",month:"Month",day:"Day",weekDay:"Week day",hours:"Hours",minutes:"Minutes",seconds:"Seconds",meridiem:"Meridiem",empty:"Empty"},Ud=Sl;jd(Sl);const As=()=>{const n=Xo(jo);if(n===null)throw new Error(["MUI X: Can not find the date and time pickers localization context.","It looks like you forgot to wrap your component in LocalizationProvider.","This can also happen if you are bundling multiple versions of the `@mui/x-date-pickers` package"].join(`
`));if(n.utils===null)throw new Error(["MUI X: Can not find the date and time pickers adapter from its localization context.","It looks like you forgot to pass a `dateAdapter` to your LocalizationProvider."].join(`
`));const e=he(()=>k({},Ud,n.localeText),[n.localeText]);return he(()=>k({},n,{localeText:e}),[n,e])},Ee=()=>As().utils,Un=()=>As().defaultDates,Fs=n=>{const e=Ee(),t=De(void 0);return t.current===void 0&&(t.current=e.date(void 0,n)),t.current},nt=()=>As().localeText,Wd=Qo(),It=()=>Xo(Wd)??!1,zd=as(I.jsx("path",{d:"M7 10l5 5 5-5z"}),"ArrowDropDown"),Hd=as(I.jsx("path",{d:"M15.41 16.59L10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z"}),"ArrowLeft"),Jd=as(I.jsx("path",{d:"M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"}),"ArrowRight"),Kd=as(I.jsx("path",{d:"M17 12h-5v5h5v-5zM16 1v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-1V1h-2zm3 18H5V8h14v11z"}),"Calendar"),qd=as(I.jsxs(Jt,{children:[I.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),I.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"})]}),"Clock");as(I.jsx("path",{d:"M9 11H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm2-7h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V9h14v11z"}),"DateRange");as(I.jsxs(Jt,{children:[I.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),I.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"})]}),"Time");const Yd=as(I.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Clear");function Gd(n){return Ae("MuiPickersArrowSwitcher",n)}Fe("MuiPickersArrowSwitcher",["root","spacer","button","previousIconButton","nextIconButton","leftArrowIcon","rightArrowIcon"]);const Qd=["children","className","slots","slotProps","isNextDisabled","isNextHidden","onGoToNext","nextLabel","isPreviousDisabled","isPreviousHidden","onGoToPrevious","previousLabel","labelId"],Xd=["ownerState"],Zd=["ownerState"],ep=X("div",{name:"MuiPickersArrowSwitcher",slot:"Root",overridesResolver:(n,e)=>e.root})({display:"flex"}),tp=X("div",{name:"MuiPickersArrowSwitcher",slot:"Spacer",overridesResolver:(n,e)=>e.spacer})(({theme:n})=>({width:n.spacing(3)})),Zi=X(sn,{name:"MuiPickersArrowSwitcher",slot:"Button",overridesResolver:(n,e)=>e.button})({variants:[{props:{hidden:!0},style:{visibility:"hidden"}}]}),sp=n=>{const{classes:e}=n;return Se({root:["root"],spacer:["spacer"],button:["button"],previousIconButton:["previousIconButton"],nextIconButton:["nextIconButton"],leftArrowIcon:["leftArrowIcon"],rightArrowIcon:["rightArrowIcon"]},Gd,e)},kl=Te(function(e,t){const s=It(),r=ve({props:e,name:"MuiPickersArrowSwitcher"}),{children:o,className:i,slots:a,slotProps:l,isNextDisabled:u,isNextHidden:d,onGoToNext:h,nextLabel:p,isPreviousDisabled:g,isPreviousHidden:m,onGoToPrevious:f,previousLabel:y,labelId:b}=r,C=pe(r,Qd),D=r,v=sp(D),E={isDisabled:u,isHidden:d,goTo:h,label:p},A={isDisabled:g,isHidden:m,goTo:f,label:y},S=(a==null?void 0:a.previousIconButton)??Zi,T=ke({elementType:S,externalSlotProps:l==null?void 0:l.previousIconButton,additionalProps:{size:"medium",title:A.label,"aria-label":A.label,disabled:A.isDisabled,edge:"end",onClick:A.goTo},ownerState:k({},D,{hidden:A.isHidden}),className:Ie(v.button,v.previousIconButton)}),N=(a==null?void 0:a.nextIconButton)??Zi,V=ke({elementType:N,externalSlotProps:l==null?void 0:l.nextIconButton,additionalProps:{size:"medium",title:E.label,"aria-label":E.label,disabled:E.isDisabled,edge:"start",onClick:E.goTo},ownerState:k({},D,{hidden:E.isHidden}),className:Ie(v.button,v.nextIconButton)}),_=(a==null?void 0:a.leftArrowIcon)??Hd,$=ke({elementType:_,externalSlotProps:l==null?void 0:l.leftArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:D,className:v.leftArrowIcon}),j=pe($,Xd),U=(a==null?void 0:a.rightArrowIcon)??Jd,R=ke({elementType:U,externalSlotProps:l==null?void 0:l.rightArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:D,className:v.rightArrowIcon}),K=pe(R,Zd);return I.jsxs(ep,k({ref:t,className:Ie(v.root,i),ownerState:D},C,{children:[I.jsx(S,k({},T,{children:s?I.jsx(U,k({},K)):I.jsx(_,k({},j))})),o?I.jsx(ls,{variant:"subtitle1",component:"span",id:b,children:o}):I.jsx(tp,{className:v.spacer,ownerState:D}),I.jsx(N,k({},V,{children:s?I.jsx(_,k({},j)):I.jsx(U,k({},K))}))]}))}),Bt=(n,e)=>n.length!==e.length?!1:e.every(t=>n.includes(t)),Tl=({openTo:n,defaultOpenTo:e,views:t,defaultViews:s})=>{const r=t??s;let o;if(n!=null)o=n;else if(r.includes(e))o=e;else if(r.length>0)o=r[0];else throw new Error("MUI X: The `views` prop must contain at least one view.");return{views:r,openTo:o}},Al=["hours","minutes","seconds"],Bn=n=>Al.includes(n),np=n=>Al.includes(n)||n==="meridiem",rp=(n,e)=>n?e.getHours(n)>=12?"pm":"am":null,Mn=(n,e,t)=>t&&(n>=12?"pm":"am")!==e?e==="am"?n-12:n+12:n,op=(n,e,t,s)=>{const r=Mn(s.getHours(n),e,t);return s.setHours(n,r)},ea=(n,e)=>e.getHours(n)*3600+e.getMinutes(n)*60+e.getSeconds(n),Wn=(n,e)=>(t,s)=>n?e.isAfter(t,s):ea(t,e)>ea(s,e),Fl=(n,{format:e,views:t,ampm:s})=>{if(e!=null)return e;const r=n.formats;return Bt(t,["hours"])?s?`${r.hours12h} ${r.meridiem}`:r.hours24h:Bt(t,["minutes"])?r.minutes:Bt(t,["seconds"])?r.seconds:Bt(t,["minutes","seconds"])?`${r.minutes}:${r.seconds}`:Bt(t,["hours","minutes","seconds"])?s?`${r.hours12h}:${r.minutes}:${r.seconds} ${r.meridiem}`:`${r.hours24h}:${r.minutes}:${r.seconds}`:s?`${r.hours12h}:${r.minutes} ${r.meridiem}`:`${r.hours24h}:${r.minutes}`};function zn({onChange:n,onViewChange:e,openTo:t,view:s,views:r,autoFocus:o,focusedView:i,onFocusedViewChange:a}){const l=De(t),u=De(r),d=De(r.includes(t)?t:r[0]),[h,p]=xs({name:"useViews",state:"view",controlled:s,default:d.current}),g=De(o?h:null),[m,f]=xs({name:"useViews",state:"focusedView",controlled:i,default:g.current});Oe(()=>{(l.current&&l.current!==t||u.current&&u.current.some(S=>!r.includes(S)))&&(p(r.includes(t)?t:r[0]),u.current=r,l.current=t)},[t,p,h,r]);const y=r.indexOf(h),b=r[y-1]??null,C=r[y+1]??null,D=ce((S,T)=>{f(T?S:N=>S===N?null:N),a==null||a(S,T)}),v=ce(S=>{D(S,!0),S!==h&&(p(S),e&&e(S))}),E=ce(()=>{C&&v(C)}),A=ce((S,T,N)=>{const V=T==="finish",_=N?r.indexOf(N)<r.length-1:!!C;if(n(S,V&&_?"partial":T,N),N&&N!==h){const j=r[r.indexOf(N)+1];j&&v(j)}else V&&E()});return{view:h,setView:v,focusedView:m,setFocusedView:D,nextView:C,previousView:b,defaultView:r.includes(t)?t:r[0],goToNextView:E,setValueAndGoToNextView:A}}function ip(n,{disableFuture:e,maxDate:t,timezone:s}){const r=Ee();return he(()=>{const o=r.date(void 0,s),i=r.startOfMonth(e&&r.isBefore(o,t)?o:t);return!r.isAfter(i,n)},[e,t,n,r,s])}function ap(n,{disablePast:e,minDate:t,timezone:s}){const r=Ee();return he(()=>{const o=r.date(void 0,s),i=r.startOfMonth(e&&r.isAfter(o,t)?o:t);return!r.isBefore(i,n)},[e,t,n,r,s])}function fi(n,e,t,s){const r=Ee(),o=rp(n,r),i=pt(a=>{const l=n==null?null:op(n,a,!!e,r);t(l,s??"partial")},[e,n,t,s,r]);return{meridiemMode:o,handleMeridiemChange:i}}const $n=36,Rr=2,jr=320,lp=280,mi=336,Il=232,cp=48,Ur=X("div")({overflow:"hidden",width:jr,maxHeight:mi,display:"flex",flexDirection:"column",margin:"0 auto"});function up(n){return Ae("MuiTimeClock",n)}Fe("MuiTimeClock",["root","arrowSwitcher"]);const Xs=220,zt=36,Ln={x:Xs/2,y:Xs/2},_l={x:Ln.x,y:0},hp=_l.x-Ln.x,dp=_l.y-Ln.y,pp=n=>n*(180/Math.PI),Ol=(n,e,t)=>{const s=e-Ln.x,r=t-Ln.y,o=Math.atan2(hp,dp)-Math.atan2(s,r);let i=pp(o);i=Math.round(i/n)*n,i%=360;const a=Math.floor(i/n)||0,l=s**2+r**2,u=Math.sqrt(l);return{value:a,distance:u}},fp=(n,e,t=1)=>{const s=t*6;let{value:r}=Ol(s,n,e);return r=r*t%60,r},mp=(n,e,t)=>{const{value:s,distance:r}=Ol(30,n,e);let o=s||12;return t?o%=12:r<Xs/2-zt&&(o+=12,o%=24),o};function gp(n){return Ae("MuiClockPointer",n)}Fe("MuiClockPointer",["root","thumb"]);const yp=["className","hasSelected","isInner","type","viewValue"],bp=n=>{const{classes:e}=n;return Se({root:["root"],thumb:["thumb"]},gp,e)},Cp=X("div",{name:"MuiClockPointer",slot:"Root",overridesResolver:(n,e)=>e.root})(({theme:n})=>({width:2,backgroundColor:(n.vars||n).palette.primary.main,position:"absolute",left:"calc(50% - 1px)",bottom:"50%",transformOrigin:"center bottom 0px",variants:[{props:{shouldAnimate:!0},style:{transition:n.transitions.create(["transform","height"])}}]})),Dp=X("div",{name:"MuiClockPointer",slot:"Thumb",overridesResolver:(n,e)=>e.thumb})(({theme:n})=>({width:4,height:4,backgroundColor:(n.vars||n).palette.primary.contrastText,borderRadius:"50%",position:"absolute",top:-21,left:`calc(50% - ${zt/2}px)`,border:`${(zt-4)/2}px solid ${(n.vars||n).palette.primary.main}`,boxSizing:"content-box",variants:[{props:{hasSelected:!0},style:{backgroundColor:(n.vars||n).palette.primary.main}}]}));function vp(n){const e=ve({props:n,name:"MuiClockPointer"}),{className:t,isInner:s,type:r,viewValue:o}=e,i=pe(e,yp),a=De(r);Oe(()=>{a.current=r},[r]);const l=k({},e,{shouldAnimate:a.current!==r}),u=bp(l),d=()=>{let p=360/(r==="hours"?12:60)*o;return r==="hours"&&o>12&&(p-=360),{height:Math.round((s?.26:.4)*Xs),transform:`rotateZ(${p}deg)`}};return I.jsx(Cp,k({style:d(),className:Ie(u.root,t),ownerState:l},i,{children:I.jsx(Dp,{ownerState:l,className:u.thumb})}))}function wp(n){return Ae("MuiClock",n)}Fe("MuiClock",["root","clock","wrapper","squareMask","pin","amButton","pmButton","meridiemText","selected"]);const Tr=(n,e,t)=>{let s=e;return s=n.setHours(s,n.getHours(t)),s=n.setMinutes(s,n.getMinutes(t)),s=n.setSeconds(s,n.getSeconds(t)),s=n.setMilliseconds(s,n.getMilliseconds(t)),s},kn=({date:n,disableFuture:e,disablePast:t,maxDate:s,minDate:r,isDateDisabled:o,utils:i,timezone:a})=>{const l=Tr(i,i.date(void 0,a),n);t&&i.isBefore(r,l)&&(r=l),e&&i.isAfter(s,l)&&(s=l);let u=n,d=n;for(i.isBefore(n,r)&&(u=r,d=null),i.isAfter(n,s)&&(d&&(d=s),u=null);u||d;){if(u&&i.isAfter(u,s)&&(u=null),d&&i.isBefore(d,r)&&(d=null),u){if(!o(u))return u;u=i.addDays(u,1)}if(d){if(!o(d))return d;d=i.addDays(d,-1)}}return null},Ep=(n,e)=>e==null||!n.isValid(e)?null:e,vt=(n,e,t)=>e==null||!n.isValid(e)?t:e,xp=(n,e,t)=>!n.isValid(e)&&e!=null&&!n.isValid(t)&&t!=null?!0:n.isEqual(e,t),gi=(n,e)=>{const s=[n.startOfYear(e)];for(;s.length<12;){const r=s[s.length-1];s.push(n.addMonths(r,1))}return s},yi=(n,e,t)=>t==="date"?n.startOfDay(n.date(void 0,e)):n.date(void 0,e),ss=(n,e)=>{const t=n.setHours(n.date(),e==="am"?2:14);return n.format(t,"meridiem")},Sp=["year","month","day"],ta=n=>Sp.includes(n),bi=(n,{format:e,views:t},s)=>{if(e!=null)return e;const r=n.formats;return Bt(t,["year"])?r.year:Bt(t,["month"])?r.month:Bt(t,["day"])?r.dayOfMonth:Bt(t,["month","year"])?`${r.month} ${r.year}`:Bt(t,["day","month"])?`${r.month} ${r.dayOfMonth}`:s?/en/.test(n.getCurrentLocaleCode())?r.normalDateWithWeekday:r.normalDate:r.keyboardDate},kp=(n,e)=>{const t=n.startOfWeek(e);return[0,1,2,3,4,5,6].map(s=>n.addDays(t,s))},Tp=n=>{const{classes:e,meridiemMode:t}=n;return Se({root:["root"],clock:["clock"],wrapper:["wrapper"],squareMask:["squareMask"],pin:["pin"],amButton:["amButton",t==="am"&&"selected"],pmButton:["pmButton",t==="pm"&&"selected"],meridiemText:["meridiemText"]},wp,e)},Ap=X("div",{name:"MuiClock",slot:"Root",overridesResolver:(n,e)=>e.root})(({theme:n})=>({display:"flex",justifyContent:"center",alignItems:"center",margin:n.spacing(2)})),Fp=X("div",{name:"MuiClock",slot:"Clock",overridesResolver:(n,e)=>e.clock})({backgroundColor:"rgba(0,0,0,.07)",borderRadius:"50%",height:220,width:220,flexShrink:0,position:"relative",pointerEvents:"none"}),Ip=X("div",{name:"MuiClock",slot:"Wrapper",overridesResolver:(n,e)=>e.wrapper})({"&:focus":{outline:"none"}}),_p=X("div",{name:"MuiClock",slot:"SquareMask",overridesResolver:(n,e)=>e.squareMask})({width:"100%",height:"100%",position:"absolute",pointerEvents:"auto",outline:0,touchAction:"none",userSelect:"none",variants:[{props:{disabled:!1},style:{"@media (pointer: fine)":{cursor:"pointer",borderRadius:"50%"},"&:active":{cursor:"move"}}}]}),Op=X("div",{name:"MuiClock",slot:"Pin",overridesResolver:(n,e)=>e.pin})(({theme:n})=>({width:6,height:6,borderRadius:"50%",backgroundColor:(n.vars||n).palette.primary.main,position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"})),Pl=(n,e)=>({zIndex:1,bottom:8,paddingLeft:4,paddingRight:4,width:zt,variants:[{props:{meridiemMode:e},style:{backgroundColor:(n.vars||n).palette.primary.main,color:(n.vars||n).palette.primary.contrastText,"&:hover":{backgroundColor:(n.vars||n).palette.primary.light}}}]}),Pp=X(sn,{name:"MuiClock",slot:"AmButton",overridesResolver:(n,e)=>e.amButton})(({theme:n})=>k({},Pl(n,"am"),{position:"absolute",left:8})),Np=X(sn,{name:"MuiClock",slot:"PmButton",overridesResolver:(n,e)=>e.pmButton})(({theme:n})=>k({},Pl(n,"pm"),{position:"absolute",right:8})),sa=X(ls,{name:"MuiClock",slot:"meridiemText",overridesResolver:(n,e)=>e.meridiemText})({overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"});function Bp(n){const e=ve({props:n,name:"MuiClock"}),{ampm:t,ampmInClock:s,autoFocus:r,children:o,value:i,handleMeridiemChange:a,isTimeDisabled:l,meridiemMode:u,minutesStep:d=1,onChange:h,selectedId:p,type:g,viewValue:m,viewRange:[f,y],disabled:b=!1,readOnly:C,className:D}=e,v=e,E=Ee(),A=nt(),S=De(!1),T=Tp(v),N=l(m,g),V=!t&&g==="hours"&&(m<1||m>12),_=(O,B)=>{b||C||l(O,g)||h(O,B)},$=(O,B)=>{let{offsetX:Y,offsetY:ne}=O;if(Y===void 0){const z=O.target.getBoundingClientRect();Y=O.changedTouches[0].clientX-z.left,ne=O.changedTouches[0].clientY-z.top}const ee=g==="seconds"||g==="minutes"?fp(Y,ne,d):mp(Y,ne,!!t);_(ee,B)},j=O=>{S.current=!0,$(O,"shallow")},U=O=>{S.current&&($(O,"finish"),S.current=!1),O.preventDefault()},R=O=>{O.buttons>0&&$(O.nativeEvent,"shallow")},K=O=>{S.current&&(S.current=!1),$(O.nativeEvent,"finish")},ae=he(()=>g==="hours"?!0:m%5===0,[g,m]),se=g==="minutes"?d:1,de=De(null);Kt(()=>{r&&de.current.focus()},[r]);const ie=O=>Math.max(f,Math.min(y,O)),P=O=>(O+(y+1))%(y+1),M=O=>{if(!S.current)switch(O.key){case"Home":_(f,"partial"),O.preventDefault();break;case"End":_(y,"partial"),O.preventDefault();break;case"ArrowUp":_(P(m+se),"partial"),O.preventDefault();break;case"ArrowDown":_(P(m-se),"partial"),O.preventDefault();break;case"PageUp":_(ie(m+5),"partial"),O.preventDefault();break;case"PageDown":_(ie(m-5),"partial"),O.preventDefault();break;case"Enter":case" ":_(m,"finish"),O.preventDefault();break}};return I.jsxs(Ap,{className:Ie(T.root,D),children:[I.jsxs(Fp,{className:T.clock,children:[I.jsx(_p,{onTouchMove:j,onTouchStart:j,onTouchEnd:U,onMouseUp:K,onMouseMove:R,ownerState:{disabled:b},className:T.squareMask}),!N&&I.jsxs(Jt,{children:[I.jsx(Op,{className:T.pin}),i!=null&&I.jsx(vp,{type:g,viewValue:m,isInner:V,hasSelected:ae})]}),I.jsx(Ip,{"aria-activedescendant":p,"aria-label":A.clockLabelText(g,i,E,i==null?null:E.format(i,"fullTime")),ref:de,role:"listbox",onKeyDown:M,tabIndex:0,className:T.wrapper,children:o})]}),t&&s&&I.jsxs(Jt,{children:[I.jsx(Pp,{onClick:C?void 0:()=>a("am"),disabled:b||u===null,ownerState:v,className:T.amButton,title:ss(E,"am"),children:I.jsx(sa,{variant:"caption",className:T.meridiemText,children:ss(E,"am")})}),I.jsx(Np,{disabled:b||u===null,onClick:C?void 0:()=>a("pm"),ownerState:v,className:T.pmButton,title:ss(E,"pm"),children:I.jsx(sa,{variant:"caption",className:T.meridiemText,children:ss(E,"pm")})})]})]})}function Mp(n){return Ae("MuiClockNumber",n)}const sr=Fe("MuiClockNumber",["root","selected","disabled"]),$p=["className","disabled","index","inner","label","selected"],Lp=n=>{const{classes:e,selected:t,disabled:s}=n;return Se({root:["root",t&&"selected",s&&"disabled"]},Mp,e)},Vp=X("span",{name:"MuiClockNumber",slot:"Root",overridesResolver:(n,e)=>[e.root,{[`&.${sr.disabled}`]:e.disabled},{[`&.${sr.selected}`]:e.selected}]})(({theme:n})=>({height:zt,width:zt,position:"absolute",left:`calc((100% - ${zt}px) / 2)`,display:"inline-flex",justifyContent:"center",alignItems:"center",borderRadius:"50%",color:(n.vars||n).palette.text.primary,fontFamily:n.typography.fontFamily,"&:focused":{backgroundColor:(n.vars||n).palette.background.paper},[`&.${sr.selected}`]:{color:(n.vars||n).palette.primary.contrastText},[`&.${sr.disabled}`]:{pointerEvents:"none",color:(n.vars||n).palette.text.disabled},variants:[{props:{inner:!0},style:k({},n.typography.body2,{color:(n.vars||n).palette.text.secondary})}]}));function Nl(n){const e=ve({props:n,name:"MuiClockNumber"}),{className:t,disabled:s,index:r,inner:o,label:i,selected:a}=e,l=pe(e,$p),u=e,d=Lp(u),h=r%12/12*Math.PI*2-Math.PI/2,p=(Xs-zt-2)/2*(o?.65:1),g=Math.round(Math.cos(h)*p),m=Math.round(Math.sin(h)*p);return I.jsx(Vp,k({className:Ie(d.root,t),"aria-disabled":s?!0:void 0,"aria-selected":a?!0:void 0,role:"option",style:{transform:`translate(${g}px, ${m+(Xs-zt)/2}px`},ownerState:u},l,{children:i}))}const Rp=({ampm:n,value:e,getClockNumberText:t,isDisabled:s,selectedId:r,utils:o})=>{const i=e?o.getHours(e):null,a=[],l=n?1:0,u=n?12:23,d=h=>i===null?!1:n?h===12?i===12||i===0:i===h||i-12===h:i===h;for(let h=l;h<=u;h+=1){let p=h.toString();h===0&&(p="00");const g=!n&&(h===0||h>12);p=o.formatNumber(p);const m=d(h);a.push(I.jsx(Nl,{id:m?r:void 0,index:h,inner:g,selected:m,disabled:s(h),label:p,"aria-label":t(p)},h))}return a},na=({utils:n,value:e,isDisabled:t,getClockNumberText:s,selectedId:r})=>{const o=n.formatNumber;return[[5,o("05")],[10,o("10")],[15,o("15")],[20,o("20")],[25,o("25")],[30,o("30")],[35,o("35")],[40,o("40")],[45,o("45")],[50,o("50")],[55,o("55")],[0,o("00")]].map(([i,a],l)=>{const u=i===e;return I.jsx(Nl,{label:a,id:u?r:void 0,index:l+1,inner:!1,disabled:t(i),selected:u,"aria-label":s(a)},i)})},Ci=({timezone:n,value:e,defaultValue:t,referenceDate:s,onChange:r,valueManager:o})=>{const i=Ee(),a=De(t),l=e??a.current??o.emptyValue,u=he(()=>o.getTimezone(i,l),[i,o,l]),d=ce(m=>u==null?m:o.setTimezone(i,u,m));let h;n?h=n:u?h=u:s?h=i.getTimezone(s):h="default";const p=he(()=>o.setTimezone(i,h,l),[o,i,h,l]),g=ce((m,...f)=>{const y=d(m);r==null||r(y,...f)});return{value:p,handleValueChange:g,timezone:h}},nn=({name:n,timezone:e,value:t,defaultValue:s,referenceDate:r,onChange:o,valueManager:i})=>{const[a,l]=xs({name:n,state:"value",controlled:t,default:s??i.emptyValue}),u=ce((d,...h)=>{l(d),o==null||o(d,...h)});return Ci({timezone:e,value:a,defaultValue:void 0,referenceDate:r,onChange:u,valueManager:i})},At={year:1,month:2,day:3,hours:4,minutes:5,seconds:6,milliseconds:7},jp=n=>Math.max(...n.map(e=>At[e.type]??1)),hn=(n,e,t)=>{if(e===At.year)return n.startOfYear(t);if(e===At.month)return n.startOfMonth(t);if(e===At.day)return n.startOfDay(t);let s=t;return e<At.minutes&&(s=n.setMinutes(s,0)),e<At.seconds&&(s=n.setSeconds(s,0)),e<At.milliseconds&&(s=n.setMilliseconds(s,0)),s},Up=({props:n,utils:e,granularity:t,timezone:s,getTodayDate:r})=>{let o=r?r():hn(e,t,yi(e,s));n.minDate!=null&&e.isAfterDay(n.minDate,o)&&(o=hn(e,t,n.minDate)),n.maxDate!=null&&e.isBeforeDay(n.maxDate,o)&&(o=hn(e,t,n.maxDate));const i=Wn(n.disableIgnoringDatePartForTimeValidation??!1,e);return n.minTime!=null&&i(n.minTime,o)&&(o=hn(e,t,n.disableIgnoringDatePartForTimeValidation?n.minTime:Tr(e,o,n.minTime))),n.maxTime!=null&&i(o,n.maxTime)&&(o=hn(e,t,n.disableIgnoringDatePartForTimeValidation?n.maxTime:Tr(e,o,n.maxTime))),o},Bl=(n,e)=>{const t=n.formatTokenMap[e];if(t==null)throw new Error([`MUI X: The token "${e}" is not supported by the Date and Time Pickers.`,"Please try using another token or open an issue on https://github.com/mui/mui-x/issues/new/choose if you think it should be supported."].join(`
`));return typeof t=="string"?{type:t,contentType:t==="meridiem"?"letter":"digit",maxLength:void 0}:{type:t.sectionType,contentType:t.contentType,maxLength:t.maxLength}},Wp=n=>{switch(n){case"ArrowUp":return 1;case"ArrowDown":return-1;case"PageUp":return 5;case"PageDown":return-5;default:return 0}},Wr=(n,e)=>{const t=[],s=n.date(void 0,"default"),r=n.startOfWeek(s),o=n.endOfWeek(s);let i=r;for(;n.isBefore(i,o);)t.push(i),i=n.addDays(i,1);return t.map(a=>n.formatByString(a,e))},Ml=(n,e,t,s)=>{switch(t){case"month":return gi(n,n.date(void 0,e)).map(r=>n.formatByString(r,s));case"weekDay":return Wr(n,s);case"meridiem":{const r=n.date(void 0,e);return[n.startOfDay(r),n.endOfDay(r)].map(o=>n.formatByString(o,s))}default:return[]}},ra="s",zp=["0","1","2","3","4","5","6","7","8","9"],Hp=n=>{const e=n.date(void 0);return n.formatByString(n.setSeconds(e,0),ra)==="0"?zp:Array.from({length:10}).map((s,r)=>n.formatByString(n.setSeconds(e,r),ra))},Ss=(n,e)=>{if(e[0]==="0")return n;const t=[];let s="";for(let r=0;r<n.length;r+=1){s+=n[r];const o=e.indexOf(s);o>-1&&(t.push(o.toString()),s="")}return t.join("")},Di=(n,e)=>e[0]==="0"?n:n.split("").map(t=>e[Number(t)]).join(""),oa=(n,e)=>{const t=Ss(n,e);return t!==" "&&!Number.isNaN(Number(t))},$l=(n,e)=>{let t=n;for(t=Number(t).toString();t.length<e;)t=`0${t}`;return t},Ll=(n,e,t,s,r)=>{if(r.type==="day"&&r.contentType==="digit-with-letter"){const i=n.setDate(t.longestMonth,e);return n.formatByString(i,r.format)}let o=e.toString();return r.hasLeadingZerosInInput&&(o=$l(o,r.maxLength)),Di(o,s)},Jp=(n,e,t,s,r,o,i,a)=>{const l=Wp(s),u=s==="Home",d=s==="End",h=t.value===""||u||d,p=()=>{const m=r[t.type]({currentDate:i,format:t.format,contentType:t.contentType}),f=C=>Ll(n,C,m,o,t),y=t.type==="minutes"&&(a!=null&&a.minutesStep)?a.minutesStep:1;let b;if(h){if(t.type==="year"&&!d&&!u)return n.formatByString(n.date(void 0,e),t.format);l>0||u?b=m.minimum:b=m.maximum}else b=parseInt(Ss(t.value,o),10)+l*y;return b%y!==0&&((l<0||u)&&(b+=y-(y+b)%y),(l>0||d)&&(b-=b%y)),b>m.maximum?f(m.minimum+(b-m.maximum-1)%(m.maximum-m.minimum+1)):b<m.minimum?f(m.maximum-(m.minimum-b-1)%(m.maximum-m.minimum+1)):f(b)},g=()=>{const m=Ml(n,e,t.type,t.format);if(m.length===0)return t.value;if(h)return l>0||u?m[0]:m[m.length-1];const b=((m.indexOf(t.value)+l)%m.length+m.length)%m.length;return m[b]};return t.contentType==="digit"||t.contentType==="digit-with-letter"?p():g()},vi=(n,e,t)=>{let s=n.value||n.placeholder;const r=e==="non-input"?n.hasLeadingZerosInFormat:n.hasLeadingZerosInInput;return e==="non-input"&&n.hasLeadingZerosInInput&&!n.hasLeadingZerosInFormat&&(s=Number(Ss(s,t)).toString()),["input-rtl","input-ltr"].includes(e)&&n.contentType==="digit"&&!r&&s.length===1&&(s=`${s}‎`),e==="input-rtl"&&(s=`⁨${s}⁩`),s},ia=(n,e,t,s)=>n.formatByString(n.parse(e,t),s),Kp=(n,e)=>n.formatByString(n.date(void 0,"system"),e).length===4,Vl=(n,e,t,s)=>{if(e!=="digit")return!1;const r=n.date(void 0,"default");switch(t){case"year":return n.lib==="dayjs"&&s==="YY"?!0:n.formatByString(n.setYear(r,1),s).startsWith("0");case"month":return n.formatByString(n.startOfYear(r),s).length>1;case"day":return n.formatByString(n.startOfMonth(r),s).length>1;case"weekDay":return n.formatByString(n.startOfWeek(r),s).length>1;case"hours":return n.formatByString(n.setHours(r,1),s).length>1;case"minutes":return n.formatByString(n.setMinutes(r,1),s).length>1;case"seconds":return n.formatByString(n.setSeconds(r,1),s).length>1;default:throw new Error("Invalid section type")}},qp=(n,e,t)=>{const s=e.some(l=>l.type==="day"),r=[],o=[];for(let l=0;l<e.length;l+=1){const u=e[l];s&&u.type==="weekDay"||(r.push(u.format),o.push(vi(u,"non-input",t)))}const i=r.join(" "),a=o.join(" ");return n.parse(a,i)},Yp=n=>n.map(e=>`${e.startSeparator}${e.value||e.placeholder}${e.endSeparator}`).join(""),Gp=(n,e,t)=>{const r=n.map(o=>{const i=vi(o,t?"input-rtl":"input-ltr",e);return`${o.startSeparator}${i}${o.endSeparator}`}).join("");return t?`⁦${r}⁩`:r},Qp=(n,e,t)=>{const s=n.date(void 0,t),r=n.endOfYear(s),o=n.endOfDay(s),{maxDaysInMonth:i,longestMonth:a}=gi(n,s).reduce((l,u)=>{const d=n.getDaysInMonth(u);return d>l.maxDaysInMonth?{maxDaysInMonth:d,longestMonth:u}:l},{maxDaysInMonth:0,longestMonth:null});return{year:({format:l})=>({minimum:0,maximum:Kp(n,l)?9999:99}),month:()=>({minimum:1,maximum:n.getMonth(r)+1}),day:({currentDate:l})=>({minimum:1,maximum:l!=null&&n.isValid(l)?n.getDaysInMonth(l):i,longestMonth:a}),weekDay:({format:l,contentType:u})=>{if(u==="digit"){const d=Wr(n,l).map(Number);return{minimum:Math.min(...d),maximum:Math.max(...d)}}return{minimum:1,maximum:7}},hours:({format:l})=>{const u=n.getHours(o);return Ss(n.formatByString(n.endOfDay(s),l),e)!==u.toString()?{minimum:1,maximum:Number(Ss(n.formatByString(n.startOfDay(s),l),e))}:{minimum:0,maximum:u}},minutes:()=>({minimum:0,maximum:n.getMinutes(o)}),seconds:()=>({minimum:0,maximum:n.getSeconds(o)}),meridiem:()=>({minimum:0,maximum:1}),empty:()=>({minimum:0,maximum:0})}},Xp=(n,e,t,s)=>{switch(e.type){case"year":return n.setYear(s,n.getYear(t));case"month":return n.setMonth(s,n.getMonth(t));case"weekDay":{const r=Wr(n,e.format),o=n.formatByString(t,e.format),i=r.indexOf(o),l=r.indexOf(e.value)-i;return n.addDays(t,l)}case"day":return n.setDate(s,n.getDate(t));case"meridiem":{const r=n.getHours(t)<12,o=n.getHours(s);return r&&o>=12?n.addHours(s,-12):!r&&o<12?n.addHours(s,12):s}case"hours":return n.setHours(s,n.getHours(t));case"minutes":return n.setMinutes(s,n.getMinutes(t));case"seconds":return n.setSeconds(s,n.getSeconds(t));default:return s}},aa={year:1,month:2,day:3,weekDay:4,hours:5,minutes:6,seconds:7,meridiem:8,empty:9},la=(n,e,t,s,r)=>[...t].sort((o,i)=>aa[o.type]-aa[i.type]).reduce((o,i)=>!r||i.modified?Xp(n,i,e,o):o,s),Zp=()=>navigator.userAgent.toLowerCase().includes("android"),ef=(n,e)=>{const t={};if(!e)return n.forEach((l,u)=>{const d=u===0?null:u-1,h=u===n.length-1?null:u+1;t[u]={leftIndex:d,rightIndex:h}}),{neighbors:t,startIndex:0,endIndex:n.length-1};const s={},r={};let o=0,i=0,a=n.length-1;for(;a>=0;){i=n.findIndex((l,u)=>{var d;return u>=o&&((d=l.endSeparator)==null?void 0:d.includes(" "))&&l.endSeparator!==" / "}),i===-1&&(i=n.length-1);for(let l=i;l>=o;l-=1)r[l]=a,s[a]=l,a-=1;o=i+1}return n.forEach((l,u)=>{const d=r[u],h=d===0?null:s[d-1],p=d===n.length-1?null:s[d+1];t[u]={leftIndex:h,rightIndex:p}}),{neighbors:t,startIndex:s[0],endIndex:s[n.length-1]}},Uo=(n,e)=>{if(n==null)return null;if(n==="all")return"all";if(typeof n=="string"){const t=e.findIndex(s=>s.type===n);return t===-1?null:t}return n},tf=(n,e)=>{if(n.value)switch(n.type){case"month":{if(n.contentType==="digit")return e.format(e.setMonth(e.date(),Number(n.value)-1),"month");const t=e.parse(n.value,n.format);return t?e.format(t,"month"):void 0}case"day":return n.contentType==="digit"?e.format(e.setDate(e.startOfYear(e.date()),Number(n.value)),"dayOfMonthFull"):n.value;case"weekDay":return;default:return}},sf=(n,e)=>{if(n.value)switch(n.type){case"weekDay":return n.contentType==="letter"?void 0:Number(n.value);case"meridiem":{const t=e.parse(`01:00 ${n.value}`,`${e.formats.hours12h}:${e.formats.minutes} ${n.format}`);return t?e.getHours(t)>=12?1:0:void 0}case"day":return n.contentType==="digit-with-letter"?parseInt(n.value,10):Number(n.value);case"month":{if(n.contentType==="digit")return Number(n.value);const t=e.parse(n.value,n.format);return t?e.getMonth(t)+1:void 0}default:return n.contentType!=="letter"?Number(n.value):void 0}},nf=["value","referenceDate"],tt={emptyValue:null,getTodayValue:yi,getInitialReferenceValue:n=>{let{value:e,referenceDate:t}=n,s=pe(n,nf);return e!=null&&s.utils.isValid(e)?e:t??Up(s)},cleanValue:Ep,areValuesEqual:xp,isSameError:(n,e)=>n===e,hasError:n=>n!=null,defaultErrorState:null,getTimezone:(n,e)=>e==null||!n.isValid(e)?null:n.getTimezone(e),setTimezone:(n,e,t)=>t==null?null:n.setTimezone(t,e)},Rl={updateReferenceValue:(n,e,t)=>e==null||!n.isValid(e)?t:e,getSectionsFromValue:(n,e,t,s)=>!n.isValid(e)&&!!t?t:s(e),getV7HiddenInputValueFromSections:Yp,getV6InputValueFromSections:Gp,getActiveDateManager:(n,e)=>({date:e.value,referenceDate:e.referenceValue,getSections:t=>t,getNewValuesFromNewActiveDate:t=>({value:t,referenceValue:t==null||!n.isValid(t)?e.referenceValue:t})}),parseValueStr:(n,e,t)=>t(n.trim(),e)},wi=({value:n,referenceDate:e,utils:t,props:s,timezone:r})=>{const o=he(()=>tt.getInitialReferenceValue({value:n,utils:t,props:s,referenceDate:e,granularity:At.day,timezone:r,getTodayDate:()=>yi(t,r,"date")}),[]);return n??o},rf=["ampm","ampmInClock","autoFocus","slots","slotProps","value","defaultValue","referenceDate","disableIgnoringDatePartForTimeValidation","maxTime","minTime","disableFuture","disablePast","minutesStep","shouldDisableTime","showViewSwitcher","onChange","view","views","openTo","onViewChange","focusedView","onFocusedViewChange","className","disabled","readOnly","timezone"],of=n=>{const{classes:e}=n;return Se({root:["root"],arrowSwitcher:["arrowSwitcher"]},up,e)},af=X(Ur,{name:"MuiTimeClock",slot:"Root",overridesResolver:(n,e)=>e.root})({display:"flex",flexDirection:"column",position:"relative"}),lf=X(kl,{name:"MuiTimeClock",slot:"ArrowSwitcher",overridesResolver:(n,e)=>e.arrowSwitcher})({position:"absolute",right:12,top:15}),cf=["hours","minutes"],uf=Te(function(e,t){const s=Ee(),r=ve({props:e,name:"MuiTimeClock"}),{ampm:o=s.is12HourCycleInCurrentLocale(),ampmInClock:i=!1,autoFocus:a,slots:l,slotProps:u,value:d,defaultValue:h,referenceDate:p,disableIgnoringDatePartForTimeValidation:g=!1,maxTime:m,minTime:f,disableFuture:y,disablePast:b,minutesStep:C=1,shouldDisableTime:D,showViewSwitcher:v,onChange:E,view:A,views:S=cf,openTo:T,onViewChange:N,focusedView:V,onFocusedViewChange:_,className:$,disabled:j,readOnly:U,timezone:R}=r,K=pe(r,rf),{value:ae,handleValueChange:se,timezone:de}=nn({name:"TimeClock",timezone:R,value:d,defaultValue:h,referenceDate:p,onChange:E,valueManager:tt}),ie=wi({value:ae,referenceDate:p,utils:s,props:r,timezone:de}),P=nt(),M=Fs(de),{view:O,setView:B,previousView:Y,nextView:ne,setValueAndGoToNextView:ee}=zn({view:A,views:S,openTo:T,onViewChange:N,onChange:se,focusedView:V,onFocusedViewChange:_}),{meridiemMode:z,handleMeridiemChange:J}=fi(ie,o,ee),ue=pt((te,q)=>{const H=Wn(g,s),G=q==="hours"||q==="minutes"&&S.includes("seconds"),Q=({start:me,end:Qe})=>!(f&&H(f,Qe)||m&&H(me,m)||y&&H(me,M)||b&&H(M,G?Qe:me)),oe=(me,Qe=1)=>{if(me%Qe!==0)return!1;if(D)switch(q){case"hours":return!D(s.setHours(ie,me),"hours");case"minutes":return!D(s.setMinutes(ie,me),"minutes");case"seconds":return!D(s.setSeconds(ie,me),"seconds");default:return!1}return!0};switch(q){case"hours":{const me=Mn(te,z,o),Qe=s.setHours(ie,me);if(s.getHours(Qe)!==me)return!0;const ft=s.setSeconds(s.setMinutes(Qe,0),0),cs=s.setSeconds(s.setMinutes(Qe,59),59);return!Q({start:ft,end:cs})||!oe(me)}case"minutes":{const me=s.setMinutes(ie,te),Qe=s.setSeconds(me,0),ft=s.setSeconds(me,59);return!Q({start:Qe,end:ft})||!oe(te,C)}case"seconds":{const me=s.setSeconds(ie,te);return!Q({start:me,end:me})||!oe(te)}default:throw new Error("not supported")}},[o,ie,g,m,z,f,C,D,s,y,b,M,S]),le=tn(),re=he(()=>{switch(O){case"hours":{const te=(G,Q)=>{const oe=Mn(G,z,o);ee(s.setHours(ie,oe),Q,"hours")},q=s.getHours(ie);let H;return o?q>12?H=[12,23]:H=[0,11]:H=[0,23],{onChange:te,viewValue:q,children:Rp({value:ae,utils:s,ampm:o,getClockNumberText:P.hoursClockNumberText,isDisabled:G=>j||ue(G,"hours"),selectedId:le}),viewRange:H}}case"minutes":{const te=s.getMinutes(ie);return{viewValue:te,onChange:(H,G)=>{ee(s.setMinutes(ie,H),G,"minutes")},children:na({utils:s,value:te,getClockNumberText:P.minutesClockNumberText,isDisabled:H=>j||ue(H,"minutes"),selectedId:le}),viewRange:[0,59]}}case"seconds":{const te=s.getSeconds(ie);return{viewValue:te,onChange:(H,G)=>{ee(s.setSeconds(ie,H),G,"seconds")},children:na({utils:s,value:te,getClockNumberText:P.secondsClockNumberText,isDisabled:H=>j||ue(H,"seconds"),selectedId:le}),viewRange:[0,59]}}default:throw new Error("You must provide the type for ClockView")}},[O,s,ae,o,P.hoursClockNumberText,P.minutesClockNumberText,P.secondsClockNumberText,z,ee,ie,ue,le,j]),L=r,Z=of(L);return I.jsxs(af,k({ref:t,className:Ie(Z.root,$),ownerState:L},K,{children:[I.jsx(Bp,k({autoFocus:a??!!V,ampmInClock:i&&S.includes("hours"),value:ae,type:O,ampm:o,minutesStep:C,isTimeDisabled:ue,meridiemMode:z,handleMeridiemChange:J,selectedId:le,disabled:j,readOnly:U},re)),v&&I.jsx(lf,{className:Z.arrowSwitcher,slots:l,slotProps:u,onGoToPrevious:()=>B(Y),isPreviousDisabled:!Y,previousLabel:P.openPreviousView,onGoToNext:()=>B(ne),isNextDisabled:!ne,nextLabel:P.openNextView,ownerState:L})]}))});function hf(n){return Ae("MuiDigitalClock",n)}Fe("MuiDigitalClock",["root","list","item"]);function $s(n,e){return Array.isArray(e)?e.every(t=>n.indexOf(t)!==-1):n.indexOf(e)!==-1}const df=(n,e)=>t=>{(t.key==="Enter"||t.key===" ")&&(n(t),t.preventDefault(),t.stopPropagation())},ot=(n=document)=>{const e=n.activeElement;return e?e.shadowRoot?ot(e.shadowRoot):e:null},Ar=n=>Array.from(n.children).indexOf(ot(document)),jl="@media (pointer: fine)",pf=["ampm","timeStep","autoFocus","slots","slotProps","value","defaultValue","referenceDate","disableIgnoringDatePartForTimeValidation","maxTime","minTime","disableFuture","disablePast","minutesStep","shouldDisableTime","onChange","view","openTo","onViewChange","focusedView","onFocusedViewChange","className","disabled","readOnly","views","skipDisabled","timezone"],ff=n=>{const{classes:e}=n;return Se({root:["root"],list:["list"],item:["item"]},hf,e)},mf=X(Ur,{name:"MuiDigitalClock",slot:"Root",overridesResolver:(n,e)=>e.root})({overflowY:"auto",width:"100%","@media (prefers-reduced-motion: no-preference)":{scrollBehavior:"auto"},maxHeight:Il,variants:[{props:{alreadyRendered:!0},style:{"@media (prefers-reduced-motion: no-preference)":{scrollBehavior:"smooth"}}}]}),gf=X(gl,{name:"MuiDigitalClock",slot:"List",overridesResolver:(n,e)=>e.list})({padding:0}),yf=X(ml,{name:"MuiDigitalClock",slot:"Item",overridesResolver:(n,e)=>e.item})(({theme:n})=>({padding:"8px 16px",margin:"2px 4px","&:first-of-type":{marginTop:4},"&:hover":{backgroundColor:n.vars?`rgba(${n.vars.palette.primary.mainChannel} / ${n.vars.palette.action.hoverOpacity})`:$t(n.palette.primary.main,n.palette.action.hoverOpacity)},"&.Mui-selected":{backgroundColor:(n.vars||n).palette.primary.main,color:(n.vars||n).palette.primary.contrastText,"&:focus-visible, &:hover":{backgroundColor:(n.vars||n).palette.primary.dark}},"&.Mui-focusVisible":{backgroundColor:n.vars?`rgba(${n.vars.palette.primary.mainChannel} / ${n.vars.palette.action.focusOpacity})`:$t(n.palette.primary.main,n.palette.action.focusOpacity)}})),bf=Te(function(e,t){const s=Ee(),r=De(null),o=ut(t,r),i=De(null),a=ve({props:e,name:"MuiDigitalClock"}),{ampm:l=s.is12HourCycleInCurrentLocale(),timeStep:u=30,autoFocus:d,slots:h,slotProps:p,value:g,defaultValue:m,referenceDate:f,disableIgnoringDatePartForTimeValidation:y=!1,maxTime:b,minTime:C,disableFuture:D,disablePast:v,minutesStep:E=1,shouldDisableTime:A,onChange:S,view:T,openTo:N,onViewChange:V,focusedView:_,onFocusedViewChange:$,className:j,disabled:U,readOnly:R,views:K=["hours"],skipDisabled:ae=!1,timezone:se}=a,de=pe(a,pf),{value:ie,handleValueChange:P,timezone:M}=nn({name:"DigitalClock",timezone:se,value:g,defaultValue:m,referenceDate:f,onChange:S,valueManager:tt}),O=nt(),B=Fs(M),Y=he(()=>k({},a,{alreadyRendered:!!r.current}),[a]),ne=ff(Y),ee=(h==null?void 0:h.digitalClockItem)??yf,z=ke({elementType:ee,externalSlotProps:p==null?void 0:p.digitalClockItem,ownerState:{},className:ne.item}),J=wi({value:ie,referenceDate:f,utils:s,props:a,timezone:M}),ue=ce(H=>P(H,"finish","hours")),{setValueAndGoToNextView:le}=zn({view:T,views:K,openTo:N,onViewChange:V,onChange:ue,focusedView:_,onFocusedViewChange:$}),re=ce(H=>{le(H,"finish")});Oe(()=>{if(r.current===null)return;const H=r.current.querySelector('[role="listbox"] [role="option"][tabindex="0"], [role="listbox"] [role="option"][aria-selected="true"]');if(!H)return;const G=H.offsetTop;(d||_)&&H.focus(),r.current.scrollTop=G-4});const L=pt(H=>{const G=Wn(y,s),Q=()=>!(C&&G(C,H)||b&&G(H,b)||D&&G(H,B)||v&&G(B,H)),oe=()=>s.getMinutes(H)%E!==0?!1:A?!A(H,"hours"):!0;return!Q()||!oe()},[y,s,C,b,D,B,v,E,A]),Z=he(()=>{const H=[];let Q=s.startOfDay(J);for(;s.isSameDay(J,Q);)H.push(Q),Q=s.addMinutes(Q,u);return H},[J,u,s]),te=Z.findIndex(H=>s.isEqual(H,J)),q=H=>{switch(H.key){case"PageUp":{const G=Ar(i.current)-5,Q=i.current.children,oe=Math.max(0,G),me=Q[oe];me&&me.focus(),H.preventDefault();break}case"PageDown":{const G=Ar(i.current)+5,Q=i.current.children,oe=Math.min(Q.length-1,G),me=Q[oe];me&&me.focus(),H.preventDefault();break}}};return I.jsx(mf,k({ref:o,className:Ie(ne.root,j),ownerState:Y},de,{children:I.jsx(gf,{ref:i,role:"listbox","aria-label":O.timePickerToolbarTitle,className:ne.list,onKeyDown:q,children:Z.map((H,G)=>{if(ae&&L(H))return null;const Q=s.isEqual(H,ie),oe=s.format(H,l?"fullTime12h":"fullTime24h"),me=te===G||te===-1&&G===0?0:-1;return I.jsx(ee,k({onClick:()=>!R&&re(H),selected:Q,disabled:U||L(H),disableRipple:R,role:"option","aria-disabled":R,"aria-selected":Q,tabIndex:me},z,{children:oe}),`${H.valueOf()}-${oe}`)})})}))});function Cf(n){return Ae("MuiMultiSectionDigitalClock",n)}Fe("MuiMultiSectionDigitalClock",["root"]);function Df(n){return Ae("MuiMultiSectionDigitalClockSection",n)}Fe("MuiMultiSectionDigitalClockSection",["root","item"]);const vf=["autoFocus","onChange","className","disabled","readOnly","items","active","slots","slotProps","skipDisabled"],wf=n=>{const{classes:e}=n;return Se({root:["root"],item:["item"]},Df,e)},Ef=X(gl,{name:"MuiMultiSectionDigitalClockSection",slot:"Root",overridesResolver:(n,e)=>e.root})(({theme:n})=>({maxHeight:Il,width:56,padding:0,overflow:"hidden","@media (prefers-reduced-motion: no-preference)":{scrollBehavior:"auto"},"@media (pointer: fine)":{"&:hover":{overflowY:"auto"}},"@media (pointer: none), (pointer: coarse)":{overflowY:"auto"},"&:not(:first-of-type)":{borderLeft:`1px solid ${(n.vars||n).palette.divider}`},"&::after":{display:"block",content:'""',height:"calc(100% - 40px - 6px)"},variants:[{props:{alreadyRendered:!0},style:{"@media (prefers-reduced-motion: no-preference)":{scrollBehavior:"smooth"}}}]})),xf=X(ml,{name:"MuiMultiSectionDigitalClockSection",slot:"Item",overridesResolver:(n,e)=>e.item})(({theme:n})=>({padding:8,margin:"2px 4px",width:cp,justifyContent:"center","&:first-of-type":{marginTop:4},"&:hover":{backgroundColor:n.vars?`rgba(${n.vars.palette.primary.mainChannel} / ${n.vars.palette.action.hoverOpacity})`:$t(n.palette.primary.main,n.palette.action.hoverOpacity)},"&.Mui-selected":{backgroundColor:(n.vars||n).palette.primary.main,color:(n.vars||n).palette.primary.contrastText,"&:focus-visible, &:hover":{backgroundColor:(n.vars||n).palette.primary.dark}},"&.Mui-focusVisible":{backgroundColor:n.vars?`rgba(${n.vars.palette.primary.mainChannel} / ${n.vars.palette.action.focusOpacity})`:$t(n.palette.primary.main,n.palette.action.focusOpacity)}})),Sf=Te(function(e,t){const s=De(null),r=ut(t,s),o=De(null),i=ve({props:e,name:"MuiMultiSectionDigitalClockSection"}),{autoFocus:a,onChange:l,className:u,disabled:d,readOnly:h,items:p,active:g,slots:m,slotProps:f,skipDisabled:y}=i,b=pe(i,vf),C=he(()=>k({},i,{alreadyRendered:!!s.current}),[i]),D=wf(C),v=(m==null?void 0:m.digitalClockSectionItem)??xf;Oe(()=>{if(s.current===null)return;const S=s.current.querySelector('[role="option"][tabindex="0"], [role="option"][aria-selected="true"]');if(g&&a&&S&&S.focus(),!S||o.current===S)return;o.current=S;const T=S.offsetTop;s.current.scrollTop=T-4});const E=p.findIndex(S=>S.isFocused(S.value)),A=S=>{switch(S.key){case"PageUp":{const T=Ar(s.current)-5,N=s.current.children,V=Math.max(0,T),_=N[V];_&&_.focus(),S.preventDefault();break}case"PageDown":{const T=Ar(s.current)+5,N=s.current.children,V=Math.min(N.length-1,T),_=N[V];_&&_.focus(),S.preventDefault();break}}};return I.jsx(Ef,k({ref:r,className:Ie(D.root,u),ownerState:C,autoFocusItem:a&&g,role:"listbox",onKeyDown:A},b,{children:p.map((S,T)=>{var j;const N=(j=S.isDisabled)==null?void 0:j.call(S,S.value),V=d||N;if(y&&V)return null;const _=S.isSelected(S.value),$=E===T||E===-1&&T===0?0:-1;return I.jsx(v,k({onClick:()=>!h&&l(S.value),selected:_,disabled:V,disableRipple:h,role:"option","aria-disabled":h||V||void 0,"aria-label":S.ariaLabel,"aria-selected":_,tabIndex:$,className:D.item},f==null?void 0:f.digitalClockSectionItem,{children:S.label}),S.label)})}))}),kf=({now:n,value:e,utils:t,ampm:s,isDisabled:r,resolveAriaLabel:o,timeStep:i,valueOrReferenceDate:a})=>{const l=e?t.getHours(e):null,u=[],d=(g,m)=>{const f=m??l;return f===null?!1:s?g===12?f===12||f===0:f===g||f-12===g:f===g},h=g=>d(g,t.getHours(a)),p=s?11:23;for(let g=0;g<=p;g+=i){let m=t.format(t.setHours(n,g),s?"hours12h":"hours24h");const f=o(parseInt(m,10).toString());m=t.formatNumber(m),u.push({value:g,label:m,isSelected:d,isDisabled:r,isFocused:h,ariaLabel:f})}return u},ca=({value:n,utils:e,isDisabled:t,timeStep:s,resolveLabel:r,resolveAriaLabel:o,hasValue:i=!0})=>{const a=u=>n===null?!1:i&&n===u,l=u=>n===u;return[...Array.from({length:Math.ceil(60/s)},(u,d)=>{const h=s*d;return{value:h,label:e.formatNumber(r(h)),isDisabled:t,isSelected:a,isFocused:l,ariaLabel:o(h.toString())}})]},Tf=["ampm","timeSteps","autoFocus","slots","slotProps","value","defaultValue","referenceDate","disableIgnoringDatePartForTimeValidation","maxTime","minTime","disableFuture","disablePast","minutesStep","shouldDisableTime","onChange","view","views","openTo","onViewChange","focusedView","onFocusedViewChange","className","disabled","readOnly","skipDisabled","timezone"],Af=n=>{const{classes:e}=n;return Se({root:["root"]},Cf,e)},Ff=X(Ur,{name:"MuiMultiSectionDigitalClock",slot:"Root",overridesResolver:(n,e)=>e.root})(({theme:n})=>({display:"flex",flexDirection:"row",width:"100%",borderBottom:`1px solid ${(n.vars||n).palette.divider}`})),If=Te(function(e,t){const s=Ee(),r=It(),o=ve({props:e,name:"MuiMultiSectionDigitalClock"}),{ampm:i=s.is12HourCycleInCurrentLocale(),timeSteps:a,autoFocus:l,slots:u,slotProps:d,value:h,defaultValue:p,referenceDate:g,disableIgnoringDatePartForTimeValidation:m=!1,maxTime:f,minTime:y,disableFuture:b,disablePast:C,minutesStep:D=1,shouldDisableTime:v,onChange:E,view:A,views:S=["hours","minutes"],openTo:T,onViewChange:N,focusedView:V,onFocusedViewChange:_,className:$,disabled:j,readOnly:U,skipDisabled:R=!1,timezone:K}=o,ae=pe(o,Tf),{value:se,handleValueChange:de,timezone:ie}=nn({name:"MultiSectionDigitalClock",timezone:K,value:h,defaultValue:p,referenceDate:g,onChange:E,valueManager:tt}),P=nt(),M=Fs(ie),O=he(()=>k({hours:1,minutes:5,seconds:5},a),[a]),B=wi({value:se,referenceDate:g,utils:s,props:o,timezone:ie}),Y=ce((Q,oe,me)=>de(Q,oe,me)),ne=he(()=>!i||!S.includes("hours")||S.includes("meridiem")?S:[...S,"meridiem"],[i,S]),{view:ee,setValueAndGoToNextView:z,focusedView:J}=zn({view:A,views:ne,openTo:T,onViewChange:N,onChange:Y,focusedView:V,onFocusedViewChange:_}),ue=ce(Q=>{z(Q,"finish","meridiem")}),{meridiemMode:le,handleMeridiemChange:re}=fi(B,i,ue,"finish"),L=pt((Q,oe)=>{const me=Wn(m,s),Qe=oe==="hours"||oe==="minutes"&&ne.includes("seconds"),ft=({start:Xe,end:lt})=>!(y&&me(y,lt)||f&&me(Xe,f)||b&&me(Xe,M)||C&&me(M,Qe?lt:Xe)),cs=(Xe,lt=1)=>{if(Xe%lt!==0)return!1;if(v)switch(oe){case"hours":return!v(s.setHours(B,Xe),"hours");case"minutes":return!v(s.setMinutes(B,Xe),"minutes");case"seconds":return!v(s.setSeconds(B,Xe),"seconds");default:return!1}return!0};switch(oe){case"hours":{const Xe=Mn(Q,le,i),lt=s.setHours(B,Xe);if(s.getHours(lt)!==Xe)return!0;const Yt=s.setSeconds(s.setMinutes(lt,0),0),Xn=s.setSeconds(s.setMinutes(lt,59),59);return!ft({start:Yt,end:Xn})||!cs(Xe)}case"minutes":{const Xe=s.setMinutes(B,Q),lt=s.setSeconds(Xe,0),Yt=s.setSeconds(Xe,59);return!ft({start:lt,end:Yt})||!cs(Q,D)}case"seconds":{const Xe=s.setSeconds(B,Q);return!ft({start:Xe,end:Xe})||!cs(Q)}default:throw new Error("not supported")}},[i,B,m,f,le,y,D,v,s,b,C,M,ne]),Z=pt(Q=>{switch(Q){case"hours":return{onChange:oe=>{const me=Mn(oe,le,i);z(s.setHours(B,me),"finish","hours")},items:kf({now:M,value:se,ampm:i,utils:s,isDisabled:oe=>L(oe,"hours"),timeStep:O.hours,resolveAriaLabel:P.hoursClockNumberText,valueOrReferenceDate:B})};case"minutes":return{onChange:oe=>{z(s.setMinutes(B,oe),"finish","minutes")},items:ca({value:s.getMinutes(B),utils:s,isDisabled:oe=>L(oe,"minutes"),resolveLabel:oe=>s.format(s.setMinutes(M,oe),"minutes"),timeStep:O.minutes,hasValue:!!se,resolveAriaLabel:P.minutesClockNumberText})};case"seconds":return{onChange:oe=>{z(s.setSeconds(B,oe),"finish","seconds")},items:ca({value:s.getSeconds(B),utils:s,isDisabled:oe=>L(oe,"seconds"),resolveLabel:oe=>s.format(s.setSeconds(M,oe),"seconds"),timeStep:O.seconds,hasValue:!!se,resolveAriaLabel:P.secondsClockNumberText})};case"meridiem":{const oe=ss(s,"am"),me=ss(s,"pm");return{onChange:re,items:[{value:"am",label:oe,isSelected:()=>!!se&&le==="am",isFocused:()=>!!B&&le==="am",ariaLabel:oe},{value:"pm",label:me,isSelected:()=>!!se&&le==="pm",isFocused:()=>!!B&&le==="pm",ariaLabel:me}]}}default:throw new Error(`Unknown view: ${Q} found.`)}},[M,se,i,s,O.hours,O.minutes,O.seconds,P.hoursClockNumberText,P.minutesClockNumberText,P.secondsClockNumberText,le,z,B,L,re]),te=he(()=>{if(!r)return ne;const Q=ne.filter(oe=>oe!=="meridiem");return Q.reverse(),ne.includes("meridiem")&&Q.push("meridiem"),Q},[r,ne]),q=he(()=>ne.reduce((Q,oe)=>k({},Q,{[oe]:Z(oe)}),{}),[ne,Z]),H=o,G=Af(H);return I.jsx(Ff,k({ref:t,className:Ie(G.root,$),ownerState:H,role:"group"},ae,{children:te.map(Q=>I.jsx(Sf,{items:q[Q].items,onChange:q[Q].onChange,active:ee===Q,autoFocus:l||J===Q,disabled:j,readOnly:U,slots:u,slotProps:d,skipDisabled:R,"aria-label":P.selectViewText(Q)},Q))}))});function _f(n){return Ae("MuiPickersDay",n)}const ds=Fe("MuiPickersDay",["root","dayWithMargin","dayOutsideMonth","hiddenDaySpacingFiller","today","selected","disabled"]),Of=["autoFocus","className","day","disabled","disableHighlightToday","disableMargin","hidden","isAnimating","onClick","onDaySelect","onFocus","onBlur","onKeyDown","onMouseDown","onMouseEnter","outsideCurrentMonth","selected","showDaysOutsideCurrentMonth","children","today","isFirstVisibleCell","isLastVisibleCell"],Pf=n=>{const{selected:e,disableMargin:t,disableHighlightToday:s,today:r,disabled:o,outsideCurrentMonth:i,showDaysOutsideCurrentMonth:a,classes:l}=n,u=i&&!a;return Se({root:["root",e&&!u&&"selected",o&&"disabled",!t&&"dayWithMargin",!s&&r&&"today",i&&a&&"dayOutsideMonth",u&&"hiddenDaySpacingFiller"],hiddenDaySpacingFiller:["hiddenDaySpacingFiller"]},_f,l)},Ul=({theme:n})=>k({},n.typography.caption,{width:$n,height:$n,borderRadius:"50%",padding:0,backgroundColor:"transparent",transition:n.transitions.create("background-color",{duration:n.transitions.duration.short}),color:(n.vars||n).palette.text.primary,"@media (pointer: fine)":{"&:hover":{backgroundColor:n.vars?`rgba(${n.vars.palette.primary.mainChannel} / ${n.vars.palette.action.hoverOpacity})`:$t(n.palette.primary.main,n.palette.action.hoverOpacity)}},"&:focus":{backgroundColor:n.vars?`rgba(${n.vars.palette.primary.mainChannel} / ${n.vars.palette.action.focusOpacity})`:$t(n.palette.primary.main,n.palette.action.focusOpacity),[`&.${ds.selected}`]:{willChange:"background-color",backgroundColor:(n.vars||n).palette.primary.dark}},[`&.${ds.selected}`]:{color:(n.vars||n).palette.primary.contrastText,backgroundColor:(n.vars||n).palette.primary.main,fontWeight:n.typography.fontWeightMedium,"&:hover":{willChange:"background-color",backgroundColor:(n.vars||n).palette.primary.dark}},[`&.${ds.disabled}:not(.${ds.selected})`]:{color:(n.vars||n).palette.text.disabled},[`&.${ds.disabled}&.${ds.selected}`]:{opacity:.6},variants:[{props:{disableMargin:!1},style:{margin:`0 ${Rr}px`}},{props:{outsideCurrentMonth:!0,showDaysOutsideCurrentMonth:!0},style:{color:(n.vars||n).palette.text.secondary}},{props:{disableHighlightToday:!1,today:!0},style:{[`&:not(.${ds.selected})`]:{border:`1px solid ${(n.vars||n).palette.text.secondary}`}}}]}),Wl=(n,e)=>{const{ownerState:t}=n;return[e.root,!t.disableMargin&&e.dayWithMargin,!t.disableHighlightToday&&t.today&&e.today,!t.outsideCurrentMonth&&t.showDaysOutsideCurrentMonth&&e.dayOutsideMonth,t.outsideCurrentMonth&&!t.showDaysOutsideCurrentMonth&&e.hiddenDaySpacingFiller]},Nf=X(Vh,{name:"MuiPickersDay",slot:"Root",overridesResolver:Wl})(Ul),Bf=X("div",{name:"MuiPickersDay",slot:"Root",overridesResolver:Wl})(({theme:n})=>k({},Ul({theme:n}),{opacity:0,pointerEvents:"none"})),dn=()=>{},Mf=Te(function(e,t){const s=ve({props:e,name:"MuiPickersDay"}),{autoFocus:r=!1,className:o,day:i,disabled:a=!1,disableHighlightToday:l=!1,disableMargin:u=!1,isAnimating:d,onClick:h,onDaySelect:p,onFocus:g=dn,onBlur:m=dn,onKeyDown:f=dn,onMouseDown:y=dn,onMouseEnter:b=dn,outsideCurrentMonth:C,selected:D=!1,showDaysOutsideCurrentMonth:v=!1,children:E,today:A=!1}=s,S=pe(s,Of),T=k({},s,{autoFocus:r,disabled:a,disableHighlightToday:l,disableMargin:u,selected:D,showDaysOutsideCurrentMonth:v,today:A}),N=Pf(T),V=Ee(),_=De(null),$=ut(_,t);Kt(()=>{r&&!a&&!d&&!C&&_.current.focus()},[r,a,d,C]);const j=R=>{y(R),C&&R.preventDefault()},U=R=>{a||p(i),C&&R.currentTarget.focus(),h&&h(R)};return C&&!v?I.jsx(Bf,{className:Ie(N.root,N.hiddenDaySpacingFiller,o),ownerState:T,role:S.role}):I.jsx(Nf,k({className:Ie(N.root,o),ref:$,centerRipple:!0,disabled:a,tabIndex:D?0:-1,onKeyDown:R=>f(R,i),onFocus:R=>g(R,i),onBlur:R=>m(R,i),onMouseEnter:R=>b(R,i),onClick:U,onMouseDown:j},S,{ownerState:T,children:E||V.format(i,"dayOfMonth")}))}),$f=Zo(Mf),Hn=({props:n,value:e,timezone:t,adapter:s})=>{if(e===null)return null;const{shouldDisableDate:r,shouldDisableMonth:o,shouldDisableYear:i,disablePast:a,disableFuture:l}=n,u=s.utils.date(void 0,t),d=vt(s.utils,n.minDate,s.defaultDates.minDate),h=vt(s.utils,n.maxDate,s.defaultDates.maxDate);switch(!0){case!s.utils.isValid(e):return"invalidDate";case!!(r&&r(e)):return"shouldDisableDate";case!!(o&&o(e)):return"shouldDisableMonth";case!!(i&&i(e)):return"shouldDisableYear";case!!(l&&s.utils.isAfterDay(e,u)):return"disableFuture";case!!(a&&s.utils.isBeforeDay(e,u)):return"disablePast";case!!(d&&s.utils.isBeforeDay(e,d)):return"minDate";case!!(h&&s.utils.isAfterDay(e,h)):return"maxDate";default:return null}};Hn.valueManager=tt;const zr=({adapter:n,value:e,timezone:t,props:s})=>{if(e===null)return null;const{minTime:r,maxTime:o,minutesStep:i,shouldDisableTime:a,disableIgnoringDatePartForTimeValidation:l=!1,disablePast:u,disableFuture:d}=s,h=n.utils.date(void 0,t),p=Wn(l,n.utils);switch(!0){case!n.utils.isValid(e):return"invalidDate";case!!(r&&p(r,e)):return"minTime";case!!(o&&p(e,o)):return"maxTime";case!!(d&&n.utils.isAfter(e,h)):return"disableFuture";case!!(u&&n.utils.isBefore(e,h)):return"disablePast";case!!(a&&a(e,"hours")):return"shouldDisableTime-hours";case!!(a&&a(e,"minutes")):return"shouldDisableTime-minutes";case!!(a&&a(e,"seconds")):return"shouldDisableTime-seconds";case!!(i&&n.utils.getMinutes(e)%i!==0):return"minutesStep";default:return null}};zr.valueManager=tt;const Wo=["disablePast","disableFuture","minDate","maxDate","shouldDisableDate","shouldDisableMonth","shouldDisableYear"],zo=["disablePast","disableFuture","minTime","maxTime","shouldDisableTime","minutesStep","ampm","disableIgnoringDatePartForTimeValidation"],zl=["minDateTime","maxDateTime"],Lf=[...Wo,...zo,...zl],Hr=n=>Lf.reduce((e,t)=>(n.hasOwnProperty(t)&&(e[t]=n[t]),e),{});function Hl(n){const{props:e,validator:t,value:s,timezone:r,onError:o}=n,i=As(),a=De(t.valueManager.defaultErrorState),l=t({adapter:i,value:s,timezone:r,props:e}),u=t.valueManager.hasError(l);Oe(()=>{o&&!t.valueManager.isSameError(l,a.current)&&o(l,s),a.current=l},[t,o,l,s]);const d=ce(h=>t({adapter:i,value:h,timezone:r,props:e}));return{validationError:l,hasValidationError:u,getValidationErrorForNewValue:d}}const Vf=({utils:n,format:e})=>{let t=10,s=e,r=n.expandFormat(e);for(;r!==s;)if(s=r,r=n.expandFormat(s),t-=1,t<0)throw new Error("MUI X: The format expansion seems to be in an infinite loop. Please open an issue with the format passed to the picker component.");return r},Rf=({utils:n,expandedFormat:e})=>{const t=[],{start:s,end:r}=n.escapedCharacters,o=new RegExp(`(\\${s}[^\\${r}]*\\${r})+`,"g");let i=null;for(;i=o.exec(e);)t.push({start:i.index,end:o.lastIndex-1});return t},jf=(n,e,t,s)=>{switch(t.type){case"year":return e.fieldYearPlaceholder({digitAmount:n.formatByString(n.date(void 0,"default"),s).length,format:s});case"month":return e.fieldMonthPlaceholder({contentType:t.contentType,format:s});case"day":return e.fieldDayPlaceholder({format:s});case"weekDay":return e.fieldWeekDayPlaceholder({contentType:t.contentType,format:s});case"hours":return e.fieldHoursPlaceholder({format:s});case"minutes":return e.fieldMinutesPlaceholder({format:s});case"seconds":return e.fieldSecondsPlaceholder({format:s});case"meridiem":return e.fieldMeridiemPlaceholder({format:s});default:return s}},Uf=({utils:n,date:e,shouldRespectLeadingZeros:t,localeText:s,localizedDigits:r,now:o,token:i,startSeparator:a})=>{if(i==="")throw new Error("MUI X: Should not call `commitToken` with an empty token");const l=Bl(n,i),u=Vl(n,l.contentType,l.type,i),d=t?u:l.contentType==="digit",h=e!=null&&n.isValid(e);let p=h?n.formatByString(e,i):"",g=null;if(d)if(u)g=p===""?n.formatByString(o,i).length:p.length;else{if(l.maxLength==null)throw new Error(`MUI X: The token ${i} should have a 'maxDigitNumber' property on it's adapter`);g=l.maxLength,h&&(p=Di($l(Ss(p,r),g),r))}return k({},l,{format:i,maxLength:g,value:p,placeholder:jf(n,s,l,i),hasLeadingZerosInFormat:u,hasLeadingZerosInInput:d,startSeparator:a,endSeparator:"",modified:!1})},Wf=n=>{var g;const{utils:e,expandedFormat:t,escapedParts:s}=n,r=e.date(void 0),o=[];let i="";const a=Object.keys(e.formatTokenMap).sort((m,f)=>f.length-m.length),l=/^([a-zA-Z]+)/,u=new RegExp(`^(${a.join("|")})*$`),d=new RegExp(`^(${a.join("|")})`),h=m=>s.find(f=>f.start<=m&&f.end>=m);let p=0;for(;p<t.length;){const m=h(p),f=m!=null,y=(g=l.exec(t.slice(p)))==null?void 0:g[1];if(!f&&y!=null&&u.test(y)){let b=y;for(;b.length>0;){const C=d.exec(b)[1];b=b.slice(C.length),o.push(Uf(k({},n,{now:r,token:C,startSeparator:i}))),i=""}p+=y.length}else{const b=t[p];f&&(m==null?void 0:m.start)===p||(m==null?void 0:m.end)===p||(o.length===0?i+=b:o[o.length-1].endSeparator+=b),p+=1}}return o.length===0&&i.length>0&&o.push({type:"empty",contentType:"letter",maxLength:null,format:"",value:"",placeholder:"",hasLeadingZerosInFormat:!1,hasLeadingZerosInInput:!1,startSeparator:i,endSeparator:"",modified:!1}),o},zf=({isRtl:n,formatDensity:e,sections:t})=>t.map(s=>{const r=o=>{let i=o;return n&&i!==null&&i.includes(" ")&&(i=`⁩${i}⁦`),e==="spacious"&&["/",".","-"].includes(i)&&(i=` ${i} `),i};return s.startSeparator=r(s.startSeparator),s.endSeparator=r(s.endSeparator),s}),ua=n=>{let e=Vf(n);n.isRtl&&n.enableAccessibleFieldDOMStructure&&(e=e.split(" ").reverse().join(" "));const t=Rf(k({},n,{expandedFormat:e})),s=Wf(k({},n,{expandedFormat:e,escapedParts:t}));return zf(k({},n,{sections:s}))},Hf=n=>{const e=Ee(),t=nt(),s=As(),r=It(),{valueManager:o,fieldValueManager:i,valueType:a,validator:l,internalProps:u,internalProps:{value:d,defaultValue:h,referenceDate:p,onChange:g,format:m,formatDensity:f="dense",selectedSections:y,onSelectedSectionsChange:b,shouldRespectLeadingZeros:C=!1,timezone:D,enableAccessibleFieldDOMStructure:v=!1}}=n,{timezone:E,value:A,handleValueChange:S}=Ci({timezone:D,value:d,defaultValue:h,referenceDate:p,onChange:g,valueManager:o}),T=he(()=>Hp(e),[e]),N=he(()=>Qp(e,T,E),[e,T,E]),V=pt((Y,ne=null)=>i.getSectionsFromValue(e,Y,ne,ee=>ua({utils:e,localeText:t,localizedDigits:T,format:m,date:ee,formatDensity:f,shouldRespectLeadingZeros:C,enableAccessibleFieldDOMStructure:v,isRtl:r})),[i,m,t,T,r,C,e,f,v]),[_,$]=Dt(()=>{const Y=V(A),ne={sections:Y,value:A,referenceValue:o.emptyValue,tempValueStrAndroid:null},ee=jp(Y),z=o.getInitialReferenceValue({referenceDate:p,value:A,utils:e,props:u,granularity:ee,timezone:E});return k({},ne,{referenceValue:z})}),[j,U]=xs({controlled:y,default:null,name:"useField",state:"selectedSections"}),R=Y=>{U(Y),b==null||b(Y)},K=he(()=>Uo(j,_.sections),[j,_.sections]),ae=K==="all"?0:K,se=({value:Y,referenceValue:ne,sections:ee})=>{if($(J=>k({},J,{sections:ee,value:Y,referenceValue:ne,tempValueStrAndroid:null})),o.areValuesEqual(e,_.value,Y))return;const z={validationError:l({adapter:s,value:Y,timezone:E,props:u})};S(Y,z)},de=(Y,ne)=>{const ee=[..._.sections];return ee[Y]=k({},ee[Y],{value:ne,modified:!0}),ee},ie=()=>{se({value:o.emptyValue,referenceValue:_.referenceValue,sections:V(o.emptyValue)})},P=()=>{if(ae==null)return;const Y=_.sections[ae],ne=i.getActiveDateManager(e,_,Y),z=ne.getSections(_.sections).filter(re=>re.value!=="").length===(Y.value===""?0:1),J=de(ae,""),ue=z?null:e.getInvalidDate(),le=ne.getNewValuesFromNewActiveDate(ue);se(k({},le,{sections:J}))},M=Y=>{const ne=(J,ue)=>{const le=e.parse(J,m);if(le==null||!e.isValid(le))return null;const re=ua({utils:e,localeText:t,localizedDigits:T,format:m,date:le,formatDensity:f,shouldRespectLeadingZeros:C,enableAccessibleFieldDOMStructure:v,isRtl:r});return la(e,le,re,ue,!1)},ee=i.parseValueStr(Y,_.referenceValue,ne),z=i.updateReferenceValue(e,ee,_.referenceValue);se({value:ee,referenceValue:z,sections:V(ee,_.sections)})},O=({activeSection:Y,newSectionValue:ne,shouldGoToNextSection:ee})=>{ee&&ae<_.sections.length-1&&R(ae+1);const z=i.getActiveDateManager(e,_,Y),J=de(ae,ne),ue=z.getSections(J),le=qp(e,ue,T);let re,L;if(le!=null&&e.isValid(le)){const Z=la(e,le,ue,z.referenceDate,!0);re=z.getNewValuesFromNewActiveDate(Z),L=!0}else re=z.getNewValuesFromNewActiveDate(le),L=(le!=null&&!e.isValid(le))!=(z.date!=null&&!e.isValid(z.date));return L?se(k({},re,{sections:J})):$(Z=>k({},Z,re,{sections:J,tempValueStrAndroid:null}))},B=Y=>$(ne=>k({},ne,{tempValueStrAndroid:Y}));return Oe(()=>{const Y=V(_.value);$(ne=>k({},ne,{sections:Y}))},[m,e.locale,r]),Oe(()=>{let Y;o.areValuesEqual(e,_.value,A)?Y=o.getTimezone(e,_.value)!==o.getTimezone(e,A):Y=!0,Y&&$(ne=>k({},ne,{value:A,referenceValue:i.updateReferenceValue(e,A,ne.referenceValue),sections:V(A)}))},[A]),{state:_,activeSectionIndex:ae,parsedSelectedSections:K,setSelectedSections:R,clearValue:ie,clearActiveSection:P,updateSectionValue:O,updateValueFromValueStr:M,setTempAndroidValueStr:B,getSectionsFromValue:V,sectionsValueBoundaries:N,localizedDigits:T,timezone:E}},Jf=5e3,Os=n=>n.saveQuery!=null,Kf=({sections:n,updateSectionValue:e,sectionsValueBoundaries:t,localizedDigits:s,setTempAndroidValueStr:r,timezone:o})=>{const i=Ee(),[a,l]=Dt(null),u=ce(()=>l(null));Oe(()=>{var m;a!=null&&((m=n[a.sectionIndex])==null?void 0:m.type)!==a.sectionType&&u()},[n,a,u]),Oe(()=>{if(a!=null){const m=setTimeout(()=>u(),Jf);return()=>{clearTimeout(m)}}return()=>{}},[a,u]);const d=({keyPressed:m,sectionIndex:f},y,b)=>{const C=m.toLowerCase(),D=n[f];if(a!=null&&(!b||b(a.value))&&a.sectionIndex===f){const E=`${a.value}${C}`,A=y(E,D);if(!Os(A))return l({sectionIndex:f,value:E,sectionType:D.type}),A}const v=y(C,D);return Os(v)&&!v.saveQuery?(u(),null):(l({sectionIndex:f,value:C,sectionType:D.type}),Os(v)?null:v)},h=m=>{const f=(C,D,v)=>{const E=D.filter(A=>A.toLowerCase().startsWith(v));return E.length===0?{saveQuery:!1}:{sectionValue:E[0],shouldGoToNextSection:E.length===1}},y=(C,D,v,E)=>{const A=S=>Ml(i,o,D.type,S);if(D.contentType==="letter")return f(D.format,A(D.format),C);if(v&&E!=null&&Bl(i,v).contentType==="letter"){const S=A(v),T=f(v,S,C);return Os(T)?{saveQuery:!1}:k({},T,{sectionValue:E(T.sectionValue,S)})}return{saveQuery:!1}};return d(m,(C,D)=>{switch(D.type){case"month":{const v=E=>ia(i,E,i.formats.month,D.format);return y(C,D,i.formats.month,v)}case"weekDay":{const v=(E,A)=>A.indexOf(E).toString();return y(C,D,i.formats.weekday,v)}case"meridiem":return y(C,D);default:return{saveQuery:!1}}})},p=m=>{const f=(b,C)=>{const D=Ss(b,s),v=Number(D),E=t[C.type]({currentDate:null,format:C.format,contentType:C.contentType});if(v>E.maximum)return{saveQuery:!1};if(v<E.minimum)return{saveQuery:!0};const A=v*10>E.maximum||D.length===E.maximum.toString().length;return{sectionValue:Ll(i,v,E,s,C),shouldGoToNextSection:A}};return d(m,(b,C)=>{if(C.contentType==="digit"||C.contentType==="digit-with-letter")return f(b,C);if(C.type==="month"){Vl(i,"digit","month","MM");const D=f(b,{type:C.type,format:"MM",hasLeadingZerosInInput:!0,contentType:"digit",maxLength:2});if(Os(D))return D;const v=ia(i,D.sectionValue,"MM",C.format);return k({},D,{sectionValue:v})}if(C.type==="weekDay"){const D=f(b,C);if(Os(D))return D;const v=Wr(i,C.format)[Number(D.sectionValue)-1];return k({},D,{sectionValue:v})}return{saveQuery:!1}},b=>oa(b,s))};return{applyCharacterEditing:ce(m=>{const f=n[m.sectionIndex],b=oa(m.keyPressed,s)?p(k({},m,{keyPressed:Di(m.keyPressed,s)})):h(m);if(b==null){r(null);return}e({activeSection:f,newSectionValue:b.sectionValue,shouldGoToNextSection:b.shouldGoToNextSection})}),resetCharacterQuery:u}},qf=n=>{const{internalProps:{disabled:e,readOnly:t=!1},forwardedProps:{sectionListRef:s,onBlur:r,onClick:o,onFocus:i,onInput:a,onPaste:l,focused:u,autoFocus:d=!1},fieldValueManager:h,applyCharacterEditing:p,resetCharacterQuery:g,setSelectedSections:m,parsedSelectedSections:f,state:y,clearActiveSection:b,clearValue:C,updateSectionValue:D,updateValueFromValueStr:v,sectionOrder:E,areAllSectionsEmpty:A,sectionsValueBoundaries:S}=n,T=De(null),N=ut(s,T),V=nt(),_=Ee(),$=tn(),[j,U]=Dt(!1),R=he(()=>({syncSelectionToDOM:()=>{if(!T.current)return;const L=document.getSelection();if(!L)return;if(f==null){L.rangeCount>0&&T.current.getRoot().contains(L.getRangeAt(0).startContainer)&&L.removeAllRanges(),j&&T.current.getRoot().blur();return}if(!T.current.getRoot().contains(ot(document)))return;const Z=new window.Range;let te;f==="all"?te=T.current.getRoot():y.sections[f].type==="empty"?te=T.current.getSectionContainer(f):te=T.current.getSectionContent(f),Z.selectNodeContents(te),te.focus(),L.removeAllRanges(),L.addRange(Z)},getActiveSectionIndexFromDOM:()=>{const L=ot(document);return!L||!T.current||!T.current.getRoot().contains(L)?null:T.current.getSectionIndexFromDOMElement(L)},focusField:(L=0)=>{if(!T.current||R.getActiveSectionIndexFromDOM()!=null)return;const Z=Uo(L,y.sections);U(!0),T.current.getSectionContent(Z).focus()},setSelectedSections:L=>{if(!T.current)return;const Z=Uo(L,y.sections);U((Z==="all"?0:Z)!==null),m(L)},isFieldFocused:()=>{const L=ot(document);return!!T.current&&T.current.getRoot().contains(L)}}),[f,m,y.sections,j]),K=ce(L=>{if(!T.current)return;const Z=y.sections[L];T.current.getSectionContent(L).innerHTML=Z.value||Z.placeholder,R.syncSelectionToDOM()}),ae=ce((L,...Z)=>{L.isDefaultPrevented()||!T.current||(U(!0),o==null||o(L,...Z),f==="all"?setTimeout(()=>{const te=document.getSelection().getRangeAt(0).startOffset;if(te===0){m(E.startIndex);return}let q=0,H=0;for(;H<te&&q<y.sections.length;){const G=y.sections[q];q+=1,H+=`${G.startSeparator}${G.value||G.placeholder}${G.endSeparator}`.length}m(q-1)}):j?T.current.getRoot().contains(L.target)||m(E.startIndex):(U(!0),m(E.startIndex)))}),se=ce(L=>{if(a==null||a(L),!T.current||f!=="all")return;const te=L.target.textContent??"";T.current.getRoot().innerHTML=y.sections.map(q=>`${q.startSeparator}${q.value||q.placeholder}${q.endSeparator}`).join(""),R.syncSelectionToDOM(),te.length===0||te.charCodeAt(0)===10?(g(),C(),m("all")):te.length>1?v(te):(f==="all"&&m(0),p({keyPressed:te,sectionIndex:0}))}),de=ce(L=>{if(l==null||l(L),t||f!=="all"){L.preventDefault();return}const Z=L.clipboardData.getData("text");L.preventDefault(),g(),v(Z)}),ie=ce((...L)=>{if(i==null||i(...L),j||!T.current)return;U(!0),T.current.getSectionIndexFromDOMElement(ot(document))!=null||m(E.startIndex)}),P=ce((...L)=>{r==null||r(...L),setTimeout(()=>{if(!T.current)return;const Z=ot(document);!T.current.getRoot().contains(Z)&&(U(!1),m(null))})}),M=ce(L=>Z=>{Z.isDefaultPrevented()||m(L)}),O=ce(L=>{L.preventDefault()}),B=ce(L=>()=>{m(L)}),Y=ce(L=>{if(L.preventDefault(),t||e||typeof f!="number")return;const Z=y.sections[f],te=L.clipboardData.getData("text"),q=/^[a-zA-Z]+$/.test(te),H=/^[0-9]+$/.test(te),G=/^(([a-zA-Z]+)|)([0-9]+)(([a-zA-Z]+)|)$/.test(te);Z.contentType==="letter"&&q||Z.contentType==="digit"&&H||Z.contentType==="digit-with-letter"&&G?(g(),D({activeSection:Z,newSectionValue:te,shouldGoToNextSection:!0})):!q&&!H&&(g(),v(te))}),ne=ce(L=>{L.preventDefault(),L.dataTransfer.dropEffect="none"}),ee=ce(L=>{if(!T.current)return;const Z=L.target,te=Z.textContent??"",q=T.current.getSectionIndexFromDOMElement(Z),H=y.sections[q];if(t||!T.current){K(q);return}if(te.length===0){if(H.value===""){K(q);return}const G=L.nativeEvent.inputType;if(G==="insertParagraph"||G==="insertLineBreak"){K(q);return}g(),b();return}p({keyPressed:te,sectionIndex:q}),K(q)});Kt(()=>{if(!(!j||!T.current)){if(f==="all")T.current.getRoot().focus();else if(typeof f=="number"){const L=T.current.getSectionContent(f);L&&L.focus()}}},[f,j]);const z=he(()=>y.sections.reduce((L,Z)=>(L[Z.type]=S[Z.type]({currentDate:null,contentType:Z.contentType,format:Z.format}),L),{}),[S,y.sections]),J=f==="all",ue=he(()=>y.sections.map((L,Z)=>{const te=!J&&!e&&!t;return{container:{"data-sectionindex":Z,onClick:M(Z)},content:{tabIndex:J||Z>0?-1:0,contentEditable:!J&&!e&&!t,role:"spinbutton",id:`${$}-${L.type}`,"aria-labelledby":`${$}-${L.type}`,"aria-readonly":t,"aria-valuenow":sf(L,_),"aria-valuemin":z[L.type].minimum,"aria-valuemax":z[L.type].maximum,"aria-valuetext":L.value?tf(L,_):V.empty,"aria-label":V[L.type],"aria-disabled":e,spellCheck:te?!1:void 0,autoCapitalize:te?"off":void 0,autoCorrect:te?"off":void 0,[parseInt(Cu,10)>=17?"enterKeyHint":"enterkeyhint"]:te?"next":void 0,children:L.value||L.placeholder,onInput:ee,onPaste:Y,onFocus:B(Z),onDragOver:ne,onMouseUp:O,inputMode:L.contentType==="letter"?"text":"numeric"},before:{children:L.startSeparator},after:{children:L.endSeparator}}}),[y.sections,B,Y,ne,ee,M,O,e,t,J,V,_,z,$]),le=ce(L=>{v(L.target.value)}),re=he(()=>A?"":h.getV7HiddenInputValueFromSections(y.sections),[A,y.sections,h]);return Oe(()=>{if(T.current==null)throw new Error(["MUI X: The `sectionListRef` prop has not been initialized by `PickersSectionList`","You probably tried to pass a component to the `textField` slot that contains an `<input />` element instead of a `PickersSectionList`.","","If you want to keep using an `<input />` HTML element for the editing, please remove the `enableAccessibleFieldDOMStructure` prop from your picker or field component:","","<DatePicker slots={{ textField: MyCustomTextField }} />","","Learn more about the field accessible DOM structure on the MUI documentation: https://mui.com/x/react-date-pickers/fields/#fields-to-edit-a-single-element"].join(`
`));d&&T.current&&T.current.getSectionContent(E.startIndex).focus()},[]),{interactions:R,returnedValue:{autoFocus:d,readOnly:t,focused:u??j,sectionListRef:N,onBlur:P,onClick:ae,onFocus:ie,onInput:se,onPaste:de,enableAccessibleFieldDOMStructure:!0,elements:ue,tabIndex:f===0?-1:0,contentEditable:J,value:re,onChange:le,areAllSectionsEmpty:A}}},Vs=n=>n.replace(/[\u2066\u2067\u2068\u2069]/g,""),Yf=(n,e,t)=>{let s=0,r=t?1:0;const o=[];for(let i=0;i<n.length;i+=1){const a=n[i],l=vi(a,t?"input-rtl":"input-ltr",e),u=`${a.startSeparator}${l}${a.endSeparator}`,d=Vs(u).length,h=u.length,p=Vs(l),g=r+(p===""?0:l.indexOf(p[0]))+a.startSeparator.length,m=g+p.length;o.push(k({},a,{start:s,end:s+d,startInInput:g,endInInput:m})),s+=d,r+=h}return o},Gf=n=>{const e=It(),t=De(void 0),s=De(void 0),{forwardedProps:{onFocus:r,onClick:o,onPaste:i,onBlur:a,inputRef:l,placeholder:u},internalProps:{readOnly:d=!1,disabled:h=!1},parsedSelectedSections:p,activeSectionIndex:g,state:m,fieldValueManager:f,valueManager:y,applyCharacterEditing:b,resetCharacterQuery:C,updateSectionValue:D,updateValueFromValueStr:v,clearActiveSection:E,clearValue:A,setTempAndroidValueStr:S,setSelectedSections:T,getSectionsFromValue:N,areAllSectionsEmpty:V,localizedDigits:_}=n,$=De(null),j=ut(l,$),U=he(()=>Yf(m.sections,_,e),[m.sections,_,e]),R=he(()=>({syncSelectionToDOM:()=>{if(!$.current)return;if(p==null){$.current.scrollLeft&&($.current.scrollLeft=0);return}if($.current!==ot(document))return;const ee=$.current.scrollTop;if(p==="all")$.current.select();else{const z=U[p],J=z.type==="empty"?z.startInInput-z.startSeparator.length:z.startInInput,ue=z.type==="empty"?z.endInInput+z.endSeparator.length:z.endInInput;(J!==$.current.selectionStart||ue!==$.current.selectionEnd)&&$.current===ot(document)&&$.current.setSelectionRange(J,ue),clearTimeout(s.current),s.current=setTimeout(()=>{$.current&&$.current===ot(document)&&$.current.selectionStart===$.current.selectionEnd&&($.current.selectionStart!==J||$.current.selectionEnd!==ue)&&R.syncSelectionToDOM()})}$.current.scrollTop=ee},getActiveSectionIndexFromDOM:()=>{const ee=$.current.selectionStart??0,z=$.current.selectionEnd??0;if(ee===0&&z===0)return null;const J=ee<=U[0].startInInput?1:U.findIndex(ue=>ue.startInInput-ue.startSeparator.length>ee);return J===-1?U.length-1:J-1},focusField:(ee=0)=>{var z;ot(document)!==$.current&&((z=$.current)==null||z.focus(),T(ee))},setSelectedSections:ee=>T(ee),isFieldFocused:()=>$.current===ot(document)}),[$,p,U,T]),K=()=>{const ee=$.current.selectionStart??0;let z;ee<=U[0].startInInput||ee>=U[U.length-1].endInInput?z=1:z=U.findIndex(ue=>ue.startInInput-ue.startSeparator.length>ee);const J=z===-1?U.length-1:z-1;T(J)},ae=ce((...ee)=>{r==null||r(...ee);const z=$.current;clearTimeout(t.current),t.current=setTimeout(()=>{!z||z!==$.current||g==null&&(z.value.length&&Number(z.selectionEnd)-Number(z.selectionStart)===z.value.length?T("all"):K())})}),se=ce((ee,...z)=>{ee.isDefaultPrevented()||(o==null||o(ee,...z),K())}),de=ce(ee=>{if(i==null||i(ee),ee.preventDefault(),d||h)return;const z=ee.clipboardData.getData("text");if(typeof p=="number"){const J=m.sections[p],ue=/^[a-zA-Z]+$/.test(z),le=/^[0-9]+$/.test(z),re=/^(([a-zA-Z]+)|)([0-9]+)(([a-zA-Z]+)|)$/.test(z);if(J.contentType==="letter"&&ue||J.contentType==="digit"&&le||J.contentType==="digit-with-letter"&&re){C(),D({activeSection:J,newSectionValue:z,shouldGoToNextSection:!0});return}if(ue||le)return}C(),v(z)}),ie=ce((...ee)=>{a==null||a(...ee),T(null)}),P=ce(ee=>{if(d)return;const z=ee.target.value;if(z===""){C(),A();return}const J=ee.nativeEvent.data,ue=J&&J.length>1,le=ue?J:z,re=Vs(le);if(p==="all"&&T(g),g==null||ue){v(ue?J:re);return}let L;if(p==="all"&&re.length===1)L=re;else{const Z=Vs(f.getV6InputValueFromSections(U,_,e));let te=-1,q=-1;for(let oe=0;oe<Z.length;oe+=1)te===-1&&Z[oe]!==re[oe]&&(te=oe),q===-1&&Z[Z.length-oe-1]!==re[re.length-oe-1]&&(q=oe);const H=U[g];if(te<H.start||Z.length-q-1>H.end)return;const Q=re.length-Z.length+H.end-Vs(H.endSeparator||"").length;L=re.slice(H.start+Vs(H.startSeparator||"").length,Q)}if(L.length===0){Zp()&&S(le),C(),E();return}b({keyPressed:L,sectionIndex:g})}),M=he(()=>u!==void 0?u:f.getV6InputValueFromSections(N(y.emptyValue),_,e),[u,f,N,y.emptyValue,_,e]),O=he(()=>m.tempValueStrAndroid??f.getV6InputValueFromSections(m.sections,_,e),[m.sections,f,m.tempValueStrAndroid,_,e]);Oe(()=>($.current&&$.current===ot(document)&&T("all"),()=>{clearTimeout(t.current),clearTimeout(s.current)}),[]);const B=he(()=>g==null||m.sections[g].contentType==="letter"?"text":"numeric",[g,m.sections]),ne=!($.current&&$.current===ot(document))&&V;return{interactions:R,returnedValue:{readOnly:d,onBlur:ie,onClick:se,onFocus:ae,onPaste:de,inputRef:j,enableAccessibleFieldDOMStructure:!1,placeholder:M,inputMode:B,autoComplete:"off",value:ne?"":O,onChange:P}}},Jl=n=>{const e=Ee(),{internalProps:t,internalProps:{unstableFieldRef:s,minutesStep:r,enableAccessibleFieldDOMStructure:o=!1,disabled:i=!1,readOnly:a=!1},forwardedProps:{onKeyDown:l,error:u,clearable:d,onClear:h},fieldValueManager:p,valueManager:g,validator:m}=n,f=It(),y=Hf(n),{state:b,activeSectionIndex:C,parsedSelectedSections:D,setSelectedSections:v,clearValue:E,clearActiveSection:A,updateSectionValue:S,setTempAndroidValueStr:T,sectionsValueBoundaries:N,localizedDigits:V,timezone:_}=y,$=Kf({sections:b.sections,updateSectionValue:S,sectionsValueBoundaries:N,localizedDigits:V,setTempAndroidValueStr:T,timezone:_}),{resetCharacterQuery:j}=$,U=g.areValuesEqual(e,b.value,g.emptyValue),R=o?qf:Gf,K=he(()=>ef(b.sections,f&&!o),[b.sections,f,o]),{returnedValue:ae,interactions:se}=R(k({},n,y,$,{areAllSectionsEmpty:U,sectionOrder:K})),de=ce(Y=>{if(l==null||l(Y),!i)switch(!0){case((Y.ctrlKey||Y.metaKey)&&String.fromCharCode(Y.keyCode)==="A"&&!Y.shiftKey&&!Y.altKey):{Y.preventDefault(),v("all");break}case Y.key==="ArrowRight":{if(Y.preventDefault(),D==null)v(K.startIndex);else if(D==="all")v(K.endIndex);else{const ne=K.neighbors[D].rightIndex;ne!==null&&v(ne)}break}case Y.key==="ArrowLeft":{if(Y.preventDefault(),D==null)v(K.endIndex);else if(D==="all")v(K.startIndex);else{const ne=K.neighbors[D].leftIndex;ne!==null&&v(ne)}break}case Y.key==="Delete":{if(Y.preventDefault(),a)break;D==null||D==="all"?E():A(),j();break}case["ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(Y.key):{if(Y.preventDefault(),a||C==null)break;D==="all"&&v(C);const ne=b.sections[C],ee=p.getActiveDateManager(e,b,ne),z=Jp(e,_,ne,Y.key,N,V,ee.date,{minutesStep:r});S({activeSection:ne,newSectionValue:z,shouldGoToNextSection:!1});break}}});Kt(()=>{se.syncSelectionToDOM()});const{hasValidationError:ie}=Hl({props:t,validator:m,timezone:_,value:b.value,onError:t.onError}),P=he(()=>u!==void 0?u:ie,[ie,u]);Oe(()=>{!P&&C==null&&j()},[b.referenceValue,C,P]),Oe(()=>{b.tempValueStrAndroid!=null&&C!=null&&(j(),A())},[b.sections]),qa(s,()=>({getSections:()=>b.sections,getActiveSectionIndex:se.getActiveSectionIndexFromDOM,setSelectedSections:se.setSelectedSections,focusField:se.focusField,isFieldFocused:se.isFieldFocused}));const M=ce((Y,...ne)=>{Y.preventDefault(),h==null||h(Y,...ne),E(),se.isFieldFocused()?v(K.startIndex):se.focusField(0)}),O={onKeyDown:de,onClear:M,error:P,clearable:!!(d&&!U&&!a&&!i)},B={disabled:i,readOnly:a};return k({},n.forwardedProps,O,B,ae)},Qf=["clearable","onClear","InputProps","sx","slots","slotProps"],Xf=["ownerState"],Kl=n=>{const e=nt(),{clearable:t,onClear:s,InputProps:r,sx:o,slots:i,slotProps:a}=n,l=pe(n,Qf),u=(i==null?void 0:i.clearButton)??sn,d=ke({elementType:u,externalSlotProps:a==null?void 0:a.clearButton,ownerState:{},className:"clearButton",additionalProps:{title:e.fieldClearLabel}}),h=pe(d,Xf),p=(i==null?void 0:i.clearIcon)??Yd,g=ke({elementType:p,externalSlotProps:a==null?void 0:a.clearIcon,ownerState:{}});return k({},l,{InputProps:k({},r,{endAdornment:I.jsxs(Jt,{children:[t&&I.jsx(yl,{position:"end",sx:{marginRight:r!=null&&r.endAdornment?-1:-1.5},children:I.jsx(u,k({},h,{onClick:s,children:I.jsx(p,k({fontSize:"small"},g))}))}),r==null?void 0:r.endAdornment]})}),sx:[{"& .clearButton":{opacity:1},"@media (pointer: fine)":{"& .clearButton":{opacity:0},"&:hover, &:focus-within":{".clearButton":{opacity:1}}}},...Array.isArray(o)?o:[o]]})},Zf=["value","defaultValue","referenceDate","format","formatDensity","onChange","timezone","onError","shouldRespectLeadingZeros","selectedSections","onSelectedSectionsChange","unstableFieldRef","enableAccessibleFieldDOMStructure","disabled","readOnly","dateSeparator"],ql=(n,e)=>he(()=>{const t=k({},n),s={},r=o=>{t.hasOwnProperty(o)&&(s[o]=t[o],delete t[o])};return Zf.forEach(r),e==="date"?Wo.forEach(r):e==="time"?zo.forEach(r):e==="date-time"&&(Wo.forEach(r),zo.forEach(r),zl.forEach(r)),{forwardedProps:t,internalProps:s}},[n,e]),em=Qo(null);function Yl(n){const{contextValue:e,localeText:t,children:s}=n;return I.jsx(em.Provider,{value:e,children:I.jsx(Rd,{localeText:t,children:s})})}const tm=n=>{const e=Ee(),t=Un();return k({},n,{disablePast:n.disablePast??!1,disableFuture:n.disableFuture??!1,format:n.format??e.formats.keyboardDate,minDate:vt(e,n.minDate,t.minDate),maxDate:vt(e,n.maxDate,t.maxDate)})},sm=n=>{const e=Ee(),s=n.ampm??e.is12HourCycleInCurrentLocale()?e.formats.fullTime12h:e.formats.fullTime24h;return k({},n,{disablePast:n.disablePast??!1,disableFuture:n.disableFuture??!1,format:n.format??s})},nm=n=>{const e=tm(n),{forwardedProps:t,internalProps:s}=ql(e,"date");return Jl({forwardedProps:t,internalProps:s,valueManager:tt,fieldValueManager:Rl,validator:Hn,valueType:"date"})};function rm(n){return Ae("MuiPickersTextField",n)}Fe("MuiPickersTextField",["root","focused","disabled","error","required"]);function om(n){return Ae("MuiPickersInputBase",n)}const zs=Fe("MuiPickersInputBase",["root","focused","disabled","error","notchedOutline","sectionContent","sectionBefore","sectionAfter","adornedStart","adornedEnd","input"]);function im(n){return Ae("MuiPickersSectionList",n)}const pn=Fe("MuiPickersSectionList",["root","section","sectionContent"]),am=["slots","slotProps","elements","sectionListRef"],Gl=X("div",{name:"MuiPickersSectionList",slot:"Root",overridesResolver:(n,e)=>e.root})({direction:"ltr /*! @noflip */",outline:"none"}),Ql=X("span",{name:"MuiPickersSectionList",slot:"Section",overridesResolver:(n,e)=>e.section})({}),Xl=X("span",{name:"MuiPickersSectionList",slot:"SectionSeparator",overridesResolver:(n,e)=>e.sectionSeparator})({whiteSpace:"pre"}),Zl=X("span",{name:"MuiPickersSectionList",slot:"SectionContent",overridesResolver:(n,e)=>e.sectionContent})({outline:"none"}),lm=n=>{const{classes:e}=n;return Se({root:["root"],section:["section"],sectionContent:["sectionContent"]},im,e)};function cm(n){const{slots:e,slotProps:t,element:s,classes:r}=n,o=(e==null?void 0:e.section)??Ql,i=ke({elementType:o,externalSlotProps:t==null?void 0:t.section,externalForwardedProps:s.container,className:r.section,ownerState:{}}),a=(e==null?void 0:e.sectionContent)??Zl,l=ke({elementType:a,externalSlotProps:t==null?void 0:t.sectionContent,externalForwardedProps:s.content,additionalProps:{suppressContentEditableWarning:!0},className:r.sectionContent,ownerState:{}}),u=(e==null?void 0:e.sectionSeparator)??Xl,d=ke({elementType:u,externalSlotProps:t==null?void 0:t.sectionSeparator,externalForwardedProps:s.before,ownerState:{position:"before"}}),h=ke({elementType:u,externalSlotProps:t==null?void 0:t.sectionSeparator,externalForwardedProps:s.after,ownerState:{position:"after"}});return I.jsxs(o,k({},i,{children:[I.jsx(u,k({},d)),I.jsx(a,k({},l)),I.jsx(u,k({},h))]}))}const um=Te(function(e,t){const s=ve({props:e,name:"MuiPickersSectionList"}),{slots:r,slotProps:o,elements:i,sectionListRef:a}=s,l=pe(s,am),u=lm(s),d=De(null),h=ut(t,d),p=f=>{if(!d.current)throw new Error(`MUI X: Cannot call sectionListRef.${f} before the mount of the component.`);return d.current};qa(a,()=>({getRoot(){return p("getRoot")},getSectionContainer(f){return p("getSectionContainer").querySelector(`.${pn.section}[data-sectionindex="${f}"]`)},getSectionContent(f){return p("getSectionContent").querySelector(`.${pn.section}[data-sectionindex="${f}"] .${pn.sectionContent}`)},getSectionIndexFromDOMElement(f){const y=p("getSectionIndexFromDOMElement");if(f==null||!y.contains(f))return null;let b=null;return f.classList.contains(pn.section)?b=f:f.classList.contains(pn.sectionContent)&&(b=f.parentElement),b==null?null:Number(b.dataset.sectionindex)}}));const g=(r==null?void 0:r.root)??Gl,m=ke({elementType:g,externalSlotProps:o==null?void 0:o.root,externalForwardedProps:l,additionalProps:{ref:h,suppressContentEditableWarning:!0},className:u.root,ownerState:{}});return I.jsx(g,k({},m,{children:m.contentEditable?i.map(({content:f,before:y,after:b})=>`${y.children}${f.children}${b.children}`).join(""):I.jsx(Jt,{children:i.map((f,y)=>I.jsx(cm,{slots:r,slotProps:o,element:f,classes:u},y))})}))}),hm=["elements","areAllSectionsEmpty","defaultValue","label","value","onChange","id","autoFocus","endAdornment","startAdornment","renderSuffix","slots","slotProps","contentEditable","tabIndex","onInput","onPaste","onKeyDown","fullWidth","name","readOnly","inputProps","inputRef","sectionListRef"],dm=n=>Math.round(n*1e5)/1e5,Jr=X("div",{name:"MuiPickersInputBase",slot:"Root",overridesResolver:(n,e)=>e.root})(({theme:n})=>k({},n.typography.body1,{color:(n.vars||n).palette.text.primary,cursor:"text",padding:0,display:"flex",justifyContent:"flex-start",alignItems:"center",position:"relative",boxSizing:"border-box",letterSpacing:`${dm(.15/16)}em`,variants:[{props:{fullWidth:!0},style:{width:"100%"}}]})),Ei=X(Gl,{name:"MuiPickersInputBase",slot:"SectionsContainer",overridesResolver:(n,e)=>e.sectionsContainer})(({theme:n})=>({padding:"4px 0 5px",fontFamily:n.typography.fontFamily,fontSize:"inherit",lineHeight:"1.4375em",flexGrow:1,outline:"none",display:"flex",flexWrap:"nowrap",overflow:"hidden",letterSpacing:"inherit",width:"182px",variants:[{props:{isRtl:!0},style:{textAlign:"right /*! @noflip */"}},{props:{size:"small"},style:{paddingTop:1}},{props:{adornedStart:!1,focused:!1,filled:!1},style:{color:"currentColor",opacity:0}},{props:({adornedStart:e,focused:t,filled:s,label:r})=>!e&&!t&&!s&&r==null,style:n.vars?{opacity:n.vars.opacity.inputPlaceholder}:{opacity:n.palette.mode==="light"?.42:.5}}]})),pm=X(Ql,{name:"MuiPickersInputBase",slot:"Section",overridesResolver:(n,e)=>e.section})(({theme:n})=>({fontFamily:n.typography.fontFamily,fontSize:"inherit",letterSpacing:"inherit",lineHeight:"1.4375em",display:"inline-block",whiteSpace:"nowrap"})),fm=X(Zl,{name:"MuiPickersInputBase",slot:"SectionContent",overridesResolver:(n,e)=>e.content})(({theme:n})=>({fontFamily:n.typography.fontFamily,lineHeight:"1.4375em",letterSpacing:"inherit",width:"fit-content",outline:"none"})),mm=X(Xl,{name:"MuiPickersInputBase",slot:"Separator",overridesResolver:(n,e)=>e.separator})(()=>({whiteSpace:"pre",letterSpacing:"inherit"})),gm=X("input",{name:"MuiPickersInputBase",slot:"Input",overridesResolver:(n,e)=>e.hiddenInput})(k({},Rh)),ym=n=>{const{focused:e,disabled:t,error:s,classes:r,fullWidth:o,readOnly:i,color:a,size:l,endAdornment:u,startAdornment:d}=n,h={root:["root",e&&!t&&"focused",t&&"disabled",i&&"readOnly",s&&"error",o&&"fullWidth",`color${Oh(a)}`,l==="small"&&"inputSizeSmall",!!d&&"adornedStart",!!u&&"adornedEnd"],notchedOutline:["notchedOutline"],input:["input"],sectionsContainer:["sectionsContainer"],sectionContent:["sectionContent"],sectionBefore:["sectionBefore"],sectionAfter:["sectionAfter"]};return Se(h,om,r)},xi=Te(function(e,t){const s=ve({props:e,name:"MuiPickersInputBase"}),{elements:r,areAllSectionsEmpty:o,value:i,onChange:a,id:l,endAdornment:u,startAdornment:d,renderSuffix:h,slots:p,slotProps:g,contentEditable:m,tabIndex:f,onInput:y,onPaste:b,onKeyDown:C,name:D,readOnly:v,inputProps:E,inputRef:A,sectionListRef:S}=s,T=pe(s,hm),N=De(null),V=ut(t,N),_=ut(E==null?void 0:E.ref,A),$=It(),j=Mr();if(!j)throw new Error("MUI X: PickersInputBase should always be used inside a PickersTextField component");const U=ie=>{var P;if(j.disabled){ie.stopPropagation();return}(P=j.onFocus)==null||P.call(j,ie)};Oe(()=>{j&&j.setAdornedStart(!!d)},[j,d]),Oe(()=>{j&&(o?j.onEmpty():j.onFilled())},[j,o]);const R=k({},s,j,{isRtl:$}),K=ym(R),ae=(p==null?void 0:p.root)||Jr,se=ke({elementType:ae,externalSlotProps:g==null?void 0:g.root,externalForwardedProps:T,additionalProps:{"aria-invalid":j.error,ref:V},className:K.root,ownerState:R}),de=(p==null?void 0:p.input)||Ei;return I.jsxs(ae,k({},se,{children:[d,I.jsx(um,{sectionListRef:S,elements:r,contentEditable:m,tabIndex:f,className:K.sectionsContainer,onFocus:U,onBlur:j.onBlur,onInput:y,onPaste:b,onKeyDown:C,slots:{root:de,section:pm,sectionContent:fm,sectionSeparator:mm},slotProps:{root:{ownerState:R},sectionContent:{className:zs.sectionContent},sectionSeparator:({position:ie})=>({className:ie==="before"?zs.sectionBefore:zs.sectionAfter})}}),u,h?h(k({},j)):null,I.jsx(gm,k({name:D,className:K.input,value:i,onChange:a,id:l,"aria-hidden":"true",tabIndex:-1,readOnly:v,required:j.required,disabled:j.disabled},E,{ref:_}))]}))});function bm(n){return Ae("MuiPickersOutlinedInput",n)}const St=k({},zs,Fe("MuiPickersOutlinedInput",["root","notchedOutline","input"])),Cm=["children","className","label","notched","shrink"],Dm=X("fieldset",{name:"MuiPickersOutlinedInput",slot:"NotchedOutline",overridesResolver:(n,e)=>e.notchedOutline})(({theme:n})=>{const e=n.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return{textAlign:"left",position:"absolute",bottom:0,right:0,top:-5,left:0,margin:0,padding:"0 8px",pointerEvents:"none",borderRadius:"inherit",borderStyle:"solid",borderWidth:1,overflow:"hidden",minWidth:"0%",borderColor:n.vars?`rgba(${n.vars.palette.common.onBackgroundChannel} / 0.23)`:e}}),ha=X("span")(({theme:n})=>({fontFamily:n.typography.fontFamily,fontSize:"inherit"})),vm=X("legend")(({theme:n})=>({float:"unset",width:"auto",overflow:"hidden",variants:[{props:{withLabel:!1},style:{padding:0,lineHeight:"11px",transition:n.transitions.create("width",{duration:150,easing:n.transitions.easing.easeOut})}},{props:{withLabel:!0},style:{display:"block",padding:0,height:11,fontSize:"0.75em",visibility:"hidden",maxWidth:.01,transition:n.transitions.create("max-width",{duration:50,easing:n.transitions.easing.easeOut}),whiteSpace:"nowrap","& > span":{paddingLeft:5,paddingRight:5,display:"inline-block",opacity:0,visibility:"visible"}}},{props:{withLabel:!0,notched:!0},style:{maxWidth:"100%",transition:n.transitions.create("max-width",{duration:100,easing:n.transitions.easing.easeOut,delay:50})}}]}));function wm(n){const{className:e,label:t}=n,s=pe(n,Cm),r=t!=null&&t!=="",o=k({},n,{withLabel:r});return I.jsx(Dm,k({"aria-hidden":!0,className:e},s,{ownerState:o,children:I.jsx(vm,{ownerState:o,children:r?I.jsx(ha,{children:t}):I.jsx(ha,{className:"notranslate",children:"​"})})}))}const Em=["label","autoFocus","ownerState","notched"],xm=X(Jr,{name:"MuiPickersOutlinedInput",slot:"Root",overridesResolver:(n,e)=>e.root})(({theme:n})=>{const e=n.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return{padding:"0 14px",borderRadius:(n.vars||n).shape.borderRadius,[`&:hover .${St.notchedOutline}`]:{borderColor:(n.vars||n).palette.text.primary},"@media (hover: none)":{[`&:hover .${St.notchedOutline}`]:{borderColor:n.vars?`rgba(${n.vars.palette.common.onBackgroundChannel} / 0.23)`:e}},[`&.${St.focused} .${St.notchedOutline}`]:{borderStyle:"solid",borderWidth:2},[`&.${St.disabled}`]:{[`& .${St.notchedOutline}`]:{borderColor:(n.vars||n).palette.action.disabled},"*":{color:(n.vars||n).palette.action.disabled}},[`&.${St.error} .${St.notchedOutline}`]:{borderColor:(n.vars||n).palette.error.main},variants:Object.keys((n.vars??n).palette).filter(t=>{var s;return((s=(n.vars??n).palette[t])==null?void 0:s.main)??!1}).map(t=>({props:{color:t},style:{[`&.${St.focused}:not(.${St.error}) .${St.notchedOutline}`]:{borderColor:(n.vars||n).palette[t].main}}}))}}),Sm=X(Ei,{name:"MuiPickersOutlinedInput",slot:"SectionsContainer",overridesResolver:(n,e)=>e.sectionsContainer})({padding:"16.5px 0",variants:[{props:{size:"small"},style:{padding:"8.5px 0"}}]}),km=n=>{const{classes:e}=n,s=Se({root:["root"],notchedOutline:["notchedOutline"],input:["input"]},bm,e);return k({},e,s)},ec=Te(function(e,t){const s=ve({props:e,name:"MuiPickersOutlinedInput"}),{label:r,ownerState:o,notched:i}=s,a=pe(s,Em),l=Mr(),u=k({},s,o,l,{color:(l==null?void 0:l.color)||"primary"}),d=km(u);return I.jsx(xi,k({slots:{root:xm,input:Sm},renderSuffix:h=>I.jsx(wm,{shrink:!!(i||h.adornedStart||h.focused||h.filled),notched:!!(i||h.adornedStart||h.focused||h.filled),className:d.notchedOutline,label:r!=null&&r!==""&&(l!=null&&l.required)?I.jsxs(Jt,{children:[r," ","*"]}):r,ownerState:u})},a,{label:r,classes:d,ref:t}))});ec.muiName="Input";function Tm(n,...e){const t=new URL(`https://mui.com/production-error/?code=${n}`);return e.forEach(s=>t.searchParams.append("args[]",s)),`Minified MUI error #${n}; visit ${t} for the full message.`}function Ls(n){if(typeof n!="object"||n===null)return!1;const e=Object.getPrototypeOf(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)}function tc(n){if(Ya(n)||pl.isValidElementType(n)||!Ls(n))return n;const e={};return Object.keys(n).forEach(t=>{e[t]=tc(n[t])}),e}function Fr(n,e,t={clone:!0}){const s=t.clone?{...n}:n;return Ls(n)&&Ls(e)&&Object.keys(e).forEach(r=>{Ya(e[r])||pl.isValidElementType(e[r])?s[r]=e[r]:Ls(e[r])&&Object.prototype.hasOwnProperty.call(n,r)&&Ls(n[r])?s[r]=Fr(n[r],e[r],t):t.clone?s[r]=Ls(e[r])?tc(e[r]):e[r]:s[r]=e[r]}),s}const Am=n=>{const e=Object.keys(n).map(t=>({key:t,val:n[t]}))||[];return e.sort((t,s)=>t.val-s.val),e.reduce((t,s)=>({...t,[s.key]:s.val}),{})};function Fm(n){const{values:e={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:t="px",step:s=5,...r}=n,o=Am(e),i=Object.keys(o);function a(p){return`@media (min-width:${typeof e[p]=="number"?e[p]:p}${t})`}function l(p){return`@media (max-width:${(typeof e[p]=="number"?e[p]:p)-s/100}${t})`}function u(p,g){const m=i.indexOf(g);return`@media (min-width:${typeof e[p]=="number"?e[p]:p}${t}) and (max-width:${(m!==-1&&typeof e[i[m]]=="number"?e[i[m]]:g)-s/100}${t})`}function d(p){return i.indexOf(p)+1<i.length?u(p,i[i.indexOf(p)+1]):a(p)}function h(p){const g=i.indexOf(p);return g===0?a(i[1]):g===i.length-1?l(i[g]):u(p,i[i.indexOf(p)+1]).replace("@media","@media not all and")}return{keys:i,values:o,up:a,down:l,between:u,only:d,not:h,unit:t,...r}}function da(n,e){if(!n.containerQueries)return e;const t=Object.keys(e).filter(s=>s.startsWith("@container")).sort((s,r)=>{var i,a;const o=/min-width:\s*([0-9.]+)/;return+(((i=s.match(o))==null?void 0:i[1])||0)-+(((a=r.match(o))==null?void 0:a[1])||0)});return t.length?t.reduce((s,r)=>{const o=e[r];return delete s[r],s[r]=o,s},{...e}):e}function Im(n,e){return e==="@"||e.startsWith("@")&&(n.some(t=>e.startsWith(`@${t}`))||!!e.match(/^@\d/))}function _m(n,e){const t=e.match(/^@([^/]+)?\/?(.+)?$/);if(!t)return null;const[,s,r]=t,o=Number.isNaN(+s)?s||0:+s;return n.containerQueries(r).up(o)}function Om(n){const e=(o,i)=>o.replace("@media",i?`@container ${i}`:"@container");function t(o,i){o.up=(...a)=>e(n.breakpoints.up(...a),i),o.down=(...a)=>e(n.breakpoints.down(...a),i),o.between=(...a)=>e(n.breakpoints.between(...a),i),o.only=(...a)=>e(n.breakpoints.only(...a),i),o.not=(...a)=>{const l=e(n.breakpoints.not(...a),i);return l.includes("not all and")?l.replace("not all and ","").replace("min-width:","width<").replace("max-width:","width>").replace("and","or"):l}}const s={},r=o=>(t(s,o),s);return t(r),{...n,containerQueries:r}}const Pm={borderRadius:4};function Tn(n,e){return e?Fr(n,e,{clone:!1}):n}const Kr={xs:0,sm:600,md:900,lg:1200,xl:1536},pa={keys:["xs","sm","md","lg","xl"],up:n=>`@media (min-width:${Kr[n]}px)`},Nm={containerQueries:n=>({up:e=>{let t=typeof e=="number"?e:Kr[e]||e;return typeof t=="number"&&(t=`${t}px`),n?`@container ${n} (min-width:${t})`:`@container (min-width:${t})`}})};function qt(n,e,t){const s=n.theme||{};if(Array.isArray(e)){const o=s.breakpoints||pa;return e.reduce((i,a,l)=>(i[o.up(o.keys[l])]=t(e[l]),i),{})}if(typeof e=="object"){const o=s.breakpoints||pa;return Object.keys(e).reduce((i,a)=>{if(Im(o.keys,a)){const l=_m(s.containerQueries?s:Nm,a);l&&(i[l]=t(e[a],a))}else if(Object.keys(o.values||Kr).includes(a)){const l=o.up(a);i[l]=t(e[a],a)}else{const l=a;i[l]=e[l]}return i},{})}return t(e)}function Bm(n={}){var t;return((t=n.keys)==null?void 0:t.reduce((s,r)=>{const o=n.up(r);return s[o]={},s},{}))||{}}function fa(n,e){return n.reduce((t,s)=>{const r=t[s];return(!r||Object.keys(r).length===0)&&delete t[s],t},e)}function sc(n){if(typeof n!="string")throw new Error(Tm(7));return n.charAt(0).toUpperCase()+n.slice(1)}function qr(n,e,t=!0){if(!e||typeof e!="string")return null;if(n&&n.vars&&t){const s=`vars.${e}`.split(".").reduce((r,o)=>r&&r[o]?r[o]:null,n);if(s!=null)return s}return e.split(".").reduce((s,r)=>s&&s[r]!=null?s[r]:null,n)}function Ir(n,e,t,s=t){let r;return typeof n=="function"?r=n(t):Array.isArray(n)?r=n[t]||s:r=qr(n,t)||s,e&&(r=e(r,s,n)),r}function Ge(n){const{prop:e,cssProperty:t=n.prop,themeKey:s,transform:r}=n,o=i=>{if(i[e]==null)return null;const a=i[e],l=i.theme,u=qr(l,s)||{};return qt(i,a,h=>{let p=Ir(u,r,h);return h===p&&typeof h=="string"&&(p=Ir(u,r,`${e}${h==="default"?"":sc(h)}`,h)),t===!1?p:{[t]:p}})};return o.propTypes={},o.filterProps=[e],o}function Mm(n){const e={};return t=>(e[t]===void 0&&(e[t]=n(t)),e[t])}const $m={m:"margin",p:"padding"},Lm={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},ma={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},Vm=Mm(n=>{if(n.length>2)if(ma[n])n=ma[n];else return[n];const[e,t]=n.split(""),s=$m[e],r=Lm[t]||"";return Array.isArray(r)?r.map(o=>s+o):[s+r]}),Si=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],ki=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"];[...Si,...ki];function Jn(n,e,t,s){const r=qr(n,e,!0)??t;return typeof r=="number"||typeof r=="string"?o=>typeof o=="string"?o:typeof r=="string"?r.startsWith("var(")&&o===0?0:r.startsWith("var(")&&o===1?r:`calc(${o} * ${r})`:r*o:Array.isArray(r)?o=>{if(typeof o=="string")return o;const i=Math.abs(o),a=r[i];return o>=0?a:typeof a=="number"?-a:typeof a=="string"&&a.startsWith("var(")?`calc(-1 * ${a})`:`-${a}`}:typeof r=="function"?r:()=>{}}function nc(n){return Jn(n,"spacing",8)}function Kn(n,e){return typeof e=="string"||e==null?e:n(e)}function Rm(n,e){return t=>n.reduce((s,r)=>(s[r]=Kn(e,t),s),{})}function jm(n,e,t,s){if(!e.includes(t))return null;const r=Vm(t),o=Rm(r,s),i=n[t];return qt(n,i,o)}function rc(n,e){const t=nc(n.theme);return Object.keys(n).map(s=>jm(n,e,s,t)).reduce(Tn,{})}function Ue(n){return rc(n,Si)}Ue.propTypes={};Ue.filterProps=Si;function We(n){return rc(n,ki)}We.propTypes={};We.filterProps=ki;function Um(n=8,e=nc({spacing:n})){if(n.mui)return n;const t=(...s)=>(s.length===0?[1]:s).map(o=>{const i=e(o);return typeof i=="number"?`${i}px`:i}).join(" ");return t.mui=!0,t}function Yr(...n){const e=n.reduce((s,r)=>(r.filterProps.forEach(o=>{s[o]=r}),s),{}),t=s=>Object.keys(s).reduce((r,o)=>e[o]?Tn(r,e[o](s)):r,{});return t.propTypes={},t.filterProps=n.reduce((s,r)=>s.concat(r.filterProps),[]),t}function yt(n){return typeof n!="number"?n:`${n}px solid`}function Et(n,e){return Ge({prop:n,themeKey:"borders",transform:e})}const Wm=Et("border",yt),zm=Et("borderTop",yt),Hm=Et("borderRight",yt),Jm=Et("borderBottom",yt),Km=Et("borderLeft",yt),qm=Et("borderColor"),Ym=Et("borderTopColor"),Gm=Et("borderRightColor"),Qm=Et("borderBottomColor"),Xm=Et("borderLeftColor"),Zm=Et("outline",yt),eg=Et("outlineColor"),Gr=n=>{if(n.borderRadius!==void 0&&n.borderRadius!==null){const e=Jn(n.theme,"shape.borderRadius",4),t=s=>({borderRadius:Kn(e,s)});return qt(n,n.borderRadius,t)}return null};Gr.propTypes={};Gr.filterProps=["borderRadius"];Yr(Wm,zm,Hm,Jm,Km,qm,Ym,Gm,Qm,Xm,Gr,Zm,eg);const Qr=n=>{if(n.gap!==void 0&&n.gap!==null){const e=Jn(n.theme,"spacing",8),t=s=>({gap:Kn(e,s)});return qt(n,n.gap,t)}return null};Qr.propTypes={};Qr.filterProps=["gap"];const Xr=n=>{if(n.columnGap!==void 0&&n.columnGap!==null){const e=Jn(n.theme,"spacing",8),t=s=>({columnGap:Kn(e,s)});return qt(n,n.columnGap,t)}return null};Xr.propTypes={};Xr.filterProps=["columnGap"];const Zr=n=>{if(n.rowGap!==void 0&&n.rowGap!==null){const e=Jn(n.theme,"spacing",8),t=s=>({rowGap:Kn(e,s)});return qt(n,n.rowGap,t)}return null};Zr.propTypes={};Zr.filterProps=["rowGap"];const tg=Ge({prop:"gridColumn"}),sg=Ge({prop:"gridRow"}),ng=Ge({prop:"gridAutoFlow"}),rg=Ge({prop:"gridAutoColumns"}),og=Ge({prop:"gridAutoRows"}),ig=Ge({prop:"gridTemplateColumns"}),ag=Ge({prop:"gridTemplateRows"}),lg=Ge({prop:"gridTemplateAreas"}),cg=Ge({prop:"gridArea"});Yr(Qr,Xr,Zr,tg,sg,ng,rg,og,ig,ag,lg,cg);function Hs(n,e){return e==="grey"?e:n}const ug=Ge({prop:"color",themeKey:"palette",transform:Hs}),hg=Ge({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:Hs}),dg=Ge({prop:"backgroundColor",themeKey:"palette",transform:Hs});Yr(ug,hg,dg);function dt(n){return n<=1&&n!==0?`${n*100}%`:n}const pg=Ge({prop:"width",transform:dt}),Ti=n=>{if(n.maxWidth!==void 0&&n.maxWidth!==null){const e=t=>{var r,o,i,a,l;const s=((i=(o=(r=n.theme)==null?void 0:r.breakpoints)==null?void 0:o.values)==null?void 0:i[t])||Kr[t];return s?((l=(a=n.theme)==null?void 0:a.breakpoints)==null?void 0:l.unit)!=="px"?{maxWidth:`${s}${n.theme.breakpoints.unit}`}:{maxWidth:s}:{maxWidth:dt(t)}};return qt(n,n.maxWidth,e)}return null};Ti.filterProps=["maxWidth"];const fg=Ge({prop:"minWidth",transform:dt}),mg=Ge({prop:"height",transform:dt}),gg=Ge({prop:"maxHeight",transform:dt}),yg=Ge({prop:"minHeight",transform:dt});Ge({prop:"size",cssProperty:"width",transform:dt});Ge({prop:"size",cssProperty:"height",transform:dt});const bg=Ge({prop:"boxSizing"});Yr(pg,Ti,fg,mg,gg,yg,bg);const oc={border:{themeKey:"borders",transform:yt},borderTop:{themeKey:"borders",transform:yt},borderRight:{themeKey:"borders",transform:yt},borderBottom:{themeKey:"borders",transform:yt},borderLeft:{themeKey:"borders",transform:yt},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:yt},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:Gr},color:{themeKey:"palette",transform:Hs},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:Hs},backgroundColor:{themeKey:"palette",transform:Hs},p:{style:We},pt:{style:We},pr:{style:We},pb:{style:We},pl:{style:We},px:{style:We},py:{style:We},padding:{style:We},paddingTop:{style:We},paddingRight:{style:We},paddingBottom:{style:We},paddingLeft:{style:We},paddingX:{style:We},paddingY:{style:We},paddingInline:{style:We},paddingInlineStart:{style:We},paddingInlineEnd:{style:We},paddingBlock:{style:We},paddingBlockStart:{style:We},paddingBlockEnd:{style:We},m:{style:Ue},mt:{style:Ue},mr:{style:Ue},mb:{style:Ue},ml:{style:Ue},mx:{style:Ue},my:{style:Ue},margin:{style:Ue},marginTop:{style:Ue},marginRight:{style:Ue},marginBottom:{style:Ue},marginLeft:{style:Ue},marginX:{style:Ue},marginY:{style:Ue},marginInline:{style:Ue},marginInlineStart:{style:Ue},marginInlineEnd:{style:Ue},marginBlock:{style:Ue},marginBlockStart:{style:Ue},marginBlockEnd:{style:Ue},displayPrint:{cssProperty:!1,transform:n=>({"@media print":{display:n}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:Qr},rowGap:{style:Zr},columnGap:{style:Xr},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:dt},maxWidth:{style:Ti},minWidth:{transform:dt},height:{transform:dt},maxHeight:{transform:dt},minHeight:{transform:dt},boxSizing:{},font:{themeKey:"font"},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}};function Cg(...n){const e=n.reduce((s,r)=>s.concat(Object.keys(r)),[]),t=new Set(e);return n.every(s=>t.size===Object.keys(s).length)}function Dg(n,e){return typeof n=="function"?n(e):n}function vg(){function n(t,s,r,o){const i={[t]:s,theme:r},a=o[t];if(!a)return{[t]:s};const{cssProperty:l=t,themeKey:u,transform:d,style:h}=a;if(s==null)return null;if(u==="typography"&&s==="inherit")return{[t]:s};const p=qr(r,u)||{};return h?h(i):qt(i,s,m=>{let f=Ir(p,d,m);return m===f&&typeof m=="string"&&(f=Ir(p,d,`${t}${m==="default"?"":sc(m)}`,m)),l===!1?f:{[l]:f}})}function e(t){const{sx:s,theme:r={},nested:o}=t||{};if(!s)return null;const i=r.unstable_sxConfig??oc;function a(l){let u=l;if(typeof l=="function")u=l(r);else if(typeof l!="object")return l;if(!u)return null;const d=Bm(r.breakpoints),h=Object.keys(d);let p=d;return Object.keys(u).forEach(g=>{const m=Dg(u[g],r);if(m!=null)if(typeof m=="object")if(i[g])p=Tn(p,n(g,m,r,i));else{const f=qt({theme:r},m,y=>({[g]:y}));Cg(f,m)?p[g]=e({sx:m,theme:r,nested:!0}):p=Tn(p,f)}else p=Tn(p,n(g,m,r,i))}),!o&&r.modularCssLayers?{"@layer sx":da(r,fa(h,p))}:da(r,fa(h,p))}return Array.isArray(s)?s.map(a):a(s)}return e}const ic=vg();ic.filterProps=["sx"];function wg(n,e){var s;const t=this;if(t.vars){if(!((s=t.colorSchemes)!=null&&s[n])||typeof t.getColorSchemeSelector!="function")return{};let r=t.getColorSchemeSelector(n);return r==="&"?e:((r.includes("data-")||r.includes("."))&&(r=`*:where(${r.replace(/\s*&$/,"")}) &`),{[r]:e})}return t.palette.mode===n?e:{}}function Eg(n={},...e){const{breakpoints:t={},palette:s={},spacing:r,shape:o={},...i}=n,a=Fm(t),l=Um(r);let u=Fr({breakpoints:a,direction:"ltr",components:{},palette:{mode:"light",...s},spacing:l,shape:{...Pm,...o}},i);return u=Om(u),u.applyStyles=wg,u=e.reduce((d,h)=>Fr(d,h),u),u.unstable_sxConfig={...oc,...i==null?void 0:i.unstable_sxConfig},u.unstable_sx=function(h){return ic({sx:h,theme:this})},u}Eg();function xg(n){return n!=="ownerState"&&n!=="theme"&&n!=="sx"&&n!=="as"}function Sg(n){return Ae("MuiPickersFilledInput",n)}const ps=k({},zs,Fe("MuiPickersFilledInput",["root","underline","input"])),kg=["label","autoFocus","disableUnderline","ownerState"],Tg=X(Jr,{name:"MuiPickersFilledInput",slot:"Root",overridesResolver:(n,e)=>e.root,shouldForwardProp:n=>xg(n)&&n!=="disableUnderline"})(({theme:n})=>{const e=n.palette.mode==="light",t=e?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)",s=e?"rgba(0, 0, 0, 0.06)":"rgba(255, 255, 255, 0.09)",r=e?"rgba(0, 0, 0, 0.09)":"rgba(255, 255, 255, 0.13)",o=e?"rgba(0, 0, 0, 0.12)":"rgba(255, 255, 255, 0.12)";return{backgroundColor:n.vars?n.vars.palette.FilledInput.bg:s,borderTopLeftRadius:(n.vars||n).shape.borderRadius,borderTopRightRadius:(n.vars||n).shape.borderRadius,transition:n.transitions.create("background-color",{duration:n.transitions.duration.shorter,easing:n.transitions.easing.easeOut}),"&:hover":{backgroundColor:n.vars?n.vars.palette.FilledInput.hoverBg:r,"@media (hover: none)":{backgroundColor:n.vars?n.vars.palette.FilledInput.bg:s}},[`&.${ps.focused}`]:{backgroundColor:n.vars?n.vars.palette.FilledInput.bg:s},[`&.${ps.disabled}`]:{backgroundColor:n.vars?n.vars.palette.FilledInput.disabledBg:o},variants:[...Object.keys((n.vars??n).palette).filter(i=>(n.vars??n).palette[i].main).map(i=>{var a;return{props:{color:i,disableUnderline:!1},style:{"&::after":{borderBottom:`2px solid ${(a=(n.vars||n).palette[i])==null?void 0:a.main}`}}}}),{props:{disableUnderline:!1},style:{"&::after":{left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:n.transitions.create("transform",{duration:n.transitions.duration.shorter,easing:n.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${ps.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${ps.error}`]:{"&:before, &:after":{borderBottomColor:(n.vars||n).palette.error.main}},"&::before":{borderBottom:`1px solid ${n.vars?`rgba(${n.vars.palette.common.onBackgroundChannel} / ${n.vars.opacity.inputUnderline})`:t}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:n.transitions.create("border-bottom-color",{duration:n.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${ps.disabled}, .${ps.error}):before`]:{borderBottom:`1px solid ${(n.vars||n).palette.text.primary}`},[`&.${ps.disabled}:before`]:{borderBottomStyle:"dotted"}}},{props:({startAdornment:i})=>!!i,style:{paddingLeft:12}},{props:({endAdornment:i})=>!!i,style:{paddingRight:12}}]}}),Ag=X(Ei,{name:"MuiPickersFilledInput",slot:"sectionsContainer",overridesResolver:(n,e)=>e.sectionsContainer})({paddingTop:25,paddingRight:12,paddingBottom:8,paddingLeft:12,variants:[{props:{size:"small"},style:{paddingTop:21,paddingBottom:4}},{props:({startAdornment:n})=>!!n,style:{paddingLeft:0}},{props:({endAdornment:n})=>!!n,style:{paddingRight:0}},{props:{hiddenLabel:!0},style:{paddingTop:16,paddingBottom:17}},{props:{hiddenLabel:!0,size:"small"},style:{paddingTop:8,paddingBottom:9}}]}),Fg=n=>{const{classes:e,disableUnderline:t}=n,r=Se({root:["root",!t&&"underline"],input:["input"]},Sg,e);return k({},e,r)},ac=Te(function(e,t){const s=ve({props:e,name:"MuiPickersFilledInput"}),{label:r,disableUnderline:o=!1,ownerState:i}=s,a=pe(s,kg),l=Mr(),u=k({},s,i,l,{color:(l==null?void 0:l.color)||"primary"}),d=Fg(u);return I.jsx(xi,k({slots:{root:Tg,input:Ag},slotProps:{root:{disableUnderline:o}}},a,{label:r,classes:d,ref:t}))});ac.muiName="Input";function Ig(n){return Ae("MuiPickersFilledInput",n)}const fn=k({},zs,Fe("MuiPickersInput",["root","input"])),_g=["label","autoFocus","disableUnderline","ownerState"],Og=X(Jr,{name:"MuiPickersInput",slot:"Root",overridesResolver:(n,e)=>e.root})(({theme:n})=>{let t=n.palette.mode==="light"?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)";return n.vars&&(t=`rgba(${n.vars.palette.common.onBackgroundChannel} / ${n.vars.opacity.inputUnderline})`),{"label + &":{marginTop:16},variants:[...Object.keys((n.vars??n).palette).filter(s=>(n.vars??n).palette[s].main).map(s=>({props:{color:s},style:{"&::after":{borderBottom:`2px solid ${(n.vars||n).palette[s].main}`}}})),{props:{disableUnderline:!1},style:{"&::after":{background:"red",left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:n.transitions.create("transform",{duration:n.transitions.duration.shorter,easing:n.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${fn.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${fn.error}`]:{"&:before, &:after":{borderBottomColor:(n.vars||n).palette.error.main}},"&::before":{borderBottom:`1px solid ${t}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:n.transitions.create("border-bottom-color",{duration:n.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${fn.disabled}, .${fn.error}):before`]:{borderBottom:`2px solid ${(n.vars||n).palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${t}`}},[`&.${fn.disabled}:before`]:{borderBottomStyle:"dotted"}}}]}}),Pg=n=>{const{classes:e,disableUnderline:t}=n,r=Se({root:["root",!t&&"underline"],input:["input"]},Ig,e);return k({},e,r)},lc=Te(function(e,t){const s=ve({props:e,name:"MuiPickersInput"}),{label:r,disableUnderline:o=!1,ownerState:i}=s,a=pe(s,_g),l=Mr(),u=k({},s,i,l,{disableUnderline:o,color:(l==null?void 0:l.color)||"primary"}),d=Pg(u);return I.jsx(xi,k({slots:{root:Og}},a,{label:r,classes:d,ref:t}))});lc.muiName="Input";const Ng=["onFocus","onBlur","className","color","disabled","error","variant","required","InputProps","inputProps","inputRef","sectionListRef","elements","areAllSectionsEmpty","onClick","onKeyDown","onKeyUp","onPaste","onInput","endAdornment","startAdornment","tabIndex","contentEditable","focused","value","onChange","fullWidth","id","name","helperText","FormHelperTextProps","label","InputLabelProps"],Bg={standard:lc,filled:ac,outlined:ec},Mg=X(Wh,{name:"MuiPickersTextField",slot:"Root",overridesResolver:(n,e)=>e.root})({maxWidth:"100%"}),$g=n=>{const{focused:e,disabled:t,classes:s,required:r}=n;return Se({root:["root",e&&!t&&"focused",t&&"disabled",r&&"required"]},rm,s)},cc=Te(function(e,t){const s=ve({props:e,name:"MuiPickersTextField"}),{onFocus:r,onBlur:o,className:i,color:a="primary",disabled:l=!1,error:u=!1,variant:d="outlined",required:h=!1,InputProps:p,inputProps:g,inputRef:m,sectionListRef:f,elements:y,areAllSectionsEmpty:b,onClick:C,onKeyDown:D,onKeyUp:v,onPaste:E,onInput:A,endAdornment:S,startAdornment:T,tabIndex:N,contentEditable:V,focused:_,value:$,onChange:j,fullWidth:U,id:R,name:K,helperText:ae,FormHelperTextProps:se,label:de,InputLabelProps:ie}=s,P=pe(s,Ng),M=De(null),O=ut(t,M),B=tn(R),Y=ae&&B?`${B}-helper-text`:void 0,ne=de&&B?`${B}-label`:void 0,ee=k({},s,{color:a,disabled:l,error:u,focused:_,required:h,variant:d}),z=$g(ee),J=Bg[d];return I.jsxs(Mg,k({className:Ie(z.root,i),ref:O,focused:_,onFocus:r,onBlur:o,disabled:l,variant:d,error:u,color:a,fullWidth:U,required:h,ownerState:ee},P,{children:[I.jsx(jh,k({htmlFor:B,id:ne},ie,{children:de})),I.jsx(J,k({elements:y,areAllSectionsEmpty:b,onClick:C,onKeyDown:D,onKeyUp:v,onInput:A,onPaste:E,endAdornment:S,startAdornment:T,tabIndex:N,contentEditable:V,value:$,onChange:j,id:B,fullWidth:U,inputProps:g,inputRef:m,sectionListRef:f,label:de,name:K,role:"group","aria-labelledby":ne,"aria-describedby":Y,"aria-live":Y?"polite":void 0},p)),ae&&I.jsx(Uh,k({id:Y},se,{children:ae}))]}))}),Lg=["enableAccessibleFieldDOMStructure"],Vg=["InputProps","readOnly"],Rg=["onPaste","onKeyDown","inputMode","readOnly","InputProps","inputProps","inputRef"],uc=n=>{let{enableAccessibleFieldDOMStructure:e}=n,t=pe(n,Lg);if(e){const{InputProps:h,readOnly:p}=t,g=pe(t,Vg);return k({},g,{InputProps:k({},h??{},{readOnly:p})})}const{onPaste:s,onKeyDown:r,inputMode:o,readOnly:i,InputProps:a,inputProps:l,inputRef:u}=t,d=pe(t,Rg);return k({},d,{InputProps:k({},a??{},{readOnly:i}),inputProps:k({},l??{},{inputMode:o,onPaste:s,onKeyDown:r,ref:u})})},jg=["slots","slotProps","InputProps","inputProps"],hc=Te(function(e,t){const s=ve({props:e,name:"MuiDateField"}),{slots:r,slotProps:o,InputProps:i,inputProps:a}=s,l=pe(s,jg),u=s,d=(r==null?void 0:r.textField)??(e.enableAccessibleFieldDOMStructure?cc:bl),h=ke({elementType:d,externalSlotProps:o==null?void 0:o.textField,externalForwardedProps:l,additionalProps:{ref:t},ownerState:u});h.inputProps=k({},a,h.inputProps),h.InputProps=k({},i,h.InputProps);const p=nm(h),g=uc(p),m=Kl(k({},g,{slots:r,slotProps:o}));return I.jsx(d,k({},m))}),Ug=n=>{const e=sm(n),{forwardedProps:t,internalProps:s}=ql(e,"time");return Jl({forwardedProps:t,internalProps:s,valueManager:tt,fieldValueManager:Rl,validator:zr,valueType:"time"})},Wg=["slots","slotProps","InputProps","inputProps"],dc=Te(function(e,t){const s=ve({props:e,name:"MuiTimeField"}),{slots:r,slotProps:o,InputProps:i,inputProps:a}=s,l=pe(s,Wg),u=s,d=(r==null?void 0:r.textField)??(e.enableAccessibleFieldDOMStructure?cc:bl),h=ke({elementType:d,externalSlotProps:o==null?void 0:o.textField,externalForwardedProps:l,ownerState:u,additionalProps:{ref:t}});h.inputProps=k({},a,h.inputProps),h.InputProps=k({},i,h.InputProps);const p=Ug(h),g=uc(p),m=Kl(k({},g,{slots:r,slotProps:o}));return I.jsx(d,k({},m))}),pc=({shouldDisableDate:n,shouldDisableMonth:e,shouldDisableYear:t,minDate:s,maxDate:r,disableFuture:o,disablePast:i,timezone:a})=>{const l=As();return pt(u=>Hn({adapter:l,value:u,timezone:a,props:{shouldDisableDate:n,shouldDisableMonth:e,shouldDisableYear:t,minDate:s,maxDate:r,disableFuture:o,disablePast:i}})!==null,[l,n,e,t,s,r,o,i,a])},zg=(n,e,t)=>(s,r)=>{switch(r.type){case"changeMonth":return k({},s,{slideDirection:r.direction,currentMonth:r.newMonth,isMonthSwitchingAnimating:!n});case"changeMonthTimezone":{const o=r.newTimezone;if(t.getTimezone(s.currentMonth)===o)return s;let i=t.setTimezone(s.currentMonth,o);return t.getMonth(i)!==t.getMonth(s.currentMonth)&&(i=t.setMonth(i,t.getMonth(s.currentMonth))),k({},s,{currentMonth:i})}case"finishMonthSwitchingAnimation":return k({},s,{isMonthSwitchingAnimating:!1});case"changeFocusedDay":{if(s.focusedDay!=null&&r.focusedDay!=null&&t.isSameDay(r.focusedDay,s.focusedDay))return s;const o=r.focusedDay!=null&&!e&&!t.isSameMonth(s.currentMonth,r.focusedDay);return k({},s,{focusedDay:r.focusedDay,isMonthSwitchingAnimating:o&&!n&&!r.withoutMonthSwitchingAnimation,currentMonth:o?t.startOfMonth(r.focusedDay):s.currentMonth,slideDirection:r.focusedDay!=null&&t.isAfterDay(r.focusedDay,s.currentMonth)?"left":"right"})}default:throw new Error("missing support")}},Hg=n=>{const{value:e,referenceDate:t,disableFuture:s,disablePast:r,disableSwitchToMonthOnDayFocus:o=!1,maxDate:i,minDate:a,onMonthChange:l,reduceAnimations:u,shouldDisableDate:d,timezone:h}=n,p=Ee(),g=De(zg(!!u,o,p)).current,m=he(()=>tt.getInitialReferenceValue({value:e,utils:p,timezone:h,props:n,referenceDate:t,granularity:At.day}),[t,h]),[f,y]=Du(g,{isMonthSwitchingAnimating:!1,focusedDay:m,currentMonth:p.startOfMonth(m),slideDirection:"left"});Oe(()=>{y({type:"changeMonthTimezone",newTimezone:p.getTimezone(m)})},[m,p]);const b=pt(A=>{y(k({type:"changeMonth"},A)),l&&l(A.newMonth)},[l]),C=pt(A=>{const S=A;p.isSameMonth(S,f.currentMonth)||b({newMonth:p.startOfMonth(S),direction:p.isAfterDay(S,f.currentMonth)?"left":"right"})},[f.currentMonth,b,p]),D=pc({shouldDisableDate:d,minDate:a,maxDate:i,disableFuture:s,disablePast:r,timezone:h}),v=pt(()=>{y({type:"finishMonthSwitchingAnimation"})},[]),E=ce((A,S)=>{D(A)||y({type:"changeFocusedDay",focusedDay:A,withoutMonthSwitchingAnimation:S})});return{referenceDate:m,calendarState:f,changeMonth:C,changeFocusedDay:E,isDateDisabled:D,onMonthSwitchingAnimationEnd:v,handleChangeMonth:b}},Jg=n=>Ae("MuiPickersFadeTransitionGroup",n);Fe("MuiPickersFadeTransitionGroup",["root"]);const Kg=n=>{const{classes:e}=n;return Se({root:["root"]},Jg,e)},qg=X(Cl,{name:"MuiPickersFadeTransitionGroup",slot:"Root",overridesResolver:(n,e)=>e.root})({display:"block",position:"relative"});function fc(n){const e=ve({props:n,name:"MuiPickersFadeTransitionGroup"}),{children:t,className:s,reduceAnimations:r,transKey:o}=e,i=Kg(e),a=Dl();return r?t:I.jsx(qg,{className:Ie(i.root,s),children:I.jsx($r,{appear:!1,mountOnEnter:!0,unmountOnExit:!0,timeout:{appear:a.transitions.duration.enteringScreen,enter:a.transitions.duration.enteringScreen,exit:0},children:t},o)})}const Yg=n=>Ae("MuiPickersSlideTransition",n),mt=Fe("MuiPickersSlideTransition",["root","slideEnter-left","slideEnter-right","slideEnterActive","slideExit","slideExitActiveLeft-left","slideExitActiveLeft-right"]),Gg=["children","className","reduceAnimations","slideDirection","transKey","classes"],Qg=n=>{const{classes:e,slideDirection:t}=n,s={root:["root"],exit:["slideExit"],enterActive:["slideEnterActive"],enter:[`slideEnter-${t}`],exitActive:[`slideExitActiveLeft-${t}`]};return Se(s,Yg,e)},Xg=X(Cl,{name:"MuiPickersSlideTransition",slot:"Root",overridesResolver:(n,e)=>[e.root,{[`.${mt["slideEnter-left"]}`]:e["slideEnter-left"]},{[`.${mt["slideEnter-right"]}`]:e["slideEnter-right"]},{[`.${mt.slideEnterActive}`]:e.slideEnterActive},{[`.${mt.slideExit}`]:e.slideExit},{[`.${mt["slideExitActiveLeft-left"]}`]:e["slideExitActiveLeft-left"]},{[`.${mt["slideExitActiveLeft-right"]}`]:e["slideExitActiveLeft-right"]}]})(({theme:n})=>{const e=n.transitions.create("transform",{duration:n.transitions.duration.complex,easing:"cubic-bezier(0.35, 0.8, 0.4, 1)"});return{display:"block",position:"relative",overflowX:"hidden","& > *":{position:"absolute",top:0,right:0,left:0},[`& .${mt["slideEnter-left"]}`]:{willChange:"transform",transform:"translate(100%)",zIndex:1},[`& .${mt["slideEnter-right"]}`]:{willChange:"transform",transform:"translate(-100%)",zIndex:1},[`& .${mt.slideEnterActive}`]:{transform:"translate(0%)",transition:e},[`& .${mt.slideExit}`]:{transform:"translate(0%)"},[`& .${mt["slideExitActiveLeft-left"]}`]:{willChange:"transform",transform:"translate(-100%)",transition:e,zIndex:0},[`& .${mt["slideExitActiveLeft-right"]}`]:{willChange:"transform",transform:"translate(100%)",transition:e,zIndex:0}}});function Zg(n){const e=ve({props:n,name:"MuiPickersSlideTransition"}),{children:t,className:s,reduceAnimations:r,transKey:o}=e,i=pe(e,Gg),a=Qg(e),l=Dl();if(r)return I.jsx("div",{className:Ie(a.root,s),children:t});const u={exit:a.exit,enterActive:a.enterActive,enter:a.enter,exitActive:a.exitActive};return I.jsx(Xg,{className:Ie(a.root,s),childFactory:d=>vu(d,{classNames:u}),role:"presentation",children:I.jsx(hi,k({mountOnEnter:!0,unmountOnExit:!0,timeout:l.transitions.duration.complex,classNames:u},i,{children:t}),o)})}const ey=n=>Ae("MuiDayCalendar",n);Fe("MuiDayCalendar",["root","header","weekDayLabel","loadingContainer","slideTransition","monthContainer","weekContainer","weekNumberLabel","weekNumber"]);const ty=["parentProps","day","focusableDay","selectedDays","isDateDisabled","currentMonthNumber","isViewFocused"],sy=["ownerState"],ny=n=>{const{classes:e}=n;return Se({root:["root"],header:["header"],weekDayLabel:["weekDayLabel"],loadingContainer:["loadingContainer"],slideTransition:["slideTransition"],monthContainer:["monthContainer"],weekContainer:["weekContainer"],weekNumberLabel:["weekNumberLabel"],weekNumber:["weekNumber"]},ey,e)},mc=($n+Rr*2)*6,ry=X("div",{name:"MuiDayCalendar",slot:"Root",overridesResolver:(n,e)=>e.root})({}),oy=X("div",{name:"MuiDayCalendar",slot:"Header",overridesResolver:(n,e)=>e.header})({display:"flex",justifyContent:"center",alignItems:"center"}),iy=X(ls,{name:"MuiDayCalendar",slot:"WeekDayLabel",overridesResolver:(n,e)=>e.weekDayLabel})(({theme:n})=>({width:36,height:40,margin:"0 2px",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",color:(n.vars||n).palette.text.secondary})),ay=X(ls,{name:"MuiDayCalendar",slot:"WeekNumberLabel",overridesResolver:(n,e)=>e.weekNumberLabel})(({theme:n})=>({width:36,height:40,margin:"0 2px",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",color:n.palette.text.disabled})),ly=X(ls,{name:"MuiDayCalendar",slot:"WeekNumber",overridesResolver:(n,e)=>e.weekNumber})(({theme:n})=>k({},n.typography.caption,{width:$n,height:$n,padding:0,margin:`0 ${Rr}px`,color:n.palette.text.disabled,fontSize:"0.75rem",alignItems:"center",justifyContent:"center",display:"inline-flex"})),cy=X("div",{name:"MuiDayCalendar",slot:"LoadingContainer",overridesResolver:(n,e)=>e.loadingContainer})({display:"flex",justifyContent:"center",alignItems:"center",minHeight:mc}),uy=X(Zg,{name:"MuiDayCalendar",slot:"SlideTransition",overridesResolver:(n,e)=>e.slideTransition})({minHeight:mc}),hy=X("div",{name:"MuiDayCalendar",slot:"MonthContainer",overridesResolver:(n,e)=>e.monthContainer})({overflow:"hidden"}),dy=X("div",{name:"MuiDayCalendar",slot:"WeekContainer",overridesResolver:(n,e)=>e.weekContainer})({margin:`${Rr}px 0`,display:"flex",justifyContent:"center"});function py(n){let{parentProps:e,day:t,focusableDay:s,selectedDays:r,isDateDisabled:o,currentMonthNumber:i,isViewFocused:a}=n,l=pe(n,ty);const{disabled:u,disableHighlightToday:d,isMonthSwitchingAnimating:h,showDaysOutsideCurrentMonth:p,slots:g,slotProps:m,timezone:f}=e,y=Ee(),b=Fs(f),C=s!==null&&y.isSameDay(t,s),D=r.some($=>y.isSameDay($,t)),v=y.isSameDay(t,b),E=(g==null?void 0:g.day)??$f,A=ke({elementType:E,externalSlotProps:m==null?void 0:m.day,additionalProps:k({disableHighlightToday:d,showDaysOutsideCurrentMonth:p,role:"gridcell",isAnimating:h,"data-timestamp":y.toJsDate(t).valueOf()},l),ownerState:k({},e,{day:t,selected:D})}),S=pe(A,sy),T=he(()=>u||o(t),[u,o,t]),N=he(()=>y.getMonth(t)!==i,[y,t,i]),V=he(()=>{const $=y.startOfMonth(y.setMonth(t,i));return p?y.isSameDay(t,y.startOfWeek($)):y.isSameDay(t,$)},[i,t,p,y]),_=he(()=>{const $=y.endOfMonth(y.setMonth(t,i));return p?y.isSameDay(t,y.endOfWeek($)):y.isSameDay(t,$)},[i,t,p,y]);return I.jsx(E,k({},S,{day:t,disabled:T,autoFocus:a&&C,today:v,outsideCurrentMonth:N,isFirstVisibleCell:V,isLastVisibleCell:_,selected:D,tabIndex:C?0:-1,"aria-selected":D,"aria-current":v?"date":void 0}))}function fy(n){const e=ve({props:n,name:"MuiDayCalendar"}),t=Ee(),{onFocusedDayChange:s,className:r,currentMonth:o,selectedDays:i,focusedDay:a,loading:l,onSelectedDaysChange:u,onMonthSwitchingAnimationEnd:d,readOnly:h,reduceAnimations:p,renderLoading:g=()=>I.jsx("span",{children:"..."}),slideDirection:m,TransitionProps:f,disablePast:y,disableFuture:b,minDate:C,maxDate:D,shouldDisableDate:v,shouldDisableMonth:E,shouldDisableYear:A,dayOfWeekFormatter:S=q=>t.format(q,"weekdayShort").charAt(0).toUpperCase(),hasFocus:T,onFocusedViewChange:N,gridLabelId:V,displayWeekNumber:_,fixedWeekNumber:$,autoFocus:j,timezone:U}=e,R=Fs(U),K=ny(e),ae=It(),se=pc({shouldDisableDate:v,shouldDisableMonth:E,shouldDisableYear:A,minDate:C,maxDate:D,disablePast:y,disableFuture:b,timezone:U}),de=nt(),[ie,P]=xs({name:"DayCalendar",state:"hasFocus",controlled:T,default:j??!1}),[M,O]=Dt(()=>a||R),B=ce(q=>{h||u(q)}),Y=q=>{se(q)||(s(q),O(q),N==null||N(!0),P(!0))},ne=ce((q,H)=>{switch(q.key){case"ArrowUp":Y(t.addDays(H,-7)),q.preventDefault();break;case"ArrowDown":Y(t.addDays(H,7)),q.preventDefault();break;case"ArrowLeft":{const G=t.addDays(H,ae?1:-1),Q=t.addMonths(H,ae?1:-1),oe=kn({utils:t,date:G,minDate:ae?G:t.startOfMonth(Q),maxDate:ae?t.endOfMonth(Q):G,isDateDisabled:se,timezone:U});Y(oe||G),q.preventDefault();break}case"ArrowRight":{const G=t.addDays(H,ae?-1:1),Q=t.addMonths(H,ae?-1:1),oe=kn({utils:t,date:G,minDate:ae?t.startOfMonth(Q):G,maxDate:ae?G:t.endOfMonth(Q),isDateDisabled:se,timezone:U});Y(oe||G),q.preventDefault();break}case"Home":Y(t.startOfWeek(H)),q.preventDefault();break;case"End":Y(t.endOfWeek(H)),q.preventDefault();break;case"PageUp":Y(t.addMonths(H,1)),q.preventDefault();break;case"PageDown":Y(t.addMonths(H,-1)),q.preventDefault();break}}),ee=ce((q,H)=>Y(H)),z=ce((q,H)=>{ie&&t.isSameDay(M,H)&&(N==null||N(!1))}),J=t.getMonth(o),ue=t.getYear(o),le=he(()=>i.filter(q=>!!q).map(q=>t.startOfDay(q)),[t,i]),re=`${ue}-${J}`,L=he(()=>Ga(),[re]),Z=he(()=>{const q=t.startOfMonth(o),H=t.endOfMonth(o);return se(M)||t.isAfterDay(M,H)||t.isBeforeDay(M,q)?kn({utils:t,date:M,minDate:q,maxDate:H,disablePast:y,disableFuture:b,isDateDisabled:se,timezone:U}):M},[o,b,y,M,se,t,U]),te=he(()=>{const q=t.getWeekArray(o);let H=t.addMonths(o,1);for(;$&&q.length<$;){const G=t.getWeekArray(H),Q=t.isSameDay(q[q.length-1][0],G[0][0]);G.slice(Q?1:0).forEach(oe=>{q.length<$&&q.push(oe)}),H=t.addMonths(H,1)}return q},[o,$,t]);return I.jsxs(ry,{role:"grid","aria-labelledby":V,className:K.root,children:[I.jsxs(oy,{role:"row",className:K.header,children:[_&&I.jsx(ay,{variant:"caption",role:"columnheader","aria-label":de.calendarWeekNumberHeaderLabel,className:K.weekNumberLabel,children:de.calendarWeekNumberHeaderText}),kp(t,R).map((q,H)=>I.jsx(iy,{variant:"caption",role:"columnheader","aria-label":t.format(q,"weekday"),className:K.weekDayLabel,children:S(q)},H.toString()))]}),l?I.jsx(cy,{className:K.loadingContainer,children:g()}):I.jsx(uy,k({transKey:re,onExited:d,reduceAnimations:p,slideDirection:m,className:Ie(r,K.slideTransition)},f,{nodeRef:L,children:I.jsx(hy,{ref:L,role:"rowgroup",className:K.monthContainer,children:te.map((q,H)=>I.jsxs(dy,{role:"row",className:K.weekContainer,"aria-rowindex":H+1,children:[_&&I.jsx(ly,{className:K.weekNumber,role:"rowheader","aria-label":de.calendarWeekNumberAriaLabelText(t.getWeekNumber(q[0])),children:de.calendarWeekNumberText(t.getWeekNumber(q[0]))}),q.map((G,Q)=>I.jsx(py,{parentProps:e,day:G,selectedDays:le,focusableDay:Z,onKeyDown:ne,onFocus:ee,onBlur:z,onDaySelect:B,isDateDisabled:se,currentMonthNumber:J,isViewFocused:ie,"aria-colindex":Q+1},G.toString()))]},`week-${q[0]}`))})}))]})}function my(n){return Ae("MuiPickersMonth",n)}const nr=Fe("MuiPickersMonth",["root","monthButton","disabled","selected"]),gy=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","aria-label","monthsPerRow","slots","slotProps"],yy=n=>{const{disabled:e,selected:t,classes:s}=n;return Se({root:["root"],monthButton:["monthButton",e&&"disabled",t&&"selected"]},my,s)},by=X("div",{name:"MuiPickersMonth",slot:"Root",overridesResolver:(n,e)=>[e.root]})({display:"flex",alignItems:"center",justifyContent:"center",flexBasis:"33.3%",variants:[{props:{monthsPerRow:4},style:{flexBasis:"25%"}}]}),Cy=X("button",{name:"MuiPickersMonth",slot:"MonthButton",overridesResolver:(n,e)=>[e.monthButton,{[`&.${nr.disabled}`]:e.disabled},{[`&.${nr.selected}`]:e.selected}]})(({theme:n})=>k({color:"unset",backgroundColor:"transparent",border:0,outline:0},n.typography.subtitle1,{margin:"8px 0",height:36,width:72,borderRadius:18,cursor:"pointer","&:focus":{backgroundColor:n.vars?`rgba(${n.vars.palette.action.activeChannel} / ${n.vars.palette.action.hoverOpacity})`:$t(n.palette.action.active,n.palette.action.hoverOpacity)},"&:hover":{backgroundColor:n.vars?`rgba(${n.vars.palette.action.activeChannel} / ${n.vars.palette.action.hoverOpacity})`:$t(n.palette.action.active,n.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${nr.disabled}`]:{color:(n.vars||n).palette.text.secondary},[`&.${nr.selected}`]:{color:(n.vars||n).palette.primary.contrastText,backgroundColor:(n.vars||n).palette.primary.main,"&:focus, &:hover":{backgroundColor:(n.vars||n).palette.primary.dark}}})),Dy=Zo(function(e){const t=ve({props:e,name:"MuiPickersMonth"}),{autoFocus:s,className:r,children:o,disabled:i,selected:a,value:l,tabIndex:u,onClick:d,onKeyDown:h,onFocus:p,onBlur:g,"aria-current":m,"aria-label":f,slots:y,slotProps:b}=t,C=pe(t,gy),D=De(null),v=yy(t);Kt(()=>{var S;s&&((S=D.current)==null||S.focus())},[s]);const E=(y==null?void 0:y.monthButton)??Cy,A=ke({elementType:E,externalSlotProps:b==null?void 0:b.monthButton,additionalProps:{children:o,disabled:i,tabIndex:u,ref:D,type:"button",role:"radio","aria-current":m,"aria-checked":a,"aria-label":f,onClick:S=>d(S,l),onKeyDown:S=>h(S,l),onFocus:S=>p(S,l),onBlur:S=>g(S,l)},ownerState:t,className:v.monthButton});return I.jsx(by,k({className:Ie(v.root,r),ownerState:t},C,{children:I.jsx(E,k({},A))}))});function vy(n){return Ae("MuiMonthCalendar",n)}Fe("MuiMonthCalendar",["root"]);const wy=["className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","shouldDisableMonth","readOnly","disableHighlightToday","autoFocus","onMonthFocus","hasFocus","onFocusedViewChange","monthsPerRow","timezone","gridLabelId","slots","slotProps"],Ey=n=>{const{classes:e}=n;return Se({root:["root"]},vy,e)};function xy(n,e){const t=Ee(),s=Un(),r=ve({props:n,name:e});return k({disableFuture:!1,disablePast:!1},r,{minDate:vt(t,r.minDate,s.minDate),maxDate:vt(t,r.maxDate,s.maxDate)})}const Sy=X("div",{name:"MuiMonthCalendar",slot:"Root",overridesResolver:(n,e)=>e.root})({display:"flex",flexWrap:"wrap",alignContent:"stretch",padding:"0 4px",width:jr,boxSizing:"border-box"}),ky=Te(function(e,t){const s=xy(e,"MuiMonthCalendar"),{className:r,value:o,defaultValue:i,referenceDate:a,disabled:l,disableFuture:u,disablePast:d,maxDate:h,minDate:p,onChange:g,shouldDisableMonth:m,readOnly:f,autoFocus:y=!1,onMonthFocus:b,hasFocus:C,onFocusedViewChange:D,monthsPerRow:v=3,timezone:E,gridLabelId:A,slots:S,slotProps:T}=s,N=pe(s,wy),{value:V,handleValueChange:_,timezone:$}=nn({name:"MonthCalendar",timezone:E,value:o,defaultValue:i,referenceDate:a,onChange:g,valueManager:tt}),j=Fs($),U=It(),R=Ee(),K=he(()=>tt.getInitialReferenceValue({value:V,utils:R,props:s,timezone:$,referenceDate:a,granularity:At.month}),[]),ae=s,se=Ey(ae),de=he(()=>R.getMonth(j),[R,j]),ie=he(()=>V!=null?R.getMonth(V):null,[V,R]),[P,M]=Dt(()=>ie||R.getMonth(K)),[O,B]=xs({name:"MonthCalendar",state:"hasFocus",controlled:C,default:y??!1}),Y=ce(re=>{B(re),D&&D(re)}),ne=pt(re=>{const L=R.startOfMonth(d&&R.isAfter(j,p)?j:p),Z=R.startOfMonth(u&&R.isBefore(j,h)?j:h),te=R.startOfMonth(re);return R.isBefore(te,L)||R.isAfter(te,Z)?!0:m?m(te):!1},[u,d,h,p,j,m,R]),ee=ce((re,L)=>{if(f)return;const Z=R.setMonth(V??K,L);_(Z)}),z=ce(re=>{ne(R.setMonth(V??K,re))||(M(re),Y(!0),b&&b(re))});Oe(()=>{M(re=>ie!==null&&re!==ie?ie:re)},[ie]);const J=ce((re,L)=>{switch(re.key){case"ArrowUp":z((12+L-3)%12),re.preventDefault();break;case"ArrowDown":z((12+L+3)%12),re.preventDefault();break;case"ArrowLeft":z((12+L+(U?1:-1))%12),re.preventDefault();break;case"ArrowRight":z((12+L+(U?-1:1))%12),re.preventDefault();break}}),ue=ce((re,L)=>{z(L)}),le=ce((re,L)=>{P===L&&Y(!1)});return I.jsx(Sy,k({ref:t,className:Ie(se.root,r),ownerState:ae,role:"radiogroup","aria-labelledby":A},N,{children:gi(R,V??K).map(re=>{const L=R.getMonth(re),Z=R.format(re,"monthShort"),te=R.format(re,"month"),q=L===ie,H=l||ne(re);return I.jsx(Dy,{selected:q,value:L,onClick:ee,onKeyDown:J,autoFocus:O&&L===P,disabled:H,tabIndex:L===P&&!H?0:-1,onFocus:ue,onBlur:le,"aria-current":de===L?"date":void 0,"aria-label":te,monthsPerRow:v,slots:S,slotProps:T,children:Z},Z)})}))});function Ty(n){return Ae("MuiPickersYear",n)}const rr=Fe("MuiPickersYear",["root","yearButton","selected","disabled"]),Ay=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","yearsPerRow","slots","slotProps"],Fy=n=>{const{disabled:e,selected:t,classes:s}=n;return Se({root:["root"],yearButton:["yearButton",e&&"disabled",t&&"selected"]},Ty,s)},Iy=X("div",{name:"MuiPickersYear",slot:"Root",overridesResolver:(n,e)=>[e.root]})({display:"flex",alignItems:"center",justifyContent:"center",flexBasis:"33.3%",variants:[{props:{yearsPerRow:4},style:{flexBasis:"25%"}}]}),_y=X("button",{name:"MuiPickersYear",slot:"YearButton",overridesResolver:(n,e)=>[e.yearButton,{[`&.${rr.disabled}`]:e.disabled},{[`&.${rr.selected}`]:e.selected}]})(({theme:n})=>k({color:"unset",backgroundColor:"transparent",border:0,outline:0},n.typography.subtitle1,{margin:"6px 0",height:36,width:72,borderRadius:18,cursor:"pointer","&:focus":{backgroundColor:n.vars?`rgba(${n.vars.palette.action.activeChannel} / ${n.vars.palette.action.focusOpacity})`:$t(n.palette.action.active,n.palette.action.focusOpacity)},"&:hover":{backgroundColor:n.vars?`rgba(${n.vars.palette.action.activeChannel} / ${n.vars.palette.action.hoverOpacity})`:$t(n.palette.action.active,n.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${rr.disabled}`]:{color:(n.vars||n).palette.text.secondary},[`&.${rr.selected}`]:{color:(n.vars||n).palette.primary.contrastText,backgroundColor:(n.vars||n).palette.primary.main,"&:focus, &:hover":{backgroundColor:(n.vars||n).palette.primary.dark}}})),Oy=Zo(function(e){const t=ve({props:e,name:"MuiPickersYear"}),{autoFocus:s,className:r,children:o,disabled:i,selected:a,value:l,tabIndex:u,onClick:d,onKeyDown:h,onFocus:p,onBlur:g,"aria-current":m,slots:f,slotProps:y}=t,b=pe(t,Ay),C=De(null),D=Fy(t);Kt(()=>{var A;s&&((A=C.current)==null||A.focus())},[s]);const v=(f==null?void 0:f.yearButton)??_y,E=ke({elementType:v,externalSlotProps:y==null?void 0:y.yearButton,additionalProps:{children:o,disabled:i,tabIndex:u,ref:C,type:"button",role:"radio","aria-current":m,"aria-checked":a,onClick:A=>d(A,l),onKeyDown:A=>h(A,l),onFocus:A=>p(A,l),onBlur:A=>g(A,l)},ownerState:t,className:D.yearButton});return I.jsx(Iy,k({className:Ie(D.root,r),ownerState:t},b,{children:I.jsx(v,k({},E))}))});function Py(n){return Ae("MuiYearCalendar",n)}Fe("MuiYearCalendar",["root"]);const Ny=["autoFocus","className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","readOnly","shouldDisableYear","disableHighlightToday","onYearFocus","hasFocus","onFocusedViewChange","yearsOrder","yearsPerRow","timezone","gridLabelId","slots","slotProps"],By=n=>{const{classes:e}=n;return Se({root:["root"]},Py,e)};function My(n,e){const t=Ee(),s=Un(),r=ve({props:n,name:e});return k({disablePast:!1,disableFuture:!1},r,{yearsPerRow:r.yearsPerRow??3,minDate:vt(t,r.minDate,s.minDate),maxDate:vt(t,r.maxDate,s.maxDate)})}const $y=X("div",{name:"MuiYearCalendar",slot:"Root",overridesResolver:(n,e)=>e.root})({display:"flex",flexDirection:"row",flexWrap:"wrap",overflowY:"auto",height:"100%",padding:"0 4px",width:jr,maxHeight:lp,boxSizing:"border-box",position:"relative"}),Ly=Te(function(e,t){const s=My(e,"MuiYearCalendar"),{autoFocus:r,className:o,value:i,defaultValue:a,referenceDate:l,disabled:u,disableFuture:d,disablePast:h,maxDate:p,minDate:g,onChange:m,readOnly:f,shouldDisableYear:y,onYearFocus:b,hasFocus:C,onFocusedViewChange:D,yearsOrder:v="asc",yearsPerRow:E,timezone:A,gridLabelId:S,slots:T,slotProps:N}=s,V=pe(s,Ny),{value:_,handleValueChange:$,timezone:j}=nn({name:"YearCalendar",timezone:A,value:i,defaultValue:a,referenceDate:l,onChange:m,valueManager:tt}),U=Fs(j),R=It(),K=Ee(),ae=he(()=>tt.getInitialReferenceValue({value:_,utils:K,props:s,timezone:j,referenceDate:l,granularity:At.year}),[]),se=s,de=By(se),ie=he(()=>K.getYear(U),[K,U]),P=he(()=>_!=null?K.getYear(_):null,[_,K]),[M,O]=Dt(()=>P||K.getYear(ae)),[B,Y]=xs({name:"YearCalendar",state:"hasFocus",controlled:C,default:r??!1}),ne=ce(G=>{Y(G),D&&D(G)}),ee=pt(G=>{if(h&&K.isBeforeYear(G,U)||d&&K.isAfterYear(G,U)||g&&K.isBeforeYear(G,g)||p&&K.isAfterYear(G,p))return!0;if(!y)return!1;const Q=K.startOfYear(G);return y(Q)},[d,h,p,g,U,y,K]),z=ce((G,Q)=>{if(f)return;const oe=K.setYear(_??ae,Q);$(oe)}),J=ce(G=>{ee(K.setYear(_??ae,G))||(O(G),ne(!0),b==null||b(G))});Oe(()=>{O(G=>P!==null&&G!==P?P:G)},[P]);const ue=v!=="desc"?E*1:E*-1,le=R&&v==="asc"||!R&&v==="desc"?-1:1,re=ce((G,Q)=>{switch(G.key){case"ArrowUp":J(Q-ue),G.preventDefault();break;case"ArrowDown":J(Q+ue),G.preventDefault();break;case"ArrowLeft":J(Q-le),G.preventDefault();break;case"ArrowRight":J(Q+le),G.preventDefault();break}}),L=ce((G,Q)=>{J(Q)}),Z=ce((G,Q)=>{M===Q&&ne(!1)}),te=De(null),q=ut(t,te);Oe(()=>{if(r||te.current===null)return;const G=te.current.querySelector('[tabindex="0"]');if(!G)return;const Q=G.offsetHeight,oe=G.offsetTop,me=te.current.clientHeight,Qe=te.current.scrollTop,ft=oe+Q;Q>me||oe<Qe||(te.current.scrollTop=ft-me/2-Q/2)},[r]);const H=K.getYearRange([g,p]);return v==="desc"&&H.reverse(),I.jsx($y,k({ref:q,className:Ie(de.root,o),ownerState:se,role:"radiogroup","aria-labelledby":S},V,{children:H.map(G=>{const Q=K.getYear(G),oe=Q===P,me=u||ee(G);return I.jsx(Oy,{selected:oe,value:Q,onClick:z,onKeyDown:re,autoFocus:B&&Q===M,disabled:me,tabIndex:Q===M&&!me?0:-1,onFocus:L,onBlur:Z,"aria-current":ie===Q?"date":void 0,yearsPerRow:E,slots:T,slotProps:N,children:K.format(G,"year")},K.format(G,"year"))})}))}),Vy=n=>Ae("MuiPickersCalendarHeader",n),Ry=Fe("MuiPickersCalendarHeader",["root","labelContainer","label","switchViewButton","switchViewIcon"]),jy=["slots","slotProps","currentMonth","disabled","disableFuture","disablePast","maxDate","minDate","onMonthChange","onViewChange","view","reduceAnimations","views","labelId","className","timezone","format"],Uy=["ownerState"],Wy=n=>{const{classes:e}=n;return Se({root:["root"],labelContainer:["labelContainer"],label:["label"],switchViewButton:["switchViewButton"],switchViewIcon:["switchViewIcon"]},Vy,e)},zy=X("div",{name:"MuiPickersCalendarHeader",slot:"Root",overridesResolver:(n,e)=>e.root})({display:"flex",alignItems:"center",marginTop:12,marginBottom:4,paddingLeft:24,paddingRight:12,maxHeight:40,minHeight:40}),Hy=X("div",{name:"MuiPickersCalendarHeader",slot:"LabelContainer",overridesResolver:(n,e)=>e.labelContainer})(({theme:n})=>k({display:"flex",overflow:"hidden",alignItems:"center",cursor:"pointer",marginRight:"auto"},n.typography.body1,{fontWeight:n.typography.fontWeightMedium})),Jy=X("div",{name:"MuiPickersCalendarHeader",slot:"Label",overridesResolver:(n,e)=>e.label})({marginRight:6}),Ky=X(sn,{name:"MuiPickersCalendarHeader",slot:"SwitchViewButton",overridesResolver:(n,e)=>e.switchViewButton})({marginRight:"auto",variants:[{props:{view:"year"},style:{[`.${Ry.switchViewIcon}`]:{transform:"rotate(180deg)"}}}]}),qy=X(zd,{name:"MuiPickersCalendarHeader",slot:"SwitchViewIcon",overridesResolver:(n,e)=>e.switchViewIcon})(({theme:n})=>({willChange:"transform",transition:n.transitions.create("transform"),transform:"rotate(0deg)"})),Yy=Te(function(e,t){const s=nt(),r=Ee(),o=ve({props:e,name:"MuiPickersCalendarHeader"}),{slots:i,slotProps:a,currentMonth:l,disabled:u,disableFuture:d,disablePast:h,maxDate:p,minDate:g,onMonthChange:m,onViewChange:f,view:y,reduceAnimations:b,views:C,labelId:D,className:v,timezone:E,format:A=`${r.formats.month} ${r.formats.year}`}=o,S=pe(o,jy),T=o,N=Wy(o),V=(i==null?void 0:i.switchViewButton)??Ky,_=ke({elementType:V,externalSlotProps:a==null?void 0:a.switchViewButton,additionalProps:{size:"small","aria-label":s.calendarViewSwitchingButtonAriaLabel(y)},ownerState:T,className:N.switchViewButton}),$=(i==null?void 0:i.switchViewIcon)??qy,j=ke({elementType:$,externalSlotProps:a==null?void 0:a.switchViewIcon,ownerState:T,className:N.switchViewIcon}),U=pe(j,Uy),R=()=>m(r.addMonths(l,1),"left"),K=()=>m(r.addMonths(l,-1),"right"),ae=ip(l,{disableFuture:d,maxDate:p,timezone:E}),se=ap(l,{disablePast:h,minDate:g,timezone:E}),de=()=>{if(!(C.length===1||!f||u))if(C.length===2)f(C.find(P=>P!==y)||C[0]);else{const P=C.indexOf(y)!==0?0:1;f(C[P])}};if(C.length===1&&C[0]==="year")return null;const ie=r.formatByString(l,A);return I.jsxs(zy,k({},S,{ownerState:T,className:Ie(N.root,v),ref:t,children:[I.jsxs(Hy,{role:"presentation",onClick:de,ownerState:T,"aria-live":"polite",className:N.labelContainer,children:[I.jsx(fc,{reduceAnimations:b,transKey:ie,children:I.jsx(Jy,{id:D,ownerState:T,className:N.label,children:ie})}),C.length>1&&!u&&I.jsx(V,k({},_,{children:I.jsx($,k({},U))}))]}),I.jsx($r,{in:y==="day",appear:!b,enter:!b,children:I.jsx(kl,{slots:i,slotProps:a,onGoToPrevious:K,isPreviousDisabled:se,previousLabel:s.previousMonth,onGoToNext:R,isNextDisabled:ae,nextLabel:s.nextMonth})})]}))}),Gy="@media (prefers-reduced-motion: reduce)",Js=typeof navigator<"u"&&navigator.userAgent.match(/android\s(\d+)|OS\s(\d+)/i),ga=Js&&Js[1]?parseInt(Js[1],10):null,ya=Js&&Js[2]?parseInt(Js[2],10):null,Qy=ga&&ga<10||ya&&ya<13||!1,gc=()=>ci(Gy,{defaultMatches:!1})||Qy,Xy=n=>Ae("MuiDateCalendar",n);Fe("MuiDateCalendar",["root","viewTransitionContainer"]);const Zy=["autoFocus","onViewChange","value","defaultValue","referenceDate","disableFuture","disablePast","onChange","onYearChange","onMonthChange","reduceAnimations","shouldDisableDate","shouldDisableMonth","shouldDisableYear","view","views","openTo","className","disabled","readOnly","minDate","maxDate","disableHighlightToday","focusedView","onFocusedViewChange","showDaysOutsideCurrentMonth","fixedWeekNumber","dayOfWeekFormatter","slots","slotProps","loading","renderLoading","displayWeekNumber","yearsOrder","yearsPerRow","monthsPerRow","timezone"],e0=n=>{const{classes:e}=n;return Se({root:["root"],viewTransitionContainer:["viewTransitionContainer"]},Xy,e)};function t0(n,e){const t=Ee(),s=Un(),r=gc(),o=ve({props:n,name:e});return k({},o,{loading:o.loading??!1,disablePast:o.disablePast??!1,disableFuture:o.disableFuture??!1,openTo:o.openTo??"day",views:o.views??["year","day"],reduceAnimations:o.reduceAnimations??r,renderLoading:o.renderLoading??(()=>I.jsx("span",{children:"..."})),minDate:vt(t,o.minDate,s.minDate),maxDate:vt(t,o.maxDate,s.maxDate)})}const s0=X(Ur,{name:"MuiDateCalendar",slot:"Root",overridesResolver:(n,e)=>e.root})({display:"flex",flexDirection:"column",height:mi}),n0=X(fc,{name:"MuiDateCalendar",slot:"ViewTransitionContainer",overridesResolver:(n,e)=>e.viewTransitionContainer})({}),r0=Te(function(e,t){const s=Ee(),r=tn(),o=t0(e,"MuiDateCalendar"),{autoFocus:i,onViewChange:a,value:l,defaultValue:u,referenceDate:d,disableFuture:h,disablePast:p,onChange:g,onYearChange:m,onMonthChange:f,reduceAnimations:y,shouldDisableDate:b,shouldDisableMonth:C,shouldDisableYear:D,view:v,views:E,openTo:A,className:S,disabled:T,readOnly:N,minDate:V,maxDate:_,disableHighlightToday:$,focusedView:j,onFocusedViewChange:U,showDaysOutsideCurrentMonth:R,fixedWeekNumber:K,dayOfWeekFormatter:ae,slots:se,slotProps:de,loading:ie,renderLoading:P,displayWeekNumber:M,yearsOrder:O,yearsPerRow:B,monthsPerRow:Y,timezone:ne}=o,ee=pe(o,Zy),{value:z,handleValueChange:J,timezone:ue}=nn({name:"DateCalendar",timezone:ne,value:l,defaultValue:u,referenceDate:d,onChange:g,valueManager:tt}),{view:le,setView:re,focusedView:L,setFocusedView:Z,goToNextView:te,setValueAndGoToNextView:q}=zn({view:v,views:E,openTo:A,onChange:J,onViewChange:a,autoFocus:i,focusedView:j,onFocusedViewChange:U}),{referenceDate:H,calendarState:G,changeFocusedDay:Q,changeMonth:oe,handleChangeMonth:me,isDateDisabled:Qe,onMonthSwitchingAnimationEnd:ft}=Hg({value:z,referenceDate:d,reduceAnimations:y,onMonthChange:f,minDate:V,maxDate:_,shouldDisableDate:b,disablePast:p,disableFuture:h,timezone:ue}),cs=T&&z||V,Xe=T&&z||_,lt=`${r}-grid-label`,Yt=L!==null,Xn=(se==null?void 0:se.calendarHeader)??Yy,fu=ke({elementType:Xn,externalSlotProps:de==null?void 0:de.calendarHeader,additionalProps:{views:E,view:le,currentMonth:G.currentMonth,onViewChange:re,onMonthChange:(Re,Ot)=>me({newMonth:Re,direction:Ot}),minDate:cs,maxDate:Xe,disabled:T,disablePast:p,disableFuture:h,reduceAnimations:y,timezone:ue,labelId:lt},ownerState:o}),mu=ce(Re=>{const Ot=s.startOfMonth(Re),cn=s.endOfMonth(Re),Gt=Qe(Re)?kn({utils:s,date:Re,minDate:s.isBefore(V,Ot)?Ot:V,maxDate:s.isAfter(_,cn)?cn:_,disablePast:p,disableFuture:h,isDateDisabled:Qe,timezone:ue}):Re;Gt?(q(Gt,"finish"),f==null||f(Ot)):(te(),oe(Ot)),Q(Gt,!0)}),gu=ce(Re=>{const Ot=s.startOfYear(Re),cn=s.endOfYear(Re),Gt=Qe(Re)?kn({utils:s,date:Re,minDate:s.isBefore(V,Ot)?Ot:V,maxDate:s.isAfter(_,cn)?cn:_,disablePast:p,disableFuture:h,isDateDisabled:Qe,timezone:ue}):Re;Gt?(q(Gt,"finish"),m==null||m(Gt)):(te(),oe(Ot)),Q(Gt,!0)}),yu=ce(Re=>J(Re&&Tr(s,Re,z??H),"finish",le));Oe(()=>{z!=null&&s.isValid(z)&&oe(z)},[z]);const ho=o,zi=e0(ho),po={disablePast:p,disableFuture:h,maxDate:_,minDate:V},fo={disableHighlightToday:$,readOnly:N,disabled:T,timezone:ue,gridLabelId:lt,slots:se,slotProps:de},mo=De(le);Oe(()=>{mo.current!==le&&(L===mo.current&&Z(le,!0),mo.current=le)},[L,Z,le]);const bu=he(()=>[z],[z]);return I.jsxs(s0,k({ref:t,className:Ie(zi.root,S),ownerState:ho},ee,{children:[I.jsx(Xn,k({},fu,{slots:se,slotProps:de})),I.jsx(n0,{reduceAnimations:y,className:zi.viewTransitionContainer,transKey:le,ownerState:ho,children:I.jsxs("div",{children:[le==="year"&&I.jsx(Ly,k({},po,fo,{value:z,onChange:gu,shouldDisableYear:D,hasFocus:Yt,onFocusedViewChange:Re=>Z("year",Re),yearsOrder:O,yearsPerRow:B,referenceDate:H})),le==="month"&&I.jsx(ky,k({},po,fo,{hasFocus:Yt,className:S,value:z,onChange:mu,shouldDisableMonth:C,onFocusedViewChange:Re=>Z("month",Re),monthsPerRow:Y,referenceDate:H})),le==="day"&&I.jsx(fy,k({},G,po,fo,{onMonthSwitchingAnimationEnd:ft,onFocusedDayChange:Q,reduceAnimations:y,selectedDays:bu,onSelectedDaysChange:yu,shouldDisableDate:b,shouldDisableMonth:C,shouldDisableYear:D,hasFocus:Yt,onFocusedViewChange:Re=>Z("day",Re),showDaysOutsideCurrentMonth:R,fixedWeekNumber:K,dayOfWeekFormatter:ae,displayWeekNumber:M,loading:ie,renderLoading:P}))]})})]}))});function yc(n){return Ae("MuiPickersToolbar",n)}Fe("MuiPickersToolbar",["root","content"]);const o0=["children","className","toolbarTitle","hidden","titleId","isLandscape","classes","landscapeDirection"],i0=n=>{const{classes:e}=n;return Se({root:["root"],content:["content"]},yc,e)},a0=X("div",{name:"MuiPickersToolbar",slot:"Root",overridesResolver:(n,e)=>e.root})(({theme:n})=>({display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"space-between",padding:n.spacing(2,3),variants:[{props:{isLandscape:!0},style:{height:"auto",maxWidth:160,padding:16,justifyContent:"flex-start",flexWrap:"wrap"}}]})),l0=X("div",{name:"MuiPickersToolbar",slot:"Content",overridesResolver:(n,e)=>e.content})({display:"flex",flexWrap:"wrap",width:"100%",flex:1,justifyContent:"space-between",alignItems:"center",flexDirection:"row",variants:[{props:{isLandscape:!0},style:{justifyContent:"flex-start",alignItems:"flex-start",flexDirection:"column"}},{props:{isLandscape:!0,landscapeDirection:"row"},style:{flexDirection:"row"}}]}),bc=Te(function(e,t){const s=ve({props:e,name:"MuiPickersToolbar"}),{children:r,className:o,toolbarTitle:i,hidden:a,titleId:l}=s,u=pe(s,o0),d=s,h=i0(d);return a?null:I.jsxs(a0,k({ref:t,className:Ie(h.root,o),ownerState:d},u,{children:[I.jsx(ls,{color:"text.secondary",variant:"overline",id:l,children:i}),I.jsx(l0,{className:h.content,ownerState:d,children:r})]}))});function c0(n){return Ae("MuiDatePickerToolbar",n)}Fe("MuiDatePickerToolbar",["root","title"]);const u0=["value","isLandscape","onChange","toolbarFormat","toolbarPlaceholder","views","className","onViewChange","view"],h0=n=>{const{classes:e}=n;return Se({root:["root"],title:["title"]},c0,e)},d0=X(bc,{name:"MuiDatePickerToolbar",slot:"Root",overridesResolver:(n,e)=>e.root})({}),p0=X(ls,{name:"MuiDatePickerToolbar",slot:"Title",overridesResolver:(n,e)=>e.title})({variants:[{props:{isLandscape:!0},style:{margin:"auto 16px auto auto"}}]}),f0=Te(function(e,t){const s=ve({props:e,name:"MuiDatePickerToolbar"}),{value:r,isLandscape:o,toolbarFormat:i,toolbarPlaceholder:a="––",views:l,className:u}=s,d=pe(s,u0),h=Ee(),p=nt(),g=h0(s),m=he(()=>{if(!r)return a;const y=bi(h,{format:i,views:l},!0);return h.formatByString(r,y)},[r,i,a,h,l]),f=s;return I.jsx(d0,k({ref:t,toolbarTitle:p.datePickerToolbarTitle,isLandscape:o,className:Ie(g.root,u)},d,{children:I.jsx(p0,{variant:"h4",align:o?"left":"center",ownerState:f,className:g.title,children:m})}))});function Cc(n,e){const t=Ee(),s=Un(),r=ve({props:n,name:e}),o=he(()=>{var i;return((i=r.localeText)==null?void 0:i.toolbarTitle)==null?r.localeText:k({},r.localeText,{datePickerToolbarTitle:r.localeText.toolbarTitle})},[r.localeText]);return k({},r,{localeText:o},Tl({views:r.views,openTo:r.openTo,defaultViews:["year","day"],defaultOpenTo:"day"}),{disableFuture:r.disableFuture??!1,disablePast:r.disablePast??!1,minDate:vt(t,r.minDate,s.minDate),maxDate:vt(t,r.maxDate,s.maxDate),slots:k({toolbar:f0},r.slots)})}function m0(n){return Ae("MuiPickersPopper",n)}Fe("MuiPickersPopper",["root","paper"]);const g0=["PaperComponent","popperPlacement","ownerState","children","paperSlotProps","paperClasses","onPaperClick","onPaperTouchStart"],y0=n=>{const{classes:e}=n;return Se({root:["root"],paper:["paper"]},m0,e)},b0=X(Lh,{name:"MuiPickersPopper",slot:"Root",overridesResolver:(n,e)=>e.root})(({theme:n})=>({zIndex:n.zIndex.modal})),C0=X(Hh,{name:"MuiPickersPopper",slot:"Paper",overridesResolver:(n,e)=>e.paper})({outline:0,transformOrigin:"top center",variants:[{props:({placement:n})=>["top","top-start","top-end"].includes(n),style:{transformOrigin:"bottom center"}}]});function D0(n,e){return e.documentElement.clientWidth<n.clientX||e.documentElement.clientHeight<n.clientY}function v0(n,e){const t=De(!1),s=De(!1),r=De(null),o=De(!1);Oe(()=>{if(!n)return;function l(){o.current=!0}return document.addEventListener("mousedown",l,!0),document.addEventListener("touchstart",l,!0),()=>{document.removeEventListener("mousedown",l,!0),document.removeEventListener("touchstart",l,!0),o.current=!1}},[n]);const i=ce(l=>{if(!o.current)return;const u=s.current;s.current=!1;const d=bo(r.current);if(!r.current||"clientX"in l&&D0(l,d))return;if(t.current){t.current=!1;return}let h;l.composedPath?h=l.composedPath().indexOf(r.current)>-1:h=!d.documentElement.contains(l.target)||r.current.contains(l.target),!h&&!u&&e(l)}),a=()=>{s.current=!0};return Oe(()=>{if(n){const l=bo(r.current),u=()=>{t.current=!0};return l.addEventListener("touchstart",i),l.addEventListener("touchmove",u),()=>{l.removeEventListener("touchstart",i),l.removeEventListener("touchmove",u)}}},[n,i]),Oe(()=>{if(n){const l=bo(r.current);return l.addEventListener("click",i),()=>{l.removeEventListener("click",i),s.current=!1}}},[n,i]),[r,a,a]}const w0=Te((n,e)=>{const{PaperComponent:t,popperPlacement:s,ownerState:r,children:o,paperSlotProps:i,paperClasses:a,onPaperClick:l,onPaperTouchStart:u}=n,d=pe(n,g0),h=k({},r,{placement:s}),p=ke({elementType:t,externalSlotProps:i,additionalProps:{tabIndex:-1,elevation:8,ref:e},className:a,ownerState:h});return I.jsx(t,k({},d,p,{onClick:g=>{var m;l(g),(m=p.onClick)==null||m.call(p,g)},onTouchStart:g=>{var m;u(g),(m=p.onTouchStart)==null||m.call(p,g)},ownerState:h,children:o}))});function E0(n){const e=ve({props:n,name:"MuiPickersPopper"}),{anchorEl:t,children:s,containerRef:r=null,shouldRestoreFocus:o,onBlur:i,onDismiss:a,open:l,role:u,placement:d,slots:h,slotProps:p,reduceAnimations:g}=e;Oe(()=>{function R(K){l&&K.key==="Escape"&&a()}return document.addEventListener("keydown",R),()=>{document.removeEventListener("keydown",R)}},[a,l]);const m=De(null);Oe(()=>{u==="tooltip"||o&&!o()||(l?m.current=ot(document):m.current&&m.current instanceof HTMLElement&&setTimeout(()=>{m.current instanceof HTMLElement&&m.current.focus()}))},[l,u,o]);const[f,y,b]=v0(l,i??a),C=De(null),D=ut(C,r),v=ut(D,f),E=e,A=y0(E),S=gc(),T=g??S,N=R=>{R.key==="Escape"&&(R.stopPropagation(),a())},V=(h==null?void 0:h.desktopTransition)??T?$r:$h,_=(h==null?void 0:h.desktopTrapFocus)??zh,$=(h==null?void 0:h.desktopPaper)??C0,j=(h==null?void 0:h.popper)??b0,U=ke({elementType:j,externalSlotProps:p==null?void 0:p.popper,additionalProps:{transition:!0,role:u,open:l,anchorEl:t,placement:d,onKeyDown:N},className:A.root,ownerState:e});return I.jsx(j,k({},U,{children:({TransitionProps:R,placement:K})=>I.jsx(_,k({open:l,disableAutoFocus:!0,disableRestoreFocus:!0,disableEnforceFocus:u==="tooltip",isEnabled:()=>!0},p==null?void 0:p.desktopTrapFocus,{children:I.jsx(V,k({},R,p==null?void 0:p.desktopTransition,{children:I.jsx(w0,{PaperComponent:$,ownerState:E,popperPlacement:K,ref:v,onPaperClick:y,onPaperTouchStart:b,paperClasses:A.paper,paperSlotProps:p==null?void 0:p.desktopPaper,children:s})}))}))}))}const x0=({open:n,onOpen:e,onClose:t})=>{const s=De(typeof n=="boolean").current,[r,o]=Dt(!1);Oe(()=>{if(s){if(typeof n!="boolean")throw new Error("You must not mix controlling and uncontrolled mode for `open` prop");o(n)}},[s,n]);const i=pt(a=>{s||o(a),a&&e&&e(),!a&&t&&t()},[s,e,t]);return{isOpen:r,setIsOpen:i}},S0=n=>{const{action:e,hasChanged:t,dateState:s,isControlled:r}=n,o=!r&&!s.hasBeenModifiedSinceMount;return e.name==="setValueFromField"?!0:e.name==="setValueFromAction"?o&&["accept","today","clear"].includes(e.pickerAction)?!0:t(s.lastPublishedValue):e.name==="setValueFromView"&&e.selectionState!=="shallow"||e.name==="setValueFromShortcut"?o?!0:t(s.lastPublishedValue):!1},k0=n=>{const{action:e,hasChanged:t,dateState:s,isControlled:r,closeOnSelect:o}=n,i=!r&&!s.hasBeenModifiedSinceMount;return e.name==="setValueFromAction"?i&&["accept","today","clear"].includes(e.pickerAction)?!0:t(s.lastCommittedValue):e.name==="setValueFromView"&&e.selectionState==="finish"&&o?i?!0:t(s.lastCommittedValue):e.name==="setValueFromShortcut"?e.changeImportance==="accept"&&t(s.lastCommittedValue):!1},T0=n=>{const{action:e,closeOnSelect:t}=n;return e.name==="setValueFromAction"?!0:e.name==="setValueFromView"?e.selectionState==="finish"&&t:e.name==="setValueFromShortcut"?e.changeImportance==="accept":!1},A0=({props:n,valueManager:e,valueType:t,wrapperVariant:s,validator:r})=>{const{onAccept:o,onChange:i,value:a,defaultValue:l,closeOnSelect:u=s==="desktop",timezone:d,referenceDate:h}=n,{current:p}=De(l),{current:g}=De(a!==void 0),[m,f]=Dt(d),y=Ee(),b=As(),{isOpen:C,setIsOpen:D}=x0(n),{timezone:v,value:E,handleValueChange:A}=Ci({timezone:d,value:a,defaultValue:p,referenceDate:h,onChange:i,valueManager:e}),[S,T]=Dt(()=>{let J;return E!==void 0?J=E:p!==void 0?J=p:J=e.emptyValue,{draft:J,lastPublishedValue:J,lastCommittedValue:J,lastControlledValue:a,hasBeenModifiedSinceMount:!1}}),N=e.getTimezone(y,S.draft);m!==d&&(f(d),d&&N&&d!==N&&T(J=>k({},J,{draft:e.setTimezone(y,d,J.draft)})));const{getValidationErrorForNewValue:V}=Hl({props:n,validator:r,timezone:v,value:S.draft,onError:n.onError}),_=ce(J=>{const ue={action:J,dateState:S,hasChanged:q=>!e.areValuesEqual(y,J.value,q),isControlled:g,closeOnSelect:u},le=S0(ue),re=k0(ue),L=T0(ue);T(q=>k({},q,{draft:J.value,lastPublishedValue:le?J.value:q.lastPublishedValue,lastCommittedValue:re?J.value:q.lastCommittedValue,hasBeenModifiedSinceMount:!0}));let Z=null;const te=()=>(Z||(Z={validationError:J.name==="setValueFromField"?J.context.validationError:V(J.value)},J.name==="setValueFromShortcut"&&(Z.shortcut=J.shortcut)),Z);le&&A(J.value,te()),re&&o&&o(J.value,te()),L&&D(!1)});if(S.lastControlledValue!==a){const J=e.areValuesEqual(y,S.draft,E);T(ue=>k({},ue,{lastControlledValue:a},J?{}:{lastCommittedValue:E,lastPublishedValue:E,draft:E,hasBeenModifiedSinceMount:!0}))}const $=ce(()=>{_({value:e.emptyValue,name:"setValueFromAction",pickerAction:"clear"})}),j=ce(()=>{_({value:S.lastPublishedValue,name:"setValueFromAction",pickerAction:"accept"})}),U=ce(()=>{_({value:S.lastPublishedValue,name:"setValueFromAction",pickerAction:"dismiss"})}),R=ce(()=>{_({value:S.lastCommittedValue,name:"setValueFromAction",pickerAction:"cancel"})}),K=ce(()=>{_({value:e.getTodayValue(y,v,t),name:"setValueFromAction",pickerAction:"today"})}),ae=ce(J=>{J.preventDefault(),D(!0)}),se=ce(J=>{J==null||J.preventDefault(),D(!1)}),de=ce((J,ue="partial")=>_({name:"setValueFromView",value:J,selectionState:ue})),ie=ce((J,ue,le)=>_({name:"setValueFromShortcut",value:J,changeImportance:ue,shortcut:le})),P=ce((J,ue)=>_({name:"setValueFromField",value:J,context:ue})),M={onClear:$,onAccept:j,onDismiss:U,onCancel:R,onSetToday:K,onOpen:ae,onClose:se},O={value:S.draft,onChange:P},B=he(()=>e.cleanValue(y,S.draft),[y,e,S.draft]),Y={value:B,onChange:de,onClose:se,open:C},ee=k({},M,{value:B,onChange:de,onSelectShortcut:ie,isValid:J=>{const ue=r({adapter:b,value:J,timezone:v,props:n});return!e.hasError(ue)}}),z=he(()=>({onOpen:ae,onClose:se,open:C}),[C,se,ae]);return{open:C,fieldProps:O,viewProps:Y,layoutProps:ee,actions:M,contextValue:z}},F0=["className","sx"],I0=({props:n,propsFromPickerValue:e,additionalViewProps:t,autoFocusView:s,rendererInterceptor:r,fieldRef:o})=>{const{onChange:i,open:a,onClose:l}=e,{view:u,views:d,openTo:h,onViewChange:p,viewRenderers:g,timezone:m}=n,f=pe(n,F0),{view:y,setView:b,defaultView:C,focusedView:D,setFocusedView:v,setValueAndGoToNextView:E}=zn({view:u,views:d,openTo:h,onChange:i,onViewChange:p,autoFocus:s}),{hasUIView:A,viewModeLookup:S}=he(()=>d.reduce((U,R)=>{let K;return g[R]!=null?K="UI":K="field",U.viewModeLookup[R]=K,K==="UI"&&(U.hasUIView=!0),U},{hasUIView:!1,viewModeLookup:{}}),[g,d]),T=he(()=>d.reduce((U,R)=>g[R]!=null&&Bn(R)?U+1:U,0),[g,d]),N=S[y],V=ce(()=>N==="UI"),[_,$]=Dt(N==="UI"?y:null);return _!==y&&S[y]==="UI"&&$(y),Kt(()=>{N==="field"&&a&&(l(),setTimeout(()=>{var U,R;(U=o==null?void 0:o.current)==null||U.setSelectedSections(y),(R=o==null?void 0:o.current)==null||R.focusField(y)}))},[y]),Kt(()=>{if(!a)return;let U=y;N==="field"&&_!=null&&(U=_),U!==C&&S[U]==="UI"&&S[C]==="UI"&&(U=C),U!==y&&b(U),v(U,!0)},[a]),{hasUIView:A,shouldRestoreFocus:V,layoutProps:{views:d,view:_,onViewChange:b},renderCurrentView:()=>{if(_==null)return null;const U=g[_];if(U==null)return null;const R=k({},f,t,e,{views:d,timezone:m,onChange:E,view:_,onViewChange:b,focusedView:D,onFocusedViewChange:v,showViewSwitcher:T>1,timeViewsCount:T});return r?r(g,_,R):U(R)}}};function ba(){return typeof window>"u"?"portrait":window.screen&&window.screen.orientation&&window.screen.orientation.angle?Math.abs(window.screen.orientation.angle)===90?"landscape":"portrait":window.orientation&&Math.abs(Number(window.orientation))===90?"landscape":"portrait"}const _0=(n,e)=>{const[t,s]=Dt(ba);return Kt(()=>{const o=()=>{s(ba())};return window.addEventListener("orientationchange",o),()=>{window.removeEventListener("orientationchange",o)}},[]),$s(n,["hours","minutes","seconds"])?!1:(e||t)==="landscape"},O0=({props:n,propsFromPickerValue:e,propsFromPickerViews:t,wrapperVariant:s})=>{const{orientation:r}=n,o=_0(t.views,r),i=It();return{layoutProps:k({},t,e,{isLandscape:o,isRtl:i,wrapperVariant:s,disabled:n.disabled,readOnly:n.readOnly})}};function P0(n){const{props:e,pickerValueResponse:t}=n;return he(()=>({value:t.viewProps.value,open:t.open,disabled:e.disabled??!1,readOnly:e.readOnly??!1}),[t.viewProps.value,t.open,e.disabled,e.readOnly])}const Dc=({props:n,valueManager:e,valueType:t,wrapperVariant:s,additionalViewProps:r,validator:o,autoFocusView:i,rendererInterceptor:a,fieldRef:l})=>{const u=A0({props:n,valueManager:e,valueType:t,wrapperVariant:s,validator:o}),d=I0({props:n,additionalViewProps:r,autoFocusView:i,fieldRef:l,propsFromPickerValue:u.viewProps,rendererInterceptor:a}),h=O0({props:n,wrapperVariant:s,propsFromPickerValue:u.layoutProps,propsFromPickerViews:d.layoutProps}),p=P0({props:n,pickerValueResponse:u});return{open:u.open,actions:u.actions,fieldProps:u.fieldProps,renderCurrentView:d.renderCurrentView,hasUIView:d.hasUIView,shouldRestoreFocus:d.shouldRestoreFocus,layoutProps:h.layoutProps,contextValue:u.contextValue,ownerState:p}};function vc(n){return Ae("MuiPickersLayout",n)}const fs=Fe("MuiPickersLayout",["root","landscape","contentWrapper","toolbar","actionBar","tabs","shortcuts"]),N0=["onAccept","onClear","onCancel","onSetToday","actions"];function B0(n){const{onAccept:e,onClear:t,onCancel:s,onSetToday:r,actions:o}=n,i=pe(n,N0),a=nt();if(o==null||o.length===0)return null;const l=o==null?void 0:o.map(u=>{switch(u){case"clear":return I.jsx(Dn,{onClick:t,children:a.clearButtonLabel},u);case"cancel":return I.jsx(Dn,{onClick:s,children:a.cancelButtonLabel},u);case"accept":return I.jsx(Dn,{onClick:e,children:a.okButtonLabel},u);case"today":return I.jsx(Dn,{onClick:r,children:a.todayButtonLabel},u);default:return null}});return I.jsx(Jh,k({},i,{children:l}))}const M0=["items","changeImportance","isLandscape","onChange","isValid"],$0=["getValue"];function L0(n){const{items:e,changeImportance:t="accept",onChange:s,isValid:r}=n,o=pe(n,M0);if(e==null||e.length===0)return null;const i=e.map(a=>{let{getValue:l}=a,u=pe(a,$0);const d=l({isValid:r});return k({},u,{label:u.label,onClick:()=>{s(d,t,u)},disabled:!r(d)})});return I.jsx(Kh,k({dense:!0,sx:[{maxHeight:mi,maxWidth:200,overflow:"auto"},...Array.isArray(o.sx)?o.sx:[o.sx]]},o,{children:i.map(a=>I.jsx(qh,{children:I.jsx(Yh,k({},a))},a.id??a.label))}))}function V0(n){return n.view!==null}const R0=n=>{const{classes:e,isLandscape:t}=n;return Se({root:["root",t&&"landscape"],contentWrapper:["contentWrapper"],toolbar:["toolbar"],actionBar:["actionBar"],tabs:["tabs"],landscape:["landscape"],shortcuts:["shortcuts"]},vc,e)},j0=n=>{const{wrapperVariant:e,onAccept:t,onClear:s,onCancel:r,onSetToday:o,view:i,views:a,onViewChange:l,value:u,onChange:d,onSelectShortcut:h,isValid:p,isLandscape:g,disabled:m,readOnly:f,children:y,slots:b,slotProps:C}=n,D=R0(n),v=(b==null?void 0:b.actionBar)??B0,E=ke({elementType:v,externalSlotProps:C==null?void 0:C.actionBar,additionalProps:{onAccept:t,onClear:s,onCancel:r,onSetToday:o,actions:e==="desktop"?[]:["cancel","accept"]},className:D.actionBar,ownerState:k({},n,{wrapperVariant:e})}),A=I.jsx(v,k({},E)),S=b==null?void 0:b.toolbar,T=ke({elementType:S,externalSlotProps:C==null?void 0:C.toolbar,additionalProps:{isLandscape:g,onChange:d,value:u,view:i,onViewChange:l,views:a,disabled:m,readOnly:f},className:D.toolbar,ownerState:k({},n,{wrapperVariant:e})}),N=V0(T)&&S?I.jsx(S,k({},T)):null,V=y,_=b==null?void 0:b.tabs,$=i&&_?I.jsx(_,k({view:i,onViewChange:l,className:D.tabs},C==null?void 0:C.tabs)):null,j=(b==null?void 0:b.shortcuts)??L0,U=ke({elementType:j,externalSlotProps:C==null?void 0:C.shortcuts,additionalProps:{isValid:p,isLandscape:g,onChange:h},className:D.shortcuts,ownerState:{isValid:p,isLandscape:g,onChange:h,wrapperVariant:e}}),R=i&&j?I.jsx(j,k({},U)):null;return{toolbar:N,content:V,tabs:$,actionBar:A,shortcuts:R}},U0=n=>{const{isLandscape:e,classes:t}=n;return Se({root:["root",e&&"landscape"],contentWrapper:["contentWrapper"]},vc,t)},W0=X("div",{name:"MuiPickersLayout",slot:"Root",overridesResolver:(n,e)=>e.root})({display:"grid",gridAutoColumns:"max-content auto max-content",gridAutoRows:"max-content auto max-content",[`& .${fs.actionBar}`]:{gridColumn:"1 / 4",gridRow:3},variants:[{props:{isLandscape:!0},style:{[`& .${fs.toolbar}`]:{gridColumn:1,gridRow:"2 / 3"},[`.${fs.shortcuts}`]:{gridColumn:"2 / 4",gridRow:1}}},{props:{isLandscape:!0,isRtl:!0},style:{[`& .${fs.toolbar}`]:{gridColumn:3}}},{props:{isLandscape:!1},style:{[`& .${fs.toolbar}`]:{gridColumn:"2 / 4",gridRow:1},[`& .${fs.shortcuts}`]:{gridColumn:1,gridRow:"2 / 3"}}},{props:{isLandscape:!1,isRtl:!0},style:{[`& .${fs.shortcuts}`]:{gridColumn:3}}}]}),z0=X("div",{name:"MuiPickersLayout",slot:"ContentWrapper",overridesResolver:(n,e)=>e.contentWrapper})({gridColumn:2,gridRow:2,display:"flex",flexDirection:"column"}),wc=Te(function(e,t){const s=ve({props:e,name:"MuiPickersLayout"}),{toolbar:r,content:o,tabs:i,actionBar:a,shortcuts:l}=j0(s),{sx:u,className:d,isLandscape:h,wrapperVariant:p}=s,g=U0(s);return I.jsxs(W0,{ref:t,sx:u,className:Ie(g.root,d),ownerState:s,children:[h?l:r,h?r:l,I.jsx(z0,{className:g.contentWrapper,children:p==="desktop"?I.jsxs(Jt,{children:[o,i]}):I.jsxs(Jt,{children:[i,o]})}),a]})}),H0=["props","getOpenDialogAriaText"],J0=["ownerState"],K0=["ownerState"],Ec=n=>{var te;let{props:e,getOpenDialogAriaText:t}=n,s=pe(n,H0);const{slots:r,slotProps:o,className:i,sx:a,format:l,formatDensity:u,enableAccessibleFieldDOMStructure:d,selectedSections:h,onSelectedSectionsChange:p,timezone:g,name:m,label:f,inputRef:y,readOnly:b,disabled:C,autoFocus:D,localeText:v,reduceAnimations:E}=e,A=De(null),S=De(null),T=tn(),N=((te=o==null?void 0:o.toolbar)==null?void 0:te.hidden)??!1,{open:V,actions:_,hasUIView:$,layoutProps:j,renderCurrentView:U,shouldRestoreFocus:R,fieldProps:K,contextValue:ae,ownerState:se}=Dc(k({},s,{props:e,fieldRef:S,autoFocusView:!0,additionalViewProps:{},wrapperVariant:"desktop"})),de=r.inputAdornment??yl,ie=ke({elementType:de,externalSlotProps:o==null?void 0:o.inputAdornment,additionalProps:{position:"end"},ownerState:e}),P=pe(ie,J0),M=r.openPickerButton??sn,O=ke({elementType:M,externalSlotProps:o==null?void 0:o.openPickerButton,additionalProps:{disabled:C||b,onClick:V?_.onClose:_.onOpen,"aria-label":t(K.value),edge:P.position},ownerState:e}),B=pe(O,K0),Y=r.openPickerIcon,ne=ke({elementType:Y,externalSlotProps:o==null?void 0:o.openPickerIcon,ownerState:se}),ee=r.field,z=ke({elementType:ee,externalSlotProps:o==null?void 0:o.field,additionalProps:k({},K,N&&{id:T},{readOnly:b,disabled:C,className:i,sx:a,format:l,formatDensity:u,enableAccessibleFieldDOMStructure:d,selectedSections:h,onSelectedSectionsChange:p,timezone:g,label:f,name:m,autoFocus:D&&!e.open,focused:V?!0:void 0},y?{inputRef:y}:{}),ownerState:e});$&&(z.InputProps=k({},z.InputProps,{ref:A},!e.disableOpenPicker&&{[`${P.position}Adornment`]:I.jsx(de,k({},P,{children:I.jsx(M,k({},B,{children:I.jsx(Y,k({},ne))}))}))}));const J=k({textField:r.textField,clearIcon:r.clearIcon,clearButton:r.clearButton},z.slots),ue=r.layout??wc;let le=T;N&&(f?le=`${T}-label`:le=void 0);const re=k({},o,{toolbar:k({},o==null?void 0:o.toolbar,{titleId:T}),popper:k({"aria-labelledby":le},o==null?void 0:o.popper)}),L=ut(S,z.unstableFieldRef);return{renderPicker:()=>I.jsxs(Yl,{contextValue:ae,localeText:v,children:[I.jsx(ee,k({},z,{slots:J,slotProps:re,unstableFieldRef:L})),I.jsx(E0,k({role:"dialog",placement:"bottom-start",anchorEl:A.current},_,{open:V,slots:r,slotProps:re,shouldRestoreFocus:R,reduceAnimations:E,children:I.jsx(ue,k({},j,re==null?void 0:re.layout,{slots:r,slotProps:re,children:U()}))}))]})}},Ks=({view:n,onViewChange:e,views:t,focusedView:s,onFocusedViewChange:r,value:o,defaultValue:i,referenceDate:a,onChange:l,className:u,classes:d,disableFuture:h,disablePast:p,minDate:g,maxDate:m,shouldDisableDate:f,shouldDisableMonth:y,shouldDisableYear:b,reduceAnimations:C,onMonthChange:D,monthsPerRow:v,onYearChange:E,yearsOrder:A,yearsPerRow:S,slots:T,slotProps:N,loading:V,renderLoading:_,disableHighlightToday:$,readOnly:j,disabled:U,showDaysOutsideCurrentMonth:R,dayOfWeekFormatter:K,sx:ae,autoFocus:se,fixedWeekNumber:de,displayWeekNumber:ie,timezone:P})=>I.jsx(r0,{view:n,onViewChange:e,views:t.filter(ta),focusedView:s&&ta(s)?s:null,onFocusedViewChange:r,value:o,defaultValue:i,referenceDate:a,onChange:l,className:u,classes:d,disableFuture:h,disablePast:p,minDate:g,maxDate:m,shouldDisableDate:f,shouldDisableMonth:y,shouldDisableYear:b,reduceAnimations:C,onMonthChange:D,monthsPerRow:v,onYearChange:E,yearsOrder:A,yearsPerRow:S,slots:T,slotProps:N,loading:V,renderLoading:_,disableHighlightToday:$,readOnly:j,disabled:U,showDaysOutsideCurrentMonth:R,dayOfWeekFormatter:K,sx:ae,autoFocus:se,fixedWeekNumber:de,displayWeekNumber:ie,timezone:P}),xc=Te(function(e,t){var u,d;const s=nt(),r=Ee(),o=Cc(e,"MuiDesktopDatePicker"),i=k({day:Ks,month:Ks,year:Ks},o.viewRenderers),a=k({},o,{viewRenderers:i,format:bi(r,o,!1),yearsPerRow:o.yearsPerRow??4,slots:k({openPickerIcon:Kd,field:hc},o.slots),slotProps:k({},o.slotProps,{field:h=>{var p;return k({},Br((p=o.slotProps)==null?void 0:p.field,h),Hr(o),{ref:t})},toolbar:k({hidden:!0},(u=o.slotProps)==null?void 0:u.toolbar)})}),{renderPicker:l}=Ec({props:a,valueManager:tt,valueType:"date",getOpenDialogAriaText:Vr({utils:r,formatKey:"fullDate",contextTranslation:s.openDatePickerDialogue,propsTranslation:(d=a.localeText)==null?void 0:d.openDatePickerDialogue}),validator:Hn});return l()});xc.propTypes={autoFocus:w.bool,className:w.string,closeOnSelect:w.bool,dayOfWeekFormatter:w.func,defaultValue:w.object,disabled:w.bool,disableFuture:w.bool,disableHighlightToday:w.bool,disableOpenPicker:w.bool,disablePast:w.bool,displayWeekNumber:w.bool,enableAccessibleFieldDOMStructure:w.any,fixedWeekNumber:w.number,format:w.string,formatDensity:w.oneOf(["dense","spacious"]),inputRef:Lr,label:w.node,loading:w.bool,localeText:w.object,maxDate:w.object,minDate:w.object,monthsPerRow:w.oneOf([3,4]),name:w.string,onAccept:w.func,onChange:w.func,onClose:w.func,onError:w.func,onMonthChange:w.func,onOpen:w.func,onSelectedSectionsChange:w.func,onViewChange:w.func,onYearChange:w.func,open:w.bool,openTo:w.oneOf(["day","month","year"]),orientation:w.oneOf(["landscape","portrait"]),readOnly:w.bool,reduceAnimations:w.bool,referenceDate:w.object,renderLoading:w.func,selectedSections:w.oneOfType([w.oneOf(["all","day","empty","hours","meridiem","minutes","month","seconds","weekDay","year"]),w.number]),shouldDisableDate:w.func,shouldDisableMonth:w.func,shouldDisableYear:w.func,showDaysOutsideCurrentMonth:w.bool,slotProps:w.object,slots:w.object,sx:w.oneOfType([w.arrayOf(w.oneOfType([w.func,w.object,w.bool])),w.func,w.object]),timezone:w.string,value:w.object,view:w.oneOf(["day","month","year"]),viewRenderers:w.shape({day:w.func,month:w.func,year:w.func}),views:w.arrayOf(w.oneOf(["day","month","year"]).isRequired),yearsOrder:w.oneOf(["asc","desc"]),yearsPerRow:w.oneOf([3,4])};const q0=X(Gh)({[`& .${Ji.container}`]:{outline:0},[`& .${Ji.paper}`]:{outline:0,minWidth:jr}}),Y0=X(Qh)({"&:first-of-type":{padding:0}});function G0(n){const{children:e,onDismiss:t,open:s,slots:r,slotProps:o}=n,i=(r==null?void 0:r.dialog)??q0,a=(r==null?void 0:r.mobileTransition)??$r;return I.jsx(i,k({open:s,onClose:t},o==null?void 0:o.dialog,{TransitionComponent:a,TransitionProps:o==null?void 0:o.mobileTransition,PaperComponent:r==null?void 0:r.mobilePaper,PaperProps:o==null?void 0:o.mobilePaper,children:I.jsx(Y0,{children:e})}))}const Q0=["props","getOpenDialogAriaText"],Sc=n=>{var P;let{props:e,getOpenDialogAriaText:t}=n,s=pe(n,Q0);const{slots:r,slotProps:o,className:i,sx:a,format:l,formatDensity:u,enableAccessibleFieldDOMStructure:d,selectedSections:h,onSelectedSectionsChange:p,timezone:g,name:m,label:f,inputRef:y,readOnly:b,disabled:C,localeText:D}=e,v=De(null),E=tn(),A=((P=o==null?void 0:o.toolbar)==null?void 0:P.hidden)??!1,{open:S,actions:T,layoutProps:N,renderCurrentView:V,fieldProps:_,contextValue:$}=Dc(k({},s,{props:e,fieldRef:v,autoFocusView:!0,additionalViewProps:{},wrapperVariant:"mobile"})),j=r.field,U=ke({elementType:j,externalSlotProps:o==null?void 0:o.field,additionalProps:k({},_,A&&{id:E},!(C||b)&&{onClick:T.onOpen,onKeyDown:df(T.onOpen)},{readOnly:b??!0,disabled:C,className:i,sx:a,format:l,formatDensity:u,enableAccessibleFieldDOMStructure:d,selectedSections:h,onSelectedSectionsChange:p,timezone:g,label:f,name:m},y?{inputRef:y}:{}),ownerState:e});U.inputProps=k({},U.inputProps,{"aria-label":t(_.value)});const R=k({textField:r.textField},U.slots),K=r.layout??wc;let ae=E;A&&(f?ae=`${E}-label`:ae=void 0);const se=k({},o,{toolbar:k({},o==null?void 0:o.toolbar,{titleId:E}),mobilePaper:k({"aria-labelledby":ae},o==null?void 0:o.mobilePaper)}),de=ut(v,U.unstableFieldRef);return{renderPicker:()=>I.jsxs(Yl,{contextValue:$,localeText:D,children:[I.jsx(j,k({},U,{slots:R,slotProps:se,unstableFieldRef:de})),I.jsx(G0,k({},T,{open:S,slots:r,slotProps:se,children:I.jsx(K,k({},N,se==null?void 0:se.layout,{slots:r,slotProps:se,children:V()}))}))]})}},kc=Te(function(e,t){var u,d;const s=nt(),r=Ee(),o=Cc(e,"MuiMobileDatePicker"),i=k({day:Ks,month:Ks,year:Ks},o.viewRenderers),a=k({},o,{viewRenderers:i,format:bi(r,o,!1),slots:k({field:hc},o.slots),slotProps:k({},o.slotProps,{field:h=>{var p;return k({},Br((p=o.slotProps)==null?void 0:p.field,h),Hr(o),{ref:t})},toolbar:k({hidden:!1},(u=o.slotProps)==null?void 0:u.toolbar)})}),{renderPicker:l}=Sc({props:a,valueManager:tt,valueType:"date",getOpenDialogAriaText:Vr({utils:r,formatKey:"fullDate",contextTranslation:s.openDatePickerDialogue,propsTranslation:(d=a.localeText)==null?void 0:d.openDatePickerDialogue}),validator:Hn});return l()});kc.propTypes={autoFocus:w.bool,className:w.string,closeOnSelect:w.bool,dayOfWeekFormatter:w.func,defaultValue:w.object,disabled:w.bool,disableFuture:w.bool,disableHighlightToday:w.bool,disableOpenPicker:w.bool,disablePast:w.bool,displayWeekNumber:w.bool,enableAccessibleFieldDOMStructure:w.any,fixedWeekNumber:w.number,format:w.string,formatDensity:w.oneOf(["dense","spacious"]),inputRef:Lr,label:w.node,loading:w.bool,localeText:w.object,maxDate:w.object,minDate:w.object,monthsPerRow:w.oneOf([3,4]),name:w.string,onAccept:w.func,onChange:w.func,onClose:w.func,onError:w.func,onMonthChange:w.func,onOpen:w.func,onSelectedSectionsChange:w.func,onViewChange:w.func,onYearChange:w.func,open:w.bool,openTo:w.oneOf(["day","month","year"]),orientation:w.oneOf(["landscape","portrait"]),readOnly:w.bool,reduceAnimations:w.bool,referenceDate:w.object,renderLoading:w.func,selectedSections:w.oneOfType([w.oneOf(["all","day","empty","hours","meridiem","minutes","month","seconds","weekDay","year"]),w.number]),shouldDisableDate:w.func,shouldDisableMonth:w.func,shouldDisableYear:w.func,showDaysOutsideCurrentMonth:w.bool,slotProps:w.object,slots:w.object,sx:w.oneOfType([w.arrayOf(w.oneOfType([w.func,w.object,w.bool])),w.func,w.object]),timezone:w.string,value:w.object,view:w.oneOf(["day","month","year"]),viewRenderers:w.shape({day:w.func,month:w.func,year:w.func}),views:w.arrayOf(w.oneOf(["day","month","year"]).isRequired),yearsOrder:w.oneOf(["asc","desc"]),yearsPerRow:w.oneOf([3,4])};const X0=["desktopModeMediaQuery"],Z0=Te(function(e,t){const s=ve({props:e,name:"MuiDatePicker"}),{desktopModeMediaQuery:r=jl}=s,o=pe(s,X0);return ci(r,{defaultMatches:!0})?I.jsx(xc,k({ref:t},o)):I.jsx(kc,k({ref:t},o))});function eb(n){return Ae("MuiPickersToolbarText",n)}const Ca=Fe("MuiPickersToolbarText",["root","selected"]),tb=["className","selected","value"],sb=n=>{const{classes:e,selected:t}=n;return Se({root:["root",t&&"selected"]},eb,e)},nb=X(ls,{name:"MuiPickersToolbarText",slot:"Root",overridesResolver:(n,e)=>[e.root,{[`&.${Ca.selected}`]:e.selected}]})(({theme:n})=>({transition:n.transitions.create("color"),color:(n.vars||n).palette.text.secondary,[`&.${Ca.selected}`]:{color:(n.vars||n).palette.text.primary}})),Tc=Te(function(e,t){const s=ve({props:e,name:"MuiPickersToolbarText"}),{className:r,value:o}=s,i=pe(s,tb),a=sb(s);return I.jsx(nb,k({ref:t,className:Ie(a.root,r),component:"span"},i,{children:o}))}),rb=["align","className","selected","typographyClassName","value","variant","width"],ob=n=>{const{classes:e}=n;return Se({root:["root"]},yc,e)},ib=X(Dn,{name:"MuiPickersToolbarButton",slot:"Root",overridesResolver:(n,e)=>e.root})({padding:0,minWidth:16,textTransform:"none"}),mn=Te(function(e,t){const s=ve({props:e,name:"MuiPickersToolbarButton"}),{align:r,className:o,selected:i,typographyClassName:a,value:l,variant:u,width:d}=s,h=pe(s,rb),p=ob(s);return I.jsx(ib,k({variant:"text",ref:t,className:Ie(p.root,o)},d?{sx:{width:d}}:{},h,{children:I.jsx(Tc,{align:r,className:a,variant:u,value:l,selected:i})}))});function ab(n){return Ae("MuiTimePickerToolbar",n)}const An=Fe("MuiTimePickerToolbar",["root","separator","hourMinuteLabel","hourMinuteLabelLandscape","hourMinuteLabelReverse","ampmSelection","ampmLandscape","ampmLabel"]),lb=["ampm","ampmInClock","value","isLandscape","onChange","view","onViewChange","views","disabled","readOnly","className"],cb=n=>{const{isLandscape:e,classes:t,isRtl:s}=n;return Se({root:["root"],separator:["separator"],hourMinuteLabel:["hourMinuteLabel",e&&"hourMinuteLabelLandscape",s&&"hourMinuteLabelReverse"],ampmSelection:["ampmSelection",e&&"ampmLandscape"],ampmLabel:["ampmLabel"]},ab,t)},ub=X(bc,{name:"MuiTimePickerToolbar",slot:"Root",overridesResolver:(n,e)=>e.root})({}),hb=X(Tc,{name:"MuiTimePickerToolbar",slot:"Separator",overridesResolver:(n,e)=>e.separator})({outline:0,margin:"0 4px 0 2px",cursor:"default"}),db=X("div",{name:"MuiTimePickerToolbar",slot:"HourMinuteLabel",overridesResolver:(n,e)=>[{[`&.${An.hourMinuteLabelLandscape}`]:e.hourMinuteLabelLandscape,[`&.${An.hourMinuteLabelReverse}`]:e.hourMinuteLabelReverse},e.hourMinuteLabel]})({display:"flex",justifyContent:"flex-end",alignItems:"flex-end",variants:[{props:{isRtl:!0},style:{flexDirection:"row-reverse"}},{props:{isLandscape:!0},style:{marginTop:"auto"}}]}),pb=X("div",{name:"MuiTimePickerToolbar",slot:"AmPmSelection",overridesResolver:(n,e)=>[{[`.${An.ampmLabel}`]:e.ampmLabel},{[`&.${An.ampmLandscape}`]:e.ampmLandscape},e.ampmSelection]})({display:"flex",flexDirection:"column",marginRight:"auto",marginLeft:12,[`& .${An.ampmLabel}`]:{fontSize:17},variants:[{props:{isLandscape:!0},style:{margin:"4px 0 auto",flexDirection:"row",justifyContent:"space-around",flexBasis:"100%"}}]});function fb(n){const e=ve({props:n,name:"MuiTimePickerToolbar"}),{ampm:t,ampmInClock:s,value:r,isLandscape:o,onChange:i,view:a,onViewChange:l,views:u,disabled:d,readOnly:h,className:p}=e,g=pe(e,lb),m=Ee(),f=nt(),y=It(),b=!!(t&&!s&&u.includes("hours")),{meridiemMode:C,handleMeridiemChange:D}=fi(r,t,i),v=T=>t?m.format(T,"hours12h"):m.format(T,"hours24h"),E=k({},e,{isRtl:y}),A=cb(E),S=I.jsx(hb,{tabIndex:-1,value:":",variant:"h3",selected:!1,className:A.separator});return I.jsxs(ub,k({landscapeDirection:"row",toolbarTitle:f.timePickerToolbarTitle,isLandscape:o,ownerState:E,className:Ie(A.root,p)},g,{children:[I.jsxs(db,{className:A.hourMinuteLabel,ownerState:E,children:[$s(u,"hours")&&I.jsx(mn,{tabIndex:-1,variant:"h3",onClick:()=>l("hours"),selected:a==="hours",value:r?v(r):"--"}),$s(u,["hours","minutes"])&&S,$s(u,"minutes")&&I.jsx(mn,{tabIndex:-1,variant:"h3",onClick:()=>l("minutes"),selected:a==="minutes",value:r?m.format(r,"minutes"):"--"}),$s(u,["minutes","seconds"])&&S,$s(u,"seconds")&&I.jsx(mn,{variant:"h3",onClick:()=>l("seconds"),selected:a==="seconds",value:r?m.format(r,"seconds"):"--"})]}),b&&I.jsxs(pb,{className:A.ampmSelection,ownerState:E,children:[I.jsx(mn,{disableRipple:!0,variant:"subtitle2",selected:C==="am",typographyClassName:A.ampmLabel,value:ss(m,"am"),onClick:h?void 0:()=>D("am"),disabled:d}),I.jsx(mn,{disableRipple:!0,variant:"subtitle2",selected:C==="pm",typographyClassName:A.ampmLabel,value:ss(m,"pm"),onClick:h?void 0:()=>D("pm"),disabled:d})]})]}))}function Ac(n,e){var i;const t=Ee(),s=ve({props:n,name:e}),r=s.ampm??t.is12HourCycleInCurrentLocale(),o=he(()=>{var a;return((a=s.localeText)==null?void 0:a.toolbarTitle)==null?s.localeText:k({},s.localeText,{timePickerToolbarTitle:s.localeText.toolbarTitle})},[s.localeText]);return k({},s,{ampm:r,localeText:o},Tl({views:s.views,openTo:s.openTo,defaultViews:["hours","minutes"],defaultOpenTo:"hours"}),{disableFuture:s.disableFuture??!1,disablePast:s.disablePast??!1,slots:k({toolbar:fb},s.slots),slotProps:k({},s.slotProps,{toolbar:k({ampm:r,ampmInClock:s.ampmInClock},(i=s.slotProps)==null?void 0:i.toolbar)})})}const So=({view:n,onViewChange:e,focusedView:t,onFocusedViewChange:s,views:r,value:o,defaultValue:i,referenceDate:a,onChange:l,className:u,classes:d,disableFuture:h,disablePast:p,minTime:g,maxTime:m,shouldDisableTime:f,minutesStep:y,ampm:b,ampmInClock:C,slots:D,slotProps:v,readOnly:E,disabled:A,sx:S,autoFocus:T,showViewSwitcher:N,disableIgnoringDatePartForTimeValidation:V,timezone:_})=>I.jsx(uf,{view:n,onViewChange:e,focusedView:t&&Bn(t)?t:null,onFocusedViewChange:s,views:r.filter(Bn),value:o,defaultValue:i,referenceDate:a,onChange:l,className:u,classes:d,disableFuture:h,disablePast:p,minTime:g,maxTime:m,shouldDisableTime:f,minutesStep:y,ampm:b,ampmInClock:C,slots:D,slotProps:v,readOnly:E,disabled:A,sx:S,autoFocus:T,showViewSwitcher:N,disableIgnoringDatePartForTimeValidation:V,timezone:_}),mb=({view:n,onViewChange:e,focusedView:t,onFocusedViewChange:s,views:r,value:o,defaultValue:i,referenceDate:a,onChange:l,className:u,classes:d,disableFuture:h,disablePast:p,minTime:g,maxTime:m,shouldDisableTime:f,minutesStep:y,ampm:b,slots:C,slotProps:D,readOnly:v,disabled:E,sx:A,autoFocus:S,disableIgnoringDatePartForTimeValidation:T,timeSteps:N,skipDisabled:V,timezone:_})=>I.jsx(bf,{view:n,onViewChange:e,focusedView:t,onFocusedViewChange:s,views:r.filter(Bn),value:o,defaultValue:i,referenceDate:a,onChange:l,className:u,classes:d,disableFuture:h,disablePast:p,minTime:g,maxTime:m,shouldDisableTime:f,minutesStep:y,ampm:b,slots:C,slotProps:D,readOnly:v,disabled:E,sx:A,autoFocus:S,disableIgnoringDatePartForTimeValidation:T,timeStep:N==null?void 0:N.minutes,skipDisabled:V,timezone:_}),Da=({view:n,onViewChange:e,focusedView:t,onFocusedViewChange:s,views:r,value:o,defaultValue:i,referenceDate:a,onChange:l,className:u,classes:d,disableFuture:h,disablePast:p,minTime:g,maxTime:m,shouldDisableTime:f,minutesStep:y,ampm:b,slots:C,slotProps:D,readOnly:v,disabled:E,sx:A,autoFocus:S,disableIgnoringDatePartForTimeValidation:T,timeSteps:N,skipDisabled:V,timezone:_})=>I.jsx(If,{view:n,onViewChange:e,focusedView:t,onFocusedViewChange:s,views:r.filter(Bn),value:o,defaultValue:i,referenceDate:a,onChange:l,className:u,classes:d,disableFuture:h,disablePast:p,minTime:g,maxTime:m,shouldDisableTime:f,minutesStep:y,ampm:b,slots:C,slotProps:D,readOnly:v,disabled:E,sx:A,autoFocus:S,disableIgnoringDatePartForTimeValidation:T,timeSteps:N,skipDisabled:V,timezone:_}),gb=(n,e,t)=>t?e.filter(s=>!np(s)||s==="hours"):n?[...e,"meridiem"]:e,yb=(n,e)=>1440/((n.hours??1)*(n.minutes??5))<=e;function bb({thresholdToRenderTimeInASingleColumn:n,ampm:e,timeSteps:t,views:s}){const r=n??24,o=k({hours:1,minutes:5,seconds:5},t),i=yb(o,r);return{thresholdToRenderTimeInASingleColumn:r,timeSteps:o,shouldRenderTimeInASingleColumn:i,views:gb(e,s,i)}}const Fc=Te(function(e,t){var b,C,D,v;const s=nt(),r=Ee(),o=Ac(e,"MuiDesktopTimePicker"),{shouldRenderTimeInASingleColumn:i,views:a,timeSteps:l}=bb(o),u=i?mb:Da,d=k({hours:u,minutes:u,seconds:u,meridiem:u},o.viewRenderers),h=o.ampmInClock??!0,p=i?[]:["accept"],m=((b=d.hours)==null?void 0:b.name)===Da.name?a:a.filter(E=>E!=="meridiem"),f=k({},o,{ampmInClock:h,timeSteps:l,viewRenderers:d,format:Fl(r,o),views:i?["hours"]:m,slots:k({field:dc,openPickerIcon:qd},o.slots),slotProps:k({},o.slotProps,{field:E=>{var A;return k({},Br((A=o.slotProps)==null?void 0:A.field,E),Hr(o),{ref:t})},toolbar:k({hidden:!0,ampmInClock:h},(C=o.slotProps)==null?void 0:C.toolbar),actionBar:k({actions:p},(D=o.slotProps)==null?void 0:D.actionBar)})}),{renderPicker:y}=Ec({props:f,valueManager:tt,valueType:"time",getOpenDialogAriaText:Vr({utils:r,formatKey:"fullTime",contextTranslation:s.openTimePickerDialogue,propsTranslation:(v=f.localeText)==null?void 0:v.openTimePickerDialogue}),validator:zr});return y()});Fc.propTypes={ampm:w.bool,ampmInClock:w.bool,autoFocus:w.bool,className:w.string,closeOnSelect:w.bool,defaultValue:w.object,disabled:w.bool,disableFuture:w.bool,disableIgnoringDatePartForTimeValidation:w.bool,disableOpenPicker:w.bool,disablePast:w.bool,enableAccessibleFieldDOMStructure:w.any,format:w.string,formatDensity:w.oneOf(["dense","spacious"]),inputRef:Lr,label:w.node,localeText:w.object,maxTime:w.object,minTime:w.object,minutesStep:w.number,name:w.string,onAccept:w.func,onChange:w.func,onClose:w.func,onError:w.func,onOpen:w.func,onSelectedSectionsChange:w.func,onViewChange:w.func,open:w.bool,openTo:w.oneOf(["hours","meridiem","minutes","seconds"]),orientation:w.oneOf(["landscape","portrait"]),readOnly:w.bool,reduceAnimations:w.bool,referenceDate:w.object,selectedSections:w.oneOfType([w.oneOf(["all","day","empty","hours","meridiem","minutes","month","seconds","weekDay","year"]),w.number]),shouldDisableTime:w.func,skipDisabled:w.bool,slotProps:w.object,slots:w.object,sx:w.oneOfType([w.arrayOf(w.oneOfType([w.func,w.object,w.bool])),w.func,w.object]),thresholdToRenderTimeInASingleColumn:w.number,timeSteps:w.shape({hours:w.number,minutes:w.number,seconds:w.number}),timezone:w.string,value:w.object,view:w.oneOf(["hours","meridiem","minutes","seconds"]),viewRenderers:w.shape({hours:w.func,meridiem:w.func,minutes:w.func,seconds:w.func}),views:w.arrayOf(w.oneOf(["hours","minutes","seconds"]).isRequired)};const Ic=Te(function(e,t){var d,h;const s=nt(),r=Ee(),o=Ac(e,"MuiMobileTimePicker"),i=k({hours:So,minutes:So,seconds:So},o.viewRenderers),a=o.ampmInClock??!1,l=k({},o,{ampmInClock:a,viewRenderers:i,format:Fl(r,o),slots:k({field:dc},o.slots),slotProps:k({},o.slotProps,{field:p=>{var g;return k({},Br((g=o.slotProps)==null?void 0:g.field,p),Hr(o),{ref:t})},toolbar:k({hidden:!1,ampmInClock:a},(d=o.slotProps)==null?void 0:d.toolbar)})}),{renderPicker:u}=Sc({props:l,valueManager:tt,valueType:"time",getOpenDialogAriaText:Vr({utils:r,formatKey:"fullTime",contextTranslation:s.openTimePickerDialogue,propsTranslation:(h=l.localeText)==null?void 0:h.openTimePickerDialogue}),validator:zr});return u()});Ic.propTypes={ampm:w.bool,ampmInClock:w.bool,autoFocus:w.bool,className:w.string,closeOnSelect:w.bool,defaultValue:w.object,disabled:w.bool,disableFuture:w.bool,disableIgnoringDatePartForTimeValidation:w.bool,disableOpenPicker:w.bool,disablePast:w.bool,enableAccessibleFieldDOMStructure:w.any,format:w.string,formatDensity:w.oneOf(["dense","spacious"]),inputRef:Lr,label:w.node,localeText:w.object,maxTime:w.object,minTime:w.object,minutesStep:w.number,name:w.string,onAccept:w.func,onChange:w.func,onClose:w.func,onError:w.func,onOpen:w.func,onSelectedSectionsChange:w.func,onViewChange:w.func,open:w.bool,openTo:w.oneOf(["hours","minutes","seconds"]),orientation:w.oneOf(["landscape","portrait"]),readOnly:w.bool,reduceAnimations:w.bool,referenceDate:w.object,selectedSections:w.oneOfType([w.oneOf(["all","day","empty","hours","meridiem","minutes","month","seconds","weekDay","year"]),w.number]),shouldDisableTime:w.func,slotProps:w.object,slots:w.object,sx:w.oneOfType([w.arrayOf(w.oneOfType([w.func,w.object,w.bool])),w.func,w.object]),timezone:w.string,value:w.object,view:w.oneOf(["hours","minutes","seconds"]),viewRenderers:w.shape({hours:w.func,minutes:w.func,seconds:w.func}),views:w.arrayOf(w.oneOf(["hours","minutes","seconds"]).isRequired)};const Cb=["desktopModeMediaQuery"],Db=Te(function(e,t){const s=ve({props:e,name:"MuiTimePicker"}),{desktopModeMediaQuery:r=jl}=s,o=pe(s,Cb);return ci(r,{defaultMatches:!0})?I.jsx(Fc,k({ref:t},o)):I.jsx(Ic,k({ref:t},o))});class vb extends F{componentDidMount(){super.componentDidMount();const e=F.getValue(this.props.data,this.props.attr);if(e)try{const t=new Date(e);this.setState({value:t})}catch{}}renderItem(e,t){return c.createElement(Z0,{sx:s=>({width:"100%",borderBottom:`1px solid ${e?"#F00":s.palette.text.primary}`,"& fieldset":{display:"none"},"& input":{padding:`${s.spacing(1.5)} 0 4px 0`},"& .MuiInputAdornment-root":{marginLeft:0,marginTop:1},"& label":{transform:"translate(0px, -9px) scale(0.75)"}}),format:this.props.oContext.systemConfig.dateFormat.toLowerCase().replace("mm","MM"),disabled:!!t,value:this.state.value||null,onChange:s=>this.setState({value:s},()=>{try{const r=this.state.value.toISOString();this.onChange(this.props.attr,r).catch(o=>console.warn(`Error saving value for ${this.props.attr}:`,o))}catch{}}),label:this.getText(this.props.schema.label)})}}class wb extends F{renderItem(){if(!this.props.schema)return null;if(this.props.oContext.DeviceManager){const t=this.props.oContext.DeviceManager;return c.createElement(t,{uploadImagesToInstance:`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,title:this.getText(this.props.schema.label),socket:this.props.oContext.socket,selectedInstance:`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,themeName:this.props.themeName,theme:this.props.oContext.theme,themeType:this.props.oContext.themeType,isFloatComma:this.props.oContext.isFloatComma,dateFormat:this.props.oContext.dateFormat})}return c.createElement("div",null,"DeviceManager not found")}}const kt={fullWidth:{width:"100%"},uploadDiv:{position:"relative",width:"100%"},uploadDivDragging:{opacity:1,background:"rgba(128,255,128,0.1)"},uploadCenterDiv:{margin:5,border:"3px dashed grey",borderRadius:5,width:"100%",height:"100%",position:"absolute",display:"flex"},uploadCenterIcon:{paddingTop:10,width:48,height:48},uploadCenterText:{fontSize:16},uploadCenterTextAndIcon:{textAlign:"center",position:"absolute",top:0,bottom:0,left:0,right:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},disabledOpacity:{opacity:.3,cursor:"default"},error:{border:"2px solid red"},deleteButton:{},selectedImage:{height:40,width:40,display:"inline-block",marginRight:8}},Eb=["jpg","jpeg","svg","png","webp","gif","apng","avif","webp"],xb=["mp3","ogg","wav","aac"],Sb=["avi","mp4","mov"],kb=["txt","log","html","htm"],Tb=["json","js","ts"];class eo extends F{dropzoneRef;imagePrefix;objectID;path;constructor(e){super(e),this.dropzoneRef=c.createRef(),this.imagePrefix=this.props.oContext.imagePrefix===void 0?"./files":this.props.oContext.imagePrefix}componentDidMount(){super.componentDidMount(),this.objectID=(this.props.schema.objectID||"0_userdata.0").replace("%INSTANCE%",(this.props.oContext.instance||0).toString()),this.path=this.props.schema.upload,this.path&&(this.path==="/"?this.path="":this.path.endsWith("/")||(this.path=`${this.path}/`)),this.updateFiles().then(()=>{const e=F.getValue(this.props.data,this.props.attr);this.setState({value:e}),this.props.oContext.socket.subscribeFiles(this.objectID,`${this.path}/*`,this.onFolderChanged).catch(t=>console.error(`Cannot subscribe: ${t}`))})}onFolderChanged=(e,t)=>{this.path&&t.startsWith(this.path)&&this.updateFiles().catch(s=>console.error(`Cannot update files: ${s}`))};componentWillUnmount(){this.props.oContext.socket.subscribeFiles(this.objectID,`${this.path}/*`,this.onFolderChanged).catch(e=>console.error(`Cannot subscribe: ${e}`)),super.componentWillUnmount()}async updateFiles(){const e=await this.readFiles(this.props.schema.pattern);await new Promise(t=>this.setState({files:e},t))}async readFolder(e,t,s){try{const r=await this.props.oContext.socket.readDir(this.objectID,e.replace(/^\//,"")||null);for(let o=0;o<r.length;o++){const i=r[o];if(i.isDir)await this.readFolder(`${e+i.file}/`,t,s);else{let a=!1;s==="*.*"&&i.file.includes(".")||!s||s==="*"||s===".*"&&i.file.startsWith(".")?a=!0:a=new RegExp(`^${s.replace(/\./g,"\\.").replace(/\*/g,".*")}$`).test(i.file),a&&t.push({name:e+i.file,size:i.stats?je.formatBytes(i.stats.size):"--"})}}}catch(r){console.error(`Cannot read "${e}": ${r}`)}return t}async readFiles(e){const t=[];e=e||this.props.schema.pattern,e||(e="**/*.*");let s;const r=e.lastIndexOf("/");if(r===-1?s=e:s=e.substring(r+1),e.startsWith("**"))await this.readFolder("/",t,s);else{const o=e.lastIndexOf("/");if(o===-1)await this.readFolder("/",t,s);else{const i=e.substring(0,o+1);await this.readFolder(i,t,s)}}return t}onDrop(e){const t=e[0],s=new FileReader,r=this.props.schema.maxSize||2*1024*1024;s.onabort=()=>console.log("file reading was aborted"),s.onerror=()=>console.log("file reading has failed"),s.onload=()=>{if(t.size>r){window.alert(x.t("File is too big. Max %sk allowed. Try use SVG.",Math.round(r/1024)));return}this.props.oContext.socket.writeFile64(this.objectID,this.path+t.name,s.result).then(()=>this.updateFiles()).then(()=>this.setState({value:this.path+t.name},()=>this.onChange(this.props.attr,this.path+t.name))).catch(o=>window.alert(`Cannot upload file: ${o}`))},s.readAsArrayBuffer(t)}renderDeleteDialog(){return this.state.deleteFile?c.createElement(ws,{title:x.t("ra_Are you sure?"),text:x.t("ra_File will be deleted"),ok:x.t("ra_Delete"),cancel:x.t("ra_Cancel"),onClose:e=>{const t=this.state.deleteFile;this.setState({deleteFile:""},()=>{e&&this.props.oContext.socket.deleteFile(this.objectID,t).then(()=>this.updateFiles()).catch(s=>window.alert(`Cannot delete file: ${s}`))})}}):null}static base64ToArrayBuffer(e){const t=window.atob(e),s=t.length,r=new Uint8Array(s);for(let o=0;o<s;o++)r[o]=t.charCodeAt(o);return r.buffer}loadFile(){return this.props.oContext.socket.readFile(this.objectID,this.state.value,!0)}play(){this.loadFile().then(e=>{if(typeof AudioContext<"u"){const t=new AudioContext,s=eo.base64ToArrayBuffer(e.file);t.decodeAudioData(s,r=>{const o=t.createBufferSource();o.buffer=r,o.connect(t.destination),o.start(0)},r=>window.alert(`Cannot play: ${r.message}`))}})}getFileIcon(e){return e!=null&&e.extension?Eb.includes(e.extension)?c.createElement("div",{style:{...kt.selectedImage,backgroundImage:`url(${this.imagePrefix}/${this.objectID}/${e.value})`,backgroundSize:"contain",backgroundRepeat:"no-repeat"}}):xb.includes(e.extension)?c.createElement(Xu,null):kb.includes(e.extension)?c.createElement(cl,null):Sb.includes(e.extension)?c.createElement(ul,null):Tb.includes(e.extension)?c.createElement(hl,null):null:null}renderItem(e,t){if(!this.state.files)return null;const s=[];this.props.schema.withFolder||this.state.files.forEach(d=>{const h=d.name.lastIndexOf("/");if(h===-1)s.includes("/")||s.push("/");else{const p=d.name.substring(0,h+1);s.includes(p)||s.push(p)}});const r=this.state.files.map(d=>({value:d.name,label:!this.props.schema.withFolder&&s.length===1?`${d.name.substring(s[0].length)}`:`${d.name}${this.props.schema.noSize?"":`(${d.size})`}`,extension:d.name.toLowerCase().split(".").pop()}));this.props.schema.noNone||r.unshift({label:x.t("ra_none"),value:""});const o=r.find(d=>d.value===this.state.value);let i=0;this.props.schema.upload&&i++,this.props.schema.refresh&&i++;const a=this.state.value&&(this.state.value.endsWith(".mp3")||this.state.value.endsWith(".ogg")||this.state.value.endsWith(".wav"));a&&i++;const l=c.createElement("div",{style:kt.fullWidth},c.createElement(_e,{variant:"standard",style:{width:`calc(100% - ${i*42}px)`}},this.props.schema.label?c.createElement(Ke,null,this.getText(this.props.schema.label)):null,c.createElement(st,{variant:"standard",error:!!e,disabled:!!t,value:this.state.value||"_",renderValue:()=>c.createElement(c.Fragment,null,this.getFileIcon(o),c.createElement("span",null,(o==null?void 0:o.label)||"")),onChange:d=>{this.setState({value:d.target.value==="_"?"":d.target.value},()=>this.onChange(this.props.attr,this.state.value))}},r.map(d=>c.createElement(ze,{key:d.value,value:d.value},c.createElement(Za,null,this.getFileIcon(d)),c.createElement(ri,null,d.label),this.props.schema.delete&&o.value?c.createElement(fe,{style:kt.deleteButton,size:"small",onClick:()=>this.setState({deleteFile:o.value})},c.createElement(ts,null)):null))),this.props.schema.help?c.createElement(Be,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null),this.props.schema.refresh&&c.createElement(fe,{onClick:()=>this.updateFiles()},c.createElement(oi,null)),this.props.schema.upload&&c.createElement(fe,{onClick:()=>{var d;return(d=this.dropzoneRef.current)==null?void 0:d.open()}},c.createElement(On,null)),a&&c.createElement(fe,{style:{color:"#00FF00"},onClick:()=>this.play()},c.createElement(ai,null)));if(!this.props.schema.upload)return c.createElement(c.Fragment,null,l,this.renderDeleteDialog());let u={"*/*":[]};if(this.props.schema.fileTypes==="image"?u={"image/*":[".png",".jpg",".svg",".gif",".apng",".avif",".webp"]}:this.props.schema.fileTypes==="audio"?u={"audio/*":[".mp3",".ogg",".wav",".mp4"]}:this.props.schema.fileTypes==="text"&&(u={"text/plain":[".txt"]}),this.props.schema.pattern){const d=this.props.schema.pattern.split("/").pop().toLowerCase().replace(/.*\./,"");d==="png"||d==="jpg"||d==="svg"||d==="gif"||d==="apng"||d==="avif"||d==="webp"?u={"image/*":[".png",".jpg",".svg",".gif",".apng",".avif",".webp"]}:d==="mp3"||d==="ogg"||d==="wav"?u={"audio/*":[".mp3",".ogg",".wav",".mp4"]}:d==="ics"?u={"text/calendar":[".ics"]}:d==="txt"?u={"text/plain":[".txt"]}:d==="pem"?u={"text/plain":[".pem"]}:u={"*/*":[`.${d}`]}}return c.createElement(fl,{ref:this.dropzoneRef,multiple:!1,accept:u,noKeyboard:!0,noClick:!0,maxSize:this.props.schema.maxSize||2*1024*1024,onDragEnter:()=>{this.setState({uploadFile:"dragging"})},onDragLeave:()=>this.setState({uploadFile:!0}),onDrop:(d,h)=>{var p,g,m;this.setState({uploadFile:!1}),d.length?this.onDrop(d):window.alert(((m=(g=(p=h==null?void 0:h[0])==null?void 0:p.errors)==null?void 0:g[0])==null?void 0:m.message)||x.t("Cannot upload"))}},({getRootProps:d,getInputProps:h})=>c.createElement("div",{style:{...kt.uploadDiv,...this.state.uploadFile==="dragging"?kt.uploadDivDragging:void 0,...t?kt.disabledOpacity:void 0},...d()},c.createElement("input",{...h()}),this.state.uploadFile==="dragging"?c.createElement("div",{style:{...kt.uploadCenterDiv,...this.state.uploadError?kt.error:void 0}},c.createElement("div",{style:kt.uploadCenterTextAndIcon},c.createElement(On,{style:kt.uploadCenterIcon}),c.createElement("div",{style:kt.uploadCenterText},this.state.uploadFile==="dragging"?x.t("ra_Drop file here"):x.t("ra_Place your files here or click here to open the browse dialog")))):null,l,this.renderDeleteDialog()))}}const or={fullWidth:{width:"100%"},fullWidthOneButton:{width:"calc(100% - 69px)",marginRight:4},fullWidthIcon:{width:"calc(100% - 119px)",marginRight:4},selectedImage:{height:40,width:40,display:"inline-block",marginRight:8}},Ab=["jpg","jpeg","svg","png","webp","gif","apng","avif","webp"],Fb=["mp3","ogg","wav","aac"],Ib=["avi","mp4","mov"],_b=["txt","log","html","htm"],Ob=["json","js","ts"];class Pb extends F{imagePrefix="../..";componentDidMount(){super.componentDidMount();const e=F.getValue(this.props.data,this.props.attr);this.imagePrefix=this.props.oContext.imagePrefix===void 0?"./files":this.props.oContext.imagePrefix,this.setState({value:e??""})}static getDerivedStateFromProps(e,t){const s=F.getValue(e.data,e.attr);return s==null||s.toString().trim()!==(t.value||"").toString().trim()?{value:s??""}:null}loadFile(){const e=this.state.value.indexOf("/");if(e!==-1){const t=this.state.value.substring(0,e),s=this.state.value.substring(e+1);return this.props.oContext.socket.readFile(t,s,!0)}return Promise.resolve(null)}play(){this.loadFile().then(e=>{if(typeof AudioContext<"u"&&(e!=null&&e.file)){const t=new AudioContext,s=eo.base64ToArrayBuffer(e.file);t.decodeAudioData(s,r=>{const o=t.createBufferSource();o.buffer=r,o.connect(t.destination),o.start(0)},r=>window.alert(`Cannot play: ${r.message}`))}})}getIcon(){const e=this.state.value.split(".").pop().toLowerCase();return Ab.includes(e)?c.createElement("div",{style:{...or.selectedImage,backgroundImage:`url(${this.imagePrefix}/${this.state.value})`,backgroundSize:"contain",backgroundRepeat:"no-repeat"}}):Fb.includes(e)?c.createElement(fe,{style:{color:"#00FF00"},onClick:()=>this.play()},c.createElement(ai,null)):_b.includes(e)?c.createElement(cl,null):Ib.includes(e)?c.createElement(ul,null):Ob.includes(e)?c.createElement(hl,null):null}renderFileBrowser(){return this.state.showFileBrowser?c.createElement(vh,{imagePrefix:this.props.oContext.imagePrefix,socket:this.props.oContext.socket,selected:this.state.value,onClose:()=>this.setState({showFileBrowser:!1}),onOk:e=>{const t=Array.isArray(e)?e[0]:e;this.setState({value:t},()=>this.onChange(this.props.attr,this.props.schema.trim===!1?t:(t||"").trim()))},selectOnlyFolders:this.props.schema.selectOnlyFolders,allowUpload:this.props.schema.allowUpload,allowDownload:this.props.schema.allowDownload,allowCreateFolder:this.props.schema.allowCreateFolder,allowView:this.props.schema.allowView,showToolbar:this.props.schema.showToolbar,limitPath:this.props.schema.limitPath,theme:this.props.oContext.theme}):null}renderItem(e,t){const s=this.getIcon();return c.createElement("div",{style:or.fullWidth},s,c.createElement(xe,{variant:"standard",style:s?or.fullWidthIcon:or.fullWidthOneButton,value:this.state.value===null||this.state.value===void 0?"":this.state.value,error:!!e,disabled:!!t,slotProps:{htmlInput:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0,readOnly:!!this.props.schema.disableEdit}},onChange:r=>{const o=r.target.value;this.setState({value:o},()=>this.onChange(this.props.attr,this.props.schema.trim===!1?o:(o||"").trim()))},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)}),c.createElement(Ne,{disabled:t,variant:"outlined",onClick:()=>this.setState({showFileBrowser:!0})},"..."),this.renderFileBrowser())}}class Nb extends F{componentDidMount(){super.componentDidMount();const e=F.getValue(this.props.data,this.props.attr);this.props.oContext.socket.getEnums("functions").then(t=>{const s=Object.keys(t).map(r=>({value:this.props.schema.short?r.replace("enum.functions.",""):r,label:this.getText(t[r].common.name),obj:t[r]}));this.props.schema.allowDeactivate!==!1&&s.unshift({label:x.t(F.NONE_LABEL),value:F.NONE_VALUE}),this.setState({value:e,selectOptions:s})})}renderItem(e,t){if(!this.state.selectOptions)return null;const s=this.state.selectOptions.find(r=>r.value===this.state.value);return c.createElement(_e,{variant:"standard",fullWidth:!0},this.props.schema.label?c.createElement(Ke,null,this.getText(this.props.schema.label)):null,c.createElement(st,{variant:"standard",error:!!e,disabled:!!t,value:this.state.value||"_",renderValue:()=>s?s.obj?c.createElement(xr,{value:s.obj,themeType:this.props.oContext.themeType,lang:x.getLanguage()}):s.label:"",onChange:r=>{this.setState({value:r.target.value==="_"?"":r.target.value},()=>this.onChange(this.props.attr,this.state.value))}},this.state.selectOptions.map(r=>c.createElement(ze,{key:r.value,value:r.value,style:r.value===F.DIFFERENT_VALUE?{opacity:.5}:{}},r.obj?c.createElement(xr,{value:r.obj,themeType:this.props.oContext.themeType,lang:x.getLanguage()}):r.label))),this.props.schema.help?c.createElement(Be,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class Bb extends F{iframeRef=c.createRef();observer=null;componentDidMount(){super.componentDidMount(),this.props.schema.reloadOnShow&&(this.observer=new IntersectionObserver(([e])=>{if(e.isIntersecting&&this.state.isVisible===!1&&this.iframeRef.current){const t=this.iframeRef.current.src;this.iframeRef.current.src="",setTimeout(()=>{this.iframeRef.current&&(this.iframeRef.current.src=t)},0)}this.setState({isVisible:e.isIntersecting})}),this.iframeRef.current&&this.observer.observe(this.iframeRef.current))}componentWillUnmount(){var e,t;(e=super.componentWillUnmount)==null||e.call(this),(t=this.observer)==null||t.disconnect()}renderItem(e,t){const s=this.props.schema.url||F.getValue(this.props.data,this.props.attr);return c.createElement("div",{style:{position:"relative",width:"100%",height:"100%"}},c.createElement("iframe",{style:{width:"100%",height:"100%",borderWidth:this.props.schema.frameBorder??0,...this.props.schema.innerStyle,border:e?"1px solid red":void 0},ref:this.iframeRef,src:s,allowFullScreen:this.props.schema.allowFullscreen??!1,sandbox:this.props.schema.sandbox,loading:this.props.schema.lazyLoad??"lazy"}),t&&c.createElement("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(255, 255, 255, 0.3)",cursor:"not-allowed",zIndex:1}}))}}class Mb extends F{initialized=!1;localContext;iframeRef=c.createRef();observer=null;componentDidMount(){super.componentDidMount(),this.askInstance(),this.props.schema.reloadOnShow&&(this.observer=new IntersectionObserver(([e])=>{if(e.isIntersecting&&this.state.isVisible===!1&&this.iframeRef.current){const t=this.iframeRef.current.src;this.iframeRef.current.src="",setTimeout(()=>{this.iframeRef.current&&(this.iframeRef.current.src=t)},0)}this.setState({isVisible:e.isIntersecting})}),this.iframeRef.current&&this.observer.observe(this.iframeRef.current))}askInstance(){if(this.props.alive){let e=this.props.schema.data;if(e===void 0&&this.props.schema.jsonData){const t=this.getPattern(this.props.schema.jsonData,null,!0);if(t)try{e=JSON.parse(t)}catch{console.error(`Cannot parse json data: ${JSON.stringify(e)}`)}}e===void 0&&(e=null),this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",e).then(t=>this.setState({url:t||""}))}}getContext(){const e={};return Array.isArray(this.props.schema.alsoDependsOn)&&this.props.schema.alsoDependsOn.forEach(t=>e[t]=F.getValue(this.props.data,t)),JSON.stringify(e)}renderItem(e,t){if(this.props.alive){const s=this.getContext();(s!==this.localContext||!this.initialized)&&(this.localContext=s,setTimeout(()=>this.askInstance(),this.initialized?300:50),this.initialized=!0)}return this.state.url===void 0?null:c.createElement("div",{style:{position:"relative",width:"100%",height:"100%"}},c.createElement("iframe",{style:{width:"100%",height:"100%",borderWidth:this.props.schema.frameBorder??0,...this.props.schema.innerStyle,border:e?"1px solid red":void 0},ref:this.iframeRef,src:this.state.url,allowFullScreen:this.props.schema.allowFullscreen??!1,sandbox:this.props.schema.sandbox,loading:this.props.schema.lazyLoad??"lazy"}),t&&c.createElement("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(255, 255, 255, 0.3)",cursor:"not-allowed",zIndex:1}}))}}class $b extends F{componentDidMount(){super.componentDidMount(),this.props.oContext.socket.getHostByIp(this.props.common.host).then(e=>{this.props.schema.listenOnAllPorts||(e=e.filter(t=>t.address!=="0.0.0.0"&&t.address!=="::")),this.props.schema.onlyIp4?e=e.filter(t=>t.family==="ipv4"):this.props.schema.onlyIp6&&(e=e.filter(t=>t.family==="ipv6")),this.props.schema.noInternal&&(e=e.filter(t=>!t.internal)),e.forEach(t=>{t.address==="0.0.0.0"?t.name=`[IPv4] 0.0.0.0 - ${x.t("ra_Listen on all IPs")}`:t.address==="::"&&(t.name=`[IPv6] :: - ${x.t("ra_Listen on all IPs")}`)}),this.setState({ips:e})}).catch(e=>console.error(e))}renderItem(e,t){var o,i;const s=F.getValue(this.props.data,this.props.attr),r=(o=this.state.ips)==null?void 0:o.find(a=>a.address===s);return c.createElement(_e,{fullWidth:!0,variant:"standard"},this.state.ips&&this.props.schema.label?c.createElement(Ke,null,this.getText(this.props.schema.label)):null,this.state.ips?c.createElement(st,{variant:"standard",error:!!e,disabled:!!t,value:s,renderValue:a=>(r==null?void 0:r.name)||a,onChange:a=>this.onChange(this.props.attr,a.target.value)},(i=this.state.ips)==null?void 0:i.map((a,l)=>c.createElement(ze,{key:l,value:a.address},a.name))):c.createElement(xe,{fullWidth:!0,variant:"standard",error:!!e,disabled:!!t,value:s,onChange:a=>this.onChange(this.props.attr,a.target.value),label:this.getText(this.props.schema.label)}),this.props.schema.help?c.createElement(Be,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class Lb extends F{initialized=!1;localContext;componentDidMount(){super.componentDidMount(),this.props.schema.sendFirstByClick||this.askInstance()}askInstance(){if(this.props.alive){let e=this.props.schema.data;if(e===void 0&&this.props.schema.jsonData){const t=this.getPattern(this.props.schema.jsonData,null,!0);if(t)try{e=JSON.parse(t)}catch{console.error(`Cannot parse json data: ${JSON.stringify(e)}`)}}e===void 0&&(e=null),this.setState({loading:!0},()=>this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",e).then(t=>this.setState({image:t||""})))}}getContext(){const e={};return Array.isArray(this.props.schema.alsoDependsOn)&&this.props.schema.alsoDependsOn.forEach(t=>e[t]=F.getValue(this.props.data,t)),JSON.stringify(e)}renderItem(){if(this.props.alive){const e=this.getContext();(e!==this.localContext||!this.initialized)&&(this.localContext=e,(!this.props.schema.sendFirstByClick||this.state.image!==void 0)&&setTimeout(()=>this.askInstance(),this.initialized?300:50),this.initialized=!0)}return!this.state.image&&this.props.schema.sendFirstByClick?c.createElement("div",{style:{width:this.props.schema.width||"100%",height:this.props.schema.height,display:"flex",alignItems:"center",justifyContent:"center",cursor:this.state.loading?"default":"pointer"},onClick:()=>!this.state.loading&&this.askInstance()},this.state.loading?c.createElement(rs,null):typeof this.props.schema.sendFirstByClick=="boolean"?x.t("ra_Click to show"):this.getText(this.props.schema.sendFirstByClick,this.props.schema.noTranslation)):this.state.image===void 0?null:c.createElement("img",{title:this.getText(this.props.schema.tooltip),alt:"dynamic content",src:this.state.image,style:{width:this.props.schema.width||"100%",height:this.props.schema.height}})}}class Vb extends F{index;constructor(e){super(e),this.index=Date.now()}componentDidMount(){if(super.componentDidMount(),this.props.schema.base64){const e=F.getValue(this.props.data,this.props.attr);this.setState({value:e})}else this.props.oContext.socket.fileExists(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.attr).then(e=>e&&this.loadImage())}_getUrl(e){e&&(this.index=Date.now());let t=`files/${this.props.oContext.adapterName}.${this.props.oContext.instance}/${this.props.attr}?t=${this.index}`;return window.location.port==="3000"&&(t=`${window.location.protocol}//${window.location.hostname}:8081/${t}`),t}loadImage(){fetch(this._getUrl()).then(e=>e.blob()).then(e=>{const t=new FileReader;t.onload=()=>{this.setState({value:t.result})},t.readAsDataURL(e)}).catch(e=>console.error(e))}renderItem(e,t){return c.createElement(_e,{fullWidth:!0,variant:"standard"},this.props.schema.label?c.createElement(Ke,{shrink:!0},this.getText(this.props.schema.label)):null,c.createElement(wh,{error:!!e,disabled:t,accept:this.props.schema.accept,crop:this.props.schema.crop,maxSize:this.props.schema.maxSize||256*1024,icon:this.state.value||void 0,removeIconFunc:()=>this.setState({value:null},()=>{if(this.props.schema.base64){const s=this.onChange(this.props.attr,this.state.value);s instanceof Promise&&s.catch(r=>console.error(`Cannot set value: ${r}`))}else this.props.oContext.socket.deleteFile(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.attr).catch(s=>console.error(s))}),onChange:s=>this.setState({value:s},()=>{if(this.props.schema.base64){const r=this.onChange(this.props.attr,this.state.value);r instanceof Promise&&r.catch(o=>console.error(`Cannot set value: ${o}`))}else s.startsWith("data")&&(s=s.split(",")[1]);this.props.oContext.socket.writeFile64(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.attr,s).catch(r=>console.error(r))})}),this.props.schema.help?c.createElement(Be,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class Rb extends F{renderItem(){return c.createElement(Eh,{type:this.props.schema.boxType||"info",closeable:this.props.schema.closeable!==void 0?this.props.schema.closeable:!0,storeId:this.props.schema.closed!==void 0?void 0:`${!!this.props.oContext.adapterName} ${this.props.attr}`,closed:this.props.schema.closed,style:{width:"100%",...this.props.schema.style}},this.props.schema.title?c.createElement(Ze,{component:"div",sx:{fontWeight:"bold",fontSize:"larger"}},this.getText(this.props.schema.title)):null,this.getText(this.props.schema.text))}}const va={icon:{width:20,height:20,marginRight:4}};class jb extends F{componentDidMount(){super.componentDidMount();const e=F.getValue(this.props.data,this.props.attr);let t=this.props.schema.adapter;t==="_dataSources"&&(t=void 0),this.props.oContext.socket.getAdapterInstances(t,!0).then(async s=>{this.props.schema.adapter==="_dataSources"?s=s.filter(o=>{var i;return(i=o==null?void 0:o.common)==null?void 0:i.getHistory}):this.props.schema.adapter?s=s.filter(o=>o==null?void 0:o._id.startsWith(`system.adapter.${this.props.schema.adapter}.`)):this.props.schema.adapters&&Array.isArray(this.props.schema.adapters)&&(s=s.filter(o=>{var i;return this.props.schema.adapters.includes((i=o==null?void 0:o.common)==null?void 0:i.name)})),this.props.schema.onlyEnabled&&(s=s.filter(o=>{var i;return(i=o==null?void 0:o.common)==null?void 0:i.enabled}));const r=s.map(o=>({value:this.props.schema.long?o._id:this.props.schema.short?o._id.split(".").pop():o._id.replace(/^system\.adapter\./,""),label:`${o.common.name} [${o._id.replace(/^system\.adapter\./,"")}]`,icon:`adapter/${o.common.name}/${o.common.icon}`}));r.sort((o,i)=>o.value>i.value?1:o.value<i.value?-1:0),this.props.schema.allowDeactivate!==!1&&r.unshift({label:x.t(F.NONE_LABEL),value:F.NONE_VALUE}),this.props.schema.all&&r.unshift({label:x.t("sch_all"),value:"*"}),this.setState({value:e||"",selectOptions:r}),await this.props.oContext.socket.subscribeObject(`system.adapter.${t?`${t}.`:""}*`,this.onInstancesUpdate)}).catch(s=>console.error(`Cannot get instances: ${s}`))}componentWillUnmount(){this.props.oContext.socket.unsubscribeObject("system.adapter.*",this.onInstancesUpdate).then(()=>{}),super.componentWillUnmount()}onInstancesUpdate=(e,t)=>{if(!e.match(/^system\.adapter\.[-_a-z\d]+\.\d+$/))return;const s=this.props.schema.long?e:this.props.schema.short?e.split(".").pop():e.replace(/^system\.adapter\./,""),r=this.state.selectOptions.findIndex(o=>o.value===s);if(t){if(this.props.schema.adapter==="_dataSources"&&(!t.common||!t.common.getHistory))return;if(r===-1){const o=JSON.parse(JSON.stringify(this.state.selectOptions)),i=typeof t.common.name=="object"?t.common.name[x.getLanguage()]||t.common.name.en:t.common.name;o.push({value:this.props.schema.long?t._id:this.props.schema.short?t._id.split(".").pop():t._id.replace(/^system\.adapter\./,""),label:`${i} [${t._id.replace(/^system\.adapter\./,"")}]`,icon:`adapter/${i}/${t.common.icon}`}),o.sort((a,l)=>a.label>l.label?1:a.label<l.label?-1:0),this.setState({selectOptions:o})}}else if(r!==-1){const o=JSON.parse(JSON.stringify(this.state.selectOptions)),i={};this.state.value===o[r].value&&(i.value=F.NONE_VALUE),o.splice(r,1),i.selectOptions=o,this.setState(i)}};renderItem(e,t){var r;if(!this.state.selectOptions)return null;const s=(r=this.state.selectOptions)==null?void 0:r.find(o=>o.value===this.state.value);return c.createElement(_e,{fullWidth:!0,key:this.props.attr,variant:"standard"},this.props.schema.label?c.createElement(Ke,{shrink:!0},this.getText(this.props.schema.label)):null,c.createElement(st,{variant:"standard",error:!!e,displayEmpty:!0,disabled:!!t,value:this.state.value,renderValue:()=>c.createElement("span",{style:{display:"flex"}},s!=null&&s.icon?c.createElement("img",{src:`./${s.icon}`,alt:s.value,style:va.icon}):null,this.getText(s==null?void 0:s.label,!0)),onChange:o=>this.setState({value:o.target.value},()=>this.onChange(this.props.attr,this.state.value))},this.state.selectOptions.map(o=>c.createElement(ze,{key:o.value,value:o.value,style:o.value===F.NONE_VALUE?{opacity:.5}:{}},o.icon?c.createElement("img",{src:`./${o.icon}`,alt:o.value,style:va.icon}):null,this.getText(o.label,!0)))),this.props.schema.help?c.createElement(Be,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const wa={address:{fontSize:"smaller",opacity:.5,marginLeft:8}};class Ub extends F{componentDidMount(){super.componentDidMount(),this.props.oContext.socket.getObject(`system.host.${this.props.common.host}`).then(e=>{var s,r;const t=[];if((r=(s=e==null?void 0:e.native)==null?void 0:s.hardware)!=null&&r.networkInterfaces){const o=e.native.hardware.networkInterfaces;Object.keys(o).forEach(i=>{if(this.props.schema.ignoreInternal&&!o[i].find(l=>!l.internal)||this.props.schema.ignoreLoopback&&o[i].find(l=>l.address==="127.0.0.1"||l.address==="::1"))return;let a=o[i].find(l=>l.family==="IPv4");a||=o[i].find(l=>l.family==="IPv6"),t.push({value:i,address:a.address})})}this.setState({interfaces:t})}).catch(e=>window.alert(`Cannot read interfaces: ${e}`))}renderItem(e,t){var o,i,a;const s=F.getValue(this.props.data,this.props.attr),r=(o=this.state.interfaces)==null?void 0:o.find(l=>l.value===s);return c.createElement(_e,{fullWidth:!0,variant:"standard"},(i=this.state.interfaces)!=null&&i.length&&this.props.schema.label?c.createElement(Ke,null,this.getText(this.props.schema.label)):null,(a=this.state.interfaces)!=null&&a.length?c.createElement(st,{variant:"standard",error:!!e,disabled:!!t,value:s,renderValue:l=>r?c.createElement("span",null,r.value,c.createElement("span",{style:wa.address},r.address)):l,onChange:l=>this.onChange(this.props.attr,l.target.value)},this.state.interfaces.map((l,u)=>c.createElement(ze,{key:u,value:l.value},c.createElement("span",null,l.value,c.createElement("span",{style:wa.address},l.address))))):c.createElement(xe,{fullWidth:!0,variant:"standard",error:!!e,disabled:!!t,value:s,onChange:l=>this.onChange(this.props.attr,l.target.value),label:this.getText(this.props.schema.label)}),this.props.schema.help?c.createElement(Be,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Ps={modalDialog:{minWidth:400,maxWidth:800},overflowHidden:{display:"flex",overflow:"hidden"},titleIcon:{marginRight:5},content:{fontSize:16},languageButton:{position:"absolute",right:8,top:8},languageButtonActive:{color:"primary.main"}},Ai=({toggleTranslation:n,noTranslation:e,title:t,fullWidth:s,help:r,maxWidth:o,progress:i,icon:a,applyDisabled:l,applyButton:u,onClose:d,children:h,titleButtonApply:p,titleButtonClose:g,onApply:m,textInput:f,defaultValue:y,overflowHidden:b})=>{const[C,D]=Dt(y);Oe(()=>{D(y)},[y]);const v=Au(),E=Fu(v.breakpoints.down("md"));let A=null;return a&&(A=a),c.createElement(os,{open:!0,maxWidth:E?!1:o||"md",fullWidth:!!s,fullScreen:E,disableEscapeKeyDown:!1,onClose:d,sx:{"& .MuiPaper-root":E?{}:Ps.modalDialog}},t&&c.createElement(Qs,null,a?c.createElement(A,{style:Ps.titleIcon}):null,t,x.getLanguage()!=="en"&&n?c.createElement(fe,{size:"large",style:{...Ps.languageButton,...e?Ps.languageButtonActive:{}},onClick:()=>n(),title:x.t("ra_Disable/Enable translation")},c.createElement(Zu,null)):null),c.createElement(Cs,{sx:{...b?Ps.overflowHidden:{},...Ps.content},style:{paddingTop:8}},f&&c.createElement(xe,{autoComplete:"off",fullWidth:!0,autoFocus:!0,variant:"outlined",size:"medium",multiline:!0,value:C,onChange:S=>D(S.target.value)}),h,r?c.createElement("div",null,r):null),c.createElement(Ds,null,u!==!1&&c.createElement(Ne,{startIcon:c.createElement(ii,null),disabled:i||l&&y===C,onClick:()=>m&&m(f?C:""),variant:"contained",color:"primary"},x.t(p||"ra_Ok")),c.createElement(Ne,{color:"grey",onClick:()=>d&&d(),disabled:i,variant:"contained",startIcon:c.createElement(Mt,null)},x.t(g||"ra_Cancel"))))},ko={flex:{display:"flex"},button:{height:48,minWidth:48},wrapper:{width:"calc(100vw - 40px)",height:"calc(100vh - 188px)"}};class Wb extends F{componentDidMount(){super.componentDidMount();const{data:e,attr:t}=this.props,s=F.getValue(e,t)||"{}";this.setState({value:s,initialized:!0,jsonError:this.validateJson(s)})}validateJson(e){let t=!1;if(this.props.schema.validateJson!==!1&&(e||!this.props.schema.allowEmpty))try{this.props.schema.json5?xl.parse(e):JSON.parse(e)}catch(s){console.log("Error in JSON",s),t=!0}return t}renderItem(e,t){if(!this.state.initialized)return null;const{schema:s,data:r,attr:o}=this.props,{value:i,showSelectId:a}=this.state,l=s.readOnly===!0||t;return c.createElement(_e,{fullWidth:!0,variant:"standard"},c.createElement("div",{style:ko.flex},c.createElement(Ne,{color:"grey",style:ko.button,size:"small",variant:"outlined",onClick:()=>this.setState({showSelectId:!0})},x.t("ra_JSON editor"))),a?c.createElement(Ai,{title:this.getText(s.label),overflowHidden:!0,applyDisabled:this.state.jsonError&&this.props.schema.doNotApplyWithError||l,onClose:()=>{l?this.setState({showSelectId:!1}):this.setState({showSelectId:!1,value:F.getValue(r,o)||{}})},onApply:l?void 0:()=>this.setState({showSelectId:!1},()=>this.onChange(o,i))},c.createElement("div",{style:{...ko.wrapper,border:this.state.jsonError?"2px solid red":"2px solid transparent"}},c.createElement(ui,{mode:this.props.schema.json5?"json5":"json",value:typeof i=="object"?JSON.stringify(i):i,onChange:l?void 0:u=>this.setState({value:u,jsonError:this.validateJson(u)}),name:"ConfigJsonEditor",themeType:this.props.oContext.themeType}))):null,s.help||this.state.jsonError?c.createElement(Be,null,this.state.jsonError?x.t("ra_Invalid JSON"):this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const zb=[{value:"en",label:"English"},{value:"de",label:"Deutsch"},{value:"ru",label:"русский"},{value:"pt",label:"Portugues"},{value:"nl",label:"Nederlands"},{value:"fr",label:"français"},{value:"it",label:"Italiano"},{value:"es",label:"Espanol"},{value:"pl",label:"Polski"},{value:"uk",label:"Український"},{value:"zh-cn",label:"简体中文"}];class Hb extends F{componentDidMount(){super.componentDidMount();const e=F.getValue(this.props.data,this.props.attr),t=[...zb];this.props.schema.system?t.unshift({value:"",label:x.t("ra_System language")}):t.unshift({value:"",label:x.t("ra_none")}),this.setState({value:this.props.schema.system?e||"":e||x.getLanguage(),selectOptions:t})}renderItem(e,t){var r,o;if(!this.state.selectOptions)return null;const s=(r=this.state.selectOptions)==null?void 0:r.find(i=>i.value===this.state.value||!i.value&&!this.state.value);return c.createElement(_e,{fullWidth:!0,variant:"standard"},this.props.schema.label?c.createElement(Ke,null,this.getText(this.props.schema.label)):null,c.createElement(st,{variant:"standard",error:!!e,disabled:t,value:this.state.value||"_",renderValue:()=>this.getText(s==null?void 0:s.label,this.props.schema.noTranslation),onChange:i=>{let{value:a}=i.target;a==="_"&&(a=""),this.setState({value:a},()=>{const l=this.onChange(this.props.attr,a);if(l instanceof Promise&&l.catch(u=>console.error(u)),this.props.schema.changeGuiLanguage)if(a){if(a===x.getLanguage())return;x.setLanguage(a),this.props.oContext.changeLanguage&&this.props.oContext.changeLanguage()}else this.props.oContext.socket.getSystemConfig().then(u=>{u.common.language!==x.getLanguage()&&u.common.language&&(x.setLanguage(u.common.language),this.props.oContext.changeLanguage&&this.props.oContext.changeLanguage())}).catch(u=>console.error(`Cannot read system config: ${u}`))})}},(o=this.state.selectOptions)==null?void 0:o.map(i=>c.createElement(ze,{key:i.value,value:i.value},i.label))),this.props.schema.help?c.createElement(Be,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class Jb extends F{scrollRef;constructor(e){super(e),this.scrollRef=c.createRef()}scrolledDown(){return this.scrollRef.current?this.scrollRef.current.offsetHeight+this.scrollRef.current.scrollTop>=this.scrollRef.current.scrollHeight:!1}componentDidMount(){super.componentDidMount(),F.getValue(this.props.data,this.props.attr)||(this.props.schema.licenseUrl?(this.setState({showLicenseDialog:!0,loading:!0,scrolledDown:!1}),fetch(this.props.schema.licenseUrl).then(e=>e.text()).then(e=>this.setState({license:e,loading:!1})).catch(e=>this.setState({license:e.toString(),loading:!1,error:!0,scrolledDown:!1}))):this.setState({showLicenseDialog:!0,scrolledDown:!1}),setTimeout(()=>{this.scrollRef.current&&(this.scrolledDown()?this.setState({scrolledDown:!0}):this.scrollRef.current.addEventListener("scroll",()=>{!this.state.scrolledDown&&this.scrolledDown()&&this.setState({scrolledDown:!0})}))},1e3))}renderItem(e,t){return this.state.showLicenseDialog?c.createElement(os,{maxWidth:"lg",open:!0,onClose:(s,r)=>{r!=="escapeKeyDown"&&r!=="backdropClick"&&this.setState({showLicenseDialog:!1})}},c.createElement(Qs,null,this.props.schema.title?x.t(this.props.schema.title):x.t("ra_License agreement")),c.createElement(Cs,null,this.props.schema.licenseUrl?c.createElement(c.Fragment,null,this.state.loading?c.createElement(Nr,null):null,c.createElement("pre",{ref:this.scrollRef,style:{width:"100%",height:"100%",overflowY:"auto",fontSize:14}},this.state.license)):null,!this.props.schema.licenseUrl&&this.props.schema.texts?c.createElement("div",{ref:this.scrollRef,style:{width:"100%",height:"100%",overflowY:"auto",fontSize:14}},this.props.schema.texts.map((s,r)=>this.props.schema.noTranslation?c.createElement("p",{key:r},s):c.createElement("p",{key:r},x.t(s)))):null),c.createElement(Ds,null,this.props.schema.checkBox?c.createElement(jn,{control:c.createElement(Ts,{disabled:t,checked:!!this.state.licenseChecked,onClick:()=>this.setState({licenseChecked:!this.state.licenseChecked})}),label:x.t(this.props.schema.checkBox)}):null,c.createElement(Ne,{disabled:t||this.state.loading||this.state.error||this.props.schema.checkBox&&!this.state.licenseChecked||!this.state.scrolledDown,onClick:()=>{this.setState({showLicenseDialog:!1});const s=this.onChange(this.props.attr,!0);s instanceof Promise&&s.catch(r=>console.error(`Cannot set value: ${r}`))},color:"primary",variant:"contained",startIcon:c.createElement(ii,null)},this.props.schema.agreeText?x.t(this.props.schema.agreeText):x.t("ra_Accept license")),c.createElement(Ne,{onClick:()=>{this.setState({showLicenseDialog:!1}),setTimeout(()=>this.setState({showLicenseDialog:!0}),2e3)},color:"grey",variant:"contained",startIcon:c.createElement(Mt,null)},x.t("ra_Close")))):null}}const Ea={indeterminate:{opacity:.5},control:{flexDirection:"row",width:"100%"}};class Kb extends F{updateTimeout;componentDidMount(){super.componentDidMount();let e=F.getValue(this.props.data,this.props.attr);if(e==null&&(e=""),Array.isArray(e)&&this.props.oContext.multiEdit){e=F.DIFFERENT_VALUE,this.setState({_value:e,oldValue:e});return}this.setState({_value:e.toString(),oldValue:e.toString()})}static getDerivedStateFromProps(e,t){if(e.schema.min!==void 0&&e.schema.min<0||e.schema.max!==void 0&&e.schema.max<0)return null;const s=F.getValue(e.data,e.attr);return e.oContext.multiEdit&&t._value===F.DIFFERENT_VALUE?{_value:F.DIFFERENT_VALUE}:s==null||t.oldValue===null||t.oldValue===void 0||s.toString()!==parseFloat(t._value).toString()&&s.toString()!==t.oldValue.toString()?{_value:s}:null}checkValue(e){if(e==null||(e=e.toString().trim().replace(",","."),e==="-"))return null;const t=e===""?0:parseFloat(e);return e!==""&&Number.isNaN(t)?"ra_Not a number":e!==""&&window.isFinite(t)?this.props.schema.min!==void 0&&t<this.props.schema.min?"ra_Too small":this.props.schema.max!==void 0&&t>this.props.schema.max?"ra_Too big":e===""||e==="-"||Number.isNaN(t)?"ra_Not a number":null:"ra_Not a number"}renderItem(e,t){var o;const s=Array.isArray(this.state._value)||this.state._value===F.DIFFERENT_VALUE;if(this.state.oldValue!==null&&this.state.oldValue!==void 0?(this.updateTimeout&&clearTimeout(this.updateTimeout),this.updateTimeout=setTimeout(()=>{this.updateTimeout=void 0,this.setState({oldValue:null})},30)):this.updateTimeout&&(clearTimeout(this.updateTimeout),this.updateTimeout=void 0),s){const i=F.getValue(this.props.data,this.props.attr),a=(i==null?void 0:i.filter(l=>l||l===0).map(l=>({label:l.toString(),value:l})))||[];return a.unshift({label:x.t(F.DIFFERENT_LABEL),value:F.DIFFERENT_VALUE}),c.createElement(Pr,{style:Ea.indeterminate,fullWidth:!0,freeSolo:!0,value:a[0],getOptionSelected:(l,u)=>l.label===u.label,onChange:(l,u)=>{const d=this.onChange(this.props.attr,u==null?void 0:u.value,()=>{this.setState({_value:u==null?void 0:u.value,oldValue:this.state._value})});d instanceof Promise&&d.catch(h=>console.error(h))},options:a,getOptionLabel:l=>l.label,renderInput:l=>c.createElement(xe,{...l,label:this.getText(this.props.schema.label),variant:"standard",slotProps:{htmlInput:{...l.inputProps,readOnly:this.props.schema.readOnly||!1},input:{endAdornment:this.props.schema.unit?this.getText(this.props.schema.unit,this.props.schema.noTranslation):void 0}},error:!!e,placeholder:this.getText(this.props.schema.placeholder),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation),disabled:!!t})})}!e&&this.state._value!==null&&this.state._value!==void 0&&this.state._value&&(e=this.checkValue(this.state._value),e&&(e=x.t(e)));const r=parseFloat(((o=this.state._value)==null?void 0:o.toString().replace(",","."))||"");return c.createElement(_e,{variant:"standard",style:Ea.control},c.createElement(xe,{sx:{"& .up-down":{display:"none"},"&:hover .up-down":{display:"block"}},variant:"standard",type:Number.isNaN(r)?"text":this.props.schema.min!==void 0&&this.props.schema.min>=0?"number":"text",fullWidth:!0,slotProps:{htmlInput:{min:this.props.schema.min,max:this.props.schema.max,step:this.props.schema.step,readOnly:this.props.schema.readOnly||!1},input:{endAdornment:this.props.schema.unit?this.getText(this.props.schema.unit,this.props.schema.noTranslation):null}},value:this.state._value===null||this.state._value===void 0?"":this.state._value,error:!!e,disabled:!!t,onChange:i=>{const a=i.target.value,l=this.checkValue(a);l?this.onError(this.props.attr,x.t(l)):this.onError(this.props.attr),this.setState({_value:a,oldValue:this.state._value},()=>{const u=parseFloat(a.toString().replace(",","."));Number.isNaN(u)?this.onChange(this.props.attr,a.toString().replace(",",".")):this.onChange(this.props.attr,u)})},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:e&&typeof e=="string"?e:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)}))}}class qb extends F{authWindow;oid;url;constructor(e){super(e),this.state={...this.state,accessTokens:"",success:!1,blocked:!1,running:!1,pressed:!1,clientId:"",clientSecret:"",accessTokenError:""},this.url=`https://oauth2.iobroker.in/${e.schema.identifier}?redirect=true`,e.schema.scope&&(this.url+=`&scope=${encodeURIComponent(e.schema.scope)}`),this.oid=`${this.props.oContext.adapterName}.${this.props.oContext.instance}.${this.props.schema.saveTokenIn||"oauth2Tokens"}`}async componentDidMount(){super.componentDidMount(),window.addEventListener?window.addEventListener("message",this.onMessage,!1):window.attachEvent("onmessage",this.onMessage,!1),await this.props.oContext.socket.subscribeState(this.oid,this.onTokensUpdated);let e;this.props.schema.ownClientId&&(e={clientId:F.getValue(this.props.data,this.props.schema.ownClientId)}),this.props.schema.ownClientId&&(e||={},e.clientSecret=F.getValue(this.props.data,this.props.schema.ownClientSecret));const t=await this.props.oContext.socket.getState(this.oid);if(t){const s=JSON.parse(t.val);new Date(s.access_token_expires_on).getTime()>Date.now()&&(e||={},e.accessTokens=t.val)}e&&this.setState(e)}onTokensUpdated=(e,t)=>{if(t!=null&&t.val){const s=JSON.parse(t.val);if(new Date(s.access_token_expires_on).getTime()>Date.now()){this.state.accessTokens!==t.val&&this.setState({accessTokens:t.val});return}}this.setState({accessTokens:""})};componentWillUnmount(){super.componentWillUnmount(),window.removeEventListener?window.removeEventListener("message",this.onMessage,!1):window.detachEvent("onmessage",this.onMessage,!1),this.props.oContext.socket.unsubscribeState(this.oid,this.onTokensUpdated)}saveToken(e){try{e&&!e.startsWith("{")&&(e=atob(e));const t=JSON.parse(e);t.access_token&&t.refresh_token&&t.expires_in&&(t.access_token_expires_on||=new Date(Date.now()+t.expires_in*1e3).toISOString(),this.props.schema.ownClientId&&(t.client_id=F.getValue(this.props.data,this.props.schema.ownClientId)),this.props.oContext.socket.setState(this.oid,JSON.stringify(t),!0).catch(s=>console.log(`Error occurred: ${s.toString()}`)))}catch(t){console.warn(t)}}onMessage=e=>{var t,s,r;if(e.origin==="https://oauth2.iobroker.in"&&(typeof e.data=="string"&&e.data.startsWith(`${this.props.schema.identifier}-authentication:`)||typeof e.message=="string"&&e.message.startsWith(`${this.props.schema.identifier}-authentication:`))){const o=(e.data||e.message).split(":");o[1]==="success"?(this.setState({accessTokens:o[2],success:!0,pressed:!1},()=>this.saveToken(this.state.accessTokens)),(t=this.authWindow)==null||t.postMessage("close",e.origin),this.authWindow=null):(r=(s=this.props).onError)==null||r.call(s,o[2])}};onOpenUrl(){this.authWindow=window.open(this.url+(this.props.schema.ownClientId?`&client_id=${encodeURIComponent(this.state.clientId)}&client_secret=${encodeURIComponent(this.state.clientSecret)}`:""),this.props.schema.identifier),!this.authWindow||this.authWindow.closed||typeof this.authWindow.closed>"u"?this.setState({blocked:!0}):this.setState({pressed:!0})}renderItem(e,t){let s="";if(this.state.accessTokens)try{const i=JSON.parse(this.state.accessTokens);s=new Date(i.access_token_expires_on).toLocaleString()}catch{}let r;this.state.accessTokens?r=this.props.schema.refreshLabel?this.getText(this.props.schema.refreshLabel):x.t("ra_Renew %s access",this.props.schema.identifier[0].toUpperCase()+this.props.schema.identifier.slice(1)):r=this.props.schema.label?this.getText(this.props.schema.label):x.t("ra_Get %s access",this.props.schema.identifier[0].toUpperCase()+this.props.schema.identifier.slice(1));const o=this.getIcon();return c.createElement("div",{style:{width:"100%",margin:"0 0 1rem 0"}},this.props.schema.ownClientId?c.createElement(xe,{value:this.state.clientId,onChange:i=>{const a=i.target.value;this.setState({clientId:a},()=>this.onChange(this.props.schema.ownClientId,a))},style:{marginBottom:8},variant:"standard",fullWidth:!0,error:!this.state.clientId,disabled:!!t,label:x.t("ra_OAuth Client ID"),slotProps:{input:{endAdornment:this.state.clientId?c.createElement(fe,{size:"small",tabIndex:-1,onClick:()=>this.setState({clientId:""},()=>this.onChange(this.props.schema.ownClientId,""))},c.createElement(Mt,null)):null}}}):null,this.props.schema.ownClientSecret?c.createElement(xe,{value:this.state.clientSecret,onChange:i=>{const a=i.target.value;this.setState({clientSecret:a},()=>this.onChange(this.props.schema.ownClientSecret,a))},style:{marginBottom:8},variant:"standard",fullWidth:!0,error:!this.state.clientSecret,disabled:!!t,label:x.t("ra_OAuth Client secret"),slotProps:{input:{endAdornment:this.state.clientSecret?c.createElement(fe,{size:"small",tabIndex:-1,onClick:()=>this.setState({clientSecret:""},()=>this.onChange(this.props.schema.ownClientSecret,""))},c.createElement(Mt,null)):null}}}):null,c.createElement(Ne,{disabled:this.state.running||this.props.schema.ownClientSecret&&!this.state.clientSecret||this.props.schema.ownClientId&&!this.state.clientId,endIcon:o||c.createElement(eh,null),variant:"contained",onClick:()=>this.onOpenUrl()},r),this.state.blocked?c.createElement("div",{style:{color:"red",fontSize:16,marginTop:20}},x.t("ra_Please allow popups in your browser for this page!")):null,this.state.accessTokens?c.createElement("div",{style:{color:"green",fontSize:16,marginTop:20}},this.props.alive?x.t("ra_Successfully authorized. Token valid till %s and will be automatically renewed.",s):x.t("ra_Successfully authorized. Token valid till %s but it can expire as the instance is not running.",s)):null,this.state.pressed?c.createElement(c.Fragment,null,c.createElement("div",{style:{width:"100%",margin:"1rem 0 1rem 0"}},c.createElement("span",{style:{marginRight:4}},`${x.t("ra_If the button above does not work, you can authorize manually this app by visiting this url")}`,":"),c.createElement("br",null),c.createElement("a",{target:this.props.schema.identifier,href:this.url,rel:"noreferrer"},this.url)),c.createElement(xe,{value:this.state.accessTokens,label:x.t("ra_Enter the code from that page here"),variant:"standard",error:!!this.state.accessTokenError,helperText:this.state.accessTokenError||"",onChange:i=>{let a=i.target.value;try{a!=null&&a.trim()&&!a.trim().startsWith("{")&&(a=atob(a.trim()))}catch{this.setState({accessTokenError:"Invalid access token. Cannot decode from base64"})}if(a!=null&&a.startsWith("{"))try{const l=JSON.parse(a);l.access_token&&(l.access_token_expires_on=new Date(Date.now()+(l.expires_in-10)*1e3).toISOString(),this.setState({accessTokens:JSON.stringify(l),accessTokenError:""},()=>this.saveToken(this.state.accessTokens)))}catch{this.setState({accessTokens:a,accessTokenError:"Invalid access token. Cannot parse JSON"})}else a&&this.setState({accessTokens:a,accessTokenError:"Invalid access token. Not JSON"})},fullWidth:!0})):null)}}const xa={flex:{display:"flex"},button:{maxHeight:48,marginLeft:4,minWidth:48}};class Yb extends F{fillOnSelect=[];componentDidMount(){super.componentDidMount();const{data:e,attr:t}=this.props,s=F.getValue(e,t)||"";if(this.props.schema.fillOnSelect){const r=this.props.schema.fillOnSelect.split(",").map(o=>o.trim());for(const o of r){const i=o.split("=>");if(i.length===2){const a={pathInObject:i[0],attr:i[1]};(a.attr.includes("(X)")||a.attr.includes("(x)"))&&(a.overwrite=!0,a.attr=a.attr.replace(/\(X\)|\(x\)/g,"")),this.fillOnSelect.push(a)}else console.error(`Invalid format for fillOnSelect: ${this.props.schema.fillOnSelect}`)}}this.setState({value:s,initialized:!0})}onObjectChanged=async(e,t)=>{if(await this.onChange(e,t),this.fillOnSelect.length)try{const s=await this.props.oContext.socket.getObject(t);for(const r of this.fillOnSelect)if(r.overwrite||!F.getValue(this.props.data,r.attr)){let o=F.getValue(s,r.pathInObject);typeof o=="object"&&(o=this.getText(o,!0)),await this.onChange(r.attr,o)}}catch(s){console.error(s.toString())}};renderItem(e,t){if(!this.state.initialized)return null;const s=this.props.oContext.socket,{schema:r,attr:o}=this.props,{value:i,showSelectId:a}=this.state;return c.createElement(_e,{fullWidth:!0,variant:"standard"},r.label?c.createElement(Ke,{shrink:!0},this.getText(r.label)):null,c.createElement("div",{style:xa.flex},c.createElement(xe,{variant:"standard",fullWidth:!0,value:i,error:!!e,disabled:t,placeholder:this.getText(r.placeholder),label:this.getText(r.label),helperText:this.renderHelp(r.help,r.helpLink,r.noTranslation),onChange:l=>{const u=Array.isArray(l.target.value)?l.target.value[0]:l.target.value;this.setState({value:u},()=>{this.onObjectChanged(o,u)})}}),c.createElement(Ne,{color:"grey",disabled:t,style:xa.button,size:"small",variant:"outlined",onClick:()=>this.setState({showSelectId:!0})},"...")),a?c.createElement(xh,{imagePrefix:this.props.oContext.imagePrefix===void 0?"../..":this.props.oContext.imagePrefix,dialogName:`admin.${this.props.oContext.adapterName}`,filterFunc:r.filterFunc,themeType:this.props.oContext.themeType,theme:this.props.oContext.theme,types:r.types?Array.isArray(r.types)?r.types:[r.types]:void 0,customFilter:r.customFilter,filters:r.filters,socket:s,selected:i,root:r.root,onClose:()=>this.setState({showSelectId:!1}),onOk:l=>{const u=Array.isArray(l)?l[0]:l;this.setState({showSelectId:!1,value:u},()=>{this.onObjectChanged(o,u)})}}):null)}}const To={fullWidth:{width:"100%",display:"inline-block"},halfWidth1:{width:"calc(50% - 5px)",display:"inline-block",marginRight:8},halfWidth2:{width:"calc(50% - 5px)",display:"inline-block"}},ir="____ppp____";class Gb extends F{componentDidMount(){super.componentDidMount();const e=F.getValue(this.props.data,this.props.attr);this.setState({_repeat:e?ir:"",_visible:!1,value:e?ir:"",_notEqual:!1})}onChangePassword(e,t){e===void 0&&(e=this.state.value),t===void 0&&(t=this.state._repeat);const s=!!this.props.schema.repeat&&t!==e;this.setState({value:e,_repeat:t,_notEqual:s},()=>{if(s)this.onError(this.props.attr,x.t("ra_Passwords are not equal!"));else{this.onError(this.props.attr);const r=this.onChange(this.props.attr,e);r instanceof Promise&&r.catch(o=>this.onError(this.props.attr,o))}})}renderItem(e,t){if(this.state._notEqual===void 0)return null;const s=c.createElement(xe,{variant:"standard",fullWidth:!0,type:this.state._visible&&this.state.value!==ir?"text":"password",value:this.state.value,error:!!e||this.state._notEqual,disabled:!!t,onChange:r=>this.onChangePassword(r.target.value),label:this.getText(this.props.schema.label),slotProps:{input:{autoComplete:"new-password",endAdornment:this.state.value&&this.state.value!==ir&&this.props.schema.visible&&!t&&!this.props.schema.readOnly?c.createElement(Gs,{position:"end"},c.createElement(fe,{size:"large",tabIndex:-1,onClick:r=>{r.preventDefault(),r.stopPropagation(),this.setState({_visible:!this.state._visible})},edge:"end"},this.state._visible?c.createElement(th,null):c.createElement(dl,null))):void 0},htmlInput:{autoComplete:"new-password",form:{autoComplete:"off"},maxLength:this.props.schema.maxLength||this.props.schema.max||void 0,readOnly:this.props.schema.readOnly||!1}},helperText:this.state._notEqual?x.t("ra_Passwords are not equal!"):this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)});if(this.props.schema.repeat&&!this.props.schema.readOnly){const r=this.state._visible?null:c.createElement(xe,{variant:"standard",fullWidth:!0,type:"password",value:this.state._repeat,error:!!e||this.state._notEqual,disabled:!!t,onChange:o=>this.onChangePassword(void 0,o.target.value),label:`${this.getText(this.props.schema.label)} (${x.t("ra_repeat")})`,slotProps:{input:{autoComplete:"new-password"},htmlInput:{autoComplete:"new-password",form:{autoComplete:"off"},maxLength:this.props.schema.maxLength||this.props.schema.max||void 0}},helperText:this.state._notEqual?x.t("ra_Passwords are not equal!"):this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)});return c.createElement("div",{style:To.fullWidth},c.createElement("div",{style:To.halfWidth1},s),c.createElement("div",{style:To.halfWidth2},r))}return s}}class Qb extends F{renderItem(e,t){return c.createElement(xe,{variant:"standard",fullWidth:!0,disabled:!!t,slotProps:{input:{endAdornment:this.props.schema.copyToClipboard?c.createElement(fe,{tabIndex:-1,size:"small",onClick:()=>{je.copyToClipboard(this.getPattern(this.props.schema.pattern,null,this.props.schema.noTranslation)),window.alert(x.t("ra_Copied"))}},c.createElement(li,null)):void 0}},value:this.getPattern(this.props.schema.pattern,null,!0),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}}const Xb={warning:{"& .Mui-error":{color:"orange"}}};class Zb extends F{updateTimeout;async componentDidMount(){super.componentDidMount();let e=F.getValue(this.props.data,this.props.attr);e==null&&(e=""),this.setState({_value:e.toString(),oldValue:e.toString()});const t=await this.props.oContext.socket.getAdapterInstances(),s=`system.adapter.${this.props.oContext.adapterName}.${this.props.oContext.instance}`,r=await this.props.oContext.socket.getObject(s),o=r==null?void 0:r.common.host,i=[];t.forEach(a=>{var u,d,h,p;if(!a||a._id===s||a.common.host!==o||!((u=a.native)!=null&&u.bind))return;if(a!=null&&a.native&&a.native.secure&&a.native.leEnabled&&a.native.leUpdate){const g=parseInt(a.native.leCheckPort||a.native.lePort,10);g&&i.push({name:`${a._id.replace("system.adapter.","")} (LE)`,port:g,v6bind:a.native.bind.includes(":")?a.native.bind:a.native.v6bind,bind:a.native.bind,enabled:!!((d=a.common)!=null&&d.enabled)})}const l=parseInt((h=a==null?void 0:a.native)==null?void 0:h.port,10);l&&i.push({name:a._id.replace("system.adapter.",""),bind:a.native.bind,v6bind:a.native.bind.includes(":")?a.native.bind:a.native.v6bind,port:l,enabled:!!((p=a.common)!=null&&p.enabled)})}),this.setState({ports:i})}static getDerivedStateFromProps(e,t){const s=F.getValue(e.data,e.attr);return s==null||t.oldValue===null||t.oldValue===void 0||s.toString()!==parseInt(t._value,10).toString()&&s.toString()!==t.oldValue.toString()?{_value:s}:null}checkValue(e){if(e==null)return null;const t=this.props.schema.min===void 0?20:this.props.schema.min,s=this.props.schema.max||65535;e=e.toString().trim();const r=e===""?0:parseInt(e,10);return e!==""&&Number.isNaN(r)?"ra_Not a number":e!==""&&window.isFinite(Number(e))?r<t?"ra_Too small":r>s?"ra_Too big":e===""||e==="-"||Number.isNaN(r)?"ra_Not a number":null:"ra_Not a number"}renderItem(e,t){this.state.oldValue!==null&&this.state.oldValue!==void 0?(this.updateTimeout&&clearTimeout(this.updateTimeout),this.updateTimeout=setTimeout(()=>{this.updateTimeout=void 0,this.setState({oldValue:null})},30)):this.updateTimeout&&(clearTimeout(this.updateTimeout),this.updateTimeout=void 0);const s=this.props.schema.min===void 0?20:this.props.schema.min,r=this.props.schema.max||65535;let o;if(this.state.ports){const i=parseInt(this.state._value,10);if(i){const a=this.props.data.bind,l=this.state.ports.filter(d=>{if(d.port!==i)return!1;const h=d.bind,p=d.v6bind;return!a||!h||a==="0.0.0.0"||h==="0.0.0.0"||a==="::"||p==="::"||a===h||a===p});let u=l.findIndex(d=>d.port===i&&d.enabled);if(u!==-1){const d=this.state.ports.find(h=>h.port===i&&h.enabled&&l.some(p=>p.name===h.name&&p.bind===h.bind));e=x.t("ra_Port is already used by %s",(d==null?void 0:d.name)||l[u].name)}else if(u=l.findIndex(d=>d.port===i&&!d.enabled),u!==-1){o=!0;const d=this.state.ports.find(h=>h.port===i&&!h.enabled&&l.some(p=>p.name===h.name&&p.bind===h.bind));e=x.t("ra_Port could be used by %s",(d==null?void 0:d.name)||l[u].name)}}}return!e&&this.state._value!==null&&this.state._value!==void 0&&(e=this.checkValue(this.state._value),typeof e=="string"&&(e=x.t(e))),c.createElement(xe,{variant:"standard",type:"number",fullWidth:!0,slotProps:{htmlInput:{min:s,max:r,readOnly:this.props.schema.readOnly||!1}},value:this.state._value===null||this.state._value===void 0?"":this.state._value,error:!!e,disabled:!!t,sx:o?Xb.warning:void 0,onChange:i=>{const a=Number(i.target.value.toString().replace(/[^0-9]/g,"")).toString(),l=this.checkValue(a);l?this.onError(this.props.attr,x.t(l)):this.onError(this.props.attr),this.setState({_value:a,oldValue:this.state._value},()=>{if(a.trim()===parseInt(a,10).toString()){const u=this.onChange(this.props.attr,parseInt(a,10)||0);u instanceof Promise&&u.catch(d=>{console.error(`Cannot set value for ${this.props.attr}: ${d}`)})}})},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:e&&typeof e=="string"?e:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}}class eC extends F{componentDidMount(){super.componentDidMount();const e=F.getValue(this.props.data,this.props.attr);this.props.oContext.socket.getEnums("rooms").then(t=>{const s=Object.keys(t).map(r=>({value:this.props.schema.short?r.replace("enum.rooms.",""):r,label:this.getText(t[r].common.name),obj:t[r]}));this.props.schema.allowDeactivate!==!1&&s.unshift({label:x.t(F.NONE_LABEL),value:F.NONE_VALUE}),this.setState({value:e,selectOptions:s})}).catch(t=>console.error(`Cannot get enums: ${t}`))}renderItem(e,t){if(!this.state.selectOptions)return null;const s=this.state.selectOptions.find(r=>r.value===this.state.value);return c.createElement(_e,{variant:"standard",fullWidth:!0},this.props.schema.label?c.createElement(Ke,null,this.getText(this.props.schema.label)):null,c.createElement(st,{variant:"standard",error:!!e,disabled:!!t,value:this.state.value||"_",renderValue:()=>s?s.obj?c.createElement(xr,{value:s.obj,themeType:this.props.oContext.themeType,lang:x.getLanguage()}):s.label:"",onChange:r=>{this.setState({value:r.target.value==="_"?"":r.target.value},()=>this.onChange(this.props.attr,this.state.value))}},this.state.selectOptions.map(r=>c.createElement(ze,{key:r.value,value:r.value,style:r.value===F.DIFFERENT_VALUE?{opacity:.5}:{}},r.obj?c.createElement(xr,{value:r.obj,themeType:this.props.oContext.themeType,lang:x.getLanguage()}):r.label))),this.props.schema.help?c.createElement(Be,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const tC={noMargin:{"&>div":{marginTop:0}}};class sC extends F{initialValue="";componentDidMount(){super.componentDidMount();let e=F.getValue(this.props.data,this.props.attr);this.props.schema.multiple&&(typeof e=="string"?e=[e]:e==null&&(e=[]));const t=[];if((this.props.schema.options||[]).forEach(s=>{const r=s;Array.isArray(r.items)?(t.push({label:this.getText(s.label,this.props.schema.noTranslation),value:s.value,group:!0,color:s.color,description:this.getText(s.description)}),r.items.forEach(o=>t.push({label:this.getText(o.label,this.props.schema.noTranslation),value:o.value,hidden:o.hidden,color:s.color,description:this.getText(s.description)}))):t.push({label:this.getText(s.label,this.props.schema.noTranslation),value:s.value,hidden:s.hidden,color:s.color,description:this.getText(s.description)})}),this.props.onFilterLabelUpdate&&this.props.table){const s={};for(const r of t)!r.group&&r.value!==F.DIFFERENT_VALUE&&(s[r.value.toString()]=r.label);this.props.onFilterLabelUpdate(this.props.attr,s)}Array.isArray(e)&&!this.props.schema.multiple?(this.initialValue=[...e],t.unshift({label:x.t(F.DIFFERENT_LABEL),value:F.DIFFERENT_VALUE}),this.setState({value:F.DIFFERENT_VALUE,selectOptions:t})):this.setState({value:e,selectOptions:t})}_getValue(){let e=this.state.value===null||this.state.value===void 0?F.getValue(this.props.data,this.props.attr):this.state.value;return this.props.schema.multiple&&(typeof e=="string"?e=[e]:e==null&&(e=[])),e}_filterOptions(e){return(e||[]).filter(t=>t.hidden?this.props.custom?!this.executeCustom(t.hidden,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):!this.execute(t.hidden,this.props.schema.default,this.props.data,this.props.arrayIndex,this.props.globalData):!0)}renderRadio(e,t){const s=this._filterOptions(this.state.selectOptions).filter(o=>!o.group),r=this._getValue();return c.createElement(_e,{fullWidth:!0,error:!!e,disabled:!!t,id:`jsonSelect_${this.props.attr}_${this.props.index||this.props.index===0?this.props.index:""}`},this.props.schema.label?c.createElement(Iu,null,this.getText(this.props.schema.label)):null,c.createElement(_u,{value:r==null?"":r.toString(),onChange:o=>{const i=s.find(l=>l.value.toString()===o.target.value),a=i?i.value:o.target.value;this.setState({value:a},()=>{const l=this.onChange(this.props.attr,a);l instanceof Promise&&l.catch(u=>console.error(u))})}},s.map((o,i)=>c.createElement(jn,{key:i,value:o.value.toString(),control:c.createElement(Ou,null),title:o.description||"",label:c.createElement(Ut,{component:"span",style:{color:o.color}},o.label),style:o.value===F.DIFFERENT_VALUE?{opacity:.5}:{}}))),this.props.schema.help?c.createElement(Be,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}renderItem(e,t){if(!this.state.selectOptions)return null;if(this.props.schema.format==="radio")return this.renderRadio(e,t);const s=this._filterOptions(this.state.selectOptions),r=this._getValue(),o=this.props.schema.multiple?null:s.find(i=>i.value==r);return c.createElement(_e,{variant:"standard",fullWidth:!0,sx:this.props.table!==void 0&&tC.noMargin,id:`jsonSelect_${this.props.attr}_${this.props.index||this.props.index===0?this.props.index:""}`},this.props.schema.label?c.createElement(Ke,null,this.getText(this.props.schema.label)):null,c.createElement(st,{variant:"standard",error:!!e,multiple:this.props.schema.multiple,disabled:!!t,value:r||"_",renderValue:i=>this.props.schema.multiple?c.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:.5}},i.map(a=>{const l=s.find(u=>u.value===a);if(l||this.props.schema.showAllValues!==!1){const u=(l==null?void 0:l.label)||a;return c.createElement(ni,{key:a,label:u})}return null})):o!=null&&o.color?c.createElement(c.Fragment,null,c.createElement("div",{style:{color:o.color}},o.label===void 0?i:o.label),o.description?c.createElement("div",{style:{opacity:.7,fontStyle:"italic",fontSize:"smaller"}},o.description):null):(o==null?void 0:o.label)===void 0?i:c.createElement(c.Fragment,null,c.createElement("div",null,o.label),o.description?c.createElement("div",{style:{opacity:.7,fontStyle:"italic",fontSize:"smaller"}},o.description):null),onChange:i=>{this.setState({value:i.target.value==="_"?"":i.target.value},()=>{let a;this.state.value===F.DIFFERENT_VALUE?a=this.onChange(this.props.attr,this.initialValue):a=this.onChange(this.props.attr,this.state.value),a instanceof Promise&&a.catch(l=>console.error(l))})}},s.map((i,a)=>i.group?c.createElement(el,{key:a,style:{color:i.color}},c.createElement("div",null,i.label),o.description?c.createElement("div",{style:{opacity:.7,fontStyle:"italic",fontSize:"smaller"}},o.description):null):c.createElement(ze,{key:a,value:i.value,style:i.value===F.DIFFERENT_VALUE?{opacity:.5}:{}},this.props.schema.multiple?c.createElement(Ts,{checked:r.includes(i.value),onClick:()=>{const l=JSON.parse(JSON.stringify(this._getValue())),u=r.indexOf(i.value);u!==-1?l.splice(u,1):(l.push(i.value),l.sort()),this.setState({value:l},()=>this.onChange(this.props.attr,l))}}):null,c.createElement(ri,{primary:i.label,secondary:i.description,slotProps:{secondary:{style:{fontSize:"smaller",fontStyle:"italic",opacity:.7}}},style:{color:i.color}})))),this.props.schema.help?c.createElement(Be,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const nC={menuPaper:{maxHeight:800}};class rC extends F{initialized=!1;localContext;askInstance(){if(this.props.alive){let e=this.props.schema.data;if(e===void 0&&this.props.schema.jsonData){const t=this.getPattern(this.props.schema.jsonData,null,!0);try{e=JSON.parse(t)}catch{console.error(`Cannot parse json data: ${t}`)}}e===void 0&&(e=null),this.setState({running:!0},()=>{this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",e).then(t=>{this.reportFilterLabels(t),this.setState({list:t,running:!1})}).catch(t=>{console.error(`Cannot send command: ${t}`)})})}else{const e=F.getValue(this.props.data,this.props.attr);this.setState({value:e,running:!1})}}reportFilterLabels(e){if(this.props.onFilterLabelUpdate&&this.props.table&&Array.isArray(e)){const t={};for(const s of e)s.value!==F.DIFFERENT_VALUE&&(t[s.value]=s.label);this.props.onFilterLabelUpdate(this.props.attr,t)}}getContext(){const e={};return Array.isArray(this.props.schema.alsoDependsOn)&&this.props.schema.alsoDependsOn.forEach(t=>e[t]=F.getValue(this.props.data,t)),JSON.stringify(e)}_getValue(){let e=this.state.value===null||this.state.value===void 0?F.getValue(this.props.data,this.props.attr):this.state.value;return this.props.schema.multiple&&(typeof e=="string"?e=[e]:e==null&&(e=[])),e}renderItem(e,t){if(this.props.alive){const i=this.getContext();(i!==this.localContext||!this.initialized)&&(this.localContext=i,setTimeout(()=>this.askInstance(),this.initialized?300:50),this.initialized=!0)}const s=this._getValue();if(!this.props.alive||!this.state.running&&!Array.isArray(this.state.list))return this.props.schema.multiple||this.props.schema.manual===!1?x.t("ra_Cannot retrieve options, as instance is offline"):c.createElement(xe,{variant:"standard",fullWidth:!0,value:s,error:!!e,disabled:!!t,onChange:i=>{const a=i.target.value;this.setState({value:a},()=>this.onChange(this.props.attr,(a||"").trim()))},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation),slotProps:{input:{endAdornment:this.state.value&&!this.props.schema.noClearButton?c.createElement(Gs,{position:"end"},c.createElement(fe,{tabIndex:-1,size:"small",onClick:()=>this.setState({value:""},()=>this.onChange(this.props.attr,""))},c.createElement(Mt,null))):null}}});if(this.state.running)return c.createElement(rs,{size:"24"});const r=this.state.list.filter(i=>i.hidden?this.props.custom?!this.executeCustom(i.hidden,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):!this.execute(i.hidden,this.props.schema.default,this.props.data,this.props.arrayIndex,this.props.globalData):!0),o=r.find(i=>i.value===s);return c.createElement(_e,{variant:"standard",fullWidth:!0},this.props.schema.label?c.createElement(Ke,null,this.getText(this.props.schema.label)):null,c.createElement(st,{variant:"standard",error:!!e,multiple:this.props.schema.multiple,disabled:!!t,sx:{"&.MuiSelect-paper":this.props.schema.multiple?nC.menuPaper:void 0},value:s,renderValue:i=>this.props.schema.multiple?c.createElement(Ze,{sx:{display:"flex",flexWrap:"wrap",gap:.5}},i.map(a=>{const l=r.find(u=>u.value===a);if(l||this.props.schema.showAllValues!==!1){const u=(l==null?void 0:l.label)||a;return c.createElement(ni,{key:a,label:u})}return null})):this.getText((o==null?void 0:o.label)||i,this.props.schema.noTranslation),onChange:i=>{const a=this.onChange(this.props.attr,i.target.value);a instanceof Promise&&a.catch(l=>console.error(`Cannot set value: ${l}`))}},r.map((i,a)=>i.group?c.createElement(el,{key:a},c.createElement("div",null,this.getText(i.label,this.props.schema.noTranslation)),i.description?c.createElement("div",{style:{opacity:.7,fontStyle:"italic",fontSize:"smaller"}},this.getText(i.description)):null):c.createElement(ze,{key:a,value:i.value},this.props.schema.multiple?c.createElement(Ts,{checked:s.includes(i.value),onClick:()=>{const l=JSON.parse(JSON.stringify(this._getValue())),u=s.indexOf(i.value);u!==-1?l.splice(u,1):(l.push(i.value),l.sort()),this.setState({value:l},()=>this.onChange(this.props.attr,l))}}):null,c.createElement(ri,{primary:this.getText(i.label),secondary:this.getText(i.description),slotProps:{secondary:{style:{fontSize:"smaller",fontStyle:"italic",opacity:.7}}}})))),this.props.schema.help?c.createElement(Be,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Sa={fullWidth:{width:"100%"}};function Qt(n){return n.split(".").reduce((e,t)=>(e<<8)+parseInt(t,10),0)>>>0}function oC(n,e){var r,o;const t=(o=(r=n==null?void 0:n.native)==null?void 0:r.hardware)==null?void 0:o.networkInterfaces;if(!t)return null;let s;return Object.keys(t).forEach(i=>t[i].forEach(a=>{a.internal||e.includes(":")&&a.family!=="IPv6"||e.includes(".")&&!e.match(/[^.\d]/)&&a.family!=="IPv4"||(a.family==="IPv4"&&!a.address.startsWith("172")&&(e==="127.0.0.0"||e==="localhost"||e.match(/[^.\d]/))?s=a.address:s||(a.family==="IPv4"&&e.includes(".")&&(Qt(e)&Qt(a.netmask),Qt(a.address)&Qt(a.netmask)),s=a.address))})),s||Object.keys(t).forEach(i=>t[i].forEach(a=>{a.internal||e.includes(":")&&a.family!=="IPv6"||e.includes(".")&&!e.match(/[^.\d]/)&&a.family!=="IPv4"||(a.family==="IPv6"&&(e==="127.0.0.0"||e==="localhost"||e.match(/[^.\d]/))?s=a.address:s||(a.family==="IPv4"&&e.includes(".")&&(Qt(e)&Qt(a.netmask),Qt(a.address)&Qt(a.netmask)),s=a.address))})),s||Object.keys(t).forEach(i=>{t[i].forEach(a=>{a.internal||e.includes(":")&&a.family!=="IPv6"||e.includes(".")&&!e.match(/[^.\d]/)&&a.family!=="IPv4"||(e==="127.0.0.0"||e==="localhost"||e.match(/[^.\d]/),s=a.address)})}),s||Object.keys(t).forEach(i=>{t[i].forEach(a=>{a.internal||(s=a.address)})}),s}class ka extends F{async componentDidMount(){var t;super.componentDidMount();let e=window.location.hostname;if(this.props.schema.openUrl){const s=await this.props.oContext.socket.getCurrentInstance(),r=await this.props.oContext.socket.getObject(`system.adapter.${s}`);if(r){const o=await this.props.oContext.socket.getObject(`system.host.${(t=r==null?void 0:r.common)==null?void 0:t.host}`);if(o){const i=oC(o,window.location.hostname);if(i)e=`${i}:${window.location.port}`;else{console.warn(`Cannot find suitable IP in host ${r.common.host} for ${r._id}`);return}}}}await new Promise(s=>{this.setState({_error:"",_message:"",hostname:e},s)}),this.props.schema.onLoaded&&this._onClick()}renderErrorDialog(){return this.state._error?c.createElement(Sh,{text:this.state._error,onClose:()=>this.setState({_error:""})}):null}renderMessageDialog(){return this.state._message?c.createElement(kh,{text:this.state._message,onClose:()=>this.setState({_message:""})}):null}renderCopyDialog(){return this.state._copyDialog?c.createElement(Ai,{title:this.getText(this.state._copyDialog.title||x.t("ra_Result")),overflowHidden:!0,onClose:()=>{this.setState({_copyDialog:null})},onApply:()=>{Th(this.state._copyDialog.text),window.alert(x.t("ra_Copied")),this.setState({_copyDialog:null})},titleButtonApply:x.t("ra_Copy content")},c.createElement("div",{style:{width:"calc(100vw - 40px)",height:"calc(100vh - 188px)"}},c.createElement(ui,{mode:this.state._copyDialog.type,value:this.state._copyDialog.text,name:"CopyDialog",themeType:this.props.oContext.themeType}))):null}_onClick(){this.props.oContext.onCommandRunning(!0),this.setState({running:!0});const e=`${window.location.protocol}//${window.location.host}${window.location.pathname.replace(/\/index\.html$/,"")}`,t=`${window.location.protocol}//${this.state.hostname.split(":").length>3?`[${this.state.hostname}]`:this.state.hostname}${window.location.pathname.replace(/\/index\.html$/,"")}`;let s=this.props.schema.data;if(s===void 0&&this.props.schema.jsonData){const o=this.getPattern(this.props.schema.jsonData,{_origin:e,_originIp:t,...this.props.data},!0);try{s=JSON.parse(o)}catch{console.error(`Cannot parse json data: ${o}`)}}s===void 0&&(s=null),this.props.schema.openUrl&&!s&&(s={_origin:e,_originIp:t});let r;this.props.schema.timeout&&(r=setTimeout(()=>{this.props.oContext.onCommandRunning(!1),this.setState({_error:x.t("ra_Request timed out"),running:!1})},parseInt(this.props.schema.timeout,10)||1e4)),this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",s).then(async o=>{var i,a,l,u,d,h;if(r&&(clearTimeout(r),r=void 0),o!=null&&o.error)if((i=this.props.schema.error)!=null&&i[o.error]){let p=this.getText(this.props.schema.error[o.error]);(a=o.args)==null||a.forEach(g=>p=p.replace("%s",g)),this.setState({_error:p})}else this.setState({_error:o.error?typeof o.error=="string"?x.t(o.error):JSON.stringify(o.error):x.t("ra_Error")});else{if(o!=null&&o.command){(u=(l=this.props.oContext).onBackEndCommand)==null||u.call(l,o.command);return}if(o!=null&&o.reloadBrowser&&this.props.schema.reloadBrowser)window.location.reload();else if(o!=null&&o.openUrl&&this.props.schema.openUrl)window.open(o.openUrl,o.window||this.props.schema.window||"_blank");else if(o!=null&&o.result&&((d=this.props.schema.result)!=null&&d[o.result])){let p=this.getText(this.props.schema.result[o.result]);(h=o.args)==null||h.forEach(g=>p=p.replace("%s",g)),window.alert(p)}if(o!=null&&o.native&&this.props.schema.useNative){for(const[p,g]of Object.entries(o.native))await this.onChangeAsync(p,g);setTimeout(()=>this.props.oContext.forceUpdate(Object.keys(o.native),this.props.data),300)}else o!=null&&o.result?window.alert(typeof o.result=="object"?JSON.stringify(o.result):o.result):o!=null&&o.copyDialog?this.setState({_copyDialog:o.copyDialog}):window.alert(x.t("ra_Ok"));o!=null&&o.saveConfig&&this.props.onChange(null,null,null,!0)}}).catch(o=>{this.props.schema.error&&this.props.schema.error[o.toString()]?this.setState({_error:this.getText(this.props.schema.error[o.toString()])}):this.setState({_error:x.t(o.toString())||x.t("ra_Error")})}).then(()=>{this.props.oContext.onCommandRunning(!1),this.setState({running:!1})})}renderDialogConfirm(){if(!this.state.confirmDialog)return null;const e=this.state.confirmData||this.props.schema.confirm;let t=null;return e.type==="warning"?t=c.createElement(_n,null):e.type==="error"?t=c.createElement(vs,null):e.type==="info"&&(t=c.createElement(wr,null)),c.createElement(ws,{title:this.getText(e.title)||x.t("ra_Please confirm"),text:this.getText(e.text),ok:this.getText(e.ok)||x.t("ra_Ok"),cancel:this.getText(e.cancel)||x.t("ra_Cancel"),icon:t||void 0,onClose:s=>this.setState({confirmDialog:!1},()=>s&&this._onClick())})}renderItem(e,t){const s=this.getIcon();return c.createElement("div",{style:Sa.fullWidth},c.createElement(Ne,{variant:this.props.schema.variant||void 0,color:this.props.schema.color||"grey",style:{...Sa.fullWidth,...this.props.schema.controlStyle||void 0},disabled:t||!this.props.alive,startIcon:s,title:this.props.alive?this.getText(this.props.schema.title)||"":x.t("ra_Instance is not alive"),onClick:()=>{this.props.schema.confirm?this.setState({confirmDialog:!0}):this._onClick()}},this.props.schema.showProcess&&this.state.running?c.createElement(rs,{size:20,style:{marginRight:8}}):null,this.getText(this.props.schema.label,this.props.schema.noTranslation)),this.renderErrorDialog(),this.renderMessageDialog(),this.renderCopyDialog())}}const iC={fullWidth:{width:"100%"}};class aC extends F{async _onClick(){var s,r;let e=this.props.schema.val;if(typeof e=="string"&&e.includes("${")){e=this.getPattern(e,null,!0);const o=await this.props.oContext.socket.getObject(this.props.schema.id);((s=o==null?void 0:o.common)==null?void 0:s.type)==="number"?e=parseFloat(e):((r=o==null?void 0:o.common)==null?void 0:r.type)==="boolean"&&(e=e==="true"||e===!0||e==="1"||e===1)}const t=(this.props.schema.id||"").replace(/%INSTANCE%/g,(this.props.oContext.instance||0).toString());try{await this.props.oContext.socket.setState(t,{val:e,ack:!!this.props.schema.ack}),this.props.schema.okText&&window.alert(this.getText(this.props.schema.okText))}catch(o){this.props.schema.error&&this.props.schema.error[o.toString()]?window.alert(this.getText(this.props.schema.error[o.toString()])):window.alert(x.t(o.toString())||x.t("ra_Error"))}}renderDialogConfirm(){if(!this.state.confirmDialog)return null;const e=this.state.confirmData||this.props.schema.confirm;let t=null;return e.type==="warning"?t=c.createElement(_n,null):e.type==="error"?t=c.createElement(vs,null):e.type==="info"&&(t=c.createElement(wr,null)),c.createElement(ws,{title:this.getText(e.title)||x.t("ra_Please confirm"),text:this.getText(e.text),ok:this.getText(e.ok)||x.t("ra_Ok"),cancel:this.getText(e.cancel)||x.t("ra_Cancel"),icon:t,onClose:s=>this.setState({confirmDialog:!1},()=>s&&this._onClick())})}renderItem(e,t){const s=this.getIcon();return c.createElement(Ne,{variant:this.props.schema.variant||void 0,color:this.props.schema.color||"grey",style:iC.fullWidth,disabled:t,onClick:async()=>{this.props.schema.confirm?this.setState({confirmDialog:!0}):await this._onClick()},startIcon:s||void 0},this.getText(this.props.schema.label,this.props.schema.noTranslation))}}const Ta={fullWidth:{width:"100%"},slider:{marginLeft:10,marginRight:10,width:"calc(100% - 20px)"}};class lC extends F{componentDidMount(){super.componentDidMount();const e=F.getValue(this.props.data,this.props.attr);this.setState({_value:e})}static getDerivedStateFromProps(e,t){if(e.schema.min!==void 0&&e.schema.min<0||e.schema.max!==void 0&&e.schema.max<0)return null;const s=F.getValue(e.data,e.attr);return s==null||s.toString()!==parseFloat(t._value).toString()?{_value:s}:null}renderItem(e,t){const s=this.props.schema.min||0,r=this.props.schema.max||100,o=this.props.schema.unit?this.getText(this.props.schema.unit,this.props.schema.noTranslation):"",i=[{value:s,label:s+o},{value:r,label:r+o}];return c.createElement(Ze,{style:Ta.fullWidth},this.props.schema.label?c.createElement(Ut,{gutterBottom:!0},this.getText(this.props.schema.label)):null,c.createElement(tl,{style:Ta.slider,value:this.state._value,getAriaValueText:a=>a+o,step:this.props.schema.step||(r-s)/100,valueLabelDisplay:"auto",marks:i,min:s,max:r,disabled:!!t,onChange:a=>{const l=a.target.value;this.setState({_value:l},()=>this.onChange(this.props.attr,l))}}),this.props.schema.help?c.createElement(Ut,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}function Xt(n,e){return n==="edit"||n==="rename"?c.createElement(rl,{style:e}):n==="delete"?c.createElement(ts,{style:e}):n==="refresh"?c.createElement(oi,{style:e}):n==="newDevice"||n==="new"||n==="add"?c.createElement(Pn,{style:e}):n==="discover"||n==="search"?c.createElement(nl,{style:e}):n==="unpairDevice"||n==="unpair"?c.createElement(al,{style:e}):n==="pairDevice"||n==="pair"?c.createElement(ll,{style:e}):n==="identify"?c.createElement(sh,{style:e}):n==="play"?c.createElement(ai,{style:e}):n==="stop"?c.createElement(nh,{style:e}):n==="pause"?c.createElement(rh,{style:e}):n==="forward"||n==="next"?c.createElement(oh,{style:e}):n==="rewind"||n==="previous"?c.createElement(ih,{style:e}):n==="lamp"||n==="light"?c.createElement(ah,{style:e}):n==="backlight"?c.createElement(lh,{style:e}):n==="dimmer"?c.createElement(ch,{style:e}):n==="socket"?c.createElement(uh,{style:e}):n==="settings"?c.createElement(hh,{style:e}):n==="users"||n==="group"?c.createElement(il,{style:e}):n==="user"?c.createElement(ol,{style:e}):n==="qrcode"?c.createElement(dh,{style:e}):n==="connection"?c.createElement(ph,{style:e}):n==="no-connection"?c.createElement(fh,{style:e}):n==="visible"?c.createElement(dl,{style:e}):null}function cC(n,e){return typeof e=="string"?{"@keyframes newStateAnimationOnceColor":{"0%":{color:e},"100%":{color:n.palette.mode==="dark"?"#fff":"#000"}},animation:"newStateAnimationOnceColor 2s ease-in-out"}:{"@keyframes newStateAnimationOnce":{"0%":{color:"#00f900"},"80%":{color:n.palette.mode==="dark"?"#518851":"#008000"},"100%":{color:n.palette.mode==="dark"?"#fff":"#000"}},animation:"newStateAnimationOnce 2s ease-in-out"}}class uC extends F{controlTimeout=null;delayedUpdate={timer:null,value:null};getObjectID(){let e=(this.props.schema.oid||"").toString();return e.includes("${")&&(e=this.getPattern(e,null,!0)),this.props.schema.foreign?e:`${this.props.schema.system?"system.adapter.":""}${this.props.oContext.adapterName}.${this.props.oContext.instance||0}.${e}`}async componentDidMount(){var s,r;super.componentDidMount();const e=await this.props.oContext.socket.getObject(this.getObjectID());if((s=e==null?void 0:e.common)!=null&&s.states&&!this.props.schema.options){if(Array.isArray((r=e==null?void 0:e.common)==null?void 0:r.states)){const o={};e.common.states.forEach((i,a)=>{o[a.toString()]=i}),e.common.states=o}Object.keys(e.common.states).length||(e.common.states=void 0)}const t=this.props.schema.control||this.detectType(e);try{const o=await this.props.oContext.socket.getState(this.getObjectID());this.setState({stateValue:o?o.val:null,controlType:t,obj:e},async()=>{await this.props.oContext.socket.subscribeState(this.getObjectID(),this.onStateChanged)})}catch(o){console.error(`Cannot get state ${this.getObjectID()}: ${o}`),this.setState({controlType:t,obj:e})}}componentWillUnmount(){super.componentWillUnmount(),this.props.oContext.socket.unsubscribeState(this.getObjectID(),this.onStateChanged),this.delayedUpdate.timer&&(clearTimeout(this.delayedUpdate.timer),this.delayedUpdate.timer=null),this.controlTimeout&&(clearTimeout(this.controlTimeout),this.controlTimeout=null,this.props.oContext.socket.setState(this.getObjectID(),this.state.stateValue,!1).catch(e=>console.error(`Cannot control value: ${e.toString()}`)))}onStateChanged=(e,t)=>{let s=t?t.val:null;this.state.controlType==="button"||this.state.controlType==="switch"?(s=!!s,this.state.stateValue!==s&&this.setState({stateValue:s})):s!==null&&(this.state.controlType==="slider"||this.state.controlType==="number")?(s=parseFloat(s),console.log(`${Date.now()} Received new value: ${s}`),s!==this.state.stateValue?(this.delayedUpdate.timer&&(clearTimeout(this.delayedUpdate.timer),this.delayedUpdate.timer=null),this.delayedUpdate.value=s,this.delayedUpdate.timer=setTimeout(()=>{this.setState({stateValue:this.delayedUpdate.value})},500)):this.delayedUpdate.timer&&(clearTimeout(this.delayedUpdate.timer),this.delayedUpdate.timer=null)):this.state.stateValue.toString()!==s.toString()&&this.setState({stateValue:s})};detectType(e){if(e||={},e.common||={},e.common.type==="boolean"){if(this.props.schema.controlled!==!1){if(e.common.read===!1||this.props.schema.controlled===!0)return"button";if(e.common.write||this.props.schema.controlled===!0)return"switch"}return"text"}return e.common.type==="number"&&this.props.schema.controlled!==!1?e.common.write||this.props.schema.controlled===!0?e.common.states||this.props.schema.options?"select":e.common.max!==void 0?"slider":"input":"text":e.common.write&&this.props.schema.controlled!==!1?e.common.states||this.props.schema.options?"select":"input":"text"}getNormalizedStates(){let e;return this.props.schema.options?e=this.props.schema.options.map(t=>typeof t=="string"?{value:t,label:this.getText(t,this.props.schema.noTranslation)}:{value:t.value,label:this.getText(t.label,this.props.schema.noTranslation),color:t.color}):this.state.obj.common.states?(e=[],Object.keys(this.state.obj.common.states).forEach(t=>{e.push({value:t,label:this.getText(this.state.obj.common.states[t],this.props.schema.noTranslation)})})):e=[],e}renderItem(e,t){var r,o,i,a,l;if(!this.state.obj)return null;let s;if(this.state.controlType==="select"||!this.state.controlType&&(this.state.obj.common.type==="number"||this.state.obj.common.type==="string")&&this.state.obj.common.write!==!1&&(this.props.schema.options||this.state.obj.common.states)){const u=this.getNormalizedStates(),d=u.find(h=>h.value===this.state.stateValue);s=c.createElement(_e,{fullWidth:!0},c.createElement(Ke,null,"$",this.getText(this.props.schema.label)),c.createElement(st,{value:this.state.stateValue,disabled:!!this.props.schema.readOnly||t,onChange:h=>{this.setState({stateValue:h.target.value},()=>{let p=this.state.stateValue;this.state.obj.common.type==="number"&&(p=parseFloat(p.toString().replace(",","."))),this.props.oContext.socket.setState(this.getObjectID(),p,!1)})},renderValue:h=>d!=null&&d.color?c.createElement("div",{style:{color:d.color}},d.label):h},u.map(h=>c.createElement(ze,{key:(h.value??"").toString(),value:h.value,style:{color:h.color}},"$",h.label))))}else if(this.state.controlType==="button"||!this.state.controlType&&this.state.obj.common.type==="boolean"&&(this.state.obj.common.write&&this.state.obj.common.read===!1||(r=this.state.obj.common.role)!=null&&r.includes("button"))){let u=null;this.props.schema.falseImage&&(u=Xt(this.props.schema.falseImage));const d=this.getText(this.props.schema.falseText||this.props.schema.label,this.props.schema.noTranslation);!d&&u?s=c.createElement(fe,{style:this.props.schema.falseTextStyle,disabled:!!this.props.schema.readOnly,onClick:async()=>{this.props.schema.confirm?this.setState({confirmDialog:!0,confirmCallback:async h=>{h&&await this.props.oContext.socket.setState(this.getObjectID(),this.props.schema.buttonValue!==void 0?this.props.schema.buttonValue:!0,!1)}}):await this.props.oContext.socket.setState(this.getObjectID(),this.props.schema.buttonValue!==void 0?this.props.schema.buttonValue:!0,!1)}},u):s=c.createElement(Ne,{variant:this.props.schema.variant||"contained",startIcon:u,style:this.props.schema.falseTextStyle,disabled:t||!!this.props.schema.readOnly,onClick:async()=>{this.props.schema.confirm?this.setState({confirmDialog:!0,confirmCallback:async h=>{h&&await this.props.oContext.socket.setState(this.getObjectID(),this.props.schema.buttonValue!==void 0?this.props.schema.buttonValue:!0,!1)}}):await this.props.oContext.socket.setState(this.getObjectID(),this.props.schema.buttonValue!==void 0?this.props.schema.buttonValue:!0,!1)}},d||this.getObjectID().split(".").pop())}else if(this.state.controlType==="input"||!this.state.controlType&&this.state.obj.common.write&&this.state.obj.common.type==="string")s=c.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",gap:8,alignItems:"baseline"}},c.createElement(xe,{style:{flex:1},value:this.state.stateValue,variant:"standard",disabled:!!this.props.schema.readOnly||t,slotProps:{input:{endAdornment:this.getText(this.props.schema.unit,this.props.schema.noTranslation)||this.state.obj.common.unit||void 0},htmlInput:{readOnly:!!this.props.schema.readOnly}},onKeyUp:u=>{this.props.schema.setOnEnterKey&&u.key==="Enter"&&this.props.oContext.socket.setState(this.getObjectID(),this.state.stateValue,!1)},onChange:u=>{this.setState({stateValue:u.target.value},()=>{this.props.schema.setOnEnterKey||this.props.schema.showEnterButton||(this.controlTimeout&&clearTimeout(this.controlTimeout),this.controlTimeout=setTimeout(async()=>{this.controlTimeout=null;let d=this.state.stateValue;this.state.obj.common.type==="number"&&(d=parseFloat(d.toString().replace(",","."))),await this.props.oContext.socket.setState(this.getObjectID(),d,!1)},this.props.schema.controlDelay||0))})},label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)}),this.props.schema.showEnterButton&&!this.props.schema.readOnly&&c.createElement(Ne,{variant:"outlined",disabled:t,onClick:()=>{this.props.oContext.socket.setState(this.getObjectID(),this.state.stateValue,!1)}},this.getText(typeof this.props.schema.showEnterButton=="string"?this.props.schema.showEnterButton:"Set")));else{let u;this.props.schema.size==="normal"?u=16:this.props.schema.size==="large"?u=20:typeof this.props.schema.size=="number"&&(u=this.props.schema.size);let d=this.getText(this.props.schema.label,this.props.schema.noTranslation);const h={display:"flex",alignItems:"center",fontSize:u||"1rem",gap:8};this.props.schema.narrow||(h.width="100%",h.justifyContent="space-between"),d.trim()&&!d.trim().endsWith(":")&&this.props.schema.addColon&&(d=`${d.trim()}:`);let p;this.props.schema.blinkOnUpdate&&(p=cC(this.props.oContext.theme,this.props.schema.blinkOnUpdate));let g;this.props.schema.labelIcon&&(g=c.createElement(Es,{src:this.props.schema.labelIcon,style:{marginRight:4}}));let m;if(d&&g?m=c.createElement("div",{style:{whiteSpace:"nowrap"}},g,d):d?m=c.createElement("div",{style:{whiteSpace:"nowrap"}},d):g&&(m=g),this.state.controlType==="switch"||!this.state.controlType&&this.state.obj.common.type==="boolean"&&(this.state.obj.common.write&&this.state.obj.common.read!==!1||(o=this.state.obj.common.role)!=null&&o.includes("switch"))){let f=null;const y=this.getText(this.props.schema.falseText,this.props.schema.noTranslation);this.props.schema.falseImage&&(f=Xt(this.props.schema.falseImage,y?{marginLeft:8}:void 0));let b=null;const C=this.getText(this.props.schema.trueText,this.props.schema.noTranslation);this.props.schema.trueImage&&(b=Xt(this.props.schema.trueImage,C?{marginRight:8}:void 0)),s=c.createElement(Pu,{checked:!!this.state.stateValue,disabled:!!this.props.schema.readOnly||t,onChange:async()=>{this.props.schema.confirm?this.setState({confirmDialog:!0,confirmCallback:async D=>{D&&await this.props.oContext.socket.setState(this.getObjectID(),!this.state.stateValue,!1)}}):await this.props.oContext.socket.setState(this.getObjectID(),!this.state.stateValue,!1)}}),(y||f||C||b)&&(s=c.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:14}},c.createElement("span",{style:this.props.schema.falseTextStyle},y,f),s,c.createElement("span",{style:this.props.schema.trueTextStyle},b,C))),m&&(s=c.createElement("div",{style:h},m,s))}else if(this.state.controlType==="slider"||!this.state.controlType&&this.state.obj.common.type==="number"&&(this.state.obj.common.write&&(this.state.obj.common.max!==void 0||this.state.obj.common.unit==="%")||(i=this.state.obj.common.role)!=null&&i.includes("slider")||(a=this.state.obj.common.role)!=null&&a.includes("dimmer")||(l=this.state.obj.common.role)!=null&&l.includes("blind"))){let f=null;const y=this.getText(this.props.schema.falseText,this.props.schema.noTranslation);this.props.schema.falseImage&&(f=Xt(this.props.schema.falseImage,y?{marginLeft:8}:void 0));let b=null;const C=this.getText(this.props.schema.trueText,this.props.schema.noTranslation);this.props.schema.trueImage&&(b=Xt(this.props.schema.trueImage,C?{marginRight:8}:void 0));const D=this.props.schema.min===void 0?this.state.obj.common.min||0:this.props.schema.min,v=this.props.schema.max===void 0?this.state.obj.common.max===void 0?100:this.state.obj.common.max:this.props.schema.max,E=this.props.schema.step===void 0?this.state.obj.common.step||1:this.props.schema.step;s=c.createElement(tl,{style:{width:"100%",flexGrow:1},min:D,max:v,disabled:!!this.props.schema.readOnly||t,step:E,value:this.state.stateValue,valueLabelDisplay:"auto",valueLabelFormat:A=>{let S=this.props.schema.digits!==void 0?A.toFixed(this.props.schema.digits):A.toString();return this.props.oContext.isFloatComma&&(S=S.replace(".",",")),`${S}${this.getText(this.props.schema.unit,this.props.schema.noTranslation)||this.state.obj.common.unit||""}`},onChange:(A,S)=>{this.setState({stateValue:S},()=>{this.controlTimeout&&clearTimeout(this.controlTimeout),this.controlTimeout=setTimeout(async()=>{console.log(`${Date.now()} Send new value: ${this.state.stateValue}`),this.controlTimeout=null,await this.props.oContext.socket.setState(this.getObjectID(),this.state.stateValue,!1)},this.props.schema.controlDelay||0)})}}),(y||f||C||b)&&(s=c.createElement("div",{style:{display:"flex",width:"100%",flexGrow:1,alignItems:"center"}},c.createElement("span",{style:{marginRight:16,...this.props.schema.falseTextStyle}},y,f),s,c.createElement("span",{style:{marginLeft:16,...this.props.schema.trueTextStyle}},b,C))),m&&(s=c.createElement("div",{style:h},m,s))}else if(this.state.obj.common.type==="number"&&this.state.obj.common.write&&!this.state.controlType){const f=this.props.schema.min===void 0?this.state.obj.common.min===void 0?void 0:this.state.obj.common.min:this.props.schema.min,y=this.props.schema.max===void 0?this.state.obj.common.max===void 0?void 0:this.state.obj.common.max:this.props.schema.max,b=this.props.schema.step===void 0?this.state.obj.common.step===void 0?void 0:this.state.obj.common.step:this.props.schema.step;s=c.createElement(xe,{variant:"standard",style:{width:"100%"},value:this.state.stateValue,type:"number",disabled:!!this.props.schema.readOnly||t,slotProps:{htmlInput:{min:f,max:y,step:b,readOnly:!!this.props.schema.readOnly},input:{endAdornment:this.getText(this.props.schema.unit,this.props.schema.noTranslation)||this.state.obj.common.unit||void 0}},onChange:C=>{this.setState({stateValue:C.target.value},()=>{this.controlTimeout&&clearTimeout(this.controlTimeout),this.controlTimeout=setTimeout(async()=>{this.controlTimeout=null;const D=parseFloat(this.state.stateValue);await this.props.oContext.socket.setState(this.getObjectID(),D,!1)},this.props.schema.controlDelay||0)})},label:this.getText(this.props.schema.label,this.props.schema.noTranslation),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}else if(this.state.obj.common.type==="boolean"){let f=null,y,b;this.state.stateValue?(y=this.getText(this.props.schema.trueText,this.props.schema.noTranslation),this.props.schema.trueImage&&(f=Xt(this.props.schema.falseImage,y?{marginRight:8}:void 0)),b=this.props.schema.trueTextStyle):(y=this.getText(this.props.schema.falseText,this.props.schema.noTranslation),this.props.schema.falseImage&&(f=Xt(this.props.schema.falseImage,y?{marginLeft:8}:void 0)),b=this.props.schema.falseTextStyle),b=Object.assign(h,b),s=c.createElement("div",{style:b},m,c.createElement(Ze,{style:{display:"flex",alignItems:"center",gap:8},sx:p,key:this.props.schema.blinkOnUpdate?y:void 0},f,y||(this.state.stateValue?x.t("ra_true"):x.t("ra_false"))))}else{const f=this.getText(this.props.schema.unit,this.props.schema.noTranslation)||this.state.obj.common.unit;let y=this.state.stateValue;if(y!=null&&(this.props.schema.options||this.state.obj.common.states)){const v=this.getNormalizedStates().find(E=>E.value===y);v&&(y=v.label)}let b,C;this.state.controlType==="html"?(C=(y||"").toString(),b=c.createElement("span",{dangerouslySetInnerHTML:{__html:y}})):this.state.stateValue===null?(b="null",C=b):this.state.stateValue===void 0?(b="undefined",C=b):(this.props.schema.digits!==void 0&&typeof y=="number"?(b=y.toFixed(this.props.schema.digits),this.props.oContext.isFloatComma&&(b=b.replace(".",","))):b=y.toString(),C=b),s=c.createElement("div",{style:h},m,c.createElement("div",{style:{display:"flex",alignItems:"baseline",gap:4}},c.createElement(Ze,{sx:p,key:this.props.schema.blinkOnUpdate?C:void 0},b),f?c.createElement("span",{style:{opacity:.7,fontSize:"smaller"}},f):null))}}return s}}const Ao={fullWidth:n=>({width:"100%",backgroundColor:n.palette.mode==="dark"?"#FFF":"#000",borderStyle:"hidden"}),primary:n=>({backgroundColor:n.palette.primary.main}),secondary:n=>({backgroundColor:n.palette.secondary.main})};class hC extends F{renderItem(){return c.createElement(Ze,{component:"hr",sx:je.getStyle(this.props.oContext.theme,Ao.fullWidth,this.props.schema.color==="primary"?Ao.primary:this.props.schema.color==="secondary"?Ao.secondary:{backgroundColor:this.props.schema.color||(this.props.oContext.themeType==="dark"?"#333":"#ddd")},{height:this.props.schema.color?this.props.schema.height||2:this.props.schema.height||1})})}}const dC={header:n=>({width:"100%",background:n.palette.primary.main,color:n.palette.primary.contrastText,padding:"4px !important",borderRadius:"3px",marginBlockEnd:0,marginBlockStart:0})};class pC extends F{renderItem(){let e="h5";switch((this.props.schema.size||5).toString()){case"1":e="h1";break;case"2":e="h2";break;case"3":e="h3";break;case"4":e="h4";break;default:e="h5";break}return c.createElement(Ze,{component:e,sx:dC.header},this.getText(this.props.schema.label||this.props.schema.text,this.props.schema.noTranslation))}}class fC extends F{getSrc(){let e=this.props.schema.src;return e&&!e.startsWith(".")&&!e.startsWith("http")&&!e.startsWith(`adapter/${this.props.oContext.adapterName}/`)&&!e.startsWith(`./adapter/${this.props.oContext.adapterName}/`)&&(e=`adapter/${this.props.oContext.adapterName}/${e}`),e}renderItem(){const{schema:e}=this.props,t=this.getSrc();if(e.showInDialog){const s=e.showInDialogSmallSize||100,r=e.showInDialogButtonLabel?this.getText(e.showInDialogButtonLabel):"";return c.createElement(c.Fragment,null,c.createElement(Pe,{title:x.t("ra_Click to see in full size")},c.createElement("img",{src:t,style:{cursor:"pointer",width:"auto",height:s,objectFit:"contain"},onClick:()=>this.setState({showDialog:!0}),alt:""}))," ",r?c.createElement(Ne,{variant:"outlined",color:"grey",onClick:()=>this.setState({showDialog:!0})},r):null,this.state.showDialog?c.createElement(os,{open:!0,onClose:()=>this.setState({showDialog:!1}),maxWidth:"lg"},c.createElement(Cs,null,c.createElement("img",{src:t,style:{width:"100%",height:"100%",objectFit:"contain"},alt:""})),c.createElement(Ds,null,c.createElement(Ne,{variant:"contained",onClick:()=>this.setState({showDialog:!1}),color:"primary"},x.t("ra_Close")))):null)}return c.createElement("img",{src:t,style:{cursor:e.href?"pointer":void 0,width:"100%",height:"100%"},onClick:e.href?()=>e.href&&window.open(e.href,"_blank"):null,alt:""})}}function Aa(n,e,t){return typeof t=="string"?{"@keyframes newValueAnimationOnceColor":{"0%":{color:e?`${t} !important`:t},"100%":{color:n.palette.mode==="dark"?e?"#fff !important":"#fff":e?"#000 !important":"#000"}},animation:"newValueAnimationOnceColor 2s ease-in-out"}:{"@keyframes newValueAnimationOnce":{"0%":{color:e?"#00f900 !important":"#00f900"},"80%":{color:n.palette.mode==="dark"?e?"#518851 !important":"#518851":e?"#008000 !important":"#008000"},"100%":{color:n.palette.mode==="dark"?e?"#fff !important":"#fff":e?"#000 !important":"#000"}},animation:"newValueAnimationOnce 2s ease-in-out"}}function Fa(n,e){return typeof e=="string"?{"@keyframes blinkAnimationColor":{"0%":{color:e},"100%":{color:n.palette.mode==="dark"?"#fff":"#000"}},animation:"blinkAnimationColor 2s ease-in-out infinite"}:{"@keyframes blinkAnimation":{"0%":{color:"#00f900"},"80%":{color:n.palette.mode==="dark"?"#518851":"#008000"},"100%":{color:n.palette.mode==="dark"?"#fff":"#000"}},animation:"blinkAnimation 2s ease-in-out infinite"}}const Ns={label:{fontWeight:"bold",whiteSpace:"nowrap"},valueImage:{maxHeight:"100%"},valueAndUnit:{display:"flex",gap:4,alignItems:"baseline"},value:{},unit:{fontSize:"smaller",opacity:.7}};class mC extends F{renderItem(e){let t=this.getText(this.props.schema.text||this.props.schema.label,this.props.schema.noTranslation);this.props.schema.addColon&&typeof t=="string"&&!t.trim().endsWith(":")&&(t=`${t.trim()}:`),t&&(t.includes("<a ")||t.includes("<br")||t.includes("<b>")||t.includes("<i>"))&&(t=je.renderTextWithA(t));let s;this.props.schema.size==="normal"?s=16:this.props.schema.size==="large"?s=20:typeof this.props.schema.size=="number"&&(s=this.props.schema.size);const r={width:"100%",height:"100%",display:"flex",alignItems:"center",position:"relative",fontSize:s};this.props.schema.narrow?r.gap=8:r.justifyContent="space-between";let o,i;this.props.schema.data&&typeof this.props.schema.data=="object"&&this.props.schema.data.en?i=this.getText(this.props.schema.data):typeof this.props.schema.data=="object"||this.props.schema.data===void 0||this.props.schema.data===null?i=JSON.stringify(this.props.schema.data):typeof this.props.schema.data=="number"?(i=this.props.schema.data.toString(),this.props.oContext.isFloatComma&&(i=i.replace(".",","))):(!this.props.schema.booleanAsCheckbox||typeof this.props.schema.data!="boolean")&&(i=this.props.schema.data.toString());let a=!1;if(this.props.schema.booleanAsCheckbox&&typeof this.props.schema.data=="boolean")o=c.createElement(Ts,{checked:!!o,disabled:!0,size:this.props.schema.size==="small"?"small":this.props.schema.size==="large"?"large":void 0});else if(i.startsWith("data:image/"))o=c.createElement("div",{style:{...Ns.value,...Ns.valueImage,...this.props.schema.styleValue||void 0}},c.createElement(Es,{src:i}));else{const h={...Ns.value,...this.props.schema.styleValue||void 0};this.props.schema.html?o=c.createElement("div",{style:h,dangerouslySetInnerHTML:{__html:i}}):Array.isArray(this.props.schema.data)?(a=!0,o=c.createElement("div",{style:h},this.props.schema.data.map((p,g)=>c.createElement("div",{key:g},typeof p=="object"||p===null||p===void 0?JSON.stringify(p):p)))):i.includes(`
`)?(a=!0,o=c.createElement("div",{style:h},je.renderTextWithA(i))):o=c.createElement("div",{style:h},i)}if(this.props.schema.blinkOnUpdate&&this.props.schema.blink){const h=Aa(this.props.oContext.theme,!0,this.props.schema.blinkOnUpdate),p=Fa(this.props.oContext.theme,this.props.schema.blink);o=c.createElement(Ze,{key:i,sx:{...h,...p}},o)}else if(this.props.schema.blinkOnUpdate){const h=Aa(this.props.oContext.theme,!1,this.props.schema.blinkOnUpdate);o=c.createElement(Ze,{key:i,sx:h},o)}else if(this.props.schema.blink){const h=Fa(this.props.oContext.theme,this.props.schema.blink);o=c.createElement(Ze,{sx:h},o)}this.props.schema.unit&&(o=c.createElement("div",{style:Ns.valueAndUnit},o,c.createElement("div",{style:{...Ns.unit,...this.props.schema.styleUnit||void 0}},this.getText(this.props.schema.unit,this.props.schema.noTranslation))));let l;this.props.schema.labelIcon&&(l=c.createElement(Es,{src:this.props.schema.labelIcon,style:{marginRight:4}}));let u;this.props.schema.copyToClipboard&&(u=c.createElement(Ws,{className:"staticCopyButton",style:{position:"absolute",top:"calc(50% - 12px)",right:0,cursor:"pointer"},onClick:()=>{je.copyToClipboard(i),window.alert(x.t("ra_Copied"))}}));const d={"& .staticCopyButton":{display:"none"},"& .staticCopyButton:action":{transform:"scale(0.9)"},"&:hover .staticCopyButton":{display:"block"}};return this.props.schema.highlight&&(d["&:hover"]={backgroundColor:this.props.oContext.themeType==="dark"?"#51515180":"#b8b8b880"}),a&&(r.alignItems="top"),c.createElement(Ze,{component:"div",style:r,sx:d},c.createElement("div",{style:{...Ns.label,...this.props.schema.styleLabel||void 0}},l,t),o,u)}}const Ia={fullWidth:{height:"100%",width:"100%"},link:n=>({textDecoration:"underline",color:n.palette.mode==="dark"?"#4dabf5":"#254e72",cursor:"pointer"})};function _a(n,e,t){let s,r="";n?n.toString().startsWith("#")||n.toString().startsWith("/")?(s=e||"_self",r=n):n.startsWith("http://")||n.startsWith("https://")?(s=e||"_blank",r=n):(r=`#tab-instances/config/${t}/${n}`,s=e||"_self"):(r=`#tab-instances/config/${t}`,s=e||"_self"),s==="_self"?setTimeout(o=>{o.startsWith("#")?window.location.hash=o:o.startsWith("/")?r=`${window.location.protocol}:${window.location.host}${r}`:(o.startsWith("http://")||o.startsWith("https://"))&&(window.location.href=o)},100,r):(r.startsWith("#")?r=`${window.location.protocol}:${window.location.host}${window.location.pathname}${r}`:r.startsWith("/")&&(r=`${window.location.protocol}:${window.location.host}${r}`),window.open(r,s))}class Oa extends F{renderItem(e,t){if(this.props.schema.button){const r=this.getIcon();return c.createElement(Ne,{variant:this.props.schema.variant||void 0,color:this.props.schema.color||"grey",style:{...Ia.fullWidth,...this.props.schema.controlStyle||void 0},disabled:t,startIcon:r,onClick:this.props.schema.href?()=>{const o=this.props.schema.href?this.getText(this.props.schema.href,!0):null;o&&(this.props.oContext.onBackEndCommand?this.props.oContext.onBackEndCommand({command:"link",url:o,target:this.props.schema.target,close:this.props.schema.close}):_a(o,this.props.schema.target,`${this.props.oContext.adapterName}.${this.props.oContext.instance}`))}:null},this.getText(this.props.schema.text||this.props.schema.label,this.props.schema.noTranslation))}let s=this.getText(this.props.schema.text||this.props.schema.label,this.props.schema.noTranslation);if(this.props.schema.format==="html")s=c.createElement("div",{dangerouslySetInnerHTML:{__html:s}});else if(this.props.schema.format==="json")try{const r=typeof s=="string"?JSON.parse(s):s;s=c.createElement("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",margin:0}},JSON.stringify(r,null,2))}catch{}else s&&(s.includes("<a ")||s.includes("<br")||s.includes("<b>")||s.includes("<i>"))&&(s=je.renderTextWithA(s));return c.createElement(Ze,{component:"span",style:{...this.props.schema.controlStyle||void 0},sx:this.props.schema.href?Ia.link:void 0,onClick:this.props.schema.href?()=>{const r=this.props.schema.href?this.getText(this.props.schema.href,!0):null;r&&(this.props.oContext.onBackEndCommand?this.props.oContext.onBackEndCommand({command:"link",url:r,target:this.props.schema.target||"_blank",close:this.props.schema.close}):_a(r,this.props.schema.target||"_blank",`${this.props.oContext.adapterName}.${this.props.oContext.instance}`))}:null},s)}}const Fo=1024*1024,ge={paper:{width:"100%",marginBottom:16,backgroundColor:"rgba(255, 255, 255, 0.1)"},headerText:{width:"100%"},table:{minWidth:750},label:{display:"flex",justifyContent:"space-between"},title:{flex:"1 1 100%"},rootTool:{paddingLeft:16,paddingRight:8},silver:{opacity:.2},flex:{display:"flex",alignItems:"baseline"},filteredOut:{padding:10,display:"flex",textAlign:"center"},buttonEmpty:{width:34,display:"inline-block"},buttonCell:{whiteSpace:"nowrap"},dropZone:{width:"100%",height:100,position:"relative"},dropZoneEmpty:{},uploadDiv:{position:"relative",width:"100%",minHeight:300,opacity:.9,marginTop:30,cursor:"pointer",outline:"none"},uploadDivDragging:{opacity:1,background:"rgba(128,255,128,0.1)"},uploadCenterDiv:{margin:5,border:"3px dashed grey",borderRadius:5,width:"calc(100% - 10px)",height:"calc(100% - 10px)",minHeight:300,position:"relative",display:"flex"},uploadCenterIcon:{paddingTop:10,width:48,height:48},uploadCenterText:{fontSize:16},uploadCenterTextAndIcon:{textAlign:"center",position:"absolute",top:0,bottom:0,left:0,right:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},tooltip:{pointerEvents:"none"},cardHeader:n=>({color:n.palette.mode==="light"?n.palette.secondary.main:n.palette.text.primary,height:"100%",fontWeight:"bold",fontSize:20,fontStyle:"italic",padding:"4px 16px",backgroundColor:n.palette.primary.main,display:"flex",justifyContent:"space-between"})};function gC(n,e,t){e=e||"key";const s=[];return Object.keys(n).forEach(r=>{const o={};o[e]=r,t?(o[t]=n[r],s.push(o)):s.push(Object.assign(o,n[r]))}),s}function Pa(n,e,t){e=e||"key";const s={};return n.forEach(r=>{let o=r[e];o==null&&(o=""),delete r[e],t?s[o]=r[t]:s[o]=r}),s}function yC(n,e){let t="";for(let s=0;s<e.length;s++)t+=String.fromCharCode(n[s%n.length].charCodeAt(0)^e.charCodeAt(s));return t}function bC(n,e){let t="";for(let s=0;s<e.length;s++)t+=String.fromCharCode(n[s%n.length].charCodeAt(0)^e.charCodeAt(s));return t}class gt extends F{filterRefs;typingTimer=null;resizeTimeout=null;secret="Zgfr56gFe87jJOM";refDiv;listOfHiddenElements=[];refreshBecauseOfHiddenElements=null;constructor(e){super(e),this.filterRefs={},this.props.schema.items||=[],this.props.schema.items.forEach(t=>{t.filter&&(this.filterRefs[t.attr]=Ga())}),this.refDiv=c.createRef()}async componentDidMount(){super.componentDidMount();const e=F.getValue(this.props.data,this.props.attr)||[];let t;if(this.props.schema.objKeyName?t=gC(e,this.props.schema.objKeyName,this.props.schema.objValueName):t=e,Array.isArray(t)||(t=[]),this.props.schema.encryptedAttributes){const o=await this.props.oContext.socket.getCompactSystemConfig();this.secret=(o==null?void 0:o.native.secret)||this.secret,e.forEach(i=>{this.props.schema.encryptedAttributes.forEach(a=>{i[a]&&(i[a]=bC(this.secret,i[a]))})})}const s=window.localStorage.getItem(`table.collapsed.${this.props.oContext.instance}.${this.props.attr}`);let r=[];if(s)try{r=JSON.parse(s)}catch{}this.setState({value:t,visibleValue:null,orderBy:"",order:"asc",iteration:0,filterOn:[],width:0,tableErrors:{},collapsed:r,filterLabelMap:{}},()=>this.validateUniqueProps())}componentWillUnmount(){this.typingTimer&&(clearTimeout(this.typingTimer),this.typingTimer=null),this.resizeTimeout&&(clearTimeout(this.resizeTimeout),this.resizeTimeout=null),this.refreshBecauseOfHiddenElements&&(clearTimeout(this.refreshBecauseOfHiddenElements),this.refreshBecauseOfHiddenElements=null),super.componentWillUnmount()}itemTable(e,t,s,r){var l;const{schema:o}=this.props,i=(l=o.items)==null?void 0:l.find(u=>u.attr===e);if(!i)return null;const a={items:{[e]:i}};return c.createElement(_s,{oContext:this.props.oContext,alive:this.props.alive,arrayIndex:s,changed:this.props.changed,common:this.props.common,expertMode:this.props.expertMode,custom:!0,data:t,globalData:this.props.data,index:s+this.state.iteration,onChange:(u,d)=>{const h=JSON.parse(JSON.stringify(this.state.value));h[s][u]=d,this.setState({value:h},()=>{this.validateUniqueProps(),this.onChangeWrapper(h,!0)})},onError:this.onTableRowError(s),originalData:this.props.originalData,schema:a,table:!0,themeName:this.props.themeName,onFilterLabelUpdate:(u,d)=>{const h=this.state.filterLabelMap[u],p={...h,...d};JSON.stringify(h)!==JSON.stringify(p)&&this.setState(g=>({filterLabelMap:{...g.filterLabelMap,[u]:p}}))},onHiddenChanged:r?(u,d)=>{if(d)this.listOfHiddenElements[s]||=[],this.listOfHiddenElements[s].includes(u)||(this.listOfHiddenElements[s].push(u),this.refreshBecauseOfHiddenElements&&clearTimeout(this.refreshBecauseOfHiddenElements),this.refreshBecauseOfHiddenElements=setTimeout(()=>{this.forceUpdate()},100));else if(this.listOfHiddenElements[s]){const h=this.listOfHiddenElements[s].indexOf(u);h!==-1&&(this.listOfHiddenElements[s].splice(h,1),this.refreshBecauseOfHiddenElements&&clearTimeout(this.refreshBecauseOfHiddenElements),this.refreshBecauseOfHiddenElements=setTimeout(()=>{this.forceUpdate()},100))}}:void 0})}validateUniqueProps(){if(!this.props.schema.uniqueColumns)return;let e=null,t=null;for(const s of this.props.schema.uniqueColumns){const r=[];this.state.value.find(i=>{const a=i[s];return r.includes(a)?(e||(e=s,t=a),this.onError(s,"is not unique"),!0):(r.push(a),!1)})||this.onError(s,null)}e?this.setState({errorMessage:x.t('Non-allowed duplicate entry "%s" in column "%s"',t,e)}):this.setState({errorMessage:""})}onTableRowError=e=>(t,s)=>{const r={...this.state.tableErrors};r[e]||(r[e]={}),s?r[e][t]=s:(delete r[e][t],Object.keys(r[e]).length===0&&delete r[e]),this.setState({tableErrors:r}),this.props.onError(t,s)};static descendingComparator(e,t,s){return t[s]<e[s]?-1:t[s]>e[s]?1:0}static getComparator(e,t){return e==="desc"?(s,r)=>gt.descendingComparator(s,r,t):(s,r)=>-gt.descendingComparator(s,r,t)}static getFilterValue(e){var t,s,r;return(r=(s=(t=e==null?void 0:e.current)==null?void 0:t.children[0])==null?void 0:s.children[0])==null?void 0:r.value}static setFilterValue(e,t){return e.current.children[0].children[0].value=t}handleRequestSort=(e,t=!1)=>{const{order:s,orderBy:r}=this.state,i=t?s:r===e&&s==="asc"?"desc":"asc",a=this.stableSort(i,e);JSON.stringify(a)!==JSON.stringify(this.state.value)&&this.setState({value:a,order:i,orderBy:e,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,a))};stableSort=(e,t)=>{const{value:s}=this.state,r=gt.getComparator(e,t),o=s.map((i,a)=>({el:i,index:a}));return o.sort((i,a)=>{const l=r(i.el,a.el);return l!==0?l:i.index-a.index}),o.map(i=>i.el)};renderShowHideFilter(e){return e.filter?c.createElement(fe,{title:x.t("ra_Show/hide filter input"),size:"small",onClick:()=>{const t=[...this.state.filterOn],s=this.state.filterOn.indexOf(e.attr);s===-1?t.push(e.attr):t.splice(s,1),this.setState({filterOn:t},()=>{s&&gt.getFilterValue(this.filterRefs[e.attr])&&(gt.setFilterValue(this.filterRefs[e.attr],""),this.applyFilter())})}},this.state.filterOn.includes(e.attr)?c.createElement(mh,null):c.createElement(gh,null)):null}renderImportExportButtons(e){return c.createElement(c.Fragment,null,!e.noDelete&&e.import?c.createElement(Pe,{title:x.t("ra_Import data from %s file","CSV"),slotProps:{popper:{sx:ge.tooltip}}},c.createElement(fe,{size:"small",onClick:()=>this.setState({showImportDialog:!0})},c.createElement(On,null))):null,e.export?c.createElement(Pe,{title:x.t("ra_Export data to %s file","CSV"),slotProps:{popper:{sx:ge.tooltip}}},c.createElement(fe,{size:"small",onClick:()=>this.onExport()},c.createElement(yh,null))):null,e.noDelete?null:c.createElement(fe,{disabled:!0,size:"small"},c.createElement(ts,null)))}renderAddButton(e){return c.createElement(Pe,{title:e?x.t("ra_Cannot add items with set filter"):x.t("ra_Add row"),slotProps:{popper:{sx:ge.tooltip}}},c.createElement("span",null,c.createElement(fe,{size:"small",color:"primary",disabled:!!e&&!this.props.schema.allowAddByFilter,onClick:this.onAdd},c.createElement(Pn,null))))}enhancedTableHead(e,t){var i;const{schema:s}=this.props,{order:r,orderBy:o}=this.state;return c.createElement(Xa,null,c.createElement(Nt,null,(i=s.items)==null?void 0:i.map((a,l)=>this.renderOneFilter({schema:s,style:{width:a.width},showAddButton:!l&&!s.noDelete,headCell:a,order:r,orderBy:o,index:l,doAnyFilterSet:t})),!s.noDelete&&c.createElement(Ve,{style:{paddingLeft:20,paddingRight:20,width:e,textAlign:"right"},padding:"checkbox"},this.renderImportExportButtons(s))))}onDelete=e=>()=>{const t=JSON.parse(JSON.stringify(this.state.value));t.splice(e,1);const s={...this.state.tableErrors};s[e]&&(Object.keys(s[e]).forEach(o=>{this.props.onError(o,void 0)}),delete s[e]);const r={};Object.keys(s).forEach(o=>{const i=parseInt(o,10);i>e?r[i-1]=s[i]:r[i]=s[i]}),this.setState({value:t,iteration:this.state.iteration+1e4,tableErrors:r},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(t)))};onExport(){const{schema:e}=this.props,{value:t}=this.state,r=[e.items.map(a=>a.attr).join(";")];t.forEach(a=>{const l=[];e.items.forEach(u=>{a[u.attr]&&typeof a[u.attr]=="string"&&a[u.attr].includes(";")?l.push(`"${a[u.attr]}"`):l.push(a[u.attr]===void 0||a[u.attr]===null?"":a[u.attr])}),r.push(l.join(";"))});const o=document.createElement("a");o.setAttribute("href",`data:text/csv;charset=utf-8,${encodeURIComponent(r.join(`
`))}`);const i=new Date;o.setAttribute("download",`${i.getFullYear()}_${(i.getMonth()+1).toString().padStart(2,"0")}_${i.getDate().toString().padStart(2,"0")}_${this.props.oContext.adapterName}.${this.props.oContext.instance}_${this.props.attr}.csv`),o.style.display="none",document.body.appendChild(o),o.click(),document.body.removeChild(o)}onImport(e){var i;const t=e.split(`
`).map(a=>a.replace("\r","").trim()),{schema:s}=this.props,r=t.shift().split(";").filter(a=>a&&s.items.find(l=>l.attr===a)),o=[];t.forEach(a=>{const l=a.split(";"),u={};for(let d=0;d<l.length;d++){let h=l[d];if(h.startsWith('"')){for(h=h.substring(1);d<l.length&&!h.endsWith('"');)h+=`;${l[++d]}`;h=h.substring(0,h.length-1)}let p=h;if(h==="true")p=!0;else if(h==="false")p=!1;else if(window.isFinite(h)){const g=this.props.schema.items.find(m=>m.attr===r[d]);g&&g.type==="number"?p=parseFloat(h):p=h}else p=h;u[r[d]]=p}o.push(u)}),o.length?(i=this.state.value)!=null&&i.length?this.setState({showTypeOfImportDialog:o,showImportDialog:!1}):this.setState({value:o,showImportDialog:!1}):window.alert("ra_No data found in file")}onClone=e=>()=>{const t=JSON.parse(JSON.stringify(this.state.value)),s=JSON.parse(JSON.stringify(t[e]));if(typeof this.props.schema.clone=="string"&&typeof s[this.props.schema.clone]=="string"){let r=1,o=s[this.props.schema.clone];const i=o.match(/(\d+)$/);for(i?(o=o.replace(i[0],""),r=parseInt(i[0],10)+1):o+="_";t.find(a=>a[this.props.schema.clone]===o+r.toString());)r++;s[this.props.schema.clone]=`${s[this.props.schema.clone]}_${r}`}t.splice(e,0,s),this.setState({value:t,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(t)))};onChangeWrapper=(e,t)=>{this.typingTimer&&clearTimeout(this.typingTimer),this.typingTimer=setTimeout((s,r)=>{this.typingTimer=null;let o;if(this.props.schema.encryptedAttributes){const i=JSON.parse(JSON.stringify(s));if(i.forEach(a=>{this.props.schema.encryptedAttributes.forEach(l=>{a[l]&&(a[l]=yC(this.secret,a[l]))})}),this.props.schema.objKeyName){const a=Pa(i,this.props.schema.objKeyName,this.props.schema.objValueName);o=this.onChange(this.props.attr,a)}else o=this.onChange(this.props.attr,i)}else if(this.props.schema.objKeyName){const i=Pa(JSON.parse(JSON.stringify(s)),this.props.schema.objKeyName,this.props.schema.objValueName);o=this.onChange(this.props.attr,i)}else o=this.onChange(this.props.attr,s);o instanceof Promise&&o.catch(i=>console.error(`Cannot save: ${i}`)),r&&(this.applyFilter(!1,s),this.handleRequestSort(this.state.orderBy,!0))},300,e,t)};onAdd=()=>{var r;const{schema:e}=this.props,t=JSON.parse(JSON.stringify(this.state.value)),s=(r=e.items)==null?void 0:r.reduce((o,i)=>{let a;return i.defaultFunc?this.props.custom?a=i.defaultFunc?this.executeCustom(i.defaultFunc,this.props.data,this.props.customObj,this.props.oContext.instanceObj,t.length,this.props.data):this.props.schema.default:a=i.defaultFunc?this.execute(i.defaultFunc,this.props.schema.default,this.props.data,t.length,this.props.data):this.props.schema.default:a=i.default===void 0?null:i.default,o[i.attr]=a,o},{});t.push(s),this.setState({value:t},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(t)))};isAnyFilterSet(){return!!Object.keys(this.filterRefs).find(e=>gt.getFilterValue(this.filterRefs[e]))}applyFilter=(e,t,s)=>{t=t||this.state.value;let r=t.map((o,i)=>i);if(Object.keys(this.filterRefs).forEach(o=>{var a;let i=gt.getFilterValue(this.filterRefs[o]);if(!e&&i){i=i.toLowerCase();const l=(a=this.state.filterLabelMap)==null?void 0:a[o];r=r.filter(u=>{if(!t[u]||t[u][o]==null)return!1;if(t[u][o].toString().toLowerCase().includes(i))return!0;if(l){const h=l[t[u][o]];if(h&&h.toLowerCase().includes(i))return!0}return!1})}else this.filterRefs[o].current&&gt.setFilterValue(this.filterRefs[o],"")}),r.length===t.length&&(r=null),r===null&&this.state.visibleValue===null){s&&s();return}JSON.stringify(r)!==JSON.stringify(this.state.visibleValue)?this.setState({visibleValue:r},()=>s&&s()):s&&s()};onMoveUp(e){const t=JSON.parse(JSON.stringify(this.state.value)),s=t[e];t.splice(e,1),t.splice(e-1,0,s),this.setState({value:t,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(t)))}onMoveDown(e){const t=JSON.parse(JSON.stringify(this.state.value)),s=t[e];t.splice(e,1),t.splice(e+1,0,s),this.setState({value:t,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(t)))}onDrop(e){const t=e[0],s=new FileReader;s.onabort=()=>console.log("file reading was aborted"),s.onerror=()=>console.log("file reading has failed"),s.onload=()=>{if(t.size>Fo){window.alert(x.t("ra_File is too big. Max %sk allowed. Try use SVG.",Math.round(Fo/1024)));return}const r=new Uint8Array(s.result).reduce((o,i)=>o+String.fromCharCode(i),"");this.onImport(r)},s.readAsArrayBuffer(t)}showTypeOfImportDialog(){return this.state.showTypeOfImportDialog?c.createElement(os,{open:!0,onClose:()=>this.setState({showTypeOfImportDialog:!1}),maxWidth:"md"},c.createElement(Qs,null,x.t("ra_Append or replace?")),c.createElement(Cs,null,x.t("ra_Append %s entries or replace existing?",this.state.showTypeOfImportDialog.length)),c.createElement(Ds,null,c.createElement(Ne,{variant:"contained",color:"primary",autoFocus:!0,onClick:()=>{const e=JSON.parse(JSON.stringify(this.state.value));this.state.showTypeOfImportDialog.forEach(t=>e.push(t)),this.setState({value:e,iteration:this.state.iteration+1e4,showTypeOfImportDialog:!1},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(e)))}},x.t("ra_Append")),c.createElement(Ne,{variant:"contained",color:"secondary",autoFocus:!0,onClick:()=>{const e=this.state.showTypeOfImportDialog;this.setState({value:e,iteration:this.state.iteration+1e4,showTypeOfImportDialog:!1},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(e)))}},x.t("ra_Replace")))):null}showImportDialog(){return this.state.showImportDialog?c.createElement(os,{open:!0,onClose:()=>this.setState({showImportDialog:!1}),sx:{"& .MuiDialog-paper":{minHeight:500}},maxWidth:"md",fullWidth:!0},c.createElement(Qs,null,x.t("ra_Import from %s","CSV")),c.createElement(Cs,null,c.createElement(fl,{multiple:!1,accept:{"text/csv":[".csv"]},maxSize:Fo,onDragEnter:()=>this.setState({uploadFile:"dragging"}),onDragLeave:()=>this.setState({uploadFile:!0}),onDrop:(e,t)=>{this.setState({uploadFile:!1}),e.length?this.onDrop(e):window.alert(t&&t[0]&&t[0].errors&&t[0].errors[0]&&t[0].errors[0].message||x.t("ra_Cannot upload"))}},({getRootProps:e,getInputProps:t})=>c.createElement("div",{style:{...ge.uploadDiv,...this.state.uploadFile==="dragging"?ge.uploadDivDragging:void 0,...ge.dropZone,...this.state.icon?void 0:ge.dropZoneEmpty},...e()},c.createElement("input",{...t()}),c.createElement("div",{style:ge.uploadCenterDiv},c.createElement("div",{style:ge.uploadCenterTextAndIcon},c.createElement(On,{style:ge.uploadCenterIcon}),c.createElement("div",{style:ge.uploadCenterText},this.state.uploadFile==="dragging"?x.t("ra_Drop file here"):x.t("ra_Place your files here or click here to open the browse dialog"))))))),c.createElement(Ds,null,c.createElement(Ne,{variant:"contained",onClick:()=>this.setState({showImportDialog:!1}),color:"primary",startIcon:c.createElement(Mt,null)},x.t("Cancel")))):null}renderOneFilter(e){return c.createElement(Ve,{key:`${e.headCell.attr}_${e.index}`,style:e.style,align:"left",sortDirection:e.orderBy===e.headCell.attr?e.order:!1},c.createElement("div",{style:{...ge.flex,...e.schema.showFirstAddOnTop?{flexDirection:"column"}:void 0}},e.showAddButton?this.renderAddButton(e.doAnyFilterSet):null,e.headCell.sort&&c.createElement(Nu,{active:!0,style:e.orderBy!==e.headCell.attr?ge.silver:void 0,direction:e.orderBy===e.headCell.attr?e.order:"asc",onClick:()=>this.handleRequestSort(e.headCell.attr)}),e.headCell.filter&&this.state.filterOn.includes(e.headCell.attr)?c.createElement(xe,{variant:"standard",ref:this.filterRefs[e.headCell.attr],onChange:()=>this.applyFilter(),title:x.t("ra_You can filter entries by entering here some text"),slotProps:{input:{endAdornment:gt.getFilterValue(this.filterRefs[e.headCell.attr])&&c.createElement(Gs,{position:"end"},c.createElement(fe,{size:"small",tabIndex:-1,onClick:()=>{gt.setFilterValue(this.filterRefs[e.headCell.attr],""),this.applyFilter()}},c.createElement(Mt,null)))}},fullWidth:!0,placeholder:this.getText(e.headCell.title)}):c.createElement("span",{style:ge.headerText},this.getText(e.headCell.title)),this.renderShowHideFilter(e.headCell)))}enhancedFilterCard(){var i;const{schema:e}=this.props,{order:t,orderBy:s}=this.state;let r;this.props.schema.compact&&(r={paddingTop:1,paddingBottom:1});const o=!e.noDelete&&e.import||e.export;return o||e.items.find(a=>a.sort||a.filter)?c.createElement(ct,{size:{xs:e.xs||12,sm:e.sm||void 0,md:e.md||void 0,lg:e.lg||void 0,xl:e.xl||void 0}},c.createElement(yo,null,c.createElement(yn,{style:ge.paper},c.createElement(ei,{style:ge.paper},c.createElement(ti,{expandIcon:c.createElement(Er,null)},c.createElement(Ut,null,x.t("ra_Filter and Data Actions"))),c.createElement(si,null,c.createElement(bn,null,c.createElement(Cn,null,((i=e.items)==null?void 0:i.find(a=>a.sort||a.filter))&&e.items.map((a,l)=>c.createElement(Nt,{key:`${a.attr}_${l}`},this.renderOneFilter({schema:e,style:r,showAddButton:!1,headCell:a,order:t,orderBy:s,index:l,doAnyFilterSet:!1}))),o?c.createElement(Nt,null,c.createElement(Ve,{align:"left",style:r},c.createElement("span",{style:ge.headerText},x.t("ra_Actions"))),c.createElement(Ve,{style:r},this.renderImportExportButtons(e))):null))))))):null}enhancedBottomCard(){const{schema:e}=this.props;let t;this.props.schema.compact&&(t={paddingTop:1,paddingBottom:1});const s=this.isAnyFilterSet();return c.createElement(ct,{size:{xs:e.xs||12,sm:e.sm||void 0,md:e.md||void 0,lg:e.lg||void 0,xl:e.xl||void 0}},c.createElement(yo,null,c.createElement(yn,{style:ge.paper},c.createElement(bn,null,c.createElement(Cn,null,c.createElement(Nt,null,c.createElement(Ve,{colSpan:e.items.length+1,style:t},this.renderAddButton(s))))))))}renderCards(){const{schema:e}=this.props;let{visibleValue:t}=this.state,s;this.props.schema.compact&&(s={paddingTop:1,paddingBottom:1});const r={padding:0,borderBottom:"none"};t||=this.state.value.map((i,a)=>a);const o=this.isAnyFilterSet();return c.createElement(ct,{container:!0},this.showImportDialog(),this.showTypeOfImportDialog(),this.enhancedFilterCard(),t.map((i,a)=>{var l,u,d;return c.createElement(ct,{key:`${i}_${a}`,size:{xs:e.xs||12,sm:e.sm||void 0,md:e.md||void 0,lg:e.lg||void 0,xl:e.xl||void 0}},c.createElement(yo,{sx:this.state.tableErrors[i]?{outline:"1px solid red"}:void 0},c.createElement(yn,{style:ge.paper},this.props.schema.titleAttribute?c.createElement(Ze,{sx:ge.cardHeader},c.createElement("div",null,this.state.value[i][this.props.schema.titleAttribute]),c.createElement("div",null,!o&&!this.state.orderBy?c.createElement(Pe,{title:x.t("ra_Move up"),slotProps:{popper:{sx:ge.tooltip}}},c.createElement("span",null,c.createElement(fe,{size:"small",onClick:()=>this.onMoveUp(i),disabled:a===0},c.createElement(fr,null)))):null,!o&&!this.state.orderBy?c.createElement(Pe,{title:x.t("ra_Move down"),slotProps:{popper:{sx:ge.tooltip}}},c.createElement("span",null,c.createElement(fe,{size:"small",onClick:()=>this.onMoveDown(i),disabled:a===t.length-1},c.createElement(mr,null)))):null,c.createElement(Pe,{title:x.t("ra_Delete current row"),slotProps:{popper:{sx:ge.tooltip}}},c.createElement(fe,{size:"small",onClick:this.onDelete(i)},c.createElement(ts,null))),this.props.schema.clone?c.createElement(Pe,{title:x.t("ra_Clone current row"),slotProps:{popper:{sx:ge.tooltip}}},c.createElement(fe,{size:"small",onClick:this.onClone(i)},c.createElement(Ws,null))):null,c.createElement(Pe,{title:x.t("ra_Expand/Collapse card"),slotProps:{popper:{sx:ge.tooltip}}},c.createElement(fe,{size:"small",onClick:()=>{const h=[...this.state.collapsed],p=h.indexOf(i);p===-1?h.push(i):h.splice(p,1),window.localStorage.setItem(`table.collapsed.${this.props.oContext.instance}.${this.props.attr}`,JSON.stringify(h)),this.setState({collapsed:h})}},c.createElement(Er,{style:{rotate:(l=this.state.collapsed)!=null&&l.includes(i)?"0deg":"180deg",transition:"0.3s",transitionProperty:"rotate"}}))))):null,c.createElement(Bu,{in:!((u=this.state.collapsed)!=null&&u.includes(i)),timeout:"auto",unmountOnExit:!0},c.createElement(bn,null,c.createElement(Cn,null,(d=e.items)==null?void 0:d.map(h=>{var g,m;const p=(m=(g=this.listOfHiddenElements)==null?void 0:g[i])==null?void 0:m.includes(h.attr);return c.createElement(Nt,{key:`${h.attr}_${i}`},c.createElement(Ve,{align:"left",style:p?r:s},p?null:c.createElement("span",{style:ge.headerText},this.getText(h.title))),c.createElement(Ve,{align:"left",style:p?r:s},this.itemTable(h.attr,this.state.value[i],i,!0)))}),!this.props.schema.titleAttribute&&!e.noDelete&&c.createElement(Nt,null,c.createElement(Ve,{align:"left",style:s},c.createElement("span",{style:ge.headerText},this.getText("Actions"))),c.createElement(Ve,{align:"left",style:s},!o&&!this.state.orderBy?c.createElement(Pe,{title:x.t("ra_Move up"),slotProps:{popper:{sx:ge.tooltip}}},c.createElement("span",null,c.createElement(fe,{size:"small",onClick:()=>this.onMoveUp(i),disabled:a===0},c.createElement(fr,null)))):null,!o&&!this.state.orderBy?c.createElement(Pe,{title:x.t("ra_Move down"),slotProps:{popper:{sx:ge.tooltip}}},c.createElement("span",null,c.createElement(fe,{size:"small",onClick:()=>this.onMoveDown(i),disabled:a===t.length-1},c.createElement(mr,null)))):null,c.createElement(Pe,{title:x.t("ra_Delete current row"),slotProps:{popper:{sx:ge.tooltip}}},c.createElement(fe,{size:"small",onClick:this.onDelete(i)},c.createElement(ts,null))),this.props.schema.clone?c.createElement(Pe,{title:x.t("ra_Clone current row"),slotProps:{popper:{sx:ge.tooltip}}},c.createElement(fe,{size:"small",onClick:this.onClone(i)},c.createElement(Ws,null))):null))))))))}),this.enhancedBottomCard())}renderTable(){const{schema:e}=this.props;let{visibleValue:t}=this.state;t=t||this.state.value.map((o,i)=>i);const s=this.isAnyFilterSet();let r;return this.props.schema.compact&&(r={paddingTop:1,paddingBottom:1}),c.createElement(yn,{style:ge.paper},this.showImportDialog(),this.showTypeOfImportDialog(),e.label?c.createElement("div",{style:ge.label},c.createElement(xn,{variant:"dense",style:ge.rootTool},c.createElement(Ut,{style:ge.title,variant:"h6",id:"tableTitle",component:"div"},this.getText(e.label)))):null,c.createElement(Qa,null,c.createElement(bn,{style:ge.table,size:"small"},this.enhancedTableHead(!s&&!this.state.orderBy?120:64,s),c.createElement(Cn,null,t.map((o,i)=>{var a;return c.createElement(Nt,{hover:!0,key:`${o}_${i}`,sx:this.state.tableErrors[o]?{outline:"1px solid red"}:void 0},(a=e.items)==null?void 0:a.map(l=>c.createElement(Ve,{key:`${l.attr}_${o}`,align:"left",style:r},this.itemTable(l.attr,this.state.value[o],o,!1))),!e.noDelete&&c.createElement(Ve,{align:"left",style:{...r,...ge.buttonCell}},!s&&!this.state.orderBy?i?c.createElement(Pe,{title:x.t("ra_Move up"),slotProps:{popper:{sx:ge.tooltip}}},c.createElement(fe,{size:"small",onClick:()=>this.onMoveUp(o)},c.createElement(fr,null))):c.createElement("div",{style:ge.buttonEmpty}):null,!s&&!this.state.orderBy?i<t.length-1?c.createElement(Pe,{title:x.t("ra_Move down"),slotProps:{popper:{sx:ge.tooltip}}},c.createElement(fe,{size:"small",onClick:()=>this.onMoveDown(o)},c.createElement(mr,null))):c.createElement("div",{style:ge.buttonEmpty}):null,c.createElement(Pe,{title:x.t("ra_Delete current row"),slotProps:{popper:{sx:ge.tooltip}}},c.createElement(fe,{size:"small",onClick:this.onDelete(o)},c.createElement(ts,null))),this.props.schema.clone?c.createElement(Pe,{title:x.t("ra_Clone current row"),slotProps:{popper:{sx:ge.tooltip}}},c.createElement(fe,{size:"small",onClick:this.onClone(o)},c.createElement(Ws,null))):null))}),!e.noDelete&&t.length>=(e.showSecondAddAt||5)?c.createElement(Nt,null,c.createElement(Ve,{colSpan:e.items.length+1,style:{...r}},this.renderAddButton(s))):null)),!t.length&&this.state.value.length?c.createElement("div",{style:ge.filteredOut},c.createElement(Ut,{style:ge.title,variant:"h6",id:"tableTitle",component:"div"},x.t("ra_All items are filtered out"),c.createElement(fe,{size:"small",onClick:()=>this.applyFilter(!0)},c.createElement(Mt,null)))):null),e.help?c.createElement(Be,{style:{paddingLeft:16}},this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null,this.state.errorMessage?c.createElement("div",{style:{display:"flex",padding:"5px"}},c.createElement(_n,{color:"error"}),c.createElement("span",{style:{color:"red",alignSelf:"center"}},this.state.errorMessage)):null)}componentDidUpdate(){var e;(e=this.refDiv.current)!=null&&e.clientWidth&&this.refDiv.current.clientWidth!==this.state.width&&(this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{var t;this.resizeTimeout=null,this.setState({width:(t=this.refDiv.current)==null?void 0:t.clientWidth})},50))}getCurrentBreakpoint(){return this.state.width?this.state.width<600?"xs":this.state.width<900?"sm":this.state.width<1200?"md":this.state.width<1536?"lg":"xl":"md"}renderItem(){const{schema:e}=this.props;if(!this.state.value||!Array.isArray(this.state.value))return null;const t=this.getCurrentBreakpoint();let s;return t&&(e.useCardFor||["xs"]).includes(t)?s=this.renderCards():s=this.renderTable(),c.createElement("div",{ref:this.refDiv,style:{width:"100%"}},s)}}const ar={indeterminate:{opacity:.5},label:{width:"100%",fontSize:14,marginBottom:2},helper:{width:"100%",fontSize:12},error:{width:"100%",fontSize:12,color:"#FF0000"}};class CC extends F{updateTimeout=null;componentDidMount(){super.componentDidMount();let e=F.getValue(this.props.data,this.props.attr);if(Array.isArray(e)&&this.props.oContext.multiEdit){e=F.DIFFERENT_VALUE,this.setState({value:e,oldValue:e,jsonError:!1});return}this.setState({value:e,oldValue:e,jsonError:this.validateJson(e)})}validateJson(e){let t=!1;if(this.props.schema.validateJson&&(e||!this.props.schema.allowEmpty))try{JSON.parse(e)}catch(s){console.log("Error in JSON",s),t=!0}return t}static getDerivedStateFromProps(e,t){if(e.oContext.multiEdit&&t.value===F.DIFFERENT_VALUE)return{value:F.DIFFERENT_VALUE};let s=F.getValue(e.data,e.attr);return s!=null&&(s=s.toString()),s==null||s!==t.value&&s!==t.oldValue?{value:s}:null}renderItem(e,t){const s=Array.isArray(this.state.value)||this.state.value===F.DIFFERENT_VALUE;if(this.props.schema.time){let i="";return typeof this.state.value=="number"?this.state.value&&this.state.value<9466596e5?i=new Date(this.state.value*1e3).toLocaleString():i=new Date(this.state.value).toLocaleString():typeof this.state.value=="string"&&(i=new Date(this.state.value).toLocaleString()),c.createElement(xe,{variant:"standard",fullWidth:!0,value:i,error:!!e||!!this.state.jsonError,disabled:!!t,slotProps:{htmlInput:{readOnly:!0}},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}if(this.state.oldValue!==null&&this.state.oldValue!==void 0?(this.updateTimeout&&clearTimeout(this.updateTimeout),this.updateTimeout=setTimeout(()=>{this.updateTimeout=null,this.setState({oldValue:null})},30)):this.updateTimeout&&(clearTimeout(this.updateTimeout),this.updateTimeout=null),s){const i=F.getValue(this.props.data,this.props.attr),a=(i==null?void 0:i.filter(l=>l||l===0).map(l=>({label:l.toString()||"",value:l})))||[];return a.unshift({label:x.t(F.DIFFERENT_LABEL),value:F.DIFFERENT_VALUE}),c.createElement(Pr,{style:ar.indeterminate,fullWidth:!0,value:a[0],onChange:(l,u)=>{const d=u?u.value:"",h=this.onChange(this.props.attr,d,()=>{this.setState({value:d,oldValue:d,jsonError:this.validateJson(u)})});h instanceof Promise&&h.catch(p=>console.error(`Cannot set value: ${p}`))},options:a,getOptionLabel:l=>l.label,renderInput:l=>c.createElement(xe,{variant:"standard",...l,error:!!e,placeholder:this.getText(this.props.schema.placeholder),slotProps:{htmlInput:{...l.inputProps,maxLength:this.props.schema.maxLength||this.props.schema.max||void 0,readOnly:this.props.schema.readOnly||!1}},label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation),disabled:!!t})})}let r,o;if((this.props.schema.readOnly||t)&&this.props.schema.copyToClipboard?(this.props.schema.minRows>1&&(o={position:"absolute",right:3,top:20,zIndex:1e3}),r=c.createElement(fe,{tabIndex:-1,style:o,size:"small",onClick:()=>{je.copyToClipboard(this.state.value),window.alert(x.t("ra_Copied"))}},c.createElement(li,null))):!this.props.schema.readOnly&&!t&&this.state.value&&!this.props.schema.noClearButton&&(this.props.schema.minRows>1&&(o={position:"absolute",right:3,top:20,zIndex:1e3}),r=c.createElement(fe,{style:o,size:"small",tabIndex:-1,onClick:()=>this.setState({value:"",oldValue:this.state.value},()=>this.onChange(this.props.attr,""))},c.createElement(Mt,null)),this.props.schema.minRows<=1&&(r=c.createElement(Gs,{position:"end"},r))),this.props.schema.minRows>1){const i=this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation);return c.createElement("div",{style:{width:"100%",position:"relative"}},this.props.schema.label?c.createElement("div",{style:ar.label},this.getText(this.props.schema.label)):null,c.createElement(Mu,{style:{width:"100%",resize:"vertical",backgroundColor:this.props.oContext.themeType==="dark"?"#363636":"#cccccc",color:this.props.oContext.themeType==="dark"?"#fff":"#111"},minRows:this.props.schema.minRows,maxRows:this.props.schema.maxRows,value:this.state.value===null||this.state.value===void 0?"":this.state.value,disabled:!!t,readOnly:this.props.schema.readOnly||!1,onChange:a=>{const l=a.target.value;this.setState({value:l,oldValue:this.state.value,jsonError:this.validateJson(l)},()=>this.onChange(this.props.attr,l||""))},placeholder:this.getText(this.props.schema.placeholder)}),i||e||this.state.jsonError?c.createElement("div",{style:e?ar.error:ar.helper},e||(this.state.jsonError?x.t("ra_Invalid JSON"):i)):null)}return c.createElement(xe,{variant:"standard",fullWidth:!0,value:this.state.value===null||this.state.value===void 0?"":this.state.value,error:!!e||!!this.state.jsonError,disabled:!!t,slotProps:{htmlInput:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0,readOnly:this.props.schema.readOnly||!1},input:{endAdornment:r}},onChange:i=>{const a=i.target.value;this.setState({value:a,oldValue:this.state.value,jsonError:this.validateJson(a)},()=>this.onChange(this.props.attr,a))},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.state.jsonError?x.t("ra_Invalid JSON"):this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}}const DC={fullWidth:{width:"100%"}};class vC extends F{initialized=!1;localContext;askInstance(){if(this.props.alive){let e=this.props.schema.data;if(e===void 0&&this.props.schema.jsonData){const t=this.getPattern(this.props.schema.jsonData,null,!0);try{e=JSON.parse(t)}catch{console.error(`Cannot parse json data: ${t}`)}}e===void 0&&(e=null),this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",e).then(t=>{if(typeof t=="object"){const s=t;this.setState({text:s.text||"",style:s.style,icon:s.icon,iconStyle:s.iconStyle})}else typeof t=="string"&&this.setState({text:t||""})}).catch(t=>console.error(`Cannot send command: ${t}`))}}getLocalContext(){const e={};return Array.isArray(this.props.schema.alsoDependsOn)&&this.props.schema.alsoDependsOn.forEach(t=>e[t]=F.getValue(this.props.data,t)),JSON.stringify(e)}renderItem(){if(this.props.alive){const t=this.getLocalContext();(t!==this.localContext||!this.initialized)&&(this.localContext=t,setTimeout(()=>this.askInstance(),this.initialized?300:50),this.initialized=!0)}if(this.state.text===void 0)return null;let e=null;return this.state.icon&&(e=Xt(this.state.icon,{marginRight:this.state.text?8:void 0,...this.state.iconStyle||void 0}),e||(e=c.createElement(Es,{src:this.state.icon,style:{marginRight:this.state.text?8:void 0,...this.state.iconStyle||void 0}}))),this.props.schema.container==="text"?c.createElement(xe,{variant:"standard",fullWidth:!0,slotProps:{input:{endAdornment:this.props.schema.copyToClipboard?c.createElement(fe,{tabIndex:-1,size:"small",onClick:()=>{je.copyToClipboard(this.state.text),window.alert(x.t("ra_Copied"))}},c.createElement(li,null)):void 0}},value:this.state.text,label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)}):c.createElement("div",{style:{...DC.fullWidth,...this.state.style||void 0}},e,this.props.schema.container==="html"?c.createElement("span",{dangerouslySetInnerHTML:{__html:this.state.text||""}}):this.state.text)}}class wC extends F{componentDidMount(){super.componentDidMount();const e=F.getValue(this.props.data,this.props.attr);this.setState({value:e})}renderItem(e,t){const s=this.props.schema.returnFormat!=="HH:mm:ss",r=new Date(Date.parse(`Thu, 01 Jan 1970 ${this.state.value||"00:00:00"}`));return c.createElement(Db,{sx:o=>({width:"100%",borderBottom:`1px solid ${o.palette.text.primary}`,"& fieldset":{display:"none"},"& input":{padding:`${o.spacing(1.5)} 0 4px 0`},"& .MuiInputAdornment-root":{marginLeft:0,marginTop:1},"& label":{transform:"translate(0px, -9px) scale(0.75)"}}),ampm:this.props.oContext.systemConfig.dateFormat.includes("/"),timeSteps:this.props.schema.timeSteps||this.props.schema.timesteps||{hours:1,minutes:5,seconds:5},format:this.props.schema.format||"HH:mm:ss",disabled:!!t,value:r,onChange:o=>{let i;i=o instanceof Date?o.toTimeString().split(" ")[0]:o.toTimeString(),s&&(i=i.split(":").slice(0,2).join(":")),this.setState({value:i},()=>this.onChange(this.props.attr,this.state.value))},views:this.props.schema.views||["hours","minutes","seconds"],label:this.getText(this.props.schema.label)})}}function EC(n,e){let t;return e&&n.substring(0,e.length)===e?t=n.substring(e.length+1):t=n,t=t.replace(/\./g,"/").replace(/_/g," "),t}class xC extends F{componentDidMount(){var t;super.componentDidMount();const e=F.getValue(this.props.data,this.props.attr);if(!e&&((t=this.props.customObj)!=null&&t._id)){const s=EC(this.props.customObj._id,`${this.props.oContext.adapterName}.${this.props.oContext.instance}`);this.setState({value:s})}else this.setState({value:e||""})}renderItem(e,t){return c.createElement(xe,{variant:"standard",fullWidth:!0,slotProps:{htmlInput:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0}},value:this.state.value,error:!!e,disabled:t,placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation),onChange:s=>{const r=s.target.value;this.setState({value:r},()=>this.onChange(this.props.attr,r))}})}}class SC extends F{async componentDidMount(){var t;super.componentDidMount();const e=await this.props.oContext.socket.getObject("system.meta.uuid");this.setState({uuid:((t=e==null?void 0:e.native)==null?void 0:t.uuid)||"unknown"})}renderItem(e,t){return c.createElement(xe,{variant:"standard",fullWidth:!0,error:!!e,disabled:!!t,slotProps:{htmlInput:{readOnly:!0},input:{endAdornment:c.createElement(fe,{tabIndex:-1,onClick:()=>{je.copyToClipboard(this.state.uuid),window.alert(x.t("ra_Copied %s",this.state.uuid))}},c.createElement(Ws,null))}},value:this.state.uuid||"",label:this.getText(this.props.schema.label)||x.t("ra_Serial number (UUID)"),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}}const Na={icon:{width:16,height:16,marginRight:8}};class kC extends F{componentDidMount(){super.componentDidMount(),this.props.oContext.socket.getUsers().then(e=>{const t={},s=x.getLanguage();this.props.schema.short?e.forEach(r=>{var o,i;return t[r._id]={color:(o=r.common)==null?void 0:o.color,icon:(i=r.common)==null?void 0:i.icon,name:je.getObjectNameFromObj(r,s)}}):e.forEach(r=>{var o,i;return t[r._id.replace(/^system\.user\./,"")]={color:(o=r.common)==null?void 0:o.color,icon:(i=r.common)==null?void 0:i.icon,name:je.getObjectNameFromObj(r,s)}}),this.setState({users:t})}).catch(e=>console.error(`Cannot get users: ${e}`))}renderItem(e,t){var r,o;const s=F.getValue(this.props.data,this.props.attr);return c.createElement(_e,{variant:"standard",fullWidth:!0},this.state.users&&this.props.schema.label?c.createElement(Ke,null,this.getText(this.props.schema.label)):null,this.state.users?c.createElement(st,{variant:"standard",error:!!e,disabled:!!t,value:s,renderValue:i=>{var a,l,u;return c.createElement("span",null,this.state.users&&((a=this.state.users[i])!=null&&a.icon)?c.createElement(Es,{src:this.state.users&&((l=this.state.users[i])==null?void 0:l.icon),style:Na.icon}):null,this.state.users&&((u=this.state.users[i])==null?void 0:u.name)||i||"")},style:{color:this.state.users&&((r=this.state.users[s])==null?void 0:r.color)||void 0,backgroundColor:je.getInvertedColor(this.state.users&&((o=this.state.users[s])==null?void 0:o.color),this.props.oContext.themeType)},onChange:i=>this.onChange(this.props.attr,i.target.value)},this.state.users&&Object.keys(this.state.users).map(i=>c.createElement(ze,{style:{color:this.state.users[i].color||void 0,backgroundColor:je.getInvertedColor(this.state.users[i].color,this.props.oContext.themeType)},key:i,value:i},this.state.users[i].icon?c.createElement(Es,{src:this.state.users[i].icon,style:Na.icon}):null,this.state.users[i].name))):c.createElement(xe,{variant:"standard",error:!!e,disabled:!!t,value:s,onChange:i=>this.onChange(this.props.attr,i.target.value),label:this.getText(this.props.schema.label)}),this.props.schema.help?c.createElement(Be,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Fi=Symbol.for("yaml.alias"),Ho=Symbol.for("yaml.document"),ns=Symbol.for("yaml.map"),_c=Symbol.for("yaml.pair"),Lt=Symbol.for("yaml.scalar"),rn=Symbol.for("yaml.seq"),wt=Symbol.for("yaml.node.type"),Is=n=>!!n&&typeof n=="object"&&n[wt]===Fi,to=n=>!!n&&typeof n=="object"&&n[wt]===Ho,qn=n=>!!n&&typeof n=="object"&&n[wt]===ns,Ye=n=>!!n&&typeof n=="object"&&n[wt]===_c,Me=n=>!!n&&typeof n=="object"&&n[wt]===Lt,Yn=n=>!!n&&typeof n=="object"&&n[wt]===rn;function Je(n){if(n&&typeof n=="object")switch(n[wt]){case ns:case rn:return!0}return!1}function qe(n){if(n&&typeof n=="object")switch(n[wt]){case Fi:case ns:case Lt:case rn:return!0}return!1}const Oc=n=>(Me(n)||Je(n))&&!!n.anchor,gs=Symbol("break visit"),TC=Symbol("skip children"),Fn=Symbol("remove node");function on(n,e){const t=AC(e);to(n)?Rs(null,n.contents,t,Object.freeze([n]))===Fn&&(n.contents=null):Rs(null,n,t,Object.freeze([]))}on.BREAK=gs;on.SKIP=TC;on.REMOVE=Fn;function Rs(n,e,t,s){const r=FC(n,e,t,s);if(qe(r)||Ye(r))return IC(n,s,r),Rs(n,r,t,s);if(typeof r!="symbol"){if(Je(e)){s=Object.freeze(s.concat(e));for(let o=0;o<e.items.length;++o){const i=Rs(o,e.items[o],t,s);if(typeof i=="number")o=i-1;else{if(i===gs)return gs;i===Fn&&(e.items.splice(o,1),o-=1)}}}else if(Ye(e)){s=Object.freeze(s.concat(e));const o=Rs("key",e.key,t,s);if(o===gs)return gs;o===Fn&&(e.key=null);const i=Rs("value",e.value,t,s);if(i===gs)return gs;i===Fn&&(e.value=null)}}return r}function AC(n){return typeof n=="object"&&(n.Collection||n.Node||n.Value)?Object.assign({Alias:n.Node,Map:n.Node,Scalar:n.Node,Seq:n.Node},n.Value&&{Map:n.Value,Scalar:n.Value,Seq:n.Value},n.Collection&&{Map:n.Collection,Seq:n.Collection},n):n}function FC(n,e,t,s){var r,o,i,a,l;if(typeof t=="function")return t(n,e,s);if(qn(e))return(r=t.Map)==null?void 0:r.call(t,n,e,s);if(Yn(e))return(o=t.Seq)==null?void 0:o.call(t,n,e,s);if(Ye(e))return(i=t.Pair)==null?void 0:i.call(t,n,e,s);if(Me(e))return(a=t.Scalar)==null?void 0:a.call(t,n,e,s);if(Is(e))return(l=t.Alias)==null?void 0:l.call(t,n,e,s)}function IC(n,e,t){const s=e[e.length-1];if(Je(s))s.items[n]=t;else if(Ye(s))n==="key"?s.key=t:s.value=t;else if(to(s))s.contents=t;else{const r=Is(s)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}const _C={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},OC=n=>n.replace(/[!,[\]{}]/g,e=>_C[e]);class rt{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},rt.defaultYaml,e),this.tags=Object.assign({},rt.defaultTags,t)}clone(){const e=new rt(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){const e=new rt(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:rt.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},rt.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:rt.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},rt.defaultTags),this.atNextDocument=!1);const s=e.trim().split(/[ \t]+/),r=s.shift();switch(r){case"%TAG":{if(s.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),s.length<2))return!1;const[o,i]=s;return this.tags[o]=i,!0}case"%YAML":{if(this.yaml.explicit=!0,s.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;const[o]=s;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{const i=/^\d+\.\d+$/.test(o);return t(6,`Unsupported YAML version ${o}`,i),!1}}default:return t(0,`Unknown directive ${r}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){const i=e.slice(2,-1);return i==="!"||i==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),i)}const[,s,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);const o=this.tags[s];if(o)try{return o+decodeURIComponent(r)}catch(i){return t(String(i)),null}return s==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(const[t,s]of Object.entries(this.tags))if(e.startsWith(s))return t+OC(e.substring(s.length));return e[0]==="!"?e:`!<${e}>`}toString(e){const t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags);let r;if(e&&s.length>0&&qe(e.contents)){const o={};on(e.contents,(i,a)=>{qe(a)&&a.tag&&(o[a.tag]=!0)}),r=Object.keys(o)}else r=[];for(const[o,i]of s)o==="!!"&&i==="tag:yaml.org,2002:"||(!e||r.some(a=>a.startsWith(i)))&&t.push(`%TAG ${o} ${i}`);return t.join(`
`)}}rt.defaultYaml={explicit:!1,version:"1.2"};rt.defaultTags={"!!":"tag:yaml.org,2002:"};function Pc(n){if(/[\x00-\x19\s,[\]{}]/.test(n)){const t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(n)}`;throw new Error(t)}return!0}function Nc(n){const e=new Set;return on(n,{Value(t,s){s.anchor&&e.add(s.anchor)}}),e}function Bc(n,e){for(let t=1;;++t){const s=`${n}${t}`;if(!e.has(s))return s}}function PC(n,e){const t=[],s=new Map;let r=null;return{onAnchor:o=>{t.push(o),r??(r=Nc(n));const i=Bc(e,r);return r.add(i),i},setAnchors:()=>{for(const o of t){const i=s.get(o);if(typeof i=="object"&&i.anchor&&(Me(i.node)||Je(i.node)))i.node.anchor=i.anchor;else{const a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:s}}function js(n,e,t,s){if(s&&typeof s=="object")if(Array.isArray(s))for(let r=0,o=s.length;r<o;++r){const i=s[r],a=js(n,s,String(r),i);a===void 0?delete s[r]:a!==i&&(s[r]=a)}else if(s instanceof Map)for(const r of Array.from(s.keys())){const o=s.get(r),i=js(n,s,r,o);i===void 0?s.delete(r):i!==o&&s.set(r,i)}else if(s instanceof Set)for(const r of Array.from(s)){const o=js(n,s,r,r);o===void 0?s.delete(r):o!==r&&(s.delete(r),s.add(o))}else for(const[r,o]of Object.entries(s)){const i=js(n,s,r,o);i===void 0?delete s[r]:i!==o&&(s[r]=i)}return n.call(e,t,s)}function Ct(n,e,t){if(Array.isArray(n))return n.map((s,r)=>Ct(s,String(r),t));if(n&&typeof n.toJSON=="function"){if(!t||!Oc(n))return n.toJSON(e,t);const s={aliasCount:0,count:1,res:void 0};t.anchors.set(n,s),t.onCreate=o=>{s.res=o,delete t.onCreate};const r=n.toJSON(e,t);return t.onCreate&&t.onCreate(r),r}return typeof n=="bigint"&&!(t!=null&&t.keep)?Number(n):n}class Ii{constructor(e){Object.defineProperty(this,wt,{value:e})}clone(){const e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:s,onAnchor:r,reviver:o}={}){if(!to(e))throw new TypeError("A document argument is required");const i={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},a=Ct(this,"",i);if(typeof r=="function")for(const{count:l,res:u}of i.anchors.values())r(u,l);return typeof o=="function"?js(o,{"":a},"",a):a}}class _i extends Ii{constructor(e){super(Fi),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){let s;t!=null&&t.aliasResolveCache?s=t.aliasResolveCache:(s=[],on(e,{Node:(o,i)=>{(Is(i)||Oc(i))&&s.push(i)}}),t&&(t.aliasResolveCache=s));let r;for(const o of s){if(o===this)break;o.anchor===this.source&&(r=o)}return r}toJSON(e,t){if(!t)return{source:this.source};const{anchors:s,doc:r,maxAliasCount:o}=t,i=this.resolve(r,t);if(!i){const l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=s.get(i);if(a||(Ct(i,null,t),a=s.get(i)),(a==null?void 0:a.res)===void 0){const l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=yr(r,i,s)),a.count*a.aliasCount>o)){const l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,t,s){const r=`*${this.source}`;if(e){if(Pc(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){const o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${r} `}return r}}function yr(n,e,t){if(Is(e)){const s=e.resolve(n),r=t&&s&&t.get(s);return r?r.count*r.aliasCount:0}else if(Je(e)){let s=0;for(const r of e.items){const o=yr(n,r,t);o>s&&(s=o)}return s}else if(Ye(e)){const s=yr(n,e.key,t),r=yr(n,e.value,t);return Math.max(s,r)}return 1}const Mc=n=>!n||typeof n!="function"&&typeof n!="object";class be extends Ii{constructor(e){super(Lt),this.value=e}toJSON(e,t){return t!=null&&t.keep?this.value:Ct(this.value,e,t)}toString(){return String(this.value)}}be.BLOCK_FOLDED="BLOCK_FOLDED";be.BLOCK_LITERAL="BLOCK_LITERAL";be.PLAIN="PLAIN";be.QUOTE_DOUBLE="QUOTE_DOUBLE";be.QUOTE_SINGLE="QUOTE_SINGLE";const NC="tag:yaml.org,2002:";function BC(n,e,t){if(e){const s=t.filter(o=>o.tag===e),r=s.find(o=>!o.format)??s[0];if(!r)throw new Error(`Tag ${e} not found`);return r}return t.find(s=>{var r;return((r=s.identify)==null?void 0:r.call(s,n))&&!s.format})}function Vn(n,e,t){var h,p,g;if(to(n)&&(n=n.contents),qe(n))return n;if(Ye(n)){const m=(p=(h=t.schema[ns]).createNode)==null?void 0:p.call(h,t.schema,null,t);return m.items.push(n),m}(n instanceof String||n instanceof Number||n instanceof Boolean||typeof BigInt<"u"&&n instanceof BigInt)&&(n=n.valueOf());const{aliasDuplicateObjects:s,onAnchor:r,onTagObj:o,schema:i,sourceObjects:a}=t;let l;if(s&&n&&typeof n=="object"){if(l=a.get(n),l)return l.anchor??(l.anchor=r(n)),new _i(l.anchor);l={anchor:null,node:null},a.set(n,l)}e!=null&&e.startsWith("!!")&&(e=NC+e.slice(2));let u=BC(n,e,i.tags);if(!u){if(n&&typeof n.toJSON=="function"&&(n=n.toJSON()),!n||typeof n!="object"){const m=new be(n);return l&&(l.node=m),m}u=n instanceof Map?i[ns]:Symbol.iterator in Object(n)?i[rn]:i[ns]}o&&(o(u),delete t.onTagObj);const d=u!=null&&u.createNode?u.createNode(t.schema,n,t):typeof((g=u==null?void 0:u.nodeClass)==null?void 0:g.from)=="function"?u.nodeClass.from(t.schema,n,t):new be(n);return e?d.tag=e:u.default||(d.tag=u.tag),l&&(l.node=d),d}function _r(n,e,t){let s=t;for(let r=e.length-1;r>=0;--r){const o=e[r];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){const i=[];i[o]=s,s=i}else s=new Map([[o,s]])}return Vn(s,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:n,sourceObjects:new Map})}const wn=n=>n==null||typeof n=="object"&&!!n[Symbol.iterator]().next().done;class $c extends Ii{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(s=>qe(s)||Ye(s)?s.clone(e):s),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(wn(e))this.add(t);else{const[s,...r]=e,o=this.get(s,!0);if(Je(o))o.addIn(r,t);else if(o===void 0&&this.schema)this.set(s,_r(this.schema,r,t));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${r}`)}}deleteIn(e){const[t,...s]=e;if(s.length===0)return this.delete(t);const r=this.get(t,!0);if(Je(r))return r.deleteIn(s);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${s}`)}getIn(e,t){const[s,...r]=e,o=this.get(s,!0);return r.length===0?!t&&Me(o)?o.value:o:Je(o)?o.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!Ye(t))return!1;const s=t.value;return s==null||e&&Me(s)&&s.value==null&&!s.commentBefore&&!s.comment&&!s.tag})}hasIn(e){const[t,...s]=e;if(s.length===0)return this.has(t);const r=this.get(t,!0);return Je(r)?r.hasIn(s):!1}setIn(e,t){const[s,...r]=e;if(r.length===0)this.set(s,t);else{const o=this.get(s,!0);if(Je(o))o.setIn(r,t);else if(o===void 0&&this.schema)this.set(s,_r(this.schema,r,t));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${r}`)}}}const MC=n=>n.replace(/^(?!$)(?: $)?/gm,"#");function jt(n,e){return/^\n+$/.test(n)?n.substring(1):e?n.replace(/^(?! *$)/gm,e):n}const ys=(n,e,t)=>n.endsWith(`
`)?jt(t,e):t.includes(`
`)?`
`+jt(t,e):(n.endsWith(" ")?"":" ")+t,Lc="flow",Jo="block",br="quoted";function so(n,e,t="flow",{indentAtStart:s,lineWidth:r=80,minContentWidth:o=20,onFold:i,onOverflow:a}={}){if(!r||r<0)return n;r<o&&(o=0);const l=Math.max(1+o,1+r-e.length);if(n.length<=l)return n;const u=[],d={};let h=r-e.length;typeof s=="number"&&(s>r-Math.max(2,o)?u.push(0):h=r-s);let p,g,m=!1,f=-1,y=-1,b=-1;t===Jo&&(f=Ba(n,f,e.length),f!==-1&&(h=f+l));for(let D;D=n[f+=1];){if(t===br&&D==="\\"){switch(y=f,n[f+1]){case"x":f+=3;break;case"u":f+=5;break;case"U":f+=9;break;default:f+=1}b=f}if(D===`
`)t===Jo&&(f=Ba(n,f,e.length)),h=f+e.length+l,p=void 0;else{if(D===" "&&g&&g!==" "&&g!==`
`&&g!=="	"){const v=n[f+1];v&&v!==" "&&v!==`
`&&v!=="	"&&(p=f)}if(f>=h)if(p)u.push(p),h=p+l,p=void 0;else if(t===br){for(;g===" "||g==="	";)g=D,D=n[f+=1],m=!0;const v=f>b+1?f-2:y-1;if(d[v])return n;u.push(v),d[v]=!0,h=v+l,p=void 0}else m=!0}g=D}if(m&&a&&a(),u.length===0)return n;i&&i();let C=n.slice(0,u[0]);for(let D=0;D<u.length;++D){const v=u[D],E=u[D+1]||n.length;v===0?C=`
${e}${n.slice(0,E)}`:(t===br&&d[v]&&(C+=`${n[v]}\\`),C+=`
${e}${n.slice(v+1,E)}`)}return C}function Ba(n,e,t){let s=e,r=e+1,o=n[r];for(;o===" "||o==="	";)if(e<r+t)o=n[++e];else{do o=n[++e];while(o&&o!==`
`);s=e,r=e+1,o=n[r]}return s}const no=(n,e)=>({indentAtStart:e?n.indent.length:n.indentAtStart,lineWidth:n.options.lineWidth,minContentWidth:n.options.minContentWidth}),ro=n=>/^(%|---|\.\.\.)/m.test(n);function $C(n,e,t){if(!e||e<0)return!1;const s=e-t,r=n.length;if(r<=s)return!1;for(let o=0,i=0;o<r;++o)if(n[o]===`
`){if(o-i>s)return!0;if(i=o+1,r-i<=s)return!1}return!0}function In(n,e){const t=JSON.stringify(n);if(e.options.doubleQuotedAsJSON)return t;const{implicitKey:s}=e,r=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(ro(n)?"  ":"");let i="",a=0;for(let l=0,u=t[l];u;u=t[++l])if(u===" "&&t[l+1]==="\\"&&t[l+2]==="n"&&(i+=t.slice(a,l)+"\\ ",l+=1,a=l,u="\\"),u==="\\")switch(t[l+1]){case"u":{i+=t.slice(a,l);const d=t.substr(l+2,4);switch(d){case"0000":i+="\\0";break;case"0007":i+="\\a";break;case"000b":i+="\\v";break;case"001b":i+="\\e";break;case"0085":i+="\\N";break;case"00a0":i+="\\_";break;case"2028":i+="\\L";break;case"2029":i+="\\P";break;default:d.substr(0,2)==="00"?i+="\\x"+d.substr(2):i+=t.substr(l,6)}l+=5,a=l+1}break;case"n":if(s||t[l+2]==='"'||t.length<r)l+=1;else{for(i+=t.slice(a,l)+`

`;t[l+2]==="\\"&&t[l+3]==="n"&&t[l+4]!=='"';)i+=`
`,l+=2;i+=o,t[l+2]===" "&&(i+="\\"),l+=1,a=l+1}break;default:l+=1}return i=a?i+t.slice(a):t,s?i:so(i,o,br,no(e,!1))}function Ko(n,e){if(e.options.singleQuote===!1||e.implicitKey&&n.includes(`
`)||/[ \t]\n|\n[ \t]/.test(n))return In(n,e);const t=e.indent||(ro(n)?"  ":""),s="'"+n.replace(/'/g,"''").replace(/\n+/g,`$&
${t}`)+"'";return e.implicitKey?s:so(s,t,Lc,no(e,!1))}function Us(n,e){const{singleQuote:t}=e.options;let s;if(t===!1)s=In;else{const r=n.includes('"'),o=n.includes("'");r&&!o?s=Ko:o&&!r?s=In:s=t?Ko:In}return s(n,e)}let qo;try{qo=new RegExp(`(^|(?<!
))
+(?!
|$)`,"g")}catch{qo=/\n+(?!\n|$)/g}function Cr({comment:n,type:e,value:t},s,r,o){const{blockQuote:i,commentString:a,lineWidth:l}=s.options;if(!i||/\n[\t ]+$/.test(t))return Us(t,s);const u=s.indent||(s.forceBlockIndent||ro(t)?"  ":""),d=i==="literal"?!0:i==="folded"||e===be.BLOCK_FOLDED?!1:e===be.BLOCK_LITERAL?!0:!$C(t,l,u.length);if(!t)return d?`|
`:`>
`;let h,p;for(p=t.length;p>0;--p){const E=t[p-1];if(E!==`
`&&E!=="	"&&E!==" ")break}let g=t.substring(p);const m=g.indexOf(`
`);m===-1?h="-":t===g||m!==g.length-1?(h="+",o&&o()):h="",g&&(t=t.slice(0,-g.length),g[g.length-1]===`
`&&(g=g.slice(0,-1)),g=g.replace(qo,`$&${u}`));let f=!1,y,b=-1;for(y=0;y<t.length;++y){const E=t[y];if(E===" ")f=!0;else if(E===`
`)b=y;else break}let C=t.substring(0,b<y?b+1:y);C&&(t=t.substring(C.length),C=C.replace(/\n+/g,`$&${u}`));let v=(f?u?"2":"1":"")+h;if(n&&(v+=" "+a(n.replace(/ ?[\r\n]+/g," ")),r&&r()),!d){const E=t.replace(/\n+/g,`
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${u}`);let A=!1;const S=no(s,!0);i!=="folded"&&e!==be.BLOCK_FOLDED&&(S.onOverflow=()=>{A=!0});const T=so(`${C}${E}${g}`,u,Jo,S);if(!A)return`>${v}
${u}${T}`}return t=t.replace(/\n+/g,`$&${u}`),`|${v}
${u}${C}${t}${g}`}function LC(n,e,t,s){const{type:r,value:o}=n,{actualString:i,implicitKey:a,indent:l,indentStep:u,inFlow:d}=e;if(a&&o.includes(`
`)||d&&/[[\]{},]/.test(o))return Us(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||d||!o.includes(`
`)?Us(o,e):Cr(n,e,t,s);if(!a&&!d&&r!==be.PLAIN&&o.includes(`
`))return Cr(n,e,t,s);if(ro(o)){if(l==="")return e.forceBlockIndent=!0,Cr(n,e,t,s);if(a&&l===u)return Us(o,e)}const h=o.replace(/\n+/g,`$&
${l}`);if(i){const p=f=>{var y;return f.default&&f.tag!=="tag:yaml.org,2002:str"&&((y=f.test)==null?void 0:y.test(h))},{compat:g,tags:m}=e.doc.schema;if(m.some(p)||g!=null&&g.some(p))return Us(o,e)}return a?h:so(h,l,Lc,no(e,!1))}function Oi(n,e,t,s){const{implicitKey:r,inFlow:o}=e,i=typeof n.value=="string"?n:Object.assign({},n,{value:String(n.value)});let{type:a}=n;a!==be.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(i.value)&&(a=be.QUOTE_DOUBLE);const l=d=>{switch(d){case be.BLOCK_FOLDED:case be.BLOCK_LITERAL:return r||o?Us(i.value,e):Cr(i,e,t,s);case be.QUOTE_DOUBLE:return In(i.value,e);case be.QUOTE_SINGLE:return Ko(i.value,e);case be.PLAIN:return LC(i,e,t,s);default:return null}};let u=l(a);if(u===null){const{defaultKeyType:d,defaultStringType:h}=e.options,p=r&&d||h;if(u=l(p),u===null)throw new Error(`Unsupported default string type ${p}`)}return u}function Vc(n,e){const t=Object.assign({blockQuote:!0,commentString:MC,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},n.schema.toStringOptions,e);let s;switch(t.collectionStyle){case"block":s=!1;break;case"flow":s=!0;break;default:s=null}return{anchors:new Set,doc:n,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):"  ",inFlow:s,options:t}}function VC(n,e){var r;if(e.tag){const o=n.filter(i=>i.tag===e.tag);if(o.length>0)return o.find(i=>i.format===e.format)??o[0]}let t,s;if(Me(e)){s=e.value;let o=n.filter(i=>{var a;return(a=i.identify)==null?void 0:a.call(i,s)});if(o.length>1){const i=o.filter(a=>a.test);i.length>0&&(o=i)}t=o.find(i=>i.format===e.format)??o.find(i=>!i.format)}else s=e,t=n.find(o=>o.nodeClass&&s instanceof o.nodeClass);if(!t){const o=((r=s==null?void 0:s.constructor)==null?void 0:r.name)??(s===null?"null":typeof s);throw new Error(`Tag not resolved for ${o} value`)}return t}function RC(n,e,{anchors:t,doc:s}){if(!s.directives)return"";const r=[],o=(Me(n)||Je(n))&&n.anchor;o&&Pc(o)&&(t.add(o),r.push(`&${o}`));const i=n.tag??(e.default?null:e.tag);return i&&r.push(s.directives.tagString(i)),r.join(" ")}function Zs(n,e,t,s){var l;if(Ye(n))return n.toString(e,t,s);if(Is(n)){if(e.doc.directives)return n.toString(e);if((l=e.resolvedAliases)!=null&&l.has(n))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(n):e.resolvedAliases=new Set([n]),n=n.resolve(e.doc)}let r;const o=qe(n)?n:e.doc.createNode(n,{onTagObj:u=>r=u});r??(r=VC(e.doc.schema.tags,o));const i=RC(o,r,e);i.length>0&&(e.indentAtStart=(e.indentAtStart??0)+i.length+1);const a=typeof r.stringify=="function"?r.stringify(o,e,t,s):Me(o)?Oi(o,e,t,s):o.toString(e,t,s);return i?Me(o)||a[0]==="{"||a[0]==="["?`${i} ${a}`:`${i}
${e.indent}${a}`:a}function jC({key:n,value:e},t,s,r){const{allNullValues:o,doc:i,indent:a,indentStep:l,options:{commentString:u,indentSeq:d,simpleKeys:h}}=t;let p=qe(n)&&n.comment||null;if(h){if(p)throw new Error("With simple keys, key nodes cannot have comments");if(Je(n)||!qe(n)&&typeof n=="object"){const S="With simple keys, collection cannot be used as a key value";throw new Error(S)}}let g=!h&&(!n||p&&e==null&&!t.inFlow||Je(n)||(Me(n)?n.type===be.BLOCK_FOLDED||n.type===be.BLOCK_LITERAL:typeof n=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!g&&(h||!o),indent:a+l});let m=!1,f=!1,y=Zs(n,t,()=>m=!0,()=>f=!0);if(!g&&!t.inFlow&&y.length>1024){if(h)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");g=!0}if(t.inFlow){if(o||e==null)return m&&s&&s(),y===""?"?":g?`? ${y}`:y}else if(o&&!h||e==null&&g)return y=`? ${y}`,p&&!m?y+=ys(y,t.indent,u(p)):f&&r&&r(),y;m&&(p=null),g?(p&&(y+=ys(y,t.indent,u(p))),y=`? ${y}
${a}:`):(y=`${y}:`,p&&(y+=ys(y,t.indent,u(p))));let b,C,D;qe(e)?(b=!!e.spaceBefore,C=e.commentBefore,D=e.comment):(b=!1,C=null,D=null,e&&typeof e=="object"&&(e=i.createNode(e))),t.implicitKey=!1,!g&&!p&&Me(e)&&(t.indentAtStart=y.length+1),f=!1,!d&&l.length>=2&&!t.inFlow&&!g&&Yn(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let v=!1;const E=Zs(e,t,()=>v=!0,()=>f=!0);let A=" ";if(p||b||C){if(A=b?`
`:"",C){const S=u(C);A+=`
${jt(S,t.indent)}`}E===""&&!t.inFlow?A===`
`&&D&&(A=`

`):A+=`
${t.indent}`}else if(!g&&Je(e)){const S=E[0],T=E.indexOf(`
`),N=T!==-1,V=t.inFlow??e.flow??e.items.length===0;if(N||!V){let _=!1;if(N&&(S==="&"||S==="!")){let $=E.indexOf(" ");S==="&"&&$!==-1&&$<T&&E[$+1]==="!"&&($=E.indexOf(" ",$+1)),($===-1||T<$)&&(_=!0)}_||(A=`
${t.indent}`)}}else(E===""||E[0]===`
`)&&(A="");return y+=A+E,t.inFlow?v&&s&&s():D&&!v?y+=ys(y,t.indent,u(D)):f&&r&&r(),y}function Rc(n,e){(n==="debug"||n==="warn")&&console.warn(e)}const lr="<<",Ht={identify:n=>n===lr||typeof n=="symbol"&&n.description===lr,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new be(Symbol(lr)),{addToJSMap:jc}),stringify:()=>lr},UC=(n,e)=>(Ht.identify(e)||Me(e)&&(!e.type||e.type===be.PLAIN)&&Ht.identify(e.value))&&(n==null?void 0:n.doc.schema.tags.some(t=>t.tag===Ht.tag&&t.default));function jc(n,e,t){if(t=n&&Is(t)?t.resolve(n.doc):t,Yn(t))for(const s of t.items)Io(n,e,s);else if(Array.isArray(t))for(const s of t)Io(n,e,s);else Io(n,e,t)}function Io(n,e,t){const s=n&&Is(t)?t.resolve(n.doc):t;if(!qn(s))throw new Error("Merge sources must be maps or map aliases");const r=s.toJSON(null,n,Map);for(const[o,i]of r)e instanceof Map?e.has(o)||e.set(o,i):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:i,writable:!0,enumerable:!0,configurable:!0});return e}function Uc(n,e,{key:t,value:s}){if(qe(t)&&t.addToJSMap)t.addToJSMap(n,e,s);else if(UC(n,t))jc(n,e,s);else{const r=Ct(t,"",n);if(e instanceof Map)e.set(r,Ct(s,r,n));else if(e instanceof Set)e.add(r);else{const o=WC(t,r,n),i=Ct(s,o,n);o in e?Object.defineProperty(e,o,{value:i,writable:!0,enumerable:!0,configurable:!0}):e[o]=i}}return e}function WC(n,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(qe(n)&&(t!=null&&t.doc)){const s=Vc(t.doc,{});s.anchors=new Set;for(const o of t.anchors.keys())s.anchors.add(o.anchor);s.inFlow=!0,s.inStringifyKey=!0;const r=n.toString(s);if(!t.mapKeyWarned){let o=JSON.stringify(r);o.length>40&&(o=o.substring(0,36)+'..."'),Rc(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return r}return JSON.stringify(e)}function Pi(n,e,t){const s=Vn(n,void 0,t),r=Vn(e,void 0,t);return new at(s,r)}class at{constructor(e,t=null){Object.defineProperty(this,wt,{value:_c}),this.key=e,this.value=t}clone(e){let{key:t,value:s}=this;return qe(t)&&(t=t.clone(e)),qe(s)&&(s=s.clone(e)),new at(t,s)}toJSON(e,t){const s=t!=null&&t.mapAsMap?new Map:{};return Uc(t,s,this)}toString(e,t,s){return e!=null&&e.doc?jC(this,e,t,s):JSON.stringify(this)}}function Wc(n,e,t){return(e.inFlow??n.flow?HC:zC)(n,e,t)}function zC({comment:n,items:e},t,{blockItemPrefix:s,flowChars:r,itemIndent:o,onChompKeep:i,onComment:a}){const{indent:l,options:{commentString:u}}=t,d=Object.assign({},t,{indent:o,type:null});let h=!1;const p=[];for(let m=0;m<e.length;++m){const f=e[m];let y=null;if(qe(f))!h&&f.spaceBefore&&p.push(""),Or(t,p,f.commentBefore,h),f.comment&&(y=f.comment);else if(Ye(f)){const C=qe(f.key)?f.key:null;C&&(!h&&C.spaceBefore&&p.push(""),Or(t,p,C.commentBefore,h))}h=!1;let b=Zs(f,d,()=>y=null,()=>h=!0);y&&(b+=ys(b,o,u(y))),h&&y&&(h=!1),p.push(s+b)}let g;if(p.length===0)g=r.start+r.end;else{g=p[0];for(let m=1;m<p.length;++m){const f=p[m];g+=f?`
${l}${f}`:`
`}}return n?(g+=`
`+jt(u(n),l),a&&a()):h&&i&&i(),g}function HC({items:n},e,{flowChars:t,itemIndent:s}){const{indent:r,indentStep:o,flowCollectionPadding:i,options:{commentString:a}}=e;s+=o;const l=Object.assign({},e,{indent:s,inFlow:!0,type:null});let u=!1,d=0;const h=[];for(let m=0;m<n.length;++m){const f=n[m];let y=null;if(qe(f))f.spaceBefore&&h.push(""),Or(e,h,f.commentBefore,!1),f.comment&&(y=f.comment);else if(Ye(f)){const C=qe(f.key)?f.key:null;C&&(C.spaceBefore&&h.push(""),Or(e,h,C.commentBefore,!1),C.comment&&(u=!0));const D=qe(f.value)?f.value:null;D?(D.comment&&(y=D.comment),D.commentBefore&&(u=!0)):f.value==null&&(C!=null&&C.comment)&&(y=C.comment)}y&&(u=!0);let b=Zs(f,l,()=>y=null);u||(u=h.length>d||b.includes(`
`)),m<n.length-1?b+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(u||(u=h.reduce((C,D)=>C+D.length+2,2)+(b.length+2)>e.options.lineWidth)),u&&(b+=",")),y&&(b+=ys(b,s,a(y))),h.push(b),d=h.length}const{start:p,end:g}=t;if(h.length===0)return p+g;if(!u){const m=h.reduce((f,y)=>f+y.length+2,2);u=e.options.lineWidth>0&&m>e.options.lineWidth}if(u){let m=p;for(const f of h)m+=f?`
${o}${r}${f}`:`
`;return`${m}
${r}${g}`}else return`${p}${i}${h.join(" ")}${i}${g}`}function Or({indent:n,options:{commentString:e}},t,s,r){if(s&&r&&(s=s.replace(/^\n+/,"")),s){const o=jt(e(s),n);t.push(o.trimStart())}}function bs(n,e){const t=Me(e)?e.value:e;for(const s of n)if(Ye(s)&&(s.key===e||s.key===t||Me(s.key)&&s.key.value===t))return s}class bt extends $c{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(ns,e),this.items=[]}static from(e,t,s){const{keepUndefined:r,replacer:o}=s,i=new this(e),a=(l,u)=>{if(typeof o=="function")u=o.call(t,l,u);else if(Array.isArray(o)&&!o.includes(l))return;(u!==void 0||r)&&i.items.push(Pi(l,u,s))};if(t instanceof Map)for(const[l,u]of t)a(l,u);else if(t&&typeof t=="object")for(const l of Object.keys(t))a(l,t[l]);return typeof e.sortMapEntries=="function"&&i.items.sort(e.sortMapEntries),i}add(e,t){var i;let s;Ye(e)?s=e:!e||typeof e!="object"||!("key"in e)?s=new at(e,e==null?void 0:e.value):s=new at(e.key,e.value);const r=bs(this.items,s.key),o=(i=this.schema)==null?void 0:i.sortMapEntries;if(r){if(!t)throw new Error(`Key ${s.key} already set`);Me(r.value)&&Mc(s.value)?r.value.value=s.value:r.value=s.value}else if(o){const a=this.items.findIndex(l=>o(s,l)<0);a===-1?this.items.push(s):this.items.splice(a,0,s)}else this.items.push(s)}delete(e){const t=bs(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){const s=bs(this.items,e),r=s==null?void 0:s.value;return(!t&&Me(r)?r.value:r)??void 0}has(e){return!!bs(this.items,e)}set(e,t){this.add(new at(e,t),!0)}toJSON(e,t,s){const r=s?new s:t!=null&&t.mapAsMap?new Map:{};t!=null&&t.onCreate&&t.onCreate(r);for(const o of this.items)Uc(t,r,o);return r}toString(e,t,s){if(!e)return JSON.stringify(this);for(const r of this.items)if(!Ye(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Wc(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:s,onComment:t})}}const an={collection:"map",default:!0,nodeClass:bt,tag:"tag:yaml.org,2002:map",resolve(n,e){return qn(n)||e("Expected a mapping for this tag"),n},createNode:(n,e,t)=>bt.from(n,e,t)};class ks extends $c{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(rn,e),this.items=[]}add(e){this.items.push(e)}delete(e){const t=cr(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){const s=cr(e);if(typeof s!="number")return;const r=this.items[s];return!t&&Me(r)?r.value:r}has(e){const t=cr(e);return typeof t=="number"&&t<this.items.length}set(e,t){const s=cr(e);if(typeof s!="number")throw new Error(`Expected a valid index, not ${e}.`);const r=this.items[s];Me(r)&&Mc(t)?r.value=t:this.items[s]=t}toJSON(e,t){const s=[];t!=null&&t.onCreate&&t.onCreate(s);let r=0;for(const o of this.items)s.push(Ct(o,String(r++),t));return s}toString(e,t,s){return e?Wc(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+"  ",onChompKeep:s,onComment:t}):JSON.stringify(this)}static from(e,t,s){const{replacer:r}=s,o=new this(e);if(t&&Symbol.iterator in Object(t)){let i=0;for(let a of t){if(typeof r=="function"){const l=t instanceof Set?a:String(i++);a=r.call(t,l,a)}o.items.push(Vn(a,void 0,s))}}return o}}function cr(n){let e=Me(n)?n.value:n;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}const ln={collection:"seq",default:!0,nodeClass:ks,tag:"tag:yaml.org,2002:seq",resolve(n,e){return Yn(n)||e("Expected a sequence for this tag"),n},createNode:(n,e,t)=>ks.from(n,e,t)},oo={identify:n=>typeof n=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:n=>n,stringify(n,e,t,s){return e=Object.assign({actualString:!0},e),Oi(n,e,t,s)}},io={identify:n=>n==null,createNode:()=>new be(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new be(null),stringify:({source:n},e)=>typeof n=="string"&&io.test.test(n)?n:e.options.nullStr},Ni={identify:n=>typeof n=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:n=>new be(n[0]==="t"||n[0]==="T"),stringify({source:n,value:e},t){if(n&&Ni.test.test(n)){const s=n[0]==="t"||n[0]==="T";if(e===s)return n}return e?t.options.trueStr:t.options.falseStr}};function _t({format:n,minFractionDigits:e,tag:t,value:s}){if(typeof s=="bigint")return String(s);const r=typeof s=="number"?s:Number(s);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let o=Object.is(s,-0)?"-0":JSON.stringify(s);if(!n&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^\d/.test(o)){let i=o.indexOf(".");i<0&&(i=o.length,o+=".");let a=e-(o.length-i-1);for(;a-- >0;)o+="0"}return o}const zc={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:n=>n.slice(-3).toLowerCase()==="nan"?NaN:n[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:_t},Hc={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:n=>parseFloat(n),stringify(n){const e=Number(n.value);return isFinite(e)?e.toExponential():_t(n)}},Jc={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(n){const e=new be(parseFloat(n)),t=n.indexOf(".");return t!==-1&&n[n.length-1]==="0"&&(e.minFractionDigits=n.length-t-1),e},stringify:_t},ao=n=>typeof n=="bigint"||Number.isInteger(n),Bi=(n,e,t,{intAsBigInt:s})=>s?BigInt(n):parseInt(n.substring(e),t);function Kc(n,e,t){const{value:s}=n;return ao(s)&&s>=0?t+s.toString(e):_t(n)}const qc={identify:n=>ao(n)&&n>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(n,e,t)=>Bi(n,2,8,t),stringify:n=>Kc(n,8,"0o")},Yc={identify:ao,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(n,e,t)=>Bi(n,0,10,t),stringify:_t},Gc={identify:n=>ao(n)&&n>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(n,e,t)=>Bi(n,2,16,t),stringify:n=>Kc(n,16,"0x")},JC=[an,ln,oo,io,Ni,qc,Yc,Gc,zc,Hc,Jc];function Ma(n){return typeof n=="bigint"||Number.isInteger(n)}const ur=({value:n})=>JSON.stringify(n),KC=[{identify:n=>typeof n=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:n=>n,stringify:ur},{identify:n=>n==null,createNode:()=>new be(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:ur},{identify:n=>typeof n=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:n=>n==="true",stringify:ur},{identify:Ma,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(n,e,{intAsBigInt:t})=>t?BigInt(n):parseInt(n,10),stringify:({value:n})=>Ma(n)?n.toString():JSON.stringify(n)},{identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:n=>parseFloat(n),stringify:ur}],qC={default:!0,tag:"",test:/^/,resolve(n,e){return e(`Unresolved plain scalar ${JSON.stringify(n)}`),n}},YC=[an,ln].concat(KC,qC),Mi={identify:n=>n instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(n,e){if(typeof atob=="function"){const t=atob(n.replace(/[\n\r]/g,"")),s=new Uint8Array(t.length);for(let r=0;r<t.length;++r)s[r]=t.charCodeAt(r);return s}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),n},stringify({comment:n,type:e,value:t},s,r,o){if(!t)return"";const i=t;let a;if(typeof btoa=="function"){let l="";for(let u=0;u<i.length;++u)l+=String.fromCharCode(i[u]);a=btoa(l)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=be.BLOCK_LITERAL),e!==be.QUOTE_DOUBLE){const l=Math.max(s.options.lineWidth-s.indent.length,s.options.minContentWidth),u=Math.ceil(a.length/l),d=new Array(u);for(let h=0,p=0;h<u;++h,p+=l)d[h]=a.substr(p,l);a=d.join(e===be.BLOCK_LITERAL?`
`:" ")}return Oi({comment:n,type:e,value:a},s,r,o)}};function Qc(n,e){if(Yn(n))for(let t=0;t<n.items.length;++t){let s=n.items[t];if(!Ye(s)){if(qn(s)){s.items.length>1&&e("Each pair must have its own sequence indicator");const r=s.items[0]||new at(new be(null));if(s.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${s.commentBefore}
${r.key.commentBefore}`:s.commentBefore),s.comment){const o=r.value??r.key;o.comment=o.comment?`${s.comment}
${o.comment}`:s.comment}s=r}n.items[t]=Ye(s)?s:new at(s)}}else e("Expected a sequence for this tag");return n}function Xc(n,e,t){const{replacer:s}=t,r=new ks(n);r.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let i of e){typeof s=="function"&&(i=s.call(e,String(o++),i));let a,l;if(Array.isArray(i))if(i.length===2)a=i[0],l=i[1];else throw new TypeError(`Expected [key, value] tuple: ${i}`);else if(i&&i instanceof Object){const u=Object.keys(i);if(u.length===1)a=u[0],l=i[a];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else a=i;r.items.push(Pi(a,l,t))}return r}const $i={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Qc,createNode:Xc};class qs extends ks{constructor(){super(),this.add=bt.prototype.add.bind(this),this.delete=bt.prototype.delete.bind(this),this.get=bt.prototype.get.bind(this),this.has=bt.prototype.has.bind(this),this.set=bt.prototype.set.bind(this),this.tag=qs.tag}toJSON(e,t){if(!t)return super.toJSON(e);const s=new Map;t!=null&&t.onCreate&&t.onCreate(s);for(const r of this.items){let o,i;if(Ye(r)?(o=Ct(r.key,"",t),i=Ct(r.value,o,t)):o=Ct(r,"",t),s.has(o))throw new Error("Ordered maps must not include duplicate keys");s.set(o,i)}return s}static from(e,t,s){const r=Xc(e,t,s),o=new this;return o.items=r.items,o}}qs.tag="tag:yaml.org,2002:omap";const Li={collection:"seq",identify:n=>n instanceof Map,nodeClass:qs,default:!1,tag:"tag:yaml.org,2002:omap",resolve(n,e){const t=Qc(n,e),s=[];for(const{key:r}of t.items)Me(r)&&(s.includes(r.value)?e(`Ordered maps must not include duplicate keys: ${r.value}`):s.push(r.value));return Object.assign(new qs,t)},createNode:(n,e,t)=>qs.from(n,e,t)};function Zc({value:n,source:e},t){return e&&(n?eu:tu).test.test(e)?e:n?t.options.trueStr:t.options.falseStr}const eu={identify:n=>n===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new be(!0),stringify:Zc},tu={identify:n=>n===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new be(!1),stringify:Zc},GC={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:n=>n.slice(-3).toLowerCase()==="nan"?NaN:n[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:_t},QC={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:n=>parseFloat(n.replace(/_/g,"")),stringify(n){const e=Number(n.value);return isFinite(e)?e.toExponential():_t(n)}},XC={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(n){const e=new be(parseFloat(n.replace(/_/g,""))),t=n.indexOf(".");if(t!==-1){const s=n.substring(t+1).replace(/_/g,"");s[s.length-1]==="0"&&(e.minFractionDigits=s.length)}return e},stringify:_t},Gn=n=>typeof n=="bigint"||Number.isInteger(n);function lo(n,e,t,{intAsBigInt:s}){const r=n[0];if((r==="-"||r==="+")&&(e+=1),n=n.substring(e).replace(/_/g,""),s){switch(t){case 2:n=`0b${n}`;break;case 8:n=`0o${n}`;break;case 16:n=`0x${n}`;break}const i=BigInt(n);return r==="-"?BigInt(-1)*i:i}const o=parseInt(n,t);return r==="-"?-1*o:o}function Vi(n,e,t){const{value:s}=n;if(Gn(s)){const r=s.toString(e);return s<0?"-"+t+r.substr(1):t+r}return _t(n)}const ZC={identify:Gn,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(n,e,t)=>lo(n,2,2,t),stringify:n=>Vi(n,2,"0b")},eD={identify:Gn,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(n,e,t)=>lo(n,1,8,t),stringify:n=>Vi(n,8,"0")},tD={identify:Gn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(n,e,t)=>lo(n,0,10,t),stringify:_t},sD={identify:Gn,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(n,e,t)=>lo(n,2,16,t),stringify:n=>Vi(n,16,"0x")};class Ys extends bt{constructor(e){super(e),this.tag=Ys.tag}add(e){let t;Ye(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new at(e.key,null):t=new at(e,null),bs(this.items,t.key)||this.items.push(t)}get(e,t){const s=bs(this.items,e);return!t&&Ye(s)?Me(s.key)?s.key.value:s.key:s}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);const s=bs(this.items,e);s&&!t?this.items.splice(this.items.indexOf(s),1):!s&&t&&this.items.push(new at(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,s){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,s);throw new Error("Set items must all have null values")}static from(e,t,s){const{replacer:r}=s,o=new this(e);if(t&&Symbol.iterator in Object(t))for(let i of t)typeof r=="function"&&(i=r.call(t,i,i)),o.items.push(Pi(i,null,s));return o}}Ys.tag="tag:yaml.org,2002:set";const Ri={collection:"map",identify:n=>n instanceof Set,nodeClass:Ys,default:!1,tag:"tag:yaml.org,2002:set",createNode:(n,e,t)=>Ys.from(n,e,t),resolve(n,e){if(qn(n)){if(n.hasAllNullValues(!0))return Object.assign(new Ys,n);e("Set items must all have null values")}else e("Expected a mapping for this tag");return n}};function ji(n,e){const t=n[0],s=t==="-"||t==="+"?n.substring(1):n,r=i=>e?BigInt(i):Number(i),o=s.replace(/_/g,"").split(":").reduce((i,a)=>i*r(60)+r(a),r(0));return t==="-"?r(-1)*o:o}function su(n){let{value:e}=n,t=i=>i;if(typeof e=="bigint")t=i=>BigInt(i);else if(isNaN(e)||!isFinite(e))return _t(n);let s="";e<0&&(s="-",e*=t(-1));const r=t(60),o=[e%r];return e<60?o.unshift(0):(e=(e-o[0])/r,o.unshift(e%r),e>=60&&(e=(e-o[0])/r,o.unshift(e))),s+o.map(i=>String(i).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const nu={identify:n=>typeof n=="bigint"||Number.isInteger(n),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(n,e,{intAsBigInt:t})=>ji(n,t),stringify:su},ru={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:n=>ji(n,!1),stringify:su},co={identify:n=>n instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(n){const e=n.match(co.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,t,s,r,o,i,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0;let u=Date.UTC(t,s-1,r,o||0,i||0,a||0,l);const d=e[8];if(d&&d!=="Z"){let h=ji(d,!1);Math.abs(h)<30&&(h*=60),u-=6e4*h}return new Date(u)},stringify:({value:n})=>(n==null?void 0:n.toISOString().replace(/(T00:00:00)?\.000Z$/,""))??""},$a=[an,ln,oo,io,eu,tu,ZC,eD,tD,sD,GC,QC,XC,Mi,Ht,Li,$i,Ri,nu,ru,co],La=new Map([["core",JC],["failsafe",[an,ln,oo]],["json",YC],["yaml11",$a],["yaml-1.1",$a]]),Va={binary:Mi,bool:Ni,float:Jc,floatExp:Hc,floatNaN:zc,floatTime:ru,int:Yc,intHex:Gc,intOct:qc,intTime:nu,map:an,merge:Ht,null:io,omap:Li,pairs:$i,seq:ln,set:Ri,timestamp:co},nD={"tag:yaml.org,2002:binary":Mi,"tag:yaml.org,2002:merge":Ht,"tag:yaml.org,2002:omap":Li,"tag:yaml.org,2002:pairs":$i,"tag:yaml.org,2002:set":Ri,"tag:yaml.org,2002:timestamp":co};function _o(n,e,t){const s=La.get(e);if(s&&!n)return t&&!s.includes(Ht)?s.concat(Ht):s.slice();let r=s;if(!r)if(Array.isArray(n))r=[];else{const o=Array.from(La.keys()).filter(i=>i!=="yaml11").map(i=>JSON.stringify(i)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(n))for(const o of n)r=r.concat(o);else typeof n=="function"&&(r=n(r.slice()));return t&&(r=r.concat(Ht)),r.reduce((o,i)=>{const a=typeof i=="string"?Va[i]:i;if(!a){const l=JSON.stringify(i),u=Object.keys(Va).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${u}`)}return o.includes(a)||o.push(a),o},[])}const rD=(n,e)=>n.key<e.key?-1:n.key>e.key?1:0;class Ui{constructor({compat:e,customTags:t,merge:s,resolveKnownTags:r,schema:o,sortMapEntries:i,toStringDefaults:a}){this.compat=Array.isArray(e)?_o(e,"compat"):e?_o(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=r?nD:{},this.tags=_o(t,this.name,s),this.toStringOptions=a??null,Object.defineProperty(this,ns,{value:an}),Object.defineProperty(this,Lt,{value:oo}),Object.defineProperty(this,rn,{value:ln}),this.sortMapEntries=typeof i=="function"?i:i===!0?rD:null}clone(){const e=Object.create(Ui.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}function oD(n,e){var l;const t=[];let s=e.directives===!0;if(e.directives!==!1&&n.directives){const u=n.directives.toString(n);u?(t.push(u),s=!0):n.directives.docStart&&(s=!0)}s&&t.push("---");const r=Vc(n,e),{commentString:o}=r.options;if(n.commentBefore){t.length!==1&&t.unshift("");const u=o(n.commentBefore);t.unshift(jt(u,""))}let i=!1,a=null;if(n.contents){if(qe(n.contents)){if(n.contents.spaceBefore&&s&&t.push(""),n.contents.commentBefore){const h=o(n.contents.commentBefore);t.push(jt(h,""))}r.forceBlockIndent=!!n.comment,a=n.contents.comment}const u=a?void 0:()=>i=!0;let d=Zs(n.contents,r,()=>a=null,u);a&&(d+=ys(d,"",o(a))),(d[0]==="|"||d[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${d}`:t.push(d)}else t.push(Zs(n.contents,r));if((l=n.directives)!=null&&l.docEnd)if(n.comment){const u=o(n.comment);u.includes(`
`)?(t.push("..."),t.push(jt(u,""))):t.push(`... ${u}`)}else t.push("...");else{let u=n.comment;u&&i&&(u=u.replace(/^\n+/,"")),u&&((!i||a)&&t[t.length-1]!==""&&t.push(""),t.push(jt(o(u),"")))}return t.join(`
`)+`
`}class uo{constructor(e,t,s){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,wt,{value:Ho});let r=null;typeof t=="function"||Array.isArray(t)?r=t:s===void 0&&t&&(s=t,t=void 0);const o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},s);this.options=o;let{version:i}=o;s!=null&&s._directives?(this.directives=s._directives.atDocument(),this.directives.yaml.explicit&&(i=this.directives.yaml.version)):this.directives=new rt({version:i}),this.setSchema(i,s),this.contents=e===void 0?null:this.createNode(e,r,s)}clone(){const e=Object.create(uo.prototype,{[wt]:{value:Ho}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=qe(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Bs(this.contents)&&this.contents.add(e)}addIn(e,t){Bs(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){const s=Nc(this);e.anchor=!t||s.has(t)?Bc(t||"a",s):t}return new _i(e.anchor)}createNode(e,t,s){let r;if(typeof t=="function")e=t.call({"":e},"",e),r=t;else if(Array.isArray(t)){const y=C=>typeof C=="number"||C instanceof String||C instanceof Number,b=t.filter(y).map(String);b.length>0&&(t=t.concat(b)),r=t}else s===void 0&&t&&(s=t,t=void 0);const{aliasDuplicateObjects:o,anchorPrefix:i,flow:a,keepUndefined:l,onTagObj:u,tag:d}=s??{},{onAnchor:h,setAnchors:p,sourceObjects:g}=PC(this,i||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:l??!1,onAnchor:h,onTagObj:u,replacer:r,schema:this.schema,sourceObjects:g},f=Vn(e,d,m);return a&&Je(f)&&(f.flow=!0),p(),f}createPair(e,t,s={}){const r=this.createNode(e,null,s),o=this.createNode(t,null,s);return new at(r,o)}delete(e){return Bs(this.contents)?this.contents.delete(e):!1}deleteIn(e){return wn(e)?this.contents==null?!1:(this.contents=null,!0):Bs(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return Je(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return wn(e)?!t&&Me(this.contents)?this.contents.value:this.contents:Je(this.contents)?this.contents.getIn(e,t):void 0}has(e){return Je(this.contents)?this.contents.has(e):!1}hasIn(e){return wn(e)?this.contents!==void 0:Je(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=_r(this.schema,[e],t):Bs(this.contents)&&this.contents.set(e,t)}setIn(e,t){wn(e)?this.contents=t:this.contents==null?this.contents=_r(this.schema,Array.from(e),t):Bs(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let s;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new rt({version:"1.1"}),s={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new rt({version:e}),s={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,s=null;break;default:{const r=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${r}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(s)this.schema=new Ui(Object.assign(s,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:s,maxAliasCount:r,onAnchor:o,reviver:i}={}){const a={anchors:new Map,doc:this,keep:!e,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},l=Ct(this.contents,t??"",a);if(typeof o=="function")for(const{count:u,res:d}of a.anchors.values())o(d,u);return typeof i=="function"?js(i,{"":l},"",l):l}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){const t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return oD(this,e)}}function Bs(n){if(Je(n))return!0;throw new Error("Expected a YAML collection as document contents")}class ou extends Error{constructor(e,t,s,r){super(),this.name=e,this.code=s,this.message=r,this.pos=t}}class En extends ou{constructor(e,t,s){super("YAMLParseError",e,t,s)}}class iD extends ou{constructor(e,t,s){super("YAMLWarning",e,t,s)}}const Ra=(n,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(a=>e.linePos(a));const{line:s,col:r}=t.linePos[0];t.message+=` at line ${s}, column ${r}`;let o=r-1,i=n.substring(e.lineStarts[s-1],e.lineStarts[s]).replace(/[\n\r]+$/,"");if(o>=60&&i.length>80){const a=Math.min(o-39,i.length-79);i="…"+i.substring(a),o-=a-1}if(i.length>80&&(i=i.substring(0,79)+"…"),s>1&&/^ *$/.test(i.substring(0,o))){let a=n.substring(e.lineStarts[s-2],e.lineStarts[s-1]);a.length>80&&(a=a.substring(0,79)+`…
`),i=a+i}if(/[^ ]/.test(i)){let a=1;const l=t.linePos[1];(l==null?void 0:l.line)===s&&l.col>r&&(a=Math.max(1,Math.min(l.col-r,80-o)));const u=" ".repeat(o)+"^".repeat(a);t.message+=`:

${i}
${u}
`}};function en(n,{flow:e,indicator:t,next:s,offset:r,onError:o,parentIndent:i,startOnNewline:a}){let l=!1,u=a,d=a,h="",p="",g=!1,m=!1,f=null,y=null,b=null,C=null,D=null,v=null,E=null;for(const T of n)switch(m&&(T.type!=="space"&&T.type!=="newline"&&T.type!=="comma"&&o(T.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),f&&(u&&T.type!=="comment"&&T.type!=="newline"&&o(f,"TAB_AS_INDENT","Tabs are not allowed as indentation"),f=null),T.type){case"space":!e&&(t!=="doc-start"||(s==null?void 0:s.type)!=="flow-collection")&&T.source.includes("	")&&(f=T),d=!0;break;case"comment":{d||o(T,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const N=T.source.substring(1)||" ";h?h+=p+N:h=N,p="",u=!1;break}case"newline":u?h?h+=T.source:(!v||t!=="seq-item-ind")&&(l=!0):p+=T.source,u=!0,g=!0,(y||b)&&(C=T),d=!0;break;case"anchor":y&&o(T,"MULTIPLE_ANCHORS","A node can have at most one anchor"),T.source.endsWith(":")&&o(T.offset+T.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),y=T,E??(E=T.offset),u=!1,d=!1,m=!0;break;case"tag":{b&&o(T,"MULTIPLE_TAGS","A node can have at most one tag"),b=T,E??(E=T.offset),u=!1,d=!1,m=!0;break}case t:(y||b)&&o(T,"BAD_PROP_ORDER",`Anchors and tags must be after the ${T.source} indicator`),v&&o(T,"UNEXPECTED_TOKEN",`Unexpected ${T.source} in ${e??"collection"}`),v=T,u=t==="seq-item-ind"||t==="explicit-key-ind",d=!1;break;case"comma":if(e){D&&o(T,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),D=T,u=!1,d=!1;break}default:o(T,"UNEXPECTED_TOKEN",`Unexpected ${T.type} token`),u=!1,d=!1}const A=n[n.length-1],S=A?A.offset+A.source.length:r;return m&&s&&s.type!=="space"&&s.type!=="newline"&&s.type!=="comma"&&(s.type!=="scalar"||s.source!=="")&&o(s.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),f&&(u&&f.indent<=i||(s==null?void 0:s.type)==="block-map"||(s==null?void 0:s.type)==="block-seq")&&o(f,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:D,found:v,spaceBefore:l,comment:h,hasNewline:g,anchor:y,tag:b,newlineAfterProp:C,end:S,start:E??S}}function Rn(n){if(!n)return null;switch(n.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(n.source.includes(`
`))return!0;if(n.end){for(const e of n.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(const e of n.items){for(const t of e.start)if(t.type==="newline")return!0;if(e.sep){for(const t of e.sep)if(t.type==="newline")return!0}if(Rn(e.key)||Rn(e.value))return!0}return!1;default:return!0}}function Yo(n,e,t){if((e==null?void 0:e.type)==="flow-collection"){const s=e.end[0];s.indent===n&&(s.source==="]"||s.source==="}")&&Rn(e)&&t(s,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function iu(n,e,t){const{uniqueKeys:s}=n.options;if(s===!1)return!1;const r=typeof s=="function"?s:(o,i)=>o===i||Me(o)&&Me(i)&&o.value===i.value;return e.some(o=>r(o.key,t))}const ja="All mapping items must start at the same column";function aD({composeNode:n,composeEmptyNode:e},t,s,r,o){var d;const i=(o==null?void 0:o.nodeClass)??bt,a=new i(t.schema);t.atRoot&&(t.atRoot=!1);let l=s.offset,u=null;for(const h of s.items){const{start:p,key:g,sep:m,value:f}=h,y=en(p,{indicator:"explicit-key-ind",next:g??(m==null?void 0:m[0]),offset:l,onError:r,parentIndent:s.indent,startOnNewline:!0}),b=!y.found;if(b){if(g&&(g.type==="block-seq"?r(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in g&&g.indent!==s.indent&&r(l,"BAD_INDENT",ja)),!y.anchor&&!y.tag&&!m){u=y.end,y.comment&&(a.comment?a.comment+=`
`+y.comment:a.comment=y.comment);continue}(y.newlineAfterProp||Rn(g))&&r(g??p[p.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else((d=y.found)==null?void 0:d.indent)!==s.indent&&r(l,"BAD_INDENT",ja);t.atKey=!0;const C=y.end,D=g?n(t,g,y,r):e(t,C,p,null,y,r);t.schema.compat&&Yo(s.indent,g,r),t.atKey=!1,iu(t,a.items,D)&&r(C,"DUPLICATE_KEY","Map keys must be unique");const v=en(m??[],{indicator:"map-value-ind",next:f,offset:D.range[2],onError:r,parentIndent:s.indent,startOnNewline:!g||g.type==="block-scalar"});if(l=v.end,v.found){b&&((f==null?void 0:f.type)==="block-map"&&!v.hasNewline&&r(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&y.start<v.found.offset-1024&&r(D.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));const E=f?n(t,f,v,r):e(t,l,m,null,v,r);t.schema.compat&&Yo(s.indent,f,r),l=E.range[2];const A=new at(D,E);t.options.keepSourceTokens&&(A.srcToken=h),a.items.push(A)}else{b&&r(D.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),v.comment&&(D.comment?D.comment+=`
`+v.comment:D.comment=v.comment);const E=new at(D);t.options.keepSourceTokens&&(E.srcToken=h),a.items.push(E)}}return u&&u<l&&r(u,"IMPOSSIBLE","Map comment with trailing content"),a.range=[s.offset,l,u??l],a}function lD({composeNode:n,composeEmptyNode:e},t,s,r,o){const i=(o==null?void 0:o.nodeClass)??ks,a=new i(t.schema);t.atRoot&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let l=s.offset,u=null;for(const{start:d,value:h}of s.items){const p=en(d,{indicator:"seq-item-ind",next:h,offset:l,onError:r,parentIndent:s.indent,startOnNewline:!0});if(!p.found)if(p.anchor||p.tag||h)(h==null?void 0:h.type)==="block-seq"?r(p.end,"BAD_INDENT","All sequence items must start at the same column"):r(l,"MISSING_CHAR","Sequence item without - indicator");else{u=p.end,p.comment&&(a.comment=p.comment);continue}const g=h?n(t,h,p,r):e(t,p.end,d,null,p,r);t.schema.compat&&Yo(s.indent,h,r),l=g.range[2],a.items.push(g)}return a.range=[s.offset,l,u??l],a}function Qn(n,e,t,s){let r="";if(n){let o=!1,i="";for(const a of n){const{source:l,type:u}=a;switch(u){case"space":o=!0;break;case"comment":{t&&!o&&s(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const d=l.substring(1)||" ";r?r+=i+d:r=d,i="";break}case"newline":r&&(i+=l),o=!0;break;default:s(a,"UNEXPECTED_TOKEN",`Unexpected ${u} at node end`)}e+=l.length}}return{comment:r,offset:e}}const Oo="Block collections are not allowed within flow collections",Po=n=>n&&(n.type==="block-map"||n.type==="block-seq");function cD({composeNode:n,composeEmptyNode:e},t,s,r,o){var y;const i=s.start.source==="{",a=i?"flow map":"flow sequence",l=(o==null?void 0:o.nodeClass)??(i?bt:ks),u=new l(t.schema);u.flow=!0;const d=t.atRoot;d&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let h=s.offset+s.start.source.length;for(let b=0;b<s.items.length;++b){const C=s.items[b],{start:D,key:v,sep:E,value:A}=C,S=en(D,{flow:a,indicator:"explicit-key-ind",next:v??(E==null?void 0:E[0]),offset:h,onError:r,parentIndent:s.indent,startOnNewline:!1});if(!S.found){if(!S.anchor&&!S.tag&&!E&&!A){b===0&&S.comma?r(S.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):b<s.items.length-1&&r(S.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),S.comment&&(u.comment?u.comment+=`
`+S.comment:u.comment=S.comment),h=S.end;continue}!i&&t.options.strict&&Rn(v)&&r(v,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(b===0)S.comma&&r(S.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(S.comma||r(S.start,"MISSING_CHAR",`Missing , between ${a} items`),S.comment){let T="";e:for(const N of D)switch(N.type){case"comma":case"space":break;case"comment":T=N.source.substring(1);break e;default:break e}if(T){let N=u.items[u.items.length-1];Ye(N)&&(N=N.value??N.key),N.comment?N.comment+=`
`+T:N.comment=T,S.comment=S.comment.substring(T.length+1)}}if(!i&&!E&&!S.found){const T=A?n(t,A,S,r):e(t,S.end,E,null,S,r);u.items.push(T),h=T.range[2],Po(A)&&r(T.range,"BLOCK_IN_FLOW",Oo)}else{t.atKey=!0;const T=S.end,N=v?n(t,v,S,r):e(t,T,D,null,S,r);Po(v)&&r(N.range,"BLOCK_IN_FLOW",Oo),t.atKey=!1;const V=en(E??[],{flow:a,indicator:"map-value-ind",next:A,offset:N.range[2],onError:r,parentIndent:s.indent,startOnNewline:!1});if(V.found){if(!i&&!S.found&&t.options.strict){if(E)for(const j of E){if(j===V.found)break;if(j.type==="newline"){r(j,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}S.start<V.found.offset-1024&&r(V.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else A&&("source"in A&&((y=A.source)==null?void 0:y[0])===":"?r(A,"MISSING_CHAR",`Missing space after : in ${a}`):r(V.start,"MISSING_CHAR",`Missing , or : between ${a} items`));const _=A?n(t,A,V,r):V.found?e(t,V.end,E,null,V,r):null;_?Po(A)&&r(_.range,"BLOCK_IN_FLOW",Oo):V.comment&&(N.comment?N.comment+=`
`+V.comment:N.comment=V.comment);const $=new at(N,_);if(t.options.keepSourceTokens&&($.srcToken=C),i){const j=u;iu(t,j.items,N)&&r(T,"DUPLICATE_KEY","Map keys must be unique"),j.items.push($)}else{const j=new bt(t.schema);j.flow=!0,j.items.push($);const U=(_??N).range;j.range=[N.range[0],U[1],U[2]],u.items.push(j)}h=_?_.range[2]:V.end}}const p=i?"}":"]",[g,...m]=s.end;let f=h;if((g==null?void 0:g.source)===p)f=g.offset+g.source.length;else{const b=a[0].toUpperCase()+a.substring(1),C=d?`${b} must end with a ${p}`:`${b} in block collection must be sufficiently indented and end with a ${p}`;r(h,d?"MISSING_CHAR":"BAD_INDENT",C),g&&g.source.length!==1&&m.unshift(g)}if(m.length>0){const b=Qn(m,f,t.options.strict,r);b.comment&&(u.comment?u.comment+=`
`+b.comment:u.comment=b.comment),u.range=[s.offset,f,b.offset]}else u.range=[s.offset,f,f];return u}function No(n,e,t,s,r,o){const i=t.type==="block-map"?aD(n,e,t,s,o):t.type==="block-seq"?lD(n,e,t,s,o):cD(n,e,t,s,o),a=i.constructor;return r==="!"||r===a.tagName?(i.tag=a.tagName,i):(r&&(i.tag=r),i)}function uD(n,e,t,s,r){var p;const o=s.tag,i=o?e.directives.tagName(o.source,g=>r(o,"TAG_RESOLVE_FAILED",g)):null;if(t.type==="block-seq"){const{anchor:g,newlineAfterProp:m}=s,f=g&&o?g.offset>o.offset?g:o:g??o;f&&(!m||m.offset<f.offset)&&r(f,"MISSING_CHAR","Missing newline after block sequence props")}const a=t.type==="block-map"?"map":t.type==="block-seq"?"seq":t.start.source==="{"?"map":"seq";if(!o||!i||i==="!"||i===bt.tagName&&a==="map"||i===ks.tagName&&a==="seq")return No(n,e,t,r,i);let l=e.schema.tags.find(g=>g.tag===i&&g.collection===a);if(!l){const g=e.schema.knownTags[i];if((g==null?void 0:g.collection)===a)e.schema.tags.push(Object.assign({},g,{default:!1})),l=g;else return g?r(o,"BAD_COLLECTION_TYPE",`${g.tag} used for ${a} collection, but expects ${g.collection??"scalar"}`,!0):r(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,!0),No(n,e,t,r,i)}const u=No(n,e,t,r,i,l),d=((p=l.resolve)==null?void 0:p.call(l,u,g=>r(o,"TAG_RESOLVE_FAILED",g),e.options))??u,h=qe(d)?d:new be(d);return h.range=u.range,h.tag=i,l!=null&&l.format&&(h.format=l.format),h}function hD(n,e,t){const s=e.offset,r=dD(e,n.options.strict,t);if(!r)return{value:"",type:null,comment:"",range:[s,s,s]};const o=r.mode===">"?be.BLOCK_FOLDED:be.BLOCK_LITERAL,i=e.source?pD(e.source):[];let a=i.length;for(let f=i.length-1;f>=0;--f){const y=i[f][1];if(y===""||y==="\r")a=f;else break}if(a===0){const f=r.chomp==="+"&&i.length>0?`
`.repeat(Math.max(1,i.length-1)):"";let y=s+r.length;return e.source&&(y+=e.source.length),{value:f,type:o,comment:r.comment,range:[s,y,y]}}let l=e.indent+r.indent,u=e.offset+r.length,d=0;for(let f=0;f<a;++f){const[y,b]=i[f];if(b===""||b==="\r")r.indent===0&&y.length>l&&(l=y.length);else{y.length<l&&t(u+y.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),r.indent===0&&(l=y.length),d=f,l===0&&!n.atRoot&&t(u,"BAD_INDENT","Block scalar values in collections must be indented");break}u+=y.length+b.length+1}for(let f=i.length-1;f>=a;--f)i[f][0].length>l&&(a=f+1);let h="",p="",g=!1;for(let f=0;f<d;++f)h+=i[f][0].slice(l)+`
`;for(let f=d;f<a;++f){let[y,b]=i[f];u+=y.length+b.length+1;const C=b[b.length-1]==="\r";if(C&&(b=b.slice(0,-1)),b&&y.length<l){const v=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;t(u-b.length-(C?2:1),"BAD_INDENT",v),y=""}o===be.BLOCK_LITERAL?(h+=p+y.slice(l)+b,p=`
`):y.length>l||b[0]==="	"?(p===" "?p=`
`:!g&&p===`
`&&(p=`

`),h+=p+y.slice(l)+b,p=`
`,g=!0):b===""?p===`
`?h+=`
`:p=`
`:(h+=p+b,p=" ",g=!1)}switch(r.chomp){case"-":break;case"+":for(let f=a;f<i.length;++f)h+=`
`+i[f][0].slice(l);h[h.length-1]!==`
`&&(h+=`
`);break;default:h+=`
`}const m=s+r.length+e.source.length;return{value:h,type:o,comment:r.comment,range:[s,m,m]}}function dD({offset:n,props:e},t,s){if(e[0].type!=="block-scalar-header")return s(e[0],"IMPOSSIBLE","Block scalar header not found"),null;const{source:r}=e[0],o=r[0];let i=0,a="",l=-1;for(let p=1;p<r.length;++p){const g=r[p];if(!a&&(g==="-"||g==="+"))a=g;else{const m=Number(g);!i&&m?i=m:l===-1&&(l=n+p)}}l!==-1&&s(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let u=!1,d="",h=r.length;for(let p=1;p<e.length;++p){const g=e[p];switch(g.type){case"space":u=!0;case"newline":h+=g.source.length;break;case"comment":t&&!u&&s(g,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),h+=g.source.length,d=g.source.substring(1);break;case"error":s(g,"UNEXPECTED_TOKEN",g.message),h+=g.source.length;break;default:{const m=`Unexpected token in block scalar header: ${g.type}`;s(g,"UNEXPECTED_TOKEN",m);const f=g.source;f&&typeof f=="string"&&(h+=f.length)}}}return{mode:o,indent:i,chomp:a,comment:d,length:h}}function pD(n){const e=n.split(/\n( *)/),t=e[0],s=t.match(/^( *)/),o=[s!=null&&s[1]?[s[1],t.slice(s[1].length)]:["",t]];for(let i=1;i<e.length;i+=2)o.push([e[i],e[i+1]]);return o}function fD(n,e,t){const{offset:s,type:r,source:o,end:i}=n;let a,l;const u=(p,g,m)=>t(s+p,g,m);switch(r){case"scalar":a=be.PLAIN,l=mD(o,u);break;case"single-quoted-scalar":a=be.QUOTE_SINGLE,l=gD(o,u);break;case"double-quoted-scalar":a=be.QUOTE_DOUBLE,l=yD(o,u);break;default:return t(n,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[s,s+o.length,s+o.length]}}const d=s+o.length,h=Qn(i,d,e,t);return{value:l,type:a,comment:h.comment,range:[s,d,h.offset]}}function mD(n,e){let t="";switch(n[0]){case"	":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${n[0]}`;break}case"@":case"`":{t=`reserved character ${n[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),au(n)}function gD(n,e){return(n[n.length-1]!=="'"||n.length===1)&&e(n.length,"MISSING_CHAR","Missing closing 'quote"),au(n.slice(1,-1)).replace(/''/g,"'")}function au(n){let e,t;try{e=new RegExp(`(.*?)(?<![ 	])[ 	]*\r?
`,"sy"),t=new RegExp(`[ 	]*(.*?)(?:(?<![ 	])[ 	]*)?\r?
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,t=/[ \t]*(.*?)[ \t]*\r?\n/sy}let s=e.exec(n);if(!s)return n;let r=s[1],o=" ",i=e.lastIndex;for(t.lastIndex=i;s=t.exec(n);)s[1]===""?o===`
`?r+=o:o=`
`:(r+=o+s[1],o=" "),i=t.lastIndex;const a=/[ \t]*(.*)/sy;return a.lastIndex=i,s=a.exec(n),r+o+((s==null?void 0:s[1])??"")}function yD(n,e){let t="";for(let s=1;s<n.length-1;++s){const r=n[s];if(!(r==="\r"&&n[s+1]===`
`))if(r===`
`){const{fold:o,offset:i}=bD(n,s);t+=o,s=i}else if(r==="\\"){let o=n[++s];const i=CD[o];if(i)t+=i;else if(o===`
`)for(o=n[s+1];o===" "||o==="	";)o=n[++s+1];else if(o==="\r"&&n[s+1]===`
`)for(o=n[++s+1];o===" "||o==="	";)o=n[++s+1];else if(o==="x"||o==="u"||o==="U"){const a={x:2,u:4,U:8}[o];t+=DD(n,s+1,a,e),s+=a}else{const a=n.substr(s-1,2);e(s-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),t+=a}}else if(r===" "||r==="	"){const o=s;let i=n[s+1];for(;i===" "||i==="	";)i=n[++s+1];i!==`
`&&!(i==="\r"&&n[s+2]===`
`)&&(t+=s>o?n.slice(o,s+1):r)}else t+=r}return(n[n.length-1]!=='"'||n.length===1)&&e(n.length,"MISSING_CHAR",'Missing closing "quote'),t}function bD(n,e){let t="",s=n[e+1];for(;(s===" "||s==="	"||s===`
`||s==="\r")&&!(s==="\r"&&n[e+2]!==`
`);)s===`
`&&(t+=`
`),e+=1,s=n[e+1];return t||(t=" "),{fold:t,offset:e}}const CD={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
`,r:"\r",t:"	",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","	":"	"};function DD(n,e,t,s){const r=n.substr(e,t),i=r.length===t&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;if(isNaN(i)){const a=n.substr(e-2,t+2);return s(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(i)}function lu(n,e,t,s){const{value:r,type:o,comment:i,range:a}=e.type==="block-scalar"?hD(n,e,s):fD(e,n.options.strict,s),l=t?n.directives.tagName(t.source,h=>s(t,"TAG_RESOLVE_FAILED",h)):null;let u;n.options.stringKeys&&n.atKey?u=n.schema[Lt]:l?u=vD(n.schema,r,l,t,s):e.type==="scalar"?u=wD(n,r,e,s):u=n.schema[Lt];let d;try{const h=u.resolve(r,p=>s(t??e,"TAG_RESOLVE_FAILED",p),n.options);d=Me(h)?h:new be(h)}catch(h){const p=h instanceof Error?h.message:String(h);s(t??e,"TAG_RESOLVE_FAILED",p),d=new be(r)}return d.range=a,d.source=r,o&&(d.type=o),l&&(d.tag=l),u.format&&(d.format=u.format),i&&(d.comment=i),d}function vD(n,e,t,s,r){var a;if(t==="!")return n[Lt];const o=[];for(const l of n.tags)if(!l.collection&&l.tag===t)if(l.default&&l.test)o.push(l);else return l;for(const l of o)if((a=l.test)!=null&&a.test(e))return l;const i=n.knownTags[t];return i&&!i.collection?(n.tags.push(Object.assign({},i,{default:!1,test:void 0})),i):(r(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),n[Lt])}function wD({atKey:n,directives:e,schema:t},s,r,o){const i=t.tags.find(a=>{var l;return(a.default===!0||n&&a.default==="key")&&((l=a.test)==null?void 0:l.test(s))})||t[Lt];if(t.compat){const a=t.compat.find(l=>{var u;return l.default&&((u=l.test)==null?void 0:u.test(s))})??t[Lt];if(i.tag!==a.tag){const l=e.tagString(i.tag),u=e.tagString(a.tag),d=`Value may be parsed as either ${l} or ${u}`;o(r,"TAG_RESOLVE_FAILED",d,!0)}}return i}function ED(n,e,t){if(e){t??(t=e.length);for(let s=t-1;s>=0;--s){let r=e[s];switch(r.type){case"space":case"comment":case"newline":n-=r.source.length;continue}for(r=e[++s];(r==null?void 0:r.type)==="space";)n+=r.source.length,r=e[++s];break}}return n}const xD={composeNode:cu,composeEmptyNode:Wi};function cu(n,e,t,s){const r=n.atKey,{spaceBefore:o,comment:i,anchor:a,tag:l}=t;let u,d=!0;switch(e.type){case"alias":u=SD(n,e,s),(a||l)&&s(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":u=lu(n,e,l,s),a&&(u.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=uD(xD,n,e,t,s),a&&(u.anchor=a.source.substring(1))}catch(h){const p=h instanceof Error?h.message:String(h);s(e,"RESOURCE_EXHAUSTION",p)}break;default:{const h=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;s(e,"UNEXPECTED_TOKEN",h),d=!1}}return u??(u=Wi(n,e.offset,void 0,null,t,s)),a&&u.anchor===""&&s(a,"BAD_ALIAS","Anchor cannot be an empty string"),r&&n.options.stringKeys&&(!Me(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&s(l??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(u.spaceBefore=!0),i&&(e.type==="scalar"&&e.source===""?u.comment=i:u.commentBefore=i),n.options.keepSourceTokens&&d&&(u.srcToken=e),u}function Wi(n,e,t,s,{spaceBefore:r,comment:o,anchor:i,tag:a,end:l},u){const d={type:"scalar",offset:ED(e,t,s),indent:-1,source:""},h=lu(n,d,a,u);return i&&(h.anchor=i.source.substring(1),h.anchor===""&&u(i,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(h.spaceBefore=!0),o&&(h.comment=o,h.range[2]=l),h}function SD({options:n},{offset:e,source:t,end:s},r){const o=new _i(t.substring(1));o.source===""&&r(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&r(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const i=e+t.length,a=Qn(s,i,n.strict,r);return o.range=[e,i,a.offset],a.comment&&(o.comment=a.comment),o}function kD(n,e,{offset:t,start:s,value:r,end:o},i){const a=Object.assign({_directives:e},n),l=new uo(void 0,a),u={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},d=en(s,{indicator:"doc-start",next:r??(o==null?void 0:o[0]),offset:t,onError:i,parentIndent:0,startOnNewline:!0});d.found&&(l.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!d.hasNewline&&i(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=r?cu(u,r,d,i):Wi(u,d.end,s,null,d,i);const h=l.contents.range[2],p=Qn(o,h,!1,i);return p.comment&&(l.comment=p.comment),l.range=[t,h,p.offset],l}function gn(n){if(typeof n=="number")return[n,n+1];if(Array.isArray(n))return n.length===2?n:[n[0],n[1]];const{offset:e,source:t}=n;return[e,e+(typeof t=="string"?t.length:1)]}function Ua(n){var r;let e="",t=!1,s=!1;for(let o=0;o<n.length;++o){const i=n[o];switch(i[0]){case"#":e+=(e===""?"":s?`

`:`
`)+(i.substring(1)||" "),t=!0,s=!1;break;case"%":((r=n[o+1])==null?void 0:r[0])!=="#"&&(o+=1),t=!1;break;default:t||(s=!0),t=!1}}return{comment:e,afterEmptyLine:s}}class TD{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,s,r,o)=>{const i=gn(t);o?this.warnings.push(new iD(i,s,r)):this.errors.push(new En(i,s,r))},this.directives=new rt({version:e.version||"1.2"}),this.options=e}decorate(e,t){const{comment:s,afterEmptyLine:r}=Ua(this.prelude);if(s){const o=e.contents;if(t)e.comment=e.comment?`${e.comment}
${s}`:s;else if(r||e.directives.docStart||!o)e.commentBefore=s;else if(Je(o)&&!o.flow&&o.items.length>0){let i=o.items[0];Ye(i)&&(i=i.key);const a=i.commentBefore;i.commentBefore=a?`${s}
${a}`:s}else{const i=o.commentBefore;o.commentBefore=i?`${s}
${i}`:s}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Ua(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,s=-1){for(const r of e)yield*this.next(r);yield*this.end(t,s)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(t,s,r)=>{const o=gn(e);o[0]+=t,this.onError(o,"BAD_DIRECTIVE",s,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{const t=kD(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{const t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,s=new En(gn(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(s):this.doc.errors.push(s);break}case"doc-end":{if(!this.doc){const s="Unexpected doc-end without preceding document";this.errors.push(new En(gn(e),"UNEXPECTED_TOKEN",s));break}this.doc.directives.docEnd=!0;const t=Qn(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){const s=this.doc.comment;this.doc.comment=s?`${s}
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new En(gn(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){const s=Object.assign({_directives:this.directives},this.options),r=new uo(void 0,s);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,t,t],this.decorate(r,!1),yield r}}}const uu="\uFEFF",hu="",du="",Go="";function AD(n){switch(n){case uu:return"byte-order-mark";case hu:return"doc-mode";case du:return"flow-error-end";case Go:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
`:case`\r
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(n[0]){case" ":case"	":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function Tt(n){switch(n){case void 0:case" ":case`
`:case"\r":case"	":return!0;default:return!1}}const Wa=new Set("0123456789ABCDEFabcdef"),FD=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),hr=new Set(",[]{}"),ID=new Set(` ,[]{}
\r	`),Bo=n=>!n||ID.has(n);class _D{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let s=this.next??"stream";for(;s&&(t||this.hasChars(1));)s=yield*this.parseNext(s)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t==="	";)t=this.buffer[++e];return!t||t==="#"||t===`
`?!0:t==="\r"?this.buffer[e+1]===`
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let s=0;for(;t===" ";)t=this.buffer[++s+e];if(t==="\r"){const r=this.buffer[s+e+1];if(r===`
`||!r&&!this.atEnd)return e+s+1}return t===`
`||s>=this.indentNext||!t&&!this.atEnd?e+s:-1}if(t==="-"||t==="."){const s=this.buffer.substr(e,3);if((s==="---"||s==="...")&&Tt(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===uu&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length,s=e.indexOf("#");for(;s!==-1;){const o=e[s-1];if(o===" "||o==="	"){t=s-1;break}else s=e.indexOf("#",s+1)}for(;;){const o=e[t-1];if(o===" "||o==="	")t-=1;else break}const r=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){const t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield hu,yield*this.parseLineStart()}*parseLineStart(){const e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");const t=this.peek(3);if((t==="---"||t==="...")&&Tt(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,t==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Tt(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){const[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Tt(t)){const s=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=s,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Bo),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,s=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=s=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);const r=this.getLine();if(r===null)return this.setNext("flow");if((s!==-1&&s<this.indentNext&&r[0]!=="#"||s===0&&(r.startsWith("---")||r.startsWith("..."))&&Tt(r[3]))&&!(s===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield du,yield*this.parseLineStart();let o=0;for(;r[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),r[o]){case void 0:return"flow";case"#":return yield*this.pushCount(r.length-o),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Bo),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{const i=this.charAt(1);if(this.flowKey||Tt(i)||i===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){const e=this.charAt(0);let t=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;t!==-1&&this.buffer[t+1]==="'";)t=this.buffer.indexOf("'",t+2);else for(;t!==-1;){let o=0;for(;this.buffer[t-1-o]==="\\";)o+=1;if(o%2===0)break;t=this.buffer.indexOf('"',t+1)}const s=this.buffer.substring(0,t);let r=s.indexOf(`
`,this.pos);if(r!==-1){for(;r!==-1;){const o=this.continueScalar(r+1);if(o===-1)break;r=s.indexOf(`
`,o)}r!==-1&&(t=r-(s[r-1]==="\r"?2:1))}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){const t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil(t=>Tt(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,s;e:for(let o=this.pos;s=this.buffer[o];++o)switch(s){case" ":t+=1;break;case`
`:e=o,t=0;break;case"\r":{const i=this.buffer[o+1];if(!i&&!this.atEnd)return this.setNext("block-scalar");if(i===`
`)break}default:break e}if(!s&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{const o=this.continueScalar(e+1);if(o===-1)break;e=this.buffer.indexOf(`
`,o)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let r=e+1;for(s=this.buffer[r];s===" ";)s=this.buffer[++r];if(s==="	"){for(;s==="	"||s===" "||s==="\r"||s===`
`;)s=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let o=e-1,i=this.buffer[o];i==="\r"&&(i=this.buffer[--o]);const a=o;for(;i===" ";)i=this.buffer[--o];if(i===`
`&&o>=this.pos&&o+1+t>a)e=o;else break}while(!0);return yield Go,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const e=this.flowLevel>0;let t=this.pos-1,s=this.pos-1,r;for(;r=this.buffer[++s];)if(r===":"){const o=this.buffer[s+1];if(Tt(o)||e&&hr.has(o))break;t=s}else if(Tt(r)){let o=this.buffer[s+1];if(r==="\r"&&(o===`
`?(s+=1,r=`
`,o=this.buffer[s+1]):t=s),o==="#"||e&&hr.has(o))break;if(r===`
`){const i=this.continueScalar(s+1);if(i===-1)break;s=Math.max(s,i-2)}}else{if(e&&hr.has(r))break;t=s}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield Go,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){const s=this.buffer.slice(this.pos,e);return s?(yield s,this.pos+=s.length,s.length):(t&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(Bo))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{const e=this.flowLevel>0,t=this.charAt(1);if(Tt(t)||e&&hr.has(t))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!Tt(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(FD.has(t))t=this.buffer[++e];else if(t==="%"&&Wa.has(this.buffer[e+1])&&Wa.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){const e=this.buffer[this.pos];return e===`
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,s;do s=this.buffer[++t];while(s===" "||e&&s==="	");const r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,s=this.buffer[t];for(;!e(s);)s=this.buffer[++t];return yield*this.pushToIndex(t,!1)}}class OD{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,s=this.lineStarts.length;for(;t<s;){const o=t+s>>1;this.lineStarts[o]<e?t=o+1:s=o}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};const r=this.lineStarts[t-1];return{line:t,col:e-r+1}}}}function es(n,e){for(let t=0;t<n.length;++t)if(n[t].type===e)return!0;return!1}function za(n){for(let e=0;e<n.length;++e)switch(n[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function pu(n){switch(n==null?void 0:n.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function dr(n){switch(n.type){case"document":return n.start;case"block-map":{const e=n.items[n.items.length-1];return e.sep??e.start}case"block-seq":return n.items[n.items.length-1].start;default:return[]}}function Ms(n){var t;if(n.length===0)return[];let e=n.length;e:for(;--e>=0;)switch(n[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;((t=n[++e])==null?void 0:t.type)==="space";);return n.splice(e,n.length)}function Ha(n){if(n.start.type==="flow-seq-start")for(const e of n.items)e.sep&&!e.value&&!es(e.start,"explicit-key-ind")&&!es(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,pu(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}class PD{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new _D,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(const s of this.lexer.lex(e,t))yield*this.next(s);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}const t=AD(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{const s=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:s,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const e=this.peek(1);if(this.type==="doc-end"&&(e==null?void 0:e.type)!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){const t=e??this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{const s=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in s?s.indent:0:t.type==="flow-collection"&&s.type==="document"&&(t.indent=0),t.type==="flow-collection"&&Ha(t),s.type){case"document":s.value=t;break;case"block-scalar":s.props.push(t);break;case"block-map":{const r=s.items[s.items.length-1];if(r.value){s.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=t;else{Object.assign(r,{key:t,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{const r=s.items[s.items.length-1];r.value?s.items.push({start:[],value:t}):r.value=t;break}case"flow-collection":{const r=s.items[s.items.length-1];!r||r.value?s.items.push({start:[],key:t,sep:[]}):r.sep?r.value=t:Object.assign(r,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((s.type==="document"||s.type==="block-map"||s.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){const r=t.items[t.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&za(r.start)===-1&&(t.indent===0||r.start.every(o=>o.type!=="comment"||o.indent<t.indent))&&(s.type==="document"?s.end=r.start:s.items.push({start:r.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{const e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{za(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}const t=this.startBlockValue(e);t?this.stack.push(t):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){const t=dr(this.peek(2)),s=Ms(t);let r;e.end?(r=e.end,r.push(this.sourceToken),delete e.end):r=[this.sourceToken];const o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:s,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(`
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){var s;const t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){const r="end"in t.value?t.value.end:void 0,o=Array.isArray(r)?r[r.length-1]:void 0;(o==null?void 0:o.type)==="comment"?r==null||r.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){const r=e.items[e.items.length-2],o=(s=r==null?void 0:r.value)==null?void 0:s.end;if(Array.isArray(o)){Array.prototype.push.apply(o,t.start),o.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){const r=!this.onKeyLine&&this.indent===e.indent,o=r&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind";let i=[];if(o&&t.sep&&!t.value){const a=[];for(let l=0;l<t.sep.length;++l){const u=t.sep[l];switch(u.type){case"newline":a.push(l);break;case"space":break;case"comment":u.indent>e.indent&&(a.length=0);break;default:a.length=0}}a.length>=2&&(i=t.sep.splice(a[1]))}switch(this.type){case"anchor":case"tag":o||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):o||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(es(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(pu(t.key)&&!es(t.sep,"newline")){const a=Ms(t.start),l=t.key,u=t.sep;u.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:l,sep:u}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken);else if(es(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{const a=Ms(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||o?e.items.push({start:i,key:null,sep:[this.sourceToken]}):es(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const a=this.flowScalar(this.type);o||t.value?(e.items.push({start:i,key:a,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(a):(Object.assign(t,{key:a,sep:[]}),this.onKeyLine=!0);return}default:{const a=this.startBlockValue(e);if(a){if(a.type==="block-seq"){if(!t.explicitKey&&t.sep&&!es(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&e.items.push({start:i});this.stack.push(a);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){var s;const t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){const r="end"in t.value?t.value.end:void 0,o=Array.isArray(r)?r[r.length-1]:void 0;(o==null?void 0:o.type)==="comment"?r==null||r.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){const r=e.items[e.items.length-2],o=(s=r==null?void 0:r.value)==null?void 0:s.end;if(Array.isArray(o)){Array.prototype.push.apply(o,t.start),o.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||es(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){const r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){const t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let s;do yield*this.pop(),s=this.peek(1);while((s==null?void 0:s.type)==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const r=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:r,sep:[]}):t.sep?this.stack.push(r):Object.assign(t,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}const s=this.startBlockValue(e);s?this.stack.push(s):(yield*this.pop(),yield*this.step())}else{const s=this.peek(2);if(s.type==="block-map"&&(this.type==="map-value-ind"&&s.indent===e.indent||this.type==="newline"&&!s.items[s.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&s.type!=="flow-collection"){const r=dr(s),o=Ms(r);Ha(e);const i=e.end.splice(1,e.end.length);i.push(this.sourceToken);const a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const t=dr(e),s=Ms(t);return s.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const t=dr(e),s=Ms(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(s=>s.type==="newline"||s.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function ND(n){const e=n.prettyErrors!==!1;return{lineCounter:n.lineCounter||e&&new OD||null,prettyErrors:e}}function BD(n,e={}){const{lineCounter:t,prettyErrors:s}=ND(e),r=new PD(t==null?void 0:t.addNewLine),o=new TD(e);let i=null;for(const a of o.compose(r.parse(n),!0,n.length))if(!i)i=a;else if(i.options.logLevel!=="silent"){i.errors.push(new En(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&t&&(i.errors.forEach(Ra(n,t)),i.warnings.forEach(Ra(n,t))),i}function MD(n,e,t){let s;const r=BD(n,t);if(!r)return null;if(r.warnings.forEach(o=>Rc(r.options.logLevel,o)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:s},t))}const Mo={flex:{display:"flex"},button:{height:48,minWidth:48},wrapper:{width:"calc(100vw - 40px)",height:"calc(100vh - 188px)"}};class $D extends F{componentDidMount(){super.componentDidMount();const{data:e,attr:t}=this.props,s=F.getValue(e,t)||"";this.setState({value:s,initialized:!0,yamlError:this.validateYaml(s)})}validateYaml(e){let t=!1;if(this.props.schema.validateYaml!==!1&&(e||!this.props.schema.allowEmpty))try{MD(e)}catch(s){console.log("Error in YAML",s),t=!0}return t}renderItem(e,t){if(!this.state.initialized)return null;const{schema:s,data:r,attr:o}=this.props,{value:i,showSelectId:a}=this.state,l=s.readOnly===!0||t;return c.createElement(_e,{fullWidth:!0,variant:"standard"},c.createElement("div",{style:Mo.flex},c.createElement(Ne,{color:"grey",style:Mo.button,size:"small",variant:"outlined",onClick:()=>this.setState({showSelectId:!0})},x.t("ra_YAML editor"))),a?c.createElement(Ai,{title:this.getText(s.label),overflowHidden:!0,applyDisabled:this.state.yamlError&&this.props.schema.doNotApplyWithError||l,onClose:()=>{l?this.setState({showSelectId:!1}):this.setState({showSelectId:!1,value:F.getValue(r,o)||""})},onApply:l?void 0:()=>this.setState({showSelectId:!1},()=>this.onChange(o,i))},c.createElement("div",{style:{...Mo.wrapper,border:this.state.yamlError?"2px solid red":"2px solid transparent"}},c.createElement(ui,{mode:"yaml",value:typeof i=="object"?JSON.stringify(i):i,onChange:l?void 0:u=>this.setState({value:u,yamlError:this.validateYaml(u)}),name:"ConfigYamlEditor",themeType:this.props.oContext.themeType}))):null,s.help||this.state.yamlError?c.createElement(Be,null,this.state.yamlError?x.t("ra_Invalid YAML"):this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class LD extends F{async componentDidMount(){super.componentDidMount();const e=await vl(()=>import("./index-C9vfxzYy.js").then(t=>t.i),__vite__mapDeps([0,1,2,3,4]),import.meta.url);this.setState({QRCode:e.default})}renderItem(){const e=this.state.QRCode;if(!e)return null;const t=Math.max(32,Math.round((this.props.schema.size||256)*.15));return c.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:this.props.schema.bgColor||"white",padding:t,width:"100%",height:"100%"}},c.createElement(e,{title:this.getText(this.props.schema.tooltip),value:this.props.schema.data,size:this.props.schema.size,fgColor:this.props.schema.fgColor,bgColor:this.props.schema.bgColor,level:this.props.schema.level}))}}class VD extends F{initialized=!1;localContext;async componentDidMount(){super.componentDidMount();const e=await vl(()=>import("./index-C9vfxzYy.js").then(t=>t.i),__vite__mapDeps([0,1,2,3,4]),import.meta.url);this.setState({QRCode:e.default}),this.props.schema.sendFirstByClick||this.askInstance()}askInstance(){if(this.props.alive){let e=this.props.schema.data;if(e===void 0&&this.props.schema.jsonData){const t=this.getPattern(this.props.schema.jsonData,null,!0);if(t)try{e=JSON.parse(t)}catch{console.error(`Cannot parse json data: ${JSON.stringify(e)}`)}}e===void 0&&(e=null),this.setState({loading:!0},()=>this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",e).then(t=>this.setState({qrData:t||"",loading:!1})))}}getContext(){const e={};return Array.isArray(this.props.schema.alsoDependsOn)&&this.props.schema.alsoDependsOn.forEach(t=>e[t]=F.getValue(this.props.data,t)),JSON.stringify(e)}renderItem(){if(this.props.alive){const s=this.getContext();(s!==this.localContext||!this.initialized)&&(this.localContext=s,(!this.props.schema.sendFirstByClick||this.state.qrData!==void 0)&&setTimeout(()=>this.askInstance(),this.initialized?300:50),this.initialized=!0)}if(!this.state.qrData&&this.props.schema.sendFirstByClick)return c.createElement("div",{style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",cursor:this.state.loading?"default":"pointer"},onClick:()=>!this.state.loading&&this.askInstance()},this.state.loading?c.createElement(rs,null):typeof this.props.schema.sendFirstByClick=="boolean"?x.t("ra_Click to show"):this.getText(this.props.schema.sendFirstByClick,this.props.schema.noTranslation));const e=this.state.QRCode;if(!e||this.state.qrData===void 0)return null;const t=Math.max(32,Math.round((this.props.schema.size||256)*.15));return c.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:this.props.schema.bgColor||"white",padding:t,width:"100%",height:"100%"}},c.createElement(e,{title:this.getText(this.props.schema.tooltip),value:this.state.qrData,size:this.props.schema.size,fgColor:this.props.schema.fgColor,bgColor:this.props.schema.bgColor,level:this.props.schema.level}))}}const RD={accordion:Ed,alive:xd,autocomplete:Sd,autocompleteSendTo:kd,certCollection:Id,certificate:Ad,certificates:Fd,checkbox:Od,checkDocker:_d,checkLicense:Zt,chip:Xi,chips:Xi,color:$d,coordinates:Ld,cron:Td,custom:Nn,datePicker:vb,deviceManager:wb,divider:hC,file:Pb,fileSelector:eo,func:Nb,header:pC,iframe:Bb,iframeSendTo:Mb,image:Vb,imageSendTo:Lb,infoBox:Rb,instance:jb,interface:Ub,ip:$b,jsonEditor:Wb,language:Hb,license:Jb,number:Kb,oauth2:qb,objectId:Yb,password:Gb,pattern:Qb,port:Zb,qrCode:LD,qrCodeSendTo:VD,room:eC,select:sC,selectSendTo:rC,sendto:ka,sendTo:ka,setState:aC,slider:lC,state:uC,staticImage:fC,staticInfo:mC,staticLink:Oa,staticText:Oa,table:gt,text:CC,textSendTo:vC,timePicker:wC,topic:xC,uuid:SC,user:kC,yamlEditor:$D},Pt={fullWidth:{width:"100%"},paper:{margin:1,width:"auto !important",overflowY:"auto",paddingBottom:1},paperWithIcons:{height:"calc(100vh - 259px) !important"},paperWithoutIcons:{height:"calc(100vh - 235px) !important"},padding:{padding:"10px"},heading:{},primary:n=>({backgroundColor:n.palette.primary.main,color:n.palette.mode==="dark"?"inherit":"#FFF"}),secondary:n=>({backgroundColor:n.palette.secondary.main})};class _s extends F{componentDidMount(){var e;super.componentDidMount(),(e=this.props.schema)!=null&&e.collapsable&&this.setState({expanded:(window._localStorage||window.localStorage).getItem(`${this.props.oContext.adapterName}.${this.props.attr}`)==="true"})}renderItems(e,t){return e?Object.keys(e).map(s=>{if(this.props.oContext.multiEdit&&e[s].noMultiEdit)return null;const r=e[s].type||"panel";let o,i="Use this.props.oContext.socket!";return r==="custom"?(e[s].url?o=Nn:this.props.oContext.customs&&this.props.oContext.customs[e[s].component]?o=this.props.oContext.customs[e[s].component]:(console.error(`Cannot find custom component: ${e[s].component}`),o=F),i=this.props.oContext.socket):r==="panel"?o=_s:o=RD[r]||F,c.createElement(o,{socket:i,globalData:this.props.globalData,oContext:this.props.oContext,key:`${s}_${this.props.index===void 0?"":this.props.index}`,index:this.props.index,changed:this.props.changed,arrayIndex:this.props.arrayIndex,expertMode:this.props.expertMode,commandRunning:this.props.commandRunning,style:Pt.panel,common:this.props.common,alive:this.props.alive,themeName:this.props.themeName,data:this.props.data,originalData:this.props.originalData,onError:this.props.onError,onHiddenChanged:this.props.onHiddenChanged,onFilterLabelUpdate:this.props.onFilterLabelUpdate,onChange:this.props.onChange,disabled:t,customObj:this.props.customObj,custom:this.props.custom,schema:e[s],attr:s,table:this.props.table})}):null}render(){const e=this.props.schema;if(!e)return null;const{disabled:t,hidden:s}=this.calculate(e),r=this.props.schema.items,o=this.props.schema.style||{};if(s){if(e.hideOnlyControl){const a=c.createElement(ct,{size:{xs:e.xs||void 0,sm:e.sm||void 0,md:e.md||void 0,lg:e.lg||void 0,xl:e.xl||void 0},sx:je.getStyle(this.props.oContext.theme,{marginBottom:0,textAlign:"left"},o,this.props.oContext.themeType==="dark"&&e.darkStyle)});return e.newLine?c.createElement(c.Fragment,null,c.createElement("div",{style:{flexBasis:"100%",height:0}}),a):a}return null}if(this.props.table)return this.renderItems(r,t);if(this.props.custom)return c.createElement(ct,{key:`${this.props.attr}_${this.props.index}`,container:!0,style:Pt.fullWidth,columnSpacing:2,rowSpacing:1,sx:o},this.renderItems(r,t));let i;if(e.collapsable)i=c.createElement(ei,{key:`${this.props.attr}_${this.props.index}`,style:Pt.fullWidth,expanded:!!this.state.expanded,onChange:()=>{(window._localStorage||window.localStorage).setItem(`${this.props.oContext.adapterName}.${this.props.attr}`,this.state.expanded?"false":"true"),this.setState({expanded:!this.state.expanded})}},c.createElement(ti,{expandIcon:c.createElement(Er,null),sx:je.getStyle(this.props.oContext.theme,o,this.props.oContext.themeType&&e.darkStyle,e.color==="primary"?Pt.primary:e.color==="secondary"&&Pt.secondary,{width:"100%"})},c.createElement(Ut,{style:Pt.heading},this.getText(e.label))),c.createElement(si,null,c.createElement(ct,{container:!0,columnSpacing:2,rowSpacing:1,sx:{...o,width:"100%",padding:"10px"}},this.renderItems(r,t))));else{const a=je.getStyle(this.props.oContext.theme,this.props.style,o,{width:"100%"},this.props.isParentTab&&Pt.paper,this.props.isParentTab&&(this.props.withoutSaveButtons?this.props.withIcons?{height:"calc(100% - 88px) !important"}:{height:"calc(100% - 64px) !important"}:this.props.withIcons?Pt.paperWithIcons:Pt.paperWithoutIcons));i=c.createElement(Ze,{component:"div",key:`${this.props.attr}_${this.props.index}`,className:this.props.className,sx:a},c.createElement(ct,{container:!0,columnSpacing:2,rowSpacing:1,sx:je.getStyle(this.props.oContext.theme,{width:"100%"},this.props.isParentTab&&Pt.padding,this.props.schema.innerStyle)},this.renderItems(r,t)))}if(!this.props.isParentTab){const a=c.createElement(ct,{title:this.getText(e.tooltip),size:{xs:e.xs||void 0,sm:e.sm||void 0,md:e.md||void 0,lg:e.lg||void 0,xl:e.xl||void 0},sx:{marginBottom:0,textAlign:"left",...o}},i);return e.newLine?c.createElement(c.Fragment,null,c.createElement("div",{style:{flexBasis:"100%",height:0}}),a):a}return i}}const pr={tabs:{height:"100%",width:"100%"},panel:{width:"100%",display:"block"},panelWithIcons:{height:"calc(100% - 72px)"},panelWithoutIcons:{height:"calc(100% - 48px)"}};class jD extends F{resizeTimeout=null;refDiv;constructor(e){super(e);let t;if(this.props.root){const s=(window.location.hash||"").replace(/^#/,"").split("/");if(s.length>=3&&s[1]==="config"){const r=s[3],o=parseInt(r,10);r&&o.toString()===r?o>=0&&o<Object.keys(this.props.schema.items).length&&(t=Object.keys(this.props.schema.items)[o]):r&&Object.keys(this.props.schema.items).includes(r)&&(t=r),window.addEventListener("hashchange",this.onHashTabsChanged,!1)}}t===void 0&&(t=(window._localStorage||window.localStorage).getItem(`${this.props.dialogName||"App"}.${this.props.oContext.adapterName}`)||Object.keys(this.props.schema.items)[0],Object.keys(this.props.schema.items).includes(t)||(t=Object.keys(this.props.schema.items)[0])),this.refDiv=c.createRef(),Object.assign(this.state,{tab:t,width:0,openMenu:null,tabErrors:{}})}onTabError=(e,t)=>{const s=this.state.tab;if(!s){this.props.onError(e,t);return}const r={...this.state.tabErrors};r[s]||(r[s]={}),t?r[s][e]=t:(delete r[s][e],Object.keys(r[s]).length===0&&delete r[s]),this.setState({tabErrors:r}),this.props.onError(e,t)};hasTabErrors=e=>!!(this.state.tabErrors[e]&&Object.keys(this.state.tabErrors[e]).length>0);componentWillUnmount(){this.resizeTimeout&&(clearTimeout(this.resizeTimeout),this.resizeTimeout=null),window.removeEventListener("hashchange",this.onHashTabsChanged,!1),super.componentWillUnmount()}onHashTabsChanged=()=>{const e=(window.location.hash||"").replace(/^#/,"").split("/");if(e.length>3&&e[1]==="config"){const t=e[3],s=parseInt(t,10);let r;s.toString()===t?s>=0&&s<Object.keys(this.props.schema.items).length&&(r=Object.keys(this.props.schema.items)[s]):Object.keys(this.props.schema.items).includes(t)&&(r=t),r!==void 0&&r!==this.state.tab&&((window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.${this.props.oContext.adapterName}`,r),this.setState({tab:r}))}};getCurrentBreakpoint(){if(!this.state.width)return"md";if(!this.state.initialBreakpoint){let e;return this.state.width<600?e="xs":this.state.width<900?e="sm":this.state.width<1200?e="md":this.state.width<1536?e="lg":e="xl",setTimeout(()=>{this.setState({initialBreakpoint:e})},50),e}return this.state.initialBreakpoint}componentDidUpdate(){var e;!this.state.initialBreakpoint&&((e=this.refDiv.current)!=null&&e.clientWidth)&&this.refDiv.current.clientWidth!==this.state.width&&(this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{var t;this.resizeTimeout=null,this.setState({width:(t=this.refDiv.current)==null?void 0:t.clientWidth})},50))}onMenuChange(e){(window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.${this.props.oContext.adapterName}`,e),this.setState({tab:e},()=>{if(this.props.root){const t=(window.location.hash||"").split("/");t.length>=3&&t[1]==="config"&&(t[3]=this.state.tab,window.location.hash=t.join("/"))}})}render(){const e=this.props.schema.items;let t=!1;const s=[];Object.keys(e).map(i=>{let a;if(e[i].expertMode&&!this.props.expertMode)return;if(this.props.custom){if(this.executeCustom(e[i].hidden,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.index,this.props.globalData))return;a=this.executeCustom(e[i].disabled,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.index,this.props.globalData)}else{if(this.execute(e[i].hidden,!1,this.props.data,this.props.index,this.props.globalData))return;a=this.execute(e[i].disabled,!1,this.props.data,this.props.index,this.props.globalData)}const l=this.getIcon(e[i].icon);t=t||!!l,s.push({icon:l,disabled:a,label:this.getText(e[i].label),name:i})}),s.find(i=>i.name===this.state.tab)||setTimeout(()=>this.setState({tab:s[0].name}),50);const r=this.getCurrentBreakpoint();let o;return r==="xs"&&s.length>2?o=c.createElement(xn,{style:{top:2,backgroundColor:this.props.oContext.themeType==="dark"?"#222":"#DDD"},variant:"dense"},c.createElement(fe,{onClick:i=>this.setState({openMenu:i.currentTarget})},c.createElement(bh,null)),this.state.openMenu?c.createElement($u,{open:!0,anchorEl:this.state.openMenu,onClose:()=>this.setState({openMenu:null})},s.map(i=>{const a=this.hasTabErrors(i.name);return c.createElement(ze,{disabled:i.disabled,key:i.name,onClick:()=>{this.setState({openMenu:null},()=>this.onMenuChange(i.name))},selected:i.name===this.state.tab,sx:a?{color:"error.main"}:void 0},t?c.createElement(Za,null,i.icon):null,c.createElement(Ze,{sx:{display:"flex",alignItems:"center",gap:.5,width:"100%"}},i.label,a&&c.createElement(vs,{sx:{fontSize:16,color:"error.main"}})))})):null):o=c.createElement(Lu,{variant:"scrollable",scrollButtons:"auto",style:this.props.schema.tabsStyle,value:this.state.tab,onChange:(i,a)=>this.onMenuChange(a)},s.map(i=>{const a=this.hasTabErrors(i.name),l=a?c.createElement(Ze,{sx:{display:"flex",alignItems:"center",gap:.5}},i.label,c.createElement(vs,{sx:{fontSize:16,color:"error.main"}})):i.label;return c.createElement(Vu,{id:i.name,wrapped:!0,disabled:i.disabled,key:i.name,value:i.name,iconPosition:this.props.schema.iconPosition||"start",icon:i.icon,label:l,sx:a?{"& .MuiTab-wrapper":{color:"error.main"}}:void 0})})),c.createElement("div",{style:pr.tabs,ref:this.refDiv},o,c.createElement(_s,{oContext:this.props.oContext,withoutSaveButtons:this.props.withoutSaveButtons,isParentTab:!0,changed:this.props.changed,key:this.state.tab,expertMode:this.props.expertMode,index:1001,arrayIndex:this.props.arrayIndex,globalData:this.props.globalData,commandRunning:this.props.commandRunning,style:{...pr.panel,...t?pr.panelWithIcons:pr.panelWithoutIcons},common:this.props.common,alive:this.props.alive,themeName:this.props.themeName,data:this.props.data,originalData:this.props.originalData,onChange:this.props.onChange,onError:this.onTabError,customObj:this.props.customObj,custom:this.props.custom,schema:e[this.state.tab],table:this.props.table,withIcons:t}))}}const UD={root:{width:"100%",height:"100%"}};class Dr extends Ka{forceUpdateHandlers;errorTimeout=null;errorCached=null;oContext;constructor(e){super(e),this.state={originalData:JSON.stringify(this.props.data),changed:!1,errors:{},updateData:this.props.updateData||0,systemConfig:null,alive:!1,commandRunning:!1,schema:JSON.parse(JSON.stringify(this.props.schema))},this.forceUpdateHandlers={},this.buildDependencies(this.state.schema),this.readData()}static getDerivedStateFromProps(e,t){return e.updateData!==t.updateData?{updateData:e.updateData,originalData:JSON.stringify(e.data),schema:JSON.parse(JSON.stringify(e.schema))}:null}static async loadI18n(e,t,s){if(t===!0||t&&typeof t=="string"){const r=x.getLanguage(),o=typeof t=="string"?t:"i18n";let i=await e.fileExists(`${s}.admin`,`${o}/${r}.json`),a;if(i?a=`${o}/${r}.json`:(i=await e.fileExists(`${s}.admin`,`${o}/${r}/translations.json`),i?a=`${o}/${r}/translations.json`:r!=="en"&&(i=await e.fileExists(`${s}.admin`,`${o}/en.json`),i?a=`${o}/en.json`:(i=await e.fileExists(`${s}.admin`,`${o}/en/translations.json`),i&&(a=`${o}/en/translations.json`)))),a){const l=await e.readFile(`${s}.admin`,a);let u;l.file!==void 0?u=l.file:u=l;try{const d=JSON.parse(u);x.extendTranslations(d,r)}catch(d){return console.error(`Cannot parse language file "${s}.admin/${a}: ${d}`),""}return a}return console.warn(`Cannot find i18n for ${s} / ${a}`),""}return t&&typeof t=="object"&&x.extendTranslations(t),""}onCommandRunning=e=>this.setState({commandRunning:e});readData(){this.props.socket.getCompactSystemConfig().then(e=>this.props.socket.getState(`system.adapter.${this.props.adapterName}.${this.props.instance}.alive`).then(t=>this.setState({systemConfig:e.common,alive:!!(t&&t.val)},()=>{this.updateContext(!0),this.props.custom||this.props.socket.subscribeState(`system.adapter.${this.props.adapterName}.${this.props.instance}.alive`,this.onAlive)}))).catch(e=>console.error(`Cannot read system config: ${e}`))}onAlive=(e,t)=>{!!(t!=null&&t.val)!==this.state.alive&&this.setState({alive:!!(t!=null&&t.val)})};onChange=(e,t,s,r)=>{if(this.props.onValueChange)this.props.onValueChange(e,t,r),s&&s();else if(e&&this.props.onChange){const o={changed:JSON.stringify(e)!==this.state.originalData};this.setState(o,()=>{this.props.onChange(e,o.changed,r),s&&s()})}else r&&this.props.onChange(null,null,r)};onError=(e,t)=>{this.errorCached=this.errorCached||JSON.parse(JSON.stringify(this.state.errors));const s=this.errorCached;t?s[e]=t:delete s[e],this.errorTimeout&&clearTimeout(this.errorTimeout),JSON.stringify(s)!==JSON.stringify(this.state.errors)?this.errorTimeout=setTimeout(()=>this.setState({errors:this.errorCached},()=>{this.errorTimeout=null,this.errorCached=null,this.props.onError(!!Object.keys(this.state.errors).length)}),50):this.errorCached=null};flatten(e,t){return t=t||{},e.items&&Object.keys(e.items).forEach(s=>{t[s]=e.items[s],this.flatten(e.items[s],t)}),t}buildDependencies(e){const t=this.flatten(e);Object.keys(t).forEach(s=>{var r,o,i,a,l,u,d,h,p,g;(r=t[s].confirm)!=null&&r.alsoDependsOn&&((o=t[s].confirm)==null||o.alsoDependsOn.forEach(m=>{if(!t[m])console.error(`[JsonConfigComponent] Attribute ${m} does not exist!`),m.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${m.replace(/^data\./,"")}" instead of "${m}"`);else{t[m].confirmDependsOn=t[m].confirmDependsOn||[];const f={...t[s],attr:s};f.confirm&&(f.confirm.cancel="Undo"),t[m].confirmDependsOn.push(f)}})),(i=t[s].onChange)!=null&&i.alsoDependsOn&&((a=t[s].onChange)==null||a.alsoDependsOn.forEach(m=>{if(!t[m])console.error(`[JsonConfigComponent] Attribute ${m} does not exist!`),m.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${m.replace(/^data\./,"")}" instead of "${m}"`);else{t[m].onChangeDependsOn=t[m].onChangeDependsOn||[];const f={...t[s],attr:s};t[m].onChangeDependsOn.push(f)}})),(l=t[s].hidden)!=null&&l.alsoDependsOn&&((u=t[s].hidden)==null||u.alsoDependsOn.forEach(m=>{if(!t[m])console.error(`[JsonConfigComponent] Attribute ${m} does not exist!`),m.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${m.replace(/^data\./,"")}" instead of "${m}"`);else{t[m].hiddenDependsOn=t[m].hiddenDependsOn||[];const f={...t[s],attr:s};t[m].hiddenDependsOn.push(f)}})),(d=t[s].label)!=null&&d.alsoDependsOn&&((h=t[s].label)==null||h.alsoDependsOn.forEach(m=>{if(!t[m])console.error(`[JsonConfigComponent] Attribute ${m} does not exist!`),m.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${m.replace(/^data\./,"")}" instead of "${m}"`);else{t[m].labelDependsOn=t[m].labelDependsOn||[];const f={...t[s],attr:s};t[m].labelDependsOn.push(f)}})),(p=t[s].help)!=null&&p.alsoDependsOn&&((g=t[s].help)==null||g.alsoDependsOn.forEach(m=>{if(!t[m])console.error(`[JsonConfigComponent] Attribute ${m} does not exist!`),m.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${m.replace(/^data\./,"")}" instead of "${m}"`);else{t[m].helpDependsOn=t[m].helpDependsOn||[];const f={...t[s],attr:s};t[m].helpDependsOn.push(f)}}))})}updateContext(e){this.oContext={DeviceManager:this.props.DeviceManager,adapterName:this.props.adapterName,changeLanguage:this.changeLanguage,common:this.props.common,customs:this.props.customs,dateFormat:this.props.dateFormat,embedded:this.props.embedded,forceUpdate:this.forceAttrUpdate,imagePrefix:this.props.imagePrefix,instance:this.props.instance,instanceObj:this.props.instanceObj,isFloatComma:this.props.isFloatComma,multiEdit:this.props.multiEdit,onBackEndCommand:this.props.onBackEndCommand,onCommandRunning:this.onCommandRunning,onValueChange:this.props.onValueChange,registerOnForceUpdate:this.registerOnForceUpdate,socket:this.props.socket,systemConfig:this.state.systemConfig,theme:this.props.theme,themeType:this.props.themeType,_themeName:this.props.themeName,updateData:this.state.updateData},e&&this.forceUpdate()}renderItem(e){return e.type==="tabs"?c.createElement(jD,{withoutSaveButtons:this.props.withoutSaveButtons,oContext:this.oContext,alive:this.state.alive,changed:this.state.changed,commandRunning:this.state.commandRunning,common:this.props.common,custom:this.props.custom,customObj:this.props.customObj,data:this.props.data,onChange:this.onChange,onError:(t,s)=>this.onError(t,s),originalData:JSON.parse(this.state.originalData),root:!0,schema:e,expertMode:this.props.expertMode,themeName:this.props.themeName}):e.type==="panel"||!e.type?c.createElement(_s,{withoutSaveButtons:this.props.withoutSaveButtons,oContext:this.oContext,alive:this.state.alive,changed:this.state.changed,commandRunning:this.state.commandRunning,common:this.props.common,custom:this.props.custom,customObj:this.props.customObj,data:this.props.data,expertMode:this.props.expertMode,index:1e3,isParentTab:!this.props.embedded&&!this.props.withoutSaveButtons,onChange:this.onChange,onError:(t,s)=>this.onError(t,s),originalData:JSON.parse(this.state.originalData),root:!0,schema:e,themeName:this.props.themeName}):(console.error(`Unknown item type in root: ${JSON.stringify(e)}`),null)}changeLanguage=()=>{this.forceUpdate()};forceAttrUpdate=(e,t)=>{Array.isArray(e)?e.forEach(s=>this.forceUpdateHandlers[s]&&this.forceUpdateHandlers[s](t)):this.forceUpdateHandlers[e]&&this.forceUpdateHandlers[e](t)};registerOnForceUpdate=(e,t)=>{t?this.forceUpdateHandlers[e]=t:this.forceUpdateHandlers[e]&&delete this.forceUpdateHandlers[e]};render(){return!this.state.systemConfig||!this.oContext?c.createElement(Nr,null):(this.oContext._themeName!==this.props.themeName&&(this.oContext._themeName=this.props.themeName,setTimeout(()=>this.updateContext(!0),0)),c.createElement("div",{style:{...!this.props.embedded||this.props.withoutSaveButtons?UD.root:void 0,...this.props.style,...this.state.schema.style}},this.renderItem(this.state.schema)))}}const ms={root:{width:"100%",height:"100%",overflow:"hidden",position:"relative"},scroll:{height:"calc(100% - 48px)",overflowY:"auto"},exportImportButtons:{position:"absolute",top:5,right:0,zIndex:3},button:{marginRight:"5px"},tooltip:{pointerEvents:"none"}};function WD(n,e){let t="";for(let s=0;s<e.length;s++)t+=String.fromCharCode(n[s%n.length].charCodeAt(0)^e.charCodeAt(s));return t}function zD(n,e){let t="";for(let s=0;s<e.length;s++)t+=String.fromCharCode(n[s%n.length].charCodeAt(0)^e.charCodeAt(s));return t}function HD(n,e){if(typeof e!="string")return e;if(!e.startsWith("$/aes-192-cbc:")||!/^[0-9a-f]{48}$/.test(n))return WD(n,e);const t=e.split(":",3),s=window.CryptoJS.enc.Hex.parse(n),r=window.CryptoJS.enc.Hex.parse(t[1]),o=window.CryptoJS.lib.CipherParams.create({ciphertext:window.CryptoJS.enc.Hex.parse(t[2])}),i=window.CryptoJS.AES.decrypt(o,s,{iv:r});return window.CryptoJS.enc.Utf8.stringify(i)}function JD(n,e,t){if(typeof e!="string")return e;if(!/^[0-9a-f]{48}$/.test(n))return zD(n,e);let s;s=window.CryptoJS.lib.WordArray.random(128/8);const r=window.CryptoJS.enc.Hex.parse(n),o=window.CryptoJS.AES.encrypt(e,r,{iv:s}).ciphertext;return`$/aes-192-cbc:${window.CryptoJS.enc.Hex.stringify(s)}:${o}`}function Ja(n,e){var t;return document.getElementById(e)?(t=document.getElementById(e))==null?void 0:t.onload:new Promise(s=>{const r=document.createElement("script");r.setAttribute("id",e),r.onload=s,r.src=n,document.getElementsByTagName("head")[0].appendChild(r)})}let KD=class extends Zn{fileSubscribed=[];fileLangSubscribed="";secret;constructor(e){super(e),this.state={updateData:0,changed:!1,confirmDialog:!1,theme:Ah(e.themeName),saveConfigDialog:!1,hash:"_"},this.secret=e.secret||"",this.getInstanceObject().then(t=>this.getConfigFile().then(s=>Dr.loadI18n(this.props.socket,s==null?void 0:s.i18n,this.props.adapterName).then(r=>{r&&(this.fileLangSubscribed||(this.fileLangSubscribed=r,this.props.socket.subscribeFiles(`${this.props.adapterName}.admin`,this.fileLangSubscribed,this.onFileChange))),t?this.setState({schema:s,data:t.native,common:t.common,hash:Gi(JSON.stringify(s)).toString()}):window.alert(`Instance system.adapter.${this.props.adapterName}.${this.props.instance} not found!`)})))}componentWillUnmount(){super.componentWillUnmount(),this.fileSubscribed.length&&(this.props.socket.unsubscribeFiles(`${this.props.adapterName}.admin`,this.fileSubscribed,this.onFileChange),this.fileSubscribed=[]),this.fileLangSubscribed&&(this.props.socket.unsubscribeFiles(`${this.props.adapterName}.admin`,this.fileLangSubscribed,this.onFileChange),this.fileLangSubscribed="")}handleFileSelect=e=>{const t=e.target.files[0];if(t){const s=new FileReader;s.onload=r=>{if(!r.target)return;const o=r.target.result;try{const i=JSON.parse(o);this.setState({data:i,changed:JSON.stringify(i)!==JSON.stringify(this.state.originalData)})}catch{window.alert(x.t("[JsonConfig] Failed to parse JSON file"))}},s.readAsText(t)}else window.alert(x.t("[JsonConfig] Failed to open JSON File"))};getExportImportButtons(){return c.createElement("div",{style:ms.exportImportButtons},c.createElement(Pe,{title:this.props.t("Import settings from JSON file"),slotProps:{popper:{sx:ms.tooltip}}},c.createElement(vr,{size:"small",sx:{"&.MuiFab-root":ms.button},onClick:()=>{const e=document.createElement("input");e.setAttribute("type","file"),e.setAttribute("id","files"),e.setAttribute("opacity",0),e.addEventListener("change",t=>this.handleFileSelect(t),!1),e.click()}},c.createElement(Hi,null))),c.createElement(Pe,{title:this.props.t("Export setting to JSON file"),slotProps:{popper:{sx:ms.tooltip}}},c.createElement(vr,{size:"small",sx:{"&.MuiFab-root":ms.button},onClick:()=>{this.state.data&&je.generateFile(`${this.props.adapterName}.${this.props.instance}.json`,this.state.data)}},c.createElement(Hi,{style:{transform:"rotate(180deg)"}}))))}onFileChange=async(e,t,s)=>{var r;if(e===`${this.props.adapterName}.admin`&&s){if(t===this.fileLangSubscribed)try{await Dr.loadI18n(this.props.socket,(r=this.state.schema)==null?void 0:r.i18n,this.props.adapterName),this.setState({hash:`${this.state.hash}1`})}catch{}else if(this.fileSubscribed.includes(t))try{const o=await this.getConfigFile(this.fileSubscribed[0]);this.setState({schema:o,hash:Gi(JSON.stringify(o)).toString()})}catch{}}};async getInstanceObject(){var e;try{const t=await this.props.socket.getObject(`system.adapter.${this.props.adapterName}.${this.props.instance}`);if(Array.isArray(t.encryptedNative)){if(!this.secret){const s=await this.props.socket.getSystemConfig();await Ja("../../lib/js/crypto-js/crypto-js.js","crypto-js"),this.secret=s.native.secret}return(e=t.encryptedNative)==null||e.forEach(s=>{t.native[s]&&(t.native[s]=HD(this.secret,t.native[s]))}),t}return t}catch(t){window.alert(`[JsonConfig] Cannot read instance object: ${t}`)}return null}renderDialogConfirm(){return this.state.confirmDialog?c.createElement(ws,{title:x.t("ra_Please confirm"),text:x.t("ra_Some data are not stored. Discard?"),ok:x.t("ra_Discard"),cancel:x.t("ra_Cancel"),onClose:e=>this.setState({confirmDialog:!1},()=>e&&Zn.doNavigate(null))}):null}async scanForInclude(e,t){if(typeof e["#include"]=="string"){const r=await this._getConfigFile(e["#include"],[...t]);return delete e["#include"],r&&(e={...e,...r}),e}const s=Object.keys(e);for(let r=0;r<s.length;r++)e[s[r]]&&typeof e[s[r]]=="object"&&(e[s[r]]=await this.scanForInclude(e[s[r]],t));return e}async getConfigFile(e){return this._getConfigFile(e)}async _getConfigFile(e,t){if(e=e||"jsonConfig.json5",t=t||[],t.includes(e))return window.alert(`[JsonConfig] Circular reference in file: ${e} => ${t.join(" => ")}`),null;t.push(e);try{await this.props.socket.fileExists(`${this.props.adapterName}.admin`,e)||(e="jsonConfig.json");const r=await this.props.socket.readFile(`${this.props.adapterName}.admin`,e);let o="",i="";if(r.file!==void 0&&(i=r.file),typeof i=="string")o=i;else if(i.type==="Buffer"){let a="";const l=new Uint8Array(i.data),u=l.byteLength;for(let d=0;d<u;d++)a+=String.fromCharCode(l[d]);o=a}this.fileSubscribed.includes(e)||(this.fileSubscribed.push(e),await this.props.socket.subscribeFiles(`${this.props.adapterName}.admin`,e,this.onFileChange));try{return await this.scanForInclude(xl.parse(o),t)}catch(a){window.alert("[JsonConfig] Cannot parse json5 config!"),console.log(a)}}catch(s){this.state.schema||window.alert(`[JsonConfig] Cannot read file "${e}: ${s}`)}return null}renderSaveConfigDialog(){return this.state.saveConfigDialog?c.createElement(ws,{title:x.t("ra_Please confirm"),text:x.t("Save configuration?"),ok:x.t("ra_Save"),cancel:x.t("ra_Cancel"),onClose:e=>this.setState({saveConfigDialog:!1},()=>e&&this.onSave(!0))}):null}findAttr(e,t){if(t=t||this.state.schema,t!=null&&t.items){if(e in t.items)return t.items[e];for(const s of Object.values(t.items)){const r=this.findAttr(e,s);if(r)return r}}return null}postProcessing(e,t,s){if(s=s||this.state.schema,!e){console.error(`Data is empty in postProcessing: ${t}, ${JSON.stringify(s)}`);return}const r=e[t];if(s.items)if(s.type==="table"){const o=r;if(!Array.isArray(o))return;for(const i of o)for(const a of s.items)this.postProcessing(i,a.attr,a)}else for(const[o,i]of Object.entries(s.items)){if(i.type==="panel"||i.type==="tabs"||i.type==="accordion")return;this.postProcessing(e,o,i)}else if(t&&typeof r=="string")if(s.type==="text")s.trim!==!1&&(e[t]=r.trim());else if(s.type==="ip")e[t]=r.trim();else if(s.type==="number"){const o=parseFloat(r.toString().replace(",","."));s.min!==void 0&&o<s.min?e[t]=s.min:s.max!==void 0&&o>s.max?e[t]=s.max:e[t]=o}else if(s.type==="port"){const o=parseInt(r.toString(),10);s.min!==void 0&&o<s.min?e[t]=s.min:s.max!==void 0&&o>s.max&&(e[t]=s.max),e[t]!==0&&o<20?e[t]=20:o>65535?e[t]=65535:e[t]=o}else s.type==="checkbox"&&(e[t]=e[t]===!0||e[t]==="true"||e[t]==="on"||e[t]===1||e[t]==="1")}async onSave(e,t){if(e){const s=await this.getInstanceObject();if(!s){console.error("Something went wrong: may be no connection?"),window.alert("Something went wrong: may be no connection?");return}if(!this.state.data||!this.state.schema)return;const r={};for(const i of Object.keys(this.state.data)){const a=this.findAttr(i);(!a||!a.doNotSave||a.type==="state")&&!i.startsWith("_")?F.setValue(s.native,i,this.state.data[i]):(F.setValue(s.native,i,null),r[i]=this.state.data[i])}try{const i=JSON.parse(JSON.stringify(s));if(Array.isArray(i.encryptedNative)){await Ja("../../lib/js/crypto-js/crypto-js.js","crypto-js");for(const a of i.encryptedNative)i.native[a]&&(i.native[a]=JD(this.secret,i.native[a]))}await this.props.socket.setObject(i._id,i)}catch(i){window.alert(`[JsonConfig] Cannot set object: ${i}`)}const o={...s.native,...r};console.log(o),this.setState({changed:!1,data:o,updateData:this.state.updateData+1,originalData:o},()=>t&&Zn.doNavigate(null))}else this.state.changed?this.setState({confirmDialog:!0}):Zn.doNavigate(null)}componentDidUpdate(e,t){t.changed!==this.state.changed&&this.props.configStored(!this.state.changed)}async componentDidMount(){const e=`${window.location.protocol}//${window.location.host}${window.location.pathname}validate_config/${this.props.adapterName}`;console.log(`fetch ${e}`),await fetch(e)}render(){return!this.state.data||!this.state.schema?c.createElement(Nr,null):c.createElement("div",{style:ms.root},this.renderDialogConfirm(),this.getExportImportButtons(),this.renderSaveConfigDialog(),c.createElement(Dr,{key:this.state.hash,style:ms.scroll,socket:this.props.socket,themeName:this.props.themeName,themeType:this.props.themeType,adapterName:this.props.adapterName,instance:this.props.instance,isFloatComma:this.props.isFloatComma,dateFormat:this.props.dateFormat,schema:this.state.schema,common:this.state.common,expertMode:this.props.expertMode,data:this.state.data,updateData:this.state.updateData,onError:e=>this.setState({error:e}),onChange:(e,t,s)=>{s&&this.state.error&&(window.alert(x.t("Cannot save configuration because of error in configuration")),s=!1),s&&!this.state.changed&&!t&&(s=!1),e?this.setState({data:e,changed:t,saveConfigDialog:s}):s!==void 0&&this.setState({saveConfigDialog:s})},DeviceManager:this.props.DeviceManager,theme:this.state.theme}),c.createElement(Fh,{isIFrame:!1,dense:!0,paddingLeft:0,newReact:!0,theme:this.state.theme,noTextOnButtons:this.props.width==="xs"||this.props.width==="sm"||this.props.width==="md",changed:!!(this.state.error||this.state.changed),error:!!this.state.error,onSave:e=>this.onSave(!0,e),onClose:()=>this.onSave(!1)}))}};export{F as ConfigGeneric,_s as ConfigPanel,KD as JsonConfig,Dr as JsonConfigComponent};