Please note that during the backup other concurrent write requests may fail since the
database will be temporary "locked" (this usually happens only during the ZIP generation).
If you are using S3 storage for the collections file upload, you'll have to backup them
separately since they are not locally stored and will not be included in the final backup!
`,t=C(),i=b("form"),H(s.$$.fragment),p(e,"class","alert alert-info"),p(i,"id",n[4]),p(i,"autocomplete","off")},m(a,u){w(a,e,u),w(a,t,u),w(a,i,u),q(s,i,null),l=!0,o||(r=Y(i,"submit",it(n[5])),o=!0)},p(a,u){const f={};u&98308&&(f.$$scope={dirty:u,ctx:a}),s.$set(f)},i(a){l||(M(s.$$.fragment,a),l=!0)},o(a){D(s.$$.fragment,a),l=!1},d(a){a&&(v(e),v(t),v(i)),j(s),o=!1,r()}}}function IR(n){let e;return{c(){e=b("h4"),e.textContent="Initialize new backup",p(e,"class","center txt-break")},m(t,i){w(t,e,i)},p:te,d(t){t&&v(e)}}}function LR(n){let e,t,i,s,l,o,r;return{c(){e=b("button"),t=b("span"),t.textContent="Cancel",i=C(),s=b("button"),l=b("span"),l.textContent="Start backup",p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-transparent"),e.disabled=n[3],p(l,"class","txt"),p(s,"type","submit"),p(s,"form",n[4]),p(s,"class","btn btn-expanded"),s.disabled=n[3],x(s,"btn-loading",n[3])},m(a,u){w(a,e,u),y(e,t),w(a,i,u),w(a,s,u),y(s,l),o||(r=Y(e,"click",n[0]),o=!0)},p(a,u){u&8&&(e.disabled=a[3]),u&8&&(s.disabled=a[3]),u&8&&x(s,"btn-loading",a[3])},d(a){a&&(v(e),v(i),v(s)),o=!1,r()}}}function AR(n){let e,t,i={class:"backup-create-panel",beforeOpen:n[8],beforeHide:n[9],popup:!0,$$slots:{footer:[LR],header:[IR],default:[DR]},$$scope:{ctx:n}};return e=new nn({props:i}),n[10](e),e.$on("show",n[11]),e.$on("hide",n[12]),{c(){H(e.$$.fragment)},m(s,l){q(e,s,l),t=!0},p(s,[l]){const o={};l&8&&(o.beforeOpen=s[8]),l&8&&(o.beforeHide=s[9]),l&65548&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(M(e.$$.fragment,s),t=!0)},o(s){D(e.$$.fragment,s),t=!1},d(s){n[10](null),j(e,s)}}}function PR(n,e,t){const i=wt(),s="backup_create_"+U.randomString(5);let l,o="",r=!1,a;function u(S){Jt({}),t(3,r=!1),t(2,o=S||""),l==null||l.show()}function f(){return l==null?void 0:l.hide()}async function c(){if(!r){t(3,r=!0),clearTimeout(a),a=setTimeout(()=>{f()},1500);try{await _e.backups.create(o,{$cancelKey:s}),t(3,r=!1),f(),i("submit"),tn("Successfully generated new backup.")}catch(S){S.isAbort||_e.error(S)}clearTimeout(a),t(3,r=!1)}}oo(()=>{clearTimeout(a)});function d(){o=this.value,t(2,o)}const m=()=>r?(Ks("A backup has already been started, please wait."),!1):!0,h=()=>(r&&Ks("The backup was started but may take a while to complete. You can come back later.",4500),!0);function g(S){ne[S?"unshift":"push"](()=>{l=S,t(1,l)})}function _(S){Le.call(this,n,S)}function k(S){Le.call(this,n,S)}return[f,l,o,r,s,c,u,d,m,h,g,_,k]}class NR extends we{constructor(e){super(),ve(this,e,PR,AR,be,{show:6,hide:0})}get show(){return this.$$.ctx[6]}get hide(){return this.$$.ctx[0]}}function RR(n){let e,t,i,s,l,o,r,a;return{c(){e=b("label"),t=W("Backup name"),s=C(),l=b("input"),p(e,"for",i=n[15]),p(l,"type","text"),p(l,"id",o=n[15]),l.required=!0},m(u,f){w(u,e,f),y(e,t),w(u,s,f),w(u,l,f),me(l,n[2]),r||(a=Y(l,"input",n[9]),r=!0)},p(u,f){f&32768&&i!==(i=u[15])&&p(e,"for",i),f&32768&&o!==(o=u[15])&&p(l,"id",o),f&4&&l.value!==u[2]&&me(l,u[2])},d(u){u&&(v(e),v(s),v(l)),r=!1,a()}}}function FR(n){let e,t,i,s,l,o,r,a,u,f,c,d,m,h,g,_;return u=new Oi({props:{value:n[1]}}),m=new fe({props:{class:"form-field required m-0",name:"name",$$slots:{default:[RR,({uniqueId:k})=>({15:k}),({uniqueId:k})=>k?32768:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),e.innerHTML=`Please proceed with caution and use it only with trusted backups!
Backup restore is experimental and works only on UNIX based systems.
The restore operation will attempt to replace your existing pb_data
with the one from
the backup and will restart the application process.
This means that on success all of your data (including app settings, users, superusers, etc.) will
be replaced with the ones from the backup.
Nothing will happen if the backup is invalid or incompatible (ex. missing
data.db
file).
`,t=C(),i=b("div"),s=W(`Type the backup name
`),l=b("div"),o=b("span"),r=W(n[1]),a=C(),H(u.$$.fragment),f=W(`
to confirm:`),c=C(),d=b("form"),H(m.$$.fragment),p(e,"class","alert alert-danger"),p(o,"class","txt"),p(l,"class","label"),p(i,"class","content m-b-xs"),p(d,"id",n[6]),p(d,"autocomplete","off")},m(k,S){w(k,e,S),w(k,t,S),w(k,i,S),y(i,s),y(i,l),y(l,o),y(o,r),y(l,a),q(u,l,null),y(i,f),w(k,c,S),w(k,d,S),q(m,d,null),h=!0,g||(_=Y(d,"submit",it(n[7])),g=!0)},p(k,S){(!h||S&2)&&se(r,k[1]);const $={};S&2&&($.value=k[1]),u.$set($);const T={};S&98308&&(T.$$scope={dirty:S,ctx:k}),m.$set(T)},i(k){h||(M(u.$$.fragment,k),M(m.$$.fragment,k),h=!0)},o(k){D(u.$$.fragment,k),D(m.$$.fragment,k),h=!1},d(k){k&&(v(e),v(t),v(i),v(c),v(d)),j(u),j(m),g=!1,_()}}}function qR(n){let e,t,i,s;return{c(){e=b("h4"),t=W("Restore "),i=b("strong"),s=W(n[1]),p(e,"class","popup-title txt-ellipsis svelte-1fcgldh")},m(l,o){w(l,e,o),y(e,t),y(e,i),y(i,s)},p(l,o){o&2&&se(s,l[1])},d(l){l&&v(e)}}}function jR(n){let e,t,i,s,l,o,r,a;return{c(){e=b("button"),t=W("Cancel"),i=C(),s=b("button"),l=b("span"),l.textContent="Restore backup",p(e,"type","button"),p(e,"class","btn btn-transparent"),e.disabled=n[4],p(l,"class","txt"),p(s,"type","submit"),p(s,"form",n[6]),p(s,"class","btn btn-expanded"),s.disabled=o=!n[5]||n[4],x(s,"btn-loading",n[4])},m(u,f){w(u,e,f),y(e,t),w(u,i,f),w(u,s,f),y(s,l),r||(a=Y(e,"click",n[0]),r=!0)},p(u,f){f&16&&(e.disabled=u[4]),f&48&&o!==(o=!u[5]||u[4])&&(s.disabled=o),f&16&&x(s,"btn-loading",u[4])},d(u){u&&(v(e),v(i),v(s)),r=!1,a()}}}function HR(n){let e,t,i={class:"backup-restore-panel",overlayClose:!n[4],escClose:!n[4],beforeHide:n[10],popup:!0,$$slots:{footer:[jR],header:[qR],default:[FR]},$$scope:{ctx:n}};return e=new nn({props:i}),n[11](e),e.$on("show",n[12]),e.$on("hide",n[13]),{c(){H(e.$$.fragment)},m(s,l){q(e,s,l),t=!0},p(s,[l]){const o={};l&16&&(o.overlayClose=!s[4]),l&16&&(o.escClose=!s[4]),l&16&&(o.beforeHide=s[10]),l&65590&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(M(e.$$.fragment,s),t=!0)},o(s){D(e.$$.fragment,s),t=!1},d(s){n[11](null),j(e,s)}}}function zR(n,e,t){let i;const s="backup_restore_"+U.randomString(5);let l,o="",r="",a=!1,u=null;function f(S){Jt({}),t(2,r=""),t(1,o=S),t(4,a=!1),l==null||l.show()}function c(){return l==null?void 0:l.hide()}async function d(){var S;if(!(!i||a)){clearTimeout(u),t(4,a=!0);try{await _e.backups.restore(o),u=setTimeout(()=>{window.location.reload()},2e3)}catch($){clearTimeout(u),$!=null&&$.isAbort||(t(4,a=!1),Mi(((S=$.response)==null?void 0:S.message)||$.message))}}}oo(()=>{clearTimeout(u)});function m(){r=this.value,t(2,r)}const h=()=>!a;function g(S){ne[S?"unshift":"push"](()=>{l=S,t(3,l)})}function _(S){Le.call(this,n,S)}function k(S){Le.call(this,n,S)}return n.$$.update=()=>{n.$$.dirty&6&&t(5,i=r!=""&&o==r)},[c,o,r,l,a,i,s,d,f,m,h,g,_,k]}class UR extends we{constructor(e){super(),ve(this,e,zR,HR,be,{show:8,hide:0})}get show(){return this.$$.ctx[8]}get hide(){return this.$$.ctx[0]}}function q1(n,e,t){const i=n.slice();return i[22]=e[t],i}function j1(n,e,t){const i=n.slice();return i[19]=e[t],i}function VR(n){let e=[],t=new Map,i,s,l=ce(n[3]);const o=a=>a[22].key;for(let a=0;a