iobroker.javascript 8.9.0 → 8.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/admin/assets/hostInit-WWj7Ma6O.js +2 -0
- package/admin/assets/{index-CbZpkpqP.js → index-B4TCes5W.js} +1 -1
- package/admin/assets/index-BQ7eR1Vn.js +805 -0
- package/admin/assets/{index-DhJ9BAXJ.js → index-DPsp9SLy.js} +59 -59
- package/admin/assets/{inheritsLoose-D_3QVnqj.js → inheritsLoose-MUXuXZWE.js} +4 -4
- package/admin/assets/preload-helper-C1FmrZbK.js +1 -0
- package/admin/custom/customComponents.js +1 -1
- package/admin/custom/customComponents.js.map +1 -1
- package/admin/custom/static/js/{main.c2632cca.js → main.402676b8.js} +2 -2
- package/admin/custom/static/js/{main.c2632cca.js.map → main.402676b8.js.map} +1 -1
- package/admin/custom/static/js/{node_modules_mui_material_node_modules_mui_system_esm_DefaultPropsProvider_DefaultPropsProvid-6480f80.64d156b1.chunk.js → node_modules_mui_material_node_modules_mui_system_esm_DefaultPropsProvider_DefaultPropsProvid-6480f80.e4f6733d.chunk.js} +3 -3
- package/admin/custom/static/js/node_modules_mui_material_node_modules_mui_system_esm_DefaultPropsProvider_DefaultPropsProvid-6480f80.e4f6733d.chunk.js.map +1 -0
- package/admin/custom/static/js/{node_modules_mui_material_node_modules_mui_system_esm_DefaultPropsProvider_DefaultPropsProvid-6480f81.faac2bea.chunk.js → node_modules_mui_material_node_modules_mui_system_esm_DefaultPropsProvider_DefaultPropsProvid-6480f81.cf4e50a5.chunk.js} +3 -3
- package/admin/custom/static/js/node_modules_mui_material_node_modules_mui_system_esm_DefaultPropsProvider_DefaultPropsProvid-6480f81.cf4e50a5.chunk.js.map +1 -0
- package/admin/custom/static/js/{node_modules_mui_material_node_modules_mui_system_esm_DefaultPropsProvider_DefaultPropsProvid-d67bc2.3794c875.chunk.js → node_modules_mui_material_node_modules_mui_system_esm_DefaultPropsProvider_DefaultPropsProvid-d67bc2.53f91b62.chunk.js} +3 -3
- package/admin/custom/static/js/node_modules_mui_material_node_modules_mui_system_esm_DefaultPropsProvider_DefaultPropsProvid-d67bc2.53f91b62.chunk.js.map +1 -0
- package/admin/custom/static/js/node_modules_mui_material_node_modules_mui_system_esm_DefaultPropsProvider_DefaultPropsProvid-e30e0b.300189a9.chunk.js +11 -0
- package/admin/custom/static/js/node_modules_mui_material_node_modules_mui_system_esm_DefaultPropsProvider_DefaultPropsProvid-e30e0b.300189a9.chunk.js.map +1 -0
- package/admin/custom/static/js/vendors-node_modules_iobroker_adapter-react-v5_build_index_js.bbed4ac6.chunk.js +781 -0
- package/admin/custom/static/js/vendors-node_modules_iobroker_adapter-react-v5_build_index_js.bbed4ac6.chunk.js.map +1 -0
- package/admin/custom/static/js/{vendors-node_modules_iobroker_adapter-react-v5_node_modules_mui_material_index_js-node_module-97ca99.33a209a3.chunk.js → vendors-node_modules_iobroker_adapter-react-v5_node_modules_mui_material_index_js-node_module-97ca99.607f9d26.chunk.js} +2 -2
- package/admin/custom/static/js/vendors-node_modules_iobroker_adapter-react-v5_node_modules_mui_material_index_js-node_module-97ca99.607f9d26.chunk.js.map +1 -0
- package/admin/custom/static/js/vendors-node_modules_iobroker_json-config_build_index_js.9bde8280.chunk.js +407 -0
- package/admin/custom/static/js/vendors-node_modules_iobroker_json-config_build_index_js.9bde8280.chunk.js.map +1 -0
- package/admin/custom/static/js/{vendors-node_modules_leaflet_dist_leaflet_css-node_modules_mui_material_styles_ThemeProvider_-7f7a23.cb1d977b.chunk.js → vendors-node_modules_leaflet_dist_leaflet_css-node_modules_mui_material_styles_ThemeProvider_-7f7a23.3d5bd211.chunk.js} +2 -2
- package/admin/custom/static/js/vendors-node_modules_leaflet_dist_leaflet_css-node_modules_mui_material_styles_ThemeProvider_-7f7a23.3d5bd211.chunk.js.map +1 -0
- package/admin/custom/static/js/{vendors-node_modules_mui_material_DefaultPropsProvider_DefaultPropsProvider_js-node_modules_m-228034.52253fa1.chunk.js → vendors-node_modules_mui_material_DefaultPropsProvider_DefaultPropsProvider_js-node_modules_m-228034.6cda137b.chunk.js} +2 -2
- package/admin/custom/static/js/vendors-node_modules_mui_material_DefaultPropsProvider_DefaultPropsProvider_js-node_modules_m-228034.6cda137b.chunk.js.map +1 -0
- package/admin/custom/static/js/vendors-node_modules_mui_x-date-pickers_index_js.543a0e68.chunk.js +15 -0
- package/admin/custom/static/js/vendors-node_modules_mui_x-date-pickers_index_js.543a0e68.chunk.js.map +1 -0
- package/admin/mf-manifest.json +1 -1
- package/admin/remoteEntry.js +2 -2
- package/admin/tab.html +5 -5
- package/io-package.json +14 -14
- package/package.json +4 -4
- package/admin/assets/hostInit-CloAGww7.js +0 -2
- package/admin/assets/index-DuyZV49U.js +0 -805
- package/admin/assets/preload-helper-D6kgxu3v.js +0 -1
- package/admin/custom/static/js/node_modules_mui_material_node_modules_mui_system_esm_DefaultPropsProvider_DefaultPropsProvid-6480f80.64d156b1.chunk.js.map +0 -1
- package/admin/custom/static/js/node_modules_mui_material_node_modules_mui_system_esm_DefaultPropsProvider_DefaultPropsProvid-6480f81.faac2bea.chunk.js.map +0 -1
- package/admin/custom/static/js/node_modules_mui_material_node_modules_mui_system_esm_DefaultPropsProvider_DefaultPropsProvid-d67bc2.3794c875.chunk.js.map +0 -1
- package/admin/custom/static/js/node_modules_mui_material_node_modules_mui_system_esm_DefaultPropsProvider_DefaultPropsProvid-e30e0b.04fd593a.chunk.js +0 -11
- package/admin/custom/static/js/node_modules_mui_material_node_modules_mui_system_esm_DefaultPropsProvider_DefaultPropsProvid-e30e0b.04fd593a.chunk.js.map +0 -1
- package/admin/custom/static/js/vendors-node_modules_iobroker_adapter-react-v5_build_index_js.1c4bb293.chunk.js +0 -781
- package/admin/custom/static/js/vendors-node_modules_iobroker_adapter-react-v5_build_index_js.1c4bb293.chunk.js.map +0 -1
- package/admin/custom/static/js/vendors-node_modules_iobroker_adapter-react-v5_node_modules_mui_material_index_js-node_module-97ca99.33a209a3.chunk.js.map +0 -1
- package/admin/custom/static/js/vendors-node_modules_iobroker_json-config_build_index_js.27d108f4.chunk.js +0 -407
- package/admin/custom/static/js/vendors-node_modules_iobroker_json-config_build_index_js.27d108f4.chunk.js.map +0 -1
- package/admin/custom/static/js/vendors-node_modules_leaflet_dist_leaflet_css-node_modules_mui_material_styles_ThemeProvider_-7f7a23.cb1d977b.chunk.js.map +0 -1
- package/admin/custom/static/js/vendors-node_modules_mui_material_DefaultPropsProvider_DefaultPropsProvider_js-node_modules_m-228034.52253fa1.chunk.js.map +0 -1
- package/admin/custom/static/js/vendors-node_modules_mui_x-date-pickers_index_js.9a8c3036.chunk.js +0 -15
- package/admin/custom/static/js/vendors-node_modules_mui_x-date-pickers_index_js.9a8c3036.chunk.js.map +0 -1
- /package/admin/assets/{index-vLuKuXyl.css → index-CEoeyJnt.css} +0 -0
|
@@ -1,407 +0,0 @@
|
|
|
1
|
-
var Us=Object.defineProperty,Ws=Object.defineProperties;var Js=Object.getOwnPropertyDescriptors;var On=Object.getOwnPropertySymbols,Hs=Object.getPrototypeOf,zs=Object.prototype.hasOwnProperty,qs=Object.prototype.propertyIsEnumerable,Ks=Reflect.get;var mn=(V,ee,Y)=>ee in V?Us(V,ee,{enumerable:!0,configurable:!0,writable:!0,value:Y}):V[ee]=Y,q=(V,ee)=>{for(var Y in ee||(ee={}))zs.call(ee,Y)&&mn(V,Y,ee[Y]);if(On)for(var Y of On(ee))qs.call(ee,Y)&&mn(V,Y,ee[Y]);return V},Be=(V,ee)=>Ws(V,Js(ee));var Q=(V,ee,Y)=>mn(V,typeof ee!="symbol"?ee+"":ee,Y);var nt=(V,ee,Y)=>Ks(Hs(V),Y,ee);var pe=(V,ee,Y)=>new Promise((T,n)=>{var C=v=>{try{D(Y.next(v))}catch(o){n(o)}},m=v=>{try{D(Y.throw(v))}catch(o){n(o)}},D=v=>v.done?T(v.value):Promise.resolve(v.value).then(C,m);D((Y=Y.apply(V,ee)).next())});(self.webpackChunkiobroker_admin_component_backitup=self.webpackChunkiobroker_admin_component_backitup||[]).push([["vendors-node_modules_iobroker_json-config_build_index_js"],{79388:(V,ee,Y)=>{"use strict";Y.r(ee),Y.d(ee,{ConfigGeneric:()=>f,ConfigPanel:()=>Ot,JsonConfig:()=>Vs,JsonConfigComponent:()=>Wt});var T=Y(28437),n=Y.n(T),C=Y(85589),m=Y.n(C),D=Y(91778),v=Y.n(D),o=Y(67085),u=Y(21839),a=Y(75636);const _=window.innerWidth<=600?12:void 0;function R(E){return Object.prototype.toString.call(E)==="[object Object]"}const Se=class Se extends T.Component{constructor(e){super(e);Q(this,"defaultValue");Q(this,"isError");Q(this,"lang");Q(this,"defaultSendToDone");Q(this,"sendToTimeout");Q(this,"noPlaceRequired");Q(this,"onUpdate",e=>{const t=Se.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.oContext.instanceObj,e.arrayIndex,e.globalData):e.schema.default:e.schema.type!=="state"&&(this.defaultValue=e.schema.defaultFunc?this.execute(e.schema.defaultFunc,e.schema.default,e.data,e.arrayIndex,e.globalData):e.schema.default)),this.lang=a.I18n.getLanguage()}componentDidMount(){this.props.oContext.registerOnForceUpdate&&this.props.oContext.registerOnForceUpdate(this.props.attr,this.onUpdate);const e=["select","autocomplete","autocompleteSendTo"];if(this.defaultValue!==void 0){const t=Se.getValue(this.props.data,this.props.attr);(t===void 0||e.includes(this.props.schema.type)&&(t===""||t===null))&&setTimeout(()=>{this.props.custom?this.props.onChange(this.props.attr,this.defaultValue,()=>setTimeout(()=>this.props.oContext.forceUpdate([this.props.attr],this.props.data),100)):(Se.setValue(this.props.data,this.props.attr,this.defaultValue),this.props.onChange(this.props.data,void 0,()=>this.props.oContext.forceUpdate([this.props.attr],this.props.data)))},100)}else this.props.schema.defaultSendTo&&this.sendTo()}sendTo(){if(this.props.alive){this.defaultSendToDone=!0;let e=this.props.schema.data;if(e===void 0&&this.props.schema.jsonData){const t=this.getPattern(this.props.schema.jsonData,null,!0);try{e=JSON.parse(t)}catch(s){console.error(`Cannot parse json data: ${t}`)}}else e={attr:this.props.attr,value:Se.getValue(this.props.data,this.props.attr)};e===void 0&&(e=null),this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.defaultSendTo,e).then(t=>{t!=null&&(this.props.custom?this.props.onChange(this.props.attr,t,()=>this.props.oContext.forceUpdate([this.props.attr],this.props.data)):(Se.setValue(this.props.data,this.props.attr,t),this.props.onChange(this.props.data,void 0,()=>this.props.oContext.forceUpdate([this.props.attr],this.props.data))))})}else this.defaultSendToDone=!1,this.props.schema.allowSaveWithError||this.onError(this.props.attr,a.I18n.t("ra_Instance %s is not alive",this.props.oContext.instance.toString()))}componentWillUnmount(){this.props.oContext.registerOnForceUpdate&&this.props.oContext.registerOnForceUpdate(this.props.attr),this.sendToTimeout&&(clearTimeout(this.sendToTimeout),this.sendToTimeout=null)}static getValue(e,t){if(typeof t=="string")return Se.getValue(e,t.split("."));if(t.length===1)return e[t[0]];const s=t.shift();if(typeof s=="string"&&typeof e[s]=="object")return Se.getValue(e[s],t)}static setValue(e,t,s){if(typeof t=="string"){Se.setValue(e,t.split("."),s);return}if(t.length===1)s===null?delete e[t[0]]:e[t[0]]=s;else{const i=t.shift();if(typeof i!="string")return;(!e[i]||typeof e[i]=="object")&&(e[i]=e[i]||{}),Se.setValue(e[i],t,s)}}getText(e,t){if(!e)return"";if(typeof e=="string"){const s=t?e:a.I18n.t(e);return s.includes("${")?this.getPattern(s,null,t):s}return R(e)?e.func?typeof e.func=="object"?this.getPattern(e.func[this.lang]||e.func.en||"",null,!0):this.getPattern(e.func,null,t):e[this.lang]||e.en||"":e.toString()}renderDialogConfirm(){if(!this.state.confirmDialog)return null;const e=this.state.confirmData||this.props.schema.confirm;let t=null;return e.type==="warning"?t=n().createElement(u.Warning,null):e.type==="error"?t=n().createElement(u.Error,null):e.type==="info"&&(t=n().createElement(u.Info,null)),n().createElement(a.DialogConfirm,{title:this.getText(e.title)||a.I18n.t("ra_Please confirm"),text:this.getText(e.text),ok:this.getText(e.ok)||a.I18n.t("ra_Ok"),cancel:this.getText(e.cancel)||a.I18n.t("ra_Cancel"),icon:t||void 0,onClose:s=>this.setState({confirmDialog:!1},()=>{if(s){if(this.state.confirmCallback){const r=this.state.confirmCallback;this.setState({confirmCallback:null},()=>r(!0));return}const i=JSON.parse(JSON.stringify(this.props.data));this.state.confirmDepAttr&&Se.setValue(i,this.state.confirmDepAttr,this.state.confirmDepNewValue),Se.setValue(i,this.state.confirmAttr,this.state.confirmNewValue),this.setState({confirmDialog:!1,confirmDepAttr:null,confirmDepNewValue:null,confirmNewValue:null,confirmAttr:null,confirmData:null},()=>this.props.onChange(i))}else{const i=this.state.confirmCallback;this.setState({confirmDialog:!1,confirmDepAttr:null,confirmDepNewValue:null,confirmNewValue:null,confirmAttr:null,confirmData:null,confirmCallback:null},()=>{i&&i(!1)})}})})}getIcon(e){e=e||this.props.schema.icon;let t=null;return e==="auth"?t=n().createElement(u.Key,null):e==="send"?t=n().createElement(u.Send,null):e==="web"?t=n().createElement(u.Public,null):e==="warning"?t=n().createElement(u.Warning,null):e==="error"?t=n().createElement(u.Error,null):e==="info"?t=n().createElement(u.Info,null):e==="search"?t=n().createElement(u.Search,null):e==="book"?t=n().createElement(u.MenuBook,null):e==="help"?t=n().createElement(u.Help,null):e==="upload"?t=n().createElement(u.UploadFile,null):e==="edit"?t=n().createElement(u.Edit,null):e==="user"?t=n().createElement(u.Person,null):e==="group"?t=n().createElement(u.Group,null):e==="delete"?t=n().createElement(u.Delete,null):e==="refresh"?t=n().createElement(u.Refresh,null):e==="add"?t=n().createElement(u.Add,null):e==="unpair"?t=n().createElement(u.LinkOff,null):e==="pair"?t=n().createElement(u.Link,null):e==="save"?t=n().createElement(u.Save,null):e==="open"?t=n().createElement(u.OpenInNew,null):e&&((e.endsWith(".png")||e.endsWith(".svg")||e.endsWith(".jpg"))&&!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`./adapter/${this.props.oContext.adapterName}/${e}`),t=n().createElement(a.Icon,{src:e,style:{width:22,height:22}})),t}onChangeAsync(e,t){return new Promise(s=>{const i=this.onChange(e,t,s);i instanceof Promise&&i.catch(r=>console.error(`Cannot set value: ${r}`))})}onChange(e,t,s){const i=JSON.parse(JSON.stringify(this.props.data));if(Se.setValue(i,e,t),this.props.schema.confirm&&this.execute(this.props.schema.confirm.condition,!1,i,this.props.arrayIndex,this.props.globalData))return new Promise(l=>{this.setState({confirmDialog:!0,confirmNewValue:t,confirmAttr:e,confirmData:null},()=>{typeof s=="function"?s():l()})});if(this.props.schema.confirmDependsOn)for(let l=0;l<this.props.schema.confirmDependsOn.length;l++){const h=this.props.schema.confirmDependsOn[l];if(h.confirm){const S=Se.getValue(i,h.attr);if(this.execute(h.confirm.condition,!1,i,this.props.arrayIndex,this.props.globalData))return new Promise(L=>{this.setState({confirmDialog:!0,confirmNewValue:t,confirmAttr:e,confirmDepNewValue:S,confirmDepAttr:h.attr,confirmData:h.confirm},()=>{typeof s=="function"?s():L()})})}}const r=[];if(this.props.schema.onChangeDependsOn)for(let l=0;l<this.props.schema.onChangeDependsOn.length;l++){const h=this.props.schema.onChangeDependsOn[l];if(h.onChange){const S=Se.getValue(i,h.attr);let L;this.props.custom?L=this.executeCustom(h.onChange.calculateFunc,i,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):L=this.execute(h.onChange.calculateFunc,S,i,this.props.arrayIndex,this.props.globalData),L!==S&&(Se.setValue(i,h.attr,L),r.push(h.attr))}}if(this.props.schema.hiddenDependsOn)for(let l=0;l<this.props.schema.hiddenDependsOn.length;l++){const h=this.props.schema.hiddenDependsOn[l];h.hidden&&r.push(h.attr)}if(this.props.schema.labelDependsOn)for(let l=0;l<this.props.schema.labelDependsOn.length;l++){const h=this.props.schema.labelDependsOn[l];h.hidden&&r.push(h.attr)}if(this.props.schema.helpDependsOn)for(let l=0;l<this.props.schema.helpDependsOn.length;l++){const h=this.props.schema.helpDependsOn[l];h.hidden&&r.push(h.attr)}if(this.props.schema.onChange&&!this.props.schema.onChange.ignoreOwnChanges){const l=Se.getValue(i,this.props.attr),h=this.props.custom?this.executeCustom(this.props.schema.onChange.calculateFunc,i,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):this.execute(this.props.schema.onChange.calculateFunc,l,i,this.props.arrayIndex,this.props.globalData);h!==l&&Se.setValue(i,this.props.attr,h)}return this.props.custom?(this.props.onChange(e,t,()=>s&&s()),r!=null&&r.length&&r.forEach((l,h)=>setTimeout(()=>this.props.onChange(l,Se.getValue(i,l)),h*50))):this.props.onChange(i,void 0,()=>{r.length&&this.props.oContext.forceUpdate(r,i),s&&s()}),Promise.resolve()}execute(e,t,s,i,r){let l;if(R(e))l=e.func;else if(typeof e=="string")l=e;else return e;if(!l)return t;try{return new Function("data","originalData","_system","_alive","_common","_socket","_instance","arrayIndex","globalData","_changed",l.includes("return")?l:`return ${l}`)(s||this.props.data,this.props.originalData,this.props.oContext.systemConfig,this.props.alive,this.props.common,this.props.oContext.socket,this.props.oContext.instance,i,r,this.props.changed)}catch(h){return console.error(`Cannot execute ${JSON.stringify(e)}: ${h}`),t}}executeCustom(e,t,s,i,r,l){let h;if(R(e))h=e.func;else if(typeof e=="string")h=e;else return e;if(!h)return null;try{return new Function("data","originalData","_system","instanceObj","customObj","_socket","arrayIndex","globalData","_changed",h.includes("return")?h:`return ${h}`)(t||this.props.data,this.props.originalData,this.props.oContext.systemConfig,i,s,this.props.oContext.socket,r,l,this.props.changed)}catch(S){return console.error(`Cannot execute ${h}: ${S}`),null}}calculate(e){let t,s,i,r;return this.props.custom?(t=e.validator?!this.executeCustom(e.validator,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):!1,e.disabled===!0?s=!0:s=e.disabled?this.executeCustom(e.disabled,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):!1,e.hidden===!0?i=!0:i=e.hidden?this.executeCustom(e.hidden,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):!1,r=e.defaultFunc?this.executeCustom(e.defaultFunc,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):e.default):(t=e.validator?!this.execute(e.validator,!1,this.props.data,this.props.arrayIndex,this.props.globalData):!1,e.disabled===!0?s=!0:s=e.disabled?this.execute(e.disabled,!1,this.props.data,this.props.arrayIndex,this.props.globalData):!1,e.hidden===!0?i=!0:i=e.hidden?this.execute(e.hidden,!1,this.props.data,this.props.arrayIndex,this.props.globalData):!1,r=e.defaultFunc?this.execute(e.defaultFunc,e.default,this.props.data,this.props.arrayIndex,this.props.globalData):e.default),{error:t,disabled:s,hidden:i,defaultValue:r}}onError(e,t){t?this.isError[e]=t:delete this.isError[e],this.props.onError&&this.props.onError(e,t)}renderItem(e,t,s){return this.getText(this.props.schema.label)||this.getText(this.props.schema.text)}renderHelp(e,t,s){return t?n().createElement("a",{href:t,target:"_blank",rel:"noreferrer",style:{color:this.props.oContext.themeType==="dark"?"#a147ff":"#5b238f",textDecoration:"underline"}},this.getText(e,s)):(e=this.getText(e,s)||"",e&&(e.includes("<a ")||e.includes("<br")||e.includes("<b>")||e.includes("<i>"))?a.Utils.renderTextWithA(e):e)}static escapeString(e,t){return typeof e!="string"?"":(e=e.replace(/`/g,"\\`"),e=e.replace(/\${([^}]+)}/g,(s,i)=>{if(i&&typeof i=="string"&&i.startsWith("data.")){const r=Se.getValue(t,i.replace(/^data\./,""));if(typeof r=="string"&&r.includes('"'))return`\${${i}.replace(/"/g, '\\\\"')}`}return s}),e)}getPattern(e,t,s){if(t=t||this.props.data,!e)return"";let i;typeof e=="object"?e.func?i=e.func:(console.log(`Object must be stringified: ${JSON.stringify(e)}`),i=JSON.stringify(e)):i=e;try{if(this.props.custom)return new Function("data","originalData","arrayIndex","globalData","_system","instanceObj","customObj","_socket","_changed",`return \`${Se.escapeString(i,t)}\``)(t,this.props.originalData,this.props.arrayIndex,this.props.globalData,this.props.oContext.systemConfig,this.props.oContext.instanceObj,this.props.customObj,this.props.oContext.socket,this.props.changed);const l=new Function("data","originalData","arrayIndex","globalData","_system","_alive","_common","_socket","_changed",`return \`${Se.escapeString(i,t)}\``)(t,this.props.originalData,this.props.arrayIndex,this.props.globalData,this.props.oContext.systemConfig,this.props.alive,this.props.common,this.props.oContext.socket,this.props.changed);return s?l:a.I18n.t(l)}catch(r){return console.error(`Cannot execute ${i}: ${r}`),i}}render(){const e=this.props.schema;if(!e||this.props.oContext.expertMode===!1&&e.expertMode)return null;this.props.alive&&this.defaultSendToDone===!1&&(this.sendToTimeout=setTimeout(()=>{this.sendToTimeout=null,this.sendTo()},200));const{error:t,disabled:s,hidden:i,defaultValue:r}=this.calculate(e);if(i){if(Object.keys(this.isError).length&&(setTimeout(S=>Object.keys(S).forEach(L=>this.props.onError(L)),100,JSON.parse(JSON.stringify(this.isError))),this.isError={}),e.hideOnlyControl){const S=n().createElement(o.Grid2,{size:{xs:e.xs||_,sm:e.sm||void 0,md:e.md||void 0,lg:e.lg||void 0,xl:e.xl||void 0},style:q(q({marginBottom:0,textAlign:"left"},e.style),this.props.oContext.themeType==="dark"?e.darkStyle:{})});return e.newLine?n().createElement(n().Fragment,null,n().createElement("div",{style:{flexBasis:"100%",height:0}}),S):S}return null}e.validatorNoSaveOnError&&(t&&!Object.keys(this.isError).length?(this.isError={[this.props.attr]:e.validatorErrorText?a.I18n.t(e.validatorErrorText):!0},setTimeout(S=>Object.keys(S).forEach(L=>this.props.onError(L,S[L])),100,JSON.parse(JSON.stringify(this.isError)))):!t&&Object.keys(this.isError).length&&(setTimeout(S=>Object.keys(S).forEach(L=>this.props.onError(L)),100,JSON.parse(JSON.stringify(this.isError))),this.isError={}));const l=this.renderItem(t,s||this.props.commandRunning||this.props.disabled,r);if(this.noPlaceRequired)return l;const h=n().createElement(o.Grid2,{title:this.getText(e.tooltip),size:{xs:e.xs||12,sm:e.sm||void 0,md:e.md||void 0,lg:e.lg||void 0,xl:e.xl||void 0},style:q(q({marginBottom:0,textAlign:"left",width:e.type==="divider"||e.type==="header"?e.width||"100%":void 0},e.style),this.props.oContext.themeType==="dark"?e.darkStyle:{})},this.props.schema.defaultSendTo&&this.props.schema.button?n().createElement(o.Grid2,{container:!0,style:{width:"100%"}},n().createElement(o.Grid2,{flex:1},l),n().createElement(o.Grid2,null,n().createElement(o.Button,{disabled:s,variant:"outlined",onClick:()=>this.sendTo(),title:this.props.schema.buttonTooltip?this.getText(this.props.schema.buttonTooltip,this.props.schema.buttonTooltipNoTranslation):a.I18n.t("ra_Request data by instance")},this.getText(this.props.schema.button)))):l);return e.newLine?n().createElement(n().Fragment,null,n().createElement("div",{style:{flexBasis:"100%",height:0}}),this.renderDialogConfirm(),h):this.state.confirmDialog?n().createElement(n().Fragment,null,this.renderDialogConfirm(),h):h}};Q(Se,"DIFFERENT_VALUE","__different__"),Q(Se,"DIFFERENT_LABEL","ra___different__"),Q(Se,"NONE_VALUE",""),Q(Se,"NONE_LABEL","ra_none");let f=Se;const Z={fullWidth:{width:"100%"},accordionSummary:E=>({backgroundColor:E.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"rgba(0, 0, 0, 0.08)"}),accordionTitle:{},toolbar:E=>({backgroundColor:E.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"rgba(0, 0, 0, 0.08)",borderRadius:"3px"}),tooltip:{pointerEvents:"none"}};class j extends f{constructor(e){super(e);Q(this,"typingTimer",null);Q(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))});Q(this,"onClone",e=>()=>{const t=JSON.parse(JSON.stringify(this.state.value)),s=JSON.parse(JSON.stringify(t[e]));if(typeof this.props.schema.clone=="string"&&typeof s[this.props.schema.clone]=="string"){let i=1,r=s[this.props.schema.clone];const l=r.match(/(\d+)$/);for(l?(r=r.replace(l[0],""),i=parseInt(l[0],10)+1):r+="_";t.find(h=>h[this.props.schema.clone]===r+i.toString());)i++;s[this.props.schema.clone]=`${s[this.props.schema.clone]}_${i}`}t.splice(e,0,s),this.setState({value:t,activeIndex:-1,iteration:this.state.iteration+1e4},()=>this.onChangeWrapper(t))});Q(this,"onChangeWrapper",e=>{this.typingTimer&&clearTimeout(this.typingTimer),this.typingTimer=setTimeout(t=>{this.typingTimer=null;const s=this.onChange(this.props.attr,t);s instanceof Promise&&s.catch(i=>this.onError(i))},300,e)});Q(this,"onAdd",()=>{const{schema:e}=this.props,t=JSON.parse(JSON.stringify(this.state.value)),s=e.items&&e.items.reduce((i,r)=>{let l;return r.defaultFunc?this.props.custom?l=r.defaultFunc?this.executeCustom(r.defaultFunc,this.props.data,this.props.customObj,this.props.oContext.instanceObj,t.length,this.props.data):this.props.schema.default:l=r.defaultFunc?this.execute(r.defaultFunc,this.props.schema.default,this.props.data,t.length,this.props.data):this.props.schema.default:l=r.default===void 0?null:r.default,i[r.attr]=l,i},{});t.push(s),this.setState({value:t,activeIndex:t.length-1},()=>this.onChangeWrapper(t))});this.props.schema.items=this.props.schema.items||[]}componentDidMount(){super.componentDidMount();let e=f.getValue(this.props.data,this.props.attr)||[];Array.isArray(e)||(e=[]),this.setState({value:e,activeIndex:-1,iteration:0})}componentWillUnmount(){this.typingTimer&&(clearTimeout(this.typingTimer),this.typingTimer=null),super.componentWillUnmount()}itemAccordion(e,t){const{value:s}=this.state,{schema:i}=this.props,r={type:"panel",items:i.items.reduce((l,h)=>(l[h.attr]=h,l),{}),style:{marginLeft:"-8px",marginTop:"10px",marginBottom:"10px"}};return n().createElement(Ot,{oContext:this.props.oContext,index:t+this.state.iteration,arrayIndex:t,changed:this.props.changed,globalData:this.props.data,common:this.props.common,alive:this.props.alive,themeName:this.props.themeName,data:e,custom:!0,schema:r,originalData:this.props.originalData,onChange:(l,h)=>{const S=JSON.parse(JSON.stringify(s));S[t][l]=h,this.setState({value:S},()=>this.onChangeWrapper(S))},onError:(l,h)=>this.onError(l,h),table:this.props.table})}onMoveUp(e){const t=JSON.parse(JSON.stringify(this.state.value)),s=t[e];t.splice(e,1),t.splice(e-1,0,s);const i=this.state.activeIndex-1;this.setState({value:t,activeIndex:i,iteration:this.state.iteration+1e4},()=>this.onChangeWrapper(t))}onMoveDown(e){const t=JSON.parse(JSON.stringify(this.state.value)),s=t[e];t.splice(e,1),t.splice(e+1,0,s);const i=this.state.activeIndex+1;this.setState({value:t,activeIndex:i,iteration:this.state.iteration+1e4},()=>this.onChangeWrapper(t))}renderItem(){const{schema:e}=this.props,{value:t}=this.state;return t?n().createElement(o.Paper,null,e.label||!e.noDelete?n().createElement(o.Toolbar,{variant:"dense"},e.label?n().createElement(o.Typography,{variant:"h6",id:"tableTitle",component:"div"},this.getText(e.label)):null,e.noDelete?null:n().createElement(o.IconButton,{size:"small",color:"primary",onClick:this.onAdd},n().createElement(u.Add,null))):null,t.map((s,i)=>n().createElement(o.Accordion,{key:`${s}_${i}`,expanded:this.state.activeIndex===i,onChange:(r,l)=>this.setState({activeIndex:l?i:-1})},n().createElement(o.AccordionSummary,{expandIcon:n().createElement(u.ExpandMore,null),sx:a.Utils.getStyle(this.props.oContext.theme,Z.fullWidth,Z.accordionSummary)},n().createElement(o.Typography,{style:Z.accordionTitle},s[e.titleAttr])),n().createElement(o.AccordionDetails,{style:q(q({},e.style),this.props.oContext.themeType?e.darkStyle:void 0)},this.itemAccordion(t[i],i),n().createElement(o.Toolbar,{sx:Z.toolbar},i?n().createElement(o.Tooltip,{title:a.I18n.t("ra_Move up"),slotProps:{popper:{sx:Z.tooltip}}},n().createElement(o.IconButton,{size:"small",onClick:()=>this.onMoveUp(i)},n().createElement(u.ArrowUpward,null))):n().createElement("div",{style:Z.buttonEmpty}),i<t.length-1?n().createElement(o.Tooltip,{title:a.I18n.t("ra_Move down"),slotProps:{popper:{sx:Z.tooltip}}},n().createElement(o.IconButton,{size:"small",onClick:()=>this.onMoveDown(i)},n().createElement(u.ArrowDownward,null))):n().createElement("div",{style:Z.buttonEmpty}),e.noDelete?null:n().createElement(o.Tooltip,{title:a.I18n.t("ra_Delete current row"),slotProps:{popper:{sx:Z.tooltip}}},n().createElement(o.IconButton,{size:"small",onClick:this.onDelete(i)},n().createElement(u.Delete,null))),e.clone?n().createElement(o.Tooltip,{title:a.I18n.t("ra_Clone current row"),slotProps:{popper:{sx:Z.tooltip}}},n().createElement(o.IconButton,{size:"small",onClick:this.onClone(i)},n().createElement(u.ContentCopy,null))):null)))),!e.noDelete&&t.length>0?n().createElement(o.Toolbar,{variant:"dense",sx:Z.rootTool},n().createElement(o.IconButton,{size:"small",color:"primary",onClick:this.onAdd},n().createElement(u.Add,null))):null,e.help?n().createElement(o.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null):null}}const H=j,ie={root:{width:"100%"},notAlive:{color:"#a30000"}};class le extends f{componentDidMount(){super.componentDidMount();const c=this.getInstance();this.props.oContext.socket.getState(`${c}.alive`).then(e=>this.setState({alive:!!(e&&e.val),instance:c}))}getInstance(){let c=this.props.schema.instance||`${this.props.oContext.adapterName}.${this.props.oContext.instance}`;return c.includes("${")&&(c=this.getPattern(c,null,!0)),c&&!c.startsWith("system.adapter.")&&(c=`system.adapter.${c}`),c}renderItem(){if(this.getInstance()!==this.state.instance&&setTimeout(()=>{const e=this.getInstance();e?this.props.oContext.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 c=this.state.instance.replace(/^system.adapter./,"");return n().createElement("div",{style:q(q({},ie.root),this.state.alive?void 0:ie.notAlive)},this.state.alive?this.props.schema.textAlive!==void 0?this.props.schema.textAlive?a.I18n.t(this.props.schema.textAlive,c):"":a.I18n.t("ra_Instance %s is alive",c):this.props.schema.textNotAlive!==void 0?this.props.schema.textNotAlive?a.I18n.t(this.props.schema.textNotAlive,c):"":a.I18n.t("ra_Instance %s is not alive",c))}}const M=le;class w extends f{componentDidMount(){super.componentDidMount();const c=f.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(c)?(e.unshift({label:a.I18n.t(f.DIFFERENT_LABEL),value:f.DIFFERENT_VALUE}),this.setState({value:f.DIFFERENT_VALUE,selectOptions:e})):this.setState({value:c,selectOptions:e})}renderItem(c,e){if(!this.state.selectOptions)return null;let t;const s=JSON.parse(JSON.stringify(this.state.selectOptions));return Array.isArray(this.state.value)||this.state.value===f.DIFFERENT_VALUE?([...this.state.value].filter(r=>!s.find(l=>typeof l=="object"?l.value===r:l===r)).forEach(r=>s.push({label:r.toString(),value:r})),t={label:a.I18n.t(f.DIFFERENT_LABEL),value:f.DIFFERENT_VALUE},s.unshift(t)):(t=this.state.value!==null&&this.state.value!==void 0&&s.find(r=>typeof r=="object"?r.value==this.state.value:r==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},s.push(t))),n().createElement(o.Autocomplete,{fullWidth:!0,freeSolo:!!this.props.schema.freeSolo,value:t,options:s,isOptionEqualToValue:(r,l)=>r.value===l.value,filterOptions:(r,l)=>{const h=r.filter(S=>l.inputValue===""?!0:S.label.toLowerCase().includes(l.inputValue.toLowerCase())||S.value.toLowerCase().includes(l.inputValue.toLowerCase()));return this.props.schema.freeSolo&&l.inputValue!==""&&h.push({label:l.inputValue,value:l.inputValue}),h},onInputChange:r=>{if(!r||!this.props.schema.freeSolo)return;const l=r.target.value;l!==this.state.value&&this.setState({value:l},()=>this.onChange(this.props.attr,l))},onChange:(r,l)=>{const h=typeof l=="object"?l?l.value:"":l;h!==this.state.value&&this.setState({value:h},()=>this.onChange(this.props.attr,h))},getOptionLabel:r=>{var l;return typeof r=="object"&&(l=r==null?void 0:r.label)!=null?l:""},renderInput:r=>n().createElement(o.TextField,Be(q({variant:"standard"},r),{error:!!c,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 y=w;class p extends f{constructor(){super(...arguments);Q(this,"initialized",!1);Q(this,"localContext")}askInstance(){const e=f.getValue(this.props.data,this.props.attr),t=this.props.schema.options?this.props.schema.options.map(s=>typeof s=="string"?{label:s,value:s}:JSON.parse(JSON.stringify(s))):[];if(this.props.alive){let s=this.props.schema.data;if(s===void 0&&this.props.schema.jsonData){const i=this.getPattern(this.props.schema.jsonData,null,!0);try{typeof i=="string"&&(s=JSON.parse(i))}catch(r){console.error(`Cannot parse json data: ${JSON.stringify(s)}`)}}s===void 0&&(s=null),this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",s).then(i=>{i&&Array.isArray(i)&&i.forEach(r=>t.push(typeof r=="string"?{label:r,value:r}:JSON.parse(JSON.stringify(r)))),Array.isArray(e)?(t.unshift({label:a.I18n.t(f.DIFFERENT_LABEL),value:f.DIFFERENT_VALUE}),this.setState({value:f.DIFFERENT_VALUE,selectOptions:t})):this.setState({value:e,selectOptions:t})})}else Array.isArray(e)?(t.unshift({label:a.I18n.t(f.DIFFERENT_LABEL),value:f.DIFFERENT_VALUE}),this.setState({value:f.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]=f.getValue(this.props.data,t)),JSON.stringify(e)}renderItem(e,t){if(this.props.alive){const l=this.getContext();(l!==this.localContext||!this.initialized)&&(this.localContext=l,setTimeout(()=>this.askInstance(),this.initialized?300:50),this.initialized=!0)}let s;const i=this.state.selectOptions?JSON.parse(JSON.stringify(this.state.selectOptions)):[];return Array.isArray(this.state.value)||this.state.value===f.DIFFERENT_LABEL?([...this.state.value].filter(l=>!i.find(h=>h.value===l)).forEach(l=>i.push({label:l.toString(),value:l})),s={label:a.I18n.t(f.DIFFERENT_LABEL),value:f.DIFFERENT_VALUE},i.unshift(s)):(s=this.state.value!==null&&this.state.value!==void 0&&i.find(l=>l.value==this.state.value),this.state.value!==null&&this.state.value!==void 0&&!s&&this.props.schema.freeSolo&&(s={value:this.state.value,label:this.state.value},i.push(s)),s=s||null),i.length?n().createElement(o.Autocomplete,{value:s,fullWidth:!0,freeSolo:!!this.props.schema.freeSolo,options:i,isOptionEqualToValue:(l,h)=>l.value===h.value,filterOptions:(l,h)=>{const S=l.filter(L=>h.inputValue===""?!0:L.label.toLowerCase().includes(h.inputValue.toLowerCase())||L.value.toLowerCase().includes(h.inputValue.toLowerCase()));return this.props.schema.freeSolo&&h.inputValue!==""&&S.push({label:h.inputValue,value:h.inputValue}),S},getOptionLabel:l=>{var h;return(h=l==null?void 0:l.label)!=null?h:""},onInputChange:l=>{if(!l||!this.props.schema.freeSolo)return;const h=l.target.value;h!==this.state.value&&this.setState({value:h},()=>this.onChange(this.props.attr,h))},onChange:(l,h)=>{const S=typeof h=="object"?h?h.value:"":h;S!==this.state.value&&this.setState({value:S},()=>this.onChange(this.props.attr,S))},renderInput:l=>n().createElement(o.TextField,Be(q({variant:"standard"},l),{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}))}):n().createElement(o.TextField,{variant:"standard",fullWidth:!0,value:this.state.value===null||this.state.value===void 0?"":this.state.value,error:!!e,disabled:t,slotProps:{htmlInput:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0}},onChange:l=>{const h=l.target.value;this.setState({value:h},()=>this.onChange(this.props.attr,(h||"").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 g=p,d={fullWidth:{width:"100%"},flex:{display:"flex"},button:{height:48,marginLeft:4,minWidth:48}};class x extends f{componentDidMount(){super.componentDidMount();const{data:c,attr:e}=this.props,t=f.getValue(c,e)||"";this.setState({value:t,showDialog:!1})}renderItem(c,e){const{schema:t,attr:s}=this.props,{value:i,showDialog:r}=this.state;return n().createElement(o.FormControl,{style:d.fullWidth,variant:"standard"},t.label?n().createElement(o.InputLabel,{shrink:!0},this.getText(t.label)):null,n().createElement("div",{style:d.flex},n().createElement(o.TextField,{variant:"standard",fullWidth:!0,value:i!=null?i:"",error:!!c,disabled:e,placeholder:this.getText(t.placeholder),label:this.getText(t.label),helperText:this.renderHelp(t.help,t.helpLink,t.noTranslation),onChange:l=>{const h=l.target.value;this.setState({value:h},()=>this.onChange(s,h))}}),n().createElement(o.Button,{color:"grey",disabled:e,style:d.button,size:"small",variant:"outlined",onClick:()=>this.setState({showDialog:!0})},"...")),r?n().createElement(a.DialogCron,{title:a.I18n.t("ra_Define schedule"),simple:t.simple,complex:t.complex,cron:i,onClose:()=>this.setState({showDialog:!1}),cancel:a.I18n.t("ra_Cancel"),ok:a.I18n.t("ra_Ok"),theme:this.props.oContext.theme,onOk:l=>this.setState({showDialog:!1,value:l},()=>this.onChange(s,l))}):null)}}const b=x;class B extends f{componentDidMount(){return pe(this,null,function*(){nt(B.prototype,this,"componentDidMount").call(this);const c=f.getValue(this.props.data,this.props.attr),t=(yield this.props.oContext.socket.getCertificates()).filter(s=>{const i=this.props.attr.toLowerCase();return i.includes(s.type)||s.type==="public"&&i.includes("cert")||s.type==="private"&&(i.includes("priv")||i.includes("key"))?!0:!!(s.type==="chained"&&(i.includes("chain")||i.includes("ca")))}).map(s=>({label:s.name,value:s.name}));t.unshift({label:a.I18n.t(f.NONE_LABEL),value:f.NONE_VALUE}),this.setState({value:c,selectOptions:t})})}renderItem(c,e){var s,i;if(!this.state.selectOptions)return null;const t=(s=this.state.selectOptions)==null?void 0:s.find(r=>r.value===this.state.value);return n().createElement(o.FormControl,{style:{width:"100%"},variant:"standard"},this.props.schema.label?n().createElement(o.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,n().createElement(o.Select,{variant:"standard",error:!!c,displayEmpty:!0,disabled:!!e,value:this.state.value,renderValue:()=>this.getText(t==null?void 0:t.label,this.props.schema.noTranslation!==!1),onChange:r=>this.setState({value:r.target.value},()=>this.onChange(this.props.attr,this.state.value))},(i=this.state.selectOptions)==null?void 0:i.map(r=>n().createElement(o.MenuItem,{key:r.value,value:r.value,style:r.value===f.NONE_VALUE?{opacity:.5}:{}},this.getText(r.label,this.props.schema.noTranslation!==!1)))),this.props.schema.help?n().createElement(o.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const $=B,k={fullWidth:{width:"100%"},leWidth:{width:620,marginBottom:10},certWidth:{width:200,marginRight:10}};class F extends f{componentDidMount(){return pe(this,null,function*(){var l;nt(F.prototype,this,"componentDidMount").call(this);const c=yield this.props.oContext.socket.getCertificates(),e=[],t=[],s=[];let i=[];const r=yield this.props.oContext.socket.getObject("system.certificates");(l=r==null?void 0:r.native)!=null&&l.collections?i=Object.keys(r.native.collections):i=null,c.forEach(h=>{h.type==="public"?e.push({label:h.name,value:h.name}):h.type==="private"?t.push({label:h.name,value:h.name}):h.type==="chained"?s.push({label:h.name,value:h.name}):(e.push({label:h.name,value:h.name}),t.push({label:h.name,value:h.name}),s.push({label:h.name,value:h.name}))}),e.unshift({label:a.I18n.t(f.NONE_LABEL),value:f.NONE_VALUE}),t.unshift({label:a.I18n.t(f.NONE_LABEL),value:f.NONE_VALUE}),s.unshift({label:a.I18n.t(f.NONE_LABEL),value:f.NONE_VALUE}),this.setState({certsPublicOptions:e,certsChainOptions:s,certsPrivateOptions:t,collectionsOptions:i})})}renderItem(c,e){var L,O,N,te,ye,se,Ee;if(!this.state.certsPublicOptions||!this.state.certsPrivateOptions||!this.state.certsChainOptions)return null;const t=(f.getValue(this.props.data,this.props.schema.leCollectionName||"leCollection")||"false").toString(),s=f.getValue(this.props.data,this.props.schema.certPublicName||"certPublic"),i=f.getValue(this.props.data,this.props.schema.certPrivateName||"certPrivate"),r=f.getValue(this.props.data,this.props.schema.certChainedName||"certChained"),l=(L=this.state.certsPublicOptions)==null?void 0:L.find(me=>me.value===s),h=(O=this.state.certsPrivateOptions)==null?void 0:O.find(me=>me.value===i),S=(N=this.state.certsChainOptions)==null?void 0:N.find(me=>me.value===r);return n().createElement("div",{style:k.fullWidth},this.state.collectionsOptions?n().createElement(o.FormControl,{style:k.leWidth,variant:"standard"},n().createElement(o.InputLabel,{shrink:!0},"Let's encrypt"),n().createElement(o.Select,{variant:"standard",error:!!c,displayEmpty:!0,disabled:!!e,value:t,onChange:me=>this.onChange(this.props.schema.leCollectionName||"leCollection",me.target.value==="false"?!1:me.target.value==="true"?!0:me.target.value)},n().createElement(o.MenuItem,{key:"_false",value:"false",style:{fontWeight:"bold"}},a.I18n.t("ra_Do not use let's encrypt")),n().createElement(o.MenuItem,{key:"_true",value:"true",style:{fontWeight:"bold"}},a.I18n.t("ra_Use all available let's encrypt certificates")),(te=this.state.collectionsOptions)==null?void 0:te.map(me=>n().createElement(o.MenuItem,{key:me,value:me},me)))):null,this.state.collectionsOptions?n().createElement("br",null):null,this.state.collectionsOptions&&t!=="false"?n().createElement("div",null,a.I18n.t("ra_Fallback custom certificates")):null,n().createElement(o.FormControl,{style:k.certWidth,variant:"standard"},n().createElement(o.InputLabel,{shrink:!0},a.I18n.t("ra_Public certificate")),n().createElement(o.Select,{variant:"standard",error:!!c,displayEmpty:!0,disabled:!!e,value:s||"",renderValue:()=>this.getText(l==null?void 0:l.label),onChange:me=>this.onChange(this.props.schema.certPublicName||"certPublic",me.target.value)},(ye=this.state.certsPublicOptions)==null?void 0:ye.map((me,Me)=>n().createElement(o.MenuItem,{key:`${me.value}_${Me}`,value:me.value,style:me.value===f.NONE_VALUE?{opacity:.5}:{}},this.getText(me.label))))),n().createElement(o.FormControl,{style:k.certWidth,variant:"standard"},n().createElement(o.InputLabel,{shrink:!0},a.I18n.t("ra_Private certificate")),n().createElement(o.Select,{variant:"standard",error:!!c,displayEmpty:!0,disabled:!!e,value:i||"",renderValue:()=>this.getText(h==null?void 0:h.label),onChange:me=>this.onChange(this.props.schema.certPrivateName||"certPrivate",me.target.value)},(se=this.state.certsPrivateOptions)==null?void 0:se.map((me,Me)=>n().createElement(o.MenuItem,{key:`${me.value}_${Me}`,value:me.value,style:me.value===f.NONE_VALUE?{opacity:.5}:{}},this.getText(me.label))))),n().createElement(o.FormControl,{style:k.certWidth,variant:"standard"},n().createElement(o.InputLabel,{shrink:!0},a.I18n.t("ra_Chained certificate")),n().createElement(o.Select,{variant:"standard",error:!!c,displayEmpty:!0,disabled:!!e,value:r||"",renderValue:()=>this.getText(S==null?void 0:S.label),onChange:me=>this.onChange(this.props.schema.certChainedName||"certChained",me.target.value)},(Ee=this.state.certsChainOptions)==null?void 0:Ee.map((me,Me)=>n().createElement(o.MenuItem,{key:`${me.value}_${Me}`,value:me.value,style:me.value===f.NONE_VALUE?{opacity:.5}:{}},this.getText(me.label))))))}}const I=F;class U extends f{componentDidMount(){return pe(this,null,function*(){var t;nt(U.prototype,this,"componentDidMount").call(this);let c;const e=yield this.props.oContext.socket.getObject("system.certificates");(t=e==null?void 0:e.native)!=null&&t.collections?c=Object.keys(e.native.collections):c=[],this.setState({collectionsOptions:c})})}renderItem(c,e){var s;if(!this.state.collectionsOptions)return null;const t=(f.getValue(this.props.data,this.props.schema.leCollectionName||"leCollection")||"false").toString();return n().createElement(o.FormControl,{style:{width:"100%"},variant:"standard"},this.props.schema.label?n().createElement(o.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,n().createElement(o.Select,{variant:"standard",error:!!c,displayEmpty:!0,disabled:!!e,value:t,onChange:i=>this.onChange(this.props.schema.leCollectionName||"leCollection",i.target.value==="false"?!1:i.target.value==="true"?!0:i.target.value)},n().createElement(o.MenuItem,{key:"_false",value:"false",style:{fontWeight:"bold"}},a.I18n.t("ra_Do not use let's encrypt")),n().createElement(o.MenuItem,{key:"_true",value:"true",style:{fontWeight:"bold"}},a.I18n.t("ra_Use all available let's encrypt certificates")),(s=this.state.collectionsOptions)==null?void 0:s.map(i=>n().createElement(o.MenuItem,{key:i,value:i},i))),this.props.schema.help?n().createElement(o.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const re=U,X={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:E=>({color:E.palette.mode==="dark"?"#e39191":"#b62020"}),okTitle:E=>({color:E.palette.mode==="dark"?"#6fd56f":"#007c00"}),errorText:E=>({color:E.palette.mode==="dark"?"#e39191":"#b62020",mb:"30px"})};class ae extends f{componentDidMount(){super.componentDidMount(),this.setState({_error:"",running:!1,showLicenseData:null,foundSuitableLicense:!1,licenseOfflineCheck:!1,result:null,allLicenses:null,askForUpdate:!1,showLinkToProfile:!1})}renderErrorDialog(){if(this.state._error&&!this.state.showLicenseData){let c=this.state._error;return this.state.allLicenses&&(c=[n().createElement("div",{key:"error"},c)],c.push(n().createElement(o.Button,{key:"button",variant:"contained",onClick:()=>window.open("https://iobroker.net/www/account/licenses","_blank")},a.I18n.t("iobroker.net"))),this.state.allLicenses.length?c.push(n().createElement(o.TableContainer,{key:"table"},n().createElement(o.Table,{size:"small"},n().createElement(o.TableHead,null,n().createElement(o.TableRow,null,n().createElement(o.TableCell,null,a.I18n.t("ra_Product")),n().createElement(o.TableCell,null,a.I18n.t("ra_Version")),n().createElement(o.TableCell,null,"UUID"),n().createElement(o.TableCell,null,a.I18n.t("ra_ValidTill")),n().createElement(o.TableCell,null,a.I18n.t("ra_Commercial")),n().createElement(o.TableCell,null,"ID"))),n().createElement(o.TableBody,null,this.state.allLicenses.map(e=>n().createElement(o.TableRow,{key:e.id},n().createElement(o.TableCell,{sx:e.validName?null:X.errorText},e.license.product),n().createElement(o.TableCell,{sx:e.validVersion?null:X.errorText},e.license.version),n().createElement(o.TableCell,{sx:e.validUuid?null:X.errorText},e.license.uuid||"--"),n().createElement(o.TableCell,{sx:e.validTill?null:X.errorText},e.license.validTill&&e.license.validTill!=="0000-00-00 00:00:00"?new Date(e.license.validTill).toLocaleDateString():"--"),n().createElement(o.TableCell,null,e.license.invoice!=="free"?e.license.invoice==="MANUALLY_CREATED"?"\u2713":e.license.invoice:"-"),n().createElement(o.TableCell,null,e.id))))))):(c.push(n().createElement("div",{key:"text1"},a.I18n.t("ra_No one license found in license manager"))),c.push(n().createElement("div",{key:"text2"},a.I18n.t("ra_Please create license"))))),n().createElement(o.Dialog,{open:!0,maxWidth:"xl",fullWidth:this.props.fullWidth!==void 0?this.props.fullWidth:!0,onClick:()=>this.setState({_error:"",allLicenses:null})},n().createElement(o.DialogTitle,null,a.I18n.t("ra_Error")),n().createElement(o.DialogContent,null,n().createElement(o.DialogContentText,null,c)),n().createElement(o.DialogActions,null,n().createElement(o.Button,{variant:"contained",onClick:()=>this.setState({_error:"",allLicenses:null}),color:"primary",autoFocus:!0,startIcon:n().createElement(u.Check,null)},a.I18n.t("ra_Ok"))))}return null}renderMessageDialog(){if(this.state.showLicenseData){const c=[],e=this.state.showLicenseData;return Object.keys(e).forEach(t=>{if(!(e[t]===null||e[t]===void 0))if(typeof e[t]=="object"){const s=e[t];Object.keys(s).forEach(i=>{s[i]!==null&&s[i]!==void 0&&(typeof s[i]=="object"?c.push(n().createElement("div",{key:i},n().createElement("div",{style:X.licLabel},i,":"),JSON.stringify(s[i],null,2))):c.push(n().createElement("div",{key:i},n().createElement("div",{style:X.licLabel},t," -",i,":"),s[i].toString())))})}else c.push(n().createElement("div",{key:t},n().createElement("div",{style:X.licLabel},t.replace(/_/g," "),":"),e[t].toString()))}),c.push(n().createElement("div",{key:"checked"},n().createElement("div",{style:X.licLabel},a.I18n.t("ra_Checked"),":"),this.state.licenseOfflineCheck?a.I18n.t("ra_locally"):a.I18n.t("ra_via internet"))),n().createElement(o.Dialog,{open:!0,onClose:()=>this.setState({showLicenseData:null})},n().createElement(o.DialogTitle,null,n().createElement(o.Box,{component:"span",sx:this.state.result?X.okTitle:X.errorTitle},a.I18n.t("ra_License %s",this.state.result?"OK":"INVALID"))),n().createElement(o.DialogContent,null,this.state.showLinkToProfile?n().createElement(o.Button,{variant:"contained",onClick:()=>window.open("https://iobroker.net/www/account/licenses","_blank")},"https://iobroker.net"):null,this.state._error?n().createElement(o.Box,{component:"div",sx:X.errorText},this.state._error):null,c),n().createElement(o.DialogActions,null,n().createElement(o.Button,{onClick:()=>this.setState({showLicenseData:null,_error:""}),color:"primary",variant:"contained"},a.I18n.t("ra_Close"))))}return null}static parseJwt(c){const t=c.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),s=decodeURIComponent(atob(t).split("").map(i=>`%${`00${i.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));try{return JSON.parse(s)}catch(i){return null}}static isVersionValid(c,e,t,s){if(!e||!c)return!0;let i=!0;const[r]=c.split(".");return e.startsWith(">=")?i=parseInt(r,10)>=parseInt(e.substring(2,10)):e.startsWith("<=")?i=parseInt(r,10)<=parseInt(e.substring(2,10)):e.startsWith(">")?i=parseInt(r,10)>parseInt(e.substring(1,10)):e.startsWith("<")?i=parseInt(r,10)<parseInt(e.substring(1,10)):e.startsWith("=")?i=parseInt(r,10)===parseInt(e.substring(1,10)):e.startsWith("==")?i=parseInt(r,10)===parseInt(e.substring(2,10)):e.startsWith("===")&&(i=parseInt(r,10)===parseInt(e.substring(3,10))),!0}findInLicenseManager(c){return pe(this,null,function*(){var s,i,r,l;const e=yield this.props.oContext.socket.getObject("system.licenses"),t=[];if((i=(s=e==null?void 0:e.native)==null?void 0:s.licenses)!=null&&i.length){let h=null;const S=Date.now();let L;if(this.props.schema.uuid){const N=yield this.props.oContext.socket.getObject("system.meta.uuid");L=(r=N==null?void 0:N.native)==null?void 0:r.uuid}let O;if(this.props.schema.version){const N=yield this.props.oContext.socket.getObject(`system.adapter.${c}`);O=(l=N==null?void 0:N.common)==null?void 0:l.version}e.native.licenses.forEach(N=>{const te=!N.validTill||N.validTill==="0000-00-00 00:00:00"||new Date(N.validTill).getTime()>S,ye=(N.product||"").split("."),se=ye[1]===c||c==="vis-2"&&ye[1]==="vis",Ee=!L||!N.uuid||N.uuid===L,me=ae.isVersionValid(O,N.version,N.invoice,c);(!h||N.invoice!=="free")&&te&&se&&Ee&&me&&(h=N),t.push({id:N.id,validName:se,validUuid:Ee,validVersion:me,validTill:te,license:N})}),h&&(t.find(N=>N.id===h.id).used=!0)}return t})}checkLicense(c,e){return pe(this,null,function*(){var l,h,S;let t;if(this.props.schema.uuid){const L=yield this.props.oContext.socket.getObject("system.meta.uuid");t=(l=L==null?void 0:L.native)==null?void 0:l.uuid}let s;if(this.props.schema.version){const L=yield this.props.oContext.socket.getObject(`system.adapter.${e}`);s=(h=L==null?void 0:L.common)==null?void 0:h.version}const i=new AbortController;let r=setTimeout(()=>{r=null,i.abort()},5e3);try{const L=yield window.fetch("https://iobroker.net/api/v1/public/cert/",{method:"POST",body:JSON.stringify({json:c,uuid:t}),headers:{"Content-Type":"text/plain"},signal:i.signal});r&&clearTimeout(r);const O=yield L.text();let N;try{N=JSON.parse(O)}catch(te){}if(N!=null&&N.error)try{const te=ae.parseJwt(c),ye=a.I18n.t(`ra_${te.error||N.error||"Unknown error"}`).replace(/^ra_/,"");return this.setState({_error:ye,licenseOfflineCheck:!1,showLicenseData:te,result:!1,running:!1})}catch(te){return console.log("Cannot parse license"),this.setState({_error:N.error,result:!1,running:!1})}else{let te=null;try{te=ae.parseJwt(c)}catch(ye){}if(N){const ye=N.validTill||N.valid_till;if(ye&&ye!=="0000-00-00 00:00:00"&&new Date(ye).getTime()<Date.now())return this.setState({_error:a.I18n.t("ra_License expired on %s",new Date(ye).toLocaleString()),licenseOfflineCheck:!1,showLicenseData:te,result:!1,running:!1});const se=(N.name||"").split(".");return se[1]===e||se[1]==="vis"&&e==="vis-2"?t&&!N.uuid&&e==="vis-2"?this.setState({_error:a.I18n.t("ra_License must be converted",N.uuid),showLinkToProfile:!0,licenseOfflineCheck:!1,showLicenseData:te,result:!1,running:!1}):t&&N.uuid&&N.uuid!==t?this.setState({_error:a.I18n.t('ra_Serial number (UUID) "%s" in license is for other device.',N.uuid),licenseOfflineCheck:!1,showLicenseData:te,result:!1,running:!1}):ae.isVersionValid(s,N.version,N.invoice,e)?this.setState({licenseOfflineCheck:!1,showLicenseData:te,result:!0,running:!1}):this.setState({_error:a.I18n.t("ra_License is for version %s, but required version is %s",N.version,this.props.schema.version),licenseOfflineCheck:!1,showLicenseData:te,result:!1,running:!1}):this.setState({_error:a.I18n.t('ra_License for other product "%s"',N.name),licenseOfflineCheck:!1,showLicenseData:te,result:!1,running:!1})}throw new Error("ra_Invalid answer from server")}}catch(L){if(((S=L==null?void 0:L.response)==null?void 0:S.status)===404)return this.setState({_error:a.I18n.t("ra_License does not exist"),result:!1,running:!1});try{const O=ae.parseJwt(c),N=(O.name||"").split(".");return O.valid_till&&O.valid_till!=="0000-00-00 00:00:00"&&new Date(O.valid_till).getTime()<Date.now()?this.setState({_error:a.I18n.t("ra_License expired on %s",new Date(O.valid_till).toLocaleString()),showLicenseData:O,licenseOfflineCheck:!0,running:!1,result:!1}):N[1]===e?t&&O.uuid&&O.uuid!==t?this.setState({_error:a.I18n.t('ra_Serial number (UUID) "%s" in license is for other device.',O.uuid),showLicenseData:O,licenseOfflineCheck:!0,result:!1,running:!1}):ae.isVersionValid(s,O.version,O.invoice,e)?this.setState({running:!1,result:!0,licenseOfflineCheck:!0,showLicenseData:O}):this.setState({_error:a.I18n.t("ra_License is for version %s, but required version is %s",O.version,this.props.schema.version),licenseOfflineCheck:!0,showLicenseData:O,result:!1,running:!1}):this.setState({_error:a.I18n.t('ra_License for other product "%s"',O.name),licenseOfflineCheck:!0,showLicenseData:O,result:!1,running:!1})}catch(O){return this.setState({_error:a.I18n.t("ra_Cannot decode license"),result:!1,licenseOfflineCheck:!0,running:!1})}}})}renderAskForUpdate(){return this.state.askForUpdate?n().createElement(a.DialogConfirm,{text:a.I18n.t("ra_License not found in license manager. Do you want to read licenses from iobroker.net?"),ok:a.I18n.t("ra_Yes"),onClose:c=>pe(this,null,function*(){if(c){this.setState({askForUpdate:!1});try{yield this.props.oContext.socket.updateLicenses(null,null)}catch(e){window.alert(a.I18n.t("ra_Cannot read licenses: %s",e));return}yield this._onClick(!0)}else this.setState({askForUpdate:!1,running:!1})})}):null}_onClick(c){return pe(this,null,function*(){const e=this.props.oContext.adapterName==="vis-2"?"vis":this.props.oContext.adapterName;this.setState({running:!0});let t,s;if(this.props.data.useLicenseManager){if(s=yield this.findInLicenseManager(e),t=s.find(i=>i.used),t&&(t=t.license.json),!t&&!c){this.setState({askForUpdate:!0});return}}else t=this.props.data.license;t?yield this.checkLicense(t,e):this.props.data.useLicenseManager?this.setState({_error:a.I18n.t("ra_Suitable license not found in license manager"),result:!1,running:!1,allLicenses:s}):this.setState({_error:a.I18n.t("ra_Please enter the license"),result:!1,running:!1})})}renderItem(){return n().createElement("div",{style:X.fullWidth},n().createElement(o.Button,{variant:this.props.schema.variant||"outlined",color:this.props.schema.color||"primary",style:X.fullWidth,disabled:!this.props.data.license&&!this.props.data.useLicenseManager||this.state.running,startIcon:n().createElement(u.Send,null),onClick:()=>this._onClick()},this.state.running?n().createElement(o.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 ce=ae;class W extends f{renderItem(c,e){const t=f.getValue(this.props.data,this.props.attr),s=Array.isArray(t);return n().createElement(o.FormControl,{style:{width:"100%"},variant:"standard"},n().createElement(o.FormControlLabel,{onClick:i=>{if(i.preventDefault(),i.stopPropagation(),!e){const r=this.onChange(this.props.attr,!t);r instanceof Promise&&r.catch(l=>console.error(`Cannot set value: ${l}`))}},control:n().createElement(o.Checkbox,{indeterminate:s,checked:!!t,onChange:i=>{let r;s?r=this.onChange(this.props.attr,!0):r=this.onChange(this.props.attr,i.target.checked),r instanceof Promise&&r.catch(l=>console.error(`Cannot set value: ${l}`))},disabled:e||this.props.schema.readOnly}),label:this.getText(this.props.schema.label)}),n().createElement(o.FormHelperText,{style:{color:"red"}},c?this.props.schema.validatorErrorText?a.I18n.t(this.props.schema.validatorErrorText):a.I18n.t("ra_Error"):null),this.props.schema.help?n().createElement(o.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const K=W;var z=Y(23479),G=Y.n(z),Ve=Y(98625),ge=Y(34603);const _e={standard:o.Input,filled:Ve.A,outlined:o.OutlinedInput},ze=E=>{const c=E.palette.mode==="light",e=c?"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 ${E.palette.primary[c?"dark":"light"]}`,left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:E.transitions.create("transform",{duration:E.transitions.duration.shorter,easing:E.transitions.easing.easeOut}),pointerEvents:"none"},"&$focused:after":{transform:"scaleX(1)"},"&$error:after":{borderBottomColor:E.palette.error.main,transform:"scaleX(1)"},"&:before":{borderBottom:`1px solid ${e}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:E.transitions.create("border-bottom-color",{duration:E.transitions.duration.shorter}),pointerEvents:"none"},"&:hover:not($disabled):not($focused):not($error):before":{borderBottom:`2px solid ${E.palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${e}`}},"&$disabled:before":{borderBottomStyle:"dotted"}},error:{"&:after":{backgroundColor:E.palette.error.main,transform:"scaleX(1)"}},chip:{margin:"0 8px 8px 0",float:"left"},marginDense:{}}},xe={BACKSPACE:8,DELETE:46,LEFT_ARROW:37,RIGHT_ARROW:39},at=({value:E,isFocused:c,isDisabled:e,isReadOnly:t,handleClick:s,handleDelete:i,style:r},l)=>n().createElement(o.Chip,{key:l,style:Be(q({},r),{pointerEvents:e||t?"none":void 0,backgroundColor:c?ge.A[300]:void 0}),onClick:s,onDelete:i,label:E});class lt extends n().Component{constructor(e){super(e);Q(this,"labelRef");Q(this,"labelNode",null);Q(this,"input");Q(this,"newChipKeyCodes");Q(this,"newChipKeys");Q(this,"actualInput",null);Q(this,"inputBlurTimeout",null);Q(this,"_keyPressed");Q(this,"_preventChipCreation");Q(this,"styles",{});Q(this,"styleTheme",null);Q(this,"focus",()=>{var e;(e=this.actualInput)==null||e.focus(),this.state.focusedChip&&this.setState({focusedChip:null})});Q(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 s;switch(this.props.blurBehavior||"clear"){case"add-or-clear":s={clearInputOnFail:!0};case"add":if(this.props.delayBeforeAdd){const i=(this.props.value||this.state.chips).length;this.inputBlurTimeout=setTimeout(()=>{const r=(this.props.value||this.state.chips).length;i===r?this.handleAddChip(t,s):this.clearInput()},150)}else this.handleAddChip(t,s);break;case"clear":this.clearInput();break;default:break}});Q(this,"handleInputFocus",e=>{this.setState({isFocused:!0}),this.props.onFocus&&this.props.onFocus(e)});Q(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 s=this.props.value||this.state.chips;if(this.newChipKeyCodes.includes(e.keyCode)||this.newChipKeys.includes(e.key)){this.handleAddChip(e.target.value)!==!1&&e.preventDefault();return}switch(e.keyCode){case xe.BACKSPACE:e.target.value===""&&(t?(this.handleDeleteChip(s[t],t),t&&this.setState({focusedChip:t-1})):this.setState({focusedChip:s.length-1}));break;case xe.DELETE:e.target.value===""&&t&&(this.handleDeleteChip(s[t],t),t<=s.length-1&&this.setState({focusedChip:t}));break;case xe.LEFT_ARROW:t===null&&e.target.value===""&&s.length?this.setState({focusedChip:s.length-1}):t!==null&&t>0&&this.setState({focusedChip:t-1});break;case xe.RIGHT_ARROW:t!==null&&t<s.length-1?this.setState({focusedChip:t+1}):this.setState({focusedChip:null});break;default:this.setState({focusedChip:null});break}});Q(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)});Q(this,"handleUpdateInput",e=>{(this.props.inputValue===null||this.props.inputValue===void 0)&&this.updateInput(e.target.value),this.props.onUpdateInput&&this.props.onUpdateInput(e)});Q(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=n().createRef(),this.input=n().createRef()}componentDidMount(){this.state.variant==="outlined"&&(this.labelNode=G().findDOMNode(this.labelRef.current),this.forceUpdate())}componentWillUnmount(){this.inputBlurTimeout&&clearTimeout(this.inputBlurTimeout)}static getDerivedStateFromProps(e,t){let s=null;return e.value&&e.value.length!==t.prevPropsValue.length&&(s={prevPropsValue:e.value},e.clearInputValueOnChange&&(s.inputValue="")),e.clearInputValueOnChange&&e.value&&e.value.length!==t.prevPropsValue.length&&(s={prevPropsValue:e.value,inputValue:""}),e.disabled&&(s=Be(q({},s),{focusedChip:null})),!t.chipsUpdated&&e.defaultValue&&(s=Be(q({},s),{chips:e.defaultValue})),s}handleAddChip(e,t){if(this.props.onBeforeAdd&&!this.props.onBeforeAdd(e))return this._preventChipCreation=!0,t&&t.clearInputOnFail&&this.clearInput(),!1;this.clearInput();const s=this.props.value||this.state.chips;return e.trim().length?((this.props.allowDuplicates||!s.includes(e))&&(this.props.value&&this.props.onAdd?this.props.onAdd(e):this.updateChips([...this.state.chips,e])),!0):!1}handleDeleteChip(e,t){if(this.props.value)this.props.onDelete&&this.props.onDelete(e,t);else{const s=this.state.chips.slice();if(s.splice(t,1)){let r=this.state.focusedChip;this.state.focusedChip===t?r=null:this.state.focusedChip>t&&(r=this.state.focusedChip-1),this.updateChips(s,{focusedChip:r})}}}updateChips(e,t={}){this.setState(q({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=at,className:s,disabled:i,disableUnderline:r,error:l,FormHelperTextProps:h,fullWidth:S,fullWidthInput:L,helperText:O,id:N,InputProps:te={},InputLabelProps:ye={},inputValue:se,label:Ee,placeholder:me,readOnly:Me,required:yt,rootRef:Jt,value:pn,margin:_n}=this.props,tt=this.state.variant;this.styleTheme!==this.props.theme.palette.mode&&(this.styleTheme=this.props.theme.palette.mode,this.styles=a.Utils.getStyle(this.props.theme,ze));let Tt=pn||this.state.chips||[];Array.isArray(Tt)||(Tt=(Tt||"").toString().split(/[,\s]+/).map(qt=>qt.trim()));const dn=se!=null?se:this.state.inputValue,kn=(this.props.value||dn).length||dn.length,Ht=typeof ye.shrink=="boolean"?ye.shrink:Ee!==null&&(kn||this.state.isFocused||Tt.length),Bn=Tt.map((qt,Kt)=>t({value:qt,isDisabled:!!i,isReadOnly:Me,isFocused:this.state.focusedChip===Kt,handleClick:()=>this.setState({focusedChip:Kt}),handleDelete:()=>this.handleDeleteChip(qt,Kt),style:this.styles.chip},Kt.toString())),zt={};tt==="outlined"&&(zt.notched=!!Ht,zt.labelWidth=Ht&&this.labelNode&&this.labelNode.offsetWidth||0),tt!=="standard"?zt.startAdornment=Bn:te.disableUnderline=!0;const js=_e[tt];return n().createElement(o.FormControl,{ref:Jt,fullWidth:S,className:s,sx:q(q({},this.styles.root),_n==="dense"?this.styles.marginDense:{}),error:l,required:Tt.length>0?void 0:yt,onClick:this.focus,disabled:i,variant:tt,component:"div",margin:_n},Ee&&n().createElement(o.InputLabel,q({htmlFor:N,sx:{"&.MuiInputLabel-root":this.styles.label,"&.MuiInputLabel-shrink":this.styles.labelShrink},shrink:!!Ht,focused:this.state.isFocused,variant:tt,ref:this.labelRef,required:yt,component:"label"},ye),Ee),n().createElement(o.Box,{component:"div",id:"input-chip-container",sx:q(q(q(q(q(q(q({},this.styles[tt]),this.styles.chipContainer),this.state.isFocused?this.styles.focused:void 0),!r&&tt==="standard"?this.styles.underline:void 0),i?this.styles.disabled:void 0),Ee?this.styles.labeled:void 0),l?this.styles.error:void 0)},tt==="standard"&&Bn,n().createElement(js,q(q({ref:this.input,className:`mui-variant-${this.styles[tt]} ${Ee?"mui-chip-with-label":"mui-chip-no-label"}`,sx:{"&.MuiInputBase-input":q(q({},this.styles.input),this.styles[tt]),"&.MuiInputBase-root":q({},this.styles.inputRoot)},id:N,value:dn,onChange:this.handleUpdateInput,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onFocus:this.handleInputFocus,onBlur:this.handleInputBlur,inputRef:this.setActualInputRef,disabled:i,fullWidth:L,placeholder:!kn&&(Ht||Ee===null||Ee===void 0)||e?me:null,readOnly:Me},te),zt))),O&&n().createElement(o.FormHelperText,Be(q({},h),{className:h==null?void 0:h.className,style:this.styles.helperText}),O))}}const mt=lt;class Ie extends f{componentDidMount(){super.componentDidMount();const{data:c,attr:e}=this.props,t=f.getValue(c,e);if(this.props.schema.delimiter&&typeof t=="string"){const s=t.split(this.props.schema.delimiter).map(i=>i.trim()).filter(i=>i);this.setState({value:s})}else this.setState({value:t||[]})}renderItem(c,e){const{attr:t,schema:s}=this.props,{value:i}=this.state;return n().createElement(o.FormControl,{fullWidth:!0,variant:"standard"},n().createElement(mt,{value:i,disabled:!!e,label:this.getText(s.label),error:!!c,onAdd:r=>{const l=JSON.parse(JSON.stringify(i));l.push(r),this.setState({value:l},()=>{let h;this.props.schema.delimiter?h=this.onChange(t,l.join(`${this.props.schema.delimiter} `)):h=this.onChange(t,l),h instanceof Promise&&h.catch(S=>console.error(S))})},theme:this.props.oContext.theme,onDelete:(r,l)=>{const h=JSON.parse(JSON.stringify(i));h.splice(l,1),this.setState({value:h},()=>{let S;this.props.schema.delimiter?S=this.onChange(t,h.join(`${this.props.schema.delimiter} `)):S=this.onChange(t,h),S instanceof Promise&&S.catch(L=>console.error(L))})}}),n().createElement(o.FormHelperText,null,a.I18n.t("ra_Press ENTER Key to add new item")),this.props.schema.help?n().createElement(o.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Et=Ie;var Ne=Y(55385);class Ge extends f{renderColorDialog(){return!!this.state.showColorDialog&&n().createElement(o.Dialog,{onClose:()=>this.setState({showColorDialog:!1}),open:this.state.showColorDialog},n().createElement(Ne.xk,{color:this.state.colorDialogValue,onChange:c=>this.setState({colorDialogValue:c.hex},()=>this.onChange(this.props.attr,this.state.colorDialogValue))}))}renderItem(c,e){const t=f.getValue(this.props.data,this.props.attr);let s=a.Utils.isUseBright(t,null);return s===null&&(s=void 0),n().createElement(n().Fragment,null,this.renderColorDialog(),n().createElement(o.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:i=>{const r=i.target.value,l=this.onChange(this.props.attr,r);l instanceof Promise&&l.catch(h=>console.error(`Cannot set value: ${h}`))},slotProps:{htmlInput:{style:{backgroundColor:t,color:s?"#FFF":"#000"},readOnly:this.props.schema.readOnly||!1},input:{endAdornment:!this.props.schema.readOnly&&t&&!this.props.schema.noClearButton?n().createElement(o.IconButton,{size:"small",onClick:i=>{i.stopPropagation();const r=this.onChange(this.props.attr,"");r instanceof Promise&&r.catch(l=>console.error(`Cannot set value: ${l}`))}},n().createElement(u.Close,null)):void 0},inputLabel:{shrink:!0}}}))}}const bt=Ge,qe={width:{width:"calc(100% - 85px)"},width50:{width:120,marginRight:5}};class je extends f{componentDidMount(){super.componentDidMount();const c=f.getValue(this.props.data,this.props.attr);this.setState({value:c});const e={};this.props.schema.useSystemName&&(e.useSystem=!!f.getValue(this.props.data,this.props.schema.useSystemName)),this.props.schema.longitudeName&&this.props.schema.latitudeName?(e.longitude=f.getValue(this.props.data,this.props.schema.longitudeName),e.latitude=f.getValue(this.props.data,this.props.schema.latitudeName),!e.longitude&&!e.latitude&&this.props.schema.autoInit&&setTimeout(()=>this.getCoordinates(),300)):!f.getValue(this.props.data,this.props.attr)&&this.props.schema.autoInit&&setTimeout(()=>this.getCoordinates(),300),Object.keys(e).length&&setTimeout(()=>this.setState(e),50)}getSystemCoordinates(){return pe(this,null,function*(){const c=yield this.props.oContext.socket.getCompactSystemConfig();if(c!=null&&c.common&&(c.common.longitude||c.common.latitude))if(window.alert(a.I18n.t("ra_Used system settings")),this.props.schema.longitudeName&&this.props.schema.latitudeName)this.setState({longitude:c.common.longitude,latitude:c.common.latitude},()=>pe(this,null,function*(){yield this.onChange(this.props.schema.longitudeName,c.common.longitude),yield this.onChange(this.props.schema.latitudeName,c.common.latitude)}));else{const e=c.common.latitude+(this.props.schema.divider||",")+c.common.longitude;this.setState({value:e},()=>{const t=this.onChange(this.props.attr,e);t instanceof Promise&&t.catch(s=>console.error(`Cannot set value: ${s}`))})}else window.alert(a.I18n.t("ra_Cannot determine position: System settings are empty and GPS detection is disabled in browser"))})}getCoordinates(){navigator.geolocation?navigator.geolocation.getCurrentPosition(c=>pe(this,null,function*(){if(c!=null&&c.coords)if(this.props.schema.longitudeName&&this.props.schema.latitudeName)this.setState({longitude:c.coords.longitude,latitude:c.coords.latitude},()=>pe(this,null,function*(){yield this.onChange(this.props.schema.longitudeName,c.coords.longitude||""),yield this.onChange(this.props.schema.latitudeName,c.coords.latitude||"")}));else{const e=c.coords.latitude+(this.props.schema.divider||",")+c.coords.longitude;this.setState({value:e},()=>{const t=this.onChange(this.props.attr,e);t instanceof Promise&&t.catch(s=>console.error(`Cannot set value: ${s}`))})}else yield this.getSystemCoordinates()}),c=>pe(this,null,function*(){console.error(`Cannot determine coordinates from browser: ${c.message}`),yield this.getSystemCoordinates()})):this.getSystemCoordinates().catch(c=>{console.error(`Cannot determine coordinates: ${c}`)})}renderItem(c,e){var t,s;return n().createElement(n().Fragment,null,this.props.schema.useSystemName?n().createElement(o.FormControlLabel,{control:n().createElement(o.Checkbox,{checked:!!this.state.useSystem,onChange:i=>{const r=i.target.checked;r&&this.getSystemCoordinates().catch(l=>console.error(`Cannot determine coordinates: ${l}`)),this.setState({useSystem:r},()=>this.onChange(this.props.schema.useSystemName,r))}}),label:a.I18n.t("ra_Use system settings for position")}):null,this.props.schema.longitudeName&&this.props.schema.latitudeName?n().createElement(o.TextField,{variant:"standard",style:qe.width50,value:(t=this.state.longitude)!=null?t:"",error:!!c,disabled:this.state.useSystem||!!e,onChange:i=>{const r=i.target.value;this.setState({longitude:r},()=>{const l=this.onChange(this.props.schema.longitudeName,(r||"").trim());l instanceof Promise&&l.catch(h=>console.error(`Cannot set value: ${h}`))})},label:a.I18n.t("ra_Longitude")}):null,this.props.schema.longitudeName&&this.props.schema.latitudeName?n().createElement(o.TextField,{variant:"standard",style:qe.width50,value:(s=this.state.latitude)!=null?s:"",error:!!c,disabled:this.state.useSystem||!!e,onChange:i=>{const r=i.target.value;this.setState({latitude:r},()=>this.onChange(this.props.schema.latitudeName,(r||"").trim()))},label:a.I18n.t("ra_Latitude")}):null,!this.props.schema.longitudeName||!this.props.schema.latitudeName?n().createElement(o.TextField,{variant:"standard",style:qe.width,value:this.state.value===null||this.state.value===void 0?"":this.state.value,error:!!c,disabled:!!e,slotProps:{htmlInput:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0,readOnly:this.state.useSystem}},onChange:i=>{const r=i.target.value;this.setState({value:r},()=>this.onChange(this.props.attr,(r||"").trim()))},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)}):null,this.state.useSystem?null:n().createElement(o.Fab,{size:"small",onClick:()=>this.getCoordinates(),title:a.I18n.t("ra_Take browser position"),style:{marginRight:4}},n().createElement(u.LocationOn,null)),this.state.useSystem?null:n().createElement(o.Fab,{size:"small",onClick:()=>this.getSystemCoordinates(),title:a.I18n.t("ra_Take position from system settings")},n().createElement(u.GpsFixed,null)))}}const ke=je,It=(E,c,e)=>new Promise((t,s)=>{if(window[E])t(window[E]);else{const i=document.querySelector(`script[data-webpack="${E}"]`),r=()=>pe(this,null,function*(){if(window[E])window[E].__initialized||(yield window[E].init(Y.S[c]),window[E].__initialized=!0);else{console.error(`Cannot load ${E}`),s(new Error(`Cannot load ${E}`));return}t(window[E])});if(i)i.onload=r,i.onerror=s;else if(e){const l=document,h=l.createElement("script");h.type="text/javascript",h.setAttribute("data-webpack",`${E}`),h.async=!0,h.onerror=s,h.onload=r,h.src=e,l.getElementsByTagName("head")[0].appendChild(h)}else s(new Error(`Cannot Find Remote ${E} to inject`))}});function ft(E,c,e,t){return()=>pe(this,null,function*(){return(yield(yield It(E,c,t)).get(e))()})}const Lt=class Lt extends f{constructor(c){super(c),Object.assign(this.state,{Component:null,error:""})}componentDidMount(){return pe(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 c;this.props.schema.url.startsWith("./")?c=`${window.location.protocol}//${window.location.host}${this.props.schema.url.replace(/^\./,"")}`:c=`${window.location.protocol}//${window.location.host}/adapter/${this.props.oContext.adapterName}/${this.props.schema.url}`;const[e,t,...s]=this.props.schema.name.split("/"),i=s.join("/");if(!c){console.error('Cannot find URL for custom component! Please define "url" as "custom/customComponents.js" in the schema');return}if(!e||!t||!i){console.error('Invalid format of "name"! Please define "name" as "ConfigCustomBackItUpSet/Components/AdapterExist" in the schema');return}let r=Lt.runningLoads[`${c}!${t}`];if(!(r instanceof Promise)){let l;if(this.props.schema.i18n===!0){const h=c.lastIndexOf("/");let S;h!==-1?S=c.substring(0,h):S=c;const L=a.I18n.getLanguage(),O=`${S}/i18n/${L}.json`;l=fetch(O).then(N=>N.json()).then(N=>a.I18n.extendTranslations(N,L)).catch(N=>{if(L!=="en"){fetch(`${S}/i18n/en.json`).then(te=>te.json()).then(te=>a.I18n.extendTranslations(te,L)).catch(te=>console.log(`Cannot load i18n "${O}": ${te}`));return}console.log(`Cannot load i18n "${O}": ${N}`)})}else if(this.props.schema.i18n&&typeof this.props.schema.i18n=="object")try{a.I18n.extendTranslations(this.props.schema.i18n)}catch(h){console.error(`Cannot import i18n: ${h}`)}try{console.log(e,t,i),r=ft(e,"default",`./${t}`,c)(),l instanceof Promise&&(r=Promise.all([r,l]).then(h=>h[0])),Lt.runningLoads[`${c}!${t}`]=r}catch(h){this.setState({error:`Cannot import from ${this.props.schema.url}: ${h}`})}}try{const l=(yield r).default;if(l!=null&&l[i])this.setState({Component:l[i]});else{const h=Object.keys(l||{});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: ${h.join(", ")}`})}}catch(l){this.setState({error:`Cannot import from ${this.props.schema.url}: ${l}`})}})}render(){const c=this.state.Component,e=this.props.schema||{};let t=c?n().createElement(c,Be(q({},this.props),{socket:this.props.oContext.socket,theme:this.props.oContext.theme,themeType:this.props.oContext.themeType,instance:this.props.oContext.instance,adapterName:this.props.oContext.adapterName,systemConfig:this.props.oContext.systemConfig,forceUpdate:this.props.oContext.forceUpdate})):this.state.error?n().createElement("div",null,this.state.error):n().createElement(o.LinearProgress,null);return(e.xs||e.sm||e.md||e.lg||e.xl)&&(t=n().createElement(o.Grid2,{size:{xs:e.xs||12,sm:e.sm||void 0,md:e.md||void 0,lg:e.lg||void 0,xl:e.xl||void 0},style:q(q({marginBottom:0,textAlign:"left"},e.style),this.props.oContext.themeType==="dark"?e.darkStyle:{})},t)),e.newLine?n().createElement(n().Fragment,null,n().createElement("div",{style:{flexBasis:"100%",height:0}}),t):t}};Q(Lt,"runningLoads",{});let xt=Lt;var wt=Y(28497);class fe extends f{componentDidMount(){super.componentDidMount();const c=f.getValue(this.props.data,this.props.attr);this.setState({value:c})}renderItem(c,e){return n().createElement(wt.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.oContext.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 de extends f{renderItem(){if(!this.props.schema)return null;if(this.props.oContext.DeviceManager){const e=this.props.oContext.DeviceManager;return n().createElement(e,{uploadImagesToInstance:`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,title:this.getText(this.props.schema.label),socket:this.props.oContext.socket,selectedInstance:`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,themeName:this.props.themeName,themeType:this.props.oContext.themeType,isFloatComma:this.props.oContext.isFloatComma,dateFormat:this.props.oContext.dateFormat})}return n().createElement("div",null,"DeviceManager not found")}}const gt=de;var Xe=Y(53683),De=Y.n(Xe);const Ue={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}},Ye=["jpg","jpeg","svg","png","webp","gif","apng","avif","webp"],J=["mp3","ogg","wav","aac"],$t=["avi","mp4","mov"],we=["txt","log","html","htm"],st=["json","js","ts"];class _t extends f{constructor(e){super(e);Q(this,"dropzoneRef");Q(this,"imagePrefix");Q(this,"objectID");Q(this,"path");this.dropzoneRef=n().createRef(),this.imagePrefix=this.props.oContext.imagePrefix===void 0?"./files":this.props.oContext.imagePrefix}componentDidMount(){super.componentDidMount(),this.objectID=(this.props.schema.objectID||"0_userdata.0").replace("%INSTANCE%",(this.props.oContext.instance||0).toString()),this.path=this.props.schema.upload,this.path&&(this.path==="/"?this.path="":this.path.endsWith("/")||(this.path=`${this.path}/`)),this.updateFiles().then(()=>{const e=f.getValue(this.props.data,this.props.attr);this.setState({value:e})})}updateFiles(){return this.readFiles(this.props.schema.pattern).then(e=>this.setState({files:e}))}readFolder(e,t,s){return pe(this,null,function*(){try{const i=yield this.props.oContext.socket.readDir(this.objectID,e.replace(/^\//,"")||null);for(let r=0;r<i.length;r++){const l=i[r];if(l.isDir)yield this.readFolder(`${e+l.file}/`,t,s);else{let h=!1;s==="*.*"&&l.file.includes(".")||!s||s==="*"||s===".*"&&l.file.startsWith(".")?h=!0:h=new RegExp(`^${s.replace(/\./g,"\\.").replace(/\*/g,".*")}$`).test(l.file),h&&t.push({name:e+l.file,size:l.stats?a.Utils.formatBytes(l.stats.size):"--"})}}}catch(i){console.error(`Cannot read "${e}": ${i}`)}return t})}readFiles(e){return pe(this,null,function*(){const t=[];e=e||this.props.schema.pattern,e||(e="**/*.*");let s;const i=e.lastIndexOf("/");if(i===-1?s=e:s=e.substring(i+1),e.startsWith("**"))yield this.readFolder("/",t,s);else{const r=e.lastIndexOf("/");if(r===-1)yield this.readFolder("/",t,s);else{const l=e.substring(0,r+1);yield this.readFolder(l,t,s)}}return t})}onDrop(e){const t=e[0],s=new FileReader,i=this.props.schema.maxSize||2*1024*1024;s.onabort=()=>console.log("file reading was aborted"),s.onerror=()=>console.log("file reading has failed"),s.onload=()=>{let r=`image/${t.name.split(".").pop().toLowerCase()}`;if(r==="image/jpg"?r="image/jpeg":r.includes("svg")&&(r="image/svg+xml"),t.size>i){window.alert(a.I18n.t("File is too big. Max %sk allowed. Try use SVG.",Math.round(i/1024)));return}const l=`data:${r};base64,${btoa(new Uint8Array(s.result).reduce((h,S)=>h+String.fromCharCode(S),""))}`;this.props.oContext.socket.writeFile64(this.objectID,this.path+t.name,l).then(()=>this.updateFiles()).catch(h=>window.alert(`Cannot upload file: ${h}`))},s.readAsArrayBuffer(t)}renderDeleteDialog(){return this.state.deleteFile?n().createElement(a.DialogConfirm,{title:a.I18n.t("ra_Are you sure?"),text:a.I18n.t("ra_File will be deleted"),ok:a.I18n.t("ra_Delete"),cancel:a.I18n.t("ra_Cancel"),onClose:e=>{const t=this.state.deleteFile;this.setState({deleteFile:""},()=>{e&&this.props.oContext.socket.deleteFile(this.objectID,t).then(()=>this.updateFiles()).catch(s=>window.alert(`Cannot delete file: ${s}`))})}}):null}static base64ToArrayBuffer(e){const t=window.atob(e),s=t.length,i=new Uint8Array(s);for(let r=0;r<s;r++)i[r]=t.charCodeAt(r);return i.buffer}loadFile(){return this.props.oContext.socket.readFile(this.objectID,this.state.value,!0)}play(){this.loadFile().then(e=>{if(typeof AudioContext!="undefined"){const t=new AudioContext,s=_t.base64ToArrayBuffer(e.file);t.decodeAudioData(s,i=>{const r=t.createBufferSource();r.buffer=i,r.connect(t.destination),r.start(0)},i=>window.alert(`Cannot play: ${i.message}`))}})}getFileIcon(e){return e!=null&&e.extension?Ye.includes(e.extension)?n().createElement("div",{style:Be(q({},Ue.selectedImage),{backgroundImage:`url(${this.imagePrefix}/${this.objectID}/${e.value})`,backgroundSize:"contain",backgroundRepeat:"no-repeat"})}):J.includes(e.extension)?n().createElement(u.MusicNote,null):we.includes(e.extension)?n().createElement(u.Article,null):$t.includes(e.extension)?n().createElement(u.Videocam,null):st.includes(e.extension)?n().createElement(u.Code,null):null:null}renderItem(e,t){if(!this.state.files)return null;const s=[];this.props.schema.withFolder||this.state.files.forEach(O=>{const N=O.name.lastIndexOf("/");if(N===-1)s.includes("/")||s.push("/");else{const te=O.name.substring(0,N+1);s.includes(te)||s.push(te)}});const i=this.state.files.map(O=>({value:O.name,label:!this.props.schema.withFolder&&s.length===1?`${O.name.substring(s[0].length)}`:`${O.name}${this.props.schema.noSize?"":`(${O.size})`}`,extension:O.name.toLowerCase().split(".").pop()}));this.props.schema.noNone||i.unshift({label:a.I18n.t("ra_none"),value:""});const r=i.find(O=>O.value===this.state.value);let l=0;this.props.schema.upload&&l++,this.props.schema.refresh&&l++;const h=this.state.value&&(this.state.value.endsWith(".mp3")||this.state.value.endsWith(".ogg")||this.state.value.endsWith(".wav"));h&&l++;const S=n().createElement("div",{style:Ue.fullWidth},n().createElement(o.FormControl,{variant:"standard",style:{width:`calc(100% - ${l*42}px)`}},this.props.schema.label?n().createElement(o.InputLabel,null,this.getText(this.props.schema.label)):null,n().createElement(o.Select,{variant:"standard",error:!!e,disabled:!!t,value:this.state.value||"_",renderValue:()=>n().createElement(n().Fragment,null,this.getFileIcon(r),n().createElement("span",null,(r==null?void 0:r.label)||"")),onChange:O=>{this.setState({value:O.target.value==="_"?"":O.target.value},()=>this.onChange(this.props.attr,this.state.value))}},i.map(O=>n().createElement(o.MenuItem,{key:O.value,value:O.value},n().createElement(o.ListItemIcon,null,this.getFileIcon(O)),n().createElement(o.ListItemText,null,O.label),this.props.schema.delete&&r.value?n().createElement(o.IconButton,{style:Ue.deleteButton,size:"small",onClick:()=>this.setState({deleteFile:r.value})},n().createElement(u.Delete,null)):null))),this.props.schema.help?n().createElement(o.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null),this.props.schema.refresh&&n().createElement(o.IconButton,{onClick:()=>this.updateFiles()},n().createElement(u.Refresh,null)),this.props.schema.upload&&n().createElement(o.IconButton,{onClick:()=>{var O;return(O=this.dropzoneRef.current)==null?void 0:O.open()}},n().createElement(u.UploadFile,null)),h&&n().createElement(o.IconButton,{style:{color:"#00FF00"},onClick:()=>this.play()},n().createElement(u.PlayArrow,null)));if(!this.props.schema.upload)return n().createElement(n().Fragment,null,S,this.renderDeleteDialog());let L={"*/*":[]};if(this.props.schema.fileTypes==="image"?L={"image/*":[".png",".jpg",".svg",".gif",".apng",".avif",".webp"]}:this.props.schema.fileTypes==="audio"?L={"audio/*":[".mp3",".ogg",".wav",".mp4"]}:this.props.schema.fileTypes==="text"&&(L={"text/plain":[".txt"]}),this.props.schema.pattern){const O=this.props.schema.pattern.split("/").pop().toLowerCase().replace(/.*\./,"");O==="png"||O==="jpg"||O==="svg"||O==="gif"||O==="apng"||O==="avif"||O==="webp"?L={"image/*":[".png",".jpg",".svg",".gif",".apng",".avif",".webp"]}:O==="mp3"||O==="ogg"||O==="wav"?L={"audio/*":[".mp3",".ogg",".wav",".mp4"]}:O==="ics"?L={"text/calendar":[".ics"]}:O==="txt"?L={"text/plain":[".txt"]}:O==="pem"?L={"text/plain":[".pem"]}:L={"*/*":[`.${O}`]}}return n().createElement(De(),{ref:this.dropzoneRef,multiple:!1,accept:L,noKeyboard:!0,noClick:!0,maxSize:this.props.schema.maxSize||2*1024*1024,onDragEnter:()=>{this.setState({uploadFile:"dragging"})},onDragLeave:()=>this.setState({uploadFile:!0}),onDrop:(O,N)=>{this.setState({uploadFile:!1}),O.length?this.onDrop(O):window.alert(N&&N[0]&&N[0].errors&&N[0].errors[0]&&N[0].errors[0].message||a.I18n.t("Cannot upload"))}},({getRootProps:O,getInputProps:N})=>n().createElement("div",q({style:q(q(q({},Ue.uploadDiv),this.state.uploadFile==="dragging"?Ue.uploadDivDragging:void 0),t?Ue.disabledOpacity:void 0)},O()),n().createElement("input",q({},N())),this.state.uploadFile==="dragging"?n().createElement("div",{style:q(q({},Ue.uploadCenterDiv),this.state.uploadError?Ue.error:void 0)},n().createElement("div",{style:Ue.uploadCenterTextAndIcon},n().createElement(u.UploadFile,{style:Ue.uploadCenterIcon}),n().createElement("div",{style:Ue.uploadCenterText},this.state.uploadFile==="dragging"?a.I18n.t("ra_Drop file here"):a.I18n.t("ra_Place your files here or click here to open the browse dialog")))):null,S,this.renderDeleteDialog()))}}const Nt=_t,ut={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}},Gt=["jpg","jpeg","svg","png","webp","gif","apng","avif","webp"],kt=["mp3","ogg","wav","aac"],At=["avi","mp4","mov"],Ae=["txt","log","html","htm"],it=["json","js","ts"];class Pt extends f{constructor(){super(...arguments);Q(this,"imagePrefix","../..")}componentDidMount(){super.componentDidMount();const e=f.getValue(this.props.data,this.props.attr);this.imagePrefix=this.props.oContext.imagePrefix===void 0?"./files":this.props.oContext.imagePrefix,this.setState({value:e!=null?e:""})}static getDerivedStateFromProps(e,t){const s=f.getValue(e.data,e.attr);return s==null||s.toString().trim()!==(t.value||"").toString().trim()?{value:s!=null?s:""}:null}loadFile(){const e=this.state.value.indexOf("/");if(e!==-1){const t=this.state.value.substring(0,e),s=this.state.value.substring(e+1);return this.props.oContext.socket.readFile(t,s,!0)}return Promise.resolve(null)}play(){this.loadFile().then(e=>{if(typeof AudioContext!="undefined"&&(e!=null&&e.file)){const t=new AudioContext,s=Nt.base64ToArrayBuffer(e.file);t.decodeAudioData(s,i=>{const r=t.createBufferSource();r.buffer=i,r.connect(t.destination),r.start(0)},i=>window.alert(`Cannot play: ${i.message}`))}})}getIcon(){const e=this.state.value.split(".").pop().toLowerCase();return Gt.includes(e)?n().createElement("div",{style:Be(q({},ut.selectedImage),{backgroundImage:`url(${this.imagePrefix}/${this.state.value})`,backgroundSize:"contain",backgroundRepeat:"no-repeat"})}):kt.includes(e)?n().createElement(o.IconButton,{style:{color:"#00FF00"},onClick:()=>this.play()},n().createElement(u.PlayArrow,null)):Ae.includes(e)?n().createElement(u.Article,null):At.includes(e)?n().createElement(u.Videocam,null):it.includes(e)?n().createElement(u.Code,null):null}renderFileBrowser(){return this.state.showFileBrowser?n().createElement(a.DialogSelectFile,{imagePrefix:this.props.oContext.imagePrefix,socket:this.props.oContext.socket,selected:this.state.value,onClose:()=>this.setState({showFileBrowser:!1}),onOk:e=>{const t=Array.isArray(e)?e[0]:e;this.setState({value:t},()=>this.onChange(this.props.attr,this.props.schema.trim===!1?t:(t||"").trim()))},selectOnlyFolders:this.props.schema.selectOnlyFolders,allowUpload:this.props.schema.allowUpload,allowDownload:this.props.schema.allowDownload,allowCreateFolder:this.props.schema.allowCreateFolder,allowView:this.props.schema.allowView,showToolbar:this.props.schema.showToolbar,limitPath:this.props.schema.limitPath,theme:this.props.oContext.theme}):null}renderItem(e,t){const s=this.getIcon();return n().createElement("div",{style:ut.fullWidth},s,n().createElement(o.TextField,{variant:"standard",style:s?ut.fullWidthIcon:ut.fullWidthOneButton,value:this.state.value===null||this.state.value===void 0?"":this.state.value,error:!!e,disabled:!!t,slotProps:{htmlInput:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0,readOnly:!!this.props.schema.disableEdit}},onChange:i=>{const r=i.target.value;this.setState({value:r},()=>this.onChange(this.props.attr,this.props.schema.trim===!1?r:(r||"").trim()))},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)}),n().createElement(o.Button,{disabled:t,variant:"outlined",onClick:()=>this.setState({showFileBrowser:!0})},"..."),this.renderFileBrowser())}}const Xt=Pt;class Rt extends f{componentDidMount(){super.componentDidMount();const c=f.getValue(this.props.data,this.props.attr);this.props.oContext.socket.getEnums("functions").then(e=>{const t=Object.keys(e).map(s=>({value:this.props.schema.short?s.replace("enum.functions.",""):s,label:this.getText(e[s].common.name),obj:e[s]}));this.props.schema.allowDeactivate!==!1&&t.unshift({label:a.I18n.t(f.NONE_LABEL),value:f.NONE_VALUE}),this.setState({value:c,selectOptions:t})})}renderItem(c,e){if(!this.state.selectOptions)return null;const t=this.state.selectOptions.find(s=>s.value===this.state.value);return n().createElement(o.FormControl,{variant:"standard",fullWidth:!0},this.props.schema.label?n().createElement(o.InputLabel,null,this.getText(this.props.schema.label)):null,n().createElement(o.Select,{variant:"standard",error:!!c,disabled:!!e,value:this.state.value||"_",renderValue:()=>t?t.obj?n().createElement(a.TextWithIcon,{value:t.obj,themeType:this.props.oContext.themeType,lang:a.I18n.getLanguage()}):t.label:"",onChange:s=>{this.setState({value:s.target.value==="_"?"":s.target.value},()=>this.onChange(this.props.attr,this.state.value))}},this.state.selectOptions.map(s=>n().createElement(o.MenuItem,{key:s.value,value:s.value,style:s.value===f.DIFFERENT_VALUE?{opacity:.5}:{}},s.obj?n().createElement(a.TextWithIcon,{value:s.obj,themeType:this.props.oContext.themeType,lang:a.I18n.getLanguage()}):s.label))),this.props.schema.help?n().createElement(o.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Ft=Rt;class Yt extends f{componentDidMount(){super.componentDidMount(),this.props.oContext.socket.getHostByIp(this.props.common.host).then(c=>{this.props.schema.listenOnAllPorts||(c=c.filter(e=>e.address!=="0.0.0.0"&&e.address!=="::")),this.props.schema.onlyIp4?c=c.filter(e=>e.family==="ipv4"):this.props.schema.onlyIp6&&(c=c.filter(e=>e.family==="ipv6")),this.props.schema.noInternal&&(c=c.filter(e=>!e.internal)),c.forEach(e=>{e.address==="0.0.0.0"?e.name=`[IPv4] 0.0.0.0 - ${a.I18n.t("ra_Listen on all IPs")}`:e.address==="::"&&(e.name=`[IPv6] :: - ${a.I18n.t("ra_Listen on all IPs")}`)}),this.setState({ips:c})}).catch(c=>console.error(c))}renderItem(c,e){var i,r;const t=f.getValue(this.props.data,this.props.attr),s=(i=this.state.ips)==null?void 0:i.find(l=>l.address===t);return n().createElement(o.FormControl,{fullWidth:!0,variant:"standard"},this.state.ips&&this.props.schema.label?n().createElement(o.InputLabel,null,this.getText(this.props.schema.label)):null,this.state.ips?n().createElement(o.Select,{variant:"standard",error:!!c,disabled:!!e,value:t,renderValue:l=>(s==null?void 0:s.name)||l,onChange:l=>this.onChange(this.props.attr,l.target.value)},(r=this.state.ips)==null?void 0:r.map((l,h)=>n().createElement(o.MenuItem,{key:h,value:l.address},l.name))):n().createElement(o.TextField,{fullWidth:!0,variant:"standard",error:!!c,disabled:!!e,value:t,onChange:l=>this.onChange(this.props.attr,l.target.value),label:this.getText(this.props.schema.label)}),this.props.schema.help?n().createElement(o.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Zt=Yt;class Qt extends f{constructor(){super(...arguments);Q(this,"initialized",!1);Q(this,"localContext")}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,null,!0);if(t)try{e=JSON.parse(t)}catch(s){console.error(`Cannot parse json data: ${JSON.stringify(e)}`)}}e===void 0&&(e=null),this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",e).then(t=>this.setState({image:t||""}))}}getContext(){const e={};return Array.isArray(this.props.schema.alsoDependsOn)&&this.props.schema.alsoDependsOn.forEach(t=>e[t]=f.getValue(this.props.data,t)),JSON.stringify(e)}renderItem(){if(this.props.alive){const e=this.getContext();(e!==this.localContext||!this.initialized)&&(this.localContext=e,setTimeout(()=>this.askInstance(),this.initialized?300:50),this.initialized=!0)}return this.state.image===void 0?null:n().createElement("img",{alt:"dynamic content",src:this.state.image,style:{width:this.props.schema.width||"100%",height:this.props.schema.height}})}}const en=Qt;class A extends f{constructor(e){super(e);Q(this,"index");this.index=Date.now()}componentDidMount(){if(super.componentDidMount(),this.props.schema.base64){const e=f.getValue(this.props.data,this.props.attr);this.setState({value:e})}else this.props.oContext.socket.fileExists(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.attr).then(e=>e&&this.loadImage())}_getUrl(e){e&&(this.index=Date.now());let t=`files/${this.props.oContext.adapterName}.${this.props.oContext.instance}/${this.props.attr}?t=${this.index}`;return window.location.port==="3000"&&(t=`${window.location.protocol}//${window.location.hostname}:8081/${t}`),t}loadImage(){fetch(this._getUrl()).then(e=>e.blob()).then(e=>{const t=new FileReader;t.onload=()=>{this.setState({value:t.result})},t.readAsDataURL(e)}).catch(e=>console.error(e))}renderItem(e,t){return n().createElement(o.FormControl,{fullWidth:!0,variant:"standard"},this.props.schema.label?n().createElement(o.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,n().createElement(a.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},()=>{if(this.props.schema.base64){const s=this.onChange(this.props.attr,this.state.value);s instanceof Promise&&s.catch(i=>console.error(`Cannot set value: ${i}`))}else this.props.oContext.socket.deleteFile(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.attr).catch(s=>console.error(s))}),onChange:s=>this.setState({value:s},()=>{if(this.props.schema.base64){const i=this.onChange(this.props.attr,this.state.value);i instanceof Promise&&i.catch(r=>console.error(`Cannot set value: ${r}`))}else s.startsWith("data")&&(s=s.split(",")[1]);this.props.oContext.socket.writeFile64(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.attr,s).catch(i=>console.error(i))})}),this.props.schema.help?n().createElement(o.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const P=A,oe={icon:{width:20,height:20,marginRight:4}};class ne extends f{constructor(){super(...arguments);Q(this,"onInstancesUpdate",(e,t)=>{if(!e.match(/^system\.adapter\.[-_a-z\d]+\.\d+$/))return;const s=this.props.schema.long?e:this.props.schema.short?e.split(".").pop():e.replace(/^system\.adapter\./,""),i=this.state.selectOptions.findIndex(r=>r.value===s);if(t){if(this.props.schema.adapter==="_dataSources"&&(!t.common||!t.common.getHistory))return;if(i===-1){const r=JSON.parse(JSON.stringify(this.state.selectOptions)),l=typeof t.common.name=="object"?t.common.name[a.I18n.getLanguage()]||t.common.name.en:t.common.name;r.push({value:this.props.schema.long?t._id:this.props.schema.short?t._id.split(".").pop():t._id.replace(/^system\.adapter\./,""),label:`${l} [${t._id.replace(/^system\.adapter\./,"")}]`,icon:`adapter/${l}/${t.common.icon}`}),r.sort((h,S)=>h.label>S.label?1:h.label<S.label?-1:0),this.setState({selectOptions:r})}}else if(i!==-1){const r=JSON.parse(JSON.stringify(this.state.selectOptions)),l={};this.state.value===r[i].value&&(l.value=f.NONE_VALUE),r.splice(i,1),l.selectOptions=r,this.setState(l)}})}componentDidMount(){super.componentDidMount();const e=f.getValue(this.props.data,this.props.attr);let t=this.props.schema.adapter;t==="_dataSources"&&(t=void 0),this.props.oContext.socket.getAdapterInstances(t,!0).then(s=>pe(this,null,function*(){this.props.schema.adapter==="_dataSources"?s=s.filter(r=>{var l;return(l=r==null?void 0:r.common)==null?void 0:l.getHistory}):this.props.schema.adapter?s=s.filter(r=>r==null?void 0:r._id.startsWith(`system.adapter.${this.props.schema.adapter}.`)):this.props.schema.adapters&&Array.isArray(this.props.schema.adapters)&&(s=s.filter(r=>{var l;return this.props.schema.adapters.includes((l=r==null?void 0:r.common)==null?void 0:l.name)})),this.props.schema.onlyEnabled&&(s=s.filter(r=>{var l;return(l=r==null?void 0:r.common)==null?void 0:l.enabled}));const i=s.map(r=>({value:this.props.schema.long?r._id:this.props.schema.short?r._id.split(".").pop():r._id.replace(/^system\.adapter\./,""),label:`${r.common.name} [${r._id.replace(/^system\.adapter\./,"")}]`,icon:`adapter/${r.common.name}/${r.common.icon}`}));i.sort((r,l)=>r.value>l.value?1:r.value<l.value?-1:0),this.props.schema.allowDeactivate!==!1&&i.unshift({label:a.I18n.t(f.NONE_LABEL),value:f.NONE_VALUE}),this.props.schema.all&&i.unshift({label:a.I18n.t("sch_all"),value:"*"}),this.setState({value:e||"",selectOptions:i}),yield this.props.oContext.socket.subscribeObject(`system.adapter.${t?`${t}.`:""}*`,this.onInstancesUpdate)})).catch(s=>console.error(`Cannot get instances: ${s}`))}componentWillUnmount(){this.props.oContext.socket.unsubscribeObject("system.adapter.*",this.onInstancesUpdate).then(()=>{}),super.componentWillUnmount()}renderItem(e,t){var i;if(!this.state.selectOptions)return null;const s=(i=this.state.selectOptions)==null?void 0:i.find(r=>r.value===this.state.value);return n().createElement(o.FormControl,{fullWidth:!0,key:this.props.attr,variant:"standard"},this.props.schema.label?n().createElement(o.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,n().createElement(o.Select,{variant:"standard",error:!!e,displayEmpty:!0,disabled:!!t,value:this.state.value,renderValue:()=>n().createElement("span",{style:{display:"flex"}},s!=null&&s.icon?n().createElement("img",{src:`./${s.icon}`,alt:s.value,style:oe.icon}):null,this.getText(s==null?void 0:s.label,!0)),onChange:r=>this.setState({value:r.target.value},()=>this.onChange(this.props.attr,this.state.value))},this.state.selectOptions.map(r=>n().createElement(o.MenuItem,{key:r.value,value:r.value,style:r.value===f.NONE_VALUE?{opacity:.5}:{}},r.icon?n().createElement("img",{src:`./${r.icon}`,alt:r.value,style:oe.icon}):null,this.getText(r.label,!0)))),this.props.schema.help?n().createElement(o.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const ue=ne,Ce={address:{fontSize:"smaller",opacity:.5,marginLeft:8}};class ve extends f{componentDidMount(){super.componentDidMount(),this.props.oContext.socket.getObject(`system.host.${this.props.common.host}`).then(c=>{var t,s;const e=[];if((s=(t=c==null?void 0:c.native)==null?void 0:t.hardware)!=null&&s.networkInterfaces){const i=c.native.hardware.networkInterfaces;Object.keys(i).forEach(r=>{if(this.props.schema.ignoreInternal&&!i[r].find(h=>!h.internal)||this.props.schema.ignoreLoopback&&i[r].find(h=>h.address==="127.0.0.1"||h.address==="::1"))return;let l=i[r].find(h=>h.family==="IPv4");l=l||i[r].find(h=>h.family==="IPv6"),e.push({value:r,address:l.address})})}this.setState({interfaces:e})}).catch(c=>window.alert(`Cannot read interfaces: ${c}`))}renderItem(c,e){var i,r,l;const t=f.getValue(this.props.data,this.props.attr),s=(i=this.state.interfaces)==null?void 0:i.find(h=>h.value===t);return n().createElement(o.FormControl,{fullWidth:!0,variant:"standard"},(r=this.state.interfaces)!=null&&r.length&&this.props.schema.label?n().createElement(o.InputLabel,null,this.getText(this.props.schema.label)):null,(l=this.state.interfaces)!=null&&l.length?n().createElement(o.Select,{variant:"standard",error:!!c,disabled:!!e,value:t,renderValue:h=>s?n().createElement("span",null,s.value,n().createElement("span",{style:Ce.address},s.address)):h,onChange:h=>this.onChange(this.props.attr,h.target.value)},this.state.interfaces.map((h,S)=>n().createElement(o.MenuItem,{key:S,value:h.value},n().createElement("span",null,h.value,n().createElement("span",{style:Ce.address},h.address))))):n().createElement(o.TextField,{fullWidth:!0,variant:"standard",error:!!c,disabled:!!e,value:t,onChange:h=>this.onChange(this.props.attr,h.target.value),label:this.getText(this.props.schema.label)}),this.props.schema.help?n().createElement(o.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Pe=ve,Te={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"}},ht=({toggleTranslation:E,noTranslation:c,title:e,fullWidth:t,help:s,maxWidth:i,progress:r,icon:l,applyDisabled:h,applyButton:S,onClose:L,children:O,titleButtonApply:N,titleButtonClose:te,onApply:ye,textInput:se,defaultValue:Ee,overflowHidden:me})=>{const[Me,yt]=(0,T.useState)(Ee);(0,T.useEffect)(()=>{yt(Ee)},[Ee]);let Jt=null;return l&&(Jt=l),n().createElement(o.Dialog,{open:!0,maxWidth:i||"md",fullWidth:!!t,disableEscapeKeyDown:!1,onClose:L,sx:{"& .MuiPaper-root":Te.modalDialog}},e&&n().createElement(o.DialogTitle,null,l?n().createElement(Jt,{style:Te.titleIcon}):null,e,a.I18n.getLanguage()!=="en"&&E?n().createElement(o.IconButton,{size:"large",style:q(q({},Te.languageButton),c?Te.languageButtonActive:{}),onClick:()=>E(),title:a.I18n.t("Disable/Enable translation")},n().createElement(u.Language,null)):null),n().createElement(o.DialogContent,{sx:q(q({},me?Te.overflowHidden:{}),Te.content),style:{paddingTop:8}},se&&n().createElement(o.TextField,{autoComplete:"off",fullWidth:!0,autoFocus:!0,variant:"outlined",size:"medium",multiline:!0,value:Me,onChange:pn=>yt(pn.target.value)}),O,s?n().createElement("div",null,s):null),n().createElement(o.DialogActions,null,S!==!1&&n().createElement(o.Button,{startIcon:n().createElement(u.Check,null),disabled:r||h&&Ee===Me,onClick:()=>ye&&ye(se?Me:""),variant:"contained",color:"primary"},a.I18n.t(N||"Ok")),n().createElement(o.Button,{color:"grey",onClick:()=>L&&L(),disabled:r,variant:"contained",startIcon:n().createElement(u.Close,null)},a.I18n.t(te||"Cancel"))))};var We=Y(58093),Ke=Y.n(We),Re=Y(97726),Ct=Y(51197),Bt=Y(9285),fn=Y(44210),gn=Y(82292);const Mt={jsonError:{border:"1px solid red",minHeight:200},jsonNoError:{border:"1px solid #00000000",minHeight:200}};function be(E){return n().createElement(Ke(),{style:E.error===!0?Mt.jsonError:E.error===!1?Mt.jsonNoError:void 0,mode:E.mode||"json",width:"100%",height:"100%",showPrintMargin:E.editValueMode,showGutter:E.editValueMode,highlightActiveLine:E.editValueMode,defaultValue:E.defaultValue,theme:E.themeType==="dark"?"clouds_midnight":"chrome",value:E.value,readOnly:!E.onChange,onChange:c=>E.onChange(c),name:E.name||"UNIQUE_ID_OF_DIV1",fontSize:E.fontSize||14,setOptions:{enableBasicAutocompletion:!0,enableLiveAutocompletion:!0,enableSnippets:!0,showLineNumbers:E.editValueMode,tabSize:E.editValueMode?2:void 0},editorProps:{$blockScrolling:!0}})}const Le=be,he={fullWidth:{width:"100%"},flex:{display:"flex"},button:{height:48,minWidth:48},wrapper:{width:"calc(100vw - 40px)",height:"calc(100vh - 188px)"}};class Oe extends f{componentDidMount(){super.componentDidMount();const{data:c,attr:e}=this.props,t=f.getValue(c,e)||{};this.setState({value:t,initialized:!0,jsonError:this.validateJson(t)})}validateJson(c){let e=!1;if(this.props.schema.validateJson!==!1&&(c||!this.props.schema.allowEmpty))try{JSON.parse(c)}catch(t){console.log("Error in JSON",t),e=!0}return e}renderItem(c,e){if(!this.state.initialized)return null;const{schema:t,data:s,attr:i}=this.props,{value:r,showSelectId:l}=this.state;return n().createElement(o.FormControl,{fullWidth:!0,variant:"standard"},n().createElement("div",{style:he.flex},n().createElement(o.Button,{color:"grey",disabled:e,style:he.button,size:"small",variant:"outlined",onClick:()=>this.setState({showSelectId:!0})},a.I18n.t("ra_JSON editor"))),l?n().createElement(ht,{title:this.getText(t.label),overflowHidden:!0,onClose:()=>this.setState({showSelectId:!1,value:f.getValue(s,i)||{}}),onApply:()=>this.setState({showSelectId:!1},()=>this.onChange(i,r))},n().createElement("div",{style:q(q({},he.wrapper),this.state.jsonError?{}:void 0)},n().createElement(Le,{value:typeof r=="object"?JSON.stringify(r):r,onChange:h=>this.setState({value:h,jsonError:this.validateJson(h)}),name:"ConfigJsonEditor",themeType:this.props.oContext.themeType}))):null,t.help||this.state.jsonError?n().createElement(o.FormHelperText,null,this.state.jsonError?a.I18n.t("ra_Invalid JSON"):this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Je=Oe,$e=[{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-cn",label:"\u7B80\u4F53\u4E2D\u6587"}];class ot extends f{componentDidMount(){super.componentDidMount();const c=f.getValue(this.props.data,this.props.attr),e=[...$e];this.props.schema.system?e.unshift({value:"",label:a.I18n.t("ra_System language")}):e.unshift({value:"",label:a.I18n.t("ra_none")}),this.setState({value:this.props.schema.system?c||"":c||a.I18n.getLanguage(),selectOptions:e})}renderItem(c,e){var s,i;if(!this.state.selectOptions)return null;const t=(s=this.state.selectOptions)==null?void 0:s.find(r=>r.value===this.state.value||!r.value&&!this.state.value);return n().createElement(o.FormControl,{fullWidth:!0,variant:"standard"},this.props.schema.label?n().createElement(o.InputLabel,null,this.getText(this.props.schema.label)):null,n().createElement(o.Select,{variant:"standard",error:!!c,disabled:e,value:this.state.value||"_",renderValue:()=>this.getText(t==null?void 0:t.label,this.props.schema.noTranslation),onChange:r=>{let{value:l}=r.target;l==="_"&&(l=""),this.setState({value:l},()=>{const h=this.onChange(this.props.attr,l);if(h instanceof Promise&&h.catch(S=>console.error(S)),this.props.schema.changeGuiLanguage)if(l){if(l===a.I18n.getLanguage())return;a.I18n.setLanguage(l),this.props.oContext.changeLanguage&&this.props.oContext.changeLanguage()}else this.props.oContext.socket.getSystemConfig().then(S=>{S.common.language!==a.I18n.getLanguage()&&S.common.language&&(a.I18n.setLanguage(S.common.language),this.props.oContext.changeLanguage&&this.props.oContext.changeLanguage())}).catch(S=>console.error(`Cannot read system config: ${S}`))})}},(i=this.state.selectOptions)==null?void 0:i.map(r=>n().createElement(o.MenuItem,{key:r.value,value:r.value},r.label))),this.props.schema.help?n().createElement(o.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Ze=ot;class Qe extends f{constructor(e){super(e);Q(this,"scrollRef");this.scrollRef=n().createRef()}scrolledDown(){return this.scrollRef.current?this.scrollRef.current.offsetHeight+this.scrollRef.current.scrollTop>=this.scrollRef.current.scrollHeight:!1}componentDidMount(){super.componentDidMount(),f.getValue(this.props.data,this.props.attr)||(this.props.schema.licenseUrl?(this.setState({showLicenseDialog:!0,loading:!0,scrolledDown:!1}),fetch(this.props.schema.licenseUrl).then(e=>e.text()).then(e=>this.setState({license:e,loading:!1})).catch(e=>this.setState({license:e.toString(),loading:!1,error:!0,scrolledDown:!1}))):this.setState({showLicenseDialog:!0,scrolledDown:!1}),setTimeout(()=>{this.scrollRef.current&&(this.scrolledDown()?this.setState({scrolledDown:!0}):this.scrollRef.current.addEventListener("scroll",()=>{!this.state.scrolledDown&&this.scrolledDown()&&this.setState({scrolledDown:!0})}))},1e3))}renderItem(e,t){return this.state.showLicenseDialog?n().createElement(o.Dialog,{maxWidth:"lg",open:!0,onClose:(s,i)=>{i!=="escapeKeyDown"&&i!=="backdropClick"&&this.setState({showLicenseDialog:!1})}},n().createElement(o.DialogTitle,null,this.props.schema.title?a.I18n.t(this.props.schema.title):a.I18n.t("ra_License agreement")),n().createElement(o.DialogContent,null,this.props.schema.licenseUrl?n().createElement(n().Fragment,null,this.state.loading?n().createElement(o.LinearProgress,null):null,n().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?n().createElement("div",{ref:this.scrollRef,style:{width:"100%",height:"100%",overflowY:"auto",fontSize:14}},this.props.schema.texts.map((s,i)=>this.props.schema.noTranslation?n().createElement("p",{key:i},s):n().createElement("p",{key:i},a.I18n.t(s)))):null),n().createElement(o.DialogActions,null,this.props.schema.checkBox?n().createElement(o.FormControlLabel,{control:n().createElement(o.Checkbox,{disabled:t,checked:!!this.state.licenseChecked,onClick:()=>this.setState({licenseChecked:!this.state.licenseChecked})}),label:a.I18n.t(this.props.schema.checkBox)}):null,n().createElement(o.Button,{disabled:t||this.state.loading||this.state.error||this.props.schema.checkBox&&!this.state.licenseChecked||!this.state.scrolledDown,onClick:()=>{this.setState({showLicenseDialog:!1});const s=this.onChange(this.props.attr,!0);s instanceof Promise&&s.catch(i=>console.error(`Cannot set value: ${i}`))},color:"primary",variant:"contained",startIcon:n().createElement(u.Check,null)},this.props.schema.agreeText?a.I18n.t(this.props.schema.agreeText):a.I18n.t("ra_Accept license")),n().createElement(o.Button,{onClick:()=>{this.setState({showLicenseDialog:!1}),setTimeout(()=>this.setState({showLicenseDialog:!0}),2e3)},color:"grey",variant:"contained",startIcon:n().createElement(u.Close,null)},a.I18n.t("ra_Close")))):null}}const rt=Qe,Dt={indeterminate:{opacity:.5},control:{flexDirection:"row",width:"100%"}};class tn extends f{constructor(){super(...arguments);Q(this,"updateTimeout")}componentDidMount(){super.componentDidMount();let e=f.getValue(this.props.data,this.props.attr);if(e==null&&(e=""),Array.isArray(e)&&this.props.oContext.multiEdit){e=f.DIFFERENT_VALUE,this.setState({_value:e,oldValue:e});return}this.setState({_value:e.toString(),oldValue:e.toString()})}static getDerivedStateFromProps(e,t){if(e.schema.min!==void 0&&e.schema.min<0||e.schema.max!==void 0&&e.schema.max<0)return null;const s=f.getValue(e.data,e.attr);return e.oContext.multiEdit&&t._value===f.DIFFERENT_VALUE?{_value:f.DIFFERENT_VALUE}:s==null||t.oldValue===null||t.oldValue===void 0||s.toString()!==parseFloat(t._value).toString()&&s.toString()!==t.oldValue.toString()?{_value:s}:null}checkValue(e){if(e==null)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 s=Array.isArray(this.state._value)||this.state._value===f.DIFFERENT_VALUE;if(this.state.oldValue!==null&&this.state.oldValue!==void 0?(this.updateTimeout&&clearTimeout(this.updateTimeout),this.updateTimeout=setTimeout(()=>{this.updateTimeout=void 0,this.setState({oldValue:null})},30)):this.updateTimeout&&(clearTimeout(this.updateTimeout),this.updateTimeout=void 0),s){const i=f.getValue(this.props.data,this.props.attr),r=(i==null?void 0:i.filter(l=>l||l===0).map(l=>({label:l.toString(),value:l})))||[];return r.unshift({label:a.I18n.t(f.DIFFERENT_LABEL),value:f.DIFFERENT_VALUE}),n().createElement(o.Autocomplete,{style:Dt.indeterminate,fullWidth:!0,freeSolo:!0,value:r[0],getOptionSelected:(l,h)=>l.label===h.label,onChange:(l,h)=>{const S=this.onChange(this.props.attr,h==null?void 0:h.value,()=>{this.setState({_value:h==null?void 0:h.value,oldValue:this.state._value})});S instanceof Promise&&S.catch(L=>console.error(L))},options:r,getOptionLabel:l=>l.label,renderInput:l=>n().createElement(o.TextField,Be(q({},l),{label:this.getText(this.props.schema.label),variant:"standard",slotProps:{htmlInput:Be(q({},l.inputProps),{readOnly:this.props.schema.readOnly||!1}),input:{endAdornment:this.props.schema.unit?this.getText(this.props.schema.unit,this.props.schema.noTranslation):void 0}},error:!!e,placeholder:this.getText(this.props.schema.placeholder),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation),disabled:!!t}))})}return!e&&this.state._value!==null&&this.state._value!==void 0&&this.state._value&&(e=this.checkValue(this.state._value),e&&(e=a.I18n.t(e))),n().createElement(o.FormControl,{variant:"standard",style:Dt.control},n().createElement(o.TextField,{variant:"standard",type:"number",fullWidth:!0,slotProps:{htmlInput:{min:this.props.schema.min,max:this.props.schema.max,step:this.props.schema.step,readOnly:this.props.schema.readOnly||!1},input:{endAdornment:this.props.schema.unit?this.getText(this.props.schema.unit,this.props.schema.noTranslation):void 0}},value:this.state._value===null||this.state._value===void 0?"":this.state._value,error:!!e,disabled:!!t,onChange:i=>{const r=i.target.value,l=this.checkValue(r);l?this.onError(this.props.attr,a.I18n.t(l)):this.onError(this.props.attr),this.setState({_value:r,oldValue:this.state._value},()=>this.onChange(this.props.attr,parseFloat(r)))},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 Ln=tn,Cn={flex:{display:"flex"},button:{height:48,marginLeft:4,minWidth:48}};class $n extends f{componentDidMount(){super.componentDidMount();const{data:c,attr:e}=this.props,t=f.getValue(c,e)||"";this.setState({value:t,initialized:!0})}renderItem(c,e){if(!this.state.initialized)return null;const t=this.props.oContext.socket,{schema:s,attr:i}=this.props,{value:r,showSelectId:l}=this.state;return n().createElement(o.FormControl,{fullWidth:!0,variant:"standard"},s.label?n().createElement(o.InputLabel,{shrink:!0},this.getText(s.label)):null,n().createElement("div",{style:Cn.flex},n().createElement(o.TextField,{variant:"standard",fullWidth:!0,value:r,error:!!c,disabled:e,placeholder:this.getText(s.placeholder),label:this.getText(s.label),helperText:this.renderHelp(s.help,s.helpLink,s.noTranslation),onChange:h=>{const S=h.target.value;this.setState({value:S},()=>this.onChange(i,S))}}),n().createElement(o.Button,{color:"grey",disabled:e,style:Cn.button,size:"small",variant:"outlined",onClick:()=>this.setState({showSelectId:!0})},"...")),l?n().createElement(a.DialogSelectID,{imagePrefix:this.props.oContext.imagePrefix===void 0?"../..":this.props.oContext.imagePrefix,dialogName:`admin.${this.props.oContext.adapterName}`,filterFunc:s.filterFunc,themeType:this.props.oContext.themeType,theme:this.props.oContext.theme,types:s.types?Array.isArray(s.types)?s.types:[s.types]:void 0,customFilter:s.customFilter,filters:s.filters,socket:t,selected:r,root:s.root,onClose:()=>this.setState({showSelectId:!1}),onOk:h=>this.setState({showSelectId:!1,value:h},()=>this.onChange(i,h))}):null)}}const Nn=$n,nn={fullWidth:{width:"100%",display:"inline-block"},halfWidth1:{width:"calc(50% - 5px)",display:"inline-block",marginRight:8},halfWidth2:{width:"calc(50% - 5px)",display:"inline-block"}},Vt="____ppp____";class Pn extends f{componentDidMount(){super.componentDidMount();const c=f.getValue(this.props.data,this.props.attr);this.setState({_repeat:c?Vt:"",_visible:!1,value:c?Vt:"",_notEqual:!1})}onChangePassword(c,e){c===void 0&&(c=this.state.value),e===void 0&&(e=this.state._repeat);const t=!!this.props.schema.repeat&&e!==c;this.setState({value:c,_repeat:e,_notEqual:t},()=>{if(t)this.onError(this.props.attr,a.I18n.t("ra_Passwords are not equal!"));else{this.onError(this.props.attr);const s=this.onChange(this.props.attr,c);s instanceof Promise&&s.catch(i=>this.onError(this.props.attr,i))}})}renderItem(c,e){if(this.state._notEqual===void 0)return null;const t=n().createElement(o.TextField,{variant:"standard",fullWidth:!0,type:this.state._visible&&this.state.value!==Vt?"text":"password",value:this.state.value,error:!!c||this.state._notEqual,disabled:!!e,onChange:s=>this.onChangePassword(s.target.value),label:this.getText(this.props.schema.label),slotProps:{input:{autoComplete:"new-password",endAdornment:this.state.value&&this.state.value!==Vt&&this.props.schema.visible&&!e&&!this.props.schema.readOnly?n().createElement(o.InputAdornment,{position:"end"},n().createElement(o.IconButton,{size:"large",tabIndex:-1,onClick:s=>{s.preventDefault(),s.stopPropagation(),this.setState({_visible:!this.state._visible})},edge:"end"},this.state._visible?n().createElement(u.VisibilityOff,null):n().createElement(u.Visibility,null))):void 0},htmlInput:{autoComplete:"new-password",form:{autoComplete:"off"},maxLength:this.props.schema.maxLength||this.props.schema.max||void 0,readOnly:this.props.schema.readOnly||!1}},helperText:this.state._notEqual?a.I18n.t("ra_Passwords are not equal!"):this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)});if(this.props.schema.repeat&&!this.props.schema.readOnly){const s=this.state._visible?null:n().createElement(o.TextField,{variant:"standard",fullWidth:!0,type:"password",value:this.state._repeat,error:!!c||this.state._notEqual,disabled:!!e,onChange:i=>this.onChangePassword(void 0,i.target.value),label:`${this.getText(this.props.schema.label)} (${a.I18n.t("ra_repeat")})`,slotProps:{input:{autoComplete:"new-password"},htmlInput:{autoComplete:"new-password",form:{autoComplete:"off"},maxLength:this.props.schema.maxLength||this.props.schema.max||void 0}},helperText:this.state._notEqual?a.I18n.t("ra_Passwords are not equal!"):this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)});return n().createElement("div",{style:nn.fullWidth},n().createElement("div",{style:nn.halfWidth1},t),n().createElement("div",{style:nn.halfWidth2},s))}return t}}const Rn=Pn;class Mn extends f{renderItem(c,e){return n().createElement(o.TextField,{variant:"standard",fullWidth:!0,disabled:!!e,slotProps:{input:{endAdornment:this.props.schema.copyToClipboard?n().createElement(o.IconButton,{size:"small",onClick:()=>{a.Utils.copyToClipboard(this.getPattern(this.props.schema.pattern,null,this.props.schema.noTranslation)),window.alert(a.I18n.t("ra_Copied"))}},n().createElement(a.IconCopy,null)):void 0}},value:this.getPattern(this.props.schema.pattern,null,!0),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}}const Vn=Mn,jn={warning:{"& .Mui-error":{color:"orange"}}};class sn extends f{constructor(){super(...arguments);Q(this,"updateTimeout")}componentDidMount(){return pe(this,null,function*(){nt(sn.prototype,this,"componentDidMount").call(this);let e=f.getValue(this.props.data,this.props.attr);e==null&&(e=""),this.setState({_value:e.toString(),oldValue:e.toString()});const t=yield this.props.oContext.socket.getAdapterInstances(),s=`system.adapter.${this.props.oContext.adapterName}.${this.props.oContext.instance}`,i=yield this.props.oContext.socket.getObject(s),r=i==null?void 0:i.common.host,l=[];t.forEach(h=>{var L,O,N,te;if(!h||h._id===s||h.common.host!==r||!((L=h.native)!=null&&L.bind))return;if(h!=null&&h.native&&h.native.secure&&h.native.leEnabled&&h.native.leUpdate){const ye=parseInt(h.native.leCheckPort||h.native.lePort,10);ye&&l.push({name:`${h._id.replace("system.adapter.","")} (LE)`,port:ye,v6bind:h.native.bind.includes(":")?h.native.bind:h.native.v6bind,bind:h.native.bind,enabled:!!((O=h.common)!=null&&O.enabled)})}const S=parseInt((N=h==null?void 0:h.native)==null?void 0:N.port,10);S&&l.push({name:h._id.replace("system.adapter.",""),bind:h.native.bind,v6bind:h.native.bind.includes(":")?h.native.bind:h.native.v6bind,port:S,enabled:!!((te=h.common)!=null&&te.enabled)})}),this.setState({ports:l})})}static getDerivedStateFromProps(e,t){const s=f.getValue(e.data,e.attr);return s==null||t.oldValue===null||t.oldValue===void 0||s.toString()!==parseInt(t._value,10).toString()&&s.toString()!==t.oldValue.toString()?{_value:s}:null}checkValue(e){if(e==null)return null;const t=this.props.schema.min===void 0?20:this.props.schema.min,s=this.props.schema.max||65535;e=e.toString().trim();const i=e===""?0:parseInt(e,10);return e!==""&&Number.isNaN(i)?"ra_Not a number":e!==""&&window.isFinite(Number(e))?i<t?"ra_Too small":i>s?"ra_Too big":e===""||e==="-"||Number.isNaN(i)?"ra_Not a number":null:"ra_Not a number"}renderItem(e,t){this.state.oldValue!==null&&this.state.oldValue!==void 0?(this.updateTimeout&&clearTimeout(this.updateTimeout),this.updateTimeout=setTimeout(()=>{this.updateTimeout=void 0,this.setState({oldValue:null})},30)):this.updateTimeout&&(clearTimeout(this.updateTimeout),this.updateTimeout=void 0);const s=this.props.schema.min===void 0?20:this.props.schema.min,i=this.props.schema.max||65535;let r;if(this.state.ports){const l=parseInt(this.state._value,10);if(l){const h=this.state.ports.filter(L=>!this.props.data.bind||this.props.data.bind===L.bind||this.props.data.bind==="0.0.0.0"||L.bind==="0.0.0.0");let S=h.findIndex(L=>L.port===l&&L.enabled);S!==-1?e=a.I18n.t("ra_Port is already used by %s",this.state.ports[S].name):(S=h.findIndex(L=>L.port===l&&!L.enabled),S!==-1&&(r=!0,e=a.I18n.t("ra_Port could be used by %s",this.state.ports[S].name)))}}return!e&&this.state._value!==null&&this.state._value!==void 0&&(e=this.checkValue(this.state._value),typeof e=="string"&&(e=a.I18n.t(e))),n().createElement(o.TextField,{variant:"standard",type:"number",fullWidth:!0,slotProps:{htmlInput:{min:s,max:i,readOnly:this.props.schema.readOnly||!1}},value:this.state._value===null||this.state._value===void 0?"":this.state._value,error:!!e,disabled:!!t,sx:r?jn.warning:void 0,onChange:l=>{const h=Number(l.target.value.toString().replace(/[^0-9]/g,"")).toString(),S=this.checkValue(h);S?this.onError(this.props.attr,a.I18n.t(S)):this.onError(this.props.attr),this.setState({_value:h,oldValue:this.state._value},()=>{if(h.trim()===parseInt(h,10).toString()){const L=this.onChange(this.props.attr,parseInt(h,10)||0);L instanceof Promise&&L.catch(O=>{console.error(`Cannot set value for ${this.props.attr}: ${O}`)})}})},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 Un=sn;class Wn extends f{componentDidMount(){super.componentDidMount();const c=f.getValue(this.props.data,this.props.attr);this.props.oContext.socket.getEnums("rooms").then(e=>{const t=Object.keys(e).map(s=>({value:this.props.schema.short?s.replace("enum.rooms.",""):s,label:this.getText(e[s].common.name),obj:e[s]}));this.props.schema.allowDeactivate!==!1&&t.unshift({label:a.I18n.t(f.NONE_LABEL),value:f.NONE_VALUE}),this.setState({value:c,selectOptions:t})}).catch(e=>console.error(`Cannot get enums: ${e}`))}renderItem(c,e){if(!this.state.selectOptions)return null;const t=this.state.selectOptions.find(s=>s.value===this.state.value);return n().createElement(o.FormControl,{variant:"standard",fullWidth:!0},this.props.schema.label?n().createElement(o.InputLabel,null,this.getText(this.props.schema.label)):null,n().createElement(o.Select,{variant:"standard",error:!!c,disabled:!!e,value:this.state.value||"_",renderValue:()=>t?t.obj?n().createElement(a.TextWithIcon,{value:t.obj,themeType:this.props.oContext.themeType,lang:a.I18n.getLanguage()}):t.label:"",onChange:s=>{this.setState({value:s.target.value==="_"?"":s.target.value},()=>this.onChange(this.props.attr,this.state.value))}},this.state.selectOptions.map(s=>n().createElement(o.MenuItem,{key:s.value,value:s.value,style:s.value===f.DIFFERENT_VALUE?{opacity:.5}:{}},s.obj?n().createElement(a.TextWithIcon,{value:s.obj,themeType:this.props.oContext.themeType,lang:a.I18n.getLanguage()}):s.label))),this.props.schema.help?n().createElement(o.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Jn=Wn,Hn={fullWidth:{width:"100%"},noMargin:{"&>div":{marginTop:0}}};class zn extends f{constructor(){super(...arguments);Q(this,"initialValue","")}componentDidMount(){super.componentDidMount();const e=f.getValue(this.props.data,this.props.attr),t=[];(this.props.schema.options||[]).forEach(s=>{const i=s;Array.isArray(i.items)?(t.push({label:this.getText(s.label),value:s.value,group:!0}),i.items.forEach(r=>t.push({label:this.getText(r.label),value:r.value,hidden:r.hidden}))):t.push({label:this.getText(s.label),value:s.value,hidden:s.hidden})}),Array.isArray(e)?(this.initialValue=[...e],t.unshift({label:a.I18n.t(f.DIFFERENT_LABEL),value:f.DIFFERENT_VALUE}),this.setState({value:f.DIFFERENT_VALUE,selectOptions:t})):this.setState({value:e,selectOptions:t})}renderItem(e,t){if(!this.state.selectOptions)return null;const s=(this.state.selectOptions||[]).filter(r=>r.hidden?this.props.custom?!this.executeCustom(r.hidden,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):!this.execute(r.hidden,this.props.schema.default,this.props.data,this.props.arrayIndex,this.props.globalData):!0),i=s.find(r=>r.value==this.state.value);return n().createElement(o.FormControl,{variant:"standard",fullWidth:!0,sx:this.props.table!==void 0&&Hn.noMargin,id:`jsonSelect_${this.props.attr}_${this.props.index||this.props.index===0?this.props.index:""}`},this.props.schema.label?n().createElement(o.InputLabel,null,this.getText(this.props.schema.label)):null,n().createElement(o.Select,{variant:"standard",error:!!e,disabled:!!t,value:this.state.value||"_",renderValue:()=>this.getText(i==null?void 0:i.label,this.props.schema.noTranslation),onChange:r=>{this.setState({value:r.target.value==="_"?"":r.target.value},()=>{let l;this.state.value===f.DIFFERENT_VALUE?l=this.onChange(this.props.attr,this.initialValue):l=this.onChange(this.props.attr,this.state.value),l instanceof Promise&&l.catch(h=>console.error(h))})}},s.map((r,l)=>r.group?n().createElement(o.ListSubheader,{key:l},this.getText(r.label,this.props.schema.noTranslation)):n().createElement(o.MenuItem,{key:l,value:r.value,style:r.value===f.DIFFERENT_VALUE?{opacity:.5}:{}},this.getText(r.label,this.props.schema.noTranslation)))),this.props.schema.help?n().createElement(o.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const qn=zn,Kn={menuPaper:{maxHeight:800}};class Gn extends f{constructor(){super(...arguments);Q(this,"initialized",!1);Q(this,"localContext")}askInstance(){if(this.props.alive){let e=this.props.schema.data;if(e===void 0&&this.props.schema.jsonData){const t=this.getPattern(this.props.schema.jsonData,null,!0);try{e=JSON.parse(t)}catch(s){console.error(`Cannot parse json data: ${t}`)}}e===void 0&&(e=null),this.setState({running:!0},()=>{this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",e).then(t=>this.setState({list:t,running:!1})).catch(t=>{console.error(`Cannot send command: ${t}`)})})}else{const e=f.getValue(this.props.data,this.props.attr);this.setState({value:e,running:!1})}}getContext(){const e={};return Array.isArray(this.props.schema.alsoDependsOn)&&this.props.schema.alsoDependsOn.forEach(t=>e[t]=f.getValue(this.props.data,t)),JSON.stringify(e)}_getValue(){let e=this.state.value===null||this.state.value===void 0?f.getValue(this.props.data,this.props.attr):this.state.value;return this.props.schema.multiple&&(typeof e=="string"?e=[e]:e==null&&(e=[])),e}renderItem(e,t){var l;if(this.props.alive){const h=this.getContext();(h!==this.localContext||!this.initialized)&&(this.localContext=h,setTimeout(()=>this.askInstance(),this.initialized?300:50),this.initialized=!0)}const s=this._getValue();if(!this.props.alive||!this.state.running&&!((l=this.state.list)!=null&&l.length))return this.props.schema.multiple||this.props.schema.manual===!1?a.I18n.t("ra_Cannot retrieve options, as instance is offline"):n().createElement(o.TextField,{variant:"standard",fullWidth:!0,value:s,error:!!e,disabled:!!t,onChange:h=>{const S=h.target.value;this.setState({value:S},()=>this.onChange(this.props.attr,(S||"").trim()))},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation),slotProps:{input:{endAdornment:this.state.value&&!this.props.schema.noClearButton?n().createElement(o.InputAdornment,{position:"end"},n().createElement(o.IconButton,{size:"small",onClick:()=>this.setState({value:""},()=>this.onChange(this.props.attr,""))},n().createElement(u.Close,null))):null}}});if(this.state.running)return n().createElement(o.CircularProgress,{size:"24"});const i=this.state.list.filter(h=>h.hidden?this.props.custom?!this.executeCustom(h.hidden,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):!this.execute(h.hidden,this.props.schema.default,this.props.data,this.props.arrayIndex,this.props.globalData):!0),r=i.find(h=>h.value===s);return n().createElement(o.FormControl,{variant:"standard",fullWidth:!0},this.props.schema.label?n().createElement(o.InputLabel,null,this.getText(this.props.schema.label)):null,n().createElement(o.Select,{variant:"standard",error:!!e,multiple:this.props.schema.multiple,disabled:!!t,sx:{"&.MuiSelect-paper":this.props.schema.multiple?Kn.menuPaper:void 0},value:s,renderValue:h=>this.props.schema.multiple?n().createElement(o.Box,{sx:{display:"flex",flexWrap:"wrap",gap:.5}},h.map(S=>{const L=i.find(O=>O.value===S);if(L||this.props.schema.showAllValues!==!1){const O=(L==null?void 0:L.label)||S;return n().createElement(o.Chip,{key:S,label:O})}return null})):(r==null?void 0:r.label)||h,onChange:h=>{const S=this.onChange(this.props.attr,h.target.value);S instanceof Promise&&S.catch(L=>console.error(`Cannot set value: ${L}`))}},i.map((h,S)=>n().createElement(o.MenuItem,{key:S,value:h.value},this.props.schema.multiple?n().createElement(o.Checkbox,{checked:s.includes(h.value),onClick:()=>{const L=JSON.parse(JSON.stringify(this._getValue())),O=s.indexOf(h.value);O!==-1?L.splice(O,1):(L.push(h.value),L.sort()),this.setState({value:L},()=>this.onChange(this.props.attr,L))}}):null,n().createElement(o.ListItemText,{primary:h.label})))),this.props.schema.help?n().createElement(o.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Xn=Gn,Dn={fullWidth:{width:"100%"}};function pt(E){return E.split(".").reduce((c,e)=>(c<<8)+parseInt(e,10),0)>>>0}function Yn(E,c){var s,i;const e=(i=(s=E==null?void 0:E.native)==null?void 0:s.hardware)==null?void 0:i.networkInterfaces;if(!e)return null;let t;return Object.keys(e).forEach(r=>e[r].forEach(l=>{l.internal||c.includes(":")&&l.family!=="IPv6"||c.includes(".")&&!c.match(/[^.\d]/)&&l.family!=="IPv4"||(l.family==="IPv4"&&!l.address.startsWith("172")&&(c==="127.0.0.0"||c==="localhost"||c.match(/[^.\d]/))?t=l.address:t||(l.family==="IPv4"&&c.includes(".")&&(pt(c)&pt(l.netmask),pt(l.address)&pt(l.netmask)),t=l.address))})),t||Object.keys(e).forEach(r=>e[r].forEach(l=>{l.internal||c.includes(":")&&l.family!=="IPv6"||c.includes(".")&&!c.match(/[^.\d]/)&&l.family!=="IPv4"||(l.family==="IPv6"&&(c==="127.0.0.0"||c==="localhost"||c.match(/[^.\d]/))?t=l.address:t||(l.family==="IPv4"&&c.includes(".")&&(pt(c)&pt(l.netmask),pt(l.address)&pt(l.netmask)),t=l.address))})),t||Object.keys(e).forEach(r=>{e[r].forEach(l=>{l.internal||c.includes(":")&&l.family!=="IPv6"||c.includes(".")&&!c.match(/[^.\d]/)&&l.family!=="IPv4"||(c==="127.0.0.0"||c==="localhost"||c.match(/[^.\d]/),t=l.address)})}),t||Object.keys(e).forEach(r=>{e[r].forEach(l=>{l.internal||(t=l.address)})}),t}class on extends f{componentDidMount(){return pe(this,null,function*(){var e;nt(on.prototype,this,"componentDidMount").call(this);let c=window.location.hostname;if(this.props.schema.openUrl){const t=yield this.props.oContext.socket.getCurrentInstance(),s=yield this.props.oContext.socket.getObject(`system.adapter.${t}`);if(s){const i=yield this.props.oContext.socket.getObject(`system.host.${(e=s==null?void 0:s.common)==null?void 0:e.host}`);if(i){const r=Yn(i,window.location.hostname);if(r)c=`${r}:${window.location.port}`;else{console.warn(`Cannot find suitable IP in host ${s.common.host} for ${s._id}`);return}}}}yield new Promise(t=>{this.setState({_error:"",_message:"",hostname:c},t)}),this.props.schema.onLoaded&&this._onClick()})}renderErrorDialog(){return this.state._error?n().createElement(a.DialogError,{text:this.state._error,onClose:()=>this.setState({_error:""})}):null}renderMessageDialog(){return this.state._message?n().createElement(a.DialogMessage,{text:this.state._message,onClose:()=>this.setState({_message:""})}):null}_onClick(){this.props.oContext.onCommandRunning(!0),this.setState({running:!0});const c=`${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 i=this.getPattern(this.props.schema.jsonData,q({_origin:c,_originIp:e},this.props.data),!0);try{t=JSON.parse(i)}catch(r){console.error(`Cannot parse json data: ${i}`)}}t===void 0&&(t=null),this.props.schema.openUrl&&!t&&(t={_origin:c,_originIp:e});let s;this.props.schema.timeout&&(s=setTimeout(()=>{this.props.oContext.onCommandRunning(!1),this.setState({_error:a.I18n.t("ra_Request timed out"),running:!1})},parseInt(this.props.schema.timeout,10)||1e4)),this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",t).then(i=>pe(this,null,function*(){if(s&&(clearTimeout(s),s=void 0),i!=null&&i.error)if(this.props.schema.error&&this.props.schema.error[i.error]){let r=this.getText(this.props.schema.error[i.error]);i.args&&i.args.forEach(l=>r=r.replace("%s",l)),this.setState({_error:r})}else this.setState({_error:i.error?a.I18n.t(i.error):a.I18n.t("ra_Error")});else{if(i!=null&&i.command){this.props.oContext.onBackEndCommand&&this.props.oContext.onBackEndCommand(i.command);return}if(i!=null&&i.reloadBrowser&&this.props.schema.reloadBrowser)window.location.reload();else if(i!=null&&i.openUrl&&this.props.schema.openUrl)window.open(i.openUrl,i.window||this.props.schema.window||"_blank");else if(i!=null&&i.result&&this.props.schema.result&&this.props.schema.result[i.result]){let r=this.getText(this.props.schema.result[i.result]);i.args&&i.args.forEach(l=>r=r.replace("%s",l)),window.alert(r)}if(i!=null&&i.native&&this.props.schema.useNative){for(const[r,l]of Object.entries(i.native))yield this.onChangeAsync(r,l);setTimeout(()=>this.props.oContext.forceUpdate(Object.keys(i.native),this.props.data),300)}else i!=null&&i.result?window.alert(typeof i.result=="object"?JSON.stringify(i.result):i.result):window.alert(a.I18n.t("ra_Ok"));i!=null&&i.saveConfig&&this.props.onChange(null,null,null,!0)}})).catch(i=>{this.props.schema.error&&this.props.schema.error[i.toString()]?this.setState({_error:this.getText(this.props.schema.error[i.toString()])}):this.setState({_error:a.I18n.t(i.toString())||a.I18n.t("ra_Error")})}).then(()=>{this.props.oContext.onCommandRunning(!1),this.setState({running:!1})})}renderDialogConfirm(){if(!this.state.confirmDialog)return null;const c=this.state.confirmData||this.props.schema.confirm;let e=null;return c.type==="warning"?e=n().createElement(u.Warning,null):c.type==="error"?e=n().createElement(u.Error,null):c.type==="info"&&(e=n().createElement(u.Info,null)),n().createElement(a.DialogConfirm,{title:this.getText(c.title)||a.I18n.t("ra_Please confirm"),text:this.getText(c.text),ok:this.getText(c.ok)||a.I18n.t("ra_Ok"),cancel:this.getText(c.cancel)||a.I18n.t("ra_Cancel"),icon:e||void 0,onClose:t=>this.setState({confirmDialog:!1},()=>t&&this._onClick())})}renderItem(c,e){const t=this.getIcon();return n().createElement("div",{style:Dn.fullWidth},n().createElement(o.Button,{variant:this.props.schema.variant||void 0,color:this.props.schema.color||"grey",style:q(q({},Dn.fullWidth),this.props.schema.controlStyle||void 0),disabled:e||!this.props.alive,startIcon:t,title:this.props.alive?this.getText(this.props.schema.title)||"":a.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?n().createElement(o.CircularProgress,{size:20,style:{marginRight:8}}):null,this.getText(this.props.schema.label,this.props.schema.noTranslation)),this.renderErrorDialog(),this.renderMessageDialog())}}const vn=on,yn={fullWidth:{width:"100%"},icon:{width:24,height:24,marginRight:4}};class Zn extends f{_onClick(){return pe(this,null,function*(){var t,s;let c=this.props.schema.val;if(typeof c=="string"&&c.includes("${")){c=this.getPattern(c,null,!0);const i=yield this.props.oContext.socket.getObject(this.props.schema.id);((t=i==null?void 0:i.common)==null?void 0:t.type)==="number"?c=parseFloat(c):((s=i==null?void 0:i.common)==null?void 0:s.type)==="boolean"&&(c=c==="true"||c===!0||c==="1"||c===1)}const e=(this.props.schema.id||"").replace(/%INSTANCE%/g,(this.props.oContext.instance||0).toString());try{yield this.props.oContext.socket.setState(e,{val:c,ack:!!this.props.schema.ack}),this.props.schema.okText&&window.alert(this.getText(this.props.schema.okText))}catch(i){this.props.schema.error&&this.props.schema.error[i.toString()]?window.alert(this.getText(this.props.schema.error[i.toString()])):window.alert(a.I18n.t(i.toString())||a.I18n.t("ra_Error"))}})}renderDialogConfirm(){if(!this.state.confirmDialog)return null;const c=this.state.confirmData||this.props.schema.confirm;let e=null;return c.type==="warning"?e=n().createElement(u.Warning,null):c.type==="error"?e=n().createElement(u.Error,null):c.type==="info"&&(e=n().createElement(u.Info,null)),n().createElement(a.DialogConfirm,{title:this.getText(c.title)||a.I18n.t("ra_Please confirm"),text:this.getText(c.text),ok:this.getText(c.ok)||a.I18n.t("ra_Ok"),cancel:this.getText(c.cancel)||a.I18n.t("ra_Cancel"),icon:e,onClose:t=>this.setState({confirmDialog:!1},()=>t&&this._onClick())})}renderItem(c,e){return n().createElement(o.Button,{variant:this.props.schema.variant||void 0,color:this.props.schema.color||"grey",style:yn.fullWidth,disabled:e,onClick:()=>pe(this,null,function*(){this.props.schema.confirm?this.setState({confirmDialog:!0}):yield this._onClick()})},this.props.schema.icon?n().createElement(a.Icon,{src:this.props.schema.icon,style:yn.icon}):null,this.getText(this.props.schema.label,this.props.schema.noTranslation))}}const Qn=Zn,En={fullWidth:{width:"100%"},slider:{marginLeft:10,marginRight:10,width:"calc(100% - 20px)"}};class es extends f{componentDidMount(){super.componentDidMount();const c=f.getValue(this.props.data,this.props.attr);this.setState({_value:c})}static getDerivedStateFromProps(c,e){if(c.schema.min!==void 0&&c.schema.min<0||c.schema.max!==void 0&&c.schema.max<0)return null;const t=f.getValue(c.data,c.attr);return t==null||t.toString()!==parseFloat(e._value).toString()?{_value:t}:null}renderItem(c,e){const t=this.props.schema.min||0,s=this.props.schema.max||100,i=this.props.schema.unit?this.getText(this.props.schema.unit,this.props.schema.noTranslation):"",r=[{value:t,label:t+i},{value:s,label:s+i}];return n().createElement(o.Box,{style:En.fullWidth},this.props.schema.label?n().createElement(o.Typography,{gutterBottom:!0},this.getText(this.props.schema.label)):null,n().createElement(o.Slider,{style:En.slider,value:this.state._value,getAriaValueText:l=>l+i,step:this.props.schema.step||(s-t)/100,valueLabelDisplay:"auto",marks:r,min:t,max:s,disabled:!!e,onChange:l=>{const h=l.target.value;this.setState({_value:h},()=>this.onChange(this.props.attr,h))}}),this.props.schema.help?n().createElement(o.Typography,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const ts=es;function dt(E,c){return E==="edit"||E==="rename"?n().createElement(u.Edit,{style:c}):E==="delete"?n().createElement(u.Delete,{style:c}):E==="refresh"?n().createElement(u.Refresh,{style:c}):E==="newDevice"||E==="new"||E==="add"?n().createElement(u.Add,{style:c}):E==="discover"||E==="search"?n().createElement(u.Search,{style:c}):E==="unpairDevice"||E==="unpair"?n().createElement(u.LinkOff,{style:c}):E==="pairDevice"||E==="pair"?n().createElement(u.Link,{style:c}):E==="identify"?n().createElement(u.NotListedLocation,{style:c}):E==="play"?n().createElement(u.PlayArrow,{style:c}):E==="stop"?n().createElement(u.Stop,{style:c}):E==="pause"?n().createElement(u.Pause,{style:c}):E==="forward"||E==="next"?n().createElement(u.FastForward,{style:c}):E==="rewind"||E==="previous"?n().createElement(u.FastRewind,{style:c}):E==="lamp"||E==="light"?n().createElement(u.Lightbulb,{style:c}):E==="backlight"?n().createElement(u.Fluorescent,{style:c}):E==="dimmer"?n().createElement(u.WbIncandescent,{style:c}):E==="socket"?n().createElement(u.Power,{style:c}):E==="settings"?n().createElement(u.Settings,{style:c}):E==="users"||E==="group"?n().createElement(u.Group,{style:c}):E==="user"?n().createElement(u.Person,{style:c}):E==="qrcode"?n().createElement(u.QrCode,{style:c}):E==="connection"?n().createElement(u.Wifi,{style:c}):E==="no-connection"?n().createElement(u.WifiOff,{style:c}):E==="visible"?n().createElement(u.Visibility,{style:c}):null}function ns(E,c){return typeof c=="string"?{"@keyframes newStateAnimationOnceColor":{"0%":{color:c},"100%":{color:E.palette.mode==="dark"?"#fff":"#000"}},animation:"newStateAnimationOnceColor 2s ease-in-out"}:{"@keyframes newStateAnimationOnce":{"0%":{color:"#00f900"},"80%":{color:E.palette.mode==="dark"?"#518851":"#008000"},"100%":{color:E.palette.mode==="dark"?"#fff":"#000"}},animation:"newStateAnimationOnce 2s ease-in-out"}}class rn extends f{constructor(){super(...arguments);Q(this,"controlTimeout",null);Q(this,"delayedUpdate",{timer:null,value:null});Q(this,"onStateChanged",(e,t)=>{let s=t?t.val:null;this.state.controlType==="button"||this.state.controlType==="switch"?(s=!!s,this.state.stateValue!==s&&this.setState({stateValue:s})):s!==null&&(this.state.controlType==="slider"||this.state.controlType==="number")?(s=parseFloat(s),console.log(`${Date.now()} Received new value: ${s}`),s!==this.state.stateValue?(this.delayedUpdate.timer&&(clearTimeout(this.delayedUpdate.timer),this.delayedUpdate.timer=null),this.delayedUpdate.value=s,this.delayedUpdate.timer=setTimeout(()=>{this.setState({stateValue:this.delayedUpdate.value})},500)):this.delayedUpdate.timer&&(clearTimeout(this.delayedUpdate.timer),this.delayedUpdate.timer=null)):this.state.stateValue.toString()!==s.toString()&&this.setState({stateValue:s})})}getObjectID(){return this.props.schema.foreign?this.props.schema.oid:`${this.props.schema.system?"system.adapter.":""}${this.props.oContext.adapterName}.${this.props.oContext.instance}.${this.props.schema.oid}`}componentDidMount(){return pe(this,null,function*(){nt(rn.prototype,this,"componentDidMount").call(this);const e=yield this.props.oContext.socket.getObject(this.getObjectID()),t=this.props.schema.control||this.detectType(e),s=yield this.props.oContext.socket.getState(this.getObjectID());this.setState({stateValue:s?s.val:null,controlType:t,obj:e},()=>pe(this,null,function*(){yield this.props.oContext.socket.subscribeState(this.getObjectID(),this.onStateChanged)}))})}componentWillUnmount(){super.componentWillUnmount(),this.props.oContext.socket.unsubscribeState(this.getObjectID(),this.onStateChanged),this.delayedUpdate.timer&&(clearTimeout(this.delayedUpdate.timer),this.delayedUpdate.timer=null),this.controlTimeout&&(clearTimeout(this.controlTimeout),this.controlTimeout=null,this.props.oContext.socket.setState(this.getObjectID(),this.state.stateValue,!1).catch(e=>console.error(`Cannot control value: ${e}`)))}detectType(e){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(e,t){if(!this.state.obj)return null;let s;if(this.state.controlType==="button"){let i=null;this.props.schema.falseImage&&(i=dt(this.props.schema.falseImage));const r=this.getText(this.props.schema.falseText||this.props.schema.label,this.props.schema.noTranslation);!r&&i?s=n().createElement(o.IconButton,{style:this.props.schema.falseTextStyle,disabled:!!this.props.schema.readOnly,onClick:()=>pe(this,null,function*(){this.props.schema.confirm?this.setState({confirmDialog:!0,confirmCallback:l=>pe(this,null,function*(){l&&(yield this.props.oContext.socket.setState(this.getObjectID(),!0,!1))})}):yield this.props.oContext.socket.setState(this.getObjectID(),!0,!1)})},i):s=n().createElement(o.Button,{variant:this.props.schema.variant||"contained",startIcon:i,style:this.props.schema.falseTextStyle,disabled:t||!!this.props.schema.readOnly,onClick:()=>pe(this,null,function*(){this.props.schema.confirm?this.setState({confirmDialog:!0,confirmCallback:l=>pe(this,null,function*(){l&&(yield this.props.oContext.socket.setState(this.getObjectID(),!0,!1))})}):yield this.props.oContext.socket.setState(this.getObjectID(),!0,!1)})},r||this.getObjectID().split(".").pop())}else if(this.state.controlType==="input")s=n().createElement(o.TextField,{style:{width:"100%"},value:this.state.stateValue,variant:"standard",slotProps:{input:{endAdornment:this.getText(this.props.schema.unit,this.props.schema.noTranslation)||this.state.obj.common.unit||void 0},htmlInput:{readOnly:!!this.props.schema.readOnly}},onChange:i=>{this.setState({stateValue:i.target.value},()=>{this.controlTimeout&&clearTimeout(this.controlTimeout),this.controlTimeout=setTimeout(()=>pe(this,null,function*(){this.controlTimeout=null,yield this.props.oContext.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 i=this.props.schema.min===void 0?this.state.obj.common.min||0:this.props.schema.min,r=this.props.schema.max===void 0?this.state.obj.common.max===void 0?100:this.state.obj.common.max:this.props.schema.max,l=this.props.schema.step===void 0?this.state.obj.common.step||1:this.props.schema.step;s=n().createElement(o.TextField,{variant:"standard",style:{width:"100%"},value:this.state.stateValue,type:"number",slotProps:{htmlInput:{min:i,max:r,step:l,readOnly:!!this.props.schema.readOnly},input:{endAdornment:this.getText(this.props.schema.unit,this.props.schema.noTranslation)||this.state.obj.common.unit||void 0}},onChange:h=>{this.setState({stateValue:h.target.value},()=>{this.controlTimeout&&clearTimeout(this.controlTimeout),this.controlTimeout=setTimeout(()=>pe(this,null,function*(){this.controlTimeout=null;const S=parseFloat(this.state.stateValue);yield this.props.oContext.socket.setState(this.getObjectID(),S,!1)}),this.props.schema.controlDelay||0)})},label:this.getText(this.props.schema.label,this.props.schema.noTranslation),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}else{let i;this.props.schema.size==="normal"?i=16:this.props.schema.size==="large"?i=20:typeof this.props.schema.size=="number"&&(i=this.props.schema.size);let r=this.getText(this.props.schema.label,this.props.schema.noTranslation);const l={display:"flex",alignItems:"center",fontSize:i||"1rem",gap:8};this.props.schema.narrow||(l.width="100%",l.justifyContent="space-between"),r.trim()&&!r.trim().endsWith(":")&&this.props.schema.addColon&&(r=`${r.trim()}:`);let h;this.props.schema.blinkOnUpdate&&(h=ns(this.props.oContext.theme,this.props.schema.blinkOnUpdate));let S;this.props.schema.labelIcon&&(S=n().createElement(a.Icon,{src:this.props.schema.labelIcon,style:{marginRight:4}}));let L;if(r&&S?L=n().createElement("div",{style:{whiteSpace:"nowrap"}},S,r):r?L=n().createElement("div",{style:{whiteSpace:"nowrap"}},r):S&&(L=S),this.state.controlType==="switch"){let O=null;const N=this.getText(this.props.schema.falseText,this.props.schema.noTranslation);this.props.schema.falseImage&&(O=dt(this.props.schema.falseImage,N?{marginLeft:8}:void 0));let te=null;const ye=this.getText(this.props.schema.trueText,this.props.schema.noTranslation);this.props.schema.trueImage&&(te=dt(this.props.schema.trueImage,ye?{marginRight:8}:void 0)),s=n().createElement(o.Switch,{checked:!!this.state.stateValue,disabled:!!this.props.schema.readOnly,onChange:()=>pe(this,null,function*(){this.props.schema.confirm?this.setState({confirmDialog:!0,confirmCallback:se=>pe(this,null,function*(){se&&(yield this.props.oContext.socket.setState(this.getObjectID(),!this.state.stateValue,!1))})}):yield this.props.oContext.socket.setState(this.getObjectID(),!this.state.stateValue,!1)})}),(N||O||ye||te)&&(s=n().createElement("div",{style:{display:"flex",alignItems:"center",fontSize:14}},n().createElement("span",{style:this.props.schema.falseTextStyle},N,O),s,n().createElement("span",{style:this.props.schema.trueTextStyle},te,ye))),L&&(s=n().createElement("div",{style:l},L,s))}else if(this.state.controlType==="slider"){let O=null;const N=this.getText(this.props.schema.falseText,this.props.schema.noTranslation);this.props.schema.falseImage&&(O=dt(this.props.schema.falseImage,N?{marginLeft:8}:void 0));let te=null;const ye=this.getText(this.props.schema.trueText,this.props.schema.noTranslation);this.props.schema.trueImage&&(te=dt(this.props.schema.trueImage,ye?{marginRight:8}:void 0));const se=this.props.schema.min===void 0?this.state.obj.common.min||0:this.props.schema.min,Ee=this.props.schema.max===void 0?this.state.obj.common.max===void 0?100:this.state.obj.common.max:this.props.schema.max,me=this.props.schema.step===void 0?this.state.obj.common.step||1:this.props.schema.step;s=n().createElement(o.Slider,{style:{width:"100%",flexGrow:1},min:se,max:Ee,disabled:!!this.props.schema.readOnly,step:me,value:this.state.stateValue,valueLabelDisplay:"auto",valueLabelFormat:Me=>`${Me}${this.getText(this.props.schema.unit,this.props.schema.noTranslation)||this.state.obj.common.unit||""}`,onChange:(Me,yt)=>{this.setState({stateValue:yt},()=>{this.controlTimeout&&clearTimeout(this.controlTimeout),this.controlTimeout=setTimeout(()=>pe(this,null,function*(){console.log(`${Date.now()} Send new value: ${this.state.stateValue}`),this.controlTimeout=null,yield this.props.oContext.socket.setState(this.getObjectID(),this.state.stateValue,!1)}),this.props.schema.controlDelay||0)})}}),(N||O||ye||te)&&(s=n().createElement("div",{style:{display:"flex",width:"100%",flexGrow:1,alignItems:"center"}},n().createElement("span",{style:q({marginRight:16},this.props.schema.falseTextStyle)},N,O),s,n().createElement("span",{style:q({marginLeft:16},this.props.schema.trueTextStyle)},te,ye))),L&&(s=n().createElement("div",{style:l},L,s))}else if(this.state.obj.common.type==="boolean"){let O=null,N,te;this.state.stateValue?(N=this.getText(this.props.schema.trueText,this.props.schema.noTranslation),this.props.schema.trueImage&&(O=dt(this.props.schema.falseImage,N?{marginRight:8}:void 0)),te=this.props.schema.trueTextStyle):(N=this.getText(this.props.schema.falseText,this.props.schema.noTranslation),this.props.schema.falseImage&&(O=dt(this.props.schema.falseImage,N?{marginLeft:8}:void 0)),te=this.props.schema.falseTextStyle),te=Object.assign(l,te),s=n().createElement("div",{style:te},L,n().createElement(o.Box,{style:{display:"flex",alignItems:"center",gap:8},sx:h,key:this.props.schema.blinkOnUpdate?N:void 0},O,N||(this.state.stateValue?a.I18n.t("ra_true"):a.I18n.t("ra_false"))))}else{const O=this.getText(this.props.schema.unit,this.props.schema.noTranslation)||this.state.obj.common.unit;let N,te;this.state.controlType==="html"?(te=(this.state.stateValue||"").toString(),N=n().createElement("span",{dangerouslySetInnerHTML:{__html:this.state.stateValue}})):this.state.stateValue===null?(N="null",te=N):this.state.stateValue===void 0?(N="undefined",te=N):(N=this.state.stateValue.toString(),te=N),s=n().createElement("div",{style:l},L,n().createElement("div",{style:{display:"flex",alignItems:"baseline",gap:4}},n().createElement(o.Box,{sx:h,key:this.props.schema.blinkOnUpdate?te:void 0},N),O?n().createElement("span",{style:{opacity:.7,fontSize:"smaller"}},O):null))}}return s}}const ss=rn,an={fullWidth:E=>({width:"100%",backgroundColor:E.palette.mode==="dark"?"#FFF":"#000",borderStyle:"hidden"}),primary:E=>({backgroundColor:E.palette.primary.main}),secondary:E=>({backgroundColor:E.palette.secondary.main})};class is extends f{renderItem(){return n().createElement(o.Box,{component:"hr",sx:a.Utils.getStyle(this.props.oContext.theme,an.fullWidth,this.props.schema.color==="primary"?an.primary:this.props.schema.color==="secondary"?an.secondary:{backgroundColor:this.props.schema.color||(this.props.oContext.themeType==="dark"?"#333":"#ddd")},{height:this.props.schema.color?this.props.schema.height||2:this.props.schema.height||1})})}}const os=is,rs={header:E=>({width:"100%",background:E.palette.primary.main,color:E.palette.primary.contrastText,padding:"4px !important",borderRadius:"3px",marginBlockEnd:0,marginBlockStart:0})};class as extends f{renderItem(){let c="h5";switch((this.props.schema.size||5).toString()){case"1":c="h1";break;case"2":c="h2";break;case"3":c="h3";break;case"4":c="h4";break;case"5":default:c="h5";break}return n().createElement(o.Box,{component:c,sx:rs.header},this.getText(this.props.schema.label||this.props.schema.text,this.props.schema.noTranslation))}}const ls=as;class us extends f{renderItem(){let c=this.props.schema.src;return c&&!c.startsWith(".")&&!c.startsWith("http")&&!c.startsWith(`adapter/${this.props.oContext.adapterName}/`)&&!c.startsWith(`./adapter/${this.props.oContext.adapterName}/`)&&(c=`adapter/${this.props.oContext.adapterName}/${c}`),n().createElement("img",{src:c,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 cs=us;function bn(E,c,e){return typeof e=="string"?{"@keyframes newValueAnimationOnceColor":{"0%":{color:c?`${e} !important`:e},"100%":{color:E.palette.mode==="dark"?c?"#fff !important":"#fff":c?"#000 !important":"#000"}},animation:"newValueAnimationOnceColor 2s ease-in-out"}:{"@keyframes newValueAnimationOnce":{"0%":{color:c?"#00f900 !important":"#00f900"},"80%":{color:E.palette.mode==="dark"?c?"#518851 !important":"#518851":c?"#008000 !important":"#008000"},"100%":{color:E.palette.mode==="dark"?c?"#fff !important":"#fff":c?"#000 !important":"#000"}},animation:"newValueAnimationOnce 2s ease-in-out"}}function xn(E,c){return typeof c=="string"?{"@keyframes blinkAnimationColor":{"0%":{color:c},"100%":{color:E.palette.mode==="dark"?"#fff":"#000"}},animation:"blinkAnimationColor 2s ease-in-out infinite"}:{"@keyframes blinkAnimation":{"0%":{color:"#00f900"},"80%":{color:E.palette.mode==="dark"?"#518851":"#008000"},"100%":{color:E.palette.mode==="dark"?"#fff":"#000"}},animation:"blinkAnimation 2s ease-in-out infinite"}}const St={label:{fontWeight:"bold",whiteSpace:"nowrap"},valueImage:{maxHeight:"100%"},valueAndUnit:{display:"flex",gap:4,alignItems:"baseline"},value:{},unit:{fontSize:"smaller",opacity:.7}};class hs extends f{renderItem(c){let e=this.getText(this.props.schema.text||this.props.schema.label,this.props.schema.noTranslation);this.props.schema.addColon&&typeof e=="string"&&!e.trim().endsWith(":")&&(e=`${e.trim()}:`),e&&(e.includes("<a ")||e.includes("<br")||e.includes("<b>")||e.includes("<i>"))&&(e=a.Utils.renderTextWithA(e));let t;this.props.schema.size==="normal"?t=16:this.props.schema.size==="large"?t=20:typeof this.props.schema.size=="number"&&(t=this.props.schema.size);const s={width:"100%",height:"100%",display:"flex",alignItems:"center",position:"relative",fontSize:t};this.props.schema.narrow?s.gap=8:s.justifyContent="space-between";let i,r;this.props.schema.data&&typeof this.props.schema.data=="object"&&this.props.schema.data.en?r=this.getText(this.props.schema.data):typeof this.props.schema.data=="object"||this.props.schema.data===void 0||this.props.schema.data===null?r=JSON.stringify(this.props.schema.data):typeof this.props.schema.data=="number"?(r=this.props.schema.data.toString(),this.props.oContext.isFloatComma&&(r=r.replace(".",","))):(!this.props.schema.booleanAsCheckbox||typeof this.props.schema.data!="boolean")&&(r=this.props.schema.data.toString());let l=!1;if(this.props.schema.booleanAsCheckbox&&typeof this.props.schema.data=="boolean")i=n().createElement(o.Checkbox,{checked:!!i,disabled:!0,size:this.props.schema.size==="small"?"small":this.props.schema.size==="large"?"large":void 0});else if(r.startsWith("data:image/"))i=n().createElement("div",{style:q(q(q({},St.value),St.valueImage),this.props.schema.styleValue||void 0)},n().createElement(a.Icon,{src:r}));else{const O=q(q({},St.value),this.props.schema.styleValue||void 0);this.props.schema.html?i=n().createElement("div",{style:O,dangerouslySetInnerHTML:{__html:r}}):Array.isArray(this.props.schema.data)?(l=!0,i=n().createElement("div",{style:O},this.props.schema.data.map((N,te)=>n().createElement("div",{key:te},typeof N=="object"||N===null||N===void 0?JSON.stringify(N):N)))):r.includes(`
|
|
2
|
-
`)?(l=!0,i=n().createElement("div",{style:O},a.Utils.renderTextWithA(r))):i=n().createElement("div",{style:O},r)}if(this.props.schema.blinkOnUpdate&&this.props.schema.blink){const O=bn(this.props.oContext.theme,!0,this.props.schema.blinkOnUpdate),N=xn(this.props.oContext.theme,this.props.schema.blink);i=n().createElement(o.Box,{key:r,sx:q(q({},O),N)},i)}else if(this.props.schema.blinkOnUpdate){const O=bn(this.props.oContext.theme,!1,this.props.schema.blinkOnUpdate);i=n().createElement(o.Box,{key:r,sx:O},i)}else if(this.props.schema.blink){const O=xn(this.props.oContext.theme,this.props.schema.blink);i=n().createElement(o.Box,{sx:O},i)}this.props.schema.unit&&(i=n().createElement("div",{style:St.valueAndUnit},i,n().createElement("div",{style:q(q({},St.unit),this.props.schema.styleUnit||void 0)},this.getText(this.props.schema.unit,this.props.schema.noTranslation))));let h;this.props.schema.labelIcon&&(h=n().createElement(a.Icon,{src:this.props.schema.labelIcon,style:{marginRight:4}}));let S;this.props.schema.copyToClipboard&&(S=n().createElement(u.ContentCopy,{className:"staticCopyButton",style:{position:"absolute",top:"calc(50% - 12px)",right:0,cursor:"pointer"},onClick:()=>{a.Utils.copyToClipboard(r),window.alert(a.I18n.t("ra_Copied"))}}));const L={"& .staticCopyButton":{display:"none"},"& .staticCopyButton:action":{transform:"scale(0.9)"},"&:hover .staticCopyButton":{display:"block"}};return this.props.schema.highlight&&(L["&:hover"]={backgroundColor:this.props.oContext.themeType==="dark"?"#51515180":"#b8b8b880"}),l&&(s.alignItems="top"),n().createElement(o.Box,{component:"div",style:s,sx:L},n().createElement("div",{style:q(q({},St.label),this.props.schema.styleLabel||void 0)},h,e),i,S)}}const ps=hs,wn={fullWidth:{height:"100%",width:"100%"},link:E=>({textDecoration:"underline",color:E.palette.mode==="dark"?"#4dabf5":"#254e72",cursor:"pointer"})};function An(E,c,e){let t,s="";E?E.toString().startsWith("#")||E.toString().startsWith("/")?(t=c||"_self",s=E):E.startsWith("http://")||E.startsWith("https://")?(t=c||"_blank",s=E):(s=`#tab-instances/config/${e}/${E}`,t=c||"_self"):(s=`#tab-instances/config/${e}`,t=c||"_self"),t==="_self"?setTimeout(i=>{i.startsWith("#")?window.location.hash=i:i.startsWith("/")?s=`${window.location.protocol}:${window.location.host}${s}`:(i.startsWith("http://")||i.startsWith("https://"))&&(window.location.href=i)},100,s):(s.startsWith("#")?s=`${window.location.protocol}:${window.location.host}${window.location.pathname}${s}`:s.startsWith("/")&&(s=`${window.location.protocol}:${window.location.host}${s}`),window.open(s,t))}class ds extends f{renderItem(c,e){if(this.props.schema.button){const s=this.getIcon();return n().createElement(o.Button,{variant:this.props.schema.variant||void 0,color:this.props.schema.color||"grey",style:q(q({},wn.fullWidth),this.props.schema.controlStyle||void 0),disabled:e,startIcon:s,onClick:this.props.schema.href?()=>{const i=this.props.schema.href?this.getText(this.props.schema.href,!0):null;i&&(this.props.oContext.onBackEndCommand?this.props.oContext.onBackEndCommand({command:"link",url:i,target:this.props.schema.target,close:this.props.schema.close}):An(i,this.props.schema.target,`${this.props.oContext.adapterName}.${this.props.oContext.instance}`))}:null},this.getText(this.props.schema.text||this.props.schema.label,this.props.schema.noTranslation))}let 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=a.Utils.renderTextWithA(t)),n().createElement(o.Box,{component:"span",style:q({},this.props.schema.controlStyle||void 0),sx:this.props.schema.href?wn.link:void 0,onClick:this.props.schema.href?()=>{const s=this.props.schema.href?this.getText(this.props.schema.href,!0):null;s&&(this.props.oContext.onBackEndCommand?this.props.oContext.onBackEndCommand({command:"link",url:s,target:this.props.schema.target||"_blank",close:this.props.schema.close}):An(s,this.props.schema.target||"_blank",`${this.props.oContext.adapterName}.${this.props.oContext.instance}`))}:null},t)}}const Fn=ds,ln=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 ms(E,c,e){c=c||"key";const t=[];return Object.keys(E).forEach(s=>{const i={};i[c]=s,e?(i[e]=E[s],t.push(i)):t.push(Object.assign(i,E[s]))}),t}function Sn(E,c,e){c=c||"key";const t={};return E.forEach(s=>{let i=s[c];i==null&&(i=""),delete s[c],e?t[i]=s[e]:t[i]=s}),t}function fs(E,c){let e="";for(let t=0;t<c.length;t++)e+=String.fromCharCode(E[t%E.length].charCodeAt(0)^c.charCodeAt(t));return e}function gs(E,c){let e="";for(let t=0;t<c.length;t++)e+=String.fromCharCode(E[t%E.length].charCodeAt(0)^c.charCodeAt(t));return e}class He extends f{constructor(e){super(e);Q(this,"filterRefs");Q(this,"typingTimer",null);Q(this,"secret","Zgfr56gFe87jJOM");Q(this,"handleRequestSort",(e,t=!1)=>{const{order:s,orderBy:i}=this.state;if(i){const l=t?s:i===e&&s==="asc"?"desc":"asc",h=this.stableSort(l,e);this.setState({order:l,orderBy:e,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,h))}});Q(this,"stableSort",(e,t)=>{const{value:s}=this.state,i=He.getComparator(e,t),r=s.map((l,h)=>({el:l,index:h}));return r.sort((l,h)=>{const S=i(l.el,h.el);return S!==0?S:l.index-h.index}),r.map(l=>l.el)});Q(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)))});Q(this,"onClone",e=>()=>{const t=JSON.parse(JSON.stringify(this.state.value)),s=JSON.parse(JSON.stringify(t[e]));if(typeof this.props.schema.clone=="string"&&typeof s[this.props.schema.clone]=="string"){let i=1,r=s[this.props.schema.clone];const l=r.match(/(\d+)$/);for(l?(r=r.replace(l[0],""),i=parseInt(l[0],10)+1):r+="_";t.find(h=>h[this.props.schema.clone]===r+i.toString());)i++;s[this.props.schema.clone]=`${s[this.props.schema.clone]}_${i}`}t.splice(e,0,s),this.setState({value:t,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(t)))});Q(this,"onChangeWrapper",(e,t)=>{this.typingTimer&&clearTimeout(this.typingTimer),this.typingTimer=setTimeout((s,i)=>{this.typingTimer=null;let r;if(this.props.schema.encryptedAttributes){const l=JSON.parse(JSON.stringify(s));if(l.forEach(h=>{this.props.schema.encryptedAttributes.forEach(S=>{h[S]&&(h[S]=fs(this.secret,h[S]))})}),this.props.schema.objKeyName){const h=Sn(l,this.props.schema.objKeyName,this.props.schema.objValueName);r=this.onChange(this.props.attr,h)}else r=this.onChange(this.props.attr,l)}else if(this.props.schema.objKeyName){const l=Sn(JSON.parse(JSON.stringify(s)),this.props.schema.objKeyName,this.props.schema.objValueName);r=this.onChange(this.props.attr,l)}else r=this.onChange(this.props.attr,s);r instanceof Promise&&r.catch(l=>console.error(`Cannot save: ${l}`)),i&&(this.applyFilter(!1,s),this.handleRequestSort(this.state.orderBy,!0))},300,e,t)});Q(this,"onAdd",()=>{var i;const{schema:e}=this.props,t=JSON.parse(JSON.stringify(this.state.value)),s=(i=e.items)==null?void 0:i.reduce((r,l)=>{let h;return l.defaultFunc?this.props.custom?h=l.defaultFunc?this.executeCustom(l.defaultFunc,this.props.data,this.props.customObj,this.props.oContext.instanceObj,t.length,this.props.data):this.props.schema.default:h=l.defaultFunc?this.execute(l.defaultFunc,this.props.schema.default,this.props.data,t.length,this.props.data):this.props.schema.default:h=l.default===void 0?null:l.default,r[l.attr]=h,r},{});t.push(s),this.setState({value:t},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(t)))});Q(this,"applyFilter",(e,t,s)=>{t=t||this.state.value;let i=t.map((r,l)=>l);if(Object.keys(this.filterRefs).forEach(r=>{let l=He.getFilterValue(this.filterRefs[r]);!e&&l?(l=l.toLowerCase(),i=i.filter(h=>t[h]&&t[h][r]&&t[h][r].toLowerCase().includes(l))):this.filterRefs[r].current&&He.setFilterValue(this.filterRefs[r],"")}),i.length===t.length&&(i=null),i===null&&this.state.visibleValue===null){s&&s();return}JSON.stringify(i)!==JSON.stringify(this.state.visibleValue)?this.setState({visibleValue:i},()=>s&&s()):s&&s()});this.filterRefs={},this.props.schema.items=this.props.schema.items||[],this.props.schema.items.forEach(t=>{t.filter&&(this.filterRefs[t.attr]=(0,T.createRef)())})}componentDidMount(){return pe(this,null,function*(){nt(He.prototype,this,"componentDidMount").call(this);const e=f.getValue(this.props.data,this.props.attr)||[];let t;if(this.props.schema.objKeyName?t=ms(e,this.props.schema.objKeyName,this.props.schema.objValueName):t=e,Array.isArray(t)||(t=[]),this.props.schema.encryptedAttributes){const s=yield this.props.oContext.socket.getCompactSystemConfig();this.secret=(s==null?void 0:s.native.secret)||this.secret,e.forEach(i=>{this.props.schema.encryptedAttributes.forEach(r=>{i[r]&&(i[r]=gs(this.secret,i[r]))})})}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,s){const{schema:i}=this.props,r=i.items&&i.items.find(h=>h.attr===e);if(!r)return null;const l={items:{[e]:r}};return n().createElement(Ot,{oContext:this.props.oContext,alive:this.props.alive,arrayIndex:s,changed:this.props.changed,common:this.props.common,custom:!0,data:t,globalData:this.props.data,index:s+this.state.iteration,onChange:(h,S)=>{const L=JSON.parse(JSON.stringify(this.state.value));L[s][h]=S,this.setState({value:L},()=>{this.validateUniqueProps(),this.onChangeWrapper(L,!0)})},onError:(h,S)=>this.onError(h,S),originalData:this.props.originalData,schema:l,table:!0,themeName:this.props.themeName})}validateUniqueProps(){if(this.props.schema.uniqueColumns)for(const e of this.props.schema.uniqueColumns){const t=[];this.state.value.find(i=>{const r=i[e];return t.includes(r)?(this.onError(e,"is not unique"),this.setState({errorMessage:a.I18n.t('Non-allowed duplicate entry "%s" in column "%s"',r,e)}),!0):(t.push(r),!1)})||(this.onError(e,null),this.setState({errorMessage:""}))}}static descendingComparator(e,t,s){return t[s]<e[s]?-1:t[s]>e[s]?1:0}static getComparator(e,t){return e==="desc"?(s,i)=>He.descendingComparator(s,i,t):(s,i)=>-He.descendingComparator(s,i,t)}static getFilterValue(e){var t,s,i;return(i=(s=(t=e==null?void 0:e.current)==null?void 0:t.children[0])==null?void 0:s.children[0])==null?void 0:i.value}static setFilterValue(e,t){return e.current.children[0].children[0].value=t}enhancedTableHead(e,t){const{schema:s}=this.props,{order:i,orderBy:r}=this.state;return n().createElement(o.TableHead,null,n().createElement(o.TableRow,null,s.items&&s.items.map((l,h)=>n().createElement(o.TableCell,{style:{width:(typeof l.width=="string"&&l.width.endsWith("%"),l.width)},key:`${l.attr}_${h}`,align:"left",sortDirection:r===l.attr?i:!1},n().createElement("div",{style:q(q({},Fe.flex),s.showFirstAddOnTop?{flexDirection:"column"}:void 0)},!h&&!s.noDelete?n().createElement(o.Tooltip,{title:t?a.I18n.t("ra_Cannot add items with set filter"):a.I18n.t("ra_Add row"),slotProps:{popper:{sx:Fe.tooltip}}},n().createElement("span",null,n().createElement(o.IconButton,{size:"small",color:"primary",disabled:!!t&&!this.props.schema.allowAddByFilter,onClick:this.onAdd},n().createElement(u.Add,null)))):null,l.sort&&n().createElement(o.TableSortLabel,{active:!0,style:r!==l.attr?Fe.silver:void 0,direction:r===l.attr?i:"asc",onClick:()=>this.handleRequestSort(l.attr)}),l.filter&&this.state.filterOn.includes(l.attr)?n().createElement(o.TextField,{variant:"standard",ref:this.filterRefs[l.attr],onChange:()=>this.applyFilter(),title:a.I18n.t("ra_You can filter entries by entering here some text"),slotProps:{input:{endAdornment:He.getFilterValue(this.filterRefs[l.attr])&&n().createElement(o.InputAdornment,{position:"end"},n().createElement(o.IconButton,{size:"small",onClick:()=>{He.setFilterValue(this.filterRefs[l.attr],""),this.applyFilter()}},n().createElement(u.Close,null)))}},fullWidth:!0,placeholder:this.getText(l.title)}):n().createElement("span",{style:Fe.headerText},this.getText(l.title)),l.filter?n().createElement(o.IconButton,{title:a.I18n.t("ra_Show/hide filter input"),size:"small",onClick:()=>{const S=[...this.state.filterOn],L=this.state.filterOn.indexOf(l.attr);L===-1?S.push(l.attr):S.splice(L,1),this.setState({filterOn:S},()=>{L&&He.getFilterValue(this.filterRefs[l.attr])&&(He.setFilterValue(this.filterRefs[l.attr],""),this.applyFilter())})}},this.state.filterOn.includes(l.attr)?n().createElement(u.FilterAltOff,null):n().createElement(u.FilterAlt,null)):null))),!s.noDelete&&n().createElement(o.TableCell,{style:{paddingLeft:20,paddingRight:20,width:e,textAlign:"right"},padding:"checkbox"},s.import?n().createElement(o.IconButton,{style:{marginRight:10},size:"small",onClick:()=>this.setState({showImportDialog:!0}),title:a.I18n.t("ra_import data from %s file","CSV")},n().createElement(u.UploadFile,null)):null,s.export?n().createElement(o.IconButton,{style:{marginRight:10},size:"small",onClick:()=>this.onExport(),title:a.I18n.t("ra_Export data to %s file","CSV")},n().createElement(u.Download,null)):null,n().createElement(o.IconButton,{disabled:!0,size:"small"},n().createElement(u.Delete,null)))))}onExport(){const{schema:e}=this.props,{value:t}=this.state,i=[e.items.map(h=>h.attr).join(";")];t.forEach(h=>{const S=[];e.items.forEach(L=>{var O;(O=h[L.attr])!=null&&O.includes(";")?S.push(`"${h[L.attr]}"`):S.push(h[L.attr]===void 0||h[L.attr]===null?"":h[L.attr])}),i.push(S.join(";"))});const r=document.createElement("a");r.setAttribute("href",`data:text/csv;charset=utf-8,${encodeURIComponent(i.join(`
|
|
3
|
-
`))}`);const l=new Date;r.setAttribute("download",`${l.getFullYear()}_${(l.getMonth()+1).toString().padStart(2,"0")}_${l.getDate().toString().padStart(2,"0")}_${this.props.oContext.adapterName}.${this.props.oContext.instance}_${this.props.attr}.csv`),r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r)}onImport(e){var l;const t=e.split(`
|
|
4
|
-
`).map(h=>h.replace("\r","").trim()),{schema:s}=this.props,i=t.shift().split(";").filter(h=>h&&s.items.find(S=>S.attr===h)),r=[];t.forEach(h=>{const S=h.split(";"),L={};for(let O=0;O<S.length;O++){let N=S[O];if(N.startsWith('"')){for(N=N.substring(1);O<S.length&&!N.endsWith('"');)N+=`;${S[++O]}`;N=N.substring(0,N.length-1)}let te=N;if(N==="true")te=!0;else if(N==="false")te=!1;else if(window.isFinite(N)){const ye=this.props.schema.items.find(se=>se.attr===i[O]);ye&&ye.type==="number"?te=parseFloat(N):te=N}else te=N;L[i[O]]=te}r.push(L)}),r.length?(l=this.state.value)!=null&&l.length?this.setState({showTypeOfImportDialog:r,showImportDialog:!1}):this.setState({value:r,showImportDialog:!1}):window.alert("ra_No data found in file")}isAnyFilterSet(){return!!Object.keys(this.filterRefs).find(e=>He.getFilterValue(this.filterRefs[e]))}onMoveUp(e){const t=JSON.parse(JSON.stringify(this.state.value)),s=t[e];t.splice(e,1),t.splice(e-1,0,s),this.setState({value:t,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(t)))}onMoveDown(e){const t=JSON.parse(JSON.stringify(this.state.value)),s=t[e];t.splice(e,1),t.splice(e+1,0,s),this.setState({value:t,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(t)))}onDrop(e){const t=e[0],s=new FileReader;s.onabort=()=>console.log("file reading was aborted"),s.onerror=()=>console.log("file reading has failed"),s.onload=()=>{if(t.size>ln){window.alert(a.I18n.t("ra_File is too big. Max %sk allowed. Try use SVG.",Math.round(ln/1024)));return}const i=new Uint8Array(s.result).reduce((r,l)=>r+String.fromCharCode(l),"");this.onImport(i)},s.readAsArrayBuffer(t)}showTypeOfImportDialog(){return this.state.showTypeOfImportDialog?n().createElement(o.Dialog,{open:!0,onClose:()=>this.setState({showTypeOfImportDialog:!1}),maxWidth:"md"},n().createElement(o.DialogTitle,null,a.I18n.t("ra_Append or replace?")),n().createElement(o.DialogContent,null,a.I18n.t("ra_Append %s entries or replace existing?",this.state.showTypeOfImportDialog.length)),n().createElement(o.DialogActions,null,n().createElement(o.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)))}},a.I18n.t("ra_Append")),n().createElement(o.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)))}},a.I18n.t("ra_Replace")))):null}showImportDialog(){return this.state.showImportDialog?n().createElement(o.Dialog,{open:!0,onClose:()=>this.setState({showImportDialog:!1}),sx:{"& .MuiDialog-paper":{minHeight:500}},maxWidth:"md",fullWidth:!0},n().createElement(o.DialogTitle,null,a.I18n.t("ra_Import from %s","CSV")),n().createElement(o.DialogContent,null,n().createElement(De(),{multiple:!1,accept:{"text/csv":[".csv"]},maxSize:ln,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||a.I18n.t("ra_Cannot upload"))}},({getRootProps:e,getInputProps:t})=>n().createElement("div",q({style:q(q(q(q({},Fe.uploadDiv),this.state.uploadFile==="dragging"?Fe.uploadDivDragging:void 0),Fe.dropZone),this.state.icon?void 0:Fe.dropZoneEmpty)},e()),n().createElement("input",q({},t())),n().createElement("div",{style:Fe.uploadCenterDiv},n().createElement("div",{style:Fe.uploadCenterTextAndIcon},n().createElement(u.UploadFile,{style:Fe.uploadCenterIcon}),n().createElement("div",{style:Fe.uploadCenterText},this.state.uploadFile==="dragging"?a.I18n.t("ra_Drop file here"):a.I18n.t("ra_Place your files here or click here to open the browse dialog"))))))),n().createElement(o.DialogActions,null,n().createElement(o.Button,{variant:"contained",onClick:()=>this.setState({showImportDialog:!1}),color:"primary",startIcon:n().createElement(u.Close,null)},a.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((r,l)=>l);const s=this.isAnyFilterSet();let i;return this.props.schema.compact&&(i={paddingTop:1,paddingBottom:1}),n().createElement(o.Paper,{style:Fe.paper},this.showImportDialog(),this.showTypeOfImportDialog(),e.label?n().createElement("div",{style:Fe.label},n().createElement(o.Toolbar,{variant:"dense",style:Fe.rootTool},n().createElement(o.Typography,{style:Fe.title,variant:"h6",id:"tableTitle",component:"div"},this.getText(e.label)))):null,n().createElement(o.TableContainer,null,n().createElement(o.Table,{style:Fe.table,size:"small"},this.enhancedTableHead(!s&&!this.state.orderBy?120:64,s),n().createElement(o.TableBody,null,t.map((r,l)=>n().createElement(o.TableRow,{hover:!0,key:`${r}_${l}`},e.items&&e.items.map(h=>n().createElement(o.TableCell,{key:`${h.attr}_${r}`,align:"left",style:i},this.itemTable(h.attr,this.state.value[r],r))),!e.noDelete&&n().createElement(o.TableCell,{align:"left",style:q(q({},i),Fe.buttonCell)},!s&&!this.state.orderBy?l?n().createElement(o.Tooltip,{title:a.I18n.t("ra_Move up"),slotProps:{popper:{sx:Fe.tooltip}}},n().createElement(o.IconButton,{size:"small",onClick:()=>this.onMoveUp(r)},n().createElement(u.ArrowUpward,null))):n().createElement("div",{style:Fe.buttonEmpty}):null,!s&&!this.state.orderBy?l<t.length-1?n().createElement(o.Tooltip,{title:a.I18n.t("ra_Move down"),slotProps:{popper:{sx:Fe.tooltip}}},n().createElement(o.IconButton,{size:"small",onClick:()=>this.onMoveDown(r)},n().createElement(u.ArrowDownward,null))):n().createElement("div",{style:Fe.buttonEmpty}):null,n().createElement(o.Tooltip,{title:a.I18n.t("ra_Delete current row"),slotProps:{popper:{sx:Fe.tooltip}}},n().createElement(o.IconButton,{size:"small",onClick:this.onDelete(r)},n().createElement(u.Delete,null))),this.props.schema.clone?n().createElement(o.Tooltip,{title:a.I18n.t("ra_Clone current row"),slotProps:{popper:{sx:Fe.tooltip}}},n().createElement(o.IconButton,{size:"small",onClick:this.onClone(r)},n().createElement(u.ContentCopy,null))):null))),!e.noDelete&&t.length>=(e.showSecondAddAt||5)?n().createElement(o.TableRow,null,n().createElement(o.TableCell,{colSpan:e.items.length+1,style:q({},i)},n().createElement(o.Tooltip,{title:s?a.I18n.t("ra_Cannot add items with set filter"):a.I18n.t("ra_Add row"),slotProps:{popper:{sx:Fe.tooltip}}},n().createElement("span",null,n().createElement(o.IconButton,{size:"small",color:"primary",disabled:!!s&&!this.props.schema.allowAddByFilter,onClick:this.onAdd},n().createElement(u.Add,null)))))):null)),!t.length&&this.state.value.length?n().createElement("div",{style:Fe.filteredOut},n().createElement(o.Typography,{style:Fe.title,variant:"h6",id:"tableTitle",component:"div"},a.I18n.t("ra_All items are filtered out"),n().createElement(o.IconButton,{size:"small",onClick:()=>this.applyFilter(!0)},n().createElement(u.Close,null)))):null),e.help?n().createElement(o.FormHelperText,{style:{paddingLeft:16}},this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null,this.state.errorMessage?n().createElement("div",{style:{display:"flex",padding:"5px"}},n().createElement(u.Warning,{color:"error"}),n().createElement("span",{style:{color:"red",alignSelf:"center"}},this.state.errorMessage)):null)}}const Cs=He,jt={indeterminate:{opacity:.5},label:{width:"100%",fontSize:14,marginBottom:2},helper:{width:"100%",fontSize:12},error:{width:"100%",fontSize:12,color:"#FF0000"}};class Ds extends f{constructor(){super(...arguments);Q(this,"updateTimeout",null)}componentDidMount(){super.componentDidMount();let e=f.getValue(this.props.data,this.props.attr);if(Array.isArray(e)&&this.props.oContext.multiEdit){e=f.DIFFERENT_VALUE,this.setState({value:e,oldValue:e,jsonError:!1});return}this.setState({value:e,oldValue:e,jsonError:this.validateJson(e)})}validateJson(e){let t=!1;if(this.props.schema.validateJson&&(e||!this.props.schema.allowEmpty))try{JSON.parse(e)}catch(s){console.log("Error in JSON",s),t=!0}return t}static getDerivedStateFromProps(e,t){if(e.oContext.multiEdit&&t.value===f.DIFFERENT_VALUE)return{value:f.DIFFERENT_VALUE};let s=f.getValue(e.data,e.attr);return s!=null&&(s=s.toString()),s==null||s!==t.value&&s!==t.oldValue?{value:s}:null}renderItem(e,t){const s=Array.isArray(this.state.value)||this.state.value===f.DIFFERENT_VALUE;if(this.props.schema.time){let l="";return typeof this.state.value=="number"?this.state.value&&this.state.value<9466596e5?l=new Date(this.state.value*1e3).toLocaleString():l=new Date(this.state.value).toLocaleString():typeof this.state.value=="string"&&(l=new Date(this.state.value).toLocaleString()),n().createElement(o.TextField,{variant:"standard",fullWidth:!0,value:l,error:!!e||!!this.state.jsonError,disabled:!!t,slotProps:{htmlInput:{readOnly:!0}},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}if(this.state.oldValue!==null&&this.state.oldValue!==void 0?(this.updateTimeout&&clearTimeout(this.updateTimeout),this.updateTimeout=setTimeout(()=>{this.updateTimeout=null,this.setState({oldValue:null})},30)):this.updateTimeout&&(clearTimeout(this.updateTimeout),this.updateTimeout=null),s){const l=f.getValue(this.props.data,this.props.attr),h=(l==null?void 0:l.filter(S=>S||S===0).map(S=>({label:S.toString()||"",value:S})))||[];return h.unshift({label:a.I18n.t(f.DIFFERENT_LABEL),value:f.DIFFERENT_VALUE}),n().createElement(o.Autocomplete,{style:jt.indeterminate,fullWidth:!0,value:h[0],onChange:(S,L)=>{const O=L?L.value:"",N=this.onChange(this.props.attr,O,()=>{this.setState({value:O,oldValue:O,jsonError:this.validateJson(L)})});N instanceof Promise&&N.catch(te=>console.error(`Cannot set value: ${te}`))},options:h,getOptionLabel:S=>S.label,renderInput:S=>n().createElement(o.TextField,Be(q({variant:"standard"},S),{error:!!e,placeholder:this.getText(this.props.schema.placeholder),slotProps:{htmlInput:Be(q({},S.inputProps),{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0,readOnly:this.props.schema.readOnly||!1})},label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation),disabled:!!t}))})}let i,r;if((this.props.schema.readOnly||t)&&this.props.schema.copyToClipboard?(this.props.schema.minRows>1&&(r={position:"absolute",right:3,top:20,zIndex:1e3}),i=n().createElement(o.IconButton,{style:r,size:"small",onClick:()=>{a.Utils.copyToClipboard(this.state.value),window.alert(a.I18n.t("ra_Copied"))}},n().createElement(a.IconCopy,null))):!this.props.schema.readOnly&&!t&&this.state.value&&!this.props.schema.noClearButton&&(this.props.schema.minRows>1&&(r={position:"absolute",right:3,top:20,zIndex:1e3}),i=n().createElement(o.IconButton,{style:r,size:"small",onClick:()=>this.setState({value:"",oldValue:this.state.value},()=>this.onChange(this.props.attr,""))},n().createElement(u.Close,null)),this.props.schema.minRows<=1&&(i=n().createElement(o.InputAdornment,{position:"end"},i))),this.props.schema.minRows>1){const l=this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation);return n().createElement("div",{style:{width:"100%",position:"relative"}},this.props.schema.label?n().createElement("div",{style:jt.label},this.getText(this.props.schema.label)):null,n().createElement(o.TextareaAutosize,{style:{width:"100%",resize:"vertical",backgroundColor:this.props.oContext.themeType==="dark"?"#363636":"#cccccc",color:this.props.oContext.themeType==="dark"?"#fff":"#111"},minRows:this.props.schema.minRows,maxRows:this.props.schema.maxRows,value:this.state.value===null||this.state.value===void 0?"":this.state.value,disabled:!!t,readOnly:this.props.schema.readOnly||!1,onChange:h=>{const S=h.target.value;this.setState({value:S,oldValue:this.state.value,jsonError:this.validateJson(S)},()=>this.onChange(this.props.attr,S||""))},placeholder:this.getText(this.props.schema.placeholder)}),l||e||this.state.jsonError?n().createElement("div",{style:e?jt.error:jt.helper},e||(this.state.jsonError?a.I18n.t("ra_Invalid JSON"):l)):null)}return n().createElement(o.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,slotProps:{htmlInput:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0,readOnly:this.props.schema.readOnly||!1},input:{endAdornment:i}},onChange:l=>{const h=l.target.value;this.setState({value:h,oldValue:this.state.value,jsonError:this.validateJson(h)},()=>this.onChange(this.props.attr,h))},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.state.jsonError?a.I18n.t("ra_Invalid JSON"):this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}}const vs=Ds,ys={fullWidth:{width:"100%"}};class Es extends f{constructor(){super(...arguments);Q(this,"initialized",!1);Q(this,"localContext")}askInstance(){if(this.props.alive){let e=this.props.schema.data;if(e===void 0&&this.props.schema.jsonData){const t=this.getPattern(this.props.schema.jsonData,null,!0);try{e=JSON.parse(t)}catch(s){console.error(`Cannot parse json data: ${t}`)}}e===void 0&&(e=null),this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",e).then(t=>{if(typeof t=="object"){const s=t;this.setState({text:s.text||"",style:s.style,icon:s.icon,iconStyle:s.iconStyle})}else typeof t=="string"&&this.setState({text:t||""})}).catch(t=>console.error(`Cannot send command: ${t}`))}}getLocalContext(){const e={};return Array.isArray(this.props.schema.alsoDependsOn)&&this.props.schema.alsoDependsOn.forEach(t=>e[t]=f.getValue(this.props.data,t)),JSON.stringify(e)}renderItem(){if(this.props.alive){const t=this.getLocalContext();(t!==this.localContext||!this.initialized)&&(this.localContext=t,setTimeout(()=>this.askInstance(),this.initialized?300:50),this.initialized=!0)}if(this.state.text===void 0)return null;let e=null;return this.state.icon&&(e=dt(this.state.icon,q({marginRight:this.state.text?8:void 0},this.state.iconStyle||void 0)),e||(e=n().createElement(a.Icon,{src:this.state.icon,style:q({marginRight:this.state.text?8:void 0},this.state.iconStyle||void 0)}))),this.props.schema.container==="text"?n().createElement(o.TextField,{variant:"standard",fullWidth:!0,slotProps:{input:{endAdornment:this.props.schema.copyToClipboard?n().createElement(o.IconButton,{size:"small",onClick:()=>{a.Utils.copyToClipboard(this.state.text),window.alert(a.I18n.t("ra_Copied"))}},n().createElement(a.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)}):n().createElement("div",{style:q(q({},ys.fullWidth),this.state.style||void 0)},e,this.props.schema.container==="html"?n().createElement("span",{dangerouslySetInnerHTML:{__html:this.state.text||""}}):this.state.text)}}const bs=Es;class xs extends f{componentDidMount(){super.componentDidMount();const c=f.getValue(this.props.data,this.props.attr);this.setState({value:c})}renderItem(c,e){const t=this.props.schema.returnFormat!=="HH:mm:ss",s=new Date(Date.parse(`Thu, 01 Jan 1970 ${this.state.value||"00:00:00"}`));return n().createElement(wt.TimePicker,{sx:i=>({width:"100%",borderBottom:`1px solid ${i.palette.text.primary}`,"& fieldset":{display:"none"},"& input":{padding:`${i.spacing(1.5)} 0 4px 0`},"& .MuiInputAdornment-root":{marginLeft:0,marginTop:1},"& label":{transform:"translate(0px, -9px) scale(0.75)"}}),ampm:this.props.oContext.systemConfig.dateFormat.includes("/"),timeSteps:this.props.schema.timeSteps||this.props.schema.timesteps||{hours:1,minutes:5,seconds:5},format:this.props.schema.format||"HH:mm:ss",disabled:!!e,value:s,onChange:i=>{let r;r=i instanceof Date?i.toTimeString().split(" ")[0]:i.toTimeString(),t&&(r=r.split(":").slice(0,2).join(":")),this.setState({value:r},()=>this.onChange(this.props.attr,this.state.value))},views:this.props.schema.views||["hours","minutes","seconds"],label:this.getText(this.props.schema.label)})}}function ws(E,c){let e;return c&&E.substring(0,c.length)===c?e=E.substring(c.length+1):e=E,e=e.replace(/\./g,"/").replace(/_/g," "),e}class As extends f{componentDidMount(){var e;super.componentDidMount();const c=f.getValue(this.props.data,this.props.attr);if(!c&&((e=this.props.customObj)!=null&&e._id)){const t=ws(this.props.customObj._id,`${this.props.oContext.adapterName}.${this.props.oContext.instance}`);this.setState({value:t})}else this.setState({value:c||""})}renderItem(c,e){return n().createElement(o.TextField,{variant:"standard",fullWidth:!0,slotProps:{htmlInput:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0}},value:this.state.value,error:!!c,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 s=t.target.value;this.setState({value:s},()=>this.onChange(this.props.attr,s))}})}}const Fs=As;class un extends f{componentDidMount(){return pe(this,null,function*(){var e;nt(un.prototype,this,"componentDidMount").call(this);const c=yield this.props.oContext.socket.getObject("system.meta.uuid");this.setState({uuid:((e=c==null?void 0:c.native)==null?void 0:e.uuid)||"unknown"})})}renderItem(c,e){return n().createElement(o.TextField,{variant:"standard",fullWidth:!0,error:!!c,disabled:!!e,slotProps:{htmlInput:{readOnly:!0},input:{endAdornment:n().createElement(o.IconButton,{onClick:()=>{a.Utils.copyToClipboard(this.state.uuid),window.alert(a.I18n.t("ra_Copied %s",this.state.uuid))}},n().createElement(u.ContentCopy,null))}},value:this.state.uuid||"",label:this.getText(this.props.schema.label)||a.I18n.t("ra_Serial number (UUID)"),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}}const Ss=un,Tn={icon:{width:16,height:16,marginRight:8}};class Ts extends f{componentDidMount(){super.componentDidMount(),this.props.oContext.socket.getUsers().then(c=>{const e={},t=a.I18n.getLanguage();this.props.schema.short?c.forEach(s=>{var i,r;return e[s._id]={color:(i=s.common)==null?void 0:i.color,icon:(r=s.common)==null?void 0:r.icon,name:a.Utils.getObjectNameFromObj(s,t)}}):c.forEach(s=>{var i,r;return e[s._id.replace(/^system\.user\./,"")]={color:(i=s.common)==null?void 0:i.color,icon:(r=s.common)==null?void 0:r.icon,name:a.Utils.getObjectNameFromObj(s,t)}}),this.setState({users:e})}).catch(c=>console.error(`Cannot get users: ${c}`))}renderItem(c,e){var s,i;const t=f.getValue(this.props.data,this.props.attr);return n().createElement(o.FormControl,{variant:"standard",fullWidth:!0},this.state.users&&this.props.schema.label?n().createElement(o.InputLabel,null,this.getText(this.props.schema.label)):null,this.state.users?n().createElement(o.Select,{variant:"standard",error:!!c,disabled:!!e,value:t,renderValue:r=>{var l,h,S;return n().createElement("span",null,this.state.users&&((l=this.state.users[r])!=null&&l.icon)?n().createElement(a.Icon,{src:this.state.users&&((h=this.state.users[r])==null?void 0:h.icon),style:Tn.icon}):null,this.state.users&&((S=this.state.users[r])==null?void 0:S.name)||r||"")},style:{color:this.state.users&&((s=this.state.users[t])==null?void 0:s.color)||void 0,backgroundColor:a.Utils.getInvertedColor(this.state.users&&((i=this.state.users[t])==null?void 0:i.color),this.props.oContext.themeType)},onChange:r=>this.onChange(this.props.attr,r.target.value)},this.state.users&&Object.keys(this.state.users).map(r=>n().createElement(o.MenuItem,{style:{color:this.state.users[r].color||void 0,backgroundColor:a.Utils.getInvertedColor(this.state.users[r].color,this.props.oContext.themeType)},key:r,value:r},this.state.users[r].icon?n().createElement(a.Icon,{src:this.state.users[r].icon,style:Tn.icon}):null,this.state.users[r].name))):n().createElement(o.TextField,{variant:"standard",error:!!c,disabled:!!e,value:t,onChange:r=>this.onChange(this.props.attr,r.target.value),label:this.getText(this.props.schema.label)}),this.props.schema.help?n().createElement(o.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Is=Ts;class cn extends f{componentDidMount(){return pe(this,null,function*(){nt(cn.prototype,this,"componentDidMount").call(this);const c=yield Y.e("vendors-node_modules_react-qr-code_lib_index_js").then(Y.bind(Y,10732));this.setState({QRCode:c.default})})}renderItem(){const c=this.state.QRCode;return c?n().createElement(c,{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 _s={accordion:H,alive:M,autocomplete:y,autocompleteSendTo:g,certCollection:re,certificate:$,certificates:I,checkbox:K,checkLicense:ce,chip:Et,chips:Et,color:bt,coordinates:ke,cron:b,custom:xt,datePicker:fe,deviceManager:gt,divider:os,file:Xt,fileSelector:Nt,func:Ft,header:ls,image:P,imageSendTo:en,instance:ue,interface:Pe,ip:Zt,jsonEditor:Je,language:Ze,license:rt,number:Ln,objectId:Nn,password:Rn,pattern:Vn,port:Un,qrCode:cn,room:Jn,select:qn,selectSendTo:Xn,sendto:vn,sendTo:vn,setState:Qn,slider:ts,state:ss,staticImage:cs,staticInfo:ps,staticLink:Fn,staticText:Fn,table:Cs,text:vs,textSendTo:bs,timePicker:xs,topic:Fs,uuid:Ss,user:Is},et={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:E=>({backgroundColor:E.palette.primary.main,color:E.palette.mode==="dark"?"inherit":"#FFF"}),secondary:E=>({backgroundColor:E.palette.secondary.main})};class hn extends f{componentDidMount(){super.componentDidMount(),this.props.schema&&this.props.schema.collapsable&&this.setState({expanded:(window._localStorage||window.localStorage).getItem(`${this.props.oContext.adapterName}.${this.props.attr}`)==="true"})}renderItems(c,e){return c?Object.keys(c).map(t=>{if(this.props.oContext.multiEdit&&c[t].noMultiEdit)return null;const s=c[t].type||"panel";let i,r="Use this.props.oContext.socket!";return s==="custom"?(c[t].url?i=xt:this.props.oContext.customs&&this.props.oContext.customs[c[t].component]?i=this.props.oContext.customs[c[t].component]:(console.error(`Cannot find custom component: ${c[t].component}`),i=f),r=this.props.oContext.socket):s==="panel"?i=hn:i=_s[s]||f,n().createElement(i,{socket:r,globalData:this.props.globalData,oContext:this.props.oContext,key:`${t}_${this.props.index===void 0?"":this.props.index}`,index:this.props.index,changed:this.props.changed,arrayIndex:this.props.arrayIndex,commandRunning:this.props.commandRunning,style:et.panel,common:this.props.common,alive:this.props.alive,themeName:this.props.themeName,data:this.props.data,originalData:this.props.originalData,onError:this.props.onError,onChange:this.props.onChange,disabled:e,customObj:this.props.customObj,custom:this.props.custom,schema:c[t],attr:t,table:this.props.table})}):null}render(){const c=this.props.schema;if(!c)return null;const{disabled:e,hidden:t}=this.calculate(c),s=this.props.schema.items,i=this.props.schema.style||{};if(t){if(c.hideOnlyControl){const l=n().createElement(o.Grid2,{size:{xs:c.xs||void 0,sm:c.sm||void 0,md:c.md||void 0,lg:c.lg||void 0,xl:c.xl||void 0},sx:a.Utils.getStyle(this.props.oContext.theme,{marginBottom:0,textAlign:"left"},i,this.props.oContext.themeType==="dark"&&c.darkStyle)});return c.newLine?n().createElement(n().Fragment,null,n().createElement("div",{style:{flexBasis:"100%",height:0}}),l):l}return null}if(this.props.table)return this.renderItems(s,e);if(this.props.custom)return n().createElement(o.Grid2,{key:`${this.props.attr}_${this.props.index}`,container:!0,style:et.fullWidth,columnSpacing:2,rowSpacing:1,sx:i},this.renderItems(s,e));let r;if(c.collapsable?r=n().createElement(o.Accordion,{key:`${this.props.attr}_${this.props.index}`,style:et.fullWidth,expanded:!!this.state.expanded,onChange:()=>{(window._localStorage||window.localStorage).setItem(`${this.props.oContext.adapterName}.${this.props.attr}`,this.state.expanded?"false":"true"),this.setState({expanded:!this.state.expanded})}},n().createElement(o.AccordionSummary,{expandIcon:n().createElement(u.ExpandMore,null),sx:a.Utils.getStyle(this.props.oContext.theme,i,this.props.oContext.themeType&&c.darkStyle,c.color==="primary"?et.primary:c.color==="secondary"&&et.secondary,{width:"100%"})},n().createElement(o.Typography,{style:et.heading},this.getText(c.label))),n().createElement(o.AccordionDetails,null,n().createElement(o.Grid2,{container:!0,columnSpacing:2,rowSpacing:1,sx:Be(q({},i),{width:"100%",padding:"10px"})},this.renderItems(s,e)))):r=n().createElement(o.Box,{component:"div",key:`${this.props.attr}_${this.props.index}`,className:this.props.className,sx:a.Utils.getStyle(this.props.oContext.theme,this.props.style,i,{width:"100%"},this.props.isParentTab&&et.paper,this.props.isParentTab&&(this.props.withIcons?et.paperWithIcons:et.paperWithoutIcons))},n().createElement(o.Grid2,{container:!0,columnSpacing:2,rowSpacing:1,sx:a.Utils.getStyle(this.props.oContext.theme,{width:"100%"},this.props.isParentTab&&et.padding,this.props.schema.innerStyle)},this.renderItems(s,e))),!this.props.isParentTab){const l=n().createElement(o.Grid2,{title:this.getText(c.tooltip),size:{xs:c.xs||void 0,sm:c.sm||void 0,md:c.md||void 0,lg:c.lg||void 0,xl:c.xl||void 0},sx:q({marginBottom:0,textAlign:"left"},i)},r);return c.newLine?n().createElement(n().Fragment,null,n().createElement("div",{style:{flexBasis:"100%",height:0}}),l):l}return r}}const Ot=hn,Ut={tabs:{height:"100%",width:"100%"},panel:{width:"100%",display:"block"},panelWithIcons:{height:"calc(100% - 72px)"},panelWithoutIcons:{height:"calc(100% - 48px)"}};class ks extends f{constructor(e){super(e);Q(this,"onHashTabsChanged",()=>{const e=(window.location.hash||"").replace(/^#/,"").split("/");if(e.length>3&&e[1]==="config"){const t=e[3],s=parseInt(t,10);let i;s.toString()===t?s>=0&&s<Object.keys(this.props.schema.items).length&&(i=Object.keys(this.props.schema.items)[s]):Object.keys(this.props.schema.items).includes(t)&&(i=t),i!==void 0&&i!==this.state.tab&&((window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.${this.props.oContext.adapterName}`,i),this.setState({tab:i}))}});let t;if(this.props.root){const s=(window.location.hash||"").replace(/^#/,"").split("/");if(s.length>=3&&s[1]==="config"){const i=s[3],r=parseInt(i,10);i&&r.toString()===i?r>=0&&r<Object.keys(this.props.schema.items).length&&(t=Object.keys(this.props.schema.items)[r]):i&&Object.keys(this.props.schema.items).includes(i)&&(t=i),window.addEventListener("hashchange",this.onHashTabsChanged,!1)}}t===void 0&&(t=(window._localStorage||window.localStorage).getItem(`${this.props.dialogName||"App"}.${this.props.oContext.adapterName}`)||Object.keys(this.props.schema.items)[0],Object.keys(this.props.schema.items).includes(t)||(t=Object.keys(this.props.schema.items)[0])),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 n().createElement("div",{style:Ut.tabs},n().createElement(o.Tabs,{variant:"scrollable",scrollButtons:"auto",style:this.props.schema.tabsStyle,value:this.state.tab,onChange:(s,i)=>{(window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.${this.props.oContext.adapterName}`,i),this.setState({tab:i},()=>{if(this.props.root){const r=(window.location.hash||"").split("/");r.length>=3&&r[1]==="config"&&(r[3]=this.state.tab,window.location.hash=r.join("/"))}})}},Object.keys(e).map(s=>{let i;if(this.props.custom){if(this.executeCustom(e[s].hidden,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.index,this.props.globalData))return null;i=this.executeCustom(e[s].disabled,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.index,this.props.globalData)}else{if(this.execute(e[s].hidden,!1,this.props.data,this.props.index,this.props.globalData))return null;i=this.execute(e[s].disabled,!1,this.props.data,this.props.index,this.props.globalData)}const r=this.getIcon(e[s].icon);return t=t||!!r,n().createElement(o.Tab,{id:s,wrapped:!0,disabled:i,key:s,value:s,iconPosition:this.props.schema.iconPosition||"start",icon:r,label:this.getText(e[s].label)})})),n().createElement(Ot,{oContext:this.props.oContext,isParentTab:!0,changed:this.props.changed,key:this.state.tab,index:1001,arrayIndex:this.props.arrayIndex,globalData:this.props.globalData,commandRunning:this.props.commandRunning,style:q(q({},Ut.panel),t?Ut.panelWithIcons:Ut.panelWithoutIcons),common:this.props.common,alive:this.props.alive,themeName:this.props.themeName,data:this.props.data,originalData:this.props.originalData,onChange:this.props.onChange,onError:this.props.onError,customObj:this.props.customObj,custom:this.props.custom,schema:e[this.state.tab],table:this.props.table,withIcons:t}))}}const Bs=ks,Os={root:{width:"100%",height:"100%"}};class Ls extends T.Component{constructor(e){super(e);Q(this,"forceUpdateHandlers");Q(this,"errorTimeout",null);Q(this,"errorCached",null);Q(this,"oContext");Q(this,"onCommandRunning",e=>this.setState({commandRunning:e}));Q(this,"onAlive",(e,t)=>{!!(t!=null&&t.val)!==this.state.alive&&this.setState({alive:!!(t!=null&&t.val)})});Q(this,"onChange",(e,t,s,i)=>{if(this.props.onValueChange)this.props.onValueChange(e,t,i),s&&s();else if(e&&this.props.onChange){const r={changed:JSON.stringify(e)!==this.state.originalData};this.setState(r,()=>{this.props.onChange(e,r.changed,i),s&&s()})}else i&&this.props.onChange(null,null,i)});Q(this,"onError",(e,t)=>{this.errorCached=this.errorCached||JSON.parse(JSON.stringify(this.state.errors));const s=this.errorCached;t?s[e]=t:delete s[e],this.errorTimeout&&clearTimeout(this.errorTimeout),JSON.stringify(s)!==JSON.stringify(this.state.errors)?this.errorTimeout=setTimeout(()=>this.setState({errors:this.errorCached},()=>{this.errorTimeout=null,this.errorCached=null,this.props.onError(!!Object.keys(this.state.errors).length)}),50):this.errorCached=null});Q(this,"changeLanguage",()=>{this.forceUpdate()});Q(this,"forceAttrUpdate",(e,t)=>{Array.isArray(e)?e.forEach(s=>this.forceUpdateHandlers[s]&&this.forceUpdateHandlers[s](t)):this.forceUpdateHandlers[e]&&this.forceUpdateHandlers[e](t)});Q(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,s){return pe(this,null,function*(){if(t===!0||t&&typeof t=="string"){const i=a.I18n.getLanguage(),r=typeof t=="string"?t:"i18n";let l=yield e.fileExists(`${s}.admin`,`${r}/${i}.json`),h;if(l?h=`${r}/${i}.json`:(l=yield e.fileExists(`${s}.admin`,`${r}/${i}/translations.json`),l?h=`${r}/${i}/translations.json`:i!=="en"&&(l=yield e.fileExists(`${s}.admin`,`${r}/en.json`),l?h=`${r}/en.json`:(l=yield e.fileExists(`${s}.admin`,`${r}/en/translations.json`),l&&(h=`${r}/en/translations.json`)))),h){const S=yield e.readFile(`${s}.admin`,h);let L;S.file!==void 0?L=S.file:L=S;try{const O=JSON.parse(L);a.I18n.extendTranslations(O,i)}catch(O){return console.error(`Cannot parse language file "${s}.admin/${h}: ${O}`),""}return h}return console.warn(`Cannot find i18n for ${s} / ${h}`),""}return t&&typeof t=="object"&&a.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.setState({systemConfig:e.common,alive:!!(t&&t.val)},()=>{this.updateContext(!0),this.props.custom||this.props.socket.subscribeState(`system.adapter.${this.props.adapterName}.${this.props.instance}.alive`,this.onAlive)}))).catch(e=>console.error(`Cannot read system config: ${e}`))}flatten(e,t){return t=t||{},e.items&&Object.keys(e.items).forEach(s=>{t[s]=e.items[s],this.flatten(e.items[s],t)}),t}buildDependencies(e){const t=this.flatten(e);Object.keys(t).forEach(s=>{var i,r,l,h,S,L,O,N,te,ye;(i=t[s].confirm)!=null&&i.alsoDependsOn&&((r=t[s].confirm)==null||r.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 Ee=Be(q({},t[s]),{attr:s});Ee.confirm&&(Ee.confirm.cancel="Undo"),t[se].confirmDependsOn.push(Ee)}})),(l=t[s].onChange)!=null&&l.alsoDependsOn&&((h=t[s].onChange)==null||h.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 Ee=Be(q({},t[s]),{attr:s});t[se].onChangeDependsOn.push(Ee)}})),(S=t[s].hidden)!=null&&S.alsoDependsOn&&((L=t[s].hidden)==null||L.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 Ee=Be(q({},t[s]),{attr:s});t[se].hiddenDependsOn.push(Ee)}})),(O=t[s].label)!=null&&O.alsoDependsOn&&((N=t[s].label)==null||N.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 Ee=Be(q({},t[s]),{attr:s});t[se].labelDependsOn.push(Ee)}})),(te=t[s].help)!=null&&te.alsoDependsOn&&((ye=t[s].help)==null||ye.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 Ee=Be(q({},t[s]),{attr:s});t[se].helpDependsOn.push(Ee)}}))})}updateContext(e){this.oContext={DeviceManager:this.props.DeviceManager,adapterName:this.props.adapterName,changeLanguage:this.changeLanguage,common:this.props.common,customs:this.props.customs,dateFormat:this.props.dateFormat,embedded:this.props.embedded,expertMode:this.props.expertMode,forceUpdate:this.forceAttrUpdate,imagePrefix:this.props.imagePrefix,instance:this.props.instance,instanceObj:this.props.instanceObj,isFloatComma:this.props.isFloatComma,multiEdit:this.props.multiEdit,onBackEndCommand:this.props.onBackEndCommand,onCommandRunning:this.onCommandRunning,onValueChange:this.props.onValueChange,registerOnForceUpdate:this.registerOnForceUpdate,socket:this.props.socket,systemConfig:this.state.systemConfig,theme:this.props.theme,themeType:this.props.themeType,_themeName:this.props.themeName,updateData:this.state.updateData},e&&this.forceUpdate()}renderItem(e){return e.type==="tabs"?n().createElement(Bs,{oContext:this.oContext,alive:this.state.alive,changed:this.state.changed,commandRunning:this.state.commandRunning,common:this.props.common,custom:this.props.custom,customObj:this.props.customObj,data:this.props.data,onChange:this.onChange,onError:(t,s)=>this.onError(t,s),originalData:JSON.parse(this.state.originalData),root:!0,schema:e,themeName:this.props.themeName}):e.type==="panel"||!e.type?n().createElement(Ot,{oContext:this.oContext,alive:this.state.alive,changed:this.state.changed,commandRunning:this.state.commandRunning,common:this.props.common,custom:this.props.custom,customObj:this.props.customObj,data:this.props.data,index:1e3,isParentTab:!this.props.embedded,onChange:this.onChange,onError:(t,s)=>this.onError(t,s),originalData:JSON.parse(this.state.originalData),root:!0,schema:e,themeName:this.props.themeName}):(console.error(`Unknown item type in root: ${JSON.stringify(e)}`),null)}render(){return!this.state.systemConfig||!this.oContext?n().createElement(o.LinearProgress,null):(this.oContext._themeName!==this.props.themeName&&(this.oContext._themeName=this.props.themeName,setTimeout(()=>this.updateContext(!0),0)),n().createElement("div",{style:q(q(q({},this.props.embedded?void 0:Os.root),this.props.style),this.state.schema.style)},this.renderItem(this.state.schema)))}}const Wt=Ls,vt={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 $s(E,c){let e="";for(let t=0;t<c.length;t++)e+=String.fromCharCode(E[t%E.length].charCodeAt(0)^c.charCodeAt(t));return e}function Ns(E,c){let e="";for(let t=0;t<c.length;t++)e+=String.fromCharCode(E[t%E.length].charCodeAt(0)^c.charCodeAt(t));return e}function Ps(E,c){if(typeof c!="string")return c;if(!c.startsWith("$/aes-192-cbc:")||!/^[0-9a-f]{48}$/.test(E))return $s(E,c);const e=c.split(":",3),t=window.CryptoJS.enc.Hex.parse(E),s=window.CryptoJS.enc.Hex.parse(e[1]),i=window.CryptoJS.lib.CipherParams.create({ciphertext:window.CryptoJS.enc.Hex.parse(e[2])}),r=window.CryptoJS.AES.decrypt(i,t,{iv:s});return window.CryptoJS.enc.Utf8.stringify(r)}function Rs(E,c,e){if(typeof c!="string")return c;if(!/^[0-9a-f]{48}$/.test(E))return Ns(E,c);let t;e?t=window.CryptoJS.enc.Hex.parse(e):t=window.CryptoJS.lib.WordArray.random(128/8);const s=window.CryptoJS.enc.Hex.parse(E),i=window.CryptoJS.AES.encrypt(c,s,{iv:t}).ciphertext;return`$/aes-192-cbc:${window.CryptoJS.enc.Hex.stringify(t)}:${i}`}function In(E,c){var e;return!c||!document.getElementById(c)?new Promise(t=>{const s=document.createElement("script");s.setAttribute("id",c),s.onload=t,s.src=E,document.getElementsByTagName("head")[0].appendChild(s)}):(e=document.getElementById(c))==null?void 0:e.onload}class Ms extends a.Router{constructor(e){super(e);Q(this,"fileSubscribed",[]);Q(this,"fileLangSubscribed","");Q(this,"secret");Q(this,"handleFileSelect",e=>{const t=e.target.files[0];if(t){const s=new FileReader;s.onload=i=>{if(!i.target)return;const r=i.target.result;try{const l=JSON.parse(r);this.setState({data:l,changed:JSON.stringify(l)!==JSON.stringify(this.state.originalData)})}catch(l){window.alert(a.I18n.t("[JsonConfig] Failed to parse JSON file"))}},s.readAsText(t)}else window.alert(a.I18n.t("[JsonConfig] Failed to open JSON File"))});Q(this,"onFileChange",(e,t,s)=>pe(this,null,function*(){var i;if(e===`${this.props.adapterName}.admin`&&s){if(t===this.fileLangSubscribed)try{yield Wt.loadI18n(this.props.socket,(i=this.state.schema)==null?void 0:i.i18n,this.props.adapterName),this.setState({hash:`${this.state.hash}1`})}catch(r){}else if(this.fileSubscribed.includes(t))try{const r=yield this.getConfigFile(this.fileSubscribed[0]);this.setState({schema:r,hash:v()(JSON.stringify(r)).toString()})}catch(r){}}}));this.state={updateData:0,changed:!1,confirmDialog:!1,theme:(0,a.Theme)(e.themeName),saveConfigDialog:!1,hash:"_"},this.secret=e.secret||"",this.getInstanceObject().then(t=>this.getConfigFile().then(s=>Wt.loadI18n(this.props.socket,s==null?void 0:s.i18n,this.props.adapterName).then(i=>{i&&(this.fileLangSubscribed||(this.fileLangSubscribed=i,this.props.socket.subscribeFiles(`${this.props.adapterName}.admin`,this.fileLangSubscribed,this.onFileChange))),t?this.setState({schema:s,data:t.native,common:t.common,hash:v()(JSON.stringify(s)).toString()}):window.alert(`Instance system.adapter.${this.props.adapterName}.${this.props.instance} not found!`)})))}componentWillUnmount(){super.componentWillUnmount(),this.fileSubscribed.length&&(this.props.socket.unsubscribeFiles(`${this.props.adapterName}.admin`,this.fileSubscribed,this.onFileChange),this.fileSubscribed=[]),this.fileLangSubscribed&&(this.props.socket.unsubscribeFiles(`${this.props.adapterName}.admin`,this.fileLangSubscribed,this.onFileChange),this.fileLangSubscribed="")}getExportImportButtons(){return n().createElement("div",{style:vt.exportImportButtons},n().createElement(o.Tooltip,{title:this.props.t("Import settings from JSON file"),slotProps:{popper:{sx:vt.tooltip}}},n().createElement(o.Fab,{size:"small",sx:{"&.MuiFab-root":vt.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()}},n().createElement(u.Publish,null))),n().createElement(o.Tooltip,{title:this.props.t("Export setting to JSON file"),slotProps:{popper:{sx:vt.tooltip}}},n().createElement(o.Fab,{size:"small",sx:{"&.MuiFab-root":vt.button},onClick:()=>{this.state.data&&a.Utils.generateFile(`${this.props.adapterName}.${this.props.instance}.json`,this.state.data)}},n().createElement(u.Publish,{style:{transform:"rotate(180deg)"}}))))}getInstanceObject(){return pe(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 s=yield this.props.socket.getSystemConfig();yield In("../../lib/js/crypto-js/crypto-js.js","crypto-js"),this.secret=s.native.secret}return(e=t.encryptedNative)==null||e.forEach(s=>{t.native[s]&&(t.native[s]=Ps(this.secret,t.native[s]))}),t}return t}catch(t){window.alert(`[JsonConfig] Cannot read instance object: ${t}`)}return null})}renderDialogConfirm(){return this.state.confirmDialog?n().createElement(a.DialogConfirm,{title:a.I18n.t("ra_Please confirm"),text:a.I18n.t("ra_Some data are not stored. Discard?"),ok:a.I18n.t("ra_Discard"),cancel:a.I18n.t("ra_Cancel"),onClose:e=>this.setState({confirmDialog:!1},()=>e&&a.Router.doNavigate(null))}):null}scanForInclude(e,t){return pe(this,null,function*(){if(typeof e["#include"]=="string"){const i=yield this._getConfigFile(e["#include"],[...t]);return delete e["#include"],i&&(e=q(q({},e),i)),e}const s=Object.keys(e);for(let i=0;i<s.length;i++)e[s[i]]&&typeof e[s[i]]=="object"&&(e[s[i]]=yield this.scanForInclude(e[s[i]],t));return e})}getConfigFile(e){return pe(this,null,function*(){return this._getConfigFile(e)})}_getConfigFile(e,t){return pe(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 i=yield this.props.socket.readFile(`${this.props.adapterName}.admin`,e);let r="",l="";if(i.file!==void 0&&(l=i.file),typeof l=="string")r=l;else if(l.type==="Buffer"){let h="";const S=new Uint8Array(l.data),L=S.byteLength;for(let O=0;O<L;O++)h+=String.fromCharCode(S[O]);r=h}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(m().parse(r),t)}catch(h){window.alert("[JsonConfig] Cannot parse json5 config!"),console.log(h)}}catch(s){this.state.schema||window.alert(`[JsonConfig] Cannot read file "${e}: ${s}`)}return null})}renderSaveConfigDialog(){return this.state.saveConfigDialog?n().createElement(a.DialogConfirm,{title:a.I18n.t("ra_Please confirm"),text:a.I18n.t("Save configuration?"),ok:a.I18n.t("ra_Save"),cancel:a.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 s of Object.values(t.items)){const i=this.findAttr(e,s);if(i)return i}}return null}postProcessing(e,t,s){if(s=s||this.state.schema,!e){console.error(`Data is empty in postProcessing: ${t}, ${JSON.stringify(s)}`);return}const i=e[t];if(s.items)if(s.type==="table"){const r=i;if(!Array.isArray(r))return;for(const l of r)for(const h of s.items)this.postProcessing(l,h.attr,h)}else for(const[r,l]of Object.entries(s.items)){if(l.type==="panel"||l.type==="tabs"||l.type==="accordion")return;this.postProcessing(e,r,l)}else if(t&&typeof i=="string")if(s.type==="text")s.trim!==!1&&(e[t]=i.trim());else if(s.type==="ip")e[t]=i.trim();else if(s.type==="number"){const r=parseFloat(i.toString().replace(",","."));s.min!==void 0&&r<s.min?e[t]=s.min:s.max!==void 0&&r>s.max?e[t]=s.max:e[t]=r}else if(s.type==="port"){const r=parseInt(i.toString(),10);s.min!==void 0&&r<s.min?e[t]=s.min:s.max!==void 0&&r>s.max&&(e[t]=s.max),e[t]!==0&&r<20?e[t]=20:r>65535?e[t]=65535:e[t]=r}else s.type==="checkbox"&&(e[t]=e[t]===!0||e[t]==="true"||e[t]==="on"||e[t]===1||e[t]==="1")}onSave(e,t){return pe(this,null,function*(){if(e){const s=yield this.getInstanceObject();if(!s){console.error("Something went wrong: may be no connection?"),window.alert("Something went wrong: may be no connection?");return}if(!this.state.data||!this.state.schema)return;const i={};for(const l of Object.keys(this.state.data)){const h=this.findAttr(l);(!h||!h.doNotSave||h.type==="state")&&!l.startsWith("_")?f.setValue(s.native,l,this.state.data[l]):(f.setValue(s.native,l,null),i[l]=this.state.data[l])}try{const l=JSON.parse(JSON.stringify(s));if(Array.isArray(l.encryptedNative)){yield In("../../lib/js/crypto-js/crypto-js.js","crypto-js");for(const h of l.encryptedNative)l.native[h]&&(l.native[h]=Rs(this.secret,l.native[h]))}yield this.props.socket.setObject(l._id,l)}catch(l){window.alert(`[JsonConfig] Cannot set object: ${l}`)}const r=q(q({},s.native),i);console.log(r),this.setState({changed:!1,data:r,updateData:this.state.updateData+1,originalData:r},()=>t&&a.Router.doNavigate(null))}else this.state.changed?this.setState({confirmDialog:!0}):a.Router.doNavigate(null)})}componentDidUpdate(e,t){t.changed!==this.state.changed&&this.props.configStored(!this.state.changed)}componentDidMount(){return pe(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?n().createElement(o.LinearProgress,null):n().createElement("div",{style:vt.root},this.renderDialogConfirm(),this.getExportImportButtons(),this.renderSaveConfigDialog(),n().createElement(Wt,{key:this.state.hash,style:vt.scroll,socket:this.props.socket,themeName:this.props.themeName,themeType:this.props.themeType,adapterName:this.props.adapterName,instance:this.props.instance,isFloatComma:this.props.isFloatComma,dateFormat:this.props.dateFormat,schema:this.state.schema,common:this.state.common,expertMode:this.props.expertMode,data:this.state.data,updateData:this.state.updateData,onError:e=>this.setState({error:e}),onChange:(e,t,s)=>{s&&this.state.error&&(window.alert(a.I18n.t("Cannot save configuration because of error in configuration")),s=!1),s&&!this.state.changed&&!t&&(s=!1),e?this.setState({data:e,changed:t,saveConfigDialog:s}):s!==void 0&&this.setState({saveConfigDialog:s})},DeviceManager:this.props.DeviceManager,theme:this.state.theme}),n().createElement(a.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 Vs=Ms},82292:(V,ee,Y)=>{V=Y.nmd(V),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(T,n,C){"use strict";function m(p){var g=new Date().toLocaleString("en-us",p);return g.length==1?"0"+g:g}var D=T("./lib/dom"),v=T("./lib/oop"),o=T("./lib/event_emitter").EventEmitter,u=T("./lib/lang"),a=T("./range").Range,_=T("./range_list").RangeList,R=T("./keyboard/hash_handler").HashHandler,f=T("./tokenizer").Tokenizer,Z=T("./clipboard"),j={CURRENT_WORD:function(p){return p.session.getTextRange(p.session.getWordRange())},SELECTION:function(p,g,d){var x=p.session.getTextRange();return d?x.replace(/\n\r?([ \t]*\S)/g,`
|
|
5
|
-
`+d+"$1"):x},CURRENT_LINE:function(p){return p.session.getLine(p.getCursorPosition().row)},PREV_LINE:function(p){return p.session.getLine(p.getCursorPosition().row-1)},LINE_INDEX:function(p){return p.getCursorPosition().row},LINE_NUMBER:function(p){return p.getCursorPosition().row+1},SOFT_TABS:function(p){return p.session.getUseSoftTabs()?"YES":"NO"},TAB_SIZE:function(p){return p.session.getTabSize()},CLIPBOARD:function(p){return Z.getText&&Z.getText()},FILENAME:function(p){return/[^/\\]*$/.exec(this.FILEPATH(p))[0]},FILENAME_BASE:function(p){return/[^/\\]*$/.exec(this.FILEPATH(p))[0].replace(/\.[^.]*$/,"")},DIRECTORY:function(p){return this.FILEPATH(p).replace(/[^/\\]*$/,"")},FILEPATH:function(p){return"/not implemented.txt"},WORKSPACE_NAME:function(){return"Unknown"},FULLNAME:function(){return"Unknown"},BLOCK_COMMENT_START:function(p){var g=p.session.$mode||{};return g.blockComment&&g.blockComment.start||""},BLOCK_COMMENT_END:function(p){var g=p.session.$mode||{};return g.blockComment&&g.blockComment.end||""},LINE_COMMENT:function(p){var g=p.session.$mode||{};return g.lineCommentStart||""},CURRENT_YEAR:m.bind(null,{year:"numeric"}),CURRENT_YEAR_SHORT:m.bind(null,{year:"2-digit"}),CURRENT_MONTH:m.bind(null,{month:"numeric"}),CURRENT_MONTH_NAME:m.bind(null,{month:"long"}),CURRENT_MONTH_NAME_SHORT:m.bind(null,{month:"short"}),CURRENT_DATE:m.bind(null,{day:"2-digit"}),CURRENT_DAY_NAME:m.bind(null,{weekday:"long"}),CURRENT_DAY_NAME_SHORT:m.bind(null,{weekday:"short"}),CURRENT_HOUR:m.bind(null,{hour:"2-digit",hour12:!1}),CURRENT_MINUTE:m.bind(null,{minute:"2-digit"}),CURRENT_SECOND:m.bind(null,{second:"2-digit"})};j.SELECTED_TEXT=j.SELECTION;var H=function(){function p(){this.snippetMap={},this.snippetNameMap={},this.variables=j}return p.prototype.getTokenizer=function(){return p.$tokenizer||this.createTokenizer()},p.prototype.createTokenizer=function(){function g(b){return b=b.substr(1),/^\d+$/.test(b)?[{tabstopId:parseInt(b,10)}]:[{text:b}]}function d(b){return"(?:[^\\\\"+b+"]|\\\\.)"}var x={regex:"/("+d("/")+"+)/",onMatch:function(b,B,$){var k=$[0];return k.fmtString=!0,k.guard=b.slice(1,-1),k.flag="",""},next:"formatString"};return p.$tokenizer=new f({start:[{regex:/\\./,onMatch:function(b,B,$){var k=b[1];return(k=="}"&&$.length||"`$\\".indexOf(k)!=-1)&&(b=k),[b]}},{regex:/}/,onMatch:function(b,B,$){return[$.length?$.shift():b]}},{regex:/\$(?:\d+|\w+)/,onMatch:g},{regex:/\$\{[\dA-Z_a-z]+/,onMatch:function(b,B,$){var k=g(b.substr(1));return $.unshift(k[0]),k},next:"snippetVar"},{regex:/\n/,token:"newline",merge:!1}],snippetVar:[{regex:"\\|"+d("\\|")+"*\\|",onMatch:function(b,B,$){var k=b.slice(1,-1).replace(/\\[,|\\]|,/g,function(F){return F.length==2?F[1]:"\0"}).split("\0").map(function(F){return{value:F}});return $[0].choices=k,[k[0]]},next:"start"},x,{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"start"}],formatString:[{regex:/:/,onMatch:function(b,B,$){return $.length&&$[0].expectElse?($[0].expectElse=!1,$[0].ifEnd={elseEnd:$[0]},[$[0].ifEnd]):":"}},{regex:/\\./,onMatch:function(b,B,$){var k=b[1];return k=="}"&&$.length||"`$\\".indexOf(k)!=-1?b=k:k=="n"?b=`
|
|
6
|
-
`:k=="t"?b=" ":"ulULE".indexOf(k)!=-1&&(b={changeCase:k,local:k>"a"}),[b]}},{regex:"/\\w*}",onMatch:function(b,B,$){var k=$.shift();return k&&(k.flag=b.slice(1,-1)),this.next=k&&k.tabstopId?"start":"",[k||b]},next:"start"},{regex:/\$(?:\d+|\w+)/,onMatch:function(b,B,$){return[{text:b.slice(1)}]}},{regex:/\${\w+/,onMatch:function(b,B,$){var k={text:b.slice(2)};return $.unshift(k),[k]},next:"formatStringVar"},{regex:/\n/,token:"newline",merge:!1},{regex:/}/,onMatch:function(b,B,$){var k=$.shift();return this.next=k&&k.tabstopId?"start":"",[k||b]},next:"start"}],formatStringVar:[{regex:/:\/\w+}/,onMatch:function(b,B,$){var k=$[0];return k.formatFunction=b.slice(2,-1),[$.shift()]},next:"formatString"},x,{regex:/:[\?\-+]?/,onMatch:function(b,B,$){b[1]=="+"&&($[0].ifEnd=$[0]),b[1]=="?"&&($[0].expectElse=!0)},next:"formatString"},{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"formatString"}]}),p.$tokenizer},p.prototype.tokenizeTmSnippet=function(g,d){return this.getTokenizer().getLineTokens(g,d).tokens.map(function(x){return x.value||x})},p.prototype.getVariableValue=function(g,d,x){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 b=this.variables[d];return typeof b=="function"&&(b=this.variables[d](g,d,x)),b==null?"":b},p.prototype.tmStrFormat=function(g,d,x){if(!d.fmt)return g;var b=d.flag||"",B=d.guard;B=new RegExp(B,b.replace(/[^gim]/g,""));var $=typeof d.fmt=="string"?this.tokenizeTmSnippet(d.fmt,"formatString"):d.fmt,k=this,F=g.replace(B,function(){var I=k.variables.__;k.variables.__=[].slice.call(arguments);for(var U=k.resolveVariables($,x),re="E",X=0;X<U.length;X++){var ae=U[X];if(typeof ae=="object")if(U[X]="",ae.changeCase&&ae.local){var ce=U[X+1];ce&&typeof ce=="string"&&(ae.changeCase=="u"?U[X]=ce[0].toUpperCase():U[X]=ce[0].toLowerCase(),U[X+1]=ce.substr(1))}else ae.changeCase&&(re=ae.changeCase);else re=="U"?U[X]=ae.toUpperCase():re=="L"&&(U[X]=ae.toLowerCase())}return k.variables.__=I,U.join("")});return F},p.prototype.tmFormatFunction=function(g,d,x){return d.formatFunction=="upcase"?g.toUpperCase():d.formatFunction=="downcase"?g.toLowerCase():g},p.prototype.resolveVariables=function(g,d){function x(re){var X=g.indexOf(re,k+1);X!=-1&&(k=X)}for(var b=[],B="",$=!0,k=0;k<g.length;k++){var F=g[k];if(typeof F=="string"){b.push(F),F==`
|
|
7
|
-
`?($=!0,B=""):$&&(B=/^\t*/.exec(F)[0],$=/\S/.test(F));continue}if(F){if($=!1,F.fmtString){var I=g.indexOf(F,k+1);I==-1&&(I=g.length),F.fmt=g.slice(k+1,I),k=I}if(F.text){var U=this.getVariableValue(d,F.text,B)+"";F.fmtString&&(U=this.tmStrFormat(U,F,d)),F.formatFunction&&(U=this.tmFormatFunction(U,F,d)),U&&!F.ifEnd?(b.push(U),x(F)):!U&&F.ifEnd&&x(F.ifEnd)}else F.elseEnd?x(F.elseEnd):(F.tabstopId!=null||F.changeCase!=null)&&b.push(F)}}return b},p.prototype.getDisplayTextForSnippet=function(g,d){var x=ie.call(this,g,d);return x.text},p.prototype.insertSnippetForSelection=function(g,d,x){x===void 0&&(x={});var b=ie.call(this,g,d,x),B=g.getSelectionRange(),$=g.session.replace(B,b.text),k=new le(g),F=g.inVirtualSelectionMode&&g.selection.index;k.addTabstops(b.tabstops,B.start,$,F)},p.prototype.insertSnippet=function(g,d,x){x===void 0&&(x={});var b=this;if(g.inVirtualSelectionMode)return b.insertSnippetForSelection(g,d,x);g.forEachSelection(function(){b.insertSnippetForSelection(g,d,x)},null,{keepOrder:!0}),g.tabstopManager&&g.tabstopManager.tabNext()},p.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 x=g.getCursorPosition(),b=g.session.getState(x.row);typeof b=="object"&&(b=b[0]),b.substring&&(b.substring(0,3)=="js-"?d="javascript":b.substring(0,4)=="css-"?d="css":b.substring(0,4)=="php-"&&(d="php"))}return d},p.prototype.getActiveScopes=function(g){var d=this.$getScope(g),x=[d],b=this.snippetMap;return b[d]&&b[d].includeScopes&&x.push.apply(x,b[d].includeScopes),x.push("_"),x},p.prototype.expandWithTab=function(g,d){var x=this,b=g.forEachSelection(function(){return x.expandSnippetForSelection(g,d)},null,{keepOrder:!0});return b&&g.tabstopManager&&g.tabstopManager.tabNext(),b},p.prototype.expandSnippetForSelection=function(g,d){var x=g.getCursorPosition(),b=g.session.getLine(x.row),B=b.substring(0,x.column),$=b.substr(x.column),k=this.snippetMap,F;return this.getActiveScopes(g).some(function(I){var U=k[I];return U&&(F=this.findMatchingSnippet(U,B,$)),!!F},this),F?(d&&d.dryRun||(g.session.doc.removeInLine(x.row,x.column-F.replaceBefore.length,x.column+F.replaceAfter.length),this.variables.M__=F.matchBefore,this.variables.T__=F.matchAfter,this.insertSnippetForSelection(g,F.content),this.variables.M__=this.variables.T__=null),!0):!1},p.prototype.findMatchingSnippet=function(g,d,x){for(var b=g.length;b--;){var B=g[b];if(!(B.startRe&&!B.startRe.test(d))&&!(B.endRe&&!B.endRe.test(x))&&!(!B.startRe&&!B.endRe))return B.matchBefore=B.startRe?B.startRe.exec(d):[""],B.matchAfter=B.endRe?B.endRe.exec(x):[""],B.replaceBefore=B.triggerRe?B.triggerRe.exec(d)[0]:"",B.replaceAfter=B.endTriggerRe?B.endTriggerRe.exec(x)[0]:"",B}},p.prototype.register=function(g,d){function x(I){return I&&!/^\^?\(.*\)\$?$|^\\b$/.test(I)&&(I="(?:"+I+")"),I||""}function b(I,U,re){return I=x(I),U=x(U),re?(I=U+I,I&&I[I.length-1]!="$"&&(I+="$")):(I+=U,I&&I[0]!="^"&&(I="^"+I)),new RegExp(I)}function B(I){I.scope||(I.scope=d||"_"),d=I.scope,$[d]||($[d]=[],k[d]={});var U=k[d];if(I.name){var re=U[I.name];re&&F.unregister(re),U[I.name]=I}$[d].push(I),I.prefix&&(I.tabTrigger=I.prefix),!I.content&&I.body&&(I.content=Array.isArray(I.body)?I.body.join(`
|
|
8
|
-
`):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=b(I.trigger,I.guard,!0),I.triggerRe=new RegExp(I.trigger),I.endRe=b(I.endTrigger,I.endGuard,!0),I.endTriggerRe=new RegExp(I.endTrigger))}var $=this.snippetMap,k=this.snippetNameMap,F=this;g||(g=[]),Array.isArray(g)?g.forEach(B):Object.keys(g).forEach(function(I){B(g[I])}),this._signal("registerSnippets",{scope:d})},p.prototype.unregister=function(g,d){function x($){var k=B[$.scope||d];if(k&&k[$.name]){delete k[$.name];var F=b[$.scope||d],I=F&&F.indexOf($);I>=0&&F.splice(I,1)}}var b=this.snippetMap,B=this.snippetNameMap;g.content?x(g):Array.isArray(g)&&g.forEach(x)},p.prototype.parseSnippetFile=function(g){g=g.replace(/\r/g,"");for(var d=[],x={},b=/^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm,B;B=b.exec(g);){if(B[1])try{x=JSON.parse(B[1]),d.push(x)}catch(I){}if(B[4])x.content=B[4].replace(/^\t/gm,""),d.push(x),x={};else{var $=B[2],k=B[3];if($=="regex"){var F=/\/((?:[^\/\\]|\\.)*)|$/g;x.guard=F.exec(k)[1],x.trigger=F.exec(k)[1],x.endTrigger=F.exec(k)[1],x.endGuard=F.exec(k)[1]}else $=="snippet"?(x.tabTrigger=k.match(/^\S*/)[0],x.name||(x.name=k)):$&&(x[$]=k)}}return d},p.prototype.getSnippetByName=function(g,d){var x=this.snippetNameMap,b;return this.getActiveScopes(d).some(function(B){var $=x[B];return $&&(b=$[g]),!!b},this),b},p}();v.implement(H.prototype,o);var ie=function(p,g,d){function x(ge){for(var _e=[],ze=0;ze<ge.length;ze++){var xe=ge[ze];if(typeof xe=="object"){if(U[xe.tabstopId])continue;var at=ge.lastIndexOf(xe,ze-1);xe=_e[at]||{tabstopId:xe.tabstopId}}_e[ze]=xe}return _e}d===void 0&&(d={});var b=p.getCursorPosition(),B=p.session.getLine(b.row),$=p.session.getTabString(),k=B.match(/^\s*/)[0];b.column<k.length&&(k=k.slice(0,b.column)),g=g.replace(/\r/g,"");var F=this.tokenizeTmSnippet(g);F=this.resolveVariables(F,p),F=F.map(function(ge){return ge==`
|
|
9
|
-
`&&!d.excludeExtraIndent?ge+k:typeof ge=="string"?ge.replace(/\t/g,$):ge});var I=[];F.forEach(function(ge,_e){if(typeof ge=="object"){var ze=ge.tabstopId,xe=I[ze];if(xe||(xe=I[ze]=[],xe.index=ze,xe.value="",xe.parents={}),xe.indexOf(ge)===-1){ge.choices&&!xe.choices&&(xe.choices=ge.choices),xe.push(ge);var at=F.indexOf(ge,_e+1);if(at!==-1){var lt=F.slice(_e+1,at),mt=lt.some(function(Ie){return typeof Ie=="object"});mt&&!xe.value?xe.value=lt:lt.length&&(!xe.value||typeof xe.value!="string")&&(xe.value=lt.join(""))}}}}),I.forEach(function(ge){ge.length=0});for(var U={},re=0;re<F.length;re++){var X=F[re];if(typeof X=="object"){var ae=X.tabstopId,ce=I[ae],W=F.indexOf(X,re+1);if(U[ae]){U[ae]===X&&(delete U[ae],Object.keys(U).forEach(function(ge){ce.parents[ge]=!0}));continue}U[ae]=X;var K=ce.value;typeof K!="string"?K=x(K):X.fmt&&(K=this.tmStrFormat(K,X,p)),F.splice.apply(F,[re+1,Math.max(0,W-re)].concat(K,X)),ce.indexOf(X)===-1&&ce.push(X)}}var z=0,G=0,Ve="";return F.forEach(function(ge){if(typeof ge=="string"){var _e=ge.split(`
|
|
10
|
-
`);_e.length>1?(G=_e[_e.length-1].length,z+=_e.length-1):G+=ge.length,Ve+=ge}else ge&&(ge.start?ge.end={row:z,column:G}:ge.start={row:z,column:G})}),{text:Ve,tabstops:I,tokens:F}},le=function(){function p(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 p.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)},p.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},p.prototype.onChange=function(g){for(var d=g.action[0]=="r",x=this.selectedTabstop||{},b=x.parents||{},B=this.tabstops.slice(),$=0;$<B.length;$++){var k=B[$],F=k==x||b[k.index];if(k.rangeList.$bias=F?0:1,g.action=="remove"&&k!==x){var I=k.parents&&k.parents[x.index],U=k.rangeList.pointIndex(g.start,I);U=U<0?-U-1:U+1;var re=k.rangeList.pointIndex(g.end,I);re=re<0?-re-1:re-1;for(var X=k.rangeList.ranges.slice(U,re),ae=0;ae<X.length;ae++)this.removeRange(X[ae])}k.rangeList.$onChange(g)}var ce=this.session;!this.$inChange&&d&&ce.getLength()==1&&!ce.getValue()&&this.detach()},p.prototype.updateLinkedFields=function(){var g=this.selectedTabstop;if(!(!g||!g.hasLinkedRanges||!g.firstNonLinked)){this.$inChange=!0;for(var d=this.session,x=d.getTextRange(g.firstNonLinked),b=0;b<g.length;b++){var B=g[b];if(B.linked){var $=B.original,k=n.snippetManager.tmStrFormat(x,$,this.editor);d.replace(B,k)}}this.$inChange=!1}},p.prototype.onAfterExec=function(g){g.command&&!g.command.readOnly&&this.updateLinkedFields()},p.prototype.onChangeSelection=function(){if(this.editor){for(var g=this.editor.selection.lead,d=this.editor.selection.anchor,x=this.editor.selection.isEmpty(),b=0;b<this.ranges.length;b++)if(!this.ranges[b].linked){var B=this.ranges[b].contains(g.row,g.column),$=x||this.ranges[b].contains(d.row,d.column);if(B&&$)return}this.detach()}},p.prototype.onChangeSession=function(){this.detach()},p.prototype.tabNext=function(g){var d=this.tabstops.length,x=this.index+(g||1);x=Math.min(Math.max(x,1),d),x==d&&(x=0),this.selectTabstop(x),this.updateTabstopMarkers(),x===0&&this.detach()},p.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 x=d.firstNonLinked||d;if(d.choices&&(x.cursor=x.start),this.editor.inVirtualSelectionMode)this.editor.selection.fromOrientedRange(x);else{var b=this.editor.multiSelect;b.toSingleRange(x);for(var B=0;B<d.length;B++)d.hasLinkedRanges&&d[B].linked||b.addRange(d[B].clone(),!0)}this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler),this.selectedTabstop&&this.selectedTabstop.choices&&this.editor.execCommand("startAutocomplete",{matches:this.selectedTabstop.choices})}},p.prototype.addTabstops=function(g,d,x){var b=this.useLink||!this.editor.getOption("enableMultiselect");if(this.$openTabstops||(this.$openTabstops=[]),!g[0]){var B=a.fromPoints(x,x);w(B.start,d),w(B.end,d),g[0]=[B],g[0].index=0}var $=this.index,k=[$+1,0],F=this.ranges,I=this.snippetId=(this.snippetId||0)+1;g.forEach(function(U,re){var X=this.$openTabstops[re]||U;X.snippetId=I;for(var ae=0;ae<U.length;ae++){var ce=U[ae],W=a.fromPoints(ce.start,ce.end||ce.start);M(W.start,d),M(W.end,d),W.original=ce,W.tabstop=X,F.push(W),X!=U?X.unshift(W):X[ae]=W,ce.fmtString||X.firstNonLinked&&b?(W.linked=!0,X.hasLinkedRanges=!0):X.firstNonLinked||(X.firstNonLinked=W)}X.firstNonLinked||(X.hasLinkedRanges=!1),X===U&&(k.push(X),this.$openTabstops[re]=X),this.addTabstopMarkers(X),X.rangeList=X.rangeList||new _,X.rangeList.$bias=0,X.rangeList.addList(X)},this),k.length>2&&(this.tabstops.length&&k.push(k.splice(2,1)[0]),this.tabstops.splice.apply(this.tabstops,k))},p.prototype.addTabstopMarkers=function(g){var d=this.session;g.forEach(function(x){x.markerId||(x.markerId=d.addMarker(x,"ace_snippet-marker","text"))})},p.prototype.removeTabstopMarkers=function(g){var d=this.session;g.forEach(function(x){d.removeMarker(x.markerId),x.markerId=null})},p.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)}},p.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())},p}();le.prototype.keyboardHandler=new R,le.prototype.keyboardHandler.bindKeys({Tab:function(p){n.snippetManager&&n.snippetManager.expandWithTab(p)||(p.tabstopManager.tabNext(1),p.renderer.scrollCursorIntoView())},"Shift-Tab":function(p){p.tabstopManager.tabNext(-1),p.renderer.scrollCursorIntoView()},Esc:function(p){p.tabstopManager.detach()}});var M=function(p,g){p.row==0&&(p.column+=g.column),p.row+=g.row},w=function(p,g){p.row==g.row&&(p.column-=g.column),p.row-=g.row};D.importCssString(`
|
|
11
|
-
.ace_snippet-marker {
|
|
12
|
-
-moz-box-sizing: border-box;
|
|
13
|
-
box-sizing: border-box;
|
|
14
|
-
background: rgba(194, 193, 208, 0.09);
|
|
15
|
-
border: 1px dotted rgba(211, 208, 235, 0.62);
|
|
16
|
-
position: absolute;
|
|
17
|
-
}`,"snippets.css",!1),n.snippetManager=new H;var y=T("./editor").Editor;(function(){this.insertSnippet=function(p,g){return n.snippetManager.insertSnippet(this,p,g)},this.expandSnippet=function(p){return n.snippetManager.expandWithTab(this,p)}}).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(T,n,C){"use strict";var m=T("../virtual_renderer").VirtualRenderer,D=T("../editor").Editor,v=T("../range").Range,o=T("../lib/event"),u=T("../lib/lang"),a=T("../lib/dom"),_=T("../config").nls,R=T("./../lib/useragent"),f=function(M){return"suggest-aria-id:".concat(M)},Z=R.isSafari?"menu":"listbox",j=R.isSafari?"menuitem":"option",H=R.isSafari?"aria-current":"aria-selected",ie=function(M){var w=new m(M);w.$maxLines=4;var y=new D(w);return y.setHighlightActiveLine(!1),y.setShowPrintMargin(!1),y.renderer.setShowGutter(!1),y.renderer.setHighlightGutterLine(!1),y.$mouseHandler.$focusTimeout=0,y.$highlightTagPending=!0,y},le=function(){function M(w){var y=a.createElement("div"),p=ie(y);w&&w.appendChild(y),y.style.display="none",p.renderer.content.style.cursor="default",p.renderer.setStyle("ace_autocomplete"),p.renderer.$textLayer.element.setAttribute("role",Z),p.renderer.$textLayer.element.setAttribute("aria-roledescription",_("autocomplete.popup.aria-roledescription","Autocomplete suggestions")),p.renderer.$textLayer.element.setAttribute("aria-label",_("autocomplete.popup.aria-label","Autocomplete suggestions")),p.renderer.textarea.setAttribute("aria-hidden","true"),p.setOption("displayIndentGuides",!1),p.setOption("dragDelay",150);var g=function(){};p.focus=g,p.$isFocused=!0,p.renderer.$cursorLayer.restartTimer=g,p.renderer.$cursorLayer.element.style.opacity="0",p.renderer.$maxLines=8,p.renderer.$keepTextAreaAtCursor=!1,p.setHighlightActiveLine(!1),p.session.highlight(""),p.session.$searchHighlight.clazz="ace_highlight-marker",p.on("mousedown",function(F){var I=F.getDocumentPosition();p.selection.moveToPosition(I),b.start.row=b.end.row=I.row,F.stop()});var d,x=new v(-1,0,-1,1/0),b=new v(-1,0,-1,1/0);b.id=p.session.addMarker(b,"ace_active-line","fullLine"),p.setSelectOnHover=function(F){F?x.id&&(p.session.removeMarker(x.id),x.id=null):x.id=p.session.addMarker(x,"ace_line-hover","fullLine")},p.setSelectOnHover(!1),p.on("mousemove",function(F){if(!d){d=F;return}if(!(d.x==F.x&&d.y==F.y)){d=F,d.scrollTop=p.renderer.scrollTop,p.isMouseOver=!0;var I=d.getDocumentPosition().row;x.start.row!=I&&(x.id||p.setRow(I),$(I))}}),p.renderer.on("beforeRender",function(){if(d&&x.start.row!=-1){d.$pos=null;var F=d.getDocumentPosition().row;x.id||p.setRow(F),$(F,!0)}}),p.renderer.on("afterRender",function(){var F=p.getRow(),I=p.renderer.$textLayer,U=I.element.childNodes[F-I.config.firstRow],re=document.activeElement;if(U!==p.selectedNode&&p.selectedNode&&(a.removeCssClass(p.selectedNode,"ace_selected"),re.removeAttribute("aria-activedescendant"),p.selectedNode.removeAttribute(H),p.selectedNode.removeAttribute("id")),p.selectedNode=U,U){a.addCssClass(U,"ace_selected");var X=f(F);U.id=X,I.element.setAttribute("aria-activedescendant",X),re.setAttribute("aria-activedescendant",X),U.setAttribute("role",j),U.setAttribute("aria-roledescription",_("autocomplete.popup.item.aria-roledescription","item")),U.setAttribute("aria-label",p.getData(F).caption||p.getData(F).value),U.setAttribute("aria-setsize",p.data.length),U.setAttribute("aria-posinset",F+1),U.setAttribute("aria-describedby","doc-tooltip"),U.setAttribute(H,"true")}});var B=function(){$(-1)},$=function(F,I){F!==x.start.row&&(x.start.row=x.end.row=F,I||p.session._emit("changeBackMarker"),p._emit("changeHoverMarker"))};p.getHoveredRow=function(){return x.start.row},o.addListener(p.container,"mouseout",function(){p.isMouseOver=!1,B()}),p.on("hide",B),p.on("changeSelection",B),p.session.doc.getLength=function(){return p.data.length},p.session.doc.getLine=function(F){var I=p.data[F];return typeof I=="string"?I:I&&I.value||""};var k=p.session.bgTokenizer;return k.$tokenizeRow=function(F){function I(ge,_e){ge&&re.push({type:(U.className||"")+(_e||""),value:ge})}var U=p.data[F],re=[];if(!U)return re;typeof U=="string"&&(U={value:U});for(var X=U.caption||U.value||U.name,ae=X.toLowerCase(),ce=(p.filterText||"").toLowerCase(),W=0,K=0,z=0;z<=ce.length;z++)if(z!=K&&(U.matchMask&1<<z||z==ce.length)){var G=ce.slice(K,z);K=z;var Ve=ae.indexOf(G,W);if(Ve==-1)continue;I(X.slice(W,Ve),""),W=Ve+G.length,I(X.slice(Ve,W),"completion-highlight")}return I(X.slice(W,X.length),""),re.push({type:"completion-spacer",value:" "}),U.meta&&re.push({type:"completion-meta",value:U.meta}),U.message&&re.push({type:"completion-message",value:U.message}),re},k.$updateOnChange=g,k.start=g,p.session.$computeWidth=function(){return this.screenWidth=0},p.isOpen=!1,p.isTopdown=!1,p.autoSelect=!0,p.filterText="",p.isMouseOver=!1,p.data=[],p.setData=function(F,I){p.filterText=I||"",p.setValue(u.stringRepeat(`
|
|
18
|
-
`,F.length),-1),p.data=F||[],p.setRow(0)},p.getData=function(F){return p.data[F]},p.getRow=function(){return b.start.row},p.setRow=function(F){F=Math.max(this.autoSelect?0:-1,Math.min(this.data.length-1,F)),b.start.row!=F&&(p.selection.clearSelection(),b.start.row=b.end.row=F||0,p.session._emit("changeBackMarker"),p.moveCursorTo(F||0,0),p.isOpen&&p._signal("select"))},p.on("changeSelection",function(){p.isOpen&&p.setRow(p.selection.lead.row),p.renderer.scrollCursorIntoView()}),p.hide=function(){this.container.style.display="none",p.anchorPos=null,p.anchor=null,p.isOpen&&(p.isOpen=!1,this._signal("hide"))},p.tryShow=function(F,I,U,re){if(!re&&p.isOpen&&p.anchorPos&&p.anchor&&p.anchorPos.top===F.top&&p.anchorPos.left===F.left&&p.anchor===U)return!0;var X=this.container,ae=window.innerHeight,ce=window.innerWidth,W=this.renderer,K=W.$maxLines*I*1.4,z={top:0,bottom:0,left:0},G=ae-F.top-3*this.$borderSize-I,Ve=F.top-3*this.$borderSize;U||(Ve<=G||G>=K?U="bottom":U="top"),U==="top"?(z.bottom=F.top-this.$borderSize,z.top=z.bottom-K):U==="bottom"&&(z.top=F.top+I+this.$borderSize,z.bottom=z.top+K);var ge=z.top>=0&&z.bottom<=ae;if(!re&&!ge)return!1;ge?W.$maxPixelHeight=null:U==="top"?W.$maxPixelHeight=Ve:W.$maxPixelHeight=G,U==="top"?(X.style.top="",X.style.bottom=ae-z.bottom+"px",p.isTopdown=!1):(X.style.top=z.top+"px",X.style.bottom="",p.isTopdown=!0),X.style.display="";var _e=F.left;return _e+X.offsetWidth>ce&&(_e=ce-X.offsetWidth),X.style.left=_e+"px",X.style.right="",p.isOpen||(p.isOpen=!0,this._signal("show"),d=null),p.anchorPos=F,p.anchor=U,!0},p.show=function(F,I,U){this.tryShow(F,I,U?"bottom":void 0,!0)},p.goTo=function(F){var I=this.getRow(),U=this.session.getLength()-1;switch(F){case"up":I=I<=0?U:I-1;break;case"down":I=I>=U?-1:I+1;break;case"start":I=0;break;case"end":I=U}this.setRow(I)},p.getTextLeftOffset=function(){return this.$borderSize+this.renderer.$padding+this.$imageSize},p.$imageSize=0,p.$borderSize=1,p}return M}();a.importCssString(`
|
|
19
|
-
.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {
|
|
20
|
-
background-color: #CAD6FA;
|
|
21
|
-
z-index: 1;
|
|
22
|
-
}
|
|
23
|
-
.ace_dark.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {
|
|
24
|
-
background-color: #3a674e;
|
|
25
|
-
}
|
|
26
|
-
.ace_editor.ace_autocomplete .ace_line-hover {
|
|
27
|
-
border: 1px solid #abbffe;
|
|
28
|
-
margin-top: -1px;
|
|
29
|
-
background: rgba(233,233,253,0.4);
|
|
30
|
-
position: absolute;
|
|
31
|
-
z-index: 2;
|
|
32
|
-
}
|
|
33
|
-
.ace_dark.ace_editor.ace_autocomplete .ace_line-hover {
|
|
34
|
-
border: 1px solid rgba(109, 150, 13, 0.8);
|
|
35
|
-
background: rgba(58, 103, 78, 0.62);
|
|
36
|
-
}
|
|
37
|
-
.ace_completion-meta {
|
|
38
|
-
opacity: 0.5;
|
|
39
|
-
margin-left: 0.9em;
|
|
40
|
-
}
|
|
41
|
-
.ace_completion-message {
|
|
42
|
-
margin-left: 0.9em;
|
|
43
|
-
color: blue;
|
|
44
|
-
}
|
|
45
|
-
.ace_editor.ace_autocomplete .ace_completion-highlight{
|
|
46
|
-
color: #2d69c7;
|
|
47
|
-
}
|
|
48
|
-
.ace_dark.ace_editor.ace_autocomplete .ace_completion-highlight{
|
|
49
|
-
color: #93ca12;
|
|
50
|
-
}
|
|
51
|
-
.ace_editor.ace_autocomplete {
|
|
52
|
-
width: 300px;
|
|
53
|
-
z-index: 200000;
|
|
54
|
-
border: 1px lightgray solid;
|
|
55
|
-
position: fixed;
|
|
56
|
-
box-shadow: 2px 3px 5px rgba(0,0,0,.2);
|
|
57
|
-
line-height: 1.4;
|
|
58
|
-
background: #fefefe;
|
|
59
|
-
color: #111;
|
|
60
|
-
}
|
|
61
|
-
.ace_dark.ace_editor.ace_autocomplete {
|
|
62
|
-
border: 1px #484747 solid;
|
|
63
|
-
box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.51);
|
|
64
|
-
line-height: 1.4;
|
|
65
|
-
background: #25282c;
|
|
66
|
-
color: #c1c1c1;
|
|
67
|
-
}
|
|
68
|
-
.ace_autocomplete .ace_text-layer {
|
|
69
|
-
width: calc(100% - 8px);
|
|
70
|
-
}
|
|
71
|
-
.ace_autocomplete .ace_line {
|
|
72
|
-
display: flex;
|
|
73
|
-
align-items: center;
|
|
74
|
-
}
|
|
75
|
-
.ace_autocomplete .ace_line > * {
|
|
76
|
-
min-width: 0;
|
|
77
|
-
flex: 0 0 auto;
|
|
78
|
-
}
|
|
79
|
-
.ace_autocomplete .ace_line .ace_ {
|
|
80
|
-
flex: 0 1 auto;
|
|
81
|
-
overflow: hidden;
|
|
82
|
-
text-overflow: ellipsis;
|
|
83
|
-
}
|
|
84
|
-
.ace_autocomplete .ace_completion-spacer {
|
|
85
|
-
flex: 1;
|
|
86
|
-
}
|
|
87
|
-
.ace_autocomplete.ace_loading:after {
|
|
88
|
-
content: "";
|
|
89
|
-
position: absolute;
|
|
90
|
-
top: 0px;
|
|
91
|
-
height: 2px;
|
|
92
|
-
width: 8%;
|
|
93
|
-
background: blue;
|
|
94
|
-
z-index: 100;
|
|
95
|
-
animation: ace_progress 3s infinite linear;
|
|
96
|
-
animation-delay: 300ms;
|
|
97
|
-
transform: translateX(-100%) scaleX(1);
|
|
98
|
-
}
|
|
99
|
-
@keyframes ace_progress {
|
|
100
|
-
0% { transform: translateX(-100%) scaleX(1) }
|
|
101
|
-
50% { transform: translateX(625%) scaleX(2) }
|
|
102
|
-
100% { transform: translateX(1500%) scaleX(3) }
|
|
103
|
-
}
|
|
104
|
-
@media (prefers-reduced-motion) {
|
|
105
|
-
.ace_autocomplete.ace_loading:after {
|
|
106
|
-
transform: translateX(625%) scaleX(2);
|
|
107
|
-
animation: none;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
`,"autocompletion.css",!1),n.AcePopup=le,n.$singleLineEditor=ie,n.getAriaId=f}),ace.define("ace/autocomplete/inline_screenreader",["require","exports","module"],function(T,n,C){"use strict";var m=function(){function D(v){this.editor=v,this.screenReaderDiv=document.createElement("div"),this.screenReaderDiv.classList.add("ace_screenreader-only"),this.editor.container.appendChild(this.screenReaderDiv)}return D.prototype.setScreenReaderContent=function(v){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(),a=this.popup.renderer.$textLayer,_=a.element.childNodes[u-a.config.firstRow];if(_){for(var R="doc-tooltip ",f=0;f<this._lines.length;f++)R+="ace-inline-screenreader-line-".concat(f," ");_.setAttribute("aria-describedby",R)}}.bind(this)));this.screenReaderDiv.firstChild;)this.screenReaderDiv.removeChild(this.screenReaderDiv.firstChild);this._lines=v.split(/\r\n|\r|\n/);var o=this.createCodeBlock();this.screenReaderDiv.appendChild(o)},D.prototype.destroy=function(){this.screenReaderDiv.remove()},D.prototype.createCodeBlock=function(){var v=document.createElement("pre");v.setAttribute("id","ace-inline-screenreader");for(var o=0;o<this._lines.length;o++){var u=document.createElement("code");u.setAttribute("id","ace-inline-screenreader-line-".concat(o));var a=document.createTextNode(this._lines[o]);u.appendChild(a),v.appendChild(u)}return v},D}();n.AceInlineScreenReader=m}),ace.define("ace/autocomplete/inline",["require","exports","module","ace/snippets","ace/autocomplete/inline_screenreader"],function(T,n,C){"use strict";var m=T("../snippets").snippetManager,D=T("./inline_screenreader").AceInlineScreenReader,v=function(){function o(){this.editor=null}return o.prototype.show=function(u,a,_){if(_=_||"",u&&this.editor&&this.editor!==u&&(this.hide(),this.editor=null,this.inlineScreenReader=null),!u||!a)return!1;this.inlineScreenReader||(this.inlineScreenReader=new D(u));var R=a.snippet?m.getDisplayTextForSnippet(u,a.snippet):a.value;return a.hideInlinePreview||!R||!R.startsWith(_)?!1:(this.editor=u,this.inlineScreenReader.setScreenReaderContent(R),R=R.slice(_.length),R===""?u.removeGhostText():u.setGhostText(R),!0)},o.prototype.isOpen=function(){return this.editor?!!this.editor.renderer.$ghostText:!1},o.prototype.hide=function(){return this.editor?(this.editor.removeGhostText(),!0):!1},o.prototype.destroy=function(){this.hide(),this.editor=null,this.inlineScreenReader&&(this.inlineScreenReader.destroy(),this.inlineScreenReader=null)},o}();n.AceInline=v}),ace.define("ace/autocomplete/util",["require","exports","module"],function(T,n,C){"use strict";n.parForEach=function(D,v,o){var u=0,a=D.length;a===0&&o();for(var _=0;_<a;_++)v(D[_],function(R,f){u++,u===a&&o(R,f)})};var m=/[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;n.retrievePrecedingIdentifier=function(D,v,o){o=o||m;for(var u=[],a=v-1;a>=0&&o.test(D[a]);a--)u.push(D[a]);return u.reverse().join("")},n.retrieveFollowingIdentifier=function(D,v,o){o=o||m;for(var u=[],a=v;a<D.length&&o.test(D[a]);a++)u.push(D[a]);return u},n.getCompletionPrefix=function(D){var v=D.getCursorPosition(),o=D.session.getLine(v.row),u;return D.completers.forEach(function(a){a.identifierRegexps&&a.identifierRegexps.forEach(function(_){!u&&_&&(u=this.retrievePrecedingIdentifier(o,v.column,_))}.bind(this))}.bind(this)),u||this.retrievePrecedingIdentifier(o,v.column)},n.triggerAutocomplete=function(D,o){var o=o==null?D.session.getPrecedingCharacter():o;return D.completers.some(function(u){if(u.triggerCharacters&&Array.isArray(u.triggerCharacters))return u.triggerCharacters.includes(o)})}}),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(T,n,C){"use strict";var m=T("./keyboard/hash_handler").HashHandler,D=T("./autocomplete/popup").AcePopup,v=T("./autocomplete/inline").AceInline,o=T("./autocomplete/popup").getAriaId,u=T("./autocomplete/util"),a=T("./lib/lang"),_=T("./lib/dom"),R=T("./snippets").snippetManager,f=T("./config"),Z=T("./lib/event"),j=T("./lib/scroll").preventParentScroll,H=function(w,y){y.completer&&y.completer.destroy()},ie=function(){function w(){this.autoInsert=!1,this.autoSelect=!0,this.autoShown=!1,this.exactMatch=!1,this.inlineEnabled=!1,this.keyboardHandler=new m,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=a.delayedCall(function(){this.updateCompletions(!0)}.bind(this)),this.tooltipTimer=a.delayedCall(this.updateDocTooltip.bind(this),50),this.popupTimer=a.delayedCall(this.$updatePopupPosition.bind(this),50),this.stickySelectionTimer=a.delayedCall(function(){this.stickySelection=!0}.bind(this),this.stickySelectionDelay),this.$firstOpenTimer=a.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(w.completionsForLoading),this.openPopup(this.editor,y.prefix,!1),this.popup.renderer.setStyle("ace_loading",!0))}.bind(this),this.stickySelectionDelay)}return Object.defineProperty(w,"completionsForLoading",{get:function(){return[{caption:f.nls("autocomplete.loading","Loading..."),value:""}]},enumerable:!1,configurable:!0}),w.prototype.$init=function(){return this.popup=new D(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},w.prototype.$initInline=function(){if(!(!this.inlineEnabled||this.inlineRenderer))return this.inlineRenderer=new v,this.inlineRenderer},w.prototype.getPopup=function(){return this.popup||this.$init()},w.prototype.$onHidePopup=function(){this.inlineRenderer&&this.inlineRenderer.hide(),this.hideDocTooltip(),this.stickySelectionTimer.cancel(),this.popupTimer.cancel(),this.stickySelection=!1},w.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))},w.prototype.$onPopupChange=function(y){if(this.inlineRenderer&&this.inlineEnabled){var p=y?null:this.popup.getData(this.popup.getRow());if(this.$updateGhostText(p),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)},w.prototype.$updateGhostText=function(y){var p=this.base.row,g=this.base.column,d=this.editor.getCursorPosition().column,x=this.editor.session.getLine(p).slice(g,d);this.inlineRenderer.show(this.editor,y,x)?this.$seen(y):this.inlineRenderer.hide()},w.prototype.$onPopupRender=function(){var y=this.inlineRenderer&&this.inlineEnabled;if(this.completions&&this.completions.filtered&&this.completions.filtered.length>0)for(var p=this.popup.getFirstVisibleRow();p<=this.popup.getLastVisibleRow();p++){var g=this.popup.getData(p);g&&(!y||g.hideInlinePreview)&&this.$seen(g)}},w.prototype.$onPopupShow=function(y){this.$onPopupChange(y),this.stickySelection=!1,this.stickySelectionDelay>=0&&this.stickySelectionTimer.schedule(this.stickySelectionDelay)},w.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,p=[];y;)p.push(y),y.addEventListener("scroll",this.onLayoutChange,{passive:!0}),y=y.parentNode;this.$elements=p}},w.prototype.unObserveLayoutChanges=function(){var y=this;window.removeEventListener("resize",this.onLayoutChange,{passive:!0}),window.removeEventListener("wheel",this.mousewheelListener),this.$elements&&this.$elements.forEach(function(p){p.removeEventListener("scroll",y.onLayoutChange,{passive:!0})}),this.$elements=null},w.prototype.onLayoutChange=function(){if(!this.popup.isOpen)return this.unObserveLayoutChanges();this.$updatePopupPosition(),this.updateDocTooltip()},w.prototype.$updatePopupPosition=function(){var y=this.editor,p=y.renderer,g=p.layerConfig.lineHeight,d=p.$cursorLayer.getPixelPosition(this.base,!0);d.left-=this.popup.getTextLeftOffset();var x=y.container.getBoundingClientRect();d.top+=x.top-p.layerConfig.offset,d.left+=x.left-y.renderer.scrollLeft,d.left+=p.gutterWidth;var b={top:d.top,left:d.left};p.$ghostText&&p.$ghostTextWidget&&this.base.row===p.$ghostText.position.row&&(b.top+=p.$ghostTextWidget.el.offsetHeight);var B=y.container.getBoundingClientRect().bottom-g,$=B<b.top?{top:B,left:b.left}:b;this.popup.tryShow($,g,"bottom")||this.popup.tryShow(d,g,"top")||this.popup.show(d,g)},w.prototype.openPopup=function(y,p,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(),x=this.popup.data[d];this.popup.setData(this.completions.filtered,this.completions.filterText),this.editor.textInput.setAriaOptions&&this.editor.textInput.setAriaOptions({activeDescendant:o(this.popup.getRow()),inline:this.inlineEnabled}),y.keyBinding.addKeyboardHandler(this.keyboardHandler);var b;this.stickySelection&&(b=this.popup.data.indexOf(x)),(!b||b===-1)&&(b=0),this.popup.setRow(this.autoSelect?b:-1),b===d&&x!==this.completions.filtered[b]&&this.$onPopupChange();var B=this.inlineRenderer&&this.inlineEnabled;if(b===d&&B){var $=this.popup.getData(this.popup.getRow());this.$updateGhostText($)}g||(this.popup.setTheme(y.getTheme()),this.popup.setFontSize(y.getFontSize()),this.$updatePopupPosition(),this.tooltipNode&&this.updateDocTooltip()),this.changeTimer.cancel(),this.observeLayoutChanges()},w.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()},w.prototype.changeListener=function(y){var p=this.editor.selection.lead;(p.row!=this.base.row||p.column<this.base.column)&&this.detach(),this.activated?this.changeTimer.schedule():this.detach()},w.prototype.blurListener=function(y){var p=document.activeElement,g=this.editor.textInput.getElement(),d=y.relatedTarget&&this.tooltipNode&&this.tooltipNode.contains(y.relatedTarget),x=this.popup&&this.popup.container;p!=g&&p.parentNode!=x&&!d&&p!=this.tooltipNode&&y.relatedTarget!=g&&this.detach()},w.prototype.mousedownListener=function(y){this.detach()},w.prototype.mousewheelListener=function(y){this.popup&&!this.popup.isMouseOver&&this.detach()},w.prototype.mouseOutListener=function(y){this.popup.isOpen&&this.$updatePopupPosition()},w.prototype.goTo=function(y){this.popup.goTo(y)},w.prototype.insertMatch=function(y,p){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,p);return this.completions==g&&this.detach(),d},w.prototype.showPopup=function(y,p){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,p)},w.prototype.getCompletionProvider=function(y){return this.completionProvider||(this.completionProvider=new le(y)),this.completionProvider},w.prototype.gatherCompletions=function(y,p){return this.getCompletionProvider().gatherCompletions(y,p)},w.prototype.updateCompletions=function(y,p){if(y&&this.base&&this.completions){var d=this.editor.getCursorPosition(),x=this.editor.session.getTextRange({start:this.base,end:d});if(x==this.completions.filterText)return;if(this.completions.setFilter(x),!this.completions.filtered.length)return this.detach();if(this.completions.filtered.length==1&&this.completions.filtered[0].value==x&&!this.completions.filtered[0].snippet)return this.detach();this.openPopup(this.editor,x,y);return}if(p&&p.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(p.matches),this.getCompletionProvider().completions=this.completions,this.openPopup(this.editor,"",y)}var g=this.editor.getSession(),d=this.editor.getCursorPosition(),x=u.getCompletionPrefix(this.editor);this.base=g.doc.createAnchor(d.row,d.column-x.length),this.base.$insertRight=!0;var b={exactMatch:this.exactMatch,ignoreCaption:this.ignoreCaption};this.getCompletionProvider({prefix:x,pos:d}).provideCompletions(this.editor,b,function(B,$,k){var F=$.filtered,I=u.getCompletionPrefix(this.editor);if(this.$firstOpenTimer.cancel(),k){if(!F.length){var U=!this.autoShown&&this.emptyMessage;if(typeof U=="function"&&(U=this.emptyMessage(I)),U){var re=[{caption:U,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(F.length==1&&F[0].value==I&&!F[0].snippet)return this.detach();if(this.autoInsert&&!this.autoShown&&F.length==1)return this.insertMatch(F[0])}this.completions=!k&&this.showLoadingState?new M(w.completionsForLoading.concat(F),$.filterText):$,this.openPopup(this.editor,I,y),this.popup.renderer.setStyle("ace_empty-message",!1),this.popup.renderer.setStyle("ace_loading",!k)}.bind(this)),this.showLoadingState&&!this.autoShown&&(!this.popup||!this.popup.isOpen)&&this.$firstOpenTimer.delay(this.stickySelectionDelay/2)},w.prototype.cancelContextMenu=function(){this.editor.$mouseHandler.cancelContextMenu()},w.prototype.updateDocTooltip=function(){var y=this.popup,p=this.completions.filtered,g=p&&(p[y.getHoveredRow()]||p[y.getRow()]),d=null;if(!g||!this.editor||!this.popup.isOpen)return this.hideDocTooltip();for(var x=this.editor.completers.length,b=0;b<x;b++){var B=this.editor.completers[b];if(B.getDocTooltip&&g.completerId===B.id){d=B.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)},w.prototype.showDocTooltip=function(y){this.tooltipNode||(this.tooltipNode=_.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",j));var p=this.editor.renderer.theme;this.tooltipNode.className="ace_tooltip ace_doc-tooltip "+(p.isDark?"ace_dark ":"")+(p.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,x=d.container.getBoundingClientRect();g.style.top=d.container.style.top,g.style.bottom=d.container.style.bottom,g.style.display="block",window.innerWidth-x.right<320?x.left<320?d.isTopdown?(g.style.top=x.bottom+"px",g.style.left=x.left+"px",g.style.right="",g.style.bottom=""):(g.style.top=d.container.offsetTop-g.offsetHeight+"px",g.style.left=x.left+"px",g.style.right="",g.style.bottom=""):(g.style.right=window.innerWidth-x.left+"px",g.style.left=""):(g.style.left=x.right+1+"px",g.style.right="")},w.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)}},w.prototype.onTooltipClick=function(y){for(var p=y.target;p&&p!=this.tooltipNode;){if(p.nodeName=="A"&&p.href){p.rel="noreferrer",p.target="_blank";break}p=p.parentNode}},w.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",H),this.editor.completer=null),this.inlineRenderer=this.popup=this.editor=null},w.for=function(y){return y.completer instanceof w||(y.completer&&(y.completer.destroy(),y.completer=null),f.get("sharedPopups")?(w.$sharedInstance||(w.$sharedInstance=new w),y.completer=w.$sharedInstance):(y.completer=new w,y.once("destroy",H))),y.completer},w}();ie.prototype.commands={Up:function(w){w.completer.goTo("up")},Down:function(w){w.completer.goTo("down")},"Ctrl-Up|Ctrl-Home":function(w){w.completer.goTo("start")},"Ctrl-Down|Ctrl-End":function(w){w.completer.goTo("end")},Esc:function(w){w.completer.detach()},Return:function(w){return w.completer.insertMatch()},"Shift-Return":function(w){w.completer.insertMatch(null,{deleteSuffix:!0})},Tab:function(w){var y=w.completer.insertMatch();if(y||w.tabstopManager)return y;w.completer.goTo("down")},Backspace:function(w){w.execCommand("backspace");var y=u.getCompletionPrefix(w);!y&&w.completer&&w.completer.detach()},PageUp:function(w){w.completer.popup.gotoPageUp()},PageDown:function(w){w.completer.popup.gotoPageDown()}},ie.startCommand={name:"startAutocomplete",exec:function(w,y){var p=ie.for(w);p.autoInsert=!1,p.autoSelect=!0,p.autoShown=!1,p.showPopup(w,y),p.cancelContextMenu()},bindKey:"Ctrl-Space|Ctrl-Shift-Space|Alt-Space"};var le=function(){function w(y){this.initialPosition=y,this.active=!0}return w.prototype.insertByIndex=function(y,p,g){return!this.completions||!this.completions.filtered?!1:this.insertMatch(y,this.completions.filtered[p],g)},w.prototype.insertMatch=function(y,p,g){if(!p)return!1;if(y.startOperation({command:{name:"insertMatch"}}),p.completer&&p.completer.insertMatch)p.completer.insertMatch(y,p);else{if(!this.completions)return!1;var d=this.completions.filterText.length,x=0;if(p.range&&p.range.start.row===p.range.end.row&&(d-=this.initialPosition.prefix.length,d+=this.initialPosition.pos.column-p.range.start.column,x+=p.range.end.column-this.initialPosition.pos.column),d||x){var b;y.selection.getAllRanges?b=y.selection.getAllRanges():b=[y.getSelectionRange()];for(var B=0,$;$=b[B];B++)$.start.column-=d,$.end.column+=x,y.session.remove($)}p.snippet?R.insertSnippet(y,p.snippet):this.$insertString(y,p),p.completer&&p.completer.onInsert&&typeof p.completer.onInsert=="function"&&p.completer.onInsert(y,p),p.command&&p.command==="startAutocomplete"&&y.execCommand(p.command)}return y.endOperation(),!0},w.prototype.$insertString=function(y,p){var g=p.value||p;y.execCommand("insertstring",g)},w.prototype.gatherCompletions=function(y,p){var g=y.getSession(),d=y.getCursorPosition(),x=u.getCompletionPrefix(y),b=[];this.completers=y.completers;var B=y.completers.length;return y.completers.forEach(function($,k){$.getCompletions(y,g,d,x,function(F,I){$.hideInlinePreview&&(I=I.map(function(U){return Object.assign(U,{hideInlinePreview:$.hideInlinePreview})})),!F&&I&&(b=b.concat(I)),p(null,{prefix:u.getCompletionPrefix(y),matches:b,finished:--B===0})})}),!0},w.prototype.provideCompletions=function(y,p,g){var d=function($){var k=$.prefix,F=$.matches;this.completions=new M(F),p.exactMatch&&(this.completions.exactMatch=!0),p.ignoreCaption&&(this.completions.ignoreCaption=!0),this.completions.setFilter(k),($.finished||this.completions.filtered.length)&&g(null,this.completions,$.finished)}.bind(this),x=!0,b=null;if(this.gatherCompletions(y,function($,k){if(this.active){$&&(g($,[],!0),this.detach());var F=k.prefix;if(F.indexOf(k.prefix)===0){if(x){b=k;return}d(k)}}}.bind(this)),x=!1,b){var B=b;b=null,d(B)}},w.prototype.detach=function(){this.active=!1,this.completers&&this.completers.forEach(function(y){typeof y.cancel=="function"&&y.cancel()})},w}(),M=function(){function w(y,p){this.all=y,this.filtered=y,this.filterText=p||"",this.exactMatch=!1,this.ignoreCaption=!1}return w.prototype.setFilter=function(y){if(y.length>this.filterText&&y.lastIndexOf(this.filterText,0)===0)var p=this.filtered;else var p=this.all;this.filterText=y,p=this.filterCompletions(p,this.filterText),p=p.sort(function(d,x){return x.exactMatch-d.exactMatch||x.$score-d.$score||(d.caption||d.value).localeCompare(x.caption||x.value)});var g=null;p=p.filter(function(d){var x=d.snippet||d.caption||d.value;return x===g?!1:(g=x,!0)}),this.filtered=p},w.prototype.filterCompletions=function(y,p){var g=[],d=p.toUpperCase(),x=p.toLowerCase();e:for(var b=0,B;B=y[b];b++){var $=!this.ignoreCaption&&B.caption||B.value||B.snippet;if($){var k=-1,F=0,I=0,U,re;if(this.exactMatch){if(p!==$.substr(0,p.length))continue e}else{var X=$.toLowerCase().indexOf(x);if(X>-1)I=X;else for(var ae=0;ae<p.length;ae++){var ce=$.indexOf(x[ae],k+1),W=$.indexOf(d[ae],k+1);if(U=ce>=0&&(W<0||ce<W)?ce:W,U<0)continue e;re=U-k-1,re>0&&(k===-1&&(I+=10),I+=re,F|=1<<ae),k=U}}B.matchMask=F,B.exactMatch=I?0:1,B.$score=(B.score||0)-I,g.push(B)}}return g},w}();n.Autocomplete=ie,n.CompletionProvider=le,n.FilteredList=M}),ace.define("ace/autocomplete/text_completer",["require","exports","module","ace/range"],function(T,n,C){function m(u,a){var _=u.getTextRange(v.fromPoints({row:0,column:0},a));return _.split(o).length-1}function D(u,a){var _=m(u,a),R=u.getValue().split(o),f=Object.create(null),Z=R[_];return R.forEach(function(j,H){if(!(!j||j===Z)){var ie=Math.abs(_-H),le=R.length-ie;f[j]?f[j]=Math.max(le,f[j]):f[j]=le}}),f}var v=T("../range").Range,o=/[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;n.getCompletions=function(u,a,_,R,f){var Z=D(a,_),j=Object.keys(Z);f(null,j.map(function(H){return{caption:H,value:H,score:Z[H],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(T,n,C){"use strict";var m=T("../snippets").snippetManager,D=T("../autocomplete").Autocomplete,v=T("../config"),o=T("../lib/lang"),u=T("../autocomplete/util"),a=T("../autocomplete/text_completer"),_={getCompletions:function(d,x,b,B,$){if(x.$mode.completer)return x.$mode.completer.getCompletions(d,x,b,B,$);var k=d.session.getState(b.row),F=x.$mode.getCompletions(k,x,b,B);F=F.map(function(I){return I.completerId=_.id,I}),$(null,F)},id:"keywordCompleter"},R=function(d){var x={};return d.replace(/\${(\d+)(:(.*?))?}/g,function(b,B,$,k){return x[B]=k||""}).replace(/\$(\d+?)/g,function(b,B){return x[B]})},f={getCompletions:function(d,x,b,B,$){var k=[],F=x.getTokenAt(b.row,b.column);F&&F.type.match(/(tag-name|tag-open|tag-whitespace|attribute-name|attribute-value)\.xml$/)?k.push("html-tag"):k=m.getActiveScopes(d);var I=m.snippetMap,U=[];k.forEach(function(re){for(var X=I[re]||[],ae=X.length;ae--;){var ce=X[ae],W=ce.name||ce.tabTrigger;W&&U.push({caption:W,snippet:ce.content,meta:ce.tabTrigger&&!ce.name?ce.tabTrigger+"\u21E5 ":"snippet",completerId:f.id})}},this),$(null,U)},getDocTooltip:function(d){d.snippet&&!d.docHTML&&(d.docHTML=["<b>",o.escapeHTML(d.caption),"</b>","<hr></hr>",o.escapeHTML(R(d.snippet))].join(""))},id:"snippetCompleter"},Z=[f,a,_];n.setCompleters=function(d){Z.length=0,d&&Z.push.apply(Z,d)},n.addCompleter=function(d){Z.push(d)},n.textCompleter=a,n.keyWordCompleter=_,n.snippetCompleter=f;var j={name:"expandSnippet",exec:function(d){return m.expandWithTab(d)},bindKey:"Tab"},H=function(d,x){ie(x.session.$mode)},ie=function(d){typeof d=="string"&&(d=v.$modes[d]),d&&(m.files||(m.files={}),le(d.$id,d.snippetFileId),d.modes&&d.modes.forEach(ie))},le=function(d,x){!x||!d||m.files[d]||(m.files[d]={},v.loadModule(x,function(b){b&&(m.files[d]=b,!b.snippets&&b.snippetText&&(b.snippets=m.parseSnippetFile(b.snippetText)),m.register(b.snippets||[],b.scope),b.includeScopes&&(m.snippetMap[b.scope].includeScopes=b.includeScopes,b.includeScopes.forEach(function(B){ie("ace/mode/"+B)})))}))},M=function(d){var x=d.editor,b=x.completer&&x.completer.activated;if(d.command.name==="backspace")b&&!u.getCompletionPrefix(x)&&x.completer.detach();else if(d.command.name==="insertstring"&&!b){w=d;var B=d.editor.$liveAutocompletionDelay;B?y.delay(B):p(d)}},w,y=o.delayedCall(function(){p(w)},0),p=function(d){var x=d.editor,b=u.getCompletionPrefix(x),B=d.args,$=u.triggerAutocomplete(x,B);if(b&&b.length>=x.$liveAutocompletionThreshold||$){var k=D.for(x);k.autoShown=!0,k.showPopup(x)}},g=T("../editor").Editor;T("../config").defineOptions(g.prototype,"editor",{enableBasicAutocompletion:{set:function(d){d?(this.completers||(this.completers=Array.isArray(d)?d:Z),this.commands.addCommand(D.startCommand)):this.commands.removeCommand(D.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(j),this.on("changeMode",H),H(null,this)):(this.commands.removeCommand(j),this.off("changeMode",H))},value:!1}})}),function(){ace.require(["ace/ext/language_tools"],function(T){V&&(V.exports=T)})}()},97726:(V,ee,Y)=>{V=Y.nmd(V),ace.define("ace/mode/json_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(T,n,C){"use strict";var m=T("../lib/oop"),D=T("./text_highlight_rules").TextHighlightRules,v=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"}]}};m.inherits(v,D),n.JsonHighlightRules=v}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(T,n,C){"use strict";var m=T("../range").Range,D=function(){};(function(){this.checkOutdent=function(v,o){return/^\s+$/.test(v)?/^\s*\}/.test(o):!1},this.autoOutdent=function(v,o){var u=v.getLine(o),a=u.match(/^(\s*\})/);if(!a)return 0;var _=a[1].length,R=v.findMatchingBracket({row:o,column:_});if(!R||R.row==o)return 0;var f=this.$getIndent(v.getLine(R.row));v.replace(new m(o,0,o,_-1),f)},this.$getIndent=function(v){return v.match(/^\s*/)[0]}}).call(D.prototype),n.MatchingBraceOutdent=D}),ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(T,n,C){"use strict";var m=T("../../lib/oop"),D=T("../../range").Range,v=T("./fold_mode").FoldMode,o=n.FoldMode=function(u){u&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+u.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+u.end)))};m.inherits(o,v),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,a,_){var R=u.getLine(_);if(this.singleLineBlockCommentRe.test(R)&&!this.startRegionRe.test(R)&&!this.tripleStarBlockCommentRe.test(R))return"";var f=this._getFoldWidgetBase(u,a,_);return!f&&this.startRegionRe.test(R)?"start":f},this.getFoldWidgetRange=function(u,a,_,R){var f=u.getLine(_);if(this.startRegionRe.test(f))return this.getCommentRegionBlock(u,f,_);var H=f.match(this.foldingStartMarker);if(H){var Z=H.index;if(H[1])return this.openingBracketBlock(u,H[1],_,Z);var j=u.getCommentFoldRange(_,Z+H[0].length,1);return j&&!j.isMultiLine()&&(R?j=this.getSectionRange(u,_):a!="all"&&(j=null)),j}if(a!=="markbegin"){var H=f.match(this.foldingStopMarker);if(H){var Z=H.index+H[0].length;return H[1]?this.closingBracketBlock(u,H[1],_,Z):u.getCommentFoldRange(_,Z,-1)}}},this.getSectionRange=function(u,a){var _=u.getLine(a),R=_.search(/\S/),f=a,Z=_.length;a+=1;for(var j=a,H=u.getLength();++a<H;){_=u.getLine(a);var ie=_.search(/\S/);if(ie!==-1){if(R>ie)break;var le=this.getFoldWidgetRange(u,"all",a);if(le){if(le.start.row<=f)break;if(le.isMultiLine())a=le.end.row;else if(R==ie)break}j=a}}return new D(f,Z,j,u.getLine(j).length)},this.getCommentRegionBlock=function(u,a,_){for(var R=a.search(/\s*$/),f=u.getLength(),Z=_,j=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,H=1;++_<f;){a=u.getLine(_);var ie=j.exec(a);if(ie&&(ie[1]?H--:H++,!H))break}var le=_;if(le>Z)return new D(Z,R,le,a.length)}}.call(o.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(T,n,C){"use strict";var m=T("../lib/oop"),D=T("./text").Mode,v=T("./json_highlight_rules").JsonHighlightRules,o=T("./matching_brace_outdent").MatchingBraceOutdent,u=T("./folding/cstyle").FoldMode,a=T("../worker/worker_client").WorkerClient,_=function(){this.HighlightRules=v,this.$outdent=new o,this.$behaviour=this.$defaultBehaviour,this.foldingRules=new u};m.inherits(_,D),function(){this.lineCommentStart="//",this.blockComment={start:"/*",end:"*/"},this.getNextLineIndent=function(R,f,Z){var j=this.$getIndent(f);if(R=="start"){var H=f.match(/^.*[\{\(\[]\s*$/);H&&(j+=Z)}return j},this.checkOutdent=function(R,f,Z){return this.$outdent.checkOutdent(f,Z)},this.autoOutdent=function(R,f,Z){this.$outdent.autoOutdent(f,Z)},this.createWorker=function(R){var f=new a(["ace"],"ace/mode/json_worker","JsonWorker");return f.attachToDocument(R.getDocument()),f.on("annotate",function(Z){R.setAnnotations(Z.data)}),f.on("terminate",function(){R.clearAnnotations()}),f},this.$id="ace/mode/json"}.call(_.prototype),n.Mode=_}),function(){ace.require(["ace/mode/json"],function(T){V&&(V.exports=T)})}()},44210:(V,ee,Y)=>{V=Y.nmd(V),ace.define("ace/theme/chrome-css",["require","exports","module"],function(T,n,C){C.exports=`.ace-chrome .ace_gutter {
|
|
111
|
-
background: #ebebeb;
|
|
112
|
-
color: #333;
|
|
113
|
-
overflow : hidden;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.ace-chrome .ace_print-margin {
|
|
117
|
-
width: 1px;
|
|
118
|
-
background: #e8e8e8;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.ace-chrome {
|
|
122
|
-
background-color: #FFFFFF;
|
|
123
|
-
color: black;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.ace-chrome .ace_cursor {
|
|
127
|
-
color: black;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.ace-chrome .ace_invisible {
|
|
131
|
-
color: rgb(191, 191, 191);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
.ace-chrome .ace_constant.ace_buildin {
|
|
135
|
-
color: rgb(88, 72, 246);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.ace-chrome .ace_constant.ace_language {
|
|
139
|
-
color: rgb(88, 92, 246);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.ace-chrome .ace_constant.ace_library {
|
|
143
|
-
color: rgb(6, 150, 14);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
.ace-chrome .ace_invalid {
|
|
147
|
-
background-color: rgb(153, 0, 0);
|
|
148
|
-
color: white;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
.ace-chrome .ace_fold {
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.ace-chrome .ace_support.ace_function {
|
|
155
|
-
color: rgb(60, 76, 114);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
.ace-chrome .ace_support.ace_constant {
|
|
159
|
-
color: rgb(6, 150, 14);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.ace-chrome .ace_support.ace_type,
|
|
163
|
-
.ace-chrome .ace_support.ace_class
|
|
164
|
-
.ace-chrome .ace_support.ace_other {
|
|
165
|
-
color: rgb(109, 121, 222);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
.ace-chrome .ace_variable.ace_parameter {
|
|
169
|
-
font-style:italic;
|
|
170
|
-
color:#FD971F;
|
|
171
|
-
}
|
|
172
|
-
.ace-chrome .ace_keyword.ace_operator {
|
|
173
|
-
color: rgb(104, 118, 135);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
.ace-chrome .ace_comment {
|
|
177
|
-
color: #236e24;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
.ace-chrome .ace_comment.ace_doc {
|
|
181
|
-
color: #236e24;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
.ace-chrome .ace_comment.ace_doc.ace_tag {
|
|
185
|
-
color: #236e24;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
.ace-chrome .ace_constant.ace_numeric {
|
|
189
|
-
color: rgb(0, 0, 205);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
.ace-chrome .ace_variable {
|
|
193
|
-
color: rgb(49, 132, 149);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.ace-chrome .ace_xml-pe {
|
|
197
|
-
color: rgb(104, 104, 91);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
.ace-chrome .ace_entity.ace_name.ace_function {
|
|
201
|
-
color: #0000A2;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
.ace-chrome .ace_heading {
|
|
206
|
-
color: rgb(12, 7, 255);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
.ace-chrome .ace_list {
|
|
210
|
-
color:rgb(185, 6, 144);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
.ace-chrome .ace_marker-layer .ace_selection {
|
|
214
|
-
background: rgb(181, 213, 255);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
.ace-chrome .ace_marker-layer .ace_step {
|
|
218
|
-
background: rgb(252, 255, 0);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
.ace-chrome .ace_marker-layer .ace_stack {
|
|
222
|
-
background: rgb(164, 229, 101);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
.ace-chrome .ace_marker-layer .ace_bracket {
|
|
226
|
-
margin: -1px 0 0 -1px;
|
|
227
|
-
border: 1px solid rgb(192, 192, 192);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
.ace-chrome .ace_marker-layer .ace_active-line {
|
|
231
|
-
background: rgba(0, 0, 0, 0.07);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
.ace-chrome .ace_gutter-active-line {
|
|
235
|
-
background-color : #dcdcdc;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
.ace-chrome .ace_marker-layer .ace_selected-word {
|
|
239
|
-
background: rgb(250, 250, 255);
|
|
240
|
-
border: 1px solid rgb(200, 200, 250);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
.ace-chrome .ace_storage,
|
|
244
|
-
.ace-chrome .ace_keyword,
|
|
245
|
-
.ace-chrome .ace_meta.ace_tag {
|
|
246
|
-
color: rgb(147, 15, 128);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
.ace-chrome .ace_string.ace_regex {
|
|
250
|
-
color: rgb(255, 0, 0)
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
.ace-chrome .ace_string {
|
|
254
|
-
color: #1A1AA6;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
.ace-chrome .ace_entity.ace_other.ace_attribute-name {
|
|
258
|
-
color: #994409;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
.ace-chrome .ace_indent-guide {
|
|
262
|
-
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
.ace-chrome .ace_indent-guide-active {
|
|
266
|
-
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAAZSURBVHjaYvj///9/hivKyv8BAAAA//8DACLqBhbvk+/eAAAAAElFTkSuQmCC") right repeat-y;
|
|
267
|
-
}
|
|
268
|
-
`}),ace.define("ace/theme/chrome",["require","exports","module","ace/theme/chrome-css","ace/lib/dom"],function(T,n,C){n.isDark=!1,n.cssClass="ace-chrome",n.cssText=T("./chrome-css");var m=T("../lib/dom");m.importCssString(n.cssText,n.cssClass,!1)}),function(){ace.require(["ace/theme/chrome"],function(T){V&&(V.exports=T)})}()},9285:(V,ee,Y)=>{V=Y.nmd(V),ace.define("ace/theme/clouds_midnight-css",["require","exports","module"],function(T,n,C){C.exports=`.ace-clouds-midnight .ace_gutter {
|
|
269
|
-
background: #232323;
|
|
270
|
-
color: #929292
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
.ace-clouds-midnight .ace_print-margin {
|
|
274
|
-
width: 1px;
|
|
275
|
-
background: #232323
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
.ace-clouds-midnight {
|
|
279
|
-
background-color: #191919;
|
|
280
|
-
color: #929292
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
.ace-clouds-midnight .ace_cursor {
|
|
284
|
-
color: #7DA5DC
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
.ace-clouds-midnight .ace_marker-layer .ace_selection {
|
|
288
|
-
background: #000000
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
.ace-clouds-midnight.ace_multiselect .ace_selection.ace_start {
|
|
292
|
-
box-shadow: 0 0 3px 0px #191919;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
.ace-clouds-midnight .ace_marker-layer .ace_step {
|
|
296
|
-
background: rgb(102, 82, 0)
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
.ace-clouds-midnight .ace_marker-layer .ace_bracket {
|
|
300
|
-
margin: -1px 0 0 -1px;
|
|
301
|
-
border: 1px solid #BFBFBF
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
.ace-clouds-midnight .ace_marker-layer .ace_active-line {
|
|
305
|
-
background: rgba(215, 215, 215, 0.031)
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
.ace-clouds-midnight .ace_gutter-active-line {
|
|
309
|
-
background-color: rgba(215, 215, 215, 0.031)
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
.ace-clouds-midnight .ace_marker-layer .ace_selected-word {
|
|
313
|
-
border: 1px solid #000000
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
.ace-clouds-midnight .ace_invisible {
|
|
317
|
-
color: #666
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
.ace-clouds-midnight .ace_keyword,
|
|
321
|
-
.ace-clouds-midnight .ace_meta,
|
|
322
|
-
.ace-clouds-midnight .ace_support.ace_constant.ace_property-value {
|
|
323
|
-
color: #927C5D
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
.ace-clouds-midnight .ace_keyword.ace_operator {
|
|
327
|
-
color: #4B4B4B
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
.ace-clouds-midnight .ace_keyword.ace_other.ace_unit {
|
|
331
|
-
color: #366F1A
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
.ace-clouds-midnight .ace_constant.ace_language {
|
|
335
|
-
color: #39946A
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
.ace-clouds-midnight .ace_constant.ace_numeric {
|
|
339
|
-
color: #46A609
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
.ace-clouds-midnight .ace_constant.ace_character.ace_entity {
|
|
343
|
-
color: #A165AC
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
.ace-clouds-midnight .ace_invalid {
|
|
347
|
-
color: #FFFFFF;
|
|
348
|
-
background-color: #E92E2E
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
.ace-clouds-midnight .ace_fold {
|
|
352
|
-
background-color: #927C5D;
|
|
353
|
-
border-color: #929292
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
.ace-clouds-midnight .ace_storage,
|
|
357
|
-
.ace-clouds-midnight .ace_support.ace_class,
|
|
358
|
-
.ace-clouds-midnight .ace_support.ace_function,
|
|
359
|
-
.ace-clouds-midnight .ace_support.ace_other,
|
|
360
|
-
.ace-clouds-midnight .ace_support.ace_type {
|
|
361
|
-
color: #E92E2E
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
.ace-clouds-midnight .ace_string {
|
|
365
|
-
color: #5D90CD
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
.ace-clouds-midnight .ace_comment {
|
|
369
|
-
color: #3C403B
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
.ace-clouds-midnight .ace_entity.ace_name.ace_tag,
|
|
373
|
-
.ace-clouds-midnight .ace_entity.ace_other.ace_attribute-name {
|
|
374
|
-
color: #606060
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
.ace-clouds-midnight .ace_indent-guide {
|
|
378
|
-
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYHB3d/8PAAOIAdULw8qMAAAAAElFTkSuQmCC) right repeat-y
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
.ace-clouds-midnight .ace_indent-guide-active {
|
|
382
|
-
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQIW2PQ1dX9zzBz5sz/ABCcBFFentLlAAAAAElFTkSuQmCC) right repeat-y;
|
|
383
|
-
}
|
|
384
|
-
`}),ace.define("ace/theme/clouds_midnight",["require","exports","module","ace/theme/clouds_midnight-css","ace/lib/dom"],function(T,n,C){n.isDark=!0,n.cssClass="ace-clouds-midnight",n.cssText=T("./clouds_midnight-css");var m=T("../lib/dom");m.importCssString(n.cssText,n.cssClass,!1)}),function(){ace.require(["ace/theme/clouds_midnight"],function(T){V&&(V.exports=T)})}()},51197:function(){"no use strict";(function(V){function ee(n,C){for(var m=n,D="";m;){var v=C[m];if(typeof v=="string")return v+D;if(v)return v.location.replace(/\/*$/,"/")+(D||v.main||v.name);if(v===!1)return"";var o=m.lastIndexOf("/");if(o===-1)break;D=m.substr(o)+D,m=m.slice(0,o)}return n}if(!(typeof V.window!="undefined"&&V.document)&&!(V.require&&V.define)){V.console||(V.console=function(){var n=Array.prototype.slice.call(arguments,0);postMessage({type:"log",data:n})},V.console.error=V.console.warn=V.console.log=V.console.trace=V.console),V.window=V,V.ace=V,V.onerror=function(n,C,m,D,v){postMessage({type:"error",data:{message:n,data:v&&v.data,file:C,line:m,col:D,stack:v&&v.stack}})},V.normalizeModule=function(n,C){if(C.indexOf("!")!==-1){var m=C.split("!");return V.normalizeModule(n,m[0])+"!"+V.normalizeModule(n,m[1])}if(C.charAt(0)=="."){var D=n.split("/").slice(0,-1).join("/");for(C=(D?D+"/":"")+C;C.indexOf(".")!==-1&&v!=C;){var v=C;C=C.replace(/^\.\//,"").replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return C},V.require=function(n,C){if(C||(C=n,n=null),!C.charAt)throw new Error("worker.js require() accepts only (parentId, id) as arguments");C=V.normalizeModule(n,C);var m=V.require.modules[C];if(m)return m.initialized||(m.initialized=!0,m.exports=m.factory().exports),m.exports;if(!V.require.tlns)return console.log("unable to load "+C);var D=ee(C,V.require.tlns);return D.slice(-3)!=".js"&&(D+=".js"),V.require.id=C,V.require.modules[C]={},importScripts(D),V.require(n,C)},V.require.modules={},V.require.tlns={},V.define=function(n,C,m){if(arguments.length==2?(m=C,typeof n!="string"&&(C=n,n=V.require.id)):arguments.length==1&&(m=n,C=[],n=V.require.id),typeof m!="function"){V.require.modules[n]={exports:m,initialized:!0};return}C.length||(C=["require","exports","module"]);var D=function(v){return V.require(n,v)};V.require.modules[n]={exports:{},factory:function(){var v=this,o=m.apply(this,C.slice(0,m.length).map(function(u){switch(u){case"require":return D;case"exports":return v.exports;case"module":return v;default:return D(u)}}));return o&&(v.exports=o),v}}},V.define.amd={},V.require.tlns={},V.initBaseUrls=function(n){for(var C in n)this.require.tlns[C]=n[C]},V.initSender=function(){var n=V.require("ace/lib/event_emitter").EventEmitter,C=V.require("ace/lib/oop"),m=function(){};return function(){C.implement(this,n),this.callback=function(D,v){postMessage({type:"call",id:v,data:D})},this.emit=function(D,v){postMessage({type:"event",name:D,data:v})}}.call(m.prototype),new m};var Y=V.main=null,T=V.sender=null;V.onmessage=function(n){var C=n.data;if(C.event&&T)T._signal(C.event,C.data);else if(C.command)if(Y[C.command])Y[C.command].apply(Y,C.args);else{if(!V[C.command])throw new Error("Unknown command:"+C.command);V[C.command].apply(V,C.args)}else if(C.init){V.initBaseUrls(C.tlns),T=V.sender=V.initSender();var m=this.require(C.module)[C.classname];Y=V.main=new m(T)}}}})(this),ace.define("ace/lib/oop",[],function(V,ee,Y){"use strict";ee.inherits=function(T,n){T.super_=n,T.prototype=Object.create(n.prototype,{constructor:{value:T,enumerable:!1,writable:!0,configurable:!0}})},ee.mixin=function(T,n){for(var C in n)T[C]=n[C];return T},ee.implement=function(T,n){ee.mixin(T,n)}}),ace.define("ace/apply_delta",[],function(V,ee,Y){"use strict";function T(m,D){throw console.log("Invalid Delta:",m),"Invalid Delta: "+D}function n(m,D){return D.row>=0&&D.row<m.length&&D.column>=0&&D.column<=m[D.row].length}function C(m,D){D.action!="insert"&&D.action!="remove"&&T(D,"delta.action must be 'insert' or 'remove'"),D.lines instanceof Array||T(D,"delta.lines must be an Array"),(!D.start||!D.end)&&T(D,"delta.start/end must be an present");var v=D.start;n(m,D.start)||T(D,"delta.start must be contained in document");var o=D.end;D.action=="remove"&&!n(m,o)&&T(D,"delta.end must contained in document for 'remove' actions");var u=o.row-v.row,a=o.column-(u==0?v.column:0);(u!=D.lines.length-1||D.lines[u].length!=a)&&T(D,"delta.range must match delta lines")}ee.applyDelta=function(m,D,v){var o=D.start.row,u=D.start.column,a=m[o]||"";switch(D.action){case"insert":var _=D.lines;if(_.length===1)m[o]=a.substring(0,u)+D.lines[0]+a.substring(u);else{var R=[o,1].concat(D.lines);m.splice.apply(m,R),m[o]=a.substring(0,u)+m[o],m[o+D.lines.length-1]+=a.substring(u)}break;case"remove":var f=D.end.column,Z=D.end.row;o===Z?m[o]=a.substring(0,u)+a.substring(f):m.splice(o,Z-o+1,a.substring(0,u)+m[Z].substring(f))}}}),ace.define("ace/lib/event_emitter",[],function(V,ee,Y){"use strict";var T={},n=function(){this.propagationStopped=!0},C=function(){this.defaultPrevented=!0};T._emit=T._dispatchEvent=function(m,D){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var v=this._eventRegistry[m]||[],o=this._defaultHandlers[m];if(!(!v.length&&!o)){(typeof D!="object"||!D)&&(D={}),D.type||(D.type=m),D.stopPropagation||(D.stopPropagation=n),D.preventDefault||(D.preventDefault=C),v=v.slice();for(var u=0;u<v.length&&(v[u](D,this),!D.propagationStopped);u++);if(o&&!D.defaultPrevented)return o(D,this)}},T._signal=function(m,D){var v=(this._eventRegistry||{})[m];if(v){v=v.slice();for(var o=0;o<v.length;o++)v[o](D,this)}},T.once=function(m,D){var v=this;if(this.on(m,function o(){v.off(m,o),D.apply(null,arguments)}),!D)return new Promise(function(o){D=o})},T.setDefaultHandler=function(m,D){var v=this._defaultHandlers;if(v||(v=this._defaultHandlers={_disabled_:{}}),v[m]){var o=v[m],u=v._disabled_[m];u||(v._disabled_[m]=u=[]),u.push(o);var a=u.indexOf(D);a!=-1&&u.splice(a,1)}v[m]=D},T.removeDefaultHandler=function(m,D){var v=this._defaultHandlers;if(v){var o=v._disabled_[m];if(v[m]==D)o&&this.setDefaultHandler(m,o.pop());else if(o){var u=o.indexOf(D);u!=-1&&o.splice(u,1)}}},T.on=T.addEventListener=function(m,D,v){this._eventRegistry=this._eventRegistry||{};var o=this._eventRegistry[m];return o||(o=this._eventRegistry[m]=[]),o.indexOf(D)==-1&&o[v?"unshift":"push"](D),D},T.off=T.removeListener=T.removeEventListener=function(m,D){this._eventRegistry=this._eventRegistry||{};var v=this._eventRegistry[m];if(v){var o=v.indexOf(D);o!==-1&&v.splice(o,1)}},T.removeAllListeners=function(m){m||(this._eventRegistry=this._defaultHandlers=void 0),this._eventRegistry&&(this._eventRegistry[m]=void 0),this._defaultHandlers&&(this._defaultHandlers[m]=void 0)},ee.EventEmitter=T}),ace.define("ace/range",[],function(V,ee,Y){"use strict";var T=function(){function n(C,m,D,v){this.start={row:C,column:m},this.end={row:D,column:v}}return n.prototype.isEqual=function(C){return this.start.row===C.start.row&&this.end.row===C.end.row&&this.start.column===C.start.column&&this.end.column===C.end.column},n.prototype.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},n.prototype.contains=function(C,m){return this.compare(C,m)==0},n.prototype.compareRange=function(C){var m,D=C.end,v=C.start;return m=this.compare(D.row,D.column),m==1?(m=this.compare(v.row,v.column),m==1?2:m==0?1:0):m==-1?-2:(m=this.compare(v.row,v.column),m==-1?-1:m==1?42:0)},n.prototype.comparePoint=function(C){return this.compare(C.row,C.column)},n.prototype.containsRange=function(C){return this.comparePoint(C.start)==0&&this.comparePoint(C.end)==0},n.prototype.intersects=function(C){var m=this.compareRange(C);return m==-1||m==0||m==1},n.prototype.isEnd=function(C,m){return this.end.row==C&&this.end.column==m},n.prototype.isStart=function(C,m){return this.start.row==C&&this.start.column==m},n.prototype.setStart=function(C,m){typeof C=="object"?(this.start.column=C.column,this.start.row=C.row):(this.start.row=C,this.start.column=m)},n.prototype.setEnd=function(C,m){typeof C=="object"?(this.end.column=C.column,this.end.row=C.row):(this.end.row=C,this.end.column=m)},n.prototype.inside=function(C,m){return this.compare(C,m)==0?!(this.isEnd(C,m)||this.isStart(C,m)):!1},n.prototype.insideStart=function(C,m){return this.compare(C,m)==0?!this.isEnd(C,m):!1},n.prototype.insideEnd=function(C,m){return this.compare(C,m)==0?!this.isStart(C,m):!1},n.prototype.compare=function(C,m){return!this.isMultiLine()&&C===this.start.row?m<this.start.column?-1:m>this.end.column?1:0:C<this.start.row?-1:C>this.end.row?1:this.start.row===C?m>=this.start.column?0:-1:this.end.row===C?m<=this.end.column?0:1:0},n.prototype.compareStart=function(C,m){return this.start.row==C&&this.start.column==m?-1:this.compare(C,m)},n.prototype.compareEnd=function(C,m){return this.end.row==C&&this.end.column==m?1:this.compare(C,m)},n.prototype.compareInside=function(C,m){return this.end.row==C&&this.end.column==m?1:this.start.row==C&&this.start.column==m?-1:this.compare(C,m)},n.prototype.clipRows=function(C,m){if(this.end.row>m)var D={row:m+1,column:0};else if(this.end.row<C)var D={row:C,column:0};if(this.start.row>m)var v={row:m+1,column:0};else if(this.start.row<C)var v={row:C,column:0};return n.fromPoints(v||this.start,D||this.end)},n.prototype.extend=function(C,m){var D=this.compare(C,m);if(D==0)return this;if(D==-1)var v={row:C,column:m};else var o={row:C,column:m};return n.fromPoints(v||this.start,o||this.end)},n.prototype.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},n.prototype.isMultiLine=function(){return this.start.row!==this.end.row},n.prototype.clone=function(){return n.fromPoints(this.start,this.end)},n.prototype.collapseRows=function(){return this.end.column==0?new n(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new n(this.start.row,0,this.end.row,0)},n.prototype.toScreenRange=function(C){var m=C.documentToScreenPosition(this.start),D=C.documentToScreenPosition(this.end);return new n(m.row,m.column,D.row,D.column)},n.prototype.moveBy=function(C,m){this.start.row+=C,this.start.column+=m,this.end.row+=C,this.end.column+=m},n}();T.fromPoints=function(n,C){return new T(n.row,n.column,C.row,C.column)},T.comparePoints=function(n,C){return n.row-C.row||n.column-C.column},ee.Range=T}),ace.define("ace/anchor",[],function(V,ee,Y){"use strict";function T(v,o,u){var a=u?v.column<=o.column:v.column<o.column;return v.row<o.row||v.row==o.row&&a}function n(v,o,u){var a=v.action=="insert",_=(a?1:-1)*(v.end.row-v.start.row),R=(a?1:-1)*(v.end.column-v.start.column),f=v.start,Z=a?f:v.end;return T(o,f,u)?{row:o.row,column:o.column}:T(Z,o,!u)?{row:o.row+_,column:o.column+(o.row==Z.row?R:0)}:{row:f.row,column:f.column}}var C=V("./lib/oop"),m=V("./lib/event_emitter").EventEmitter,D=function(){function v(o,u,a){this.$onChange=this.onChange.bind(this),this.attach(o),typeof u!="number"?this.setPosition(u.row,u.column):this.setPosition(u,a)}return v.prototype.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},v.prototype.getDocument=function(){return this.document},v.prototype.onChange=function(o){if(!(o.start.row==o.end.row&&o.start.row!=this.row)&&!(o.start.row>this.row)){var u=n(o,{row:this.row,column:this.column},this.$insertRight);this.setPosition(u.row,u.column,!0)}},v.prototype.setPosition=function(o,u,a){var _;if(a?_={row:o,column:u}:_=this.$clipPositionToDocument(o,u),!(this.row==_.row&&this.column==_.column)){var R={row:this.row,column:this.column};this.row=_.row,this.column=_.column,this._signal("change",{old:R,value:_})}},v.prototype.detach=function(){this.document.off("change",this.$onChange)},v.prototype.attach=function(o){this.document=o||this.document,this.document.on("change",this.$onChange)},v.prototype.$clipPositionToDocument=function(o,u){var a={};return o>=this.document.getLength()?(a.row=Math.max(0,this.document.getLength()-1),a.column=this.document.getLine(a.row).length):o<0?(a.row=0,a.column=0):(a.row=o,a.column=Math.min(this.document.getLine(a.row).length,Math.max(0,u))),u<0&&(a.column=0),a},v}();D.prototype.$insertRight=!1,C.implement(D.prototype,m),ee.Anchor=D}),ace.define("ace/document",[],function(V,ee,Y){"use strict";var T=V("./lib/oop"),n=V("./apply_delta").applyDelta,C=V("./lib/event_emitter").EventEmitter,m=V("./range").Range,D=V("./anchor").Anchor,v=function(){function o(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 o.prototype.setValue=function(u){var a=this.getLength()-1;this.remove(new m(0,0,a,this.getLine(a).length)),this.insert({row:0,column:0},u||"")},o.prototype.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},o.prototype.createAnchor=function(u,a){return new D(this,u,a)},o.prototype.$detectNewLine=function(u){var a=u.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=a?a[1]:`
|
|
385
|
-
`,this._signal("changeNewLineMode")},o.prototype.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return`\r
|
|
386
|
-
`;case"unix":return`
|
|
387
|
-
`;default:return this.$autoNewLine||`
|
|
388
|
-
`}},o.prototype.setNewLineMode=function(u){this.$newLineMode!==u&&(this.$newLineMode=u,this._signal("changeNewLineMode"))},o.prototype.getNewLineMode=function(){return this.$newLineMode},o.prototype.isNewLine=function(u){return u==`\r
|
|
389
|
-
`||u=="\r"||u==`
|
|
390
|
-
`},o.prototype.getLine=function(u){return this.$lines[u]||""},o.prototype.getLines=function(u,a){return this.$lines.slice(u,a+1)},o.prototype.getAllLines=function(){return this.getLines(0,this.getLength())},o.prototype.getLength=function(){return this.$lines.length},o.prototype.getTextRange=function(u){return this.getLinesForRange(u).join(this.getNewLineCharacter())},o.prototype.getLinesForRange=function(u){var a;if(u.start.row===u.end.row)a=[this.getLine(u.start.row).substring(u.start.column,u.end.column)];else{a=this.getLines(u.start.row,u.end.row),a[0]=(a[0]||"").substring(u.start.column);var _=a.length-1;u.end.row-u.start.row==_&&(a[_]=a[_].substring(0,u.end.column))}return a},o.prototype.insertLines=function(u,a){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(u,a)},o.prototype.removeLines=function(u,a){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(u,a)},o.prototype.insertNewLine=function(u){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(u,["",""])},o.prototype.insert=function(u,a){return this.getLength()<=1&&this.$detectNewLine(a),this.insertMergedLines(u,this.$split(a))},o.prototype.insertInLine=function(u,a){var _=this.clippedPos(u.row,u.column),R=this.pos(u.row,u.column+a.length);return this.applyDelta({start:_,end:R,action:"insert",lines:[a]},!0),this.clonePos(R)},o.prototype.clippedPos=function(u,a){var _=this.getLength();u===void 0?u=_:u<0?u=0:u>=_&&(u=_-1,a=void 0);var R=this.getLine(u);return a==null&&(a=R.length),a=Math.min(Math.max(a,0),R.length),{row:u,column:a}},o.prototype.clonePos=function(u){return{row:u.row,column:u.column}},o.prototype.pos=function(u,a){return{row:u,column:a}},o.prototype.$clipPosition=function(u){var a=this.getLength();return u.row>=a?(u.row=Math.max(0,a-1),u.column=this.getLine(a-1).length):(u.row=Math.max(0,u.row),u.column=Math.min(Math.max(u.column,0),this.getLine(u.row).length)),u},o.prototype.insertFullLines=function(u,a){u=Math.min(Math.max(u,0),this.getLength());var _=0;u<this.getLength()?(a=a.concat([""]),_=0):(a=[""].concat(a),u--,_=this.$lines[u].length),this.insertMergedLines({row:u,column:_},a)},o.prototype.insertMergedLines=function(u,a){var _=this.clippedPos(u.row,u.column),R={row:_.row+a.length-1,column:(a.length==1?_.column:0)+a[a.length-1].length};return this.applyDelta({start:_,end:R,action:"insert",lines:a}),this.clonePos(R)},o.prototype.remove=function(u){var a=this.clippedPos(u.start.row,u.start.column),_=this.clippedPos(u.end.row,u.end.column);return this.applyDelta({start:a,end:_,action:"remove",lines:this.getLinesForRange({start:a,end:_})}),this.clonePos(a)},o.prototype.removeInLine=function(u,a,_){var R=this.clippedPos(u,a),f=this.clippedPos(u,_);return this.applyDelta({start:R,end:f,action:"remove",lines:this.getLinesForRange({start:R,end:f})},!0),this.clonePos(R)},o.prototype.removeFullLines=function(u,a){u=Math.min(Math.max(0,u),this.getLength()-1),a=Math.min(Math.max(0,a),this.getLength()-1);var _=a==this.getLength()-1&&u>0,R=a<this.getLength()-1,f=_?u-1:u,Z=_?this.getLine(f).length:0,j=R?a+1:a,H=R?0:this.getLine(j).length,ie=new m(f,Z,j,H),le=this.$lines.slice(u,a+1);return this.applyDelta({start:ie.start,end:ie.end,action:"remove",lines:this.getLinesForRange(ie)}),le},o.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:["",""]})},o.prototype.replace=function(u,a){if(u instanceof m||(u=m.fromPoints(u.start,u.end)),a.length===0&&u.isEmpty())return u.start;if(a==this.getTextRange(u))return u.end;this.remove(u);var _;return a?_=this.insert(u.start,a):_=u.start,_},o.prototype.applyDeltas=function(u){for(var a=0;a<u.length;a++)this.applyDelta(u[a])},o.prototype.revertDeltas=function(u){for(var a=u.length-1;a>=0;a--)this.revertDelta(u[a])},o.prototype.applyDelta=function(u,a){var _=u.action=="insert";(_?u.lines.length<=1&&!u.lines[0]:!m.comparePoints(u.start,u.end))||(_&&u.lines.length>2e4?this.$splitAndapplyLargeDelta(u,2e4):(n(this.$lines,u,a),this._signal("change",u)))},o.prototype.$safeApplyDelta=function(u){var a=this.$lines.length;(u.action=="remove"&&u.start.row<a&&u.end.row<a||u.action=="insert"&&u.start.row<=a)&&this.applyDelta(u)},o.prototype.$splitAndapplyLargeDelta=function(u,a){for(var _=u.lines,R=_.length-a+1,f=u.start.row,Z=u.start.column,j=0,H=0;j<R;j=H){H+=a-1;var ie=_.slice(j,H);ie.push(""),this.applyDelta({start:this.pos(f+j,Z),end:this.pos(f+H,Z=0),action:u.action,lines:ie},!0)}u.lines=_.slice(j),u.start.row=f+j,u.start.column=Z,this.applyDelta(u,!0)},o.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()})},o.prototype.indexToPosition=function(u,a){for(var _=this.$lines||this.getAllLines(),R=this.getNewLineCharacter().length,f=a||0,Z=_.length;f<Z;f++)if(u-=_[f].length+R,u<0)return{row:f,column:u+_[f].length+R};return{row:Z-1,column:u+_[Z-1].length+R}},o.prototype.positionToIndex=function(u,a){for(var _=this.$lines||this.getAllLines(),R=this.getNewLineCharacter().length,f=0,Z=Math.min(u.row,_.length),j=a||0;j<Z;++j)f+=_[j].length+R;return f+u.column},o.prototype.$split=function(u){return u.split(/\r\n|\r|\n/)},o}();v.prototype.$autoNewLine="",v.prototype.$newLineMode="auto",T.implement(v.prototype,C),ee.Document=v}),ace.define("ace/lib/deep_copy",[],function(V,ee,Y){ee.deepCopy=function T(n){if(typeof n!="object"||!n)return n;var C;if(Array.isArray(n)){C=[];for(var m=0;m<n.length;m++)C[m]=T(n[m]);return C}if(Object.prototype.toString.call(n)!=="[object Object]")return n;C={};for(var m in n)C[m]=T(n[m]);return C}}),ace.define("ace/lib/lang",[],function(V,ee,Y){"use strict";ee.last=function(C){return C[C.length-1]},ee.stringReverse=function(C){return C.split("").reverse().join("")},ee.stringRepeat=function(C,m){for(var D="";m>0;)m&1&&(D+=C),(m>>=1)&&(C+=C);return D};var T=/^\s\s*/,n=/\s\s*$/;ee.stringTrimLeft=function(C){return C.replace(T,"")},ee.stringTrimRight=function(C){return C.replace(n,"")},ee.copyObject=function(C){var m={};for(var D in C)m[D]=C[D];return m},ee.copyArray=function(C){for(var m=[],D=0,v=C.length;D<v;D++)C[D]&&typeof C[D]=="object"?m[D]=this.copyObject(C[D]):m[D]=C[D];return m},ee.deepCopy=V("./deep_copy").deepCopy,ee.arrayToMap=function(C){for(var m={},D=0;D<C.length;D++)m[C[D]]=1;return m},ee.createMap=function(C){var m=Object.create(null);for(var D in C)m[D]=C[D];return m},ee.arrayRemove=function(C,m){for(var D=0;D<=C.length;D++)m===C[D]&&C.splice(D,1)},ee.escapeRegExp=function(C){return C.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},ee.escapeHTML=function(C){return(""+C).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<")},ee.getMatchOffsets=function(C,m){var D=[];return C.replace(m,function(v){D.push({offset:arguments[arguments.length-2],length:v.length})}),D},ee.deferredCall=function(C){var m=null,D=function(){m=null,C()},v=function(o){return v.cancel(),m=setTimeout(D,o||0),v};return v.schedule=v,v.call=function(){return this.cancel(),C(),v},v.cancel=function(){return clearTimeout(m),m=null,v},v.isPending=function(){return m},v},ee.delayedCall=function(C,m){var D=null,v=function(){D=null,C()},o=function(u){D==null&&(D=setTimeout(v,u||m))};return o.delay=function(u){D&&clearTimeout(D),D=setTimeout(v,u||m)},o.schedule=o,o.call=function(){this.cancel(),C()},o.cancel=function(){D&&clearTimeout(D),D=null},o.isPending=function(){return D},o},ee.supportsLookbehind=function(){try{new RegExp("(?<=.)")}catch(C){return!1}return!0},ee.skipEmptyMatch=function(C,m,D){return D&&C.codePointAt(m)>65535?2:1}}),ace.define("ace/worker/mirror",[],function(V,ee,Y){"use strict";var T=V("../document").Document,n=V("../lib/lang"),C=ee.Mirror=function(m){this.sender=m;var D=this.doc=new T(""),v=this.deferredUpdate=n.delayedCall(this.onUpdate.bind(this)),o=this;m.on("change",function(u){var a=u.data;if(a[0].start)D.applyDeltas(a);else for(var _=0;_<a.length;_+=2){var R,f;if(Array.isArray(a[_+1])?R={action:"insert",start:a[_],lines:a[_+1]}:R={action:"remove",start:a[_],end:a[_+1]},(R.action=="insert"?R.start:R.end).row>=D.$lines.length)throw f=new Error("Invalid delta"),f.data={path:o.$path,linesLength:D.$lines.length,start:R.start,end:R.end},f;D.applyDelta(R,!0)}if(o.$timeout)return v.schedule(o.$timeout);o.onUpdate()})};(function(){this.$timeout=500,this.setTimeout=function(m){this.$timeout=m},this.setValue=function(m){this.doc.setValue(m),this.deferredUpdate.schedule(this.$timeout)},this.getValue=function(m){this.sender.callback(this.doc.getValue(),m)},this.onUpdate=function(){},this.isPending=function(){return this.deferredUpdate.isPending()}}).call(C.prototype)}),ace.define("ace/mode/json/json_parse",[],function(V,ee,Y){"use strict";var T,n,C={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
391
|
-
`,r:"\r",t:" "},m,D=function(j){throw{name:"SyntaxError",message:j,at:T,text:m}},v=function(j){return j&&j!==n&&D("Expected '"+j+"' instead of '"+n+"'"),n=m.charAt(T),T+=1,n},o=function(){var j,H="";for(n==="-"&&(H="-",v("-"));n>="0"&&n<="9";)H+=n,v();if(n===".")for(H+=".";v()&&n>="0"&&n<="9";)H+=n;if(n==="e"||n==="E")for(H+=n,v(),(n==="-"||n==="+")&&(H+=n,v());n>="0"&&n<="9";)H+=n,v();if(j=+H,!isNaN(j))return j;D("Bad number")},u=function(){var j,H,ie="",le;if(n==='"')for(;v();){if(n==='"')return v(),ie;if(n==="\\")if(v(),n==="u"){for(le=0,H=0;H<4&&(j=parseInt(v(),16),!!isFinite(j));H+=1)le=le*16+j;ie+=String.fromCharCode(le)}else{if(typeof C[n]!="string")break;ie+=C[n]}else{if(n==`
|
|
392
|
-
`||n=="\r")break;ie+=n}}D("Bad string")},a=function(){for(;n&&n<=" ";)v()},_=function(){switch(n){case"t":return v("t"),v("r"),v("u"),v("e"),!0;case"f":return v("f"),v("a"),v("l"),v("s"),v("e"),!1;case"n":return v("n"),v("u"),v("l"),v("l"),null}D("Unexpected '"+n+"'")},R,f=function(){var j=[];if(n==="["){if(v("["),a(),n==="]")return v("]"),j;for(;n;){if(j.push(R()),a(),n==="]")return v("]"),j;v(","),a()}}D("Bad array")},Z=function(){var j,H={};if(n==="{"){if(v("{"),a(),n==="}")return v("}"),H;for(;n;){if(j=u(),a(),v(":"),Object.hasOwnProperty.call(H,j)&&D('Duplicate key "'+j+'"'),H[j]=R(),a(),n==="}")return v("}"),H;v(","),a()}}D("Bad object")};return R=function(){switch(a(),n){case"{":return Z();case"[":return f();case'"':return u();case"-":return o();default:return n>="0"&&n<="9"?o():_()}},function(j,H){var ie;return m=j,T=0,n=" ",ie=R(),a(),n&&D("Syntax error"),typeof H=="function"?function le(M,w){var y,p,g=M[w];if(g&&typeof g=="object")for(y in g)Object.hasOwnProperty.call(g,y)&&(p=le(g,y),p!==void 0?g[y]=p:delete g[y]);return H.call(M,w,g)}({"":ie},""):ie}}),ace.define("ace/mode/json_worker",[],function(V,ee,Y){"use strict";var T=V("../lib/oop"),n=V("../worker/mirror").Mirror,C=V("./json/json_parse"),m=ee.JsonWorker=function(D){n.call(this,D),this.setTimeout(200)};T.inherits(m,n),function(){this.onUpdate=function(){var D=this.doc.getValue(),v=[];try{D&&C(D)}catch(u){var o=this.doc.indexToPosition(u.at-1);v.push({row:o.row,column:o.column,text:u.message,type:"error"})}this.sender.emit("annotate",v)}}.call(m.prototype)})},57051:function(V,ee,Y){(function(T,n){V.exports=ee=n()})(this,function(){var T=T||function(n,C){var m;if(typeof window!="undefined"&&window.crypto&&(m=window.crypto),typeof self!="undefined"&&self.crypto&&(m=self.crypto),typeof globalThis!="undefined"&&globalThis.crypto&&(m=globalThis.crypto),!m&&typeof window!="undefined"&&window.msCrypto&&(m=window.msCrypto),!m&&typeof Y.g!="undefined"&&Y.g.crypto&&(m=Y.g.crypto),!m)try{m=Y(50477)}catch(M){}var D=function(){if(m){if(typeof m.getRandomValues=="function")try{return m.getRandomValues(new Uint32Array(1))[0]}catch(M){}if(typeof m.randomBytes=="function")try{return m.randomBytes(4).readInt32LE()}catch(M){}}throw new Error("Native crypto module could not be used to get secure random number.")},v=Object.create||function(){function M(){}return function(w){var y;return M.prototype=w,y=new M,M.prototype=null,y}}(),o={},u=o.lib={},a=u.Base=function(){return{extend:function(M){var w=v(this);return M&&w.mixIn(M),(!w.hasOwnProperty("init")||this.init===w.init)&&(w.init=function(){w.$super.init.apply(this,arguments)}),w.init.prototype=w,w.$super=this,w},create:function(){var M=this.extend();return M.init.apply(M,arguments),M},init:function(){},mixIn:function(M){for(var w in M)M.hasOwnProperty(w)&&(this[w]=M[w]);M.hasOwnProperty("toString")&&(this.toString=M.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),_=u.WordArray=a.extend({init:function(M,w){M=this.words=M||[],w!=C?this.sigBytes=w:this.sigBytes=M.length*4},toString:function(M){return(M||f).stringify(this)},concat:function(M){var w=this.words,y=M.words,p=this.sigBytes,g=M.sigBytes;if(this.clamp(),p%4)for(var d=0;d<g;d++){var x=y[d>>>2]>>>24-d%4*8&255;w[p+d>>>2]|=x<<24-(p+d)%4*8}else for(var b=0;b<g;b+=4)w[p+b>>>2]=y[b>>>2];return this.sigBytes+=g,this},clamp:function(){var M=this.words,w=this.sigBytes;M[w>>>2]&=4294967295<<32-w%4*8,M.length=n.ceil(w/4)},clone:function(){var M=a.clone.call(this);return M.words=this.words.slice(0),M},random:function(M){for(var w=[],y=0;y<M;y+=4)w.push(D());return new _.init(w,M)}}),R=o.enc={},f=R.Hex={stringify:function(M){for(var w=M.words,y=M.sigBytes,p=[],g=0;g<y;g++){var d=w[g>>>2]>>>24-g%4*8&255;p.push((d>>>4).toString(16)),p.push((d&15).toString(16))}return p.join("")},parse:function(M){for(var w=M.length,y=[],p=0;p<w;p+=2)y[p>>>3]|=parseInt(M.substr(p,2),16)<<24-p%8*4;return new _.init(y,w/2)}},Z=R.Latin1={stringify:function(M){for(var w=M.words,y=M.sigBytes,p=[],g=0;g<y;g++){var d=w[g>>>2]>>>24-g%4*8&255;p.push(String.fromCharCode(d))}return p.join("")},parse:function(M){for(var w=M.length,y=[],p=0;p<w;p++)y[p>>>2]|=(M.charCodeAt(p)&255)<<24-p%4*8;return new _.init(y,w)}},j=R.Utf8={stringify:function(M){try{return decodeURIComponent(escape(Z.stringify(M)))}catch(w){throw new Error("Malformed UTF-8 data")}},parse:function(M){return Z.parse(unescape(encodeURIComponent(M)))}},H=u.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new _.init,this._nDataBytes=0},_append:function(M){typeof M=="string"&&(M=j.parse(M)),this._data.concat(M),this._nDataBytes+=M.sigBytes},_process:function(M){var w,y=this._data,p=y.words,g=y.sigBytes,d=this.blockSize,x=d*4,b=g/x;M?b=n.ceil(b):b=n.max((b|0)-this._minBufferSize,0);var B=b*d,$=n.min(B*4,g);if(B){for(var k=0;k<B;k+=d)this._doProcessBlock(p,k);w=p.splice(0,B),y.sigBytes-=$}return new _.init(w,$)},clone:function(){var M=a.clone.call(this);return M._data=this._data.clone(),M},_minBufferSize:0}),ie=u.Hasher=H.extend({cfg:a.extend(),init:function(M){this.cfg=this.cfg.extend(M),this.reset()},reset:function(){H.reset.call(this),this._doReset()},update:function(M){return this._append(M),this._process(),this},finalize:function(M){M&&this._append(M);var w=this._doFinalize();return w},blockSize:512/32,_createHelper:function(M){return function(w,y){return new M.init(y).finalize(w)}},_createHmacHelper:function(M){return function(w,y){return new le.HMAC.init(M,y).finalize(w)}}}),le=o.algo={};return o}(Math);return T})},91778:function(V,ee,Y){(function(T,n){V.exports=ee=n(Y(57051))})(this,function(T){return function(n){var C=T,m=C.lib,D=m.WordArray,v=m.Hasher,o=C.algo,u=[];(function(){for(var j=0;j<64;j++)u[j]=n.abs(n.sin(j+1))*4294967296|0})();var a=o.MD5=v.extend({_doReset:function(){this._hash=new D.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(j,H){for(var ie=0;ie<16;ie++){var le=H+ie,M=j[le];j[le]=(M<<8|M>>>24)&16711935|(M<<24|M>>>8)&4278255360}var w=this._hash.words,y=j[H+0],p=j[H+1],g=j[H+2],d=j[H+3],x=j[H+4],b=j[H+5],B=j[H+6],$=j[H+7],k=j[H+8],F=j[H+9],I=j[H+10],U=j[H+11],re=j[H+12],X=j[H+13],ae=j[H+14],ce=j[H+15],W=w[0],K=w[1],z=w[2],G=w[3];W=_(W,K,z,G,y,7,u[0]),G=_(G,W,K,z,p,12,u[1]),z=_(z,G,W,K,g,17,u[2]),K=_(K,z,G,W,d,22,u[3]),W=_(W,K,z,G,x,7,u[4]),G=_(G,W,K,z,b,12,u[5]),z=_(z,G,W,K,B,17,u[6]),K=_(K,z,G,W,$,22,u[7]),W=_(W,K,z,G,k,7,u[8]),G=_(G,W,K,z,F,12,u[9]),z=_(z,G,W,K,I,17,u[10]),K=_(K,z,G,W,U,22,u[11]),W=_(W,K,z,G,re,7,u[12]),G=_(G,W,K,z,X,12,u[13]),z=_(z,G,W,K,ae,17,u[14]),K=_(K,z,G,W,ce,22,u[15]),W=R(W,K,z,G,p,5,u[16]),G=R(G,W,K,z,B,9,u[17]),z=R(z,G,W,K,U,14,u[18]),K=R(K,z,G,W,y,20,u[19]),W=R(W,K,z,G,b,5,u[20]),G=R(G,W,K,z,I,9,u[21]),z=R(z,G,W,K,ce,14,u[22]),K=R(K,z,G,W,x,20,u[23]),W=R(W,K,z,G,F,5,u[24]),G=R(G,W,K,z,ae,9,u[25]),z=R(z,G,W,K,d,14,u[26]),K=R(K,z,G,W,k,20,u[27]),W=R(W,K,z,G,X,5,u[28]),G=R(G,W,K,z,g,9,u[29]),z=R(z,G,W,K,$,14,u[30]),K=R(K,z,G,W,re,20,u[31]),W=f(W,K,z,G,b,4,u[32]),G=f(G,W,K,z,k,11,u[33]),z=f(z,G,W,K,U,16,u[34]),K=f(K,z,G,W,ae,23,u[35]),W=f(W,K,z,G,p,4,u[36]),G=f(G,W,K,z,x,11,u[37]),z=f(z,G,W,K,$,16,u[38]),K=f(K,z,G,W,I,23,u[39]),W=f(W,K,z,G,X,4,u[40]),G=f(G,W,K,z,y,11,u[41]),z=f(z,G,W,K,d,16,u[42]),K=f(K,z,G,W,B,23,u[43]),W=f(W,K,z,G,F,4,u[44]),G=f(G,W,K,z,re,11,u[45]),z=f(z,G,W,K,ce,16,u[46]),K=f(K,z,G,W,g,23,u[47]),W=Z(W,K,z,G,y,6,u[48]),G=Z(G,W,K,z,$,10,u[49]),z=Z(z,G,W,K,ae,15,u[50]),K=Z(K,z,G,W,b,21,u[51]),W=Z(W,K,z,G,re,6,u[52]),G=Z(G,W,K,z,d,10,u[53]),z=Z(z,G,W,K,I,15,u[54]),K=Z(K,z,G,W,p,21,u[55]),W=Z(W,K,z,G,k,6,u[56]),G=Z(G,W,K,z,ce,10,u[57]),z=Z(z,G,W,K,B,15,u[58]),K=Z(K,z,G,W,X,21,u[59]),W=Z(W,K,z,G,x,6,u[60]),G=Z(G,W,K,z,U,10,u[61]),z=Z(z,G,W,K,g,15,u[62]),K=Z(K,z,G,W,F,21,u[63]),w[0]=w[0]+W|0,w[1]=w[1]+K|0,w[2]=w[2]+z|0,w[3]=w[3]+G|0},_doFinalize:function(){var j=this._data,H=j.words,ie=this._nDataBytes*8,le=j.sigBytes*8;H[le>>>5]|=128<<24-le%32;var M=n.floor(ie/4294967296),w=ie;H[(le+64>>>9<<4)+15]=(M<<8|M>>>24)&16711935|(M<<24|M>>>8)&4278255360,H[(le+64>>>9<<4)+14]=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,j.sigBytes=(H.length+1)*4,this._process();for(var y=this._hash,p=y.words,g=0;g<4;g++){var d=p[g];p[g]=(d<<8|d>>>24)&16711935|(d<<24|d>>>8)&4278255360}return y},clone:function(){var j=v.clone.call(this);return j._hash=this._hash.clone(),j}});function _(j,H,ie,le,M,w,y){var p=j+(H&ie|~H&le)+M+y;return(p<<w|p>>>32-w)+H}function R(j,H,ie,le,M,w,y){var p=j+(H&le|ie&~le)+M+y;return(p<<w|p>>>32-w)+H}function f(j,H,ie,le,M,w,y){var p=j+(H^ie^le)+M+y;return(p<<w|p>>>32-w)+H}function Z(j,H,ie,le,M,w,y){var p=j+(ie^(H|~le))+M+y;return(p<<w|p>>>32-w)+H}C.MD5=v._createHelper(a),C.HmacMD5=v._createHmacHelper(a)}(Math),T.MD5})},85589:function(V){(function(ee,Y){V.exports=Y()})(this,function(){"use strict";function ee(A,P){return P={exports:{}},A(P,P.exports),P.exports}var Y=ee(function(A){var P=A.exports=typeof window!="undefined"&&window.Math==Math?window:typeof self!="undefined"&&self.Math==Math?self:Function("return this")();typeof __g=="number"&&(__g=P)}),T=ee(function(A){var P=A.exports={version:"2.6.5"};typeof __e=="number"&&(__e=P)}),n=T.version,C=function(A){return typeof A=="object"?A!==null:typeof A=="function"},m=function(A){if(!C(A))throw TypeError(A+" is not an object!");return A},D=function(A){try{return!!A()}catch(P){return!0}},v=!D(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7}),o=Y.document,u=C(o)&&C(o.createElement),a=function(A){return u?o.createElement(A):{}},_=!v&&!D(function(){return Object.defineProperty(a("div"),"a",{get:function(){return 7}}).a!=7}),R=function(A,P){if(!C(A))return A;var oe,ne;if(P&&typeof(oe=A.toString)=="function"&&!C(ne=oe.call(A))||typeof(oe=A.valueOf)=="function"&&!C(ne=oe.call(A))||!P&&typeof(oe=A.toString)=="function"&&!C(ne=oe.call(A)))return ne;throw TypeError("Can't convert object to primitive value")},f=Object.defineProperty,Z=v?Object.defineProperty:function(P,oe,ne){if(m(P),oe=R(oe,!0),m(ne),_)try{return f(P,oe,ne)}catch(ue){}if("get"in ne||"set"in ne)throw TypeError("Accessors not supported!");return"value"in ne&&(P[oe]=ne.value),P},j={f:Z},H=function(A,P){return{enumerable:!(A&1),configurable:!(A&2),writable:!(A&4),value:P}},ie=v?function(A,P,oe){return j.f(A,P,H(1,oe))}:function(A,P,oe){return A[P]=oe,A},le={}.hasOwnProperty,M=function(A,P){return le.call(A,P)},w=0,y=Math.random(),p=function(A){return"Symbol(".concat(A===void 0?"":A,")_",(++w+y).toString(36))},g=!1,d=ee(function(A){var P="__core-js_shared__",oe=Y[P]||(Y[P]={});(A.exports=function(ne,ue){return oe[ne]||(oe[ne]=ue!==void 0?ue:{})})("versions",[]).push({version:T.version,mode:g?"pure":"global",copyright:"\xA9 2019 Denis Pushkarev (zloirock.ru)"})}),x=d("native-function-to-string",Function.toString),b=ee(function(A){var P=p("src"),oe="toString",ne=(""+x).split(oe);T.inspectSource=function(ue){return x.call(ue)},(A.exports=function(ue,Ce,ve,Pe){var Te=typeof ve=="function";Te&&(M(ve,"name")||ie(ve,"name",Ce)),ue[Ce]!==ve&&(Te&&(M(ve,P)||ie(ve,P,ue[Ce]?""+ue[Ce]:ne.join(String(Ce)))),ue===Y?ue[Ce]=ve:Pe?ue[Ce]?ue[Ce]=ve:ie(ue,Ce,ve):(delete ue[Ce],ie(ue,Ce,ve)))})(Function.prototype,oe,function(){return typeof this=="function"&&this[P]||x.call(this)})}),B=function(A){if(typeof A!="function")throw TypeError(A+" is not a function!");return A},$=function(A,P,oe){if(B(A),P===void 0)return A;switch(oe){case 1:return function(ne){return A.call(P,ne)};case 2:return function(ne,ue){return A.call(P,ne,ue)};case 3:return function(ne,ue,Ce){return A.call(P,ne,ue,Ce)}}return function(){return A.apply(P,arguments)}},k="prototype",F=function(A,P,oe){var ne=A&F.F,ue=A&F.G,Ce=A&F.S,ve=A&F.P,Pe=A&F.B,Te=ue?Y:Ce?Y[P]||(Y[P]={}):(Y[P]||{})[k],ct=ue?T:T[P]||(T[P]={}),ht=ct[k]||(ct[k]={}),We,Ke,Re,Ct;ue&&(oe=P);for(We in oe)Ke=!ne&&Te&&Te[We]!==void 0,Re=(Ke?Te:oe)[We],Ct=Pe&&Ke?$(Re,Y):ve&&typeof Re=="function"?$(Function.call,Re):Re,Te&&b(Te,We,Re,A&F.U),ct[We]!=Re&&ie(ct,We,Ct),ve&&ht[We]!=Re&&(ht[We]=Re)};Y.core=T,F.F=1,F.G=2,F.S=4,F.P=8,F.B=16,F.W=32,F.U=64,F.R=128;var I=F,U=Math.ceil,re=Math.floor,X=function(A){return isNaN(A=+A)?0:(A>0?re:U)(A)},ae=function(A){if(A==null)throw TypeError("Can't call method on "+A);return A},ce=function(A){return function(P,oe){var ne=String(ae(P)),ue=X(oe),Ce=ne.length,ve,Pe;return ue<0||ue>=Ce?A?"":void 0:(ve=ne.charCodeAt(ue),ve<55296||ve>56319||ue+1===Ce||(Pe=ne.charCodeAt(ue+1))<56320||Pe>57343?A?ne.charAt(ue):ve:A?ne.slice(ue,ue+2):(ve-55296<<10)+(Pe-56320)+65536)}},W=ce(!1);I(I.P,"String",{codePointAt:function(P){return W(this,P)}});var K=T.String.codePointAt,z=Math.max,G=Math.min,Ve=function(A,P){return A=X(A),A<0?z(A+P,0):G(A,P)},ge=String.fromCharCode,_e=String.fromCodePoint;I(I.S+I.F*(!!_e&&_e.length!=1),"String",{fromCodePoint:function(P){for(var oe=arguments,ne=[],ue=arguments.length,Ce=0,ve;ue>Ce;){if(ve=+oe[Ce++],Ve(ve,1114111)!==ve)throw RangeError(ve+" is not a valid code point");ne.push(ve<65536?ge(ve):ge(((ve-=65536)>>10)+55296,ve%1024+56320))}return ne.join("")}});var ze=T.String.fromCodePoint,xe=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,at=/[\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]/,lt=/[\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]/,mt={Space_Separator:xe,ID_Start:at,ID_Continue:lt},Ie={isSpaceSeparator:function(P){return typeof P=="string"&&mt.Space_Separator.test(P)},isIdStartChar:function(P){return typeof P=="string"&&(P>="a"&&P<="z"||P>="A"&&P<="Z"||P==="$"||P==="_"||mt.ID_Start.test(P))},isIdContinueChar:function(P){return typeof P=="string"&&(P>="a"&&P<="z"||P>="A"&&P<="Z"||P>="0"&&P<="9"||P==="$"||P==="_"||P==="\u200C"||P==="\u200D"||mt.ID_Continue.test(P))},isDigit:function(P){return typeof P=="string"&&/[0-9]/.test(P)},isHexDigit:function(P){return typeof P=="string"&&/[0-9A-Fa-f]/.test(P)}},Et,Ne,Ge,bt,qe,je,ke,It,ft,xt=function(P,oe){Et=String(P),Ne="start",Ge=[],bt=0,qe=1,je=0,ke=void 0,It=void 0,ft=void 0;do ke=Ue(),Gt[Ne]();while(ke.type!=="eof");return typeof oe=="function"?wt({"":ft},"",oe):ft};function wt(A,P,oe){var ne=A[P];if(ne!=null&&typeof ne=="object")if(Array.isArray(ne))for(var ue=0;ue<ne.length;ue++){var Ce=String(ue),ve=wt(ne,Ce,oe);ve===void 0?delete ne[Ce]:Object.defineProperty(ne,Ce,{value:ve,writable:!0,enumerable:!0,configurable:!0})}else for(var Pe in ne){var Te=wt(ne,Pe,oe);Te===void 0?delete ne[Pe]:Object.defineProperty(ne,Pe,{value:Te,writable:!0,enumerable:!0,configurable:!0})}return oe.call(A,P,ne)}var fe,de,gt,Xe,De;function Ue(){for(fe="default",de="",gt=!1,Xe=1;;){De=Ye();var A=$t[fe]();if(A)return A}}function Ye(){if(Et[bt])return String.fromCodePoint(Et.codePointAt(bt))}function J(){var A=Ye();return A===`
|
|
393
|
-
`?(qe++,je=0):A?je+=A.length:je++,A&&(bt+=A.length),A}var $t={default:function(){switch(De){case" ":case"\v":case"\f":case" ":case"\xA0":case"\uFEFF":case`
|
|
394
|
-
`:case"\r":case"\u2028":case"\u2029":J();return;case"/":J(),fe="comment";return;case void 0:return J(),we("eof")}if(Ie.isSpaceSeparator(De)){J();return}return $t[Ne]()},comment:function(){switch(De){case"*":J(),fe="multiLineComment";return;case"/":J(),fe="singleLineComment";return}throw Ae(J())},multiLineComment:function(){switch(De){case"*":J(),fe="multiLineCommentAsterisk";return;case void 0:throw Ae(J())}J()},multiLineCommentAsterisk:function(){switch(De){case"*":J();return;case"/":J(),fe="default";return;case void 0:throw Ae(J())}J(),fe="multiLineComment"},singleLineComment:function(){switch(De){case`
|
|
395
|
-
`:case"\r":case"\u2028":case"\u2029":J(),fe="default";return;case void 0:return J(),we("eof")}J()},value:function(){switch(De){case"{":case"[":return we("punctuator",J());case"n":return J(),st("ull"),we("null",null);case"t":return J(),st("rue"),we("boolean",!0);case"f":return J(),st("alse"),we("boolean",!1);case"-":case"+":J()==="-"&&(Xe=-1),fe="sign";return;case".":de=J(),fe="decimalPointLeading";return;case"0":de=J(),fe="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":de=J(),fe="decimalInteger";return;case"I":return J(),st("nfinity"),we("numeric",1/0);case"N":return J(),st("aN"),we("numeric",NaN);case'"':case"'":gt=J()==='"',de="",fe="string";return}throw Ae(J())},identifierNameStartEscape:function(){if(De!=="u")throw Ae(J());J();var P=ut();switch(P){case"$":case"_":break;default:if(!Ie.isIdStartChar(P))throw Pt();break}de+=P,fe="identifierName"},identifierName:function(){switch(De){case"$":case"_":case"\u200C":case"\u200D":de+=J();return;case"\\":J(),fe="identifierNameEscape";return}if(Ie.isIdContinueChar(De)){de+=J();return}return we("identifier",de)},identifierNameEscape:function(){if(De!=="u")throw Ae(J());J();var P=ut();switch(P){case"$":case"_":case"\u200C":case"\u200D":break;default:if(!Ie.isIdContinueChar(P))throw Pt();break}de+=P,fe="identifierName"},sign:function(){switch(De){case".":de=J(),fe="decimalPointLeading";return;case"0":de=J(),fe="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":de=J(),fe="decimalInteger";return;case"I":return J(),st("nfinity"),we("numeric",Xe*(1/0));case"N":return J(),st("aN"),we("numeric",NaN)}throw Ae(J())},zero:function(){switch(De){case".":de+=J(),fe="decimalPoint";return;case"e":case"E":de+=J(),fe="decimalExponent";return;case"x":case"X":de+=J(),fe="hexadecimal";return}return we("numeric",Xe*0)},decimalInteger:function(){switch(De){case".":de+=J(),fe="decimalPoint";return;case"e":case"E":de+=J(),fe="decimalExponent";return}if(Ie.isDigit(De)){de+=J();return}return we("numeric",Xe*Number(de))},decimalPointLeading:function(){if(Ie.isDigit(De)){de+=J(),fe="decimalFraction";return}throw Ae(J())},decimalPoint:function(){switch(De){case"e":case"E":de+=J(),fe="decimalExponent";return}if(Ie.isDigit(De)){de+=J(),fe="decimalFraction";return}return we("numeric",Xe*Number(de))},decimalFraction:function(){switch(De){case"e":case"E":de+=J(),fe="decimalExponent";return}if(Ie.isDigit(De)){de+=J();return}return we("numeric",Xe*Number(de))},decimalExponent:function(){switch(De){case"+":case"-":de+=J(),fe="decimalExponentSign";return}if(Ie.isDigit(De)){de+=J(),fe="decimalExponentInteger";return}throw Ae(J())},decimalExponentSign:function(){if(Ie.isDigit(De)){de+=J(),fe="decimalExponentInteger";return}throw Ae(J())},decimalExponentInteger:function(){if(Ie.isDigit(De)){de+=J();return}return we("numeric",Xe*Number(de))},hexadecimal:function(){if(Ie.isHexDigit(De)){de+=J(),fe="hexadecimalInteger";return}throw Ae(J())},hexadecimalInteger:function(){if(Ie.isHexDigit(De)){de+=J();return}return we("numeric",Xe*Number(de))},string:function(){switch(De){case"\\":J(),de+=_t();return;case'"':if(gt)return J(),we("string",de);de+=J();return;case"'":if(!gt)return J(),we("string",de);de+=J();return;case`
|
|
396
|
-
`:case"\r":throw Ae(J());case"\u2028":case"\u2029":Xt(De);break;case void 0:throw Ae(J())}de+=J()},start:function(){switch(De){case"{":case"[":return we("punctuator",J())}fe="value"},beforePropertyName:function(){switch(De){case"$":case"_":de=J(),fe="identifierName";return;case"\\":J(),fe="identifierNameStartEscape";return;case"}":return we("punctuator",J());case'"':case"'":gt=J()==='"',fe="string";return}if(Ie.isIdStartChar(De)){de+=J(),fe="identifierName";return}throw Ae(J())},afterPropertyName:function(){if(De===":")return we("punctuator",J());throw Ae(J())},beforePropertyValue:function(){fe="value"},afterPropertyValue:function(){switch(De){case",":case"}":return we("punctuator",J())}throw Ae(J())},beforeArrayValue:function(){if(De==="]")return we("punctuator",J());fe="value"},afterArrayValue:function(){switch(De){case",":case"]":return we("punctuator",J())}throw Ae(J())},end:function(){throw Ae(J())}};function we(A,P){return{type:A,value:P,line:qe,column:je}}function st(A){for(var P=0,oe=A;P<oe.length;P+=1){var ne=oe[P],ue=Ye();if(ue!==ne)throw Ae(J());J()}}function _t(){var A=Ye();switch(A){case"b":return J(),"\b";case"f":return J(),"\f";case"n":return J(),`
|
|
397
|
-
`;case"r":return J(),"\r";case"t":return J()," ";case"v":return J(),"\v";case"0":if(J(),Ie.isDigit(Ye()))throw Ae(J());return"\0";case"x":return J(),Nt();case"u":return J(),ut();case`
|
|
398
|
-
`:case"\u2028":case"\u2029":return J(),"";case"\r":return J(),Ye()===`
|
|
399
|
-
`&&J(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw Ae(J());case void 0:throw Ae(J())}return J()}function Nt(){var A="",P=Ye();if(!Ie.isHexDigit(P)||(A+=J(),P=Ye(),!Ie.isHexDigit(P)))throw Ae(J());return A+=J(),String.fromCodePoint(parseInt(A,16))}function ut(){for(var A="",P=4;P-- >0;){var oe=Ye();if(!Ie.isHexDigit(oe))throw Ae(J());A+=J()}return String.fromCodePoint(parseInt(A,16))}var Gt={start:function(){if(ke.type==="eof")throw it();kt()},beforePropertyName:function(){switch(ke.type){case"identifier":case"string":It=ke.value,Ne="afterPropertyName";return;case"punctuator":At();return;case"eof":throw it()}},afterPropertyName:function(){if(ke.type==="eof")throw it();Ne="beforePropertyValue"},beforePropertyValue:function(){if(ke.type==="eof")throw it();kt()},beforeArrayValue:function(){if(ke.type==="eof")throw it();if(ke.type==="punctuator"&&ke.value==="]"){At();return}kt()},afterPropertyValue:function(){if(ke.type==="eof")throw it();switch(ke.value){case",":Ne="beforePropertyName";return;case"}":At()}},afterArrayValue:function(){if(ke.type==="eof")throw it();switch(ke.value){case",":Ne="beforeArrayValue";return;case"]":At()}},end:function(){}};function kt(){var A;switch(ke.type){case"punctuator":switch(ke.value){case"{":A={};break;case"[":A=[];break}break;case"null":case"boolean":case"numeric":case"string":A=ke.value;break}if(ft===void 0)ft=A;else{var P=Ge[Ge.length-1];Array.isArray(P)?P.push(A):Object.defineProperty(P,It,{value:A,writable:!0,enumerable:!0,configurable:!0})}if(A!==null&&typeof A=="object")Ge.push(A),Array.isArray(A)?Ne="beforeArrayValue":Ne="beforePropertyName";else{var oe=Ge[Ge.length-1];oe==null?Ne="end":Array.isArray(oe)?Ne="afterArrayValue":Ne="afterPropertyValue"}}function At(){Ge.pop();var A=Ge[Ge.length-1];A==null?Ne="end":Array.isArray(A)?Ne="afterArrayValue":Ne="afterPropertyValue"}function Ae(A){return Ft(A===void 0?"JSON5: invalid end of input at "+qe+":"+je:"JSON5: invalid character '"+Rt(A)+"' at "+qe+":"+je)}function it(){return Ft("JSON5: invalid end of input at "+qe+":"+je)}function Pt(){return je-=5,Ft("JSON5: invalid identifier character at "+qe+":"+je)}function Xt(A){console.warn("JSON5: '"+Rt(A)+"' in strings is not valid ECMAScript; consider escaping")}function Rt(A){var P={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(P[A])return P[A];if(A<" "){var oe=A.charCodeAt(0).toString(16);return"\\x"+("00"+oe).substring(oe.length)}return A}function Ft(A){var P=new SyntaxError(A);return P.lineNumber=qe,P.columnNumber=je,P}var Yt=function(P,oe,ne){var ue=[],Ce="",ve,Pe,Te="",ct;if(oe!=null&&typeof oe=="object"&&!Array.isArray(oe)&&(ne=oe.space,ct=oe.quote,oe=oe.replacer),typeof oe=="function")Pe=oe;else if(Array.isArray(oe)){ve=[];for(var ht=0,We=oe;ht<We.length;ht+=1){var Ke=We[ht],Re=void 0;typeof Ke=="string"?Re=Ke:(typeof Ke=="number"||Ke instanceof String||Ke instanceof Number)&&(Re=String(Ke)),Re!==void 0&&ve.indexOf(Re)<0&&ve.push(Re)}}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)),Te=" ".substr(0,ne)):typeof ne=="string"&&(Te=ne.substr(0,10)),Ct("",{"":P});function Ct(be,Le){var he=Le[be];switch(he!=null&&(typeof he.toJSON5=="function"?he=he.toJSON5(be):typeof he.toJSON=="function"&&(he=he.toJSON(be))),Pe&&(he=Pe.call(Le,be,he)),he instanceof Number?he=Number(he):he instanceof String?he=String(he):he instanceof Boolean&&(he=he.valueOf()),he){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof he=="string")return Bt(he,!1);if(typeof he=="number")return String(he);if(typeof he=="object")return Array.isArray(he)?Mt(he):fn(he)}function Bt(be){for(var Le={"'":.1,'"':.2},he={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"},Oe="",Je=0;Je<be.length;Je++){var $e=be[Je];switch($e){case"'":case'"':Le[$e]++,Oe+=$e;continue;case"\0":if(Ie.isDigit(be[Je+1])){Oe+="\\x00";continue}}if(he[$e]){Oe+=he[$e];continue}if($e<" "){var ot=$e.charCodeAt(0).toString(16);Oe+="\\x"+("00"+ot).substring(ot.length);continue}Oe+=$e}var Ze=ct||Object.keys(Le).reduce(function(Qe,rt){return Le[Qe]<Le[rt]?Qe:rt});return Oe=Oe.replace(new RegExp(Ze,"g"),he[Ze]),Ze+Oe+Ze}function fn(be){if(ue.indexOf(be)>=0)throw TypeError("Converting circular structure to JSON5");ue.push(be);var Le=Ce;Ce=Ce+Te;for(var he=ve||Object.keys(be),Oe=[],Je=0,$e=he;Je<$e.length;Je+=1){var ot=$e[Je],Ze=Ct(ot,be);if(Ze!==void 0){var Qe=gn(ot)+":";Te!==""&&(Qe+=" "),Qe+=Ze,Oe.push(Qe)}}var rt;if(Oe.length===0)rt="{}";else{var Dt;if(Te==="")Dt=Oe.join(","),rt="{"+Dt+"}";else{var tn=`,
|
|
400
|
-
`+Ce;Dt=Oe.join(tn),rt=`{
|
|
401
|
-
`+Ce+Dt+`,
|
|
402
|
-
`+Le+"}"}}return ue.pop(),Ce=Le,rt}function gn(be){if(be.length===0)return Bt(be,!0);var Le=String.fromCodePoint(be.codePointAt(0));if(!Ie.isIdStartChar(Le))return Bt(be,!0);for(var he=Le.length;he<be.length;he++)if(!Ie.isIdContinueChar(String.fromCodePoint(be.codePointAt(he))))return Bt(be,!0);return be}function Mt(be){if(ue.indexOf(be)>=0)throw TypeError("Converting circular structure to JSON5");ue.push(be);var Le=Ce;Ce=Ce+Te;for(var he=[],Oe=0;Oe<be.length;Oe++){var Je=Ct(String(Oe),be);he.push(Je!==void 0?Je:"null")}var $e;if(he.length===0)$e="[]";else if(Te===""){var ot=he.join(",");$e="["+ot+"]"}else{var Ze=`,
|
|
403
|
-
`+Ce,Qe=he.join(Ze);$e=`[
|
|
404
|
-
`+Ce+Qe+`,
|
|
405
|
-
`+Le+"]"}return ue.pop(),Ce=Le,$e}},Zt={parse:xt,stringify:Yt},Qt=Zt,en=Qt;return en})}}]);
|
|
406
|
-
|
|
407
|
-
//# sourceMappingURL=vendors-node_modules_iobroker_json-config_build_index_js.27d108f4.chunk.js.map
|