iobroker.eos-admin 8.0.0 → 8.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NEXOWATT_EOS_BUILD_INFO.json +7 -6
- package/NEXOWATT_EOS_PREBUILT_MANIFEST.json +133 -51
- package/START_HERE_8.0.1.md +36 -0
- package/adminWww/.vite/manifest.json +39 -39
- package/adminWww/NEXOWATT_EOS_FRONTEND_MANIFEST.json +107 -107
- package/adminWww/assets/{AdapterUpdateDialog-B3y8RL_5.js → AdapterUpdateDialog-D3y2bGHM.js} +1 -1
- package/adminWww/assets/{Adapters-BDxfhfGe.js → Adapters-WMGNQt7g.js} +1 -1
- package/adminWww/assets/{ConfigManager-CFuOc_kb.js → ConfigManager-BMdQoiCg.js} +1 -1
- package/adminWww/assets/{Enums-CSzSzWm7.js → Enums-CHm2sGa-.js} +1 -1
- package/adminWww/assets/{Fields-DnckPMA8.js → Fields-Df7Llf6U.js} +1 -1
- package/adminWww/assets/{Files-CwUHx0pF.js → Files-Bwbw17Fb.js} +1 -1
- package/adminWww/assets/{Hosts-QkyuASJy.js → Hosts-BR0g-Wxo.js} +1 -1
- package/adminWww/assets/{Instances-BaWBemTT.js → Instances-BKydFSdw.js} +1 -1
- package/adminWww/assets/{Intro-DsfrPrWv.js → Intro-Dt2GzmtW.js} +1 -1
- package/adminWww/assets/{Logs-Cngy2Opt.js → Logs-hbcdBDN3.js} +1 -1
- package/adminWww/assets/{Objects-DY8KS7zK.js → Objects-HPx0yuOk.js} +1 -1
- package/adminWww/assets/{Overview-WwP6FjK-.js → Overview-CDvnM655.js} +1 -1
- package/adminWww/assets/{State-vP1o2BCL.js → State-Cc-tyuqB.js} +1 -1
- package/adminWww/assets/{UsedResources-CMTzFOX3.js → UsedResources-BIdU7UPm.js} +1 -1
- package/adminWww/assets/{Users-BjTGOjzL.js → Users-BruHA-yU.js} +1 -1
- package/adminWww/assets/{bootstrap-Bs4TZ7iA.js → bootstrap-D-7xcwTc.js} +3 -3
- package/adminWww/assets/{hostInit-2xIZYDSq.js → hostInit-huY-0clu.js} +1 -1
- package/adminWww/assets/{icons-material-BLgrEUSv.js → icons-material-Bu1f45BT.js} +1 -1
- package/adminWww/assets/{index-BZifaJHi.js → index-D8vmzGp8.js} +2 -2
- package/adminWww/assets/{installSVGRenderer-Pe6-VnD2.js → installSVGRenderer-BkdptYag.js} +1 -1
- package/adminWww/assets/{mf-entry-bootstrap-0-a6a54377.js → mf-entry-bootstrap-0-f6098d8b.js} +2 -2
- package/adminWww/index.html +21 -21
- package/adminWww/mf-manifest.json +1 -1
- package/adminWww/mf-stats.json +1 -1
- package/adminWww/{remoteEntry-eos-8.0.0.js → remoteEntry-eos-8.0.1.js} +1 -1
- package/adminWww/remoteEntry.js +1 -1
- package/build/lib/eosSessionSecurity.js +12 -4
- package/build/lib/eosSessionSecurity.js.map +1 -1
- package/build/lib/vendor/webserver/LICENSE +21 -0
- package/build/lib/vendor/webserver/README.md +506 -0
- package/build/lib/vendor/webserver/build/index.d.ts +9 -0
- package/build/lib/vendor/webserver/build/index.js +42 -0
- package/build/lib/vendor/webserver/build/index.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/acmeChallenge.d.ts +65 -0
- package/build/lib/vendor/webserver/build/lib/acmeChallenge.js +149 -0
- package/build/lib/vendor/webserver/build/lib/acmeChallenge.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/certificateManager.d.ts +60 -0
- package/build/lib/vendor/webserver/build/lib/certificateManager.js +128 -0
- package/build/lib/vendor/webserver/build/lib/certificateManager.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/http2Compat.d.ts +21 -0
- package/build/lib/vendor/webserver/build/lib/http2Compat.js +109 -0
- package/build/lib/vendor/webserver/build/lib/http2Compat.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-authcode.d.ts +167 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-authcode.js +619 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-authcode.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-clients.d.ts +92 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-clients.js +230 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-clients.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-model.d.ts +84 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-model.js +388 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-model.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/oauth2.d.ts +75 -0
- package/build/lib/vendor/webserver/build/lib/oauth2.js +625 -0
- package/build/lib/vendor/webserver/build/lib/oauth2.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/securityChecker.d.ts +6 -0
- package/build/lib/vendor/webserver/build/lib/securityChecker.js +96 -0
- package/build/lib/vendor/webserver/build/lib/securityChecker.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/usedResources.d.ts +62 -0
- package/build/lib/vendor/webserver/build/lib/usedResources.js +231 -0
- package/build/lib/vendor/webserver/build/lib/usedResources.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/utils.d.ts +35 -0
- package/build/lib/vendor/webserver/build/lib/utils.js +110 -0
- package/build/lib/vendor/webserver/build/lib/utils.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/webServer.d.ts +164 -0
- package/build/lib/vendor/webserver/build/lib/webServer.js +454 -0
- package/build/lib/vendor/webserver/build/lib/webServer.js.map +1 -0
- package/build/lib/vendor/webserver/package.json +63 -0
- package/build/lib/web.js +1 -1
- package/build/lib/web.js.map +1 -1
- package/docs/ADMIN8_MIGRATION_8.0.0_DE.md +2 -0
- package/docs/cra/CRA_IEC_GAP_ANALYSIS_2026-09-30.md +5 -0
- package/docs/security/admin8-2026-11-04/development-1.log +3 -3
- package/docs/security/admin8-2026-11-04/development-2.log +248 -233
- package/docs/security/admin8-2026-11-05/copy-update/evidence-sha256.json +0 -5
- package/docs/security/admin8-2026-11-05/login-fix/BACKEND_DIAGNOSE_DE.md +48 -0
- package/docs/security/admin8-2026-11-05/login-fix/REPORT_DE.md +47 -0
- package/docs/security/admin8-2026-11-05/login-fix/REVIEW_DE.md +7 -0
- package/docs/security/admin8-2026-11-05/login-fix/controller-adapter-api.ts.txt +122 -0
- package/docs/security/admin8-2026-11-05/login-fix/controller-file-view.ts.txt +75 -0
- package/docs/security/admin8-2026-11-05/login-fix/controller-redis-view.ts.txt +471 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/LICENSE-webserver-3.4.0 +21 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/REPORT_DE.md +41 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/evidence-sha256.json +116 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/http-consumer-check.cjs +58 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/README_DE.md +9 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/REJECTED-webserver-3.4.0-eos-oauth.provenance.json +263 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/REJECTED-webserver-3.4.0-eos-oauth.tgz +0 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/admission.log +16 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-audit-stderr.log +1 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-audit.json +22 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-fixture-1.0.0.tgz +0 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-fixture-package.json +11 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-npm10-package-lock.json +387 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-npm11-package-lock.json +387 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/evidence-sha256.json +85 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/http-consumer-npm10-node22.json +11 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/http-consumer-npm11-node24.json +11 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/local-tests.json +38 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/tests-node22.log +168 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/tests-node24.log +36 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/source-vendor-tests-node22.log +224 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/source-vendor-tests-node24.log +42 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/source-vendor-tests.json +31 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/webserver-3.4.0-upstream.tgz +0 -0
- package/docs/security/admin8-2026-11-05/login-fix/eos-session-8.0.0.js.txt +385 -0
- package/docs/security/admin8-2026-11-05/login-fix/evidence-sha256.json +59 -0
- package/docs/security/admin8-2026-11-05/login-fix/path-budget.json +6 -0
- package/docs/security/admin8-2026-11-05/login-fix/provenance.json +51 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/admission.log +21 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/archive-scan.json +13 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/artifacts.log +6 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/backend-build.log +5 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/consumer-package-lock.json +3258 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/copy-update-journal.json +165 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/development.log +365 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/frontend-build.log +149 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-audit.json +22 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-audit.stderr +2 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-final-install-node22.log +9 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-http-node22.json +15 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-http-node22.stderr +2 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-http-node24.json +15 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-http-node24.stderr +0 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/inventory.log +8 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/npm-pack-final.json +7809 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/npm-pack-final.stderr +6 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/overlay-final-publish-node22.json +10213 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/overlay-final-publish-node22.stderr +282 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/pipeline.json +72 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/seal.log +6 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/vendor-final-review-node24.log +18 -0
- package/docs/security/admin8-2026-11-05/login-fix/reproduce.cjs +79 -0
- package/docs/security/admin8-2026-11-05/login-fix/reproduction.json +80 -0
- package/docs/security/admin8-2026-11-05/login-fix/upstream-LICENSE.txt +22 -0
- package/docs/security/admin8-2026-11-05/login-fix/validation.json +85 -0
- package/docs/third-party/admin8/NOTICE-PROVENANCE.json +3 -3
- package/io-package.json +9 -10
- package/package.json +9 -4
- package/release-manifests/admin8-development-validation.json +114 -31
- package/reports/security/artifact-inventory.json +462 -227
- package/reports/security/inventory-summary.json +39 -17
- package/reports/security/sbom-backend-lock.cdx.json +108 -111
- package/reports/security/sbom-frontend-lock.cdx.json +5 -5
- package/reports/security/source-runtime-manifest.json +455 -65
- package/tools/nexowatt-artifact-inventory.cjs +8 -1
- package/tools/nexowatt-installer-ems-selftest.cjs +1 -1
- package/tools/nexowatt-lock-provenance-check.cjs +8 -3
- package/tools/nexowatt-repair-lock-metadata.cjs +3 -3
- package/tools/nexowatt-security-inventory.cjs +22 -1
- package/tools/nexowatt-user-area-selftest.cjs +1 -1
- package/tools/nexowatt-v7109-clean-core-selftest.cjs +1 -1
- package/tools/nexowatt-vendored-webserver.cjs +69 -0
- package/tools/vendor/eos-retired-release-files.json +73 -1
- package/tools/vendor/webserver-3.4.0-source.provenance.json +244 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Es as e,Fo as t,Ga as n,Go as r,Gr as i,Hs as a,Mo as o,No as s,Tr as c,Ts as l,Us as u,Vs as d,Xn as f,_i as p,_o as m,bo as h,ho as g,ja as _,jo as v,qa as y,qo as b,r as x,si as S,ta as C,tc as w}from"./loadShare-eager-CRNcc8D7.js";import{t as ee}from"./Book-QmHxDaHb.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-
|
|
1
|
+
import{Es as e,Fo as t,Ga as n,Go as r,Gr as i,Hs as a,Mo as o,No as s,Tr as c,Ts as l,Us as u,Vs as d,Xn as f,_i as p,_o as m,bo as h,ho as g,ja as _,jo as v,qa as y,qo as b,r as x,si as S,ta as C,tc as w}from"./loadShare-eager-CRNcc8D7.js";import{t as ee}from"./Book-QmHxDaHb.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-D-7xcwTc.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-Cc-tyuqB.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,An as n,Ar as r,Br as i,Ci as a,Ds as o,Eo as s,Es as c,Fo as l,Ga as u,Go as d,Gr as f,Ho as p,Hs as m,Is as h,Jo as g,Ka as _,Ls as v,Mo as y,Ni as ee,No as b,On as te,Oo as x,Pi as ne,Qo as re,Qs as ie,Rr as ae,Rs as oe,So as se,To as ce,Tr as S,Ts as C,Ua as le,Ui as ue,Us as w,Vo as de,Vs as T,Xn as fe,Yo as pe,Zo as E,_o as D,as as me,ba as he,bo as O,br as ge,ca as _e,co as ve,da as ye,ei as be,eo as xe,es as Se,fa as Ce,gs as we,ho as k,io as Te,is as Ee,ja as De,jo as A,ki as Oe,kn as ke,ls as Ae,ma as je,mo as j,ms as Me,no as M,oc as Ne,oo as N,po as Pe,ps as Fe,qa as P,qo as F,qs as I,r as L,ro as Ie,rs as Le,ss as R,ta as Re,tc as z,tn as ze,to as Be,ts as Ve,uo as B,us as He,vi as Ue,wi as We,wo as Ge,zo as Ke,zr as qe,zs as Je}from"./loadShare-eager-CRNcc8D7.js";import{a as Ye,c as Xe,d as Ze,f as Qe,i as $e,l as et,n as tt,o as nt,p as rt,r as it,s as at,t as ot,u as st}from"./Star-DNdm064z.js";import{f as ct}from"./WifiTethering-Da8nW7Do.js";import{t as lt}from"./DeleteForever-BnEM-6_v.js";import{t as ut}from"./Remove-DplJatnC.js";import{t as dt}from"./ViewList-DuKCnBnc.js";import{n as ft,o as pt,r as mt,t as ht}from"./AdminUtils-DDT_kD8H.js";import{A as gt,E as _t,F as V,I as vt,O as yt,Q as bt,_t as xt,i as St,j as Ct,n as wt,q as Tt}from"./bootstrap-
|
|
1
|
+
import{$a as e,$o as t,An as n,Ar as r,Br as i,Ci as a,Ds as o,Eo as s,Es as c,Fo as l,Ga as u,Go as d,Gr as f,Ho as p,Hs as m,Is as h,Jo as g,Ka as _,Ls as v,Mo as y,Ni as ee,No as b,On as te,Oo as x,Pi as ne,Qo as re,Qs as ie,Rr as ae,Rs as oe,So as se,To as ce,Tr as S,Ts as C,Ua as le,Ui as ue,Us as w,Vo as de,Vs as T,Xn as fe,Yo as pe,Zo as E,_o as D,as as me,ba as he,bo as O,br as ge,ca as _e,co as ve,da as ye,ei as be,eo as xe,es as Se,fa as Ce,gs as we,ho as k,io as Te,is as Ee,ja as De,jo as A,ki as Oe,kn as ke,ls as Ae,ma as je,mo as j,ms as Me,no as M,oc as Ne,oo as N,po as Pe,ps as Fe,qa as P,qo as F,qs as I,r as L,ro as Ie,rs as Le,ss as R,ta as Re,tc as z,tn as ze,to as Be,ts as Ve,uo as B,us as He,vi as Ue,wi as We,wo as Ge,zo as Ke,zr as qe,zs as Je}from"./loadShare-eager-CRNcc8D7.js";import{a as Ye,c as Xe,d as Ze,f as Qe,i as $e,l as et,n as tt,o as nt,p as rt,r as it,s as at,t as ot,u as st}from"./Star-DNdm064z.js";import{f as ct}from"./WifiTethering-Da8nW7Do.js";import{t as lt}from"./DeleteForever-BnEM-6_v.js";import{t as ut}from"./Remove-DplJatnC.js";import{t as dt}from"./ViewList-DuKCnBnc.js";import{n as ft,o as pt,r as mt,t as ht}from"./AdminUtils-DDT_kD8H.js";import{A as gt,E as _t,F as V,I as vt,O as yt,Q as bt,_t as xt,i as St,j as Ct,n as wt,q as Tt}from"./bootstrap-D-7xcwTc.js";import{n as Et,r as Dt,t as Ot}from"./sentry-B4uGc7ut.js";import{i as kt,n as At,r as jt,t as Mt}from"./AdapterUpdateDialog-D3y2bGHM.js";import{t as Nt}from"./CustomModal-B8vdCRn1.js";c();var H={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`})},Pt=class e extends z{constructor(e){super(e),C(this,`updateAvailable`,void 0),C(this,`initialVersions`,void 0),C(this,`currentRef`,void 0),C(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=I.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 L.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})&&(At(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{L.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 t;let n=this.props.selected.includes(e);if((this.props.finished||this.props.inProcess)&&!n||!this.props.installed[e])return null;let r=this.props.installed[e].localIcon,i=r?`.${r}`:((t=this.props.repository[e])==null?void 0:t.extIcon)||`img/no-image.svg`;return w(Se,{dense:!0,sx:{"&.MuiListItem-root":f.getStyle(this.props.theme,H.listItem,this.props.updated.includes(e)&&H.updateDone)},ref:this.props.current===e?this.currentRef:null,secondaryAction:!this.props.finished&&!this.props.inProcess?m(s,{edge:`end`,checked:n,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&&m(x,{}),children:[m(Le,{sx:H.minWidthCss,children:m(we,{variant:`square`,alt:e,src:i,style:H.smallAvatar})}),m(Ee,{primary:e,title:this.getNews(e).map(e=>`${e.version}: ${e.news}`).join(`
|
|
2
2
|
`),secondary:w(`span`,{children:[w(`div`,{style:H.versions,children:[this.initialVersions[e],` →`,m(D,{component:`span`,sx:H.toVersion,children:this.props.repository[e].version})]}),m(F,{title:S.t(`Show change log`),onClick:()=>this.setState({showNews:{adapter:e,version:this.props.repository[e].version,fromVersion:this.initialVersions[e]}}),size:`small`,children:m(Re,{})})]})})]},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,f;a=(u=this.props.repository[e])==null?void 0:u.stable,o=(f=this.props.repository[e])==null?void 0:f.version}let p=n==null?void 0:n.news;return r&&p&&Object.keys(p).forEach(n=>{try{if(L.gt(n,t)&&p[n]){let e=(this.props.noTranslation?p[n].en||``:p[n][this.props.lang]||p[n].en||``).split(`
|
|
3
3
|
`).map(e=>kt(e.trim()).replace(/<!--[^>]*->/g,``).replace(/<! -[^>]*->/g,``).trim()).filter(e=>!!e);i.push(w(d,{children:[w(k,{sx:H.versionHeader,children:[n,o===n?m(D,{component:`span`,sx:H.repoLatestVersionText,children:`(latest)`}):null,a===n?m(D,{component:`span`,sx:H.repoStableVersionText,children:`(${S.t(`stable`)})`}):null]}),e.map((e,t)=>m(jt,{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=f.getStyle(this.props.theme,H.closeButton),n=f.getStyle(this.props.theme,H.languageButtonActive);return w(A,{onClose:()=>this.setState({showNews:null}),open:!0,children:[m(l,{children:w(k,{component:`h2`,variant:`h6`,sx:{"&.MuiTypography-root":H.typography},children:[m(`div`,{style:{width:`calc(100% - 60px)`},children:S.t(`Update "%s" to v%s`,this.state.showNews.adapter,this.state.showNews.version)}),m(F,{size:`large`,style:t,onClick:()=>this.setState({showNews:null}),children:m(P,{})}),S.getLanguage()!==`en`&&this.props.toggleTranslation?m(F,{size:`large`,style:{...H.languageButton,...this.props.noTranslation?n:void 0},onClick:this.props.toggleTranslation,title:S.t(`Disable/Enable translation`),children:m(De,{})}):null]})}),m(b,{dividers:!0,children:m(d,{container:!0,spacing:2,wrap:`nowrap`,sx:{flexDirection:`column`},children:e.length?w(d,{children:[m(k,{variant:`h6`,gutterBottom:!0,children:S.t(`Change log`)}),m(d,{container:!0,spacing:2,wrap:`nowrap`,sx:{flexDirection:`column`},children:e})]}):S.t(`No change log available`)})}),m(y,{style:H.wrapperButton,children:m(O,{variant:`contained`,onClick:()=>this.setState({showNews:null}),color:`grey`,startIcon:m(P,{}),children:S.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)),w(t,{style:H.root,children:[this.updateAvailable.map(e=>this.renderOneAdapter(e)),this.renderShowNews()]})}};c();var U={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})},Ft=class extends z{constructor(e){super(e),C(this,`updateAvailable`,[]),C(this,`onAdapterFinished`,null),C(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?f.getStyle(this.props.theme,U.languageButtonActive):void 0;return w(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":U.dialogRoot},scroll:`paper`,children:[m(l,{id:`update-dialog-title`,children:w(`div`,{style:U.wrapperHead,children:[this.props.t(`Update %s adapter(s)`,this.state.selected.length),!this.state.finished&&!this.state.inProcess&&m(j,{title:this.props.t(`Select/Unselect all`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:m(s,{checked:this.state.selected.length===this.updateAvailable.length,style:U.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})}})}),S.getLanguage()!==`en`&&this.props.toggleTranslation?m(F,{size:`large`,style:{...U.languageButton,...e},onClick:()=>{var e,t;return(e=(t=this.props).toggleTranslation)==null?void 0:e.call(t)},title:S.t(`Disable/Enable translation`),children:m(De,{})}):null]})}),w(b,{sx:{"&.MuiDialogContent-root":U.content},children:[w(d,{container:!0,direction:`row`,sx:U.container,children:[m(d,{style:{height:`100%`,overflow:`hidden`,width:this.state.current?250:`100%`},children:m(`div`,{style:{height:`100%`,overflow:`auto`},children:m(Pt,{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&&m(d,{style:{height:`100%`,overflow:`hidden`,width:`calc(100% - 260px)`,minWidth:240},children:m(vt,{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)})]}),w(Pe,{variant:`dense`,disableGutters:!0,sx:U.appBar,children:[m(p,{control:m(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`)}),m(p,{control:m(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`)}),m(p,{control:m(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`)})]})]}),w(y,{children:[m(O,{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:m(u,{}),children:this.props.t(`Update`)}),m(O,{id:`adapters-update-dialog-cancel`,variant:`contained`,disabled:!this.state.inProcess,color:`grey`,startIcon:m(be,{}),onClick:()=>{this.setState({stopped:!0,finished:!0}),this.props.onSetCommandRunning(!1)},children:this.props.t(`Cancel`)}),m(O,{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:m(P,{}),children:this.props.t(`Close`)})]})]})}},It=o(w(T,{children:[m(`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`}),m(`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`);c();var Lt=class extends _t{constructor(e,t){super(e,`${t}.adapter`,`adapter`),C(this,`host`,void 0),C(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 Rt(e){var t;return(e==null||(t=e.licenseInformation)==null?void 0:t.link)||zt(e)}function zt(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 Bt(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 Vt=`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 Ht(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 Ut(e){return{id:`github-install-dialog-tab-${e}`,"aria-controls":`github-install-dialog-panel-${e}`}}var W={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 Wt(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 Gt=10,Kt=class extends I.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(`${S.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=Bt(this.state.selectedFile.name)||``;if(this.state.cmdExecFilesSupported){try{let t=await Ht(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>Gt&&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(Bt(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 m(`div`,{style:{display:`flex`,alignItems:`center`},children:m(p,{control:m(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`?w(He,{style:W.tabPaper,id:`github-install-dialog-panel-npm`,children:[m(`div`,{style:{display:`flex`,alignItems:`center`},children:m(p,{control:m(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(),w(`div`,{style:{display:`flex`,alignItems:`flex-end`},children:[m(it,{style:{marginRight:10}}),m(Ae,{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 m(B,{variant:`standard`,...e,slotProps:{...e.slotProps,input:{...e.slotProps.input,startAdornment:m(g,{position:`start`,children:m(ge,{src:((t=this.state.autoCompleteValue)==null?void 0:t.icon)||``,style:W.listIcon})})}},label:S.t(`Select adapter`)})},renderOption:(e,t)=>w(D,{component:`li`,sx:{"& > img":{mr:2,flexShrink:0}},...e,children:[m(ge,{src:(t==null?void 0:t.icon)||``,style:W.listIconWithMargin}),(t==null?void 0:t.name)??``]})})]}),m(`div`,{style:{fontSize:24,fontWeight:`bold`,marginTop:40},children:this.props.t(`Warning!`)}),m(`div`,{style:W.warningText,children:this.props.t(`npm_warning`,`NPM`,`NPM`)}),m(`div`,{style:W.noteText,children:this.props.t(`github_note`)})]}):null}renderGitHub(){return this.state.currentTab===`GitHub`?w(He,{style:W.tabPaper,id:`github-install-dialog-panel-github`,children:[m(`div`,{style:{display:`flex`,alignItems:`center`},children:m(p,{control:m(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(),w(`div`,{style:{display:`flex`,alignItems:`flex-end`},children:[m(it,{style:{marginRight:10}}),m(Ae,{fullWidth:!0,value:this.state.autoCompleteValue,getOptionDisabled:e=>!!(e!=null&&e.nogit),renderOption:(e,t)=>w(D,{component:`li`,sx:{"& > img":{mr:2,flexShrink:0}},...e,children:[m(ge,{src:(t==null?void 0:t.icon)||``,style:W.listIconWithMargin}),(t==null?void 0:t.name)??``,(t==null?void 0:t.nogit)&&m(`div`,{style:W.errorTextNoGit,children:S.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 m(B,{variant:`standard`,...e,slotProps:{...e.slotProps,input:{...e.slotProps.input,startAdornment:m(g,{position:`start`,children:m(ge,{src:((t=this.state.autoCompleteValue)==null?void 0:t.icon)||``,style:W.listIconWithMargin})})}},label:S.t(`Select adapter`)})}})]}),m(`div`,{style:{fontSize:24,fontWeight:`bold`,marginTop:40},children:this.props.t(`Warning!`)}),m(`div`,{style:W.warningText,children:this.props.t(`github_warning`,`GitHub`,`GitHub`)}),m(`div`,{style:W.noteText,children:this.props.t(`github_note`)})]}):null}renderCustom(){return this.state.currentTab===`URL`?w(He,{style:W.tabPaper,id:`github-install-dialog-panel-custom`,children:[m(`div`,{style:{display:`flex`,alignItems:`center`},children:m(p,{control:m(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(),m(`div`,{style:{display:`flex`,alignItems:`center`},children:m(Ae,{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)=>w(D,{component:`li`,...e,style:{display:`flex`,alignItems:`left`},children:[t,m(`div`,{style:{flexGrow:1}}),m(F,{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:m(le,{})})]}),freeSolo:!0,options:this.state.customHistory,renderInput:e=>m(B,{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`)})})}),m(`div`,{style:{fontSize:24,fontWeight:`bold`,marginTop:40},children:this.props.t(`Warning!`)}),m(`div`,{style:W.warningText,children:this.props.t(`github_warning`,`URL`,`URL`)}),m(`div`,{style:W.noteText,children:this.props.t(`github_note`)})]}):null}renderFile(){return this.state.currentTab===`File`?w(He,{style:W.tabPaper,id:`github-install-dialog-panel-file`,children:[w(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[w(O,{variant:`outlined`,component:`label`,startIcon:m(Ce,{}),disabled:this.state.uploading,children:[this.props.t(`Select file`),m(`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&&w(T,{children:[m(k,{variant:`body2`,style:{flex:1},children:this.state.selectedFile.name}),m(F,{size:`small`,onClick:()=>this.setState({selectedFile:null}),children:m(P,{})})]}),this.state.uploading&&m(x,{size:24})]}),this.state.selectedFile&&m(p,{control:m(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&&w(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:8},children:[w(k,{variant:`body2`,children:[this.props.t(`Install on host`),`:`]}),m(yt,{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})})]}),m(`div`,{style:{fontSize:24,fontWeight:`bold`,marginTop:40},children:this.props.t(`Warning!`)}),m(`div`,{style:W.warningText,children:this.props.t(`github_warning`,`File`,`File`)}),m(`div`,{style:W.noteText,children:this.props.t(`github_note`)})]}):null}getList(){let e=Wt(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[S.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=pt(`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 t;let n=()=>this.setState({autoCompleteValue:null,url:``,selectedFile:null,uploading:!1});return w(A,{onClose:()=>this.props.onClose(),open:!0,sx:{"& .MuiDialog-paper":W.paper},children:[m(b,{dividers:!0,children:w(D,{component:`div`,sx:W.root,children:[m(me,{position:`static`,color:`default`,children:w(ve,{value:this.state.currentTab,onChange:(e,t)=>{(window._localstorage||window.localStorage).setItem(`App.gitTab`,t),this.setState({currentTab:t})},variant:`fullWidth`,indicatorColor:`secondary`,children:[m(e,{label:this.props.t(`From npm`),wrapped:!0,sx:{"&.Mui-selected":W.tabSelected},icon:m(`img`,{src:Vt,alt:`npm`,width:24,height:24}),...Ut(`npm`),value:`npm`}),m(e,{label:this.props.t(`From github`),wrapped:!0,sx:{"&.Mui-selected":W.tabSelected},icon:m(ue,{style:{width:24,height:24},width:24,height:24}),...Ut(`github`),value:`GitHub`}),m(e,{label:this.props.t(`Custom`),wrapped:!0,sx:{"&.Mui-selected":W.tabSelected},icon:m(De,{width:24,height:24}),...Ut(`custom`),value:`URL`}),m(e,{label:this.props.t(`From file`),wrapped:!0,sx:{"&.Mui-selected":W.tabSelected},icon:m(Ue,{style:{width:24,height:24}}),...Ut(`file`),value:`File`})]})}),m(D,{component:`div`,sx:W.title,children:this.props.t(`Install or update the adapter from %s`,this.state.currentTab||`npm`)}),this.renderNpm(),this.renderGitHub(),this.renderCustom(),this.renderFile()]})}),w(y,{children:[m(O,{id:`github-install-dialog-ok`,variant:`contained`,disabled:this.state.uploading||this.props.commandRunning||(this.state.currentTab===`GitHub`||this.state.currentTab===`npm`)&&!((t=this.state.autoCompleteValue)!=null&&t.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(),n()},color:`primary`,startIcon:this.props.commandRunning?m(x,{size:20}):m(u,{}),children:this.props.t(`Install`)}),m(O,{id:`github-install-dialog-close`,variant:`contained`,onClick:()=>{this.props.onClose(),n()},color:`grey`,startIcon:m(P,{}),children:this.props.t(`Close`)})]})]})}};c();var G={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`})},qt=class extends z{constructor(e){super(e),C(this,`t`,void 0),C(this,`messages`,null),C(this,`lang`,void 0),this.state={instanceNumbers:[]},this.t=e.t,this.lang=S.getLanguage(),this.messages=At(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(m(R,{value:`auto`,children:this.t(`auto`)},`auto`));for(let t=0;t<=100&&(this.state.instanceNumbers.includes(t.toString())||e.push(m(R,{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(w(`div`,{children:[m(`div`,{children:this.props.t(`The following hosts do not fulfill the required version %s of %s:`,r.version||`unknown`,r.name)}),m(`ul`,{style:{margin:`4px 0`},children:r.wrongHosts.map(e=>w(`li`,{children:[e.host,`: `,e.installedVersion]},e.host))})]},r.name)):r.rightVersion||t.push(m(`div`,{children:`${this.props.t(`Invalid version of %s. Required %s. Current `,r.name,r.version||`unknown`)}${r.installedVersion}`},r.name)):t.push(m(`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 w(d,{children:[m(k,{sx:G[`messageTitle_${e.level||`warn`}`],children:this.getText(e.title,this.props.noTranslation)||``}),m(k,{component:`div`,variant:`body2`,style:G.messageText,children:this.getText(e.text,this.props.noTranslation)||``}),e.link?m(O,{onClick:()=>{let t=window.open(e.link,`_blank`);t==null||t.focus()},startIcon:m(fe,{}),variant:`contained`,color:`grey`,children:this.getText(e.linkText||``,this.props.noTranslation)||this.props.t(`More info`)}):null]},t)}renderMessages(){return this.messages?m(d,{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 w(A,{onClose:()=>{},open:!0,sx:{"& .MuiDialog-paper":G.paper},children:[m(l,{children:w(k,{component:`h2`,variant:`h6`,sx:{"&.MuiTypography-root":G.typography},children:[this.t(`You are going to add new instance:`),` `,this.props.adapter,m(F,{size:`large`,sx:G.closeButton,onClick:()=>this.props.onClose(!1),children:m(P,{})}),this.messages&&this.lang!==`en`&&this.props.toggleTranslation?m(F,{size:`large`,style:f.getStyle(this.props.theme,G.languageButton,this.props.noTranslation&&G.languageButtonActive),onClick:this.props.toggleTranslation,title:S.t(`Disable/Enable translation`),children:m(De,{})}):null]})}),w(b,{dividers:!0,children:[this.renderMessages(),!e&&this.props.expertMode?w(d,{container:!0,sx:{flexDirection:`column`},children:[m(yt,{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\./,``))}),w(de,{variant:`standard`,style:G.formControl,children:[m(pe,{id:`instance-label`,children:this.t(`Instance`)}),m(Me,{variant:`standard`,labelId:`instance-label`,value:this.props.currentInstance,onChange:this.props.onInstanceChange,children:this.getAvailableInstances()})]})]}):null,m(D,{component:`div`,sx:G.deps,children:e})]}),w(y,{children:[m(O,{id:`instance-add-dialog-ok`,variant:`contained`,autoFocus:!0,disabled:!!e,onClick:()=>this.props.onClose(!0),color:`primary`,startIcon:m(We,{}),children:this.t(`Add`)}),m(O,{id:`instance-add-dialog-cancel`,variant:`contained`,onClick:()=>this.props.onClose(!1),color:`grey`,startIcon:m(P,{}),children:this.t(`Close`)})]})]})}},K=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?m(St,{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=At(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(`${S.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(`${S.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||L.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=L.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||L.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||L.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=L.satisfies(t.nodeJsVersion,o)}catch{e.rightVersion=!0}r.push(e)}}return r}renderAddInstanceDialog(t){return this.state.addInstanceDialog?m(qt,{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=zt(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?w(T,{children:[this.renderAddInstanceDialog(e),this.renderLicenseDialog(e)]}):null}},q={name:{flexWrap:`nowrap`,width:300,marginTop:0},nameDiv:{display:`flex`,alignItems:`center`},categoryName:{fontWeight:`bold`,cursor:`pointer`},green:{color:v[500]},blue:{color:oe[700]},category:{backgroundColor:`background.default`},marginRight5:{marginRight:5}};function Jt(e){let{installedCount:t,name:r,categoryName:i}=e;return w(N,{hover:!1,sx:q.category,children:[m(M,{children:m(d,{container:!0,spacing:1,style:q.name,sx:{alignItems:`center`},children:m(d,{component:`div`,children:m(F,{size:`small`,onClick:e.onToggle,children:e.expanded?m(n,{}):m(Qe,{})})})})}),m(M,{onClick:e.onToggle,children:w(`div`,{style:{...q.nameDiv,...q.categoryName},children:[m(Dt,{iconName:i,style:q.marginRight5}),r]})}),w(M,{colSpan:e.descHidden?5:6,children:[m(k,{component:`span`,variant:`body2`,style:q.green,children:t}),` ${e.t(`of`)} `,m(k,{component:`span`,variant:`body2`,style:q.blue,children:e.count}),` ${e.t(`Adapters from this Group installed`)}`]})]})}var J={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`}},Yt=[{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:`简体中文`}],Xt=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 w(`div`,{style:J.infoTextContainer,children:[m(Re,{}),m(k,{style:J.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 w(`div`,{style:{width:`100%`,textAlign:`left`},children:[m(D,{component:`h3`,sx:J.listTitle,children:this.props.t(`Comments`)}),w(de,{variant:`standard`,style:J.languageFilter,children:[m(pe,{children:this.props.t(`Show comments in language`)}),w(Me,{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:[w(R,{value:`_`,children:[this.props.t(`All`),` `,m(`span`,{style:J.commentCount,children:this.state.votings.comments.length})]}),Yt.map(e=>w(R,{value:e.id,children:[e.title,` `,this.state.commentsByLanguage[e.id]?m(`span`,{style:J.commentCount,children:this.state.commentsByLanguage[e.id]}):null]},e.id))]})]}),w(t,{style:J.list,dense:!0,disablePadding:!0,children:[e&&this.state.votings.comments.map((e,t)=>this.state.filterLang&&this.state.filterLang!==`_`&&e.lang!==this.state.filterLang?null:e?w(Se,{title:e.uuid?this.props.t(`Your comment`):``,sx:{"&.MuiListItem-root":e.uuid?J.listOwn:void 0},dense:!0,children:[m(Ve,{style:J.listRating,children:m(Fe,{readOnly:!0,defaultValue:e.rating,size:`small`})}),m(Ee,{primary:e.comment,secondary:`${new Date(e.ts).toLocaleString()} / v${e.version}`,sx:{"& .MuiListItemText-secondary":J.listTime}})]},t):null),!e&&m(`div`,{style:J.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 w(A,{open:!0,onClose:()=>this.props.onClose(),children:[m(l,{children:`${this.props.t(`Review`)} ${this.props.adapter}${this.props.version?`@${this.props.version}`:``}`}),w(b,{style:{textAlign:`center`},title:((e=this.props.currentRating)==null?void 0:e.title)||``,children:[this.renderInfoText(),m(Fe,{style:J.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?w(`div`,{style:{width:`100%`,textAlign:`left`},children:[m(B,{variant:`standard`,style:J.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?m(g,{position:`end`,children:m(F,{tabIndex:-1,size:`small`,onClick:()=>this.setState({ratingComment:``}),children:m(P,{})})}):null},htmlInput:{maxLength:200}}}),w(de,{variant:`standard`,style:J.ratingLanguageControl,children:[m(pe,{children:this.props.t(`Language`)}),m(Me,{variant:`standard`,value:this.state.ratingLang,onChange:e=>this.setState({ratingLang:e.target.value}),children:Yt.map(e=>m(R,{value:e.id,children:e.title},e.id))})]})]}):null,this.props.version?m(`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?m(`div`,{children:this.props.t(`You voted for %s on %s`,r[0],new Date(n.ts).toLocaleDateString())}):null,this.renderComments()]}),w(y,{children:[this.props.version&&m(O,{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:m(Xe,{}),children:this.props.t(`Rate`)}),m(O,{autoFocus:!this.props.version,variant:`contained`,onClick:()=>this.props.onClose(),color:`grey`,startIcon:m(P,{}),children:this.props.t(`Close`)})]})]})}};c();var Zt={formControl:{marginTop:24},closeButton:e=>({position:`absolute`,right:8,top:8,color:e.palette.grey[500]}),typography:{paddingRight:30}},Qt=class extends z{constructor(e){super(e),C(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 w(A,{onClose:this.props.onClose,open:!0,children:[m(l,{children:w(k,{component:`h2`,variant:`h6`,sx:{"&.MuiTypography-root":Zt.typography},children:[this.t(`Please confirm`),m(F,{size:`large`,sx:Zt.closeButton,onClick:this.props.onClose,children:m(P,{})})]})}),w(b,{dividers:!0,children:[m(k,{gutterBottom:!0,children:this.t(`Are you sure you want to delete adapter %s?`,this.props.adapter)}),this.state.deleteCustomSupported&&m(p,{control:m(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`)})]}),w(y,{children:[m(O,{id:`adapter-delete-dialog-ok`,variant:`contained`,autoFocus:!0,onClick:()=>{this.props.onClick(this.state.deleteCustom),this.props.onClose()},color:`primary`,startIcon:m(u,{}),children:this.t(`Ok`)}),m(O,{id:`adapter-delete-dialog-cancel`,variant:`contained`,autoFocus:!0,onClick:()=>this.props.onClose(),color:`grey`,startIcon:m(P,{}),children:this.t(`Close`)})]})]})}},$t={none:m(et,{}),patch:m(nt,{style:{color:`green`}}),minor:m($e,{style:{color:`orange`}}),major:m(ee,{style:{color:`red`}})},en=class extends I.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 w(A,{open:!0,maxWidth:`md`,fullWidth:!0,children:[m(l,{children:S.t(`Auto upgrade policy for %s`,this.props.adapter)}),w(b,{style:{padding:`0 20px`,overflow:`hidden`},children:[m(V,{value:!this.state.supported,children:m(k,{children:S.t(`This feature is supported up from js-controller Kiera (Version 6)!`)})}),w(V,{value:this.state.supported,children:[m(k,{children:S.t(`Allow only the following upgrades to be performed automatically:`)}),m(Me,{variant:`standard`,style:{marginTop:20,minWidth:150,marginBottom:8},value:this.state.policy,onChange:e=>this.setState({policy:e.target.value}),children:mt.map(e=>m(R,{value:e,children:w(`div`,{style:{display:`flex`,gap:8},children:[$t[e],ft[e]]})},e))}),m(V,{value:this.state.repositories.includes(`beta`)&&this.state.policy!==`none`,children:m(r,{type:`warning`,children:S.t(`repo_update_hint`)})}),m(V,{value:this.state.policy===`major`,children:m(r,{type:`warning`,children:S.t(`The current selected configuration will allow to automatically pull in incompatible changes of this adapter!`)})})]})]}),w(y,{children:[m(O,{disabled:this.state.currentSavedPolicy===this.state.policy,color:`primary`,variant:`contained`,startIcon:m(_,{}),onClick:()=>this.save(),children:S.t(`Save`)}),m(O,{variant:`contained`,onClick:()=>this.props.onClose(),color:`grey`,startIcon:m(P,{}),children:S.t(`Close`)})]})]})}};c();var tn=new Set([`admin`,`eos-admin`,`backitup`,`nexowatt-devices`,`nexowatt-device`,`nexowatt-dev`,`nexowatt-ui`]),nn=e=>String(e||``).toLowerCase().replace(/^system\.adapter\./,``).replace(/^iobroker\./,``).replace(/^@nexowatt\/iobroker\./,``).replace(/^@nexowatt\//,``).replace(/\.\d+$/,``),rn=e=>{let t=nn(e);return tn.has(t)},an={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:Je[700]},updateAvailable:{color:v[700]},repositoryVersionAvailable:{color:h[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:h[500]},cardContentFlexBetween:{},cardContentFlex:{}},on=class e extends K{constructor(e){super(e),C(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 m(`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 m(V,{value:e!==!1&&!K.isSingletonInstalled(this.props.adapterName,this.props.context),children:m(j,{title:this.props.context.t(`Add instance`),slotProps:{popper:{sx:this.styles.tooltip}},children:m(F,{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:m(We,{})})})})}renderAutoUpgradeButton(){var e;let t=this.props.context.hostAdapterWorker.getObject(this.props.adapterName);if(!t)return m(`div`,{style:{width:34,height:34,display:`inline-block`}});let n=(e=t.common)==null?void 0:e.automaticUpgrade;return m(j,{title:this.props.context.t(`Automatic Upgrade Policy`)+(n?`: ${n}`:``),slotProps:{popper:{sx:this.styles.tooltip}},children:m(F,{size:`small`,onClick:e=>{e.preventDefault(),e.stopPropagation(),this.setState({autoUpgradeDialogOpen:!0,showDialog:!0})},children:!n||n===`none`?m(at,{}):$t[n]})})}renderReadmeButton(){let e=!this.props.context.repository[this.props.adapterName]||this.props.context.repository[this.props.adapterName].allowAdapterReadme;return m(V,{value:e,children:m(j,{title:this.props.context.t(`Readme`),slotProps:{popper:{sx:this.styles.tooltip}},children:m(F,{size:`small`,onClick:e=>{e.preventDefault(),e.stopPropagation(),this.openInfoDialog()},children:m(ne,{})})})})}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:m(`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:m(Fe,{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`?m(j,{title:this.props.context.t(`Adapter requires the specific cloud access for these devices/service`),slotProps:{popper:{sx:this.styles.tooltip}},children:m(xt,{})}):t===`local`?m(j,{title:this.props.context.t(`Adapter does not use the cloud for these devices/service`),slotProps:{popper:{sx:this.styles.tooltip}},children:m(Ze,{})}):null}renderDataSource(){var e;let t=(e=this.props.context.repository[this.props.adapterName])==null?void 0:e.dataSource;return t?m(`div`,{style:this.styles.marginLeft5,title:t,children:t===`poll`?m(j,{title:this.props.context.t(`The device or service will be periodically asked`),slotProps:{popper:{sx:this.styles.tooltip}},children:m(ke,{style:this.styles.classPoll})}):t===`push`?m(j,{title:this.props.context.t(`The device or service delivers the new state actively`),slotProps:{popper:{sx:this.styles.tooltip}},children:m(te,{style:this.styles.classPush})}):t===`assumption`?m(j,{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:m(ut,{style:this.styles.classAssumption})}):m(`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=Rt(a),s=(t=a.licenseInformation)!=null&&t.type?m(re,{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`?m(j,{title:this.props.context.t(`The adapter requires a paid license.`),slotProps:{popper:{sx:this.styles.tooltip}},children:m(Ye,{})}):((r=a.licenseInformation)==null?void 0:r.type)===`commercial`?m(j,{slotProps:{popper:{sx:this.styles.tooltip}},title:this.props.context.t(`The adapter requires a paid license for commercial use.`),children:m(Ye,{opacity:.5})}):((i=a.licenseInformation)==null?void 0:i.type)===`limited`?m(j,{slotProps:{popper:{sx:this.styles.tooltip}},title:this.props.context.t(`The adapter has a limited functionality without a paid license.`),children:m(Ye,{opacity:.5})}):null}):null;return!s&&e?m(`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?m(`div`,{style:this.styles.marginLeft5,children:m(j,{title:`sentry`,slotProps:{popper:{sx:this.styles.tooltip}},children:m(ce,{style:this.styles.sentry,component:`img`,image:Ot})})}):null}getDependencies(){let e=K.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)=>m(`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()?m(j,{title:this.props.context.t(`Install version %s from repository`,n),slotProps:{popper:{sx:this.styles.tooltip}},children:w(`div`,{onClick:()=>this.setState({showUpdateDialog:!0,showDialog:!0,installRepositoryVersion:!0}),style:{...this.styles.buttonUpdate,...this.props.cached.rightDependencies?this.styles.repositoryVersionAvailable:void 0},children:[m(F,{style:this.styles.buttonUpdateIcon,size:`small`,children:m(bt,{})}),n]})}):!this.props.commandRunning&&this.props.cached.updateAvailable&&e!==!1?m(j,{title:this.props.context.t(`Update`),slotProps:{popper:{sx:this.styles.tooltip}},children:w(`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:[m(F,{style:this.styles.buttonUpdateIcon,size:`small`,children:m(ye,{})}),n]})}):m(j,{title:this.getDependencies(),slotProps:{popper:{sx:this.styles.tooltip}},children:m(`span`,{style:this.props.cached.rightDependencies?void 0:this.styles.wrongDependencies,children:n})}):m(`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 ht.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 w(d,{container:!0,wrap:`nowrap`,spacing:1,sx:{alignItems:`center`},children:[this.installedVersion?m(d,{children:c+(t?` (${t}${t===e?``:`~`})`:``)}):null,o&&m(d,{container:!0,children:m(j,{title:`${this.props.context.t(`Non-NPM-Version`)}: ${i}`,slotProps:{popper:{sx:this.styles.tooltip}},children:m(st,{fontSize:`small`,style:this.styles.versionWarn})})})]})}return this.installedVersion?w(k,{component:`span`,style:this.styles.cardContentFlexBetween,children:[w(`div`,{children:[this.props.context.t(`Installed version`),`:`]}),w(`div`,{style:this.styles.cardContentFlex,children:[o&&m(j,{title:`${this.props.context.t(`Non-NPM-Version`)}: ${i}`,slotProps:{popper:{sx:this.styles.tooltip}},children:m(st,{fontSize:`small`,style:this.styles.versionWarn})}),c]})]}):null}renderUploadButton(){return this.props.context.expertMode&&this.installedVersion?m(j,{title:this.props.context.t(`Upload`),slotProps:{popper:{sx:this.styles.tooltip}},children:m(F,{size:`small`,disabled:this.props.commandRunning,"data-eos-adapter-action":`upload`,onClick:e=>{e.preventDefault(),e.stopPropagation(),this.onUpload()},children:m(Ce,{})})}):null}renderDeleteButton(){let e=rn(this.props.adapterName);return m(V,{value:!!this.installedVersion&&!e,children:m(j,{title:this.props.context.t(`Delete adapter`),slotProps:{popper:{sx:this.styles.tooltip}},children:m(F,{size:`small`,disabled:this.props.commandRunning,"data-eos-adapter-action":`delete`,onClick:e=>{e.preventDefault(),e.stopPropagation(),this.setState({adapterDeletionDialog:!0,showDialog:!0})},children:m(lt,{})})})})}renderInstallSpecificVersionButton(){return this.props.context.expertMode&&this.installedVersion?m(j,{title:this.props.context.t(`Install a specific version`),slotProps:{popper:{sx:this.styles.tooltip}},children:m(F,{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:m(rt,{})})}):null}renderRebuildButton(){return!this.props.context.expertMode||!this.installedVersion?null:m(j,{title:this.props.context.t(`Rebuild`),children:m(F,{size:`small`,disabled:this.props.commandRunning,"data-eos-adapter-action":`rebuild`,onClick:e=>{e.preventDefault(),e.stopPropagation(),this.rebuild()},children:m(a,{})})})}renderAutoUpdateDialog(){return this.state.autoUpgradeDialogOpen?m(en,{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 m(Mt,{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:K.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)=>w(`div`,{style:{},children:[m(`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 m(Nt,{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:w(`div`,{style:{height:`100%`,overflowY:`hidden`},children:[w(`div`,{style:this.styles.containerSpecificVersion,children:[w(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[m(B,{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?m(g,{position:`end`,children:m(F,{tabIndex:-1,size:`small`,onClick:()=>this.setState({adapterInstallSpecificVersion:``}),children:m(P,{})})}):null}}}),m(O,{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`)})]}),m(j,{title:this.props.context.t(`npmjs.com`),slotProps:{popper:{sx:this.styles.tooltip}},children:m(F,{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:m(Oe,{})})})]}),m(D,{component:`div`,sx:this.styles.header,children:this.props.context.t(`Or select from the list`)}),m(`div`,{style:{...this.styles.containerVersion,height:`calc(100% - 122px)`,overflowY:`auto`},children:this.getNews(!0).map(({version:r,news:i})=>m(se,{variant:`outlined`,sx:this.styles.currentVersion,onClick:()=>{this.update(r),this.setState({showInstallVersion:!1,showDialog:!1})},children:w(Ge,{children:[w(k,{sx:f.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?m(D,{component:`span`,sx:this.styles.currentVersionText,children:`(${this.props.context.t(`current`)})`}):null,n===r?m(D,{component:`span`,sx:this.styles.repoLatestVersionText,children:`(latest)`}):null,t===r?m(D,{component:`span`,sx:this.styles.repoStableVersionText,children:`(${this.props.context.t(`stable`)})`}):null]}),m(k,{variant:`body2`,style:{opacity:.7},children:e.formatNews(i)})]})},r))})]})})}renderSetRatingDialog(){return this.state.showSetRating?m(Xt,{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?m(Qt,{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(ht.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(L.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=zt(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}):K.upload(this.props.adapterName,this.props.context)}delete(e){rn(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?w(T,{children:[this.renderAddInstanceDialog(this.props.context),this.renderLicenseDialog(this.props.context),this.renderUpdateAdapterDialog(),this.renderAdapterInstallVersion(),this.renderSetRatingDialog(),this.renderAdapterDeletionDialog(),this.renderAutoUpdateDialog()]}):null}};c();var sn=`0 8px 17px 0 rgba(0, 0, 0, .2),0 6px 20px 0 rgba(0, 0, 0, .19)`,cn={...an,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:sn}}),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:h[500],marginRight:5},rating:{marginTop:20}},ln=class extends on{constructor(e){super(e),C(this,`styles`,cn),Object.assign(this.state,{openCollapse:!1})}renderInfoCard(){return w(`div`,{className:`eos-adapter-info-card`,style:this.styles.collapse,children:[w(Ge,{style:this.styles.cardContent,children:[m(`div`,{style:this.styles.cardContentDiv,children:m(F,{size:`small`,sx:this.styles.close,onClick:()=>this.setState({openCollapse:!this.state.openCollapse}),children:m(P,{})})}),m(k,{gutterBottom:!0,component:`span`,variant:`body2`,sx:this.styles.description,children:this.props.cached.desc})]}),w(D,{component:`div`,sx:this.styles.footerBlock,children:[this.renderAddInstanceButton(),w(`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 w(D,{component:`div`,sx:f.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:[m(ce,{sx:this.styles.img,component:e=>on.renderImage(e),src:this.props.cached.image||`img/no-image.svg`,image:this.props.cached.image||`img/no-image.svg`}),m(D,{component:`div`,sx:f.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?m(`div`,{style:this.styles.versionDate,children:e.stat}):null,this.props.context.sortRecentlyUpdated?m(`div`,{style:this.styles.versionDate,children:this.props.cached.daysAgoText}):null,this.props.context.sortRecentlyCreated?m(`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:m(j,{title:this.props.context.t(`Info`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:m(Ke,{onClick:()=>this.setState({openCollapse:!this.state.openCollapse}),style:this.styles.fab,color:`primary`,"aria-label":`add`,children:m(ze,{})})})]})}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 w(Ge,{style:this.styles.cardContent2,children:[m(k,{gutterBottom:!0,variant:`h5`,component:`h5`,children:this.props.cached.title}),w(`div`,{style:this.styles.cardContentFlex,children:[this.renderConnectionType(),this.renderDataSource(),m(`div`,{children:this.renderLicenseInfo()}),this.renderSentryInfo()]}),w(`div`,{style:this.styles.cardMargin10,children:[t!=null&&t.count?w(k,{component:`span`,style:this.styles.cardContentFlexBetween,children:[w(`div`,{children:[this.props.context.t(`Installed instances`),`:`]}),m(`div`,{children:t.count})]}):null,m(V,{value:e,children:w(k,{component:`span`,style:this.styles.availableVersion,children:[m(`div`,{children:this.props.context.t(`Available version:`)}),m(D,{component:`div`,sx:f.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,w(se,{sx:this.styles.root,children:[this.state.openCollapse?this.renderInfoCard():null,this.renderCardMedia(),this.renderCardContent(),this.renderDialogs()]})}};c();var un={...an,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`}},dn=class extends on{constructor(...e){super(...e),C(this,`styles`,un)}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,w(N,{hover:!0,children:[m(M,{}),m(M,{children:w(d,{container:!0,spacing:1,style:this.styles.name,sx:{alignItems:`center`},children:[m(j,{title:this.props.adapterName,slotProps:{popper:{sx:this.styles.tooltip}},children:m(d,{style:this.styles.paddingNone,children:m(we,{variant:`square`,alt:this.props.cached.title,src:this.props.cached.image,style:this.styles.smallAvatar})})}),r===!1?m(d,{children:this.props.cached.title}):w(d,{style:this.styles.nameCell,children:[m(`div`,{children:this.props.cached.title}),this.renderRating()]})]})}),!this.props.context.descHidden&&m(M,{title:this.props.cached.desc,style:{width:20,wordWrap:`break-word`},children:this.props.cached.desc}),m(M,{children:w(`div`,{style:this.styles.flex,children:[this.renderConnectionType()||m(`div`,{style:{width:24,height:24}}),this.renderDataSource()||m(`div`,{style:{marginLeft:5,width:24,height:24}}),this.renderSentryInfo()||m(`div`,{style:{marginLeft:5,width:24,height:24}}),this.renderLicenseInfo(!0)]})}),m(M,{children:this.renderInstalledVersion(!0)}),m(M,{children:m(d,{container:!0,sx:{alignItems:`center`},children:this.renderVersion()})}),m(M,{style:{fontSize:`smaller`},children:(n==null||(t=n.licenseInformation)==null?void 0:t.license)||(n==null?void 0:n.license)}),w(M,{children:[this.renderAddInstanceButton(),this.renderAutoUpgradeButton(),this.renderReadmeButton(),this.renderUploadButton(),this.renderDeleteButton(),this.renderInstallSpecificVersionButton(),this.renderRebuildButton()]}),this.renderDialogs()]})}};c();var fn=246,Y={emptyBlock:50,name:300,connectionType:120,installed:120,available:120,update:40,license:80,install:fn},pn=Object.keys(Y).reduce((e,t)=>e+Y[t],0),X={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:Y.name},emptyBlock:{flexWrap:`nowrap`,width:Y.emptyBlock},description:{width:`calc(100% - ${pn+2}px)`},connectionType:{width:Y.connectionType},installed:{width:Y.installed},available:{width:Y.available,paddingRight:6},update:{width:Y.update,padding:0},license:{width:Y.license},install:{width:Y.install},viewModeDiv:{display:`flex`,flexFlow:`wrap`,overflow:`auto`,justifyContent:`center`}},mn=class extends z{constructor(e){super(e),C(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?m(dn,{context:t,adapterName:e,cached:r,commandRunning:this.state.commandRunning,noTranslation:this.state.noTranslation},`adapter-${e}`):null}getRows(e){if(!this.props.listOfVisibleAdapter)return m(N,{children:m(M,{colSpan:8,children:m(E,{})})});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(m(N,{children:m(M,{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++,w(Ne,{children:[m(Jt,{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:m(`tr`,{children:w(`td`,{colSpan:8,style:{textAlign:`center`},children:[this.props.searchFilter||this.props.installedListFilter?m(O,{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)?m(`br`,{}):null,this.props.updateListFilter?m(O,{style:{marginTop:16},variant:`outlined`,onClick:()=>this.props.clearAllFilters(!0),startIcon:m(Tt,{}),children:this.props.context.t(`Remove filter for updatable adapters`)}):null]})})}getTiles(e){if(!this.props.listOfVisibleAdapter)return m(E,{});if(!this.props.listOfVisibleAdapter.length)return this.props.update?null:w(`div`,{style:{width:`100%`,display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`center`,gap:16},children:[this.props.searchFilter||this.props.installedListFilter?m(j,{title:this.props.context.t(`Click to clear all filters`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:m(O,{variant:`outlined`,onClick:()=>this.props.clearAllFilters(),children:this.props.context.t(`all items are filtered out`)})}):null,this.props.updateListFilter?m(O,{variant:`outlined`,onClick:()=>this.props.clearAllFilters(!0),startIcon:m(Tt,{}),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(m(ln,{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(m(`div`,{style:{flexBasis:`100%`,height:0}},`newLine`)),t.push(m(`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 w(T,{children:[this.shouldShowRepositoryWarning(e,t)?m(D,{sx:{marginX:2,marginTop:1,width:`calc(100% - 32px)`},children:m(r,{type:`warning`,children:this.props.context.t(`Active repo is "%s"`,t)})}):null,m(`div`,{style:X.viewModeDiv,children:this.getTiles(n)})]})}renderTableView(e,t,n){return w(qe,{children:[this.shouldShowRepositoryWarning(e,t)?m(D,{sx:{marginX:2,marginTop:1,width:`calc(100% - 32px)`},children:m(r,{type:`warning`,children:this.props.context.t(`Active repo is "%s"`,t)})}):null,m(Ie,{style:{...X.container,...e?X.containerFullHeight:X.containerNotFullHeight},children:w(xe,{stickyHeader:!0,size:`small`,sx:X.table,children:[m(Te,{children:w(N,{children:[m(M,{style:X.emptyBlock}),m(M,{style:X.name,children:m(k,{children:this.props.context.t(`Name`)})}),!n.descHidden&&m(M,{style:{...X.description,width:this.props.descWidth},children:m(k,{children:this.props.context.t(`Description`)})}),m(M,{style:X.connectionType}),m(M,{style:X.installed,children:m(k,{children:this.props.context.t(`Installed`)})}),m(M,{style:X.available,children:m(k,{children:this.props.context.t(`Available`)})}),m(M,{style:X.license,children:m(k,{children:this.props.context.t(`License`)})}),m(M,{style:{...X.install,width:this.state.expertMode?fn:178},children:m(k,{children:this.props.context.t(`Install`)})})]})}),m(Be,{children:this.getRows(n)})]})})]})}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):m(E,{})}};c();var hn=class extends z{constructor(e){super(e),C(this,`updating`,void 0),C(this,`interval`,null),C(this,`startTimeout`,null),C(this,`textareaRef`,void 0),C(this,`link`,void 0),C(this,`oldVersion`,void 0),this.state={response:null,error:null,starting:!0,upAgain:!1},this.updating=!1,this.textareaRef=I.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:[S.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(S.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(S.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,a,o;return w(A,{onClose:(e,t)=>{t!==`escapeKeyDown`&&t!==`backdropClick`&&this.props.onClose()},open:!0,maxWidth:`lg`,fullWidth:!0,children:[m(l,{children:S.t(`Updating %s...`,`eos-admin`)}),w(b,{style:{height:400,padding:`0 20px`,overflow:`hidden`},children:[(!this.state.response||this.state.response.running)&&!this.state.error?m(E,{}):null,this.state.response||this.state.error?m(`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{Hs as e,Tr as t,jr as n,mo as r,qo as i,t as a}from"./loadShare-eager-CRNcc8D7.js";import{n as o,t as s}from"./PushPinOutlined-DvxsqPHo.js";import{N as c,P as l}from"./bootstrap-
|
|
1
|
+
import{Hs as e,Tr as t,jr as n,mo as r,qo as i,t as a}from"./loadShare-eager-CRNcc8D7.js";import{n as o,t as s}from"./PushPinOutlined-DvxsqPHo.js";import{N as c,P as l}from"./bootstrap-D-7xcwTc.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 n{constructor(e){super(e);let t=n.getLocation().id||window.localStorage.getItem(`dmSelectedInstance`)||``;this.state={instance:t,pinned:t?c(t):!1,listKey:t}}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 e=n.getLocation().id;e&&e!==this.state.instance&&this.setState({instance:e,pinned:c(e),listKey:e})}renderPinButton(){return this.state.instance?e(r,{title:t.t(this.state.pinned?`Remove from navigation`:`Pin to navigation`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:e(i,{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?e(o,{style:u.pinnedIcon}):e(s,{})})}):null}render(){return e(`div`,{style:u.root,children:e(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:e=>{this.setState({instance:e,pinned:e?c(e):!1}),n.doNavigate(`tab-devicemanager`,`tab`,e)}},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,$i as n,$o as r,Cr as i,Do as a,Dr as o,Eo as s,Es as c,Fo as l,Ga as u,Go as d,Gr as f,Ho as p,Hs as m,Js as h,Mo as g,No as _,Oo as ee,Or as v,Po as te,Qa as y,Qi as b,Rr as x,Sa as S,So as C,Sr as ne,Ts as w,Ua as T,Us as E,Vs as D,Xa as re,Ya as ie,Ys as ae,Zi as oe,Zo as se,Zs as ce,_a as le,_o as O,ao as ue,ar as de,bo as k,br as A,co as fe,cr as j,cs as pe,da as me,dc as M,do as he,ds as N,ec as P,eo as ge,fc as _e,fo as ve,ho as F,io as ye,is as be,jo as xe,ka as Se,kr as Ce,ma as we,mc as Te,mo as I,ms as Ee,no as L,ns as De,oo as R,os as Oe,pc as z,qa as ke,qo as B,qr as Ae,qs as V,ro as je,rs as Me,sc as H,si as Ne,sr as Pe,ss as Fe,tc as Ie,to as Le,tr as Re,uc as U,uo as ze,wi as Be,wr as Ve,xa as He,xi as Ue,xo as We,xr as Ge,yr as Ke,ys as qe,zr as Je}from"./loadShare-eager-CRNcc8D7.js";import{a as Ye,i as Xe,n as Ze,o as Qe,r as $e,s as et,t as tt}from"./ViewSidebar-kHvah-XS.js";import{n as nt,r as rt,t as it}from"./Pageview-DBITLOzI.js";import{n as at,t as ot}from"./KeyboardArrowRight-zZUJhG9e.js";import{t as st}from"./InfoOutlined-l86Si1qa.js";import{n as ct,t as lt}from"./UnfoldMore-Du7-8wYn.js";import{t as ut}from"./AdminUtils-DDT_kD8H.js";import{B as dt,H as ft,L as pt,R as mt,Tt as ht,W as gt,yt as _t,z as vt}from"./bootstrap-
|
|
1
|
+
import{t as e}from"./rolldown-runtime-sJBDdmOt.js";import{$a as t,$i as n,$o as r,Cr as i,Do as a,Dr as o,Eo as s,Es as c,Fo as l,Ga as u,Go as d,Gr as f,Ho as p,Hs as m,Js as h,Mo as g,No as _,Oo as ee,Or as v,Po as te,Qa as y,Qi as b,Rr as x,Sa as S,So as C,Sr as ne,Ts as w,Ua as T,Us as E,Vs as D,Xa as re,Ya as ie,Ys as ae,Zi as oe,Zo as se,Zs as ce,_a as le,_o as O,ao as ue,ar as de,bo as k,br as A,co as fe,cr as j,cs as pe,da as me,dc as M,do as he,ds as N,ec as P,eo as ge,fc as _e,fo as ve,ho as F,io as ye,is as be,jo as xe,ka as Se,kr as Ce,ma as we,mc as Te,mo as I,ms as Ee,no as L,ns as De,oo as R,os as Oe,pc as z,qa as ke,qo as B,qr as Ae,qs as V,ro as je,rs as Me,sc as H,si as Ne,sr as Pe,ss as Fe,tc as Ie,to as Le,tr as Re,uc as U,uo as ze,wi as Be,wr as Ve,xa as He,xi as Ue,xo as We,xr as Ge,yr as Ke,ys as qe,zr as Je}from"./loadShare-eager-CRNcc8D7.js";import{a as Ye,i as Xe,n as Ze,o as Qe,r as $e,s as et,t as tt}from"./ViewSidebar-kHvah-XS.js";import{n as nt,r as rt,t as it}from"./Pageview-DBITLOzI.js";import{n as at,t as ot}from"./KeyboardArrowRight-zZUJhG9e.js";import{t as st}from"./InfoOutlined-l86Si1qa.js";import{n as ct,t as lt}from"./UnfoldMore-Du7-8wYn.js";import{t as ut}from"./AdminUtils-DDT_kD8H.js";import{B as dt,H as ft,L as pt,R as mt,Tt as ht,W as gt,yt as _t,z as vt}from"./bootstrap-D-7xcwTc.js";import{n as yt,r as bt,t as xt}from"./Fields-Df7Llf6U.js";var St=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}})),Ct=e(((e,t)=>{t.exports=St()}))();function wt(e,t){let n=getComputedStyle(t);if(!n)return;let r=e===G.Horizontal?t.clientWidth:t.clientHeight;return r===0?void 0:(e===G.Horizontal?r-=parseFloat(n.paddingLeft)+parseFloat(n.paddingRight):r-=parseFloat(n.paddingTop)+parseFloat(n.paddingBottom),r)}function Tt(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{Hs as e,Jo as t,Mr as n,Us as r,Vo as i,Xs as a,fc as o,qa as s,qo as c,uo as l}from"./loadShare-eager-CRNcc8D7.js";import{V as u}from"./bootstrap-
|
|
1
|
+
import{Hs as e,Jo as t,Mr as n,Us as r,Vo as i,Xs as a,fc as o,qa as s,qo as c,uo as l}from"./loadShare-eager-CRNcc8D7.js";import{V as u}from"./bootstrap-D-7xcwTc.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(n){let a=n.icon;return r(`div`,{style:n.styles.formContainer,children:[a?e(a,{style:n.styles.formIcon}):null,e(i,{style:n.styles.formControl,variant:`standard`,children:e(l,{variant:`standard`,label:n.t(n.label),autoComplete:n.autoComplete,error:!!n.error,helperText:n.error||``,value:n.value,onChange:e=>{var t;return(t=n.onChange)==null?void 0:t.call(n,e.target.value)},disabled:n.disabled,type:n.type,slotProps:{inputLabel:{shrink:!0},input:{readOnly:!1,endAdornment:n.value?e(t,{position:`end`,children:e(c,{tabIndex:-1,size:`small`,onClick:()=>{var e;return(e=n.onChange)==null?void 0:e.call(n,``)},children:e(s,{})})}):null}}})})]})}function b(t){let i=t.icon;return r(`div`,{style:{width:`100%`},children:[i?e(i,{style:t.previewStyle||t.styles.formIcon}):null,e(n,{style:{...t.style||void 0,width:i?`calc(100% - 45px)`:`100%`,display:`inline-block`,verticalAlign:`top`},label:t.t(t.label),onChange:t.onChange,value:t.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{Eo as n,Es as r,Hs as i,Pr as a,Qa as o,Rr as s,Tr as c,Ts as l,Us as u,Zo as d,c as f,jr as p,pc as m,sc as h,tc as g,ur as _,vr as v,zr as y}from"./loadShare-eager-CRNcc8D7.js";import{t as b}from"./AdminUtils-DDT_kD8H.js";import{M as x}from"./bootstrap-Bs4TZ7iA.js";import{t as S}from"./CustomModal-B8vdCRn1.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(f(),1);E(),r();var k=O.require?O.require(`ace/ext/modelist`):O.acequire(`ace/ext/modelist`),A=class e extends v{constructor(e){super(e),l(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:r,differentValues:a,applyToChildren:o,mask:s,setMask:c,disabled:l})=>{h(()=>{if(o){let t=0;for(let n=0;n<a.length;n++)t|=e^a[n];c(t)}else c(0)},[a,o,c,e]);let d=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,d.add(t.valueNum));return i(`div`,{style:{display:`flex`,width:`fit-content`,margin:20,border:`1px solid`,borderLeft:0},children:j.map(a=>{let o=Object.keys(a)[0];return u(`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:r(o)}),i(`div`,{style:{display:`flex`,width:`100%`},children:a[o].map((a,o)=>{let f=d.has(a.valueNum),p=s&a.valueNum;return u(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1,alignItems:`center`,borderRight:o===0?`1px solid`:0},children:[i(`div`,{style:{height:50,borderBottom:`1px solid`,width:`100%`,justifyContent:`center`,display:`flex`,alignItems:`center`,color:`silver`},children:r(a.name)}),i(`div`,{style:{height:50,display:`flex`},children:i(n,{disabled:l,checked:f,color:p?`primary`:`secondary`,indeterminate:!!p,style:p?{opacity:.5}:void 0,onChange:n=>{p&&(s&=~a.valueNum&65535,c(s));let r=e;n.target.checked?r|=a.valueNum:r&=~a.valueNum&65535,t(r)}})})]},a.valueNum)})})]},o)})})};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:s,objects:l,t:f,themeType:p,folders:g,socket:_,theme:v})=>{let y=n.substring(0,n.lastIndexOf(`/`))||n,b=(n.split(`/`).length===1?g[`/`].find(({id:e})=>e===n):g[y].find(({id:e})=>e===n))||{},[x,C]=m(null),[w,T]=m(null),[E,D]=m([]),[O,k]=m([]),[A,j]=m(!1),[N,ne]=m(0),[I,L]=m(null),[R,z]=m(!1),[B,V]=m(!1),[H,U]=m([]),[W,G]=m(0),[K,re]=m([]),[q,J]=m(!0),[Y,ie]=m(!1),X=c.getLanguage();return h(()=>{let e=[],t=b.id,n=!1,r=!1,i=null,a=null,o=null,s=[],c=0;P(_,g,t).then(()=>{let u=te(g),d=`${t}/`;Object.keys(u).forEach(f=>{if(f!==`/`&&(f===t||f.startsWith(d))){if(!f.includes(`/`)&&l[f]){var p,m,h,g,_,v,y,b,x;let t=l[f];c++,s.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;c++;let t=u[f];if(s.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(l).forEach(e=>{let t=l[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 m=l[`system.config`].common.defaultNewAcl;i||=m.owner,a||=m.ownerGroup,o||=m.file,L(o),C(i),T(a),z(n),V(r),D(f),k(p),b!=null&&b.folder&&j(!0),ne(c),U(e),re(s)})},[l,n]),h(()=>{if(A)R&&x!==F&&C(F),B&&w!==F&&T(F);else{if(x&&x===F){var e;C(((e=l[n])==null||(e=e.acl)==null?void 0:e.owner)||null)}if(w&&w===F){var t;T(((t=l[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=l[`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 l=K[t],m=!1,h=l,g=l;if(h._id){var i,a,o,c;let t=M(((i=h.acl)==null?void 0:i.file)||n,I??0,e);t!==((a=h.acl)==null?void 0:a.file)&&(h.acl=h.acl||{},h.acl.file=t,m=!0),x!==F&&x!==((o=h.acl)==null?void 0:o.owner)&&(h.acl=h.acl||{},h.acl.owner=x??``,m=!0),w!==F&&w!==((c=h.acl)==null?void 0:c.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 s(n,r,t)}catch(e){console.error(e)}}}}}else{let e=b.id.split(`/`),t=e.shift()||``,n=e.join(`/`),i={},a=!1;if(!b.folder){var m,h,g;((m=b.acl)==null?void 0:m.permissions)!==I&&(i.permissions=I??void 0,a=!0),((h=b.acl)==null?void 0:h.owner)!==x&&(i.owner=x??void 0,a=!0),((g=b.acl)==null?void 0:g.ownerGroup)!==w&&(i.ownerGroup=w??void 0,a=!0),a&&await s(t,n,i)}else if(!e.length&&l[b.id]){var _,v,y;let e=l[b.id];((_=e.acl)==null?void 0:_.file)!==I&&(e.acl=e.acl||{},e.acl.file=I??0,a=!0),((v=e.acl)==null?void 0:v.owner)!==x&&(e.acl=e.acl||{},e.acl.owner=x??``,a=!0),((y=e.acl)==null?void 0:y.ownerGroup)!==w&&(e.acl=e.acl||{},e.acl.ownerGroup=w??``,a=!0),a&&await r(e)}}ie(!1),t()},200)},children:u(`div`,{style:{display:`flex`,flexDirection:`column`},children:[i(`div`,{style:{margin:10,fontSize:20},children:f(`Access control list: %s`,n)}),u(`div`,{style:{display:`flex`},children:[i(a,{fullWidth:!0,style:{marginRight:10},label:f(`Owner user`),lang:X,list:E,t:f,disabled:Y,value:x||void 0,themeType:p,different:R?F:!1,onChange:e=>{z(!1),C(e),J(!1)}}),i(a,{fullWidth:!0,label:f(`Owner group`),lang:X,list:O,t:f,disabled:Y,value:w||void 0,themeType:p,different:B?F:!1,onChange:e=>{V(!1),T(e),J(!1)}})]}),u(`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:f(`to apply one item`)}),i(o,{disabled:K.length===1||Y,checked:!l[b.id]&&!!b.folder||A,onChange:e=>{j(e.target.checked),J(!1)},color:`primary`}),u(`div`,{style:b.folder||A?{color:`green`}:void 0,children:[f(`to apply with children`),` `,b.folder||N>1?`(${N} ${f(`object(s)`)})`:``]})]}),Y&&i(d,{}),i(`div`,{style:{overflowY:`auto`},children:u(`div`,{children:[i(`h2`,{children:f(`File rights`)}),i(ee,{disabled:Y,mask:W,setMask:G,applyToChildren:A,differentValues:H,t:f,setValue:e=>{L(e),J(!1)},value:I??0})]})})]})}):i(d,{})};r();var I=[`select`,`view`],L=class e extends g{constructor(e){super(e),l(this,`t`,void 0),l(this,`wordCache`,void 0),l(this,`objects`,void 0),l(this,`navigateTo`,null),l(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=p.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(d,{});if(!e.isAppDialogOpen()){let e=p.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(s,{children:i(y,{overflow:`auto`,children:i(_,{navigateTo:t,onNavigateTo:t=>{e.isAppDialogOpen()||(t!=null&&t.id?p.doNavigate(`tab-files`,t.mode,t.id):p.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{Eo as n,Es as r,Hs as i,Pr as a,Qa as o,Rr as s,Tr as c,Ts as l,Us as u,Zo as d,c as f,jr as p,pc as m,sc as h,tc as g,ur as _,vr as v,zr as y}from"./loadShare-eager-CRNcc8D7.js";import{t as b}from"./AdminUtils-DDT_kD8H.js";import{M as x}from"./bootstrap-D-7xcwTc.js";import{t as S}from"./CustomModal-B8vdCRn1.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(f(),1);E(),r();var k=O.require?O.require(`ace/ext/modelist`):O.acequire(`ace/ext/modelist`),A=class e extends v{constructor(e){super(e),l(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:r,differentValues:a,applyToChildren:o,mask:s,setMask:c,disabled:l})=>{h(()=>{if(o){let t=0;for(let n=0;n<a.length;n++)t|=e^a[n];c(t)}else c(0)},[a,o,c,e]);let d=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,d.add(t.valueNum));return i(`div`,{style:{display:`flex`,width:`fit-content`,margin:20,border:`1px solid`,borderLeft:0},children:j.map(a=>{let o=Object.keys(a)[0];return u(`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:r(o)}),i(`div`,{style:{display:`flex`,width:`100%`},children:a[o].map((a,o)=>{let f=d.has(a.valueNum),p=s&a.valueNum;return u(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1,alignItems:`center`,borderRight:o===0?`1px solid`:0},children:[i(`div`,{style:{height:50,borderBottom:`1px solid`,width:`100%`,justifyContent:`center`,display:`flex`,alignItems:`center`,color:`silver`},children:r(a.name)}),i(`div`,{style:{height:50,display:`flex`},children:i(n,{disabled:l,checked:f,color:p?`primary`:`secondary`,indeterminate:!!p,style:p?{opacity:.5}:void 0,onChange:n=>{p&&(s&=~a.valueNum&65535,c(s));let r=e;n.target.checked?r|=a.valueNum:r&=~a.valueNum&65535,t(r)}})})]},a.valueNum)})})]},o)})})};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:s,objects:l,t:f,themeType:p,folders:g,socket:_,theme:v})=>{let y=n.substring(0,n.lastIndexOf(`/`))||n,b=(n.split(`/`).length===1?g[`/`].find(({id:e})=>e===n):g[y].find(({id:e})=>e===n))||{},[x,C]=m(null),[w,T]=m(null),[E,D]=m([]),[O,k]=m([]),[A,j]=m(!1),[N,ne]=m(0),[I,L]=m(null),[R,z]=m(!1),[B,V]=m(!1),[H,U]=m([]),[W,G]=m(0),[K,re]=m([]),[q,J]=m(!0),[Y,ie]=m(!1),X=c.getLanguage();return h(()=>{let e=[],t=b.id,n=!1,r=!1,i=null,a=null,o=null,s=[],c=0;P(_,g,t).then(()=>{let u=te(g),d=`${t}/`;Object.keys(u).forEach(f=>{if(f!==`/`&&(f===t||f.startsWith(d))){if(!f.includes(`/`)&&l[f]){var p,m,h,g,_,v,y,b,x;let t=l[f];c++,s.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;c++;let t=u[f];if(s.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(l).forEach(e=>{let t=l[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 m=l[`system.config`].common.defaultNewAcl;i||=m.owner,a||=m.ownerGroup,o||=m.file,L(o),C(i),T(a),z(n),V(r),D(f),k(p),b!=null&&b.folder&&j(!0),ne(c),U(e),re(s)})},[l,n]),h(()=>{if(A)R&&x!==F&&C(F),B&&w!==F&&T(F);else{if(x&&x===F){var e;C(((e=l[n])==null||(e=e.acl)==null?void 0:e.owner)||null)}if(w&&w===F){var t;T(((t=l[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=l[`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 l=K[t],m=!1,h=l,g=l;if(h._id){var i,a,o,c;let t=M(((i=h.acl)==null?void 0:i.file)||n,I??0,e);t!==((a=h.acl)==null?void 0:a.file)&&(h.acl=h.acl||{},h.acl.file=t,m=!0),x!==F&&x!==((o=h.acl)==null?void 0:o.owner)&&(h.acl=h.acl||{},h.acl.owner=x??``,m=!0),w!==F&&w!==((c=h.acl)==null?void 0:c.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 s(n,r,t)}catch(e){console.error(e)}}}}}else{let e=b.id.split(`/`),t=e.shift()||``,n=e.join(`/`),i={},a=!1;if(!b.folder){var m,h,g;((m=b.acl)==null?void 0:m.permissions)!==I&&(i.permissions=I??void 0,a=!0),((h=b.acl)==null?void 0:h.owner)!==x&&(i.owner=x??void 0,a=!0),((g=b.acl)==null?void 0:g.ownerGroup)!==w&&(i.ownerGroup=w??void 0,a=!0),a&&await s(t,n,i)}else if(!e.length&&l[b.id]){var _,v,y;let e=l[b.id];((_=e.acl)==null?void 0:_.file)!==I&&(e.acl=e.acl||{},e.acl.file=I??0,a=!0),((v=e.acl)==null?void 0:v.owner)!==x&&(e.acl=e.acl||{},e.acl.owner=x??``,a=!0),((y=e.acl)==null?void 0:y.ownerGroup)!==w&&(e.acl=e.acl||{},e.acl.ownerGroup=w??``,a=!0),a&&await r(e)}}ie(!1),t()},200)},children:u(`div`,{style:{display:`flex`,flexDirection:`column`},children:[i(`div`,{style:{margin:10,fontSize:20},children:f(`Access control list: %s`,n)}),u(`div`,{style:{display:`flex`},children:[i(a,{fullWidth:!0,style:{marginRight:10},label:f(`Owner user`),lang:X,list:E,t:f,disabled:Y,value:x||void 0,themeType:p,different:R?F:!1,onChange:e=>{z(!1),C(e),J(!1)}}),i(a,{fullWidth:!0,label:f(`Owner group`),lang:X,list:O,t:f,disabled:Y,value:w||void 0,themeType:p,different:B?F:!1,onChange:e=>{V(!1),T(e),J(!1)}})]}),u(`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:f(`to apply one item`)}),i(o,{disabled:K.length===1||Y,checked:!l[b.id]&&!!b.folder||A,onChange:e=>{j(e.target.checked),J(!1)},color:`primary`}),u(`div`,{style:b.folder||A?{color:`green`}:void 0,children:[f(`to apply with children`),` `,b.folder||N>1?`(${N} ${f(`object(s)`)})`:``]})]}),Y&&i(d,{}),i(`div`,{style:{overflowY:`auto`},children:u(`div`,{children:[i(`h2`,{children:f(`File rights`)}),i(ee,{disabled:Y,mask:W,setMask:G,applyToChildren:A,differentValues:H,t:f,setValue:e=>{L(e),J(!1)},value:I??0})]})})]})}):i(d,{})};r();var I=[`select`,`view`],L=class e extends g{constructor(e){super(e),l(this,`t`,void 0),l(this,`wordCache`,void 0),l(this,`objects`,void 0),l(this,`navigateTo`,null),l(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=p.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(d,{});if(!e.isAppDialogOpen()){let e=p.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(s,{children:i(y,{overflow:`auto`,children:i(_,{navigateTo:t,onNavigateTo:t=>{e.isAppDialogOpen()||(t!=null&&t.id?p.doNavigate(`tab-files`,t.mode,t.id):p.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};
|