@duplicati/ngclient 0.0.35 → 0.0.37
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/{chunk-DE2AAZUP.js → chunk-3WCWZJYH.js} +1 -1
- package/{chunk-X25RPH22.js → chunk-4VPUEZIU.js} +1 -1
- package/{chunk-L6DT3BQG.js → chunk-4XJFGB4E.js} +1 -1
- package/{chunk-XM4XOJPS.js → chunk-6SKCAZOP.js} +1 -1
- package/{chunk-QGSX2XOM.js → chunk-73OFEMRU.js} +1 -1
- package/{chunk-LVYTERRJ.js → chunk-7KKPI5E4.js} +1 -1
- package/{chunk-UPHEPMGX.js → chunk-A27JK2VW.js} +1 -1
- package/chunk-AUUCT7OA.js +1 -0
- package/{chunk-2X2NVYPD.js → chunk-DAXEWTI7.js} +1 -1
- package/chunk-DFKPVTYK.js +1 -0
- package/{chunk-VOINBIWD.js → chunk-DFT2UYO6.js} +1 -1
- package/{chunk-NWRHNRPB.js → chunk-EV37MCYP.js} +1 -1
- package/{chunk-BT2JRS3A.js → chunk-GL2OCAVZ.js} +1 -1
- package/{chunk-GTXQM7B6.js → chunk-HGQLQ733.js} +1 -1
- package/{chunk-RU7EY7FN.js → chunk-IO5IBATB.js} +1 -1
- package/chunk-JAY2DGID.js +1 -0
- package/chunk-JY2MTE7P.js +1 -0
- package/chunk-KMNTAMUY.js +1 -0
- package/{chunk-EWJCAT5A.js → chunk-LSBOVSYF.js} +1 -1
- package/{chunk-ZRCOVLAQ.js → chunk-M4CEGBQO.js} +1 -1
- package/{chunk-HLOYWLHV.js → chunk-M76F7EZP.js} +1 -1
- package/{chunk-LQUKRKUH.js → chunk-OZQD3PLH.js} +1 -1
- package/{chunk-B3MIBKC5.js → chunk-RDUEFPJ3.js} +1 -1
- package/{chunk-YCOOYSZG.js → chunk-SAKG3775.js} +1 -1
- package/{chunk-SZ4NLIO2.js → chunk-TW4633HQ.js} +1 -1
- package/chunk-WKYWPXQ6.js +1 -0
- package/{chunk-BJAZPKHX.js → chunk-XYNM2UME.js} +1 -1
- package/{chunk-IOH6RL5H.js → chunk-YXIGPDXN.js} +1 -1
- package/{chunk-QLPXITCK.js → chunk-Z4XFPOPE.js} +1 -1
- package/index.html +2 -2
- package/main-YZOCOTGC.js +1 -0
- package/package.json +1 -1
- package/{styles-CLP6NP2M.css → styles-DO5TEHSB.css} +1 -1
- package/chunk-E4CUHBCT.js +0 -1
- package/chunk-EHV3OZDB.js +0 -1
- package/chunk-NKPGP6QP.js +0 -1
- package/chunk-UAKB5CAQ.js +0 -1
- package/chunk-W76PK3CU.js +0 -1
- package/main-WGR4ZD6A.js +0 -1
package/chunk-W76PK3CU.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as he}from"./chunk-K7H3KYW7.js";import{a as X,b as Le}from"./chunk-DE2AAZUP.js";import{b as H}from"./chunk-KFGIVU27.js";import{a as ge,b as A,d as D,e as y,h as v,i as Ee,j as fe,l as b,o as G,p as Ce,q as Pe,r as w,t as x}from"./chunk-7SJHYZC5.js";import{a as k}from"./chunk-PIDBEXSZ.js";import{a as W,g as V,n as Ne,o as Ie,q as Re,v as Me}from"./chunk-EHV3OZDB.js";import{H as $,X as P}from"./chunk-J3H4BCHI.js";import{pa as h}from"./chunk-5ZK3D2RS.js";import{Ab as j,B as se,Bb as Fe,Cb as ue,Db as Se,E as z,Eb as n,Fb as l,Gb as a,Hb as E,Ib as f,K as le,Kb as M,Kc as de,L as ae,Qb as F,R as _e,Ra as m,Rb as u,Sb as T,Wb as C,X as _,Xb as U,Za as O,c as oe,ea as d,fa as g,fb as R,ic as L,l as ie,lb as K,lc as me,p as ne,qc as ce,v as re,vb as c,vc as Oe,xb as pe,xc as Te}from"./chunk-MR4RE3IB.js";function ve(r,t){r&1&&a(0,"spk-progress-bar",7)}function be(r,t){if(r&1&&(n(0,"option",14),L(1),Oe(2,"date"),l()),r&2){let e=t.$implicit;c("value",e.Version),m(),me("",e.Version,": ",Te(2,3,e.Time,"d MMM y, h:mm"),"")}}function Ge(r,t){if(r&1&&(n(0,"app-file-tree",15)(1,"label",16),T(2,4),l(),a(3,"input",17),l()),r&2){let e=U(2);c("rootPath",e.rootPath())("backupSettings",e.backupSettings())("multiSelect",!0)("showFiles",!0)}}function we(r,t){if(r&1&&(n(0,"spk-select",11),a(1,"input",12),E(2,13),ue(3,be,3,6,"option",14,Fe),f(),l(),K(5,Ge,4,4,"app-file-tree",15)),r&2){let e=U();c("displayFn",e.displayFn()),m(3),Se(e.versionOptions()),m(2),j(e.rootPathLoaded()?5:-1)}}var B=new w,ke=()=>B.group({filesToRestore:B.control(""),selectedOption:B.control(null),passphrase:B.control(null)}),q=class r{#t=_(k);#e=_(N);#o=_(P);#i=_($);#n=_(h);selectFilesForm=this.#e.selectFilesForm;selectFilesFormSignal=this.#e.selectFilesFormSignal;backupId=this.#e.backupId;versionOptionsLoading=this.#e.versionOptionsLoading;versionOptions=this.#e.versionOptions;backupSettings=de(()=>{let t=this.backupId(),e=this.selectFilesFormSignal()?.selectedOption;if(typeof e!="number"||!t)return null;let i=this.versionOptions()?.find(s=>s.Version===e)?.Time??null;return i?{id:t,time:i}:null});rootPathLoaded=O(!1);rootPath=he([this.selectFilesFormSignal,this.backupId],oe(le([null,null]),ae(([t,e])=>{let o=t?.selectedOption,i=e;if(typeof o!="number"||!i)return ie("/");let s=this.versionOptions()?.find(p=>p.Version===o);return this.#t.getApiV1BackupByIdFiles({id:i,time:s?.Time??"",prefixOnly:!1,folderContents:!0}).pipe(ne(p=>(this.rootPathLoaded.set(!0),p.Files[0].Path)))})));displayFn(){let t=this.versionOptions();return e=>{if(!e)return"";let o=t?.find(i=>i.Version?.toString()===e);return o?`${o.Version}: ${this.#n.transform(o.Time,"d MMM y, h:mm")}`:""}}next(){this.#o.navigate(["options"],{relativeTo:this.#i.parent})}exit(){this.#e.exit()}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=R({type:r,selectors:[["app-select-files"]],features:[ce([h])],decls:13,vars:2,consts:()=>{let t;t=$localize`Select files`;let e;e=$localize`${"\uFFFD#9\uFFFD"}:START_TAG_SPK_ICON:arrow-left${"\uFFFD/#9\uFFFD"}:CLOSE_TAG_SPK_ICON: Exit `;let o;o=$localize`${"\uFFFD#12\uFFFD"}:START_TAG_SPK_ICON:arrow-right${"\uFFFD/#12\uFFFD"}:CLOSE_TAG_SPK_ICON: Continue `;let i;i=$localize`Select an option...`;let s;return s=$localize`Path`,[["formRef",""],t,e,o,s,[3,"submit","formGroup"],[1,"title-30"],[1,"indeterminate","primary"],[1,"form-actions"],["spk-button","","type","button",3,"click"],["spk-button","","type","submit",1,"raised","primary"],[3,"displayFn"],["type","number","placeholder",i,"formControlName","selectedOption"],["options",""],[3,"value"],[3,"rootPath","backupSettings","multiSelect","showFiles"],["for","path"],["type","text","id","path","formControlName","filesToRestore"]]},template:function(e,o){if(e&1){let i=M();n(0,"form",5,0),C("submit",function(){return d(i),g(o.next())}),n(2,"h3",6),T(3,1),l(),K(4,ve,1,0,"spk-progress-bar",7)(5,we,6,2),n(6,"div",8)(7,"button",9),C("click",function(){return d(i),g(o.exit())}),F(8,2),a(9,"spk-icon"),u(),l(),n(10,"button",10),F(11,3),a(12,"spk-icon"),u(),l()()()}e&2&&(c("formGroup",o.selectFilesForm),m(4),j(o.versionOptionsLoading()?4:5))},dependencies:[x,v,Ce,Pe,A,Ee,D,y,b,G,h,X,V,W,Re,Ne],styles:["[_nghost-%COMP%]{display:block}form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.form-actions[_ngcontent-%COMP%]{display:flex;justify-content:space-between}"],changeDetection:0})};var N=class r{#t=_(P);#e=_(k);backupId=O(null);backup=O(null);selectFilesForm=ke();optionsForm=Ae();optionsFormSignal=H(this.optionsForm.valueChanges);selectFilesFormSignal=H(this.selectFilesForm.valueChanges);versionOptionsLoading=O(!1);versionOptions=O([]);isSubmitting=O(!1);init(t){this.backupId.set(t),this.#o(t,!0)}submit(){this.isSubmitting.set(!0);let t=this.backupId(),e=this.optionsForm.value,o=this.selectFilesForm.value,i=this.versionOptions()?.find(s=>s.Version===o.selectedOption);this.#e.postApiV1BackupByIdRestore({id:t??"",requestBody:{paths:o.filesToRestore?.split("\0").map(s=>`${s}*`)??[],passphrase:o.passphrase??null,time:i?.Time,restore_path:e.restoreFromPath,overwrite:e.handleExisting==="overwrite",permissions:e.permissions,skip_metadata:!0}}).pipe(z(()=>this.isSubmitting.set(!1))).subscribe({next:()=>this.exit(),error:s=>{console.error("restore error",s)}})}exit(){this.#i(),this.#t.navigate(["/"])}getVersionOptions(){this.versionOptions()}#o(t,e=!1){this.versionOptionsLoading.set(!0),re([this.#e.getApiV1BackupById({id:t}),this.#e.getApiV1BackupByIdFilesets({id:t})]).pipe(se(1),z(()=>this.versionOptionsLoading.set(!1))).subscribe({next:([o,i])=>{this.versionOptions.set(i),this.backup.set(o),e&&this.selectFilesForm.controls.selectedOption.setValue(i[0].Version)}})}#i(){this.selectFilesForm.reset(),this.optionsForm.reset()}static \u0275fac=function(e){return new(e||r)};static \u0275prov=_e({token:r,factory:r.\u0275fac,providedIn:"root"})};var I=new w,Ae=()=>I.group({restoreFrom:I.control("orignal"),restoreFromPath:I.control(""),handleExisting:I.control("overwrite"),permissions:I.control(!1)}),J=class r{#t=_(N);#e=_(P);#o=_($);optionsForm=this.#t.optionsForm;optionsFormSignal=this.#t.optionsFormSignal;isSubmitting=this.#t.isSubmitting;goBack(){this.#e.navigate(["select-files"],{relativeTo:this.#o.parent})}submit(){this.#t.submit()}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=R({type:r,selectors:[["app-options"]],decls:39,vars:6,consts:()=>{let t;t=$localize`Restore options`;let e;e=$localize`Where do you want to restore files from?`;let o;o=$localize` Original location ${"\uFFFD#9\uFFFD\uFFFD/#9\uFFFD"}:TAG_INPUT:`;let i;i=$localize` Pick location ${"\uFFFD#12\uFFFD\uFFFD/#12\uFFFD"}:TAG_INPUT:`;let s;s=$localize`How do you want to handle existing files?`;let p;p=$localize` Overwrite ${"\uFFFD#22\uFFFD\uFFFD/#22\uFFFD"}:TAG_INPUT:`;let Q;Q=$localize` Save different versions with timestamp in file name ${"\uFFFD#25\uFFFD\uFFFD/#25\uFFFD"}:TAG_INPUT:`;let Y;Y=$localize`Permissions`;let Z;Z=$localize` Restore read/write permissions ${"\uFFFD#31\uFFFD\uFFFD/#31\uFFFD"}:TAG_INPUT:`;let ee;ee=$localize`${"\uFFFD#35\uFFFD"}:START_TAG_SPK_ICON:arrow-left${"\uFFFD/#35\uFFFD"}:CLOSE_TAG_SPK_ICON: Go back `;let te;return te=$localize`${"\uFFFD#38\uFFFD"}:START_TAG_SPK_ICON:arrow-right${"\uFFFD/#38\uFFFD"}:CLOSE_TAG_SPK_ICON: Submit `,[["formRef",""],t,e,o,i,s,p,Q,Y,Z,ee,te,[3,"submit","formGroup"],[1,"title-30"],[3,"disallowToggle"],["title",""],[1,"raised","primary"],["type","radio","name","restoreFrom","value","orignal","formControlName","restoreFrom"],["type","radio","name","restoreFrom","value","pickLocation","formControlName","restoreFrom"],[3,"disabled"],["for","path"],["type","text","id","path","formControlName","restoreFromPath"],["type","radio","name","handleExisting","value","overwrite","formControlName","handleExisting"],["type","radio","name","handleExisting","value","saveTimestamp","formControlName","handleExisting"],[1,"primary","raised"],["type","checkbox","formControlName","permissions"],[1,"form-actions"],["spk-button","","type","button",3,"click"],["spk-button","","type","submit",1,"raised","primary"]]},template:function(e,o){if(e&1){let i=M();n(0,"form",12,0),C("submit",function(){return d(i),g(o.submit())}),n(2,"h3",13),T(3,1),l(),n(4,"app-toggle-card",14),E(5,15),T(6,2),f(),n(7,"spk-radio",16),F(8,3),a(9,"input",17),u(),l(),n(10,"spk-radio",16),F(11,4),a(12,"input",18),u(),l(),n(13,"app-file-tree",19)(14,"label",20),L(15,"Path"),l(),a(16,"input",21),l()(),n(17,"app-toggle-card",14),E(18,15),T(19,5),f(),n(20,"spk-radio",16),F(21,6),a(22,"input",22),u(),l(),n(23,"spk-radio",16),F(24,7),a(25,"input",23),u(),l()(),n(26,"app-toggle-card"),E(27,15),T(28,8),f(),n(29,"spk-toggle",24),F(30,9),a(31,"input",25),u(),l()(),n(32,"div",26)(33,"button",27),C("click",function(){return d(i),g(o.goBack())}),F(34,10),a(35,"spk-icon"),u(),l(),n(36,"button",28),F(37,11),a(38,"spk-icon"),u(),l()()()}if(e&2){let i;c("formGroup",o.optionsForm),m(4),c("disallowToggle",!0),m(9),c("disabled",((i=o.optionsFormSignal())==null?null:i.restoreFrom)!=="pickLocation"),m(4),c("disallowToggle",!0),m(19),pe("loader",o.isSubmitting())}},dependencies:[x,v,A,ge,fe,D,y,b,G,Le,X,Me,Ie,V,W],styles:["[_nghost-%COMP%]{display:block}form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.form-actions[_ngcontent-%COMP%]{display:flex;justify-content:space-between}"],changeDetection:0})};export{Ae as a,J as b,ke as c,q as d,N as e};
|
package/main-WGR4ZD6A.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as se,c as ie}from"./chunk-N35HGIXN.js";import{a as oe}from"./chunk-V7APGUBT.js";import"./chunk-KFGIVU27.js";import{a as I}from"./chunk-SSYD4I7W.js";import{a as b}from"./chunk-6M3MNJ52.js";import{d as te}from"./chunk-PIDBEXSZ.js";import{c as ne}from"./chunk-EHV3OZDB.js";import{H as Z,L as Q,X as S,ca as Y,ma as ee}from"./chunk-J3H4BCHI.js";import{a as X}from"./chunk-P6LV5I2K.js";import{a as $,b as z,d as B,e as q,f as _}from"./chunk-5XX7BU4I.js";import"./chunk-5ZK3D2RS.js";import{b as re}from"./chunk-OVIL3KMN.js";import{Bc as J,Cc as G,E as w,Gb as D,J as P,L as R,Mc as K,N as W,R as y,U as H,X as r,Za as l,d as x,fb as F,g as V,ja as U,m as E,x as j,y as O}from"./chunk-MR4RE3IB.js";import"./chunk-C6Q5SG76.js";var d=class o{#o=l(null);#n=window.self!==window.top;config=this.#o.asReadonly();configLoaded=this.#n?new V:null;parentIframeListner=null;parentOrigin="*";fetchConfig(){this.#i(),this.#n&&(this.parentIframeListner=new AbortController,this.#e("connected"),window.addEventListener("message",e=>{if(e.data.startsWith("access:")){let t=e.data.replace("access:",""),n=JSON.parse(t);if(!n?.accessToken||!n?.clientId){this.#e("error:invalid-config");return}if(typeof n.clientId!="string"){this.#e("error:invalid-config");return}if(typeof n.accessToken!="string"){this.#e("error:invalid-config");return}console.info("postMessage config set"),this.#o.set(n),this.configLoaded?.next(!0)}},{signal:this.parentIframeListner.signal}))}#e(e){window.parent.postMessage(e,"*")}#i(){this.parentIframeListner&&(this.parentIframeListner.abort(),this.parentIframeListner=null)}setConfig(e){this.#o.set(e)}clearConfig(){this.#o.set(null)}static \u0275fac=function(t){return new(t||o)};static \u0275prov=y({token:o,factory:o.\u0275fac,providedIn:"root"})};var M=class o{#o=r(b);#n=r(Z);#e=r(d);sub=null;ngOnInit(){this.#e.fetchConfig(),this.sub=this.#n.queryParams.subscribe(({accessToken:e,clientId:t})=>{e?.length&&t?.length&&this.#e.setConfig({accessToken:e,clientId:t})}),this.#o.clearAllNotCurrentVersion()}ngOnDestroy(){this.sub?.unsubscribe()}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=F({type:o,selectors:[["app-root"]],decls:1,vars:0,template:function(t,n){t&1&&D(0,"router-outlet")},dependencies:[Q],encapsulation:2})};var ae={production:!0,baseUrl:"/api",machineServerUrl:"${WS_URL}",defaultTimeout:3e4};var u=new H("ENVIRONMENT");var T=class o{#o=r(te);isLoaded=l(!1);webmodules=l(null);preload(e=!1){let t=this.#o.getApiV1Webmodules().pipe(W(n=>this.webmodules.set(n)),w(()=>this.isLoaded.set(!0)));if(e)return t;t.subscribe()}static \u0275fac=function(t){return new(t||o)};static \u0275prov=y({token:o,factory:o.\u0275fac,providedIn:"root"})};var ue=()=>{let o=r(d),e=r(U);return o.configLoaded===null&&console.log("preload"),o.configLoaded?.pipe(R(()=>j(e.get(oe).preload(!0),e.get(T).preload(!0))))},pe=[{path:"",children:[{path:"login",canActivate:[()=>r(I).token()!==null?r(S).navigate(["/"]):!0],loadComponent:()=>import("./chunk-EWJCAT5A.js")},{path:"logout",loadComponent:()=>import("./chunk-LVYTERRJ.js")},{path:"",canActivate:[ue],loadComponent:()=>import("./chunk-2X2NVYPD.js"),children:[{path:"",loadComponent:()=>import("./chunk-E4CUHBCT.js")},{path:"add-backup",loadComponent:()=>import("./chunk-BJAZPKHX.js")},{path:"backup/:id/export",loadComponent:()=>import("./chunk-B3MIBKC5.js")},{path:"backup/import",loadComponent:()=>import("./chunk-NWRHNRPB.js")},{path:"backup-draft/:id",loadComponent:()=>import("./chunk-XM4XOJPS.js"),loadChildren:()=>import("./chunk-NKPGP6QP.js")},{path:"backup/:id",loadComponent:()=>import("./chunk-XM4XOJPS.js"),loadChildren:()=>import("./chunk-NKPGP6QP.js")},{path:"restore",loadComponent:()=>import("./chunk-HLOYWLHV.js")},{path:"restore-flow/:id",loadComponent:()=>import("./chunk-LQUKRKUH.js"),children:[{path:"",redirectTo:"select-files",pathMatch:"full"},{path:"select-files",loadComponent:()=>import("./chunk-ZRCOVLAQ.js")},{path:"options",loadComponent:()=>import("./chunk-RU7EY7FN.js")}]},{path:"settings",loadComponent:()=>import("./chunk-UAKB5CAQ.js")},{path:"about",loadComponent:()=>import("./chunk-QGSX2XOM.js"),children:[{path:"",redirectTo:"general",pathMatch:"full"},{path:"general",loadComponent:()=>import("./chunk-UPHEPMGX.js")},{path:"changelog",loadComponent:()=>import("./chunk-ZI3FISVO.js")},{path:"libraries",loadComponent:()=>import("./chunk-VOINBIWD.js")},{path:"system-info",loadComponent:()=>import("./chunk-443IB2NN.js")},{path:"logs",loadComponent:()=>import("./chunk-X25RPH22.js")}]}]}]}];var A=null,ce=(o,e)=>{let t=r(I),n=r(S),c=r(b),i=r(u),f=r(ne),s=c.getItem("locale"),p=se(s),h=o;if(t.token()&&o.url.startsWith(i.baseUrl)){let a=o.headers.set("Authorization",`Bearer ${t.token()}`);s&&s!=="en-US"&&(a=a.set("X-Ui-Language",p)),h=o.clone({headers:a})}return e(h).pipe(O(a=>{if(f.error(a.message),a.status===401&&!A&&(A=t.refreshToken().pipe(P())),a.status===401)return A.pipe(R(()=>e(o.clone({headers:o.headers.set("Authorization",`Bearer ${t.token()}`)}))),O(g=>(n.navigate(["/logout"]),E(()=>g))),w(()=>A=null));let m=`Error Code: ${a.status}, Message: ${a.message}`;return E(()=>({error:a,message:m}))}))};var fe="1.0.0",le="portal-proxy-client",he=1,k=class o{#o=1e3;#n=r(u);#e=l("disconnected");#i=l(this.#o);#a=l(!1);#r=l(!1);#p=l(null);isConnectedToMachineServer=this.#r.asReadonly();wsState=this.#e.asReadonly();#c=[];#s={};#t=null;#m=new TextDecoder("utf-8");#l=null;#d=K(()=>{let e=this.#a(),t=this.#i(),n=this.#p();if(!n||!e||!t||t<this.#o){this.#l&&window.clearInterval(this.#l);return}this.#l=window.setInterval(()=>{this.connectToMachineServer(n)},t)});utf8Atob(e){let t=Uint8Array.from(atob(e),c=>c.charCodeAt(0)),n=this.#m.decode(t);return n?JSON.parse(n):null}connectToMachineServer(e,t){let n=t?.reconnect??!1;this.#t&&this.wsState()==="authenticated"&&!n||(this.#t&&this.wsState()!=="authenticated"&&this.#t.close(),this.#t=new WebSocket(this.#n.machineServerUrl),this.#t.onopen=()=>{this.#e.set("connect"),this.#r.set(!0),this.#a.set(!1),this.#p.set(null)},this.#t.onclose=()=>{this.#e.set("disconnected"),this.#r.set(!1),this.#p.set(e),this.#a.set(!0)},this.#t.onerror=()=>{this.#e.set("error")},this.#t.onmessage=c=>{let i=JSON.parse(c.data);if(this.wsState()==="connect"){if(i.type!=="welcome"){this.disconnectFromMachineServer(`Unexpected message type, expected 'welcome' but got '${i.type}'`);return}let s={token:e,publicKey:"",clientVersion:fe,protocolVersion:he},p=this.createResponse(i,"authportal",s);this.#e.set("welcome"),this.#t?.send(p)}else if(this.wsState()==="welcome"){if(i.type!=="authportal"){this.disconnectFromMachineServer(`Unexpected message type, expected 'authportal' but got '${i.type}'`);return}var f=JSON.parse(i.payload??"");if(f.accepted===!1){this.disconnectFromMachineServer("Authentication failed");return}for(this.#e.set("authenticated"),this.#r.set(!0);this.#c.length>0;){let s=this.#c.pop();s&&this.#s[s.messageId]&&this.activateCommand(s)}}else if(this.wsState()==="authenticated"){if(i.type!=="command"){console.warn(`Unexpected message type, expected 'command' but got '${i.type}'`);return}let s=this.#s[i.messageId];if(s){if(i.errorMessage){s.reject(i.errorMessage);return}else{let p=JSON.parse(i.payload??"");p.body=p?.body==null?null:this.utf8Atob(p.body),s.resolve(p)}delete this.#s[i.messageId],window.clearTimeout(s.timer)}}})}disconnectFromMachineServer(e=null){e&&console.error(e),this.#t?.close(),this.#t=null,this.#e.set("disconnected"),this.#r.set(!1)}createResponse(e,t,n){let c={from:le,to:e.from,type:t,messageId:e.messageId,payload:JSON.stringify(n)};return JSON.stringify(c)}sendCommand(e,t,n,c,i,f,s=5e3){return(this.wsState()==="disconnected"||this.wsState()==="error")&&this.connectToMachineServer(e),new Promise((p,h)=>{let a=crypto.randomUUID(),g={from:le,to:t,type:"command",messageId:a,payload:JSON.stringify({method:n,path:c,body:i,headers:f})},v={resolve:p,reject:h,timer:window.setTimeout(()=>{let C=this.#s[a];C&&(delete this.#s[a],C.reject("Timeout"))},s)};this.#s[a]=v,this.#r()?this.activateCommand(g):this.#c.push(g)})}activateCommand(e){this.#t?.send(JSON.stringify(e))}static \u0275fac=function(t){return new(t||o)};static \u0275prov=y({token:o,factory:o.\u0275fac,providedIn:"root"})};function ge(o){if(typeof o!="string")return null;let t=new TextEncoder().encode(o);return window.btoa(String.fromCharCode(...t))}var me=(o,e)=>{let n=r(d).config(),c=r(u);if(n===null)return e(o);let i=r(k),f=ge(o.body),s={};o.headers.keys().forEach(m=>{s[m]=o.headers.get(m)??""});let p=o.headers.get("timeout"),h=p!==null?parseInt(p):c.defaultTimeout,a=i.sendCommand(n.accessToken,n.clientId,o.method,o.url,f,s,h);return new x(m=>{a.then(g=>{let v=new $;s!=null&&Object.keys(s).forEach(L=>{v.set(L,s[L])});let C=new z({body:g.body,status:g.code,statusText:"OK",headers:v});m.next(C),m.complete()})})};var de={providers:[J(),Y(pe,ee()),B(_(),q([me,ce])),b,{provide:u,useValue:ae},{provide:G,useValue:ie()},re]};X(M,de);
|