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

203 lines
1.0 MiB
JavaScript
Raw Normal View History

const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./FilterAutocompleteInput-CuTMwa2h.js","./index-B5ReTu-C.js","./ListApiDocs-ZuV6Kf3D.js","./FieldsQueryParam-JQgEaE1u.js","./ListApiDocs-DhdAtA7Y.css","./ViewApiDocs-CVXBABEY.js","./CreateApiDocs-BVvVkOY7.js","./UpdateApiDocs-DMHb7WRc.js","./AuthMethodsDocs-BkPc8Y1Z.js","./AuthRefreshDocs-CWaSLIOx.js","./AuthWithPasswordDocs-CWaE_Vum.js","./AuthWithOAuth2Docs-Gs8bcNHp.js","./CodeEditor-BmjD0EKy.js"])))=>i.map(i=>d[i]);
var hv=Object.defineProperty;var _v=(n,e,t)=>e in n?hv(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var ct=(n,e,t)=>_v(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 lo=n=>n;function ze(n,e){for(const t in e)n[t]=e[t];return n}function gv(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 Ft(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 yn(n,e){return n===e?!0:(So||(So=document.createElement("a")),So.href=e,n===So.href)}function bv(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 At(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?ze(t.ctx.slice(),n[1](i(e))):t.ctx}function Pt(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 Nt(n,e,t,i,l,s){if(l){const o=Db(e,t,i,s);n.p(o,l)}}function Rt(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 zs(n){return n??""}function Nn(n,e,t){return n.set(t),e}function Me(n){return n&&Ft(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 kv(n){const e=b("style");return e.textContent="/* empty */",vv(Ab(n),e),e.sheet}function vv(n,e){return w(n.head||n,e),e.sheet}function y(n,e,t){n.insertBefore(e,t||null)}function v(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 ke(){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 yv=["width","height"];function Qn(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
`;for(let _=0;_<=1;_+=a){const k=e+(t-e)*s(_);u+=_*100+`%{${o(k,1-k)}}
2024-09-30 00:23:19 +08:00
`}const f=u+`100% {${o(t,1-t)}}
}`,c=`__svelte_${$v(f)}_${r}`,d=Ab(n),{stylesheet:m,rules:h}=fr.get(d)||Cv(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 Vs(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||Ov())}function Ov(){fu(()=>{cr||(fr.forEach(n=>{const{ownerNode:e}=n.stylesheet;e&&v(e)}),fr.clear())})}function Ev(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=lo,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=Us(n,0,1,o,s,r,c)),s||(m=!0)}function _(){c&&Vs(n,h),d=!1}return Er(k=>{if(!m&&k>=a&&(m=!0),m&&k>=u&&(f(1,0),_()),!d)return!1;if(m){const S=k-a,$=0+1*r(S/o);f($,1-$)}return!0}),g(),f(0,1),_}function Mv(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 Bs;function Ni(n){Bs=n}function so(){if(!Bs)throw new Error("Function called outside component initialization");return Bs}function Yt(n){so().$$.on_mount.push(n)}function Dv(n){so().$$.after_update.push(n)}function oo(n){so().$$.on_destroy.push(n)}function bt(){const n=so();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=Bs;do{try{for(;jl<Yl.length;){const e=Yl[jl];jl++,Ni(e),Iv(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 Iv(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 Lv(n){const e=[],t=[];Gl.forEach(i=>n.indexOf(i)===-1?e.push(i):t.push(i)),t.forEach(i=>i()),Gl=e}let bs;function du(){return bs||(bs=Promise.resolve(),bs.then(()=>{bs=null})),bs}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 E(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&&Vs(n,o)}function f(){const{delay:d=0,duration:m=300,easing:h=lo,tick:g=te,css:_}=l||pu;_&&(o=Us(n,0,1,m,d,h,_,a++)),g(0,1);const k=Or()+d,S=k+m;r&&r.abort(),s=!0,nt(()=>Ol(n,!0,"start")),r=Er($=>{if(s){if($>=S)return g(1,0),Ol(n,!0,"end"),u(),s=!1;if($>=k){const T=h(($-k)/m);g(T,1-T)}}return s})}let c=!1;return{start(){c||(c=!0,Vs(n),Ft(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=lo,tick:m=te,css:h}=l||pu;h&&(o=Us(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(k=>{if(s){if(k>=_)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 Ys(n,{delay:e=0,duration:t=400,easing:i=lo}={}){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 mt(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(k=>`${k[0].toUpperCase()}${k.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:k=>`overflow: hidden;opacity: ${Math.min(k*20,1)*o};${r}: ${k*a}px;padding-${u[0]}: ${k*c}px;padding-${u[1]}: ${k*d}px;margin-${u[0]}: ${k*m}px;margin-${u[1]}: ${k*h}px;border-${u[0]}-width: ${k*g}px;border-${u[1]}-width: ${k*_}px;`}}function Dt(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,_,k,S,$=n[4]&&!n[2]&&Zf(n);const T=n[19].header,O=At(T,n,n[18],Kf);let M=n[4]&&n[2]&&Gf(n);const L=n[19].default,I=At(L,n,n[18],null),A=n[19].footer,P=At(A,n,n[18],Yf);return{c(){e=b("div"),t=b("div"),l=C(),s=b("div"),o=b("div"),$&&$.c(),r=C(),O&&O.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(N,R){y(N,e,R),w(e,t),w(e,l),w(e,s),w(s,o),$&&$.m(o,null),w(o,r),O&&O.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,k||(S=[B(t,"click",tt(n[20])),B(f,"scroll",n[22])],k=!0)},p(N,R){n=N,n[4]&&!n[2]?$?($.p(n,R),R[0]&20&&E($,1)):($=Zf(n),$.c(),E($,1),$.m(o,r)):$&&(re(),D($,1,1,()=>{$=null}),ae()),O&&O.p&&(!_||R[0]&262144)&&Nt(O,T,n,n[18],_?Pt(T,n[18],R,B2):Rt(n[18]),Kf),n[4]&&n[2]?M?M.p(n,R):(M=Gf(n),M.c(),M.m(o,null)):M&&(M.d(1),M=null),I&&I.p&&(!_||R[0]&262144)&&Nt(I,L,n,n[18],_?Pt(L,n[18],R,null):Rt(n[18]),null),P&&P.p&&(!_||R[0]&262144)&&Nt(P,A,n,n[18],_?Pt(A,n[18],R,V2):Rt(n[18]),Yf),(!_||R[0]&258&&m!==(m="overlay-panel "+n[1]+" "+n[8]))&&p(s,"class",m),(!_||R[0]&262)&&Q(s,"popup",n[2]),(!_||R[0]&4)&&Q(e,"padded",n[2]),(!_||R[0]&1)&&Q(e,"active",n[0])},i(N){_||(N&&nt(()=>{_&&(i||(i=je(t,Ys,{duration:Ki,opacity:0},!0)),i.run(1))}),E($),E(O,N),E(I,N),E(P,N),N&&nt(()=>{_&&(g&&g.end(1),h=qb(s,Fn,n[2]?{duration:Ki,y:-10}:{duration:Ki,x:50}),h.start())}),_=!0)},o(N){N&&(i||(i=je(t,Ys,{duration:Ki,opacity:0},!1)),i.run(0)),D($),D(O,N),D(I,N),D(P,N),h&&h.invalidate(),N&&(g=mu(s,Fn,n[2]?{duration:Ki,y:10}:{duration:Ki,x:50})),_=!1},d(N){N&&v(e),N&&i&&i.end(),$&&$.d(),O&&O.d(N),M&&M.d(),I&&I.d(N),n[21](null),P&&P.d(N),N&&g&&g.end(),k=!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){y(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=je(e,Ys,{duration:Ki},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=je(e,Ys,{duration:Ki},!1)),t.run(0)),i=!1},d(o){o&&v(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){y(l,e,s),t||(i=B(e,"click",tt(n[5])),t=!0)},p:te,d(l){l&&v(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){y(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&&E(s,1)):(s=Jf(o),s.c(),E(s,1),s.m(e,null)):s&&(re(),D(s,1,1,()=>{s=null}),ae())},i(o){t||(E(s),t=!0)},o(o){D(s),t=!1},d(o){o&&v(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=bt(),h="op_"+z.randomString(10);let g,_,k,S,$="",T=o;function O(){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,T=X),X?(k=document.activeElement,m("show"),g==null||g.focus()):(clearTimeout(S),m("hide"),k==null||k.focus()),await fn(),A()}function A(){g&&(o?t(6,g.
`)})),o=!0)},p(a,u){i&&Ft(i.update)&&u&8&&i.update.call(null,{position:"left",text:a[3].map(br).join(`
`)})},i(a){s||(a&&nt(()=>{s&&(l||(l=je(t,Dt,{duration:150,start:.7},!0)),l.run(1))}),s=!0)},o(a){a&&(l||(l=je(t,Dt,{duration:150,start:.7},!1)),l.run(0)),s=!1},d(a){a&&v(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){y(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=je(e,mt,{duration:150},!0)),o.run(1))}),r=!0)},o(a){a&&(o||(o=je(e,mt,{duration:150},!1)),o.run(0)),r=!1},d(a){a&&v(e),a&&o&&o.end()}}}function Xw(n){let e,t,i,l,s,o,r;const a=n[9].default,u=At(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){y(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)&&Nt(u,a,m,m[8],s?Pt(a,m[8],h,Jw):Rt(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()),E(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||(E(u,m),E(l),s=!0)},o(m){D(u,m),D(l),s=!1},d(m){m&&v(e),u&&u.d(m),c[i].d(),n[11](null),o=!1,r()}}}const kc="Invalid value";function br(n){return typeof n=="object"?(n==null?void 0:n.message)||(n==null?void 0:n.code)||kc:n||kc}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(),ve(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){y(u,e,f),w(e,t),y(u,l,f),y(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&&(v(e),v(l),v(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){y(c,e,d),w(e,t),y(c,l,d),y(c,s,d),ce(s,n[3]),y(c,r,d),y(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&&(v(e),v(l),v(s),v(r),v(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){y(u,e,f),w(e,t),y(u,l,f),y(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&&(v(e),v(l),v(s)),r=!1,a()}}}function n3(n){let e,t,i,l,s,o,r,a,u,f,c,d,m,h,g,_,k,S,$;return l=new fe({props:{class:"form-field required",name:"email",$$slots:{default:[xw,({uniqueId:T})=>({17:T}),({uniqueId:T})=>T?131072:0]},$$scope:{ctx:n}}}),o=new fe({props:{class:"form-field required",name:"password",$$slots:{default:[e3,({uniqueId:T})=>({17:T}),({uniqueId:T})=>T?131072:0]},$$scope:{ctx:n}}}),a=
2024-09-30 00:23:19 +08:00
Do you really want to upload and initialize "${T.name}"?`,()=>{h(T)},()=>{d()})}async function h(T){if(!(!T||i)){t(1,u=!0);try{await me.backups.upload({file:T}),await me.backups.restore(T.name),Ks("Please wait while extracting the uploaded archive!"),await new Promise(O=>setTimeout(O,2e3)),l("submit")}catch(O){me.error(O)}d(),t(1,u=!1)}}function g(){s=this.value,t(2,s)}function _(){o=this.value,t(3,o)}function k(){r=this.value,t(4,r)}function S(T){ie[T?"unshift":"push"](()=>{f=T,t(5,f)})}const $=T=>{var O,M;m((M=(O=T.target)==null?void 0:O.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,_,k,S,$]}class l3 extends ye{constructor(e){super(),ve(this,e,i3,n3,_e,{})}}function vc(n){let e,t;return e=new nk({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||(E(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||(E(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]&&vc(n);return{c(){i&&i.c(),e=ke()},m(l,s){i&&i.m(l,s),y(l,e,s),t=!0},p(l,[s]){l[0]?i?(i.p(l,s),s&1&&E(i,1)):(i=vc(l),i.c(),E(i,1),i.m(e.parentNode,e)):i&&(re(),D(i,1,1,()=>{i=null}),ae())},i(l){t||(E(i),t=!0)},o(l){D(i),t=!1},d(l){l&&v(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(),ve(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){y(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&&v(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(()=>ge(e,"value",s)),e.$on("submit",n[10])),{c(){e&&H(e.$$.fragment),i=ke()},m(a,u){e&&F(e,a,u),y(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(()=>ge(e,"value",s)),e.$on("submit",a[10]),H(e.$$.fragment),E(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&&E(e.$$.fragment,a),l=!0)},o(a){e&&D(e.$$.fragment,a),l=!1},d(a){a&&v(i),e&&q(e,a)}}}function yc(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){y(l,e,s),i=!0},i(l){i||(l&&nt(()=>{i&&(t||(t=je(e,Fn,{duration:150,x:5},!0)),t.run(1))}),i=!0)},o(l){l&&(t||(t=je(e,Fn,{duration:150,x:5},!1)),t.run(0)),i=!1},d(l){l&&v(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){y(o,e,r),i=!0,l||(s=B(e,"click",n[15]),l=!0)},p:te,i(o){i||(o&&nt(()=>{i&&(t||(t=je(e,Fn,{duration:150,x:5},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=je(e,Fn,{duration:150,x:5},!1)),t.run(0)),i=!1},d(o){o&&v(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(k,S){return k[4]&&!k[5]?0:1}s=h(n),o=m[s]=d[s](n);let g=(n[0].length||n[7].length)&&n[7]!=n[0]&&yc(),_=(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 po(n){return n+.5|0}const Zi=(n,e,t)=>Math.max(Math.min(n,t),e);function Os(n){return Zi(po(n*2.55),0,255)}function el(n){return Zi(po(n*255),0,255)}function Pi(n){return Zi(po(n/2.55)/100,0,1)}function Nc(n){return Zi(po(n*100),0,100)}const Kn={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&Kn[n[1]]*17,g:255&Kn[n[2]]*17,b:255&Kn[n[3]]*17,a:e===5?Kn[n[4]]*17:255}:(e===7||e===9)&&(t={r:Kn[n[1]]<<4|Kn[n[2]],g:Kn[n[3]]<<4|Kn[n[4]],b:Kn[n[5]]<<4|Kn[n[6]],a:e===9?Kn[n[7]]<<4|Kn[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 sk(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=sk(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(sk,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 ok(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]?Os(+e[5]):el(+e[5]));const l=ok(+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]=ok(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 vt(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 Ot(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 _t(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(vt(n))for(o=Object.keys(n),s=o.length,l=0;l<s;l++)e.call(t,n[o[l]],o[l])}function kr(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 vr(n){if(un(n))return n.map(vr);if(vt(n)){const e=Object.create(null),t=Object.keys(n),i=t.length;let l=0;for(;l<i;++l)e[t[l]]=vr(n[t[l]]);return e}return n}function ak(n){return["__proto__","prototype","constructor"].indexOf(n)===-1}function uS(n,e,t,i){if(!ak(n))return;const l=e[n],s=t[n];vt(l)&&vt(s)?Zs(l,s,i):e[n]=vr(s)}function Zs(n,e,t){const i=un(e)?e:[e],l=i.length;if(!vt(n))return n;t=t||{};const s=t.merger||uS;let o;for(let r=0;r<l;++r){if(o=i[r],!vt(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 As(n,e){return Zs(n,e,{merger:fS})}function fS(n,e,t){if(!ak(n))return;const i=e[n],l=t[n];vt(i)&&vt(l)?As(i,l):Object.prototype.hasOwnProperty.call(e,n)||(e[n]=vr(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 yr(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 vn=Math.PI,Ti=2*vn,mS=Ti+vn,Sr=Number.POSITIVE_INFINITY,hS=vn/180,oi=vn/2,kl=vn/4,zc=vn*2/3,Ka=Math.log10,il=Math.sign;function Ps(n,e,t){return Math.abs(n-e)<t}function Uc(n){const e=Math.round(n);n=Ps(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 Gs(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*(vn/180)}function kS(n){return n*(180/vn)}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 vS(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*vn&&(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 yS(n,e){return(n-e+mS)%Ti-vn}function ki(n){return(n%Ti+Ti)%Ti}function uk(n,e,t,i){const l=ki(n),s=ki(e),o=ki(t),r=ki(s-l),a=ki(o-l),u=ki(l-s),f=ki(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 fk(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=dk.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=Ns[e.easing]||Ns.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 Ck{constructor(e,t){this._chart=e,this._properties=new Map,this.configure(t)}configure(e){if(!vt(e))return;const t=Object.keys(nn.animation),i=this._properties;Object.getOwnPropertyNames(e).forEach(l=>{const s=e[l];if(!vt(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,k=i.reduce((T,O)=>T+O.before.length+O.lines.length+O.after.length,0);if(k+=n.beforeBody.length+n.afterBody.length,c&&(g+=c*u.lineHeight+(c-1)*e.titleSpacing+e.titleMarginBottom),k){const T=e.displayColors?Math.max(r,a.lineHeight):a.lineHeight;g+=m*T+(k-m)*a.lineHeight+(k-1)*e.bodySpacing}d&&(g+=e.footerMarginTop+d*f.lineHeight+(d-1)*e.footerSpacing);let S=0;const $=function(T){_=Math.max(_,t.measureText(T).width+S)};return t.save(),t.font=u.string,_t(n.title,$),t.font=a.string,_t(n.beforeBody.concat(n.afterBody),$),S=e.displayColors?o+2+e.boxPadding:0,_t(i,T=>{_t(T.before,$),_t(T.lines,$),_t(T.after,$)}),S=0,t.font=f.string,_t(n.footer,$),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 Uk={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"?Uk[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"}};Ek._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 Vk={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($(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+`
2024-09-30 00:23:19 +08:00
`+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",ht=e.console&&(e.console.warn||e.console.log);return ht&&ht.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`."),k=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 $(W,G){return function(){return W.apply(G,arguments)}}function T(W,G){return typeof W==r?W.apply(G&&G[0]||l,G):W}function O(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 N(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 R(W){return Array.prototype.slice.call(W,0)}function U(W,G,ne){for(var de=[],Ie=[],Ye=0;Ye<W.length;){var ht=W[Ye][G];N(Ie,ht)<0&&de.push(W[Ye]),Ie[Ye]=ht,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),we="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,be=ot|Le,Oe=Ve|be,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){T(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 Tt(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,ht=G&(Je|at)&&de-Ie===0;ne.isFirst=!!Ye,ne.isFinal=!!ht,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,ht=ne.firstMultiple,an=ht?ht.center:Ye.center,dn=G.center=hn(de);G.timeStamp=f(),G.deltaTime=G.timeStamp-Ye.timeStamp,G.angle=rn(an,dn),G.distance=kt(an,dn),It(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=ht?rl(ht.pointers,de):1,G.rotation=ht?sn(ht.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 eo=n=>n&&n.enabled&&n.modifierKey,Bk=(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 ka(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 Wk(n,e,t){const{mode:i="xy",scaleMode:l,overScaleMode:s}=n||{},o=J$(e,t),r=ka(i,t),a=ka(l,t);if(s){const f=ka(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 _t(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 Yk(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=Ot(o.options,o.scale)}return Ot(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=Yk(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=Yk(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 Kk(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 Kk(n,e,t,!0)}const lu={category:eC,default:X$},su={default:Q$},ou={category:nC,default:Kk,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){_t(n,(t,i)=>{e[i]||delete n[i]})}function cs(n,e){const{scales:t}=n,{originalScaleLimits:i,updatedScaleLimits:l}=e;return _t(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=Wk(a,s,n);_t(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){y(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&&v(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 tv extends ye{constructor(e){super(),ve(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){y(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 k={};m&25165826&&(k.$$scope={dirty:m,ctx:d}),a.$set(k)},i(d){u||(E(t.$$.fragment,d),E(l.$$.fragment,d),E(o.$$.fragment,d),E(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&&v(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){y(t,e,i)},p:te,i:te,o:te,d(t){t&&v(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){y(c,e,d),w(e,t),y(c,l,d),y(c,s,d),ce(s,n[1].logs.maxDays),y(c,r,d),y(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&&gt(s.value)!==c[1].logs.maxDays&&ce(s,c[1].logs.maxDays)},d(c){c&&(v(e),v(l),v(s),v(r),v(a)),u=!1,f()}}}function s5(n){let e,t,i,l,s,o,r,a,u,f,c,d,m;return f=new tv({}),{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){y(h,e,g),w(e,t),y(h,l,g),y(h,s,g),ce(s,n[1].logs.minLevel),y(h,o,g),y(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&&gt(s.value)!==h[1].logs.minLevel&&ce(s,h[1].logs.minLevel)},i(h){c||(E(f.$$.fragment,h),c=!0)},o(h){D(f.$$.fragment,h),c=!1},d(h){h&&(v(e),v(l),v(s),v(o),v(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){y(u,e,f),e.checked=n[1].logs.logIP,y(u,i,f),y(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&&(v(e),v(i),v(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){y(u,e,f),e.checked=n[1].logs.logAuthId,y(u,i,f),y(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){y(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&&v(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){y(a,e,u),w(e,i),y(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&&(v(e),v(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=ke(),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){y(m,e,h),w(e,t),y(m,l,h),y(m,s,h),ce(s,n[0].subject),y(m,r,h),c&&c.m(m,h),y(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&&(v(e),v(l),v(s),v(r),v(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){y(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&&v(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(()=>ge(e,"value",s))),{c(){e&&H(e.$$.fragment),i=ke()},m(a,u){e&&F(e,a,u),y(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(()=>ge(e,"value",s)),H(e.$$.fragment),E(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&&E(e.$$.fragment,a),l=!0)},o(a){e&&D(e.$$.fragment,a),l=!1},d(a){a&&v(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){y(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&&v(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){y(a,e,u),w(e,i),y(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&&(v(e),v(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=ke(),p(e,"for",i=n[24])},m(g,_){y(g,e,_),w(e,t),y(g,l,_),c[s].m(g,_),y(g,r,_),m&&m.m(g,_),y(g,a,_),u=!0},p(g,_){var S;(!u||_&16777216&&i!==(i=g[24]))&&p(e,"for",i);let k=s;s=d(g),s===k?c[s].p(g,_):(re(),D(c[k],1,1,()=>{c[k]=null}),ae(),o=c[s],o?o.p(g,_):(o=c[s]=f[s](g),o.c()),E(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||(E(o),u=!0)},o(g){D(o),u=!1},d(g){g&&(v(e),v(l),v(r),v(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),y(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||(E(e.$$.fragment,s),E(i.$$.fragment,s),l=!0)},o(s){D(e.$$.fragment,s),D(i.$$.fragment,s),l=!1},d(s){s&&v(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){y(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=je(e,Dt,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=je(e,Dt,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&v(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=ke(),p(t,"class","ri-draft-line"),p(l,"class","txt"),p(e,"class","inline-flex"),p(r,"class","flex-fill")},m(c,d){y(c,e,d),w(e,t),w(e,i),w(e,l),w(l,s),y(c,o,d),y(c,r,d),y(c,a,d),f&&f.m(c,d),y(c,u,d)},p(c,d){d&4&&ue(s,c[2]),c[7]?f?d&128&&E(f,1):(f=Dp(),f.c(),E(f,1),f.m(u.parentNode,u)):f&&(re(),D(f,1,1,()=>{f=null}),ae())},d(c){c&&(v(e),v(o),v(r),v(a),v(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=ze(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?wt(i,[qt(s[9])]):{};o&1073742063&&(r.$$scope={dirty:o,ctx:s}),e.$set(r)},i(s){t||(E(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,R=>t(13,o=R));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 k(){d||m||(t(6,m=!0),t(5,d=(await Et(async()=>{const{default:R}=await import("./CodeEditor-BmjD0EKy.js");return{default:R}},__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){y(o,e,r),y(o,t,r),y(o,i,r),y(o,l,r),y(o,s,r)},p:te,d(o){o&&(v(e),v(t),v(i),v(l),v(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(()=>ge(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){y(d,e,m),y(d,t,m),y(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||(E(l.$$.fragment,d),E(r.$$.fragment,d),u=!0)},o(d){D(l.$$.fragment,d),D(r.$$.fragment,d),u=!1},d(d){d&&(v(e),v(t),v(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){y(t,e,i)},d(t){t&&v(e)}}}function o6(n){let e;return{c(){e=b("span"),e.textContent="Enabled",p(e,"class","label label-success")},m(t,i){y(t,e,i)},d(t){t&&v(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){y(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=je(e,Dt,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=je(e,Dt,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&v(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=ke(),p(e,"class","inline-flex"),p(i,"class","flex-fill")},m(c,d){y(c,e,d),y(c,t,d),y(c,i,d),y(c,l,d),u.m(c,d),y(c,s,d),f&&f.m(c,d),y(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&&E(f,1):(f=Up(),f.c(),E(f,1),f.m(o.parentNode,o)):f&&(re(),D(f,1,1,()=>{f=null}),ae())},d(c){c&&(v(e),v(t),v(i),v(l),v(s),v(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||(E(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(),ve(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){y(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&&v(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){y(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&&v(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=ze(u,l[f]);return a!==void 0&&a[0]&2049&&(u=ze(u,wt(l,[a[0]&1&&{item:r[50]},a[0]&2048&&qt(r[11])]))),{props:u}}return s&&(e=jt(s,o(n))),{c(){e&&H(e.$$.fragment),t=ke()},m(r,a){e&&F(e,r,a),y(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),E(e.$$.fragment,1),F(e,t.parentNode,t)):e=null}else if(s){const u=a[0]&2049?wt(l,[a[0]&1&&{item:r[50]},a[0]&2048&&qt(r[11])]):{};e.$set(u)}},i(r){i||(e&&E(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){y(c,e,d),w(e,t),y(c,l,d),y(c,s,d),ce(s,n[5]),y(c,r,d),y(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&&(v(e),v(l),v(s),v(r),v(a)),u=!1,f()}}}function j6(n){let e,t,i,l,s,o,r,a,u,f,c,d,m,h,g,_,k,S;return l=new fe({props:{class:"form-field required",name:"clientId",$$slots:{default:[N6,({uniqueId:$})=>({23:$}),({uniqueId:$})=>$?8388608:0]},$$scope:{ctx:n}}}),r=new fe({props:{class:"form-field required",name:"teamId",$$slots:{default:[R6,({uniqueId:$})=>({23:$}),({uniqueId:$})=>$?8388608:0]},$$scope:{ctx:n}}}),f=new fe({props:{class:"form-field required",name:"keyId",$$slots:{default:[F6,({uniqueId:$})=>({23:$}),({uniqueId:$})=>$?8388608:0]},$$scope:{ctx:n}}}),m=new fe({props:{class:"form-field required",name:"duration",$$slots:{default:[q6,({uniqueId:$})=>({23:$}),({uniqueId:$})=>$?8388608:0]},$$scope:{ctx:n}}}),g=new fe({props:{class:"form-field required",name:"privateKey",$$slots:{default:[H6,({uniqueId:$})=>({23:$}),({uniqueId:$})=>$?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){y($,e,T),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,k||(S=B(e,"submit",tt(n[17])),k=!0)},p($,T){const O={};T&25165828&&(O.$$scope={dirty:T,ctx:$}),l.$set(O);const M={};T&25165832&&(M.$$scope={dirty:T,ctx:$}),r.$set(M);const L={};T&25165840&&(L.$$scope={dirty:T,ctx:$}),f.$set(L);const I={};T&25165888&&(I.$$scope={dirty:T,ctx:$}),m.$set(I);const A={};T&25165856&&(A.$$scope={dirty:T,ctx:$}),g.$set(A)},i($){_||(E(l.$$.fragment,$),E(r.$$.fragment,$),E(f.$$.fragment,$),E(m.$$.fragment,$),E(g.$$.fragment,$),_=!0)},o($){D(l.$$.fragment,$),D(r.$$.fragment,$),D(f.$$.fragment,$),D(m.$$.fragment,$),D(g.$$.fragment,$),_=!1},d($){$&&v(e),q(l),q(r),q(f),q(m),q(g),k=!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){y(t,e,i)},p:te,d(t){t&&v(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){y(c,e,d),w(e,t),y(c,i,d),y(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&&(v(e),v(i),v(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||(E(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=bt(),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=
is a direct result of the trusted server code-&gt;token exchange response.</em>`,i=C(),H(l.$$.fragment),s=C(),H(o.$$.fragment),p(t,"class","txt-hint txt-sm m-b-xs"),p(e,"class","content")},m(u,f){y(u,e,f),w(e,t),w(e,i),F(l,e,null),w(e,s),F(o,e,null),a=!0},p(u,f){const c={};f&2&&(c.name=u[1]+".extra.jwksURL"),f&24577&&(c.$$scope={dirty:f,ctx:u}),l.$set(c);const d={};f&2&&(d.name=u[1]+".extra.issuers"),f&24577&&(d.$$scope={dirty:f,ctx:u}),o.$set(d)},i(u){a||(E(l.$$.fragment,u),E(o.$$.fragment,u),u&&nt(()=>{a&&(r||(r=je(e,mt,{delay:10,duration:150},!0)),r.run(1))}),a=!0)},o(u){D(l.$$.fragment,u),D(o.$$.fragment,u),u&&(r||(r=je(e,mt,{delay:10,duration:150},!1)),r.run(0)),a=!1},d(u){u&&v(e),q(l),q(o),u&&r&&r.end()}}}function p8(n){let e,t,i,l;return t=new fe({props:{class:"form-field required",name:n[1]+".userInfoURL",$$slots:{default:[_8,({uniqueId:s})=>({13:s}),({uniqueId:s})=>s?8192:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),H(t.$$.fragment),p(e,"class","content")},m(s,o){y(s,e,o),F(t,e,null),l=!0},p(s,o){const r={};o&2&&(r.name=s[1]+".userInfoURL"),o&24577&&(r.$$scope={dirty:o,ctx:s}),t.$set(r)},i(s){l||(E(t.$$.fragment,s),s&&nt(()=>{l&&(i||(i=je(e,mt,{delay:10,duration:150},!0)),i.run(1))}),l=!0)},o(s){D(t.$$.fragment,s),s&&(i||(i=je(e,mt,{delay:10,duration:150},!1)),i.run(0)),l=!1},d(s){s&&v(e),q(t),s&&i&&i.end()}}}function m8(n){let e,t,i,l,s,o,r,a,u,f;return{c(){e=b("label"),t=b("span"),t.textContent="JWKS verification URL",i=C(),l=b("i"),o=C(),r=b("input"),p(t,"class","txt"),p(l,"class","ri-information-line link-hint"),p(e,"for",s=n[13]),p(r,"type","url"),p(r,"id",a=n[13])},m(c,d){y(c,e,d),w(e,t),w(e,i),w(e,l),y(c,o,d),y(c,r,d),ce(r,n[0].extra.jwksURL),u||(f=[Me(He.call(null,l,{text:"URL to the public token verification keys.",position:"top"})),B(r,"input",n[9])],u=!0)},p(c,d){d&8192&&s!==(s=c[13])&&p(e,"for",s),d&8192&&a!==(a=c[13])&&p(r,"id",a),d&1&&r.value!==c[0].extra.jwksURL&&ce(r,c[0].extra.jwksURL)},d(c){c&&(v(e),v(o),v(r)),u=!1,De(f)}}}function h8(n){let e,t,i,l,s,o,r,a,u,f,c;function d(h){n[10](h)}let m={id:n[13]};return n[0].extra.issuers!==void 0&&(m.value=n[0].extra.issuers),r=new ps({props:m}),ie.push(()=>ge(r,"value",d)),{c(){e=b("label"),t=b("span"),t.textContent="Issuers",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[13])},m(h,g){y(h,e,g),w(e,t),w(e,i),w(e,l),y(h,o,g),F(r,h,g),u=!0,f||(c=Me(He.call(null,l,{text:"Comma separated list of accepted values for the iss token claim validation.",position:"top"})),f=!0)},p(h,g){(!u||g&8192&&s!==(s=h[13]))&&p(e,"for",s);const _={};g&8192&&(_.id=h[13]),!a&&g&1&&(a=!0,_.value=h[0].extra.issuers,$e(()=>a=!1)),r.$set(_)},i(h){u||(E(r.$$.fragment,h),u=!0)},o(h){D(r.$$.fragment,h),u=!1},d(h){h&&(v(e),v(o)),q(r,h),f=!1,c()}}}function _8(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("User info URL"),l=C(),s=b("input"),p(e,"for",i=n[13]),p(s,"type","url"),p(s,"id",o=n[13]),s.required=!0},m(u,f){y(u,e,f),w(e,t),y(u,l,f),y(u,s,f),ce(s,n[0].userInfoURL),r||(a=B(s,"input",n[8]),r=!0)},p(u,f){f&8192&&i!==(i=u[13])&&p(e,"for",i),f&8192&&o!==(o=u[13])&&p(s,"id",o),f&1&&s.value!==u[0].userInfoURL&&ce(s,u[0].userInfoURL)},d(u){u&&(v(e),v(l),v(s)),r=!1,a()}}}function g8(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="Support PKCE",o=C(),r=b("i"),p(e,"type","checkbox"),p(e,"id",t=n[13]),p(s,"class","txt"),p(r,"class","ri-information-line link-hint"),p(l,"for",a=n[13])},m(c,d){y(c,e,d),e.checked=n[0].pkce,y(c,i,d),y(c,l,d),w(l,s),w(l,o),w(l,r),u||(f=[B(e,"change",n[11]),Me(He.call(null,r,{text:"Usually it should be safe to be always enabled as most providers will just ignore the extra query parameters if they don't support PKCE.",position:"right"}))],u=!0)},p(c,d){d&8192&&t!==(t=c[13])&&p(e,"id",t),d&1&&(e.checked=c[0].pkce),d&8192&&a!==(a=c[13])&&p(l,"for",a)},d(c){c&&(v(e),v(i),v(l)),u=!1,De(f)}}}function b8(n){let e,t,i,l,s,o,r,a,u,f,c,d,m,h,g,_;e=new fe({props:{class:"form-field required",name:n[1]+".displayName",$$slots:{default:[a8,({uni
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=Ct("div","flatpickr-weekwrapper");Z.appendChild(Ct("span","flatpickr-weekday",t.l10n.weekAbbreviation));var x=Ct("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,Lt("onYearChange"),U()),R(),Lt("onMonthChange"),ji())}function we(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&&Lt("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")),Lt("onClose")}function We(){t.config!==void 0&&Lt("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(),Lt("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(_,k){(!c||k&512&&s!==(s=_[9]))&&p(e,"for",s);const S={};k&512&&(S.id=_[9]),k&1&&(S.disabled=!z.isEmpty(_[0].onlyDomains)),!a&&k&1&&(a=!0,S.value=_[0].exceptDomains,$e(()=>a=!1)),r.$set(S)},i(_){c||(E(r.$$.fragment,_),c=!0)},o(_){D(r.$$.fragment,_),c=!1},d(_){_&&(v(e),v(o),v(u),v(f)),q(r,_),d=!1,m()}}}function qE(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 ps({props:g}),ie.push(()=>ge(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(_,k){y(_,e,k),w(e,t),w(e,i),w(e,l),y(_,o,k),F(r,_,k),y(_,u,k),y(_,f,k),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(_,k){(!c||k&512&&s!==(s=_[9]+".onlyDomains"))&&p(e,"for",s);const S={};k&512&&(S.id=_[9]+".onlyDomains"),k&1&&(S.disabled=!z.isEmpty(_[0].exceptDomains)),!a&&k&1&&(a=!0,S.value=_[0].onlyDomains,$e(()=>a=!1)),r.$set(S)},i(_){c||(E(r.$$.fragment,_),c=!0)},o(_){D(r.$$.fragment,_),c=!1},d(_){_&&(v(e),v(o),v(u),v(f)),q(r,_),d=!1,m()}}}function HE(n){let e,t,i,l,s,o,r;return i=new fe({props:{class:"form-field",name:"fields."+n[1]+".exceptDomains",$$slots:{default:[FE,({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:[qE,({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){y(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||(E(i.$$.fragment,a),E(o.$$.fragment,a),r=!0)},o(a){D(i.$$.fragment,a),D(o.$$.fragment,a),r=!1},d(a){a&&v(e),q(i),q(o)}}}function jE(n){let e,t,i;const l=[{key:n[1]},n[2]];function s(r){n[5](r)}let o={$$slots:{options:[HE]},$$scope:{ctx:n}};for(let r=0;r<l.length;r+=1)o=ze(o,l[r]);return n[0]!==void 0&&(o.field=n[0]),e=new ei({props:o}),ie.push(()=>ge(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?wt(l,[a&2&&{key:r[1]},a&4&&qt(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||(E(e.$$.fragment,r),i=!0)},o(r){D(e.$$.fragment,r),i=!1},d(r){q(e,r)}}}function zE(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=ze(ze({},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 sv extends ye{constructor(e){super(),ve(this,e,zE,jE,_e,{field:0,key:1})}}function UE(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){y(a,e,u),w(e,i),y(a,l,u),y(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&&(v(e),v(l),v(s))}}}function VE(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(),ve(this,e,VE,UE,_e,{item:0})}}const BE=[{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){(!k||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){k||(E(r.$$.fragment,M),E(_.$$.fragment,M),k=!0)},o(M){D(r.$$.fragment,M),D(_.$$.fragment,M),k=!1},d(M){M&&(v(e),v(o),v(u),v(f)),q(r,M),q(_),S=!1,$()}}}function ZE(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){y(t,e,i)},p:te,d(t){t&&v(e)}}}function GE(n){let e,t,i,l,s,o,r,a,u,f,c,d,m,h,g,_,k,S,$,T,O;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 ps({props:L}),ie.push(()=>ge(r,"value",M)),S=new Hn({props:{class:"dropdown dropdown-sm dropdown-center dropdown-nowrap p-r-10",$$slots:{default:[ZE]},$$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"),k=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){y(I,e,A),w(e,t),w(e,i),w(e,l),y(I,o,A),F(r,I,A),y(I,u,A),y(I,f,A),w(f,c),w(f,d),w(f,m),w(m,h),w(m,g),w(m,_),w(m,k),F(S,m,null),$=!0,T||(O=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"})),T=!0)},p(I,A){(!$||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 N={};A&33554432&&(N.$$scope={dirty:A,ctx:I}),S.$set(N)},i(I){$||(E(r.$$.fragment,I),E(S.$$.fragment,I),$=!0)},o(I){D(r.$$.fragment,I),D(S.$$.fragment,I),$=!1},d(I){I&&(v(e),v(o),v(u),v(f)),q(r,I),q(S),T=!1,O()}}}function XE(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){y(d,e,m),w(e,t),y(d,l,m),y(d,s,m),y(d,a,m),y(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&&(v(e),v(l),v(s),v(a),v(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:[QE,({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){y(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||(E(t.$$.fragment,l),i=!0)},o(l){D(t.$$.fragment,l),i=!1},d(l){l&&v(e),q(t)}}}function QE(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){y(u,e,f),w(e,t),y(u,l,f),y(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&&gt(s.value)!==u[0].maxSelect&&ce(s,u[0].maxSelect)},d(u){u&&(v(e),v(l),v(s)),r=!1,a()}}}function xE(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){y(c,e,d),e.checked=n[0].protected,y(c,i,d),y(c,l,d),w(l,s),y(c,r,d),y(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&&(v(e),v(i),v(l),v(r),v(a)),u=!1,f()}}}function eM(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:[JE,({uniqueId:k})=>({23:k}),({uniqueId:k})=>k?8388608:0]},$$scope:{ctx:n}}}),o=new fe({props:{class:"form-field",name:"fields."+n[1]+".thumbs",$$slots:{default:[GE,({uniqueId:k})=>({23:k}),({uniqueId:k})=>k?8388608:0]},$$scope:{ctx:n}}}),f=new fe({props:{class:"form-field",name:"fields."+n[1]+".maxSize",$$slots:{default:[XE,({uniqueId:k})=>({23:k}),({uniqueId:k})=>k?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:[xE,({uniqueId:k})=>({23:k}),({uniqueId:k})=>k?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(k,S){y(k,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(k,S){const $={};S&2&&($.name="fields."+k[1]+".mimeTypes"),S&41943049&&($.$$scope={dirty:S,ctx:k}),i.$set($);const T={};S&2&&(T.name="fields."+k[1]+".thumbs"),S&41943041&&(T.$$scope={dirty:S,ctx:k}),o.$set(T),(!g||S&4&&r!==(r=k[2]?"col-sm-8":"col-sm-6"))&&p(s,"class",r);const O={};S&2&&(O.name="fields."+k[1]+".maxSize"),S&41943041&&(O.$$scope={dirty:S,ctx:k}),f.$set(O),(!g||S&4&&c!==(c=k[2]?"col-sm-4":"col-sm-3"))&&p(u,"class",c),k[2]?_&&(re(),D(_,1,1,()=>{_=null}),ae()):_?(_.p(k,S),S&4&&E(_,1)):(_=ih(k),_.c(),E(_,1),_.m(e,m));const M={};S&2&&(M.name="fields."+k[1]+".protected"),S&41943041&&(M.$$scope={dirty:S,ctx:k}),h.$set(M)},i(k){g||(E(i.$$.fragment,k),E(o.$$.fragment,k),E(f.$$.fragment,k),E(_),E(h.$$.fragment,k),g=!0)},o(k){D(i.$$.fragment,k),D(o.$$.fragment,k),D(f.$$.fragment,k),D(_),D(h.$$.fragment,k),g=!1},d(k){k&&v(e),q(i),q(o),q(f),_&&_.d(),q(h)}}}function tM(n){let e,t,i;const l=[{key:n[1]},n[5]];function s(r){n[17](r)}let o={$$slots:{options:[eM],default:[YE,({interactive:r})=>({24:r}),({interactive:r})=>r?16777216:0]},$$scope:{ctx:n}};for(let r=0;r<l.length;r+=1)o=ze(o,l[r]);return n[0]!==void 0&&(o.field=n[0]),e=new ei({props:o}),ie.push(()=>ge(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?wt(l,[a&2&&{key:r[1]},a&32&&qt(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||(E(e.$$.fragment,r),i=!0)},o(r){D(e.$$.fragment,r),i=!1},d(r){q(e,r)}}}function nM(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=BE.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 N=[];for(const R of s.mimeTypes)a.find(U=>U.mimeType===R)||N.push({mimeType:R});N.length&&t(3,a=a.concat(N))}function m(N){n.$$.not_equal(s.mimeTypes,N)&&(s.mimeTypes=N,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>",k=C(),S=b("li"),S.innerHTML="&quot;null&quot; is converted to the json <code>null</code>",$=C(),T=b("li"),T.innerHTML="&quot;[1,2,3]&quot; is converted to the json <code>[1,2,3]</code>",O=C(),M=b("li"),I=Y(L),A=Y(" is converted to the json "),P=b("code"),P.textContent='{"a":1,"b":2}',N=C(),R=b("li"),R.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(`
2024-09-30 00:23:19 +08:00
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,we){y(Se,e,we),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,k),w(m,S),w(m,$),w(m,T),w(m,O),w(m,M),w(M,I),w(M,A),w(M,P),w(m,N),w(m,R),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=je(e,mt,{duration:150},!0)),X.run(1))}),oe=!0)},o(Se){Se&&(X||(X=je(e,mt,{duration:150},!1)),X.run(0)),oe=!1},d(Se){Se&&v(e),Se&&X&&X.end()}}}function rM(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:[lM,({uniqueId:_})=>({10:_}),({uniqueId:_})=>_?1024:0]},$$scope:{ctx:n}}});function d(_,k){return _[2]?oM:sM}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=ke(),p(l,"class","txt"),p(i,"type","button"),p(i,"class",o="btn btn-sm "+(n[2]?"btn-secondary":"btn-hint btn-transparent"))},m(_,k){F(e,_,k),y(_,t,k),y(_,i,k),w(i,l),w(i,s),h.m(i,null),y(_,r,k),g&&g.m(_,k),y(_,a,k),u=!0,f||(c=B(i,"click",n[5]),f=!0)},p(_,k){const S={};k&2&&(S.name="fields."+_[1]+".maxSize"),k&3073&&(S.$$scope={dirty:k,ctx:_}),e.$set(S),m!==(m=d(_))&&(h.d(1),h=m(_),h&&(h.c(),h.m(i,null))),(!u||k&4&&o!==(o="btn btn-sm "+(_[2]?"btn-secondary":"btn-hint btn-transparent")))&&p(i,"class",o),_[2]?g?k&4&&E(g,1):(g=lh(),g.c(),E(g,1),g.m(a.parentNode,a)):g&&(re(),D(g,1,1,()=>{g=null}),ae())},i(_){u||(E(e.$$.fragment,_),E(g),u=!0)},o(_){D(e.$$.fragment,_),D(g),u=!1},d(_){_&&(v(t),v(i),v(r),v(a)),q(e,_),h.d(),g&&g.d(_),f=!1,c()}}}function aM(n){let e,t,i;const l=[{key:n[1]},n[3]];function s(r){n[6](r)}let o={$$slots:{options:[rM]},$$scope:{ctx:n}};for(let r=0;r<l.length;r+=1)o=ze(o,l[r]);return n[0]!==void 0&&(o.field=n[0]),e=new ei({props:o}),ie.push(()=>ge(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?wt(l,[a&2&&{key:r[1]},a&8&&qt(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||(E(e.$$.fragment,r),i=!0)},o(r){D(e.$$.fragment,r),i=!1},d(r){q(e,r)}}}function uM(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=ze(ze({},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 fM extends ye{constructor(e){super(),ve(this,e,uM,aM,_e,{field:0,key:1})}}function cM(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){y(u,e,f),w(e,t),y(u,l,f),y(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&&gt(s.value)!==u[0].min&&ce(s,u[0].min)},d(u){u&&(v(e),v(l),v(s)),r=!1,a()}}}function dM(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){y(f,e,c),w(e,t),y(f,l,c),y(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&&gt(s.value)!==f[0].max&&ce(s,f[0].max)},d(f){f&&(v(e),v(l),v(s)),a=!1,u()}}}function pM(n){let e,t,i,l,s,o,r;return i=new fe({props:{class:"form-field",name:"fields."+n[1]+".min",$$slots:{default:[cM,({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:[dM,({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,$;s&&Ft(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 ${(($=g[4])==null?void 0:$.name)||"relation"} ids are removed from the corresponding record.`].filter(Boolean).join(`
2024-09-30 00:23:19 +08:00
`),position:"top"}),(!f||_&16777216&&o!==(o=g[24]))&&p(e,"for",o);const k={};_&16777216&&(k.id=g[24]),!u&&_&1&&(u=!0,k.keyOfSelected=g[0].cascadeDelete,$e(()=>u=!1)),a.$set(k)},i(g){f||(E(a.$$.fragment,g),f=!0)},o(g){D(a.$$.fragment,g),f=!1},d(g){g&&(v(e),v(r)),q(a,g),c=!1,d()}}}function PM(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:[AM,({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){y(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&&E(o,1)):(o=sh(r),o.c(),E(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||(E(o),E(l.$$.fragment,r),s=!0)},o(r){D(o),D(l.$$.fragment,r),s=!1},d(r){r&&v(e),o&&o.d(),q(l)}}}function NM(n){let e,t,i,l,s;const o=[{key:n[1]},n[8]];function r(f){n[17](f)}let a={$$slots:{options:[PM],default:[DM,({interactive:f})=>({25:f}),({interactive:f})=>f?33554432:0]},$$scope:{ctx:n}};for(let f=0;f<o.length;f+=1)a=ze(a,o[f]);n[0]!==void 0&&(a.field=n[0]),e=new ei({props:a}),ie.push(()=>ge(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),y(f,i,c),F(l,f,c),s=!0},p(f,[c]){const d=c&258?wt(o,[c&2&&{key:f[1]},c&256&&qt(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||(E(e.$$.fragment,f),E(l.$$.fragment,f),s=!0)},o(f){D(e.$$.fragment,f),D(l.$$.fragment,f),s=!1},d(f){f&&v(i),q(e,f),n[21](null),q(l,f)}}}function RM(n,e,t){let i,l;const s=["field","key"];let o=lt(e,s),r;Qe(n,En,R=>t(10,r=R));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 _=R=>t(0,a.minSelect=R.target.value<<0,a);function k(){a.maxSelect=gt(this.value),t(0,a),t(9,h),t(2,m)}function S(R){n.$$.not_equal(a.cascadeDelete,R)&&(a.cascadeDelete=R,t(0,a),t(9,h),t(2,m))}const $=()=>d==null?void 0:d.show();function T(R){n.$$.not_equal(a.collectionId,R)&&(a.collectionId=R,t(0,a),t(9,h),t(2,m))}function O(R){m=R,t(2,m)}function M(R){a=R,t(0,a),t(9,h),t(2,m)}function L(R){Pe.call(this,n,R)}function I(R){Pe.call(this,n,R)}function A(R){Pe.call(this,n,R)}function P(R){ie[R?"unshift":"push"](()=>{d=R,t(3,d)})}const N=R=>{var U,j;(j=(U=R==null?void 0:R.detail)==null?void 0:U.collection)!=null&&j.id&&R.detail.collection.type!="view"&&t(0,a.collectionId=R.detail.collection.id,a)};return n.$$set=R=>{e=ze(ze({},e),Ut(R)),t(8,o=lt(e,s)),"field"in R&&t(0,a=R.field),"key"in R&&t(1,u=R.key)},n.$$.update=()=>{n.$$.dirty&1024&&t(5,i=r.filter(R=>!R.system&&R.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(R=>R.id==a.collectionId)||null)},[a,u,m,d,l,i,f,c,o,h,r,_,k,S,$,T,O,M,L,I,A,P,N]}class FM extends ye{constructor(e){super(),ve(this,e,RM,NM,_e,{field:0,key:1})}}function qM(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 ps({props:a}),ie.push(()=>ge(t,"value",r)),{c(){e=b("div"),H(t.$$.fragment)},m(u,f){y(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||(E(t.$$.fragment,u),l=!0)},o(u){D(t.$$.fragment,u),l=!1},d(u){u&&v(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=ke(),p(t,"class","txt"),p(e,"for",i=n[8]),p(a,"class","help-block")},m(_,k){y(_,e,k),w(e,t),y(_,l,k),m[s].m(_,k),y(_,r,k),y(_,a,k),y(_,u,k),g&&g.m(_,k),y(_,f,k),c=!0},p(_,k){(!c||k&256&&i!==(i=_[8]))&&p(e,"for",i);let S=s;s=h(_),s===S?m[s].p(_,k):(re(),D(m[S],1,1,()=>{m[S]=null}),ae(),o=m[s],o?o.p(_,k):(o=m[s]=d[s](_),o.c()),E(o,1),o.m(r.parentNode,r)),_[3].length?g?g.p(_,k):(g=fh(_),g.c(),g.m(f.parentNode,f)):g&&(g.d(1),g=null)},i(_){c||(E(o),c=!0)},o(_){D(o),c=!1},d(_){_&&(v(e),v(l),v(r),v(a),v(u),v(f)),m[s].d(_),g&&g.d(_)}}}function fD(n){let e,t;return e=new fe({props:{class:"form-field required "+(n[3].length?"error":""),name:"viewQuery",$$slots:{default:[uD,({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||(E(e.$$.fragment,i),t=!0)},o(i){D(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function cD(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,k=m[h]||h;r.push(z.sentenize(k+": "+_))}}Yt(async()=>{t(2,o=!0);try{t(1,s=(await Et(async()=>{const{default:c}=await import("./CodeEditor-BmjD0EKy.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 dD extends ye{constructor(e){super(),ve(this,e,cD,fD,_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,_,k,S,$,T,O,M,L,I,A=pe(n[4]),P=[];for(let N=0;N<A.length;N+=1)P[N]=hh(dh(n,A,N));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 N=0;N<P.length;N+=1)P[N].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
<em>@collection</em> filter:`,k=C(),S=b("div"),S.innerHTML="<code>@collection.ANY_COLLECTION_NAME.*</code>",$=C(),T=b("hr"),O=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(T,"class","m-t-10 m-b-5"),p(i,"class","content"),p(t,"class","alert alert-warning m-0")},m(N,R){y(N,e,R),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,k),w(i,S),w(i,$),w(i,T),w(i,O),w(i,M),I=!0},p(N,R){if(R&24){A=pe(N[4]);let U;for(U=0;U<A.length;U+=1){const j=dh(N,A,U);P[U]?P[U].p(j,R):(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(N){I||(N&&nt(()=>{I&&(L||(L=je(e,mt,{duration:150},!0)),L.run(1))}),I=!0)},o(N){N&&(L||(L=je(e,mt,{duration:150},!1)),L.run(0)),I=!1},d(N){N&&v(e),pt(P,N),N&&L&&L.end()}}}function mh(n){let e,t=n[15]+"",i;return{c(){e=b("code"),i=Y(t)},m(l,s){y(l,e,s),w(e,i)},p(l,s){s&16&&t!==(t=l[15]+"")&&ue(i,t)},d(l){l&&v(e)}}}function hh(n){let e=!n[3].includes(n[15]),t,i=e&&mh(n);return{c(){i&&i.c(),t=ke()},m(l,s){i&&i.m(l,s),y(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&&v(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:[pD,({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(()=>ge(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(()=>ge(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(()=>ge(r,"rule",h)),{c(){H(e.$$.fragment),i=C(),H(l.$$.fragment),o=C(),H(r.$$.fragment)},m(_,k){F(e,_,k),y(_,i,k),F(l,_,k),y(_,o,k),F(r,_,k),u=!0},p(_,k){const S={};k&1&&(S.collection=_[0]),k&278528&&(S.$$scope={dirty:k,ctx:_}),!t&&k&1&&(t=!0,S.rule=_[0].createRule,$e(()=>t=!1)),e.$set(S);const $={};k&1&&($.collection=_[0]),!s&&k&1&&(s=!0,$.rule=_[0].updateRule,$e(()=>s=!1)),l.$set($);const T={};k&1&&(T.collection=_[0]),!a&&k&1&&(a=!0,T.rule=_[0].deleteRule,$e(()=>a=!1)),r.$set(T)},i(_){u||(E(e.$$.fragment,_),E(l.$$.fragment,_),E(r.$$.fragment,_),u=!0)},o(_){D(e.$$.fragment,_),D(l.$$.fragment,_),D(r.$$.fragment,_),u=!1},d(_){_&&(v(i),v(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){y(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&&v(e),t=!1,i()}}}function pD(n){let e,t=!n[14]&&gh();return{c(){t&&t.c(),e=ke()},m(i,l){t&&t.m(i,l),y(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&&v(e),t&&t.d(i)}}}function bh(n){let e,t,i,l,s,o,r,a,u,f,c;function d(_,k){return _[2]?hD:mD}let m=d(n),h=m(n),g=n[2]&&kh(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=ke(),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(_,k){y(_,e,k),y(_,t,k),y(_,i,k),w(i,l),w(i,s),h.m(i,null),y(_,r,k),g&&g.m(_,k),y(_,a,k),u=!0,f||(c=B(i,"click",n[11]),f=!0)},p(_,k){m!==(m=d(_))&&(h.d(1),h=m(_),h&&(h.c(),h.m(i,null))),(!u||k&4&&o!==(o="btn btn-sm m-b-sm "+(_[2]?"btn-secondary":"btn-hint btn-transparent")))&&p(i,"class",o),_[2]?g?(g.p(_,k),k&4&&E(g,1)):(g=kh(_),g.c(),E(g,1),g.m(a.parentNode,a)):g&&(re(),D(g,1,1,()=>{g=null}),ae())},i(_){u||(E(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){y(a,e,u),y(a,t,u),y(a,i,u),y(a,l,u),y(a,s,u),y(a,o,u),y(a,r,u)},p:te,d(a){a&&(v(e),v(t),v(i),v(l),v(s),v(o),v(r))}}}function gD(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){y(l,e,s),y(l,t,s),y(l,i,s)},p:te,d(l){l&&(v(e),v(t),v(i))}}}function bD(n){var R,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,_,k,S,$,T,O=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(()=>ge(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(()=>ge(m,"rule",I));let P=((R=n[0])==null?void 0:R.type)!=="view"&&_h(n),N=((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(),O&&O.c(),u=C(),H(f.$$.fragment),d=C(),H(m.$$.fragment),g=C(),P&&P.c(),_=C(),N&&N.c(),k=ke(),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){y(j,e,V),w(e,t),w(t,i),w(t,l),w(t,s),w(s,r),w(e,a),O&&O.m(e,null),y(j,u,V),F(f,j,V),y(j,d,V),F(m,j,V),y(j,g,V),P&&P.m(j,V),y(j,_,V),N&&N.m(j,V),y(j,k,V),S=!0,$||(T=B(s,"click",n[5]),$=!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]?O?(O.p(j,V),V&2&&E(O,1)):(O=ph(j),O.c(),E(O,1),O.m(e,null)):O&&(re(),D(O,1,1,()=>{O=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&&E(P,1)):(P=_h(j),P.c(),E(P,1),P.m(_.parentNode,_)):P&&(re(),D(P,1,1,()=>{P=null}),ae()),((X=j[0])==null?void 0:X.type)==="auth"?N?(N.p(j,V),V&1&&E(N,1)):(N=bh(j),N.c(),E(N,1),N.m(k.parentNode,k)):N&&(re(),D(N,1,1,()=>{N=null}),ae())},i(j){S||(E(O),E(f.$$.fragment,j),E(m.$$.fragment,j),E(P),E(N),S=!0)},o(j){D(O),D(f.$$.fragment,j),D(m.$$.fragment,j),D(P),D(N),S=!1},d(j){j&&(v(e),v(u),v(d),v(g),v(_),v(k)),O&&O.d(),q(f,j),q(m,j),P&&P.d(j),N&&N.d(j),$=!1,T()}}}function kD(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(k){n.$$.not_equal(s.listRule,k)&&(s.listRule=k,t(0,s))}function f(k){n.$$.not_equal(s.viewRule,k)&&(s.viewRule=k,t(0,s))}function c(k){n.$$.not_equal(s.createRule,k)&&(s.createRule=k,t(0,s))}function d(k){n.$$.not_equal(s.updateRule,k)&&(s.updateRule=k,t(0,s))}function m(k){n.$$.not_equal(s.deleteRule,k)&&(s.deleteRule=k,t(0,s))}const h=()=>{t(2,r=!r)};function g(k){n.$$.not_equal(s.authRule,k)&&(s.authRule=k,t(0,s))}function _(k){n.$$.not_equal(s.manageRule,k)&&(s.manageRule=k,t(0,s))}return n.$$set=k=>{"collection"in k&&t(0,s=k.collection)},n.$$.update=()=>{var k;n.$$.dirty&1&&t(4,i=z.getAllCollectionIdentifiers(s)),n.$$.dirty&1&&t(3,l=(k=s.fields)==null?void 0:k.filter(S=>S.hidden).map(S=>S.name))},[s,o,r,l,i,a,u,f,c,d,m,h,g,_]}class vD extends ye{constructor(e){super(),ve(this,e,kD,bD,_e,{collection:0})}}function vh(n,e,t){const i=n.slice();return i[19]=e[t],i}function yh(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){y(t,e,i)},d(t){t&&v(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){y(r,e,a),y(r,t,a),y(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&&(v(e),v(t),v(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
`),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,_){y(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 k,S;_&2&&s!==(s=((k=g[1])==null?void 0:k.name)+"")&&ue(o,s),_&4&&c!==(c=((S=g[2])==null?void 0:S.name)+"")&&ue(d,c)},d(g){g&&v(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(yh(n,o,f));let a=pe(n[7]),u=[];for(let f=0;f<a.length;f+=1)u[f]=Mh(vh(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=ke()},m(f,c){for(let d=0;d<s.length;d+=1)s[d]&&s[d].m(f,c);y(f,e,c);for(let d=0;d<r.length;d+=1)r[d]&&r[d].m(f,c);y(f,t,c);for(let d=0;d<u.length;d+=1)u[d]&&u[d].m(f,c);y(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=yh(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=vh(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&&(v(e),v(t),v(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){y(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&&v(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){y(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&&v(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){y(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&&v(e)}}}function yD(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=ke(),p(t,"class","icon"),p(l,"class","content txt-bold"),p(e,"class","alert alert-warning")},m(c,d){y(c,e,d),w(e,t),w(e,i),w(e,l),w(l,s),w(l,o),u&&u.m(l,null),y(c,r,d),f&&f.m(c,d),y(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&&(v(e),v(r),v(a)),u&&u.d(),f&&f.d(c)}}}function wD(n){let e;return{c(){e=b("h4"),e.textContent="Confirm collection changes"},m(t,i){y(t,e,i)},p:te,d(t){t&&v(e)}}}function SD(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){y(o,e,r),y(o,t,r),y(o,i,r),e.focus(),l||(s=[B(e,"click",n[12]),B(i,"click",n[13])],l=!0)},p:te,d(o){o&&(v(e),v(t),v(i)),l=!1,De(s)}}}function TD(n){let e,t,i={class:"confirm-changes-panel",popup:!0,$$slots:{footer:[SD],header:[wD],default:[yD]},$$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||(E(e.$$.fragment,l),t=!0)},o(l){D(e.$$.fragment,l),t=!1},d(l){n[14](null),q(e,l)}}}function $D(n,e,t){let i,l,s,o,r,a;const u=bt();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 k=()=>g(),S=()=>_();function $(M){ie[M?"unshift":"push"](()=>{f=M,t(5,f)})}function T(M){Pe.call(this,n,M)}function O(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 N;const P=(N=c==null?void 0:c.fields)==null?void 0:N.find(R=>R.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,k,S,$,T,O]}class CD extends ye{constructor(e){super(),ve(this,e,$D,TD,_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 OD(n){let e,t,i;function l(o){n[43](o)}let s={};return n[2]!==void 0&&(s.collection=n[2]),e=new oD({props:s}),ie.push(()=>ge(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||(E(e.$$.fragment,o),i=!0)},o(o){D(e.$$.fragment,o),i=!1},d(o){q(e,o)}}}function ED(n){let e,t,i;function l(o){n[42](o)}let s={};return n[2]!==void 0&&(s.collection=n[2]),e=new dD({props:s}),ie.push(()=>ge(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||(E(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 vD({props:o}),ie.push(()=>ge(t,"collection",s)),{c(){e=b("div"),H(t.$$.fragment),p(e,"class","tab-item active")},m(r,a){y(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||(E(t.$$.fragment,r),l=!0)},o(r){D(t.$$.fragment,r),l=!1},d(r){r&&v(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 OO({props:o}),ie.push(()=>ge(t,"collection",s)),{c(){e=b("div"),H(t.$$.fragment),p(e,"class","tab-item"),Q(e,"active",n[3]===ss)},m(r,a){y(r,e,a),F(t,e,null),l=!0},p(r,a){const
`+z.truncate(JSON.stringify(z.truncateObject(k_(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&&Ft(r.update)&&d&1&&r.update.call(null,{text:`Open relation record in new tab:
`+z.truncate(JSON.stringify(z.truncateObject(k_(c[0],"expand")),null,2),800,!0),class:"code",position:"left"})},i(c){a||(E(t.$$.fragment,c),a=!0)},o(c){D(t.$$.fragment,c),a=!1},d(c){c&&v(e),q(t),u=!1,De(f)}}}function k_(n,...e){const t=Object.assign({},n);for(let i of e)delete t[i];return t}function TI(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(),ve(this,e,TI,SI,_e,{record:0})}}function v_(n,e,t){const i=n.slice();return i[19]=e[t],i[9]=t,i}function y_(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 $I(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 CI(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 OI(n){const e=n.slice(),t=z.trimQuotedValue(JSON.stringify(e[3]))||'""';return e[6]=t,e}function EI(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){y(i,e,l),w(e,t)},p(i,l){l&8&&ue(t,i[3])},i:te,o:te,d(i){i&&v(e)}}}function MI(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){y(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&&v(e)}}}function DI(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=v_(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){y(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=yt(t,f,r,1,u,o,i,e,zt,T_,l,v_),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)E(t[f]);s=!0}},o(u){for(let f=0;f<t.length;f+=1)D(t[f]);s=!1},d(u){u&&v(e);for(let f=0;f<t.length;f+=1)t[f].d();a&&a.d()}}}function II(n){let e,t,i,l,s;const o=[UI,zI],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){y(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()),E(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||(E(i),s=!0)},o(f){D(i),s=!1},d(f){f&&v(e),r[t].d(),u&&u.d()}}}function LI(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){y(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=yt(t,r,s,1,o,l,i,e,ci,M_,null,S_))},i:te,o:te,d(o){o&&v(e);for(let r=0;r<t.length;r+=1)t[r].d()}}}function AI(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||(E(e.$$.fragment,i),t=!0)},o(i){D(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function PI(n){let e,t,i,l;const s=[BI,VI],o=[];function r(a,u){return a[2]?0:1}return e=r(n),t=o[e]=s[e](n),{c(){t.c(),i=ke()},m(a,u){o[e].m(a,u),y(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()),E(t,1),t.m(i.parentNode,i))},i(a){l||(E(t),l=!0)},o(a){D(t),l=!1},d(a){a&&v(i),o[e].d(a)}}}function NI(n){let e,t=z.truncate(n[3])+"",i,l,s;return{c(){e=b("a"),i=Y(t),p(e,"cl
`),position:"left"})),i=!0)},p(s,[o]){t&&Ft(t.update)&&o&1&&t.update.call(null,{text:s[0].join(`
`),position:"left"})},i:te,o:te,d(s){s&&v(e),i=!1,l()}}}const nL="yyyy-MM-dd HH:mm:ss.SSS";function iL(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],nL)+" 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 lL extends ye{constructor(e){super(),ve(this,e,iL,tL,_e,{record:1})}}function R_(n,e,t){const i=n.slice();return i[9]=e[t],i}function sL(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){y(t,e,i)},p:te,d(t){t&&v(e)}}}function oL(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){y(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&&v(e),pt(i,l)}}}function rL(n){let e;return{c(){e=b("div"),e.innerHTML='<span class="loader"></span>',p(e,"class","block txt-center")},m(t,i){y(t,e,i)},p:te,d(t){t&&v(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,_,k,S;function $(){return n[6](n[9])}return{c(){var T;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(),yn(i.src,l="./images/oauth2/"+((T=n[3](n[9].provider))==null?void 0:T.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(T,O){y(T,e,O),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,_),k||(S=B(g,"click",$),k=!0)},p(T,O){var M;n=T,O&2&&!yn(i.src,l="./images/oauth2/"+((M=n[3](n[9].provider))==null?void 0:M.logo))&&p(i,"src",l),O&2&&r!==(r=n[4](n[9].provider)+"")&&ue(a,r),O&2&&d!==(d=n[9].providerId+"")&&ue(m,d)},d(T){T&&v(e),k=!1,S()}}}function aL(n){let e;function t(s,o){var r;return s[2]?rL:(r=s[0])!=null&&r.id&&s[1].length?oL:sL}let i=t(n),l=i(n);return{c(){l.c(),e=ke()},m(s,o){l.m(s,o),y(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&&v(e),l.d(s)}}}function uL(n,e,t){const i=bt();let{record:l}=e,s=[],o=!1;function r(d){return ef.find(m=>m.key==d)||{}}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 fL extends ye{constructor(e){super(),ve(this,e,uL,aL,_e,{record:0})}}function cL(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){y(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||(E(s.$$.fragment,c),a=!0)},o(c){D(s.$$.fragment,c),a=!1},d(c){c&
(record: `+n[44].id+")")),B(e,"click",tt(function(){Ft(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&&Ft(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&&v(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=ke();for(let o=0;o<s.length;o+=1)s[o].c();i=ke(),this.first=t},m(o,r){y(o,t,r);for(let a=0;a<s.length;a+=1)s[a]&&s[a].m(o,r);y(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&&(v(t),v(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){y(t,e,i)},d(t){t&&v(e)}}}function zL(n){let e,t;function i(r,a){if(r[15])return qL;if(!r[6])return FL}let l=i(n),s=l&&l(n),o=n[6]&&Q_();return{c(){s&&s.c(),e=C(),o&&o.c(),t=ke()},m(r,a){s&&s.m(r,a),y(r,e,a),o&&o.m(r,a),y(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&&(v(e),v(t)),s&&s.d(r),o&&o.d(r)}}}function UL(n){let e,t,i,l;const s=[RL,NL],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=ke()},m(a,u){o[e].m(a,u),y(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()),E(t,1),t.m(i.parentNode,i))},i(a){l||(E(t),l=!0)},o(a){D(t),l=!1},d(a){a&&v(i),o[e].d(a)}}}function VL(n){let e,t;return{c(){e=b("h4"),t=Y(n[0])},m(i,l){y(i,e,l),w(e,t)},p(i,l){l[0]&1&&ue(t,i[0])},d(i){i&&v(e)}}}function x_(n){let e,t;return e=new fe({props:{class:"form-field file-picker-size-select",$$slots:{default:[BL,({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||(E(e.$$.fragment,i),t=!0)},o(i){D(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function BL(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 Bn({props:s}),ie.push(()=>ge(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||(E(e.$$.fragment,o),i=!0)},o(o){D(e.$$.fragment,o),i=!1},d(o){q(e,o)}}}function WL(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,_){y(g,e,_),w(e,t),y(g,i,_),m&&m.m(g,_),y(g,s,_),y(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 k;(!f||_[0]&64)&&(e.disabled=g[6]),_[0]&512&&(l=z.hasImageExtension((k=g[9])==null?void 0:k.name)),l?m?(m.p(g,_),_[0]&512&&E(m,1)):(m=x_(g),m.c(),E(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||(E(m),f=!0)},o(g){D(m),f=!1},d(g){g&&(v(e),v(i),v(s),v(o)),m&&m.d(g),c=!1,De(d)}}}function YL(n){let e,t,i,l;const s=[{popup:!0},{class:"file-picker-popup"},n[22]];let o={$$slots:{footer:[WL],header:[VL],default:[UL]},$$scope:{ctx:n}};for(let a=0;a<s.length;a+=1)o=ze(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),y(a,t,u),F(i,a,u),l=!0},p(a,u){const f=u[0]&4194304?wt(s,[s[0],s[1],qt(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:[mA,({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){y(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||(E(t.$$.fragment,o),i=!0)},o(o){D(t.$$.fragment,o),i=!1},d(o){o&&v(e),q(t),l=!1,De(s)}}}function _A(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 k(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 $(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 T=V=>g(V),O=V=>_(V);function M(V){a=V,t(0,a),t(6,i),t(4,r)}const L=V=>k(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)},N=()=>c==null?void 0:c.click();function R(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,_,k,$,T,O,M,L,I,A,P,N,R,U,j]}class gA extends ye{constructor(e){super(),ve(this,e,_A,hA,_e,{record:3,field:4,value:0,uploadedFiles:1,deletedFileNames:2},null,[-1,-1])}}function bA(n){let e;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(t,i){y(t,e,i)},d(t){t&&v(e)}}}function kA(n){let e;return{c(){e=b("i"),p(e,"class","ri-checkbox-circle-fill txt-success")},m(t,i){y(t,e,i)},d(t){t&&v(e)}}}function vA(n){let e,t,i,l;function s(a,u){return a[4]?kA:bA}let o=s(n),r=o(n);return{c(){e=b("span"),r.c(),p(e,"class","json-state svelte-p6ecb8")},m(a,u){y(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&&Ft(t.update)&&u&16&&t.update.call(null,{position:"left",text:a[4]?"Valid JSON":"Invalid JSON"})},d(a){a&&v(e),r.d(),i=!1,l()}}}function yA(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){y(t,e,i)},p:te,i:te,o:te,d(t){t&&v(e)}}}function wA(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=ke()},m(o,r){e&&F(e,o,r),y(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),E(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&&E(e.$$.fragment,o),i=!0)},o(o){e&&D(e.$$.fragment,o),i=!1},d(o){o&&v(t),e&&q(e,o)}}}function SA(n){let e,t,i,l,s,o;e=new ti({props:{uniqueId:n[6],field:n[1],$$slots:{default:[vA]},$$scope:{ctx:n}}});const r=[wA,yA],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=ke()},m(f,c){F(e,f,c),y(f,t,c),a[i].m(f,c),y(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()),E(l,1),l.m(s.parentNode,s))},i(f){o||(E(e.$$.fragment,f),E(l),o=!0)},o(f){D(e.$$.fragment,f),D(l)
`),A&&A.c(),m=C(),g.c(),_=ke(),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){y(U,e,j),F(t,e,null),w(e,i),T&&T.m(e,null),y(U,l,j),y(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),y(U,f,j),y(U,c,j),w(c,d),A&&A.m(c,null),y(U,m,j),N[h].m(U,j),y(U,_,j),k=!0,S||($=Me(u=NA.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]?T&&(T.d(1),T=null):T?T.p(U,j):(T=ug(U),T.c(),T.m(e,null)),j[0]&143252&&(O=pe(U[8]),re(),o=yt(o,j,M,1,U,O,r,s,zt,mg,a,ag),ae(),!O.length&&L?L.p(U,j):O.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&&Ft(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=R(U),h===K?N[h].p(U,j):(re(),D(N[K],1,1,()=>{N[K]=null}),ae(),g=N[h],g?g.p(U,j):(g=N[h]=P[h](U),g.c()),E(g,1),g.m(_.parentNode,_))},i(U){if(!k){E(t.$$.fragment,U);for(let j=0;j<O.length;j+=1)E(o[j]);E(g),k=!0}},o(U){D(t.$$.fragment,U);for(let j=0;j<o.length;j+=1)D(o[j]);D(g),k=!1},d(U){U&&(v(e),v(l),v(s),v(f),v(c),v(m),v(_)),q(t),T&&T.d();for(let j=0;j<o.length;j+=1)o[j].d();L&&L.d(),I&&I.d(),A&&A.d(),N[h].d(U),S=!1,$()}}}function UA(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){y(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&&v(e)}}}function VA(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){y(o,e,r),y(o,t,r),y(o,i,r),l||(s=[B(e,"click",n[28]),B(i,"click",n[29])],l=!0)},p:te,d(o){o&&(v(e),v(t),v(i)),l=!1,De(s)}}}function BA(n){let e,t,i,l;const s=[{popup:!0},{class:"overlay-panel-xl"},n[19]];let o={$$slots:{footer:[VA],header:[UA],default:[zA]},$$scope:{ctx:n}};for(let a=0;a<s.length;a+=1)o=ze(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),y(a,t,u),F(i,a,u),l=!0},p(a,u){const f=u[0]&524288?wt(s,[s[0],s[1],qt(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||(E(e.$$.fragment,a),E(i.$$.fragment,a),l=!0)},o(a){D(e.$$.fragment,a),D(i.$$.fragment,a),l=!1},d(a){a&&v(t),n[39](null),q(e,a),n[42](null),q(i,a)}}}const Go=50;function WA(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=bt(),g="picker_"+z.randomString(5);let{value:_}=e,{field:k}=e,S,$,T="",O=[],M=[],L=1,I=0,A=!1,P=!1;function N(){return t(2,T=""),t(8,O=[]),t(6,M=[]),j(),V(!0),S==null?void 0:S.show()}function R(){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 Tt=z.getExpandPresentableRelField(xe,m,2);Tt&&(Oe!=""&&(Oe+=","),Oe+=Tt)}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 Tt=[];for(const Zt of Ne.splice(0,Go))Tt.push(`id="${Zt}"`);xe.push(me.collection(l).getFullList({batch:Go,filter:Tt.join("||"),fields:"*:excerpt(200)",expand:U(),requestKey:null}))}try{await Promise.all(xe).then(Tt=>{ut=ut.concat(...Tt)}),t(6,M=[]);for(const Tt of Oe){const Zt=z.findByKey(ut,"id",Tt);Zt&&M.push(Zt)}T.trim()||t(8,O=z.filterDuplicatesByKey(M.concat(O))),t(24,P=!1)}catch(Tt){Tt.isAbort||(me.error(Tt),t(24,P=!1))}}async function V(Oe=!1){if(l){t(3,A=!0),Oe&&(T.trim()?t(8,O=[]):t(8,O=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){y(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||(E(u.$$.fragment,m),f=!0)},o(m){D(u.$$.fragment,m),f=!1},d(m){m&&v(e),q(u),c=!1,d()}}}function bP(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 _P({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){y(c,e,d),w(e,t),w(t,i),w(i,s),w(t,o),F(r,t,null),y(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=`
2024-09-30 00:23:19 +08:00
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||(E(r.$$.fragment,c),E(u.$$.fragment,c),f=!0)},o(c){D(r.$$.fragment,c),D(u.$$.fragment,c),f=!1},d(c){c&&(v(e),v(a)),q(r),q(u,c)}}}function kP(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){y(c,e,d),w(e,t),y(c,l,d),y(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&&(v(e),v(l),v(s)),u=!1,f()}}}function vP(n){let e,t,i,l,s,o;const r=[bP,gP],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=ke(),p(e,"class","clearfix")},m(f,c){y(f,e,c),y(f,t,c),a[i].m(f,c),y(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()),E(l,1),l.m(s.parentNode,s))},i(f){o||(E(l),o=!0)},o(f){D(l),o=!1},d(f){f&&(v(e),v(t),v(s)),a[i].d(f)}}}function yP(n){let e;return{c(){e=b("h4"),e.textContent="Impersonate auth token"},m(t,i){y(t,e,i)},p:te,d(t){t&&v(e)}}}function wP(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){y(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&&v(e),i=!1,l()}}}function SP(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){y(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&&v(e),i=!1,l()}}}function TP(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?SP:wP}let a=r(n),u=a(n);return{c(){e=b("button"),t=b("span"),t.textContent="Close",i=C(),u.c(),l=ke(),p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-transparent"),e.disabled=n[6]},m(f,c){y(f,e,c),w(e,t),y(f,i,c),u.m(f,c),y(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&&(v(e),v(i),v(l)),u.d(f),s=!1,o()}}}function $P(n){let e,t,i={overlayClose:!1,escClose:!n[6],beforeHide:n[15],popup:!0,$$slots:{footer:[TP],header:[yP],default:[vP]},$$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||(E(e.$$.fragment,l),t=!0)},o(l){D(e.$$.fragment,l),t=!1},d(l){n[16](null),q(e,l)}}}function CP(n,e,t){let i;const l=bt(),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(),k=()=>h(),S=L=>t(5,u=L.target.value<<0),$=()=>!f;function T(L){ie[L?"unshift":"push"](()=>{a=L,t(4,a)})}function O(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,_,k,S,$,T,O,M]}class OP extends ye{constructor(e){super(),ve(this,e,CP,$P,_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(_,k){y(_,e,k),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,mt,{duration:150})),m=!1},d(_){_&&v(e),_&&d&&d.end(),h=!1,De(g)}}}function Pg(n){let e,t,i;return t=new lL({props:{record:n[3]}}),{c(){e=b("div"),H(t.$$.fragment),p(e,"class","form-field-addon")},m(l,s){y(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||(E(t.$$.fragment,l),i=!0)},o(l){D(t.$$.fragment,l),i=!1},d(l){l&&v(e),q(t)}}}function EP(n){let e,t,i,l,s,o,r,a,u,f,c,d,m,h,g,_,k,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",zs(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(($=n[19])==null?void 0:$.autogeneratePattern)?"Leave empty to auto generate...":""),p(f,"minlength",m=(T=n[19])==null?void 0:T.min),f.readOnly=h=!n[6]},m($,T){y($,e,T),w(e,t),w(e,i),w(e,l),w(e,s),w(e,o),y($,a,T),S&&S.m($,T),y($,u,T),y($,f,T),ce(f,n[3].id),g=!0,_||(k=B(f,"input",n[48]),_=!0)},p($,T){var O,M;(!g||T[2]&8388608&&r!==(r=$[85]))&&p(e,"for",r),$[6]?S&&(re(),D(S,1,1,()=>{S=null}),ae()):S?(S.p($,T),T[0]&64&&E(S,1)):(S=Pg($),S.c(),E(S,1),S.m(u.parentNode,u)),(!g||T[2]&8388608&&c!==(c=$[85]))&&p(f,"id",c),(!g||T[0]&524416&&d!==(d=!$[7]&&!z.isEmpty((O=$[19])==null?void 0:O.autogeneratePattern)?"Leave empty to auto generate...":""))&&p(f,"placeholder",d),(!g||T[0]&524288&&m!==(m=(M=$[19])==null?void 0:M.min))&&p(f,"minlength",m),(!g||T[0]&64&&h!==(h=!$[6]))&&(f.readOnly=h),T[0]&8&&f.value!==$[3].id&&ce(f,$[3].id)},i($){g||(E(S),g=!0)},o($){D(S),g=!1},d($){$&&(v(e),v(a),v(u),v(f)),S&&S.d($),_=!1,k()}}}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 wL({props:r}),ie.push(()=>ge(e,"record",o));let a=n[16].length&&Rg();return{c(){H(e.$$.fragment),i=C(),a&&a.c(),l=ke()},m(u,f){F(e,u,f),y(u,i,f),a&&a.m(u,f),y(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||(E(e.$$.fragment,u),s=!0)},o(u){D(e.$$.fragment,u),s=!1},d(u){u&&(v(i),v(l)),q(e,u),a&&a.d(u)}}}function Rg(n){let e;return{c(){e=b("hr")},m(t,i){y(t,e,i)},d(t){t&&v(e)}}}function MP(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 PA({props:s}),ie.push(()=>ge(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||(E(e.$$.fragment,o),i=!0)},o(o){D(e.$$.fragment,o),i=!1},d(o){q(e,o)}}}function DP(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 QA({props:s}),ie.push(()=>ge(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||(E(e.$$.fragment,o),i=!0)},o(o){D(e.$$.fragment,o),i=!1},d(o){q(e,o)}}}function IP(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:[KP],header:[WP],default:[zP]},$$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 OP({props:o}),n[68](i),{c(){H(e.$$.fragment),t=C(),H(i.$$.fragment)},m(r,a){F(e,r,a),y(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||(E(e.$$.fragment,r),E(i.$$.fragment,r),l=!0)},o(r){D(e.$$.fragment,r),D(i.$$.fragment,r),l=!1},d(r){r&&v(t),n[65](null),q(e,r),n[68](null),q(i,r)}}}const Ml="form",io="providers";function ZP(n,e,t){let i,l,s,o,r,a,u,f;const c=bt(),d="record_"+z.randomString(5);let{collection:m}=e,h,g,_={},k={},S=null,$=!1,T=!1,O={},M={},L=JSON.stringify(_),I=L,A=Ml,P=!0,N=!0,R=m,U=[];const j=["id"],V=j.concat("email","emailVisibility","verified","tokenKey","password");function K(le){return Se(le),t(14,T=!0),t(15,A=Ml),h==null?void 0:h.show()}function J(){return h==null?void 0:h.hide()}function ee(){t(14,T=!1),J()}function X(){t(34,R=m),h!=null&&h.isActive()&&(st(JSON.stringify(k)),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,N=!0),Wt({}),t(4,O={}),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,k=structuredClone(_)),t(2,_=await oe(le)||{}),t(3,k=structuredClone(_)),await fn(),t(12,S=We()),!S||Be(k,S)?t(12,S=null):(delete S.password,delete S.passwordConfirm),t(32,L=JSON.stringify(k)),t(7,N=!1)}async function we(le){var Re,Ke;Wt({}),t(2,_=le||{}),t(4,O={}),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,k[Ae]=le[Ae],k);await fn(),t(32,L=JSON.stringify(k)),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,k=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(!($||!u||!(m!=null&&m.id))){t(13,$=!0);try{const Re=Ht();let Ke;if(P?Ke=await me.collection(m.id).create(Re):Ke=await me.collection(m.id).update(k.id,Re),tn(P?"Successfully created record.":"Successfully updated record."),rt(),l&&(k==null?void 0:k.id)==((Ee=me.authStore.record)==null?void 0:Ee.id)&&Re.get("password"))return me.logout();le?ee():we(Ke),c("save",{isNew:P,record:Ke})}catch(Re){me.error(Re)}t(13,$=!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(k||{}),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 O){const Ge=z.toArray(O[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 O=0;O<T.length;O+=1)T[O].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(O,M){y(O,e,M),w(e,t),y(O,l,M),F(s,O,M),y(O,r,M),y(O,a,M),w(a,u),y(O,f,M),y(O,c,M),w(c,d),w(d,m);for(let L=0;L<T.length;L+=1)T[L]&&T[L].m(d,null);h=!0,g||(_=B(u,"click",n[12]),g=!0)},p(O,M){(!h||M&65536&&i!==(i=O[16]))&&p(e,"for",i);const L={};if(M&65536&&(L.id=O[16]),!o&&M&1&&(o=!0,L.value=O[0].trustedProxy.headers,$e(()=>o=!1)),s.$set(L),(!h||M&1)&&Q(u,"hidden",z.isEmpty(O[0].trustedProxy.headers)),M&68){$=pe(O[2]);let I;for(I=0;I<$.length;I+=1){const A=f1(O,$,I);T[I]?T[I].p(A,M):(T[I]=c1(A),T[I].c(),T[I].m(d,null))}for(;I<T.length;I+=1)T[I].d(1);T.length=$.length}},i(O){h||(E(s.$$.fragment,O),h=!0)},o(O){D(s.$$.fragment,O),h=!1},d(O){O&&(v(e),v(l),v(r),v(a),v(f),v(c)),q(s,O),pt(T,O),g=!1,_()}}}function VN(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 Bn({props:m}),ie.push(()=>ge(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){y(h,e,g),w(e,t),w(e,i),w(e,l),y(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||(E(r.$$.fragment,h),u=!0)},o(h){D(r.$$.fragment,h),u=!1},d(h){h&&(v(e),v(o)),q(r,h),f=!1,c()}}}function BN(n){let e,t,i,l,s,o,r=(n[1].realIP||"N/A")+"",a,u,f,c,d,m,h,g,_,k,S=(n[1].possibleProxyHeader||"N/A")+"",$,T,O,M,L,I,A,P,N,R,U,j,V;return A=new fe({props:{class:"form-field m-b-0",name:"trustedProxy.headers",$$slots:{default:[UN,({uniqueId:K})=>({16:K}),({uniqueId:K})=>K?65536:0]},$$scope:{ctx:n}}}),R=new fe({props:{class:"form-field m-0",name:"trustedProxy.useLeftmostIP",$$slots:{default:[VN,({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(),k=b("strong"),$=Y(S),T=C(),O=b("div"),O.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(),N=b("div"),H(R.$$.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(O,"class","content m-b-sm"),p(I,"class","col-lg-9"),p(N,"class","col-lg-3"),p(L,"class","grid grid-sm")},m(K,J){y(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,k),w(k,$),y(K,T,J),y(K,O,J),y(K,M,J),y(K,L,J),w(L,I),F(A,I,null),w(L,P),w(L,N),F(R,N,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($,S);const ee={};J&1114117&&(ee.$$scope={dirty:J,ctx:K}),A.$set(ee);const X={};J&1114113&&(X.$$scope={dirty:J,ctx:K}),R.$set(X)},i(K){U||(E(A.$$.fragment,K),E(R.$$.fragment,K),U=!0)},o(K){D(A.$$.fragment,K),D(R.$$.fragment,K),U=!1},d(K){K&&(v(e),v(T),v(O),v(M),v(L)),q(A),q(R),j=!1,V()}}}function WN(n){let e,t,i;return{c(){e=b("i"),p(e,"class","ri-alert-line txt-sm txt-hint")},m(l,s){y(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&&v(e),t=!1,i()}}}function YN(n){let e,t,i;return{c(){e=b("i"),p(e,"class","ri-alert-line txt-sm txt-warning")},m(l,s){y(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&&v(e),t=!1,i()}}}function KN(n){let e;return{c(){e=b("span"),e.textContent="Disabled",p(e,"class","label")},m(t,i){y(t,e,i)},d(t){t&&v(e)}}}function JN(n){let e;return{c(){e=b("span"),e.textContent="Enabled",p(e,"class","label label-success")},m(t,i){y(t,e,i)},d(t){t&&v(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){y(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=je(e,Dt,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=je(e,Dt,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&v(e),o&&t&&t.end(),l=!1,s()}}}function ZN(n){let e,t,i,l,s,o,r,a,u,f,c;function d($,T){if(T&43&&(o=null),!$[3]&&$[1].possibleProxyHeader)return YN;if(o==null&&(o=!!($[3]&&!$[5]&&!$[0].trustedProxy.headers.includes($[1].possibleProxyHeader))),o)return WN}let m=d(n,-1),h=m&&m(n);function g($,T){return $[3]?JN:KN}let _=g(n),k=_(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(),k.c(),f=C(),S&&S.c(),c=ke(),p(t,"class","ri-route-line"),p(l,"class","txt"),p(e,"class","inline-flex"),p(a,"class","flex-fill")},m($,T){y($,e,T),w(e,t),w(e,i),w(e,l),w(e,s),h&&h.m(e,null),y($,r,T),y($,a,T),y($,u,T),k.m($,T),y($,f,T),S&&S.m($,T),y($,c,T)},p($,T){m!==(m=d($,T))&&(h&&h.d(1),h=m&&m($),h&&(h.c(),h.m(e,null))),_!==(_=g($))&&(k.d(1),k=_($),k&&(k.c(),k.m(f.parentNode,f))),$[4]?S?T&16&&E(S,1):(S=d1(),S.c(),E(S,1),S.m(c.parentNode,c)):S&&(re(),D(S,1,1,()=>{S=null}),ae())},d($){$&&(v(e),v(r),v(a),v(u),v(f),v(c)),h&&h.d(),k.d($),S&&S.d($)}}}function GN(n){let e,t;return e=new qi({props:{single:!0,$$slots:{header:[ZN],default:[BN]},$$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||(E(e.$$.fragment,i),t=!0)},o(i){D(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function XN(n,e,t){let i,l,s,o,r,a;Qe(n,Sn,$=>t(10,a=$));const u=["X-Forward-For","Fly-Client-IP","CF-Connecting-IP"];let{formSettings:f}=e,{healthData:c}=e,d="";function m($){t(0,f.trustedProxy.headers=[$],f)}const h=[{label:"Use leftmost IP",value:!0},{label:"Use rightmost IP",value:!1}];function g($){n.$$.not_equal(f.trustedProxy.headers,$)&&(f.trustedProxy.headers=$,t(0,f))}const _=()=>t(0,f.trustedProxy.headers=[],f),k=$=>m($);function S($){n.$$.not_equal(f.trustedProxy.useLeftmostIP,$)&&(f.trustedProxy.useLeftmostIP=$,t(0,f))}return n.$$set=$=>{"formSettings"in $&&t(0,f=$.formSettings),"healthData"in $&&t(1,c=$.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($=>$!=c.possibleProxyHeader)):u)},[f,c,r,o,s,l,m,h,d,i,a,g,_,k,S]}class QN extends ye{constructor(e){super(),ve(this,e,XN,GN,_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){y(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&&v(e)}}}function xN(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=ze(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();Qn(e,a),p(l,"id",n[2])},m(c,d){y(c,e,d),"value"in a&&(e.value=a.value),e.autofocus&&e.focus(),y(c,i,d),y(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(Qn(e,a=wt(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){y(a,e,u),y(a,t,u),y(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||(E(l.$$.fragment,a),s=!0)},o(a){D(l.$$.fragment,a),s=!1},d(a){a&&(v(e),v(t),v(i)),q(l),o=!1,r()}}}function T7(n){let e;return{c(){e=b("h4"),e.textContent="Initialize new backup",p(e,"class","center txt-break")},m(t,i){y(t,e,i)},p:te,d(t){t&&v(e)}}}function $7(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){y(a,e,u),w(e,t),y(a,i,u),y(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&&(v(e),v(i),v(l)),o=!1,r()}}}function C7(n){let e,t,i={class:"backup-create-panel",beforeOpen:n[8],beforeHide:n[9],popup:!0,$$slots:{footer:[$7],header:[T7],default:[S7]},$$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||(E(e.$$.fragment,l),t=!0)},o(l){D(e.$$.fragment,l),t=!1},d(l){n[10](null),q(e,l)}}}function O7(n,e,t){const i=bt(),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)}}oo(()=>{clearTimeout(a)});function d(){o=this.value,t(2,o)}const m=()=>r?(Ks("A backup has already been started, please wait."),!1):!0,h=()=>(r&&Ks("The backup was started but may take a while to complete. You can come back later.",4500),!0);function g(S){ie[S?"unshift":"push"](()=>{s=S,t(1,s)})}function _(S){Pe.call(this,n,S)}function k(S){Pe.call(this,n,S)}return[f,s,o,r,l,c,u,d,m,h,g,_,k]}class E7 extends ye{constructor(e){super(),ve(this,e,O7,C7,_e,{show:6,hide:0})}get show(){return this.$$.ctx[6]}get hide(){return this.$$.ctx[0]}}function M7(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){y(u,e,f),w(e,t),y(u,l,f),y(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&&(v(e),v(l),v(s)),r=!1,a()}}}function D7(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:[M7,({uniqueId:k})=>({15:k}),({uniqueId:k})=>k?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(k,S){y(k,e,S),y(k,t,S),y(k,i,S),w(i,l),w(i,s),w(s,o),w(o,r),w(s,a),F(u,s,null),w(i,f),y(k,c,S),y(k,d,S),F(m,d,null),h=!0,g||(_=B(d,"submit",tt(n[7])),g=!0)},p(k,S){(!h||S&2)&&ue(r,k[1]);const $={};S&2&&($.value=k[1]),u.$set($);const T={};S&98308&&(T.$$scope={dirty:S,ctx:k}),m.$set(T)},i(k){h||(E(u.$$.fragment,k),E(m.$$.fragment,k),h=!0)},o(k){D(u.$$.fragment,k),D(m.$$.fragment,k),h=!1},d(k){k&&(v(e),v(t),v(i),v(c),v(d)),q(u),q(m),g=!1,_()}}}function I7(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){y(s,e,o),w(e,t),w(e,i),w(i,l)},p(s,o){o&2&&ue(l,s[1])},d(s){s&&v(e)}}}function L7(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){y(u,e,f),w(e,t),y(u,i,f),y(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&&(v(e),v(i),v(l)),r=!1,a()}}}function A7(n){let e,t,i={class:"backup-restore-panel",overlayClose:!n[4],escClose:!n[4],beforeHide:n[10],popup:!0,$$slots:{footer:[L7],header:[I7],default:[D7]},$$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||(E(e.$$.fragment,l),t=!0)},o(l){D(e.$$.fragment,l),t=!1},d(l){n[11](null),q(e,l)}}}function P7(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($){clearTimeout(u),$!=null&&$.isAbort||(t(4,a=!1),$i(((S=$.response)==null?void 0:S.message)||$.message))}}}oo(()=>{clearTimeout(u)});function m(){r=this.value,t(2,r)}const h=()=>!a;function g(S){ie[S?"unshift":"push"](()=>{s=S,t(3,s)})}function _(S){Pe.call(this,n,S)}function k(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,_,k]}class N7 extends ye{constructor(e){super(),ve(this,e,P7,A7,_e,{show:8,hide:0})}get show(){return this.$$.ctx[8]}get hide(){return this.$$.ctx[0]}}function v1(n,e,t){const i=n.slice();return i[22]=e[t],i}function y1(n,e,t){const i=n.slice();return i[19]=e[t],i}function R7(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=v1(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=ke(),r&&r.c()},m(a,u){for(let f=0;f<e.length;f+=1)e[f]&&e[f].m(a,u);y(a,i,u),r&&r.m(a,u),l=!0},p(a,u){u&876&&(s=pe(a[3]),re(),e=yt(e,u,o,1,a,s,t,i.parentNode,zt,S1,i,v1),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)E(e[u]);l=!0}},o(a){for(let u=0;u<e.length;u+=1)D(e[u]);l=!1},d(a){a&&v(i);for(let u=0;u<e.length;u+=1)e[u].d(a);r&&r.d(a)}}}function F7(n){let e,t=pe(Array(n[3].length||1)),i=[];for(let l=0;l<t.length;l+=1)i[l]=T1(y1(n,t,l));return{c(){for(let l=0;l<i.length;l+=1)i[l].c();e=ke()},m(l,s){for(let o=0;o<i.length;o+=1)i[o]&&i[o].m(l,s);y(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=y1(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&&v(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,_,k;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),(k=(_=(g=S.response)==null?void 0:g.data)==null?void 0:_.file)!=null&&k.message?$i(S.response.data.file.message):me.error(S))}r()}oo(()=>{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 tR extends ye{constructor(e){super(),ve(this,e,eR,x7,_e,{class:0})}}function nR(n){let e;return{c(){e=b("i"),p(e,"class","ri-arrow-down-s-line")},m(t,i){y(t,e,i)},d(t){t&&v(e)}}}function iR(n){let e;return{c(){e=b("i"),p(e,"class","ri-arrow-up-s-line")},m(t,i){y(t,e,i)},d(t){t&&v(e)}}}function E1(n){var V,K,J;let e,t,i,l,s,o,r,a,u,f,c,d,m,h,g,_,k,S,$,T,O,M,L;t=new fe({props:{class:"form-field form-field-toggle m-t-base m-b-0",$$slots:{default:[lR,({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 N(ee){n[26](ee)}let R={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&&(R.config=n[1].backups.s3),n[7]!==void 0&&(R.isTesting=n[7]),n[8]!==void 0&&(R.testError=n[8]),r=new fv({props:R}),ie.push(()=>ge(r,"config",A)),ie.push(()=>ge(r,"isTesting",P)),ie.push(()=>ge(r,"testError",N));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(),k=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(k,"type","submit"),p(k,"class","btn btn-expanded"),k.disabled=$=!n[9]||n[5],Q(k,"btn-loading",n[5]),p(d,"class","flex"),p(e,"class","block"),p(e,"autocomplete","off")},m(ee,X){y(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,k),w(k,S),O=!0,M||(L=[B(k,"click",n[28]),B(e,"submit",tt(n[11]))],M=!0)},p(ee,X){var we,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&&E(I,1)):(I=M1(ee),I.c(),E(I,1),I.m(e,l)):I&&(re(),D(I,1,1,()=>{I=null}),ae());const Se={};X[0]&1&&(Se.originalConfig=(we=ee[0].backups)==null?void 0:we.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),(!O||X[0]&544&&$!==($=!ee[9]||ee[5]))&&(k.disabled=$),(!O||X[0]&32)&&Q(k,"btn-loading",ee[5])},i(ee){O||(E(t.$$.fragment,ee),E(I),E(r.$$.fragment,ee),ee&&nt(()=>{O&&(T||(T=je(e,mt,{duration:150},!0)),T.run(1))}),O=!0)},o(ee){D(t.$$.fragment,ee),D(I),D(r.$$.fragment,ee),ee&&(T||(T=je(e,mt,{duration:150},!1)),T.run(0)),O=!1},d(ee){ee&&v(e),q(t),I&&I.d(),q(r),U&&U.d(),j&&j.d(),ee&&T&&T.end(),M=!1,De(L)}}}function lR(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){y(u,e,f),e.checked=n[2],y(u,i,f),y(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&&(v(e),v(i),v(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:
`),T=b("span"),T.textContent="macros",O=Y(`.
2024-09-30 00:23:19 +08:00
`),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=!((R=(N=n[0])==null?void 0:N.backups)!=null&&R.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(T,"class","link-primary"),p(k,"class","help-block")},m(N,R){var U,j;y(N,e,R),w(e,t),y(N,l,R),y(N,s,R),ce(s,n[1].backups.cron),y(N,a,R),y(N,u,R),w(u,f),w(f,c),w(f,d),w(f,m),w(f,h),F(g,f,null),y(N,_,R),y(N,k,R),w(k,S),w(S,$),w(S,T),w(S,O),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,T,`@yearly
2024-09-30 00:23:19 +08:00
@annually
@monthly
@weekly
@daily
@midnight
@hourly`))],A=!0)},p(N,R){var j,V;(!I||R[1]&1&&i!==(i=N[31]))&&p(e,"for",i),(!I||R[1]&1&&o!==(o=N[31]))&&p(s,"id",o),(!I||R[0]&1&&r!==(r=!((V=(j=N[0])==null?void 0:j.backups)!=null&&V.cron)))&&(s.autofocus=r),R[0]&2&&s.value!==N[1].backups.cron&&ce(s,N[1].backups.cron);const U={};R[0]&2|R[1]&2&&(U.$$scope={dirty:R,ctx:N}),g.$set(U)},i(N){I||(E(g.$$.fragment,N),I=!0)},o(N){D(g.$$.fragment,N),I=!1},d(N){N&&(v(e),v(l),v(s),v(a),v(u),v(_),v(k)),q(g),A=!1,De(P)}}}function rR(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){y(u,e,f),w(e,t),y(u,l,f),y(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&&gt(s.value)!==u[1].backups.cronMaxKeep&&ce(s,u[1].backups.cronMaxKeep)},d(u){u&&(v(e),v(l),v(s)),r=!1,a()}}}function D1(n){let e;function t(s,o){return s[7]?fR:s[8]?uR:aR}let i=t(n),l=i(n);return{c(){l.c(),e=ke()},m(s,o){l.m(s,o),y(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&&v(e),l.d(s)}}}function aR(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){y(t,e,i)},p:te,d(t){t&&v(e)}}}function uR(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;y(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&&Ft(t.update)&&o[0]&256&&t.update.call(null,(r=s[8].data)==null?void 0:r.message)},d(s){s&&v(e),i=!1,l()}}}function fR(n){let e;return{c(){e=b("span"),p(e,"class","loader loader-sm")},m(t,i){y(t,e,i)},p:te,d(t){t&&v(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){y(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&&v(e),l=!1,s()}}}function cR(n){let e,t,i,l,s,o,r,a,u,f,c,d,m,h,g,_,k,S,$,T,O,M,L,I,A,P,N;m=new Au({props:{class:"btn-sm",tooltip:"Refresh"}}),m.$on("refresh",n[13]),g=new tR({props:{class:"btn-sm"}}),g.$on("success",n[13]);let R={};k=new U7({props:R}),n[15](k);function U(J,ee){return J[6]?iR:nR}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(k.$$.fragment),S=C(),$=b("hr"),T=C(),O=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(O,"type","button"),p(O,"class","btn btn-secondary"),O.disabled=n[4],Q(O,"btn-loading",n[4]),p(u,"class","panel"),p(u,"autocomplete","off"),p(a,"class","wrapper")},m(J,ee){y(J,e,ee),w(e,t),w(t,i),w(t,l),w(t,s),w(s,o),y(J,r,ee),y(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(k,u,null),w(u,S),w(u,$),w(u,T),w(u,O),w(O,M),w(O,L),V.m(O,null),w(u,I),K&&K.m(u,null),A=!0,P||(N=[B(O,"click",n[16]),B(u,"submit",tt(n[11]))],P=!0)},p(J,ee){(!A||ee[0]&1024)&&ue(o,J[10]);const X={};k.$set(X),j!==(j=U(J))&&(V.d(1),V=j(J),V&&(V.c(),V.m(O,null))),(!A||ee[0]&16)&&(O.disabled=J[4]),(!A||ee[0]&16)&&Q(O,"btn-loading",J[4]),J[6]&&!J[4]?K?(K.p(J,ee),ee[0]&80&&E(K,1)):(K=E1(J),K.c(),E(K,1),K.m(u,null)):K&&(re(),D(K,1,1,()=>{K=null}),ae())},i(J){A||(E(m.$$.fragment,J),E(g.$$.fragment,J),E(k.$$.fragment,J),E(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"),k=Y(n[6]),S=C(),$=b("div"),T=b("div"),O=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(T,"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($,"class","flex m-t-base")},m(K,J){y(K,e,J),y(K,t,J),y(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(_,k),n[16](c),y(K,S,J),y(K,$,J),w($,T),w($,O),w($,M),w(M,L),w(M,I),w(M,A),N=!0,R||(U=[B(d,"click",n[15]),B(c,"keydown",n[17]),B(M,"click",n[18])],R=!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=yt(a,J,V,1,K,j,u,l,zt,A1,null,L1),ae()),(!N||J&4&&h!==(h=!K[2]))&&(d.disabled=h),(!N||J&64)&&ue(k,K[6]),(!N||J&4&&P!==(P=!K[2]))&&(M.disabled=P)},i(K){if(!N){E(o.$$.fragment,K);for(let J=0;J<j.length;J+=1)E(a[J]);N=!0}},o(K){D(o.$$.fragment,K);for(let J=0;J<a.length;J+=1)D(a[J]);N=!1},d(K){K&&(v(e),v(t),v(i),v(S),v($)),q(o);for(let J=0;J<a.length;J+=1)a[J].d();n[16](null),R=!1,De(U)}}}function _R(n){let e;return{c(){e=b("div"),p(e,"class","loader")},m(t,i){y(t,e,i)},p:te,i:te,o:te,d(t){t&&v(e)}}}function gR(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){y(f,e,c),y(f,l,c),y(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&&(v(e),v(l),v(s)),a=!1,u()}}}function bR(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){y(m,e,h),y(m,l,h),y(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&&(v(e),v(l),v(s)),f=!1,c()}}}function A1(n,e){let t,i,l,s;return i=new fe({props:{class:"form-field",$$slots:{default:[bR,({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){y(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||(E(i.$$.fragment,o),s=!0)},o(o){D(i.$$.fragment,o),s=!1},d(o){o&&v(t),q(i)}}}function kR(n){let e,t,i,l,s,o,r,a,u,f,c,d;const m=[_R,hR],h=[];function g(_,k){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(_,k){y(_,e,k),w(e,t),w(t,i),w(t,l),w(t,s),w(s,o),y(_,r,k),y(_,a,k),w(a,u),h[f].m(u,null),d=!0},p(_,k){(!d||k&128)&&ue(o,_[7]);let S=f;f=g(_),f===S?h[f].p(_,k):(re(),D(h[S],1,1,()=>{h[S]=null}),ae(),c=h[f],c?c.p(_,k):(c=h[f]=m[f](_),c.c()),E(c,1),c.m(u,null))},i(_){d||(E(c),d=!0)},o(_){D(c),d=!1},d(_){_&&(v(e),v(r),v(a)),h[f].d()}}}function vR(n){let e,t,i,l;return e=new ms({}),i=new di({props:{$$s
- ${T.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(T){me.error(T)}t(4,u=!1),c()}}const g=()=>m(),_=()=>!u;function k(T){ie[T?"unshift":"push"](()=>{l=T,t(1,l)})}function S(T){Pe.call(this,n,T)}function $(T){Pe.call(this,n,T)}return n.$$.update=()=>{n.$$.dirty&384&&Array.isArray(s)&&Array.isArray(o)&&d()},[c,l,r,a,u,m,f,s,o,g,_,k,S,$]}class PR extends ye{constructor(e){super(),ve(this,e,AR,LR,_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 NR(n){let e,t,i,l,s,o,r,a,u,f,c,d,m,h,g,_,k,S,$,T,O,M,L,I;a=new fe({props:{class:"form-field "+(n[6]?"":"field-error"),name:"collections",$$slots:{default:[FR,({uniqueId:V})=>({41:V}),({uniqueId:V})=>[0,V?1024:0]]},$$scope:{ctx:n}}});let A=n[1].length&&lb(n),P=!1,N=n[6]&&n[1].length&&!n[7]&&sb(),R=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(),N&&N.c(),d=C(),R&&R.c(),m=C(),U&&U.c(),h=C(),g=b("div"),j&&j.c(),_=C(),k=b("div"),S=C(),$=b("button"),T=b("span"),T.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(k,"class","flex-fill"),p(T,"class","txt"),p($,"type","button"),p($,"class","btn btn-expanded btn-warning m-l-auto"),$.disabled=O=!n[14],p(g,"class","flex m-t-base")},m(V,K){y(V,e,K),n[21](e),y(V,t,K),y(V,i,K),w(i,l),w(l,s),w(l,o),y(V,r,K),F(a,V,K),y(V,u,K),A&&A.m(V,K),y(V,f,K),y(V,c,K),N&&N.m(V,K),y(V,d,K),R&&R.m(V,K),y(V,m,K),U&&U.m(V,K),y(V,h,K),y(V,g,K),j&&j.m(g,null),w(g,_),w(g,k),w(g,S),w(g,$),w($,T),M=!0,L||(I=[B(e,"change",n[22]),B(o,"click",n[23]),B($,"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&&E(A,1)):(A=lb(V),A.c(),E(A,1),A.m(f.parentNode,f)):A&&(re(),D(A,1,1,()=>{A=null}),ae()),V[6]&&V[1].length&&!V[7]?N||(N=sb(),N.c(),N.m(d.parentNode,d)):N&&(N.d(1),N=null),V[6]&&V[1].length&&V[7]?R?R.p(V,K):(R=ob(V),R.c(),R.m(m.parentNode,m)):R&&(R.d(1),R=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&&O!==(O=!V[14]))&&($.disabled=O)},i(V){M||(E(a.$$.fragment,V),E(A),E(P),M=!0)},o(V){D(a.$$.fragment,V),D(A),D(P),M=!1},d(V){V&&(v(e),v(t),v(i),v(r),v(u),v(f),v(c),v(d),v(m),v(h),v(g)),n[21](null),q(a,V),A&&A.d(V),N&&N.d(V),R&&R.d(V),U&&U.d(V),j&&j.d(),L=!1,De(I)}}}function RR(n){let e;return{c(){e=b("div"),p(e,"class","loader")},m(t,i){y(t,e,i)},p:te,i:te,o:te,d(t){t&&v(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){y(t,e,i)},d(t){t&&v(e)}}}function FR(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=ke(),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){y(d,e,m),w(e,t),y(d,l,m),y(d,s,m),ce(s,n[0]),y(d,r,m),c&&c.m(d,m),y(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&&(v(e),v(l),v(s),v(r),v(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:[qR,({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||(E(e.$$.fragment,i),t=!0)},o(i){D(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function qR(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){y(f,e,c),e.checked=n[5],y(f,l,c),y(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&&(v(e),v(l),v(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){y(t,e,i)},d(t){t&&v(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){y(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&&v(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){y(l,e,s),t||(i=B(e,"click",n[28]),t=!0)},p:te,d(l){l&&v(e),t=!1,i()}}}function HR(n){let e,t,i,l,s,o,r,a,u,f,c,d;const m=[RR,NR],h=[];function g(_,k){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(_,k){y(_,e,k),w(e,t),w(t,i),w(t,l),w(t,s),w(s,o),y(_,r,k),y(_,a,k),w(a,u),h[f].m(u,null),d=!0},p(_,k){(!d||k[0]&32768)&&ue(o,_[15]);let S=f;f=g(_),f===S?h[f].p(_,k):(re(),D(h[S],1,1,()=>{h[S]=null}),ae(),c=h[f],c?c.p(_,k):(c=h[f]=m[f](_),c.c()),E(c,1),c.m(u,null))},i(_){d||(E(c),d=!0)},o(_){D(c),d=!1},d(_){_&&(v(e),v(r),v(a)),h[f].d()}}}function jR(n){let e,t,i,l,s,o;e=new ms({}),i=new di({props:{$$slots:{default:[HR]},$$scope:{ctx:n}}});let r={};return s=new PR({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),y(a,t,u),F(i,a,u),y(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||(E(e.$$.fragment,a),E(i.$$.fragment,a),E(s.$$.fragment,a),o=!0)},o(a){D(e.$$.fragment,a),D(i.$$.fragment,a),D(s.$$.fragment,a),o=!1},d(a){a&&(v(t),v(l)),q(e,a),q(i,a),n[29](null),q(s,a)}}}function zR(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,k=[],S=!1,$=!1;T();async function T(){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 O(){if(t(3,k=[]),!!i)for(let oe of h){const Se=z.findByKey(g,"id",oe.id);!(Se!=null&&Se.id)||!z.hasCollectionChanges(Se,oe,_)||k.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 we=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===we&&(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 we=>{t(12,m=!1),t(10,f.value="",f),t(0,d=we.target.result),await fn(),h.length||($i("Invalid collections configuration."),A())},Se.onerror=we=>{console.warn(we),$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=$?z.filterDuplicatesByKey(g.concat(h)):h;c==null||c.show(g,oe,_)}function N(oe){ie[oe?"unshift":"push"](()=>{f=oe,t(10,f)})}const R=()=>{f.files.length&&I(f.files[0])},U=()=>{f.click()};function j(){d=this.value,t(0,d)}function V(){$=this.checked,t(5,$)}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"&&$!==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:
`),k=b("a"),k.textContent=`rclone
2024-09-30 00:23:19 +08:00
`,S=Y(`,
`),$=b("a"),$.textContent=`s5cmd
`,T=Y(", etc."),O=C(),M=b("div"),p(i,"class","icon"),p(k,"href","https://github.com/rclone/rclone"),p(k,"target","_blank"),p(k,"rel","noopener noreferrer"),p(k,"class","txt-bold"),p($,"href","https://github.com/peak/s5cmd"),p($,"target","_blank"),p($,"rel","noopener noreferrer"),p($,"class","txt-bold"),p(s,"class","content"),p(t,"class","alert alert-warning m-0"),p(M,"class","clearfix m-t-base")},m(P,N){y(P,e,N),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,k),w(s,S),w(s,$),w(s,T),w(e,O),w(e,M),I=!0},p(P,N){var R;(!I||N&1)&&a!==(a=(R=P[0].s3)!=null&&R.enabled?"S3 storage":"local file system")&&ue(u,a),(!I||N&2)&&d!==(d=P[1].s3.enabled?"S3 storage":"local file system")&&ue(m,d)},i(P){I||(P&&nt(()=>{I&&(L||(L=je(e,mt,{duration:150},!0)),L.run(1))}),I=!0)},o(P){P&&(L||(L=je(e,mt,{duration:150},!1)),L.run(0)),I=!1},d(P){P&&v(e),P&&L&&L.end()}}}function cF(n){var i;let e,t=((i=n[0].s3)==null?void 0:i.enabled)!=n[1].s3.enabled&&yb(n);return{c(){t&&t.c(),e=ke()},m(l,s){t&&t.m(l,s),y(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&&E(t,1)):(t=yb(l),t.c(),E(t,1),t.m(e.parentNode,e)):t&&(re(),D(t,1,1,()=>{t=null}),ae())},d(l){l&&v(e),t&&t.d(l)}}}function wb(n){let e;function t(s,o){return s[4]?mF:s[5]?pF:dF}let i=t(n),l=i(n);return{c(){l.c(),e=ke()},m(s,o){l.m(s,o),y(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&&v(e),l.d(s)}}}function dF(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){y(t,e,i)},p:te,d(t){t&&v(e)}}}function pF(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;y(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&&Ft(t.update)&&o&32&&t.update.call(null,(r=s[5].data)==null?void 0:r.message)},d(s){s&&v(e),i=!1,l()}}}function mF(n){let e;return{c(){e=b("span"),p(e,"class","loader loader-sm")},m(t,i){y(t,e,i)},p:te,d(t){t&&v(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){y(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&&v(e),i=!1,l()}}}function hF(n){let e,t,i,l,s,o,r,a,u,f,c,d,m,h,g,_;const k=[fF,uF],S=[];function $(T,O){return T[2]?0:1}return d=$(n),m=S[d]=k[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(T,O){y(T,e,O),w(e,t),w(t,i),w(t,l),w(t,s),w(s,o),y(T,r,O),y(T,a,O),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(T,O){(!h||O&128)&&ue(o,T[7]);let M=d;d=$(T),d===M?S[d].p(T,O):(re(),D(S[M],1,1,()=>{S[M]=null}),ae(),m=S[d],m?m.p(T,O):(m=S[d]=k[d](T),m.c()),E(m,1),m.m(u,null))},i(T){h||(E(m),h=!0)},o(T){D(m),h=!1},d(T){T&&(v(e),v(r),v(a)),S[d].d(),g=!1,_()}}}function _F(n){let e,t,i,l;return e=new ms({}),i=new di({props:{$$slots:{default:[hF]},$$scope:{ctx:n}}}),{c(){H(e.$$.fragment),t=C(),H(i.$$.fragment)},m(s,o){F(e,s,o),y(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||(E(e.$$.fragment,s),E(i.$$.fragment,s),l=!0)},o(s){D(e.$$.fragment,s),D(i.$$.fragment,s),l=!1},d(s){s&&v(t),
One-time password (OTP).`),p(e,"class","content txt-center m-b-sm")},m(r,a){y(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&&v(e)}}}function $F(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){y(u,e,f),w(e,t),y(u,l,f),y(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&&(v(e),v(l),v(s)),r=!1,a()}}}function CF(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){y(u,e,f),w(e,t),y(u,l,f),y(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&&(v(e),v(l),v(s)),r=!1,a()}}}function OF(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){y(c,e,d),w(e,i),y(c,s,d),y(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&&(v(e),v(s),v(o)),u=!1,f()}}}function EF(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){y(d,e,m),w(e,t),y(d,l,m),y(d,s,m),ce(s,n[6]),y(d,r,m),y(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&&(v(e),v(l),v(s),v(r),v(a)),f=!1,De(c)}}}function MF(n){let e,t,i,l,s,o,r,a,u=n[2]>1&&Tb(n);const f=[wF,yF,vF],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=ke(),p(e,"class","content txt-center m-b-base")},m(m,h){y(m,e,h),w(e,t),w(t,i),u&&u.m(t,null),y(m,l,h),~s&&c[s].m(m,h),y(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()),E(o,1),o.m(r.parentNode,r)):o=null)},i(m){a||(E(o),a=!0)},o(m){D(o),a=!1},d(m){m&&(v(e),v(l),v(r)),u&&u.d(),~s&&c[s].d(m)}}}function DF(n){let e,t;return e=new nk({props:{$$slots:{default:[MF]},$$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||(E(e.$$.fragment,i),t=!0)},o(i){D(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function IF(n,e,t){let i;Qe(n,Lu,R=>t(22,i=R));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="",_="",k="",S="";$();async function $(){if(!m){t(10,m=!0);try{t(0,r=await me.collection("_superusers").listAuthMethods())}catch(R){me.error(R)}t(10,m=!1)}}async function T(){var R,U;if(!f){t(7,f=!0);try{await me.collection("_superusers").authWithPassword(s,o),Is(),Wt({}),Il("/")}catch(j){j.status==401?(t(3,h=j.response.mfaId),((U=(R=r==null?void 0:r.password)==null?void 0:R.identityFields)==null?void 0:U.length)==1&&r.password.identityFields[0]=="email"?(t(11,k=s),await O()):/^[^@\s]+@[^@\s]+$/.test(s)&&t(11,k=s)):j.status!=400?me.error(j):$i("Invalid login credentials.")}t(7,f=!1)}}async function O(){if(!c){t(8,c=!0);try{const R=await me.collection("_superusers").requestOTP(k);t(4,g=R.otpId),_=g,Is(),Wt({})}catch(R){R.status==429&&t(4,g=_),me.error(R)}t(8,c=!1)}}async function M(){if(!d){t(9,d=!0);try{await me.collection("_superusers").authWithOTP(g,S,{mfaId:h}),Is(),Wt({}),Il("/")}catch(R){me.error(R)}t(9,d=!1)}}const L=R=>{t(5,s=R.target.value)};function I(){o=this.value,t(6,o)}function A(){k=this.value,t(11,k)}function P(){S=this.value,t(12,S)}const N=()=>{t(4,g="")};return n.$$.update=()=>{var R,U;n.$$.dirty&31&&(t(2,u=1),t(1,a=1),(R=r==null?void 0:r.mfa)!=null&&R.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,k,S,T,O,M,L,I,A,P,N]}class LF extends ye{constructor(e){super(),ve(this,e,IF,DF,_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}],AF={"/login":Qt({component:LF,conditions:on.concat([n=>!me.authStore.isValid]),userData:{showAppSidebar:!1}}),"/request-password-reset":Qt({asyncComponent:()=>Et(()=>import("./PageSuperuserRequestPasswordReset-C-ZISZMY.js"),[],import.meta.url),conditions:on.concat([n=>!me.authStore.isValid]),userData:{showAppSidebar:!1}}),"/confirm-password-reset/:token":Qt({asyncComponent:()=>Et(()=>import("./PageSuperuserConfirmPasswordReset-D1Z7koOF.js"),[],import.meta.url),conditions:on.concat([n=>!me.authStore.isValid]),userData:{showAppSidebar:!1}}),"/collections":Qt({component:ON,conditions:on.concat([n=>me.authStore.isValid]),userData:{showAppSidebar:!0}}),"/logs":Qt({component:b5,conditions:on.concat([n=>me.authStore.isVali