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

222 lines
1.1 MiB
JavaScript
Raw Normal View History

2024-11-05 01:08:21 +08:00
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./FilterAutocompleteInput-BYlcexRG.js","./index-B5ReTu-C.js","./ListApiDocs-BRYx7P-7.js","./FieldsQueryParam-CU2A0Yw0.js","./ListApiDocs-DhdAtA7Y.css","./ViewApiDocs-B8pikWRr.js","./CreateApiDocs-BGr9q-mq.js","./UpdateApiDocs-pGzvFrtp.js","./AuthMethodsDocs-CM9oXoZI.js","./AuthWithPasswordDocs-Dt2DjtBj.js","./AuthWithOAuth2Docs-Dq9Yr_Yz.js","./AuthRefreshDocs-BQNQi_p4.js","./CodeEditor-B0EGgw8R.js"])))=>i.map(i=>d[i]);
var yv=Object.defineProperty;var wv=(n,e,t)=>e in n?yv(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var ct=(n,e,t)=>wv(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 so=n=>n;function ze(n,e){for(const t in e)n[t]=e[t];return n}function Sv(n){return!!n&&(typeof n=="object"||typeof n=="function")&&typeof n.then=="function"}function Pb(n){return n()}function df(){return Object.create(null)}function Ie(n){n.forEach(Pb)}function It(n){return typeof n=="function"}function ge(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}let To;function kn(n,e){return n===e?!0:(To||(To=document.createElement("a")),To.href=e,n===To.href)}function Tv(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 Nb(n){let e;return uu(n,t=>e=t)(),e}function Qe(n,e,t){n.$$.on_destroy.push(uu(e,t))}function Lt(n,e,t,i){if(n){const l=Rb(n,e,t,i);return n[0](l)}}function Rb(n,e,t,i){return n[1]&&i?ze(t.ctx.slice(),n[1](i(e))):t.ctx}function At(n,e,t,i){if(n[2]&&i){const l=n[2](i(t));if(e.dirty===void 0)return l;if(typeof l=="object"){const s=[],o=Math.max(e.dirty.length,l.length);for(let r=0;r<o;r+=1)s[r]=e.dirty[r]|l[r];return s}return e.dirty|l}return e.dirty}function Pt(n,e,t,i,l,s){if(l){const o=Rb(e,t,i,s);n.p(o,l)}}function Nt(n){if(n.ctx.length>32){const e=[],t=n.ctx.length/32;for(let i=0;i<t;i++)e[i]=-1;return e}return-1}function Ut(n){const e={};for(const t in n)t[0]!=="$"&&(e[t]=n[t]);return e}function lt(n,e){const t={};e=new Set(e);for(const i in n)!e.has(i)&&i[0]!=="$"&&(t[i]=n[i]);return t}function zs(n){return n??""}function Rn(n,e,t){return n.set(t),e}function Ee(n){return n&&It(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 Fb=typeof window<"u";let Or=Fb?()=>window.performance.now():()=>Date.now(),fu=Fb?n=>requestAnimationFrame(n):te;const Zl=new Set;function qb(n){Zl.forEach(e=>{e.c(n)||(Zl.delete(e),e.f())}),Zl.size!==0&&fu(qb)}function Er(n){let e;return Zl.size===0&&fu(qb),{promise:new Promise(t=>{Zl.add(e={c:n,f:t})}),abort(){Zl.delete(e)}}}function w(n,e){n.appendChild(e)}function Hb(n){if(!n)return document;const e=n.getRootNode?n.getRootNode():n.ownerDocument;return e&&e.host?e:n.ownerDocument}function $v(n){const e=b("style");return e.textContent="/* empty */",Cv(Hb(n),e),e.sheet}function Cv(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 dt(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 B(n){return document.createTextNode(n)}function C(){return B(" ")}function ve(){return B("")}function W(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 Ov=["width","height"];function ei(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 g=0;g<=1;g+=a){const k=e+(t-e)*s(g);u+=g*100+`%{${o(k,1-k)}}
2024-10-15 14:03:48 +08:00
`}const f=u+`100% {${o(t,1-t)}}
}`,c=`__svelte_${Iv(f)}_${r}`,d=Hb(n),{stylesheet:m,rules:h}=cr.get(d)||Lv(d,n);h[c]||(h[c]=!0,m.insertRule(`@keyframes ${c} ${f}`,m.cssRules.length));const _=n.style.animation||"";return n.style.animation=`${_?`${_}, `:""}${c} ${i}ms linear ${l}ms 1 both`,dr+=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(", "),dr-=l,dr||Av())}function Av(){fu(()=>{dr||(cr.forEach(n=>{const{ownerNode:e}=n.stylesheet;e&&v(e)}),cr.clear())})}function Pv(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=so,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 _(){c&&(h=Us(n,0,1,o,s,r,c)),s||(m=!0)}function g(){c&&Vs(n,h),d=!1}return Er(k=>{if(!m&&k>=a&&(m=!0),m&&k>=u&&(f(1,0),g()),!d)return!1;if(m){const S=k-a,$=0+1*r(S/o);f($,1-$)}return!0}),_(),f(0,1),g}function Nv(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,zb(n,l)}}function zb(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 Fi(n){Bs=n}function oo(){if(!Bs)throw new Error("Function called outside component initialization");return Bs}function Zt(n){oo().$$.on_mount.push(n)}function Rv(n){oo().$$.after_update.push(n)}function ro(n){oo().$$.on_destroy.push(n)}function bt(){const n=oo();return(e,t,{cancelable:i=!1}={})=>{const l=n.$$.callbacks[e];if(l){const s=jb(e,t,{cancelable:i});return l.slice().forEach(o=>{o.call(n,s)}),!s.defaultPrevented}return!0}}function Ne(n,e){const t=n.$$.callbacks[e.type];t&&t.slice().forEach(i=>i.call(this,e))}const Yl=[],ie=[];let Gl=[];const Pa=[],Ub=Promise.resolve();let Na=!1;function Vb(){Na||(Na=!0,Ub.then(cu))}function un(){return Vb(),Ub}function et(n){Gl.push(n)}function Te(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++,Fi(e),Fv(e.$$)}}catch(e){throw Yl.length=0,jl=0,e}for(Fi(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(),Fi(n)}function Fv(n){if(n.fragment!==null){n.update(),Ie(n.before_update);const e=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,e),n.after_update.forEach(et)}}function qv(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(jb(`${e?"intro":"outro"}${t}`))}const Qo=new Set;let Si;function ae(){Si={r:0,c:[],p:Si}}function ue(){Si.r||Ie(Si.c),Si=Si.p}function E(n,e){n&&n.i&&(Qo.delete(n),n.i(e))}function D(n,e,t,i){if(n&&n.o){if(Qo.has(n))return;Qo.add(n),Si.c.push(()=>{Qo.delete(n),i&&(t&&n.d(1),i())}),n.o(e)}else i&&i()}const pu={duration:0};function Bb(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=so,tick:_=te,css:g}=l||pu;g&&(o=Us(n,0,1,m,d,h,g,a++)),_(0,1);const k=Or()+d,S=k+m;r&&r.abort(),s=!0,et(()=>Ol(n,!0,"start")),r=Er($=>{if(s){if($>=S)return _(1,0),Ol(n,!0,"end"),u(),s=!1;if($>=k){const T=h(($-k)/m);_(T,1-T)}}return s})}let c=!1;return{start(){c||(c=!0,Vs(n),It(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=Si;r.r+=1;let a;function u(){const{delay:f=0,duration:c=300,easing:d=so,tick:m=te,css:h}=l||pu;h&&(o=Us(n,1,0,c,f,d,h));const _=Or()+f,g=_+c;et(()=>Ol(n,!1,"start")),"inert"in n&&(a=n.inert,n.inert=!0),Er(k=>{if(s){if(k>=g)return m(0,1
2024-10-15 14:03:48 +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=V.parseIndex(e);return i.tableName=t,V.buildIndex(i)}static replaceIndexColumn(e,t,i){if(t===i)return e;const l=V.parseIndex(e);let s=!1;for(let o of l.columns)o.name===t&&(o.name=i,s=!0);return s?V.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 V.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 tl(){return gl=gl||document.querySelector("."+Va),gl||(gl=document.createElement("div"),gl.classList.add(Va),document.body.appendChild(gl)),gl}function Y0(n,e){let t=tl();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),tl().classList.remove("active"),tl().activeNode=void 0}function J2(n,e){tl().activeNode=n,clearTimeout(Ua),Ua=setTimeout(()=>{tl().classList.add("active"),Y0(n,e)},isNaN(e.delay)?0:e.delay)}function He(n,e){let t=Wf(e);function i(){J2(n,t)}function l(){Ba()}return n.addEventListener("mouseenter",i),n.addEventListener("mouseleave",l),n.addEventListener("blur",l),(t.hideOnClick===!0||t.hideOnClick===null&&V.isFocusable(n))&&n.addEventListener("click",l),tl(),{update(s){var o,r;t=Wf(s),(r=(o=tl())==null?void 0:o.activeNode)!=null&&r.contains(n)&&Y0(n,t)},destroy(){var s,o;(o=(s=tl())==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=so}={}){const l=+getComputedStyle(n).opacity;return{delay:e,duration:t,easing:i,css:s=>`opacity: ${s*l}`}}function qn(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)=>`
transform: ${u} translate(${(1-_)*c}${d}, ${(1-_)*m}${h});
opacity: ${a-f*g}`}}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]}`]),_=parseFloat(s[`border${f[0]}Width`]),g=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*_}px;border-${u[1]}-width: ${k*g}px;`}}function Tt(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-10-15 14:03:48 +08:00
transform: ${a} scale(${1-u*d});
opacity: ${r-f*d}
2024-11-05 01:08:21 +08:00
`}}const Z2=n=>({}),Yf=n=>({}),G2=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=Lt(T,n,n[18],Kf);let M=n[4]&&n[2]&&Gf(n);const L=n[19].default,I=Lt(L,n,n[18],null),P=n[19].footer,A=Lt(P,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"),A&&A.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]),x(s,"popup",n[2]),p(e,"class","overlay-panel-container"),x(e,"padded",n[2]),x(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),A&&A.m(d,null),g=!0,k||(S=[W(t,"click",tt(n[20])),W(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)):$&&(ae(),D($,1,1,()=>{$=null}),ue()),O&&O.p&&(!g||R[0]&262144)&&Pt(O,T,n,n[18],g?At(T,n[18],R,G2):Nt(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&&(!g||R[0]&262144)&&Pt(I,L,n,n[18],g?At(L,n[18],R,null):Nt(n[18]),null),A&&A.p&&(!g||R[0]&262144)&&Pt(A,P,n,n[18],g?At(P,n[18],R,Z2):Nt(n[18]),Yf),(!g||R[0]&258&&m!==(m="overlay-panel "+n[1]+" "+n[8]))&&p(s,"class",m),(!g||R[0]&262)&&x(s,"popup",n[2]),(!g||R[0]&4)&&x(e,"padded",n[2]),(!g||R[0]&1)&&x(e,"active",n[0])},i(N){g||(N&&et(()=>{g&&(i||(i=je(t,Ys,{duration:Zi,opacity:0},!0)),i.run(1))}),E($),E(O,N),E(I,N),E(A,N),N&&et(()=>{g&&(_&&_.end(1),h=Bb(s,qn,n[2]?{duration:Zi,y:-10}:{duration:Zi,x:50}),h.start())}),g=!0)},o(N){N&&(i||(i=je(t,Ys,{duration:Zi,opacity:0},!1)),i.run(0)),D($),D(O,N),D(I,N),D(A,N),h&&h.invalidate(),N&&(_=mu(s,qn,n[2]?{duration:Zi,y:10}:{duration:Zi,x:50})),g=!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),A&&A.d(N),N&&_&&_.end(),k=!1,Ie(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=W(e,"click",tt(n[5])),l=!0)},p(o,r){n=o},i(o){i||(o&&et(()=>{i&&(t||(t=je(e,Ys,{duration:Zi},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=je(e,Ys,{duration:Zi},!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=W(e,"click",tt(n[5])),t=!0)},p:te,d(l){l&&v(e),t=!1,i()}}}function X2(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=[W(window,"resize",n[10]),W(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&&(ae(),D(s,1,1,()=>{s=null}),ue())},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,Ie(l)}}}let bl,la=[];function K0(){return bl=bl||document.querySelector(".overlays"),bl||(bl=document.createElement("div"),bl.classList.add("overlays"),document.body.appendChild(bl)),bl}let Zi=150;function Xf(){return 1e3+K0().querySelectorAll(".overlay-panel-container.active").length}function Q2(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_"+V.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"),_==null||_.focus()):(clearTimeout(S),m("hide"),k==null||k.focus()),await un(),P()}function P(){_&&(o?t(6,_.
`)})),o=!0)},p(a,u){i&&It(i.update)&&u&8&&i.update.call(null,{position:"left",text:a[3].map(br).join(`
`)})},i(a){s||(a&&et(()=>{s&&(l||(l=je(t,Tt,{duration:150,start:.7},!0)),l.run(1))}),s=!0)},o(a){a&&(l||(l=je(t,Tt,{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=B(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])+"")&&re(l,i)},i(a){r||(a&&et(()=>{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 i3(n){let e,t,i,l,s,o,r;const a=n[9].default,u=Lt(a,n,n[8],gc),f=[n3,t3],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]),x(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=W(e,"click",n[10]),o=!0)},p(m,[h]){u&&u.p&&(!s||h&256)&&Pt(u,a,m,m[8],s?At(a,m[8],h,e3):Nt(m[8]),gc);let _=i;i=d(m),i===_?c[i].p(m,h):(ae(),D(c[_],1,1,()=>{c[_]=null}),ue(),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)&&x(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 l3(n,e,t){let i;Qe(n,yn,_=>t(7,i=_));let{$$slots:l={},$$scope:s}=e;const o="field_"+V.randomString(7);let{name:r=""}=e,{inlineError:a=!1}=e,{class:u=void 0}=e,f,c=[];function d(){xn(r)}Zt(()=>(f.addEventListener("input",d),f.addEventListener("change",d),()=>{f.removeEventListener("input",d),f.removeEventListener("change",d)}));function m(_){Ne.call(this,n,_)}function h(_){ie[_?"unshift":"push"](()=>{f=_,t(2,f)})}return n.$$set=_=>{"name"in _&&t(5,r=_.name),"inlineError"in _&&t(0,a=_.inlineError),"class"in _&&t(1,u=_.class),"$$scope"in _&&t(8,s=_.$$scope)},n.$$.update=()=>{n.$$.dirty&160&&t(3,c=V.toArray(V.getNestedVal(i,r)))},[a,u,f,c,o,r,d,i,s,l,m,h]}class fe extends Se{constructor(e){super(),we(this,e,l3,i3,ge,{name:5,inlineError:0,class:1,changed:6})}get changed(){return this.$$.ctx[6]}}function s3(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=B("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=W(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 o3(n){let e,t,i,l,s,o,r,a,u,f;return{c(){e=b("label"),t=B("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=W(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 r3(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=B("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=W(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 a3(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:[s3,({uniqueId:T})=>({17:T}),({uniqueId:T})=>T?131072:0]},$$scope:{ctx:n}}}),o=new fe({props:{class:"form-field required",name:"password",$$slots:{default:[o3,({uniqueId:T})=>({17:T}),({uniqueId:T})=>T?131072:0]},$$scope:{ctx:n}}}),a=
2024-10-15 14:03:48 +08:00
2024-11-05 01:08:21 +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 _(){s=this.value,t(2,s)}function g(){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 f3 extends Se{constructor(e){super(),we(this,e,u3,a3,ge,{})}}function vc(n){let e,t;return e=new ak({props:{$$slots:{default:[c3]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,l){q(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){H(e,i)}}}function c3(n){let e,t;return e=new f3({}),e.$on("submit",n[1]),{c(){j(e.$$.fragment)},m(i,l){q(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){H(e,i)}}}function d3(n){let e,t,i=n[0]&&vc(n);return{c(){i&&i.c(),e=ve()},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&&(ae(),D(i,1,1,()=>{i=null}),ue())},i(l){t||(E(i),t=!0)},o(l){D(i),t=!1},d(l){l&&v(e),i&&i.d(l)}}}function p3(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 un(),window.location.search=""}]}class m3 extends Se{constructor(e){super(),we(this,e,p3,d3,ge,{})}}function h3(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=W(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 _3(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(()=>ke(e,"value",s)),e.$on("submit",n[10])),{c(){e&&j(e.$$.fragment),i=ve()},m(a,u){e&&q(e,a,u),y(a,i,u),l=!0},p(a,u){if(u&16&&o!==(o=a[4])){if(e){ae();const f=e;D(f.$$.fragment,1,0,()=>{H(f,1)}),ue()}o?(e=jt(o,r(a)),ie.push(()=>ke(e,"value",s)),e.$on("submit",a[10]),j(e.$$.fragment),E(e.$$.fragment,1),q(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],Te(()=>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&&H(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&&et(()=>{i&&(t||(t=je(e,qn,{duration:150,x:5},!0)),t.run(1))}),i=!0)},o(l){l&&(t||(t=je(e,qn,{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=W(e,"click",n[15]),l=!0)},p:te,i(o){i||(o&&et(()=>{i&&(t||(t=je(e,qn,{duration:150,x:5},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=je(e,qn,{duration:150,x:5},!1)),t.run(0)),i=!1},d(o){o&&v(e),o&&t&&t.end(),l=!1,s()}}}function g3(n){let e,t,i,l,s,o,r,a,u,f,c;const d=[_3,h3],m=[];function h(k,S){return k[4]&&!k[5]?0:1}s=h(n),o=m[s]=d[s](n);let _=(n[0].length||n[7].length)&&n[7]!=n[0]&&yc(),g=(n[0].length||n[7].length)&&wc(n);return{c(){e=b("form"),t=b("label"),i=b("i"),l=C
2024-10-15 14:03:48 +08:00
* @kurkle/color v0.3.2
* https://github.com/kurkle/color#readme
* (c) 2023 Jukka Kurkela
* Released under the MIT License
*/function mo(n){return n+.5|0}const Xi=(n,e,t)=>Math.max(Math.min(n,t),e);function Os(n){return Xi(mo(n*2.55),0,255)}function nl(n){return Xi(mo(n*255),0,255)}function Ri(n){return Xi(mo(n/2.55)/100,0,1)}function Nc(n){return Xi(mo(n*100),0,100)}const Jn={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"],W3=n=>Ya[n&15],Y3=n=>Ya[(n&240)>>4]+Ya[n&15],Lo=n=>(n&240)>>4===(n&15),K3=n=>Lo(n.r)&&Lo(n.g)&&Lo(n.b)&&Lo(n.a);function J3(n){var e=n.length,t;return n[0]==="#"&&(e===4||e===5?t={r:255&Jn[n[1]]*17,g:255&Jn[n[2]]*17,b:255&Jn[n[3]]*17,a:e===5?Jn[n[4]]*17:255}:(e===7||e===9)&&(t={r:Jn[n[1]]<<4|Jn[n[2]],g:Jn[n[3]]<<4|Jn[n[4]],b:Jn[n[5]]<<4|Jn[n[6]],a:e===9?Jn[n[7]]<<4|Jn[n[8]]:255})),t}const Z3=(n,e)=>n<255?e(n):"";function G3(n){var e=K3(n)?W3:Y3;return n?"#"+e(n.r)+e(n.g)+e(n.b)+Z3(n.a,e):void 0}const X3=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function ck(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 Q3(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 x3(n,e,t){const i=ck(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 eS(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=eS(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(nl)}function Fu(n,e,t){return Ru(ck,n,e,t)}function tS(n,e,t){return Ru(x3,n,e,t)}function nS(n,e,t){return Ru(Q3,n,e,t)}function dk(n){return(n%360+360)%360}function iS(n){const e=X3.exec(n);let t=255,i;if(!e)return;e[5]!==i&&(t=e[6]?Os(+e[5]):nl(+e[5]));const l=dk(+e[2]),s=+e[3]/100,o=+e[4]/100;return e[1]==="hwb"?i=tS(l,s,o):e[1]==="hsv"?i=nS(l,s,o):i=Fu(l,s,o),{r:i[0],g:i[1],b:i[2],a:t}}function lS(n,e){var t=Nu(n);t[0]=dk(t[0]+e),t=Fu(t),n.r=t[0],n.g=t[1],n.b=t[2]}function sS(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}%, ${Ri(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-10-15 14:03:48 +08:00
* Chart.js v4.4.4
* https://www.chartjs.org
* (c) 2024 Chart.js Contributors
* Released under the MIT License
*/function Ai(){}const pS=(()=>{let n=0;return()=>n++})();function Kt(n){return n===null||typeof n>"u"}function an(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 vn(n){return(typeof n=="number"||n instanceof Number)&&isFinite(+n)}function gi(n,e){return vn(n)?n:e}function Et(n,e){return typeof n>"u"?e:n}const mS=(n,e)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*e:+n;function pt(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(an(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(an(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 mk(n){return["__proto__","prototype","constructor"].indexOf(n)===-1}function hS(n,e,t,i){if(!mk(n))return;const l=e[n],s=t[n];vt(l)&&vt(s)?Gs(l,s,i):e[n]=vr(s)}function Gs(n,e,t){const i=an(e)?e:[e],l=i.length;if(!vt(n))return n;t=t||{};const s=t.merger||hS;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 Gs(n,e,{merger:_S})}function _S(n,e,t){if(!mk(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 gS(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 bS(n){const e=gS(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]=bS(e)))(n)}function qu(n){return n.charAt(0).toUpperCase()+n.slice(1)}const wr=n=>typeof n<"u",ll=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 kS(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}const bn=Math.PI,$i=2*bn,vS=$i+bn,Sr=Number.POSITIVE_INFINITY,yS=bn/180,ui=bn/2,kl=bn/4,zc=bn*2/3,Ka=Math.log10,sl=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 wS(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 Xs(n){return!isNaN(parseFloat(n))&&isFinite(n)}function SS(n,e){const t=Math.round(n);return t-e<=n&&t+e>=n}function TS(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*(bn/180)}function $S(n){return n*(180/bn)}function Vc(n){if(!vn(n))return;let e=1,t=0;for(;Math.round(n*e)/e!==n;)e*=10,t++;return t}function CS(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*bn&&(s+=$i),{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 OS(n,e){return(n-e+vS)%$i-bn}function vi(n){return(n%$i+$i)%$i}function hk(n,e,t,i){const l=vi(n),s=vi(e),o=vi(t),r=vi(s-l),a=vi(o-l),u=vi(l-s),f=vi(l-o);return l===s||l===o||i&&s===o||r>a&&u<f}function fi(n,e,t){return Math.max(e,Math.min(t,n))}function ES(n){return fi(n,-32768,32767)}function _k(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),MS=(n,e,t)=>Hu(n,t,i=>n[i][e]>=t);function DS(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-10-15 14:03:48 +08:00
* Chart.js v4.4.4
* https://www.chartjs.org
* (c) 2024 Chart.js Contributors
* Released under the MIT License
*/class H4{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=bk.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 Pi=new H4;const rd="transparent",j4={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 z4{constructor(e,t,i,l){const s=t[i];l=Ro([e.to,l,s,e.from]);const o=Ro([e.from,s,l]);this._active=!0,this._fn=e.fn||j4[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=Ro([e.to,t,l,e.from]),this._from=Ro([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 Lk{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];(an(s.properties)&&s.properties||[l]).forEach(r=>{(r===l||!i.has(r))&&i.set(r,o)})})}_animateOptions(e,t){const i=t.options,l=V4(e,i);if(!l)return[];const s=this._createAnimations(l,i);return i.$shared&&U4(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 z4(d,e,u,f),l.push(c)}return l}update(e,t){if(this._properties.size
2024-10-15 14:03:48 +08:00
`)>-1?n.split(`
`):n}function F$(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=Ti(e.bodyFont),u=Ti(e.titleFont),f=Ti(e.footerFont),c=s.length,d=l.length,m=i.length,h=ol(e.padding);let _=h.height,g=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&&(_+=c*u.lineHeight+(c-1)*e.titleSpacing+e.titleMarginBottom),k){const T=e.displayColors?Math.max(r,a.lineHeight):a.lineHeight;_+=m*T+(k-m)*a.lineHeight+(k-1)*e.bodySpacing}d&&(_+=e.footerMarginTop+d*f.lineHeight+(d-1)*e.footerSpacing);let S=0;const $=function(T){g=Math.max(g,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(),g+=h.width,{width:g,height:_}}function q$(n,e){const{y:t,height:i}=e;return t<i/2?"top":t>n.height-i/2?"bottom":"center"}function H$(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 j$(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"),H$(u,n,e,t)&&(u="center"),u}function jd(n,e,t){const i=t.yAlign||e.yAlign||q$(n,t);return{xAlign:t.xAlign||e.xAlign||j$(n,e,t,i),yAlign:i}}function z$(n,e){let{x:t,width:i}=n;return e==="right"?t-=i:e==="center"&&(t-=i/2),t}function U$(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}=sr(o);let h=z$(e,r);const _=U$(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:fi(h,0,i.width-e.width),y:fi(_,0,i.height-e.height)}}function Wo(n,e,t){const i=ol(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 bi([],Ni(n))}function V$(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 Jk={beforeTitle:Ai,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:Ai,beforeBody:Ai,beforeLabel:Ai,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:Ai,afterBody:Ai,beforeFooter:Ai,footer:Ai,afterFooter:Ai};function In(n,e,t,i){const l=n[e].call(t,i);return typeof l>"u"?Jk[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-10-15 14:03:48 +08:00
* chartjs-adapter-luxon v1.3.1
* https://www.chartjs.org
* (c) 2023 chartjs-adapter-luxon Contributors
* Released under the MIT license
*/const G$={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"}};Pk._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 G$},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 X$(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Zk={exports:{}};/*! Hammer.JS - v2.0.7 - 2016-04-22
2024-10-15 14:03:48 +08:00
* http://hammerjs.github.io/
*
* Copyright (c) 2016 Jorik Tangelder;
2024-11-01 20:05:42 +08:00
* 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(Y,G,ne){return setTimeout($(Y,ne),G)}function d(Y,G,ne){return Array.isArray(Y)?(m(Y,ne[G],ne),!0):!1}function m(Y,G,ne){var pe;if(Y)if(Y.forEach)Y.forEach(G,ne);else if(Y.length!==l)for(pe=0;pe<Y.length;)G.call(ne,Y[pe],pe,Y),pe++;else for(pe in Y)Y.hasOwnProperty(pe)&&G.call(ne,Y[pe],pe,Y)}function h(Y,G,ne){var pe="DEPRECATED METHOD: "+G+`
2024-10-15 14:03:48 +08:00
`+ne+` AT
`;return function(){var Ae=new Error("get-stack-trace"),Ke=Ae&&Ae.stack?Ae.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,pe,Ke),Y.apply(this,arguments)}}var _;typeof Object.assign!="function"?_=function(G){if(G===l||G===null)throw new TypeError("Cannot convert undefined or null to object");for(var ne=Object(G),pe=1;pe<arguments.length;pe++){var Ae=arguments[pe];if(Ae!==l&&Ae!==null)for(var Ke in Ae)Ae.hasOwnProperty(Ke)&&(ne[Ke]=Ae[Ke])}return ne}:_=Object.assign;var g=h(function(G,ne,pe){for(var Ae=Object.keys(ne),Ke=0;Ke<Ae.length;)(!pe||pe&&G[Ae[Ke]]===l)&&(G[Ae[Ke]]=ne[Ae[Ke]]),Ke++;return G},"extend","Use `assign`."),k=h(function(G,ne){return g(G,ne,!0)},"merge","Use `assign`.");function S(Y,G,ne){var pe=G.prototype,Ae;Ae=Y.prototype=Object.create(pe),Ae.constructor=Y,Ae._super=pe,ne&&_(Ae,ne)}function $(Y,G){return function(){return Y.apply(G,arguments)}}function T(Y,G){return typeof Y==r?Y.apply(G&&G[0]||l,G):Y}function O(Y,G){return Y===l?G:Y}function M(Y,G,ne){m(A(G),function(pe){Y.addEventListener(pe,ne,!1)})}function L(Y,G,ne){m(A(G),function(pe){Y.removeEventListener(pe,ne,!1)})}function I(Y,G){for(;Y;){if(Y==G)return!0;Y=Y.parentNode}return!1}function P(Y,G){return Y.indexOf(G)>-1}function A(Y){return Y.trim().split(/\s+/g)}function N(Y,G,ne){if(Y.indexOf&&!ne)return Y.indexOf(G);for(var pe=0;pe<Y.length;){if(ne&&Y[pe][ne]==G||!ne&&Y[pe]===G)return pe;pe++}return-1}function R(Y){return Array.prototype.slice.call(Y,0)}function z(Y,G,ne){for(var pe=[],Ae=[],Ke=0;Ke<Y.length;){var ht=Y[Ke][G];N(Ae,ht)<0&&pe.push(Y[Ke]),Ae[Ke]=ht,Ke++}return pe=pe.sort(function(dn,Tn){return dn[G]>Tn[G]}),pe}function F(Y,G){for(var ne,pe,Ae=G[0].toUpperCase()+G.slice(1),Ke=0;Ke<s.length;){if(ne=s[Ke],pe=ne?ne+Ae:G,pe in Y)return pe;Ke++}return l}var U=1;function J(){return U++}function K(Y){var G=Y.ownerDocument||Y;return G.defaultView||G.parentWindow||e}var Q=/mobile|tablet|ip(ad|hone|od)|android/i,X="ontouchstart"in e,oe=F(e,"PointerEvent")!==l,be=X&&Q.test(navigator.userAgent),he="touch",$e="pen",We="mouse",nt="kinect",st=25,Be=1,xe=2,Ze=4,at=8,Ht=1,Ve=2,Me=4,ot=8,De=16,Ye=Ve|Me,ye=ot|De,Ce=Ye|ye,ut=["x","y"],qt=["clientX","clientY"];function Le(Y,G){var ne=this;this.manager=Y,this.callback=G,this.element=Y.element,this.target=Y.options.inputTarget,this.domHandler=function(pe){T(Y.options.enable,[Y])&&ne.handler(pe)},this.init()}Le.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(K(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(K(this.element),this.evWin,this.domHandler)}};function rt(Y){var G,ne=Y.options.inputClass;return ne?G=ne:oe?G=cl:be?G=Fe:X?G=ft:G=zi,new G(Y,on)}function on(Y,G,ne){var pe=ne.pointers.length,Ae=ne.changedPointers.length,Ke=G&Be&&pe-Ae===0,ht=G&(Ze|at)&&pe-Ae===0;ne.isFirst=!!Ke,ne.isFinal=!!ht,Ke&&(Y.session={}),ne.eventType=G,Mn(Y,ne),Y.emit("hammer.input",ne),Y.recognize(ne),Y.session.prevInput=ne}function Mn(Y,G){var ne=Y.session,pe=G.pointers,Ae=pe.length;ne.firstInput||(ne.firstInput=Vt(G)),Ae>1&&!ne.firstMultiple?ne.firstMultiple=Vt(G):Ae===1&&(ne.firstMultiple=!1);var Ke=ne.firstInput,ht=ne.firstMultiple,rn=ht?ht.center:Ke.center,dn=G.center=wn(pe);G.timeStamp=f(),G.deltaTime=G.timeStamp-Ke.timeStamp,G.angle=kt(rn,dn),G.distance=li(rn,dn),Re(ne,G),G.offsetDirection=Oi(G.deltaX,G.deltaY);var Tn=cn(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?ln(ht.pointers,pe):1,G.rotation=ht?Sn(ht.pointers,pe):0,G.maxPointers=ne.prevInput?G.pointers.length>ne.prevInput.maxPointers?G.pointers.length:ne.prevInput.maxPointers:G.pointers.length,Ft(ne,G);var _i=Y.element;I(G.srcEvent.target,_i)&&(_i=
2024-10-15 14:03:48 +08:00
* chartjs-plugin-zoom v2.0.1
* undefined
* (c) 2016-2023 chartjs-plugin-zoom Contributors
* Released under the MIT License
*/const to=n=>n&&n.enabled&&n.modifierKey,Gk=(n,e)=>n&&e[n+"Key"],Gu=(n,e)=>n&&!e[n+"Key"];function rl(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 x$(n,e){let t;return function(){return clearTimeout(t),t=setTimeout(n,e),e}}function eC({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 Xk(n,e,t){const{mode:i="xy",scaleMode:l,overScaleMode:s}=n||{},o=eC(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 tC(n){iu.delete(n)}function Qk(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=Et(o.options,o.scale)}return Et(s,l)}function nC(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 iC(n,e,t,i){const l=Qk(n,e,t),s={min:n.min+l.min,max:n.max-l.max};return fs(n,s,i,!0)}function lC(n,e,t,i){fs(n,nC(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 sC(n){const t=n.getLabels().length-1;n.min>0&&(n.min-=1),n.max<t&&(n.max+=1)}function oC(n,e,t,i){const l=Qk(n,e,t);n.min===n.max&&e<1&&sC(n);const s={min:n.min+Qd(l.min),max:n.max-Qd(l.max)};return fs(n,s,i,!0)}function rC(n){return n.isHorizontal()?n.width:n.height}function aC(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(rC(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 uC={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 xk(n,e,t,i=!1){const{min:l,max:s,options:o}=n,r=o.time&&o.time.round,a=uC[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 xk(n,e,t,!0)}const lu={category:oC,default:iC},su={default:lC},ou={category:aC,default:xk,logarithmic:xd,timeseries:xd};function fC(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){fC(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;pt(l,[n,e,t,i])}function np(n,e,t,i,l){const s=su[n.type]||su.default;pt(s,[n,e,t,i,l])}function cC(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=cC(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=Xk(a,s,n);_t(c||n.scales,function(d){d.isHorizontal()&&u?tp(d
2024-11-05 01:08:21 +08:00
`),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),dt(s,o)}}}function r5(n,e,t){let{class:i=""}=e;return n.$$set=l=>{"class"in l&&t(0,i=l.class)},[i]}class rv extends Se{constructor(e){super(),we(this,e,r5,o5,ge,{class:0})}}function a5(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:[f5,({uniqueId:d})=>({23:d}),({uniqueId:d})=>d?8388608:0]},$$scope:{ctx:n}}}),l=new fe({props:{class:"form-field",name:"logs.minLevel",$$slots:{default:[c5,({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:[d5,({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:[p5,({uniqueId:d})=>({23:d}),({uniqueId:d})=>d?8388608:0]},$$scope:{ctx:n}}}),{c(){e=b("form"),j(t.$$.fragment),i=C(),j(l.$$.fragment),s=C(),j(o.$$.fragment),r=C(),j(a.$$.fragment),p(e,"id",n[6]),p(e,"class","grid"),p(e,"autocomplete","off")},m(d,m){y(d,e,m),q(t,e,null),w(e,i),q(l,e,null),w(e,s),q(o,e,null),w(e,r),q(a,e,null),u=!0,f||(c=W(e,"submit",tt(n[7])),f=!0)},p(d,m){const h={};m&25165826&&(h.$$scope={dirty:m,ctx:d}),t.$set(h);const _={};m&25165826&&(_.$$scope={dirty:m,ctx:d}),l.$set(_);const g={};m&25165826&&(g.$$scope={dirty:m,ctx:d}),o.$set(g);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),H(t),H(l),H(o),H(a),f=!1,c()}}}function u5(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 f5(n){let e,t,i,l,s,o,r,a,u,f;return{c(){e=b("label"),t=B("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=W(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 c5(n){let e,t,i,l,s,o,r,a,u,f,c,d,m;return f=new rv({}),{c(){e=b("label"),t=B("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(),j(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,_){y(h,e,_),w(e,t),y(h,l,_),y(h,s,_),ce(s,n[1].logs.minLevel),y(h,o,_),y(h,r,_),w(r,a),w(r,u),q(f,r,null),c=!0,d||(m=W(s,"input",n[12]),d=!0)},p(h,_){(!c||_&8388608&&i!==(i=h[23]))&&p(e,"for",i),_&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)),H(f),d=!1,m()}}}function d5(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=C(),l=b("label"),s=B("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=W(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 p5(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=C(),l=b("label"),s=B("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=W(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=de(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),dt(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=B(t),l=B(" "),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=W(e,"click",r),s=!0)},p(a,u){n=a,u&8&&t!==(t="{"+n[25]+"}")&&re(i,t)},d(a){a&&(v(e),v(l)),s=!1,o()}}}function q5(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=B("Subject"),l=C(),s=b("input"),r=C(),c&&c.c(),a=ve(),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=W(s,"input",n[14]),u=!0)},p(m,h){var _;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),((_=m[3])==null?void 0:_.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 H5(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=W(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 j5(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(()=>ke(e,"value",s))),{c(){e&&j(e.$$.fragment),i=ve()},m(a,u){e&&q(e,a,u),y(a,i,u),l=!0},p(a,u){if(u&32&&o!==(o=a[5])){if(e){ae();const f=e;D(f.$$.fragment,1,0,()=>{H(f,1)}),ue()}o?(e=jt(o,r(a)),ie.push(()=>ke(e,"value",s)),j(e.$$.fragment),E(e.$$.fragment,1),q(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,Te(()=>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&&H(e,a)}}}function Ep(n){let e,t,i=de(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=B(`Available placeholder parameters:
2024-11-05 01:08:21 +08:00
`);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=de(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),dt(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=B(t),l=B(" "),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=W(e,"click",r),s=!0)},p(a,u){n=a,u&8&&t!==(t="{"+n[25]+"}")&&re(i,t)},d(a){a&&(v(e),v(l)),s=!1,o()}}}function z5(n){var h;let e,t,i,l,s,o,r,a,u;const f=[j5,H5],c=[];function d(_,g){return _[5]&&!_[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=B("Body (HTML)"),l=C(),o.c(),r=C(),m&&m.c(),a=ve(),p(e,"for",i=n[24])},m(_,g){y(_,e,g),w(e,t),y(_,l,g),c[s].m(_,g),y(_,r,g),m&&m.m(_,g),y(_,a,g),u=!0},p(_,g){var S;(!u||g&16777216&&i!==(i=_[24]))&&p(e,"for",i);let k=s;s=d(_),s===k?c[s].p(_,g):(ae(),D(c[k],1,1,()=>{c[k]=null}),ue(),o=c[s],o?o.p(_,g):(o=c[s]=f[s](_),o.c()),E(o,1),o.m(r.parentNode,r)),((S=_[3])==null?void 0:S.length)>0?m?m.p(_,g):(m=Ep(_),m.c(),m.m(a.parentNode,a)):m&&(m.d(1),m=null)},i(_){u||(E(o),u=!0)},o(_){D(o),u=!1},d(_){_&&(v(e),v(l),v(r),v(a)),c[s].d(_),m&&m.d(_)}}}function U5(n){let e,t,i,l;return e=new fe({props:{class:"form-field required",name:n[1]+".subject",$$slots:{default:[q5,({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:[z5,({uniqueId:s})=>({24:s}),({uniqueId:s})=>s?16777216:0]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment),t=C(),j(i.$$.fragment)},m(s,o){q(e,s,o),y(s,t,o),q(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),H(e,s),H(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=Ee(He.call(null,e,{text:"Has errors",position:"left"})),l=!0)},i(o){i||(o&&et(()=>{i&&(t||(t=je(e,Tt,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=je(e,Tt,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&v(e),o&&t&&t.end(),l=!1,s()}}}function V5(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=B(n[2]),o=C(),r=b("div"),a=C(),f&&f.c(),u=ve(),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&&re(s,c[2]),c[7]?f?d&128&&E(f,1):(f=Dp(),f.c(),E(f,1),f.m(u.parentNode,u)):f&&(ae(),D(f,1,1,()=>{f=null}),ue())},d(c){c&&(v(e),v(o),v(r),v(a),v(u)),f&&f.d(c)}}}function B5(n){let e,t;const i=[n[9]];let l={$$slots:{header:[V5],default:[U5]},$$scope:{ctx:n}};for(let s=0;s<i.length;s+=1)l=ze(l,i[s]);return e=new ji({props:l}),n[19](e),e.$on("expand",n[20]),e.$on("collapse",n[21]),e.$on("toggle",n[22]),{c(){j(e.$$.fragment)},m(s,o){q(e,s,o),t=!0},p(s,[o]){const r=o&512?wt(i,[Rt(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),H(e,s)}}}let Ip;function W5(n,e,t){let i;const l=["key","title","config","placeholders","expand","collapse","collapseSiblings"];let s=lt(e,l),o;Qe(n,yn,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 _(){c==null||c.collapse()}function g(){c==null||c.collapseSiblings()}async function k(){d||m||(t(6,m=!0),t(5,d=(await Ot(async()=>{const{default:R}=await import("./CodeEditor-B0EGgw8R.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 d6(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:[f6,({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:[c6]},$$scope:{ctx:n}};return n[0].mfa.rule!==void 0&&(c.rule=n[0].mfa.rule),r=new il({props:c}),ie.push(()=>ke(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-10-15 14:03:48 +08:00
methods (otp, identity/password, oauth2) before issuing an auth token.
<a href="https://pocketbase.io/docs/authentication/#multi-factor-authentication" target="_blank" rel="noopener noreferrer" class="txt-sm link-hint" title="Learn more"><em>(Learn more)</em> </a>.</p>`,t=C(),i=b("div"),j(l.$$.fragment),s=C(),o=b("div"),j(r.$$.fragment),p(e,"class","content m-b-sm"),p(o,"class","content"),x(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),q(l,i,null),w(i,s),w(i,o),q(r,o,null),u=!0},p(d,m){const h={};m&97&&(h.$$scope={dirty:m,ctx:d}),l.$set(h);const _={};m&1&&(_.disabled=!d[0].mfa.enabled),m&1&&(_.collection=d[0]),m&64&&(_.$$scope={dirty:m,ctx:d}),!a&&m&1&&(a=!0,_.rule=d[0].mfa.rule,Te(()=>a=!1)),r.$set(_),(!u||m&1)&&x(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)),H(l),H(r)}}}function p6(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 m6(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=Ee(He.call(null,e,{text:"Has errors",position:"left"})),l=!0)},i(o){i||(o&&et(()=>{i&&(t||(t=je(e,Tt,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=je(e,Tt,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&v(e),o&&t&&t.end(),l=!1,s()}}}function h6(n){let e,t,i,l,s,o;function r(c,d){return c[0].mfa.enabled?m6:p6}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=ve(),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&&(ae(),D(f,1,1,()=>{f=null}),ue())},d(c){c&&(v(e),v(t),v(i),v(l),v(s),v(o)),u.d(c),f&&f.d(c)}}}function _6(n){let e,t;return e=new ji({props:{single:!0,$$slots:{header:[h6],default:[d6]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,l){q(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){H(e,i)}}}function g6(n,e,t){let i,l;Qe(n,yn,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=!V.isEmpty(l==null?void 0:l.mfa))},[s,i,l,o,r]}class b6 extends Se{constructor(e){super(),we(this,e,g6,_6,ge,{collection:0})}}const k6=n=>({}),Vp=n=>({});function Bp(n,e,t){const i=n.slice();return i[50]=e[t],i}const v6=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=B(n[2]),i=C(),p(e,"class","block txt-placeholder"),x(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&&re(t,l[2]),s[0]&96&&x(e,"link-hint",!l[5]&&!l[6])},d(l){l&&v(e)}}}function y6(n){let e,t=n[50]+"",i;return{c(){e=b("span"),i=B(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]+"")&&re(i,t)},i:te,o:te,d(l){l&&v(e)}}}function w6(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&&Rt(r[11])]))),{props:u}}return s&&(e=jt(s,o(n))),{c(){e&&j(e.$$.fragment),t=ve()},m(r,a){e&&q(e,r,a),y(r,t,a),i=!0},p(r,a){if(a[0]&1024&&s!==(s=r[10])){if(e){ae();const u=e;D(u.$$.fragment,1,0,()=>{H(u,1)}),ue()}s?(e=jt(s,o(r,a)),j(e.$$.fragment),E(e.$$.fragment,1),q(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&&Rt(r[11])]):{};e.$set(u)}},i(r){i||(e&&E(e.$$.fragment,r),i=!0)}
2024-10-15 14:03:48 +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=W(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:[V6,({uniqueId:$})=>({23:$}),({uniqueId:$})=>$?8388608:0]},$$scope:{ctx:n}}}),r=new fe({props:{class:"form-field required",name:"teamId",$$slots:{default:[B6,({uniqueId:$})=>({23:$}),({uniqueId:$})=>$?8388608:0]},$$scope:{ctx:n}}}),f=new fe({props:{class:"form-field required",name:"keyId",$$slots:{default:[W6,({uniqueId:$})=>({23:$}),({uniqueId:$})=>$?8388608:0]},$$scope:{ctx:n}}}),m=new fe({props:{class:"form-field required",name:"duration",$$slots:{default:[Y6,({uniqueId:$})=>({23:$}),({uniqueId:$})=>$?8388608:0]},$$scope:{ctx:n}}}),_=new fe({props:{class:"form-field required",name:"privateKey",$$slots:{default:[K6,({uniqueId:$})=>({23:$}),({uniqueId:$})=>$?8388608:0]},$$scope:{ctx:n}}}),{c(){e=b("form"),t=b("div"),i=b("div"),j(l.$$.fragment),s=C(),o=b("div"),j(r.$$.fragment),a=C(),u=b("div"),j(f.$$.fragment),c=C(),d=b("div"),j(m.$$.fragment),h=C(),j(_.$$.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),q(l,i,null),w(t,s),w(t,o),q(r,o,null),w(t,a),w(t,u),q(f,u,null),w(t,c),w(t,d),q(m,d,null),w(t,h),q(_,t,null),g=!0,k||(S=W(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 P={};T&25165856&&(P.$$scope={dirty:T,ctx:$}),_.$set(P)},i($){g||(E(l.$$.fragment,$),E(r.$$.fragment,$),E(f.$$.fragment,$),E(m.$$.fragment,$),E(_.$$.fragment,$),g=!0)},o($){D(l.$$.fragment,$),D(r.$$.fragment,$),D(f.$$.fragment,$),D(m.$$.fragment,$),D(_.$$.fragment,$),g=!1},d($){$&&v(e),H(l),H(r),H(f),H(m),H(_),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 G6(n){let e,t,i,l,s,o,r,a,u,f;return{c(){e=b("button"),t=B("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],x(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=W(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&&x(l,"btn-loading",c[7])},d(c){c&&(v(e),v(i),v(l)),u=!1,f()}}}function X6(n){let e,t,i={overlayClose:!n[7],escClose:!n[7],beforeHide:n[18],popup:!0,$$slots:{footer:[G6],header:[Z6],default:[J6]},$$scope:{ctx:n}};return e=new Gt({props:i}),n[19](e),e.$on("show",n[20]),e.$on("hide",n[21]),{c(){j(e.$$.fragment)},m(l,s){q(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),H(e,l)}}}const fr=15777e3;function Q6(n,e,t){let i;const l=bt(),s="apple_secret_"+V.randomString(5);let o,r,a,u,f,c,d=!1;function m(A={}){t(2,r=A.clientId||""),t(3,a=A.teamId||""),t(4,u=A.keyId||""),t(5,f=A.privateKey||""),t(6,c=A.duration||fr),Yt({}),o==null||o.show()}function h(){return o==null?void 0:o.hide()}async function _(){t(7,d=!0);try{const A=await me.settings.generateAppleClientSecret(r,a,u,f.trim(),c);t(7,d=!1),tn("Successfully generated client secret."),l("submit",A),o==null||o.hide()}catch(A){me.error(A)}t(7,d=!1)}function g(){r=
2024-11-05 01:08:21 +08:00
is a direct result of the trusted server code-&gt;token exchange response.</em>`,i=C(),j(l.$$.fragment),s=C(),j(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),q(l,e,null),w(e,s),q(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&&et(()=>{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),H(l),H(o),u&&r&&r.end()}}}function y8(n){let e,t,i,l;return t=new fe({props:{class:"form-field required",name:n[1]+".userInfoURL",$$slots:{default:[T8,({uniqueId:s})=>({13:s}),({uniqueId:s})=>s?8192:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),j(t.$$.fragment),p(e,"class","content")},m(s,o){y(s,e,o),q(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&&et(()=>{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),H(t),s&&i&&i.end()}}}function w8(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=[Ee(He.call(null,l,{text:"URL to the public token verification keys.",position:"top"})),W(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,Ie(f)}}}function S8(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(()=>ke(r,"value",d)),{c(){e=b("label"),t=b("span"),t.textContent="Issuers",i=C(),l=b("i"),o=C(),j(r.$$.fragment),p(t,"class","txt"),p(l,"class","ri-information-line link-hint"),p(e,"for",s=n[13])},m(h,_){y(h,e,_),w(e,t),w(e,i),w(e,l),y(h,o,_),q(r,h,_),u=!0,f||(c=Ee(He.call(null,l,{text:"Comma separated list of accepted values for the iss token claim validation.",position:"top"})),f=!0)},p(h,_){(!u||_&8192&&s!==(s=h[13]))&&p(e,"for",s);const g={};_&8192&&(g.id=h[13]),!a&&_&1&&(a=!0,g.value=h[0].extra.issuers,Te(()=>a=!1)),r.$set(g)},i(h){u||(E(r.$$.fragment,h),u=!0)},o(h){D(r.$$.fragment,h),u=!1},d(h){h&&(v(e),v(o)),H(r,h),f=!1,c()}}}function T8(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=B("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=W(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 $8(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=[W(e,"change",n[11]),Ee(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,Ie(f)}}}function C8(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:[_8,({uni
`),g&&g.c(),o=C(),r=b("div");for(let A=0;A<S.length;A+=1)S[A].c();a=C(),u=b("button"),u.innerHTML='<span class="txt">+</span> <span class="txt">New index</span>',f=C(),j(c.$$.fragment),p(e,"class","section-title"),p(u,"type","button"),p(u,"class","btn btn-xs btn-transparent btn-pill btn-outline"),p(r,"class","indexes-list svelte-167lbwu")},m(A,N){y(A,e,N),w(e,t),w(e,l),w(e,s),g&&g.m(e,null),y(A,o,N),y(A,r,N);for(let R=0;R<S.length;R+=1)S[R]&&S[R].m(r,null);w(r,a),w(r,u),y(A,f,N),q(c,A,N),m=!0,h||(_=W(u,"click",n[5]),h=!0)},p(A,[N]){var z,F,U,J,K;if((!m||N&1)&&i!==(i=(((F=(z=A[0])==null?void 0:z.indexes)==null?void 0:F.length)||0)+"")&&re(l,i),(J=(U=A[2])==null?void 0:U.indexes)!=null&&J.message?g?(g.p(A,N),N&4&&E(g,1)):(g=Nm(A),g.c(),E(g,1),g.m(e,null)):g&&(ae(),D(g,1,1,()=>{g=null}),ue()),N&7){k=de(((K=A[0])==null?void 0:K.indexes)||[]);let Q;for(Q=0;Q<k.length;Q+=1){const X=Pm(A,k,Q);S[Q]?S[Q].p(X,N):(S[Q]=Fm(X),S[Q].c(),S[Q].m(r,a))}for(;Q<S.length;Q+=1)S[Q].d(1);S.length=k.length}const R={};!d&&N&1&&(d=!0,R.collection=A[0],Te(()=>d=!1)),c.$set(R)},i(A){m||(E(g),E(c.$$.fragment,A),m=!0)},o(A){D(g),D(c.$$.fragment,A),m=!1},d(A){A&&(v(e),v(o),v(r),v(f)),g&&g.d(),dt(S,A),n[6](null),H(c,A),h=!1,_()}}}const qm=n=>n.name;function GO(n,e,t){let i;Qe(n,yn,m=>t(2,i=m));let{collection:l}=e,s;function o(m,h){for(let _=0;_<l.indexes.length;_++)if(l.indexes[_]==m){t(0,l.indexes[_]=h,l),xn("indexes."+_);return}l.indexes.push(h),t(0,l)}const r=(m,h)=>s==null?void 0:s.show(m,h),a=()=>s==null?void 0:s.show();function u(m){ie[m?"unshift":"push"](()=>{s=m,t(1,s)})}function f(m){l=m,t(0,l)}const c=m=>{for(let h=0;h<l.indexes.length;h++)if(l.indexes[h]==m.detail){l.indexes.splice(h,1),xn("indexes."+h);break}t(0,l)},d=m=>{var h;(h=i.indexes)!=null&&h.message&&xn("indexes"),o(m.detail.old,m.detail.new)};return n.$$set=m=>{"collection"in m&&t(0,l=m.collection)},[l,s,i,o,r,a,u,f,c,d]}class XO extends Se{constructor(e){super(),we(this,e,GO,ZO,ge,{collection:0})}}function Hm(n,e,t){const i=n.slice();return i[5]=e[t],i}function jm(n){let e,t,i,l,s,o,r;function a(){return n[3](n[5])}return{c(){e=b("button"),t=b("i"),i=C(),l=b("span"),l.textContent=`${n[5].label}`,s=C(),p(t,"class","icon "+n[5].icon+" svelte-1gz9b6p"),p(t,"aria-hidden","true"),p(l,"class","txt"),p(e,"type","button"),p(e,"role","menuitem"),p(e,"class","dropdown-item svelte-1gz9b6p")},m(u,f){y(u,e,f),w(e,t),w(e,i),w(e,l),w(e,s),o||(r=W(e,"click",a),o=!0)},p(u,f){n=u},d(u){u&&v(e),o=!1,r()}}}function QO(n){let e,t=de(n[1]),i=[];for(let l=0;l<t.length;l+=1)i[l]=jm(Hm(n,t,l));return{c(){for(let l=0;l<i.length;l+=1)i[l].c();e=ve()},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&6){t=de(l[1]);let o;for(o=0;o<t.length;o+=1){const r=Hm(l,t,o);i[o]?i[o].p(r,s):(i[o]=jm(r),i[o].c(),i[o].m(e.parentNode,e))}for(;o<i.length;o+=1)i[o].d(1);i.length=t.length}},d(l){l&&v(e),dt(i,l)}}}function xO(n){let e,t,i,l,s,o,r,a;return o=new jn({props:{class:"dropdown field-types-dropdown",$$slots:{default:[QO]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("i"),i=C(),l=b("div"),l.textContent="New field",s=C(),j(o.$$.fragment),p(t,"class","ri-add-line"),p(t,"aria-hidden","true"),p(l,"class","txt"),p(e,"tabindex","0"),p(e,"role","button"),p(e,"class",r="field-types-btn "+n[0]+" svelte-1gz9b6p")},m(u,f){y(u,e,f),w(e,t),w(e,i),w(e,l),w(e,s),q(o,e,null),a=!0},p(u,[f]){const c={};f&256&&(c.$$scope={dirty:f,ctx:u}),o.$set(c),(!a||f&1&&r!==(r="field-types-btn "+u[0]+" svelte-1gz9b6p"))&&p(e,"class",r)},i(u){a||(E(o.$$.fragment,u),a=!0)},o(u){D(o.$$.fragment,u),a=!1},d(u){u&&v(e),H(o)}}}function eE(n,e,t){let{class:i=""}=e;const l=bt(),s=[{label:"Plain text",value:"text",icon:V.getFieldTypeIcon("text")},{label:"Rich editor",value:"editor",icon:V.getFieldTypeIcon("editor")},{label:"Number",value:"number",icon:V.getFieldTypeIcon("number")},{label:"Bool",value:"bool",icon:V.getFieldTypeIcon("bool")},{label:"Email",value:"email",icon:V.getFieldTypeIcon("email")},{label:"URL",value:"url",icon:V.getFieldTypeIcon("url")},{label:"DateTime",value:"date",icon:V.getFieldTypeIcon("date")},{label:"Autod
2024-10-15 14:03:48 +08:00
<span class='flatpickr-weekday'>
`+ee.join("</span><span class='flatpickr-weekday'>")+`
</span>
`}}function oe(){t.calendarContainer.classList.add("hasWeeks");var Z=Ct("div","flatpickr-weekwrapper");Z.appendChild(Ct("span","flatpickr-weekday",t.l10n.weekAbbreviation));var ee=Ct("div","flatpickr-weeks");return Z.appendChild(ee),{weekWrapper:Z,weekNumbers:ee}}function be(Z,ee){ee===void 0&&(ee=!0);var se=ee?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,Dt("onYearChange"),z()),R(),Dt("onMonthChange"),Ui())}function he(Z,ee){if(Z===void 0&&(Z=!0),ee===void 0&&(ee=!0),t.input.value="",t.altInput!==void 0&&(t.altInput.value=""),t.mobileInput!==void 0&&(t.mobileInput.value=""),t.selectedDates=[],t.latestSelectedDateObj=void 0,ee===!0&&(t.currentYear=t._initialDate.getFullYear(),t.currentMonth=t._initialDate.getMonth()),t.config.enableTime===!0){var se=Ia(t.config),_e=se.hours,qe=se.minutes,le=se.seconds;m(_e,qe,le)}t.redraw(),Z&&Dt("onChange")}function $e(){t.isOpen=!1,t.isMobile||(t.calendarContainer!==void 0&&t.calendarContainer.classList.remove("open"),t._input!==void 0&&t._input.classList.remove("active")),Dt("onClose")}function We(){t.config!==void 0&&Dt("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 ee=t.calendarContainer.parentNode;if(ee.lastChild&&ee.removeChild(ee.lastChild),ee.parentNode){for(;ee.firstChild;)ee.parentNode.insertBefore(ee.firstChild,ee);ee.parentNode.removeChild(ee)}}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 nt(Z){return t.calendarContainer.contains(Z)}function st(Z){if(t.isOpen&&!t.config.inline){var ee=zn(Z),se=nt(ee),_e=ee===t.input||ee===t.altInput||t.element.contains(ee)||Z.path&&Z.path.indexOf&&(~Z.path.indexOf(t.input)||~Z.path.indexOf(t.altInput)),qe=!_e&&!se&&!nt(Z.relatedTarget),le=!t.config.ignoredFocusElements.some(function(Oe){return Oe.contains(ee)});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 ee=Z,se=t.currentYear!==ee;t.currentYear=ee||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(),Dt("onYearChange"),z())}}function xe(Z,ee){var se;ee===void 0&&(ee=!0);var _e=t.parseDate(Z,void 0,ee);if(t.config.minDate&&_e&&Un(_e,t.config.minDate,ee!==void 0?ee:!t.minDateHasTime)<0||t.config.maxDate&&_e&&Un(_e,t.config.maxDate,ee!==void 0?ee:!t.maxDateHasTime)>0)return!1;if(!t.config.
This field is disabled if "Only domains" is set.`,position:"top"})),d=!0)},p(g,k){(!c||k&512&&s!==(s=g[9]))&&p(e,"for",s);const S={};k&512&&(S.id=g[9]),k&1&&(S.disabled=!V.isEmpty(g[0].onlyDomains)),!a&&k&1&&(a=!0,S.value=g[0].exceptDomains,Te(()=>a=!1)),r.$set(S)},i(g){c||(E(r.$$.fragment,g),c=!0)},o(g){D(r.$$.fragment,g),c=!1},d(g){g&&(v(e),v(o),v(u),v(f)),H(r,g),d=!1,m()}}}function YE(n){let e,t,i,l,s,o,r,a,u,f,c,d,m;function h(g){n[4](g)}let _={id:n[9]+".onlyDomains",disabled:!V.isEmpty(n[0].exceptDomains)};return n[0].onlyDomains!==void 0&&(_.value=n[0].onlyDomains),r=new ps({props:_}),ie.push(()=>ke(r,"value",h)),{c(){e=b("label"),t=b("span"),t.textContent="Only domains",i=C(),l=b("i"),o=C(),j(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(g,k){y(g,e,k),w(e,t),w(e,i),w(e,l),y(g,o,k),q(r,g,k),y(g,u,k),y(g,f,k),c=!0,d||(m=Ee(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(g,k){(!c||k&512&&s!==(s=g[9]+".onlyDomains"))&&p(e,"for",s);const S={};k&512&&(S.id=g[9]+".onlyDomains"),k&1&&(S.disabled=!V.isEmpty(g[0].exceptDomains)),!a&&k&1&&(a=!0,S.value=g[0].onlyDomains,Te(()=>a=!1)),r.$set(S)},i(g){c||(E(r.$$.fragment,g),c=!0)},o(g){D(r.$$.fragment,g),c=!1},d(g){g&&(v(e),v(o),v(u),v(f)),H(r,g),d=!1,m()}}}function KE(n){let e,t,i,l,s,o,r;return i=new fe({props:{class:"form-field",name:"fields."+n[1]+".exceptDomains",$$slots:{default:[WE,({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:[YE,({uniqueId:a})=>({9:a}),({uniqueId:a})=>a?512:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),j(i.$$.fragment),l=C(),s=b("div"),j(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),q(i,t,null),w(e,l),w(e,s),q(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),H(i),H(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:[KE]},$$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 ni({props:o}),ie.push(()=>ke(e,"field",s)),e.$on("rename",n[6]),e.$on("remove",n[7]),e.$on("duplicate",n[8]),{c(){j(e.$$.fragment)},m(r,a){q(e,r,a),i=!0},p(r,[a]){const u=a&6?wt(l,[a&2&&{key:r[1]},a&4&&Rt(r[2])]):{};a&1027&&(u.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,u.field=r[0],Te(()=>t=!1)),e.$set(u)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){D(e.$$.fragment,r),i=!1},d(r){H(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){Ne.call(this,n,m)}function c(m){Ne.call(this,n,m)}function d(m){Ne.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 cv extends Se{constructor(e){super(),we(this,e,ZE,JE,ge,{field:0,key:1})}}function GE(n){let e,t=(n[0].ext||"N/A")+"",i,l,s,o=n[0].mimeType+"",r;return{c(){e=b("span"),i=B(t),l=C(),s=b("small"),r=B(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")+"")&&re(i,t),u&1&&o!==(o=a[0].mimeType+"")&&re(r,o)},i:te,o:te,d(a){a&&(v(e),v(l),v(s))}}}function XE(n,e,t){let{item:i={}}=e;return n.$$set=l=>{"item"in l&&t(0,i=l.item)},[i]}class ih extends Se{constructor(e){super(),we(this,e,XE,GE,ge,{item:0})}}const QE=[{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,Te(()=>a=!1)),r.$set(I);const P={};L&33554433&&(P.$$scope={dirty:L,ctx:M}),g.$set(P)},i(M){k||(E(r.$$.fragment,M),E(g.$$.fragment,M),k=!0)},o(M){D(r.$$.fragment,M),D(g.$$.fragment,M),k=!1},d(M){M&&(v(e),v(o),v(u),v(f)),H(r,M),H(g),S=!1,$()}}}function iM(n){let e;return{c(){e=b("ul"),e.innerHTML=`<li><strong>WxH</strong>
2024-10-15 14:03:48 +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 lM(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(()=>ke(r,"value",M)),S=new jn({props:{class:"dropdown dropdown-sm dropdown-center dropdown-nowrap p-r-10",$$slots:{default:[iM]},$$scope:{ctx:n}}}),{c(){e=b("label"),t=b("span"),t.textContent="Thumb sizes",i=C(),l=b("i"),o=C(),j(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",_=C(),g=b("i"),k=C(),j(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(g,"class","ri-arrow-drop-down-fill"),p(g,"aria-hidden","true"),p(m,"type","button"),p(m,"class","inline-flex flex-gap-0"),p(f,"class","help-block")},m(I,P){y(I,e,P),w(e,t),w(e,i),w(e,l),y(I,o,P),q(r,I,P),y(I,u,P),y(I,f,P),w(f,c),w(f,d),w(f,m),w(m,h),w(m,_),w(m,g),w(m,k),q(S,m,null),$=!0,T||(O=Ee(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,P){(!$||P&8388608&&s!==(s=I[23]))&&p(e,"for",s);const A={};P&8388608&&(A.id=I[23]),!a&&P&1&&(a=!0,A.value=I[0].thumbs,Te(()=>a=!1)),r.$set(A);const N={};P&33554432&&(N.$$scope={dirty:P,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)),H(r,I),H(S),T=!1,O()}}}function sM(n){let e,t,i,l,s,o,r,a,u,f,c;return{c(){e=b("label"),t=B("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=W(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 lh(n){let e,t,i;return t=new fe({props:{class:"form-field",name:"fields."+n[1]+".maxSelect",$$slots:{default:[oM,({uniqueId:l})=>({23:l}),({uniqueId:l})=>l?8388608:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),j(t.$$.fragment),p(e,"class","col-sm-3")},m(l,s){y(l,e,s),q(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),H(t)}}}function oM(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=B("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=W(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 rM(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=W(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 aM(n){let e,t,i,l,s,o,r,a,u,f,c,d,m,h,_;i=new fe({props:{class:"form-field",name:"fields."+n[1]+".mimeTypes",$$slots:{default:[nM,({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:[lM,({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:[sM,({uniqueId:k})=>({23:k}),({uniqueId:k})=>k?8388608:0]},$$scope:{ctx:n}}});let g=!n[2]&&lh(n);return h=new fe({props:{class:"form-field form-field-toggle",name:"fields."+n[1]+".protected",$$slots:{default:[rM,({uniqueId:k})=>({23:k}),({uniqueId:k})=>k?8388608:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),j(i.$$.fragment),l=C(),s=b("div"),j(o.$$.fragment),a=C(),u=b("div"),j(f.$$.fragment),d=C(),g&&g.c(),m=C(),j(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),q(i,t,null),w(e,l),w(e,s),q(o,s,null),w(e,a),w(e,u),q(f,u,null),w(e,d),g&&g.m(e,null),w(e,m),q(h,e,null),_=!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),(!_||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),(!_||S&4&&c!==(c=k[2]?"col-sm-4":"col-sm-3"))&&p(u,"class",c),k[2]?g&&(ae(),D(g,1,1,()=>{g=null}),ue()):g?(g.p(k,S),S&4&&E(g,1)):(g=lh(k),g.c(),E(g,1),g.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){_||(E(i.$$.fragment,k),E(o.$$.fragment,k),E(f.$$.fragment,k),E(g),E(h.$$.fragment,k),_=!0)},o(k){D(i.$$.fragment,k),D(o.$$.fragment,k),D(f.$$.fragment,k),D(g),D(h.$$.fragment,k),_=!1},d(k){k&&v(e),H(i),H(o),H(f),g&&g.d(),H(h)}}}function uM(n){let e,t,i;const l=[{key:n[1]},n[5]];function s(r){n[17](r)}let o={$$slots:{options:[aM],default:[eM,({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 ni({props:o}),ie.push(()=>ke(e,"field",s)),e.$on("rename",n[18]),e.$on("remove",n[19]),e.$on("duplicate",n[20]),{c(){j(e.$$.fragment)},m(r,a){q(e,r,a),i=!0},p(r,[a]){const u=a&34?wt(l,[a&2&&{key:r[1]},a&32&&Rt(r[5])]):{};a&50331663&&(u.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,u.field=r[0],Te(()=>t=!1)),e.$set(u)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){D(e.$$.fragment,r),i=!1},d(r){H(e,r)}}}function fM(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=QE.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(V.isEmpty(s.mimeTypes))return;const N=[];for(const R of s.mimeTypes)a.find(z=>z.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)},_=()=>{t(0,s.mimeTypes=["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetm
2024-11-01 20:05:42 +08:00
`),r=b("code"),r.textContent="multipart/form-data",a=B(`
requests, the following normalization rules are applied if the `),u=b("code"),u.textContent="json",f=B(` field
2024-10-15 14:03:48 +08:00
is a
2024-11-01 20:05:42 +08:00
`),c=b("strong"),c.textContent="plain string",d=B(`:
`),m=b("ul"),h=b("li"),h.innerHTML="&quot;true&quot; is converted to the json <code>true</code>",_=C(),g=b("li"),g.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=B(L),P=B(" is converted to the json "),A=b("code"),A.textContent='{"a":1,"b":2}',N=C(),R=b("li"),R.textContent="numeric strings are converted to json number",z=C(),F=b("li"),F.textContent="double quoted strings are left as they are (aka. without normalizations)",U=C(),J=b("li"),J.textContent="any other string (empty string too) is double quoted",K=B(`
2024-10-15 14:03:48 +08:00
Alternatively, if you want to avoid the string value normalizations, you can wrap your
data inside an object, eg.`),Q=b("code"),Q.textContent='{"data": anything}',p(i,"class","content"),p(t,"class","alert alert-warning m-b-0 m-t-10"),p(e,"class","block")},m(be,he){y(be,e,he),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,_),w(m,g),w(m,k),w(m,S),w(m,$),w(m,T),w(m,O),w(m,M),w(M,I),w(M,P),w(M,A),w(m,N),w(m,R),w(m,z),w(m,F),w(m,U),w(m,J),w(i,K),w(i,Q),oe=!0},i(be){oe||(be&&et(()=>{oe&&(X||(X=je(e,mt,{duration:150},!0)),X.run(1))}),oe=!0)},o(be){be&&(X||(X=je(e,mt,{duration:150},!1)),X.run(0)),oe=!1},d(be){be&&v(e),be&&X&&X.end()}}}function hM(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:[dM,({uniqueId:g})=>({10:g}),({uniqueId:g})=>g?1024:0]},$$scope:{ctx:n}}});function d(g,k){return g[2]?mM:pM}let m=d(n),h=m(n),_=n[2]&&sh();return{c(){j(e.$$.fragment),t=C(),i=b("button"),l=b("strong"),l.textContent="String value normalizations",s=C(),h.c(),r=C(),_&&_.c(),a=ve(),p(l,"class","txt"),p(i,"type","button"),p(i,"class",o="btn btn-sm "+(n[2]?"btn-secondary":"btn-hint btn-transparent"))},m(g,k){q(e,g,k),y(g,t,k),y(g,i,k),w(i,l),w(i,s),h.m(i,null),y(g,r,k),_&&_.m(g,k),y(g,a,k),u=!0,f||(c=W(i,"click",n[5]),f=!0)},p(g,k){const S={};k&2&&(S.name="fields."+g[1]+".maxSize"),k&3073&&(S.$$scope={dirty:k,ctx:g}),e.$set(S),m!==(m=d(g))&&(h.d(1),h=m(g),h&&(h.c(),h.m(i,null))),(!u||k&4&&o!==(o="btn btn-sm "+(g[2]?"btn-secondary":"btn-hint btn-transparent")))&&p(i,"class",o),g[2]?_?k&4&&E(_,1):(_=sh(),_.c(),E(_,1),_.m(a.parentNode,a)):_&&(ae(),D(_,1,1,()=>{_=null}),ue())},i(g){u||(E(e.$$.fragment,g),E(_),u=!0)},o(g){D(e.$$.fragment,g),D(_),u=!1},d(g){g&&(v(t),v(i),v(r),v(a)),H(e,g),h.d(),_&&_.d(g),f=!1,c()}}}function _M(n){let e,t,i;const l=[{key:n[1]},n[3]];function s(r){n[6](r)}let o={$$slots:{options:[hM]},$$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 ni({props:o}),ie.push(()=>ke(e,"field",s)),e.$on("rename",n[7]),e.$on("remove",n[8]),e.$on("duplicate",n[9]),{c(){j(e.$$.fragment)},m(r,a){q(e,r,a),i=!0},p(r,[a]){const u=a&10?wt(l,[a&2&&{key:r[1]},a&8&&Rt(r[3])]):{};a&2055&&(u.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,u.field=r[0],Te(()=>t=!1)),e.$set(u)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){D(e.$$.fragment,r),i=!1},d(r){H(e,r)}}}function gM(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){Ne.call(this,n,h)}function d(h){Ne.call(this,n,h)}function m(h){Ne.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 bM extends Se{constructor(e){super(),we(this,e,gM,_M,ge,{field:0,key:1})}}function kM(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=B("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=W(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 vM(n){let e,t,i,l,s,o,r,a,u;return{c(){e=b("label"),t=B("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=W(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 yM(n){let e,t,i,l,s,o,r;return i=new fe({props:{class:"form-field",name:"fields."+n[1]+".min",$$slots:{default:[kM,({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:[vM,({uniqueId:a})=>({10:a}),({uniqueId:a})=>a?1024:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),j(i.$$.fragment),l=C(),s=b(
2024-10-15 14:03:48 +08:00
`),position:"top"})),c=!0)},p(_,g){var S,$;s&&It(s.update)&&g&20&&s.update.call(null,{text:[`Whether on ${((S=_[4])==null?void 0:S.name)||"relation"} record deletion to delete also the current corresponding collection record(s).`,_[2]?null:`For "Multiple" relation fields the cascade delete is triggered only when all ${(($=_[4])==null?void 0:$.name)||"relation"} ids are removed from the corresponding record.`].filter(Boolean).join(`
2024-10-15 14:03:48 +08:00
`),position:"top"}),(!f||g&16777216&&o!==(o=_[24]))&&p(e,"for",o);const k={};g&16777216&&(k.id=_[24]),!u&&g&1&&(u=!0,k.keyOfSelected=_[0].cascadeDelete,Te(()=>u=!1)),a.$set(k)},i(_){f||(E(a.$$.fragment,_),f=!0)},o(_){D(a.$$.fragment,_),f=!1},d(_){_&&(v(e),v(r)),H(a,_),c=!1,d()}}}function UM(n){let e,t,i,l,s,o=!n[2]&&oh(n);return l=new fe({props:{class:"form-field",name:"fields."+n[1]+".cascadeDelete",$$slots:{default:[zM,({uniqueId:r})=>({24:r}),({uniqueId:r})=>r?16777216:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),o&&o.c(),t=C(),i=b("div"),j(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),q(l,i,null),s=!0},p(r,a){r[2]?o&&(ae(),D(o,1,1,()=>{o=null}),ue()):o?(o.p(r,a),a&4&&E(o,1)):(o=oh(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(),H(l)}}}function VM(n){let e,t,i,l,s;const o=[{key:n[1]},n[8]];function r(f){n[17](f)}let a={$$slots:{options:[UM],default:[qM,({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 ni({props:a}),ie.push(()=>ke(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(){j(e.$$.fragment),i=C(),j(l.$$.fragment)},m(f,c){q(e,f,c),y(f,i,c),q(l,f,c),s=!0},p(f,[c]){const d=c&258?wt(o,[c&2&&{key:f[1]},c&256&&Rt(f[8])]):{};c&100663359&&(d.$$scope={dirty:c,ctx:f}),!t&&c&1&&(t=!0,d.field=f[0],Te(()=>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),H(e,f),n[21](null),H(l,f)}}}function BM(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 _(){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 g=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){Ne.call(this,n,R)}function I(R){Ne.call(this,n,R)}function P(R){Ne.call(this,n,R)}function A(R){ie[R?"unshift":"push"](()=>{d=R,t(3,d)})}const N=R=>{var z,F;(F=(z=R==null?void 0:R.detail)==null?void 0:z.collection)!=null&&F.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"&&_(),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,g,k,S,$,T,O,M,L,I,P,A,N]}class WM extends Se{constructor(e){super(),we(this,e,BM,VM,ge,{field:0,key:1})}}function YM(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(()=>ke(t,"value",r)),{c(){e=b("div"),j(t.$$.fragment)},m(u,f){y(u,e,f),q(t,e,null),l=!0,s||(o=Ee(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,Te(()=>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),H(t),s=!1,o()}}}func
2024-10-15 14:03:48 +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.
2024-11-05 01:08:21 +08:00
<code>(MAX(balance) + 1) as maxBalance</code>.</li></ul>`,u=C(),_&&_.c(),f=ve(),p(t,"class","txt"),p(e,"for",i=n[8]),p(a,"class","help-block")},m(g,k){y(g,e,k),w(e,t),y(g,l,k),m[s].m(g,k),y(g,r,k),y(g,a,k),y(g,u,k),_&&_.m(g,k),y(g,f,k),c=!0},p(g,k){(!c||k&256&&i!==(i=g[8]))&&p(e,"for",i);let S=s;s=h(g),s===S?m[s].p(g,k):(ae(),D(m[S],1,1,()=>{m[S]=null}),ue(),o=m[s],o?o.p(g,k):(o=m[s]=d[s](g),o.c()),E(o,1),o.m(r.parentNode,r)),g[3].length?_?_.p(g,k):(_=ch(g),_.c(),_.m(f.parentNode,f)):_&&(_.d(1),_=null)},i(g){c||(E(o),c=!0)},o(g){D(o),c=!1},d(g){g&&(v(e),v(l),v(r),v(a),v(u),v(f)),m[s].d(g),_&&_.d(g)}}}function bD(n){let e,t;return e=new fe({props:{class:"form-field required "+(n[3].length?"error":""),name:"viewQuery",$$slots:{default:[gD,({uniqueId:i})=>({8:i}),({uniqueId:i})=>i?256:0]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,l){q(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){H(e,i)}}}function kD(n,e,t){let i;Qe(n,yn,c=>t(4,i=c));let{collection:l}=e,s,o=!1,r=[];function a(c){t(3,r=[]);const d=V.getNestedVal(c,"fields",null);if(V.isEmpty(d))return;if(d!=null&&d.message){r.push(d==null?void 0:d.message);return}const m=V.extractColumnsFromQuery(l==null?void 0:l.viewQuery);V.removeByValue(m,"id"),V.removeByValue(m,"created"),V.removeByValue(m,"updated");for(let h in d)for(let _ in d[h]){const g=d[h][_].message,k=m[h]||h;r.push(V.sentenize(k+": "+g))}}Zt(async()=>{t(2,o=!0);try{t(1,s=(await Ot(async()=>{const{default:c}=await import("./CodeEditor-B0EGgw8R.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&&xn("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 vD extends Se{constructor(e){super(),we(this,e,kD,bD,ge,{collection:0})}}function ph(n,e,t){const i=n.slice();return i[15]=e[t],i}function mh(n){let e,t,i,l,s,o,r,a,u,f,c,d,m,h,_,g,k,S,$,T,O,M,L,I,P=de(n[4]),A=[];for(let N=0;N<P.length;N+=1)A[N]=_h(ph(n,P,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<A.length;N+=1)A[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"),_=C(),g=b("p"),g.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(g,"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 z=0;z<A.length;z+=1)A[z]&&A[z].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,_),w(i,g),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){P=de(N[4]);let z;for(z=0;z<P.length;z+=1){const F=ph(N,P,z);A[z]?A[z].p(F,R):(A[z]=_h(F),A[z].c(),A[z].m(o,null))}for(;z<A.length;z+=1)A[z].d(1);A.length=P.length}},i(N){I||(N&&et(()=>{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),dt(A,N),N&&L&&L.end()}}}function hh(n){let e,t=n[15]+"",i;return{c(){e=b("code"),i=B(t)},m(l,s){y(l,e,s),w(e,i)},p(l,s){s&16&&t!==(t=l[15]+"")&&re(i,t)},d(l){l&&v(e)}}}function _h(n){let e=!n[3].includes(n[15]),t,i=e&&hh(n);return{c(){i&&i.c(),t=ve()},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=hh(l),i.c(),i.m(t.parentNode,t)):i&&(i.d(1),i=null)},d(l){l&&v(t),i&&i.d(l)}}}function gh(n){let e,t,i,l,s,o,r,a,u;function f(g){n[8](g)}let c={label:"Create rule",formKey:"createRule",collection:n[0],$$slots:{afterLabel:[yD,({isSuperuserOnly:g})=>({14:g}),({isSuperuserOnly:g})=>g?16384:0]},$$scope:{ctx:n}};n[0].createRule!==void 0&&(c.rule=n[0].createRule),e=new il({props:c}),ie.push(()=>ke(e,"rule",f));function d(g){n[9](g)}let m={label:"Update rule",formKey:"updateRule",collection:n[0]};n[0].updateRule!==void 0&&(m.rule=n[0].updateRule),l=new il({props:m}),ie.push(()=>ke(l,"rule",d));function h(g){n[10](g)}let _={label:"Delete rule",formKey:"deleteRule",collection:n[0]};return n[0].deleteRule!==void 0&&(_.rule=n[0].deleteRule),r=new il({props:_}),ie.push(()=>ke(r,"rule",h)),{c(){j(e.$$.fragment),i=C(),j(l.$$.fragment),o=C(),j(r.$$.fragment)},m(g,k){q(e,g,k),y(g,i,k),q(l,g,k),y(g,o,k),q(r,g,k),u=!0},p(g,k){const S={};k&1&&(S.collection=g[0]),k&278528&&(S.$$scope={dirty:k,ctx:g}),!t&&k&1&&(t=!0,S.rule=g[0].createRule,Te(()=>t=!1)),e.$set(S);const $={};k&1&&($.collection=g[0]),!s&&k&1&&(s=!0,$.rule=g[0].updateRule,Te(()=>s=!1)),l.$set($);const T={};k&1&&(T.collection=g[0]),!a&&k&1&&(a=!0,T.rule=g[0].deleteRule,Te(()=>a=!1)),r.$set(T)},i(g){u||(E(e.$$.fragment,g),E(l.$$.fragment,g),E(r.$$.fragment,g),u=!0)},o(g){D(e.$$.fragment,g),D(l.$$.fragment,g),D(r.$$.fragment,g),u=!1},d(g){g&&(v(i),v(o)),H(e,g),H(l,g),H(r,g)}}}function bh(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=Ee(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 yD(n){let e,t=!n[14]&&bh();return{c(){t&&t.c(),e=ve()},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=bh(),t.c(),t.m(e.parentNode,e))},d(i){i&&v(e),t&&t.d(i)}}}function kh(n){let e,t,i,l,s,o,r,a,u,f,c;function d(g,k){return g[2]?SD:wD}let m=d(n),h=m(n),_=n[2]&&vh(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(),_&&_.c(),a=ve(),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(g,k){y(g,e,k),y(g,t,k),y(g,i,k),w(i,l),w(i,s),h.m(i,null),y(g,r,k),_&&_.m(g,k),y(g,a,k),u=!0,f||(c=W(i,"click",n[11]),f=!0)},p(g,k){m!==(m=d(g))&&(h.d(1),h=m(g),h&&(h.c(),h.m(i,null))),(!u||k&4&&o!==(o="btn btn-sm m-b-sm "+(g[2]?"btn-secondary":"btn-hint btn-transparent")))&&p(i,"class",o),g[2]?_?(_.p(g,k),k&4&&E(_,1)):(_=vh(g),_.c(),E(_,1),_.m(a.parentNode,a)):_&&(ae(),D(_,1,1,()=>{_=null}),ue())},i(g){u||(E(_),u=!0)},o(g
2024-10-15 14:03:48 +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 $D(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-10-15 14:03:48 +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 CD(n){var R,z;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]&&mh(n);function M(F){n[6](F)}let L={label:"List/Search rule",formKey:"listRule",collection:n[0]};n[0].listRule!==void 0&&(L.rule=n[0].listRule),f=new il({props:L}),ie.push(()=>ke(f,"rule",M));function I(F){n[7](F)}let P={label:"View rule",formKey:"viewRule",collection:n[0]};n[0].viewRule!==void 0&&(P.rule=n[0].viewRule),m=new il({props:P}),ie.push(()=>ke(m,"rule",I));let A=((R=n[0])==null?void 0:R.type)!=="view"&&gh(n),N=((z=n[0])==null?void 0:z.type)==="auth"&&kh(n);return{c(){e=b("div"),t=b("div"),i=b("p"),i.innerHTML=`All rules follow the
2024-10-15 14:03:48 +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=B(o),a=C(),O&&O.c(),u=C(),j(f.$$.fragment),d=C(),j(m.$$.fragment),_=C(),A&&A.c(),g=C(),N&&N.c(),k=ve(),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(F,U){y(F,e,U),w(e,t),w(t,i),w(t,l),w(t,s),w(s,r),w(e,a),O&&O.m(e,null),y(F,u,U),q(f,F,U),y(F,d,U),q(m,F,U),y(F,_,U),A&&A.m(F,U),y(F,g,U),N&&N.m(F,U),y(F,k,U),S=!0,$||(T=W(s,"click",n[5]),$=!0)},p(F,[U]){var Q,X;(!S||U&2)&&o!==(o=F[1]?"Hide available fields":"Show available fields")&&re(r,o),F[1]?O?(O.p(F,U),U&2&&E(O,1)):(O=mh(F),O.c(),E(O,1),O.m(e,null)):O&&(ae(),D(O,1,1,()=>{O=null}),ue());const J={};U&1&&(J.collection=F[0]),!c&&U&1&&(c=!0,J.rule=F[0].listRule,Te(()=>c=!1)),f.$set(J);const K={};U&1&&(K.collection=F[0]),!h&&U&1&&(h=!0,K.rule=F[0].viewRule,Te(()=>h=!1)),m.$set(K),((Q=F[0])==null?void 0:Q.type)!=="view"?A?(A.p(F,U),U&1&&E(A,1)):(A=gh(F),A.c(),E(A,1),A.m(g.parentNode,g)):A&&(ae(),D(A,1,1,()=>{A=null}),ue()),((X=F[0])==null?void 0:X.type)==="auth"?N?(N.p(F,U),U&1&&E(N,1)):(N=kh(F),N.c(),E(N,1),N.m(k.parentNode,k)):N&&(ae(),D(N,1,1,()=>{N=null}),ue())},i(F){S||(E(O),E(f.$$.fragment,F),E(m.$$.fragment,F),E(A),E(N),S=!0)},o(F){D(O),D(f.$$.fragment,F),D(m.$$.fragment,F),D(A),D(N),S=!1},d(F){F&&(v(e),v(u),v(d),v(_),v(g),v(k)),O&&O.d(),H(f,F),H(m,F),A&&A.d(F),N&&N.d(F),$=!1,T()}}}function OD(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 _(k){n.$$.not_equal(s.authRule,k)&&(s.authRule=k,t(0,s))}function g(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=V.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 ED extends Se{constructor(e){super(),we(this,e,OD,CD,ge,{collection:0})}}function yh(n,e,t){const i=n.slice();return i[24]=e[t],i}function wh(n,e,t){const i=n.slice();return i[27]=e[t],i}function Sh(n,e,t){const i=n.slice();return i[27]=e[t],i}function Th(n,e,t){const i=n.slice();return i[27]=e[t],i}function $h(n){let e,t,i,l,s,o,r=n[8].length&&Ch();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(),r&&r.c(),p(t,"class","icon"),p(l,"class","content txt-bold"),p(e,"class","alert alert-warning")},m(a,u){y(a,e,u),w(e,t),w(e,i),w(e,l),w(l,s),w(l,o),r&&r.m(l,null)},p(a,u){a[8].length?r||(r=Ch(),r.c(),r.m(l,null)):r&&(r.d(1),r=null)},d(a){a&&v(e),r&&r.d()}}}function Ch(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 Oh(n){let e,t,i,l,s,o=n[3]&&Eh(n),r=!n[4]&&Mh(n),a=de(n[6]),u=[];for(let f=0;f<a.length;f+=1)u[f]=Ah(yh(n,a,f));return{c(){e=b("h6"),e.textContent="Changes:",t=C(),i=b("ul"),o&&o.c(),l=C(),r&&r.c(),s=C();for(let f=0;f<u.length;f+=1)u[f].c();p(i,"class","changes-list svelte-xqpcsf")},m(f,c){y(f,e,c),y(f,t,c),y(f,i,c),o&&o.m(i,null),w(i,l),r&&r.m(i,null),w(i,s);for(let d=0;d<u.length;d+=1)u[d]&&u[d].m(i,null)},p(f,c){if(f[3]?o?o.p(f,c):(o=Eh(f),o.c(),o.m(i,l)):o&&(o.d(1),o=null),f[4]?r&&(r.d(1),r=null):r?r.p(f,c):(r=Mh(f),r.c(),r.m(i,s)),c[0]&4160){a=de(f[6]);let d;for(d=0;d<a.length;d+=1){const m=yh(f,a,d);u[d]?u[d].p(m,c):(u[d]=Ah(m),u[d].c(),u[d].m(i,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},d(f){f&&(v(e),v(t),v(i)),o&&o.d(),r&&r.d(),dt(u,f)}}}function Eh(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=B(`Renamed collection
`),l=b("strong"),o=B(s),r=C(),a=b("i"),u=C(),f=b("strong"),d=B(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(_,e,g),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;g[0]&2&&s!==(s=((k=_[1])==null?void 0:k.name)+"")&&re(o,s),g[0]&4&&c!==(c=((S=_[2])==null?void 0:S.name)+"")&&re(d,c)},d(_){_&&v(e)}}}function Mh(n){let e,t,i,l=de(n[7]),s=[];for(let f=0;f<l.length;f+=1)s[f]=Dh(Th(n,l,f));let o=de(n[9]),r=[];for(let f=0;f<o.length;f+=1)r[f]=Ih(Sh(n,o,f));let a=de(n[8]),u=[];for(let f=0;f<a.length;f+=1)u[f]=Lh(wh(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=ve()},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[0]&128){l=de(f[7]);let d;for(d=0;d<l.length;d+=1){const m=Th(f,l,d);s[d]?s[d].p(m,c):(s[d]=Dh(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[0]&512){o=de(f[9]);let d;for(d=0;d<o.length;d+=1){const m=Sh(f,o,d);r[d]?r[d].p(m,c):(r[d]=Ih(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[0]&256){a=de(f[8]);let d;for(d=0;d<a.length;d+=1){const m=wh(f,a,d);u[d]?u[d].p(m,c):(u[d]=Lh(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)),dt(s,f),dt(r,f),dt(u,f)}}}function Dh(n){let e,t,i,l=n[27].name+"",s,o,r;return{c(){e=b("li"),t=B(`Multiple to single value conversion of field
`),i=b("strong"),s=B(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[0]&128&&l!==(l=a[27].name+"")&&re(s,l)},d(a){a&&v(e)}}}function Ih(n){let e,t,i,l,s=n[27]._originalName+"",o,r,a,u,f,c=n[27].name+"",d;return{c(){e=b("li"),t=b("div"),i=B(`Renamed field
`),l=b("strong"),o=B(s),r=C(),a=b("i"),u=C(),f=b("strong"),d=B(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[0]&512&&s!==(s=m[27]._originalName+"")&&re(o,s),h[0]&512&&c!==(c=m[27].name+"")&&re(d,c)},d(m){m&&v(e)}}}function Lh(n){let e,t,i,l=n[27].name+"",s,o;return{c(){e=b("li"),t=B("Removed field "),i=b("span"),s=B(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[0]&256&&l!==(l=r[27].name+"")&&re(s,l)},d(r){r&&v(e)}}}function Ah(n){let e,t,i,l=n[24].name+"",s,o,r,a,u=n[24].oldHost+"",f,c,d,m,h,_=n[24].newHost+"",g,k,S,$,T,O,M,L,I,P,A,N,R,z,F,U,J;return{c(){e=b("li"),t=B("Changed "),i=b("code"),s=B(l),o=B(` host
2024-11-01 20:05:42 +08:00
`),r=b("div"),a=b("strong"),f=B(u),c=C(),d=b("i"),m=C(),h=b("strong"),g=B(_),k=C(),S=b("br"),$=C(),T=b("em"),O=B(`If the old and new OIDC configuration is not for the same provider consider deleting
all old `),M=b("code"),M.textContent="_externalAuths",L=B(` records associated to the current
2024-10-15 14:03:48 +08:00
collection and provider, otherwise it may result in account linking errors.
`),I=b("a"),P=B("Review existing "),A=b("code"),A.textContent="_externalAuths",N=B(` records
`),R=b("i"),z=C(),U=B("."),J=C(),p(a,"class","txt-strikethrough txt-hint"),p(d,"class","ri-arrow-right-line txt-sm"),p(h,"class","txt"),p(r,"class","inline-flex m-l-5"),p(M,"class","txt-sm"),p(A,"class","txt-sm"),p(R,"class","ri-external-link-line txt-sm"),p(I,"href",F=n[12](n[24].name)),p(I,"target","_blank"),p(T,"class","txt-hint"),p(e,"class","svelte-xqpcsf")},m(K,Q){y(K,e,Q),w(e,t),w(e,i),w(i,s),w(e,o),w(e,r),w(r,a),w(a,f),w(r,c),w(r,d),w(r,m),w(r,h),w(h,g),w(e,k),w(e,S),w(e,$),w(e,T),w(T,O),w(T,M),w(T,L),w(T,I),w(I,P),w(I,A),w(I,N),w(I,R),w(I,z),w(T,U),w(e,J)},p(K,Q){Q[0]&64&&l!==(l=K[24].name+"")&&re(s,l),Q[0]&64&&u!==(u=K[24].oldHost+"")&&re(f,u),Q[0]&64&&_!==(_=K[24].newHost+"")&&re(g,_),Q[0]&64&&F!==(F=K[12](K[24].name))&&p(I,"href",F)},d(K){K&&v(e)}}}function MD(n){let e,t,i=(n[3]||n[8].length||n[9].length)&&$h(n),l=n[10]&&Oh(n);return{c(){i&&i.c(),e=C(),l&&l.c(),t=ve()},m(s,o){i&&i.m(s,o),y(s,e,o),l&&l.m(s,o),y(s,t,o)},p(s,o){s[3]||s[8].length||s[9].length?i?i.p(s,o):(i=$h(s),i.c(),i.m(e.parentNode,e)):i&&(i.d(1),i=null),s[10]?l?l.p(s,o):(l=Oh(s),l.c(),l.m(t.parentNode,t)):l&&(l.d(1),l=null)},d(s){s&&(v(e),v(t)),i&&i.d(s),l&&l.d(s)}}}function DD(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 ID(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=[W(e,"click",n[14]),W(i,"click",n[15])],l=!0)},p:te,d(o){o&&(v(e),v(t),v(i)),l=!1,Ie(s)}}}function LD(n){let e,t,i={class:"confirm-changes-panel",popup:!0,$$slots:{footer:[ID],header:[DD],default:[MD]},$$scope:{ctx:n}};return e=new Gt({props:i}),n[16](e),e.$on("hide",n[17]),e.$on("show",n[18]),{c(){j(e.$$.fragment)},m(l,s){q(e,l,s),t=!0},p(l,s){const o={};s[0]&2014|s[1]&8&&(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),H(e,l)}}}function AD(n,e,t){let i,l,s,o,r,a;const u=bt();let f,c,d,m,h=[];async function _(N,R,z=!0){t(1,c=N),t(2,d=R),m=z,await $(),await un(),i||s.length||o.length||r.length||h.length?f==null||f.show():k()}function g(){f==null||f.hide()}function k(){g(),u("confirm",m)}const S=["oidc","oidc2","oidc3"];async function $(){var N,R,z,F;t(6,h=[]);for(let U of S){let J=(R=(N=c==null?void 0:c.oauth2)==null?void 0:N.providers)==null?void 0:R.find(oe=>oe.name==U),K=(F=(z=d==null?void 0:d.oauth2)==null?void 0:z.providers)==null?void 0:F.find(oe=>oe.name==U);if(!J||!K)continue;let Q=new URL(J.authURL).host,X=new URL(K.authURL).host;Q!=X&&await T(U)&&h.push({name:U,oldHost:Q,newHost:X})}}async function T(N){try{return await me.collection("_externalAuths").getFirstListItem(me.filter("collectionRef={:collectionId} && provider={:provider}",{collectionId:d==null?void 0:d.id,provider:N})),!0}catch{}return!1}function O(N){return`#/collections?collection=_externalAuths&filter=collectionRef%3D%22${d==null?void 0:d.id}%22+%26%26+provider%3D%22${N}%22`}const M=()=>g(),L=()=>k();function I(N){ie[N?"unshift":"push"](()=>{f=N,t(5,f)})}function P(N){Ne.call(this,n,N)}function A(N){Ne.call(this,n,N)}return n.$$.update=()=>{var N,R,z;n.$$.dirty[0]&6&&t(3,i=(c==null?void 0:c.name)!=(d==null?void 0:d.name)),n.$$.dirty[0]&4&&t(4,l=(d==null?void 0:d.type)==="view"),n.$$.dirty[0]&4&&t(9,s=((N=d==null?void 0:d.fields)==null?void 0:N.filter(F=>F.id&&!F._toDelete&&F._originalName!=F.name))||[]),n.$$.dirty[0]&4&&t(8,o=((R=d==null?void 0:d.fields)==null?void 0:R.filter(F=>F.id&&F._toDelete))||[]),n.$$.dirty[0]&6&&t(7,r=((z=d==null?void 0:d.fields)==null?void 0:z.filter(F=>{var J;const U=(J=c==null?void 0:c.fields)==null?void 0:J.find(K=>K.id==F.id);return U?U.maxSelect!=1&&F.maxSelect==1:!1}))||[]),n.$$.dirty[0]&24&&t(10,a=!l||i)},[g,c,d,i,l,f,h,r,o,s,a,k,O,_,M,L,I,P,A]}class PD extends Se{constructor(e){super(),we(this,e,AD,LD,ge,{show:13,hide:
`+V.truncate(JSON.stringify(V.truncateObject(S_(n[0],"expand")),null,2),800,!0),class:"code",position:"left"})),W(l,"click",On(n[1])),W(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?collection="+c[0].collectionId+"&recordId="+c[0].id))&&p(l,"href",o),r&&It(r.update)&&d&1&&r.update.call(null,{text:`Open relation record in new tab:
`+V.truncate(JSON.stringify(V.truncateObject(S_(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),H(t),u=!1,Ie(f)}}}function S_(n,...e){const t=Object.assign({},n);for(let i of e)delete t[i];return t}function LI(n,e,t){let{record:i}=e;function l(o){Ne.call(this,n,o)}function s(o){Ne.call(this,n,o)}return n.$$set=o=>{"record"in o&&t(0,i=o.record)},[i,l,s]}class Ur extends Se{constructor(e){super(),we(this,e,LI,II,ge,{record:0})}}function T_(n,e,t){const i=n.slice();return i[19]=e[t],i[9]=t,i}function $_(n,e,t){const i=n.slice();return i[14]=e[t],i}function C_(n,e,t){const i=n.slice();return i[7]=e[t],i[9]=t,i}function O_(n,e,t){const i=n.slice();return i[7]=e[t],i[9]=t,i}function AI(n){const e=n.slice(),t=V.toArray(e[3]);e[17]=t;const i=e[2]?10:500;return e[18]=i,e}function PI(n){var s,o;const e=n.slice(),t=V.toArray(e[3]);e[10]=t;const i=V.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 NI(n){const e=n.slice(),t=V.trimQuotedValue(JSON.stringify(e[3]))||'""';return e[6]=t,e}function RI(n){let e,t;return{c(){e=b("div"),t=B(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&&re(t,i[3])},i:te,o:te,d(i){i&&v(e)}}}function FI(n){let e,t=V.truncate(n[3])+"",i,l;return{c(){e=b("span"),i=B(t),p(e,"class","txt txt-ellipsis"),p(e,"title",l=V.truncate(n[3]))},m(s,o){y(s,e,o),w(e,i)},p(s,o){o&8&&t!==(t=V.truncate(s[3])+"")&&re(i,t),o&8&&l!==(l=V.truncate(s[3]))&&p(e,"title",l)},i:te,o:te,d(s){s&&v(e)}}}function qI(n){let e,t=[],i=new Map,l,s,o=de(n[17].slice(0,n[18]));const r=u=>u[9]+u[19];for(let u=0;u<o.length;u+=1){let f=T_(n,o,u),c=r(f);i.set(c,t[u]=E_(c,f))}let a=n[17].length>n[18]&&M_();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"),x(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=de(u[17].slice(0,u[18])),ae(),t=yt(t,f,r,1,u,o,i,e,zt,E_,l,T_),ue()),u[17].length>u[18]?a||(a=M_(),a.c(),a.m(e,null)):a&&(a.d(1),a=null),(!s||f&2)&&x(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 HI(n){let e,t,i,l,s;const o=[GI,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]&&L_();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):(ae(),D(r[d],1,1,()=>{r[d]=null}),ue(),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=L_(),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 jI(n){let e,t=[],i=new Map,l=de(V.toArray(n[3]));const s=o=>o[9]+o[7];for(let o=0;o<l.length;o+=1){let r=O_(n,l,o),a=s(r);i.set(a,t[o]=A_(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=de(V.toArray(o[3])),t=yt(t,r,s,1,o,l,i,e,pi,A_,null,O_))},i:te,o:te,d(o){o&&v(e);for(let r=0;r<t.length;r+=1)t[r].d()}}}function zI(n){let e,t;return e=new sf({props:{date:n[3]}}),{c(){j(e.$$.fragment)},m(i,l){q(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){H(e,i)}}}function UI(n){let e,t,i,l;const s=[QI,XI],o=[];function r(a,u){return a[2]?0:1}return e=r(n),t=o[e]=s[e](n),{c(){t.c(),i=ve()},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):(ae(),D(o[f],1,1,()=>{o[f]=null}),ue(),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 VI(n){let e,t=V.truncate(n[3])+"",i,l,s;return{c(){e=b("a"),i=B(t),p(e,"cl
`),position:"left"})),i=!0)},p(s,[o]){t&&It(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 fL="yyyy-MM-dd HH:mm:ss.SSS";function cL(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+": "+V.formatToLocalDate(s[u.name],fL)+" 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 dL extends Se{constructor(e){super(),we(this,e,cL,uL,ge,{record:1})}}function j_(n,e,t){const i=n.slice();return i[9]=e[t],i}function pL(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 mL(n){let e,t=de(n[1]),i=[];for(let l=0;l<t.length;l+=1)i[l]=z_(j_(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=de(l[1]);let o;for(o=0;o<t.length;o+=1){const r=j_(l,t,o);i[o]?i[o].p(r,s):(i[o]=z_(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),dt(i,l)}}}function hL(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 z_(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=B(r),u=C(),f=b("div"),c=B("ID: "),m=B(d),h=C(),_=b("button"),_.innerHTML='<i class="ri-close-line"></i>',g=C(),kn(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(_,"type","button"),p(_,"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,_),w(e,g),k||(S=W(_,"click",$),k=!0)},p(T,O){var M;n=T,O&2&&!kn(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)+"")&&re(a,r),O&2&&d!==(d=n[9].providerId+"")&&re(m,d)},d(T){T&&v(e),k=!1,S()}}}function _L(n){let e;function t(s,o){var r;return s[2]?hL:(r=s[0])!=null&&r.id&&s[1].length?mL:pL}let i=t(n),l=i(n);return{c(){l.c(),e=ve()},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 gL(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)||V.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 bL extends Se{constructor(e){super(),we(this,e,gL,_L,ge,{record:0})}}function kL(n){let e,t,i,l,s,o,r,a,u,f;return s=new ci({props:{value:n[1]}}),{c(){e=b("div"),t=b("span"),i=B(n[1]),l=C(),j(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),q(s,e,null),w(e,o),w(e,r),a=!0,u||(f=[Ee(He.call(null,r,"Refresh")),W(r,"click",n[4])],u=!0)},p(c,d){(!a||d&2)&&re(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+")")),W(e,"click",tt(function(){It(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&&It(l.update)&&c[0]&32&&l.update.call(null,n[48]+`
(record: `+n[44].id+")"),c[0]&589856&&x(e,"thumb-warning",n[16](n[44],n[48]))},d(f){f&&v(e),u.d(),s=!1,Ie(o)}}}function tg(n,e){let t,i,l=de(e[45]),s=[];for(let o=0;o<l.length;o+=1)s[o]=eg(G_(e,l,o));return{key:n,first:null,c(){t=ve();for(let o=0;o<s.length;o+=1)s[o].c();i=ve(),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=de(e[45]);let a;for(a=0;a<l.length;a+=1){const u=G_(e,l,a);s[a]?s[a].p(u,r):(s[a]=eg(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)),dt(s,o)}}}function ng(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 YL;if(!r[6])return WL}let l=i(n),s=l&&l(n),o=n[6]&&ng();return{c(){s&&s.c(),e=C(),o&&o.c(),t=ve()},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=ng(),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 GL(n){let e,t,i,l;const s=[BL,VL],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=ve()},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):(ae(),D(o[f],1,1,()=>{o[f]=null}),ue(),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 XL(n){let e,t;return{c(){e=b("h4"),t=B(n[0])},m(i,l){y(i,e,l),w(e,t)},p(i,l){l[0]&1&&re(t,i[0])},d(i){i&&v(e)}}}function ig(n){let e,t;return e=new fe({props:{class:"form-field file-picker-size-select",$$slots:{default:[QL,({uniqueId:i})=>({23:i}),({uniqueId:i})=>[i?8388608:0]]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,l){q(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){H(e,i)}}}function QL(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 Wn({props:s}),ie.push(()=>ke(e,"keyOfSelected",l)),{c(){j(e.$$.fragment)},m(o,r){q(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],Te(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){D(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function xL(n){var h;let e,t,i,l=V.hasImageExtension((h=n[9])==null?void 0:h.name),s,o,r,a,u,f,c,d,m=l&&ig(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=B(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(_,e,g),w(e,t),y(_,i,g),m&&m.m(_,g),y(_,s,g),y(_,o,g),w(o,r),w(r,a),f=!0,c||(d=[W(e,"click",n[2]),W(o,"click",n[21])],c=!0)},p(_,g){var k;(!f||g[0]&64)&&(e.disabled=_[6]),g[0]&512&&(l=V.hasImageExtension((k=_[9])==null?void 0:k.name)),l?m?(m.p(_,g),g[0]&512&&E(m,1)):(m=ig(_),m.c(),E(m,1),m.m(s.parentNode,s)):m&&(ae(),D(m,1,1,()=>{m=null}),ue()),(!f||g[0]&2)&&re(a,_[1]),(!f||g[0]&8192&&u!==(u=!_[13]))&&(o.disabled=u)},i(_){f||(E(m),f=!0)},o(_){D(m),f=!1},d(_){_&&(v(e),v(i),v(s),v(o)),m&&m.d(_),c=!1,Ie(d)}}}function eA(n){let e,t,i,l;const s=[{popup:!0},{class:"file-picker-popup"},n[22]];let o={$$slots:{footer:[xL],header:[XL],default:[GL]},$$scope:{ctx:n}};for(let a=0;a<s.length;a+=1)o=ze(o,s[a]);e=new Gt({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(){j(e.$$.fragment),t=C(),j(i.$$.fragment)},m(a,u){q(e,a,u),y(a,t,u),q(i,a,u),l=!0},p(a,u){const f=u[0]&4194304?wt(s,[s[0],s[1],Rt(a[22])]):{};u[0]&131059|u[1]&8388608&&(f.$$scope={dirty:u,ctx:a}),e.$
2024-10-15 14:03:48 +08:00
form-field form-field-list form-field-file
`+(n[4].required?"required":"")+`
`+(n[9]?"dragover":"")+`
`,name:n[4].name,$$slots:{default:[wA,({uniqueId:o})=>({28:o}),({uniqueId:o})=>[o?268435456:0]]},$$scope:{ctx:n}}}),{c(){e=b("div"),j(t.$$.fragment),p(e,"class","block")},m(o,r){y(o,e,r),q(t,e,null),i=!0,l||(s=[W(e,"dragover",tt(n[25])),W(e,"dragleave",n[26]),W(e,"drop",n[15])],l=!0)},p(o,r){const a={};r[0]&528&&(a.class=`
2024-10-15 14:03:48 +08:00
form-field form-field-list form-field-file
`+(o[4].required?"required":"")+`
`+(o[9]?"dragover":"")+`
2024-11-05 01:08:21 +08:00
`),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),H(t),l=!1,Ie(s)}}}function TA(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 _(U){V.removeByValue(f,U),t(2,f)}function g(U){V.pushUnique(f,U),t(2,f)}function k(U){V.isEmpty(u[U])||u.splice(U,1),t(1,u)}function S(){d==null||d.dispatchEvent(new CustomEvent("change",{detail:{value:a,uploadedFiles:u,deletedFileNames:f},bubbles:!0}))}function $(U){var K;U.preventDefault(),t(9,m=!1);const J=((K=U.dataTransfer)==null?void 0:K.files)||[];if(!(s||!J.length)){for(const Q of J){const X=l.length+u.length-f.length;if(r.maxSelect<=X)break;u.push(Q)}t(1,u)}}Zt(async()=>{t(10,h=await me.getSuperuserFileToken(o.collectionId))});const T=U=>_(U),O=U=>g(U);function M(U){a=U,t(0,a),t(6,i),t(4,r)}const L=U=>k(U);function I(U){u=U,t(1,u)}function P(U){ie[U?"unshift":"push"](()=>{c=U,t(7,c)})}const A=()=>{for(let U of c.files)u.push(U);t(1,u),t(7,c.value=null,c)},N=()=>c==null?void 0:c.click();function R(U){ie[U?"unshift":"push"](()=>{d=U,t(8,d)})}const z=()=>{t(9,m=!0)},F=()=>{t(9,m=!1)};return n.$$set=U=>{"record"in U&&t(3,o=U.record),"field"in U&&t(4,r=U.field),"value"in U&&t(0,a=U.value),"uploadedFiles"in U&&t(1,u=U.uploadedFiles),"deletedFileNames"in U&&t(2,f=U.deletedFileNames)},n.$$.update=()=>{n.$$.dirty[0]&2&&(Array.isArray(u)||t(1,u=V.toArray(u))),n.$$.dirty[0]&4&&(Array.isArray(f)||t(2,f=V.toArray(f))),n.$$.dirty[0]&16&&t(6,i=r.maxSelect>1),n.$$.dirty[0]&65&&V.isEmpty(a)&&t(0,a=i?[]:""),n.$$.dirty[0]&1&&t(5,l=V.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,P,A,N,R,z,F]}class $A extends Se{constructor(e){super(),we(this,e,TA,SA,ge,{record:3,field:4,value:0,uploadedFiles:1,deletedFileNames:2},null,[-1,-1])}}function CA(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 OA(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 EA(n){let e,t,i,l;function s(a,u){return a[4]?OA:CA}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=Ee(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&&It(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 MA(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 DA(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&&j(e.$$.fragment),t=ve()},m(o,r){e&&q(e,o,r),y(o,t,r),i=!0},p(o,r){if(r&8&&l!==(l=o[3])){if(e){ae();const a=e;D(a.$$.fragment,1,0,()=>{H(a,1)}),ue()}l?(e=jt(l,s(o)),e.$on("change",o[5]),j(e.$$.fragment),E(e.$$.fragment,1),q(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&&H(e,o)}}}function IA(n){let e,t,i,l,s,o;e=new ii({props:{uniqueId:n[6],field:n[1],$$slots:{default:[EA]},$$scope:{ctx:n}}});const r=[DA,MA],a=[];function u(f,c){return f[3]?0:1}return i=u(n),l=a[i]=r[i](n),{c(){j(e.$$.fragment),t=C(),l.c(),s=ve()},m(f,c){q(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):(ae(),D(a[m],1,1,()=>{a[m]=null}),ue(),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),o
`),P&&P.c(),m=C(),_.c(),g=ve(),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(z,F){y(z,e,F),q(t,e,null),w(e,i),T&&T.m(e,null),y(z,l,F),y(z,s,F);for(let U=0;U<o.length;U+=1)o[U]&&o[U].m(s,null);L&&L.m(s,null),w(s,a),I&&I.m(s,null),y(z,f,F),y(z,c,F),w(c,d),P&&P.m(c,null),y(z,m,F),N[h].m(z,F),y(z,g,F),k=!0,S||($=Ee(u=VA.call(null,s,n[36])),S=!0)},p(z,F){const U={};F[0]&4&&(U.value=z[2]),F[0]&32&&(U.autocompleteCollection=z[5]),t.$set(U),z[11]?T&&(T.d(1),T=null):T?T.p(z,F):(T=pg(z),T.c(),T.m(e,null)),F[0]&143252&&(O=de(z[8]),ae(),o=yt(o,F,M,1,z,O,r,s,zt,bg,a,dg),ue(),!O.length&&L?L.p(z,F):O.length?L&&(L.d(1),L=null):(L=mg(z),L.c(),L.m(s,a))),z[13]?I||(I=kg(),I.c(),I.m(s,null)):I&&(I.d(1),I=null),u&&It(u.update)&&F[0]&4104&&u.update.call(null,z[36]),z[4]>1?P?P.p(z,F):(P=vg(z),P.c(),P.m(c,null)):P&&(P.d(1),P=null);let J=h;h=R(z),h===J?N[h].p(z,F):(ae(),D(N[J],1,1,()=>{N[J]=null}),ue(),_=N[h],_?_.p(z,F):(_=N[h]=A[h](z),_.c()),E(_,1),_.m(g.parentNode,g))},i(z){if(!k){E(t.$$.fragment,z);for(let F=0;F<O.length;F+=1)E(o[F]);E(_),k=!0}},o(z){D(t.$$.fragment,z);for(let F=0;F<o.length;F+=1)D(o[F]);D(_),k=!1},d(z){z&&(v(e),v(l),v(s),v(f),v(c),v(m),v(g)),H(t),T&&T.d();for(let F=0;F<o.length;F+=1)o[F].d();L&&L.d(),I&&I.d(),P&&P.d(),N[h].d(z),S=!1,$()}}}function GA(n){var r;let e,t,i,l=(((r=n[5])==null?void 0:r.name)||"")+"",s,o;return{c(){e=b("h4"),t=B("Select "),i=b("strong"),s=B(l),o=B(" 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)||"")+"")&&re(s,l)},d(a){a&&v(e)}}}function XA(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=[W(e,"click",n[28]),W(i,"click",n[29])],l=!0)},p:te,d(o){o&&(v(e),v(t),v(i)),l=!1,Ie(s)}}}function QA(n){let e,t,i,l;const s=[{popup:!0},{class:"overlay-panel-xl"},n[19]];let o={$$slots:{footer:[XA],header:[GA],default:[ZA]},$$scope:{ctx:n}};for(let a=0;a<s.length;a+=1)o=ze(o,s[a]);e=new Gt({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(){j(e.$$.fragment),t=C(),j(i.$$.fragment)},m(a,u){q(e,a,u),y(a,t,u),q(i,a,u),l=!0},p(a,u){const f=u[0]&524288?wt(s,[s[0],s[1],Rt(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),H(e,a),n[42](null),H(i,a)}}}const Xo=50;function xA(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,Ce=>t(26,m=Ce));const h=bt(),_="picker_"+V.randomString(5);let{value:g}=e,{field:k}=e,S,$,T="",O=[],M=[],L=1,I=0,P=!1,A=!1;function N(){return t(2,T=""),t(8,O=[]),t(6,M=[]),F(),U(!0),S==null?void 0:S.show()}function R(){return S==null?void 0:S.hide()}function z(){var qt;let Ce="";const ut=(qt=s==null?void 0:s.fields)==null?void 0:qt.filter(Le=>!Le.hidden&&Le.presentable&&Le.type=="relation");for(const Le of ut){const rt=V.getExpandPresentableRelField(Le,m,2);rt&&(Ce!=""&&(Ce+=","),Ce+=rt)}return Ce}async function F(){const Ce=V.toArray(g);if(!l||!Ce.length)return;t(24,A=!0);let ut=[];const qt=Ce.slice(),Le=[];for(;qt.length>0;){const rt=[];for(const on of qt.splice(0,Xo))rt.push(`id="${on}"`);Le.push(me.collection(l).getFullList({batch:Xo,filter:rt.join("||"),fields:"*:excerpt(200)",expand:z(),requestKey:null}))}try{await Promise.all(Le).then(rt=>{ut=ut.concat(...rt)}),t(6,M=[]);for(const rt of Ce){const on=V.findByKey(ut,"id",rt);on&&M.push(on)}T.trim()||t(8,O=V.filterDuplicatesByKey(M.concat(O))),t(24,A=!1)}catch(rt){rt.isAbort||(me.error(rt),t(24,A=!1))}}async function U(Ce=!1){if(l){t(3,P=!0),Ce&&(T.trim()?t(8,O=[]):t(8,O=V.toArray(M).slice()
`),s=b("strong"),r=B(o),a=B(":"),u=C(),j(f.$$.fragment),p(t,"class","content"),p(e,"id",n[8])},m(h,_){y(h,e,_),w(e,t),w(t,i),w(i,l),w(i,s),w(s,r),w(s,a),w(e,u),q(f,e,null),c=!0,d||(m=W(e,"submit",tt(n[9])),d=!0)},p(h,_){(!c||_&2)&&o!==(o=V.displayValue(h[1])+"")&&re(r,o);const g={};_&3145761&&(g.$$scope={dirty:_,ctx:h}),f.$set(g)},i(h){c||(E(f.$$.fragment,h),c=!0)},o(h){D(f.$$.fragment,h),c=!1},d(h){h&&v(e),H(f),d=!1,m()}}}function CP(n){let e,t,i,l=n[3].authStore.token+"",s,o,r,a,u,f;return r=new ci({props:{value:n[3].authStore.token}}),u=new TP({props:{class:"m-b-0",js:`
2024-10-15 14:03:48 +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);
2024-11-01 20:05:42 +08:00
`}}),{c(){e=b("div"),t=b("div"),i=b("span"),s=B(l),o=C(),j(r.$$.fragment),a=C(),j(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),q(r,t,null),y(c,a,d),q(u,c,d),f=!0},p(c,d){(!f||d&8)&&l!==(l=c[3].authStore.token+"")&&re(s,l);const m={};d&8&&(m.value=c[3].authStore.token),r.$set(m);const h={};d&128&&(h.js=`
2024-10-15 14:03:48 +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)),H(r),H(u,c)}}}function OP(n){let e,t,i,l,s,o,r,a,u,f;return{c(){var c,d;e=b("label"),t=B("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=W(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 EP(n){let e,t,i,l,s,o;const r=[CP,$P],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=ve(),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):(ae(),D(a[d],1,1,()=>{a[d]=null}),ue(),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 MP(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 DP(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],x(e,"btn-loading",n[6])},m(s,o){y(s,e,o),w(e,t),i||(l=W(e,"click",n[13]),i=!0)},p(s,o){o&64&&(e.disabled=s[6]),o&64&&x(e,"btn-loading",s[6])},d(s){s&&v(e),i=!1,l()}}}function IP(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=W(e,"click",n[12]),i=!0)},p(s,o){o&64&&(e.disabled=s[6])},d(s){s&&v(e),i=!1,l()}}}function LP(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?IP:DP}let a=r(n),u=a(n);return{c(){e=b("button"),t=b("span"),t.textContent="Close",i=C(),u.c(),l=ve(),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=W(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 AP(n){let e,t,i={overlayClose:!1,escClose:!n[6],beforeHide:n[15],popup:!0,$$slots:{footer:[LP],header:[MP],default:[EP]},$$scope:{ctx:n}};return e=new Gt({props:i}),n[16](e),e.$on("show",n[17]),e.$on("hide",n[18]),{c(){j(e.$$.fragment)},m(l,s){q(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),H(e,l)}}}function PP(n,e,t){let i;const l=bt(),s="impersonate_"+V.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(),_()}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 _(){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){Ne.call(this,n,L)}function M(L){Ne.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=V.getApiExampleUrl(c==null?void 0:c.baseURL))},[o,r,m,c,a,u,f,i,s,h,_,d,g,k,S,$,T,O,M]}class NP extends Se{constructor(e){super(),we(this,e,PP,AP,ge,{collectio
`),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(g,k){y(g,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||(_=[W(r,"click",n[46]),Ee(He.call(null,u,"Discard draft")),W(u,"click",tt(n[47]))],h=!0)},p:te,i(g){m||(d&&d.end(1),m=!0)},o(g){g&&(d=mu(e,mt,{duration:150})),m=!1},d(g){g&&v(e),g&&d&&d.end(),h=!1,Ie(_)}}}function qg(n){let e,t,i;return t=new dL({props:{record:n[3]}}),{c(){e=b("div"),j(t.$$.fragment),p(e,"class","form-field-addon")},m(l,s){y(l,e,s),q(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),H(t)}}}function RP(n){let e,t,i,l,s,o,r,a,u,f,c,d,m,h,_,g,k,S=!n[6]&&qg(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(V.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]&&!V.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),_=!0,g||(k=W(f,"input",n[48]),g=!0)},p($,T){var O,M;(!_||T[2]&8388608&&r!==(r=$[85]))&&p(e,"for",r),$[6]?S&&(ae(),D(S,1,1,()=>{S=null}),ue()):S?(S.p($,T),T[0]&64&&E(S,1)):(S=qg($),S.c(),E(S,1),S.m(u.parentNode,u)),(!_||T[2]&8388608&&c!==(c=$[85]))&&p(f,"id",c),(!_||T[0]&524416&&d!==(d=!$[7]&&!V.isEmpty((O=$[19])==null?void 0:O.autogeneratePattern)?"Leave empty to auto generate...":""))&&p(f,"placeholder",d),(!_||T[0]&524288&&m!==(m=(M=$[19])==null?void 0:M.min))&&p(f,"minlength",m),(!_||T[0]&64&&h!==(h=!$[6]))&&(f.readOnly=h),T[0]&8&&f.value!==$[3].id&&ce(f,$[3].id)},i($){_||(E(S),_=!0)},o($){D(S),_=!1},d($){$&&(v(e),v(a),v(u),v(f)),S&&S.d($),g=!1,k()}}}function Hg(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 DL({props:r}),ie.push(()=>ke(e,"record",o));let a=n[16].length&&jg();return{c(){j(e.$$.fragment),i=C(),a&&a.c(),l=ve()},m(u,f){q(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],Te(()=>t=!1)),e.$set(c),u[16].length?a||(a=jg(),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)),H(e,u),a&&a.d(u)}}}function jg(n){let e;return{c(){e=b("hr")},m(t,i){y(t,e,i)},d(t){t&&v(e)}}}function FP(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 UA({props:s}),ie.push(()=>ke(e,"value",l)),{c(){j(e.$$.fragment)},m(o,r){q(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],Te(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){D(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function qP(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 oP({props:s}),ie.push(()=>ke(e,"value",l)),{c(){j(e.$$.fragment)},m(o,r){q(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],Te(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){D(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function HP(n){let e,t,i,l,s;function o(f){n[59](f,n[82]
2024-10-15 14:03:48 +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:[tN],header:[xP],default:[ZP]},$$scope:{ctx:n}};e=new Gt({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 NP({props:o}),n[68](i),{c(){j(e.$$.fragment),t=C(),j(i.$$.fragment)},m(r,a){q(e,r,a),y(r,t,a),q(i,r,a),l=!0},p(r,a){const u={};a[0]&1180224&&(u.class=`
2024-10-15 14:03:48 +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),H(e,r),n[68](null),H(i,r)}}}const Ml="form",lo="providers";function iN(n,e,t){let i,l,s,o,r,a,u,f;const c=bt(),d="record_"+V.randomString(5);let{collection:m}=e,h,_,g={},k={},S=null,$=!1,T=!1,O={},M={},L=JSON.stringify(g),I=L,P=Ml,A=!0,N=!0,R=m,z=[];const F=["id"],U=F.concat("email","emailVisibility","verified","tokenKey","password");function J(le){return be(le),t(14,T=!0),t(15,P=Ml),h==null?void 0:h.show()}function K(){return h==null?void 0:h.hide()}function Q(){t(14,T=!1),K()}function X(){t(34,R=m),h!=null&&h.isActive()&&(nt(JSON.stringify(k)),Q())}async function oe(le){if(le&&typeof le=="string"){try{return await me.collection(m.id).getOne(le)}catch(Oe){Oe.isAbort||(Q(),console.warn("resolveModel:",Oe),Ci(`Unable to load record with id "${le}"`))}return null}return le}async function be(le){t(7,N=!0),Yt({}),t(4,O={}),t(5,M={}),t(2,g=typeof le=="string"?{id:le,collectionId:m==null?void 0:m.id,collectionName:m==null?void 0:m.name}:le||{}),t(3,k=structuredClone(g)),t(2,g=await oe(le)||{}),t(3,k=structuredClone(g)),await un(),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 he(le){var Fe,Je;Yt({}),t(2,g=le||{}),t(4,O={}),t(5,M={});const Oe=((Je=(Fe=m==null?void 0:m.fields)==null?void 0:Fe.filter(Pe=>Pe.type!="file"))==null?void 0:Je.map(Pe=>Pe.name))||[];for(let Pe in le)Oe.includes(Pe)||t(3,k[Pe]=le[Pe],k);await un(),t(32,L=JSON.stringify(k)),xe()}function $e(){return"record_draft_"+((m==null?void 0:m.id)||"")+"_"+((g==null?void 0:g.id)||"")}function We(le){try{const Oe=window.localStorage.getItem($e());if(Oe)return JSON.parse(Oe)}catch{}return le}function nt(le){try{window.localStorage.setItem($e(),le)}catch(Oe){console.warn("updateDraft failure:",Oe),window.localStorage.removeItem($e())}}function st(){S&&(t(3,k=S),t(12,S=null))}function Be(le,Oe){var ft;const Fe=structuredClone(le||{}),Je=structuredClone(Oe||{}),Pe=(ft=m==null?void 0:m.fields)==null?void 0:ft.filter(Xt=>Xt.type==="file");for(let Xt of Pe)delete Fe[Xt.name],delete Je[Xt.name];const Ge=["expand","password","passwordConfirm"];for(let Xt of Ge)delete Fe[Xt],delete Je[Xt];return JSON.stringify(Fe)==JSON.stringify(Je)}function xe(){t(12,S=null),window.localStorage.removeItem($e())}async function Ze(le=!0){var Oe;if(!($||!u||!(m!=null&&m.id))){t(13,$=!0);try{const Fe=Ht();let Je;if(A?Je=await me.collection(m.id).create(Fe):Je=await me.collection(m.id).update(k.id,Fe),tn(A?"Successfully created record.":"Successfully updated record."),xe(),l&&(k==null?void 0:k.id)==((Oe=me.authStore.record)==null?void 0:Oe.id)&&Fe.get("password"))return me.logout();le?Q():he(Je),c("save",{isNew:A,record:Je})}catch(Fe){me.error(Fe)}t(13,$=!1)}}function at(){g!=null&&g.id&&pn("Do you really want to delete the selected record?",()=>me.collection(g.collectionId).delete(g.id).then(()=>{Q(),tn("Successfully deleted record."),c("delete",g)}).catch(le=>{me.error(le)}))}function Ht(){const le=structuredClone(k||{}),Oe=new FormData,Fe={},Je={};for(const Pe of(m==null?void 0:m.fields)||[])Pe.type=="autodate"||i&&Pe.type=="password"||(Fe[Pe.name]=!0,Pe.type=="json"&&(Je[Pe.name]=!0));i&&le.password&&(Fe.password=!0),i&&le.passwordConfirm&&(Fe.passwordConfirm=!0);for(const Pe in le)if(Fe[Pe]){if(typeof le[Pe]>"u"&&(le[Pe]=null),Je[Pe]&&le[Pe]!=="")try{JSON.parse(le[Pe])}catch(Ge){const ft={};throw ft[Pe]={code:"invalid_json",message:Ge.toString()},new Fn({status:400,response:{data:ft}})}V.addValueToFormData(Oe,Pe,le[Pe])}for(const Pe in O){const Ge=V.toArray(O[Pe]);for(const ft of Ge)Oe.append(Pe+"+",ft)}for(const Pe in M){const Ge=V.toArray(M[Pe]);for(const ft of Ge)Oe.append(Pe+"-",ft)}return Oe}function Ve(){!(m
`);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"),x(u,"hidden",V.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),q(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=W(u,"click",n[12]),_=!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,Te(()=>o=!1)),s.$set(L),(!h||M&1)&&x(u,"hidden",V.isEmpty(O[0].trustedProxy.headers)),M&68){$=de(O[2]);let I;for(I=0;I<$.length;I+=1){const P=m1(O,$,I);T[I]?T[I].p(P,M):(T[I]=h1(P),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)),H(s,O),dt(T,O),_=!1,g()}}}function XN(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 Wn({props:m}),ie.push(()=>ke(r,"keyOfSelected",d)),{c(){e=b("label"),t=b("span"),t.textContent="IP priority selection",i=C(),l=b("i"),o=C(),j(r.$$.fragment),p(t,"class","txt"),p(l,"class","ri-information-line link-hint"),p(e,"for",s=n[16])},m(h,_){y(h,e,_),w(e,t),w(e,i),w(e,l),y(h,o,_),q(r,h,_),u=!0,f||(c=Ee(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,_){(!u||_&65536&&s!==(s=h[16]))&&p(e,"for",s);const g={};!a&&_&1&&(a=!0,g.keyOfSelected=h[0].trustedProxy.useLeftmostIP,Te(()=>a=!1)),r.$set(g)},i(h){u||(E(r.$$.fragment,h),u=!0)},o(h){D(r.$$.fragment,h),u=!1},d(h){h&&(v(e),v(o)),H(r,h),f=!1,c()}}}function QN(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,P,A,N,R,z,F,U;return P=new fe({props:{class:"form-field m-b-0",name:"trustedProxy.headers",$$slots:{default:[GN,({uniqueId:J})=>({16:J}),({uniqueId:J})=>J?65536:0]},$$scope:{ctx:n}}}),R=new fe({props:{class:"form-field m-0",name:"trustedProxy.useLeftmostIP",$$slots:{default:[XN,({uniqueId:J})=>({16:J}),({uniqueId:J})=>J?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=B(r),u=C(),f=b("i"),c=C(),d=b("br"),m=C(),h=b("div"),_=b("span"),_.textContent="Detected proxy header:",g=C(),k=b("strong"),$=B(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-10-15 14:03:48 +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"),j(P.$$.fragment),A=C(),N=b("div"),j(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(J,K){y(J,e,K),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,_),w(h,g),w(h,k),w(k,$),y(J,T,K),y(J,O,K),y(J,M,K),y(J,L,K),w(L,I),q(P,I,null),w(L,A),w(L,N),q(R,N,null),z=!0,F||(U=Ee(He.call(null,f,`Must show your actual IP.
If not, set the correct proxy header.`)),F=!0)},p(J,K){(!z||K&2)&&r!==(r=(J[1].realIP||"N/A")+"")&&re(a,r),(!z||K&2)&&S!==(S=(J[1].possibleProxyHeader||"N/A")+"")&&re($,S);const Q={};K&1114117&&(Q.$$scope={dirty:K,ctx:J}),P.$set(Q);const X={};K&1114113&&(X.$$scope={dirty:K,ctx:J}),R.$set(X)},i(J){z||(E(P.$$.fragment,J),E(R.$$.fragment,J),z=!0)},o(J){D(P.$$.fragment,J),D(R.$$.fragment,J),z=!1},d(J){J&&(v(e),v(T),v(O),v(M),v(L)),H(P),H(R),F=!1,U()}}}function xN(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=Ee(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 e7(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=Ee(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 t7(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 n7(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 _1(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=Ee(He.call(null,e,{text:"Has errors",position:"left"})),l=!0)},i(o){i||(o&&et(()=>{i&&(t||(t=je(e,Tt,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=je(e,Tt,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&v(e),o&&t&&t.end(),l=!1,s()}}}function i7(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 e7;if(o==null&&(o=!!($[3]&&!$[5]&&!$[0].trustedProxy.headers.includes($[1].possibleProxyHeader))),o)return xN}let m=d(n,-1),h=m&&m(n);function _($,T){return $[3]?n7:t7}let g=_(n),k=g(n),S=n[4]&&_1();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=ve(),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!==(g=_($))&&(k.d(1),k=g($),k&&(k.c(),k.m(f.parentNode,f))),$[4]?S?T&16&&E(S,1):(S=_1(),S.c(),E(S,1),S.m(c.parentNode,c)):S&&(ae(),D(S,1,1,()=>{S=null}),ue())},d($){$&&(v(e),v(r),v(a),v(u),v(f),v(c)),h&&h.d(),k.d($),S&&S.d($)}}}function l7(n){let e,t;return e=new ji({props:{single:!0,$$slots:{header:[i7],default:[QN]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,l){q(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){H(e,i)}}}function s7(n,e,t){let i,l,s,o,r,a;Qe(n,yn,$=>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 _($){n.$$.not_equal(f.trustedProxy.headers,$)&&(f.trustedProxy.headers=$,t(0,f))}const g=()=>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=!V.isEmpty(a==null?void 0:a.trustedProxy)),n.$$.dirty&1&&t(3,o=!V.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 o7 extends Se{constructor(e){super(),we(this,e,s7,l7,ge,{formSettings:0,healthData:1})}}function g1(n,e,t){const i=n.slice();return i[5]=e[t],i}function b1(n){let e,t=(n[5].label||"")+"",i,l;return{c(){e=b("option"),i=B(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||"")+"")&&re(i,t),o&2&&l!==(l=s[5].value)&&(e.__value=l,ce(e,e.__value))},d(s){s&&v(e)}}}function r7(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=de(n[1]),f=[];for(let c=0;c<u.length;c+=1)f[c]=b1(g1(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();ei(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=W(e,"input",n[4]),s=!0)},p(c,[d]){if(ei(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=de(c[1]);
2024-11-01 20:05:42 +08:00
<strong>must be without trailing slash </strong>; &quot;METHOD&quot; is optional).
<br/> For example:
<ul class="m-0"><li class="m-0"><code>/hello</code> - matches <code>GET /hello</code>, <code>POST /hello</code>, etc.</li> <li class="m-0"><code>POST /hello</code> - matches only <code>POST /hello</code></li></ul>`,s=C(),o=b("li"),o.innerHTML=`<code>[METHOD ]/my/prefix<strong>/</strong></code> - path prefix (
<strong>must end with trailing slash;</strong>
&quot;METHOD&quot; is optional). For example:
<ul class="m-0"><li class="m-0"><code>/hello/</code> - matches <code>GET /hello</code>,
<code>POST /hello/a/b/c</code>, etc.</li> <li class="m-0"><code>POST /hello/</code> - matches <code>POST /hello</code>,
<code>POST /hello/a/b/c</code>, etc.</li></ul>`,r=C(),a=b("li"),u=b("code"),u.textContent="collectionName:predefinedTag",f=B(` - targets a specific action of a single collection. To
apply the rule for all collections you can use the `),c=b("code"),c.textContent="*",d=B(` wildcard. For example:
`),m=b("code"),m.textContent="posts:create",h=B(", "),_=b("code"),_.textContent="users:listAuthMethods",g=B(", "),k=b("code"),k.textContent="*:auth",S=B(`.
`),$=b("br"),T=B(`
The predifined collection tags are (`),O=b("em"),O.textContent="there should be autocomplete once you start typing",M=B(`):
`),L=b("ul");for(let A=0;A<P.length;A+=1)P[A].c();p(l,"class","m-b-sm"),p(o,"class","m-b-sm")},m(A,N){y(A,e,N),y(A,t,N),y(A,i,N),w(i,l),w(i,s),w(i,o),w(i,r),w(i,a),w(a,u),w(a,f),w(a,c),w(a,d),w(a,m),w(a,h),w(a,_),w(a,g),w(a,k),w(a,S),w(a,$),w(a,T),w(a,O),w(a,M),w(a,L);for(let R=0;R<P.length;R+=1)P[R]&&P[R].m(L,null)},p(A,N){if(N&32){I=de(A[5]);let R;for(R=0;R<I.length;R+=1){const z=k1(A,I,R);P[R]?P[R].p(z,N):(P[R]=T1(z),P[R].c(),P[R].m(L,null))}for(;R<P.length;R+=1)P[R].d(1);P.length=I.length}},d(A){A&&(v(e),v(t),v(i)),dt(P,A)}}}function v7(n){let e;return{c(){e=b("h4"),e.textContent="Rate limit label format",p(e,"class","center txt-break")},m(t,i){y(t,e,i)},p:te,d(t){t&&v(e)}}}function y7(n){let e,t,i;return{c(){e=b("button"),e.textContent="Close",p(e,"type","button"),p(e,"class","btn btn-transparent")},m(l,s){y(l,e,s),t||(i=W(e,"click",n[15]),t=!0)},p:te,d(l){l&&v(e),t=!1,i()}}}function w7(n){let e,t,i,l;e=new ji({props:{single:!0,$$slots:{header:[g7],default:[m7]},$$scope:{ctx:n}}});let s={$$slots:{footer:[y7],header:[v7],default:[k7]},$$scope:{ctx:n}};return i=new Gt({props:s}),n[16](i),{c(){j(e.$$.fragment),t=C(),j(i.$$.fragment)},m(o,r){q(e,o,r),y(o,t,r),q(i,o,r),l=!0},p(o,[r]){const a={};r&67108895&&(a.$$scope={dirty:r,ctx:o}),e.$set(a);const u={};r&67108872&&(u.$$scope={dirty:r,ctx:o}),i.$set(u)},i(o){l||(E(e.$$.fragment,o),E(i.$$.fragment,o),l=!0)},o(o){D(e.$$.fragment,o),D(i.$$.fragment,o),l=!1},d(o){o&&v(t),H(e,o),n[16](null),H(i,o)}}}function S7(n,e,t){let i,l,s;Qe(n,En,M=>t(17,l=M)),Qe(n,yn,M=>t(1,s=M));let{formSettings:o}=e;const r=[{value:"*:list"},{value:"*:view"},{value:"*:create"},{value:"*:update"},{value:"*:delete"},{value:"*:file",description:"targets the files download endpoint"},{value:"*:listAuthMethods"},{value:"*:authRefresh"},{value:"*:auth",description:"targets all auth methods"},{value:"*:authWithPassword"},{value:"*:authWithOAuth2"},{value:"*:authWithOTP"},{value:"*:requestOTP"},{value:"*:requestPasswordReset"},{value:"*:confirmPasswordReset"},{value:"*:requestVerification"},{value:"*:confirmVerification"},{value:"*:requestEmailChange"},{value:"*:confirmEmailChange"}];let a=r,u;f();async function f(){await Du(),t(2,a=[]);for(let M of l)M.system||(a.push({value:M.name+":list"}),a.push({value:M.name+":view"}),M.type!="view"&&(a.push({value:M.name+":create"}),a.push({value:M.name+":update"}),a.push({value:M.name+":delete"})),M.type=="auth"&&(a.push({value:M.name+":listAuthMethods"}),a.push({value:M.name+":authRefresh"}),a.push({value:M.name+":auth"}),a.push({value:M.name+":authWithPassword"}),a.push({value:M.name+":authWithOAuth2"}),a.push({value:M.name+":authWithOTP"}),a.push({value:M.name+":requestOTP"}),a.push({value:M.name+":requestPasswordReset"}),a.push({value:M.name+":confirmPasswordReset"}),a.push({value:M.name+":requestVerification"}),a.push({value:M.name+":confirmVerification"}),a.push({value:M.name+":requestEmailChange"}),a.push({value:M.name+":confirmEmailChange"})),M.fields.find(L=>L.type=="file")&&a.push({value:M.name+":file"}));t(2,a=a.concat(r))}function c(){Yt({}),Array.isArray(o.rateLimits.rules)||t(0,o.rateLimits.rules=[],o),o.rateLimits.rules.push({label:"",maxRequests:300,duration:10}),t(0,o),o.rateLimits.rules.length==1&&t(0,o.rateLimits.enabled=!0,o)}function d(M){Yt({}),o.rateLimits.rules.splice(M,1),t(0,o),o.rateLimits.rules.length||t(0,o.rateLimits.enabled=!1,o)}function m(){o.rateLimits.enabled=this.checked,t(0,o)}function h(M,L){n.$$.not_equal(L.label,M)&&(L.label=M,t(0,o))}function _(M,L){M[L].maxRequests=gt(this.value),t(0,o)}function g(M,L){M[L].duration=gt(this.value),t(0,o)}const k=M=>d(M),S=()=>c(),$=()=>u==null?void 0:u.show(),T=()=>u==null?void 0:u.hide();function O(M){ie[M?"unshift":"push"](()=>{u=M,t(3,u)})}return n.$$set=M=>{"formSettings"in M&&t(0,o=M.formSettings)},n.$$.update=()=>{n.$$.dirty&2&&t(4,i=!V.isEmpty(s==null?void 0:s.rateLimits))},[o,s,a,u,i,r,c,d,m,h,_,g,k,S,$,T,O]}class T7 extends Se{constructor(e){super(),we(this,e,S7,w7,ge,{formSettings:0})}}function $7(n){let e,t,i,l,s,o,r,a,u,f,c,d,m,h,_,g,k,S,$,T,O,M,L,I,P,A,N,R,z,F,U;i=ne
2024-10-15 14:03:48 +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"),j(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),q(l,i,null),s=!0,o||(r=W(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)),H(l),o=!1,r()}}}function R7(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 F7(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],x(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=W(e,"click",n[0]),o=!0)},p(a,u){u&8&&(e.disabled=a[3]),u&8&&(l.disabled=a[3]),u&8&&x(l,"btn-loading",a[3])},d(a){a&&(v(e),v(i),v(l)),o=!1,r()}}}function q7(n){let e,t,i={class:"backup-create-panel",beforeOpen:n[8],beforeHide:n[9],popup:!0,$$slots:{footer:[F7],header:[R7],default:[N7]},$$scope:{ctx:n}};return e=new Gt({props:i}),n[10](e),e.$on("show",n[11]),e.$on("hide",n[12]),{c(){j(e.$$.fragment)},m(l,s){q(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),H(e,l)}}}function H7(n,e,t){const i=bt(),l="backup_create_"+V.randomString(5);let s,o="",r=!1,a;function u(S){Yt({}),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)}}ro(()=>{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 _(S){ie[S?"unshift":"push"](()=>{s=S,t(1,s)})}function g(S){Ne.call(this,n,S)}function k(S){Ne.call(this,n,S)}return[f,s,o,r,l,c,u,d,m,h,_,g,k]}class j7 extends Se{constructor(e){super(),we(this,e,H7,q7,ge,{show:6,hide:0})}get show(){return this.$$.ctx[6]}get hide(){return this.$$.ctx[0]}}function z7(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=B("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=W(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 U7(n){let e,t,i,l,s,o,r,a,u,f,c,d,m,h,_,g;return u=new ci({props:{value:n[1]}}),m=new fe({props:{class:"form-field required m-0",name:"name",$$slots:{default:[z7,({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-10-15 14:03:48 +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
2024-11-01 20:05:42 +08:00
<code>data.db</code> file).</p></div>`,t=C(),i=b("div"),l=B(`Type the backup name
`),s=b("div"),o=b("span"),r=B(n[1]),a=C(),j(u.$$.fragment),f=B(`
to confirm:`),c=C(),d=b("form"),j(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),q(u,s,null),w(i,f),y(k,c,S),y(k,d,S),q(m,d,null),h=!0,_||(g=W(d,"submit",tt(n[7])),_=!0)},p(k,S){(!h||S&2)&&re(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)),H(u),H(m),_=!1,g()}}}function V7(n){let e,t,i,l;return{c(){e=b("h4"),t=B("Restore "),i=b("strong"),l=B(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&&re(l,s[1])},d(s){s&&v(e)}}}function B7(n){let e,t,i,l,s,o,r,a;return{c(){e=b("button"),t=B("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],x(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=W(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&&x(l,"btn-loading",u[4])},d(u){u&&(v(e),v(i),v(l)),r=!1,a()}}}function W7(n){let e,t,i={class:"backup-restore-panel",overlayClose:!n[4],escClose:!n[4],beforeHide:n[10],popup:!0,$$slots:{footer:[B7],header:[V7],default:[U7]},$$scope:{ctx:n}};return e=new Gt({props:i}),n[11](e),e.$on("show",n[12]),e.$on("hide",n[13]),{c(){j(e.$$.fragment)},m(l,s){q(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),H(e,l)}}}function Y7(n,e,t){let i;const l="backup_restore_"+V.randomString(5);let s,o="",r="",a=!1,u=null;function f(S){Yt({}),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),Ci(((S=$.response)==null?void 0:S.message)||$.message))}}}ro(()=>{clearTimeout(u)});function m(){r=this.value,t(2,r)}const h=()=>!a;function _(S){ie[S?"unshift":"push"](()=>{s=S,t(3,s)})}function g(S){Ne.call(this,n,S)}function k(S){Ne.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 K7 extends Se{constructor(e){super(),we(this,e,Y7,W7,ge,{show:8,hide:0})}get show(){return this.$$.ctx[8]}get hide(){return this.$$.ctx[0]}}function C1(n,e,t){const i=n.slice();return i[22]=e[t],i}function O1(n,e,t){const i=n.slice();return i[19]=e[t],i}function J7(n){let e=[],t=new Map,i,l,s=de(n[3]);const o=a=>a[22].key;for(let a=0;a<s.length;a+=1){let u=C1(n,s,a),f=o(u);t.set(f,e[a]=M1(f,u))}let r=null;return s.length||(r=E1()),{c(){for(let a=0;a<e.length;a+=1)e[a].c();i=ve(),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=de(a[3]),ae(),e=yt(e,u,o,1,a,s,t,i.parentNode,zt,M1,i,C1),ue(),!s.length&&r?r.p(a,u):s.length?r&&(r.d(1),r=null):(r=E1(),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 Z7(n){let e,t=de(Array(n[3].length||1)),i=[];for(let l=0;l<t.length;l+=1)i[l]=D1(O1(n,t,l));return{c(){for(let l=0;l<i.length;l+=1)i[l].c();e=ve()},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=de(Array(l[3].length||1));let o;for(o=0;o<t.length;o+=1){const r=O1(l,t,o);i[o]?i[o].p(r,s):(i[o]=D1(),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),dt(i,l)}}
2024-11-01 20:05:42 +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:A1}),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:_.data)==null?void 0:g.file)!=null&&k.message?Ci(S.response.data.file.message):me.error(S))}r()}ro(()=>{me.cancelRequest(A1)});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,_;a((_=(h=m==null?void 0:m.target)==null?void 0:h.files)==null?void 0:_[0])};return n.$$set=m=>{"class"in m&&t(0,l=m.class)},[l,s,o,a,f,c,d]}class pR extends Se{constructor(e){super(),we(this,e,dR,cR,ge,{class:0})}}function mR(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 hR(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 P1(n){var U,J,K;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:[_R,({uniqueId:Q})=>({31:Q}),({uniqueId:Q})=>[0,Q?1:0]]},$$scope:{ctx:n}}});let I=n[2]&&N1(n);function P(Q){n[24](Q)}function A(Q){n[25](Q)}function N(Q){n[26](Q)}let R={toggleLabel:"Store backups in S3 storage",testFilesystem:"backups",configKey:"backups.s3",originalConfig:(U=n[0].backups)==null?void 0:U.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 _v({props:R}),ie.push(()=>ke(r,"config",P)),ie.push(()=>ke(r,"isTesting",A)),ie.push(()=>ke(r,"testError",N));let z=((K=(J=n[1].backups)==null?void 0:J.s3)==null?void 0:K.enabled)&&!n[9]&&!n[5]&&R1(n),F=n[9]&&F1(n);return{c(){e=b("form"),j(t.$$.fragment),i=C(),I&&I.c(),l=C(),s=b("div"),o=C(),j(r.$$.fragment),c=C(),d=b("div"),m=b("div"),h=C(),z&&z.c(),_=C(),F&&F.c(),g=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],x(k,"btn-loading",n[5]),p(d,"class","flex"),p(e,"class","block"),p(e,"autocomplete","off")},m(Q,X){y(Q,e,X),q(t,e,null),w(e,i),I&&I.m(e,null),w(e,l),w(e,s),w(e,o),q(r,e,null),w(e,c),w(e,d),w(d,m),w(d,h),z&&z.m(d,null),w(d,_),F&&F.m(d,null),w(d,g),w(d,k),w(k,S),O=!0,M||(L=[W(k,"click",n[28]),W(e,"submit",tt(n[11]))],M=!0)},p(Q,X){var he,$e,We;const oe={};X[0]&4|X[1]&3&&(oe.$$scope={dirty:X,ctx:Q}),t.$set(oe),Q[2]?I?(I.p(Q,X),X[0]&4&&E(I,1)):(I=N1(Q),I.c(),E(I,1),I.m(e,l)):I&&(ae(),D(I,1,1,()=>{I=null}),ue());const be={};X[0]&1&&(be.originalConfig=(he=Q[0].backups)==null?void 0:he.s3),!a&&X[0]&2&&(a=!0,be.config=Q[1].backups.s3,Te(()=>a=!1)),!u&&X[0]&128&&(u=!0,be.isTesting=Q[7],Te(()=>u=!1)),!f&&X[0]&256&&(f=!0,be.testError=Q[8],Te(()=>f=!1)),r.$set(be),(We=($e=Q[1].backups)==null?void 0:$e.s3)!=null&&We.enabled&&!Q[9]&&!Q[5]?z?z.p(Q,X):(z=R1(Q),z.c(),z.m(d,_)):z&&(z.d(1),z=null),Q[9]?F?F.p(Q,X):(F=F1(Q),F.c(),F.m(d,g)):F&&(F.d(1),F=null),(!O||X[0]&544&&$!==($=!Q[9]||Q[5]))&&(k.disabled=$),(!O||X[0]&32)&&x(k,"btn-loading",Q[5])},i(Q){O||(E(t.$$.fragment,Q),E(I),E(r.$$.fragment,Q),Q&&et(()=>{O&&(T||(T=je(e,mt,{duration:150},!0)),T.run(1))}),O=!0)},o(Q){D(t.$$.fragment,Q),D(I),D(r.$$.fragment,Q),Q&&(T||(T=je(e,mt,{duration:150},!1)),T.run(0)),O=!1},d(Q){Q&&v(e),H(t),I&&I.d(),H(r),z&&z.d(),F&&F.d(),Q&&T&&T.end(),M=!1,Ie(L)}}}function _R(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=C(),l=b("label"),s=B("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=W(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 N1(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:[bR,({uniqueId:f})=>({31:f}),({uniqueId:f})
2024-11-01 20:05:42 +08:00
`),T=b("span"),T.textContent="macros",O=B(`.
`),M=b("br"),L=B(`
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 z,F;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),q(_,f,null),y(N,g,R),y(N,k,R),w(k,S),w(S,$),w(S,T),w(S,O),w(S,M),w(S,L),I=!0,(F=(z=n[0])==null?void 0:z.backups)!=null&&F.cron||s.focus(),P||(A=[W(s,"input",n[18]),Ee(He.call(null,T,`@yearly
2024-10-15 14:03:48 +08:00
@annually
@monthly
@weekly
@daily
@midnight
@hourly`))],P=!0)},p(N,R){var F,U;(!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=!((U=(F=N[0])==null?void 0:F.backups)!=null&&U.cron)))&&(s.autofocus=r),R[0]&2&&s.value!==N[1].backups.cron&&ce(s,N[1].backups.cron);const z={};R[0]&2|R[1]&2&&(z.$$scope={dirty:R,ctx:N}),_.$set(z)},i(N){I||(E(_.$$.fragment,N),I=!0)},o(N){D(_.$$.fragment,N),I=!1},d(N){N&&(v(e),v(l),v(s),v(a),v(u),v(g),v(k)),H(_),P=!1,Ie(A)}}}function kR(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=B("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=W(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 R1(n){let e;function t(s,o){return s[7]?wR:s[8]?yR:vR}let i=t(n),l=i(n);return{c(){l.c(),e=ve()},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 vR(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 yR(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=Ee(t=He.call(null,e,(r=n[8].data)==null?void 0:r.message)),i=!0)},p(s,o){var r;t&&It(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 wR(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 F1(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=W(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 SR(n){let e,t,i,l,s,o,r,a,u,f,c,d,m,h,_,g,k,S,$,T,O,M,L,I,P,A,N;m=new Au({props:{class:"btn-sm",tooltip:"Refresh"}}),m.$on("refresh",n[13]),_=new pR({props:{class:"btn-sm"}}),_.$on("success",n[13]);let R={};k=new eR({props:R}),n[15](k);function z(K,Q){return K[6]?hR:mR}let F=z(n),U=F(n),J=n[6]&&!n[4]&&P1(n);return{c(){e=b("header"),t=b("nav"),i=b("div"),i.textContent="Settings",l=C(),s=b("div"),o=B(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(),j(m.$$.fragment),h=C(),j(_.$$.fragment),g=C(),j(k.$$.fragment),S=C(),$=b("hr"),T=C(),O=b("button"),M=b("span"),M.textContent="Backups options",L=C(),U.c(),I=C(),J&&J.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],x(O,"btn-loading",n[4]),p(u,"class","panel"),p(u,"autocomplete","off"),p(a,"class","wrapper")},m(K,Q){y(K,e,Q),w(e,t),w(t,i),w(t,l),w(t,s),w(s,o),y(K,r,Q),y(K,a,Q),w(a,u),w(u,f),w(f,c),w(f,d),q(m,f,null),w(f,h),q(_,f,null),w(u,g),q(k,u,null),w(u,S),w(u,$),w(u,T),w(u,O),w(O,M),w(O,L),U.m(O,null),w(u,I),J&&J.m(u,null),P=!0,A||(N=[W(O,"click",n[16]),W(u,"submit",tt(n[11]))],A=!0)},p(K,Q){(!P||Q[0]&1024)&&re(o,K[10]);const X={};k.$set(X),F!==(F=z(K))&&(U.d(1),U=F(K),U&&(U.c(),U.m(O,null))),(!P||Q[0]&16)&&(O.disabled=K[4]),(!P||Q[0]&16)&&x(O,"btn-loading",K[4]),K[6]&&!K[4]?J?(J.p(K,Q),Q[0]&80&&E(J,1)):(J=P1(K),J.c(),E(J,1),J.m(u,null)):J&&(ae(),D(J,1,1,()=>{J=null}),ue())},i(K){P||(E(m.$$.fragment,K),E(_.$$.fragment,K),E(k.$$.fragment,K),E(J),P=!0)},o(K){D(m.$$.fragment,K),D(_.$$.fragment,K),
another PocketBase environment.</p>`,t=C(),i=b("div"),l=b("div"),s=b("div"),j(o.$$.fragment),r=C();for(let J=0;J<a.length;J+=1)a[J].c();f=C(),c=b("div"),d=b("button"),m=b("span"),m.textContent="Copy",_=C(),g=b("pre"),k=B(n[6]),S=C(),$=b("div"),T=b("div"),O=C(),M=b("button"),L=b("i"),I=C(),P=b("span"),P.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(g,"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(P,"class","txt"),p(M,"type","button"),p(M,"class","btn btn-expanded"),M.disabled=A=!n[2],p($,"class","flex m-t-base")},m(J,K){y(J,e,K),y(J,t,K),y(J,i,K),w(i,l),w(l,s),q(o,s,null),w(l,r);for(let Q=0;Q<a.length;Q+=1)a[Q]&&a[Q].m(l,null);w(i,f),w(i,c),w(c,d),w(d,m),w(c,_),w(c,g),w(g,k),n[16](c),y(J,S,K),y(J,$,K),w($,T),w($,O),w($,M),w(M,L),w(M,I),w(M,P),N=!0,R||(z=[W(d,"click",n[15]),W(c,"keydown",n[17]),W(M,"click",n[18])],R=!0)},p(J,K){const Q={};K&33558561&&(Q.$$scope={dirty:K,ctx:J}),o.$set(Q),K&6147&&(F=de(J[0]),ae(),a=yt(a,K,U,1,J,F,u,l,zt,H1,null,q1),ue()),(!N||K&4&&h!==(h=!J[2]))&&(d.disabled=h),(!N||K&64)&&re(k,J[6]),(!N||K&4&&A!==(A=!J[2]))&&(M.disabled=A)},i(J){if(!N){E(o.$$.fragment,J);for(let K=0;K<F.length;K+=1)E(a[K]);N=!0}},o(J){D(o.$$.fragment,J);for(let K=0;K<a.length;K+=1)D(a[K]);N=!1},d(J){J&&(v(e),v(t),v(i),v(S),v($)),H(o);for(let K=0;K<a.length;K+=1)a[K].d();n[16](null),R=!1,Ie(z)}}}function ER(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 MR(n){let e,t,i,l,s,o,r,a,u;return{c(){e=b("input"),l=C(),s=b("label"),o=B("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=W(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 DR(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=B(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=W(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+"")&&re(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 H1(n,e){let t,i,l,s;return i=new fe({props:{class:"form-field",$$slots:{default:[DR,({uniqueId:o})=>({12:o}),({uniqueId:o})=>o?4096:0]},$$scope:{ctx:e}}}),{key:n,first:null,c(){t=b("div"),j(i.$$.fragment),l=C(),p(t,"class","list-item list-item-collection"),this.first=t},m(o,r){y(o,t,r),q(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),H(i)}}}function IR(n){let e,t,i,l,s,o,r,a,u,f,c,d;const m=[ER,OR],h=[];function _(g,k){return g[4]?0:1}return f=_(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=B(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(g,k){y(g,e,k),w(e,t),w(t,i),w(t,l),w(t,s),w(s,o),y(g,r,k),y(g,a,k),w(a,u),h[f].m(u,null),d=!0},p(g,k){(!d||k&128)&&re(o,g[7]);let S=f;f=_(g),f===S?h[f].p(g,k):(ae(),D(h[S],1,1,()=>{h[S]=null}),ue(),c=h[f],c?c.p(g,k):(c=h[f]=m[f](g),c.c()),E(c,1),c.m(u,null))},i(g){d||(E(c),d=!0)},o(g){D(c),d=!1},d(g){g&&(v(e),v(r),v(a)),h[f].d()}}}function LR(n){let e,t,i,l;return e=new ms({}),i=new mi({props:{$$slots:{de
2024-10-15 14:03:48 +08:00
- ${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 _=()=>m(),g=()=>!u;function k(T){ie[T?"unshift":"push"](()=>{l=T,t(1,l)})}function S(T){Ne.call(this,n,T)}function $(T){Ne.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 YR extends Se{constructor(e){super(),we(this,e,WR,BR,ge,{show:6,hide:0})}get show(){return this.$$.ctx[6]}get hide(){return this.$$.ctx[0]}}function ob(n,e,t){const i=n.slice();return i[33]=e[t],i}function rb(n,e,t){const i=n.slice();return i[36]=e[t],i}function ab(n,e,t){const i=n.slice();return i[33]=e[t],i}function KR(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:[ZR,({uniqueId:U})=>({41:U}),({uniqueId:U})=>[0,U?1024:0]]},$$scope:{ctx:n}}});let P=n[1].length&&fb(n),A=!1,N=n[6]&&n[1].length&&!n[7]&&cb(),R=n[6]&&n[1].length&&n[7]&&db(n),z=n[13].length&&Sb(n),F=!!n[0]&&Tb(n);return{c(){e=b("input"),t=C(),i=b("div"),l=b("p"),s=B(`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(),j(a.$$.fragment),u=C(),P&&P.c(),f=C(),c=C(),N&&N.c(),d=C(),R&&R.c(),m=C(),z&&z.c(),h=C(),_=b("div"),F&&F.c(),g=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"),x(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(_,"class","flex m-t-base")},m(U,J){y(U,e,J),n[21](e),y(U,t,J),y(U,i,J),w(i,l),w(l,s),w(l,o),y(U,r,J),q(a,U,J),y(U,u,J),P&&P.m(U,J),y(U,f,J),y(U,c,J),N&&N.m(U,J),y(U,d,J),R&&R.m(U,J),y(U,m,J),z&&z.m(U,J),y(U,h,J),y(U,_,J),F&&F.m(_,null),w(_,g),w(_,k),w(_,S),w(_,$),w($,T),M=!0,L||(I=[W(e,"change",n[22]),W(o,"click",n[23]),W($,"click",n[19])],L=!0)},p(U,J){(!M||J[0]&4096)&&x(o,"btn-loading",U[12]);const K={};J[0]&64&&(K.class="form-field "+(U[6]?"":"field-error")),J[0]&65|J[1]&3072&&(K.$$scope={dirty:J,ctx:U}),a.$set(K),U[1].length?P?(P.p(U,J),J[0]&2&&E(P,1)):(P=fb(U),P.c(),E(P,1),P.m(f.parentNode,f)):P&&(ae(),D(P,1,1,()=>{P=null}),ue()),U[6]&&U[1].length&&!U[7]?N||(N=cb(),N.c(),N.m(d.parentNode,d)):N&&(N.d(1),N=null),U[6]&&U[1].length&&U[7]?R?R.p(U,J):(R=db(U),R.c(),R.m(m.parentNode,m)):R&&(R.d(1),R=null),U[13].length?z?z.p(U,J):(z=Sb(U),z.c(),z.m(h.parentNode,h)):z&&(z.d(1),z=null),U[0]?F?F.p(U,J):(F=Tb(U),F.c(),F.m(_,g)):F&&(F.d(1),F=null),(!M||J[0]&16384&&O!==(O=!U[14]))&&($.disabled=O)},i(U){M||(E(a.$$.fragment,U),E(P),E(A),M=!0)},o(U){D(a.$$.fragment,U),D(P),D(A),M=!1},d(U){U&&(v(e),v(t),v(i),v(r),v(u),v(f),v(c),v(d),v(m),v(h),v(_)),n[21](null),H(a,U),P&&P.d(U),N&&N.d(U),R&&R.d(U),z&&z.d(U),F&&F.d(),L=!1,Ie(I)}}}function JR(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 ub(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 ZR(n){let e,t,i,l,s,o,r,a,u,f,c=!!n[0]&&!n[6]&&ub();return{c(){e=b("label"),t=B("Collections"),l=C(),s=b("textarea"),r=C(),c&&c.c(),a=ve(),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=W(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=ub(),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 fb(n){let e,t;return e=new fe({props:{class:"form-field form-field-toggle",$$slots:{default:[GR,({uniqueId:i})=>({41:i}),({uniqueId:i})=>[0,i?1024:0]]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,l){q(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){H(e,i)}}}function GR(n){let e,t,i,l,s,o,r,a,u;return{c(){e=b("input"),l=C(),s=b("label"),o=B("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=W(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 cb(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 db(n){let e,t,i,l,s,o=n[9].length&&pb(n),r=n[3].length&&_b(n),a=n[8].length&&vb(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-10-15 14:03:48 +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=W(o,"click",n[27]),r=!0)},p:te,d(u){u&&v(e),r=!1,a()}}}function Tb(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=W(e,"click",n[28]),t=!0)},p:te,d(l){l&&v(e),t=!1,i()}}}function XR(n){let e,t,i,l,s,o,r,a,u,f,c,d;const m=[JR,KR],h=[];function _(g,k){return g[4]?0:1}return f=_(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=B(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(g,k){y(g,e,k),w(e,t),w(t,i),w(t,l),w(t,s),w(s,o),y(g,r,k),y(g,a,k),w(a,u),h[f].m(u,null),d=!0},p(g,k){(!d||k[0]&32768)&&re(o,g[15]);let S=f;f=_(g),f===S?h[f].p(g,k):(ae(),D(h[S],1,1,()=>{h[S]=null}),ue(),c=h[f],c?c.p(g,k):(c=h[f]=m[f](g),c.c()),E(c,1),c.m(u,null))},i(g){d||(E(c),d=!0)},o(g){D(c),d=!1},d(g){g&&(v(e),v(r),v(a)),h[f].d()}}}function QR(n){let e,t,i,l,s,o;e=new ms({}),i=new mi({props:{$$slots:{default:[XR]},$$scope:{ctx:n}}});let r={};return s=new YR({props:r}),n[29](s),s.$on("submit",n[18]),{c(){j(e.$$.fragment),t=C(),j(i.$$.fragment),l=C(),j(s.$$.fragment)},m(a,u){q(e,a,u),y(a,t,u),q(i,a,u),y(a,l,u),q(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)),H(e,a),H(i,a),n[29](null),H(s,a)}}}function xR(n,e,t){let i,l,s,o,r,a,u;Qe(n,fn,oe=>t(15,u=oe)),Rn(fn,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,_=await me.collections.getFullList(200));for(let be of _)delete be.created,delete be.updated,(oe=be.oauth2)==null||delete oe.providers}catch(be){me.error(be)}t(4,S=!1)}function O(){if(t(3,k=[]),!!i)for(let oe of h){const be=V.findByKey(_,"id",oe.id);!(be!=null&&be.id)||!V.hasCollectionChanges(be,oe,g)||k.push({new:oe,old:be})}}function M(){t(1,h=[]);try{t(1,h=JSON.parse(d))}catch{}Array.isArray(h)?t(1,h=V.filterDuplicatesByKey(h)):t(1,h=[]);for(let oe of h)delete oe.created,delete oe.updated,oe.fields=V.filterDuplicatesByKey(oe.fields)}function L(){var oe;for(let be of h){const he=V.findByKey(_,"name",be.name)||V.findByKey(_,"id",be.id);if(!he)continue;const $e=be.id,We=he.id;be.id=We;const nt=Array.isArray(he.fields)?he.fields:[],st=Array.isArray(be.fields)?be.fields:[];for(const Be of st){const xe=V.findByKey(nt,"name",Be.name);xe&&xe.id&&(Be.id=xe.id)}for(let Be of h)if(Array.isArray(Be.fields))for(let xe of Be.fields)xe.collectionId&&xe.collectionId===$e&&(xe.collectionId=We);for(let Be=0;Be<((oe=be.indexes)==null?void 0:oe.length);Be++)be.indexes[Be]=be.indexes[Be].replace(/create\s+(?:unique\s+)?\s*index\s*(?:if\s+not\s+exists\s+)?(\S*)\s+on/gim,xe=>xe.replace($e,We))}t(0,d=JSON.stringify(h,null,4))}function I(oe){t(12,m=!0);const be=new FileReader;be.onload=async he=>{t(12,m=!1),t(10,f.value="",f),t(0,d=he.target.result),await un(),h.length||(Ci("Invalid collections configuration."),P())},be.onerror=he=>{console.warn(he),Ci("Failed to load the imported JSON."),t(12,m=!1),t(10,f.value="",f)},be.readAsText(oe)}function P(){t(0,d=""),t(10,f.value="",f),Yt({})}function A(){const oe=$?V.filterDuplicatesByKey(_.concat(h)):h;c==null||c.show(_,oe,g)}function N(oe){ie[oe?"unshift":"push"](()=>{f=oe,t(10,f)})}const R=()=>{f.files.length&&I(f.files[0])},z=()=>{f.click()};function F(){d=this.value,t(0,d)}function U(){$=this.checked,t(5,$)}function J(){g=this.checked,t(2,g)}const K=()=>L()
2024-10-15 14:03:48 +08:00
from the
2024-11-01 20:05:42 +08:00
`),r=b("strong"),u=B(a),f=B(`
2024-10-15 14:03:48 +08:00
to the
2024-11-01 20:05:42 +08:00
`),c=b("strong"),m=B(d),h=B(`.
`),_=b("br"),g=B(`
2024-10-15 14:03:48 +08:00
There are numerous command line tools that can help you, such as:
2024-10-28 04:12:37 +08:00
`),k=b("a"),k.textContent=`rclone
2024-11-01 20:05:42 +08:00
`,S=B(`,
2024-10-15 14:03:48 +08:00
`),$=b("a"),$.textContent=`s5cmd
`,T=B(", 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(A,N){y(A,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,_),w(s,g),w(s,k),w(s,S),w(s,$),w(s,T),w(e,O),w(e,M),I=!0},p(A,N){var R;(!I||N&1)&&a!==(a=(R=A[0].s3)!=null&&R.enabled?"S3 storage":"local file system")&&re(u,a),(!I||N&2)&&d!==(d=A[1].s3.enabled?"S3 storage":"local file system")&&re(m,d)},i(A){I||(A&&et(()=>{I&&(L||(L=je(e,mt,{duration:150},!0)),L.run(1))}),I=!0)},o(A){A&&(L||(L=je(e,mt,{duration:150},!1)),L.run(0)),I=!1},d(A){A&&v(e),A&&L&&L.end()}}}function SF(n){var i;let e,t=((i=n[0].s3)==null?void 0:i.enabled)!=n[1].s3.enabled&&Ob(n);return{c(){t&&t.c(),e=ve()},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=Ob(l),t.c(),E(t,1),t.m(e.parentNode,e)):t&&(ae(),D(t,1,1,()=>{t=null}),ue())},d(l){l&&v(e),t&&t.d(l)}}}function Eb(n){let e;function t(s,o){return s[4]?CF:s[5]?$F:TF}let i=t(n),l=i(n);return{c(){l.c(),e=ve()},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 TF(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 $F(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=Ee(t=He.call(null,e,(r=n[5].data)==null?void 0:r.message)),i=!0)},p(s,o){var r;t&&It(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 CF(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 Mb(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=W(e,"click",n[14]),i=!0)},p(s,o){o&8&&(e.disabled=s[3])},d(s){s&&v(e),i=!1,l()}}}function OF(n){let e,t,i,l,s,o,r,a,u,f,c,d,m,h,_,g;const k=[wF,yF],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=B(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=W(u,"submit",tt(n[16])),_=!0)},p(T,O){(!h||O&128)&&re(o,T[7]);let M=d;d=$(T),d===M?S[d].p(T,O):(ae(),D(S[M],1,1,()=>{S[M]=null}),ue(),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(),_=!1,g()}}}function EF(n){let e,t,i,l;return e=new ms({}),i=new mi({props:{$$slots:{default:[OF]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment),t=C(),j(i.$$.fragment)},m(s,o){q(e,s,o),y(s,t,o),q(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&&re(s,r[11])},d(r){r&&v(e)}}}function FF(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=B("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=W(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 qF(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=B("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=W(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 HF(n){let e,t=V.sentenize(n[0].password.identityFields.join(" or "),!1)+"",i,l,s,o,r,a,u,f;return{c(){e=b("label"),i=B(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=W(o,"input",n[16]),u=!0)},p(c,d){d&1&&t!==(t=V.sentenize(c[0].password.identityFields.join(" or "),!1)+"")&&re(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 jF(n){let e,t,i,l,s,o,r,a,u,f,c;return{c(){e=b("label"),t=B("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=[W(s,"input",n[17]),Ee(Vn.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,Ie(c)}}}function zF(n){let e,t,i,l,s,o,r,a,u=n[2]>1&&Db(n);const f=[PF,AF,LF],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=B(`Superuser login
2024-11-05 01:08:21 +08:00
`),u&&u.c(),l=C(),o&&o.c(),r=ve(),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=Db(m),u.c(),u.m(t,null)):u&&(u.d(1),u=null);let _=s;s=d(m),s===_?~s&&c[s].p(m,h):(o&&(ae(),D(c[_],1,1,()=>{c[_]=null}),ue()),~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 UF(n){let e,t;return e=new ak({props:{$$slots:{default:[zF]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,l){q(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){H(e,i)}}}function VF(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,z;if(!f){t(7,f=!0);try{await me.collection("_superusers").authWithPassword(s,o),Is(),Yt({}),Il("/")}catch(F){F.status==401?(t(3,h=F.response.mfaId),((z=(R=r==null?void 0:r.password)==null?void 0:R.identityFields)==null?void 0:z.length)==1&&r.password.identityFields[0]=="email"?(t(11,k=s),await O()):/^[^@\s]+@[^@\s]+$/.test(s)&&t(11,k=s)):F.status!=400?me.error(F):Ci("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,_=R.otpId),g=_,Is(),Yt({})}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(_,S,{mfaId:h}),Is(),Yt({}),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 P(){k=this.value,t(11,k)}function A(){S=this.value,t(12,S)}const N=()=>{t(4,_="")};return n.$$.update=()=>{var R,z;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),(z=r==null?void 0:r.otp)!=null&&z.enabled&&t(2,u++,u),h!=""&&t(1,a++,a),_!=""&&t(1,a++,a))},[r,a,u,h,_,s,o,f,c,d,m,k,S,T,O,M,L,I,P,A,N]}class BF extends Se{constructor(e){super(),we(this,e,VF,UF,ge,{})}}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 sn=[async n=>{const e=new URLSearchParams(window.location.search);return n.location!=="/"&&e.has("pbinstal")?Il("/"):!0}],WF={"/login":Qt({component:BF,conditions:sn.concat([n=>!me.authStore.isValid]),userData:{showAppSidebar:!1}}),"/request-password-reset":Qt({asyncComponent:()=>Ot(()=>import("./PageSuperuserRequestPasswordReset-LikyDc0G.js"),[],import.meta.url),conditions:sn.concat([n=>!me.authStore.isValid]),userData:{showAppSidebar:!1}}),"/confirm-password-reset/:token":Qt({asyncComponent:()=>Ot(()=>import("./PageSuperuserConfirmPasswordReset-CwHgg_wd.js"),[],import.meta.url),conditions:sn.concat([n=>!me.authStore.isValid]),userData:{showAppSidebar:!1}}),"/collections":Qt({component:NN,conditions:sn.concat([n=>me.authStore.isValid]),userData:{showAppSidebar:!0}}),"/logs":Qt({component:T5,conditions:sn.concat([n=>me.authStore.isVali