homebridge-config-ui-x 4.78.1 → 4.78.2-beta.0
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/CHANGELOG.md +17 -2
- package/dist/core/auth/auth.controller.d.ts +4 -0
- package/dist/core/config/config.service.d.ts +4 -0
- package/dist/core/config/config.service.js +2 -0
- package/dist/core/config/config.service.js.map +1 -1
- package/dist/modules/backup/backup.service.js +2 -1
- package/dist/modules/backup/backup.service.js.map +1 -1
- package/dist/modules/server/server.service.js +4 -2
- package/dist/modules/server/server.service.js.map +1 -1
- package/package.json +1 -1
- package/public/chunk-2SCPTKR7.js +1 -0
- package/public/{chunk-6LFABEVD.js → chunk-4B5B546N.js} +1 -1
- package/public/{chunk-RYCM65J5.js → chunk-4EWTRX44.js} +1 -1
- package/public/{chunk-LUAP5JIU.js → chunk-4N2YADTF.js} +1 -1
- package/public/{chunk-J6LG7572.js → chunk-4WLTWMEZ.js} +1 -1
- package/public/chunk-54G4EJNO.js +1 -0
- package/public/{chunk-FMIEZK6P.js → chunk-55JMWTF3.js} +1 -1
- package/public/{chunk-EDDNQT4K.js → chunk-77PKGTJ6.js} +1 -1
- package/public/chunk-APF46O6G.js +1 -0
- package/public/chunk-ASVA3NON.js +1 -0
- package/public/{chunk-KTBIQM6F.js → chunk-AVCQPCOS.js} +1 -1
- package/public/chunk-CLF7Z5FU.js +1 -0
- package/public/{chunk-OJIVR22S.js → chunk-D6G4NGNK.js} +1 -1
- package/public/{chunk-5LV43K5Q.js → chunk-DCIRWDVW.js} +1 -1
- package/public/chunk-DFSVMXD4.js +1 -0
- package/public/{chunk-TALXUYCG.js → chunk-E7XYGOQD.js} +1 -1
- package/public/{chunk-KPKXYWYI.js → chunk-EJKIFJ3G.js} +1 -1
- package/public/chunk-EOEJQUXC.js +1 -0
- package/public/chunk-F2VCKTA7.js +1 -0
- package/public/{chunk-PV3PJQXB.js → chunk-GGCJJLHN.js} +1 -1
- package/public/{chunk-J7ZYSHUZ.js → chunk-IRVOXEFE.js} +1 -1
- package/public/chunk-IZQSSGQT.js +1 -0
- package/public/chunk-JCSKQSFB.js +1 -0
- package/public/{chunk-NWSDLJGS.js → chunk-JEXGGMX5.js} +1 -1
- package/public/{chunk-RFN7COZT.js → chunk-JTFO2KJZ.js} +1 -1
- package/public/{chunk-KYIHZYMT.js → chunk-JU3SOS44.js} +1 -1
- package/public/{chunk-AE2FRIIY.js → chunk-KHCYDPWI.js} +1 -1
- package/public/{chunk-X6JNJXEN.js → chunk-KK2BBLPH.js} +1 -1
- package/public/chunk-LCRBIOJQ.js +1 -0
- package/public/{chunk-SYLE7CUR.js → chunk-LPIANZIZ.js} +1 -1
- package/public/{chunk-WM5V72KD.js → chunk-NOVC5ASQ.js} +1 -1
- package/public/{chunk-J6TX5B4F.js → chunk-O47K6ZXU.js} +1 -1
- package/public/chunk-OFZACWTK.js +1 -0
- package/public/{chunk-2VXN7WKJ.js → chunk-PFTJAWJK.js} +1 -1
- package/public/{chunk-Y4Q7E7P6.js → chunk-PNDJDJ5J.js} +1 -1
- package/public/chunk-POSBD7VV.js +1 -0
- package/public/chunk-QF2PH6KT.js +1 -0
- package/public/{chunk-WK3DIOUP.js → chunk-QOXK2L5U.js} +1 -1
- package/public/{chunk-TGHT3YAQ.js → chunk-QUD6HGBN.js} +2 -2
- package/public/{chunk-UMOY3YLS.js → chunk-R2D5KFFL.js} +1 -1
- package/public/{chunk-TO5WDII4.js → chunk-RT4A5F4Q.js} +1 -1
- package/public/{chunk-UXWMED4C.js → chunk-SA2YD3FJ.js} +1 -1
- package/public/{chunk-YFVQVTBT.js → chunk-SQSFBJVO.js} +1 -1
- package/public/chunk-SQZCN2E6.js +1 -0
- package/public/{chunk-KIJRUF65.js → chunk-TGQOS2G2.js} +1 -1
- package/public/{chunk-IONHXP54.js → chunk-TOYUVWM3.js} +1 -1
- package/public/{chunk-HSLSQSUK.js → chunk-TZHQDFLX.js} +1 -1
- package/public/{chunk-XVOGZWDM.js → chunk-U5H55F36.js} +1 -1
- package/public/{chunk-IK32HKVF.js → chunk-UJNJDPHO.js} +1 -1
- package/public/{chunk-HJRHEGOR.js → chunk-UWOCPHPM.js} +1 -1
- package/public/{chunk-T5BFPPBQ.js → chunk-WHUKNIMX.js} +1 -1
- package/public/{chunk-5Q3NKPCR.js → chunk-WW2UANPC.js} +1 -1
- package/public/{chunk-R46BD4H7.js → chunk-XK6HSLL7.js} +1 -1
- package/public/{chunk-I5MUH5C6.js → chunk-XRLP4JNA.js} +1 -1
- package/public/{chunk-53LOYMG6.js → chunk-YUPVYMES.js} +1 -1
- package/public/{chunk-BCWAVC5J.js → chunk-ZB4INQMV.js} +1 -1
- package/public/{chunk-5XQFBCJG.js → chunk-ZVJVD437.js} +1 -1
- package/public/{chunk-ELUNHUWE.js → chunk-ZW5IK3Y4.js} +1 -1
- package/public/index.html +1 -1
- package/public/{main-N24GDECP.js → main-GJ4KTFJY.js} +1 -1
- package/public/chunk-4VN4GBLG.js +0 -1
- package/public/chunk-5ZCW3NXI.js +0 -1
- package/public/chunk-7DWJTQPZ.js +0 -1
- package/public/chunk-AKTOY2ID.js +0 -1
- package/public/chunk-ARWR6FQL.js +0 -1
- package/public/chunk-BWSWZYVR.js +0 -1
- package/public/chunk-C63MPSJQ.js +0 -1
- package/public/chunk-FRLDRRIN.js +0 -1
- package/public/chunk-K6PDZMYT.js +0 -1
- package/public/chunk-MEEKQDYR.js +0 -1
- package/public/chunk-MLAMHH27.js +0 -1
- package/public/chunk-MQK7CXUI.js +0 -1
- package/public/chunk-OJGPSUKN.js +0 -1
- package/public/chunk-VK3KWDK4.js +0 -1
- package/public/chunk-XOPIKWHI.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as ee}from"./chunk-TJJCM4OW.js";import{a as Z,b as ne}from"./chunk-6XANA56B.js";import{a as W,b as Y}from"./chunk-WTTWP6KF.js";import{a as X}from"./chunk-S6UXXPGF.js";import{m as J,n as K,t as U}from"./chunk-2NQ5FYSH.js";import{c as N,e as F,l as q,z}from"./chunk-5NG7YGKN.js";import{b as G}from"./chunk-JBQX4JBH.js";import{b as Q}from"./chunk-J6LG7572.js";import{k as M,n as V}from"./chunk-OJGPSUKN.js";import{a as k,b as T}from"./chunk-555LSHXI.js";import{$a as n,Ac as s,Bc as d,Cc as O,Gb as C,Hb as m,Ib as p,Kb as I,Lb as j,Mb as H,Nb as v,Ob as r,Pb as a,Qb as w,Ub as b,Xb as _,Yb as l,eb as D,g as oe,h as S,id as L,jc as y,kc as x,la as h,lb as $,lc as E,qc as R,ra as g,rc as P,sa as u,sc as B,w as A}from"./chunk-W6X46MTW.js";var ie=oe(ne(),1);function ae(o,f){o&1&&(r(0,"div",5),w(1,"i",12),a())}function se(o,f){if(o&1){let e=b();r(0,"li",17),y(1),s(2,"date"),r(3,"button",18),s(4,"translate"),_("click",function(){let t=g(e).$implicit,c=l(3);return u(c.restore(t.id))}),w(5,"i",19),a()()}if(o&2){let e=f.$implicit;n(),E(" ",O(2,2,e.timestamp,"medium")," "),n(2),C("aria-label",d(4,5,"config.restore.copy_to_editor"))}}function le(o,f){if(o&1&&(r(0,"ul",15),j(1,se,6,7,"li",17,I),a()),o&2){let e=l(2);n(),H(e.backupList)}}function de(o,f){o&1&&(r(0,"p",16),y(1),s(2,"translate"),a()),o&2&&(n(),x(d(2,1,"config.restore.no_backups")))}function ce(o,f){if(o&1&&(r(0,"div",13),w(1,"i",14),a(),r(2,"p",13),y(3),s(4,"translate"),a(),m(5,le,3,0,"ul",15),m(6,de,3,3,"p",16)),o&2){let e=l();n(3),x(d(4,3,"config.restore.title_restore_homebridge_backup")),n(2),p(e.backupList&&e.backupList.length?5:-1),n(),p(!e.backupList||!e.backupList.length?6:-1)}}function me(o,f){if(o&1){let e=b();r(0,"button",20),s(1,"translate"),_("click",function(){g(e);let t=l();return u(t.$activeModal.dismiss("Dismiss"))}),y(2),s(3,"translate"),a()}o&2&&(C("aria-label",d(1,2,"form.button_close")),n(2),E(" ",d(3,4,"form.button_close")," "))}function pe(o,f){if(o&1){let e=b();r(0,"button",20),s(1,"translate"),_("click",function(){g(e);let t=l();return u(t.$activeModal.dismiss("Dismiss"))}),y(2),s(3,"translate"),a()}o&2&&(C("aria-label",d(1,2,"form.button_close")),n(2),E(" ",d(3,4,"form.button_close")," "))}function fe(o,f){if(o&1){let e=b();r(0,"button",21),s(1,"translate"),_("click",function(){g(e);let t=l();return u(t.deleteAllBackups())}),y(2),s(3,"translate"),a()}o&2&&(C("aria-label",d(1,2,"form.button_remove")),n(2),E(" ",d(3,4,"form.button_remove")," "))}var te=(()=>{class o{$activeModal=h(J);$api=h(V);$toastr=h(M);$translate=h(k);loading=!0;backupList=[];constructor(){}ngOnInit(){this.$api.get("/config-editor/backups").subscribe({next:e=>{this.loading=!1,this.backupList=e},error:e=>{this.loading=!1,console.error(e),this.$toastr.error(e.error.message||e.message,this.$translate.instant("toast.title_error"))}})}restore(e){return this.$activeModal.close(e)}deleteAllBackups(){return this.$api.delete("/config-editor/backups").subscribe({next:()=>{this.$activeModal.dismiss(),this.$toastr.success(this.$translate.instant("config.restore.toast_backups_deleted"),this.$translate.instant("toast.title_success"))},error:e=>{console.error(e),this.$toastr.error(e.error.message||e.message,this.$translate.instant("toast.title_error"))}})}static \u0275fac=function(i){return new(i||o)};static \u0275cmp=$({type:o,selectors:[["ng-component"]],decls:17,vars:11,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","primary-text"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant"],[1,"text-center"],[1,"text-end"],["type","button",1,"btn","btn-danger","me-auto"],[1,"fa","fa-fw","fa-cog","fa-spin",2,"font-size","75px"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-history","primary-text",2,"font-size","75px"],[1,"list-group","list-group-box"],[1,"text-center","mb-0"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[1,"btn","btn-primary","m-0","ms-3",3,"click"],[1,"fas","fa-fw","fa-arrow-right"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],["type","button",1,"btn","btn-danger","me-auto",3,"click"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"div",1)(2,"h5",2),y(3),s(4,"translate"),a(),r(5,"button",3),s(6,"translate"),_("click",function(){return t.$activeModal.dismiss("Dismiss")}),a()(),r(7,"div",4),m(8,ae,2,0,"div",5),m(9,ce,7,5),a(),r(10,"div",6)(11,"div",7),m(12,me,4,6,"button",8),a(),r(13,"div",9),m(14,pe,4,6,"button",8),a(),r(15,"div",10),m(16,fe,4,6,"button",11),a()()()),i&2&&(n(3),x(d(4,7,"form.button_restore")),n(2),C("aria-label",d(6,9,"form.button_close")),n(3),p(t.loading?8:-1),n(),p(t.loading?-1:9),n(3),p(!t.loading&&t.backupList.length?12:-1),n(2),p(t.loading||!t.loading&&!t.backupList.length?14:-1),n(2),p(!t.loading&&t.backupList.length?16:-1))},dependencies:[L,T],encapsulation:2})}return o})();function ge(o,f){if(o&1){let e=b();r(0,"button",13),s(1,"translate"),s(2,"translate"),_("click",function(){g(e);let t=l();return u(t.onExportConfig())}),w(3,"i",14),a()}o&2&&(v("ngbTooltip",d(1,2,"form.button_download")),C("aria-label",d(2,4,"form.button_download")))}function ue(o,f){if(o&1){let e=b();r(0,"button",15),s(1,"translate"),s(2,"translate"),_("click",function(){g(e);let t=l();return u(t.onCancelRestore())}),w(3,"i",16),a()}if(o&2){let e=l();v("disabled",e.saveInProgress)("ngbTooltip",d(1,3,"form.button_cancel")),C("aria-label",d(2,5,"form.button_cancel"))}}function he(o,f){if(o&1){let e=b();r(0,"button",13),s(1,"translate"),s(2,"translate"),_("click",function(){g(e);let t=l();return u(t.onRestore())}),w(3,"i",17),a()}o&2&&(v("ngbTooltip",d(1,2,"form.button_restore")),C("aria-label",d(2,4,"form.button_restore")))}function _e(o,f){o&1&&w(0,"i",8)}function be(o,f){o&1&&w(0,"i",9)}function Ce(o,f){if(o&1){let e=b();r(0,"ngx-monaco-editor",18),_("onInit",function(t){g(e);let c=l();return u(c.onEditorInit(t))})("keydown.control.s",function(t){g(e);let c=l();return t.preventDefault(),u(c.onSave())})("keydown.meta.s",function(t){g(e);let c=l();return t.preventDefault(),u(c.onSave())}),a()}if(o&2){let e=l();v("options",e.editorOptions)("model",e.monacoEditorModel)}}function ye(o,f){if(o&1){let e=b();r(0,"ngx-monaco-diff-editor",19),_("onInit",function(t){g(e);let c=l();return u(c.onInitDiffEditor(t))})("keydown.control.s",function(t){g(e);let c=l();return t.preventDefault(),u(c.onSave())})("keydown.meta.s",function(t){g(e);let c=l();return t.preventDefault(),u(c.onSave())}),a()}if(o&2){let e=l();v("options",e.editorOptions)("originalModel",e.monacoEditorModel)("modifiedModel",e.monacoEditorModel)}}function we(o,f){if(o&1){let e=b();r(0,"textarea",20),B("ngModelChange",function(t){g(e);let c=l();return P(c.homebridgeConfig,t)||(c.homebridgeConfig=t),u(t)}),y(1," "),a()}if(o&2){let e=l();R("ngModel",e.homebridgeConfig)}}var Ke=(()=>{class o{$api=h(V);$md=h(X);$modal=h(K);$monacoEditor=h(ee);$route=h(G);$renderer=h(D);$settings=h(Q);$toastr=h(M);$translate=h(k);homebridgeConfig;originalConfig;saveInProgress;isMobile=!1;monacoEditor;editorOptions;monacoEditorModel;editorDecorations=[];lastHeight;visualViewPortEventCallback;constructor(){this.isMobile=this.$md.detect.mobile()}ngOnInit(){this.editorOptions={language:"json",theme:this.$settings.actualLightingMode==="dark"?"vs-dark":"vs-light",automaticLayout:!0};let e=document.querySelector(".content");this.$renderer.setStyle(e,"height","100%"),this.visualViewPortEventCallback=()=>this.visualViewPortChanged(),this.lastHeight=window.innerHeight,window.visualViewport&&!this.isMobile&&(window.visualViewport.addEventListener("resize",this.visualViewPortEventCallback,!0),this.$md.disableTouchMove()),this.visualViewPortEventCallback=()=>this.visualViewPortChanged(),this.lastHeight=window.innerHeight,window.visualViewport&&!this.isMobile&&(window.visualViewport.addEventListener("resize",this.visualViewPortEventCallback,!0),this.$md.disableTouchMove()),this.$route.data.subscribe(i=>{this.homebridgeConfig=i.config}),this.monacoEditorModel={value:"{}",language:"json",uri:window.monaco?window.monaco.Uri.parse("a://homebridge/config.json"):void 0},window.monaco?this.setMonacoEditorModel():this.$monacoEditor.readyEvent.subscribe({next:()=>{this.setMonacoEditorModel()}})}onEditorInit(e){window.editor=e,this.monacoEditor=e,this.monacoEditor.getModel().setValue(this.homebridgeConfig)}onInitDiffEditor(e){this.monacoEditor=e.modifiedEditor,e.getModel().original.setValue(this.originalConfig),e.getModel().modified.setValue(this.homebridgeConfig),window.editor=e}onSave(){return S(this,null,function*(){if(!this.saveInProgress){this.monacoEditor&&(this.editorDecorations=this.monacoEditor.deltaDecorations(this.editorDecorations,[])),this.saveInProgress=!0;try{if(!this.isMobile){yield this.monacoEditor.getAction("editor.action.formatDocument").run();let i=window.monaco.editor.getModelMarkers({owner:"json"});for(let t of i)if(t.message==="Duplicate object key"){this.saveInProgress=!1,this.$toastr.error(this.$translate.instant("config.config_invalid_json"),this.$translate.instant("toast.title_error"));return}this.homebridgeConfig=this.monacoEditor.getModel().getValue()}let e=this.parseConfigFromEditor();this.homebridgeConfig=JSON.stringify(e,null,4),typeof e.bridge!="object"?this.$toastr.error(this.$translate.instant("config.config_bridge_missing"),this.$translate.instant("toast.title_error")):/^(?:[0-9A-F]{2}:){5}[0-9A-F]{2}$/i.test(e.bridge.username)?e.accessories&&!Array.isArray(e.accessories)?this.$toastr.error(this.$translate.instant("config.config_accessory_must_be_array"),this.$translate.instant("toast.title_error")):e.platforms&&!Array.isArray(e.platforms)?this.$toastr.error(this.$translate.instant("config.config_platform_must_be_array"),this.$translate.instant("toast.title_error")):e.platforms&&Array.isArray(e.platforms)&&!this.validateSection(e.platforms,"platform")||e.accessories&&Array.isArray(e.accessories)&&!this.validateSection(e.accessories,"accessory")||e.plugins&&Array.isArray(e.plugins)&&!this.validatePlugins(e.plugins,"plugins")||e.disabledPlugins&&Array.isArray(e.disabledPlugins)&&!this.validatePlugins(e.disabledPlugins,"disabledPlugins")||(yield this.saveConfig(e),this.originalConfig=""):this.$toastr.error(this.$translate.instant("config.config_username_error"),this.$translate.instant("toast.title_error"))}catch(e){console.error(e),this.$toastr.error(this.$translate.instant("config.config_invalid_json"),this.$translate.instant("toast.title_error"))}this.saveInProgress=!1}})}parseConfigFromEditor(){try{return JSON.parse(this.homebridgeConfig)}catch{let i=ie.default.parse(this.homebridgeConfig);return this.homebridgeConfig=JSON.stringify(i,null,4),this.monacoEditor&&this.monacoEditor.getModel().setValue(this.homebridgeConfig),i}}saveConfig(e){return S(this,null,function*(){try{let i=yield A(this.$api.post("/config-editor",e));this.homebridgeConfig=JSON.stringify(i,null,4),this.$modal.open(Z,{size:"lg",backdrop:"static"})}catch(i){console.error(i),this.$toastr.error(this.$translate.instant("config.failed_to_save_config"),this.$translate.instant("toast.title_error"))}})}onRestore(){this.$modal.open(te,{size:"lg",backdrop:"static"}).result.then(e=>{this.originalConfig||(this.originalConfig=this.homebridgeConfig),this.$api.get(`/config-editor/backups/${e}`).subscribe({next:i=>{this.$toastr.info(this.$translate.instant("config.restore.confirm"),this.$translate.instant("config.title_backup_loaded")),this.homebridgeConfig=JSON.stringify(i,null,4),this.monacoEditor&&window.editor.modifiedEditor&&(this.editorDecorations=this.monacoEditor.deltaDecorations(this.editorDecorations,[]),this.monacoEditor.executeEdits("beautifier",[{identifier:"delete",range:new monaco.Range(1,1,this.monacoEditor.getModel().getLineCount()+10,1),text:"",forceMoveMarkers:!0}]),this.monacoEditor.executeEdits("beautifier",[{identifier:"insert",range:new monaco.Range(1,1,1,1),text:this.homebridgeConfig,forceMoveMarkers:!0}]))},error:i=>{console.error(i),this.$toastr.error(i.error.message||this.$translate.instant("backup.load_error"),this.$translate.instant("toast.title_error"))}})}).catch(()=>{})}onExportConfig(){let e=`data:text/json;charset=utf-8,${encodeURIComponent(this.homebridgeConfig)}`,i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("download","config.json"),document.body.appendChild(i),i.click(),i.remove()}onCancelRestore(){this.homebridgeConfig=this.originalConfig,this.originalConfig=""}validateSection(e,i){for(let t of e){if(typeof t!="object"||Array.isArray(t))return this.$toastr.error(this.$translate.instant("config.error_blocks_objects",{type:i}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(t),!1;if(!t[i])return this.$toastr.error(this.$translate.instant("config.error_blocks_type",{type:i}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(t),!1;if(typeof t[i]!="string")return this.$toastr.error(this.$translate.instant("config.error_string_type",{type:i}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(t),!1}return!0}validatePlugins(e,i){for(let t of e)if(typeof t!="string")return this.$toastr.error(this.$translate.instant("config.error_string_array",{key:i}),this.$translate.instant("toast.title_error")),!1;return!0}highlightOffendingArrayItem(e){this.monacoEditor&&(e=JSON.stringify(e,null,4).split(`
|
|
1
|
+
import{a as ee}from"./chunk-TJJCM4OW.js";import{a as Z,b as ne}from"./chunk-6XANA56B.js";import{a as W,b as Y}from"./chunk-WTTWP6KF.js";import{a as X}from"./chunk-S6UXXPGF.js";import{m as J,n as K,t as U}from"./chunk-2NQ5FYSH.js";import{c as N,e as F,l as q,z}from"./chunk-5NG7YGKN.js";import{b as G}from"./chunk-JBQX4JBH.js";import{b as Q}from"./chunk-4WLTWMEZ.js";import{k as M,n as V}from"./chunk-2SCPTKR7.js";import{a as k,b as T}from"./chunk-555LSHXI.js";import{$a as n,Ac as s,Bc as d,Cc as O,Gb as C,Hb as m,Ib as p,Kb as I,Lb as j,Mb as H,Nb as v,Ob as r,Pb as a,Qb as w,Ub as b,Xb as _,Yb as l,eb as D,g as oe,h as S,id as L,jc as y,kc as x,la as h,lb as $,lc as E,qc as R,ra as g,rc as P,sa as u,sc as B,w as A}from"./chunk-W6X46MTW.js";var ie=oe(ne(),1);function ae(o,f){o&1&&(r(0,"div",5),w(1,"i",12),a())}function se(o,f){if(o&1){let e=b();r(0,"li",17),y(1),s(2,"date"),r(3,"button",18),s(4,"translate"),_("click",function(){let t=g(e).$implicit,c=l(3);return u(c.restore(t.id))}),w(5,"i",19),a()()}if(o&2){let e=f.$implicit;n(),E(" ",O(2,2,e.timestamp,"medium")," "),n(2),C("aria-label",d(4,5,"config.restore.copy_to_editor"))}}function le(o,f){if(o&1&&(r(0,"ul",15),j(1,se,6,7,"li",17,I),a()),o&2){let e=l(2);n(),H(e.backupList)}}function de(o,f){o&1&&(r(0,"p",16),y(1),s(2,"translate"),a()),o&2&&(n(),x(d(2,1,"config.restore.no_backups")))}function ce(o,f){if(o&1&&(r(0,"div",13),w(1,"i",14),a(),r(2,"p",13),y(3),s(4,"translate"),a(),m(5,le,3,0,"ul",15),m(6,de,3,3,"p",16)),o&2){let e=l();n(3),x(d(4,3,"config.restore.title_restore_homebridge_backup")),n(2),p(e.backupList&&e.backupList.length?5:-1),n(),p(!e.backupList||!e.backupList.length?6:-1)}}function me(o,f){if(o&1){let e=b();r(0,"button",20),s(1,"translate"),_("click",function(){g(e);let t=l();return u(t.$activeModal.dismiss("Dismiss"))}),y(2),s(3,"translate"),a()}o&2&&(C("aria-label",d(1,2,"form.button_close")),n(2),E(" ",d(3,4,"form.button_close")," "))}function pe(o,f){if(o&1){let e=b();r(0,"button",20),s(1,"translate"),_("click",function(){g(e);let t=l();return u(t.$activeModal.dismiss("Dismiss"))}),y(2),s(3,"translate"),a()}o&2&&(C("aria-label",d(1,2,"form.button_close")),n(2),E(" ",d(3,4,"form.button_close")," "))}function fe(o,f){if(o&1){let e=b();r(0,"button",21),s(1,"translate"),_("click",function(){g(e);let t=l();return u(t.deleteAllBackups())}),y(2),s(3,"translate"),a()}o&2&&(C("aria-label",d(1,2,"form.button_remove")),n(2),E(" ",d(3,4,"form.button_remove")," "))}var te=(()=>{class o{$activeModal=h(J);$api=h(V);$toastr=h(M);$translate=h(k);loading=!0;backupList=[];constructor(){}ngOnInit(){this.$api.get("/config-editor/backups").subscribe({next:e=>{this.loading=!1,this.backupList=e},error:e=>{this.loading=!1,console.error(e),this.$toastr.error(e.error.message||e.message,this.$translate.instant("toast.title_error"))}})}restore(e){return this.$activeModal.close(e)}deleteAllBackups(){return this.$api.delete("/config-editor/backups").subscribe({next:()=>{this.$activeModal.dismiss(),this.$toastr.success(this.$translate.instant("config.restore.toast_backups_deleted"),this.$translate.instant("toast.title_success"))},error:e=>{console.error(e),this.$toastr.error(e.error.message||e.message,this.$translate.instant("toast.title_error"))}})}static \u0275fac=function(i){return new(i||o)};static \u0275cmp=$({type:o,selectors:[["ng-component"]],decls:17,vars:11,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","primary-text"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant"],[1,"text-center"],[1,"text-end"],["type","button",1,"btn","btn-danger","me-auto"],[1,"fa","fa-fw","fa-cog","fa-spin",2,"font-size","75px"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-history","primary-text",2,"font-size","75px"],[1,"list-group","list-group-box"],[1,"text-center","mb-0"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[1,"btn","btn-primary","m-0","ms-3",3,"click"],[1,"fas","fa-fw","fa-arrow-right"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],["type","button",1,"btn","btn-danger","me-auto",3,"click"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"div",1)(2,"h5",2),y(3),s(4,"translate"),a(),r(5,"button",3),s(6,"translate"),_("click",function(){return t.$activeModal.dismiss("Dismiss")}),a()(),r(7,"div",4),m(8,ae,2,0,"div",5),m(9,ce,7,5),a(),r(10,"div",6)(11,"div",7),m(12,me,4,6,"button",8),a(),r(13,"div",9),m(14,pe,4,6,"button",8),a(),r(15,"div",10),m(16,fe,4,6,"button",11),a()()()),i&2&&(n(3),x(d(4,7,"form.button_restore")),n(2),C("aria-label",d(6,9,"form.button_close")),n(3),p(t.loading?8:-1),n(),p(t.loading?-1:9),n(3),p(!t.loading&&t.backupList.length?12:-1),n(2),p(t.loading||!t.loading&&!t.backupList.length?14:-1),n(2),p(!t.loading&&t.backupList.length?16:-1))},dependencies:[L,T],encapsulation:2})}return o})();function ge(o,f){if(o&1){let e=b();r(0,"button",13),s(1,"translate"),s(2,"translate"),_("click",function(){g(e);let t=l();return u(t.onExportConfig())}),w(3,"i",14),a()}o&2&&(v("ngbTooltip",d(1,2,"form.button_download")),C("aria-label",d(2,4,"form.button_download")))}function ue(o,f){if(o&1){let e=b();r(0,"button",15),s(1,"translate"),s(2,"translate"),_("click",function(){g(e);let t=l();return u(t.onCancelRestore())}),w(3,"i",16),a()}if(o&2){let e=l();v("disabled",e.saveInProgress)("ngbTooltip",d(1,3,"form.button_cancel")),C("aria-label",d(2,5,"form.button_cancel"))}}function he(o,f){if(o&1){let e=b();r(0,"button",13),s(1,"translate"),s(2,"translate"),_("click",function(){g(e);let t=l();return u(t.onRestore())}),w(3,"i",17),a()}o&2&&(v("ngbTooltip",d(1,2,"form.button_restore")),C("aria-label",d(2,4,"form.button_restore")))}function _e(o,f){o&1&&w(0,"i",8)}function be(o,f){o&1&&w(0,"i",9)}function Ce(o,f){if(o&1){let e=b();r(0,"ngx-monaco-editor",18),_("onInit",function(t){g(e);let c=l();return u(c.onEditorInit(t))})("keydown.control.s",function(t){g(e);let c=l();return t.preventDefault(),u(c.onSave())})("keydown.meta.s",function(t){g(e);let c=l();return t.preventDefault(),u(c.onSave())}),a()}if(o&2){let e=l();v("options",e.editorOptions)("model",e.monacoEditorModel)}}function ye(o,f){if(o&1){let e=b();r(0,"ngx-monaco-diff-editor",19),_("onInit",function(t){g(e);let c=l();return u(c.onInitDiffEditor(t))})("keydown.control.s",function(t){g(e);let c=l();return t.preventDefault(),u(c.onSave())})("keydown.meta.s",function(t){g(e);let c=l();return t.preventDefault(),u(c.onSave())}),a()}if(o&2){let e=l();v("options",e.editorOptions)("originalModel",e.monacoEditorModel)("modifiedModel",e.monacoEditorModel)}}function we(o,f){if(o&1){let e=b();r(0,"textarea",20),B("ngModelChange",function(t){g(e);let c=l();return P(c.homebridgeConfig,t)||(c.homebridgeConfig=t),u(t)}),y(1," "),a()}if(o&2){let e=l();R("ngModel",e.homebridgeConfig)}}var Ke=(()=>{class o{$api=h(V);$md=h(X);$modal=h(K);$monacoEditor=h(ee);$route=h(G);$renderer=h(D);$settings=h(Q);$toastr=h(M);$translate=h(k);homebridgeConfig;originalConfig;saveInProgress;isMobile=!1;monacoEditor;editorOptions;monacoEditorModel;editorDecorations=[];lastHeight;visualViewPortEventCallback;constructor(){this.isMobile=this.$md.detect.mobile()}ngOnInit(){this.editorOptions={language:"json",theme:this.$settings.actualLightingMode==="dark"?"vs-dark":"vs-light",automaticLayout:!0};let e=document.querySelector(".content");this.$renderer.setStyle(e,"height","100%"),this.visualViewPortEventCallback=()=>this.visualViewPortChanged(),this.lastHeight=window.innerHeight,window.visualViewport&&!this.isMobile&&(window.visualViewport.addEventListener("resize",this.visualViewPortEventCallback,!0),this.$md.disableTouchMove()),this.visualViewPortEventCallback=()=>this.visualViewPortChanged(),this.lastHeight=window.innerHeight,window.visualViewport&&!this.isMobile&&(window.visualViewport.addEventListener("resize",this.visualViewPortEventCallback,!0),this.$md.disableTouchMove()),this.$route.data.subscribe(i=>{this.homebridgeConfig=i.config}),this.monacoEditorModel={value:"{}",language:"json",uri:window.monaco?window.monaco.Uri.parse("a://homebridge/config.json"):void 0},window.monaco?this.setMonacoEditorModel():this.$monacoEditor.readyEvent.subscribe({next:()=>{this.setMonacoEditorModel()}})}onEditorInit(e){window.editor=e,this.monacoEditor=e,this.monacoEditor.getModel().setValue(this.homebridgeConfig)}onInitDiffEditor(e){this.monacoEditor=e.modifiedEditor,e.getModel().original.setValue(this.originalConfig),e.getModel().modified.setValue(this.homebridgeConfig),window.editor=e}onSave(){return S(this,null,function*(){if(!this.saveInProgress){this.monacoEditor&&(this.editorDecorations=this.monacoEditor.deltaDecorations(this.editorDecorations,[])),this.saveInProgress=!0;try{if(!this.isMobile){yield this.monacoEditor.getAction("editor.action.formatDocument").run();let i=window.monaco.editor.getModelMarkers({owner:"json"});for(let t of i)if(t.message==="Duplicate object key"){this.saveInProgress=!1,this.$toastr.error(this.$translate.instant("config.config_invalid_json"),this.$translate.instant("toast.title_error"));return}this.homebridgeConfig=this.monacoEditor.getModel().getValue()}let e=this.parseConfigFromEditor();this.homebridgeConfig=JSON.stringify(e,null,4),typeof e.bridge!="object"?this.$toastr.error(this.$translate.instant("config.config_bridge_missing"),this.$translate.instant("toast.title_error")):/^(?:[0-9A-F]{2}:){5}[0-9A-F]{2}$/i.test(e.bridge.username)?e.accessories&&!Array.isArray(e.accessories)?this.$toastr.error(this.$translate.instant("config.config_accessory_must_be_array"),this.$translate.instant("toast.title_error")):e.platforms&&!Array.isArray(e.platforms)?this.$toastr.error(this.$translate.instant("config.config_platform_must_be_array"),this.$translate.instant("toast.title_error")):e.platforms&&Array.isArray(e.platforms)&&!this.validateSection(e.platforms,"platform")||e.accessories&&Array.isArray(e.accessories)&&!this.validateSection(e.accessories,"accessory")||e.plugins&&Array.isArray(e.plugins)&&!this.validatePlugins(e.plugins,"plugins")||e.disabledPlugins&&Array.isArray(e.disabledPlugins)&&!this.validatePlugins(e.disabledPlugins,"disabledPlugins")||(yield this.saveConfig(e),this.originalConfig=""):this.$toastr.error(this.$translate.instant("config.config_username_error"),this.$translate.instant("toast.title_error"))}catch(e){console.error(e),this.$toastr.error(this.$translate.instant("config.config_invalid_json"),this.$translate.instant("toast.title_error"))}this.saveInProgress=!1}})}parseConfigFromEditor(){try{return JSON.parse(this.homebridgeConfig)}catch{let i=ie.default.parse(this.homebridgeConfig);return this.homebridgeConfig=JSON.stringify(i,null,4),this.monacoEditor&&this.monacoEditor.getModel().setValue(this.homebridgeConfig),i}}saveConfig(e){return S(this,null,function*(){try{let i=yield A(this.$api.post("/config-editor",e));this.homebridgeConfig=JSON.stringify(i,null,4),this.$modal.open(Z,{size:"lg",backdrop:"static"})}catch(i){console.error(i),this.$toastr.error(this.$translate.instant("config.failed_to_save_config"),this.$translate.instant("toast.title_error"))}})}onRestore(){this.$modal.open(te,{size:"lg",backdrop:"static"}).result.then(e=>{this.originalConfig||(this.originalConfig=this.homebridgeConfig),this.$api.get(`/config-editor/backups/${e}`).subscribe({next:i=>{this.$toastr.info(this.$translate.instant("config.restore.confirm"),this.$translate.instant("config.title_backup_loaded")),this.homebridgeConfig=JSON.stringify(i,null,4),this.monacoEditor&&window.editor.modifiedEditor&&(this.editorDecorations=this.monacoEditor.deltaDecorations(this.editorDecorations,[]),this.monacoEditor.executeEdits("beautifier",[{identifier:"delete",range:new monaco.Range(1,1,this.monacoEditor.getModel().getLineCount()+10,1),text:"",forceMoveMarkers:!0}]),this.monacoEditor.executeEdits("beautifier",[{identifier:"insert",range:new monaco.Range(1,1,1,1),text:this.homebridgeConfig,forceMoveMarkers:!0}]))},error:i=>{console.error(i),this.$toastr.error(i.error.message||this.$translate.instant("backup.load_error"),this.$translate.instant("toast.title_error"))}})}).catch(()=>{})}onExportConfig(){let e=`data:text/json;charset=utf-8,${encodeURIComponent(this.homebridgeConfig)}`,i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("download","config.json"),document.body.appendChild(i),i.click(),i.remove()}onCancelRestore(){this.homebridgeConfig=this.originalConfig,this.originalConfig=""}validateSection(e,i){for(let t of e){if(typeof t!="object"||Array.isArray(t))return this.$toastr.error(this.$translate.instant("config.error_blocks_objects",{type:i}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(t),!1;if(!t[i])return this.$toastr.error(this.$translate.instant("config.error_blocks_type",{type:i}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(t),!1;if(typeof t[i]!="string")return this.$toastr.error(this.$translate.instant("config.error_string_type",{type:i}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(t),!1}return!0}validatePlugins(e,i){for(let t of e)if(typeof t!="string")return this.$toastr.error(this.$translate.instant("config.error_string_array",{key:i}),this.$translate.instant("toast.title_error")),!1;return!0}highlightOffendingArrayItem(e){this.monacoEditor&&(e=JSON.stringify(e,null,4).split(`
|
|
2
2
|
`).map(i=>` ${i}`).join(`
|
|
3
3
|
`),setTimeout(()=>{let i=this.monacoEditor.getModel().findMatches(e);if(i.length){let t=i[0].range,c=new monaco.Range(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn);this.editorDecorations=this.monacoEditor.deltaDecorations(this.editorDecorations,[{range:c,options:{isWholeLine:!0,linesDecorationsClassName:"hb-monaco-editor-line-error"}}])}},200))}setMonacoEditorModel(){if(window.monaco.languages.json.jsonDefaults.diagnosticsOptions.schemas.some(i=>i.uri==="http://homebridge/config.json"))return;let e=monaco.Uri.parse("a://homebridge/config.json");window.monaco.languages.json.jsonDefaults.setDiagnosticsOptions({allowComments:!1,validate:!0,schemas:[{uri:"http://homebridge/config.json",fileMatch:[e.toString()],schema:{type:"object",required:["bridge"],properties:{bridge:{type:"object",required:["name","username","port","pin"],properties:{name:{type:"string",description:`The Homebridge instance name.
|
|
4
4
|
This should be unique if you are running multiple instances of Homebridge.`,default:"Homebridge"},username:{type:"string",description:`Homebridge username must be 6 pairs of colon-separated hexadecimal characters (A-F 0-9).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as j}from"./chunk-
|
|
1
|
+
import{a as j}from"./chunk-KHCYDPWI.js";import"./chunk-TJJCM4OW.js";import"./chunk-6XANA56B.js";import{c as M}from"./chunk-WTTWP6KF.js";import"./chunk-S6UXXPGF.js";import{v as u}from"./chunk-2NQ5FYSH.js";import{A as d,z as l}from"./chunk-5NG7YGKN.js";import{d as h,g as a}from"./chunk-JBQX4JBH.js";import"./chunk-4WLTWMEZ.js";import{k as v,n as y}from"./chunk-2SCPTKR7.js";import"./chunk-EM4PY2IW.js";import{a as g,c as C}from"./chunk-555LSHXI.js";import{ga as c,h as s,ha as i,kd as p,la as e,mb as n,w as f}from"./chunk-W6X46MTW.js";var m=(()=>{class o{$api=e(y);$router=e(h);$toastr=e(v);$translate=e(g);constructor(){}resolve(){return s(this,null,function*(){try{let r=yield f(this.$api.get("/config-editor"));return JSON.stringify(r,null,4)}catch(r){console.error(r),this.$toastr.error(r.message,this.$translate.instant("toast.title_error")),this.$router.navigate(["/"])}})}static \u0275fac=function(t){return new(t||o)};static \u0275prov=c({token:o,factory:o.\u0275fac})}return o})();var $=[{path:"",loadComponent:()=>import("./chunk-AVCQPCOS.js").then(o=>o.ConfigEditorComponent),resolve:{config:m}}],R=(()=>{class o{static \u0275fac=function(t){return new(t||o)};static \u0275mod=n({type:o});static \u0275inj=i({imports:[a.forChild($),a]})}return o})();var Q=(()=>{class o{static \u0275fac=function(t){return new(t||o)};static \u0275mod=n({type:o});static \u0275inj=i({providers:[m],imports:[p,l,d,M,u,C.forChild(),R,j]})}return o})();export{Q as ConfigEditorModule};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-R2D5KFFL.js";import"./chunk-JBQX4JBH.js";import"./chunk-U5H55F36.js";import"./chunk-XK6HSLL7.js";import"./chunk-4WLTWMEZ.js";import"./chunk-2SCPTKR7.js";import"./chunk-EM4PY2IW.js";import"./chunk-555LSHXI.js";import"./chunk-W6X46MTW.js";export{a as ContainerRestartComponent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as cu,b as ib}from"./chunk-6XANA56B.js";import{a as j1}from"./chunk-WTTWP6KF.js";import{a as Jr,b as Xr}from"./chunk-QJQSHTGR.js";import{a as q1}from"./chunk-S6UXXPGF.js";import{a as z1,b as ff}from"./chunk-TALXUYCG.js";import{a as R1,b as L1}from"./chunk-AJTG3DAQ.js";import{a as V1}from"./chunk-J764EFYE.js";import{a as Ds}from"./chunk-SCRWY2OT.js";import{a as N1}from"./chunk-IMPGSXGE.js";import{a as zr,b as Ur,c as Hr,d as Wr,e as Kr,f as Gr,g as Qi,m as Ae,n as it,o as k1,p as T1,q as P1,r as O1,s as M1,t as en}from"./chunk-2NQ5FYSH.js";import{A as nf,a as v1,b as Ju,c as Yi,e as vt,f as B1,h as x1,i as w1,j as S1,k as I1,l as Xu,m as A1,o as Yu,r as Zi,s as xi,t as wi,y as $1,z as uu}from"./chunk-5NG7YGKN.js";import{d as Ut}from"./chunk-JBQX4JBH.js";import{a as Qu}from"./chunk-XVOGZWDM.js";import{b as Re}from"./chunk-J6LG7572.js";import{k as _e,m as Zu,n as be}from"./chunk-OJGPSUKN.js";import{e as y1}from"./chunk-EM4PY2IW.js";import{a as Ee,b as $e}from"./chunk-555LSHXI.js";import{$a as l,Ac as y,Bc as B,Ca as zu,Cc as He,D as o1,Da as d1,Fa as Uu,Gb as G,Hb as w,Ib as S,Jc as gt,Kb as nt,Kc as U,Lb as ft,Lc as Gu,M as Ki,Mb as rt,Nb as b,Nc as E1,Ob as c,Pb as p,Qb as x,Rb as F1,Sb as C1,Ub as H,Xa as me,Xb as M,Yb as C,Z as rs,_a as c1,a as X,aa as uf,ac as os,b as xe,bc as as,bd as zt,cc as ss,cd as Bi,dc as Hu,dd as bt,e as F,eb as qr,ec as Wu,fa as a1,fb as yu,fc as h1,g as Ue,ga as Ot,gc as eu,h as K,ha as Gi,hb as _i,hc as Ku,ic as Z,ja as s1,jc as E,k as i1,ka as D1,kc as R,kd as Lr,la as I,lb as Y,lc as q,mb as Ji,mc as yi,n as Pt,nb as vu,nc as Rr,o as fs,ob as p1,q as n1,qc as Pe,ra as j,rb as se,rc as Oe,sa as N,sc as Me,sd as _1,ta as l1,tb as m1,tc as g1,ub as Vr,uc as b1,v as f1,vc as Ie,w as ae,wc as tu,x as r1,xc as vi,yc as Bu,za as Nr,zc as Xi}from"./chunk-W6X46MTW.js";var af=F(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.regexpCode=ge.getEsmExportName=ge.getProperty=ge.safeStringify=ge.stringify=ge.strConcat=ge.addCodeArg=ge.str=ge._=ge.nil=ge._Code=ge.Name=ge.IDENTIFIER=ge._CodeOrName=void 0;var rf=class{};ge._CodeOrName=rf;ge.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Si=class extends rf{constructor(u){if(super(),!ge.IDENTIFIER.test(u))throw new Error("CodeGen: name must be a valid identifier");this.str=u}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};ge.Name=Si;var Ht=class extends rf{constructor(u){super(),this._items=typeof u=="string"?[u]:u}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let u=this._items[0];return u===""||u==='""'}get str(){var u;return(u=this._str)!==null&&u!==void 0?u:this._str=this._items.reduce((t,i)=>`${t}${i}`,"")}get names(){var u;return(u=this._names)!==null&&u!==void 0?u:this._names=this._items.reduce((t,i)=>(i instanceof Si&&(t[i.str]=(t[i.str]||0)+1),t),{})}};ge._Code=Ht;ge.nil=new Ht("");function U1(e,...u){let t=[e[0]],i=0;for(;i<u.length;)ds(t,u[i]),t.push(e[++i]);return new Ht(t)}ge._=U1;var ls=new Ht("+");function H1(e,...u){let t=[of(e[0])],i=0;for(;i<u.length;)t.push(ls),ds(t,u[i]),t.push(ls,of(e[++i]));return fb(t),new Ht(t)}ge.str=H1;function ds(e,u){u instanceof Ht?e.push(...u._items):u instanceof Si?e.push(u):e.push(ab(u))}ge.addCodeArg=ds;function fb(e){let u=1;for(;u<e.length-1;){if(e[u]===ls){let t=rb(e[u-1],e[u+1]);if(t!==void 0){e.splice(u-1,3,t);continue}e[u++]="+"}u++}}function rb(e,u){if(u==='""')return e;if(e==='""')return u;if(typeof e=="string")return u instanceof Si||e[e.length-1]!=='"'?void 0:typeof u!="string"?`${e.slice(0,-1)}${u}"`:u[0]==='"'?e.slice(0,-1)+u.slice(1):void 0;if(typeof u=="string"&&u[0]==='"'&&!(e instanceof Si))return`"${e}${u.slice(1)}`}function ob(e,u){return u.emptyStr()?e:e.emptyStr()?u:H1`${e}${u}`}ge.strConcat=ob;function ab(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:of(Array.isArray(e)?e.join(","):e)}function sb(e){return new Ht(of(e))}ge.stringify=sb;function of(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ge.safeStringify=of;function Db(e){return typeof e=="string"&&ge.IDENTIFIER.test(e)?new Ht(`.${e}`):U1`[${e}]`}ge.getProperty=Db;function lb(e){if(typeof e=="string"&&ge.IDENTIFIER.test(e))return new Ht(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}ge.getEsmExportName=lb;function db(e){return new Ht(e.toString())}ge.regexpCode=db});var ms=F(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.ValueScope=xt.ValueScopeName=xt.Scope=xt.varKinds=xt.UsedValueState=void 0;var Bt=af(),cs=class extends Error{constructor(u){super(`CodeGen: "code" for ${u} not defined`),this.value=u.value}},Yr=function(e){return e[e.Started=0]="Started",e[e.Completed=1]="Completed",e}(Yr||(xt.UsedValueState=Yr={}));xt.varKinds={const:new Bt.Name("const"),let:new Bt.Name("let"),var:new Bt.Name("var")};var Zr=class{constructor({prefixes:u,parent:t}={}){this._names={},this._prefixes=u,this._parent=t}toName(u){return u instanceof Bt.Name?u:this.name(u)}name(u){return new Bt.Name(this._newName(u))}_newName(u){let t=this._names[u]||this._nameGroup(u);return`${u}${t.index++}`}_nameGroup(u){var t,i;if(!((i=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||i===void 0)&&i.has(u)||this._prefixes&&!this._prefixes.has(u))throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);return this._names[u]={prefix:u,index:0}}};xt.Scope=Zr;var Qr=class extends Bt.Name{constructor(u,t){super(t),this.prefix=u}setValue(u,{property:t,itemIndex:i}){this.value=u,this.scopePath=(0,Bt._)`.${new Bt.Name(t)}[${i}]`}};xt.ValueScopeName=Qr;var cb=(0,Bt._)`\n`,ps=class extends Zr{constructor(u){super(u),this._values={},this._scope=u.scope,this.opts=xe(X({},u),{_n:u.lines?cb:Bt.nil})}get(){return this._scope}name(u){return new Qr(u,this._newName(u))}value(u,t){var i;if(t.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(u),{prefix:f}=n,r=(i=t.key)!==null&&i!==void 0?i:t.ref,o=this._values[f];if(o){let D=o.get(r);if(D)return D}else o=this._values[f]=new Map;o.set(r,n);let a=this._scope[f]||(this._scope[f]=[]),s=a.length;return a[s]=t.ref,n.setValue(t,{property:f,itemIndex:s}),n}getValue(u,t){let i=this._values[u];if(i)return i.get(t)}scopeRefs(u,t=this._values){return this._reduceValues(t,i=>{if(i.scopePath===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return(0,Bt._)`${u}${i.scopePath}`})}scopeCode(u=this._values,t,i){return this._reduceValues(u,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},t,i)}_reduceValues(u,t,i={},n){let f=Bt.nil;for(let r in u){let o=u[r];if(!o)continue;let a=i[r]=i[r]||new Map;o.forEach(s=>{if(a.has(s))return;a.set(s,Yr.Started);let D=t(s);if(D){let d=this.opts.es5?xt.varKinds.var:xt.varKinds.const;f=(0,Bt._)`${f}${d} ${s} = ${D};${this.opts._n}`}else if(D=n?.(s))f=(0,Bt._)`${f}${D}${this.opts._n}`;else throw new cs(s);a.set(s,Yr.Completed)})}return f}};xt.ValueScope=ps});var ee=F(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.or=De.and=De.not=De.CodeGen=De.operators=De.varKinds=De.ValueScopeName=De.ValueScope=De.Scope=De.Name=De.regexpCode=De.stringify=De.getProperty=De.nil=De.strConcat=De.str=De._=void 0;var Fe=af(),iu=ms(),ei=af();Object.defineProperty(De,"_",{enumerable:!0,get:function(){return ei._}});Object.defineProperty(De,"str",{enumerable:!0,get:function(){return ei.str}});Object.defineProperty(De,"strConcat",{enumerable:!0,get:function(){return ei.strConcat}});Object.defineProperty(De,"nil",{enumerable:!0,get:function(){return ei.nil}});Object.defineProperty(De,"getProperty",{enumerable:!0,get:function(){return ei.getProperty}});Object.defineProperty(De,"stringify",{enumerable:!0,get:function(){return ei.stringify}});Object.defineProperty(De,"regexpCode",{enumerable:!0,get:function(){return ei.regexpCode}});Object.defineProperty(De,"Name",{enumerable:!0,get:function(){return ei.Name}});var no=ms();Object.defineProperty(De,"Scope",{enumerable:!0,get:function(){return no.Scope}});Object.defineProperty(De,"ValueScope",{enumerable:!0,get:function(){return no.ValueScope}});Object.defineProperty(De,"ValueScopeName",{enumerable:!0,get:function(){return no.ValueScopeName}});Object.defineProperty(De,"varKinds",{enumerable:!0,get:function(){return no.varKinds}});De.operators={GT:new Fe._Code(">"),GTE:new Fe._Code(">="),LT:new Fe._Code("<"),LTE:new Fe._Code("<="),EQ:new Fe._Code("==="),NEQ:new Fe._Code("!=="),NOT:new Fe._Code("!"),OR:new Fe._Code("||"),AND:new Fe._Code("&&"),ADD:new Fe._Code("+")};var xu=class{optimizeNodes(){return this}optimizeNames(u,t){return this}},Fs=class extends xu{constructor(u,t,i){super(),this.varKind=u,this.name=t,this.rhs=i}render({es5:u,_n:t}){let i=u?iu.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${i} ${this.name}${n};`+t}optimizeNames(u,t){if(u[this.name.str])return this.rhs&&(this.rhs=un(this.rhs,u,t)),this}get names(){return this.rhs instanceof Fe._CodeOrName?this.rhs.names:{}}},to=class extends xu{constructor(u,t,i){super(),this.lhs=u,this.rhs=t,this.sideEffects=i}render({_n:u}){return`${this.lhs} = ${this.rhs};`+u}optimizeNames(u,t){if(!(this.lhs instanceof Fe.Name&&!u[this.lhs.str]&&!this.sideEffects))return this.rhs=un(this.rhs,u,t),this}get names(){let u=this.lhs instanceof Fe.Name?{}:X({},this.lhs.names);return io(u,this.rhs)}},Cs=class extends to{constructor(u,t,i,n){super(u,i,n),this.op=t}render({_n:u}){return`${this.lhs} ${this.op}= ${this.rhs};`+u}},hs=class extends xu{constructor(u){super(),this.label=u,this.names={}}render({_n:u}){return`${this.label}:`+u}},gs=class extends xu{constructor(u){super(),this.label=u,this.names={}}render({_n:u}){return`break${this.label?` ${this.label}`:""};`+u}},bs=class extends xu{constructor(u){super(),this.error=u}render({_n:u}){return`throw ${this.error};`+u}get names(){return this.error.names}},Es=class extends xu{constructor(u){super(),this.code=u}render({_n:u}){return`${this.code};`+u}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(u,t){return this.code=un(this.code,u,t),this}get names(){return this.code instanceof Fe._CodeOrName?this.code.names:{}}},sf=class extends xu{constructor(u=[]){super(),this.nodes=u}render(u){return this.nodes.reduce((t,i)=>t+i.render(u),"")}optimizeNodes(){let{nodes:u}=this,t=u.length;for(;t--;){let i=u[t].optimizeNodes();Array.isArray(i)?u.splice(t,1,...i):i?u[t]=i:u.splice(t,1)}return u.length>0?this:void 0}optimizeNames(u,t){let{nodes:i}=this,n=i.length;for(;n--;){let f=i[n];f.optimizeNames(u,t)||(pb(u,f.names),i.splice(n,1))}return i.length>0?this:void 0}get names(){return this.nodes.reduce((u,t)=>Ii(u,t.names),{})}},wu=class extends sf{render(u){return"{"+u._n+super.render(u)+"}"+u._n}},_s=class extends sf{},ys=(()=>{class e extends wu{}return e.kind="else",e})(),eo=(()=>{class e extends wu{constructor(t,i){super(i),this.condition=t}render(t){let i=`if(${this.condition})`+super.render(t);return this.else&&(i+="else "+this.else.render(t)),i}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let i=this.else;if(i){let n=i.optimizeNodes();i=this.else=Array.isArray(n)?new ys(n):n}if(i)return t===!1?i instanceof e?i:i.nodes:this.nodes.length?this:new e(X1(t),i instanceof e?[i]:i.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,i){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,i),!!(super.optimizeNames(t,i)||this.else))return this.condition=un(this.condition,t,i),this}get names(){let t=super.names;return io(t,this.condition),this.else&&Ii(t,this.else.names),t}}return e.kind="if",e})(),fo=(()=>{class e extends wu{}return e.kind="for",e})(),vs=class extends fo{constructor(u){super(),this.iteration=u}render(u){return`for(${this.iteration})`+super.render(u)}optimizeNames(u,t){if(super.optimizeNames(u,t))return this.iteration=un(this.iteration,u,t),this}get names(){return Ii(super.names,this.iteration.names)}},Bs=class extends fo{constructor(u,t,i,n){super(),this.varKind=u,this.name=t,this.from=i,this.to=n}render(u){let t=u.es5?iu.varKinds.var:this.varKind,{name:i,from:n,to:f}=this;return`for(${t} ${i}=${n}; ${i}<${f}; ${i}++)`+super.render(u)}get names(){let u=io(super.names,this.from);return io(u,this.to)}},uo=class extends fo{constructor(u,t,i,n){super(),this.loop=u,this.varKind=t,this.name=i,this.iterable=n}render(u){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(u)}optimizeNames(u,t){if(super.optimizeNames(u,t))return this.iterable=un(this.iterable,u,t),this}get names(){return Ii(super.names,this.iterable.names)}},W1=(()=>{class e extends wu{constructor(t,i,n){super(),this.name=t,this.args=i,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}}return e.kind="func",e})(),K1=(()=>{class e extends sf{render(t){return"return "+super.render(t)}}return e.kind="return",e})(),xs=class extends wu{render(u){let t="try"+super.render(u);return this.catch&&(t+=this.catch.render(u)),this.finally&&(t+=this.finally.render(u)),t}optimizeNodes(){var u,t;return super.optimizeNodes(),(u=this.catch)===null||u===void 0||u.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(u,t){var i,n;return super.optimizeNames(u,t),(i=this.catch)===null||i===void 0||i.optimizeNames(u,t),(n=this.finally)===null||n===void 0||n.optimizeNames(u,t),this}get names(){let u=super.names;return this.catch&&Ii(u,this.catch.names),this.finally&&Ii(u,this.finally.names),u}},G1=(()=>{class e extends wu{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}}return e.kind="catch",e})(),J1=(()=>{class e extends wu{render(t){return"finally"+super.render(t)}}return e.kind="finally",e})(),ws=class{constructor(u,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts=xe(X({},t),{_n:t.lines?`
|
|
1
|
+
import{a as cu,b as ib}from"./chunk-6XANA56B.js";import{a as j1}from"./chunk-WTTWP6KF.js";import{a as Jr,b as Xr}from"./chunk-QJQSHTGR.js";import{a as q1}from"./chunk-S6UXXPGF.js";import{a as z1,b as ff}from"./chunk-E7XYGOQD.js";import{a as R1,b as L1}from"./chunk-AJTG3DAQ.js";import{a as V1}from"./chunk-J764EFYE.js";import{a as Ds}from"./chunk-SCRWY2OT.js";import{a as N1}from"./chunk-IMPGSXGE.js";import{a as zr,b as Ur,c as Hr,d as Wr,e as Kr,f as Gr,g as Qi,m as Ae,n as it,o as k1,p as T1,q as P1,r as O1,s as M1,t as en}from"./chunk-2NQ5FYSH.js";import{A as nf,a as v1,b as Ju,c as Yi,e as vt,f as B1,h as x1,i as w1,j as S1,k as I1,l as Xu,m as A1,o as Yu,r as Zi,s as xi,t as wi,y as $1,z as uu}from"./chunk-5NG7YGKN.js";import{d as Ut}from"./chunk-JBQX4JBH.js";import{a as Qu}from"./chunk-U5H55F36.js";import{b as Re}from"./chunk-4WLTWMEZ.js";import{k as _e,m as Zu,n as be}from"./chunk-2SCPTKR7.js";import{e as y1}from"./chunk-EM4PY2IW.js";import{a as Ee,b as $e}from"./chunk-555LSHXI.js";import{$a as l,Ac as y,Bc as B,Ca as zu,Cc as He,D as o1,Da as d1,Fa as Uu,Gb as G,Hb as w,Ib as S,Jc as gt,Kb as nt,Kc as U,Lb as ft,Lc as Gu,M as Ki,Mb as rt,Nb as b,Nc as E1,Ob as c,Pb as p,Qb as x,Rb as F1,Sb as C1,Ub as H,Xa as me,Xb as M,Yb as C,Z as rs,_a as c1,a as X,aa as uf,ac as os,b as xe,bc as as,bd as zt,cc as ss,cd as Bi,dc as Hu,dd as bt,e as F,eb as qr,ec as Wu,fa as a1,fb as yu,fc as h1,g as Ue,ga as Ot,gc as eu,h as K,ha as Gi,hb as _i,hc as Ku,ic as Z,ja as s1,jc as E,k as i1,ka as D1,kc as R,kd as Lr,la as I,lb as Y,lc as q,mb as Ji,mc as yi,n as Pt,nb as vu,nc as Rr,o as fs,ob as p1,q as n1,qc as Pe,ra as j,rb as se,rc as Oe,sa as N,sc as Me,sd as _1,ta as l1,tb as m1,tc as g1,ub as Vr,uc as b1,v as f1,vc as Ie,w as ae,wc as tu,x as r1,xc as vi,yc as Bu,za as Nr,zc as Xi}from"./chunk-W6X46MTW.js";var af=F(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.regexpCode=ge.getEsmExportName=ge.getProperty=ge.safeStringify=ge.stringify=ge.strConcat=ge.addCodeArg=ge.str=ge._=ge.nil=ge._Code=ge.Name=ge.IDENTIFIER=ge._CodeOrName=void 0;var rf=class{};ge._CodeOrName=rf;ge.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Si=class extends rf{constructor(u){if(super(),!ge.IDENTIFIER.test(u))throw new Error("CodeGen: name must be a valid identifier");this.str=u}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};ge.Name=Si;var Ht=class extends rf{constructor(u){super(),this._items=typeof u=="string"?[u]:u}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let u=this._items[0];return u===""||u==='""'}get str(){var u;return(u=this._str)!==null&&u!==void 0?u:this._str=this._items.reduce((t,i)=>`${t}${i}`,"")}get names(){var u;return(u=this._names)!==null&&u!==void 0?u:this._names=this._items.reduce((t,i)=>(i instanceof Si&&(t[i.str]=(t[i.str]||0)+1),t),{})}};ge._Code=Ht;ge.nil=new Ht("");function U1(e,...u){let t=[e[0]],i=0;for(;i<u.length;)ds(t,u[i]),t.push(e[++i]);return new Ht(t)}ge._=U1;var ls=new Ht("+");function H1(e,...u){let t=[of(e[0])],i=0;for(;i<u.length;)t.push(ls),ds(t,u[i]),t.push(ls,of(e[++i]));return fb(t),new Ht(t)}ge.str=H1;function ds(e,u){u instanceof Ht?e.push(...u._items):u instanceof Si?e.push(u):e.push(ab(u))}ge.addCodeArg=ds;function fb(e){let u=1;for(;u<e.length-1;){if(e[u]===ls){let t=rb(e[u-1],e[u+1]);if(t!==void 0){e.splice(u-1,3,t);continue}e[u++]="+"}u++}}function rb(e,u){if(u==='""')return e;if(e==='""')return u;if(typeof e=="string")return u instanceof Si||e[e.length-1]!=='"'?void 0:typeof u!="string"?`${e.slice(0,-1)}${u}"`:u[0]==='"'?e.slice(0,-1)+u.slice(1):void 0;if(typeof u=="string"&&u[0]==='"'&&!(e instanceof Si))return`"${e}${u.slice(1)}`}function ob(e,u){return u.emptyStr()?e:e.emptyStr()?u:H1`${e}${u}`}ge.strConcat=ob;function ab(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:of(Array.isArray(e)?e.join(","):e)}function sb(e){return new Ht(of(e))}ge.stringify=sb;function of(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ge.safeStringify=of;function Db(e){return typeof e=="string"&&ge.IDENTIFIER.test(e)?new Ht(`.${e}`):U1`[${e}]`}ge.getProperty=Db;function lb(e){if(typeof e=="string"&&ge.IDENTIFIER.test(e))return new Ht(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}ge.getEsmExportName=lb;function db(e){return new Ht(e.toString())}ge.regexpCode=db});var ms=F(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.ValueScope=xt.ValueScopeName=xt.Scope=xt.varKinds=xt.UsedValueState=void 0;var Bt=af(),cs=class extends Error{constructor(u){super(`CodeGen: "code" for ${u} not defined`),this.value=u.value}},Yr=function(e){return e[e.Started=0]="Started",e[e.Completed=1]="Completed",e}(Yr||(xt.UsedValueState=Yr={}));xt.varKinds={const:new Bt.Name("const"),let:new Bt.Name("let"),var:new Bt.Name("var")};var Zr=class{constructor({prefixes:u,parent:t}={}){this._names={},this._prefixes=u,this._parent=t}toName(u){return u instanceof Bt.Name?u:this.name(u)}name(u){return new Bt.Name(this._newName(u))}_newName(u){let t=this._names[u]||this._nameGroup(u);return`${u}${t.index++}`}_nameGroup(u){var t,i;if(!((i=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||i===void 0)&&i.has(u)||this._prefixes&&!this._prefixes.has(u))throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);return this._names[u]={prefix:u,index:0}}};xt.Scope=Zr;var Qr=class extends Bt.Name{constructor(u,t){super(t),this.prefix=u}setValue(u,{property:t,itemIndex:i}){this.value=u,this.scopePath=(0,Bt._)`.${new Bt.Name(t)}[${i}]`}};xt.ValueScopeName=Qr;var cb=(0,Bt._)`\n`,ps=class extends Zr{constructor(u){super(u),this._values={},this._scope=u.scope,this.opts=xe(X({},u),{_n:u.lines?cb:Bt.nil})}get(){return this._scope}name(u){return new Qr(u,this._newName(u))}value(u,t){var i;if(t.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(u),{prefix:f}=n,r=(i=t.key)!==null&&i!==void 0?i:t.ref,o=this._values[f];if(o){let D=o.get(r);if(D)return D}else o=this._values[f]=new Map;o.set(r,n);let a=this._scope[f]||(this._scope[f]=[]),s=a.length;return a[s]=t.ref,n.setValue(t,{property:f,itemIndex:s}),n}getValue(u,t){let i=this._values[u];if(i)return i.get(t)}scopeRefs(u,t=this._values){return this._reduceValues(t,i=>{if(i.scopePath===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return(0,Bt._)`${u}${i.scopePath}`})}scopeCode(u=this._values,t,i){return this._reduceValues(u,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},t,i)}_reduceValues(u,t,i={},n){let f=Bt.nil;for(let r in u){let o=u[r];if(!o)continue;let a=i[r]=i[r]||new Map;o.forEach(s=>{if(a.has(s))return;a.set(s,Yr.Started);let D=t(s);if(D){let d=this.opts.es5?xt.varKinds.var:xt.varKinds.const;f=(0,Bt._)`${f}${d} ${s} = ${D};${this.opts._n}`}else if(D=n?.(s))f=(0,Bt._)`${f}${D}${this.opts._n}`;else throw new cs(s);a.set(s,Yr.Completed)})}return f}};xt.ValueScope=ps});var ee=F(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.or=De.and=De.not=De.CodeGen=De.operators=De.varKinds=De.ValueScopeName=De.ValueScope=De.Scope=De.Name=De.regexpCode=De.stringify=De.getProperty=De.nil=De.strConcat=De.str=De._=void 0;var Fe=af(),iu=ms(),ei=af();Object.defineProperty(De,"_",{enumerable:!0,get:function(){return ei._}});Object.defineProperty(De,"str",{enumerable:!0,get:function(){return ei.str}});Object.defineProperty(De,"strConcat",{enumerable:!0,get:function(){return ei.strConcat}});Object.defineProperty(De,"nil",{enumerable:!0,get:function(){return ei.nil}});Object.defineProperty(De,"getProperty",{enumerable:!0,get:function(){return ei.getProperty}});Object.defineProperty(De,"stringify",{enumerable:!0,get:function(){return ei.stringify}});Object.defineProperty(De,"regexpCode",{enumerable:!0,get:function(){return ei.regexpCode}});Object.defineProperty(De,"Name",{enumerable:!0,get:function(){return ei.Name}});var no=ms();Object.defineProperty(De,"Scope",{enumerable:!0,get:function(){return no.Scope}});Object.defineProperty(De,"ValueScope",{enumerable:!0,get:function(){return no.ValueScope}});Object.defineProperty(De,"ValueScopeName",{enumerable:!0,get:function(){return no.ValueScopeName}});Object.defineProperty(De,"varKinds",{enumerable:!0,get:function(){return no.varKinds}});De.operators={GT:new Fe._Code(">"),GTE:new Fe._Code(">="),LT:new Fe._Code("<"),LTE:new Fe._Code("<="),EQ:new Fe._Code("==="),NEQ:new Fe._Code("!=="),NOT:new Fe._Code("!"),OR:new Fe._Code("||"),AND:new Fe._Code("&&"),ADD:new Fe._Code("+")};var xu=class{optimizeNodes(){return this}optimizeNames(u,t){return this}},Fs=class extends xu{constructor(u,t,i){super(),this.varKind=u,this.name=t,this.rhs=i}render({es5:u,_n:t}){let i=u?iu.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${i} ${this.name}${n};`+t}optimizeNames(u,t){if(u[this.name.str])return this.rhs&&(this.rhs=un(this.rhs,u,t)),this}get names(){return this.rhs instanceof Fe._CodeOrName?this.rhs.names:{}}},to=class extends xu{constructor(u,t,i){super(),this.lhs=u,this.rhs=t,this.sideEffects=i}render({_n:u}){return`${this.lhs} = ${this.rhs};`+u}optimizeNames(u,t){if(!(this.lhs instanceof Fe.Name&&!u[this.lhs.str]&&!this.sideEffects))return this.rhs=un(this.rhs,u,t),this}get names(){let u=this.lhs instanceof Fe.Name?{}:X({},this.lhs.names);return io(u,this.rhs)}},Cs=class extends to{constructor(u,t,i,n){super(u,i,n),this.op=t}render({_n:u}){return`${this.lhs} ${this.op}= ${this.rhs};`+u}},hs=class extends xu{constructor(u){super(),this.label=u,this.names={}}render({_n:u}){return`${this.label}:`+u}},gs=class extends xu{constructor(u){super(),this.label=u,this.names={}}render({_n:u}){return`break${this.label?` ${this.label}`:""};`+u}},bs=class extends xu{constructor(u){super(),this.error=u}render({_n:u}){return`throw ${this.error};`+u}get names(){return this.error.names}},Es=class extends xu{constructor(u){super(),this.code=u}render({_n:u}){return`${this.code};`+u}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(u,t){return this.code=un(this.code,u,t),this}get names(){return this.code instanceof Fe._CodeOrName?this.code.names:{}}},sf=class extends xu{constructor(u=[]){super(),this.nodes=u}render(u){return this.nodes.reduce((t,i)=>t+i.render(u),"")}optimizeNodes(){let{nodes:u}=this,t=u.length;for(;t--;){let i=u[t].optimizeNodes();Array.isArray(i)?u.splice(t,1,...i):i?u[t]=i:u.splice(t,1)}return u.length>0?this:void 0}optimizeNames(u,t){let{nodes:i}=this,n=i.length;for(;n--;){let f=i[n];f.optimizeNames(u,t)||(pb(u,f.names),i.splice(n,1))}return i.length>0?this:void 0}get names(){return this.nodes.reduce((u,t)=>Ii(u,t.names),{})}},wu=class extends sf{render(u){return"{"+u._n+super.render(u)+"}"+u._n}},_s=class extends sf{},ys=(()=>{class e extends wu{}return e.kind="else",e})(),eo=(()=>{class e extends wu{constructor(t,i){super(i),this.condition=t}render(t){let i=`if(${this.condition})`+super.render(t);return this.else&&(i+="else "+this.else.render(t)),i}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let i=this.else;if(i){let n=i.optimizeNodes();i=this.else=Array.isArray(n)?new ys(n):n}if(i)return t===!1?i instanceof e?i:i.nodes:this.nodes.length?this:new e(X1(t),i instanceof e?[i]:i.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,i){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,i),!!(super.optimizeNames(t,i)||this.else))return this.condition=un(this.condition,t,i),this}get names(){let t=super.names;return io(t,this.condition),this.else&&Ii(t,this.else.names),t}}return e.kind="if",e})(),fo=(()=>{class e extends wu{}return e.kind="for",e})(),vs=class extends fo{constructor(u){super(),this.iteration=u}render(u){return`for(${this.iteration})`+super.render(u)}optimizeNames(u,t){if(super.optimizeNames(u,t))return this.iteration=un(this.iteration,u,t),this}get names(){return Ii(super.names,this.iteration.names)}},Bs=class extends fo{constructor(u,t,i,n){super(),this.varKind=u,this.name=t,this.from=i,this.to=n}render(u){let t=u.es5?iu.varKinds.var:this.varKind,{name:i,from:n,to:f}=this;return`for(${t} ${i}=${n}; ${i}<${f}; ${i}++)`+super.render(u)}get names(){let u=io(super.names,this.from);return io(u,this.to)}},uo=class extends fo{constructor(u,t,i,n){super(),this.loop=u,this.varKind=t,this.name=i,this.iterable=n}render(u){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(u)}optimizeNames(u,t){if(super.optimizeNames(u,t))return this.iterable=un(this.iterable,u,t),this}get names(){return Ii(super.names,this.iterable.names)}},W1=(()=>{class e extends wu{constructor(t,i,n){super(),this.name=t,this.args=i,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}}return e.kind="func",e})(),K1=(()=>{class e extends sf{render(t){return"return "+super.render(t)}}return e.kind="return",e})(),xs=class extends wu{render(u){let t="try"+super.render(u);return this.catch&&(t+=this.catch.render(u)),this.finally&&(t+=this.finally.render(u)),t}optimizeNodes(){var u,t;return super.optimizeNodes(),(u=this.catch)===null||u===void 0||u.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(u,t){var i,n;return super.optimizeNames(u,t),(i=this.catch)===null||i===void 0||i.optimizeNames(u,t),(n=this.finally)===null||n===void 0||n.optimizeNames(u,t),this}get names(){let u=super.names;return this.catch&&Ii(u,this.catch.names),this.finally&&Ii(u,this.finally.names),u}},G1=(()=>{class e extends wu{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}}return e.kind="catch",e})(),J1=(()=>{class e extends wu{render(t){return"finally"+super.render(t)}}return e.kind="finally",e})(),ws=class{constructor(u,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts=xe(X({},t),{_n:t.lines?`
|
|
2
2
|
`:""}),this._extScope=u,this._scope=new iu.Scope({parent:u}),this._nodes=[new _s]}toString(){return this._root.render(this.opts)}name(u){return this._scope.name(u)}scopeName(u){return this._extScope.name(u)}scopeValue(u,t){let i=this._extScope.value(u,t);return(this._values[i.prefix]||(this._values[i.prefix]=new Set)).add(i),i}getScopeValue(u,t){return this._extScope.getValue(u,t)}scopeRefs(u){return this._extScope.scopeRefs(u,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(u,t,i,n){let f=this._scope.toName(t);return i!==void 0&&n&&(this._constants[f.str]=i),this._leafNode(new Fs(u,f,i)),f}const(u,t,i){return this._def(iu.varKinds.const,u,t,i)}let(u,t,i){return this._def(iu.varKinds.let,u,t,i)}var(u,t,i){return this._def(iu.varKinds.var,u,t,i)}assign(u,t,i){return this._leafNode(new to(u,t,i))}add(u,t){return this._leafNode(new Cs(u,De.operators.ADD,t))}code(u){return typeof u=="function"?u():u!==Fe.nil&&this._leafNode(new Es(u)),this}object(...u){let t=["{"];for(let[i,n]of u)t.length>1&&t.push(","),t.push(i),(i!==n||this.opts.es5)&&(t.push(":"),(0,Fe.addCodeArg)(t,n));return t.push("}"),new Fe._Code(t)}if(u,t,i){if(this._blockNode(new eo(u)),t&&i)this.code(t).else().code(i).endIf();else if(t)this.code(t).endIf();else if(i)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(u){return this._elseNode(new eo(u))}else(){return this._elseNode(new ys)}endIf(){return this._endBlockNode(eo,ys)}_for(u,t){return this._blockNode(u),t&&this.code(t).endFor(),this}for(u,t){return this._for(new vs(u),t)}forRange(u,t,i,n,f=this.opts.es5?iu.varKinds.var:iu.varKinds.let){let r=this._scope.toName(u);return this._for(new Bs(f,r,t,i),()=>n(r))}forOf(u,t,i,n=iu.varKinds.const){let f=this._scope.toName(u);if(this.opts.es5){let r=t instanceof Fe.Name?t:this.var("_arr",t);return this.forRange("_i",0,(0,Fe._)`${r}.length`,o=>{this.var(f,(0,Fe._)`${r}[${o}]`),i(f)})}return this._for(new uo("of",n,f,t),()=>i(f))}forIn(u,t,i,n=this.opts.es5?iu.varKinds.var:iu.varKinds.const){if(this.opts.ownProperties)return this.forOf(u,(0,Fe._)`Object.keys(${t})`,i);let f=this._scope.toName(u);return this._for(new uo("in",n,f,t),()=>i(f))}endFor(){return this._endBlockNode(fo)}label(u){return this._leafNode(new hs(u))}break(u){return this._leafNode(new gs(u))}return(u){let t=new K1;if(this._blockNode(t),this.code(u),t.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(K1)}try(u,t,i){if(!t&&!i)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new xs;if(this._blockNode(n),this.code(u),t){let f=this.name("e");this._currNode=n.catch=new G1(f),t(f)}return i&&(this._currNode=n.finally=new J1,this.code(i)),this._endBlockNode(G1,J1)}throw(u){return this._leafNode(new bs(u))}block(u,t){return this._blockStarts.push(this._nodes.length),u&&this.code(u).endBlock(t),this}endBlock(u){let t=this._blockStarts.pop();if(t===void 0)throw new Error("CodeGen: not in self-balancing block");let i=this._nodes.length-t;if(i<0||u!==void 0&&i!==u)throw new Error(`CodeGen: wrong number of nodes: ${i} vs ${u} expected`);return this._nodes.length=t,this}func(u,t=Fe.nil,i,n){return this._blockNode(new W1(u,t,i)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(W1)}optimize(u=1){for(;u-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(u){return this._currNode.nodes.push(u),this}_blockNode(u){this._currNode.nodes.push(u),this._nodes.push(u)}_endBlockNode(u,t){let i=this._currNode;if(i instanceof u||t&&i instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${u.kind}/${t.kind}`:u.kind}"`)}_elseNode(u){let t=this._currNode;if(!(t instanceof eo))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=u,this}get _root(){return this._nodes[0]}get _currNode(){let u=this._nodes;return u[u.length-1]}set _currNode(u){let t=this._nodes;t[t.length-1]=u}};De.CodeGen=ws;function Ii(e,u){for(let t in u)e[t]=(e[t]||0)+(u[t]||0);return e}function io(e,u){return u instanceof Fe._CodeOrName?Ii(e,u.names):e}function un(e,u,t){if(e instanceof Fe.Name)return i(e);if(!n(e))return e;return new Fe._Code(e._items.reduce((f,r)=>(r instanceof Fe.Name&&(r=i(r)),r instanceof Fe._Code?f.push(...r._items):f.push(r),f),[]));function i(f){let r=t[f.str];return r===void 0||u[f.str]!==1?f:(delete u[f.str],r)}function n(f){return f instanceof Fe._Code&&f._items.some(r=>r instanceof Fe.Name&&u[r.str]===1&&t[r.str]!==void 0)}}function pb(e,u){for(let t in u)e[t]=(e[t]||0)-(u[t]||0)}function X1(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,Fe._)`!${Ss(e)}`}De.not=X1;var mb=Y1(De.operators.AND);function Fb(...e){return e.reduce(mb)}De.and=Fb;var Cb=Y1(De.operators.OR);function hb(...e){return e.reduce(Cb)}De.or=hb;function Y1(e){return(u,t)=>u===Fe.nil?t:t===Fe.nil?u:(0,Fe._)`${Ss(u)} ${e} ${Ss(t)}`}function Ss(e){return e instanceof Fe.Name?e:(0,Fe._)`(${e})`}});var de=F(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.checkStrictMode=le.getErrorPath=le.Type=le.useFunc=le.setEvaluated=le.evaluatedPropsToName=le.mergeEvaluated=le.eachItem=le.unescapeJsonPointer=le.escapeJsonPointer=le.escapeFragment=le.unescapeFragment=le.schemaRefOrVal=le.schemaHasRulesButRef=le.schemaHasRules=le.checkUnknownRules=le.alwaysValidSchema=le.toHash=void 0;var we=ee(),gb=af();function bb(e){let u={};for(let t of e)u[t]=!0;return u}le.toHash=bb;function Eb(e,u){return typeof u=="boolean"?u:Object.keys(u).length===0?!0:(ed(e,u),!td(u,e.self.RULES.all))}le.alwaysValidSchema=Eb;function ed(e,u=e.schema){let{opts:t,self:i}=e;if(!t.strictSchema||typeof u=="boolean")return;let n=i.RULES.keywords;for(let f in u)n[f]||nd(e,`unknown keyword: "${f}"`)}le.checkUnknownRules=ed;function td(e,u){if(typeof e=="boolean")return!e;for(let t in e)if(u[t])return!0;return!1}le.schemaHasRules=td;function _b(e,u){if(typeof e=="boolean")return!e;for(let t in e)if(t!=="$ref"&&u.all[t])return!0;return!1}le.schemaHasRulesButRef=_b;function yb({topSchemaRef:e,schemaPath:u},t,i,n){if(!n){if(typeof t=="number"||typeof t=="boolean")return t;if(typeof t=="string")return(0,we._)`${t}`}return(0,we._)`${e}${u}${(0,we.getProperty)(i)}`}le.schemaRefOrVal=yb;function vb(e){return ud(decodeURIComponent(e))}le.unescapeFragment=vb;function Bb(e){return encodeURIComponent(As(e))}le.escapeFragment=Bb;function As(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}le.escapeJsonPointer=As;function ud(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}le.unescapeJsonPointer=ud;function xb(e,u){if(Array.isArray(e))for(let t of e)u(t);else u(e)}le.eachItem=xb;function Z1({mergeNames:e,mergeToName:u,mergeValues:t,resultToName:i}){return(n,f,r,o)=>{let a=r===void 0?f:r instanceof we.Name?(f instanceof we.Name?e(n,f,r):u(n,f,r),r):f instanceof we.Name?(u(n,r,f),f):t(f,r);return o===we.Name&&!(a instanceof we.Name)?i(n,a):a}}le.mergeEvaluated={props:Z1({mergeNames:(e,u,t)=>e.if((0,we._)`${t} !== true && ${u} !== undefined`,()=>{e.if((0,we._)`${u} === true`,()=>e.assign(t,!0),()=>e.assign(t,(0,we._)`${t} || {}`).code((0,we._)`Object.assign(${t}, ${u})`))}),mergeToName:(e,u,t)=>e.if((0,we._)`${t} !== true`,()=>{u===!0?e.assign(t,!0):(e.assign(t,(0,we._)`${t} || {}`),$s(e,t,u))}),mergeValues:(e,u)=>e===!0?!0:X(X({},e),u),resultToName:id}),items:Z1({mergeNames:(e,u,t)=>e.if((0,we._)`${t} !== true && ${u} !== undefined`,()=>e.assign(t,(0,we._)`${u} === true ? true : ${t} > ${u} ? ${t} : ${u}`)),mergeToName:(e,u,t)=>e.if((0,we._)`${t} !== true`,()=>e.assign(t,u===!0?!0:(0,we._)`${t} > ${u} ? ${t} : ${u}`)),mergeValues:(e,u)=>e===!0?!0:Math.max(e,u),resultToName:(e,u)=>e.var("items",u)})};function id(e,u){if(u===!0)return e.var("props",!0);let t=e.var("props",(0,we._)`{}`);return u!==void 0&&$s(e,t,u),t}le.evaluatedPropsToName=id;function $s(e,u,t){Object.keys(t).forEach(i=>e.assign((0,we._)`${u}${(0,we.getProperty)(i)}`,!0))}le.setEvaluated=$s;var Q1={};function wb(e,u){return e.scopeValue("func",{ref:u,code:Q1[u.code]||(Q1[u.code]=new gb._Code(u.code))})}le.useFunc=wb;var Is=function(e){return e[e.Num=0]="Num",e[e.Str=1]="Str",e}(Is||(le.Type=Is={}));function Sb(e,u,t){if(e instanceof we.Name){let i=u===Is.Num;return t?i?(0,we._)`"[" + ${e} + "]"`:(0,we._)`"['" + ${e} + "']"`:i?(0,we._)`"/" + ${e}`:(0,we._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return t?(0,we.getProperty)(e).toString():"/"+As(e)}le.getErrorPath=Sb;function nd(e,u,t=e.opts.strictSchema){if(t){if(u=`strict mode: ${u}`,t===!0)throw new Error(u);e.self.logger.warn(u)}}le.checkStrictMode=nd});var Wt=F(ks=>{"use strict";Object.defineProperty(ks,"__esModule",{value:!0});var lt=ee(),Ib={data:new lt.Name("data"),valCxt:new lt.Name("valCxt"),instancePath:new lt.Name("instancePath"),parentData:new lt.Name("parentData"),parentDataProperty:new lt.Name("parentDataProperty"),rootData:new lt.Name("rootData"),dynamicAnchors:new lt.Name("dynamicAnchors"),vErrors:new lt.Name("vErrors"),errors:new lt.Name("errors"),this:new lt.Name("this"),self:new lt.Name("self"),scope:new lt.Name("scope"),json:new lt.Name("json"),jsonPos:new lt.Name("jsonPos"),jsonLen:new lt.Name("jsonLen"),jsonPart:new lt.Name("jsonPart")};ks.default=Ib});var Df=F(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.extendErrors=dt.resetErrorsCount=dt.reportExtraError=dt.reportError=dt.keyword$DataError=dt.keywordError=void 0;var he=ee(),ro=de(),Et=Wt();dt.keywordError={message:({keyword:e})=>(0,he.str)`must pass "${e}" keyword validation`};dt.keyword$DataError={message:({keyword:e,schemaType:u})=>u?(0,he.str)`"${e}" keyword must be ${u} ($data)`:(0,he.str)`"${e}" keyword is invalid ($data)`};function Ab(e,u=dt.keywordError,t,i){let{it:n}=e,{gen:f,compositeRule:r,allErrors:o}=n,a=od(e,u,t);i??(r||o)?fd(f,a):rd(n,(0,he._)`[${a}]`)}dt.reportError=Ab;function $b(e,u=dt.keywordError,t){let{it:i}=e,{gen:n,compositeRule:f,allErrors:r}=i,o=od(e,u,t);fd(n,o),f||r||rd(i,Et.default.vErrors)}dt.reportExtraError=$b;function kb(e,u){e.assign(Et.default.errors,u),e.if((0,he._)`${Et.default.vErrors} !== null`,()=>e.if(u,()=>e.assign((0,he._)`${Et.default.vErrors}.length`,u),()=>e.assign(Et.default.vErrors,null)))}dt.resetErrorsCount=kb;function Tb({gen:e,keyword:u,schemaValue:t,data:i,errsCount:n,it:f}){if(n===void 0)throw new Error("ajv implementation error");let r=e.name("err");e.forRange("i",n,Et.default.errors,o=>{e.const(r,(0,he._)`${Et.default.vErrors}[${o}]`),e.if((0,he._)`${r}.instancePath === undefined`,()=>e.assign((0,he._)`${r}.instancePath`,(0,he.strConcat)(Et.default.instancePath,f.errorPath))),e.assign((0,he._)`${r}.schemaPath`,(0,he.str)`${f.errSchemaPath}/${u}`),f.opts.verbose&&(e.assign((0,he._)`${r}.schema`,t),e.assign((0,he._)`${r}.data`,i))})}dt.extendErrors=Tb;function fd(e,u){let t=e.const("err",u);e.if((0,he._)`${Et.default.vErrors} === null`,()=>e.assign(Et.default.vErrors,(0,he._)`[${t}]`),(0,he._)`${Et.default.vErrors}.push(${t})`),e.code((0,he._)`${Et.default.errors}++`)}function rd(e,u){let{gen:t,validateName:i,schemaEnv:n}=e;n.$async?t.throw((0,he._)`new ${e.ValidationError}(${u})`):(t.assign((0,he._)`${i}.errors`,u),t.return(!1))}var Ai={keyword:new he.Name("keyword"),schemaPath:new he.Name("schemaPath"),params:new he.Name("params"),propertyName:new he.Name("propertyName"),message:new he.Name("message"),schema:new he.Name("schema"),parentSchema:new he.Name("parentSchema")};function od(e,u,t){let{createErrors:i}=e.it;return i===!1?(0,he._)`{}`:Pb(e,u,t)}function Pb(e,u,t={}){let{gen:i,it:n}=e,f=[Ob(n,t),Mb(e,t)];return jb(e,u,f),i.object(...f)}function Ob({errorPath:e},{instancePath:u}){let t=u?(0,he.str)`${e}${(0,ro.getErrorPath)(u,ro.Type.Str)}`:e;return[Et.default.instancePath,(0,he.strConcat)(Et.default.instancePath,t)]}function Mb({keyword:e,it:{errSchemaPath:u}},{schemaPath:t,parentSchema:i}){let n=i?u:(0,he.str)`${u}/${e}`;return t&&(n=(0,he.str)`${n}${(0,ro.getErrorPath)(t,ro.Type.Str)}`),[Ai.schemaPath,n]}function jb(e,{params:u,message:t},i){let{keyword:n,data:f,schemaValue:r,it:o}=e,{opts:a,propertyName:s,topSchemaRef:D,schemaPath:d}=o;i.push([Ai.keyword,n],[Ai.params,typeof u=="function"?u(e):u||(0,he._)`{}`]),a.messages&&i.push([Ai.message,typeof t=="function"?t(e):t]),a.verbose&&i.push([Ai.schema,r],[Ai.parentSchema,(0,he._)`${D}${d}`],[Et.default.data,f]),s&&i.push([Ai.propertyName,s])}});var sd=F(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.boolOrEmptySchema=nn.topBoolOrEmptySchema=void 0;var Nb=Df(),qb=ee(),Vb=Wt(),Rb={message:"boolean schema is false"};function Lb(e){let{gen:u,schema:t,validateName:i}=e;t===!1?ad(e,!1):typeof t=="object"&&t.$async===!0?u.return(Vb.default.data):(u.assign((0,qb._)`${i}.errors`,null),u.return(!0))}nn.topBoolOrEmptySchema=Lb;function zb(e,u){let{gen:t,schema:i}=e;i===!1?(t.var(u,!1),ad(e)):t.var(u,!0)}nn.boolOrEmptySchema=zb;function ad(e,u){let{gen:t,data:i}=e,n={gen:t,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,Nb.reportError)(n,Rb,void 0,u)}});var Ts=F(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.getRules=fn.isJSONType=void 0;var Ub=["string","number","integer","boolean","null","object","array"],Hb=new Set(Ub);function Wb(e){return typeof e=="string"&&Hb.has(e)}fn.isJSONType=Wb;function Kb(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:xe(X({},e),{integer:!0,boolean:!0,null:!0}),rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}fn.getRules=Kb});var Ps=F(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});ti.shouldUseRule=ti.shouldUseGroup=ti.schemaHasRulesForType=void 0;function Gb({schema:e,self:u},t){let i=u.RULES.types[t];return i&&i!==!0&&Dd(e,i)}ti.schemaHasRulesForType=Gb;function Dd(e,u){return u.rules.some(t=>ld(e,t))}ti.shouldUseGroup=Dd;function ld(e,u){var t;return e[u.keyword]!==void 0||((t=u.definition.implements)===null||t===void 0?void 0:t.some(i=>e[i]!==void 0))}ti.shouldUseRule=ld});var lf=F(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.reportTypeError=ct.checkDataTypes=ct.checkDataType=ct.coerceAndCheckDataType=ct.getJSONTypes=ct.getSchemaTypes=ct.DataType=void 0;var Jb=Ts(),Xb=Ps(),Yb=Df(),re=ee(),dd=de(),rn=function(e){return e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong",e}(rn||(ct.DataType=rn={}));function Zb(e){let u=cd(e.type);if(u.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!u.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&u.push("null")}return u}ct.getSchemaTypes=Zb;function cd(e){let u=Array.isArray(e)?e:e?[e]:[];if(u.every(Jb.isJSONType))return u;throw new Error("type must be JSONType or JSONType[]: "+u.join(","))}ct.getJSONTypes=cd;function Qb(e,u){let{gen:t,data:i,opts:n}=e,f=eE(u,n.coerceTypes),r=u.length>0&&!(f.length===0&&u.length===1&&(0,Xb.schemaHasRulesForType)(e,u[0]));if(r){let o=Ms(u,i,n.strictNumbers,rn.Wrong);t.if(o,()=>{f.length?tE(e,u,f):js(e)})}return r}ct.coerceAndCheckDataType=Qb;var pd=new Set(["string","number","integer","boolean","null"]);function eE(e,u){return u?e.filter(t=>pd.has(t)||u==="array"&&t==="array"):[]}function tE(e,u,t){let{gen:i,data:n,opts:f}=e,r=i.let("dataType",(0,re._)`typeof ${n}`),o=i.let("coerced",(0,re._)`undefined`);f.coerceTypes==="array"&&i.if((0,re._)`${r} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>i.assign(n,(0,re._)`${n}[0]`).assign(r,(0,re._)`typeof ${n}`).if(Ms(u,n,f.strictNumbers),()=>i.assign(o,n))),i.if((0,re._)`${o} !== undefined`);for(let s of t)(pd.has(s)||s==="array"&&f.coerceTypes==="array")&&a(s);i.else(),js(e),i.endIf(),i.if((0,re._)`${o} !== undefined`,()=>{i.assign(n,o),uE(e,o)});function a(s){switch(s){case"string":i.elseIf((0,re._)`${r} == "number" || ${r} == "boolean"`).assign(o,(0,re._)`"" + ${n}`).elseIf((0,re._)`${n} === null`).assign(o,(0,re._)`""`);return;case"number":i.elseIf((0,re._)`${r} == "boolean" || ${n} === null
|
|
3
3
|
|| (${r} == "string" && ${n} && ${n} == +${n})`).assign(o,(0,re._)`+${n}`);return;case"integer":i.elseIf((0,re._)`${r} === "boolean" || ${n} === null
|
|
4
4
|
|| (${r} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(o,(0,re._)`+${n}`);return;case"boolean":i.elseIf((0,re._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(o,!1).elseIf((0,re._)`${n} === "true" || ${n} === 1`).assign(o,!0);return;case"null":i.elseIf((0,re._)`${n} === "" || ${n} === 0 || ${n} === false`),i.assign(o,null);return;case"array":i.elseIf((0,re._)`${r} === "string" || ${r} === "number"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-PNDJDJ5J.js";import{a as f}from"./chunk-EJKIFJ3G.js";import{v as u}from"./chunk-2NQ5FYSH.js";import{A as p,z as n}from"./chunk-5NG7YGKN.js";import{g as i}from"./chunk-JBQX4JBH.js";import"./chunk-U5H55F36.js";import"./chunk-XK6HSLL7.js";import"./chunk-4WLTWMEZ.js";import"./chunk-2SCPTKR7.js";import"./chunk-EM4PY2IW.js";import{c as d}from"./chunk-555LSHXI.js";import{ha as t,kd as m,mb as r}from"./chunk-W6X46MTW.js";var M=[{path:"",loadComponent:()=>import("./chunk-IZQSSGQT.js").then(o=>o.SetupWizardComponent)}],l=(()=>{class o{static \u0275fac=function(e){return new(e||o)};static \u0275mod=r({type:o});static \u0275inj=t({imports:[i.forChild(M),i]})}return o})();var R=(()=>{class o{static \u0275fac=function(e){return new(e||o)};static \u0275mod=r({type:o});static \u0275inj=t({providers:[a],imports:[m,n,p,d,u,l,f]})}return o})();export{R as SetupWizardModule};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-
|
|
1
|
+
import"./chunk-PFTJAWJK.js";import"./chunk-TOYUVWM3.js";import{g as n}from"./chunk-JBQX4JBH.js";import"./chunk-U5H55F36.js";import"./chunk-XK6HSLL7.js";import"./chunk-4WLTWMEZ.js";import"./chunk-2SCPTKR7.js";import"./chunk-EM4PY2IW.js";import{c as m}from"./chunk-555LSHXI.js";import{ha as t,kd as i,mb as r}from"./chunk-W6X46MTW.js";var d=[{path:"",redirectTo:"/",pathMatch:"full"},{path:"restart-server",loadComponent:()=>import("./chunk-OFZACWTK.js").then(o=>o.RestartLinuxComponent)},{path:"shutdown-server",loadComponent:()=>import("./chunk-TZHQDFLX.js").then(o=>o.ShutdownLinuxComponent)}],u=(()=>{class o{static \u0275fac=function(e){return new(e||o)};static \u0275mod=r({type:o});static \u0275inj=t({imports:[n.forChild(d),n]})}return o})();var g=(()=>{class o{static \u0275fac=function(e){return new(e||o)};static \u0275mod=r({type:o});static \u0275inj=t({imports:[i,m.forChild(),u]})}return o})();export{g as LinuxModule};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-PFTJAWJK.js";import"./chunk-JBQX4JBH.js";import"./chunk-U5H55F36.js";import"./chunk-XK6HSLL7.js";import"./chunk-4WLTWMEZ.js";import"./chunk-2SCPTKR7.js";import"./chunk-EM4PY2IW.js";import"./chunk-555LSHXI.js";import"./chunk-W6X46MTW.js";export{a as RestartLinuxComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as y}from"./chunk-JBQX4JBH.js";import{a as T}from"./chunk-
|
|
1
|
+
import{d as y}from"./chunk-JBQX4JBH.js";import{a as T}from"./chunk-U5H55F36.js";import{b as S}from"./chunk-4WLTWMEZ.js";import{k as $,n as C}from"./chunk-2SCPTKR7.js";import{a as _,b as g}from"./chunk-555LSHXI.js";import{$a as i,Ac as p,Bc as c,Hb as l,Ib as m,Ob as r,Pb as n,Qb as x,Yb as v,jc as o,kc as s,la as a,lb as h}from"./chunk-W6X46MTW.js";function w(t,f){t&1&&(r(0,"p",7),o(1),p(2,"translate"),n()),t&2&&(i(),s(c(2,1,"restart.please_wait_while_server_restarts")))}function k(t,f){if(t&1&&(r(0,"div",8),o(1),n()),t&2){let e=v();i(),s(e.error)}}function b(t,f){t&1&&(r(0,"div",9)(1,"div",11),x(2,"i",12),n()())}function E(t,f){t&1&&(r(0,"div",10),o(1),p(2,"translate"),n()),t&2&&(i(),s(c(2,1,"platform.linux.long_time")))}var A=(()=>{class t{$api=a(C);$router=a(y);$settings=a(S);$toastr=a($);$translate=a(_);$ws=a(T);checkTimeout;checkDelay;resp={};timeout=!1;error=!1;io;constructor(){}ngOnInit(){this.io=this.$ws.connectToNamespace("status"),this.io.connected.subscribe(()=>{this.io.socket.emit("monitor-server-status"),this.$settings.getAppSettings().catch(()=>{})}),this.$api.put("/platform-tools/linux/restart-host",{}).subscribe({next:e=>{this.resp=e,this.checkIfServerUp()},error:e=>{console.error(e),this.error=this.$translate.instant("platform.linux.server_restart_error"),this.$toastr.error(this.$translate.instant("platform.linux.server_restart_error"),this.$translate.instant("toast.title_error"))}})}checkIfServerUp(){this.checkDelay=setTimeout(()=>{this.io.socket.on("homebridge-status",e=>{(e.status==="up"||e.status==="pending")&&(this.$toastr.success(this.$translate.instant("platform.linux.server_restarted"),this.$translate.instant("toast.title_success")),this.$router.navigate(["/"]))})},3e4),this.checkTimeout=setTimeout(()=>{this.$toastr.warning(this.$translate.instant("platform.linux.server_taking_long_time"),this.$translate.instant("toast.title_warning"),{timeOut:1e4}),this.timeout=!0},12e4)}ngOnDestroy(){this.io.end(),clearTimeout(this.checkDelay),clearTimeout(this.checkTimeout)}static \u0275fac=function(d){return new(d||t)};static \u0275cmp=h({type:t,selectors:[["ng-component"]],decls:15,vars:10,consts:[[1,"d-flex","justify-content-between"],[1,"primary-text","m-0"],[1,"my-4","align-items-center",2,"max-width","1000px","margin","auto"],[1,"w-100","text-center","primary-text","mb-5"],[1,"fas","fa-fw","fa-power-off",2,"font-size","75px"],[1,"text-center"],[1,"primary-text","mb-4"],[1,"grey-text"],[1,"alert","alert-error","my-4"],[1,"justify-content-center","my-4"],[1,"alert","alert-warning","my-4"],[1,"restart-progress-box","primary-text"],[1,"fas","fa-fw","fa-spinner","fa-spin"]],template:function(d,u){d&1&&(r(0,"div",0)(1,"h3",1),o(2),p(3,"translate"),n()(),r(4,"div",2)(5,"div",3),x(6,"i",4),n(),r(7,"div",5)(8,"h4",6),o(9),p(10,"translate"),n(),l(11,w,3,3,"p",7),l(12,k,2,1,"div",8),l(13,b,3,0,"div",9),l(14,E,3,3,"div",10),n()()),d&2&&(i(2),s(c(3,6,"menu.restart.title")),i(7),s(c(10,8,"platform.linux.restarting_server")),i(2),m(u.error?-1:11),i(),m(u.error?12:-1),i(),m(u.error?-1:13),i(),m(u.timeout?14:-1))},dependencies:[g],styles:[".restart-progress-box[_ngcontent-%COMP%]{font-size:22px;font-weight:300;margin-top:15px}"]})}return t})();export{A as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as n}from"./chunk-JBQX4JBH.js";import{b as s}from"./chunk-
|
|
1
|
+
import{d as n}from"./chunk-JBQX4JBH.js";import{b as s}from"./chunk-4WLTWMEZ.js";import{ga as o,h as r,la as e,w as i}from"./chunk-W6X46MTW.js";var l=(()=>{class t{$router=e(n);$settings=e(s);constructor(){}canActivate(){return r(this,null,function*(){return this.$settings.settingsLoaded||(yield i(this.$settings.onSettingsLoaded)),this.$settings.env.setupWizardComplete===!1||this.$router.navigate(["/"]),!0})}static \u0275fac=function(a){return new(a||t)};static \u0275prov=o({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();export{l as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-UJNJDPHO.js";import"./chunk-WUXDJZ6X.js";import"./chunk-LPIANZIZ.js";import"./chunk-6XANA56B.js";import"./chunk-WTTWP6KF.js";import"./chunk-QJQSHTGR.js";import"./chunk-S6UXXPGF.js";import"./chunk-E7XYGOQD.js";import"./chunk-AJTG3DAQ.js";import"./chunk-J764EFYE.js";import"./chunk-SCRWY2OT.js";import"./chunk-IMPGSXGE.js";import"./chunk-2NQ5FYSH.js";import"./chunk-5NG7YGKN.js";import"./chunk-JBQX4JBH.js";import"./chunk-U5H55F36.js";import"./chunk-XK6HSLL7.js";import"./chunk-4WLTWMEZ.js";import"./chunk-2SCPTKR7.js";import"./chunk-EM4PY2IW.js";import"./chunk-555LSHXI.js";import"./chunk-W6X46MTW.js";export{a as PluginsComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as a}from"./chunk-55JMWTF3.js";import"./chunk-J764EFYE.js";import"./chunk-2NQ5FYSH.js";import"./chunk-5NG7YGKN.js";import"./chunk-JBQX4JBH.js";import"./chunk-XK6HSLL7.js";import"./chunk-4WLTWMEZ.js";import"./chunk-2SCPTKR7.js";import"./chunk-EM4PY2IW.js";import"./chunk-555LSHXI.js";import"./chunk-W6X46MTW.js";export{a as UsersComponent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as P}from"./chunk-WTTWP6KF.js";import{a as O}from"./chunk-S6UXXPGF.js";import{c as y,e as E,l as k,z as $}from"./chunk-5NG7YGKN.js";import{b as D}from"./chunk-JBQX4JBH.js";import{b as L}from"./chunk-
|
|
1
|
+
import{a as P}from"./chunk-WTTWP6KF.js";import{a as O}from"./chunk-S6UXXPGF.js";import{c as y,e as E,l as k,z as $}from"./chunk-5NG7YGKN.js";import{b as D}from"./chunk-JBQX4JBH.js";import{b as L}from"./chunk-4WLTWMEZ.js";import{k as I,n as H}from"./chunk-2SCPTKR7.js";import{a as T}from"./chunk-555LSHXI.js";import{$a as s,Hb as d,Ib as m,Nb as f,Ob as u,Pb as l,Qb as w,Ub as g,Xb as _,Yb as a,h as S,jc as v,la as r,lb as x,qc as b,ra as c,rc as M,sa as p,sc as V,w as C}from"./chunk-W6X46MTW.js";function z(i,h){i&1&&w(0,"i",6)}function A(i,h){i&1&&w(0,"i",7)}function F(i,h){if(i&1){let t=g();u(0,"ngx-monaco-editor",10),_("onInit",function(e){c(t);let o=a();return p(o.onEditorInit(e))})("keydown.control.s",function(e){c(t);let o=a();return e.preventDefault(),p(o.onSave())})("keydown.meta.s",function(e){c(t);let o=a();return e.preventDefault(),p(o.onSave())}),l()}if(i&2){let t=a();f("options",t.editorOptions)("model",t.monacoEditorModel)}}function W(i,h){if(i&1){let t=g();u(0,"textarea",11),V("ngModelChange",function(e){c(t);let o=a();return M(o.startupScript,e)||(o.startupScript=e),p(e)}),v(1," "),l()}if(i&2){let t=a();b("ngModel",t.startupScript)}}var tt=(()=>{class i{$api=r(H);$md=r(O);$route=r(D);$settings=r(L);$toastr=r(I);$translate=r(T);startupScript;saveInProgress;isMobile=!1;options={printMargin:!1};monacoEditor;editorOptions;monacoEditorModel;lastHeight;visualViewPortEventCallback;constructor(){this.isMobile=this.$md.detect.mobile()}ngOnInit(){this.editorOptions={language:"shell",theme:this.$settings.actualLightingMode==="dark"?"vs-dark":"vs-light",automaticLayout:!0},this.visualViewPortEventCallback=()=>this.visualViewPortChanged(),this.lastHeight=window.innerHeight,window.visualViewport&&!this.isMobile&&(window.visualViewport.addEventListener("resize",this.visualViewPortEventCallback,!0),this.$md.disableTouchMove()),this.$route.data.subscribe(t=>{this.startupScript=t.startupScript.script}),this.monacoEditorModel={value:"",language:"shell"}}onEditorInit(t){this.monacoEditor=t,this.monacoEditor.getModel().setValue(this.startupScript)}onSave(){return S(this,null,function*(){if(!this.saveInProgress){if(this.saveInProgress=!0,this.isMobile||(yield this.monacoEditor.getAction("editor.action.formatDocument").run(),this.startupScript=this.monacoEditor.getModel().getValue()),!["#!/bin/sh","#!/bin/bash"].includes(this.startupScript.split(`
|
|
2
2
|
`)[0].trim())){this.$toastr.error(this.$translate.instant("platform.docker.must_use_hashbang"),this.$translate.instant("toast.title_error")),this.startupScript=`#!/bin/sh
|
|
3
3
|
|
|
4
4
|
${this.startupScript}`,this.isMobile||this.monacoEditor.getModel().setValue(this.startupScript),this.saveInProgress=!1;return}try{yield C(this.$api.put("/platform-tools/docker/startup-script",{script:this.startupScript})),this.$toastr.success(this.$translate.instant("platform.docker.restart_required"),this.$translate.instant("platform.docker.script_saved"))}catch(t){console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error"))}this.saveInProgress=!1}})}visualViewPortChanged(){this.lastHeight<window.visualViewport.height&&document.activeElement.blur(),window.visualViewport.height<window.innerHeight?(this.$md.enableTouchMove(),this.lastHeight=window.visualViewport.height):window.visualViewport.height===window.innerHeight&&(this.$md.disableTouchMove(),this.lastHeight=window.visualViewport.height)}ngOnDestroy(){window.visualViewport&&(window.visualViewport.removeEventListener("resize",this.visualViewPortEventCallback,!0),this.$md.enableTouchMove()),this.monacoEditor&&this.monacoEditor.dispose()}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=x({type:i,selectors:[["ng-component"]],decls:11,vars:5,consts:[[1,"flex-column","d-flex","align-items-stretch","h-100"],[1,"row","mb-3"],[1,"col-6"],[1,"primary-text","m-0","font-monospace"],[1,"col-6","text-end"],[1,"btn","btn-primary","waves-effect","m-0",3,"click","disabled"],[1,"fas","fa-fw","fa-floppy-disk"],[1,"fas","fa-fw","fa-spinner","fa-pulse"],[1,"flex-grow-1","h-100","w-100","my-2",3,"options","model"],["wrap","off","autocomplete","off","autocorrect","off","autocapitalize","off","spellcheck","false",1,"hb-plain-text-editor","align-self-end","h-100","w-100","my-2",3,"ngModel"],[1,"flex-grow-1","h-100","w-100","my-2",3,"onInit","keydown.control.s","keydown.meta.s","options","model"],["wrap","off","autocomplete","off","autocorrect","off","autocapitalize","off","spellcheck","false",1,"hb-plain-text-editor","align-self-end","h-100","w-100","my-2",3,"ngModelChange","ngModel"]],template:function(n,e){n&1&&(u(0,"div",0)(1,"div",1)(2,"div",2)(3,"h3",3),v(4,"startup.sh"),l()(),u(5,"div",4)(6,"button",5),_("click",function(){return e.onSave()}),d(7,z,1,0,"i",6),d(8,A,1,0,"i",7),l()()(),d(9,F,1,2,"ngx-monaco-editor",8),d(10,W,2,1,"textarea",9),l()),n&2&&(s(6),f("disabled",e.saveInProgress),s(),m(e.saveInProgress?-1:7),s(),m(e.saveInProgress?8:-1),s(),m(e.isMobile?-1:9),s(),m(e.isMobile?10:-1))},dependencies:[P,$,y,E,k],encapsulation:2})}return i})();export{tt as a};
|