iobroker.eos-admin 9.0.38 → 9.0.39

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.
Files changed (77) hide show
  1. package/NEXOWATT_EOS_BUILD_INFO.json +12 -10
  2. package/README.md +10 -2
  3. package/adminWww/.vite/manifest.json +114 -114
  4. package/adminWww/NEXOWATT_EOS_FRONTEND_MANIFEST.json +13759 -13759
  5. package/adminWww/assets/{AdapterUpdateDialog-D4gUYZep.js → AdapterUpdateDialog-DDmYbnK4.js} +1 -1
  6. package/adminWww/assets/{Adapters-DLxiJc3y.js → Adapters-73Uo4VUy.js} +1 -1
  7. package/adminWww/assets/{ConfigManager-D_YTKUdP.js → ConfigManager-DoFx_j4o.js} +1 -1
  8. package/adminWww/assets/{Enums-D79rON6b.js → Enums-BRQSAW9I.js} +1 -1
  9. package/adminWww/assets/{Fields-CTOv49EU.js → Fields-pcmISvLk.js} +1 -1
  10. package/adminWww/assets/{Files-DNLzjEG5.js → Files-E8-7c9Ab.js} +1 -1
  11. package/adminWww/assets/{Hosts-DHNboUMq.js → Hosts-D4a3shrq.js} +1 -1
  12. package/adminWww/assets/{Instances-BJxYNJAC.js → Instances-ByxEHRoo.js} +1 -1
  13. package/adminWww/assets/{Intro-8R-Q7CR_.js → Intro-DFriWa6g.js} +1 -1
  14. package/adminWww/assets/{Logs-CjAPhWuK.js → Logs-BXR0h5Sz.js} +1 -1
  15. package/adminWww/assets/{Objects-cvdqooGe.js → Objects-h6jg_6uT.js} +1 -1
  16. package/adminWww/assets/{Overview-JPfBOuKv.js → Overview-B39PiMGJ.js} +1 -1
  17. package/adminWww/assets/{State-CGnvMceJ.js → State-CqF2ARx_.js} +1 -1
  18. package/adminWww/assets/{UsedResources-FBd9jThR.js → UsedResources-CnbnoF3d.js} +1 -1
  19. package/adminWww/assets/{Users-BbUu3hZj.js → Users-BQik0rIi.js} +1 -1
  20. package/adminWww/assets/{bootstrap-Df_WTIJg.js → bootstrap-Dllnekqb.js} +3 -3
  21. package/adminWww/assets/{hostInit-BQCRqFay.js → hostInit-CQbS-SCS.js} +1 -1
  22. package/adminWww/assets/{icons-material-DS82xOs8.js → icons-material-rYFYu2DM.js} +1 -1
  23. package/adminWww/assets/{index-BlBZd8r8.js → index-BzbVZbb2.js} +2 -2
  24. package/adminWww/assets/{installSVGRenderer-BtlXF9y3.js → installSVGRenderer-DbH6B8B8.js} +1 -1
  25. package/adminWww/assets/{mf-entry-bootstrap-0-8bb11ea2.js → mf-entry-bootstrap-0-4dee1225.js} +2 -2
  26. package/adminWww/index.html +23 -23
  27. package/adminWww/mf-manifest.json +1 -1
  28. package/adminWww/mf-stats.json +1 -1
  29. package/adminWww/remoteEntry-eos-9.0.39.js +12 -0
  30. package/adminWww/remoteEntry.js +1 -1
  31. package/docs/README.md +1 -0
  32. package/docs/reports/EMS_ZIELLADEN_2026-11-28.md +45 -0
  33. package/docs/reports/unified-9.0.39/PRUEFBERICHT.md +48 -0
  34. package/docs/reports/unified-9.0.39/raw/INDEX.json +51 -0
  35. package/docs/reports/unified-9.0.39/raw/node22-tests-final.log +18189 -0
  36. package/docs/reports/unified-9.0.39/raw/node22-version.log +1 -0
  37. package/docs/reports/unified-9.0.39/raw/node24-tests-final.log +3129 -0
  38. package/docs/reports/unified-9.0.39/raw/node24-version.log +1 -0
  39. package/docs/reports/unified-9.0.39/raw/npm-runtime-audit.json +77 -0
  40. package/docs/reports/unified-9.0.39/raw/overnight-simulation.json +117 -0
  41. package/docs/start/START_HIER_9.0.39.md +14 -0
  42. package/io-package.json +8 -8
  43. package/modules/ocpp/README.md +2 -0
  44. package/modules/ocpp/ocpp/common.js +64 -40
  45. package/modules/ocpp/ocpp/eos-contract.js +8 -3
  46. package/modules/ocpp/runtime.js +10 -5
  47. package/modules/ocpp/test/eos-contract.test.js +67 -0
  48. package/modules/ocpp/test/hosted.test.cjs +29 -1
  49. package/package.json +7 -3
  50. package/release-manifests/unified/build-environment.cdx.json +6 -6
  51. package/release-manifests/unified/files.json +123 -109
  52. package/release-manifests/unified/frontend.cdx.json +6 -6
  53. package/release-manifests/unified/installer.cdx.json +6 -6
  54. package/release-manifests/unified/obsolete-admin-assets.json +83 -0
  55. package/release-manifests/unified/runtime.cdx.json +27 -27
  56. package/release-manifests/unified/validation.json +17 -17
  57. package/tools/eos-release-manifest.cjs +2 -0
  58. package/ui/docs/STATES_AND_DATAPOINTS_DE.md +132 -0
  59. package/ui/ems/engine.js +5 -3
  60. package/ui/ems/evcs-control-mapping.js +13 -1
  61. package/ui/ems/modules/charging-management.js +40 -76
  62. package/ui/ems/services/admin-overview-publisher.js +13 -7
  63. package/ui/ems/services/charging-management-audit.js +32 -1
  64. package/ui/ems/services/forecast-aware-target-planner.js +12 -5
  65. package/ui/ems/services/forecast-target-runtime-bridge.js +12 -5
  66. package/ui/io-package.json +5 -1
  67. package/ui/lib/charging-point-identity.js +91 -16
  68. package/ui/lib/hosted-adapter.js +35 -1
  69. package/ui/main.js +69 -41
  70. package/ui/package.json +1 -1
  71. package/ui/www/app.js +57 -72
  72. package/ui/www/charging-diagnostics-appcenter.js +12 -7
  73. package/ui/www/dashboard-lp-status.js +19 -12
  74. package/ui/www/evcs.js +71 -98
  75. package/ui/www/licenses/smarthome-markdown-components.json +156 -156
  76. package/ui/www/manifest.webmanifest +2 -2
  77. package/adminWww/remoteEntry-eos-9.0.38.js +0 -12
@@ -1,4 +1,4 @@
1
- import{Aa as e,Ao as t,Es as n,Hs as r,Ka as i,Ko as a,Mo as o,Po as s,Tr as c,Ts as l,Us as u,Vs as d,Wa as f,Wo as p,Wr as m,Xn as h,ea as g,gi as _,go as v,jo as y,mo as b,oi as x,r as S,tc as C,yo as w}from"./loadShare-eager-dmdYQhAl.js";import{t as ee}from"./Book-Cq8bkU2t.js";import{C as T,S as te,_ as E,a as ne,b as D,c as re,d as O,f as k,g as A,h as ie,l as ae,m as j,o as oe,p as M,s as se,u as ce,v as N,w as le,x as P,y as F}from"./bootstrap-Df_WTIJg.js";import{a as ue,c as de,d as fe,i as pe,l as me,n as he,o as ge,r as _e,s as ve,t as ye,u as be}from"./zh-cn-B6dBxOyw.js";import{t as I}from"./State-CGnvMceJ.js";function xe(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Se(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function Ce(e,t,n){let r=re((n||{}).ignore||[]),i=we(t),a=-1;for(;++a<i.length;)se(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function we(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([Te(e[0]),Ee(e[1])])}return t}function Te(e){return typeof e==`string`?new RegExp(Se(e),`g`):e}function Ee(e){return typeof e==`function`?e:function(){return e}}var L=`phrasing`,R=[`autolink`,`link`,`image`,`label`];function De(){return{transforms:[Pe],enter:{literalAutolink:ke,literalAutolinkEmail:z,literalAutolinkHttp:z,literalAutolinkWww:z},exit:{literalAutolink:Ne,literalAutolinkEmail:Me,literalAutolinkHttp:Ae,literalAutolinkWww:je}}}function Oe(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:L,notInConstruct:R},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:L,notInConstruct:R},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:L,notInConstruct:R}]}}function ke(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function z(e){this.config.enter.autolinkProtocol.call(this,e)}function Ae(e){this.config.exit.autolinkProtocol.call(this,e)}function je(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function Me(e){this.config.exit.autolinkEmail.call(this,e)}function Ne(e){this.exit(e)}function Pe(e){Ce(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Fe],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Ie]],{ignore:[`link`,`linkReference`]})}function Fe(e,t,n,r,i){let a=``;if(!ze(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!Le(n)))return!1;let o=Re(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function Ie(e,t,n,r){return!ze(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function Le(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Re(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=xe(e,`(`),a=xe(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function ze(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||D(n)||F(n))&&(!t||n!==47)}Ye.peek=Je;function Be(){this.buffer()}function Ve(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function He(){this.buffer()}function Ue(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function We(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=P(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Ge(e){this.exit(e)}function Ke(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=P(this.sliceSerialize(e)).toLowerCase(),n.label=t}function qe(e){this.exit(e)}function Je(){return`[`}function Ye(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function Xe(){return{enter:{gfmFootnoteCallString:Be,gfmFootnoteCall:Ve,gfmFootnoteDefinitionLabelString:He,gfmFootnoteDefinition:Ue},exit:{gfmFootnoteCallString:We,gfmFootnoteCall:Ge,gfmFootnoteDefinitionLabelString:Ke,gfmFootnoteDefinition:qe}}}function Ze(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Ye},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
1
+ import{Aa as e,Ao as t,Es as n,Hs as r,Ka as i,Ko as a,Mo as o,Po as s,Tr as c,Ts as l,Us as u,Vs as d,Wa as f,Wo as p,Wr as m,Xn as h,ea as g,gi as _,go as v,jo as y,mo as b,oi as x,r as S,tc as C,yo as w}from"./loadShare-eager-dmdYQhAl.js";import{t as ee}from"./Book-Cq8bkU2t.js";import{C as T,S as te,_ as E,a as ne,b as D,c as re,d as O,f as k,g as A,h as ie,l as ae,m as j,o as oe,p as M,s as se,u as ce,v as N,w as le,x as P,y as F}from"./bootstrap-Dllnekqb.js";import{a as ue,c as de,d as fe,i as pe,l as me,n as he,o as ge,r as _e,s as ve,t as ye,u as be}from"./zh-cn-B6dBxOyw.js";import{t as I}from"./State-CqF2ARx_.js";function xe(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Se(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function Ce(e,t,n){let r=re((n||{}).ignore||[]),i=we(t),a=-1;for(;++a<i.length;)se(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function we(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([Te(e[0]),Ee(e[1])])}return t}function Te(e){return typeof e==`string`?new RegExp(Se(e),`g`):e}function Ee(e){return typeof e==`function`?e:function(){return e}}var L=`phrasing`,R=[`autolink`,`link`,`image`,`label`];function De(){return{transforms:[Pe],enter:{literalAutolink:ke,literalAutolinkEmail:z,literalAutolinkHttp:z,literalAutolinkWww:z},exit:{literalAutolink:Ne,literalAutolinkEmail:Me,literalAutolinkHttp:Ae,literalAutolinkWww:je}}}function Oe(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:L,notInConstruct:R},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:L,notInConstruct:R},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:L,notInConstruct:R}]}}function ke(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function z(e){this.config.enter.autolinkProtocol.call(this,e)}function Ae(e){this.config.exit.autolinkProtocol.call(this,e)}function je(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function Me(e){this.config.exit.autolinkEmail.call(this,e)}function Ne(e){this.exit(e)}function Pe(e){Ce(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Fe],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Ie]],{ignore:[`link`,`linkReference`]})}function Fe(e,t,n,r,i){let a=``;if(!ze(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!Le(n)))return!1;let o=Re(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function Ie(e,t,n,r){return!ze(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function Le(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Re(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=xe(e,`(`),a=xe(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function ze(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||D(n)||F(n))&&(!t||n!==47)}Ye.peek=Je;function Be(){this.buffer()}function Ve(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function He(){this.buffer()}function Ue(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function We(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=P(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Ge(e){this.exit(e)}function Ke(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=P(this.sliceSerialize(e)).toLowerCase(),n.label=t}function qe(e){this.exit(e)}function Je(){return`[`}function Ye(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function Xe(){return{enter:{gfmFootnoteCallString:Be,gfmFootnoteCall:Ve,gfmFootnoteDefinitionLabelString:He,gfmFootnoteDefinition:Ue},exit:{gfmFootnoteCallString:We,gfmFootnoteCall:Ge,gfmFootnoteDefinitionLabelString:Ke,gfmFootnoteDefinition:qe}}}function Ze(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Ye},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
2
2
  `:` `)+r.indentLines(r.containerFlow(e,a.current()),t?$e:Qe))),s(),o}}function Qe(e,t,n){return t===0?e:$e(e,t,n)}function $e(e,t,n){return(n?``:` `)+e}var et=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];at.peek=ot;function tt(){return{canContainEols:[`delete`],enter:{strikethrough:rt},exit:{strikethrough:it}}}function nt(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:et}],handlers:{delete:at}}}function rt(e){this.enter({type:`delete`,children:[]},e)}function it(e){this.exit(e)}function at(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function ot(){return`~`}function st(e){return e.length}function ct(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||st,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=lt(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=ut(r[d]);else{let e=ut(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding===!1||n.alignDelimiters===!1&&i===``||n.delimiterStart===!1&&!d||r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
3
3
  `)}function lt(e){return e==null?``:String(e)}function ut(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function dt(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),ft);return i(),o}function ft(e,t,n){return`>`+(n?``:` `)+e}function pt(e,t){return mt(e,t.inConstruct,!0)&&!mt(e,t.notInConstruct,!1)}function mt(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function ht(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
4
4
  `&&pt(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
@@ -1,4 +1,4 @@
1
- import{$a as e,$o as t,$r as n,Aa as r,An as i,Ao as a,Bo as o,Ci as s,Co as c,Do as l,Ds as u,Es as d,Ga as f,Ha as p,Hi as m,Hs as h,Is as g,Jo as _,Ka as v,Ko as y,Lr as ee,Ls as te,Mi as ne,Mo as b,Ni as re,Oi as ie,On as ae,Po as x,Qa as oe,Qo as se,Qs as ce,Ro as le,Rr as ue,Rs as de,Si as fe,To as S,Tr as C,Ts as w,Us as T,Vo as E,Vs as D,Wa as pe,Wo as O,Wr as k,Xn as me,Xo as A,Zo as he,_i as ge,ao as _e,br as ve,cs as ye,da as be,ea as xe,eo as Se,es as Ce,fo as we,fs as Te,go as j,hs as Ee,is as De,jo as M,kn as Oe,kr as ke,lo as N,ls as Ae,mo as P,no as je,ns as Me,oc as Ne,os as F,pa as Pe,po as I,ps as Fe,qo as L,qs as Ie,r as R,ro as Le,rs as Re,sa as ze,so as Be,tc as z,tn as Ve,to as B,ua as He,wo as Ue,xo as We,ya as Ge,yo as V,zr as Ke,zs as qe}from"./loadShare-eager-dmdYQhAl.js";import{a as Je,c as Ye,d as Xe,f as Ze,i as Qe,l as $e,n as et,o as tt,p as nt,r as rt,s as it,t as at,u as ot}from"./Star-D8VNXawT.js";import{f as st}from"./WifiTethering-DJ9VO12W.js";import{t as ct}from"./DeleteForever-CioJt3X3.js";import{t as lt}from"./Remove-IN7ZNaCF.js";import{t as ut}from"./ViewList-DVj9ENkU.js";import{n as dt,o as ft,r as pt,t as mt}from"./AdminUtils-Dc1eHsx5.js";import{A as ht,E as gt,F as H,I as _t,O as vt,Q as yt,i as bt,j as xt,n as St,q as Ct,yt as wt}from"./bootstrap-Df_WTIJg.js";import{n as Tt,r as Et,t as Dt}from"./sentry-CPzCHrwe.js";import{i as Ot,n as kt,r as At,t as jt}from"./AdapterUpdateDialog-D4gUYZep.js";import{t as Mt}from"./CustomModal-Do2qVZr7.js";d();var U={smallAvatar:{width:24,height:24},listItem:e=>({mb:`2px`,background:e.palette.background,"@media screen and (max-width: 400px)":{pl:`2px`}}),toVersion:e=>({color:e.palette.mode===`dark`?`#00dc00`:`#008100`,fontWeight:`bold`,ml:`4px`}),updateDone:{background:`#5ef05e80`,opacity:.7},minWidthCss:{"@media screen and (max-width: 400px)":{minWidth:32}},wrapperButton:{},typography:{paddingRight:30},versions:{minWidth:110,display:`inline-block`},closeButton:e=>({position:`absolute`,right:8,top:8,color:e.palette.grey[500]}),languageButton:{position:`absolute`,right:60,top:8},languageButtonActive:e=>({color:e.palette.primary.main}),versionHeader:e=>({background:`#4dabf5`,borderRadius:`3px`,pl:`10px`,fontWeight:`bold`,color:e.palette.mode===`dark`?`black`:`white`}),repoStableVersionText:e=>({color:e.palette.mode===`dark`?`#8dff7a`:`#2b9800`,fontWeight:`bold`,marginLeft:`4px`}),repoLatestVersionText:e=>({color:e.palette.mode===`dark`?`#a3fcff`:`#005498`,fontWeight:`bold`,marginLeft:`4px`})},Nt=class e extends z{constructor(e){super(e),w(this,`updateAvailable`,void 0),w(this,`initialVersions`,void 0),w(this,`currentRef`,void 0),w(this,`current`,void 0),this.updateAvailable=this.detectUpdates(),this.initialVersions={},this.updateAvailable.forEach(e=>this.initialVersions[e]=this.props.installed[e].version),this.state={showNews:null},this.currentRef=Ie.createRef(),this.current=e.current,this.props.onUpdateSelected([...this.updateAvailable],this.updateAvailable)}static isUpdateAvailable(e){let{oldVersion:t,newVersion:n,name:r}=e;try{return R.gt(n,t)}catch{return console.warn(`Cannot compare "${n}" and "${t}" of adapter ${r}`),!1}}detectUpdates(){let t=[];return Object.keys(this.props.repository).forEach(n=>{let r=this.props.installed[n];n!==`js-controller`&&n!==`admin`&&n!==`eos-admin`&&r&&this.props.repository[n].version&&r.ignoreVersion!==this.props.repository[n].version&&e.isUpdateAvailable({oldVersion:r.version,newVersion:this.props.repository[n].version,name:n})&&(kt(this.props.repository[n].messages,r.version,this.props.repository[n].version)?console.log(`Adapter ${n} is filtered out from update all functionality, because it has messages which need to be read before update`):this.props.rightDependenciesFunc(n)?t.push(n):console.log(`Adapter ${n} is filtered out from update all functionality, because its dependencies are not met`))}),t.sort(),t}getNews(e){let t=this.props.repository[e],n=this.props.installed[e],r=[],i=t==null?void 0:t.news;return n&&i&&Object.keys(i).forEach(t=>{try{R.gt(t,n.version)&&r.push({version:t,news:this.props.noTranslation?i[t].en:i[t][this.props.lang]||i[t].en})}catch{console.warn(`Cannot compare "${t}" and "${n.version}" of adapter ${e}`)}}),r}renderOneAdapter(e){var n;let r=this.props.selected.includes(e);if((this.props.finished||this.props.inProcess)&&!r||!this.props.installed[e])return null;let i=this.props.installed[e].localIcon,a=i?`.${i}`:((n=this.props.repository[e])==null?void 0:n.extIcon)||`img/no-image.svg`;return T(t,{dense:!0,sx:{"&.MuiListItem-root":k.getStyle(this.props.theme,U.listItem,this.props.updated.includes(e)&&U.updateDone)},ref:this.props.current===e?this.currentRef:null,secondaryAction:!this.props.finished&&!this.props.inProcess?h(S,{edge:`end`,checked:r,tabIndex:-1,disableRipple:!0,disabled:this.props.inProcess,onClick:()=>{let t=[...this.props.selected],n=t.indexOf(e);n===-1?(t.push(e),t.sort()):t.splice(n,1),this.props.onUpdateSelected(t)}}):this.props.current===e&&!this.props.stopped&&!this.props.finished&&h(l,{}),children:[h(Me,{sx:U.minWidthCss,children:h(Ee,{variant:`square`,alt:e,src:a,style:U.smallAvatar})}),h(Re,{primary:e,title:this.getNews(e).map(e=>`${e.version}: ${e.news}`).join(`
1
+ import{$a as e,$o as t,$r as n,Aa as r,An as i,Ao as a,Bo as o,Ci as s,Co as c,Do as l,Ds as u,Es as d,Ga as f,Ha as p,Hi as m,Hs as h,Is as g,Jo as _,Ka as v,Ko as y,Lr as ee,Ls as te,Mi as ne,Mo as b,Ni as re,Oi as ie,On as ae,Po as x,Qa as oe,Qo as se,Qs as ce,Ro as le,Rr as ue,Rs as de,Si as fe,To as S,Tr as C,Ts as w,Us as T,Vo as E,Vs as D,Wa as pe,Wo as O,Wr as k,Xn as me,Xo as A,Zo as he,_i as ge,ao as _e,br as ve,cs as ye,da as be,ea as xe,eo as Se,es as Ce,fo as we,fs as Te,go as j,hs as Ee,is as De,jo as M,kn as Oe,kr as ke,lo as N,ls as Ae,mo as P,no as je,ns as Me,oc as Ne,os as F,pa as Pe,po as I,ps as Fe,qo as L,qs as Ie,r as R,ro as Le,rs as Re,sa as ze,so as Be,tc as z,tn as Ve,to as B,ua as He,wo as Ue,xo as We,ya as Ge,yo as V,zr as Ke,zs as qe}from"./loadShare-eager-dmdYQhAl.js";import{a as Je,c as Ye,d as Xe,f as Ze,i as Qe,l as $e,n as et,o as tt,p as nt,r as rt,s as it,t as at,u as ot}from"./Star-D8VNXawT.js";import{f as st}from"./WifiTethering-DJ9VO12W.js";import{t as ct}from"./DeleteForever-CioJt3X3.js";import{t as lt}from"./Remove-IN7ZNaCF.js";import{t as ut}from"./ViewList-DVj9ENkU.js";import{n as dt,o as ft,r as pt,t as mt}from"./AdminUtils-Dc1eHsx5.js";import{A as ht,E as gt,F as H,I as _t,O as vt,Q as yt,i as bt,j as xt,n as St,q as Ct,yt as wt}from"./bootstrap-Dllnekqb.js";import{n as Tt,r as Et,t as Dt}from"./sentry-CPzCHrwe.js";import{i as Ot,n as kt,r as At,t as jt}from"./AdapterUpdateDialog-DDmYbnK4.js";import{t as Mt}from"./CustomModal-Do2qVZr7.js";d();var U={smallAvatar:{width:24,height:24},listItem:e=>({mb:`2px`,background:e.palette.background,"@media screen and (max-width: 400px)":{pl:`2px`}}),toVersion:e=>({color:e.palette.mode===`dark`?`#00dc00`:`#008100`,fontWeight:`bold`,ml:`4px`}),updateDone:{background:`#5ef05e80`,opacity:.7},minWidthCss:{"@media screen and (max-width: 400px)":{minWidth:32}},wrapperButton:{},typography:{paddingRight:30},versions:{minWidth:110,display:`inline-block`},closeButton:e=>({position:`absolute`,right:8,top:8,color:e.palette.grey[500]}),languageButton:{position:`absolute`,right:60,top:8},languageButtonActive:e=>({color:e.palette.primary.main}),versionHeader:e=>({background:`#4dabf5`,borderRadius:`3px`,pl:`10px`,fontWeight:`bold`,color:e.palette.mode===`dark`?`black`:`white`}),repoStableVersionText:e=>({color:e.palette.mode===`dark`?`#8dff7a`:`#2b9800`,fontWeight:`bold`,marginLeft:`4px`}),repoLatestVersionText:e=>({color:e.palette.mode===`dark`?`#a3fcff`:`#005498`,fontWeight:`bold`,marginLeft:`4px`})},Nt=class e extends z{constructor(e){super(e),w(this,`updateAvailable`,void 0),w(this,`initialVersions`,void 0),w(this,`currentRef`,void 0),w(this,`current`,void 0),this.updateAvailable=this.detectUpdates(),this.initialVersions={},this.updateAvailable.forEach(e=>this.initialVersions[e]=this.props.installed[e].version),this.state={showNews:null},this.currentRef=Ie.createRef(),this.current=e.current,this.props.onUpdateSelected([...this.updateAvailable],this.updateAvailable)}static isUpdateAvailable(e){let{oldVersion:t,newVersion:n,name:r}=e;try{return R.gt(n,t)}catch{return console.warn(`Cannot compare "${n}" and "${t}" of adapter ${r}`),!1}}detectUpdates(){let t=[];return Object.keys(this.props.repository).forEach(n=>{let r=this.props.installed[n];n!==`js-controller`&&n!==`admin`&&n!==`eos-admin`&&r&&this.props.repository[n].version&&r.ignoreVersion!==this.props.repository[n].version&&e.isUpdateAvailable({oldVersion:r.version,newVersion:this.props.repository[n].version,name:n})&&(kt(this.props.repository[n].messages,r.version,this.props.repository[n].version)?console.log(`Adapter ${n} is filtered out from update all functionality, because it has messages which need to be read before update`):this.props.rightDependenciesFunc(n)?t.push(n):console.log(`Adapter ${n} is filtered out from update all functionality, because its dependencies are not met`))}),t.sort(),t}getNews(e){let t=this.props.repository[e],n=this.props.installed[e],r=[],i=t==null?void 0:t.news;return n&&i&&Object.keys(i).forEach(t=>{try{R.gt(t,n.version)&&r.push({version:t,news:this.props.noTranslation?i[t].en:i[t][this.props.lang]||i[t].en})}catch{console.warn(`Cannot compare "${t}" and "${n.version}" of adapter ${e}`)}}),r}renderOneAdapter(e){var n;let r=this.props.selected.includes(e);if((this.props.finished||this.props.inProcess)&&!r||!this.props.installed[e])return null;let i=this.props.installed[e].localIcon,a=i?`.${i}`:((n=this.props.repository[e])==null?void 0:n.extIcon)||`img/no-image.svg`;return T(t,{dense:!0,sx:{"&.MuiListItem-root":k.getStyle(this.props.theme,U.listItem,this.props.updated.includes(e)&&U.updateDone)},ref:this.props.current===e?this.currentRef:null,secondaryAction:!this.props.finished&&!this.props.inProcess?h(S,{edge:`end`,checked:r,tabIndex:-1,disableRipple:!0,disabled:this.props.inProcess,onClick:()=>{let t=[...this.props.selected],n=t.indexOf(e);n===-1?(t.push(e),t.sort()):t.splice(n,1),this.props.onUpdateSelected(t)}}):this.props.current===e&&!this.props.stopped&&!this.props.finished&&h(l,{}),children:[h(Me,{sx:U.minWidthCss,children:h(Ee,{variant:`square`,alt:e,src:a,style:U.smallAvatar})}),h(Re,{primary:e,title:this.getNews(e).map(e=>`${e.version}: ${e.news}`).join(`
2
2
  `),secondary:T(`span`,{children:[T(`div`,{style:U.versions,children:[this.initialVersions[e],` →`,h(j,{component:`span`,sx:U.toVersion,children:this.props.repository[e].version})]}),h(y,{title:C.t(`Show change log`),onClick:()=>this.setState({showNews:{adapter:e,version:this.props.repository[e].version,fromVersion:this.initialVersions[e]}}),size:`small`,children:h(xe,{})})]})})]},e)}getReactNews(e,t){let n=this.props.repository[e],r=this.props.installed[e];t||=r.version;let i=[],a,o,s=this.props.repository._repoInfo;if(s!=null&&s.stable){var c,l;a=(c=this.props.repository[e])==null?void 0:c.version,o=(l=this.props.repository[e])==null?void 0:l.latestVersion}else{var u,d;a=(u=this.props.repository[e])==null?void 0:u.stable,o=(d=this.props.repository[e])==null?void 0:d.version}let f=n==null?void 0:n.news;return r&&f&&Object.keys(f).forEach(n=>{try{if(R.gt(n,t)&&f[n]){let e=(this.props.noTranslation?f[n].en||``:f[n][this.props.lang]||f[n].en||``).split(`
3
3
  `).map(e=>Ot(e.trim()).replace(/<!--[^>]*->/g,``).replace(/<! -[^>]*->/g,``).trim()).filter(e=>!!e);i.push(T(O,{children:[T(P,{sx:U.versionHeader,children:[n,o===n?h(j,{component:`span`,sx:U.repoLatestVersionText,children:`(latest)`}):null,a===n?h(j,{component:`span`,sx:U.repoStableVersionText,children:`(${C.t(`stable`)})`}):null]}),e.map((e,t)=>h(At,{text:e},`${n}-${t}`))]},n))}}catch{console.warn(`Cannot compare "${n}" and "${t}" of adapter ${e}`)}}),i}renderShowNews(){if(this.state.showNews){let e=this.getReactNews(this.state.showNews.adapter,this.state.showNews.fromVersion),t=k.getStyle(this.props.theme,U.closeButton),n=k.getStyle(this.props.theme,U.languageButtonActive);return T(a,{onClose:()=>this.setState({showNews:null}),open:!0,children:[h(x,{children:T(P,{component:`h2`,variant:`h6`,sx:{"&.MuiTypography-root":U.typography},children:[h(`div`,{style:{width:`calc(100% - 60px)`},children:C.t(`Update "%s" to v%s`,this.state.showNews.adapter,this.state.showNews.version)}),h(y,{size:`large`,style:t,onClick:()=>this.setState({showNews:null}),children:h(v,{})}),C.getLanguage()!==`en`&&this.props.toggleTranslation?h(y,{size:`large`,style:{...U.languageButton,...this.props.noTranslation?n:void 0},onClick:this.props.toggleTranslation,title:C.t(`Disable/Enable translation`),children:h(r,{})}):null]})}),h(b,{dividers:!0,children:h(O,{container:!0,spacing:2,wrap:`nowrap`,sx:{flexDirection:`column`},children:e.length?T(O,{children:[h(P,{variant:`h6`,gutterBottom:!0,children:C.t(`Change log`)}),h(O,{container:!0,spacing:2,wrap:`nowrap`,sx:{flexDirection:`column`},children:e})]}):C.t(`No change log available`)})}),h(M,{style:U.wrapperButton,children:h(V,{variant:`contained`,onClick:()=>this.setState({showNews:null}),color:`grey`,startIcon:h(v,{}),children:C.t(`Close`)})})]})}return null}render(){return this.current!==this.props.current&&(this.current=this.props.current,setTimeout(()=>{var e;return(e=this.currentRef.current)==null?void 0:e.scrollIntoView()},200)),T(se,{style:U.root,children:[this.updateAvailable.map(e=>this.renderOneAdapter(e)),this.renderShowNews()]})}};d();var W={dialogRoot:{height:`calc(100% - 64px)`},wrapperHead:{justifyContent:`space-between`,display:`flex`},checkbox:{marginRight:10},appBar:e=>({flexWrap:`wrap`,position:`sticky`,bottom:-10,pl:1,pr:1,borderRadius:`${e.shape.borderRadius}px`,background:e.palette.background.paper}),container:{overflow:`hidden`,flex:`1 1 auto`,minHeight:0,flexWrap:`nowrap`,"@media screen and (max-width: 602px)":{flex:`none`,flexWrap:`wrap`}},content:{display:`flex`,flexDirection:`column`,"& > .MuiToolbar-root":{flexShrink:0},"@media screen and (max-width: 500px)":{p:1}},languageButton:{position:`absolute`,right:73,top:11},languageButtonActive:e=>({color:e.palette.primary.main})},Pt=class extends z{constructor(e){super(e),w(this,`updateAvailable`,[]),w(this,`onAdapterFinished`,null),w(this,`processList`,[]),this.state={selected:[],inProcess:!1,finished:!1,current:``,updated:[],stopped:!1,debug:(window._localStorage||window.localStorage).getItem(`AdaptersUpdaterDialog.debug`)===`true`,stopOnError:(window._localStorage||window.localStorage).getItem(`AdaptersUpdaterDialog.stopOnError`)!==`false`,closeOnFinished:(window._localStorage||window.localStorage).getItem(`AdaptersUpdaterDialog.closeOnFinished`)===`true`,currentVersion:``},this.updateAvailable=[]}updateAdapter(e,t,n){this.onAdapterFinished=n,this.setState({current:e,currentVersion:t})}onStartUpdate(){this.props.ready?this.setState({inProcess:!0},()=>{this.props.onSetCommandRunning(!0),this.processList=[...this.state.selected].sort((e,t)=>e===`eos-admin`?1:t===`eos-admin`?-1:e.localeCompare(t)).map(e=>{var t;return{adapter:e,version:(t=this.props.repository[e])==null?void 0:t.version}}),this.updateAdapters(()=>{this.setState({inProcess:!1,finished:!0},()=>{this.props.onSetCommandRunning(!1),this.state.closeOnFinished&&this.props.onClose(!!this.state.updated.length)})})}):window.alert(this.props.t(`The connection is not ready yet. Please wait a moment and try again.`))}updateAdapters(e){if(!this.processList||!this.processList.length||this.state.stopped)e&&e();else{let{adapter:t,version:n}=this.processList.shift();this.updateAdapter(t,n,()=>{let n=[...this.state.updated];n.push(t),this.setState({updated:n},()=>setTimeout(()=>this.updateAdapters(e),200))})}}render(){let e=this.props.noTranslation?k.getStyle(this.props.theme,W.languageButtonActive):void 0;return T(a,{open:!0,maxWidth:`lg`,fullWidth:!!this.state.current,onClose:()=>this.props.onClose(!!this.state.updated.length),"aria-labelledby":`update-dialog-title`,"aria-describedby":`update-dialog-description`,sx:{"& .MuiPaper-root":W.dialogRoot},scroll:`paper`,children:[h(x,{id:`update-dialog-title`,children:T(`div`,{style:W.wrapperHead,children:[this.props.t(`Update %s adapter(s)`,this.state.selected.length),!this.state.finished&&!this.state.inProcess&&h(I,{title:this.props.t(`Select/Unselect all`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:h(S,{checked:this.state.selected.length===this.updateAvailable.length,style:W.checkbox,tabIndex:-1,indeterminate:this.state.selected.length!==this.updateAvailable.length&&this.state.selected.length!==0,disableRipple:!0,onClick:()=>{let e=[];this.state.selected.length!==this.updateAvailable.length&&(e=[...this.updateAvailable]),this.setState({selected:e})}})}),C.getLanguage()!==`en`&&this.props.toggleTranslation?h(y,{size:`large`,style:{...W.languageButton,...e},onClick:()=>{var e,t;return(e=(t=this.props).toggleTranslation)==null?void 0:e.call(t)},title:C.t(`Disable/Enable translation`),children:h(r,{})}):null]})}),T(b,{sx:{"&.MuiDialogContent-root":W.content},children:[T(O,{container:!0,direction:`row`,sx:W.container,children:[h(O,{style:{height:`100%`,overflow:`hidden`,width:this.state.current?250:`100%`},children:h(`div`,{style:{height:`100%`,overflow:`auto`},children:h(Nt,{finished:this.state.finished,inProcess:this.state.inProcess,selected:this.state.selected,current:this.state.current,stopped:this.state.stopped,updated:this.state.updated,lang:this.props.lang,installed:this.props.installed,repository:this.props.repository,noTranslation:!!this.props.noTranslation,toggleTranslation:this.props.toggleTranslation||(()=>{}),onUpdateSelected:(e,t)=>{t&&(this.updateAvailable=t),this.setState({selected:e})},theme:this.props.theme,rightDependenciesFunc:this.props.rightDependenciesFunc})})}),!!this.state.current&&h(O,{style:{height:`100%`,overflow:`hidden`,width:`calc(100% - 260px)`,minWidth:240},children:h(_t,{noSpacing:!0,ready:this.props.ready,host:this.props.currentHost,socket:this.props.socket,t:this.props.t,cmd:`upgrade ${this.state.current}@${this.state.currentVersion}${this.state.debug?` --debug`:``}`,onFinished:()=>{var e;return(e=this.onAdapterFinished)==null?void 0:e.call(this)},errorFunc:()=>{if(this.state.stopOnError)this.setState({stopped:!0,finished:!0}),this.onAdapterFinished=null,this.props.onSetCommandRunning(!1);else{var e;(e=this.onAdapterFinished)==null||e.call(this)}}},this.state.current)})]}),T(we,{variant:`dense`,disableGutters:!0,sx:W.appBar,children:[h(E,{control:h(S,{disabled:this.state.finished,checked:this.state.stopOnError,onChange:()=>{(window._localStorage||window.localStorage).setItem(`AdaptersUpdaterDialog.stopOnError`,this.state.stopOnError?`false`:`true`),this.setState({stopOnError:!this.state.stopOnError})}}),label:this.props.t(`Stop on error`)}),h(E,{control:h(S,{disabled:this.state.finished,checked:this.state.closeOnFinished,onChange:()=>{(window._localStorage||window.localStorage).setItem(`AdaptersUpdaterDialog.closeOnFinished`,this.state.closeOnFinished?`false`:`true`),this.setState({closeOnFinished:!this.state.closeOnFinished})}}),label:this.props.t(`Close on finished`)}),h(E,{control:h(S,{disabled:this.state.finished||this.state.inProcess,checked:this.state.debug,onChange:()=>{(window._localStorage||window.localStorage).setItem(`AdaptersUpdaterDialog.debug`,this.state.debug?`false`:`true`),this.setState({debug:!this.state.debug})}}),label:this.props.t(`Debug info`)})]})]}),T(M,{children:[h(V,{id:`adapters-update-dialog-update`,variant:`contained`,disabled:this.state.stopped||this.state.inProcess||this.state.finished||!this.state.selected.length||!this.props.ready,onClick:()=>this.onStartUpdate(),color:`primary`,autoFocus:!0,startIcon:h(pe,{}),children:this.props.t(`Update`)}),h(V,{id:`adapters-update-dialog-cancel`,variant:`contained`,disabled:!this.state.inProcess,color:`grey`,startIcon:h(n,{}),onClick:()=>{this.setState({stopped:!0,finished:!0}),this.props.onSetCommandRunning(!1)},children:this.props.t(`Cancel`)}),h(V,{id:`adapters-update-dialog-close`,variant:`contained`,onClick:()=>this.props.onClose(!!this.state.updated.length),disabled:this.state.inProcess&&!this.state.stopped,color:this.state.stopped?`error`:`grey`,startIcon:h(v,{}),children:this.props.t(`Close`)})]})]})}},Ft=u(T(D,{children:[h(`path`,{d:`M21 10.12h-6.78l2.74-2.82c-2.73-2.7-7.15-2.8-9.88-.1-2.73 2.71-2.73 7.08 0 9.79s7.15 2.71 9.88 0C18.32 15.65 19 14.08 19 12.1h2c0 1.98-.88 4.55-2.64 6.29-3.51 3.48-9.21 3.48-12.72 0-3.5-3.47-3.53-9.11-.02-12.58s9.14-3.47 12.65 0L21 3z`}),h(`path`,{d:`M8.6 8.7h2.9v2.9H8.6zM12.5 8.7h2.9v2.9h-2.9zM8.6 12.6h2.9v2.9H8.6zM12.5 12.6h2.9v2.9h-2.9z`})]}),`UpdateAll`);d();var It=class extends gt{constructor(e,t){super(e,`${t}.adapter`,`adapter`),w(this,`host`,void 0),w(this,`prefix`,void 0),this.prefix=`${t}.adapter.`,this.host=t}getObject(e){return this.objects&&this.objects[this.prefix+e]||null}getHost(){return this.host}};function Lt(e){var t;return(e==null||(t=e.licenseInformation)==null?void 0:t.link)||Rt(e)}function Rt(e){if(!e)return``;let t=e.licenseUrl;if(!t||!t.includes(`/LICENSE`)||!t.includes(`raw.githubusercontent.com`)){if(t=e.extIcon,!t){if(t=e.readme,!t)return console.error(`No extIcon for ${e.name||JSON.stringify(e)}`),``;t=t.replace(`github.com`,`raw.githubusercontent.com`).replace(`/blob/`,`/`),t.includes(`/main`)?t=`${t.split(`/main`)[0]}/main/LICENSE`:t.includes(`/master`)&&(t=`${t.split(`/master`)[0]}/master/LICENSE`)}if(t.includes(`/main`))t=`${t.split(`/main`)[0]}/main/LICENSE`;else if(t.includes(`/master`))t=`${t.split(`/master`)[0]}/master/LICENSE`;else return``}return t}function zt(e){if(!e)return null;let t=e.trim().split(`?`)[0].split(`#`)[0],n=t.match(/iobroker\.([a-z\d][a-z\d_-]*?)-\d+\.\d+\.\d+[^/\\]*\.tgz$/i);if(n)return n[1].toLowerCase();let r=t.match(/iobroker\.([a-z\d][a-z\d_-]*)/i);return r?r[1].toLowerCase():/^[a-z\d][a-z\d_-]*$/i.test(t)?t.toLowerCase():null}var Bt=`data:image/svg+xml,%3csvg%20viewBox='0%200%202500%202500'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%200h2500v2500H0z'%20fill='%23c00'/%3e%3cpath%20d='M1241.5%20268.5h-973v1962.9h972.9V763.5h495v1467.9h495V268.5z'%20fill='%23fff'/%3e%3c/svg%3e`;function Vt(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let e=r.result,n=e.indexOf(`,`);t(n===-1?e:e.substring(n+1))},r.onerror=()=>n(r.error||Error(`Cannot read file`)),r.readAsDataURL(e)})}function Ht(e){return{id:`github-install-dialog-tab-${e}`,"aria-controls":`github-install-dialog-panel-${e}`}}var G={root:e=>({backgroundColor:e.palette.background.paper,width:`100%`,height:`100%`}),paper:{maxWidth:1e3},tabPaper:{padding:16},title:e=>({mt:`10px`,p:1,ml:1,fontSize:18,color:e.palette.primary.main}),warningText:{color:`#f53939`},noteText:{marginTop:16},errorTextNoGit:{fontSize:13,color:`#ff1616`},listIcon:{width:24,height:24},listIconWithMargin:{width:24,height:24,marginRight:8},tabSelected:e=>({color:e.palette.mode===`dark`?e.palette.secondary.contrastText:`#222 !important`})};function Ut(e){let t=[];for(let n=0;n<e.length;n++)typeof e[n]==`object`?e[n].forEach(e=>t.push(e)):t.push(e[n]);return t}var Wt=10,Gt=class extends Ie.Component{constructor(e){super(e);let t=[],n=(window._localstorage||window.localStorage).getItem(`App.npmHistory`);if(n)try{t=JSON.parse(n)}catch{}this.state={autoCompleteValue:(window._localstorage||window.localStorage).getItem(`App.autocomplete`)||null,debug:(window._localstorage||window.localStorage).getItem(`App.gitDebug`)===`true`,createInstance:(window._localstorage||window.localStorage).getItem(`App.createInstanceAfterInstall`)!==`false`,url:(window._localstorage||window.localStorage).getItem(`App.userUrl`)||``,currentTab:(window._localstorage||window.localStorage).getItem(`App.gitTab`)||`npm`,customHistory:t,selectedFile:null,restartAfterInstall:(window._localstorage||window.localStorage).getItem(`App.restartAfterInstall`)!==`false`,uploading:!1,selectedHost:e.currentHost,cmdExecFilesSupported:!1}}async componentDidMount(){try{let e=await this.props.socket.checkFeatureSupported(`CONTROLLER_CMD_EXEC_FILES`);this.setState({cmdExecFilesSupported:!!e})}catch(e){console.error(`Cannot read feature: ${e}`)}}async uploadFileToServer(){if(!this.state.selectedFile)return null;this.setState({uploading:!0});try{let e=new FormData;e.append(`file`,this.state.selectedFile);let t=await fetch(`./upload-adapter`,{method:`POST`,body:e});if(!t.ok){let e;try{e=(await t.json()).error||`Upload failed with status ${t.status}`}catch{e=`Upload failed with status ${t.status}`}throw Error(e)}return(await t.json()).filePath}catch(e){return window.alert(`${C.t(`Upload failed`)}: ${e.message}`),null}finally{this.setState({uploading:!1})}}async restartInstances(e){if(!this.state.restartAfterInstall||!e)return;let t=await this.props.socket.getAdapterInstances(e);for(let e of t){var n;e!=null&&(n=e.common)!=null&&n.enabled&&await this.props.socket.extendObject(e._id,{})}}async createInstanceIfDesired(e,t){if(this.state.createInstance&&e)try{await this.props.createInstance(e,t)}catch(t){console.error(`Cannot create the instance of ${e}: ${t.message}`)}}async installFile(){if(!this.state.selectedFile)return;let e=zt(this.state.selectedFile.name)||``;if(this.state.cmdExecFilesSupported){try{let t=await Vt(this.state.selectedFile),n=this.state.selectedFile.name.replace(/[^a-zA-Z0-9._-]/g,`_`),r=await this.props.installFromUrl(n,this.state.debug,!0,{host:this.state.selectedHost,files:[{name:n,file:t}]});await this.restartInstances(e),r&&await this.createInstanceIfDesired(e,this.state.selectedHost)}catch(e){console.error(`Installation from file failed: ${e.message}`)}return}let t=await this.uploadFileToServer();if(t)try{let n=await this.props.installFromUrl(t,this.state.debug,!0);await this.restartInstances(e),n&&await this.createInstanceIfDesired(e)}catch(e){console.error(`Installation from file failed: ${e.message}`)}}async handleInstall(){if(this.state.currentTab===`GitHub`){var e;let t=(((e=this.state.autoCompleteValue)==null?void 0:e.value)||``).split(`/`),n=`${t[1]}/ioBroker.${t[0]}`;await this.props.installFromUrl(n,this.state.debug,!0)&&await this.createInstanceIfDesired(t[0])}else if(this.state.currentTab===`URL`){let e=this.state.customHistory.filter(e=>e!==this.state.url);e.unshift(this.state.url),e.length>Wt&&e.pop(),(window._localstorage||window.localStorage).setItem(`App.npmHistory`,JSON.stringify(e));let t=this.state.url.includes(`.`)?this.state.url:`iobroker.${this.state.url}`;await this.props.installFromUrl(t,this.state.debug,!0)&&await this.createInstanceIfDesired(zt(t))}else if(this.state.currentTab===`File`)await this.installFile();else if(this.state.currentTab===`npm`){var t;let e=(((t=this.state.autoCompleteValue)==null?void 0:t.value)||``).split(`/`)[0],n=e.includes(`.`)?e.split(`.`)[1]:e;try{let e=await this.props.installFromUrl(`iobroker.${n}@latest`,this.state.debug,!0);await this.props.upload(n),e&&await this.createInstanceIfDesired(n)}catch(e){console.error(`Installation from url failed: ${e.message}`)}}}renderCreateInstance(){return h(`div`,{style:{display:`flex`,alignItems:`center`},children:h(E,{control:h(S,{checked:this.state.createInstance,onChange:e=>{(window._localstorage||window.localStorage).setItem(`App.createInstanceAfterInstall`,e.target.checked?`true`:`false`),this.setState({createInstance:e.target.checked})}}),label:this.props.t(`Create instance if it does not exist yet`)})})}renderNpm(){return this.state.currentTab===`npm`?T(Ae,{style:G.tabPaper,id:`github-install-dialog-panel-npm`,children:[h(`div`,{style:{display:`flex`,alignItems:`center`},children:h(E,{control:h(S,{checked:this.state.debug,onChange:e=>{(window._localstorage||window.localStorage).setItem(`App.gitDebug`,e.target.checked?`true`:`false`),this.setState({debug:e.target.checked})}}),label:this.props.t(`Debug outputs`)})}),this.renderCreateInstance(),T(`div`,{style:{display:`flex`,alignItems:`flex-end`},children:[h(rt,{style:{marginRight:10}}),h(ye,{fullWidth:!0,value:this.state.autoCompleteValue,onChange:(e,t)=>{(window._localstorage||window.localStorage).setItem(`App.autocomplete`,t||void 0),this.setState({autoCompleteValue:t||null})},options:this.getList(),getOptionLabel:e=>(e==null?void 0:e.name)??``,renderInput:e=>{var t;return h(N,{variant:`standard`,...e,slotProps:{...e.slotProps,input:{...e.slotProps.input,startAdornment:h(L,{position:`start`,children:h(ve,{src:((t=this.state.autoCompleteValue)==null?void 0:t.icon)||``,style:G.listIcon})})}},label:C.t(`Select adapter`)})},renderOption:(e,t)=>T(j,{component:`li`,sx:{"& > img":{mr:2,flexShrink:0}},...e,children:[h(ve,{src:(t==null?void 0:t.icon)||``,style:G.listIconWithMargin}),(t==null?void 0:t.name)??``]})})]}),h(`div`,{style:{fontSize:24,fontWeight:`bold`,marginTop:40},children:this.props.t(`Warning!`)}),h(`div`,{style:G.warningText,children:this.props.t(`npm_warning`,`NPM`,`NPM`)}),h(`div`,{style:G.noteText,children:this.props.t(`github_note`)})]}):null}renderGitHub(){return this.state.currentTab===`GitHub`?T(Ae,{style:G.tabPaper,id:`github-install-dialog-panel-github`,children:[h(`div`,{style:{display:`flex`,alignItems:`center`},children:h(E,{control:h(S,{checked:this.state.debug,onChange:e=>{(window._localstorage||window.localStorage).setItem(`App.gitDebug`,e.target.checked?`true`:`false`),this.setState({debug:e.target.checked})}}),label:this.props.t(`Debug outputs`)})}),this.renderCreateInstance(),T(`div`,{style:{display:`flex`,alignItems:`flex-end`},children:[h(rt,{style:{marginRight:10}}),h(ye,{fullWidth:!0,value:this.state.autoCompleteValue,getOptionDisabled:e=>!!(e!=null&&e.nogit),renderOption:(e,t)=>T(j,{component:`li`,sx:{"& > img":{mr:2,flexShrink:0}},...e,children:[h(ve,{src:(t==null?void 0:t.icon)||``,style:G.listIconWithMargin}),(t==null?void 0:t.name)??``,(t==null?void 0:t.nogit)&&h(`div`,{style:G.errorTextNoGit,children:C.t(`This adapter cannot be installed from git as must be built before installation.`)})]}),onChange:(e,t)=>{(window._localstorage||window.localStorage).setItem(`App.autocomplete`,t),this.setState({autoCompleteValue:t})},options:this.getList(),getOptionLabel:e=>(e==null?void 0:e.name)??``,renderInput:e=>{var t;return h(N,{variant:`standard`,...e,slotProps:{...e.slotProps,input:{...e.slotProps.input,startAdornment:h(L,{position:`start`,children:h(ve,{src:((t=this.state.autoCompleteValue)==null?void 0:t.icon)||``,style:G.listIconWithMargin})})}},label:C.t(`Select adapter`)})}})]}),h(`div`,{style:{fontSize:24,fontWeight:`bold`,marginTop:40},children:this.props.t(`Warning!`)}),h(`div`,{style:G.warningText,children:this.props.t(`github_warning`,`GitHub`,`GitHub`)}),h(`div`,{style:G.noteText,children:this.props.t(`github_note`)})]}):null}renderCustom(){return this.state.currentTab===`URL`?T(Ae,{style:G.tabPaper,id:`github-install-dialog-panel-custom`,children:[h(`div`,{style:{display:`flex`,alignItems:`center`},children:h(E,{control:h(S,{checked:this.state.debug,onChange:e=>{(window._localstorage||window.localStorage).setItem(`App.gitDebug`,e.target.checked?`true`:`false`),this.setState({debug:e.target.checked})}}),label:this.props.t(`Debug outputs`)})}),this.renderCreateInstance(),h(`div`,{style:{display:`flex`,alignItems:`center`},children:h(ye,{fullWidth:!0,value:this.state.url||``,onInputChange:(e,t)=>{(window._localstorage||window.localStorage).setItem(`App.userUrl`,t||``),this.setState({url:t||``})},onChange:(e,t)=>{(window._localstorage||window.localStorage).setItem(`App.userUrl`,t||``),this.setState({url:t||``})},renderOption:(e,t)=>T(j,{component:`li`,...e,style:{display:`flex`,alignItems:`left`},children:[t,h(`div`,{style:{flexGrow:1}}),h(y,{size:`small`,onClick:e=>{e.stopPropagation();let n=this.state.customHistory.filter(e=>e!==t);(window._localstorage||window.localStorage).setItem(`App.npmHistory`,JSON.stringify(n)),this.setState({customHistory:n})},children:h(p,{})})]}),freeSolo:!0,options:this.state.customHistory,renderInput:e=>h(N,{variant:`standard`,...e,onKeyUp:e=>{e.key===`Enter`&&this.state.url&&this.handleInstall().then(()=>{this.setState({autoCompleteValue:null,url:``}),this.props.onClose()})},helperText:this.props.t(`URL or file path`),label:this.props.t(`URL`)})})}),h(`div`,{style:{fontSize:24,fontWeight:`bold`,marginTop:40},children:this.props.t(`Warning!`)}),h(`div`,{style:G.warningText,children:this.props.t(`github_warning`,`URL`,`URL`)}),h(`div`,{style:G.noteText,children:this.props.t(`github_note`)})]}):null}renderFile(){return this.state.currentTab===`File`?T(Ae,{style:G.tabPaper,id:`github-install-dialog-panel-file`,children:[T(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[T(V,{variant:`outlined`,component:`label`,startIcon:h(be,{}),disabled:this.state.uploading,children:[this.props.t(`Select file`),h(`input`,{type:`file`,accept:`.tgz`,hidden:!0,onChange:e=>{var t;let n=((t=e.target.files)==null?void 0:t[0])||null;this.setState({selectedFile:n,url:``}),(window._localstorage||window.localStorage).setItem(`App.userUrl`,``),e.target.value=``}})]}),this.state.selectedFile&&T(D,{children:[h(P,{variant:`body2`,style:{flex:1},children:this.state.selectedFile.name}),h(y,{size:`small`,onClick:()=>this.setState({selectedFile:null}),children:h(v,{})})]}),this.state.uploading&&h(l,{size:24})]}),this.state.selectedFile&&h(E,{control:h(S,{checked:this.state.restartAfterInstall,onChange:e=>{(window._localstorage||window.localStorage).setItem(`App.restartAfterInstall`,e.target.checked?`true`:`false`),this.setState({restartAfterInstall:e.target.checked})}}),label:this.props.t(`Restart adapter after install`)}),this.renderCreateInstance(),this.state.cmdExecFilesSupported&&T(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:8},children:[T(P,{variant:`body2`,children:[this.props.t(`Install on host`),`:`]}),h(vt,{socket:this.props.socket,currentHost:this.state.selectedHost,hostsWorker:this.props.hostsWorker,expertMode:this.props.expertMode,themeType:this.props.themeType,tooltip:this.props.t(`Install on host`),setCurrentHost:(e,t)=>this.setState({selectedHost:t})})]}),h(`div`,{style:{fontSize:24,fontWeight:`bold`,marginTop:40},children:this.props.t(`Warning!`)}),h(`div`,{style:G.warningText,children:this.props.t(`github_warning`,`File`,`File`)}),h(`div`,{style:G.noteText,children:this.props.t(`github_note`)})]}):null}getList(){let e=Ut(this.props.categories.map(e=>e.adapters));return e.sort(),e.map((t,n)=>{if(n&&e[n-1]===t)return null;let r=this.props.repository[t];if(!(r!=null&&r.controller)){let e=(r.extIcon||r.meta||r.readme||``).toString().split(`/`),n=r==null?void 0:r.name;n||=(n=r.titleLang,n&&typeof n==`object`?n[C.getLanguage()]||n.en:r.title||t);let i={value:`${t}/${e[3]}`,name:`${n} [${e[3]}]`,icon:r.extIcon||r.icon||``,nogit:!!r.nogit,title:t};return this.props.installed[n]&&n!==`admin`&&(i.icon=ft(`adapter/${t}/${(r.icon||``).split(`/admin/`).pop()}`)),i}return null}).filter(e=>e).sort((e,t)=>e.name<t.name?-1:+(e.name>t.name))}render(){var e;let t=()=>this.setState({autoCompleteValue:null,url:``,selectedFile:null,uploading:!1});return T(a,{onClose:()=>this.props.onClose(),open:!0,sx:{"& .MuiDialog-paper":G.paper},children:[h(b,{dividers:!0,children:T(j,{component:`div`,sx:G.root,children:[h(De,{position:`static`,color:`default`,children:T(Be,{value:this.state.currentTab,onChange:(e,t)=>{(window._localstorage||window.localStorage).setItem(`App.gitTab`,t),this.setState({currentTab:t})},variant:`fullWidth`,indicatorColor:`secondary`,children:[h(oe,{label:this.props.t(`From npm`),wrapped:!0,sx:{"&.Mui-selected":G.tabSelected},icon:h(`img`,{src:Bt,alt:`npm`,width:24,height:24}),...Ht(`npm`),value:`npm`}),h(oe,{label:this.props.t(`From github`),wrapped:!0,sx:{"&.Mui-selected":G.tabSelected},icon:h(m,{style:{width:24,height:24},width:24,height:24}),...Ht(`github`),value:`GitHub`}),h(oe,{label:this.props.t(`Custom`),wrapped:!0,sx:{"&.Mui-selected":G.tabSelected},icon:h(r,{width:24,height:24}),...Ht(`custom`),value:`URL`}),h(oe,{label:this.props.t(`From file`),wrapped:!0,sx:{"&.Mui-selected":G.tabSelected},icon:h(ge,{style:{width:24,height:24}}),...Ht(`file`),value:`File`})]})}),h(j,{component:`div`,sx:G.title,children:this.props.t(`Install or update the adapter from %s`,this.state.currentTab||`npm`)}),this.renderNpm(),this.renderGitHub(),this.renderCustom(),this.renderFile()]})}),T(M,{children:[h(V,{id:`github-install-dialog-ok`,variant:`contained`,disabled:this.state.uploading||this.props.commandRunning||(this.state.currentTab===`GitHub`||this.state.currentTab===`npm`)&&!((e=this.state.autoCompleteValue)!=null&&e.value)||this.state.currentTab===`URL`&&!this.state.url||this.state.currentTab===`File`&&!this.state.selectedFile,autoFocus:!0,onClick:async()=>{await this.handleInstall(),this.props.onClose(),t()},color:`primary`,startIcon:this.props.commandRunning?h(l,{size:20}):h(pe,{}),children:this.props.t(`Install`)}),h(V,{id:`github-install-dialog-close`,variant:`contained`,onClick:()=>{this.props.onClose(),t()},color:`grey`,startIcon:h(v,{}),children:this.props.t(`Close`)})]})]})}};d();var K={formControl:{marginTop:24,width:100},closeButton:e=>({position:`absolute`,right:8,top:8,color:e.palette.grey[500]}),languageButton:{position:`absolute`,right:60,top:8},languageButtonActive:e=>({color:e.palette.primary.main}),paper:{},typography:{pr:`30px`},messageText:{},messageColor_warn:{color:`#cb7642`},messageColor_error:{color:`#f5614d`},messageColor_info:{color:`#5abd29`},messageTitle_warn:e=>({background:`#cb7642`,borderRadius:`3px`,pl:`10px`,fontWeight:`bold`,color:e.palette.mode===`dark`?`black`:`white`}),messageTitle_error:e=>({background:`#f5614d`,borderRadius:`3px`,pl:`10px`,fontWeight:`bold`,color:e.palette.mode===`dark`?`black`:`white`}),messageTitle_info:e=>({background:`#5abd29`,borderRadius:`3px`,pl:`10px`,fontWeight:`bold`,color:e.palette.mode===`dark`?`black`:`white`}),deps:e=>({m:`10px`,fontSize:16,color:e.palette.mode===`dark`?`#e70000`:`#840101`})},Kt=class extends z{constructor(e){super(e),w(this,`t`,void 0),w(this,`messages`,null),w(this,`lang`,void 0),this.state={instanceNumbers:[]},this.t=e.t,this.lang=C.getLanguage(),this.messages=kt(e.adapterObject.messages,null,e.adapterObject.version,e.instances)}componentDidMount(){this.props.instancesWorker.getObjects().then(e=>{let t=Object.keys(e||{}).filter(t=>{var n;return(e==null||(n=e[t])==null||(n=n.common)==null?void 0:n.name)===this.props.adapter}).map(e=>e.substring(e.lastIndexOf(`.`)+1));this.setState({instanceNumbers:t})})}getAvailableInstances(){let e=[];e.push(h(F,{value:`auto`,children:this.t(`auto`)},`auto`));for(let t=0;t<=100&&(this.state.instanceNumbers.includes(t.toString())||e.push(h(F,{value:t.toString(),children:t},t)),!(e.length>11));t++);return e}checkDependencies(e=this.props.dependencies){if(!e)return``;let t=[];for(let r of e){var n;r.installedVersion?(n=r.wrongHosts)!=null&&n.length?t.push(T(`div`,{children:[h(`div`,{children:this.props.t(`The following hosts do not fulfill the required version %s of %s:`,r.version||`unknown`,r.name)}),h(`ul`,{style:{margin:`4px 0`},children:r.wrongHosts.map(e=>T(`li`,{children:[e.host,`: `,e.installedVersion]},e.host))})]},r.name)):r.rightVersion||t.push(h(`div`,{children:`${this.props.t(`Invalid version of %s. Required %s. Current `,r.name,r.version||`unknown`)}${r.installedVersion}`},r.name)):t.push(h(`div`,{children:this.props.t(`No version of %s`,r.name,r.name)},r.name))}return t.length?t:``}getText(e,t){return e&&typeof e==`object`?t?e.en:e[this.lang]||e.en:typeof e==`object`?``:e}renderOneMessage(e,t){return T(O,{children:[h(P,{sx:K[`messageTitle_${e.level||`warn`}`],children:this.getText(e.title,this.props.noTranslation)||``}),h(P,{component:`div`,variant:`body2`,style:K.messageText,children:this.getText(e.text,this.props.noTranslation)||``}),e.link?h(V,{onClick:()=>{let t=window.open(e.link,`_blank`);t==null||t.focus()},startIcon:h(me,{}),variant:`contained`,color:`grey`,children:this.getText(e.linkText||``,this.props.noTranslation)||this.props.t(`More info`)}):null]},t)}renderMessages(){return this.messages?h(O,{container:!0,spacing:2,wrap:`nowrap`,sx:{marginBottom:1,flexDirection:`column`},children:this.messages.map((e,t)=>this.renderOneMessage(e,t))}):null}render(){let e=this.checkDependencies();return T(a,{onClose:()=>{},open:!0,sx:{"& .MuiDialog-paper":K.paper},children:[h(x,{children:T(P,{component:`h2`,variant:`h6`,sx:{"&.MuiTypography-root":K.typography},children:[this.t(`You are going to add new instance:`),` `,this.props.adapter,h(y,{size:`large`,sx:K.closeButton,onClick:()=>this.props.onClose(!1),children:h(v,{})}),this.messages&&this.lang!==`en`&&this.props.toggleTranslation?h(y,{size:`large`,style:k.getStyle(this.props.theme,K.languageButton,this.props.noTranslation&&K.languageButtonActive),onClick:this.props.toggleTranslation,title:C.t(`Disable/Enable translation`),children:h(r,{})}):null]})}),T(b,{dividers:!0,children:[this.renderMessages(),!e&&this.props.expertMode?T(O,{container:!0,sx:{flexDirection:`column`},children:[h(vt,{tooltip:this.t(`Select host to add the instance`),expertMode:!0,socket:this.props.socket,hostsWorker:this.props.hostsWorker,currentHost:this.props.currentHost,setCurrentHost:(e,t)=>this.props.onHostChange(t.replace(/^system\.host\./,``))}),T(o,{variant:`standard`,style:K.formControl,children:[h(_,{id:`instance-label`,children:this.t(`Instance`)}),h(Fe,{variant:`standard`,labelId:`instance-label`,value:this.props.currentInstance,onChange:this.props.onInstanceChange,children:this.getAvailableInstances()})]})]}):null,h(j,{component:`div`,sx:K.deps,children:e})]}),T(M,{children:[h(V,{id:`instance-add-dialog-ok`,variant:`contained`,autoFocus:!0,disabled:!!e,onClick:()=>this.props.onClose(!0),color:`primary`,startIcon:h(s,{}),children:this.t(`Add`)}),h(V,{id:`instance-add-dialog-cancel`,variant:`contained`,onClick:()=>this.props.onClose(!1),color:`grey`,startIcon:h(v,{}),children:this.t(`Close`)})]})]})}},q=class e extends z{constructor(e){super(e),this.state={showDialog:!1,showLicenseDialog:null,addInstanceHostName:``,addInstanceId:`auto`,addInstanceDialog:``}}renderLicenseDialog(t){var n;return this.state.showLicenseDialog?h(bt,{licenseType:this.state.showLicenseDialog.licenseType,url:this.state.showLicenseDialog.url,link:(n=t.repository[this.state.showLicenseDialog.adapterName])==null||(n=n.licenseInformation)==null?void 0:n.link,onClose:n=>{let r=n?this.state.showLicenseDialog:null;this.setState({showLicenseDialog:null,showDialog:!1},()=>{r&&(r.upload?e.upload(r.adapterName,t):this.addInstance({adapterName:r.adapterName,context:t}).catch(e=>window.alert(`Cannot add instance: ${e}`)))})}}):null}async addInstance(t){if(!t.customUrl){let e=t.context.repository[t.adapterName],n=kt(e.messages,null,e.version,t.context.compactInstances);if(!t.instance&&(t.context.expertMode||n))return this.setState({addInstanceDialog:t.adapterName,showDialog:!0,addInstanceHostName:t.context.currentHost.replace(/^system\.host\./,``),addInstanceId:t.instance||`auto`}),!1;if(t.instance){let e=await t.context.instancesWorker.getObjects();if(e&&e[`system.adapter.${t.adapterName}.${t.instance}`])return window.alert(t.context.t(`Instance %s already exists`,`${t.adapterName}.${t.instance}`)),!1}}let n=(t.host||this.state.addInstanceHostName||t.context.currentHost).replace(/^system\.host\./,``);if(!t.customUrl){let r=await e.getSingletonRefusal(t.adapterName,n,t.context);if(r)return window.alert(r),!1}try{await new Promise((e,r)=>{t.context.executeCommand(`${t.customUrl?`url`:`add`} ${t.adapterName} ${t.instance?`${t.instance} `:``}--host ${n} ${t.debug||t.context.expertMode?`--debug`:``}`,n,t=>t?r(Error(`The process returned an exit code of ${t}`)):e(),t.files)})}catch(e){return window.alert(`${C.t(`Cannot install`)}: ${e}`),!1}return!0}static isSingletonInstalled(e,t){var n;if(!((n=t.adapters[`system.adapter.${e}`])!=null&&(n=n.common)!=null&&n.singleton))return!1;let r=`system.adapter.${e}.`;return Object.keys(t.compactInstances).some(e=>e.startsWith(r))}static async getSingletonRefusal(e,t,n){var r;let i=(r=n.adapters[`system.adapter.${e}`])==null?void 0:r.common;if(!(i!=null&&i.singleton)&&!(i!=null&&i.singletonHost))return null;let a=await n.instancesWorker.getObjects().catch(()=>null)||{},o=`system.adapter.${e}.`,s=Object.values(a).filter(e=>e==null?void 0:e._id.startsWith(o));if(i.singleton&&s.length)return n.t(`Adapter "%s" allows only one instance, and %s exists already`,e,s[0]._id.substring(15));let c=s.find(e=>e.common.host===t);return i.singletonHost&&c?n.t(`Adapter "%s" allows only one instance per host, and %s exists already on host "%s"`,e,c._id.substring(15),t):null}static async createInstanceIfNotExists(e){let{adapterName:t,context:n}=e,r=(e.host||n.currentHost).replace(/^system\.host\./,``),i;for(let e=0;e<5&&!i;e++){await new Promise(e=>setTimeout(e,500));try{i=await n.socket.getObject(`system.adapter.${t}`)}catch{}}if(!i){console.warn(`Cannot create an instance: adapter "${t}" not found after the installation`);return}let a=await n.instancesWorker.getObjects(!0);if(!(a&&Object.keys(a).find(e=>e.startsWith(`system.adapter.${t}.`))))try{await new Promise((i,a)=>{n.executeCommand(`add ${t} --host ${r} ${e.debug||n.expertMode?`--debug`:``}`,r,e=>e?a(Error(`The process returned an exit code of ${e}`)):i())})}catch(e){window.alert(`${C.t(`Cannot create instance`)}: ${e}`)}}static getDependencies(e,t){let n=t.repository[e],r=[];if(n){let e=n.dependencies?Array.isArray(n.dependencies)?n.dependencies:[n.dependencies]:[],a=n.globalDependencies?Array.isArray(n.globalDependencies)?n.globalDependencies:[n.globalDependencies]:[],o=n.node;if(e.length)for(let n of e){let e={name:``,version:null,installed:!1,installedVersion:null,rightVersion:!1},i=typeof n!=`string`,a=Object.keys(n);if(e.name=(i?a?a[0]:``:n)||``,e.version=i?n[e.name]:null,e.name){let n=t.installed[e.name];e.installed=!!n,e.installedVersion=n?n.version:null;try{e.rightVersion=n?!i||R.satisfies(n.version,e.version||`*`,{includePrerelease:!0}):!1}catch{e.rightVersion=!0}}r.push(e)}if(a.length)for(let e of a){let n={name:``,version:null,installed:!1,installedVersion:null,rightVersion:!1},a=typeof e!=`string`,o=Object.keys(e);if(n.name=(a?o?o[0]:``:e)||``,n.version=a?e[n.name]:null,n.name){var i;let e=t.installedGlobal[n.name];n.installed=!!e,n.installedVersion=e?e.version:null;let r=(i=t.installedGlobalHosts)==null?void 0:i[n.name];if(a&&r&&Object.keys(r).length>1){let t=[];for(let[e,i]of Object.entries(r)){let r;try{r=R.satisfies(i,n.version||`*`,{includePrerelease:!0})}catch{r=!0}r||t.push({host:e,installedVersion:i})}n.wrongHosts=t,n.rightVersion=e?!t.length:!1}else try{n.rightVersion=e?!a||R.satisfies(e.version,n.version||`*`,{includePrerelease:!0}):!1}catch{n.rightVersion=!0}}r.push(n)}let s=n.ifInstalledDependencies||{};if(typeof s==`object`&&!Array.isArray(s)){let e=Object.keys(s);for(let n of e){let e={name:n,version:s[n],installed:!1,installedVersion:null,rightVersion:!1};if(e.name){let n=t.installedGlobal[e.name];e.installed=!!n,e.installedVersion=n?n.version:null;try{e.rightVersion=!n||R.satisfies(n.version,e.version||`*`,{includePrerelease:!0})}catch{e.rightVersion=!0}}r.push(e)}}if(o){let e={name:`node`,version:o,installed:!0,installedVersion:t.nodeJsVersion,rightVersion:!1};try{e.rightVersion=R.satisfies(t.nodeJsVersion,o)}catch{e.rightVersion=!0}r.push(e)}}return r}renderAddInstanceDialog(t){return this.state.addInstanceDialog?h(Kt,{adapter:this.state.addInstanceDialog,socket:t.socket,hostsWorker:t.hostsWorker,instancesWorker:t.instancesWorker,dependencies:e.getDependencies(this.state.addInstanceDialog,t),currentHost:`system.host.${this.state.addInstanceHostName}`,currentInstance:this.state.addInstanceId,t:t.t,onClose:e=>{let n=e?this.state.addInstanceDialog:``,r=e?this.state.addInstanceId:``;this.setState({addInstanceDialog:``,addInstanceId:`auto`,showDialog:!1},()=>{if(n)try{this.addInstance({adapterName:n,instance:r,context:t})}catch(e){window.alert(`Cannot add instance: ${e}`)}})},onHostChange:e=>this.setState({addInstanceHostName:e.replace(/^system\.host\./,``)}),onInstanceChange:e=>this.setState({addInstanceId:e.target.value.toString()}),adapterObject:t.repository[this.state.addInstanceDialog],instances:t.compactInstances,toggleTranslation:t.toggleTranslation,noTranslation:this.props.noTranslation,expertMode:t.expertMode,theme:t.theme}):null}static upload(e,t){t.executeCommand(`upload ${e}${t.expertMode?` --debug`:``}`)}onAddInstance(e,t){var n;let r=t.repository[e],i=Rt(r),a=((n=r.licenseInformation)==null?void 0:n.license)||r.license;a===`MIT`||a===`Apache-2.0`||a===`ISC`||a===`BSD-3-Clause`||a===`BSD-2-Clause`||!a?this.addInstance({adapterName:e,context:t}).catch(e=>window.alert(`Cannot add instance: ${e}`)):this.setState({showLicenseDialog:{url:i,adapterName:e,licenseType:a},showDialog:!0})}renderDialogs(e){return this.state.showDialog?T(D,{children:[this.renderAddInstanceDialog(e),this.renderLicenseDialog(e)]}):null}},J={name:{flexWrap:`nowrap`,width:300,marginTop:0},nameDiv:{display:`flex`,alignItems:`center`},categoryName:{fontWeight:`bold`,cursor:`pointer`},green:{color:te[500]},blue:{color:de[700]},category:{backgroundColor:`background.default`},marginRight5:{marginRight:5}};function qt(e){let{installedCount:t,name:n,categoryName:r}=e;return T(_e,{hover:!1,sx:J.category,children:[h(B,{children:h(O,{container:!0,spacing:1,style:J.name,sx:{alignItems:`center`},children:h(O,{component:`div`,children:h(y,{size:`small`,onClick:e.onToggle,children:e.expanded?h(i,{}):h(Ze,{})})})})}),h(B,{onClick:e.onToggle,children:T(`div`,{style:{...J.nameDiv,...J.categoryName},children:[h(Et,{iconName:r,style:J.marginRight5}),n]})}),T(B,{colSpan:e.descHidden?5:6,children:[h(P,{component:`span`,variant:`body2`,style:J.green,children:t}),` ${e.t(`of`)} `,h(P,{component:`span`,variant:`body2`,style:J.blue,children:e.count}),` ${e.t(`Adapters from this Group installed`)}`]})]})}var Y={rating:{marginBottom:20},listRating:{marginRight:8},listTime:{opacity:.5,fontStyle:`italic`},list:{},listOwn:e=>({backgroundColor:e.palette.mode===`light`?`#16516e2e`:e.palette.secondary.dark}),listTitle:e=>({backgroundColor:e.palette.primary.dark,pt:`4px`,pb:`4px`,mb:`4px`,color:`#ffffff`,textAlign:`center`}),languageFilter:{width:300},ratingTextControl:{width:`calc(100% - 138px)`,marginRight:8},ratingLanguageControl:{width:130},noComments:{width:`100%`,textAlign:`center`,marginTop:16},commentCount:{marginTop:2,marginLeft:8,opacity:.8,fontSize:10,float:`right`},infoText:{textAlign:`left`,fontSize:`14px`},infoTextContainer:{display:`flex`,paddingBottom:`10px`,alignItems:`center`,gap:`10px`}},Jt=[{id:`en`,title:`English`},{id:`de`,title:`Deutsch`},{id:`ru`,title:`русский`},{id:`pt`,title:`Portugues`},{id:`nl`,title:`Nederlands`},{id:`fr`,title:`français`},{id:`it`,title:`Italiano`},{id:`es`,title:`Espanol`},{id:`pl`,title:`Polski`},{id:`uk`,title:`Українська`},{id:`zh-cn`,title:`简体中文`}],Yt=class extends z{constructor(e){super(e),this.state={ratingNumber:0,ratingComment:``,votings:null,ratingLang:this.props.lang,filterLang:(window._localStorage||window.localStorage).getItem(`app.commentLang`)||this.props.lang,commentsByLanguage:{}}}componentDidMount(){fetch(`https://rating.iobroker.net/adapter/${this.props.adapter}?uuid=${this.props.uuid}`).then(e=>e.json()).then(e=>{e||={},e.rating||={};let t=Object.keys(e.rating);t.sort((t,n)=>e.rating[t].ts>e.rating[n].ts?-1:+(e.rating[t].ts<e.rating[n].ts));let n={};if(e.comments&&(e.comments.sort((e,t)=>e.ts>t.ts?-1:+(e.ts<t.ts)),e.comments.forEach(e=>{n[e.lang]=n[e.lang]||0,n[e.lang]++})),t.length){let r=e.rating[t[0]];this.setState({votings:e,ratingNumber:r?r.r:0,commentsByLanguage:n})}else this.setState({votings:e,commentsByLanguage:n})})}setAdapterRating(e,t,n,r,i){return fetch(`https://rating.iobroker.net/vote`,{method:`POST`,headers:{"Content-Type":`application/json`},redirect:`follow`,body:JSON.stringify({uuid:this.props.uuid,adapter:e,version:t,rating:n,comment:r,lang:i})}).then(e=>e.json()).then(r=>(window.alert(`${this.props.t(`Vote:`)} ${e}@${t}=${n}`),delete r.adapter,r)).catch(e=>(window.alert(`Cannot vote: ${e}`),null))}renderInfoText(){return T(`div`,{style:Y.infoTextContainer,children:[h(xe,{}),h(P,{style:Y.infoText,children:this.props.t(`use GitHub for issues`)})]})}renderComments(){var e;if((e=this.state.votings)!=null&&e.comments&&this.state.votings.comments.length){let e=this.state.votings.comments.find(e=>!(this.state.filterLang&&this.state.filterLang!==`_`&&e.lang!==this.state.filterLang));return T(`div`,{style:{width:`100%`,textAlign:`left`},children:[h(j,{component:`h3`,sx:Y.listTitle,children:this.props.t(`Comments`)}),T(o,{variant:`standard`,style:Y.languageFilter,children:[h(_,{children:this.props.t(`Show comments in language`)}),T(Fe,{variant:`standard`,value:this.state.filterLang,onChange:e=>{(window._localStorage||window.localStorage).setItem(`app.commentLang`,e.target.value),this.setState({filterLang:e.target.value})},children:[T(F,{value:`_`,children:[this.props.t(`All`),` `,h(`span`,{style:Y.commentCount,children:this.state.votings.comments.length})]}),Jt.map(e=>T(F,{value:e.id,children:[e.title,` `,this.state.commentsByLanguage[e.id]?h(`span`,{style:Y.commentCount,children:this.state.commentsByLanguage[e.id]}):null]},e.id))]})]}),T(se,{style:Y.list,dense:!0,disablePadding:!0,children:[e&&this.state.votings.comments.map((e,n)=>this.state.filterLang&&this.state.filterLang!==`_`&&e.lang!==this.state.filterLang?null:e?T(t,{title:e.uuid?this.props.t(`Your comment`):``,sx:{"&.MuiListItem-root":e.uuid?Y.listOwn:void 0},dense:!0,children:[h(Ce,{style:Y.listRating,children:h(Te,{readOnly:!0,defaultValue:e.rating,size:`small`})}),h(Re,{primary:e.comment,secondary:`${new Date(e.ts).toLocaleString()} / v${e.version}`,sx:{"& .MuiListItemText-secondary":Y.listTime}})]},n):null),!e&&h(`div`,{style:Y.noComments,children:this.props.t(`No comments in selected language`)})]})]})}return null}render(){var e,t;let n,r;if(this.state.votings){let e=this.state.votings.rating||{};r=Object.keys(e),r.sort((t,n)=>e[t].ts>e[n].ts?-1:+(e[t].ts<e[n].ts)),r.length&&(n=e[r[0]])}return T(a,{open:!0,onClose:()=>this.props.onClose(),children:[h(x,{children:`${this.props.t(`Review`)} ${this.props.adapter}${this.props.version?`@${this.props.version}`:``}`}),T(b,{style:{textAlign:`center`},title:((e=this.props.currentRating)==null?void 0:e.title)||``,children:[this.renderInfoText(),h(Te,{style:Y.rating,name:this.props.adapter,value:this.props.version?this.state.ratingNumber:(t=this.props.currentRating)==null||(t=t.rating)==null?void 0:t.r,size:`large`,readOnly:!this.props.version,onChange:(e,t)=>this.setState({ratingNumber:t})}),this.props.version?T(`div`,{style:{width:`100%`,textAlign:`left`},children:[h(N,{variant:`standard`,style:Y.ratingTextControl,value:this.state.ratingComment,label:this.props.t(`Comment to version`),helperText:this.props.t(`Max length %s characters`,200),onChange:e=>this.setState({ratingComment:e.target.value}),slotProps:{input:{endAdornment:this.state.ratingComment?h(L,{position:`end`,children:h(y,{tabIndex:-1,size:`small`,onClick:()=>this.setState({ratingComment:``}),children:h(v,{})})}):null},htmlInput:{maxLength:200}}}),T(o,{variant:`standard`,style:Y.ratingLanguageControl,children:[h(_,{children:this.props.t(`Language`)}),h(Fe,{variant:`standard`,value:this.state.ratingLang,onChange:e=>this.setState({ratingLang:e.target.value}),children:Jt.map(e=>h(F,{value:e.id,children:e.title},e.id))})]})]}):null,this.props.version?h(`div`,{style:{paddingTop:20,paddingBottom:16},children:this.props.t(`Rate how good this version of the adapter works on your system. You can vote for every new version.`)}):null,r&&n?h(`div`,{children:this.props.t(`You voted for %s on %s`,r[0],new Date(n.ts).toLocaleDateString())}):null,this.renderComments()]}),T(M,{children:[this.props.version&&h(V,{variant:`contained`,autoFocus:!0,color:`primary`,disabled:!this.state.ratingNumber||this.state.votings===null,onClick:()=>{this.state.ratingNumber!==(n==null?void 0:n.r)||this.state.ratingComment?this.setAdapterRating(this.props.adapter,this.props.version,this.state.ratingNumber||5,this.state.ratingComment,this.state.ratingLang).then(e=>this.props.onClose(e)):this.props.onClose()},startIcon:h(Ye,{}),children:this.props.t(`Rate`)}),h(V,{autoFocus:!this.props.version,variant:`contained`,onClick:()=>this.props.onClose(),color:`grey`,startIcon:h(v,{}),children:this.props.t(`Close`)})]})]})}};d();var Xt={formControl:{marginTop:24},closeButton:e=>({position:`absolute`,right:8,top:8,color:e.palette.grey[500]}),typography:{paddingRight:30}},Zt=class extends z{constructor(e){super(e),w(this,`t`,void 0),this.state={deleteCustom:!1,deleteCustomSupported:!1},this.t=e.t}componentDidMount(){this.props.socket.checkFeatureSupported(`DEL_INSTANCE_CUSTOM`).then(e=>{if(e)return this.props.socket.getObject(`system.adapter.${this.props.adapter}`).then(e=>{e!=null&&e.common?e.common.supportCustoms&&this.setState({deleteCustomSupported:e.common.supportCustoms}):this.setState({deleteCustomSupported:!0})})})}render(){return T(a,{onClose:this.props.onClose,open:!0,children:[h(x,{children:T(P,{component:`h2`,variant:`h6`,sx:{"&.MuiTypography-root":Xt.typography},children:[this.t(`Please confirm`),h(y,{size:`large`,sx:Xt.closeButton,onClick:this.props.onClose,children:h(v,{})})]})}),T(b,{dividers:!0,children:[h(P,{gutterBottom:!0,children:this.t(`Are you sure you want to delete adapter %s?`,this.props.adapter)}),this.state.deleteCustomSupported&&h(E,{control:h(S,{checked:this.state.deleteCustom,onChange:e=>this.setState({deleteCustom:e.target.checked})}),label:this.t(`Delete all custom object settings of this adapter too`)})]}),T(M,{children:[h(V,{id:`adapter-delete-dialog-ok`,variant:`contained`,autoFocus:!0,onClick:()=>{this.props.onClick(this.state.deleteCustom),this.props.onClose()},color:`primary`,startIcon:h(pe,{}),children:this.t(`Ok`)}),h(V,{id:`adapter-delete-dialog-cancel`,variant:`contained`,autoFocus:!0,onClick:()=>this.props.onClose(),color:`grey`,startIcon:h(v,{}),children:this.t(`Close`)})]})]})}},Qt={none:h($e,{}),patch:h(tt,{style:{color:`green`}}),minor:h(Qe,{style:{color:`orange`}}),major:h(ne,{style:{color:`red`}})},$t=class extends Ie.Component{constructor(e){super(e),this.state={currentSavedPolicy:`none`,policy:`none`,repositories:[],supported:!0}}async componentDidMount(){await this.getConfiguredRepositories(),await this.getCurrentAutoUpgradeSetting()}async getConfiguredRepositories(){var e;let t=await this.props.socket.getObject(`system.config`);if(!(t!=null&&(e=t.common)!=null&&e.adapterAutoUpgrade))return;let n=Object.entries(t.common.adapterAutoUpgrade.repositories).filter(([,e])=>e).map(([e])=>e);this.setState({repositories:n})}getAdapterId(){return`${this.props.hostId}.adapter.${this.props.adapter}`}async getCurrentAutoUpgradeSetting(){let e=await this.props.socket.getObject(this.getAdapterId());e?this.setState({policy:e.common.automaticUpgrade||`none`,currentSavedPolicy:e.common.automaticUpgrade||`none`}):(console.error(`no adapter object existing`),this.setState({supported:!1}))}async save(){let e=await this.props.socket.getObject(this.getAdapterId());e?(e.common.automaticUpgrade=this.state.policy,await this.props.socket.setObject(this.getAdapterId(),e),this.setState({currentSavedPolicy:this.state.policy},()=>this.props.onClose())):(console.error(`no adapter object existing`),this.setState({supported:!1}))}render(){return T(a,{open:!0,maxWidth:`md`,fullWidth:!0,children:[h(x,{children:C.t(`Auto upgrade policy for %s`,this.props.adapter)}),T(b,{style:{padding:`0 20px`,overflow:`hidden`},children:[h(H,{value:!this.state.supported,children:h(P,{children:C.t(`This feature is supported up from js-controller Kiera (Version 6)!`)})}),T(H,{value:this.state.supported,children:[h(P,{children:C.t(`Allow only the following upgrades to be performed automatically:`)}),h(Fe,{variant:`standard`,style:{marginTop:20,minWidth:150,marginBottom:8},value:this.state.policy,onChange:e=>this.setState({policy:e.target.value}),children:pt.map(e=>h(F,{value:e,children:T(`div`,{style:{display:`flex`,gap:8},children:[Qt[e],dt[e]]})},e))}),h(H,{value:this.state.repositories.includes(`beta`)&&this.state.policy!==`none`,children:h(ke,{type:`warning`,children:C.t(`repo_update_hint`)})}),h(H,{value:this.state.policy===`major`,children:h(ke,{type:`warning`,children:C.t(`The current selected configuration will allow to automatically pull in incompatible changes of this adapter!`)})})]})]}),T(M,{children:[h(V,{disabled:this.state.currentSavedPolicy===this.state.policy,color:`primary`,variant:`contained`,startIcon:h(f,{}),onClick:()=>this.save(),children:C.t(`Save`)}),h(V,{variant:`contained`,onClick:()=>this.props.onClose(),color:`grey`,startIcon:h(v,{}),children:C.t(`Close`)})]})]})}};d();var en=new Set([`admin`,`eos-admin`,`backitup`,`nexowatt-devices`,`nexowatt-device`,`nexowatt-dev`,`nexowatt-ui`]),tn=e=>String(e||``).toLowerCase().replace(/^system\.adapter\./,``).replace(/^iobroker\./,``).replace(/^@nexowatt\/iobroker\./,``).replace(/^@nexowatt\//,``).replace(/\.\d+$/,``),nn=e=>{let t=tn(e);return en.has(t)},rn={hidden:{display:`none`},buttonUpdate:{border:`1px solid`,padding:`0px 7px`,borderRadius:5,display:`flex`,alignItems:`center`,cursor:`pointer`,transition:`background 0.5s`,"&:hover":{background:`#00800026`}},buttonUpdateIcon:{height:20,width:20,marginRight:10},classPoll:{color:`orange`},classPush:{color:`green`},classAssumption:{color:`red`,transform:`rotate(90deg)`},marginLeft5:{marginLeft:5},ratingSet:{cursor:`pointer`},sentry:{width:21,height:21,objectFit:`fill`,marginTop:3,filter:`invert(0%) sepia(90%) saturate(1267%) hue-rotate(-260deg) brightness(99%) contrast(97%)`},tooltip:{pointerEvents:`none`},wrongDependencies:{color:qe[700]},updateAvailable:{color:te[700]},repositoryVersionAvailable:{color:g[800]},currentVersion:e=>({cursor:`pointer`,mb:`6px`,mr:`8px`,mt:`4px`,"&:hover":{background:e.palette.primary.dark}}),header:e=>({fontWeight:`bold`,background:e.palette.secondary.main,p:`10px`}),modalDialog:{height:`calc(100% - 64px)`,overflowY:`hidden`},currentVersionText:e=>({color:e.palette.mode===`dark`?`#a3ffa3`:`#009800`,fontWeight:`bold`,marginLeft:`4px`}),repoStableVersionText:e=>({color:e.palette.mode===`dark`?`#8dff7a`:`#2b9800`,fontWeight:`bold`,marginLeft:`4px`}),repoLatestVersionText:e=>({color:e.palette.mode===`dark`?`#a3fcff`:`#005498`,fontWeight:`bold`,marginLeft:`4px`}),rating:{},containerVersion:{},containerSpecificVersion:{},versionWarn:{color:g[500]},cardContentFlexBetween:{},cardContentFlex:{}},an=class e extends q{constructor(e){super(e),w(this,`installedVersion`,``),Object.assign(this.state,{autoUpgradeDialogOpen:!1,showUpdateDialog:!1,installRepositoryVersion:!1,adapterDeletionDialog:!1,adapterInstallSpecificVersion:``,showInstallVersion:!1,showSetRating:null})}static renderImage(e){var t;let{style:n,alt:r,...i}=e,a=(t=n.backgroundImage)==null?void 0:t.substring(5,n.backgroundImage.length-2);return h(`img`,{...i,alt:r,src:a,onError:e=>{e.target&&(e.target.onerror=null,e.target.src=`img/no-image.svg`)}})}renderAddInstanceButton(){let e=!this.props.context.repository[this.props.adapterName]||this.props.context.repository[this.props.adapterName].allowAdapterInstall;return h(H,{value:e!==!1&&!q.isSingletonInstalled(this.props.adapterName,this.props.context),children:h(I,{title:this.props.context.t(`Add instance`),slotProps:{popper:{sx:this.styles.tooltip}},children:h(y,{size:`small`,disabled:this.props.commandRunning,style:this.props.cached.rightOs?void 0:this.styles.hidden,onClick:this.props.cached.rightOs?e=>{e.preventDefault(),e.stopPropagation(),this.onAddInstance(this.props.adapterName,this.props.context)}:void 0,children:h(s,{})})})})}renderAutoUpgradeButton(){var e;let t=this.props.context.hostAdapterWorker.getObject(this.props.adapterName);if(!t)return h(`div`,{style:{width:34,height:34,display:`inline-block`}});let n=(e=t.common)==null?void 0:e.automaticUpgrade;return h(I,{title:this.props.context.t(`Automatic Upgrade Policy`)+(n?`: ${n}`:``),slotProps:{popper:{sx:this.styles.tooltip}},children:h(y,{size:`small`,onClick:e=>{e.preventDefault(),e.stopPropagation(),this.setState({autoUpgradeDialogOpen:!0,showDialog:!0})},children:!n||n===`none`?h(it,{}):Qt[n]})})}renderReadmeButton(){let e=!this.props.context.repository[this.props.adapterName]||this.props.context.repository[this.props.adapterName].allowAdapterReadme;return h(H,{value:e,children:h(I,{title:this.props.context.t(`Readme`),slotProps:{popper:{sx:this.styles.tooltip}},children:h(y,{size:`small`,onClick:e=>{e.preventDefault(),e.stopPropagation(),this.openInfoDialog()},children:h(re,{})})})})}renderRating(){var e,t;let n=!this.props.context.repository[this.props.adapterName]||this.props.context.repository[this.props.adapterName].allowAdapterRating;return this.props.context.isTileView&&(this.props.context.sortPopularFirst||this.props.context.sortRecentlyUpdated||this.props.context.sortRecentlyCreated)||!this.props.context.repository[this.props.adapterName].stat||n===!1?null:h(`div`,{onClick:()=>this.setState({showSetRating:{version:this.installedVersion,rating:this.props.context.repository[this.props.adapterName].rating},showDialog:!0}),style:{...this.styles.rating,...this.styles.ratingSet},title:(e=this.props.context.repository[this.props.adapterName].rating)==null?void 0:e.title,children:h(Te,{name:this.props.adapterName,precision:.5,size:`small`,readOnly:!0,value:((t=this.props.context.repository[this.props.adapterName].rating)==null||(t=t.rating)==null?void 0:t.r)||0})})}renderConnectionType(){var e;let t=(e=this.props.context.repository[this.props.adapterName])==null?void 0:e.connectionType;return t===`cloud`?h(I,{title:this.props.context.t(`Adapter requires the specific cloud access for these devices/service`),slotProps:{popper:{sx:this.styles.tooltip}},children:h(wt,{})}):t===`local`?h(I,{title:this.props.context.t(`Adapter does not use the cloud for these devices/service`),slotProps:{popper:{sx:this.styles.tooltip}},children:h(Xe,{})}):null}renderDataSource(){var e;let t=(e=this.props.context.repository[this.props.adapterName])==null?void 0:e.dataSource;return t?h(`div`,{style:this.styles.marginLeft5,title:t,children:t===`poll`?h(I,{title:this.props.context.t(`The device or service will be periodically asked`),slotProps:{popper:{sx:this.styles.tooltip}},children:h(Oe,{style:this.styles.classPoll})}):t===`push`?h(I,{title:this.props.context.t(`The device or service delivers the new state actively`),slotProps:{popper:{sx:this.styles.tooltip}},children:h(ae,{style:this.styles.classPush})}):t===`assumption`?h(I,{slotProps:{popper:{sx:this.styles.tooltip}},title:this.props.context.t(`Adapter cannot request the exactly device status and the status will be guessed on the last sent command`),children:h(lt,{style:this.styles.classAssumption})}):h(`div`,{style:{width:24,height:24}})}):null}renderLicenseInfo(e=!1){var t,n,r,i;let a=this.props.context.repository[this.props.adapterName],o=Lt(a),s=(t=a.licenseInformation)!=null&&t.type?h(he,{href:o,target:`_blank`,rel:`noopener`,sx:e=>({color:e.palette.mode===`dark`?`white`:`black`,"&:hover":{color:e.palette.mode===`dark`?`white`:`black`}}),children:((n=a.licenseInformation)==null?void 0:n.type)===`paid`?h(I,{title:this.props.context.t(`The adapter requires a paid license.`),slotProps:{popper:{sx:this.styles.tooltip}},children:h(Je,{})}):((r=a.licenseInformation)==null?void 0:r.type)===`commercial`?h(I,{slotProps:{popper:{sx:this.styles.tooltip}},title:this.props.context.t(`The adapter requires a paid license for commercial use.`),children:h(Je,{opacity:.5})}):((i=a.licenseInformation)==null?void 0:i.type)===`limited`?h(I,{slotProps:{popper:{sx:this.styles.tooltip}},title:this.props.context.t(`The adapter has a limited functionality without a paid license.`),children:h(Je,{opacity:.5})}):null}):null;return!s&&e?h(`div`,{style:{width:24,height:24}}):s}renderSentryInfo(){var e;return(e=this.props.context.repository[this.props.adapterName])!=null&&(e=e.plugins)!=null&&e.sentry?h(`div`,{style:this.styles.marginLeft5,children:h(I,{title:`sentry`,slotProps:{popper:{sx:this.styles.tooltip}},children:h(Ue,{style:this.styles.sentry,component:`img`,image:Dt})})}):null}getDependencies(){let e=q.getDependencies(this.props.adapterName,this.props.context);if(!e)return null;let t=[];for(let r of e){var n;r.installedVersion?(n=r.wrongHosts)!=null&&n.length?t.push(`${this.props.context.t(`The following hosts do not fulfill the required version %s of %s:`,r.version||`unknown`,r.name)} ${r.wrongHosts.map(e=>`${e.host} (${e.installedVersion})`).join(`, `)}`):r.rightVersion||t.push(`${this.props.context.t(`Invalid version of %s. Required %s. Current `,r.name,r.version||`unknown`)}${r.installedVersion}`):t.push(this.props.context.t(`No version of %s`,r.name,r.name))}return t.length?(t.unshift(this.props.context.t(`Wrong dependencies`)),t.map((e,t)=>h(`div`,{style:t?void 0:{fontWeight:`bold`,fontSize:`larger`},children:e},e))):null}renderVersion(){let e=!this.props.context.repository[this.props.adapterName]||this.props.context.repository[this.props.adapterName].allowAdapterUpdate,t=this.props.context.repository[this.props.adapterName],n=t==null?void 0:t.version;return n?!this.props.commandRunning&&e!==!1&&this.isRepositoryVersionInstallable()?h(I,{title:this.props.context.t(`Install version %s from repository`,n),slotProps:{popper:{sx:this.styles.tooltip}},children:T(`div`,{onClick:()=>this.setState({showUpdateDialog:!0,showDialog:!0,installRepositoryVersion:!0}),style:{...this.styles.buttonUpdate,...this.props.cached.rightDependencies?this.styles.repositoryVersionAvailable:void 0},children:[h(y,{style:this.styles.buttonUpdateIcon,size:`small`,children:h(yt,{})}),n]})}):!this.props.commandRunning&&this.props.cached.updateAvailable&&e!==!1?h(I,{title:this.props.context.t(`Update`),slotProps:{popper:{sx:this.styles.tooltip}},children:T(`div`,{onClick:e=>{e.preventDefault(),e.stopPropagation(),this.setState({showUpdateDialog:!0,showDialog:!0,installRepositoryVersion:!1})},style:{...this.styles.buttonUpdate,...this.props.cached.rightDependencies?this.styles.updateAvailable:void 0},children:[h(y,{style:this.styles.buttonUpdateIcon,size:`small`,children:h(He,{})}),n]})}):h(I,{title:this.getDependencies(),slotProps:{popper:{sx:this.styles.tooltip}},children:h(`span`,{style:this.props.cached.rightDependencies?void 0:this.styles.wrongDependencies,children:n})}):h(`span`,{style:this.styles.wrongDependencies,children:this.props.context.t(`not maintained`)})}isRepositoryVersionInstallable(){var e,t,n;let r=(e=this.props.context.repository[this.props.adapterName])==null?void 0:e.version,i=(t=this.props.context.installed[this.props.adapterName])==null?void 0:t.version;if(!r||!i||this.props.cached.updateAvailable)return!1;if(r!==i)return mt.updateAvailable(r,i,`adapter "${this.props.adapterName}"`);let a=(n=this.props.context.adapters[`system.adapter.${this.props.adapterName}`])==null||(n=n.common)==null?void 0:n.installedFrom;return!!a&&!a.startsWith(`iobroker.${this.props.adapterName}@`)}static extractGitHubCommitHash(e){if(!e)return null;let t=e.indexOf(`#`);if(t===-1)return null;let n=e.substring(t+1);return n.length>=7?n.substring(0,7):n}renderInstalledVersion(t){var n;let r=this.props.context.installed[this.props.adapterName],i=(n=this.props.context.adapters[`system.adapter.${this.props.adapterName}`])==null||(n=n.common)==null?void 0:n.installedFrom,{adapterName:a}=this.props,o=i&&!i.startsWith(`iobroker.${a}@`),s=o?e.extractGitHubCommitHash(i):null,c=o&&s?`${this.installedVersion}+${s}`:this.installedVersion;if(t){let e=r==null?void 0:r.enabled,t=r==null?void 0:r.count;return T(O,{container:!0,wrap:`nowrap`,spacing:1,sx:{alignItems:`center`},children:[this.installedVersion?h(O,{children:c+(t?` (${t}${t===e?``:`~`})`:``)}):null,o&&h(O,{container:!0,children:h(I,{title:`${this.props.context.t(`Non-NPM-Version`)}: ${i}`,slotProps:{popper:{sx:this.styles.tooltip}},children:h(ot,{fontSize:`small`,style:this.styles.versionWarn})})})]})}return this.installedVersion?T(P,{component:`span`,style:this.styles.cardContentFlexBetween,children:[T(`div`,{children:[this.props.context.t(`Installed version`),`:`]}),T(`div`,{style:this.styles.cardContentFlex,children:[o&&h(I,{title:`${this.props.context.t(`Non-NPM-Version`)}: ${i}`,slotProps:{popper:{sx:this.styles.tooltip}},children:h(ot,{fontSize:`small`,style:this.styles.versionWarn})}),c]})]}):null}renderUploadButton(){return this.props.context.expertMode&&this.installedVersion?h(I,{title:this.props.context.t(`Upload`),slotProps:{popper:{sx:this.styles.tooltip}},children:h(y,{size:`small`,disabled:this.props.commandRunning,"data-eos-adapter-action":`upload`,onClick:e=>{e.preventDefault(),e.stopPropagation(),this.onUpload()},children:h(be,{})})}):null}renderDeleteButton(){let e=nn(this.props.adapterName);return h(H,{value:!!this.installedVersion&&!e,children:h(I,{title:this.props.context.t(`Delete adapter`),slotProps:{popper:{sx:this.styles.tooltip}},children:h(y,{size:`small`,disabled:this.props.commandRunning,"data-eos-adapter-action":`delete`,onClick:e=>{e.preventDefault(),e.stopPropagation(),this.setState({adapterDeletionDialog:!0,showDialog:!0})},children:h(ct,{})})})})}renderInstallSpecificVersionButton(){return this.props.context.expertMode&&this.installedVersion?h(I,{title:this.props.context.t(`Install a specific version`),slotProps:{popper:{sx:this.styles.tooltip}},children:h(y,{disabled:this.props.commandRunning,size:`small`,"data-eos-adapter-action":`install-specific-version`,onClick:e=>{e.preventDefault(),e.stopPropagation(),this.setState({showInstallVersion:!0,showDialog:!0})},children:h(nt,{})})}):null}renderRebuildButton(){return!this.props.context.expertMode||!this.installedVersion?null:h(I,{title:this.props.context.t(`Rebuild`),children:h(y,{size:`small`,disabled:this.props.commandRunning,"data-eos-adapter-action":`rebuild`,onClick:e=>{e.preventDefault(),e.stopPropagation(),this.rebuild()},children:h(fe,{})})})}renderAutoUpdateDialog(){return this.state.autoUpgradeDialogOpen?h($t,{onClose:()=>this.setState({autoUpgradeDialogOpen:!1,showDialog:!1}),adapter:this.props.adapterName,hostId:this.props.context.adminHost,socket:this.props.context.socket}):null}async ignoreVersion(e){let t=await this.props.context.socket.getObject(`system.adapter.${this.props.adapterName}`);t!=null&&t.common?(t.common.ignoreVersion=e,this.props.context.socket.setObject(t._id,t).catch(e=>window.alert(`Cannot write object: ${e}`))):window.alert(`Adapter "${this.props.adapterName}" does not exist!`),this.props.context.removeUpdateAvailable(this.props.adapterName)}renderUpdateAdapterDialog(){var e,t;if(!this.state.showUpdateDialog)return null;this.installedVersion=(e=this.props.context.installed[this.props.adapterName])==null?void 0:e.version;let n=(t=this.props.context.repository[this.props.adapterName])==null?void 0:t.version;return h(jt,{textTitle:this.state.installRepositoryVersion?this.props.context.t(`Install "%s" v%s from repository instead of v%s`,this.props.adapterName,n,this.installedVersion):void 0,textUpdate:this.state.installRepositoryVersion?this.props.context.t(`Install`):void 0,adapter:this.props.adapterName,adapterObject:this.props.context.repository[this.props.adapterName],t:this.props.context.t,dependencies:q.getDependencies(this.props.adapterName,this.props.context),rightDependencies:this.props.context.rightDependenciesFunc(this.props.adapterName),news:this.getNews(),toggleTranslation:this.props.context.toggleTranslation,noTranslation:this.props.noTranslation,installedVersion:this.installedVersion,onUpdate:e=>this.setState({showUpdateDialog:!1,showDialog:!1},()=>this.update(e)),isStable:this.props.context.repository._repoInfo.stable,onIgnore:this.state.installRepositoryVersion?void 0:e=>this.setState({showUpdateDialog:!1,showDialog:!1},()=>void this.ignoreVersion(e)),onClose:()=>this.setState({showUpdateDialog:!1,showDialog:!1}),instances:this.props.context.compactInstances,theme:this.props.context.theme})}static formatNews(e){return(e||``).toString().split(`
4
4
  `).map(e=>e.trim().replace(/^\*+/,``).replace(/^-/,``).replace(/\*+$/,``).replace(/\r/g,``).trim()).filter(e=>e).map((e,t)=>T(`div`,{style:{},children:[h(`span`,{children:`- `}),e]},t))}renderAdapterInstallVersion(){if(!this.state.showInstallVersion)return null;let t,n,r=this.props.context.repository._repoInfo;if(r!=null&&r.stable){var i,a;t=(i=this.props.context.repository[this.props.adapterName])==null?void 0:i.version,n=(a=this.props.context.repository[this.props.adapterName])==null?void 0:a.latestVersion}else{var o,s;t=(o=this.props.context.repository[this.props.adapterName])==null?void 0:o.stable,n=(s=this.props.context.repository[this.props.adapterName])==null?void 0:s.version}return h(Mt,{title:this.props.context.t(`Please select specific version of %s`,this.props.adapterName),applyButton:!1,onClose:()=>this.setState({showInstallVersion:!1,adapterInstallSpecificVersion:``,showDialog:!1}),theme:this.props.context.theme,toggleTranslation:this.props.context.toggleTranslation,noTranslation:this.props.noTranslation,children:T(`div`,{style:{height:`100%`,overflowY:`hidden`},children:[T(`div`,{style:this.styles.containerSpecificVersion,children:[T(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[h(N,{variant:`standard`,style:{flexGrow:1},label:this.props.context.t(`Enter version manually`),value:this.state.adapterInstallSpecificVersion,onChange:e=>this.setState({adapterInstallSpecificVersion:e.target.value}),slotProps:{input:{endAdornment:this.state.adapterInstallSpecificVersion?h(L,{position:`end`,children:h(y,{tabIndex:-1,size:`small`,onClick:()=>this.setState({adapterInstallSpecificVersion:``}),children:h(v,{})})}):null}}}),h(V,{color:`primary`,variant:`contained`,size:`small`,disabled:!this.state.adapterInstallSpecificVersion,onClick:()=>{this.state.adapterInstallSpecificVersion&&(this.update(this.state.adapterInstallSpecificVersion),this.setState({showInstallVersion:!1,adapterInstallSpecificVersion:``,showDialog:!1}))},children:this.props.context.t(`Install`)})]}),h(I,{title:this.props.context.t(`npmjs.com`),slotProps:{popper:{sx:this.styles.tooltip}},children:h(y,{size:`small`,onClick:()=>{var e;(e=window.open(`https://www.npmjs.com/package/iobroker.${this.props.adapterName}?activeTab=versions`,this.props.adapterName))==null||e.focus()},children:h(ie,{})})})]}),h(j,{component:`div`,sx:this.styles.header,children:this.props.context.t(`Or select from the list`)}),h(`div`,{style:{...this.styles.containerVersion,height:`calc(100% - 122px)`,overflowY:`auto`},children:this.getNews(!0).map(({version:r,news:i})=>h(We,{variant:`outlined`,sx:this.styles.currentVersion,onClick:()=>{this.update(r),this.setState({showInstallVersion:!1,showDialog:!1})},children:T(c,{children:[T(P,{sx:k.getStyle(this.props.context.theme,this.installedVersion===r&&this.styles.currentVersionText,{fontSize:16,fontWeight:`bold`}),color:`text.secondary`,gutterBottom:!0,children:[r,this.installedVersion===r?h(j,{component:`span`,sx:this.styles.currentVersionText,children:`(${this.props.context.t(`current`)})`}):null,n===r?h(j,{component:`span`,sx:this.styles.repoLatestVersionText,children:`(latest)`}):null,t===r?h(j,{component:`span`,sx:this.styles.repoStableVersionText,children:`(${this.props.context.t(`stable`)})`}):null]}),h(P,{variant:`body2`,style:{opacity:.7},children:e.formatNews(i)})]})},r))})]})})}renderSetRatingDialog(){return this.state.showSetRating?h(Yt,{t:this.props.context.t,lang:this.props.context.lang,version:this.state.showSetRating.version,adapter:this.props.adapterName,currentRating:this.state.showSetRating.rating,onClose:e=>{e&&this.props.context.updateRating(this.props.adapterName,e),this.setState({showSetRating:null,showDialog:!1})},uuid:this.props.context.uuid}):null}renderAdapterDeletionDialog(){return this.state.adapterDeletionDialog?h(Zt,{adapter:this.props.adapterName,socket:this.props.context.socket,t:this.props.context.t,onClick:e=>this.delete(e),onClose:()=>this.setState({adapterDeletionDialog:!1,showDialog:!1})}):null}openInfoDialog(){var e;let t=(e=this.props.context.repository[this.props.adapterName].docs)!=null&&e[this.props.context.lang]?this.props.context.lang:`en`;window.open(mt.getDocsLinkForAdapter({lang:t,adapterName:this.props.adapterName}),`help`)}getNews(e=!1){let t=this.props.context.repository[this.props.adapterName],n=this.props.context.installed[this.props.adapterName],r=[];return n&&t!=null&&t.news&&Object.keys(t.news).forEach(i=>{try{if(R.gt(i,n.version)||e){let e;e=typeof t.news[i]==`object`?this.props.noTranslation?t.news[i].en:t.news[i][this.props.context.lang]||t.news[i].en:t.news[i],r.push({version:i,news:e})}}catch{console.warn(`[ADAPTERS] Cannot compare "${i}" and "${n.version}" (${this.props.adapterName})`)}}),r}onUpload(){var e;let t=this.props.context.repository[this.props.adapterName],n=Rt(t),r=((e=t.licenseInformation)==null?void 0:e.license)||t.license;r!==`MIT`&&r!==`Apache-2.0`&&r!==`ISC`&&r!==`BSD-3-Clause`&&r!==`BSD-2-Clause`&&r?this.setState({showLicenseDialog:{url:n,upload:!0,adapterName:this.props.adapterName,licenseType:r},showDialog:!0}):q.upload(this.props.adapterName,this.props.context)}delete(e){nn(this.props.adapterName)?window.alert(`Dieser Adapter ist ein geschütztes NexoWatt-EOS-Systemmodul und darf nicht gelöscht werden.`):this.props.context.executeCommand(`del ${this.props.adapterName}${e?` --custom`:``}${this.props.context.expertMode?` --debug`:``}`)}update(e){this.props.context.executeCommand(`upgrade ${this.props.adapterName}@${e}${this.props.context.expertMode?` --debug`:``}`)}rebuild(){this.props.context.executeCommand(`rebuild ${this.props.adapterName}${this.props.context.expertMode?` --debug`:``}`)}renderDialogs(){return this.state.showDialog?T(D,{children:[this.renderAddInstanceDialog(this.props.context),this.renderLicenseDialog(this.props.context),this.renderUpdateAdapterDialog(),this.renderAdapterInstallVersion(),this.renderSetRatingDialog(),this.renderAdapterDeletionDialog(),this.renderAutoUpdateDialog()]}):null}};d();var on=`0 8px 17px 0 rgba(0, 0, 0, .2),0 6px 20px 0 rgba(0, 0, 0, .19)`,sn={...rn,type:{color:`tile`},root:e=>({position:`relative`,m:`10px`,width:300,minHeight:200,borderRadius:24,overflow:`hidden`,background:`linear-gradient(180deg, rgba(13, 36, 58, 0.90), rgba(7, 23, 39, 0.88))`,boxShadow:`0 14px 30px rgba(0,0,0,.24)`,display:`flex`,flexDirection:`column`,transition:`box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease`,"&:hover":{boxShadow:on}}),imageBlock:e=>({background:`linear-gradient(135deg, rgba(0,255,136,.16), rgba(0,212,255,.11))`,borderBottom:`1px solid rgba(0,255,136,.20)`,minHeight:60,display:`flex`,padding:`0 10px 0 10px`,position:`relative`,justifyContent:`space-between`,color:`#eef7ff`}),img:{width:45,height:45,margin:`auto 0`,position:`relative`,"&:after":{content:`""`,position:`absolute`,zIndex:2,top:0,left:0,width:`100%`,height:`100%`,background:`url("img/no-image.svg") 100% 100% no-repeat`,backgroundSize:`cover`,backgroundColor:`#fff`}},installed:{background:`#77c7ff8c`},update:{background:`#10ff006b`},fab:{position:`absolute`,bottom:-20,width:40,height:40,right:20},greenText:e=>({color:e.palette.success.dark}),collapse:{height:`100%`,background:`linear-gradient(180deg, rgba(8, 29, 47, 0.985), rgba(4, 14, 25, 0.975))`,color:`#eef7ff`,border:`1px solid rgba(0, 255, 136, 0.34)`,borderRadius:24,position:`absolute`,width:`100%`,zIndex:1200,marginTop:`auto`,bottom:0,overflow:`hidden`,pointerEvents:`auto`,justifyContent:`space-between`,display:`flex`,flexDirection:`column`},close:{display:`flex`,ml:`auto`,mt:`-4px`,color:`#eaf9ff`},footerBlock:e=>({background:`rgba(2, 9, 20, 0.90)`,borderTop:`1px solid rgba(0,255,136,.22)`,position:`relative`,zIndex:40,pointerEvents:`auto`,p:`10px`,display:`flex`,justifyContent:`space-between`}),versionDate:{alignSelf:`center`},adapter:e=>({width:`100%`,fontWeight:`bold`,fontSize:16,verticalAlign:`middle`,pl:1,pt:2,color:(e.palette.mode,`#333`)}),adapterWithAgo:{width:`calc(100% - 145px)`},description:e=>({display:`block`,color:`rgba(238, 247, 255, 0.94)`,fontSize:13.5,lineHeight:1.48,whiteSpace:`normal`,overflowWrap:`anywhere`}),cardContent:{overflow:`auto`},cardContentDiv:{position:`sticky`,right:0,top:0,background:`linear-gradient(135deg, rgba(0,255,136,.16), rgba(0,212,255,.09))`,borderBottom:`1px solid rgba(0,255,136,.22)`,zIndex:2},cardContentFlex:{display:`flex`},cardContentFlexBetween:{display:`flex`,justifyContent:`space-between`},cardContent2:{height:`100%`,display:`flex`,flexDirection:`column`,justifyContent:`space-between`},cardMargin10:{marginTop:10},availableVersion:{display:`flex`,justifyContent:`space-between`},curdContentFlexCenter:{display:`flex`,alignItems:`center`},versionWarn:{color:g[500],marginRight:5},rating:{marginTop:20}},cn=class extends an{constructor(e){super(e),w(this,`styles`,sn),Object.assign(this.state,{openCollapse:!1})}renderInfoCard(){return T(`div`,{className:`eos-adapter-info-card`,style:this.styles.collapse,children:[T(c,{style:this.styles.cardContent,children:[h(`div`,{style:this.styles.cardContentDiv,children:h(y,{size:`small`,sx:this.styles.close,onClick:()=>this.setState({openCollapse:!this.state.openCollapse}),children:h(v,{})})}),h(P,{gutterBottom:!0,component:`span`,variant:`body2`,sx:this.styles.description,children:this.props.cached.desc})]}),T(j,{component:`div`,sx:this.styles.footerBlock,children:[this.renderAddInstanceButton(),T(`div`,{style:this.styles.cardContentFlex,children:[this.renderAutoUpgradeButton(),this.renderReadmeButton(),this.renderUploadButton(),this.renderDeleteButton(),this.renderInstallSpecificVersionButton()]})]})]})}renderCardMedia(){let e=this.props.context.repository[this.props.adapterName],t=e==null?void 0:e.version;return T(j,{component:`div`,sx:k.getStyle(this.props.context.theme,this.styles.imageBlock,this.installedVersion&&this.styles.installed,this.installedVersion&&t&&this.installedVersion!==t&&this.props.cached.updateAvailable&&this.styles.update),children:[h(Ue,{sx:this.styles.img,component:e=>an.renderImage(e),src:this.props.cached.image||`img/no-image.svg`,image:this.props.cached.image||`img/no-image.svg`}),h(j,{component:`div`,sx:k.getStyle(this.props.context.theme,this.styles.adapter,(e.stat||this.props.context.sortRecentlyUpdated||this.props.context.sortRecentlyCreated)&&this.styles.adapterWithAgo),children:this.props.adapterName}),this.props.context.sortPopularFirst?h(`div`,{style:this.styles.versionDate,children:e.stat}):null,this.props.context.sortRecentlyUpdated?h(`div`,{style:this.styles.versionDate,children:this.props.cached.daysAgoText}):null,this.props.context.sortRecentlyCreated?h(`div`,{style:this.styles.versionDate,children:this.props.cached.createdDaysAgoText}):null,!this.props.context.sortPopularFirst&&!this.props.context.sortRecentlyUpdated&&!this.props.context.sortRecentlyCreated?this.renderRating():null,this.state.openCollapse?null:h(I,{title:this.props.context.t(`Info`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:h(le,{onClick:()=>this.setState({openCollapse:!this.state.openCollapse}),style:this.styles.fab,color:`primary`,"aria-label":`add`,children:h(Ve,{})})})]})}renderCardContent(){let e=!this.props.context.repository[this.props.adapterName]||this.props.context.repository[this.props.adapterName].allowAdapterUpdate,t=this.props.context.installed[this.props.adapterName];return T(c,{style:this.styles.cardContent2,children:[h(P,{gutterBottom:!0,variant:`h5`,component:`h5`,children:this.props.cached.title}),T(`div`,{style:this.styles.cardContentFlex,children:[this.renderConnectionType(),this.renderDataSource(),h(`div`,{children:this.renderLicenseInfo()}),this.renderSentryInfo()]}),T(`div`,{style:this.styles.cardMargin10,children:[t!=null&&t.count?T(P,{component:`span`,style:this.styles.cardContentFlexBetween,children:[T(`div`,{children:[this.props.context.t(`Installed instances`),`:`]}),h(`div`,{children:t.count})]}):null,h(H,{value:e,children:T(P,{component:`span`,style:this.styles.availableVersion,children:[h(`div`,{children:this.props.context.t(`Available version:`)}),h(j,{component:`div`,sx:k.getStyle(this.props.context.theme,this.props.cached.updateAvailable&&this.styles.greenText,this.styles.curdContentFlexCenter),children:this.renderVersion()})]})}),this.renderInstalledVersion()]})]})}render(){var e;return this.installedVersion=(e=this.props.context.installed[this.props.adapterName])==null?void 0:e.version,T(We,{sx:this.styles.root,children:[this.state.openCollapse?this.renderInfoCard():null,this.renderCardMedia(),this.renderCardContent(),this.renderDialogs()]})}};d();var ln={...rn,type:{color:`line`},smallAvatar:{width:32,height:32,marginLeft:4},paddingNone:{padding:`0 !important`},name:{flexWrap:`nowrap`,width:300,marginTop:0},flex:{display:`flex`},nameCell:{paddingTop:`0 !important`,paddingBottom:`0 !important`}},un=class extends an{constructor(...e){super(...e),w(this,`styles`,ln)}render(){var e,t;let n=this.props.context.repository[this.props.adapterName],r=!n||n.allowAdapterRating;return this.installedVersion=(e=this.props.context.installed[this.props.adapterName])==null?void 0:e.version,T(_e,{hover:!0,children:[h(B,{}),h(B,{children:T(O,{container:!0,spacing:1,style:this.styles.name,sx:{alignItems:`center`},children:[h(I,{title:this.props.adapterName,slotProps:{popper:{sx:this.styles.tooltip}},children:h(O,{style:this.styles.paddingNone,children:h(Ee,{variant:`square`,alt:this.props.cached.title,src:this.props.cached.image,style:this.styles.smallAvatar})})}),r===!1?h(O,{children:this.props.cached.title}):T(O,{style:this.styles.nameCell,children:[h(`div`,{children:this.props.cached.title}),this.renderRating()]})]})}),!this.props.context.descHidden&&h(B,{title:this.props.cached.desc,style:{width:20,wordWrap:`break-word`},children:this.props.cached.desc}),h(B,{children:T(`div`,{style:this.styles.flex,children:[this.renderConnectionType()||h(`div`,{style:{width:24,height:24}}),this.renderDataSource()||h(`div`,{style:{marginLeft:5,width:24,height:24}}),this.renderSentryInfo()||h(`div`,{style:{marginLeft:5,width:24,height:24}}),this.renderLicenseInfo(!0)]})}),h(B,{children:this.renderInstalledVersion(!0)}),h(B,{children:h(O,{container:!0,sx:{alignItems:`center`},children:this.renderVersion()})}),h(B,{style:{fontSize:`smaller`},children:(n==null||(t=n.licenseInformation)==null?void 0:t.license)||(n==null?void 0:n.license)}),T(B,{children:[this.renderAddInstanceButton(),this.renderAutoUpgradeButton(),this.renderReadmeButton(),this.renderUploadButton(),this.renderDeleteButton(),this.renderInstallSpecificVersionButton(),this.renderRebuildButton()]}),this.renderDialogs()]})}};d();var dn=246,X={emptyBlock:50,name:300,connectionType:120,installed:120,available:120,update:40,license:80,install:dn},fn=Object.keys(X).reduce((e,t)=>e+X[t],0),Z={container:{height:`100%`,width:`100%`},containerNotFullHeight:{height:`calc(100% - 50px)`},containerFullHeight:{height:`100%`},table:{width:`100%`,tableLayout:`fixed`,minWidth:960,"& td":{whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,pt:`2px`,pb:`2px`,pr:`4px`,pl:`4px`},"& th":{whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,pt:`2px`,pb:`2px`,pr:`4px`,pl:`4px`}},name:{flexWrap:`nowrap`,width:X.name},emptyBlock:{flexWrap:`nowrap`,width:X.emptyBlock},description:{width:`calc(100% - ${fn+2}px)`},connectionType:{width:X.connectionType},installed:{width:X.installed},available:{width:X.available,paddingRight:6},update:{width:X.update,padding:0},license:{width:X.license},install:{width:X.install},viewModeDiv:{display:`flex`,flexFlow:`wrap`,overflow:`auto`,justifyContent:`center`}},pn=class extends z{constructor(e){super(e),w(this,`lastRenderCounter`,-1),this.state={descWidth:e.descWidth,repoName:e.repoName,systemConfig:!!e.systemConfig,tableViewMode:e.tableViewMode,oneListView:e.oneListView,categoriesExpanded:JSON.stringify(e.categoriesExpanded),cachedAdapters:e.cachedAdapters?Object.keys(e.cachedAdapters).length:0,update:e.update,sortByName:e.sortByName,sortPopularFirst:e.sortPopularFirst,sortRecentlyUpdated:e.sortRecentlyUpdated,sortRecentlyCreated:e.sortRecentlyCreated,renderCounter:0,listOfVisibleAdapter:JSON.stringify(e.listOfVisibleAdapter),expertMode:e.context.expertMode,commandRunning:e.commandRunning,noTranslation:e.noTranslation}}getRow(e,t){var n;let r=(n=this.props.cachedAdapters)==null?void 0:n[e];return r?h(un,{context:t,adapterName:e,cached:r,commandRunning:this.state.commandRunning,noTranslation:this.state.noTranslation},`adapter-${e}`):null}getRows(e){if(!this.props.listOfVisibleAdapter)return h(_e,{children:h(B,{colSpan:8,children:h(A,{})})});let t=0,n=[];if(this.props.oneListView){for(let t=0;t<this.props.listOfVisibleAdapter.length;t++){var r;let i=this.props.listOfVisibleAdapter[t];if(n.length>50&&!((r=this.props.context.installed[i])!=null&&r.version))continue;let a=this.getRow(i,e);a&&n.push(a)}if(t=n.length,t&&this.props.listOfVisibleAdapter.length>n.length){let e=this.props.listOfVisibleAdapter.length-n.length,t=e===1?this.props.context.t(`Filter adapters to see others. There is %s more`,1):this.props.context.t(`Filter adapters to see others. There are %s more`,e);n.push(h(_e,{children:h(B,{colSpan:8,style:{fontSize:20,padding:20,textAlign:`center`},children:t})},`more`))}}else n=this.props.categories.map(n=>{if(!n.adapters.find(e=>{var t;return(t=this.props.listOfVisibleAdapter)==null?void 0:t.includes(e)}))return null;let r=n.name,i=this.props.categoriesExpanded[r];return t++,T(Ne,{children:[h(qt,{categoryName:r,count:n.count,expanded:i,installedCount:n.installed,name:n.translation,descHidden:e.descHidden,onToggle:()=>this.props.toggleCategory(r),t:this.props.context.t},`category-${r}1`),i&&n.adapters.map(n=>{let r=this.getRow(n,e);return r&&t++,r})]},`category-${r} ${n.adapters.length}`)});return t?n:this.props.update?null:h(`tr`,{children:T(`td`,{colSpan:8,style:{textAlign:`center`},children:[this.props.searchFilter||this.props.installedListFilter?h(V,{variant:`outlined`,title:this.props.context.t(`Click to clear all filters`),onClick:()=>this.props.clearAllFilters(),children:this.props.context.t(`all items are filtered out`)}):null,this.props.updateListFilter&&(this.props.searchFilter||this.props.installedListFilter)?h(`br`,{}):null,this.props.updateListFilter?h(V,{style:{marginTop:16},variant:`outlined`,onClick:()=>this.props.clearAllFilters(!0),startIcon:h(Ct,{}),children:this.props.context.t(`Remove filter for updatable adapters`)}):null]})})}getTiles(e){if(!this.props.listOfVisibleAdapter)return h(A,{});if(!this.props.listOfVisibleAdapter.length)return this.props.update?null:T(`div`,{style:{width:`100%`,display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`center`,gap:16},children:[this.props.searchFilter||this.props.installedListFilter?h(I,{title:this.props.context.t(`Click to clear all filters`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:h(V,{variant:`outlined`,onClick:()=>this.props.clearAllFilters(),children:this.props.context.t(`all items are filtered out`)})}):null,this.props.updateListFilter?h(V,{variant:`outlined`,onClick:()=>this.props.clearAllFilters(!0),startIcon:h(Ct,{}),children:this.props.context.t(`Remove filter for updatable adapters`)}):null]});let t=[];for(let i=0;i<this.props.listOfVisibleAdapter.length;i++){var n,r;let a=this.props.listOfVisibleAdapter[i],o=(n=this.props.cachedAdapters)==null?void 0:n[a];t.length>50&&!((r=this.props.context.installed[a])!=null&&r.version)||o&&t.push(h(cn,{context:e,adapterName:a,cached:o,commandRunning:this.state.commandRunning,noTranslation:this.state.noTranslation},`adapter-${a}`))}return this.props.listOfVisibleAdapter.length>t.length&&(t.push(h(`div`,{style:{flexBasis:`100%`,height:0}},`newLine`)),t.push(h(`div`,{style:{fontSize:20,margin:20},children:this.props.context.t(`Filter adapters to see others. There is %s more`,this.props.listOfVisibleAdapter.length-t.length)},`more`))),t}shouldShowRepositoryWarning(e,t){return!e&&String(t||``).toLowerCase()!==`nexowatt`}renderTileView(e,t,n){return T(D,{children:[this.shouldShowRepositoryWarning(e,t)?h(j,{sx:{marginX:2,marginTop:1,width:`calc(100% - 32px)`},children:h(ke,{type:`warning`,children:this.props.context.t(`Active repo is "%s"`,t)})}):null,h(`div`,{style:Z.viewModeDiv,children:this.getTiles(n)})]})}renderTableView(t,n,r){return T(ue,{children:[this.shouldShowRepositoryWarning(t,n)?h(j,{sx:{marginX:2,marginTop:1,width:`calc(100% - 32px)`},children:h(ke,{type:`warning`,children:this.props.context.t(`Active repo is "%s"`,n)})}):null,h(je,{style:{...Z.container,...t?Z.containerFullHeight:Z.containerNotFullHeight},children:T(e,{stickyHeader:!0,size:`small`,sx:Z.table,children:[h(Le,{children:T(_e,{children:[h(B,{style:Z.emptyBlock}),h(B,{style:Z.name,children:h(P,{children:this.props.context.t(`Name`)})}),!r.descHidden&&h(B,{style:{...Z.description,width:this.props.descWidth},children:h(P,{children:this.props.context.t(`Description`)})}),h(B,{style:Z.connectionType}),h(B,{style:Z.installed,children:h(P,{children:this.props.context.t(`Installed`)})}),h(B,{style:Z.available,children:h(P,{children:this.props.context.t(`Available`)})}),h(B,{style:Z.license,children:h(P,{children:this.props.context.t(`License`)})}),h(B,{style:{...Z.install,width:this.state.expertMode?dn:178},children:h(P,{children:this.props.context.t(`Install`)})})]})}),h(Se,{children:this.getRows(r)})]})})]})}static getDerivedStateFromProps(e,t){let n=!1;e.descWidth!==t.descWidth&&(console.log(`Render because of descWidth`),n=!0),e.repoName!==t.repoName&&(console.log(`Render because of repoName`),n=!0),!!e.systemConfig!==t.systemConfig&&(console.log(`Render because of systemConfig`),n=!0),e.tableViewMode!==t.tableViewMode&&(console.log(`Render because of tableViewMode`),n=!0),e.oneListView!==t.oneListView&&(console.log(`Render because of oneListView`),n=!0);let r=JSON.stringify(e.categoriesExpanded);r!==t.categoriesExpanded&&(console.log(`Render because of categoriesExpanded`),n=!0);let i=e.cachedAdapters?Object.keys(e.cachedAdapters).length:0;i!==t.cachedAdapters&&(console.log(`Render because of cachedAdapters ${i} <> ${t.cachedAdapters}`),n=!0),e.update!==t.update&&(console.log(`Render because of update`),n=!0),e.sortByName!==t.sortByName&&(console.log(`Render because of sortByName`),n=!0),e.sortPopularFirst!==t.sortPopularFirst&&(console.log(`Render because of sortPopularFirst`),n=!0),e.sortRecentlyUpdated!==t.sortRecentlyUpdated&&(console.log(`Render because of sortRecentlyUpdated`),n=!0),e.sortRecentlyCreated!==t.sortRecentlyCreated&&(console.log(`Render because of sortRecentlyCreated`),n=!0),e.context.expertMode!==t.expertMode&&(console.log(`Render because of expertMode`),n=!0);let a=JSON.stringify(e.listOfVisibleAdapter);return a!==t.listOfVisibleAdapter&&(console.log(`Render because of listOfVisibleAdapter`),n=!0),e.commandRunning!==t.commandRunning&&(console.log(`Render because of commandRunning`),n=!0),e.noTranslation!==t.noTranslation&&(console.log(`Render because of commandRunning`),n=!0),n?{descWidth:e.descWidth,repoName:e.repoName,systemConfig:!!e.systemConfig,tableViewMode:e.tableViewMode,oneListView:e.oneListView,categoriesExpanded:r,cachedAdapters:i,update:e.update,sortByName:e.sortByName,sortPopularFirst:e.sortPopularFirst,sortRecentlyUpdated:e.sortRecentlyUpdated,sortRecentlyCreated:e.sortRecentlyCreated,listOfVisibleAdapter:a,renderCounter:t.renderCounter+1,expertMode:e.context.expertMode,commandRunning:e.commandRunning,noTranslation:e.noTranslation}:null}shouldComponentUpdate(e,t){return this.lastRenderCounter!==t.renderCounter&&(this.lastRenderCounter=t.renderCounter,!0)}render(){var e;return(e=this.props.systemConfig)!=null&&(e=e.common)!=null&&e.activeRepo?this.props.tableViewMode?this.renderTableView(this.props.stableRepo,this.props.repoName,this.props.context):this.renderTileView(this.props.stableRepo,this.props.repoName,this.props.context):h(A,{})}};d();var mn=class extends z{constructor(e){super(e),w(this,`updating`,void 0),w(this,`interval`,null),w(this,`startTimeout`,null),w(this,`textareaRef`,void 0),w(this,`link`,void 0),w(this,`oldVersion`,void 0),this.state={response:null,error:null,starting:!0,upAgain:!1},this.updating=!1,this.textareaRef=Ie.createRef(),this.link=`${window.location.protocol}//${window.location.host}/`}setUpdating(e){this.updating!==e&&(this.updating=e,this.props.onUpdating(e))}async getWebserverParams(){let e=await this.props.socket.getObject(`system.adapter.${this.props.adminInstance}`);return{useHttps:e==null?void 0:e.native.secure,port:e==null?void 0:e.native.port,certPrivateName:e==null?void 0:e.native.certPrivate,certPublicName:e==null?void 0:e.native.certPublic}}async componentDidMount(){let{certPrivateName:e,certPublicName:t,port:n,useHttps:r}=await this.getWebserverParams();this.oldVersion=this.props.currentAdminVersion,await this.props.socket.upgradeAdapterWithWebserver(this.props.host,{version:this.props.version,adapterName:`eos-admin`,port:n,useHttps:r,certPublicName:t,certPrivateName:e}),this.setUpdating(!0),this.interval=setInterval(()=>this.checkStatus(),1e3),this.startTimeout=setTimeout(()=>{this.startTimeout=null,this.setState({starting:!1})},1e4)}componentWillUnmount(){this.interval&&=(clearInterval(this.interval),null),this.startTimeout&&=(clearTimeout(this.startTimeout),null)}async checkVersion(){try{let e=await(await fetch(`./version`)).text();return e&&e.length<20&&e!==this.oldVersion?(this.interval&&=(clearInterval(this.interval),null),this.setState({response:{running:!1,success:!0,stderr:[],stdout:[C.t(`Version updated to %s`,e)]},upAgain:!0,error:null},()=>this.setUpdating(!1)),!0):e===this.oldVersion}catch{return!1}}async checkStatus(){console.log(`Request update status from: ${this.link}`);try{let e=await(await fetch(this.link)).text();if(console.log(`Received status: ${e}`),e.startsWith(`{`)&&e.endsWith(`}`))try{let t=JSON.parse(e);t!=null&&t.stderr&&(t.stderr=t.stderr.filter(e=>e.trim())),t&&!t.running&&t.success&&t.stdout?(t.stdout.push(``),t.stdout.push(`---------------------------------------------------`),t.stdout.push(C.t(`%s was successfully updated to %s`,`eos-admin`,this.props.version))):t!=null&&t.stdout&&(t.stdout.unshift(``),t.stdout.unshift(`---------------------------------------------------`),t.stdout.unshift(C.t(`updating %s to %s...`,`eos-admin`,this.props.version))),this.setState({response:t,error:null},()=>{t&&!t.running?(this.interval&&=(clearInterval(this.interval),null),this.waitForAdapterStart()):t!=null&&t.running&&this.setUpdating(!0),this.textareaRef.current&&setTimeout(()=>this.textareaRef.current&&(this.textareaRef.current.scrollTop=this.textareaRef.current.scrollHeight),100)})}catch(t){console.error(`Cannot parse response: ${t}`),this.setState({error:e},()=>this.setUpdating(!1))}else await this.checkVersion()||console.error(`Response is not JSON: ${e}`)}catch(e){this.state.starting||this.setState({error:e.toString()},()=>this.setUpdating(!1))}}waitForAdapterStart(){this.interval=setInterval(async()=>{try{await fetch(this.link),this.interval&&clearInterval(this.interval),this.interval=null,this.setState({upAgain:!0})}catch{}},1e3)}render(){var e,t,n,r,i,o,s;return T(a,{onClose:(e,t)=>{t!==`escapeKeyDown`&&t!==`backdropClick`&&this.props.onClose()},open:!0,maxWidth:`lg`,fullWidth:!0,children:[h(x,{children:C.t(`Updating %s...`,`eos-admin`)}),T(b,{style:{height:400,padding:`0 20px`,overflow:`hidden`},children:[(!this.state.response||this.state.response.running)&&!this.state.error?h(A,{}):null,this.state.response||this.state.error?h(`textarea`,{ref:this.textareaRef,style:{width:`100%`,height:`100%`,resize:`none`,background:this.props.themeType===`dark`?`#000`:`#fff`,color:this.props.themeType===`dark`?`#EEE`:`#111`,boxSizing:`border-box`,fontFamily:`Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace`,border:(e=this.state.response)!=null&&e.success?`2px solid green`:this.state.error||this.state.response&&!this.state.response.running&&!this.state.response.success?`2px solid red`:void 0},value:this.state.error?this.state.error:(t=this.state.response)!=null&&(t=t.stderr)!=null&&t.length?this.state.response.stderr.join(`
@@ -1 +1 @@
1
- import{Ar as e,Hs as t,Ko as n,Tr as r,po as i,t as a}from"./loadShare-eager-dmdYQhAl.js";import{n as o,t as s}from"./PushPinOutlined-BCUm5DLR.js";import{N as c,P as l}from"./bootstrap-Df_WTIJg.js";var u={root:{display:`block`,position:`relative`,left:0,top:0,width:`100%`,height:`100%`,color:`black`,borderRadius:4,boxShadow:`0px 2px 1px -1px rgb(0 0 0 / 20%), 0px 1px 1px 0px rgb(0 0 0 / 14%), 0px 1px 3px 0px rgb(0 0 0 / 12%)`,border:`0px solid #888`},pinnedIcon:{color:`#ffca28`}},d={backgroundColor:`rgba(255, 255, 255, 0.25)`,"&:hover":{backgroundColor:`rgba(255, 255, 255, 0.35)`}},f=class extends e{constructor(t){super(t);let n=e.getLocation().id||window.localStorage.getItem(`dmSelectedInstance`)||``;this.state={instance:n,pinned:n?c(n):!1,listKey:n}}componentDidMount(){super.componentDidMount(),this.state.instance||this.detectSingleInstance()}async detectSingleInstance(){try{let e=await this.props.socket.getObjectViewSystem(`instance`,`system.adapter.`,`system.adapter.香`),t=Object.keys(e||{}).filter(t=>{var n;return(n=e[t])==null||(n=n.common)==null||(n=n.supportedMessages)==null?void 0:n.deviceManager}).map(e=>e.substring(15)),n=[];for(let e of t){let t=await this.props.socket.getState(`system.adapter.${e}.alive`);t!=null&&t.val&&n.push(e)}n.length===1&&!this.state.instance&&this.setState({instance:n[0],pinned:c(n[0])})}catch(e){console.error(`Cannot read the instances with a device manager: ${e}`)}}onHashChanged(){let t=e.getLocation().id;t&&t!==this.state.instance&&this.setState({instance:t,pinned:c(t),listKey:t})}renderPinButton(){return this.state.instance?t(i,{title:r.t(this.state.pinned?`Remove from navigation`:`Pin to navigation`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:t(n,{color:`inherit`,size:`small`,sx:{mr:1,...this.state.pinned?d:void 0},onClick:()=>{let e=!this.state.pinned;l(this.state.instance,e),this.setState({pinned:e})},children:this.state.pinned?t(o,{style:u.pinnedIcon}):t(s,{})})}):null}render(){return t(`div`,{style:u.root,children:t(a,{socket:this.props.socket,themeType:this.props.themeType,themeName:this.props.themeName,theme:this.props.theme,isFloatComma:this.props.isFloatComma,dateFormat:this.props.dateFormat,title:this.renderPinButton(),instance:this.state.instance,onInstanceChanged:t=>{this.setState({instance:t,pinned:t?c(t):!1}),e.doNavigate(`tab-devicemanager`,`tab`,t)}},this.state.listKey)})}};export{f as default};
1
+ import{Ar as e,Hs as t,Ko as n,Tr as r,po as i,t as a}from"./loadShare-eager-dmdYQhAl.js";import{n as o,t as s}from"./PushPinOutlined-BCUm5DLR.js";import{N as c,P as l}from"./bootstrap-Dllnekqb.js";var u={root:{display:`block`,position:`relative`,left:0,top:0,width:`100%`,height:`100%`,color:`black`,borderRadius:4,boxShadow:`0px 2px 1px -1px rgb(0 0 0 / 20%), 0px 1px 1px 0px rgb(0 0 0 / 14%), 0px 1px 3px 0px rgb(0 0 0 / 12%)`,border:`0px solid #888`},pinnedIcon:{color:`#ffca28`}},d={backgroundColor:`rgba(255, 255, 255, 0.25)`,"&:hover":{backgroundColor:`rgba(255, 255, 255, 0.35)`}},f=class extends e{constructor(t){super(t);let n=e.getLocation().id||window.localStorage.getItem(`dmSelectedInstance`)||``;this.state={instance:n,pinned:n?c(n):!1,listKey:n}}componentDidMount(){super.componentDidMount(),this.state.instance||this.detectSingleInstance()}async detectSingleInstance(){try{let e=await this.props.socket.getObjectViewSystem(`instance`,`system.adapter.`,`system.adapter.香`),t=Object.keys(e||{}).filter(t=>{var n;return(n=e[t])==null||(n=n.common)==null||(n=n.supportedMessages)==null?void 0:n.deviceManager}).map(e=>e.substring(15)),n=[];for(let e of t){let t=await this.props.socket.getState(`system.adapter.${e}.alive`);t!=null&&t.val&&n.push(e)}n.length===1&&!this.state.instance&&this.setState({instance:n[0],pinned:c(n[0])})}catch(e){console.error(`Cannot read the instances with a device manager: ${e}`)}}onHashChanged(){let t=e.getLocation().id;t&&t!==this.state.instance&&this.setState({instance:t,pinned:c(t),listKey:t})}renderPinButton(){return this.state.instance?t(i,{title:r.t(this.state.pinned?`Remove from navigation`:`Pin to navigation`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:t(n,{color:`inherit`,size:`small`,sx:{mr:1,...this.state.pinned?d:void 0},onClick:()=>{let e=!this.state.pinned;l(this.state.instance,e),this.setState({pinned:e})},children:this.state.pinned?t(o,{style:u.pinnedIcon}):t(s,{})})}):null}render(){return t(`div`,{style:u.root,children:t(a,{socket:this.props.socket,themeType:this.props.themeType,themeName:this.props.themeName,theme:this.props.theme,isFloatComma:this.props.isFloatComma,dateFormat:this.props.dateFormat,title:this.renderPinButton(),instance:this.state.instance,onInstanceChanged:t=>{this.setState({instance:t,pinned:t?c(t):!1}),e.doNavigate(`tab-devicemanager`,`tab`,t)}},this.state.listKey)})}};export{f as default};
@@ -1,4 +1,4 @@
1
- import{t as e}from"./rolldown-runtime-sJBDdmOt.js";import{$a as t,Ao as n,Ci as r,Cr as i,Do as a,Dr as o,Eo as s,Er as c,Es as l,Ha as u,Hs as d,Ja as f,Js as p,Ka as m,Ko as h,Kr as g,Lr as _,Mo as v,No as y,Oa as ee,Or as b,Po as x,Qa as S,Qi as C,Qo as w,Rr as te,Sr as T,To as ne,Ts as E,Us as D,Vo as re,Vs as O,Wa as ie,Wo as ae,Wr as k,Xi as oe,Xo as se,Ya as ce,Ys as le,Za as ue,Zi as A,Zs as j,ao as de,ar as M,as as fe,ba as pe,bi as N,bo as P,br as F,cr as me,dc as he,do as ge,ec as _e,eo as ve,fc as ye,ga as be,go as I,io as xe,jo as Se,lo as Ce,mc as we,mo as L,no as Te,ns as Ee,oi as R,os as De,pa as Oe,pc as z,po as B,ps as ke,qs as V,ro as Ae,rs as je,sc as H,so as Me,sr as Ne,ss as Pe,tc as Fe,to as Ie,tr as Le,ts as Re,ua as ze,uc as U,uo as Be,us as Ve,wr as He,xa as Ue,xo as We,xr as Ge,yo as W,yr as Ke,ys as qe}from"./loadShare-eager-dmdYQhAl.js";import{a as Je,i as Ye,n as Xe,o as Ze,r as Qe,s as $e,t as et}from"./ViewSidebar-CjClbCI5.js";import{n as tt,r as nt,t as rt}from"./Pageview-wzrLQZ-j.js";import{n as it,t as at}from"./KeyboardArrowRight-ifvmV1ZL.js";import{t as ot}from"./InfoOutlined-Bggo2-pX.js";import{n as st,t as ct}from"./UnfoldMore-DOHSVdRn.js";import{t as lt}from"./AdminUtils-Dc1eHsx5.js";import{B as ut,H as dt,L as ft,Ot as pt,R as mt,W as ht,xt as gt,z as _t}from"./bootstrap-Df_WTIJg.js";import{n as vt,r as yt,t as bt}from"./Fields-CTOv49EU.js";var xt=e((e=>{var t=60103,n=60106,r=60107,i=60108,a=60114,o=60109,s=60110,c=60112,l=60113,u=60120,d=60115,f=60116;if(typeof Symbol==`function`&&Symbol.for){var p=Symbol.for;t=p(`react.element`),n=p(`react.portal`),r=p(`react.fragment`),i=p(`react.strict_mode`),a=p(`react.profiler`),o=p(`react.provider`),s=p(`react.context`),c=p(`react.forward_ref`),l=p(`react.suspense`),u=p(`react.suspense_list`),d=p(`react.memo`),f=p(`react.lazy`),p(`react.block`),p(`react.server.block`),p(`react.fundamental`),p(`react.debug_trace_mode`),p(`react.legacy_hidden`)}function m(e){if(typeof e==`object`&&e){var p=e.$$typeof;switch(p){case t:switch(e=e.type,e){case r:case a:case i:case l:case u:return e;default:switch(e&&=e.$$typeof,e){case s:case c:case f:case d:case o:return e;default:return p}}case n:return p}}}e.isFragment=function(e){return m(e)===r}})),St=e(((e,t)=>{t.exports=xt()}))();function Ct(e,t){let n=getComputedStyle(t);if(!n)return;let r=e===K.Horizontal?t.clientWidth:t.clientHeight;return r===0?void 0:(e===K.Horizontal?r-=parseFloat(n.paddingLeft)+parseFloat(n.paddingRight):r-=parseFloat(n.paddingTop)+parseFloat(n.paddingBottom),r)}function wt(e,t,n=[],r={condition:!0}){let{condition:i}=r,a=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(r,[`condition`]);H((()=>(i&&window.addEventListener(e,t,a),()=>{i&&window.removeEventListener(e,t)})),[e,t,i,...n])}(function(e,t){t===void 0&&(t={});var n=t.insertAt;if(typeof document<`u`){var r=document.head||document.getElementsByTagName(`head`)[0],i=document.createElement(`style`);i.type=`text/css`,n===`top`&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}})(`/* === Main Container === */
1
+ import{t as e}from"./rolldown-runtime-sJBDdmOt.js";import{$a as t,Ao as n,Ci as r,Cr as i,Do as a,Dr as o,Eo as s,Er as c,Es as l,Ha as u,Hs as d,Ja as f,Js as p,Ka as m,Ko as h,Kr as g,Lr as _,Mo as v,No as y,Oa as ee,Or as b,Po as x,Qa as S,Qi as C,Qo as w,Rr as te,Sr as T,To as ne,Ts as E,Us as D,Vo as re,Vs as O,Wa as ie,Wo as ae,Wr as k,Xi as oe,Xo as se,Ya as ce,Ys as le,Za as ue,Zi as A,Zs as j,ao as de,ar as M,as as fe,ba as pe,bi as N,bo as P,br as F,cr as me,dc as he,do as ge,ec as _e,eo as ve,fc as ye,ga as be,go as I,io as xe,jo as Se,lo as Ce,mc as we,mo as L,no as Te,ns as Ee,oi as R,os as De,pa as Oe,pc as z,po as B,ps as ke,qs as V,ro as Ae,rs as je,sc as H,so as Me,sr as Ne,ss as Pe,tc as Fe,to as Ie,tr as Le,ts as Re,ua as ze,uc as U,uo as Be,us as Ve,wr as He,xa as Ue,xo as We,xr as Ge,yo as W,yr as Ke,ys as qe}from"./loadShare-eager-dmdYQhAl.js";import{a as Je,i as Ye,n as Xe,o as Ze,r as Qe,s as $e,t as et}from"./ViewSidebar-CjClbCI5.js";import{n as tt,r as nt,t as rt}from"./Pageview-wzrLQZ-j.js";import{n as it,t as at}from"./KeyboardArrowRight-ifvmV1ZL.js";import{t as ot}from"./InfoOutlined-Bggo2-pX.js";import{n as st,t as ct}from"./UnfoldMore-DOHSVdRn.js";import{t as lt}from"./AdminUtils-Dc1eHsx5.js";import{B as ut,H as dt,L as ft,Ot as pt,R as mt,W as ht,xt as gt,z as _t}from"./bootstrap-Dllnekqb.js";import{n as vt,r as yt,t as bt}from"./Fields-pcmISvLk.js";var xt=e((e=>{var t=60103,n=60106,r=60107,i=60108,a=60114,o=60109,s=60110,c=60112,l=60113,u=60120,d=60115,f=60116;if(typeof Symbol==`function`&&Symbol.for){var p=Symbol.for;t=p(`react.element`),n=p(`react.portal`),r=p(`react.fragment`),i=p(`react.strict_mode`),a=p(`react.profiler`),o=p(`react.provider`),s=p(`react.context`),c=p(`react.forward_ref`),l=p(`react.suspense`),u=p(`react.suspense_list`),d=p(`react.memo`),f=p(`react.lazy`),p(`react.block`),p(`react.server.block`),p(`react.fundamental`),p(`react.debug_trace_mode`),p(`react.legacy_hidden`)}function m(e){if(typeof e==`object`&&e){var p=e.$$typeof;switch(p){case t:switch(e=e.type,e){case r:case a:case i:case l:case u:return e;default:switch(e&&=e.$$typeof,e){case s:case c:case f:case d:case o:return e;default:return p}}case n:return p}}}e.isFragment=function(e){return m(e)===r}})),St=e(((e,t)=>{t.exports=xt()}))();function Ct(e,t){let n=getComputedStyle(t);if(!n)return;let r=e===K.Horizontal?t.clientWidth:t.clientHeight;return r===0?void 0:(e===K.Horizontal?r-=parseFloat(n.paddingLeft)+parseFloat(n.paddingRight):r-=parseFloat(n.paddingTop)+parseFloat(n.paddingBottom),r)}function wt(e,t,n=[],r={condition:!0}){let{condition:i}=r,a=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(r,[`condition`]);H((()=>(i&&window.addEventListener(e,t,a),()=>{i&&window.removeEventListener(e,t)})),[e,t,i,...n])}(function(e,t){t===void 0&&(t={});var n=t.insertAt;if(typeof document<`u`){var r=document.head||document.getElementsByTagName(`head`)[0],i=document.createElement(`style`);i.type=`text/css`,n===`top`&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}})(`/* === Main Container === */
2
2
  .__dbk__container {
3
3
  height: 100%;
4
4
  width: 100%;
@@ -1 +1 @@
1
- import{Bo as e,Hs as t,Ka as n,Ko as r,Us as i,Xs as a,fc as o,jr as s,lo as c,qo as l}from"./loadShare-eager-dmdYQhAl.js";import{V as u}from"./bootstrap-Df_WTIJg.js";a(void 0);var d=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),f=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),p=e=>{let t=e.getInitialClientOffset(),n=e.getInitialSourceClientOffset();return t===null||n===null?{x:0,y:0}:d(t,n)},m=(e,t)=>{switch(e){case`left`:case`top-start`:case`bottom-start`:return 0;case`right`:case`top-end`:case`bottom-end`:return t.width;default:return t.width/2}},h=(e,t)=>{switch(e){case`top`:case`top-start`:case`top-end`:return 0;case`bottom`:case`bottom-start`:case`bottom-end`:return t.height;default:return t.height/2}},g=(e,t,n=`center`,r={x:0,y:0})=>{let i=e.getClientOffset();if(i===null)return null;if(!t.current||!t.current.getBoundingClientRect)return d(i,p(e));let a=t.current.getBoundingClientRect();return f(d(i,{x:m(n,a),y:h(n,a)}),r)},_=e=>{let t=`translate(${e.x.toFixed(1)}px, ${e.y.toFixed(1)}px)`;return{pointerEvents:`none`,position:`fixed`,top:0,left:0,transform:t,WebkitTransform:t}},v=e=>{let t=o(null),n=u(n=>({currentOffset:g(n,t,e==null?void 0:e.placement,e==null?void 0:e.padding),isDragging:n.isDragging(),itemType:n.getItemType(),item:n.getItem(),monitor:n}));return!n.isDragging||n.currentOffset===null?{display:!1}:{display:!0,itemType:n.itemType,item:n.item,style:_(n.currentOffset),monitor:n.monitor,ref:t}};function y(a){let o=a.icon;return i(`div`,{style:a.styles.formContainer,children:[o?t(o,{style:a.styles.formIcon}):null,t(e,{style:a.styles.formControl,variant:`standard`,children:t(c,{variant:`standard`,label:a.t(a.label),autoComplete:a.autoComplete,error:!!a.error,helperText:a.error||``,value:a.value,onChange:e=>{var t;return(t=a.onChange)==null?void 0:t.call(a,e.target.value)},disabled:a.disabled,type:a.type,slotProps:{inputLabel:{shrink:!0},input:{readOnly:!1,endAdornment:a.value?t(l,{position:`end`,children:t(r,{tabIndex:-1,size:`small`,onClick:()=>{var e;return(e=a.onChange)==null?void 0:e.call(a,``)},children:t(n,{})})}):null}}})})]})}function b(e){let n=e.icon;return i(`div`,{style:{width:`100%`},children:[n?t(n,{style:e.previewStyle||e.styles.formIcon}):null,t(s,{style:{...e.style||void 0,width:n?`calc(100% - 45px)`:`100%`,display:`inline-block`,verticalAlign:`top`},label:e.t(e.label),onChange:e.onChange,value:e.value||``})]})}export{y as n,v as r,b as t};
1
+ import{Bo as e,Hs as t,Ka as n,Ko as r,Us as i,Xs as a,fc as o,jr as s,lo as c,qo as l}from"./loadShare-eager-dmdYQhAl.js";import{V as u}from"./bootstrap-Dllnekqb.js";a(void 0);var d=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),f=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),p=e=>{let t=e.getInitialClientOffset(),n=e.getInitialSourceClientOffset();return t===null||n===null?{x:0,y:0}:d(t,n)},m=(e,t)=>{switch(e){case`left`:case`top-start`:case`bottom-start`:return 0;case`right`:case`top-end`:case`bottom-end`:return t.width;default:return t.width/2}},h=(e,t)=>{switch(e){case`top`:case`top-start`:case`top-end`:return 0;case`bottom`:case`bottom-start`:case`bottom-end`:return t.height;default:return t.height/2}},g=(e,t,n=`center`,r={x:0,y:0})=>{let i=e.getClientOffset();if(i===null)return null;if(!t.current||!t.current.getBoundingClientRect)return d(i,p(e));let a=t.current.getBoundingClientRect();return f(d(i,{x:m(n,a),y:h(n,a)}),r)},_=e=>{let t=`translate(${e.x.toFixed(1)}px, ${e.y.toFixed(1)}px)`;return{pointerEvents:`none`,position:`fixed`,top:0,left:0,transform:t,WebkitTransform:t}},v=e=>{let t=o(null),n=u(n=>({currentOffset:g(n,t,e==null?void 0:e.placement,e==null?void 0:e.padding),isDragging:n.isDragging(),itemType:n.getItemType(),item:n.getItem(),monitor:n}));return!n.isDragging||n.currentOffset===null?{display:!1}:{display:!0,itemType:n.itemType,item:n.item,style:_(n.currentOffset),monitor:n.monitor,ref:t}};function y(a){let o=a.icon;return i(`div`,{style:a.styles.formContainer,children:[o?t(o,{style:a.styles.formIcon}):null,t(e,{style:a.styles.formControl,variant:`standard`,children:t(c,{variant:`standard`,label:a.t(a.label),autoComplete:a.autoComplete,error:!!a.error,helperText:a.error||``,value:a.value,onChange:e=>{var t;return(t=a.onChange)==null?void 0:t.call(a,e.target.value)},disabled:a.disabled,type:a.type,slotProps:{inputLabel:{shrink:!0},input:{readOnly:!1,endAdornment:a.value?t(l,{position:`end`,children:t(r,{tabIndex:-1,size:`small`,onClick:()=>{var e;return(e=a.onChange)==null?void 0:e.call(a,``)},children:t(n,{})})}):null}}})})]})}function b(e){let n=e.icon;return i(`div`,{style:{width:`100%`},children:[n?t(n,{style:e.previewStyle||e.styles.formIcon}):null,t(s,{style:{...e.style||void 0,width:n?`calc(100% - 45px)`:`100%`,display:`inline-block`,verticalAlign:`top`},label:e.t(e.label),onChange:e.onChange,value:e.value||``})]})}export{y as n,v as r,b as t};
@@ -1 +1 @@
1
- import{a as e,t}from"./rolldown-runtime-sJBDdmOt.js";import{Ar as n,Es as r,Hs as i,Lr as a,Nr as o,Rr as s,To as c,Tr as l,Ts as u,Us as d,Xo as f,Za as p,c as m,pc as h,sc as g,tc as _,ur as v,vr as y}from"./loadShare-eager-dmdYQhAl.js";import{t as b}from"./AdminUtils-Dc1eHsx5.js";import{M as x}from"./bootstrap-Df_WTIJg.js";import{t as S}from"./CustomModal-Do2qVZr7.js";var C=t((e=>{e.byteLength=c,e.toByteArray=u,e.fromByteArray=p;for(var t=[],n=[],r=typeof Uint8Array<`u`?Uint8Array:Array,i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,a=0,o=i.length;a<o;++a)t[a]=i[a],n[i.charCodeAt(a)]=a;n[45]=62,n[95]=63;function s(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=s(e),n=t[0],r=t[1];return(n+r)*3/4-r}function l(e,t,n){return(t+n)*3/4-n}function u(e){for(var t,i=s(e),a=i[0],o=i[1],c=new r(l(e,a,o)),u=0,d=o>0?a-4:a,f=0;f<d;f+=4)t=n[e.charCodeAt(f)]<<18|n[e.charCodeAt(f+1)]<<12|n[e.charCodeAt(f+2)]<<6|n[e.charCodeAt(f+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=t&255;return o===2&&(t=n[e.charCodeAt(f)]<<2|n[e.charCodeAt(f+1)]>>4,c[u++]=t&255),o===1&&(t=n[e.charCodeAt(f)]<<10|n[e.charCodeAt(f+1)]<<4|n[e.charCodeAt(f+2)]>>2,c[u++]=t>>8&255,c[u++]=t&255),c}function d(e){return t[e>>18&63]+t[e>>12&63]+t[e>>6&63]+t[e&63]}function f(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(d(r));return i.join(``)}function p(e){for(var n,r=e.length,i=r%3,a=[],o=16383,s=0,c=r-i;s<c;s+=o)a.push(f(e,s,s+o>c?c:s+o));return i===1?(n=e[r-1],a.push(t[n>>2]+t[n<<4&63]+`==`)):i===2&&(n=(e[r-2]<<8)+e[r-1],a.push(t[n>>10]+t[n>>4&63]+t[n<<2&63]+`=`)),a.join(``)}})),w=t((e=>{e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},e.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128}})),T=t((e=>{var t=C(),n=w(),r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=s,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50;var i=2147483647;e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return d(e)}return c(e,t,n)}s.poolSize=8192;function c(e,t,n){if(typeof e==`string`)return f(e,t);if(ArrayBuffer.isView(e))return m(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(Q(e,ArrayBuffer)||e&&Q(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(Q(e,SharedArrayBuffer)||e&&Q(e.buffer,SharedArrayBuffer)))return h(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return s.from(r,t,n);let i=g(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return s.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}s.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function u(e,t,n){return l(e),e<=0||t===void 0?o(e):typeof n==`string`?o(e).fill(t,n):o(e).fill(t)}s.alloc=function(e,t,n){return u(e,t,n)};function d(e){return l(e),o(e<0?0:_(e)|0)}s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)};function f(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!s.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=y(e,t)|0,r=o(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function p(e){let t=e.length<0?0:_(e.length)|0,n=o(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function m(e){if(Q(e,Uint8Array)){let t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return p(e)}function h(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,s.prototype),r}function g(e){if(s.isBuffer(e)){let t=_(e.length)|0,n=o(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||ce(e.length)?o(0):p(e);if(e.type===`Buffer`&&Array.isArray(e.data))return p(e.data)}function _(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function v(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype},s.compare=function(e,t){if(Q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),Q(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},s.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return s.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=s.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(Q(t,Uint8Array))i+t.length>r.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(s.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function y(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Q(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return X(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return se(e).length;default:if(i)return r?-1:X(e).length;t=(``+t).toLowerCase(),i=!0}}s.byteLength=y;function b(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return F(this,t,n);case`utf8`:case`utf-8`:return M(this,t,n);case`ascii`:return te(this,t,n);case`latin1`:case`binary`:return P(this,t,n);case`base64`:return j(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return ne(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}s.prototype._isBuffer=!0;function x(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}s.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)x(this,t,t+1);return this},s.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)x(this,t,t+3),x(this,t+1,t+2);return this},s.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)x(this,t,t+7),x(this,t+1,t+6),x(this,t+2,t+5),x(this,t+3,t+4);return this},s.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?M(this,0,e):b.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e||s.compare(this,e)===0},s.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,i){if(Q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,c=Math.min(a,o),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],o=u[e];break}return a<o?-1:+(o<a)};function S(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,ce(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(i)n=0;else return-1}if(typeof t==`string`&&(t=s.from(t,r)),s.isBuffer(t))return t.length===0?-1:T(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):T(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function T(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},s.prototype.indexOf=function(e,t,n){return S(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return S(this,e,t,n,!1)};function E(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o=0;for(;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(ce(r))return o;e[n+o]=r}return o}function D(e,t,n,r){return Z(X(t,e.length-n),e,n,r)}function O(e,t,n,r){return Z(ae(t),e,n,r)}function k(e,t,n,r){return Z(se(t),e,n,r)}function A(e,t,n,r){return Z(oe(t,e.length-n),e,n,r)}s.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return E(this,e,t,n);case`utf8`:case`utf-8`:return D(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return O(this,e,t,n);case`base64`:return k(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return A(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function j(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function M(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return N(r)}var ee=4096;function N(e){let t=e.length;if(t<=ee)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=ee));return n}function te(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function P(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function F(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=le[e[r]];return i}function ne(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}s.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,s.prototype),r};function I(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||I(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||I(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||I(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=$(function(e){e>>>=0,q(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let r=t+this[++e]*256+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*256+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),s.prototype.readBigUInt64BE=$(function(e){e>>>=0,q(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*256+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*256+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||I(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||I(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||I(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=$(function(e){e>>>=0,q(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let r=this[e+4]+this[e+5]*256+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*256+this[++e]*2**16+this[++e]*2**24)}),s.prototype.readBigInt64BE=$(function(e){e>>>=0,q(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*256+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*256+n)}),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||I(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||I(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||I(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||I(e,8,this.length),n.read(this,e,!1,52,8)};function L(e,t,n,r,i,a){if(!s.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;L(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;L(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,255,0),this[t]=e&255,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function R(e,t,n,r,i){re(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function z(e,t,n,r,i){re(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}s.prototype.writeBigUInt64LE=$(function(e,t=0){return R(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeBigUInt64BE=$(function(e,t=0){return z(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);L(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a|0)-o&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);L(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a|0)-o&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},s.prototype.writeBigInt64LE=$(function(e,t=0){return R(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),s.prototype.writeBigInt64BE=$(function(e,t=0){return z(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function B(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function V(e,t,r,i,a){return t=+t,r>>>=0,a||B(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(e,t,n){return V(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return V(this,e,t,!1,n)};function H(e,t,r,i,a){return t=+t,r>>>=0,a||B(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(e,t,n){return H(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return H(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},s.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!s.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=s.isBuffer(e)?e:s.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};var U={};function W(e,t,n){U[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}W(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),W(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),W(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=G(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=G(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function G(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function K(e,t,n){q(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&J(t,e.length-(n+1))}function re(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new U.ERR_OUT_OF_RANGE(`value`,i,e)}K(r,i,a)}function q(e,t){if(typeof e!=`number`)throw new U.ERR_INVALID_ARG_TYPE(t,`number`,e)}function J(e,t,n){throw Math.floor(e)===e?t<0?new U.ERR_BUFFER_OUT_OF_BOUNDS:new U.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(q(e,n),new U.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}var Y=/[^+/0-9A-Za-z-_]/g;function ie(e){if(e=e.split(`=`)[0],e=e.trim().replace(Y,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function X(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319||o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function ae(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function oe(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function se(e){return t.toByteArray(ie(e))}function Z(e,t,n,r){let i=0;for(;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function Q(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function ce(e){return e!==e}var le=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function $(e){return typeof BigInt>`u`?ue:e}function ue(){throw Error(`BigInt not supported`)}})),E=t(((e,t)=>{ace.define(`ace/ext/modelist`,[`require`,`exports`,`module`],function(e,t,n){var r=[];function i(e){for(var t=c.text,n=e.split(/[\/\\]/).pop(),i=0;i<r.length;i++)if(r[i].supportsFile(n)){t=r[i];break}return t}var a=function(){function e(e,t,n){this.name=e,this.caption=t,this.mode=`ace/mode/`+e,this.extensions=n;var r=/\^/.test(n)?n.replace(/\|(\^)?/g,function(e,t){return`$|`+(t?`^`:`^.*\\.`)})+`$`:`\\.(`+n+`)$`;this.extRe=new RegExp(r,`gi`)}return e.prototype.supportsFile=function(e){return e.match(this.extRe)},e}(),o={ABAP:[`abap`],ABC:[`abc`],ActionScript:[`as`],ADA:[`ada|adb`],Alda:[`alda`],Apache_Conf:[`^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd`],Apex:[`apex|cls|trigger|tgr`],AQL:[`aql`],AsciiDoc:[`asciidoc|adoc`],ASL:[`dsl|asl|asl.json`],Assembly_ARM32:[`s`],Assembly_x86:[`asm|a`],Astro:[`astro`],AutoHotKey:[`ahk`],Basic:[`bas|bak`],BatchFile:[`bat|cmd`],BibTeX:[`bib`],C_Cpp:[`cpp|c|cc|cxx|h|hh|hpp|ino`],C9Search:[`c9search_results`],Cedar:[`cedar`],CedarSchema:[`cedarschema`],Cirru:[`cirru|cr`],Clojure:[`clj|cljs`],Clue:[`clue`],Cobol:[`CBL|COB`],coffee:[`coffee|cf|cson|^Cakefile`],ColdFusion:[`cfm|cfc`],Crystal:[`cr`],CSharp:[`cs`],Csound_Document:[`csd`],Csound_Orchestra:[`orc`],Csound_Score:[`sco`],CSS:[`css`],CSV:[`csv`],Curly:[`curly`],Cuttlefish:[`conf`],D:[`d|di`],Dart:[`dart`],Diff:[`diff|patch`],Django:[`djt|html.djt|dj.html|djhtml`],Dockerfile:[`^Dockerfile`],Dot:[`dot`],Drools:[`drl`],Edifact:[`edi`],Eiffel:[`e|ge`],EJS:[`ejs`],Elixir:[`ex|exs`],Elm:[`elm`],Erlang:[`erl|hrl`],Flix:[`flix`],Forth:[`frt|fs|ldr|fth|4th`],Fortran:[`f|f90`],FSharp:[`fsi|fs|ml|mli|fsx|fsscript`],FSL:[`fsl`],FTL:[`ftl`],Gcode:[`gcode`],GDResource:[`tres|tscn`],GDScript:[`gd`],GDShader:[`gdshader|gdshaderinc`],Gherkin:[`feature`],Gitignore:[`^.gitignore`],Glsl:[`glsl|frag|vert`],Gobstones:[`gbs`],golang:[`go`],GraphQLSchema:[`gql`],GROQ:[`groq`],Groovy:[`groovy`],HAML:[`haml`],Handlebars:[`hbs|handlebars|tpl|mustache`],Haskell:[`hs`],Haskell_Cabal:[`cabal`],haXe:[`hx`],Hjson:[`hjson`],HTML:[`html|htm|xhtml|we|wpy`],HTML_Elixir:[`eex|html.eex`],HTML_Ruby:[`erb|rhtml|html.erb`],INI:[`ini|conf|cfg|prefs`],Io:[`io`],Ion:[`ion`],Jack:[`jack`],Jade:[`jade|pug`],Java:[`java`],JavaScript:[`js|jsm|cjs|mjs`],JEXL:[`jexl`],JSON:[`json`],JSON5:[`json5`],JSONiq:[`jq`],JSP:[`jsp`],JSSM:[`jssm|jssm_state`],JSX:[`jsx`],Julia:[`jl`],Kotlin:[`kt|kts`],LaTeX:[`tex|latex|ltx|bib`],Latte:[`latte`],LESS:[`less`],Liquid:[`liquid`],Lisp:[`lisp`],LiveScript:[`ls`],LogiQL:[`logic|lql`],Logtalk:[`lgt`],LSL:[`lsl`],Lua:[`lua`],LuaPage:[`lp`],Lucene:[`lucene`],Makefile:[`^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make`],Markdown:[`md|markdown`],Mask:[`mask`],MATLAB:[`matlab`],Maze:[`mz`],MediaWiki:[`wiki|mediawiki`],MEL:[`mel`],MIPS:[`s|asm`],MIXAL:[`mixal`],MUSHCode:[`mc|mush`],MySQL:[`mysql`],Mariadb:[`mariadb`],Nasal:[`nas`],Nginx:[`nginx|conf`],Nim:[`nim`],Nix:[`nix`],NSIS:[`nsi|nsh|nsdinc`],Nunjucks:[`nunjucks|nunjs|nj|njk`],ObjectiveC:[`m|mm`],OCaml:[`ml|mli`],Odin:[`odin`],PartiQL:[`partiql|pql`],Pascal:[`pas|p`],Perl:[`pl|pm`],pgSQL:[`pgsql`],PHP:[`php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module`],PHP_Laravel_blade:[`blade.php`],Pig:[`pig`],PLSQL:[`plsql`],Powershell:[`ps1`],Praat:[`praat|praatscript|psc|proc`],Prisma:[`prisma`],Prolog:[`plg|prolog`],Properties:[`properties`],Protobuf:[`proto`],PRQL:[`prql`],Puppet:[`epp|pp`],Python:[`py`],QML:[`qml`],R:[`r`],Raku:[`raku|rakumod|rakutest|p6|pl6|pm6`],Razor:[`cshtml|asp`],RDoc:[`Rd`],Red:[`red|reds`],RHTML:[`Rhtml`],Robot:[`robot|resource`],RST:[`rst`],Ruby:[`rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile`],Rust:[`rs`],SaC:[`sac`],SASS:[`sass`],SCAD:[`scad`],Scala:[`scala|sbt`],Scheme:[`scm|sm|rkt|oak|scheme`],Scrypt:[`scrypt`],SCSS:[`scss`],SH:[`sh|bash|^.bashrc`],SJS:[`sjs`],Slim:[`slim|skim`],Smarty:[`smarty|tpl`],Smithy:[`smithy`],snippets:[`snippets`],Soy_Template:[`soy`],Space:[`space`],SPARQL:[`rq`],SQL:[`sql`],SQLServer:[`sqlserver`],Stylus:[`styl|stylus`],SVG:[`svg`],Swift:[`swift`],Tcl:[`tcl`],Terraform:[`tf`,`tfvars`,`terragrunt`],Tex:[`tex`],Text:[`txt`],Textile:[`textile`],Toml:[`toml`],TSV:[`tsv`],TSX:[`tsx`],Turtle:[`ttl`],Twig:[`twig|swig`],Typescript:[`ts|mts|cts|typescript|str`],Vala:[`vala`],VBScript:[`vbs|vb`],Velocity:[`vm`],Verilog:[`v|vh|sv|svh`],VHDL:[`vhd|vhdl`],Visualforce:[`vfp|component|page`],Vue:[`vue`],Wollok:[`wlk|wpgm|wtest`],XML:[`xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml`],XQuery:[`xq`],YAML:[`yaml|yml`],Zeek:[`zeek|bro`],Zig:[`zig`]},s={ObjectiveC:`Objective-C`,CSharp:`C#`,golang:`Go`,C_Cpp:`C and C++`,Csound_Document:`Csound Document`,Csound_Orchestra:`Csound`,Csound_Score:`Csound Score`,coffee:`CoffeeScript`,HTML_Ruby:`HTML (Ruby)`,HTML_Elixir:`HTML (Elixir)`,FTL:`FreeMarker`,PHP_Laravel_blade:`PHP (Blade Template)`,Perl6:`Perl 6`,AutoHotKey:`AutoHotkey / AutoIt`},c={};for(var l in o){var u=o[l],d=(s[l]||l).replace(/_/g,` `),f=l.toLowerCase(),p=new a(f,d,u[0]);c[f]=p,r.push(p)}t.getModeForPath=i,t.modes=r,t.modesByName=c}),(function(){ace.require([`ace/ext/modelist`],function(n){typeof t==`object`&&typeof e==`object`&&t&&(t.exports=n)})})()})),D=T(),O=e(m(),1);E(),r();var k=O.require?O.require(`ace/ext/modelist`):O.acequire(`ace/ext/modelist`),A=class e extends y{constructor(e){super(e),u(this,`writeFile64`,()=>{let e=this.props.href.split(`/`),t=this.state.editingValue||``;e.splice(0,2);let n=e[0],r=e.splice(1).join(`/`);this.props.socket.writeFile64(n,r,D.Buffer.from(t).toString(`base64`)).then(()=>this.props.onClose()).catch(e=>window.alert(`Cannot write file: ${e}`))}),Object.assign(this.state,{editing:!!this.props.formatEditFile||!1})}static getEditFile(e){switch(e){case`json`:return`json`;case`json5`:return`json5`;case`js`:return`javascript`;case`html`:return`html`;case`txt`:return`html`;default:return k.getModeForPath(`testFile.${e}`).mode.split(`/`).pop()||`text`}}getEditorOrViewer(){return i(x,{mode:e.getEditFile(this.props.formatEditFile),themeType:this.props.themeType,value:this.state.editingValue||this.state.code||this.state.text||void 0,onChange:this.state.editing?e=>this.setState({editingValue:e,changed:!0}):void 0})}onSave(){this.writeFile64()}},j=[{Owner:[{name:`read`,valueNum:1024,title:`read owner`},{name:`write`,valueNum:512,title:`write owner`}]},{Group:[{name:`read`,valueNum:64,title:`read group`},{name:`write`,valueNum:32,title:`write group`}]},{Everyone:[{name:`read`,valueNum:4,title:`read everyone`},{name:`write`,valueNum:2,title:`write everyone`}]}],M=(e,t,n)=>(e|=t&n,e&=t|~n&65535,e),ee=({value:e,setValue:t,t:n,differentValues:r,applyToChildren:a,mask:o,setMask:s,disabled:l})=>{g(()=>{if(a){let t=0;for(let n=0;n<r.length;n++)t|=e^r[n];s(t)}else s(0)},[r,a,s,e]);let u=new Set,f=e;for(let e of j)for(let t of e[Object.keys(e)[0]])f-t.valueNum>=0&&(f-=t.valueNum,u.add(t.valueNum));return i(`div`,{style:{display:`flex`,width:`fit-content`,margin:20,border:`1px solid`,borderLeft:0},children:j.map(r=>{let a=Object.keys(r)[0];return d(`div`,{style:{width:150,height:150,display:`flex`,flexDirection:`column`,alignItems:`center`,borderLeft:`1px solid`},children:[i(`div`,{style:{height:50,display:`flex`,alignItems:`center`,fontSize:18,borderBottom:`1px solid silver`,width:`100%`,justifyContent:`center`},children:n(a)}),i(`div`,{style:{display:`flex`,width:`100%`},children:r[a].map((r,a)=>{let f=u.has(r.valueNum),p=o&r.valueNum;return d(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1,alignItems:`center`,borderRight:a===0?`1px solid`:0},children:[i(`div`,{style:{height:50,borderBottom:`1px solid`,width:`100%`,justifyContent:`center`,display:`flex`,alignItems:`center`,color:`silver`},children:n(r.name)}),i(`div`,{style:{height:50,display:`flex`},children:i(c,{disabled:l,checked:f,color:p?`primary`:`secondary`,indeterminate:!!p,style:p?{opacity:.5}:void 0,onChange:n=>{p&&(o&=~r.valueNum&65535,s(o));let i=e;n.target.checked?i|=r.valueNum:i&=~r.valueNum&65535,t(i)}})})]},r.valueNum)})})]},a)})})};async function N(e,t,n){let r=t[e];if(!r){let i=e.split(`/`),a=i.length,o=i.shift()||null,s=i.join(`/`),c=await n.readDir(o,s);t[e]=[];for(let n=0;n<c.length;n++){let r=c[n],i={id:`${e}/${r.file}`,ext:b.getFileExtension(r.file),folder:r.isDir,name:r.file,size:r.stats&&r.stats.size,modified:r.modifiedAt,acl:r.acl,level:a};t[e].push(i)}r=t[e]}for(let e=0;e<r.length;e++){let i=r[e];i.folder&&await N(i.id,t,n)}}function te(e){let t={};return Object.keys(e).forEach(n=>{t[n]={folder:!0,id:n,level:0,name:n},e[n].forEach(e=>{t[e.id]=e})}),t}async function P(e,t,n,r=``,i=``,a=0){if(typeof n==`string`&&(n=n.split(`/`),a=0,r=n.shift()||``,i=``),!(n.length>=a)){if(t[r+i]){if(n.length-1===a){let o=`${r+i}/${n[a]}`,s=t[r+i].find(e=>e.id===o);s&&s.folder&&await N(r+i,t,e);return}i+=`/${n[a]}`,await P(e,t,n,r,i,a+1)}else{let o=await e.readDir(r||null,i);t[r+i]=[],o.forEach(e=>{let n={id:`${i}/${e.file}`,ext:b.getFileExtension(e.file),folder:e.isDir,name:e.file,size:e.stats&&e.stats.size,modified:e.modifiedAt,acl:e.acl,level:a};t[r+i].push(n)}),await P(e,t,n,r,i,a+1)}}}var F=`different`,ne=({onClose:e,onApply:t,selected:n,applyChangesToObject:r,applyChangesToFile:a,objects:s,t:c,themeType:u,folders:m,socket:_,theme:v})=>{let y=n.substring(0,n.lastIndexOf(`/`))||n,b=(n.split(`/`).length===1?m[`/`].find(({id:e})=>e===n):m[y].find(({id:e})=>e===n))||{},[x,C]=h(null),[w,T]=h(null),[E,D]=h([]),[O,k]=h([]),[A,j]=h(!1),[N,ne]=h(0),[I,L]=h(null),[R,z]=h(!1),[B,V]=h(!1),[H,U]=h([]),[W,G]=h(0),[K,re]=h([]),[q,J]=h(!0),[Y,ie]=h(!1),X=l.getLanguage();return g(()=>{let e=[],t=b.id,n=!1,r=!1,i=null,a=null,o=null,c=[],l=0;P(_,m,t).then(()=>{let u=te(m),d=`${t}/`;Object.keys(u).forEach(f=>{if(f!==`/`&&(f===t||f.startsWith(d))){if(!f.includes(`/`)&&s[f]){var p,m,h,g,_,v,y,b,x;let t=s[f];l++,c.push(t),o===null&&((p=t.acl)==null?void 0:p.file)!==void 0&&(o=t.acl.file),i===null&&((m=t.acl)==null?void 0:m.owner)!==void 0&&(i=t.acl.owner),a===null&&((h=t.acl)==null?void 0:h.ownerGroup)!==void 0&&(a=t.acl.ownerGroup),!R&&i!==((g=t.acl)==null?void 0:g.owner)&&((_=t.acl)==null?void 0:_.owner)!==void 0&&(n=!0),!B&&a!==((v=t.acl)==null?void 0:v.ownerGroup)&&((y=t.acl)==null?void 0:y.ownerGroup)!==void 0&&(r=!0),((b=t.acl)==null?void 0:b.file)!==void 0&&o!==((x=t.acl)==null?void 0:x.file)&&!e.includes(t.acl.file)&&e.push(t.acl.file)}else if(!u[f].folder){var S,C,w,T,E,D;l++;let t=u[f];if(c.push(t),o===null&&t.acl.permissions!==void 0&&(o=t.acl.permissions),i===null&&((S=t.acl)==null?void 0:S.owner)!==void 0){var O;i=(O=t.acl)==null?void 0:O.owner}if(a===null&&((C=t.acl)==null?void 0:C.ownerGroup)!==void 0){var k;a=(k=t.acl)==null?void 0:k.ownerGroup}!R&&i!==((w=t.acl)==null?void 0:w.owner)&&((T=t.acl)==null?void 0:T.owner)!==void 0&&(n=!0),!B&&a!==((E=t.acl)==null?void 0:E.ownerGroup)&&((D=t.acl)==null?void 0:D.ownerGroup)!==void 0&&(r=!0),t.acl.permissions!==void 0&&o!==t.acl.permissions&&!e.includes(t.acl.permissions)&&e.push(t.acl.permissions)}}});let f=[],p=[];Object.keys(s).forEach(e=>{let t=s[e];e.startsWith(`system.group.`)&&(t==null?void 0:t.type)===`group`?p.push(t):e.startsWith(`system.user.`)&&(t==null?void 0:t.type)===`user`&&f.push(t)});let h=s[`system.config`].common.defaultNewAcl;i||=h.owner,a||=h.ownerGroup,o||=h.file,L(o),C(i),T(a),z(n),V(r),D(f),k(p),b!=null&&b.folder&&j(!0),ne(l),U(e),re(c)})},[s,n]),g(()=>{if(A)R&&x!==F&&C(F),B&&w!==F&&T(F);else{if(x&&x===F){var e;C(((e=s[n])==null||(e=e.acl)==null?void 0:e.owner)||null)}if(w&&w===F){var t;T(((t=s[n])==null||(t=t.acl)==null?void 0:t.ownerGroup)||null)}}console.log(`stateOwnerUser ${x}`)},[A,x,w,R,B]),K.length?i(S,{theme:v,titleButtonApply:`apply`,overflowHidden:!0,disableApply:q,progress:Y,onClose:e,onApply:()=>{ie(!0),setTimeout(async()=>{var e;let n=((e=s[`system.config`].common)==null||(e=e.defaultNewAcl)==null?void 0:e.file)||1636;if(A){let e=~W&65535;for(let t=0;t<K.length;t++){let s=K[t],m=!1,h=s,g=s;if(h._id){var i,o,c,l;let t=M(((i=h.acl)==null?void 0:i.file)||n,I??0,e);t!==((o=h.acl)==null?void 0:o.file)&&(h.acl=h.acl||{},h.acl.file=t,m=!0),x!==F&&x!==((c=h.acl)==null?void 0:c.owner)&&(h.acl=h.acl||{},h.acl.owner=x??``,m=!0),w!==F&&w!==((l=h.acl)==null?void 0:l.ownerGroup)&&(h.acl=h.acl||{},h.acl.ownerGroup=w??``,m=!0);try{m&&await r(h)}catch(e){console.error(e)}}else if(g&&!g.folder){var u,d,f,p;let t={},r=M(((u=g.acl)==null?void 0:u.permissions)||n,I??0,e);if(r!==((d=g.acl)==null?void 0:d.permissions)&&(t.permissions=r,m=!0),x!==F&&x!==((f=g.acl)==null?void 0:f.owner)&&(t.owner=x??void 0,m=!0),w!==F&&w!==((p=g.acl)==null?void 0:p.ownerGroup)&&(t.ownerGroup=w??void 0,m=!0),m){let e=g.id.split(`/`),n=e.shift()||``,r=e.join(`/`);try{await a(n,r,t)}catch(e){console.error(e)}}}}}else{let e=b.id.split(`/`),t=e.shift()||``,n=e.join(`/`),i={},o=!1;if(!b.folder){var m,h,g;((m=b.acl)==null?void 0:m.permissions)!==I&&(i.permissions=I??void 0,o=!0),((h=b.acl)==null?void 0:h.owner)!==x&&(i.owner=x??void 0,o=!0),((g=b.acl)==null?void 0:g.ownerGroup)!==w&&(i.ownerGroup=w??void 0,o=!0),o&&await a(t,n,i)}else if(!e.length&&s[b.id]){var _,v,y;let e=s[b.id];((_=e.acl)==null?void 0:_.file)!==I&&(e.acl=e.acl||{},e.acl.file=I??0,o=!0),((v=e.acl)==null?void 0:v.owner)!==x&&(e.acl=e.acl||{},e.acl.owner=x??``,o=!0),((y=e.acl)==null?void 0:y.ownerGroup)!==w&&(e.acl=e.acl||{},e.acl.ownerGroup=w??``,o=!0),o&&await r(e)}}ie(!1),t()},200)},children:d(`div`,{style:{display:`flex`,flexDirection:`column`},children:[i(`div`,{style:{margin:10,fontSize:20},children:c(`Access control list: %s`,n)}),d(`div`,{style:{display:`flex`},children:[i(o,{fullWidth:!0,style:{marginRight:10},label:c(`Owner user`),lang:X,list:E,t:c,disabled:Y,value:x||void 0,themeType:u,different:R?F:!1,onChange:e=>{z(!1),C(e),J(!1)}}),i(o,{fullWidth:!0,label:c(`Owner group`),lang:X,list:O,t:c,disabled:Y,value:w||void 0,themeType:u,different:B?F:!1,onChange:e=>{V(!1),T(e),J(!1)}})]}),d(`div`,{style:{display:`flex`,margin:10,alignItems:`center`,fontSize:10,marginLeft:0,color:`silver`},children:[i(`div`,{style:!b.folder||!A?{color:`green`}:void 0,children:c(`to apply one item`)}),i(p,{disabled:K.length===1||Y,checked:!s[b.id]&&!!b.folder||A,onChange:e=>{j(e.target.checked),J(!1)},color:`primary`}),d(`div`,{style:b.folder||A?{color:`green`}:void 0,children:[c(`to apply with children`),` `,b.folder||N>1?`(${N} ${c(`object(s)`)})`:``]})]}),Y&&i(f,{}),i(`div`,{style:{overflowY:`auto`},children:d(`div`,{children:[i(`h2`,{children:c(`File rights`)}),i(ee,{disabled:Y,mask:W,setMask:G,applyToChildren:A,differentValues:H,t:c,setValue:e=>{L(e),J(!1)},value:I??0})]})})]})}):i(f,{})};r();var I=[`select`,`view`],L=class e extends _{constructor(e){super(e),u(this,`t`,void 0),u(this,`wordCache`,void 0),u(this,`objects`,void 0),u(this,`navigateTo`,null),u(this,`translate`,(e,t,n)=>t===void 0?(this.wordCache[e]||(this.wordCache[e]=this.props.t(e)),this.wordCache[e]):this.props.t(e,t,n)),this.t=this.translate,this.wordCache={},this.objects={}}componentDidMount(){this.props.socket.getObjects(!0,!0).then(e=>this.objects=e)}static isAppDialogOpen(){let e=n.getLocation().dialog;return!!e&&!I.includes(e)}renderAclDialog(e){return i(ne,{theme:this.props.theme,themeType:this.props.themeType,applyChangesToObject:async t=>{let n=await this.props.socket.getObject(t._id);n.acl=t.acl,await this.props.socket.setObject(n._id,n);let r=n;r!=null&&r.acl&&e.updateItemsAcl([{id:r._id,acl:r.acl,level:0,name:r._id,folder:!1}])},applyChangesToFile:async(t,n,r)=>{let i=r||{},a;if((i.owner||i.ownerGroup)&&i.permissions?(await this.props.socket.chownFile(t,n,{owner:i.owner,ownerGroup:i.ownerGroup}),a=await this.props.socket.chmodFile(t,n,{mode:i.permissions})):i.permissions?a=await this.props.socket.chmodFile(t,n,{mode:i.permissions}):(i.owner||i.ownerGroup)&&(a=await this.props.socket.chownFile(t,n,{owner:i.owner,ownerGroup:i.ownerGroup})),Array.isArray(a))for(let n=0;n<a.length;n++){let r=a[n];r&&r.file&&r.acl&&e.updateItemsAcl([{id:`${t}/${r.path?`${r.path}/`:``}${r.file}`,acl:r.acl,level:0,name:``,folder:!1}])}},selected:e.state.selected,folders:e.state.folders,objects:this.objects,socket:this.props.socket,t:this.t,onClose:()=>e.setState({modalEditOfAccess:!1}),onApply:()=>e.setState({modalEditOfAccess:!1})})}render(){if(!this.props.ready)return i(f,{});if(!e.isAppDialogOpen()){let e=n.getLocation();this.navigateTo=e.tab===`tab-files`&&e.id?{mode:e.dialog===`view`?`view`:`select`,id:e.id}:null}let t=this.navigateTo;return i(a,{children:i(s,{overflow:`auto`,children:i(v,{navigateTo:t,onNavigateTo:t=>{e.isAppDialogOpen()||(t!=null&&t.id?n.doNavigate(`tab-files`,t.mode,t.id):n.doNavigate(`tab-files`))},showViewTypeButton:!0,ready:this.props.ready,socket:this.props.socket,themeType:this.props.themeType,theme:this.props.theme,lang:this.props.lang,t:this.props.t,showToolbar:!0,allowUpload:!0,allowView:!0,allowDownload:!0,allowCreateFolder:!0,allowDelete:!0,expertMode:this.props.expertMode,modalEditOfAccessControl:e=>this.renderAclDialog(e),FileViewer:A})})})}};export{L as default};
1
+ import{a as e,t}from"./rolldown-runtime-sJBDdmOt.js";import{Ar as n,Es as r,Hs as i,Lr as a,Nr as o,Rr as s,To as c,Tr as l,Ts as u,Us as d,Xo as f,Za as p,c as m,pc as h,sc as g,tc as _,ur as v,vr as y}from"./loadShare-eager-dmdYQhAl.js";import{t as b}from"./AdminUtils-Dc1eHsx5.js";import{M as x}from"./bootstrap-Dllnekqb.js";import{t as S}from"./CustomModal-Do2qVZr7.js";var C=t((e=>{e.byteLength=c,e.toByteArray=u,e.fromByteArray=p;for(var t=[],n=[],r=typeof Uint8Array<`u`?Uint8Array:Array,i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,a=0,o=i.length;a<o;++a)t[a]=i[a],n[i.charCodeAt(a)]=a;n[45]=62,n[95]=63;function s(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=s(e),n=t[0],r=t[1];return(n+r)*3/4-r}function l(e,t,n){return(t+n)*3/4-n}function u(e){for(var t,i=s(e),a=i[0],o=i[1],c=new r(l(e,a,o)),u=0,d=o>0?a-4:a,f=0;f<d;f+=4)t=n[e.charCodeAt(f)]<<18|n[e.charCodeAt(f+1)]<<12|n[e.charCodeAt(f+2)]<<6|n[e.charCodeAt(f+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=t&255;return o===2&&(t=n[e.charCodeAt(f)]<<2|n[e.charCodeAt(f+1)]>>4,c[u++]=t&255),o===1&&(t=n[e.charCodeAt(f)]<<10|n[e.charCodeAt(f+1)]<<4|n[e.charCodeAt(f+2)]>>2,c[u++]=t>>8&255,c[u++]=t&255),c}function d(e){return t[e>>18&63]+t[e>>12&63]+t[e>>6&63]+t[e&63]}function f(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(d(r));return i.join(``)}function p(e){for(var n,r=e.length,i=r%3,a=[],o=16383,s=0,c=r-i;s<c;s+=o)a.push(f(e,s,s+o>c?c:s+o));return i===1?(n=e[r-1],a.push(t[n>>2]+t[n<<4&63]+`==`)):i===2&&(n=(e[r-2]<<8)+e[r-1],a.push(t[n>>10]+t[n>>4&63]+t[n<<2&63]+`=`)),a.join(``)}})),w=t((e=>{e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},e.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128}})),T=t((e=>{var t=C(),n=w(),r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=s,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50;var i=2147483647;e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return d(e)}return c(e,t,n)}s.poolSize=8192;function c(e,t,n){if(typeof e==`string`)return f(e,t);if(ArrayBuffer.isView(e))return m(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(Q(e,ArrayBuffer)||e&&Q(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(Q(e,SharedArrayBuffer)||e&&Q(e.buffer,SharedArrayBuffer)))return h(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return s.from(r,t,n);let i=g(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return s.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}s.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function u(e,t,n){return l(e),e<=0||t===void 0?o(e):typeof n==`string`?o(e).fill(t,n):o(e).fill(t)}s.alloc=function(e,t,n){return u(e,t,n)};function d(e){return l(e),o(e<0?0:_(e)|0)}s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)};function f(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!s.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=y(e,t)|0,r=o(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function p(e){let t=e.length<0?0:_(e.length)|0,n=o(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function m(e){if(Q(e,Uint8Array)){let t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return p(e)}function h(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,s.prototype),r}function g(e){if(s.isBuffer(e)){let t=_(e.length)|0,n=o(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||ce(e.length)?o(0):p(e);if(e.type===`Buffer`&&Array.isArray(e.data))return p(e.data)}function _(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function v(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype},s.compare=function(e,t){if(Q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),Q(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},s.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return s.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=s.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(Q(t,Uint8Array))i+t.length>r.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(s.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function y(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Q(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return X(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return se(e).length;default:if(i)return r?-1:X(e).length;t=(``+t).toLowerCase(),i=!0}}s.byteLength=y;function b(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return F(this,t,n);case`utf8`:case`utf-8`:return M(this,t,n);case`ascii`:return te(this,t,n);case`latin1`:case`binary`:return P(this,t,n);case`base64`:return j(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return ne(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}s.prototype._isBuffer=!0;function x(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}s.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)x(this,t,t+1);return this},s.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)x(this,t,t+3),x(this,t+1,t+2);return this},s.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)x(this,t,t+7),x(this,t+1,t+6),x(this,t+2,t+5),x(this,t+3,t+4);return this},s.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?M(this,0,e):b.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e||s.compare(this,e)===0},s.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,i){if(Q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,c=Math.min(a,o),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],o=u[e];break}return a<o?-1:+(o<a)};function S(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,ce(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(i)n=0;else return-1}if(typeof t==`string`&&(t=s.from(t,r)),s.isBuffer(t))return t.length===0?-1:T(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):T(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function T(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},s.prototype.indexOf=function(e,t,n){return S(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return S(this,e,t,n,!1)};function E(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o=0;for(;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(ce(r))return o;e[n+o]=r}return o}function D(e,t,n,r){return Z(X(t,e.length-n),e,n,r)}function O(e,t,n,r){return Z(ae(t),e,n,r)}function k(e,t,n,r){return Z(se(t),e,n,r)}function A(e,t,n,r){return Z(oe(t,e.length-n),e,n,r)}s.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return E(this,e,t,n);case`utf8`:case`utf-8`:return D(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return O(this,e,t,n);case`base64`:return k(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return A(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function j(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function M(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return N(r)}var ee=4096;function N(e){let t=e.length;if(t<=ee)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=ee));return n}function te(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function P(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function F(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=le[e[r]];return i}function ne(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}s.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,s.prototype),r};function I(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||I(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||I(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||I(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=$(function(e){e>>>=0,q(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let r=t+this[++e]*256+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*256+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),s.prototype.readBigUInt64BE=$(function(e){e>>>=0,q(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*256+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*256+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||I(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||I(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||I(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=$(function(e){e>>>=0,q(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let r=this[e+4]+this[e+5]*256+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*256+this[++e]*2**16+this[++e]*2**24)}),s.prototype.readBigInt64BE=$(function(e){e>>>=0,q(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*256+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*256+n)}),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||I(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||I(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||I(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||I(e,8,this.length),n.read(this,e,!1,52,8)};function L(e,t,n,r,i,a){if(!s.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;L(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;L(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,255,0),this[t]=e&255,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function R(e,t,n,r,i){re(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function z(e,t,n,r,i){re(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}s.prototype.writeBigUInt64LE=$(function(e,t=0){return R(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeBigUInt64BE=$(function(e,t=0){return z(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);L(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a|0)-o&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);L(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a|0)-o&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},s.prototype.writeBigInt64LE=$(function(e,t=0){return R(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),s.prototype.writeBigInt64BE=$(function(e,t=0){return z(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function B(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function V(e,t,r,i,a){return t=+t,r>>>=0,a||B(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(e,t,n){return V(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return V(this,e,t,!1,n)};function H(e,t,r,i,a){return t=+t,r>>>=0,a||B(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(e,t,n){return H(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return H(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},s.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!s.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=s.isBuffer(e)?e:s.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};var U={};function W(e,t,n){U[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}W(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),W(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),W(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=G(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=G(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function G(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function K(e,t,n){q(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&J(t,e.length-(n+1))}function re(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new U.ERR_OUT_OF_RANGE(`value`,i,e)}K(r,i,a)}function q(e,t){if(typeof e!=`number`)throw new U.ERR_INVALID_ARG_TYPE(t,`number`,e)}function J(e,t,n){throw Math.floor(e)===e?t<0?new U.ERR_BUFFER_OUT_OF_BOUNDS:new U.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(q(e,n),new U.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}var Y=/[^+/0-9A-Za-z-_]/g;function ie(e){if(e=e.split(`=`)[0],e=e.trim().replace(Y,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function X(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319||o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function ae(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function oe(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function se(e){return t.toByteArray(ie(e))}function Z(e,t,n,r){let i=0;for(;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function Q(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function ce(e){return e!==e}var le=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function $(e){return typeof BigInt>`u`?ue:e}function ue(){throw Error(`BigInt not supported`)}})),E=t(((e,t)=>{ace.define(`ace/ext/modelist`,[`require`,`exports`,`module`],function(e,t,n){var r=[];function i(e){for(var t=c.text,n=e.split(/[\/\\]/).pop(),i=0;i<r.length;i++)if(r[i].supportsFile(n)){t=r[i];break}return t}var a=function(){function e(e,t,n){this.name=e,this.caption=t,this.mode=`ace/mode/`+e,this.extensions=n;var r=/\^/.test(n)?n.replace(/\|(\^)?/g,function(e,t){return`$|`+(t?`^`:`^.*\\.`)})+`$`:`\\.(`+n+`)$`;this.extRe=new RegExp(r,`gi`)}return e.prototype.supportsFile=function(e){return e.match(this.extRe)},e}(),o={ABAP:[`abap`],ABC:[`abc`],ActionScript:[`as`],ADA:[`ada|adb`],Alda:[`alda`],Apache_Conf:[`^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd`],Apex:[`apex|cls|trigger|tgr`],AQL:[`aql`],AsciiDoc:[`asciidoc|adoc`],ASL:[`dsl|asl|asl.json`],Assembly_ARM32:[`s`],Assembly_x86:[`asm|a`],Astro:[`astro`],AutoHotKey:[`ahk`],Basic:[`bas|bak`],BatchFile:[`bat|cmd`],BibTeX:[`bib`],C_Cpp:[`cpp|c|cc|cxx|h|hh|hpp|ino`],C9Search:[`c9search_results`],Cedar:[`cedar`],CedarSchema:[`cedarschema`],Cirru:[`cirru|cr`],Clojure:[`clj|cljs`],Clue:[`clue`],Cobol:[`CBL|COB`],coffee:[`coffee|cf|cson|^Cakefile`],ColdFusion:[`cfm|cfc`],Crystal:[`cr`],CSharp:[`cs`],Csound_Document:[`csd`],Csound_Orchestra:[`orc`],Csound_Score:[`sco`],CSS:[`css`],CSV:[`csv`],Curly:[`curly`],Cuttlefish:[`conf`],D:[`d|di`],Dart:[`dart`],Diff:[`diff|patch`],Django:[`djt|html.djt|dj.html|djhtml`],Dockerfile:[`^Dockerfile`],Dot:[`dot`],Drools:[`drl`],Edifact:[`edi`],Eiffel:[`e|ge`],EJS:[`ejs`],Elixir:[`ex|exs`],Elm:[`elm`],Erlang:[`erl|hrl`],Flix:[`flix`],Forth:[`frt|fs|ldr|fth|4th`],Fortran:[`f|f90`],FSharp:[`fsi|fs|ml|mli|fsx|fsscript`],FSL:[`fsl`],FTL:[`ftl`],Gcode:[`gcode`],GDResource:[`tres|tscn`],GDScript:[`gd`],GDShader:[`gdshader|gdshaderinc`],Gherkin:[`feature`],Gitignore:[`^.gitignore`],Glsl:[`glsl|frag|vert`],Gobstones:[`gbs`],golang:[`go`],GraphQLSchema:[`gql`],GROQ:[`groq`],Groovy:[`groovy`],HAML:[`haml`],Handlebars:[`hbs|handlebars|tpl|mustache`],Haskell:[`hs`],Haskell_Cabal:[`cabal`],haXe:[`hx`],Hjson:[`hjson`],HTML:[`html|htm|xhtml|we|wpy`],HTML_Elixir:[`eex|html.eex`],HTML_Ruby:[`erb|rhtml|html.erb`],INI:[`ini|conf|cfg|prefs`],Io:[`io`],Ion:[`ion`],Jack:[`jack`],Jade:[`jade|pug`],Java:[`java`],JavaScript:[`js|jsm|cjs|mjs`],JEXL:[`jexl`],JSON:[`json`],JSON5:[`json5`],JSONiq:[`jq`],JSP:[`jsp`],JSSM:[`jssm|jssm_state`],JSX:[`jsx`],Julia:[`jl`],Kotlin:[`kt|kts`],LaTeX:[`tex|latex|ltx|bib`],Latte:[`latte`],LESS:[`less`],Liquid:[`liquid`],Lisp:[`lisp`],LiveScript:[`ls`],LogiQL:[`logic|lql`],Logtalk:[`lgt`],LSL:[`lsl`],Lua:[`lua`],LuaPage:[`lp`],Lucene:[`lucene`],Makefile:[`^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make`],Markdown:[`md|markdown`],Mask:[`mask`],MATLAB:[`matlab`],Maze:[`mz`],MediaWiki:[`wiki|mediawiki`],MEL:[`mel`],MIPS:[`s|asm`],MIXAL:[`mixal`],MUSHCode:[`mc|mush`],MySQL:[`mysql`],Mariadb:[`mariadb`],Nasal:[`nas`],Nginx:[`nginx|conf`],Nim:[`nim`],Nix:[`nix`],NSIS:[`nsi|nsh|nsdinc`],Nunjucks:[`nunjucks|nunjs|nj|njk`],ObjectiveC:[`m|mm`],OCaml:[`ml|mli`],Odin:[`odin`],PartiQL:[`partiql|pql`],Pascal:[`pas|p`],Perl:[`pl|pm`],pgSQL:[`pgsql`],PHP:[`php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module`],PHP_Laravel_blade:[`blade.php`],Pig:[`pig`],PLSQL:[`plsql`],Powershell:[`ps1`],Praat:[`praat|praatscript|psc|proc`],Prisma:[`prisma`],Prolog:[`plg|prolog`],Properties:[`properties`],Protobuf:[`proto`],PRQL:[`prql`],Puppet:[`epp|pp`],Python:[`py`],QML:[`qml`],R:[`r`],Raku:[`raku|rakumod|rakutest|p6|pl6|pm6`],Razor:[`cshtml|asp`],RDoc:[`Rd`],Red:[`red|reds`],RHTML:[`Rhtml`],Robot:[`robot|resource`],RST:[`rst`],Ruby:[`rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile`],Rust:[`rs`],SaC:[`sac`],SASS:[`sass`],SCAD:[`scad`],Scala:[`scala|sbt`],Scheme:[`scm|sm|rkt|oak|scheme`],Scrypt:[`scrypt`],SCSS:[`scss`],SH:[`sh|bash|^.bashrc`],SJS:[`sjs`],Slim:[`slim|skim`],Smarty:[`smarty|tpl`],Smithy:[`smithy`],snippets:[`snippets`],Soy_Template:[`soy`],Space:[`space`],SPARQL:[`rq`],SQL:[`sql`],SQLServer:[`sqlserver`],Stylus:[`styl|stylus`],SVG:[`svg`],Swift:[`swift`],Tcl:[`tcl`],Terraform:[`tf`,`tfvars`,`terragrunt`],Tex:[`tex`],Text:[`txt`],Textile:[`textile`],Toml:[`toml`],TSV:[`tsv`],TSX:[`tsx`],Turtle:[`ttl`],Twig:[`twig|swig`],Typescript:[`ts|mts|cts|typescript|str`],Vala:[`vala`],VBScript:[`vbs|vb`],Velocity:[`vm`],Verilog:[`v|vh|sv|svh`],VHDL:[`vhd|vhdl`],Visualforce:[`vfp|component|page`],Vue:[`vue`],Wollok:[`wlk|wpgm|wtest`],XML:[`xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml`],XQuery:[`xq`],YAML:[`yaml|yml`],Zeek:[`zeek|bro`],Zig:[`zig`]},s={ObjectiveC:`Objective-C`,CSharp:`C#`,golang:`Go`,C_Cpp:`C and C++`,Csound_Document:`Csound Document`,Csound_Orchestra:`Csound`,Csound_Score:`Csound Score`,coffee:`CoffeeScript`,HTML_Ruby:`HTML (Ruby)`,HTML_Elixir:`HTML (Elixir)`,FTL:`FreeMarker`,PHP_Laravel_blade:`PHP (Blade Template)`,Perl6:`Perl 6`,AutoHotKey:`AutoHotkey / AutoIt`},c={};for(var l in o){var u=o[l],d=(s[l]||l).replace(/_/g,` `),f=l.toLowerCase(),p=new a(f,d,u[0]);c[f]=p,r.push(p)}t.getModeForPath=i,t.modes=r,t.modesByName=c}),(function(){ace.require([`ace/ext/modelist`],function(n){typeof t==`object`&&typeof e==`object`&&t&&(t.exports=n)})})()})),D=T(),O=e(m(),1);E(),r();var k=O.require?O.require(`ace/ext/modelist`):O.acequire(`ace/ext/modelist`),A=class e extends y{constructor(e){super(e),u(this,`writeFile64`,()=>{let e=this.props.href.split(`/`),t=this.state.editingValue||``;e.splice(0,2);let n=e[0],r=e.splice(1).join(`/`);this.props.socket.writeFile64(n,r,D.Buffer.from(t).toString(`base64`)).then(()=>this.props.onClose()).catch(e=>window.alert(`Cannot write file: ${e}`))}),Object.assign(this.state,{editing:!!this.props.formatEditFile||!1})}static getEditFile(e){switch(e){case`json`:return`json`;case`json5`:return`json5`;case`js`:return`javascript`;case`html`:return`html`;case`txt`:return`html`;default:return k.getModeForPath(`testFile.${e}`).mode.split(`/`).pop()||`text`}}getEditorOrViewer(){return i(x,{mode:e.getEditFile(this.props.formatEditFile),themeType:this.props.themeType,value:this.state.editingValue||this.state.code||this.state.text||void 0,onChange:this.state.editing?e=>this.setState({editingValue:e,changed:!0}):void 0})}onSave(){this.writeFile64()}},j=[{Owner:[{name:`read`,valueNum:1024,title:`read owner`},{name:`write`,valueNum:512,title:`write owner`}]},{Group:[{name:`read`,valueNum:64,title:`read group`},{name:`write`,valueNum:32,title:`write group`}]},{Everyone:[{name:`read`,valueNum:4,title:`read everyone`},{name:`write`,valueNum:2,title:`write everyone`}]}],M=(e,t,n)=>(e|=t&n,e&=t|~n&65535,e),ee=({value:e,setValue:t,t:n,differentValues:r,applyToChildren:a,mask:o,setMask:s,disabled:l})=>{g(()=>{if(a){let t=0;for(let n=0;n<r.length;n++)t|=e^r[n];s(t)}else s(0)},[r,a,s,e]);let u=new Set,f=e;for(let e of j)for(let t of e[Object.keys(e)[0]])f-t.valueNum>=0&&(f-=t.valueNum,u.add(t.valueNum));return i(`div`,{style:{display:`flex`,width:`fit-content`,margin:20,border:`1px solid`,borderLeft:0},children:j.map(r=>{let a=Object.keys(r)[0];return d(`div`,{style:{width:150,height:150,display:`flex`,flexDirection:`column`,alignItems:`center`,borderLeft:`1px solid`},children:[i(`div`,{style:{height:50,display:`flex`,alignItems:`center`,fontSize:18,borderBottom:`1px solid silver`,width:`100%`,justifyContent:`center`},children:n(a)}),i(`div`,{style:{display:`flex`,width:`100%`},children:r[a].map((r,a)=>{let f=u.has(r.valueNum),p=o&r.valueNum;return d(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1,alignItems:`center`,borderRight:a===0?`1px solid`:0},children:[i(`div`,{style:{height:50,borderBottom:`1px solid`,width:`100%`,justifyContent:`center`,display:`flex`,alignItems:`center`,color:`silver`},children:n(r.name)}),i(`div`,{style:{height:50,display:`flex`},children:i(c,{disabled:l,checked:f,color:p?`primary`:`secondary`,indeterminate:!!p,style:p?{opacity:.5}:void 0,onChange:n=>{p&&(o&=~r.valueNum&65535,s(o));let i=e;n.target.checked?i|=r.valueNum:i&=~r.valueNum&65535,t(i)}})})]},r.valueNum)})})]},a)})})};async function N(e,t,n){let r=t[e];if(!r){let i=e.split(`/`),a=i.length,o=i.shift()||null,s=i.join(`/`),c=await n.readDir(o,s);t[e]=[];for(let n=0;n<c.length;n++){let r=c[n],i={id:`${e}/${r.file}`,ext:b.getFileExtension(r.file),folder:r.isDir,name:r.file,size:r.stats&&r.stats.size,modified:r.modifiedAt,acl:r.acl,level:a};t[e].push(i)}r=t[e]}for(let e=0;e<r.length;e++){let i=r[e];i.folder&&await N(i.id,t,n)}}function te(e){let t={};return Object.keys(e).forEach(n=>{t[n]={folder:!0,id:n,level:0,name:n},e[n].forEach(e=>{t[e.id]=e})}),t}async function P(e,t,n,r=``,i=``,a=0){if(typeof n==`string`&&(n=n.split(`/`),a=0,r=n.shift()||``,i=``),!(n.length>=a)){if(t[r+i]){if(n.length-1===a){let o=`${r+i}/${n[a]}`,s=t[r+i].find(e=>e.id===o);s&&s.folder&&await N(r+i,t,e);return}i+=`/${n[a]}`,await P(e,t,n,r,i,a+1)}else{let o=await e.readDir(r||null,i);t[r+i]=[],o.forEach(e=>{let n={id:`${i}/${e.file}`,ext:b.getFileExtension(e.file),folder:e.isDir,name:e.file,size:e.stats&&e.stats.size,modified:e.modifiedAt,acl:e.acl,level:a};t[r+i].push(n)}),await P(e,t,n,r,i,a+1)}}}var F=`different`,ne=({onClose:e,onApply:t,selected:n,applyChangesToObject:r,applyChangesToFile:a,objects:s,t:c,themeType:u,folders:m,socket:_,theme:v})=>{let y=n.substring(0,n.lastIndexOf(`/`))||n,b=(n.split(`/`).length===1?m[`/`].find(({id:e})=>e===n):m[y].find(({id:e})=>e===n))||{},[x,C]=h(null),[w,T]=h(null),[E,D]=h([]),[O,k]=h([]),[A,j]=h(!1),[N,ne]=h(0),[I,L]=h(null),[R,z]=h(!1),[B,V]=h(!1),[H,U]=h([]),[W,G]=h(0),[K,re]=h([]),[q,J]=h(!0),[Y,ie]=h(!1),X=l.getLanguage();return g(()=>{let e=[],t=b.id,n=!1,r=!1,i=null,a=null,o=null,c=[],l=0;P(_,m,t).then(()=>{let u=te(m),d=`${t}/`;Object.keys(u).forEach(f=>{if(f!==`/`&&(f===t||f.startsWith(d))){if(!f.includes(`/`)&&s[f]){var p,m,h,g,_,v,y,b,x;let t=s[f];l++,c.push(t),o===null&&((p=t.acl)==null?void 0:p.file)!==void 0&&(o=t.acl.file),i===null&&((m=t.acl)==null?void 0:m.owner)!==void 0&&(i=t.acl.owner),a===null&&((h=t.acl)==null?void 0:h.ownerGroup)!==void 0&&(a=t.acl.ownerGroup),!R&&i!==((g=t.acl)==null?void 0:g.owner)&&((_=t.acl)==null?void 0:_.owner)!==void 0&&(n=!0),!B&&a!==((v=t.acl)==null?void 0:v.ownerGroup)&&((y=t.acl)==null?void 0:y.ownerGroup)!==void 0&&(r=!0),((b=t.acl)==null?void 0:b.file)!==void 0&&o!==((x=t.acl)==null?void 0:x.file)&&!e.includes(t.acl.file)&&e.push(t.acl.file)}else if(!u[f].folder){var S,C,w,T,E,D;l++;let t=u[f];if(c.push(t),o===null&&t.acl.permissions!==void 0&&(o=t.acl.permissions),i===null&&((S=t.acl)==null?void 0:S.owner)!==void 0){var O;i=(O=t.acl)==null?void 0:O.owner}if(a===null&&((C=t.acl)==null?void 0:C.ownerGroup)!==void 0){var k;a=(k=t.acl)==null?void 0:k.ownerGroup}!R&&i!==((w=t.acl)==null?void 0:w.owner)&&((T=t.acl)==null?void 0:T.owner)!==void 0&&(n=!0),!B&&a!==((E=t.acl)==null?void 0:E.ownerGroup)&&((D=t.acl)==null?void 0:D.ownerGroup)!==void 0&&(r=!0),t.acl.permissions!==void 0&&o!==t.acl.permissions&&!e.includes(t.acl.permissions)&&e.push(t.acl.permissions)}}});let f=[],p=[];Object.keys(s).forEach(e=>{let t=s[e];e.startsWith(`system.group.`)&&(t==null?void 0:t.type)===`group`?p.push(t):e.startsWith(`system.user.`)&&(t==null?void 0:t.type)===`user`&&f.push(t)});let h=s[`system.config`].common.defaultNewAcl;i||=h.owner,a||=h.ownerGroup,o||=h.file,L(o),C(i),T(a),z(n),V(r),D(f),k(p),b!=null&&b.folder&&j(!0),ne(l),U(e),re(c)})},[s,n]),g(()=>{if(A)R&&x!==F&&C(F),B&&w!==F&&T(F);else{if(x&&x===F){var e;C(((e=s[n])==null||(e=e.acl)==null?void 0:e.owner)||null)}if(w&&w===F){var t;T(((t=s[n])==null||(t=t.acl)==null?void 0:t.ownerGroup)||null)}}console.log(`stateOwnerUser ${x}`)},[A,x,w,R,B]),K.length?i(S,{theme:v,titleButtonApply:`apply`,overflowHidden:!0,disableApply:q,progress:Y,onClose:e,onApply:()=>{ie(!0),setTimeout(async()=>{var e;let n=((e=s[`system.config`].common)==null||(e=e.defaultNewAcl)==null?void 0:e.file)||1636;if(A){let e=~W&65535;for(let t=0;t<K.length;t++){let s=K[t],m=!1,h=s,g=s;if(h._id){var i,o,c,l;let t=M(((i=h.acl)==null?void 0:i.file)||n,I??0,e);t!==((o=h.acl)==null?void 0:o.file)&&(h.acl=h.acl||{},h.acl.file=t,m=!0),x!==F&&x!==((c=h.acl)==null?void 0:c.owner)&&(h.acl=h.acl||{},h.acl.owner=x??``,m=!0),w!==F&&w!==((l=h.acl)==null?void 0:l.ownerGroup)&&(h.acl=h.acl||{},h.acl.ownerGroup=w??``,m=!0);try{m&&await r(h)}catch(e){console.error(e)}}else if(g&&!g.folder){var u,d,f,p;let t={},r=M(((u=g.acl)==null?void 0:u.permissions)||n,I??0,e);if(r!==((d=g.acl)==null?void 0:d.permissions)&&(t.permissions=r,m=!0),x!==F&&x!==((f=g.acl)==null?void 0:f.owner)&&(t.owner=x??void 0,m=!0),w!==F&&w!==((p=g.acl)==null?void 0:p.ownerGroup)&&(t.ownerGroup=w??void 0,m=!0),m){let e=g.id.split(`/`),n=e.shift()||``,r=e.join(`/`);try{await a(n,r,t)}catch(e){console.error(e)}}}}}else{let e=b.id.split(`/`),t=e.shift()||``,n=e.join(`/`),i={},o=!1;if(!b.folder){var m,h,g;((m=b.acl)==null?void 0:m.permissions)!==I&&(i.permissions=I??void 0,o=!0),((h=b.acl)==null?void 0:h.owner)!==x&&(i.owner=x??void 0,o=!0),((g=b.acl)==null?void 0:g.ownerGroup)!==w&&(i.ownerGroup=w??void 0,o=!0),o&&await a(t,n,i)}else if(!e.length&&s[b.id]){var _,v,y;let e=s[b.id];((_=e.acl)==null?void 0:_.file)!==I&&(e.acl=e.acl||{},e.acl.file=I??0,o=!0),((v=e.acl)==null?void 0:v.owner)!==x&&(e.acl=e.acl||{},e.acl.owner=x??``,o=!0),((y=e.acl)==null?void 0:y.ownerGroup)!==w&&(e.acl=e.acl||{},e.acl.ownerGroup=w??``,o=!0),o&&await r(e)}}ie(!1),t()},200)},children:d(`div`,{style:{display:`flex`,flexDirection:`column`},children:[i(`div`,{style:{margin:10,fontSize:20},children:c(`Access control list: %s`,n)}),d(`div`,{style:{display:`flex`},children:[i(o,{fullWidth:!0,style:{marginRight:10},label:c(`Owner user`),lang:X,list:E,t:c,disabled:Y,value:x||void 0,themeType:u,different:R?F:!1,onChange:e=>{z(!1),C(e),J(!1)}}),i(o,{fullWidth:!0,label:c(`Owner group`),lang:X,list:O,t:c,disabled:Y,value:w||void 0,themeType:u,different:B?F:!1,onChange:e=>{V(!1),T(e),J(!1)}})]}),d(`div`,{style:{display:`flex`,margin:10,alignItems:`center`,fontSize:10,marginLeft:0,color:`silver`},children:[i(`div`,{style:!b.folder||!A?{color:`green`}:void 0,children:c(`to apply one item`)}),i(p,{disabled:K.length===1||Y,checked:!s[b.id]&&!!b.folder||A,onChange:e=>{j(e.target.checked),J(!1)},color:`primary`}),d(`div`,{style:b.folder||A?{color:`green`}:void 0,children:[c(`to apply with children`),` `,b.folder||N>1?`(${N} ${c(`object(s)`)})`:``]})]}),Y&&i(f,{}),i(`div`,{style:{overflowY:`auto`},children:d(`div`,{children:[i(`h2`,{children:c(`File rights`)}),i(ee,{disabled:Y,mask:W,setMask:G,applyToChildren:A,differentValues:H,t:c,setValue:e=>{L(e),J(!1)},value:I??0})]})})]})}):i(f,{})};r();var I=[`select`,`view`],L=class e extends _{constructor(e){super(e),u(this,`t`,void 0),u(this,`wordCache`,void 0),u(this,`objects`,void 0),u(this,`navigateTo`,null),u(this,`translate`,(e,t,n)=>t===void 0?(this.wordCache[e]||(this.wordCache[e]=this.props.t(e)),this.wordCache[e]):this.props.t(e,t,n)),this.t=this.translate,this.wordCache={},this.objects={}}componentDidMount(){this.props.socket.getObjects(!0,!0).then(e=>this.objects=e)}static isAppDialogOpen(){let e=n.getLocation().dialog;return!!e&&!I.includes(e)}renderAclDialog(e){return i(ne,{theme:this.props.theme,themeType:this.props.themeType,applyChangesToObject:async t=>{let n=await this.props.socket.getObject(t._id);n.acl=t.acl,await this.props.socket.setObject(n._id,n);let r=n;r!=null&&r.acl&&e.updateItemsAcl([{id:r._id,acl:r.acl,level:0,name:r._id,folder:!1}])},applyChangesToFile:async(t,n,r)=>{let i=r||{},a;if((i.owner||i.ownerGroup)&&i.permissions?(await this.props.socket.chownFile(t,n,{owner:i.owner,ownerGroup:i.ownerGroup}),a=await this.props.socket.chmodFile(t,n,{mode:i.permissions})):i.permissions?a=await this.props.socket.chmodFile(t,n,{mode:i.permissions}):(i.owner||i.ownerGroup)&&(a=await this.props.socket.chownFile(t,n,{owner:i.owner,ownerGroup:i.ownerGroup})),Array.isArray(a))for(let n=0;n<a.length;n++){let r=a[n];r&&r.file&&r.acl&&e.updateItemsAcl([{id:`${t}/${r.path?`${r.path}/`:``}${r.file}`,acl:r.acl,level:0,name:``,folder:!1}])}},selected:e.state.selected,folders:e.state.folders,objects:this.objects,socket:this.props.socket,t:this.t,onClose:()=>e.setState({modalEditOfAccess:!1}),onApply:()=>e.setState({modalEditOfAccess:!1})})}render(){if(!this.props.ready)return i(f,{});if(!e.isAppDialogOpen()){let e=n.getLocation();this.navigateTo=e.tab===`tab-files`&&e.id?{mode:e.dialog===`view`?`view`:`select`,id:e.id}:null}let t=this.navigateTo;return i(a,{children:i(s,{overflow:`auto`,children:i(v,{navigateTo:t,onNavigateTo:t=>{e.isAppDialogOpen()||(t!=null&&t.id?n.doNavigate(`tab-files`,t.mode,t.id):n.doNavigate(`tab-files`))},showViewTypeButton:!0,ready:this.props.ready,socket:this.props.socket,themeType:this.props.themeType,theme:this.props.theme,lang:this.props.lang,t:this.props.t,showToolbar:!0,allowUpload:!0,allowView:!0,allowDownload:!0,allowCreateFolder:!0,allowDelete:!0,expertMode:this.props.expertMode,modalEditOfAccessControl:e=>this.renderAclDialog(e),FileViewer:A})})})}};export{L as default};