pocketbase/ui/dist/assets/index-0unWA3Bg.js

229 lines
1.1 MiB
JavaScript
Raw Normal View History

2025-04-16 13:14:56 +08:00
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./FilterAutocompleteInput-GIaJxLlC.js","./index-CXcDhfsk.js","./ListApiDocs-D9Yaj1xF.js","./FieldsQueryParam-ZLlGrCBp.js","./ListApiDocs-ByASLUZu.css","./ViewApiDocs-DOVrcdQR.js","./CreateApiDocs-BSBD75dG.js","./UpdateApiDocs-CRATukjt.js","./AuthMethodsDocs-wtj3JCVc.js","./AuthWithPasswordDocs-DX00Ztbb.js","./AuthWithOAuth2Docs-DvyyX2ad.js","./AuthWithOtpDocs-CB-NRkGk.js","./AuthRefreshDocs-DJaM_nz_.js","./CodeEditor-sxuxxBKk.js","./Leaflet-DYeBczBi.js","./Leaflet-DCQr6yJv.css"])))=>i.map(i=>d[i]);
var By=Object.defineProperty;var Wy=(n,e,t)=>e in n?By(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var pt=(n,e,t)=>Wy(n,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const l of s)if(l.type==="childList")for(const o of l.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(s){const l={};return s.integrity&&(l.integrity=s.integrity),s.referrerPolicy&&(l.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?l.credentials="include":s.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(s){if(s.ep)return;s.ep=!0;const l=t(s);fetch(s.href,l)}})();function te(){}const lo=n=>n;function je(n,e){for(const t in e)n[t]=e[t];return n}function Yy(n){return!!n&&(typeof n=="object"||typeof n=="function")&&typeof n.then=="function"}function Xb(n){return n()}function mf(){return Object.create(null)}function Ee(n){n.forEach(Xb)}function Lt(n){return typeof n=="function"}function be(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}let wo;function Sn(n,e){return n===e?!0:(wo||(wo=document.createElement("a")),wo.href=e,n===wo.href)}function Ky(n){return Object.keys(n).length===0}function pu(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 Qb(n){let e;return pu(n,t=>e=t)(),e}function Ge(n,e,t){n.$$.on_destroy.push(pu(e,t))}function Nt(n,e,t,i){if(n){const s=xb(n,e,t,i);return n[0](s)}}function xb(n,e,t,i){return n[1]&&i?je(t.ctx.slice(),n[1](i(e))):t.ctx}function Rt(n,e,t,i){if(n[2]&&i){const s=n[2](i(t));if(e.dirty===void 0)return s;if(typeof s=="object"){const l=[],o=Math.max(e.dirty.length,s.length);for(let r=0;r<o;r+=1)l[r]=e.dirty[r]|s[r];return l}return e.dirty|s}return e.dirty}function Ft(n,e,t,i,s,l){if(s){const o=xb(e,t,i,l);n.p(o,s)}}function qt(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 Kt(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 En(n,e,t){return n.set(t),e}function Oe(n){return n&&Lt(n.destroy)?n.destroy:te}function hf(n){const e=typeof n=="string"&&n.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);return e?[parseFloat(e[1]),e[2]||"px"]:[n,"px"]}const e0=typeof window<"u";let vr=e0?()=>window.performance.now():()=>Date.now(),mu=e0?n=>requestAnimationFrame(n):te;const Zl=new Set;function t0(n){Zl.forEach(e=>{e.c(n)||(Zl.delete(e),e.f())}),Zl.size!==0&&mu(t0)}function wr(n){let e;return Zl.size===0&&mu(t0),{promise:new Promise(t=>{Zl.add(e={c:n,f:t})}),abort(){Zl.delete(e)}}}function y(n,e){n.appendChild(e)}function n0(n){if(!n)return document;const e=n.getRootNode?n.getRootNode():n.ownerDocument;return e&&e.host?e:n.ownerDocument}function Jy(n){const e=b("style");return e.textContent="/* empty */",Zy(n0(n),e),e.sheet}function Zy(n,e){return y(n.head||n,e),e.sheet}function w(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 W(n){return document.createTextNode(n)}function C(){return W(" ")}function ke(){return W("")}function Y(n,e,t,i){return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t,i)}function it(n){return function(e){return e.preventDefault(),n.call(this,e)}}function en(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 Gy=["width","height"];function ii(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
2025-04-02 16:38:19 +08:00
`;for(let _=0;_<=1;_+=a){const k=e+(t-e)*l(_);u+=_*100+`%{${o(k,1-k)}}
`}const f=u+`100% {${o(t,1-t)}}
2025-04-16 13:14:56 +08:00
}`,c=`__svelte_${xy(f)}_${r}`,d=n0(n),{stylesheet:m,rules:h}=sr.get(d)||ev(d,n);h[c]||(h[c]=!0,m.insertRule(`@keyframes ${c} ${f}`,m.cssRules.length));const g=n.style.animation||"";return n.style.animation=`${g?`${g}, `:""}${c} ${i}ms linear ${s}ms 1 both`,or+=1,c}function Vs(n,e){const t=(n.style.animation||"").split(", "),i=t.filter(e?l=>l.indexOf(e)<0:l=>l.indexOf("__svelte")===-1),s=t.length-i.length;s&&(n.style.animation=i.join(", "),or-=s,or||tv())}function tv(){mu(()=>{or||(sr.forEach(n=>{const{ownerNode:e}=n.stylesheet;e&&v(e)}),sr.clear())})}function nv(n,e,t,i){if(!e)return te;const s=n.getBoundingClientRect();if(e.left===s.left&&e.right===s.right&&e.top===s.top&&e.bottom===s.bottom)return te;const{delay:l=0,duration:o=300,easing:r=lo,start:a=vr()+l,end:u=a+o,tick:f=te,css:c}=t(n,{from:e,to:s},i);let d=!0,m=!1,h;function g(){c&&(h=Us(n,0,1,o,l,r,c)),l||(m=!0)}function _(){c&&Vs(n,h),d=!1}return wr(k=>{if(!m&&k>=a&&(m=!0),m&&k>=u&&(f(1,0),_()),!d)return!1;if(m){const S=k-a,$=0+1*r(S/o);f($,1-$)}return!0}),g(),f(0,1),_}function iv(n){const e=getComputedStyle(n);if(e.position!=="absolute"&&e.position!=="fixed"){const{width:t,height:i}=e,s=n.getBoundingClientRect();n.style.position="absolute",n.style.width=t,n.style.height=i,s0(n,s)}}function s0(n,e){const t=n.getBoundingClientRect();if(e.left!==t.left||e.top!==t.top){const i=getComputedStyle(n),s=i.transform==="none"?"":i.transform;n.style.transform=`${s} translate(${e.left-t.left}px, ${e.top-t.top}px)`}}let Bs;function qi(n){Bs=n}function so(){if(!Bs)throw new Error("Function called outside component initialization");return Bs}function an(n){so().$$.on_mount.push(n)}function lv(n){so().$$.after_update.push(n)}function oo(n){so().$$.on_destroy.push(n)}function wt(){const n=so();return(e,t,{cancelable:i=!1}={})=>{const s=n.$$.callbacks[e];if(s){const l=l0(e,t,{cancelable:i});return s.slice().forEach(o=>{o.call(n,l)}),!l.defaultPrevented}return!0}}function Le(n,e){const t=n.$$.callbacks[e.type];t&&t.slice().forEach(i=>i.call(this,e))}const Kl=[],ne=[];let Gl=[];const La=[],o0=Promise.resolve();let Aa=!1;function r0(){Aa||(Aa=!0,o0.then(hu))}function _n(){return r0(),o0}function tt(n){Gl.push(n)}function $e(n){La.push(n)}const Wr=new Set;let zl=0;function hu(){if(zl!==0)return;const n=Bs;do{try{for(;zl<Kl.length;){const e=Kl[zl];zl++,qi(e),sv(e.$$)}}catch(e){throw Kl.length=0,zl=0,e}for(qi(null),Kl.length=0,zl=0;ne.length;)ne.pop()();for(let e=0;e<Gl.length;e+=1){const t=Gl[e];Wr.has(t)||(Wr.add(t),t())}Gl.length=0}while(Kl.length);for(;La.length;)La.pop()();Aa=!1,Wr.clear(),qi(n)}function sv(n){if(n.fragment!==null){n.update(),Ee(n.before_update);const e=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,e),n.after_update.forEach(tt)}}function ov(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 _u(){return bs||(bs=Promise.resolve(),bs.then(()=>{bs=null})),bs}function Cl(n,e,t){n.dispatchEvent(l0(`${e?"intro":"outro"}${t}`))}const Zo=new Set;let Ti;function oe(){Ti={r:0,c:[],p:Ti}}function re(){Ti.r||Ee(Ti.c),Ti=Ti.p}function M(n,e){n&&n.i&&(Zo.delete(n),n.i(e))}function D(n,e,t,i){if(n&&n.o){if(Zo.has(n))return;Zo.add(n),Ti.c.push(()=>{Zo.delete(n),i&&(t&&n.d(1),i())}),n.o(e)}else i&&i()}const gu={duration:0};function a0(n,e,t){const i={direction:"in"};let s=e(n,t,i),l=!1,o,r,a=0;function u(){o&&Vs(n,o)}function f(){const{delay:d=0,duration:m=300,easing:h=lo,tick:g=te,css:_}=s||gu;_&&(o=Us(n,0,1,m,d,h,_,a++)),g(0,1);const k=vr()+d,S=k+m;r&&r.abort(),l=!0,tt(()=>Cl(n,!0,"start")),r=wr($=>{if(l){if($>=S)return g(1,0),Cl(n,!0,"end"),u(),l=!1;if($>=k){const T=h(($-k)/m);g(T,1-T)}}return l})}let c=!1;return{start(){c||(c=!0,Vs(n),Lt(s)?(s=s(i),_u().then(f)):f())},invalidate(){c=!1},end(){l&&(u(),l=!1)}}}function bu(n,e,t){const i={direction:"out"};let s=e(n,t,i),l=!0,o;const r=Ti;r.r+=1;let a;function u(){const{delay:f=0,duration:c=300,easing:d=lo,tick:m=te,css:h}=s||gu;h&&(o=Us(n,1,0,c,f,d,h));const g=vr()+f,_=g+c;tt(()=>Cl(n,!1,"start")),"inert"in n&&(a=n.inert,n.inert=!0),wr(k=>{if(l){if(k>=_)return m(0,1
2025-04-02 16:38:19 +08:00
`),t+=i.map(s=>{let l="";return s.name.includes("(")||s.name.includes(" ")?l+=s.name:l+="`"+s.name+"`",s.collate&&(l+=" COLLATE "+s.collate),s.sort&&(l+=" "+s.sort.toUpperCase()),l}).join(`,
`),i.length>1&&(t+=`
`),t+=")",e.where&&(t+=` WHERE ${e.where}`),t}static replaceIndexTableName(e,t){const i=U.parseIndex(e);return i.tableName=t,U.buildIndex(i)}static replaceIndexColumn(e,t,i){if(t===i)return e;const s=U.parseIndex(e);let l=!1;for(let o of s.columns)o.name===t&&(o.name=i,l=!0);return l?U.buildIndex(s):e}static normalizeSearchFilter(e,t){if(e=(e||"").trim(),!e||!t.length)return e;const i=["=","!=","~","!~",">",">=","<","<="];for(const s of i)if(e.includes(s))return e;return e=isNaN(e)&&e!="true"&&e!="false"?`"${e.replace(/^[\"\'\`]|[\"\'\`]$/gm,"")}"`:e,t.map(s=>`${s}~${e}`).join("||")}static normalizeLogsFilter(e,t=[]){return U.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 s=i.indexOf("?");s>-1&&(t=i.substring(s+1),i=i.substring(0,s));const l=new URLSearchParams(t);for(let a in e){const u=e[a];u===null?l.delete(a):l.set(a,u)}t=l.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 Wa,_l;const Ya="app-tooltip";function Wf(n){return typeof n=="string"?{text:n,position:"bottom",hideOnClick:null}:n||{}}function nl(){return _l=_l||document.querySelector("."+Ya),_l||(_l=document.createElement("div"),_l.classList.add(Ya),document.body.appendChild(_l)),_l}function dk(n,e){let t=nl();if(!t.classList.contains("active")||!(e!=null&&e.text)){Ka();return}t.textContent=e.text,t.className=Ya+" 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,s=t.offsetWidth,l=n.getBoundingClientRect(),o=0,r=0,a=5;e.position=="left"?(o=l.top+l.height/2-i/2,r=l.left-s-a):e.position=="right"?(o=l.top+l.height/2-i/2,r=l.right+a):e.position=="top"?(o=l.top-i-a,r=l.left+l.width/2-s/2):e.position=="top-left"?(o=l.top-i-a,r=l.left):e.position=="top-right"?(o=l.top-i-a,r=l.right-s):e.position=="bottom-left"?(o=l.top+l.height+a,r=l.left):e.position=="bottom-right"?(o=l.top+l.height+a,r=l.right-s):(o=l.top+l.height+a,r=l.left+l.width/2-s/2),r+s>document.documentElement.clientWidth&&(r=document.documentElement.clientWidth-s),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 Ka(){clearTimeout(Wa),nl().classList.remove("active"),nl().activeNode=void 0}function bw(n,e){nl().activeNode=n,clearTimeout(Wa),Wa=setTimeout(()=>{nl().classList.add("active"),dk(n,e)},isNaN(e.delay)?0:e.delay)}function Re(n,e){let t=Wf(e);function i(){bw(n,t)}function s(){Ka()}return n.addEventListener("mouseenter",i),n.addEventListener("mouseleave",s),n.addEventListener("blur",s),(t.hideOnClick===!0||t.hideOnClick===null&&U.isFocusable(n))&&n.addEventListener("click",s),nl(),{update(l){var o,r;t=Wf(l),(r=(o=nl())==null?void 0:o.activeNode)!=null&&r.contains(n)&&dk(n,t)},destroy(){var l,o;(o=(l=nl())==null?void 0:l.activeNode)!=null&&o.contains(n)&&Ka(),n.removeEventListener("mouseenter",i),n.removeEventListener("mouseleave",s),n.removeEventListener("blur",s),n.removeEventListener("click",s)}}}function Mr(n){const e=n-1;return e*e*e+1}function Ys(n,{delay:e=0,duration:t=400,easing:i=lo}={}){const s=+getComputedStyle(n).opacity;return{delay:e,duration:t,easing:i,css:l=>`opacity: ${l*s}`}}function zn(n,{delay:e=0,duration:t=400,easing:i=Mr,x:s=0,y:l=0,opacity:o=0}={}){const r=getComputedStyle(n),a=+r.opacity,u=r.transform==="none"?"":r.transform,f=a*(1-o),[c,d]=hf(s),[m,h]=hf(l);return{delay:e,duration:t,easing:i,css:(g,_)=>`
2025-04-02 16:38:19 +08:00
transform: ${u} translate(${(1-g)*c}${d}, ${(1-g)*m}${h});
opacity: ${a-f*_}`}}function ht(n,{delay:e=0,duration:t=400,easing:i=Mr,axis:s="y"}={}){const l=getComputedStyle(n),o=+l.opacity,r=s==="y"?"height":"width",a=parseFloat(l[r]),u=s==="y"?["top","bottom"]:["left","right"],f=u.map(k=>`${k[0].toUpperCase()}${k.slice(1)}`),c=parseFloat(l[`padding${f[0]}`]),d=parseFloat(l[`padding${f[1]}`]),m=parseFloat(l[`margin${f[0]}`]),h=parseFloat(l[`margin${f[1]}`]),g=parseFloat(l[`border${f[0]}Width`]),_=parseFloat(l[`border${f[1]}Width`]);return{delay:e,duration:t,easing:i,css:k=>`overflow: hidden;opacity: ${Math.min(k*20,1)*o};${r}: ${k*a}px;padding-${u[0]}: ${k*c}px;padding-${u[1]}: ${k*d}px;margin-${u[0]}: ${k*m}px;margin-${u[1]}: ${k*h}px;border-${u[0]}-width: ${k*g}px;border-${u[1]}-width: ${k*_}px;`}}function Ct(n,{delay:e=0,duration:t=400,easing:i=Mr,start:s=0,opacity:l=0}={}){const o=getComputedStyle(n),r=+o.opacity,a=o.transform==="none"?"":o.transform,u=1-s,f=r*(1-l);return{delay:e,duration:t,easing:i,css:(c,d)=>`
2025-04-02 16:38:19 +08:00
transform: ${a} scale(${1-u*d});
opacity: ${r-f*d}
`}}const kw=n=>({}),Yf=n=>({}),yw=n=>({}),Kf=n=>({});function Jf(n){let e,t,i,s,l,o,r,a,u,f,c,d,m,h,g,_,k,S,$=n[4]&&!n[2]&&Zf(n);const T=n[19].header,O=Nt(T,n,n[18],Kf);let E=n[4]&&n[2]&&Gf(n);const L=n[19].default,I=Nt(L,n,n[18],null),A=n[19].footer,P=Nt(A,n,n[18],Yf);return{c(){e=b("div"),t=b("div"),s=C(),l=b("div"),o=b("div"),$&&$.c(),r=C(),O&&O.c(),a=C(),E&&E.c(),u=C(),f=b("div"),I&&I.c(),c=C(),d=b("div"),P&&P.c(),p(t,"class","overlay"),p(o,"class","overlay-panel-section panel-header"),p(f,"class","overlay-panel-section panel-content"),p(d,"class","overlay-panel-section panel-footer"),p(l,"class",m="overlay-panel "+n[1]+" "+n[8]),x(l,"popup",n[2]),p(e,"class","overlay-panel-container"),x(e,"padded",n[2]),x(e,"active",n[0])},m(N,R){w(N,e,R),y(e,t),y(e,s),y(e,l),y(l,o),$&&$.m(o,null),y(o,r),O&&O.m(o,null),y(o,a),E&&E.m(o,null),y(l,u),y(l,f),I&&I.m(f,null),n[21](f),y(l,c),y(l,d),P&&P.m(d,null),_=!0,k||(S=[Y(t,"click",it(n[20])),Y(f,"scroll",n[22])],k=!0)},p(N,R){n=N,n[4]&&!n[2]?$?($.p(n,R),R[0]&20&&M($,1)):($=Zf(n),$.c(),M($,1),$.m(o,r)):$&&(oe(),D($,1,1,()=>{$=null}),re()),O&&O.p&&(!_||R[0]&262144)&&Ft(O,T,n,n[18],_?Rt(T,n[18],R,yw):qt(n[18]),Kf),n[4]&&n[2]?E?E.p(n,R):(E=Gf(n),E.c(),E.m(o,null)):E&&(E.d(1),E=null),I&&I.p&&(!_||R[0]&262144)&&Ft(I,L,n,n[18],_?Rt(L,n[18],R,null):qt(n[18]),null),P&&P.p&&(!_||R[0]&262144)&&Ft(P,A,n,n[18],_?Rt(A,n[18],R,kw):qt(n[18]),Yf),(!_||R[0]&258&&m!==(m="overlay-panel "+n[1]+" "+n[8]))&&p(l,"class",m),(!_||R[0]&262)&&x(l,"popup",n[2]),(!_||R[0]&4)&&x(e,"padded",n[2]),(!_||R[0]&1)&&x(e,"active",n[0])},i(N){_||(N&&tt(()=>{_&&(i||(i=qe(t,Ys,{duration:Gi,opacity:0},!0)),i.run(1))}),M($),M(O,N),M(I,N),M(P,N),N&&tt(()=>{_&&(g&&g.end(1),h=a0(l,zn,n[2]?{duration:Gi,y:-10}:{duration:Gi,x:50}),h.start())}),_=!0)},o(N){N&&(i||(i=qe(t,Ys,{duration:Gi,opacity:0},!1)),i.run(0)),D($),D(O,N),D(I,N),D(P,N),h&&h.invalidate(),N&&(g=bu(l,zn,n[2]?{duration:Gi,y:10}:{duration:Gi,x:50})),_=!1},d(N){N&&v(e),N&&i&&i.end(),$&&$.d(),O&&O.d(N),E&&E.d(),I&&I.d(N),n[21](null),P&&P.d(N),N&&g&&g.end(),k=!1,Ee(S)}}}function Zf(n){let e,t,i,s,l;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){w(o,e,r),i=!0,s||(l=Y(e,"click",it(n[5])),s=!0)},p(o,r){n=o},i(o){i||(o&&tt(()=>{i&&(t||(t=qe(e,Ys,{duration:Gi},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=qe(e,Ys,{duration:Gi},!1)),t.run(0)),i=!1},d(o){o&&v(e),o&&t&&t.end(),s=!1,l()}}}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(s,l){w(s,e,l),t||(i=Y(e,"click",it(n[5])),t=!0)},p:te,d(s){s&&v(e),t=!1,i()}}}function vw(n){let e,t,i,s,l=n[0]&&Jf(n);return{c(){e=b("div"),l&&l.c(),p(e,"class","overlay-panel-wrapper"),p(e,"tabindex","-1")},m(o,r){w(o,e,r),l&&l.m(e,null),n[23](e),t=!0,i||(s=[Y(window,"resize",n[10]),Y(window,"keydown",n[9])],i=!0)},p(o,r){o[0]?l?(l.p(o,r),r[0]&1&&M(l,1)):(l=Jf(o),l.c(),M(l,1),l.m(e,null)):l&&(oe(),D(l,1,1,()=>{l=null}),re())},i(o){t||(M(l),t=!0)},o(o){D(l),t=!1},d(o){o&&v(e),l&&l.d(),n[23](null),i=!1,Ee(s)}}}let gl,ta=[];function pk(){return gl=gl||document.querySelector(".overlays"),gl||(gl=document.createElement("div"),gl.classList.add("overlays"),document.body.appendChild(gl)),gl}let Gi=150;function Xf(){return 1e3+pk().querySelectorAll(".overlay-panel-container.active").length}function ww(n,e,t){let{$$slots:i={},$$scope:s}=e,{class:l=""}=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=wt(),h="op_"+U.randomString(10);let g,_,k,S,$="",T=o;function O(){typeof c=="function"&&c()===!1||t(0,o=!0)}function E(){typeof d=="function"&&d()===!1||t(0,o=!1)}function L(){return o}async function I(G){t(17,T=G),G?(k=document.activeElement,m("show"),g==null||g.focus()):(clearTimeout(S),m("hide"),k==null||k.focus()),await _n(),A()}function A(){g&&(o?t(6,g.
`)})),o=!0)},p(a,u){i&&Lt(i.update)&&u&8&&i.update.call(null,{position:"left",text:a[3].map(dr).join(`
2025-04-16 13:14:56 +08:00
`)})},i(a){l||(a&&tt(()=>{l&&(s||(s=qe(t,Ct,{duration:150,start:.7},!0)),s.run(1))}),l=!0)},o(a){a&&(s||(s=qe(t,Ct,{duration:150,start:.7},!1)),s.run(0)),l=!1},d(a){a&&v(e),a&&s&&s.end(),o=!1,r()}}}function hc(n){let e,t,i=dr(n[12])+"",s,l,o,r;return{c(){e=b("div"),t=b("pre"),s=W(i),l=C(),p(e,"class","help-block help-block-error")},m(a,u){w(a,e,u),y(e,t),y(t,s),y(e,l),r=!0},p(a,u){(!r||u&8)&&i!==(i=dr(a[12])+"")&&se(s,i)},i(a){r||(a&&tt(()=>{r&&(o||(o=qe(e,ht,{duration:150},!0)),o.run(1))}),r=!0)},o(a){a&&(o||(o=qe(e,ht,{duration:150},!1)),o.run(0)),r=!1},d(a){a&&v(e),a&&o&&o.end()}}}function $3(n){let e,t,i,s,l,o,r;const a=n[9].default,u=Nt(a,n,n[8],mc),f=[T3,S3],c=[];function d(m,h){return m[0]&&m[3].length?0:1}return i=d(n),s=c[i]=f[i](n),{c(){e=b("div"),u&&u.c(),t=C(),s.c(),p(e,"class",n[1]),x(e,"error",n[3].length)},m(m,h){w(m,e,h),u&&u.m(e,null),y(e,t),c[i].m(e,null),n[11](e),l=!0,o||(r=Y(e,"click",n[10]),o=!0)},p(m,[h]){u&&u.p&&(!l||h&256)&&Ft(u,a,m,m[8],l?Rt(a,m[8],h,w3):qt(m[8]),mc);let g=i;i=d(m),i===g?c[i].p(m,h):(oe(),D(c[g],1,1,()=>{c[g]=null}),re(),s=c[i],s?s.p(m,h):(s=c[i]=f[i](m),s.c()),M(s,1),s.m(e,null)),(!l||h&2)&&p(e,"class",m[1]),(!l||h&10)&&x(e,"error",m[3].length)},i(m){l||(M(u,m),M(s),l=!0)},o(m){D(u,m),D(s),l=!1},d(m){m&&v(e),u&&u.d(m),c[i].d(),n[11](null),o=!1,r()}}}const _c="Invalid value";function dr(n){return typeof n=="object"?(n==null?void 0:n.message)||(n==null?void 0:n.code)||_c:n||_c}function C3(n,e,t){let i;Ge(n,$n,g=>t(7,i=g));let{$$slots:s={},$$scope:l}=e;const o="field_"+U.randomString(7);let{name:r=""}=e,{inlineError:a=!1}=e,{class:u=void 0}=e,f,c=[];function d(){Yn(r)}an(()=>(f.addEventListener("input",d),f.addEventListener("change",d),()=>{f.removeEventListener("input",d),f.removeEventListener("change",d)}));function m(g){Le.call(this,n,g)}function h(g){ne[g?"unshift":"push"](()=>{f=g,t(2,f)})}return n.$$set=g=>{"name"in g&&t(5,r=g.name),"inlineError"in g&&t(0,a=g.inlineError),"class"in g&&t(1,u=g.class),"$$scope"in g&&t(8,l=g.$$scope)},n.$$.update=()=>{n.$$.dirty&160&&t(3,c=U.toArray(U.getNestedVal(i,r)))},[a,u,f,c,o,r,d,i,l,s,m,h]}class fe extends we{constructor(e){super(),ve(this,e,C3,$3,be,{name:5,inlineError:0,class:1,changed:6})}get changed(){return this.$$.ctx[6]}}const O3=n=>({}),gc=n=>({});function bc(n){let e,t,i,s,l,o;return{c(){e=b("a"),e.innerHTML='<i class="ri-book-open-line txt-sm"></i> <span class="txt">Docs</span>',t=C(),i=b("span"),i.textContent="|",s=C(),l=b("a"),o=b("span"),o.textContent="PocketBase v0.27.0",p(e,"href","https://pocketbase.io/docs"),p(e,"target","_blank"),p(e,"rel","noopener noreferrer"),p(i,"class","delimiter"),p(o,"class","txt"),p(l,"href","https://github.com/pocketbase/pocketbase/releases"),p(l,"target","_blank"),p(l,"rel","noopener noreferrer"),p(l,"title","Releases")},m(r,a){w(r,e,a),w(r,t,a),w(r,i,a),w(r,s,a),w(r,l,a),y(l,o)},d(r){r&&(v(e),v(t),v(i),v(s),v(l))}}}function M3(n){var m;let e,t,i,s,l,o,r;const a=n[4].default,u=Nt(a,n,n[3],null),f=n[4].footer,c=Nt(f,n,n[3],gc);let d=((m=n[2])==null?void 0:m.id)&&bc();return{c(){e=b("div"),t=b("main"),u&&u.c(),i=C(),s=b("footer"),c&&c.c(),l=C(),d&&d.c(),p(t,"class","page-content"),p(s,"class","page-footer"),p(e,"class",o="page-wrapper "+n[1]),x(e,"center-content",n[0])},m(h,g){w(h,e,g),y(e,t),u&&u.m(t,null),y(e,i),y(e,s),c&&c.m(s,null),y(s,l),d&&d.m(s,null),r=!0},p(h,[g]){var _;u&&u.p&&(!r||g&8)&&Ft(u,a,h,h[3],r?Rt(a,h[3],g,null):qt(h[3]),null),c&&c.p&&(!r||g&8)&&Ft(c,f,h,h[3],r?Rt(f,h[3],g,O3):qt(h[3]),gc),(_=h[2])!=null&&_.id?d||(d=bc(),d.c(),d.m(s,null)):d&&(d.d(1),d=null),(!r||g&2&&o!==(o="page-wrapper "+h[1]))&&p(e,"class",o),(!r||g&3)&&x(e,"center-content",h[0])},i(h){r||(M(u,h),M(c,h),r=!0)},o(h){D(u,h),D(c,h),r=!1},d(h){h&&v(e),u&&u.d(h),c&&c.d(h),d&&d.d()}}}function E3(n,e,t){let i;Ge(n,Dr,a=>t(2,i=a));let{$$slots:s={},$$scope:l}=e,{center:o=!1}=e,{class:r=""}=e;return n.$$set=a=>{"center"in a&&t(0,o=a.center),"class"in a&&t(1,r=a.class),"$$scope"in a&&t(3,l=a.$$scope)},[o,r,i,l,s]}class oi extends we{constructor(e){super(),ve(this,e,E3,M3,be,{center:0,class:1})}}function D3(n){let e,t
2025-04-02 16:38:19 +08:00
* @kurkle/color v0.3.4
* https://github.com/kurkle/color#readme
* (c) 2024 Jukka Kurkela
* Released under the MIT License
*/function po(n){return n+.5|0}const Qi=(n,e,t)=>Math.max(Math.min(n,t),e);function Ms(n){return Qi(po(n*2.55),0,255)}function il(n){return Qi(po(n*255),0,255)}function Fi(n){return Qi(po(n/2.55)/100,0,1)}function Ac(n){return Qi(po(n*100),0,100)}const Qn={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},Ga=[..."0123456789ABCDEF"],oS=n=>Ga[n&15],rS=n=>Ga[(n&240)>>4]+Ga[n&15],Eo=n=>(n&240)>>4===(n&15),aS=n=>Eo(n.r)&&Eo(n.g)&&Eo(n.b)&&Eo(n.a);function uS(n){var e=n.length,t;return n[0]==="#"&&(e===4||e===5?t={r:255&Qn[n[1]]*17,g:255&Qn[n[2]]*17,b:255&Qn[n[3]]*17,a:e===5?Qn[n[4]]*17:255}:(e===7||e===9)&&(t={r:Qn[n[1]]<<4|Qn[n[2]],g:Qn[n[3]]<<4|Qn[n[4]],b:Qn[n[5]]<<4|Qn[n[6]],a:e===9?Qn[n[7]]<<4|Qn[n[8]]:255})),t}const fS=(n,e)=>n<255?e(n):"";function cS(n){var e=aS(n)?oS:rS;return n?"#"+e(n.r)+e(n.g)+e(n.b)+fS(n.a,e):void 0}const dS=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Dk(n,e,t){const i=e*Math.min(t,1-t),s=(l,o=(l+n/30)%12)=>t-i*Math.max(Math.min(o-3,9-o,1),-1);return[s(0),s(8),s(4)]}function pS(n,e,t){const i=(s,l=(s+n/60)%6)=>t-t*e*Math.max(Math.min(l,4-l,1),0);return[i(5),i(3),i(1)]}function mS(n,e,t){const i=Dk(n,1,.5);let s;for(e+t>1&&(s=1/(e+t),e*=s,t*=s),s=0;s<3;s++)i[s]*=1-e-t,i[s]+=e;return i}function hS(n,e,t,i,s){return n===s?(e-t)/i+(e<t?6:0):e===s?(t-n)/i+2:(n-e)/i+4}function qu(n){const t=n.r/255,i=n.g/255,s=n.b/255,l=Math.max(t,i,s),o=Math.min(t,i,s),r=(l+o)/2;let a,u,f;return l!==o&&(f=l-o,u=r>.5?f/(2-l-o):f/(l+o),a=hS(t,i,s,f,l),a=a*60+.5),[a|0,u||0,r]}function ju(n,e,t,i){return(Array.isArray(e)?n(e[0],e[1],e[2]):n(e,t,i)).map(il)}function Hu(n,e,t){return ju(Dk,n,e,t)}function _S(n,e,t){return ju(mS,n,e,t)}function gS(n,e,t){return ju(pS,n,e,t)}function Ik(n){return(n%360+360)%360}function bS(n){const e=dS.exec(n);let t=255,i;if(!e)return;e[5]!==i&&(t=e[6]?Ms(+e[5]):il(+e[5]));const s=Ik(+e[2]),l=+e[3]/100,o=+e[4]/100;return e[1]==="hwb"?i=_S(s,l,o):e[1]==="hsv"?i=gS(s,l,o):i=Hu(s,l,o),{r:i[0],g:i[1],b:i[2],a:t}}function kS(n,e){var t=qu(n);t[0]=Ik(t[0]+e),t=Hu(t),n.r=t[0],n.g=t[1],n.b=t[2]}function yS(n){if(!n)return;const e=qu(n),t=e[0],i=Ac(e[1]),s=Ac(e[2]);return n.a<255?`hsla(${t}, ${i}%, ${s}%, ${Fi(n.a)})`:`hsl(${t}, ${i}%, ${s}%)`}const Pc={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"},Nc={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:"
* Chart.js v4.4.9
2025-04-02 16:38:19 +08:00
* https://www.chartjs.org
* (c) 2025 Chart.js Contributors
* Released under the MIT License
*/function Pi(){}const MS=(()=>{let n=0;return()=>n++})();function Vt(n){return n==null}function cn(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 St(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}function Tn(n){return(typeof n=="number"||n instanceof Number)&&isFinite(+n)}function gi(n,e){return Tn(n)?n:e}function Et(n,e){return typeof n>"u"?e:n}const ES=(n,e)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*e:+n;function ft(n,e,t){if(n&&typeof n.call=="function")return n.apply(t,e)}function gt(n,e,t,i){let s,l,o;if(cn(n))for(l=n.length,s=0;s<l;s++)e.call(t,n[s],s);else if(St(n))for(o=Object.keys(n),l=o.length,s=0;s<l;s++)e.call(t,n[o[s]],o[s])}function pr(n,e){let t,i,s,l;if(!n||!e||n.length!==e.length)return!1;for(t=0,i=n.length;t<i;++t)if(s=n[t],l=e[t],s.datasetIndex!==l.datasetIndex||s.index!==l.index)return!1;return!0}function mr(n){if(cn(n))return n.map(mr);if(St(n)){const e=Object.create(null),t=Object.keys(n),i=t.length;let s=0;for(;s<i;++s)e[t[s]]=mr(n[t[s]]);return e}return n}function Ak(n){return["__proto__","prototype","constructor"].indexOf(n)===-1}function DS(n,e,t,i){if(!Ak(n))return;const s=e[n],l=t[n];St(s)&&St(l)?Gs(s,l,i):e[n]=mr(l)}function Gs(n,e,t){const i=cn(e)?e:[e],s=i.length;if(!St(n))return n;t=t||{};const l=t.merger||DS;let o;for(let r=0;r<s;++r){if(o=i[r],!St(o))continue;const a=Object.keys(o);for(let u=0,f=a.length;u<f;++u)l(a[u],n,o,t)}return n}function Ps(n,e){return Gs(n,e,{merger:IS})}function IS(n,e,t){if(!Ak(n))return;const i=e[n],s=t[n];St(i)&&St(s)?Ps(i,s):Object.prototype.hasOwnProperty.call(e,n)||(e[n]=mr(s))}const Fc={"":n=>n,x:n=>n.x,y:n=>n.y};function LS(n){const e=n.split("."),t=[];let i="";for(const s of e)i+=s,i.endsWith("\\")?i=i.slice(0,-1)+".":(t.push(i),i="");return t}function AS(n){const e=LS(n);return t=>{for(const i of e){if(i==="")break;t=t&&t[i]}return t}}function hr(n,e){return(Fc[e]||(Fc[e]=AS(e)))(n)}function zu(n){return n.charAt(0).toUpperCase()+n.slice(1)}const _r=n=>typeof n<"u",sl=n=>typeof n=="function",qc=(n,e)=>{if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1;return!0};function PS(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}const wn=Math.PI,Ci=2*wn,NS=Ci+wn,gr=Number.POSITIVE_INFINITY,RS=wn/180,di=wn/2,bl=wn/4,jc=wn*2/3,Pk=Math.log10,ol=Math.sign;function Ol(n,e,t){return Math.abs(n-e)<t}function Hc(n){const e=Math.round(n);n=Ol(n,e,n/1e3)?e:n;const t=Math.pow(10,Math.floor(Pk(n))),i=n/t;return(i<=1?1:i<=2?2:i<=5?5:10)*t}function FS(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((s,l)=>s-l).pop(),e}function qS(n){return typeof n=="symbol"||typeof n=="object"&&n!==null&&!(Symbol.toPrimitive in n||"toString"in n||"valueOf"in n)}function Xs(n){return!qS(n)&&!isNaN(parseFloat(n))&&isFinite(n)}function jS(n,e){const t=Math.round(n);return t-e<=n&&t+e>=n}function HS(n,e,t){let i,s,l;for(i=0,s=n.length;i<s;i++)l=n[i][t],isNaN(l)||(e.min=Math.min(e.min,l),e.max=Math.max(e.max,l))}function Tl(n){return n*(wn/180)}function zS(n){return n*(180/wn)}function zc(n){if(!Tn(n))return;let e=1,t=0;for(;Math.round(n*e)/e!==n;)e*=10,t++;return t}function US(n,e){const t=e.x-n.x,i=e.y-n.y,s=Math.sqrt(t*t+i*i);let l=Math.atan2(i,t);return l<-.5*wn&&(l+=Ci),{angle:l,distance:s}}function Xa(n,e){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))}function VS(n,e){return(n-e+NS)%Ci-wn}function yi(n){return(n%Ci+Ci)%Ci}function Nk(n,e,t,i){const s=yi(n),l=yi(e),o=yi(t),r=yi(l-s),a=yi(o-s),u=yi(s-l),f=yi(s-o);return s===l||s===o||i&&l===o||r>a&&u<f}function pi(n,e,t){return Math.max(e,Math.min(t,n))}function BS(n){return pi(n,-32768,32767)}function Rk(n,e,t,i=1e-6){return n>=Math.min(e,t)-i&&n<=Math.max(e,t)+i}function Uu(n,e,t){t=t||(o=>n[o]<e);let i=n.length-1,s=0,l;for(;i-s>1;)l=s+i>>1,t(l)?s=l:i=l;return{lo:s,hi:i}}const $l=(n,e,t,i)=>Uu(n,t,i?s=>{const l=n[s][e];return l<t||l===t&&n[s+1][e]===t}:s=>n[s][e]<t),WS=(n,
* Chart.js v4.4.9
2025-04-02 16:38:19 +08:00
* https://www.chartjs.org
* (c) 2025 Chart.js Contributors
* Released under the MIT License
*/class iT{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,t,i,s){const l=t.listeners[s],o=t.duration;l.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=qk.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let t=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const l=i.items;let o=l.length-1,r=!1,a;for(;o>=0;--o)a=l[o],a._active?(a._total>i.duration&&(i.duration=a._total),a.tick(e),r=!0):(l[o]=l[l.length-1],l.pop());r&&(s.draw(),this._notify(s,i,e,"progress")),l.length||(i.running=!1,this._notify(s,i,e,"complete"),i.initial=!1),t+=l.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,s)=>Math.max(i,s._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 s=i.length-1;for(;s>=0;--s)i[s].cancel();t.items=[],this._notify(e,t,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var Ni=new iT;const sd="transparent",lT={boolean(n,e,t){return t>.5?e:n},color(n,e,t){const i=Yc(n||sd),s=i.valid&&Yc(e||sd);return s&&s.valid?s.mix(i,t).hexString():e},number(n,e,t){return n+(e-n)*t}};class sT{constructor(e,t,i,s){const l=t[i];s=Ao([e.to,s,l,e.from]);const o=Ao([e.from,l,s]);this._active=!0,this._fn=e.fn||lT[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=s,this._promises=void 0}active(){return this._active}update(e,t,i){if(this._active){this._notify(!1);const s=this._target[this._prop],l=i-this._start,o=this._duration-l;this._start=i,this._duration=Math.floor(Math.max(o,e.duration)),this._total+=l,this._loop=!!e.loop,this._to=Ao([e.to,t,s,e.from]),this._from=Ao([e.from,s,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const t=e-this._start,i=this._duration,s=this._prop,l=this._from,o=this._loop,r=this._to;let a;if(this._active=l!==r&&(o||t<i),!this._active){this._target[s]=r,this._notify(!0);return}if(t<0){this._target[s]=l;return}a=t/i%2,a=o&&a>1?2-a:a,a=this._easing(Math.min(1,Math.max(0,a))),this._target[s]=this._fn(l,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 s=0;s<i.length;s++)i[s][t]()}}class Qk{constructor(e,t){this._chart=e,this._properties=new Map,this.configure(t)}configure(e){if(!St(e))return;const t=Object.keys(on.animation),i=this._properties;Object.getOwnPropertyNames(e).forEach(s=>{const l=e[s];if(!St(l))return;const o={};for(const r of t)o[r]=l[r];(cn(l.properties)&&l.properties||[s]).forEach(r=>{(r===s||!i.has(r))&&i.set(r,o)})})}_animateOptions(e,t){const i=t.options,s=rT(e,i);if(!s)return[];const l=this._createAnimations(s,i);return i.$shared&&oT(e.options.$animations,i).then(()=>{e.options=i},()=>{}),l}_createAnimations(e,t){const i=this._properties,s=[],l=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"){s.push(...this._animateOptions(e,t));continue}const f=t[u];let c=l[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}l[u]=c=new sT(d,e,u,f),s.push(c)}return s}update(e,t){if(this._properties.size
2025-04-02 16:38:19 +08:00
`)>-1?n.split(`
`):n}function e6(n,e){const{element:t,datasetIndex:i,index:s}=e,l=n.getDatasetMeta(i).controller,{label:o,value:r}=l.getLabelAndValue(s);return{chart:n,label:o,parsed:l.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:r,dataset:l.getDataset(),dataIndex:s,datasetIndex:i,element:t}}function Rd(n,e){const t=n.chart.ctx,{body:i,footer:s,title:l}=n,{boxWidth:o,boxHeight:r}=e,a=$i(e.bodyFont),u=$i(e.titleFont),f=$i(e.footerFont),c=l.length,d=s.length,m=i.length,h=rl(e.padding);let g=h.height,_=0,k=i.reduce((T,O)=>T+O.before.length+O.lines.length+O.after.length,0);if(k+=n.beforeBody.length+n.afterBody.length,c&&(g+=c*u.lineHeight+(c-1)*e.titleSpacing+e.titleMarginBottom),k){const T=e.displayColors?Math.max(r,a.lineHeight):a.lineHeight;g+=m*T+(k-m)*a.lineHeight+(k-1)*e.bodySpacing}d&&(g+=e.footerMarginTop+d*f.lineHeight+(d-1)*e.footerSpacing);let S=0;const $=function(T){_=Math.max(_,t.measureText(T).width+S)};return t.save(),t.font=u.string,gt(n.title,$),t.font=a.string,gt(n.beforeBody.concat(n.afterBody),$),S=e.displayColors?o+2+e.boxPadding:0,gt(i,T=>{gt(T.before,$),gt(T.lines,$),gt(T.after,$)}),S=0,t.font=f.string,gt(n.footer,$),t.restore(),_+=h.width,{width:_,height:g}}function t6(n,e){const{y:t,height:i}=e;return t<i/2?"top":t>n.height-i/2?"bottom":"center"}function n6(n,e,t,i){const{x:s,width:l}=i,o=t.caretSize+t.caretPadding;if(n==="left"&&s+l+o>e.width||n==="right"&&s-l-o<0)return!0}function i6(n,e,t,i){const{x:s,width:l}=t,{width:o,chartArea:{left:r,right:a}}=n;let u="center";return i==="center"?u=s<=(r+a)/2?"left":"right":s<=l/2?u="left":s>=o-l/2&&(u="right"),n6(u,n,e,t)&&(u="center"),u}function Fd(n,e,t){const i=t.yAlign||e.yAlign||t6(n,t);return{xAlign:t.xAlign||e.xAlign||i6(n,e,t,i),yAlign:i}}function l6(n,e){let{x:t,width:i}=n;return e==="right"?t-=i:e==="center"&&(t-=i/2),t}function s6(n,e,t){let{y:i,height:s}=n;return e==="top"?i+=t:e==="bottom"?i-=s+t:i-=s/2,i}function qd(n,e,t,i){const{caretSize:s,caretPadding:l,cornerRadius:o}=n,{xAlign:r,yAlign:a}=t,u=s+l,{topLeft:f,topRight:c,bottomLeft:d,bottomRight:m}=xo(o);let h=l6(e,r);const g=s6(e,a,u);return a==="center"?r==="left"?h+=u:r==="right"&&(h-=u):r==="left"?h-=Math.max(f,d)+s:r==="right"&&(h+=Math.max(c,m)+s),{x:pi(h,0,i.width-e.width),y:pi(g,0,i.height-e.height)}}function Uo(n,e,t){const i=rl(t.padding);return e==="center"?n.x+n.width/2:e==="right"?n.x+n.width-i.right:n.x+i.left}function jd(n){return bi([],Ri(n))}function o6(n,e,t){return Pl(n,{tooltip:e,tooltipItems:t,type:"tooltip"})}function Hd(n,e){const t=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return t?n.override(t):n}const my={beforeTitle:Pi,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:Pi,beforeBody:Pi,beforeLabel:Pi,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 Vt(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:Pi,afterBody:Pi,beforeFooter:Pi,footer:Pi,afterFooter:Pi};function Pn(n,e,t,i){const s=n[e].call(t,i);return typeof s>"u"?my[e].call(t,i):s}class lu extends Ll{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
2025-04-02 16:38:19 +08:00
* chartjs-adapter-luxon v1.3.1
* https://www.chartjs.org
* (c) 2023 chartjs-adapter-luxon Contributors
* Released under the MIT license
*/const p6={datetime:Xe.DATETIME_MED_WITH_SECONDS,millisecond:"h:mm:ss.SSS a",second:Xe.TIME_WITH_SECONDS,minute:Xe.TIME_SIMPLE,hour:{hour:"numeric"},day:{day:"numeric",month:"short"},week:"DD",month:{month:"short",year:"numeric"},quarter:"'Q'q - yyyy",year:{year:"numeric"}};ey._date.override({_id:"luxon",_create:function(n){return Xe.fromMillis(n,this.options)},init(n){this.options.locale||(this.options.locale=n.locale)},formats:function(){return p6},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()}});var r9=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function m6(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var hy={exports:{}};/*! Hammer.JS - v2.0.7 - 2016-04-22
2025-04-02 16:38:19 +08:00
* http://hammerjs.github.io/
*
* Copyright (c) 2016 Jorik Tangelder;
* Licensed under the MIT license */(function(n){(function(e,t,i,s){var l=["","webkit","Moz","MS","ms","o"],o=t.createElement("div"),r="function",a=Math.round,u=Math.abs,f=Date.now;function c(K,Q,ie){return setTimeout($(K,ie),Q)}function d(K,Q,ie){return Array.isArray(K)?(m(K,ie[Q],ie),!0):!1}function m(K,Q,ie){var he;if(K)if(K.forEach)K.forEach(Q,ie);else if(K.length!==s)for(he=0;he<K.length;)Q.call(ie,K[he],he,K),he++;else for(he in K)K.hasOwnProperty(he)&&Q.call(ie,K[he],he,K)}function h(K,Q,ie){var he="DEPRECATED METHOD: "+Q+`
`+ie+` AT
`;return function(){var Ae=new Error("get-stack-trace"),Ze=Ae&&Ae.stack?Ae.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",_t=e.console&&(e.console.warn||e.console.log);return _t&&_t.call(e.console,he,Ze),K.apply(this,arguments)}}var g;typeof Object.assign!="function"?g=function(Q){if(Q===s||Q===null)throw new TypeError("Cannot convert undefined or null to object");for(var ie=Object(Q),he=1;he<arguments.length;he++){var Ae=arguments[he];if(Ae!==s&&Ae!==null)for(var Ze in Ae)Ae.hasOwnProperty(Ze)&&(ie[Ze]=Ae[Ze])}return ie}:g=Object.assign;var _=h(function(Q,ie,he){for(var Ae=Object.keys(ie),Ze=0;Ze<Ae.length;)(!he||he&&Q[Ae[Ze]]===s)&&(Q[Ae[Ze]]=ie[Ae[Ze]]),Ze++;return Q},"extend","Use `assign`."),k=h(function(Q,ie){return _(Q,ie,!0)},"merge","Use `assign`.");function S(K,Q,ie){var he=Q.prototype,Ae;Ae=K.prototype=Object.create(he),Ae.constructor=K,Ae._super=he,ie&&g(Ae,ie)}function $(K,Q){return function(){return K.apply(Q,arguments)}}function T(K,Q){return typeof K==r?K.apply(Q&&Q[0]||s,Q):K}function O(K,Q){return K===s?Q:K}function E(K,Q,ie){m(P(Q),function(he){K.addEventListener(he,ie,!1)})}function L(K,Q,ie){m(P(Q),function(he){K.removeEventListener(he,ie,!1)})}function I(K,Q){for(;K;){if(K==Q)return!0;K=K.parentNode}return!1}function A(K,Q){return K.indexOf(Q)>-1}function P(K){return K.trim().split(/\s+/g)}function N(K,Q,ie){if(K.indexOf&&!ie)return K.indexOf(Q);for(var he=0;he<K.length;){if(ie&&K[he][ie]==Q||!ie&&K[he]===Q)return he;he++}return-1}function R(K){return Array.prototype.slice.call(K,0)}function z(K,Q,ie){for(var he=[],Ae=[],Ze=0;Ze<K.length;){var _t=K[Ze][Q];N(Ae,_t)<0&&he.push(K[Ze]),Ae[Ze]=_t,Ze++}return he=he.sort(function(hn,Cn){return hn[Q]>Cn[Q]}),he}function F(K,Q){for(var ie,he,Ae=Q[0].toUpperCase()+Q.slice(1),Ze=0;Ze<l.length;){if(ie=l[Ze],he=ie?ie+Ae:Q,he in K)return he;Ze++}return s}var B=1;function J(){return B++}function V(K){var Q=K.ownerDocument||K;return Q.defaultView||Q.parentWindow||e}var Z=/mobile|tablet|ip(ad|hone|od)|android/i,G="ontouchstart"in e,de=F(e,"PointerEvent")!==s,pe=G&&Z.test(navigator.userAgent),ae="touch",Ce="pen",Ye="mouse",Ke="kinect",ct=25,et=1,xe=2,Be=4,ut=8,Bt=1,Ue=2,De=4,ot=8,Ie=16,We=Ue|De,Te=ot|Ie,nt=We|Te,zt=["x","y"],Ne=["clientX","clientY"];function Me(K,Q){var ie=this;this.manager=K,this.callback=Q,this.element=K.element,this.target=K.options.inputTarget,this.domHandler=function(he){T(K.options.enable,[K])&&ie.handler(he)},this.init()}Me.prototype={handler:function(){},init:function(){this.evEl&&E(this.element,this.evEl,this.domHandler),this.evTarget&&E(this.target,this.evTarget,this.domHandler),this.evWin&&E(V(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(V(this.element),this.evWin,this.domHandler)}};function bt(K){var Q,ie=K.options.inputClass;return ie?Q=ie:de?Q=cl:pe?Q=Je:G?Q=Qe:Q=Ui,new Q(K,Ut)}function Ut(K,Q,ie){var he=ie.pointers.length,Ae=ie.changedPointers.length,Ze=Q&et&&he-Ae===0,_t=Q&(Be|ut)&&he-Ae===0;ie.isFirst=!!Ze,ie.isFinal=!!_t,Ze&&(K.session={}),ie.eventType=Q,Pt(K,ie),K.emit("hammer.input",ie),K.recognize(ie),K.session.prevInput=ie}function Pt(K,Q){var ie=K.session,he=Q.pointers,Ae=he.length;ie.firstInput||(ie.firstInput=Gt(Q)),Ae>1&&!ie.firstMultiple?ie.firstMultiple=Gt(Q):Ae===1&&(ie.firstMultiple=!1);var Ze=ie.firstInput,_t=ie.firstMultiple,fn=_t?_t.center:Ze.center,hn=Q.center=gn(he);Q.timeStamp=f(),Q.deltaTime=Q.timeStamp-Ze.timeStamp,Q.angle=yt(fn,hn),Q.distance=ri(fn,hn),Pe(ie,Q),Q.offsetDirection=Ei(Q.deltaX,Q.deltaY);var Cn=dn(Q.deltaTime,Q.deltaX,Q.deltaY);Q.overallVelocityX=Cn.x,Q.overallVelocityY=Cn.y,Q.overallVelocity=u(Cn.x)>u(Cn.y)?Cn.x:Cn.y,Q.scale=_t?un(_t.pointers,he):1,Q.rotation=_t?Zn(_t.pointers,he):0,Q.maxPointers=ie.prevInput?Q.pointers.length>ie.prevInput.maxPointers?Q.pointers.length:ie.prevInput.maxPointers:Q.pointers.length,jt(ie,Q);var _i=K.element;I(Q.srcEvent.target,_i)&&(_i=
2025-04-02 16:38:19 +08:00
* chartjs-plugin-zoom v2.2.0
* https://www.chartjs.org/chartjs-plugin-zoom/2.2.0/
* (c) 2016-2024 chartjs-plugin-zoom Contributors
* Released under the MIT License
*/const eo=n=>n&&n.enabled&&n.modifierKey,_y=(n,e)=>n&&e[n+"Key"],xu=(n,e)=>n&&!e[n+"Key"];function al(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 ga(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 _6(n,e){let t;return function(){return clearTimeout(t),t=setTimeout(n,e),e}}function g6({x:n,y:e},t){const i=t.scales,s=Object.keys(i);for(let l=0;l<s.length;l++){const o=i[s[l]];if(e>=o.top&&e<=o.bottom&&n>=o.left&&n<=o.right)return o}return null}function gy(n,e,t){const{mode:i="xy",scaleMode:s,overScaleMode:l}=n||{},o=g6(e,t),r=ga(i,t),a=ga(s,t);if(l){const f=ga(l,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 gt(t.scales,function(f){r[f.axis]&&u.push(f)}),u}const ou=new WeakMap;function Zt(n){let e=ou.get(n);return e||(e={originalScaleLimits:{},updatedScaleLimits:{},handlers:{},panDelta:{},dragging:!1,panning:!1},ou.set(n,e)),e}function b6(n){ou.delete(n)}function by(n,e,t,i){const s=Math.max(0,Math.min(1,(n-e)/t||0)),l=1-s;return{min:i*s,max:i*l}}function ky(n,e){const t=n.isHorizontal()?e.x:e.y;return n.getValueForPixel(t)}function yy(n,e,t){const i=n.max-n.min,s=i*(e-1),l=ky(n,t);return by(l,n.min,i,s)}function k6(n,e,t){const i=ky(n,t);if(i===void 0)return{min:n.min,max:n.max};const s=Math.log10(n.min),l=Math.log10(n.max),o=Math.log10(i),r=l-s,a=r*(e-1),u=by(o,s,r,a);return{min:Math.pow(10,s+u.min),max:Math.pow(10,l-u.max)}}function y6(n,e){return e&&(e[n.id]||e[n.axis])||{}}function Jd(n,e,t,i,s){let l=t[i];if(l==="original"){const o=n.originalScaleLimits[e.id][i];l=Et(o.options,o.scale)}return Et(l,s)}function v6(n,e,t){const i=n.getValueForPixel(e),s=n.getValueForPixel(t);return{min:Math.min(i,s),max:Math.max(i,s)}}function w6(n,{min:e,max:t,minLimit:i,maxLimit:s},l){const o=(n-t+e)/2;e-=o,t+=o;const r=l.min.options??l.min.scale,a=l.max.options??l.max.scale,u=n/1e6;return Ol(e,r,u)&&(e=r),Ol(t,a,u)&&(t=a),e<i?(e=i,t=Math.min(i+n,s)):t>s&&(t=s,e=Math.max(s-n,i)),{min:e,max:t}}function Nl(n,{min:e,max:t},i,s=!1){const l=Zt(n.chart),{options:o}=n,r=y6(n,i),{minRange:a=0}=r,u=Jd(l,n,r,"min",-1/0),f=Jd(l,n,r,"max",1/0);if(s==="pan"&&(e<u||t>f))return!0;const c=n.max-n.min,d=s?Math.max(t-e,a):c;if(s&&d===a&&c<=a)return!0;const m=w6(d,{min:e,max:t,minLimit:u,maxLimit:f},l.originalScaleLimits[n.id]);return o.min=m.min,o.max=m.max,l.updatedScaleLimits[n.id]=m,n.parse(m.min)!==n.min||n.parse(m.max)!==n.max}function S6(n,e,t,i){const s=yy(n,e,t),l={min:n.min+s.min,max:n.max-s.max};return Nl(n,l,i,!0)}function T6(n,e,t,i){const s=k6(n,e,t);return Nl(n,s,i,!0)}function $6(n,e,t,i){Nl(n,v6(n,e,t),i,!0)}const Zd=n=>n===0||isNaN(n)?0:n<0?Math.min(Math.round(n),-1):Math.max(Math.round(n),1);function C6(n){const t=n.getLabels().length-1;n.min>0&&(n.min-=1),n.max<t&&(n.max+=1)}function O6(n,e,t,i){const s=yy(n,e,t);n.min===n.max&&e<1&&C6(n);const l={min:n.min+Zd(s.min),max:n.max-Zd(s.max)};return Nl(n,l,i,!0)}function M6(n){return n.isHorizontal()?n.width:n.height}function E6(n,e,t){const s=n.getLabels().length-1;let{min:l,max:o}=n;const r=Math.max(o-l,1),a=Math.round(M6(n)/Math.max(r,10)),u=Math.round(Math.abs(e/a));let f;return e<-a?(o=Math.min(o+u,s),l=r===1?o:o-r,f=o===s):e>a&&(l=Math.max(0,l-u),o=r===1?l:l+r,f=l===0),Nl(n,{min:l,max:o},t)||f}const D6={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 vy(n,e,t,i=!1){const{min:s,max:l,options:o}=n,r=o.time&&o.time.round,a=D6[r]||0,u=n.getValueForPixel(n.getPixelForValue(s+a)-e),f=n.getValueForPixel(n.getPixelForValue(l+a)-e);return isNaN(u)||isNaN(f)?!0:Nl(n,{min:u,max:f},t,i?"pan":!1)}function Gd(n,e,t){return vy(n,e,t,!0)}const ru={category:O6,default:S6,logarithmic:T6},au={default:$6},uu={category:E6,default:vy,logarithmic:Gd,timeseries:Gd};function I6(n,e,t){const{id:i,options:{min:s,max:l}}=n;if(!e[i]||!t[i])return!0;const o=t[i];return o.min!==s||o.max
2025-04-16 13:14:56 +08:00
`),i=b("div");for(let o=0;o<l.length;o+=1)l[o].c();p(i,"class","inline-flex flex-gap-5"),p(e,"class",n[0])},m(o,r){w(o,e,r),y(e,t),y(e,i);for(let a=0;a<l.length;a+=1)l[a]&&l[a].m(i,null)},p(o,[r]){r&1&&p(e,"class",o[0])},i:te,o:te,d(o){o&&v(e),dt(l,o)}}}function D$(n,e,t){let{class:i=""}=e;return n.$$set=s=>{"class"in s&&t(0,i=s.class)},[i]}class Ey extends we{constructor(e){super(),ve(this,e,D$,E$,be,{class:0})}}function I$(n){let e,t,i,s,l,o,r,a,u,f,c;return t=new fe({props:{class:"form-field required",name:"logs.maxDays",$$slots:{default:[A$,({uniqueId:d})=>({23:d}),({uniqueId:d})=>d?8388608:0]},$$scope:{ctx:n}}}),s=new fe({props:{class:"form-field",name:"logs.minLevel",$$slots:{default:[P$,({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:[N$,({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:[R$,({uniqueId:d})=>({23:d}),({uniqueId:d})=>d?8388608:0]},$$scope:{ctx:n}}}),{c(){e=b("form"),H(t.$$.fragment),i=C(),H(s.$$.fragment),l=C(),H(o.$$.fragment),r=C(),H(a.$$.fragment),p(e,"id",n[6]),p(e,"class","grid"),p(e,"autocomplete","off")},m(d,m){w(d,e,m),q(t,e,null),y(e,i),q(s,e,null),y(e,l),q(o,e,null),y(e,r),q(a,e,null),u=!0,f||(c=Y(e,"submit",it(n[7])),f=!0)},p(d,m){const h={};m&25165826&&(h.$$scope={dirty:m,ctx:d}),t.$set(h);const g={};m&25165826&&(g.$$scope={dirty:m,ctx:d}),s.$set(g);const _={};m&25165826&&(_.$$scope={dirty:m,ctx:d}),o.$set(_);const k={};m&25165826&&(k.$$scope={dirty:m,ctx:d}),a.$set(k)},i(d){u||(M(t.$$.fragment,d),M(s.$$.fragment,d),M(o.$$.fragment,d),M(a.$$.fragment,d),u=!0)},o(d){D(t.$$.fragment,d),D(s.$$.fragment,d),D(o.$$.fragment,d),D(a.$$.fragment,d),u=!1},d(d){d&&v(e),j(t),j(s),j(o),j(a),f=!1,c()}}}function L$(n){let e;return{c(){e=b("div"),e.innerHTML='<div class="loader"></div>',p(e,"class","block txt-center")},m(t,i){w(t,e,i)},p:te,i:te,o:te,d(t){t&&v(e)}}}function A$(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=b("label"),t=W("Max days retention"),s=C(),l=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(l,"type","number"),p(l,"id",o=n[23]),l.required=!0,p(a,"class","help-block")},m(c,d){w(c,e,d),y(e,t),w(c,s,d),w(c,l,d),me(l,n[1].logs.maxDays),w(c,r,d),w(c,a,d),u||(f=Y(l,"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(l,"id",o),d&2&&mt(l.value)!==c[1].logs.maxDays&&me(l,c[1].logs.maxDays)},d(c){c&&(v(e),v(s),v(l),v(r),v(a)),u=!1,f()}}}function P$(n){let e,t,i,s,l,o,r,a,u,f,c,d,m;return f=new Ey({}),{c(){e=b("label"),t=W("Min log level"),s=C(),l=b("input"),o=C(),r=b("div"),a=b("p"),a.textContent="Logs with level below the minimum will be ignored.",u=C(),H(f.$$.fragment),p(e,"for",i=n[23]),p(l,"type","number"),l.required=!0,p(l,"min","-100"),p(l,"max","100"),p(r,"class","help-block")},m(h,g){w(h,e,g),y(e,t),w(h,s,g),w(h,l,g),me(l,n[1].logs.minLevel),w(h,o,g),w(h,r,g),y(r,a),y(r,u),q(f,r,null),c=!0,d||(m=Y(l,"input",n[12]),d=!0)},p(h,g){(!c||g&8388608&&i!==(i=h[23]))&&p(e,"for",i),g&2&&mt(l.value)!==h[1].logs.minLevel&&me(l,h[1].logs.minLevel)},i(h){c||(M(f.$$.fragment,h),c=!0)},o(h){D(f.$$.fragment,h),c=!1},d(h){h&&(v(e),v(s),v(l),v(o),v(r)),j(f),d=!1,m()}}}function N$(n){let e,t,i,s,l,o,r,a;return{c(){e=b("input"),i=C(),s=b("label"),l=W("Enable IP logging"),p(e,"type","checkbox"),p(e,"id",t=n[23]),p(s,"for",o=n[23])},m(u,f){w(u,e,f),e.checked=n[1].logs.logIP,w(u,i,f),w(u,s,f),y(s,l),r||(a=Y(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(s,"for",o)},d(u){u&&(v(e),v(i),v(s)),r=!1,a()}}}function R$(n){let e,t,i,s,l,o,r,a;return{c(){e=b("input"),i=C(),s=b("label"),l=W("Enable Auth Id logging"),p(e,"type","checkbox"),p(e,"id",t=n[23]),p(s,"for",o=n[23])},m(u,f){w(u,e,f),e.checked=n[1].logs.logAuthId,w(u,i,f),w(u,s,f),y(s,l),r||(a=Y(e,"change",n[14]),r=!0)},p(u,f){f&8388608&&t!==(
`);for(let l=0;l<s.length;l+=1)s[l].c();p(e,"class","help-block")},m(l,o){w(l,e,o),y(e,t);for(let r=0;r<s.length;r+=1)s[r]&&s[r].m(e,null)},p(l,o){if(o&264){i=ce(l[3]);let r;for(r=0;r<i.length;r+=1){const a=Op(l,i,r);s[r]?s[r].p(a,o):(s[r]=Ep(a),s[r].c(),s[r].m(e,null))}for(;r<s.length;r+=1)s[r].d(1);s.length=i.length}},d(l){l&&v(e),dt(s,l)}}}function Ep(n){let e,t="{"+n[25]+"}",i,s,l,o;function r(){return n[15](n[25])}return{c(){e=b("button"),i=W(t),s=W(" "),p(e,"type","button"),p(e,"class","label label-sm link-primary txt-mono")},m(a,u){w(a,e,u),y(e,i),w(a,s,u),l||(o=Y(e,"click",r),l=!0)},p(a,u){n=a,u&8&&t!==(t="{"+n[25]+"}")&&se(i,t)},d(a){a&&(v(e),v(s)),l=!1,o()}}}function rC(n){var d;let e,t,i,s,l,o,r,a,u,f,c=((d=n[3])==null?void 0:d.length)>0&&Mp(n);return{c(){e=b("label"),t=W("Subject"),s=C(),l=b("input"),r=C(),c&&c.c(),a=ke(),p(e,"for",i=n[24]),p(l,"type","text"),p(l,"id",o=n[24]),p(l,"spellcheck","false"),l.required=!0},m(m,h){w(m,e,h),y(e,t),w(m,s,h),w(m,l,h),me(l,n[0].subject),w(m,r,h),c&&c.m(m,h),w(m,a,h),u||(f=Y(l,"input",n[14]),u=!0)},p(m,h){var g;h&16777216&&i!==(i=m[24])&&p(e,"for",i),h&16777216&&o!==(o=m[24])&&p(l,"id",o),h&1&&l.value!==m[0].subject&&me(l,m[0].subject),((g=m[3])==null?void 0:g.length)>0?c?c.p(m,h):(c=Mp(m),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(m){m&&(v(e),v(s),v(l),v(r),v(a)),c&&c.d(m),u=!1,f()}}}function aC(n){let e,t,i,s;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(l,o){w(l,e,o),me(e,n[0].body),i||(s=Y(e,"input",n[17]),i=!0)},p(l,o){o&16777216&&t!==(t=l[24])&&p(e,"id",t),o&1&&me(e,l[0].body)},i:te,o:te,d(l){l&&v(e),i=!1,s()}}}function uC(n){let e,t,i,s;function l(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=Ht(o,r(n)),ne.push(()=>ge(e,"value",l))),{c(){e&&H(e.$$.fragment),i=ke()},m(a,u){e&&q(e,a,u),w(a,i,u),s=!0},p(a,u){if(u&32&&o!==(o=a[5])){if(e){oe();const f=e;D(f.$$.fragment,1,0,()=>{j(f,1)}),re()}o?(e=Ht(o,r(a)),ne.push(()=>ge(e,"value",l)),H(e.$$.fragment),M(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,$e(()=>t=!1)),e.$set(f)}},i(a){s||(e&&M(e.$$.fragment,a),s=!0)},o(a){e&&D(e.$$.fragment,a),s=!1},d(a){a&&v(i),e&&j(e,a)}}}function Dp(n){let e,t,i=ce(n[3]),s=[];for(let l=0;l<i.length;l+=1)s[l]=Ip(Cp(n,i,l));return{c(){e=b("div"),t=W(`Available placeholder parameters:
2025-04-16 13:14:56 +08:00
`);for(let l=0;l<s.length;l+=1)s[l].c();p(e,"class","help-block")},m(l,o){w(l,e,o),y(e,t);for(let r=0;r<s.length;r+=1)s[r]&&s[r].m(e,null)},p(l,o){if(o&264){i=ce(l[3]);let r;for(r=0;r<i.length;r+=1){const a=Cp(l,i,r);s[r]?s[r].p(a,o):(s[r]=Ip(a),s[r].c(),s[r].m(e,null))}for(;r<s.length;r+=1)s[r].d(1);s.length=i.length}},d(l){l&&v(e),dt(s,l)}}}function Ip(n){let e,t="{"+n[25]+"}",i,s,l,o;function r(){return n[18](n[25])}return{c(){e=b("button"),i=W(t),s=W(" "),p(e,"type","button"),p(e,"class","label label-sm link-primary txt-mono")},m(a,u){w(a,e,u),y(e,i),w(a,s,u),l||(o=Y(e,"click",r),l=!0)},p(a,u){n=a,u&8&&t!==(t="{"+n[25]+"}")&&se(i,t)},d(a){a&&(v(e),v(s)),l=!1,o()}}}function fC(n){var h;let e,t,i,s,l,o,r,a,u;const f=[uC,aC],c=[];function d(g,_){return g[5]&&!g[6]?0:1}l=d(n),o=c[l]=f[l](n);let m=((h=n[3])==null?void 0:h.length)>0&&Dp(n);return{c(){e=b("label"),t=W("Body (HTML)"),s=C(),o.c(),r=C(),m&&m.c(),a=ke(),p(e,"for",i=n[24])},m(g,_){w(g,e,_),y(e,t),w(g,s,_),c[l].m(g,_),w(g,r,_),m&&m.m(g,_),w(g,a,_),u=!0},p(g,_){var S;(!u||_&16777216&&i!==(i=g[24]))&&p(e,"for",i);let k=l;l=d(g),l===k?c[l].p(g,_):(oe(),D(c[k],1,1,()=>{c[k]=null}),re(),o=c[l],o?o.p(g,_):(o=c[l]=f[l](g),o.c()),M(o,1),o.m(r.parentNode,r)),((S=g[3])==null?void 0:S.length)>0?m?m.p(g,_):(m=Dp(g),m.c(),m.m(a.parentNode,a)):m&&(m.d(1),m=null)},i(g){u||(M(o),u=!0)},o(g){D(o),u=!1},d(g){g&&(v(e),v(s),v(r),v(a)),c[l].d(g),m&&m.d(g)}}}function cC(n){let e,t,i,s;return e=new fe({props:{class:"form-field required",name:n[1]+".subject",$$slots:{default:[rC,({uniqueId:l})=>({24:l}),({uniqueId:l})=>l?16777216:0]},$$scope:{ctx:n}}}),i=new fe({props:{class:"form-field m-0 required",name:n[1]+".body",$$slots:{default:[fC,({uniqueId:l})=>({24:l}),({uniqueId:l})=>l?16777216:0]},$$scope:{ctx:n}}}),{c(){H(e.$$.fragment),t=C(),H(i.$$.fragment)},m(l,o){q(e,l,o),w(l,t,o),q(i,l,o),s=!0},p(l,o){const r={};o&2&&(r.name=l[1]+".subject"),o&1090519049&&(r.$$scope={dirty:o,ctx:l}),e.$set(r);const a={};o&2&&(a.name=l[1]+".body"),o&1090519145&&(a.$$scope={dirty:o,ctx:l}),i.$set(a)},i(l){s||(M(e.$$.fragment,l),M(i.$$.fragment,l),s=!0)},o(l){D(e.$$.fragment,l),D(i.$$.fragment,l),s=!1},d(l){l&&v(t),j(e,l),j(i,l)}}}function Lp(n){let e,t,i,s,l;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){w(o,e,r),i=!0,s||(l=Oe(Re.call(null,e,{text:"Has errors",position:"left"})),s=!0)},i(o){i||(o&&tt(()=>{i&&(t||(t=qe(e,Ct,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=qe(e,Ct,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&v(e),o&&t&&t.end(),s=!1,l()}}}function dC(n){let e,t,i,s,l,o,r,a,u,f=n[7]&&Lp();return{c(){e=b("div"),t=b("i"),i=C(),s=b("span"),l=W(n[2]),o=C(),r=b("div"),a=C(),f&&f.c(),u=ke(),p(t,"class","ri-draft-line"),p(s,"class","txt"),p(e,"class","inline-flex"),p(r,"class","flex-fill")},m(c,d){w(c,e,d),y(e,t),y(e,i),y(e,s),y(s,l),w(c,o,d),w(c,r,d),w(c,a,d),f&&f.m(c,d),w(c,u,d)},p(c,d){d&4&&se(l,c[2]),c[7]?f?d&128&&M(f,1):(f=Lp(),f.c(),M(f,1),f.m(u.parentNode,u)):f&&(oe(),D(f,1,1,()=>{f=null}),re())},d(c){c&&(v(e),v(o),v(r),v(a),v(u)),f&&f.d(c)}}}function pC(n){let e,t;const i=[n[9]];let s={$$slots:{header:[dC],default:[cC]},$$scope:{ctx:n}};for(let l=0;l<i.length;l+=1)s=je(s,i[l]);return e=new zi({props:s}),n[19](e),e.$on("expand",n[20]),e.$on("collapse",n[21]),e.$on("toggle",n[22]),{c(){H(e.$$.fragment)},m(l,o){q(e,l,o),t=!0},p(l,[o]){const r=o&512?vt(i,[At(l[9])]):{};o&1073742063&&(r.$$scope={dirty:o,ctx:l}),e.$set(r)},i(l){t||(M(e.$$.fragment,l),t=!0)},o(l){D(e.$$.fragment,l),t=!1},d(l){n[19](null),j(e,l)}}}let Ap;function mC(n,e,t){let i;const s=["key","title","config","placeholders","expand","collapse","collapseSiblings"];let l=lt(e,s),o;Ge(n,$n,R=>t(13,o=R));let{key:r}=e,{title:a}=e,{config:u={}}=e,{placeholders:f=[]}=e,c,d=Ap,m=!1;function h(){c==null||c.expand()}function g(){c==null||c.collapse()}function _(){c==null||c.collapseSiblings()}async function k(){d||m||(t(6,m=!0),t(5,d=(await $t(async()=>{const{default:R}=await import("./CodeEditor-sxuxxBKk.js");return{default:R}},__vite__mapDeps([13,1]),import.meta.url)).d
<code>email != &#39;&#39;</code>.`,s=C(),l=b("p"),l.textContent="Leave the rule empty to require MFA for everyone."},m(o,r){w(o,e,r),w(o,t,r),w(o,i,r),w(o,s,r),w(o,l,r)},p:te,d(o){o&&(v(e),v(t),v(i),v(s),v(l))}}}function NC(n){let e,t,i,s,l,o,r,a,u;s=new fe({props:{class:"form-field form-field-toggle",name:"mfa.enabled",$$slots:{default:[AC,({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:[PC]},$$scope:{ctx:n}};return n[0].mfa.rule!==void 0&&(c.rule=n[0].mfa.rule),r=new ll({props:c}),ne.push(()=>ge(r,"rule",f)),{c(){e=b("div"),e.innerHTML=`<p class="txt-bold">This feature is experimental and may change in the future.</p> <p>Multi-factor authentication (MFA) requires the user to authenticate with any 2 different auth
2025-04-02 16:38:19 +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"),H(s.$$.fragment),l=C(),o=b("div"),H(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){w(d,e,m),w(d,t,m),w(d,i,m),q(s,i,null),y(i,l),y(i,o),q(r,o,null),u=!0},p(d,m){const h={};m&97&&(h.$$scope={dirty:m,ctx:d}),s.$set(h);const g={};m&1&&(g.disabled=!d[0].mfa.enabled),m&1&&(g.collection=d[0]),m&64&&(g.$$scope={dirty:m,ctx:d}),!a&&m&1&&(a=!0,g.rule=d[0].mfa.rule,$e(()=>a=!1)),r.$set(g),(!u||m&1)&&x(o,"fade",!d[0].mfa.enabled)},i(d){u||(M(s.$$.fragment,d),M(r.$$.fragment,d),u=!0)},o(d){D(s.$$.fragment,d),D(r.$$.fragment,d),u=!1},d(d){d&&(v(e),v(t),v(i)),j(s),j(r)}}}function RC(n){let e;return{c(){e=b("span"),e.textContent="Disabled",p(e,"class","label")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function FC(n){let e;return{c(){e=b("span"),e.textContent="Enabled",p(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function Bp(n){let e,t,i,s,l;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){w(o,e,r),i=!0,s||(l=Oe(Re.call(null,e,{text:"Has errors",position:"left"})),s=!0)},i(o){i||(o&&tt(()=>{i&&(t||(t=qe(e,Ct,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=qe(e,Ct,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&v(e),o&&t&&t.end(),s=!1,l()}}}function qC(n){let e,t,i,s,l,o;function r(c,d){return c[0].mfa.enabled?FC:RC}let a=r(n),u=a(n),f=n[1]&&Bp();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"),s=C(),u.c(),l=C(),f&&f.c(),o=ke(),p(e,"class","inline-flex"),p(i,"class","flex-fill")},m(c,d){w(c,e,d),w(c,t,d),w(c,i,d),w(c,s,d),u.m(c,d),w(c,l,d),f&&f.m(c,d),w(c,o,d)},p(c,d){a!==(a=r(c))&&(u.d(1),u=a(c),u&&(u.c(),u.m(l.parentNode,l))),c[1]?f?d&2&&M(f,1):(f=Bp(),f.c(),M(f,1),f.m(o.parentNode,o)):f&&(oe(),D(f,1,1,()=>{f=null}),re())},d(c){c&&(v(e),v(t),v(i),v(s),v(l),v(o)),u.d(c),f&&f.d(c)}}}function jC(n){let e,t;return e=new zi({props:{single:!0,$$slots:{header:[qC],default:[NC]},$$scope:{ctx:n}}}),{c(){H(e.$$.fragment)},m(i,s){q(e,i,s),t=!0},p(i,[s]){const l={};s&67&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(M(e.$$.fragment,i),t=!0)},o(i){D(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function HC(n,e,t){let i,s;Ge(n,$n,a=>t(2,s=a));let{collection:l}=e;function o(){l.mfa.enabled=this.checked,t(0,l)}function r(a){n.$$.not_equal(l.mfa.rule,a)&&(l.mfa.rule=a,t(0,l))}return n.$$set=a=>{"collection"in a&&t(0,l=a.collection)},n.$$.update=()=>{n.$$.dirty&4&&t(1,i=!U.isEmpty(s==null?void 0:s.mfa))},[l,i,s,o,r]}class zC extends we{constructor(e){super(),ve(this,e,HC,jC,be,{collection:0})}}const UC=n=>({}),Wp=n=>({});function Yp(n,e,t){const i=n.slice();return i[50]=e[t],i}const VC=n=>({}),Kp=n=>({});function Jp(n,e,t){const i=n.slice();return i[50]=e[t],i[54]=t,i}function Zp(n){let e,t,i;return{c(){e=b("div"),t=W(n[2]),i=C(),p(e,"class","block txt-placeholder"),x(e,"link-hint",!n[5]&&!n[6])},m(s,l){w(s,e,l),y(e,t),y(e,i)},p(s,l){l[0]&4&&se(t,s[2]),l[0]&96&&x(e,"link-hint",!s[5]&&!s[6])},d(s){s&&v(e)}}}function BC(n){let e,t=n[50]+"",i;return{c(){e=b("span"),i=W(t),p(e,"class","txt")},m(s,l){w(s,e,l),y(e,i)},p(s,l){l[0]&1&&t!==(t=s[50]+"")&&se(i,t)},i:te,o:te,d(s){s&&v(e)}}}function WC(n){let e,t,i;const s=[{item:n[50]},n[11]];var l=n[10];function o(r,a){let u={};for(let f=0;f<s.length;f+=1)u=je(u,s[f]);return a!==void 0&&a[0]&2049&&(u=je(u,vt(s,[a[0]&1&&{item:r[50]},a[0]&2048&&At(r[11])]))),{props:u}}return l&&(e=Ht(l,o(n))),{c(){e&&H(e.$$.fragment),t=ke()},m(r,a){e&&q(e,r,a),w(r,t,a),i=!0},p(r,a){if(a[0]&1024&&l!==(l=r[10])){if(e){oe();const u=e;D(u.$$.fragment,1,0,()=>{j(u,1)}),re()}l?(e=Ht(l,o(r,a)),H(e.$$.fragment),M(e.$$.fragment,1),q(e,t.parentNode,t)):e=null}else if(l){const u=a[0]&2049?vt(s,[a[0]&1&&{item:r[50]},a[0]&2048&&At(r[11])]):{};e.$set(u)}},i(r){i||(e&&M(e.$$.fragment,r),i=!0)},
2025-04-02 16:38:19 +08:00
...
-----END PRIVATE KEY-----`),p(a,"class","help-block")},m(c,d){w(c,e,d),y(e,t),w(c,s,d),w(c,l,d),me(l,n[5]),w(c,r,d),w(c,a,d),u||(f=Y(l,"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(l,"id",o),d&32&&me(l,c[5])},d(c){c&&(v(e),v(s),v(l),v(r),v(a)),u=!1,f()}}}function g8(n){let e,t,i,s,l,o,r,a,u,f,c,d,m,h,g,_,k,S;return s=new fe({props:{class:"form-field required",name:"clientId",$$slots:{default:[d8,({uniqueId:$})=>({23:$}),({uniqueId:$})=>$?8388608:0]},$$scope:{ctx:n}}}),r=new fe({props:{class:"form-field required",name:"teamId",$$slots:{default:[p8,({uniqueId:$})=>({23:$}),({uniqueId:$})=>$?8388608:0]},$$scope:{ctx:n}}}),f=new fe({props:{class:"form-field required",name:"keyId",$$slots:{default:[m8,({uniqueId:$})=>({23:$}),({uniqueId:$})=>$?8388608:0]},$$scope:{ctx:n}}}),m=new fe({props:{class:"form-field required",name:"duration",$$slots:{default:[h8,({uniqueId:$})=>({23:$}),({uniqueId:$})=>$?8388608:0]},$$scope:{ctx:n}}}),g=new fe({props:{class:"form-field required",name:"privateKey",$$slots:{default:[_8,({uniqueId:$})=>({23:$}),({uniqueId:$})=>$?8388608:0]},$$scope:{ctx:n}}}),{c(){e=b("form"),t=b("div"),i=b("div"),H(s.$$.fragment),l=C(),o=b("div"),H(r.$$.fragment),a=C(),u=b("div"),H(f.$$.fragment),c=C(),d=b("div"),H(m.$$.fragment),h=C(),H(g.$$.fragment),p(i,"class","col-lg-6"),p(o,"class","col-lg-6"),p(u,"class","col-lg-6"),p(d,"class","col-lg-6"),p(t,"class","grid"),p(e,"id",n[9]),p(e,"autocomplete","off")},m($,T){w($,e,T),y(e,t),y(t,i),q(s,i,null),y(t,l),y(t,o),q(r,o,null),y(t,a),y(t,u),q(f,u,null),y(t,c),y(t,d),q(m,d,null),y(t,h),q(g,t,null),_=!0,k||(S=Y(e,"submit",it(n[17])),k=!0)},p($,T){const O={};T&25165828&&(O.$$scope={dirty:T,ctx:$}),s.$set(O);const E={};T&25165832&&(E.$$scope={dirty:T,ctx:$}),r.$set(E);const L={};T&25165840&&(L.$$scope={dirty:T,ctx:$}),f.$set(L);const I={};T&25165888&&(I.$$scope={dirty:T,ctx:$}),m.$set(I);const A={};T&25165856&&(A.$$scope={dirty:T,ctx:$}),g.$set(A)},i($){_||(M(s.$$.fragment,$),M(r.$$.fragment,$),M(f.$$.fragment,$),M(m.$$.fragment,$),M(g.$$.fragment,$),_=!0)},o($){D(s.$$.fragment,$),D(r.$$.fragment,$),D(f.$$.fragment,$),D(m.$$.fragment,$),D(g.$$.fragment,$),_=!1},d($){$&&v(e),j(s),j(r),j(f),j(m),j(g),k=!1,S()}}}function b8(n){let e;return{c(){e=b("h4"),e.textContent="Generate Apple client secret",p(e,"class","center txt-break")},m(t,i){w(t,e,i)},p:te,d(t){t&&v(e)}}}function k8(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=b("button"),t=W("Close"),i=C(),s=b("button"),l=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(l,"class","ri-key-line"),p(r,"class","txt"),p(s,"type","submit"),p(s,"form",n[9]),p(s,"class","btn btn-expanded"),s.disabled=a=!n[8]||n[7],x(s,"btn-loading",n[7])},m(c,d){w(c,e,d),y(e,t),w(c,i,d),w(c,s,d),y(s,l),y(s,o),y(s,r),u||(f=Y(e,"click",n[0]),u=!0)},p(c,d){d&128&&(e.disabled=c[7]),d&384&&a!==(a=!c[8]||c[7])&&(s.disabled=a),d&128&&x(s,"btn-loading",c[7])},d(c){c&&(v(e),v(i),v(s)),u=!1,f()}}}function y8(n){let e,t,i={overlayClose:!n[7],escClose:!n[7],beforeHide:n[18],popup:!0,$$slots:{footer:[k8],header:[b8],default:[g8]},$$scope:{ctx:n}};return e=new nn({props:i}),n[19](e),e.$on("show",n[20]),e.$on("hide",n[21]),{c(){H(e.$$.fragment)},m(s,l){q(e,s,l),t=!0},p(s,[l]){const o={};l&128&&(o.overlayClose=!s[7]),l&128&&(o.escClose=!s[7]),l&128&&(o.beforeHide=s[18]),l&16777724&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(M(e.$$.fragment,s),t=!0)},o(s){D(e.$$.fragment,s),t=!1},d(s){n[19](null),j(e,s)}}}const lr=15777e3;function v8(n,e,t){let i;const s=wt(),l="apple_secret_"+U.randomString(5);let o,r,a,u,f,c,d=!1;function m(P={}){t(2,r=P.clientId||""),t(3,a=P.teamId||""),t(4,u=P.keyId||""),t(5,f=P.privateKey||""),t(6,c=P.duration||lr),Jt({}),o==null||o.show()}function h(){return o==null?void 0:o.hide()}async function g(){t(7,d=!0);try{const P=await _e.settings.generateAppleClientSecret(r,a,u,f.trim(),c);t(7,d=!1),tn("Successfully generated client secret."),s("submit",P),o==null||o.hide()}catch(P){_e.error(P)}t(7,d=!1)}function _(){r=
2025-04-16 13:14:56 +08:00
is a direct result of the trusted server code-&gt;token exchange response.</em>`,i=C(),H(s.$$.fragment),l=C(),H(o.$$.fragment),p(t,"class","txt-hint txt-sm m-b-xs"),p(e,"class","content")},m(u,f){w(u,e,f),y(e,t),y(e,i),q(s,e,null),y(e,l),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}),s.$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||(M(s.$$.fragment,u),M(o.$$.fragment,u),u&&tt(()=>{a&&(r||(r=qe(e,ht,{delay:10,duration:150},!0)),r.run(1))}),a=!0)},o(u){D(s.$$.fragment,u),D(o.$$.fragment,u),u&&(r||(r=qe(e,ht,{delay:10,duration:150},!1)),r.run(0)),a=!1},d(u){u&&v(e),j(s),j(o),u&&r&&r.end()}}}function B8(n){let e,t,i,s;return t=new fe({props:{class:"form-field required",name:n[1]+".userInfoURL",$$slots:{default:[K8,({uniqueId:l})=>({13:l}),({uniqueId:l})=>l?8192:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),H(t.$$.fragment),p(e,"class","content")},m(l,o){w(l,e,o),q(t,e,null),s=!0},p(l,o){const r={};o&2&&(r.name=l[1]+".userInfoURL"),o&24577&&(r.$$scope={dirty:o,ctx:l}),t.$set(r)},i(l){s||(M(t.$$.fragment,l),l&&tt(()=>{s&&(i||(i=qe(e,ht,{delay:10,duration:150},!0)),i.run(1))}),s=!0)},o(l){D(t.$$.fragment,l),l&&(i||(i=qe(e,ht,{delay:10,duration:150},!1)),i.run(0)),s=!1},d(l){l&&v(e),j(t),l&&i&&i.end()}}}function W8(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=b("label"),t=b("span"),t.textContent="JWKS verification URL",i=C(),s=b("i"),o=C(),r=b("input"),p(t,"class","txt"),p(s,"class","ri-information-line link-hint"),p(e,"for",l=n[13]),p(r,"type","url"),p(r,"id",a=n[13])},m(c,d){w(c,e,d),y(e,t),y(e,i),y(e,s),w(c,o,d),w(c,r,d),me(r,n[0].extra.jwksURL),u||(f=[Oe(Re.call(null,s,{text:"URL to the public token verification keys.",position:"top"})),Y(r,"input",n[9])],u=!0)},p(c,d){d&8192&&l!==(l=c[13])&&p(e,"for",l),d&8192&&a!==(a=c[13])&&p(r,"id",a),d&1&&r.value!==c[0].extra.jwksURL&&me(r,c[0].extra.jwksURL)},d(c){c&&(v(e),v(o),v(r)),u=!1,Ee(f)}}}function Y8(n){let e,t,i,s,l,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 ho({props:m}),ne.push(()=>ge(r,"value",d)),{c(){e=b("label"),t=b("span"),t.textContent="Issuers",i=C(),s=b("i"),o=C(),H(r.$$.fragment),p(t,"class","txt"),p(s,"class","ri-information-line link-hint"),p(e,"for",l=n[13])},m(h,g){w(h,e,g),y(e,t),y(e,i),y(e,s),w(h,o,g),q(r,h,g),u=!0,f||(c=Oe(Re.call(null,s,{text:"Comma separated list of accepted values for the iss token claim validation.",position:"top"})),f=!0)},p(h,g){(!u||g&8192&&l!==(l=h[13]))&&p(e,"for",l);const _={};g&8192&&(_.id=h[13]),!a&&g&1&&(a=!0,_.value=h[0].extra.issuers,$e(()=>a=!1)),r.$set(_)},i(h){u||(M(r.$$.fragment,h),u=!0)},o(h){D(r.$$.fragment,h),u=!1},d(h){h&&(v(e),v(o)),j(r,h),f=!1,c()}}}function K8(n){let e,t,i,s,l,o,r,a;return{c(){e=b("label"),t=W("User info URL"),s=C(),l=b("input"),p(e,"for",i=n[13]),p(l,"type","url"),p(l,"id",o=n[13]),l.required=!0},m(u,f){w(u,e,f),y(e,t),w(u,s,f),w(u,l,f),me(l,n[0].userInfoURL),r||(a=Y(l,"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(l,"id",o),f&1&&l.value!==u[0].userInfoURL&&me(l,u[0].userInfoURL)},d(u){u&&(v(e),v(s),v(l)),r=!1,a()}}}function J8(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=b("input"),i=C(),s=b("label"),l=b("span"),l.textContent="Support PKCE",o=C(),r=b("i"),p(e,"type","checkbox"),p(e,"id",t=n[13]),p(l,"class","txt"),p(r,"class","ri-information-line link-hint"),p(s,"for",a=n[13])},m(c,d){w(c,e,d),e.checked=n[0].pkce,w(c,i,d),w(c,s,d),y(s,l),y(s,o),y(s,r),u||(f=[Y(e,"change",n[11]),Oe(Re.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(s,"for",a)},d(c){c&&(v(e),v(i),v(s)),u=!1,Ee(f)}}}function Z8(n){let e,t,i,s,l,o,r,a,u,f,c,d,m,h,g,_;e=new fe({props:{class:"form-field required",name:n[1]+".displayName",$$slots:{default:[j8,({uni
`),_&&_.c(),o=C(),r=b("div");for(let P=0;P<S.length;P+=1)S[P].c();a=C(),u=b("button"),u.innerHTML='<span class="txt">+</span> <span class="txt">New index</span>',f=C(),H(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(P,N){w(P,e,N),y(e,t),y(e,s),y(e,l),_&&_.m(e,null),w(P,o,N),w(P,r,N);for(let R=0;R<S.length;R+=1)S[R]&&S[R].m(r,null);y(r,a),y(r,u),w(P,f,N),q(c,P,N),m=!0,h||(g=Y(u,"click",n[5]),h=!0)},p(P,[N]){var z,F,B,J,V;if((!m||N&1)&&i!==(i=(((F=(z=P[0])==null?void 0:z.indexes)==null?void 0:F.length)||0)+"")&&se(s,i),(J=(B=P[2])==null?void 0:B.indexes)!=null&&J.message?_?(_.p(P,N),N&4&&M(_,1)):(_=qm(P),_.c(),M(_,1),_.m(e,null)):_&&(oe(),D(_,1,1,()=>{_=null}),re()),N&7){k=ce(((V=P[0])==null?void 0:V.indexes)||[]);let Z;for(Z=0;Z<k.length;Z+=1){const G=Fm(P,k,Z);S[Z]?S[Z].p(G,N):(S[Z]=Hm(G),S[Z].c(),S[Z].m(r,a))}for(;Z<S.length;Z+=1)S[Z].d(1);S.length=k.length}const R={};!d&&N&1&&(d=!0,R.collection=P[0],$e(()=>d=!1)),c.$set(R)},i(P){m||(M(_),M(c.$$.fragment,P),m=!0)},o(P){D(_),D(c.$$.fragment,P),m=!1},d(P){P&&(v(e),v(o),v(r),v(f)),_&&_.d(),dt(S,P),n[6](null),j(c,P),h=!1,g()}}}const zm=n=>n.name;function yM(n,e,t){let i;Ge(n,$n,m=>t(2,i=m));let{collection:s}=e,l;function o(m,h){for(let g=0;g<s.indexes.length;g++)if(s.indexes[g]==m){t(0,s.indexes[g]=h,s),Yn("indexes."+g);return}s.indexes.push(h),t(0,s)}const r=(m,h)=>l==null?void 0:l.show(m,h),a=()=>l==null?void 0:l.show();function u(m){ne[m?"unshift":"push"](()=>{l=m,t(1,l)})}function f(m){s=m,t(0,s)}const c=m=>{for(let h=0;h<s.indexes.length;h++)if(s.indexes[h]==m.detail){s.indexes.splice(h,1),Yn("indexes."+h);break}t(0,s)},d=m=>{var h;(h=i.indexes)!=null&&h.message&&Yn("indexes"),o(m.detail.old,m.detail.new)};return n.$$set=m=>{"collection"in m&&t(0,s=m.collection)},[s,l,i,o,r,a,u,f,c,d]}class vM extends we{constructor(e){super(),ve(this,e,yM,kM,be,{collection:0})}}function Um(n,e,t){const i=n.slice();return i[5]=e[t],i}function Vm(n){let e,t,i,s,l,o,r;function a(){return n[3](n[5])}return{c(){e=b("button"),t=b("i"),i=C(),s=b("span"),s.textContent=`${n[5].label}`,l=C(),p(t,"class","icon "+n[5].icon+" svelte-1gz9b6p"),p(t,"aria-hidden","true"),p(s,"class","txt"),p(e,"type","button"),p(e,"role","menuitem"),p(e,"class","dropdown-item svelte-1gz9b6p")},m(u,f){w(u,e,f),y(e,t),y(e,i),y(e,s),y(e,l),o||(r=Y(e,"click",a),o=!0)},p(u,f){n=u},d(u){u&&v(e),o=!1,r()}}}function wM(n){let e,t=ce(n[1]),i=[];for(let s=0;s<t.length;s+=1)i[s]=Vm(Um(n,t,s));return{c(){for(let s=0;s<i.length;s+=1)i[s].c();e=ke()},m(s,l){for(let o=0;o<i.length;o+=1)i[o]&&i[o].m(s,l);w(s,e,l)},p(s,l){if(l&6){t=ce(s[1]);let o;for(o=0;o<t.length;o+=1){const r=Um(s,t,o);i[o]?i[o].p(r,l):(i[o]=Vm(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(s){s&&v(e),dt(i,s)}}}function SM(n){let e,t,i,s,l,o,r,a;return o=new Dn({props:{class:"dropdown field-types-dropdown",$$slots:{default:[wM]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("i"),i=C(),s=b("div"),s.textContent="New field",l=C(),H(o.$$.fragment),p(t,"class","ri-add-line"),p(t,"aria-hidden","true"),p(s,"class","txt"),p(e,"tabindex","0"),p(e,"role","button"),p(e,"class",r="field-types-btn "+n[0]+" svelte-1gz9b6p")},m(u,f){w(u,e,f),y(e,t),y(e,i),y(e,s),y(e,l),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||(M(o.$$.fragment,u),a=!0)},o(u){D(o.$$.fragment,u),a=!1},d(u){u&&v(e),j(o)}}}function TM(n,e,t){let{class:i=""}=e;const s=wt(),l=[{label:"Plain text",value:"text",icon:U.getFieldTypeIcon("text")},{label:"Rich editor",value:"editor",icon:U.getFieldTypeIcon("editor")},{label:"Number",value:"number",icon:U.getFieldTypeIcon("number")},{label:"Bool",value:"bool",icon:U.getFieldTypeIcon("bool")},{label:"Email",value:"email",icon:U.getFieldTypeIcon("email")},{label:"URL",value:"url",icon:U.getFieldTypeIcon("url")},{label:"Datetime",value:"date",icon:U.getFieldTypeIcon("date")},{label:"Autod
2025-04-02 16:38:19 +08:00
<span class='flatpickr-weekday'>
`+ee.join("</span><span class='flatpickr-weekday'>")+`
</span>
`}}function de(){t.calendarContainer.classList.add("hasWeeks");var X=Mt("div","flatpickr-weekwrapper");X.appendChild(Mt("span","flatpickr-weekday",t.l10n.weekAbbreviation));var ee=Mt("div","flatpickr-weeks");return X.appendChild(ee),{weekWrapper:X,weekNumbers:ee}}function pe(X,ee){ee===void 0&&(ee=!0);var le=ee?X:X-t.currentMonth;le<0&&t._hidePrevMonthArrow===!0||le>0&&t._hideNextMonthArrow===!0||(t.currentMonth+=le,(t.currentMonth<0||t.currentMonth>11)&&(t.currentYear+=t.currentMonth>11?1:-1,t.currentMonth=(t.currentMonth+12)%12,It("onYearChange"),z()),R(),It("onMonthChange"),Vi())}function ae(X,ee){if(X===void 0&&(X=!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 le=Ea(t.config),Se=le.hours,Fe=le.minutes,Ve=le.seconds;m(Se,Fe,Ve)}t.redraw(),X&&It("onChange")}function Ce(){t.isOpen=!1,t.isMobile||(t.calendarContainer!==void 0&&t.calendarContainer.classList.remove("open"),t._input!==void 0&&t._input.classList.remove("active")),It("onClose")}function Ye(){t.config!==void 0&&It("onDestroy");for(var X=t._handlers.length;X--;)t._handlers[X].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(le){try{delete t[le]}catch{}})}function Ke(X){return t.calendarContainer.contains(X)}function ct(X){if(t.isOpen&&!t.config.inline){var ee=Vn(X),le=Ke(ee),Se=ee===t.input||ee===t.altInput||t.element.contains(ee)||X.path&&X.path.indexOf&&(~X.path.indexOf(t.input)||~X.path.indexOf(t.altInput)),Fe=!Se&&!le&&!Ke(X.relatedTarget),Ve=!t.config.ignoredFocusElements.some(function(rt){return rt.contains(ee)});Fe&&Ve&&(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 et(X){if(!(!X||t.config.minDate&&X<t.config.minDate.getFullYear()||t.config.maxDate&&X>t.config.maxDate.getFullYear())){var ee=X,le=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)),le&&(t.redraw(),It("onYearChange"),z())}}function xe(X,ee){var le;ee===void 0&&(ee=!0);var Se=t.parseDate(X,void 0,ee);if(t.config.minDate&&Se&&Bn(Se,t.config.minDate,ee!==void 0?ee:!t.minDateHasTime)<0||t.config.maxDate&&Se&&Bn(Se,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(_,k){(!c||k&512&&l!==(l=_[9]))&&p(e,"for",l);const S={};k&512&&(S.id=_[9]),k&1&&(S.disabled=!U.isEmpty(_[0].onlyDomains)),!a&&k&1&&(a=!0,S.value=_[0].exceptDomains,$e(()=>a=!1)),r.$set(S)},i(_){c||(M(r.$$.fragment,_),c=!0)},o(_){D(r.$$.fragment,_),c=!1},d(_){_&&(v(e),v(o),v(u),v(f)),j(r,_),d=!1,m()}}}function _E(n){let e,t,i,s,l,o,r,a,u,f,c,d,m;function h(_){n[4](_)}let g={id:n[9]+".onlyDomains",disabled:!U.isEmpty(n[0].exceptDomains)};return n[0].onlyDomains!==void 0&&(g.value=n[0].onlyDomains),r=new ho({props:g}),ne.push(()=>ge(r,"value",h)),{c(){e=b("label"),t=b("span"),t.textContent="Only domains",i=C(),s=b("i"),o=C(),H(r.$$.fragment),u=C(),f=b("div"),f.textContent="Use comma as separator.",p(t,"class","txt"),p(s,"class","ri-information-line link-hint"),p(e,"for",l=n[9]+".onlyDomains"),p(f,"class","help-block")},m(_,k){w(_,e,k),y(e,t),y(e,i),y(e,s),w(_,o,k),q(r,_,k),w(_,u,k),w(_,f,k),c=!0,d||(m=Oe(Re.call(null,s,{text:`List of domains that are ONLY allowed.
This field is disabled if "Except domains" is set.`,position:"top"})),d=!0)},p(_,k){(!c||k&512&&l!==(l=_[9]+".onlyDomains"))&&p(e,"for",l);const S={};k&512&&(S.id=_[9]+".onlyDomains"),k&1&&(S.disabled=!U.isEmpty(_[0].exceptDomains)),!a&&k&1&&(a=!0,S.value=_[0].onlyDomains,$e(()=>a=!1)),r.$set(S)},i(_){c||(M(r.$$.fragment,_),c=!0)},o(_){D(r.$$.fragment,_),c=!1},d(_){_&&(v(e),v(o),v(u),v(f)),j(r,_),d=!1,m()}}}function gE(n){let e,t,i,s,l,o,r;return i=new fe({props:{class:"form-field",name:"fields."+n[1]+".exceptDomains",$$slots:{default:[hE,({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:[_E,({uniqueId:a})=>({9:a}),({uniqueId:a})=>a?512:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),H(i.$$.fragment),s=C(),l=b("div"),H(o.$$.fragment),p(t,"class","col-sm-6"),p(l,"class","col-sm-6"),p(e,"class","grid grid-sm")},m(a,u){w(a,e,u),y(e,t),q(i,t,null),y(e,s),y(e,l),q(o,l,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||(M(i.$$.fragment,a),M(o.$$.fragment,a),r=!0)},o(a){D(i.$$.fragment,a),D(o.$$.fragment,a),r=!1},d(a){a&&v(e),j(i),j(o)}}}function bE(n){let e,t,i;const s=[{key:n[1]},n[2]];function l(r){n[5](r)}let o={$$slots:{options:[gE]},$$scope:{ctx:n}};for(let r=0;r<s.length;r+=1)o=je(o,s[r]);return n[0]!==void 0&&(o.field=n[0]),e=new Kn({props:o}),ne.push(()=>ge(e,"field",l)),e.$on("rename",n[6]),e.$on("remove",n[7]),e.$on("duplicate",n[8]),{c(){H(e.$$.fragment)},m(r,a){q(e,r,a),i=!0},p(r,[a]){const u=a&6?vt(s,[a&2&&{key:r[1]},a&4&&At(r[2])]):{};a&1027&&(u.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,u.field=r[0],$e(()=>t=!1)),e.$set(u)},i(r){i||(M(e.$$.fragment,r),i=!0)},o(r){D(e.$$.fragment,r),i=!1},d(r){j(e,r)}}}function kE(n,e,t){const i=["field","key"];let s=lt(e,i),{field:l}=e,{key:o=""}=e;function r(m){n.$$.not_equal(l.exceptDomains,m)&&(l.exceptDomains=m,t(0,l))}function a(m){n.$$.not_equal(l.onlyDomains,m)&&(l.onlyDomains=m,t(0,l))}function u(m){l=m,t(0,l)}function f(m){Le.call(this,n,m)}function c(m){Le.call(this,n,m)}function d(m){Le.call(this,n,m)}return n.$$set=m=>{e=je(je({},e),Kt(m)),t(2,s=lt(e,i)),"field"in m&&t(0,l=m.field),"key"in m&&t(1,o=m.key)},[l,o,s,r,a,u,f,c,d]}class Ay extends we{constructor(e){super(),ve(this,e,kE,bE,be,{field:0,key:1})}}function yE(n){let e,t=(n[0].ext||"N/A")+"",i,s,l,o=n[0].mimeType+"",r;return{c(){e=b("span"),i=W(t),s=C(),l=b("small"),r=W(o),p(e,"class","txt"),p(l,"class","txt-hint")},m(a,u){w(a,e,u),y(e,i),w(a,s,u),w(a,l,u),y(l,r)},p(a,[u]){u&1&&t!==(t=(a[0].ext||"N/A")+"")&&se(i,t),u&1&&o!==(o=a[0].mimeType+"")&&se(r,o)},i:te,o:te,d(a){a&&(v(e),v(s),v(l))}}}function vE(n,e,t){let{item:i={}}=e;return n.$$set=s=>{"item"in s&&t(0,i=s.item)},[i]}class oh extends we{constructor(e){super(),ve(this,e,vE,yE,be,{item:0})}}const wE=[{ext:"",mimeType:"application/octet-stream"},{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:".apk",mimeType:"application/vnd.android.package-archive"},{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.
Leave empty for no restriction.`,position:"top"})),S=!0)},p(E,L){(!k||L&8388608&&l!==(l=E[23]))&&p(e,"for",l);const I={};L&8388608&&(I.id=E[23]),L&8&&(I.items=E[3]),!a&&L&1&&(a=!0,I.keyOfSelected=E[0].mimeTypes,$e(()=>a=!1)),r.$set(I);const A={};L&33554433&&(A.$$scope={dirty:L,ctx:E}),_.$set(A)},i(E){k||(M(r.$$.fragment,E),M(_.$$.fragment,E),k=!0)},o(E){D(r.$$.fragment,E),D(_.$$.fragment,E),k=!1},d(E){E&&(v(e),v(o),v(u),v(f)),j(r,E),j(_),S=!1,$()}}}function OE(n){let e;return{c(){e=b("ul"),e.innerHTML=`<li><strong>WxH</strong>
2025-04-02 16:38:19 +08:00
(e.g. 100x50) - crop to WxH viewbox (from center)</li> <li><strong>WxHt</strong>
(e.g. 100x50t) - crop to WxH viewbox (from top)</li> <li><strong>WxHb</strong>
(e.g. 100x50b) - crop to WxH viewbox (from bottom)</li> <li><strong>WxHf</strong>
(e.g. 100x50f) - fit inside a WxH viewbox (without cropping)</li> <li><strong>0xH</strong>
(e.g. 0x50) - resize to H height preserving the aspect ratio</li> <li><strong>Wx0</strong>
(e.g. 100x0) - resize to W width preserving the aspect ratio</li>`,p(e,"class","m-0")},m(t,i){w(t,e,i)},p:te,d(t){t&&v(e)}}}function ME(n){let e,t,i,s,l,o,r,a,u,f,c,d,m,h,g,_,k,S,$,T,O;function E(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 ho({props:L}),ne.push(()=>ge(r,"value",E)),S=new Dn({props:{class:"dropdown dropdown-sm dropdown-center dropdown-nowrap p-r-10",$$slots:{default:[OE]},$$scope:{ctx:n}}}),{c(){e=b("label"),t=b("span"),t.textContent="Thumb sizes",i=C(),s=b("i"),o=C(),H(r.$$.fragment),u=C(),f=b("div"),c=b("span"),c.textContent="Use comma as separator.",d=C(),m=b("button"),h=b("span"),h.textContent="Supported formats",g=C(),_=b("i"),k=C(),H(S.$$.fragment),p(t,"class","txt"),p(s,"class","ri-information-line link-hint"),p(e,"for",l=n[23]),p(c,"class","txt"),p(h,"class","txt link-primary"),p(_,"class","ri-arrow-drop-down-fill"),p(_,"aria-hidden","true"),p(m,"type","button"),p(m,"class","inline-flex flex-gap-0"),p(f,"class","help-block")},m(I,A){w(I,e,A),y(e,t),y(e,i),y(e,s),w(I,o,A),q(r,I,A),w(I,u,A),w(I,f,A),y(f,c),y(f,d),y(f,m),y(m,h),y(m,g),y(m,_),y(m,k),q(S,m,null),$=!0,T||(O=Oe(Re.call(null,s,{text:"List of additional thumb sizes for image files, along with the default thumb size of 100x100. The thumbs are generated lazily on first access.",position:"top"})),T=!0)},p(I,A){(!$||A&8388608&&l!==(l=I[23]))&&p(e,"for",l);const P={};A&8388608&&(P.id=I[23]),!a&&A&1&&(a=!0,P.value=I[0].thumbs,$e(()=>a=!1)),r.$set(P);const N={};A&33554432&&(N.$$scope={dirty:A,ctx:I}),S.$set(N)},i(I){$||(M(r.$$.fragment,I),M(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)),j(r,I),j(S),T=!1,O()}}}function EE(n){let e,t,i,s,l,o,r,a,u,f,c;return{c(){e=b("label"),t=W("Max file size"),s=C(),l=b("input"),a=C(),u=b("div"),u.textContent="Must be in bytes.",p(e,"for",i=n[23]),p(l,"type","number"),p(l,"id",o=n[23]),p(l,"step","1"),p(l,"min","0"),p(l,"max",Number.MAX_SAFE_INTEGER),l.value=r=n[0].maxSize||"",p(l,"placeholder","Default to max ~5MB"),p(u,"class","help-block")},m(d,m){w(d,e,m),y(e,t),w(d,s,m),w(d,l,m),w(d,a,m),w(d,u,m),f||(c=Y(l,"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(l,"id",o),m&1&&r!==(r=d[0].maxSize||"")&&l.value!==r&&(l.value=r)},d(d){d&&(v(e),v(s),v(l),v(a),v(u)),f=!1,c()}}}function rh(n){let e,t,i;return t=new fe({props:{class:"form-field",name:"fields."+n[1]+".maxSelect",$$slots:{default:[DE,({uniqueId:s})=>({23:s}),({uniqueId:s})=>s?8388608:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),H(t.$$.fragment),p(e,"class","col-sm-3")},m(s,l){w(s,e,l),q(t,e,null),i=!0},p(s,l){const o={};l&2&&(o.name="fields."+s[1]+".maxSelect"),l&41943041&&(o.$$scope={dirty:l,ctx:s}),t.$set(o)},i(s){i||(M(t.$$.fragment,s),i=!0)},o(s){D(t.$$.fragment,s),i=!1},d(s){s&&v(e),j(t)}}}function DE(n){let e,t,i,s,l,o,r,a;return{c(){e=b("label"),t=W("Max select"),s=C(),l=b("input"),p(e,"for",i=n[23]),p(l,"id",o=n[23]),p(l,"type","number"),p(l,"step","1"),p(l,"min","2"),p(l,"max",Number.MAX_SAFE_INTEGER),l.required=!0,p(l,"placeholder","Default to single")},m(u,f){w(u,e,f),y(e,t),w(u,s,f),w(u,l,f),me(l,n[0].maxSelect),r||(a=Y(l,"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(l,"id",o),f&1&&mt(l.value)!==u[0].maxSelect&&me(l,u[0].maxSelect)},d(u){u&&(v(e),v(s),v(l)),r=!1,a()}}}function IE(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=b("input"),i=C(),s=b("label"),l=b("span"),l.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(l,"class","txt"),p(s,"for",o=n[23]),p(a,"class","txt-hint")},m(c,d){w(c,e,d),e.checked=n[0].protected,w(c,i,d),w(c,s,d),y(s,l),w(c,r,d),w(c,a,d),u||(f=Y(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(s,"for",o)},d(c){c&&(v(e),v(i),v(s),v(r),v(a)),u=!1,f()}}}function LE(n){let e,t,i,s,l,o,r,a,u,f,c,d,m,h,g;i=new fe({props:{class:"form-field",name:"fields."+n[1]+".mimeTypes",$$slots:{default:[CE,({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:[ME,({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:[EE,({uniqueId:k})=>({23:k}),({uniqueId:k})=>k?8388608:0]},$$scope:{ctx:n}}});let _=!n[2]&&rh(n);return h=new fe({props:{class:"form-field form-field-toggle",name:"fields."+n[1]+".protected",$$slots:{default:[IE,({uniqueId:k})=>({23:k}),({uniqueId:k})=>k?8388608:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),H(i.$$.fragment),s=C(),l=b("div"),H(o.$$.fragment),a=C(),u=b("div"),H(f.$$.fragment),d=C(),_&&_.c(),m=C(),H(h.$$.fragment),p(t,"class","col-sm-12"),p(l,"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){w(k,e,S),y(e,t),q(i,t,null),y(e,s),y(e,l),q(o,l,null),y(e,a),y(e,u),q(f,u,null),y(e,d),_&&_.m(e,null),y(e,m),q(h,e,null),g=!0},p(k,S){const $={};S&2&&($.name="fields."+k[1]+".mimeTypes"),S&41943049&&($.$$scope={dirty:S,ctx:k}),i.$set($);const T={};S&2&&(T.name="fields."+k[1]+".thumbs"),S&41943041&&(T.$$scope={dirty:S,ctx:k}),o.$set(T),(!g||S&4&&r!==(r=k[2]?"col-sm-8":"col-sm-6"))&&p(l,"class",r);const O={};S&2&&(O.name="fields."+k[1]+".maxSize"),S&41943041&&(O.$$scope={dirty:S,ctx:k}),f.$set(O),(!g||S&4&&c!==(c=k[2]?"col-sm-4":"col-sm-3"))&&p(u,"class",c),k[2]?_&&(oe(),D(_,1,1,()=>{_=null}),re()):_?(_.p(k,S),S&4&&M(_,1)):(_=rh(k),_.c(),M(_,1),_.m(e,m));const E={};S&2&&(E.name="fields."+k[1]+".protected"),S&41943041&&(E.$$scope={dirty:S,ctx:k}),h.$set(E)},i(k){g||(M(i.$$.fragment,k),M(o.$$.fragment,k),M(f.$$.fragment,k),M(_),M(h.$$.fragment,k),g=!0)},o(k){D(i.$$.fragment,k),D(o.$$.fragment,k),D(f.$$.fragment,k),D(_),D(h.$$.fragment,k),g=!1},d(k){k&&v(e),j(i),j(o),j(f),_&&_.d(),j(h)}}}function AE(n){let e,t,i;const s=[{key:n[1]},n[5]];function l(r){n[17](r)}let o={$$slots:{options:[LE],default:[TE,({interactive:r})=>({24:r}),({interactive:r})=>r?16777216:0]},$$scope:{ctx:n}};for(let r=0;r<s.length;r+=1)o=je(o,s[r]);return n[0]!==void 0&&(o.field=n[0]),e=new Kn({props:o}),ne.push(()=>ge(e,"field",l)),e.$on("rename",n[18]),e.$on("remove",n[19]),e.$on("duplicate",n[20]),{c(){H(e.$$.fragment)},m(r,a){q(e,r,a),i=!0},p(r,[a]){const u=a&34?vt(s,[a&2&&{key:r[1]},a&32&&At(r[5])]):{};a&50331663&&(u.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,u.field=r[0],$e(()=>t=!1)),e.$set(u)},i(r){i||(M(e.$$.fragment,r),i=!0)},o(r){D(e.$$.fragment,r),i=!1},d(r){j(e,r)}}}function PE(n,e,t){const i=["field","key"];let s=lt(e,i),{field:l}=e,{key:o=""}=e;const r=[{label:"Single",value:!0},{label:"Multiple",value:!1}];let a=wE.slice(),u=l.maxSelect<=1,f=u;function c(){t(0,l.maxSelect=1,l),t(0,l.thumbs=[],l),t(0,l.mimeTypes=[],l),t(2,u=!0),t(6,f=u)}function d(){if(U.isEmpty(l.mimeTypes))return;const N=[];for(const R of l.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(l.mimeTypes,N)&&(l.mimeTypes=N,t(0,l),t(6,f),t(2,u))}const h=()=>{t(0,l.mimeTypes=["image/jpeg","image/png","image/svg+xml","image/gif","image/webp"],l)},g=()=>{t(0,l.mimeTypes=["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml
2025-04-02 16:38:19 +08:00
`),r=b("code"),r.textContent="multipart/form-data",a=W(`
requests, the following normalization rules are applied if the `),u=b("code"),u.textContent="json",f=W(` field
is a
`),c=b("strong"),c.textContent="plain string",d=W(`:
`),m=b("ul"),h=b("li"),h.innerHTML="&quot;true&quot; is converted to the json <code>true</code>",g=C(),_=b("li"),_.innerHTML="&quot;false&quot; is converted to the json <code>false</code>",k=C(),S=b("li"),S.innerHTML="&quot;null&quot; is converted to the json <code>null</code>",$=C(),T=b("li"),T.innerHTML="&quot;[1,2,3]&quot; is converted to the json <code>[1,2,3]</code>",O=C(),E=b("li"),I=W(L),A=W(" is converted to the json "),P=b("code"),P.textContent='{"a":1,"b":2}',N=C(),R=b("li"),R.textContent="numeric strings are converted to json number",z=C(),F=b("li"),F.textContent="double quoted strings are left as they are (aka. without normalizations)",B=C(),J=b("li"),J.textContent="any other string (empty string too) is double quoted",V=W(`
Alternatively, if you want to avoid the string value normalizations, you can wrap your
data inside an object, eg.`),Z=b("code"),Z.textContent='{"data": anything}',p(i,"class","content"),p(t,"class","alert alert-warning m-b-0 m-t-10"),p(e,"class","block")},m(pe,ae){w(pe,e,ae),y(e,t),y(t,i),y(i,s),y(i,l),y(i,o),y(i,r),y(i,a),y(i,u),y(i,f),y(i,c),y(i,d),y(i,m),y(m,h),y(m,g),y(m,_),y(m,k),y(m,S),y(m,$),y(m,T),y(m,O),y(m,E),y(E,I),y(E,A),y(E,P),y(m,N),y(m,R),y(m,z),y(m,F),y(m,B),y(m,J),y(i,V),y(i,Z),de=!0},i(pe){de||(pe&&tt(()=>{de&&(G||(G=qe(e,ht,{duration:150},!0)),G.run(1))}),de=!0)},o(pe){pe&&(G||(G=qe(e,ht,{duration:150},!1)),G.run(0)),de=!1},d(pe){pe&&v(e),pe&&G&&G.end()}}}function jE(n){let e,t,i,s,l,o,r,a,u,f,c;e=new fe({props:{class:"form-field m-b-sm",name:"fields."+n[1]+".maxSize",$$slots:{default:[RE,({uniqueId:_})=>({10:_}),({uniqueId:_})=>_?1024:0]},$$scope:{ctx:n}}});function d(_,k){return _[2]?qE:FE}let m=d(n),h=m(n),g=n[2]&&ah();return{c(){H(e.$$.fragment),t=C(),i=b("button"),s=b("strong"),s.textContent="String value normalizations",l=C(),h.c(),r=C(),g&&g.c(),a=ke(),p(s,"class","txt"),p(i,"type","button"),p(i,"class",o="btn btn-sm "+(n[2]?"btn-secondary":"btn-hint btn-transparent"))},m(_,k){q(e,_,k),w(_,t,k),w(_,i,k),y(i,s),y(i,l),h.m(i,null),w(_,r,k),g&&g.m(_,k),w(_,a,k),u=!0,f||(c=Y(i,"click",n[5]),f=!0)},p(_,k){const S={};k&2&&(S.name="fields."+_[1]+".maxSize"),k&3073&&(S.$$scope={dirty:k,ctx:_}),e.$set(S),m!==(m=d(_))&&(h.d(1),h=m(_),h&&(h.c(),h.m(i,null))),(!u||k&4&&o!==(o="btn btn-sm "+(_[2]?"btn-secondary":"btn-hint btn-transparent")))&&p(i,"class",o),_[2]?g?k&4&&M(g,1):(g=ah(),g.c(),M(g,1),g.m(a.parentNode,a)):g&&(oe(),D(g,1,1,()=>{g=null}),re())},i(_){u||(M(e.$$.fragment,_),M(g),u=!0)},o(_){D(e.$$.fragment,_),D(g),u=!1},d(_){_&&(v(t),v(i),v(r),v(a)),j(e,_),h.d(),g&&g.d(_),f=!1,c()}}}function HE(n){let e,t,i;const s=[{key:n[1]},n[3]];function l(r){n[6](r)}let o={$$slots:{options:[jE]},$$scope:{ctx:n}};for(let r=0;r<s.length;r+=1)o=je(o,s[r]);return n[0]!==void 0&&(o.field=n[0]),e=new Kn({props:o}),ne.push(()=>ge(e,"field",l)),e.$on("rename",n[7]),e.$on("remove",n[8]),e.$on("duplicate",n[9]),{c(){H(e.$$.fragment)},m(r,a){q(e,r,a),i=!0},p(r,[a]){const u=a&10?vt(s,[a&2&&{key:r[1]},a&8&&At(r[3])]):{};a&2055&&(u.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,u.field=r[0],$e(()=>t=!1)),e.$set(u)},i(r){i||(M(e.$$.fragment,r),i=!0)},o(r){D(e.$$.fragment,r),i=!1},d(r){j(e,r)}}}function zE(n,e,t){const i=["field","key"];let s=lt(e,i),{field:l}=e,{key:o=""}=e,r=!1;const a=h=>t(0,l.maxSize=parseInt(h.target.value,10),l),u=()=>{t(2,r=!r)};function f(h){l=h,t(0,l)}function c(h){Le.call(this,n,h)}function d(h){Le.call(this,n,h)}function m(h){Le.call(this,n,h)}return n.$$set=h=>{e=je(je({},e),Kt(h)),t(3,s=lt(e,i)),"field"in h&&t(0,l=h.field),"key"in h&&t(1,o=h.key)},[l,o,r,s,a,u,f,c,d,m]}class UE extends we{constructor(e){super(),ve(this,e,zE,HE,be,{field:0,key:1})}}function VE(n){let e,t,i,s,l,o,r,a;return{c(){e=b("label"),t=W("Min"),s=C(),l=b("input"),p(e,"for",i=n[10]),p(l,"type","number"),p(l,"id",o=n[10])},m(u,f){w(u,e,f),y(e,t),w(u,s,f),w(u,l,f),me(l,n[0].min),r||(a=Y(l,"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(l,"id",o),f&1&&mt(l.value)!==u[0].min&&me(l,u[0].min)},d(u){u&&(v(e),v(s),v(l)),r=!1,a()}}}function BE(n){let e,t,i,s,l,o,r,a,u;return{c(){e=b("label"),t=W("Max"),s=C(),l=b("input"),p(e,"for",i=n[10]),p(l,"type","number"),p(l,"id",o=n[10]),p(l,"min",r=n[0].min)},m(f,c){w(f,e,c),y(e,t),w(f,s,c),w(f,l,c),me(l,n[0].max),a||(u=Y(l,"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(l,"id",o),c&1&&r!==(r=f[0].min)&&p(l,"min",r),c&1&&mt(l.value)!==f[0].max&&me(l,f[0].max)},d(f){f&&(v(e),v(s),v(l)),a=!1,u()}}}function WE(n){let e,t,i,s,l,o,r;return i=new fe({props:{class:"form-field",name:"fields."+n[1]+".min",$$slots:{default:[VE,({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:[BE,({uniqueId:a})=>({10:a}),({uniqueId:a})=>a?1024:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),H(i.$$.fragment),
2025-04-02 16:38:19 +08:00
`),position:"top"})),c=!0)},p(g,_){var S,$;l&&Lt(l.update)&&_&20&&l.update.call(null,{text:[`Whether on ${((S=g[4])==null?void 0:S.name)||"relation"} record deletion to delete also the current corresponding collection record(s).`,g[2]?null:`For "Multiple" relation fields the cascade delete is triggered only when all ${(($=g[4])==null?void 0:$.name)||"relation"} ids are removed from the corresponding record.`].filter(Boolean).join(`
`),position:"top"}),(!f||_&16777216&&o!==(o=g[24]))&&p(e,"for",o);const k={};_&16777216&&(k.id=g[24]),!u&&_&1&&(u=!0,k.keyOfSelected=g[0].cascadeDelete,$e(()=>u=!1)),a.$set(k)},i(g){f||(M(a.$$.fragment,g),f=!0)},o(g){D(a.$$.fragment,g),f=!1},d(g){g&&(v(e),v(r)),j(a,g),c=!1,d()}}}function dD(n){let e,t,i,s,l,o=!n[2]&&uh(n);return s=new fe({props:{class:"form-field",name:"fields."+n[1]+".cascadeDelete",$$slots:{default:[cD,({uniqueId:r})=>({24:r}),({uniqueId:r})=>r?16777216:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),o&&o.c(),t=C(),i=b("div"),H(s.$$.fragment),p(i,"class","col-sm-12"),p(e,"class","grid grid-sm")},m(r,a){w(r,e,a),o&&o.m(e,null),y(e,t),y(e,i),q(s,i,null),l=!0},p(r,a){r[2]?o&&(oe(),D(o,1,1,()=>{o=null}),re()):o?(o.p(r,a),a&4&&M(o,1)):(o=uh(r),o.c(),M(o,1),o.m(e,t));const u={};a&2&&(u.name="fields."+r[1]+".cascadeDelete"),a&83886101&&(u.$$scope={dirty:a,ctx:r}),s.$set(u)},i(r){l||(M(o),M(s.$$.fragment,r),l=!0)},o(r){D(o),D(s.$$.fragment,r),l=!1},d(r){r&&v(e),o&&o.d(),j(s)}}}function pD(n){let e,t,i,s,l;const o=[{key:n[1]},n[8]];function r(f){n[17](f)}let a={$$slots:{options:[dD],default:[aD,({interactive:f})=>({25:f}),({interactive:f})=>f?33554432:0]},$$scope:{ctx:n}};for(let f=0;f<o.length;f+=1)a=je(a,o[f]);n[0]!==void 0&&(a.field=n[0]),e=new Kn({props:a}),ne.push(()=>ge(e,"field",r)),e.$on("rename",n[18]),e.$on("remove",n[19]),e.$on("duplicate",n[20]);let u={};return s=new of({props:u}),n[21](s),s.$on("save",n[22]),{c(){H(e.$$.fragment),i=C(),H(s.$$.fragment)},m(f,c){q(e,f,c),w(f,i,c),q(s,f,c),l=!0},p(f,[c]){const d=c&258?vt(o,[c&2&&{key:f[1]},c&256&&At(f[8])]):{};c&100663359&&(d.$$scope={dirty:c,ctx:f}),!t&&c&1&&(t=!0,d.field=f[0],$e(()=>t=!1)),e.$set(d);const m={};s.$set(m)},i(f){l||(M(e.$$.fragment,f),M(s.$$.fragment,f),l=!0)},o(f){D(e.$$.fragment,f),D(s.$$.fragment,f),l=!1},d(f){f&&v(i),j(e,f),n[21](null),j(s,f)}}}function mD(n,e,t){let i,s;const l=["field","key"];let o=lt(e,l),r;Ge(n,In,R=>t(10,r=R));let{field:a}=e,{key:u=""}=e;const f=[{label:"Single",value:!0},{label:"Multiple",value:!1}],c=[{label:"False",value:!1},{label:"True",value:!0}];let d=null,m=a.maxSelect<=1,h=m;function g(){t(0,a.maxSelect=1,a),t(0,a.collectionId=null,a),t(0,a.cascadeDelete=!1,a),t(2,m=!0),t(9,h=m)}const _=R=>t(0,a.minSelect=R.target.value<<0,a);function k(){a.maxSelect=mt(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 E(R){a=R,t(0,a),t(9,h),t(2,m)}function L(R){Le.call(this,n,R)}function I(R){Le.call(this,n,R)}function A(R){Le.call(this,n,R)}function P(R){ne[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=je(je({},e),Kt(R)),t(8,o=lt(e,l)),"field"in R&&t(0,a=R.field),"key"in R&&t(1,u=R.key)},n.$$.update=()=>{n.$$.dirty&1024&&t(5,i=r.filter(R=>!R.system&&R.type!="view")),n.$$.dirty&516&&h!=m&&(t(9,h=m),m?(t(0,a.minSelect=0,a),t(0,a.maxSelect=1,a)):t(0,a.maxSelect=999,a)),n.$$.dirty&1&&typeof a.maxSelect>"u"&&g(),n.$$.dirty&1025&&t(4,s=r.find(R=>R.id==a.collectionId)||null)},[a,u,m,d,s,i,f,c,o,h,r,_,k,S,$,T,O,E,L,I,A,P,N]}class hD extends we{constructor(e){super(),ve(this,e,mD,pD,be,{field:0,key:1})}}function fh(n,e,t){const i=n.slice();return i[22]=e[t],i[24]=t,i}function ch(n){let e,t;return e=new Dn({props:{class:"dropdown dropdown-block options-dropdown dropdown-left m-t-0 p-0",$$slots:{default:[gD]},$$scope:{ctx:n}}}),e.$on("hide",n[21]),{c(){H(e.$$.fragment)},m(i,s){q(e,i,s),t=!0},p(i,s){const l={};s&33554547&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(M(e.$$.fragment,i),t=!0)},o(i){D(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function _D(n){let e,t,i=n[22]+"",s,l,o,r,a,u,f;function c(){return n[15](n[22])}return{c(){e=b("div"),t=b("span"),s=W(i),l=C(),o=b("div"),r=C(),a=b("button"),a.innerHTML='<i class="ri-close-lin
2025-04-02 16:38:19 +08:00
<br/>
If your query doesn&#39;t have a suitable one, you can use the universal
<code>(ROW_NUMBER() OVER()) as id</code>.</li> <li>Expressions must be aliased with a valid formatted field name, e.g.
<code>MAX(balance) as maxBalance</code>.</li> <li>Combined/multi-spaced expressions must be wrapped in parenthesis, e.g.
2025-04-16 13:14:56 +08:00
<code>(MAX(balance) + 1) as maxBalance</code>.</li></ul>`,u=C(),g&&g.c(),f=ke(),p(t,"class","txt"),p(e,"for",i=n[8]),p(a,"class","help-block")},m(_,k){w(_,e,k),y(e,t),w(_,s,k),m[l].m(_,k),w(_,r,k),w(_,a,k),w(_,u,k),g&&g.m(_,k),w(_,f,k),c=!0},p(_,k){(!c||k&256&&i!==(i=_[8]))&&p(e,"for",i);let S=l;l=h(_),l===S?m[l].p(_,k):(oe(),D(m[S],1,1,()=>{m[S]=null}),re(),o=m[l],o?o.p(_,k):(o=m[l]=d[l](_),o.c()),M(o,1),o.m(r.parentNode,r)),_[3].length?g?g.p(_,k):(g=gh(_),g.c(),g.m(f.parentNode,f)):g&&(g.d(1),g=null)},i(_){c||(M(o),c=!0)},o(_){D(o),c=!1},d(_){_&&(v(e),v(s),v(r),v(a),v(u),v(f)),m[l].d(_),g&&g.d(_)}}}function GD(n){let e,t;return e=new fe({props:{class:"form-field required "+(n[3].length?"error":""),name:"viewQuery",$$slots:{default:[ZD,({uniqueId:i})=>({8:i}),({uniqueId:i})=>i?256:0]},$$scope:{ctx:n}}}),{c(){H(e.$$.fragment)},m(i,s){q(e,i,s),t=!0},p(i,[s]){const l={};s&8&&(l.class="form-field required "+(i[3].length?"error":"")),s&4367&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(M(e.$$.fragment,i),t=!0)},o(i){D(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function XD(n,e,t){let i;Ge(n,$n,c=>t(4,i=c));let{collection:s}=e,l,o=!1,r=[];function a(c){t(3,r=[]);const d=U.getNestedVal(c,"fields",null);if(U.isEmpty(d))return;if(d!=null&&d.message){r.push(d==null?void 0:d.message);return}const m=U.extractColumnsFromQuery(s==null?void 0:s.viewQuery);U.removeByValue(m,"id"),U.removeByValue(m,"created"),U.removeByValue(m,"updated");for(let h in d)for(let g in d[h]){const _=d[h][g].message,k=m[h]||h;r.push(U.sentenize(k+": "+_))}}an(async()=>{t(2,o=!0);try{t(1,l=(await $t(async()=>{const{default:c}=await import("./CodeEditor-sxuxxBKk.js");return{default:c}},__vite__mapDeps([13,1]),import.meta.url)).default)}catch(c){console.warn(c)}t(2,o=!1)});function u(c){n.$$.not_equal(s.viewQuery,c)&&(s.viewQuery=c,t(0,s))}const f=()=>{r.length&&Yn("fields")};return n.$$set=c=>{"collection"in c&&t(0,s=c.collection)},n.$$.update=()=>{n.$$.dirty&16&&a(i)},[s,l,o,r,i,u,f]}class QD extends we{constructor(e){super(),ve(this,e,XD,GD,be,{collection:0})}}function kh(n,e,t){const i=n.slice();return i[15]=e[t],i}function yh(n){let e,t,i,s,l,o,r,a,u,f,c,d,m,h,g,_,k,S,$,T,O,E,L,I,A=ce(n[4]),P=[];for(let N=0;N<A.length;N+=1)P[N]=wh(kh(n,A,N));return{c(){e=b("div"),t=b("div"),i=b("div"),s=b("p"),s.textContent="The following record fields are available:",l=C(),o=b("div");for(let N=0;N<P.length;N+=1)P[N].c();r=C(),a=b("hr"),u=C(),f=b("p"),f.innerHTML="The request fields could be accessed with the special <em>@request</em> filter:",c=C(),d=b("div"),d.innerHTML="<code>@request.headers.*</code> <code>@request.query.*</code> <code>@request.body.*</code> <code>@request.auth.*</code>",m=C(),h=b("hr"),g=C(),_=b("p"),_.innerHTML=`You could also add constraints and query other collections using the
2025-04-02 16:38:19 +08:00
<em>@collection</em> filter:`,k=C(),S=b("div"),S.innerHTML="<code>@collection.ANY_COLLECTION_NAME.*</code>",$=C(),T=b("hr"),O=C(),E=b("p"),E.innerHTML=`Example rule:
<br/> <code>@request.auth.id != &quot;&quot; &amp;&amp; created &gt; &quot;2022-01-01 00:00:00&quot;</code>`,p(s,"class","m-b-0"),p(o,"class","inline-flex flex-gap-5"),p(a,"class","m-t-10 m-b-5"),p(f,"class","m-b-0"),p(d,"class","inline-flex flex-gap-5"),p(h,"class","m-t-10 m-b-5"),p(_,"class","m-b-0"),p(S,"class","inline-flex flex-gap-5"),p(T,"class","m-t-10 m-b-5"),p(i,"class","content"),p(t,"class","alert alert-warning m-0")},m(N,R){w(N,e,R),y(e,t),y(t,i),y(i,s),y(i,l),y(i,o);for(let z=0;z<P.length;z+=1)P[z]&&P[z].m(o,null);y(i,r),y(i,a),y(i,u),y(i,f),y(i,c),y(i,d),y(i,m),y(i,h),y(i,g),y(i,_),y(i,k),y(i,S),y(i,$),y(i,T),y(i,O),y(i,E),I=!0},p(N,R){if(R&24){A=ce(N[4]);let z;for(z=0;z<A.length;z+=1){const F=kh(N,A,z);P[z]?P[z].p(F,R):(P[z]=wh(F),P[z].c(),P[z].m(o,null))}for(;z<P.length;z+=1)P[z].d(1);P.length=A.length}},i(N){I||(N&&tt(()=>{I&&(L||(L=qe(e,ht,{duration:150},!0)),L.run(1))}),I=!0)},o(N){N&&(L||(L=qe(e,ht,{duration:150},!1)),L.run(0)),I=!1},d(N){N&&v(e),dt(P,N),N&&L&&L.end()}}}function vh(n){let e,t=n[15]+"",i;return{c(){e=b("code"),i=W(t)},m(s,l){w(s,e,l),y(e,i)},p(s,l){l&16&&t!==(t=s[15]+"")&&se(i,t)},d(s){s&&v(e)}}}function wh(n){let e=!n[3].includes(n[15]),t,i=e&&vh(n);return{c(){i&&i.c(),t=ke()},m(s,l){i&&i.m(s,l),w(s,t,l)},p(s,l){l&24&&(e=!s[3].includes(s[15])),e?i?i.p(s,l):(i=vh(s),i.c(),i.m(t.parentNode,t)):i&&(i.d(1),i=null)},d(s){s&&v(t),i&&i.d(s)}}}function Sh(n){let e,t,i,s,l,o,r,a,u;function f(_){n[8](_)}let c={label:"Create rule",formKey:"createRule",collection:n[0],$$slots:{afterLabel:[xD,({isSuperuserOnly:_})=>({14:_}),({isSuperuserOnly:_})=>_?16384:0]},$$scope:{ctx:n}};n[0].createRule!==void 0&&(c.rule=n[0].createRule),e=new ll({props:c}),ne.push(()=>ge(e,"rule",f));function d(_){n[9](_)}let m={label:"Update rule",formKey:"updateRule",collection:n[0],$$slots:{afterLabel:[eI,({isSuperuserOnly:_})=>({14:_}),({isSuperuserOnly:_})=>_?16384:0]},$$scope:{ctx:n}};n[0].updateRule!==void 0&&(m.rule=n[0].updateRule),s=new ll({props:m}),ne.push(()=>ge(s,"rule",d));function h(_){n[10](_)}let g={label:"Delete rule",formKey:"deleteRule",collection:n[0]};return n[0].deleteRule!==void 0&&(g.rule=n[0].deleteRule),r=new ll({props:g}),ne.push(()=>ge(r,"rule",h)),{c(){H(e.$$.fragment),i=C(),H(s.$$.fragment),o=C(),H(r.$$.fragment)},m(_,k){q(e,_,k),w(_,i,k),q(s,_,k),w(_,o,k),q(r,_,k),u=!0},p(_,k){const S={};k&1&&(S.collection=_[0]),k&278528&&(S.$$scope={dirty:k,ctx:_}),!t&&k&1&&(t=!0,S.rule=_[0].createRule,$e(()=>t=!1)),e.$set(S);const $={};k&1&&($.collection=_[0]),k&278528&&($.$$scope={dirty:k,ctx:_}),!l&&k&1&&(l=!0,$.rule=_[0].updateRule,$e(()=>l=!1)),s.$set($);const T={};k&1&&(T.collection=_[0]),!a&&k&1&&(a=!0,T.rule=_[0].deleteRule,$e(()=>a=!1)),r.$set(T)},i(_){u||(M(e.$$.fragment,_),M(s.$$.fragment,_),M(r.$$.fragment,_),u=!0)},o(_){D(e.$$.fragment,_),D(s.$$.fragment,_),D(r.$$.fragment,_),u=!1},d(_){_&&(v(i),v(o)),j(e,_),j(s,_),j(r,_)}}}function Th(n){let e,t,i;return{c(){e=b("i"),p(e,"class","ri-information-line link-hint")},m(s,l){w(s,e,l),t||(i=Oe(Re.call(null,e,{text:"The main record fields hold the values that are going to be inserted in the database.",position:"top"})),t=!0)},d(s){s&&v(e),t=!1,i()}}}function xD(n){let e,t=!n[14]&&Th();return{c(){t&&t.c(),e=ke()},m(i,s){t&&t.m(i,s),w(i,e,s)},p(i,s){i[14]?t&&(t.d(1),t=null):t||(t=Th(),t.c(),t.m(e.parentNode,e))},d(i){i&&v(e),t&&t.d(i)}}}function $h(n){let e,t,i;return{c(){e=b("i"),p(e,"class","ri-information-line link-hint")},m(s,l){w(s,e,l),t||(i=Oe(Re.call(null,e,{text:`The main record fields represent the old/existing record field values.
To target the newly submitted ones you can use @request.body.*`,position:"top"})),t=!0)},d(s){s&&v(e),t=!1,i()}}}function eI(n){let e,t=!n[14]&&$h();return{c(){t&&t.c(),e=ke()},m(i,s){t&&t.m(i,s),w(i,e,s)},p(i,s){i[14]?t&&(t.d(1),t=null):t||(t=$h(),t.c(),t.m(e.parentNode,e))},d(i){i&&v(e),t&&t.d(i)}}}function Ch(n){let e,t,i,s,l,o,r,a,u,f,c;function d(_,k){return _[2]?nI:tI}let m=d(n),h=m(n),g=n[2]&&Oh(n);return{c(){e=b("hr"),t=C(),i=b("button"),s=b("strong"),s.textContent="Additional auth collection rules",l=C(),h.c(),r=C(),g&&g.c(),a=ke(),p(s,"class","txt"),p(i,"type","button"),p(i,"class",o="btn btn-sm m-b-sm "+(n[2]?"btn-secondary":"btn-hint btn-transparent"))},m(_,k){w(_,e,k),w(_,t,k),w(_,i,k),y(i,s),y(i,l),h.m(i,null),w(_,r,k),g&&g.m(_,k),w(_,a,k),u=!0,f||(c=Y(i,"click",n[11]),f=!0)},p(_,k){m!==(m=d(_))&&(h.d(1),h=m(_),h&&(h.c(),h.m(i,null))),(!u||k&4&&o!==(o="btn btn-sm m-b-sm "+(_[2]?"btn-secondary":"btn-hint btn-transparent")))&&p(i,"class",o),_[2]?g?(g.p(_,k),k&4&&M(g,1)):(g=Oh(_),g.c(),M(g,1),g.m(a.parentNode,a)):g&&(oe(),D(g,1,1,()=>{g=null}),re())},i(_){u||(M(g),u=!0)},o(_){D(g),u=!1},d(_){_&&(v(e),v(t),v(i),v(r),v(a)),h.d(),g&&g.d(_),f=!1,c()}}}function tI(n){let e;return{c(){e=b("i"),p(e,"class","ri-arrow-down-s-line txt-sm")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function nI(n){let e;return{c(){e=b("i"),p(e,"class","ri-arrow-up-s-line txt-sm")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function Oh(n){let e,t,i,s,l,o,r,a;function u(m){n[12](m)}let f={label:"Authentication rule",formKey:"authRule",placeholder:"",collection:n[0],$$slots:{default:[iI]},$$scope:{ctx:n}};n[0].authRule!==void 0&&(f.rule=n[0].authRule),t=new ll({props:f}),ne.push(()=>ge(t,"rule",u));function c(m){n[13](m)}let d={label:"Manage rule",formKey:"manageRule",placeholder:"",required:n[0].manageRule!==null,collection:n[0],$$slots:{default:[lI]},$$scope:{ctx:n}};return n[0].manageRule!==void 0&&(d.rule=n[0].manageRule),l=new ll({props:d}),ne.push(()=>ge(l,"rule",c)),{c(){e=b("div"),H(t.$$.fragment),s=C(),H(l.$$.fragment),p(e,"class","block")},m(m,h){w(m,e,h),q(t,e,null),y(e,s),q(l,e,null),a=!0},p(m,h){const g={};h&1&&(g.collection=m[0]),h&262144&&(g.$$scope={dirty:h,ctx:m}),!i&&h&1&&(i=!0,g.rule=m[0].authRule,$e(()=>i=!1)),t.$set(g);const _={};h&1&&(_.required=m[0].manageRule!==null),h&1&&(_.collection=m[0]),h&262144&&(_.$$scope={dirty:h,ctx:m}),!o&&h&1&&(o=!0,_.rule=m[0].manageRule,$e(()=>o=!1)),l.$set(_)},i(m){a||(M(t.$$.fragment,m),M(l.$$.fragment,m),m&&tt(()=>{a&&(r||(r=qe(e,ht,{duration:150},!0)),r.run(1))}),a=!0)},o(m){D(t.$$.fragment,m),D(l.$$.fragment,m),m&&(r||(r=qe(e,ht,{duration:150},!1)),r.run(0)),a=!1},d(m){m&&v(e),j(t),j(l),m&&r&&r.end()}}}function iI(n){let e,t,i,s,l,o,r;return{c(){e=b("p"),e.textContent=`This rule is executed every time before authentication allowing you to restrict who
2025-04-02 16:38:19 +08:00
can authenticate.`,t=C(),i=b("p"),i.innerHTML=`For example, to allow only verified users you can set it to
<code>verified = true</code>.`,s=C(),l=b("p"),l.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){w(a,e,u),w(a,t,u),w(a,i,u),w(a,s,u),w(a,l,u),w(a,o,u),w(a,r,u)},p:te,d(a){a&&(v(e),v(t),v(i),v(s),v(l),v(o),v(r))}}}function lI(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
2025-04-02 16:38:19 +08:00
rules.`,t=C(),i=b("p"),i.textContent=`It enables superuser-like permissions to allow fully managing the auth record(s), eg.
changing the password without requiring to enter the old one, directly updating the
verified state or email, etc.`},m(s,l){w(s,e,l),w(s,t,l),w(s,i,l)},p:te,d(s){s&&(v(e),v(t),v(i))}}}function sI(n){var R,z;let e,t,i,s,l,o=n[1]?"Hide available fields":"Show available fields",r,a,u,f,c,d,m,h,g,_,k,S,$,T,O=n[1]&&yh(n);function E(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 ll({props:L}),ne.push(()=>ge(f,"rule",E));function I(F){n[7](F)}let A={label:"View rule",formKey:"viewRule",collection:n[0]};n[0].viewRule!==void 0&&(A.rule=n[0].viewRule),m=new ll({props:A}),ne.push(()=>ge(m,"rule",I));let P=((R=n[0])==null?void 0:R.type)!=="view"&&Sh(n),N=((z=n[0])==null?void 0:z.type)==="auth"&&Ch(n);return{c(){e=b("div"),t=b("div"),i=b("p"),i.innerHTML=`All rules follow the
2025-04-02 16:38:19 +08:00
<a href="https://pocketbase.io/docs/api-rules-and-filters" target="_blank" rel="noopener noreferrer">PocketBase filter syntax and operators
</a>.`,s=C(),l=b("button"),r=W(o),a=C(),O&&O.c(),u=C(),H(f.$$.fragment),d=C(),H(m.$$.fragment),g=C(),P&&P.c(),_=C(),N&&N.c(),k=ke(),p(l,"type","button"),p(l,"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,B){w(F,e,B),y(e,t),y(t,i),y(t,s),y(t,l),y(l,r),y(e,a),O&&O.m(e,null),w(F,u,B),q(f,F,B),w(F,d,B),q(m,F,B),w(F,g,B),P&&P.m(F,B),w(F,_,B),N&&N.m(F,B),w(F,k,B),S=!0,$||(T=Y(l,"click",n[5]),$=!0)},p(F,[B]){var Z,G;(!S||B&2)&&o!==(o=F[1]?"Hide available fields":"Show available fields")&&se(r,o),F[1]?O?(O.p(F,B),B&2&&M(O,1)):(O=yh(F),O.c(),M(O,1),O.m(e,null)):O&&(oe(),D(O,1,1,()=>{O=null}),re());const J={};B&1&&(J.collection=F[0]),!c&&B&1&&(c=!0,J.rule=F[0].listRule,$e(()=>c=!1)),f.$set(J);const V={};B&1&&(V.collection=F[0]),!h&&B&1&&(h=!0,V.rule=F[0].viewRule,$e(()=>h=!1)),m.$set(V),((Z=F[0])==null?void 0:Z.type)!=="view"?P?(P.p(F,B),B&1&&M(P,1)):(P=Sh(F),P.c(),M(P,1),P.m(_.parentNode,_)):P&&(oe(),D(P,1,1,()=>{P=null}),re()),((G=F[0])==null?void 0:G.type)==="auth"?N?(N.p(F,B),B&1&&M(N,1)):(N=Ch(F),N.c(),M(N,1),N.m(k.parentNode,k)):N&&(oe(),D(N,1,1,()=>{N=null}),re())},i(F){S||(M(O),M(f.$$.fragment,F),M(m.$$.fragment,F),M(P),M(N),S=!0)},o(F){D(O),D(f.$$.fragment,F),D(m.$$.fragment,F),D(P),D(N),S=!1},d(F){F&&(v(e),v(u),v(d),v(g),v(_),v(k)),O&&O.d(),j(f,F),j(m,F),P&&P.d(F),N&&N.d(F),$=!1,T()}}}function oI(n,e,t){let i,s,{collection:l}=e,o=!1,r=l.manageRule!==null||l.authRule!=="";const a=()=>t(1,o=!o);function u(k){n.$$.not_equal(l.listRule,k)&&(l.listRule=k,t(0,l))}function f(k){n.$$.not_equal(l.viewRule,k)&&(l.viewRule=k,t(0,l))}function c(k){n.$$.not_equal(l.createRule,k)&&(l.createRule=k,t(0,l))}function d(k){n.$$.not_equal(l.updateRule,k)&&(l.updateRule=k,t(0,l))}function m(k){n.$$.not_equal(l.deleteRule,k)&&(l.deleteRule=k,t(0,l))}const h=()=>{t(2,r=!r)};function g(k){n.$$.not_equal(l.authRule,k)&&(l.authRule=k,t(0,l))}function _(k){n.$$.not_equal(l.manageRule,k)&&(l.manageRule=k,t(0,l))}return n.$$set=k=>{"collection"in k&&t(0,l=k.collection)},n.$$.update=()=>{var k;n.$$.dirty&1&&t(4,i=U.getAllCollectionIdentifiers(l)),n.$$.dirty&1&&t(3,s=(k=l.fields)==null?void 0:k.filter(S=>S.hidden).map(S=>S.name))},[l,o,r,s,i,a,u,f,c,d,m,h,g,_]}class rI extends we{constructor(e){super(),ve(this,e,oI,sI,be,{collection:0})}}function Mh(n,e,t){const i=n.slice();return i[27]=e[t],i}function Eh(n,e,t){const i=n.slice();return i[30]=e[t],i}function Dh(n,e,t){const i=n.slice();return i[33]=e[t],i}function Ih(n,e,t){const i=n.slice();return i[33]=e[t],i}function Lh(n,e,t){const i=n.slice();return i[33]=e[t],i}function Ah(n){let e,t,i,s,l,o,r=n[9].length&&Ph();return{c(){e=b("div"),t=b("div"),t.innerHTML='<i class="ri-error-warning-line"></i>',i=C(),s=b("div"),l=b("p"),l.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(s,"class","content txt-bold"),p(e,"class","alert alert-warning")},m(a,u){w(a,e,u),y(e,t),y(e,i),y(e,s),y(s,l),y(s,o),r&&r.m(s,null)},p(a,u){a[9].length?r||(r=Ph(),r.c(),r.m(s,null)):r&&(r.d(1),r=null)},d(a){a&&v(e),r&&r.d()}}}function Ph(n){let e;return{c(){e=b("p"),e.textContent="All data associated with the removed fields will be permanently deleted!"},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function Nh(n){let e,t,i,s,l,o,r=n[5]&&Rh(n),a=!n[4]&&Fh(n),u=ce(n[3]),f=[];for(let m=0;m<u.length;m+=1)f[m]=zh(Eh(n,u,m));let c=ce(n[7]),d=[];for(let m=0;m<c.length;m+=1)d[m]=Uh(Mh(n,c,m));return{c(){e=b("h6"),e.textContent="Changes:",t=C(),i=b("ul"),r&&r.c(),s=C(),a&&a.c(),l=C();for(let m=0;m<f.length;m+=1)f[m].c();o=C();for(let m=0;m<d.length;m+=1)d[m].c();p(i,"class","changes-list svelte-xqpcsf")},m(m,h){w(m,e,h),w(m,t,h),w(m,i,h),r&&r.m(i,null),y(i,s),a&&a.m(i,null),y(i,l);for(let g=0;g<f.length;g+=1)f[g]&&f[g].m(i,null);y(i,o);for(let g=0;g<d.length;g+=1)d[g]&&d[g].m(i,null)},p(m,h){if(m[5]?r?r.p(m,h):(r=Rh(m),r.c(),r.m(i,s)):r&&(r.d(1),r=null),m[4]?a&&(a.d(1),a=null):a?a.p(m,h):(a=Fh(m),a.c(),a.m(i,l)),h[0]&8){u=ce(m[3]);let g;for(g=0;g<u.length;g+=1){const _=Eh(m,u,g);f[g]?f[g].p(_,h):(f[g]=zh(_),f[g].c(),f[g].m(i,o))}for(;g<f.length;g+=1)f[g].d(1);f.length=u.length}if(h[0]&8320){c=ce(m[7]);let g;for(g=0;g<c.length;g+=1){const _=Mh(m,c,g);d[g]?d[g].p(_,h):(d[g]=Uh(_),d[g].c(),d[g].m(i,null))}for(;g<d.length;g+=1)d[g].d(1);d.length=c.length}},d(m){m&&(v(e),v(t),v(i)),r&&r.d(),a&&a.d(),dt(f,m),dt(d,m)}}}function Rh(n){var m,h;let e,t,i,s,l=((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=W(`Renamed collection
`),s=b("strong"),o=W(l),r=C(),a=b("i"),u=C(),f=b("strong"),d=W(c),p(s,"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,_){w(g,e,_),y(e,t),y(t,i),y(t,s),y(s,o),y(t,r),y(t,a),y(t,u),y(t,f),y(f,d)},p(g,_){var k,S;_[0]&2&&l!==(l=((k=g[1])==null?void 0:k.name)+"")&&se(o,l),_[0]&4&&c!==(c=((S=g[2])==null?void 0:S.name)+"")&&se(d,c)},d(g){g&&v(e)}}}function Fh(n){let e,t,i,s=ce(n[8]),l=[];for(let f=0;f<s.length;f+=1)l[f]=qh(Lh(n,s,f));let o=ce(n[10]),r=[];for(let f=0;f<o.length;f+=1)r[f]=jh(Ih(n,o,f));let a=ce(n[9]),u=[];for(let f=0;f<a.length;f+=1)u[f]=Hh(Dh(n,a,f));return{c(){for(let f=0;f<l.length;f+=1)l[f].c();e=C();for(let f=0;f<r.length;f+=1)r[f].c();t=C();for(let f=0;f<u.length;f+=1)u[f].c();i=ke()},m(f,c){for(let d=0;d<l.length;d+=1)l[d]&&l[d].m(f,c);w(f,e,c);for(let d=0;d<r.length;d+=1)r[d]&&r[d].m(f,c);w(f,t,c);for(let d=0;d<u.length;d+=1)u[d]&&u[d].m(f,c);w(f,i,c)},p(f,c){if(c[0]&256){s=ce(f[8]);let d;for(d=0;d<s.length;d+=1){const m=Lh(f,s,d);l[d]?l[d].p(m,c):(l[d]=qh(m),l[d].c(),l[d].m(e.parentNode,e))}for(;d<l.length;d+=1)l[d].d(1);l.length=s.length}if(c[0]&1024){o=ce(f[10]);let d;for(d=0;d<o.length;d+=1){const m=Ih(f,o,d);r[d]?r[d].p(m,c):(r[d]=jh(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]&512){a=ce(f[9]);let d;for(d=0;d<a.length;d+=1){const m=Dh(f,a,d);u[d]?u[d].p(m,c):(u[d]=Hh(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(l,f),dt(r,f),dt(u,f)}}}function qh(n){let e,t,i,s=n[33].name+"",l,o,r;return{c(){e=b("li"),t=W(`Multiple to single value conversion of field
`),i=b("strong"),l=W(s),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){w(a,e,u),y(e,t),y(e,i),y(i,l),y(e,o),y(e,r)},p(a,u){u[0]&256&&s!==(s=a[33].name+"")&&se(l,s)},d(a){a&&v(e)}}}function jh(n){let e,t,i,s,l=n[33]._originalName+"",o,r,a,u,f,c=n[33].name+"",d;return{c(){e=b("li"),t=b("div"),i=W(`Renamed field
`),s=b("strong"),o=W(l),r=C(),a=b("i"),u=C(),f=b("strong"),d=W(c),p(s,"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){w(m,e,h),y(e,t),y(t,i),y(t,s),y(s,o),y(t,r),y(t,a),y(t,u),y(t,f),y(f,d)},p(m,h){h[0]&1024&&l!==(l=m[33]._originalName+"")&&se(o,l),h[0]&1024&&c!==(c=m[33].name+"")&&se(d,c)},d(m){m&&v(e)}}}function Hh(n){let e,t,i,s=n[33].name+"",l,o;return{c(){e=b("li"),t=W("Removed field "),i=b("span"),l=W(s),o=C(),p(i,"class","txt-bold"),p(e,"class","txt-danger svelte-xqpcsf")},m(r,a){w(r,e,a),y(e,t),y(e,i),y(i,l),y(e,o)},p(r,a){a[0]&512&&s!==(s=r[33].name+"")&&se(l,s)},d(r){r&&v(e)}}}function zh(n){let e,t,i,s=n[30].prop+"",l,o,r,a,u,f,c,d,m=(n[30].oldRule===null?"null (superusers only)":n[30].oldRule||'""')+"",h,g,_,k,S,$,T,O,E=(n[30].newRule===null?"null (superusers only)":n[30].newRule||'""')+"",L;return{c(){e=b("li"),t=W("Changed API rule "),i=b("code"),l=W(s),o=W(`:
2025-04-02 16:38:19 +08:00
`),r=b("br"),a=C(),u=b("small"),f=b("strong"),f.textContent="Old",c=W(`:
`),d=b("span"),h=W(m),g=C(),_=b("br"),k=C(),S=b("small"),$=b("strong"),$.textContent="New",T=W(`:
`),O=b("span"),L=W(E),p(i,"class","txt-sm"),p(d,"class","txt-preline"),p(u,"class","txt-mono txt-hint"),p(O,"class","txt-preline"),p(S,"class","txt-mono txt-success"),p(e,"class","svelte-xqpcsf")},m(I,A){w(I,e,A),y(e,t),y(e,i),y(i,l),y(e,o),y(e,r),y(e,a),y(e,u),y(u,f),y(u,c),y(u,d),y(d,h),y(e,g),y(e,_),y(e,k),y(e,S),y(S,$),y(S,T),y(S,O),y(O,L)},p(I,A){A[0]&8&&s!==(s=I[30].prop+"")&&se(l,s),A[0]&8&&m!==(m=(I[30].oldRule===null?"null (superusers only)":I[30].oldRule||'""')+"")&&se(h,m),A[0]&8&&E!==(E=(I[30].newRule===null?"null (superusers only)":I[30].newRule||'""')+"")&&se(L,E)},d(I){I&&v(e)}}}function Uh(n){let e,t,i,s=n[27].name+"",l,o,r,a,u=n[27].oldHost+"",f,c,d,m,h,g=n[27].newHost+"",_,k,S,$,T,O,E,L,I,A,P,N,R,z,F,B,J;return{c(){e=b("li"),t=W("Changed "),i=b("code"),l=W(s),o=W(` host
2025-04-02 16:38:19 +08:00
`),r=b("div"),a=b("strong"),f=W(u),c=C(),d=b("i"),m=C(),h=b("strong"),_=W(g),k=C(),S=b("br"),$=C(),T=b("em"),O=W(`If the old and new OIDC configuration is not for the same provider consider deleting
all old `),E=b("code"),E.textContent="_externalAuths",L=W(` records associated to the current
collection and provider, otherwise it may result in account linking errors.
`),I=b("a"),A=W("Review existing "),P=b("code"),P.textContent="_externalAuths",N=W(` records
`),R=b("i"),z=C(),B=W("."),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(E,"class","txt-sm"),p(P,"class","txt-sm"),p(R,"class","ri-external-link-line txt-sm"),p(I,"href",F=n[13](n[27].name)),p(I,"target","_blank"),p(T,"class","txt-hint"),p(e,"class","svelte-xqpcsf")},m(V,Z){w(V,e,Z),y(e,t),y(e,i),y(i,l),y(e,o),y(e,r),y(r,a),y(a,f),y(r,c),y(r,d),y(r,m),y(r,h),y(h,_),y(e,k),y(e,S),y(e,$),y(e,T),y(T,O),y(T,E),y(T,L),y(T,I),y(I,A),y(I,P),y(I,N),y(I,R),y(I,z),y(T,B),y(e,J)},p(V,Z){Z[0]&128&&s!==(s=V[27].name+"")&&se(l,s),Z[0]&128&&u!==(u=V[27].oldHost+"")&&se(f,u),Z[0]&128&&g!==(g=V[27].newHost+"")&&se(_,g),Z[0]&128&&F!==(F=V[13](V[27].name))&&p(I,"href",F)},d(V){V&&v(e)}}}function aI(n){let e,t,i=(n[5]||n[9].length||n[10].length)&&Ah(n),s=n[11]&&Nh(n);return{c(){i&&i.c(),e=C(),s&&s.c(),t=ke()},m(l,o){i&&i.m(l,o),w(l,e,o),s&&s.m(l,o),w(l,t,o)},p(l,o){l[5]||l[9].length||l[10].length?i?i.p(l,o):(i=Ah(l),i.c(),i.m(e.parentNode,e)):i&&(i.d(1),i=null),l[11]?s?s.p(l,o):(s=Nh(l),s.c(),s.m(t.parentNode,t)):s&&(s.d(1),s=null)},d(l){l&&(v(e),v(t)),i&&i.d(l),s&&s.d(l)}}}function uI(n){let e;return{c(){e=b("h4"),e.textContent="Confirm collection changes"},m(t,i){w(t,e,i)},p:te,d(t){t&&v(e)}}}function fI(n){let e,t,i,s,l;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){w(o,e,r),w(o,t,r),w(o,i,r),e.focus(),s||(l=[Y(e,"click",n[15]),Y(i,"click",n[16])],s=!0)},p:te,d(o){o&&(v(e),v(t),v(i)),s=!1,Ee(l)}}}function cI(n){let e,t,i={class:"confirm-changes-panel",popup:!0,$$slots:{footer:[fI],header:[uI],default:[aI]},$$scope:{ctx:n}};return e=new nn({props:i}),n[17](e),e.$on("hide",n[18]),e.$on("show",n[19]),{c(){H(e.$$.fragment)},m(s,l){q(e,s,l),t=!0},p(s,l){const o={};l[0]&4030|l[1]&512&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(M(e.$$.fragment,s),t=!0)},o(s){D(e.$$.fragment,s),t=!1},d(s){n[17](null),j(e,s)}}}function dI(n,e,t){let i,s,l,o,r,a,u;const f=wt();let c,d,m,h,g=[],_=[];async function k(F,B,J=!0){t(1,d=F),t(2,m=B),h=J,await O(),I(),await _n(),i||o.length||r.length||a.length||g.length||_.length?c==null||c.show():$()}function S(){c==null||c.hide()}function $(){S(),f("confirm",h)}const T=["oidc","oidc2","oidc3"];async function O(){var F,B,J,V;t(7,g=[]);for(let Z of T){let G=(B=(F=d==null?void 0:d.oauth2)==null?void 0:F.providers)==null?void 0:B.find(Ce=>Ce.name==Z),de=(V=(J=m==null?void 0:m.oauth2)==null?void 0:J.providers)==null?void 0:V.find(Ce=>Ce.name==Z);if(!G||!de)continue;let pe=new URL(G.authURL).host,ae=new URL(de.authURL).host;pe!=ae&&await E(Z)&&g.push({name:Z,oldHost:pe,newHost:ae})}}async function E(F){try{return await _e.collection("_externalAuths").getFirstListItem(_e.filter("collectionRef={:collectionId} && provider={:provider}",{collectionId:m==null?void 0:m.id,provider:F})),!0}catch{}return!1}function L(F){return`#/collections?collection=_externalAuths&filter=collectionRef%3D%22${m==null?void 0:m.id}%22+%26%26+provider%3D%22${F}%22`}function I(){if(t(3,_=[]),window.location.protocol!="https:")return;const F=["listRule","viewRule"];s||F.push("createRule","updateRule","deleteRule"),l&&F.push("manageRule","authRule");let B,J;for(let V of F)B=d==null?void 0:d[V],J=m==null?void 0:m[V],B!==J&&_.push({prop:V,oldRule:B,newRule:J})}const A=()=>S(),P=()=>$();function N(F){ne[F?"unshift":"push"](()=>{c=F,t(6,c)})}function R(F){Le.call(this,n,F)}function z(F){Le.call(this,n,F)}return n.$$.update=()=>{var F,B,J;n.$$.dirty[0]&6&&t(5,i=(d==null?void 0:d.name)!=(m==null?void 0:m.name)),n.$$.dirty[0]&4&&t(4,s=(m==null?void 0:m.type)==="view"),n.$$.dirty[0]&4&&(l=(m==null?void 0:m.type)==="auth"),n.$$.dirty[0]&20&&t(10,o=!s&&((F=m==null?void 0:m.fields)==null?void 0:F.filter(V=>V.id&&!V._toDelete&&V._originalName!=V.name))||[]),n.$$.dirty[0]&20&&t(9,r=!s&&((B=m==null?void 0:m.fields)==null?
`+U.truncate(JSON.stringify(U.truncateObject(P_(n[0],"expand")),null,2),800,!0),class:"code",position:"left"})),Y(s,"click",en(n[1])),Y(s,"keydown",en(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(s,"href",o),r&&Lt(r.update)&&d&1&&r.update.call(null,{text:`Open relation record in new tab:
`+U.truncate(JSON.stringify(U.truncateObject(P_(c[0],"expand")),null,2),800,!0),class:"code",position:"left"})},i(c){a||(M(t.$$.fragment,c),a=!0)},o(c){D(t.$$.fragment,c),a=!1},d(c){c&&v(e),j(t),u=!1,Ee(f)}}}function P_(n,...e){const t=Object.assign({},n);for(let i of e)delete t[i];return t}function hL(n,e,t){let{record:i}=e;function s(o){Le.call(this,n,o)}function l(o){Le.call(this,n,o)}return n.$$set=o=>{"record"in o&&t(0,i=o.record)},[i,s,l]}class qr extends we{constructor(e){super(),ve(this,e,hL,mL,be,{record:0})}}function N_(n,e,t){const i=n.slice();return i[19]=e[t],i[9]=t,i}function R_(n,e,t){const i=n.slice();return i[14]=e[t],i}function F_(n,e,t){const i=n.slice();return i[7]=e[t],i[9]=t,i}function q_(n,e,t){const i=n.slice();return i[7]=e[t],i[9]=t,i}function _L(n){const e=n.slice(),t=U.toArray(e[3]);e[17]=t;const i=e[2]?10:500;return e[18]=i,e}function gL(n){var l,o;const e=n.slice(),t=U.toArray(e[3]);e[10]=t;const i=U.toArray((o=(l=e[0])==null?void 0:l.expand)==null?void 0:o[e[1].name]);e[11]=i;const s=e[2]?20:500;return e[12]=s,e}function bL(n){const e=n.slice(),t=U.trimQuotedValue(JSON.stringify(e[3]))||'""';return e[6]=t,e}function kL(n){let e,t;return{c(){e=b("div"),t=W(n[3]),p(e,"class","block txt-break fallback-block svelte-jdf51v")},m(i,s){w(i,e,s),y(e,t)},p(i,s){s&8&&se(t,i[3])},i:te,o:te,d(i){i&&v(e)}}}function yL(n){let e,t=U.truncate(n[3])+"",i,s;return{c(){e=b("span"),i=W(t),p(e,"class","txt txt-ellipsis"),p(e,"title",s=U.truncate(n[3]))},m(l,o){w(l,e,o),y(e,i)},p(l,o){o&8&&t!==(t=U.truncate(l[3])+"")&&se(i,t),o&8&&s!==(s=U.truncate(l[3]))&&p(e,"title",s)},i:te,o:te,d(l){l&&v(e)}}}function vL(n){let e,t,i;return t=new Ny({props:{value:n[3]}}),{c(){e=b("div"),H(t.$$.fragment),p(e,"class","label")},m(s,l){w(s,e,l),q(t,e,null),i=!0},p(s,l){const o={};l&8&&(o.value=s[3]),t.$set(o)},i(s){i||(M(t.$$.fragment,s),i=!0)},o(s){D(t.$$.fragment,s),i=!1},d(s){s&&v(e),j(t)}}}function wL(n){let e,t=[],i=new Map,s,l,o=ce(n[17].slice(0,n[18]));const r=u=>u[9]+u[19];for(let u=0;u<o.length;u+=1){let f=N_(n,o,u),c=r(f);i.set(c,t[u]=j_(c,f))}let a=n[17].length>n[18]&&H_();return{c(){e=b("div");for(let u=0;u<t.length;u+=1)t[u].c();s=C(),a&&a.c(),p(e,"class","inline-flex"),x(e,"multiple",n[1].maxSelect!=1)},m(u,f){w(u,e,f);for(let c=0;c<t.length;c+=1)t[c]&&t[c].m(e,null);y(e,s),a&&a.m(e,null),l=!0},p(u,f){f&13&&(o=ce(u[17].slice(0,u[18])),oe(),t=kt(t,f,r,1,u,o,i,e,Yt,j_,s,N_),re()),u[17].length>u[18]?a||(a=H_(),a.c(),a.m(e,null)):a&&(a.d(1),a=null),(!l||f&2)&&x(e,"multiple",u[1].maxSelect!=1)},i(u){if(!l){for(let f=0;f<o.length;f+=1)M(t[f]);l=!0}},o(u){for(let f=0;f<t.length;f+=1)D(t[f]);l=!1},d(u){u&&v(e);for(let f=0;f<t.length;f+=1)t[f].d();a&&a.d()}}}function SL(n){let e,t,i,s,l;const o=[PL,AL],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]&&V_();return{c(){e=b("div"),i.c(),s=C(),u&&u.c(),p(e,"class","inline-flex")},m(f,c){w(f,e,c),r[t].m(e,null),y(e,s),u&&u.m(e,null),l=!0},p(f,c){let d=t;t=a(f),t===d?r[t].p(f,c):(oe(),D(r[d],1,1,()=>{r[d]=null}),re(),i=r[t],i?i.p(f,c):(i=r[t]=o[t](f),i.c()),M(i,1),i.m(e,s)),f[10].length>f[12]?u||(u=V_(),u.c(),u.m(e,null)):u&&(u.d(1),u=null)},i(f){l||(M(i),l=!0)},o(f){D(i),l=!1},d(f){f&&v(e),r[t].d(),u&&u.d()}}}function TL(n){let e,t=[],i=new Map,s=ce(U.toArray(n[3]));const l=o=>o[9]+o[7];for(let o=0;o<s.length;o+=1){let r=q_(n,s,o),a=l(r);i.set(a,t[o]=B_(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){w(o,e,r);for(let a=0;a<t.length;a+=1)t[a]&&t[a].m(e,null)},p(o,r){r&8&&(s=ce(U.toArray(o[3])),t=kt(t,r,l,1,o,s,i,e,si,B_,null,q_))},i:te,o:te,d(o){o&&v(e);for(let r=0;r<t.length;r+=1)t[r].d()}}}function $L(n){let e,t;return e=new BI({props:{date:n[3]}}),{c(){H(e.$$.fragment)},m(i,s){q(e,i,s),t=!0},p(i,s){const l={};s&8&&(l.date=i[3]),e.$set(l)},i(i){t||(M(e.$$.fragment,i),t=!0)},o(i){D(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function CL(n){let e,t,i,s;const l=[RL,NL],o=[];function r(a,u){return a[2]?0:1}return e=r(n),t=o[e]=l[e](n),{c(){t.c(),i=ke()},m(a,u){o[e].m(a,u),w(a,i,u),s=!0},p(a,u){l
2025-04-02 16:38:19 +08:00
`),position:"left"})),i=!0)},p(l,[o]){t&&Lt(t.update)&&o&1&&t.update.call(null,{text:l[0].join(`
`),position:"left"})},i:te,o:te,d(l){l&&v(e),i=!1,s()}}}const JL="yyyy-MM-dd HH:mm:ss.SSS";function ZL(n,e,t){let i,s;Ge(n,In,a=>t(2,s=a));let{record:l}=e,o=[];function r(){t(0,o=[]);const a=i.fields||[];for(let u of a)u.type=="autodate"&&o.push(u.name+": "+U.formatToLocalDate(l[u.name],JL)+" Local")}return n.$$set=a=>{"record"in a&&t(1,l=a.record)},n.$$.update=()=>{n.$$.dirty&6&&(i=l&&s.find(a=>a.id==l.collectionId)),n.$$.dirty&2&&l&&r()},[o,l,s]}class GL extends we{constructor(e){super(),ve(this,e,ZL,KL,be,{record:1})}}function Z_(n,e,t){const i=n.slice();return i[9]=e[t],i}function XL(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){w(t,e,i)},p:te,d(t){t&&v(e)}}}function QL(n){let e,t=ce(n[1]),i=[];for(let s=0;s<t.length;s+=1)i[s]=G_(Z_(n,t,s));return{c(){e=b("div");for(let s=0;s<i.length;s+=1)i[s].c();p(e,"class","list")},m(s,l){w(s,e,l);for(let o=0;o<i.length;o+=1)i[o]&&i[o].m(e,null)},p(s,l){if(l&58){t=ce(s[1]);let o;for(o=0;o<t.length;o+=1){const r=Z_(s,t,o);i[o]?i[o].p(r,l):(i[o]=G_(r),i[o].c(),i[o].m(e,null))}for(;o<i.length;o+=1)i[o].d(1);i.length=t.length}},d(s){s&&v(e),dt(i,s)}}}function xL(n){let e;return{c(){e=b("div"),e.innerHTML='<span class="loader"></span>',p(e,"class","block txt-center")},m(t,i){w(t,e,i)},p:te,d(t){t&&v(e)}}}function G_(n){let e,t,i,s,l,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"),l=C(),o=b("span"),a=W(r),u=C(),f=b("div"),c=W("ID: "),m=W(d),h=C(),g=b("button"),g.innerHTML='<i class="ri-close-line"></i>',_=C(),Sn(i.src,s="./images/oauth2/"+((T=n[3](n[9].provider))==null?void 0:T.logo))||p(i,"src",s),p(i,"alt","Provider logo"),p(t,"class","provider-logo"),p(o,"class","txt"),p(f,"class","txt-hint"),p(g,"type","button"),p(g,"class","btn btn-transparent link-hint btn-circle btn-sm m-l-auto"),p(e,"class","list-item")},m(T,O){w(T,e,O),y(e,t),y(t,i),y(e,l),y(e,o),y(o,a),y(e,u),y(e,f),y(f,c),y(f,m),y(e,h),y(e,g),y(e,_),k||(S=Y(g,"click",$),k=!0)},p(T,O){var E;n=T,O&2&&!Sn(i.src,s="./images/oauth2/"+((E=n[3](n[9].provider))==null?void 0:E.logo))&&p(i,"src",s),O&2&&r!==(r=n[4](n[9].provider)+"")&&se(a,r),O&2&&d!==(d=n[9].providerId+"")&&se(m,d)},d(T){T&&v(e),k=!1,S()}}}function eA(n){let e;function t(l,o){var r;return l[2]?xL:(r=l[0])!=null&&r.id&&l[1].length?QL:XL}let i=t(n),s=i(n);return{c(){s.c(),e=ke()},m(l,o){s.m(l,o),w(l,e,o)},p(l,[o]){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},i:te,o:te,d(l){l&&v(e),s.d(l)}}}function tA(n,e,t){const i=wt();let{record:s}=e,l=[],o=!1;function r(d){return lf.find(m=>m.key==d)||{}}function a(d){var m;return((m=r(d))==null?void 0:m.title)||U.sentenize(d,!1)}async function u(){if(!(s!=null&&s.id)){t(1,l=[]),t(2,o=!1);return}t(2,o=!0);try{t(1,l=await _e.collection("_externalAuths").getFullList({filter:_e.filter("collectionRef = {:collectionId} && recordRef = {:recordId}",{collectionId:s.collectionId,recordId:s.id})}))}catch(d){_e.error(d)}t(2,o=!1)}function f(d){!(s!=null&&s.id)||!d||vn(`Do you really want to unlink the ${a(d.provider)} provider?`,()=>_e.collection("_externalAuths").delete(d.id).then(()=>{tn(`Successfully unlinked the ${a(d.provider)} provider.`),i("unlink",d.provider),u()}).catch(m=>{_e.error(m)}))}u();const c=d=>f(d);return n.$$set=d=>{"record"in d&&t(0,s=d.record)},[s,l,o,r,a,f,c]}class nA extends we{constructor(e){super(),ve(this,e,tA,eA,be,{record:0})}}function iA(n){let e,t,i,s,l,o,r,a,u,f;return l=new Oi({props:{value:n[1]}}),{c(){e=b("div"),t=b("span"),i=W(n[1]),s=C(),H(l.$$.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){w(c,e,d),y(e,t),y(t,i),n[6](t),y(e,s),q(l,e,null),y(e,o),y(e,r),a=!0,u||(f=[Oe(Re.call(null,r,"Refresh")),Y(r,"click",n[4])],u=!0)},p(c,d){(!a||d&2)&&se(i,c[1]);const m={};d&2&&(m.value=c[1]),l.$set(m)},i(c){a||(M(l.$$.fragment,c),a=!0)},o(c){D(l.$$.fragment,c),a=!1},d(c){c&
2025-04-02 16:38:19 +08:00
(record: `+n[44].id+")")),Y(e,"click",it(function(){Lt(n[20](n[44],n[48]))&&n[20](n[44],n[48]).apply(this,arguments)}))],l=!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))),s&&Lt(s.update)&&c[0]&32&&s.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(),l=!1,Ee(o)}}}function fg(n,e){let t,i,s=ce(e[45]),l=[];for(let o=0;o<s.length;o+=1)l[o]=ug(sg(e,s,o));return{key:n,first:null,c(){t=ke();for(let o=0;o<l.length;o+=1)l[o].c();i=ke(),this.first=t},m(o,r){w(o,t,r);for(let a=0;a<l.length;a+=1)l[a]&&l[a].m(o,r);w(o,i,r)},p(o,r){if(e=o,r[0]&1638432){s=ce(e[45]);let a;for(a=0;a<s.length;a+=1){const u=sg(e,s,a);l[a]?l[a].p(u,r):(l[a]=ug(u),l[a].c(),l[a].m(i.parentNode,i))}for(;a<l.length;a+=1)l[a].d(1);l.length=s.length}},d(o){o&&(v(t),v(i)),dt(l,o)}}}function cg(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){w(t,e,i)},d(t){t&&v(e)}}}function AA(n){let e,t;function i(r,a){if(r[15])return DA;if(!r[6])return EA}let s=i(n),l=s&&s(n),o=n[6]&&cg();return{c(){l&&l.c(),e=C(),o&&o.c(),t=ke()},m(r,a){l&&l.m(r,a),w(r,e,a),o&&o.m(r,a),w(r,t,a)},p(r,a){s===(s=i(r))&&l?l.p(r,a):(l&&l.d(1),l=s&&s(r),l&&(l.c(),l.m(e.parentNode,e))),r[6]?o||(o=cg(),o.c(),o.m(t.parentNode,t)):o&&(o.d(1),o=null)},d(r){r&&(v(e),v(t)),l&&l.d(r),o&&o.d(r)}}}function PA(n){let e,t,i,s;const l=[MA,OA],o=[];function r(a,u){return a[7].length?1:0}return e=r(n),t=o[e]=l[e](n),{c(){t.c(),i=ke()},m(a,u){o[e].m(a,u),w(a,i,u),s=!0},p(a,u){let f=e;e=r(a),e===f?o[e].p(a,u):(oe(),D(o[f],1,1,()=>{o[f]=null}),re(),t=o[e],t?t.p(a,u):(t=o[e]=l[e](a),t.c()),M(t,1),t.m(i.parentNode,i))},i(a){s||(M(t),s=!0)},o(a){D(t),s=!1},d(a){a&&v(i),o[e].d(a)}}}function NA(n){let e,t;return{c(){e=b("h4"),t=W(n[0])},m(i,s){w(i,e,s),y(e,t)},p(i,s){s[0]&1&&se(t,i[0])},d(i){i&&v(e)}}}function dg(n){let e,t;return e=new fe({props:{class:"form-field file-picker-size-select",$$slots:{default:[RA,({uniqueId:i})=>({23:i}),({uniqueId:i})=>[i?8388608:0]]},$$scope:{ctx:n}}}),{c(){H(e.$$.fragment)},m(i,s){q(e,i,s),t=!0},p(i,s){const l={};s[0]&8402944|s[1]&8388608&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(M(e.$$.fragment,i),t=!0)},o(i){D(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function RA(n){let e,t,i;function s(o){n[28](o)}let l={upside:!0,id:n[23],items:n[11],disabled:!n[13],selectPlaceholder:"Select size"};return n[12]!==void 0&&(l.keyOfSelected=n[12]),e=new Ln({props:l}),ne.push(()=>ge(e,"keyOfSelected",s)),{c(){H(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],$e(()=>t=!1)),e.$set(a)},i(o){i||(M(e.$$.fragment,o),i=!0)},o(o){D(e.$$.fragment,o),i=!1},d(o){j(e,o)}}}function FA(n){var h;let e,t,i,s=U.hasImageExtension((h=n[9])==null?void 0:h.name),l,o,r,a,u,f,c,d,m=s&&dg(n);return{c(){e=b("button"),t=b("span"),t.textContent="Cancel",i=C(),m&&m.c(),l=C(),o=b("button"),r=b("span"),a=W(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,_){w(g,e,_),y(e,t),w(g,i,_),m&&m.m(g,_),w(g,l,_),w(g,o,_),y(o,r),y(r,a),f=!0,c||(d=[Y(e,"click",n[2]),Y(o,"click",n[21])],c=!0)},p(g,_){var k;(!f||_[0]&64)&&(e.disabled=g[6]),_[0]&512&&(s=U.hasImageExtension((k=g[9])==null?void 0:k.name)),s?m?(m.p(g,_),_[0]&512&&M(m,1)):(m=dg(g),m.c(),M(m,1),m.m(l.parentNode,l)):m&&(oe(),D(m,1,1,()=>{m=null}),re()),(!f||_[0]&2)&&se(a,g[1]),(!f||_[0]&8192&&u!==(u=!g[13]))&&(o.disabled=u)},i(g){f||(M(m),f=!0)},o(g){D(m),f=!1},d(g){g&&(v(e),v(i),v(l),v(o)),m&&m.d(g),c=!1,Ee(d)}}}function qA(n){let e,t,i,s;const l=[{popup:!0},{class:"file-picker-popup"},n[22]];let o={$$slots:{footer:[FA],header:[NA],default:[PA]},$$scope:{ctx:n}};for(let a=0;a<l.length;a+=1)o=je(o,l[a]);e=new nn({props:o}),n[33](e),e.$on("hide",n[34]),e.$on("show",n[35]);let r={collection:n[8]};return i=new uf({props:r}),n[36](i),i.$on("save",n[37]),i.$on("delete",n[38]),{c(){H(e.$$.fragment),t=C(),H(i.$$.fragment)},m(a,u){q(e,a,u),w(a,t,u),q(i,a,u),s=!0},p(a,u){const f=u[0]&4194304?vt(l,[l[0],l[1],At(a[22])]):{};u[0]&131059|u[1]&8388608&&(f.$$scope={dirty:u,ctx:a}),e.$
2025-04-02 16:38:19 +08:00
form-field form-field-list form-field-file
`+(n[4].required?"required":"")+`
`+(n[9]?"dragover":"")+`
`,name:n[4].name,$$slots:{default:[o7,({uniqueId:o})=>({30:o}),({uniqueId:o})=>[o?1073741824:0]]},$$scope:{ctx:n}}}),{c(){e=b("div"),H(t.$$.fragment),p(e,"class","block")},m(o,r){w(o,e,r),q(t,e,null),i=!0,s||(l=[Y(e,"dragover",it(n[27])),Y(e,"dragleave",n[28]),Y(e,"drop",n[14])],s=!0)},p(o,r){const a={};r[0]&528&&(a.class=`
2025-04-02 16:38:19 +08:00
form-field form-field-list form-field-file
`+(o[4].required?"required":"")+`
`+(o[9]?"dragover":"")+`
2025-04-16 13:14:56 +08:00
`),r[0]&16&&(a.name=o[4].name),r[0]&1073743359|r[1]&256&&(a.$$scope={dirty:r,ctx:o}),t.$set(a)},i(o){i||(M(t.$$.fragment,o),i=!0)},o(o){D(t.$$.fragment,o),i=!1},d(o){o&&v(e),j(t),s=!1,Ee(l)}}}function a7(n,e,t){let i,s,l,{record:o}=e,{field:r}=e,{value:a=""}=e,{uploadedFiles:u=[]}=e,{deletedFileNames:f=[]}=e,c,d,m=!1;function h(V){U.removeByValue(f,V),t(2,f)}function g(V){U.pushUnique(f,V),t(2,f)}function _(V){U.isEmpty(u[V])||u.splice(V,1),t(1,u)}function k(){d==null||d.dispatchEvent(new CustomEvent("change",{detail:{value:a,uploadedFiles:u,deletedFileNames:f},bubbles:!0}))}function S(V){var G;V.preventDefault(),t(9,m=!1);const Z=((G=V.dataTransfer)==null?void 0:G.files)||[];if(!(l||!Z.length)){for(const de of Z){const pe=s.length+u.length-f.length;if(r.maxSelect<=pe)break;u.push(de)}t(1,u)}}async function $(V){try{let Z=await _e.getSuperuserFileToken(o.collectionId),G=_e.files.getURL(o,V,{token:Z});window.open(G,"_blank","noreferrer, noopener")}catch(Z){console.warn("openInNewTab file token failure:",Z)}}const T=V=>$(V),O=V=>$(V),E=V=>h(V),L=V=>g(V);function I(V){a=V,t(0,a),t(6,i),t(4,r)}const A=V=>_(V);function P(V){u=V,t(1,u)}function N(V){ne[V?"unshift":"push"](()=>{c=V,t(7,c)})}const R=()=>{for(let V of c.files)u.push(V);t(1,u),t(7,c.value=null,c)},z=()=>c==null?void 0:c.click();function F(V){ne[V?"unshift":"push"](()=>{d=V,t(8,d)})}const B=()=>{t(9,m=!0)},J=()=>{t(9,m=!1)};return n.$$set=V=>{"record"in V&&t(3,o=V.record),"field"in V&&t(4,r=V.field),"value"in V&&t(0,a=V.value),"uploadedFiles"in V&&t(1,u=V.uploadedFiles),"deletedFileNames"in V&&t(2,f=V.deletedFileNames)},n.$$.update=()=>{n.$$.dirty[0]&2&&(Array.isArray(u)||t(1,u=U.toArray(u))),n.$$.dirty[0]&4&&(Array.isArray(f)||t(2,f=U.toArray(f))),n.$$.dirty[0]&16&&t(6,i=r.maxSelect>1),n.$$.dirty[0]&65&&U.isEmpty(a)&&t(0,a=i?[]:""),n.$$.dirty[0]&1&&t(5,s=U.toArray(a)),n.$$.dirty[0]&54&&t(10,l=(s.length||u.length)&&r.maxSelect<=s.length+u.length-f.length),n.$$.dirty[0]&6&&(u!==-1||f!==-1)&&k()},[a,u,f,o,r,s,i,c,d,m,l,h,g,_,S,$,T,O,E,L,I,A,P,N,R,z,F,B,J]}class u7 extends we{constructor(e){super(),ve(this,e,a7,r7,be,{record:3,field:4,value:0,uploadedFiles:1,deletedFileNames:2},null,[-1,-1])}}function f7(n){let e;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function c7(n){let e;return{c(){e=b("i"),p(e,"class","ri-checkbox-circle-fill txt-success")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function d7(n){let e,t,i,s;function l(a,u){return a[4]?c7:f7}let o=l(n),r=o(n);return{c(){e=b("span"),r.c(),p(e,"class","json-state svelte-p6ecb8")},m(a,u){w(a,e,u),r.m(e,null),i||(s=Oe(t=Re.call(null,e,{position:"left",text:n[4]?"Valid JSON":"Invalid JSON"})),i=!0)},p(a,u){o!==(o=l(a))&&(r.d(1),r=o(a),r&&(r.c(),r.m(e,null))),t&&Lt(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,s()}}}function p7(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){w(t,e,i)},p:te,i:te,o:te,d(t){t&&v(e)}}}function m7(n){let e,t,i;var s=n[3];function l(o,r){return{props:{id:o[6],maxHeight:"500",language:"json",value:o[2]}}}return s&&(e=Ht(s,l(n)),e.$on("change",n[5])),{c(){e&&H(e.$$.fragment),t=ke()},m(o,r){e&&q(e,o,r),w(o,t,r),i=!0},p(o,r){if(r&8&&s!==(s=o[3])){if(e){oe();const a=e;D(a.$$.fragment,1,0,()=>{j(a,1)}),re()}s?(e=Ht(s,l(o)),e.$on("change",o[5]),H(e.$$.fragment),M(e.$$.fragment,1),q(e,t.parentNode,t)):e=null}else if(s){const a={};r&64&&(a.id=o[6]),r&4&&(a.value=o[2]),e.$set(a)}},i(o){i||(e&&M(e.$$.fragment,o),i=!0)},o(o){e&&D(e.$$.fragment,o),i=!1},d(o){o&&v(t),e&&j(e,o)}}}function h7(n){let e,t,i,s,l,o;e=new Jn({props:{uniqueId:n[6],field:n[1],$$slots:{default:[d7]},$$scope:{ctx:n}}});const r=[m7,p7],a=[];function u(f,c){return f[3]?0:1}return i=u(n),s=a[i]=r[i](n),{c(){H(e.$$.fragment),t=C(),s.c(),l=ke()},m(f,c){q(e,f,c),w(f,t,c),a[i].m(f,c),w(f,l,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):(oe(),
`),A&&A.c(),m=C(),g.c(),_=ke(),p(e,"class","flex m-b-base flex-gap-10"),p(l,"class","list picker-list m-b-base svelte-1u8jhky"),p(c,"class","section-title")},m(z,F){w(z,e,F),q(t,e,null),y(e,i),T&&T.m(e,null),w(z,s,F),w(z,l,F);for(let B=0;B<o.length;B+=1)o[B]&&o[B].m(l,null);L&&L.m(l,null),y(l,a),I&&I.m(l,null),w(z,f,F),w(z,c,F),y(c,d),A&&A.m(c,null),w(z,m,F),N[h].m(z,F),w(z,_,F),k=!0,S||($=Oe(u=O7.call(null,l,n[38])),S=!0)},p(z,F){const B={};F[0]&4&&(B.value=z[2]),F[0]&32&&(B.autocompleteCollection=z[5]),t.$set(B),z[12]?T&&(T.d(1),T=null):T?T.p(z,F):(T=wg(z),T.c(),T.m(e,null)),F[0]&548756&&(O=ce(z[8]),oe(),o=kt(o,F,E,1,z,O,r,l,Yt,Og,a,vg),re(),!O.length&&L?L.p(z,F):O.length?L&&(L.d(1),L=null):(L=Sg(z),L.c(),L.m(l,a))),z[14]?I||(I=Mg(),I.c(),I.m(l,null)):I&&(I.d(1),I=null),u&&Lt(u.update)&&F[0]&8200&&u.update.call(null,z[38]),z[4]>1?A?A.p(z,F):(A=Eg(z),A.c(),A.m(c,null)):A&&(A.d(1),A=null);let J=h;h=R(z),h===J?N[h].p(z,F):(oe(),D(N[J],1,1,()=>{N[J]=null}),re(),g=N[h],g?g.p(z,F):(g=N[h]=P[h](z),g.c()),M(g,1),g.m(_.parentNode,_))},i(z){if(!k){M(t.$$.fragment,z);for(let F=0;F<O.length;F+=1)M(o[F]);M(g),k=!0}},o(z){D(t.$$.fragment,z);for(let F=0;F<o.length;F+=1)D(o[F]);D(g),k=!1},d(z){z&&(v(e),v(s),v(l),v(f),v(c),v(m),v(_)),j(t),T&&T.d();for(let F=0;F<o.length;F+=1)o[F].d();L&&L.d(),I&&I.d(),A&&A.d(),N[h].d(z),S=!1,$()}}}function q7(n){var r;let e,t,i,s=(((r=n[5])==null?void 0:r.name)||"")+"",l,o;return{c(){e=b("h4"),t=W("Select "),i=b("strong"),l=W(s),o=W(" records")},m(a,u){w(a,e,u),y(e,t),y(e,i),y(i,l),y(e,o)},p(a,u){var f;u[0]&32&&s!==(s=(((f=a[5])==null?void 0:f.name)||"")+"")&&se(l,s)},d(a){a&&v(e)}}}function j7(n){let e,t,i,s,l;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){w(o,e,r),w(o,t,r),w(o,i,r),s||(l=[Y(e,"click",n[30]),Y(i,"click",n[31])],s=!0)},p:te,d(o){o&&(v(e),v(t),v(i)),s=!1,Ee(l)}}}function H7(n){let e,t,i,s;const l=[{popup:!0},{class:"overlay-panel-xl"},n[21]];let o={$$slots:{footer:[j7],header:[q7],default:[F7]},$$scope:{ctx:n}};for(let a=0;a<l.length;a+=1)o=je(o,l[a]);e=new nn({props:o}),n[41](e),e.$on("hide",n[42]),e.$on("show",n[43]);let r={collection:n[5]};return i=new uf({props:r}),n[44](i),i.$on("save",n[45]),i.$on("delete",n[46]),{c(){H(e.$$.fragment),t=C(),H(i.$$.fragment)},m(a,u){q(e,a,u),w(a,t,u),q(i,a,u),s=!0},p(a,u){const f=u[0]&2097152?vt(l,[l[0],l[1],At(a[21])]):{};u[0]&32764|u[1]&268435456&&(f.$$scope={dirty:u,ctx:a}),e.$set(f);const c={};u[0]&32&&(c.collection=a[5]),i.$set(c)},i(a){s||(M(e.$$.fragment,a),M(i.$$.fragment,a),s=!0)},o(a){D(e.$$.fragment,a),D(i.$$.fragment,a),s=!1},d(a){a&&v(t),n[41](null),j(e,a),n[44](null),j(i,a)}}}const Jo=50;function z7(n,e,t){let i,s,l,o,r,a,u,f;const c=["value","field","show","hide"];let d=lt(e,c),m;Ge(n,In,Ne=>t(28,m=Ne));const h=wt(),g="picker_"+U.randomString(5);let{value:_}=e,{field:k}=e,S,$,T="",O=[],E=[],L=1,I=0,A=!1,P=!1,N={};function R(){return t(2,T=""),t(8,O=[]),t(6,E=[]),B(),J(!0),S==null?void 0:S.show()}function z(){return S==null?void 0:S.hide()}function F(){var bt;let Ne=[];const Me=(bt=l==null?void 0:l.fields)==null?void 0:bt.filter(Ut=>!Ut.hidden&&Ut.presentable&&Ut.type=="relation");for(const Ut of Me)Ne=Ne.concat(U.getExpandPresentableRelFields(Ut,m,2));return Ne.join(",")}async function B(){const Ne=U.toArray(_);if(!s||!Ne.length)return;t(26,P=!0);let Me=[];const bt=Ne.slice(),Ut=[];for(;bt.length>0;){const Pt=[];for(const Pe of bt.splice(0,Jo))Pt.push(`id="${Pe}"`);Ut.push(_e.collection(s).getFullList({batch:Jo,filter:Pt.join("||"),fields:"*:excerpt(200)",expand:F(),requestKey:null}))}try{await Promise.all(Ut).then(Pt=>{Me=Me.concat(...Pt)}),t(6,E=[]);for(const Pt of Ne){const Pe=U.findByKey(Me,"id",Pt);Pe&&E.push(Pe)}T.trim()||t(8,O=U.filterDuplicatesByKey(E.concat(O))),t(26,P=!1)}catch(Pt){Pt.isAbort||(_e.error(Pt),t(26,P=!1))}}async function J(Ne=!1){if(s){t(3,A=!0),Ne&&(T.trim()?t(8,O=[]):t(8,O=U.toArray(E).slice()));try{co
`),l=b("strong"),r=W(o),a=W(":"),u=C(),H(f.$$.fragment),p(t,"class","content"),p(e,"id",n[8])},m(h,g){w(h,e,g),y(e,t),y(t,i),y(i,s),y(i,l),y(l,r),y(l,a),y(e,u),q(f,e,null),c=!0,d||(m=Y(e,"submit",it(n[9])),d=!0)},p(h,g){(!c||g&2)&&o!==(o=U.displayValue(h[1])+"")&&se(r,o);const _={};g&3145761&&(_.$$scope={dirty:g,ctx:h}),f.$set(_)},i(h){c||(M(f.$$.fragment,h),c=!0)},o(h){D(f.$$.fragment,h),c=!1},d(h){h&&v(e),j(f),d=!1,m()}}}function wP(n){let e,t,i,s=n[3].authStore.token+"",l,o,r,a,u,f;return r=new Oi({props:{value:n[3].authStore.token}}),u=new yP({props:{class:"m-b-0",js:`
2025-04-02 16:38:19 +08:00
import PocketBase from 'pocketbase';
const token = "...";
const pb = new PocketBase('${n[7]}');
pb.authStore.save(token, null);
`,dart:`
import 'package:pocketbase/pocketbase.dart';
final token = "...";
final pb = PocketBase('${n[7]}');
pb.authStore.save(token, null);
`}}),{c(){e=b("div"),t=b("div"),i=b("span"),l=W(s),o=C(),H(r.$$.fragment),a=C(),H(u.$$.fragment),p(i,"class","txt token-holder svelte-1i56uix"),p(t,"class","content txt-bold"),p(e,"class","alert alert-success")},m(c,d){w(c,e,d),y(e,t),y(t,i),y(i,l),y(t,o),q(r,t,null),w(c,a,d),q(u,c,d),f=!0},p(c,d){(!f||d&8)&&s!==(s=c[3].authStore.token+"")&&se(l,s);const m={};d&8&&(m.value=c[3].authStore.token),r.$set(m);const h={};d&128&&(h.js=`
import PocketBase from 'pocketbase';
const token = "...";
const pb = new PocketBase('${c[7]}');
pb.authStore.save(token, null);
`),d&128&&(h.dart=`
import 'package:pocketbase/pocketbase.dart';
final token = "...";
final pb = PocketBase('${c[7]}');
pb.authStore.save(token, null);
`),u.$set(h)},i(c){f||(M(r.$$.fragment,c),M(u.$$.fragment,c),f=!0)},o(c){D(r.$$.fragment,c),D(u.$$.fragment,c),f=!1},d(c){c&&(v(e),v(a)),j(r),j(u,c)}}}function SP(n){let e,t,i,s,l,o,r,a,u,f;return{c(){var c,d;e=b("label"),t=W("Token duration (in seconds)"),s=C(),l=b("input"),p(e,"for",i=n[20]),p(l,"type","number"),p(l,"id",o=n[20]),p(l,"placeholder",r="Default to the collection setting ("+(((d=(c=n[0])==null?void 0:c.authToken)==null?void 0:d.duration)||0)+"s)"),p(l,"min","0"),p(l,"step","1"),l.value=a=n[5]||""},m(c,d){w(c,e,d),y(e,t),w(c,s,d),w(c,l,d),u||(f=Y(l,"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(l,"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(l,"placeholder",r),d&32&&a!==(a=c[5]||"")&&l.value!==a&&(l.value=a)},d(c){c&&(v(e),v(s),v(l)),u=!1,f()}}}function TP(n){let e,t,i,s,l,o;const r=[wP,vP],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),s=a[i]=r[i](n),{c(){e=b("div"),t=C(),s.c(),l=ke(),p(e,"class","clearfix")},m(f,c){w(f,e,c),w(f,t,c),a[i].m(f,c),w(f,l,c),o=!0},p(f,c){let d=i;i=u(f),i===d?a[i].p(f,c):(oe(),D(a[d],1,1,()=>{a[d]=null}),re(),s=a[i],s?s.p(f,c):(s=a[i]=r[i](f),s.c()),M(s,1),s.m(l.parentNode,l))},i(f){o||(M(s),o=!0)},o(f){D(s),o=!1},d(f){f&&(v(e),v(t),v(l)),a[i].d(f)}}}function $P(n){let e;return{c(){e=b("h4"),e.textContent="Impersonate auth token"},m(t,i){w(t,e,i)},p:te,d(t){t&&v(e)}}}function CP(n){let e,t,i,s;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(l,o){w(l,e,o),y(e,t),i||(s=Y(e,"click",n[13]),i=!0)},p(l,o){o&64&&(e.disabled=l[6]),o&64&&x(e,"btn-loading",l[6])},d(l){l&&v(e),i=!1,s()}}}function OP(n){let e,t,i,s;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(l,o){w(l,e,o),y(e,t),i||(s=Y(e,"click",n[12]),i=!0)},p(l,o){o&64&&(e.disabled=l[6])},d(l){l&&v(e),i=!1,s()}}}function MP(n){let e,t,i,s,l,o;function r(f,c){var d,m;return(m=(d=f[3])==null?void 0:d.authStore)!=null&&m.token?OP:CP}let a=r(n),u=a(n);return{c(){e=b("button"),t=b("span"),t.textContent="Close",i=C(),u.c(),s=ke(),p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-transparent"),e.disabled=n[6]},m(f,c){w(f,e,c),y(e,t),w(f,i,c),u.m(f,c),w(f,s,c),l||(o=Y(e,"click",n[2]),l=!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(s.parentNode,s)))},d(f){f&&(v(e),v(i),v(s)),u.d(f),l=!1,o()}}}function EP(n){let e,t,i={overlayClose:!1,escClose:!n[6],beforeHide:n[15],popup:!0,$$slots:{footer:[MP],header:[$P],default:[TP]},$$scope:{ctx:n}};return e=new nn({props:i}),n[16](e),e.$on("show",n[17]),e.$on("hide",n[18]),{c(){H(e.$$.fragment)},m(s,l){q(e,s,l),t=!0},p(s,[l]){const o={};l&64&&(o.escClose=!s[6]),l&64&&(o.beforeHide=s[15]),l&2097387&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(M(e.$$.fragment,s),t=!0)},o(s){D(e.$$.fragment,s),t=!1},d(s){n[16](null),j(e,s)}}}function DP(n,e,t){let i;const s=wt(),l="impersonate_"+U.randomString(5);let{collection:o}=e,{record:r}=e,a,u=0,f=!1,c;function d(){r&&(g(),a==null||a.show())}function m(){a==null||a.hide(),g()}async function h(){if(!(f||!o||!r)){t(6,f=!0);try{t(3,c=await _e.collection(o.name).impersonate(r.id,u)),s("submit",c)}catch(L){_e.error(L)}t(6,f=!1)}}function g(){t(5,u=0),t(3,c=void 0)}const _=()=>g(),k=()=>h(),S=L=>t(5,u=L.target.value<<0),$=()=>!f;function T(L){ne[L?"unshift":"push"](()=>{a=L,t(4,a)})}function O(L){Le.call(this,n,L)}function E(L){Le.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=U.getApiExampleUrl(c==null?void 0:c.baseURL))},[o,r,m,c,a,u,f,i,l,h,g,d,_,k,S,$,T,O,E]}class IP extends we{constructor(e){super(),ve(this,e,DP,EP,be,{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(l,"class","flex flex-gap-xs"),p(u,"type","button"),p(u,"class","close"),p(u,"aria-label","Discard draft"),p(t,"class","alert alert-info m-0"),p(c,"class","clearfix p-b-base"),p(e,"class","block")},m(_,k){w(_,e,k),y(e,t),y(t,i),y(t,s),y(t,l),y(l,o),y(l,r),y(t,a),y(t,u),y(e,f),y(e,c),m=!0,h||(g=[Y(r,"click",n[48]),Oe(Re.call(null,u,"Discard draft")),Y(u,"click",it(n[49]))],h=!0)},p:te,i(_){m||(d&&d.end(1),m=!0)},o(_){_&&(d=bu(e,ht,{duration:150})),m=!1},d(_){_&&v(e),_&&d&&d.end(),h=!1,Ee(g)}}}function Jg(n){let e,t,i;return t=new GL({props:{record:n[3]}}),{c(){e=b("div"),H(t.$$.fragment),p(e,"class","form-field-addon")},m(s,l){w(s,e,l),q(t,e,null),i=!0},p(s,l){const o={};l[0]&8&&(o.record=s[3]),t.$set(o)},i(s){i||(M(t.$$.fragment,s),i=!0)},o(s){D(t.$$.fragment,s),i=!1},d(s){s&&v(e),j(t)}}}function LP(n){let e,t,i,s,l,o,r,a,u,f,c,d,m,h,g,_,k,S,$=!n[6]&&Jg(n);return{c(){var T,O,E;e=b("label"),t=b("i"),i=C(),s=b("span"),s.textContent="id",l=C(),o=b("span"),a=C(),$&&$.c(),u=C(),f=b("input"),p(t,"class",zs(U.getFieldTypeIcon("primary"))+" svelte-qc5ngu"),p(s,"class","txt"),p(o,"class","flex-fill"),p(e,"for",r=n[88]),p(f,"type","text"),p(f,"id",c=n[88]),p(f,"placeholder",d=!n[7]&&!U.isEmpty((T=n[19])==null?void 0:T.autogeneratePattern)?"Leave empty to auto generate...":""),p(f,"minlength",m=((O=n[19])==null?void 0:O.min)||null),p(f,"maxlength",h=((E=n[19])==null?void 0:E.max)||null),f.readOnly=g=!n[6]},m(T,O){w(T,e,O),y(e,t),y(e,i),y(e,s),y(e,l),y(e,o),w(T,a,O),$&&$.m(T,O),w(T,u,O),w(T,f,O),me(f,n[3].id),_=!0,k||(S=Y(f,"input",n[50]),k=!0)},p(T,O){var E,L,I;(!_||O[2]&67108864&&r!==(r=T[88]))&&p(e,"for",r),T[6]?$&&(oe(),D($,1,1,()=>{$=null}),re()):$?($.p(T,O),O[0]&64&&M($,1)):($=Jg(T),$.c(),M($,1),$.m(u.parentNode,u)),(!_||O[2]&67108864&&c!==(c=T[88]))&&p(f,"id",c),(!_||O[0]&524416&&d!==(d=!T[7]&&!U.isEmpty((E=T[19])==null?void 0:E.autogeneratePattern)?"Leave empty to auto generate...":""))&&p(f,"placeholder",d),(!_||O[0]&524288&&m!==(m=((L=T[19])==null?void 0:L.min)||null))&&p(f,"minlength",m),(!_||O[0]&524288&&h!==(h=((I=T[19])==null?void 0:I.max)||null))&&p(f,"maxlength",h),(!_||O[0]&64&&g!==(g=!T[6]))&&(f.readOnly=g),O[0]&8&&f.value!==T[3].id&&me(f,T[3].id)},i(T){_||(M($),_=!0)},o(T){D($),_=!1},d(T){T&&(v(e),v(a),v(u),v(f)),$&&$.d(T),k=!1,S()}}}function Zg(n){let e,t,i,s,l;function o(u){n[51](u)}let r={isNew:n[6],collection:n[0]};n[3]!==void 0&&(r.record=n[3]),e=new mA({props:r}),ne.push(()=>ge(e,"record",o));let a=n[16].length&&Gg();return{c(){H(e.$$.fragment),i=C(),a&&a.c(),s=ke()},m(u,f){q(e,u,f),w(u,i,f),a&&a.m(u,f),w(u,s,f),l=!0},p(u,f){const c={};f[0]&64&&(c.isNew=u[6]),f[0]&1&&(c.collection=u[0]),!t&&f[0]&8&&(t=!0,c.record=u[3],$e(()=>t=!1)),e.$set(c),u[16].length?a||(a=Gg(),a.c(),a.m(s.parentNode,s)):a&&(a.d(1),a=null)},i(u){l||(M(e.$$.fragment,u),l=!0)},o(u){D(e.$$.fragment,u),l=!1},d(u){u&&(v(i),v(s)),j(e,u),a&&a.d(u)}}}function Gg(n){let e;return{c(){e=b("hr")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function AP(n){let e,t,i;function s(o){n[66](o,n[85])}let l={field:n[85],original:n[2],record:n[3]};return n[3][n[85].name]!==void 0&&(l.value=n[3][n[85].name]),e=new gP({props:l}),ne.push(()=>ge(e,"value",s)),{c(){H(e.$$.fragment)},m(o,r){q(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&65536&&(a.field=n[85]),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[85].name],$e(()=>t=!1)),e.$set(a)},i(o){i||(M(e.$$.fragment,o),i=!0)},o(o){D(e.$$.fragment,o),i=!1},d(o){j(e,o)}}}function PP(n){let e,t,i;function s(o){n[65](o,n[85])}let l={field:n[85],original:n[2],record:n[3]};return n[3][n[85].name]!==void 0&&(l.value=n[3][n[85].name]),e=new C7({props:l}),ne.push(()=>ge(e,"value",s)),{c(){H(e.$$.fragment)},m(o,r){q(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&65536&&(a.field=n[85]),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[85].na
2025-04-02 16:38:19 +08:00
record-panel
`+(n[20]?"overlay-panel-xl":"overlay-panel-lg")+`
`+(n[9]&&!n[17]&&!n[6]?"colored-header":"")+`
`,btnClose:!n[7],escClose:!n[7],overlayClose:!n[7],beforeHide:n[67],$$slots:{footer:[QP],header:[GP],default:[YP]},$$scope:{ctx:n}};e=new nn({props:l}),n[68](e),e.$on("hide",n[69]),e.$on("show",n[70]);let o=n[9]&&s1(n);return{c(){H(e.$$.fragment),t=C(),o&&o.c(),i=ke()},m(r,a){q(e,r,a),w(r,t,a),o&&o.m(r,a),w(r,i,a),s=!0},p(r,a){const u={};a[0]&1180224&&(u.class=`
2025-04-02 16:38:19 +08:00
record-panel
`+(r[20]?"overlay-panel-xl":"overlay-panel-lg")+`
`+(r[9]&&!r[17]&&!r[6]?"colored-header":"")+`
`),a[0]&128&&(u.btnClose=!r[7]),a[0]&128&&(u.escClose=!r[7]),a[0]&128&&(u.overlayClose=!r[7]),a[0]&16640&&(u.beforeHide=r[67]),a[0]&1031165|a[2]&134217728&&(u.$$scope={dirty:a,ctx:r}),e.$set(u),r[9]?o?(o.p(r,a),a[0]&512&&M(o,1)):(o=s1(r),o.c(),M(o,1),o.m(i.parentNode,i)):o&&(oe(),D(o,1,1,()=>{o=null}),re())},i(r){s||(M(e.$$.fragment,r),M(o),s=!0)},o(r){D(e.$$.fragment,r),D(o),s=!1},d(r){r&&(v(t),v(i)),n[68](null),j(e,r),o&&o.d(r)}}}const El="form",io="providers";function eN(n,e,t){let i,s,l,o,r,a,u,f;const c=wt(),d="record_"+U.randomString(5);let{collection:m}=e,h,g,_={},k={},S=null,$=!1,T=!1,O={},E={},L=JSON.stringify(_),I=L,A=El,P=!0,N=!0,R=m,z=[];const F=["id"],B=F.concat("email","emailVisibility","verified","tokenKey","password");function J(ue){return pe(ue),t(14,T=!0),t(15,A=El),h==null?void 0:h.show()}function V(){return h==null?void 0:h.hide()}function Z(){t(14,T=!1),V()}function G(){t(35,R=m),h!=null&&h.isActive()&&(Ke(JSON.stringify(k)),Z())}async function de(ue){if(!ue)return null;let ye=typeof ue=="string"?ue:ue==null?void 0:ue.id;if(ye)try{return await _e.collection(m.id).getOne(ye)}catch(He){He.isAbort||(Z(),console.warn("resolveModel:",He),Mi(`Unable to load record with id "${ye}"`))}return typeof ue=="object"?ue:null}async function pe(ue){t(7,N=!0),Jt({}),t(4,O={}),t(5,E={}),t(2,_=typeof ue=="string"?{id:ue,collectionId:m==null?void 0:m.id,collectionName:m==null?void 0:m.name}:ue||{}),t(3,k=structuredClone(_)),t(2,_=await de(ue)||{}),t(3,k=structuredClone(_)),await _n(),t(12,S=Ye()),!S||et(k,S)?t(12,S=null):(delete S.password,delete S.passwordConfirm),t(33,L=JSON.stringify(k)),t(7,N=!1)}async function ae(ue){var He,Qe;Jt({}),t(2,_=ue||{}),t(4,O={}),t(5,E={});const ye=((Qe=(He=m==null?void 0:m.fields)==null?void 0:He.filter(at=>at.type!="file"))==null?void 0:Qe.map(at=>at.name))||[];for(let at in ue)ye.includes(at)||t(3,k[at]=ue[at],k);await _n(),t(33,L=JSON.stringify(k)),xe()}function Ce(){return"record_draft_"+((m==null?void 0:m.id)||"")+"_"+((_==null?void 0:_.id)||"")}function Ye(ue){try{const ye=window.localStorage.getItem(Ce());if(ye)return JSON.parse(ye)}catch{}return ue}function Ke(ue){try{window.localStorage.setItem(Ce(),ue)}catch(ye){console.warn("updateDraft failure:",ye),window.localStorage.removeItem(Ce())}}function ct(){S&&(t(3,k=S),t(12,S=null))}function et(ue,ye){var pn;const He=structuredClone(ue||{}),Qe=structuredClone(ye||{}),at=(pn=m==null?void 0:m.fields)==null?void 0:pn.filter(mn=>mn.type==="file");for(let mn of at)delete He[mn.name],delete Qe[mn.name];const Wt=["expand","password","passwordConfirm"];for(let mn of Wt)delete He[mn],delete Qe[mn];return JSON.stringify(He)==JSON.stringify(Qe)}function xe(){t(12,S=null),window.localStorage.removeItem(Ce())}async function Be(ue=!0){var ye;if(!($||!u||!(m!=null&&m.id))){t(13,$=!0);try{const He=Bt();let Qe;if(P?Qe=await _e.collection(m.id).create(He):Qe=await _e.collection(m.id).update(k.id,He),tn(P?"Successfully created record.":"Successfully updated record."),xe(),s&&(k==null?void 0:k.id)==((ye=_e.authStore.record)==null?void 0:ye.id)&&He.get("password"))return _e.logout();ue?Z():ae(Qe),c("save",{isNew:P,record:Qe})}catch(He){_e.error(He)}t(13,$=!1)}}function ut(){_!=null&&_.id&&vn("Do you really want to delete the selected record?",()=>_e.collection(_.collectionId).delete(_.id).then(()=>{Z(),tn("Successfully deleted record."),c("delete",_)}).catch(ue=>{_e.error(ue)}))}function Bt(){const ue=structuredClone(k||{}),ye=new FormData,He={},Qe={};for(const at of(m==null?void 0:m.fields)||[])at.type=="autodate"||i&&at.type=="password"||(He[at.name]=!0,at.type=="json"&&(Qe[at.name]=!0));i&&ue.password&&(He.password=!0),i&&ue.passwordConfirm&&(He.passwordConfirm=!0);for(const at in ue)if(He[at]){if(typeof ue[at]>"u"&&(ue[at]=null),Qe[at]&&ue[at]!=="")try{JSON.parse(ue[at])}catch(Wt){const pn={};throw pn[at]={code:"invalid_json",message:Wt.toString()},new Hn({status:400,response:{data:pn}})}U.addValueToFormData(ye,at,ue[at])}for(const at in O){const Wt=U.toArray(O[at]);for(const pn of Wt)ye.append(at+"+",pn)}for(const at in E){const Wt=U.toArray
`);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",U.isEmpty(n[0].trustedProxy.headers)),p(a,"class","form-field-addon"),p(c,"class","help-block")},m(O,E){w(O,e,E),y(e,t),w(O,s,E),q(l,O,E),w(O,r,E),w(O,a,E),y(a,u),w(O,f,E),w(O,c,E),y(c,d),y(d,m);for(let L=0;L<T.length;L+=1)T[L]&&T[L].m(d,null);h=!0,g||(_=Y(u,"click",n[12]),g=!0)},p(O,E){(!h||E&65536&&i!==(i=O[16]))&&p(e,"for",i);const L={};if(E&65536&&(L.id=O[16]),!o&&E&1&&(o=!0,L.value=O[0].trustedProxy.headers,$e(()=>o=!1)),l.$set(L),(!h||E&1)&&x(u,"hidden",U.isEmpty(O[0].trustedProxy.headers)),E&68){$=ce(O[2]);let I;for(I=0;I<$.length;I+=1){const A=C1(O,$,I);T[I]?T[I].p(A,E):(T[I]=O1(A),T[I].c(),T[I].m(d,null))}for(;I<T.length;I+=1)T[I].d(1);T.length=$.length}},i(O){h||(M(l.$$.fragment,O),h=!0)},o(O){D(l.$$.fragment,O),h=!1},d(O){O&&(v(e),v(s),v(r),v(a),v(f),v(c)),j(l,O),dt(T,O),g=!1,_()}}}function JN(n){let e,t,i,s,l,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 Ln({props:m}),ne.push(()=>ge(r,"keyOfSelected",d)),{c(){e=b("label"),t=b("span"),t.textContent="IP priority selection",i=C(),s=b("i"),o=C(),H(r.$$.fragment),p(t,"class","txt"),p(s,"class","ri-information-line link-hint"),p(e,"for",l=n[16])},m(h,g){w(h,e,g),y(e,t),y(e,i),y(e,s),w(h,o,g),q(r,h,g),u=!0,f||(c=Oe(Re.call(null,s,{text:"This is in case the proxy returns more than 1 IP as header value. The rightmost IP is usually considered to be the more trustworthy but this could vary depending on the proxy.",position:"right"})),f=!0)},p(h,g){(!u||g&65536&&l!==(l=h[16]))&&p(e,"for",l);const _={};!a&&g&1&&(a=!0,_.keyOfSelected=h[0].trustedProxy.useLeftmostIP,$e(()=>a=!1)),r.$set(_)},i(h){u||(M(r.$$.fragment,h),u=!0)},o(h){D(r.$$.fragment,h),u=!1},d(h){h&&(v(e),v(o)),j(r,h),f=!1,c()}}}function ZN(n){let e,t,i,s,l,o,r=(n[1].realIP||"N/A")+"",a,u,f,c,d,m,h,g,_,k,S=(n[1].possibleProxyHeader||"N/A")+"",$,T,O,E,L,I,A,P,N,R,z,F,B;return A=new fe({props:{class:"form-field m-b-0",name:"trustedProxy.headers",$$slots:{default:[KN,({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:[JN,({uniqueId:J})=>({16:J}),({uniqueId:J})=>J?65536:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),i=b("div"),s=b("span"),s.textContent="Resolved user IP:",l=C(),o=b("strong"),a=W(r),u=C(),f=b("i"),c=C(),d=b("br"),m=C(),h=b("div"),g=b("span"),g.textContent="Detected proxy header:",_=C(),k=b("strong"),$=W(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
2025-04-02 16:38:19 +08:00
NGINX, requests from different users will originate from the same IP address (the IP of the proxy
connecting to your PocketBase app).</p> <p>In this case to retrieve the actual user IP (used for rate limiting, logging, etc.) you need to
properly configure your proxy and list below the trusted headers that PocketBase could use to
extract the user IP.</p> <p class="txt-bold">When using such proxy, to avoid spoofing it is recommended to:</p> <ul class="m-t-0 txt-bold"><li>use headers that are controlled only by the proxy and cannot be manually set by the users</li> <li>make sure that the PocketBase server can be accessed only through the proxy</li></ul> <p>You can clear the headers field if PocketBase is not deployed behind a proxy.</p>`,E=C(),L=b("div"),I=b("div"),H(A.$$.fragment),P=C(),N=b("div"),H(R.$$.fragment),p(f,"class","ri-information-line txt-sm link-hint"),p(i,"class","inline-flex flex-gap-5"),p(h,"class","inline-flex flex-gap-5"),p(t,"class","content"),p(e,"class","alert alert-info m-b-sm"),p(O,"class","content m-b-sm"),p(I,"class","col-lg-9"),p(N,"class","col-lg-3"),p(L,"class","grid grid-sm")},m(J,V){w(J,e,V),y(e,t),y(t,i),y(i,s),y(i,l),y(i,o),y(o,a),y(i,u),y(i,f),y(t,c),y(t,d),y(t,m),y(t,h),y(h,g),y(h,_),y(h,k),y(k,$),w(J,T,V),w(J,O,V),w(J,E,V),w(J,L,V),y(L,I),q(A,I,null),y(L,P),y(L,N),q(R,N,null),z=!0,F||(B=Oe(Re.call(null,f,`Must show your actual IP.
If not, set the correct proxy header.`)),F=!0)},p(J,V){(!z||V&2)&&r!==(r=(J[1].realIP||"N/A")+"")&&se(a,r),(!z||V&2)&&S!==(S=(J[1].possibleProxyHeader||"N/A")+"")&&se($,S);const Z={};V&1114117&&(Z.$$scope={dirty:V,ctx:J}),A.$set(Z);const G={};V&1114113&&(G.$$scope={dirty:V,ctx:J}),R.$set(G)},i(J){z||(M(A.$$.fragment,J),M(R.$$.fragment,J),z=!0)},o(J){D(A.$$.fragment,J),D(R.$$.fragment,J),z=!1},d(J){J&&(v(e),v(T),v(O),v(E),v(L)),j(A),j(R),F=!1,B()}}}function GN(n){let e,t,i;return{c(){e=b("i"),p(e,"class","ri-alert-line txt-sm txt-hint")},m(s,l){w(s,e,l),t||(i=Oe(Re.call(null,e,"The configured proxy header doesn't match with the detected one.")),t=!0)},d(s){s&&v(e),t=!1,i()}}}function XN(n){let e,t,i;return{c(){e=b("i"),p(e,"class","ri-alert-line txt-sm txt-warning")},m(s,l){w(s,e,l),t||(i=Oe(Re.call(null,e,`Detected proxy header.
It is recommend to list it as trusted.`)),t=!0)},d(s){s&&v(e),t=!1,i()}}}function QN(n){let e;return{c(){e=b("span"),e.textContent="Disabled",p(e,"class","label")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function xN(n){let e;return{c(){e=b("span"),e.textContent="Enabled",p(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function M1(n){let e,t,i,s,l;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){w(o,e,r),i=!0,s||(l=Oe(Re.call(null,e,{text:"Has errors",position:"left"})),s=!0)},i(o){i||(o&&tt(()=>{i&&(t||(t=qe(e,Ct,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=qe(e,Ct,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&v(e),o&&t&&t.end(),s=!1,l()}}}function eR(n){let e,t,i,s,l,o,r,a,u,f,c;function d($,T){if(T&43&&(o=null),!$[3]&&$[1].possibleProxyHeader)return XN;if(o==null&&(o=!!($[3]&&!$[5]&&!$[0].trustedProxy.headers.includes($[1].possibleProxyHeader))),o)return GN}let m=d(n,-1),h=m&&m(n);function g($,T){return $[3]?xN:QN}let _=g(n),k=_(n),S=n[4]&&M1();return{c(){e=b("div"),t=b("i"),i=C(),s=b("span"),s.textContent="User IP proxy headers",l=C(),h&&h.c(),r=C(),a=b("div"),u=C(),k.c(),f=C(),S&&S.c(),c=ke(),p(t,"class","ri-route-line"),p(s,"class","txt"),p(e,"class","inline-flex"),p(a,"class","flex-fill")},m($,T){w($,e,T),y(e,t),y(e,i),y(e,s),y(e,l),h&&h.m(e,null),w($,r,T),w($,a,T),w($,u,T),k.m($,T),w($,f,T),S&&S.m($,T),w($,c,T)},p($,T){m!==(m=d($,T))&&(h&&h.d(1),h=m&&m($),h&&(h.c(),h.m(e,null))),_!==(_=g($))&&(k.d(1),k=_($),k&&(k.c(),k.m(f.parentNode,f))),$[4]?S?T&16&&M(S,1):(S=M1(),S.c(),M(S,1),S.m(c.parentNode,c)):S&&(oe(),D(S,1,1,()=>{S=null}),re())},d($){$&&(v(e),v(r),v(a),v(u),v(f),v(c)),h&&h.d(),k.d($),S&&S.d($)}}}function tR(n){let e,t;return e=new zi({props:{single:!0,$$slots:{header:[eR],default:[ZN]},$$scope:{ctx:n}}}),{c(){H(e.$$.fragment)},m(i,s){q(e,i,s),t=!0},p(i,[s]){const l={};s&1048639&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(M(e.$$.fragment,i),t=!0)},o(i){D(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function nR(n,e,t){let i,s,l,o,r,a;Ge(n,$n,$=>t(10,a=$));const u=["X-Forwarded-For","Fly-Client-IP","CF-Connecting-IP"];let{formSettings:f}=e,{healthData:c}=e,d="";function m($){t(0,f.trustedProxy.headers=[$],f)}const h=[{label:"Use leftmost IP",value:!0},{label:"Use rightmost IP",value:!1}];function g($){n.$$.not_equal(f.trustedProxy.headers,$)&&(f.trustedProxy.headers=$,t(0,f))}const _=()=>t(0,f.trustedProxy.headers=[],f),k=$=>m($);function S($){n.$$.not_equal(f.trustedProxy.useLeftmostIP,$)&&(f.trustedProxy.useLeftmostIP=$,t(0,f))}return n.$$set=$=>{"formSettings"in $&&t(0,f=$.formSettings),"healthData"in $&&t(1,c=$.healthData)},n.$$.update=()=>{n.$$.dirty&1&&t(9,i=JSON.stringify(f)),n.$$.dirty&768&&d!=i&&t(8,d=i),n.$$.dirty&768&&t(5,s=d!=i),n.$$.dirty&1024&&t(4,l=!U.isEmpty(a==null?void 0:a.trustedProxy)),n.$$.dirty&1&&t(3,o=!U.isEmpty(f.trustedProxy.headers)),n.$$.dirty&2&&t(2,r=c.possibleProxyHeader?[c.possibleProxyHeader].concat(u.filter($=>$!=c.possibleProxyHeader)):u)},[f,c,r,o,l,s,m,h,d,i,a,g,_,k,S]}class iR extends we{constructor(e){super(),ve(this,e,nR,tR,be,{formSettings:0,healthData:1})}}function E1(n,e,t){const i=n.slice();return i[5]=e[t],i}function D1(n){let e,t=(n[5].label||"")+"",i,s;return{c(){e=b("option"),i=W(t),e.__value=s=n[5].value,me(e,e.__value)},m(l,o){w(l,e,o),y(e,i)},p(l,o){o&2&&t!==(t=(l[5].label||"")+"")&&se(i,t),o&2&&s!==(s=l[5].value)&&(e.__value=s,me(e,e.__value))},d(l){l&&v(e)}}}function lR(n){let e,t,i,s,l,o,r=[{type:t=n[3].type||"text"},{list:n[2]},{value:n[0]},n[3]],a={};for(let c=0;c<r.length;c+=1)a=je(a,r[c]);let u=ce(n[1]),f=[];for(let c=0;c<u.length;c+=1)f[c]=D1(E1(n,u,c));return{c(){e=b("input"),i=C(),s=b("datalist");for(let c=0;c<f.length;c+=1)f[c].c();ii(e,a),p(s,"id",n[2])},m(c,d){w(c,e,d),"value"in a&&(e.value=a.value),e.autofocus&&e.focus(),w(c,i,d),w(c,s,d);for(let m=0;m<f.length;m+=1)f[m]&&f[m].m(s,null);l||(o=Y(e,"input",n[4]),l=!0)},p(c,[d]){if(ii(e,a=vt(r,[d&8&&t!==(t=c[3].type||"text")&&{type:t},{list:c[2]},d&1&&e.value!==c[0]&&{value:c[0]},d&8&&c[3]])),"value"in a&&(e.value=a.value),d&2){u=ce(c[1]
2025-04-02 16:38:19 +08:00
"auth"), only the matching audience rule is taken in consideration.`,o=C(),r=b("hr"),a=C(),u=b("p"),u.textContent="The rate limit label could be in one of the following formats:",f=C(),c=b("ul"),d=b("li"),d.innerHTML=`<code>[METHOD ]/my/path</code> - full exact route match (
<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>`,m=C(),h=b("li"),h.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>`,g=C(),_=b("li"),k=b("code"),k.textContent="collectionName:predefinedTag",S=W(` - targets a specific action of a single collection. To
apply the rule for all collections you can use the `),$=b("code"),$.textContent="*",T=W(` wildcard. For example:
`),O=b("code"),O.textContent="posts:create",E=W(", "),L=b("code"),L.textContent="users:listAuthMethods",I=W(", "),A=b("code"),A.textContent="*:auth",P=W(`.
`),N=b("br"),R=W(`
The predifined collection tags are (`),z=b("em"),z.textContent="there should be autocomplete once you start typing",F=W(`):
`),B=b("ul");for(let Z=0;Z<V.length;Z+=1)V[Z].c();p(r,"class","m-t-xs m-b-xs"),p(d,"class","m-b-sm"),p(h,"class","m-b-sm")},m(Z,G){w(Z,e,G),w(Z,t,G),w(Z,i,G),w(Z,s,G),w(Z,l,G),w(Z,o,G),w(Z,r,G),w(Z,a,G),w(Z,u,G),w(Z,f,G),w(Z,c,G),y(c,d),y(c,m),y(c,h),y(c,g),y(c,_),y(_,k),y(_,S),y(_,$),y(_,T),y(_,O),y(_,E),y(_,L),y(_,I),y(_,A),y(_,P),y(_,N),y(_,R),y(_,z),y(_,F),y(_,B);for(let de=0;de<V.length;de+=1)V[de]&&V[de].m(B,null)},p(Z,G){if(G&64){J=ce(Z[6]);let de;for(de=0;de<J.length;de+=1){const pe=I1(Z,J,de);V[de]?V[de].p(pe,G):(V[de]=R1(pe),V[de].c(),V[de].m(B,null))}for(;de<V.length;de+=1)V[de].d(1);V.length=J.length}},d(Z){Z&&(v(e),v(t),v(i),v(s),v(l),v(o),v(r),v(a),v(u),v(f),v(c)),dt(V,Z)}}}function bR(n){let e;return{c(){e=b("h4"),e.textContent="Rate limit label format",p(e,"class","center txt-break")},m(t,i){w(t,e,i)},p:te,d(t){t&&v(e)}}}function kR(n){let e,t,i;return{c(){e=b("button"),e.textContent="Close",p(e,"type","button"),p(e,"class","btn btn-transparent")},m(s,l){w(s,e,l),t||(i=Y(e,"click",n[18]),t=!0)},p:te,d(s){s&&v(e),t=!1,i()}}}function yR(n){let e,t,i,s;e=new zi({props:{single:!0,$$slots:{header:[hR],default:[dR]},$$scope:{ctx:n}}});let l={$$slots:{footer:[kR],header:[bR],default:[gR]},$$scope:{ctx:n}};return i=new nn({props:l}),n[19](i),{c(){H(e.$$.fragment),t=C(),H(i.$$.fragment)},m(o,r){q(e,o,r),w(o,t,r),q(i,o,r),s=!0},p(o,[r]){const a={};r&536870943&&(a.$$scope={dirty:r,ctx:o}),e.$set(a);const u={};r&536870920&&(u.$$scope={dirty:r,ctx:o}),i.$set(u)},i(o){s||(M(e.$$.fragment,o),M(i.$$.fragment,o),s=!0)},o(o){D(e.$$.fragment,o),D(i.$$.fragment,o),s=!1},d(o){o&&v(t),j(e,o),n[19](null),j(i,o)}}}function vR(n,e,t){let i,s,l;Ge(n,In,A=>t(20,s=A)),Ge(n,$n,A=>t(1,l=A));let{formSettings:o}=e;const r=[{value:"",label:"All"},{value:"@guest",label:"Guest only"},{value:"@auth",label:"Auth only"}],a=[{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 u=a,f;c();async function c(){await Pu(),t(2,u=[]);for(let A of s)A.system||(u.push({value:A.name+":list"}),u.push({value:A.name+":view"}),A.type!="view"&&(u.push({value:A.name+":create"}),u.push({value:A.name+":update"}),u.push({value:A.name+":delete"})),A.type=="auth"&&(u.push({value:A.name+":listAuthMethods"}),u.push({value:A.name+":authRefresh"}),u.push({value:A.name+":auth"}),u.push({value:A.name+":authWithPassword"}),u.push({value:A.name+":authWithOAuth2"}),u.push({value:A.name+":authWithOTP"}),u.push({value:A.name+":requestOTP"}),u.push({value:A.name+":requestPasswordReset"}),u.push({value:A.name+":confirmPasswordReset"}),u.push({value:A.name+":requestVerification"}),u.push({value:A.name+":confirmVerification"}),u.push({value:A.name+":requestEmailChange"}),u.push({value:A.name+":confirmEmailChange"})),A.fields.find(P=>P.type=="file")&&u.push({value:A.name+":file"}));t(2,u=u.concat(a))}function d(){Jt({}),Array.isArray(o.rateLimits.rules)||t(0,o.rateLimits.rules=[],o),o.rateLimits.rules.push({label:"",maxRequests:300,duration:10,audience:""}),t(0,o),o.rateLimits.rules.length==1&&t(0,o.rateLimits.enabled=!0,o)}function m(A){Jt({}),o.rateLimits.rules.splice(A,1),t(0,o),o.rateLimits.rules.length||t(0,o.rateLimits.enabled=!1,o)}function h(){o.rateLimits.enabled=this.checked,t(0,o)}function g(A,P){n.$$.not_equal(P.label,A)&&(P.label=A,t(0,o))}function _(A,P){A[P].maxRequests=mt(this.value),t(0,o)}function k(A,P){A[P].duration=mt(this.value),t(0,o)}function S(A,P){n.$$.not_equal(P.audience,A)&&(P.audience=A,t(0,o))}const $=A=>{Yn("rateLimits.rules."+A)},T=A=>m(A),O=()=>d(),E=()=>f==null?void 0:f.show(),L=()=>f==null?void 0:f.hide();function I(A){ne[A?"unsh
2025-04-02 16:38:19 +08:00
database will be temporary &quot;locked&quot; (this usually happens only during the ZIP generation).</p> <p class="txt-bold">If you are using S3 storage for the collections file upload, you&#39;ll have to backup them
separately since they are not locally stored and will not be included in the final backup!</p></div>`,t=C(),i=b("form"),H(s.$$.fragment),p(e,"class","alert alert-info"),p(i,"id",n[4]),p(i,"autocomplete","off")},m(a,u){w(a,e,u),w(a,t,u),w(a,i,u),q(s,i,null),l=!0,o||(r=Y(i,"submit",it(n[5])),o=!0)},p(a,u){const f={};u&98308&&(f.$$scope={dirty:u,ctx:a}),s.$set(f)},i(a){l||(M(s.$$.fragment,a),l=!0)},o(a){D(s.$$.fragment,a),l=!1},d(a){a&&(v(e),v(t),v(i)),j(s),o=!1,r()}}}function PR(n){let e;return{c(){e=b("h4"),e.textContent="Initialize new backup",p(e,"class","center txt-break")},m(t,i){w(t,e,i)},p:te,d(t){t&&v(e)}}}function NR(n){let e,t,i,s,l,o,r;return{c(){e=b("button"),t=b("span"),t.textContent="Cancel",i=C(),s=b("button"),l=b("span"),l.textContent="Start backup",p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-transparent"),e.disabled=n[3],p(l,"class","txt"),p(s,"type","submit"),p(s,"form",n[4]),p(s,"class","btn btn-expanded"),s.disabled=n[3],x(s,"btn-loading",n[3])},m(a,u){w(a,e,u),y(e,t),w(a,i,u),w(a,s,u),y(s,l),o||(r=Y(e,"click",n[0]),o=!0)},p(a,u){u&8&&(e.disabled=a[3]),u&8&&(s.disabled=a[3]),u&8&&x(s,"btn-loading",a[3])},d(a){a&&(v(e),v(i),v(s)),o=!1,r()}}}function RR(n){let e,t,i={class:"backup-create-panel",beforeOpen:n[8],beforeHide:n[9],popup:!0,$$slots:{footer:[NR],header:[PR],default:[AR]},$$scope:{ctx:n}};return e=new nn({props:i}),n[10](e),e.$on("show",n[11]),e.$on("hide",n[12]),{c(){H(e.$$.fragment)},m(s,l){q(e,s,l),t=!0},p(s,[l]){const o={};l&8&&(o.beforeOpen=s[8]),l&8&&(o.beforeHide=s[9]),l&65548&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(M(e.$$.fragment,s),t=!0)},o(s){D(e.$$.fragment,s),t=!1},d(s){n[10](null),j(e,s)}}}function FR(n,e,t){const i=wt(),s="backup_create_"+U.randomString(5);let l,o="",r=!1,a;function u(S){Jt({}),t(3,r=!1),t(2,o=S||""),l==null||l.show()}function f(){return l==null?void 0:l.hide()}async function c(){if(!r){t(3,r=!0),clearTimeout(a),a=setTimeout(()=>{f()},1500);try{await _e.backups.create(o,{$cancelKey:s}),t(3,r=!1),f(),i("submit"),tn("Successfully generated new backup.")}catch(S){S.isAbort||_e.error(S)}clearTimeout(a),t(3,r=!1)}}oo(()=>{clearTimeout(a)});function d(){o=this.value,t(2,o)}const m=()=>r?(Ks("A backup has already been started, please wait."),!1):!0,h=()=>(r&&Ks("The backup was started but may take a while to complete. You can come back later.",4500),!0);function g(S){ne[S?"unshift":"push"](()=>{l=S,t(1,l)})}function _(S){Le.call(this,n,S)}function k(S){Le.call(this,n,S)}return[f,l,o,r,s,c,u,d,m,h,g,_,k]}class qR extends we{constructor(e){super(),ve(this,e,FR,RR,be,{show:6,hide:0})}get show(){return this.$$.ctx[6]}get hide(){return this.$$.ctx[0]}}function jR(n){let e,t,i,s,l,o,r,a;return{c(){e=b("label"),t=W("Backup name"),s=C(),l=b("input"),p(e,"for",i=n[15]),p(l,"type","text"),p(l,"id",o=n[15]),l.required=!0},m(u,f){w(u,e,f),y(e,t),w(u,s,f),w(u,l,f),me(l,n[2]),r||(a=Y(l,"input",n[9]),r=!0)},p(u,f){f&32768&&i!==(i=u[15])&&p(e,"for",i),f&32768&&o!==(o=u[15])&&p(l,"id",o),f&4&&l.value!==u[2]&&me(l,u[2])},d(u){u&&(v(e),v(s),v(l)),r=!1,a()}}}function HR(n){let e,t,i,s,l,o,r,a,u,f,c,d,m,h,g,_;return u=new Oi({props:{value:n[1]}}),m=new fe({props:{class:"form-field required m-0",name:"name",$$slots:{default:[jR,({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
2025-04-02 16:38:19 +08:00
the backup and will restart the application process.</p> <p>This means that on success all of your data (including app settings, users, superusers, etc.) will
be replaced with the ones from the backup.</p> <p>Nothing will happen if the backup is invalid or incompatible (ex. missing
<code>data.db</code> file).</p></div>`,t=C(),i=b("div"),s=W(`Type the backup name
`),l=b("div"),o=b("span"),r=W(n[1]),a=C(),H(u.$$.fragment),f=W(`
to confirm:`),c=C(),d=b("form"),H(m.$$.fragment),p(e,"class","alert alert-danger"),p(o,"class","txt"),p(l,"class","label"),p(i,"class","content m-b-xs"),p(d,"id",n[6]),p(d,"autocomplete","off")},m(k,S){w(k,e,S),w(k,t,S),w(k,i,S),y(i,s),y(i,l),y(l,o),y(o,r),y(l,a),q(u,l,null),y(i,f),w(k,c,S),w(k,d,S),q(m,d,null),h=!0,g||(_=Y(d,"submit",it(n[7])),g=!0)},p(k,S){(!h||S&2)&&se(r,k[1]);const $={};S&2&&($.value=k[1]),u.$set($);const T={};S&98308&&(T.$$scope={dirty:S,ctx:k}),m.$set(T)},i(k){h||(M(u.$$.fragment,k),M(m.$$.fragment,k),h=!0)},o(k){D(u.$$.fragment,k),D(m.$$.fragment,k),h=!1},d(k){k&&(v(e),v(t),v(i),v(c),v(d)),j(u),j(m),g=!1,_()}}}function zR(n){let e,t,i,s;return{c(){e=b("h4"),t=W("Restore "),i=b("strong"),s=W(n[1]),p(e,"class","popup-title txt-ellipsis svelte-1fcgldh")},m(l,o){w(l,e,o),y(e,t),y(e,i),y(i,s)},p(l,o){o&2&&se(s,l[1])},d(l){l&&v(e)}}}function UR(n){let e,t,i,s,l,o,r,a;return{c(){e=b("button"),t=W("Cancel"),i=C(),s=b("button"),l=b("span"),l.textContent="Restore backup",p(e,"type","button"),p(e,"class","btn btn-transparent"),e.disabled=n[4],p(l,"class","txt"),p(s,"type","submit"),p(s,"form",n[6]),p(s,"class","btn btn-expanded"),s.disabled=o=!n[5]||n[4],x(s,"btn-loading",n[4])},m(u,f){w(u,e,f),y(e,t),w(u,i,f),w(u,s,f),y(s,l),r||(a=Y(e,"click",n[0]),r=!0)},p(u,f){f&16&&(e.disabled=u[4]),f&48&&o!==(o=!u[5]||u[4])&&(s.disabled=o),f&16&&x(s,"btn-loading",u[4])},d(u){u&&(v(e),v(i),v(s)),r=!1,a()}}}function VR(n){let e,t,i={class:"backup-restore-panel",overlayClose:!n[4],escClose:!n[4],beforeHide:n[10],popup:!0,$$slots:{footer:[UR],header:[zR],default:[HR]},$$scope:{ctx:n}};return e=new nn({props:i}),n[11](e),e.$on("show",n[12]),e.$on("hide",n[13]),{c(){H(e.$$.fragment)},m(s,l){q(e,s,l),t=!0},p(s,[l]){const o={};l&16&&(o.overlayClose=!s[4]),l&16&&(o.escClose=!s[4]),l&16&&(o.beforeHide=s[10]),l&65590&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(M(e.$$.fragment,s),t=!0)},o(s){D(e.$$.fragment,s),t=!1},d(s){n[11](null),j(e,s)}}}function BR(n,e,t){let i;const s="backup_restore_"+U.randomString(5);let l,o="",r="",a=!1,u=null;function f(S){Jt({}),t(2,r=""),t(1,o=S),t(4,a=!1),l==null||l.show()}function c(){return l==null?void 0:l.hide()}async function d(){var S;if(!(!i||a)){clearTimeout(u),t(4,a=!0);try{await _e.backups.restore(o),u=setTimeout(()=>{window.location.reload()},2e3)}catch($){clearTimeout(u),$!=null&&$.isAbort||(t(4,a=!1),Mi(((S=$.response)==null?void 0:S.message)||$.message))}}}oo(()=>{clearTimeout(u)});function m(){r=this.value,t(2,r)}const h=()=>!a;function g(S){ne[S?"unshift":"push"](()=>{l=S,t(3,l)})}function _(S){Le.call(this,n,S)}function k(S){Le.call(this,n,S)}return n.$$.update=()=>{n.$$.dirty&6&&t(5,i=r!=""&&o==r)},[c,o,r,l,a,i,s,d,f,m,h,g,_,k]}class WR extends we{constructor(e){super(),ve(this,e,BR,VR,be,{show:8,hide:0})}get show(){return this.$$.ctx[8]}get hide(){return this.$$.ctx[0]}}function j1(n,e,t){const i=n.slice();return i[22]=e[t],i}function H1(n,e,t){const i=n.slice();return i[19]=e[t],i}function YR(n){let e=[],t=new Map,i,s,l=ce(n[3]);const o=a=>a[22].key;for(let a=0;a<l.length;a+=1){let u=j1(n,l,a),f=o(u);t.set(f,e[a]=U1(f,u))}let r=null;return l.length||(r=z1()),{c(){for(let a=0;a<e.length;a+=1)e[a].c();i=ke(),r&&r.c()},m(a,u){for(let f=0;f<e.length;f+=1)e[f]&&e[f].m(a,u);w(a,i,u),r&&r.m(a,u),s=!0},p(a,u){u&876&&(l=ce(a[3]),oe(),e=kt(e,u,o,1,a,l,t,i.parentNode,Yt,U1,i,j1),re(),!l.length&&r?r.p(a,u):l.length?r&&(r.d(1),r=null):(r=z1(),r.c(),r.m(i.parentNode,i)))},i(a){if(!s){for(let u=0;u<l.length;u+=1)M(e[u]);s=!0}},o(a){for(let u=0;u<e.length;u+=1)D(e[u]);s=!1},d(a){a&&v(i);for(let u=0;u<e.length;u+=1)e[u].d(a);r&&r.d(a)}}}function KR(n){let e,t=ce(Array(n[3].length||1)),i=[];for(let s=0;s<t.length;s+=1)i[s]=V1(H1(n,t,s));return{c(){for(let s=0;s<i.length;s+=1)i[s].c();e=ke()},m(s,l){for(let o=0;o<i.length;o+=1)i[o]&&i[o].m(s,l);w(s,e,l)},p(s,l){if(l&8){t=ce(Array(s[3].length||1));let o;for(o=0;o<t.length;o+=1){const r=H1(s,t,o);i[o]?i[o].p(r,l):(i[o]=V1(),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(s){s&&v(e),dt(i,s)}}
2025-04-02 16:38:19 +08:00
Do you really want to upload "${m.name}"?`,()=>{u(m)},()=>{r()})}async function u(m){var g,_,k;if(o||!m)return;t(2,o=!0);const h=new FormData;h.set("file",m);try{await _e.backups.upload(h,{requestKey:Y1}),t(2,o=!1),i("success"),tn("Successfully uploaded a new backup.")}catch(S){S.isAbort||(t(2,o=!1),(k=(_=(g=S.response)==null?void 0:g.data)==null?void 0:_.file)!=null&&k.message?Mi(S.response.data.file.message):_e.error(S))}r()}oo(()=>{_e.cancelRequest(Y1)});const f=()=>l==null?void 0:l.click();function c(m){ne[m?"unshift":"push"](()=>{l=m,t(1,l)})}const d=m=>{var h,g;a((g=(h=m==null?void 0:m.target)==null?void 0:h.files)==null?void 0:g[0])};return n.$$set=m=>{"class"in m&&t(0,s=m.class)},[s,l,o,a,f,c,d]}class cF extends we{constructor(e){super(),ve(this,e,fF,uF,be,{class:0})}}function dF(n){let e;return{c(){e=b("i"),p(e,"class","ri-arrow-down-s-line")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function pF(n){let e;return{c(){e=b("i"),p(e,"class","ri-arrow-up-s-line")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function K1(n){var B,J,V;let e,t,i,s,l,o,r,a,u,f,c,d,m,h,g,_,k,S,$,T,O,E,L;t=new fe({props:{class:"form-field form-field-toggle m-t-base m-b-0",$$slots:{default:[mF,({uniqueId:Z})=>({31:Z}),({uniqueId:Z})=>[0,Z?1:0]]},$$scope:{ctx:n}}});let I=n[2]&&J1(n);function A(Z){n[24](Z)}function P(Z){n[25](Z)}function N(Z){n[26](Z)}let R={toggleLabel:"Store backups in S3 storage",testFilesystem:"backups",configKey:"backups.s3",originalConfig:(B=n[0].backups)==null?void 0:B.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 jy({props:R}),ne.push(()=>ge(r,"config",A)),ne.push(()=>ge(r,"isTesting",P)),ne.push(()=>ge(r,"testError",N));let z=((V=(J=n[1].backups)==null?void 0:J.s3)==null?void 0:V.enabled)&&!n[9]&&!n[5]&&Z1(n),F=n[9]&&G1(n);return{c(){e=b("form"),H(t.$$.fragment),i=C(),I&&I.c(),s=C(),l=b("div"),o=C(),H(r.$$.fragment),c=C(),d=b("div"),m=b("div"),h=C(),z&&z.c(),g=C(),F&&F.c(),_=C(),k=b("button"),S=b("span"),S.textContent="Save changes",p(l,"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(Z,G){w(Z,e,G),q(t,e,null),y(e,i),I&&I.m(e,null),y(e,s),y(e,l),y(e,o),q(r,e,null),y(e,c),y(e,d),y(d,m),y(d,h),z&&z.m(d,null),y(d,g),F&&F.m(d,null),y(d,_),y(d,k),y(k,S),O=!0,E||(L=[Y(k,"click",n[28]),Y(e,"submit",it(n[11]))],E=!0)},p(Z,G){var ae,Ce,Ye;const de={};G[0]&4|G[1]&3&&(de.$$scope={dirty:G,ctx:Z}),t.$set(de),Z[2]?I?(I.p(Z,G),G[0]&4&&M(I,1)):(I=J1(Z),I.c(),M(I,1),I.m(e,s)):I&&(oe(),D(I,1,1,()=>{I=null}),re());const pe={};G[0]&1&&(pe.originalConfig=(ae=Z[0].backups)==null?void 0:ae.s3),!a&&G[0]&2&&(a=!0,pe.config=Z[1].backups.s3,$e(()=>a=!1)),!u&&G[0]&128&&(u=!0,pe.isTesting=Z[7],$e(()=>u=!1)),!f&&G[0]&256&&(f=!0,pe.testError=Z[8],$e(()=>f=!1)),r.$set(pe),(Ye=(Ce=Z[1].backups)==null?void 0:Ce.s3)!=null&&Ye.enabled&&!Z[9]&&!Z[5]?z?z.p(Z,G):(z=Z1(Z),z.c(),z.m(d,g)):z&&(z.d(1),z=null),Z[9]?F?F.p(Z,G):(F=G1(Z),F.c(),F.m(d,_)):F&&(F.d(1),F=null),(!O||G[0]&544&&$!==($=!Z[9]||Z[5]))&&(k.disabled=$),(!O||G[0]&32)&&x(k,"btn-loading",Z[5])},i(Z){O||(M(t.$$.fragment,Z),M(I),M(r.$$.fragment,Z),Z&&tt(()=>{O&&(T||(T=qe(e,ht,{duration:150},!0)),T.run(1))}),O=!0)},o(Z){D(t.$$.fragment,Z),D(I),D(r.$$.fragment,Z),Z&&(T||(T=qe(e,ht,{duration:150},!1)),T.run(0)),O=!1},d(Z){Z&&v(e),j(t),I&&I.d(),j(r),z&&z.d(),F&&F.d(),Z&&T&&T.end(),E=!1,Ee(L)}}}function mF(n){let e,t,i,s,l,o,r,a;return{c(){e=b("input"),i=C(),s=b("label"),l=W("Enable auto backups"),p(e,"type","checkbox"),p(e,"id",t=n[31]),p(s,"for",o=n[31])},m(u,f){w(u,e,f),e.checked=n[2],w(u,i,f),w(u,s,f),y(s,l),r||(a=Y(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(s,"for",o)},d(u){u&&(v(e),v(i),v(s)),r=!1,a()}}}function J1(n){let e,t,i,s,l,o,r,a,u;return s=new fe({props:{class:"form-field required",name:"backups.cron",$$slots:{default:[_F,({uniqueId:f})=>({31:f}),({uniqueId:f})
2025-04-02 16:38:19 +08:00
`),T=b("span"),T.textContent="macros",O=W(`.
`),E=b("br"),L=W(`
The timezone is in UTC.`),p(e,"for",i=n[31]),l.required=!0,p(l,"type","text"),p(l,"id",o=n[31]),p(l,"class","txt-lg txt-mono"),p(l,"placeholder","* * * * *"),l.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;w(N,e,R),y(e,t),w(N,s,R),w(N,l,R),me(l,n[1].backups.cron),w(N,a,R),w(N,u,R),y(u,f),y(f,c),y(f,d),y(f,m),y(f,h),q(g,f,null),w(N,_,R),w(N,k,R),y(k,S),y(S,$),y(S,T),y(S,O),y(S,E),y(S,L),I=!0,(F=(z=n[0])==null?void 0:z.backups)!=null&&F.cron||l.focus(),A||(P=[Y(l,"input",n[18]),Oe(Re.call(null,T,`@yearly
@annually
@monthly
@weekly
@daily
@midnight
@hourly`))],A=!0)},p(N,R){var F,B;(!I||R[1]&1&&i!==(i=N[31]))&&p(e,"for",i),(!I||R[1]&1&&o!==(o=N[31]))&&p(l,"id",o),(!I||R[0]&1&&r!==(r=!((B=(F=N[0])==null?void 0:F.backups)!=null&&B.cron)))&&(l.autofocus=r),R[0]&2&&l.value!==N[1].backups.cron&&me(l,N[1].backups.cron);const z={};R[0]&2|R[1]&2&&(z.$$scope={dirty:R,ctx:N}),g.$set(z)},i(N){I||(M(g.$$.fragment,N),I=!0)},o(N){D(g.$$.fragment,N),I=!1},d(N){N&&(v(e),v(s),v(l),v(a),v(u),v(_),v(k)),j(g),A=!1,Ee(P)}}}function gF(n){let e,t,i,s,l,o,r,a;return{c(){e=b("label"),t=W("Max @auto backups to keep"),s=C(),l=b("input"),p(e,"for",i=n[31]),p(l,"type","number"),p(l,"id",o=n[31]),p(l,"min","1")},m(u,f){w(u,e,f),y(e,t),w(u,s,f),w(u,l,f),me(l,n[1].backups.cronMaxKeep),r||(a=Y(l,"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(l,"id",o),f[0]&2&&mt(l.value)!==u[1].backups.cronMaxKeep&&me(l,u[1].backups.cronMaxKeep)},d(u){u&&(v(e),v(s),v(l)),r=!1,a()}}}function Z1(n){let e;function t(l,o){return l[7]?yF:l[8]?kF:bF}let i=t(n),s=i(n);return{c(){s.c(),e=ke()},m(l,o){s.m(l,o),w(l,e,o)},p(l,o){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){l&&v(e),s.d(l)}}}function bF(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){w(t,e,i)},p:te,d(t){t&&v(e)}}}function kF(n){let e,t,i,s;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(l,o){var r;w(l,e,o),i||(s=Oe(t=Re.call(null,e,(r=n[8].data)==null?void 0:r.message)),i=!0)},p(l,o){var r;t&&Lt(t.update)&&o[0]&256&&t.update.call(null,(r=l[8].data)==null?void 0:r.message)},d(l){l&&v(e),i=!1,s()}}}function yF(n){let e;return{c(){e=b("span"),p(e,"class","loader loader-sm")},m(t,i){w(t,e,i)},p:te,d(t){t&&v(e)}}}function G1(n){let e,t,i,s,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-hint btn-transparent"),e.disabled=i=!n[9]||n[5]},m(o,r){w(o,e,r),y(e,t),s||(l=Y(e,"click",n[27]),s=!0)},p(o,r){r[0]&544&&i!==(i=!o[9]||o[5])&&(e.disabled=i)},d(o){o&&v(e),s=!1,l()}}}function vF(n){let e,t,i,s,l,o,r,a,u,f,c,d,m,h,g,_,k,S,$,T,O,E,L,I,A,P,N;m=new Pr({props:{class:"btn-sm",tooltip:"Refresh"}}),m.$on("refresh",n[13]),g=new cF({props:{class:"btn-sm"}}),g.$on("success",n[13]);let R={};k=new QR({props:R}),n[15](k);function z(V,Z){return V[6]?pF:dF}let F=z(n),B=F(n),J=n[6]&&!n[4]&&K1(n);return{c(){e=b("header"),t=b("nav"),i=b("div"),i.textContent="Settings",s=C(),l=b("div"),o=W(n[10]),r=C(),a=b("div"),u=b("div"),f=b("div"),c=b("span"),c.textContent="Backup and restore your PocketBase data",d=C(),H(m.$$.fragment),h=C(),H(g.$$.fragment),_=C(),H(k.$$.fragment),S=C(),$=b("hr"),T=C(),O=b("button"),E=b("span"),E.textContent="Backups options",L=C(),B.c(),I=C(),J&&J.c(),p(i,"class","breadcrumb-item"),p(l,"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(E,"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(V,Z){w(V,e,Z),y(e,t),y(t,i),y(t,s),y(t,l),y(l,o),w(V,r,Z),w(V,a,Z),y(a,u),y(u,f),y(f,c),y(f,d),q(m,f,null),y(f,h),q(g,f,null),y(u,_),q(k,u,null),y(u,S),y(u,$),y(u,T),y(u,O),y(O,E),y(O,L),B.m(O,null),y(u,I),J&&J.m(u,null),A=!0,P||(N=[Y(O,"click",n[16]),Y(u,"submit",it(n[11]))],P=!0)},p(V,Z){(!A||Z[0]&1024)&&se(o,V[10]);const G={};k.$set(G),F!==(F=z(V))&&(B.d(1),B=F(V),B&&(B.c(),B.m(O,null))),(!A||Z[0]&16)&&(O.disabled=V[4]),(!A||Z[0]&16)&&x(O,"btn-loading",V[4]),V[6]&&!V[4]?J?(J.p(V,Z),Z[0]&80&&M(J,1)):(J=K1(V),J.c(),M(J,1),J.m(u,null)):J&&(oe(),D(J,1,1,()=>{J=null}),re())},i(V){A||(M(m.$$.fragment,V),M(g.$$.fragment,V),M(k.$$.fragment,V),M(J),A=!0)},o(V){D(m.$$.fragment,V),D(g.$$.fragment,V),
2025-04-02 16:38:19 +08:00
<a href="https://pocketbase.io/docs/go-jobs-scheduling/" target="_blank" rel="noopener noreferrer">Go</a>
or
<a href="https://pocketbase.io/docs/js-jobs-scheduling/" target="_blank" rel="noopener noreferrer">JavaScript
</a>.`,p(i,"class","breadcrumb-item"),p(l,"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(_,"class","list-content"),p(g,"class","list list-compact"),p(S,"class","txt-hint m-t-xs"),p(u,"class","panel"),p(u,"autocomplete","off"),p(a,"class","wrapper")},m(L,I){w(L,e,I),y(e,t),y(t,i),y(t,s),y(t,l),y(l,o),w(L,r,I),w(L,a,I),y(a,u),y(u,f),y(f,c),y(f,d),q(m,f,null),y(u,h),y(u,g),y(g,_),E.m(_,null),y(u,k),y(u,S),$=!0},p(L,I){(!$||I&8)&&se(o,L[3]),O===(O=T(L))&&E?E.p(L,I):(E.d(1),E=O(L),E&&(E.c(),E.m(_,null)))},i(L){$||(M(m.$$.fragment,L),$=!0)},o(L){D(m.$$.fragment,L),$=!1},d(L){L&&(v(e),v(r),v(a)),j(m),E.d()}}}function MF(n){let e,t,i,s;return e=new Rl({}),i=new oi({props:{$$slots:{default:[OF]},$$scope:{ctx:n}}}),{c(){H(e.$$.fragment),t=C(),H(i.$$.fragment)},m(l,o){q(e,l,o),w(l,t,o),q(i,l,o),s=!0},p(l,[o]){const r={};o&1039&&(r.$$scope={dirty:o,ctx:l}),i.$set(r)},i(l){s||(M(e.$$.fragment,l),M(i.$$.fragment,l),s=!0)},o(l){D(e.$$.fragment,l),D(i.$$.fragment,l),s=!1},d(l){l&&v(t),j(e,l),j(i,l)}}}function EF(n,e,t){let i;Ge(n,rn,f=>t(3,i=f)),En(rn,i="Crons",i);let s=[],l=!1,o={};r();async function r(){t(1,l=!0);try{t(0,s=await _e.crons.getFullList()),t(1,l=!1)}catch(f){f.isAbort||(_e.error(f),t(1,l=!1))}}async function a(f){t(2,o[f]=!0,o);try{await _e.crons.run(f),tn(`Successfully triggered ${f}.`),t(2,o[f]=!1,o)}catch(c){c.isAbort||(_e.error(c),t(2,o[f]=!1,o))}}return[s,l,o,i,r,a,f=>a(f.id)]}class DF extends we{constructor(e){super(),ve(this,e,EF,MF,be,{})}}function eb(n,e,t){const i=n.slice();return i[22]=e[t],i}function IF(n){let e,t,i,s,l,o,r,a=[],u=new Map,f,c,d,m,h,g,_,k,S,$,T,O,E,L,I,A,P,N,R,z;o=new fe({props:{class:"form-field",$$slots:{default:[AF,({uniqueId:J})=>({12:J}),({uniqueId:J})=>J?4096:0]},$$scope:{ctx:n}}});let F=ce(n[0]);const B=J=>J[22].id;for(let J=0;J<F.length;J+=1){let V=eb(n,F,J),Z=B(V);u.set(Z,a[J]=tb(Z,V))}return{c(){e=b("div"),e.innerHTML=`<p>Below you&#39;ll find your current collections configuration that you could import in
another PocketBase environment.</p>`,t=C(),i=b("div"),s=b("div"),l=b("div"),H(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",g=C(),_=b("pre"),k=W(n[6]),S=C(),$=b("div"),T=b("div"),O=C(),E=b("button"),L=b("i"),I=C(),A=b("span"),A.textContent="Download as JSON",p(e,"class","content txt-xl m-b-base"),p(l,"class","list-item list-item-section"),p(s,"class","export-list"),p(m,"class","txt"),p(d,"type","button"),p(d,"class","btn btn-sm btn-transparent fade copy-schema"),d.disabled=h=!n[2],p(_,"class","code-wrapper"),p(c,"tabindex","0"),p(c,"class","export-preview"),p(i,"class","export-panel"),p(T,"class","flex-fill"),p(L,"class","ri-download-line"),p(A,"class","txt"),p(E,"type","button"),p(E,"class","btn btn-expanded"),E.disabled=P=!n[2],p($,"class","flex m-t-base")},m(J,V){w(J,e,V),w(J,t,V),w(J,i,V),y(i,s),y(s,l),q(o,l,null),y(s,r);for(let Z=0;Z<a.length;Z+=1)a[Z]&&a[Z].m(s,null);y(i,f),y(i,c),y(c,d),y(d,m),y(c,g),y(c,_),y(_,k),n[16](c),w(J,S,V),w(J,$,V),y($,T),y($,O),y($,E),y(E,L),y(E,I),y(E,A),N=!0,R||(z=[Y(d,"click",n[15]),Y(c,"keydown",n[17]),Y(E,"click",n[18])],R=!0)},p(J,V){const Z={};V&33558561&&(Z.$$scope={dirty:V,ctx:J}),o.$set(Z),V&6147&&(F=ce(J[0]),oe(),a=kt(a,V,B,1,J,F,u,s,Yt,tb,null,eb),re()),(!N||V&4&&h!==(h=!J[2]))&&(d.disabled=h),(!N||V&64)&&se(k,J[6]),(!N||V&4&&P!==(P=!J[2]))&&(E.disabled=P)},i(J){if(!N){M(o.$$.fragment,J);for(let V=0;V<F.length;V+=1)M(a[V]);N=!0}},o(J){D(o.$$.fragment,J);for(let V=0;V<a.length;V+=1)D(a[V]);N=!1},d(J){J&&(v(e),v(t),v(i),v(S),v($)),j(o);for(let V=0;V<a.length;V+=1)a[V].d();n[16](null),R=!1,Ee(z)}}}function LF(n){let e;return{c(){e=b("div"),p(e,"class","loader")},m(t,i){w(t,e,i)},p:te,i:te,o:te,d(t){t&&v(e)}}}function AF(n){let e,t,i,s,l,o,r,a,u;return{c(){e=b("input"),s=C(),l=b("label"),o=W("Select all"),p(e,"type","checkbox"),p(e,"id",t=n[12]),e.disabled=i=!n[0].length,e.checked=n[5],p(l,"for",r=n[12])},m(f,c){w(f,e,c),w(f,s,c),w(f,l,c),y(l,o),a||(u=Y(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(l,"for",r)},d(f){f&&(v(e),v(s),v(l)),a=!1,u()}}}function PF(n){let e,t,i,s,l,o=n[22].name+"",r,a,u,f,c;function d(){return n[14](n[22])}return{c(){e=b("input"),s=C(),l=b("label"),r=W(o),p(e,"type","checkbox"),p(e,"id",t=n[12]),e.checked=i=n[1][n[22].id],p(l,"for",a=n[12]),p(l,"title",u=n[22].name)},m(m,h){w(m,e,h),w(m,s,h),w(m,l,h),y(l,r),f||(c=Y(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+"")&&se(r,o),h&4096&&a!==(a=n[12])&&p(l,"for",a),h&1&&u!==(u=n[22].name)&&p(l,"title",u)},d(m){m&&(v(e),v(s),v(l)),f=!1,c()}}}function tb(n,e){let t,i,s,l;return i=new fe({props:{class:"form-field",$$slots:{default:[PF,({uniqueId:o})=>({12:o}),({uniqueId:o})=>o?4096:0]},$$scope:{ctx:e}}}),{key:n,first:null,c(){t=b("div"),H(i.$$.fragment),s=C(),p(t,"class","list-item list-item-collection"),this.first=t},m(o,r){w(o,t,r),q(i,t,null),y(t,s),l=!0},p(o,r){e=o;const a={};r&33558531&&(a.$$scope={dirty:r,ctx:e}),i.$set(a)},i(o){l||(M(i.$$.fragment,o),l=!0)},o(o){D(i.$$.fragment,o),l=!1},d(o){o&&v(t),j(i)}}}function NF(n){let e,t,i,s,l,o,r,a,u,f,c,d;const m=[LF,IF],h=[];function g(_,k){return _[4]?0:1}return f=g(n),c=h[f]=m[f](n),{c(){e=b("header"),t=b("nav"),i=b("div"),i.textContent="Settings",s=C(),l=b("div"),o=W(n[7]),r=C(),a=b("div"),u=b("div"),c.c(),p(i,"class","breadcrumb-item"),p(l,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(e,"class","page-header"),p(u,"class","panel"),p(a,"class","wrapper")},m(_,k){w(_,e,k),y(e,t),y(t,i),y(t,s),y(t,l),y(l,o),w(_,r,k),w(_,a,k),y(a,u),h[f].m(u,null),d=!0},p(_,k){(!d||k&128)&&se(o,_[7]);let S=f;f=g(_),f===S?h[f].p(_,k):(oe(),D(h[S],1,1,()=>{h[S]=null}),re(),c=h[f],c?c.p(_,k):(c=h[f]=m[f](_),c.c()),M(c,1),c.m(u,null))},i(_){d||(M(c),d=!0)},o(_){D(c),d=!1},d(_){_&&(v(e),v(r),v(a)),h[f].d()}}}function RF(n){let e,t,i,s;return e=new Rl({}),i=new oi({props:{$$slots:{de
2025-04-02 16:38:19 +08:00
- ${T.join(`
- `)}`,()=>{h()}):h()}async function h(){if(!u){t(4,u=!0);try{await _e.collections.import(o,a),tn("Successfully imported collections configuration."),i("submit")}catch(T){_e.error(T)}t(4,u=!1),c()}}const g=()=>m(),_=()=>!u;function k(T){ne[T?"unshift":"push"](()=>{s=T,t(1,s)})}function S(T){Le.call(this,n,T)}function $(T){Le.call(this,n,T)}return n.$$.update=()=>{n.$$.dirty&384&&Array.isArray(l)&&Array.isArray(o)&&d()},[c,s,r,a,u,m,f,l,o,g,_,k,S,$]}class GF extends we{constructor(e){super(),ve(this,e,ZF,JF,be,{show:6,hide:0})}get show(){return this.$$.ctx[6]}get hide(){return this.$$.ctx[0]}}function wb(n,e,t){const i=n.slice();return i[34]=e[t],i}function Sb(n,e,t){const i=n.slice();return i[37]=e[t],i}function Tb(n,e,t){const i=n.slice();return i[34]=e[t],i}function XF(n){let e,t,i,s,l,o,r,a,u,f,c,d,m,h,g,_,k,S,$,T,O,E,L,I;a=new fe({props:{class:"form-field "+(n[6]?"":"field-error"),name:"collections",$$slots:{default:[xF,({uniqueId:B})=>({42:B}),({uniqueId:B})=>[0,B?2048:0]]},$$scope:{ctx:n}}});let A=n[1].length&&Cb(n),P=!1,N=n[6]&&n[1].length&&!n[7]&&Ob(),R=n[6]&&n[1].length&&n[7]&&Mb(n),z=n[13].length&&jb(n),F=!!n[0]&&Hb(n);return{c(){e=b("input"),t=C(),i=b("div"),s=b("p"),l=W(`Paste below the collections configuration you want to import or
`),o=b("button"),o.innerHTML='<span class="txt">Load from JSON file</span>',r=C(),H(a.$$.fragment),u=C(),A&&A.c(),f=C(),c=C(),N&&N.c(),d=C(),R&&R.c(),m=C(),z&&z.c(),h=C(),g=b("div"),F&&F.c(),_=C(),k=b("div"),S=C(),$=b("button"),T=b("span"),T.textContent="Review",p(e,"type","file"),p(e,"class","hidden"),p(e,"accept",".json"),p(o,"class","btn btn-outline btn-sm m-l-5"),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(g,"class","flex m-t-base")},m(B,J){w(B,e,J),n[22](e),w(B,t,J),w(B,i,J),y(i,s),y(s,l),y(s,o),w(B,r,J),q(a,B,J),w(B,u,J),A&&A.m(B,J),w(B,f,J),w(B,c,J),N&&N.m(B,J),w(B,d,J),R&&R.m(B,J),w(B,m,J),z&&z.m(B,J),w(B,h,J),w(B,g,J),F&&F.m(g,null),y(g,_),y(g,k),y(g,S),y(g,$),y($,T),E=!0,L||(I=[Y(e,"change",n[23]),Y(o,"click",n[24]),Y($,"click",n[20])],L=!0)},p(B,J){(!E||J[0]&4096)&&x(o,"btn-loading",B[12]);const V={};J[0]&64&&(V.class="form-field "+(B[6]?"":"field-error")),J[0]&65|J[1]&6144&&(V.$$scope={dirty:J,ctx:B}),a.$set(V),B[1].length?A?(A.p(B,J),J[0]&2&&M(A,1)):(A=Cb(B),A.c(),M(A,1),A.m(f.parentNode,f)):A&&(oe(),D(A,1,1,()=>{A=null}),re()),B[6]&&B[1].length&&!B[7]?N||(N=Ob(),N.c(),N.m(d.parentNode,d)):N&&(N.d(1),N=null),B[6]&&B[1].length&&B[7]?R?R.p(B,J):(R=Mb(B),R.c(),R.m(m.parentNode,m)):R&&(R.d(1),R=null),B[13].length?z?z.p(B,J):(z=jb(B),z.c(),z.m(h.parentNode,h)):z&&(z.d(1),z=null),B[0]?F?F.p(B,J):(F=Hb(B),F.c(),F.m(g,_)):F&&(F.d(1),F=null),(!E||J[0]&16384&&O!==(O=!B[14]))&&($.disabled=O)},i(B){E||(M(a.$$.fragment,B),M(A),M(P),E=!0)},o(B){D(a.$$.fragment,B),D(A),D(P),E=!1},d(B){B&&(v(e),v(t),v(i),v(r),v(u),v(f),v(c),v(d),v(m),v(h),v(g)),n[22](null),j(a,B),A&&A.d(B),N&&N.d(B),R&&R.d(B),z&&z.d(B),F&&F.d(),L=!1,Ee(I)}}}function QF(n){let e;return{c(){e=b("div"),p(e,"class","loader")},m(t,i){w(t,e,i)},p:te,i:te,o:te,d(t){t&&v(e)}}}function $b(n){let e;return{c(){e=b("div"),e.textContent="Invalid collections configuration.",p(e,"class","help-block help-block-error")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function xF(n){let e,t,i,s,l,o,r,a,u,f,c=!!n[0]&&!n[6]&&$b();return{c(){e=b("label"),t=W("Collections"),s=C(),l=b("textarea"),r=C(),c&&c.c(),a=ke(),p(e,"for",i=n[42]),p(e,"class","p-b-10"),p(l,"id",o=n[42]),p(l,"class","code"),p(l,"spellcheck","false"),p(l,"rows","15"),l.required=!0},m(d,m){w(d,e,m),y(e,t),w(d,s,m),w(d,l,m),me(l,n[0]),w(d,r,m),c&&c.m(d,m),w(d,a,m),u||(f=Y(l,"input",n[25]),u=!0)},p(d,m){m[1]&2048&&i!==(i=d[42])&&p(e,"for",i),m[1]&2048&&o!==(o=d[42])&&p(l,"id",o),m[0]&1&&me(l,d[0]),d[0]&&!d[6]?c||(c=$b(),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(d){d&&(v(e),v(s),v(l),v(r),v(a)),c&&c.d(d),u=!1,f()}}}function Cb(n){let e,t;return e=new fe({props:{class:"form-field form-field-toggle",$$slots:{default:[eq,({uniqueId:i})=>({42:i}),({uniqueId:i})=>[0,i?2048:0]]},$$scope:{ctx:n}}}),{c(){H(e.$$.fragment)},m(i,s){q(e,i,s),t=!0},p(i,s){const l={};s[0]&96|s[1]&6144&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(M(e.$$.fragment,i),t=!0)},o(i){D(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function eq(n){let e,t,i,s,l,o,r,a,u;return{c(){e=b("input"),s=C(),l=b("label"),o=W("Merge with the existing collections"),p(e,"type","checkbox"),p(e,"id",t=n[42]),e.disabled=i=!n[6],p(l,"for",r=n[42])},m(f,c){w(f,e,c),e.checked=n[5],w(f,s,c),w(f,l,c),y(l,o),a||(u=Y(e,"change",n[26]),a=!0)},p(f,c){c[1]&2048&&t!==(t=f[42])&&p(e,"id",t),c[0]&64&&i!==(i=!f[6])&&(e.disabled=i),c[0]&32&&(e.checked=f[5]),c[1]&2048&&r!==(r=f[42])&&p(l,"for",r)},d(f){f&&(v(e),v(s),v(l)),a=!1,u()}}}function Ob(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){w(t,e,i)},d(t){t&&v(e)}}}function Mb(n){let e,t,i,s,l,o=n[9].length&&Eb(n),r=n[3].length&&Lb(n),a=n[8].length&&Rb(n);return{c(){e=b("h5"),e.textContent="Detected changes",t=C(),i=b("div"),o&&o.c(),s=C(),r&&r.c(),l=C(),a&&a.c(),p(e,"class"
2025-04-02 16:38:19 +08:00
imported with different IDs. You can replace them in the import if you want
to.</string>`,l=C(),o=b("button"),o.innerHTML='<span class="txt">Replace with original ids</span>',p(t,"class","icon"),p(s,"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){w(u,e,f),y(e,t),y(e,i),y(e,s),y(e,l),y(e,o),r||(a=Y(o,"click",n[28]),r=!0)},p:te,d(u){u&&v(e),r=!1,a()}}}function Hb(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(s,l){w(s,e,l),t||(i=Y(e,"click",n[29]),t=!0)},p:te,d(s){s&&v(e),t=!1,i()}}}function tq(n){let e,t,i,s,l,o,r,a,u,f,c,d;const m=[QF,XF],h=[];function g(_,k){return _[4]?0:1}return f=g(n),c=h[f]=m[f](n),{c(){e=b("header"),t=b("nav"),i=b("div"),i.textContent="Settings",s=C(),l=b("div"),o=W(n[15]),r=C(),a=b("div"),u=b("div"),c.c(),p(i,"class","breadcrumb-item"),p(l,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(e,"class","page-header"),p(u,"class","panel"),p(a,"class","wrapper")},m(_,k){w(_,e,k),y(e,t),y(t,i),y(t,s),y(t,l),y(l,o),w(_,r,k),w(_,a,k),y(a,u),h[f].m(u,null),d=!0},p(_,k){(!d||k[0]&32768)&&se(o,_[15]);let S=f;f=g(_),f===S?h[f].p(_,k):(oe(),D(h[S],1,1,()=>{h[S]=null}),re(),c=h[f],c?c.p(_,k):(c=h[f]=m[f](_),c.c()),M(c,1),c.m(u,null))},i(_){d||(M(c),d=!0)},o(_){D(c),d=!1},d(_){_&&(v(e),v(r),v(a)),h[f].d()}}}function nq(n){let e,t,i,s,l,o;e=new Rl({}),i=new oi({props:{$$slots:{default:[tq]},$$scope:{ctx:n}}});let r={};return l=new GF({props:r}),n[30](l),l.$on("submit",n[31]),{c(){H(e.$$.fragment),t=C(),H(i.$$.fragment),s=C(),H(l.$$.fragment)},m(a,u){q(e,a,u),w(a,t,u),q(i,a,u),w(a,s,u),q(l,a,u),o=!0},p(a,u){const f={};u[0]&63487|u[1]&4096&&(f.$$scope={dirty:u,ctx:a}),i.$set(f);const c={};l.$set(c)},i(a){o||(M(e.$$.fragment,a),M(i.$$.fragment,a),M(l.$$.fragment,a),o=!0)},o(a){D(e.$$.fragment,a),D(i.$$.fragment,a),D(l.$$.fragment,a),o=!1},d(a){a&&(v(t),v(s)),j(e,a),j(i,a),n[30](null),j(l,a)}}}function iq(n,e,t){let i,s,l,o,r,a,u;Ge(n,rn,pe=>t(15,u=pe)),En(rn,u="Import collections",u);let f,c,d="",m=!1,h=[],g=[],_=!0,k=[],S=!1,$=!1;T();async function T(){var pe;t(4,S=!0);try{t(21,g=await _e.collections.getFullList(200));for(let ae of g)delete ae.created,delete ae.updated,(pe=ae.oauth2)==null||delete pe.providers}catch(ae){_e.error(ae)}t(4,S=!1)}function O(){if(t(3,k=[]),!!i)for(let pe of h){const ae=U.findByKey(g,"id",pe.id);!(ae!=null&&ae.id)||!U.hasCollectionChanges(ae,pe,_)||k.push({new:pe,old:ae})}}function E(){t(1,h=[]);try{t(1,h=JSON.parse(d))}catch{}Array.isArray(h)?t(1,h=U.filterDuplicatesByKey(h)):t(1,h=[]);for(let pe of h)delete pe.created,delete pe.updated,pe.fields=U.filterDuplicatesByKey(pe.fields)}function L(){var pe;for(let ae of h){const Ce=U.findByKey(g,"name",ae.name)||U.findByKey(g,"id",ae.id);if(!Ce)continue;const Ye=ae.id,Ke=Ce.id;ae.id=Ke;const ct=Array.isArray(Ce.fields)?Ce.fields:[],et=Array.isArray(ae.fields)?ae.fields:[];for(const xe of et){const Be=U.findByKey(ct,"name",xe.name);Be&&Be.id&&(xe.id=Be.id)}for(let xe of h)if(Array.isArray(xe.fields))for(let Be of xe.fields)Be.collectionId&&Be.collectionId===Ye&&(Be.collectionId=Ke);for(let xe=0;xe<((pe=ae.indexes)==null?void 0:pe.length);xe++)ae.indexes[xe]=ae.indexes[xe].replace(/create\s+(?:unique\s+)?\s*index\s*(?:if\s+not\s+exists\s+)?(\S*)\s+on/gim,Be=>Be.replace(Ye,Ke))}t(0,d=JSON.stringify(h,null,4))}function I(pe){t(12,m=!0);const ae=new FileReader;ae.onload=async Ce=>{t(12,m=!1),t(10,f.value="",f),t(0,d=Ce.target.result),await _n(),h.length||(Mi("Invalid collections configuration."),A())},ae.onerror=Ce=>{console.warn(Ce),Mi("Failed to load the imported JSON."),t(12,m=!1),t(10,f.value="",f)},ae.readAsText(pe)}function A(){t(0,d=""),t(10,f.value="",f),Jt({})}function P(){const pe=$?U.filterDuplicatesByKey(g.concat(h)):h;c==null||c.show(g,pe,_)}function N(pe){ne[pe?"unshift":"push"](()=>{f=pe,t(10,f)})}const R=()=>{f.files.length&&I(f.files[0])},z=()=>{f.click()};function F(){d=this.value,t(0,d)}function B(){$=this.checked,t(5,$)}function J(){_=this.checked,t(2,_)}const V=()=>L()
2025-04-02 16:38:19 +08:00
from the
`),r=b("strong"),u=W(a),f=W(`
to the
`),c=b("strong"),m=W(d),h=W(`.
`),g=b("br"),_=W(`
There are numerous command line tools that can help you, such as:
`),k=b("a"),k.textContent=`rclone
`,S=W(`,
`),$=b("a"),$.textContent=`s5cmd
`,T=W(", etc."),O=C(),E=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(l,"class","content"),p(t,"class","alert alert-warning m-0"),p(E,"class","clearfix m-t-base")},m(P,N){w(P,e,N),y(e,t),y(t,i),y(t,s),y(t,l),y(l,o),y(l,r),y(r,u),y(l,f),y(l,c),y(c,m),y(l,h),y(l,g),y(l,_),y(l,k),y(l,S),y(l,$),y(l,T),y(e,O),y(e,E),I=!0},p(P,N){var R;(!I||N&1)&&a!==(a=(R=P[0].s3)!=null&&R.enabled?"S3 storage":"local file system")&&se(u,a),(!I||N&2)&&d!==(d=P[1].s3.enabled?"S3 storage":"local file system")&&se(m,d)},i(P){I||(P&&tt(()=>{I&&(L||(L=qe(e,ht,{duration:150},!0)),L.run(1))}),I=!0)},o(P){P&&(L||(L=qe(e,ht,{duration:150},!1)),L.run(0)),I=!1},d(P){P&&v(e),P&&L&&L.end()}}}function Oq(n){var i;let e,t=((i=n[0].s3)==null?void 0:i.enabled)!=n[1].s3.enabled&&Vb(n);return{c(){t&&t.c(),e=ke()},m(s,l){t&&t.m(s,l),w(s,e,l)},p(s,l){var o;((o=s[0].s3)==null?void 0:o.enabled)!=s[1].s3.enabled?t?(t.p(s,l),l&3&&M(t,1)):(t=Vb(s),t.c(),M(t,1),t.m(e.parentNode,e)):t&&(oe(),D(t,1,1,()=>{t=null}),re())},d(s){s&&v(e),t&&t.d(s)}}}function Bb(n){let e;function t(l,o){return l[4]?Dq:l[5]?Eq:Mq}let i=t(n),s=i(n);return{c(){s.c(),e=ke()},m(l,o){s.m(l,o),w(l,e,o)},p(l,o){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){l&&v(e),s.d(l)}}}function Mq(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){w(t,e,i)},p:te,d(t){t&&v(e)}}}function Eq(n){let e,t,i,s;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(l,o){var r;w(l,e,o),i||(s=Oe(t=Re.call(null,e,(r=n[5].data)==null?void 0:r.message)),i=!0)},p(l,o){var r;t&&Lt(t.update)&&o&32&&t.update.call(null,(r=l[5].data)==null?void 0:r.message)},d(l){l&&v(e),i=!1,s()}}}function Dq(n){let e;return{c(){e=b("span"),p(e,"class","loader loader-sm")},m(t,i){w(t,e,i)},p:te,d(t){t&&v(e)}}}function Wb(n){let e,t,i,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-transparent btn-hint"),e.disabled=n[3]},m(l,o){w(l,e,o),y(e,t),i||(s=Y(e,"click",n[14]),i=!0)},p(l,o){o&8&&(e.disabled=l[3])},d(l){l&&v(e),i=!1,s()}}}function Iq(n){let e,t,i,s,l,o,r,a,u,f,c,d,m,h,g,_;const k=[Cq,$q],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",s=C(),l=b("div"),o=W(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(l,"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){w(T,e,O),y(e,t),y(t,i),y(t,s),y(t,l),y(l,o),w(T,r,O),w(T,a,O),y(a,u),y(u,f),y(u,c),S[d].m(u,null),h=!0,g||(_=Y(u,"submit",it(n[16])),g=!0)},p(T,O){(!h||O&128)&&se(o,T[7]);let E=d;d=$(T),d===E?S[d].p(T,O):(oe(),D(S[E],1,1,()=>{S[E]=null}),re(),m=S[d],m?m.p(T,O):(m=S[d]=k[d](T),m.c()),M(m,1),m.m(u,null))},i(T){h||(M(m),h=!0)},o(T){D(m),h=!1},d(T){T&&(v(e),v(r),v(a)),S[d].d(),g=!1,_()}}}function Lq(n){let e,t,i,s;return e=new Rl({}),i=new oi({props:{$$slots:{default:[Iq]},$$scope:{ctx:n}}}),{c(){H(e.$$.fragment),t=C(),H(i.$$.fragment)},m(l,o){q(e,l,o),w(l,t,o),q(i,l,o),s=!0},p(l,[o]){const r={};o&524543&&(r.$$scope={dirty:o,ctx:l}),i.$set(r)},i(l){s||(M(e.$$.fragment,l),M(i.$$.fragment,l),s=!0)},o(l){D(e.$$.fragment,l),D(i.$$.fragment,l),s=!1},d(l){l&&v(t),
One-time password (OTP).`),p(e,"class","content txt-center m-b-sm")},m(r,a){w(r,e,a),y(e,t),y(t,i),y(t,s),y(s,l),y(t,o)},p(r,a){a&4096&&se(l,r[12])},d(r){r&&v(e)}}}function Wq(n){let e,t,i,s,l,o,r,a;return{c(){e=b("label"),t=W("Id"),s=C(),l=b("input"),p(e,"for",i=n[26]),p(l,"type","text"),p(l,"id",o=n[26]),l.value=n[4],p(l,"placeholder",n[11]),l.required=!0},m(u,f){w(u,e,f),y(e,t),w(u,s,f),w(u,l,f),r||(a=Y(l,"change",n[20]),r=!0)},p(u,f){f&67108864&&i!==(i=u[26])&&p(e,"for",i),f&67108864&&o!==(o=u[26])&&p(l,"id",o),f&16&&l.value!==u[4]&&(l.value=u[4]),f&2048&&p(l,"placeholder",u[11])},d(u){u&&(v(e),v(s),v(l)),r=!1,a()}}}function Yq(n){let e,t,i,s,l,o,r,a;return{c(){e=b("label"),t=W("One-time password"),s=C(),l=b("input"),p(e,"for",i=n[26]),p(l,"type","password"),p(l,"id",o=n[26]),l.required=!0,l.autofocus=!0},m(u,f){w(u,e,f),y(e,t),w(u,s,f),w(u,l,f),me(l,n[13]),l.focus(),r||(a=Y(l,"input",n[21]),r=!0)},p(u,f){f&67108864&&i!==(i=u[26])&&p(e,"for",i),f&67108864&&o!==(o=u[26])&&p(l,"id",o),f&8192&&l.value!==u[13]&&me(l,u[13])},d(u){u&&(v(e),v(s),v(l)),r=!1,a()}}}function Kq(n){let e,t,i,s,l,o,r,a;return{c(){e=b("label"),t=W("Email"),s=C(),l=b("input"),p(e,"for",i=n[26]),p(l,"type","email"),p(l,"id",o=n[26]),l.required=!0},m(u,f){w(u,e,f),y(e,t),w(u,s,f),w(u,l,f),me(l,n[12]),r||(a=Y(l,"input",n[19]),r=!0)},p(u,f){f&67108864&&i!==(i=u[26])&&p(e,"for",i),f&67108864&&o!==(o=u[26])&&p(l,"id",o),f&4096&&l.value!==u[12]&&me(l,u[12])},d(u){u&&(v(e),v(s),v(l)),r=!1,a()}}}function Jq(n){let e,t=U.sentenize(n[0].password.identityFields.join(" or "),!1)+"",i,s,l,o,r,a,u,f;return{c(){e=b("label"),i=W(t),l=C(),o=b("input"),p(e,"for",s=n[26]),p(o,"id",r=n[26]),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){w(c,e,d),y(e,i),w(c,l,d),w(c,o,d),o.focus(),u||(f=Y(o,"input",n[17]),u=!0)},p(c,d){d&1&&t!==(t=U.sentenize(c[0].password.identityFields.join(" or "),!1)+"")&&se(i,t),d&67108864&&s!==(s=c[26])&&p(e,"for",s),d&67108864&&r!==(r=c[26])&&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(l),v(o)),u=!1,f()}}}function Zq(n){let e,t,i,s,l,o,r,a,u,f,c;return{c(){e=b("label"),t=W("Password"),s=C(),l=b("input"),r=C(),a=b("div"),u=b("a"),u.textContent="Forgotten password?",p(e,"for",i=n[26]),p(l,"type","password"),p(l,"id",o=n[26]),l.required=!0,p(u,"href","/request-password-reset"),p(u,"class","link-hint"),p(a,"class","help-block")},m(d,m){w(d,e,m),y(e,t),w(d,s,m),w(d,l,m),me(l,n[6]),w(d,r,m),w(d,a,m),y(a,u),f||(c=[Y(l,"input",n[18]),Oe(qn.call(null,u))],f=!0)},p(d,m){m&67108864&&i!==(i=d[26])&&p(e,"for",i),m&67108864&&o!==(o=d[26])&&p(l,"id",o),m&64&&l.value!==d[6]&&me(l,d[6])},d(d){d&&(v(e),v(s),v(l),v(r),v(a)),f=!1,Ee(c)}}}function Gq(n){let e,t,i,s,l,o,r,a,u=n[2]>1&&Kb(n);const f=[Uq,zq,Hq],c=[];function d(m,h){return m[10]?0:m[0].password.enabled&&!m[3]?1:m[0].otp.enabled?2:-1}return~(l=d(n))&&(o=c[l]=f[l](n)),{c(){e=b("div"),t=b("h4"),i=W(`Superuser login
2025-04-16 13:14:56 +08:00
`),u&&u.c(),s=C(),o&&o.c(),r=ke(),p(e,"class","content txt-center m-b-base")},m(m,h){w(m,e,h),y(e,t),y(t,i),u&&u.m(t,null),w(m,s,h),~l&&c[l].m(m,h),w(m,r,h),a=!0},p(m,h){m[2]>1?u?u.p(m,h):(u=Kb(m),u.c(),u.m(t,null)):u&&(u.d(1),u=null);let g=l;l=d(m),l===g?~l&&c[l].p(m,h):(o&&(oe(),D(c[g],1,1,()=>{c[g]=null}),re()),~l?(o=c[l],o?o.p(m,h):(o=c[l]=f[l](m),o.c()),M(o,1),o.m(r.parentNode,r)):o=null)},i(m){a||(M(o),a=!0)},o(m){D(o),a=!1},d(m){m&&(v(e),v(s),v(r)),u&&u.d(),~l&&c[l].d(m)}}}function Xq(n){let e,t;return e=new jq({props:{$$slots:{default:[Gq]},$$scope:{ctx:n}}}),{c(){H(e.$$.fragment)},m(i,s){q(e,i,s),t=!0},p(i,[s]){const l={};s&134234111&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(M(e.$$.fragment,i),t=!0)},o(i){D(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function Qq(n,e,t){let i;Ge(n,Ru,z=>t(23,i=z));const s=new URLSearchParams(i);let l=s.get("demoEmail")||"",o=s.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 _e.collection("_superusers").listAuthMethods())}catch(z){_e.error(z)}t(10,m=!1)}}async function T(){var z,F;if(!f){t(7,f=!0);try{await _e.collection("_superusers").authWithPassword(l,o),Ls(),Jt({}),is("/")}catch(B){B.status==401?(t(3,h=B.response.mfaId),((F=(z=r==null?void 0:r.password)==null?void 0:z.identityFields)==null?void 0:F.length)==1&&r.password.identityFields[0]=="email"?(t(12,k=l),await O()):/^[^@\s]+@[^@\s]+$/.test(l)&&t(12,k=l)):B.status!=400?_e.error(B):Mi("Invalid login credentials.")}t(7,f=!1)}}async function O(){if(!c){t(8,c=!0);try{const z=await _e.collection("_superusers").requestOTP(k);t(4,g=z.otpId),t(11,_=g),Ls(),Jt({})}catch(z){z.status==429&&t(4,g=_),_e.error(z)}t(8,c=!1)}}async function E(){if(!d){t(9,d=!0);try{await _e.collection("_superusers").authWithOTP(g||_,S,{mfaId:h}),Ls(),Jt({}),is("/")}catch(z){_e.error(z)}t(9,d=!1)}}const L=z=>{t(5,l=z.target.value)};function I(){o=this.value,t(6,o)}function A(){k=this.value,t(12,k)}const P=z=>{t(4,g=z.target.value||_),z.target.value=g};function N(){S=this.value,t(13,S)}const R=()=>{t(4,g="")};return n.$$.update=()=>{var z,F;n.$$.dirty&31&&(t(2,u=1),t(1,a=1),(z=r==null?void 0:r.mfa)!=null&&z.enabled&&t(2,u++,u),(F=r==null?void 0:r.otp)!=null&&F.enabled&&t(2,u++,u),h!=""&&t(1,a++,a),g!=""&&t(1,a++,a))},[r,a,u,h,g,l,o,f,c,d,m,_,k,S,T,O,E,L,I,A,P,N,R]}class xq extends we{constructor(e){super(),ve(this,e,Qq,Xq,be,{})}}function Xt(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 e9={"/pbinstal/:token":Xt({asyncComponent:()=>$t(()=>import("./PageInstaller-ch6lGOpk.js"),[],import.meta.url),conditions:[n=>n.params.token&&!Ir(n.params.token)],userData:{showAppSidebar:!1}}),"/login":Xt({component:xq,conditions:[n=>!_e.authStore.isValid],userData:{showAppSidebar:!1}}),"/request-password-reset":Xt({asyncComponent:()=>$t(()=>import("./PageSuperuserRequestPasswordReset-BbDEO4Gx.js"),[],import.meta.url),conditions:[n=>!_e.authStore.isValid],userData:{showAppSidebar:!1}}),"/confirm-password-reset/:token":Xt({asyncComponent:()=>$t(()=>import("./PageSuperuserConfirmPasswordReset-BUe8kFnI.js"),[],import.meta.url),conditions:[n=>!_e.authStore.isValid],userData:{showAppSidebar:!1}}),"/collections":Xt({component:LN,conditions:[n=>_e.authStore.isValid],userDat