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

227 lines
966 KiB
JavaScript
Raw Normal View History

2023-05-14 03:23:19 +08:00
(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 $l=n=>n;function je(n,e){for(const t in e)n[t]=e[t];return n}function q1(n){return!!n&&(typeof n=="object"||typeof n=="function")&&typeof n.then=="function"}function Q_(n){return n()}function hu(){return Object.create(null)}function De(n){n.forEach(Q_)}function jt(n){return typeof n=="function"}function _e(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}let ql;function _n(n,e){return ql||(ql=document.createElement("a")),ql.href=e,n===ql.href}function j1(n){return Object.keys(n).length===0}function va(n,...e){if(n==null)return te;const t=n.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}function V1(n){let e;return va(n,t=>e=t)(),e}function Ze(n,e,t){n.$$.on_destroy.push(va(e,t))}function kt(n,e,t,i){if(n){const s=x_(n,e,t,i);return n[0](s)}}function x_(n,e,t,i){return n[1]&&i?je(t.ctx.slice(),n[1](i(e))):t.ctx}function wt(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 St(n,e,t,i,s,l){if(s){const o=x_(e,t,i,l);n.p(o,s)}}function $t(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 Gt(n){const e={};for(const t in n)t[0]!=="$"&&(e[t]=n[t]);return e}function tt(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 os(n){return n??""}function ln(n,e,t){return n.set(t),e}function Oe(n){return n&&jt(n.destroy)?n.destroy:te}function _u(n){const e=typeof n=="string"&&n.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);return e?[parseFloat(e[1]),e[2]||"px"]:[n,"px"]}const eg=typeof window<"u";let Ro=eg?()=>window.performance.now():()=>Date.now(),ya=eg?n=>requestAnimationFrame(n):te;const Ss=new Set;function tg(n){Ss.forEach(e=>{e.c(n)||(Ss.delete(e),e.f())}),Ss.size!==0&&ya(tg)}function qo(n){let e;return Ss.size===0&&ya(tg),{promise:new Promise(t=>{Ss.add(e={c:n,f:t})}),abort(){Ss.delete(e)}}}const z1=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;"WeakMap"in z1;function v(n,e){n.appendChild(e)}function ng(n){if(!n)return document;const e=n.getRootNode?n.getRootNode():n.ownerDocument;return e&&e.host?e:n.ownerDocument}function H1(n){const e=y("style");return B1(ng(n),e),e.sheet}function B1(n,e){return v(n.head||n,e),e.sheet}function S(n,e,t){n.insertBefore(e,t||null)}function w(n){n.parentNode&&n.parentNode.removeChild(n)}function pt(n,e){for(let t=0;t<n.length;t+=1)n[t]&&n[t].d(e)}function y(n){return document.createElement(n)}function Y(n){return document.createTextNode(n)}function D(){return Y(" ")}function Se(){return Y("")}function J(n,e,t,i){return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t,i)}function xe(n){return function(e){return e.preventDefault(),n.call(this,e)}}function In(n){return function(e){return e.stopPropagation(),n.call(this,e)}}function m(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}const U1=["width","height"];function ai(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=n[i]=e[i]:t[i]&&t[i].set&&U1.indexOf(i)===-1?n[i]=e[i]:m(n,i,e[i])}function W1(n){let e;return{p(...t){e=t,e.forEach(i=>n.push(i))},r(){e.forEach(
2023-05-14 03:10:14 +08:00
`;for(let b=0;b<=1;b+=a){const k=e+(t-e)*l(b);u+=b*100+`%{${o(k,1-k)}}
`}const f=u+`100% {${o(t,1-t)}}
2023-05-14 03:23:19 +08:00
}`,d=`__svelte_${K1(f)}_${r}`,p=ng(n),{stylesheet:h,rules:g}=ho.get(p)||J1(p,n);g[d]||(g[d]=!0,h.insertRule(`@keyframes ${d} ${f}`,h.cssRules.length));const _=n.style.animation||"";return n.style.animation=`${_?`${_}, `:""}${d} ${i}ms linear ${s}ms 1 both`,_o+=1,d}function ml(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(", "),_o-=s,_o||Z1())}function Z1(){ya(()=>{_o||(ho.forEach(n=>{const{ownerNode:e}=n.stylesheet;e&&w(e)}),ho.clear())})}function G1(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=$l,start:a=Ro()+l,end:u=a+o,tick:f=te,css:d}=t(n,{from:e,to:s},i);let p=!0,h=!1,g;function _(){d&&(g=pl(n,0,1,o,l,r,d)),l||(h=!0)}function b(){d&&ml(n,g),p=!1}return qo(k=>{if(!h&&k>=a&&(h=!0),h&&k>=u&&(f(1,0),b()),!p)return!1;if(h){const $=k-a,C=0+1*r($/o);f(C,1-C)}return!0}),_(),f(0,1),b}function X1(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,sg(n,s)}}function sg(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 hl;function vi(n){hl=n}function Tl(){if(!hl)throw new Error("Function called outside component initialization");return hl}function Xt(n){Tl().$$.on_mount.push(n)}function Q1(n){Tl().$$.after_update.push(n)}function jo(n){Tl().$$.on_destroy.push(n)}function Tt(){const n=Tl();return(e,t,{cancelable:i=!1}={})=>{const s=n.$$.callbacks[e];if(s){const l=ig(e,t,{cancelable:i});return s.slice().forEach(o=>{o.call(n,l)}),!l.defaultPrevented}return!0}}function me(n,e){const t=n.$$.callbacks[e.type];t&&t.slice().forEach(i=>i.call(this,e))}const ws=[],ne=[];let $s=[];const Hr=[],lg=Promise.resolve();let Br=!1;function og(){Br||(Br=!0,lg.then(ka))}function cn(){return og(),lg}function et(n){$s.push(n)}function ye(n){Hr.push(n)}const sr=new Set;let _s=0;function ka(){if(_s!==0)return;const n=hl;do{try{for(;_s<ws.length;){const e=ws[_s];_s++,vi(e),x1(e.$$)}}catch(e){throw ws.length=0,_s=0,e}for(vi(null),ws.length=0,_s=0;ne.length;)ne.pop()();for(let e=0;e<$s.length;e+=1){const t=$s[e];sr.has(t)||(sr.add(t),t())}$s.length=0}while(ws.length);for(;Hr.length;)Hr.pop()();Br=!1,sr.clear(),vi(n)}function x1(n){if(n.fragment!==null){n.update(),De(n.before_update);const e=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,e),n.after_update.forEach(et)}}function e0(n){const e=[],t=[];$s.forEach(i=>n.indexOf(i)===-1?e.push(i):t.push(i)),t.forEach(i=>i()),$s=e}let Bs;function wa(){return Bs||(Bs=Promise.resolve(),Bs.then(()=>{Bs=null})),Bs}function ns(n,e,t){n.dispatchEvent(ig(`${e?"intro":"outro"}${t}`))}const oo=new Set;let li;function ue(){li={r:0,c:[],p:li}}function fe(){li.r||De(li.c),li=li.p}function I(n,e){n&&n.i&&(oo.delete(n),n.i(e))}function P(n,e,t,i){if(n&&n.o){if(oo.has(n))return;oo.add(n),li.c.push(()=>{oo.delete(n),i&&(t&&n.d(1),i())}),n.o(e)}else i&&i()}const Sa={duration:0};function rg(n,e,t){const i={direction:"in"};let s=e(n,t,i),l=!1,o,r,a=0;function u(){o&&ml(n,o)}function f(){const{delay:p=0,duration:h=300,easing:g=$l,tick:_=te,css:b}=s||Sa;b&&(o=pl(n,0,1,h,p,g,b,a++)),_(0,1);const k=Ro()+p,$=k+h;r&&r.abort(),l=!0,et(()=>ns(n,!0,"start")),r=qo(C=>{if(l){if(C>=$)return _(1,0),ns(n,!0,"end"),u(),l=!1;if(C>=k){const T=g((C-k)/h);_(T,1-T)}}return l})}let d=!1;return{start(){d||(d=!0,ml(n),jt(s)?(s=s(i),wa().then(f)):f())},invalidate(){d=!1},end(){l&&(u(),l=!1)}}}function $a(n,e,t){const i={direction:"out"};let s=e(n,t,i),l=!0,o;const r=li;r.r+=1;function a(){const{delay:u=0,duration:f=300,easing:d=$l,tick:p=te,css:h}=s||Sa;h&&(o=pl(n,1,0,f,u,d,h));const g=Ro()+u,_=g+f;et(()=>ns(n,!1,"start")),qo(b=>{if(l){if(b>=_)return p(0,1),ns(n,!1,"end"),--r.r||De(r.c),!1;if(b>=g
2023-05-14 03:10:14 +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+=" "+c.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("||")}}const Wo=Ln([]);function yo(n,e=4e3){return Yo(n,"info",e)}function Ht(n,e=3e3){return Yo(n,"success",e)}function As(n,e=4500){return Yo(n,"error",e)}function Dy(n,e=4500){return Yo(n,"warning",e)}function Yo(n,e,t){t=t||4e3;const i={message:n,type:e,duration:t,timeout:setTimeout(()=>{hb(i)},t)};Wo.update(s=>(Na(s,i.message),U.pushOrReplaceByKey(s,i,"message"),s))}function hb(n){Wo.update(e=>(Na(e,n),e))}function Fa(){Wo.update(n=>{for(let e of n)Na(n,e);return[]})}function Na(n,e){let t;typeof e=="string"?t=U.findByKey(n,"message",e):t=e,t&&(clearTimeout(t.timeout),U.removeByKey(n,"message",t.message))}const Ti=Ln({});function tn(n){Ti.set(n||{})}function ui(n){Ti.update(e=>(U.deleteByPath(e,n),e))}const Ra=Ln({});function ea(n){Ra.set(n||{})}const di=Ln([]),fi=Ln({}),ko=Ln(!1),_b=Ln({});function Ay(n){di.update(e=>{const t=U.findByKey(e,"id",n);return t?fi.set(t):e.length&&fi.set(e[0]),e})}function Iy(n){fi.update(e=>U.isEmpty(e==null?void 0:e.id)||e.id===n.id?n:e),di.update(e=>(U.pushOrReplaceByKey(e,n,"id"),qa(),U.sortCollections(e)))}function Ly(n){di.update(e=>(U.removeByKey(e,"id",n.id),fi.update(t=>t.id===n.id?e[0]:t),qa(),e))}async function Py(n=null){ko.set(!0);try{let e=await de.collections.getFullList(200,{sort:"+name"});e=U.sortCollections(e),di.set(e);const t=n&&U.findByKey(e,"id",n);t?fi.set(t):e.length&&fi.set(e[0]),qa()}catch(e){de.error(e)}ko.set(!1)}function qa(){_b.update(n=>(di.update(e=>{var t;for(let i of e)n[i.id]=!!((t=i.schema)!=null&&t.find(s=>{var l;return s.type=="file"&&((l=s.options)==null?void 0:l.protected)}));return e}),n))}const pr="pb_admin_file_token";zo.prototype.logout=function(n=!0){this.authStore.clear(),n&&Vi("/login")};zo.prototype.error=function(n,e=!0,t=""){if(!n||!(n instanceof Error)||n.isAbort)return;const i=(n==null?void 0:n.status)<<0||400,s=(n==null?void 0:n.data)||{};if(e&&i!==404){let l=s.message||n.message||t;l&&As(l)}if(U.isEmpty(s.data)||tn(s.data),i===401)return this.cancelAllRequests(),this.logout();if(i===403)return this.cancelAllRequests(),Vi("/")};zo.prototype.getAdminFileToken=async function(n=""){let e=!0;if(n){const i=V1(_b);e=typeof i[n]<"u"?i[n]:!0}if(!e)return"";let t=localStorage.getItem(pr)||"";return(!t||hg(t,10))&&(t&&localStorage.removeItem(pr),this._adminFileTokenRequest||(this._adminFileTokenRequest=this.files.getToken()),t=await this._adminFileTokenRequest,localStorage.setItem(pr,t),this._adminFileTokenRequest=null),t};class Fy extends _g{save(e,t){super.save(e,t),t instanceof rs&&ea(t)}clear(){super.clear(),ea(null)}}const de=new zo("../",new Fy("pb_admin_auth"));de.authStore.model instanceof rs&&ea(de.authStore.model);function Ny(n){let e,t,i,s,l,o,r,a,u,f,d,p;const h=n[3].default,g=kt(h,n,n[2],null);return{c(){e=y("div"),t=y("main"),g&&g.c(),i=D(),s=y("footer"),l=y("a"),l.innerHTML=`<i class="ri-book-open-line txt-sm"></i>
2023-05-14 03:23:19 +08:00
<span class="txt">Docs</span>`,o=D(),r=y("span"),r.textContent="|",a=D(),u=y("a"),f=y("span"),f.textContent="PocketBase v0.16.0-WIP",m(t,"class","page-content"),m(l,"href","https://pocketbase.io/docs/"),m(l,"target","_blank"),m(l,"rel","noopener noreferrer"),m(r,"class","delimiter"),m(f,"class","txt"),m(u,"href","https://github.com/pocketbase/pocketbase/releases"),m(u,"target","_blank"),m(u,"rel","noopener noreferrer"),m(u,"title","Releases"),m(s,"class","page-footer"),m(e,"class",d="page-wrapper "+n[1]),ee(e,"center-content",n[0])},m(_,b){S(_,e,b),v(e,t),g&&g.m(t,null),v(e,i),v(e,s),v(s,l),v(s,o),v(s,r),v(s,a),v(s,u),v(u,f),p=!0},p(_,[b]){g&&g.p&&(!p||b&4)&&St(g,h,_,_[2],p?wt(h,_[2],b,null):$t(_[2]),null),(!p||b&2&&d!==(d="page-wrapper "+_[1]))&&m(e,"class",d),(!p||b&3)&&ee(e,"center-content",_[0])},i(_){p||(I(g,_),p=!0)},o(_){P(g,_),p=!1},d(_){_&&w(e),g&&g.d(_)}}}function Ry(n,e,t){let{$$slots:i={},$$scope:s}=e,{center:l=!1}=e,{class:o=""}=e;return n.$$set=r=>{"center"in r&&t(0,l=r.center),"class"in r&&t(1,o=r.class),"$$scope"in r&&t(2,s=r.$$scope)},[l,o,s,i]}class Sn extends be{constructor(e){super(),ge(this,e,Ry,Ny,_e,{center:0,class:1})}}function Gu(n){let e,t,i;return{c(){e=y("div"),e.innerHTML=`<figure class="logo"><img src="./images/logo.svg" alt="PocketBase logo" width="40" height="40"/>
2023-05-14 03:10:14 +08:00
<span class="txt">Pocket<strong>Base</strong></span></figure>`,t=D(),i=y("div"),m(e,"class","block txt-center m-b-lg"),m(i,"class","clearfix")},m(s,l){S(s,e,l),S(s,t,l),S(s,i,l)},d(s){s&&w(e),s&&w(t),s&&w(i)}}}function qy(n){let e,t,i,s=!n[0]&&Gu();const l=n[1].default,o=kt(l,n,n[2],null);return{c(){e=y("div"),s&&s.c(),t=D(),o&&o.c(),m(e,"class","wrapper wrapper-sm m-b-xl panel-wrapper svelte-lxxzfu")},m(r,a){S(r,e,a),s&&s.m(e,null),v(e,t),o&&o.m(e,null),i=!0},p(r,a){r[0]?s&&(s.d(1),s=null):s||(s=Gu(),s.c(),s.m(e,t)),o&&o.p&&(!i||a&4)&&St(o,l,r,r[2],i?wt(l,r[2],a,null):$t(r[2]),null)},i(r){i||(I(o,r),i=!0)},o(r){P(o,r),i=!1},d(r){r&&w(e),s&&s.d(),o&&o.d(r)}}}function jy(n){let e,t;return e=new Sn({props:{class:"full-page",center:!0,$$slots:{default:[qy]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){z(e,i,s),t=!0},p(i,[s]){const l={};s&5&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function Vy(n,e,t){let{$$slots:i={},$$scope:s}=e,{nobranding:l=!1}=e;return n.$$set=o=>{"nobranding"in o&&t(0,l=o.nobranding),"$$scope"in o&&t(2,s=o.$$scope)},[l,i,s]}class gb extends be{constructor(e){super(),ge(this,e,Vy,jy,_e,{nobranding:0})}}function Ko(n){const e=n-1;return e*e*e+1}function ta(n,{delay:e=0,duration:t=400,easing:i=$l}={}){const s=+getComputedStyle(n).opacity;return{delay:e,duration:t,easing:i,css:l=>`opacity: ${l*s}`}}function ci(n,{delay:e=0,duration:t=400,easing:i=Ko,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),[d,p]=_u(s),[h,g]=_u(l);return{delay:e,duration:t,easing:i,css:(_,b)=>`
transform: ${u} translate(${(1-_)*d}${p}, ${(1-_)*h}${g});
opacity: ${a-f*b}`}}function rt(n,{delay:e=0,duration:t=400,easing:i=Ko,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)}`),d=parseFloat(l[`padding${f[0]}`]),p=parseFloat(l[`padding${f[1]}`]),h=parseFloat(l[`margin${f[0]}`]),g=parseFloat(l[`margin${f[1]}`]),_=parseFloat(l[`border${f[0]}Width`]),b=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*d}px;padding-${u[1]}: ${k*p}px;margin-${u[0]}: ${k*h}px;margin-${u[1]}: ${k*g}px;border-${u[0]}-width: ${k*_}px;border-${u[1]}-width: ${k*b}px;`}}function Jt(n,{delay:e=0,duration:t=400,easing:i=Ko,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:(d,p)=>`
transform: ${a} scale(${1-u*p});
opacity: ${r-f*p}
`}}let na,Ki;const ia="app-tooltip";function Xu(n){return typeof n=="string"?{text:n,position:"bottom",hideOnClick:null}:n||{}}function Ni(){return Ki=Ki||document.querySelector("."+ia),Ki||(Ki=document.createElement("div"),Ki.classList.add(ia),document.body.appendChild(Ki)),Ki}function bb(n,e){let t=Ni();if(!t.classList.contains("active")||!(e!=null&&e.text)){sa();return}t.textContent=e.text,t.className=ia+" 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 sa(){clearTimeout(na),Ni().classList.remove("active"),Ni().activeNode=void 0}function zy(n,e){Ni().activeNode=n,clearTimeout(na),na=setTimeout(()=>{Ni().classList.add("active"),bb(n,e)},isNaN(e.delay)?0:e.delay)}function Be(n,e){let t=Xu(e);function i(){zy(n,t)}function s(){sa()}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),Ni(),{update(l){var o,r;t=Xu(l),(r=(o=Ni())==null?void 0:o.activeNode)!=null&&r.contains(n)&&bb(n,t)},destroy(){var l,o;(o=(l=Ni())==null?void 0:l.activeNode)!=null&&o.contains(n)&&sa(),n.removeEventListener("mouseenter",i),n.removeEventListener("mouseleave",s),n.removeEventListener("blur",s),n.removeEventListener("click",s)}}}function Qu(n,e,t){const i=n.slice();return i[12]=e[t],i}const Hy=n=>({}),xu=n=>({uniqueId:n[4]});function By(n){let e,t,i=n[3],s=[];for(let o=0;o<i.length;o+=1)s[o]=ef(Qu(n,i,o));const l=o=>P(s[o],1,1,()=>{s[o]=null});return{c(){for(let o=0;o<s.length;o+=1)s[o].c();e=Se()},m(o,r){for(let a=0;a<s.length;a+=1)s[a]&&s[a].m(o,r);S(o,e,r),t=!0},p(o,r){if(r&8){i=o[3];let a;for(a=0;a<i.length;a+=1){const u=Qu(o,i,a);s[a]?(s[a].p(u,r),I(s[a],1)):(s[a]=ef(u),s[a].c(),I(s[a],1),s[a].m(e.parentNode,e))}for(ue(),a=i.length;a<s.length;a+=1)l(a);fe()}},i(o){if(!t){for(let r=0;r<i.length;r+=1)I(s[r]);t=!0}},o(o){s=s.filter(Boolean);for(let r=0;r<s.length;r+=1)P(s[r]);t=!1},d(o){pt(s,o),o&&w(e)}}}function Uy(n){let e,t,i,s,l,o,r;return{c(){e=y("div"),t=y("i"),m(t,"class","ri-error-warning-fill txt-danger"),m(e,"class","form-field-addon")},m(a,u){S(a,e,u),v(e,t),l=!0,o||(r=Oe(i=Be.call(null,t,{position:"left",text:n[3].map(wo).join(`
`)})),o=!0)},p(a,u){i&&jt(i.update)&&u&8&&i.update.call(null,{position:"left",text:a[3].map(wo).join(`
2023-05-14 03:23:19 +08:00
`)})},i(a){l||(a&&et(()=>{l&&(s||(s=Ve(t,Jt,{duration:150,start:.7},!0)),s.run(1))}),l=!0)},o(a){a&&(s||(s=Ve(t,Jt,{duration:150,start:.7},!1)),s.run(0)),l=!1},d(a){a&&w(e),a&&s&&s.end(),o=!1,r()}}}function ef(n){let e,t,i=wo(n[12])+"",s,l,o,r;return{c(){e=y("div"),t=y("pre"),s=Y(i),l=D(),m(e,"class","help-block help-block-error")},m(a,u){S(a,e,u),v(e,t),v(t,s),v(e,l),r=!0},p(a,u){(!r||u&8)&&i!==(i=wo(a[12])+"")&&le(s,i)},i(a){r||(a&&et(()=>{r&&(o||(o=Ve(e,rt,{duration:150},!0)),o.run(1))}),r=!0)},o(a){a&&(o||(o=Ve(e,rt,{duration:150},!1)),o.run(0)),r=!1},d(a){a&&w(e),a&&o&&o.end()}}}function Wy(n){let e,t,i,s,l,o,r;const a=n[9].default,u=kt(a,n,n[8],xu),f=[Uy,By],d=[];function p(h,g){return h[0]&&h[3].length?0:1}return i=p(n),s=d[i]=f[i](n),{c(){e=y("div"),u&&u.c(),t=D(),s.c(),m(e,"class",n[1]),ee(e,"error",n[3].length)},m(h,g){S(h,e,g),u&&u.m(e,null),v(e,t),d[i].m(e,null),n[11](e),l=!0,o||(r=J(e,"click",n[10]),o=!0)},p(h,[g]){u&&u.p&&(!l||g&256)&&St(u,a,h,h[8],l?wt(a,h[8],g,Hy):$t(h[8]),xu);let _=i;i=p(h),i===_?d[i].p(h,g):(ue(),P(d[_],1,1,()=>{d[_]=null}),fe(),s=d[i],s?s.p(h,g):(s=d[i]=f[i](h),s.c()),I(s,1),s.m(e,null)),(!l||g&2)&&m(e,"class",h[1]),(!l||g&10)&&ee(e,"error",h[3].length)},i(h){l||(I(u,h),I(s),l=!0)},o(h){P(u,h),P(s),l=!1},d(h){h&&w(e),u&&u.d(h),d[i].d(),n[11](null),o=!1,r()}}}const tf="Invalid value";function wo(n){return typeof n=="object"?(n==null?void 0:n.message)||(n==null?void 0:n.code)||tf:n||tf}function Yy(n,e,t){let i;Ze(n,Ti,_=>t(7,i=_));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,d=[];function p(){ui(r)}Xt(()=>(f.addEventListener("input",p),f.addEventListener("change",p),()=>{f.removeEventListener("input",p),f.removeEventListener("change",p)}));function h(_){me.call(this,n,_)}function g(_){ne[_?"unshift":"push"](()=>{f=_,t(2,f)})}return n.$$set=_=>{"name"in _&&t(5,r=_.name),"inlineError"in _&&t(0,a=_.inlineError),"class"in _&&t(1,u=_.class),"$$scope"in _&&t(8,l=_.$$scope)},n.$$.update=()=>{n.$$.dirty&160&&t(3,d=U.toArray(U.getNestedVal(i,r)))},[a,u,f,d,o,r,p,i,l,s,h,g]}class pe extends be{constructor(e){super(),ge(this,e,Yy,Wy,_e,{name:5,inlineError:0,class:1,changed:6})}get changed(){return this.$$.ctx[6]}}function Ky(n){let e,t,i,s,l,o,r,a;return{c(){e=y("label"),t=Y("Email"),s=D(),l=y("input"),m(e,"for",i=n[9]),m(l,"type","email"),m(l,"autocomplete","off"),m(l,"id",o=n[9]),l.required=!0,l.autofocus=!0},m(u,f){S(u,e,f),v(e,t),S(u,s,f),S(u,l,f),ae(l,n[0]),l.focus(),r||(a=J(l,"input",n[5]),r=!0)},p(u,f){f&512&&i!==(i=u[9])&&m(e,"for",i),f&512&&o!==(o=u[9])&&m(l,"id",o),f&1&&l.value!==u[0]&&ae(l,u[0])},d(u){u&&w(e),u&&w(s),u&&w(l),r=!1,a()}}}function Jy(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=y("label"),t=Y("Password"),s=D(),l=y("input"),r=D(),a=y("div"),a.textContent="Minimum 10 characters.",m(e,"for",i=n[9]),m(l,"type","password"),m(l,"autocomplete","new-password"),m(l,"minlength","10"),m(l,"id",o=n[9]),l.required=!0,m(a,"class","help-block")},m(d,p){S(d,e,p),v(e,t),S(d,s,p),S(d,l,p),ae(l,n[1]),S(d,r,p),S(d,a,p),u||(f=J(l,"input",n[6]),u=!0)},p(d,p){p&512&&i!==(i=d[9])&&m(e,"for",i),p&512&&o!==(o=d[9])&&m(l,"id",o),p&2&&l.value!==d[1]&&ae(l,d[1])},d(d){d&&w(e),d&&w(s),d&&w(l),d&&w(r),d&&w(a),u=!1,f()}}}function Zy(n){let e,t,i,s,l,o,r,a;return{c(){e=y("label"),t=Y("Password confirm"),s=D(),l=y("input"),m(e,"for",i=n[9]),m(l,"type","password"),m(l,"minlength","10"),m(l,"id",o=n[9]),l.required=!0},m(u,f){S(u,e,f),v(e,t),S(u,s,f),S(u,l,f),ae(l,n[2]),r||(a=J(l,"input",n[7]),r=!0)},p(u,f){f&512&&i!==(i=u[9])&&m(e,"for",i),f&512&&o!==(o=u[9])&&m(l,"id",o),f&4&&l.value!==u[2]&&ae(l,u[2])},d(u){u&&w(e),u&&w(s),u&&w(l),r=!1,a()}}}function Gy(n){let e,t,i,s,l,o,r,a,u,f,d,p,h;return s=new pe({props:{class:"form-field required",name:"email",$$slots:{default:[Ky,({uniqueId:g})=>({9:g}),({uniqueId:g})=>g?512:0]},$$scope:{ctx:n}}}),o=new pe({props:{class:"form-field required",name:"password",$$slots:{default:[Jy,({uniqueId:g})=>({9:g}),({uniqueId:g})=>g?512:0]},$$scope:{ctx:n}}}),a=new pe({props:{class:"form-field required",nam
<i class="ri-arrow-right-line"></i>`,m(t,"class","content txt-center m-b-base"),m(f,"type","submit"),m(f,"class","btn btn-lg btn-block btn-next"),ee(f,"btn-disabled",n[3]),ee(f,"btn-loading",n[3]),m(e,"class","block"),m(e,"autocomplete","off")},m(g,_){S(g,e,_),v(e,t),v(e,i),z(s,e,null),v(e,l),z(o,e,null),v(e,r),z(a,e,null),v(e,u),v(e,f),d=!0,p||(h=J(e,"submit",xe(n[4])),p=!0)},p(g,[_]){const b={};_&1537&&(b.$$scope={dirty:_,ctx:g}),s.$set(b);const k={};_&1538&&(k.$$scope={dirty:_,ctx:g}),o.$set(k);const $={};_&1540&&($.$$scope={dirty:_,ctx:g}),a.$set($),(!d||_&8)&&ee(f,"btn-disabled",g[3]),(!d||_&8)&&ee(f,"btn-loading",g[3])},i(g){d||(I(s.$$.fragment,g),I(o.$$.fragment,g),I(a.$$.fragment,g),d=!0)},o(g){P(s.$$.fragment,g),P(o.$$.fragment,g),P(a.$$.fragment,g),d=!1},d(g){g&&w(e),H(s),H(o),H(a),p=!1,h()}}}function Xy(n,e,t){const i=Tt();let s="",l="",o="",r=!1;async function a(){if(!r){t(3,r=!0);try{await de.admins.create({email:s,password:l,passwordConfirm:o}),await de.admins.authWithPassword(s,l),i("submit")}catch(p){de.error(p)}t(3,r=!1)}}function u(){s=this.value,t(0,s)}function f(){l=this.value,t(1,l)}function d(){o=this.value,t(2,o)}return[s,l,o,r,a,u,f,d]}class Qy extends be{constructor(e){super(),ge(this,e,Xy,Gy,_e,{})}}function nf(n){let e,t;return e=new gb({props:{$$slots:{default:[xy]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){z(e,i,s),t=!0},p(i,s){const l={};s&9&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function xy(n){let e,t;return e=new Qy({}),e.$on("submit",n[1]),{c(){B(e.$$.fragment)},m(i,s){z(e,i,s),t=!0},p:te,i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function ek(n){let e,t,i=n[0]&&nf(n);return{c(){i&&i.c(),e=Se()},m(s,l){i&&i.m(s,l),S(s,e,l),t=!0},p(s,[l]){s[0]?i?(i.p(s,l),l&1&&I(i,1)):(i=nf(s),i.c(),I(i,1),i.m(e.parentNode,e)):i&&(ue(),P(i,1,1,()=>{i=null}),fe())},i(s){t||(I(i),t=!0)},o(s){P(i),t=!1},d(s){i&&i.d(s),s&&w(e)}}}function tk(n,e,t){let i=!1;s();function s(){if(t(0,i=!1),new URLSearchParams(window.location.search).has("installer")){de.logout(!1),t(0,i=!0);return}de.authStore.isValid?Vi("/collections"):de.logout()}return[i,async()=>{t(0,i=!1),await cn(),window.location.search=""}]}class nk extends be{constructor(e){super(),ge(this,e,tk,ek,_e,{})}}const Mt=Ln(""),So=Ln(""),Is=Ln(!1);function ik(n){let e,t,i,s;return{c(){e=y("input"),m(e,"type","text"),m(e,"id",n[8]),m(e,"placeholder",t=n[0]||n[1])},m(l,o){S(l,e,o),n[13](e),ae(e,n[7]),i||(s=J(e,"input",n[14]),i=!0)},p(l,o){o&3&&t!==(t=l[0]||l[1])&&m(e,"placeholder",t),o&128&&e.value!==l[7]&&ae(e,l[7])},i:te,o:te,d(l){l&&w(e),n[13](null),i=!1,s()}}}function sk(n){let e,t,i,s;function l(a){n[12](a)}var o=n[4];function r(a){let u={id:a[8],singleLine:!0,disableRequestKeys:!0,disableIndirectCollectionsKeys:!0,extraAutocompleteKeys:a[3],baseCollection:a[2],placeholder:a[0]||a[1]};return a[7]!==void 0&&(u.value=a[7]),{props:u}}return o&&(e=Rt(o,r(n)),ne.push(()=>he(e,"value",l)),e.$on("submit",n[10])),{c(){e&&B(e.$$.fragment),i=Se()},m(a,u){e&&z(e,a,u),S(a,i,u),s=!0},p(a,u){const f={};if(u&8&&(f.extraAutocompleteKeys=a[3]),u&4&&(f.baseCollection=a[2]),u&3&&(f.placeholder=a[0]||a[1]),!t&&u&128&&(t=!0,f.value=a[7],ye(()=>t=!1)),u&16&&o!==(o=a[4])){if(e){ue();const d=e;P(d.$$.fragment,1,0,()=>{H(d,1)}),fe()}o?(e=Rt(o,r(a)),ne.push(()=>he(e,"value",l)),e.$on("submit",a[10]),B(e.$$.fragment),I(e.$$.fragment,1),z(e,i.parentNode,i)):e=null}else o&&e.$set(f)},i(a){s||(e&&I(e.$$.fragment,a),s=!0)},o(a){e&&P(e.$$.fragment,a),s=!1},d(a){a&&w(i),e&&H(e,a)}}}function sf(n){let e,t,i;return{c(){e=y("button"),e.innerHTML='<span class="txt">Search</span>',m(e,"type","submit"),m(e,"class","btn btn-expanded btn-sm btn-warning")},m(s,l){S(s,e,l),i=!0},i(s){i||(s&&et(()=>{i&&(t||(t=Ve(e,ci,{duration:150,x:5},!0)),t.run(1))}),i=!0)},o(s){s&&(t||(t=Ve(e,ci,{duration:150,x:5},!1)),t.run(0)),i=!1},d(s){s&&w(e),s&&t&&t.end()}}}function lf(n){let e,t,i,s,l;return{c(){e=y("button"),e.innerHTML='<span class="txt">Clear</span>',m(e,"type","button"),m(e,"c
<span class="txt">Method</span>`,m(e,"class","col-header-content")},m(t,i){S(t,e,i)},p:te,d(t){t&&w(e)}}}function yk(n){let e,t,i,s;return{c(){e=y("div"),t=y("i"),i=D(),s=y("span"),s.textContent="URL",m(t,"class",U.getFieldTypeIcon("url")),m(s,"class","txt"),m(e,"class","col-header-content")},m(l,o){S(l,e,o),v(e,t),v(e,i),v(e,s)},p:te,d(l){l&&w(e)}}}function kk(n){let e,t,i,s;return{c(){e=y("div"),t=y("i"),i=D(),s=y("span"),s.textContent="Referer",m(t,"class",U.getFieldTypeIcon("url")),m(s,"class","txt"),m(e,"class","col-header-content")},m(l,o){S(l,e,o),v(e,t),v(e,i),v(e,s)},p:te,d(l){l&&w(e)}}}function wk(n){let e,t,i,s;return{c(){e=y("div"),t=y("i"),i=D(),s=y("span"),s.textContent="User IP",m(t,"class",U.getFieldTypeIcon("number")),m(s,"class","txt"),m(e,"class","col-header-content")},m(l,o){S(l,e,o),v(e,t),v(e,i),v(e,s)},p:te,d(l){l&&w(e)}}}function Sk(n){let e,t,i,s;return{c(){e=y("div"),t=y("i"),i=D(),s=y("span"),s.textContent="Status",m(t,"class",U.getFieldTypeIcon("number")),m(s,"class","txt"),m(e,"class","col-header-content")},m(l,o){S(l,e,o),v(e,t),v(e,i),v(e,s)},p:te,d(l){l&&w(e)}}}function $k(n){let e,t,i,s;return{c(){e=y("div"),t=y("i"),i=D(),s=y("span"),s.textContent="Created",m(t,"class",U.getFieldTypeIcon("date")),m(s,"class","txt"),m(e,"class","col-header-content")},m(l,o){S(l,e,o),v(e,t),v(e,i),v(e,s)},p:te,d(l){l&&w(e)}}}function uf(n){let e;function t(l,o){return l[6]?Ck:Tk}let i=t(n),s=i(n);return{c(){s.c(),e=Se()},m(l,o){s.m(l,o),S(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){s.d(l),l&&w(e)}}}function Tk(n){var r;let e,t,i,s,l,o=((r=n[0])==null?void 0:r.length)&&ff(n);return{c(){e=y("tr"),t=y("td"),i=y("h6"),i.textContent="No logs found.",s=D(),o&&o.c(),l=D(),m(t,"colspan","99"),m(t,"class","txt-center txt-hint p-xs")},m(a,u){S(a,e,u),v(e,t),v(t,i),v(t,s),o&&o.m(t,null),v(e,l)},p(a,u){var f;(f=a[0])!=null&&f.length?o?o.p(a,u):(o=ff(a),o.c(),o.m(t,null)):o&&(o.d(1),o=null)},d(a){a&&w(e),o&&o.d()}}}function Ck(n){let e;return{c(){e=y("tr"),e.innerHTML=`<td colspan="99" class="p-xs"><span class="skeleton-loader m-0"></span></td>
`},m(t,i){S(t,e,i)},p:te,d(t){t&&w(e)}}}function ff(n){let e,t,i;return{c(){e=y("button"),e.innerHTML='<span class="txt">Clear filters</span>',m(e,"type","button"),m(e,"class","btn btn-hint btn-expanded m-t-sm")},m(s,l){S(s,e,l),t||(i=J(e,"click",n[19]),t=!0)},p:te,d(s){s&&w(e),t=!1,i()}}}function cf(n){let e;return{c(){e=y("i"),m(e,"class","ri-error-warning-line txt-danger m-l-5 m-r-5"),m(e,"title","Error")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function df(n,e){var Ee,Ge,_t;let t,i,s,l=((Ee=e[23].method)==null?void 0:Ee.toUpperCase())+"",o,r,a,u,f,d=e[23].url+"",p,h,g,_,b,k,$=(e[23].referer||"N/A")+"",C,T,O,M,E,A=(e[23].userIp||"N/A")+"",L,N,q,R,F,V=e[23].status+"",j,W,Q,X,Z,re,x,se,ve,$e,ze=(((Ge=e[23].meta)==null?void 0:Ge.errorMessage)||((_t=e[23].meta)==null?void 0:_t.errorData))&&cf();X=new $i({props:{date:e[23].created}});function Ue(){return e[17](e[23])}function we(...Xe){return e[18](e[23],...Xe)}return{key:n,first:null,c(){t=y("tr"),i=y("td"),s=y("span"),o=Y(l),a=D(),u=y("td"),f=y("span"),p=Y(d),g=D(),ze&&ze.c(),_=D(),b=y("td"),k=y("span"),C=Y($),O=D(),M=y("td"),E=y("span"),L=Y(A),q=D(),R=y("td"),F=y("span"),j=Y(V),W=D(),Q=y("td"),B(X.$$.fragment),Z=D(),re=y("td"),re.innerHTML='<i class="ri-arrow-right-line"></i>',x=D(),m(s,"class",r="label txt-uppercase "+e[9][e[23].method.toLowerCase()]),m(i,"class","col-type-text col-field-method min-width"),m(f,"class","txt txt-ellipsis"),m(f,"title",h=e[23].url),m(u,"class","col-type-text col-field-url"),m(k,"class","txt txt-ellipsis"),m(k,"title",T=e[23].referer),ee(k,"txt-hint",!e[23].referer),m(b,"class","col-type-text col-field-referer"),m(E,"class","txt txt-ellipsis"),m(E,"title",N=e[23].userIp),ee(E,"txt-hint",!e[23].userIp),m(M,"class","col-type-number col-field-userIp"),m(F,"class","label"),ee(F,"label-danger",e[23].status>=400),m(R,"class","col-type-number col-field-status"),m(Q,"class","col-type-date col-field-created"),m(re,"class","col-type-action min-width"),m(t,"tabindex","0"),m(t,"class","row-handle"),this.first=t},m(Xe,Ke){S(Xe,t,Ke),v(t,i),v(i,s),v(s,o),v(t,a),v(t,u),v(u,f),v(f,p),v(u,g),ze&&ze.m(u,null),v(t,_),v(t,b),v(b,k),v(k,C),v(t,O),v(t,M),v(M,E),v(E,L),v(t,q),v(t,R),v(R,F),v(F,j),v(t,W),v(t,Q),z(X,Q,null),v(t,Z),v(t,re),v(t,x),se=!0,ve||($e=[J(t,"click",Ue),J(t,"keydown",we)],ve=!0)},p(Xe,Ke){var ce,He,At;e=Xe,(!se||Ke&8)&&l!==(l=((ce=e[23].method)==null?void 0:ce.toUpperCase())+"")&&le(o,l),(!se||Ke&8&&r!==(r="label txt-uppercase "+e[9][e[23].method.toLowerCase()]))&&m(s,"class",r),(!se||Ke&8)&&d!==(d=e[23].url+"")&&le(p,d),(!se||Ke&8&&h!==(h=e[23].url))&&m(f,"title",h),(He=e[23].meta)!=null&&He.errorMessage||(At=e[23].meta)!=null&&At.errorData?ze||(ze=cf(),ze.c(),ze.m(u,null)):ze&&(ze.d(1),ze=null),(!se||Ke&8)&&$!==($=(e[23].referer||"N/A")+"")&&le(C,$),(!se||Ke&8&&T!==(T=e[23].referer))&&m(k,"title",T),(!se||Ke&8)&&ee(k,"txt-hint",!e[23].referer),(!se||Ke&8)&&A!==(A=(e[23].userIp||"N/A")+"")&&le(L,A),(!se||Ke&8&&N!==(N=e[23].userIp))&&m(E,"title",N),(!se||Ke&8)&&ee(E,"txt-hint",!e[23].userIp),(!se||Ke&8)&&V!==(V=e[23].status+"")&&le(j,V),(!se||Ke&8)&&ee(F,"label-danger",e[23].status>=400);const Te={};Ke&8&&(Te.date=e[23].created),X.$set(Te)},i(Xe){se||(I(X.$$.fragment,Xe),se=!0)},o(Xe){P(X.$$.fragment,Xe),se=!1},d(Xe){Xe&&w(t),ze&&ze.d(),H(X),ve=!1,De($e)}}}function Mk(n){let e,t,i,s,l,o,r,a,u,f,d,p,h,g,_,b,k,$,C,T,O,M,E,A,L=[],N=new Map,q;function R(we){n[11](we)}let F={disable:!0,class:"col-field-method",name:"method",$$slots:{default:[vk]},$$scope:{ctx:n}};n[1]!==void 0&&(F.sort=n[1]),s=new un({props:F}),ne.push(()=>he(s,"sort",R));function V(we){n[12](we)}let j={disable:!0,class:"col-type-text col-field-url",name:"url",$$slots:{default:[yk]},$$scope:{ctx:n}};n[1]!==void 0&&(j.sort=n[1]),r=new un({props:j}),ne.push(()=>he(r,"sort",V));function W(we){n[13](we)}let Q={disable:!0,class:"col-type-text col-field-referer",name:"referer",$$slots:{default:[kk]},$$scope:{ctx:n}};n[1]!==void 0&&(Q.sort=n[1]),f=new un({props:Q}),ne.push(()=>he(f,"sort",W));function X(we){n[14](we)}let Z={disable:!0,class:"col-type-number col-field-userIp
2023-05-14 03:10:14 +08:00
* Chart.js v3.9.1
* https://www.chartjs.org
* (c) 2022 Chart.js Contributors
* Released under the MIT License
*/function hi(){}const Ak=function(){let n=0;return function(){return n++}}();function dt(n){return n===null||typeof n>"u"}function Ct(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 nt(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}const Bt=n=>(typeof n=="number"||n instanceof Number)&&isFinite(+n);function jn(n,e){return Bt(n)?n:e}function lt(n,e){return typeof n>"u"?e:n}const Ik=(n,e)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:n/e,vb=(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 ht(n,e,t,i){let s,l,o;if(Ct(n))if(l=n.length,i)for(s=l-1;s>=0;s--)e.call(t,n[s],s);else for(s=0;s<l;s++)e.call(t,n[s],s);else if(nt(n))for(o=Object.keys(n),l=o.length,s=0;s<l;s++)e.call(t,n[o[s]],o[s])}function $o(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 To(n){if(Ct(n))return n.map(To);if(nt(n)){const e=Object.create(null),t=Object.keys(n),i=t.length;let s=0;for(;s<i;++s)e[t[s]]=To(n[t[s]]);return e}return n}function yb(n){return["__proto__","prototype","constructor"].indexOf(n)===-1}function Lk(n,e,t,i){if(!yb(n))return;const s=e[n],l=t[n];nt(s)&&nt(l)?_l(s,l,i):e[n]=To(l)}function _l(n,e,t){const i=Ct(e)?e:[e],s=i.length;if(!nt(n))return n;t=t||{};const l=t.merger||Lk;for(let o=0;o<s;++o){if(e=i[o],!nt(e))continue;const r=Object.keys(e);for(let a=0,u=r.length;a<u;++a)l(r[a],n,e,t)}return n}function rl(n,e){return _l(n,e,{merger:Pk})}function Pk(n,e,t){if(!yb(n))return;const i=e[n],s=t[n];nt(i)&&nt(s)?rl(i,s):Object.prototype.hasOwnProperty.call(e,n)||(e[n]=To(s))}const hf={"":n=>n,x:n=>n.x,y:n=>n.y};function qi(n,e){return(hf[e]||(hf[e]=Fk(e)))(n)}function Fk(n){const e=Nk(n);return t=>{for(const i of e){if(i==="")break;t=t&&t[i]}return t}}function Nk(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 Va(n){return n.charAt(0).toUpperCase()+n.slice(1)}const Yn=n=>typeof n<"u",ji=n=>typeof n=="function",_f=(n,e)=>{if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1;return!0};function Rk(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}const qt=Math.PI,bt=2*qt,qk=bt+qt,Co=Number.POSITIVE_INFINITY,jk=qt/180,Nt=qt/2,Js=qt/4,gf=qt*2/3,Un=Math.log10,ri=Math.sign;function bf(n){const e=Math.round(n);n=al(n,e,n/1e3)?e:n;const t=Math.pow(10,Math.floor(Un(n))),i=n/t;return(i<=1?1:i<=2?2:i<=5?5:10)*t}function Vk(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 Ls(n){return!isNaN(parseFloat(n))&&isFinite(n)}function al(n,e,t){return Math.abs(n-e)<t}function zk(n,e){const t=Math.round(n);return t-e<=n&&t+e>=n}function kb(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 Qn(n){return n*(qt/180)}function za(n){return n*(180/qt)}function vf(n){if(!Bt(n))return;let e=1,t=0;for(;Math.round(n*e)/e!==n;)e*=10,t++;return t}function wb(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*qt&&(l+=bt),{angle:l,distance:s}}function la(n,e){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))}function Hk(n,e){return(n-e+qk)%bt-qt}function On(n){return(n%bt+bt)%bt}function gl(n,e,t,i){const s=On(n),l=On(e),o=On(t),r=On(l-s),a=On(o-s),u=On(s-l),f=On(s-o);return s===l||s===o||i&&l===o||r>a&&u<f}function fn(n,e,t){return Math.max(e,Math.min(t,n))}function Bk(n){return fn(n,-32768,32767)}function bl(n,e,t,i=1e-6){return n>=Math.min(e,t)-i&&n<=Math.max(e,t)+i}function Ha(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 ts=(n,e,t,i)=>Ha(n,t,i?s=>n[s][e]<=t:s=>n[s][e]<t),Uk=(n,e,t)=>Ha(n,t,i=>n[i][e]>=t);function Wk(n,e,
* @kurkle/color v0.2.1
* https://github.com/kurkle/color#readme
* (c) 2022 Jukka Kurkela
* Released under the MIT License
2023-05-14 03:23:19 +08:00
*/function Al(n){return n+.5|0}const Li=(n,e,t)=>Math.max(Math.min(n,t),e);function il(n){return Li(Al(n*2.55),0,255)}function Ri(n){return Li(Al(n*255),0,255)}function bi(n){return Li(Al(n/2.55)/100,0,1)}function $f(n){return Li(Al(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},oa=[..."0123456789ABCDEF"],Zk=n=>oa[n&15],Gk=n=>oa[(n&240)>>4]+oa[n&15],Yl=n=>(n&240)>>4===(n&15),Xk=n=>Yl(n.r)&&Yl(n.g)&&Yl(n.b)&&Yl(n.a);function Qk(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 xk=(n,e)=>n<255?e(n):"";function e2(n){var e=Xk(n)?Zk:Gk;return n?"#"+e(n.r)+e(n.g)+e(n.b)+xk(n.a,e):void 0}const t2=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Ob(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 n2(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 i2(n,e,t){const i=Ob(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 s2(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 Ba(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=s2(t,i,s,f,l),a=a*60+.5),[a|0,u||0,r]}function Ua(n,e,t,i){return(Array.isArray(e)?n(e[0],e[1],e[2]):n(e,t,i)).map(Ri)}function Wa(n,e,t){return Ua(Ob,n,e,t)}function l2(n,e,t){return Ua(i2,n,e,t)}function o2(n,e,t){return Ua(n2,n,e,t)}function Db(n){return(n%360+360)%360}function r2(n){const e=t2.exec(n);let t=255,i;if(!e)return;e[5]!==i&&(t=e[6]?il(+e[5]):Ri(+e[5]));const s=Db(+e[2]),l=+e[3]/100,o=+e[4]/100;return e[1]==="hwb"?i=l2(s,l,o):e[1]==="hsv"?i=o2(s,l,o):i=Wa(s,l,o),{r:i[0],g:i[1],b:i[2],a:t}}function a2(n,e){var t=Ba(n);t[0]=Db(t[0]+e),t=Wa(t),n.r=t[0],n.g=t[1],n.b=t[2]}function u2(n){if(!n)return;const e=Ba(n),t=e[0],i=$f(e[1]),s=$f(e[2]);return n.a<255?`hsla(${t}, ${i}%, ${s}%, ${bi(n.a)})`:`hsl(${t}, ${i}%, ${s}%)`}const Tf={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"},Cf={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:"
2023-05-14 03:10:14 +08:00
* Chart.js v3.9.1
* https://www.chartjs.org
* (c) 2022 Chart.js Contributors
* Released under the MIT License
2023-05-14 03:23:19 +08:00
*/class dw{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=Tb.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 _i=new dw;const qf="transparent",pw={boolean(n,e,t){return t>.5?e:n},color(n,e,t){const i=Ef(n||qf),s=i.valid&&Ef(e||qf);return s&&s.valid?s.mix(i,t).hexString():e},number(n,e,t){return n+(e-n)*t}};class mw{constructor(e,t,i,s){const l=t[i];s=Zl([e.to,s,l,e.from]);const o=Zl([e.from,l,s]);this._active=!0,this._fn=e.fn||pw[e.type||typeof o],this._easing=ul[e.easing]||ul.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=Zl([e.to,t,s,e.from]),this._from=Zl([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]()}}const hw=["x","y","borderWidth","radius","tension"],_w=["color","borderColor","backgroundColor"];ot.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0});const gw=Object.keys(ot.animation);ot.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:n=>n!=="onProgress"&&n!=="onComplete"&&n!=="fn"});ot.set("animations",{colors:{type:"color",properties:_w},numbers:{type:"number",properties:hw}});ot.describe("animations",{_fallback:"animation"});ot.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:n=>n|0}}}});class Wb{constructor(e,t){this._chart=e,this._properties=new Map,this.configure(t)}configure(e){if(!nt(e))return;const t=this._properties;Object.getOwnPropertyNames(e).forEach(i=>{const s=e[i];if(!nt(s))return;const l={};for(con
2023-05-14 03:10:14 +08:00
`)>-1?n.split(`
2023-05-14 03:23:19 +08:00
`):n}function LS(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 hc(n,e){const t=n.chart.ctx,{body:i,footer:s,title:l}=n,{boxWidth:o,boxHeight:r}=e,a=Dn(e.bodyFont),u=Dn(e.titleFont),f=Dn(e.footerFont),d=l.length,p=s.length,h=i.length,g=Kn(e.padding);let _=g.height,b=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,d&&(_+=d*u.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),k){const T=e.displayColors?Math.max(r,a.lineHeight):a.lineHeight;_+=h*T+(k-h)*a.lineHeight+(k-1)*e.bodySpacing}p&&(_+=e.footerMarginTop+p*f.lineHeight+(p-1)*e.footerSpacing);let $=0;const C=function(T){b=Math.max(b,t.measureText(T).width+$)};return t.save(),t.font=u.string,ht(n.title,C),t.font=a.string,ht(n.beforeBody.concat(n.afterBody),C),$=e.displayColors?o+2+e.boxPadding:0,ht(i,T=>{ht(T.before,C),ht(T.lines,C),ht(T.after,C)}),$=0,t.font=f.string,ht(n.footer,C),t.restore(),b+=g.width,{width:b,height:_}}function PS(n,e){const{y:t,height:i}=e;return t<i/2?"top":t>n.height-i/2?"bottom":"center"}function FS(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 NS(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"),FS(u,n,e,t)&&(u="center"),u}function _c(n,e,t){const i=t.yAlign||e.yAlign||PS(n,t);return{xAlign:t.xAlign||e.xAlign||NS(n,e,t,i),yAlign:i}}function RS(n,e){let{x:t,width:i}=n;return e==="right"?t-=i:e==="center"&&(t-=i/2),t}function qS(n,e,t){let{y:i,height:s}=n;return e==="top"?i+=t:e==="bottom"?i-=s+t:i-=s/2,i}function gc(n,e,t,i){const{caretSize:s,caretPadding:l,cornerRadius:o}=n,{xAlign:r,yAlign:a}=t,u=s+l,{topLeft:f,topRight:d,bottomLeft:p,bottomRight:h}=Cs(o);let g=RS(e,r);const _=qS(e,a,u);return a==="center"?r==="left"?g+=u:r==="right"&&(g-=u):r==="left"?g-=Math.max(f,p)+s:r==="right"&&(g+=Math.max(d,h)+s),{x:fn(g,0,i.width-e.width),y:fn(_,0,i.height-e.height)}}function no(n,e,t){const i=Kn(t.padding);return e==="center"?n.x+n.width/2:e==="right"?n.x+n.width-i.right:n.x+i.left}function bc(n){return si([],gi(n))}function jS(n,e,t){return zi(n,{tooltip:e,tooltipItems:t,type:"tooltip"})}function vc(n,e){const t=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return t?n.override(t):n}class ha extends Ci{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||e._chart,this._chart=this.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const t=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&t.options.animation&&i.animations,l=new Wb(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(l)),l}getContext(){return this.$context||(this.$context=jS(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,t){const{callbacks:i}=t,s=i.beforeTitle.apply(this,[e]),l=i.title.apply(this,[e]),o=i.afterTitle.apply(this,[e]);let r=[];return r=si(r,gi(s)),r=si(r,gi(l)),r=si(r,gi(o)),r}getBeforeBody(e,t){return bc(t.callbacks.beforeBody.apply(this,[e]))}getBody(e,t){const{callbacks:i}=t,s=[];return ht(e,l=>{const o={before:[],lines:[],after:[]},r=vc(i,l);si(o.before,gi(r.beforeLabel.call(this,l))
2023-05-14 03:10:14 +08:00
* chartjs-adapter-luxon v1.3.1
* https://www.chartjs.org
* (c) 2023 chartjs-adapter-luxon Contributors
* Released under the MIT license
2023-05-14 03:23:19 +08:00
*/const o$={datetime:We.DATETIME_MED_WITH_SECONDS,millisecond:"h:mm:ss.SSS a",second:We.TIME_WITH_SECONDS,minute:We.TIME_SIMPLE,hour:{hour:"numeric"},day:{day:"numeric",month:"short"},week:"DD",month:{month:"short",year:"numeric"},quarter:"'Q'q - yyyy",year:{year:"numeric"}};Gb._date.override({_id:"luxon",_create:function(n){return We.fromMillis(n,this.options)},init(n){this.options.locale||(this.options.locale=n.locale)},formats:function(){return o$},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=We.fromFormat(n,e,t):n=We.fromISO(n,t):n instanceof Date?n=We.fromJSDate(n,t):i==="object"&&!(n instanceof We)&&(n=We.fromObject(n,t)),n.isValid?n.valueOf():null)},format:function(n,e){const t=this._create(n);return typeof e=="string"?t.toFormat(e):t.toLocaleString(e)},add:function(n,e,t){const i={};return i[t]=e,this._create(n).plus(i).valueOf()},diff:function(n,e,t){return this._create(n).diff(this._create(e)).as(t).valueOf()},startOf:function(n,e,t){if(e==="isoWeek"){t=Math.trunc(Math.min(Math.max(0,t),6));const i=this._create(n);return i.minus({days:(i.weekday-t+7)%7}).startOf("day").valueOf()}return e?this._create(n).startOf(e).valueOf():n},endOf:function(n,e){return this._create(n).endOf(e).valueOf()}});function Mc(n){let e,t,i;return{c(){e=y("div"),m(e,"class","chart-loader loader svelte-vh4sl8")},m(s,l){S(s,e,l),i=!0},i(s){i||(s&&et(()=>{i&&(t||(t=Ve(e,Jt,{duration:150},!0)),t.run(1))}),i=!0)},o(s){s&&(t||(t=Ve(e,Jt,{duration:150},!1)),t.run(0)),i=!1},d(s){s&&w(e),s&&t&&t.end()}}}function r$(n){let e,t,i=n[1]===1?"log":"logs",s;return{c(){e=Y(n[1]),t=D(),s=Y(i)},m(l,o){S(l,e,o),S(l,t,o),S(l,s,o)},p(l,o){o&2&&le(e,l[1]),o&2&&i!==(i=l[1]===1?"log":"logs")&&le(s,i)},d(l){l&&w(e),l&&w(t),l&&w(s)}}}function a$(n){let e;return{c(){e=Y("Loading...")},m(t,i){S(t,e,i)},p:te,d(t){t&&w(e)}}}function u$(n){let e,t,i,s,l,o=n[2]&&Mc();function r(f,d){return f[2]?a$:r$}let a=r(n),u=a(n);return{c(){e=y("div"),o&&o.c(),t=D(),i=y("canvas"),s=D(),l=y("div"),u.c(),m(i,"class","chart-canvas svelte-vh4sl8"),zr(i,"height","250px"),zr(i,"width","100%"),m(e,"class","chart-wrapper svelte-vh4sl8"),ee(e,"loading",n[2]),m(l,"class","txt-hint m-t-xs txt-right")},m(f,d){S(f,e,d),o&&o.m(e,null),v(e,t),v(e,i),n[8](i),S(f,s,d),S(f,l,d),u.m(l,null)},p(f,[d]){f[2]?o?d&4&&I(o,1):(o=Mc(),o.c(),I(o,1),o.m(e,t)):o&&(ue(),P(o,1,1,()=>{o=null}),fe()),d&4&&ee(e,"loading",f[2]),a===(a=r(f))&&u?u.p(f,d):(u.d(1),u=a(f),u&&(u.c(),u.m(l,null)))},i(f){I(o)},o(f){P(o)},d(f){f&&w(e),o&&o.d(),n[8](null),f&&w(s),f&&w(l),u.d()}}}function f$(n,e,t){let{filter:i=""}=e,{presets:s=""}=e,l,o,r=[],a=0,u=!1;async function f(){return t(2,u=!0),de.logs.getRequestsStats({filter:[s,i].filter(Boolean).join("&&")}).then(h=>{d();for(let g of h)r.push({x:new Date(g.date),y:g.total}),t(1,a+=g.total);r.push({x:new Date,y:void 0})}).catch(h=>{h!=null&&h.isAbort||(d(),console.warn(h),de.error(h,!1))}).finally(()=>{t(2,u=!1)})}function d(){t(1,a=0),t(7,r=[])}Xt(()=>(Po.register(Hi,xo,Xo,ru,Fl,IS,VS),t(6,o=new Po(l,{type:"line",data:{datasets:[{label:"Total requests",data:r,borderColor:"#ef4565",pointBackgroundColor:"#ef4565",backgroundColor:"rgb(239,69,101,0.05)",borderWidth:2,pointRadius:1,pointBorderWidth:0,fill:!0}]},options:{animation:!1,interaction:{intersect:!1,mode:"index"},scales:{y:{beginAtZero:!0,grid:{color:"#edf0f3",borderColor:"#dee3e8"},ticks:{precision:0,maxTicksLimit:6,autoSkip:!0,color:"#666f75"}},x:{type:"time",time:{unit:"hour",tooltipFormat:"DD h a"},grid:{borderColor:"#dee3e8",color:h=>h.tick.major?"#edf0f3":""},ticks:{maxTicksLimit:15,autoSkip:!0,maxRotation:0,major:{enabled:!0},color:h=>h.tick.major?"#16161a":"#666f75"}}},plugins:{legend:{display:!1}}}})),()=>o==null?void 0:o.destroy()));function p(h){ne[h?"unshift":"push"](()=>{l=h,t(0,l)})}return n.$$set=h=>{"filter"in h&&t(3,i=h.filter),"presets"in h&&t(4,s=h.presets)},n.$$.update=()=>{n.$$.dirty&24&&(typeof i<"u"||typeof s<"u")&&f(),n.$$.dirty&192&&typeof r<"u"&&o&&(t(6,o.data.datasets[0].data=r,o),o.update
2023-05-14 03:10:14 +08:00
* Prism: Lightweight, robust, elegant syntax highlighting
*
* @license MIT <https://opensource.org/licenses/MIT>
* @author Lea Verou <https://lea.verou.me>
* @namespace
* @public
2023-05-14 03:23:19 +08:00
*/var t=function(i){var s=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,l=0,o={},r={manual:i.Prism&&i.Prism.manual,disableWorkerMessageHandler:i.Prism&&i.Prism.disableWorkerMessageHandler,util:{encode:function $(C){return C instanceof a?new a(C.type,$(C.content),C.alias):Array.isArray(C)?C.map($):C.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function($){return Object.prototype.toString.call($).slice(8,-1)},objId:function($){return $.__id||Object.defineProperty($,"__id",{value:++l}),$.__id},clone:function $(C,T){T=T||{};var O,M;switch(r.util.type(C)){case"Object":if(M=r.util.objId(C),T[M])return T[M];O={},T[M]=O;for(var E in C)C.hasOwnProperty(E)&&(O[E]=$(C[E],T));return O;case"Array":return M=r.util.objId(C),T[M]?T[M]:(O=[],T[M]=O,C.forEach(function(A,L){O[L]=$(A,T)}),O);default:return C}},getLanguage:function($){for(;$;){var C=s.exec($.className);if(C)return C[1].toLowerCase();$=$.parentElement}return"none"},setLanguage:function($,C){$.className=$.className.replace(RegExp(s,"gi"),""),$.classList.add("language-"+C)},currentScript:function(){if(typeof document>"u")return null;if("currentScript"in document&&1<2)return document.currentScript;try{throw new Error}catch(O){var $=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(O.stack)||[])[1];if($){var C=document.getElementsByTagName("script");for(var T in C)if(C[T].src==$)return C[T]}return null}},isActive:function($,C,T){for(var O="no-"+C;$;){var M=$.classList;if(M.contains(C))return!0;if(M.contains(O))return!1;$=$.parentElement}return!!T}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function($,C){var T=r.util.clone(r.languages[$]);for(var O in C)T[O]=C[O];return T},insertBefore:function($,C,T,O){O=O||r.languages;var M=O[$],E={};for(var A in M)if(M.hasOwnProperty(A)){if(A==C)for(var L in T)T.hasOwnProperty(L)&&(E[L]=T[L]);T.hasOwnProperty(A)||(E[A]=M[A])}var N=O[$];return O[$]=E,r.languages.DFS(r.languages,function(q,R){R===N&&q!=$&&(this[q]=E)}),E},DFS:function $(C,T,O,M){M=M||{};var E=r.util.objId;for(var A in C)if(C.hasOwnProperty(A)){T.call(C,A,C[A],O||A);var L=C[A],N=r.util.type(L);N==="Object"&&!M[E(L)]?(M[E(L)]=!0,$(L,T,null,M)):N==="Array"&&!M[E(L)]&&(M[E(L)]=!0,$(L,T,A,M))}}},plugins:{},highlightAll:function($,C){r.highlightAllUnder(document,$,C)},highlightAllUnder:function($,C,T){var O={callback:T,container:$,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};r.hooks.run("before-highlightall",O),O.elements=Array.prototype.slice.apply(O.container.querySelectorAll(O.selector)),r.hooks.run("before-all-elements-highlight",O);for(var M=0,E;E=O.elements[M++];)r.highlightElement(E,C===!0,O.callback)},highlightElement:function($,C,T){var O=r.util.getLanguage($),M=r.languages[O];r.util.setLanguage($,O);var E=$.parentElement;E&&E.nodeName.toLowerCase()==="pre"&&r.util.setLanguage(E,O);var A=$.textContent,L={element:$,language:O,grammar:M,code:A};function N(R){L.highlightedCode=R,r.hooks.run("before-insert",L),L.element.innerHTML=L.highlightedCode,r.hooks.run("after-highlight",L),r.hooks.run("complete",L),T&&T.call(L.element)}if(r.hooks.run("before-sanity-check",L),E=L.element.parentElement,E&&E.nodeName.toLowerCase()==="pre"&&!E.hasAttribute("tabindex")&&E.setAttribute("tabindex","0"),!L.code){r.hooks.run("complete",L),T&&T.call(L.element);return}if(r.hooks.run("before-highlight",L),!L.grammar){N(r.util.encode(L.code));return}if(C&&i.Worker){var q=new Worker(r.filename);q.onmessage=function(R){N(R.data)},q.postMessage(JSON.stringify({language:L.language,code:L.code,immediateClose:!0}))}else N(r.highlight(L.code,L.grammar,L.language))},highlight:function($,C,T){var O={code:$,grammar:C,language:T};if(r.hooks.run("before-tokenize",O),!O.grammar)throw new Error('The language "'+O.language+'" has no grammar.');return O.tokens=r.tokenize(O.code,O.grammar),r.hooks.run("after-tokenize",O),a.stringify(r.util.encode(O.tokens),O.language)},tokenize:function($,C){var T=C.rest;if(T){for(var O in T)C[O]=T[O];delete C.rest}var M=new d;return p(M,M.head,$),f($,M,C,M.head,0),g(M)},hooks:{all:{},add:function
2023-05-14 03:10:14 +08:00
`),b.hasAttribute("data-start")||b.setAttribute("data-start",String(L+1))}k.textContent=M,t.highlightElement(k)},function(M){b.setAttribute(r,f),k.textContent=M})}}),t.plugins.fileHighlight={highlight:function(b){for(var k=(b||document).querySelectorAll(d),$=0,C;C=k[$++];)t.highlightElement(C)}};var g=!1;t.fileHighlight=function(){g||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),g=!0),t.plugins.fileHighlight.highlight.apply(this,arguments)}}()})(_1);var p$=_1.exports;const el=d$(p$);var m$={exports:{}};(function(n){(function(){if(typeof Prism>"u")return;var e=Object.assign||function(o,r){for(var a in r)r.hasOwnProperty(a)&&(o[a]=r[a]);return o};function t(o){this.defaults=e({},o)}function i(o){return o.replace(/-(\w)/g,function(r,a){return a.toUpperCase()})}function s(o){for(var r=0,a=0;a<o.length;++a)o.charCodeAt(a)==" ".charCodeAt(0)&&(r+=3);return o.length+r}var l={"remove-trailing":"boolean","remove-indent":"boolean","left-trim":"boolean","right-trim":"boolean","break-lines":"number",indent:"number","remove-initial-line-feed":"boolean","tabs-to-spaces":"number","spaces-to-tabs":"number"};t.prototype={setDefaults:function(o){this.defaults=e(this.defaults,o)},normalize:function(o,r){r=e(this.defaults,r);for(var a in r){var u=i(a);a!=="normalize"&&u!=="setDefaults"&&r[a]&&this[u]&&(o=this[u].call(this,o,r[a]))}return o},leftTrim:function(o){return o.replace(/^\s+/,"")},rightTrim:function(o){return o.replace(/\s+$/,"")},tabsToSpaces:function(o,r){return r=r|0||4,o.replace(/\t/g,new Array(++r).join(" "))},spacesToTabs:function(o,r){return r=r|0||4,o.replace(RegExp(" {"+r+"}","g")," ")},removeTrailing:function(o){return o.replace(/\s*?$/gm,"")},removeInitialLineFeed:function(o){return o.replace(/^(?:\r?\n|\r)/,"")},removeIndent:function(o){var r=o.match(/^[^\S\n\r]*(?=\S)/gm);return!r||!r[0].length||(r.sort(function(a,u){return a.length-u.length}),!r[0].length)?o:o.replace(RegExp("^"+r[0],"gm"),"")},indent:function(o,r){return o.replace(/^[^\S\n\r]*(?=\S)/gm,new Array(++r).join(" ")+"$&")},breakLines:function(o,r){r=r===!0?80:r|0||80;for(var a=o.split(`
`),u=0;u<a.length;++u)if(!(s(a[u])<=r)){for(var f=a[u].split(/(\s+)/g),d=0,p=0;p<f.length;++p){var h=s(f[p]);d+=h,d>r&&(f[p]=`
`+f[p],d=h)}a[u]=f.join("")}return a.join(`
2023-05-14 03:23:19 +08:00
`)}},n.exports&&(n.exports=t),Prism.plugins.NormalizeWhitespace=new t({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0}),Prism.hooks.add("before-sanity-check",function(o){var r=Prism.plugins.NormalizeWhitespace;if(!(o.settings&&o.settings["whitespace-normalization"]===!1)&&Prism.util.isActive(o.element,"whitespace-normalization",!0)){if((!o.element||!o.element.parentNode)&&o.code){o.code=r.normalize(o.code,o.settings);return}var a=o.element.parentNode;if(!(!o.code||!a||a.nodeName.toLowerCase()!=="pre")){o.settings==null&&(o.settings={});for(var u in l)if(Object.hasOwnProperty.call(l,u)){var f=l[u];if(a.hasAttribute("data-"+u))try{var d=JSON.parse(a.getAttribute("data-"+u)||"true");typeof d===f&&(o.settings[u]=d)}catch{}}for(var p=a.childNodes,h="",g="",_=!1,b=0;b<p.length;++b){var k=p[b];k==o.element?_=!0:k.nodeName==="#text"&&(_?g+=k.nodeValue:h+=k.nodeValue,a.removeChild(k),--b)}if(!o.element.children.length||!Prism.plugins.KeepMarkup)o.code=h+o.code+g,o.code=r.normalize(o.code,o.settings);else{var $=h+o.element.innerHTML+g;o.element.innerHTML=r.normalize($,o.settings),o.code=o.element.textContent}}}})})()})(m$);(function(n){var e=[/\b(?:async|sync|yield)\*/,/\b(?:abstract|assert|async|await|break|case|catch|class|const|continue|covariant|default|deferred|do|dynamic|else|enum|export|extends|extension|external|factory|final|finally|for|get|hide|if|implements|import|in|interface|library|mixin|new|null|on|operator|part|rethrow|return|set|show|static|super|switch|sync|this|throw|try|typedef|var|void|while|with|yield)\b/],t=/(^|[^\w.])(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,i={pattern:RegExp(t+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}}}};n.languages.dart=n.languages.extend("clike",{"class-name":[i,{pattern:RegExp(t+/[A-Z]\w*(?=\s+\w+\s*[;,=()])/.source),lookbehind:!0,inside:i.inside}],keyword:e,operator:/\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/}),n.languages.insertBefore("dart","string",{"string-literal":{pattern:/r?(?:("""|''')[\s\S]*?\1|(["'])(?:\\.|(?!\2)[^\\\r\n])*\2(?!\2))/,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:\w+|\{(?:[^{}]|\{[^{}]*\})*\})/,lookbehind:!0,inside:{punctuation:/^\$\{?|\}$/,expression:{pattern:/[\s\S]+/,inside:n.languages.dart}}},string:/[\s\S]+/}},string:void 0}),n.languages.insertBefore("dart","class-name",{metadata:{pattern:/@\w+/,alias:"function"}}),n.languages.insertBefore("dart","class-name",{generics:{pattern:/<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<[\w\s,.&?]*>)*>)*>)*>/,inside:{"class-name":i,keyword:e,punctuation:/[<>(),.:]/,operator:/[?&|]/}}})})(Prism);function h$(n){let e,t,i;return{c(){e=y("div"),t=y("code"),m(t,"class","svelte-10s5tkd"),m(e,"class",i="code-wrapper prism-light "+n[0]+" svelte-10s5tkd")},m(s,l){S(s,e,l),v(e,t),t.innerHTML=n[1]},p(s,[l]){l&2&&(t.innerHTML=s[1]),l&1&&i!==(i="code-wrapper prism-light "+s[0]+" svelte-10s5tkd")&&m(e,"class",i)},i:te,o:te,d(s){s&&w(e)}}}function _$(n,e,t){let{class:i=""}=e,{content:s=""}=e,{language:l="javascript"}=e,o="";function r(a){return a=typeof a=="string"?a:"",a=el.plugins.NormalizeWhitespace.normalize(a,{"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0}),el.highlight(a,el.languages[l]||el.languages.javascript,l)}return n.$$set=a=>{"class"in a&&t(0,i=a.class),"content"in a&&t(2,s=a.content),"language"in a&&t(3,l=a.language)},n.$$.update=()=>{n.$$.dirty&4&&typeof el<"u"&&s&&t(1,o=r(s))},[i,o,s,l]}class g1 extends be{constructor(e){super(),ge(this,e,_$,h$,_e,{class:0,content:2,language:3})}}const g$=n=>({}),Oc=n=>({}),b$=n=>({}),Dc=n=>({});function Ac(n){let e,t,i,s,l,o,r,a,u,f,d,p,h,g,_,b,k,$,C=n[4]&&!n[2]&&Ic(n);const T=n[19].header,O=kt(T,n,n[18],Dc);let M=n[4]&&n[2]&&Lc(n);const E=n[19].default,A=kt(E,n,n[18],null),L=n[19].footer,N=kt(L,n,n[18],Oc);return{c(){e=y("div"),t=y("div"),s=D(),l=y("div"),o=y("div"),C&&C.c(),r=D(),O&&O.c(),a=D(),M&&M.c(),u=D(),f=y("div"),A&&A.c(),d=D(),p=y("div"),N&&N.c(),m(
<span class="txt">New index</span>`,f=D(),B(d.$$.fragment),m(e,"class","section-title"),m(u,"type","button"),m(u,"class","btn btn-xs btn-transparent btn-pill btn-outline"),m(r,"class","indexes-list svelte-167lbwu")},m(E,A){S(E,e,A),v(e,t),v(e,s),v(e,l),S(E,o,A),S(E,r,A);for(let L=0;L<k.length;L+=1)k[L]&&k[L].m(r,null);v(r,a),v(r,u),S(E,f,A),z(d,E,A),h=!0,g||(_=J(u,"click",n[5]),g=!0)},p(E,[A]){var N,q,R;if((!h||A&1)&&i!==(i=(((q=(N=E[0])==null?void 0:N.indexes)==null?void 0:q.length)||0)+"")&&le(s,i),A&7){b=((R=E[0])==null?void 0:R.indexes)||[];let F;for(F=0;F<b.length;F+=1){const V=Bc(E,b,F);k[F]?k[F].p(V,A):(k[F]=Wc(V),k[F].c(),k[F].m(r,a))}for(;F<k.length;F+=1)k[F].d(1);k.length=b.length}const L={};!p&&A&1&&(p=!0,L.collection=E[0],ye(()=>p=!1)),d.$set(L)},i(E){h||(I(d.$$.fragment,E),h=!0)},o(E){P(d.$$.fragment,E),h=!1},d(E){E&&w(e),E&&w(o),E&&w(r),pt(k,E),E&&w(f),n[6](null),H(d,E),g=!1,_()}}}const Yc=n=>n.name;function Z$(n,e,t){let i;Ze(n,Ti,h=>t(2,i=h));let{collection:s}=e,l;function o(h,g){for(let _=0;_<s.indexes.length;_++)if(s.indexes[_]==h){t(0,s.indexes[_]=g,s),ui("indexes."+_);return}s.indexes.push(g),t(0,s)}const r=(h,g)=>l==null?void 0:l.show(h,g),a=()=>l==null?void 0:l.show();function u(h){ne[h?"unshift":"push"](()=>{l=h,t(1,l)})}function f(h){s=h,t(0,s)}const d=h=>{for(let g=0;g<s.indexes.length;g++)if(s.indexes[g]==h.detail){s.indexes.splice(g,1),ui("indexes."+g);break}t(0,s)},p=h=>{o(h.detail.old,h.detail.new)};return n.$$set=h=>{"collection"in h&&t(0,s=h.collection)},[s,l,i,o,r,a,u,f,d,p]}class G$ extends be{constructor(e){super(),ge(this,e,Z$,J$,_e,{collection:0})}}function Kc(n,e,t){const i=n.slice();return i[6]=e[t],i}function Jc(n){let e,t,i,s,l=n[6].label+"",o,r,a,u;function f(){return n[4](n[6])}function d(...p){return n[5](n[6],...p)}return{c(){e=y("div"),t=y("i"),i=D(),s=y("span"),o=Y(l),r=D(),m(t,"class","icon "+n[6].icon+" svelte-1gz9b6p"),m(s,"class","txt"),m(e,"tabindex","0"),m(e,"class","dropdown-item closable svelte-1gz9b6p")},m(p,h){S(p,e,h),v(e,t),v(e,i),v(e,s),v(s,o),v(e,r),a||(u=[J(e,"click",In(f)),J(e,"keydown",In(d))],a=!0)},p(p,h){n=p},d(p){p&&w(e),a=!1,De(u)}}}function X$(n){let e,t=n[2],i=[];for(let s=0;s<t.length;s+=1)i[s]=Jc(Kc(n,t,s));return{c(){for(let s=0;s<i.length;s+=1)i[s].c();e=Se()},m(s,l){for(let o=0;o<i.length;o+=1)i[o]&&i[o].m(s,l);S(s,e,l)},p(s,l){if(l&12){t=s[2];let o;for(o=0;o<t.length;o+=1){const r=Kc(s,t,o);i[o]?i[o].p(r,l):(i[o]=Jc(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){pt(i,s),s&&w(e)}}}function Q$(n){let e,t,i,s,l,o,r,a,u,f;return o=new Jn({props:{class:"dropdown field-types-dropdown",$$slots:{default:[X$]},$$scope:{ctx:n}}}),{c(){e=y("button"),t=y("i"),i=D(),s=y("div"),s.textContent="New field",l=D(),B(o.$$.fragment),m(t,"class","ri-add-line"),m(s,"class","txt"),m(e,"type","button"),m(e,"class",r="field-types-btn "+n[0]+" svelte-1gz9b6p")},m(d,p){S(d,e,p),v(e,t),v(e,i),v(e,s),v(e,l),z(o,e,null),a=!0,u||(f=J(e,"click",n[1]),u=!0)},p(d,[p]){const h={};p&512&&(h.$$scope={dirty:p,ctx:d}),o.$set(h),(!a||p&1&&r!==(r="field-types-btn "+d[0]+" svelte-1gz9b6p"))&&m(e,"class",r)},i(d){a||(I(o.$$.fragment,d),a=!0)},o(d){P(o.$$.fragment,d),a=!1},d(d){d&&w(e),H(o),u=!1,f()}}}function x$(n,e,t){let{class:i=""}=e;const s=Tt(),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:"Select",value:"select",icon:U.getFieldTypeIcon("select")},{label:"File",value:"file",icon:U.getFieldTypeIcon("file")},{label:"Relation",value:"relation",icon:U.getFieldTypeIcon("relation")},{label:"JSON",value:"json",icon:U.getFieldTypeIcon("json")}];function o(u){s("select",u)}const r=u=>{o(u.value)},a=(u,f)=>{(f.code==="Enter"||f.code==="Sp
2023-05-14 03:10:14 +08:00
This field is disabled if "Only domains" is set.`,position:"top"})),p=!0)},p(b,k){(!d||k&4096&&l!==(l=b[12]))&&m(e,"for",l);const $={};k&4096&&($.id=b[12]),k&1&&($.disabled=!U.isEmpty(b[0].options.onlyDomains)),!a&&k&1&&(a=!0,$.value=b[0].options.exceptDomains,ye(()=>a=!1)),r.$set($)},i(b){d||(I(r.$$.fragment,b),d=!0)},o(b){P(r.$$.fragment,b),d=!1},d(b){b&&w(e),b&&w(o),H(r,b),b&&w(u),b&&w(f),p=!1,h()}}}function IT(n){let e,t,i,s,l,o,r,a,u,f,d,p,h;function g(b){n[4](b)}let _={id:n[12]+".options.onlyDomains",disabled:!U.isEmpty(n[0].options.exceptDomains)};return n[0].options.onlyDomains!==void 0&&(_.value=n[0].options.onlyDomains),r=new zs({props:_}),ne.push(()=>he(r,"value",g)),{c(){e=y("label"),t=y("span"),t.textContent="Only domains",i=D(),s=y("i"),o=D(),B(r.$$.fragment),u=D(),f=y("div"),f.textContent="Use comma as separator.",m(t,"class","txt"),m(s,"class","ri-information-line link-hint"),m(e,"for",l=n[12]+".options.onlyDomains"),m(f,"class","help-block")},m(b,k){S(b,e,k),v(e,t),v(e,i),v(e,s),S(b,o,k),z(r,b,k),S(b,u,k),S(b,f,k),d=!0,p||(h=Oe(Be.call(null,s,{text:`List of domains that are ONLY allowed.
2023-05-14 03:23:19 +08:00
This field is disabled if "Except domains" is set.`,position:"top"})),p=!0)},p(b,k){(!d||k&4096&&l!==(l=b[12]+".options.onlyDomains"))&&m(e,"for",l);const $={};k&4096&&($.id=b[12]+".options.onlyDomains"),k&1&&($.disabled=!U.isEmpty(b[0].options.exceptDomains)),!a&&k&1&&(a=!0,$.value=b[0].options.onlyDomains,ye(()=>a=!1)),r.$set($)},i(b){d||(I(r.$$.fragment,b),d=!0)},o(b){P(r.$$.fragment,b),d=!1},d(b){b&&w(e),b&&w(o),H(r,b),b&&w(u),b&&w(f),p=!1,h()}}}function LT(n){let e,t,i,s,l,o,r;return i=new pe({props:{class:"form-field",name:"schema."+n[1]+".options.exceptDomains",$$slots:{default:[AT,({uniqueId:a})=>({12:a}),({uniqueId:a})=>a?4096:0]},$$scope:{ctx:n}}}),o=new pe({props:{class:"form-field",name:"schema."+n[1]+".options.onlyDomains",$$slots:{default:[IT,({uniqueId:a})=>({12:a}),({uniqueId:a})=>a?4096:0]},$$scope:{ctx:n}}}),{c(){e=y("div"),t=y("div"),B(i.$$.fragment),s=D(),l=y("div"),B(o.$$.fragment),m(t,"class","col-sm-6"),m(l,"class","col-sm-6"),m(e,"class","grid grid-sm")},m(a,u){S(a,e,u),v(e,t),z(i,t,null),v(e,s),v(e,l),z(o,l,null),r=!0},p(a,u){const f={};u&2&&(f.name="schema."+a[1]+".options.exceptDomains"),u&12289&&(f.$$scope={dirty:u,ctx:a}),i.$set(f);const d={};u&2&&(d.name="schema."+a[1]+".options.onlyDomains"),u&12289&&(d.$$scope={dirty:u,ctx:a}),o.$set(d)},i(a){r||(I(i.$$.fragment,a),I(o.$$.fragment,a),r=!0)},o(a){P(i.$$.fragment,a),P(o.$$.fragment,a),r=!1},d(a){a&&w(e),H(i),H(o)}}}function PT(n){let e,t,i;const s=[{key:n[1]},n[2]];function l(r){n[5](r)}let o={$$slots:{options:[LT]},$$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 pi({props:o}),ne.push(()=>he(e,"field",l)),e.$on("rename",n[6]),e.$on("remove",n[7]),e.$on("drop",n[8]),e.$on("dragstart",n[9]),e.$on("dragenter",n[10]),e.$on("dragleave",n[11]),{c(){B(e.$$.fragment)},m(r,a){z(e,r,a),i=!0},p(r,[a]){const u=a&6?Et(s,[a&2&&{key:r[1]},a&4&&Qt(r[2])]):{};a&8195&&(u.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,u.field=r[0],ye(()=>t=!1)),e.$set(u)},i(r){i||(I(e.$$.fragment,r),i=!0)},o(r){P(e.$$.fragment,r),i=!1},d(r){H(e,r)}}}function FT(n,e,t){const i=["field","key"];let s=tt(e,i),{field:l}=e,{key:o=""}=e;function r(b){n.$$.not_equal(l.options.exceptDomains,b)&&(l.options.exceptDomains=b,t(0,l))}function a(b){n.$$.not_equal(l.options.onlyDomains,b)&&(l.options.onlyDomains=b,t(0,l))}function u(b){l=b,t(0,l)}function f(b){me.call(this,n,b)}function d(b){me.call(this,n,b)}function p(b){me.call(this,n,b)}function h(b){me.call(this,n,b)}function g(b){me.call(this,n,b)}function _(b){me.call(this,n,b)}return n.$$set=b=>{e=je(je({},e),Gt(b)),t(2,s=tt(e,i)),"field"in b&&t(0,l=b.field),"key"in b&&t(1,o=b.key)},[l,o,s,r,a,u,f,d,p,h,g,_]}class y1 extends be{constructor(e){super(),ge(this,e,FT,PT,_e,{field:0,key:1})}}function NT(n){let e,t,i;const s=[{key:n[1]},n[2]];function l(r){n[3](r)}let o={};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 y1({props:o}),ne.push(()=>he(e,"field",l)),e.$on("rename",n[4]),e.$on("remove",n[5]),e.$on("drop",n[6]),e.$on("dragstart",n[7]),e.$on("dragenter",n[8]),e.$on("dragleave",n[9]),{c(){B(e.$$.fragment)},m(r,a){z(e,r,a),i=!0},p(r,[a]){const u=a&6?Et(s,[a&2&&{key:r[1]},a&4&&Qt(r[2])]):{};!t&&a&1&&(t=!0,u.field=r[0],ye(()=>t=!1)),e.$set(u)},i(r){i||(I(e.$$.fragment,r),i=!0)},o(r){P(e.$$.fragment,r),i=!1},d(r){H(e,r)}}}function RT(n,e,t){const i=["field","key"];let s=tt(e,i),{field:l}=e,{key:o=""}=e;function r(g){l=g,t(0,l)}function a(g){me.call(this,n,g)}function u(g){me.call(this,n,g)}function f(g){me.call(this,n,g)}function d(g){me.call(this,n,g)}function p(g){me.call(this,n,g)}function h(g){me.call(this,n,g)}return n.$$set=g=>{e=je(je({},e),Gt(g)),t(2,s=tt(e,i)),"field"in g&&t(0,l=g.field),"key"in g&&t(1,o=g.key)},[l,o,s,r,a,u,f,d,p,h]}class qT extends be{constructor(e){super(),ge(this,e,RT,NT,_e,{field:0,key:1})}}function jT(n){let e,t,i;const s=[{key:n[1]},n[2]];function l(r){n[3](r)}let o={};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 pi({props:o}),ne.push(()=>he(e,"field",l)),e.$on("rename",n[4]),e.$on(
2023-05-14 03:10:14 +08:00
<span class='flatpickr-weekday'>
2023-05-14 03:23:19 +08:00
`+G.join("</span><span class='flatpickr-weekday'>")+`
2023-05-14 03:10:14 +08:00
</span>
2023-05-14 03:23:19 +08:00
`}}function re(){t.calendarContainer.classList.add("hasWeeks");var K=ct("div","flatpickr-weekwrapper");K.appendChild(ct("span","flatpickr-weekday",t.l10n.weekAbbreviation));var G=ct("div","flatpickr-weeks");return K.appendChild(G),{weekWrapper:K,weekNumbers:G}}function x(K,G){G===void 0&&(G=!0);var ie=G?K:K-t.currentMonth;ie<0&&t._hidePrevMonthArrow===!0||ie>0&&t._hideNextMonthArrow===!0||(t.currentMonth+=ie,(t.currentMonth<0||t.currentMonth>11)&&(t.currentYear+=t.currentMonth>11?1:-1,t.currentMonth=(t.currentMonth+12)%12,Re("onYearChange"),F()),R(),Re("onMonthChange"),Nn())}function se(K,G){if(K===void 0&&(K=!0),G===void 0&&(G=!0),t.input.value="",t.altInput!==void 0&&(t.altInput.value=""),t.mobileInput!==void 0&&(t.mobileInput.value=""),t.selectedDates=[],t.latestSelectedDateObj=void 0,G===!0&&(t.currentYear=t._initialDate.getFullYear(),t.currentMonth=t._initialDate.getMonth()),t.config.enableTime===!0){var ie=Pr(t.config),oe=ie.hours,Me=ie.minutes,Pe=ie.seconds;h(oe,Me,Pe)}t.redraw(),K&&Re("onChange")}function ve(){t.isOpen=!1,t.isMobile||(t.calendarContainer!==void 0&&t.calendarContainer.classList.remove("open"),t._input!==void 0&&t._input.classList.remove("active")),Re("onClose")}function $e(){t.config!==void 0&&Re("onDestroy");for(var K=t._handlers.length;K--;)t._handlers[K].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 G=t.calendarContainer.parentNode;if(G.lastChild&&G.removeChild(G.lastChild),G.parentNode){for(;G.firstChild;)G.parentNode.insertBefore(G.firstChild,G);G.parentNode.removeChild(G)}}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(ie){try{delete t[ie]}catch{}})}function ze(K){return t.calendarContainer.contains(K)}function Ue(K){if(t.isOpen&&!t.config.inline){var G=Mn(K),ie=ze(G),oe=G===t.input||G===t.altInput||t.element.contains(G)||K.path&&K.path.indexOf&&(~K.path.indexOf(t.input)||~K.path.indexOf(t.altInput)),Me=!oe&&!ie&&!ze(K.relatedTarget),Pe=!t.config.ignoredFocusElements.some(function(Ne){return Ne.contains(G)});Me&&Pe&&(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 we(K){if(!(!K||t.config.minDate&&K<t.config.minDate.getFullYear()||t.config.maxDate&&K>t.config.maxDate.getFullYear())){var G=K,ie=t.currentYear!==G;t.currentYear=G||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)),ie&&(t.redraw(),Re("onYearChange"),F())}}function Ee(K,G){var ie;G===void 0&&(G=!0);var oe=t.parseDate(K,void 0,G);if(t.config.minDate&&oe&&En(oe,t.config.minDate,G!==void 0?G:!t.minDateHasTime)<0||t.config.maxDate&&oe&&En(oe,t.config.maxDate,G!==void 0?G:!t.maxDateHasTime)>0)return!1;if(!t.config.enable&&t.config.disable.length===0)retu
2023-05-14 03:10:14 +08:00
`),r=y("code"),r.textContent="multipart/form-data",a=Y(`
requests, the following normalization rules are applied if the `),u=y("code"),u.textContent="json",f=Y(` field
is a
`),d=y("strong"),d.textContent="plain string",p=Y(`:
2023-05-14 03:23:19 +08:00
`),h=y("ul"),g=y("li"),g.innerHTML="&quot;true&quot; is converted to the json <code>true</code>",_=D(),b=y("li"),b.innerHTML="&quot;false&quot; is converted to the json <code>false</code>",k=D(),$=y("li"),$.innerHTML="&quot;null&quot; is converted to the json <code>null</code>",C=D(),T=y("li"),T.innerHTML="&quot;[1,2,3]&quot; is converted to the json <code>[1,2,3]</code>",O=D(),M=y("li"),A=Y(E),L=Y(" is converted to the json "),N=y("code"),N.textContent='{"a":1,"b":2}',q=D(),R=y("li"),R.textContent="numeric strings are converted to json number",F=D(),V=y("li"),V.textContent="double quoted strings are left as they are (aka. without normalizations)",j=D(),W=y("li"),W.textContent="any other string (empty string too) is double quoted",Q=Y(`
2023-05-14 03:10:14 +08:00
Alternatively, if you want to avoid the string value normalizations, you can wrap your
2023-05-14 03:23:19 +08:00
data inside an object, eg.`),X=y("code"),X.textContent='{"data": anything}',m(i,"class","content"),m(t,"class","alert alert-warning m-b-0 m-t-10"),m(e,"class","block")},m(x,se){S(x,e,se),v(e,t),v(t,i),v(i,s),v(i,l),v(i,o),v(i,r),v(i,a),v(i,u),v(i,f),v(i,d),v(i,p),v(i,h),v(h,g),v(h,_),v(h,b),v(h,k),v(h,$),v(h,C),v(h,T),v(h,O),v(h,M),v(M,A),v(M,L),v(M,N),v(h,q),v(h,R),v(h,F),v(h,V),v(h,j),v(h,W),v(i,Q),v(i,X),re=!0},i(x){re||(x&&et(()=>{re&&(Z||(Z=Ve(e,rt,{duration:150},!0)),Z.run(1))}),re=!0)},o(x){x&&(Z||(Z=Ve(e,rt,{duration:150},!1)),Z.run(0)),re=!1},d(x){x&&w(e),x&&Z&&Z.end()}}}function DC(n){let e,t,i,s,l,o,r;function a(p,h){return p[2]?OC:EC}let u=a(n),f=u(n),d=n[2]&&$d();return{c(){e=y("button"),t=y("strong"),t.textContent="String value normalizations",i=D(),f.c(),s=D(),d&&d.c(),l=Se(),m(t,"class","txt"),m(e,"type","button"),m(e,"class","inline-flex txt-sm flex-gap-5 link-hint")},m(p,h){S(p,e,h),v(e,t),v(e,i),f.m(e,null),S(p,s,h),d&&d.m(p,h),S(p,l,h),o||(r=J(e,"click",n[4]),o=!0)},p(p,h){u!==(u=a(p))&&(f.d(1),f=u(p),f&&(f.c(),f.m(e,null))),p[2]?d?h&4&&I(d,1):(d=$d(),d.c(),I(d,1),d.m(l.parentNode,l)):d&&(ue(),P(d,1,1,()=>{d=null}),fe())},d(p){p&&w(e),f.d(),p&&w(s),d&&d.d(p),p&&w(l),o=!1,r()}}}function AC(n){let e,t,i;const s=[{key:n[1]},n[3]];function l(r){n[5](r)}let o={$$slots:{options:[DC]},$$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 pi({props:o}),ne.push(()=>he(e,"field",l)),e.$on("rename",n[6]),e.$on("remove",n[7]),e.$on("drop",n[8]),e.$on("dragstart",n[9]),e.$on("dragenter",n[10]),e.$on("dragleave",n[11]),{c(){B(e.$$.fragment)},m(r,a){z(e,r,a),i=!0},p(r,[a]){const u=a&10?Et(s,[a&2&&{key:r[1]},a&8&&Qt(r[3])]):{};a&4100&&(u.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,u.field=r[0],ye(()=>t=!1)),e.$set(u)},i(r){i||(I(e.$$.fragment,r),i=!0)},o(r){P(e.$$.fragment,r),i=!1},d(r){H(e,r)}}}function IC(n,e,t){const i=["field","key"];let s=tt(e,i),{field:l}=e,{key:o=""}=e,r=!1;const a=()=>{t(2,r=!r)};function u(b){l=b,t(0,l)}function f(b){me.call(this,n,b)}function d(b){me.call(this,n,b)}function p(b){me.call(this,n,b)}function h(b){me.call(this,n,b)}function g(b){me.call(this,n,b)}function _(b){me.call(this,n,b)}return n.$$set=b=>{e=je(je({},e),Gt(b)),t(3,s=tt(e,i)),"field"in b&&t(0,l=b.field),"key"in b&&t(1,o=b.key)},[l,o,r,s,a,u,f,d,p,h,g,_]}class LC extends be{constructor(e){super(),ge(this,e,IC,AC,_e,{field:0,key:1})}}function PC(n){let e,t=(n[0].ext||"N/A")+"",i,s,l,o=n[0].mimeType+"",r;return{c(){e=y("span"),i=Y(t),s=D(),l=y("small"),r=Y(o),m(e,"class","txt"),m(l,"class","txt-hint")},m(a,u){S(a,e,u),v(e,i),S(a,s,u),S(a,l,u),v(l,r)},p(a,[u]){u&1&&t!==(t=(a[0].ext||"N/A")+"")&&le(i,t),u&1&&o!==(o=a[0].mimeType+"")&&le(r,o)},i:te,o:te,d(a){a&&w(e),a&&w(s),a&&w(l)}}}function FC(n,e,t){let{item:i={}}=e;return n.$$set=s=>{"item"in s&&t(0,i=s.item)},[i]}class Td extends be{constructor(e){super(),ge(this,e,FC,PC,_e,{item:0})}}const NC=[{ext:".xpm",mimeType:"image/x-xpixmap"},{ext:".7z",mimeType:"application/x-7z-compressed"},{ext:".zip",mimeType:"application/zip"},{ext:".xlsx",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"},{ext:".docx",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},{ext:".pptx",mimeType:"application/vnd.openxmlformats-officedocument.presentationml.presentation"},{ext:".epub",mimeType:"application/epub+zip"},{ext:".jar",mimeType:"application/jar"},{ext:".odt",mimeType:"application/vnd.oasis.opendocument.text"},{ext:".ott",mimeType:"application/vnd.oasis.opendocument.text-template"},{ext:".ods",mimeType:"application/vnd.oasis.opendocument.spreadsheet"},{ext:".ots",mimeType:"application/vnd.oasis.opendocument.spreadsheet-template"},{ext:".odp",mimeType:"application/vnd.oasis.opendocument.presentation"},{ext:".otp",mimeType:"application/vnd.oasis.opendocument.presentation-template"},{ext:".odg",mimeType:"application/vnd.oasis.opendocument.graphics"},{ext:".otg",mimeType:"application/vnd.oasis.opendocument.graphics-template"},{ext:".odf",mimeType:"application/vnd.oasis
Leave empty for no restriction.`,position:"top"})),$=!0)},p(M,E){(!k||E&67108864&&l!==(l=M[26]))&&m(e,"for",l);const A={};E&67108864&&(A.id=M[26]),E&8&&(A.items=M[3]),!a&&E&1&&(a=!0,A.keyOfSelected=M[0].options.mimeTypes,ye(()=>a=!1)),r.$set(A);const L={};E&268435457&&(L.$$scope={dirty:E,ctx:M}),b.$set(L)},i(M){k||(I(r.$$.fragment,M),I(b.$$.fragment,M),k=!0)},o(M){P(r.$$.fragment,M),P(b.$$.fragment,M),k=!1},d(M){M&&w(e),M&&w(o),H(r,M),M&&w(u),M&&w(f),H(b),$=!1,C()}}}function zC(n){let e;return{c(){e=y("ul"),e.innerHTML=`<li><strong>WxH</strong>
2023-05-14 03:10:14 +08:00
(eg. 100x50) - crop to WxH viewbox (from center)</li>
<li><strong>WxHt</strong>
(eg. 100x50t) - crop to WxH viewbox (from top)</li>
<li><strong>WxHb</strong>
(eg. 100x50b) - crop to WxH viewbox (from bottom)</li>
<li><strong>WxHf</strong>
(eg. 100x50f) - fit inside a WxH viewbox (without cropping)</li>
<li><strong>0xH</strong>
(eg. 0x50) - resize to H height preserving the aspect ratio</li>
<li><strong>Wx0</strong>
2023-05-14 03:23:19 +08:00
(eg. 100x0) - resize to W width preserving the aspect ratio</li>`,m(e,"class","m-0")},m(t,i){S(t,e,i)},p:te,d(t){t&&w(e)}}}function HC(n){let e,t,i,s,l,o,r,a,u,f,d,p,h,g,_,b,k,$,C,T,O;function M(A){n[13](A)}let E={id:n[26],placeholder:"eg. 50x50, 480x720"};return n[0].options.thumbs!==void 0&&(E.value=n[0].options.thumbs),r=new zs({props:E}),ne.push(()=>he(r,"value",M)),$=new Jn({props:{class:"dropdown dropdown-sm dropdown-center dropdown-nowrap p-r-10",$$slots:{default:[zC]},$$scope:{ctx:n}}}),{c(){e=y("label"),t=y("span"),t.textContent="Thumb sizes",i=D(),s=y("i"),o=D(),B(r.$$.fragment),u=D(),f=y("div"),d=y("span"),d.textContent="Use comma as separator.",p=D(),h=y("button"),g=y("span"),g.textContent="Supported formats",_=D(),b=y("i"),k=D(),B($.$$.fragment),m(t,"class","txt"),m(s,"class","ri-information-line link-hint"),m(e,"for",l=n[26]),m(d,"class","txt"),m(g,"class","txt link-primary"),m(b,"class","ri-arrow-drop-down-fill"),m(h,"type","button"),m(h,"class","inline-flex flex-gap-0"),m(f,"class","help-block")},m(A,L){S(A,e,L),v(e,t),v(e,i),v(e,s),S(A,o,L),z(r,A,L),S(A,u,L),S(A,f,L),v(f,d),v(f,p),v(f,h),v(h,g),v(h,_),v(h,b),v(h,k),z($,h,null),C=!0,T||(O=Oe(Be.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(A,L){(!C||L&67108864&&l!==(l=A[26]))&&m(e,"for",l);const N={};L&67108864&&(N.id=A[26]),!a&&L&1&&(a=!0,N.value=A[0].options.thumbs,ye(()=>a=!1)),r.$set(N);const q={};L&268435456&&(q.$$scope={dirty:L,ctx:A}),$.$set(q)},i(A){C||(I(r.$$.fragment,A),I($.$$.fragment,A),C=!0)},o(A){P(r.$$.fragment,A),P($.$$.fragment,A),C=!1},d(A){A&&w(e),A&&w(o),H(r,A),A&&w(u),A&&w(f),H($),T=!1,O()}}}function BC(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=y("label"),t=Y("Max file size"),s=D(),l=y("input"),r=D(),a=y("div"),a.textContent="Must be in bytes.",m(e,"for",i=n[26]),m(l,"type","number"),m(l,"id",o=n[26]),m(l,"step","1"),m(l,"min","0"),m(a,"class","help-block")},m(d,p){S(d,e,p),v(e,t),S(d,s,p),S(d,l,p),ae(l,n[0].options.maxSize),S(d,r,p),S(d,a,p),u||(f=J(l,"input",n[14]),u=!0)},p(d,p){p&67108864&&i!==(i=d[26])&&m(e,"for",i),p&67108864&&o!==(o=d[26])&&m(l,"id",o),p&1&&mt(l.value)!==d[0].options.maxSize&&ae(l,d[0].options.maxSize)},d(d){d&&w(e),d&&w(s),d&&w(l),d&&w(r),d&&w(a),u=!1,f()}}}function Cd(n){let e,t,i;return t=new pe({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSelect",$$slots:{default:[UC,({uniqueId:s})=>({26:s}),({uniqueId:s})=>s?67108864:0]},$$scope:{ctx:n}}}),{c(){e=y("div"),B(t.$$.fragment),m(e,"class","col-sm-3")},m(s,l){S(s,e,l),z(t,e,null),i=!0},p(s,l){const o={};l&2&&(o.name="schema."+s[1]+".options.maxSelect"),l&335544321&&(o.$$scope={dirty:l,ctx:s}),t.$set(o)},i(s){i||(I(t.$$.fragment,s),i=!0)},o(s){P(t.$$.fragment,s),i=!1},d(s){s&&w(e),H(t)}}}function UC(n){let e,t,i,s,l,o,r,a;return{c(){e=y("label"),t=Y("Max select"),s=D(),l=y("input"),m(e,"for",i=n[26]),m(l,"id",o=n[26]),m(l,"type","number"),m(l,"step","1"),m(l,"min","2"),l.required=!0},m(u,f){S(u,e,f),v(e,t),S(u,s,f),S(u,l,f),ae(l,n[0].options.maxSelect),r||(a=J(l,"input",n[15]),r=!0)},p(u,f){f&67108864&&i!==(i=u[26])&&m(e,"for",i),f&67108864&&o!==(o=u[26])&&m(l,"id",o),f&1&&mt(l.value)!==u[0].options.maxSelect&&ae(l,u[0].options.maxSelect)},d(u){u&&w(e),u&&w(s),u&&w(l),r=!1,a()}}}function WC(n){let e,t,i,s,l,o,r,a,u,f,d,p,h;i=new pe({props:{class:"form-field",name:"schema."+n[1]+".options.mimeTypes",$$slots:{default:[VC,({uniqueId:_})=>({26:_}),({uniqueId:_})=>_?67108864:0]},$$scope:{ctx:n}}}),o=new pe({props:{class:"form-field",name:"schema."+n[1]+".options.thumbs",$$slots:{default:[HC,({uniqueId:_})=>({26:_}),({uniqueId:_})=>_?67108864:0]},$$scope:{ctx:n}}}),f=new pe({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSize",$$slots:{default:[BC,({uniqueId:_})=>({26:_}),({uniqueId:_})=>_?67108864:0]},$$scope:{ctx:n}}});let g=!n[2]&&Cd(n);return{c(){e=y("div"),t=y("div"),B(i.$$.fragment),s=D(),l=y("div"),B(o.$$.fragment),a=D(),u=y("div"),B(f.$$.
<span class="txt">New collection</span>`,m(i,"type","button"),m(i,"class","btn btn-transparent btn-block btn-sm")},m(o,r){S(o,e,r),S(o,t,r),S(o,i,r),s||(l=J(i,"click",n[17]),s=!0)},p:te,d(o){o&&w(e),o&&w(t),o&&w(i),s=!1,l()}}}function QC(n){let e,t,i;function s(o){n[18](o)}let l={id:n[33],searchable:n[3].length>5,selectPlaceholder:"Select collection *",noOptionsText:"No collections found",selectionKey:"id",items:n[3],readonly:!n[34]||n[0].id,$$slots:{afterOptions:[XC]},$$scope:{ctx:n}};return n[0].options.collectionId!==void 0&&(l.keyOfSelected=n[0].options.collectionId),e=new Bi({props:l}),ne.push(()=>he(e,"keyOfSelected",s)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};r[1]&4&&(a.id=o[33]),r[0]&8&&(a.searchable=o[3].length>5),r[0]&8&&(a.items=o[3]),r[0]&1|r[1]&8&&(a.readonly=!o[34]||o[0].id),r[0]&16|r[1]&16&&(a.$$scope={dirty:r,ctx:o}),!t&&r[0]&1&&(t=!0,a.keyOfSelected=o[0].options.collectionId,ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function xC(n){let e,t,i;function s(o){n[19](o)}let l={id:n[33],items:n[8],readonly:!n[34]};return n[2]!==void 0&&(l.keyOfSelected=n[2]),e=new Bi({props:l}),ne.push(()=>he(e,"keyOfSelected",s)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};r[1]&4&&(a.id=o[33]),r[1]&8&&(a.readonly=!o[34]),!t&&r[0]&4&&(t=!0,a.keyOfSelected=o[2],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function e4(n){let e,t,i,s,l,o,r,a,u,f;return i=new pe({props:{class:"form-field required "+(n[34]?"":"readonly"),inlineError:!0,name:"schema."+n[1]+".options.collectionId",$$slots:{default:[QC,({uniqueId:d})=>({33:d}),({uniqueId:d})=>[0,d?4:0]]},$$scope:{ctx:n}}}),r=new pe({props:{class:"form-field form-field-single-multiple-select "+(n[34]?"":"readonly"),inlineError:!0,$$slots:{default:[xC,({uniqueId:d})=>({33:d}),({uniqueId:d})=>[0,d?4:0]]},$$scope:{ctx:n}}}),{c(){e=y("div"),t=D(),B(i.$$.fragment),s=D(),l=y("div"),o=D(),B(r.$$.fragment),a=D(),u=y("div"),m(e,"class","separator"),m(l,"class","separator"),m(u,"class","separator")},m(d,p){S(d,e,p),S(d,t,p),z(i,d,p),S(d,s,p),S(d,l,p),S(d,o,p),z(r,d,p),S(d,a,p),S(d,u,p),f=!0},p(d,p){const h={};p[1]&8&&(h.class="form-field required "+(d[34]?"":"readonly")),p[0]&2&&(h.name="schema."+d[1]+".options.collectionId"),p[0]&25|p[1]&28&&(h.$$scope={dirty:p,ctx:d}),i.$set(h);const g={};p[1]&8&&(g.class="form-field form-field-single-multiple-select "+(d[34]?"":"readonly")),p[0]&4|p[1]&28&&(g.$$scope={dirty:p,ctx:d}),r.$set(g)},i(d){f||(I(i.$$.fragment,d),I(r.$$.fragment,d),f=!0)},o(d){P(i.$$.fragment,d),P(r.$$.fragment,d),f=!1},d(d){d&&w(e),d&&w(t),H(i,d),d&&w(s),d&&w(l),d&&w(o),H(r,d),d&&w(a),d&&w(u)}}}function Md(n){let e,t,i,s,l,o;return t=new pe({props:{class:"form-field",name:"schema."+n[1]+".options.minSelect",$$slots:{default:[t4,({uniqueId:r})=>({33:r}),({uniqueId:r})=>[0,r?4:0]]},$$scope:{ctx:n}}}),l=new pe({props:{class:"form-field",name:"schema."+n[1]+".options.maxSelect",$$slots:{default:[n4,({uniqueId:r})=>({33:r}),({uniqueId:r})=>[0,r?4:0]]},$$scope:{ctx:n}}}),{c(){e=y("div"),B(t.$$.fragment),i=D(),s=y("div"),B(l.$$.fragment),m(e,"class","col-sm-6"),m(s,"class","col-sm-6")},m(r,a){S(r,e,a),z(t,e,null),S(r,i,a),S(r,s,a),z(l,s,null),o=!0},p(r,a){const u={};a[0]&2&&(u.name="schema."+r[1]+".options.minSelect"),a[0]&1|a[1]&20&&(u.$$scope={dirty:a,ctx:r}),t.$set(u);const f={};a[0]&2&&(f.name="schema."+r[1]+".options.maxSelect"),a[0]&1|a[1]&20&&(f.$$scope={dirty:a,ctx:r}),l.$set(f)},i(r){o||(I(t.$$.fragment,r),I(l.$$.fragment,r),o=!0)},o(r){P(t.$$.fragment,r),P(l.$$.fragment,r),o=!1},d(r){r&&w(e),H(t),r&&w(i),r&&w(s),H(l)}}}function t4(n){let e,t,i,s,l,o,r,a;return{c(){e=y("label"),t=Y("Min select"),s=D(),l=y("input"),m(e,"for",i=n[33]),m(l,"type","number"),m(l,"id",o=n[33]),m(l,"step","1"),m(l,"min","1"),m(l,"placeholder","No min limit")},m(u,f){S(u,e,f),v(e,t),S(u,s,f),S(u,l,f),ae(l,n[0].options.minSelect),r||(a=J(l,"input",n[13]),r=!0)},p(u,f){f[1]&4&&i!==(i=u[33])&&m(e,"for",i),f[1]&4&&o!==(o=u[33]
2023-05-14 03:10:14 +08:00
`),t=y("code"),t.textContent="username",i=Y(` ,
`),s=y("code"),s.textContent="email",l=Y(` ,
`),o=y("code"),o.textContent="emailVisibility",r=Y(` ,
2023-05-14 03:23:19 +08:00
`),a=y("code"),a.textContent="verified",m(t,"class","txt-sm"),m(s,"class","txt-sm"),m(o,"class","txt-sm"),m(a,"class","txt-sm")},m(u,f){S(u,e,f),S(u,t,f),S(u,i,f),S(u,s,f),S(u,l,f),S(u,o,f),S(u,r,f),S(u,a,f)},d(u){u&&w(e),u&&w(t),u&&w(i),u&&w(s),u&&w(l),u&&w(o),u&&w(r),u&&w(a)}}}function Dd(n,e){let t,i,s,l,o;function r(h){e[7](h,e[17],e[18],e[19])}function a(){return e[8](e[19])}function u(...h){return e[10](e[19],...h)}function f(...h){return e[11](e[19],...h)}var d=e[1][e[17].type];function p(h){let g={key:h[4](h[17])};return h[17]!==void 0&&(g.field=h[17]),{props:g}}return d&&(i=Rt(d,p(e)),ne.push(()=>he(i,"field",r)),i.$on("remove",a),i.$on("rename",e[9]),i.$on("dragstart",u),i.$on("drop",f)),{key:n,first:null,c(){t=Se(),i&&B(i.$$.fragment),l=Se(),this.first=t},m(h,g){S(h,t,g),i&&z(i,h,g),S(h,l,g),o=!0},p(h,g){e=h;const _={};if(g&1&&(_.key=e[4](e[17])),!s&&g&1&&(s=!0,_.field=e[17],ye(()=>s=!1)),g&1&&d!==(d=e[1][e[17].type])){if(i){ue();const b=i;P(b.$$.fragment,1,0,()=>{H(b,1)}),fe()}d?(i=Rt(d,p(e)),ne.push(()=>he(i,"field",r)),i.$on("remove",a),i.$on("rename",e[9]),i.$on("dragstart",u),i.$on("drop",f),B(i.$$.fragment),I(i.$$.fragment,1),z(i,l.parentNode,l)):i=null}else d&&i.$set(_)},i(h){o||(i&&I(i.$$.fragment,h),o=!0)},o(h){i&&P(i.$$.fragment,h),o=!1},d(h){h&&w(t),h&&w(l),i&&H(i,h)}}}function u4(n){let e,t,i,s,l,o,r,a,u,f,d,p,h=[],g=new Map,_,b,k,$,C,T,O,M,E=n[0].$isAuth&&Od(),A=n[0].schema;const L=R=>R[17];for(let R=0;R<A.length;R+=1){let F=Ed(n,A,R),V=L(F);g.set(V,h[R]=Dd(V,F))}b=new eT({props:{class:"btn btn-block btn-outline"}}),b.$on("select",n[12]);function N(R){n[13](R)}let q={};return n[0]!==void 0&&(q.collection=n[0]),T=new G$({props:q}),ne.push(()=>he(T,"collection",N)),{c(){e=y("div"),t=y("p"),i=Y(`System fields:
2023-05-14 03:10:14 +08:00
`),s=y("code"),s.textContent="id",l=Y(` ,
`),o=y("code"),o.textContent="created",r=Y(` ,
2023-05-14 03:23:19 +08:00
`),a=y("code"),a.textContent="updated",u=D(),E&&E.c(),f=Y(`
.`),d=D(),p=y("div");for(let R=0;R<h.length;R+=1)h[R].c();_=D(),B(b.$$.fragment),k=D(),$=y("hr"),C=D(),B(T.$$.fragment),m(s,"class","txt-sm"),m(o,"class","txt-sm"),m(a,"class","txt-sm"),m(t,"class","txt-sm"),m(e,"class","block m-b-25"),m(p,"class","schema-fields")},m(R,F){S(R,e,F),v(e,t),v(t,i),v(t,s),v(t,l),v(t,o),v(t,r),v(t,a),v(t,u),E&&E.m(t,null),v(t,f),S(R,d,F),S(R,p,F);for(let V=0;V<h.length;V+=1)h[V]&&h[V].m(p,null);S(R,_,F),z(b,R,F),S(R,k,F),S(R,$,F),S(R,C,F),z(T,R,F),M=!0},p(R,[F]){R[0].$isAuth?E||(E=Od(),E.c(),E.m(t,f)):E&&(E.d(1),E=null),F&119&&(A=R[0].schema,ue(),h=yt(h,F,L,1,R,A,g,p,Kt,Dd,null,Ed),fe());const V={};!O&&F&1&&(O=!0,V.collection=R[0],ye(()=>O=!1)),T.$set(V)},i(R){if(!M){for(let F=0;F<A.length;F+=1)I(h[F]);I(b.$$.fragment,R),I(T.$$.fragment,R),M=!0}},o(R){for(let F=0;F<h.length;F+=1)P(h[F]);P(b.$$.fragment,R),P(T.$$.fragment,R),M=!1},d(R){R&&w(e),E&&E.d(),R&&w(d),R&&w(p);for(let F=0;F<h.length;F+=1)h[F].d();R&&w(_),H(b,R),R&&w(k),R&&w($),R&&w(C),H(T,R)}}}function f4(n,e){n&&(n.dataTransfer.effectAllowed="move",n.dataTransfer.dropEffect="move",n.dataTransfer.setData("text/plain",e))}function c4(n,e,t){let i,{collection:s=new kn}=e;const l={text:vT,number:TT,bool:ET,email:y1,url:qT,editor:zT,date:iC,select:MC,json:LC,file:GC,relation:a4};function o(T){s.schema[T]&&(s.schema.splice(T,1),t(0,s))}function r(T="text"){const O=new wn({name:a(),type:T});O.onMountSelect=!0,s.schema.push(O),t(0,s)}function a(T="field"){let O="";for(;u(T+O);)++O;return T+O}function u(T){return!!s.schema.find(O=>O.name===T)}function f(T){return i.findIndex(O=>O===T)}function d(T,O){var M;!((M=s==null?void 0:s.schema)!=null&&M.length)||T===O||!O||t(0,s.indexes=s.indexes.map(E=>U.replaceIndexColumn(E,T,O)),s)}function p(T,O){if(!T)return;T.dataTransfer.dropEffect="move";const M=parseInt(T.dataTransfer.getData("text/plain")),E=s.schema;M<O?(E.splice(O+1,0,E[M]),E.splice(M,1)):(E.splice(O,0,E[M]),E.splice(M+1,1)),t(0,s.schema=E,s),tn({})}function h(T,O,M,E){M[E]=T,t(0,s)}const g=T=>o(T),_=T=>d(T.detail.oldName,T.detail.newName),b=(T,O)=>f4(O.detail,T),k=(T,O)=>p(O.detail,T),$=T=>r(T.detail);function C(T){s=T,t(0,s)}return n.$$set=T=>{"collection"in T&&t(0,s=T.collection)},n.$$.update=()=>{n.$$.dirty&1&&typeof s.schema>"u"&&(t(0,s=s||new kn),t(0,s.schema=[],s)),n.$$.dirty&1&&(i=s.schema.filter(T=>!T.toDelete)||[])},[s,l,o,r,f,d,p,h,g,_,b,k,$,C]}class d4 extends be{constructor(e){super(),ge(this,e,c4,u4,_e,{collection:0})}}const p4=n=>({isAdminOnly:n&512}),Ad=n=>({isAdminOnly:n[9]}),m4=n=>({isAdminOnly:n&512}),Id=n=>({isAdminOnly:n[9]}),h4=n=>({isAdminOnly:n&512}),Ld=n=>({isAdminOnly:n[9]});function _4(n){let e,t;return e=new pe({props:{class:"form-field rule-field "+(n[4]?"requied":"")+" "+(n[9]?"disabled":""),name:n[3],$$slots:{default:[b4,({uniqueId:i})=>({18:i}),({uniqueId:i})=>i?262144:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){z(e,i,s),t=!0},p(i,s){const l={};s&528&&(l.class="form-field rule-field "+(i[4]?"requied":"")+" "+(i[9]?"disabled":"")),s&8&&(l.name=i[3]),s&295655&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function g4(n){let e;return{c(){e=y("div"),e.innerHTML='<span class="loader"></span>',m(e,"class","txt-center")},m(t,i){S(t,e,i)},p:te,i:te,o:te,d(t){t&&w(e)}}}function Pd(n){let e,t,i;return{c(){e=y("button"),e.innerHTML=`<i class="ri-lock-line"></i>
<span class="txt">Set Admins only</span>`,m(e,"type","button"),m(e,"class","btn btn-sm btn-transparent btn-hint lock-toggle svelte-1akuazq")},m(s,l){S(s,e,l),t||(i=J(e,"click",n[11]),t=!0)},p:te,d(s){s&&w(e),t=!1,i()}}}function Fd(n){let e,t,i,s,l;return{c(){e=y("button"),e.innerHTML=`<small class="txt svelte-1akuazq">Unlock and set custom rule</small>
<div class="icon svelte-1akuazq"><i class="ri-lock-unlock-line svelte-1akuazq"></i></div>`,m(e,"type","button"),m(e,"class","unlock-overlay svelte-1akuazq"),m(e,"aria-label","Unlock and set custom rule")},m(o,r){S(o,e,r),i=!0,s||(l=J(e,"click",n[10]),s=!0)},p:te,i(o){i||(o&&et(()=>{i&&(t||(t=Ve(e,Jt,{duration:150,start:.98},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=Ve(e,Jt,{duration:150,start:.98},!1)),t.run(0)),i=!1},d(o){o&&w(e),o&&t&&t.end(),s=!1,l()}}}function b4(n){let e,t,i,s,l,o,r=n[9]?"- Admins only":"",a,u,f,d,p,h,g,_,b,k,$;const C=n[12].beforeLabel,T=kt(C,n,n[15],Ld),O=n[12].afterLabel,M=kt(O,n,n[15],Id);let E=!n[9]&&Pd(n);function A(V){n[14](V)}var L=n[7];function N(V){let j={id:V[18],baseCollection:V[1],disabled:V[9],placeholder:V[9]?"":V[5]};return V[0]!==void 0&&(j.value=V[0]),{props:j}}L&&(h=Rt(L,N(n)),n[13](h),ne.push(()=>he(h,"value",A)));let q=n[9]&&Fd(n);const R=n[12].default,F=kt(R,n,n[15],Ad);return{c(){e=y("div"),t=y("label"),T&&T.c(),i=D(),s=y("span"),l=Y(n[2]),o=D(),a=Y(r),u=D(),M&&M.c(),f=D(),E&&E.c(),p=D(),h&&B(h.$$.fragment),_=D(),q&&q.c(),b=D(),k=y("div"),F&&F.c(),m(s,"class","txt"),ee(s,"txt-hint",n[9]),m(t,"for",d=n[18]),m(e,"class","input-wrapper svelte-1akuazq"),m(k,"class","help-block")},m(V,j){S(V,e,j),v(e,t),T&&T.m(t,null),v(t,i),v(t,s),v(s,l),v(s,o),v(s,a),v(t,u),M&&M.m(t,null),v(t,f),E&&E.m(t,null),v(e,p),h&&z(h,e,null),v(e,_),q&&q.m(e,null),S(V,b,j),S(V,k,j),F&&F.m(k,null),$=!0},p(V,j){T&&T.p&&(!$||j&33280)&&St(T,C,V,V[15],$?wt(C,V[15],j,h4):$t(V[15]),Ld),(!$||j&4)&&le(l,V[2]),(!$||j&512)&&r!==(r=V[9]?"- Admins only":"")&&le(a,r),(!$||j&512)&&ee(s,"txt-hint",V[9]),M&&M.p&&(!$||j&33280)&&St(M,O,V,V[15],$?wt(O,V[15],j,m4):$t(V[15]),Id),V[9]?E&&(E.d(1),E=null):E?E.p(V,j):(E=Pd(V),E.c(),E.m(t,null)),(!$||j&262144&&d!==(d=V[18]))&&m(t,"for",d);const W={};if(j&262144&&(W.id=V[18]),j&2&&(W.baseCollection=V[1]),j&512&&(W.disabled=V[9]),j&544&&(W.placeholder=V[9]?"":V[5]),!g&&j&1&&(g=!0,W.value=V[0],ye(()=>g=!1)),j&128&&L!==(L=V[7])){if(h){ue();const Q=h;P(Q.$$.fragment,1,0,()=>{H(Q,1)}),fe()}L?(h=Rt(L,N(V)),V[13](h),ne.push(()=>he(h,"value",A)),B(h.$$.fragment),I(h.$$.fragment,1),z(h,e,_)):h=null}else L&&h.$set(W);V[9]?q?(q.p(V,j),j&512&&I(q,1)):(q=Fd(V),q.c(),I(q,1),q.m(e,null)):q&&(ue(),P(q,1,1,()=>{q=null}),fe()),F&&F.p&&(!$||j&33280)&&St(F,R,V,V[15],$?wt(R,V[15],j,p4):$t(V[15]),Ad)},i(V){$||(I(T,V),I(M,V),h&&I(h.$$.fragment,V),I(q),I(F,V),$=!0)},o(V){P(T,V),P(M,V),h&&P(h.$$.fragment,V),P(q),P(F,V),$=!1},d(V){V&&w(e),T&&T.d(V),M&&M.d(V),E&&E.d(),n[13](null),h&&H(h),q&&q.d(),V&&w(b),V&&w(k),F&&F.d(V)}}}function v4(n){let e,t,i,s;const l=[g4,_4],o=[];function r(a,u){return a[8]?0:1}return e=r(n),t=o[e]=l[e](n),{c(){t.c(),i=Se()},m(a,u){o[e].m(a,u),S(a,i,u),s=!0},p(a,[u]){let f=e;e=r(a),e===f?o[e].p(a,u):(ue(),P(o[f],1,1,()=>{o[f]=null}),fe(),t=o[e],t?t.p(a,u):(t=o[e]=l[e](a),t.c()),I(t,1),t.m(i.parentNode,i))},i(a){s||(I(t),s=!0)},o(a){P(t),s=!1},d(a){o[e].d(a),a&&w(i)}}}let Nd;function y4(n,e,t){let i,{$$slots:s={},$$scope:l}=e,{collection:o=null}=e,{rule:r=null}=e,{label:a="Rule"}=e,{formKey:u="rule"}=e,{required:f=!1}=e,{placeholder:d="Leave empty to grant everyone access..."}=e,p=null,h=null,g=Nd,_=!1;b();async function b(){g||_||(t(8,_=!0),t(7,g=(await ut(()=>import("./FilterAutocompleteInput-9787ccc2.js"),["./FilterAutocompleteInput-9787ccc2.js","./index-03b6b7de.js"],import.meta.url)).default),Nd=g,t(8,_=!1))}async function k(){t(0,r=h||""),await cn(),p==null||p.focus()}async function $(){h=r,t(0,r=null)}function C(O){ne[O?"unshift":"push"](()=>{p=O,t(6,p)})}function T(O){r=O,t(0,r)}return n.$$set=O=>{"collection"in O&&t(1,o=O.collection),"rule"in O&&t(0,r=O.rule),"label"in O&&t(2,a=O.label),"formKey"in O&&t(3,u=O.formKey),"required"in O&&t(4,f=O.required),"placeholder"in O&&t(5,d=O.placeholder),"$$scope"in O&&t(15,l=O.$$scope)},n.$$.update=()=>{n.$$.dirty&1&&t(9,i=r===null)},[r,o,a,u,f,d,p,g,_,i,k,$,s,C,T,l]}class Os extends be{constructor(e){super(),ge(this,e,y4,v4,_e,{collection:1,rule:0,label:2,formKey:3,required:4,placeholder:5})}}function Rd(n,e,t){const i=n.s
2023-05-14 03:10:14 +08:00
<code>@request.query.*</code>
<code>@request.data.*</code>
2023-05-14 03:23:19 +08:00
<code>@request.auth.*</code>`,h=D(),g=y("hr"),_=D(),b=y("p"),b.innerHTML="You could also add constraints and query other collections using the <em>@collection</em> filter:",k=D(),$=y("div"),$.innerHTML="<code>@collection.ANY_COLLECTION_NAME.*</code>",C=D(),T=y("hr"),O=D(),M=y("p"),M.innerHTML=`Example rule:
2023-05-14 03:10:14 +08:00
<br/>
2023-05-14 03:23:19 +08:00
<code>@request.auth.id != &quot;&quot; &amp;&amp; created &gt; &quot;2022-01-01 00:00:00&quot;</code>`,m(s,"class","m-b-0"),m(o,"class","inline-flex flex-gap-5"),m(a,"class","m-t-10 m-b-5"),m(f,"class","m-b-0"),m(p,"class","inline-flex flex-gap-5"),m(g,"class","m-t-10 m-b-5"),m(b,"class","m-b-0"),m($,"class","inline-flex flex-gap-5"),m(T,"class","m-t-10 m-b-5"),m(i,"class","content"),m(t,"class","alert alert-warning m-0")},m(q,R){S(q,e,R),v(e,t),v(t,i),v(i,s),v(i,l),v(i,o);for(let F=0;F<N.length;F+=1)N[F]&&N[F].m(o,null);v(i,r),v(i,a),v(i,u),v(i,f),v(i,d),v(i,p),v(i,h),v(i,g),v(i,_),v(i,b),v(i,k),v(i,$),v(i,C),v(i,T),v(i,O),v(i,M),A=!0},p(q,R){if(R&4){L=q[2];let F;for(F=0;F<L.length;F+=1){const V=Rd(q,L,F);N[F]?N[F].p(V,R):(N[F]=jd(V),N[F].c(),N[F].m(o,null))}for(;F<N.length;F+=1)N[F].d(1);N.length=L.length}},i(q){A||(q&&et(()=>{A&&(E||(E=Ve(e,rt,{duration:150},!0)),E.run(1))}),A=!0)},o(q){q&&(E||(E=Ve(e,rt,{duration:150},!1)),E.run(0)),A=!1},d(q){q&&w(e),pt(N,q),q&&E&&E.end()}}}function jd(n){let e,t=n[11]+"",i;return{c(){e=y("code"),i=Y(t)},m(s,l){S(s,e,l),v(e,i)},p(s,l){l&4&&t!==(t=s[11]+"")&&le(i,t)},d(s){s&&w(e)}}}function Vd(n){let e,t,i,s,l,o,r,a,u;function f(b){n[6](b)}let d={label:"Create rule",formKey:"createRule",collection:n[0],$$slots:{afterLabel:[k4,({isAdminOnly:b})=>({10:b}),({isAdminOnly:b})=>b?1024:0]},$$scope:{ctx:n}};n[0].createRule!==void 0&&(d.rule=n[0].createRule),e=new Os({props:d}),ne.push(()=>he(e,"rule",f));function p(b){n[7](b)}let h={label:"Update rule",formKey:"updateRule",collection:n[0]};n[0].updateRule!==void 0&&(h.rule=n[0].updateRule),s=new Os({props:h}),ne.push(()=>he(s,"rule",p));function g(b){n[8](b)}let _={label:"Delete rule",formKey:"deleteRule",collection:n[0]};return n[0].deleteRule!==void 0&&(_.rule=n[0].deleteRule),r=new Os({props:_}),ne.push(()=>he(r,"rule",g)),{c(){B(e.$$.fragment),i=D(),B(s.$$.fragment),o=D(),B(r.$$.fragment)},m(b,k){z(e,b,k),S(b,i,k),z(s,b,k),S(b,o,k),z(r,b,k),u=!0},p(b,k){const $={};k&1&&($.collection=b[0]),k&17408&&($.$$scope={dirty:k,ctx:b}),!t&&k&1&&(t=!0,$.rule=b[0].createRule,ye(()=>t=!1)),e.$set($);const C={};k&1&&(C.collection=b[0]),!l&&k&1&&(l=!0,C.rule=b[0].updateRule,ye(()=>l=!1)),s.$set(C);const T={};k&1&&(T.collection=b[0]),!a&&k&1&&(a=!0,T.rule=b[0].deleteRule,ye(()=>a=!1)),r.$set(T)},i(b){u||(I(e.$$.fragment,b),I(s.$$.fragment,b),I(r.$$.fragment,b),u=!0)},o(b){P(e.$$.fragment,b),P(s.$$.fragment,b),P(r.$$.fragment,b),u=!1},d(b){H(e,b),b&&w(i),H(s,b),b&&w(o),H(r,b)}}}function zd(n){let e,t,i;return{c(){e=y("i"),m(e,"class","ri-information-line link-hint")},m(s,l){S(s,e,l),t||(i=Oe(Be.call(null,e,{text:'The Create rule is executed after a "dry save" of the submitted data, giving you access to the main record fields as in every other rule.',position:"top"})),t=!0)},d(s){s&&w(e),t=!1,i()}}}function k4(n){let e,t=!n[10]&&zd();return{c(){t&&t.c(),e=Se()},m(i,s){t&&t.m(i,s),S(i,e,s)},p(i,s){i[10]?t&&(t.d(1),t=null):t||(t=zd(),t.c(),t.m(e.parentNode,e))},d(i){t&&t.d(i),i&&w(e)}}}function Hd(n){let e,t,i;function s(o){n[9](o)}let l={label:"Manage rule",formKey:"options.manageRule",placeholder:"",required:n[0].options.manageRule!==null,collection:n[0],$$slots:{default:[w4]},$$scope:{ctx:n}};return n[0].options.manageRule!==void 0&&(l.rule=n[0].options.manageRule),e=new Os({props:l}),ne.push(()=>he(e,"rule",s)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};r&1&&(a.required=o[0].options.manageRule!==null),r&1&&(a.collection=o[0]),r&16384&&(a.$$scope={dirty:r,ctx:o}),!t&&r&1&&(t=!0,a.rule=o[0].options.manageRule,ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function w4(n){let e,t,i;return{c(){e=y("p"),e.textContent=`This API rule gives admin-like permissions to allow fully managing the auth record(s), eg.
2023-05-14 03:10:14 +08:00
changing the password without requiring to enter the old one, directly updating the verified
2023-05-14 03:23:19 +08:00
state or email, etc.`,t=D(),i=y("p"),i.innerHTML="This rule is executed in addition to the <code>create</code> and <code>update</code> API rules."},m(s,l){S(s,e,l),S(s,t,l),S(s,i,l)},p:te,d(s){s&&w(e),s&&w(t),s&&w(i)}}}function S4(n){var R,F;let e,t,i,s,l,o=n[1]?"Hide available fields":"Show available fields",r,a,u,f,d,p,h,g,_,b,k,$,C,T,O=n[1]&&qd(n);function M(V){n[4](V)}let E={label:"List/Search rule",formKey:"listRule",collection:n[0]};n[0].listRule!==void 0&&(E.rule=n[0].listRule),f=new Os({props:E}),ne.push(()=>he(f,"rule",M));function A(V){n[5](V)}let L={label:"View rule",formKey:"viewRule",collection:n[0]};n[0].viewRule!==void 0&&(L.rule=n[0].viewRule),h=new Os({props:L}),ne.push(()=>he(h,"rule",A));let N=!((R=n[0])!=null&&R.$isView)&&Vd(n),q=((F=n[0])==null?void 0:F.$isAuth)&&Hd(n);return{c(){e=y("div"),t=y("div"),i=y("p"),i.innerHTML=`All rules follow the
2023-05-14 03:10:14 +08:00
<a href="https://pocketbase.io/docs/api-rules-and-filters/" target="_blank" rel="noopener noreferrer">PocketBase filter syntax and operators
2023-05-14 03:23:19 +08:00
</a>.`,s=D(),l=y("button"),r=Y(o),a=D(),O&&O.c(),u=D(),B(f.$$.fragment),p=D(),B(h.$$.fragment),_=D(),N&&N.c(),b=D(),q&&q.c(),k=Se(),m(l,"type","button"),m(l,"class","expand-handle txt-sm txt-bold txt-nowrap link-hint"),m(t,"class","flex txt-sm txt-hint m-b-5"),m(e,"class","block m-b-sm handle")},m(V,j){S(V,e,j),v(e,t),v(t,i),v(t,s),v(t,l),v(l,r),v(e,a),O&&O.m(e,null),S(V,u,j),z(f,V,j),S(V,p,j),z(h,V,j),S(V,_,j),N&&N.m(V,j),S(V,b,j),q&&q.m(V,j),S(V,k,j),$=!0,C||(T=J(l,"click",n[3]),C=!0)},p(V,[j]){var X,Z;(!$||j&2)&&o!==(o=V[1]?"Hide available fields":"Show available fields")&&le(r,o),V[1]?O?(O.p(V,j),j&2&&I(O,1)):(O=qd(V),O.c(),I(O,1),O.m(e,null)):O&&(ue(),P(O,1,1,()=>{O=null}),fe());const W={};j&1&&(W.collection=V[0]),!d&&j&1&&(d=!0,W.rule=V[0].listRule,ye(()=>d=!1)),f.$set(W);const Q={};j&1&&(Q.collection=V[0]),!g&&j&1&&(g=!0,Q.rule=V[0].viewRule,ye(()=>g=!1)),h.$set(Q),(X=V[0])!=null&&X.$isView?N&&(ue(),P(N,1,1,()=>{N=null}),fe()):N?(N.p(V,j),j&1&&I(N,1)):(N=Vd(V),N.c(),I(N,1),N.m(b.parentNode,b)),(Z=V[0])!=null&&Z.$isAuth?q?(q.p(V,j),j&1&&I(q,1)):(q=Hd(V),q.c(),I(q,1),q.m(k.parentNode,k)):q&&(ue(),P(q,1,1,()=>{q=null}),fe())},i(V){$||(I(O),I(f.$$.fragment,V),I(h.$$.fragment,V),I(N),I(q),$=!0)},o(V){P(O),P(f.$$.fragment,V),P(h.$$.fragment,V),P(N),P(q),$=!1},d(V){V&&w(e),O&&O.d(),V&&w(u),H(f,V),V&&w(p),H(h,V),V&&w(_),N&&N.d(V),V&&w(b),q&&q.d(V),V&&w(k),C=!1,T()}}}function $4(n,e,t){let i,{collection:s=new kn}=e,l=!1;const o=()=>t(1,l=!l);function r(h){n.$$.not_equal(s.listRule,h)&&(s.listRule=h,t(0,s))}function a(h){n.$$.not_equal(s.viewRule,h)&&(s.viewRule=h,t(0,s))}function u(h){n.$$.not_equal(s.createRule,h)&&(s.createRule=h,t(0,s))}function f(h){n.$$.not_equal(s.updateRule,h)&&(s.updateRule=h,t(0,s))}function d(h){n.$$.not_equal(s.deleteRule,h)&&(s.deleteRule=h,t(0,s))}function p(h){n.$$.not_equal(s.options.manageRule,h)&&(s.options.manageRule=h,t(0,s))}return n.$$set=h=>{"collection"in h&&t(0,s=h.collection)},n.$$.update=()=>{n.$$.dirty&1&&t(2,i=U.getAllCollectionIdentifiers(s))},[s,l,i,o,r,a,u,f,d,p]}class T4 extends be{constructor(e){super(),ge(this,e,$4,S4,_e,{collection:0})}}function Bd(n,e,t){const i=n.slice();return i[9]=e[t],i}function C4(n){let e,t,i,s;function l(a){n[5](a)}var o=n[1];function r(a){let u={id:a[8],placeholder:"eg. SELECT id, name from posts",language:"sql-select",minHeight:"150"};return a[0].options.query!==void 0&&(u.value=a[0].options.query),{props:u}}return o&&(e=Rt(o,r(n)),ne.push(()=>he(e,"value",l)),e.$on("change",n[6])),{c(){e&&B(e.$$.fragment),i=Se()},m(a,u){e&&z(e,a,u),S(a,i,u),s=!0},p(a,u){const f={};if(u&256&&(f.id=a[8]),!t&&u&1&&(t=!0,f.value=a[0].options.query,ye(()=>t=!1)),u&2&&o!==(o=a[1])){if(e){ue();const d=e;P(d.$$.fragment,1,0,()=>{H(d,1)}),fe()}o?(e=Rt(o,r(a)),ne.push(()=>he(e,"value",l)),e.$on("change",a[6]),B(e.$$.fragment),I(e.$$.fragment,1),z(e,i.parentNode,i)):e=null}else o&&e.$set(f)},i(a){s||(e&&I(e.$$.fragment,a),s=!0)},o(a){e&&P(e.$$.fragment,a),s=!1},d(a){a&&w(i),e&&H(e,a)}}}function M4(n){let e;return{c(){e=y("textarea"),e.disabled=!0,m(e,"rows","7"),m(e,"placeholder","Loading...")},m(t,i){S(t,e,i)},p:te,i:te,o:te,d(t){t&&w(e)}}}function Ud(n){let e,t,i=n[3],s=[];for(let l=0;l<i.length;l+=1)s[l]=Wd(Bd(n,i,l));return{c(){e=y("div"),t=y("div");for(let l=0;l<s.length;l+=1)s[l].c();m(t,"class","content"),m(e,"class","help-block help-block-error")},m(l,o){S(l,e,o),v(e,t);for(let r=0;r<s.length;r+=1)s[r]&&s[r].m(t,null)},p(l,o){if(o&8){i=l[3];let r;for(r=0;r<i.length;r+=1){const a=Bd(l,i,r);s[r]?s[r].p(a,o):(s[r]=Wd(a),s[r].c(),s[r].m(t,null))}for(;r<s.length;r+=1)s[r].d(1);s.length=i.length}},d(l){l&&w(e),pt(s,l)}}}function Wd(n){let e,t=n[9]+"",i;return{c(){e=y("p"),i=Y(t)},m(s,l){S(s,e,l),v(e,i)},p(s,l){l&8&&t!==(t=s[9]+"")&&le(i,t)},d(s){s&&w(e)}}}function E4(n){let e,t,i,s,l,o,r,a,u,f,d;const p=[M4,C4],h=[];function g(b,k){return b[2]?0:1}l=g(n),o=h[l]=p[l](n);let _=n[3].length&&Ud(n);return{c(){e=y("label"),t=y("span"),t.textContent="Select query",s=D(),o.c(),r=D(),a=y("div"),a.innerHTML=`<ul><li>Wildcard columns (<code>*</code>) are not supported
2023-05-14 03:10:14 +08:00
<li>The query must have a unique <code>id</code> column.
<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 (eg.
2023-05-14 03:23:19 +08:00
<code>MAX(balance) as maxBalance</code>).</li></ul>`,u=D(),_&&_.c(),f=Se(),m(t,"class","txt"),m(e,"for",i=n[8]),m(a,"class","help-block")},m(b,k){S(b,e,k),v(e,t),S(b,s,k),h[l].m(b,k),S(b,r,k),S(b,a,k),S(b,u,k),_&&_.m(b,k),S(b,f,k),d=!0},p(b,k){(!d||k&256&&i!==(i=b[8]))&&m(e,"for",i);let $=l;l=g(b),l===$?h[l].p(b,k):(ue(),P(h[$],1,1,()=>{h[$]=null}),fe(),o=h[l],o?o.p(b,k):(o=h[l]=p[l](b),o.c()),I(o,1),o.m(r.parentNode,r)),b[3].length?_?_.p(b,k):(_=Ud(b),_.c(),_.m(f.parentNode,f)):_&&(_.d(1),_=null)},i(b){d||(I(o),d=!0)},o(b){P(o),d=!1},d(b){b&&w(e),b&&w(s),h[l].d(b),b&&w(r),b&&w(a),b&&w(u),_&&_.d(b),b&&w(f)}}}function O4(n){let e,t;return e=new pe({props:{class:"form-field required "+(n[3].length?"error":""),name:"options.query",$$slots:{default:[E4,({uniqueId:i})=>({8:i}),({uniqueId:i})=>i?256:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){z(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||(I(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function D4(n,e,t){let i;Ze(n,Ti,d=>t(4,i=d));let{collection:s=new kn}=e,l,o=!1,r=[];function a(d){var g;t(3,r=[]);const p=U.getNestedVal(d,"schema",null);if(U.isEmpty(p))return;if(p!=null&&p.message){r.push(p==null?void 0:p.message);return}const h=U.extractColumnsFromQuery((g=s==null?void 0:s.options)==null?void 0:g.query);U.removeByValue(h,"id"),U.removeByValue(h,"created"),U.removeByValue(h,"updated");for(let _ in p)for(let b in p[_]){const k=p[_][b].message,$=h[_]||_;r.push(U.sentenize($+": "+k))}}Xt(async()=>{t(2,o=!0);try{t(1,l=(await ut(()=>import("./CodeEditor-06ad58db.js"),["./CodeEditor-06ad58db.js","./index-03b6b7de.js"],import.meta.url)).default)}catch(d){console.warn(d)}t(2,o=!1)});function u(d){n.$$.not_equal(s.options.query,d)&&(s.options.query=d,t(0,s))}const f=()=>{r.length&&ui("schema")};return n.$$set=d=>{"collection"in d&&t(0,s=d.collection)},n.$$.update=()=>{n.$$.dirty&16&&a(i)},[s,l,o,r,i,u,f]}class A4 extends be{constructor(e){super(),ge(this,e,D4,O4,_e,{collection:0})}}const I4=n=>({active:n&1}),Yd=n=>({active:n[0]});function Kd(n){let e,t,i;const s=n[15].default,l=kt(s,n,n[14],null);return{c(){e=y("div"),l&&l.c(),m(e,"class","accordion-content")},m(o,r){S(o,e,r),l&&l.m(e,null),i=!0},p(o,r){l&&l.p&&(!i||r&16384)&&St(l,s,o,o[14],i?wt(s,o[14],r,null):$t(o[14]),null)},i(o){i||(I(l,o),o&&et(()=>{i&&(t||(t=Ve(e,rt,{duration:150},!0)),t.run(1))}),i=!0)},o(o){P(l,o),o&&(t||(t=Ve(e,rt,{duration:150},!1)),t.run(0)),i=!1},d(o){o&&w(e),l&&l.d(o),o&&t&&t.end()}}}function L4(n){let e,t,i,s,l,o,r;const a=n[15].header,u=kt(a,n,n[14],Yd);let f=n[0]&&Kd(n);return{c(){e=y("div"),t=y("button"),u&&u.c(),i=D(),f&&f.c(),m(t,"type","button"),m(t,"class","accordion-header"),m(t,"draggable",n[2]),ee(t,"interactive",n[3]),m(e,"class",s="accordion "+(n[7]?"drag-over":"")+" "+n[1]),ee(e,"active",n[0])},m(d,p){S(d,e,p),v(e,t),u&&u.m(t,null),v(e,i),f&&f.m(e,null),n[22](e),l=!0,o||(r=[J(t,"click",xe(n[17])),J(t,"drop",xe(n[18])),J(t,"dragstart",n[19]),J(t,"dragenter",n[20]),J(t,"dragleave",n[21]),J(t,"dragover",xe(n[16]))],o=!0)},p(d,[p]){u&&u.p&&(!l||p&16385)&&St(u,a,d,d[14],l?wt(a,d[14],p,I4):$t(d[14]),Yd),(!l||p&4)&&m(t,"draggable",d[2]),(!l||p&8)&&ee(t,"interactive",d[3]),d[0]?f?(f.p(d,p),p&1&&I(f,1)):(f=Kd(d),f.c(),I(f,1),f.m(e,null)):f&&(ue(),P(f,1,1,()=>{f=null}),fe()),(!l||p&130&&s!==(s="accordion "+(d[7]?"drag-over":"")+" "+d[1]))&&m(e,"class",s),(!l||p&131)&&ee(e,"active",d[0])},i(d){l||(I(u,d),I(f),l=!0)},o(d){P(u,d),P(f),l=!1},d(d){d&&w(e),u&&u.d(d),f&&f.d(),n[22](null),o=!1,De(r)}}}function P4(n,e,t){let{$$slots:i={},$$scope:s}=e;const l=Tt();let o,r,{class:a=""}=e,{draggable:u=!1}=e,{active:f=!1}=e,{interactive:d=!0}=e,{single:p=!1}=e,h=!1;function g(){return!!f}function _(){$(),t(0,f=!0),l("expand")}function b(){t(0,f=!1),clearTimeout(r),l("collapse")}function k(){l("toggle"),f?b():_()}function $(){if(p&&o.closest(".accordions")){const N=o.closest(".accordions").querySelectorAll(".accordion.active .accordion-header.interactive");for(co
2023-05-14 03:10:14 +08:00
<span class="txt">Username/Password</span>`,t=D(),i=y("div"),s=D(),f.c(),l=D(),d&&d.c(),o=Se(),m(e,"class","inline-flex"),m(i,"class","flex-fill")},m(p,h){S(p,e,h),S(p,t,h),S(p,i,h),S(p,s,h),f.m(p,h),S(p,l,h),d&&d.m(p,h),S(p,o,h),r=!0},p(p,h){u!==(u=a(p))&&(f.d(1),f=u(p),f&&(f.c(),f.m(l.parentNode,l))),p[3]?d?h&8&&I(d,1):(d=Jd(),d.c(),I(d,1),d.m(o.parentNode,o)):d&&(ue(),P(d,1,1,()=>{d=null}),fe())},i(p){r||(I(d),r=!0)},o(p){P(d),r=!1},d(p){p&&w(e),p&&w(t),p&&w(i),p&&w(s),f.d(p),p&&w(l),d&&d.d(p),p&&w(o)}}}function V4(n){let e,t,i,s,l,o,r,a;return{c(){e=y("input"),i=D(),s=y("label"),l=Y("Enable"),m(e,"type","checkbox"),m(e,"id",t=n[12]),m(s,"for",o=n[12])},m(u,f){S(u,e,f),e.checked=n[0].options.allowEmailAuth,S(u,i,f),S(u,s,f),v(s,l),r||(a=J(e,"change",n[6]),r=!0)},p(u,f){f&4096&&t!==(t=u[12])&&m(e,"id",t),f&1&&(e.checked=u[0].options.allowEmailAuth),f&4096&&o!==(o=u[12])&&m(s,"for",o)},d(u){u&&w(e),u&&w(i),u&&w(s),r=!1,a()}}}function Zd(n){let e,t,i,s,l,o,r,a;return i=new pe({props:{class:"form-field "+(U.isEmpty(n[0].options.onlyEmailDomains)?"":"disabled"),name:"options.exceptEmailDomains",$$slots:{default:[z4,({uniqueId:u})=>({12:u}),({uniqueId:u})=>u?4096:0]},$$scope:{ctx:n}}}),o=new pe({props:{class:"form-field "+(U.isEmpty(n[0].options.exceptEmailDomains)?"":"disabled"),name:"options.onlyEmailDomains",$$slots:{default:[H4,({uniqueId:u})=>({12:u}),({uniqueId:u})=>u?4096:0]},$$scope:{ctx:n}}}),{c(){e=y("div"),t=y("div"),B(i.$$.fragment),s=D(),l=y("div"),B(o.$$.fragment),m(t,"class","col-lg-6"),m(l,"class","col-lg-6"),m(e,"class","grid grid-sm p-t-sm")},m(u,f){S(u,e,f),v(e,t),z(i,t,null),v(e,s),v(e,l),z(o,l,null),a=!0},p(u,f){const d={};f&1&&(d.class="form-field "+(U.isEmpty(u[0].options.onlyEmailDomains)?"":"disabled")),f&12289&&(d.$$scope={dirty:f,ctx:u}),i.$set(d);const p={};f&1&&(p.class="form-field "+(U.isEmpty(u[0].options.exceptEmailDomains)?"":"disabled")),f&12289&&(p.$$scope={dirty:f,ctx:u}),o.$set(p)},i(u){a||(I(i.$$.fragment,u),I(o.$$.fragment,u),u&&et(()=>{a&&(r||(r=Ve(e,rt,{duration:150},!0)),r.run(1))}),a=!0)},o(u){P(i.$$.fragment,u),P(o.$$.fragment,u),u&&(r||(r=Ve(e,rt,{duration:150},!1)),r.run(0)),a=!1},d(u){u&&w(e),H(i),H(o),u&&r&&r.end()}}}function z4(n){let e,t,i,s,l,o,r,a,u,f,d,p,h;function g(b){n[7](b)}let _={id:n[12],disabled:!U.isEmpty(n[0].options.onlyEmailDomains)};return n[0].options.exceptEmailDomains!==void 0&&(_.value=n[0].options.exceptEmailDomains),r=new zs({props:_}),ne.push(()=>he(r,"value",g)),{c(){e=y("label"),t=y("span"),t.textContent="Except domains",i=D(),s=y("i"),o=D(),B(r.$$.fragment),u=D(),f=y("div"),f.textContent="Use comma as separator.",m(t,"class","txt"),m(s,"class","ri-information-line link-hint"),m(e,"for",l=n[12]),m(f,"class","help-block")},m(b,k){S(b,e,k),v(e,t),v(e,i),v(e,s),S(b,o,k),z(r,b,k),S(b,u,k),S(b,f,k),d=!0,p||(h=Oe(Be.call(null,s,{text:`Email domains that are NOT allowed to sign up.
This field is disabled if "Only domains" is set.`,position:"top"})),p=!0)},p(b,k){(!d||k&4096&&l!==(l=b[12]))&&m(e,"for",l);const $={};k&4096&&($.id=b[12]),k&1&&($.disabled=!U.isEmpty(b[0].options.onlyEmailDomains)),!a&&k&1&&(a=!0,$.value=b[0].options.exceptEmailDomains,ye(()=>a=!1)),r.$set($)},i(b){d||(I(r.$$.fragment,b),d=!0)},o(b){P(r.$$.fragment,b),d=!1},d(b){b&&w(e),b&&w(o),H(r,b),b&&w(u),b&&w(f),p=!1,h()}}}function H4(n){let e,t,i,s,l,o,r,a,u,f,d,p,h;function g(b){n[8](b)}let _={id:n[12],disabled:!U.isEmpty(n[0].options.exceptEmailDomains)};return n[0].options.onlyEmailDomains!==void 0&&(_.value=n[0].options.onlyEmailDomains),r=new zs({props:_}),ne.push(()=>he(r,"value",g)),{c(){e=y("label"),t=y("span"),t.textContent="Only domains",i=D(),s=y("i"),o=D(),B(r.$$.fragment),u=D(),f=y("div"),f.textContent="Use comma as separator.",m(t,"class","txt"),m(s,"class","ri-information-line link-hint"),m(e,"for",l=n[12]),m(f,"class","help-block")},m(b,k){S(b,e,k),v(e,t),v(e,i),v(e,s),S(b,o,k),z(r,b,k),S(b,u,k),S(b,f,k),d=!0,p||(h=Oe(Be.call(null,s,{text:`Email domains that are ONLY allowed to sign up.
This field is disabled if "Except domains" is set.`,position:"top"})),p=!0)},p(b,k){(!d||k&4096&&l!==(l=b[12]))&&m(e,"for",l);const $={};k&4096&&($.id=b[12]),k&1&&($.disabled=!U.isEmpty(b[0].options.exceptEmailDomains)),!a&&k&1&&(a=!0,$.value=b[0].options.onlyEmailDomains,ye(()=>a=!1)),r.$set($)},i(b){d||(I(r.$$.fragment,b),d=!0)},o(b){P(r.$$.fragment,b),d=!1},d(b){b&&w(e),b&&w(o),H(r,b),b&&w(u),b&&w(f),p=!1,h()}}}function B4(n){let e,t,i,s;e=new pe({props:{class:"form-field form-field-toggle m-0",name:"options.allowEmailAuth",$$slots:{default:[V4,({uniqueId:o})=>({12:o}),({uniqueId:o})=>o?4096:0]},$$scope:{ctx:n}}});let l=n[0].options.allowEmailAuth&&Zd(n);return{c(){B(e.$$.fragment),t=D(),l&&l.c(),i=Se()},m(o,r){z(e,o,r),S(o,t,r),l&&l.m(o,r),S(o,i,r),s=!0},p(o,r){const a={};r&12289&&(a.$$scope={dirty:r,ctx:o}),e.$set(a),o[0].options.allowEmailAuth?l?(l.p(o,r),r&1&&I(l,1)):(l=Zd(o),l.c(),I(l,1),l.m(i.parentNode,i)):l&&(ue(),P(l,1,1,()=>{l=null}),fe())},i(o){s||(I(e.$$.fragment,o),I(l),s=!0)},o(o){P(e.$$.fragment,o),P(l),s=!1},d(o){H(e,o),o&&w(t),l&&l.d(o),o&&w(i)}}}function U4(n){let e;return{c(){e=y("span"),e.textContent="Disabled",m(e,"class","label")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function W4(n){let e;return{c(){e=y("span"),e.textContent="Enabled",m(e,"class","label label-success")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function Gd(n){let e,t,i,s,l;return{c(){e=y("i"),m(e,"class","ri-error-warning-fill txt-danger")},m(o,r){S(o,e,r),i=!0,s||(l=Oe(Be.call(null,e,{text:"Has errors",position:"left"})),s=!0)},i(o){i||(et(()=>{i&&(t||(t=Ve(e,Jt,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){t||(t=Ve(e,Jt,{duration:150,start:.7},!1)),t.run(0),i=!1},d(o){o&&w(e),o&&t&&t.end(),s=!1,l()}}}function Y4(n){let e,t,i,s,l,o,r;function a(p,h){return p[0].options.allowEmailAuth?W4:U4}let u=a(n),f=u(n),d=n[2]&&Gd();return{c(){e=y("div"),e.innerHTML=`<i class="ri-mail-star-line"></i>
<span class="txt">Email/Password</span>`,t=D(),i=y("div"),s=D(),f.c(),l=D(),d&&d.c(),o=Se(),m(e,"class","inline-flex"),m(i,"class","flex-fill")},m(p,h){S(p,e,h),S(p,t,h),S(p,i,h),S(p,s,h),f.m(p,h),S(p,l,h),d&&d.m(p,h),S(p,o,h),r=!0},p(p,h){u!==(u=a(p))&&(f.d(1),f=u(p),f&&(f.c(),f.m(l.parentNode,l))),p[2]?d?h&4&&I(d,1):(d=Gd(),d.c(),I(d,1),d.m(o.parentNode,o)):d&&(ue(),P(d,1,1,()=>{d=null}),fe())},i(p){r||(I(d),r=!0)},o(p){P(d),r=!1},d(p){p&&w(e),p&&w(t),p&&w(i),p&&w(s),f.d(p),p&&w(l),d&&d.d(p),p&&w(o)}}}function K4(n){let e,t,i,s,l,o,r,a;return{c(){e=y("input"),i=D(),s=y("label"),l=Y("Enable"),m(e,"type","checkbox"),m(e,"id",t=n[12]),m(s,"for",o=n[12])},m(u,f){S(u,e,f),e.checked=n[0].options.allowOAuth2Auth,S(u,i,f),S(u,s,f),v(s,l),r||(a=J(e,"change",n[9]),r=!0)},p(u,f){f&4096&&t!==(t=u[12])&&m(e,"id",t),f&1&&(e.checked=u[0].options.allowOAuth2Auth),f&4096&&o!==(o=u[12])&&m(s,"for",o)},d(u){u&&w(e),u&&w(i),u&&w(s),r=!1,a()}}}function Xd(n){let e,t,i;return{c(){e=y("div"),e.innerHTML='<div class="flex p-t-base"><a href="/_/#/settings/auth-providers" target="_blank" class="btn btn-sm btn-outline"><span class="txt">Manage OAuth2 providers</span></a></div>',m(e,"class","block")},m(s,l){S(s,e,l),i=!0},i(s){i||(s&&et(()=>{i&&(t||(t=Ve(e,rt,{duration:150},!0)),t.run(1))}),i=!0)},o(s){s&&(t||(t=Ve(e,rt,{duration:150},!1)),t.run(0)),i=!1},d(s){s&&w(e),s&&t&&t.end()}}}function J4(n){let e,t,i,s;e=new pe({props:{class:"form-field form-field-toggle m-b-0",name:"options.allowOAuth2Auth",$$slots:{default:[K4,({uniqueId:o})=>({12:o}),({uniqueId:o})=>o?4096:0]},$$scope:{ctx:n}}});let l=n[0].options.allowOAuth2Auth&&Xd();return{c(){B(e.$$.fragment),t=D(),l&&l.c(),i=Se()},m(o,r){z(e,o,r),S(o,t,r),l&&l.m(o,r),S(o,i,r),s=!0},p(o,r){const a={};r&12289&&(a.$$scope={dirty:r,ctx:o}),e.$set(a),o[0].options.allowOAuth2Auth?l?r&1&&I(l,1):(l=Xd(),l.c(),I(l,1),l.m(i.parentNode,i)):l&&(ue(),P(l,1,1,()=>{l=null}),fe())},i(o){s||(I(e.$$.fragment,o),I(l),s=!0)},o(o){P(e.$$.fragment,o),P(l),s=!1},d(o){H(e,o),o&&w(t),l&&l.d(o),o&&w(i)}}}function Z4(n){let e;return{c(){e=y("span"),e.textContent="Disabled",m(e,"class","label")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function G4(n){let e;return{c(){e=y("span"),e.textContent="Enabled",m(e,"class","label label-success")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function Qd(n){let e,t,i,s,l;return{c(){e=y("i"),m(e,"class","ri-error-warning-fill txt-danger")},m(o,r){S(o,e,r),i=!0,s||(l=Oe(Be.call(null,e,{text:"Has errors",position:"left"})),s=!0)},i(o){i||(et(()=>{i&&(t||(t=Ve(e,Jt,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){t||(t=Ve(e,Jt,{duration:150,start:.7},!1)),t.run(0),i=!1},d(o){o&&w(e),o&&t&&t.end(),s=!1,l()}}}function X4(n){let e,t,i,s,l,o,r;function a(p,h){return p[0].options.allowOAuth2Auth?G4:Z4}let u=a(n),f=u(n),d=n[1]&&Qd();return{c(){e=y("div"),e.innerHTML=`<i class="ri-shield-star-line"></i>
2023-05-14 03:23:19 +08:00
<span class="txt">OAuth2</span>`,t=D(),i=y("div"),s=D(),f.c(),l=D(),d&&d.c(),o=Se(),m(e,"class","inline-flex"),m(i,"class","flex-fill")},m(p,h){S(p,e,h),S(p,t,h),S(p,i,h),S(p,s,h),f.m(p,h),S(p,l,h),d&&d.m(p,h),S(p,o,h),r=!0},p(p,h){u!==(u=a(p))&&(f.d(1),f=u(p),f&&(f.c(),f.m(l.parentNode,l))),p[1]?d?h&2&&I(d,1):(d=Qd(),d.c(),I(d,1),d.m(o.parentNode,o)):d&&(ue(),P(d,1,1,()=>{d=null}),fe())},i(p){r||(I(d),r=!0)},o(p){P(d),r=!1},d(p){p&&w(e),p&&w(t),p&&w(i),p&&w(s),f.d(p),p&&w(l),d&&d.d(p),p&&w(o)}}}function Q4(n){let e,t,i,s,l,o,r,a;return{c(){e=y("label"),t=Y("Minimum password length"),s=D(),l=y("input"),m(e,"for",i=n[12]),m(l,"type","number"),m(l,"id",o=n[12]),l.required=!0,m(l,"min","6"),m(l,"max","72")},m(u,f){S(u,e,f),v(e,t),S(u,s,f),S(u,l,f),ae(l,n[0].options.minPasswordLength),r||(a=J(l,"input",n[10]),r=!0)},p(u,f){f&4096&&i!==(i=u[12])&&m(e,"for",i),f&4096&&o!==(o=u[12])&&m(l,"id",o),f&1&&mt(l.value)!==u[0].options.minPasswordLength&&ae(l,u[0].options.minPasswordLength)},d(u){u&&w(e),u&&w(s),u&&w(l),r=!1,a()}}}function x4(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=y("input"),i=D(),s=y("label"),l=y("span"),l.textContent="Always require email",o=D(),r=y("i"),m(e,"type","checkbox"),m(e,"id",t=n[12]),m(l,"class","txt"),m(r,"class","ri-information-line txt-sm link-hint"),m(s,"for",a=n[12])},m(d,p){S(d,e,p),e.checked=n[0].options.requireEmail,S(d,i,p),S(d,s,p),v(s,l),v(s,o),v(s,r),u||(f=[J(e,"change",n[11]),Oe(Be.call(null,r,{text:`The constraint is applied only for new records.
Also note that some OAuth2 providers (like Twitter), don't return an email and the authentication may fail if the email field is required.`,position:"right"}))],u=!0)},p(d,p){p&4096&&t!==(t=d[12])&&m(e,"id",t),p&1&&(e.checked=d[0].options.requireEmail),p&4096&&a!==(a=d[12])&&m(s,"for",a)},d(d){d&&w(e),d&&w(i),d&&w(s),u=!1,De(f)}}}function eM(n){let e,t,i,s,l,o,r,a,u,f,d,p,h,g,_,b,k;return s=new co({props:{single:!0,$$slots:{header:[j4],default:[N4]},$$scope:{ctx:n}}}),o=new co({props:{single:!0,$$slots:{header:[Y4],default:[B4]},$$scope:{ctx:n}}}),a=new co({props:{single:!0,$$slots:{header:[X4],default:[J4]},$$scope:{ctx:n}}}),g=new pe({props:{class:"form-field required",name:"options.minPasswordLength",$$slots:{default:[Q4,({uniqueId:$})=>({12:$}),({uniqueId:$})=>$?4096:0]},$$scope:{ctx:n}}}),b=new pe({props:{class:"form-field form-field-toggle m-b-sm",name:"options.requireEmail",$$slots:{default:[x4,({uniqueId:$})=>({12:$}),({uniqueId:$})=>$?4096:0]},$$scope:{ctx:n}}}),{c(){e=y("h4"),e.textContent="Auth methods",t=D(),i=y("div"),B(s.$$.fragment),l=D(),B(o.$$.fragment),r=D(),B(a.$$.fragment),u=D(),f=y("hr"),d=D(),p=y("h4"),p.textContent="General",h=D(),B(g.$$.fragment),_=D(),B(b.$$.fragment),m(e,"class","section-title"),m(i,"class","accordions"),m(p,"class","section-title")},m($,C){S($,e,C),S($,t,C),S($,i,C),z(s,i,null),v(i,l),z(o,i,null),v(i,r),z(a,i,null),S($,u,C),S($,f,C),S($,d,C),S($,p,C),S($,h,C),z(g,$,C),S($,_,C),z(b,$,C),k=!0},p($,[C]){const T={};C&8201&&(T.$$scope={dirty:C,ctx:$}),s.$set(T);const O={};C&8197&&(O.$$scope={dirty:C,ctx:$}),o.$set(O);const M={};C&8195&&(M.$$scope={dirty:C,ctx:$}),a.$set(M);const E={};C&12289&&(E.$$scope={dirty:C,ctx:$}),g.$set(E);const A={};C&12289&&(A.$$scope={dirty:C,ctx:$}),b.$set(A)},i($){k||(I(s.$$.fragment,$),I(o.$$.fragment,$),I(a.$$.fragment,$),I(g.$$.fragment,$),I(b.$$.fragment,$),k=!0)},o($){P(s.$$.fragment,$),P(o.$$.fragment,$),P(a.$$.fragment,$),P(g.$$.fragment,$),P(b.$$.fragment,$),k=!1},d($){$&&w(e),$&&w(t),$&&w(i),H(s),H(o),H(a),$&&w(u),$&&w(f),$&&w(d),$&&w(p),$&&w(h),H(g,$),$&&w(_),H(b,$)}}}function tM(n,e,t){let i,s,l,o;Ze(n,Ti,_=>t(4,o=_));let{collection:r=new kn}=e;function a(){r.options.allowUsernameAuth=this.checked,t(0,r)}function u(){r.options.allowEmailAuth=this.checked,t(0,r)}function f(_){n.$$.not_equal(r.options.exceptEmailDomains,_)&&(r.options.exceptEmailDomains=_,t(0,r))}function d(_){n.$$.not_equal(r.options.onlyEmailDomains,_)&&(r.options.onlyEmailDomains=_,t(0,r))}function p(){r.options.allowOAuth2Auth=this.checked,t(0,r)}function h(){r.options.minPasswordLength=mt(this.value),t(0,r)}function g(){r.options.requireEmail=this.checked,t(0,r)}return n.$$set=_=>{"collection"in _&&t(0,r=_.collection)},n.$$.update=()=>{var _,b,k,$;n.$$.dirty&1&&r.$isAuth&&U.isEmpty(r.options)&&t(0,r.options={allowEmailAuth:!0,allowUsernameAuth:!0,allowOAuth2Auth:!0,minPasswordLength:8},r),n.$$.dirty&16&&t(2,s=!U.isEmpty((_=o==null?void 0:o.options)==null?void 0:_.allowEmailAuth)||!U.isEmpty((b=o==null?void 0:o.options)==null?void 0:b.onlyEmailDomains)||!U.isEmpty((k=o==null?void 0:o.options)==null?void 0:k.exceptEmailDomains)),n.$$.dirty&16&&t(1,l=!U.isEmpty(($=o==null?void 0:o.options)==null?void 0:$.allowOAuth2Auth))},t(3,i=!1),[r,l,s,i,o,a,u,f,d,p,h,g]}class nM extends be{constructor(e){super(),ge(this,e,tM,eM,_e,{collection:0})}}function xd(n,e,t){const i=n.slice();return i[17]=e[t],i}function ep(n,e,t){const i=n.slice();return i[17]=e[t],i}function tp(n,e,t){const i=n.slice();return i[17]=e[t],i}function np(n){let e;return{c(){e=y("p"),e.textContent="All data associated with the removed fields will be permanently deleted!"},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function ip(n){var r;let e,t,i,s,l=n[3]&&sp(n),o=!((r=n[2])!=null&&r.$isView)&&lp(n);return{c(){e=y("h6"),e.textContent="Changes:",t=D(),i=y("ul"),l&&l.c(),s=D(),o&&o.c(),m(i,"class","changes-list svelte-xqpcsf")},m(a,u){S(a,e,u),S(a,t,u),S(a,i,u),l&&l.m(i,null),v(i,s),o&&o.m(i,null)},p(a,u){var f;a[3]?l?l.p(a,u):(l=sp(a),l.c(),l.m(i,s)):l&&(l.d(1),l=null),(f=a[2])!=null&&f.$isView?o&&(o.d(1),o=null):o?o.p(a,u):(o=lp
2023-05-14 03:10:14 +08:00
`),s=y("strong"),o=Y(l),r=D(),a=y("i"),u=D(),f=y("strong"),p=Y(d),m(s,"class","txt-strikethrough txt-hint"),m(a,"class","ri-arrow-right-line txt-sm"),m(f,"class","txt"),m(t,"class","inline-flex"),m(e,"class","svelte-xqpcsf")},m(_,b){S(_,e,b),v(e,t),v(t,i),v(t,s),v(s,o),v(t,r),v(t,a),v(t,u),v(t,f),v(f,p)},p(_,b){var k,$;b&2&&l!==(l=((k=_[1])==null?void 0:k.name)+"")&&le(o,l),b&4&&d!==(d=(($=_[2])==null?void 0:$.name)+"")&&le(p,d)},d(_){_&&w(e)}}}function lp(n){let e,t,i,s=n[5],l=[];for(let f=0;f<s.length;f+=1)l[f]=op(tp(n,s,f));let o=n[7],r=[];for(let f=0;f<o.length;f+=1)r[f]=rp(ep(n,o,f));let a=n[6],u=[];for(let f=0;f<a.length;f+=1)u[f]=ap(xd(n,a,f));return{c(){for(let f=0;f<l.length;f+=1)l[f].c();e=D();for(let f=0;f<r.length;f+=1)r[f].c();t=D();for(let f=0;f<u.length;f+=1)u[f].c();i=Se()},m(f,d){for(let p=0;p<l.length;p+=1)l[p]&&l[p].m(f,d);S(f,e,d);for(let p=0;p<r.length;p+=1)r[p]&&r[p].m(f,d);S(f,t,d);for(let p=0;p<u.length;p+=1)u[p]&&u[p].m(f,d);S(f,i,d)},p(f,d){if(d&32){s=f[5];let p;for(p=0;p<s.length;p+=1){const h=tp(f,s,p);l[p]?l[p].p(h,d):(l[p]=op(h),l[p].c(),l[p].m(e.parentNode,e))}for(;p<l.length;p+=1)l[p].d(1);l.length=s.length}if(d&128){o=f[7];let p;for(p=0;p<o.length;p+=1){const h=ep(f,o,p);r[p]?r[p].p(h,d):(r[p]=rp(h),r[p].c(),r[p].m(t.parentNode,t))}for(;p<r.length;p+=1)r[p].d(1);r.length=o.length}if(d&64){a=f[6];let p;for(p=0;p<a.length;p+=1){const h=xd(f,a,p);u[p]?u[p].p(h,d):(u[p]=ap(h),u[p].c(),u[p].m(i.parentNode,i))}for(;p<u.length;p+=1)u[p].d(1);u.length=a.length}},d(f){pt(l,f),f&&w(e),pt(r,f),f&&w(t),pt(u,f),f&&w(i)}}}function op(n){let e,t,i,s=n[17].name+"",l,o,r;return{c(){e=y("li"),t=Y(`Multiple to single value conversion of field
`),i=y("strong"),l=Y(s),o=D(),r=y("em"),r.textContent="(will keep only the last array item)",m(r,"class","txt-sm"),m(e,"class","svelte-xqpcsf")},m(a,u){S(a,e,u),v(e,t),v(e,i),v(i,l),v(e,o),v(e,r)},p(a,u){u&32&&s!==(s=a[17].name+"")&&le(l,s)},d(a){a&&w(e)}}}function rp(n){let e,t,i,s,l=n[17].originalName+"",o,r,a,u,f,d=n[17].name+"",p;return{c(){e=y("li"),t=y("div"),i=Y(`Renamed field
`),s=y("strong"),o=Y(l),r=D(),a=y("i"),u=D(),f=y("strong"),p=Y(d),m(s,"class","txt-strikethrough txt-hint"),m(a,"class","ri-arrow-right-line txt-sm"),m(f,"class","txt"),m(t,"class","inline-flex"),m(e,"class","svelte-xqpcsf")},m(h,g){S(h,e,g),v(e,t),v(t,i),v(t,s),v(s,o),v(t,r),v(t,a),v(t,u),v(t,f),v(f,p)},p(h,g){g&128&&l!==(l=h[17].originalName+"")&&le(o,l),g&128&&d!==(d=h[17].name+"")&&le(p,d)},d(h){h&&w(e)}}}function ap(n){let e,t,i,s=n[17].name+"",l,o;return{c(){e=y("li"),t=Y("Removed field "),i=y("span"),l=Y(s),o=D(),m(i,"class","txt-bold"),m(e,"class","txt-danger svelte-xqpcsf")},m(r,a){S(r,e,a),v(e,t),v(e,i),v(i,l),v(e,o)},p(r,a){a&64&&s!==(s=r[17].name+"")&&le(l,s)},d(r){r&&w(e)}}}function iM(n){let e,t,i,s,l,o,r,a,u=n[6].length&&np(),f=n[8]&&ip(n);return{c(){e=y("div"),t=y("div"),t.innerHTML='<i class="ri-error-warning-line"></i>',i=D(),s=y("div"),l=y("p"),l.textContent=`If any of the collection changes is part of another collection rule, filter or view query,
2023-05-14 03:23:19 +08:00
you'll have to update it manually!`,o=D(),u&&u.c(),r=D(),f&&f.c(),a=Se(),m(t,"class","icon"),m(s,"class","content txt-bold"),m(e,"class","alert alert-warning")},m(d,p){S(d,e,p),v(e,t),v(e,i),v(e,s),v(s,l),v(s,o),u&&u.m(s,null),S(d,r,p),f&&f.m(d,p),S(d,a,p)},p(d,p){d[6].length?u||(u=np(),u.c(),u.m(s,null)):u&&(u.d(1),u=null),d[8]?f?f.p(d,p):(f=ip(d),f.c(),f.m(a.parentNode,a)):f&&(f.d(1),f=null)},d(d){d&&w(e),u&&u.d(),d&&w(r),f&&f.d(d),d&&w(a)}}}function sM(n){let e;return{c(){e=y("h4"),e.textContent="Confirm collection changes"},m(t,i){S(t,e,i)},p:te,d(t){t&&w(e)}}}function lM(n){let e,t,i,s,l;return{c(){e=y("button"),e.innerHTML='<span class="txt">Cancel</span>',t=D(),i=y("button"),i.innerHTML='<span class="txt">Confirm</span>',e.autofocus=!0,m(e,"type","button"),m(e,"class","btn btn-transparent"),m(i,"type","button"),m(i,"class","btn btn-expanded")},m(o,r){S(o,e,r),S(o,t,r),S(o,i,r),e.focus(),s||(l=[J(e,"click",n[11]),J(i,"click",n[12])],s=!0)},p:te,d(o){o&&w(e),o&&w(t),o&&w(i),s=!1,De(l)}}}function oM(n){let e,t,i={class:"confirm-changes-panel",popup:!0,$$slots:{footer:[lM],header:[sM],default:[iM]},$$scope:{ctx:n}};return e=new on({props:i}),n[13](e),e.$on("hide",n[14]),e.$on("show",n[15]),{c(){B(e.$$.fragment)},m(s,l){z(e,s,l),t=!0},p(s,[l]){const o={};l&16777710&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(I(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[13](null),H(e,s)}}}function rM(n,e,t){let i,s,l,o,r;const a=Tt();let u,f,d;async function p(T,O){t(1,f=T),t(2,d=O),await cn(),i||s.length||l.length||o.length?u==null||u.show():g()}function h(){u==null||u.hide()}function g(){h(),a("confirm")}const _=()=>h(),b=()=>g();function k(T){ne[T?"unshift":"push"](()=>{u=T,t(4,u)})}function $(T){me.call(this,n,T)}function C(T){me.call(this,n,T)}return n.$$.update=()=>{var T,O,M;n.$$.dirty&6&&t(3,i=(f==null?void 0:f.name)!=(d==null?void 0:d.name)),n.$$.dirty&4&&t(7,s=((T=d==null?void 0:d.schema)==null?void 0:T.filter(E=>E.id&&!E.toDelete&&E.originalName!=E.name))||[]),n.$$.dirty&4&&t(6,l=((O=d==null?void 0:d.schema)==null?void 0:O.filter(E=>E.id&&E.toDelete))||[]),n.$$.dirty&6&&t(5,o=((M=d==null?void 0:d.schema)==null?void 0:M.filter(E=>{var L,N,q;const A=(L=f==null?void 0:f.schema)==null?void 0:L.find(R=>R.id==E.id);return A?((N=A.options)==null?void 0:N.maxSelect)!=1&&((q=E.options)==null?void 0:q.maxSelect)==1:!1}))||[]),n.$$.dirty&12&&t(8,r=!(d!=null&&d.$isView)||i)},[h,f,d,i,u,o,l,s,r,g,p,_,b,k,$,C]}class aM extends be{constructor(e){super(),ge(this,e,rM,oM,_e,{show:10,hide:0})}get show(){return this.$$.ctx[10]}get hide(){return this.$$.ctx[0]}}function up(n,e,t){const i=n.slice();return i[47]=e[t][0],i[48]=e[t][1],i}function uM(n){let e,t,i;function s(o){n[33](o)}let l={};return n[2]!==void 0&&(l.collection=n[2]),e=new d4({props:l}),ne.push(()=>he(e,"collection",s)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};!t&&r[0]&4&&(t=!0,a.collection=o[2],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function fM(n){let e,t,i;function s(o){n[32](o)}let l={};return n[2]!==void 0&&(l.collection=n[2]),e=new A4({props:l}),ne.push(()=>he(e,"collection",s)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};!t&&r[0]&4&&(t=!0,a.collection=o[2],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function fp(n){let e,t,i,s;function l(r){n[34](r)}let o={};return n[2]!==void 0&&(o.collection=n[2]),t=new T4({props:o}),ne.push(()=>he(t,"collection",l)),{c(){e=y("div"),B(t.$$.fragment),m(e,"class","tab-item active")},m(r,a){S(r,e,a),z(t,e,null),s=!0},p(r,a){const u={};!i&&a[0]&4&&(i=!0,u.collection=r[2],ye(()=>i=!1)),t.$set(u)},i(r){s||(I(t.$$.fragment,r),s=!0)},o(r){P(t.$$.fragment,r),s=!1},d(r){r&&w(e),H(t)}}}function cp(n){let e,t,i,s;function l(r){n[35](r)}let o={};return n[2]!==void 0&&(o.collection=n[2]),t=new nM({props:o}),ne.push(()=>he(t,"collection",l)),{c(){e=y("div"),B(t.$$.fragment),m(e,"class","tab-item"),ee(e,"active",n[3]===Ns)},m(r,a){S(r,e,a),z(t,e,null),s=!
2023-05-14 03:10:14 +08:00
<span class="txt">Duplicate</span>`,t=D(),i=y("button"),i.innerHTML=`<i class="ri-delete-bin-7-line"></i>
2023-05-14 03:23:19 +08:00
<span class="txt">Delete</span>`,m(e,"type","button"),m(e,"class","dropdown-item closable"),m(i,"type","button"),m(i,"class","dropdown-item txt-danger closable")},m(o,r){S(o,e,r),S(o,t,r),S(o,i,r),s||(l=[J(e,"click",n[24]),J(i,"click",In(xe(n[25])))],s=!0)},p:te,d(o){o&&w(e),o&&w(t),o&&w(i),s=!1,De(l)}}}function pp(n){let e,t,i,s;return i=new Jn({props:{class:"dropdown dropdown-right dropdown-nowrap m-t-5",$$slots:{default:[pM]},$$scope:{ctx:n}}}),{c(){e=y("i"),t=D(),B(i.$$.fragment),m(e,"class","ri-arrow-down-s-fill")},m(l,o){S(l,e,o),S(l,t,o),z(i,l,o),s=!0},p(l,o){const r={};o[0]&68|o[1]&1048576&&(r.$$scope={dirty:o,ctx:l}),i.$set(r)},i(l){s||(I(i.$$.fragment,l),s=!0)},o(l){P(i.$$.fragment,l),s=!1},d(l){l&&w(e),l&&w(t),H(i,l)}}}function mp(n){let e,t,i,s,l,o=n[48]+"",r,a,u,f,d;function p(){return n[27](n[47])}return{c(){e=y("button"),t=y("i"),s=D(),l=y("span"),r=Y(o),a=Y(" collection"),u=D(),m(t,"class",i=os(U.getCollectionTypeIcon(n[47]))+" svelte-12y0yzb"),m(l,"class","txt"),m(e,"type","button"),m(e,"class","dropdown-item closable"),ee(e,"selected",n[47]==n[2].type)},m(h,g){S(h,e,g),v(e,t),v(e,s),v(e,l),v(l,r),v(l,a),v(e,u),f||(d=J(e,"click",p),f=!0)},p(h,g){n=h,g[0]&64&&i!==(i=os(U.getCollectionTypeIcon(n[47]))+" svelte-12y0yzb")&&m(t,"class",i),g[0]&64&&o!==(o=n[48]+"")&&le(r,o),g[0]&68&&ee(e,"selected",n[47]==n[2].type)},d(h){h&&w(e),f=!1,d()}}}function pM(n){let e,t=Object.entries(n[6]),i=[];for(let s=0;s<t.length;s+=1)i[s]=mp(up(n,t,s));return{c(){for(let s=0;s<i.length;s+=1)i[s].c();e=Se()},m(s,l){for(let o=0;o<i.length;o+=1)i[o]&&i[o].m(s,l);S(s,e,l)},p(s,l){if(l[0]&131140){t=Object.entries(s[6]);let o;for(o=0;o<t.length;o+=1){const r=up(s,t,o);i[o]?i[o].p(r,l):(i[o]=mp(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){pt(i,s),s&&w(e)}}}function hp(n){let e;return{c(){e=y("div"),e.textContent="System collection",m(e,"class","help-block")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function mM(n){let e,t,i,s,l,o,r,a,u,f,d,p,h,g,_,b,k=(n[6][n[2].type]||"N/A")+"",$,C,T,O,M,E,A,L,N,q=n[2].$isNew&&pp(n),R=n[2].system&&hp();return{c(){e=y("label"),t=Y("Name"),s=D(),l=y("input"),f=D(),d=y("div"),p=y("button"),h=y("span"),g=D(),_=y("span"),b=Y("Type: "),$=Y(k),C=D(),q&&q.c(),M=D(),R&&R.c(),E=Se(),m(e,"for",i=n[46]),m(l,"type","text"),m(l,"id",o=n[46]),l.required=!0,l.disabled=n[13],m(l,"spellcheck","false"),l.autofocus=r=n[2].$isNew,m(l,"placeholder",a=n[2].$isAuth?'eg. "users"':'eg. "posts"'),l.value=u=n[2].name,m(_,"class","txt"),m(p,"type","button"),m(p,"class",T="btn btn-sm p-r-10 p-l-10 "+(n[2].$isNew?"btn-outline":"btn-transparent")),p.disabled=O=!n[2].$isNew,m(d,"class","form-field-addon")},m(F,V){S(F,e,V),v(e,t),S(F,s,V),S(F,l,V),S(F,f,V),S(F,d,V),v(d,p),v(p,h),v(p,g),v(p,_),v(_,b),v(_,$),v(p,C),q&&q.m(p,null),S(F,M,V),R&&R.m(F,V),S(F,E,V),A=!0,n[2].$isNew&&l.focus(),L||(N=J(l,"input",n[26]),L=!0)},p(F,V){(!A||V[1]&32768&&i!==(i=F[46]))&&m(e,"for",i),(!A||V[1]&32768&&o!==(o=F[46]))&&m(l,"id",o),(!A||V[0]&8192)&&(l.disabled=F[13]),(!A||V[0]&4&&r!==(r=F[2].$isNew))&&(l.autofocus=r),(!A||V[0]&4&&a!==(a=F[2].$isAuth?'eg. "users"':'eg. "posts"'))&&m(l,"placeholder",a),(!A||V[0]&4&&u!==(u=F[2].name)&&l.value!==u)&&(l.value=u),(!A||V[0]&68)&&k!==(k=(F[6][F[2].type]||"N/A")+"")&&le($,k),F[2].$isNew?q?(q.p(F,V),V[0]&4&&I(q,1)):(q=pp(F),q.c(),I(q,1),q.m(p,null)):q&&(ue(),P(q,1,1,()=>{q=null}),fe()),(!A||V[0]&4&&T!==(T="btn btn-sm p-r-10 p-l-10 "+(F[2].$isNew?"btn-outline":"btn-transparent")))&&m(p,"class",T),(!A||V[0]&4&&O!==(O=!F[2].$isNew))&&(p.disabled=O),F[2].system?R||(R=hp(),R.c(),R.m(E.parentNode,E)):R&&(R.d(1),R=null)},i(F){A||(I(q),A=!0)},o(F){P(q),A=!1},d(F){F&&w(e),F&&w(s),F&&w(l),F&&w(f),F&&w(d),q&&q.d(),F&&w(M),R&&R.d(F),F&&w(E),L=!1,N()}}}function _p(n){let e,t,i,s,l,o;return{c(){e=y("i"),m(e,"class","ri-error-warning-fill txt-danger")},m(r,a){S(r,e,a),s=!0,l||(o=Oe(t=Be.call(null,e,n[11])),l=!0)},p(r,a){t&&jt(t.update)&&a[0]&2048&&t.update.call(null,r[11])},i(r){s||(r&&et(()=>{s&&(i||(i=Ve(e,Jt,{duration:150,start:.7},!0)),i.run(1))}),s=!0)},o(r){r&&
<span class="txt">New collection</span>`,m(t,"type","button"),m(t,"class","btn btn-block btn-outline"),m(e,"class","sidebar-footer")},m(l,o){S(l,e,o),v(e,t),i||(s=J(t,"click",n[12]),i=!0)},p:te,d(l){l&&w(e),i=!1,s()}}}function yM(n){let e,t,i,s,l,o,r,a,u,f,d,p=[],h=new Map,g,_,b,k,$,C,T=n[3];const O=L=>L[15].id;for(let L=0;L<T.length;L+=1){let N=wp(n,T,L),q=O(N);h.set(q,p[L]=Tp(q,N))}let M=null;T.length||(M=Sp(n));let E=!n[7]&&Cp(n),A={};return b=new cu({props:A}),n[13](b),b.$on("save",n[14]),{c(){e=y("aside"),t=y("header"),i=y("div"),s=y("div"),l=y("button"),l.innerHTML='<i class="ri-close-line"></i>',o=D(),r=y("input"),a=D(),u=y("hr"),f=D(),d=y("div");for(let L=0;L<p.length;L+=1)p[L].c();M&&M.c(),g=D(),E&&E.c(),_=D(),B(b.$$.fragment),m(l,"type","button"),m(l,"class","btn btn-xs btn-transparent btn-circle btn-clear"),ee(l,"hidden",!n[4]),m(s,"class","form-field-addon"),m(r,"type","text"),m(r,"placeholder","Search collections..."),m(i,"class","form-field search"),ee(i,"active",n[4]),m(t,"class","sidebar-header"),m(u,"class","m-t-5 m-b-xs"),m(d,"class","sidebar-content"),ee(d,"fade",n[6]),ee(d,"sidebar-content-compact",n[3].length>20),m(e,"class","page-sidebar collection-sidebar")},m(L,N){S(L,e,N),v(e,t),v(t,i),v(i,s),v(s,l),v(i,o),v(i,r),ae(r,n[0]),v(e,a),v(e,u),v(e,f),v(e,d);for(let q=0;q<p.length;q+=1)p[q]&&p[q].m(d,null);M&&M.m(d,null),v(e,g),E&&E.m(e,null),S(L,_,N),z(b,L,N),k=!0,$||(C=[J(l,"click",n[10]),J(r,"input",n[11])],$=!0)},p(L,[N]){(!k||N&16)&&ee(l,"hidden",!L[4]),N&1&&r.value!==L[0]&&ae(r,L[0]),(!k||N&16)&&ee(i,"active",L[4]),N&42&&(T=L[3],p=yt(p,N,O,1,L,T,h,d,us,Tp,null,wp),!T.length&&M?M.p(L,N):T.length?M&&(M.d(1),M=null):(M=Sp(L),M.c(),M.m(d,null))),(!k||N&64)&&ee(d,"fade",L[6]),(!k||N&8)&&ee(d,"sidebar-content-compact",L[3].length>20),L[7]?E&&(E.d(1),E=null):E?E.p(L,N):(E=Cp(L),E.c(),E.m(e,null));const q={};b.$set(q)},i(L){k||(I(b.$$.fragment,L),k=!0)},o(L){P(b.$$.fragment,L),k=!1},d(L){L&&w(e);for(let N=0;N<p.length;N+=1)p[N].d();M&&M.d(),E&&E.d(),L&&w(_),n[13](null),H(b,L),$=!1,De(C)}}}function kM(){setTimeout(()=>{const n=document.querySelector(".collection-sidebar .sidebar-list-item.active");n&&(n==null||n.scrollIntoView({block:"nearest"}))},0)}function wM(n,e,t){let i,s,l,o,r,a,u;Ze(n,fi,$=>t(5,o=$)),Ze(n,di,$=>t(9,r=$)),Ze(n,ko,$=>t(6,a=$)),Ze(n,Is,$=>t(7,u=$));let f,d="";function p($){ln(fi,o=$,o)}const h=()=>t(0,d="");function g(){d=this.value,t(0,d)}const _=()=>f==null?void 0:f.show();function b($){ne[$?"unshift":"push"](()=>{f=$,t(2,f)})}const k=$=>{var C;(C=$.detail)!=null&&C.isNew&&$.detail.collection&&p($.detail.collection)};return n.$$.update=()=>{n.$$.dirty&512&&r&&kM(),n.$$.dirty&1&&t(1,i=d.replace(/\s+/g,"").toLowerCase()),n.$$.dirty&1&&t(4,s=d!==""),n.$$.dirty&515&&t(3,l=r.filter($=>$.id==d||$.name.replace(/\s+/g,"").toLowerCase().includes(i)))},[d,i,f,l,s,o,a,u,p,r,h,g,_,b,k]}class SM extends be{constructor(e){super(),ge(this,e,wM,yM,_e,{})}}function Mp(n,e,t){const i=n.slice();return i[14]=e[t][0],i[15]=e[t][1],i}function Ep(n){n[18]=n[19].default}function Op(n,e,t){const i=n.slice();return i[14]=e[t][0],i[15]=e[t][1],i[21]=t,i}function Dp(n){let e;return{c(){e=y("hr"),m(e,"class","m-t-sm m-b-sm")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function Ap(n,e){let t,i=e[21]===Object.keys(e[6]).length,s,l,o=e[15].label+"",r,a,u,f,d=i&&Dp();function p(){return e[9](e[14])}return{key:n,first:null,c(){t=Se(),d&&d.c(),s=D(),l=y("button"),r=Y(o),a=D(),m(l,"type","button"),m(l,"class","sidebar-item"),ee(l,"active",e[5]===e[14]),this.first=t},m(h,g){S(h,t,g),d&&d.m(h,g),S(h,s,g),S(h,l,g),v(l,r),v(l,a),u||(f=J(l,"click",p),u=!0)},p(h,g){e=h,g&8&&(i=e[21]===Object.keys(e[6]).length),i?d||(d=Dp(),d.c(),d.m(s.parentNode,s)):d&&(d.d(1),d=null),g&8&&o!==(o=e[15].label+"")&&le(r,o),g&40&&ee(l,"active",e[5]===e[14])},d(h){h&&w(t),d&&d.d(h),h&&w(s),h&&w(l),u=!1,f()}}}function Ip(n){let e,t,i,s={ctx:n,current:null,token:null,hasCatch:!1,pending:CM,then:TM,catch:$M,value:19,blocks:[,,,]};return gu(t=n[15].component,s),{c(){e=Se(),s.block.c()},m(l,o){S(l,e,o),s.block.m(l,s.anchor=o),s.mount=()=>e.pare
2023-05-14 03:10:14 +08:00
form-field form-field-list form-field-file
`+(n[3].required?"required":"")+`
`+(n[8]?"dragover":"")+`
`,name:n[3].name,$$slots:{default:[U6,({uniqueId:o})=>({26:o}),({uniqueId:o})=>[o?67108864:0]]},$$scope:{ctx:n}}}),{c(){e=y("div"),B(t.$$.fragment),m(e,"class","block")},m(o,r){S(o,e,r),z(t,e,null),i=!0,s||(l=[J(e,"dragover",xe(n[23])),J(e,"dragleave",n[24]),J(e,"drop",n[14])],s=!0)},p(o,r){const a={};r[0]&264&&(a.class=`
form-field form-field-list form-field-file
`+(o[3].required?"required":"")+`
`+(o[8]?"dragover":"")+`
2023-05-14 03:23:19 +08:00
`),r[0]&8&&(a.name=o[3].name),r[0]&67110655|r[1]&4&&(a.$$scope={dirty:r,ctx:o}),t.$set(a)},i(o){i||(I(t.$$.fragment,o),i=!0)},o(o){P(t.$$.fragment,o),i=!1},d(o){o&&w(e),H(t),s=!1,De(l)}}}function Y6(n,e,t){let i,s,l,{record:o}=e,{value:r=""}=e,{uploadedFiles:a=[]}=e,{deletedFileIndexes:u=[]}=e,{field:f=new wn}=e,d,p,h=!1,g="";function _(F){U.removeByValue(u,F),t(1,u)}function b(F){U.pushUnique(u,F),t(1,u)}function k(F){U.isEmpty(a[F])||a.splice(F,1),t(0,a)}function $(){p==null||p.dispatchEvent(new CustomEvent("change",{detail:{value:r,uploadedFiles:a,deletedFileIndexes:u},bubbles:!0}))}function C(F){var j,W;F.preventDefault(),t(8,h=!1);const V=((j=F.dataTransfer)==null?void 0:j.files)||[];if(!(l||!V.length)){for(const Q of V){const X=s.length+a.length-u.length;if(((W=f.options)==null?void 0:W.maxSelect)<=X)break;a.push(Q)}t(0,a)}}Xt(async()=>{t(9,g=await de.getAdminFileToken(o.collectionId))});const T=F=>_(F),O=F=>b(F),M=F=>k(F);function E(F){ne[F?"unshift":"push"](()=>{d=F,t(6,d)})}const A=()=>{for(let F of d.files)a.push(F);t(0,a),t(6,d.value=null,d)},L=()=>d==null?void 0:d.click();function N(F){ne[F?"unshift":"push"](()=>{p=F,t(7,p)})}const q=()=>{t(8,h=!0)},R=()=>{t(8,h=!1)};return n.$$set=F=>{"record"in F&&t(2,o=F.record),"value"in F&&t(15,r=F.value),"uploadedFiles"in F&&t(0,a=F.uploadedFiles),"deletedFileIndexes"in F&&t(1,u=F.deletedFileIndexes),"field"in F&&t(3,f=F.field)},n.$$.update=()=>{var F,V;n.$$.dirty[0]&1&&(Array.isArray(a)||t(0,a=U.toArray(a))),n.$$.dirty[0]&2&&(Array.isArray(u)||t(1,u=U.toArray(u))),n.$$.dirty[0]&8&&t(5,i=((F=f.options)==null?void 0:F.maxSelect)>1),n.$$.dirty[0]&32800&&U.isEmpty(r)&&t(15,r=i?[]:""),n.$$.dirty[0]&32768&&t(4,s=U.toArray(r)),n.$$.dirty[0]&27&&t(10,l=(s.length||a.length)&&((V=f.options)==null?void 0:V.maxSelect)<=s.length+a.length-u.length),n.$$.dirty[0]&3&&(a!==-1||u!==-1)&&$()},[a,u,o,f,s,i,d,p,h,g,l,_,b,k,C,r,T,O,M,E,A,L,N,q,R]}class K6 extends be{constructor(e){super(),ge(this,e,Y6,W6,_e,{record:2,value:15,uploadedFiles:0,deletedFileIndexes:1,field:3},null,[-1,-1])}}function Bp(n){return typeof n=="function"?{threshold:100,callback:n}:n||{}}function J6(n,e){e=Bp(e),e!=null&&e.callback&&e.callback();function t(i){if(!(e!=null&&e.callback))return;i.target.scrollHeight-i.target.clientHeight-i.target.scrollTop<=e.threshold&&e.callback()}return n.addEventListener("scroll",t),n.addEventListener("resize",t),{update(i){e=Bp(i)},destroy(){n.removeEventListener("scroll",t),n.removeEventListener("resize",t)}}}const Z6=n=>({dragging:n&2,dragover:n&4}),Up=n=>({dragging:n[1],dragover:n[2]});function G6(n){let e,t,i,s;const l=n[8].default,o=kt(l,n,n[7],Up);return{c(){e=y("div"),o&&o.c(),m(e,"draggable",!0),m(e,"class","draggable svelte-28orm4"),ee(e,"dragging",n[1]),ee(e,"dragover",n[2])},m(r,a){S(r,e,a),o&&o.m(e,null),t=!0,i||(s=[J(e,"dragover",xe(n[9])),J(e,"dragleave",xe(n[10])),J(e,"dragend",n[11]),J(e,"dragstart",n[12]),J(e,"drop",n[13])],i=!0)},p(r,[a]){o&&o.p&&(!t||a&134)&&St(o,l,r,r[7],t?wt(l,r[7],a,Z6):$t(r[7]),Up),(!t||a&2)&&ee(e,"dragging",r[1]),(!t||a&4)&&ee(e,"dragover",r[2])},i(r){t||(I(o,r),t=!0)},o(r){P(o,r),t=!1},d(r){r&&w(e),o&&o.d(r),i=!1,De(s)}}}function X6(n,e,t){let{$$slots:i={},$$scope:s}=e;const l=Tt();let{index:o}=e,{list:r=[]}=e,{disabled:a=!1}=e,u=!1,f=!1;function d($,C){!$&&!a||(t(1,u=!0),$.dataTransfer.effectAllowed="move",$.dataTransfer.dropEffect="move",$.dataTransfer.setData("text/plain",C))}function p($,C){if(!$&&!a)return;t(2,f=!1),t(1,u=!1),$.dataTransfer.dropEffect="move";const T=parseInt($.dataTransfer.getData("text/plain"));T<C?(r.splice(C+1,0,r[T]),r.splice(T,1)):(r.splice(C,0,r[T]),r.splice(T+1,1)),t(5,r),l("sort",r)}const h=()=>{t(2,f=!0)},g=()=>{t(2,f=!1)},_=()=>{t(2,f=!1),t(1,u=!1)},b=$=>d($,o),k=$=>p($,o);return n.$$set=$=>{"index"in $&&t(0,o=$.index),"list"in $&&t(5,r=$.list),"disabled"in $&&t(6,a=$.disabled),"$$scope"in $&&t(7,s=$.$$scope)},[o,u,f,d,p,r,a,s,i,h,g,_,b,k]}class Q6 extends be{constructor(e){super(),ge(this,e,X6,G6,_e,{index:0,list:5,disabled:6})}}function Wp(n,e,t){const i=n.slice();i[6]=e[t];const s=U.toArray(i[0][i[
`),E&&E.c(),p=D(),g.c(),_=Se(),m(e,"class","flex m-b-base flex-gap-10"),m(l,"class","list picker-list m-b-base svelte-1u8jhky"),m(f,"class","section-title")},m(R,F){S(R,e,F),z(t,e,null),v(e,i),C&&C.m(e,null),S(R,s,F),S(R,l,F);for(let V=0;V<o.length;V+=1)o[V]&&o[V].m(l,null);M&&M.m(l,null),S(R,u,F),S(R,f,F),v(f,d),E&&E.m(f,null),S(R,p,F),L[h].m(R,F),S(R,_,F),b=!0,k||($=Oe(a=J6.call(null,l,n[36])),k=!0)},p(R,F){var W;const V={};F[0]&4&&(V.value=R[2]),F[0]&1024&&(V.autocompleteCollection=R[10]),t.$set(V),(W=R[10])!=null&&W.$isView?C&&(C.d(1),C=null):C?C.p(R,F):(C=Qp(R),C.c(),C.m(e,null)),F[0]&145324&&(T=R[3],ue(),o=yt(o,F,O,1,R,T,r,l,Kt,nm,null,Xp),fe(),!T.length&&M?M.p(R,F):T.length?M&&(M.d(1),M=null):(M=xp(R),M.c(),M.m(l,null))),a&&jt(a.update)&&F[0]&2064&&a.update.call(null,R[36]),R[5]>1?E?E.p(R,F):(E=im(R),E.c(),E.m(f,null)):E&&(E.d(1),E=null);let j=h;h=N(R),h===j?L[h].p(R,F):(ue(),P(L[j],1,1,()=>{L[j]=null}),fe(),g=L[h],g?g.p(R,F):(g=L[h]=A[h](R),g.c()),I(g,1),g.m(_.parentNode,_))},i(R){if(!b){I(t.$$.fragment,R);for(let F=0;F<T.length;F+=1)I(o[F]);I(g),b=!0}},o(R){P(t.$$.fragment,R);for(let F=0;F<o.length;F+=1)P(o[F]);P(g),b=!1},d(R){R&&w(e),H(t),C&&C.d(),R&&w(s),R&&w(l);for(let F=0;F<o.length;F+=1)o[F].d();M&&M.d(),R&&w(u),R&&w(f),E&&E.d(),R&&w(p),L[h].d(R),R&&w(_),k=!1,$()}}}function u5(n){var r;let e,t,i,s=(((r=n[10])==null?void 0:r.name)||"")+"",l,o;return{c(){e=y("h4"),t=Y("Select "),i=y("strong"),l=Y(s),o=Y(" records")},m(a,u){S(a,e,u),v(e,t),v(e,i),v(i,l),v(e,o)},p(a,u){var f;u[0]&1024&&s!==(s=(((f=a[10])==null?void 0:f.name)||"")+"")&&le(l,s)},d(a){a&&w(e)}}}function f5(n){let e,t,i,s,l;return{c(){e=y("button"),e.innerHTML='<span class="txt">Cancel</span>',t=D(),i=y("button"),i.innerHTML='<span class="txt">Set selection</span>',m(e,"type","button"),m(e,"class","btn btn-transparent"),m(i,"type","button"),m(i,"class","btn")},m(o,r){S(o,e,r),S(o,t,r),S(o,i,r),s||(l=[J(e,"click",n[28]),J(i,"click",n[29])],s=!0)},p:te,d(o){o&&w(e),o&&w(t),o&&w(i),s=!1,De(l)}}}function c5(n){let e,t,i,s;const l=[{popup:!0},{class:"overlay-panel-xl"},n[19]];let o={$$slots:{footer:[f5],header:[u5],default:[a5]},$$scope:{ctx:n}};for(let a=0;a<l.length;a+=1)o=je(o,l[a]);e=new on({props:o}),n[39](e),e.$on("hide",n[40]),e.$on("show",n[41]);let r={collection:n[10]};return i=new $1({props:r}),n[42](i),i.$on("save",n[43]),i.$on("delete",n[44]),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment)},m(a,u){z(e,a,u),S(a,t,u),z(i,a,u),s=!0},p(a,u){const f=u[0]&524288?Et(l,[l[0],l[1],Qt(a[19])]):{};u[0]&16380|u[1]&33554432&&(f.$$scope={dirty:u,ctx:a}),e.$set(f);const d={};u[0]&1024&&(d.collection=a[10]),i.$set(d)},i(a){s||(I(e.$$.fragment,a),I(i.$$.fragment,a),s=!0)},o(a){P(e.$$.fragment,a),P(i.$$.fragment,a),s=!1},d(a){n[39](null),H(e,a),a&&w(t),n[42](null),H(i,a)}}}const Nr=100;function d5(n,e,t){let i,s,l,o,r,a,u,f;const d=["value","field","show","hide"];let p=tt(e,d),h;Ze(n,di,Fe=>t(26,h=Fe));const g=Tt(),_="picker_"+U.randomString(5);let{value:b}=e,{field:k}=e,$,C,T="",O=[],M=[],E=1,A=0,L=!1,N=!1;function q(){return t(2,T=""),t(3,O=[]),t(6,M=[]),F(),V(!0),$==null?void 0:$.show()}function R(){return $==null?void 0:$.hide()}async function F(){const Fe=U.toArray(b);if(!s||!Fe.length)return;t(24,N=!0);let Ce=[];const it=Fe.slice(),It=[];for(;it.length>0;){const Vt=[];for(const Ut of it.splice(0,Nr))Vt.push(`id="${Ut}"`);It.push(de.collection(s).getFullList(Nr,{filter:Vt.join("||"),$autoCancel:!1}))}try{await Promise.all(It).then(Vt=>{Ce=Ce.concat(...Vt)}),t(6,M=[]);for(const Vt of Fe){const Ut=U.findByKey(Ce,"id",Vt);Ut&&M.push(Ut)}T.trim()||t(3,O=U.filterDuplicatesByKey(M.concat(O)))}catch(Vt){de.error(Vt)}t(24,N=!1)}async function V(Fe=!1){if(s){t(4,L=!0),Fe&&(T.trim()?t(3,O=[]):t(3,O=U.toArray(M).slice()));try{const Ce=Fe?1:E+1,it=U.getAllCollectionIdentifiers(o),It=await de.collection(s).getList(Ce,Nr,{filter:U.normalizeSearchFilter(T,it),sort:o!=null&&o.$isView?"":"-created",$cancelKey:_+"loadList"});t(3,O=U.filterDuplicatesByKey(O.concat(It.items))),E=It.page,t(23,A=It.totalItems)}catch(Ce){de.error(Ce)}t(4,L=!1)}}function j(Fe){i==1?t(6,M=
`,m(e,"class","list-item")},m(t,i){S(t,e,i)},p:te,d(t){t&&w(e)}}}function fm(n,e){var h;let t,i,s,l,o,r,a,u,f,d;s=new nr({props:{record:e[17],displayFields:(h=e[2].options)==null?void 0:h.displayFields}});function p(){return e[9](e[17])}return{key:n,first:null,c(){t=y("div"),i=y("div"),B(s.$$.fragment),l=D(),o=y("div"),r=y("button"),r.innerHTML='<i class="ri-close-line"></i>',a=D(),m(i,"class","content"),m(r,"type","button"),m(r,"class","btn btn-transparent btn-hint btn-sm btn-circle btn-remove"),m(o,"class","actions"),m(t,"class","list-item"),this.first=t},m(g,_){S(g,t,_),v(t,i),z(s,i,null),v(t,l),v(t,o),v(o,r),v(t,a),u=!0,f||(d=[Oe(Be.call(null,r,"Remove")),J(r,"click",p)],f=!0)},p(g,_){var k;e=g;const b={};_&16&&(b.record=e[17]),_&4&&(b.displayFields=(k=e[2].options)==null?void 0:k.displayFields),s.$set(b)},i(g){u||(I(s.$$.fragment,g),u=!0)},o(g){P(s.$$.fragment,g),u=!1},d(g){g&&w(t),H(s),f=!1,De(d)}}}function m5(n){let e,t,i,s,l,o=n[2].name+"",r,a,u,f,d,p=[],h=new Map,g,_,b,k,$,C,T=n[4];const O=E=>E[17].id;for(let E=0;E<T.length;E+=1){let A=lm(n,T,E),L=O(A);h.set(L,p[E]=fm(L,A))}let M=null;return T.length||(M=rm(n)),{c(){e=y("label"),t=y("i"),s=D(),l=y("span"),r=Y(o),u=D(),f=y("div"),d=y("div");for(let E=0;E<p.length;E+=1)p[E].c();M&&M.c(),g=D(),_=y("div"),b=y("button"),b.innerHTML=`<i class="ri-magic-line"></i>
2023-05-14 03:10:14 +08:00
2023-05-14 03:23:19 +08:00
<span class="txt">Open picker</span>`,m(t,"class",i=os(U.getFieldTypeIcon(n[2].type))+" svelte-1ynw0pc"),m(l,"class","txt"),m(e,"for",a=n[16]),m(d,"class","relations-list svelte-1ynw0pc"),m(b,"type","button"),m(b,"class","btn btn-transparent btn-sm btn-block"),m(_,"class","list-item list-item-btn"),m(f,"class","list")},m(E,A){S(E,e,A),v(e,t),v(e,s),v(e,l),v(l,r),S(E,u,A),S(E,f,A),v(f,d);for(let L=0;L<p.length;L+=1)p[L]&&p[L].m(d,null);M&&M.m(d,null),v(f,g),v(f,_),v(_,b),k=!0,$||(C=J(b,"click",n[10]),$=!0)},p(E,A){(!k||A&4&&i!==(i=os(U.getFieldTypeIcon(E[2].type))+" svelte-1ynw0pc"))&&m(t,"class",i),(!k||A&4)&&o!==(o=E[2].name+"")&&le(r,o),(!k||A&65536&&a!==(a=E[16]))&&m(e,"for",a),A&181&&(T=E[4],ue(),p=yt(p,A,O,1,E,T,h,d,Kt,fm,null,lm),fe(),!T.length&&M?M.p(E,A):T.length?M&&(M.d(1),M=null):(M=rm(E),M.c(),M.m(d,null)))},i(E){if(!k){for(let A=0;A<T.length;A+=1)I(p[A]);k=!0}},o(E){for(let A=0;A<p.length;A+=1)P(p[A]);k=!1},d(E){E&&w(e),E&&w(u),E&&w(f);for(let A=0;A<p.length;A+=1)p[A].d();M&&M.d(),$=!1,C()}}}function h5(n){let e,t,i,s,l={class:"form-field form-field-list "+(n[2].required?"required":""),name:n[2].name,$$slots:{default:[m5,({uniqueId:r})=>({16:r}),({uniqueId:r})=>r?65536:0]},$$scope:{ctx:n}};e=new pe({props:l}),n[11](e);let o={value:n[0],field:n[2]};return i=new p5({props:o}),n[12](i),i.$on("save",n[13]),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment)},m(r,a){z(e,r,a),S(r,t,a),z(i,r,a),s=!0},p(r,[a]){const u={};a&4&&(u.class="form-field form-field-list "+(r[2].required?"required":"")),a&4&&(u.name=r[2].name),a&8454199&&(u.$$scope={dirty:a,ctx:r}),e.$set(u);const f={};a&1&&(f.value=r[0]),a&4&&(f.field=r[2]),i.$set(f)},i(r){s||(I(e.$$.fragment,r),I(i.$$.fragment,r),s=!0)},o(r){P(e.$$.fragment,r),P(i.$$.fragment,r),s=!1},d(r){n[11](null),H(e,r),r&&w(t),n[12](null),H(i,r)}}}const cm=100;function _5(n,e,t){let i,{value:s}=e,{picker:l}=e,{field:o=new wn}=e,r,a=[],u=!1,f;function d(){if(u)return!1;const C=U.toArray(s);return t(4,a=a.filter(T=>C.includes(T.id))),C.length!=a.length}async function p(){var M,E;const C=U.toArray(s);if(t(4,a=[]),!((M=o==null?void 0:o.options)!=null&&M.collectionId)||!C.length){t(5,u=!1);return}t(5,u=!0);const T=C.slice(),O=[];for(;T.length>0;){const A=[];for(const L of T.splice(0,cm))A.push(`id="${L}"`);O.push(de.collection((E=o==null?void 0:o.options)==null?void 0:E.collectionId).getFullList(cm,{filter:A.join("||"),$autoCancel:!1}))}try{let A=[];await Promise.all(O).then(L=>{A=A.concat(...L)});for(const L of C){const N=U.findByKey(A,"id",L);N&&a.push(N)}t(4,a)}catch(A){de.error(A)}t(5,u=!1)}function h(C){var T;U.removeByKey(a,"id",C.id),t(4,a),i?t(0,s=a.map(O=>O.id)):t(0,s=((T=a[0])==null?void 0:T.id)||"")}jo(()=>{clearTimeout(f)});const g=C=>h(C),_=()=>l==null?void 0:l.show();function b(C){ne[C?"unshift":"push"](()=>{r=C,t(3,r)})}function k(C){ne[C?"unshift":"push"](()=>{l=C,t(1,l)})}const $=C=>{var T;t(4,a=C.detail||[]),t(0,s=i?a.map(O=>O.id):((T=a[0])==null?void 0:T.id)||"")};return n.$$set=C=>{"value"in C&&t(0,s=C.value),"picker"in C&&t(1,l=C.picker),"field"in C&&t(2,o=C.field)},n.$$.update=()=>{var C;n.$$.dirty&4&&t(6,i=((C=o.options)==null?void 0:C.maxSelect)!=1),n.$$.dirty&9&&typeof s<"u"&&(r==null||r.changed()),n.$$.dirty&273&&d()&&(clearTimeout(f),t(8,f=setTimeout(p,0)))},[s,l,o,r,a,u,i,h,f,g,_,b,k,$]}class g5 extends be{constructor(e){super(),ge(this,e,_5,h5,_e,{value:0,picker:1,field:2})}}const b5=["Activate","AddUndo","BeforeAddUndo","BeforeExecCommand","BeforeGetContent","BeforeRenderUI","BeforeSetContent","BeforePaste","Blur","Change","ClearUndos","Click","ContextMenu","Copy","Cut","Dblclick","Deactivate","Dirty","Drag","DragDrop","DragEnd","DragGesture","DragOver","Drop","ExecCommand","Focus","FocusIn","FocusOut","GetContent","Hide","Init","KeyDown","KeyPress","KeyUp","LoadContent","MouseDown","MouseEnter","MouseLeave","MouseMove","MouseOut","MouseOver","MouseUp","NodeChange","ObjectResizeStart","ObjectResized","ObjectSelected","Paste","PostProcess","PostRender","PreProcess","ProgressState","Redo","Remove","Reset","ResizeEditor","SaveContent","SelectionChange",
2023-05-14 03:10:14 +08:00
...
2023-05-14 03:23:19 +08:00
-----END PRIVATE KEY-----`),m(a,"class","help-block")},m(d,p){S(d,e,p),v(e,t),S(d,s,p),S(d,l,p),ae(l,n[5]),S(d,r,p),S(d,a,p),u||(f=J(l,"input",n[16]),u=!0)},p(d,p){p&8388608&&i!==(i=d[23])&&m(e,"for",i),p&8388608&&o!==(o=d[23])&&m(l,"id",o),p&32&&ae(l,d[5])},d(d){d&&w(e),d&&w(s),d&&w(l),d&&w(r),d&&w(a),u=!1,f()}}}function G5(n){let e,t,i,s,l,o,r,a,u,f,d,p,h,g,_,b,k,$;return s=new pe({props:{class:"form-field required",name:"clientId",$$slots:{default:[W5,({uniqueId:C})=>({23:C}),({uniqueId:C})=>C?8388608:0]},$$scope:{ctx:n}}}),r=new pe({props:{class:"form-field required",name:"teamId",$$slots:{default:[Y5,({uniqueId:C})=>({23:C}),({uniqueId:C})=>C?8388608:0]},$$scope:{ctx:n}}}),f=new pe({props:{class:"form-field required",name:"keyId",$$slots:{default:[K5,({uniqueId:C})=>({23:C}),({uniqueId:C})=>C?8388608:0]},$$scope:{ctx:n}}}),h=new pe({props:{class:"form-field required",name:"duration",$$slots:{default:[J5,({uniqueId:C})=>({23:C}),({uniqueId:C})=>C?8388608:0]},$$scope:{ctx:n}}}),_=new pe({props:{class:"form-field required",name:"privateKey",$$slots:{default:[Z5,({uniqueId:C})=>({23:C}),({uniqueId:C})=>C?8388608:0]},$$scope:{ctx:n}}}),{c(){e=y("form"),t=y("div"),i=y("div"),B(s.$$.fragment),l=D(),o=y("div"),B(r.$$.fragment),a=D(),u=y("div"),B(f.$$.fragment),d=D(),p=y("div"),B(h.$$.fragment),g=D(),B(_.$$.fragment),m(i,"class","col-lg-6"),m(o,"class","col-lg-6"),m(u,"class","col-lg-6"),m(p,"class","col-lg-6"),m(t,"class","grid"),m(e,"id",n[9]),m(e,"autocomplete","off")},m(C,T){S(C,e,T),v(e,t),v(t,i),z(s,i,null),v(t,l),v(t,o),z(r,o,null),v(t,a),v(t,u),z(f,u,null),v(t,d),v(t,p),z(h,p,null),v(t,g),z(_,t,null),b=!0,k||($=J(e,"submit",xe(n[17])),k=!0)},p(C,T){const O={};T&25165828&&(O.$$scope={dirty:T,ctx:C}),s.$set(O);const M={};T&25165832&&(M.$$scope={dirty:T,ctx:C}),r.$set(M);const E={};T&25165840&&(E.$$scope={dirty:T,ctx:C}),f.$set(E);const A={};T&25165888&&(A.$$scope={dirty:T,ctx:C}),h.$set(A);const L={};T&25165856&&(L.$$scope={dirty:T,ctx:C}),_.$set(L)},i(C){b||(I(s.$$.fragment,C),I(r.$$.fragment,C),I(f.$$.fragment,C),I(h.$$.fragment,C),I(_.$$.fragment,C),b=!0)},o(C){P(s.$$.fragment,C),P(r.$$.fragment,C),P(f.$$.fragment,C),P(h.$$.fragment,C),P(_.$$.fragment,C),b=!1},d(C){C&&w(e),H(s),H(r),H(f),H(h),H(_),k=!1,$()}}}function X5(n){let e;return{c(){e=y("h4"),e.textContent="Generate Apple client secret",m(e,"class","center txt-break")},m(t,i){S(t,e,i)},p:te,d(t){t&&w(e)}}}function Q5(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=y("button"),t=Y("Close"),i=D(),s=y("button"),l=y("i"),o=D(),r=y("span"),r.textContent="Generate and set secret",m(e,"type","button"),m(e,"class","btn btn-transparent"),e.disabled=n[7],m(l,"class","ri-key-line"),m(r,"class","txt"),m(s,"type","submit"),m(s,"form",n[9]),m(s,"class","btn btn-expanded"),s.disabled=a=!n[8]||n[7],ee(s,"btn-loading",n[7])},m(d,p){S(d,e,p),v(e,t),S(d,i,p),S(d,s,p),v(s,l),v(s,o),v(s,r),u||(f=J(e,"click",n[0]),u=!0)},p(d,p){p&128&&(e.disabled=d[7]),p&384&&a!==(a=!d[8]||d[7])&&(s.disabled=a),p&128&&ee(s,"btn-loading",d[7])},d(d){d&&w(e),d&&w(i),d&&w(s),u=!1,f()}}}function x5(n){let e,t,i={overlayClose:!n[7],escClose:!n[7],beforeHide:n[18],popup:!0,$$slots:{footer:[Q5],header:[X5],default:[G5]},$$scope:{ctx:n}};return e=new on({props:i}),n[19](e),e.$on("show",n[20]),e.$on("hide",n[21]),{c(){B(e.$$.fragment)},m(s,l){z(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||(I(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[19](null),H(e,s)}}}const po=15777e3;function eE(n,e,t){let i;const s=Tt(),l="apple_secret_"+U.randomString(5);let o,r,a,u,f,d,p=!1;function h(N={}){t(2,r=N.clientId||""),t(3,a=N.teamId||""),t(4,u=N.keyId||""),t(5,f=N.privateKey||""),t(6,d=N.duration||po),tn({}),o==null||o.show()}function g(){return o==null?void 0:o.hide()}async function _(){t(7,p=!0);try{const N=await de.settings.generateAppleClientSecret(r,a,u,f.trim(),d);t(7,p=!1),Ht("Successfully generated client secret."),s("submit",N),o==null||o.hide()}catch(N){de.error(N)}t(7,p=!1)
`),r=y("button"),r.textContent="Restore draft",a=D(),u=y("button"),u.innerHTML='<i class="ri-close-line"></i>',f=D(),d=y("div"),m(i,"class","icon"),m(r,"type","button"),m(r,"class","btn btn-sm btn-secondary"),m(l,"class","content"),m(u,"type","button"),m(u,"class","close"),m(u,"aria-label","Discard draft"),m(t,"class","alert alert-info m-0"),m(d,"class","clearfix p-b-base"),m(e,"class","block")},m(b,k){S(b,e,k),v(e,t),v(t,i),v(t,s),v(t,l),v(l,o),v(l,r),v(t,a),v(t,u),v(e,f),v(e,d),h=!0,g||(_=[J(r,"click",n[36]),Oe(Be.call(null,u,"Discard draft")),J(u,"click",xe(n[37]))],g=!0)},p:te,i(b){h||(p&&p.end(1),h=!0)},o(b){p=$a(e,rt,{duration:150}),h=!1},d(b){b&&w(e),b&&p&&p.end(),g=!1,De(_)}}}function gm(n){let e,t,i,s,l;return{c(){e=y("div"),t=y("i"),m(t,"class","ri-calendar-event-line txt-disabled"),m(e,"class","form-field-addon")},m(o,r){S(o,e,r),v(e,t),s||(l=Oe(i=Be.call(null,t,{text:`Created: ${n[3].created}
2023-05-14 03:10:14 +08:00
Updated: ${n[3].updated}`,position:"left"})),s=!0)},p(o,r){i&&jt(i.update)&&r[0]&8&&i.update.call(null,{text:`Created: ${o[3].created}
2023-05-14 03:23:19 +08:00
Updated: ${o[3].updated}`,position:"left"})},d(o){o&&w(e),s=!1,l()}}}function cE(n){let e,t,i,s,l,o,r,a,u,f,d,p,h,g,_=!n[6]&&gm(n);return{c(){e=y("label"),t=y("i"),i=D(),s=y("span"),s.textContent="id",l=D(),o=y("span"),a=D(),_&&_.c(),u=D(),f=y("input"),m(t,"class",os(U.getFieldTypeIcon("primary"))+" svelte-qc5ngu"),m(s,"class","txt"),m(o,"class","flex-fill"),m(e,"for",r=n[69]),m(f,"type","text"),m(f,"id",d=n[69]),m(f,"placeholder","Leave empty to auto generate..."),m(f,"minlength","15"),f.readOnly=p=!n[6]},m(b,k){S(b,e,k),v(e,t),v(e,i),v(e,s),v(e,l),v(e,o),S(b,a,k),_&&_.m(b,k),S(b,u,k),S(b,f,k),ae(f,n[3].id),h||(g=J(f,"input",n[38]),h=!0)},p(b,k){k[2]&128&&r!==(r=b[69])&&m(e,"for",r),b[6]?_&&(_.d(1),_=null):_?_.p(b,k):(_=gm(b),_.c(),_.m(u.parentNode,u)),k[2]&128&&d!==(d=b[69])&&m(f,"id",d),k[0]&64&&p!==(p=!b[6])&&(f.readOnly=p),k[0]&8&&f.value!==b[3].id&&ae(f,b[3].id)},d(b){b&&w(e),b&&w(a),_&&_.d(b),b&&w(u),b&&w(f),h=!1,g()}}}function bm(n){var u,f;let e,t,i,s,l;function o(d){n[39](d)}let r={isNew:n[6],collection:n[0]};n[3]!==void 0&&(r.record=n[3]),e=new VM({props:r}),ne.push(()=>he(e,"record",o));let a=((f=(u=n[0])==null?void 0:u.schema)==null?void 0:f.length)&&vm();return{c(){B(e.$$.fragment),i=D(),a&&a.c(),s=Se()},m(d,p){z(e,d,p),S(d,i,p),a&&a.m(d,p),S(d,s,p),l=!0},p(d,p){var g,_;const h={};p[0]&64&&(h.isNew=d[6]),p[0]&1&&(h.collection=d[0]),!t&&p[0]&8&&(t=!0,h.record=d[3],ye(()=>t=!1)),e.$set(h),(_=(g=d[0])==null?void 0:g.schema)!=null&&_.length?a||(a=vm(),a.c(),a.m(s.parentNode,s)):a&&(a.d(1),a=null)},i(d){l||(I(e.$$.fragment,d),l=!0)},o(d){P(e.$$.fragment,d),l=!1},d(d){H(e,d),d&&w(i),a&&a.d(d),d&&w(s)}}}function vm(n){let e;return{c(){e=y("hr")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function dE(n){let e,t,i;function s(o){n[52](o,n[66])}let l={field:n[66]};return n[3][n[66].name]!==void 0&&(l.value=n[3][n[66].name]),e=new g5({props:l}),ne.push(()=>he(e,"value",s)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[66]),!t&&r[0]&9&&(t=!0,a.value=n[3][n[66].name],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function pE(n){let e,t,i,s,l;function o(f){n[49](f,n[66])}function r(f){n[50](f,n[66])}function a(f){n[51](f,n[66])}let u={field:n[66],record:n[3]};return n[3][n[66].name]!==void 0&&(u.value=n[3][n[66].name]),n[4][n[66].name]!==void 0&&(u.uploadedFiles=n[4][n[66].name]),n[5][n[66].name]!==void 0&&(u.deletedFileIndexes=n[5][n[66].name]),e=new K6({props:u}),ne.push(()=>he(e,"value",o)),ne.push(()=>he(e,"uploadedFiles",r)),ne.push(()=>he(e,"deletedFileIndexes",a)),{c(){B(e.$$.fragment)},m(f,d){z(e,f,d),l=!0},p(f,d){n=f;const p={};d[0]&1&&(p.field=n[66]),d[0]&8&&(p.record=n[3]),!t&&d[0]&9&&(t=!0,p.value=n[3][n[66].name],ye(()=>t=!1)),!i&&d[0]&17&&(i=!0,p.uploadedFiles=n[4][n[66].name],ye(()=>i=!1)),!s&&d[0]&33&&(s=!0,p.deletedFileIndexes=n[5][n[66].name],ye(()=>s=!1)),e.$set(p)},i(f){l||(I(e.$$.fragment,f),l=!0)},o(f){P(e.$$.fragment,f),l=!1},d(f){H(e,f)}}}function mE(n){let e,t,i;function s(o){n[48](o,n[66])}let l={field:n[66]};return n[3][n[66].name]!==void 0&&(l.value=n[3][n[66].name]),e=new k6({props:l}),ne.push(()=>he(e,"value",s)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[66]),!t&&r[0]&9&&(t=!0,a.value=n[3][n[66].name],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function hE(n){let e,t,i;function s(o){n[47](o,n[66])}let l={field:n[66]};return n[3][n[66].name]!==void 0&&(l.value=n[3][n[66].name]),e=new g6({props:l}),ne.push(()=>he(e,"value",s)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[66]),!t&&r[0]&9&&(t=!0,a.value=n[3][n[66].name],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function _E(n){let e,t,i;function s(o){n[46](o,n[66])}let l={field:n[66]};return n[3][n[66].name]!==void 0&&(l.value=n[3][n[66].name]),e=new p6({props:l}),ne.push(()=>he(e,"value",s)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){n=o;const a={};
<span class="txt">Send verification email</span>`,m(e,"type","button"),m(e,"class","dropdown-item closable")},m(s,l){S(s,e,l),t||(i=J(e,"click",n[30]),t=!0)},p:te,d(s){s&&w(e),t=!1,i()}}}function $m(n){let e,t,i;return{c(){e=y("button"),e.innerHTML=`<i class="ri-mail-lock-line"></i>
<span class="txt">Send password reset email</span>`,m(e,"type","button"),m(e,"class","dropdown-item closable")},m(s,l){S(s,e,l),t||(i=J(e,"click",n[31]),t=!0)},p:te,d(s){s&&w(e),t=!1,i()}}}function $E(n){let e,t,i,s,l,o,r,a=n[0].$isAuth&&!n[2].verified&&n[2].email&&Sm(n),u=n[0].$isAuth&&n[2].email&&$m(n);return{c(){a&&a.c(),e=D(),u&&u.c(),t=D(),i=y("button"),i.innerHTML=`<i class="ri-file-copy-line"></i>
2023-05-14 03:10:14 +08:00
<span class="txt">Duplicate</span>`,s=D(),l=y("button"),l.innerHTML=`<i class="ri-delete-bin-7-line"></i>
2023-05-14 03:23:19 +08:00
<span class="txt">Delete</span>`,m(i,"type","button"),m(i,"class","dropdown-item closable"),m(l,"type","button"),m(l,"class","dropdown-item txt-danger closable")},m(f,d){a&&a.m(f,d),S(f,e,d),u&&u.m(f,d),S(f,t,d),S(f,i,d),S(f,s,d),S(f,l,d),o||(r=[J(i,"click",n[32]),J(l,"click",In(xe(n[33])))],o=!0)},p(f,d){f[0].$isAuth&&!f[2].verified&&f[2].email?a?a.p(f,d):(a=Sm(f),a.c(),a.m(e.parentNode,e)):a&&(a.d(1),a=null),f[0].$isAuth&&f[2].email?u?u.p(f,d):(u=$m(f),u.c(),u.m(t.parentNode,t)):u&&(u.d(1),u=null)},d(f){a&&a.d(f),f&&w(e),u&&u.d(f),f&&w(t),f&&w(i),f&&w(s),f&&w(l),o=!1,De(r)}}}function Tm(n){let e,t,i,s,l,o;return{c(){e=y("div"),t=y("button"),t.textContent="Account",i=D(),s=y("button"),s.textContent="Authorized providers",m(t,"type","button"),m(t,"class","tab-item"),ee(t,"active",n[12]===ls),m(s,"type","button"),m(s,"class","tab-item"),ee(s,"active",n[12]===Sl),m(e,"class","tabs-header stretched")},m(r,a){S(r,e,a),v(e,t),v(e,i),v(e,s),l||(o=[J(t,"click",n[34]),J(s,"click",n[35])],l=!0)},p(r,a){a[0]&4096&&ee(t,"active",r[12]===ls),a[0]&4096&&ee(s,"active",r[12]===Sl)},d(r){r&&w(e),l=!1,De(o)}}}function TE(n){var _;let e,t=n[6]?"New":"Edit",i,s,l,o=((_=n[0])==null?void 0:_.name)+"",r,a,u,f,d,p,h=!n[6]&&wm(n),g=n[0].$isAuth&&!n[6]&&Tm(n);return{c(){e=y("h4"),i=Y(t),s=D(),l=y("strong"),r=Y(o),a=Y(" record"),u=D(),h&&h.c(),f=D(),g&&g.c(),d=Se(),m(e,"class","panel-title svelte-qc5ngu")},m(b,k){S(b,e,k),v(e,i),v(e,s),v(e,l),v(l,r),v(e,a),S(b,u,k),h&&h.m(b,k),S(b,f,k),g&&g.m(b,k),S(b,d,k),p=!0},p(b,k){var $;(!p||k[0]&64)&&t!==(t=b[6]?"New":"Edit")&&le(i,t),(!p||k[0]&1)&&o!==(o=(($=b[0])==null?void 0:$.name)+"")&&le(r,o),b[6]?h&&(ue(),P(h,1,1,()=>{h=null}),fe()):h?(h.p(b,k),k[0]&64&&I(h,1)):(h=wm(b),h.c(),I(h,1),h.m(f.parentNode,f)),b[0].$isAuth&&!b[6]?g?g.p(b,k):(g=Tm(b),g.c(),g.m(d.parentNode,d)):g&&(g.d(1),g=null)},i(b){p||(I(h),p=!0)},o(b){P(h),p=!1},d(b){b&&w(e),b&&w(u),h&&h.d(b),b&&w(f),g&&g.d(b),b&&w(d)}}}function CE(n){let e,t,i,s,l,o=n[6]?"Create":"Save changes",r,a,u,f;return{c(){e=y("button"),t=y("span"),t.textContent="Cancel",i=D(),s=y("button"),l=y("span"),r=Y(o),m(t,"class","txt"),m(e,"type","button"),m(e,"class","btn btn-transparent"),e.disabled=n[10],m(l,"class","txt"),m(s,"type","submit"),m(s,"form",n[15]),m(s,"class","btn btn-expanded"),s.disabled=a=!n[13]||n[10],ee(s,"btn-loading",n[10])},m(d,p){S(d,e,p),v(e,t),S(d,i,p),S(d,s,p),v(s,l),v(l,r),u||(f=J(e,"click",n[29]),u=!0)},p(d,p){p[0]&1024&&(e.disabled=d[10]),p[0]&64&&o!==(o=d[6]?"Create":"Save changes")&&le(r,o),p[0]&9216&&a!==(a=!d[13]||d[10])&&(s.disabled=a),p[0]&1024&&ee(s,"btn-loading",d[10])},d(d){d&&w(e),d&&w(i),d&&w(s),u=!1,f()}}}function ME(n){var s;let e,t,i={class:`
2023-05-14 03:10:14 +08:00
record-panel
`+(n[14]?"overlay-panel-xl":"overlay-panel-lg")+`
`+((s=n[0])!=null&&s.$isAuth&&!n[6]?"colored-header":"")+`
`,beforeHide:n[53],$$slots:{footer:[CE],header:[TE],default:[SE]},$$scope:{ctx:n}};return e=new on({props:i}),n[54](e),e.$on("hide",n[55]),e.$on("show",n[56]),{c(){B(e.$$.fragment)},m(l,o){z(e,l,o),t=!0},p(l,o){var a;const r={};o[0]&16449&&(r.class=`
record-panel
`+(l[14]?"overlay-panel-xl":"overlay-panel-lg")+`
`+((a=l[0])!=null&&a.$isAuth&&!l[6]?"colored-header":"")+`
2023-05-14 03:23:19 +08:00
`),o[0]&2176&&(r.beforeHide=l[53]),o[0]&14077|o[2]&256&&(r.$$scope={dirty:o,ctx:l}),e.$set(r)},i(l){t||(I(e.$$.fragment,l),t=!0)},o(l){P(e.$$.fragment,l),t=!1},d(l){n[54](null),H(e,l)}}}const ls="form",Sl="providers";function EE(n,e,t){let i,s,l,o;const r=Tt(),a="record_"+U.randomString(5);let{collection:u}=e,f,d=null,p=null,h=null,g=!1,_=!1,b={},k={},$=JSON.stringify(null),C=$,T=ls,O=!0,M=!1;function E(ke){return L(ke),t(11,_=!0),t(12,T=ls),f==null?void 0:f.show()}function A(){return f==null?void 0:f.hide()}async function L(ke){t(27,M=!1),tn({}),t(2,d=ke||new wi),t(3,p=d.$clone()),t(4,b={}),t(5,k={}),await cn(),t(9,h=R()),!h||j(p,h)?t(9,h=null):(delete h.password,delete h.passwordConfirm),t(25,$=JSON.stringify(p)),t(27,M=!0)}async function N(ke){var Re,Qe;tn({}),t(2,d=ke||new wi),t(4,b={}),t(5,k={});const Ie=((Qe=(Re=u==null?void 0:u.schema)==null?void 0:Re.filter(Ot=>Ot.type!="file"))==null?void 0:Qe.map(Ot=>Ot.name))||[];for(let Ot in ke.$export())Ie.includes(Ot)||t(3,p[Ot]=ke[Ot],p);await cn(),t(25,$=JSON.stringify(p)),W()}function q(){return"record_draft_"+((u==null?void 0:u.id)||"")+"_"+((d==null?void 0:d.id)||"")}function R(ke){try{const Ie=window.localStorage.getItem(q());if(Ie)return new wi(JSON.parse(Ie))}catch{}return ke}function F(ke){window.localStorage.setItem(q(),ke)}function V(){h&&(t(3,p=h),t(9,h=null))}function j(ke,Ie){var Tn;const Re=ke==null?void 0:ke.$clone(),Qe=Ie==null?void 0:Ie.$clone(),Ot=(Tn=u==null?void 0:u.schema)==null?void 0:Tn.filter(Nn=>Nn.type==="file");for(let Nn of Ot)Re==null||delete Re[Nn.name],Qe==null||delete Qe[Nn.name];return Re==null||delete Re.password,Re==null||delete Re.passwordConfirm,Qe==null||delete Qe.password,Qe==null||delete Qe.passwordConfirm,JSON.stringify(Re)==JSON.stringify(Qe)}function W(){t(9,h=null),window.localStorage.removeItem(q())}function Q(ke=!0){if(g||!o||!(u!=null&&u.id))return;t(10,g=!0);const Ie=Z();let Re;O?Re=de.collection(u.id).create(Ie):Re=de.collection(u.id).update(p.id,Ie),Re.then(Qe=>{Ht(O?"Successfully created record.":"Successfully updated record."),W(),ke?(t(11,_=!1),A()):N(Qe),r("save",Qe)}).catch(Qe=>{de.error(Qe)}).finally(()=>{t(10,g=!1)})}function X(){d!=null&&d.id&&mn("Do you really want to delete the selected record?",()=>de.collection(d.collectionId).delete(d.id).then(()=>{A(),Ht("Successfully deleted record."),r("delete",d)}).catch(ke=>{de.error(ke)}))}function Z(){const ke=(p==null?void 0:p.$export())||{},Ie=new FormData,Re={id:ke.id};for(const Qe of(u==null?void 0:u.schema)||[])Re[Qe.name]=!0;u!=null&&u.isAuth&&(Re.username=!0,Re.email=!0,Re.emailVisibility=!0,Re.password=!0,Re.passwordConfirm=!0,Re.verified=!0);for(const Qe in ke)Re[Qe]&&(typeof ke[Qe]>"u"&&(ke[Qe]=null),U.addValueToFormData(Ie,Qe,ke[Qe]));for(const Qe in b){const Ot=U.toArray(b[Qe]);for(const Tn of Ot)Ie.append(Qe,Tn)}for(const Qe in k){const Ot=U.toArray(k[Qe]);for(const Tn of Ot)Ie.append(Qe+"."+Tn,"")}return Ie}function re(){!(u!=null&&u.id)||!(d!=null&&d.email)||mn(`Do you really want to sent verification email to ${d.email}?`,()=>de.collection(u.id).requestVerification(d.email).then(()=>{Ht(`Successfully sent verification email to ${d.email}.`)}).catch(ke=>{de.error(ke)}))}function x(){!(u!=null&&u.id)||!(d!=null&&d.email)||mn(`Do you really want to sent password reset email to ${d.email}?`,()=>de.collection(u.id).requestPasswordReset(d.email).then(()=>{Ht(`Successfully sent password reset email to ${d.email}.`)}).catch(ke=>{de.error(ke)}))}function se(){l?mn("You have unsaved changes. Do you really want to discard them?",()=>{ve()}):ve()}async function ve(){const ke=d==null?void 0:d.$clone();if(ke){ke.id="",ke.created="",ke.updated="";const Ie=(u==null?void 0:u.schema)||[];for(const Re of Ie)Re.type==="file"&&delete ke[Re.name]}W(),E(ke),await cn(),t(25,$="")}function $e(ke){(ke.ctrlKey||ke.metaKey)&&ke.code=="KeyS"&&(ke.preventDefault(),ke.stopPropagation(),Q(!1))}const ze=()=>A(),Ue=()=>re(),we=()=>x(),Ee=()=>se(),Ge=()=>X(),_t=()=>t(12,T=ls),Xe=()=>t(12,T=Sl),Ke=()=>V(),Te=()=>W();function ce(){p.id=this.value,t(3,p)}function He(ke){p=ke,t(3,p)}func
`},m(t,i){S(t,e,i)},p:te,d(t){t&&w(e)}}}function _O(n){let e,t,i;return{c(){e=y("button"),e.innerHTML=`<i class="ri-add-line"></i>
<span class="txt">New record</span>`,m(e,"type","button"),m(e,"class","btn btn-secondary btn-expanded m-t-sm")},m(s,l){S(s,e,l),t||(i=J(e,"click",n[40]),t=!0)},p:te,d(s){s&&w(e),t=!1,i()}}}function gO(n){let e,t,i;return{c(){e=y("button"),e.innerHTML='<span class="txt">Clear filters</span>',m(e,"type","button"),m(e,"class","btn btn-hint btn-expanded m-t-sm")},m(s,l){S(s,e,l),t||(i=J(e,"click",n[39]),t=!0)},p:te,d(s){s&&w(e),t=!1,i()}}}function th(n){let e,t,i,s,l,o,r,a,u,f;function d(){return n[36](n[55])}return{c(){e=y("td"),t=y("div"),i=y("input"),o=D(),r=y("label"),m(i,"type","checkbox"),m(i,"id",s="checkbox_"+n[55].id),i.checked=l=n[6][n[55].id],m(r,"for",a="checkbox_"+n[55].id),m(t,"class","form-field"),m(e,"class","bulk-select-col min-width")},m(p,h){S(p,e,h),v(e,t),v(t,i),v(t,o),v(t,r),u||(f=[J(i,"change",d),J(t,"click",In(n[26]))],u=!0)},p(p,h){n=p,h[0]&16&&s!==(s="checkbox_"+n[55].id)&&m(i,"id",s),h[0]&80&&l!==(l=n[6][n[55].id])&&(i.checked=l),h[0]&16&&a!==(a="checkbox_"+n[55].id)&&m(r,"for",a)},d(p){p&&w(e),u=!1,De(f)}}}function nh(n){let e,t,i,s,l,o,r=n[55].id+"",a,u,f;s=new Nl({props:{value:n[55].id}});let d=n[2].$isAuth&&ih(n);return{c(){e=y("td"),t=y("div"),i=y("div"),B(s.$$.fragment),l=D(),o=y("div"),a=Y(r),u=D(),d&&d.c(),m(o,"class","txt"),m(i,"class","label"),m(t,"class","flex flex-gap-5"),m(e,"class","col-type-text col-field-id")},m(p,h){S(p,e,h),v(e,t),v(t,i),z(s,i,null),v(i,l),v(i,o),v(o,a),v(t,u),d&&d.m(t,null),f=!0},p(p,h){const g={};h[0]&16&&(g.value=p[55].id),s.$set(g),(!f||h[0]&16)&&r!==(r=p[55].id+"")&&le(a,r),p[2].$isAuth?d?d.p(p,h):(d=ih(p),d.c(),d.m(t,null)):d&&(d.d(1),d=null)},i(p){f||(I(s.$$.fragment,p),f=!0)},o(p){P(s.$$.fragment,p),f=!1},d(p){p&&w(e),H(s),d&&d.d()}}}function ih(n){let e;function t(l,o){return l[55].verified?vO:bO}let i=t(n),s=i(n);return{c(){s.c(),e=Se()},m(l,o){s.m(l,o),S(l,e,o)},p(l,o){i!==(i=t(l))&&(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&w(e)}}}function bO(n){let e,t,i;return{c(){e=y("i"),m(e,"class","ri-error-warning-fill txt-sm txt-hint")},m(s,l){S(s,e,l),t||(i=Oe(Be.call(null,e,"Unverified")),t=!0)},d(s){s&&w(e),t=!1,i()}}}function vO(n){let e,t,i;return{c(){e=y("i"),m(e,"class","ri-checkbox-circle-fill txt-sm txt-success")},m(s,l){S(s,e,l),t||(i=Oe(Be.call(null,e,"Verified")),t=!0)},d(s){s&&w(e),t=!1,i()}}}function sh(n){let e=!n[7].includes("@username"),t,i=!n[7].includes("@email"),s,l=e&&lh(n),o=i&&oh(n);return{c(){l&&l.c(),t=D(),o&&o.c(),s=Se()},m(r,a){l&&l.m(r,a),S(r,t,a),o&&o.m(r,a),S(r,s,a)},p(r,a){a[0]&128&&(e=!r[7].includes("@username")),e?l?l.p(r,a):(l=lh(r),l.c(),l.m(t.parentNode,t)):l&&(l.d(1),l=null),a[0]&128&&(i=!r[7].includes("@email")),i?o?o.p(r,a):(o=oh(r),o.c(),o.m(s.parentNode,s)):o&&(o.d(1),o=null)},d(r){l&&l.d(r),r&&w(t),o&&o.d(r),r&&w(s)}}}function lh(n){let e,t;function i(o,r){return r[0]&16&&(t=null),t==null&&(t=!!U.isEmpty(o[55].username)),t?kO:yO}let s=i(n,[-1,-1,-1]),l=s(n);return{c(){e=y("td"),l.c(),m(e,"class","col-type-text col-field-username")},m(o,r){S(o,e,r),l.m(e,null)},p(o,r){s===(s=i(o,r))&&l?l.p(o,r):(l.d(1),l=s(o),l&&(l.c(),l.m(e,null)))},d(o){o&&w(e),l.d()}}}function yO(n){let e,t=n[55].username+"",i,s;return{c(){e=y("span"),i=Y(t),m(e,"class","txt txt-ellipsis"),m(e,"title",s=n[55].username)},m(l,o){S(l,e,o),v(e,i)},p(l,o){o[0]&16&&t!==(t=l[55].username+"")&&le(i,t),o[0]&16&&s!==(s=l[55].username)&&m(e,"title",s)},d(l){l&&w(e)}}}function kO(n){let e;return{c(){e=y("span"),e.textContent="N/A",m(e,"class","txt-hint")},m(t,i){S(t,e,i)},p:te,d(t){t&&w(e)}}}function oh(n){let e,t;function i(o,r){return r[0]&16&&(t=null),t==null&&(t=!!U.isEmpty(o[55].email)),t?SO:wO}let s=i(n,[-1,-1,-1]),l=s(n);return{c(){e=y("td"),l.c(),m(e,"class","col-type-text col-field-email")},m(o,r){S(o,e,r),l.m(e,null)},p(o,r){s===(s=i(o,r))&&l?l.p(o,r):(l.d(1),l=s(o),l&&(l.c(),l.m(e,null)))},d(o){o&&w(e),l.d()}}}function wO(n){let e,t=n[55].email+"",i,s;return{c(){e=y("span"),i=Y(t),m(e,"class","txt txt-ellipsis"),m(e,"title",s=n[55].email)},m(l,o){S(l,e,o),v(e,i)},p(l,o){o[0]&16&&t!==(t=l[55].emai
<span class="txt">New record</span>`,m(e,"type","button"),m(e,"class","btn btn-expanded")},m(s,l){S(s,e,l),t||(i=J(e,"click",n[18]),t=!0)},p:te,d(s){s&&w(e),t=!1,i()}}}function FO(n){let e,t,i,s,l,o=n[2].name+"",r,a,u,f,d,p,h,g,_,b,k,$,C,T,O,M,E,A,L,N,q=!n[10]&&_h(n);d=new Zo({}),d.$on("refresh",n[16]);let R=!n[2].$isView&&gh(n);k=new Jo({props:{value:n[0],autocompleteCollection:n[2]}}),k.$on("submit",n[19]);function F(W){n[21](W)}function V(W){n[22](W)}let j={collection:n[2]};return n[0]!==void 0&&(j.filter=n[0]),n[1]!==void 0&&(j.sort=n[1]),O=new AO({props:j}),n[20](O),ne.push(()=>he(O,"filter",F)),ne.push(()=>he(O,"sort",V)),O.$on("select",n[23]),O.$on("new",n[24]),{c(){e=y("header"),t=y("nav"),i=y("div"),i.textContent="Collections",s=D(),l=y("div"),r=Y(o),a=D(),u=y("div"),q&&q.c(),f=D(),B(d.$$.fragment),p=D(),h=y("div"),g=y("button"),g.innerHTML=`<i class="ri-code-s-slash-line"></i>
<span class="txt">API Preview</span>`,_=D(),R&&R.c(),b=D(),B(k.$$.fragment),$=D(),C=y("div"),T=D(),B(O.$$.fragment),m(i,"class","breadcrumb-item"),m(l,"class","breadcrumb-item"),m(t,"class","breadcrumbs"),m(u,"class","inline-flex gap-5"),m(g,"type","button"),m(g,"class","btn btn-outline"),m(h,"class","btns-group"),m(e,"class","page-header"),m(C,"class","clearfix m-b-base")},m(W,Q){S(W,e,Q),v(e,t),v(t,i),v(t,s),v(t,l),v(l,r),v(e,a),v(e,u),q&&q.m(u,null),v(u,f),z(d,u,null),v(e,p),v(e,h),v(h,g),v(h,_),R&&R.m(h,null),S(W,b,Q),z(k,W,Q),S(W,$,Q),S(W,C,Q),S(W,T,Q),z(O,W,Q),A=!0,L||(N=J(g,"click",n[17]),L=!0)},p(W,Q){(!A||Q[0]&4)&&o!==(o=W[2].name+"")&&le(r,o),W[10]?q&&(q.d(1),q=null):q?q.p(W,Q):(q=_h(W),q.c(),q.m(u,f)),W[2].$isView?R&&(R.d(1),R=null):R?R.p(W,Q):(R=gh(W),R.c(),R.m(h,null));const X={};Q[0]&1&&(X.value=W[0]),Q[0]&4&&(X.autocompleteCollection=W[2]),k.$set(X);const Z={};Q[0]&4&&(Z.collection=W[2]),!M&&Q[0]&1&&(M=!0,Z.filter=W[0],ye(()=>M=!1)),!E&&Q[0]&2&&(E=!0,Z.sort=W[1],ye(()=>E=!1)),O.$set(Z)},i(W){A||(I(d.$$.fragment,W),I(k.$$.fragment,W),I(O.$$.fragment,W),A=!0)},o(W){P(d.$$.fragment,W),P(k.$$.fragment,W),P(O.$$.fragment,W),A=!1},d(W){W&&w(e),q&&q.d(),H(d),R&&R.d(),W&&w(b),H(k,W),W&&w($),W&&w(C),W&&w(T),n[20](null),H(O,W),L=!1,N()}}}function NO(n){let e,t,i,s,l;return{c(){e=y("h1"),e.textContent="Create your first collection to add records!",t=D(),i=y("button"),i.innerHTML=`<i class="ri-add-line"></i>
<span class="txt">Create new collection</span>`,m(e,"class","m-b-10"),m(i,"type","button"),m(i,"class","btn btn-expanded-lg btn-lg")},m(o,r){S(o,e,r),S(o,t,r),S(o,i,r),s||(l=J(i,"click",n[14]),s=!0)},p:te,d(o){o&&w(e),o&&w(t),o&&w(i),s=!1,l()}}}function RO(n){let e;return{c(){e=y("h1"),e.textContent="You don't have any collections yet.",m(e,"class","m-b-10")},m(t,i){S(t,e,i)},p:te,d(t){t&&w(e)}}}function qO(n){let e,t,i;function s(r,a){return r[10]?RO:NO}let l=s(n),o=l(n);return{c(){e=y("div"),t=y("div"),t.innerHTML='<i class="ri-database-2-line"></i>',i=D(),o.c(),m(t,"class","icon"),m(e,"class","placeholder-section m-b-base")},m(r,a){S(r,e,a),v(e,t),v(e,i),o.m(e,null)},p(r,a){l===(l=s(r))&&o?o.p(r,a):(o.d(1),o=l(r),o&&(o.c(),o.m(e,null)))},d(r){r&&w(e),o.d()}}}function jO(n){let e;return{c(){e=y("div"),e.innerHTML=`<span class="loader loader-lg"></span>
<h1>Loading collections...</h1>`,m(e,"class","placeholder-section m-b-base")},m(t,i){S(t,e,i)},p:te,d(t){t&&w(e)}}}function VO(n){let e,t,i,s,l,o,r,a,u,f,d;const p=[PO,LO,IO],h=[];function g(C,T){return C[3]&&!C[9].length?0:C[9].length?2:1}e=g(n),t=h[e]=p[e](n);let _={};s=new cu({props:_}),n[25](s);let b={};o=new AM({props:b}),n[26](o);let k={collection:n[2]};a=new $1({props:k}),n[27](a),a.$on("save",n[28]),a.$on("delete",n[29]);let $={collection:n[2]};return f=new lO({props:$}),n[30](f),{c(){t.c(),i=D(),B(s.$$.fragment),l=D(),B(o.$$.fragment),r=D(),B(a.$$.fragment),u=D(),B(f.$$.fragment)},m(C,T){h[e].m(C,T),S(C,i,T),z(s,C,T),S(C,l,T),z(o,C,T),S(C,r,T),z(a,C,T),S(C,u,T),z(f,C,T),d=!0},p(C,T){let O=e;e=g(C),e===O?h[e].p(C,T):(ue(),P(h[O],1,1,()=>{h[O]=null}),fe(),t=h[e],t?t.p(C,T):(t=h[e]=p[e](C),t.c()),I(t,1),t.m(i.parentNode,i));const M={};s.$set(M);const E={};o.$set(E);const A={};T[0]&4&&(A.collection=C[2]),a.$set(A);const L={};T[0]&4&&(L.collection=C[2]),f.$set(L)},i(C){d||(I(t),I(s.$$.fragment,C),I(o.$$.fragment,C),I(a.$$.fragment,C),I(f.$$.fragment,C),d=!0)},o(C){P(t),P(s.$$.fragment,C),P(o.$$.fragment,C),P(a.$$.fragment,C),P(f.$$.fragment,C),d=!1},d(C){h[e].d(C),C&&w(i),n[25](null),H(s,C),C&&w(l),n[26](null),H(o,C),C&&w(r),n[27](null),H(a,C),C&&w(u),n[30](null),H(f,C)}}}function zO(n,e,t){let i,s,l,o,r,a,u;Ze(n,fi,x=>t(2,s=x)),Ze(n,Mt,x=>t(31,l=x)),Ze(n,ko,x=>t(3,o=x)),Ze(n,Ta,x=>t(13,r=x)),Ze(n,di,x=>t(9,a=x)),Ze(n,Is,x=>t(10,u=x));const f=new URLSearchParams(r);let d,p,h,g,_,b=f.get("filter")||"",k=f.get("sort")||"",$=f.get("collectionId")||(s==null?void 0:s.id);function C(){t(11,$=s==null?void 0:s.id),t(0,b=""),t(1,k="-created"),s!=null&&s.$isView&&!U.extractColumnsFromQuery(s.options.query).includes("created")&&t(1,k="")}Py($);const T=()=>d==null?void 0:d.show(),O=()=>d==null?void 0:d.show(s),M=()=>_==null?void 0:_.load(),E=()=>p==null?void 0:p.show(s),A=()=>h==null?void 0:h.show(),L=x=>t(0,b=x.detail);function N(x){ne[x?"unshift":"push"](()=>{_=x,t(8,_)})}function q(x){b=x,t(0,b)}function R(x){k=x,t(1,k)}const F=x=>{s.$isView?g.show(x==null?void 0:x.detail):h==null||h.show(x==null?void 0:x.detail)},V=()=>h==null?void 0:h.show();function j(x){ne[x?"unshift":"push"](()=>{d=x,t(4,d)})}function W(x){ne[x?"unshift":"push"](()=>{p=x,t(5,p)})}function Q(x){ne[x?"unshift":"push"](()=>{h=x,t(6,h)})}const X=()=>_==null?void 0:_.reloadLoadedPages(),Z=()=>_==null?void 0:_.reloadLoadedPages();function re(x){ne[x?"unshift":"push"](()=>{g=x,t(7,g)})}return n.$$.update=()=>{if(n.$$.dirty[0]&8192&&t(12,i=new URLSearchParams(r)),n.$$.dirty[0]&6152&&!o&&i.get("collectionId")&&i.get("collectionId")!=$&&Ay(i.get("collectionId")),n.$$.dirty[0]&2052&&s!=null&&s.id&&$!=s.id&&C(),n.$$.dirty[0]&7&&(k||b||s!=null&&s.id)){const x=new URLSearchParams({collectionId:(s==null?void 0:s.id)||"",filter:b,sort:k}).toString();Vi("/collections?"+x)}n.$$.dirty[0]&4&&ln(Mt,l=(s==null?void 0:s.name)||"Collections",l)},[b,k,s,o,d,p,h,g,_,a,u,$,i,r,T,O,M,E,A,L,N,q,R,F,V,j,W,Q,X,Z,re]}class HO extends be{constructor(e){super(),ge(this,e,zO,VO,_e,{},null,[-1,-1])}}function BO(n){let e,t,i,s,l,o,r,a,u,f,d,p,h,g,_,b,k,$,C,T,O,M,E,A,L,N,q;return{c(){e=y("aside"),t=y("div"),i=y("div"),i.textContent="System",s=D(),l=y("a"),l.innerHTML=`<i class="ri-home-gear-line"></i>
2023-05-14 03:10:14 +08:00
<span class="txt">Application</span>`,o=D(),r=y("a"),r.innerHTML=`<i class="ri-send-plane-2-line"></i>
<span class="txt">Mail settings</span>`,a=D(),u=y("a"),u.innerHTML=`<i class="ri-archive-drawer-line"></i>
<span class="txt">Files storage</span>`,f=D(),d=y("a"),d.innerHTML=`<i class="ri-archive-line"></i>
<span class="txt">Backups</span>`,p=D(),h=y("div"),h.innerHTML='<span class="txt">Sync</span>',g=D(),_=y("a"),_.innerHTML=`<i class="ri-uninstall-line"></i>
<span class="txt">Export collections</span>`,b=D(),k=y("a"),k.innerHTML=`<i class="ri-install-line"></i>
2023-05-14 03:23:19 +08:00
<span class="txt">Import collections</span>`,$=D(),C=y("div"),C.textContent="Authentication",T=D(),O=y("a"),O.innerHTML=`<i class="ri-lock-password-line"></i>
<span class="txt">Auth providers</span>`,M=D(),E=y("a"),E.innerHTML=`<i class="ri-key-line"></i>
2023-05-14 03:10:14 +08:00
<span class="txt">Token options</span>`,A=D(),L=y("a"),L.innerHTML=`<i class="ri-shield-user-line"></i>
2023-05-14 03:23:19 +08:00
<span class="txt">Admins</span>`,m(i,"class","sidebar-title"),m(l,"href","/settings"),m(l,"class","sidebar-list-item"),m(r,"href","/settings/mail"),m(r,"class","sidebar-list-item"),m(u,"href","/settings/storage"),m(u,"class","sidebar-list-item"),m(d,"href","/settings/backups"),m(d,"class","sidebar-list-item"),m(h,"class","sidebar-title"),m(_,"href","/settings/export-collections"),m(_,"class","sidebar-list-item"),m(k,"href","/settings/import-collections"),m(k,"class","sidebar-list-item"),m(C,"class","sidebar-title"),m(O,"href","/settings/auth-providers"),m(O,"class","sidebar-list-item"),m(E,"href","/settings/tokens"),m(E,"class","sidebar-list-item"),m(L,"href","/settings/admins"),m(L,"class","sidebar-list-item"),m(t,"class","sidebar-content"),m(e,"class","page-sidebar settings-sidebar")},m(R,F){S(R,e,F),v(e,t),v(t,i),v(t,s),v(t,l),v(t,o),v(t,r),v(t,a),v(t,u),v(t,f),v(t,d),v(t,p),v(t,h),v(t,g),v(t,_),v(t,b),v(t,k),v(t,$),v(t,C),v(t,T),v(t,O),v(t,M),v(t,E),v(t,A),v(t,L),N||(q=[Oe(zn.call(null,l,{path:"/settings"})),Oe(rn.call(null,l)),Oe(zn.call(null,r,{path:"/settings/mail/?.*"})),Oe(rn.call(null,r)),Oe(zn.call(null,u,{path:"/settings/storage/?.*"})),Oe(rn.call(null,u)),Oe(zn.call(null,d,{path:"/settings/backups/?.*"})),Oe(rn.call(null,d)),Oe(zn.call(null,_,{path:"/settings/export-collections/?.*"})),Oe(rn.call(null,_)),Oe(zn.call(null,k,{path:"/settings/import-collections/?.*"})),Oe(rn.call(null,k)),Oe(zn.call(null,O,{path:"/settings/auth-providers/?.*"})),Oe(rn.call(null,O)),Oe(zn.call(null,E,{path:"/settings/tokens/?.*"})),Oe(rn.call(null,E)),Oe(zn.call(null,L,{path:"/settings/admins/?.*"})),Oe(rn.call(null,L))],N=!0)},p:te,i:te,o:te,d(R){R&&w(e),N=!1,De(q)}}}class Mi extends be{constructor(e){super(),ge(this,e,null,BO,_e,{})}}function bh(n,e,t){const i=n.slice();return i[30]=e[t],i}function vh(n){let e,t;return e=new pe({props:{class:"form-field readonly",name:"id",$$slots:{default:[UO,({uniqueId:i})=>({29:i}),({uniqueId:i})=>[i?536870912:0]]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){z(e,i,s),t=!0},p(i,s){const l={};s[0]&536870914|s[1]&4&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function UO(n){let e,t,i,s,l,o,r,a,u,f,d,p,h,g,_;return{c(){e=y("label"),t=y("i"),i=D(),s=y("span"),s.textContent="id",o=D(),r=y("div"),a=y("i"),f=D(),d=y("input"),m(t,"class",U.getFieldTypeIcon("primary")),m(s,"class","txt"),m(e,"for",l=n[29]),m(a,"class","ri-calendar-event-line txt-disabled"),m(r,"class","form-field-addon"),m(d,"type","text"),m(d,"id",p=n[29]),d.value=h=n[1].id,d.readOnly=!0},m(b,k){S(b,e,k),v(e,t),v(e,i),v(e,s),S(b,o,k),S(b,r,k),v(r,a),S(b,f,k),S(b,d,k),g||(_=Oe(u=Be.call(null,a,{text:`Created: ${n[1].created}
2023-05-14 03:10:14 +08:00
Updated: ${n[1].updated}`,position:"left"})),g=!0)},p(b,k){k[0]&536870912&&l!==(l=b[29])&&m(e,"for",l),u&&jt(u.update)&&k[0]&2&&u.update.call(null,{text:`Created: ${b[1].created}
2023-05-14 03:23:19 +08:00
Updated: ${b[1].updated}`,position:"left"}),k[0]&536870912&&p!==(p=b[29])&&m(d,"id",p),k[0]&2&&h!==(h=b[1].id)&&d.value!==h&&(d.value=h)},d(b){b&&w(e),b&&w(o),b&&w(r),b&&w(f),b&&w(d),g=!1,_()}}}function yh(n){let e,t,i,s,l,o,r;function a(){return n[17](n[30])}return{c(){e=y("button"),t=y("img"),s=D(),_n(t.src,i="./images/avatars/avatar"+n[30]+".svg")||m(t,"src",i),m(t,"alt","Avatar "+n[30]),m(e,"type","button"),m(e,"class",l="link-fade thumb thumb-circle "+(n[30]==n[2]?"thumb-active":"thumb-sm"))},m(u,f){S(u,e,f),v(e,t),v(e,s),o||(r=J(e,"click",a),o=!0)},p(u,f){n=u,f[0]&4&&l!==(l="link-fade thumb thumb-circle "+(n[30]==n[2]?"thumb-active":"thumb-sm"))&&m(e,"class",l)},d(u){u&&w(e),o=!1,r()}}}function WO(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=y("label"),t=y("i"),i=D(),s=y("span"),s.textContent="Email",o=D(),r=y("input"),m(t,"class",U.getFieldTypeIcon("email")),m(s,"class","txt"),m(e,"for",l=n[29]),m(r,"type","email"),m(r,"autocomplete","off"),m(r,"id",a=n[29]),r.required=!0},m(d,p){S(d,e,p),v(e,t),v(e,i),v(e,s),S(d,o,p),S(d,r,p),ae(r,n[3]),u||(f=J(r,"input",n[18]),u=!0)},p(d,p){p[0]&536870912&&l!==(l=d[29])&&m(e,"for",l),p[0]&536870912&&a!==(a=d[29])&&m(r,"id",a),p[0]&8&&r.value!==d[3]&&ae(r,d[3])},d(d){d&&w(e),d&&w(o),d&&w(r),u=!1,f()}}}function kh(n){let e,t;return e=new pe({props:{class:"form-field form-field-toggle",$$slots:{default:[YO,({uniqueId:i})=>({29:i}),({uniqueId:i})=>[i?536870912:0]]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){z(e,i,s),t=!0},p(i,s){const l={};s[0]&536870928|s[1]&4&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function YO(n){let e,t,i,s,l,o,r,a;return{c(){e=y("input"),i=D(),s=y("label"),l=Y("Change password"),m(e,"type","checkbox"),m(e,"id",t=n[29]),m(s,"for",o=n[29])},m(u,f){S(u,e,f),e.checked=n[4],S(u,i,f),S(u,s,f),v(s,l),r||(a=J(e,"change",n[19]),r=!0)},p(u,f){f[0]&536870912&&t!==(t=u[29])&&m(e,"id",t),f[0]&16&&(e.checked=u[4]),f[0]&536870912&&o!==(o=u[29])&&m(s,"for",o)},d(u){u&&w(e),u&&w(i),u&&w(s),r=!1,a()}}}function wh(n){let e,t,i,s,l,o,r,a,u;return s=new pe({props:{class:"form-field required",name:"password",$$slots:{default:[KO,({uniqueId:f})=>({29:f}),({uniqueId:f})=>[f?536870912:0]]},$$scope:{ctx:n}}}),r=new pe({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[JO,({uniqueId:f})=>({29:f}),({uniqueId:f})=>[f?536870912:0]]},$$scope:{ctx:n}}}),{c(){e=y("div"),t=y("div"),i=y("div"),B(s.$$.fragment),l=D(),o=y("div"),B(r.$$.fragment),m(i,"class","col-sm-6"),m(o,"class","col-sm-6"),m(t,"class","grid"),m(e,"class","col-12")},m(f,d){S(f,e,d),v(e,t),v(t,i),z(s,i,null),v(t,l),v(t,o),z(r,o,null),u=!0},p(f,d){const p={};d[0]&536871168|d[1]&4&&(p.$$scope={dirty:d,ctx:f}),s.$set(p);const h={};d[0]&536871424|d[1]&4&&(h.$$scope={dirty:d,ctx:f}),r.$set(h)},i(f){u||(I(s.$$.fragment,f),I(r.$$.fragment,f),f&&et(()=>{u&&(a||(a=Ve(t,rt,{duration:150},!0)),a.run(1))}),u=!0)},o(f){P(s.$$.fragment,f),P(r.$$.fragment,f),f&&(a||(a=Ve(t,rt,{duration:150},!1)),a.run(0)),u=!1},d(f){f&&w(e),H(s),H(r),f&&a&&a.end()}}}function KO(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=y("label"),t=y("i"),i=D(),s=y("span"),s.textContent="Password",o=D(),r=y("input"),m(t,"class","ri-lock-line"),m(s,"class","txt"),m(e,"for",l=n[29]),m(r,"type","password"),m(r,"autocomplete","new-password"),m(r,"id",a=n[29]),r.required=!0},m(d,p){S(d,e,p),v(e,t),v(e,i),v(e,s),S(d,o,p),S(d,r,p),ae(r,n[8]),u||(f=J(r,"input",n[20]),u=!0)},p(d,p){p[0]&536870912&&l!==(l=d[29])&&m(e,"for",l),p[0]&536870912&&a!==(a=d[29])&&m(r,"id",a),p[0]&256&&r.value!==d[8]&&ae(r,d[8])},d(d){d&&w(e),d&&w(o),d&&w(r),u=!1,f()}}}function JO(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=y("label"),t=y("i"),i=D(),s=y("span"),s.textContent="Password confirm",o=D(),r=y("input"),m(t,"class","ri-lock-line"),m(s,"class","txt"),m(e,"for",l=n[29]),m(r,"type","password"),m(r,"autocomplete","new-password"),m(r,"id",a=n[29]),r.required=!0},m(d,p){S(d,e,p),v(e,t),v(e,i),v(e,s),S(d,o,p),S(d,r,p),ae(r,n[9]),u||(f=J(r,"input",n[21]),u=!0)},p(d,p){p[0]&536870912&&l!==(l=d[29])&&m(e,"for",l),p
<span class="txt">Delete</span>`,m(e,"type","button"),m(e,"class","dropdown-item txt-danger")},m(s,l){S(s,e,l),t||(i=J(e,"click",n[15]),t=!0)},p:te,d(s){s&&w(e),t=!1,i()}}}function QO(n){let e,t,i,s,l,o,r=n[1].$isNew?"Create":"Save changes",a,u,f,d,p,h=!n[1].$isNew&&Sh(n);return{c(){h&&h.c(),e=D(),t=y("button"),i=y("span"),i.textContent="Cancel",s=D(),l=y("button"),o=y("span"),a=Y(r),m(i,"class","txt"),m(t,"type","button"),m(t,"class","btn btn-transparent"),t.disabled=n[6],m(o,"class","txt"),m(l,"type","submit"),m(l,"form",n[11]),m(l,"class","btn btn-expanded"),l.disabled=u=!n[10]||n[6],ee(l,"btn-loading",n[6])},m(g,_){h&&h.m(g,_),S(g,e,_),S(g,t,_),v(t,i),S(g,s,_),S(g,l,_),v(l,o),v(o,a),f=!0,d||(p=J(t,"click",n[16]),d=!0)},p(g,_){g[1].$isNew?h&&(ue(),P(h,1,1,()=>{h=null}),fe()):h?(h.p(g,_),_[0]&2&&I(h,1)):(h=Sh(g),h.c(),I(h,1),h.m(e.parentNode,e)),(!f||_[0]&64)&&(t.disabled=g[6]),(!f||_[0]&2)&&r!==(r=g[1].$isNew?"Create":"Save changes")&&le(a,r),(!f||_[0]&1088&&u!==(u=!g[10]||g[6]))&&(l.disabled=u),(!f||_[0]&64)&&ee(l,"btn-loading",g[6])},i(g){f||(I(h),f=!0)},o(g){P(h),f=!1},d(g){h&&h.d(g),g&&w(e),g&&w(t),g&&w(s),g&&w(l),d=!1,p()}}}function xO(n){let e,t,i={popup:!0,class:"admin-panel",beforeHide:n[22],$$slots:{footer:[QO],header:[GO],default:[ZO]},$$scope:{ctx:n}};return e=new on({props:i}),n[23](e),e.$on("hide",n[24]),e.$on("show",n[25]),{c(){B(e.$$.fragment)},m(s,l){z(e,s,l),t=!0},p(s,l){const o={};l[0]&1152&&(o.beforeHide=s[22]),l[0]&1886|l[1]&4&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(I(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[23](null),H(e,s)}}}function eD(n,e,t){let i;const s=Tt(),l="admin_"+U.randomString(5);let o,r=new rs,a=!1,u=!1,f=0,d="",p="",h="",g=!1;function _(W){return k(W),t(7,u=!0),o==null?void 0:o.show()}function b(){return o==null?void 0:o.hide()}function k(W){t(1,r=W!=null&&W.$clone?W.$clone():new rs),$()}function $(){t(4,g=!1),t(3,d=(r==null?void 0:r.email)||""),t(2,f=(r==null?void 0:r.avatar)||0),t(8,p=""),t(9,h=""),tn({})}function C(){if(a||!i)return;t(6,a=!0);const W={email:d,avatar:f};(r.$isNew||g)&&(W.password=p,W.passwordConfirm=h);let Q;r.$isNew?Q=de.admins.create(W):Q=de.admins.update(r.id,W),Q.then(async X=>{var Z;t(7,u=!1),b(),Ht(r.$isNew?"Successfully created admin.":"Successfully updated admin."),((Z=de.authStore.model)==null?void 0:Z.id)===X.id&&de.authStore.save(de.authStore.token,X),s("save",X)}).catch(X=>{de.error(X)}).finally(()=>{t(6,a=!1)})}function T(){r!=null&&r.id&&mn("Do you really want to delete the selected admin?",()=>de.admins.delete(r.id).then(()=>{t(7,u=!1),b(),Ht("Successfully deleted admin."),s("delete",r)}).catch(W=>{de.error(W)}))}const O=()=>T(),M=()=>b(),E=W=>t(2,f=W);function A(){d=this.value,t(3,d)}function L(){g=this.checked,t(4,g)}function N(){p=this.value,t(8,p)}function q(){h=this.value,t(9,h)}const R=()=>i&&u?(mn("You have unsaved changes. Do you really want to close the panel?",()=>{t(7,u=!1),b()}),!1):!0;function F(W){ne[W?"unshift":"push"](()=>{o=W,t(5,o)})}function V(W){me.call(this,n,W)}function j(W){me.call(this,n,W)}return n.$$.update=()=>{n.$$.dirty[0]&30&&t(10,i=r.$isNew&&d!=""||g||d!==r.email||f!==r.avatar)},[b,r,f,d,g,o,a,u,p,h,i,l,C,T,_,O,M,E,A,L,N,q,R,F,V,j]}class tD extends be{constructor(e){super(),ge(this,e,eD,xO,_e,{show:14,hide:0},null,[-1,-1])}get show(){return this.$$.ctx[14]}get hide(){return this.$$.ctx[0]}}function $h(n,e,t){const i=n.slice();return i[24]=e[t],i}function nD(n){let e,t,i,s;return{c(){e=y("div"),t=y("i"),i=D(),s=y("span"),s.textContent="id",m(t,"class",U.getFieldTypeIcon("primary")),m(s,"class","txt"),m(e,"class","col-header-content")},m(l,o){S(l,e,o),v(e,t),v(e,i),v(e,s)},p:te,d(l){l&&w(e)}}}function iD(n){let e,t,i,s;return{c(){e=y("div"),t=y("i"),i=D(),s=y("span"),s.textContent="email",m(t,"class",U.getFieldTypeIcon("email")),m(s,"class","txt"),m(e,"class","col-header-content")},m(l,o){S(l,e,o),v(e,t),v(e,i),v(e,s)},p:te,d(l){l&&w(e)}}}function sD(n){let e,t,i,s;return{c(){e=y("div"),t=y("i"),i=D(),s=y("span"),s.textContent="created",m(t,"class",U.getFieldTypeIcon("
`},m(t,i){S(t,e,i)},p:te,d(t){t&&w(e)}}}function Ch(n){let e,t,i;return{c(){e=y("button"),e.innerHTML='<span class="txt">Clear filters</span>',m(e,"type","button"),m(e,"class","btn btn-hint btn-expanded m-t-sm")},m(s,l){S(s,e,l),t||(i=J(e,"click",n[17]),t=!0)},p:te,d(s){s&&w(e),t=!1,i()}}}function Mh(n){let e;return{c(){e=y("span"),e.textContent="You",m(e,"class","label label-warning m-l-5")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function Eh(n,e){let t,i,s,l,o,r,a,u,f,d,p,h=e[24].id+"",g,_,b,k,$,C=e[24].email+"",T,O,M,E,A,L,N,q,R,F,V,j,W,Q;f=new Nl({props:{value:e[24].id}});let X=e[24].id===e[7].id&&Mh();A=new $i({props:{date:e[24].created}}),q=new $i({props:{date:e[24].updated}});function Z(){return e[15](e[24])}function re(...x){return e[16](e[24],...x)}return{key:n,first:null,c(){t=y("tr"),i=y("td"),s=y("figure"),l=y("img"),r=D(),a=y("td"),u=y("div"),B(f.$$.fragment),d=D(),p=y("span"),g=Y(h),_=D(),X&&X.c(),b=D(),k=y("td"),$=y("span"),T=Y(C),M=D(),E=y("td"),B(A.$$.fragment),L=D(),N=y("td"),B(q.$$.fragment),R=D(),F=y("td"),F.innerHTML='<i class="ri-arrow-right-line"></i>',V=D(),_n(l.src,o="./images/avatars/avatar"+(e[24].avatar||0)+".svg")||m(l,"src",o),m(l,"alt","Admin avatar"),m(s,"class","thumb thumb-sm thumb-circle"),m(i,"class","min-width"),m(p,"class","txt"),m(u,"class","label"),m(a,"class","col-type-text col-field-id"),m($,"class","txt txt-ellipsis"),m($,"title",O=e[24].email),m(k,"class","col-type-email col-field-email"),m(E,"class","col-type-date col-field-created"),m(N,"class","col-type-date col-field-updated"),m(F,"class","col-type-action min-width"),m(t,"tabindex","0"),m(t,"class","row-handle"),this.first=t},m(x,se){S(x,t,se),v(t,i),v(i,s),v(s,l),v(t,r),v(t,a),v(a,u),z(f,u,null),v(u,d),v(u,p),v(p,g),v(a,_),X&&X.m(a,null),v(t,b),v(t,k),v(k,$),v($,T),v(t,M),v(t,E),z(A,E,null),v(t,L),v(t,N),z(q,N,null),v(t,R),v(t,F),v(t,V),j=!0,W||(Q=[J(t,"click",Z),J(t,"keydown",re)],W=!0)},p(x,se){e=x,(!j||se&16&&!_n(l.src,o="./images/avatars/avatar"+(e[24].avatar||0)+".svg"))&&m(l,"src",o);const ve={};se&16&&(ve.value=e[24].id),f.$set(ve),(!j||se&16)&&h!==(h=e[24].id+"")&&le(g,h),e[24].id===e[7].id?X||(X=Mh(),X.c(),X.m(a,null)):X&&(X.d(1),X=null),(!j||se&16)&&C!==(C=e[24].email+"")&&le(T,C),(!j||se&16&&O!==(O=e[24].email))&&m($,"title",O);const $e={};se&16&&($e.date=e[24].created),A.$set($e);const ze={};se&16&&(ze.date=e[24].updated),q.$set(ze)},i(x){j||(I(f.$$.fragment,x),I(A.$$.fragment,x),I(q.$$.fragment,x),j=!0)},o(x){P(f.$$.fragment,x),P(A.$$.fragment,x),P(q.$$.fragment,x),j=!1},d(x){x&&w(t),H(f),X&&X.d(),H(A),H(q),W=!1,De(Q)}}}function aD(n){let e,t,i,s,l,o,r,a,u,f,d,p,h,g,_,b,k,$,C,T,O=[],M=new Map,E;function A(Z){n[11](Z)}let L={class:"col-type-text",name:"id",$$slots:{default:[nD]},$$scope:{ctx:n}};n[2]!==void 0&&(L.sort=n[2]),o=new un({props:L}),ne.push(()=>he(o,"sort",A));function N(Z){n[12](Z)}let q={class:"col-type-email col-field-email",name:"email",$$slots:{default:[iD]},$$scope:{ctx:n}};n[2]!==void 0&&(q.sort=n[2]),u=new un({props:q}),ne.push(()=>he(u,"sort",N));function R(Z){n[13](Z)}let F={class:"col-type-date col-field-created",name:"created",$$slots:{default:[sD]},$$scope:{ctx:n}};n[2]!==void 0&&(F.sort=n[2]),p=new un({props:F}),ne.push(()=>he(p,"sort",R));function V(Z){n[14](Z)}let j={class:"col-type-date col-field-updated",name:"updated",$$slots:{default:[lD]},$$scope:{ctx:n}};n[2]!==void 0&&(j.sort=n[2]),_=new un({props:j}),ne.push(()=>he(_,"sort",V));let W=n[4];const Q=Z=>Z[24].id;for(let Z=0;Z<W.length;Z+=1){let re=$h(n,W,Z),x=Q(re);M.set(x,O[Z]=Eh(x,re))}let X=null;return W.length||(X=Th(n)),{c(){e=y("table"),t=y("thead"),i=y("tr"),s=y("th"),l=D(),B(o.$$.fragment),a=D(),B(u.$$.fragment),d=D(),B(p.$$.fragment),g=D(),B(_.$$.fragment),k=D(),$=y("th"),C=D(),T=y("tbody");for(let Z=0;Z<O.length;Z+=1)O[Z].c();X&&X.c(),m(s,"class","min-width"),m($,"class","col-type-action min-width"),m(e,"class","table"),ee(e,"table-loading",n[5])},m(Z,re){S(Z,e,re),v(e,t),v(t,i),v(i,s),v(i,l),z(o,i,null),v(i,a),z(u,i,null),v(i,d),z(p,i,null),v(i,g),z(_,i,null),v(i,k),v(i,$),v(e,C),v(e,T);for(let x=0;x<O.
<span class="txt">New admin</span>`,h=D(),B(g.$$.fragment),_=D(),b=y("div"),k=D(),B($.$$.fragment),C=D(),A&&A.c(),T=Se(),m(i,"class","breadcrumb-item"),m(l,"class","breadcrumb-item"),m(t,"class","breadcrumbs"),m(f,"class","flex-fill"),m(p,"type","button"),m(p,"class","btn btn-expanded"),m(e,"class","page-header"),m(b,"class","clearfix m-b-base")},m(L,N){S(L,e,N),v(e,t),v(t,i),v(t,s),v(t,l),v(l,o),v(e,r),z(a,e,null),v(e,u),v(e,f),v(e,d),v(e,p),S(L,h,N),z(g,L,N),S(L,_,N),S(L,b,N),S(L,k,N),z($,L,N),S(L,C,N),A&&A.m(L,N),S(L,T,N),O=!0,M||(E=J(p,"click",n[9]),M=!0)},p(L,N){(!O||N&64)&&le(o,L[6]);const q={};N&2&&(q.value=L[1]),g.$set(q);const R={};N&134217918&&(R.$$scope={dirty:N,ctx:L}),$.$set(R),L[4].length?A?A.p(L,N):(A=Oh(L),A.c(),A.m(T.parentNode,T)):A&&(A.d(1),A=null)},i(L){O||(I(a.$$.fragment,L),I(g.$$.fragment,L),I($.$$.fragment,L),O=!0)},o(L){P(a.$$.fragment,L),P(g.$$.fragment,L),P($.$$.fragment,L),O=!1},d(L){L&&w(e),H(a),L&&w(h),H(g,L),L&&w(_),L&&w(b),L&&w(k),H($,L),L&&w(C),A&&A.d(L),L&&w(T),M=!1,E()}}}function fD(n){let e,t,i,s,l,o;e=new Mi({}),i=new Sn({props:{$$slots:{default:[uD]},$$scope:{ctx:n}}});let r={};return l=new tD({props:r}),n[18](l),l.$on("save",n[19]),l.$on("delete",n[20]),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment),s=D(),B(l.$$.fragment)},m(a,u){z(e,a,u),S(a,t,u),z(i,a,u),S(a,s,u),z(l,a,u),o=!0},p(a,[u]){const f={};u&134217982&&(f.$$scope={dirty:u,ctx:a}),i.$set(f);const d={};l.$set(d)},i(a){o||(I(e.$$.fragment,a),I(i.$$.fragment,a),I(l.$$.fragment,a),o=!0)},o(a){P(e.$$.fragment,a),P(i.$$.fragment,a),P(l.$$.fragment,a),o=!1},d(a){H(e,a),a&&w(t),H(i,a),a&&w(s),n[18](null),H(l,a)}}}function cD(n,e,t){let i,s,l;Ze(n,Ta,q=>t(21,i=q)),Ze(n,Mt,q=>t(6,s=q)),Ze(n,Ra,q=>t(7,l=q)),ln(Mt,s="Admins",s);const o=new URLSearchParams(i);let r,a=[],u=!1,f=o.get("filter")||"",d=o.get("sort")||"-created";function p(){t(5,u=!0),t(4,a=[]);const q=U.normalizeSearchFilter(f,["id","email","created","updated"]);return de.admins.getFullList(100,{sort:d||"-created",filter:q}).then(R=>{t(4,a=R),t(5,u=!1)}).catch(R=>{R!=null&&R.isAbort||(t(5,u=!1),console.warn(R),h(),de.error(R,!1))})}function h(){t(4,a=[])}const g=()=>p(),_=()=>r==null?void 0:r.show(),b=q=>t(1,f=q.detail);function k(q){d=q,t(2,d)}function $(q){d=q,t(2,d)}function C(q){d=q,t(2,d)}function T(q){d=q,t(2,d)}const O=q=>r==null?void 0:r.show(q),M=(q,R)=>{(R.code==="Enter"||R.code==="Space")&&(R.preventDefault(),r==null||r.show(q))},E=()=>t(1,f="");function A(q){ne[q?"unshift":"push"](()=>{r=q,t(3,r)})}const L=()=>p(),N=()=>p();return n.$$.update=()=>{if(n.$$.dirty&6&&d!==-1&&f!==-1){const q=new URLSearchParams({filter:f,sort:d}).toString();Vi("/settings/admins?"+q),p()}},[p,f,d,r,a,u,s,l,g,_,b,k,$,C,T,O,M,E,A,L,N]}class dD extends be{constructor(e){super(),ge(this,e,cD,fD,_e,{loadAdmins:0})}get loadAdmins(){return this.$$.ctx[0]}}function pD(n){let e,t,i,s,l,o,r,a;return{c(){e=y("label"),t=Y("Email"),s=D(),l=y("input"),m(e,"for",i=n[8]),m(l,"type","email"),m(l,"id",o=n[8]),l.required=!0,l.autofocus=!0},m(u,f){S(u,e,f),v(e,t),S(u,s,f),S(u,l,f),ae(l,n[0]),l.focus(),r||(a=J(l,"input",n[4]),r=!0)},p(u,f){f&256&&i!==(i=u[8])&&m(e,"for",i),f&256&&o!==(o=u[8])&&m(l,"id",o),f&1&&l.value!==u[0]&&ae(l,u[0])},d(u){u&&w(e),u&&w(s),u&&w(l),r=!1,a()}}}function mD(n){let e,t,i,s,l,o,r,a,u,f,d;return{c(){e=y("label"),t=Y("Password"),s=D(),l=y("input"),r=D(),a=y("div"),u=y("a"),u.textContent="Forgotten password?",m(e,"for",i=n[8]),m(l,"type","password"),m(l,"id",o=n[8]),l.required=!0,m(u,"href","/request-password-reset"),m(u,"class","link-hint"),m(a,"class","help-block")},m(p,h){S(p,e,h),v(e,t),S(p,s,h),S(p,l,h),ae(l,n[1]),S(p,r,h),S(p,a,h),v(a,u),f||(d=[J(l,"input",n[5]),Oe(rn.call(null,u))],f=!0)},p(p,h){h&256&&i!==(i=p[8])&&m(e,"for",i),h&256&&o!==(o=p[8])&&m(l,"id",o),h&2&&l.value!==p[1]&&ae(l,p[1])},d(p){p&&w(e),p&&w(s),p&&w(l),p&&w(r),p&&w(a),f=!1,De(d)}}}function hD(n){let e,t,i,s,l,o,r,a,u,f,d;return s=new pe({props:{class:"form-field required",name:"identity",$$slots:{default:[pD,({uniqueId:p})=>({8:p}),({uniqueId:p})=>p?256:0]},$$scope:{ctx:n}}}),o=new pe({prop
<i class="ri-arrow-right-line"></i>`,m(t,"class","content txt-center m-b-base"),m(a,"type","submit"),m(a,"class","btn btn-lg btn-block btn-next"),ee(a,"btn-disabled",n[2]),ee(a,"btn-loading",n[2]),m(e,"class","block")},m(p,h){S(p,e,h),v(e,t),v(e,i),z(s,e,null),v(e,l),z(o,e,null),v(e,r),v(e,a),u=!0,f||(d=J(e,"submit",xe(n[3])),f=!0)},p(p,h){const g={};h&769&&(g.$$scope={dirty:h,ctx:p}),s.$set(g);const _={};h&770&&(_.$$scope={dirty:h,ctx:p}),o.$set(_),(!u||h&4)&&ee(a,"btn-disabled",p[2]),(!u||h&4)&&ee(a,"btn-loading",p[2])},i(p){u||(I(s.$$.fragment,p),I(o.$$.fragment,p),u=!0)},o(p){P(s.$$.fragment,p),P(o.$$.fragment,p),u=!1},d(p){p&&w(e),H(s),H(o),f=!1,d()}}}function _D(n){let e,t;return e=new gb({props:{$$slots:{default:[hD]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){z(e,i,s),t=!0},p(i,[s]){const l={};s&519&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function gD(n,e,t){let i;Ze(n,Ta,d=>t(6,i=d));const s=new URLSearchParams(i);let l=s.get("demoEmail")||"",o=s.get("demoPassword")||"",r=!1;function a(){if(!r)return t(2,r=!0),de.admins.authWithPassword(l,o).then(()=>{Fa(),Vi("/")}).catch(()=>{As("Invalid login credentials.")}).finally(()=>{t(2,r=!1)})}function u(){l=this.value,t(0,l)}function f(){o=this.value,t(1,o)}return[l,o,r,a,u,f]}class bD extends be{constructor(e){super(),ge(this,e,gD,_D,_e,{})}}function vD(n){let e,t,i,s,l,o,r,a,u,f,d,p,h,g,_,b,k,$,C,T,O;i=new pe({props:{class:"form-field required",name:"meta.appName",$$slots:{default:[kD,({uniqueId:E})=>({19:E}),({uniqueId:E})=>E?524288:0]},$$scope:{ctx:n}}}),o=new pe({props:{class:"form-field required",name:"meta.appUrl",$$slots:{default:[wD,({uniqueId:E})=>({19:E}),({uniqueId:E})=>E?524288:0]},$$scope:{ctx:n}}}),a=new pe({props:{class:"form-field required",name:"logs.maxDays",$$slots:{default:[SD,({uniqueId:E})=>({19:E}),({uniqueId:E})=>E?524288:0]},$$scope:{ctx:n}}}),f=new pe({props:{class:"form-field form-field-toggle",name:"meta.hideControls",$$slots:{default:[$D,({uniqueId:E})=>({19:E}),({uniqueId:E})=>E?524288:0]},$$scope:{ctx:n}}});let M=n[3]&&Dh(n);return{c(){e=y("div"),t=y("div"),B(i.$$.fragment),s=D(),l=y("div"),B(o.$$.fragment),r=D(),B(a.$$.fragment),u=D(),B(f.$$.fragment),d=D(),p=y("div"),h=y("div"),g=D(),M&&M.c(),_=D(),b=y("button"),k=y("span"),k.textContent="Save changes",m(t,"class","col-lg-6"),m(l,"class","col-lg-6"),m(h,"class","flex-fill"),m(k,"class","txt"),m(b,"type","submit"),m(b,"class","btn btn-expanded"),b.disabled=$=!n[3]||n[2],ee(b,"btn-loading",n[2]),m(p,"class","col-lg-12 flex"),m(e,"class","grid")},m(E,A){S(E,e,A),v(e,t),z(i,t,null),v(e,s),v(e,l),z(o,l,null),v(e,r),z(a,e,null),v(e,u),z(f,e,null),v(e,d),v(e,p),v(p,h),v(p,g),M&&M.m(p,null),v(p,_),v(p,b),v(b,k),C=!0,T||(O=J(b,"click",n[13]),T=!0)},p(E,A){const L={};A&1572865&&(L.$$scope={dirty:A,ctx:E}),i.$set(L);const N={};A&1572865&&(N.$$scope={dirty:A,ctx:E}),o.$set(N);const q={};A&1572865&&(q.$$scope={dirty:A,ctx:E}),a.$set(q);const R={};A&1572865&&(R.$$scope={dirty:A,ctx:E}),f.$set(R),E[3]?M?M.p(E,A):(M=Dh(E),M.c(),M.m(p,_)):M&&(M.d(1),M=null),(!C||A&12&&$!==($=!E[3]||E[2]))&&(b.disabled=$),(!C||A&4)&&ee(b,"btn-loading",E[2])},i(E){C||(I(i.$$.fragment,E),I(o.$$.fragment,E),I(a.$$.fragment,E),I(f.$$.fragment,E),C=!0)},o(E){P(i.$$.fragment,E),P(o.$$.fragment,E),P(a.$$.fragment,E),P(f.$$.fragment,E),C=!1},d(E){E&&w(e),H(i),H(o),H(a),H(f),M&&M.d(),T=!1,O()}}}function yD(n){let e;return{c(){e=y("div"),m(e,"class","loader")},m(t,i){S(t,e,i)},p:te,i:te,o:te,d(t){t&&w(e)}}}function kD(n){let e,t,i,s,l,o,r,a;return{c(){e=y("label"),t=Y("Application name"),s=D(),l=y("input"),m(e,"for",i=n[19]),m(l,"type","text"),m(l,"id",o=n[19]),l.required=!0},m(u,f){S(u,e,f),v(e,t),S(u,s,f),S(u,l,f),ae(l,n[0].meta.appName),r||(a=J(l,"input",n[8]),r=!0)},p(u,f){f&524288&&i!==(i=u[19])&&m(e,"for",i),f&524288&&o!==(o=u[19])&&m(l,"id",o),f&1&&l.value!==u[0].meta.appName&&ae(l,u[0].meta.appName)},d(u){u&&w(e),u&&w(s),u&&w(l),r=!1,a()}}}function wD(n){let e,t,i,s,l,o,r,a;return{c(){e=y("label"),t=Y("Application url"),s=D(),
<div class="breadcrumb-item">Application</div></nav>`,t=D(),i=y("div"),s=y("form"),o.c(),m(e,"class","page-header"),m(s,"class","panel"),m(s,"autocomplete","off"),m(i,"class","wrapper")},m(h,g){S(h,e,g),S(h,t,g),S(h,i,g),v(i,s),d[l].m(s,null),r=!0,a||(u=J(s,"submit",xe(n[4])),a=!0)},p(h,g){let _=l;l=p(h),l===_?d[l].p(h,g):(ue(),P(d[_],1,1,()=>{d[_]=null}),fe(),o=d[l],o?o.p(h,g):(o=d[l]=f[l](h),o.c()),I(o,1),o.m(s,null))},i(h){r||(I(o),r=!0)},o(h){P(o),r=!1},d(h){h&&w(e),h&&w(t),h&&w(i),d[l].d(),a=!1,u()}}}function CD(n){let e,t,i,s;return e=new Mi({}),i=new Sn({props:{$$slots:{default:[TD]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment)},m(l,o){z(e,l,o),S(l,t,o),z(i,l,o),s=!0},p(l,[o]){const r={};o&1048591&&(r.$$scope={dirty:o,ctx:l}),i.$set(r)},i(l){s||(I(e.$$.fragment,l),I(i.$$.fragment,l),s=!0)},o(l){P(e.$$.fragment,l),P(i.$$.fragment,l),s=!1},d(l){H(e,l),l&&w(t),H(i,l)}}}function MD(n,e,t){let i,s,l,o;Ze(n,Is,M=>t(14,s=M)),Ze(n,So,M=>t(15,l=M)),Ze(n,Mt,M=>t(16,o=M)),ln(Mt,o="Application settings",o);let r={},a={},u=!1,f=!1,d="";p();async function p(){t(1,u=!0);try{const M=await de.settings.getAll()||{};g(M)}catch(M){de.error(M)}t(1,u=!1)}async function h(){if(!(f||!i)){t(2,f=!0);try{const M=await de.settings.update(U.filterRedactedProps(a));g(M),Ht("Successfully saved application settings.")}catch(M){de.error(M)}t(2,f=!1)}}function g(M={}){var E,A;ln(So,l=(E=M==null?void 0:M.meta)==null?void 0:E.appName,l),ln(Is,s=!!((A=M==null?void 0:M.meta)!=null&&A.hideControls),s),t(0,a={meta:(M==null?void 0:M.meta)||{},logs:(M==null?void 0:M.logs)||{}}),t(6,r=JSON.parse(JSON.stringify(a)))}function _(){t(0,a=JSON.parse(JSON.stringify(r||{})))}function b(){a.meta.appName=this.value,t(0,a)}function k(){a.meta.appUrl=this.value,t(0,a)}function $(){a.logs.maxDays=mt(this.value),t(0,a)}function C(){a.meta.hideControls=this.checked,t(0,a)}const T=()=>_(),O=()=>h();return n.$$.update=()=>{n.$$.dirty&64&&t(7,d=JSON.stringify(r)),n.$$.dirty&129&&t(3,i=d!=JSON.stringify(a))},[a,u,f,i,h,_,r,d,b,k,$,C,T,O]}class ED extends be{constructor(e){super(),ge(this,e,MD,CD,_e,{})}}function OD(n){let e,t,i,s=[{type:"password"},{autocomplete:"new-password"},n[5]],l={};for(let o=0;o<s.length;o+=1)l=je(l,s[o]);return{c(){e=y("input"),ai(e,l)},m(o,r){S(o,e,r),e.autofocus&&e.focus(),n[7](e),ae(e,n[0]),t||(i=J(e,"input",n[8]),t=!0)},p(o,r){ai(e,l=Et(s,[{type:"password"},{autocomplete:"new-password"},r&32&&o[5]])),r&1&&e.value!==o[0]&&ae(e,o[0])},d(o){o&&w(e),n[7](null),t=!1,i()}}}function DD(n){let e,t,i,s,l,o,r=[{readOnly:!0},{type:"text"},{placeholder:n[1]},n[5]],a={};for(let u=0;u<r.length;u+=1)a=je(a,r[u]);return{c(){e=y("div"),t=y("button"),t.innerHTML='<i class="ri-key-line"></i>',i=D(),s=y("input"),m(t,"type","button"),m(t,"class","btn btn-transparent btn-circle"),m(e,"class","form-field-addon"),ai(s,a)},m(u,f){S(u,e,f),v(e,t),S(u,i,f),S(u,s,f),s.autofocus&&s.focus(),l||(o=[Oe(Be.call(null,t,{position:"left",text:"Set new value"})),J(t,"click",n[6])],l=!0)},p(u,f){ai(s,a=Et(r,[{readOnly:!0},{type:"text"},f&2&&{placeholder:u[1]},f&32&&u[5]]))},d(u){u&&w(e),u&&w(i),u&&w(s),l=!1,De(o)}}}function AD(n){let e;function t(l,o){return l[3]?DD:OD}let i=t(n),s=i(n);return{c(){s.c(),e=Se()},m(l,o){s.m(l,o),S(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){s.d(l),l&&w(e)}}}function ID(n,e,t){const i=["value","mask"];let s=tt(e,i),{value:l=""}=e,{mask:o="******"}=e,r,a=!1;async function u(){t(0,l=""),t(3,a=!1),await cn(),r==null||r.focus()}const f=()=>u();function d(h){ne[h?"unshift":"push"](()=>{r=h,t(2,r)})}function p(){l=this.value,t(0,l)}return n.$$set=h=>{e=je(je({},e),Gt(h)),t(5,s=tt(e,i)),"value"in h&&t(0,l=h.value),"mask"in h&&t(1,o=h.mask)},n.$$.update=()=>{n.$$.dirty&3&&t(3,a=l===o)},[l,o,r,a,u,s,f,d,p]}class mu extends be{constructor(e){super(),ge(this,e,ID,AD,_e,{value:0,mask:1})}}function LD(n){let e,t,i,s,l,o,r,a,u,f,d,p,h,g,_;return{c(){e=y("label"),t=Y("Subject"),s=D(),l=y("input"),r=D(),a=y("div"),u=Y(`Available placeholder parameters:
2023-05-14 03:10:14 +08:00
`),f=y("button"),f.textContent=`{APP_NAME}
`,d=Y(`,
`),p=y("button"),p.textContent=`{APP_URL}
2023-05-14 03:23:19 +08:00
`,h=Y("."),m(e,"for",i=n[31]),m(l,"type","text"),m(l,"id",o=n[31]),m(l,"spellcheck","false"),l.required=!0,m(f,"type","button"),m(f,"class","label label-sm link-primary txt-mono"),m(p,"type","button"),m(p,"class","label label-sm link-primary txt-mono"),m(a,"class","help-block")},m(b,k){S(b,e,k),v(e,t),S(b,s,k),S(b,l,k),ae(l,n[0].subject),S(b,r,k),S(b,a,k),v(a,u),v(a,f),v(a,d),v(a,p),v(a,h),g||(_=[J(l,"input",n[13]),J(f,"click",n[14]),J(p,"click",n[15])],g=!0)},p(b,k){k[1]&1&&i!==(i=b[31])&&m(e,"for",i),k[1]&1&&o!==(o=b[31])&&m(l,"id",o),k[0]&1&&l.value!==b[0].subject&&ae(l,b[0].subject)},d(b){b&&w(e),b&&w(s),b&&w(l),b&&w(r),b&&w(a),g=!1,De(_)}}}function PD(n){let e,t,i,s,l,o,r,a,u,f,d,p,h,g,_,b,k;return{c(){e=y("label"),t=Y("Action URL"),s=D(),l=y("input"),r=D(),a=y("div"),u=Y(`Available placeholder parameters:
2023-05-14 03:10:14 +08:00
`),f=y("button"),f.textContent=`{APP_NAME}
`,d=Y(`,
`),p=y("button"),p.textContent=`{APP_URL}
`,h=Y(`,
`),g=y("button"),g.textContent=`{TOKEN}
2023-05-14 03:23:19 +08:00
`,_=Y("."),m(e,"for",i=n[31]),m(l,"type","text"),m(l,"id",o=n[31]),m(l,"spellcheck","false"),l.required=!0,m(f,"type","button"),m(f,"class","label label-sm link-primary txt-mono"),m(p,"type","button"),m(p,"class","label label-sm link-primary txt-mono"),m(g,"type","button"),m(g,"class","label label-sm link-primary txt-mono"),m(g,"title","Required parameter"),m(a,"class","help-block")},m($,C){S($,e,C),v(e,t),S($,s,C),S($,l,C),ae(l,n[0].actionUrl),S($,r,C),S($,a,C),v(a,u),v(a,f),v(a,d),v(a,p),v(a,h),v(a,g),v(a,_),b||(k=[J(l,"input",n[16]),J(f,"click",n[17]),J(p,"click",n[18]),J(g,"click",n[19])],b=!0)},p($,C){C[1]&1&&i!==(i=$[31])&&m(e,"for",i),C[1]&1&&o!==(o=$[31])&&m(l,"id",o),C[0]&1&&l.value!==$[0].actionUrl&&ae(l,$[0].actionUrl)},d($){$&&w(e),$&&w(s),$&&w(l),$&&w(r),$&&w(a),b=!1,De(k)}}}function FD(n){let e,t,i,s;return{c(){e=y("textarea"),m(e,"id",t=n[31]),m(e,"class","txt-mono"),m(e,"spellcheck","false"),m(e,"rows","14"),e.required=!0},m(l,o){S(l,e,o),ae(e,n[0].body),i||(s=J(e,"input",n[21]),i=!0)},p(l,o){o[1]&1&&t!==(t=l[31])&&m(e,"id",t),o[0]&1&&ae(e,l[0].body)},i:te,o:te,d(l){l&&w(e),i=!1,s()}}}function ND(n){let e,t,i,s;function l(a){n[20](a)}var o=n[4];function r(a){let u={id:a[31],language:"html"};return a[0].body!==void 0&&(u.value=a[0].body),{props:u}}return o&&(e=Rt(o,r(n)),ne.push(()=>he(e,"value",l))),{c(){e&&B(e.$$.fragment),i=Se()},m(a,u){e&&z(e,a,u),S(a,i,u),s=!0},p(a,u){const f={};if(u[1]&1&&(f.id=a[31]),!t&&u[0]&1&&(t=!0,f.value=a[0].body,ye(()=>t=!1)),u[0]&16&&o!==(o=a[4])){if(e){ue();const d=e;P(d.$$.fragment,1,0,()=>{H(d,1)}),fe()}o?(e=Rt(o,r(a)),ne.push(()=>he(e,"value",l)),B(e.$$.fragment),I(e.$$.fragment,1),z(e,i.parentNode,i)):e=null}else o&&e.$set(f)},i(a){s||(e&&I(e.$$.fragment,a),s=!0)},o(a){e&&P(e.$$.fragment,a),s=!1},d(a){a&&w(i),e&&H(e,a)}}}function RD(n){let e,t,i,s,l,o,r,a,u,f,d,p,h,g,_,b,k,$,C,T;const O=[ND,FD],M=[];function E(A,L){return A[4]&&!A[5]?0:1}return l=E(n),o=M[l]=O[l](n),{c(){e=y("label"),t=Y("Body (HTML)"),s=D(),o.c(),r=D(),a=y("div"),u=Y(`Available placeholder parameters:
2023-05-14 03:10:14 +08:00
`),f=y("button"),f.textContent=`{APP_NAME}
`,d=Y(`,
`),p=y("button"),p.textContent=`{APP_URL}
`,h=Y(`,
`),g=y("button"),g.textContent=`{TOKEN}
`,_=Y(`,
`),b=y("button"),b.textContent=`{ACTION_URL}
2023-05-14 03:23:19 +08:00
`,k=Y("."),m(e,"for",i=n[31]),m(f,"type","button"),m(f,"class","label label-sm link-primary txt-mono"),m(p,"type","button"),m(p,"class","label label-sm link-primary txt-mono"),m(g,"type","button"),m(g,"class","label label-sm link-primary txt-mono"),m(b,"type","button"),m(b,"class","label label-sm link-primary txt-mono"),m(b,"title","Required parameter"),m(a,"class","help-block")},m(A,L){S(A,e,L),v(e,t),S(A,s,L),M[l].m(A,L),S(A,r,L),S(A,a,L),v(a,u),v(a,f),v(a,d),v(a,p),v(a,h),v(a,g),v(a,_),v(a,b),v(a,k),$=!0,C||(T=[J(f,"click",n[22]),J(p,"click",n[23]),J(g,"click",n[24]),J(b,"click",n[25])],C=!0)},p(A,L){(!$||L[1]&1&&i!==(i=A[31]))&&m(e,"for",i);let N=l;l=E(A),l===N?M[l].p(A,L):(ue(),P(M[N],1,1,()=>{M[N]=null}),fe(),o=M[l],o?o.p(A,L):(o=M[l]=O[l](A),o.c()),I(o,1),o.m(r.parentNode,r))},i(A){$||(I(o),$=!0)},o(A){P(o),$=!1},d(A){A&&w(e),A&&w(s),M[l].d(A),A&&w(r),A&&w(a),C=!1,De(T)}}}function qD(n){let e,t,i,s,l,o;return e=new pe({props:{class:"form-field required",name:n[1]+".subject",$$slots:{default:[LD,({uniqueId:r})=>({31:r}),({uniqueId:r})=>[0,r?1:0]]},$$scope:{ctx:n}}}),i=new pe({props:{class:"form-field required",name:n[1]+".actionUrl",$$slots:{default:[PD,({uniqueId:r})=>({31:r}),({uniqueId:r})=>[0,r?1:0]]},$$scope:{ctx:n}}}),l=new pe({props:{class:"form-field m-0 required",name:n[1]+".body",$$slots:{default:[RD,({uniqueId:r})=>({31:r}),({uniqueId:r})=>[0,r?1:0]]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment),s=D(),B(l.$$.fragment)},m(r,a){z(e,r,a),S(r,t,a),z(i,r,a),S(r,s,a),z(l,r,a),o=!0},p(r,a){const u={};a[0]&2&&(u.name=r[1]+".subject"),a[0]&1|a[1]&3&&(u.$$scope={dirty:a,ctx:r}),e.$set(u);const f={};a[0]&2&&(f.name=r[1]+".actionUrl"),a[0]&1|a[1]&3&&(f.$$scope={dirty:a,ctx:r}),i.$set(f);const d={};a[0]&2&&(d.name=r[1]+".body"),a[0]&49|a[1]&3&&(d.$$scope={dirty:a,ctx:r}),l.$set(d)},i(r){o||(I(e.$$.fragment,r),I(i.$$.fragment,r),I(l.$$.fragment,r),o=!0)},o(r){P(e.$$.fragment,r),P(i.$$.fragment,r),P(l.$$.fragment,r),o=!1},d(r){H(e,r),r&&w(t),H(i,r),r&&w(s),H(l,r)}}}function Ah(n){let e,t,i,s,l;return{c(){e=y("i"),m(e,"class","ri-error-warning-fill txt-danger")},m(o,r){S(o,e,r),i=!0,s||(l=Oe(Be.call(null,e,{text:"Has errors",position:"left"})),s=!0)},i(o){i||(o&&et(()=>{i&&(t||(t=Ve(e,Jt,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=Ve(e,Jt,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&w(e),o&&t&&t.end(),s=!1,l()}}}function jD(n){let e,t,i,s,l,o,r,a,u,f=n[6]&&Ah();return{c(){e=y("div"),t=y("i"),i=D(),s=y("span"),l=Y(n[2]),o=D(),r=y("div"),a=D(),f&&f.c(),u=Se(),m(t,"class","ri-draft-line"),m(s,"class","txt"),m(e,"class","inline-flex"),m(r,"class","flex-fill")},m(d,p){S(d,e,p),v(e,t),v(e,i),v(e,s),v(s,l),S(d,o,p),S(d,r,p),S(d,a,p),f&&f.m(d,p),S(d,u,p)},p(d,p){p[0]&4&&le(l,d[2]),d[6]?f?p[0]&64&&I(f,1):(f=Ah(),f.c(),I(f,1),f.m(u.parentNode,u)):f&&(ue(),P(f,1,1,()=>{f=null}),fe())},d(d){d&&w(e),d&&w(o),d&&w(r),d&&w(a),f&&f.d(d),d&&w(u)}}}function VD(n){let e,t;const i=[n[8]];let s={$$slots:{header:[jD],default:[qD]},$$scope:{ctx:n}};for(let l=0;l<i.length;l+=1)s=je(s,i[l]);return e=new co({props:s}),n[26](e),e.$on("expand",n[27]),e.$on("collapse",n[28]),e.$on("toggle",n[29]),{c(){B(e.$$.fragment)},m(l,o){z(e,l,o),t=!0},p(l,o){const r=o[0]&256?Et(i,[Qt(l[8])]):{};o[0]&119|o[1]&2&&(r.$$scope={dirty:o,ctx:l}),e.$set(r)},i(l){t||(I(e.$$.fragment,l),t=!0)},o(l){P(e.$$.fragment,l),t=!1},d(l){n[26](null),H(e,l)}}}let Ih;function zD(n,e,t){let i;const s=["key","title","config","expand","collapse","collapseSiblings"];let l=tt(e,s),o;Ze(n,Ti,Z=>t(12,o=Z));let{key:r}=e,{title:a}=e,{config:u={}}=e,f,d=Ih,p=!1;function h(){f==null||f.expand()}function g(){f==null||f.collapse()}function _(){f==null||f.collapseSiblings()}async function b(){d||p||(t(5,p=!0),t(4,d=(await ut(()=>import("./CodeEditor-06ad58db.js"),["./CodeEditor-06ad58db.js","./index-03b6b7de.js"],import.meta.url)).default),Ih=d,t(5,p=!1))}function k(Z){U.copyToClipboard(Z),yo(`Copied ${Z} to clipboard`,2e3)}b();function $(){u.subject=this.value,t(0,u)}const C=()=>k("{APP_NAME}"),T=()=>k("{APP_URL}");function O(){u.action
<span class="txt">Send test email</span>`,m(e,"type","button"),m(e,"class","btn btn-expanded btn-outline")},m(s,l){S(s,e,l),t||(i=J(e,"click",n[26]),t=!0)},p:te,d(s){s&&w(e),t=!1,i()}}}function aA(n){let e,t,i,s,l,o,r,a;return{c(){e=y("button"),t=y("span"),t.textContent="Cancel",i=D(),s=y("button"),l=y("span"),l.textContent="Save changes",m(t,"class","txt"),m(e,"type","button"),m(e,"class","btn btn-transparent btn-hint"),e.disabled=n[3],m(l,"class","txt"),m(s,"type","submit"),m(s,"class","btn btn-expanded"),s.disabled=o=!n[4]||n[3],ee(s,"btn-loading",n[3])},m(u,f){S(u,e,f),v(e,t),S(u,i,f),S(u,s,f),v(s,l),r||(a=[J(e,"click",n[24]),J(s,"click",n[25])],r=!0)},p(u,f){f[0]&8&&(e.disabled=u[3]),f[0]&24&&o!==(o=!u[4]||u[3])&&(s.disabled=o),f[0]&8&&ee(s,"btn-loading",u[3])},d(u){u&&w(e),u&&w(i),u&&w(s),r=!1,De(a)}}}function uA(n){let e,t,i,s,l,o,r,a,u,f,d,p,h,g,_,b;const k=[XD,GD],$=[];function C(T,O){return T[2]?0:1}return p=C(n),h=$[p]=k[p](n),{c(){e=y("header"),t=y("nav"),i=y("div"),i.textContent="Settings",s=D(),l=y("div"),o=Y(n[5]),r=D(),a=y("div"),u=y("form"),f=y("div"),f.innerHTML="<p>Configure common settings for sending emails.</p>",d=D(),h.c(),m(i,"class","breadcrumb-item"),m(l,"class","breadcrumb-item"),m(t,"class","breadcrumbs"),m(e,"class","page-header"),m(f,"class","content txt-xl m-b-base"),m(u,"class","panel"),m(u,"autocomplete","off"),m(a,"class","wrapper")},m(T,O){S(T,e,O),v(e,t),v(t,i),v(t,s),v(t,l),v(l,o),S(T,r,O),S(T,a,O),v(a,u),v(u,f),v(u,d),$[p].m(u,null),g=!0,_||(b=J(u,"submit",xe(n[27])),_=!0)},p(T,O){(!g||O[0]&32)&&le(o,T[5]);let M=p;p=C(T),p===M?$[p].p(T,O):(ue(),P($[M],1,1,()=>{$[M]=null}),fe(),h=$[p],h?h.p(T,O):(h=$[p]=k[p](T),h.c()),I(h,1),h.m(u,null))},i(T){g||(I(h),g=!0)},o(T){P(h),g=!1},d(T){T&&w(e),T&&w(r),T&&w(a),$[p].d(),_=!1,b()}}}function fA(n){let e,t,i,s,l,o;e=new Mi({}),i=new Sn({props:{$$slots:{default:[uA]},$$scope:{ctx:n}}});let r={};return l=new ZD({props:r}),n[28](l),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment),s=D(),B(l.$$.fragment)},m(a,u){z(e,a,u),S(a,t,u),z(i,a,u),S(a,s,u),z(l,a,u),o=!0},p(a,u){const f={};u[0]&63|u[1]&2&&(f.$$scope={dirty:u,ctx:a}),i.$set(f);const d={};l.$set(d)},i(a){o||(I(e.$$.fragment,a),I(i.$$.fragment,a),I(l.$$.fragment,a),o=!0)},o(a){P(e.$$.fragment,a),P(i.$$.fragment,a),P(l.$$.fragment,a),o=!1},d(a){H(e,a),a&&w(t),H(i,a),a&&w(s),n[28](null),H(l,a)}}}function cA(n,e,t){let i,s,l;Ze(n,Mt,X=>t(5,l=X));const o=[{label:"Auto (StartTLS)",value:!1},{label:"Always",value:!0}],r=[{label:"PLAIN (default)",value:"PLAIN"},{label:"LOGIN",value:"LOGIN"}];ln(Mt,l="Mail settings",l);let a,u={},f={},d=!1,p=!1;h();async function h(){t(2,d=!0);try{const X=await de.settings.getAll()||{};_(X)}catch(X){de.error(X)}t(2,d=!1)}async function g(){if(!(p||!s)){t(3,p=!0);try{const X=await de.settings.update(U.filterRedactedProps(f));_(X),tn({}),Ht("Successfully saved mail settings.")}catch(X){de.error(X)}t(3,p=!1)}}function _(X={}){t(0,f={meta:(X==null?void 0:X.meta)||{},smtp:(X==null?void 0:X.smtp)||{}}),f.smtp.authMethod||t(0,f.smtp.authMethod=r[0].value,f),t(10,u=JSON.parse(JSON.stringify(f)))}function b(){t(0,f=JSON.parse(JSON.stringify(u||{})))}function k(){f.meta.senderName=this.value,t(0,f)}function $(){f.meta.senderAddress=this.value,t(0,f)}function C(X){n.$$.not_equal(f.meta.verificationTemplate,X)&&(f.meta.verificationTemplate=X,t(0,f))}function T(X){n.$$.not_equal(f.meta.resetPasswordTemplate,X)&&(f.meta.resetPasswordTemplate=X,t(0,f))}function O(X){n.$$.not_equal(f.meta.confirmEmailChangeTemplate,X)&&(f.meta.confirmEmailChangeTemplate=X,t(0,f))}function M(){f.smtp.enabled=this.checked,t(0,f)}function E(){f.smtp.host=this.value,t(0,f)}function A(){f.smtp.port=mt(this.value),t(0,f)}function L(X){n.$$.not_equal(f.smtp.tls,X)&&(f.smtp.tls=X,t(0,f))}function N(X){n.$$.not_equal(f.smtp.authMethod,X)&&(f.smtp.authMethod=X,t(0,f))}function q(){f.smtp.username=this.value,t(0,f)}function R(X){n.$$.not_equal(f.smtp.password,X)&&(f.smtp.password=X,t(0,f))}const F=()=>b(),V=()=>g(),j=()=>a==null?void 0:a.show(),W=()=>g();function Q(X){ne[X?"unshift":"push"
2023-05-14 03:10:14 +08:00
from the
`),r=y("strong"),u=Y(a),f=Y(`
to the
`),d=y("strong"),h=Y(p),g=Y(`.
`),_=y("br"),b=Y(`
There are numerous command line tools that can help you, such as:
`),k=y("a"),k.textContent=`rclone
`,$=Y(`,
`),C=y("a"),C.textContent=`s5cmd
2023-05-14 03:23:19 +08:00
`,T=Y(", etc."),O=D(),M=y("div"),m(i,"class","icon"),m(k,"href","https://github.com/rclone/rclone"),m(k,"target","_blank"),m(k,"rel","noopener noreferrer"),m(k,"class","txt-bold"),m(C,"href","https://github.com/peak/s5cmd"),m(C,"target","_blank"),m(C,"rel","noopener noreferrer"),m(C,"class","txt-bold"),m(l,"class","content"),m(t,"class","alert alert-warning m-0"),m(M,"class","clearfix m-t-base")},m(N,q){S(N,e,q),v(e,t),v(t,i),v(t,s),v(t,l),v(l,o),v(l,r),v(r,u),v(l,f),v(l,d),v(d,h),v(l,g),v(l,_),v(l,b),v(l,k),v(l,$),v(l,C),v(l,T),v(e,O),v(e,M),A=!0},p(N,q){var R;(!A||q&1)&&a!==(a=(R=N[0].s3)!=null&&R.enabled?"S3 storage":"local file system")&&le(u,a),(!A||q&2)&&p!==(p=N[1].s3.enabled?"S3 storage":"local file system")&&le(h,p)},i(N){A||(N&&et(()=>{A&&(E||(E=Ve(e,rt,{duration:150},!0)),E.run(1))}),A=!0)},o(N){N&&(E||(E=Ve(e,rt,{duration:150},!1)),E.run(0)),A=!1},d(N){N&&w(e),N&&E&&E.end()}}}function TA(n){var i;let e,t=((i=n[0].s3)==null?void 0:i.enabled)!=n[1].s3.enabled&&jh(n);return{c(){t&&t.c(),e=Se()},m(s,l){t&&t.m(s,l),S(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&&I(t,1)):(t=jh(s),t.c(),I(t,1),t.m(e.parentNode,e)):t&&(ue(),P(t,1,1,()=>{t=null}),fe())},d(s){t&&t.d(s),s&&w(e)}}}function Vh(n){let e;function t(l,o){return l[4]?EA:l[5]?MA:CA}let i=t(n),s=i(n);return{c(){s.c(),e=Se()},m(l,o){s.m(l,o),S(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){s.d(l),l&&w(e)}}}function CA(n){let e;return{c(){e=y("div"),e.innerHTML=`<i class="ri-checkbox-circle-line txt-success"></i>
<span class="txt">S3 connected successfully</span>`,m(e,"class","label label-sm label-success entrance-right")},m(t,i){S(t,e,i)},p:te,d(t){t&&w(e)}}}function MA(n){let e,t,i,s;return{c(){e=y("div"),e.innerHTML=`<i class="ri-error-warning-line txt-warning"></i>
<span class="txt">Failed to establish S3 connection</span>`,m(e,"class","label label-sm label-warning entrance-right")},m(l,o){var r;S(l,e,o),i||(s=Oe(t=Be.call(null,e,(r=n[5].data)==null?void 0:r.message)),i=!0)},p(l,o){var r;t&&jt(t.update)&&o&32&&t.update.call(null,(r=l[5].data)==null?void 0:r.message)},d(l){l&&w(e),i=!1,s()}}}function EA(n){let e;return{c(){e=y("span"),m(e,"class","loader loader-sm")},m(t,i){S(t,e,i)},p:te,d(t){t&&w(e)}}}function zh(n){let e,t,i,s;return{c(){e=y("button"),t=y("span"),t.textContent="Reset",m(t,"class","txt"),m(e,"type","button"),m(e,"class","btn btn-transparent btn-hint"),e.disabled=n[3]},m(l,o){S(l,e,o),v(e,t),i||(s=J(e,"click",n[14]),i=!0)},p(l,o){o&8&&(e.disabled=l[3])},d(l){l&&w(e),i=!1,s()}}}function OA(n){let e,t,i,s,l,o,r,a,u,f,d,p,h,g,_,b;const k=[$A,SA],$=[];function C(T,O){return T[2]?0:1}return p=C(n),h=$[p]=k[p](n),{c(){e=y("header"),t=y("nav"),i=y("div"),i.textContent="Settings",s=D(),l=y("div"),o=Y(n[7]),r=D(),a=y("div"),u=y("form"),f=y("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 a S3 compatible storage.</p>`,d=D(),h.c(),m(i,"class","breadcrumb-item"),m(l,"class","breadcrumb-item"),m(t,"class","breadcrumbs"),m(e,"class","page-header"),m(f,"class","content txt-xl m-b-base"),m(u,"class","panel"),m(u,"autocomplete","off"),m(a,"class","wrapper")},m(T,O){S(T,e,O),v(e,t),v(t,i),v(t,s),v(t,l),v(l,o),S(T,r,O),S(T,a,O),v(a,u),v(u,f),v(u,d),$[p].m(u,null),g=!0,_||(b=J(u,"submit",xe(n[16])),_=!0)},p(T,O){(!g||O&128)&&le(o,T[7]);let M=p;p=C(T),p===M?$[p].p(T,O):(ue(),P($[M],1,1,()=>{$[M]=null}),fe(),h=$[p],h?h.p(T,O):(h=$[p]=k[p](T),h.c()),I(h,1),h.m(u,null))},i(T){g||(I(h),g=!0)},o(T){P(h),g=!1},d(T){T&&w(e),T&&w(r),T&&w(a),$[p].d(),_=!1,b()}}}function DA(n){let e,t,i,s;return e=new Mi({}),i=new Sn({props:{$$slots:{default:[OA]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment)},m(l,o){z(e,l,o),S(l,t,o),z(i,l,o),s=!0},p(l,[o]){const r={};o&524543&&(r.$$scope={dirty:o,ctx:l}),i.$set(r)},i(l){s||(I(e.$$.fragment,l),I(i.$$.fragment,l),s=!0)},o(l){P(e.$$.fragment,l),P(i.$$.fragment,l),s=!1},d(l){H(e,l),l&&w(t),H(i,l)}}}const AA="s3_test_request";function IA(n,e,t){let i,s,l;Ze(n,Mt,M=>t(7,l=M)),ln(Mt,l="Files storage",l);let o={},r={},a=!1,u=!1,f=!1,d=null;p();async function p(){t(2,a=!0);try{const M=await de.settings.getAll()||{};g(M)}catch(M){de.error(M)}t(2,a=!1)}async function h(){if(!(u||!s)){t(3,u=!0);try{de.cancelRequest(AA);const M=await de.settings.update(U.filterRedactedProps(r));tn({}),await g(M),Fa(),d?Dy("Successfully saved but failed to establish S3 connection."):Ht("Successfully saved files storage settings.")}catch(M){de.error(M)}t(3,u=!1)}}async function g(M={}){t(1,r={s3:(M==null?void 0:M.s3)||{}}),t(0,o=JSON.parse(JSON.stringify(r)))}async function _(){t(1,r=JSON.parse(JSON.stringify(o||{})))}function b(M){n.$$.not_equal(r.s3,M)&&(r.s3=M,t(1,r))}function k(M){f=M,t(4,f)}function $(M){d=M,t(5,d)}const C=()=>_(),T=()=>h(),O=()=>h();return n.$$.update=()=>{n.$$.dirty&1&&t(10,i=JSON.stringify(o)),n.$$.dirty&1026&&t(6,s=i!=JSON.stringify(r))},[o,r,a,u,f,d,s,l,h,_,i,b,k,$,C,T,O]}class LA extends be{constructor(e){super(),ge(this,e,IA,DA,_e,{})}}function PA(n){let e,t,i,s,l,o,r,a;return{c(){e=y("input"),i=D(),s=y("label"),l=Y("Enable"),m(e,"type","checkbox"),m(e,"id",t=n[20]),m(s,"for",o=n[20])},m(u,f){S(u,e,f),e.checked=n[1].enabled,S(u,i,f),S(u,s,f),v(s,l),r||(a=J(e,"change",n[11]),r=!0)},p(u,f){f&1048576&&t!==(t=u[20])&&m(e,"id",t),f&2&&(e.checked=u[1].enabled),f&1048576&&o!==(o=u[20])&&m(s,"for",o)},d(u){u&&w(e),u&&w(i),u&&w(s),r=!1,a()}}}function FA(n){let e,t,i,s,l,o,r,a,u;return{c(){e=y("label"),t=Y("Client ID"),s=D(),l=y("input"),m(e,"for",i=n[20]),m(l,"type","text"),m(l,"id",o=n[20]),l.required=r=n[1].enabled},m(f,d){S(f,e,d),v(e,t),S(f,s,d),S(f,l,d),ae(l,n[1].clientId),a||(u=J(l,"input",n[12]),a=!0)},p(f,d){d&1048576&&i!==(i=f[20])&&m(e,"for",i),d&1048576&&o!==(o=f[20])&&m(l,"id",o),d&2&&r!==(r=f[1].enabled)&&(l.required=r),d&2&&l.value!==f[1].clientId&&ae(l,f[1].clientId)},d(f){f&&w(e),f&&w(s),f&&w(l),a=!1,u()}}}function NA(n){let e,t,i,s,l,o,r;function a(f){n[13](f)}let u={id:n[20],required:n[1].enabled};return n[1].clientSecret!==void 0&&(u.value=n[1].clientSecret),l=new mu({props:u}),ne.push(()=>he(l,"value",a)),{c(){e=y("label"),t=Y("Client secret"),s=D(),B(l.$$.fragment),m(e,"for",i=n[20])},m(f,d){S(f,e,d),v(e,t),S(f,s,d),z(l,f,d),r=!0},p(f,d){(!r||d&1048576&&i!==(i=f[20]))&&m(e,"for",i);const p={};d&1048576&&(p.id=f[20]),d&2&&(p.required=f[1].enabled),!o&&d&2&&(o=!0,p.value=f[1].clientSecret,ye(()=>o=!1)),l.$set(p)},i(f){r||(I(l.$$.fragment,f),r=!0)},o(f){P(l.$$.fragment,f),r=!1},d(f){f&&w(e),f&&w(s),H(l,f)}}}function Hh(n){let e,t,i,s;function l(a){n[14](a)}var o=n[3].optionsComponent;function r(a){let u={key:a[3].key};return a[1]!==void 0&&(u.config=a[1]),{props:u}}return o&&(t=Rt(o,r(n)),ne.push(()=>he(t,"config",l))),{c(){e=y("div"),t&&B(t.$$.fragment),m(e,"class","col-lg-12")},m(a,u){S(a,e,u),t&&z(t,e,null),s=!0},p(a,u){const f={};if(u&8&&(f.key=a[3].key),!i&&u&2&&(i=!0,f.config=a[
2023-05-14 03:10:14 +08:00
another PocketBase environment.</p>`,t=D(),i=y("div"),s=y("button"),s.innerHTML='<span class="txt">Copy</span>',l=D(),B(o.$$.fragment),r=D(),a=y("div"),u=y("div"),f=D(),d=y("button"),d.innerHTML=`<i class="ri-download-line"></i>
2023-05-14 03:23:19 +08:00
<span class="txt">Download as JSON</span>`,m(e,"class","content txt-xl m-b-base"),m(s,"type","button"),m(s,"class","btn btn-sm btn-transparent fade copy-schema svelte-jm5c4z"),m(i,"tabindex","0"),m(i,"class","export-preview svelte-jm5c4z"),m(u,"class","flex-fill"),m(d,"type","button"),m(d,"class","btn btn-expanded"),m(a,"class","flex m-t-base")},m(_,b){S(_,e,b),S(_,t,b),S(_,i,b),v(i,s),v(i,l),z(o,i,null),n[8](i),S(_,r,b),S(_,a,b),v(a,u),v(a,f),v(a,d),p=!0,h||(g=[J(s,"click",n[7]),J(i,"keydown",n[9]),J(d,"click",n[10])],h=!0)},p(_,b){const k={};b&4&&(k.content=_[2]),o.$set(k)},i(_){p||(I(o.$$.fragment,_),p=!0)},o(_){P(o.$$.fragment,_),p=!1},d(_){_&&w(e),_&&w(t),_&&w(i),H(o),n[8](null),_&&w(r),_&&w(a),h=!1,De(g)}}}function rI(n){let e;return{c(){e=y("div"),m(e,"class","loader")},m(t,i){S(t,e,i)},p:te,i:te,o:te,d(t){t&&w(e)}}}function aI(n){let e,t,i,s,l,o,r,a,u,f,d,p;const h=[rI,oI],g=[];function _(b,k){return b[1]?0:1}return f=_(n),d=g[f]=h[f](n),{c(){e=y("header"),t=y("nav"),i=y("div"),i.textContent="Settings",s=D(),l=y("div"),o=Y(n[3]),r=D(),a=y("div"),u=y("div"),d.c(),m(i,"class","breadcrumb-item"),m(l,"class","breadcrumb-item"),m(t,"class","breadcrumbs"),m(e,"class","page-header"),m(u,"class","panel"),m(a,"class","wrapper")},m(b,k){S(b,e,k),v(e,t),v(t,i),v(t,s),v(t,l),v(l,o),S(b,r,k),S(b,a,k),v(a,u),g[f].m(u,null),p=!0},p(b,k){(!p||k&8)&&le(o,b[3]);let $=f;f=_(b),f===$?g[f].p(b,k):(ue(),P(g[$],1,1,()=>{g[$]=null}),fe(),d=g[f],d?d.p(b,k):(d=g[f]=h[f](b),d.c()),I(d,1),d.m(u,null))},i(b){p||(I(d),p=!0)},o(b){P(d),p=!1},d(b){b&&w(e),b&&w(r),b&&w(a),g[f].d()}}}function uI(n){let e,t,i,s;return e=new Mi({}),i=new Sn({props:{$$slots:{default:[aI]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment)},m(l,o){z(e,l,o),S(l,t,o),z(i,l,o),s=!0},p(l,[o]){const r={};o&8207&&(r.$$scope={dirty:o,ctx:l}),i.$set(r)},i(l){s||(I(e.$$.fragment,l),I(i.$$.fragment,l),s=!0)},o(l){P(e.$$.fragment,l),P(i.$$.fragment,l),s=!1},d(l){H(e,l),l&&w(t),H(i,l)}}}function fI(n,e,t){let i,s;Ze(n,Mt,b=>t(3,s=b)),ln(Mt,s="Export collections",s);const l="export_"+U.randomString(5);let o,r=[],a=!1;u();async function u(){t(1,a=!0);try{t(6,r=await de.collections.getFullList(100,{$cancelKey:l,sort:"updated"}));for(let b of r)delete b.created,delete b.updated}catch(b){de.error(b)}t(1,a=!1)}function f(){U.downloadJson(r,"pb_schema")}function d(){U.copyToClipboard(i),yo("The configuration was copied to your clipboard!",3e3)}const p=()=>d();function h(b){ne[b?"unshift":"push"](()=>{o=b,t(0,o)})}const g=b=>{if(b.ctrlKey&&b.code==="KeyA"){b.preventDefault();const k=window.getSelection(),$=document.createRange();$.selectNodeContents(o),k.removeAllRanges(),k.addRange($)}},_=()=>f();return n.$$.update=()=>{n.$$.dirty&64&&t(2,i=JSON.stringify(r,null,4))},[o,a,i,s,f,d,r,p,h,g,_]}class cI extends be{constructor(e){super(),ge(this,e,fI,uI,_e,{})}}function t_(n,e,t){const i=n.slice();return i[14]=e[t],i}function n_(n,e,t){const i=n.slice();return i[17]=e[t][0],i[18]=e[t][1],i}function i_(n,e,t){const i=n.slice();return i[14]=e[t],i}function s_(n,e,t){const i=n.slice();return i[17]=e[t][0],i[23]=e[t][1],i}function l_(n,e,t){const i=n.slice();return i[14]=e[t],i}function o_(n,e,t){const i=n.slice();return i[17]=e[t][0],i[18]=e[t][1],i}function r_(n,e,t){const i=n.slice();return i[30]=e[t],i}function dI(n){let e,t,i,s,l=n[1].name+"",o,r=n[9]&&a_(),a=n[0].name!==n[1].name&&u_(n);return{c(){e=y("div"),r&&r.c(),t=D(),a&&a.c(),i=D(),s=y("strong"),o=Y(l),m(s,"class","txt"),m(e,"class","inline-flex fleg-gap-5")},m(u,f){S(u,e,f),r&&r.m(e,null),v(e,t),a&&a.m(e,null),v(e,i),v(e,s),v(s,o)},p(u,f){u[9]?r||(r=a_(),r.c(),r.m(e,t)):r&&(r.d(1),r=null),u[0].name!==u[1].name?a?a.p(u,f):(a=u_(u),a.c(),a.m(e,i)):a&&(a.d(1),a=null),f[0]&2&&l!==(l=u[1].name+"")&&le(o,l)},d(u){u&&w(e),r&&r.d(),a&&a.d()}}}function pI(n){var o;let e,t,i,s=((o=n[0])==null?void 0:o.name)+"",l;return{c(){e=y("span"),e.textContent="Deleted",t=D(),i=y("strong"),l=Y(s),m(e,"class","label label-danger")},m(r,a){S(r,e,a),S(r,t,a),S(r,i,a),v(i,l)},p(r,a){var u;a[0]&1&&s!==(s=((u=r[0])==null?
2023-05-14 03:10:14 +08:00
<th width="10%" class="svelte-lmkr38">Old</th>
2023-05-14 03:23:19 +08:00
<th width="10%" class="svelte-lmkr38">New</th></tr>`,l=D(),o=y("tbody");for(let T=0;T<g.length;T+=1)g[T].c();r=D(),_&&_.c(),a=D();for(let T=0;T<k.length;T+=1)k[T].c();u=D();for(let T=0;T<C.length;T+=1)C[T].c();m(e,"class","section-title"),m(i,"class","table collections-diff-table m-b-base svelte-lmkr38")},m(T,O){S(T,e,O),p.m(e,null),S(T,t,O),S(T,i,O),v(i,s),v(i,l),v(i,o);for(let M=0;M<g.length;M+=1)g[M]&&g[M].m(o,null);v(o,r),_&&_.m(o,null),v(o,a);for(let M=0;M<k.length;M+=1)k[M]&&k[M].m(o,null);v(o,u);for(let M=0;M<C.length;M+=1)C[M]&&C[M].m(o,null)},p(T,O){if(d===(d=f(T))&&p?p.p(T,O):(p.d(1),p=d(T),p&&(p.c(),p.m(e,null))),O[0]&7203){h=T[11];let M;for(M=0;M<h.length;M+=1){const E=r_(T,h,M);g[M]?g[M].p(E,O):(g[M]=f_(E),g[M].c(),g[M].m(o,r))}for(;M<g.length;M+=1)g[M].d(1);g.length=h.length}if(T[2]||T[5]?_?_.p(T,O):(_=c_(T),_.c(),_.m(o,a)):_&&(_.d(1),_=null),O[0]&4248){b=T[7];let M;for(M=0;M<b.length;M+=1){const E=i_(T,b,M);k[M]?k[M].p(E,O):(k[M]=__(E),k[M].c(),k[M].m(o,u))}for(;M<k.length;M+=1)k[M].d(1);k.length=b.length}if(O[0]&4352){$=T[8];let M;for(M=0;M<$.length;M+=1){const E=t_(T,$,M);C[M]?C[M].p(E,O):(C[M]=b_(E),C[M].c(),C[M].m(o,null))}for(;M<C.length;M+=1)C[M].d(1);C.length=$.length}},i:te,o:te,d(T){T&&w(e),p.d(),T&&w(t),T&&w(i),pt(g,T),_&&_.d(),pt(k,T),pt(C,T)}}}function Hn(n,e){n=n||[];for(let t of n)if(t.id==e)return t;return null}function bn(n,e){return n===e?!1:JSON.stringify(n)!==JSON.stringify(e)}function _I(n,e,t){let i,s,l,{collectionA:o=new kn}=e,{collectionB:r=new kn}=e,{deleteMissing:a=!1}=e,u=[],f=[],d=[],p=[],h=[];const g=Object.keys(new kn().$export()).filter(k=>!["schema","created","updated"].includes(k));function _(){t(4,f=Array.isArray(r==null?void 0:r.schema)?r==null?void 0:r.schema.concat():[]),a||t(4,f=f.concat(u.filter(k=>!f.find($=>k.id==$.id))))}function b(k){return typeof k>"u"?"":U.isObject(k)?JSON.stringify(k,null,4):k}return n.$$set=k=>{"collectionA"in k&&t(0,o=k.collectionA),"collectionB"in k&&t(1,r=k.collectionB),"deleteMissing"in k&&t(2,a=k.deleteMissing)},n.$$.update=()=>{n.$$.dirty[0]&2&&t(5,i=!(r!=null&&r.id)&&!(r!=null&&r.name)),n.$$.dirty[0]&33&&t(10,s=!i&&!(o!=null&&o.id)),n.$$.dirty[0]&1&&t(3,u=Array.isArray(o==null?void 0:o.schema)?o==null?void 0:o.schema.concat():[]),n.$$.dirty[0]&7&&(typeof(o==null?void 0:o.schema)<"u"||typeof(r==null?void 0:r.schema)<"u"||typeof a<"u")&&_(),n.$$.dirty[0]&24&&t(6,d=u.filter(k=>!f.find($=>k.id==$.id))),n.$$.dirty[0]&24&&t(7,p=f.filter(k=>u.find($=>$.id==k.id))),n.$$.dirty[0]&24&&t(8,h=f.filter(k=>!u.find($=>$.id==k.id))),n.$$.dirty[0]&7&&t(9,l=U.hasCollectionChanges(o,r,a))},[o,r,a,u,f,i,d,p,h,l,s,g,b]}class gI extends be{constructor(e){super(),ge(this,e,_I,hI,_e,{collectionA:0,collectionB:1,deleteMissing:2},null,[-1,-1])}}function v_(n,e,t){const i=n.slice();return i[17]=e[t],i}function y_(n){let e,t;return e=new gI({props:{collectionA:n[17].old,collectionB:n[17].new,deleteMissing:n[3]}}),{c(){B(e.$$.fragment)},m(i,s){z(e,i,s),t=!0},p(i,s){const l={};s&4&&(l.collectionA=i[17].old),s&4&&(l.collectionB=i[17].new),s&8&&(l.deleteMissing=i[3]),e.$set(l)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function bI(n){let e,t,i=n[2],s=[];for(let o=0;o<i.length;o+=1)s[o]=y_(v_(n,i,o));const l=o=>P(s[o],1,1,()=>{s[o]=null});return{c(){for(let o=0;o<s.length;o+=1)s[o].c();e=Se()},m(o,r){for(let a=0;a<s.length;a+=1)s[a]&&s[a].m(o,r);S(o,e,r),t=!0},p(o,r){if(r&12){i=o[2];let a;for(a=0;a<i.length;a+=1){const u=v_(o,i,a);s[a]?(s[a].p(u,r),I(s[a],1)):(s[a]=y_(u),s[a].c(),I(s[a],1),s[a].m(e.parentNode,e))}for(ue(),a=i.length;a<s.length;a+=1)l(a);fe()}},i(o){if(!t){for(let r=0;r<i.length;r+=1)I(s[r]);t=!0}},o(o){s=s.filter(Boolean);for(let r=0;r<s.length;r+=1)P(s[r]);t=!1},d(o){pt(s,o),o&&w(e)}}}function vI(n){let e;return{c(){e=y("h4"),e.textContent="Side-by-side diff",m(e,"class","center txt-break")},m(t,i){S(t,e,i)},p:te,d(t){t&&w(e)}}}function yI(n){let e,t,i,s,l,o,r;return{c(){e=y("button"),t=Y("Close"),i=D(),s=y("button"),l=y("span"),l.textContent="Confirm and import",m(e,"type","button"),m(e,"class","btn bt
2023-05-14 03:10:14 +08:00
- ${T.join(`
2023-05-14 03:23:19 +08:00
- `)}`,()=>{g()}):g()}async function g(){if(!u){t(4,u=!0);try{await de.collections.import(o,a),Ht("Successfully imported collections configuration."),i("submit")}catch(T){de.error(T)}t(4,u=!1),d()}}const _=()=>h(),b=()=>!u;function k(T){ne[T?"unshift":"push"](()=>{s=T,t(1,s)})}function $(T){me.call(this,n,T)}function C(T){me.call(this,n,T)}return n.$$.update=()=>{n.$$.dirty&384&&Array.isArray(l)&&Array.isArray(o)&&p()},[d,s,r,a,u,h,f,l,o,_,b,k,$,C]}class SI extends be{constructor(e){super(),ge(this,e,wI,kI,_e,{show:6,hide:0})}get show(){return this.$$.ctx[6]}get hide(){return this.$$.ctx[0]}}function k_(n,e,t){const i=n.slice();return i[32]=e[t],i}function w_(n,e,t){const i=n.slice();return i[35]=e[t],i}function S_(n,e,t){const i=n.slice();return i[32]=e[t],i}function $I(n){let e,t,i,s,l,o,r,a,u,f,d,p,h,g,_,b,k,$,C,T,O,M,E;a=new pe({props:{class:"form-field "+(n[6]?"":"field-error"),name:"collections",$$slots:{default:[CI,({uniqueId:F})=>({40:F}),({uniqueId:F})=>[0,F?512:0]]},$$scope:{ctx:n}}});let A=!1,L=n[6]&&n[1].length&&!n[7]&&T_(),N=n[6]&&n[1].length&&n[7]&&C_(n),q=n[13].length&&R_(n),R=!!n[0]&&q_(n);return{c(){e=y("input"),t=D(),i=y("div"),s=y("p"),l=Y(`Paste below the collections configuration you want to import or
`),o=y("button"),o.innerHTML='<span class="txt">Load from JSON file</span>',r=D(),B(a.$$.fragment),u=D(),f=D(),L&&L.c(),d=D(),N&&N.c(),p=D(),q&&q.c(),h=D(),g=y("div"),R&&R.c(),_=D(),b=y("div"),k=D(),$=y("button"),C=y("span"),C.textContent="Review",m(e,"type","file"),m(e,"class","hidden"),m(e,"accept",".json"),m(o,"class","btn btn-outline btn-sm m-l-5"),ee(o,"btn-loading",n[12]),m(i,"class","content txt-xl m-b-base"),m(b,"class","flex-fill"),m(C,"class","txt"),m($,"type","button"),m($,"class","btn btn-expanded btn-warning m-l-auto"),$.disabled=T=!n[14],m(g,"class","flex m-t-base")},m(F,V){S(F,e,V),n[19](e),S(F,t,V),S(F,i,V),v(i,s),v(s,l),v(s,o),S(F,r,V),z(a,F,V),S(F,u,V),S(F,f,V),L&&L.m(F,V),S(F,d,V),N&&N.m(F,V),S(F,p,V),q&&q.m(F,V),S(F,h,V),S(F,g,V),R&&R.m(g,null),v(g,_),v(g,b),v(g,k),v(g,$),v($,C),O=!0,M||(E=[J(e,"change",n[20]),J(o,"click",n[21]),J($,"click",n[26])],M=!0)},p(F,V){(!O||V[0]&4096)&&ee(o,"btn-loading",F[12]);const j={};V[0]&64&&(j.class="form-field "+(F[6]?"":"field-error")),V[0]&65|V[1]&1536&&(j.$$scope={dirty:V,ctx:F}),a.$set(j),F[6]&&F[1].length&&!F[7]?L||(L=T_(),L.c(),L.m(d.parentNode,d)):L&&(L.d(1),L=null),F[6]&&F[1].length&&F[7]?N?N.p(F,V):(N=C_(F),N.c(),N.m(p.parentNode,p)):N&&(N.d(1),N=null),F[13].length?q?q.p(F,V):(q=R_(F),q.c(),q.m(h.parentNode,h)):q&&(q.d(1),q=null),F[0]?R?R.p(F,V):(R=q_(F),R.c(),R.m(g,_)):R&&(R.d(1),R=null),(!O||V[0]&16384&&T!==(T=!F[14]))&&($.disabled=T)},i(F){O||(I(a.$$.fragment,F),I(A),O=!0)},o(F){P(a.$$.fragment,F),P(A),O=!1},d(F){F&&w(e),n[19](null),F&&w(t),F&&w(i),F&&w(r),H(a,F),F&&w(u),F&&w(f),L&&L.d(F),F&&w(d),N&&N.d(F),F&&w(p),q&&q.d(F),F&&w(h),F&&w(g),R&&R.d(),M=!1,De(E)}}}function TI(n){let e;return{c(){e=y("div"),m(e,"class","loader")},m(t,i){S(t,e,i)},p:te,i:te,o:te,d(t){t&&w(e)}}}function $_(n){let e;return{c(){e=y("div"),e.textContent="Invalid collections configuration.",m(e,"class","help-block help-block-error")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function CI(n){let e,t,i,s,l,o,r,a,u,f,d=!!n[0]&&!n[6]&&$_();return{c(){e=y("label"),t=Y("Collections"),s=D(),l=y("textarea"),r=D(),d&&d.c(),a=Se(),m(e,"for",i=n[40]),m(e,"class","p-b-10"),m(l,"id",o=n[40]),m(l,"class","code"),m(l,"spellcheck","false"),m(l,"rows","15"),l.required=!0},m(p,h){S(p,e,h),v(e,t),S(p,s,h),S(p,l,h),ae(l,n[0]),S(p,r,h),d&&d.m(p,h),S(p,a,h),u||(f=J(l,"input",n[22]),u=!0)},p(p,h){h[1]&512&&i!==(i=p[40])&&m(e,"for",i),h[1]&512&&o!==(o=p[40])&&m(l,"id",o),h[0]&1&&ae(l,p[0]),p[0]&&!p[6]?d||(d=$_(),d.c(),d.m(a.parentNode,a)):d&&(d.d(1),d=null)},d(p){p&&w(e),p&&w(s),p&&w(l),p&&w(r),d&&d.d(p),p&&w(a),u=!1,f()}}}function T_(n){let e;return{c(){e=y("div"),e.innerHTML=`<div class="icon"><i class="ri-information-line"></i></div>
2023-05-14 03:10:14 +08:00
<div class="content"><string>Your collections configuration is already up-to-date!</string></div>`,m(e,"class","alert alert-info")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function C_(n){let e,t,i,s,l,o=n[9].length&&M_(n),r=n[4].length&&D_(n),a=n[8].length&&P_(n);return{c(){e=y("h5"),e.textContent="Detected changes",t=D(),i=y("div"),o&&o.c(),s=D(),r&&r.c(),l=D(),a&&a.c(),m(e,"class","section-title"),m(i,"class","list")},m(u,f){S(u,e,f),S(u,t,f),S(u,i,f),o&&o.m(i,null),v(i,s),r&&r.m(i,null),v(i,l),a&&a.m(i,null)},p(u,f){u[9].length?o?o.p(u,f):(o=M_(u),o.c(),o.m(i,s)):o&&(o.d(1),o=null),u[4].length?r?r.p(u,f):(r=D_(u),r.c(),r.m(i,l)):r&&(r.d(1),r=null),u[8].length?a?a.p(u,f):(a=P_(u),a.c(),a.m(i,null)):a&&(a.d(1),a=null)},d(u){u&&w(e),u&&w(t),u&&w(i),o&&o.d(),r&&r.d(),a&&a.d()}}}function M_(n){let e=[],t=new Map,i,s=n[9];const l=o=>o[32].id;for(let o=0;o<s.length;o+=1){let r=S_(n,s,o),a=l(r);t.set(a,e[o]=O_(a,r))}return{c(){for(let o=0;o<e.length;o+=1)e[o].c();i=Se()},m(o,r){for(let a=0;a<e.length;a+=1)e[a]&&e[a].m(o,r);S(o,i,r)},p(o,r){r[0]&512&&(s=o[9],e=yt(e,r,l,1,o,s,t,i.parentNode,us,O_,i,S_))},d(o){for(let r=0;r<e.length;r+=1)e[r].d(o);o&&w(i)}}}function E_(n){let e,t,i=n[32].id+"",s,l;return{c(){e=y("small"),t=Y("("),s=Y(i),l=Y(")"),m(e,"class","txt-hint")},m(o,r){S(o,e,r),v(e,t),v(e,s),v(e,l)},p(o,r){r[0]&512&&i!==(i=o[32].id+"")&&le(s,i)},d(o){o&&w(e)}}}function O_(n,e){let t,i,s,l,o=e[32].name+"",r,a,u,f=e[32].id&&E_(e);return{key:n,first:null,c(){t=y("div"),i=y("span"),i.textContent="Deleted",s=D(),l=y("strong"),r=Y(o),a=D(),f&&f.c(),u=D(),m(i,"class","label label-danger list-label svelte-1jx20fl"),m(t,"class","list-item"),this.first=t},m(d,p){S(d,t,p),v(t,i),v(t,s),v(t,l),v(l,r),v(t,a),f&&f.m(t,null),v(t,u)},p(d,p){e=d,p[0]&512&&o!==(o=e[32].name+"")&&le(r,o),e[32].id?f?f.p(e,p):(f=E_(e),f.c(),f.m(t,u)):f&&(f.d(1),f=null)},d(d){d&&w(t),f&&f.d()}}}function D_(n){let e=[],t=new Map,i,s=n[4];const l=o=>o[35].old.id+o[35].new.id;for(let o=0;o<s.length;o+=1){let r=w_(n,s,o),a=l(r);t.set(a,e[o]=L_(a,r))}return{c(){for(let o=0;o<e.length;o+=1)e[o].c();i=Se()},m(o,r){for(let a=0;a<e.length;a+=1)e[a]&&e[a].m(o,r);S(o,i,r)},p(o,r){r[0]&16&&(s=o[4],e=yt(e,r,l,1,o,s,t,i.parentNode,us,L_,i,w_))},d(o){for(let r=0;r<e.length;r+=1)e[r].d(o);o&&w(i)}}}function A_(n){let e,t=n[35].old.name+"",i,s,l;return{c(){e=y("strong"),i=Y(t),s=D(),l=y("i"),m(e,"class","txt-strikethrough txt-hint"),m(l,"class","ri-arrow-right-line txt-sm")},m(o,r){S(o,e,r),v(e,i),S(o,s,r),S(o,l,r)},p(o,r){r[0]&16&&t!==(t=o[35].old.name+"")&&le(i,t)},d(o){o&&w(e),o&&w(s),o&&w(l)}}}function I_(n){let e,t,i=n[35].new.id+"",s,l;return{c(){e=y("small"),t=Y("("),s=Y(i),l=Y(")"),m(e,"class","txt-hint")},m(o,r){S(o,e,r),v(e,t),v(e,s),v(e,l)},p(o,r){r[0]&16&&i!==(i=o[35].new.id+"")&&le(s,i)},d(o){o&&w(e)}}}function L_(n,e){let t,i,s,l,o,r,a=e[35].new.name+"",u,f,d,p=e[35].old.name!==e[35].new.name&&A_(e),h=e[35].new.id&&I_(e);return{key:n,first:null,c(){t=y("div"),i=y("span"),i.textContent="Changed",s=D(),l=y("div"),p&&p.c(),o=D(),r=y("strong"),u=Y(a),f=D(),h&&h.c(),d=D(),m(i,"class","label label-warning list-label svelte-1jx20fl"),m(l,"class","inline-flex flex-gap-5"),m(t,"class","list-item"),this.first=t},m(g,_){S(g,t,_),v(t,i),v(t,s),v(t,l),p&&p.m(l,null),v(l,o),v(l,r),v(r,u),v(l,f),h&&h.m(l,null),v(t,d)},p(g,_){e=g,e[35].old.name!==e[35].new.name?p?p.p(e,_):(p=A_(e),p.c(),p.m(l,o)):p&&(p.d(1),p=null),_[0]&16&&a!==(a=e[35].new.name+"")&&le(u,a),e[35].new.id?h?h.p(e,_):(h=I_(e),h.c(),h.m(l,null)):h&&(h.d(1),h=null)},d(g){g&&w(t),p&&p.d(),h&&h.d()}}}function P_(n){let e=[],t=new Map,i,s=n[8];const l=o=>o[32].id;for(let o=0;o<s.length;o+=1){let r=k_(n,s,o),a=l(r);t.set(a,e[o]=N_(a,r))}return{c(){for(let o=0;o<e.length;o+=1)e[o].c();i=Se()},m(o,r){for(let a=0;a<e.length;a+=1)e[a]&&e[a].m(o,r);S(o,i,r)},p(o,r){r[0]&256&&(s=o[8],e=yt(e,r,l,1,o,s,t,i.parentNode,us,N_,i,k_))},d(o){for(let r=0;r<e.length;r+=1)e[r].d(o);o&&w(i)}}}function F_(n){let e,t,i=n[32].id+"",s,l;return{c(){e=y("small"),t=Y("("),s=Y(i),l=Y(")"),m(e,"class","txt-hint")},m(o,r){S(o,e,r
imported with different IDs. You can replace them in the import if you want
2023-05-14 03:23:19 +08:00
to.</string>`,l=D(),o=y("button"),o.innerHTML='<span class="txt">Replace with original ids</span>',m(t,"class","icon"),m(s,"class","content"),m(o,"type","button"),m(o,"class","btn btn-warning btn-sm btn-outline"),m(e,"class","alert alert-warning m-t-base")},m(u,f){S(u,e,f),v(e,t),v(e,i),v(e,s),v(e,l),v(e,o),r||(a=J(o,"click",n[24]),r=!0)},p:te,d(u){u&&w(e),r=!1,a()}}}function q_(n){let e,t,i;return{c(){e=y("button"),e.innerHTML='<span class="txt">Clear</span>',m(e,"type","button"),m(e,"class","btn btn-transparent link-hint")},m(s,l){S(s,e,l),t||(i=J(e,"click",n[25]),t=!0)},p:te,d(s){s&&w(e),t=!1,i()}}}function MI(n){let e,t,i,s,l,o,r,a,u,f,d,p;const h=[TI,$I],g=[];function _(b,k){return b[5]?0:1}return f=_(n),d=g[f]=h[f](n),{c(){e=y("header"),t=y("nav"),i=y("div"),i.textContent="Settings",s=D(),l=y("div"),o=Y(n[15]),r=D(),a=y("div"),u=y("div"),d.c(),m(i,"class","breadcrumb-item"),m(l,"class","breadcrumb-item"),m(t,"class","breadcrumbs"),m(e,"class","page-header"),m(u,"class","panel"),m(a,"class","wrapper")},m(b,k){S(b,e,k),v(e,t),v(t,i),v(t,s),v(t,l),v(l,o),S(b,r,k),S(b,a,k),v(a,u),g[f].m(u,null),p=!0},p(b,k){(!p||k[0]&32768)&&le(o,b[15]);let $=f;f=_(b),f===$?g[f].p(b,k):(ue(),P(g[$],1,1,()=>{g[$]=null}),fe(),d=g[f],d?d.p(b,k):(d=g[f]=h[f](b),d.c()),I(d,1),d.m(u,null))},i(b){p||(I(d),p=!0)},o(b){P(d),p=!1},d(b){b&&w(e),b&&w(r),b&&w(a),g[f].d()}}}function EI(n){let e,t,i,s,l,o;e=new Mi({}),i=new Sn({props:{$$slots:{default:[MI]},$$scope:{ctx:n}}});let r={};return l=new SI({props:r}),n[27](l),l.$on("submit",n[28]),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment),s=D(),B(l.$$.fragment)},m(a,u){z(e,a,u),S(a,t,u),z(i,a,u),S(a,s,u),z(l,a,u),o=!0},p(a,u){const f={};u[0]&65535|u[1]&1024&&(f.$$scope={dirty:u,ctx:a}),i.$set(f);const d={};l.$set(d)},i(a){o||(I(e.$$.fragment,a),I(i.$$.fragment,a),I(l.$$.fragment,a),o=!0)},o(a){P(e.$$.fragment,a),P(i.$$.fragment,a),P(l.$$.fragment,a),o=!1},d(a){H(e,a),a&&w(t),H(i,a),a&&w(s),n[27](null),H(l,a)}}}function OI(n,e,t){let i,s,l,o,r,a,u;Ze(n,Mt,Z=>t(15,u=Z)),ln(Mt,u="Import collections",u);let f,d,p="",h=!1,g=[],_=[],b=!0,k=[],$=!1;C();async function C(){t(5,$=!0);try{t(2,_=await de.collections.getFullList(200));for(let Z of _)delete Z.created,delete Z.updated}catch(Z){de.error(Z)}t(5,$=!1)}function T(){if(t(4,k=[]),!!i)for(let Z of g){const re=U.findByKey(_,"id",Z.id);!(re!=null&&re.id)||!U.hasCollectionChanges(re,Z,b)||k.push({new:Z,old:re})}}function O(){t(1,g=[]);try{t(1,g=JSON.parse(p))}catch{}Array.isArray(g)?t(1,g=U.filterDuplicatesByKey(g)):t(1,g=[]);for(let Z of g)delete Z.created,delete Z.updated,Z.schema=U.filterDuplicatesByKey(Z.schema)}function M(){var Z,re;for(let x of g){const se=U.findByKey(_,"name",x.name)||U.findByKey(_,"id",x.id);if(!se)continue;const ve=x.id,$e=se.id;x.id=$e;const ze=Array.isArray(se.schema)?se.schema:[],Ue=Array.isArray(x.schema)?x.schema:[];for(const we of Ue){const Ee=U.findByKey(ze,"name",we.name);Ee&&Ee.id&&(we.id=Ee.id)}for(let we of g)if(Array.isArray(we.schema))for(let Ee of we.schema)(Z=Ee.options)!=null&&Z.collectionId&&((re=Ee.options)==null?void 0:re.collectionId)===ve&&(Ee.options.collectionId=$e)}t(0,p=JSON.stringify(g,null,4))}function E(Z){t(12,h=!0);const re=new FileReader;re.onload=async x=>{t(12,h=!1),t(10,f.value="",f),t(0,p=x.target.result),await cn(),g.length||(As("Invalid collections configuration."),A())},re.onerror=x=>{console.warn(x),As("Failed to load the imported JSON."),t(12,h=!1),t(10,f.value="",f)},re.readAsText(Z)}function A(){t(0,p=""),t(10,f.value="",f),tn({})}function L(Z){ne[Z?"unshift":"push"](()=>{f=Z,t(10,f)})}const N=()=>{f.files.length&&E(f.files[0])},q=()=>{f.click()};function R(){p=this.value,t(0,p)}function F(){b=this.checked,t(3,b)}const V=()=>M(),j=()=>A(),W=()=>d==null?void 0:d.show(_,g,b);function Q(Z){ne[Z?"unshift":"push"](()=>{d=Z,t(11,d)})}const X=()=>A();return n.$$.update=()=>{n.$$.dirty[0]&1&&typeof p<"u"&&O(),n.$$.dirty[0]&3&&t(6,i=!!p&&g.length&&g.length===g.filter(Z=>!!Z.id&&!!Z.name).length),n.$$.dirty[0]&78&&t(9,s=_.filter(Z=>i&&b&&!U.findByKey(g,"id",Z.id))),n.$$.d
2023-05-14 03:10:14 +08:00
<div class="content"><p>Please note that during the backup other concurrent write requrests may fail since the
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
2023-05-14 03:23:19 +08:00
separately since they are not locally stored and will not be included in the final backup!</p></div>`,t=D(),i=y("form"),B(s.$$.fragment),m(e,"class","alert alert-info"),m(i,"id",n[4]),m(i,"autocomplete","off")},m(a,u){S(a,e,u),S(a,t,u),S(a,i,u),z(s,i,null),l=!0,o||(r=J(i,"submit",xe(n[5])),o=!0)},p(a,u){const f={};u&98308&&(f.$$scope={dirty:u,ctx:a}),s.$set(f)},i(a){l||(I(s.$$.fragment,a),l=!0)},o(a){P(s.$$.fragment,a),l=!1},d(a){a&&w(e),a&&w(t),a&&w(i),H(s),o=!1,r()}}}function LI(n){let e;return{c(){e=y("h4"),e.textContent="Initialize new backup",m(e,"class","center txt-break")},m(t,i){S(t,e,i)},p:te,d(t){t&&w(e)}}}function PI(n){let e,t,i,s,l,o,r;return{c(){e=y("button"),t=y("span"),t.textContent="Cancel",i=D(),s=y("button"),l=y("span"),l.textContent="Start backup",m(t,"class","txt"),m(e,"type","button"),m(e,"class","btn btn-transparent"),e.disabled=n[3],m(l,"class","txt"),m(s,"type","submit"),m(s,"form",n[4]),m(s,"class","btn btn-expanded"),s.disabled=n[3],ee(s,"btn-loading",n[3])},m(a,u){S(a,e,u),v(e,t),S(a,i,u),S(a,s,u),v(s,l),o||(r=J(e,"click",n[0]),o=!0)},p(a,u){u&8&&(e.disabled=a[3]),u&8&&(s.disabled=a[3]),u&8&&ee(s,"btn-loading",a[3])},d(a){a&&w(e),a&&w(i),a&&w(s),o=!1,r()}}}function FI(n){let e,t,i={class:"backup-create-panel",beforeOpen:n[8],beforeHide:n[9],popup:!0,$$slots:{footer:[PI],header:[LI],default:[II]},$$scope:{ctx:n}};return e=new on({props:i}),n[10](e),e.$on("show",n[11]),e.$on("hide",n[12]),{c(){B(e.$$.fragment)},m(s,l){z(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||(I(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[10](null),H(e,s)}}}function NI(n,e,t){const i=Tt(),s="backup_create_"+U.randomString(5);let l,o="",r=!1,a;function u($){tn({}),t(3,r=!1),t(2,o=$||""),l==null||l.show()}function f(){return l==null?void 0:l.hide()}async function d(){if(!r){t(3,r=!0),clearTimeout(a),a=setTimeout(()=>{f()},1500);try{await de.backups.create(o,{$cancelKey:s}),t(3,r=!1),f(),i("submit"),Ht("Successfully generated new backup.")}catch($){$.isAbort||de.error($)}clearTimeout(a),t(3,r=!1)}}jo(()=>{clearTimeout(a)});function p(){o=this.value,t(2,o)}const h=()=>r?(yo("A backup has already been started, please wait."),!1):!0,g=()=>(r&&yo("The backup was started but may take a while to complete. You can come back later.",4500),!0);function _($){ne[$?"unshift":"push"](()=>{l=$,t(1,l)})}function b($){me.call(this,n,$)}function k($){me.call(this,n,$)}return[f,l,o,r,s,d,u,p,h,g,_,b,k]}class RI extends be{constructor(e){super(),ge(this,e,NI,FI,_e,{show:6,hide:0})}get show(){return this.$$.ctx[6]}get hide(){return this.$$.ctx[0]}}function qI(n){let e,t,i,s,l,o,r,a;return{c(){e=y("label"),t=Y("Backup name"),s=D(),l=y("input"),m(e,"for",i=n[14]),m(l,"type","text"),m(l,"id",o=n[14]),l.required=!0},m(u,f){S(u,e,f),v(e,t),S(u,s,f),S(u,l,f),ae(l,n[2]),r||(a=J(l,"input",n[9]),r=!0)},p(u,f){f&16384&&i!==(i=u[14])&&m(e,"for",i),f&16384&&o!==(o=u[14])&&m(l,"id",o),f&4&&l.value!==u[2]&&ae(l,u[2])},d(u){u&&w(e),u&&w(s),u&&w(l),r=!1,a()}}}function jI(n){let e,t,i,s,l,o,r,a,u,f,d,p,h,g,_,b;return u=new Nl({props:{value:n[1]}}),h=new pe({props:{class:"form-field required m-0",name:"name",$$slots:{default:[qI,({uniqueId:k})=>({14:k}),({uniqueId:k})=>k?16384:0]},$$scope:{ctx:n}}}),{c(){e=y("div"),e.innerHTML=`<div class="icon"><i class="ri-alert-line"></i></div>
2023-05-14 03:10:14 +08:00
<div class="content"><p>Please proceed with caution.</p>
<p>The restore operation will replace your existing <code>pb_data</code> with the one from the backup
and will restart the application process!</p>
<p class="txt-bold">Backup restore is still experimental and currently works only on UNIX based systems.</p></div>`,t=D(),i=y("div"),s=Y(`Type the backup name
`),l=y("div"),o=y("span"),r=Y(n[1]),a=D(),B(u.$$.fragment),f=Y(`
2023-05-14 03:23:19 +08:00
to confirm:`),d=D(),p=y("form"),B(h.$$.fragment),m(e,"class","alert alert-danger"),m(o,"class","txt"),m(l,"class","label"),m(i,"class","content m-b-sm"),m(p,"id",n[6]),m(p,"autocomplete","off")},m(k,$){S(k,e,$),S(k,t,$),S(k,i,$),v(i,s),v(i,l),v(l,o),v(o,r),v(l,a),z(u,l,null),v(i,f),S(k,d,$),S(k,p,$),z(h,p,null),g=!0,_||(b=J(p,"submit",xe(n[7])),_=!0)},p(k,$){(!g||$&2)&&le(r,k[1]);const C={};$&2&&(C.value=k[1]),u.$set(C);const T={};$&49156&&(T.$$scope={dirty:$,ctx:k}),h.$set(T)},i(k){g||(I(u.$$.fragment,k),I(h.$$.fragment,k),g=!0)},o(k){P(u.$$.fragment,k),P(h.$$.fragment,k),g=!1},d(k){k&&w(e),k&&w(t),k&&w(i),H(u),k&&w(d),k&&w(p),H(h),_=!1,b()}}}function VI(n){let e,t,i,s;return{c(){e=y("h4"),t=Y("Restore "),i=y("strong"),s=Y(n[1]),m(e,"class","center txt-break")},m(l,o){S(l,e,o),v(e,t),v(e,i),v(i,s)},p(l,o){o&2&&le(s,l[1])},d(l){l&&w(e)}}}function zI(n){let e,t,i,s,l,o,r,a;return{c(){e=y("button"),t=Y("Cancel"),i=D(),s=y("button"),l=y("span"),l.textContent="Restore backup",m(e,"type","button"),m(e,"class","btn btn-transparent"),e.disabled=n[4],m(l,"class","txt"),m(s,"type","submit"),m(s,"form",n[6]),m(s,"class","btn btn-expanded"),s.disabled=o=!n[5]||n[4],ee(s,"btn-loading",n[4])},m(u,f){S(u,e,f),v(e,t),S(u,i,f),S(u,s,f),v(s,l),r||(a=J(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&&ee(s,"btn-loading",u[4])},d(u){u&&w(e),u&&w(i),u&&w(s),r=!1,a()}}}function HI(n){let e,t,i={class:"backup-restore-panel",overlayClose:!n[4],escClose:!n[4],beforeHide:n[10],popup:!0,$$slots:{footer:[zI],header:[VI],default:[jI]},$$scope:{ctx:n}};return e=new on({props:i}),n[11](e),e.$on("show",n[12]),e.$on("hide",n[13]),{c(){B(e.$$.fragment)},m(s,l){z(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&32822&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(I(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[11](null),H(e,s)}}}function BI(n,e,t){let i;const s="backup_restore_"+U.randomString(5);let l,o="",r="",a=!1;function u(k){tn({}),t(2,r=""),t(1,o=k),t(4,a=!1),l==null||l.show()}function f(){return l==null?void 0:l.hide()}async function d(){var k;if(!(!i||a)){t(4,a=!0);try{await de.backups.restore(o),setTimeout(()=>{window.location.reload()},1e3)}catch($){$!=null&&$.isAbort||(t(4,a=!1),As(((k=$.response)==null?void 0:k.message)||$.message))}}}function p(){r=this.value,t(2,r)}const h=()=>!a;function g(k){ne[k?"unshift":"push"](()=>{l=k,t(3,l)})}function _(k){me.call(this,n,k)}function b(k){me.call(this,n,k)}return n.$$.update=()=>{n.$$.dirty&6&&t(5,i=r!=""&&o==r)},[f,o,r,l,a,i,s,d,u,p,h,g,_,b]}class UI extends be{constructor(e){super(),ge(this,e,BI,HI,_e,{show:8,hide:0})}get show(){return this.$$.ctx[8]}get hide(){return this.$$.ctx[0]}}function j_(n,e,t){const i=n.slice();return i[22]=e[t],i}function V_(n,e,t){const i=n.slice();return i[19]=e[t],i}function WI(n){let e=[],t=new Map,i,s,l=n[3];const o=a=>a[22].key;for(let a=0;a<l.length;a+=1){let u=j_(n,l,a),f=o(u);t.set(f,e[a]=H_(f,u))}let r=null;return l.length||(r=z_()),{c(){for(let a=0;a<e.length;a+=1)e[a].c();i=Se(),r&&r.c()},m(a,u){for(let f=0;f<e.length;f+=1)e[f]&&e[f].m(a,u);S(a,i,u),r&&r.m(a,u),s=!0},p(a,u){u&876&&(l=a[3],ue(),e=yt(e,u,o,1,a,l,t,i.parentNode,Kt,H_,i,j_),fe(),!l.length&&r?r.p(a,u):l.length?r&&(r.d(1),r=null):(r=z_(),r.c(),r.m(i.parentNode,i)))},i(a){if(!s){for(let u=0;u<l.length;u+=1)I(e[u]);s=!0}},o(a){for(let u=0;u<e.length;u+=1)P(e[u]);s=!1},d(a){for(let u=0;u<e.length;u+=1)e[u].d(a);a&&w(i),r&&r.d(a)}}}function YI(n){let e,t=Array(n[3].length||1),i=[];for(let s=0;s<t.length;s+=1)i[s]=B_(V_(n,t,s));return{c(){for(let s=0;s<i.length;s+=1)i[s].c();e=Se()},m(s,l){for(let o=0;o<i.length;o+=1)i[o]&&i[o].m(s,l);S(s,e,l)},p(s,l){if(l&8){t=Array(s[3].length||1);let o;for(o=0;o<t.length;o+=1){const r=V_(s,t,o);i[o]?i[o].p(r,l):(i[o]=B_(),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){pt(i,s),s&&w(e)}}}function z_(n){let e;return{c(){e=y("div"),e.innerHTML=`<span class="txt">No backups yet.
`,m(e,"class","list-item list-item-placeholder svelte-1ulbkf5")},m(t,i){S(t,e,i)},p:te,d(t){t&&w(e)}}}function H_(n,e){let t,i,s,l,o,r=e[22].key+"",a,u,f,d,p=U.formattedFileSize(e[22].size)+"",h,g,_,b,k,$,C,T,O,M,E,A,L,N,q,R,F,V,j,W;function Q(){return e[10](e[22])}function X(){return e[11](e[22])}function Z(){return e[12](e[22])}return{key:n,first:null,c(){t=y("div"),i=y("i"),s=D(),l=y("div"),o=y("span"),a=Y(r),u=D(),f=y("span"),d=Y("("),h=Y(p),g=Y(")"),_=D(),b=y("div"),k=y("button"),$=y("i"),T=D(),O=y("button"),M=y("i"),A=D(),L=y("button"),N=y("i"),R=D(),m(i,"class","ri-folder-zip-line"),m(o,"class","name backup-name svelte-1ulbkf5"),m(f,"class","size txt-hint txt-nowrap"),m(l,"class","content"),m($,"class","ri-download-line"),m(k,"type","button"),m(k,"class","btn btn-sm btn-circle btn-hint btn-transparent"),k.disabled=C=e[6][e[22].key]||e[5][e[22].key],m(k,"aria-label","Download"),ee(k,"btn-loading",e[5][e[22].key]),m(M,"class","ri-restart-line"),m(O,"type","button"),m(O,"class","btn btn-sm btn-circle btn-hint btn-transparent"),O.disabled=E=e[6][e[22].key],m(O,"aria-label","Restore"),m(N,"class","ri-delete-bin-7-line"),m(L,"type","button"),m(L,"class","btn btn-sm btn-circle btn-hint btn-transparent"),L.disabled=q=e[6][e[22].key],m(L,"aria-label","Delete"),ee(L,"btn-loading",e[6][e[22].key]),m(b,"class","actions nonintrusive"),m(t,"class","list-item svelte-1ulbkf5"),this.first=t},m(re,x){S(re,t,x),v(t,i),v(t,s),v(t,l),v(l,o),v(o,a),v(l,u),v(l,f),v(f,d),v(f,h),v(f,g),v(t,_),v(t,b),v(b,k),v(k,$),v(b,T),v(b,O),v(O,M),v(b,A),v(b,L),v(L,N),v(t,R),V=!0,j||(W=[Oe(Be.call(null,k,"Download")),J(k,"click",xe(Q)),Oe(Be.call(null,O,"Restore")),J(O,"click",xe(X)),Oe(Be.call(null,L,"Delete")),J(L,"click",xe(Z))],j=!0)},p(re,x){e=re,(!V||x&8)&&r!==(r=e[22].key+"")&&le(a,r),(!V||x&8)&&p!==(p=U.formattedFileSize(e[22].size)+"")&&le(h,p),(!V||x&104&&C!==(C=e[6][e[22].key]||e[5][e[22].key]))&&(k.disabled=C),(!V||x&40)&&ee(k,"btn-loading",e[5][e[22].key]),(!V||x&72&&E!==(E=e[6][e[22].key]))&&(O.disabled=E),(!V||x&72&&q!==(q=e[6][e[22].key]))&&(L.disabled=q),(!V||x&72)&&ee(L,"btn-loading",e[6][e[22].key])},i(re){V||(re&&et(()=>{V&&(F||(F=Ve(t,rt,{duration:150},!0)),F.run(1))}),V=!0)},o(re){re&&(F||(F=Ve(t,rt,{duration:150},!1)),F.run(0)),V=!1},d(re){re&&w(t),re&&F&&F.end(),j=!1,De(W)}}}function B_(n){let e;return{c(){e=y("div"),e.innerHTML=`<span class="skeleton-loader"></span>
`,m(e,"class","list-item list-item-loader svelte-1ulbkf5")},m(t,i){S(t,e,i)},p:te,d(t){t&&w(e)}}}function KI(n){let e,t,i;return{c(){e=y("span"),t=D(),i=y("span"),i.textContent="Backup/restore operation is in process",m(e,"class","loader loader-sm"),m(i,"class","txt")},m(s,l){S(s,e,l),S(s,t,l),S(s,i,l)},d(s){s&&w(e),s&&w(t),s&&w(i)}}}function JI(n){let e,t,i;return{c(){e=y("i"),t=D(),i=y("span"),i.textContent="Initialize new backup",m(e,"class","ri-play-circle-line"),m(i,"class","txt")},m(s,l){S(s,e,l),S(s,t,l),S(s,i,l)},d(s){s&&w(e),s&&w(t),s&&w(i)}}}function ZI(n){let e,t,i,s,l,o,r,a,u,f,d,p,h,g,_;const b=[YI,WI],k=[];function $(A,L){return A[4]?0:1}i=$(n),s=k[i]=b[i](n);function C(A,L){return A[7]?JI:KI}let T=C(n),O=T(n),M={};f=new RI({props:M}),n[14](f),f.$on("submit",n[15]);let E={};return p=new UI({props:E}),n[16](p),{c(){e=y("div"),t=y("div"),s.c(),l=D(),o=y("div"),r=y("button"),O.c(),u=D(),B(f.$$.fragment),d=D(),B(p.$$.fragment),m(t,"class","list-content svelte-1ulbkf5"),m(r,"type","button"),m(r,"class","btn btn-block btn-transparent"),r.disabled=a=n[4]||!n[7],m(o,"class","list-item list-item-btn"),m(e,"class","list list-compact")},m(A,L){S(A,e,L),v(e,t),k[i].m(t,null),v(e,l),v(e,o),v(o,r),O.m(r,null),S(A,u,L),z(f,A,L),S(A,d,L),z(p,A,L),h=!0,g||(_=J(r,"click",n[13]),g=!0)},p(A,[L]){let N=i;i=$(A),i===N?k[i].p(A,L):(ue(),P(k[N],1,1,()=>{k[N]=null}),fe(),s=k[i],s?s.p(A,L):(s=k[i]=b[i](A),s.c()),I(s,1),s.m(t,null)),T!==(T=C(A))&&(O.d(1),O=T(A),O&&(O.c(),O.m(r,null))),(!h||L&144&&a!==(a=A[4]||!A[7]))&&(r.disabled=a);const q={};f.$set(q);const R={};p.$set(R)},i(A){h||(I(s),I(f.$$.fragment,A),I(p.$$.fragment,A),h=!0)},o(A){P(s),P(f.$$.fragment,A),P(p.$$.fragment,A),h=!1},d(A){A&&w(e),k[i].d(),O.d(),A&&w(u),n[14](null),H(f,A),A&&w(d),n[16](null),H(p,A),g=!1,_()}}}function GI(n,e,t){let i,s,l=[],o=!1,r={},a={},u=!0;f(),g();async function f(){t(4,o=!0);try{t(3,l=await de.backups.getFullList()),l.sort((M,E)=>M.modified<E.modified?1:M.modified>E.modified?-1:0),t(4,o=!1)}catch(M){M.isAbort||(de.error(M),t(4,o=!1))}}async function d(M){if(!r[M]){t(5,r[M]=!0,r);try{const E=await de.getAdminFileToken(),A=de.backups.getDownloadUrl(E,M);U.download(A)}catch(E){E.isAbort||de.error(E)}delete r[M],t(5,r)}}function p(M){mn(`Do you really want to delete ${M}?`,()=>h(M))}async function h(M){if(!a[M]){t(6,a[M]=!0,a);try{await de.backups.delete(M),U.removeByKey(l,"name",M),f(),Ht(`Successfully deleted ${M}.`)}catch(E){E.isAbort||de.error(E)}delete a[M],t(6,a)}}async function g(){var M;try{const E=await de.health.check({$autoCancel:!1}),A=u;t(7,u=((M=E==null?void 0:E.data)==null?void 0:M.canBackup)||!1),A!=u&&u&&f()}catch{}}Xt(()=>{let M=setInterval(()=>{g()},3e3);return()=>{clearInterval(M)}});const _=M=>d(M.key),b=M=>s.show(M.key),k=M=>p(M.key),$=()=>i==null?void 0:i.show();function C(M){ne[M?"unshift":"push"](()=>{i=M,t(1,i)})}const T=()=>{f()};function O(M){ne[M?"unshift":"push"](()=>{s=M,t(2,s)})}return[f,i,s,l,o,r,a,u,d,p,_,b,k,$,C,T,O]}class XI extends be{constructor(e){super(),ge(this,e,GI,ZI,_e,{loadBackups:0})}get loadBackups(){return this.$$.ctx[0]}}function QI(n){let e;return{c(){e=y("i"),m(e,"class","ri-arrow-down-s-line")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function xI(n){let e;return{c(){e=y("i"),m(e,"class","ri-arrow-up-s-line")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function U_(n){var j,W,Q;let e,t,i,s,l,o,r,a,u,f,d,p,h,g,_,b,k,$,C,T,O,M,E;t=new pe({props:{class:"form-field form-field-toggle m-t-base m-b-0",$$slots:{default:[e8,({uniqueId:X})=>({32:X}),({uniqueId:X})=>[0,X?2:0]]},$$scope:{ctx:n}}});let A=n[2]&&W_(n);function L(X){n[25](X)}function N(X){n[26](X)}function q(X){n[27](X)}let R={toggleLabel:"Store backups in S3 storage",testFilesystem:"backups",configKey:"backups.s3",originalConfig:(j=n[0].backups)==null?void 0:j.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 C1({props:R}),ne.push(()=>he(r,"config",L)),ne.push(()=>he(r,"isTesting",N)),ne.push(()=>he(r,"testError",q));let F=((Q=(W=n[1].backups)==null?void 0:W.s3)==null?vo
<span class="txt">S3 connected successfully</span>`,m(e,"class","label label-sm label-success entrance-right")},m(t,i){S(t,e,i)},p:te,d(t){t&&w(e)}}}function l8(n){let e,t,i,s;return{c(){e=y("div"),e.innerHTML=`<i class="ri-error-warning-line txt-warning"></i>
<span class="txt">Failed to establish S3 connection</span>`,m(e,"class","label label-sm label-warning entrance-right")},m(l,o){var r;S(l,e,o),i||(s=Oe(t=Be.call(null,e,(r=n[8].data)==null?void 0:r.message)),i=!0)},p(l,o){var r;t&&jt(t.update)&&o[0]&256&&t.update.call(null,(r=l[8].data)==null?void 0:r.message)},d(l){l&&w(e),i=!1,s()}}}function o8(n){let e;return{c(){e=y("span"),m(e,"class","loader loader-sm")},m(t,i){S(t,e,i)},p:te,d(t){t&&w(e)}}}function K_(n){let e,t,i,s,l;return{c(){e=y("button"),t=y("span"),t.textContent="Reset",m(t,"class","txt"),m(e,"type","submit"),m(e,"class","btn btn-hint btn-transparent"),e.disabled=i=!n[9]||n[5]},m(o,r){S(o,e,r),v(e,t),s||(l=J(e,"click",n[28]),s=!0)},p(o,r){r[0]&544&&i!==(i=!o[9]||o[5])&&(e.disabled=i)},d(o){o&&w(e),s=!1,l()}}}function r8(n){let e,t,i,s,l,o,r,a,u,f,d,p,h,g,_,b,k,$,C,T,O,M,E,A,L;h=new Zo({props:{class:"btn-sm",tooltip:"Reload backups list"}}),h.$on("refresh",n[15]);let N={};_=new XI({props:N}),n[16](_);function q(j,W){return j[6]?xI:QI}let R=q(n),F=R(n),V=n[6]&&!n[4]&&U_(n);return{c(){e=y("header"),t=y("nav"),i=y("div"),i.textContent="Settings",s=D(),l=y("div"),o=Y(n[10]),r=D(),a=y("div"),u=y("div"),f=y("div"),d=y("span"),d.textContent="Backup and restore your PocketBase data",p=D(),B(h.$$.fragment),g=D(),B(_.$$.fragment),b=D(),k=y("hr"),$=D(),C=y("button"),T=y("span"),T.textContent="Backups options",O=D(),F.c(),M=D(),V&&V.c(),m(i,"class","breadcrumb-item"),m(l,"class","breadcrumb-item"),m(t,"class","breadcrumbs"),m(e,"class","page-header"),m(d,"class","txt-xl"),m(f,"class","flex m-b-sm flex-gap-5"),m(T,"class","txt"),m(C,"type","button"),m(C,"class","btn btn-secondary"),C.disabled=n[4],ee(C,"btn-loading",n[4]),m(u,"class","panel"),m(u,"autocomplete","off"),m(a,"class","wrapper")},m(j,W){S(j,e,W),v(e,t),v(t,i),v(t,s),v(t,l),v(l,o),S(j,r,W),S(j,a,W),v(a,u),v(u,f),v(f,d),v(f,p),z(h,f,null),v(u,g),z(_,u,null),v(u,b),v(u,k),v(u,$),v(u,C),v(C,T),v(C,O),F.m(C,null),v(u,M),V&&V.m(u,null),E=!0,A||(L=[J(C,"click",n[17]),J(u,"submit",xe(n[11]))],A=!0)},p(j,W){(!E||W[0]&1024)&&le(o,j[10]);const Q={};_.$set(Q),R!==(R=q(j))&&(F.d(1),F=R(j),F&&(F.c(),F.m(C,null))),(!E||W[0]&16)&&(C.disabled=j[4]),(!E||W[0]&16)&&ee(C,"btn-loading",j[4]),j[6]&&!j[4]?V?(V.p(j,W),W[0]&80&&I(V,1)):(V=U_(j),V.c(),I(V,1),V.m(u,null)):V&&(ue(),P(V,1,1,()=>{V=null}),fe())},i(j){E||(I(h.$$.fragment,j),I(_.$$.fragment,j),I(V),E=!0)},o(j){P(h.$$.fragment,j),P(_.$$.fragment,j),P(V),E=!1},d(j){j&&w(e),j&&w(r),j&&w(a),H(h),n[16](null),H(_),F.d(),V&&V.d(),A=!1,De(L)}}}function a8(n){let e,t,i,s;return e=new Mi({}),i=new Sn({props:{$$slots:{default:[r8]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment)},m(l,o){z(e,l,o),S(l,t,o),z(i,l,o),s=!0},p(l,o){const r={};o[0]&2047|o[1]&4&&(r.$$scope={dirty:o,ctx:l}),i.$set(r)},i(l){s||(I(e.$$.fragment,l),I(i.$$.fragment,l),s=!0)},o(l){P(e.$$.fragment,l),P(i.$$.fragment,l),s=!1},d(l){H(e,l),l&&w(t),H(i,l)}}}function u8(n,e,t){let i,s;Ze(n,Mt,Z=>t(10,s=Z)),ln(Mt,s="Backups",s);let l,o={},r={},a=!1,u=!1,f="",d=!1,p=!1,h=!1,g=null;_();async function _(){t(4,a=!0);try{const Z=await de.settings.getAll()||{};k(Z)}catch(Z){de.error(Z)}t(4,a=!1)}async function b(){if(!(u||!i)){t(5,u=!0);try{const Z=await de.settings.update(U.filterRedactedProps(r));await C(),k(Z),Ht("Successfully saved application settings.")}catch(Z){de.error(Z)}t(5,u=!1)}}function k(Z={}){t(1,r={backups:(Z==null?void 0:Z.backups)||{}}),t(2,d=r.backups.cron!=""),t(0,o=JSON.parse(JSON.stringify(r)))}function $(){t(1,r=JSON.parse(JSON.stringify(o||{backups:{}}))),t(2,d=r.backups.cron!="")}async function C(){await(l==null?void 0:l.loadBackups())}const T=()=>C();function O(Z){ne[Z?"unshift":"push"](()=>{l=Z,t(3,l)})}const M=()=>t(6,p=!p);function E(){d=this.checked,t(2,d)}function A(){r.backups.cron=this.value,t(1,r),t(2,d)}const L=()=>{t(1,r.backups.cron="0 0 * * *",r)},N=()=>{t(1,r.backups.cron="0 0 * * 0",r)},q=()=>{t(1,r.backups.cron="0 0 * * 1,3",r)},R=()=>{t(1,r.backups.cron="0 0 1 * *",r)};function F(){r.backups.cronMaxKeep=mt(this.value),t(1,r),t(2,d)}func
2023-05-14 03:10:14 +08:00
<span class="txt">Manage admins</span>`,t=D(),i=y("hr"),s=D(),l=y("button"),l.innerHTML=`<i class="ri-logout-circle-line"></i>
2023-05-14 03:23:19 +08:00
<span class="txt">Logout</span>`,m(e,"href","/settings/admins"),m(e,"class","dropdown-item closable"),m(l,"type","button"),m(l,"class","dropdown-item closable")},m(a,u){S(a,e,u),S(a,t,u),S(a,i,u),S(a,s,u),S(a,l,u),o||(r=[Oe(rn.call(null,e)),J(l,"click",n[7])],o=!0)},p:te,d(a){a&&w(e),a&&w(t),a&&w(i),a&&w(s),a&&w(l),o=!1,De(r)}}}function X_(n){let e,t,i;return t=new pu({props:{scriptSrc:"./libs/tinymce/tinymce.min.js",conf:U.defaultEditorOptions()}}),t.$on("init",n[8]),{c(){e=y("div"),B(t.$$.fragment),m(e,"class","tinymce-preloader hidden")},m(s,l){S(s,e,l),z(t,e,null),i=!0},p:te,i(s){i||(I(t.$$.fragment,s),i=!0)},o(s){P(t.$$.fragment,s),i=!1},d(s){s&&w(e),H(t)}}}function C8(n){var b;let e,t,i,s,l,o,r,a,u,f,d,p,h;document.title=e=U.joinNonEmpty([n[4],n[3],"PocketBase"]," - ");let g=((b=n[0])==null?void 0:b.id)&&n[1]&&G_(n);o=new c0({props:{routes:c8}}),o.$on("routeLoading",n[5]),o.$on("conditionsFailed",n[6]),a=new v8({}),f=new $8({});let _=n[1]&&!n[2]&&X_(n);return{c(){t=D(),i=y("div"),g&&g.c(),s=D(),l=y("div"),B(o.$$.fragment),r=D(),B(a.$$.fragment),u=D(),B(f.$$.fragment),d=D(),_&&_.c(),p=Se(),m(l,"class","app-body"),m(i,"class","app-layout")},m(k,$){S(k,t,$),S(k,i,$),g&&g.m(i,null),v(i,s),v(i,l),z(o,l,null),v(l,r),z(a,l,null),S(k,u,$),z(f,k,$),S(k,d,$),_&&_.m(k,$),S(k,p,$),h=!0},p(k,[$]){var C;(!h||$&24)&&e!==(e=U.joinNonEmpty([k[4],k[3],"PocketBase"]," - "))&&(document.title=e),(C=k[0])!=null&&C.id&&k[1]?g?(g.p(k,$),$&3&&I(g,1)):(g=G_(k),g.c(),I(g,1),g.m(i,s)):g&&(ue(),P(g,1,1,()=>{g=null}),fe()),k[1]&&!k[2]?_?(_.p(k,$),$&6&&I(_,1)):(_=X_(k),_.c(),I(_,1),_.m(p.parentNode,p)):_&&(ue(),P(_,1,1,()=>{_=null}),fe())},i(k){h||(I(g),I(o.$$.fragment,k),I(a.$$.fragment,k),I(f.$$.fragment,k),I(_),h=!0)},o(k){P(g),P(o.$$.fragment,k),P(a.$$.fragment,k),P(f.$$.fragment,k),P(_),h=!1},d(k){k&&w(t),k&&w(i),g&&g.d(),H(o),H(a),k&&w(u),H(f,k),k&&w(d),_&&_.d(k),k&&w(p)}}}function M8(n,e,t){let i,s,l,o;Ze(n,Is,_=>t(10,i=_)),Ze(n,So,_=>t(3,s=_)),Ze(n,Ra,_=>t(0,l=_)),Ze(n,Mt,_=>t(4,o=_));let r,a=!1,u=!1;function f(_){var b,k,$,C;((b=_==null?void 0:_.detail)==null?void 0:b.location)!==r&&(t(1,a=!!(($=(k=_==null?void 0:_.detail)==null?void 0:k.userData)!=null&&$.showAppSidebar)),r=(C=_==null?void 0:_.detail)==null?void 0:C.location,ln(Mt,o="",o),tn({}),v1())}function d(){Vi("/")}async function p(){var _,b;if(l!=null&&l.id)try{const k=await de.settings.getAll({$cancelKey:"initialAppSettings"});ln(So,s=((_=k==null?void 0:k.meta)==null?void 0:_.appName)||"",s),ln(Is,i=!!((b=k==null?void 0:k.meta)!=null&&b.hideControls),i)}catch(k){k!=null&&k.isAbort||console.warn("Failed to load app settings.",k)}}function h(){de.logout()}const g=()=>{t(2,u=!0)};return n.$$.update=()=>{n.$$.dirty&1&&l!=null&&l.id&&p()},[l,a,u,s,o,f,d,h,g]}class E8 extends be{constructor(e){super(),ge(this,e,M8,C8,_e,{})}}new E8({target:document.getElementById("app")});export{De as A,Ht as B,U as C,Vi as D,Se as E,gb as F,mg as G,Xt as H,Ze as I,di as J,Tt as K,ne as L,g1 as M,yt as N,zo as O,us as P,Kt as Q,pt as R,be as S,kn as T,zr as U,P as a,D as b,B as c,H as d,y as e,m as f,S as g,v as h,ge as i,Oe as j,ue as k,rn as l,z as m,fe as n,w as o,de as p,pe as q,ee as r,_e as s,I as t,J as u,xe as v,Y as w,le as x,te as y,ae as z};