pocketbase/ui/dist/assets/index-DslVpixa.js

202 lines
1.0 MiB
JavaScript
Raw Normal View History

const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./FilterAutocompleteInput-CN5jyO8C.js","./index-B5ReTu-C.js","./ListApiDocs-DbJKBKk4.js","./FieldsQueryParam-DkzXaFeo.js","./ListApiDocs-DhdAtA7Y.css","./ViewApiDocs-DoFkUF5W.js","./CreateApiDocs-Bdj6lfwm.js","./UpdateApiDocs-DzmCT5PG.js","./AuthMethodsDocs-CuZok0vO.js","./AuthRefreshDocs-yEtbkHSb.js","./AuthWithPasswordDocs-ld2zw1bg.js","./AuthWithOAuth2Docs-DzQSiw2A.js","./CodeEditor-ycRnVsci.js"])))=>i.map(i=>d[i]);
var hk=Object.defineProperty;var _k=(n,e,t)=>e in n?hk(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var ct=(n,e,t)=>_k(n,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))i(l);new MutationObserver(l=>{for(const s of l)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(l){const s={};return l.integrity&&(s.integrity=l.integrity),l.referrerPolicy&&(s.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?s.credentials="include":l.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(l){if(l.ep)return;l.ep=!0;const s=t(l);fetch(l.href,s)}})();function te(){}const io=n=>n;function je(n,e){for(const t in e)n[t]=e[t];return n}function gk(n){return!!n&&(typeof n=="object"||typeof n=="function")&&typeof n.then=="function"}function Eb(n){return n()}function df(){return Object.create(null)}function De(n){n.forEach(Eb)}function Rt(n){return typeof n=="function"}function _e(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}let So;function vn(n,e){return n===e?!0:(So||(So=document.createElement("a")),So.href=e,n===So.href)}function bk(n){return Object.keys(n).length===0}function uu(n,...e){if(n==null){for(const i of e)i(void 0);return te}const t=n.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}function Mb(n){let e;return uu(n,t=>e=t)(),e}function Qe(n,e,t){n.$$.on_destroy.push(uu(e,t))}function Lt(n,e,t,i){if(n){const l=Db(n,e,t,i);return n[0](l)}}function Db(n,e,t,i){return n[1]&&i?je(t.ctx.slice(),n[1](i(e))):t.ctx}function At(n,e,t,i){if(n[2]&&i){const l=n[2](i(t));if(e.dirty===void 0)return l;if(typeof l=="object"){const s=[],o=Math.max(e.dirty.length,l.length);for(let r=0;r<o;r+=1)s[r]=e.dirty[r]|l[r];return s}return e.dirty|l}return e.dirty}function Pt(n,e,t,i,l,s){if(l){const o=Db(e,t,i,s);n.p(o,l)}}function Nt(n){if(n.ctx.length>32){const e=[],t=n.ctx.length/32;for(let i=0;i<t;i++)e[i]=-1;return e}return-1}function Ut(n){const e={};for(const t in n)t[0]!=="$"&&(e[t]=n[t]);return e}function lt(n,e){const t={};e=new Set(e);for(const i in n)!e.has(i)&&i[0]!=="$"&&(t[i]=n[i]);return t}function js(n){return n??""}function Nn(n,e,t){return n.set(t),e}function Me(n){return n&&Rt(n.destroy)?n.destroy:te}function pf(n){const e=typeof n=="string"&&n.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);return e?[parseFloat(e[1]),e[2]||"px"]:[n,"px"]}const Ib=typeof window<"u";let Or=Ib?()=>window.performance.now():()=>Date.now(),fu=Ib?n=>requestAnimationFrame(n):te;const Zl=new Set;function Lb(n){Zl.forEach(e=>{e.c(n)||(Zl.delete(e),e.f())}),Zl.size!==0&&fu(Lb)}function Er(n){let e;return Zl.size===0&&fu(Lb),{promise:new Promise(t=>{Zl.add(e={c:n,f:t})}),abort(){Zl.delete(e)}}}function w(n,e){n.appendChild(e)}function Ab(n){if(!n)return document;const e=n.getRootNode?n.getRootNode():n.ownerDocument;return e&&e.host?e:n.ownerDocument}function yk(n){const e=b("style");return e.textContent="/* empty */",kk(Ab(n),e),e.sheet}function kk(n,e){return w(n.head||n,e),e.sheet}function v(n,e,t){n.insertBefore(e,t||null)}function k(n){n.parentNode&&n.parentNode.removeChild(n)}function pt(n,e){for(let t=0;t<n.length;t+=1)n[t]&&n[t].d(e)}function b(n){return document.createElement(n)}function Y(n){return document.createTextNode(n)}function C(){return Y(" ")}function ge(){return Y("")}function B(n,e,t,i){return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t,i)}function tt(n){return function(e){return e.preventDefault(),n.call(this,e)}}function On(n){return function(e){return e.stopPropagation(),n.call(this,e)}}function p(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}const vk=["width","height"];function Xn(n,e){const t=Object.getOwnPropertyDescriptors(n.__proto__);for(const i in e)e[i]==null?n.removeAttribute(i):i==="style"?n.style.cssText=e[i]:i==="__value"?n.value
2024-09-30 00:23:19 +08:00
`;for(let _=0;_<=1;_+=a){const y=e+(t-e)*s(_);u+=_*100+`%{${o(y,1-y)}}
`}const f=u+`100% {${o(t,1-t)}}
}`,c=`__svelte_${$k(f)}_${r}`,d=Ab(n),{stylesheet:m,rules:h}=fr.get(d)||Ck(d,n);h[c]||(h[c]=!0,m.insertRule(`@keyframes ${c} ${f}`,m.cssRules.length));const g=n.style.animation||"";return n.style.animation=`${g?`${g}, `:""}${c} ${i}ms linear ${l}ms 1 both`,cr+=1,c}function Us(n,e){const t=(n.style.animation||"").split(", "),i=t.filter(e?s=>s.indexOf(e)<0:s=>s.indexOf("__svelte")===-1),l=t.length-i.length;l&&(n.style.animation=i.join(", "),cr-=l,cr||Ok())}function Ok(){fu(()=>{cr||(fr.forEach(n=>{const{ownerNode:e}=n.stylesheet;e&&k(e)}),fr.clear())})}function Ek(n,e,t,i){if(!e)return te;const l=n.getBoundingClientRect();if(e.left===l.left&&e.right===l.right&&e.top===l.top&&e.bottom===l.bottom)return te;const{delay:s=0,duration:o=300,easing:r=io,start:a=Or()+s,end:u=a+o,tick:f=te,css:c}=t(n,{from:e,to:l},i);let d=!0,m=!1,h;function g(){c&&(h=zs(n,0,1,o,s,r,c)),s||(m=!0)}function _(){c&&Us(n,h),d=!1}return Er(y=>{if(!m&&y>=a&&(m=!0),m&&y>=u&&(f(1,0),_()),!d)return!1;if(m){const S=y-a,T=0+1*r(S/o);f(T,1-T)}return!0}),g(),f(0,1),_}function Mk(n){const e=getComputedStyle(n);if(e.position!=="absolute"&&e.position!=="fixed"){const{width:t,height:i}=e,l=n.getBoundingClientRect();n.style.position="absolute",n.style.width=t,n.style.height=i,Nb(n,l)}}function Nb(n,e){const t=n.getBoundingClientRect();if(e.left!==t.left||e.top!==t.top){const i=getComputedStyle(n),l=i.transform==="none"?"":i.transform;n.style.transform=`${l} translate(${e.left-t.left}px, ${e.top-t.top}px)`}}let Vs;function Ni(n){Vs=n}function lo(){if(!Vs)throw new Error("Function called outside component initialization");return Vs}function Yt(n){lo().$$.on_mount.push(n)}function Dk(n){lo().$$.after_update.push(n)}function so(n){lo().$$.on_destroy.push(n)}function gt(){const n=lo();return(e,t,{cancelable:i=!1}={})=>{const l=n.$$.callbacks[e];if(l){const s=Pb(e,t,{cancelable:i});return l.slice().forEach(o=>{o.call(n,s)}),!s.defaultPrevented}return!0}}function Pe(n,e){const t=n.$$.callbacks[e.type];t&&t.slice().forEach(i=>i.call(this,e))}const Yl=[],ie=[];let Gl=[];const Pa=[],Rb=Promise.resolve();let Na=!1;function Fb(){Na||(Na=!0,Rb.then(cu))}function fn(){return Fb(),Rb}function nt(n){Gl.push(n)}function $e(n){Pa.push(n)}const Zr=new Set;let jl=0;function cu(){if(jl!==0)return;const n=Vs;do{try{for(;jl<Yl.length;){const e=Yl[jl];jl++,Ni(e),Ik(e.$$)}}catch(e){throw Yl.length=0,jl=0,e}for(Ni(null),Yl.length=0,jl=0;ie.length;)ie.pop()();for(let e=0;e<Gl.length;e+=1){const t=Gl[e];Zr.has(t)||(Zr.add(t),t())}Gl.length=0}while(Yl.length);for(;Pa.length;)Pa.pop()();Na=!1,Zr.clear(),Ni(n)}function Ik(n){if(n.fragment!==null){n.update(),De(n.before_update);const e=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,e),n.after_update.forEach(nt)}}function Lk(n){const e=[],t=[];Gl.forEach(i=>n.indexOf(i)===-1?e.push(i):t.push(i)),t.forEach(i=>i()),Gl=e}let gs;function du(){return gs||(gs=Promise.resolve(),gs.then(()=>{gs=null})),gs}function Ol(n,e,t){n.dispatchEvent(Pb(`${e?"intro":"outro"}${t}`))}const Xo=new Set;let wi;function re(){wi={r:0,c:[],p:wi}}function ae(){wi.r||De(wi.c),wi=wi.p}function O(n,e){n&&n.i&&(Xo.delete(n),n.i(e))}function D(n,e,t,i){if(n&&n.o){if(Xo.has(n))return;Xo.add(n),wi.c.push(()=>{Xo.delete(n),i&&(t&&n.d(1),i())}),n.o(e)}else i&&i()}const pu={duration:0};function qb(n,e,t){const i={direction:"in"};let l=e(n,t,i),s=!1,o,r,a=0;function u(){o&&Us(n,o)}function f(){const{delay:d=0,duration:m=300,easing:h=io,tick:g=te,css:_}=l||pu;_&&(o=zs(n,0,1,m,d,h,_,a++)),g(0,1);const y=Or()+d,S=y+m;r&&r.abort(),s=!0,nt(()=>Ol(n,!0,"start")),r=Er(T=>{if(s){if(T>=S)return g(1,0),Ol(n,!0,"end"),u(),s=!1;if(T>=y){const $=h((T-y)/m);g($,1-$)}}return s})}let c=!1;return{start(){c||(c=!0,Us(n),Rt(l)?(l=l(i),du().then(f)):f())},invalidate(){c=!1},end(){s&&(u(),s=!1)}}}function mu(n,e,t){const i={direction:"out"};let l=e(n,t,i),s=!0,o;const r=wi;r.r+=1;let a;function u(){const{delay:f=0,duration:c=300,easing:d=io,tick:m=te,css:h}=l||pu;h&&(o=zs(n,1,0,c,f,d,h));const g=Or()+f,_=g+c;nt(()=>Ol(n,!1,"start")),"inert"in n&&(a=n.inert,n.inert=!0),Er(y=>{if(s){if(y>=_)return m(0,1
2024-09-30 00:23:19 +08:00
`),t+=i.map(l=>{let s="";return l.name.includes("(")||l.name.includes(" ")?s+=l.name:s+="`"+l.name+"`",l.collate&&(s+=" COLLATE "+l.collate),l.sort&&(s+=" "+l.sort.toUpperCase()),s}).join(`,
`),i.length>1&&(t+=`
`),t+=")",e.where&&(t+=` WHERE ${e.where}`),t}static replaceIndexTableName(e,t){const i=z.parseIndex(e);return i.tableName=t,z.buildIndex(i)}static replaceIndexColumn(e,t,i){if(t===i)return e;const l=z.parseIndex(e);let s=!1;for(let o of l.columns)o.name===t&&(o.name=i,s=!0);return s?z.buildIndex(l):e}static normalizeSearchFilter(e,t){if(e=(e||"").trim(),!e||!t.length)return e;const i=["=","!=","~","!~",">",">=","<","<="];for(const l of i)if(e.includes(l))return e;return e=isNaN(e)&&e!="true"&&e!="false"?`"${e.replace(/^[\"\'\`]|[\"\'\`]$/gm,"")}"`:e,t.map(l=>`${l}~${e}`).join("||")}static normalizeLogsFilter(e,t=[]){return z.normalizeSearchFilter(e,["level","message","data"].concat(t))}static initSchemaField(e){return Object.assign({id:"",name:"",type:"text",system:!1,hidden:!1,required:!1},e)}static triggerResize(){window.dispatchEvent(new Event("resize"))}static getHashQueryParams(){let e="";const t=window.location.hash.indexOf("?");return t>-1&&(e=window.location.hash.substring(t+1)),Object.fromEntries(new URLSearchParams(e))}static replaceHashQueryParams(e){e=e||{};let t="",i=window.location.hash;const l=i.indexOf("?");l>-1&&(t=i.substring(l+1),i=i.substring(0,l));const s=new URLSearchParams(t);for(let a in e){const u=e[a];u===null?s.delete(a):s.set(a,u)}t=s.toString(),t!=""&&(i+="?"+t);let o=window.location.href;const r=o.indexOf("#");r>-1&&(o=o.substring(0,r)),window.location.replace(o+i)}}let Ua,gl;const Va="app-tooltip";function Wf(n){return typeof n=="string"?{text:n,position:"bottom",hideOnClick:null}:n||{}}function xi(){return gl=gl||document.querySelector("."+Va),gl||(gl=document.createElement("div"),gl.classList.add(Va),document.body.appendChild(gl)),gl}function j0(n,e){let t=xi();if(!t.classList.contains("active")||!(e!=null&&e.text)){Ba();return}t.textContent=e.text,t.className=Va+" active",e.class&&t.classList.add(e.class),e.position&&t.classList.add(e.position),t.style.top="0px",t.style.left="0px";let i=t.offsetHeight,l=t.offsetWidth,s=n.getBoundingClientRect(),o=0,r=0,a=5;e.position=="left"?(o=s.top+s.height/2-i/2,r=s.left-l-a):e.position=="right"?(o=s.top+s.height/2-i/2,r=s.right+a):e.position=="top"?(o=s.top-i-a,r=s.left+s.width/2-l/2):e.position=="top-left"?(o=s.top-i-a,r=s.left):e.position=="top-right"?(o=s.top-i-a,r=s.right-l):e.position=="bottom-left"?(o=s.top+s.height+a,r=s.left):e.position=="bottom-right"?(o=s.top+s.height+a,r=s.right-l):(o=s.top+s.height+a,r=s.left+s.width/2-l/2),r+l>document.documentElement.clientWidth&&(r=document.documentElement.clientWidth-l),r=r>=0?r:0,o+i>document.documentElement.clientHeight&&(o=document.documentElement.clientHeight-i),o=o>=0?o:0,t.style.top=o+"px",t.style.left=r+"px"}function Ba(){clearTimeout(Ua),xi().classList.remove("active"),xi().activeNode=void 0}function U2(n,e){xi().activeNode=n,clearTimeout(Ua),Ua=setTimeout(()=>{xi().classList.add("active"),j0(n,e)},isNaN(e.delay)?0:e.delay)}function He(n,e){let t=Wf(e);function i(){U2(n,t)}function l(){Ba()}return n.addEventListener("mouseenter",i),n.addEventListener("mouseleave",l),n.addEventListener("blur",l),(t.hideOnClick===!0||t.hideOnClick===null&&z.isFocusable(n))&&n.addEventListener("click",l),xi(),{update(s){var o,r;t=Wf(s),(r=(o=xi())==null?void 0:o.activeNode)!=null&&r.contains(n)&&j0(n,t)},destroy(){var s,o;(o=(s=xi())==null?void 0:s.activeNode)!=null&&o.contains(n)&&Ba(),n.removeEventListener("mouseenter",i),n.removeEventListener("mouseleave",l),n.removeEventListener("blur",l),n.removeEventListener("click",l)}}}function Pr(n){const e=n-1;return e*e*e+1}function Ws(n,{delay:e=0,duration:t=400,easing:i=io}={}){const l=+getComputedStyle(n).opacity;return{delay:e,duration:t,easing:i,css:s=>`opacity: ${s*l}`}}function Fn(n,{delay:e=0,duration:t=400,easing:i=Pr,x:l=0,y:s=0,opacity:o=0}={}){const r=getComputedStyle(n),a=+r.opacity,u=r.transform==="none"?"":r.transform,f=a*(1-o),[c,d]=pf(l),[m,h]=pf(s);return{delay:e,duration:t,easing:i,css:(g,_)=>`
2024-09-30 00:23:19 +08:00
transform: ${u} translate(${(1-g)*c}${d}, ${(1-g)*m}${h});
opacity: ${a-f*_}`}}function wt(n,{delay:e=0,duration:t=400,easing:i=Pr,axis:l="y"}={}){const s=getComputedStyle(n),o=+s.opacity,r=l==="y"?"height":"width",a=parseFloat(s[r]),u=l==="y"?["top","bottom"]:["left","right"],f=u.map(y=>`${y[0].toUpperCase()}${y.slice(1)}`),c=parseFloat(s[`padding${f[0]}`]),d=parseFloat(s[`padding${f[1]}`]),m=parseFloat(s[`margin${f[0]}`]),h=parseFloat(s[`margin${f[1]}`]),g=parseFloat(s[`border${f[0]}Width`]),_=parseFloat(s[`border${f[1]}Width`]);return{delay:e,duration:t,easing:i,css:y=>`overflow: hidden;opacity: ${Math.min(y*20,1)*o};${r}: ${y*a}px;padding-${u[0]}: ${y*c}px;padding-${u[1]}: ${y*d}px;margin-${u[0]}: ${y*m}px;margin-${u[1]}: ${y*h}px;border-${u[0]}-width: ${y*g}px;border-${u[1]}-width: ${y*_}px;`}}function Mt(n,{delay:e=0,duration:t=400,easing:i=Pr,start:l=0,opacity:s=0}={}){const o=getComputedStyle(n),r=+o.opacity,a=o.transform==="none"?"":o.transform,u=1-l,f=r*(1-s);return{delay:e,duration:t,easing:i,css:(c,d)=>`
2024-09-30 00:23:19 +08:00
transform: ${a} scale(${1-u*d});
opacity: ${r-f*d}
`}}const V2=n=>({}),Yf=n=>({}),B2=n=>({}),Kf=n=>({});function Jf(n){let e,t,i,l,s,o,r,a,u,f,c,d,m,h,g,_,y,S,T=n[4]&&!n[2]&&Zf(n);const $=n[19].header,E=Lt($,n,n[18],Kf);let M=n[4]&&n[2]&&Gf(n);const L=n[19].default,I=Lt(L,n,n[18],null),A=n[19].footer,P=Lt(A,n,n[18],Yf);return{c(){e=b("div"),t=b("div"),l=C(),s=b("div"),o=b("div"),T&&T.c(),r=C(),E&&E.c(),a=C(),M&&M.c(),u=C(),f=b("div"),I&&I.c(),c=C(),d=b("div"),P&&P.c(),p(t,"class","overlay"),p(o,"class","overlay-panel-section panel-header"),p(f,"class","overlay-panel-section panel-content"),p(d,"class","overlay-panel-section panel-footer"),p(s,"class",m="overlay-panel "+n[1]+" "+n[8]),Q(s,"popup",n[2]),p(e,"class","overlay-panel-container"),Q(e,"padded",n[2]),Q(e,"active",n[0])},m(R,N){v(R,e,N),w(e,t),w(e,l),w(e,s),w(s,o),T&&T.m(o,null),w(o,r),E&&E.m(o,null),w(o,a),M&&M.m(o,null),w(s,u),w(s,f),I&&I.m(f,null),n[21](f),w(s,c),w(s,d),P&&P.m(d,null),_=!0,y||(S=[B(t,"click",tt(n[20])),B(f,"scroll",n[22])],y=!0)},p(R,N){n=R,n[4]&&!n[2]?T?(T.p(n,N),N[0]&20&&O(T,1)):(T=Zf(n),T.c(),O(T,1),T.m(o,r)):T&&(re(),D(T,1,1,()=>{T=null}),ae()),E&&E.p&&(!_||N[0]&262144)&&Pt(E,$,n,n[18],_?At($,n[18],N,B2):Nt(n[18]),Kf),n[4]&&n[2]?M?M.p(n,N):(M=Gf(n),M.c(),M.m(o,null)):M&&(M.d(1),M=null),I&&I.p&&(!_||N[0]&262144)&&Pt(I,L,n,n[18],_?At(L,n[18],N,null):Nt(n[18]),null),P&&P.p&&(!_||N[0]&262144)&&Pt(P,A,n,n[18],_?At(A,n[18],N,V2):Nt(n[18]),Yf),(!_||N[0]&258&&m!==(m="overlay-panel "+n[1]+" "+n[8]))&&p(s,"class",m),(!_||N[0]&262)&&Q(s,"popup",n[2]),(!_||N[0]&4)&&Q(e,"padded",n[2]),(!_||N[0]&1)&&Q(e,"active",n[0])},i(R){_||(R&&nt(()=>{_&&(i||(i=ze(t,Ws,{duration:Ki,opacity:0},!0)),i.run(1))}),O(T),O(E,R),O(I,R),O(P,R),R&&nt(()=>{_&&(g&&g.end(1),h=qb(s,Fn,n[2]?{duration:Ki,y:-10}:{duration:Ki,x:50}),h.start())}),_=!0)},o(R){R&&(i||(i=ze(t,Ws,{duration:Ki,opacity:0},!1)),i.run(0)),D(T),D(E,R),D(I,R),D(P,R),h&&h.invalidate(),R&&(g=mu(s,Fn,n[2]?{duration:Ki,y:10}:{duration:Ki,x:50})),_=!1},d(R){R&&k(e),R&&i&&i.end(),T&&T.d(),E&&E.d(R),M&&M.d(),I&&I.d(R),n[21](null),P&&P.d(R),R&&g&&g.end(),y=!1,De(S)}}}function Zf(n){let e,t,i,l,s;return{c(){e=b("button"),e.innerHTML='<i class="ri-close-line" aria-hidden="true"></i>',p(e,"type","button"),p(e,"aria-label","Close"),p(e,"class","overlay-close")},m(o,r){v(o,e,r),i=!0,l||(s=B(e,"click",tt(n[5])),l=!0)},p(o,r){n=o},i(o){i||(o&&nt(()=>{i&&(t||(t=ze(e,Ws,{duration:Ki},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=ze(e,Ws,{duration:Ki},!1)),t.run(0)),i=!1},d(o){o&&k(e),o&&t&&t.end(),l=!1,s()}}}function Gf(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='<i class="ri-close-line txt-lg" aria-hidden="true"></i>',p(e,"type","button"),p(e,"aria-label","Close"),p(e,"class","btn btn-sm btn-circle btn-transparent btn-close m-l-auto")},m(l,s){v(l,e,s),t||(i=B(e,"click",tt(n[5])),t=!0)},p:te,d(l){l&&k(e),t=!1,i()}}}function W2(n){let e,t,i,l,s=n[0]&&Jf(n);return{c(){e=b("div"),s&&s.c(),p(e,"class","overlay-panel-wrapper"),p(e,"tabindex","-1")},m(o,r){v(o,e,r),s&&s.m(e,null),n[23](e),t=!0,i||(l=[B(window,"resize",n[10]),B(window,"keydown",n[9])],i=!0)},p(o,r){o[0]?s?(s.p(o,r),r[0]&1&&O(s,1)):(s=Jf(o),s.c(),O(s,1),s.m(e,null)):s&&(re(),D(s,1,1,()=>{s=null}),ae())},i(o){t||(O(s),t=!0)},o(o){D(s),t=!1},d(o){o&&k(e),s&&s.d(),n[23](null),i=!1,De(l)}}}let bl,la=[];function z0(){return bl=bl||document.querySelector(".overlays"),bl||(bl=document.createElement("div"),bl.classList.add("overlays"),document.body.appendChild(bl)),bl}let Ki=150;function Xf(){return 1e3+z0().querySelectorAll(".overlay-panel-container.active").length}function Y2(n,e,t){let{$$slots:i={},$$scope:l}=e,{class:s=""}=e,{active:o=!1}=e,{popup:r=!1}=e,{overlayClose:a=!0}=e,{btnClose:u=!0}=e,{escClose:f=!0}=e,{beforeOpen:c=void 0}=e,{beforeHide:d=void 0}=e;const m=gt(),h="op_"+z.randomString(10);let g,_,y,S,T="",$=o;function E(){typeof c=="function"&&c()===!1||t(0,o=!0)}function M(){typeof d=="function"&&d()===!1||t(0,o=!1)}function L(){return o}async function I(X){t(17,$=X),X?(y=document.activeElement,m("show"),g==null||g.focus()):(clearTimeout(S),m("hide"),y==null||y.focus()),await fn(),A()}function A(){g&&(o?t(6,g.
2024-09-30 00:23:19 +08:00
`)})),o=!0)},p(a,u){i&&Rt(i.update)&&u&8&&i.update.call(null,{position:"left",text:a[3].map(br).join(`
`)})},i(a){s||(a&&nt(()=>{s&&(l||(l=ze(t,Mt,{duration:150,start:.7},!0)),l.run(1))}),s=!0)},o(a){a&&(l||(l=ze(t,Mt,{duration:150,start:.7},!1)),l.run(0)),s=!1},d(a){a&&k(e),a&&l&&l.end(),o=!1,r()}}}function bc(n){let e,t,i=br(n[12])+"",l,s,o,r;return{c(){e=b("div"),t=b("pre"),l=Y(i),s=C(),p(e,"class","help-block help-block-error")},m(a,u){v(a,e,u),w(e,t),w(t,l),w(e,s),r=!0},p(a,u){(!r||u&8)&&i!==(i=br(a[12])+"")&&ue(l,i)},i(a){r||(a&&nt(()=>{r&&(o||(o=ze(e,wt,{duration:150},!0)),o.run(1))}),r=!0)},o(a){a&&(o||(o=ze(e,wt,{duration:150},!1)),o.run(0)),r=!1},d(a){a&&k(e),a&&o&&o.end()}}}function Xw(n){let e,t,i,l,s,o,r;const a=n[9].default,u=Lt(a,n,n[8],gc),f=[Gw,Zw],c=[];function d(m,h){return m[0]&&m[3].length?0:1}return i=d(n),l=c[i]=f[i](n),{c(){e=b("div"),u&&u.c(),t=C(),l.c(),p(e,"class",n[1]),Q(e,"error",n[3].length)},m(m,h){v(m,e,h),u&&u.m(e,null),w(e,t),c[i].m(e,null),n[11](e),s=!0,o||(r=B(e,"click",n[10]),o=!0)},p(m,[h]){u&&u.p&&(!s||h&256)&&Pt(u,a,m,m[8],s?At(a,m[8],h,Jw):Nt(m[8]),gc);let g=i;i=d(m),i===g?c[i].p(m,h):(re(),D(c[g],1,1,()=>{c[g]=null}),ae(),l=c[i],l?l.p(m,h):(l=c[i]=f[i](m),l.c()),O(l,1),l.m(e,null)),(!s||h&2)&&p(e,"class",m[1]),(!s||h&10)&&Q(e,"error",m[3].length)},i(m){s||(O(u,m),O(l),s=!0)},o(m){D(u,m),D(l),s=!1},d(m){m&&k(e),u&&u.d(m),c[i].d(),n[11](null),o=!1,r()}}}const yc="Invalid value";function br(n){return typeof n=="object"?(n==null?void 0:n.message)||(n==null?void 0:n.code)||yc:n||yc}function Qw(n,e,t){let i;Qe(n,Sn,g=>t(7,i=g));let{$$slots:l={},$$scope:s}=e;const o="field_"+z.randomString(7);let{name:r=""}=e,{inlineError:a=!1}=e,{class:u=void 0}=e,f,c=[];function d(){fi(r)}Yt(()=>(f.addEventListener("input",d),f.addEventListener("change",d),()=>{f.removeEventListener("input",d),f.removeEventListener("change",d)}));function m(g){Pe.call(this,n,g)}function h(g){ie[g?"unshift":"push"](()=>{f=g,t(2,f)})}return n.$$set=g=>{"name"in g&&t(5,r=g.name),"inlineError"in g&&t(0,a=g.inlineError),"class"in g&&t(1,u=g.class),"$$scope"in g&&t(8,s=g.$$scope)},n.$$.update=()=>{n.$$.dirty&160&&t(3,c=z.toArray(z.getNestedVal(i,r)))},[a,u,f,c,o,r,d,i,s,l,m,h]}class fe extends ye{constructor(e){super(),be(this,e,Qw,Xw,_e,{name:5,inlineError:0,class:1,changed:6})}get changed(){return this.$$.ctx[6]}}function xw(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Email"),l=C(),s=b("input"),p(e,"for",i=n[17]),p(s,"type","email"),p(s,"autocomplete","off"),p(s,"id",o=n[17]),s.required=!0,s.autofocus=!0},m(u,f){v(u,e,f),w(e,t),v(u,l,f),v(u,s,f),ce(s,n[2]),s.focus(),r||(a=B(s,"input",n[9]),r=!0)},p(u,f){f&131072&&i!==(i=u[17])&&p(e,"for",i),f&131072&&o!==(o=u[17])&&p(s,"id",o),f&4&&s.value!==u[2]&&ce(s,u[2])},d(u){u&&(k(e),k(l),k(s)),r=!1,a()}}}function e3(n){let e,t,i,l,s,o,r,a,u,f;return{c(){e=b("label"),t=Y("Password"),l=C(),s=b("input"),r=C(),a=b("div"),a.textContent="Recommended at least 10 characters.",p(e,"for",i=n[17]),p(s,"type","password"),p(s,"autocomplete","new-password"),p(s,"minlength","10"),p(s,"id",o=n[17]),s.required=!0,p(a,"class","help-block")},m(c,d){v(c,e,d),w(e,t),v(c,l,d),v(c,s,d),ce(s,n[3]),v(c,r,d),v(c,a,d),u||(f=B(s,"input",n[10]),u=!0)},p(c,d){d&131072&&i!==(i=c[17])&&p(e,"for",i),d&131072&&o!==(o=c[17])&&p(s,"id",o),d&8&&s.value!==c[3]&&ce(s,c[3])},d(c){c&&(k(e),k(l),k(s),k(r),k(a)),u=!1,f()}}}function t3(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Password confirm"),l=C(),s=b("input"),p(e,"for",i=n[17]),p(s,"type","password"),p(s,"minlength","10"),p(s,"id",o=n[17]),s.required=!0},m(u,f){v(u,e,f),w(e,t),v(u,l,f),v(u,s,f),ce(s,n[4]),r||(a=B(s,"input",n[11]),r=!0)},p(u,f){f&131072&&i!==(i=u[17])&&p(e,"for",i),f&131072&&o!==(o=u[17])&&p(s,"id",o),f&16&&s.value!==u[4]&&ce(s,u[4])},d(u){u&&(k(e),k(l),k(s)),r=!1,a()}}}function n3(n){let e,t,i,l,s,o,r,a,u,f,c,d,m,h,g,_,y,S,T;return l=new fe({props:{class:"form-field required",name:"email",$$slots:{default:[xw,({uniqueId:$})=>({17:$}),({uniqueId:$})=>$?131072:0]},$$scope:{ctx:n}}}),o=new fe({props:{class:"form-field required",name:"password",$$slots:{default:[e3,({uniqueId:$})=>({17:$}),({uniqueId:$})=>$?131072:0]},$$scope:{ctx:n}}}),a=
2024-09-30 00:23:19 +08:00
Do you really want to upload and initialize "${$.name}"?`,()=>{h($)},()=>{d()})}async function h($){if(!(!$||i)){t(1,u=!0);try{await me.backups.upload({file:$}),await me.backups.restore($.name),Ys("Please wait while extracting the uploaded archive!"),await new Promise(E=>setTimeout(E,2e3)),l("submit")}catch(E){me.error(E)}d(),t(1,u=!1)}}function g(){s=this.value,t(2,s)}function _(){o=this.value,t(3,o)}function y(){r=this.value,t(4,r)}function S($){ie[$?"unshift":"push"](()=>{f=$,t(5,f)})}const T=$=>{var E,M;m((M=(E=$.target)==null?void 0:E.files)==null?void 0:M[0])};return n.$$.update=()=>{n.$$.dirty&3&&t(6,i=a||u)},[a,u,s,o,r,f,i,c,m,g,_,y,S,T]}class l3 extends ye{constructor(e){super(),be(this,e,i3,n3,_e,{})}}function kc(n){let e,t;return e=new ny({props:{$$slots:{default:[s3]},$$scope:{ctx:n}}}),{c(){H(e.$$.fragment)},m(i,l){F(e,i,l),t=!0},p(i,l){const s={};l&9&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(O(e.$$.fragment,i),t=!0)},o(i){D(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function s3(n){let e,t;return e=new l3({}),e.$on("submit",n[1]),{c(){H(e.$$.fragment)},m(i,l){F(e,i,l),t=!0},p:te,i(i){t||(O(e.$$.fragment,i),t=!0)},o(i){D(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function o3(n){let e,t,i=n[0]&&kc(n);return{c(){i&&i.c(),e=ge()},m(l,s){i&&i.m(l,s),v(l,e,s),t=!0},p(l,[s]){l[0]?i?(i.p(l,s),s&1&&O(i,1)):(i=kc(l),i.c(),O(i,1),i.m(e.parentNode,e)):i&&(re(),D(i,1,1,()=>{i=null}),ae())},i(l){t||(O(i),t=!0)},o(l){D(i),t=!1},d(l){l&&k(e),i&&i.d(l)}}}function r3(n,e,t){let i=!1;l();function l(){if(t(0,i=!1),new URLSearchParams(window.location.search).has("pbinstal")){me.logout(!1),t(0,i=!0);return}me.authStore.isValid?Il("/collections"):me.logout()}return[i,async()=>{t(0,i=!1),await fn(),window.location.search=""}]}class a3 extends ye{constructor(e){super(),be(this,e,r3,o3,_e,{})}}function u3(n){let e,t,i,l;return{c(){e=b("input"),p(e,"type","text"),p(e,"id",n[8]),p(e,"placeholder",t=n[0]||n[1])},m(s,o){v(s,e,o),n[13](e),ce(e,n[7]),i||(l=B(e,"input",n[14]),i=!0)},p(s,o){o&3&&t!==(t=s[0]||s[1])&&p(e,"placeholder",t),o&128&&e.value!==s[7]&&ce(e,s[7])},i:te,o:te,d(s){s&&k(e),n[13](null),i=!1,l()}}}function f3(n){let e,t,i,l;function s(a){n[12](a)}var o=n[4];function r(a,u){let f={id:a[8],singleLine:!0,disableRequestKeys:!0,disableCollectionJoinKeys:!0,extraAutocompleteKeys:a[3],baseCollection:a[2],placeholder:a[0]||a[1]};return a[7]!==void 0&&(f.value=a[7]),{props:f}}return o&&(e=jt(o,r(n)),ie.push(()=>ve(e,"value",s)),e.$on("submit",n[10])),{c(){e&&H(e.$$.fragment),i=ge()},m(a,u){e&&F(e,a,u),v(a,i,u),l=!0},p(a,u){if(u&16&&o!==(o=a[4])){if(e){re();const f=e;D(f.$$.fragment,1,0,()=>{q(f,1)}),ae()}o?(e=jt(o,r(a)),ie.push(()=>ve(e,"value",s)),e.$on("submit",a[10]),H(e.$$.fragment),O(e.$$.fragment,1),F(e,i.parentNode,i)):e=null}else if(o){const f={};u&8&&(f.extraAutocompleteKeys=a[3]),u&4&&(f.baseCollection=a[2]),u&3&&(f.placeholder=a[0]||a[1]),!t&&u&128&&(t=!0,f.value=a[7],$e(()=>t=!1)),e.$set(f)}},i(a){l||(e&&O(e.$$.fragment,a),l=!0)},o(a){e&&D(e.$$.fragment,a),l=!1},d(a){a&&k(i),e&&q(e,a)}}}function vc(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='<span class="txt">Search</span>',p(e,"type","submit"),p(e,"class","btn btn-expanded-sm btn-sm btn-warning")},m(l,s){v(l,e,s),i=!0},i(l){i||(l&&nt(()=>{i&&(t||(t=ze(e,Fn,{duration:150,x:5},!0)),t.run(1))}),i=!0)},o(l){l&&(t||(t=ze(e,Fn,{duration:150,x:5},!1)),t.run(0)),i=!1},d(l){l&&k(e),l&&t&&t.end()}}}function wc(n){let e,t,i,l,s;return{c(){e=b("button"),e.innerHTML='<span class="txt">Clear</span>',p(e,"type","button"),p(e,"class","btn btn-transparent btn-sm btn-hint p-l-xs p-r-xs m-l-10")},m(o,r){v(o,e,r),i=!0,l||(s=B(e,"click",n[15]),l=!0)},p:te,i(o){i||(o&&nt(()=>{i&&(t||(t=ze(e,Fn,{duration:150,x:5},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=ze(e,Fn,{duration:150,x:5},!1)),t.run(0)),i=!1},d(o){o&&k(e),o&&t&&t.end(),l=!1,s()}}}function c3(n){let e,t,i,l,s,o,r,a,u,f,c;const d=[f3,u3],m=[];function h(y,S){return y[4]&&!y[5]?0:1}s=h(n),o=m[s]=d[s](n);let g=(n[0].length||n[7].length)&&n[7]!=n[0]&&vc(),_=(n[0].length||n[7].length)&&wc(n);return{c(){e=b("form"),t=b("label"),i=b("i"),l=C
2024-09-30 00:23:19 +08:00
* @kurkle/color v0.3.2
* https://github.com/kurkle/color#readme
* (c) 2023 Jukka Kurkela
* Released under the MIT License
*/function co(n){return n+.5|0}const Zi=(n,e,t)=>Math.max(Math.min(n,t),e);function Cs(n){return Zi(co(n*2.55),0,255)}function el(n){return Zi(co(n*255),0,255)}function Pi(n){return Zi(co(n/2.55)/100,0,1)}function Nc(n){return Zi(co(n*100),0,100)}const Yn={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Ya=[..."0123456789ABCDEF"],H3=n=>Ya[n&15],j3=n=>Ya[(n&240)>>4]+Ya[n&15],Io=n=>(n&240)>>4===(n&15),z3=n=>Io(n.r)&&Io(n.g)&&Io(n.b)&&Io(n.a);function U3(n){var e=n.length,t;return n[0]==="#"&&(e===4||e===5?t={r:255&Yn[n[1]]*17,g:255&Yn[n[2]]*17,b:255&Yn[n[3]]*17,a:e===5?Yn[n[4]]*17:255}:(e===7||e===9)&&(t={r:Yn[n[1]]<<4|Yn[n[2]],g:Yn[n[3]]<<4|Yn[n[4]],b:Yn[n[5]]<<4|Yn[n[6]],a:e===9?Yn[n[7]]<<4|Yn[n[8]]:255})),t}const V3=(n,e)=>n<255?e(n):"";function B3(n){var e=z3(n)?H3:j3;return n?"#"+e(n.r)+e(n.g)+e(n.b)+V3(n.a,e):void 0}const W3=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function sy(n,e,t){const i=e*Math.min(t,1-t),l=(s,o=(s+n/30)%12)=>t-i*Math.max(Math.min(o-3,9-o,1),-1);return[l(0),l(8),l(4)]}function Y3(n,e,t){const i=(l,s=(l+n/60)%6)=>t-t*e*Math.max(Math.min(s,4-s,1),0);return[i(5),i(3),i(1)]}function K3(n,e,t){const i=sy(n,1,.5);let l;for(e+t>1&&(l=1/(e+t),e*=l,t*=l),l=0;l<3;l++)i[l]*=1-e-t,i[l]+=e;return i}function J3(n,e,t,i,l){return n===l?(e-t)/i+(e<t?6:0):e===l?(t-n)/i+2:(n-e)/i+4}function Nu(n){const t=n.r/255,i=n.g/255,l=n.b/255,s=Math.max(t,i,l),o=Math.min(t,i,l),r=(s+o)/2;let a,u,f;return s!==o&&(f=s-o,u=r>.5?f/(2-s-o):f/(s+o),a=J3(t,i,l,f,s),a=a*60+.5),[a|0,u||0,r]}function Ru(n,e,t,i){return(Array.isArray(e)?n(e[0],e[1],e[2]):n(e,t,i)).map(el)}function Fu(n,e,t){return Ru(sy,n,e,t)}function Z3(n,e,t){return Ru(K3,n,e,t)}function G3(n,e,t){return Ru(Y3,n,e,t)}function oy(n){return(n%360+360)%360}function X3(n){const e=W3.exec(n);let t=255,i;if(!e)return;e[5]!==i&&(t=e[6]?Cs(+e[5]):el(+e[5]));const l=oy(+e[2]),s=+e[3]/100,o=+e[4]/100;return e[1]==="hwb"?i=Z3(l,s,o):e[1]==="hsv"?i=G3(l,s,o):i=Fu(l,s,o),{r:i[0],g:i[1],b:i[2],a:t}}function Q3(n,e){var t=Nu(n);t[0]=oy(t[0]+e),t=Fu(t),n.r=t[0],n.g=t[1],n.b=t[2]}function x3(n){if(!n)return;const e=Nu(n),t=e[0],i=Nc(e[1]),l=Nc(e[2]);return n.a<255?`hsla(${t}, ${i}%, ${l}%, ${Pi(n.a)})`:`hsl(${t}, ${i}%, ${l}%)`}const Rc={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Fc={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"
2024-09-30 00:23:19 +08:00
* Chart.js v4.4.4
* https://www.chartjs.org
* (c) 2024 Chart.js Contributors
* Released under the MIT License
*/function Ii(){}const rS=(()=>{let n=0;return()=>n++})();function Kt(n){return n===null||typeof n>"u"}function un(n){if(Array.isArray&&Array.isArray(n))return!0;const e=Object.prototype.toString.call(n);return e.slice(0,7)==="[object"&&e.slice(-6)==="Array]"}function yt(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}function wn(n){return(typeof n=="number"||n instanceof Number)&&isFinite(+n)}function _i(n,e){return wn(n)?n:e}function Ct(n,e){return typeof n>"u"?e:n}const aS=(n,e)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*e:+n;function dt(n,e,t){if(n&&typeof n.call=="function")return n.apply(t,e)}function ht(n,e,t,i){let l,s,o;if(un(n))for(s=n.length,l=0;l<s;l++)e.call(t,n[l],l);else if(yt(n))for(o=Object.keys(n),s=o.length,l=0;l<s;l++)e.call(t,n[o[l]],o[l])}function yr(n,e){let t,i,l,s;if(!n||!e||n.length!==e.length)return!1;for(t=0,i=n.length;t<i;++t)if(l=n[t],s=e[t],l.datasetIndex!==s.datasetIndex||l.index!==s.index)return!1;return!0}function kr(n){if(un(n))return n.map(kr);if(yt(n)){const e=Object.create(null),t=Object.keys(n),i=t.length;let l=0;for(;l<i;++l)e[t[l]]=kr(n[t[l]]);return e}return n}function ay(n){return["__proto__","prototype","constructor"].indexOf(n)===-1}function uS(n,e,t,i){if(!ay(n))return;const l=e[n],s=t[n];yt(l)&&yt(s)?Js(l,s,i):e[n]=kr(s)}function Js(n,e,t){const i=un(e)?e:[e],l=i.length;if(!yt(n))return n;t=t||{};const s=t.merger||uS;let o;for(let r=0;r<l;++r){if(o=i[r],!yt(o))continue;const a=Object.keys(o);for(let u=0,f=a.length;u<f;++u)s(a[u],n,o,t)}return n}function Ls(n,e){return Js(n,e,{merger:fS})}function fS(n,e,t){if(!ay(n))return;const i=e[n],l=t[n];yt(i)&&yt(l)?Ls(i,l):Object.prototype.hasOwnProperty.call(e,n)||(e[n]=kr(l))}const Hc={"":n=>n,x:n=>n.x,y:n=>n.y};function cS(n){const e=n.split("."),t=[];let i="";for(const l of e)i+=l,i.endsWith("\\")?i=i.slice(0,-1)+".":(t.push(i),i="");return t}function dS(n){const e=cS(n);return t=>{for(const i of e){if(i==="")break;t=t&&t[i]}return t}}function vr(n,e){return(Hc[e]||(Hc[e]=dS(e)))(n)}function qu(n){return n.charAt(0).toUpperCase()+n.slice(1)}const wr=n=>typeof n<"u",nl=n=>typeof n=="function",jc=(n,e)=>{if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1;return!0};function pS(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}const kn=Math.PI,Ti=2*kn,mS=Ti+kn,Sr=Number.POSITIVE_INFINITY,hS=kn/180,oi=kn/2,yl=kn/4,zc=kn*2/3,Ka=Math.log10,il=Math.sign;function As(n,e,t){return Math.abs(n-e)<t}function Uc(n){const e=Math.round(n);n=As(n,e,n/1e3)?e:n;const t=Math.pow(10,Math.floor(Ka(n))),i=n/t;return(i<=1?1:i<=2?2:i<=5?5:10)*t}function _S(n){const e=[],t=Math.sqrt(n);let i;for(i=1;i<t;i++)n%i===0&&(e.push(i),e.push(n/i));return t===(t|0)&&e.push(t),e.sort((l,s)=>l-s).pop(),e}function Zs(n){return!isNaN(parseFloat(n))&&isFinite(n)}function gS(n,e){const t=Math.round(n);return t-e<=n&&t+e>=n}function bS(n,e,t){let i,l,s;for(i=0,l=n.length;i<l;i++)s=n[i][t],isNaN(s)||(e.min=Math.min(e.min,s),e.max=Math.max(e.max,s))}function $l(n){return n*(kn/180)}function yS(n){return n*(180/kn)}function Vc(n){if(!wn(n))return;let e=1,t=0;for(;Math.round(n*e)/e!==n;)e*=10,t++;return t}function kS(n,e){const t=e.x-n.x,i=e.y-n.y,l=Math.sqrt(t*t+i*i);let s=Math.atan2(i,t);return s<-.5*kn&&(s+=Ti),{angle:s,distance:l}}function Ja(n,e){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))}function vS(n,e){return(n-e+mS)%Ti-kn}function yi(n){return(n%Ti+Ti)%Ti}function uy(n,e,t,i){const l=yi(n),s=yi(e),o=yi(t),r=yi(s-l),a=yi(o-l),u=yi(l-s),f=yi(l-o);return l===s||l===o||i&&s===o||r>a&&u<f}function ri(n,e,t){return Math.max(e,Math.min(t,n))}function wS(n){return ri(n,-32768,32767)}function fy(n,e,t,i=1e-6){return n>=Math.min(e,t)-i&&n<=Math.max(e,t)+i}function Hu(n,e,t){t=t||(o=>n[o]<e);let i=n.length-1,l=0,s;for(;i-l>1;)s=l+i>>1,t(s)?l=s:i=s;return{lo:l,hi:i}}const Cl=(n,e,t,i)=>Hu(n,t,i?l=>{const s=n[l][e];return s<t||s===t&&n[l+1][e]===t}:l=>n[l][e]<t),SS=(n,e,t)=>Hu(n,t,i=>n[i][e]>=t);function TS(n,e,t){let i=0,l=n.length;for(;i<l&&n[i]<e;)i++;for(;l>i&&n[l-1]>t;)l--;return i>0|
2024-09-30 00:23:19 +08:00
* Chart.js v4.4.4
* https://www.chartjs.org
* (c) 2024 Chart.js Contributors
* Released under the MIT License
*/class A4{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,t,i,l){const s=t.listeners[l],o=t.duration;s.forEach(r=>r({chart:e,initial:t.initial,numSteps:o,currentStep:Math.min(i-t.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=dy.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let t=0;this._charts.forEach((i,l)=>{if(!i.running||!i.items.length)return;const s=i.items;let o=s.length-1,r=!1,a;for(;o>=0;--o)a=s[o],a._active?(a._total>i.duration&&(i.duration=a._total),a.tick(e),r=!0):(s[o]=s[s.length-1],s.pop());r&&(l.draw(),this._notify(l,i,e,"progress")),s.length||(i.running=!1,this._notify(l,i,e,"complete"),i.initial=!1),t+=s.length}),this._lastDate=e,t===0&&(this._running=!1)}_getAnims(e){const t=this._charts;let i=t.get(e);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(e,i)),i}listen(e,t,i){this._getAnims(e).listeners[t].push(i)}add(e,t){!t||!t.length||this._getAnims(e).items.push(...t)}has(e){return this._getAnims(e).items.length>0}start(e){const t=this._charts.get(e);t&&(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce((i,l)=>Math.max(i,l._duration),0),this._refresh())}running(e){if(!this._running)return!1;const t=this._charts.get(e);return!(!t||!t.running||!t.items.length)}stop(e){const t=this._charts.get(e);if(!t||!t.items.length)return;const i=t.items;let l=i.length-1;for(;l>=0;--l)i[l].cancel();t.items=[],this._notify(e,t,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var Li=new A4;const rd="transparent",P4={boolean(n,e,t){return t>.5?e:n},color(n,e,t){const i=Jc(n||rd),l=i.valid&&Jc(e||rd);return l&&l.valid?l.mix(i,t).hexString():e},number(n,e,t){return n+(e-n)*t}};class N4{constructor(e,t,i,l){const s=t[i];l=No([e.to,l,s,e.from]);const o=No([e.from,s,l]);this._active=!0,this._fn=e.fn||P4[e.type||typeof o],this._easing=Ps[e.easing]||Ps.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=t,this._prop=i,this._from=o,this._to=l,this._promises=void 0}active(){return this._active}update(e,t,i){if(this._active){this._notify(!1);const l=this._target[this._prop],s=i-this._start,o=this._duration-s;this._start=i,this._duration=Math.floor(Math.max(o,e.duration)),this._total+=s,this._loop=!!e.loop,this._to=No([e.to,t,l,e.from]),this._from=No([e.from,l,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const t=e-this._start,i=this._duration,l=this._prop,s=this._from,o=this._loop,r=this._to;let a;if(this._active=s!==r&&(o||t<i),!this._active){this._target[l]=r,this._notify(!0);return}if(t<0){this._target[l]=s;return}a=t/i%2,a=o&&a>1?2-a:a,a=this._easing(Math.min(1,Math.max(0,a))),this._target[l]=this._fn(s,r,a)}wait(){const e=this._promises||(this._promises=[]);return new Promise((t,i)=>{e.push({res:t,rej:i})})}_notify(e){const t=e?"res":"rej",i=this._promises||[];for(let l=0;l<i.length;l++)i[l][t]()}}class Cy{constructor(e,t){this._chart=e,this._properties=new Map,this.configure(t)}configure(e){if(!yt(e))return;const t=Object.keys(nn.animation),i=this._properties;Object.getOwnPropertyNames(e).forEach(l=>{const s=e[l];if(!yt(s))return;const o={};for(const r of t)o[r]=s[r];(un(s.properties)&&s.properties||[l]).forEach(r=>{(r===l||!i.has(r))&&i.set(r,o)})})}_animateOptions(e,t){const i=t.options,l=F4(e,i);if(!l)return[];const s=this._createAnimations(l,i);return i.$shared&&R4(e.options.$animations,i).then(()=>{e.options=i},()=>{}),s}_createAnimations(e,t){const i=this._properties,l=[],s=e.$animations||(e.$animations={}),o=Object.keys(t),r=Date.now();let a;for(a=o.length-1;a>=0;--a){const u=o[a];if(u.charAt(0)==="$")continue;if(u==="options"){l.push(...this._animateOptions(e,t));continue}const f=t[u];let c=s[u];const d=i.get(u);if(c)if(d&&c.active()){c.update(d,f,r);continue}else c.cancel();if(!d||!d.duration){e[u]=f;continue}s[u]=c=new N4(d,e,u,f),l.push(c)}return l}update(e,t){if(this._properties.size
2024-09-30 00:23:19 +08:00
`)>-1?n.split(`
`):n}function I$(n,e){const{element:t,datasetIndex:i,index:l}=e,s=n.getDatasetMeta(i).controller,{label:o,value:r}=s.getLabelAndValue(l);return{chart:n,label:o,parsed:s.getParsed(l),raw:n.data.datasets[i].data[l],formattedValue:r,dataset:s.getDataset(),dataIndex:l,datasetIndex:i,element:t}}function Hd(n,e){const t=n.chart.ctx,{body:i,footer:l,title:s}=n,{boxWidth:o,boxHeight:r}=e,a=Si(e.bodyFont),u=Si(e.titleFont),f=Si(e.footerFont),c=s.length,d=l.length,m=i.length,h=ll(e.padding);let g=h.height,_=0,y=i.reduce(($,E)=>$+E.before.length+E.lines.length+E.after.length,0);if(y+=n.beforeBody.length+n.afterBody.length,c&&(g+=c*u.lineHeight+(c-1)*e.titleSpacing+e.titleMarginBottom),y){const $=e.displayColors?Math.max(r,a.lineHeight):a.lineHeight;g+=m*$+(y-m)*a.lineHeight+(y-1)*e.bodySpacing}d&&(g+=e.footerMarginTop+d*f.lineHeight+(d-1)*e.footerSpacing);let S=0;const T=function($){_=Math.max(_,t.measureText($).width+S)};return t.save(),t.font=u.string,ht(n.title,T),t.font=a.string,ht(n.beforeBody.concat(n.afterBody),T),S=e.displayColors?o+2+e.boxPadding:0,ht(i,$=>{ht($.before,T),ht($.lines,T),ht($.after,T)}),S=0,t.font=f.string,ht(n.footer,T),t.restore(),_+=h.width,{width:_,height:g}}function L$(n,e){const{y:t,height:i}=e;return t<i/2?"top":t>n.height-i/2?"bottom":"center"}function A$(n,e,t,i){const{x:l,width:s}=i,o=t.caretSize+t.caretPadding;if(n==="left"&&l+s+o>e.width||n==="right"&&l-s-o<0)return!0}function P$(n,e,t,i){const{x:l,width:s}=t,{width:o,chartArea:{left:r,right:a}}=n;let u="center";return i==="center"?u=l<=(r+a)/2?"left":"right":l<=s/2?u="left":l>=o-s/2&&(u="right"),A$(u,n,e,t)&&(u="center"),u}function jd(n,e,t){const i=t.yAlign||e.yAlign||L$(n,t);return{xAlign:t.xAlign||e.xAlign||P$(n,e,t,i),yAlign:i}}function N$(n,e){let{x:t,width:i}=n;return e==="right"?t-=i:e==="center"&&(t-=i/2),t}function R$(n,e,t){let{y:i,height:l}=n;return e==="top"?i+=t:e==="bottom"?i-=l+t:i-=l/2,i}function zd(n,e,t,i){const{caretSize:l,caretPadding:s,cornerRadius:o}=n,{xAlign:r,yAlign:a}=t,u=l+s,{topLeft:f,topRight:c,bottomLeft:d,bottomRight:m}=lr(o);let h=N$(e,r);const g=R$(e,a,u);return a==="center"?r==="left"?h+=u:r==="right"&&(h-=u):r==="left"?h-=Math.max(f,d)+l:r==="right"&&(h+=Math.max(c,m)+l),{x:ri(h,0,i.width-e.width),y:ri(g,0,i.height-e.height)}}function Bo(n,e,t){const i=ll(t.padding);return e==="center"?n.x+n.width/2:e==="right"?n.x+n.width-i.right:n.x+i.left}function Ud(n){return gi([],Ai(n))}function F$(n,e,t){return Nl(n,{tooltip:e,tooltipItems:t,type:"tooltip"})}function Vd(n,e){const t=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return t?n.override(t):n}const Uy={beforeTitle:Ii,title(n){if(n.length>0){const e=n[0],t=e.chart.data.labels,i=t?t.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(i>0&&e.dataIndex<i)return t[e.dataIndex]}return""},afterTitle:Ii,beforeBody:Ii,beforeLabel:Ii,label(n){if(this&&this.options&&this.options.mode==="dataset")return n.label+": "+n.formattedValue||n.formattedValue;let e=n.dataset.label||"";e&&(e+=": ");const t=n.formattedValue;return Kt(t)||(e+=t),e},labelColor(n){const t=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{borderColor:t.borderColor,backgroundColor:t.backgroundColor,borderWidth:t.borderWidth,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(n){const t=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{pointStyle:t.pointStyle,rotation:t.rotation}},afterLabel:Ii,afterBody:Ii,beforeFooter:Ii,footer:Ii,afterFooter:Ii};function Dn(n,e,t,i){const l=n[e].call(t,i);return typeof l>"u"?Uy[e].call(t,i):l}class tu extends Al{constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void
2024-09-30 00:23:19 +08:00
* chartjs-adapter-luxon v1.3.1
* https://www.chartjs.org
* (c) 2023 chartjs-adapter-luxon Contributors
* Released under the MIT license
*/const B$={datetime:Xe.DATETIME_MED_WITH_SECONDS,millisecond:"h:mm:ss.SSS a",second:Xe.TIME_WITH_SECONDS,minute:Xe.TIME_SIMPLE,hour:{hour:"numeric"},day:{day:"numeric",month:"short"},week:"DD",month:{month:"short",year:"numeric"},quarter:"'Q'q - yyyy",year:{year:"numeric"}};Ey._date.override({_id:"luxon",_create:function(n){return Xe.fromMillis(n,this.options)},init(n){this.options.locale||(this.options.locale=n.locale)},formats:function(){return B$},parse:function(n,e){const t=this.options,i=typeof n;return n===null||i==="undefined"?null:(i==="number"?n=this._create(n):i==="string"?typeof e=="string"?n=Xe.fromFormat(n,e,t):n=Xe.fromISO(n,t):n instanceof Date?n=Xe.fromJSDate(n,t):i==="object"&&!(n instanceof Xe)&&(n=Xe.fromObject(n,t)),n.isValid?n.valueOf():null)},format:function(n,e){const t=this._create(n);return typeof e=="string"?t.toFormat(e):t.toLocaleString(e)},add:function(n,e,t){const i={};return i[t]=e,this._create(n).plus(i).valueOf()},diff:function(n,e,t){return this._create(n).diff(this._create(e)).as(t).valueOf()},startOf:function(n,e,t){if(e==="isoWeek"){t=Math.trunc(Math.min(Math.max(0,t),6));const i=this._create(n);return i.minus({days:(i.weekday-t+7)%7}).startOf("day").valueOf()}return e?this._create(n).startOf(e).valueOf():n},endOf:function(n,e){return this._create(n).endOf(e).valueOf()}});function W$(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Vy={exports:{}};/*! Hammer.JS - v2.0.7 - 2016-04-22
2024-09-30 00:23:19 +08:00
* http://hammerjs.github.io/
*
* Copyright (c) 2016 Jorik Tangelder;
* Licensed under the MIT license */(function(n){(function(e,t,i,l){var s=["","webkit","Moz","MS","ms","o"],o=t.createElement("div"),r="function",a=Math.round,u=Math.abs,f=Date.now;function c(W,G,ne){return setTimeout(T(W,ne),G)}function d(W,G,ne){return Array.isArray(W)?(m(W,ne[G],ne),!0):!1}function m(W,G,ne){var de;if(W)if(W.forEach)W.forEach(G,ne);else if(W.length!==l)for(de=0;de<W.length;)G.call(ne,W[de],de,W),de++;else for(de in W)W.hasOwnProperty(de)&&G.call(ne,W[de],de,W)}function h(W,G,ne){var de="DEPRECATED METHOD: "+G+`
`+ne+` AT
`;return function(){var Ie=new Error("get-stack-trace"),Ye=Ie&&Ie.stack?Ie.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",mt=e.console&&(e.console.warn||e.console.log);return mt&&mt.call(e.console,de,Ye),W.apply(this,arguments)}}var g;typeof Object.assign!="function"?g=function(G){if(G===l||G===null)throw new TypeError("Cannot convert undefined or null to object");for(var ne=Object(G),de=1;de<arguments.length;de++){var Ie=arguments[de];if(Ie!==l&&Ie!==null)for(var Ye in Ie)Ie.hasOwnProperty(Ye)&&(ne[Ye]=Ie[Ye])}return ne}:g=Object.assign;var _=h(function(G,ne,de){for(var Ie=Object.keys(ne),Ye=0;Ye<Ie.length;)(!de||de&&G[Ie[Ye]]===l)&&(G[Ie[Ye]]=ne[Ie[Ye]]),Ye++;return G},"extend","Use `assign`."),y=h(function(G,ne){return _(G,ne,!0)},"merge","Use `assign`.");function S(W,G,ne){var de=G.prototype,Ie;Ie=W.prototype=Object.create(de),Ie.constructor=W,Ie._super=de,ne&&g(Ie,ne)}function T(W,G){return function(){return W.apply(G,arguments)}}function $(W,G){return typeof W==r?W.apply(G&&G[0]||l,G):W}function E(W,G){return W===l?G:W}function M(W,G,ne){m(P(G),function(de){W.addEventListener(de,ne,!1)})}function L(W,G,ne){m(P(G),function(de){W.removeEventListener(de,ne,!1)})}function I(W,G){for(;W;){if(W==G)return!0;W=W.parentNode}return!1}function A(W,G){return W.indexOf(G)>-1}function P(W){return W.trim().split(/\s+/g)}function R(W,G,ne){if(W.indexOf&&!ne)return W.indexOf(G);for(var de=0;de<W.length;){if(ne&&W[de][ne]==G||!ne&&W[de]===G)return de;de++}return-1}function N(W){return Array.prototype.slice.call(W,0)}function U(W,G,ne){for(var de=[],Ie=[],Ye=0;Ye<W.length;){var mt=W[Ye][G];R(Ie,mt)<0&&de.push(W[Ye]),Ie[Ye]=mt,Ye++}return de=de.sort(function(dn,Tn){return dn[G]>Tn[G]}),de}function j(W,G){for(var ne,de,Ie=G[0].toUpperCase()+G.slice(1),Ye=0;Ye<s.length;){if(ne=s[Ye],de=ne?ne+Ie:G,de in W)return de;Ye++}return l}var V=1;function K(){return V++}function J(W){var G=W.ownerDocument||W;return G.defaultView||G.parentWindow||e}var ee=/mobile|tablet|ip(ad|hone|od)|android/i,X="ontouchstart"in e,oe=j(e,"PointerEvent")!==l,Se=X&&ee.test(navigator.userAgent),ke="touch",Ce="pen",We="mouse",st="kinect",et=25,Be=1,rt=2,Je=4,at=8,Ht=1,Te=2,Ze=4,ot=8,Le=16,Ve=Te|Ze,we=ot|Le,Oe=Ve|we,ut=["x","y"],Ne=["clientX","clientY"];function xe(W,G){var ne=this;this.manager=W,this.callback=G,this.element=W.element,this.target=W.options.inputTarget,this.domHandler=function(de){$(W.options.enable,[W])&&ne.handler(de)},this.init()}xe.prototype={handler:function(){},init:function(){this.evEl&&M(this.element,this.evEl,this.domHandler),this.evTarget&&M(this.target,this.evTarget,this.domHandler),this.evWin&&M(J(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&L(this.element,this.evEl,this.domHandler),this.evTarget&&L(this.target,this.evTarget,this.domHandler),this.evWin&&L(J(this.element),this.evWin,this.domHandler)}};function qt(W){var G,ne=W.options.inputClass;return ne?G=ne:oe?G=cl:Se?G=Re:X?G=ft:G=Hi,new G(W,Zt)}function Zt(W,G,ne){var de=ne.pointers.length,Ie=ne.changedPointers.length,Ye=G&Be&&de-Ie===0,mt=G&(Je|at)&&de-Ie===0;ne.isFirst=!!Ye,ne.isFinal=!!mt,Ye&&(W.session={}),ne.eventType=G,Fe(W,ne),W.emit("hammer.input",ne),W.recognize(ne),W.session.prevInput=ne}function Fe(W,G){var ne=W.session,de=G.pointers,Ie=de.length;ne.firstInput||(ne.firstInput=mn(G)),Ie>1&&!ne.firstMultiple?ne.firstMultiple=mn(G):Ie===1&&(ne.firstMultiple=!1);var Ye=ne.firstInput,mt=ne.firstMultiple,an=mt?mt.center:Ye.center,dn=G.center=hn(de);G.timeStamp=f(),G.deltaTime=G.timeStamp-Ye.timeStamp,G.angle=rn(an,dn),G.distance=bt(an,dn),Dt(ne,G),G.offsetDirection=Ci(G.deltaX,G.deltaY);var Tn=pi(G.deltaTime,G.deltaX,G.deltaY);G.overallVelocityX=Tn.x,G.overallVelocityY=Tn.y,G.overallVelocity=u(Tn.x)>u(Tn.y)?Tn.x:Tn.y,G.scale=mt?rl(mt.pointers,de):1,G.rotation=mt?sn(mt.pointers,de):0,G.maxPointers=ne.prevInput?G.pointers.length>ne.prevInput.maxPointers?G.pointers.length:ne.prevInput.maxPointers:G.pointers.length,Gt(ne,G);var hi=W.element;I(G.srcEvent.target,hi)&&(h
2024-09-30 00:23:19 +08:00
* chartjs-plugin-zoom v2.0.1
* undefined
* (c) 2016-2023 chartjs-plugin-zoom Contributors
* Released under the MIT License
*/const xs=n=>n&&n.enabled&&n.modifierKey,By=(n,e)=>n&&e[n+"Key"],Gu=(n,e)=>n&&!e[n+"Key"];function sl(n,e,t){return n===void 0?!0:typeof n=="string"?n.indexOf(e)!==-1:typeof n=="function"?n({chart:t}).indexOf(e)!==-1:!1}function ya(n,e){return typeof n=="function"&&(n=n({chart:e})),typeof n=="string"?{x:n.indexOf("x")!==-1,y:n.indexOf("y")!==-1}:{x:!1,y:!1}}function K$(n,e){let t;return function(){return clearTimeout(t),t=setTimeout(n,e),e}}function J$({x:n,y:e},t){const i=t.scales,l=Object.keys(i);for(let s=0;s<l.length;s++){const o=i[l[s]];if(e>=o.top&&e<=o.bottom&&n>=o.left&&n<=o.right)return o}return null}function Wy(n,e,t){const{mode:i="xy",scaleMode:l,overScaleMode:s}=n||{},o=J$(e,t),r=ya(i,t),a=ya(l,t);if(s){const f=ya(s,t);for(const c of["x","y"])f[c]&&(a[c]=r[c],r[c]=!1)}if(o&&a[o.axis])return[o];const u=[];return ht(t.scales,function(f){r[f.axis]&&u.push(f)}),u}const iu=new WeakMap;function Jt(n){let e=iu.get(n);return e||(e={originalScaleLimits:{},updatedScaleLimits:{},handlers:{},panDelta:{}},iu.set(n,e)),e}function Z$(n){iu.delete(n)}function Yy(n,e,t){const i=n.max-n.min,l=i*(e-1),s=n.isHorizontal()?t.x:t.y,o=Math.max(0,Math.min(1,(n.getValueForPixel(s)-n.min)/i||0)),r=1-o;return{min:l*o,max:l*r}}function Xd(n,e,t,i,l){let s=t[i];if(s==="original"){const o=n.originalScaleLimits[e.id][i];s=Ct(o.options,o.scale)}return Ct(s,l)}function G$(n,e,t){const i=n.getValueForPixel(e),l=n.getValueForPixel(t);return{min:Math.min(i,l),max:Math.max(i,l)}}function fs(n,{min:e,max:t},i,l=!1){const s=Jt(n.chart),{id:o,axis:r,options:a}=n,u=i&&(i[o]||i[r])||{},{minRange:f=0}=u,c=Xd(s,n,u,"min",-1/0),d=Xd(s,n,u,"max",1/0),m=l?Math.max(t-e,f):n.max-n.min,h=(m-t+e)/2;return e-=h,t+=h,e<c?(e=c,t=Math.min(c+m,d)):t>d&&(t=d,e=Math.max(d-m,c)),a.min=e,a.max=t,s.updatedScaleLimits[n.id]={min:e,max:t},n.parse(e)!==n.min||n.parse(t)!==n.max}function X$(n,e,t,i){const l=Yy(n,e,t),s={min:n.min+l.min,max:n.max-l.max};return fs(n,s,i,!0)}function Q$(n,e,t,i){fs(n,G$(n,e,t),i,!0)}const Qd=n=>n===0||isNaN(n)?0:n<0?Math.min(Math.round(n),-1):Math.max(Math.round(n),1);function x$(n){const t=n.getLabels().length-1;n.min>0&&(n.min-=1),n.max<t&&(n.max+=1)}function eC(n,e,t,i){const l=Yy(n,e,t);n.min===n.max&&e<1&&x$(n);const s={min:n.min+Qd(l.min),max:n.max-Qd(l.max)};return fs(n,s,i,!0)}function tC(n){return n.isHorizontal()?n.width:n.height}function nC(n,e,t){const l=n.getLabels().length-1;let{min:s,max:o}=n;const r=Math.max(o-s,1),a=Math.round(tC(n)/Math.max(r,10)),u=Math.round(Math.abs(e/a));let f;return e<-a?(o=Math.min(o+u,l),s=r===1?o:o-r,f=o===l):e>a&&(s=Math.max(0,s-u),o=r===1?s:s+r,f=s===0),fs(n,{min:s,max:o},t)||f}const iC={second:500,minute:30*1e3,hour:30*60*1e3,day:12*60*60*1e3,week:3.5*24*60*60*1e3,month:15*24*60*60*1e3,quarter:60*24*60*60*1e3,year:182*24*60*60*1e3};function Ky(n,e,t,i=!1){const{min:l,max:s,options:o}=n,r=o.time&&o.time.round,a=iC[r]||0,u=n.getValueForPixel(n.getPixelForValue(l+a)-e),f=n.getValueForPixel(n.getPixelForValue(s+a)-e),{min:c=-1/0,max:d=1/0}=i&&t&&t[n.axis]||{};return isNaN(u)||isNaN(f)||u<c||f>d?!0:fs(n,{min:u,max:f},t,i)}function xd(n,e,t){return Ky(n,e,t,!0)}const lu={category:eC,default:X$},su={default:Q$},ou={category:nC,default:Ky,logarithmic:xd,timeseries:xd};function lC(n,e,t){const{id:i,options:{min:l,max:s}}=n;if(!e[i]||!t[i])return!0;const o=t[i];return o.min!==l||o.max!==s}function ep(n,e){ht(n,(t,i)=>{e[i]||delete n[i]})}function cs(n,e){const{scales:t}=n,{originalScaleLimits:i,updatedScaleLimits:l}=e;return ht(t,function(s){lC(s,i,l)&&(i[s.id]={min:{scale:s.min,options:s.options.min},max:{scale:s.max,options:s.options.max}})}),ep(i,t),ep(l,t),i}function tp(n,e,t,i){const l=lu[n.type]||lu.default;dt(l,[n,e,t,i])}function np(n,e,t,i,l){const s=su[n.type]||su.default;dt(s,[n,e,t,i,l])}function sC(n){const e=n.chartArea;return{x:(e.left+e.right)/2,y:(e.top+e.bottom)/2}}function Xu(n,e,t="none"){const{x:i=1,y:l=1,focalPoint:s=sC(n)}=typeof e=="number"?{x:e,y:e}:e,o=Jt(n),{options:{limits:r,zoom:a}}=o;cs(n,o);const u=i!==1,f=l!==1,c=Wy(a,s,n);ht(c||n.scales,function(d){d.isHorizontal()&&u?tp(d
`),i=b("div");for(let o=0;o<s.length;o+=1)s[o].c();p(i,"class","inline-flex flex-gap-5"),p(e,"class",n[0])},m(o,r){v(o,e,r),w(e,t),w(e,i);for(let a=0;a<s.length;a+=1)s[a]&&s[a].m(i,null)},p(o,[r]){r&1&&p(e,"class",o[0])},i:te,o:te,d(o){o&&k(e),pt(s,o)}}}function t5(n,e,t){let{class:i=""}=e;return n.$$set=l=>{"class"in l&&t(0,i=l.class)},[i]}class tk extends ye{constructor(e){super(),be(this,e,t5,e5,_e,{class:0})}}function n5(n){let e,t,i,l,s,o,r,a,u,f,c;return t=new fe({props:{class:"form-field required",name:"logs.maxDays",$$slots:{default:[l5,({uniqueId:d})=>({23:d}),({uniqueId:d})=>d?8388608:0]},$$scope:{ctx:n}}}),l=new fe({props:{class:"form-field",name:"logs.minLevel",$$slots:{default:[s5,({uniqueId:d})=>({23:d}),({uniqueId:d})=>d?8388608:0]},$$scope:{ctx:n}}}),o=new fe({props:{class:"form-field form-field-toggle",name:"logs.logIP",$$slots:{default:[o5,({uniqueId:d})=>({23:d}),({uniqueId:d})=>d?8388608:0]},$$scope:{ctx:n}}}),a=new fe({props:{class:"form-field form-field-toggle",name:"logs.logAuthId",$$slots:{default:[r5,({uniqueId:d})=>({23:d}),({uniqueId:d})=>d?8388608:0]},$$scope:{ctx:n}}}),{c(){e=b("form"),H(t.$$.fragment),i=C(),H(l.$$.fragment),s=C(),H(o.$$.fragment),r=C(),H(a.$$.fragment),p(e,"id",n[6]),p(e,"class","grid"),p(e,"autocomplete","off")},m(d,m){v(d,e,m),F(t,e,null),w(e,i),F(l,e,null),w(e,s),F(o,e,null),w(e,r),F(a,e,null),u=!0,f||(c=B(e,"submit",tt(n[7])),f=!0)},p(d,m){const h={};m&25165826&&(h.$$scope={dirty:m,ctx:d}),t.$set(h);const g={};m&25165826&&(g.$$scope={dirty:m,ctx:d}),l.$set(g);const _={};m&25165826&&(_.$$scope={dirty:m,ctx:d}),o.$set(_);const y={};m&25165826&&(y.$$scope={dirty:m,ctx:d}),a.$set(y)},i(d){u||(O(t.$$.fragment,d),O(l.$$.fragment,d),O(o.$$.fragment,d),O(a.$$.fragment,d),u=!0)},o(d){D(t.$$.fragment,d),D(l.$$.fragment,d),D(o.$$.fragment,d),D(a.$$.fragment,d),u=!1},d(d){d&&k(e),q(t),q(l),q(o),q(a),f=!1,c()}}}function i5(n){let e;return{c(){e=b("div"),e.innerHTML='<div class="loader"></div>',p(e,"class","block txt-center")},m(t,i){v(t,e,i)},p:te,i:te,o:te,d(t){t&&k(e)}}}function l5(n){let e,t,i,l,s,o,r,a,u,f;return{c(){e=b("label"),t=Y("Max days retention"),l=C(),s=b("input"),r=C(),a=b("div"),a.innerHTML="Set to <code>0</code> to disable logs persistence.",p(e,"for",i=n[23]),p(s,"type","number"),p(s,"id",o=n[23]),s.required=!0,p(a,"class","help-block")},m(c,d){v(c,e,d),w(e,t),v(c,l,d),v(c,s,d),ce(s,n[1].logs.maxDays),v(c,r,d),v(c,a,d),u||(f=B(s,"input",n[11]),u=!0)},p(c,d){d&8388608&&i!==(i=c[23])&&p(e,"for",i),d&8388608&&o!==(o=c[23])&&p(s,"id",o),d&2&&_t(s.value)!==c[1].logs.maxDays&&ce(s,c[1].logs.maxDays)},d(c){c&&(k(e),k(l),k(s),k(r),k(a)),u=!1,f()}}}function s5(n){let e,t,i,l,s,o,r,a,u,f,c,d,m;return f=new tk({}),{c(){e=b("label"),t=Y("Min log level"),l=C(),s=b("input"),o=C(),r=b("div"),a=b("p"),a.textContent="Logs with level below the minimum will be ignored.",u=C(),H(f.$$.fragment),p(e,"for",i=n[23]),p(s,"type","number"),s.required=!0,p(s,"min","-100"),p(s,"max","100"),p(r,"class","help-block")},m(h,g){v(h,e,g),w(e,t),v(h,l,g),v(h,s,g),ce(s,n[1].logs.minLevel),v(h,o,g),v(h,r,g),w(r,a),w(r,u),F(f,r,null),c=!0,d||(m=B(s,"input",n[12]),d=!0)},p(h,g){(!c||g&8388608&&i!==(i=h[23]))&&p(e,"for",i),g&2&&_t(s.value)!==h[1].logs.minLevel&&ce(s,h[1].logs.minLevel)},i(h){c||(O(f.$$.fragment,h),c=!0)},o(h){D(f.$$.fragment,h),c=!1},d(h){h&&(k(e),k(l),k(s),k(o),k(r)),q(f),d=!1,m()}}}function o5(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=C(),l=b("label"),s=Y("Enable IP logging"),p(e,"type","checkbox"),p(e,"id",t=n[23]),p(l,"for",o=n[23])},m(u,f){v(u,e,f),e.checked=n[1].logs.logIP,v(u,i,f),v(u,l,f),w(l,s),r||(a=B(e,"change",n[13]),r=!0)},p(u,f){f&8388608&&t!==(t=u[23])&&p(e,"id",t),f&2&&(e.checked=u[1].logs.logIP),f&8388608&&o!==(o=u[23])&&p(l,"for",o)},d(u){u&&(k(e),k(i),k(l)),r=!1,a()}}}function r5(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=C(),l=b("label"),s=Y("Enable Auth Id logging"),p(e,"type","checkbox"),p(e,"id",t=n[23]),p(l,"for",o=n[23])},m(u,f){v(u,e,f),e.checked=n[1].logs.logAuthId,v(u,i,f),v(u,l,f),w(l,s),r||(a=B(e,"change",n[14]),r=!0)},p(u,f){f&8388608&&t!==(
`);for(let s=0;s<l.length;s+=1)l[s].c();p(e,"class","help-block")},m(s,o){v(s,e,o),w(e,t);for(let r=0;r<l.length;r+=1)l[r]&&l[r].m(e,null)},p(s,o){if(o&264){i=pe(s[3]);let r;for(r=0;r<i.length;r+=1){const a=$p(s,i,r);l[r]?l[r].p(a,o):(l[r]=Op(a),l[r].c(),l[r].m(e,null))}for(;r<l.length;r+=1)l[r].d(1);l.length=i.length}},d(s){s&&k(e),pt(l,s)}}}function Op(n){let e,t="{"+n[25]+"}",i,l,s,o;function r(){return n[15](n[25])}return{c(){e=b("button"),i=Y(t),l=Y(" "),p(e,"type","button"),p(e,"class","label label-sm link-primary txt-mono")},m(a,u){v(a,e,u),w(e,i),v(a,l,u),s||(o=B(e,"click",r),s=!0)},p(a,u){n=a,u&8&&t!==(t="{"+n[25]+"}")&&ue(i,t)},d(a){a&&(k(e),k(l)),s=!1,o()}}}function D5(n){var d;let e,t,i,l,s,o,r,a,u,f,c=((d=n[3])==null?void 0:d.length)>0&&Cp(n);return{c(){e=b("label"),t=Y("Subject"),l=C(),s=b("input"),r=C(),c&&c.c(),a=ge(),p(e,"for",i=n[24]),p(s,"type","text"),p(s,"id",o=n[24]),p(s,"spellcheck","false"),s.required=!0},m(m,h){v(m,e,h),w(e,t),v(m,l,h),v(m,s,h),ce(s,n[0].subject),v(m,r,h),c&&c.m(m,h),v(m,a,h),u||(f=B(s,"input",n[14]),u=!0)},p(m,h){var g;h&16777216&&i!==(i=m[24])&&p(e,"for",i),h&16777216&&o!==(o=m[24])&&p(s,"id",o),h&1&&s.value!==m[0].subject&&ce(s,m[0].subject),((g=m[3])==null?void 0:g.length)>0?c?c.p(m,h):(c=Cp(m),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(m){m&&(k(e),k(l),k(s),k(r),k(a)),c&&c.d(m),u=!1,f()}}}function I5(n){let e,t,i,l;return{c(){e=b("textarea"),p(e,"id",t=n[24]),p(e,"class","txt-mono"),p(e,"spellcheck","false"),p(e,"rows","14"),e.required=!0},m(s,o){v(s,e,o),ce(e,n[0].body),i||(l=B(e,"input",n[17]),i=!0)},p(s,o){o&16777216&&t!==(t=s[24])&&p(e,"id",t),o&1&&ce(e,s[0].body)},i:te,o:te,d(s){s&&k(e),i=!1,l()}}}function L5(n){let e,t,i,l;function s(a){n[16](a)}var o=n[5];function r(a,u){let f={id:a[24],language:"html"};return a[0].body!==void 0&&(f.value=a[0].body),{props:f}}return o&&(e=jt(o,r(n)),ie.push(()=>ve(e,"value",s))),{c(){e&&H(e.$$.fragment),i=ge()},m(a,u){e&&F(e,a,u),v(a,i,u),l=!0},p(a,u){if(u&32&&o!==(o=a[5])){if(e){re();const f=e;D(f.$$.fragment,1,0,()=>{q(f,1)}),ae()}o?(e=jt(o,r(a)),ie.push(()=>ve(e,"value",s)),H(e.$$.fragment),O(e.$$.fragment,1),F(e,i.parentNode,i)):e=null}else if(o){const f={};u&16777216&&(f.id=a[24]),!t&&u&1&&(t=!0,f.value=a[0].body,$e(()=>t=!1)),e.$set(f)}},i(a){l||(e&&O(e.$$.fragment,a),l=!0)},o(a){e&&D(e.$$.fragment,a),l=!1},d(a){a&&k(i),e&&q(e,a)}}}function Ep(n){let e,t,i=pe(n[3]),l=[];for(let s=0;s<i.length;s+=1)l[s]=Mp(Tp(n,i,s));return{c(){e=b("div"),t=Y(`Available placeholder parameters:
`);for(let s=0;s<l.length;s+=1)l[s].c();p(e,"class","help-block")},m(s,o){v(s,e,o),w(e,t);for(let r=0;r<l.length;r+=1)l[r]&&l[r].m(e,null)},p(s,o){if(o&264){i=pe(s[3]);let r;for(r=0;r<i.length;r+=1){const a=Tp(s,i,r);l[r]?l[r].p(a,o):(l[r]=Mp(a),l[r].c(),l[r].m(e,null))}for(;r<l.length;r+=1)l[r].d(1);l.length=i.length}},d(s){s&&k(e),pt(l,s)}}}function Mp(n){let e,t="{"+n[25]+"}",i,l,s,o;function r(){return n[18](n[25])}return{c(){e=b("button"),i=Y(t),l=Y(" "),p(e,"type","button"),p(e,"class","label label-sm link-primary txt-mono")},m(a,u){v(a,e,u),w(e,i),v(a,l,u),s||(o=B(e,"click",r),s=!0)},p(a,u){n=a,u&8&&t!==(t="{"+n[25]+"}")&&ue(i,t)},d(a){a&&(k(e),k(l)),s=!1,o()}}}function A5(n){var h;let e,t,i,l,s,o,r,a,u;const f=[L5,I5],c=[];function d(g,_){return g[5]&&!g[6]?0:1}s=d(n),o=c[s]=f[s](n);let m=((h=n[3])==null?void 0:h.length)>0&&Ep(n);return{c(){e=b("label"),t=Y("Body (HTML)"),l=C(),o.c(),r=C(),m&&m.c(),a=ge(),p(e,"for",i=n[24])},m(g,_){v(g,e,_),w(e,t),v(g,l,_),c[s].m(g,_),v(g,r,_),m&&m.m(g,_),v(g,a,_),u=!0},p(g,_){var S;(!u||_&16777216&&i!==(i=g[24]))&&p(e,"for",i);let y=s;s=d(g),s===y?c[s].p(g,_):(re(),D(c[y],1,1,()=>{c[y]=null}),ae(),o=c[s],o?o.p(g,_):(o=c[s]=f[s](g),o.c()),O(o,1),o.m(r.parentNode,r)),((S=g[3])==null?void 0:S.length)>0?m?m.p(g,_):(m=Ep(g),m.c(),m.m(a.parentNode,a)):m&&(m.d(1),m=null)},i(g){u||(O(o),u=!0)},o(g){D(o),u=!1},d(g){g&&(k(e),k(l),k(r),k(a)),c[s].d(g),m&&m.d(g)}}}function P5(n){let e,t,i,l;return e=new fe({props:{class:"form-field required",name:n[1]+".subject",$$slots:{default:[D5,({uniqueId:s})=>({24:s}),({uniqueId:s})=>s?16777216:0]},$$scope:{ctx:n}}}),i=new fe({props:{class:"form-field m-0 required",name:n[1]+".body",$$slots:{default:[A5,({uniqueId:s})=>({24:s}),({uniqueId:s})=>s?16777216:0]},$$scope:{ctx:n}}}),{c(){H(e.$$.fragment),t=C(),H(i.$$.fragment)},m(s,o){F(e,s,o),v(s,t,o),F(i,s,o),l=!0},p(s,o){const r={};o&2&&(r.name=s[1]+".subject"),o&1090519049&&(r.$$scope={dirty:o,ctx:s}),e.$set(r);const a={};o&2&&(a.name=s[1]+".body"),o&1090519145&&(a.$$scope={dirty:o,ctx:s}),i.$set(a)},i(s){l||(O(e.$$.fragment,s),O(i.$$.fragment,s),l=!0)},o(s){D(e.$$.fragment,s),D(i.$$.fragment,s),l=!1},d(s){s&&k(t),q(e,s),q(i,s)}}}function Dp(n){let e,t,i,l,s;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){v(o,e,r),i=!0,l||(s=Me(He.call(null,e,{text:"Has errors",position:"left"})),l=!0)},i(o){i||(o&&nt(()=>{i&&(t||(t=ze(e,Mt,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=ze(e,Mt,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&k(e),o&&t&&t.end(),l=!1,s()}}}function N5(n){let e,t,i,l,s,o,r,a,u,f=n[7]&&Dp();return{c(){e=b("div"),t=b("i"),i=C(),l=b("span"),s=Y(n[2]),o=C(),r=b("div"),a=C(),f&&f.c(),u=ge(),p(t,"class","ri-draft-line"),p(l,"class","txt"),p(e,"class","inline-flex"),p(r,"class","flex-fill")},m(c,d){v(c,e,d),w(e,t),w(e,i),w(e,l),w(l,s),v(c,o,d),v(c,r,d),v(c,a,d),f&&f.m(c,d),v(c,u,d)},p(c,d){d&4&&ue(s,c[2]),c[7]?f?d&128&&O(f,1):(f=Dp(),f.c(),O(f,1),f.m(u.parentNode,u)):f&&(re(),D(f,1,1,()=>{f=null}),ae())},d(c){c&&(k(e),k(o),k(r),k(a),k(u)),f&&f.d(c)}}}function R5(n){let e,t;const i=[n[9]];let l={$$slots:{header:[N5],default:[P5]},$$scope:{ctx:n}};for(let s=0;s<i.length;s+=1)l=je(l,i[s]);return e=new qi({props:l}),n[19](e),e.$on("expand",n[20]),e.$on("collapse",n[21]),e.$on("toggle",n[22]),{c(){H(e.$$.fragment)},m(s,o){F(e,s,o),t=!0},p(s,[o]){const r=o&512?vt(i,[Ft(s[9])]):{};o&1073742063&&(r.$$scope={dirty:o,ctx:s}),e.$set(r)},i(s){t||(O(e.$$.fragment,s),t=!0)},o(s){D(e.$$.fragment,s),t=!1},d(s){n[19](null),q(e,s)}}}let Ip;function F5(n,e,t){let i;const l=["key","title","config","placeholders","expand","collapse","collapseSiblings"];let s=lt(e,l),o;Qe(n,Sn,N=>t(13,o=N));let{key:r}=e,{title:a}=e,{config:u={}}=e,{placeholders:f=[]}=e,c,d=Ip,m=!1;function h(){c==null||c.expand()}function g(){c==null||c.collapse()}function _(){c==null||c.collapseSiblings()}async function y(){d||m||(t(6,m=!0),t(5,d=(await Ot(async()=>{const{default:N}=await import("./CodeEditor-ycRnVsci.js");return{default:N}},__vite__mapDeps([12,1]),import.meta.url)).d
<code>email != &#39;&#39;</code>.`,l=C(),s=b("p"),s.textContent="Leave the rule empty to require MFA for everyone."},m(o,r){v(o,e,r),v(o,t,r),v(o,i,r),v(o,l,r),v(o,s,r)},p:te,d(o){o&&(k(e),k(t),k(i),k(l),k(s))}}}function l6(n){let e,t,i,l,s,o,r,a,u;l=new fe({props:{class:"form-field form-field-toggle",name:"mfa.enabled",$$slots:{default:[n6,({uniqueId:d})=>({5:d}),({uniqueId:d})=>d?32:0]},$$scope:{ctx:n}}});function f(d){n[4](d)}let c={label:"MFA rule",formKey:"mfa.rule",superuserToggle:!1,disabled:!n[0].mfa.enabled,placeholder:"Leave empty to require MFA for everyone",collection:n[0],$$slots:{default:[i6]},$$scope:{ctx:n}};return n[0].mfa.rule!==void 0&&(c.rule=n[0].mfa.rule),r=new tl({props:c}),ie.push(()=>ve(r,"rule",f)),{c(){e=b("div"),e.innerHTML=`<p class="txt-bold">This feature is experimental and may change in the future.</p> <p>Multi-factor authentication (MFA) requires the user to authenticate with any 2 different auth
2024-09-30 00:23:19 +08:00
methods (otp, identity/password, oauth2) before issuing an auth token.
<a href="https://pocketbase.io/docs/@todo" target="_blank" rel="noopener noreferrer" class="txt-sm link-hint" title="Learn more"><em>(Learn more)</em> </a>.</p>`,t=C(),i=b("div"),H(l.$$.fragment),s=C(),o=b("div"),H(r.$$.fragment),p(e,"class","content m-b-sm"),p(o,"class","content"),Q(o,"fade",!n[0].mfa.enabled),p(i,"class","grid")},m(d,m){v(d,e,m),v(d,t,m),v(d,i,m),F(l,i,null),w(i,s),w(i,o),F(r,o,null),u=!0},p(d,m){const h={};m&97&&(h.$$scope={dirty:m,ctx:d}),l.$set(h);const g={};m&1&&(g.disabled=!d[0].mfa.enabled),m&1&&(g.collection=d[0]),m&64&&(g.$$scope={dirty:m,ctx:d}),!a&&m&1&&(a=!0,g.rule=d[0].mfa.rule,$e(()=>a=!1)),r.$set(g),(!u||m&1)&&Q(o,"fade",!d[0].mfa.enabled)},i(d){u||(O(l.$$.fragment,d),O(r.$$.fragment,d),u=!0)},o(d){D(l.$$.fragment,d),D(r.$$.fragment,d),u=!1},d(d){d&&(k(e),k(t),k(i)),q(l),q(r)}}}function s6(n){let e;return{c(){e=b("span"),e.textContent="Disabled",p(e,"class","label")},m(t,i){v(t,e,i)},d(t){t&&k(e)}}}function o6(n){let e;return{c(){e=b("span"),e.textContent="Enabled",p(e,"class","label label-success")},m(t,i){v(t,e,i)},d(t){t&&k(e)}}}function Up(n){let e,t,i,l,s;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){v(o,e,r),i=!0,l||(s=Me(He.call(null,e,{text:"Has errors",position:"left"})),l=!0)},i(o){i||(o&&nt(()=>{i&&(t||(t=ze(e,Mt,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=ze(e,Mt,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&k(e),o&&t&&t.end(),l=!1,s()}}}function r6(n){let e,t,i,l,s,o;function r(c,d){return c[0].mfa.enabled?o6:s6}let a=r(n),u=a(n),f=n[1]&&Up();return{c(){e=b("div"),e.innerHTML='<i class="ri-shield-check-line"></i> <span class="txt">Multi-factor authentication (MFA)</span>',t=C(),i=b("div"),l=C(),u.c(),s=C(),f&&f.c(),o=ge(),p(e,"class","inline-flex"),p(i,"class","flex-fill")},m(c,d){v(c,e,d),v(c,t,d),v(c,i,d),v(c,l,d),u.m(c,d),v(c,s,d),f&&f.m(c,d),v(c,o,d)},p(c,d){a!==(a=r(c))&&(u.d(1),u=a(c),u&&(u.c(),u.m(s.parentNode,s))),c[1]?f?d&2&&O(f,1):(f=Up(),f.c(),O(f,1),f.m(o.parentNode,o)):f&&(re(),D(f,1,1,()=>{f=null}),ae())},d(c){c&&(k(e),k(t),k(i),k(l),k(s),k(o)),u.d(c),f&&f.d(c)}}}function a6(n){let e,t;return e=new qi({props:{single:!0,$$slots:{header:[r6],default:[l6]},$$scope:{ctx:n}}}),{c(){H(e.$$.fragment)},m(i,l){F(e,i,l),t=!0},p(i,[l]){const s={};l&67&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(O(e.$$.fragment,i),t=!0)},o(i){D(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function u6(n,e,t){let i,l;Qe(n,Sn,a=>t(2,l=a));let{collection:s}=e;function o(){s.mfa.enabled=this.checked,t(0,s)}function r(a){n.$$.not_equal(s.mfa.rule,a)&&(s.mfa.rule=a,t(0,s))}return n.$$set=a=>{"collection"in a&&t(0,s=a.collection)},n.$$.update=()=>{n.$$.dirty&4&&t(1,i=!z.isEmpty(l==null?void 0:l.mfa))},[s,i,l,o,r]}class f6 extends ye{constructor(e){super(),be(this,e,u6,a6,_e,{collection:0})}}const c6=n=>({}),Vp=n=>({});function Bp(n,e,t){const i=n.slice();return i[50]=e[t],i}const d6=n=>({}),Wp=n=>({});function Yp(n,e,t){const i=n.slice();return i[50]=e[t],i[54]=t,i}function Kp(n){let e,t,i;return{c(){e=b("div"),t=Y(n[2]),i=C(),p(e,"class","block txt-placeholder"),Q(e,"link-hint",!n[5]&&!n[6])},m(l,s){v(l,e,s),w(e,t),w(e,i)},p(l,s){s[0]&4&&ue(t,l[2]),s[0]&96&&Q(e,"link-hint",!l[5]&&!l[6])},d(l){l&&k(e)}}}function p6(n){let e,t=n[50]+"",i;return{c(){e=b("span"),i=Y(t),p(e,"class","txt")},m(l,s){v(l,e,s),w(e,i)},p(l,s){s[0]&1&&t!==(t=l[50]+"")&&ue(i,t)},i:te,o:te,d(l){l&&k(e)}}}function m6(n){let e,t,i;const l=[{item:n[50]},n[11]];var s=n[10];function o(r,a){let u={};for(let f=0;f<l.length;f+=1)u=je(u,l[f]);return a!==void 0&&a[0]&2049&&(u=je(u,vt(l,[a[0]&1&&{item:r[50]},a[0]&2048&&Ft(r[11])]))),{props:u}}return s&&(e=jt(s,o(n))),{c(){e&&H(e.$$.fragment),t=ge()},m(r,a){e&&F(e,r,a),v(r,t,a),i=!0},p(r,a){if(a[0]&1024&&s!==(s=r[10])){if(e){re();const u=e;D(u.$$.fragment,1,0,()=>{q(u,1)}),ae()}s?(e=jt(s,o(r,a)),H(e.$$.fragment),O(e.$$.fragment,1),F(e,t.parentNode,t)):e=null}else if(s){const u=a[0]&2049?vt(l,[a[0]&1&&{item:r[50]},a[0]&2048&&Ft(r[11])]):{};e.$set(u)}},i(r){i||(e&&O(e.$$.fragment,r),i=!0)},o(r){e&&D(e.$$.fragment,r),i=!1},d(r)
2024-09-30 00:23:19 +08:00
...
-----END PRIVATE KEY-----`),p(a,"class","help-block")},m(c,d){v(c,e,d),w(e,t),v(c,l,d),v(c,s,d),ce(s,n[5]),v(c,r,d),v(c,a,d),u||(f=B(s,"input",n[16]),u=!0)},p(c,d){d&8388608&&i!==(i=c[23])&&p(e,"for",i),d&8388608&&o!==(o=c[23])&&p(s,"id",o),d&32&&ce(s,c[5])},d(c){c&&(k(e),k(l),k(s),k(r),k(a)),u=!1,f()}}}function j6(n){let e,t,i,l,s,o,r,a,u,f,c,d,m,h,g,_,y,S;return l=new fe({props:{class:"form-field required",name:"clientId",$$slots:{default:[N6,({uniqueId:T})=>({23:T}),({uniqueId:T})=>T?8388608:0]},$$scope:{ctx:n}}}),r=new fe({props:{class:"form-field required",name:"teamId",$$slots:{default:[R6,({uniqueId:T})=>({23:T}),({uniqueId:T})=>T?8388608:0]},$$scope:{ctx:n}}}),f=new fe({props:{class:"form-field required",name:"keyId",$$slots:{default:[F6,({uniqueId:T})=>({23:T}),({uniqueId:T})=>T?8388608:0]},$$scope:{ctx:n}}}),m=new fe({props:{class:"form-field required",name:"duration",$$slots:{default:[q6,({uniqueId:T})=>({23:T}),({uniqueId:T})=>T?8388608:0]},$$scope:{ctx:n}}}),g=new fe({props:{class:"form-field required",name:"privateKey",$$slots:{default:[H6,({uniqueId:T})=>({23:T}),({uniqueId:T})=>T?8388608:0]},$$scope:{ctx:n}}}),{c(){e=b("form"),t=b("div"),i=b("div"),H(l.$$.fragment),s=C(),o=b("div"),H(r.$$.fragment),a=C(),u=b("div"),H(f.$$.fragment),c=C(),d=b("div"),H(m.$$.fragment),h=C(),H(g.$$.fragment),p(i,"class","col-lg-6"),p(o,"class","col-lg-6"),p(u,"class","col-lg-6"),p(d,"class","col-lg-6"),p(t,"class","grid"),p(e,"id",n[9]),p(e,"autocomplete","off")},m(T,$){v(T,e,$),w(e,t),w(t,i),F(l,i,null),w(t,s),w(t,o),F(r,o,null),w(t,a),w(t,u),F(f,u,null),w(t,c),w(t,d),F(m,d,null),w(t,h),F(g,t,null),_=!0,y||(S=B(e,"submit",tt(n[17])),y=!0)},p(T,$){const E={};$&25165828&&(E.$$scope={dirty:$,ctx:T}),l.$set(E);const M={};$&25165832&&(M.$$scope={dirty:$,ctx:T}),r.$set(M);const L={};$&25165840&&(L.$$scope={dirty:$,ctx:T}),f.$set(L);const I={};$&25165888&&(I.$$scope={dirty:$,ctx:T}),m.$set(I);const A={};$&25165856&&(A.$$scope={dirty:$,ctx:T}),g.$set(A)},i(T){_||(O(l.$$.fragment,T),O(r.$$.fragment,T),O(f.$$.fragment,T),O(m.$$.fragment,T),O(g.$$.fragment,T),_=!0)},o(T){D(l.$$.fragment,T),D(r.$$.fragment,T),D(f.$$.fragment,T),D(m.$$.fragment,T),D(g.$$.fragment,T),_=!1},d(T){T&&k(e),q(l),q(r),q(f),q(m),q(g),y=!1,S()}}}function z6(n){let e;return{c(){e=b("h4"),e.textContent="Generate Apple client secret",p(e,"class","center txt-break")},m(t,i){v(t,e,i)},p:te,d(t){t&&k(e)}}}function U6(n){let e,t,i,l,s,o,r,a,u,f;return{c(){e=b("button"),t=Y("Close"),i=C(),l=b("button"),s=b("i"),o=C(),r=b("span"),r.textContent="Generate and set secret",p(e,"type","button"),p(e,"class","btn btn-transparent"),e.disabled=n[7],p(s,"class","ri-key-line"),p(r,"class","txt"),p(l,"type","submit"),p(l,"form",n[9]),p(l,"class","btn btn-expanded"),l.disabled=a=!n[8]||n[7],Q(l,"btn-loading",n[7])},m(c,d){v(c,e,d),w(e,t),v(c,i,d),v(c,l,d),w(l,s),w(l,o),w(l,r),u||(f=B(e,"click",n[0]),u=!0)},p(c,d){d&128&&(e.disabled=c[7]),d&384&&a!==(a=!c[8]||c[7])&&(l.disabled=a),d&128&&Q(l,"btn-loading",c[7])},d(c){c&&(k(e),k(i),k(l)),u=!1,f()}}}function V6(n){let e,t,i={overlayClose:!n[7],escClose:!n[7],beforeHide:n[18],popup:!0,$$slots:{footer:[U6],header:[z6],default:[j6]},$$scope:{ctx:n}};return e=new ln({props:i}),n[19](e),e.$on("show",n[20]),e.$on("hide",n[21]),{c(){H(e.$$.fragment)},m(l,s){F(e,l,s),t=!0},p(l,[s]){const o={};s&128&&(o.overlayClose=!l[7]),s&128&&(o.escClose=!l[7]),s&128&&(o.beforeHide=l[18]),s&16777724&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(O(e.$$.fragment,l),t=!0)},o(l){D(e.$$.fragment,l),t=!1},d(l){n[19](null),q(e,l)}}}const ur=15777e3;function B6(n,e,t){let i;const l=gt(),s="apple_secret_"+z.randomString(5);let o,r,a,u,f,c,d=!1;function m(P={}){t(2,r=P.clientId||""),t(3,a=P.teamId||""),t(4,u=P.keyId||""),t(5,f=P.privateKey||""),t(6,c=P.duration||ur),Wt({}),o==null||o.show()}function h(){return o==null?void 0:o.hide()}async function g(){t(7,d=!0);try{const P=await me.settings.generateAppleClientSecret(r,a,u,f.trim(),c);t(7,d=!1),tn("Successfully generated client secret."),l("submit",P),o==null||o.hide()}catch(P){me.error(P)}t(7,d=!1)}function _(){r=
2024-09-30 00:23:19 +08:00
<span class='flatpickr-weekday'>
2024-10-08 21:22:49 +08:00
`+x.join("</span><span class='flatpickr-weekday'>")+`
2024-09-30 00:23:19 +08:00
</span>
`}}function oe(){t.calendarContainer.classList.add("hasWeeks");var Z=$t("div","flatpickr-weekwrapper");Z.appendChild($t("span","flatpickr-weekday",t.l10n.weekAbbreviation));var x=$t("div","flatpickr-weeks");return Z.appendChild(x),{weekWrapper:Z,weekNumbers:x}}function Se(Z,x){x===void 0&&(x=!0);var se=x?Z:Z-t.currentMonth;se<0&&t._hidePrevMonthArrow===!0||se>0&&t._hideNextMonthArrow===!0||(t.currentMonth+=se,(t.currentMonth<0||t.currentMonth>11)&&(t.currentYear+=t.currentMonth>11?1:-1,t.currentMonth=(t.currentMonth+12)%12,It("onYearChange"),U()),N(),It("onMonthChange"),ji())}function ke(Z,x){if(Z===void 0&&(Z=!0),x===void 0&&(x=!0),t.input.value="",t.altInput!==void 0&&(t.altInput.value=""),t.mobileInput!==void 0&&(t.mobileInput.value=""),t.selectedDates=[],t.latestSelectedDateObj=void 0,x===!0&&(t.currentYear=t._initialDate.getFullYear(),t.currentMonth=t._initialDate.getMonth()),t.config.enableTime===!0){var se=Ia(t.config),he=se.hours,qe=se.minutes,le=se.seconds;m(he,qe,le)}t.redraw(),Z&&It("onChange")}function Ce(){t.isOpen=!1,t.isMobile||(t.calendarContainer!==void 0&&t.calendarContainer.classList.remove("open"),t._input!==void 0&&t._input.classList.remove("active")),It("onClose")}function We(){t.config!==void 0&&It("onDestroy");for(var Z=t._handlers.length;Z--;)t._handlers[Z].remove();if(t._handlers=[],t.mobileInput)t.mobileInput.parentNode&&t.mobileInput.parentNode.removeChild(t.mobileInput),t.mobileInput=void 0;else if(t.calendarContainer&&t.calendarContainer.parentNode)if(t.config.static&&t.calendarContainer.parentNode){var x=t.calendarContainer.parentNode;if(x.lastChild&&x.removeChild(x.lastChild),x.parentNode){for(;x.firstChild;)x.parentNode.insertBefore(x.firstChild,x);x.parentNode.removeChild(x)}}else t.calendarContainer.parentNode.removeChild(t.calendarContainer);t.altInput&&(t.input.type="text",t.altInput.parentNode&&t.altInput.parentNode.removeChild(t.altInput),delete t.altInput),t.input&&(t.input.type=t.input._type,t.input.classList.remove("flatpickr-input"),t.input.removeAttribute("readonly")),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(function(se){try{delete t[se]}catch{}})}function st(Z){return t.calendarContainer.contains(Z)}function et(Z){if(t.isOpen&&!t.config.inline){var x=jn(Z),se=st(x),he=x===t.input||x===t.altInput||t.element.contains(x)||Z.path&&Z.path.indexOf&&(~Z.path.indexOf(t.input)||~Z.path.indexOf(t.altInput)),qe=!he&&!se&&!st(Z.relatedTarget),le=!t.config.ignoredFocusElements.some(function(Ee){return Ee.contains(x)});qe&&le&&(t.config.allowInput&&t.setDate(t._input.value,!1,t.config.altInput?t.config.altFormat:t.config.dateFormat),t.timeContainer!==void 0&&t.minuteElement!==void 0&&t.hourElement!==void 0&&t.input.value!==""&&t.input.value!==void 0&&a(),t.close(),t.config&&t.config.mode==="range"&&t.selectedDates.length===1&&t.clear(!1))}}function Be(Z){if(!(!Z||t.config.minDate&&Z<t.config.minDate.getFullYear()||t.config.maxDate&&Z>t.config.maxDate.getFullYear())){var x=Z,se=t.currentYear!==x;t.currentYear=x||t.currentYear,t.config.maxDate&&t.currentYear===t.config.maxDate.getFullYear()?t.currentMonth=Math.min(t.config.maxDate.getMonth(),t.currentMonth):t.config.minDate&&t.currentYear===t.config.minDate.getFullYear()&&(t.currentMonth=Math.max(t.config.minDate.getMonth(),t.currentMonth)),se&&(t.redraw(),It("onYearChange"),U())}}function rt(Z,x){var se;x===void 0&&(x=!0);var he=t.parseDate(Z,void 0,x);if(t.config.minDate&&he&&zn(he,t.config.minDate,x!==void 0?x:!t.minDateHasTime)<0||t.config.maxDate&&he&&zn(he,t.config.maxDate,x!==void 0?x:!t.maxDateHasTime)>0)return!1;if(!t.config.enable&&t.config.disable.length===0)ret
This field is disabled if "Only domains" is set.`,position:"top"})),d=!0)},p(_,y){(!c||y&512&&s!==(s=_[9]))&&p(e,"for",s);const S={};y&512&&(S.id=_[9]),y&1&&(S.disabled=!z.isEmpty(_[0].onlyDomains)),!a&&y&1&&(a=!0,S.value=_[0].exceptDomains,$e(()=>a=!1)),r.$set(S)},i(_){c||(O(r.$$.fragment,_),c=!0)},o(_){D(r.$$.fragment,_),c=!1},d(_){_&&(k(e),k(o),k(u),k(f)),q(r,_),d=!1,m()}}}function AE(n){let e,t,i,l,s,o,r,a,u,f,c,d,m;function h(_){n[4](_)}let g={id:n[9]+".onlyDomains",disabled:!z.isEmpty(n[0].exceptDomains)};return n[0].onlyDomains!==void 0&&(g.value=n[0].onlyDomains),r=new _o({props:g}),ie.push(()=>ve(r,"value",h)),{c(){e=b("label"),t=b("span"),t.textContent="Only domains",i=C(),l=b("i"),o=C(),H(r.$$.fragment),u=C(),f=b("div"),f.textContent="Use comma as separator.",p(t,"class","txt"),p(l,"class","ri-information-line link-hint"),p(e,"for",s=n[9]+".onlyDomains"),p(f,"class","help-block")},m(_,y){v(_,e,y),w(e,t),w(e,i),w(e,l),v(_,o,y),F(r,_,y),v(_,u,y),v(_,f,y),c=!0,d||(m=Me(He.call(null,l,{text:`List of domains that are ONLY allowed.
This field is disabled if "Except domains" is set.`,position:"top"})),d=!0)},p(_,y){(!c||y&512&&s!==(s=_[9]+".onlyDomains"))&&p(e,"for",s);const S={};y&512&&(S.id=_[9]+".onlyDomains"),y&1&&(S.disabled=!z.isEmpty(_[0].exceptDomains)),!a&&y&1&&(a=!0,S.value=_[0].onlyDomains,$e(()=>a=!1)),r.$set(S)},i(_){c||(O(r.$$.fragment,_),c=!0)},o(_){D(r.$$.fragment,_),c=!1},d(_){_&&(k(e),k(o),k(u),k(f)),q(r,_),d=!1,m()}}}function PE(n){let e,t,i,l,s,o,r;return i=new fe({props:{class:"form-field",name:"fields."+n[1]+".exceptDomains",$$slots:{default:[LE,({uniqueId:a})=>({9:a}),({uniqueId:a})=>a?512:0]},$$scope:{ctx:n}}}),o=new fe({props:{class:"form-field",name:"fields."+n[1]+".onlyDomains",$$slots:{default:[AE,({uniqueId:a})=>({9:a}),({uniqueId:a})=>a?512:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),H(i.$$.fragment),l=C(),s=b("div"),H(o.$$.fragment),p(t,"class","col-sm-6"),p(s,"class","col-sm-6"),p(e,"class","grid grid-sm")},m(a,u){v(a,e,u),w(e,t),F(i,t,null),w(e,l),w(e,s),F(o,s,null),r=!0},p(a,u){const f={};u&2&&(f.name="fields."+a[1]+".exceptDomains"),u&1537&&(f.$$scope={dirty:u,ctx:a}),i.$set(f);const c={};u&2&&(c.name="fields."+a[1]+".onlyDomains"),u&1537&&(c.$$scope={dirty:u,ctx:a}),o.$set(c)},i(a){r||(O(i.$$.fragment,a),O(o.$$.fragment,a),r=!0)},o(a){D(i.$$.fragment,a),D(o.$$.fragment,a),r=!1},d(a){a&&k(e),q(i),q(o)}}}function NE(n){let e,t,i;const l=[{key:n[1]},n[2]];function s(r){n[5](r)}let o={$$slots:{options:[PE]},$$scope:{ctx:n}};for(let r=0;r<l.length;r+=1)o=je(o,l[r]);return n[0]!==void 0&&(o.field=n[0]),e=new ei({props:o}),ie.push(()=>ve(e,"field",s)),e.$on("rename",n[6]),e.$on("remove",n[7]),e.$on("duplicate",n[8]),{c(){H(e.$$.fragment)},m(r,a){F(e,r,a),i=!0},p(r,[a]){const u=a&6?vt(l,[a&2&&{key:r[1]},a&4&&Ft(r[2])]):{};a&1027&&(u.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,u.field=r[0],$e(()=>t=!1)),e.$set(u)},i(r){i||(O(e.$$.fragment,r),i=!0)},o(r){D(e.$$.fragment,r),i=!1},d(r){q(e,r)}}}function RE(n,e,t){const i=["field","key"];let l=lt(e,i),{field:s}=e,{key:o=""}=e;function r(m){n.$$.not_equal(s.exceptDomains,m)&&(s.exceptDomains=m,t(0,s))}function a(m){n.$$.not_equal(s.onlyDomains,m)&&(s.onlyDomains=m,t(0,s))}function u(m){s=m,t(0,s)}function f(m){Pe.call(this,n,m)}function c(m){Pe.call(this,n,m)}function d(m){Pe.call(this,n,m)}return n.$$set=m=>{e=je(je({},e),Ut(m)),t(2,l=lt(e,i)),"field"in m&&t(0,s=m.field),"key"in m&&t(1,o=m.key)},[s,o,l,r,a,u,f,c,d]}class sk extends ye{constructor(e){super(),be(this,e,RE,NE,_e,{field:0,key:1})}}function FE(n){let e,t=(n[0].ext||"N/A")+"",i,l,s,o=n[0].mimeType+"",r;return{c(){e=b("span"),i=Y(t),l=C(),s=b("small"),r=Y(o),p(e,"class","txt"),p(s,"class","txt-hint")},m(a,u){v(a,e,u),w(e,i),v(a,l,u),v(a,s,u),w(s,r)},p(a,[u]){u&1&&t!==(t=(a[0].ext||"N/A")+"")&&ue(i,t),u&1&&o!==(o=a[0].mimeType+"")&&ue(r,o)},i:te,o:te,d(a){a&&(k(e),k(l),k(s))}}}function qE(n,e,t){let{item:i={}}=e;return n.$$set=l=>{"item"in l&&t(0,i=l.item)},[i]}class nh extends ye{constructor(e){super(),be(this,e,qE,FE,_e,{item:0})}}const HE=[{ext:".xpm",mimeType:"image/x-xpixmap"},{ext:".7z",mimeType:"application/x-7z-compressed"},{ext:".zip",mimeType:"application/zip"},{ext:".xlsx",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"},{ext:".docx",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},{ext:".pptx",mimeType:"application/vnd.openxmlformats-officedocument.presentationml.presentation"},{ext:".epub",mimeType:"application/epub+zip"},{ext:".jar",mimeType:"application/jar"},{ext:".odt",mimeType:"application/vnd.oasis.opendocument.text"},{ext:".ott",mimeType:"application/vnd.oasis.opendocument.text-template"},{ext:".ods",mimeType:"application/vnd.oasis.opendocument.spreadsheet"},{ext:".ots",mimeType:"application/vnd.oasis.opendocument.spreadsheet-template"},{ext:".odp",mimeType:"application/vnd.oasis.opendocument.presentation"},{ext:".otp",mimeType:"application/vnd.oasis.opendocument.presentation-template"},{ext:".odg",mimeType:"application/vnd.oasis.opendocument.graphics"},{ext:".otg",mimeType:"application/vnd.oasis.opendocument.graphics-template"},{e
Leave empty for no restriction.`,position:"top"})),S=!0)},p(M,L){(!y||L&8388608&&s!==(s=M[23]))&&p(e,"for",s);const I={};L&8388608&&(I.id=M[23]),L&8&&(I.items=M[3]),!a&&L&1&&(a=!0,I.keyOfSelected=M[0].mimeTypes,$e(()=>a=!1)),r.$set(I);const A={};L&33554433&&(A.$$scope={dirty:L,ctx:M}),_.$set(A)},i(M){y||(O(r.$$.fragment,M),O(_.$$.fragment,M),y=!0)},o(M){D(r.$$.fragment,M),D(_.$$.fragment,M),y=!1},d(M){M&&(k(e),k(o),k(u),k(f)),q(r,M),q(_),S=!1,T()}}}function BE(n){let e;return{c(){e=b("ul"),e.innerHTML=`<li><strong>WxH</strong>
2024-09-30 00:23:19 +08:00
(e.g. 100x50) - crop to WxH viewbox (from center)</li> <li><strong>WxHt</strong>
(e.g. 100x50t) - crop to WxH viewbox (from top)</li> <li><strong>WxHb</strong>
(e.g. 100x50b) - crop to WxH viewbox (from bottom)</li> <li><strong>WxHf</strong>
(e.g. 100x50f) - fit inside a WxH viewbox (without cropping)</li> <li><strong>0xH</strong>
(e.g. 0x50) - resize to H height preserving the aspect ratio</li> <li><strong>Wx0</strong>
(e.g. 100x0) - resize to W width preserving the aspect ratio</li>`,p(e,"class","m-0")},m(t,i){v(t,e,i)},p:te,d(t){t&&k(e)}}}function WE(n){let e,t,i,l,s,o,r,a,u,f,c,d,m,h,g,_,y,S,T,$,E;function M(I){n[12](I)}let L={id:n[23],placeholder:"e.g. 50x50, 480x720"};return n[0].thumbs!==void 0&&(L.value=n[0].thumbs),r=new _o({props:L}),ie.push(()=>ve(r,"value",M)),S=new Hn({props:{class:"dropdown dropdown-sm dropdown-center dropdown-nowrap p-r-10",$$slots:{default:[BE]},$$scope:{ctx:n}}}),{c(){e=b("label"),t=b("span"),t.textContent="Thumb sizes",i=C(),l=b("i"),o=C(),H(r.$$.fragment),u=C(),f=b("div"),c=b("span"),c.textContent="Use comma as separator.",d=C(),m=b("button"),h=b("span"),h.textContent="Supported formats",g=C(),_=b("i"),y=C(),H(S.$$.fragment),p(t,"class","txt"),p(l,"class","ri-information-line link-hint"),p(e,"for",s=n[23]),p(c,"class","txt"),p(h,"class","txt link-primary"),p(_,"class","ri-arrow-drop-down-fill"),p(_,"aria-hidden","true"),p(m,"type","button"),p(m,"class","inline-flex flex-gap-0"),p(f,"class","help-block")},m(I,A){v(I,e,A),w(e,t),w(e,i),w(e,l),v(I,o,A),F(r,I,A),v(I,u,A),v(I,f,A),w(f,c),w(f,d),w(f,m),w(m,h),w(m,g),w(m,_),w(m,y),F(S,m,null),T=!0,$||(E=Me(He.call(null,l,{text:"List of additional thumb sizes for image files, along with the default thumb size of 100x100. The thumbs are generated lazily on first access.",position:"top"})),$=!0)},p(I,A){(!T||A&8388608&&s!==(s=I[23]))&&p(e,"for",s);const P={};A&8388608&&(P.id=I[23]),!a&&A&1&&(a=!0,P.value=I[0].thumbs,$e(()=>a=!1)),r.$set(P);const R={};A&33554432&&(R.$$scope={dirty:A,ctx:I}),S.$set(R)},i(I){T||(O(r.$$.fragment,I),O(S.$$.fragment,I),T=!0)},o(I){D(r.$$.fragment,I),D(S.$$.fragment,I),T=!1},d(I){I&&(k(e),k(o),k(u),k(f)),q(r,I),q(S),$=!1,E()}}}function YE(n){let e,t,i,l,s,o,r,a,u,f,c;return{c(){e=b("label"),t=Y("Max file size"),l=C(),s=b("input"),a=C(),u=b("div"),u.textContent="Must be in bytes.",p(e,"for",i=n[23]),p(s,"type","number"),p(s,"id",o=n[23]),p(s,"step","1"),p(s,"min","0"),s.value=r=n[0].maxSize||"",p(s,"placeholder","Default to max ~5MB"),p(u,"class","help-block")},m(d,m){v(d,e,m),w(e,t),v(d,l,m),v(d,s,m),v(d,a,m),v(d,u,m),f||(c=B(s,"input",n[13]),f=!0)},p(d,m){m&8388608&&i!==(i=d[23])&&p(e,"for",i),m&8388608&&o!==(o=d[23])&&p(s,"id",o),m&1&&r!==(r=d[0].maxSize||"")&&s.value!==r&&(s.value=r)},d(d){d&&(k(e),k(l),k(s),k(a),k(u)),f=!1,c()}}}function ih(n){let e,t,i;return t=new fe({props:{class:"form-field",name:"fields."+n[1]+".maxSelect",$$slots:{default:[KE,({uniqueId:l})=>({23:l}),({uniqueId:l})=>l?8388608:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),H(t.$$.fragment),p(e,"class","col-sm-3")},m(l,s){v(l,e,s),F(t,e,null),i=!0},p(l,s){const o={};s&2&&(o.name="fields."+l[1]+".maxSelect"),s&41943041&&(o.$$scope={dirty:s,ctx:l}),t.$set(o)},i(l){i||(O(t.$$.fragment,l),i=!0)},o(l){D(t.$$.fragment,l),i=!1},d(l){l&&k(e),q(t)}}}function KE(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Max select"),l=C(),s=b("input"),p(e,"for",i=n[23]),p(s,"id",o=n[23]),p(s,"type","number"),p(s,"step","1"),p(s,"min","2"),s.required=!0,p(s,"placeholder","Default to single")},m(u,f){v(u,e,f),w(e,t),v(u,l,f),v(u,s,f),ce(s,n[0].maxSelect),r||(a=B(s,"input",n[14]),r=!0)},p(u,f){f&8388608&&i!==(i=u[23])&&p(e,"for",i),f&8388608&&o!==(o=u[23])&&p(s,"id",o),f&1&&_t(s.value)!==u[0].maxSelect&&ce(s,u[0].maxSelect)},d(u){u&&(k(e),k(l),k(s)),r=!1,a()}}}function JE(n){let e,t,i,l,s,o,r,a,u,f;return{c(){e=b("input"),i=C(),l=b("label"),s=b("span"),s.textContent="Protected",r=C(),a=b("small"),a.innerHTML=`it will require View API rule permissions and file token to be accessible
<a href="https://pocketbase.io/docs/files-handling/#protected-files" class="toggle-info" target="_blank" rel="noopener">(Learn more)</a>`,p(e,"type","checkbox"),p(e,"id",t=n[23]),p(s,"class","txt"),p(l,"for",o=n[23]),p(a,"class","txt-hint")},m(c,d){v(c,e,d),e.checked=n[0].protected,v(c,i,d),v(c,l,d),w(l,s),v(c,r,d),v(c,a,d),u||(f=B(e,"change",n[15]),u=!0)},p(c,d){d&8388608&&t!==(t=c[23])&&p(e,"id",t),d&1&&(e.checked=c[0].protected),d&8388608&&o!==(o=c[23])&&p(l,"for",o)},d(c){c&&(k(e),k(i),k(l),k(r),k(a)),u=!1,f()}}}function ZE(n){let e,t,i,l,s,o,r,a,u,f,c,d,m,h,g;i=new fe({props:{class:"form-field",name:"fields."+n[1]+".mimeTypes",$$slots:{default:[VE,({uniqueId:y})=>({23:y}),({uniqueId:y})=>y?8388608:0]},$$scope:{ctx:n}}}),o=new fe({props:{class:"form-field",name:"fields."+n[1]+".thumbs",$$slots:{default:[WE,({uniqueId:y})=>({23:y}),({uniqueId:y})=>y?8388608:0]},$$scope:{ctx:n}}}),f=new fe({props:{class:"form-field",name:"fields."+n[1]+".maxSize",$$slots:{default:[YE,({uniqueId:y})=>({23:y}),({uniqueId:y})=>y?8388608:0]},$$scope:{ctx:n}}});let _=!n[2]&&ih(n);return h=new fe({props:{class:"form-field form-field-toggle",name:"fields."+n[1]+".protected",$$slots:{default:[JE,({uniqueId:y})=>({23:y}),({uniqueId:y})=>y?8388608:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),H(i.$$.fragment),l=C(),s=b("div"),H(o.$$.fragment),a=C(),u=b("div"),H(f.$$.fragment),d=C(),_&&_.c(),m=C(),H(h.$$.fragment),p(t,"class","col-sm-12"),p(s,"class",r=n[2]?"col-sm-8":"col-sm-6"),p(u,"class",c=n[2]?"col-sm-4":"col-sm-3"),p(e,"class","grid grid-sm")},m(y,S){v(y,e,S),w(e,t),F(i,t,null),w(e,l),w(e,s),F(o,s,null),w(e,a),w(e,u),F(f,u,null),w(e,d),_&&_.m(e,null),w(e,m),F(h,e,null),g=!0},p(y,S){const T={};S&2&&(T.name="fields."+y[1]+".mimeTypes"),S&41943049&&(T.$$scope={dirty:S,ctx:y}),i.$set(T);const $={};S&2&&($.name="fields."+y[1]+".thumbs"),S&41943041&&($.$$scope={dirty:S,ctx:y}),o.$set($),(!g||S&4&&r!==(r=y[2]?"col-sm-8":"col-sm-6"))&&p(s,"class",r);const E={};S&2&&(E.name="fields."+y[1]+".maxSize"),S&41943041&&(E.$$scope={dirty:S,ctx:y}),f.$set(E),(!g||S&4&&c!==(c=y[2]?"col-sm-4":"col-sm-3"))&&p(u,"class",c),y[2]?_&&(re(),D(_,1,1,()=>{_=null}),ae()):_?(_.p(y,S),S&4&&O(_,1)):(_=ih(y),_.c(),O(_,1),_.m(e,m));const M={};S&2&&(M.name="fields."+y[1]+".protected"),S&41943041&&(M.$$scope={dirty:S,ctx:y}),h.$set(M)},i(y){g||(O(i.$$.fragment,y),O(o.$$.fragment,y),O(f.$$.fragment,y),O(_),O(h.$$.fragment,y),g=!0)},o(y){D(i.$$.fragment,y),D(o.$$.fragment,y),D(f.$$.fragment,y),D(_),D(h.$$.fragment,y),g=!1},d(y){y&&k(e),q(i),q(o),q(f),_&&_.d(),q(h)}}}function GE(n){let e,t,i;const l=[{key:n[1]},n[5]];function s(r){n[17](r)}let o={$$slots:{options:[ZE],default:[zE,({interactive:r})=>({24:r}),({interactive:r})=>r?16777216:0]},$$scope:{ctx:n}};for(let r=0;r<l.length;r+=1)o=je(o,l[r]);return n[0]!==void 0&&(o.field=n[0]),e=new ei({props:o}),ie.push(()=>ve(e,"field",s)),e.$on("rename",n[18]),e.$on("remove",n[19]),e.$on("duplicate",n[20]),{c(){H(e.$$.fragment)},m(r,a){F(e,r,a),i=!0},p(r,[a]){const u=a&34?vt(l,[a&2&&{key:r[1]},a&32&&Ft(r[5])]):{};a&50331663&&(u.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,u.field=r[0],$e(()=>t=!1)),e.$set(u)},i(r){i||(O(e.$$.fragment,r),i=!0)},o(r){D(e.$$.fragment,r),i=!1},d(r){q(e,r)}}}function XE(n,e,t){const i=["field","key"];let l=lt(e,i),{field:s}=e,{key:o=""}=e;const r=[{label:"Single",value:!0},{label:"Multiple",value:!1}];let a=HE.slice(),u=s.maxSelect<=1,f=u;function c(){t(0,s.maxSelect=1,s),t(0,s.thumbs=[],s),t(0,s.mimeTypes=[],s),t(2,u=!0),t(6,f=u)}function d(){if(z.isEmpty(s.mimeTypes))return;const R=[];for(const N of s.mimeTypes)a.find(U=>U.mimeType===N)||R.push({mimeType:N});R.length&&t(3,a=a.concat(R))}function m(R){n.$$.not_equal(s.mimeTypes,R)&&(s.mimeTypes=R,t(0,s),t(6,f),t(2,u))}const h=()=>{t(0,s.mimeTypes=["image/jpeg","image/png","image/svg+xml","image/gif","image/webp"],s)},g=()=>{t(0,s.mimeTypes=["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetm
2024-09-30 00:23:19 +08:00
`),r=b("code"),r.textContent="multipart/form-data",a=Y(`
requests, the following normalization rules are applied if the `),u=b("code"),u.textContent="json",f=Y(` field
is a
`),c=b("strong"),c.textContent="plain string",d=Y(`:
`),m=b("ul"),h=b("li"),h.innerHTML="&quot;true&quot; is converted to the json <code>true</code>",g=C(),_=b("li"),_.innerHTML="&quot;false&quot; is converted to the json <code>false</code>",y=C(),S=b("li"),S.innerHTML="&quot;null&quot; is converted to the json <code>null</code>",T=C(),$=b("li"),$.innerHTML="&quot;[1,2,3]&quot; is converted to the json <code>[1,2,3]</code>",E=C(),M=b("li"),I=Y(L),A=Y(" is converted to the json "),P=b("code"),P.textContent='{"a":1,"b":2}',R=C(),N=b("li"),N.textContent="numeric strings are converted to json number",U=C(),j=b("li"),j.textContent="double quoted strings are left as they are (aka. without normalizations)",V=C(),K=b("li"),K.textContent="any other string (empty string too) is double quoted",J=Y(`
Alternatively, if you want to avoid the string value normalizations, you can wrap your
data inside an object, eg.`),ee=b("code"),ee.textContent='{"data": anything}',p(i,"class","content"),p(t,"class","alert alert-warning m-b-0 m-t-10"),p(e,"class","block")},m(Se,ke){v(Se,e,ke),w(e,t),w(t,i),w(i,l),w(i,s),w(i,o),w(i,r),w(i,a),w(i,u),w(i,f),w(i,c),w(i,d),w(i,m),w(m,h),w(m,g),w(m,_),w(m,y),w(m,S),w(m,T),w(m,$),w(m,E),w(m,M),w(M,I),w(M,A),w(M,P),w(m,R),w(m,N),w(m,U),w(m,j),w(m,V),w(m,K),w(i,J),w(i,ee),oe=!0},i(Se){oe||(Se&&nt(()=>{oe&&(X||(X=ze(e,wt,{duration:150},!0)),X.run(1))}),oe=!0)},o(Se){Se&&(X||(X=ze(e,wt,{duration:150},!1)),X.run(0)),oe=!1},d(Se){Se&&k(e),Se&&X&&X.end()}}}function nM(n){let e,t,i,l,s,o,r,a,u,f,c;e=new fe({props:{class:"form-field m-b-sm",name:"fields."+n[1]+".maxSize",$$slots:{default:[xE,({uniqueId:_})=>({10:_}),({uniqueId:_})=>_?1024:0]},$$scope:{ctx:n}}});function d(_,y){return _[2]?tM:eM}let m=d(n),h=m(n),g=n[2]&&lh();return{c(){H(e.$$.fragment),t=C(),i=b("button"),l=b("strong"),l.textContent="String value normalizations",s=C(),h.c(),r=C(),g&&g.c(),a=ge(),p(l,"class","txt"),p(i,"type","button"),p(i,"class",o="btn btn-sm "+(n[2]?"btn-secondary":"btn-hint btn-transparent"))},m(_,y){F(e,_,y),v(_,t,y),v(_,i,y),w(i,l),w(i,s),h.m(i,null),v(_,r,y),g&&g.m(_,y),v(_,a,y),u=!0,f||(c=B(i,"click",n[5]),f=!0)},p(_,y){const S={};y&2&&(S.name="fields."+_[1]+".maxSize"),y&3073&&(S.$$scope={dirty:y,ctx:_}),e.$set(S),m!==(m=d(_))&&(h.d(1),h=m(_),h&&(h.c(),h.m(i,null))),(!u||y&4&&o!==(o="btn btn-sm "+(_[2]?"btn-secondary":"btn-hint btn-transparent")))&&p(i,"class",o),_[2]?g?y&4&&O(g,1):(g=lh(),g.c(),O(g,1),g.m(a.parentNode,a)):g&&(re(),D(g,1,1,()=>{g=null}),ae())},i(_){u||(O(e.$$.fragment,_),O(g),u=!0)},o(_){D(e.$$.fragment,_),D(g),u=!1},d(_){_&&(k(t),k(i),k(r),k(a)),q(e,_),h.d(),g&&g.d(_),f=!1,c()}}}function iM(n){let e,t,i;const l=[{key:n[1]},n[3]];function s(r){n[6](r)}let o={$$slots:{options:[nM]},$$scope:{ctx:n}};for(let r=0;r<l.length;r+=1)o=je(o,l[r]);return n[0]!==void 0&&(o.field=n[0]),e=new ei({props:o}),ie.push(()=>ve(e,"field",s)),e.$on("rename",n[7]),e.$on("remove",n[8]),e.$on("duplicate",n[9]),{c(){H(e.$$.fragment)},m(r,a){F(e,r,a),i=!0},p(r,[a]){const u=a&10?vt(l,[a&2&&{key:r[1]},a&8&&Ft(r[3])]):{};a&2055&&(u.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,u.field=r[0],$e(()=>t=!1)),e.$set(u)},i(r){i||(O(e.$$.fragment,r),i=!0)},o(r){D(e.$$.fragment,r),i=!1},d(r){q(e,r)}}}function lM(n,e,t){const i=["field","key"];let l=lt(e,i),{field:s}=e,{key:o=""}=e,r=!1;const a=h=>t(0,s.maxSize=h.target.value<<0,s),u=()=>{t(2,r=!r)};function f(h){s=h,t(0,s)}function c(h){Pe.call(this,n,h)}function d(h){Pe.call(this,n,h)}function m(h){Pe.call(this,n,h)}return n.$$set=h=>{e=je(je({},e),Ut(h)),t(3,l=lt(e,i)),"field"in h&&t(0,s=h.field),"key"in h&&t(1,o=h.key)},[s,o,r,l,a,u,f,c,d,m]}class sM extends ye{constructor(e){super(),be(this,e,lM,iM,_e,{field:0,key:1})}}function oM(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Min"),l=C(),s=b("input"),p(e,"for",i=n[10]),p(s,"type","number"),p(s,"id",o=n[10])},m(u,f){v(u,e,f),w(e,t),v(u,l,f),v(u,s,f),ce(s,n[0].min),r||(a=B(s,"input",n[4]),r=!0)},p(u,f){f&1024&&i!==(i=u[10])&&p(e,"for",i),f&1024&&o!==(o=u[10])&&p(s,"id",o),f&1&&_t(s.value)!==u[0].min&&ce(s,u[0].min)},d(u){u&&(k(e),k(l),k(s)),r=!1,a()}}}function rM(n){let e,t,i,l,s,o,r,a,u;return{c(){e=b("label"),t=Y("Max"),l=C(),s=b("input"),p(e,"for",i=n[10]),p(s,"type","number"),p(s,"id",o=n[10]),p(s,"min",r=n[0].min)},m(f,c){v(f,e,c),w(e,t),v(f,l,c),v(f,s,c),ce(s,n[0].max),a||(u=B(s,"input",n[5]),a=!0)},p(f,c){c&1024&&i!==(i=f[10])&&p(e,"for",i),c&1024&&o!==(o=f[10])&&p(s,"id",o),c&1&&r!==(r=f[0].min)&&p(s,"min",r),c&1&&_t(s.value)!==f[0].max&&ce(s,f[0].max)},d(f){f&&(k(e),k(l),k(s)),a=!1,u()}}}function aM(n){let e,t,i,l,s,o,r;return i=new fe({props:{class:"form-field",name:"fields."+n[1]+".min",$$slots:{default:[oM,({uniqueId:a})=>({10:a}),({uniqueId:a})=>a?1024:0]},$$scope:{ctx:n}}}),o=new fe({props:{class:"form-field",name:"fields."+n[1]+".max",$$slots:{default:[rM,({uniqueId:a})=>({10:a}),({uniqueId:a})=>a?1024:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),H(i.$$.fragment),l=C(),s
2024-09-30 00:23:19 +08:00
`),position:"top"})),c=!0)},p(g,_){var S,T;s&&Rt(s.update)&&_&20&&s.update.call(null,{text:[`Whether on ${((S=g[4])==null?void 0:S.name)||"relation"} record deletion to delete also the current corresponding collection record(s).`,g[2]?null:`For "Multiple" relation fields the cascade delete is triggered only when all ${((T=g[4])==null?void 0:T.name)||"relation"} ids are removed from the corresponding record.`].filter(Boolean).join(`
`),position:"top"}),(!f||_&16777216&&o!==(o=g[24]))&&p(e,"for",o);const y={};_&16777216&&(y.id=g[24]),!u&&_&1&&(u=!0,y.keyOfSelected=g[0].cascadeDelete,$e(()=>u=!1)),a.$set(y)},i(g){f||(O(a.$$.fragment,g),f=!0)},o(g){D(a.$$.fragment,g),f=!1},d(g){g&&(k(e),k(r)),q(a,g),c=!1,d()}}}function MM(n){let e,t,i,l,s,o=!n[2]&&sh(n);return l=new fe({props:{class:"form-field",name:"fields."+n[1]+".cascadeDelete",$$slots:{default:[EM,({uniqueId:r})=>({24:r}),({uniqueId:r})=>r?16777216:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),o&&o.c(),t=C(),i=b("div"),H(l.$$.fragment),p(i,"class","col-sm-12"),p(e,"class","grid grid-sm")},m(r,a){v(r,e,a),o&&o.m(e,null),w(e,t),w(e,i),F(l,i,null),s=!0},p(r,a){r[2]?o&&(re(),D(o,1,1,()=>{o=null}),ae()):o?(o.p(r,a),a&4&&O(o,1)):(o=sh(r),o.c(),O(o,1),o.m(e,t));const u={};a&2&&(u.name="fields."+r[1]+".cascadeDelete"),a&83886101&&(u.$$scope={dirty:a,ctx:r}),l.$set(u)},i(r){s||(O(o),O(l.$$.fragment,r),s=!0)},o(r){D(o),D(l.$$.fragment,r),s=!1},d(r){r&&k(e),o&&o.d(),q(l)}}}function DM(n){let e,t,i,l,s;const o=[{key:n[1]},n[8]];function r(f){n[17](f)}let a={$$slots:{options:[MM],default:[$M,({interactive:f})=>({25:f}),({interactive:f})=>f?33554432:0]},$$scope:{ctx:n}};for(let f=0;f<o.length;f+=1)a=je(a,o[f]);n[0]!==void 0&&(a.field=n[0]),e=new ei({props:a}),ie.push(()=>ve(e,"field",r)),e.$on("rename",n[18]),e.$on("remove",n[19]),e.$on("duplicate",n[20]);let u={};return l=new nf({props:u}),n[21](l),l.$on("save",n[22]),{c(){H(e.$$.fragment),i=C(),H(l.$$.fragment)},m(f,c){F(e,f,c),v(f,i,c),F(l,f,c),s=!0},p(f,[c]){const d=c&258?vt(o,[c&2&&{key:f[1]},c&256&&Ft(f[8])]):{};c&100663359&&(d.$$scope={dirty:c,ctx:f}),!t&&c&1&&(t=!0,d.field=f[0],$e(()=>t=!1)),e.$set(d);const m={};l.$set(m)},i(f){s||(O(e.$$.fragment,f),O(l.$$.fragment,f),s=!0)},o(f){D(e.$$.fragment,f),D(l.$$.fragment,f),s=!1},d(f){f&&k(i),q(e,f),n[21](null),q(l,f)}}}function IM(n,e,t){let i,l;const s=["field","key"];let o=lt(e,s),r;Qe(n,En,N=>t(10,r=N));let{field:a}=e,{key:u=""}=e;const f=[{label:"Single",value:!0},{label:"Multiple",value:!1}],c=[{label:"False",value:!1},{label:"True",value:!0}];let d=null,m=a.maxSelect<=1,h=m;function g(){t(0,a.maxSelect=1,a),t(0,a.collectionId=null,a),t(0,a.cascadeDelete=!1,a),t(2,m=!0),t(9,h=m)}const _=N=>t(0,a.minSelect=N.target.value<<0,a);function y(){a.maxSelect=_t(this.value),t(0,a),t(9,h),t(2,m)}function S(N){n.$$.not_equal(a.cascadeDelete,N)&&(a.cascadeDelete=N,t(0,a),t(9,h),t(2,m))}const T=()=>d==null?void 0:d.show();function $(N){n.$$.not_equal(a.collectionId,N)&&(a.collectionId=N,t(0,a),t(9,h),t(2,m))}function E(N){m=N,t(2,m)}function M(N){a=N,t(0,a),t(9,h),t(2,m)}function L(N){Pe.call(this,n,N)}function I(N){Pe.call(this,n,N)}function A(N){Pe.call(this,n,N)}function P(N){ie[N?"unshift":"push"](()=>{d=N,t(3,d)})}const R=N=>{var U,j;(j=(U=N==null?void 0:N.detail)==null?void 0:U.collection)!=null&&j.id&&N.detail.collection.type!="view"&&t(0,a.collectionId=N.detail.collection.id,a)};return n.$$set=N=>{e=je(je({},e),Ut(N)),t(8,o=lt(e,s)),"field"in N&&t(0,a=N.field),"key"in N&&t(1,u=N.key)},n.$$.update=()=>{n.$$.dirty&1024&&t(5,i=r.filter(N=>!N.system&&N.type!="view")),n.$$.dirty&516&&h!=m&&(t(9,h=m),m?(t(0,a.minSelect=0,a),t(0,a.maxSelect=1,a)):t(0,a.maxSelect=999,a)),n.$$.dirty&1&&typeof a.maxSelect>"u"&&g(),n.$$.dirty&1025&&t(4,l=r.find(N=>N.id==a.collectionId)||null)},[a,u,m,d,l,i,f,c,o,h,r,_,y,S,T,$,E,M,L,I,A,P,R]}class LM extends ye{constructor(e){super(),be(this,e,IM,DM,_e,{field:0,key:1})}}function AM(n){let e,t,i,l,s,o;function r(u){n[7](u)}let a={id:n[14],placeholder:"Choices: eg. optionA, optionB",required:!0,readonly:!n[15]};return n[0].values!==void 0&&(a.value=n[0].values),t=new _o({props:a}),ie.push(()=>ve(t,"value",r)),{c(){e=b("div"),H(t.$$.fragment)},m(u,f){v(u,e,f),F(t,e,null),l=!0,s||(o=Me(He.call(null,e,{text:"Choices (comma separated)",position:"top-left",delay:700})),s=!0)},p(u,f){const c={};f&16384&&(c.id=u[14]),f&32768&&(c.readonly=!u[15]),!i&&f&1&&(i=!0,c.value=u[0].values,$e(()=>i=!1)),t.$set(c)},i(u){l||(O(t.$$.fragment,u),l=!0)},o(u){D(t.$$.fragment,u),l=!1},d(u){u&&k(e),q(t),s=!1,o()}}}func
2024-09-30 00:23:19 +08:00
<br/>
If your query doesn&#39;t have a suitable one, you can use the universal
<code>(ROW_NUMBER() OVER()) as id</code>.</li> <li>Expressions must be aliased with a valid formatted field name, e.g.
<code>MAX(balance) as maxBalance</code>.</li> <li>Combined/multi-spaced expressions must be wrapped in parenthesis, e.g.
<code>(MAX(balance) + 1) as maxBalance</code>.</li></ul>`,u=C(),g&&g.c(),f=ge(),p(t,"class","txt"),p(e,"for",i=n[8]),p(a,"class","help-block")},m(_,y){v(_,e,y),w(e,t),v(_,l,y),m[s].m(_,y),v(_,r,y),v(_,a,y),v(_,u,y),g&&g.m(_,y),v(_,f,y),c=!0},p(_,y){(!c||y&256&&i!==(i=_[8]))&&p(e,"for",i);let S=s;s=h(_),s===S?m[s].p(_,y):(re(),D(m[S],1,1,()=>{m[S]=null}),ae(),o=m[s],o?o.p(_,y):(o=m[s]=d[s](_),o.c()),O(o,1),o.m(r.parentNode,r)),_[3].length?g?g.p(_,y):(g=fh(_),g.c(),g.m(f.parentNode,f)):g&&(g.d(1),g=null)},i(_){c||(O(o),c=!0)},o(_){D(o),c=!1},d(_){_&&(k(e),k(l),k(r),k(a),k(u),k(f)),m[s].d(_),g&&g.d(_)}}}function sD(n){let e,t;return e=new fe({props:{class:"form-field required "+(n[3].length?"error":""),name:"viewQuery",$$slots:{default:[lD,({uniqueId:i})=>({8:i}),({uniqueId:i})=>i?256:0]},$$scope:{ctx:n}}}),{c(){H(e.$$.fragment)},m(i,l){F(e,i,l),t=!0},p(i,[l]){const s={};l&8&&(s.class="form-field required "+(i[3].length?"error":"")),l&4367&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(O(e.$$.fragment,i),t=!0)},o(i){D(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function oD(n,e,t){let i;Qe(n,Sn,c=>t(4,i=c));let{collection:l}=e,s,o=!1,r=[];function a(c){t(3,r=[]);const d=z.getNestedVal(c,"fields",null);if(z.isEmpty(d))return;if(d!=null&&d.message){r.push(d==null?void 0:d.message);return}const m=z.extractColumnsFromQuery(l==null?void 0:l.viewQuery);z.removeByValue(m,"id"),z.removeByValue(m,"created"),z.removeByValue(m,"updated");for(let h in d)for(let g in d[h]){const _=d[h][g].message,y=m[h]||h;r.push(z.sentenize(y+": "+_))}}Yt(async()=>{t(2,o=!0);try{t(1,s=(await Ot(async()=>{const{default:c}=await import("./CodeEditor-ycRnVsci.js");return{default:c}},__vite__mapDeps([12,1]),import.meta.url)).default)}catch(c){console.warn(c)}t(2,o=!1)});function u(c){n.$$.not_equal(l.viewQuery,c)&&(l.viewQuery=c,t(0,l))}const f=()=>{r.length&&fi("fields")};return n.$$set=c=>{"collection"in c&&t(0,l=c.collection)},n.$$.update=()=>{n.$$.dirty&16&&a(i)},[l,s,o,r,i,u,f]}class rD extends ye{constructor(e){super(),be(this,e,oD,sD,_e,{collection:0})}}function dh(n,e,t){const i=n.slice();return i[15]=e[t],i}function ph(n){let e,t,i,l,s,o,r,a,u,f,c,d,m,h,g,_,y,S,T,$,E,M,L,I,A=pe(n[4]),P=[];for(let R=0;R<A.length;R+=1)P[R]=hh(dh(n,A,R));return{c(){e=b("div"),t=b("div"),i=b("div"),l=b("p"),l.textContent="The following record fields are available:",s=C(),o=b("div");for(let R=0;R<P.length;R+=1)P[R].c();r=C(),a=b("hr"),u=C(),f=b("p"),f.innerHTML="The request fields could be accessed with the special <em>@request</em> filter:",c=C(),d=b("div"),d.innerHTML="<code>@request.headers.*</code> <code>@request.query.*</code> <code>@request.body.*</code> <code>@request.auth.*</code>",m=C(),h=b("hr"),g=C(),_=b("p"),_.innerHTML=`You could also add constraints and query other collections using the
2024-09-30 00:23:19 +08:00
<em>@collection</em> filter:`,y=C(),S=b("div"),S.innerHTML="<code>@collection.ANY_COLLECTION_NAME.*</code>",T=C(),$=b("hr"),E=C(),M=b("p"),M.innerHTML=`Example rule:
<br/> <code>@request.auth.id != &quot;&quot; &amp;&amp; created &gt; &quot;2022-01-01 00:00:00&quot;</code>`,p(l,"class","m-b-0"),p(o,"class","inline-flex flex-gap-5"),p(a,"class","m-t-10 m-b-5"),p(f,"class","m-b-0"),p(d,"class","inline-flex flex-gap-5"),p(h,"class","m-t-10 m-b-5"),p(_,"class","m-b-0"),p(S,"class","inline-flex flex-gap-5"),p($,"class","m-t-10 m-b-5"),p(i,"class","content"),p(t,"class","alert alert-warning m-0")},m(R,N){v(R,e,N),w(e,t),w(t,i),w(i,l),w(i,s),w(i,o);for(let U=0;U<P.length;U+=1)P[U]&&P[U].m(o,null);w(i,r),w(i,a),w(i,u),w(i,f),w(i,c),w(i,d),w(i,m),w(i,h),w(i,g),w(i,_),w(i,y),w(i,S),w(i,T),w(i,$),w(i,E),w(i,M),I=!0},p(R,N){if(N&24){A=pe(R[4]);let U;for(U=0;U<A.length;U+=1){const j=dh(R,A,U);P[U]?P[U].p(j,N):(P[U]=hh(j),P[U].c(),P[U].m(o,null))}for(;U<P.length;U+=1)P[U].d(1);P.length=A.length}},i(R){I||(R&&nt(()=>{I&&(L||(L=ze(e,wt,{duration:150},!0)),L.run(1))}),I=!0)},o(R){R&&(L||(L=ze(e,wt,{duration:150},!1)),L.run(0)),I=!1},d(R){R&&k(e),pt(P,R),R&&L&&L.end()}}}function mh(n){let e,t=n[15]+"",i;return{c(){e=b("code"),i=Y(t)},m(l,s){v(l,e,s),w(e,i)},p(l,s){s&16&&t!==(t=l[15]+"")&&ue(i,t)},d(l){l&&k(e)}}}function hh(n){let e=!n[3].includes(n[15]),t,i=e&&mh(n);return{c(){i&&i.c(),t=ge()},m(l,s){i&&i.m(l,s),v(l,t,s)},p(l,s){s&24&&(e=!l[3].includes(l[15])),e?i?i.p(l,s):(i=mh(l),i.c(),i.m(t.parentNode,t)):i&&(i.d(1),i=null)},d(l){l&&k(t),i&&i.d(l)}}}function _h(n){let e,t,i,l,s,o,r,a,u;function f(_){n[8](_)}let c={label:"Create rule",formKey:"createRule",collection:n[0],$$slots:{afterLabel:[aD,({isSuperuserOnly:_})=>({14:_}),({isSuperuserOnly:_})=>_?16384:0]},$$scope:{ctx:n}};n[0].createRule!==void 0&&(c.rule=n[0].createRule),e=new tl({props:c}),ie.push(()=>ve(e,"rule",f));function d(_){n[9](_)}let m={label:"Update rule",formKey:"updateRule",collection:n[0]};n[0].updateRule!==void 0&&(m.rule=n[0].updateRule),l=new tl({props:m}),ie.push(()=>ve(l,"rule",d));function h(_){n[10](_)}let g={label:"Delete rule",formKey:"deleteRule",collection:n[0]};return n[0].deleteRule!==void 0&&(g.rule=n[0].deleteRule),r=new tl({props:g}),ie.push(()=>ve(r,"rule",h)),{c(){H(e.$$.fragment),i=C(),H(l.$$.fragment),o=C(),H(r.$$.fragment)},m(_,y){F(e,_,y),v(_,i,y),F(l,_,y),v(_,o,y),F(r,_,y),u=!0},p(_,y){const S={};y&1&&(S.collection=_[0]),y&278528&&(S.$$scope={dirty:y,ctx:_}),!t&&y&1&&(t=!0,S.rule=_[0].createRule,$e(()=>t=!1)),e.$set(S);const T={};y&1&&(T.collection=_[0]),!s&&y&1&&(s=!0,T.rule=_[0].updateRule,$e(()=>s=!1)),l.$set(T);const $={};y&1&&($.collection=_[0]),!a&&y&1&&(a=!0,$.rule=_[0].deleteRule,$e(()=>a=!1)),r.$set($)},i(_){u||(O(e.$$.fragment,_),O(l.$$.fragment,_),O(r.$$.fragment,_),u=!0)},o(_){D(e.$$.fragment,_),D(l.$$.fragment,_),D(r.$$.fragment,_),u=!1},d(_){_&&(k(i),k(o)),q(e,_),q(l,_),q(r,_)}}}function gh(n){let e,t,i;return{c(){e=b("i"),p(e,"class","ri-information-line link-hint")},m(l,s){v(l,e,s),t||(i=Me(He.call(null,e,{text:'The Create rule is executed after a "dry save" of the submitted data, giving you access to the main record fields as in every other rule.',position:"top"})),t=!0)},d(l){l&&k(e),t=!1,i()}}}function aD(n){let e,t=!n[14]&&gh();return{c(){t&&t.c(),e=ge()},m(i,l){t&&t.m(i,l),v(i,e,l)},p(i,l){i[14]?t&&(t.d(1),t=null):t||(t=gh(),t.c(),t.m(e.parentNode,e))},d(i){i&&k(e),t&&t.d(i)}}}function bh(n){let e,t,i,l,s,o,r,a,u,f,c;function d(_,y){return _[2]?fD:uD}let m=d(n),h=m(n),g=n[2]&&yh(n);return{c(){e=b("hr"),t=C(),i=b("button"),l=b("strong"),l.textContent="Additional auth collection rules",s=C(),h.c(),r=C(),g&&g.c(),a=ge(),p(l,"class","txt"),p(i,"type","button"),p(i,"class",o="btn btn-sm m-b-sm "+(n[2]?"btn-secondary":"btn-hint btn-transparent"))},m(_,y){v(_,e,y),v(_,t,y),v(_,i,y),w(i,l),w(i,s),h.m(i,null),v(_,r,y),g&&g.m(_,y),v(_,a,y),u=!0,f||(c=B(i,"click",n[11]),f=!0)},p(_,y){m!==(m=d(_))&&(h.d(1),h=m(_),h&&(h.c(),h.m(i,null))),(!u||y&4&&o!==(o="btn btn-sm m-b-sm "+(_[2]?"btn-secondary":"btn-hint btn-transparent")))&&p(i,"class",o),_[2]?g?(g.p(_,y),y&4&&O(g,1)):(g=yh(_),g.c(),O(g,1),g.m(a.parentNode,a)):g&&(re(),D(g,1,1,()=>{g=null}),ae())},i(_){u||(O(g),u=!0)},o(_
2024-09-30 00:23:19 +08:00
can authenticate.`,t=C(),i=b("p"),i.innerHTML=`For example, to allow only verified users you can set it to
<code>verified = true</code>.`,l=C(),s=b("p"),s.textContent="Leave it empty to allow anyone with an account to authenticate.",o=C(),r=b("p"),r.textContent='To disable authentication entirely you can change it to "Set superusers only".'},m(a,u){v(a,e,u),v(a,t,u),v(a,i,u),v(a,l,u),v(a,s,u),v(a,o,u),v(a,r,u)},p:te,d(a){a&&(k(e),k(t),k(i),k(l),k(s),k(o),k(r))}}}function dD(n){let e,t,i;return{c(){e=b("p"),e.innerHTML=`This rule is executed in addition to the <code>create</code> and <code>update</code> API
2024-09-30 00:23:19 +08:00
rules.`,t=C(),i=b("p"),i.textContent=`It enables superuser-like permissions to allow fully managing the auth record(s), eg.
changing the password without requiring to enter the old one, directly updating the
verified state or email, etc.`},m(l,s){v(l,e,s),v(l,t,s),v(l,i,s)},p:te,d(l){l&&(k(e),k(t),k(i))}}}function pD(n){var N,U;let e,t,i,l,s,o=n[1]?"Hide available fields":"Show available fields",r,a,u,f,c,d,m,h,g,_,y,S,T,$,E=n[1]&&ph(n);function M(j){n[6](j)}let L={label:"List/Search rule",formKey:"listRule",collection:n[0]};n[0].listRule!==void 0&&(L.rule=n[0].listRule),f=new tl({props:L}),ie.push(()=>ve(f,"rule",M));function I(j){n[7](j)}let A={label:"View rule",formKey:"viewRule",collection:n[0]};n[0].viewRule!==void 0&&(A.rule=n[0].viewRule),m=new tl({props:A}),ie.push(()=>ve(m,"rule",I));let P=((N=n[0])==null?void 0:N.type)!=="view"&&_h(n),R=((U=n[0])==null?void 0:U.type)==="auth"&&bh(n);return{c(){e=b("div"),t=b("div"),i=b("p"),i.innerHTML=`All rules follow the
2024-09-30 00:23:19 +08:00
<a href="https://pocketbase.io/docs/api-rules-and-filters/" target="_blank" rel="noopener noreferrer">PocketBase filter syntax and operators
</a>.`,l=C(),s=b("button"),r=Y(o),a=C(),E&&E.c(),u=C(),H(f.$$.fragment),d=C(),H(m.$$.fragment),g=C(),P&&P.c(),_=C(),R&&R.c(),y=ge(),p(s,"type","button"),p(s,"class","expand-handle txt-sm txt-bold txt-nowrap link-hint"),p(t,"class","flex txt-sm txt-hint m-b-5"),p(e,"class","block m-b-sm handle")},m(j,V){v(j,e,V),w(e,t),w(t,i),w(t,l),w(t,s),w(s,r),w(e,a),E&&E.m(e,null),v(j,u,V),F(f,j,V),v(j,d,V),F(m,j,V),v(j,g,V),P&&P.m(j,V),v(j,_,V),R&&R.m(j,V),v(j,y,V),S=!0,T||($=B(s,"click",n[5]),T=!0)},p(j,[V]){var ee,X;(!S||V&2)&&o!==(o=j[1]?"Hide available fields":"Show available fields")&&ue(r,o),j[1]?E?(E.p(j,V),V&2&&O(E,1)):(E=ph(j),E.c(),O(E,1),E.m(e,null)):E&&(re(),D(E,1,1,()=>{E=null}),ae());const K={};V&1&&(K.collection=j[0]),!c&&V&1&&(c=!0,K.rule=j[0].listRule,$e(()=>c=!1)),f.$set(K);const J={};V&1&&(J.collection=j[0]),!h&&V&1&&(h=!0,J.rule=j[0].viewRule,$e(()=>h=!1)),m.$set(J),((ee=j[0])==null?void 0:ee.type)!=="view"?P?(P.p(j,V),V&1&&O(P,1)):(P=_h(j),P.c(),O(P,1),P.m(_.parentNode,_)):P&&(re(),D(P,1,1,()=>{P=null}),ae()),((X=j[0])==null?void 0:X.type)==="auth"?R?(R.p(j,V),V&1&&O(R,1)):(R=bh(j),R.c(),O(R,1),R.m(y.parentNode,y)):R&&(re(),D(R,1,1,()=>{R=null}),ae())},i(j){S||(O(E),O(f.$$.fragment,j),O(m.$$.fragment,j),O(P),O(R),S=!0)},o(j){D(E),D(f.$$.fragment,j),D(m.$$.fragment,j),D(P),D(R),S=!1},d(j){j&&(k(e),k(u),k(d),k(g),k(_),k(y)),E&&E.d(),q(f,j),q(m,j),P&&P.d(j),R&&R.d(j),T=!1,$()}}}function mD(n,e,t){let i,l,{collection:s}=e,o=!1,r=s.manageRule!==null||s.authRule!=="";const a=()=>t(1,o=!o);function u(y){n.$$.not_equal(s.listRule,y)&&(s.listRule=y,t(0,s))}function f(y){n.$$.not_equal(s.viewRule,y)&&(s.viewRule=y,t(0,s))}function c(y){n.$$.not_equal(s.createRule,y)&&(s.createRule=y,t(0,s))}function d(y){n.$$.not_equal(s.updateRule,y)&&(s.updateRule=y,t(0,s))}function m(y){n.$$.not_equal(s.deleteRule,y)&&(s.deleteRule=y,t(0,s))}const h=()=>{t(2,r=!r)};function g(y){n.$$.not_equal(s.authRule,y)&&(s.authRule=y,t(0,s))}function _(y){n.$$.not_equal(s.manageRule,y)&&(s.manageRule=y,t(0,s))}return n.$$set=y=>{"collection"in y&&t(0,s=y.collection)},n.$$.update=()=>{var y;n.$$.dirty&1&&t(4,i=z.getAllCollectionIdentifiers(s)),n.$$.dirty&1&&t(3,l=(y=s.fields)==null?void 0:y.filter(S=>S.hidden).map(S=>S.name))},[s,o,r,l,i,a,u,f,c,d,m,h,g,_]}class hD extends ye{constructor(e){super(),be(this,e,mD,pD,_e,{collection:0})}}function kh(n,e,t){const i=n.slice();return i[19]=e[t],i}function vh(n,e,t){const i=n.slice();return i[19]=e[t],i}function wh(n,e,t){const i=n.slice();return i[19]=e[t],i}function Sh(n){let e;return{c(){e=b("p"),e.textContent="All data associated with the removed fields will be permanently deleted!"},m(t,i){v(t,e,i)},d(t){t&&k(e)}}}function Th(n){let e,t,i,l,s=n[3]&&$h(n),o=!n[4]&&Ch(n);return{c(){e=b("h6"),e.textContent="Changes:",t=C(),i=b("ul"),s&&s.c(),l=C(),o&&o.c(),p(i,"class","changes-list svelte-xqpcsf")},m(r,a){v(r,e,a),v(r,t,a),v(r,i,a),s&&s.m(i,null),w(i,l),o&&o.m(i,null)},p(r,a){r[3]?s?s.p(r,a):(s=$h(r),s.c(),s.m(i,l)):s&&(s.d(1),s=null),r[4]?o&&(o.d(1),o=null):o?o.p(r,a):(o=Ch(r),o.c(),o.m(i,null))},d(r){r&&(k(e),k(t),k(i)),s&&s.d(),o&&o.d()}}}function $h(n){var m,h;let e,t,i,l,s=((m=n[1])==null?void 0:m.name)+"",o,r,a,u,f,c=((h=n[2])==null?void 0:h.name)+"",d;return{c(){e=b("li"),t=b("div"),i=Y(`Renamed collection
2024-09-30 00:23:19 +08:00
`),l=b("strong"),o=Y(s),r=C(),a=b("i"),u=C(),f=b("strong"),d=Y(c),p(l,"class","txt-strikethrough txt-hint"),p(a,"class","ri-arrow-right-line txt-sm"),p(f,"class","txt"),p(t,"class","inline-flex"),p(e,"class","svelte-xqpcsf")},m(g,_){v(g,e,_),w(e,t),w(t,i),w(t,l),w(l,o),w(t,r),w(t,a),w(t,u),w(t,f),w(f,d)},p(g,_){var y,S;_&2&&s!==(s=((y=g[1])==null?void 0:y.name)+"")&&ue(o,s),_&4&&c!==(c=((S=g[2])==null?void 0:S.name)+"")&&ue(d,c)},d(g){g&&k(e)}}}function Ch(n){let e,t,i,l=pe(n[6]),s=[];for(let f=0;f<l.length;f+=1)s[f]=Oh(wh(n,l,f));let o=pe(n[8]),r=[];for(let f=0;f<o.length;f+=1)r[f]=Eh(vh(n,o,f));let a=pe(n[7]),u=[];for(let f=0;f<a.length;f+=1)u[f]=Mh(kh(n,a,f));return{c(){for(let f=0;f<s.length;f+=1)s[f].c();e=C();for(let f=0;f<r.length;f+=1)r[f].c();t=C();for(let f=0;f<u.length;f+=1)u[f].c();i=ge()},m(f,c){for(let d=0;d<s.length;d+=1)s[d]&&s[d].m(f,c);v(f,e,c);for(let d=0;d<r.length;d+=1)r[d]&&r[d].m(f,c);v(f,t,c);for(let d=0;d<u.length;d+=1)u[d]&&u[d].m(f,c);v(f,i,c)},p(f,c){if(c&64){l=pe(f[6]);let d;for(d=0;d<l.length;d+=1){const m=wh(f,l,d);s[d]?s[d].p(m,c):(s[d]=Oh(m),s[d].c(),s[d].m(e.parentNode,e))}for(;d<s.length;d+=1)s[d].d(1);s.length=l.length}if(c&256){o=pe(f[8]);let d;for(d=0;d<o.length;d+=1){const m=vh(f,o,d);r[d]?r[d].p(m,c):(r[d]=Eh(m),r[d].c(),r[d].m(t.parentNode,t))}for(;d<r.length;d+=1)r[d].d(1);r.length=o.length}if(c&128){a=pe(f[7]);let d;for(d=0;d<a.length;d+=1){const m=kh(f,a,d);u[d]?u[d].p(m,c):(u[d]=Mh(m),u[d].c(),u[d].m(i.parentNode,i))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},d(f){f&&(k(e),k(t),k(i)),pt(s,f),pt(r,f),pt(u,f)}}}function Oh(n){let e,t,i,l=n[19].name+"",s,o,r;return{c(){e=b("li"),t=Y(`Multiple to single value conversion of field
`),i=b("strong"),s=Y(l),o=C(),r=b("em"),r.textContent="(will keep only the last array item)",p(r,"class","txt-sm"),p(e,"class","svelte-xqpcsf")},m(a,u){v(a,e,u),w(e,t),w(e,i),w(i,s),w(e,o),w(e,r)},p(a,u){u&64&&l!==(l=a[19].name+"")&&ue(s,l)},d(a){a&&k(e)}}}function Eh(n){let e,t,i,l,s=n[19]._originalName+"",o,r,a,u,f,c=n[19].name+"",d;return{c(){e=b("li"),t=b("div"),i=Y(`Renamed field
`),l=b("strong"),o=Y(s),r=C(),a=b("i"),u=C(),f=b("strong"),d=Y(c),p(l,"class","txt-strikethrough txt-hint"),p(a,"class","ri-arrow-right-line txt-sm"),p(f,"class","txt"),p(t,"class","inline-flex"),p(e,"class","svelte-xqpcsf")},m(m,h){v(m,e,h),w(e,t),w(t,i),w(t,l),w(l,o),w(t,r),w(t,a),w(t,u),w(t,f),w(f,d)},p(m,h){h&256&&s!==(s=m[19]._originalName+"")&&ue(o,s),h&256&&c!==(c=m[19].name+"")&&ue(d,c)},d(m){m&&k(e)}}}function Mh(n){let e,t,i,l=n[19].name+"",s,o;return{c(){e=b("li"),t=Y("Removed field "),i=b("span"),s=Y(l),o=C(),p(i,"class","txt-bold"),p(e,"class","txt-danger svelte-xqpcsf")},m(r,a){v(r,e,a),w(e,t),w(e,i),w(i,s),w(e,o)},p(r,a){a&128&&l!==(l=r[19].name+"")&&ue(s,l)},d(r){r&&k(e)}}}function _D(n){let e,t,i,l,s,o,r,a,u=n[7].length&&Sh(),f=n[9]&&Th(n);return{c(){e=b("div"),t=b("div"),t.innerHTML='<i class="ri-error-warning-line"></i>',i=C(),l=b("div"),s=b("p"),s.textContent=`If any of the collection changes is part of another collection rule, filter or view query,
you'll have to update it manually!`,o=C(),u&&u.c(),r=C(),f&&f.c(),a=ge(),p(t,"class","icon"),p(l,"class","content txt-bold"),p(e,"class","alert alert-warning")},m(c,d){v(c,e,d),w(e,t),w(e,i),w(e,l),w(l,s),w(l,o),u&&u.m(l,null),v(c,r,d),f&&f.m(c,d),v(c,a,d)},p(c,d){c[7].length?u||(u=Sh(),u.c(),u.m(l,null)):u&&(u.d(1),u=null),c[9]?f?f.p(c,d):(f=Th(c),f.c(),f.m(a.parentNode,a)):f&&(f.d(1),f=null)},d(c){c&&(k(e),k(r),k(a)),u&&u.d(),f&&f.d(c)}}}function gD(n){let e;return{c(){e=b("h4"),e.textContent="Confirm collection changes"},m(t,i){v(t,e,i)},p:te,d(t){t&&k(e)}}}function bD(n){let e,t,i,l,s;return{c(){e=b("button"),e.innerHTML='<span class="txt">Cancel</span>',t=C(),i=b("button"),i.innerHTML='<span class="txt">Confirm</span>',e.autofocus=!0,p(e,"type","button"),p(e,"class","btn btn-transparent"),p(i,"type","button"),p(i,"class","btn btn-expanded")},m(o,r){v(o,e,r),v(o,t,r),v(o,i,r),e.focus(),l||(s=[B(e,"click",n[12]),B(i,"click",n[13])],l=!0)},p:te,d(o){o&&(k(e),k(t),k(i)),l=!1,De(s)}}}function yD(n){let e,t,i={class:"confirm-changes-panel",popup:!0,$$slots:{footer:[bD],header:[gD],default:[_D]},$$scope:{ctx:n}};return e=new ln({props:i}),n[14](e),e.$on("hide",n[15]),e.$on("show",n[16]),{c(){H(e.$$.fragment)},m(l,s){F(e,l,s),t=!0},p(l,[s]){const o={};s&67109854&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(O(e.$$.fragment,l),t=!0)},o(l){D(e.$$.fragment,l),t=!1},d(l){n[14](null),q(e,l)}}}function kD(n,e,t){let i,l,s,o,r,a;const u=gt();let f,c,d,m;async function h(M,L,I=!0){t(1,c=M),t(2,d=L),m=I,await fn(),i||s.length||o.length||r.length?f==null||f.show():_()}function g(){f==null||f.hide()}function _(){g(),u("confirm",m)}const y=()=>g(),S=()=>_();function T(M){ie[M?"unshift":"push"](()=>{f=M,t(5,f)})}function $(M){Pe.call(this,n,M)}function E(M){Pe.call(this,n,M)}return n.$$.update=()=>{var M,L,I;n.$$.dirty&6&&t(3,i=(c==null?void 0:c.name)!=(d==null?void 0:d.name)),n.$$.dirty&4&&t(4,l=(d==null?void 0:d.type)==="view"),n.$$.dirty&4&&t(8,s=((M=d==null?void 0:d.fields)==null?void 0:M.filter(A=>A.id&&!A._toDelete&&A._originalName!=A.name))||[]),n.$$.dirty&4&&t(7,o=((L=d==null?void 0:d.fields)==null?void 0:L.filter(A=>A.id&&A._toDelete))||[]),n.$$.dirty&6&&t(6,r=((I=d==null?void 0:d.fields)==null?void 0:I.filter(A=>{var R;const P=(R=c==null?void 0:c.fields)==null?void 0:R.find(N=>N.id==A.id);return P?P.maxSelect!=1&&A.maxSelect==1:!1}))||[]),n.$$.dirty&24&&t(9,a=!l||i)},[g,c,d,i,l,f,r,o,s,a,_,h,y,S,T,$,E]}class vD extends ye{constructor(e){super(),be(this,e,kD,yD,_e,{show:11,hide:0})}get show(){return this.$$.ctx[11]}get hide(){return this.$$.ctx[0]}}function Dh(n,e,t){const i=n.slice();return i[58]=e[t][0],i[59]=e[t][1],i}function wD(n){let e,t,i;function l(o){n[43](o)}let s={};return n[2]!==void 0&&(s.collection=n[2]),e=new tD({props:s}),ie.push(()=>ve(e,"collection",l)),{c(){H(e.$$.fragment)},m(o,r){F(e,o,r),i=!0},p(o,r){const a={};!t&&r[0]&4&&(t=!0,a.collection=o[2],$e(()=>t=!1)),e.$set(a)},i(o){i||(O(e.$$.fragment,o),i=!0)},o(o){D(e.$$.fragment,o),i=!1},d(o){q(e,o)}}}function SD(n){let e,t,i;function l(o){n[42](o)}let s={};return n[2]!==void 0&&(s.collection=n[2]),e=new rD({props:s}),ie.push(()=>ve(e,"collection",l)),{c(){H(e.$$.fragment)},m(o,r){F(e,o,r),i=!0},p(o,r){const a={};!t&&r[0]&4&&(t=!0,a.collection=o[2],$e(()=>t=!1)),e.$set(a)},i(o){i||(O(e.$$.fragment,o),i=!0)},o(o){D(e.$$.fragment,o),i=!1},d(o){q(e,o)}}}function Ih(n){let e,t,i,l;function s(r){n[44](r)}let o={};return n[2]!==void 0&&(o.collection=n[2]),t=new hD({props:o}),ie.push(()=>ve(t,"collection",s)),{c(){e=b("div"),H(t.$$.fragment),p(e,"class","tab-item active")},m(r,a){v(r,e,a),F(t,e,null),l=!0},p(r,a){const u={};!i&&a[0]&4&&(i=!0,u.collection=r[2],$e(()=>i=!1)),t.$set(u)},i(r){l||(O(t.$$.fragment,r),l=!0)},o(r){D(t.$$.fragment,r),l=!1},d(r){r&&k(e),q(t)}}}function Lh(n){let e,t,i,l;function s(r){n[45](r)}let o={};return n[2]!==void 0&&(o.collection=n[2]),t=new kO({props:o}),ie.push(()=>ve(t,"collection",s)),{c(){e=b("div"),H(t.$$.fragment),p(e,"class","tab-item"),Q(e,"active",n[3]===ss)},m(r,a){v(r,e,a),F(t,e,null),l=!0},p(r,a){const
`+z.truncate(JSON.stringify(z.truncateObject(y_(n[0],"expand")),null,2),800,!0),class:"code",position:"left"})),B(l,"click",On(n[1])),B(l,"keydown",On(n[2]))],u=!0)},p(c,[d]){const m={};d&1&&(m.record=c[0]),t.$set(m),(!a||d&1&&o!==(o="#/collections?collectionId="+c[0].collectionId+"&recordId="+c[0].id))&&p(l,"href",o),r&&Rt(r.update)&&d&1&&r.update.call(null,{text:`Open relation record in new tab:
`+z.truncate(JSON.stringify(z.truncateObject(y_(c[0],"expand")),null,2),800,!0),class:"code",position:"left"})},i(c){a||(O(t.$$.fragment,c),a=!0)},o(c){D(t.$$.fragment,c),a=!1},d(c){c&&k(e),q(t),u=!1,De(f)}}}function y_(n,...e){const t=Object.assign({},n);for(let i of e)delete t[i];return t}function yI(n,e,t){let{record:i}=e;function l(o){Pe.call(this,n,o)}function s(o){Pe.call(this,n,o)}return n.$$set=o=>{"record"in o&&t(0,i=o.record)},[i,l,s]}class Ur extends ye{constructor(e){super(),be(this,e,yI,bI,_e,{record:0})}}function k_(n,e,t){const i=n.slice();return i[19]=e[t],i[9]=t,i}function v_(n,e,t){const i=n.slice();return i[14]=e[t],i}function w_(n,e,t){const i=n.slice();return i[7]=e[t],i[9]=t,i}function S_(n,e,t){const i=n.slice();return i[7]=e[t],i[9]=t,i}function kI(n){const e=n.slice(),t=z.toArray(e[3]);e[17]=t;const i=e[2]?10:500;return e[18]=i,e}function vI(n){var s,o;const e=n.slice(),t=z.toArray(e[3]);e[10]=t;const i=z.toArray((o=(s=e[0])==null?void 0:s.expand)==null?void 0:o[e[1].name]);e[11]=i;const l=e[2]?20:500;return e[12]=l,e}function wI(n){const e=n.slice(),t=z.trimQuotedValue(JSON.stringify(e[3]))||'""';return e[6]=t,e}function SI(n){let e,t;return{c(){e=b("div"),t=Y(n[3]),p(e,"class","block txt-break fallback-block svelte-jdf51v")},m(i,l){v(i,e,l),w(e,t)},p(i,l){l&8&&ue(t,i[3])},i:te,o:te,d(i){i&&k(e)}}}function TI(n){let e,t=z.truncate(n[3])+"",i,l;return{c(){e=b("span"),i=Y(t),p(e,"class","txt txt-ellipsis"),p(e,"title",l=z.truncate(n[3]))},m(s,o){v(s,e,o),w(e,i)},p(s,o){o&8&&t!==(t=z.truncate(s[3])+"")&&ue(i,t),o&8&&l!==(l=z.truncate(s[3]))&&p(e,"title",l)},i:te,o:te,d(s){s&&k(e)}}}function $I(n){let e,t=[],i=new Map,l,s,o=pe(n[17].slice(0,n[18]));const r=u=>u[9]+u[19];for(let u=0;u<o.length;u+=1){let f=k_(n,o,u),c=r(f);i.set(c,t[u]=T_(c,f))}let a=n[17].length>n[18]&&$_();return{c(){e=b("div");for(let u=0;u<t.length;u+=1)t[u].c();l=C(),a&&a.c(),p(e,"class","inline-flex"),Q(e,"multiple",n[1].maxSelect!=1)},m(u,f){v(u,e,f);for(let c=0;c<t.length;c+=1)t[c]&&t[c].m(e,null);w(e,l),a&&a.m(e,null),s=!0},p(u,f){f&13&&(o=pe(u[17].slice(0,u[18])),re(),t=kt(t,f,r,1,u,o,i,e,zt,T_,l,k_),ae()),u[17].length>u[18]?a||(a=$_(),a.c(),a.m(e,null)):a&&(a.d(1),a=null),(!s||f&2)&&Q(e,"multiple",u[1].maxSelect!=1)},i(u){if(!s){for(let f=0;f<o.length;f+=1)O(t[f]);s=!0}},o(u){for(let f=0;f<t.length;f+=1)D(t[f]);s=!1},d(u){u&&k(e);for(let f=0;f<t.length;f+=1)t[f].d();a&&a.d()}}}function CI(n){let e,t,i,l,s;const o=[FI,RI],r=[];function a(f,c){return f[11].length?0:1}t=a(n),i=r[t]=o[t](n);let u=n[10].length>n[12]&&E_();return{c(){e=b("div"),i.c(),l=C(),u&&u.c(),p(e,"class","inline-flex")},m(f,c){v(f,e,c),r[t].m(e,null),w(e,l),u&&u.m(e,null),s=!0},p(f,c){let d=t;t=a(f),t===d?r[t].p(f,c):(re(),D(r[d],1,1,()=>{r[d]=null}),ae(),i=r[t],i?i.p(f,c):(i=r[t]=o[t](f),i.c()),O(i,1),i.m(e,l)),f[10].length>f[12]?u||(u=E_(),u.c(),u.m(e,null)):u&&(u.d(1),u=null)},i(f){s||(O(i),s=!0)},o(f){D(i),s=!1},d(f){f&&k(e),r[t].d(),u&&u.d()}}}function OI(n){let e,t=[],i=new Map,l=pe(z.toArray(n[3]));const s=o=>o[9]+o[7];for(let o=0;o<l.length;o+=1){let r=S_(n,l,o),a=s(r);i.set(a,t[o]=M_(a,r))}return{c(){e=b("div");for(let o=0;o<t.length;o+=1)t[o].c();p(e,"class","inline-flex")},m(o,r){v(o,e,r);for(let a=0;a<t.length;a+=1)t[a]&&t[a].m(e,null)},p(o,r){r&8&&(l=pe(z.toArray(o[3])),t=kt(t,r,s,1,o,l,i,e,ci,M_,null,S_))},i:te,o:te,d(o){o&&k(e);for(let r=0;r<t.length;r+=1)t[r].d()}}}function EI(n){let e,t;return e=new sf({props:{date:n[3]}}),{c(){H(e.$$.fragment)},m(i,l){F(e,i,l),t=!0},p(i,l){const s={};l&8&&(s.date=i[3]),e.$set(s)},i(i){t||(O(e.$$.fragment,i),t=!0)},o(i){D(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function MI(n){let e,t,i,l;const s=[HI,qI],o=[];function r(a,u){return a[2]?0:1}return e=r(n),t=o[e]=s[e](n),{c(){t.c(),i=ge()},m(a,u){o[e].m(a,u),v(a,i,u),l=!0},p(a,u){let f=e;e=r(a),e===f?o[e].p(a,u):(re(),D(o[f],1,1,()=>{o[f]=null}),ae(),t=o[e],t?t.p(a,u):(t=o[e]=s[e](a),t.c()),O(t,1),t.m(i.parentNode,i))},i(a){l||(O(t),l=!0)},o(a){D(t),l=!1},d(a){a&&k(i),o[e].d(a)}}}function DI(n){let e,t=z.truncate(n[3])+"",i,l,s;return{c(){e=b("a"),i=Y(t),p(e,"cl
2024-09-30 00:23:19 +08:00
`),position:"left"})),i=!0)},p(s,[o]){t&&Rt(t.update)&&o&1&&t.update.call(null,{text:s[0].join(`
`),position:"left"})},i:te,o:te,d(s){s&&k(e),i=!1,l()}}}const XI="yyyy-MM-dd HH:mm:ss.SSS";function QI(n,e,t){let i,l;Qe(n,En,a=>t(2,l=a));let{record:s}=e,o=[];function r(){t(0,o=[]);const a=i.fields||[];for(let u of a)u.type=="autodate"&&o.push(u.name+": "+z.formatToLocalDate(s[u.name],XI)+" Local")}return n.$$set=a=>{"record"in a&&t(1,s=a.record)},n.$$.update=()=>{n.$$.dirty&6&&(i=s&&l.find(a=>a.id==s.collectionId)),n.$$.dirty&2&&s&&r()},[o,s,l]}class xI extends ye{constructor(e){super(),be(this,e,QI,GI,_e,{record:1})}}function R_(n,e,t){const i=n.slice();return i[9]=e[t],i}function eL(n){let e;return{c(){e=b("h6"),e.textContent="No linked OAuth2 providers.",p(e,"class","txt-hint txt-center m-t-sm m-b-sm")},m(t,i){v(t,e,i)},p:te,d(t){t&&k(e)}}}function tL(n){let e,t=pe(n[1]),i=[];for(let l=0;l<t.length;l+=1)i[l]=F_(R_(n,t,l));return{c(){e=b("div");for(let l=0;l<i.length;l+=1)i[l].c();p(e,"class","list")},m(l,s){v(l,e,s);for(let o=0;o<i.length;o+=1)i[o]&&i[o].m(e,null)},p(l,s){if(s&58){t=pe(l[1]);let o;for(o=0;o<t.length;o+=1){const r=R_(l,t,o);i[o]?i[o].p(r,s):(i[o]=F_(r),i[o].c(),i[o].m(e,null))}for(;o<i.length;o+=1)i[o].d(1);i.length=t.length}},d(l){l&&k(e),pt(i,l)}}}function nL(n){let e;return{c(){e=b("div"),e.innerHTML='<span class="loader"></span>',p(e,"class","block txt-center")},m(t,i){v(t,e,i)},p:te,d(t){t&&k(e)}}}function F_(n){let e,t,i,l,s,o,r=n[4](n[9].provider)+"",a,u,f,c,d=n[9].providerId+"",m,h,g,_,y,S;function T(){return n[6](n[9])}return{c(){var $;e=b("div"),t=b("figure"),i=b("img"),s=C(),o=b("span"),a=Y(r),u=C(),f=b("div"),c=Y("ID: "),m=Y(d),h=C(),g=b("button"),g.innerHTML='<i class="ri-close-line"></i>',_=C(),vn(i.src,l="./images/oauth2/"+(($=n[3](n[9].provider))==null?void 0:$.logo))||p(i,"src",l),p(i,"alt","Provider logo"),p(t,"class","provider-logo"),p(o,"class","txt"),p(f,"class","txt-hint"),p(g,"type","button"),p(g,"class","btn btn-transparent link-hint btn-circle btn-sm m-l-auto"),p(e,"class","list-item")},m($,E){v($,e,E),w(e,t),w(t,i),w(e,s),w(e,o),w(o,a),w(e,u),w(e,f),w(f,c),w(f,m),w(e,h),w(e,g),w(e,_),y||(S=B(g,"click",T),y=!0)},p($,E){var M;n=$,E&2&&!vn(i.src,l="./images/oauth2/"+((M=n[3](n[9].provider))==null?void 0:M.logo))&&p(i,"src",l),E&2&&r!==(r=n[4](n[9].provider)+"")&&ue(a,r),E&2&&d!==(d=n[9].providerId+"")&&ue(m,d)},d($){$&&k(e),y=!1,S()}}}function iL(n){let e;function t(s,o){var r;return s[2]?nL:(r=s[0])!=null&&r.id&&s[1].length?tL:eL}let i=t(n),l=i(n);return{c(){l.c(),e=ge()},m(s,o){l.m(s,o),v(s,e,o)},p(s,[o]){i===(i=t(s))&&l?l.p(s,o):(l.d(1),l=i(s),l&&(l.c(),l.m(e.parentNode,e)))},i:te,o:te,d(s){s&&k(e),l.d(s)}}}function lL(n,e,t){const i=gt();let{record:l}=e,s=[],o=!1;function r(d){return ef.find(m=>m.key==d+"Auth")||{}}function a(d){var m;return((m=r(d))==null?void 0:m.title)||z.sentenize(d,!1)}async function u(){if(!(l!=null&&l.id)){t(1,s=[]),t(2,o=!1);return}t(2,o=!0);try{t(1,s=await me.collection("_externalAuths").getFullList({filter:me.filter("collectionRef = {:collectionId} && recordRef = {:recordId}",{collectionId:l.collectionId,recordId:l.id})}))}catch(d){me.error(d)}t(2,o=!1)}function f(d){!(l!=null&&l.id)||!d||pn(`Do you really want to unlink the ${a(d.provider)} provider?`,()=>me.collection("_externalAuths").delete(d.id).then(()=>{tn(`Successfully unlinked the ${a(d.provider)} provider.`),i("unlink",d.provider),u()}).catch(m=>{me.error(m)}))}u();const c=d=>f(d);return n.$$set=d=>{"record"in d&&t(0,l=d.record)},[l,s,o,r,a,f,c]}class sL extends ye{constructor(e){super(),be(this,e,lL,iL,_e,{record:0})}}function oL(n){let e,t,i,l,s,o,r,a,u,f;return s=new ai({props:{value:n[1]}}),{c(){e=b("div"),t=b("span"),i=Y(n[1]),l=C(),H(s.$$.fragment),o=C(),r=b("i"),p(t,"class","secret svelte-1md8247"),p(r,"class","ri-refresh-line txt-sm link-hint"),p(r,"aria-label","Refresh"),p(e,"class","flex flex-gap-5 p-5")},m(c,d){v(c,e,d),w(e,t),w(t,i),n[6](t),w(e,l),F(s,e,null),w(e,o),w(e,r),a=!0,u||(f=[Me(He.call(null,r,"Refresh")),B(r,"click",n[4])],u=!0)},p(c,d){(!a||d&2)&&ue(i,c[1]);const m={};d&2&&(m.value=c[1]),s.$set(m)},i(c){a||(O(s.$$.fragment,c),a=!0)},o(c){D(s.$$.fragment,c),a=!1},
2024-09-30 00:23:19 +08:00
(record: `+n[44].id+")")),B(e,"click",tt(function(){Rt(n[20](n[44],n[48]))&&n[20](n[44],n[48]).apply(this,arguments)}))],s=!0)},p(f,c){n=f,a===(a=r(n,c))&&u?u.p(n,c):(u.d(1),u=a(n),u&&(u.c(),u.m(e,i))),l&&Rt(l.update)&&c[0]&32&&l.update.call(null,n[48]+`
(record: `+n[44].id+")"),c[0]&589856&&Q(e,"thumb-warning",n[16](n[44],n[48]))},d(f){f&&k(e),u.d(),s=!1,De(o)}}}function X_(n,e){let t,i,l=pe(e[45]),s=[];for(let o=0;o<l.length;o+=1)s[o]=G_(Y_(e,l,o));return{key:n,first:null,c(){t=ge();for(let o=0;o<s.length;o+=1)s[o].c();i=ge(),this.first=t},m(o,r){v(o,t,r);for(let a=0;a<s.length;a+=1)s[a]&&s[a].m(o,r);v(o,i,r)},p(o,r){if(e=o,r[0]&1638432){l=pe(e[45]);let a;for(a=0;a<l.length;a+=1){const u=Y_(e,l,a);s[a]?s[a].p(u,r):(s[a]=G_(u),s[a].c(),s[a].m(i.parentNode,i))}for(;a<s.length;a+=1)s[a].d(1);s.length=l.length}},d(o){o&&(k(t),k(i)),pt(s,o)}}}function Q_(n){let e;return{c(){e=b("div"),e.innerHTML='<span class="loader loader-sm active"></span>',p(e,"class","block txt-center")},m(t,i){v(t,e,i)},d(t){t&&k(e)}}}function RL(n){let e,t;function i(r,a){if(r[15])return AL;if(!r[6])return LL}let l=i(n),s=l&&l(n),o=n[6]&&Q_();return{c(){s&&s.c(),e=C(),o&&o.c(),t=ge()},m(r,a){s&&s.m(r,a),v(r,e,a),o&&o.m(r,a),v(r,t,a)},p(r,a){l===(l=i(r))&&s?s.p(r,a):(s&&s.d(1),s=l&&l(r),s&&(s.c(),s.m(e.parentNode,e))),r[6]?o||(o=Q_(),o.c(),o.m(t.parentNode,t)):o&&(o.d(1),o=null)},d(r){r&&(k(e),k(t)),s&&s.d(r),o&&o.d(r)}}}function FL(n){let e,t,i,l;const s=[IL,DL],o=[];function r(a,u){return a[7].length?1:0}return e=r(n),t=o[e]=s[e](n),{c(){t.c(),i=ge()},m(a,u){o[e].m(a,u),v(a,i,u),l=!0},p(a,u){let f=e;e=r(a),e===f?o[e].p(a,u):(re(),D(o[f],1,1,()=>{o[f]=null}),ae(),t=o[e],t?t.p(a,u):(t=o[e]=s[e](a),t.c()),O(t,1),t.m(i.parentNode,i))},i(a){l||(O(t),l=!0)},o(a){D(t),l=!1},d(a){a&&k(i),o[e].d(a)}}}function qL(n){let e,t;return{c(){e=b("h4"),t=Y(n[0])},m(i,l){v(i,e,l),w(e,t)},p(i,l){l[0]&1&&ue(t,i[0])},d(i){i&&k(e)}}}function x_(n){let e,t;return e=new fe({props:{class:"form-field file-picker-size-select",$$slots:{default:[HL,({uniqueId:i})=>({23:i}),({uniqueId:i})=>[i?8388608:0]]},$$scope:{ctx:n}}}),{c(){H(e.$$.fragment)},m(i,l){F(e,i,l),t=!0},p(i,l){const s={};l[0]&8402944|l[1]&8388608&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(O(e.$$.fragment,i),t=!0)},o(i){D(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function HL(n){let e,t,i;function l(o){n[28](o)}let s={upside:!0,id:n[23],items:n[11],disabled:!n[13],selectPlaceholder:"Select size"};return n[12]!==void 0&&(s.keyOfSelected=n[12]),e=new xn({props:s}),ie.push(()=>ve(e,"keyOfSelected",l)),{c(){H(e.$$.fragment)},m(o,r){F(e,o,r),i=!0},p(o,r){const a={};r[0]&8388608&&(a.id=o[23]),r[0]&2048&&(a.items=o[11]),r[0]&8192&&(a.disabled=!o[13]),!t&&r[0]&4096&&(t=!0,a.keyOfSelected=o[12],$e(()=>t=!1)),e.$set(a)},i(o){i||(O(e.$$.fragment,o),i=!0)},o(o){D(e.$$.fragment,o),i=!1},d(o){q(e,o)}}}function jL(n){var h;let e,t,i,l=z.hasImageExtension((h=n[9])==null?void 0:h.name),s,o,r,a,u,f,c,d,m=l&&x_(n);return{c(){e=b("button"),t=b("span"),t.textContent="Cancel",i=C(),m&&m.c(),s=C(),o=b("button"),r=b("span"),a=Y(n[1]),p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-transparent m-r-auto"),e.disabled=n[6],p(r,"class","txt"),p(o,"type","button"),p(o,"class","btn btn-expanded"),o.disabled=u=!n[13]},m(g,_){v(g,e,_),w(e,t),v(g,i,_),m&&m.m(g,_),v(g,s,_),v(g,o,_),w(o,r),w(r,a),f=!0,c||(d=[B(e,"click",n[2]),B(o,"click",n[21])],c=!0)},p(g,_){var y;(!f||_[0]&64)&&(e.disabled=g[6]),_[0]&512&&(l=z.hasImageExtension((y=g[9])==null?void 0:y.name)),l?m?(m.p(g,_),_[0]&512&&O(m,1)):(m=x_(g),m.c(),O(m,1),m.m(s.parentNode,s)):m&&(re(),D(m,1,1,()=>{m=null}),ae()),(!f||_[0]&2)&&ue(a,g[1]),(!f||_[0]&8192&&u!==(u=!g[13]))&&(o.disabled=u)},i(g){f||(O(m),f=!0)},o(g){D(m),f=!1},d(g){g&&(k(e),k(i),k(s),k(o)),m&&m.d(g),c=!1,De(d)}}}function zL(n){let e,t,i,l;const s=[{popup:!0},{class:"file-picker-popup"},n[22]];let o={$$slots:{footer:[jL],header:[qL],default:[FL]},$$scope:{ctx:n}};for(let a=0;a<s.length;a+=1)o=je(o,s[a]);e=new ln({props:o}),n[33](e),e.$on("hide",n[34]),e.$on("show",n[35]);let r={collection:n[8]};return i=new rf({props:r}),n[36](i),i.$on("save",n[37]),i.$on("delete",n[38]),{c(){H(e.$$.fragment),t=C(),H(i.$$.fragment)},m(a,u){F(e,a,u),v(a,t,u),F(i,a,u),l=!0},p(a,u){const f=u[0]&4194304?vt(s,[s[0],s[1],Ft(a[22])]):{};u[0]&131059|u[1]&8388608&&(f.$$scope={dirty:u,ctx:a}),e.$
2024-09-30 00:23:19 +08:00
form-field form-field-list form-field-file
`+(n[4].required?"required":"")+`
`+(n[9]?"dragover":"")+`
`,name:n[4].name,$$slots:{default:[uA,({uniqueId:o})=>({28:o}),({uniqueId:o})=>[o?268435456:0]]},$$scope:{ctx:n}}}),{c(){e=b("div"),H(t.$$.fragment),p(e,"class","block")},m(o,r){v(o,e,r),F(t,e,null),i=!0,l||(s=[B(e,"dragover",tt(n[25])),B(e,"dragleave",n[26]),B(e,"drop",n[15])],l=!0)},p(o,r){const a={};r[0]&528&&(a.class=`
2024-09-30 00:23:19 +08:00
form-field form-field-list form-field-file
`+(o[4].required?"required":"")+`
`+(o[9]?"dragover":"")+`
`),r[0]&16&&(a.name=o[4].name),r[0]&268439039|r[1]&64&&(a.$$scope={dirty:r,ctx:o}),t.$set(a)},i(o){i||(O(t.$$.fragment,o),i=!0)},o(o){D(t.$$.fragment,o),i=!1},d(o){o&&k(e),q(t),l=!1,De(s)}}}function cA(n,e,t){let i,l,s,{record:o}=e,{field:r}=e,{value:a=""}=e,{uploadedFiles:u=[]}=e,{deletedFileNames:f=[]}=e,c,d,m=!1,h="";function g(V){z.removeByValue(f,V),t(2,f)}function _(V){z.pushUnique(f,V),t(2,f)}function y(V){z.isEmpty(u[V])||u.splice(V,1),t(1,u)}function S(){d==null||d.dispatchEvent(new CustomEvent("change",{detail:{value:a,uploadedFiles:u,deletedFileNames:f},bubbles:!0}))}function T(V){var J;V.preventDefault(),t(9,m=!1);const K=((J=V.dataTransfer)==null?void 0:J.files)||[];if(!(s||!K.length)){for(const ee of K){const X=l.length+u.length-f.length;if(r.maxSelect<=X)break;u.push(ee)}t(1,u)}}Yt(async()=>{t(10,h=await me.getSuperuserFileToken(o.collectionId))});const $=V=>g(V),E=V=>_(V);function M(V){a=V,t(0,a),t(6,i),t(4,r)}const L=V=>y(V);function I(V){u=V,t(1,u)}function A(V){ie[V?"unshift":"push"](()=>{c=V,t(7,c)})}const P=()=>{for(let V of c.files)u.push(V);t(1,u),t(7,c.value=null,c)},R=()=>c==null?void 0:c.click();function N(V){ie[V?"unshift":"push"](()=>{d=V,t(8,d)})}const U=()=>{t(9,m=!0)},j=()=>{t(9,m=!1)};return n.$$set=V=>{"record"in V&&t(3,o=V.record),"field"in V&&t(4,r=V.field),"value"in V&&t(0,a=V.value),"uploadedFiles"in V&&t(1,u=V.uploadedFiles),"deletedFileNames"in V&&t(2,f=V.deletedFileNames)},n.$$.update=()=>{n.$$.dirty[0]&2&&(Array.isArray(u)||t(1,u=z.toArray(u))),n.$$.dirty[0]&4&&(Array.isArray(f)||t(2,f=z.toArray(f))),n.$$.dirty[0]&16&&t(6,i=r.maxSelect!=1),n.$$.dirty[0]&65&&z.isEmpty(a)&&t(0,a=i?[]:""),n.$$.dirty[0]&1&&t(5,l=z.toArray(a)),n.$$.dirty[0]&54&&t(11,s=(l.length||u.length)&&r.maxSelect<=l.length+u.length-f.length),n.$$.dirty[0]&6&&(u!==-1||f!==-1)&&S()},[a,u,f,o,r,l,i,c,d,m,h,s,g,_,y,T,$,E,M,L,I,A,P,R,N,U,j]}class dA extends ye{constructor(e){super(),be(this,e,cA,fA,_e,{record:3,field:4,value:0,uploadedFiles:1,deletedFileNames:2},null,[-1,-1])}}function pA(n){let e;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(t,i){v(t,e,i)},d(t){t&&k(e)}}}function mA(n){let e;return{c(){e=b("i"),p(e,"class","ri-checkbox-circle-fill txt-success")},m(t,i){v(t,e,i)},d(t){t&&k(e)}}}function hA(n){let e,t,i,l;function s(a,u){return a[4]?mA:pA}let o=s(n),r=o(n);return{c(){e=b("span"),r.c(),p(e,"class","json-state svelte-p6ecb8")},m(a,u){v(a,e,u),r.m(e,null),i||(l=Me(t=He.call(null,e,{position:"left",text:n[4]?"Valid JSON":"Invalid JSON"})),i=!0)},p(a,u){o!==(o=s(a))&&(r.d(1),r=o(a),r&&(r.c(),r.m(e,null))),t&&Rt(t.update)&&u&16&&t.update.call(null,{position:"left",text:a[4]?"Valid JSON":"Invalid JSON"})},d(a){a&&k(e),r.d(),i=!1,l()}}}function _A(n){let e;return{c(){e=b("input"),p(e,"type","text"),p(e,"class","txt-mono"),e.value="Loading...",e.disabled=!0},m(t,i){v(t,e,i)},p:te,i:te,o:te,d(t){t&&k(e)}}}function gA(n){let e,t,i;var l=n[3];function s(o,r){return{props:{id:o[6],maxHeight:"500",language:"json",value:o[2]}}}return l&&(e=jt(l,s(n)),e.$on("change",n[5])),{c(){e&&H(e.$$.fragment),t=ge()},m(o,r){e&&F(e,o,r),v(o,t,r),i=!0},p(o,r){if(r&8&&l!==(l=o[3])){if(e){re();const a=e;D(a.$$.fragment,1,0,()=>{q(a,1)}),ae()}l?(e=jt(l,s(o)),e.$on("change",o[5]),H(e.$$.fragment),O(e.$$.fragment,1),F(e,t.parentNode,t)):e=null}else if(l){const a={};r&64&&(a.id=o[6]),r&4&&(a.value=o[2]),e.$set(a)}},i(o){i||(e&&O(e.$$.fragment,o),i=!0)},o(o){e&&D(e.$$.fragment,o),i=!1},d(o){o&&k(t),e&&q(e,o)}}}function bA(n){let e,t,i,l,s,o;e=new ti({props:{uniqueId:n[6],field:n[1],$$slots:{default:[hA]},$$scope:{ctx:n}}});const r=[gA,_A],a=[];function u(f,c){return f[3]?0:1}return i=u(n),l=a[i]=r[i](n),{c(){H(e.$$.fragment),t=C(),l.c(),s=ge()},m(f,c){F(e,f,c),v(f,t,c),a[i].m(f,c),v(f,s,c),o=!0},p(f,c){const d={};c&64&&(d.uniqueId=f[6]),c&2&&(d.field=f[1]),c&144&&(d.$$scope={dirty:c,ctx:f}),e.$set(d);let m=i;i=u(f),i===m?a[i].p(f,c):(re(),D(a[m],1,1,()=>{a[m]=null}),ae(),l=a[i],l?l.p(f,c):(l=a[i]=r[i](f),l.c()),O(l,1),l.m(s.parentNode,s))},i(f){o||(O(e.$$.fragment,f),O(l),o=!0)},o(f){D(e.$$.fragment,f),D(l
`),A&&A.c(),m=C(),g.c(),_=ge(),p(e,"class","flex m-b-base flex-gap-10"),p(s,"class","list picker-list m-b-base svelte-1u8jhky"),p(c,"class","section-title")},m(U,j){v(U,e,j),F(t,e,null),w(e,i),$&&$.m(e,null),v(U,l,j),v(U,s,j);for(let V=0;V<o.length;V+=1)o[V]&&o[V].m(s,null);L&&L.m(s,null),w(s,a),I&&I.m(s,null),v(U,f,j),v(U,c,j),w(c,d),A&&A.m(c,null),v(U,m,j),R[h].m(U,j),v(U,_,j),y=!0,S||(T=Me(u=DA.call(null,s,n[36])),S=!0)},p(U,j){const V={};j[0]&4&&(V.value=U[2]),j[0]&32&&(V.autocompleteCollection=U[5]),t.$set(V),U[11]?$&&($.d(1),$=null):$?$.p(U,j):($=ug(U),$.c(),$.m(e,null)),j[0]&143252&&(E=pe(U[8]),re(),o=kt(o,j,M,1,U,E,r,s,zt,mg,a,ag),ae(),!E.length&&L?L.p(U,j):E.length?L&&(L.d(1),L=null):(L=fg(U),L.c(),L.m(s,a))),U[13]?I||(I=hg(),I.c(),I.m(s,null)):I&&(I.d(1),I=null),u&&Rt(u.update)&&j[0]&4104&&u.update.call(null,U[36]),U[4]>1?A?A.p(U,j):(A=_g(U),A.c(),A.m(c,null)):A&&(A.d(1),A=null);let K=h;h=N(U),h===K?R[h].p(U,j):(re(),D(R[K],1,1,()=>{R[K]=null}),ae(),g=R[h],g?g.p(U,j):(g=R[h]=P[h](U),g.c()),O(g,1),g.m(_.parentNode,_))},i(U){if(!y){O(t.$$.fragment,U);for(let j=0;j<E.length;j+=1)O(o[j]);O(g),y=!0}},o(U){D(t.$$.fragment,U);for(let j=0;j<o.length;j+=1)D(o[j]);D(g),y=!1},d(U){U&&(k(e),k(l),k(s),k(f),k(c),k(m),k(_)),q(t),$&&$.d();for(let j=0;j<o.length;j+=1)o[j].d();L&&L.d(),I&&I.d(),A&&A.d(),R[h].d(U),S=!1,T()}}}function FA(n){var r;let e,t,i,l=(((r=n[5])==null?void 0:r.name)||"")+"",s,o;return{c(){e=b("h4"),t=Y("Select "),i=b("strong"),s=Y(l),o=Y(" records")},m(a,u){v(a,e,u),w(e,t),w(e,i),w(i,s),w(e,o)},p(a,u){var f;u[0]&32&&l!==(l=(((f=a[5])==null?void 0:f.name)||"")+"")&&ue(s,l)},d(a){a&&k(e)}}}function qA(n){let e,t,i,l,s;return{c(){e=b("button"),e.innerHTML='<span class="txt">Cancel</span>',t=C(),i=b("button"),i.innerHTML='<span class="txt">Set selection</span>',p(e,"type","button"),p(e,"class","btn btn-transparent"),p(i,"type","button"),p(i,"class","btn")},m(o,r){v(o,e,r),v(o,t,r),v(o,i,r),l||(s=[B(e,"click",n[28]),B(i,"click",n[29])],l=!0)},p:te,d(o){o&&(k(e),k(t),k(i)),l=!1,De(s)}}}function HA(n){let e,t,i,l;const s=[{popup:!0},{class:"overlay-panel-xl"},n[19]];let o={$$slots:{footer:[qA],header:[FA],default:[RA]},$$scope:{ctx:n}};for(let a=0;a<s.length;a+=1)o=je(o,s[a]);e=new ln({props:o}),n[39](e),e.$on("hide",n[40]),e.$on("show",n[41]);let r={collection:n[5]};return i=new rf({props:r}),n[42](i),i.$on("save",n[43]),i.$on("delete",n[44]),{c(){H(e.$$.fragment),t=C(),H(i.$$.fragment)},m(a,u){F(e,a,u),v(a,t,u),F(i,a,u),l=!0},p(a,u){const f=u[0]&524288?vt(s,[s[0],s[1],Ft(a[19])]):{};u[0]&16380|u[1]&67108864&&(f.$$scope={dirty:u,ctx:a}),e.$set(f);const c={};u[0]&32&&(c.collection=a[5]),i.$set(c)},i(a){l||(O(e.$$.fragment,a),O(i.$$.fragment,a),l=!0)},o(a){D(e.$$.fragment,a),D(i.$$.fragment,a),l=!1},d(a){a&&k(t),n[39](null),q(e,a),n[42](null),q(i,a)}}}const Go=50;function jA(n,e,t){let i,l,s,o,r,a,u,f;const c=["value","field","show","hide"];let d=lt(e,c),m;Qe(n,En,Oe=>t(26,m=Oe));const h=gt(),g="picker_"+z.randomString(5);let{value:_}=e,{field:y}=e,S,T,$="",E=[],M=[],L=1,I=0,A=!1,P=!1;function R(){return t(2,$=""),t(8,E=[]),t(6,M=[]),j(),V(!0),S==null?void 0:S.show()}function N(){return S==null?void 0:S.hide()}function U(){var Ne;let Oe="";const ut=(Ne=s==null?void 0:s.fields)==null?void 0:Ne.filter(xe=>!xe.hidden&&xe.presentable&&xe.type=="relation");for(const xe of ut){const qt=z.getExpandPresentableRelField(xe,m,2);qt&&(Oe!=""&&(Oe+=","),Oe+=qt)}return Oe}async function j(){const Oe=z.toArray(_);if(!l||!Oe.length)return;t(24,P=!0);let ut=[];const Ne=Oe.slice(),xe=[];for(;Ne.length>0;){const qt=[];for(const Zt of Ne.splice(0,Go))qt.push(`id="${Zt}"`);xe.push(me.collection(l).getFullList({batch:Go,filter:qt.join("||"),fields:"*:excerpt(200)",expand:U(),requestKey:null}))}try{await Promise.all(xe).then(qt=>{ut=ut.concat(...qt)}),t(6,M=[]);for(const qt of Oe){const Zt=z.findByKey(ut,"id",qt);Zt&&M.push(Zt)}$.trim()||t(8,E=z.filterDuplicatesByKey(M.concat(E))),t(24,P=!1)}catch(qt){qt.isAbort||(me.error(qt),t(24,P=!1))}}async function V(Oe=!1){if(l){t(3,A=!0),Oe&&($.trim()?t(8,E=[]):t(8,E=z.toArray(M).slice()
`),l=b("strong"),o=Y(s),r=Y(":"),a=C(),H(u.$$.fragment),p(e,"id",n[8])},m(m,h){v(m,e,h),w(e,t),w(t,i),w(t,l),w(l,o),w(l,r),w(e,a),F(u,e,null),f=!0,c||(d=B(e,"submit",tt(n[9])),c=!0)},p(m,h){(!f||h&2)&&s!==(s=z.displayValue(m[1])+"")&&ue(o,s);const g={};h&3145761&&(g.$$scope={dirty:h,ctx:m}),u.$set(g)},i(m){f||(O(u.$$.fragment,m),f=!0)},o(m){D(u.$$.fragment,m),f=!1},d(m){m&&k(e),q(u),c=!1,d()}}}function pP(n){let e,t,i,l=n[3].authStore.token+"",s,o,r,a,u,f;return r=new ai({props:{value:n[3].authStore.token}}),u=new cP({props:{js:`
2024-09-30 00:23:19 +08:00
import PocketBase from 'pocketbase';
const token = "...";
const pb = new PocketBase('${n[7]}');
pb.authStore.save(token, null);
`,dart:`
import 'package:pocketbase/pocketbase.dart';
final token = "...";
final pb = PocketBase('${n[7]}');
pb.authStore.save(token, null);
`}}),{c(){e=b("div"),t=b("div"),i=b("span"),s=Y(l),o=C(),H(r.$$.fragment),a=C(),H(u.$$.fragment),p(i,"class","txt token-holder svelte-1i56uix"),p(t,"class","content txt-bold"),p(e,"class","alert alert-success")},m(c,d){v(c,e,d),w(e,t),w(t,i),w(i,s),w(t,o),F(r,t,null),v(c,a,d),F(u,c,d),f=!0},p(c,d){(!f||d&8)&&l!==(l=c[3].authStore.token+"")&&ue(s,l);const m={};d&8&&(m.value=c[3].authStore.token),r.$set(m);const h={};d&128&&(h.js=`
import PocketBase from 'pocketbase';
const token = "...";
const pb = new PocketBase('${c[7]}');
pb.authStore.save(token, null);
`),d&128&&(h.dart=`
import 'package:pocketbase/pocketbase.dart';
final token = "...";
final pb = PocketBase('${c[7]}');
pb.authStore.save(token, null);
`),u.$set(h)},i(c){f||(O(r.$$.fragment,c),O(u.$$.fragment,c),f=!0)},o(c){D(r.$$.fragment,c),D(u.$$.fragment,c),f=!1},d(c){c&&(k(e),k(a)),q(r),q(u,c)}}}function mP(n){let e,t,i,l,s,o,r,a,u,f;return{c(){var c,d;e=b("label"),t=Y("Token duration (in seconds)"),l=C(),s=b("input"),p(e,"for",i=n[20]),p(s,"type","number"),p(s,"id",o=n[20]),p(s,"placeholder",r="Default to the collection setting ("+(((d=(c=n[0])==null?void 0:c.authToken)==null?void 0:d.duration)||0)+"s)"),p(s,"min","0"),p(s,"step","1"),s.value=a=n[5]||""},m(c,d){v(c,e,d),w(e,t),v(c,l,d),v(c,s,d),u||(f=B(s,"input",n[14]),u=!0)},p(c,d){var m,h;d&1048576&&i!==(i=c[20])&&p(e,"for",i),d&1048576&&o!==(o=c[20])&&p(s,"id",o),d&1&&r!==(r="Default to the collection setting ("+(((h=(m=c[0])==null?void 0:m.authToken)==null?void 0:h.duration)||0)+"s)")&&p(s,"placeholder",r),d&32&&a!==(a=c[5]||"")&&s.value!==a&&(s.value=a)},d(c){c&&(k(e),k(l),k(s)),u=!1,f()}}}function hP(n){let e,t,i,l,s,o;const r=[pP,dP],a=[];function u(f,c){var d,m;return(m=(d=f[3])==null?void 0:d.authStore)!=null&&m.token?0:1}return i=u(n),l=a[i]=r[i](n),{c(){e=b("div"),t=C(),l.c(),s=ge(),p(e,"class","clearfix")},m(f,c){v(f,e,c),v(f,t,c),a[i].m(f,c),v(f,s,c),o=!0},p(f,c){let d=i;i=u(f),i===d?a[i].p(f,c):(re(),D(a[d],1,1,()=>{a[d]=null}),ae(),l=a[i],l?l.p(f,c):(l=a[i]=r[i](f),l.c()),O(l,1),l.m(s.parentNode,s))},i(f){o||(O(l),o=!0)},o(f){D(l),o=!1},d(f){f&&(k(e),k(t),k(s)),a[i].d(f)}}}function _P(n){let e;return{c(){e=b("h4"),e.textContent="Impersonate auth token"},m(t,i){v(t,e,i)},p:te,d(t){t&&k(e)}}}function gP(n){let e,t,i,l;return{c(){e=b("button"),t=b("span"),t.textContent="Generate token",p(t,"class","txt"),p(e,"type","submit"),p(e,"form",n[8]),p(e,"class","btn btn-expanded"),e.disabled=n[6],Q(e,"btn-loading",n[6])},m(s,o){v(s,e,o),w(e,t),i||(l=B(e,"click",n[13]),i=!0)},p(s,o){o&64&&(e.disabled=s[6]),o&64&&Q(e,"btn-loading",s[6])},d(s){s&&k(e),i=!1,l()}}}function bP(n){let e,t,i,l;return{c(){e=b("button"),t=b("span"),t.textContent="Generate a new one",p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-secondary btn-expanded"),e.disabled=n[6]},m(s,o){v(s,e,o),w(e,t),i||(l=B(e,"click",n[12]),i=!0)},p(s,o){o&64&&(e.disabled=s[6])},d(s){s&&k(e),i=!1,l()}}}function yP(n){let e,t,i,l,s,o;function r(f,c){var d,m;return(m=(d=f[3])==null?void 0:d.authStore)!=null&&m.token?bP:gP}let a=r(n),u=a(n);return{c(){e=b("button"),t=b("span"),t.textContent="Close",i=C(),u.c(),l=ge(),p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-transparent"),e.disabled=n[6]},m(f,c){v(f,e,c),w(e,t),v(f,i,c),u.m(f,c),v(f,l,c),s||(o=B(e,"click",n[2]),s=!0)},p(f,c){c&64&&(e.disabled=f[6]),a===(a=r(f))&&u?u.p(f,c):(u.d(1),u=a(f),u&&(u.c(),u.m(l.parentNode,l)))},d(f){f&&(k(e),k(i),k(l)),u.d(f),s=!1,o()}}}function kP(n){let e,t,i={overlayClose:!1,escClose:!n[6],beforeHide:n[15],popup:!0,$$slots:{footer:[yP],header:[_P],default:[hP]},$$scope:{ctx:n}};return e=new ln({props:i}),n[16](e),e.$on("show",n[17]),e.$on("hide",n[18]),{c(){H(e.$$.fragment)},m(l,s){F(e,l,s),t=!0},p(l,[s]){const o={};s&64&&(o.escClose=!l[6]),s&64&&(o.beforeHide=l[15]),s&2097387&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(O(e.$$.fragment,l),t=!0)},o(l){D(e.$$.fragment,l),t=!1},d(l){n[16](null),q(e,l)}}}function vP(n,e,t){let i;const l=gt(),s="impersonate_"+z.randomString(5);let{collection:o}=e,{record:r}=e,a,u=0,f=!1,c;function d(){r&&(a==null||a.show())}function m(){a==null||a.hide(),g()}async function h(){if(!(f||!o||!r)){t(6,f=!0);try{t(3,c=await me.collection(o.name).impersonate(r.id,u)),l("submit",c)}catch(L){me.error(L)}t(6,f=!1)}}function g(){t(5,u=0),t(3,c=void 0)}const _=()=>g(),y=()=>h(),S=L=>t(5,u=L.target.value<<0),T=()=>!f;function $(L){ie[L?"unshift":"push"](()=>{a=L,t(4,a)})}function E(L){Pe.call(this,n,L)}function M(L){Pe.call(this,n,L)}return n.$$set=L=>{"collection"in L&&t(0,o=L.collection),"record"in L&&t(1,r=L.record)},n.$$.update=()=>{n.$$.dirty&8&&t(7,i=z.getApiExampleUrl(c==null?void 0:c.baseURL))},[o,r,m,c,a,u,f,i,s,h,g,d,_,y,S,T,$,E,M]}class wP extends ye{constructor(e){super(),be(this,e,vP,kP,_e,{collection:0,
`),r=b("button"),r.textContent="Restore draft",a=C(),u=b("button"),u.innerHTML='<i class="ri-close-line"></i>',f=C(),c=b("div"),p(i,"class","icon"),p(r,"type","button"),p(r,"class","btn btn-sm btn-secondary"),p(s,"class","flex flex-gap-xs"),p(u,"type","button"),p(u,"class","close"),p(u,"aria-label","Discard draft"),p(t,"class","alert alert-info m-0"),p(c,"class","clearfix p-b-base"),p(e,"class","block")},m(_,y){v(_,e,y),w(e,t),w(t,i),w(t,l),w(t,s),w(s,o),w(s,r),w(t,a),w(t,u),w(e,f),w(e,c),m=!0,h||(g=[B(r,"click",n[46]),Me(He.call(null,u,"Discard draft")),B(u,"click",tt(n[47]))],h=!0)},p:te,i(_){m||(d&&d.end(1),m=!0)},o(_){_&&(d=mu(e,wt,{duration:150})),m=!1},d(_){_&&k(e),_&&d&&d.end(),h=!1,De(g)}}}function Pg(n){let e,t,i;return t=new xI({props:{record:n[3]}}),{c(){e=b("div"),H(t.$$.fragment),p(e,"class","form-field-addon")},m(l,s){v(l,e,s),F(t,e,null),i=!0},p(l,s){const o={};s[0]&8&&(o.record=l[3]),t.$set(o)},i(l){i||(O(t.$$.fragment,l),i=!0)},o(l){D(t.$$.fragment,l),i=!1},d(l){l&&k(e),q(t)}}}function SP(n){let e,t,i,l,s,o,r,a,u,f,c,d,m,h,g,_,y,S=!n[6]&&Pg(n);return{c(){var T,$;e=b("label"),t=b("i"),i=C(),l=b("span"),l.textContent="id",s=C(),o=b("span"),a=C(),S&&S.c(),u=C(),f=b("input"),p(t,"class",js(z.getFieldTypeIcon("primary"))+" svelte-qc5ngu"),p(l,"class","txt"),p(o,"class","flex-fill"),p(e,"for",r=n[85]),p(f,"type","text"),p(f,"id",c=n[85]),p(f,"placeholder",d=!n[7]&&!z.isEmpty((T=n[19])==null?void 0:T.autogeneratePattern)?"Leave empty to auto generate...":""),p(f,"minlength",m=($=n[19])==null?void 0:$.min),f.readOnly=h=!n[6]},m(T,$){v(T,e,$),w(e,t),w(e,i),w(e,l),w(e,s),w(e,o),v(T,a,$),S&&S.m(T,$),v(T,u,$),v(T,f,$),ce(f,n[3].id),g=!0,_||(y=B(f,"input",n[48]),_=!0)},p(T,$){var E,M;(!g||$[2]&8388608&&r!==(r=T[85]))&&p(e,"for",r),T[6]?S&&(re(),D(S,1,1,()=>{S=null}),ae()):S?(S.p(T,$),$[0]&64&&O(S,1)):(S=Pg(T),S.c(),O(S,1),S.m(u.parentNode,u)),(!g||$[2]&8388608&&c!==(c=T[85]))&&p(f,"id",c),(!g||$[0]&524416&&d!==(d=!T[7]&&!z.isEmpty((E=T[19])==null?void 0:E.autogeneratePattern)?"Leave empty to auto generate...":""))&&p(f,"placeholder",d),(!g||$[0]&524288&&m!==(m=(M=T[19])==null?void 0:M.min))&&p(f,"minlength",m),(!g||$[0]&64&&h!==(h=!T[6]))&&(f.readOnly=h),$[0]&8&&f.value!==T[3].id&&ce(f,T[3].id)},i(T){g||(O(S),g=!0)},o(T){D(S),g=!1},d(T){T&&(k(e),k(a),k(u),k(f)),S&&S.d(T),_=!1,y()}}}function Ng(n){let e,t,i,l,s;function o(u){n[49](u)}let r={isNew:n[6],collection:n[0]};n[3]!==void 0&&(r.record=n[3]),e=new gL({props:r}),ie.push(()=>ve(e,"record",o));let a=n[16].length&&Rg();return{c(){H(e.$$.fragment),i=C(),a&&a.c(),l=ge()},m(u,f){F(e,u,f),v(u,i,f),a&&a.m(u,f),v(u,l,f),s=!0},p(u,f){const c={};f[0]&64&&(c.isNew=u[6]),f[0]&1&&(c.collection=u[0]),!t&&f[0]&8&&(t=!0,c.record=u[3],$e(()=>t=!1)),e.$set(c),u[16].length?a||(a=Rg(),a.c(),a.m(l.parentNode,l)):a&&(a.d(1),a=null)},i(u){s||(O(e.$$.fragment,u),s=!0)},o(u){D(e.$$.fragment,u),s=!1},d(u){u&&(k(i),k(l)),q(e,u),a&&a.d(u)}}}function Rg(n){let e;return{c(){e=b("hr")},m(t,i){v(t,e,i)},d(t){t&&k(e)}}}function TP(n){let e,t,i;function l(o){n[63](o,n[82])}let s={field:n[82],original:n[2],record:n[3]};return n[3][n[82].name]!==void 0&&(s.value=n[3][n[82].name]),e=new MA({props:s}),ie.push(()=>ve(e,"value",l)),{c(){H(e.$$.fragment)},m(o,r){F(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&65536&&(a.field=n[82]),r[0]&4&&(a.original=n[2]),r[0]&8&&(a.record=n[3]),!t&&r[0]&65544&&(t=!0,a.value=n[3][n[82].name],$e(()=>t=!1)),e.$set(a)},i(o){i||(O(e.$$.fragment,o),i=!0)},o(o){D(e.$$.fragment,o),i=!1},d(o){q(e,o)}}}function $P(n){let e,t,i;function l(o){n[62](o,n[82])}let s={field:n[82],original:n[2],record:n[3]};return n[3][n[82].name]!==void 0&&(s.value=n[3][n[82].name]),e=new KA({props:s}),ie.push(()=>ve(e,"value",l)),{c(){H(e.$$.fragment)},m(o,r){F(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&65536&&(a.field=n[82]),r[0]&4&&(a.original=n[2]),r[0]&8&&(a.record=n[3]),!t&&r[0]&65544&&(t=!0,a.value=n[3][n[82].name],$e(()=>t=!1)),e.$set(a)},i(o){i||(O(e.$$.fragment,o),i=!0)},o(o){D(e.$$.fragment,o),i=!1},d(o){q(e,o)}}}function CP(n){let e,t,i,l,s;function o(f){n[59](f,n[82]
2024-09-30 00:23:19 +08:00
record-panel
`+(n[20]?"overlay-panel-xl":"overlay-panel-lg")+`
`+(n[9]&&!n[17]&&!n[6]?"colored-header":"")+`
`,btnClose:!n[7],escClose:!n[7],overlayClose:!n[7],beforeHide:n[64],$$slots:{footer:[UP],header:[jP],default:[RP]},$$scope:{ctx:n}};e=new ln({props:s}),n[65](e),e.$on("hide",n[66]),e.$on("show",n[67]);let o={record:n[3],collection:n[0]};return i=new wP({props:o}),n[68](i),{c(){H(e.$$.fragment),t=C(),H(i.$$.fragment)},m(r,a){F(e,r,a),v(r,t,a),F(i,r,a),l=!0},p(r,a){const u={};a[0]&1180224&&(u.class=`
2024-09-30 00:23:19 +08:00
record-panel
`+(r[20]?"overlay-panel-xl":"overlay-panel-lg")+`
`+(r[9]&&!r[17]&&!r[6]?"colored-header":"")+`
`),a[0]&128&&(u.btnClose=!r[7]),a[0]&128&&(u.escClose=!r[7]),a[0]&128&&(u.overlayClose=!r[7]),a[0]&16640&&(u.beforeHide=r[64]),a[0]&1031165|a[2]&16777216&&(u.$$scope={dirty:a,ctx:r}),e.$set(u);const f={};a[0]&8&&(f.record=r[3]),a[0]&1&&(f.collection=r[0]),i.$set(f)},i(r){l||(O(e.$$.fragment,r),O(i.$$.fragment,r),l=!0)},o(r){D(e.$$.fragment,r),D(i.$$.fragment,r),l=!1},d(r){r&&k(t),n[65](null),q(e,r),n[68](null),q(i,r)}}}const Ml="form",no="providers";function BP(n,e,t){let i,l,s,o,r,a,u,f;const c=gt(),d="record_"+z.randomString(5);let{collection:m}=e,h,g,_={},y={},S=null,T=!1,$=!1,E={},M={},L=JSON.stringify(_),I=L,A=Ml,P=!0,R=!0,N=m,U=[];const j=["id"],V=j.concat("email","emailVisibility","verified","tokenKey","password");function K(le){return Se(le),t(14,$=!0),t(15,A=Ml),h==null?void 0:h.show()}function J(){return h==null?void 0:h.hide()}function ee(){t(14,$=!1),J()}function X(){t(34,N=m),h!=null&&h.isActive()&&(st(JSON.stringify(y)),ee())}async function oe(le){if(le&&typeof le=="string"){try{return await me.collection(m.id).getOne(le)}catch(Ee){Ee.isAbort||(ee(),console.warn("resolveModel:",Ee),$i(`Unable to load record with id "${le}"`))}return null}return le}async function Se(le){t(7,R=!0),Wt({}),t(4,E={}),t(5,M={}),t(2,_=typeof le=="string"?{id:le,collectionId:m==null?void 0:m.id,collectionName:m==null?void 0:m.name}:le||{}),t(3,y=structuredClone(_)),t(2,_=await oe(le)||{}),t(3,y=structuredClone(_)),await fn(),t(12,S=We()),!S||Be(y,S)?t(12,S=null):(delete S.password,delete S.passwordConfirm),t(32,L=JSON.stringify(y)),t(7,R=!1)}async function ke(le){var Re,Ke;Wt({}),t(2,_=le||{}),t(4,E={}),t(5,M={});const Ee=((Ke=(Re=m==null?void 0:m.fields)==null?void 0:Re.filter(Ae=>Ae.type!="file"))==null?void 0:Ke.map(Ae=>Ae.name))||[];for(let Ae in le)Ee.includes(Ae)||t(3,y[Ae]=le[Ae],y);await fn(),t(32,L=JSON.stringify(y)),rt()}function Ce(){return"record_draft_"+((m==null?void 0:m.id)||"")+"_"+((_==null?void 0:_.id)||"")}function We(le){try{const Ee=window.localStorage.getItem(Ce());if(Ee)return JSON.parse(Ee)}catch{}return le}function st(le){try{window.localStorage.setItem(Ce(),le)}catch(Ee){console.warn("updateDraft failure:",Ee),window.localStorage.removeItem(Ce())}}function et(){S&&(t(3,y=S),t(12,S=null))}function Be(le,Ee){var ft;const Re=structuredClone(le||{}),Ke=structuredClone(Ee||{}),Ae=(ft=m==null?void 0:m.fields)==null?void 0:ft.filter(Xt=>Xt.type==="file");for(let Xt of Ae)delete Re[Xt.name],delete Ke[Xt.name];const Ge=["expand","password","passwordConfirm"];for(let Xt of Ge)delete Re[Xt],delete Ke[Xt];return JSON.stringify(Re)==JSON.stringify(Ke)}function rt(){t(12,S=null),window.localStorage.removeItem(Ce())}async function Je(le=!0){var Ee;if(!(T||!u||!(m!=null&&m.id))){t(13,T=!0);try{const Re=Ht();let Ke;if(P?Ke=await me.collection(m.id).create(Re):Ke=await me.collection(m.id).update(y.id,Re),tn(P?"Successfully created record.":"Successfully updated record."),rt(),l&&(y==null?void 0:y.id)==((Ee=me.authStore.record)==null?void 0:Ee.id)&&Re.get("password"))return me.logout();le?ee():ke(Ke),c("save",{isNew:P,record:Ke})}catch(Re){me.error(Re)}t(13,T=!1)}}function at(){_!=null&&_.id&&pn("Do you really want to delete the selected record?",()=>me.collection(_.collectionId).delete(_.id).then(()=>{ee(),tn("Successfully deleted record."),c("delete",_)}).catch(le=>{me.error(le)}))}function Ht(){const le=structuredClone(y||{}),Ee=new FormData,Re={},Ke={};for(const Ae of(m==null?void 0:m.fields)||[])Ae.type=="autodate"||i&&Ae.type=="password"||(Re[Ae.name]=!0,Ae.type=="json"&&(Ke[Ae.name]=!0));i&&le.password&&(Re.password=!0),i&&le.passwordConfirm&&(Re.passwordConfirm=!0);for(const Ae in le)if(Re[Ae]){if(typeof le[Ae]>"u"&&(le[Ae]=null),Ke[Ae]&&le[Ae]!=="")try{JSON.parse(le[Ae])}catch(Ge){const ft={};throw ft[Ae]={code:"invalid_json",message:Ge.toString()},new Rn({status:400,response:{data:ft}})}z.addValueToFormData(Ee,Ae,le[Ae])}for(const Ae in E){const Ge=z.toArray(E[Ae]);for(const ft of Ge)Ee.append(Ae+"+",ft)}for(const Ae in M){const Ge=z.toArray(M[Ae]);for(const ft of Ge)Ee.append(Ae+"-",ft)}return Ee}function Te(
`);for(let E=0;E<$.length;E+=1)$[E].c();p(e,"for",i=n[16]),p(u,"type","button"),p(u,"class","btn btn-sm btn-hint btn-transparent btn-clear"),Q(u,"hidden",z.isEmpty(n[0].trustedProxy.headers)),p(a,"class","form-field-addon"),p(c,"class","help-block")},m(E,M){v(E,e,M),w(e,t),v(E,l,M),F(s,E,M),v(E,r,M),v(E,a,M),w(a,u),v(E,f,M),v(E,c,M),w(c,d),w(d,m);for(let L=0;L<$.length;L+=1)$[L]&&$[L].m(d,null);h=!0,g||(_=B(u,"click",n[12]),g=!0)},p(E,M){(!h||M&65536&&i!==(i=E[16]))&&p(e,"for",i);const L={};if(M&65536&&(L.id=E[16]),!o&&M&1&&(o=!0,L.value=E[0].trustedProxy.headers,$e(()=>o=!1)),s.$set(L),(!h||M&1)&&Q(u,"hidden",z.isEmpty(E[0].trustedProxy.headers)),M&68){T=pe(E[2]);let I;for(I=0;I<T.length;I+=1){const A=f1(E,T,I);$[I]?$[I].p(A,M):($[I]=c1(A),$[I].c(),$[I].m(d,null))}for(;I<$.length;I+=1)$[I].d(1);$.length=T.length}},i(E){h||(O(s.$$.fragment,E),h=!0)},o(E){D(s.$$.fragment,E),h=!1},d(E){E&&(k(e),k(l),k(r),k(a),k(f),k(c)),q(s,E),pt($,E),g=!1,_()}}}function qN(n){let e,t,i,l,s,o,r,a,u,f,c;function d(h){n[14](h)}let m={items:n[7]};return n[0].trustedProxy.useLeftmostIP!==void 0&&(m.keyOfSelected=n[0].trustedProxy.useLeftmostIP),r=new xn({props:m}),ie.push(()=>ve(r,"keyOfSelected",d)),{c(){e=b("label"),t=b("span"),t.textContent="IP priority selection",i=C(),l=b("i"),o=C(),H(r.$$.fragment),p(t,"class","txt"),p(l,"class","ri-information-line link-hint"),p(e,"for",s=n[16])},m(h,g){v(h,e,g),w(e,t),w(e,i),w(e,l),v(h,o,g),F(r,h,g),u=!0,f||(c=Me(He.call(null,l,{text:"This is in case the proxy returns more than 1 IP as header value. The rightmost IP is usually considered to be the more trustworthy but this could vary depending on the proxy.",position:"right"})),f=!0)},p(h,g){(!u||g&65536&&s!==(s=h[16]))&&p(e,"for",s);const _={};!a&&g&1&&(a=!0,_.keyOfSelected=h[0].trustedProxy.useLeftmostIP,$e(()=>a=!1)),r.$set(_)},i(h){u||(O(r.$$.fragment,h),u=!0)},o(h){D(r.$$.fragment,h),u=!1},d(h){h&&(k(e),k(o)),q(r,h),f=!1,c()}}}function HN(n){let e,t,i,l,s,o,r=(n[1].realIP||"N/A")+"",a,u,f,c,d,m,h,g,_,y,S=(n[1].possibleProxyHeader||"N/A")+"",T,$,E,M,L,I,A,P,R,N,U,j,V;return A=new fe({props:{class:"form-field m-b-0",name:"trustedProxy.headers",$$slots:{default:[FN,({uniqueId:K})=>({16:K}),({uniqueId:K})=>K?65536:0]},$$scope:{ctx:n}}}),N=new fe({props:{class:"form-field m-0",name:"trustedProxy.useLeftmostIP",$$slots:{default:[qN,({uniqueId:K})=>({16:K}),({uniqueId:K})=>K?65536:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),i=b("div"),l=b("span"),l.textContent="Resolved user IP:",s=C(),o=b("strong"),a=Y(r),u=C(),f=b("i"),c=C(),d=b("br"),m=C(),h=b("div"),g=b("span"),g.textContent="Detected proxy header:",_=C(),y=b("strong"),T=Y(S),$=C(),E=b("div"),E.innerHTML=`<p>When PocketBase is deployed on platforms like Fly or it is accessible through proxies such as
2024-09-30 00:23:19 +08:00
NGINX, requests from different users will originate from the same IP address (the IP of the proxy
connecting to your PocketBase app).</p> <p>In this case to retrieve the actual user IP (used for rate limiting, logging, etc.) you need to
properly configure your proxy and list below the trusted headers that PocketBase could use to
extract the user IP.</p> <p class="txt-bold">When using such proxy, to avoid spoofing it is recommended to:</p> <ul class="m-t-0 txt-bold"><li>use headers that are controlled only by the proxy and cannot be manually set by the users</li> <li>make sure that the PocketBase server can be accessed only through the proxy</li></ul> <p>You can clear the headers field if PocketBase is not deployed behind a proxy.</p>`,M=C(),L=b("div"),I=b("div"),H(A.$$.fragment),P=C(),R=b("div"),H(N.$$.fragment),p(f,"class","ri-information-line txt-sm link-hint"),p(i,"class","inline-flex flex-gap-5"),p(h,"class","inline-flex flex-gap-5"),p(t,"class","content"),p(e,"class","alert alert-info m-b-sm"),p(E,"class","content m-b-sm"),p(I,"class","col-lg-9"),p(R,"class","col-lg-3"),p(L,"class","grid grid-sm")},m(K,J){v(K,e,J),w(e,t),w(t,i),w(i,l),w(i,s),w(i,o),w(o,a),w(i,u),w(i,f),w(t,c),w(t,d),w(t,m),w(t,h),w(h,g),w(h,_),w(h,y),w(y,T),v(K,$,J),v(K,E,J),v(K,M,J),v(K,L,J),w(L,I),F(A,I,null),w(L,P),w(L,R),F(N,R,null),U=!0,j||(V=Me(He.call(null,f,`Must show your actual IP.
If not, set the correct proxy header.`)),j=!0)},p(K,J){(!U||J&2)&&r!==(r=(K[1].realIP||"N/A")+"")&&ue(a,r),(!U||J&2)&&S!==(S=(K[1].possibleProxyHeader||"N/A")+"")&&ue(T,S);const ee={};J&1114117&&(ee.$$scope={dirty:J,ctx:K}),A.$set(ee);const X={};J&1114113&&(X.$$scope={dirty:J,ctx:K}),N.$set(X)},i(K){U||(O(A.$$.fragment,K),O(N.$$.fragment,K),U=!0)},o(K){D(A.$$.fragment,K),D(N.$$.fragment,K),U=!1},d(K){K&&(k(e),k($),k(E),k(M),k(L)),q(A),q(N),j=!1,V()}}}function jN(n){let e,t,i;return{c(){e=b("i"),p(e,"class","ri-alert-line txt-sm txt-hint")},m(l,s){v(l,e,s),t||(i=Me(He.call(null,e,"The configured proxy header doesn't match with the detected one.")),t=!0)},d(l){l&&k(e),t=!1,i()}}}function zN(n){let e,t,i;return{c(){e=b("i"),p(e,"class","ri-alert-line txt-sm txt-warning")},m(l,s){v(l,e,s),t||(i=Me(He.call(null,e,`Detected proxy header.
It is recommend to list it as trusted.`)),t=!0)},d(l){l&&k(e),t=!1,i()}}}function UN(n){let e;return{c(){e=b("span"),e.textContent="Disabled",p(e,"class","label")},m(t,i){v(t,e,i)},d(t){t&&k(e)}}}function VN(n){let e;return{c(){e=b("span"),e.textContent="Enabled",p(e,"class","label label-success")},m(t,i){v(t,e,i)},d(t){t&&k(e)}}}function d1(n){let e,t,i,l,s;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){v(o,e,r),i=!0,l||(s=Me(He.call(null,e,{text:"Has errors",position:"left"})),l=!0)},i(o){i||(o&&nt(()=>{i&&(t||(t=ze(e,Mt,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=ze(e,Mt,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&k(e),o&&t&&t.end(),l=!1,s()}}}function BN(n){let e,t,i,l,s,o,r,a,u,f,c;function d(T,$){if($&43&&(o=null),!T[3]&&T[1].possibleProxyHeader)return zN;if(o==null&&(o=!!(T[3]&&!T[5]&&!T[0].trustedProxy.headers.includes(T[1].possibleProxyHeader))),o)return jN}let m=d(n,-1),h=m&&m(n);function g(T,$){return T[3]?VN:UN}let _=g(n),y=_(n),S=n[4]&&d1();return{c(){e=b("div"),t=b("i"),i=C(),l=b("span"),l.textContent="User IP proxy headers",s=C(),h&&h.c(),r=C(),a=b("div"),u=C(),y.c(),f=C(),S&&S.c(),c=ge(),p(t,"class","ri-route-line"),p(l,"class","txt"),p(e,"class","inline-flex"),p(a,"class","flex-fill")},m(T,$){v(T,e,$),w(e,t),w(e,i),w(e,l),w(e,s),h&&h.m(e,null),v(T,r,$),v(T,a,$),v(T,u,$),y.m(T,$),v(T,f,$),S&&S.m(T,$),v(T,c,$)},p(T,$){m!==(m=d(T,$))&&(h&&h.d(1),h=m&&m(T),h&&(h.c(),h.m(e,null))),_!==(_=g(T))&&(y.d(1),y=_(T),y&&(y.c(),y.m(f.parentNode,f))),T[4]?S?$&16&&O(S,1):(S=d1(),S.c(),O(S,1),S.m(c.parentNode,c)):S&&(re(),D(S,1,1,()=>{S=null}),ae())},d(T){T&&(k(e),k(r),k(a),k(u),k(f),k(c)),h&&h.d(),y.d(T),S&&S.d(T)}}}function WN(n){let e,t;return e=new qi({props:{single:!0,$$slots:{header:[BN],default:[HN]},$$scope:{ctx:n}}}),{c(){H(e.$$.fragment)},m(i,l){F(e,i,l),t=!0},p(i,[l]){const s={};l&1048639&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(O(e.$$.fragment,i),t=!0)},o(i){D(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function YN(n,e,t){let i,l,s,o,r,a;Qe(n,Sn,T=>t(10,a=T));const u=["X-Forward-For","Fly-Client-IP","CF-Connecting-IP"];let{formSettings:f}=e,{healthData:c}=e,d="";function m(T){t(0,f.trustedProxy.headers=[T],f)}const h=[{label:"Use leftmost IP",value:!0},{label:"Use rightmost IP",value:!1}];function g(T){n.$$.not_equal(f.trustedProxy.headers,T)&&(f.trustedProxy.headers=T,t(0,f))}const _=()=>t(0,f.trustedProxy.headers=[],f),y=T=>m(T);function S(T){n.$$.not_equal(f.trustedProxy.useLeftmostIP,T)&&(f.trustedProxy.useLeftmostIP=T,t(0,f))}return n.$$set=T=>{"formSettings"in T&&t(0,f=T.formSettings),"healthData"in T&&t(1,c=T.healthData)},n.$$.update=()=>{n.$$.dirty&1&&t(9,i=JSON.stringify(f)),n.$$.dirty&768&&d!=i&&t(8,d=i),n.$$.dirty&768&&t(5,l=d!=i),n.$$.dirty&1024&&t(4,s=!z.isEmpty(a==null?void 0:a.trustedProxy)),n.$$.dirty&1&&t(3,o=!z.isEmpty(f.trustedProxy.headers)),n.$$.dirty&2&&t(2,r=c.possibleProxyHeader?[c.possibleProxyHeader].concat(u.filter(T=>T!=c.possibleProxyHeader)):u)},[f,c,r,o,s,l,m,h,d,i,a,g,_,y,S]}class KN extends ye{constructor(e){super(),be(this,e,YN,WN,_e,{formSettings:0,healthData:1})}}function p1(n,e,t){const i=n.slice();return i[5]=e[t],i}function m1(n){let e,t=(n[5].label||"")+"",i,l;return{c(){e=b("option"),i=Y(t),e.__value=l=n[5].value,ce(e,e.__value)},m(s,o){v(s,e,o),w(e,i)},p(s,o){o&2&&t!==(t=(s[5].label||"")+"")&&ue(i,t),o&2&&l!==(l=s[5].value)&&(e.__value=l,ce(e,e.__value))},d(s){s&&k(e)}}}function JN(n){let e,t,i,l,s,o,r=[{type:t=n[3].type||"text"},{list:n[2]},{value:n[0]},n[3]],a={};for(let c=0;c<r.length;c+=1)a=je(a,r[c]);let u=pe(n[1]),f=[];for(let c=0;c<u.length;c+=1)f[c]=m1(p1(n,u,c));return{c(){e=b("input"),i=C(),l=b("datalist");for(let c=0;c<f.length;c+=1)f[c].c();Xn(e,a),p(l,"id",n[2])},m(c,d){v(c,e,d),"value"in a&&(e.value=a.value),e.autofocus&&e.focus(),v(c,i,d),v(c,l,d);for(let m=0;m<f.length;m+=1)f[m]&&f[m].m(l,null);s||(o=B(e,"input",n[4]),s=!0)},p(c,[d]){if(Xn(e,a=vt(r,[d&8&&t!==(t=c[3].type||"text")&&{type:t},{list:c[2]},d&1&&e.value!==c[0]&&{value:c[0]},d&8&&c[3]])),"value"in a&&(e.value=a.value),d&2){u=pe(c[1]);
2024-09-30 00:23:19 +08:00
database will be temporary &quot;locked&quot; (this usually happens only during the ZIP generation).</p> <p class="txt-bold">If you are using S3 storage for the collections file upload, you&#39;ll have to backup them
separately since they are not locally stored and will not be included in the final backup!</p></div>`,t=C(),i=b("form"),H(l.$$.fragment),p(e,"class","alert alert-info"),p(i,"id",n[4]),p(i,"autocomplete","off")},m(a,u){v(a,e,u),v(a,t,u),v(a,i,u),F(l,i,null),s=!0,o||(r=B(i,"submit",tt(n[5])),o=!0)},p(a,u){const f={};u&98308&&(f.$$scope={dirty:u,ctx:a}),l.$set(f)},i(a){s||(O(l.$$.fragment,a),s=!0)},o(a){D(l.$$.fragment,a),s=!1},d(a){a&&(k(e),k(t),k(i)),q(l),o=!1,r()}}}function y7(n){let e;return{c(){e=b("h4"),e.textContent="Initialize new backup",p(e,"class","center txt-break")},m(t,i){v(t,e,i)},p:te,d(t){t&&k(e)}}}function k7(n){let e,t,i,l,s,o,r;return{c(){e=b("button"),t=b("span"),t.textContent="Cancel",i=C(),l=b("button"),s=b("span"),s.textContent="Start backup",p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-transparent"),e.disabled=n[3],p(s,"class","txt"),p(l,"type","submit"),p(l,"form",n[4]),p(l,"class","btn btn-expanded"),l.disabled=n[3],Q(l,"btn-loading",n[3])},m(a,u){v(a,e,u),w(e,t),v(a,i,u),v(a,l,u),w(l,s),o||(r=B(e,"click",n[0]),o=!0)},p(a,u){u&8&&(e.disabled=a[3]),u&8&&(l.disabled=a[3]),u&8&&Q(l,"btn-loading",a[3])},d(a){a&&(k(e),k(i),k(l)),o=!1,r()}}}function v7(n){let e,t,i={class:"backup-create-panel",beforeOpen:n[8],beforeHide:n[9],popup:!0,$$slots:{footer:[k7],header:[y7],default:[b7]},$$scope:{ctx:n}};return e=new ln({props:i}),n[10](e),e.$on("show",n[11]),e.$on("hide",n[12]),{c(){H(e.$$.fragment)},m(l,s){F(e,l,s),t=!0},p(l,[s]){const o={};s&8&&(o.beforeOpen=l[8]),s&8&&(o.beforeHide=l[9]),s&65548&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(O(e.$$.fragment,l),t=!0)},o(l){D(e.$$.fragment,l),t=!1},d(l){n[10](null),q(e,l)}}}function w7(n,e,t){const i=gt(),l="backup_create_"+z.randomString(5);let s,o="",r=!1,a;function u(S){Wt({}),t(3,r=!1),t(2,o=S||""),s==null||s.show()}function f(){return s==null?void 0:s.hide()}async function c(){if(!r){t(3,r=!0),clearTimeout(a),a=setTimeout(()=>{f()},1500);try{await me.backups.create(o,{$cancelKey:l}),t(3,r=!1),f(),i("submit"),tn("Successfully generated new backup.")}catch(S){S.isAbort||me.error(S)}clearTimeout(a),t(3,r=!1)}}so(()=>{clearTimeout(a)});function d(){o=this.value,t(2,o)}const m=()=>r?(Ys("A backup has already been started, please wait."),!1):!0,h=()=>(r&&Ys("The backup was started but may take a while to complete. You can come back later.",4500),!0);function g(S){ie[S?"unshift":"push"](()=>{s=S,t(1,s)})}function _(S){Pe.call(this,n,S)}function y(S){Pe.call(this,n,S)}return[f,s,o,r,l,c,u,d,m,h,g,_,y]}class S7 extends ye{constructor(e){super(),be(this,e,w7,v7,_e,{show:6,hide:0})}get show(){return this.$$.ctx[6]}get hide(){return this.$$.ctx[0]}}function T7(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Backup name"),l=C(),s=b("input"),p(e,"for",i=n[15]),p(s,"type","text"),p(s,"id",o=n[15]),s.required=!0},m(u,f){v(u,e,f),w(e,t),v(u,l,f),v(u,s,f),ce(s,n[2]),r||(a=B(s,"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(s,"id",o),f&4&&s.value!==u[2]&&ce(s,u[2])},d(u){u&&(k(e),k(l),k(s)),r=!1,a()}}}function $7(n){let e,t,i,l,s,o,r,a,u,f,c,d,m,h,g,_;return u=new ai({props:{value:n[1]}}),m=new fe({props:{class:"form-field required m-0",name:"name",$$slots:{default:[T7,({uniqueId:y})=>({15:y}),({uniqueId:y})=>y?32768:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),e.innerHTML=`<div class="icon"><i class="ri-alert-line"></i></div> <div class="content"><p class="txt-bold">Please proceed with caution and use it only with trusted backups!</p> <p>Backup restore is experimental and works only on UNIX based systems.</p> <p>The restore operation will attempt to replace your existing <code>pb_data</code> with the one from
2024-09-30 00:23:19 +08:00
the backup and will restart the application process.</p> <p>This means that on success all of your data (including app settings, users, superusers, etc.) will
be replaced with the ones from the backup.</p> <p>Nothing will happen if the backup is invalid or incompatible (ex. missing
<code>data.db</code> file).</p></div>`,t=C(),i=b("div"),l=Y(`Type the backup name
`),s=b("div"),o=b("span"),r=Y(n[1]),a=C(),H(u.$$.fragment),f=Y(`
to confirm:`),c=C(),d=b("form"),H(m.$$.fragment),p(e,"class","alert alert-danger"),p(o,"class","txt"),p(s,"class","label"),p(i,"class","content m-b-xs"),p(d,"id",n[6]),p(d,"autocomplete","off")},m(y,S){v(y,e,S),v(y,t,S),v(y,i,S),w(i,l),w(i,s),w(s,o),w(o,r),w(s,a),F(u,s,null),w(i,f),v(y,c,S),v(y,d,S),F(m,d,null),h=!0,g||(_=B(d,"submit",tt(n[7])),g=!0)},p(y,S){(!h||S&2)&&ue(r,y[1]);const T={};S&2&&(T.value=y[1]),u.$set(T);const $={};S&98308&&($.$$scope={dirty:S,ctx:y}),m.$set($)},i(y){h||(O(u.$$.fragment,y),O(m.$$.fragment,y),h=!0)},o(y){D(u.$$.fragment,y),D(m.$$.fragment,y),h=!1},d(y){y&&(k(e),k(t),k(i),k(c),k(d)),q(u),q(m),g=!1,_()}}}function C7(n){let e,t,i,l;return{c(){e=b("h4"),t=Y("Restore "),i=b("strong"),l=Y(n[1]),p(e,"class","popup-title txt-ellipsis svelte-1fcgldh")},m(s,o){v(s,e,o),w(e,t),w(e,i),w(i,l)},p(s,o){o&2&&ue(l,s[1])},d(s){s&&k(e)}}}function O7(n){let e,t,i,l,s,o,r,a;return{c(){e=b("button"),t=Y("Cancel"),i=C(),l=b("button"),s=b("span"),s.textContent="Restore backup",p(e,"type","button"),p(e,"class","btn btn-transparent"),e.disabled=n[4],p(s,"class","txt"),p(l,"type","submit"),p(l,"form",n[6]),p(l,"class","btn btn-expanded"),l.disabled=o=!n[5]||n[4],Q(l,"btn-loading",n[4])},m(u,f){v(u,e,f),w(e,t),v(u,i,f),v(u,l,f),w(l,s),r||(a=B(e,"click",n[0]),r=!0)},p(u,f){f&16&&(e.disabled=u[4]),f&48&&o!==(o=!u[5]||u[4])&&(l.disabled=o),f&16&&Q(l,"btn-loading",u[4])},d(u){u&&(k(e),k(i),k(l)),r=!1,a()}}}function E7(n){let e,t,i={class:"backup-restore-panel",overlayClose:!n[4],escClose:!n[4],beforeHide:n[10],popup:!0,$$slots:{footer:[O7],header:[C7],default:[$7]},$$scope:{ctx:n}};return e=new ln({props:i}),n[11](e),e.$on("show",n[12]),e.$on("hide",n[13]),{c(){H(e.$$.fragment)},m(l,s){F(e,l,s),t=!0},p(l,[s]){const o={};s&16&&(o.overlayClose=!l[4]),s&16&&(o.escClose=!l[4]),s&16&&(o.beforeHide=l[10]),s&65590&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(O(e.$$.fragment,l),t=!0)},o(l){D(e.$$.fragment,l),t=!1},d(l){n[11](null),q(e,l)}}}function M7(n,e,t){let i;const l="backup_restore_"+z.randomString(5);let s,o="",r="",a=!1,u=null;function f(S){Wt({}),t(2,r=""),t(1,o=S),t(4,a=!1),s==null||s.show()}function c(){return s==null?void 0:s.hide()}async function d(){var S;if(!(!i||a)){clearTimeout(u),t(4,a=!0);try{await me.backups.restore(o),u=setTimeout(()=>{window.location.reload()},2e3)}catch(T){clearTimeout(u),T!=null&&T.isAbort||(t(4,a=!1),$i(((S=T.response)==null?void 0:S.message)||T.message))}}}so(()=>{clearTimeout(u)});function m(){r=this.value,t(2,r)}const h=()=>!a;function g(S){ie[S?"unshift":"push"](()=>{s=S,t(3,s)})}function _(S){Pe.call(this,n,S)}function y(S){Pe.call(this,n,S)}return n.$$.update=()=>{n.$$.dirty&6&&t(5,i=r!=""&&o==r)},[c,o,r,s,a,i,l,d,f,m,h,g,_,y]}class D7 extends ye{constructor(e){super(),be(this,e,M7,E7,_e,{show:8,hide:0})}get show(){return this.$$.ctx[8]}get hide(){return this.$$.ctx[0]}}function k1(n,e,t){const i=n.slice();return i[22]=e[t],i}function v1(n,e,t){const i=n.slice();return i[19]=e[t],i}function I7(n){let e=[],t=new Map,i,l,s=pe(n[3]);const o=a=>a[22].key;for(let a=0;a<s.length;a+=1){let u=k1(n,s,a),f=o(u);t.set(f,e[a]=S1(f,u))}let r=null;return s.length||(r=w1()),{c(){for(let a=0;a<e.length;a+=1)e[a].c();i=ge(),r&&r.c()},m(a,u){for(let f=0;f<e.length;f+=1)e[f]&&e[f].m(a,u);v(a,i,u),r&&r.m(a,u),l=!0},p(a,u){u&876&&(s=pe(a[3]),re(),e=kt(e,u,o,1,a,s,t,i.parentNode,zt,S1,i,k1),ae(),!s.length&&r?r.p(a,u):s.length?r&&(r.d(1),r=null):(r=w1(),r.c(),r.m(i.parentNode,i)))},i(a){if(!l){for(let u=0;u<s.length;u+=1)O(e[u]);l=!0}},o(a){for(let u=0;u<e.length;u+=1)D(e[u]);l=!1},d(a){a&&k(i);for(let u=0;u<e.length;u+=1)e[u].d(a);r&&r.d(a)}}}function L7(n){let e,t=pe(Array(n[3].length||1)),i=[];for(let l=0;l<t.length;l+=1)i[l]=T1(v1(n,t,l));return{c(){for(let l=0;l<i.length;l+=1)i[l].c();e=ge()},m(l,s){for(let o=0;o<i.length;o+=1)i[o]&&i[o].m(l,s);v(l,e,s)},p(l,s){if(s&8){t=pe(Array(l[3].length||1));let o;for(o=0;o<t.length;o+=1){const r=v1(l,t,o);i[o]?i[o].p(r,s):(i[o]=T1(),i[o].c(),i[o].m(e.parentNode,e))}for(;o<i.length;o+=1)i[o].d(1);i.length=t.length}},i:te,o:te,d(l){l&&k(e),pt(i,l)}}
2024-09-30 00:23:19 +08:00
Do you really want to upload "${m.name}"?`,()=>{u(m)},()=>{r()})}async function u(m){var g,_,y;if(o||!m)return;t(2,o=!0);const h=new FormData;h.set("file",m);try{await me.backups.upload(h,{requestKey:O1}),t(2,o=!1),i("success"),tn("Successfully uploaded a new backup.")}catch(S){S.isAbort||(t(2,o=!1),(y=(_=(g=S.response)==null?void 0:g.data)==null?void 0:_.file)!=null&&y.message?$i(S.response.data.file.message):me.error(S))}r()}so(()=>{me.cancelRequest(O1)});const f=()=>s==null?void 0:s.click();function c(m){ie[m?"unshift":"push"](()=>{s=m,t(1,s)})}const d=m=>{var h,g;a((g=(h=m==null?void 0:m.target)==null?void 0:h.files)==null?void 0:g[0])};return n.$$set=m=>{"class"in m&&t(0,l=m.class)},[l,s,o,a,f,c,d]}class G7 extends ye{constructor(e){super(),be(this,e,Z7,J7,_e,{class:0})}}function X7(n){let e;return{c(){e=b("i"),p(e,"class","ri-arrow-down-s-line")},m(t,i){v(t,e,i)},d(t){t&&k(e)}}}function Q7(n){let e;return{c(){e=b("i"),p(e,"class","ri-arrow-up-s-line")},m(t,i){v(t,e,i)},d(t){t&&k(e)}}}function E1(n){var V,K,J;let e,t,i,l,s,o,r,a,u,f,c,d,m,h,g,_,y,S,T,$,E,M,L;t=new fe({props:{class:"form-field form-field-toggle m-t-base m-b-0",$$slots:{default:[x7,({uniqueId:ee})=>({31:ee}),({uniqueId:ee})=>[0,ee?1:0]]},$$scope:{ctx:n}}});let I=n[2]&&M1(n);function A(ee){n[24](ee)}function P(ee){n[25](ee)}function R(ee){n[26](ee)}let N={toggleLabel:"Store backups in S3 storage",testFilesystem:"backups",configKey:"backups.s3",originalConfig:(V=n[0].backups)==null?void 0:V.s3};n[1].backups.s3!==void 0&&(N.config=n[1].backups.s3),n[7]!==void 0&&(N.isTesting=n[7]),n[8]!==void 0&&(N.testError=n[8]),r=new fk({props:N}),ie.push(()=>ve(r,"config",A)),ie.push(()=>ve(r,"isTesting",P)),ie.push(()=>ve(r,"testError",R));let U=((J=(K=n[1].backups)==null?void 0:K.s3)==null?void 0:J.enabled)&&!n[9]&&!n[5]&&D1(n),j=n[9]&&I1(n);return{c(){e=b("form"),H(t.$$.fragment),i=C(),I&&I.c(),l=C(),s=b("div"),o=C(),H(r.$$.fragment),c=C(),d=b("div"),m=b("div"),h=C(),U&&U.c(),g=C(),j&&j.c(),_=C(),y=b("button"),S=b("span"),S.textContent="Save changes",p(s,"class","clearfix m-b-base"),p(m,"class","flex-fill"),p(S,"class","txt"),p(y,"type","submit"),p(y,"class","btn btn-expanded"),y.disabled=T=!n[9]||n[5],Q(y,"btn-loading",n[5]),p(d,"class","flex"),p(e,"class","block"),p(e,"autocomplete","off")},m(ee,X){v(ee,e,X),F(t,e,null),w(e,i),I&&I.m(e,null),w(e,l),w(e,s),w(e,o),F(r,e,null),w(e,c),w(e,d),w(d,m),w(d,h),U&&U.m(d,null),w(d,g),j&&j.m(d,null),w(d,_),w(d,y),w(y,S),E=!0,M||(L=[B(y,"click",n[28]),B(e,"submit",tt(n[11]))],M=!0)},p(ee,X){var ke,Ce,We;const oe={};X[0]&4|X[1]&3&&(oe.$$scope={dirty:X,ctx:ee}),t.$set(oe),ee[2]?I?(I.p(ee,X),X[0]&4&&O(I,1)):(I=M1(ee),I.c(),O(I,1),I.m(e,l)):I&&(re(),D(I,1,1,()=>{I=null}),ae());const Se={};X[0]&1&&(Se.originalConfig=(ke=ee[0].backups)==null?void 0:ke.s3),!a&&X[0]&2&&(a=!0,Se.config=ee[1].backups.s3,$e(()=>a=!1)),!u&&X[0]&128&&(u=!0,Se.isTesting=ee[7],$e(()=>u=!1)),!f&&X[0]&256&&(f=!0,Se.testError=ee[8],$e(()=>f=!1)),r.$set(Se),(We=(Ce=ee[1].backups)==null?void 0:Ce.s3)!=null&&We.enabled&&!ee[9]&&!ee[5]?U?U.p(ee,X):(U=D1(ee),U.c(),U.m(d,g)):U&&(U.d(1),U=null),ee[9]?j?j.p(ee,X):(j=I1(ee),j.c(),j.m(d,_)):j&&(j.d(1),j=null),(!E||X[0]&544&&T!==(T=!ee[9]||ee[5]))&&(y.disabled=T),(!E||X[0]&32)&&Q(y,"btn-loading",ee[5])},i(ee){E||(O(t.$$.fragment,ee),O(I),O(r.$$.fragment,ee),ee&&nt(()=>{E&&($||($=ze(e,wt,{duration:150},!0)),$.run(1))}),E=!0)},o(ee){D(t.$$.fragment,ee),D(I),D(r.$$.fragment,ee),ee&&($||($=ze(e,wt,{duration:150},!1)),$.run(0)),E=!1},d(ee){ee&&k(e),q(t),I&&I.d(),q(r),U&&U.d(),j&&j.d(),ee&&$&&$.end(),M=!1,De(L)}}}function x7(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=C(),l=b("label"),s=Y("Enable auto backups"),p(e,"type","checkbox"),p(e,"id",t=n[31]),p(l,"for",o=n[31])},m(u,f){v(u,e,f),e.checked=n[2],v(u,i,f),v(u,l,f),w(l,s),r||(a=B(e,"change",n[17]),r=!0)},p(u,f){f[1]&1&&t!==(t=u[31])&&p(e,"id",t),f[0]&4&&(e.checked=u[2]),f[1]&1&&o!==(o=u[31])&&p(l,"for",o)},d(u){u&&(k(e),k(i),k(l)),r=!1,a()}}}function M1(n){let e,t,i,l,s,o,r,a,u;return l=new fe({props:{class:"form-field required",name:"backups.cron",$$slots:{default:
2024-09-30 00:23:19 +08:00
`),$=b("span"),$.textContent="macros",E=Y(`.
`),M=b("br"),L=Y(`
The timezone is in UTC.`),p(e,"for",i=n[31]),s.required=!0,p(s,"type","text"),p(s,"id",o=n[31]),p(s,"class","txt-lg txt-mono"),p(s,"placeholder","* * * * *"),s.autofocus=r=!((N=(R=n[0])==null?void 0:R.backups)!=null&&N.cron),p(c,"class","txt"),p(m,"class","ri-arrow-drop-down-fill"),p(f,"type","button"),p(f,"class","btn btn-sm btn-outline p-r-0"),p(u,"class","form-field-addon"),p($,"class","link-primary"),p(y,"class","help-block")},m(R,N){var U,j;v(R,e,N),w(e,t),v(R,l,N),v(R,s,N),ce(s,n[1].backups.cron),v(R,a,N),v(R,u,N),w(u,f),w(f,c),w(f,d),w(f,m),w(f,h),F(g,f,null),v(R,_,N),v(R,y,N),w(y,S),w(S,T),w(S,$),w(S,E),w(S,M),w(S,L),I=!0,(j=(U=n[0])==null?void 0:U.backups)!=null&&j.cron||s.focus(),A||(P=[B(s,"input",n[18]),Me(He.call(null,$,`@yearly
@annually
@monthly
@weekly
@daily
@midnight
@hourly`))],A=!0)},p(R,N){var j,V;(!I||N[1]&1&&i!==(i=R[31]))&&p(e,"for",i),(!I||N[1]&1&&o!==(o=R[31]))&&p(s,"id",o),(!I||N[0]&1&&r!==(r=!((V=(j=R[0])==null?void 0:j.backups)!=null&&V.cron)))&&(s.autofocus=r),N[0]&2&&s.value!==R[1].backups.cron&&ce(s,R[1].backups.cron);const U={};N[0]&2|N[1]&2&&(U.$$scope={dirty:N,ctx:R}),g.$set(U)},i(R){I||(O(g.$$.fragment,R),I=!0)},o(R){D(g.$$.fragment,R),I=!1},d(R){R&&(k(e),k(l),k(s),k(a),k(u),k(_),k(y)),q(g),A=!1,De(P)}}}function nR(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Max @auto backups to keep"),l=C(),s=b("input"),p(e,"for",i=n[31]),p(s,"type","number"),p(s,"id",o=n[31]),p(s,"min","1")},m(u,f){v(u,e,f),w(e,t),v(u,l,f),v(u,s,f),ce(s,n[1].backups.cronMaxKeep),r||(a=B(s,"input",n[23]),r=!0)},p(u,f){f[1]&1&&i!==(i=u[31])&&p(e,"for",i),f[1]&1&&o!==(o=u[31])&&p(s,"id",o),f[0]&2&&_t(s.value)!==u[1].backups.cronMaxKeep&&ce(s,u[1].backups.cronMaxKeep)},d(u){u&&(k(e),k(l),k(s)),r=!1,a()}}}function D1(n){let e;function t(s,o){return s[7]?sR:s[8]?lR:iR}let i=t(n),l=i(n);return{c(){l.c(),e=ge()},m(s,o){l.m(s,o),v(s,e,o)},p(s,o){i===(i=t(s))&&l?l.p(s,o):(l.d(1),l=i(s),l&&(l.c(),l.m(e.parentNode,e)))},d(s){s&&k(e),l.d(s)}}}function iR(n){let e;return{c(){e=b("div"),e.innerHTML='<i class="ri-checkbox-circle-line txt-success"></i> <span class="txt">S3 connected successfully</span>',p(e,"class","label label-sm label-success entrance-right")},m(t,i){v(t,e,i)},p:te,d(t){t&&k(e)}}}function lR(n){let e,t,i,l;return{c(){e=b("div"),e.innerHTML='<i class="ri-error-warning-line txt-warning"></i> <span class="txt">Failed to establish S3 connection</span>',p(e,"class","label label-sm label-warning entrance-right")},m(s,o){var r;v(s,e,o),i||(l=Me(t=He.call(null,e,(r=n[8].data)==null?void 0:r.message)),i=!0)},p(s,o){var r;t&&Rt(t.update)&&o[0]&256&&t.update.call(null,(r=s[8].data)==null?void 0:r.message)},d(s){s&&k(e),i=!1,l()}}}function sR(n){let e;return{c(){e=b("span"),p(e,"class","loader loader-sm")},m(t,i){v(t,e,i)},p:te,d(t){t&&k(e)}}}function I1(n){let e,t,i,l,s;return{c(){e=b("button"),t=b("span"),t.textContent="Reset",p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-hint btn-transparent"),e.disabled=i=!n[9]||n[5]},m(o,r){v(o,e,r),w(e,t),l||(s=B(e,"click",n[27]),l=!0)},p(o,r){r[0]&544&&i!==(i=!o[9]||o[5])&&(e.disabled=i)},d(o){o&&k(e),l=!1,s()}}}function oR(n){let e,t,i,l,s,o,r,a,u,f,c,d,m,h,g,_,y,S,T,$,E,M,L,I,A,P,R;m=new Au({props:{class:"btn-sm",tooltip:"Refresh"}}),m.$on("refresh",n[13]),g=new G7({props:{class:"btn-sm"}}),g.$on("success",n[13]);let N={};y=new F7({props:N}),n[15](y);function U(J,ee){return J[6]?Q7:X7}let j=U(n),V=j(n),K=n[6]&&!n[4]&&E1(n);return{c(){e=b("header"),t=b("nav"),i=b("div"),i.textContent="Settings",l=C(),s=b("div"),o=Y(n[10]),r=C(),a=b("div"),u=b("div"),f=b("div"),c=b("span"),c.textContent="Backup and restore your PocketBase data",d=C(),H(m.$$.fragment),h=C(),H(g.$$.fragment),_=C(),H(y.$$.fragment),S=C(),T=b("hr"),$=C(),E=b("button"),M=b("span"),M.textContent="Backups options",L=C(),V.c(),I=C(),K&&K.c(),p(i,"class","breadcrumb-item"),p(s,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(e,"class","page-header"),p(c,"class","txt-xl"),p(f,"class","flex m-b-sm flex-gap-10"),p(M,"class","txt"),p(E,"type","button"),p(E,"class","btn btn-secondary"),E.disabled=n[4],Q(E,"btn-loading",n[4]),p(u,"class","panel"),p(u,"autocomplete","off"),p(a,"class","wrapper")},m(J,ee){v(J,e,ee),w(e,t),w(t,i),w(t,l),w(t,s),w(s,o),v(J,r,ee),v(J,a,ee),w(a,u),w(u,f),w(f,c),w(f,d),F(m,f,null),w(f,h),F(g,f,null),w(u,_),F(y,u,null),w(u,S),w(u,T),w(u,$),w(u,E),w(E,M),w(E,L),V.m(E,null),w(u,I),K&&K.m(u,null),A=!0,P||(R=[B(E,"click",n[16]),B(u,"submit",tt(n[11]))],P=!0)},p(J,ee){(!A||ee[0]&1024)&&ue(o,J[10]);const X={};y.$set(X),j!==(j=U(J))&&(V.d(1),V=j(J),V&&(V.c(),V.m(E,null))),(!A||ee[0]&16)&&(E.disabled=J[4]),(!A||ee[0]&16)&&Q(E,"btn-loading",J[4]),J[6]&&!J[4]?K?(K.p(J,ee),ee[0]&80&&O(K,1)):(K=E1(J),K.c(),O(K,1),K.m(u,null)):K&&(re(),D(K,1,1,()=>{K=null}),ae())},i(J){A||(O(m.$$.fragment,J),O(g.$$.fragment,J),O(y.$$.fragment,J),O(K),A=!0)},o(J){D(m.$$.fragment,J),D(g.$$.f
another PocketBase environment.</p>`,t=C(),i=b("div"),l=b("div"),s=b("div"),H(o.$$.fragment),r=C();for(let K=0;K<a.length;K+=1)a[K].c();f=C(),c=b("div"),d=b("button"),m=b("span"),m.textContent="Copy",g=C(),_=b("pre"),y=Y(n[6]),S=C(),T=b("div"),$=b("div"),E=C(),M=b("button"),L=b("i"),I=C(),A=b("span"),A.textContent="Download as JSON",p(e,"class","content txt-xl m-b-base"),p(s,"class","list-item list-item-section"),p(l,"class","export-list"),p(m,"class","txt"),p(d,"type","button"),p(d,"class","btn btn-sm btn-transparent fade copy-schema"),d.disabled=h=!n[2],p(_,"class","code-wrapper"),p(c,"tabindex","0"),p(c,"class","export-preview"),p(i,"class","export-panel"),p($,"class","flex-fill"),p(L,"class","ri-download-line"),p(A,"class","txt"),p(M,"type","button"),p(M,"class","btn btn-expanded"),M.disabled=P=!n[2],p(T,"class","flex m-t-base")},m(K,J){v(K,e,J),v(K,t,J),v(K,i,J),w(i,l),w(l,s),F(o,s,null),w(l,r);for(let ee=0;ee<a.length;ee+=1)a[ee]&&a[ee].m(l,null);w(i,f),w(i,c),w(c,d),w(d,m),w(c,g),w(c,_),w(_,y),n[16](c),v(K,S,J),v(K,T,J),w(T,$),w(T,E),w(T,M),w(M,L),w(M,I),w(M,A),R=!0,N||(U=[B(d,"click",n[15]),B(c,"keydown",n[17]),B(M,"click",n[18])],N=!0)},p(K,J){const ee={};J&33558561&&(ee.$$scope={dirty:J,ctx:K}),o.$set(ee),J&6147&&(j=pe(K[0]),re(),a=kt(a,J,V,1,K,j,u,l,zt,A1,null,L1),ae()),(!R||J&4&&h!==(h=!K[2]))&&(d.disabled=h),(!R||J&64)&&ue(y,K[6]),(!R||J&4&&P!==(P=!K[2]))&&(M.disabled=P)},i(K){if(!R){O(o.$$.fragment,K);for(let J=0;J<j.length;J+=1)O(a[J]);R=!0}},o(K){D(o.$$.fragment,K);for(let J=0;J<a.length;J+=1)D(a[J]);R=!1},d(K){K&&(k(e),k(t),k(i),k(S),k(T)),q(o);for(let J=0;J<a.length;J+=1)a[J].d();n[16](null),N=!1,De(U)}}}function cR(n){let e;return{c(){e=b("div"),p(e,"class","loader")},m(t,i){v(t,e,i)},p:te,i:te,o:te,d(t){t&&k(e)}}}function dR(n){let e,t,i,l,s,o,r,a,u;return{c(){e=b("input"),l=C(),s=b("label"),o=Y("Select all"),p(e,"type","checkbox"),p(e,"id",t=n[12]),e.disabled=i=!n[0].length,e.checked=n[5],p(s,"for",r=n[12])},m(f,c){v(f,e,c),v(f,l,c),v(f,s,c),w(s,o),a||(u=B(e,"change",n[13]),a=!0)},p(f,c){c&4096&&t!==(t=f[12])&&p(e,"id",t),c&1&&i!==(i=!f[0].length)&&(e.disabled=i),c&32&&(e.checked=f[5]),c&4096&&r!==(r=f[12])&&p(s,"for",r)},d(f){f&&(k(e),k(l),k(s)),a=!1,u()}}}function pR(n){let e,t,i,l,s,o=n[22].name+"",r,a,u,f,c;function d(){return n[14](n[22])}return{c(){e=b("input"),l=C(),s=b("label"),r=Y(o),p(e,"type","checkbox"),p(e,"id",t=n[12]),e.checked=i=n[1][n[22].id],p(s,"for",a=n[12]),p(s,"title",u=n[22].name)},m(m,h){v(m,e,h),v(m,l,h),v(m,s,h),w(s,r),f||(c=B(e,"change",d),f=!0)},p(m,h){n=m,h&4096&&t!==(t=n[12])&&p(e,"id",t),h&3&&i!==(i=n[1][n[22].id])&&(e.checked=i),h&1&&o!==(o=n[22].name+"")&&ue(r,o),h&4096&&a!==(a=n[12])&&p(s,"for",a),h&1&&u!==(u=n[22].name)&&p(s,"title",u)},d(m){m&&(k(e),k(l),k(s)),f=!1,c()}}}function A1(n,e){let t,i,l,s;return i=new fe({props:{class:"form-field",$$slots:{default:[pR,({uniqueId:o})=>({12:o}),({uniqueId:o})=>o?4096:0]},$$scope:{ctx:e}}}),{key:n,first:null,c(){t=b("div"),H(i.$$.fragment),l=C(),p(t,"class","list-item list-item-collection"),this.first=t},m(o,r){v(o,t,r),F(i,t,null),w(t,l),s=!0},p(o,r){e=o;const a={};r&33558531&&(a.$$scope={dirty:r,ctx:e}),i.$set(a)},i(o){s||(O(i.$$.fragment,o),s=!0)},o(o){D(i.$$.fragment,o),s=!1},d(o){o&&k(t),q(i)}}}function mR(n){let e,t,i,l,s,o,r,a,u,f,c,d;const m=[cR,fR],h=[];function g(_,y){return _[4]?0:1}return f=g(n),c=h[f]=m[f](n),{c(){e=b("header"),t=b("nav"),i=b("div"),i.textContent="Settings",l=C(),s=b("div"),o=Y(n[7]),r=C(),a=b("div"),u=b("div"),c.c(),p(i,"class","breadcrumb-item"),p(s,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(e,"class","page-header"),p(u,"class","panel"),p(a,"class","wrapper")},m(_,y){v(_,e,y),w(e,t),w(t,i),w(t,l),w(t,s),w(s,o),v(_,r,y),v(_,a,y),w(a,u),h[f].m(u,null),d=!0},p(_,y){(!d||y&128)&&ue(o,_[7]);let S=f;f=g(_),f===S?h[f].p(_,y):(re(),D(h[S],1,1,()=>{h[S]=null}),ae(),c=h[f],c?c.p(_,y):(c=h[f]=m[f](_),c.c()),O(c,1),c.m(u,null))},i(_){d||(O(c),d=!0)},o(_){D(c),d=!1},d(_){_&&(k(e),k(r),k(a)),h[f].d()}}}function hR(n){let e,t,i,l;return e=new ps({}),i=new di({props:{$$s
2024-09-30 00:23:19 +08:00
- ${$.join(`
- `)}`,()=>{h()}):h()}async function h(){if(!u){t(4,u=!0);try{await me.collections.import(o,a),tn("Successfully imported collections configuration."),i("submit")}catch($){me.error($)}t(4,u=!1),c()}}const g=()=>m(),_=()=>!u;function y($){ie[$?"unshift":"push"](()=>{l=$,t(1,l)})}function S($){Pe.call(this,n,$)}function T($){Pe.call(this,n,$)}return n.$$.update=()=>{n.$$.dirty&384&&Array.isArray(s)&&Array.isArray(o)&&d()},[c,l,r,a,u,m,f,s,o,g,_,y,S,T]}class MR extends ye{constructor(e){super(),be(this,e,ER,OR,_e,{show:6,hide:0})}get show(){return this.$$.ctx[6]}get hide(){return this.$$.ctx[0]}}function eb(n,e,t){const i=n.slice();return i[33]=e[t],i}function tb(n,e,t){const i=n.slice();return i[36]=e[t],i}function nb(n,e,t){const i=n.slice();return i[33]=e[t],i}function DR(n){let e,t,i,l,s,o,r,a,u,f,c,d,m,h,g,_,y,S,T,$,E,M,L,I;a=new fe({props:{class:"form-field "+(n[6]?"":"field-error"),name:"collections",$$slots:{default:[LR,({uniqueId:V})=>({41:V}),({uniqueId:V})=>[0,V?1024:0]]},$$scope:{ctx:n}}});let A=n[1].length&&lb(n),P=!1,R=n[6]&&n[1].length&&!n[7]&&sb(),N=n[6]&&n[1].length&&n[7]&&ob(n),U=n[13].length&&gb(n),j=!!n[0]&&bb(n);return{c(){e=b("input"),t=C(),i=b("div"),l=b("p"),s=Y(`Paste below the collections configuration you want to import or
`),o=b("button"),o.innerHTML='<span class="txt">Load from JSON file</span>',r=C(),H(a.$$.fragment),u=C(),A&&A.c(),f=C(),c=C(),R&&R.c(),d=C(),N&&N.c(),m=C(),U&&U.c(),h=C(),g=b("div"),j&&j.c(),_=C(),y=b("div"),S=C(),T=b("button"),$=b("span"),$.textContent="Review",p(e,"type","file"),p(e,"class","hidden"),p(e,"accept",".json"),p(o,"class","btn btn-outline btn-sm m-l-5"),Q(o,"btn-loading",n[12]),p(i,"class","content txt-xl m-b-base"),p(y,"class","flex-fill"),p($,"class","txt"),p(T,"type","button"),p(T,"class","btn btn-expanded btn-warning m-l-auto"),T.disabled=E=!n[14],p(g,"class","flex m-t-base")},m(V,K){v(V,e,K),n[21](e),v(V,t,K),v(V,i,K),w(i,l),w(l,s),w(l,o),v(V,r,K),F(a,V,K),v(V,u,K),A&&A.m(V,K),v(V,f,K),v(V,c,K),R&&R.m(V,K),v(V,d,K),N&&N.m(V,K),v(V,m,K),U&&U.m(V,K),v(V,h,K),v(V,g,K),j&&j.m(g,null),w(g,_),w(g,y),w(g,S),w(g,T),w(T,$),M=!0,L||(I=[B(e,"change",n[22]),B(o,"click",n[23]),B(T,"click",n[19])],L=!0)},p(V,K){(!M||K[0]&4096)&&Q(o,"btn-loading",V[12]);const J={};K[0]&64&&(J.class="form-field "+(V[6]?"":"field-error")),K[0]&65|K[1]&3072&&(J.$$scope={dirty:K,ctx:V}),a.$set(J),V[1].length?A?(A.p(V,K),K[0]&2&&O(A,1)):(A=lb(V),A.c(),O(A,1),A.m(f.parentNode,f)):A&&(re(),D(A,1,1,()=>{A=null}),ae()),V[6]&&V[1].length&&!V[7]?R||(R=sb(),R.c(),R.m(d.parentNode,d)):R&&(R.d(1),R=null),V[6]&&V[1].length&&V[7]?N?N.p(V,K):(N=ob(V),N.c(),N.m(m.parentNode,m)):N&&(N.d(1),N=null),V[13].length?U?U.p(V,K):(U=gb(V),U.c(),U.m(h.parentNode,h)):U&&(U.d(1),U=null),V[0]?j?j.p(V,K):(j=bb(V),j.c(),j.m(g,_)):j&&(j.d(1),j=null),(!M||K[0]&16384&&E!==(E=!V[14]))&&(T.disabled=E)},i(V){M||(O(a.$$.fragment,V),O(A),O(P),M=!0)},o(V){D(a.$$.fragment,V),D(A),D(P),M=!1},d(V){V&&(k(e),k(t),k(i),k(r),k(u),k(f),k(c),k(d),k(m),k(h),k(g)),n[21](null),q(a,V),A&&A.d(V),R&&R.d(V),N&&N.d(V),U&&U.d(V),j&&j.d(),L=!1,De(I)}}}function IR(n){let e;return{c(){e=b("div"),p(e,"class","loader")},m(t,i){v(t,e,i)},p:te,i:te,o:te,d(t){t&&k(e)}}}function ib(n){let e;return{c(){e=b("div"),e.textContent="Invalid collections configuration.",p(e,"class","help-block help-block-error")},m(t,i){v(t,e,i)},d(t){t&&k(e)}}}function LR(n){let e,t,i,l,s,o,r,a,u,f,c=!!n[0]&&!n[6]&&ib();return{c(){e=b("label"),t=Y("Collections"),l=C(),s=b("textarea"),r=C(),c&&c.c(),a=ge(),p(e,"for",i=n[41]),p(e,"class","p-b-10"),p(s,"id",o=n[41]),p(s,"class","code"),p(s,"spellcheck","false"),p(s,"rows","15"),s.required=!0},m(d,m){v(d,e,m),w(e,t),v(d,l,m),v(d,s,m),ce(s,n[0]),v(d,r,m),c&&c.m(d,m),v(d,a,m),u||(f=B(s,"input",n[24]),u=!0)},p(d,m){m[1]&1024&&i!==(i=d[41])&&p(e,"for",i),m[1]&1024&&o!==(o=d[41])&&p(s,"id",o),m[0]&1&&ce(s,d[0]),d[0]&&!d[6]?c||(c=ib(),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(d){d&&(k(e),k(l),k(s),k(r),k(a)),c&&c.d(d),u=!1,f()}}}function lb(n){let e,t;return e=new fe({props:{class:"form-field form-field-toggle",$$slots:{default:[AR,({uniqueId:i})=>({41:i}),({uniqueId:i})=>[0,i?1024:0]]},$$scope:{ctx:n}}}),{c(){H(e.$$.fragment)},m(i,l){F(e,i,l),t=!0},p(i,l){const s={};l[0]&96|l[1]&3072&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(O(e.$$.fragment,i),t=!0)},o(i){D(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function AR(n){let e,t,i,l,s,o,r,a,u;return{c(){e=b("input"),l=C(),s=b("label"),o=Y("Merge with the existing collections"),p(e,"type","checkbox"),p(e,"id",t=n[41]),e.disabled=i=!n[6],p(s,"for",r=n[41])},m(f,c){v(f,e,c),e.checked=n[5],v(f,l,c),v(f,s,c),w(s,o),a||(u=B(e,"change",n[25]),a=!0)},p(f,c){c[1]&1024&&t!==(t=f[41])&&p(e,"id",t),c[0]&64&&i!==(i=!f[6])&&(e.disabled=i),c[0]&32&&(e.checked=f[5]),c[1]&1024&&r!==(r=f[41])&&p(s,"for",r)},d(f){f&&(k(e),k(l),k(s)),a=!1,u()}}}function sb(n){let e;return{c(){e=b("div"),e.innerHTML='<div class="icon"><i class="ri-information-line"></i></div> <div class="content"><string>Your collections configuration is already up-to-date!</string></div>',p(e,"class","alert alert-info")},m(t,i){v(t,e,i)},d(t){t&&k(e)}}}function ob(n){let e,t,i,l,s,o=n[9].length&&rb(n),r=n[3].length&&fb(n),a=n[8].length&&mb(n);return{c(){e=b("h5"),e.textContent="Detected changes",t=C(),i=b("div"),o&&o.c(),l=C(),r&&r.c(),s=C(),a&&a.c(),p(e,"class"
2024-09-30 00:23:19 +08:00
imported with different IDs. You can replace them in the import if you want
to.</string>`,s=C(),o=b("button"),o.innerHTML='<span class="txt">Replace with original ids</span>',p(t,"class","icon"),p(l,"class","content"),p(o,"type","button"),p(o,"class","btn btn-warning btn-sm btn-outline"),p(e,"class","alert alert-warning m-t-base")},m(u,f){v(u,e,f),w(e,t),w(e,i),w(e,l),w(e,s),w(e,o),r||(a=B(o,"click",n[27]),r=!0)},p:te,d(u){u&&k(e),r=!1,a()}}}function bb(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='<span class="txt">Clear</span>',p(e,"type","button"),p(e,"class","btn btn-transparent link-hint")},m(l,s){v(l,e,s),t||(i=B(e,"click",n[28]),t=!0)},p:te,d(l){l&&k(e),t=!1,i()}}}function PR(n){let e,t,i,l,s,o,r,a,u,f,c,d;const m=[IR,DR],h=[];function g(_,y){return _[4]?0:1}return f=g(n),c=h[f]=m[f](n),{c(){e=b("header"),t=b("nav"),i=b("div"),i.textContent="Settings",l=C(),s=b("div"),o=Y(n[15]),r=C(),a=b("div"),u=b("div"),c.c(),p(i,"class","breadcrumb-item"),p(s,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(e,"class","page-header"),p(u,"class","panel"),p(a,"class","wrapper")},m(_,y){v(_,e,y),w(e,t),w(t,i),w(t,l),w(t,s),w(s,o),v(_,r,y),v(_,a,y),w(a,u),h[f].m(u,null),d=!0},p(_,y){(!d||y[0]&32768)&&ue(o,_[15]);let S=f;f=g(_),f===S?h[f].p(_,y):(re(),D(h[S],1,1,()=>{h[S]=null}),ae(),c=h[f],c?c.p(_,y):(c=h[f]=m[f](_),c.c()),O(c,1),c.m(u,null))},i(_){d||(O(c),d=!0)},o(_){D(c),d=!1},d(_){_&&(k(e),k(r),k(a)),h[f].d()}}}function NR(n){let e,t,i,l,s,o;e=new ps({}),i=new di({props:{$$slots:{default:[PR]},$$scope:{ctx:n}}});let r={};return s=new MR({props:r}),n[29](s),s.$on("submit",n[18]),{c(){H(e.$$.fragment),t=C(),H(i.$$.fragment),l=C(),H(s.$$.fragment)},m(a,u){F(e,a,u),v(a,t,u),F(i,a,u),v(a,l,u),F(s,a,u),o=!0},p(a,u){const f={};u[0]&63487|u[1]&2048&&(f.$$scope={dirty:u,ctx:a}),i.$set(f);const c={};s.$set(c)},i(a){o||(O(e.$$.fragment,a),O(i.$$.fragment,a),O(s.$$.fragment,a),o=!0)},o(a){D(e.$$.fragment,a),D(i.$$.fragment,a),D(s.$$.fragment,a),o=!1},d(a){a&&(k(t),k(l)),q(e,a),q(i,a),n[29](null),q(s,a)}}}function RR(n,e,t){let i,l,s,o,r,a,u;Qe(n,cn,oe=>t(15,u=oe)),Nn(cn,u="Import collections",u);let f,c,d="",m=!1,h=[],g=[],_=!0,y=[],S=!1,T=!1;$();async function $(){var oe;t(4,S=!0);try{t(20,g=await me.collections.getFullList(200));for(let Se of g)delete Se.created,delete Se.updated,(oe=Se.oauth2)==null||delete oe.providers}catch(Se){me.error(Se)}t(4,S=!1)}function E(){if(t(3,y=[]),!!i)for(let oe of h){const Se=z.findByKey(g,"id",oe.id);!(Se!=null&&Se.id)||!z.hasCollectionChanges(Se,oe,_)||y.push({new:oe,old:Se})}}function M(){t(1,h=[]);try{t(1,h=JSON.parse(d))}catch{}Array.isArray(h)?t(1,h=z.filterDuplicatesByKey(h)):t(1,h=[]);for(let oe of h)delete oe.created,delete oe.updated,oe.fields=z.filterDuplicatesByKey(oe.fields)}function L(){for(let oe of h){const Se=z.findByKey(g,"name",oe.name)||z.findByKey(g,"id",oe.id);if(!Se)continue;const ke=oe.id,Ce=Se.id;oe.id=Ce;const We=Array.isArray(Se.fields)?Se.fields:[],st=Array.isArray(oe.fields)?oe.fields:[];for(const et of st){const Be=z.findByKey(We,"name",et.name);Be&&Be.id&&(et.id=Be.id)}for(let et of h)if(Array.isArray(et.fields))for(let Be of et.fields)Be.collectionId&&Be.collectionId===ke&&(Be.collectionId=Ce)}t(0,d=JSON.stringify(h,null,4))}function I(oe){t(12,m=!0);const Se=new FileReader;Se.onload=async ke=>{t(12,m=!1),t(10,f.value="",f),t(0,d=ke.target.result),await fn(),h.length||($i("Invalid collections configuration."),A())},Se.onerror=ke=>{console.warn(ke),$i("Failed to load the imported JSON."),t(12,m=!1),t(10,f.value="",f)},Se.readAsText(oe)}function A(){t(0,d=""),t(10,f.value="",f),Wt({})}function P(){const oe=T?z.filterDuplicatesByKey(g.concat(h)):h;c==null||c.show(g,oe,_)}function R(oe){ie[oe?"unshift":"push"](()=>{f=oe,t(10,f)})}const N=()=>{f.files.length&&I(f.files[0])},U=()=>{f.click()};function j(){d=this.value,t(0,d)}function V(){T=this.checked,t(5,T)}function K(){_=this.checked,t(2,_)}const J=()=>L(),ee=()=>A();function X(oe){ie[oe?"unshift":"push"](()=>{c=oe,t(11,c)})}return n.$$.update=()=>{n.$$.dirty[0]&33&&typeof d<"u"&&T!==null&&M(),n.$$.dirty[0]&3&&t(6,i=!!d&&h.length&&h.length===h.filter(oe=>!!
2024-09-30 00:23:19 +08:00
from the
`),r=b("strong"),u=Y(a),f=Y(`
to the
`),c=b("strong"),m=Y(d),h=Y(`.
`),g=b("br"),_=Y(`
There are numerous command line tools that can help you, such as:
`),y=b("a"),y.textContent=`rclone
`,S=Y(`,
`),T=b("a"),T.textContent=`s5cmd
`,$=Y(", etc."),E=C(),M=b("div"),p(i,"class","icon"),p(y,"href","https://github.com/rclone/rclone"),p(y,"target","_blank"),p(y,"rel","noopener noreferrer"),p(y,"class","txt-bold"),p(T,"href","https://github.com/peak/s5cmd"),p(T,"target","_blank"),p(T,"rel","noopener noreferrer"),p(T,"class","txt-bold"),p(s,"class","content"),p(t,"class","alert alert-warning m-0"),p(M,"class","clearfix m-t-base")},m(P,R){v(P,e,R),w(e,t),w(t,i),w(t,l),w(t,s),w(s,o),w(s,r),w(r,u),w(s,f),w(s,c),w(c,m),w(s,h),w(s,g),w(s,_),w(s,y),w(s,S),w(s,T),w(s,$),w(e,E),w(e,M),I=!0},p(P,R){var N;(!I||R&1)&&a!==(a=(N=P[0].s3)!=null&&N.enabled?"S3 storage":"local file system")&&ue(u,a),(!I||R&2)&&d!==(d=P[1].s3.enabled?"S3 storage":"local file system")&&ue(m,d)},i(P){I||(P&&nt(()=>{I&&(L||(L=ze(e,wt,{duration:150},!0)),L.run(1))}),I=!0)},o(P){P&&(L||(L=ze(e,wt,{duration:150},!1)),L.run(0)),I=!1},d(P){P&&k(e),P&&L&&L.end()}}}function oF(n){var i;let e,t=((i=n[0].s3)==null?void 0:i.enabled)!=n[1].s3.enabled&&vb(n);return{c(){t&&t.c(),e=ge()},m(l,s){t&&t.m(l,s),v(l,e,s)},p(l,s){var o;((o=l[0].s3)==null?void 0:o.enabled)!=l[1].s3.enabled?t?(t.p(l,s),s&3&&O(t,1)):(t=vb(l),t.c(),O(t,1),t.m(e.parentNode,e)):t&&(re(),D(t,1,1,()=>{t=null}),ae())},d(l){l&&k(e),t&&t.d(l)}}}function wb(n){let e;function t(s,o){return s[4]?uF:s[5]?aF:rF}let i=t(n),l=i(n);return{c(){l.c(),e=ge()},m(s,o){l.m(s,o),v(s,e,o)},p(s,o){i===(i=t(s))&&l?l.p(s,o):(l.d(1),l=i(s),l&&(l.c(),l.m(e.parentNode,e)))},d(s){s&&k(e),l.d(s)}}}function rF(n){let e;return{c(){e=b("div"),e.innerHTML='<i class="ri-checkbox-circle-line txt-success"></i> <span class="txt">S3 connected successfully</span>',p(e,"class","label label-sm label-success entrance-right")},m(t,i){v(t,e,i)},p:te,d(t){t&&k(e)}}}function aF(n){let e,t,i,l;return{c(){e=b("div"),e.innerHTML='<i class="ri-error-warning-line txt-warning"></i> <span class="txt">Failed to establish S3 connection</span>',p(e,"class","label label-sm label-warning entrance-right")},m(s,o){var r;v(s,e,o),i||(l=Me(t=He.call(null,e,(r=n[5].data)==null?void 0:r.message)),i=!0)},p(s,o){var r;t&&Rt(t.update)&&o&32&&t.update.call(null,(r=s[5].data)==null?void 0:r.message)},d(s){s&&k(e),i=!1,l()}}}function uF(n){let e;return{c(){e=b("span"),p(e,"class","loader loader-sm")},m(t,i){v(t,e,i)},p:te,d(t){t&&k(e)}}}function Sb(n){let e,t,i,l;return{c(){e=b("button"),t=b("span"),t.textContent="Reset",p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-transparent btn-hint"),e.disabled=n[3]},m(s,o){v(s,e,o),w(e,t),i||(l=B(e,"click",n[14]),i=!0)},p(s,o){o&8&&(e.disabled=s[3])},d(s){s&&k(e),i=!1,l()}}}function fF(n){let e,t,i,l,s,o,r,a,u,f,c,d,m,h,g,_;const y=[sF,lF],S=[];function T($,E){return $[2]?0:1}return d=T(n),m=S[d]=y[d](n),{c(){e=b("header"),t=b("nav"),i=b("div"),i.textContent="Settings",l=C(),s=b("div"),o=Y(n[7]),r=C(),a=b("div"),u=b("form"),f=b("div"),f.innerHTML="<p>By default PocketBase uses the local file system to store uploaded files.</p> <p>If you have limited disk space, you could optionally connect to an S3 compatible storage.</p>",c=C(),m.c(),p(i,"class","breadcrumb-item"),p(s,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(e,"class","page-header"),p(f,"class","content txt-xl m-b-base"),p(u,"class","panel"),p(u,"autocomplete","off"),p(a,"class","wrapper")},m($,E){v($,e,E),w(e,t),w(t,i),w(t,l),w(t,s),w(s,o),v($,r,E),v($,a,E),w(a,u),w(u,f),w(u,c),S[d].m(u,null),h=!0,g||(_=B(u,"submit",tt(n[16])),g=!0)},p($,E){(!h||E&128)&&ue(o,$[7]);let M=d;d=T($),d===M?S[d].p($,E):(re(),D(S[M],1,1,()=>{S[M]=null}),ae(),m=S[d],m?m.p($,E):(m=S[d]=y[d]($),m.c()),O(m,1),m.m(u,null))},i($){h||(O(m),h=!0)},o($){D(m),h=!1},d($){$&&(k(e),k(r),k(a)),S[d].d(),g=!1,_()}}}function cF(n){let e,t,i,l;return e=new ps({}),i=new di({props:{$$slots:{default:[fF]},$$scope:{ctx:n}}}),{c(){H(e.$$.fragment),t=C(),H(i.$$.fragment)},m(s,o){F(e,s,o),v(s,t,o),F(i,s,o),l=!0},p(s,[o]){const r={};o&524543&&(r.$$scope={dirty:o,ctx:s}),i.$set(r)},i(s){l||(O(e.$$.fragment,s),O(i.$$.fragment,s),l=!0)},o(s){D(e.$$.fragment,s),D(i.$$.fragment,s),l=!1},d(s){s&&k(t),
One-time password (OTP).`),p(e,"class","content txt-center m-b-sm")},m(r,a){v(r,e,a),w(e,t),w(t,i),w(t,l),w(l,s),w(t,o)},p(r,a){a&2048&&ue(s,r[11])},d(r){r&&k(e)}}}function kF(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("One-time password"),l=C(),s=b("input"),p(e,"for",i=n[25]),p(s,"type","password"),p(s,"id",o=n[25]),s.required=!0},m(u,f){v(u,e,f),w(e,t),v(u,l,f),v(u,s,f),ce(s,n[12]),r||(a=B(s,"input",n[19]),r=!0)},p(u,f){f&33554432&&i!==(i=u[25])&&p(e,"for",i),f&33554432&&o!==(o=u[25])&&p(s,"id",o),f&4096&&s.value!==u[12]&&ce(s,u[12])},d(u){u&&(k(e),k(l),k(s)),r=!1,a()}}}function vF(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Email"),l=C(),s=b("input"),p(e,"for",i=n[25]),p(s,"type","email"),p(s,"id",o=n[25]),s.required=!0},m(u,f){v(u,e,f),w(e,t),v(u,l,f),v(u,s,f),ce(s,n[11]),r||(a=B(s,"input",n[18]),r=!0)},p(u,f){f&33554432&&i!==(i=u[25])&&p(e,"for",i),f&33554432&&o!==(o=u[25])&&p(s,"id",o),f&2048&&s.value!==u[11]&&ce(s,u[11])},d(u){u&&(k(e),k(l),k(s)),r=!1,a()}}}function wF(n){let e,t=z.sentenize(n[0].password.identityFields.join(" or "),!1)+"",i,l,s,o,r,a,u,f;return{c(){e=b("label"),i=Y(t),s=C(),o=b("input"),p(e,"for",l=n[25]),p(o,"id",r=n[25]),p(o,"type",a=n[0].password.identityFields.length==1&&n[0].password.identityFields[0]=="email"?"email":"text"),o.value=n[5],o.required=!0,o.autofocus=!0},m(c,d){v(c,e,d),w(e,i),v(c,s,d),v(c,o,d),o.focus(),u||(f=B(o,"input",n[16]),u=!0)},p(c,d){d&1&&t!==(t=z.sentenize(c[0].password.identityFields.join(" or "),!1)+"")&&ue(i,t),d&33554432&&l!==(l=c[25])&&p(e,"for",l),d&33554432&&r!==(r=c[25])&&p(o,"id",r),d&1&&a!==(a=c[0].password.identityFields.length==1&&c[0].password.identityFields[0]=="email"?"email":"text")&&p(o,"type",a),d&32&&o.value!==c[5]&&(o.value=c[5])},d(c){c&&(k(e),k(s),k(o)),u=!1,f()}}}function SF(n){let e,t,i,l,s,o,r,a,u,f,c;return{c(){e=b("label"),t=Y("Password"),l=C(),s=b("input"),r=C(),a=b("div"),u=b("a"),u.textContent="Forgotten password?",p(e,"for",i=n[25]),p(s,"type","password"),p(s,"id",o=n[25]),s.required=!0,p(u,"href","/request-password-reset"),p(u,"class","link-hint"),p(a,"class","help-block")},m(d,m){v(d,e,m),w(e,t),v(d,l,m),v(d,s,m),ce(s,n[6]),v(d,r,m),v(d,a,m),w(a,u),f||(c=[B(s,"input",n[17]),Me(Un.call(null,u))],f=!0)},p(d,m){m&33554432&&i!==(i=d[25])&&p(e,"for",i),m&33554432&&o!==(o=d[25])&&p(s,"id",o),m&64&&s.value!==d[6]&&ce(s,d[6])},d(d){d&&(k(e),k(l),k(s),k(r),k(a)),f=!1,De(c)}}}function TF(n){let e,t,i,l,s,o,r,a,u=n[2]>1&&Tb(n);const f=[gF,_F,hF],c=[];function d(m,h){return m[10]?0:m[0].password.enabled&&!m[3]?1:m[0].otp.enabled?2:-1}return~(s=d(n))&&(o=c[s]=f[s](n)),{c(){e=b("div"),t=b("h4"),i=Y(`Superuser login
`),u&&u.c(),l=C(),o&&o.c(),r=ge(),p(e,"class","content txt-center m-b-base")},m(m,h){v(m,e,h),w(e,t),w(t,i),u&&u.m(t,null),v(m,l,h),~s&&c[s].m(m,h),v(m,r,h),a=!0},p(m,h){m[2]>1?u?u.p(m,h):(u=Tb(m),u.c(),u.m(t,null)):u&&(u.d(1),u=null);let g=s;s=d(m),s===g?~s&&c[s].p(m,h):(o&&(re(),D(c[g],1,1,()=>{c[g]=null}),ae()),~s?(o=c[s],o?o.p(m,h):(o=c[s]=f[s](m),o.c()),O(o,1),o.m(r.parentNode,r)):o=null)},i(m){a||(O(o),a=!0)},o(m){D(o),a=!1},d(m){m&&(k(e),k(l),k(r)),u&&u.d(),~s&&c[s].d(m)}}}function $F(n){let e,t;return e=new ny({props:{$$slots:{default:[TF]},$$scope:{ctx:n}}}),{c(){H(e.$$.fragment)},m(i,l){F(e,i,l),t=!0},p(i,[l]){const s={};l&67117055&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(O(e.$$.fragment,i),t=!0)},o(i){D(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function CF(n,e,t){let i;Qe(n,Lu,N=>t(22,i=N));const l=new URLSearchParams(i);let s=l.get("demoEmail")||"",o=l.get("demoPassword")||"",r={},a=1,u=1,f=!1,c=!1,d=!1,m=!1,h="",g="",_="",y="",S="";T();async function T(){if(!m){t(10,m=!0);try{t(0,r=await me.collection("_superusers").listAuthMethods())}catch(N){me.error(N)}t(10,m=!1)}}async function $(){var N,U;if(!f){t(7,f=!0);try{await me.collection("_superusers").authWithPassword(s,o),Ds(),Wt({}),Il("/")}catch(j){j.status==401?(t(3,h=j.response.mfaId),((U=(N=r==null?void 0:r.password)==null?void 0:N.identityFields)==null?void 0:U.length)==1&&r.password.identityFields[0]=="email"?(t(11,y=s),await E()):/^[^@\s]+@[^@\s]+$/.test(s)&&t(11,y=s)):j.status!=400?me.error(j):$i("Invalid login credentials.")}t(7,f=!1)}}async function E(){if(!c){t(8,c=!0);try{const N=await me.collection("_superusers").requestOTP(y);t(4,g=N.otpId),_=g,Ds(),Wt({})}catch(N){N.status==429&&t(4,g=_),me.error(N)}t(8,c=!1)}}async function M(){if(!d){t(9,d=!0);try{await me.collection("_superusers").authWithOTP(g,S,{mfaId:h}),Ds(),Wt({}),Il("/")}catch(N){me.error(N)}t(9,d=!1)}}const L=N=>{t(5,s=N.target.value)};function I(){o=this.value,t(6,o)}function A(){y=this.value,t(11,y)}function P(){S=this.value,t(12,S)}const R=()=>{t(4,g="")};return n.$$.update=()=>{var N,U;n.$$.dirty&31&&(t(2,u=1),t(1,a=1),(N=r==null?void 0:r.mfa)!=null&&N.enabled&&t(2,u++,u),(U=r==null?void 0:r.otp)!=null&&U.enabled&&t(2,u++,u),h!=""&&t(1,a++,a),g!=""&&t(1,a++,a))},[r,a,u,h,g,s,o,f,c,d,m,y,S,$,E,M,L,I,A,P,R]}class OF extends ye{constructor(e){super(),be(this,e,CF,$F,_e,{})}}function Qt(n){if(!n)throw Error("Parameter args is required");if(!n.component==!n.asyncComponent)throw Error("One and only one of component and asyncComponent is required");if(n.component&&(n.asyncComponent=()=>Promise.resolve(n.component)),typeof n.asyncComponent!="function")throw Error("Parameter asyncComponent must be a function");if(n.conditions){Array.isArray(n.conditions)||(n.conditions=[n.conditions]);for(let t=0;t<n.conditions.length;t++)if(!n.conditions[t]||typeof n.conditions[t]!="function")throw Error("Invalid parameter conditions["+t+"]")}return n.loadingComponent&&(n.asyncComponent.loading=n.loadingComponent,n.asyncComponent.loadingParams=n.loadingParams||void 0),{component:n.asyncComponent,userData:n.userData,conditions:n.conditions&&n.conditions.length?n.conditions:void 0,props:n.props&&Object.keys(n.props).length?n.props:{},_sveltesparouter:!0}}const on=[async n=>{const e=new URLSearchParams(window.location.search);return n.location!=="/"&&e.has("pbinstal")?Il("/"):!0}],EF={"/login":Qt({component:OF,conditions:on.concat([n=>!me.authStore.isValid]),userData:{showAppSidebar:!1}}),"/request-password-reset":Qt({asyncComponent:()=>Ot(()=>import("./PageSuperuserRequestPasswordReset-D8rsP-B-.js"),[],import.meta.url),conditions:on.concat([n=>!me.authStore.isValid]),userData:{showAppSidebar:!1}}),"/confirm-password-reset/:token":Qt({asyncComponent:()=>Ot(()=>import("./PageSuperuserConfirmPasswordReset-vkHL6cCG.js"),[],import.meta.url),conditions:on.concat([n=>!me.authStore.isValid]),userData:{showAppSidebar:!1}}),"/collections":Qt({component:wN,conditions:on.concat([n=>me.authStore.isValid]),userData:{showAppSidebar:!0}}),"/logs":Qt({component:b5,conditions:on.concat([n=>me.authStore.isVali