iobroker.backitup
Version:
ioBroker.backitup allows you to backup and restore your ioBroker installation and other systems, such as databases, Zigbee, scripts and many more.
409 lines • 366 kB
JavaScript
var Hs=Object.defineProperty,zs=Object.defineProperties;var Ks=Object.getOwnPropertyDescriptors;var $n=Object.getOwnPropertySymbols,Gs=Object.getPrototypeOf,qs=Object.prototype.hasOwnProperty,Ys=Object.prototype.propertyIsEnumerable,Xs=Reflect.get;var bt=Math.pow,Cn=(P,ee,G)=>ee in P?Hs(P,ee,{enumerable:!0,configurable:!0,writable:!0,value:G}):P[ee]=G,Y=(P,ee)=>{for(var G in ee||(ee={}))qs.call(ee,G)&&Cn(P,G,ee[G]);if($n)for(var G of $n(ee))Ys.call(ee,G)&&Cn(P,G,ee[G]);return P},$e=(P,ee)=>zs(P,Ks(ee));var X=(P,ee,G)=>Cn(P,typeof ee!="symbol"?ee+"":ee,G);var Re=(P,ee,G)=>Xs(Gs(P),G,ee);var ae=(P,ee,G)=>new Promise((S,i)=>{var D=C=>{try{v(G.next(C))}catch(l){i(l)}},f=C=>{try{v(G.throw(C))}catch(l){i(l)}},v=C=>C.done?S(C.value):Promise.resolve(C.value).then(D,f);v((G=G.apply(P,ee)).next())});(self.webpackChunkiobroker_admin_component_backitup=self.webpackChunkiobroker_admin_component_backitup||[]).push([["vendors-node_modules_iobroker_json-config_build_index_js"],{30708:(P,ee,G)=>{"use strict";G.r(ee),G.d(ee,{ConfigGeneric:()=>m,ConfigPanel:()=>Lt,JsonConfig:()=>Js,JsonConfigComponent:()=>Jt});var S=G(28437),i=G.n(S),D=G(85589),f=G.n(D),v=G(91778),C=G.n(v),l=G(67085),u=G(21839),c=G(37449);const T="material",L=["Su","Mo","Tu","We","Th","Fr","Sa"],H=["Jan","Feb","Mar","Apr","Mai","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Z={0:"0x00 - good",1:"0x01 - general problem",2:"0x02 - no connection problem",16:"0x10 - substitute value from controller",32:"0x20 - substitute initial value",64:"0x40 - substitute value from device or instance",128:"0x80 - substitute value from sensor",17:"0x11 - general problem by instance",65:"0x41 - general problem by device",129:"0x81 - general problem by sensor",18:"0x12 - instance not connected",66:"0x42 - device not connected",130:"0x82 - sensor not connected",68:"0x44 - device reports error",132:"0x84 - sensor reports error"},$={JVBERi0:"pdf",R0lGODdh:"gif",R0lGODlh:"gif",iVBORw0KGgo:"png","/9j/":"jpg",PHN2Zw:"svg",Qk1:"bmp",AAABAA:"ico"},Se=class Se{static CapitalWords(s){return(s||"").split(/[\s_]/).filter(e=>e).map(e=>e?e[0].toUpperCase()+e.substring(1).toLowerCase():"").join(" ")}static formatSeconds(s){const e=Math.floor(s/86400);s%=3600*24;let t=Math.floor(s/3600);t<10&&(t=`0${t}`),s%=3600;let n=Math.floor(s/60);n<10&&(n=`0${n}`),s%=60,s=Math.floor(s),s<10&&(s=`0${s}`);let r="";return e&&(r+=`${e} ${c.I18n.t("ra_daysShortText")} `),r+=`${t}:${n}:${s}`,r}static getObjectName(s,e,t,n,r){const a=s[e];let o;const p=r?"desc":"name";if(typeof t=="string"&&!n&&(n={language:t},t=null),n=n||{},n.language||(n.language=s["system.config"]&&s["system.config"].common&&s["system.config"].common.language||window.sysLang||"en"),t&&t.name)o=t.name,typeof o=="object"&&(o=o[n.language]||o.en);else if(a&&a.common&&a.common[p])o=a.common[p],p!=="desc"&&!o&&a.common.desc&&(o=a.common.desc),typeof o=="object"&&(o=o[n.language]||o.en||o.de||o.ru||""),o=(o||"").toString().replace(/[_.]/g," "),o===o.toUpperCase()&&(o=o[0]+o.substring(1).toLowerCase());else{const O=e.lastIndexOf(".");o=e.substring(O+1).replace(/[_.]/g," "),o=Se.CapitalWords(o)}return o.trim()}static getObjectNameFromObj(s,e,t,n,r){const a=s;let o=s&&s._id||"";const p=n?"desc":"name";return typeof e=="string"&&!t&&(t={language:e},e=null),t=t||{},e&&e.name?(o=e.name,typeof o=="object"&&(o=o[t.language]||o.en)):a&&a.common&&a.common[p]&&(o=a.common[p],p!=="desc"&&!o&&a.common.desc&&(o=a.common.desc),typeof o=="object"&&(o=o[t.language]||o.en),o=(o||"").toString().replace(/[_.]/g," "),o===o.toUpperCase()&&(o=o[0]+o.substring(1).toLowerCase())),r?o:o.trim()}static getSettingsOrder(s,e,t){s&&Object.prototype.hasOwnProperty.call(s,"common")&&(s=s.common);let n;if(s&&s.custom){n=(s.custom||{})[T];const r=t.user||"admin";if(n&&n[r]){if(e){if(n[r].subOrder&&n[r].subOrder[e])return JSON.parse(JSON.stringify(n[r].subOrder[e]))}else if(n[r].order)return JSON.parse(JSON.stringify(n[r].order))}}return null}static getSettingsCustomURLs(s,e,t){s&&Object.prototype.hasOwnProperty.call(s,"common")&&(s=s.common);let n;if(s&&s.custom){n=(s.custom||{})[T];const r=t.user||"admin";if(n&&n[r]){if(e){if(n[r].subURLs&&n[r].subURLs[e])return JSON.parse(JSON.stringify(n[r].subURLs[e]))}else if(n[r].URLs)return JSON.parse(JSON.stringify(n[r].URLs))}}return null}static reorder(s,e,t){const n=Array.from(s),[r]=n.splice(e,1);return n.splice(t,0,r),n}static getSettings(s,e,t){let n;const r=s&&s._id||e&&e.id;if(s&&Object.prototype.hasOwnProperty.call(s,"common")&&(s=s.common),s!=null&&s.custom?(n=s.custom,n=n[T]&&n[T][e.user||"admin"]?JSON.parse(JSON.stringify(n[T][e.user||"admin"])):{enabled:!0}):n={enabled:t===void 0?!0:t,useCustom:!1},Object.prototype.hasOwnProperty.call(n,"enabled")||(n.enabled=t===void 0?!0:t),e&&(!n.name&&e.name&&(n.name=e.name),!n.icon&&e.icon&&(n.icon=e.icon),!n.color&&e.color&&(n.color=e.color)),s&&(!n.color&&s.color&&(n.color=s.color),!n.icon&&s.icon&&(n.icon=s.icon),!n.name&&s.name&&(n.name=s.name)),typeof n.name=="object"&&(n.name=n.name[e.language]||n.name.en,n.name=(n.name||"").toString().replace(/_/g," "),n.name===n.name.toUpperCase()&&(n.name=n.name[0]+n.name.substring(1).toLowerCase())),!n.name&&r){const a=r.lastIndexOf(".");n.name=r.substring(a+1).replace(/[_.]/g," "),n.name=(n.name||"").toString().replace(/_/g," "),n.name=Se.CapitalWords(n.name)}return n}static setSettings(s,e,t){if(s){s.common=s.common||{},s.common.custom=s.common.custom||{},s.common.custom[T]=s.common.custom[T]||{},s.common.custom[T][t.user||"admin"]=e;const n=s.common.custom[T][t.user||"admin"];return n.useCommon&&(n.color!==void 0&&(s.common.color=n.color,delete n.color),n.icon!==void 0&&(s.common.icon=n.icon,delete n.icon),n.name!==void 0&&(typeof s.common.name!="object"&&(s.common.name={}),s.common.name[t.language]=n.name,delete n.name)),!0}return!1}static getIcon(s,e){return s&&s.icon?s.icon.length<=2?i().createElement("span",{style:e||{}},s.icon):s.icon.startsWith("data:image")?i().createElement("img",{alt:s.name,src:s.icon,style:e||{}}):i().createElement("img",{alt:s.name,src:(s.prefix||"")+s.icon,style:e||{}}):null}static getObjectIcon(s,e){if(typeof s=="object"&&(e=s,s=e._id),e&&e.common&&e.common.icon){let t=e.common.icon;if(typeof t=="string"&&t.length<=2||t.startsWith("data:image"))return t;const n=s.split(".");return n[0]==="system"?t=`adapter/${n[2]}${t.startsWith("/")?"":"/"}${t}`:t=`adapter/${n[0]}${t.startsWith("/")?"":"/"}${t}`,window.location.pathname.match(/adapter\/[^/]+\/[^/]+\.html/)?t=`../../${t}`:window.location.pathname.match(/material\/[.\d]+/)?t=`../../${t}`:window.location.pathname.match(/material\//)&&(t=`../${t}`),t}return null}static splitCamelCase(s){return Se.CapitalWords(s)}static isUseBright(s,e){if(s==null||s==="")return e===void 0?!0:e;s=s.toString(),s.startsWith("#")&&(s=s.slice(1));let t,n,r;const a=s.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);if(a&&a.length===4)t=parseInt(a[1],10),n=parseInt(a[2],10),r=parseInt(a[3],10);else{if(s.length===3&&(s=s[0]+s[0]+s[1]+s[1]+s[2]+s[2]),s.length===8)s=s.substring(0,6);else if(s.length!==6)return!1;t=parseInt(s.slice(0,2),16),n=parseInt(s.slice(2,4),16),r=parseInt(s.slice(4,6),16)}return t*.299+n*.587+r*.114<=186}static getTimeString(s){if(s=parseFloat(s),Number.isNaN(s))return"--:--";const e=Math.floor(s/3600);let t=Math.floor(s%3600/60),n=s%60;return e?(t<10&&(t=`0${t}`),n<10&&(n=`0${n}`),`${e}:${t}:${n}`):(n<10&&(n=`0${n}`),`${t}:${n}`)}static getWindDirection(s){return s>=0&&s<11.25?"N":s>=11.25&&s<33.75?"NNE":s>=33.75&&s<56.25?"NE":s>=56.25&&s<78.75?"ENE":s>=78.75&&s<101.25?"E":s>=101.25&&s<123.75?"ESE":s>=123.75&&s<146.25?"SE":s>=146.25&&s<168.75?"SSE":s>=168.75&&s<191.25?"S":s>=191.25&&s<213.75?"SSW":s>=213.75&&s<236.25?"SW":s>=236.25&&s<258.75?"WSW":s>=258.75&&s<281.25?"W":s>=281.25&&s<303.75?"WNW":s>=303.75&&s<326.25?"NW":s>=326.25&&s<348.75?"NNW":"N"}static padding(s){return typeof s=="string"?s.length<2?`0${s}`:s:s<10?`0${s}`:s}static setDataFormat(s){s&&(Se.dateFormat=s.toUpperCase().split(/[.-/]/),Se.dateFormat.splice(Se.dateFormat.indexOf("YYYY"),1))}static date2string(s){if(typeof s=="string"){if(s=s.trim(),!s)return"";if(s.match(/^[\w\s]+$/))return s;const t=s.match(/(\d{1,4})[-./](\d{1,2})[-./](\d{1,4})/);if(t){const n=[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3],10)],r=n.find(o=>o>31);n.splice(n.indexOf(r),1);const a=n.find(o=>o>12);a?(n.splice(n.indexOf(a),1),s=new Date(r,n[0]-1,a)):Se.dateFormat[0][0]==="M"&&Se.dateFormat[1][0]==="D"?(s=new Date(r,n[0]-1,n[1]),Math.abs(s.getTime-Date.now())>36e5*24*10&&(s=new Date(r,n[1]-1,n[0]))):Se.dateFormat[0][0]==="D"&&Se.dateFormat[1][0]==="M"?(s=new Date(r,n[1]-1,n[0]),Math.abs(s.getTime-Date.now())>36e5*24*10&&(s=new Date(r,n[0]-1,n[1]))):s=new Date(s)}else s=new Date(s)}else s=new Date(s);let e=c.I18n.t(`ra_dow_${L[s.getDay()]}`).replace("ra_dow_","");return e+=`. ${s.getDate()} ${c.I18n.t(`ra_month_${H[s.getMonth()]}`).replace("ra_month_","")}`,e}static renderTextWithA(s){let e=s.match(/<a [^<]+<\/a>|<br\/?>|<b>[^<]+<\/b>|<i>[^<]+<\/i>/);if(e){const t=[];let n=1;do{const r=s.substring(0,e.index);if(s=s.substring(e.index+e[0].length),r&&t.push(i().createElement("span",{key:`a${n++}`},r)),e[0].startsWith("<b>"))t.push(i().createElement("b",{key:`a${n++}`},e[0].substring(3,e[0].length-4)));else if(e[0].startsWith("<i>"))t.push(i().createElement("i",{key:`a${n++}`},e[0].substring(3,e[0].length-4)));else if(e[0].startsWith("<br"))t.push(i().createElement("br",{key:`a${n++}`}));else{const a=e[0].match(/href="([^"]+)"/)||e[0].match(/href='([^']+)'/),o=e[0].match(/target="([^"]+)"/)||e[0].match(/target='([^']+)'/),p=e[0].match(/rel="([^"]+)"/)||e[0].match(/rel='([^']+)'/),O=e[0].match(/>([^<]*)</);t.push(i().createElement("a",{key:`a${n++}`,href:a?a[1]:"",target:o?o[1]:"_blank",rel:p?p[1]:"",style:{color:"inherit"}},O?O[1]:""))}e=s&&s.match(/<a [^<]+<\/a>|<br\/?>|<b>[^<]+<\/b>|<i>[^<]+<\/i>/),!e&&s&&t.push(i().createElement("span",{key:`a${n++}`},s))}while(e);return t}return s}static getSmartName(s,e,t,n){var r,a;return e?n?s[e]&&((a=s[e].common)!=null&&a.custom)&&s[e].common.custom[t]&&s[e].common.custom[t].smartName||null:s[e].common.smartName:n?s&&!s.common?s.smartName:(r=s==null?void 0:s.common)!=null&&r.custom&&s.common.custom[t]?s.common.custom[t].smartName:void 0:!s.common||s&&!s.common?s.smartName:s.common.smartName}static getSmartNameFromObj(s,e,t){var n;return t?s&&!s.common?s.smartName:(n=s==null?void 0:s.common)!=null&&n.custom&&s.common.custom[e]?s.common.custom[e].smartName:void 0:!s.common||s&&!s.common?s.smartName:s.common.smartName}static enableSmartName(s,e,t){t?(s.common.custom=s.common.custom||{},s.common.custom[e]=s.common.custom[e]||{},s.common.custom[e].smartName={}):s.common.smartName={}}static removeSmartName(s,e,t){t?s.common&&s.common.custom&&s.common.custom[e]&&(s.common.custom[e]=null):s.common.smartName=null}static updateSmartName(s,e,t,n,r,a){const o=c.I18n.getLanguage();if(typeof s.common.smartName=="string"){const p=s.common.smartName;s.common.smartName={},s.common.smartName[o]=p}if(s.native&&s.native.byON){delete s.native.byON;let p=s.common.smartName;(!p||typeof p!="object")&&(p={en:p},p[o]=p.en),s.common.smartName=p}if(n!==void 0&&(a?(s.common.custom=s.common.custom||{},s.common.custom[r]=s.common.custom[r]||{},s.common.custom[r].smartName=s.common.custom[r].smartName||{},n?s.common.custom[r].smartName.smartType=n:delete s.common.custom[r].smartName.smartType):(s.common.smartName=s.common.smartName||{},n?s.common.smartName.smartType=n:delete s.common.smartName.smartType)),t!==void 0&&(a?(s.common.custom=s.common.custom||{},s.common.custom[r]=s.common.custom[r]||{},s.common.custom[r].smartName=s.common.custom[r].smartName||{},s.common.custom[r].smartName.byON=t):(s.common.smartName=s.common.smartName||{},s.common.smartName.byON=t)),e!==void 0){let p;if(a?(s.common.custom=s.common.custom||{},s.common.custom[r]=s.common.custom[r]||{},s.common.custom[r].smartName=s.common.custom[r].smartName||{},p=s.common.custom[r].smartName):(s.common.smartName=s.common.smartName||{},p=s.common.smartName),p[o]=e,p&&(!p[o]||p[o]===s.common.name&&(!s.common.role||s.common.role.includes("button")))){delete p[o];let O=!0;for(const U in p)if(Object.prototype.hasOwnProperty.call(p,U)){O=!1;break}O&&(a?s.common.custom[r].smartName.byON===void 0?delete s.common.custom[r]:(delete s.common.custom[r].en,delete s.common.custom[r].de,delete s.common.custom[r].ru,delete s.common.custom[r].nl,delete s.common.custom[r].pl,delete s.common.custom[r].it,delete s.common.custom[r].fr,delete s.common.custom[r].pt,delete s.common.custom[r].es,delete s.common.custom[r].uk,delete s.common.custom[r]["zh-cn"]):s.common.smartName.byON!==void 0?(delete s.common.smartName.en,delete s.common.smartName.de,delete s.common.smartName.ru,delete s.common.smartName.nl,delete s.common.smartName.pl,delete s.common.smartName.it,delete s.common.smartName.fr,delete s.common.smartName.pt,delete s.common.smartName.es,delete s.common.smartName.uk,delete s.common.smartName["zh-cn"]):s.common.smartName=null)}}}static disableSmartName(s,e,t){t?(s.common.custom=s.common.custom||{},s.common.custom[e]=s.common.custom[e]||{},s.common.custom[e].smartName=!1):s.common.smartName=!1}static copyToClipboard(s,e){return e&&(e.stopPropagation(),e.preventDefault()),c.Utils.copyToClipboard(s)}static getFileExtension(s){const e=(s||"").lastIndexOf(".");return e!==-1?s.substring(e+1).toLowerCase():null}static formatBytes(s){if(Math.abs(s)<1024)return`${s} B`;const e=["KB","MB","GB"];let t=-1;do s/=1024,++t;while(Math.abs(s)>=1024&&t<e.length-1);return`${s.toFixed(1)} ${e[t]}`}static getInvertedColor(s,e,t){if(!s)return;const n=Se.invertColor(s,!0);if(n==="#FFFFFF"&&(e==="dark"||t&&e==="light"))return"#DDD";if(n==="#000000"&&(e==="light"||t&&e==="dark"))return"#222"}static invertColor(s,e){if(s==null||s===""||typeof s!="string")return"";if(s.startsWith("rgba")){const o=s.match(/rgba?\((\d+),\s*(\d+),\s*(\d+),\s*([.\d]+)\)/);o&&(s=parseInt(o[1],10).toString(16).padStart(2,"0")+parseInt(o[2],10).toString(16).padStart(2,"0")+parseInt(o[2],10).toString(16).padStart(2,"0"))}else if(s.startsWith("rgb")){const o=s.match(/rgb?\((\d+),\s*(\d+),\s*(\d+)\)/);o&&(s=parseInt(o[1],10).toString(16).padStart(2,"0")+parseInt(o[2],10).toString(16).padStart(2,"0")+parseInt(o[2],10).toString(16).padStart(2,"0"))}else s.startsWith("#")&&(s=s.slice(1));s.length===3&&(s=s[0]+s[0]+s[1]+s[1]+s[2]+s[2]);let t=null;if(s.length===8)t=s.substring(6,8),s=s.substring(0,6);else if(s.length!==6)return console.warn(`Cannot invert color: ${s}`),s;let n=parseInt(s.slice(0,2),16),r=parseInt(s.slice(2,4),16),a=parseInt(s.slice(4,6),16);return e?n*.299+r*.587+a*.114>186?`#000000${t||""}`:`#FFFFFF${t||""}`:(n=(255-n).toString(16),r=(255-r).toString(16),a=(255-a).toString(16),`#${n.padStart(2,"0")}${r.padStart(2,"0")}${a.padStart(2,"0")}${t||""}`)}static color2rgb(s){if(s==null||s===""||typeof s!="string")return"";if(s.startsWith("rgba")){const e=s.match(/rgba?\((\d+),\s*(\d+),\s*(\d+),\s*([.\d]+)\)/);e&&(s=parseInt(e[1],10).toString(16).padStart(2,"0")+parseInt(e[2],10).toString(16).padStart(2,"0")+parseInt(e[2],10).toString(16).padStart(2,"0"))}else if(s.startsWith("rgb")){const e=s.match(/rgb?\((\d+),\s*(\d+),\s*(\d+)\)/);e&&(s=parseInt(e[1],10).toString(16).padStart(2,"0")+parseInt(e[2],10).toString(16).padStart(2,"0")+parseInt(e[2],10).toString(16).padStart(2,"0"))}else s.startsWith("#")&&(s=s.slice(1));return s.length===3&&(s=s[0]+s[0]+s[1]+s[1]+s[2]+s[2]),s.length!==6&&s.length!==8?(console.warn(`Cannot invert color: ${s}`),!1):[parseInt(s.slice(0,2),16),parseInt(s.slice(2,4),16),parseInt(s.slice(4,6),16)]}static rgb2lab(s){let e=s[0]/255,t=s[1]/255,n=s[2]/255;e=e>.04045?bt((e+.055)/1.055,2.4):e/12.92,t=t>.04045?bt((t+.055)/1.055,2.4):t/12.92,n=n>.04045?bt((n+.055)/1.055,2.4):n/12.92;let r=(e*.4124+t*.3576+n*.1805)/.95047,a=e*.2126+t*.7152+n*.0722,o=(e*.0193+t*.1192+n*.9505)/1.08883;return r=r>.008856?bt(r,.33333333):7.787*r+.137931,a=a>.008856?bt(a,.33333333):7.787*a+.137931,o=o>.008856?bt(o,.33333333):7.787*o+.137931,[116*a-16,500*(r-a),200*(a-o)]}static colorDistance(s,e){const t=Se.rgb2lab(Se.color2rgb(s)),n=Se.rgb2lab(Se.color2rgb(e)),r=t[0]-n[0],a=t[1]-n[1],o=t[2]-n[2],p=Math.sqrt(t[1]*t[1]+t[2]*t[2]),O=Math.sqrt(n[1]*n[1]+n[2]*n[2]),U=p-O;let J=a*a+o*o-U*U;J=J<0?0:Math.sqrt(J);const q=1+.045*p,he=1+.015*p,Ee=r,se=U/q,ye=J/he,de=Ee*Ee+se*se+ye*ye;return de<0?0:de}static _toVal(s){let e,t="";if(typeof s=="string"||typeof s=="number")t+=s;else if(typeof s=="object")if(Array.isArray(s))for(let n=0;n<s.length;n++)s[n]&&(e=Se._toVal(s[n]),e&&(t+=(t?" ":"")+e));else for(const n in s)s[n]&&(t+=(t?" ":"")+n);return t}static clsx(){let s=0,e,t,n="";for(;s<arguments.length;)e=arguments[s++],e&&(t=Se._toVal(e),t&&(n+=(n?" ":"")+t));return n}static getThemeName(s=""){return window.vendorPrefix&&window.vendorPrefix!=="@@vendorPrefix@@"?window.vendorPrefix:s||((window._localStorage||window.localStorage).getItem("App.themeName")?(window._localStorage||window.localStorage).getItem("App.themeName"):window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"colored")}static getThemeType(s=""){return window.vendorPrefix&&window.vendorPrefix!=="@@vendorPrefix@@"?"light":(s=s||(window._localStorage||window.localStorage).getItem("App.themeName"),s==="dark"||s==="blue"?"dark":"light")}static setThemeName(s){window.vendorPrefix&&window.vendorPrefix!=="@@vendorPrefix@@"||((window._localStorage||window.localStorage).setItem("App.themeName",s),(window._localStorage||window.localStorage).setItem("App.theme",s==="dark"||s==="blue"?"dark":"light"))}static toggleTheme(s){if(window.vendorPrefix&&window.vendorPrefix!=="@@vendorPrefix@@")return window.vendorPrefix;s=s||(window._localStorage||window.localStorage).getItem("App.themeName");const e=Se.getThemeNames(),t=e.indexOf(s);let n;return t!==-1?n=e[(t+1)%e.length]:n=e[0],Se.setThemeName(n),n}static getThemeNames(){return window.vendorPrefix&&window.vendorPrefix!=="@@vendorPrefix@@"?[window.vendorPrefix]:["light","dark","blue","colored"]}static parseQuery(s){s=(s||"").toString().replace(/^\?/,"");const e={};return s.split("&").forEach(t=>{if(t=t.trim(),t){const n=t.split("="),r=decodeURIComponent(n[0]).trim();if(n.length>1)if(e[r]=decodeURIComponent(n[1]),e[r]==="true")e[r]=!0;else if(e[r]==="false")e[r]=!1;else{const a=parseFloat(e[r]);a.toString()===e[r]&&(e[r]=a)}else e[r]=!0}}),e}static getParentId(s){const e=(s||"").toString().split(".");return e.length>1?(e.pop(),e.join(".")):null}static formatDate(s,e){if(!s)return"";let t,n=s.getMonth()+1;n<10&&(n=`0${n}`);let r=s.getDate();r<10&&(r=`0${r}`),e==="MM/DD/YYYY"?t=`${n}/${r}/${s.getFullYear()}`:t=`${s.getFullYear()}-${n}-${r}`;let a=s.getHours();return a<10?t+=` 0${a}`:t+=` ${a}`,a=s.getMinutes(),a<10?t+=`:0${a}`:t+=`:${a}`,a=s.getSeconds(),a<10?t+=`:0${a}`:t+=`:${a}`,a=s.getMilliseconds(),a<10?t+=`.00${a}`:a<100?t+=`.0${a}`:t+=`.${a}`,t}static formatTime(s){if(s){s=Math.round(s);const e=Math.floor(s/(3600*24)),t=Math.floor(s%(3600*24)/3600),n=Math.floor(s%3600/60),r=s%60;return e?`${e}.${t.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:t?`${t}:${n.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`0:${n.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}return"0:00:00"}static MDtext2link(s){const e=s.match(/\d+\.\)\s/);return e&&(s=s.replace(e[0],e[0].replace(/\s/," "))),s.replace(/[^a-zA-Zа-яА-Я0-9]/g,"").trim().replace(/\s/g,"").toLowerCase()}static openLink(s,e){s=s.replace(/\/\/([0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*)(:\d+)?\//i,"//[$1]$2/"),e==="this"?window.location=s:window.open(s,e||"_blank")}static MDgetTitle(s){const e=Se.extractHeader(s),t=e.header;let n=e.body;if(!t.title){n=n.replace(/{[^}]*}/g,""),n=n.trim();const r=n.replace(/\r/g,"").split(`
`);for(let a=0;a<r.length;a++)if(r[a].startsWith("# "))return r[a].substring(2).trim();return""}return t.title}static MDextractHeader(s){const e={};if(s.substring(0,3)==="---"){const t=s.substring(3).indexOf(`
---`);t!==-1&&(s.substring(3,t+3).replace(/\r/g,"").split(`
`).forEach(a=>{if(!a.trim())return;const o=a.indexOf(":");if(o!==-1){const p=a.substring(0,o).trim();e[p]=a.substring(o+1).trim(),e[p]=e[p].replace(/^['"]|['"]$/g,""),e[p]==="true"?e[p]=!0:e[p]==="false"?e[p]=!1:parseFloat(e[p]).toString()===e[p]&&(e[p]=parseFloat(e[p]))}else e[a.trim()]=!0}),s=s.substring(t+7))}return{header:e,body:s}}static MDremoveDocsify(s){const e=s.match(/{docsify-[^}]*}/g);return e&&e.forEach(t=>s=s.replace(t,"")),s}static generateFile(s,e){const t=document.createElement("a");t.setAttribute("href",`data:application/json;charset=utf-8,${encodeURIComponent(JSON.stringify(e,null,2))}`),t.setAttribute("download",s),t.style.display="none",document.body.appendChild(t),t.click(),document.body.removeChild(t)}static quality2text(s){const e=s&4294901760,t=Z[s];let n;return t?n=[t]:s&1?n=[Z[1],`0x${(s&65534).toString(16)}`]:s&2?n=[Z[2],`0x${(s&65533).toString(16)}`]:n=[`0x${s.toString(16)}`],e&&n.push(`0x${(e>>16).toString(16).toUpperCase()}`),n}static clone(s){return JSON.parse(JSON.stringify(s))}static getStates(s){var t;let e=(t=s==null?void 0:s.common)==null?void 0:t.states;if(e){if(typeof e=="string"&&e[0]==="{")try{e=JSON.parse(e)}catch(n){console.error(`Cannot parse states: ${e}`),e=null}else if(typeof e=="string"){const n=e.split(";");e={};for(let r=0;r<n.length;r++){const a=n[r].split(":");e[a[0]]=a[1]}}else if(Array.isArray(e)){const n={};return s.common.type==="number"?e.forEach((r,a)=>n[a]=r):s.common.type==="string"?e.forEach(r=>n[r]=r):s.common.type==="boolean"&&(n.false=e[0],n.true=e[1]),n}}return e}static getSvg(s){return fetch(s).then(e=>e.blob()).then(e=>new Promise(t=>{const n=new FileReader;n.onload=function(){t(this.result)},n.readAsDataURL(e)}))}static detectMimeType(s){const e=Object.keys($).find(t=>s.startsWith(t));return e?$[e]:null}static isStableRepository(s){return!!(typeof s=="string"&&s.toLowerCase().startsWith("stable")||s&&typeof s!="string"&&s.find(e=>e.toLowerCase().startsWith("stable")))}static isStringInteger(s){return parseInt(s).toString()===s}static isValidDate(s){return s instanceof Date&&!isNaN(s)}static getStyle(s,...e){const t={};for(let n=0;n<e.length;n++)typeof e[n]=="function"?Object.assign(t,e[n](s)):e[n]&&typeof e[n]=="object"&&Object.keys(e[n]).forEach(r=>{if(typeof e[n][r]=="function")t[r]=e[n][r](s);else if(typeof e[n][r]=="object"){const a=e[n][r];t[r]=t[r]||{},Object.keys(a).forEach(o=>{typeof a[o]=="function"?t[r][o]=a(s):(a[o]||a[o]===0)&&(t[r][o]=a[o])})}else(e[n][r]||e[n][r]===0)&&(t[r]=e[n][r])});return t}};X(Se,"namespace",T),X(Se,"INSTANCES","instances"),X(Se,"dateFormat",["DD","MM"]),X(Se,"FORBIDDEN_CHARS",/[^._\-/ :!#$%&()+=@^{}|~\p{Ll}\p{Lu}\p{Nd}]+/gu);let W=Se;const te=W;function oe(w){return Object.prototype.toString.call(w)==="[object Object]"}const Ae=class Ae extends S.Component{constructor(e){super(e);X(this,"defaultValue");X(this,"isError");X(this,"lang");X(this,"defaultSendToDone");X(this,"sendToTimeout");X(this,"noPlaceRequired");X(this,"onUpdate",e=>{const t=Ae.getValue(e||this.props.data,this.props.attr)||"";this.state.value!==t?this.setState({value:t}):this.forceUpdate()});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.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=c.I18n.getLanguage()}componentDidMount(){this.props.registerOnForceUpdate&&this.props.registerOnForceUpdate(this.props.attr,this.onUpdate);const e=["select","autocomplete","autocompleteSendTo"];if(this.defaultValue!==void 0){const t=Ae.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.forceUpdate([this.props.attr],this.props.data),100)):(Ae.setValue(this.props.data,this.props.attr,this.defaultValue),this.props.onChange(this.props.data,void 0,()=>this.props.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);try{e=JSON.parse(t)}catch(n){console.error(`Cannot parse json data: ${t}`)}}else e={attr:this.props.attr,value:Ae.getValue(this.props.data,this.props.attr)};e===void 0&&(e=null),this.props.socket.sendTo(`${this.props.adapterName}.${this.props.instance}`,this.props.schema.defaultSendTo,e).then(t=>{t!=null&&(this.props.custom?this.props.onChange(this.props.attr,t,()=>this.props.forceUpdate([this.props.attr],this.props.data)):(Ae.setValue(this.props.data,this.props.attr,t),this.props.onChange(this.props.data,void 0,()=>this.props.forceUpdate([this.props.attr],this.props.data))))})}else this.defaultSendToDone=!1,this.onError(this.props.attr,c.I18n.t("ra_Instance %s is not alive",this.props.instance.toString()))}componentWillUnmount(){this.props.registerOnForceUpdate&&this.props.registerOnForceUpdate(this.props.attr),this.sendToTimeout&&(clearTimeout(this.sendToTimeout),this.sendToTimeout=null)}static getValue(e,t){if(typeof t=="string")return Ae.getValue(e,t.split("."));if(t.length===1)return e[t[0]];const n=t.shift();return typeof n=="string"&&typeof e[n]=="object"?Ae.getValue(e[n],t):null}static setValue(e,t,n){if(typeof t=="string"){Ae.setValue(e,t.split("."),n);return}if(t.length===1)n===null?delete e[t[0]]:e[t[0]]=n;else{const r=t.shift();if(typeof r!="string")return;(!e[r]||typeof e[r]=="object")&&(e[r]=e[r]||{}),Ae.setValue(e[r],t,n)}}getText(e,t){if(!e)return"";if(typeof e=="string"){const n=t?e:c.I18n.t(e);return n.includes("${")?this.getPattern(n):n}return oe(e)?e.func?typeof e.func=="object"?this.getPattern(e.func[this.lang]||e.func.en||""):this.getPattern(e.func):e[this.lang]||e.en||"":e.toString()}renderConfirmDialog(){if(!this.state.confirmDialog)return null;const e=this.state.confirmData||this.props.schema.confirm;let t=null;return e.type==="warning"?t=i().createElement(u.Warning,null):e.type==="error"?t=i().createElement(u.Error,null):e.type==="info"&&(t=i().createElement(u.Info,null)),i().createElement(c.Confirm,{title:this.getText(e.title)||c.I18n.t("ra_Please confirm"),text:this.getText(e.text),ok:this.getText(e.ok)||c.I18n.t("ra_Ok"),cancel:this.getText(e.cancel)||c.I18n.t("ra_Cancel"),icon:t||void 0,onClose:n=>this.setState({confirmDialog:!1},()=>{if(n){if(this.state.confirmCallback){const a=this.state.confirmCallback;this.setState({confirmCallback:null},()=>a(!0));return}const r=JSON.parse(JSON.stringify(this.props.data));this.state.confirmDepAttr&&Ae.setValue(r,this.state.confirmDepAttr,this.state.confirmDepNewValue),Ae.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=i().createElement(u.Key,null):e==="send"?t=i().createElement(u.Send,null):e==="web"?t=i().createElement(u.Public,null):e==="warning"?t=i().createElement(u.Warning,null):e==="error"?t=i().createElement(u.Error,null):e==="info"?t=i().createElement(u.Info,null):e==="search"?t=i().createElement(u.Search,null):e==="book"?t=i().createElement(u.MenuBook,null):e==="help"?t=i().createElement(u.Help,null):e==="upload"?t=i().createElement(u.UploadFile,null):e==="edit"?t=i().createElement(u.Edit,null):e==="user"?t=i().createElement(u.Person,null):e==="group"?t=i().createElement(u.Group,null):e==="delete"?t=i().createElement(u.Delete,null):e==="refresh"?t=i().createElement(u.Refresh,null):e==="add"?t=i().createElement(u.Add,null):e==="unpair"?t=i().createElement(u.LinkOff,null):e==="pair"?t=i().createElement(u.Link,null):e==="save"?t=i().createElement(u.Save,null):e==="open"?t=i().createElement(u.OpenInNew,null):e&&((e.endsWith(".png")||e.endsWith(".svg")||e.endsWith(".jpg"))&&!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`./adapter/${this.props.adapterName}/${e}`),t=i().createElement(c.Icon,{src:e,style:{width:22,height:22}})),t}onChangeAsync(e,t){return new Promise(n=>{this.onChange(e,t,n)})}onChange(e,t,n){const r=JSON.parse(JSON.stringify(this.props.data));if(Ae.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(o=>{this.setState({confirmDialog:!0,confirmNewValue:t,confirmAttr:e,confirmData:null},()=>{typeof n=="function"?n():o()})});if(this.props.schema.confirmDependsOn)for(let o=0;o<this.props.schema.confirmDependsOn.length;o++){const p=this.props.schema.confirmDependsOn[o];if(p.confirm){const O=Ae.getValue(r,p.attr);if(this.execute(p.confirm.condition,!1,r,this.props.arrayIndex,this.props.globalData))return new Promise(U=>{this.setState({confirmDialog:!0,confirmNewValue:t,confirmAttr:e,confirmDepNewValue:O,confirmDepAttr:p.attr,confirmData:p.confirm},()=>{typeof n=="function"?n():U()})})}}const a=[];if(this.props.schema.onChangeDependsOn)for(let o=0;o<this.props.schema.onChangeDependsOn.length;o++){const p=this.props.schema.onChangeDependsOn[o];if(p.onChange){const O=Ae.getValue(r,p.attr);let U;this.props.custom?U=this.executeCustom(p.onChange.calculateFunc,r,this.props.customObj,this.props.instanceObj,this.props.arrayIndex,this.props.globalData):U=this.execute(p.onChange.calculateFunc,O,r,this.props.arrayIndex,this.props.globalData),U!==O&&(Ae.setValue(r,p.attr,U),a.push(p.attr))}}if(this.props.schema.hiddenDependsOn)for(let o=0;o<this.props.schema.hiddenDependsOn.length;o++){const p=this.props.schema.hiddenDependsOn[o];p.hidden&&a.push(p.attr)}if(this.props.schema.labelDependsOn)for(let o=0;o<this.props.schema.labelDependsOn.length;o++){const p=this.props.schema.labelDependsOn[o];p.hidden&&a.push(p.attr)}if(this.props.schema.helpDependsOn)for(let o=0;o<this.props.schema.helpDependsOn.length;o++){const p=this.props.schema.helpDependsOn[o];p.hidden&&a.push(p.attr)}if(this.props.schema.onChange&&!this.props.schema.onChange.ignoreOwnChanges){const o=Ae.getValue(r,this.props.attr),p=this.props.custom?this.executeCustom(this.props.schema.onChange.calculateFunc,r,this.props.customObj,this.props.instanceObj,this.props.arrayIndex,this.props.globalData):this.execute(this.props.schema.onChange.calculateFunc,o,r,this.props.arrayIndex,this.props.globalData);p!==o&&Ae.setValue(r,this.props.attr,p)}return this.props.custom?(this.props.onChange(e,t,()=>n&&n()),a!=null&&a.length&&a.forEach((o,p)=>setTimeout(()=>this.props.onChange(o,Ae.getValue(r,o)),p*50))):this.props.onChange(r,void 0,()=>{a.length&&this.props.forceUpdate(a,r),n&&n()}),Promise.resolve()}execute(e,t,n,r,a){let o;if(oe(e))o=e.func;else if(typeof e=="string")o=e;else return e;if(!o)return t;try{return new Function("data","originalData","_system","_alive","_common","_socket","_instance","arrayIndex","globalData","_changed",o.includes("return")?o:`return ${o}`)(n||this.props.data,this.props.originalData,this.props.systemConfig,this.props.alive,this.props.common,this.props.socket,this.props.instance,r,a,this.props.changed)}catch(p){return console.error(`Cannot execute ${e}: ${p}`),t}}executeCustom(e,t,n,r,a,o){let p;if(oe(e))p=e.func;else if(typeof e=="string")p=e;else return e;if(!p)return null;try{return new Function("data","originalData","_system","instanceObj","customObj","_socket","arrayIndex","globalData","_changed",p.includes("return")?p:`return ${p}`)(t||this.props.data,this.props.originalData,this.props.systemConfig,r,n,this.props.socket,a,o,this.props.changed)}catch(O){return console.error(`Cannot execute ${p}: ${O}`),null}}calculate(e){let t,n,r,a;return this.props.custom?(t=e.validator?!this.executeCustom(e.validator,this.props.data,this.props.customObj,this.props.instanceObj,this.props.arrayIndex,this.props.globalData):!1,e.disabled===!0?n=!0:n=e.disabled?this.executeCustom(e.disabled,this.props.data,this.props.customObj,this.props.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.instanceObj,this.props.arrayIndex,this.props.globalData):!1,a=e.defaultFunc?this.executeCustom(e.defaultFunc,this.props.data,this.props.customObj,this.props.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?n=!0:n=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,a=e.defaultFunc?this.execute(e.defaultFunc,e.default,this.props.data,this.props.arrayIndex,this.props.globalData):e.default),{error:t,disabled:n,hidden:r,defaultValue:a}}onError(e,t){t?this.isError[e]=t:delete this.isError[e],this.props.onError&&this.props.onError(e,t)}renderItem(e,t,n){return this.getText(this.props.schema.label)||this.getText(this.props.schema.text)}renderHelp(e,t,n){return t?i().createElement("a",{href:t,target:"_blank",rel:"noreferrer",style:{color:this.props.themeType==="dark"?"#a147ff":"#5b238f",textDecoration:"underline"}},this.getText(e,n)):(e=this.getText(e,n)||"",e&&(e.includes("<a ")||e.includes("<br")||e.includes("<b>")||e.includes("<i>"))?c.Utils.renderTextWithA(e):e)}static escapeString(e,t){return typeof e!="string"?"":(e=e.replace(/`/g,"\\`"),e=e.replace(/\${([^}]+)}/g,(n,r)=>{if(r&&typeof r=="string"&&r.startsWith("data.")){const a=Ae.getValue(t,r.replace(/^data\./,""));if(typeof a=="string"&&a.includes('"'))return`\${${r}.replace(/"/g, '\\\\"')}`}return n}),e)}getPattern(e,t){if(t=t||this.props.data,!e)return"";let n;typeof e=="object"?e.func?n=e.func:(console.log(`Object must be stringified: ${JSON.stringify(e)}`),n=JSON.stringify(e)):n=e;try{return this.props.custom?new Function("data","originalData","arrayIndex","globalData","_system","instanceObj","customObj","_socket","_changed",`return \`${Ae.escapeString(n,t)}\``)(t,this.props.originalData,this.props.arrayIndex,this.props.globalData,this.props.systemConfig,this.props.instanceObj,this.props.customObj,this.props.socket,this.props.changed):new Function("data","originalData","arrayIndex","globalData","_system","_alive","_common","_socket","_changed",`return \`${Ae.escapeString(n,t)}\``)(t,this.props.originalData,this.props.arrayIndex,this.props.globalData,this.props.systemConfig,this.props.alive,this.props.common,this.props.socket,this.props.changed)}catch(r){return console.error(`Cannot execute ${n}: ${r}`),n}}render(){const e=this.props.schema;if(!e)return null;this.props.alive&&this.defaultSendToDone===!1&&(this.sendToTimeout=setTimeout(()=>{this.sendToTimeout=null,this.sendTo()},200));const{error:t,disabled:n,hidden:r,defaultValue:a}=this.calculate(e);if(r){if(Object.keys(this.isError).length&&(setTimeout(O=>Object.keys(O).forEach(U=>this.props.onError(U)),100,JSON.parse(JSON.stringify(this.isError))),this.isError={}),e.hideOnlyControl){const O=i().createElement(l.Grid2,{size:{xs:e.xs||void 0,lg:e.lg||void 0,md:e.md||void 0,sm:e.sm||void 0},style:Y(Y({marginBottom:0,textAlign:"left"},e.style),this.props.themeType==="dark"?e.darkStyle:{})});return e.newLine?i().createElement(i().Fragment,null,i().createElement("div",{style:{flexBasis:"100%",height:0}}),O):O}return null}e.validatorNoSaveOnError&&(t&&!Object.keys(this.isError).length?(this.isError={[this.props.attr]:e.validatorErrorText?c.I18n.t(e.validatorErrorText):!0},setTimeout(O=>Object.keys(O).forEach(U=>this.props.onError(U,O[U])),100,JSON.parse(JSON.stringify(this.isError)))):!t&&Object.keys(this.isError).length&&(setTimeout(O=>Object.keys(O).forEach(U=>this.props.onError(U)),100,JSON.parse(JSON.stringify(this.isError))),this.isError={}));const o=this.renderItem(t,n||this.props.commandRunning||this.props.disabled,a);if(this.noPlaceRequired)return o;const p=i().createElement(l.Grid2,{title:this.getText(e.tooltip),size:{xs:e.xs||void 0,lg:e.lg||void 0,md:e.md||void 0,sm:e.sm||void 0},style:Y(Y({marginBottom:0,textAlign:"left",width:e.type==="divider"||e.type==="header"?e.width||"100%":void 0},e.style),this.props.themeType==="dark"?e.darkStyle:{})},this.props.schema.defaultSendTo&&this.props.schema.button?i().createElement(l.Grid2,{container:!0,style:{width:"100%"}},i().createElement(l.Grid2,{flex:1},o),i().createElement(l.Grid2,null,i().createElement(l.Button,{variant:"outlined",onClick:()=>this.sendTo(),title:this.props.schema.buttonTooltip?this.getText(this.props.schema.buttonTooltip,this.props.schema.buttonTooltipNoTranslation):c.I18n.t("ra_Request data by instance")},this.getText(this.props.schema.button)))):o);return e.newLine?i().createElement(i().Fragment,null,i().createElement("div",{style:{flexBasis:"100%",height:0}}),this.renderConfirmDialog(),p):this.state.confirmDialog?i().createElement(i().Fragment,null,this.renderConfirmDialog(),p):p}};X(Ae,"DIFFERENT_VALUE","__different__"),X(Ae,"DIFFERENT_LABEL","ra___different__"),X(Ae,"NONE_VALUE",""),X(Ae,"NONE_LABEL","ra_none");let m=Ae;const x={fullWidth:{width:"100%"},accordionSummary:w=>({backgroundColor:w.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"rgba(0, 0, 0, 0.08)"}),accordionTitle:{},toolbar:w=>({backgroundColor:w.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"rgba(0, 0, 0, 0.08)",borderRadius:"3px"}),tooltip:{pointerEvents:"none"}};class y extends m{constructor(e){super(e);X(this,"typingTimer",null);X(this,"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))});X(this,"onClone",e=>()=>{const t=JSON.parse(JSON.stringify(this.state.value)),n=JSON.parse(JSON.stringify(t[e]));if(typeof this.props.schema.clone=="string"&&typeof n[this.props.schema.clone]=="string"){let r=1,a=n[this.props.schema.clone];const o=a.match(/(\d+)$/);for(o?(a=a.replace(o[0],""),r=parseInt(o[0],10)+1):a+="_";t.find(p=>p[this.props.schema.clone]===a+r.toString());)r++;n[this.props.schema.clone]=`${n[this.props.schema.clone]}_${r}`}t.splice(e,0,n),this.setState({value:t,activeIndex:-1,iteration:this.state.iteration+1e4},()=>this.onChangeWrapper(t))});X(this,"onChangeWrapper",e=>{this.typingTimer&&clearTimeout(this.typingTimer),this.typingTimer=setTimeout(t=>{this.typingTimer=null,this.onChange(this.props.attr,t)},300,e)});X(this,"onAdd",()=>{const{schema:e}=this.props,t=JSON.parse(JSON.stringify(this.state.value)),n=e.items&&e.items.reduce((r,a)=>{let o;return a.defaultFunc?this.props.custom?o=a.defaultFunc?this.executeCustom(a.defaultFunc,this.props.data,this.props.customObj,this.props.instanceObj,t.length,this.props.data):this.props.schema.default:o=a.defaultFunc?this.execute(a.defaultFunc,this.props.schema.default,this.props.data,t.length,this.props.data):this.props.schema.default:o=a.default===void 0?null:a.default,r[a.attr]=o,r},{});t.push(n),this.setState({value:t,activeIndex:t.length-1},()=>this.onChangeWrapper(t))});this.props.schema.items=this.props.schema.items||[]}componentDidMount(){return ae(this,null,function*(){Re(y.prototype,this,"componentDidMount").call(this);let e=m.getValue(this.props.data,this.props.attr)||[];Array.isArray(e)||(e=[]),this.setState({value:e,activeIndex:-1,iteration:0})})}componentWillUnmount(){this.typingTimer&&(clearTimeout(this.typingTimer),this.typingTimer=null),super.componentWillUnmount()}itemAccordion(e,t){const{value:n}=this.state,{schema:r}=this.props,a={type:"panel",items:r.items.reduce((o,p)=>(o[p.attr]=p,o),{}),style:{marginLeft:"-8px",marginTop:"10px",marginBottom:"10px"}};return i().createElement(Lt,{index:t+this.state.iteration,arrayIndex:t,changed:this.props.changed,globalData:this.props.data,socket:this.props.socket,adapterName:this.props.adapterName,instance:this.props.instance,common:this.props.common,alive:this.props.alive,themeType:this.props.themeType,themeName:this.props.themeName,data:e,custom:!0,schema:a,systemConfig:this.props.systemConfig,originalData:this.props.originalData,customs:this.props.customs,dateFormat:this.props.dateFormat,isFloatComma:this.props.isFloatComma,forceUpdate:this.props.forceUpdate,imagePrefix:this.props.imagePrefix,onCommandRunning:this.props.onCommandRunning,onChange:(o,p)=>{const O=JSON.parse(JSON.stringify(n));O[t][o]=p,this.setState({value:O},()=>this.onChangeWrapper(O))},onError:(o,p)=>this.onError(o,p),onBackEndCommand:this.props.onBackEndCommand,table:this.props.table,DeviceManager:this.props.DeviceManager,theme:this.props.theme})}onMoveUp(e){const t=JSON.parse(JSON.stringify(this.state.value)),n=t[e];t.splice(e,1),t.splice(e-1,0,n);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)),n=t[e];t.splice(e,1),t.splice(e+1,0,n);const r=this.state.activeIndex+1;this.setState({value:t,activeIndex:r,iteration:this.state.iteration+1e4},()=>this.onChangeWrapper(t))}renderItem(){const{schema:e}=this.props,{value:t}=this.state;return t?i().createElement(l.Paper,null,e.label||!e.noDelete?i().createElement(l.Toolbar,{variant:"dense"},e.label?i().createElement(l.Typography,{variant:"h6",id:"tableTitle",component:"div"},this.getText(e.label)):null,e.noDelete?null:i().createElement(l.IconButton,{size:"small",color:"primary",onClick:this.onAdd},i().createElement(u.Add,null))):null,t.map((n,r)=>i().createElement(l.Accordion,{key:`${n}_${r}`,expanded:this.state.activeIndex===r,onChange:(a,o)=>this.setState({activeIndex:o?r:-1})},i().createElement(l.AccordionSummary,{expandIcon:i().createElement(u.ExpandMore,null),sx:te.getStyle(this.props.theme,x.fullWidth,x.accordionSummary)},i().createElement(l.Typography,{style:x.accordionTitle},n[e.titleAttr])),i().createElement(l.AccordionDetails,{style:Y(Y({},e.style),this.props.themeType?e.darkStyle:void 0)},this.itemAccordion(t[r],r),i().createElement(l.Toolbar,{sx:x.toolbar},r?i().createElement(l.Tooltip,{title:c.I18n.t("ra_Move up"),slotProps:{popper:{sx:x.tooltip}}},i().createElement(l.IconButton,{size:"small",onClick:()=>this.onMoveUp(r)},i().createElement(u.ArrowUpward,null))):i().createElement("div",{style:x.buttonEmpty}),r<t.length-1?i().createElement(l.Tooltip,{title:c.I18n.t("ra_Move down"),slotProps:{popper:{sx:x.tooltip}}},i().createElement(l.IconButton,{size:"small",onClick:()=>this.onMoveDown(r)},i().createElement(u.ArrowDownward,null))):i().createElement("div",{style:x.buttonEmpty}),e.noDelete?null:i().createElement(l.Tooltip,{title:c.I18n.t("ra_Delete current row"),slotProps:{popper:{sx:x.tooltip}}},i().createElement(l.IconButton,{size:"small",onClick:this.onDelete(r)},i().createElement(u.Delete,null))),e.clone?i().createElement(l.Tooltip,{title:c.I18n.t("ra_Clone current row"),slotProps:{popper:{sx:x.tooltip}}},i().createElement(l.IconButton,{size:"small",onClick:this.onClone(r)},i().createElement(u.ContentCopy,null))):null)))),!e.noDelete&&t.length>0?i().createElement(l.Toolbar,{variant:"dense",sx:x.rootTool},i().createElement(l.IconButton,{size:"small",color:"primary",onClick:this.onAdd},i().createElement(u.Add,null))):null,e.help?i().createElement(l.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null):null}}const h=y,g={root:{width:"100%"},notAlive:{color:"#a30000"}};class d extends m{componentDidMount(){super.componentDidMount();const s=this.getInstance();this.props.socket.getState(`${s}.alive`).then(e=>this.setState({alive:!!(e&&e.val),instance:s}))}getInstance(){let s=this.props.schema.instance||`${this.props.adapterName}.${this.props.instance}`;return s.includes("${")&&(s=this.getPattern(s)),s&&!s.startsWith("system.adapter.")&&(s=`system.adapter.${s}`),s}renderItem(){if(this.getInstance()!==this.state.instance&&setTimeout(()=>{const e=this.getInstance();e?this.props.socket.getState(`${e}.alive`).then(t=>this.setState({alive:!!(t&&t.val),instance:e})):this.setState({alive:null,instance:e})},200),this.state.alive!==!1&&this.state.alive!==!0)return null;const s=this.state.instance.replace(/^system.adapter./,"");return i().createElement("div",{style:Y(Y({},g.root),this.state.alive?void 0:g.notAlive)},this.state.alive?this.props.schema.textAlive!==void 0?this.props.schema.textAlive?c.I18n.t(this.props.schema.textAlive,s):"":c.I18n.t("ra_Instance %s is alive",s):this.props.schema.textNotAlive!==void 0?this.props.schema.textNotAlive?c.I18n.t(this.props.schema.textNotAlive,s):"":c.I18n.t("ra_Instance %s is not alive",s))}}const b=d;class E extends m{componentDidMount(){super.componentDidMount();const s=m.getValue(this.props.data,this.props.attr),e=this.props.schema.options.map(t=>typeof t=="string"?{label:t,value:t}:JSON.parse(JSON.stringify(t)));Array.isArray(s)?(e.unshift({label:c.I18n.t(m.DIFFERENT_LABEL),value:m.DIFFERENT_VALUE}),this.setState({value:m.DIFFERENT_VALUE,selectOptions:e})):this.setState({value:s,selectOptions:e})}renderItem(s,e){if(!this.state.selectOptions)return null;let t;const n=JSON.parse(JSON.stringify(this.state.selectOptions));return Array.isArray(this.state.value)||this.state.value===m.DIFFERENT_VALUE?([...this.state.value].filter(a=>!n.find(o=>typeof o=="object"?o.value===a:o===a)).forEach(a=>n.push({label:a.toString(),value:a})),t={label:c.I18n.t(m.DIFFERENT_LABEL),value:m.DIFFERENT_VALUE},n.unshift(t)):(t=this.state.value!==null&&this.state.value!==void 0&&n.find(a=>typeof a=="object"?a.value==this.state.value:a==this.state.value),this.state.value!==null&&this.state.value!==void 0&&!t&&this.props.schema.freeSolo&&(t={value:this.state.value,label:this.state.value},n.push(t))),i().createElement(l.Autocomplete,{fullWidth:!0,freeSolo:!!this.props.schema.freeSolo,value:t,options:n,onInputChange:a=>{if(!a||!this.props.schema.freeSolo)return;const o=a.target.value;o!==this.state.value&&this.setState({value:o},()=>this.onChange(this.props.attr,o))},onChange:(a,o)=>{const p=typeof o=="object"?o?o.value:"":o;p!==this.state.value&&this.setState({value:p},()=>this.onChange(this.props.attr,p))},getOptionLabel:a=>{var o;return typeof a=="object"&&(o=a==null?void 0:a.label)!=null?o:""},renderInput:a=>i().createElement(l.TextField,$e(Y({variant:"standard"},a),{error:!!s,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:e}))})}}const k=E;class B extends m{constructor(){super(...arguments);X(this,"initialized",!1);X(this,"_context")}askInstance(){const e=m.getValue(this.props.data,this.props.attr),t=this.props.schema.options?this.props.schema.options.map(n=>typeof n=="string"?{label:n,value:n}:JSON.parse(JSON.stringify(n))):[];if(this.props.alive){let n=this.props.schema.data;if(n===void 0&&this.props.schema.jsonData){n=this.getPattern(this.props.schema.jsonData);try{typeof n=="string"&&(n=JSON.parse(n))}catch(r){console.error(`Cannot parse json data: ${n}`)}}n===void 0&&(n=null),this.props.socket.sendTo(`${this.props.adapterName}.${this.props.instance}`,this.props.schema.command||"send",n).then(r=>{r&&Array.isArray(r)&&r.forEach(a=>t.push(typeof a=="string"?{label:a,value:a}:JSON.parse(JSON.stringify(a)))),Array.isArray(e)?(t.unshift({label:c.I18n.t(m.DIFFERENT_LABEL),value:m.DIFFERENT_VALUE}),this.setState({value:m.DIFFERENT_VALUE,selectOptions:t})):this.setState({value:e,selectOptions:t})})}else Array.isArray(e)?(t.unshift({label:c.I18n.t(m.DIFFERENT_LABEL),value:m.DIFFERENT_VALUE}),this.setState({value:m.DIFFERENT_VALUE,selectOptions:t})):this.setState({value:e,selectOptions:t})}getContext(){const e={};return Array.isArray(this.props.schema.alsoDependsOn)&&this.props.schema.alsoDependsOn.forEach(t=>e[t]=m.getValue(this.props.data,t)),JSON.stringify(e)}renderItem(e,t){if(this.props.alive){const o=this.getContext();(o!==this._context||!this.initialized)&&(this._context=o,setTimeout(()=>this.askInstance(),this.initialized?300:50),this.initialized=!0)}if(!this.state.selectOptions)return null;let n;const r=JSON.parse(JSON.stringify(this.state.selectOptions));return Array.isArray(this.state.value)||this.state.value===m.DIFFERENT_LABEL?([...this.state.value].filter(o=>!r.find(p=>p.value===o)).forEach(o=>r.push({label:o.toString(),value:o})),n={label:c.I18n.t(m.DIFFERENT_LABEL),value:m.DIFFERENT_VALUE},r.unshift(n)):(n=this.state.value!==null&&this.state.value!==void 0&&r.find(o=>o.value==this.state.value),this.state.value!==null&&this.state.value!==void 0&&!n&&this.props.schema.freeSolo&&(n={value:this.state.value,label:this.state.value},r.push(n)),n=n||null),r.length?i().createElement(l.Autocomplete,{value:n,fullWidth:!0,freeSolo:!!this.props.schema.freeSolo,options:r,getOptionLabel:o=>{var p;return(p=o==null?void 0:o.label)!=null?p:""},onInputChange:o=>{if(!o||!this.props.schema.freeSolo)return;const p=o.target.value;p!==this.state.value&&this.setState({value:p},()=>this.onChange(this.props.attr,p))},onChange:(o,p)=>{const O=typeof p=="object"?p?p.value:"":p;O!==this.state.value&&this.setState({value:O},()=>this.onChange(this.props.attr,O))},renderInput:o=>i().createElement(l.TextField,$e(Y({variant:"standard"},o),{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}))}):i().createElement(l.TextField,{variant:"standard",fullWidth:!0,value:this.state.value===null||this.state.value===void 0?"":this.state.value,error:!!e,disabled:t,inputProps:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0},onChange:o=>{const p=o.target.value;this.setState({value:p},()=>this.onChange(this.props.attr,(p||"").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 _=B,A={fullWidth:{width:"100%"},flex:{display:"flex"},button:{height:48,marginLeft:4,minWidth:48}};class I extends m{componentDidMount(){return ae(this,null,function*(){Re(I.prototype,this,"componentDidMount").call(this);const{data:s,attr:e}=this.props,t=m.getValue(s,e)||"";this.setState({value:t,showDialog:!1})})}renderItem(s,e){const{schema:t,attr:n}=this.props,{value:r,showDialog:a}=this.state;return i().createElement(l.FormControl,{style:A.fullWidth,variant:"standard"},t.label?i().createElement(l.InputLabel,{shrink:!0},this.getText(t.label)):null,i().createElement("div",{style:A.flex},i().createElement(l.TextField,{variant:"standard",fullWidth:!0,value:r!=null?r:"",error:!!s,disabled:e,placeholder:this.getText(t.placeholder),label:this.getText(t.label),helperText:this.renderHelp(t.help,t.helpLink,t.noTranslation),onChange:o=>{const p=o.target.value;this.setState({value:p},()=>this.onChange(n,p))}}),i().createElement(l.Button,{color:"grey",style:A.button,size:"small",variant:"outlined",onClick:()=>this.setState({showDialog:!0})},"...")),a?i().createElement(c.Cron,{title:c.I18n.t("ra_Define schedule"),simple:t.simple,complex:t.complex,cron:r,onClose:()=>this.setState({showDialog:!1}),cancel:c.I18n.t("ra_Cancel"),ok:c.I18n.t("ra_Ok"),theme:this.props.theme,onOk:o=>this.setState({showDialog:!1,value:o},()=>this.onChange(n,o))}):null)}}const M=I;class re extends m{componentDidMount(){return ae(this,null,function*(){Re(re.prototype,this,"componentDidMount").call(this);const s=m.getValue(this.props.data,this.props.attr),t=(yield this.props.socket.getCertificates()).filter(n=>{const r=this.props.attr.toLowerCase();return r.includes(n.type)||n.type==="public"&&r.includes("cert")||n.type==="private"&&(r.includes("priv")||r.includes("key"))?!0:!!(n.type==="chained"&&(r.includes("chain")||r.includes("ca")))}).map(n=>({label:n.name,value:n.name}));t.unshift({label:c.I18n.t(m.NONE_LABEL),value:m.NONE_VALUE}),this.setState({value:s,selectOptions:t})})}renderItem(s,e){var n,r;if(!this.state.selectOptions)return null;const t=(n=this.state.selectOptions)==null?void 0:n.find(a=>a.value===this.state.value);return i().createElement(l.FormControl,{style:{width:"100%"},variant:"standard"},this.props.schema.label?i().createElement(l.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,i().createElement(l.Select,{variant:"standard",error:!!s,displayEmpty:!0,disabled:!!e,value:this.state.value,renderValue:()=>this.getText(t==null?void 0:t.label,this.props.schema.noTranslation!==!1),onChange:a=>this.setState({value:a.target.value},()=>this.onChange(this.props.attr,this.state.value))},(r=this.state.selectOptions)==null?void 0:r.map(a=>i().createElement(l.MenuItem,{key:a.value,value:a.value,style:a.value===m.NONE_VALUE?{opacity:.5}:{}},this.getText(a.label,this.props.schema.noTranslation!==!1)))),this.props.schema.help?i().createElement(l.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Q=re,le={fullWidth:{width:"100%"},leWidth:{width:620,marginBottom:10},certWidth:{width:200,marginRight:10}};class ce extends m{componentDidMount(){return ae(this,null,function*(){var o;Re(ce.prototype,this,"componentDidMount").call(this);const s=yield this.props.socket.getCertificates(),e=[],t=[],n=[];let r=[];const a=yield this.props.socket.getObject("system.certificates");(o=a==null?void 0:a.native)!=null&&o.collections?r=Object.keys(a.native.collections):r=null,s.forEach(p=>{p.type==="public"?e.push({label:p.name,value:p.name}):p.type==="private"?t.push({label:p.name,value:p.name}):p.type==="chained"?n.push({label:p.name,value:p.name}):(e.push({label:p.name,value:p.name}),t.push({label:p.name,value:p.name}),n.push({label:p.name,value:p.name}))}),e.unshift({label:c.I18n.t(m.NONE_LABEL),value:m.NONE_VALUE}),t.unshift({label:c.I18n.t(m.NONE_LABEL),value:m.NONE_VALUE}),n.unshift({label:c.I18n.t(m.NONE_LABEL),value:m.NONE_VALUE}),this.setState({certsPublicOptions:e,certsChainOptions:n,certsPrivateOptions:t,collectionsOptions:r})})}renderItem(s,e){var U,J,q,he,Ee,se,ye;if(!this.state.certsPublicOptions||!this.state.certsPrivateOptions||!this.state.certsChainOptions)return null;const t=(m.getValue(this.props.data,this.props.schema.leCollectionName||"leCollection")||"false").toString(),n=m.getValue(this.props.data,this.props.schema.certPublicName||"certPublic"),r=m.getValue(this.props.data,this.props.schema.certPrivateName||"certPrivate"),a=m.getValue(this.props.data,this.props.schema.certChainedName||"certChained"),o=(U=this.state.certsPublicOptions)==null?void 0:U.find(de=>de.value===n),p=(J=this.state.certsPrivateOptions)==null?void 0:J.find(de=>de.value===r),O=(q=this.state.certsChainOptions)==null?void 0:q.find(de=>de.value===a);return i().createElement("div",{style:le.fullWidth},this.state.collectionsOptions?i().createElement(l.FormControl,{style:le.leWidth,variant:"standard"},i().createElement(l.InputLabel,{shrink:!0},"Let's encrypt"),i().createElement(l.Select,{variant:"standard",error:!!s,displayEmpty:!0,disabled:!!e,value:t,onChange:de=>this.onChange(this.props.schema.leCollectionName||"leCollection",de.target.value==="false"?!1:de.target.value==="true"?!0:de.target.value)},i().createElement(l.MenuItem,{key:"_false",value:"false",style:{fontWeight:"bold"}},c.I18n.t("ra_Do not use let's encrypt")),i().createElement(l.MenuItem,{key:"_true",value:"true",style:{fontWeight:"bold"}},c.I18n.t("ra_Use all available let's encrypt certificates")),(he=this.state.collectionsOptions)==null?void 0:he.map(de=>i().createElement(l.MenuItem,{key:de,value:de},de)))):null,this.state.collectionsOptions?i().createElement("br",null):null,this.state.collectionsOptions&&t!=="false"?i().createElement("div",null,c.I18n.t("ra_Fallback custom certificates")):null,i().createElement(l.FormControl,{style:le.certWidth,variant:"standard"},i().createElement(l.InputLabel,{shrink:!0},c.I18n.t("ra_Public certificate")),i().createElement(l.Select,{variant:"standard",error:!!s,displayEmpty:!0,disabled:!!e,value:n||"",renderValue:()=>this.getText(o==null?void 0:o.label),onChange:de=>this.onChange(this.props.schema.certPublicName||"certPublic",de.target.value)},(Ee=this.state.certsPublicOptions)==null?void 0:Ee.map((de,qe)=>i().createElement(l.MenuItem,{key:`${de.value}_${qe}`,value:de.value,style:de.value===m.NONE_VALUE?{opacity:.5}:{}},this.getText(de.label))))),i().createElement(l.FormControl,{style:le.certWidth,variant:"standard"},i().createElement(l.InputLabel,{shrink:!0},c.I18n.t("ra_Private certificate")),i().createElement(l.Select,{variant:"standard",error:!!s,displayEmpty:!0,disabled:!!e,value:r||"",renderValue:()=>this.getText(p==null?void 0:p.label),onChange:de=>this.onChange(this.props.schema.certPrivateName||"certPrivate",de.target.value)},(se=this.state.certsPrivateOptions)==null?void 0:se.map((de,qe)=>i().createElement(l.MenuItem,{key:`${de.value}_${qe}`,value:de.value,style:de.value===m.NONE_VALUE?{opacity:.5}:{}},this.getText(de.label))))),i().createElement(l.FormControl,{style:le.certWidth,variant:"standard"},i().createElement(l.InputLabel,{shrink:!0},c.I18n.t("ra_Chained certificate")),i().createElement(l.Select,{variant:"standard",error:!!s,displayEmpty:!0,disabled:!!e,value:a||"",renderValue:()=>this.getText(O==null?void 0:O.label),onChange:de=>this.onChange(this.props.schema.certChainedName||"certChained",de.target.value)},(ye=this.state.certsChainOptions)==null?void 0:ye.map((de,qe)=>i().createElement(l.MenuItem,{key:`${de.value}_${qe}`,value:de.value,style:de.value===m.NONE_VALUE?{opacity:.5}:{}},this.getText(de.label))))))}}const R=ce;class K extends m{componentDidMount(){return ae(this,null,function*(){var t;Re(K.prototype,this,"componentDidMount").call(this);let s;const e=yield this.props.socket.getObject("system.certificates");(t=e==null?void 0:e.native)!=null&&t.collections?s=Object.keys(e.native.collections):s=[],this.setState({collectionsOptions:s})})}renderItem(s,e){var n;if(!this.state.collectionsOptions)return null;const t=(m.getValue(this.props.data,this.props.schema.leCollectionName||"leCollection")||"false").toString();return i().createElement(l.FormControl,{style:{width:"100%"},variant:"standard"},this.props.schema.label?i().createElement(l.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,i().createElement(l.Select,{variant:"standard",error:!!s,displayEmpty:!0,disabled:!!e,value:t,onChange:r=>this.onChange(this.props.schema.leCollectionName||"leCollection",r.target.value==="false"?!1:r.target.value==="true"?!0:r.target.value)},i().createElement(l.MenuItem,{key:"_false",value:"false",style:{fontWeight:"bold"}},c.I18n.t("ra_Do not use let's encrypt")),i().createElement(l.MenuItem,{key:"_true",value:"true",style:{fontWeight:"bold"}},c.I18n.t("ra_Use all available let's encrypt certificates")),(n=this.state.collectionsOptions)==null?void 0:n.map(r=>i().createElement(l.MenuItem,{key:r,value:r},r))),this.props.schema.help?i().createElement(l.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const z=K,j={fullWidth:{width:"100%"},icon:{width:24,height:24,marginRight:4},licLabel:{fontWeight:"bold",minWidth:100,marginRight:10,textTransform:"capitalize",display:"inline-block"},licValue:{fontWeight:"normal"},errorTitle:w=>({color:w.palette.mode==="dark"?"#e39191":"#b62020"}),okTitle:w=>({color:w.palette.mode==="dark"?"#6fd56f":"#007c00"}),errorText:w=>({color:w.palette.mode==="dark"?"#e39191":"#b62020",mb:"30px"})};class _e extends m{componentDidMount(){return ae(this,null,function*(){Re(_e.prototype,this,"componentDidMount").call(this),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 s=this.state._error;return this.state.allLicenses&&(s=[i().createElement("div",{key:"error"},s)],s.push(i().createElement(l.Button,{key:"button",variant:"contained",onClick:()=>window.open("https://iobroker.net/www/account/licenses","_blank")},c.I18n.t("iobroker.net"))),this.state.allLicenses.length?s.push(i().createElement(l.TableContainer,{key:"table"},i().createElement(l.Table,{size:"small"},i().createElement(l.TableHead,null,i().createElement(l.TableRow,null,i().createElement(l.TableCell,null,c.I18n.t("ra_Product")),i().createElement(l.TableCell,null,c.I18n.t("ra_Version")),i().createElement(l.TableCell,null,"UUID"),i().createElement(l.TableCell,null,c.I18n.t("ra_ValidTill")),i().createElement(l.TableCell,null,c.I18n.t("ra_Commercial")),i().createElement(l.TableCell,null,"ID"))),i().createElement(l.TableBody,null,this.state.allLicenses.map(e=>i().createElement(l.TableRow,{key:e.id},i().createElement(l.TableCell,{sx:e.validName?null:j.errorText},e.license.product),i().createElement(l.TableCell,{sx:e.validVersion?null:j.errorText},e.license.version),i().createElement(l.TableCell,{sx:e.validUuid?null:j.errorText},e.license.uuid||"--"),i().createElement(l.TableCell,{sx:e.validTill?null:j.errorText},e.license.validTill&&e.license.validTill!=="0000-00-00 00:00:00"?new Date(e.license.validTill).toLocaleDateString():"--"),i().createElement(l.TableCell,null,e.license.invoice!=="free"?e.license.invoice==="MANUALLY_CREATED"?"\u2713":e.license.invoice:"-"),i().createElement(l.TableCell,null,e.id))))))):(s.push(i().createElement("div",{key:"text1"},c.I18n.t("ra_No one license found in license manager"))),s.push(i().createElement("div",{key:"text2"},c.I18n.t("ra_Please create license"))))),i().createElement(l.Dialog,{open:!0,maxWidth:"xl",fullWidth:this.props.fullWidth!==void 0?this.props.fullWidth:!0,onClick:()=>this.setState({_error:"",allLicenses:null})},i().createElement(l.DialogTitle,null,c.I18n.t("ra_Error")),i().createElement(l.DialogContent,null,i().createElement(l.DialogContentText,null,s)),i().createElement(l.DialogActions,null,i().createElement(l.Button,{variant:"contained",onClick:()=>this.setState({_error:"",allLicenses:null}),color:"primary",autoFocus:!0,startIcon:i().createElement(u.Check,null)},c.I18n.t("ra_Ok"))))}return null}renderMessageDialog(){if(this.state.showLicenseData){const s=[],e=this.state.showLicenseData;return Object.keys(e).forEach(t=>{if(!(e[t]===null||e[t]===void 0))if(typeof e[t]=="object"){const n=e[t];Object.keys(n).forEach(r=>{n[r]!==null&&n[r]!==void 0&&(typeof n[r]=="object"?s.push(i().createElement("div",{key:r},i().createElement("div",{style:j.licLabel},r,":"),JSON.stringify(n[r],null,2))):s.push(i().createElement("div",{key:r},i().createElement("div",{style:j.licLabel},t," ","-",r,":"),n[r].toString())))})}else s.push(i().createElement("div",{key:t},i().createElement("div",{style:j.licLabel},t.replace(/_/g," "),":"),e[t].toString()))}),s.push(i().createElement("div",{key:"checked"},i().createElement("div",{style:j.licLabel},c.I18n.t("ra_Checked"),":"),this.state.licenseOfflineCheck?c.I18n.t("ra_locally"):c.I18n.t("ra_via internet"))),i().createElement(l.Dialog,{open:!0,onClose:()=>this.setState({showLicenseData:null})},i().createElement(l.DialogTitle,null,i().createElement(l.Box,{component:"span",sx:this.state.result?j.okTitle:j.errorTitle},c.I18n.t("ra_License %s",this.state.result?"OK":"INVALID"))),i().createElement(l.DialogContent,null,this.state.showLinkToProfile?i().createElement(l.Button,{variant:"contained",onClick:()=>window.open("https://iobroker.net/www/account/licenses","_blank")},"https://iobroker.net"):null,this.state._error?i().createElement(l.Box,{component:"div",sx:j.errorText},this.state._error):null,s),i().createElement(l.DialogActions,null,i().createElement(l.Button,{onClick:()=>this.setState({showLicenseData:null,_error:""}),color:"primary",variant:"contained"},c.I18n.t("ra_Close"))))}return null}static parseJwt(s){const t=s.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(atob(t).split("").map(r=>`%${`00${r.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));try{return JSON.parse(n)}catch(r){return null}}static isVersionValid(s,e,t,n){if(!e||!s)return!0;let r=!0;const[a]=s.split(".");return e.startsWith(">=")?r=parseInt(a,10)>=parseInt(e.substring(2,10)):e.startsWith("<=")?r=parseInt(a,10)<=parseInt(e.substring(2,10)):e.startsWith(">")?r=parseInt(a,10)>parseInt(e.substring(1,10)):e.startsWith("<")?r=parseInt(a,10)<parseInt(e.substring(1,10)):e.startsWith("=")?r=parseInt(a,10)===parseInt(e.substring(1,10)):e.startsWith("==")?r=parseInt(a,10)===parseInt(e.substring(2,10)):e.startsWith("===")&&(r=parseInt(a,10)===parseInt(e.substring(3,10))),!0}findInLicenseManager(s){return ae(this,null,function*(){var n,r,a,o;const e=yield this.props.socket.getObject("system.licenses"),t=[];if((r=(n=e==null?void 0:e.native)==null?void 0:n.licenses)!=null&&r.length){let p=null;const O=Date.now();let U;if(this.props.schema.uuid){const q=yield this.props.socket.getObject("system.meta.uuid");U=(a=q==null?void 0:q.native)==null?void 0:a.uuid}let J;if(this.props.schema.version){const q=yield this.props.socket.getObject(`system.adapter.${s}`);J=(o=q==null?void 0:q.common)==null?void 0:o.version}e.native.licenses.forEach(q=>{const he=!q.validTill||q.validTill==="0000-00-00 00:00:00"||new Date(q.validTill).getTime()>O,Ee=(q.product||"").split("."),se=Ee[1]===s||s==="vis-2"&&Ee[1]==="vis",ye=!U||!q.uuid||q.uuid===U,de=_e.isVersionValid(J,q.version,q.invoice,s);(!p||q.invoice!=="free")&&he&&se&&ye&&de&&(p=q),t.push({id:q.id,validName:se,validUuid:ye,validVersion:de,validTill:he,license:q})}),p&&(t.find(q=>q.id===p.id).used=!0)}return t})}checkLicense(s,e){return ae(this,null,function*(){var o,p,O;let t;if(this.props.schema.uuid){const U=yield this.props.socket.getObject("system.meta.uuid");t=(o=U==null?void 0:U.native)==null?void 0:o.uuid}let n;if(this.props.schema.version){const U=yield this.props.socket.getObject(`system.adapter.${e}`);n=(p=U==null?void 0:U.common)==null?void 0:p.version}const r=new AbortController;let a=setTimeout(()=>{a=null,r.abort()},5e3);try{const U=yield window.fetch("https://iobroker.net/api/v1/public/cert/",{method:"POST",body:JSON.stringify({json:s,uuid:t}),headers:{"Content-Type":"text/plain"},signal:r.signal});a&&clearTimeout(a);const J=yield U.text();let q;try{q=JSON.parse(J)}catch(he){}if(q!=null&&q.error)try{const he=_e.parseJwt(s),Ee=c.I18n.t(`ra_${he.error||q.error||"Unknown error"}`).replace(/^ra_/,"");return this.setState({_error:Ee,licenseOfflineCheck:!1,showLicenseData:he,result:!1,running:!1})}catch(he){return console.log("Cannot parse license"),this.setState({_error:q.error,result:!1,running:!1})}else{let he=null;try{he=_e.parseJwt(s)}catch(Ee){}if(q){const Ee=q.validTill||q.valid_till;if(Ee&&Ee!=="0000-00-00 00:00:00"&&new Date(Ee).getTime()<Date.now())return this.setState({_error:c.I18n.t("ra_License expired on %s",new Date(Ee).toLocaleString()),licenseOfflineCheck:!1,showLicenseData:he,result:!1,running:!1});const se=(q.name||"").split(".");return se[1]===e||se[1]==="vis"&&e==="vis-2"?t&&!q.uuid&&e==="vis-2"?this.setState({_error:c.I18n.t("ra_License must be converted",q.uuid),showLinkToProfile:!0,licenseOfflineCheck:!1,showLicenseData:he,result:!1,running:!1}):t&&q.uuid&&q.uuid!==t?this.setState({_error:c.I18n.t('ra_Serial number (UUID) "%s" in license is for other device.',q.uuid),licenseOfflineCheck:!1,showLicenseData:he,result:!1,running:!1}):_e.isVersionValid(n,q.version,q.invoice,e)?this.setState({licenseOfflineCheck:!1,showLicenseData:he,result:!0,running:!1}):this.setState({_error:c.I18n.t("ra_License is for version %s, but required version is %s",q.version,this.props.schema.version),licenseOfflineCheck:!1,showLicenseData:he,result:!1,running:!1}):this.setState({_error:c.I18n.t('ra_License for other product "%s"',q.name),licenseOfflineCheck:!1,showLicenseData:he,result:!1,running:!1})}throw new Error("ra_Invalid answer from server")}}catch(U){if(((O=U==null?void 0:U.response)==null?void 0:O.status)===404)return this.setState({_error:c.I18n.t("ra_License does not exist"),result:!1,running:!1});try{const J=_e.parseJwt(s),q=(J.name||"").split(".");return J.valid_till&&J.valid_till!=="0000-00-00 00:00:00"&&new Date(J.valid_till).getTime()<Date.now()?this.setState({_error:c.I18n.t("ra_License expired on %s",new Date(J.valid_till).toLocaleString()),showLicenseData:J,licenseOfflineCheck:!0,running:!1,result:!1}):q[1]===e?t&&J.uuid&&J.uuid!==t?this.setState({_error:c.I18n.t('ra_Serial number (UUID) "%s" in license is for other device.',J.uuid),showLicenseData:J,licenseOfflineCheck:!0,result:!1,running:!1}):_e.isVersionValid(n,J.version,J.invoice,e)?this.setState({running:!1,result:!0,licenseOfflineCheck:!0,showLicenseData:J}):this.setState({_error:c.I18n.t("ra_License is for version %s, but required version is %s",J.version,this.props.schema.version),licenseOfflineCheck:!0,showLicenseData:J,result:!1,running:!1}):this.setState({_error:c.I18n.t('ra_License for other product "%s"',J.name),licenseOfflineCheck:!0,showLicenseData:J,result:!1,running:!1})}catch(J){return this.setState({_error:c.I18n.t("ra_Cannot decode license"),result:!1,licenseOfflineCheck:!0,running:!1})}}})}renderAskForUpdate(){return this.state.askForUpdate?i().createElement(c.Confirm,{text:c.I18n.t("ra_License not found in license manager. Do you want to read licenses from iobroker.net?"),ok:c.I18n.t("ra_Yes"),onClose:s=>ae(this,null,function*(){if(s){this.setState({askForUpdate:!1});try{yield this.props.socket.updateLicenses(null,null)}catch(e){window.alert(c.I18n.t("ra_Cannot read licenses: %s",e));return}yield this._onClick(!0)}else this.setState({askForUpdate:!1,running:!1})})}):null}_onClick(s){return ae(this,null,function*(){const e=this.props.adapterName==="vis-2"?"vis":this.props.adapterName;this.setState({running:!0});let t,n;if(this.props.data.useLicenseManager){if(n=yield this.findInLicenseManager(e),t=n.find(r=>r.used),t&&(t=t.license.json),!t&&!s){this.setState({askForUpdate:!0});return}}else t=this.props.data.license;t?yield this.checkLicense(t,e):this.props.data.useLicenseManager?this.setState({_error:c.I18n.t("ra_Suitable license not found in license manager"),result:!1,running:!1,allLicenses:n}):this.setState({_error:c.I18n.t("ra_Please enter the license"),result:!1,running:!1})})}renderItem(){return i().createElement("div",{style:j.fullWidth},i().createElement(l.Button,{variant:this.props.schema.variant||"outlined",color:this.props.schema.color||"primary",style:j.fullWidth,disabled:!this.props.data.license&&!this.props.data.useLicenseManager||this.state.running,startIcon:i().createElement(u.Send,null),onClick:()=>this._onClick()},this.state.running?i().createElement(l.CircularProgress,{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())}}const ge=_e;class ke extends m{renderItem(s,e){const t=m.getValue(this.props.data,this.props.attr),n=Array.isArray(t);return i().createElement(l.FormControl,{style:{width:"100%"},variant:"standard"},i().createElement(l.FormControlLabel,{onClick:r=>{r.preventDefault(),r.stopPropagation(),e||this.onChange(this.props.attr,!t)},control:i().createElement(l.Checkbox,{indeterminate:n,checked:!!t,onChange:r=>{n?this.onChange(this.props.attr,!0):this.onChange(this.props.attr,r.target.checked)},disabled:e}),label:this.getText(this.props.schema.label)}),i().createElement(l.FormHelperText,{style:{color:"red"}},s?this.props.schema.validatorErrorText?c.I18n.t(this.props.schema.validatorErrorText):c.I18n.t("ra_Error"):null),this.props.schema.help?i().createElement(l.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Ke=ke;var Te=G(23479),ht=G.n(Te),pt=G(98625),Dt=G(34603);const Ie={standard:l.Input,filled:pt.A,outlined:l.OutlinedInput},It=w=>{const s=w.palette.mode==="light",e=s?"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 ${w.palette.primary[s?"dark":"light"]}`,left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:w.transitions.create("transform",{duration:w.transitions.duration.shorter,easing:w.transitions.easing.easeOut}),pointerEvents:"none"},"&$focused:after":{transform:"scaleX(1)"},"&$error:after":{borderBottomColor:w.palette.error.main,transform:"scaleX(1)"},"&:before":{borderBottom:`1px solid ${e}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:w.transitions.create("border-bottom-color",{duration:w.transitions.duration.shorter}),pointerEvents:"none"},"&:hover:not($disabled):not($focused):not($error):before":{borderBottom:`2px solid ${w.palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${e}`}},"&$disabled:before":{borderBottomStyle:"dotted"}},error:{"&:after":{backgroundColor:w.palette.error.main,transform:"scaleX(1)"}},chip:{margin:"0 8px 8px 0",float:"left"},marginDense:{}}},Ne={BACKSPACE:8,DELETE:46,LEFT_ARROW:37,RIGHT_ARROW:39},Ye=({value:w,isFocused:s,isDisabled:e,isReadOnly:t,handleClick:n,handleDelete:r,style:a},o)=>i().createElement(l.Chip,{key:o,style:$e(Y({},a),{pointerEvents:e||t?"none":void 0,backgroundColor:s?Dt.A[300]:void 0}),onClick:n,onDelete:r,label:w});class xt extends i().Component{constructor(e){super(e);X(this,"labelRef");X(this,"labelNode",null);X(this,"input");X(this,"newChipKeyCodes");X(this,"newChipKeys");X(this,"actualInput",null);X(this,"inputBlurTimeout",null);X(this,"_keyPressed");X(this,"_preventChipCreation");X(this,"styles",{});X(this,"styleTheme",null);X(this,"focus",()=>{var e;(e=this.actualInput)==null||e.focus(),this.state.focusedChip&&this.setState({focusedChip:null})});X(this,"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 n;switch(this.props.blurBehavior||"clear"){case"add-or-clear":n={clearInputOnFail:!0};case"add":if(this.props.delayBeforeAdd){const r=(this.props.value||this.state.chips).length;this.inputBlurTimeout=setTimeout(()=>{const a=(this.props.value||this.state.chips).length;r===a?this.handleAddChip(t,n):this.clearInput()},150)}else this.handleAddChip(t,n);break;case"clear":this.clearInput();break;default:break}});X(this,"handleInputFocus",e=>{this.setState({isFocused:!0}),this.props.onFocus&&this.props.onFocus(e)});X(this,"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 n=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 Ne.BACKSPACE:e.target.value===""&&(t?(this.handleDeleteChip(n[t],t),t&&this.setState({focusedChip:t-1})):this.setState({focusedChip:n.length-1}));break;case Ne.DELETE:e.target.value===""&&t&&(this.handleDeleteChip(n[t],t),t<=n.length-1&&this.setState({focusedChip:t}));break;case Ne.LEFT_ARROW:t===null&&e.target.value===""&&n.length?this.setState({focusedChip:n.length-1}):t!==null&&t>0&&this.setState({focusedChip:t-1});break;case Ne.RIGHT_ARROW:t!==null&&t<n.length-1?this.setState({focusedChip:t+1}):this.setState({focusedChip:null});break;default:this.setState({focusedChip:null});break}});X(this,"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)});X(this,"handleUpdateInput",e=>{(this.props.inputValue===null||this.props.inputValue===void 0)&&this.updateInput(e.target.value),this.props.onUpdateInput&&this.props.onUpdateInput(e)});X(this,"setActualInputRef",e=>{this.actualInput=e,this.props.inputRef&&this.props.inputRef(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=i().createRef(),this.input=i().createRef()}componentDidMount(){this.state.variant==="outlined"&&(this.labelNode=ht().findDOMNode(this.labelRef.current),this.forceUpdate())}componentWillUnmount(){this.inputBlurTimeout&&clearTimeout(this.inputBlurTimeout)}static getDerivedStateFromProps(e,t){let n=null;return e.value&&e.value.length!==t.prevPropsValue.length&&(n={prevPropsValue:e.value},e.clearInputValueOnChange&&(n.inputValue="")),e.clearInputValueOnChange&&e.value&&e.value.length!==t.prevPropsValue.length&&(n={prevPropsValue:e.value,inputValue:""}),e.disabled&&(n=$e(Y({},n),{focusedChip:null})),!t.chipsUpdated&&e.defaultValue&&(n=$e(Y({},n),{chips:e.defaultValue})),n}handleAddChip(e,t){if(this.props.onBeforeAdd&&!this.props.onBeforeAdd(e))return this._preventChipCreation=!0,t&&t.clearInputOnFail&&this.clearInput(),!1;this.clearInput();const n=this.props.value||this.state.chips;return e.trim().length?((this.props.allowDuplicates||!n.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 n=this.state.chips.slice();if(n.splice(t,1)){let a=this.state.focusedChip;this.state.focusedChip===t?a=null:this.state.focusedChip>t&&(a=this.state.focusedChip-1),this.updateChips(n,{focusedChip:a})}}}updateChips(e,t={}){this.setState(Y({chips:e,chipsUpdated:!0},t)),this.props.onChange&&this.props.onChange(e)}clearInput(){this.updateInput("")}updateInput(e){this.setState({inputValue:e})}render(){const{alwaysShowPlaceholder:e,chipRenderer:t=Ye,className:n,disabled:r,disableUnderline:a,error:o,FormHelperTextProps:p,fullWidth:O,fullWidthInput:U,helperText:J,id:q,InputProps:he={},InputLabelProps:Ee={},inputValue:se,label:ye,placeholder:de,readOnly:qe,required:Pt,rootRef:jt,value:Dn,margin:On}=this.props,ct=this.state.variant;this.styleTheme!==this.props.theme.palette.mode&&(this.styleTheme=this.props.theme.palette.mode,this.styles=te.getStyle(this.props.theme,It));let Tt=Dn||this.state.chips||[];Array.isArray(Tt)||(Tt=(Tt||"").toString().split(/[,\s]+/).map(Kt=>Kt.trim()));const vn=se!=null?se:this.state.inputValue,Nn=(this.props.value||vn).length||vn.length,Ht=typeof Ee.shrink=="boolean"?Ee.shrink:ye!==null&&(Nn||this.state.isFocused||Tt.length),Ln=Tt.map((Kt,Gt)=>t({value:Kt,isDisabled:!!r,isReadOnly:qe,isFocused:this.state.focusedChip===Gt,handleClick:()=>this.setState({focusedChip:Gt}),handleDelete:()=>this.handleDeleteChip(Kt,Gt),style:this.styles.chip},Gt.toString())),zt={};ct==="outlined"&&(zt.notched=!!Ht,zt.labelWidth=Ht&&this.labelNode&&this.labelNode.offsetWidth||0),ct!=="standard"?zt.startAdornment=Ln:he.disableUnderline=!0;const js=Ie[ct];return i().createElement(l.FormControl,{ref:jt,fullWidth:O,className:n,sx:Y(Y({},this.styles.root),On==="dense"?this.styles.marginDense:{}),error:o,required:Tt.length>0?void 0:Pt,onClick:this.focus,disabled:r,variant:ct,component:"div",margin:On},ye&&i().createElement(l.InputLabel,Y({htmlFor:q,sx:{"&.MuiInputLabel-root":this.styles.label,"&.MuiInputLabel-shrink":this.styles.labelShrink},shrink:!!Ht,focused:this.state.isFocused,variant:ct,ref:this.labelRef,required:Pt,component:"label"},Ee),ye),i().createElement(l.Box,{component:"div",id:"input-chip-container",sx:Y(Y(Y(Y(Y(Y(Y({},this.styles[ct]),this.styles.chipContainer),this.state.isFocused?this.styles.focused:void 0),!a&&ct==="standard"?this.styles.underline:void 0),r?this.styles.disabled:void 0),ye?this.styles.labeled:void 0),o?this.styles.error:void 0)},ct==="standard"&&Ln,i().createElement(js,Y(Y({ref:this.input,className:`mui-variant-${this.styles[ct]} ${ye?"mui-chip-with-label":"mui-chip-no-label"}`,sx:{"&.MuiInputBase-input":Y(Y({},this.styles.input),this.styles[ct]),"&.MuiInputBase-root":Y({},this.styles.inputRoot)},id:q,value:vn,onChange:this.handleUpdateInput,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onFocus:this.handleInputFocus,onBlur:this.handleInputBlur,inputRef:this.setActualInputRef,disabled:r,fullWidth:U,placeholder:!Nn&&(Ht||ye===null||ye===void 0)||e?de:null,readOnly:qe},he),zt))),J&&i().createElement(l.FormHelperText,$e(Y({},p),{className:p==null?void 0:p.className,style:this.styles.helperText}),J))}}const st=xt;class Ue extends m{componentDidMount(){super.componentDidMount();const{data:s,attr:e}=this.props,t=m.getValue(s,e);if(this.props.schema.delimiter&&typeof t=="string"){const n=t.split(this.props.schema.delimiter).map(r=>r.trim()).filter(r=>r);this.setState({value:n})}else this.setState({value:t||[]})}renderItem(s,e){const{attr:t,schema:n}=this.props,{value:r}=this.state;return i().createElement(l.FormControl,{fullWidth:!0,variant:"standard"},i().createElement(st,{value:r,disabled:!!e,label:this.getText(n.label),error:!!s,onAdd:a=>{const o=JSON.parse(JSON.stringify(r));o.push(a),this.setState({value:o},()=>{this.props.schema.delimiter?this.onChange(t,o.join(`${this.props.schema.delimiter} `)):this.onChange(t,o)})},theme:this.props.theme,onDelete:(a,o)=>{const p=JSON.parse(JSON.stringify(r));p.splice(o,1),this.setState({value:p},()=>{this.props.schema.delimiter?this.onChange(t,p.join(`${this.props.schema.delimiter} `)):this.onChange(t,p)})}}),this.props.schema.help?i().createElement(l.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Be=Ue;var _t=G(55385);class vt extends m{renderColorDialog(){return!!this.state.showColorDialog&&i().createElement(l.Dialog,{onClose:()=>this.setState({showColorDialog:!1}),open:this.state.showColorDialog},i().createElement(_t.ChromePicker,{color:this.state.colorDialogValue,onChange:s=>this.setState({colorDialogValue:s.hex},()=>this.onChange(this.props.attr,this.state.colorDialogValue))}))}renderItem(s,e){const t=m.getValue(this.props.data,this.props.attr);let n=c.Utils.isUseBright(t,null);return n===null&&(n=void 0),i().createElement(i().Fragment,null,this.renderColorDialog(),i().createElement(l.TextField,{variant:"standard",disabled:!!e,style:{minWidth:100,width:"calc(100% - 8px)"},label:this.getText(this.props.schema.label),value:t||"",onClick:()=>!this.props.schema.readOnly&&this.setState({showColorDialog:!0,colorDialogValue:t||""}),onChange:r=>{const a=r.target.value;this.onChange(this.props.attr,a)},inputProps:{style:{backgroundColor:t,color:n?"#FFF":"#000"},readOnly:this.props.schema.readOnly||!1},InputProps:{endAdornment:t&&!this.props.schema.noClearButton?i().createElement(l.IconButton,{size:"small",onClick:r=>{r.stopPropagation(),this.onChange(this.props.attr,"")}},i().createElement(u.Close,null)):void 0},InputLabelProps:{shrink:!0}}))}}const qt=vt,Ct={width:{width:"calc(100% - 85px)"},width50:{width:120,marginRight:5}};class fe extends m{componentDidMount(){super.componentDidMount();const s=m.getValue(this.props.data,this.props.attr);this.setState({value:s});const e={};this.props.schema.useSystemName&&(e.useSystem=!!m.getValue(this.props.data,this.props.schema.useSystemName)),this.props.schema.longitudeName&&this.props.schema.latitudeName?(e.longitude=m.getValue(this.props.data,this.props.schema.longitudeName),e.latitude=m.getValue(this.props.data,this.props.schema.latitudeName),!e.longitude&&!e.latitude&&this.props.schema.autoInit&&setTimeout(()=>this.getCoordinates(),300)):!m.getValue(this.props.data,this.props.attr)&&this.props.schema.autoInit&&setTimeout(()=>this.getCoordinates(),300),Object.keys(e).length&&setTimeout(()=>this.setState(e),50)}getSystemCoordinates(){return ae(this,null,function*(){const s=yield this.props.socket.getCompactSystemConfig();if(s!=null&&s.common&&(s.common.longitude||s.common.latitude))if(window.alert(c.I18n.t("ra_Used system settings")),this.props.schema.longitudeName&&this.props.schema.latitudeName)this.setState({longitude:s.common.longitude,latitude:s.common.latitude},()=>ae(this,null,function*(){yield this.onChange(this.props.schema.longitudeName,s.common.longitude),yield this.onChange(this.props.schema.latitudeName,s.common.latitude)}));else{const e=s.common.latitude+(this.props.schema.divider||",")+s.common.longitude;this.setState({value:e},()=>{this.onChange(this.props.attr,e)})}else window.alert(c.I18n.t("ra_Cannot determine position: System settings are empty and GPS detection is disabled in browser"))})}getCoordinates(){navigator.geolocation?navigator.geolocation.getCurrentPosition(s=>{if(s!=null&&s.coords)if(this.props.schema.longitudeName&&this.props.schema.latitudeName)this.setState({longitude:s.coords.longitude,latitude:s.coords.latitude},()=>ae(this,null,function*(){yield this.onChange(this.props.schema.longitudeName,s.coords.longitude||""),yield this.onChange(this.props.schema.latitudeName,s.coords.latitude||"")}));else{const e=s.coords.latitude+(this.props.schema.divider||",")+s.coords.longitude;this.setState({value:e},()=>{this.onChange(this.props.attr,e)})}else this.getSystemCoordinates()},s=>{console.error(`Cannot determine coordinates from browser: ${s}`),this.getSystemCoordinates()}):this.getSystemCoordinates()}renderItem(s,e){var t,n;return i().createElement(i().Fragment,null,this.props.schema.useSystemName?i().createElement(l.FormControlLabel,{control:i().createElement(l.Checkbox,{checked:!!this.state.useSystem,onChange:r=>{const a=r.target.checked;a&&this.getSystemCoordinates(),this.setState({useSystem:a},()=>this.onChange(this.props.schema.useSystemName,a))}}),label:c.I18n.t("ra_Use system settings for position")}):null,this.props.schema.longitudeName&&this.props.schema.latitudeName?i().createElement(l.TextField,{variant:"standard",style:Ct.width50,value:(t=this.state.longitude)!=null?t:"",error:!!s,disabled:this.state.useSystem||!!e,onChange:r=>{const a=r.target.value;this.setState({longitude:a},()=>{this.onChange(this.props.schema.longitudeName,(a||"").trim())})},label:c.I18n.t("ra_Longitude")}):null,this.props.schema.longitudeName&&this.props.schema.latitudeName?i().createElement(l.TextField,{variant:"standard",style:Ct.width50,value:(n=this.state.latitude)!=null?n:"",error:!!s,disabled:this.state.useSystem||!!e,onChange:r=>{const a=r.target.value;this.setState({latitude:a},()=>this.onChange(this.props.schema.latitudeName,(a||"").trim()))},label:c.I18n.t("ra_Latitude")}):null,!this.props.schema.longitudeName||!this.props.schema.latitudeName?i().createElement(l.TextField,{variant:"standard",style:Ct.width,value:this.state.value===null||this.state.value===void 0?"":this.state.value,error:!!s,disabled:!!e,inputProps:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0,readOnly:this.state.useSystem},onChange:r=>{const a=r.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)}):null,this.state.useSystem?null:i().createElement(l.Fab,{size:"small",onClick:()=>this.getCoordinates(),title:c.I18n.t("ra_Take browser position"),style:{marginRight:4}},i().createElement(u.LocationOn,null)),this.state.useSystem?null:i().createElement(l.Fab,{size:"small",onClick:()=>this.getSystemCoordinates(),title:c.I18n.t("ra_Take position from system settings")},i().createElement(u.GpsFixed,null)))}}const pe=fe,yt=(w,s,e)=>new Promise((t,n)=>{if(window[w])t(window[w]);else{const r=document.querySelector(`script[data-webpack="${w}"]`),a=()=>ae(this,null,function*(){if(window[w])window[w].__initialized||(yield window[w].init(G.S[s]),window[w].__initialized=!0);else{console.error(`Cannot load ${w}`),n(new Error(`Cannot load ${w}`));return}t(window[w])});if(r)r.onload=a,r.onerror=n;else if(e){const o=document,p=o.createElement("script");p.type="text/javascript",p.setAttribute("data-webpack",`${w}`),p.async=!0,p.onerror=n,p.onload=a,p.src=e,o.getElementsByTagName("head")[0].appendChild(p)}else n(new Error(`Cannot Find Remote ${w} to inject`))}});function Xe(w,s,e,t){return()=>ae(this,null,function*(){return(yield(yield yt(w,s,t)).get(e))()})}const $t=class $t extends m{constructor(s){super(s),Object.assign(this.state,{Component:null,error:""})}componentDidMount(){return ae(this,null,function*(){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 s;this.props.schema.url.startsWith("./")?s=`${window.location.protocol}//${window.location.host}${this.props.schema.url.replace(/^\./,"")}`:s=`${window.location.protocol}//${window.location.host}/adapter/${this.props.adapterName}/${this.props.schema.url}`;const[e,t,...n]=this.props.schema.name.split("/"),r=n.join("/");if(!s){console.error('Cannot find URL for custom component! Please define "url" as "custom/customComponents.js" in the schema');return}if(!e||!t||!r){console.error('Invalid format of "name"! Please define "name" as "ConfigCustomBackItUpSet/Components/AdapterExist" in the schema');return}let a=$t.runningLoads[`${s}!${t}`];if(!a){let o;if(this.props.schema.i18n===!0){const p=s.lastIndexOf("/");let O;p!==-1?O=s.substring(0,p):O=s;const U=c.I18n.getLanguage(),J=`${O}/i18n/${U}.json`;o=fetch(J).then(q=>q.json()).then(q=>c.I18n.extendTranslations(q,U)).catch(q=>{if(U!=="en"){fetch(`${O}/i18n/en.json`).then(he=>he.json()).then(he=>c.I18n.extendTranslations(he,U)).catch(he=>console.log(`Cannot load i18n "${J}": ${he}`));return}console.log(`Cannot load i18n "${J}": ${q}`)})}else if(this.props.schema.i18n&&typeof this.props.schema.i18n=="object")try{c.I18n.extendTranslations(this.props.schema.i18n)}catch(p){console.error(`Cannot import i18n: ${p}`)}try{console.log(e,t,r),a=Xe(e,"default",`./${t}`,s)(),o&&(a=Promise.all([a,o]).then(p=>p[0])),$t.runningLoads[`${s}!${t}`]=a}catch(p){this.setState({error:`Cannot import from ${this.props.schema.url}: ${p}`})}}try{const o=(yield a).default;if(o!=null&&o[r])this.setState({Component:o[r]});else{const p=Object.keys(o||{});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: ${p.join(", ")}`})}}catch(o){this.setState({error:`Cannot import from ${this.props.schema.url}: ${o}`})}})}render(){const s=this.state.Component;if(!s){const e=this.props.schema||{},t=i().createElement(l.Grid2,{size:{xs:e.xs||void 0,lg:e.lg||void 0,md:e.md||void 0,sm:e.sm||void 0},style:Y(Y({marginBottom:0,textAlign:"left"},e.style),this.props.themeType==="dark"?e.darkStyle:{})},this.state.error?i().createElement("div",null,this.state.error):i().createElement(l.LinearProgress,null));return e.newLine?i().createElement(i().Fragment,null,i().createElement("div",{style:{flexBasis:"100%",height:0}}),t):t}return i().createElement(s,Y({},this.props))}};X($t,"runningLoads",{});let De=$t;var Rt=G(28497);class Ze extends m{componentDidMount(){super.componentDidMount();const s=m.getValue(this.props.data,this.props.attr);this.setState({value:s})}renderItem(s,e){return i().createElement(Rt.DatePicker,{sx:t=>({width:"100%",borderBottom:`1px solid ${t.palette.text.primary}`,"& fieldset":{display:"none"},"& input":{padding:`${t.spacing(1.5)} 0 4px 0`},"& .MuiInputAdornment-root":{marginLeft:0,marginTop:1},"& label":{transform:"translate(0px, -9px) scale(0.75)"}}),format:this.props.systemConfig.dateFormat.toLowerCase().replace("mm","MM"),disabled:!!e,value:this.state.value,onChange:t=>{this.setState({value:t},()=>this.onChange(this.props.attr,this.state.value))},label:this.getText(this.props.schema.label)})}}class V extends m{renderItem(){if(!this.props.schema)return null;if(this.props.DeviceManager){const e=this.props.DeviceManager;return i().createElement(e,{uploadImagesToInstance:`${this.props.adapterName}.${this.props.instance}`,title:this.getText(this.props.schema.label),socket:this.props.socket,selectedInstance:`${this.props.adapterName}.${this.props.instance}`,themeName:this.props.themeName,themeType:this.props.themeType,isFloatComma:this.props.isFloatComma,dateFormat:this.props.dateFormat})}return i().createElement("div",null,"DeviceManager not found")}}const Mt=V;var xe=G(53683),it=G.n(xe),Yt=G(86215);const Je={fullWidth:{width:"100%"},fullWidthOneButton:{width:"calc(100% - 42px)"},fullWidthTwoButtons:{width:"calc(100% - 84px)"},fullWidthThreeButtons:{width:"calc(100% - 126x)"},dropZone:{width:"100%",height:"100%",position:"absolute"},dropZoneEmpty:{},image:{objectFit:"contain",margin:"auto",display:"flex",width:"100%",height:"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}},kt=["jpg","jpeg","svg","png","webp","gif","apng","avif","webp"],Xt=["mp3","ogg","wav","aac"],Bt=["avi","mp4","mov"],wt=["txt","log","html","htm"],we=["json","js","ts"];class Qe extends m{constructor(e){super(e);X(this,"dropzoneRef");X(this,"imagePrefix");X(this,"objectID");X(this,"path");this.dropzoneRef=i().createRef(),this.imagePrefix=this.props.imagePrefix===void 0?"./files":this.props.imagePrefix}componentDidMount(){super.componentDidMount(),this.objectID=(this.props.schema.objectID||"0_userdata.0").replace("%INSTANCE%",(this.props.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=m.getValue(this.props.data,this.props.attr);this.setState({value:e})})}updateFiles(){return this.readFiles(this.props.schema.pattern).then(e=>this.setState({files:e}))}readFolder(e,t,n){return ae(this,null,function*(){try{const r=yield this.props.socket.readDir(this.objectID,e.replace(/^\//,"")||null);for(let a=0;a<r.length;a++){const o=r[a];if(o.isDir)yield this.readFolder(`${e+o.file}/`,t,n);else{let p=!1;n==="*.*"&&o.file.includes(".")||!n||n==="*"||n===".*"&&o.file.startsWith(".")?p=!0:p=new RegExp(`^${n.replace(/\./g,"\\.").replace(/\*/g,".*")}$`).test(o.file),p&&t.push({name:e+o.file,size:o.stats?c.Utils.formatBytes(o.stats.size):"--"})}}}catch(r){console.error(`Cannot read "${e}": ${r}`)}return t})}readFiles(e){return ae(this,null,function*(){const t=[];e=e||this.props.schema.pattern,e||(e="**/*.*");let n;const r=e.lastIndexOf("/");if(r===-1?n=e:n=e.substring(r+1),e.startsWith("**"))yield this.readFolder("/",t,n);else{const a=e.lastIndexOf("/");if(a===-1)yield this.readFolder("/",t,n);else{const o=e.substring(0,a+1);yield this.readFolder(o,t,n)}}return t})}onDrop(e){const t=e[0],n=new FileReader,r=this.props.schema.maxSize||2*1024*1024;n.onabort=()=>console.log("file reading was aborted"),n.onerror=()=>console.log("file reading has failed"),n.onload=()=>{let a=`image/${t.name.split(".").pop().toLowerCase()}`;if(a==="image/jpg"?a="image/jpeg":a.includes("svg")&&(a="image/svg+xml"),t.size>r){window.alert(c.I18n.t("File is too big. Max %sk allowed. Try use SVG.",Math.round(r/1024)));return}const o=`data:${a};base64,${btoa(new Uint8Array(n.result).reduce((p,O)=>p+String.fromCharCode(O),""))}`;this.props.socket.writeFile64(this.objectID,this.path+t.name,o).then(()=>this.updateFiles()).catch(p=>window.alert(`Cannot upload file: ${p}`))},n.readAsArrayBuffer(t)}renderDeleteDialog(){return this.state.deleteFile?i().createElement(c.Confirm,{title:c.I18n.t("ra_Are you sure?"),text:c.I18n.t("ra_File will be deleted"),ok:c.I18n.t("ra_Delete"),cancel:c.I18n.t("ra_Cancel"),onClose:e=>{const t=this.state.deleteFile;this.setState({deleteFile:""},()=>{e&&this.props.socket.deleteFile(this.objectID,t).then(()=>this.updateFiles()).catch(n=>window.alert(`Cannot delete file: ${n}`))})}}):null}static base64ToArrayBuffer(e){const t=window.atob(e),n=t.length,r=new Uint8Array(n);for(let a=0;a<n;a++)r[a]=t.charCodeAt(a);return r.buffer}loadFile(){return this.props.socket.readFile(this.objectID,this.state.value,!0)}play(){this.loadFile().then(e=>{if(typeof AudioContext!="undefined"){const t=new AudioContext,n=Qe.base64ToArrayBuffer(e.file);t.decodeAudioData(n,r=>{const a=t.createBufferSource();a.buffer=r,a.connect(t.destination),a.start(0)},r=>window.alert(`Cannot play: ${r}`))}})}getFileIcon(e){return e!=null&&e.extension?kt.includes(e.extension)?i().createElement("div",{style:$e(Y({},Je.selectedImage),{backgroundImage:`url(${this.imagePrefix}/${this.objectID}/${e.value})`,backgroundSize:"contain",backgroundRepeat:"no-repeat"})}):Xt.includes(e.extension)?i().createElement(u.MusicNote,null):wt.includes(e.extension)?i().createElement(u.Article,null):Bt.includes(e.extension)?i().createElement(u.Videocam,null):we.includes(e.extension)?i().createElement(u.Code,null):null:null}renderItem(e,t){if(!this.state.files)return null;const n=[];this.props.schema.withFolder||this.state.files.forEach(J=>{const q=J.name.lastIndexOf("/");if(q===-1)n.includes("/")||n.push("/");else{const he=J.name.substring(0,q+1);n.includes(he)||n.push(he)}});const r=this.state.files.map(J=>({value:J.name,label:!this.props.schema.withFolder&&n.length===1?`${J.name.substring(n[0].length)}`:`${J.name}${this.props.schema.noSize?"":`(${J.size})`}`,extension:J.name.toLowerCase().split(".").pop()}));this.props.schema.noNone||r.unshift({label:c.I18n.t("ra_none"),value:""});const a=r.find(J=>J.value===this.state.value);let o=0;this.props.schema.upload&&o++,this.props.schema.refresh&&o++;const p=this.state.value&&(this.state.value.endsWith(".mp3")||this.state.value.endsWith(".ogg")||this.state.value.endsWith(".wav"));p&&o++;const O=i().createElement("div",{style:Je.fullWidth},i().createElement(l.FormControl,{variant:"standard",style:{width:`calc(100% - ${o*42}px)`}},this.props.schema.label?i().createElement(l.InputLabel,null,this.getText(this.props.schema.label)):null,i().createElement(l.Select,{variant:"standard",error:!!e,disabled:!!t,value:this.state.value||"_",renderValue:()=>i().createElement(i().Fragment,null,this.getFileIcon(a),i().createElement("span",null,(a==null?void 0:a.label)||"")),onChange:J=>{this.setState({value:J.target.value==="_"?"":J.target.value},()=>this.onChange(this.props.attr,this.state.value))}},r.map(J=>i().createElement(l.MenuItem,{key:J.value,value:J.value},i().createElement(l.ListItemIcon,null,this.getFileIcon(J)),i().createElement(l.ListItemText,null,J.label),this.props.schema.delete&&a.value?i().createElement(l.IconButton,{style:Je.deleteButton,size:"small",onClick:()=>this.setState({deleteFile:a.value})},i().createElement(u.Delete,null)):null))),this.props.schema.help?i().createElement(l.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null),this.props.schema.refresh&&i().createElement(l.IconButton,{onClick:()=>this.updateFiles()},i().createElement(u.Refresh,null)),this.props.schema.upload&&i().createElement(l.IconButton,{onClick:()=>{var J;return(J=this.dropzoneRef.current)==null?void 0:J.open()}},i().createElement(u.UploadFile,null)),p&&i().createElement(l.IconButton,{style:{color:"#00FF00"},onClick:()=>this.play()},i().createElement(u.PlayArrow,null)));if(!this.props.schema.upload)return i().createElement(i().Fragment,null,O,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 J=this.props.schema.pattern.split("/").pop().toLowerCase().replace(/.*\./,"");J==="png"||J==="jpg"||J==="svg"||J==="gif"||J==="apng"||J==="avif"||J==="webp"?U={"image/*":[".png",".jpg",".svg",".gif",".apng",".avif",".webp"]}:J==="mp3"||J==="ogg"||J==="wav"?U={"audio/*":[".mp3",".ogg",".wav",".mp4"]}:J==="ics"?U={"text/calendar":[".ics"]}:J==="txt"?U={"text/plain":[".txt"]}:J==="pem"?U={"text/plain":[".pem"]}:U={"*/*":[`.${J}`]}}return i().createElement(it(),{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:(J,q)=>{this.setState({uploadFile:!1}),J.length?this.onDrop(J):window.alert(q&&q[0]&&q[0].errors&&q[0].errors[0]&&q[0].errors[0].message||c.I18n.t("Cannot upload"))}},({getRootProps:J,getInputProps:q})=>i().createElement("div",Y({style:Y(Y(Y({},Je.uploadDiv),this.state.uploadFile==="dragging"?Je.uploadDivDragging:void 0),t?Je.disabledOpacity:void 0)},J()),i().createElement("input",Y({},q())),this.state.uploadFile==="dragging"?i().createElement("div",{style:Y(Y({},Je.uploadCenterDiv),this.state.uploadError?Je.error:void 0)},i().createElement("div",{style:Je.uploadCenterTextAndIcon},i().createElement(Yt.l1U,{style:Je.uploadCenterIcon}),i().createElement("div",{style:Je.uploadCenterText},this.state.uploadFile==="dragging"?c.I18n.t("ra_Drop file here"):c.I18n.t("ra_Place your files here or click here to open the browse dialog")))):null,O,this.renderDeleteDialog()))}}const Ot=Qe,Ft={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}},Vt=["jpg","jpeg","svg","png","webp","gif","apng","avif","webp"],At=["mp3","ogg","wav","aac"],Zt=["avi","mp4","mov"],Qt=["txt","log","html","htm"],en=["json","js","ts"];class tn extends m{constructor(){super(...arguments);X(this,"imagePrefix","../..")}componentDidMount(){super.componentDidMount();const e=m.getValue(this.props.data,this.props.attr);this.imagePrefix=this.props.imagePrefix===void 0?"./files":this.props.imagePrefix,this.setState({value:e!=null?e:""})}static getDerivedStateFromProps(e,t){const n=m.getValue(e.data,e.attr);return n==null||n.toString().trim()!==(t.value||"").toString().trim()?{value:n!=null?n:""}:null}loadFile(){const e=this.state.value.indexOf("/");if(e!==-1){const t=this.state.value.substring(0,e),n=this.state.value.substring(e+1);return this.props.socket.readFile(t,n,!0)}return Promise.resolve(null)}play(){this.loadFile().then(e=>{if(typeof AudioContext!="undefined"&&(e!=null&&e.file)){const t=new AudioContext,n=Ot.base64ToArrayBuffer(e.file);t.decodeAudioData(n,r=>{const a=t.createBufferSource();a.buffer=r,a.connect(t.destination),a.start(0)},r=>window.alert(`Cannot play: ${r}`))}})}getIcon(){const e=this.state.value.split(".").pop().toLowerCase();return Vt.includes(e)?i().createElement("div",{style:$e(Y({},Ft.selectedImage),{backgroundImage:`url(${this.imagePrefix}/${this.state.value})`,backgroundSize:"contain",backgroundRepeat:"no-repeat"})}):At.includes(e)?i().createElement(l.IconButton,{style:{color:"#00FF00"},onClick:()=>this.play()},i().createElement(u.PlayArrow,null)):Qt.includes(e)?i().createElement(u.Article,null):Zt.includes(e)?i().createElement(u.Videocam,null):en.includes(e)?i().createElement(u.Code,null):null}renderFileBrowser(){return this.state.showFileBrowser?i().createElement(c.SelectFile,{imagePrefix:this.props.imagePrefix,socket:this.props.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.theme}):null}renderItem(e,t){const n=this.getIcon();return i().createElement("div",{style:Ft.fullWidth},n,i().createElement(l.TextField,{variant:"standard",style:n?Ft.fullWidthIcon:Ft.fullWidthOneButton,value:this.state.value===null||this.state.value===void 0?"":this.state.value,error:!!e,disabled:!!t,inputProps:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0,readOnly:!!this.props.schema.disableEdit},onChange:r=>{const a=r.target.value;this.setState({value:a},()=>this.onChange(this.props.attr,this.props.schema.trim===!1?a:(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)}),i().createElement(l.Button,{variant:"outlined",onClick:()=>this.setState({showFileBrowser:!0})},"..."),this.renderFileBrowser())}}const F=tn;class N extends m{componentDidMount(){super.componentDidMount();const s=m.getValue(this.props.data,this.props.attr);this.props.socket.getEnums("functions").then(e=>{const t=Object.keys(e).map(n=>({value:this.props.schema.short?n.replace("enum.functions.",""):n,label:this.getText(e[n].common.name),obj:e[n]}));this.props.schema.allowDeactivate!==!1&&t.unshift({label:c.I18n.t(m.NONE_LABEL),value:m.NONE_VALUE}),this.setState({value:s,selectOptions:t})})}renderItem(s,e){if(!this.state.selectOptions)return null;const t=this.state.selectOptions.find(n=>n.value===this.state.value);return i().createElement(l.FormControl,{variant:"standard",fullWidth:!0},this.props.schema.label?i().createElement(l.InputLabel,null,this.getText(this.props.schema.label)):null,i().createElement(l.Select,{variant:"standard",error:!!s,disabled:!!e,value:this.state.value||"_",renderValue:()=>t?t.obj?i().createElement(c.TextWithIcon,{value:t.obj,themeType:this.props.themeType,lang:c.I18n.getLanguage()}):t.label:"",onChange:n=>{this.setState({value:n.target.value==="_"?"":n.target.value},()=>this.onChange(this.props.attr,this.state.value))}},this.state.selectOptions.map(n=>i().createElement(l.MenuItem,{key:n.value,value:n.value,style:n.value===m.DIFFERENT_VALUE?{opacity:.5}:{}},n.obj?i().createElement(c.TextWithIcon,{value:n.obj,themeType:this.props.themeType,lang:c.I18n.getLanguage()}):n.label))),this.props.schema.help?i().createElement(l.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const ie=N;class ne extends m{componentDidMount(){super.componentDidMount(),this.props.socket.getHostByIp(this.props.common.host).then(s=>{this.props.schema.listenOnAllPorts||(s=s.filter(e=>e.address!=="0.0.0.0"&&e.address!=="::")),this.props.schema.onlyIp4?s=s.filter(e=>e.family==="ipv4"):this.props.schema.onlyIp6&&(s=s.filter(e=>e.family==="ipv6")),this.props.schema.noInternal&&(s=s.filter(e=>!e.internal)),s.forEach(e=>{e.address==="0.0.0.0"?e.name=`[IPv4] 0.0.0.0 - ${c.I18n.t("ra_Listen on all IPs")}`:e.address==="::"&&(e.name=`[IPv6] :: - ${c.I18n.t("ra_Listen on all IPs")}`)}),this.setState({ips:s})})}renderItem(s,e){var r,a;const t=m.getValue(this.props.data,this.props.attr),n=(r=this.state.ips)==null?void 0:r.find(o=>o.address===t);return i().createElement(l.FormControl,{fullWidth:!0,variant:"standard"},this.state.ips&&this.props.schema.label?i().createElement(l.InputLabel,null,this.getText(this.props.schema.label)):null,this.state.ips?i().createElement(l.Select,{variant:"standard",error:!!s,disabled:!!e,value:t,renderValue:o=>(n==null?void 0:n.name)||o,onChange:o=>this.onChange(this.props.attr,o.target.value)},(a=this.state.ips)==null?void 0:a.map((o,p)=>i().createElement(l.MenuItem,{key:p,value:o.address},o.name))):i().createElement(l.TextField,{fullWidth:!0,variant:"standard",error:!!s,disabled:!!e,value:t,onChange:o=>this.onChange(this.props.attr,o.target.value),label:this.getText(this.props.schema.label)}),this.props.schema.help?i().createElement(l.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const ue=ne;class ve extends m{constructor(){super(...arguments);X(this,"initialized",!1);X(this,"_context")}componentDidMount(){super.componentDidMount(),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);if(t)try{e=JSON.parse(t)}catch(n){console.error(`Cannot parse json data: ${e}`)}}e===void 0&&(e=null),this.props.socket.sendTo(`${this.props.adapterName}.${this.props.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]=m.getValue(this.props.data,t)),JSON.stringify(e)}renderItem(){if(this.props.alive){const e=this.getContext();(e!==this._context||!this.initialized)&&(this._context=e,setTimeout(()=>this.askInstance(),this.initialized?300:50),this.initialized=!0)}return this.state.image===void 0?null:i().createElement("img",{alt:"dynamic content",src:this.state.image,style:{width:this.props.schema.width||"100%",height:this.props.schema.height}})}}const Ce=ve;class Le extends m{constructor(e){super(e);X(this,"index");this.index=Date.now()}componentDidMount(){return ae(this,null,function*(){if(Re(Le.prototype,this,"componentDidMount").call(this),this.props.schema.base64){const e=m.getValue(this.props.data,this.props.attr);this.setState({value:e})}else this.props.socket.fileExists(`${this.props.adapterName}.${this.props.instance}`,this.props.attr).then(e=>e&&this.loadImage())})}_getUrl(e){e&&(this.index=Date.now());let t=`files/${this.props.adapterName}.${this.props.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 i().createElement(l.FormControl,{fullWidth:!0,variant:"standard"},this.props.schema.label?i().createElement(l.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,i().createElement(c.UploadImage,{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},()=>{this.props.schema.base64?this.onChange(this.props.attr,this.state.value):this.props.socket.deleteFile(`${this.props.adapterName}.${this.props.instance}`,this.props.attr)}),onChange:n=>this.setState({value:n},()=>{this.props.schema.base64?this.onChange(this.props.attr,this.state.value):n.startsWith("data")&&(n=n.split(",")[1]),this.props.socket.writeFile64(`${this.props.adapterName}.${this.props.instance}`,this.props.attr,n)})}),this.props.schema.help?i().createElement(l.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Oe=Le,rt={icon:{width:20,height:20,marginRight:4}};class at extends m{constructor(){super(...arguments);X(this,"onInstancesUpdate",(e,t)=>{if(!e.match(/^system\.adapter\.[-_a-z\d]+\.\d+$/))return;const n=this.props.schema.long?e:this.props.schema.short?e.split(".").pop():e.replace(/^system\.adapter\./,""),r=this.state.selectOptions.findIndex(a=>a.value===n);if(t){if(this.props.schema.adapter==="_dataSources"&&(!t.common||!t.common.getHistory))return;if(r===-1){const a=JSON.parse(JSON.stringify(this.state.selectOptions));a.push({value:this.props.schema.long?t._id:this.props.schema.short?t._id.split(".").pop():t._id.replace(/^system\.adapter\./,""),label:`${t.common.name} [${t._id.replace(/^system\.adapter\./,"")}]`,icon:`adapter/${t.common.name}/${t.common.icon}`}),a.sort((o,p)=>o.label>p.label?1:o.label<p.label?-1:0),this.setState({selectOptions:a})}}else if(r!==-1){const a=JSON.parse(JSON.stringify(this.state.selectOptions)),o={};this.state.value===a[r].value&&(o.value=m.NONE_VALUE),a.splice(r,1),o.selectOptions=a,this.setState(o)}})}componentDidMount(){return ae(this,null,function*(){Re(at.prototype,this,"componentDidMount").call(this);const e=m.getValue(this.props.data,this.props.attr);let t=this.props.schema.adapter;t==="_dataSources"&&(t=void 0),this.props.socket.getAdapterInstances(t,!0).then(n=>ae(this,null,function*(){this.props.schema.adapter==="_dataSources"?n=n.filter(a=>{var o;return(o=a==null?void 0:a.common)==null?void 0:o.getHistory}):this.props.schema.adapter?n=n.filter(a=>a==null?void 0:a._id.startsWith(`system.adapter.${this.props.schema.adapter}.`)):this.props.schema.adapters&&Array.isArray(this.props.schema.adapters)&&(n=n.filter(a=>{var o;return this.props.schema.adapters.includes((o=a==null?void 0:a.common)==null?void 0:o.name)})),this.props.schema.onlyEnabled&&(n=n.filter(a=>{var o;return(o=a==null?void 0:a.common)==null?void 0:o.enabled}));const r=n.map(a=>({value:this.props.schema.long?a._id:this.props.schema.short?a._id.split(".").pop():a._id.replace(/^system\.adapter\./,""),label:`${a.common.name} [${a._id.replace(/^system\.adapter\./,"")}]`,icon:`adapter/${a.common.name}/${a.common.icon}`}));r.sort((a,o)=>a.value>o.value?1:a.value<o.value?-1:0),this.props.schema.allowDeactivate!==!1&&r.unshift({label:c.I18n.t(m.NONE_LABEL),value:m.NONE_VALUE}),this.props.schema.all&&r.unshift({label:c.I18n.t("sch_all"),value:"*"}),this.setState({value:e||"",selectOptions:r}),yield this.props.socket.subscribeObject(`system.adapter.${t?`${t}.`:""}*`,this.onInstancesUpdate)}))})}componentWillUnmount(){this.props.socket.unsubscribeObject("system.adapter.*",this.onInstancesUpdate).then(()=>{}),super.componentWillUnmount()}renderItem(e,t){var r;if(!this.state.selectOptions)return null;const n=(r=this.state.selectOptions)==null?void 0:r.find(a=>a.value===this.state.value);return i().createElement(l.FormControl,{fullWidth:!0,key:this.props.attr,variant:"standard"},this.props.schema.label?i().createElement(l.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,i().createElement(l.Select,{variant:"standard",error:!!e,displayEmpty:!0,disabled:!!t,value:this.state.value,renderValue:()=>i().createElement("span",{style:{display:"flex"}},n!=null&&n.icon?i().createElement("img",{src:`./${n.icon}`,alt:n.value,style:rt.icon}):null,this.getText(n==null?void 0:n.label,!0)),onChange:a=>this.setState({value:a.target.value},()=>this.onChange(this.props.attr,this.state.value))},this.state.selectOptions.map(a=>i().createElement(l.MenuItem,{key:a.value,value:a.value,style:a.value===m.NONE_VALUE?{opacity:.5}:{}},a.icon?i().createElement("img",{src:`./${a.icon}`,alt:a.value,style:rt.icon}):null,this.getText(a.label,!0)))),this.props.schema.help?i().createElement(l.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const je=at,He={address:{fontSize:"smaller",opacity:.5,marginLeft:8}};class Me extends m{componentDidMount(){super.componentDidMount(),this.props.socket.getObject(`system.host.${this.props.common.host}`).then(s=>{var t,n;const e=[];if((n=(t=s==null?void 0:s.native)==null?void 0:t.hardware)!=null&&n.networkInterfaces){const r=s.native.hardware.networkInterfaces;Object.keys(r).forEach(a=>{if(this.props.schema.ignoreInternal&&!r[a].find(p=>!p.internal)||this.props.schema.ignoreLoopback&&r[a].find(p=>p.address==="127.0.0.1"||p.address==="::1"))return;let o=r[a].find(p=>p.family==="IPv4");o=o||r[a].find(p=>p.family==="IPv6"),e.push({value:a,address:o.address})})}this.setState({interfaces:e})}).catch(s=>window.alert(`Cannot read interfaces: ${s}`))}renderItem(s,e){var r,a,o;const t=m.getValue(this.props.data,this.props.attr),n=(r=this.state.interfaces)==null?void 0:r.find(p=>p.value===t);return i().createElement(l.FormControl,{fullWidth:!0,variant:"standard"},(a=this.state.interfaces)!=null&&a.length&&this.props.schema.label?i().createElement(l.InputLabel,null,this.getText(this.props.schema.label)):null,(o=this.state.interfaces)!=null&&o.length?i().createElement(l.Select,{variant:"standard",error:!!s,disabled:!!e,value:t,renderValue:p=>n?i().createElement("span",null,n.value,i().createElement("span",{style:He.address},n.address)):p,onChange:p=>this.onChange(this.props.attr,p.target.value)},this.state.interfaces.map((p,O)=>i().createElement(l.MenuItem,{key:O,value:p.value},i().createElement("span",null,p.value,i().createElement("span",{style:He.address},p.address))))):i().createElement(l.TextField,{fullWidth:!0,variant:"standard",error:!!s,disabled:!!e,value:t,onChange:p=>this.onChange(this.props.attr,p.target.value),label:this.getText(this.props.schema.label)}),this.props.schema.help?i().createElement(l.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const dt=Me,et={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"}},nn=({toggleTranslation:w,noTranslation:s,title:e,fullWidth:t,help:n,maxWidth:r,progress:a,icon:o,applyDisabled:p,applyButton:O,onClose:U,children:J,titleButtonApply:q,titleButtonClose:he,onApply:Ee,textInput:se,defaultValue:ye,overflowHidden:de})=>{const[qe,Pt]=(0,S.useState)(ye);(0,S.useEffect)(()=>{Pt(ye)},[ye]);let jt=null;return o&&(jt=o),i().createElement(l.Dialog,{open:!0,maxWidth:r||"md",fullWidth:!!t,disableEscapeKeyDown:!1,onClose:U,sx:{"& .MuiPaper-root":et.modalDialog}},e&&i().createElement(l.DialogTitle,null,o?i().createElement(jt,{style:et.titleIcon}):null,e,c.I18n.getLanguage()!=="en"&&w?i().createElement(l.IconButton,{size:"large",style:Y(Y({},et.languageButton),s?et.languageButtonActive:{}),onClick:()=>w(),title:c.I18n.t("Disable/Enable translation")},i().createElement(u.Language,null)):null),i().createElement(l.DialogContent,{sx:Y(Y({},de?et.overflowHidden:{}),et.content),style:{paddingTop:8}},se&&i().createElement(l.TextField,{autoComplete:"off",fullWidth:!0,autoFocus:!0,variant:"outlined",size:"medium",multiline:!0,value:qe,onChange:Dn=>Pt(Dn.target.value)}),J,n?i().createElement("div",null,n):null),i().createElement(l.DialogActions,null,O!==!1&&i().createElement(l.Button,{startIcon:i().createElement(u.Check,null),disabled:a||p&&ye===qe,onClick:()=>Ee&&Ee(se?qe:""),variant:"contained",color:"primary"},c.I18n.t(q||"Ok")),i().createElement(l.Button,{color:"grey",onClick:()=>U&&U(),disabled:a,variant:"contained",startIcon:i().createElement(u.Close,null)},c.I18n.t(he||"Cancel"))))};var sn=G(58093),be=G.n(sn),Ve=G(97726),me=G(51197),Pe=G(9285),Ge=G(44210),We=G(82292);const ot={jsonError:{border:"1px solid red",minHeight:200},jsonNoError:{border:"1px solid #00000000",minHeight:200}};function tt(w){return i().createElement(be(),{style:w.error===!0?ot.jsonError:w.error===!1?ot.jsonNoError:void 0,mode:w.mode||"json",width:"100%",height:"100%",showPrintMargin:w.editValueMode,showGutter:w.editValueMode,highlightActiveLine:w.editValueMode,defaultValue:w.defaultValue,theme:w.themeType==="dark"?"clouds_midnight":"chrome",value:w.value,readOnly:!w.onChange,onChange:s=>w.onChange(s),name:w.name||"UNIQUE_ID_OF_DIV1",fontSize:w.fontSize||14,setOptions:{enableBasicAutocompletion:!0,enableLiveAutocompletion:!0,enableSnippets:!0,showLineNumbers:w.editValueMode,tabSize:w.editValueMode?2:void 0},editorProps:{$blockScrolling:!0}})}const lt=tt,nt={fullWidth:{width:"100%"},flex:{display:"flex"},button:{height:48,minWidth:48},wrapper:{width:"calc(100vw - 40px)",height:"calc(100vh - 188px)"}};class mt extends m{componentDidMount(){return ae(this,null,function*(){Re(mt.prototype,this,"componentDidMount").call(this);const{data:s,attr:e}=this.props,t=m.getValue(s,e)||{};this.setState({value:t,initialized:!0,jsonError:this.validateJson(t)})})}validateJson(s){let e=!1;if(this.props.schema.validateJson!==!1&&(s||!this.props.schema.allowEmpty))try{JSON.parse(s)}catch(t){console.log("Error in JSON",t),e=!0}return e}renderItem(){if(!this.state.initialized)return null;const{schema:s,data:e,attr:t}=this.props,{value:n,showSelectId:r}=this.state;return i().createElement(l.FormControl,{fullWidth:!0,variant:"standard"},i().createElement("div",{style:nt.flex},i().createElement(l.Button,{color:"grey",style:nt.button,size:"small",variant:"outlined",onClick:()=>this.setState({showSelectId:!0})},c.I18n.t("ra_JSON editor"))),r?i().createElement(nn,{title:this.getText(s.label),overflowHidden:!0,onClose:()=>this.setState({showSelectId:!1,value:m.getValue(e,t)||{}}),onApply:()=>this.setState({showSelectId:!1},()=>this.onChange(t,n))},i().createElement("div",{style:Y(Y({},nt.wrapper),this.state.jsonError?{}:void 0)},i().createElement(lt,{value:typeof n=="object"?JSON.stringify(n):n,onChange:a=>this.setState({value:a,jsonError:this.validateJson(a)}),name:"ConfigJsonEditor",themeType:this.props.themeType}))):null,s.help||this.state.jsonError?i().createElement(l.FormHelperText,null,this.state.jsonError?c.I18n.t("ra_Invalid JSON"):this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const rn=mt,Pn=[{value:"en",label:"English"},{value:"de",label:"Deutsch"},{value:"ru",label:"\u0440\u0443\u0441\u0441\u043A\u0438\u0439"},{value:"pt",label:"Portugues"},{value:"nl",label:"Nederlands"},{value:"fr",label:"fran\xE7ais"},{value:"it",label:"Italiano"},{value:"es",label:"Espanol"},{value:"pl",label:"Polski"},{value:"uk",label:"\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0438\u0439"},{value:"zh-ch",label:"\u7B80\u4F53\u4E2D\u6587"}];class Rn extends m{componentDidMount(){super.componentDidMount();const s=m.getValue(this.props.data,this.props.attr),e=[...Pn];this.props.schema.system?e.unshift({value:"",label:c.I18n.t("ra_System language")}):e.unshift({value:"",label:c.I18n.t("ra_none")}),this.setState({value:this.props.schema.system?s||"":s||c.I18n.getLanguage(),selectOptions:e})}renderItem(s,e){var n,r;if(!this.state.selectOptions)return null;const t=(n=this.state.selectOptions)==null?void 0:n.find(a=>a.value===this.state.value||!a.value&&!this.state.value);return i().createElement(l.FormControl,{fullWidth:!0,variant:"standard"},this.props.schema.label?i().createElement(l.InputLabel,null,this.getText(this.props.schema.label)):null,i().createElement(l.Select,{variant:"standard",error:!!s,disabled:e,value:this.state.value||"_",renderValue:()=>this.getText(t==null?void 0:t.label,this.props.schema.noTranslation),onChange:a=>{let{value:o}=a.target;o==="_"&&(o=""),this.setState({value:o},()=>{if(this.onChange(this.props.attr,o),this.props.schema.changeGuiLanguage)if(o){if(o===c.I18n.getLanguage())return;c.I18n.setLanguage(o),this.props.changeLanguage&&this.props.changeLanguage()}else this.props.socket.getSystemConfig().then(p=>{p.common.language!==c.I18n.getLanguage()&&p.common.language&&(c.I18n.setLanguage(p.common.language),this.props.changeLanguage&&this.props.changeLanguage())})})}},(r=this.state.selectOptions)==null?void 0:r.map(a=>i().createElement(l.MenuItem,{key:a.value,value:a.value},a.label))),this.props.schema.help?i().createElement(l.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Mn=Rn;class Vn extends m{constructor(e){super(e);X(this,"scrollRef");this.scrollRef=i().createRef()}scrolledDown(){return this.scrollRef.current?this.scrollRef.current.offsetHeight+this.scrollRef.current.scrollTop>=this.scrollRef.current.scrollHeight:!1}componentDidMount(){super.componentDidMount(),m.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(){return this.state.showLicenseDialog?i().createElement(l.Dialog,{maxWidth:"lg",open:!0,onClose:(e,t)=>{t!=="escapeKeyDown"&&t!=="backdropClick"&&this.setState({showLicenseDialog:!1})}},i().createElement(l.DialogTitle,null,this.props.schema.title?c.I18n.t(this.props.schema.title):c.I18n.t("ra_License agreement")),i().createElement(l.DialogContent,null,this.props.schema.licenseUrl?i().createElement(i().Fragment,null,this.state.loading?i().createElement(l.LinearProgress,null):null,i().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?i().createElement("div",{ref:this.scrollRef,style:{width:"100%",height:"100%",overflowY:"auto",fontSize:14}},this.props.schema.texts.map(e=>this.props.schema.noTranslation?i().createElement("p",null,e):i().createElement("p",null,c.I18n.t(e)))):null),i().createElement(l.DialogActions,null,this.props.schema.checkBox?i().createElement(l.FormControlLabel,{control:i().createElement(l.Checkbox,{checked:!!this.state.licenseChecked,onClick:()=>this.setState({licenseChecked:!this.state.licenseChecked})}),label:c.I18n.t(this.props.schema.checkBox)}):null,i().createElement(l.Button,{disabled:this.state.loading||this.state.error||this.props.schema.checkBox&&!this.state.licenseChecked||!this.state.scrolledDown,onClick:()=>{this.setState({showLicenseDialog:!1}),this.onChange(this.props.attr,!0)},color:"primary",variant:"contained",startIcon:i().createElement(u.Check,null)},this.props.schema.agreeText?c.I18n.t(this.props.schema.agreeText):c.I18n.t("ra_Accept license")),i().createElement(l.Button,{onClick:()=>{this.setState({showLicenseDialog:!1}),setTimeout(()=>this.setState({showLicenseDialog:!0}),2e3)},color:"grey",variant:"contained",startIcon:i().createElement(u.Close,null)},c.I18n.t("ra_Close")))):null}}const Wn=Vn,En={indeterminate:{opacity:.5},control:{flexDirection:"row",width:"100%"}};class Un extends m{constructor(){super(...arguments);X(this,"updateTimeout")}componentDidMount(){super.componentDidMount();let e=m.getValue(this.props.data,this.props.attr);if(e==null&&(e=""),Array.isArray(e)&&this.props.multiEdit){e=m.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 n=m.getValue(e.data,e.attr);return e.multiEdit&&t._value===m.DIFFERENT_VALUE?m.DIFFERENT_VALUE:n==null||t.oldValue===null||t.oldValue===void 0||n.toString()!==parseFloat(t._value).toString()&&n.toString()!==t.oldValue.toString()?{_value:n}:null}checkValue(e){if(e==null)return null;e=e.toString().trim();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){const n=Array.isArray(this.state._value)||this.state._value===m.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),n){const r=m.getValue(this.props.data,this.props.attr),a=(r==null?void 0:r.filter(o=>o||o===0).map(o=>({label:o.toString(),value:o})))||[];return a.unshift({label:c.I18n.t(m.DIFFERENT_LABEL),value:m.DIFFERENT_VALUE}),i().createElement(l.Autocomplete,{style:En.indeterminate,fullWidth:!0,freeSolo:!0,value:a[0],getOptionSelected:(o,p)=>o.label===p.label,onChange:(o,p)=>{this.onChange(this.props.attr,p==null?void 0:p.value,()=>{this.setState({_value:p==null?void 0:p.value,oldValue:this.state._value})})},options:a,getOptionLabel:o=>o.label,renderInput:o=>i().createElement(l.TextField,$e(Y({},o),{label:this.getText(this.props.schema.label),variant:"standard",inputProps:$e(Y({},o.inputProps),{readOnly:this.props.schema.readOnly||!1}),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}))})}return!e&&this.state._value!==null&&this.state._value!==void 0&&this.state._value&&(e=this.checkValue(this.state._value),e&&(e=c.I18n.t(e))),i().createElement(l.FormControl,{variant:"standard",style:En.control},i().createElement(l.TextField,{variant:"standard",type:"number",fullWidth:!0,inputProps:{min:this.props.schema.min,max:this.props.schema.max,step:this.props.schema.step,readOnly:this.props.schema.readOnly||!1},value:this.state._value===null||this.state._value===void 0?"":this.state._value,error:!!e,disabled:!!t,onChange:r=>{const a=r.target.value,o=this.checkValue(a);o?this.onError(this.props.attr,c.I18n.t(o)):this.onError(this.props.attr),this.setState({_value:a,oldValue:this.state._value},()=>this.onChange(this.props.attr,parseFloat(a)))},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)}))}}const Jn=Un,bn={flex:{display:"flex"},button:{height:48,marginLeft:4,minWidth:48}};class an extends m{componentDidMount(){return ae(this,null,function*(){Re(an.prototype,this,"componentDidMount").call(this);const{data:s,attr:e}=this.props,t=m.getValue(s,e)||"";this.setState({value:t,initialized:!0})})}renderItem(s,e){if(!this.state.initialized)return null;const{schema:t,socket:n,attr:r}=this.props,{value:a,showSelectId:o}=this.state;return i().createElement(l.FormControl,{fullWidth:!0,variant:"standard"},t.label?i().createElement(l.InputLabel,{shrink:!0},this.getText(t.label)):null,i().createElement("div",{style:bn.flex},i().createElement(l.TextField,{variant:"standard",fullWidth:!0,value:a,error:!!s,disabled:e,placeholder:this.getText(t.placeholder),label:this.getText(t.label),helperText:this.renderHelp(t.help,t.helpLink,t.noTranslation),onChange:p=>{const O=p.target.value;this.setState({value:O},()=>this.onChange(r,O))}}),i().createElement(l.Button,{color:"grey",style:bn.button,size:"small",variant:"outlined",onClick:()=>this.setState({showSelectId:!0})},"...")),o?i().createElement(c.SelectID,{imagePrefix:this.props.imagePrefix===void 0?"../..":this.props.imagePrefix,dialogName:`admin.${this.props.adapterName}`,filterFunc:t.filterFunc,themeType:this.props.themeType,theme:this.props.theme,types:t.types?Array.isArray(t.types)?t.types:[t.types]:void 0,customFilter:t.customFilter,filters:t.filters,socket:n,selected:a,root:t.root,onClose:()=>this.setState({showSelectId:!1}),onOk:p=>this.setState({showSelectId:!1,value:p},()=>this.onChange(r,p))}):null)}}const jn=an,on={fullWidth:{width:"100%",display:"inline-block"},halfWidth1:{width:"calc(50% - 4px)",display:"inline-block",marginRight:8},halfWidth2:{width:"calc(50% - 4px)",display:"inline-block"}},St="____ppp____";class Hn extends m{componentDidMount(){super.componentDidMount();const s=m.getValue(this.props.data,this.props.attr);this.setState({_repeat:s?St:"",_visible:!1,value:s?St:"",_notEqual:!1})}onChangePassword(s,e){s===void 0&&(s=this.state.value),e===void 0&&(e=this.state._repeat);const t=!!this.props.schema.repeat&&e!==s;this.setState({value:s,_repeat:e,_notEqual:t},()=>{t?this.onError(this.props.attr,c.I18n.t("ra_Passwords are not equal!")):(this.onError(this.props.attr),this.onChange(this.props.attr,s))})}renderItem(s,e){if(this.state._notEqual===void 0)return null;const t=i().createElement(l.TextField,{variant:"standard",fullWidth:!0,type:this.state._visible&&this.state.value!==St?"text":"password",value:this.state.value,error:!!s||this.state._notEqual,disabled:!!e,onChange:n=>this.onChangePassword(n.target.value),label:this.getText(this.props.schema.label),inputProps:{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?c.I18n.t("ra_Passwords are not equal!"):this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation),InputProps:{endAdornment:this.state.value&&this.state.value!==St&&(this.props.schema.visible||this.props.schema.readOnly)?i().createElement(l.InputAdornment,{position:"end"},i().createElement(l.IconButton,{size:"large",tabIndex:-1,onClick:n=>{n.preventDefault(),n.stopPropagation(),this.setState({_visible:!this.state._visible})},edge:"end"},this.state._visible?i().createElement(u.VisibilityOff,null):i().createElement(u.Visibility,null))):void 0}});if(this.props.schema.repeat&&!this.props.schema.readOnly){const n=i().createElement(l.TextField,{variant:"standard",fullWidth:!0,type:this.state._visible&&this.state._repeat!==St?"text":"password",value:this.state._repeat,error:!!s||this.state._notEqual,disabled:!!e,onChange:r=>this.onChangePassword(void 0,r.target.value),label:`${this.getText(this.props.schema.label)} (${c.I18n.t("ra_repeat")})`,inputProps:{autoComplete:"new-password",form:{autoComplete:"off"},maxLength:this.props.schema.maxLength||this.props.schema.max||void 0},helperText:this.state._notEqual?c.I18n.t("ra_Passwords are not equal!"):this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation),InputProps:{endAdornment:this.state._repeat&&this.state._repeat!==St&&this.props.schema.visible?i().createElement(l.InputAdornment,{position:"end"},i().createElement(l.IconButton,{size:"large",tabIndex:-1,onClick:r=>{r.preventDefault(),r.stopPropagation(),this.setState({_visible:!this.state._visible})},edge:"end"},this.state._visible?i().createElement(u.VisibilityOff,null):i().createElement(u.Visibility,null))):void 0}});return i().createElement("div",{style:on.fullWidth},i().createElement("div",{style:on.halfWidth1},t),i().createElement("div",{style:on.halfWidth2},n))}return t}}const zn=Hn;class Kn extends m{renderItem(s,e){return i().createElement(l.TextField,{variant:"standard",fullWidth:!0,disabled:!!e,InputProps:{endAdornment:this.props.schema.copyToClipboard?i().createElement(l.IconButton,{size:"small",onClick:()=>{c.Utils.copyToClipboard(this.getPattern(this.props.schema.pattern)),window.alert("Copied")}},i().createElement(c.IconCopy,null)):void 0},value:this.getPattern(this.props.schema.pattern),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}}const Gn=Kn,qn={warning:{"& .Mui-error":{color:"orange"}}};class ln extends m{constructor(){super(...arguments);X(this,"updateTimeout")}componentDidMount(){return ae(this,null,function*(){Re(ln.prototype,this,"componentDidMount").call(this);let e=m.getValue(this.props.data,this.props.attr);e==null&&(e=""),this.setState({_value:e.toString(),oldValue:e.toString()});const t=yield this.props.socket.getAdapterInstances(),n=`system.adapter.${this.props.adapterName}.${this.props.instance}`,r=yield this.props.socket.getObject(n),a=r==null?void 0:r.common.host,o=[];t.forEach(p=>{var U,J,q,he;if(!p||p._id===n||p.common.host!==a||!((U=p.native)!=null&&U.bind))return;if(p!=null&&p.native&&p.native.secure&&p.native.leEnabled&&p.native.leUpdate){const Ee=parseInt(p.native.leCheckPort||p.native.lePort,10);Ee&&o.push({name:`${p._id.replace("system.adapter.","")} (LE)`,port:Ee,v6bind:p.native.bind.includes(":")?p.native.bind:p.native.v6bind,bind:p.native.bind,enabled:!!((J=p.common)!=null&&J.enabled)})}const O=parseInt((q=p==null?void 0:p.native)==null?void 0:q.port,10);O&&o.push({name:p._id.replace("system.adapter.",""),bind:p.native.bind,v6bind:p.native.bind.includes(":")?p.native.bind:p.native.v6bind,port:O,enabled:!!((he=p.common)!=null&&he.enabled)})}),this.setState({ports:o})})}static getDerivedStateFromProps(e,t){const n=m.getValue(e.data,e.attr);return n==null||t.oldValue===null||t.oldValue===void 0||n.toString()!==parseInt(t._value,10).toString()&&n.toString()!==t.oldValue.toString()?{_value:n}:null}checkValue(e){if(e==null)return null;const t=this.props.schema.min===void 0?20:this.props.schema.min,n=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>n?"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 n=this.props.schema.min===void 0?20:this.props.schema.min,r=this.props.schema.max||65535;let a;if(this.state.ports){const o=parseInt(this.state._value,10);if(o){const p=this.state.ports.filter(U=>!this.props.data.bind||this.props.data.bind===U.bind||this.props.data.bind==="0.0.0.0"||U.bind==="0.0.0.0");let O=p.findIndex(U=>U.port===o&&U.enabled);O!==-1?e=c.I18n.t("ra_Port is already used by %s",this.state.ports[O].name):(O=p.findIndex(U=>U.port===o&&!U.enabled),O!==-1&&(a=!0,e=c.I18n.t("ra_Port could be used by %s",this.state.ports[O].name)))}}return!e&&this.state._value!==null&&this.state._value!==void 0&&(e=this.checkValue(this.state._value),typeof e=="string"&&(e=c.I18n.t(e))),i().createElement(l.TextField,{variant:"standard",type:"number",fullWidth:!0,inputProps:{min:n,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:a?qn.warning:void 0,onChange:o=>{const p=Number(o.target.value.toString().replace(/[^0-9]/g,"")).toString(),O=this.checkValue(p);O?this.onError(this.props.attr,c.I18n.t(O)):this.onError(this.props.attr),this.setState({_value:p,oldValue:this.state._value},()=>{p.trim()===parseInt(p,10).toString()&&this.onChange(this.props.attr,parseInt(p,10)||0)})},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)})}}const Yn=ln;class Xn extends m{componentDidMount(){super.componentDidMount();const s=m.getValue(this.props.data,this.props.attr);this.props.socket.getEnums("rooms").then(e=>{const t=Object.keys(e).map(n=>({value:this.props.schema.short?n.replace("enum.rooms.",""):n,label:this.getText(e[n].common.name),obj:e[n]}));this.props.schema.allowDeactivate!==!1&&t.unshift({label:c.I18n.t(m.NONE_LABEL),value:m.NONE_VALUE}),this.setState({value:s,selectOptions:t})})}renderItem(s,e){if(!this.state.selectOptions)return null;const t=this.state.selectOptions.find(n=>n.value===this.state.value);return i().createElement(l.FormControl,{variant:"standard",fullWidth:!0},this.props.schema.label?i().createElement(l.InputLabel,null,this.getText(this.props.schema.label)):null,i().createElement(l.Select,{variant:"standard",error:!!s,disabled:!!e,value:this.state.value||"_",renderValue:()=>t?t.obj?i().createElement(c.TextWithIcon,{value:t.obj,themeType:this.props.themeType,lang:c.I18n.getLanguage()}):t.label:"",onChange:n=>{this.setState({value:n.target.value==="_"?"":n.target.value},()=>this.onChange(this.props.attr,this.state.value))}},this.state.selectOptions.map(n=>i().createElement(l.MenuItem,{key:n.value,value:n.value,style:n.value===m.DIFFERENT_VALUE?{opacity:.5}:{}},n.obj?i().createElement(c.TextWithIcon,{value:n.obj,themeType:this.props.themeType,lang:c.I18n.getLanguage()}):n.label))),this.props.schema.help?i().createElement(l.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Zn=Xn,Qn={fullWidth:{width:"100%"},noMargin:{"&>div":{marginTop:0}}};class es extends m{constructor(){super(...arguments);X(this,"initialValue","")}componentDidMount(){super.componentDidMount();const e=m.getValue(this.props.data,this.props.attr),t=[];(this.props.schema.options||[]).forEach(n=>{const r=n;Array.isArray(r.items)?(t.push({label:this.getText(n.label),value:n.value,group:!0}),r.items.forEach(a=>t.push({label:this.getText(a.label),value:a.value,hidden:a.hidden}))):t.push({label:this.getText(n.label),value:n.value,hidden:n.hidden})}),Array.isArray(e)?(this.initialValue=[...e],t.unshift({label:c.I18n.t(m.DIFFERENT_LABEL),value:m.DIFFERENT_VALUE}),this.setState({value:m.DIFFERENT_VALUE,selectOptions:t})):this.setState({value:e,selectOptions:t})}renderItem(e,t){if(!this.state.selectOptions)return null;const n=(this.state.selectOptions||[]).filter(a=>a.hidden?this.props.custom?!this.executeCustom(a.hidden,this.props.data,this.props.customObj,this.props.instanceObj,this.props.arrayIndex,this.props.globalData):!this.execute(a.hidden,this.props.schema.default,this.props.data,this.props.arrayIndex,this.props.globalData):!0),r=n.find(a=>a.value==this.state.value);return i().createElement(l.FormControl,{variant:"standard",fullWidth:!0,sx:this.props.table!==void 0&&Qn.noMargin,id:`jsonSelect_${this.props.attr}_${this.props.index||this.props.index===0?this.props.index:""}`},this.props.schema.label?i().createElement(l.InputLabel,null,this.getText(this.props.schema.label)):null,i().createElement(l.Select,{variant:"standard",error:!!e,disabled:!!t,value:this.state.value||"_",renderValue:()=>this.getText(r==null?void 0:r.label,this.props.schema.noTranslation),onChange:a=>{this.setState({value:a.target.value==="_"?"":a.target.value},()=>{this.state.value===m.DIFFERENT_VALUE?this.onChange(this.props.attr,this.initialValue):this.onChange(this.props.attr,this.state.value)})}},n.map((a,o)=>a.group?i().createElement(l.ListSubheader,{key:o},this.getText(a.label,this.props.schema.noTranslation)):i().createElement(l.MenuItem,{key:o,value:a.value,style:a.value===m.DIFFERENT_VALUE?{opacity:.5}:{}},this.getText(a.label,this.props.schema.noTranslation)))),this.props.schema.help?i().createElement(l.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const ts=es,ns={menuPaper:{maxHeight:800}};class ss extends m{constructor(){super(...arguments);X(this,"initialized",!1);X(this,"_context")}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);try{e=JSON.parse(t)}catch(n){console.error(`Cannot parse json data: ${t}`)}}e===void 0&&(e=null),this.props.socket.sendTo(`${this.props.adapterName}.${this.props.instance}`,this.props.schema.command||"send",e).then(t=>this.setState({list:t}))}else{const e=m.getValue(this.props.data,this.props.attr);this.setState({value:e})}}getContext(){const e={};return Array.isArray(this.props.schema.alsoDependsOn)&&this.props.schema.alsoDependsOn.forEach(t=>e[t]=m.getValue(this.props.data,t)),JSON.stringify(e)}_getValue(){let e=this.state.value===null||this.state.value===void 0?m.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 o=this.getContext();(o!==this._context||!this.initialized)&&(this._context=o,setTimeout(()=>this.askInstance(),this.initialized?300:50),this.initialized=!0)}const n=this._getValue();if(!this.props.alive)return this.props.schema.multiple||this.props.schema.manual===!1?c.I18n.t("ra_Cannot retrieve options, as instance is offline"):i().createElement(l.TextField,{variant:"standard",fullWidth:!0,value:n,error:!!e,disabled:!!t,onChange:o=>{const p=o.target.value;this.setState({value:p},()=>this.onChange(this.props.attr,(p||"").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),InputProps:{endAdornment:this.state.value&&!this.props.schema.noClearButton?i().createElement(l.InputAdornment,{position:"end"},i().createElement(l.IconButton,{size:"small",onClick:()=>this.setState({value:""},()=>this.onChange(this.props.attr,""))},i().createElement(u.Close,null))):null}});if(!this.state.list)return i().createElement(l.CircularProgress,{size:"small"});const r=this.state.list.filter(o=>o.hidden?this.props.custom?!this.executeCustom(o.hidden,this.props.data,this.props.customObj,this.props.instanceObj,this.props.arrayIndex,this.props.globalData):!this.execute(o.hidden,this.props.schema.default,this.props.data,this.props.arrayIndex,this.props.globalData):!0),a=r.find(o=>o.value===n);return i().createElement(l.FormControl,{variant:"standard",fullWidth:!0},this.props.schema.label?i().createElement(l.InputLabel,null,this.getText(this.props.schema.label)):null,i().createElement(l.Select,{variant:"standard",error:!!e,multiple:this.props.schema.multiple,disabled:!!t,sx:{"&.MuiSelect-paper":this.props.schema.multiple?ns.menuPaper:void 0},value:n,renderValue:o=>this.props.schema.multiple?i().createElement(l.Box,{sx:{display:"flex",flexWrap:"wrap",gap:.5}},o.map(p=>{const O=r.find(U=>U.value===p);if(O||this.props.schema.showAllValues!==!1){const U=(O==null?void 0:O.label)||p;return i().createElement(l.Chip,{key:p,label:U})}return null})):(a==null?void 0:a.label)||o,onChange:o=>{this.onChange(this.props.attr,o.target.value)}},r.map((o,p)=>i().createElement(l.MenuItem,{key:p,value:o.value},this.props.schema.multiple?i().createElement(l.Checkbox,{checked:n.includes(o.value),onClick:()=>{const O=JSON.parse(JSON.stringify(this._getValue())),U=n.indexOf(o.value);U!==-1?O.splice(U,1):(O.push(o.value),O.sort()),this.setState({value:O},()=>this.onChange(this.props.attr,O))}}):null,i().createElement(l.ListItemText,{primary:o.label})))),this.props.schema.help?i().createElement(l.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const is=ss,xn={fullWidth:{width:"100%"}};function ft(w){return w.split(".").reduce((s,e)=>(s<<8)+parseInt(e,10),0)>>>0}function rs(w,s){var n,r;const e=(r=(n=w==null?void 0:w.native)==null?void 0:n.hardware)==null?void 0:r.networkInterfaces;if(!e)return null;let t;return Object.keys(e).forEach(a=>e[a].forEach(o=>{o.internal||s.includes(":")&&o.family!=="IPv6"||s.includes(".")&&!s.match(/[^.\d]/)&&o.family!=="IPv4"||(o.family==="IPv4"&&!o.address.startsWith("172")&&(s==="127.0.0.0"||s==="localhost"||s.match(/[^.\d]/))?t=o.address:t||(o.family==="IPv4"&&s.includes(".")&&(ft(s)&ft(o.netmask),ft(o.address)&ft(o.netmask)),t=o.address))})),t||Object.keys(e).forEach(a=>e[a].forEach(o=>{o.internal||s.includes(":")&&o.family!=="IPv6"||s.includes(".")&&!s.match(/[^.\d]/)&&o.family!=="IPv4"||(o.family==="IPv6"&&(s==="127.0.0.0"||s==="localhost"||s.match(/[^.\d]/))?t=o.address:t||(o.family==="IPv4"&&s.includes(".")&&(ft(s)&ft(o.netmask),ft(o.address)&ft(o.netmask)),t=o.address))})),t||Object.keys(e).forEach(a=>{e[a].forEach(o=>{o.internal||s.includes(":")&&o.family!=="IPv6"||s.includes(".")&&!s.match(/[^.\d]/)&&o.family!=="IPv4"||(s==="127.0.0.0"||s==="localhost"||s.match(/[^.\d]/),t=o.address)})}),t||Object.keys(e).forEach(a=>{e[a].forEach(o=>{o.internal||(t=o.address)})}),t}class un extends m{componentDidMount(){return ae(this,null,function*(){var e;Re(un.prototype,this,"componentDidMount").call(this);let s=window.location.hostname;if(this.props.schema.openUrl){const t=yield this.props.socket.getCurrentInstance(),n=yield this.props.socket.getObject(`system.adapter.${t}`);if(n){const r=yield this.props.socket.getObject(`system.host.${(e=n==null?void 0:n.common)==null?void 0:e.host}`);if(r){const a=rs(r,window.location.hostname);if(a)s=`${a}:${window.location.port}`;else{console.warn(`Cannot find suitable IP in host ${n.common.host} for ${n._id}`);return}}}}yield new Promise(t=>{this.setState({_error:"",_message:"",hostname:s},t)}),this.props.schema.onLoaded&&this._onClick()})}renderErrorDialog(){return this.state._error?i().createElement(c.Error,{text:this.state._error,onClose:()=>this.setState({_error:""})}):null}renderMessageDialog(){return this.state._message?i().createElement(c.Message,{text:this.state._message,onClose:()=>this.setState({_message:""})}):null}_onClick(){this.props.onCommandRunning(!0),this.setState({running:!0});const s=`${window.location.protocol}//${window.location.host}${window.location.pathname.replace(/\/index\.html$/,"")}`,e=`${window.location.protocol}//${this.state.hostname.split(":").length>3?`[${this.state.hostname}]`:this.state.hostname}${window.location.pathname.replace(/\/index\.html$/,"")}`;let t=this.props.schema.data;if(t===void 0&&this.props.schema.jsonData){const r=this.getPattern(this.props.schema.jsonData,Y({_origin:s,_originIp:e},this.props.data));try{t=JSON.parse(r)}catch(a){console.error(`Cannot parse json data: ${r}`)}}t===void 0&&(t=null),this.props.schema.openUrl&&!t&&(t={_origin:s,_originIp:e});let n;this.props.schema.timeout&&(n=setTimeout(()=>{this.props.onCommandRunning(!1),this.setState({_error:c.I18n.t("ra_Request timed out"),running:!1})},parseInt(this.props.schema.timeout,10)||1e4)),this.props.socket.sendTo(`${this.props.adapterName}.${this.props.instance}`,this.props.schema.command||"send",t).then(r=>ae(this,null,function*(){if(n&&(clearTimeout(n),n=void 0),r!=null&&r.error)if(this.props.schema.error&&this.props.schema.error[r.error]){let a=this.getText(this.props.schema.error[r.error]);r.args&&r.args.forEach(o=>a=a.replace("%s",o)),this.setState({_error:a})}else this.setState({_error:r.error?c.I18n.t(r.error):c.I18n.t("ra_Error")});else{if(r!=null&&r.command){this.props.onBackEndCommand&&this.props.onBackEndCommand(r.command);return}if(r!=null&&r.reloadBrowser&&this.props.schema.reloadBrowser)window.location.reload();else if(r!=null&&r.openUrl&&this.props.schema.openUrl)window.open(r.openUrl,r.window||this.props.schema.window||"_blank");else if(r!=null&&r.result&&this.props.schema.result&&this.props.schema.result[r.result]){let a=this.getText(this.props.schema.result[r.result]);r.args&&r.args.forEach(o=>a=a.replace("%s",o)),window.alert(a)}if(r!=null&&r.native&&this.props.schema.useNative){for(const[a,o]of Object.entries(r.native))yield this.onChangeAsync(a,o);setTimeout(()=>this.props.forceUpdate(Object.keys(r.native),this.props.data),300)}else r!=null&&r.result?window.alert(typeof r.result=="object"?JSON.stringify(r.result):r.result):window.alert(c.I18n.t("ra_Ok"));r!=null&&r.saveConfig&&this.props.onChange(null,null,null,!0)}})).catch(r=>{this.props.schema.error&&this.props.schema.error[r.toString()]?this.setState({_error:this.getText(this.props.schema.error[r.toString()])}):this.setState({_error:c.I18n.t(r.toString())||c.I18n.t("ra_Error")})}).then(()=>{this.props.onCommandRunning(!1),this.setState({running:!1})})}renderConfirmDialog(){if(!this.state.confirmDialog)return null;const s=this.state.confirmData||this.props.schema.confirm;let e=null;return s.type==="warning"?e=i().createElement(u.Warning,null):s.type==="error"?e=i().createElement(u.Error,null):s.type==="info"&&(e=i().createElement(u.Info,null)),i().createElement(c.Confirm,{title:this.getText(s.title)||c.I18n.t("ra_Please confirm"),text:this.getText(s.text),ok:this.getText(s.ok)||c.I18n.t("ra_Ok"),cancel:this.getText(s.cancel)||c.I18n.t("ra_Cancel"),icon:e||void 0,onClose:t=>this.setState({confirmDialog:!1},()=>t&&this._onClick())})}renderItem(s,e){const t=this.getIcon();return i().createElement("div",{style:xn.fullWidth},i().createElement(l.Button,{variant:this.props.schema.variant||void 0,color:this.props.schema.color||"grey",style:Y(Y({},xn.fullWidth),this.props.schema.controlStyle||void 0),disabled:e||!this.props.alive,startIcon:t,title:this.props.alive?this.getText(this.props.schema.title)||"":c.I18n.t("ra_Instance is not alive"),onClick:()=>{this.props.schema.confirm?this.setState({confirmDialog:!0}):this._onClick()}},this.props.schema.showProcess&&this.state.running?i().createElement(l.CircularProgress,{size:20,style:{marginRight:8}}):null,this.getText(this.props.schema.label,this.props.schema.noTranslation)),this.renderErrorDialog(),this.renderMessageDialog())}}const wn=un,Fn={fullWidth:{width:"100%"},icon:{width:24,height:24,marginRight:4}};class as extends m{_onClick(){return ae(this,null,function*(){var t,n;let s=this.props.schema.val;if(typeof s=="string"&&s.includes("${")){s=this.getPattern(s);const r=yield this.props.socket.getObject(this.props.schema.id);((t=r==null?void 0:r.common)==null?void 0:t.type)==="number"?s=parseFloat(s):((n=r==null?void 0:r.common)==null?void 0:n.type)==="boolean"&&(s=s==="true"||s===!0||s==="1"||s===1)}const e=(this.props.schema.id||"").replace(/%INSTANCE%/g,(this.props.instance||0).toString());try{yield this.props.socket.setState(e,{val:s,ack:!!this.props.schema.ack}),this.props.schema.okText&&window.alert(this.getText(this.props.schema.okText))}catch(r){this.props.schema.error&&this.props.schema.error[r.toString()]?window.alert(this.getText(this.props.schema.error[r.toString()])):window.alert(c.I18n.t(r.toString())||c.I18n.t("ra_Error"))}})}renderConfirmDialog(){if(!this.state.confirmDialog)return null;const s=this.state.confirmData||this.props.schema.confirm;let e=null;return s.type==="warning"?e=i().createElement(u.Warning,null):s.type==="error"?e=i().createElement(u.Error,null):s.type==="info"&&(e=i().createElement(u.Info,null)),i().createElement(c.Confirm,{title:this.getText(s.title)||c.I18n.t("ra_Please confirm"),text:this.getText(s.text),ok:this.getText(s.ok)||c.I18n.t("ra_Ok"),cancel:this.getText(s.cancel)||c.I18n.t("ra_Cancel"),icon:e,onClose:t=>this.setState({confirmDialog:!1},()=>t&&this._onClick())})}renderItem(s,e){return i().createElement(l.Button,{variant:this.props.schema.variant||void 0,color:this.props.schema.color||"grey",style:Fn.fullWidth,disabled:e,onClick:()=>ae(this,null,function*(){this.props.schema.confirm?this.setState({confirmDialog:!0}):yield this._onClick()})},this.props.schema.icon?i().createElement(c.Icon,{src:this.props.schema.icon,style:Fn.icon}):null,this.getText(this.props.schema.label,this.props.schema.noTranslation))}}const os=as,An={fullWidth:{width:"100%"},slider:{marginLeft:10,marginRight:10,width:"calc(100% - 20px)"}};class ls extends m{componentDidMount(){super.componentDidMount();const s=m.getValue(this.props.data,this.props.attr);this.setState({_value:s})}static getDerivedStateFromProps(s,e){if(s.schema.min!==void 0&&s.schema.min<0||s.schema.max!==void 0&&s.schema.max<0)return null;const t=m.getValue(s.data,s.attr);return t==null||t.toString()!==parseFloat(e._value).toString()?{_value:t}:null}renderItem(s,e){const t=this.props.schema.min||0,n=this.props.schema.max||100,r=this.props.schema.unit||"",a=[{value:t,label:t+r},{value:n,label:n+r}];return i().createElement(l.Box,{style:An.fullWidth},this.props.schema.label?i().createElement(l.Typography,{gutterBottom:!0},this.getText(this.props.schema.label)):null,i().createElement(l.Slider,{style:An.slider,value:this.state._value,getAriaValueText:o=>o+r,step:this.props.schema.step||(n-t)/100,valueLabelDisplay:"auto",marks:a,min:t,max:n,disabled:!!e,onChange:o=>{const p=o.target.value;this.setState({_value:p},()=>this.onChange(this.props.attr,p))}}),this.props.schema.help?i().createElement(l.Typography,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const us=ls;function gt(w,s){return w==="edit"||w==="rename"?i().createElement(u.Edit,{style:s}):w==="delete"?i().createElement(u.Delete,{style:s}):w==="refresh"?i().createElement(u.Refresh,{style:s}):w==="newDevice"||w==="new"||w==="add"?i().createElement(u.Add,{style:s}):w==="discover"||w==="search"?i().createElement(u.Search,{style:s}):w==="unpairDevice"||w==="unpair"?i().createElement(u.LinkOff,{style:s}):w==="pairDevice"||w==="pair"?i().createElement(u.Link,{style:s}):w==="identify"?i().createElement(u.NotListedLocation,{style:s}):w==="play"?i().createElement(u.PlayArrow,{style:s}):w==="stop"?i().createElement(u.Stop,{style:s}):w==="pause"?i().createElement(u.Pause,{style:s}):w==="forward"||w==="next"?i().createElement(u.FastForward,{style:s}):w==="rewind"||w==="previous"?i().createElement(u.FastRewind,{style:s}):w==="lamp"||w==="light"?i().createElement(u.Lightbulb,{style:s}):w==="backlight"?i().createElement(u.Fluorescent,{style:s}):w==="dimmer"?i().createElement(u.WbIncandescent,{style:s}):w==="socket"?i().createElement(u.Power,{style:s}):w==="settings"?i().createElement(u.Settings,{style:s}):w==="users"||w==="group"?i().createElement(u.Group,{style:s}):w==="user"?i().createElement(u.Person,{style:s}):w==="qrcode"?i().createElement(u.QrCode,{style:s}):w==="connection"?i().createElement(u.Wifi,{style:s}):w==="no-connection"?i().createElement(u.WifiOff,{style:s}):w==="visible"?i().createElement(u.Visibility,{style:s}):null}class cn extends m{constructor(){super(...arguments);X(this,"controlTimeout",null);X(this,"delayedUpdate",{timer:null,value:null});X(this,"onStateChanged",(e,t)=>{let n=t?t.val:null;this.state.controlType==="button"||this.state.controlType==="switch"?(n=!!n,this.state.stateValue!==n&&this.setState({stateValue:n})):n!==null&&(this.state.controlType==="slider"||this.state.controlType==="number")?(n=parseFloat(n),console.log(`${Date.now()} Received new value: ${n}`),n!==this.state.stateValue?(this.delayedUpdate.timer&&(clearTimeout(this.delayedUpdate.timer),this.delayedUpdate.timer=null),this.delayedUpdate.value=n,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()!==n.toString()&&this.setState({stateValue:n})})}getObjectID(){return`${this.props.schema.system?"system.adapter.":""}${this.props.adapterName}.${this.props.instance}.${this.props.schema.oid}`}componentDidMount(){return ae(this,null,function*(){Re(cn.prototype,this,"componentDidMount").call(this);const e=yield this.props.socket.getObject(this.getObjectID()),t=this.props.schema.control||(yield this.detectType(e)),n=yield this.props.socket.getState(this.getObjectID());this.setState({stateValue:n?n.val:null,controlType:t,obj:e},()=>ae(this,null,function*(){yield this.props.socket.subscribeState(this.getObjectID(),this.onStateChanged)}))})}componentWillUnmount(){super.componentWillUnmount(),this.props.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.socket.setState(this.getObjectID(),this.state.stateValue,!1).catch(e=>console.error(`Cannot control value: ${e}`)))}detectType(e){return ae(this,null,function*(){if(e=e||{},e.common=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.max!==void 0?"slider":"input":"text":e.common.write&&this.props.schema.controlled!==!1?"input":"text"})}renderItem(){if(!this.state.obj)return null;let e;if(this.state.controlType==="button"){let t=null;this.props.schema.falseImage&&(t=gt(this.props.schema.falseImage));const n=this.getText(this.props.schema.falseText,this.props.schema.noTranslation)||this.getText(this.props.schema.label,this.props.schema.noTranslation);!n&&t?e=i().createElement(l.IconButton,{style:this.props.schema.falseTextStyle,onClick:()=>ae(this,null,function*(){this.props.schema.confirm?this.setState({confirmDialog:!0,confirmCallback:r=>ae(this,null,function*(){r&&(yield this.props.socket.setState(this.getObjectID(),!0,!1))})}):yield this.props.socket.setState(this.getObjectID(),!0,!1)})},t):e=i().createElement(l.Button,{variant:this.props.schema.variant||"contained",startIcon:t,style:this.props.schema.falseTextStyle,onClick:()=>ae(this,null,function*(){this.props.schema.confirm?this.setState({confirmDialog:!0,confirmCallback:r=>ae(this,null,function*(){r&&(yield this.props.socket.setState(this.getObjectID(),!0,!1))})}):yield this.props.socket.setState(this.getObjectID(),!0,!1)})},n||this.getObjectID().split(".").pop())}else if(this.state.controlType==="switch"){let t=null;const n=this.getText(this.props.schema.falseText,this.props.schema.noTranslation);this.props.schema.falseImage&&(t=gt(this.props.schema.falseImage,n?{marginLeft:8}:void 0));let r=null;const a=this.getText(this.props.schema.trueText,this.props.schema.noTranslation);this.props.schema.trueImage&&(r=gt(this.props.schema.trueImage,a?{marginRight:8}:void 0)),e=i().createElement(l.Switch,{checked:!!this.state.stateValue,onChange:()=>ae(this,null,function*(){this.props.schema.confirm?this.setState({confirmDialog:!0,confirmCallback:p=>ae(this,null,function*(){p&&(yield this.props.socket.setState(this.getObjectID(),!this.state.stateValue,!1))})}):yield this.props.socket.setState(this.getObjectID(),!this.state.stateValue,!1)})}),(n||t||a||r)&&(e=i().createElement("div",{style:{display:"flex",alignItems:"center",fontSize:14}},i().createElement("span",{style:this.props.schema.falseTextStyle},n,t),e,i().createElement("span",{style:this.props.schema.trueTextStyle},r,a)));const o=this.getText(this.props.schema.label,this.props.schema.noTranslation);o&&(e=i().createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"1rem"}},i().createElement("span",{style:{marginRight:8}},o),e))}else if(this.state.controlType==="slider"){let t=null;const n=this.getText(this.props.schema.falseText,this.props.schema.noTranslation);this.props.schema.falseImage&&(t=gt(this.props.schema.falseImage,n?{marginLeft:8}:void 0));let r=null;const a=this.getText(this.props.schema.trueText,this.props.schema.noTranslation);this.props.schema.trueImage&&(r=gt(this.props.schema.trueImage,a?{marginRight:8}:void 0));const o=this.props.schema.min===void 0?this.state.obj.common.min||0:this.props.schema.min,p=this.props.schema.max===void 0?this.state.obj.common.max===void 0?100:this.state.obj.common.max:this.props.schema.max,O=this.props.schema.step===void 0?this.state.obj.common.step||1:this.props.schema.step;e=i().createElement(l.Slider,{style:{width:"100%",flexGrow:1},min:o,max:p,step:O,value:this.state.stateValue,valueLabelDisplay:"auto",valueLabelFormat:J=>`${J}${this.getText(this.props.schema.unit,this.props.schema.noTranslation)||this.state.obj.common.unit||""}`,onChange:(J,q)=>{this.setState({stateValue:q},()=>ae(this,null,function*(){this.controlTimeout&&clearTimeout(this.controlTimeout),this.controlTimeout=setTimeout(()=>ae(this,null,function*(){console.log(`${Date.now()} Send new value: ${this.state.stateValue}`),this.controlTimeout=null,yield this.props.socket.setState(this.getObjectID(),this.state.stateValue,!1)}),this.props.schema.controlDelay||0)}))}}),(n||t||a||r)&&(e=i().createElement("div",{style:{display:"flex",width:"100%",flexGrow:1,alignItems:"center"}},i().createElement("span",{style:Y({marginRight:16},this.props.schema.falseTextStyle)},n,t),e,i().createElement("span",{style:Y({marginLeft:16},this.props.schema.trueTextStyle)},r,a)));const U=this.getText(this.props.schema.label,this.props.schema.noTranslation);U&&(e=i().createElement("div",{style:{display:"flex",width:"100%",alignItems:"center"}},i().createElement("span",{style:{whiteSpace:"nowrap",marginRight:8,fontSize:"1rem"}},U),e))}else if(this.state.controlType==="input")e=i().createElement(l.TextField,{style:{width:"100%"},value:this.state.stateValue,variant:"standard",InputProps:{endAdornment:this.getText(this.props.schema.unit,this.props.schema.noTranslation)||this.state.obj.common.unit||void 0},onChange:t=>{this.setState({stateValue:t.target.value},()=>ae(this,null,function*(){this.controlTimeout&&clearTimeout(this.controlTimeout),this.controlTimeout=setTimeout(()=>ae(this,null,function*(){this.controlTimeout=null,yield this.props.socket.setState(this.getObjectID(),this.state.stateValue,!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)});else if(this.state.obj.common.type==="number"){const t=this.props.schema.min===void 0?this.state.obj.common.min||0:this.props.schema.min,n=this.props.schema.max===void 0?this.state.obj.common.max===void 0?100:this.state.obj.common.max:this.props.schema.max,r=this.props.schema.step===void 0?this.state.obj.common.step||1:this.props.schema.step;e=i().createElement(l.TextField,{variant:"standard",style:{width:"100%"},value:this.state.stateValue,type:"number",inputProps:{min:t,max:n,step:r},InputProps:{endAdornment:this.getText(this.props.schema.unit,this.props.schema.noTranslation)||this.state.obj.common.unit||void 0},onChange:a=>{this.setState({stateValue:a.target.value},()=>ae(this,null,function*(){this.controlTimeout&&clearTimeout(this.controlTimeout),this.controlTimeout=setTimeout(()=>ae(this,null,function*(){this.controlTimeout=null;const o=parseFloat(this.state.stateValue);yield this.props.socket.setState(this.getObjectID(),o,!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)})}else if(this.state.obj.common.type==="boolean"){let t=null,n,r;this.state.stateValue?(n=this.getText(this.props.schema.trueText,this.props.schema.noTranslation),this.props.schema.trueImage&&(t=gt(this.props.schema.falseImage,n?{marginRight:8}:void 0)),r=this.props.schema.trueTextStyle):(n=this.getText(this.props.schema.falseText,this.props.schema.noTranslation),this.props.schema.falseImage&&(t=gt(this.props.schema.falseImage,n?{marginLeft:8}:void 0)),r=this.props.schema.falseTextStyle);const a=this.getText(this.props.schema.label,this.props.schema.noTranslation);e=i().createElement("div",{style:Y({fontSize:"1rem"},r)},a,a?i().createElement("span",{style:{marginRight:8}},":"):null,t,n||(this.state.stateValue?c.I18n.t("ra_true"):c.I18n.t("ra_false")))}else{const t=this.getText(this.props.schema.label,this.props.schema.noTranslation),n=this.getText(this.props.schema.unit,this.props.schema.noTranslation)||this.state.obj.common.unit;let r;this.state.controlType==="html"?r=i().createElement("span",{dangerouslySetInnerHTML:{__html:this.state.stateValue}}):this.state.stateValue===null?r="null":this.state.stateValue===void 0?r="undefined":r=this.state.stateValue,e=i().createElement("div",{style:{fontSize:"1rem"}},t,t?i().createElement("span",{style:{marginRight:8}},":"):null,r,n?i().createElement("span",{style:{opacity:.7}},n):null)}return e}}const cs=cn,hn={fullWidth:w=>({width:"100%",backgroundColor:w.palette.mode==="dark"?"#FFF":"#000",borderStyle:"hidden"}),primary:w=>({backgroundColor:w.palette.primary.main}),secondary:w=>({backgroundColor:w.palette.secondary.main})};class hs extends m{renderItem(){return i().createElement(l.Box,{component:"hr",sx:te.getStyle(this.props.theme,hn.fullWidth,this.props.schema.color==="primary"?hn.primary:this.props.schema.color==="secondary"?hn.secondary:{backgroundColor:this.props.schema.color||(this.props.themeType==="dark"?"#333":"#ddd")},{height:this.props.schema.color?this.props.schema.height||2:this.props.schema.height||1})})}}const ps=hs,Nt={header:w=>({width:"100%",background:w.palette.primary.main,color:w.palette.primary.contrastText,padding:"4px !important",borderRadius:"3px",marginBlockEnd:0,marginBlockStart:0})};class ds extends m{renderItem(){switch((this.props.schema.size||5).toString()){case"1":return i().createElement(l.Box,{component:"h1",sx:Nt.header},this.getText(this.props.schema.text,this.props.schema.noTranslation));case"2":return i().createElement(l.Box,{component:"h2",sx:Nt.header},this.getText(this.props.schema.text,this.props.schema.noTranslation));case"3":return i().createElement(l.Box,{component:"h3",sx:Nt.header},this.getText(this.props.schema.text,this.props.schema.noTranslation));case"4":return i().createElement(l.Box,{component:"h4",sx:Nt.header},this.getText(this.props.schema.text,this.props.schema.noTranslation));case"5":default:return i().createElement(l.Box,{component:"h5",sx:Nt.header},this.getText(this.props.schema.text,this.props.schema.noTranslation))}}}const ms=ds;class fs extends m{renderItem(){let s=this.props.schema.src;return s&&!s.startsWith(".")&&!s.startsWith("http")&&!s.startsWith(`adapter/${this.props.adapterName}/`)&&!s.startsWith(`./adapter/${this.props.adapterName}/`)&&(s=`adapter/${this.props.adapterName}/${s}`),i().createElement("img",{src:s,style:{cursor:this.props.schema.href?"pointer":void 0,width:"100%",height:"100%"},onClick:this.props.schema.href?()=>this.props.schema.href&&window.open(this.props.schema.href,"_blank"):null,alt:""})}}const gs=fs,Sn={fullWidth:{height:"100%",width:"100%"},link:w=>({textDecoration:"underline",color:w.palette.mode==="dark"?"#4dabf5":"#254e72",cursor:"pointer"})};function Tn(w,s,e){let t,n="";w?w.toString().startsWith("#")||w.toString().startsWith("/")?(t=s||"_self",n=w):w.startsWith("http://")||w.startsWith("https://")?(t=s||"_blank",n=w):(n=`#tab-instances/config/${e}/${w}`,t=s||"_self"):(n=`#tab-instances/config/${e}`,t=s||"_self"),t==="_self"?setTimeout(r=>{r.startsWith("#")?window.location.hash=r:r.startsWith("/")?n=`${window.location.protocol}:${window.location.host}${n}`:(r.startsWith("http://")||r.startsWith("https://"))&&(window.location.href=r)},100,n):(n.startsWith("#")?n=`${window.location.protocol}:${window.location.host}${window.location.pathname}${n}`:n.startsWith("/")&&(n=`${window.location.protocol}:${window.location.host}${n}`),window.open(n,t))}class Ds extends m{renderItem(s,e){if(this.props.schema.button){const n=this.getIcon();return i().createElement(l.Button,{variant:this.props.schema.variant||void 0,color:this.props.schema.color||"grey",style:Y(Y({},Sn.fullWidth),this.props.schema.controlStyle||void 0),disabled:e,startIcon:n,onClick:this.props.schema.href?()=>{const r=this.props.schema.href?this.getText(this.props.schema.href,!0):null;r&&(this.props.onBackEndCommand?this.props.onBackEndCommand({command:"link",url:r,target:this.props.schema.target,close:this.props.schema.close}):Tn(r,this.props.schema.target,`${this.props.adapterName}.${this.props.instance}`))}:null},this.getText(this.props.schema.text||this.props.schema.label,this.props.schema.noTranslation))}let t=this.getText(this.props.schema.text||this.props.schema.label,this.props.schema.noTranslation);return t&&(t.includes("<a ")||t.includes("<br")||t.includes("<b>")||t.includes("<i>"))&&(t=c.Utils.renderTextWithA(t)),i().createElement(l.Box,{component:"span",style:Y({},this.props.schema.controlStyle||void 0),sx:this.props.schema.href?Sn.link:void 0,onClick:this.props.schema.href?()=>{const n=this.props.schema.href?this.getText(this.props.schema.href,!0):null;n&&(this.props.onBackEndCommand?this.props.onBackEndCommand({command:"link",url:n,target:this.props.schema.target||"_blank",close:this.props.schema.close}):Tn(n,this.props.schema.target||"_blank",`${this.props.adapterName}.${this.props.instance}`))}:null},t)}}const In=Ds,pn=1024*1024,Fe={fullWidth:{width:"100%"},root:{width:"100%"},paper:{width:"100%",marginBottom:16,backgroundColor:"rgba(255, 255, 255, 0.1)"},headerText:{width:"100%"},table:{minWidth:750},visuallyHidden:{border:0,clip:"rect(0 0 0 0)",height:1,margin:-1,overflow:"hidden",padding:0,position:"absolute",top:20,width:1},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)"},image:{objectFit:"contain",margin:"auto",display:"flex",width:"100%",height:"100%"},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"},buttonRemoveWrapper:{position:"absolute",zIndex:222,right:0},error:{border:"2px solid red",boxSizing:"border-box"},tooltip:{pointerEvents:"none"}};function vs(w,s,e){s=s||"key";const t=[];return Object.keys(w).forEach(n=>{const r={};r[s]=n,e?(r[e]=w[n],t.push(r)):t.push(Object.assign(r,w[n]))}),t}function _n(w,s,e){s=s||"key";const t={};return w.forEach(n=>{let r=n[s];r==null&&(r=""),delete n[s],e?t[r]=n[e]:t[r]=n}),t}function Cs(w,s){let e="";for(let t=0;t<s.length;t++)e+=String.fromCharCode(w[t%w.length].charCodeAt(0)^s.charCodeAt(t));return e}function ys(w,s){let e="";for(let t=0;t<s.length;t++)e+=String.fromCharCode(w[t%w.length].charCodeAt(0)^s.charCodeAt(t));return e}class ze extends m{constructor(e){super(e);X(this,"filterRefs");X(this,"typingTimer",null);X(this,"secret","Zgfr56gFe87jJOM");X(this,"handleRequestSort",(e,t=!1)=>{const{order:n,orderBy:r}=this.state;if(r){const o=t?n:r===e&&n==="asc"?"desc":"asc",p=this.stableSort(o,e);this.setState({order:o,orderBy:e,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,p))}});X(this,"stableSort",(e,t)=>{const{value:n}=this.state,r=ze.getComparator(e,t),a=n.map((o,p)=>({el:o,index:p}));return a.sort((o,p)=>{const O=r(o.el,p.el);return O!==0?O:o.index-p.index}),a.map(o=>o.el)});X(this,"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.applyFilter(!1,null,()=>this.onChangeWrapper(t)))});X(this,"onClone",e=>()=>{const t=JSON.parse(JSON.stringify(this.state.value)),n=JSON.parse(JSON.stringify(t[e]));if(typeof this.props.schema.clone=="string"&&typeof n[this.props.schema.clone]=="string"){let r=1,a=n[this.props.schema.clone];const o=a.match(/(\d+)$/);for(o?(a=a.replace(o[0],""),r=parseInt(o[0],10)+1):a+="_";t.find(p=>p[this.props.schema.clone]===a+r.toString());)r++;n[this.props.schema.clone]=`${n[this.props.schema.clone]}_${r}`}t.splice(e,0,n),this.setState({value:t,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(t)))});X(this,"onChangeWrapper",(e,t)=>{this.typingTimer&&clearTimeout(this.typingTimer),this.typingTimer=setTimeout((n,r)=>{if(this.typingTimer=null,this.props.schema.encryptedAttributes){const a=JSON.parse(JSON.stringify(n));if(a.forEach(o=>{this.props.schema.encryptedAttributes.forEach(p=>{o[p]&&(o[p]=Cs(this.secret,o[p]))})}),this.props.schema.objKeyName){const o=_n(a,this.props.schema.objKeyName,this.props.schema.objValueName);this.onChange(this.props.attr,o)}else this.onChange(this.props.attr,a)}else if(this.props.schema.objKeyName){const a=_n(JSON.parse(JSON.stringify(n)),this.props.schema.objKeyName,this.props.schema.objValueName);this.onChange(this.props.attr,a)}else this.onChange(this.props.attr,n);r&&(this.applyFilter(!1,n),this.handleRequestSort(this.state.orderBy,!0))},300,e,t)});X(this,"onAdd",()=>{var r;const{schema:e}=this.props,t=JSON.parse(JSON.stringify(this.state.value)),n=(r=e.items)==null?void 0:r.reduce((a,o)=>{let p;return o.defaultFunc?this.props.custom?p=o.defaultFunc?this.executeCustom(o.defaultFunc,this.props.data,this.props.customObj,this.props.instanceObj,t.length,this.props.data):this.props.schema.default:p=o.defaultFunc?this.execute(o.defaultFunc,this.props.schema.default,this.props.data,t.length,this.props.data):this.props.schema.default:p=o.default===void 0?null:o.default,a[o.attr]=p,a},{});t.push(n),this.setState({value:t},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(t)))});X(this,"applyFilter",(e,t,n)=>{t=t||this.state.value;let r=t.map((a,o)=>o);if(Object.keys(this.filterRefs).forEach(a=>{let o=ze.getFilterValue(this.filterRefs[a]);!e&&o?(o=o.toLowerCase(),r=r.filter(p=>t[p]&&t[p][a]&&t[p][a].toLowerCase().includes(o))):this.filterRefs[a].current&&ze.setFilterValue(this.filterRefs[a],"")}),r.length===t.length&&(r=null),r===null&&this.state.visibleValue===null){n&&n();return}JSON.stringify(r)!==JSON.stringify(this.state.visibleValue)?this.setState({visibleValue:r},()=>n&&n()):n&&n()});this.filterRefs={},this.props.schema.items=this.props.schema.items||[],this.props.schema.items.forEach(t=>{t.filter&&(this.filterRefs[t.attr]=(0,S.createRef)())})}componentDidMount(){return ae(this,null,function*(){Re(ze.prototype,this,"componentDidMount").call(this);const e=m.getValue(this.props.data,this.props.attr)||[];let t;if(this.props.schema.objKeyName?t=vs(e,this.props.schema.objKeyName,this.props.schema.objValueName):t=e,Array.isArray(t)||(t=[]),this.props.schema.encryptedAttributes){const n=yield this.props.socket.getCompactSystemConfig();this.secret=(n==null?void 0:n.native.secret)||this.secret,e.forEach(r=>{this.props.schema.encryptedAttributes.forEach(a=>{r[a]&&(r[a]=ys(this.secret,r[a]))})})}this.setState({value:t,visibleValue:null,orderBy:"",order:"asc",iteration:0,filterOn:[]},()=>this.validateUniqueProps())})}componentWillUnmount(){this.typingTimer&&(clearTimeout(this.typingTimer),this.typingTimer=null),super.componentWillUnmount()}itemTable(e,t,n){const{schema:r}=this.props,a=r.items&&r.items.find(p=>p.attr===e);if(!a)return null;const o={items:{[e]:a}};return i().createElement(Lt,{index:n+this.state.iteration,arrayIndex:n,changed:this.props.changed,globalData:this.props.data,socket:this.props.socket,adapterName:this.props.adapterName,instance:this.props.instance,common:this.props.common,alive:this.props.alive,themeType:this.props.themeType,themeName:this.props.themeName,data:t,table:!0,custom:!0,schema:o,systemConfig:this.props.systemConfig,dateFormat:this.props.dateFormat,isFloatComma:this.props.isFloatComma,imagePrefix:this.props.imagePrefix,onCommandRunning:this.props.onCommandRunning,forceUpdate:this.props.forceUpdate,originalData:this.props.originalData,customs:this.props.customs,theme:this.props.theme,DeviceManager:this.props.DeviceManager,onChange:(p,O)=>{const U=JSON.parse(JSON.stringify(this.state.value));U[n][p]=O,this.setState({value:U},()=>{this.validateUniqueProps(),this.onChangeWrapper(U,!0)})},onError:(p,O)=>this.onError(p,O),onBackEndCommand:this.props.onBackEndCommand})}validateUniqueProps(){if(this.props.schema.uniqueColumns)for(const e of this.props.schema.uniqueColumns){const t=[];this.state.value.find(r=>{const a=r[e];return t.includes(a)?(this.onError(e,"is not unique"),this.setState({errorMessage:c.I18n.t('Non-allowed duplicate entry "%s" in column "%s"',a,e)}),!0):(t.push(a),!1)})||(this.onError(e,null),this.setState({errorMessage:""}))}}static descendingComparator(e,t,n){return t[n]<e[n]?-1:t[n]>e[n]?1:0}static getComparator(e,t){return e==="desc"?(n,r)=>ze.descendingComparator(n,r,t):(n,r)=>-ze.descendingComparator(n,r,t)}static getFilterValue(e){var t,n,r;return(r=(n=(t=e==null?void 0:e.current)==null?void 0:t.children[0])==null?void 0:n.children[0])==null?void 0:r.value}static setFilterValue(e,t){return e.current.children[0].children[0].value=t}enhancedTableHead(e,t){const{schema:n}=this.props,{order:r,orderBy:a}=this.state;return i().createElement(l.TableHead,null,i().createElement(l.TableRow,null,n.items&&n.items.map((o,p)=>i().createElement(l.TableCell,{style:{width:(typeof o.width=="string"&&o.width.endsWith("%"),o.width)},key:`${o.attr}_${p}`,align:"left",sortDirection:a===o.attr?r:!1},i().createElement("div",{style:Y(Y({},Fe.flex),n.showFirstAddOnTop?{flexDirection:"column"}:void 0)},!p&&!n.noDelete?i().createElement(l.Tooltip,{title:t?c.I18n.t("ra_Cannot add items with set filter"):c.I18n.t("ra_Add row"),slotProps:{popper:{sx:Fe.tooltip}}},i().createElement("span",null,i().createElement(l.IconButton,{size:"small",color:"primary",disabled:!!t&&!this.props.schema.allowAddByFilter,onClick:this.onAdd},i().createElement(u.Add,null)))):null,o.sort&&i().createElement(l.TableSortLabel,{active:!0,style:a!==o.attr?Fe.silver:void 0,direction:a===o.attr?r:"asc",onClick:()=>this.handleRequestSort(o.attr)}),o.filter&&this.state.filterOn.includes(o.attr)?i().createElement(l.TextField,{variant:"standard",ref:this.filterRefs[o.attr],onChange:()=>this.applyFilter(),title:c.I18n.t("ra_You can filter entries by entering here some text"),InputProps:{endAdornment:ze.getFilterValue(this.filterRefs[o.attr])&&i().createElement(l.InputAdornment,{position:"end"},i().createElement(l.IconButton,{size:"small",onClick:()=>{ze.setFilterValue(this.filterRefs[o.attr],""),this.applyFilter()}},i().createElement(u.Close,null)))},fullWidth:!0,placeholder:this.getText(o.title)}):i().createElement("span",{style:Fe.headerText},this.getText(o.title)),o.filter?i().createElement(l.IconButton,{title:c.I18n.t("ra_Show/hide filter input"),size:"small",onClick:()=>{const O=[...this.state.filterOn],U=this.state.filterOn.indexOf(o.attr);U===-1?O.push(o.attr):O.splice(U,1),this.setState({filterOn:O},()=>{U&&ze.getFilterValue(this.filterRefs[o.attr])&&(ze.setFilterValue(this.filterRefs[o.attr],""),this.applyFilter())})}},this.state.filterOn.includes(o.attr)?i().createElement(u.FilterAltOff,null):i().createElement(u.FilterAlt,null)):null))),!n.noDelete&&i().createElement(l.TableCell,{style:{paddingLeft:20,paddingRight:20,width:e,textAlign:"right"},padding:"checkbox"},n.import?i().createElement(l.IconButton,{style:{marginRight:10},size:"small",onClick:()=>this.setState({showImportDialog:!0}),title:c.I18n.t("ra_import data from %s file","CSV")},i().createElement(u.UploadFile,null)):null,n.export?i().createElement(l.IconButton,{style:{marginRight:10},size:"small",onClick:()=>this.onExport(),title:c.I18n.t("ra_Export data to %s file","CSV")},i().createElement(u.Download,null)):null,i().createElement(l.IconButton,{disabled:!0,size:"small"},i().createElement(u.Delete,null)))))}onExport(){const{schema:e}=this.props,{value:t}=this.state,r=[e.items.map(p=>p.attr).join(";")];t.forEach(p=>{const O=[];e.items.forEach(U=>{var J;(J=p[U.attr])!=null&&J.includes(";")?O.push(`"${p[U.attr]}"`):O.push(p[U.attr]===void 0||p[U.attr]===null?"":p[U.attr])}),r.push(O.join(";"))});const a=document.createElement("a");a.setAttribute("href",`data:text/csv;charset=utf-8,${encodeURIComponent(r.join(`
`))}`);const o=new Date;a.setAttribute("download",`${o.getFullYear()}_${(o.getMonth()+1).toString().padStart(2,"0")}_${o.getDate().toString().padStart(2,"0")}_${this.props.adapterName}.${this.props.instance}_${this.props.attr}.csv`),a.style.display="none",document.body.appendChild(a),a.click(),document.body.removeChild(a)}onImport(e){var o;const t=e.split(`
`).map(p=>p.replace("\r","").trim()),{schema:n}=this.props,r=t.shift().split(";").filter(p=>p&&n.items.find(O=>O.attr===p)),a=[];t.forEach(p=>{const O=p.split(";"),U={};for(let J=0;J<O.length;J++){let q=O[J];if(q.startsWith('"')){for(q=q.substring(1);J<O.length&&!q.endsWith('"');)q+=`;${O[++J]}`;q=q.substring(0,q.length-1)}let he=q;if(q==="true")he=!0;else if(q==="false")he=!1;else if(window.isFinite(q)){const Ee=this.props.schema.items.find(se=>se.attr===r[J]);Ee&&Ee.type==="number"?he=parseFloat(q):he=q}else he=q;U[r[J]]=he}a.push(U)}),a.length?(o=this.state.value)!=null&&o.length?this.setState({showTypeOfImportDialog:a,showImportDialog:!1}):this.setState({value:a,showImportDialog:!1}):window.alert("ra_No data found in file")}isAnyFilterSet(){return!!Object.keys(this.filterRefs).find(e=>ze.getFilterValue(this.filterRefs[e]))}onMoveUp(e){const t=JSON.parse(JSON.stringify(this.state.value)),n=t[e];t.splice(e,1),t.splice(e-1,0,n),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)),n=t[e];t.splice(e,1),t.splice(e+1,0,n),this.setState({value:t,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(t)))}onDrop(e){const t=e[0],n=new FileReader;n.onabort=()=>console.log("file reading was aborted"),n.onerror=()=>console.log("file reading has failed"),n.onload=()=>{if(t.size>pn){window.alert(c.I18n.t("ra_File is too big. Max %sk allowed. Try use SVG.",Math.round(pn/1024)));return}const r=new Uint8Array(n.result).reduce((a,o)=>a+String.fromCharCode(o),"");this.onImport(r)},n.readAsArrayBuffer(t)}showTypeOfImportDialog(){return this.state.showTypeOfImportDialog?i().createElement(l.Dialog,{open:!0,onClose:()=>this.setState({showTypeOfImportDialog:!1}),maxWidth:"md"},i().createElement(l.DialogTitle,null,c.I18n.t("ra_Append or replace?")),i().createElement(l.DialogContent,null,c.I18n.t("ra_Append %s entries or replace existing?",this.state.showTypeOfImportDialog.length)),i().createElement(l.DialogActions,null,i().createElement(l.Button,{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)))}},c.I18n.t("ra_Append")),i().createElement(l.Button,{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)))}},c.I18n.t("ra_Replace")))):null}showImportDialog(){return this.state.showImportDialog?i().createElement(l.Dialog,{open:!0,onClose:()=>this.setState({showImportDialog:!1}),sx:{"& .MuiDialog-paper":{minHeight:500}},maxWidth:"md",fullWidth:!0},i().createElement(l.DialogTitle,null,c.I18n.t("ra_Import from %s","CSV")),i().createElement(l.DialogContent,null,i().createElement(it(),{multiple:!1,accept:{"text/csv":[".csv"]},maxSize:pn,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||c.I18n.t("ra_Cannot upload"))}},({getRootProps:e,getInputProps:t})=>i().createElement("div",Y({style:Y(Y(Y(Y({},Fe.uploadDiv),this.state.uploadFile==="dragging"?Fe.uploadDivDragging:void 0),Fe.dropZone),this.state.icon?void 0:Fe.dropZoneEmpty)},e()),i().createElement("input",Y({},t())),i().createElement("div",{style:Fe.uploadCenterDiv},i().createElement("div",{style:Fe.uploadCenterTextAndIcon},i().createElement(u.UploadFile,{style:Fe.uploadCenterIcon}),i().createElement("div",{style:Fe.uploadCenterText},this.state.uploadFile==="dragging"?c.I18n.t("ra_Drop file here"):c.I18n.t("ra_Place your files here or click here to open the browse dialog"))))))),i().createElement(l.DialogActions,null,i().createElement(l.Button,{variant:"contained",onClick:()=>this.setState({showImportDialog:!1}),color:"primary",startIcon:i().createElement(u.Close,null)},c.I18n.t("Cancel")))):null}renderItem(){const{schema:e}=this.props;let{visibleValue:t}=this.state;if(!this.state.value||!Array.isArray(this.state.value))return null;t=t||this.state.value.map((a,o)=>o);const n=this.isAnyFilterSet();let r;return this.props.schema.compact&&(r={paddingTop:1,paddingBottom:1}),i().createElement(l.Paper,{style:Fe.paper},this.showImportDialog(),this.showTypeOfImportDialog(),e.label?i().createElement("div",{style:Fe.label},i().createElement(l.Toolbar,{variant:"dense",style:Fe.rootTool},i().createElement(l.Typography,{style:Fe.title,variant:"h6",id:"tableTitle",component:"div"},this.getText(e.label)))):null,i().createElement(l.TableContainer,null,i().createElement(l.Table,{style:Fe.table,size:"small"},this.enhancedTableHead(!n&&!this.state.orderBy?120:64,n),i().createElement(l.TableBody,null,t.map((a,o)=>i().createElement(l.TableRow,{hover:!0,key:`${a}_${o}`},e.items&&e.items.map(p=>i().createElement(l.TableCell,{key:`${p.attr}_${a}`,align:"left",style:r},this.itemTable(p.attr,this.state.value[a],a))),!e.noDelete&&i().createElement(l.TableCell,{align:"left",style:Y(Y({},r),Fe.buttonCell)},!n&&!this.state.orderBy?o?i().createElement(l.Tooltip,{title:c.I18n.t("ra_Move up"),slotProps:{popper:{sx:Fe.tooltip}}},i().createElement(l.IconButton,{size:"small",onClick:()=>this.onMoveUp(a)},i().createElement(u.ArrowUpward,null))):i().createElement("div",{style:Fe.buttonEmpty}):null,!n&&!this.state.orderBy?o<t.length-1?i().createElement(l.Tooltip,{title:c.I18n.t("ra_Move down"),slotProps:{popper:{sx:Fe.tooltip}}},i().createElement(l.IconButton,{size:"small",onClick:()=>this.onMoveDown(a)},i().createElement(u.ArrowDownward,null))):i().createElement("div",{style:Fe.buttonEmpty}):null,i().createElement(l.Tooltip,{title:c.I18n.t("ra_Delete current row"),slotProps:{popper:{sx:Fe.tooltip}}},i().createElement(l.IconButton,{size:"small",onClick:this.onDelete(a)},i().createElement(u.Delete,null))),this.props.schema.clone?i().createElement(l.Tooltip,{title:c.I18n.t("ra_Clone current row"),slotProps:{popper:{sx:Fe.tooltip}}},i().createElement(l.IconButton,{size:"small",onClick:this.onClone(a)},i().createElement(u.ContentCopy,null))):null))),!e.noDelete&&t.length>=(e.showSecondAddAt||5)?i().createElement(l.TableRow,null,i().createElement(l.TableCell,{colSpan:e.items.length+1,style:Y({},r)},i().createElement(l.Tooltip,{title:n?c.I18n.t("ra_Cannot add items with set filter"):c.I18n.t("ra_Add row"),slotProps:{popper:{sx:Fe.tooltip}}},i().createElement("span",null,i().createElement(l.IconButton,{size:"small",color:"primary",disabled:!!n&&!this.props.schema.allowAddByFilter,onClick:this.onAdd},i().createElement(u.Add,null)))))):null)),!t.length&&this.state.value.length?i().createElement("div",{style:Fe.filteredOut},i().createElement(l.Typography,{style:Fe.title,variant:"h6",id:"tableTitle",component:"div"},c.I18n.t("ra_All items are filtered out"),i().createElement(l.IconButton,{size:"small",onClick:()=>this.applyFilter(!0)},i().createElement(u.Close,null)))):null),e.help?i().createElement(l.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null,this.state.errorMessage?i().createElement("div",{style:{display:"flex",padding:"5px"}},i().createElement(u.Warning,{color:"error"}),i().createElement("span",{style:{color:"red",alignSelf:"center"}},this.state.errorMessage)):null)}}const Es=ze,Wt={indeterminate:{opacity:.5},label:{width:"100%",fontSize:16},helper:{width:"100%",fontSize:12},error:{width:"100%",fontSize:12,color:"#FF0000"}};class bs extends m{constructor(){super(...arguments);X(this,"updateTimeout",null)}componentDidMount(){super.componentDidMount();let e=m.getValue(this.props.data,this.props.attr);if(Array.isArray(e)&&this.props.multiEdit){e=m.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(n){console.log("Error in JSON",n),t=!0}return t}static getDerivedStateFromProps(e,t){if(e.multiEdit&&t.value===m.DIFFERENT_VALUE)return m.DIFFERENT_VALUE;let n=m.getValue(e.data,e.attr);return n!=null&&(n=n.toString()),n==null||n!==t.value&&n!==t.oldValue?{value:n}:null}renderItem(e,t){const n=Array.isArray(this.state.value)||this.state.value===m.DIFFERENT_VALUE;if(this.props.schema.time){let r="";return typeof this.state.value=="number"?this.state.value&&this.state.value<9466596e5?r=new Date(this.state.value*1e3).toLocaleString():r=new Date(this.state.value).toLocaleString():typeof this.state.value=="string"&&(r=new Date(this.state.value).toLocaleString()),i().createElement(l.TextField,{variant:"standard",fullWidth:!0,value:r,error:!!e||!!this.state.jsonError,disabled:!!t,inputProps:{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),n){const r=m.getValue(this.props.data,this.props.attr),a=(r==null?void 0:r.filter(o=>o||o===0).map(o=>({label:o.toString()||"",value:o})))||[];return a.unshift({label:c.I18n.t(m.DIFFERENT_LABEL),value:m.DIFFERENT_VALUE}),i().createElement(l.Autocomplete,{style:Wt.indeterminate,fullWidth:!0,value:a[0],onChange:(o,p)=>{const O=p?p.value:"";this.onChange(this.props.attr,O,()=>{this.setState({value:O,oldValue:O,jsonError:this.validateJson(p)})})},options:a,getOptionLabel:o=>o.label,renderInput:o=>i().createElement(l.TextField,$e(Y({variant:"standard"},o),{error:!!e,placeholder:this.getText(this.props.schema.placeholder),inputProps:$e(Y({},o.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}))})}if(this.props.schema.minRows>1){const r=this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation);return i().createElement("div",{style:{width:"100%"}},this.props.schema.label?i().createElement("div",{style:Wt.label},this.getText(this.props.schema.label)):null,i().createElement(l.TextareaAutosize,{style:{width:"100%",resize:"vertical",backgroundColor:this.props.themeType==="dark"?"#363636":"#cccccc",color:this.props.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 o=a.target.value;this.setState({value:o,oldValue:this.state.value,jsonError:this.validateJson(o)},()=>this.onChange(this.props.attr,o||""))},placeholder:this.getText(this.props.schema.placeholder)}),r||e||this.state.jsonError?i().createElement("div",{style:e?Wt.error:Wt.helper},e||(this.state.jsonError?c.I18n.t("ra_Invalid JSON"):r)):null)}return i().createElement(l.TextField,{variant:"standard",fullWidth:!0,value:this.state.value===null||this.state.value===void 0?"":this.state.value,error:!!e||!!this.state.jsonError,disabled:!!t,inputProps:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0,readOnly:this.props.schema.readOnly||!1},InputProps:{endAdornment:this.state.value&&!this.props.schema.noClearButton?i().createElement(l.InputAdornment,{position:"end"},i().createElement(l.IconButton,{size:"small",onClick:()=>this.setState({value:"",oldValue:this.state.value},()=>this.onChange(this.props.attr,""))},i().createElement(u.Close,null))):null},onChange:r=>{const a=r.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?c.I18n.t("ra_Invalid JSON"):this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}}const xs=bs,ws={fullWidth:{width:"100%"}};class Fs extends m{constructor(){super(...arguments);X(this,"initialized",!1);X(this,"_context")}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);try{e=JSON.parse(t)}catch(n){console.error(`Cannot parse json data: ${t}`)}}e===void 0&&(e=null),this.props.socket.sendTo(`${this.props.adapterName}.${this.props.instance}`,this.props.schema.command||"send",e).then(t=>{if(typeof t=="object"){const n=t;this.setState({text:n.text||"",style:n.style,icon:n.icon,iconStyle:n.iconStyle})}else typeof t=="string"&&this.setState({text:t||""})})}}getContext(){const e={};return Array.isArray(this.props.schema.alsoDependsOn)&&this.props.schema.alsoDependsOn.forEach(t=>e[t]=m.getValue(this.props.data,t)),JSON.stringify(e)}renderItem(){if(this.props.alive){const t=this.getContext();(t!==this._context||!this.initialized)&&(this._context=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=gt(this.state.icon,Y({marginRight:this.state.text?8:void 0},this.state.iconStyle||void 0)),e||(e=i().createElement(c.Icon,{src:this.state.icon,style:Y({marginRight:this.state.text?8:void 0},this.state.iconStyle||void 0)}))),this.props.schema.container==="text"?i().createElement(l.TextField,{variant:"standard",fullWidth:!0,InputProps:{endAdornment:this.props.schema.copyToClipboard?i().createElement(l.IconButton,{size:"small",onClick:()=>{c.Utils.copyToClipboard(this.state.text),window.alert("Copied")}},i().createElement(c.IconCopy,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)}):i().createElement("div",{style:Y(Y({},ws.fullWidth),this.state.style||void 0)},e,this.props.schema.container==="html"?i().createElement("span",{dangerouslySetInnerHTML:{__html:this.state.text||""}}):this.state.text)}}const As=Fs;class Ss extends m{componentDidMount(){super.componentDidMount();const s=m.getValue(this.props.data,this.props.attr);this.setState({value:s})}renderItem(s,e){const t=this.props.schema.returnFormat!=="HH:mm:ss",n=new Date(Date.parse(`Thu, 01 Jan 1970 ${this.state.value||"00:00:00"}`));return i().createElement(Rt.TimePicker,{sx:r=>({width:"100%",borderBottom:`1px solid ${r.palette.text.primary}`,"& fieldset":{display:"none"},"& input":{padding:`${r.spacing(1.5)} 0 4px 0`},"& .MuiInputAdornment-root":{marginLeft:0,marginTop:1},"& label":{transform:"translate(0px, -9px) scale(0.75)"}}),ampm:this.props.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:!!e,value:n,onChange:r=>{let a;a=r instanceof Date?r.toTimeString().split(" ")[0]:r.toTimeString(),t&&(a=a.split(":").slice(0,2).join(":")),this.setState({value:a},()=>this.onChange(this.props.attr,this.state.value))},views:this.props.schema.views||["hours","minutes","seconds"],label:this.getText(this.props.schema.label)})}}function Ts(w,s){let e;return s&&w.substring(0,s.length)===s?e=w.substring(s.length+1):e=w,e=e.replace(/\./g,"/").replace(/_/g," "),e}class Is extends m{componentDidMount(){var e;super.componentDidMount();const s=m.getValue(this.props.data,this.props.attr);if(!s&&((e=this.props.customObj)!=null&&e._id)){const t=Ts(this.props.customObj._id,`${this.props.adapterName}.${this.props.instance}`);this.setState({value:t})}else this.setState({value:s||""})}renderItem(s,e){return i().createElement(l.TextField,{variant:"standard",fullWidth:!0,inputProps:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0},value:this.state.value,error:!!s,disabled: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),onChange:t=>{const n=t.target.value;this.setState({value:n},()=>this.onChange(this.props.attr,n))}})}}const _s=Is;class dn extends m{componentDidMount(){return ae(this,null,function*(){var e;Re(dn.prototype,this,"componentDidMount").call(this);const s=yield this.props.socket.getObject("system.meta.uuid");this.setState({uuid:((e=s==null?void 0:s.native)==null?void 0:e.uuid)||"unknown"})})}renderItem(s,e){return i().createElement(l.TextField,{variant:"standard",fullWidth:!0,error:!!s,disabled:!!e,inputProps:{readOnly:!0},InputProps:{endAdornment:i().createElement(l.IconButton,{onClick:()=>{c.Utils.copyToClipboard(this.state.uuid),window.alert(c.I18n.t("ra_Copied %s",this.state.uuid))}},i().createElement(u.ContentCopy,null))},value:this.state.uuid||"",label:this.getText(this.props.schema.label)||c.I18n.t("ra_Serial number (UUID)"),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}}const ks=dn,kn={icon:{width:16,height:16,marginRight:8}};class Bs extends m{componentDidMount(){super.componentDidMount(),this.props.socket.getUsers().then(s=>{const e={},t=c.I18n.getLanguage();this.props.schema.short?s.forEach(n=>{var r,a;return e[n._id]={color:(r=n.common)==null?void 0:r.color,icon:(a=n.common)==null?void 0:a.icon,name:c.Utils.getObjectNameFromObj(n,t)}}):s.forEach(n=>{var r,a;return e[n._id.replace(/^system\.user\./,"")]={color:(r=n.common)==null?void 0:r.color,icon:(a=n.common)==null?void 0:a.icon,name:c.Utils.getObjectNameFromObj(n,t)}}),this.setState({users:e})})}renderItem(s,e){var n,r;const t=m.getValue(this.props.data,this.props.attr);return i().createElement(l.FormControl,{variant:"standard",fullWidth:!0},this.state.users&&this.props.schema.label?i().createElement(l.InputLabel,null,this.getText(this.props.schema.label)):null,this.state.users?i().createElement(l.Select,{variant:"standard",error:!!s,disabled:!!e,value:t,renderValue:a=>{var o,p,O;return i().createElement("span",null,this.state.users&&((o=this.state.users[a])!=null&&o.icon)?i().createElement(c.Icon,{src:this.state.users&&((p=this.state.users[a])==null?void 0:p.icon),style:kn.icon}):null,this.state.users&&((O=this.state.users[a])==null?void 0:O.name)||a||"")},style:{color:this.state.users&&((n=this.state.users[t])==null?void 0:n.color)||void 0,backgroundColor:c.Utils.getInvertedColor(this.state.users&&((r=this.state.users[t])==null?void 0:r.color),this.props.themeType)},onChange:a=>this.onChange(this.props.attr,a.target.value)},this.state.users&&Object.keys(this.state.users).map(a=>i().createElement(l.MenuItem,{style:{color:this.state.users[a].color||void 0,backgroundColor:c.Utils.getInvertedColor(this.state.users[a].color,this.props.themeType)},key:a,value:a},this.state.users[a].icon?i().createElement(c.Icon,{src:this.state.users[a].icon,style:kn.icon}):null,this.state.users[a].name))):i().createElement(l.TextField,{variant:"standard",error:!!s,disabled:!!e,value:t,onChange:a=>this.onChange(this.props.attr,a.target.value),label:this.getText(this.props.schema.label)}),this.props.schema.help?i().createElement(l.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Os=Bs;class mn extends m{componentDidMount(){return ae(this,null,function*(){Re(mn.prototype,this,"componentDidMount").call(this);const s=yield G.e("vendors-node_modules_react-qr-code_lib_index_js").then(G.bind(G,10732));this.setState({QRCode:s.default})})}renderItem(){const s=this.state.QRCode;return s?i().createElement(s,{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}):null}}const Ns={accordion:h,alive:b,autocomplete:k,autocompleteSendTo:_,certCollection:z,certificate:Q,certificates:R,checkbox:Ke,checkLicense:ge,chip:Be,chips:Be,color:qt,coordinates:pe,cron:M,custom:De,datePicker:Ze,deviceManager:Mt,divider:ps,file:F,fileSelector:Ot,func:ie,header:ms,image:Oe,imageSendTo:Ce,instance:je,interface:dt,ip:ue,jsonEditor:rn,language:Mn,license:Wn,number:Jn,objectId:jn,password:zn,pattern:Gn,port:Yn,qrCode:mn,room:Zn,select:ts,selectSendTo:is,sendto:wn,sendTo:wn,setState:os,slider:us,state:cs,staticImage:gs,staticLink:In,staticText:In,table:Es,text:xs,textSendTo:As,timePicker:Ss,topic:_s,uuid:ks,user:Os},ut={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:w=>({backgroundColor:w.palette.primary.main,color:w.palette.mode==="dark"?"inherit":"#FFF"}),secondary:w=>({backgroundColor:w.palette.secondary.main})};class fn extends m{componentDidMount(){super.componentDidMount(),this.props.schema&&this.props.schema.collapsable&&this.setState({expanded:(window._localStorage||window.localStorage).getItem(`${this.props.adapterName}.${this.props.attr}`)==="true"})}renderItems(s,e){return s?Object.keys(s).map(t=>{if(this.props.multiEdit&&s[t].noMultiEdit)return null;const n=s[t].type||"panel";let r;return n==="custom"?s[t].url?r=De:this.props.customs&&this.props.customs[s[t].component]?r=this.props.customs[s[t].component]:(console.error(`Cannot find custom component: ${s[t].component}`),r=m):n==="panel"?r=fn:r=Ns[n]||m,i().createElement(r,{key:`${t}_${this.props.index===void 0?"":this.props.index}`,index:this.props.index,changed:this.props.changed,arrayIndex:this.props.arrayIndex,globalData:this.props.globalData,onCommandRunning:this.props.onCommandRunning,commandRunning:this.props.commandRunning,style:ut.panel,socket:this.props.socket,adapterName:this.props.adapterName,instance:this.props.instance,common:this.props.common,customs:this.props.customs,alive:this.props.alive,themeType:this.props.themeType,themeName:this.props.themeName,theme:this.props.theme,data:this.props.data,originalData:this.props.originalData,systemConfig:this.props.systemConfig,onError:this.props.onError,onChange:this.props.onChange,onBackEndCommand:this.props.onBackEndCommand,multiEdit:this.props.multiEdit,dateFormat:this.props.dateFormat,isFloatComma:this.props.isFloatComma,disabled:e,imagePrefix:this.props.imagePrefix,changeLanguage:this.props.changeLanguage,forceUpdate:this.props.forceUpdate,registerOnForceUpdate:this.props.registerOnForceUpdate,customObj:this.props.customObj,instanceObj:this.props.instanceObj,custom:this.props.custom,schema:s[t],DeviceManager:this.props.DeviceManager,attr:t,table:this.props.table})}):null}render(){const s=this.props.schema;if(!s)return null;const{disabled:e,hidden:t}=this.calculate(s),n=this.props.schema.items,r=this.props.schema.style||{};if(t){if(s.hideOnlyControl){const o=i().createElement(l.Grid2,{size:{xs:s.xs||void 0,lg:s.lg||void 0,md:s.md||void 0,sm:s.sm||void 0},sx:te.getStyle(this.props.theme,{marginBottom:0,textAlign:"left"},r,this.props.themeType==="dark"&&s.darkStyle)});return s.newLine?i().createElement(i().Fragment,null,i().createElement("div",{style:{flexBasis:"100%",height:0}}),o):o}return null}if(this.props.table)return this.renderItems(n,e);if(this.props.custom)return i().createElement(l.Grid2,{key:`${this.props.attr}_${this.props.index}`,container:!0,style:ut.fullWidth,spacing:2,sx:r},this.renderItems(n,e));let a;if(s.collapsable?a=i().createElement(l.Accordion,{key:`${this.props.attr}_${this.props.index}`,style:ut.fullWidth,expanded:!!this.state.expanded,onChange:()=>{(window._localStorage||window.localStorage).setItem(`${this.props.adapterName}.${this.props.attr}`,this.state.expanded?"false":"true"),this.setState({expanded:!this.state.expanded})}},i().createElement(l.AccordionSummary,{expandIcon:i().createElement(u.ExpandMore,null),sx:te.getStyle(this.props.theme,r,this.props.themeType&&s.darkStyle,s.color==="primary"?ut.primary:s.color==="secondary"&&ut.secondary,{width:"100%"})},i().createElement(l.Typography,{style:ut.heading},this.getText(s.label))),i().createElement(l.AccordionDetails,null,i().createElement(l.Grid2,{container:!0,spacing:2,sx:$e(Y({},r),{width:"100%",padding:"10px"})},this.renderItems(n,e)))):a=i().createElement(l.Box,{component:"div",key:`${this.props.attr}_${this.props.index}`,className:this.props.className,sx:te.getStyle(this.props.theme,this.props.style,r,{width:"100%"},this.props.isParentTab&&ut.paper,this.props.isParentTab&&(this.props.withIcons?ut.paperWithIcons:ut.paperWithoutIcons))},i().createElement(l.Grid2,{container:!0,spacing:2,sx:te.getStyle(this.props.theme,{width:"100%"},this.props.isParentTab&&ut.padding,this.props.schema.innerStyle)},this.renderItems(n,e))),!this.props.isParentTab){const o=i().createElement(l.Grid2,{title:this.getText(s.tooltip),size:{xs:s.xs||void 0,lg:s.lg||void 0,md:s.md||void 0,sm:s.sm||void 0},sx:Y({marginBottom:0,textAlign:"left"},r)},a);return s.newLine?i().createElement(i().Fragment,null,i().createElement("div",{style:{flexBasis:"100%",height:0}}),o):o}return a}}const Lt=fn,Ut={tabs:{height:"100%",width:"100%"},panel:{width:"100%",display:"block"},panelWithIcons:{height:"calc(100% - 72px)"},panelWithoutIcons:{height:"calc(100% - 48px)"}};class Ls extends m{constructor(e){super(e);X(this,"onHashTabsChanged",()=>{const e=(window.location.hash||"").replace(/^#/,"").split("/");if(e.length>3&&e[1]==="config"){const t=e[3],n=parseInt(t,10);let r;n.toString()===t?n>=0&&n<Object.keys(this.props.schema.items).length&&(r=Object.keys(this.props.schema.items)[n]):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.adapterName}`,r),this.setState({tab:r}))}});let t;if(this.props.root){const n=(window.location.hash||"").replace(/^#/,"").split("/");if(n.length>=3&&n[1]==="config"){const r=n[3],a=parseInt(r,10);r&&a.toString()===r?a>=0&&a<Object.keys(this.props.schema.items).length&&(t=Object.keys(this.props.schema.items)[a]):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.adapterName}`)||Object.keys(this.props.schema.items)[0],Object.keys(this.props.schema.items).includes(t)||(t=Object.keys(this.props.schema.items)[0])),Object.assign(this.state,{tab:t})}componentWillUnmount(){window.removeEventListener("hashchange",this.onHashTabsChanged,!1),super.componentWillUnmount()}render(){const e=this.props.schema.items;let t=!1;return i().createElement("div",{style:Ut.tabs},i().createElement(l.Tabs,{variant:"scrollable",scrollButtons:"auto",style:this.props.schema.tabsStyle,value:this.state.tab,onChange:(n,r)=>{(window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.${this.props.adapterName}`,r),this.setState({tab:r},()=>{if(this.props.root){const a=(window.location.hash||"").split("/");a.length>=3&&a[1]==="config"&&(a[3]=this.state.tab,window.location.hash=a.join("/"))}})}},Object.keys(e).map(n=>{let r;if(this.props.custom){if(this.executeCustom(e[n].hidden,this.props.data,this.props.customObj,this.props.instanceObj,this.props.index,this.props.globalData))return null;r=this.executeCustom(e[n].disabled,this.props.data,this.props.customObj,this.props.instanceObj,this.props.index,this.props.globalData)}else{if(this.execute(e[n].hidden,!1,this.props.data,this.props.index,this.props.globalData))return null;r=this.execute(e[n].disabled,!1,this.props.data,this.props.index,this.props.globalData)}const a=this.getIcon(e[n].icon);return t=t||!!a,i().createElement(l.Tab,{id:n,wrapped:!0,disabled:r,key:n,value:n,iconPosition:this.props.schema.iconPosition||"start",icon:a,label:this.getText(e[n].label)})})),i().createElement(Lt,{isParentTab:!0,changed:this.props.changed,key:this.state.tab,index:1001,arrayIndex:this.props.arrayIndex,globalData:this.props.globalData,onCommandRunning:this.props.onCommandRunning,commandRunning:this.props.commandRunning,style:Y(Y({},Ut.panel),t?Ut.panelWithIcons:Ut.panelWithoutIcons),socket:this.props.socket,adapterName:this.props.adapterName,instance:this.props.instance,common:this.props.common,customs:this.props.customs,alive:this.props.alive,themeType:this.props.themeType,themeName:this.props.themeName,data:this.props.data,originalData:this.props.originalData,systemConfig:this.props.systemConfig,onChange:this.props.onChange,onError:this.props.onError,onBackEndCommand:this.props.onBackEndCommand,multiEdit:this.props.multiEdit,dateFormat:this.props.dateFormat,isFloatComma:this.props.isFloatComma,imagePrefix:this.props.imagePrefix,changeLanguage:this.props.changeLanguage,forceUpdate:this.props.forceUpdate,registerOnForceUpdate:this.props.registerOnForceUpdate,customObj:this.props.customObj,instanceObj:this.props.instanceObj,custom:this.props.custom,schema:e[this.state.tab],table:this.props.table,theme:this.props.theme,DeviceManager:this.props.DeviceManager,withIcons:t}))}}const $s=Ls,Ps={root:{width:"100%",height:"100%"}};class Rs extends S.Component{constructor(e){super(e);X(this,"forceUpdateHandlers");X(this,"errorTimeout",null);X(this,"errorCached",null);X(this,"onCommandRunning",e=>this.setState({commandRunning:e}));X(this,"onAlive",(e,t)=>{!!(t!=null&&t.val)!==this.state.alive&&this.setState({alive:!!(t!=null&&t.val)})});X(this,"onChange",(e,t,n,r)=>{if(this.props.onValueChange)this.props.onValueChange(e,t,r),n&&n();else if(e&&this.props.onChange){const a={changed:JSON.stringify(e)!==this.state.originalData};this.setState(a,()=>{this.props.onChange(e,a.changed,r),n&&n()})}else r&&this.props.onChange(null,null,r)});X(this,"onError",(e,t)=>{this.errorCached=this.errorCached||JSON.parse(JSON.stringify(this.state.errors));const n=this.errorCached;t?n[e]=t:delete n[e],this.errorTimeout&&clearTimeout(this.errorTimeout),JSON.stringify(n)!==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});X(this,"changeLanguage",()=>{this.forceUpdate()});X(this,"forceAttrUpdate",(e,t)=>{Array.isArray(e)?e.forEach(n=>this.forceUpdateHandlers[n]&&this.forceUpdateHandlers[n](t)):this.forceUpdateHandlers[e]&&this.forceUpdateHandlers[e](t)});X(this,"registerOnForceUpdate",(e,t)=>{t?this.forceUpdateHandlers[e]=t:this.forceUpdateHandlers[e]&&delete this.forceUpdateHandlers[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 loadI18n(e,t,n){return ae(this,null,function*(){if(t===!0||t&&typeof t=="string"){const r=c.I18n.getLanguage(),a=typeof t=="string"?t:"i18n";let o=yield e.fileExists(`${n}.admin`,`${a}/${r}.json`),p;if(o?p=`${a}/${r}.json`:(o=yield e.fileExists(`${n}.admin`,`${a}/${r}/translations.json`),o?p=`${a}/${r}/translations.json`:r!=="en"&&(o=yield e.fileExists(`${n}.admin`,`${a}/en.json`),o?p=`${a}/en.json`:(o=yield e.fileExists(`${n}.admin`,`${a}/en/translations.json`),o&&(p=`${a}/en/translations.json`)))),p){const O=yield e.readFile(`${n}.admin`,p);let U;O.file!==void 0?U=O.file:U=O;try{const J=JSON.parse(U);c.I18n.extendTranslations(J,r)}catch(J){return console.error(`Cannot parse language file "${n}.admin/${p}: ${J}`),""}return p}return console.warn(`Cannot find i18n for ${n} / ${p}`),""}return t&&typeof t=="object"&&c.I18n.extendTranslations(t),""})}readData(){this.props.socket.getCompactSystemConfig().then(e=>this.props.socket.getState(`system.adapter.${this.props.adapterName}.${this.props.instance}.alive`).then(t=>{this.props.custom?this.setState({systemConfig:e.common,alive:!!(t&&t.val)}):this.setState({systemConfig:e.common,alive:!!(t&&t.val)},()=>this.props.socket.subscribeState(`system.adapter.${this.props.adapterName}.${this.props.instance}.alive`,this.onAlive))}))}flatten(e,t){return t=t||{},e.items&&Object.keys(e.items).forEach(n=>{t[n]=e.items[n],this.flatten(e.items[n],t)}),t}buildDependencies(e){const t=this.flatten(e);Object.keys(t).forEach(n=>{var r,a,o,p,O,U,J,q,he,Ee;(r=t[n].confirm)!=null&&r.alsoDependsOn&&((a=t[n].confirm)==null||a.alsoDependsOn.forEach(se=>{if(!t[se])console.error(`[JsonConfigComponent] Attribute ${se} does not exist!`),se.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${se.replace(/^data\./,"")}" instead of "${se}"`);else{t[se].confirmDependsOn=t[se].confirmDependsOn||[];const ye=$e(Y({},t[n]),{attr:n});ye.confirm&&(ye.confirm.cancel="Undo"),t[se].confirmDependsOn.push(ye)}})),(o=t[n].onChange)!=null&&o.alsoDependsOn&&((p=t[n].onChange)==null||p.alsoDependsOn.forEach(se=>{if(!t[se])console.error(`[JsonConfigComponent] Attribute ${se} does not exist!`),se.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${se.replace(/^data\./,"")}" instead of "${se}"`);else{t[se].onChangeDependsOn=t[se].onChangeDependsOn||[];const ye=$e(Y({},t[n]),{attr:n});t[se].onChangeDependsOn.push(ye)}})),(O=t[n].hidden)!=null&&O.alsoDependsOn&&((U=t[n].hidden)==null||U.alsoDependsOn.forEach(se=>{if(!t[se])console.error(`[JsonConfigComponent] Attribute ${se} does not exist!`),se.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${se.replace(/^data\./,"")}" instead of "${se}"`);else{t[se].hiddenDependsOn=t[se].hiddenDependsOn||[];const ye=$e(Y({},t[n]),{attr:n});t[se].hiddenDependsOn.push(ye)}})),(J=t[n].label)!=null&&J.alsoDependsOn&&((q=t[n].label)==null||q.alsoDependsOn.forEach(se=>{if(!t[se])console.error(`[JsonConfigComponent] Attribute ${se} does not exist!`),se.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${se.replace(/^data\./,"")}" instead of "${se}"`);else{t[se].labelDependsOn=t[se].labelDependsOn||[];const ye=$e(Y({},t[n]),{attr:n});t[se].labelDependsOn.push(ye)}})),(he=t[n].help)!=null&&he.alsoDependsOn&&((Ee=t[n].help)==null||Ee.alsoDependsOn.forEach(se=>{if(!t[se])console.error(`[JsonConfigComponent] Attribute ${se} does not exist!`),se.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${se.replace(/^data\./,"")}" instead of "${se}"`);else{t[se].helpDependsOn=t[se].helpDependsOn||[];const ye=$e(Y({},t[n]),{attr:n});t[se].helpDependsOn.push(ye)}}))})}renderItem(e){return e.type==="tabs"?i().createElement($s,{DeviceManager:this.props.DeviceManager,adapterName:this.props.adapterName,alive:this.state.alive,changeLanguage:this.changeLanguage,changed:this.state.changed,commandRunning:this.state.commandRunning,common:this.props.common,custom:this.props.custom,customObj:this.props.customObj,customs:this.props.customs,data:this.props.data,dateFormat:this.props.dateFormat,forceUpdate:this.forceAttrUpdate,imagePrefix:this.props.imagePrefix,instance:this.props.instance,instanceObj:this.props.instanceObj,isFloatComma:this.props.isFloatComma,multiEdit:this.props.multiEdit,onChange:this.onChange,onCommandRunning:this.onCommandRunning,onError:(t,n)=>this.onError(t,n),onBackEndCommand:this.props.onBackEndCommand,originalData:JSON.parse(this.state.originalData),registerOnForceUpdate:this.registerOnForceUpdate,root:!0,schema:e,socket:this.props.socket,systemConfig:this.state.systemConfig,theme:this.props.theme,themeName:this.props.themeName,themeType:this.props.themeType}):e.type==="panel"||!e.type?i().createElement(Lt,{DeviceManager:this.props.DeviceManager,adapterName:this.props.adapterName,alive:this.state.alive,changeLanguage:this.changeLanguage,changed:this.state.changed,commandRunning:this.state.commandRunning,common:this.props.common,custom:this.props.custom,customObj:this.props.customObj,customs:this.props.customs,data:this.props.data,dateFormat:this.props.dateFormat,forceUpdate:this.forceAttrUpdate,imagePrefix:this.props.imagePrefix,index:1e3,instance:this.props.instance,instanceObj:this.props.instanceObj,isFloatComma:this.props.isFloatComma,isParentTab:!this.props.embedded,multiEdit:this.props.multiEdit,onChange:this.onChange,onCommandRunning:this.onCommandRunning,onError:(t,n)=>this.onError(t,n),onBackEndCommand:this.props.onBackEndCommand,originalData:JSON.parse(this.state.originalData),registerOnForceUpdate:this.registerOnForceUpdate,root:!0,schema:e,socket:this.props.socket,systemConfig:this.state.systemConfig,theme:this.props.theme,themeName:this.props.themeName,themeType:this.props.themeType}):null}render(){return this.state.systemConfig?i().createElement("div",{style:Y(Y(Y({},this.props.embedded?void 0:Ps.root),this.props.style),this.state.schema.style)},this.renderItem(this.state.schema)):i().createElement(l.LinearProgress,null)}}const Jt=Rs,Et={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 Ms(w,s){let e="";for(let t=0;t<s.length;t++)e+=String.fromCharCode(w[t%w.length].charCodeAt(0)^s.charCodeAt(t));return e}function Vs(w,s){let e="";for(let t=0;t<s.length;t++)e+=String.fromCharCode(w[t%w.length].charCodeAt(0)^s.charCodeAt(t));return e}function Ws(w,s){if(typeof s!="string")return s;if(!s.startsWith("$/aes-192-cbc:")||!/^[0-9a-f]{48}$/.test(w))return Ms(w,s);const e=s.split(":",3),t=window.CryptoJS.enc.Hex.parse(w),n=window.CryptoJS.enc.Hex.parse(e[1]),r=window.CryptoJS.lib.CipherParams.create({ciphertext:window.CryptoJS.enc.Hex.parse(e[2])}),a=window.CryptoJS.AES.decrypt(r,t,{iv:n});return window.CryptoJS.enc.Utf8.stringify(a)}function Us(w,s,e){if(typeof s!="string")return s;if(!/^[0-9a-f]{48}$/.test(w))return Vs(w,s);let t;e?t=window.CryptoJS.enc.Hex.parse(e):t=window.CryptoJS.lib.WordArray.random(128/8);const n=window.CryptoJS.enc.Hex.parse(w),r=window.CryptoJS.AES.encrypt(s,n,{iv:t}).ciphertext;return`$/aes-192-cbc:${window.CryptoJS.enc.Hex.stringify(t)}:${r}`}function Bn(w,s){var e;return!s||!document.getElementById(s)?new Promise(t=>{const n=document.createElement("script");n.setAttribute("id",s),n.onload=t,n.src=w,document.getElementsByTagName("head")[0].appendChild(n)}):(e=document.getElementById(s))==null?void 0:e.onload}class gn extends c.Router{constructor(e){super(e);X(this,"fileSubscribed",[]);X(this,"fileLangSubscribed","");X(this,"secret");X(this,"handleFileSelect",e=>{const t=e.target.files[0];if(t){const n=new FileReader;n.onload=r=>ae(this,null,function*(){if(!r.target)return;const a=r.target.result;try{const o=JSON.parse(a);this.setState({data:o,changed:JSON.stringify(o)!==JSON.stringify(this.state.originalData)})}catch(o){window.alert(c.I18n.t("[JsonConfig] Failed to parse JSON file"))}}),n.readAsText(t)}else window.alert(c.I18n.t("[JsonConfig] Failed to open JSON File"))});X(this,"onFileChange",(e,t,n)=>ae(this,null,function*(){var r;if(e===`${this.props.adapterName}.admin`&&n){if(t===this.fileLangSubscribed)try{yield Jt.loadI18n(this.props.socket,(r=this.state.schema)==null?void 0:r.i18n,this.props.adapterName),this.setState({hash:`${this.state.hash}1`})}catch(a){}else if(this.fileSubscribed.includes(t))try{const a=yield this.getConfigFile(this.fileSubscribed[0]);this.setState({schema:a,hash:C()(JSON.stringify(a)).toString()})}catch(a){}}}));this.state={updateData:0,changed:!1,confirmDialog:!1,theme:(0,c.Theme)(e.themeName),saveConfigDialog:!1,hash:"_"},this.secret=e.secret||"",this.getInstanceObject().then(t=>this.getConfigFile().then(n=>Jt.loadI18n(this.props.socket,n==null?void 0:n.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:n,data:t.native,common:t.common,hash:C()(JSON.stringify(n)).toString()}):window.alert(`Instance system.adapter.${this.props.adapterName}.${this.props.instance} not found!`)})))}componentWillUnmount(){return ae(this,null,function*(){Re(gn.prototype,this,"componentWillUnmount").call(this),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="")})}getExportImportButtons(){return i().createElement("div",{style:Et.exportImportButtons},i().createElement(l.Tooltip,{title:this.props.t("Import settings from JSON file"),slotProps:{popper:{sx:Et.tooltip}}},i().createElement(l.Fab,{size:"small",sx:{"&.MuiFab-root":Et.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()}},i().createElement(u.Publish,null))),i().createElement(l.Tooltip,{title:this.props.t("Export setting to JSON file"),slotProps:{popper:{sx:Et.tooltip}}},i().createElement(l.Fab,{size:"small",sx:{"&.MuiFab-root":Et.button},onClick:()=>{this.state.data&&te.generateFile(`${this.props.adapterName}.${this.props.instance}.json`,this.state.data)}},i().createElement(u.Publish,{style:{transform:"rotate(180deg)"}}))))}getInstanceObject(){return ae(this,null,function*(){var e;try{const t=yield this.props.socket.getObject(`system.adapter.${this.props.adapterName}.${this.props.instance}`);if(Array.isArray(t.encryptedNative)){if(!this.secret){const n=yield this.props.socket.getSystemConfig();yield Bn("../../lib/js/crypto-js/crypto-js.js","crypto-js"),this.secret=n.native.secret}return(e=t.encryptedNative)==null||e.forEach(n=>{t.native[n]&&(t.native[n]=Ws(this.secret,t.native[n]))}),t}return t}catch(t){window.alert(`[JsonConfig] Cannot read instance object: ${t}`)}return null})}renderConfirmDialog(){return this.state.confirmDialog?i().createElement(c.Confirm,{title:c.I18n.t("ra_Please confirm"),text:c.I18n.t("ra_Some data are not stored. Discard?"),ok:c.I18n.t("ra_Discard"),cancel:c.I18n.t("ra_Cancel"),onClose:e=>this.setState({confirmDialog:!1},()=>e&&c.Router.doNavigate(null))}):null}scanForInclude(e,t){return ae(this,null,function*(){if(typeof e["#include"]=="string"){const r=yield this._getConfigFile(e["#include"],[...t]);return delete e["#include"],r&&(e=Y(Y({},e),r)),e}const n=Object.keys(e);for(let r=0;r<n.length;r++)e[n[r]]&&typeof e[n[r]]=="object"&&(e[n[r]]=yield this.scanForInclude(e[n[r]],t));return e})}getConfigFile(e){return ae(this,null,function*(){return this._getConfigFile(e)})}_getConfigFile(e,t){return ae(this,null,function*(){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{(yield this.props.socket.fileExists(`${this.props.adapterName}.admin`,e))||(e="jsonConfig.json");const r=yield this.props.socket.readFile(`${this.props.adapterName}.admin`,e);let a="",o="";if(r.file!==void 0&&(o=r.file),typeof o=="string")a=o;else if(o.type==="Buffer"){let p="";const O=new Uint8Array(o.data),U=O.byteLength;for(let J=0;J<U;J++)p+=String.fromCharCode(O[J]);a=p}this.fileSubscribed.includes(e)||(this.fileSubscribed.push(e),yield this.props.socket.subscribeFiles(`${this.props.adapterName}.admin`,e,this.onFileChange));try{return yield this.scanForInclude(f().parse(a),t)}catch(p){window.alert("[JsonConfig] Cannot parse json5 config!"),console.log(p)}}catch(n){this.state.schema||window.alert(`[JsonConfig] Cannot read file "${e}: ${n}`)}return null})}renderSaveConfigDialog(){return this.state.saveConfigDialog?i().createElement(c.Confirm,{title:c.I18n.t("ra_Please confirm"),text:c.I18n.t("Save configuration?"),ok:c.I18n.t("ra_Save"),cancel:c.I18n.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 n of Object.values(t.items)){const r=this.findAttr(e,n);if(r)return r}}return null}postProcessing(e,t,n){if(n=n||this.state.schema,!e){console.error(`Data is empty in postProcessing: ${t}, ${JSON.stringify(n)}`);return}const r=e[t];if(n.items)if(n.type==="table"){const a=r;if(!Array.isArray(a))return;for(const o of a)for(const p of n.items)this.postProcessing(o,p.attr,p)}else for(const[a,o]of Object.entries(n.items)){if(o.type==="panel"||o.type==="tabs"||o.type==="accordion")return;this.postProcessing(e,a,o)}else if(t&&typeof r=="string")if(n.type==="text")n.trim!==!1&&(e[t]=r.trim());else if(n.type==="ip")e[t]=r.trim();else if(n.type==="number"){const a=parseFloat(r.toString().replace(",","."));n.min!==void 0&&a<n.min?e[t]=n.min:n.max!==void 0&&a>n.max?e[t]=n.max:e[t]=a}else if(n.type==="port"){const a=parseInt(r.toString(),10);n.min!==void 0&&a<n.min?e[t]=n.min:n.max!==void 0&&a>n.max&&(e[t]=n.max),e[t]!==0&&a<20?e[t]=20:a>65535?e[t]=65535:e[t]=a}else n.type==="checkbox"&&(e[t]=e[t]===!0||e[t]==="true"||e[t]==="on"||e[t]===1||e[t]==="1")}onSave(e,t){return ae(this,null,function*(){if(e){const n=yield this.getInstanceObject();if(!n){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 o of Object.keys(this.state.data)){const p=this.findAttr(o);(!p||!p.doNotSave||p.type==="state")&&!o.startsWith("_")?m.setValue(n.native,o,this.state.data[o]):(m.setValue(n.native,o,null),r[o]=this.state.data[o])}try{const o=JSON.parse(JSON.stringify(n));if(Array.isArray(o.encryptedNative)){yield Bn("../../lib/js/crypto-js/crypto-js.js","crypto-js");for(const p of o.encryptedNative)o.native[p]&&(o.native[p]=Us(this.secret,o.native[p]))}yield this.props.socket.setObject(o._id,o)}catch(o){window.alert(`[JsonConfig] Cannot set object: ${o}`)}const a=Y(Y({},n.native),r);console.log(a),this.setState({changed:!1,data:a,updateData:this.state.updateData+1,originalData:a},()=>t&&c.Router.doNavigate(null))}else this.state.changed?this.setState({confirmDialog:!0}):c.Router.doNavigate(null)})}componentDidUpdate(e,t){t.changed!==this.state.changed&&this.props.configStored(!this.state.changed)}componentDidMount(){return ae(this,null,function*(){const e=`${window.location.protocol}//${window.location.host}${window.location.pathname}validate_config/${this.props.adapterName}`;console.log(`fetch ${e}`),yield fetch(e)})}render(){return!this.state.data||!this.state.schema?i().createElement(l.LinearProgress,null):i().createElement("div",{style:Et.root},this.renderConfirmDialog(),this.getExportImportButtons(),this.renderSaveConfigDialog(),i().createElement(Jt,{key:this.state.hash,style:Et.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,data:this.state.data,updateData:this.state.updateData,onError:e=>this.setState({error:e}),onChange:(e,t,n)=>{n&&this.state.error&&(window.alert(c.I18n.t("Cannot save configuration because of error in configuration")),n=!1),n&&!this.state.changed&&!t&&(n=!1),e?this.setState({data:e,changed:t,saveConfigDialog:n}):n!==void 0&&this.setState({saveConfigDialog:n})},DeviceManager:this.props.DeviceManager,theme:this.state.theme}),i().createElement(c.SaveCloseButtons,{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)}))}}const Js=gn},82292:(P,ee,G)=>{P=G.nmd(P),ace.define("ace/snippets",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/range_list","ace/keyboard/hash_handler","ace/tokenizer","ace/clipboard","ace/editor"],function(S,i,D){"use strict";function f(h){var g=new Date().toLocaleString("en-us",h);return g.length==1?"0"+g:g}var v=S("./lib/dom"),C=S("./lib/oop"),l=S("./lib/event_emitter").EventEmitter,u=S("./lib/lang"),c=S("./range").Range,T=S("./range_list").RangeList,L=S("./keyboard/hash_handler").HashHandler,H=S("./tokenizer").Tokenizer,Z=S("./clipboard"),$={CURRENT_WORD:function(h){return h.session.getTextRange(h.session.getWordRange())},SELECTION:function(h,g,d){var b=h.session.getTextRange();return d?b.replace(/\n\r?([ \t]*\S)/g,`
`+d+"$1"):b},CURRENT_LINE:function(h){return h.session.getLine(h.getCursorPosition().row)},PREV_LINE:function(h){return h.session.getLine(h.getCursorPosition().row-1)},LINE_INDEX:function(h){return h.getCursorPosition().row},LINE_NUMBER:function(h){return h.getCursorPosition().row+1},SOFT_TABS:function(h){return h.session.getUseSoftTabs()?"YES":"NO"},TAB_SIZE:function(h){return h.session.getTabSize()},CLIPBOARD:function(h){return Z.getText&&Z.getText()},FILENAME:function(h){return/[^/\\]*$/.exec(this.FILEPATH(h))[0]},FILENAME_BASE:function(h){return/[^/\\]*$/.exec(this.FILEPATH(h))[0].replace(/\.[^.]*$/,"")},DIRECTORY:function(h){return this.FILEPATH(h).replace(/[^/\\]*$/,"")},FILEPATH:function(h){return"/not implemented.txt"},WORKSPACE_NAME:function(){return"Unknown"},FULLNAME:function(){return"Unknown"},BLOCK_COMMENT_START:function(h){var g=h.session.$mode||{};return g.blockComment&&g.blockComment.start||""},BLOCK_COMMENT_END:function(h){var g=h.session.$mode||{};return g.blockComment&&g.blockComment.end||""},LINE_COMMENT:function(h){var g=h.session.$mode||{};return g.lineCommentStart||""},CURRENT_YEAR:f.bind(null,{year:"numeric"}),CURRENT_YEAR_SHORT:f.bind(null,{year:"2-digit"}),CURRENT_MONTH:f.bind(null,{month:"numeric"}),CURRENT_MONTH_NAME:f.bind(null,{month:"long"}),CURRENT_MONTH_NAME_SHORT:f.bind(null,{month:"short"}),CURRENT_DATE:f.bind(null,{day:"2-digit"}),CURRENT_DAY_NAME:f.bind(null,{weekday:"long"}),CURRENT_DAY_NAME_SHORT:f.bind(null,{weekday:"short"}),CURRENT_HOUR:f.bind(null,{hour:"2-digit",hour12:!1}),CURRENT_MINUTE:f.bind(null,{minute:"2-digit"}),CURRENT_SECOND:f.bind(null,{second:"2-digit"})};$.SELECTED_TEXT=$.SELECTION;var W=function(){function h(){this.snippetMap={},this.snippetNameMap={},this.variables=$}return h.prototype.getTokenizer=function(){return h.$tokenizer||this.createTokenizer()},h.prototype.createTokenizer=function(){function g(E){return E=E.substr(1),/^\d+$/.test(E)?[{tabstopId:parseInt(E,10)}]:[{text:E}]}function d(E){return"(?:[^\\\\"+E+"]|\\\\.)"}var b={regex:"/("+d("/")+"+)/",onMatch:function(E,k,B){var _=B[0];return _.fmtString=!0,_.guard=E.slice(1,-1),_.flag="",""},next:"formatString"};return h.$tokenizer=new H({start:[{regex:/\\./,onMatch:function(E,k,B){var _=E[1];return(_=="}"&&B.length||"`$\\".indexOf(_)!=-1)&&(E=_),[E]}},{regex:/}/,onMatch:function(E,k,B){return[B.length?B.shift():E]}},{regex:/\$(?:\d+|\w+)/,onMatch:g},{regex:/\$\{[\dA-Z_a-z]+/,onMatch:function(E,k,B){var _=g(E.substr(1));return B.unshift(_[0]),_},next:"snippetVar"},{regex:/\n/,token:"newline",merge:!1}],snippetVar:[{regex:"\\|"+d("\\|")+"*\\|",onMatch:function(E,k,B){var _=E.slice(1,-1).replace(/\\[,|\\]|,/g,function(A){return A.length==2?A[1]:"\0"}).split("\0").map(function(A){return{value:A}});return B[0].choices=_,[_[0]]},next:"start"},b,{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"start"}],formatString:[{regex:/:/,onMatch:function(E,k,B){return B.length&&B[0].expectElse?(B[0].expectElse=!1,B[0].ifEnd={elseEnd:B[0]},[B[0].ifEnd]):":"}},{regex:/\\./,onMatch:function(E,k,B){var _=E[1];return _=="}"&&B.length||"`$\\".indexOf(_)!=-1?E=_:_=="n"?E=`
`:_=="t"?E=" ":"ulULE".indexOf(_)!=-1&&(E={changeCase:_,local:_>"a"}),[E]}},{regex:"/\\w*}",onMatch:function(E,k,B){var _=B.shift();return _&&(_.flag=E.slice(1,-1)),this.next=_&&_.tabstopId?"start":"",[_||E]},next:"start"},{regex:/\$(?:\d+|\w+)/,onMatch:function(E,k,B){return[{text:E.slice(1)}]}},{regex:/\${\w+/,onMatch:function(E,k,B){var _={text:E.slice(2)};return B.unshift(_),[_]},next:"formatStringVar"},{regex:/\n/,token:"newline",merge:!1},{regex:/}/,onMatch:function(E,k,B){var _=B.shift();return this.next=_&&_.tabstopId?"start":"",[_||E]},next:"start"}],formatStringVar:[{regex:/:\/\w+}/,onMatch:function(E,k,B){var _=B[0];return _.formatFunction=E.slice(2,-1),[B.shift()]},next:"formatString"},b,{regex:/:[\?\-+]?/,onMatch:function(E,k,B){E[1]=="+"&&(B[0].ifEnd=B[0]),E[1]=="?"&&(B[0].expectElse=!0)},next:"formatString"},{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"formatString"}]}),h.$tokenizer},h.prototype.tokenizeTmSnippet=function(g,d){return this.getTokenizer().getLineTokens(g,d).tokens.map(function(b){return b.value||b})},h.prototype.getVariableValue=function(g,d,b){if(/^\d+$/.test(d))return(this.variables.__||{})[d]||"";if(/^[A-Z]\d+$/.test(d))return(this.variables[d[0]+"__"]||{})[d.substr(1)]||"";if(d=d.replace(/^TM_/,""),!this.variables.hasOwnProperty(d))return"";var E=this.variables[d];return typeof E=="function"&&(E=this.variables[d](g,d,b)),E==null?"":E},h.prototype.tmStrFormat=function(g,d,b){if(!d.fmt)return g;var E=d.flag||"",k=d.guard;k=new RegExp(k,E.replace(/[^gim]/g,""));var B=typeof d.fmt=="string"?this.tokenizeTmSnippet(d.fmt,"formatString"):d.fmt,_=this,A=g.replace(k,function(){var I=_.variables.__;_.variables.__=[].slice.call(arguments);for(var M=_.resolveVariables(B,b),re="E",Q=0;Q<M.length;Q++){var le=M[Q];if(typeof le=="object")if(M[Q]="",le.changeCase&&le.local){var ce=M[Q+1];ce&&typeof ce=="string"&&(le.changeCase=="u"?M[Q]=ce[0].toUpperCase():M[Q]=ce[0].toLowerCase(),M[Q+1]=ce.substr(1))}else le.changeCase&&(re=le.changeCase);else re=="U"?M[Q]=le.toUpperCase():re=="L"&&(M[Q]=le.toLowerCase())}return _.variables.__=I,M.join("")});return A},h.prototype.tmFormatFunction=function(g,d,b){return d.formatFunction=="upcase"?g.toUpperCase():d.formatFunction=="downcase"?g.toLowerCase():g},h.prototype.resolveVariables=function(g,d){function b(re){var Q=g.indexOf(re,_+1);Q!=-1&&(_=Q)}for(var E=[],k="",B=!0,_=0;_<g.length;_++){var A=g[_];if(typeof A=="string"){E.push(A),A==`
`?(B=!0,k=""):B&&(k=/^\t*/.exec(A)[0],B=/\S/.test(A));continue}if(A){if(B=!1,A.fmtString){var I=g.indexOf(A,_+1);I==-1&&(I=g.length),A.fmt=g.slice(_+1,I),_=I}if(A.text){var M=this.getVariableValue(d,A.text,k)+"";A.fmtString&&(M=this.tmStrFormat(M,A,d)),A.formatFunction&&(M=this.tmFormatFunction(M,A,d)),M&&!A.ifEnd?(E.push(M),b(A)):!M&&A.ifEnd&&b(A.ifEnd)}else A.elseEnd?b(A.elseEnd):(A.tabstopId!=null||A.changeCase!=null)&&E.push(A)}}return E},h.prototype.getDisplayTextForSnippet=function(g,d){var b=te.call(this,g,d);return b.text},h.prototype.insertSnippetForSelection=function(g,d,b){b===void 0&&(b={});var E=te.call(this,g,d,b),k=g.getSelectionRange(),B=g.session.replace(k,E.text),_=new oe(g),A=g.inVirtualSelectionMode&&g.selection.index;_.addTabstops(E.tabstops,k.start,B,A)},h.prototype.insertSnippet=function(g,d,b){b===void 0&&(b={});var E=this;if(g.inVirtualSelectionMode)return E.insertSnippetForSelection(g,d,b);g.forEachSelection(function(){E.insertSnippetForSelection(g,d,b)},null,{keepOrder:!0}),g.tabstopManager&&g.tabstopManager.tabNext()},h.prototype.$getScope=function(g){var d=g.session.$mode.$id||"";if(d=d.split("/").pop(),d==="html"||d==="php"){d==="php"&&!g.session.$mode.inlinePhp&&(d="html");var b=g.getCursorPosition(),E=g.session.getState(b.row);typeof E=="object"&&(E=E[0]),E.substring&&(E.substring(0,3)=="js-"?d="javascript":E.substring(0,4)=="css-"?d="css":E.substring(0,4)=="php-"&&(d="php"))}return d},h.prototype.getActiveScopes=function(g){var d=this.$getScope(g),b=[d],E=this.snippetMap;return E[d]&&E[d].includeScopes&&b.push.apply(b,E[d].includeScopes),b.push("_"),b},h.prototype.expandWithTab=function(g,d){var b=this,E=g.forEachSelection(function(){return b.expandSnippetForSelection(g,d)},null,{keepOrder:!0});return E&&g.tabstopManager&&g.tabstopManager.tabNext(),E},h.prototype.expandSnippetForSelection=function(g,d){var b=g.getCursorPosition(),E=g.session.getLine(b.row),k=E.substring(0,b.column),B=E.substr(b.column),_=this.snippetMap,A;return this.getActiveScopes(g).some(function(I){var M=_[I];return M&&(A=this.findMatchingSnippet(M,k,B)),!!A},this),A?(d&&d.dryRun||(g.session.doc.removeInLine(b.row,b.column-A.replaceBefore.length,b.column+A.replaceAfter.length),this.variables.M__=A.matchBefore,this.variables.T__=A.matchAfter,this.insertSnippetForSelection(g,A.content),this.variables.M__=this.variables.T__=null),!0):!1},h.prototype.findMatchingSnippet=function(g,d,b){for(var E=g.length;E--;){var k=g[E];if(!(k.startRe&&!k.startRe.test(d))&&!(k.endRe&&!k.endRe.test(b))&&!(!k.startRe&&!k.endRe))return k.matchBefore=k.startRe?k.startRe.exec(d):[""],k.matchAfter=k.endRe?k.endRe.exec(b):[""],k.replaceBefore=k.triggerRe?k.triggerRe.exec(d)[0]:"",k.replaceAfter=k.endTriggerRe?k.endTriggerRe.exec(b)[0]:"",k}},h.prototype.register=function(g,d){function b(I){return I&&!/^\^?\(.*\)\$?$|^\\b$/.test(I)&&(I="(?:"+I+")"),I||""}function E(I,M,re){return I=b(I),M=b(M),re?(I=M+I,I&&I[I.length-1]!="$"&&(I+="$")):(I+=M,I&&I[0]!="^"&&(I="^"+I)),new RegExp(I)}function k(I){I.scope||(I.scope=d||"_"),d=I.scope,B[d]||(B[d]=[],_[d]={});var M=_[d];if(I.name){var re=M[I.name];re&&A.unregister(re),M[I.name]=I}B[d].push(I),I.prefix&&(I.tabTrigger=I.prefix),!I.content&&I.body&&(I.content=Array.isArray(I.body)?I.body.join(`
`):I.body),I.tabTrigger&&!I.trigger&&(!I.guard&&/^\w/.test(I.tabTrigger)&&(I.guard="\\b"),I.trigger=u.escapeRegExp(I.tabTrigger)),!(!I.trigger&&!I.guard&&!I.endTrigger&&!I.endGuard)&&(I.startRe=E(I.trigger,I.guard,!0),I.triggerRe=new RegExp(I.trigger),I.endRe=E(I.endTrigger,I.endGuard,!0),I.endTriggerRe=new RegExp(I.endTrigger))}var B=this.snippetMap,_=this.snippetNameMap,A=this;g||(g=[]),Array.isArray(g)?g.forEach(k):Object.keys(g).forEach(function(I){k(g[I])}),this._signal("registerSnippets",{scope:d})},h.prototype.unregister=function(g,d){function b(B){var _=k[B.scope||d];if(_&&_[B.name]){delete _[B.name];var A=E[B.scope||d],I=A&&A.indexOf(B);I>=0&&A.splice(I,1)}}var E=this.snippetMap,k=this.snippetNameMap;g.content?b(g):Array.isArray(g)&&g.forEach(b)},h.prototype.parseSnippetFile=function(g){g=g.replace(/\r/g,"");for(var d=[],b={},E=/^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm,k;k=E.exec(g);){if(k[1])try{b=JSON.parse(k[1]),d.push(b)}catch(I){}if(k[4])b.content=k[4].replace(/^\t/gm,""),d.push(b),b={};else{var B=k[2],_=k[3];if(B=="regex"){var A=/\/((?:[^\/\\]|\\.)*)|$/g;b.guard=A.exec(_)[1],b.trigger=A.exec(_)[1],b.endTrigger=A.exec(_)[1],b.endGuard=A.exec(_)[1]}else B=="snippet"?(b.tabTrigger=_.match(/^\S*/)[0],b.name||(b.name=_)):B&&(b[B]=_)}}return d},h.prototype.getSnippetByName=function(g,d){var b=this.snippetNameMap,E;return this.getActiveScopes(d).some(function(k){var B=b[k];return B&&(E=B[g]),!!E},this),E},h}();C.implement(W.prototype,l);var te=function(h,g,d){function b(ge){for(var ke=[],Ke=0;Ke<ge.length;Ke++){var Te=ge[Ke];if(typeof Te=="object"){if(M[Te.tabstopId])continue;var ht=ge.lastIndexOf(Te,Ke-1);Te=ke[ht]||{tabstopId:Te.tabstopId}}ke[Ke]=Te}return ke}d===void 0&&(d={});var E=h.getCursorPosition(),k=h.session.getLine(E.row),B=h.session.getTabString(),_=k.match(/^\s*/)[0];E.column<_.length&&(_=_.slice(0,E.column)),g=g.replace(/\r/g,"");var A=this.tokenizeTmSnippet(g);A=this.resolveVariables(A,h),A=A.map(function(ge){return ge==`
`&&!d.excludeExtraIndent?ge+_:typeof ge=="string"?ge.replace(/\t/g,B):ge});var I=[];A.forEach(function(ge,ke){if(typeof ge=="object"){var Ke=ge.tabstopId,Te=I[Ke];if(Te||(Te=I[Ke]=[],Te.index=Ke,Te.value="",Te.parents={}),Te.indexOf(ge)===-1){ge.choices&&!Te.choices&&(Te.choices=ge.choices),Te.push(ge);var ht=A.indexOf(ge,ke+1);if(ht!==-1){var pt=A.slice(ke+1,ht),Dt=pt.some(function(Ie){return typeof Ie=="object"});Dt&&!Te.value?Te.value=pt:pt.length&&(!Te.value||typeof Te.value!="string")&&(Te.value=pt.join(""))}}}}),I.forEach(function(ge){ge.length=0});for(var M={},re=0;re<A.length;re++){var Q=A[re];if(typeof Q=="object"){var le=Q.tabstopId,ce=I[le],R=A.indexOf(Q,re+1);if(M[le]){M[le]===Q&&(delete M[le],Object.keys(M).forEach(function(ge){ce.parents[ge]=!0}));continue}M[le]=Q;var K=ce.value;typeof K!="string"?K=b(K):Q.fmt&&(K=this.tmStrFormat(K,Q,h)),A.splice.apply(A,[re+1,Math.max(0,R-re)].concat(K,Q)),ce.indexOf(Q)===-1&&ce.push(Q)}}var z=0,j=0,_e="";return A.forEach(function(ge){if(typeof ge=="string"){var ke=ge.split(`
`);ke.length>1?(j=ke[ke.length-1].length,z+=ke.length-1):j+=ge.length,_e+=ge}else ge&&(ge.start?ge.end={row:z,column:j}:ge.start={row:z,column:j})}),{text:_e,tabstops:I,tokens:A}},oe=function(){function h(g){if(this.index=0,this.ranges=[],this.tabstops=[],g.tabstopManager)return g.tabstopManager;g.tabstopManager=this,this.$onChange=this.onChange.bind(this),this.$onChangeSelection=u.delayedCall(this.onChangeSelection.bind(this)).schedule,this.$onChangeSession=this.onChangeSession.bind(this),this.$onAfterExec=this.onAfterExec.bind(this),this.attach(g)}return h.prototype.attach=function(g){this.$openTabstops=null,this.selectedTabstop=null,this.editor=g,this.session=g.session,this.editor.on("change",this.$onChange),this.editor.on("changeSelection",this.$onChangeSelection),this.editor.on("changeSession",this.$onChangeSession),this.editor.commands.on("afterExec",this.$onAfterExec),this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler)},h.prototype.detach=function(){this.tabstops.forEach(this.removeTabstopMarkers,this),this.ranges.length=0,this.tabstops.length=0,this.selectedTabstop=null,this.editor.off("change",this.$onChange),this.editor.off("changeSelection",this.$onChangeSelection),this.editor.off("changeSession",this.$onChangeSession),this.editor.commands.off("afterExec",this.$onAfterExec),this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.tabstopManager=null,this.session=null,this.editor=null},h.prototype.onChange=function(g){for(var d=g.action[0]=="r",b=this.selectedTabstop||{},E=b.parents||{},k=this.tabstops.slice(),B=0;B<k.length;B++){var _=k[B],A=_==b||E[_.index];if(_.rangeList.$bias=A?0:1,g.action=="remove"&&_!==b){var I=_.parents&&_.parents[b.index],M=_.rangeList.pointIndex(g.start,I);M=M<0?-M-1:M+1;var re=_.rangeList.pointIndex(g.end,I);re=re<0?-re-1:re-1;for(var Q=_.rangeList.ranges.slice(M,re),le=0;le<Q.length;le++)this.removeRange(Q[le])}_.rangeList.$onChange(g)}var ce=this.session;!this.$inChange&&d&&ce.getLength()==1&&!ce.getValue()&&this.detach()},h.prototype.updateLinkedFields=function(){var g=this.selectedTabstop;if(!(!g||!g.hasLinkedRanges||!g.firstNonLinked)){this.$inChange=!0;for(var d=this.session,b=d.getTextRange(g.firstNonLinked),E=0;E<g.length;E++){var k=g[E];if(k.linked){var B=k.original,_=i.snippetManager.tmStrFormat(b,B,this.editor);d.replace(k,_)}}this.$inChange=!1}},h.prototype.onAfterExec=function(g){g.command&&!g.command.readOnly&&this.updateLinkedFields()},h.prototype.onChangeSelection=function(){if(this.editor){for(var g=this.editor.selection.lead,d=this.editor.selection.anchor,b=this.editor.selection.isEmpty(),E=0;E<this.ranges.length;E++)if(!this.ranges[E].linked){var k=this.ranges[E].contains(g.row,g.column),B=b||this.ranges[E].contains(d.row,d.column);if(k&&B)return}this.detach()}},h.prototype.onChangeSession=function(){this.detach()},h.prototype.tabNext=function(g){var d=this.tabstops.length,b=this.index+(g||1);b=Math.min(Math.max(b,1),d),b==d&&(b=0),this.selectTabstop(b),this.updateTabstopMarkers(),b===0&&this.detach()},h.prototype.selectTabstop=function(g){this.$openTabstops=null;var d=this.tabstops[this.index];if(d&&this.addTabstopMarkers(d),this.index=g,d=this.tabstops[this.index],!(!d||!d.length)){this.selectedTabstop=d;var b=d.firstNonLinked||d;if(d.choices&&(b.cursor=b.start),this.editor.inVirtualSelectionMode)this.editor.selection.fromOrientedRange(b);else{var E=this.editor.multiSelect;E.toSingleRange(b);for(var k=0;k<d.length;k++)d.hasLinkedRanges&&d[k].linked||E.addRange(d[k].clone(),!0)}this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler),this.selectedTabstop&&this.selectedTabstop.choices&&this.editor.execCommand("startAutocomplete",{matches:this.selectedTabstop.choices})}},h.prototype.addTabstops=function(g,d,b){var E=this.useLink||!this.editor.getOption("enableMultiselect");if(this.$openTabstops||(this.$openTabstops=[]),!g[0]){var k=c.fromPoints(b,b);x(k.start,d),x(k.end,d),g[0]=[k],g[0].index=0}var B=this.index,_=[B+1,0],A=this.ranges,I=this.snippetId=(this.snippetId||0)+1;g.forEach(function(M,re){var Q=this.$openTabstops[re]||M;Q.snippetId=I;for(var le=0;le<M.length;le++){var ce=M[le],R=c.fromPoints(ce.start,ce.end||ce.start);m(R.start,d),m(R.end,d),R.original=ce,R.tabstop=Q,A.push(R),Q!=M?Q.unshift(R):Q[le]=R,ce.fmtString||Q.firstNonLinked&&E?(R.linked=!0,Q.hasLinkedRanges=!0):Q.firstNonLinked||(Q.firstNonLinked=R)}Q.firstNonLinked||(Q.hasLinkedRanges=!1),Q===M&&(_.push(Q),this.$openTabstops[re]=Q),this.addTabstopMarkers(Q),Q.rangeList=Q.rangeList||new T,Q.rangeList.$bias=0,Q.rangeList.addList(Q)},this),_.length>2&&(this.tabstops.length&&_.push(_.splice(2,1)[0]),this.tabstops.splice.apply(this.tabstops,_))},h.prototype.addTabstopMarkers=function(g){var d=this.session;g.forEach(function(b){b.markerId||(b.markerId=d.addMarker(b,"ace_snippet-marker","text"))})},h.prototype.removeTabstopMarkers=function(g){var d=this.session;g.forEach(function(b){d.removeMarker(b.markerId),b.markerId=null})},h.prototype.updateTabstopMarkers=function(){if(this.selectedTabstop){var g=this.selectedTabstop.snippetId;this.selectedTabstop.index===0&&g--,this.tabstops.forEach(function(d){d.snippetId===g?this.addTabstopMarkers(d):this.removeTabstopMarkers(d)},this)}},h.prototype.removeRange=function(g){var d=g.tabstop.indexOf(g);d!=-1&&g.tabstop.splice(d,1),d=this.ranges.indexOf(g),d!=-1&&this.ranges.splice(d,1),d=g.tabstop.rangeList.ranges.indexOf(g),d!=-1&&g.tabstop.splice(d,1),this.session.removeMarker(g.markerId),g.tabstop.length||(d=this.tabstops.indexOf(g.tabstop),d!=-1&&this.tabstops.splice(d,1),this.tabstops.length||this.detach())},h}();oe.prototype.keyboardHandler=new L,oe.prototype.keyboardHandler.bindKeys({Tab:function(h){i.snippetManager&&i.snippetManager.expandWithTab(h)||(h.tabstopManager.tabNext(1),h.renderer.scrollCursorIntoView())},"Shift-Tab":function(h){h.tabstopManager.tabNext(-1),h.renderer.scrollCursorIntoView()},Esc:function(h){h.tabstopManager.detach()}});var m=function(h,g){h.row==0&&(h.column+=g.column),h.row+=g.row},x=function(h,g){h.row==g.row&&(h.column-=g.column),h.row-=g.row};v.importCssString(`
.ace_snippet-marker {
-moz-box-sizing: border-box;
box-sizing: border-box;
background: rgba(194, 193, 208, 0.09);
border: 1px dotted rgba(211, 208, 235, 0.62);
position: absolute;
}`,"snippets.css",!1),i.snippetManager=new W;var y=S("./editor").Editor;(function(){this.insertSnippet=function(h,g){return i.snippetManager.insertSnippet(this,h,g)},this.expandSnippet=function(h){return i.snippetManager.expandWithTab(this,h)}}).call(y.prototype)}),ace.define("ace/autocomplete/popup",["require","exports","module","ace/virtual_renderer","ace/editor","ace/range","ace/lib/event","ace/lib/lang","ace/lib/dom","ace/config","ace/lib/useragent"],function(S,i,D){"use strict";var f=S("../virtual_renderer").VirtualRenderer,v=S("../editor").Editor,C=S("../range").Range,l=S("../lib/event"),u=S("../lib/lang"),c=S("../lib/dom"),T=S("../config").nls,L=S("./../lib/useragent"),H=function(m){return"suggest-aria-id:".concat(m)},Z=L.isSafari?"menu":"listbox",$=L.isSafari?"menuitem":"option",W=L.isSafari?"aria-current":"aria-selected",te=function(m){var x=new f(m);x.$maxLines=4;var y=new v(x);return y.setHighlightActiveLine(!1),y.setShowPrintMargin(!1),y.renderer.setShowGutter(!1),y.renderer.setHighlightGutterLine(!1),y.$mouseHandler.$focusTimeout=0,y.$highlightTagPending=!0,y},oe=function(){function m(x){var y=c.createElement("div"),h=te(y);x&&x.appendChild(y),y.style.display="none",h.renderer.content.style.cursor="default",h.renderer.setStyle("ace_autocomplete"),h.renderer.$textLayer.element.setAttribute("role",Z),h.renderer.$textLayer.element.setAttribute("aria-roledescription",T("autocomplete.popup.aria-roledescription","Autocomplete suggestions")),h.renderer.$textLayer.element.setAttribute("aria-label",T("autocomplete.popup.aria-label","Autocomplete suggestions")),h.renderer.textarea.setAttribute("aria-hidden","true"),h.setOption("displayIndentGuides",!1),h.setOption("dragDelay",150);var g=function(){};h.focus=g,h.$isFocused=!0,h.renderer.$cursorLayer.restartTimer=g,h.renderer.$cursorLayer.element.style.opacity="0",h.renderer.$maxLines=8,h.renderer.$keepTextAreaAtCursor=!1,h.setHighlightActiveLine(!1),h.session.highlight(""),h.session.$searchHighlight.clazz="ace_highlight-marker",h.on("mousedown",function(A){var I=A.getDocumentPosition();h.selection.moveToPosition(I),E.start.row=E.end.row=I.row,A.stop()});var d,b=new C(-1,0,-1,1/0),E=new C(-1,0,-1,1/0);E.id=h.session.addMarker(E,"ace_active-line","fullLine"),h.setSelectOnHover=function(A){A?b.id&&(h.session.removeMarker(b.id),b.id=null):b.id=h.session.addMarker(b,"ace_line-hover","fullLine")},h.setSelectOnHover(!1),h.on("mousemove",function(A){if(!d){d=A;return}if(!(d.x==A.x&&d.y==A.y)){d=A,d.scrollTop=h.renderer.scrollTop,h.isMouseOver=!0;var I=d.getDocumentPosition().row;b.start.row!=I&&(b.id||h.setRow(I),B(I))}}),h.renderer.on("beforeRender",function(){if(d&&b.start.row!=-1){d.$pos=null;var A=d.getDocumentPosition().row;b.id||h.setRow(A),B(A,!0)}}),h.renderer.on("afterRender",function(){var A=h.getRow(),I=h.renderer.$textLayer,M=I.element.childNodes[A-I.config.firstRow],re=document.activeElement;if(M!==h.selectedNode&&h.selectedNode&&(c.removeCssClass(h.selectedNode,"ace_selected"),re.removeAttribute("aria-activedescendant"),h.selectedNode.removeAttribute(W),h.selectedNode.removeAttribute("id")),h.selectedNode=M,M){c.addCssClass(M,"ace_selected");var Q=H(A);M.id=Q,I.element.setAttribute("aria-activedescendant",Q),re.setAttribute("aria-activedescendant",Q),M.setAttribute("role",$),M.setAttribute("aria-roledescription",T("autocomplete.popup.item.aria-roledescription","item")),M.setAttribute("aria-label",h.getData(A).caption||h.getData(A).value),M.setAttribute("aria-setsize",h.data.length),M.setAttribute("aria-posinset",A+1),M.setAttribute("aria-describedby","doc-tooltip"),M.setAttribute(W,"true")}});var k=function(){B(-1)},B=function(A,I){A!==b.start.row&&(b.start.row=b.end.row=A,I||h.session._emit("changeBackMarker"),h._emit("changeHoverMarker"))};h.getHoveredRow=function(){return b.start.row},l.addListener(h.container,"mouseout",function(){h.isMouseOver=!1,k()}),h.on("hide",k),h.on("changeSelection",k),h.session.doc.getLength=function(){return h.data.length},h.session.doc.getLine=function(A){var I=h.data[A];return typeof I=="string"?I:I&&I.value||""};var _=h.session.bgTokenizer;return _.$tokenizeRow=function(A){function I(ge,ke){ge&&re.push({type:(M.className||"")+(ke||""),value:ge})}var M=h.data[A],re=[];if(!M)return re;typeof M=="string"&&(M={value:M});for(var Q=M.caption||M.value||M.name,le=Q.toLowerCase(),ce=(h.filterText||"").toLowerCase(),R=0,K=0,z=0;z<=ce.length;z++)if(z!=K&&(M.matchMask&1<<z||z==ce.length)){var j=ce.slice(K,z);K=z;var _e=le.indexOf(j,R);if(_e==-1)continue;I(Q.slice(R,_e),""),R=_e+j.length,I(Q.slice(_e,R),"completion-highlight")}return I(Q.slice(R,Q.length),""),re.push({type:"completion-spacer",value:" "}),M.meta&&re.push({type:"completion-meta",value:M.meta}),M.message&&re.push({type:"completion-message",value:M.message}),re},_.$updateOnChange=g,_.start=g,h.session.$computeWidth=function(){return this.screenWidth=0},h.isOpen=!1,h.isTopdown=!1,h.autoSelect=!0,h.filterText="",h.isMouseOver=!1,h.data=[],h.setData=function(A,I){h.filterText=I||"",h.setValue(u.stringRepeat(`
`,A.length),-1),h.data=A||[],h.setRow(0)},h.getData=function(A){return h.data[A]},h.getRow=function(){return E.start.row},h.setRow=function(A){A=Math.max(this.autoSelect?0:-1,Math.min(this.data.length-1,A)),E.start.row!=A&&(h.selection.clearSelection(),E.start.row=E.end.row=A||0,h.session._emit("changeBackMarker"),h.moveCursorTo(A||0,0),h.isOpen&&h._signal("select"))},h.on("changeSelection",function(){h.isOpen&&h.setRow(h.selection.lead.row),h.renderer.scrollCursorIntoView()}),h.hide=function(){this.container.style.display="none",h.anchorPos=null,h.anchor=null,h.isOpen&&(h.isOpen=!1,this._signal("hide"))},h.tryShow=function(A,I,M,re){if(!re&&h.isOpen&&h.anchorPos&&h.anchor&&h.anchorPos.top===A.top&&h.anchorPos.left===A.left&&h.anchor===M)return!0;var Q=this.container,le=window.innerHeight,ce=window.innerWidth,R=this.renderer,K=R.$maxLines*I*1.4,z={top:0,bottom:0,left:0},j=le-A.top-3*this.$borderSize-I,_e=A.top-3*this.$borderSize;M||(_e<=j||j>=K?M="bottom":M="top"),M==="top"?(z.bottom=A.top-this.$borderSize,z.top=z.bottom-K):M==="bottom"&&(z.top=A.top+I+this.$borderSize,z.bottom=z.top+K);var ge=z.top>=0&&z.bottom<=le;if(!re&&!ge)return!1;ge?R.$maxPixelHeight=null:M==="top"?R.$maxPixelHeight=_e:R.$maxPixelHeight=j,M==="top"?(Q.style.top="",Q.style.bottom=le-z.bottom+"px",h.isTopdown=!1):(Q.style.top=z.top+"px",Q.style.bottom="",h.isTopdown=!0),Q.style.display="";var ke=A.left;return ke+Q.offsetWidth>ce&&(ke=ce-Q.offsetWidth),Q.style.left=ke+"px",Q.style.right="",h.isOpen||(h.isOpen=!0,this._signal("show"),d=null),h.anchorPos=A,h.anchor=M,!0},h.show=function(A,I,M){this.tryShow(A,I,M?"bottom":void 0,!0)},h.goTo=function(A){var I=this.getRow(),M=this.session.getLength()-1;switch(A){case"up":I=I<=0?M:I-1;break;case"down":I=I>=M?-1:I+1;break;case"start":I=0;break;case"end":I=M}this.setRow(I)},h.getTextLeftOffset=function(){return this.$borderSize+this.renderer.$padding+this.$imageSize},h.$imageSize=0,h.$borderSize=1,h}return m}();c.importCssString(`
.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {
background-color: #CAD6FA;
z-index: 1;
}
.ace_dark.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {
background-color: #3a674e;
}
.ace_editor.ace_autocomplete .ace_line-hover {
border: 1px solid #abbffe;
margin-top: -1px;
background: rgba(233,233,253,0.4);
position: absolute;
z-index: 2;
}
.ace_dark.ace_editor.ace_autocomplete .ace_line-hover {
border: 1px solid rgba(109, 150, 13, 0.8);
background: rgba(58, 103, 78, 0.62);
}
.ace_completion-meta {
opacity: 0.5;
margin-left: 0.9em;
}
.ace_completion-message {
margin-left: 0.9em;
color: blue;
}
.ace_editor.ace_autocomplete .ace_completion-highlight{
color: #2d69c7;
}
.ace_dark.ace_editor.ace_autocomplete .ace_completion-highlight{
color: #93ca12;
}
.ace_editor.ace_autocomplete {
width: 300px;
z-index: 200000;
border: 1px lightgray solid;
position: fixed;
box-shadow: 2px 3px 5px rgba(0,0,0,.2);
line-height: 1.4;
background: #fefefe;
color: #111;
}
.ace_dark.ace_editor.ace_autocomplete {
border: 1px #484747 solid;
box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.51);
line-height: 1.4;
background: #25282c;
color: #c1c1c1;
}
.ace_autocomplete .ace_text-layer {
width: calc(100% - 8px);
}
.ace_autocomplete .ace_line {
display: flex;
align-items: center;
}
.ace_autocomplete .ace_line > * {
min-width: 0;
flex: 0 0 auto;
}
.ace_autocomplete .ace_line .ace_ {
flex: 0 1 auto;
overflow: hidden;
text-overflow: ellipsis;
}
.ace_autocomplete .ace_completion-spacer {
flex: 1;
}
.ace_autocomplete.ace_loading:after {
content: "";
position: absolute;
top: 0px;
height: 2px;
width: 8%;
background: blue;
z-index: 100;
animation: ace_progress 3s infinite linear;
animation-delay: 300ms;
transform: translateX(-100%) scaleX(1);
}
@keyframes ace_progress {
0% { transform: translateX(-100%) scaleX(1) }
50% { transform: translateX(625%) scaleX(2) }
100% { transform: translateX(1500%) scaleX(3) }
}
@media (prefers-reduced-motion) {
.ace_autocomplete.ace_loading:after {
transform: translateX(625%) scaleX(2);
animation: none;
}
}
`,"autocompletion.css",!1),i.AcePopup=oe,i.$singleLineEditor=te,i.getAriaId=H}),ace.define("ace/autocomplete/inline_screenreader",["require","exports","module"],function(S,i,D){"use strict";var f=function(){function v(C){this.editor=C,this.screenReaderDiv=document.createElement("div"),this.screenReaderDiv.classList.add("ace_screenreader-only"),this.editor.container.appendChild(this.screenReaderDiv)}return v.prototype.setScreenReaderContent=function(C){for(!this.popup&&this.editor.completer&&this.editor.completer.popup&&(this.popup=this.editor.completer.popup,this.popup.renderer.on("afterRender",function(){var u=this.popup.getRow(),c=this.popup.renderer.$textLayer,T=c.element.childNodes[u-c.config.firstRow];if(T){for(var L="doc-tooltip ",H=0;H<this._lines.length;H++)L+="ace-inline-screenreader-line-".concat(H," ");T.setAttribute("aria-describedby",L)}}.bind(this)));this.screenReaderDiv.firstChild;)this.screenReaderDiv.removeChild(this.screenReaderDiv.firstChild);this._lines=C.split(/\r\n|\r|\n/);var l=this.createCodeBlock();this.screenReaderDiv.appendChild(l)},v.prototype.destroy=function(){this.screenReaderDiv.remove()},v.prototype.createCodeBlock=function(){var C=document.createElement("pre");C.setAttribute("id","ace-inline-screenreader");for(var l=0;l<this._lines.length;l++){var u=document.createElement("code");u.setAttribute("id","ace-inline-screenreader-line-".concat(l));var c=document.createTextNode(this._lines[l]);u.appendChild(c),C.appendChild(u)}return C},v}();i.AceInlineScreenReader=f}),ace.define("ace/autocomplete/inline",["require","exports","module","ace/snippets","ace/autocomplete/inline_screenreader"],function(S,i,D){"use strict";var f=S("../snippets").snippetManager,v=S("./inline_screenreader").AceInlineScreenReader,C=function(){function l(){this.editor=null}return l.prototype.show=function(u,c,T){if(T=T||"",u&&this.editor&&this.editor!==u&&(this.hide(),this.editor=null,this.inlineScreenReader=null),!u||!c)return!1;this.inlineScreenReader||(this.inlineScreenReader=new v(u));var L=c.snippet?f.getDisplayTextForSnippet(u,c.snippet):c.value;return c.hideInlinePreview||!L||!L.startsWith(T)?!1:(this.editor=u,this.inlineScreenReader.setScreenReaderContent(L),L=L.slice(T.length),L===""?u.removeGhostText():u.setGhostText(L),!0)},l.prototype.isOpen=function(){return this.editor?!!this.editor.renderer.$ghostText:!1},l.prototype.hide=function(){return this.editor?(this.editor.removeGhostText(),!0):!1},l.prototype.destroy=function(){this.hide(),this.editor=null,this.inlineScreenReader&&(this.inlineScreenReader.destroy(),this.inlineScreenReader=null)},l}();i.AceInline=C}),ace.define("ace/autocomplete/util",["require","exports","module"],function(S,i,D){"use strict";i.parForEach=function(v,C,l){var u=0,c=v.length;c===0&&l();for(var T=0;T<c;T++)C(v[T],function(L,H){u++,u===c&&l(L,H)})};var f=/[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;i.retrievePrecedingIdentifier=function(v,C,l){l=l||f;for(var u=[],c=C-1;c>=0&&l.test(v[c]);c--)u.push(v[c]);return u.reverse().join("")},i.retrieveFollowingIdentifier=function(v,C,l){l=l||f;for(var u=[],c=C;c<v.length&&l.test(v[c]);c++)u.push(v[c]);return u},i.getCompletionPrefix=function(v){var C=v.getCursorPosition(),l=v.session.getLine(C.row),u;return v.completers.forEach(function(c){c.identifierRegexps&&c.identifierRegexps.forEach(function(T){!u&&T&&(u=this.retrievePrecedingIdentifier(l,C.column,T))}.bind(this))}.bind(this)),u||this.retrievePrecedingIdentifier(l,C.column)},i.triggerAutocomplete=function(v,l){var l=l==null?v.session.getPrecedingCharacter():l;return v.completers.some(function(u){if(u.triggerCharacters&&Array.isArray(u.triggerCharacters))return u.triggerCharacters.includes(l)})}}),ace.define("ace/autocomplete",["require","exports","module","ace/keyboard/hash_handler","ace/autocomplete/popup","ace/autocomplete/inline","ace/autocomplete/popup","ace/autocomplete/util","ace/lib/lang","ace/lib/dom","ace/snippets","ace/config","ace/lib/event","ace/lib/scroll"],function(S,i,D){"use strict";var f=S("./keyboard/hash_handler").HashHandler,v=S("./autocomplete/popup").AcePopup,C=S("./autocomplete/inline").AceInline,l=S("./autocomplete/popup").getAriaId,u=S("./autocomplete/util"),c=S("./lib/lang"),T=S("./lib/dom"),L=S("./snippets").snippetManager,H=S("./config"),Z=S("./lib/event"),$=S("./lib/scroll").preventParentScroll,W=function(x,y){y.completer&&y.completer.destroy()},te=function(){function x(){this.autoInsert=!1,this.autoSelect=!0,this.autoShown=!1,this.exactMatch=!1,this.inlineEnabled=!1,this.keyboardHandler=new f,this.keyboardHandler.bindKeys(this.commands),this.parentNode=null,this.setSelectOnHover=!1,this.hasSeen=new Set,this.showLoadingState=!1,this.stickySelectionDelay=500,this.blurListener=this.blurListener.bind(this),this.changeListener=this.changeListener.bind(this),this.mousedownListener=this.mousedownListener.bind(this),this.mousewheelListener=this.mousewheelListener.bind(this),this.onLayoutChange=this.onLayoutChange.bind(this),this.changeTimer=c.delayedCall(function(){this.updateCompletions(!0)}.bind(this)),this.tooltipTimer=c.delayedCall(this.updateDocTooltip.bind(this),50),this.popupTimer=c.delayedCall(this.$updatePopupPosition.bind(this),50),this.stickySelectionTimer=c.delayedCall(function(){this.stickySelection=!0}.bind(this),this.stickySelectionDelay),this.$firstOpenTimer=c.delayedCall(function(){var y=this.completionProvider&&this.completionProvider.initialPosition;this.autoShown||this.popup&&this.popup.isOpen||!y||this.editor.completers.length===0||(this.completions=new m(x.completionsForLoading),this.openPopup(this.editor,y.prefix,!1),this.popup.renderer.setStyle("ace_loading",!0))}.bind(this),this.stickySelectionDelay)}return Object.defineProperty(x,"completionsForLoading",{get:function(){return[{caption:H.nls("autocomplete.loading","Loading..."),value:""}]},enumerable:!1,configurable:!0}),x.prototype.$init=function(){return this.popup=new v(this.parentNode||document.body||document.documentElement),this.popup.on("click",function(y){this.insertMatch(),y.stop()}.bind(this)),this.popup.focus=this.editor.focus.bind(this.editor),this.popup.on("show",this.$onPopupShow.bind(this)),this.popup.on("hide",this.$onHidePopup.bind(this)),this.popup.on("select",this.$onPopupChange.bind(this)),Z.addListener(this.popup.container,"mouseout",this.mouseOutListener.bind(this)),this.popup.on("changeHoverMarker",this.tooltipTimer.bind(null,null)),this.popup.renderer.on("afterRender",this.$onPopupRender.bind(this)),this.popup},x.prototype.$initInline=function(){if(!(!this.inlineEnabled||this.inlineRenderer))return this.inlineRenderer=new C,this.inlineRenderer},x.prototype.getPopup=function(){return this.popup||this.$init()},x.prototype.$onHidePopup=function(){this.inlineRenderer&&this.inlineRenderer.hide(),this.hideDocTooltip(),this.stickySelectionTimer.cancel(),this.popupTimer.cancel(),this.stickySelection=!1},x.prototype.$seen=function(y){!this.hasSeen.has(y)&&y&&y.completer&&y.completer.onSeen&&typeof y.completer.onSeen=="function"&&(y.completer.onSeen(this.editor,y),this.hasSeen.add(y))},x.prototype.$onPopupChange=function(y){if(this.inlineRenderer&&this.inlineEnabled){var h=y?null:this.popup.getData(this.popup.getRow());if(this.$updateGhostText(h),this.popup.isMouseOver&&this.setSelectOnHover){this.tooltipTimer.call(null,null);return}this.popupTimer.schedule(),this.tooltipTimer.schedule()}else this.popupTimer.call(null,null),this.tooltipTimer.call(null,null)},x.prototype.$updateGhostText=function(y){var h=this.base.row,g=this.base.column,d=this.editor.getCursorPosition().column,b=this.editor.session.getLine(h).slice(g,d);this.inlineRenderer.show(this.editor,y,b)?this.$seen(y):this.inlineRenderer.hide()},x.prototype.$onPopupRender=function(){var y=this.inlineRenderer&&this.inlineEnabled;if(this.completions&&this.completions.filtered&&this.completions.filtered.length>0)for(var h=this.popup.getFirstVisibleRow();h<=this.popup.getLastVisibleRow();h++){var g=this.popup.getData(h);g&&(!y||g.hideInlinePreview)&&this.$seen(g)}},x.prototype.$onPopupShow=function(y){this.$onPopupChange(y),this.stickySelection=!1,this.stickySelectionDelay>=0&&this.stickySelectionTimer.schedule(this.stickySelectionDelay)},x.prototype.observeLayoutChanges=function(){if(!(this.$elements||!this.editor)){window.addEventListener("resize",this.onLayoutChange,{passive:!0}),window.addEventListener("wheel",this.mousewheelListener);for(var y=this.editor.container.parentNode,h=[];y;)h.push(y),y.addEventListener("scroll",this.onLayoutChange,{passive:!0}),y=y.parentNode;this.$elements=h}},x.prototype.unObserveLayoutChanges=function(){var y=this;window.removeEventListener("resize",this.onLayoutChange,{passive:!0}),window.removeEventListener("wheel",this.mousewheelListener),this.$elements&&this.$elements.forEach(function(h){h.removeEventListener("scroll",y.onLayoutChange,{passive:!0})}),this.$elements=null},x.prototype.onLayoutChange=function(){if(!this.popup.isOpen)return this.unObserveLayoutChanges();this.$updatePopupPosition(),this.updateDocTooltip()},x.prototype.$updatePopupPosition=function(){var y=this.editor,h=y.renderer,g=h.layerConfig.lineHeight,d=h.$cursorLayer.getPixelPosition(this.base,!0);d.left-=this.popup.getTextLeftOffset();var b=y.container.getBoundingClientRect();d.top+=b.top-h.layerConfig.offset,d.left+=b.left-y.renderer.scrollLeft,d.left+=h.gutterWidth;var E={top:d.top,left:d.left};h.$ghostText&&h.$ghostTextWidget&&this.base.row===h.$ghostText.position.row&&(E.top+=h.$ghostTextWidget.el.offsetHeight);var k=y.container.getBoundingClientRect().bottom-g,B=k<E.top?{top:k,left:E.left}:E;this.popup.tryShow(B,g,"bottom")||this.popup.tryShow(d,g,"top")||this.popup.show(d,g)},x.prototype.openPopup=function(y,h,g){this.$firstOpenTimer.cancel(),this.popup||this.$init(),this.inlineEnabled&&!this.inlineRenderer&&this.$initInline(),this.popup.autoSelect=this.autoSelect,this.popup.setSelectOnHover(this.setSelectOnHover);var d=this.popup.getRow(),b=this.popup.data[d];this.popup.setData(this.completions.filtered,this.completions.filterText),this.editor.textInput.setAriaOptions&&this.editor.textInput.setAriaOptions({activeDescendant:l(this.popup.getRow()),inline:this.inlineEnabled}),y.keyBinding.addKeyboardHandler(this.keyboardHandler);var E;this.stickySelection&&(E=this.popup.data.indexOf(b)),(!E||E===-1)&&(E=0),this.popup.setRow(this.autoSelect?E:-1),E===d&&b!==this.completions.filtered[E]&&this.$onPopupChange();var k=this.inlineRenderer&&this.inlineEnabled;if(E===d&&k){var B=this.popup.getData(this.popup.getRow());this.$updateGhostText(B)}g||(this.popup.setTheme(y.getTheme()),this.popup.setFontSize(y.getFontSize()),this.$updatePopupPosition(),this.tooltipNode&&this.updateDocTooltip()),this.changeTimer.cancel(),this.observeLayoutChanges()},x.prototype.detach=function(){this.editor&&(this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.off("changeSelection",this.changeListener),this.editor.off("blur",this.blurListener),this.editor.off("mousedown",this.mousedownListener),this.editor.off("mousewheel",this.mousewheelListener)),this.$firstOpenTimer.cancel(),this.changeTimer.cancel(),this.hideDocTooltip(),this.completionProvider&&this.completionProvider.detach(),this.popup&&this.popup.isOpen&&this.popup.hide(),this.popup&&this.popup.renderer&&this.popup.renderer.off("afterRender",this.$onPopupRender),this.base&&this.base.detach(),this.activated=!1,this.completionProvider=this.completions=this.base=null,this.unObserveLayoutChanges()},x.prototype.changeListener=function(y){var h=this.editor.selection.lead;(h.row!=this.base.row||h.column<this.base.column)&&this.detach(),this.activated?this.changeTimer.schedule():this.detach()},x.prototype.blurListener=function(y){var h=document.activeElement,g=this.editor.textInput.getElement(),d=y.relatedTarget&&this.tooltipNode&&this.tooltipNode.contains(y.relatedTarget),b=this.popup&&this.popup.container;h!=g&&h.parentNode!=b&&!d&&h!=this.tooltipNode&&y.relatedTarget!=g&&this.detach()},x.prototype.mousedownListener=function(y){this.detach()},x.prototype.mousewheelListener=function(y){this.popup&&!this.popup.isMouseOver&&this.detach()},x.prototype.mouseOutListener=function(y){this.popup.isOpen&&this.$updatePopupPosition()},x.prototype.goTo=function(y){this.popup.goTo(y)},x.prototype.insertMatch=function(y,h){if(y||(y=this.popup.getData(this.popup.getRow())),!y)return!1;if(y.value==="")return this.detach();var g=this.completions,d=this.getCompletionProvider().insertMatch(this.editor,y,g.filterText,h);return this.completions==g&&this.detach(),d},x.prototype.showPopup=function(y,h){this.editor&&this.detach(),this.activated=!0,this.editor=y,y.completer!=this&&(y.completer&&y.completer.detach(),y.completer=this),y.on("changeSelection",this.changeListener),y.on("blur",this.blurListener),y.on("mousedown",this.mousedownListener),y.on("mousewheel",this.mousewheelListener),this.updateCompletions(!1,h)},x.prototype.getCompletionProvider=function(y){return this.completionProvider||(this.completionProvider=new oe(y)),this.completionProvider},x.prototype.gatherCompletions=function(y,h){return this.getCompletionProvider().gatherCompletions(y,h)},x.prototype.updateCompletions=function(y,h){if(y&&this.base&&this.completions){var d=this.editor.getCursorPosition(),b=this.editor.session.getTextRange({start:this.base,end:d});if(b==this.completions.filterText)return;if(this.completions.setFilter(b),!this.completions.filtered.length)return this.detach();if(this.completions.filtered.length==1&&this.completions.filtered[0].value==b&&!this.completions.filtered[0].snippet)return this.detach();this.openPopup(this.editor,b,y);return}if(h&&h.matches){var d=this.editor.getSelectionRange().start;return this.base=this.editor.session.doc.createAnchor(d.row,d.column),this.base.$insertRight=!0,this.completions=new m(h.matches),this.getCompletionProvider().completions=this.completions,this.openPopup(this.editor,"",y)}var g=this.editor.getSession(),d=this.editor.getCursorPosition(),b=u.getCompletionPrefix(this.editor);this.base=g.doc.createAnchor(d.row,d.column-b.length),this.base.$insertRight=!0;var E={exactMatch:this.exactMatch,ignoreCaption:this.ignoreCaption};this.getCompletionProvider({prefix:b,pos:d}).provideCompletions(this.editor,E,function(k,B,_){var A=B.filtered,I=u.getCompletionPrefix(this.editor);if(this.$firstOpenTimer.cancel(),_){if(!A.length){var M=!this.autoShown&&this.emptyMessage;if(typeof M=="function"&&(M=this.emptyMessage(I)),M){var re=[{caption:M,value:""}];this.completions=new m(re),this.openPopup(this.editor,I,y),this.popup.renderer.setStyle("ace_loading",!1),this.popup.renderer.setStyle("ace_empty-message",!0);return}return this.detach()}if(A.length==1&&A[0].value==I&&!A[0].snippet)return this.detach();if(this.autoInsert&&!this.autoShown&&A.length==1)return this.insertMatch(A[0])}this.completions=!_&&this.showLoadingState?new m(x.completionsForLoading.concat(A),B.filterText):B,this.openPopup(this.editor,I,y),this.popup.renderer.setStyle("ace_empty-message",!1),this.popup.renderer.setStyle("ace_loading",!_)}.bind(this)),this.showLoadingState&&!this.autoShown&&(!this.popup||!this.popup.isOpen)&&this.$firstOpenTimer.delay(this.stickySelectionDelay/2)},x.prototype.cancelContextMenu=function(){this.editor.$mouseHandler.cancelContextMenu()},x.prototype.updateDocTooltip=function(){var y=this.popup,h=this.completions.filtered,g=h&&(h[y.getHoveredRow()]||h[y.getRow()]),d=null;if(!g||!this.editor||!this.popup.isOpen)return this.hideDocTooltip();for(var b=this.editor.completers.length,E=0;E<b;E++){var k=this.editor.completers[E];if(k.getDocTooltip&&g.completerId===k.id){d=k.getDocTooltip(g);break}}if(!d&&typeof g!="string"&&(d=g),typeof d=="string"&&(d={docText:d}),!d||!d.docHTML&&!d.docText)return this.hideDocTooltip();this.showDocTooltip(d)},x.prototype.showDocTooltip=function(y){this.tooltipNode||(this.tooltipNode=T.createElement("div"),this.tooltipNode.style.margin="0",this.tooltipNode.style.pointerEvents="auto",this.tooltipNode.style.overscrollBehavior="contain",this.tooltipNode.tabIndex=-1,this.tooltipNode.onblur=this.blurListener.bind(this),this.tooltipNode.onclick=this.onTooltipClick.bind(this),this.tooltipNode.id="doc-tooltip",this.tooltipNode.setAttribute("role","tooltip"),this.tooltipNode.addEventListener("wheel",$));var h=this.editor.renderer.theme;this.tooltipNode.className="ace_tooltip ace_doc-tooltip "+(h.isDark?"ace_dark ":"")+(h.cssClass||"");var g=this.tooltipNode;y.docHTML?g.innerHTML=y.docHTML:y.docText&&(g.textContent=y.docText),g.parentNode||this.popup.container.appendChild(this.tooltipNode);var d=this.popup,b=d.container.getBoundingClientRect();g.style.top=d.container.style.top,g.style.bottom=d.container.style.bottom,g.style.display="block",window.innerWidth-b.right<320?b.left<320?d.isTopdown?(g.style.top=b.bottom+"px",g.style.left=b.left+"px",g.style.right="",g.style.bottom=""):(g.style.top=d.container.offsetTop-g.offsetHeight+"px",g.style.left=b.left+"px",g.style.right="",g.style.bottom=""):(g.style.right=window.innerWidth-b.left+"px",g.style.left=""):(g.style.left=b.right+1+"px",g.style.right="")},x.prototype.hideDocTooltip=function(){if(this.tooltipTimer.cancel(),!!this.tooltipNode){var y=this.tooltipNode;!this.editor.isFocused()&&document.activeElement==y&&this.editor.focus(),this.tooltipNode=null,y.parentNode&&y.parentNode.removeChild(y)}},x.prototype.onTooltipClick=function(y){for(var h=y.target;h&&h!=this.tooltipNode;){if(h.nodeName=="A"&&h.href){h.rel="noreferrer",h.target="_blank";break}h=h.parentNode}},x.prototype.destroy=function(){if(this.detach(),this.popup){this.popup.destroy();var y=this.popup.container;y&&y.parentNode&&y.parentNode.removeChild(y)}this.editor&&this.editor.completer==this&&(this.editor.off("destroy",W),this.editor.completer=null),this.inlineRenderer=this.popup=this.editor=null},x}();te.prototype.commands={Up:function(x){x.completer.goTo("up")},Down:function(x){x.completer.goTo("down")},"Ctrl-Up|Ctrl-Home":function(x){x.completer.goTo("start")},"Ctrl-Down|Ctrl-End":function(x){x.completer.goTo("end")},Esc:function(x){x.completer.detach()},Return:function(x){return x.completer.insertMatch()},"Shift-Return":function(x){x.completer.insertMatch(null,{deleteSuffix:!0})},Tab:function(x){var y=x.completer.insertMatch();if(y||x.tabstopManager)return y;x.completer.goTo("down")},Backspace:function(x){x.execCommand("backspace");var y=u.getCompletionPrefix(x);!y&&x.completer&&x.completer.detach()},PageUp:function(x){x.completer.popup.gotoPageUp()},PageDown:function(x){x.completer.popup.gotoPageDown()}},te.for=function(x){return x.completer instanceof te||(x.completer&&(x.completer.destroy(),x.completer=null),H.get("sharedPopups")?(te.$sharedInstance||(te.$sharedInstance=new te),x.completer=te.$sharedInstance):(x.completer=new te,x.once("destroy",W))),x.completer},te.startCommand={name:"startAutocomplete",exec:function(x,y){var h=te.for(x);h.autoInsert=!1,h.autoSelect=!0,h.autoShown=!1,h.showPopup(x,y),h.cancelContextMenu()},bindKey:"Ctrl-Space|Ctrl-Shift-Space|Alt-Space"};var oe=function(){function x(y){this.initialPosition=y,this.active=!0}return x.prototype.insertByIndex=function(y,h,g){return!this.completions||!this.completions.filtered?!1:this.insertMatch(y,this.completions.filtered[h],g)},x.prototype.insertMatch=function(y,h,g){if(!h)return!1;if(y.startOperation({command:{name:"insertMatch"}}),h.completer&&h.completer.insertMatch)h.completer.insertMatch(y,h);else{if(!this.completions)return!1;var d=this.completions.filterText.length,b=0;if(h.range&&h.range.start.row===h.range.end.row&&(d-=this.initialPosition.prefix.length,d+=this.initialPosition.pos.column-h.range.start.column,b+=h.range.end.column-this.initialPosition.pos.column),d||b){var E;y.selection.getAllRanges?E=y.selection.getAllRanges():E=[y.getSelectionRange()];for(var k=0,B;B=E[k];k++)B.start.column-=d,B.end.column+=b,y.session.remove(B)}h.snippet?L.insertSnippet(y,h.snippet):this.$insertString(y,h),h.completer&&h.completer.onInsert&&typeof h.completer.onInsert=="function"&&h.completer.onInsert(y,h),h.command&&h.command==="startAutocomplete"&&y.execCommand(h.command)}return y.endOperation(),!0},x.prototype.$insertString=function(y,h){var g=h.value||h;y.execCommand("insertstring",g)},x.prototype.gatherCompletions=function(y,h){var g=y.getSession(),d=y.getCursorPosition(),b=u.getCompletionPrefix(y),E=[];this.completers=y.completers;var k=y.completers.length;return y.completers.forEach(function(B,_){B.getCompletions(y,g,d,b,function(A,I){B.hideInlinePreview&&(I=I.map(function(M){return Object.assign(M,{hideInlinePreview:B.hideInlinePreview})})),!A&&I&&(E=E.concat(I)),h(null,{prefix:u.getCompletionPrefix(y),matches:E,finished:--k===0})})}),!0},x.prototype.provideCompletions=function(y,h,g){var d=function(B){var _=B.prefix,A=B.matches;this.completions=new m(A),h.exactMatch&&(this.completions.exactMatch=!0),h.ignoreCaption&&(this.completions.ignoreCaption=!0),this.completions.setFilter(_),(B.finished||this.completions.filtered.length)&&g(null,this.completions,B.finished)}.bind(this),b=!0,E=null;if(this.gatherCompletions(y,function(B,_){if(this.active){B&&(g(B,[],!0),this.detach());var A=_.prefix;if(A.indexOf(_.prefix)===0){if(b){E=_;return}d(_)}}}.bind(this)),b=!1,E){var k=E;E=null,d(k)}},x.prototype.detach=function(){this.active=!1,this.completers&&this.completers.forEach(function(y){typeof y.cancel=="function"&&y.cancel()})},x}(),m=function(){function x(y,h){this.all=y,this.filtered=y,this.filterText=h||"",this.exactMatch=!1,this.ignoreCaption=!1}return x.prototype.setFilter=function(y){if(y.length>this.filterText&&y.lastIndexOf(this.filterText,0)===0)var h=this.filtered;else var h=this.all;this.filterText=y,h=this.filterCompletions(h,this.filterText),h=h.sort(function(d,b){return b.exactMatch-d.exactMatch||b.$score-d.$score||(d.caption||d.value).localeCompare(b.caption||b.value)});var g=null;h=h.filter(function(d){var b=d.snippet||d.caption||d.value;return b===g?!1:(g=b,!0)}),this.filtered=h},x.prototype.filterCompletions=function(y,h){var g=[],d=h.toUpperCase(),b=h.toLowerCase();e:for(var E=0,k;k=y[E];E++){var B=!this.ignoreCaption&&k.caption||k.value||k.snippet;if(B){var _=-1,A=0,I=0,M,re;if(this.exactMatch){if(h!==B.substr(0,h.length))continue e}else{var Q=B.toLowerCase().indexOf(b);if(Q>-1)I=Q;else for(var le=0;le<h.length;le++){var ce=B.indexOf(b[le],_+1),R=B.indexOf(d[le],_+1);if(M=ce>=0&&(R<0||ce<R)?ce:R,M<0)continue e;re=M-_-1,re>0&&(_===-1&&(I+=10),I+=re,A|=1<<le),_=M}}k.matchMask=A,k.exactMatch=I?0:1,k.$score=(k.score||0)-I,g.push(k)}}return g},x}();i.Autocomplete=te,i.CompletionProvider=oe,i.FilteredList=m}),ace.define("ace/autocomplete/text_completer",["require","exports","module","ace/range"],function(S,i,D){function f(u,c){var T=u.getTextRange(C.fromPoints({row:0,column:0},c));return T.split(l).length-1}function v(u,c){var T=f(u,c),L=u.getValue().split(l),H=Object.create(null),Z=L[T];return L.forEach(function($,W){if(!(!$||$===Z)){var te=Math.abs(T-W),oe=L.length-te;H[$]?H[$]=Math.max(oe,H[$]):H[$]=oe}}),H}var C=S("../range").Range,l=/[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;i.getCompletions=function(u,c,T,L,H){var Z=v(c,T),$=Object.keys(Z);H(null,$.map(function(W){return{caption:W,value:W,score:Z[W],meta:"local"}}))}}),ace.define("ace/ext/language_tools",["require","exports","module","ace/snippets","ace/autocomplete","ace/config","ace/lib/lang","ace/autocomplete/util","ace/autocomplete/text_completer","ace/editor","ace/config"],function(S,i,D){"use strict";var f=S("../snippets").snippetManager,v=S("../autocomplete").Autocomplete,C=S("../config"),l=S("../lib/lang"),u=S("../autocomplete/util"),c=S("../autocomplete/text_completer"),T={getCompletions:function(d,b,E,k,B){if(b.$mode.completer)return b.$mode.completer.getCompletions(d,b,E,k,B);var _=d.session.getState(E.row),A=b.$mode.getCompletions(_,b,E,k);A=A.map(function(I){return I.completerId=T.id,I}),B(null,A)},id:"keywordCompleter"},L=function(d){var b={};return d.replace(/\${(\d+)(:(.*?))?}/g,function(E,k,B,_){return b[k]=_||""}).replace(/\$(\d+?)/g,function(E,k){return b[k]})},H={getCompletions:function(d,b,E,k,B){var _=[],A=b.getTokenAt(E.row,E.column);A&&A.type.match(/(tag-name|tag-open|tag-whitespace|attribute-name|attribute-value)\.xml$/)?_.push("html-tag"):_=f.getActiveScopes(d);var I=f.snippetMap,M=[];_.forEach(function(re){for(var Q=I[re]||[],le=Q.length;le--;){var ce=Q[le],R=ce.name||ce.tabTrigger;R&&M.push({caption:R,snippet:ce.content,meta:ce.tabTrigger&&!ce.name?ce.tabTrigger+"\u21E5 ":"snippet",completerId:H.id})}},this),B(null,M)},getDocTooltip:function(d){d.snippet&&!d.docHTML&&(d.docHTML=["<b>",l.escapeHTML(d.caption),"</b>","<hr></hr>",l.escapeHTML(L(d.snippet))].join(""))},id:"snippetCompleter"},Z=[H,c,T];i.setCompleters=function(d){Z.length=0,d&&Z.push.apply(Z,d)},i.addCompleter=function(d){Z.push(d)},i.textCompleter=c,i.keyWordCompleter=T,i.snippetCompleter=H;var $={name:"expandSnippet",exec:function(d){return f.expandWithTab(d)},bindKey:"Tab"},W=function(d,b){te(b.session.$mode)},te=function(d){typeof d=="string"&&(d=C.$modes[d]),d&&(f.files||(f.files={}),oe(d.$id,d.snippetFileId),d.modes&&d.modes.forEach(te))},oe=function(d,b){!b||!d||f.files[d]||(f.files[d]={},C.loadModule(b,function(E){E&&(f.files[d]=E,!E.snippets&&E.snippetText&&(E.snippets=f.parseSnippetFile(E.snippetText)),f.register(E.snippets||[],E.scope),E.includeScopes&&(f.snippetMap[E.scope].includeScopes=E.includeScopes,E.includeScopes.forEach(function(k){te("ace/mode/"+k)})))}))},m=function(d){var b=d.editor,E=b.completer&&b.completer.activated;if(d.command.name==="backspace")E&&!u.getCompletionPrefix(b)&&b.completer.detach();else if(d.command.name==="insertstring"&&!E){x=d;var k=d.editor.$liveAutocompletionDelay;k?y.delay(k):h(d)}},x,y=l.delayedCall(function(){h(x)},0),h=function(d){var b=d.editor,E=u.getCompletionPrefix(b),k=d.args,B=u.triggerAutocomplete(b,k);if(E&&E.length>=b.$liveAutocompletionThreshold||B){var _=v.for(b);_.autoShown=!0,_.showPopup(b)}},g=S("../editor").Editor;S("../config").defineOptions(g.prototype,"editor",{enableBasicAutocompletion:{set:function(d){d?(this.completers||(this.completers=Array.isArray(d)?d:Z),this.commands.addCommand(v.startCommand)):this.commands.removeCommand(v.startCommand)},value:!1},enableLiveAutocompletion:{set:function(d){d?(this.completers||(this.completers=Array.isArray(d)?d:Z),this.commands.on("afterExec",m)):this.commands.off("afterExec",m)},value:!1},liveAutocompletionDelay:{initialValue:0},liveAutocompletionThreshold:{initialValue:0},enableSnippets:{set:function(d){d?(this.commands.addCommand($),this.on("changeMode",W),W(null,this)):(this.commands.removeCommand($),this.off("changeMode",W))},value:!1}})}),function(){ace.require(["ace/ext/language_tools"],function(S){P&&(P.exports=S)})}()},97726:(P,ee,G)=>{P=G.nmd(P),ace.define("ace/mode/json_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(S,i,D){"use strict";var f=S("../lib/oop"),v=S("./text_highlight_rules").TextHighlightRules,C=function(){this.$rules={start:[{token:"variable",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]\\s*(?=:)'},{token:"string",regex:'"',next:"string"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:"text",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"comment",regex:"\\/\\/.*$"},{token:"comment.start",regex:"\\/\\*",next:"comment"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"punctuation.operator",regex:/[,]/},{token:"text",regex:"\\s+"}],string:[{token:"constant.language.escape",regex:/\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/},{token:"string",regex:'"|$',next:"start"},{defaultToken:"string"}],comment:[{token:"comment.end",regex:"\\*\\/",next:"start"},{defaultToken:"comment"}]}};f.inherits(C,v),i.JsonHighlightRules=C}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(S,i,D){"use strict";var f=S("../range").Range,v=function(){};(function(){this.checkOutdent=function(C,l){return/^\s+$/.test(C)?/^\s*\}/.test(l):!1},this.autoOutdent=function(C,l){var u=C.getLine(l),c=u.match(/^(\s*\})/);if(!c)return 0;var T=c[1].length,L=C.findMatchingBracket({row:l,column:T});if(!L||L.row==l)return 0;var H=this.$getIndent(C.getLine(L.row));C.replace(new f(l,0,l,T-1),H)},this.$getIndent=function(C){return C.match(/^\s*/)[0]}}).call(v.prototype),i.MatchingBraceOutdent=v}),ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(S,i,D){"use strict";var f=S("../../lib/oop"),v=S("../../range").Range,C=S("./fold_mode").FoldMode,l=i.FoldMode=function(u){u&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+u.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+u.end)))};f.inherits(l,C),function(){this.foldingStartMarker=/([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/,this.singleLineBlockCommentRe=/^\s*(\/\*).*\*\/\s*$/,this.tripleStarBlockCommentRe=/^\s*(\/\*\*\*).*\*\/\s*$/,this.startRegionRe=/^\s*(\/\*|\/\/)#?region\b/,this._getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(u,c,T){var L=u.getLine(T);if(this.singleLineBlockCommentRe.test(L)&&!this.startRegionRe.test(L)&&!this.tripleStarBlockCommentRe.test(L))return"";var H=this._getFoldWidgetBase(u,c,T);return!H&&this.startRegionRe.test(L)?"start":H},this.getFoldWidgetRange=function(u,c,T,L){var H=u.getLine(T);if(this.startRegionRe.test(H))return this.getCommentRegionBlock(u,H,T);var W=H.match(this.foldingStartMarker);if(W){var Z=W.index;if(W[1])return this.openingBracketBlock(u,W[1],T,Z);var $=u.getCommentFoldRange(T,Z+W[0].length,1);return $&&!$.isMultiLine()&&(L?$=this.getSectionRange(u,T):c!="all"&&($=null)),$}if(c!=="markbegin"){var W=H.match(this.foldingStopMarker);if(W){var Z=W.index+W[0].length;return W[1]?this.closingBracketBlock(u,W[1],T,Z):u.getCommentFoldRange(T,Z,-1)}}},this.getSectionRange=function(u,c){var T=u.getLine(c),L=T.search(/\S/),H=c,Z=T.length;c+=1;for(var $=c,W=u.getLength();++c<W;){T=u.getLine(c);var te=T.search(/\S/);if(te!==-1){if(L>te)break;var oe=this.getFoldWidgetRange(u,"all",c);if(oe){if(oe.start.row<=H)break;if(oe.isMultiLine())c=oe.end.row;else if(L==te)break}$=c}}return new v(H,Z,$,u.getLine($).length)},this.getCommentRegionBlock=function(u,c,T){for(var L=c.search(/\s*$/),H=u.getLength(),Z=T,$=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,W=1;++T<H;){c=u.getLine(T);var te=$.exec(c);if(te&&(te[1]?W--:W++,!W))break}var oe=T;if(oe>Z)return new v(Z,L,oe,c.length)}}.call(l.prototype)}),ace.define("ace/mode/json",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/json_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/cstyle","ace/worker/worker_client"],function(S,i,D){"use strict";var f=S("../lib/oop"),v=S("./text").Mode,C=S("./json_highlight_rules").JsonHighlightRules,l=S("./matching_brace_outdent").MatchingBraceOutdent,u=S("./folding/cstyle").FoldMode,c=S("../worker/worker_client").WorkerClient,T=function(){this.HighlightRules=C,this.$outdent=new l,this.$behaviour=this.$defaultBehaviour,this.foldingRules=new u};f.inherits(T,v),function(){this.lineCommentStart="//",this.blockComment={start:"/*",end:"*/"},this.getNextLineIndent=function(L,H,Z){var $=this.$getIndent(H);if(L=="start"){var W=H.match(/^.*[\{\(\[]\s*$/);W&&($+=Z)}return $},this.checkOutdent=function(L,H,Z){return this.$outdent.checkOutdent(H,Z)},this.autoOutdent=function(L,H,Z){this.$outdent.autoOutdent(H,Z)},this.createWorker=function(L){var H=new c(["ace"],"ace/mode/json_worker","JsonWorker");return H.attachToDocument(L.getDocument()),H.on("annotate",function(Z){L.setAnnotations(Z.data)}),H.on("terminate",function(){L.clearAnnotations()}),H},this.$id="ace/mode/json"}.call(T.prototype),i.Mode=T}),function(){ace.require(["ace/mode/json"],function(S){P&&(P.exports=S)})}()},44210:(P,ee,G)=>{P=G.nmd(P),ace.define("ace/theme/chrome-css",["require","exports","module"],function(S,i,D){D.exports=`.ace-chrome .ace_gutter {
background: #ebebeb;
color: #333;
overflow : hidden;
}
.ace-chrome .ace_print-margin {
width: 1px;
background: #e8e8e8;
}
.ace-chrome {
background-color: #FFFFFF;
color: black;
}
.ace-chrome .ace_cursor {
color: black;
}
.ace-chrome .ace_invisible {
color: rgb(191, 191, 191);
}
.ace-chrome .ace_constant.ace_buildin {
color: rgb(88, 72, 246);
}
.ace-chrome .ace_constant.ace_language {
color: rgb(88, 92, 246);
}
.ace-chrome .ace_constant.ace_library {
color: rgb(6, 150, 14);
}
.ace-chrome .ace_invalid {
background-color: rgb(153, 0, 0);
color: white;
}
.ace-chrome .ace_fold {
}
.ace-chrome .ace_support.ace_function {
color: rgb(60, 76, 114);
}
.ace-chrome .ace_support.ace_constant {
color: rgb(6, 150, 14);
}
.ace-chrome .ace_support.ace_type,
.ace-chrome .ace_support.ace_class
.ace-chrome .ace_support.ace_other {
color: rgb(109, 121, 222);
}
.ace-chrome .ace_variable.ace_parameter {
font-style:italic;
color:#FD971F;
}
.ace-chrome .ace_keyword.ace_operator {
color: rgb(104, 118, 135);
}
.ace-chrome .ace_comment {
color: #236e24;
}
.ace-chrome .ace_comment.ace_doc {
color: #236e24;
}
.ace-chrome .ace_comment.ace_doc.ace_tag {
color: #236e24;
}
.ace-chrome .ace_constant.ace_numeric {
color: rgb(0, 0, 205);
}
.ace-chrome .ace_variable {
color: rgb(49, 132, 149);
}
.ace-chrome .ace_xml-pe {
color: rgb(104, 104, 91);
}
.ace-chrome .ace_entity.ace_name.ace_function {
color: #0000A2;
}
.ace-chrome .ace_heading {
color: rgb(12, 7, 255);
}
.ace-chrome .ace_list {
color:rgb(185, 6, 144);
}
.ace-chrome .ace_marker-layer .ace_selection {
background: rgb(181, 213, 255);
}
.ace-chrome .ace_marker-layer .ace_step {
background: rgb(252, 255, 0);
}
.ace-chrome .ace_marker-layer .ace_stack {
background: rgb(164, 229, 101);
}
.ace-chrome .ace_marker-layer .ace_bracket {
margin: -1px 0 0 -1px;
border: 1px solid rgb(192, 192, 192);
}
.ace-chrome .ace_marker-layer .ace_active-line {
background: rgba(0, 0, 0, 0.07);
}
.ace-chrome .ace_gutter-active-line {
background-color : #dcdcdc;
}
.ace-chrome .ace_marker-layer .ace_selected-word {
background: rgb(250, 250, 255);
border: 1px solid rgb(200, 200, 250);
}
.ace-chrome .ace_storage,
.ace-chrome .ace_keyword,
.ace-chrome .ace_meta.ace_tag {
color: rgb(147, 15, 128);
}
.ace-chrome .ace_string.ace_regex {
color: rgb(255, 0, 0)
}
.ace-chrome .ace_string {
color: #1A1AA6;
}
.ace-chrome .ace_entity.ace_other.ace_attribute-name {
color: #994409;
}
.ace-chrome .ace_indent-guide {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;
}
.ace-chrome .ace_indent-guide-active {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAAZSURBVHjaYvj///9/hivKyv8BAAAA//8DACLqBhbvk+/eAAAAAElFTkSuQmCC") right repeat-y;
}
`}),ace.define("ace/theme/chrome",["require","exports","module","ace/theme/chrome-css","ace/lib/dom"],function(S,i,D){i.isDark=!1,i.cssClass="ace-chrome",i.cssText=S("./chrome-css");var f=S("../lib/dom");f.importCssString(i.cssText,i.cssClass,!1)}),function(){ace.require(["ace/theme/chrome"],function(S){P&&(P.exports=S)})}()},9285:(P,ee,G)=>{P=G.nmd(P),ace.define("ace/theme/clouds_midnight-css",["require","exports","module"],function(S,i,D){D.exports=`.ace-clouds-midnight .ace_gutter {
background: #232323;
color: #929292
}
.ace-clouds-midnight .ace_print-margin {
width: 1px;
background: #232323
}
.ace-clouds-midnight {
background-color: #191919;
color: #929292
}
.ace-clouds-midnight .ace_cursor {
color: #7DA5DC
}
.ace-clouds-midnight .ace_marker-layer .ace_selection {
background: #000000
}
.ace-clouds-midnight.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #191919;
}
.ace-clouds-midnight .ace_marker-layer .ace_step {
background: rgb(102, 82, 0)
}
.ace-clouds-midnight .ace_marker-layer .ace_bracket {
margin: -1px 0 0 -1px;
border: 1px solid #BFBFBF
}
.ace-clouds-midnight .ace_marker-layer .ace_active-line {
background: rgba(215, 215, 215, 0.031)
}
.ace-clouds-midnight .ace_gutter-active-line {
background-color: rgba(215, 215, 215, 0.031)
}
.ace-clouds-midnight .ace_marker-layer .ace_selected-word {
border: 1px solid #000000
}
.ace-clouds-midnight .ace_invisible {
color: #666
}
.ace-clouds-midnight .ace_keyword,
.ace-clouds-midnight .ace_meta,
.ace-clouds-midnight .ace_support.ace_constant.ace_property-value {
color: #927C5D
}
.ace-clouds-midnight .ace_keyword.ace_operator {
color: #4B4B4B
}
.ace-clouds-midnight .ace_keyword.ace_other.ace_unit {
color: #366F1A
}
.ace-clouds-midnight .ace_constant.ace_language {
color: #39946A
}
.ace-clouds-midnight .ace_constant.ace_numeric {
color: #46A609
}
.ace-clouds-midnight .ace_constant.ace_character.ace_entity {
color: #A165AC
}
.ace-clouds-midnight .ace_invalid {
color: #FFFFFF;
background-color: #E92E2E
}
.ace-clouds-midnight .ace_fold {
background-color: #927C5D;
border-color: #929292
}
.ace-clouds-midnight .ace_storage,
.ace-clouds-midnight .ace_support.ace_class,
.ace-clouds-midnight .ace_support.ace_function,
.ace-clouds-midnight .ace_support.ace_other,
.ace-clouds-midnight .ace_support.ace_type {
color: #E92E2E
}
.ace-clouds-midnight .ace_string {
color: #5D90CD
}
.ace-clouds-midnight .ace_comment {
color: #3C403B
}
.ace-clouds-midnight .ace_entity.ace_name.ace_tag,
.ace-clouds-midnight .ace_entity.ace_other.ace_attribute-name {
color: #606060
}
.ace-clouds-midnight .ace_indent-guide {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYHB3d/8PAAOIAdULw8qMAAAAAElFTkSuQmCC) right repeat-y
}
.ace-clouds-midnight .ace_indent-guide-active {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQIW2PQ1dX9zzBz5sz/ABCcBFFentLlAAAAAElFTkSuQmCC) right repeat-y;
}
`}),ace.define("ace/theme/clouds_midnight",["require","exports","module","ace/theme/clouds_midnight-css","ace/lib/dom"],function(S,i,D){i.isDark=!0,i.cssClass="ace-clouds-midnight",i.cssText=S("./clouds_midnight-css");var f=S("../lib/dom");f.importCssString(i.cssText,i.cssClass,!1)}),function(){ace.require(["ace/theme/clouds_midnight"],function(S){P&&(P.exports=S)})}()},51197:function(){"no use strict";(function(P){function ee(i,D){for(var f=i,v="";f;){var C=D[f];if(typeof C=="string")return C+v;if(C)return C.location.replace(/\/*$/,"/")+(v||C.main||C.name);if(C===!1)return"";var l=f.lastIndexOf("/");if(l===-1)break;v=f.substr(l)+v,f=f.slice(0,l)}return i}if(!(typeof P.window!="undefined"&&P.document)&&!(P.require&&P.define)){P.console||(P.console=function(){var i=Array.prototype.slice.call(arguments,0);postMessage({type:"log",data:i})},P.console.error=P.console.warn=P.console.log=P.console.trace=P.console),P.window=P,P.ace=P,P.onerror=function(i,D,f,v,C){postMessage({type:"error",data:{message:i,data:C&&C.data,file:D,line:f,col:v,stack:C&&C.stack}})},P.normalizeModule=function(i,D){if(D.indexOf("!")!==-1){var f=D.split("!");return P.normalizeModule(i,f[0])+"!"+P.normalizeModule(i,f[1])}if(D.charAt(0)=="."){var v=i.split("/").slice(0,-1).join("/");for(D=(v?v+"/":"")+D;D.indexOf(".")!==-1&&C!=D;){var C=D;D=D.replace(/^\.\//,"").replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return D},P.require=function(i,D){if(D||(D=i,i=null),!D.charAt)throw new Error("worker.js require() accepts only (parentId, id) as arguments");D=P.normalizeModule(i,D);var f=P.require.modules[D];if(f)return f.initialized||(f.initialized=!0,f.exports=f.factory().exports),f.exports;if(!P.require.tlns)return console.log("unable to load "+D);var v=ee(D,P.require.tlns);return v.slice(-3)!=".js"&&(v+=".js"),P.require.id=D,P.require.modules[D]={},importScripts(v),P.require(i,D)},P.require.modules={},P.require.tlns={},P.define=function(i,D,f){if(arguments.length==2?(f=D,typeof i!="string"&&(D=i,i=P.require.id)):arguments.length==1&&(f=i,D=[],i=P.require.id),typeof f!="function"){P.require.modules[i]={exports:f,initialized:!0};return}D.length||(D=["require","exports","module"]);var v=function(C){return P.require(i,C)};P.require.modules[i]={exports:{},factory:function(){var C=this,l=f.apply(this,D.slice(0,f.length).map(function(u){switch(u){case"require":return v;case"exports":return C.exports;case"module":return C;default:return v(u)}}));return l&&(C.exports=l),C}}},P.define.amd={},P.require.tlns={},P.initBaseUrls=function(i){for(var D in i)this.require.tlns[D]=i[D]},P.initSender=function(){var i=P.require("ace/lib/event_emitter").EventEmitter,D=P.require("ace/lib/oop"),f=function(){};return function(){D.implement(this,i),this.callback=function(v,C){postMessage({type:"call",id:C,data:v})},this.emit=function(v,C){postMessage({type:"event",name:v,data:C})}}.call(f.prototype),new f};var G=P.main=null,S=P.sender=null;P.onmessage=function(i){var D=i.data;if(D.event&&S)S._signal(D.event,D.data);else if(D.command)if(G[D.command])G[D.command].apply(G,D.args);else{if(!P[D.command])throw new Error("Unknown command:"+D.command);P[D.command].apply(P,D.args)}else if(D.init){P.initBaseUrls(D.tlns),S=P.sender=P.initSender();var f=this.require(D.module)[D.classname];G=P.main=new f(S)}}}})(this),ace.define("ace/lib/oop",[],function(P,ee,G){"use strict";ee.inherits=function(S,i){S.super_=i,S.prototype=Object.create(i.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}})},ee.mixin=function(S,i){for(var D in i)S[D]=i[D];return S},ee.implement=function(S,i){ee.mixin(S,i)}}),ace.define("ace/apply_delta",[],function(P,ee,G){"use strict";function S(f,v){throw console.log("Invalid Delta:",f),"Invalid Delta: "+v}function i(f,v){return v.row>=0&&v.row<f.length&&v.column>=0&&v.column<=f[v.row].length}function D(f,v){v.action!="insert"&&v.action!="remove"&&S(v,"delta.action must be 'insert' or 'remove'"),v.lines instanceof Array||S(v,"delta.lines must be an Array"),(!v.start||!v.end)&&S(v,"delta.start/end must be an present");var C=v.start;i(f,v.start)||S(v,"delta.start must be contained in document");var l=v.end;v.action=="remove"&&!i(f,l)&&S(v,"delta.end must contained in document for 'remove' actions");var u=l.row-C.row,c=l.column-(u==0?C.column:0);(u!=v.lines.length-1||v.lines[u].length!=c)&&S(v,"delta.range must match delta lines")}ee.applyDelta=function(f,v,C){var l=v.start.row,u=v.start.column,c=f[l]||"";switch(v.action){case"insert":var T=v.lines;if(T.length===1)f[l]=c.substring(0,u)+v.lines[0]+c.substring(u);else{var L=[l,1].concat(v.lines);f.splice.apply(f,L),f[l]=c.substring(0,u)+f[l],f[l+v.lines.length-1]+=c.substring(u)}break;case"remove":var H=v.end.column,Z=v.end.row;l===Z?f[l]=c.substring(0,u)+c.substring(H):f.splice(l,Z-l+1,c.substring(0,u)+f[Z].substring(H))}}}),ace.define("ace/lib/event_emitter",[],function(P,ee,G){"use strict";var S={},i=function(){this.propagationStopped=!0},D=function(){this.defaultPrevented=!0};S._emit=S._dispatchEvent=function(f,v){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var C=this._eventRegistry[f]||[],l=this._defaultHandlers[f];if(!(!C.length&&!l)){(typeof v!="object"||!v)&&(v={}),v.type||(v.type=f),v.stopPropagation||(v.stopPropagation=i),v.preventDefault||(v.preventDefault=D),C=C.slice();for(var u=0;u<C.length&&(C[u](v,this),!v.propagationStopped);u++);if(l&&!v.defaultPrevented)return l(v,this)}},S._signal=function(f,v){var C=(this._eventRegistry||{})[f];if(C){C=C.slice();for(var l=0;l<C.length;l++)C[l](v,this)}},S.once=function(f,v){var C=this;if(this.on(f,function l(){C.off(f,l),v.apply(null,arguments)}),!v)return new Promise(function(l){v=l})},S.setDefaultHandler=function(f,v){var C=this._defaultHandlers;if(C||(C=this._defaultHandlers={_disabled_:{}}),C[f]){var l=C[f],u=C._disabled_[f];u||(C._disabled_[f]=u=[]),u.push(l);var c=u.indexOf(v);c!=-1&&u.splice(c,1)}C[f]=v},S.removeDefaultHandler=function(f,v){var C=this._defaultHandlers;if(C){var l=C._disabled_[f];if(C[f]==v)l&&this.setDefaultHandler(f,l.pop());else if(l){var u=l.indexOf(v);u!=-1&&l.splice(u,1)}}},S.on=S.addEventListener=function(f,v,C){this._eventRegistry=this._eventRegistry||{};var l=this._eventRegistry[f];return l||(l=this._eventRegistry[f]=[]),l.indexOf(v)==-1&&l[C?"unshift":"push"](v),v},S.off=S.removeListener=S.removeEventListener=function(f,v){this._eventRegistry=this._eventRegistry||{};var C=this._eventRegistry[f];if(C){var l=C.indexOf(v);l!==-1&&C.splice(l,1)}},S.removeAllListeners=function(f){f||(this._eventRegistry=this._defaultHandlers=void 0),this._eventRegistry&&(this._eventRegistry[f]=void 0),this._defaultHandlers&&(this._defaultHandlers[f]=void 0)},ee.EventEmitter=S}),ace.define("ace/range",[],function(P,ee,G){"use strict";var S=function(){function i(D,f,v,C){this.start={row:D,column:f},this.end={row:v,column:C}}return i.prototype.isEqual=function(D){return this.start.row===D.start.row&&this.end.row===D.end.row&&this.start.column===D.start.column&&this.end.column===D.end.column},i.prototype.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},i.prototype.contains=function(D,f){return this.compare(D,f)==0},i.prototype.compareRange=function(D){var f,v=D.end,C=D.start;return f=this.compare(v.row,v.column),f==1?(f=this.compare(C.row,C.column),f==1?2:f==0?1:0):f==-1?-2:(f=this.compare(C.row,C.column),f==-1?-1:f==1?42:0)},i.prototype.comparePoint=function(D){return this.compare(D.row,D.column)},i.prototype.containsRange=function(D){return this.comparePoint(D.start)==0&&this.comparePoint(D.end)==0},i.prototype.intersects=function(D){var f=this.compareRange(D);return f==-1||f==0||f==1},i.prototype.isEnd=function(D,f){return this.end.row==D&&this.end.column==f},i.prototype.isStart=function(D,f){return this.start.row==D&&this.start.column==f},i.prototype.setStart=function(D,f){typeof D=="object"?(this.start.column=D.column,this.start.row=D.row):(this.start.row=D,this.start.column=f)},i.prototype.setEnd=function(D,f){typeof D=="object"?(this.end.column=D.column,this.end.row=D.row):(this.end.row=D,this.end.column=f)},i.prototype.inside=function(D,f){return this.compare(D,f)==0?!(this.isEnd(D,f)||this.isStart(D,f)):!1},i.prototype.insideStart=function(D,f){return this.compare(D,f)==0?!this.isEnd(D,f):!1},i.prototype.insideEnd=function(D,f){return this.compare(D,f)==0?!this.isStart(D,f):!1},i.prototype.compare=function(D,f){return!this.isMultiLine()&&D===this.start.row?f<this.start.column?-1:f>this.end.column?1:0:D<this.start.row?-1:D>this.end.row?1:this.start.row===D?f>=this.start.column?0:-1:this.end.row===D?f<=this.end.column?0:1:0},i.prototype.compareStart=function(D,f){return this.start.row==D&&this.start.column==f?-1:this.compare(D,f)},i.prototype.compareEnd=function(D,f){return this.end.row==D&&this.end.column==f?1:this.compare(D,f)},i.prototype.compareInside=function(D,f){return this.end.row==D&&this.end.column==f?1:this.start.row==D&&this.start.column==f?-1:this.compare(D,f)},i.prototype.clipRows=function(D,f){if(this.end.row>f)var v={row:f+1,column:0};else if(this.end.row<D)var v={row:D,column:0};if(this.start.row>f)var C={row:f+1,column:0};else if(this.start.row<D)var C={row:D,column:0};return i.fromPoints(C||this.start,v||this.end)},i.prototype.extend=function(D,f){var v=this.compare(D,f);if(v==0)return this;if(v==-1)var C={row:D,column:f};else var l={row:D,column:f};return i.fromPoints(C||this.start,l||this.end)},i.prototype.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},i.prototype.isMultiLine=function(){return this.start.row!==this.end.row},i.prototype.clone=function(){return i.fromPoints(this.start,this.end)},i.prototype.collapseRows=function(){return this.end.column==0?new i(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new i(this.start.row,0,this.end.row,0)},i.prototype.toScreenRange=function(D){var f=D.documentToScreenPosition(this.start),v=D.documentToScreenPosition(this.end);return new i(f.row,f.column,v.row,v.column)},i.prototype.moveBy=function(D,f){this.start.row+=D,this.start.column+=f,this.end.row+=D,this.end.column+=f},i}();S.fromPoints=function(i,D){return new S(i.row,i.column,D.row,D.column)},S.comparePoints=function(i,D){return i.row-D.row||i.column-D.column},ee.Range=S}),ace.define("ace/anchor",[],function(P,ee,G){"use strict";function S(C,l,u){var c=u?C.column<=l.column:C.column<l.column;return C.row<l.row||C.row==l.row&&c}function i(C,l,u){var c=C.action=="insert",T=(c?1:-1)*(C.end.row-C.start.row),L=(c?1:-1)*(C.end.column-C.start.column),H=C.start,Z=c?H:C.end;return S(l,H,u)?{row:l.row,column:l.column}:S(Z,l,!u)?{row:l.row+T,column:l.column+(l.row==Z.row?L:0)}:{row:H.row,column:H.column}}var D=P("./lib/oop"),f=P("./lib/event_emitter").EventEmitter,v=function(){function C(l,u,c){this.$onChange=this.onChange.bind(this),this.attach(l),typeof u!="number"?this.setPosition(u.row,u.column):this.setPosition(u,c)}return C.prototype.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},C.prototype.getDocument=function(){return this.document},C.prototype.onChange=function(l){if(!(l.start.row==l.end.row&&l.start.row!=this.row)&&!(l.start.row>this.row)){var u=i(l,{row:this.row,column:this.column},this.$insertRight);this.setPosition(u.row,u.column,!0)}},C.prototype.setPosition=function(l,u,c){var T;if(c?T={row:l,column:u}:T=this.$clipPositionToDocument(l,u),!(this.row==T.row&&this.column==T.column)){var L={row:this.row,column:this.column};this.row=T.row,this.column=T.column,this._signal("change",{old:L,value:T})}},C.prototype.detach=function(){this.document.off("change",this.$onChange)},C.prototype.attach=function(l){this.document=l||this.document,this.document.on("change",this.$onChange)},C.prototype.$clipPositionToDocument=function(l,u){var c={};return l>=this.document.getLength()?(c.row=Math.max(0,this.document.getLength()-1),c.column=this.document.getLine(c.row).length):l<0?(c.row=0,c.column=0):(c.row=l,c.column=Math.min(this.document.getLine(c.row).length,Math.max(0,u))),u<0&&(c.column=0),c},C}();v.prototype.$insertRight=!1,D.implement(v.prototype,f),ee.Anchor=v}),ace.define("ace/document",[],function(P,ee,G){"use strict";var S=P("./lib/oop"),i=P("./apply_delta").applyDelta,D=P("./lib/event_emitter").EventEmitter,f=P("./range").Range,v=P("./anchor").Anchor,C=function(){function l(u){this.$lines=[""],u.length===0?this.$lines=[""]:Array.isArray(u)?this.insertMergedLines({row:0,column:0},u):this.insert({row:0,column:0},u)}return l.prototype.setValue=function(u){var c=this.getLength()-1;this.remove(new f(0,0,c,this.getLine(c).length)),this.insert({row:0,column:0},u||"")},l.prototype.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},l.prototype.createAnchor=function(u,c){return new v(this,u,c)},l.prototype.$detectNewLine=function(u){var c=u.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=c?c[1]:`
`,this._signal("changeNewLineMode")},l.prototype.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return`\r
`;case"unix":return`
`;default:return this.$autoNewLine||`
`}},l.prototype.setNewLineMode=function(u){this.$newLineMode!==u&&(this.$newLineMode=u,this._signal("changeNewLineMode"))},l.prototype.getNewLineMode=function(){return this.$newLineMode},l.prototype.isNewLine=function(u){return u==`\r
`||u=="\r"||u==`
`},l.prototype.getLine=function(u){return this.$lines[u]||""},l.prototype.getLines=function(u,c){return this.$lines.slice(u,c+1)},l.prototype.getAllLines=function(){return this.getLines(0,this.getLength())},l.prototype.getLength=function(){return this.$lines.length},l.prototype.getTextRange=function(u){return this.getLinesForRange(u).join(this.getNewLineCharacter())},l.prototype.getLinesForRange=function(u){var c;if(u.start.row===u.end.row)c=[this.getLine(u.start.row).substring(u.start.column,u.end.column)];else{c=this.getLines(u.start.row,u.end.row),c[0]=(c[0]||"").substring(u.start.column);var T=c.length-1;u.end.row-u.start.row==T&&(c[T]=c[T].substring(0,u.end.column))}return c},l.prototype.insertLines=function(u,c){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(u,c)},l.prototype.removeLines=function(u,c){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(u,c)},l.prototype.insertNewLine=function(u){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(u,["",""])},l.prototype.insert=function(u,c){return this.getLength()<=1&&this.$detectNewLine(c),this.insertMergedLines(u,this.$split(c))},l.prototype.insertInLine=function(u,c){var T=this.clippedPos(u.row,u.column),L=this.pos(u.row,u.column+c.length);return this.applyDelta({start:T,end:L,action:"insert",lines:[c]},!0),this.clonePos(L)},l.prototype.clippedPos=function(u,c){var T=this.getLength();u===void 0?u=T:u<0?u=0:u>=T&&(u=T-1,c=void 0);var L=this.getLine(u);return c==null&&(c=L.length),c=Math.min(Math.max(c,0),L.length),{row:u,column:c}},l.prototype.clonePos=function(u){return{row:u.row,column:u.column}},l.prototype.pos=function(u,c){return{row:u,column:c}},l.prototype.$clipPosition=function(u){var c=this.getLength();return u.row>=c?(u.row=Math.max(0,c-1),u.column=this.getLine(c-1).length):(u.row=Math.max(0,u.row),u.column=Math.min(Math.max(u.column,0),this.getLine(u.row).length)),u},l.prototype.insertFullLines=function(u,c){u=Math.min(Math.max(u,0),this.getLength());var T=0;u<this.getLength()?(c=c.concat([""]),T=0):(c=[""].concat(c),u--,T=this.$lines[u].length),this.insertMergedLines({row:u,column:T},c)},l.prototype.insertMergedLines=function(u,c){var T=this.clippedPos(u.row,u.column),L={row:T.row+c.length-1,column:(c.length==1?T.column:0)+c[c.length-1].length};return this.applyDelta({start:T,end:L,action:"insert",lines:c}),this.clonePos(L)},l.prototype.remove=function(u){var c=this.clippedPos(u.start.row,u.start.column),T=this.clippedPos(u.end.row,u.end.column);return this.applyDelta({start:c,end:T,action:"remove",lines:this.getLinesForRange({start:c,end:T})}),this.clonePos(c)},l.prototype.removeInLine=function(u,c,T){var L=this.clippedPos(u,c),H=this.clippedPos(u,T);return this.applyDelta({start:L,end:H,action:"remove",lines:this.getLinesForRange({start:L,end:H})},!0),this.clonePos(L)},l.prototype.removeFullLines=function(u,c){u=Math.min(Math.max(0,u),this.getLength()-1),c=Math.min(Math.max(0,c),this.getLength()-1);var T=c==this.getLength()-1&&u>0,L=c<this.getLength()-1,H=T?u-1:u,Z=T?this.getLine(H).length:0,$=L?c+1:c,W=L?0:this.getLine($).length,te=new f(H,Z,$,W),oe=this.$lines.slice(u,c+1);return this.applyDelta({start:te.start,end:te.end,action:"remove",lines:this.getLinesForRange(te)}),oe},l.prototype.removeNewLine=function(u){u<this.getLength()-1&&u>=0&&this.applyDelta({start:this.pos(u,this.getLine(u).length),end:this.pos(u+1,0),action:"remove",lines:["",""]})},l.prototype.replace=function(u,c){if(u instanceof f||(u=f.fromPoints(u.start,u.end)),c.length===0&&u.isEmpty())return u.start;if(c==this.getTextRange(u))return u.end;this.remove(u);var T;return c?T=this.insert(u.start,c):T=u.start,T},l.prototype.applyDeltas=function(u){for(var c=0;c<u.length;c++)this.applyDelta(u[c])},l.prototype.revertDeltas=function(u){for(var c=u.length-1;c>=0;c--)this.revertDelta(u[c])},l.prototype.applyDelta=function(u,c){var T=u.action=="insert";(T?u.lines.length<=1&&!u.lines[0]:!f.comparePoints(u.start,u.end))||(T&&u.lines.length>2e4?this.$splitAndapplyLargeDelta(u,2e4):(i(this.$lines,u,c),this._signal("change",u)))},l.prototype.$safeApplyDelta=function(u){var c=this.$lines.length;(u.action=="remove"&&u.start.row<c&&u.end.row<c||u.action=="insert"&&u.start.row<=c)&&this.applyDelta(u)},l.prototype.$splitAndapplyLargeDelta=function(u,c){for(var T=u.lines,L=T.length-c+1,H=u.start.row,Z=u.start.column,$=0,W=0;$<L;$=W){W+=c-1;var te=T.slice($,W);te.push(""),this.applyDelta({start:this.pos(H+$,Z),end:this.pos(H+W,Z=0),action:u.action,lines:te},!0)}u.lines=T.slice($),u.start.row=H+$,u.start.column=Z,this.applyDelta(u,!0)},l.prototype.revertDelta=function(u){this.$safeApplyDelta({start:this.clonePos(u.start),end:this.clonePos(u.end),action:u.action=="insert"?"remove":"insert",lines:u.lines.slice()})},l.prototype.indexToPosition=function(u,c){for(var T=this.$lines||this.getAllLines(),L=this.getNewLineCharacter().length,H=c||0,Z=T.length;H<Z;H++)if(u-=T[H].length+L,u<0)return{row:H,column:u+T[H].length+L};return{row:Z-1,column:u+T[Z-1].length+L}},l.prototype.positionToIndex=function(u,c){for(var T=this.$lines||this.getAllLines(),L=this.getNewLineCharacter().length,H=0,Z=Math.min(u.row,T.length),$=c||0;$<Z;++$)H+=T[$].length+L;return H+u.column},l.prototype.$split=function(u){return u.split(/\r\n|\r|\n/)},l}();C.prototype.$autoNewLine="",C.prototype.$newLineMode="auto",S.implement(C.prototype,D),ee.Document=C}),ace.define("ace/lib/deep_copy",[],function(P,ee,G){ee.deepCopy=function S(i){if(typeof i!="object"||!i)return i;var D;if(Array.isArray(i)){D=[];for(var f=0;f<i.length;f++)D[f]=S(i[f]);return D}if(Object.prototype.toString.call(i)!=="[object Object]")return i;D={};for(var f in i)D[f]=S(i[f]);return D}}),ace.define("ace/lib/lang",[],function(P,ee,G){"use strict";ee.last=function(D){return D[D.length-1]},ee.stringReverse=function(D){return D.split("").reverse().join("")},ee.stringRepeat=function(D,f){for(var v="";f>0;)f&1&&(v+=D),(f>>=1)&&(D+=D);return v};var S=/^\s\s*/,i=/\s\s*$/;ee.stringTrimLeft=function(D){return D.replace(S,"")},ee.stringTrimRight=function(D){return D.replace(i,"")},ee.copyObject=function(D){var f={};for(var v in D)f[v]=D[v];return f},ee.copyArray=function(D){for(var f=[],v=0,C=D.length;v<C;v++)D[v]&&typeof D[v]=="object"?f[v]=this.copyObject(D[v]):f[v]=D[v];return f},ee.deepCopy=P("./deep_copy").deepCopy,ee.arrayToMap=function(D){for(var f={},v=0;v<D.length;v++)f[D[v]]=1;return f},ee.createMap=function(D){var f=Object.create(null);for(var v in D)f[v]=D[v];return f},ee.arrayRemove=function(D,f){for(var v=0;v<=D.length;v++)f===D[v]&&D.splice(v,1)},ee.escapeRegExp=function(D){return D.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},ee.escapeHTML=function(D){return(""+D).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<")},ee.getMatchOffsets=function(D,f){var v=[];return D.replace(f,function(C){v.push({offset:arguments[arguments.length-2],length:C.length})}),v},ee.deferredCall=function(D){var f=null,v=function(){f=null,D()},C=function(l){return C.cancel(),f=setTimeout(v,l||0),C};return C.schedule=C,C.call=function(){return this.cancel(),D(),C},C.cancel=function(){return clearTimeout(f),f=null,C},C.isPending=function(){return f},C},ee.delayedCall=function(D,f){var v=null,C=function(){v=null,D()},l=function(u){v==null&&(v=setTimeout(C,u||f))};return l.delay=function(u){v&&clearTimeout(v),v=setTimeout(C,u||f)},l.schedule=l,l.call=function(){this.cancel(),D()},l.cancel=function(){v&&clearTimeout(v),v=null},l.isPending=function(){return v},l},ee.supportsLookbehind=function(){try{new RegExp("(?<=.)")}catch(D){return!1}return!0},ee.skipEmptyMatch=function(D,f,v){return v&&D.codePointAt(f)>65535?2:1}}),ace.define("ace/worker/mirror",[],function(P,ee,G){"use strict";var S=P("../document").Document,i=P("../lib/lang"),D=ee.Mirror=function(f){this.sender=f;var v=this.doc=new S(""),C=this.deferredUpdate=i.delayedCall(this.onUpdate.bind(this)),l=this;f.on("change",function(u){var c=u.data;if(c[0].start)v.applyDeltas(c);else for(var T=0;T<c.length;T+=2){var L,H;if(Array.isArray(c[T+1])?L={action:"insert",start:c[T],lines:c[T+1]}:L={action:"remove",start:c[T],end:c[T+1]},(L.action=="insert"?L.start:L.end).row>=v.$lines.length)throw H=new Error("Invalid delta"),H.data={path:l.$path,linesLength:v.$lines.length,start:L.start,end:L.end},H;v.applyDelta(L,!0)}if(l.$timeout)return C.schedule(l.$timeout);l.onUpdate()})};(function(){this.$timeout=500,this.setTimeout=function(f){this.$timeout=f},this.setValue=function(f){this.doc.setValue(f),this.deferredUpdate.schedule(this.$timeout)},this.getValue=function(f){this.sender.callback(this.doc.getValue(),f)},this.onUpdate=function(){},this.isPending=function(){return this.deferredUpdate.isPending()}}).call(D.prototype)}),ace.define("ace/mode/json/json_parse",[],function(P,ee,G){"use strict";var S,i,D={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
`,r:"\r",t:" "},f,v=function($){throw{name:"SyntaxError",message:$,at:S,text:f}},C=function($){return $&&$!==i&&v("Expected '"+$+"' instead of '"+i+"'"),i=f.charAt(S),S+=1,i},l=function(){var $,W="";for(i==="-"&&(W="-",C("-"));i>="0"&&i<="9";)W+=i,C();if(i===".")for(W+=".";C()&&i>="0"&&i<="9";)W+=i;if(i==="e"||i==="E")for(W+=i,C(),(i==="-"||i==="+")&&(W+=i,C());i>="0"&&i<="9";)W+=i,C();if($=+W,!isNaN($))return $;v("Bad number")},u=function(){var $,W,te="",oe;if(i==='"')for(;C();){if(i==='"')return C(),te;if(i==="\\")if(C(),i==="u"){for(oe=0,W=0;W<4&&($=parseInt(C(),16),!!isFinite($));W+=1)oe=oe*16+$;te+=String.fromCharCode(oe)}else{if(typeof D[i]!="string")break;te+=D[i]}else{if(i==`
`||i=="\r")break;te+=i}}v("Bad string")},c=function(){for(;i&&i<=" ";)C()},T=function(){switch(i){case"t":return C("t"),C("r"),C("u"),C("e"),!0;case"f":return C("f"),C("a"),C("l"),C("s"),C("e"),!1;case"n":return C("n"),C("u"),C("l"),C("l"),null}v("Unexpected '"+i+"'")},L,H=function(){var $=[];if(i==="["){if(C("["),c(),i==="]")return C("]"),$;for(;i;){if($.push(L()),c(),i==="]")return C("]"),$;C(","),c()}}v("Bad array")},Z=function(){var $,W={};if(i==="{"){if(C("{"),c(),i==="}")return C("}"),W;for(;i;){if($=u(),c(),C(":"),Object.hasOwnProperty.call(W,$)&&v('Duplicate key "'+$+'"'),W[$]=L(),c(),i==="}")return C("}"),W;C(","),c()}}v("Bad object")};return L=function(){switch(c(),i){case"{":return Z();case"[":return H();case'"':return u();case"-":return l();default:return i>="0"&&i<="9"?l():T()}},function($,W){var te;return f=$,S=0,i=" ",te=L(),c(),i&&v("Syntax error"),typeof W=="function"?function oe(m,x){var y,h,g=m[x];if(g&&typeof g=="object")for(y in g)Object.hasOwnProperty.call(g,y)&&(h=oe(g,y),h!==void 0?g[y]=h:delete g[y]);return W.call(m,x,g)}({"":te},""):te}}),ace.define("ace/mode/json_worker",[],function(P,ee,G){"use strict";var S=P("../lib/oop"),i=P("../worker/mirror").Mirror,D=P("./json/json_parse"),f=ee.JsonWorker=function(v){i.call(this,v),this.setTimeout(200)};S.inherits(f,i),function(){this.onUpdate=function(){var v=this.doc.getValue(),C=[];try{v&&D(v)}catch(u){var l=this.doc.indexToPosition(u.at-1);C.push({row:l.row,column:l.column,text:u.message,type:"error"})}this.sender.emit("annotate",C)}}.call(f.prototype)})},57051:function(P,ee,G){(function(S,i){P.exports=ee=i()})(this,function(){var S=S||function(i,D){var f;if(typeof window!="undefined"&&window.crypto&&(f=window.crypto),typeof self!="undefined"&&self.crypto&&(f=self.crypto),typeof globalThis!="undefined"&&globalThis.crypto&&(f=globalThis.crypto),!f&&typeof window!="undefined"&&window.msCrypto&&(f=window.msCrypto),!f&&typeof G.g!="undefined"&&G.g.crypto&&(f=G.g.crypto),!f)try{f=G(50477)}catch(m){}var v=function(){if(f){if(typeof f.getRandomValues=="function")try{return f.getRandomValues(new Uint32Array(1))[0]}catch(m){}if(typeof f.randomBytes=="function")try{return f.randomBytes(4).readInt32LE()}catch(m){}}throw new Error("Native crypto module could not be used to get secure random number.")},C=Object.create||function(){function m(){}return function(x){var y;return m.prototype=x,y=new m,m.prototype=null,y}}(),l={},u=l.lib={},c=u.Base=function(){return{extend:function(m){var x=C(this);return m&&x.mixIn(m),(!x.hasOwnProperty("init")||this.init===x.init)&&(x.init=function(){x.$super.init.apply(this,arguments)}),x.init.prototype=x,x.$super=this,x},create:function(){var m=this.extend();return m.init.apply(m,arguments),m},init:function(){},mixIn:function(m){for(var x in m)m.hasOwnProperty(x)&&(this[x]=m[x]);m.hasOwnProperty("toString")&&(this.toString=m.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),T=u.WordArray=c.extend({init:function(m,x){m=this.words=m||[],x!=D?this.sigBytes=x:this.sigBytes=m.length*4},toString:function(m){return(m||H).stringify(this)},concat:function(m){var x=this.words,y=m.words,h=this.sigBytes,g=m.sigBytes;if(this.clamp(),h%4)for(var d=0;d<g;d++){var b=y[d>>>2]>>>24-d%4*8&255;x[h+d>>>2]|=b<<24-(h+d)%4*8}else for(var E=0;E<g;E+=4)x[h+E>>>2]=y[E>>>2];return this.sigBytes+=g,this},clamp:function(){var m=this.words,x=this.sigBytes;m[x>>>2]&=4294967295<<32-x%4*8,m.length=i.ceil(x/4)},clone:function(){var m=c.clone.call(this);return m.words=this.words.slice(0),m},random:function(m){for(var x=[],y=0;y<m;y+=4)x.push(v());return new T.init(x,m)}}),L=l.enc={},H=L.Hex={stringify:function(m){for(var x=m.words,y=m.sigBytes,h=[],g=0;g<y;g++){var d=x[g>>>2]>>>24-g%4*8&255;h.push((d>>>4).toString(16)),h.push((d&15).toString(16))}return h.join("")},parse:function(m){for(var x=m.length,y=[],h=0;h<x;h+=2)y[h>>>3]|=parseInt(m.substr(h,2),16)<<24-h%8*4;return new T.init(y,x/2)}},Z=L.Latin1={stringify:function(m){for(var x=m.words,y=m.sigBytes,h=[],g=0;g<y;g++){var d=x[g>>>2]>>>24-g%4*8&255;h.push(String.fromCharCode(d))}return h.join("")},parse:function(m){for(var x=m.length,y=[],h=0;h<x;h++)y[h>>>2]|=(m.charCodeAt(h)&255)<<24-h%4*8;return new T.init(y,x)}},$=L.Utf8={stringify:function(m){try{return decodeURIComponent(escape(Z.stringify(m)))}catch(x){throw new Error("Malformed UTF-8 data")}},parse:function(m){return Z.parse(unescape(encodeURIComponent(m)))}},W=u.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new T.init,this._nDataBytes=0},_append:function(m){typeof m=="string"&&(m=$.parse(m)),this._data.concat(m),this._nDataBytes+=m.sigBytes},_process:function(m){var x,y=this._data,h=y.words,g=y.sigBytes,d=this.blockSize,b=d*4,E=g/b;m?E=i.ceil(E):E=i.max((E|0)-this._minBufferSize,0);var k=E*d,B=i.min(k*4,g);if(k){for(var _=0;_<k;_+=d)this._doProcessBlock(h,_);x=h.splice(0,k),y.sigBytes-=B}return new T.init(x,B)},clone:function(){var m=c.clone.call(this);return m._data=this._data.clone(),m},_minBufferSize:0}),te=u.Hasher=W.extend({cfg:c.extend(),init:function(m){this.cfg=this.cfg.extend(m),this.reset()},reset:function(){W.reset.call(this),this._doReset()},update:function(m){return this._append(m),this._process(),this},finalize:function(m){m&&this._append(m);var x=this._doFinalize();return x},blockSize:512/32,_createHelper:function(m){return function(x,y){return new m.init(y).finalize(x)}},_createHmacHelper:function(m){return function(x,y){return new oe.HMAC.init(m,y).finalize(x)}}}),oe=l.algo={};return l}(Math);return S})},91778:function(P,ee,G){(function(S,i){P.exports=ee=i(G(57051))})(this,function(S){return function(i){var D=S,f=D.lib,v=f.WordArray,C=f.Hasher,l=D.algo,u=[];(function(){for(var $=0;$<64;$++)u[$]=i.abs(i.sin($+1))*4294967296|0})();var c=l.MD5=C.extend({_doReset:function(){this._hash=new v.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function($,W){for(var te=0;te<16;te++){var oe=W+te,m=$[oe];$[oe]=(m<<8|m>>>24)&16711935|(m<<24|m>>>8)&4278255360}var x=this._hash.words,y=$[W+0],h=$[W+1],g=$[W+2],d=$[W+3],b=$[W+4],E=$[W+5],k=$[W+6],B=$[W+7],_=$[W+8],A=$[W+9],I=$[W+10],M=$[W+11],re=$[W+12],Q=$[W+13],le=$[W+14],ce=$[W+15],R=x[0],K=x[1],z=x[2],j=x[3];R=T(R,K,z,j,y,7,u[0]),j=T(j,R,K,z,h,12,u[1]),z=T(z,j,R,K,g,17,u[2]),K=T(K,z,j,R,d,22,u[3]),R=T(R,K,z,j,b,7,u[4]),j=T(j,R,K,z,E,12,u[5]),z=T(z,j,R,K,k,17,u[6]),K=T(K,z,j,R,B,22,u[7]),R=T(R,K,z,j,_,7,u[8]),j=T(j,R,K,z,A,12,u[9]),z=T(z,j,R,K,I,17,u[10]),K=T(K,z,j,R,M,22,u[11]),R=T(R,K,z,j,re,7,u[12]),j=T(j,R,K,z,Q,12,u[13]),z=T(z,j,R,K,le,17,u[14]),K=T(K,z,j,R,ce,22,u[15]),R=L(R,K,z,j,h,5,u[16]),j=L(j,R,K,z,k,9,u[17]),z=L(z,j,R,K,M,14,u[18]),K=L(K,z,j,R,y,20,u[19]),R=L(R,K,z,j,E,5,u[20]),j=L(j,R,K,z,I,9,u[21]),z=L(z,j,R,K,ce,14,u[22]),K=L(K,z,j,R,b,20,u[23]),R=L(R,K,z,j,A,5,u[24]),j=L(j,R,K,z,le,9,u[25]),z=L(z,j,R,K,d,14,u[26]),K=L(K,z,j,R,_,20,u[27]),R=L(R,K,z,j,Q,5,u[28]),j=L(j,R,K,z,g,9,u[29]),z=L(z,j,R,K,B,14,u[30]),K=L(K,z,j,R,re,20,u[31]),R=H(R,K,z,j,E,4,u[32]),j=H(j,R,K,z,_,11,u[33]),z=H(z,j,R,K,M,16,u[34]),K=H(K,z,j,R,le,23,u[35]),R=H(R,K,z,j,h,4,u[36]),j=H(j,R,K,z,b,11,u[37]),z=H(z,j,R,K,B,16,u[38]),K=H(K,z,j,R,I,23,u[39]),R=H(R,K,z,j,Q,4,u[40]),j=H(j,R,K,z,y,11,u[41]),z=H(z,j,R,K,d,16,u[42]),K=H(K,z,j,R,k,23,u[43]),R=H(R,K,z,j,A,4,u[44]),j=H(j,R,K,z,re,11,u[45]),z=H(z,j,R,K,ce,16,u[46]),K=H(K,z,j,R,g,23,u[47]),R=Z(R,K,z,j,y,6,u[48]),j=Z(j,R,K,z,B,10,u[49]),z=Z(z,j,R,K,le,15,u[50]),K=Z(K,z,j,R,E,21,u[51]),R=Z(R,K,z,j,re,6,u[52]),j=Z(j,R,K,z,d,10,u[53]),z=Z(z,j,R,K,I,15,u[54]),K=Z(K,z,j,R,h,21,u[55]),R=Z(R,K,z,j,_,6,u[56]),j=Z(j,R,K,z,ce,10,u[57]),z=Z(z,j,R,K,k,15,u[58]),K=Z(K,z,j,R,Q,21,u[59]),R=Z(R,K,z,j,b,6,u[60]),j=Z(j,R,K,z,M,10,u[61]),z=Z(z,j,R,K,g,15,u[62]),K=Z(K,z,j,R,A,21,u[63]),x[0]=x[0]+R|0,x[1]=x[1]+K|0,x[2]=x[2]+z|0,x[3]=x[3]+j|0},_doFinalize:function(){var $=this._data,W=$.words,te=this._nDataBytes*8,oe=$.sigBytes*8;W[oe>>>5]|=128<<24-oe%32;var m=i.floor(te/4294967296),x=te;W[(oe+64>>>9<<4)+15]=(m<<8|m>>>24)&16711935|(m<<24|m>>>8)&4278255360,W[(oe+64>>>9<<4)+14]=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360,$.sigBytes=(W.length+1)*4,this._process();for(var y=this._hash,h=y.words,g=0;g<4;g++){var d=h[g];h[g]=(d<<8|d>>>24)&16711935|(d<<24|d>>>8)&4278255360}return y},clone:function(){var $=C.clone.call(this);return $._hash=this._hash.clone(),$}});function T($,W,te,oe,m,x,y){var h=$+(W&te|~W&oe)+m+y;return(h<<x|h>>>32-x)+W}function L($,W,te,oe,m,x,y){var h=$+(W&oe|te&~oe)+m+y;return(h<<x|h>>>32-x)+W}function H($,W,te,oe,m,x,y){var h=$+(W^te^oe)+m+y;return(h<<x|h>>>32-x)+W}function Z($,W,te,oe,m,x,y){var h=$+(te^(W|~oe))+m+y;return(h<<x|h>>>32-x)+W}D.MD5=C._createHelper(c),D.HmacMD5=C._createHmacHelper(c)}(Math),S.MD5})},85589:function(P){(function(ee,G){P.exports=G()})(this,function(){"use strict";function ee(F,N){return N={exports:{}},F(N,N.exports),N.exports}var G=ee(function(F){var N=F.exports=typeof window!="undefined"&&window.Math==Math?window:typeof self!="undefined"&&self.Math==Math?self:Function("return this")();typeof __g=="number"&&(__g=N)}),S=ee(function(F){var N=F.exports={version:"2.6.5"};typeof __e=="number"&&(__e=N)}),i=S.version,D=function(F){return typeof F=="object"?F!==null:typeof F=="function"},f=function(F){if(!D(F))throw TypeError(F+" is not an object!");return F},v=function(F){try{return!!F()}catch(N){return!0}},C=!v(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7}),l=G.document,u=D(l)&&D(l.createElement),c=function(F){return u?l.createElement(F):{}},T=!C&&!v(function(){return Object.defineProperty(c("div"),"a",{get:function(){return 7}}).a!=7}),L=function(F,N){if(!D(F))return F;var ie,ne;if(N&&typeof(ie=F.toString)=="function"&&!D(ne=ie.call(F))||typeof(ie=F.valueOf)=="function"&&!D(ne=ie.call(F))||!N&&typeof(ie=F.toString)=="function"&&!D(ne=ie.call(F)))return ne;throw TypeError("Can't convert object to primitive value")},H=Object.defineProperty,Z=C?Object.defineProperty:function(N,ie,ne){if(f(N),ie=L(ie,!0),f(ne),T)try{return H(N,ie,ne)}catch(ue){}if("get"in ne||"set"in ne)throw TypeError("Accessors not supported!");return"value"in ne&&(N[ie]=ne.value),N},$={f:Z},W=function(F,N){return{enumerable:!(F&1),configurable:!(F&2),writable:!(F&4),value:N}},te=C?function(F,N,ie){return $.f(F,N,W(1,ie))}:function(F,N,ie){return F[N]=ie,F},oe={}.hasOwnProperty,m=function(F,N){return oe.call(F,N)},x=0,y=Math.random(),h=function(F){return"Symbol(".concat(F===void 0?"":F,")_",(++x+y).toString(36))},g=!1,d=ee(function(F){var N="__core-js_shared__",ie=G[N]||(G[N]={});(F.exports=function(ne,ue){return ie[ne]||(ie[ne]=ue!==void 0?ue:{})})("versions",[]).push({version:S.version,mode:g?"pure":"global",copyright:"\xA9 2019 Denis Pushkarev (zloirock.ru)"})}),b=d("native-function-to-string",Function.toString),E=ee(function(F){var N=h("src"),ie="toString",ne=(""+b).split(ie);S.inspectSource=function(ue){return b.call(ue)},(F.exports=function(ue,ve,Ce,Le){var Oe=typeof Ce=="function";Oe&&(m(Ce,"name")||te(Ce,"name",ve)),ue[ve]!==Ce&&(Oe&&(m(Ce,N)||te(Ce,N,ue[ve]?""+ue[ve]:ne.join(String(ve)))),ue===G?ue[ve]=Ce:Le?ue[ve]?ue[ve]=Ce:te(ue,ve,Ce):(delete ue[ve],te(ue,ve,Ce)))})(Function.prototype,ie,function(){return typeof this=="function"&&this[N]||b.call(this)})}),k=function(F){if(typeof F!="function")throw TypeError(F+" is not a function!");return F},B=function(F,N,ie){if(k(F),N===void 0)return F;switch(ie){case 1:return function(ne){return F.call(N,ne)};case 2:return function(ne,ue){return F.call(N,ne,ue)};case 3:return function(ne,ue,ve){return F.call(N,ne,ue,ve)}}return function(){return F.apply(N,arguments)}},_="prototype",A=function(F,N,ie){var ne=F&A.F,ue=F&A.G,ve=F&A.S,Ce=F&A.P,Le=F&A.B,Oe=ue?G:ve?G[N]||(G[N]={}):(G[N]||{})[_],rt=ue?S:S[N]||(S[N]={}),at=rt[_]||(rt[_]={}),je,He,Me,dt;ue&&(ie=N);for(je in ie)He=!ne&&Oe&&Oe[je]!==void 0,Me=(He?Oe:ie)[je],dt=Le&&He?B(Me,G):Ce&&typeof Me=="function"?B(Function.call,Me):Me,Oe&&E(Oe,je,Me,F&A.U),rt[je]!=Me&&te(rt,je,dt),Ce&&at[je]!=Me&&(at[je]=Me)};G.core=S,A.F=1,A.G=2,A.S=4,A.P=8,A.B=16,A.W=32,A.U=64,A.R=128;var I=A,M=Math.ceil,re=Math.floor,Q=function(F){return isNaN(F=+F)?0:(F>0?re:M)(F)},le=function(F){if(F==null)throw TypeError("Can't call method on "+F);return F},ce=function(F){return function(N,ie){var ne=String(le(N)),ue=Q(ie),ve=ne.length,Ce,Le;return ue<0||ue>=ve?F?"":void 0:(Ce=ne.charCodeAt(ue),Ce<55296||Ce>56319||ue+1===ve||(Le=ne.charCodeAt(ue+1))<56320||Le>57343?F?ne.charAt(ue):Ce:F?ne.slice(ue,ue+2):(Ce-55296<<10)+(Le-56320)+65536)}},R=ce(!1);I(I.P,"String",{codePointAt:function(N){return R(this,N)}});var K=S.String.codePointAt,z=Math.max,j=Math.min,_e=function(F,N){return F=Q(F),F<0?z(F+N,0):j(F,N)},ge=String.fromCharCode,ke=String.fromCodePoint;I(I.S+I.F*(!!ke&&ke.length!=1),"String",{fromCodePoint:function(N){for(var ie=arguments,ne=[],ue=arguments.length,ve=0,Ce;ue>ve;){if(Ce=+ie[ve++],_e(Ce,1114111)!==Ce)throw RangeError(Ce+" is not a valid code point");ne.push(Ce<65536?ge(Ce):ge(((Ce-=65536)>>10)+55296,Ce%1024+56320))}return ne.join("")}});var Ke=S.String.fromCodePoint,Te=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,ht=/[\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]/,pt=/[\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]/,Dt={Space_Separator:Te,ID_Start:ht,ID_Continue:pt},Ie={isSpaceSeparator:function(N){return typeof N=="string"&&Dt.Space_Separator.test(N)},isIdStartChar:function(N){return typeof N=="string"&&(N>="a"&&N<="z"||N>="A"&&N<="Z"||N==="$"||N==="_"||Dt.ID_Start.test(N))},isIdContinueChar:function(N){return typeof N=="string"&&(N>="a"&&N<="z"||N>="A"&&N<="Z"||N>="0"&&N<="9"||N==="$"||N==="_"||N==="\u200C"||N==="\u200D"||Dt.ID_Continue.test(N))},isDigit:function(N){return typeof N=="string"&&/[0-9]/.test(N)},isHexDigit:function(N){return typeof N=="string"&&/[0-9A-Fa-f]/.test(N)}},It,Ne,Ye,xt,st,Ue,Be,_t,vt,qt=function(N,ie){It=String(N),Ne="start",Ye=[],xt=0,st=1,Ue=0,Be=void 0,_t=void 0,vt=void 0;do Be=Rt(),Xt[Ne]();while(Be.type!=="eof");return typeof ie=="function"?Ct({"":vt},"",ie):vt};function Ct(F,N,ie){var ne=F[N];if(ne!=null&&typeof ne=="object")if(Array.isArray(ne))for(var ue=0;ue<ne.length;ue++){var ve=String(ue),Ce=Ct(ne,ve,ie);Ce===void 0?delete ne[ve]:Object.defineProperty(ne,ve,{value:Ce,writable:!0,enumerable:!0,configurable:!0})}else for(var Le in ne){var Oe=Ct(ne,Le,ie);Oe===void 0?delete ne[Le]:Object.defineProperty(ne,Le,{value:Oe,writable:!0,enumerable:!0,configurable:!0})}return ie.call(F,N,ne)}var fe,pe,yt,Xe,De;function Rt(){for(fe="default",pe="",yt=!1,Xe=1;;){De=Ze();var F=Mt[fe]();if(F)return F}}function Ze(){if(It[xt])return String.fromCodePoint(It.codePointAt(xt))}function V(){var F=Ze();return F===`
`?(st++,Ue=0):F?Ue+=F.length:Ue++,F&&(xt+=F.length),F}var Mt={default:function(){switch(De){case" ":case"\v":case"\f":case" ":case"\xA0":case"\uFEFF":case`
`:case"\r":case"\u2028":case"\u2029":V();return;case"/":V(),fe="comment";return;case void 0:return V(),xe("eof")}if(Ie.isSpaceSeparator(De)){V();return}return Mt[Ne]()},comment:function(){switch(De){case"*":V(),fe="multiLineComment";return;case"/":V(),fe="singleLineComment";return}throw we(V())},multiLineComment:function(){switch(De){case"*":V(),fe="multiLineCommentAsterisk";return;case void 0:throw we(V())}V()},multiLineCommentAsterisk:function(){switch(De){case"*":V();return;case"/":V(),fe="default";return;case void 0:throw we(V())}V(),fe="multiLineComment"},singleLineComment:function(){switch(De){case`
`:case"\r":case"\u2028":case"\u2029":V(),fe="default";return;case void 0:return V(),xe("eof")}V()},value:function(){switch(De){case"{":case"[":return xe("punctuator",V());case"n":return V(),it("ull"),xe("null",null);case"t":return V(),it("rue"),xe("boolean",!0);case"f":return V(),it("alse"),xe("boolean",!1);case"-":case"+":V()==="-"&&(Xe=-1),fe="sign";return;case".":pe=V(),fe="decimalPointLeading";return;case"0":pe=V(),fe="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":pe=V(),fe="decimalInteger";return;case"I":return V(),it("nfinity"),xe("numeric",1/0);case"N":return V(),it("aN"),xe("numeric",NaN);case'"':case"'":yt=V()==='"',pe="",fe="string";return}throw we(V())},identifierNameStartEscape:function(){if(De!=="u")throw we(V());V();var N=kt();switch(N){case"$":case"_":break;default:if(!Ie.isIdStartChar(N))throw Ot();break}pe+=N,fe="identifierName"},identifierName:function(){switch(De){case"$":case"_":case"\u200C":case"\u200D":pe+=V();return;case"\\":V(),fe="identifierNameEscape";return}if(Ie.isIdContinueChar(De)){pe+=V();return}return xe("identifier",pe)},identifierNameEscape:function(){if(De!=="u")throw we(V());V();var N=kt();switch(N){case"$":case"_":case"\u200C":case"\u200D":break;default:if(!Ie.isIdContinueChar(N))throw Ot();break}pe+=N,fe="identifierName"},sign:function(){switch(De){case".":pe=V(),fe="decimalPointLeading";return;case"0":pe=V(),fe="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":pe=V(),fe="decimalInteger";return;case"I":return V(),it("nfinity"),xe("numeric",Xe*(1/0));case"N":return V(),it("aN"),xe("numeric",NaN)}throw we(V())},zero:function(){switch(De){case".":pe+=V(),fe="decimalPoint";return;case"e":case"E":pe+=V(),fe="decimalExponent";return;case"x":case"X":pe+=V(),fe="hexadecimal";return}return xe("numeric",Xe*0)},decimalInteger:function(){switch(De){case".":pe+=V(),fe="decimalPoint";return;case"e":case"E":pe+=V(),fe="decimalExponent";return}if(Ie.isDigit(De)){pe+=V();return}return xe("numeric",Xe*Number(pe))},decimalPointLeading:function(){if(Ie.isDigit(De)){pe+=V(),fe="decimalFraction";return}throw we(V())},decimalPoint:function(){switch(De){case"e":case"E":pe+=V(),fe="decimalExponent";return}if(Ie.isDigit(De)){pe+=V(),fe="decimalFraction";return}return xe("numeric",Xe*Number(pe))},decimalFraction:function(){switch(De){case"e":case"E":pe+=V(),fe="decimalExponent";return}if(Ie.isDigit(De)){pe+=V();return}return xe("numeric",Xe*Number(pe))},decimalExponent:function(){switch(De){case"+":case"-":pe+=V(),fe="decimalExponentSign";return}if(Ie.isDigit(De)){pe+=V(),fe="decimalExponentInteger";return}throw we(V())},decimalExponentSign:function(){if(Ie.isDigit(De)){pe+=V(),fe="decimalExponentInteger";return}throw we(V())},decimalExponentInteger:function(){if(Ie.isDigit(De)){pe+=V();return}return xe("numeric",Xe*Number(pe))},hexadecimal:function(){if(Ie.isHexDigit(De)){pe+=V(),fe="hexadecimalInteger";return}throw we(V())},hexadecimalInteger:function(){if(Ie.isHexDigit(De)){pe+=V();return}return xe("numeric",Xe*Number(pe))},string:function(){switch(De){case"\\":V(),pe+=Yt();return;case'"':if(yt)return V(),xe("string",pe);pe+=V();return;case"'":if(!yt)return V(),xe("string",pe);pe+=V();return;case`
`:case"\r":throw we(V());case"\u2028":case"\u2029":Ft(De);break;case void 0:throw we(V())}pe+=V()},start:function(){switch(De){case"{":case"[":return xe("punctuator",V())}fe="value"},beforePropertyName:function(){switch(De){case"$":case"_":pe=V(),fe="identifierName";return;case"\\":V(),fe="identifierNameStartEscape";return;case"}":return xe("punctuator",V());case'"':case"'":yt=V()==='"',fe="string";return}if(Ie.isIdStartChar(De)){pe+=V(),fe="identifierName";return}throw we(V())},afterPropertyName:function(){if(De===":")return xe("punctuator",V());throw we(V())},beforePropertyValue:function(){fe="value"},afterPropertyValue:function(){switch(De){case",":case"}":return xe("punctuator",V())}throw we(V())},beforeArrayValue:function(){if(De==="]")return xe("punctuator",V());fe="value"},afterArrayValue:function(){switch(De){case",":case"]":return xe("punctuator",V())}throw we(V())},end:function(){throw we(V())}};function xe(F,N){return{type:F,value:N,line:st,column:Ue}}function it(F){for(var N=0,ie=F;N<ie.length;N+=1){var ne=ie[N],ue=Ze();if(ue!==ne)throw we(V());V()}}function Yt(){var F=Ze();switch(F){case"b":return V(),"\b";case"f":return V(),"\f";case"n":return V(),`
`;case"r":return V(),"\r";case"t":return V()," ";case"v":return V(),"\v";case"0":if(V(),Ie.isDigit(Ze()))throw we(V());return"\0";case"x":return V(),Je();case"u":return V(),kt();case`
`:case"\u2028":case"\u2029":return V(),"";case"\r":return V(),Ze()===`
`&&V(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw we(V());case void 0:throw we(V())}return V()}function Je(){var F="",N=Ze();if(!Ie.isHexDigit(N)||(F+=V(),N=Ze(),!Ie.isHexDigit(N)))throw we(V());return F+=V(),String.fromCodePoint(parseInt(F,16))}function kt(){for(var F="",N=4;N-- >0;){var ie=Ze();if(!Ie.isHexDigit(ie))throw we(V());F+=V()}return String.fromCodePoint(parseInt(F,16))}var Xt={start:function(){if(Be.type==="eof")throw Qe();Bt()},beforePropertyName:function(){switch(Be.type){case"identifier":case"string":_t=Be.value,Ne="afterPropertyName";return;case"punctuator":wt();return;case"eof":throw Qe()}},afterPropertyName:function(){if(Be.type==="eof")throw Qe();Ne="beforePropertyValue"},beforePropertyValue:function(){if(Be.type==="eof")throw Qe();Bt()},beforeArrayValue:function(){if(Be.type==="eof")throw Qe();if(Be.type==="punctuator"&&Be.value==="]"){wt();return}Bt()},afterPropertyValue:function(){if(Be.type==="eof")throw Qe();switch(Be.value){case",":Ne="beforePropertyName";return;case"}":wt()}},afterArrayValue:function(){if(Be.type==="eof")throw Qe();switch(Be.value){case",":Ne="beforeArrayValue";return;case"]":wt()}},end:function(){}};function Bt(){var F;switch(Be.type){case"punctuator":switch(Be.value){case"{":F={};break;case"[":F=[];break}break;case"null":case"boolean":case"numeric":case"string":F=Be.value;break}if(vt===void 0)vt=F;else{var N=Ye[Ye.length-1];Array.isArray(N)?N.push(F):Object.defineProperty(N,_t,{value:F,writable:!0,enumerable:!0,configurable:!0})}if(F!==null&&typeof F=="object")Ye.push(F),Array.isArray(F)?Ne="beforeArrayValue":Ne="beforePropertyName";else{var ie=Ye[Ye.length-1];ie==null?Ne="end":Array.isArray(ie)?Ne="afterArrayValue":Ne="afterPropertyValue"}}function wt(){Ye.pop();var F=Ye[Ye.length-1];F==null?Ne="end":Array.isArray(F)?Ne="afterArrayValue":Ne="afterPropertyValue"}function we(F){return At(F===void 0?"JSON5: invalid end of input at "+st+":"+Ue:"JSON5: invalid character '"+Vt(F)+"' at "+st+":"+Ue)}function Qe(){return At("JSON5: invalid end of input at "+st+":"+Ue)}function Ot(){return Ue-=5,At("JSON5: invalid identifier character at "+st+":"+Ue)}function Ft(F){console.warn("JSON5: '"+Vt(F)+"' in strings is not valid ECMAScript; consider escaping")}function Vt(F){var N={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(N[F])return N[F];if(F<" "){var ie=F.charCodeAt(0).toString(16);return"\\x"+("00"+ie).substring(ie.length)}return F}function At(F){var N=new SyntaxError(F);return N.lineNumber=st,N.columnNumber=Ue,N}var Zt=function(N,ie,ne){var ue=[],ve="",Ce,Le,Oe="",rt;if(ie!=null&&typeof ie=="object"&&!Array.isArray(ie)&&(ne=ie.space,rt=ie.quote,ie=ie.replacer),typeof ie=="function")Le=ie;else if(Array.isArray(ie)){Ce=[];for(var at=0,je=ie;at<je.length;at+=1){var He=je[at],Me=void 0;typeof He=="string"?Me=He:(typeof He=="number"||He instanceof String||He instanceof Number)&&(Me=String(He)),Me!==void 0&&Ce.indexOf(Me)<0&&Ce.push(Me)}}return ne instanceof Number?ne=Number(ne):ne instanceof String&&(ne=String(ne)),typeof ne=="number"?ne>0&&(ne=Math.min(10,Math.floor(ne)),Oe=" ".substr(0,ne)):typeof ne=="string"&&(Oe=ne.substr(0,10)),dt("",{"":N});function dt(be,Ve){var me=Ve[be];switch(me!=null&&(typeof me.toJSON5=="function"?me=me.toJSON5(be):typeof me.toJSON=="function"&&(me=me.toJSON(be))),Le&&(me=Le.call(Ve,be,me)),me instanceof Number?me=Number(me):me instanceof String?me=String(me):me instanceof Boolean&&(me=me.valueOf()),me){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof me=="string")return et(me,!1);if(typeof me=="number")return String(me);if(typeof me=="object")return Array.isArray(me)?sn(me):yn(me)}function et(be){for(var Ve={"'":.1,'"':.2},me={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"},Pe="",Ge=0;Ge<be.length;Ge++){var We=be[Ge];switch(We){case"'":case'"':Ve[We]++,Pe+=We;continue;case"\0":if(Ie.isDigit(be[Ge+1])){Pe+="\\x00";continue}}if(me[We]){Pe+=me[We];continue}if(We<" "){var ot=We.charCodeAt(0).toString(16);Pe+="\\x"+("00"+ot).substring(ot.length);continue}Pe+=We}var tt=rt||Object.keys(Ve).reduce(function(lt,nt){return Ve[lt]<Ve[nt]?lt:nt});return Pe=Pe.replace(new RegExp(tt,"g"),me[tt]),tt+Pe+tt}function yn(be){if(ue.indexOf(be)>=0)throw TypeError("Converting circular structure to JSON5");ue.push(be);var Ve=ve;ve=ve+Oe;for(var me=Ce||Object.keys(be),Pe=[],Ge=0,We=me;Ge<We.length;Ge+=1){var ot=We[Ge],tt=dt(ot,be);if(tt!==void 0){var lt=nn(ot)+":";Oe!==""&&(lt+=" "),lt+=tt,Pe.push(lt)}}var nt;if(Pe.length===0)nt="{}";else{var mt;if(Oe==="")mt=Pe.join(","),nt="{"+mt+"}";else{var rn=`,
`+ve;mt=Pe.join(rn),nt=`{
`+ve+mt+`,
`+Ve+"}"}}return ue.pop(),ve=Ve,nt}function nn(be){if(be.length===0)return et(be,!0);var Ve=String.fromCodePoint(be.codePointAt(0));if(!Ie.isIdStartChar(Ve))return et(be,!0);for(var me=Ve.length;me<be.length;me++)if(!Ie.isIdContinueChar(String.fromCodePoint(be.codePointAt(me))))return et(be,!0);return be}function sn(be){if(ue.indexOf(be)>=0)throw TypeError("Converting circular structure to JSON5");ue.push(be);var Ve=ve;ve=ve+Oe;for(var me=[],Pe=0;Pe<be.length;Pe++){var Ge=dt(String(Pe),be);me.push(Ge!==void 0?Ge:"null")}var We;if(me.length===0)We="[]";else if(Oe===""){var ot=me.join(",");We="["+ot+"]"}else{var tt=`,
`+ve,lt=me.join(tt);We=`[
`+ve+lt+`,
`+Ve+"]"}return ue.pop(),ve=Ve,We}},Qt={parse:qt,stringify:Zt},en=Qt,tn=en;return tn})}}]);
//# sourceMappingURL=vendors-node_modules_iobroker_json-config_build_index_js.c1ba124d.chunk.js.map