firstly 0.1.0-next.5 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +55 -0
- package/esm/auth/static/assets/Page-9Ytj29NS.js +1 -0
- package/esm/auth/static/assets/{Page-BcSzu3xq.js → Page-C1pM-UDt.js} +2 -2
- package/esm/auth/static/assets/Page-CPz6KCw_.js +1 -0
- package/esm/auth/static/assets/{index-RpcgeXPm.js → index-AoBb9Ds5.js} +2 -2
- package/esm/auth/static/index.html +1 -1
- package/package.json +1 -1
- package/esm/auth/static/assets/Page-5iUUg7GN.js +0 -1
- package/esm/auth/static/assets/Page-sEK21EQB.js +0 -1
- /package/esm/auth/static/assets/{Page-sEK21EQB.d.ts → Page-9Ytj29NS.d.ts} +0 -0
- /package/esm/auth/static/assets/{Page-BcSzu3xq.d.ts → Page-C1pM-UDt.d.ts} +0 -0
- /package/esm/auth/static/assets/{Page-5iUUg7GN.d.ts → Page-CPz6KCw_.d.ts} +0 -0
- /package/esm/auth/static/assets/{index-RpcgeXPm.d.ts → index-AoBb9Ds5.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,60 @@
|
|
|
1
1
|
# firstly
|
|
2
2
|
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#140](https://github.com/jycouet/firstly/pull/140)
|
|
8
|
+
[`94b2188`](https://github.com/jycouet/firstly/commit/94b2188c78772f94e7835ab933fcebbe2a37703c)
|
|
9
|
+
Thanks [@jycouet](https://github.com/jycouet)! - [BREAKING] - deprecate firstly module in favor of
|
|
10
|
+
remult module
|
|
11
|
+
|
|
12
|
+
```diff
|
|
13
|
+
remultApi({
|
|
14
|
+
-- modules: [], // firstly modules
|
|
15
|
+
++ modulesFF: [], // firstly modules (deprecated)
|
|
16
|
+
++ modules: [], // remult modules
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
Then, you can use `modules` level of `remult`
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
- [#153](https://github.com/jycouet/firstly/pull/153)
|
|
24
|
+
[`f8ca698`](https://github.com/jycouet/firstly/commit/f8ca698aa2b4ec7cfe77f6e63486c0bf9a124946)
|
|
25
|
+
Thanks [@jycouet](https://github.com/jycouet)! - all root import ... from `firstly` moved to
|
|
26
|
+
`firstly/internals` (we will gradually add them back when needed
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- [#117](https://github.com/jycouet/firstly/pull/117)
|
|
31
|
+
[`407ed4d`](https://github.com/jycouet/firstly/commit/407ed4db8f4b99f234932965b870d51f6a9c07ca)
|
|
32
|
+
Thanks [@jycouet](https://github.com/jycouet)! - need to pass `redirect` to handleAuth manually
|
|
33
|
+
|
|
34
|
+
- [#102](https://github.com/jycouet/firstly/pull/102)
|
|
35
|
+
[`f0effb9`](https://github.com/jycouet/firstly/commit/f0effb9e2dfa3f1c3070bc27c498d7f1e1ed877d)
|
|
36
|
+
Thanks [@jycouet](https://github.com/jycouet)! - Prepare JYC 016
|
|
37
|
+
|
|
38
|
+
- [`c4606c5`](https://github.com/jycouet/firstly/commit/c4606c5ad5c0c9d90c830d99d1d2a919dc3750ec)
|
|
39
|
+
Thanks [@jycouet](https://github.com/jycouet)! - role to roles
|
|
40
|
+
|
|
41
|
+
- [#108](https://github.com/jycouet/firstly/pull/108)
|
|
42
|
+
[`cf100f4`](https://github.com/jycouet/firstly/commit/cf100f40a8462eca51acff3ac5d8779da78816ec)
|
|
43
|
+
Thanks [@jycouet](https://github.com/jycouet)! - fix import paths
|
|
44
|
+
|
|
45
|
+
- [#117](https://github.com/jycouet/firstly/pull/117)
|
|
46
|
+
[`f30c737`](https://github.com/jycouet/firstly/commit/f30c73781d8f50da08fcdc25f1f7611133ea8b0c)
|
|
47
|
+
Thanks [@jycouet](https://github.com/jycouet)! - switch mail engine to sailkit
|
|
48
|
+
|
|
49
|
+
- [#117](https://github.com/jycouet/firstly/pull/117)
|
|
50
|
+
[`5e1d67e`](https://github.com/jycouet/firstly/commit/5e1d67eb8f75127c3d729945e20b22c40184ee20)
|
|
51
|
+
Thanks [@jycouet](https://github.com/jycouet)! - [BREAKING] - Auth Identifier got removed in favor
|
|
52
|
+
of name in User table.
|
|
53
|
+
|
|
54
|
+
- [#110](https://github.com/jycouet/firstly/pull/110)
|
|
55
|
+
[`0c66f11`](https://github.com/jycouet/firstly/commit/0c66f114dd95f65c0407abddbd647a66769142eb)
|
|
56
|
+
Thanks [@jycouet](https://github.com/jycouet)! - add github in default ui (if configured)
|
|
57
|
+
|
|
3
58
|
## 0.1.0-next.5
|
|
4
59
|
|
|
5
60
|
### Patch Changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aa as e,U as o}from"./index-AoBb9Ds5.js";function f(a){var t=e("Hello from admin");o(a,t)}export{f as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var jn=Object.defineProperty;var Kr=i=>{throw TypeError(i)};var Jn=(i,e,t)=>e in i?jn(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var f=(i,e,t)=>Jn(i,typeof e!="symbol"?e+"":e,t),Xr=(i,e,t)=>e.has(i)||Kr("Cannot "+t);var Re=(i,e,t)=>(Xr(i,e,"read from private field"),t?t.call(i):e.get(i)),Yr=(i,e,t)=>e.has(i)?Kr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),Zr=(i,e,t,r)=>(Xr(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t);import{t as Ce,a as Un,r as Vn,c as Wn,b as Hn,g as Lt,e as it,u as le,d as xi,f as Tr,h as Bi,i as ji,j as Gn,k as Qn,l as zn,m as V,A as Kn,L as Xn,n as Yn,o as Zn,p as Ji,q as es,s as ts,N as rs,v as is,w as ns,x as ss,y as as,z as os,B as ls,C as $r,D as us,E as Ui,F as rr,G as ze,H as fs,I as Ee,J as ei,K as ds,M as ti,O as Sr,P as Vi,Q as pt,R as St,S as Se,T as me,U as X,V as Ke,W as Wi,X as ut,Y as ae,Z as cs,_ as ri,$ as Z,a0 as Ie,a1 as ue,a2 as Q,a3 as Dt,a4 as G,a5 as ir,a6 as oe,a7 as hs,a8 as wt,a9 as ys,aa as vt}from"./index-
|
|
1
|
+
var jn=Object.defineProperty;var Kr=i=>{throw TypeError(i)};var Jn=(i,e,t)=>e in i?jn(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var f=(i,e,t)=>Jn(i,typeof e!="symbol"?e+"":e,t),Xr=(i,e,t)=>e.has(i)||Kr("Cannot "+t);var Re=(i,e,t)=>(Xr(i,e,"read from private field"),t?t.call(i):e.get(i)),Yr=(i,e,t)=>e.has(i)?Kr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),Zr=(i,e,t,r)=>(Xr(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t);import{t as Ce,a as Un,r as Vn,c as Wn,b as Hn,g as Lt,e as it,u as le,d as xi,f as Tr,h as Bi,i as ji,j as Gn,k as Qn,l as zn,m as V,A as Kn,L as Xn,n as Yn,o as Zn,p as Ji,q as es,s as ts,N as rs,v as is,w as ns,x as ss,y as as,z as os,B as ls,C as $r,D as us,E as Ui,F as rr,G as ze,H as fs,I as Ee,J as ei,K as ds,M as ti,O as Sr,P as Vi,Q as pt,R as St,S as Se,T as me,U as X,V as Ke,W as Wi,X as ut,Y as ae,Z as cs,_ as ri,$ as Z,a0 as Ie,a1 as ue,a2 as Q,a3 as Dt,a4 as G,a5 as ir,a6 as oe,a7 as hs,a8 as wt,a9 as ys,aa as vt}from"./index-AoBb9Ds5.js";function ps(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function ms(i,e,t=!1,r=!1,n=!1){var s=i,a="";Ce(()=>{var o=Un;if(a!==(a=e()??"")&&(o.nodes_start!==null&&(Vn(o.nodes_start,o.nodes_end),o.nodes_start=o.nodes_end=null),a!=="")){var l=a+"";t?l=`<svg>${l}</svg>`:r&&(l=`<math>${l}</math>`);var u=Wn(l);if((t||r)&&(u=Lt(u)),Hn(Lt(u),u.lastChild),t||r)for(;Lt(u);)s.before(Lt(u));else s.before(u)}})}function Hi(i,e,t,r,n){var o;var s=(o=e.$$slots)==null?void 0:o[t],a=!1;s===!0&&(s=e.children,a=!0),s===void 0||s(i,a?()=>r:r)}function nr(i,e,t){it(()=>{var r=le(()=>e(i,t==null?void 0:t())||{});if(r!=null&&r.destroy)return()=>r.destroy()})}function gs(i,e){var t=void 0,r;xi(()=>{t!==(t=e())&&(r&&(Tr(r),r=null),t&&(r=Bi(()=>{it(()=>t(i))})))})}function Gi(i){var e,t,r="";if(typeof i=="string"||typeof i=="number")r+=i;else if(typeof i=="object")if(Array.isArray(i)){var n=i.length;for(e=0;e<n;e++)i[e]&&(t=Gi(i[e]))&&(r&&(r+=" "),r+=t)}else for(t in i)i[t]&&(r&&(r+=" "),r+=t);return r}function ws(){for(var i,e,t=0,r="",n=arguments.length;t<n;t++)(i=arguments[t])&&(e=Gi(i))&&(r&&(r+=" "),r+=e);return r}function vs(i){return typeof i=="object"?ws(i):i??""}const ii=[...`
|
|
2
2
|
\r\f \v\uFEFF`];function bs(i,e,t){var r=i==null?"":""+i;if(e&&(r=r?r+" "+e:e),t){for(var n in t)if(t[n])r=r?r+" "+n:n;else if(r.length)for(var s=n.length,a=0;(a=r.indexOf(n,a))>=0;){var o=a+s;(a===0||ii.includes(r[a-1]))&&(o===r.length||ii.includes(r[o]))?r=(a===0?"":r.substring(0,a))+r.substring(o+1):a=o}}return r===""?null:r}function ni(i,e=!1){var t=e?" !important;":";",r="";for(var n in i){var s=i[n];s!=null&&s!==""&&(r+=" "+n+": "+s+t)}return r}function cr(i){return i[0]!=="-"||i[1]!=="-"?i.toLowerCase():i}function _s(i,e){if(e){var t="",r,n;if(Array.isArray(e)?(r=e[0],n=e[1]):r=e,i){i=String(i).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var s=!1,a=0,o=!1,l=[];r&&l.push(...Object.keys(r).map(cr)),n&&l.push(...Object.keys(n).map(cr));var u=0,d=-1;const b=i.length;for(var c=0;c<b;c++){var h=i[c];if(o?h==="/"&&i[c-1]==="*"&&(o=!1):s?s===h&&(s=!1):h==="/"&&i[c+1]==="*"?o=!0:h==='"'||h==="'"?s=h:h==="("?a++:h===")"&&a--,!o&&s===!1&&a===0){if(h===":"&&d===-1)d=c;else if(h===";"||c===b-1){if(d!==-1){var y=cr(i.substring(u,d).trim());if(!l.includes(y)){h!==";"&&c++;var p=i.substring(u,c).trim();t+=" "+p+";"}}u=c+1,d=-1}}}}return r&&(t+=ni(r)),n&&(t+=ni(n,!0)),t=t.trim(),t===""?null:t}return i==null?null:String(i)}function mt(i,e,t,r,n,s){var a=i.__className;if(a!==t||a===void 0){var o=bs(t,r,s);o==null?i.removeAttribute("class"):e?i.className=o:i.setAttribute("class",o),i.__className=t}else if(s&&n!==s)for(var l in s){var u=!!s[l];(n==null||u!==!!n[l])&&i.classList.toggle(l,u)}return s}function hr(i,e={},t,r){for(var n in t){var s=t[n];e[n]!==s&&(t[n]==null?i.style.removeProperty(n):i.style.setProperty(n,s,r))}}function Is(i,e,t,r){var n=i.__style;if(n!==e){var s=_s(e,r);s==null?i.removeAttribute("style"):i.style.cssText=s,i.__style=e}else r&&(Array.isArray(r)?(hr(i,t==null?void 0:t[0],r[0]),hr(i,t==null?void 0:t[1],r[1],"important")):hr(i,t,r));return r}function Fr(i,e,t){if(i.multiple){if(e==null)return;if(!ji(e))return ps();for(var r of i.options)r.selected=e.includes(si(r));return}for(r of i.options){var n=si(r);if(Gn(n,e)){r.selected=!0;return}}(!t||e!==void 0)&&(i.selectedIndex=-1)}function Os(i){var e=new MutationObserver(()=>{Fr(i,i.__value)});e.observe(i,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Qn(()=>{e.disconnect()})}function si(i){return"__value"in i?i.__value:i.value}const bt=Symbol("class"),_t=Symbol("style"),Qi=Symbol("is custom element"),zi=Symbol("is html");function ks(i,e){e?i.hasAttribute("selected")||i.setAttribute("selected",""):i.removeAttribute("selected")}function $e(i,e,t,r){var n=Ki(i);n[e]!==(n[e]=t)&&(e==="loading"&&(i[Xn]=t),t==null?i.removeAttribute(e):typeof t!="string"&&Xi(i).includes(e)?i[e]=t:i.setAttribute(e,t))}function Cs(i,e,t,r,n=!1){var s=Ki(i),a=s[Qi],o=!s[zi],l=e||{},u=i.tagName==="OPTION";for(var d in e)d in t||(t[d]=null);t.class?t.class=vs(t.class):t[bt]&&(t.class=null),t[_t]&&(t.style??(t.style=null));var c=Xi(i);for(const k in t){let M=t[k];if(u&&k==="value"&&M==null){i.value=i.__value="",l[k]=M;continue}if(k==="class"){var h=i.namespaceURI==="http://www.w3.org/1999/xhtml";mt(i,h,M,r,e==null?void 0:e[bt],t[bt]),l[k]=M,l[bt]=t[bt];continue}if(k==="style"){Is(i,M,e==null?void 0:e[_t],t[_t]),l[k]=M,l[_t]=t[_t];continue}var y=l[k];if(!(M===y&&!(M===void 0&&i.hasAttribute(k)))){l[k]=M;var p=k[0]+k[1];if(p!=="$$")if(p==="on"){const T={},g="$$"+k;let O=k.slice(2);var b=ns(O);if(Yn(O)&&(O=O.slice(0,-7),T.capture=!0),!b&&y){if(M!=null)continue;i.removeEventListener(O,l[g],T),l[g]=null}if(M!=null)if(b)i[`__${O}`]=M,Ji([O]);else{let F=function(N){l[k].call(this,N)};l[g]=Zn(O,i,F,T)}else b&&(i[`__${O}`]=void 0)}else if(k==="style")$e(i,k,M);else if(k==="autofocus")es(i,!!M);else if(!a&&(k==="__value"||k==="value"&&M!=null))i.value=i.__value=M;else if(k==="selected"&&u)ks(i,M);else{var w=k;o||(w=ts(w));var P=w==="defaultValue"||w==="defaultChecked";if(M==null&&!a&&!P)if(s[k]=null,w==="value"||w==="checked"){let T=i;const g=e===void 0;if(w==="value"){let O=T.defaultValue;T.removeAttribute(w),T.defaultValue=O,T.value=T.__value=g?O:null}else{let O=T.defaultChecked;T.removeAttribute(w),T.defaultChecked=O,T.checked=g?O:!1}}else i.removeAttribute(k);else P||c.includes(w)&&(a||typeof M!="string")?i[w]=M:typeof M!="function"&&$e(i,w,M)}}}return l}function As(i,e,t=[],r,n=!1,s=zn){const a=t.map(s);var o=void 0,l={},u=i.nodeName==="SELECT",d=!1;if(xi(()=>{var h=e(...a.map(V)),y=Cs(i,o,h,r,n);d&&u&&"value"in h&&Fr(i,h.value,!1);for(let b of Object.getOwnPropertySymbols(l))h[b]||Tr(l[b]);for(let b of Object.getOwnPropertySymbols(h)){var p=h[b];b.description===Kn&&(!o||p!==o[b])&&(l[b]&&Tr(l[b]),l[b]=Bi(()=>gs(i,()=>p))),y[b]=p}o=y}),u){var c=i;it(()=>{Fr(c,o.value),Os(c)})}d=!0}function Ki(i){return i.__attributes??(i.__attributes={[Qi]:i.nodeName.includes("-"),[zi]:i.namespaceURI===rs})}var ai=new Map;function Xi(i){var e=ai.get(i.nodeName);if(e)return e;ai.set(i.nodeName,e=[]);for(var t,r=i,n=Element.prototype;n!==r;){t=ss(r);for(var s in t)t[s].set&&e.push(s);r=is(r)}return e}function tt(i,e,t=e){var r=as();os(i,"input",n=>{var s=n?i.defaultValue:i.value;if(s=yr(i)?pr(s):s,t(s),r&&s!==(s=e())){var a=i.selectionStart,o=i.selectionEnd;i.value=s??"",o!==null&&(i.selectionStart=a,i.selectionEnd=Math.min(o,i.value.length))}}),le(e)==null&&i.value&&t(yr(i)?pr(i.value):i.value),ls(()=>{var n=e();yr(i)&&n===pr(i.value)||i.type==="date"&&!n&&!i.value||n!==i.value&&(i.value=n??"")})}function yr(i){var e=i.type;return e==="number"||e==="range"}function pr(i){return i===""?null:+i}function sr(i){return function(...e){var t=e[0];return t.preventDefault(),i==null?void 0:i.apply(this,e)}}function Es(i,e){var s;var t=(s=i.$$events)==null?void 0:s[e.type],r=ji(t)?t.slice():t==null?[]:[t];for(var n of r)n.call(this,e)}const Ts=i=>{const{subscribe:e,update:t}=$r(i);return{subscribe:e,set:(r={})=>{t(n=>Object.assign(n,r))}}},ar=Ts({mode:"window",basePath:null}),mr=(i=us(ar).mode)=>{let e="popstate";i==="window"&&(e="popstate"),i==="hash"&&(e="hashchange"),window.dispatchEvent(new Event(e))},oi={go:(i=0)=>{history.go(i),mr()},push:(i,e=null)=>{history.pushState(e,"",i),mr()},replace:(i,e=null)=>{history.replaceState(e,"",i),mr()}},Ss=i=>{const e=i.match(/^(\/[^?#]*)?/),t=i.match(/\?([^#]*)?/),r=i.match(/#(.*)?/);return{path:(e==null?void 0:e[1])||"/",query:t!=null&&t[1]?`?${t==null?void 0:t[1]}`:"",hash:r!=null&&r[1]?`#${r==null?void 0:r[1]}`:""}},li=()=>{const{pathname:i,search:e,hash:t}=document.location;return{path:i,query:e,hash:t}},ui=()=>{let i=document.location.hash.substring(1);return i[0]!=="/"&&(i="/"+i),Ss(i)},Fs=Ui(li(),i=>{const e=()=>i(li());return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)}),Ps=Ui(ui(),i=>{const e=()=>i(ui());return window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)}),qr=rr([ar,Fs,Ps],([i,e,t],r)=>{i.mode==="window"&&r(e),i.mode==="hash"&&r(t)}),Rs=rr(qr,i=>i.path);rr(qr,i=>i.query);rr(qr,i=>i.hash);const Ds=()=>{let i=0;return()=>i++},Bt=i=>i.split(/(?=\/)/),fi=(i,e)=>e===null?i:i.startsWith(e)?i.slice(e.length):i,Ms=(i,e,t,r,n)=>{const s=(u,d,c)=>{const h=Bt(d).filter(y=>y!=="/").length;return(c??0)+(u?1:h)},a=(u,d)=>{const c={invalidPath:`<Route path="${u==null?void 0:u.path}" /> has invalid path. Path must start with '/'`,fallbackOutsideRoot:"<Route fallback /> cannot be outside root <Route />",pathOutsideRoot:`<Route path="${u==null?void 0:u.path}" /> cannot be outside root <Route />`,fallbackInsideFallback:"<Route fallback /> cannot be inside <Route fallback>",pathInsideFallback:`<Route path="${u==null?void 0:u.path}" /> cannot be inside <Route fallback>`};if(u.path[0]!=="/")throw new Error(c.invalidPath);if(u.root&&u.fallback)throw new Error(c.fallbackOutsideRoot);if(u.root&&u.path!=="/")throw new Error(c.pathOutsideRoot);if(d!=null&&d.fallback&&u.fallback)throw new Error(c.fallbackInsideFallback);if(d!=null&&d.fallback&&!u.fallback)throw new Error(c.pathInsideFallback)},o=s(t,r,n==null?void 0:n.depth),l={id:i,root:e,fallback:t,path:r,depth:o};return a(l,n),l},Ns=()=>{const{subscribe:i,update:e}=$r([]);return{subscribe:i,update:t=>e(r=>[...r.filter(n=>t.id!==n.id),t]),remove:t=>e(r=>r.filter(n=>t.id!==n.id))}},Ls=(i,e,t)=>{const r=(u,d,c,h)=>{let y=Bt(u).filter(w=>w!=="/"),p=Bt(c).filter(w=>w!=="/"),b="";if(c==="/")return d||y.length===h;for(let w=h-p.length;w<h;w++)b=b+y[w];return c===b},n=(u,d,c)=>{var p,b,w,P;let h=Bt(u).filter(k=>k!=="/"),y=!1;for(let k=0;k<(c==null?void 0:c.length)&&!y;k++)(p=c[k])!=null&&p.fallback||(y=r(u,((b=c[k])==null?void 0:b.root)??!1,((w=c[k])==null?void 0:w.path)??"",((P=c[k])==null?void 0:P.depth)??0));return h.length>=d&&!y},{root:s,fallback:a,path:o,depth:l}=e;return a?n(i,l,t):r(i,s,o,l)},$s=Ds(),gr={},di={};function at(i,e){ze(e,!1);const[t,r]=Wi(),n=()=>ut(y,"$route",t),s=()=>ut(p,"$contextRoute",t),a=()=>ut(Rs,"$globalPath",t),o=()=>ut(ar,"$options",t),l=()=>ut(w,"$contextChildRoutes",t),u=$s(),d=!fs(gr);let c=Ee(e,"fallback",9,!1),h=Ee(e,"path",9,"/");const y=$r(),p=ei(gr),b=Ns(),w=ei(di);ds(()=>w==null?void 0:w.remove(n())),ti(gr,y),ti(di,b),Sr(()=>(ae(c()),ae(h()),s()),()=>{cs(y,Ms(u,d,c(),h(),s()))}),Sr(()=>n(),()=>{w==null||w.update(n())}),Vi(),pt(!0);var P=St(),k=Se(P);{var M=T=>{var g=St(),O=Se(g);Hi(O,e,"default",{}),X(T,g)};me(k,T=>{ae(fi),a(),o(),n(),l(),le(()=>Ls(fi(a(),o().basePath),n(),l()))&&T(M)})}X(i,P),Ke(),r()}const ci=i=>{var o;const e=(o=i.target)==null?void 0:o.closest("a[href]"),t=e==null?void 0:e.href;if(e===null||t===null)return!0;const r=["","true"].includes(e.getAttribute("data-handle-ignore")??"false"),n=(e.getAttribute("target")??"_self")!=="_self",s=i.metaKey||i.ctrlKey||i.altKey||i.shiftKey,a=new URL(t).origin!==document.location.origin;if(r||n||s||a)return!0;t===document.location.href?oi.replace(t):oi.push(t),i.preventDefault()},wr=i=>(i.addEventListener("click",ci),{destroy:()=>{i.removeEventListener("click",ci)}}),qs=(i,e,t)=>(i==="hash"?"#":"")+(e??"")+t;var xs=ue("<a><!></a>");function It(i,e){const t=ri(e,["children","$$slots","$$events","$$legacy"]),r=ri(t,["href"]);ze(e,!1);const[n,s]=Wi(),a=()=>ut(ar,"$options",n),o=Ie(void 0,!0);let l=Ee(e,"href",9);Sr(()=>(a(),ae(l())),()=>{Z(o,qs(a().mode,a().basePath,l()))}),Vi(),pt(!0);var u=xs();As(u,()=>({href:V(o),...r}));var d=Q(u);Hi(d,e,"default",{}),nr(u,c=>wr==null?void 0:wr(c)),it(()=>Dt("click",u,function(c){Es.call(this,e,c)})),X(i,u),Ke(),s()}class Ye{constructor(...e){f(this,"fields");f(this,"options",{});f(this,"target");f(this,"readonly",!0);f(this,"allowNull",!1);f(this,"dbReadOnly",!1);f(this,"isServerExpression",!1);f(this,"key","");f(this,"label","");f(this,"caption","");f(this,"inputType","");f(this,"dbName","");f(this,"valueType");this.fields=e}apiUpdateAllowed(e){throw new Error("Method not implemented.")}displayValue(e){throw new Error("Method not implemented.")}includedInApi(e){throw new Error("Method not implemented.")}toInput(e,t){throw new Error("Method not implemented.")}fromInput(e,t){throw new Error("Method not implemented.")}getDbName(){return Promise.resolve("")}getId(e){let t=n=>e[n.key];typeof e=="function"&&(t=e);let r="";return this.fields.forEach(n=>{r.length>0&&(r+=","),r+=n.valueConverter.toJson(t(n))}),r}get valueConverter(){throw new Error("cant get value converter of compound id")}isEqualTo(e){let t={},n=e.toString().split(",");return this.fields.forEach((s,a)=>{t[s.key]=s.valueConverter.fromJson(n[a])}),t}}function ie(i,e=!0){var r;if(i===void 0)throw new Error("entity is undefined");let t=i[Xe];if(!t&&e)throw new Error("item "+(((r=i.constructor)==null?void 0:r.name)||i)+" was not initialized using a context");return t}const Xe=Symbol.for("entityMember"),Yi=Symbol.for("entityInfo"),Zi=Symbol.for("entityInfo_key");function Oe(i,e=!0){if(i===void 0){if(e)throw new Error("Undefined is not an entity :)");return}let t=i[Yi];if(!t&&e)throw new Error(i.prototype.constructor.name+" is not a known entity, did you forget to set @Entity() or did you forget to add the '@' before the call to Entity?");return t}function Bs(i){return i[Zi]}function vr(i,e){return{[en]:{toType:i,type:e}}}const en=Symbol.for("relationInfo");function js(i){return i==null?void 0:i[en]}const Pr=Symbol.for("fieldRelationInfo");function ne(i){if(i)return i[Pr]}function Js(i,e,t){for(const r of i.fields.toArray()){const n=js(r.options);if(n&&!r[Pr]){const s=n.toType(),a=e.repo(s,t),o=r.options;r[Pr]={type:n.type,toEntity:s,options:o,toRepo:a,getFields:()=>{let l=o.field,u={fields:o.fields,compoundIdField:void 0};function d(y){return Error(`Error for relation: "${i.metadata.key}.${r.key}", `+y)}let c=()=>l||u.fields;if(n.type==="toMany"&&!c()){for(const y of a.fields.toArray())if(!c()){const p=ne(y),b=y.options;if(p&&p.toEntity===i.metadata.entityType){if(p.type==="reference")l=y.key;else if(p.type==="toOne"){if(b.field)l=b.field;else if(b.fields){let w={};for(const P in b.fields)if(Object.prototype.hasOwnProperty.call(b.fields,P)){const k=b.fields[P];w[k]=P}u.fields=w}}}}if(!c())throw d(`No matching field found on target "${a.metadata.key}". Please specify field/fields`)}function h(y,p){const b=p.fields.find(y);if(!b)throw d(`Field "${y}" was not found in "${p.key}".`);return b}n.type==="reference"&&(l=r.key),l&&(n.type==="toOne"||n.type==="reference"?a.metadata.idMetadata.field instanceof Ye?u.compoundIdField=l:u.fields={[a.metadata.idMetadata.field.key]:l}:i.metadata.idMetadata.field instanceof Ye?u.compoundIdField=l:u.fields={[l]:i.metadata.idMetadata.field.key});for(const y in u.fields)Object.prototype.hasOwnProperty.call(u.fields,y)&&(h(y,a.metadata),h(u.fields[y],i.metadata));return u}}}}}class L{constructor(e){f(this,"apply");this.apply=e}static throwErrorIfFilterIsEmpty(e,t){if(L.isFilterEmpty(e))throw{message:`${t}: requires a filter to protect against accidental delete/update of all rows`,httpStatusCode:400}}static isFilterEmpty(e){if(e.$and){for(const t of e.$and)if(!L.isFilterEmpty(t))return!1}if(e.$or){for(const t of e.$or)if(L.isFilterEmpty(t))return!0;return!1}return Object.keys(e).filter(t=>!["$or","$and"].includes(t)).length==0}static async getPreciseValues(e,t){const r=new zt;return await L.fromEntityFilter(e,t).__applyToConsumer(r),r.preciseValues}async getPreciseValues(){const e=new zt;return await this.__applyToConsumer(e),e.preciseValues}static createCustom(e,t=""){let r={key:t,rawFilterTranslator:e};return Object.assign(n=>{if(n==null&&(n={}),!r.key)throw"Usage of custom filter before a key was assigned to it";return{[Ze+r.key]:n}},{rawFilterInfo:r})}static entityFilterToJson(e,t){return L.fromEntityFilter(e,t).toJson()}static entityFilterFromJson(e,t){return jt(e,{get:r=>t[r]})}static fromEntityFilter(e,t){let r=[];for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){let s=t[n];if(n=="$or")r.push(new Ws(...s.map(a=>L.fromEntityFilter(e,a))));else if(n=="$not")r.push(new Hs(L.fromEntityFilter(e,s)));else if(n=="$and")r.push(new hi(...s.map(a=>L.fromEntityFilter(e,a))));else if(n.startsWith(Ze))r.push(new L(a=>{a.custom(n.substring(Ze.length),s)}));else if(n==tn)r.push(new L(a=>a.databaseCustom(s)));else{const a=e.fields[n],o=ne(a),l=a.options;let u=(o==null?void 0:o.type)==="toOne"?l.fields?new Vs(a,e.fields,l):new Us(e.fields[l.field]):new Ht(a),d=!1;if(s!==void 0&&s!=null){s.$id!==void 0&&(s=s.$id);for(const c in s)if(Object.prototype.hasOwnProperty.call(s,c)){const h=s[c];switch(c){case"$gte":case">=":r.push(u.isGreaterOrEqualTo(h)),d=!0;break;case"$gt":case">":r.push(u.isGreaterThan(h)),d=!0;break;case"$lte":case"<=":r.push(u.isLessOrEqualTo(h)),d=!0;break;case"$lt":case"<":r.push(u.isLessThan(h)),d=!0;break;case"$ne":case"$not":case"!=":case"$nin":d=!0,Array.isArray(h)?r.push(u.isNotIn(h)):r.push(u.isDifferentFrom(h));break;case"$in":d=!0,r.push(u.isIn(h));break;case"$contains":d=!0,r.push(u.contains(h));break;case"$startsWith":d=!0,r.push(u.startsWith(h));break;case"$endsWith":d=!0,r.push(u.endsWith(h));break;case"$notContains":d=!0,r.push(u.notContains(h));break}}Array.isArray(s)&&(d=!0,r.push(u.isIn(s)))}!d&&s!==void 0&&r.push(u.isEqualTo(s))}}return new hi(...r)}__applyToConsumer(e){this.apply(e)}static async resolve(e){return typeof e=="function"?await e():e}toJson(){let e=new Gt;return this.__applyToConsumer(e),e.result}static async translateCustomWhere(e,t,r){let n=new Qt(async(s,a)=>{let o=[];for(const l in t.entityType){const u=t.entityType[l];u&&u.rawFilterInfo&&u.rawFilterInfo.rawFilterTranslator&&u.rawFilterInfo.key==s&&o.push(await L.fromEntityFilter(t,await u.rawFilterInfo.rawFilterTranslator(a,r)))}return o});return e.__applyToConsumer(n),await n.resolve(),e=new L(s=>n.applyTo(s)),e}}class Ht{constructor(e){f(this,"metadata");this.metadata=e}processVal(e){if(Oe(this.metadata.valueType,!1)){if(e==null){if(e===null&&!this.metadata.allowNull){const r=ne(this.metadata);if((r==null?void 0:r.type)==="reference")return r.toRepo.metadata.idMetadata.field.options.valueType===Number?0:""}return null}return typeof e=="string"||typeof e=="number"?e:ie(e).getId()}return e}contains(e){return new L(t=>t.containsCaseInsensitive(this.metadata,e))}notContains(e){return new L(t=>t.notContainsCaseInsensitive(this.metadata,e))}startsWith(e){return new L(t=>t.startsWithCaseInsensitive(this.metadata,e))}endsWith(e){return new L(t=>t.endsWithCaseInsensitive(this.metadata,e))}isLessThan(e){return e=this.processVal(e),new L(t=>t.isLessThan(this.metadata,e))}isGreaterOrEqualTo(e){return e=this.processVal(e),new L(t=>t.isGreaterOrEqualTo(this.metadata,e))}isNotIn(e){return new L(t=>{for(const r of e)t.isDifferentFrom(this.metadata,this.processVal(r))})}isDifferentFrom(e){return e=this.processVal(e),e==null&&this.metadata.allowNull?new L(t=>t.isNotNull(this.metadata)):new L(t=>t.isDifferentFrom(this.metadata,e))}isLessOrEqualTo(e){return e=this.processVal(e),new L(t=>t.isLessOrEqualTo(this.metadata,e))}isGreaterThan(e){return e=this.processVal(e),new L(t=>t.isGreaterThan(this.metadata,e))}isEqualTo(e){return e=this.processVal(e),e==null&&this.metadata.allowNull?new L(t=>t.isNull(this.metadata)):new L(t=>t.isEqualTo(this.metadata,e))}isIn(e){return e=e.map(t=>this.processVal(t)),(e==null?void 0:e.length)==1&&e[0]!=null&&e[0]!==null?new L(t=>t.isEqualTo(this.metadata,e[0])):new L(t=>t.isIn(this.metadata,e))}}class Us extends Ht{processVal(e){return e?typeof e=="string"||typeof e=="number"?e:ie(e).getId():null}}class Vs{constructor(e,t,r){f(this,"metadata");f(this,"fields");f(this,"relationOptions");this.metadata=e,this.fields=t,this.relationOptions=r}processVal(e){throw new Error("Invalid for Many To One Relation Field")}contains(e){throw new Error("Invalid for Many To One Relation Field")}notContains(e){throw new Error("Invalid for Many To One Relation Field")}endsWith(e){throw new Error("Invalid for Many To One Relation Field")}startsWith(e){throw new Error("Invalid for Many To One Relation Field")}isLessThan(e){throw new Error("Invalid for Many To One Relation Field")}isGreaterOrEqualTo(e){throw new Error("Invalid for Many To One Relation Field")}isNotIn(e){return new L(t=>{e.forEach(r=>this.isDifferentFrom(r).__applyToConsumer(t))})}isDifferentFrom(e){return new L(t=>{const r=[];for(const n in this.relationOptions.fields)if(Object.prototype.hasOwnProperty.call(this.relationOptions.fields,n)){const s=this.relationOptions.fields[n];r.push(new L(a=>new Ht(this.fields.find(s)).isDifferentFrom(e[n]).__applyToConsumer(a)))}t.or(r)})}isLessOrEqualTo(e){throw new Error("Invalid for Many To One Relation Field")}isGreaterThan(e){throw new Error("Invalid for Many To One Relation Field")}isEqualTo(e){return new L(t=>{for(const r in this.relationOptions.fields)if(Object.prototype.hasOwnProperty.call(this.relationOptions.fields,r)){const n=this.relationOptions.fields[r];new Ht(this.fields.find(n)).isEqualTo(e[r]).__applyToConsumer(t)}})}isIn(e){return new L(t=>{t.or(e.map(r=>this.isEqualTo(r)))})}}class hi extends L{constructor(...t){super(r=>{for(const n of this.filters)n&&n.__applyToConsumer(r)});f(this,"filters");this.filters=t}add(t){this.filters.push(t)}}class Ws extends L{constructor(...t){super(r=>{let n=this.filters.filter(s=>s!==void 0);n.length>1?r.or(n):n.length==1&&n[0].__applyToConsumer(r)});f(this,"filters");this.filters=t}}class Hs extends L{constructor(t){super(r=>{r.not(t)});f(this,"filter");this.filter=t}}const Ze="$custom$",tn="$db$",Rr="$an array";class Gt{constructor(){f(this,"result",{});f(this,"hasUndefined",!1)}databaseCustom(e){throw new Error("database custom is not allowed with api calls.")}custom(e,t){Array.isArray(t)&&(t={[Rr]:t}),this.add(Ze+e,t)}add(e,t){t===void 0&&(this.hasUndefined=!0);let r=this.result;if(r[e]===void 0){r[e]=t;return}let n=r[e];n instanceof Array?n.push(t):n=[n,t],r[e]=n}or(e){this.add("OR",e.map(t=>{let r=new Gt;return t.__applyToConsumer(r),r.result}))}not(e){let t=new Gt;e.__applyToConsumer(t),this.add("NOT",t.result)}isNull(e){this.add(e.key+".null",!0)}isNotNull(e){this.add(e.key+".null",!1)}isIn(e,t){this.add(e.key+".in",t.map(r=>e.valueConverter.toJson(r)))}isEqualTo(e,t){this.add(e.key,e.valueConverter.toJson(t))}isDifferentFrom(e,t){this.add(e.key+".ne",e.valueConverter.toJson(t))}isGreaterOrEqualTo(e,t){this.add(e.key+".gte",e.valueConverter.toJson(t))}isGreaterThan(e,t){this.add(e.key+".gt",e.valueConverter.toJson(t))}isLessOrEqualTo(e,t){this.add(e.key+".lte",e.valueConverter.toJson(t))}isLessThan(e,t){this.add(e.key+".lt",e.valueConverter.toJson(t))}containsCaseInsensitive(e,t){this.add(e.key+".contains",t)}notContainsCaseInsensitive(e,t){this.add(e.key+".notContains",t)}startsWithCaseInsensitive(e,t){this.add(e.key+".startsWith",t)}endsWithCaseInsensitive(e,t){this.add(e.key+".endsWith",t)}}function jt(i,e){let t={};function r(o){t.$and||(t.$and=[]),t.$and.push(o)}function n(o,l){t[o]===void 0?t[o]=l:r({[o]:l})}[...i.fields].forEach(o=>{function l(d,c,h=!1,y=!1){let p=e.get(o.key+d);if(p!==void 0){let b=w=>{let P=w;if(h){let M;typeof w=="string"?M=JSON.parse(w):M=w,P=M.map(T=>y?T:o.valueConverter.fromJson(T))}else P=y?P:o.valueConverter.fromJson(P);let k=c(P);k!==void 0&&n(o.key,k)};if(!h&&p instanceof Array)p.forEach(w=>{b(w)});else{h&&typeof p=="string"&&(p=JSON.parse(p));const w=a(p);for(const P of w)b(P)}}}l("",d=>d),l(".gt",d=>({$gt:d})),l(".gte",d=>({$gte:d})),l(".lt",d=>({$lt:d})),l(".lte",d=>({$lte:d})),l(".ne",d=>({$ne:d})),l(".in",d=>d,!0);var u=e.get(o.key+".null");if(u)switch(u=u.toString().trim().toLowerCase(),u){case"y":case"true":case"yes":n(o.key,null);break;default:n(o.key,{$ne:null});break}l(".contains",d=>({$contains:d}),!1,!0),l(".notContains",d=>({$notContains:d}),!1,!0),l(".startsWith",d=>({$startsWith:d}),!1,!0),l(".endsWith",d=>({$endsWith:d}),!1,!0)});let s=e.get("OR");if(s){const l=a(s).map(u=>({$or:u.map(d=>jt(i,{get:c=>d[c]}))}));l.length==1?t.$or?t.$or.push(l[0].$or):t.$or=l[0].$or:r({$and:l})}if(s=e.get("NOT"),s){let o=a(s);const l=[];for(const u of o)if(Array.isArray(u))for(const d of u)l.push({$not:jt(i,{get:c=>d[c]})});else l.push({$not:jt(i,{get:d=>u[d]})});l.length==1?t.$not?t.$not.push(l[0].$not):t.$not=l[0].$not:r({$and:l})}for(const o in i.entityType){const l=i.entityType[o];if(l&&l.rawFilterInfo&&l.rawFilterInfo.rawFilterTranslator){let u=e.get(Ze+o);if(u!==void 0){const d=c=>{c[Rr]!=null&&(c=c[Rr]),n(Ze+o,c)};Array.isArray(u)?u.forEach(c=>d(c)):d(u)}}}return t;function a(o){if(!Array.isArray(o))return[o];const l=[],u=[];for(const d of o)Array.isArray(d)?u.push(d):l.push(d);return u.push(l),u}}class Qt{constructor(e){f(this,"translateCustom");f(this,"commands",[]);f(this,"promises",[]);this.translateCustom=e}applyTo(e){this.commands.forEach(t=>t(e))}or(e){let t;this.promises.push(Promise.all(e.map(async r=>{let n=new Qt(this.translateCustom);return r.__applyToConsumer(n),await n.resolve(),new L(s=>n.applyTo(s))})).then(r=>{t=r})),this.commands.push(r=>r.or(t))}not(e){let t;this.promises.push((async()=>{let r=new Qt(this.translateCustom);e.__applyToConsumer(r),await r.resolve(),t=new L(n=>r.applyTo(n))})()),this.commands.push(r=>r.not(t))}isEqualTo(e,t){this.commands.push(r=>r.isEqualTo(e,t))}isDifferentFrom(e,t){this.commands.push(r=>r.isDifferentFrom(e,t))}isNull(e){this.commands.push(t=>t.isNull(e))}isNotNull(e){this.commands.push(t=>t.isNotNull(e))}isGreaterOrEqualTo(e,t){this.commands.push(r=>r.isGreaterOrEqualTo(e,t))}isGreaterThan(e,t){this.commands.push(r=>r.isGreaterThan(e,t))}isLessOrEqualTo(e,t){this.commands.push(r=>r.isLessOrEqualTo(e,t))}isLessThan(e,t){this.commands.push(r=>r.isLessThan(e,t))}containsCaseInsensitive(e,t){this.commands.push(r=>r.containsCaseInsensitive(e,t))}notContainsCaseInsensitive(e,t){this.commands.push(r=>r.notContainsCaseInsensitive(e,t))}startsWithCaseInsensitive(e,t){this.commands.push(r=>r.startsWithCaseInsensitive(e,t))}endsWithCaseInsensitive(e,t){this.commands.push(r=>r.endsWithCaseInsensitive(e,t))}isIn(e,t){this.commands.push(r=>r.isIn(e,t))}custom(e,t){this.promises.push((async()=>{let r=await this.translateCustom(e,t);r&&(Array.isArray(r)?r.forEach(n=>n.__applyToConsumer(this)):r.__applyToConsumer(this))})())}databaseCustom(e){this.commands.push(t=>t.databaseCustom(e))}async resolve(){for(;this.promises.length>0;){let e=this.promises;this.promises=[],await Promise.all(e)}}}class zt{constructor(){f(this,"rawValues",{});f(this,"preciseValues",new Proxy(this.rawValues,{get:(e,t)=>{if(t in e){let r=e[t];if(r.bad)return;if(r.values.length>0){const n=ne(r.field);if(n){if(n.type==="reference")return r.values.map(s=>n.toRepo.metadata.idMetadata.getIdFilter(s));throw new Error("Only relations toOne without field are supported.")}return r.values}}}}))}ok(e,...t){let r=this.rawValues[e.key];r?r.values.push(...t.filter(n=>!r.values.includes(n))):this.rawValues[e.key]={field:e,bad:!1,values:[...t]}}notOk(e){let t=this.rawValues[e.key];t?t.bad=!0:this.rawValues[e.key]={field:e,bad:!0,values:[]}}not(e){}or(e){const t=e.map(r=>{let n=new zt;return r.__applyToConsumer(n),n});for(const r of t)for(const n in r.rawValues)if(Object.prototype.hasOwnProperty.call(r.rawValues,n)){const s=r.rawValues[n];s&&(s.bad?this.notOk(s.field):this.ok(s.field,...s.values))}for(const r in this.rawValues)if(Object.prototype.hasOwnProperty.call(this.rawValues,r))for(const n of t)n.rawValues[r]||this.notOk(this.rawValues[r].field)}isEqualTo(e,t){this.ok(e,t)}isDifferentFrom(e,t){this.notOk(e)}isNull(e){this.ok(e,null)}isNotNull(e){this.notOk(e)}isGreaterOrEqualTo(e,t){this.notOk(e)}isGreaterThan(e,t){this.notOk(e)}isLessOrEqualTo(e,t){this.notOk(e)}isLessThan(e,t){this.notOk(e)}containsCaseInsensitive(e,t){this.notOk(e)}notContainsCaseInsensitive(e,t){this.notOk(e)}startsWithCaseInsensitive(e,t){this.notOk(e)}endsWithCaseInsensitive(e,t){this.notOk(e)}isIn(e,t){this.ok(e,...t)}custom(e,t){}databaseCustom(e){}}var Gs={};const br=Symbol.for("remult-static1");let Jt={defaultRemultFactory:void 0,remultFactory:void 0,defaultRemult:void 0,asyncContext:void 0,columnsOfType:new Map,allEntities:[],classHelpers:new Map,actionInfo:{allActions:[],runningOnServer:!1,runActionWithoutBlockingUI:i=>i(),startBusyWithProgress:()=>({progress:i=>{},close:()=>{}})},fieldOptionsEnricher:void 0,labelTransformer:void 0,defaultDataProvider:()=>{}};typeof process<"u"&&Gs.IGNORE_GLOBAL_REMULT_IN_TESTS||typeof globalThis[br]>"u"?(globalThis[br]=Jt,Jt.remultFactory=()=>rn()):Jt=globalThis[br];const D=Jt;function rn(){return D.defaultRemult||(D.defaultRemult=D.defaultRemultFactory()),D.defaultRemult}function Qs(){D.remultFactory=()=>rn()}function et(i){const e=i;if(typeof e[Ft]=="function")return e[Ft]();throw Error("Error getting repository internal from "+i)}const Ft=Symbol.for("getInternal");class zs{constructor(){f(this,"iAmRemultProxy",!0);f(this,"repoCache",new Map);f(this,"repo",(...e)=>{let t=D,r=this.repoCache.get(e[0]);r||this.repoCache.set(e[0],r=new Map);let n=r.get(e[1]);return n||(n={get fields(){return D.remultFactory().repo(...e).metadata.fields},[Ft](){return t.remultFactory().repo(...e)[Ft]()},relations:s=>t.remultFactory().repo(...e).relations(s),validate:(s,...a)=>t.remultFactory().repo(...e).validate(s,...a),addEventListener:(...s)=>t.remultFactory().repo(...e).addEventListener(...s),count:(...s)=>t.remultFactory().repo(...e).count(...s),create:(...s)=>t.remultFactory().repo(...e).create(...s),delete:s=>t.remultFactory().repo(...e).delete(s),deleteMany:s=>t.remultFactory().repo(...e).deleteMany(s),updateMany:(...s)=>t.remultFactory().repo(...e).updateMany(...s),find:(...s)=>t.remultFactory().repo(...e).find(...s),groupBy:(...s)=>t.remultFactory().repo(...e).groupBy(...s),aggregate:(...s)=>t.remultFactory().repo(...e).aggregate(...s),findFirst:(...s)=>t.remultFactory().repo(...e).findFirst(...s),findOne:(...s)=>t.remultFactory().repo(...e).findOne(...s),findId:(s,a)=>t.remultFactory().repo(...e).findId(s,a),toJson:s=>t.remultFactory().repo(...e).toJson(s),fromJson:(s,a)=>t.remultFactory().repo(...e).fromJson(s,a),getEntityRef:(...s)=>t.remultFactory().repo(...e).getEntityRef(...s),insert:s=>t.remultFactory().repo(...e).insert(s),liveQuery:(...s)=>t.remultFactory().repo(...e).liveQuery(...s),get metadata(){return D.remultFactory().repo(...e).metadata},query:s=>t.remultFactory().repo(...e).query(s),save:s=>t.remultFactory().repo(...e).save(s),upsert:s=>t.remultFactory().repo(...e).upsert(s),update:(s,a)=>t.remultFactory().repo(...e).update(s,a)},r.set(e[1],n),n)})}get liveQuerySubscriber(){return D.remultFactory().liveQuerySubscriber}set liveQuerySubscriber(e){D.remultFactory().liveQuerySubscriber=e}get liveQueryStorage(){return D.remultFactory().liveQueryStorage}set liveQueryStorage(e){D.remultFactory().liveQueryStorage=e}get liveQueryPublisher(){return D.remultFactory().liveQueryPublisher}set liveQueryPublisher(e){D.remultFactory().liveQueryPublisher=e}subscribeAuth(e){return D.remultFactory().subscribeAuth(e)}initUser(){return D.remultFactory().initUser()}call(e,t,...r){return D.remultFactory().call(e,t,...r)}get context(){return D.remultFactory().context}get dataProvider(){return D.remultFactory().dataProvider}set dataProvider(e){D.remultFactory().dataProvider=e}get repCache(){return D.remultFactory().repCache}authenticated(){return D.remultFactory().authenticated()}isAllowed(e){return D.remultFactory().isAllowed(e)}isAllowedForInstance(e,t){return D.remultFactory().isAllowedForInstance(e,t)}clearAllCache(){return D.remultFactory().clearAllCache()}useFetch(e){return D.remultFactory().useFetch(e)}get user(){return D.remultFactory().user}set user(e){D.remultFactory().user=e}get apiClient(){return D.remultFactory().apiClient}set apiClient(e){D.remultFactory().apiClient=e}get subscriptionServer(){return D.remultFactory().subscriptionServer}set subscriptionServer(e){D.remultFactory().subscriptionServer=e}}const be=new zs,Ks="$count",Xs=Symbol.for("GroupByForApiKey"),Ys=["sum","avg","min","max","distinctCount"],nn={error500RetryCount:4};function sn(i){return i.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,e=>e.toUpperCase()).replace("Email","eMail")}class Zs{constructor(e,t,r){f(this,"repository");f(this,"isReferenceRelation");f(this,"allowNull");f(this,"storedItem");f(this,"id");this.repository=e,this.isReferenceRelation=t,this.allowNull=r}toJson(){if(this.storedItem)return this.item===null?null:this.repository.toJson(this.item)}setId(e){this.repository.metadata.idMetadata.field.valueType==Number&&(e=+e),this.id=e}waitLoadOf(e){return e==null?null:et(this.repository)._getCachedByIdAsync(e,!1)}get(e){if(e==null)return null;const t=et(this.repository)._getCachedById(e,this.isReferenceRelation);return this.isReferenceRelation&&!this.storedItem?!this.allowNull&&(this.id===0||this.id==="")?null:void 0:t}set(e){if(e===null&&!this.allowNull&&this.isReferenceRelation&&(this.id==0||this.id=="")){this.storedItem={item:null};return}if(this.storedItem=void 0,e)if(typeof e=="string"||typeof e=="number")this.id=e;else{let t=ie(e,!1);t&&!this.isReferenceRelation?(et(this.repository)._addToCache(e),this.id=t.getId()):(this.storedItem={item:e},this.id=e[this.repository.metadata.idMetadata.field.key])}else e===null?this.id=null:this.id=void 0}get item(){return this.storedItem?this.storedItem.item:this.get(this.id)}async waitLoad(){return this.waitLoadOf(this.id)}}class Ae{constructor(...e){f(this,"Segments");this.Segments=e}toEntityOrderBy(){let e={};for(const t of this.Segments)t.isDescending?e[t.field.key]="desc":e[t.field.key]="asc";return e}reverse(){let e=new Ae;for(const t of this.Segments)e.Segments.push({field:t.field,isDescending:!t.isDescending});return e}compare(e,t,r){r||(r=n=>n.key);for(let n=0;n<this.Segments.length;n++){let s=this.Segments[n],a=e[r(s.field)],o=t[r(s.field)],l=s.isDescending,u=ea(a,o,l);if(u!=0)return u}return 0}static translateOrderByToSort(e,t){let r=new Ae;if(t){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const s=t[n];let a=e.fields.find(n);const o=l=>{switch(s){case"desc":r.Segments.push({field:l,isDescending:!0});break;case"asc":r.Segments.push({field:l})}};if(a){const l=ne(a);if((l==null?void 0:l.type)==="toOne"){const u=l.options;if(typeof u.field=="string")o(e.fields.find(u.field));else if(u.fields){for(const d in u.fields)if(Object.prototype.hasOwnProperty.call(u.fields,d)){const c=u.fields[d];o(e.fields.find(c.toString()))}}}else o(a)}}}return r}static createUniqueSort(e,t){(!t||Object.keys(t).length===0)&&e.options.defaultOrderBy&&(t=Ae.translateOrderByToSort(e,e.options.defaultOrderBy)),t||(t=new Ae);for(const r of e.idMetadata.fields)t.Segments.find(n=>n.field==r)||t.Segments.push({field:r});return t}static createUniqueEntityOrderBy(e,t){(!t||Object.keys(t).length===0)&&(t=e.options.defaultOrderBy),t?t={...t}:t={};for(const r of e.idMetadata.fields)t[r.key]||(t[r.key]="asc");return t}}function ea(i,e,t){i=yi(i),e=yi(e);let r=0;return i>e?r=1:i<e&&(r=-1),t&&(r*=-1),r}function yi(i){return i==null||i==null?i:i.id!==void 0?i.id:i}class an extends Error{constructor(t){super(t.message);f(this,"modelState");f(this,"stack");f(this,"exception");f(this,"httpStatusCode");Object.assign(this,t)}}class ta{constructor(e){f(this,"dataProvider");f(this,"isProxy");this.dataProvider=e}getEntityDataProvider(e){return new ra(this.dataProvider.then(t=>t.getEntityDataProvider(e)))}transaction(e){return this.dataProvider.then(t=>t.transaction(e))}ensureSchema(e){return this.dataProvider.then(t=>{var r;return(r=t.ensureSchema)==null?void 0:r.call(t,e)})}}class ra{constructor(e){f(this,"dataProvider");this.dataProvider=e}delete(e){return this.dataProvider.then(t=>t.delete(e))}insert(e){return this.dataProvider.then(t=>t.insert(e))}count(e){return this.dataProvider.then(t=>t.count(e))}find(e){return this.dataProvider.then(t=>t.find(e))}groupBy(e){return this.dataProvider.then(t=>t.groupBy(e))}update(e,t){return this.dataProvider.then(r=>r.update(e,t))}}class pi{constructor(e){f(this,"url");this.url=e}add(e,t){this.url.indexOf("?")>=0?this.url+="&":this.url+="?",this.url+=encodeURIComponent(e)+"="+encodeURIComponent(t)}addObject(e,t=""){if(e!=null)for(var r in e){let n=e[r];this.add(r+t,n)}}}async function Kt(i){var t,r,n,s;let e=0;for(;;)try{return await i()}catch(a){if(((t=a.message)!=null&&t.startsWith("Error occurred while trying to proxy")||(r=a.message)!=null&&r.startsWith("Error occured while trying to proxy")||(n=a.message)!=null&&n.includes("http proxy error")||(s=a.message)!=null&&s.startsWith("Gateway Timeout")||a.status==500)&&e++<nn.error500RetryCount){await new Promise((o,l)=>{setTimeout(()=>{o({})},500)});continue}throw a}}class mi{constructor(e){f(this,"fetch");this.fetch=e}async get(e){return await Kt(async()=>this.myFetch(e).then(t=>t))}put(e,t){return this.myFetch(e,{method:"put",body:JSON.stringify(t)})}delete(e){return this.myFetch(e,{method:"delete"})}async post(e,t){return await Kt(()=>this.myFetch(e,{method:"post",body:JSON.stringify(t)}))}myFetch(e,t){const r={};if(t!=null&&t.body&&(r["Content-type"]="application/json"),typeof window<"u"&&typeof window.document<"u"&&typeof(window.document.cookie!=="undefined"))for(const n of window.document.cookie.split(";"))n.trim().startsWith("XSRF-TOKEN=")&&(r["X-XSRF-TOKEN"]=n.split("=")[1]);return(this.fetch||fetch)(e,{credentials:"include",method:t==null?void 0:t.method,body:t==null?void 0:t.body,headers:r}).then(n=>ia(n)).catch(async n=>{throw await n})}}function ia(i){if(i.status!=204){if(i.status>=200&&i.status<300)return i.json();throw i.json().then(e=>({...e,message:e.message||i.statusText,url:i.url,status:i.status})).catch(()=>{throw{message:i.statusText,url:i.url,status:i.status}})}}function ht(i){if(!i)return new mi;let e;return e||on(i)&&(e=new na(i)),e||typeof i=="function"&&(e=new mi(i)),e}function on(i){let e=i;return!!(e&&e.get&&e.put&&e.post&&e.delete)}class na{constructor(e){f(this,"http");this.http=e}async post(e,t){return await Kt(()=>$t(this.http.post(e,t)))}delete(e){return $t(this.http.delete(e))}put(e,t){return $t(this.http.put(e,t))}async get(e){return await Kt(()=>$t(this.http.get(e)))}}function $t(i){let e;return i.toPromise!==void 0?e=i.toPromise():e=i,e.then(t=>t&&(t.status==200||t.status==201)&&t.headers&&t.request&&t.data!==void 0?t.data:t).catch(async t=>{throw await sa(t)})}async function sa(i){var s,a,o;let e=await i;var t;e.error?t=e.error:e.isAxiosError&&(typeof((s=e.response)==null?void 0:s.data)=="string"?t=e.response.data:t=(a=e==null?void 0:e.response)==null?void 0:a.data),t||(t=e.message),e.status==0&&e.error.isTrusted&&(t="Network Error"),typeof t=="string"&&(t={message:t}),e.modelState&&(t.modelState=e.modelState);let r=e.status;r===void 0&&(r=(o=e.response)==null?void 0:o.status),r!=null&&(t.httpStatusCode=r);var n=Object.assign(t??{},{});return n}class Dr{constructor(e,t){f(this,"apiProvider");f(this,"entityRequested");f(this,"isProxy",!0);this.apiProvider=e,this.entityRequested=t}getEntityDataProvider(e){var t;return(t=this.entityRequested)==null||t.call(this,e),new aa(()=>{var r;return ln((r=this.apiProvider())==null?void 0:r.url,e.key)},()=>ht(this.apiProvider().httpClient),e)}async transaction(e){throw new Error("Method not implemented.")}}function ln(i,e){return i==null&&(i="/api"),i+"/"+e}function xr(i,e){if(i.include){let t={};for(const r in i.include)if(Object.prototype.hasOwnProperty.call(i.include,r)){let n=i.include[r];if(typeof n=="object"){const s=ne(e.fields.find(r));s&&(n=xr(n,s.toRepo.metadata))}t[r]=n}i={...i,include:t}}return i.where&&(i={...i,where:L.entityFilterToJson(e,i.where)}),i.load&&(i={...i,load:i.load(e.fields).map(t=>t.key)}),i}class aa{constructor(e,t,r){f(this,"url");f(this,"http");f(this,"entity");this.url=e,this.http=t,this.entity=r}query(e,t){return this.buildFindRequest(e).run("query",{aggregate:this.buildAggregateOptions(t)}).then(({items:n,aggregates:s})=>({items:n.map(a=>this.translateFromJson(a)),aggregates:s}))}async groupBy(e){const{run:t}=this.buildFindRequest({where:e==null?void 0:e.where,limit:e==null?void 0:e.limit,page:e==null?void 0:e.page}),r=this.buildAggregateOptions(e),n=await t("groupBy",Object.keys(r).length>0?r:void 0);return e!=null&&e.group&&n.forEach(s=>{for(const a of e.group)s[a.key]=a.valueConverter.fromJson(s[a.key])}),n}buildAggregateOptions(e){var t,r,n,s,a,o,l;return{groupBy:(t=e==null?void 0:e.group)==null?void 0:t.map(u=>u.key),sum:(r=e==null?void 0:e.sum)==null?void 0:r.map(u=>u.key),avg:(n=e==null?void 0:e.avg)==null?void 0:n.map(u=>u.key),min:(s=e==null?void 0:e.min)==null?void 0:s.map(u=>u.key),max:(a=e==null?void 0:e.max)==null?void 0:a.map(u=>u.key),distinctCount:(o=e==null?void 0:e.distinctCount)==null?void 0:o.map(u=>u.key),orderBy:(l=e==null?void 0:e.orderBy)==null?void 0:l.map(u=>{var d;return{...u,field:(d=u.field)==null?void 0:d.key}})}}translateFromJson(e){let t={};for(const r of this.entity.fields)t[r.key]=r.valueConverter.fromJson(e[r.key]);return t}translateToJson(e){let t={};for(const r of this.entity.fields)t[r.key]=r.valueConverter.toJson(e[r.key]);return t}async count(e){const{run:t}=this.buildFindRequest({where:e});return t("count").then(r=>+r.count)}async deleteMany(e){const{run:t}=this.buildFindRequest({where:e},"delete");return t("deleteMany").then(r=>+r.deleted)}async updateMany(e,t){const{run:r}=this.buildFindRequest({where:e},"put");return r("updateMany",this.toJsonOfIncludedKeys(t)).then(n=>+n.updated)}async upsertMany(e){const{run:t}=this.buildFindRequest(void 0);return t("upsertMany",e.map(r=>({where:this.toJsonOfIncludedKeys(r.where),set:r.set!==void 0?this.toJsonOfIncludedKeys(r.set):void 0}))).then(r=>r.map(n=>this.translateFromJson(n)))}find(e){let{run:t}=this.buildFindRequest(e);return t().then(r=>r.map(n=>this.translateFromJson(n)))}buildFindRequest(e,t){t||(t="get");let r=new pi(this.url()),n;if(e){if(e.where&&(n=e.where.toJson(),oa(n,r)&&(n=void 0)),e.orderBy&&e.orderBy.Segments){let a="",o="",l=!1;e.orderBy.Segments.forEach(u=>{a.length>0&&(a+=",",o+=","),a+=u.field.key,o+=u.isDescending?"desc":"asc",u.isDescending&&(l=!0)}),a&&r.add("_sort",a),l&&r.add("_order",o)}e.limit&&r.add("_limit",e.limit),e.page&&r.add("_page",e.page)}const s=(a,o)=>{let l=new pi(r.url);if(!a&&n&&(a="get"),a&&l.add("__action",a),n){if(t==="put")return this.http().post(l.url,{set:o,where:n});o={...o,where:n}}return o&&t!="put"?this.http().post(l.url,o):this.http()[t](l.url,o)};return{createKey:()=>JSON.stringify({url:r,filterObject:n}),run:s,subscribe:async a=>({result:await s(la+a),unsubscribe:async()=>D.actionInfo.runActionWithoutBlockingUI(()=>this.http().post(this.url()+"?__action=endLiveQuery",{id:a}))})}}update(e,t){return this.http().put(this.url()+(e!=""?"/"+encodeURIComponent(e):"?__action=emptyId"),this.toJsonOfIncludedKeys(t)).then(r=>this.translateFromJson(r))}toJsonOfIncludedKeys(e){let t={},r=Object.keys(e);for(const n of this.entity.fields)r.includes(n.key)&&(t[n.key]=n.valueConverter.toJson(e[n.key]));return t}async delete(e){if(e=="")await this.deleteMany(L.fromEntityFilter(this.entity,this.entity.idMetadata.getIdFilter(e)));else return this.http().delete(this.url()+"/"+encodeURIComponent(e))}insert(e){return this.http().post(this.url(),this.translateToJson(e)).then(t=>this.translateFromJson(t))}insertMany(e){return this.http().post(this.url(),e.map(t=>this.translateToJson(t))).then(t=>t.map(r=>this.translateFromJson(r)))}}function oa(i,e){for(const t in i)if(Object.prototype.hasOwnProperty.call(i,t)){const r=i[t];if(Array.isArray(r)&&(r.length>0&&typeof r[0]=="object"||r.length>10)||t==="NOT")return!1}for(const t in i)if(Object.prototype.hasOwnProperty.call(i,t)){const r=i[t];Array.isArray(r)?t.endsWith(".in")?e.add(t,JSON.stringify(r)):r.forEach(n=>e.add(t,n)):t.startsWith(Ze)?e.add(t,JSON.stringify(r)):e.add(t,r)}return!0}const la="liveQuery-";var qt,ua=new Uint8Array(16);function fa(){if(!qt&&(qt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!qt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return qt(ua)}const da=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function ca(i){return typeof i=="string"&&da.test(i)}var ye=[];for(var _r=0;_r<256;++_r)ye.push((_r+256).toString(16).substr(1));function ha(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,t=(ye[i[e+0]]+ye[i[e+1]]+ye[i[e+2]]+ye[i[e+3]]+"-"+ye[i[e+4]]+ye[i[e+5]]+"-"+ye[i[e+6]]+ye[i[e+7]]+"-"+ye[i[e+8]]+ye[i[e+9]]+"-"+ye[i[e+10]]+ye[i[e+11]]+ye[i[e+12]]+ye[i[e+13]]+ye[i[e+14]]+ye[i[e+15]]).toLowerCase();if(!ca(t))throw TypeError("Stringified UUID is invalid");return t}function Mr(i,e,t){i=i||{};var r=i.random||(i.rng||fa)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,ha(r)}const Ir="stream";class ya{constructor(e,t,r){f(this,"repo");f(this,"query");f(this,"queryChannel");f(this,"subscribeCode");f(this,"unsubscribe",()=>{});f(this,"defaultQueryState",[]);f(this,"listeners",[]);f(this,"id",Mr());this.repo=e,this.query=t,this.queryChannel=`users:${r}:queries:${this.id}`,this.id=this.queryChannel}sendDefaultState(e){e(this.createReducerType(()=>[...this.defaultQueryState],this.allItemsMessage(this.defaultQueryState)))}async setAllItems(e){const t=await et(this.repo)._fromJsonArray(e,this.query.options);this.forListeners(r=>{r(()=>t)},this.allItemsMessage(t))}allItemsMessage(e){return[{type:"all",data:e}]}forListeners(e,t){e(r=>{if(this.defaultQueryState=r(this.defaultQueryState),t.find(n=>n.type==="add"||n.type==="replace")&&this.query.options.orderBy){const n=Ae.translateOrderByToSort(this.repo.metadata,this.query.options.orderBy);this.defaultQueryState.sort((s,a)=>n.compare(s,a))}});for(const r of this.listeners)e(n=>{r.next(this.createReducerType(n,t))})}createReducerType(e,t){return{applyChanges:e,changes:t,items:this.defaultQueryState}}async handle(e){{let t=e.filter(({type:n})=>n=="add"||n=="replace"),r=await et(this.repo)._fromJsonArray(t.map(n=>n.data.item),this.query.options);for(let n=0;n<t.length;n++){const s=t[n];s.data.item=r[n]}}this.forListeners(t=>{t(r=>{r||(r=[]);for(const n of e)switch(n.type){case"all":this.setAllItems(n.data);break;case"replace":{r=r.map(s=>this.repo.metadata.idMetadata.getId(s)===n.data.oldId?n.data.item:s);break}case"add":r=r.filter(s=>this.repo.metadata.idMetadata.getId(s)!==this.repo.metadata.idMetadata.getId(n.data.item)),r.push(n.data.item);break;case"remove":r=r.filter(s=>this.repo.metadata.idMetadata.getId(s)!==n.data.id);break}return r})},e)}}const pa="_liveQueryKeepAlive";class ma{constructor(e,t){f(this,"apiProvider");f(this,"getUserId");f(this,"queries",new Map);f(this,"channels",new Map);f(this,"client");f(this,"interval");this.apiProvider=e,this.getUserId=t}wrapMessageHandling(e){var t=this.apiProvider().wrapMessageHandling;t?t(e):e()}hasQueriesForTesting(){return this.queries.size>0}runPromise(e){return e}close(){this.queries.clear(),this.channels.clear(),this.closeIfNoListeners()}async subscribeChannel(e,t){let r=()=>{};const n=await this.openIfNoOpened();try{let s=this.channels.get(e);if(!s){this.channels.set(e,s=new ga);try{s.unsubscribe=await n.subscribe(e,a=>this.wrapMessageHandling(()=>s.handle(a)),a=>{t.error(a)})}catch(a){throw t.error(a),a}}s.listeners.push(t),r=()=>{s.listeners.splice(s.listeners.indexOf(t),1),s.listeners.length==0&&(this.channels.delete(e),s.unsubscribe()),this.closeIfNoListeners()}}catch(s){throw t.error(s),s}return()=>{r(),r=()=>{}}}closeIfNoListeners(){this.client&&this.queries.size===0&&this.channels.size===0&&(this.runPromise(this.client.then(e=>e.close())),this.client=void 0,clearInterval(this.interval),this.interval=void 0)}subscribe(e,t,r){let n=!0,s=()=>{n=!1};return this.runPromise(et(e)._buildEntityDataProviderFindOptions(t).then(a=>{if(!n)return;const{createKey:o,subscribe:l}=new Dr(this.apiProvider).getEntityDataProvider(e.metadata).buildFindRequest(a),u=o();let d=this.queries.get(u);d?d.sendDefaultState(r.next):(this.queries.set(u,d=new ya(e,{entityKey:e.metadata.key,options:t},this.getUserId())),d.subscribeCode=()=>{d.unsubscribe&&(d.unsubscribe(),d.unsubscribe=()=>{}),this.runPromise(this.subscribeChannel(d.queryChannel,{next:c=>this.runPromise(d.handle(c)),complete:()=>{},error:c=>{d.listeners.forEach(h=>h.error(c))}}).then(c=>{if(d.listeners.length==0){c();return}this.runPromise(l(d.queryChannel).then(h=>{if(d.listeners.length===0){h.unsubscribe(),c();return}this.runPromise(d.setAllItems(h.result)),d.unsubscribe=()=>{d.unsubscribe=()=>{},c(),this.runPromise(h.unsubscribe())}}).catch(h=>{d.listeners.forEach(y=>y.error(h)),c(),this.queries.delete(u)}))})).catch(c=>{d.listeners.forEach(h=>h.error(c))})},d.subscribeCode()),d.listeners.push(r),s=()=>{d.listeners.splice(d.listeners.indexOf(r),1),r.complete(),d.listeners.length==0&&(this.queries.delete(u),d.unsubscribe()),this.closeIfNoListeners()}}).catch(a=>{r.error(a)})),()=>{s()}}openIfNoOpened(){return this.client?this.client:(this.interval=setInterval(async()=>{const e=[];for(const t of this.queries.values())e.push(t.queryChannel);if(e.length>0){let t=this.apiProvider();const r=await this.runPromise(await D.actionInfo.runActionWithoutBlockingUI(()=>ht(t.httpClient).post(t.url+"/"+pa,e)));for(const n of r)for(const s of this.queries.values())s.queryChannel===n&&s.subscribeCode()}},3e4),this.runPromise(this.client=this.apiProvider().subscriptionClient.openConnection(()=>{for(const e of this.queries.values())e.subscribeCode()})))}}class ga{constructor(){f(this,"unsubscribe",()=>{});f(this,"listeners",[])}async handle(e){for(const t of this.listeners)t.next(e)}}class Br{openConnection(e){let t;const r=new Map,n=ht(be.apiClient.httpClient);let s=!1,a;const o={close(){a.close()},async subscribe(d,c){let h=r.get(d);return h||(r.set(d,h=[]),await u(d)),h.push(c),()=>{h.splice(h.indexOf(c,1)),h.length==0&&(D.actionInfo.runActionWithoutBlockingUI(()=>n.post(be.apiClient.url+"/"+Ir+"/unsubscribe",{channel:d,clientId:t})),r.delete(d))}}},l=()=>new Promise(d=>{h();let c=0;function h(){a&&a.close(),a=Br.createEventSource(be.apiClient.url+"/"+Ir),a.onmessage=y=>{let p=JSON.parse(y.data);const b=r.get(p.channel);b&&b.forEach(w=>w(p.data))},a.onerror=y=>{console.error("Live Query Event Source Error",y),a.close(),c++<nn.error500RetryCount&&setTimeout(()=>{h()},500)},a.addEventListener("connectionId",async y=>{if(t=y.data,s){for(const p of r.keys())await u(p);e()}else s=!0,d(o)})}});return l();async function u(d){await D.actionInfo.runActionWithoutBlockingUI(()=>n.post(be.apiClient.url+"/"+Ir+"/subscribe",{channel:d,clientId:t}))===wa&&await l()}}static createEventSource(e){return new EventSource(e,{withCredentials:!0})}}const wa="client connection not found",Nr=Symbol.for("serverActionField");class Ct{constructor(){f(this,"_subscribers")}reportChanged(){this._subscribers&&this._subscribers.forEach(e=>e.reportChanged())}reportObserved(){this._subscribers&&this._subscribers.forEach(e=>e.reportObserved())}subscribe(e){let t;return typeof e=="function"?t={reportChanged:()=>e(),reportObserved:()=>{}}:t=e,this._subscribers||(this._subscribers=[]),this._subscribers.push(t),()=>this._subscribers=this._subscribers.filter(r=>r!=t)}}class va{constructor(e){f(this,"remultObjectStorage");this.remultObjectStorage=e}static enable(){D.remultFactory=()=>{const e=D.asyncContext.getStore();if(e)return e.remult;throw new Error("remult object was requested outside of a valid request cycle.valid context, try running `withRemult` or run within initApi or a remult request cycle")}}static disable(){Qs()}async run(e,t){return this.remultObjectStorage?this.remultObjectStorage.run({remult:e},()=>t(e)):t(e)}isInInitRequest(){var e,t;return(t=(e=this.remultObjectStorage)==null?void 0:e.getStore())==null?void 0:t.inInitRequest}setInInitRequest(e){var r,n;const t=(r=this.remultObjectStorage)==null?void 0:r.getStore();t&&(e||(n=this.remultObjectStorage)!=null&&n.isStub)&&(t.inInitRequest=e)}getStore(){if(!this.remultObjectStorage)throw new Error("can't use static remult in this environment, `async_hooks` were not initialized");return this.remultObjectStorage.getStore()}}D.asyncContext||(D.asyncContext=new va(void 0));function Pt(){return D.actionInfo.runningOnServer||!be.dataProvider.isProxy}class De{constructor(e){f(this,"repo",(e,t)=>{let r=Oe(e)(be);if(t===void 0&&r!=null&&r.dataProvider){const a=r.dataProvider(this.dataProvider);a instanceof Promise?t=new ta(a):t=a??void 0}t||(t=this.dataProvider);let n=this.repCache.get(t);n||this.repCache.set(t,n=new Map);let s=n.get(e);return s||(n.set(e,s=new Jr(e,this,t,Sa(e,this))),Js(s,this,t)),s});f(this,"_subscribers");f(this,"__user");f(this,"dataProvider",new Dr(()=>this.apiClient));f(this,"repCache",new Map);f(this,"liveQueryStorage");f(this,"subscriptionServer");f(this,"liveQueryPublisher",{itemChanged:async()=>{}});f(this,"liveQuerySubscriber",new ma(()=>this.apiClient,()=>{var e;return(e=this.user)==null?void 0:e.id}));f(this,"context",{});f(this,"apiClient",{url:"/api",subscriptionClient:new Br});if(e&&e.getEntityDataProvider){this.dataProvider=e;return}if(on(e))this.apiClient.httpClient=e;else if(typeof e=="function")this.apiClient.httpClient=e;else if(e){const t=e;t.httpClient&&(this.apiClient.httpClient=t.httpClient),t.url&&(this.apiClient.url=t.url),t.subscriptionClient&&(this.apiClient.subscriptionClient=t.subscriptionClient),t.wrapMessageHandling&&(this.apiClient.wrapMessageHandling=t.wrapMessageHandling)}}subscribeAuth(e){return this._subscribers||(this._subscribers=new Ct),this._subscribers.subscribe(e)}get user(){var e;return(e=this._subscribers)==null||e.reportObserved(),this.__user}set user(e){var t;this.__user=e,(t=this._subscribers)==null||t.reportChanged()}async initUser(){const t=await ht(this.apiClient.httpClient).get(ln(this.apiClient.url,"me"));return this.user=(t==null?void 0:t.id)!=null?t:void 0,this.user}authenticated(){var e;return((e=this.user)==null?void 0:e.id)!==void 0}isAllowed(e){var t,r;if(e!=null){if(e instanceof Array){for(const n of e)if(this.isAllowed(n)===!0)return!0;return!1}return typeof e=="function"?e(this):typeof e=="boolean"?e:!!(typeof e=="string"&&(r=(t=this.user)==null?void 0:t.roles)!=null&&r.includes(e.toString()))}}isAllowedForInstance(e,t){if(Array.isArray(t)){for(const r of t)if(this.isAllowedForInstance(e,r))return!0}else return typeof t=="function"?t(e,this):this.isAllowed(t)}useFetch(e){this.dataProvider=new Dr(()=>({httpClient:e}))}call(e,t,...r){const n=e[Nr];if(!n.doWork)throw Error("The method received is not a valid backend method");return n.doWork(r,t,this.apiClient.url,ht(this.apiClient.httpClient))}clearAllCache(){this.repCache.clear()}}f(De,"onFind",(e,t)=>{}),f(De,"entityRefInit");D.defaultRemultFactory=()=>new De;class un{constructor(){f(this,"classes",new Map)}}function ba(i,e){let t=i;for(;;){let r=D.classHelpers.get(t);r||D.classHelpers.set(t,r=new un),r.classes.set(i,e);let n=Object.getPrototypeOf(t.prototype);if(n==null)break;t=n.constructor}}const _a={defaultPageSize:200};async function Ia(i,e){const t=new Oa(i.liveQueryPublisher);let r=!0;const n=i.dataProvider;try{await i.dataProvider.transaction(async s=>{i.dataProvider=s,i.liveQueryPublisher=t,await e(s),r=!0}),r&&await t.flush()}finally{i.dataProvider=n}}class Oa{constructor(e){f(this,"orig");f(this,"transactionItems",new Map);this.orig=e}async itemChanged(e,t){let r=this.transactionItems.get(e);r||this.transactionItems.set(e,r=[]);for(const n of t)if(n.oldId!==void 0){const s=r.find(a=>a.id===n.oldId);s!==void 0?(n.deleted&&(s.deleted=!0),n.id!=s.id&&(s.id=n.id)):r.push(n)}else r.push(n)}async flush(){for(const e of this.transactionItems.keys())await this.orig.itemChanged(e,this.transactionItems.get(e))}}function At(i,e){return e&&Object.assign(i,e),i}class Te{}f(Te,"number","number"),f(Te,"date","date"),f(Te,"checkbox","checkbox"),f(Te,"password","password"),f(Te,"email","email"),f(Te,"tel","tel"),f(Te,"time","time"),f(Te,"json","json");const U=class U{};f(U,"Date",{toJson:e=>{if(e===null)return null;if(!e)return"";if(typeof e=="string"&&(e=new Date(e)),e instanceof Date)return e.toISOString();throw new Error("Expected date but got "+e)},fromJson:e=>{if(e===null)return null;if(e!=null&&e!=""&&!e.startsWith("0000-00-00"))return new Date(Date.parse(e))},toDb:e=>e,fromDb:e=>{if(typeof e=="number"&&(e=new Date(e)),typeof e=="string"&&(e=new Date(e)),e&&!(e instanceof Date))throw"expected date but got "+e;return e},fromInput:e=>U.Date.fromJson(e),toInput:e=>U.Date.toJson(e),displayValue:e=>e?e.toLocaleString():""}),f(U,"DateOnly",{fromInput:e=>U.DateOnly.fromJson(e),toInput:e=>U.DateOnly.toJson(e),toJson:e=>{var t=e;if((typeof t=="string"||typeof t=="number")&&(t=new Date(t)),t!==void 0)return!t||t==null?null:t.getHours()==0?new Date(t.valueOf()-t.getTimezoneOffset()*6e4).toISOString().substring(0,10):t.toISOString().substring(0,10)},fromJson:e=>{if(!e||e==""||e=="0000-00-00")return null;let t=new Date(Date.parse(e));return t.setMinutes(t.getMinutes()+t.getTimezoneOffset()),t},inputType:Te.date,toDb:e=>e?U.DateOnly.fromJson(U.DateOnly.toJson(e)):null,fromDb:e=>U.Date.fromDb(e),fieldTypeInDb:"date",displayValue:e=>e?e.toLocaleDateString(void 0):""}),f(U,"DateOnlyString",{...U.DateOnly,toDb:e=>{let t=U.DateOnly.toJson(e);if(t)return t.replace(/-/g,"")},fromDb:e=>{if(e===null)return null;if(e)return new Date(e.substring(0,4)+"-"+e.substring(4,6)+"-"+e.substring(6,8))}}),f(U,"Boolean",{toDb:e=>e,inputType:Te.checkbox,fromDb:e=>U.Boolean.fromJson(e),fromJson:e=>typeof e=="boolean"?e:e===1?!0:e!=null?e.toString().trim().toLowerCase()=="true":e,toJson:e=>e,fromInput:e=>U.Boolean.fromJson(e),toInput:e=>U.Boolean.toJson(e)}),f(U,"Number",{fromDb:e=>{if(e===null)return null;if(e!==void 0)return+e},toDb:e=>e,fromJson:e=>U.Number.fromDb(e),toJson:e=>U.Number.toDb(e),fromInput:(e,t)=>{let r=+e;if(e===null)return null;if(e!==void 0)return r},toInput:(e,t)=>(e==null?void 0:e.toString())??"",inputType:Te.number}),f(U,"String",{fromDb:ot,toDb:ot,fromJson:ot,toJson:ot,fromInput:ot,toInput:ot}),f(U,"Integer",{...U.Number,toJson:e=>{let t=U.Number.toDb(e);return t&&+(+t).toFixed(0)},toDb:e=>U.Integer.toJson(e),fieldTypeInDb:"integer"}),f(U,"Default",{fromJson:e=>e,toJson:e=>e,fromDb:e=>U.JsonString.fromDb(e),toDb:e=>U.JsonString.toDb(e),fromInput:e=>U.Default.fromJson(e),toInput:e=>U.Default.toJson(e),displayValue:e=>e+"",fieldTypeInDb:"",inputType:"text"}),f(U,"JsonString",{fromJson:e=>e,toJson:e=>e,fromDb:e=>e==null?null:e?JSON.parse(U.JsonString.fromJson(e)):void 0,toDb:e=>e!==void 0?e===null?null:JSON.stringify(U.JsonString.toJson(e)):void 0,fromInput:e=>U.JsonString.fromJson(e),toInput:e=>U.JsonString.toJson(e)}),f(U,"JsonValue",{fromJson:e=>e,toJson:e=>e,fromDb:e=>e,toDb:e=>e,fromInput:e=>U.JsonString.fromJson(e),toInput:e=>U.JsonString.toJson(e),fieldTypeInDb:"json"});let ve=U;function ot(i){return i==null?i:typeof i!="string"?i.toString():i}function Or(i,e,t){let r=L.fromEntityFilter(i,e);const n=()=>{};r&&r.__applyToConsumer({custom:n,databaseCustom:n,containsCaseInsensitive:n,notContainsCaseInsensitive:n,startsWithCaseInsensitive:n,endsWithCaseInsensitive:n,isDifferentFrom:n,isEqualTo:(s,a)=>{t[s.key]=a},isGreaterOrEqualTo:n,isGreaterThan:n,isIn:n,isLessOrEqualTo:n,isLessThan:n,isNotNull:n,isNull:n,not:n,or:n})}class Et{constructor(){f(this,"entityLoaders",new Map);f(this,"promises",[])}load(e,t){let r=this.entityLoaders.get(e.entityType);r||this.entityLoaders.set(e.entityType,r=new ka(e));const n=r.find(t);return this.promises.push(n),n}async resolveAll(){for(const t of this.entityLoaders.values())for(const r of t.queries.values())r.resolve();if(this.promises.length===0)return;const e=this.promises;this.promises=[],await Promise.all(e),await this.resolveAll()}}class ka{constructor(e){f(this,"rel");f(this,"queries",new Map);this.rel=e}find(e){const{where:t,...r}=xr(e,this.rel.metadata),n=JSON.stringify(r);let s=this.queries.get(n);return s||this.queries.set(n,s=new Ca(this.rel)),s.find(e,t)}}class Ca{constructor(e){f(this,"rel");f(this,"pendingInStatements",new Map);f(this,"whereVariations",new Map);this.rel=e}find(e,t){const r=JSON.stringify(t);let n=this.whereVariations.get(r);if(!n){const s=Object.keys(t);if(s.length===1&&typeof t[s[0]]!="object"&&!e.limit){let a=this.pendingInStatements.get(s[0]);a||this.pendingInStatements.set(s[0],a=new Aa(this.rel,s[0],e)),this.whereVariations.set(r,n={result:a.find(t)})}else this.whereVariations.set(r,n={result:this.rel.find(e)})}return n.result}resolve(){const e=[...this.pendingInStatements.values()];this.pendingInStatements.clear();for(const t of e)t.resolve()}}class Aa{constructor(e,t,r){f(this,"rel");f(this,"key");f(this,"options");f(this,"values",new Map);this.rel=e,this.key=t,this.options=r}async resolve(){const e=[...this.values.values()];if(e.length==1){this.rel.find(this.options).then(e[0].resolve,e[0].reject);return}var t={...this.options};t.where={[this.key]:e.map(n=>n.value)},t.limit=1e3,t.page=1;let r=[];try{for(;;){const n=await this.rel.find(t);if(r.push(...n),n.length<t.limit)break;t.page++}for(const n of this.values.values())n.resolve(r.filter(s=>{const o=ie(s).fields.find(this.key),l=ne(o.metadata),u=(l==null?void 0:l.type)==="reference"?o.getId():s[this.key];return n.value==u}))}catch(n){for(const s of this.values.values())s.reject(n)}}find(e){const t=e[this.key];let r=this.values.get(t);if(!r){let n,s,a=new Promise((o,l)=>{n=o,s=l});this.values.set(t,r={value:t,resolve:n,reject:s,result:a})}return r.result}}async function fn(i,e=t=>t){if(i.options.sqlExpression){if(typeof i.options.sqlExpression=="string")return i.options.sqlExpression;if(typeof i.options.sqlExpression=="function"){const t=i.options.sqlExpression;try{return i.options.sqlExpression="recursive sqlExpression call for entity '"+i.key+"'. ",await t(i)}finally{i.options.sqlExpression=t}}}return e(i.dbName)}const kr=Symbol.for("sqlExpressionInProgressKey");async function jr(i,e,t=n=>n,r=!1){try{if(i.options.sqlExpression){let a;if(typeof i.options.sqlExpression=="function"){if(i[kr]&&!r)return"recursive sqlExpression call for field '"+i.key+"'. \0";try{i[kr]=!0,a=await i.options.sqlExpression(e),a.includes("\0")||(i.options.sqlExpression=()=>a)}finally{delete i[kr]}}else a=i.options.sqlExpression;return a||i.dbName}const n=ne(i);let s=(n==null?void 0:n.type)==="toOne"&&i.options.field;if(s){let a=e.fields.find(s);if(a)return jr(a,e,t,r)}return t(i.dbName)}finally{}}const de=class de{};f(de,"required",Tt(async(e,t)=>!t.valueIsNull()&&t.value!==""&&(t.value!==void 0||ne(t.metadata)!==void 0),"Should not be empty")),f(de,"unique",Tt(async(e,t)=>{if(!t.entityRef)throw"unique validation may only work on columns that are attached to an entity";return t.isBackend()&&(t.isNew||t.valueChanged())?await t.entityRef.repository.count({[t.metadata.key]:t.value})==0:!0},"already exists")),f(de,"uniqueOnBackend",Tt(async(e,t)=>t.isBackend()&&(t.isNew||t.valueChanged())?await t.entityRef.repository.count({[t.metadata.key]:t.value})==0:!0,de.unique.defaultMessage)),f(de,"regex",Qe((e,t)=>t.test(e))),f(de,"email",Ut(e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e),"Invalid Email")),f(de,"url",Ut(e=>!!new URL(e),"Invalid Url")),f(de,"in",Qe((e,t)=>t.includes(e),e=>`Value must be one of: ${e.map(t=>typeof t=="object"?(t==null?void 0:t.id)!==void 0?t==null?void 0:t.id:t==null?void 0:t.toString():t).join(", ")}`)),f(de,"notNull",Ut(e=>e!=null,"Should not be null")),f(de,"enum",Qe((e,t)=>Object.values(t).includes(e),e=>`Value must be one of ${Vt(e).join(", ")}`)),f(de,"relationExists",Tt(async(e,t)=>t.valueIsNull()||!t.isBackend()?!0:!!await t.load(),"Relation value does not exist")),f(de,"min",Qe((e,t)=>e>=t,e=>`Value must be bigger than or equal to ${e}`)),f(de,"max",Qe((e,t)=>e<=t,e=>`Value must be smaller than or equal to ${e}`)),f(de,"maxLength",Qe((e,t)=>e.length<=t,e=>`Value must be at most ${e} characters`)),f(de,"minLength",Qe((e,t)=>e.length>=t,e=>`Value must be at least ${e} characters`)),f(de,"range",Qe((e,[t,r])=>e>=t&&e<=r,([e,t])=>`Value must be between ${e} and ${t}`)),f(de,"defaultMessage","Invalid value");let Fe=de;function Tt(i,e){const t=async(n,s,a)=>{const o=await i(n,s);typeof o=="string"&&o.length>0?s.error=o:o||(s.error=typeof a=="function"&&a(n,s,void 0)||a||typeof e=="function"&&e(n,s,void 0)||e||Fe.defaultMessage)},r=(n,s,a)=>typeof n=="string"||n==="function"||n===void 0&&s===void 0?async(o,l,u)=>await t(o,l,n||u):t(n,s,a);return Object.defineProperty(r,"defaultMessage",{get:()=>e,set:n=>{e=n},enumerable:!0}),Object.assign(r,{withMessage:n=>async(s,a)=>r(s,a,n)})}function Ut(i,e){return Tt((t,r)=>r.value===void 0||r.value===null?!0:i(r.value),e)}function Qe(i,e){const t=Ea((r,n,s)=>n.value===void 0||n.value===null?!0:i(n.value,s),(r,n,s)=>typeof e=="function"&&e(s)||e,!0);return Object.assign((r,n)=>t(r,n),{get defaultMessage(){return e},set defaultMessage(r){e=r}})}function Ea(i,e,t=!1){return Object.assign((n,s)=>async(a,o)=>{const l=await i(a,o,n);typeof l=="string"?o.error=l:l||(o.error=s?typeof s=="function"?t?s(n):s(a,o,n):s:e?typeof e=="function"?e(a,o,n):e:Fe.defaultMessage)},{get defaultMessage(){return e},set defaultMessage(n){e=n}})}function Vt(i){return Object.values(i).filter(e=>typeof i[e]!="number")}function Wt(i,e,t=!1){if(!e)return i;const r=Array.isArray(e)?e:[e],n=Array.isArray(i)?i:i?[i]:[];return t?[...r,...n]:[...n,...r]}function ct(i,e){return typeof i[e]<"u"}class Ta{constructor(e,t){f(this,"options");f(this,"repo");f(this,"_count");f(this,"_aggregates");this.options=e,this.repo=t,this.options||(this.options={}),this.options.pageSize||(this.options.pageSize=_a.defaultPageSize)}async getPage(e){return(e??0)<1&&(e=1),this.repo.find({where:this.options.where,orderBy:this.options.orderBy,limit:this.options.pageSize,page:e,load:this.options.load,include:this.options.include})}async count(){return this._count===void 0&&(this._count=await this.repo.count(this.options.where)),this._count}async forEach(e){let t=0;for await(const r of this)await e(r),t++;return t}async paginator(e){this.options.orderBy=Ae.createUniqueEntityOrderBy(this.repo.metadata,this.options.orderBy);let t={where:{$and:[this.options.where,e]},orderBy:this.options.orderBy,limit:this.options.pageSize,load:this.options.load,include:this.options.include},r=()=>this.repo.find(t);if(this._aggregates===void 0&&ct(this.options,"aggregate")){let o=this.options.aggregate;if(this.repo._dataProvider.isProxy){const l=new Et;r=()=>this.repo._rawFind(t,!1,l,async u=>{const d=await this.repo._edp.query(u,await this.repo.__buildGroupByOptions(o));return this._aggregates=d.aggregates,d.items}).then(async u=>(await l.resolveAll(),u))}else{let l=r();r=async()=>(this._aggregates=await this.repo.aggregate({...o,where:this.options.where}),this._count=this._aggregates.$count,l)}}let n=await r(),s=()=>{throw new Error("no more pages")},a=n.length==this.options.pageSize;if(a){let o=await this.repo._createAfterFilter(this.options.orderBy,n[n.length-1]);s=()=>this.paginator(o)}return{count:()=>this.count(),hasNextPage:a,items:n,nextPage:s,aggregates:this._aggregates}}[Symbol.asyncIterator](){this.options.where||(this.options.where={});let e=this.options.orderBy;this.options.orderBy=Ae.createUniqueEntityOrderBy(this.repo.metadata,e);let t=-1,r,n,s=0;return n=async()=>{if(this.options.progress&&this.options.progress.progress(s++/await this.count()),r===void 0||t==r.items.length){if(r&&!r.hasNextPage)return{value:void 0,done:!0};let a=r;if(r?r=await r.nextPage():r=await this.paginator(),t=0,r.items.length==0)return{value:void 0,done:!0};if(((a==null?void 0:a.items.length)??!1)&&this.repo.getEntityRef(a.items[0]).getId()==this.repo.getEntityRef(r.items[0]).getId())throw new Error("pagination failure, returned same first row")}return t<r.items.length?{value:r.items[t++],done:!1}:{done:!0,value:void 0}},{next:async()=>n()}}}class Jr{constructor(e,t,r,n,s){f(this,"_entity");f(this,"_remult");f(this,"_dataProvider");f(this,"_info");f(this,"_defaultFindOptions");f(this,"__edp");f(this,"_idCache",new Map);f(this,"listeners");f(this,"_cache",new Map);this._entity=e,this._remult=t,this._dataProvider=r,this._info=n,this._defaultFindOptions=s}_notFoundError(e){return{message:`id ${e} not found in entity ${this.metadata.key}`,httpStatusCode:404}}[Ft](){return this}async _createAfterFilter(e,t){let r=new Map;for(const a of Ae.translateOrderByToSort(this.metadata,e).Segments){let o=t[a.field.key];r.set(a.field.key,o)}let n={$or:[]},s=[];for(const a of Ae.translateOrderByToSort(this.metadata,e).Segments){let o={};for(const l of s)o[l.key]=r.get(l.key);s.push(a.field),a.isDescending?o[a.field.key]={$lt:r.get(a.field.key)}:o[a.field.key]={$gt:r.get(a.field.key)},n.$or.push(o)}return n}relations(e){return new Proxy({},{get:(t,r)=>{const n=this.fields.find(r),s=ne(n);if(!s)throw Error(r+" is not a relation");const{toRepo:a,returnNull:o,returnUndefined:l}=this._getFocusedRelationRepo(n,e);return s.type==="toMany"?a:{findOne:u=>o?Promise.resolve(null):l?Promise.resolve(void 0):a.findFirst({},u)}}})}_getFocusedRelationRepo(e,t){const r=ne(e);let n=r.toRepo,{findOptions:s,returnNull:a,returnUndefined:o}=this._findOptionsBasedOnRelation(r,e,void 0,t,n);return{toRepo:new Jr(n._entity,n._remult,n._dataProvider,n._info,s),returnNull:a,returnUndefined:o}}get _edp(){return this.__edp?this.__edp:this.__edp=this._dataProvider.getEntityDataProvider(this.metadata)}async aggregate(e){return(await this.groupBy(e))[0]}async groupBy(e){var t=await this.__buildGroupByOptions(e);const r=await this._edp.groupBy(t);if(!(e!=null&&e[Xs])&&e.group){const n={include:{}};for(const a of e.group)n.include[a]=!0;const s=new Et;await this._populateRelationsForFields(t.group,n,r,s),await s.resolveAll()}return r}async __buildGroupByOptions(e){var a,o,l,u,d,c;let t=await this._buildEntityDataProviderFindOptions({...e});const r=h=>{const y=this.metadata.fields.find(h);if(y===void 0)throw Error(`key "${h}" not found in entity`);return y},n=h=>{var y;if((y=e==null?void 0:e.group)!=null&&y.includes(h))throw Error(`field "${h}" cannot be used both in an aggregate and in group by`);return r(h)};var s={where:t.where,limit:t.limit,page:t.page,group:(a=e==null?void 0:e.group)==null?void 0:a.map(r),sum:(o=e==null?void 0:e.sum)==null?void 0:o.map(n),avg:(l=e==null?void 0:e.avg)==null?void 0:l.map(n),min:(u=e==null?void 0:e.min)==null?void 0:u.map(n),max:(d=e==null?void 0:e.max)==null?void 0:d.map(n),distinctCount:(c=e==null?void 0:e.distinctCount)==null?void 0:c.map(n)};if(e!=null&&e.orderBy){s.orderBy=[];for(const h in e.orderBy)if(Object.prototype.hasOwnProperty.call(e==null?void 0:e.orderBy,h)){const y=e.orderBy[h];if(y){if(typeof y=="string")s.orderBy.push({field:h==="$count"?void 0:r(h),isDescending:y==="desc",operation:h==="$count"?"count":void 0});else for(const p in y)if(Object.prototype.hasOwnProperty.call(y,p)){const b=y[p];s.orderBy.push({field:this.metadata.fields.find(h),isDescending:b==="desc",operation:p})}}}}return s}_getCachedById(e,t){e=e+"",this._getCachedByIdAsync(e,t);let r=this._idCache.get(e);if(!(r instanceof Promise))return r}async _getCachedByIdAsync(e,t){e=e+"";let r=this._idCache.get(e);if(r instanceof Promise)return await r;if(this._idCache.has(e))return r;if(t)return;this._idCache.set(e,void 0);let n=this.findId(e).then(s=>(s===void 0?r=null:r=s,this._idCache.set(e,r),r));return this._idCache.set(e,n),await n}_addToCache(e){e&&this._idCache.set(this.getEntityRef(e).getId()+"",e)}get metadata(){return this._info}addEventListener(e){return this.listeners||(this.listeners=[]),this.listeners.push(e),()=>{this.listeners.splice(this.listeners.indexOf(e),1)}}query(e){return new Ta(e,this)}getEntityRef(e){let t=e[Xe];return t||(this._fixTypes(e),t=new xt(this._info,e,this,this._edp,this._remult,!0),Object.defineProperty(e,Xe,{get:()=>t}),t.saveOriginalData()),t}async delete(e){const t=ie(e,!1);if(t)return t.delete();if(typeof e=="string"||typeof e=="number"){if(this._dataProvider.isProxy)return this._edp.delete(e);{let n=await this.findId(e);if(!n)throw this._notFoundError(e);return await ie(n).delete()}}let r=this._getRefForExistingRow(e,void 0);return this._dataProvider.isProxy||await r.reload(),r.delete()}__cleanupPartialObject(e){const t=Object.keys(e);for(let r=0;r<t.length;r++){const n=t[r],s=this.fields[n];if(s){const a=ne(s);a&&a.type==="toOne"&&a.options.field&&t.indexOf(a.options.field)>r&&a.toRepo.getEntityRef(e[n]).getId()!==e[a.options.field]&&delete e[n]}}for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(e[r],ne(this.fields[r]));for(const r of this.fields);}async insert(e){if(Array.isArray(e))if(this._dataProvider.isProxy){let t=[],r=[];for(const n of e){this.__cleanupPartialObject(n);let s=ie(e,!1);if(s){if(!s.isNew())throw"Item is not new"}else s=await this.getEntityRef(this.create(n));t.push(s),r.push(await s.buildDtoForInsert())}return ft(await this._edp.insertMany(r),(n,s)=>t[s].processInsertResponseDto(n))}else{let t=[];for(const r of e)t.push(await this.insert(r));return t}else{let t=ie(e,!1);if(t){if(!t.isNew())throw"Item is not new";return await t.save()}else return this.__cleanupPartialObject(e),await this.getEntityRef(this.create(e)).save()}}get fields(){return this.metadata.fields}async validate(e,...t){{let r=ie(e,!1);if(r||(r=this.getEntityRef({...e})),!t||t.length===0)return await r.validate();{r.__clearErrorsAndReportChanged();let n=!1;for(const s of t)await r.fields.find(s).validate()||(n=!0);return n?r.buildErrorInfoObject():void 0}}}__createDto(e){this.__cleanupPartialObject(e);const r=this.getEntityRef({...e}).copyDataToObject(!1),n=Object.keys(e);for(const s of this.fields)(s.dbReadOnly||!n.includes(s.key))&&delete r[s.key];return r}async updateMany({where:e,set:t}){if(this.__cleanupPartialObject(t),L.throwErrorIfFilterIsEmpty(e,"updateMany"),this._dataProvider.isProxy)return this._edp.updateMany(await this._translateWhereToFilter(e),this.__createDto({...t}));{let r=0;for await(const n of this.query({where:e,aggregate:void 0}))At(n,t),await ie(n).save(),r++;return r}}async update(e,t){{let n=ie(t,!1);if(n)return await n.save()}{let n=ie(e,!1);if(n)return At(e,t),n.save()}this.__cleanupPartialObject(t);let r;if(typeof e=="object"?(r=this._getRefForExistingRow(e,this.metadata.idMetadata.getId(e)),Object.assign(r.instance,t)):r=this._getRefForExistingRow(t,e),this._dataProvider.isProxy)return await r.save(Object.keys(t));{const n=await r.reload();if(!n)throw this._notFoundError(r.id);for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){let a=r.fields[s];if(t[s]===void 0&&ne(a.metadata))continue;a&&(n[s]=t[s])}return await this._fixTypes(n),await r.save()}}async upsert(e){if(this._dataProvider.isProxy){let s=await this._edp.upsertMany((Array.isArray(e)?e:[e]).map(l=>{var u;return(u=this._defaultFindOptions)!=null&&u.where&&(Or(this.metadata,this._defaultFindOptions.where,l.where),this._fixTypes(l)),{where:this.__createDto(l.where),set:l.set?this.__createDto(l.set):void 0}}));const a=new Et,o=await this._loadManyToOneForManyRows(s,{},a);return await a.resolveAll(),Array.isArray(e)?o:o[0]}if(Array.isArray(e))return ft(e,s=>this.upsert(s));let t=e;var r=await this.findFirst(t.where,{createIfNotFound:!0}),n=ie(r,!1);return n.isNew()?(t.set&&At(r,t.set),await n.save()):t.set?(At(r,t.set),await n.save()):r}_getRefForExistingRow(e,t){let r=ie(e,!1);if(!r){const n=new this._entity(this._remult);for(const a of this._fieldsOf(e)){const o=a.key;n[o]=e[o]}this._fixTypes(n);let s=new xt(this._info,n,this,this._edp,this._remult,!1);typeof t=="object"&&(t=this.metadata.idMetadata.getId(t)),t?(s.id=t,s.originalId=t):s.id=s.getId(),r=s,Object.defineProperty(n,Xe,{get:()=>s})}return r}async save(e){if(Array.isArray(e))return ft(e,t=>this.save(t));{let t=ie(e,!1);if(t)return await t.save();if(e instanceof mn)return await this.getEntityRef(e).save();{let r=this.metadata.idMetadata.getId(e);return r===void 0?this.insert(e):this.update(r,e)}}}liveQuery(e){return e||(e={}),{subscribe:t=>{let r=t;return typeof t=="function"&&(r={next:t,complete:()=>{},error:()=>{}}),r.error??(r.error=()=>{}),r.complete??(r.complete=()=>{}),this._remult.liveQuerySubscriber.subscribe(this,e,r)}}}async _rawFind(e,t=!1,r,n){e||(e={}),this._defaultFindOptions&&(e={...this._defaultFindOptions,...e});let s=await this._buildEntityDataProviderFindOptions(e);t&&(delete s.orderBy,delete s.limit),De.onFind(this._info,e);const a=await n(s);return await this._loadManyToOneForManyRows(a,e,r)}async find(e,t=!1){const r=new Et,n=await this._rawFind(e,t,r,s=>this._edp.find(s));return await r.resolveAll(),n}async _buildEntityDataProviderFindOptions(e){e={...e};let t={};return t={},(!e.orderBy||Object.keys(e.orderBy).length===0)&&(this._dataProvider.isProxy||(e.orderBy=this._info.entityInfo.defaultOrderBy)),t.where=await this._translateWhereToFilter(e.where),e.orderBy!==void 0&&(t.orderBy=Ae.translateOrderByToSort(this.metadata,e.orderBy)),e.limit!==void 0&&(t.limit=e.limit),e.page!==void 0&&(t.page=e.page),t}async _fromJsonArray(e,t){const r=new Et,n=await this._loadManyToOneForManyRows(e.map(s=>{let a={};for(const o of this.metadata.fields.toArray())a[o.key]=o.valueConverter.fromJson(s[o.key]);return a}),t,r);return await r.resolveAll(),n}async _loadManyToOneForManyRows(e,t,r){let n;t!=null&&t.load&&(n=t.load(this.metadata.fields));for(const u of this.metadata.fields)if(Oe(u.valueType,!1)&&!ne(u)){let h=!u.options.lazy;if(n!==void 0&&(h=n.includes(u)),h){let y=this._remult.repo(u.valueType),p=[];for(const b of e){let w=b[u.key];w!=null&&!p.includes(w)&&!y._idCache.has(w+"")&&p.push(w)}p.length>0&&await s(y,p)}}async function s(u,d){let c=await u.find({where:u.metadata.idMetadata.getIdFilter(...d)},!0);for(const h of c)u._addToCache(h)}const a=new Set(this.fields.toArray().map(u=>{const d=this.__getRelationAndInclude(u,t);if(d.rel&&!d.incl)return u.key}).filter(u=>u!==void 0));let o=await ft(e,async u=>await this._mapRawDataToResult(u,n,a));const l=this.metadata.fields.toArray();return this._populateRelationsForFields(l,t,o,r),o}_populateRelationsForFields(e,t,r,n){for(const s of e){let{rel:a,incl:o}=this.__getRelationAndInclude(s,t);if(a)if(o){const l=a.toRepo;for(const u of r){let{findOptions:d,returnNull:c}=this._findOptionsBasedOnRelation(a,s,o,u,l);const h=s.key;if(c)u[h]=null;else{const y=a.toEntity,p=l;n.load({entityType:y,find:b=>p._rawFind(b,!1,n,w=>p._edp.find(w)),metadata:p.metadata},d).then(b=>{b.length==0&&a.type=="toOne"||(u[h]=a.type!=="toMany"?b.length==0?null:b[0]:b)})}}}else for(const l of r)Reflect.deleteProperty(l,s.key)}}__getRelationAndInclude(e,t){var a;let r=ne(e),n=e.options.defaultIncluded;const s=(a=t==null?void 0:t.include)==null?void 0:a[e.key];return s!==void 0&&(n=s),{rel:r,incl:n}}_findOptionsBasedOnRelation(e,t,r,n,s){let a=!1,o=!1,l=[],u={},d=[];typeof e.options.findOptions=="function"?d.push(e.options.findOptions(n)):typeof e.options.findOptions=="object"&&d.push(e.options.findOptions),typeof r=="object"&&d.push(r);for(const y of d){y.where&&l.push(y.where);for(const p of["limit","include","orderBy"])y[p]&&(u[p]=y[p])}const c=e.getFields(),h=y=>{const p=ie(n,!1);let b=e.type==="reference"&&p?p.fields.find(t.key).getId():n[y];return(e.type==="toOne"||e.type==="reference")&&(b===null?a=!0:b===void 0?o=!0:e.type==="reference"&&typeof b=="object"&&(b=s.metadata.idMetadata.getId(b))),b};c.compoundIdField&&(e.type==="toMany"?l.push({[c.compoundIdField]:this.metadata.idMetadata.getId(n)}):l.push(s.metadata.idMetadata.getIdFilter(h(c.compoundIdField))));for(const y in c.fields)Object.prototype.hasOwnProperty.call(c.fields,y)&&l.push({[y]:h(c.fields[y])});return u.where={$and:l},(e.type==="toOne"||e.type==="reference")&&u.orderBy&&(u.limit=1),{findOptions:u,returnNull:a,returnUndefined:o}}async _mapRawDataToResult(e,t,r){let n=new this._entity(this._remult),s=new xt(this._info,n,this,this._edp,this._remult,!1,r);return Object.defineProperty(n,Xe,{get:()=>s}),await s.loadDataFrom(e,t),s.saveOriginalData(),n}toJson(e){return e==null?e:Array.isArray(e)?e.map(t=>this.toJson(t)):typeof e.then=="function"?e.then(t=>this.toJson(t)):this.getEntityRef(e).toApiJson(!0)}fromJson(e,t){if(e==null)return e;if(Array.isArray(e))return e.map(n=>this.fromJson(n,t));let r=new this._entity(this._remult);for(const n of this._fieldsOf(e)){const s=n.key;if(Oe(n.valueType,!1)){let o=e[n.key];typeof o=="string"||typeof o=="number"?r[s]=o:r[s]=this._remult.repo(n.valueType).fromJson(o)}else e[s]!==void 0&&(r[s]=n.valueConverter.fromJson(e[n.key]))}if(this._fixTypes(r),t)return this.create(r);{let n=new xt(this._info,r,this,this._edp,this._remult,!1);return Object.defineProperty(r,Xe,{get:()=>n}),n.id=n.getId(),n.saveOriginalData(),n.originalId=n.id,r}}async count(e){return this._edp.count(await this._translateWhereToFilter(e))}async deleteMany({where:e}){if(L.throwErrorIfFilterIsEmpty(e,"deleteMany"),this._dataProvider.isProxy)return this._edp.deleteMany(await this._translateWhereToFilter(e));{let t=0;for await(const r of this.query({where:e,aggregate:void 0}))await ie(r).delete(),t++;return t}}async findOne(e,t=!1){let r,n,s=e??{};if(s.useCache){let a=xr(s,this.metadata),o=JSON.stringify(a);if(n=this._cache.get(o),n!==void 0)if(n.value&&this.getEntityRef(n.value).wasDeleted())n=void 0,this._cache.delete(o);else return n.promise;else n={value:void 0,promise:void 0},this._cache.set(o,n)}return r=this.find({...s,limit:1},t).then(async a=>{let o;return a.length>0&&(o=a[0]),!o&&s.createIfNotFound&&(o=this.create(),s.where&&await Or(this.metadata,s.where,o)),o}),n&&(n.promise=r=r.then(a=>(n.value=a,a))),r}async findFirst(e,t,r=!1){if(t||(t={}),e)if(t.where){let n=t.where;t.where={$and:[n,e]}}else t.where=e;return this.findOne(t,r)}_fieldsOf(e){let t=Object.keys(e);return this.metadata.fields.toArray().filter(r=>t.includes(r.key))}create(e){var r;let t=new this._entity(this._remult);if(e){for(const n of this._fieldsOf(e)){const s=n.key;t[s]=e[s]}this._fixTypes(t)}return(r=this._defaultFindOptions)!=null&&r.where&&(Or(this.metadata,this._defaultFindOptions.where,t),this._fixTypes(t)),this.getEntityRef(t),t}async _fixTypes(e){for(const t of this._fieldsOf(e)){const r=e[t.key];if(r!=null)if(t.valueType===Date&&!(r instanceof Date))e[t.key]=t.valueConverter.fromJson(t.valueConverter.toJson(r));else for(const[n,s]of[[String,"string"],[Number,"number"],[Boolean,"boolean"]])t.valueType===n&&typeof r!==s&&(e[t.key]=t.valueConverter.fromJson(t.valueConverter.toJson(r)))}return e}findId(e,t){if(e==null)return Promise.resolve(null);if(typeof e!="string"&&typeof e!="number")throw new Error("id can be either number or string, but got: "+typeof e);return this.findFirst({},{...t,where:this.metadata.idMetadata.getIdFilter(e)},!0)}async _translateWhereToFilter(e){var n,s;let t=e??{};(n=this._defaultFindOptions)!=null&&n.where&&(t={$and:[t,(s=this._defaultFindOptions)==null?void 0:s.where]}),this._dataProvider.isProxy||(this.metadata.options.backendPreprocessFilter&&(t=await this.metadata.options.backendPreprocessFilter(t,{metadata:this.metadata,getFilterPreciseValues:a=>L.getPreciseValues(this.metadata,a||t)})),this.metadata.options.backendPrefilter&&(t={$and:[t,await L.resolve(this.metadata.options.backendPrefilter)]}));let r=await L.fromEntityFilter(this.metadata,t);return r&&!this._dataProvider.isProxy&&(r=await L.translateCustomWhere(r,this.metadata,this._remult)),r}}function Sa(i,e){let t=D.columnsOfType.get(i);t||D.columnsOfType.set(i,t=[]);let r=Oe(i)(e),n=Bs(i),s=Object.getPrototypeOf(i);for(;s!=null;){let a=D.columnsOfType.get(s);a&&t.unshift(...a.filter(l=>!t.find(u=>u.key==l.key)));let o=Oe(s,!1);if(o){let l=o(e);r={...l,...r};let u=["saving","saved","deleting","deleted","validation"];for(const d of u)if(l[d]&&l[d]!==r[d]){let c=r[d];r[d]=async(h,y)=>{await c(h,y),await l[d](h,y)}}}s=Object.getPrototypeOf(s)}return new Da(cn(t,e),r,e,i,n)}class dn{constructor(e,t,r,n,s){f(this,"fieldsMetadata");f(this,"instance");f(this,"remult");f(this,"isNewRow");f(this,"_error");f(this,"_subscribers");f(this,"_isLoading",!1);f(this,"lookups",new Map);f(this,"errors");f(this,"originalValues",{});this.fieldsMetadata=e,this.instance=t,this.remult=r,this.isNewRow=n;{let a=r;a!=null&&a.iAmRemultProxy&&(r=D.remultFactory())}for(const a of e)if(Oe(a.valueType,!1)&&r){let l=new Zs(r.repo(a.valueType),!!ne(a),a.allowNull);this.lookups.set(a.key,l);let u=t[a.key],d;Object.defineProperty(t,a.key,{get:()=>(this._subscribers&&(this._subscribers.reportObserved(),d||(d=this.fields.find(a.key),d._subscribers||(d._subscribers=new Ct)),d._subscribers.reportObserved()),l.item),set:c=>{var h;l.set(c),(h=this._subscribers)==null||h.reportChanged(),d||(d=this.fields.find(a.key),d._subscribers||(d._subscribers=new Ct)),d._subscribers.reportChanged()},enumerable:!(s!=null&&s.has(a.key))}),l.set(u)}else{const l=ne(a);if((l==null?void 0:l.type)==="toOne"){let u=t.hasOwnProperty(a.key),d=t[a.key];n&&!d&&(u=!1),Object.defineProperty(t,a.key,{get:()=>d,set:c=>{if(d=c,c===void 0)return;const h=a.options;if(h.field&&(this.instance[h.field]=l.toRepo.metadata.idMetadata.getId(c)),h.fields){for(const y in h.fields)if(Object.prototype.hasOwnProperty.call(h.fields,y)){const p=h.fields[y];this.instance[p]=c==null?null:c[y]}}},enumerable:!(s!=null&&s.has(a.key))}),u&&(t[a.key]=d)}}}get error(){var e;return(e=this._subscribers)==null||e.reportObserved(),this._error}set error(e){var t;this._error=e,(t=this._subscribers)==null||t.reportChanged()}subscribe(e){return this.initSubscribers(),this._subscribers.subscribe(e)}initSubscribers(){if(!this._subscribers){this._subscribers=new Ct;const e=this._subscribers;for(const t of this.fieldsMetadata){let r=Oe(t.valueType,!1),n=this.fields.find(t.key);if(n._subscribers=new Ct,!(r&&this.remult||ne(t))){let s=this.instance[t.key];Object.defineProperty(this.instance,t.key,{get:()=>(e.reportObserved(),n._subscribers.reportObserved(),s),set:a=>{s=a,e.reportChanged(),n._subscribers.reportChanged()},enumerable:!0})}}}}get isLoading(){var e;return(e=this._subscribers)==null||e.reportObserved(),this._isLoading}set isLoading(e){var t;this._isLoading=e,(t=this._subscribers)==null||t.reportChanged()}async waitLoad(){await ft([...this.lookups.values()],e=>e.waitLoad())}__assertValidity(){if(!this.hasErrors())throw this.buildErrorInfoObject()}buildErrorInfoObject(){var t;let e={modelState:Object.assign({},this.errors),message:this.error};if(!e.message){for(const r of this.fieldsMetadata)if((t=this.errors)!=null&&t[r.key]){e.message=this.fields[r.key].metadata.label+": "+this.errors[r.key],this.error=e.message;break}}return new an(e)}catchSaveErrors(e){let t=e;if(t instanceof Promise)return t.then(n=>this.catchSaveErrors(n));t.error&&(t=t.error),t.message?this.error=t.message:t.Message?this.error=t.Message:this.error=t;let r=t.modelState;throw r||(r=t.ModelState),r&&(this.errors=r),e}__clearErrorsAndReportChanged(){this.errors=void 0,this.error=void 0,this._reportChangedToEntityAndFields()}_reportChangedToEntityAndFields(){if(this._subscribers){this._subscribers.reportChanged();for(const e of this.fields)e._subscribers.reportChanged()}}hasErrors(){var e;return(e=this._subscribers)==null||e.reportObserved(),!this.error&&this.errors==null}copyDataToObject(e=!1){let t={};for(const r of this.fieldsMetadata){let n=this.lookups.get(r.key),s;const a=ne(r);n?s=n.id:s=this.instance[r.key],a&&e&&!r.allowNull&&s==null&&(a.toRepo.metadata.idMetadata.field.valueType===Number?s=0:s=""),(!a||a.type==="reference")&&(s!==void 0&&(s=r.valueConverter.toJson(s),s!=null&&(s=r.valueConverter.fromJson(JSON.parse(JSON.stringify(s))))),t[r.key]=s)}return t}saveOriginalData(){this.originalValues=this.copyDataToObject(),this.saveMoreOriginalData()}saveMoreOriginalData(){}async validate(){if(this.__clearErrorsAndReportChanged(),await this.__performColumnAndEntityValidations(),this.hasErrors(),!this.hasErrors())return this.buildErrorInfoObject()}async __validateEntity(){this.__clearErrorsAndReportChanged(),await this.__performColumnAndEntityValidations(),this.__assertValidity()}async __performColumnAndEntityValidations(){}toApiJson(e=!1,t=!1){let r={};for(const n of this.fieldsMetadata)if(t||!this.remult||n.includedInApi(this.instance)){let s,a=this.lookups.get(n.key),o=!1;a?e?(s=a.toJson(),o=!0,r[n.key]=s):s=a.id:ne(n)&&!e?o=!0:(s=this.instance[n.key],this.remult||s&&Oe(s.constructor,!1)&&(s=ie(s).getId())),o||(r[n.key]=n.valueConverter.toJson(s))}return r}async _updateEntityBasedOnApi(e,t=!1){let r=Object.keys(e);for(const n of this.fieldsMetadata)if(r.includes(n.key)&&n.includedInApi(this.instance)&&(!this.remult||t||n.apiUpdateAllowed(this.instance))){let s=this.lookups.get(n.key);s?s.id=e[n.key]:this.instance[n.key]=n.valueConverter.fromJson(e[n.key])}await ft([...this.fields].filter(n=>!ne(n.metadata)),n=>n.load())}}class xt extends dn{constructor(t,r,n,s,a,o,l){super(t.fieldsMetadata,r,a,o,l);f(this,"info");f(this,"repo");f(this,"edp");f(this,"_isNew");f(this,"repository");f(this,"metadata");f(this,"_wasDeleted",!1);f(this,"_columns");f(this,"_saving",!1);f(this,"id");f(this,"originalId");if(this.info=t,this.repo=n,this.edp=s,this._isNew=o,this.repository=n,this.metadata=t,o)for(const u of t.fieldsMetadata){const d=u.key;u.options.defaultValue&&r[d]===void 0&&(typeof u.options.defaultValue=="function"?r[d]=u.options.defaultValue(r):r[d]||(r[d]=u.options.defaultValue))}this.info.entityInfo.entityRefInit&&this.info.entityInfo.entityRefInit(this,r),De.entityRefInit&&De.entityRefInit(this,r)}clone(){const t=this.toApiJson(!0,!0);return this.repo.fromJson(t,this.isNew())}get relations(){return this.repo.relations(this.instance)}get apiUpdateAllowed(){return this.remult.isAllowedForInstance(this.instance,this.metadata.options.allowApiUpdate)}get apiDeleteAllowed(){return this.remult.isAllowedForInstance(this.instance,this.metadata.options.allowApiDelete)}get apiInsertAllowed(){return this.remult.isAllowedForInstance(this.instance,this.metadata.options.allowApiInsert)}getId(){const t=r=>{let n=this.lookups.get(r.key);return n?n.id:this.instance[r.key]};return this.metadata.idMetadata.field instanceof Ye?this.metadata.idMetadata.field.getId(t):t(this.metadata.idMetadata.field)}saveMoreOriginalData(){this.originalId=this.getId()}wasDeleted(){var t;return(t=this._subscribers)==null||t.reportObserved(),this._wasDeleted}undoChanges(){this.loadDataFrom(this.originalValues),this.__clearErrorsAndReportChanged()}async reload(){return await this.edp.find({where:await this.getIdFilter()}).then(async t=>{if(t.length===0)throw this.repo._notFoundError(this.id);await this.loadDataFrom(t[0]),this.saveOriginalData()}),this._reportChangedToEntityAndFields(),this.instance}get fields(){if(!this._columns){let t=[],r={find:n=>r[typeof n=="string"?n:n.key],[Symbol.iterator]:()=>t[Symbol.iterator](),toArray:()=>t};for(const n of this.info.fieldsMetadata)t.push(r[n.key]=new Xt(n.options,n,this.instance,this,this));this._columns=r}return this._columns}async save(t){var r,n;try{if(this._saving)throw new Error("cannot save while entity is already saving");if(this._saving=!0,this.wasDeleted())throw new Error("cannot save a deleted row");this.isLoading=!0,t===void 0&&await this.__validateEntity();let s=!1,a=this.buildLifeCycleEvent(()=>s=!0);if(!this.repo._dataProvider.isProxy){for(const c of this.fields)c.metadata.options.saving&&await c.metadata.options.saving(this.instance,c,a);this.info.entityInfo.saving&&await this.info.entityInfo.saving(this.instance,a)}this.__assertValidity();let o=this.copyDataToObject(this.isNew()),l=[];for(const c of this.metadata.fields)if(c.dbReadOnly||t!==void 0&&!t.includes(c.key)){o[c.key]=void 0,l.push(c.key);let h=this.fields.find(c);h.value=h.originalValue}let u,d=this.isNew();try{if((r=this._subscribers)==null||r.reportChanged(),this.isNew())s?u=(u=await this.edp.find({where:await this.getIdFilter()}))[0]:u=await this.edp.insert(o);else{let c={},h=!1;for(const y in o)if(Object.prototype.hasOwnProperty.call(o,y)){const p=o[y];this.fields.find(y).valueChanged()&&!l.includes(y)&&p!==void 0&&(c[y]=p,h=!0)}if(!h)return this.instance;if(s)u=(await this.edp.find({where:await this.getIdFilter()}))[0];else{if(this.id===void 0)throw new Error("Invalid operation, id is undefined");u=await this.edp.update(this.id,c)}}if(u&&await this.loadDataFrom(u),a.id=this.getId(),!this.repo._dataProvider.isProxy&&(this.info.entityInfo.saved&&await this.info.entityInfo.saved(this.instance,a),this.repo.listeners))for(const c of this.repo.listeners)await((n=c.saved)==null?void 0:n.call(c,this.instance,d));return this.repo._remult.liveQueryPublisher.itemChanged(this.repo.metadata.key,[{id:this.getId(),oldId:this.getOriginalId(),deleted:!1}]),this.saveOriginalData(),this._isNew=!1,this.instance}catch(c){throw await this.catchSaveErrors(c)}}finally{this.isLoading=!1,this._reportChangedToEntityAndFields(),this._saving=!1}}async processInsertResponseDto(t){return await this.loadDataFrom(t),this.saveOriginalData(),this._isNew=!1,this.instance}async buildDtoForInsert(){await this.__validateEntity(),this.__assertValidity();let t=this.copyDataToObject(this.isNew());for(const r of this.metadata.fields)if(r.dbReadOnly){t[r.key]=void 0;let n=this.fields.find(r);n.value=n.originalValue}return t}buildLifeCycleEvent(t=()=>{}){const r=this;return{isNew:r.isNew(),fields:r.fields,id:r.getId(),originalId:r.getOriginalId(),metadata:r.repo.metadata,repository:r.repo,preventDefault:()=>t(),relations:r.repo.relations(r.instance)}}async getIdFilter(){return await this.repo._translateWhereToFilter(this.repo.metadata.idMetadata.getIdFilter(this.id))}async delete(){var n;this.__clearErrorsAndReportChanged();let t=!0,r=this.buildLifeCycleEvent(()=>t=!1);this.repo._dataProvider.isProxy||this.info.entityInfo.deleting&&await this.info.entityInfo.deleting(this.instance,r),this.__assertValidity();try{if(t){if(this.id===void 0)throw new Error("Invalid operation, id is undefined");await this.edp.delete(this.id)}if(this.repo._dataProvider.isProxy||this.info.entityInfo.deleted&&await this.info.entityInfo.deleted(this.instance,r),this.repo.listeners)for(const s of this.repo.listeners)await((n=s.deleted)==null?void 0:n.call(s,this.instance));this.repo._remult.liveQueryPublisher.itemChanged(this.repo.metadata.key,[{id:this.getId(),oldId:this.getOriginalId(),deleted:!0}]),this._wasDeleted=!0}catch(s){throw await this.catchSaveErrors(s)}}async loadDataFrom(t,r){for(const n of this.info.fields){let s=this.lookups.get(n.key);s?(s.id=t[n.key],r===void 0?!n.options.lazy&&!ne(n)&&await s.waitLoad():r.includes(n)&&await s.waitLoad()):ne(n)||(t[n.key]===void 0?delete this.instance[n.key]:this.instance[n.key]=t[n.key])}await this.calcServerExpression(),this.id=this.getId()}getOriginalId(){return this.originalId}async calcServerExpression(){if(!this.repo._dataProvider.isProxy){for(const t of this.info.fieldsMetadata)if(t.options.serverExpression){const r=await t.options.serverExpression(this.instance);r!==void 0&&(this.instance[t.key]=r)}}}isNew(){var t;return(t=this._subscribers)==null||t.reportObserved(),this._isNew}wasChanged(){var t;(t=this._subscribers)==null||t.reportObserved();for(const r of this.fields){const n=ne(r.metadata);if((!n||n.type=="reference")&&r.valueChanged())return!0}return!1}async __performColumnAndEntityValidations(){var t;for(const r of this.fieldsMetadata)r.options.validate&&await new Xt(r.options,r,this.instance,this,this).__performValidation();if(this.info.entityInfo.validation){let r=this.buildLifeCycleEvent(()=>{});await this.info.entityInfo.validation(this.instance,r)}if(this.repo.listeners)for(const r of this.repo.listeners)await((t=r.validating)==null?void 0:t.call(r,this.instance))}}const gi=Symbol.for("controllerColumns");function cn(i,e){return i.map(t=>Vr(t.settings(e),e))}function wi(i,e){const t=e||be;let r=i[gi];if(r||(r=i[Xe]),!r){let n=D.columnsOfType.get(i.constructor);n||D.columnsOfType.set(i.constructor,n=[]);let s=Object.getPrototypeOf(i.constructor);for(;s!=null;){let a=D.columnsOfType.get(s);a&&n.unshift(...a.filter(o=>!n.find(l=>l.key==o.key))),s=Object.getPrototypeOf(s)}i[gi]=r=new Fa(cn(n,t).map(a=>new yn(a,void 0,t)),i,t)}return r}class Fa extends dn{constructor(t,r,n){super(t,r,n,!1);f(this,"fields");let s=[],a={find:o=>a[typeof o=="string"?o:o.key],[Symbol.iterator]:()=>s[Symbol.iterator](),toArray:()=>s};for(const o of t)s.push(a[o.key]=new Xt(o.options,o,r,void 0,this));this.fields=a}async __performColumnAndEntityValidations(){for(const t of this.fields)t instanceof Xt&&await t.__performValidation()}}class Xt{constructor(e,t,r,n,s){f(this,"settings");f(this,"metadata");f(this,"container");f(this,"helper");f(this,"rowBase");f(this,"_subscribers");f(this,"target");f(this,"entityRef");this.settings=e,this.metadata=t,this.container=r,this.helper=n,this.rowBase=s,this.target=this.settings.target,this.entityRef=this.helper}subscribe(e){return this._subscribers||this.rowBase.initSubscribers(),this._subscribers.subscribe(e)}valueIsNull(){this.reportObserved();let e=this.rowBase.lookups.get(this.metadata.key);return e?e.id===void 0||e.id===null:this.value===null}originalValueIsNull(){return this.reportObserved(),this.rowBase.lookups.get(this.metadata.key),this.rawOriginalValue()===null}get key(){return this.metadata.key}get repo(){var e;return(e=this.helper)==null?void 0:e.repository}async load(){let e=this.rowBase.lookups.get(this.metadata.key),t=ne(this.metadata);if(t&&this.helper){if(t.type==="toMany")return this.container[this.metadata.key]=await this.repo.relations(this.container)[this.key].find();{let r=await this.repo.relations(this.container)[this.metadata.key].findOne();if(r)this.container[this.metadata.key]=r;else return null}}else if(e)return this.valueChanged()&&await e.waitLoadOf(this.rawOriginalValue()),await e.waitLoad();return this.value}reportObserved(){var e,t;(e=this._subscribers)==null||e.reportObserved(),(t=this.rowBase._subscribers)==null||t.reportObserved()}reportChanged(){var e,t;(e=this._subscribers)==null||e.reportChanged(),(t=this.rowBase._subscribers)==null||t.reportChanged()}get error(){if(this.reportObserved(),!!this.rowBase.errors)return this.rowBase.errors[this.metadata.key]}set error(e){this.rowBase.errors||(this.rowBase.errors={}),this.rowBase.errors[this.metadata.key]=e,this.reportChanged()}get displayValue(){return this.reportObserved(),this.value!=null?this.settings.displayValue?this.settings.displayValue(this.container,this.value):this.metadata.valueConverter.displayValue?this.metadata.valueConverter.displayValue(this.value):this.value.toString():""}get value(){return this.container[this.metadata.key]}set value(e){this.container[this.metadata.key]=e}get originalValue(){this.reportObserved();let e=this.rowBase.lookups.get(this.metadata.key);return e?e.get(this.rawOriginalValue()):this.rowBase.originalValues[this.metadata.key]}rawOriginalValue(){return this.rowBase.originalValues[this.metadata.key]}setId(e){this.value=e}getId(){let e=this.rowBase.lookups.get(this.metadata.key);return e?e.id!=null?e.id:null:this.value}get inputValue(){this.reportObserved();let e=this.rowBase.lookups.get(this.metadata.key);return e?e.id!=null?e.id.toString():null:this.metadata.valueConverter.toInput(this.value,this.settings.inputType)}set inputValue(e){let t=this.rowBase.lookups.get(this.metadata.key);t?t.setId(e):this.value=this.metadata.valueConverter.fromInput(e,this.settings.inputType)}valueChanged(){this.reportObserved();let e=this.value,t=this.rowBase.lookups.get(this.metadata.key);return t&&(e=t.id),JSON.stringify(this.metadata.valueConverter.toJson(this.rowBase.originalValues[this.metadata.key]))!=JSON.stringify(this.metadata.valueConverter.toJson(e))}async __performValidation(){var e;try{const t=r=>{r!==!0&&r!==void 0&&!this.error&&(typeof r=="string"&&r.length>0?this.error=r:this.error="invalid value")};if(this.settings.validate){let r=this,n={entityRef:this.entityRef,get error(){return r.error},set error(s){r.error=s},isNew:((e=this.entityRef)==null?void 0:e.isNew())??!1,load:()=>r.load(),metadata:r.metadata,originalValue:r.originalValue,value:r.value,valueChanged:()=>r.valueChanged(),originalValueIsNull:()=>r.originalValueIsNull(),valueIsNull:()=>r.valueIsNull(),isBackend:()=>{var s,a,o;return!((o=(a=(s=r.rowBase)==null?void 0:s.remult)==null?void 0:a.dataProvider)!=null&&o.isProxy)}};if(Array.isArray(this.settings.validate))for(const s of this.settings.validate)t(await s(this.container,n));else typeof this.settings.validate=="function"&&t(await this.settings.validate(this.container,n))}}catch(t){typeof t=="string"?this.error=t:this.error=t==null?void 0:t.message}}async validate(){return await this.__performValidation(),!this.error}}let Pa={transformLabel:(i,e,t,r)=>t,set transformCaption(i){this.transformLabel=i}};const Cr=D.fieldOptionsEnricher||{enrichFieldOptions:i=>i},Ra=D.labelTransformer||(D.labelTransformer=Pa);function hn(i,e,t,r){let n;return typeof i=="function"?t&&(n=i(t)):i&&(n=i),n=Ra.transformLabel(t,e,n??"",r),n||(e?sn(e):"")}class yn{constructor(e,t,r){f(this,"settings");f(this,"entityDefs");f(this,"remult");f(this,"options");f(this,"target");f(this,"readonly",!1);f(this,"valueConverter");f(this,"allowNull");f(this,"label");f(this,"dbName");f(this,"inputType");f(this,"key");f(this,"isServerExpression",!1);f(this,"valueType");this.settings=e,this.entityDefs=t,this.remult=r,this.options=this.settings,this.target=this.settings.target,this.valueConverter=new Proxy(this.settings.valueConverter??{},{get:(n,s)=>{let a=n[s];return typeof a=="function"?(...o)=>{try{return n[s](...o)}catch(l){const u=`${String(s)} failed for value ${o==null?void 0:o[0]}. Error: ${typeof l=="string"?l:l.message}`;throw new an({message:this.label+": "+u,modelState:{[this.key]:u}})}}:a}}),this.allowNull=!!this.settings.allowNull,this.valueType=this.settings.valueType,this.key=this.settings.key,this.inputType=this.settings.inputType,e.serverExpression&&(this.isServerExpression=!0),typeof this.settings.allowApiUpdate=="boolean"&&(this.readonly=this.settings.allowApiUpdate),this.inputType||(this.inputType=this.valueConverter.inputType),this.dbName=e.dbName,this.dbName==null&&(this.dbName=e.key),this.label=hn(e.label??e.caption,e.key,r,t)}apiUpdateAllowed(e){return this.options.allowApiUpdate===void 0?!0:this.remult.isAllowedForInstance(e,this.options.allowApiUpdate)}displayValue(e){return this.entityDefs.getEntityMetadataWithoutBreakingTheEntity(e).fields.find(this.key).displayValue}includedInApi(e){return this.options.includeInApi===void 0?!0:this.remult.isAllowedForInstance(e,this.options.includeInApi)}toInput(e,t){return this.valueConverter.toInput(e,t)}fromInput(e,t){return this.valueConverter.fromInput(e,t)}async getDbName(){return jr(this,this.entityDefs)}get caption(){return this.label}get dbReadOnly(){return!!this.settings.dbReadOnly}}class Da{constructor(e,t,r,n,s){f(this,"entityInfo");f(this,"remult");f(this,"entityType");f(this,"key");f(this,"options");f(this,"fieldsMetadata",[]);f(this,"idMetadata",{getId:e=>{if(e==null)return e;const t=ie(e,!1);return t?t.getId():this.idMetadata.field instanceof Ye?this.idMetadata.field.getId(e):e[this.idMetadata.field.key]},field:void 0,get fields(){return this.field instanceof Ye?this.field.fields:[this.field]},createIdInFilter:e=>e.length>0?{$or:e.map(t=>this.idMetadata.getIdFilter(ie(t).getId()))}:{[this.fields.toArray()[0].key]:[]},isIdField:e=>e.key==this.idMetadata.field.key,getIdFilter:(...e)=>{if(this.idMetadata.field instanceof Ye){let t=this.idMetadata.field;return e.length==1?t.isEqualTo(e[0]):{$or:e.map(r=>t.isEqualTo(r))}}return e.length==1?{[this.idMetadata.field.key]:e[0]}:{[this.idMetadata.field.key]:e}}});f(this,"fields");f(this,"dbName");f(this,"label");if(this.entityInfo=t,this.remult=r,this.entityType=n,this.key=s,this.options=t,this.options.allowApiCrud!==void 0){let o;typeof this.options.allowApiCrud=="function"?o=(l,u)=>this.options.allowApiCrud(u):o=this.options.allowApiCrud,this.options.allowApiDelete===void 0&&(this.entityInfo.allowApiDelete=o),this.options.allowApiInsert===void 0&&(this.entityInfo.allowApiInsert=o),this.options.allowApiUpdate===void 0&&(this.entityInfo.allowApiUpdate=o),this.options.allowApiRead===void 0&&(this.options.allowApiRead=this.options.allowApiCrud)}this.options.allowApiRead===void 0&&(this.options.allowApiRead=!0),this.key||(this.key=n.name),t.dbName||(t.dbName=this.key),this.dbName=t.dbName;let a={find:o=>a[typeof o=="string"?o:o.key],[Symbol.iterator]:()=>this.fieldsMetadata[Symbol.iterator](),toArray:()=>this.fieldsMetadata};for(const o of e)this.fieldsMetadata.push(a[o.key]=new yn(o,this,r));if(this.fields=a,this.label=hn(t.label??t.caption,this.key,r,this),t.id){let o=typeof t.id=="string"?this.fields.find(t.id):Array.isArray(t.id)?t.id.map(l=>this.fields.find(l)):typeof t.id=="function"?t.id(this.fields):Object.keys(t.id).map(l=>this.fields.find(l));Array.isArray(o)?o.length>1?this.idMetadata.field=new Ye(...o):o.length==1&&(this.idMetadata.field=o[0]):this.idMetadata.field=o}if(!this.idMetadata.field){const o=this.fields.id;o?this.idMetadata.field=o:this.idMetadata.field=[...this.fields][0]}}apiUpdateAllowed(e){return this.options.allowApiUpdate===void 0?!1:e?this.getEntityMetadataWithoutBreakingTheEntity(e).apiUpdateAllowed:this.remult.isAllowedForInstance(void 0,this.options.allowApiUpdate)}get apiReadAllowed(){return this.options.allowApiRead===void 0?!0:this.remult.isAllowed(this.options.allowApiRead)}apiDeleteAllowed(e){return this.options.allowApiDelete===void 0?!1:e?this.getEntityMetadataWithoutBreakingTheEntity(e).apiDeleteAllowed:this.remult.isAllowedForInstance(void 0,this.options.allowApiDelete)}apiInsertAllowed(e){return this.options.allowApiUpdate===void 0?!1:e?this.getEntityMetadataWithoutBreakingTheEntity(e).apiInsertAllowed:this.remult.isAllowedForInstance(void 0,this.options.allowApiInsert)}getEntityMetadataWithoutBreakingTheEntity(e){let t=ie(e,!1);return t||this.remult.repo(this.entityType).getEntityRef({...e})}getDbName(){return fn(this)}get caption(){return this.label}}function Ma(...i){return(e,t)=>(i||(i=[]),i.splice(0,0,{valueType:e}),e[Ur]=i,e)}function Na(i){var e,t;return((t=(e=i.options)==null?void 0:e.valueConverter)==null?void 0:t.fieldTypeInDb)==="autoincrement"}function La(...i){return(e,t)=>{Ma(r=>{r.valueConverter=Yt.get(e),r.displayValue=(n,s)=>(s==null?void 0:s.label)??(s==null?void 0:s.caption),r.validate=(n,s)=>{const a=Yt.get(e).getValues();return s.value&&!a.find(o=>o===s.value)&&(s.value=a.find(o=>o.id===s.value.id)||s.value),Fe.in(a)(n,s)}},...i)(e)}}class Yt{constructor(e){f(this,"valueListType");f(this,"byIdMap",new Map);f(this,"values",[]);f(this,"isNumeric",!1);f(this,"fieldTypeInDb");f(this,"inputType");this.valueListType=e;for(let r in this.valueListType){let n=this.valueListType[r];n instanceof this.valueListType&&(n.id===void 0&&(n.id=r),typeof n.id=="number"&&(this.isNumeric=!0),bi(n,r),this.byIdMap.set(n.id,n),this.values.push(n))}this.isNumeric&&(this.fieldTypeInDb="integer");var t=this.valueListType[Ur];if(t){for(const r of t)r!=null&&r.getValues&&(this.values.splice(0,this.values.length,...r.getValues()),this.byIdMap.clear(),this.values.forEach(n=>{bi(n,""),this.byIdMap.set(n.id,n)}));if(this.values.find(r=>r.id===void 0))throw new Error(`ValueType ${this.valueListType} has values without an id`)}else throw new Error("ValueType not yet initialized, did you forget to call @ValueListFieldType on "+e)}static get(e){let t=vi.get(e);return t||(t=new Yt(e),vi.set(e,t)),t}getValues(){return this.values}byId(e){return this.isNumeric&&(e=+e),this.byIdMap.get(e)}fromJson(e){return this.byId(e)}toJson(e){if(e)return e.id}fromDb(e){return this.fromJson(e)}toDb(e){return this.toJson(e)}toInput(e,t){return this.toJson(e)}fromInput(e,t){return this.fromJson(e)}displayValue(e){return e?e.caption:""}}const vi=new Map;function bi(i,e){let t=i.label??i.caption;t===void 0&&(t=sn(i.id!==void 0?i.id.toString():e)),i.label===void 0&&(i.label=t),i.caption===void 0&&(i.caption=t)}const Ur=Symbol.for("storableMember"),Ar=Symbol.for("fieldOptionalValues");function pn(i,e){var r;let t={};for(const n of i)if(n)if(typeof n=="function")n(t,e);else{const{validate:s,...a}=n;t.validate=Wt(t.validate,s),Object.assign(t,a)}return(r=Cr.enrichFieldOptions)==null||r.call(Cr,t),t}function Vr(i,e){if(i.valueType){let n=i.valueType[Ur];n&&(i=pn([...n,i],e))}if(i.valueType==String){let n=i;i.valueConverter||(n.valueConverter=ve.String)}if(i.valueType==Number){let n=i;i.valueConverter||(n.valueConverter=ve.Number)}if(i.valueType==Date){let n=i;i.valueConverter||(n.valueConverter=ve.Date)}if(i.valueType==Boolean){let n=i;n.valueConverter||(n.valueConverter=ve.Boolean)}if(!i.valueConverter){if(Oe(i.valueType,!1)){let s;i.valueConverter={toDb:a=>a,fromDb:a=>a},i.valueConverter=new Proxy(i.valueConverter,{get(a,o){if(a[o]===void 0&&s===void 0){if(o==="inputType")return"";s=e.repo(i.valueType).metadata.idMetadata.field.valueType===Number;for(const l of["fieldTypeInDb","toJson","fromJson","toDb","fromDb"])a[l]=s?ve.Integer[l]:ve.String[l]}return a[o]},set(a,o,l,u){return a[o]=l,!0}})}else i.valueConverter=ve.Default;return i}i.valueConverter.toJson||(i.valueConverter.toJson=n=>n),i.valueConverter.fromJson||(i.valueConverter.fromJson=n=>n);const t=i.valueConverter.fromJson,r=i.valueConverter.toJson;return i.valueConverter.toDb||(i.valueConverter.toDb=n=>r(n)),i.valueConverter.fromDb||(i.valueConverter.fromDb=n=>t(n)),i.valueConverter.toInput||(i.valueConverter.toInput=n=>r(n)),i.valueConverter.fromInput||(i.valueConverter.fromInput=n=>t(n)),i}class mn{get _(){return ie(this)}save(){return ie(this).save()}assign(e){return At(this,e),this}delete(){return this._.delete()}isNew(){return this._.isNew()}get $(){return this._.fields}}function $a(i){return i.metadata?i.metadata:Oe(i,!1)?be.repo(i).metadata:i}function qa(i){return Oe(i,!1)?be.repo(i):i}async function ft(i,e){const t=[];for(let r=0;r<i.length;r++){const n=i[r];t.push(await e(n,r))}return t}const dt=class dt{constructor(e){f(this,"sql");f(this,"wrapIdentifier",e=>e);f(this,"provideMigrationBuilder");f(this,"createdEntities",[]);f(this,"end");this.sql=e,e.wrapIdentifier&&(this.wrapIdentifier=t=>e.wrapIdentifier(t)),ct(e,"provideMigrationBuilder")&&(this.provideMigrationBuilder=t=>e.provideMigrationBuilder(t)),ct(e,"end")&&(this.end=()=>e.end())}static getDb(e){const t=e||be.dataProvider;if(ct(t,"createCommand"))return t;throw"the data provider is not an SqlCommandFactory"}createCommand(){return new Ba(this.sql.createCommand(),dt.LogToConsole)}async execute(e){return await this.createCommand().execute(e)}_getSourceSql(){return this.sql}async ensureSchema(e){this.sql.ensureSchema&&await this.sql.ensureSchema(e)}getEntityDataProvider(e){if(!this.sql.supportsJsonColumnType)for(const t of e.fields.toArray())t.valueConverter.fieldTypeInDb==="json"&&(t.valueConverter={...t.valueConverter,toDb:ve.JsonString.toDb,fromDb:ve.JsonString.fromDb});return new gn(e,this,async t=>{this.createdEntities.indexOf(t.$entityName)<0&&(this.createdEntities.push(t.$entityName),await this.sql.entityIsUsedForTheFirstTime(e))},this.sql)}transaction(e){return this.sql.transaction(async t=>{let r=!1;try{await e(new dt({createCommand:()=>{let n=t.createCommand();return{addParameterAndReturnSqlToken:s=>n.param(s),param:s=>n.param(s),execute:async s=>{if(r)throw"can't run a command after the transaction was completed";return n.execute(s)}}},getLimitSqlSyntax:this.sql.getLimitSqlSyntax,entityIsUsedForTheFirstTime:n=>t.entityIsUsedForTheFirstTime(n),transaction:n=>t.transaction(n),supportsJsonColumnType:this.sql.supportsJsonColumnType,wrapIdentifier:this.wrapIdentifier,end:this.end,doesNotSupportReturningSyntax:this.sql.doesNotSupportReturningSyntax,doesNotSupportReturningSyntaxOnlyForUpdate:this.sql.doesNotSupportReturningSyntaxOnlyForUpdate,orderByNullsFirst:this.sql.orderByNullsFirst}))}finally{r=!0}})}static rawFilter(e){return{[tn]:{buildSql:e}}}static async filterToRaw(e,t,r,n,s){r||(r=new ja);const a=qa(e);var o=new Ue(r,n||await wn(a.metadata,s));return o._addWhere=!1,await(await et(a)._translateWhereToFilter(t)).__applyToConsumer(o),await o.resolveWhere()}};f(dt,"LogToConsole",!1),f(dt,"durationThreshold",0);let yt=dt;const xa=new Map([["INSERT","⚪"],["SELECT","🔵"],["UPDATE","🟣"],["DELETE","🟤"],["CREATE","🟩"],["ALTER","🟨"],["DROP","🟥"],["TRUNCATE","⬛"],["GRANT","🟪"],["REVOKE","🟫"]]);class Ba{constructor(e,t){f(this,"origin");f(this,"logToConsole");f(this,"args",{});this.origin=e,this.logToConsole=t}addParameterAndReturnSqlToken(e){return this.param(e)}param(e,t){let r=this.origin.param(e);return this.args[r]=e,r}async execute(e){try{let r=new Date,n=await this.origin.execute(e);if(this.logToConsole!==!1){var t=new Date().valueOf()-r.valueOf();if(t>=yt.durationThreshold){const s=t/1e3;if(this.logToConsole==="oneLiner"){const a=e.replace(/(\r\n|\n|\r|\t)/gm," ").replace(/ +/g," ").trim(),o=a.split(" ")[0].toUpperCase();console.info(`${xa.get(o)||"💢"} (${s.toFixed(3)}) ${a} ${JSON.stringify(this.args)}`)}else typeof this.logToConsole=="function"?this.logToConsole(s,e,this.args):console.info(e+`
|
|
3
3
|
`,{arguments:this.args,duration:s})}}return n}catch(r){throw console.error((r.message||"Sql Error")+`:
|
|
4
4
|
`,e,{arguments:this.args,error:r}),r}}}class gn{constructor(e,t,r,n){f(this,"entity");f(this,"sql");f(this,"iAmUsed");f(this,"strategy");this.entity=e,this.sql=t,this.iAmUsed=r,this.strategy=n}async init(){let e=await wn(this.entity,t=>this.sql.wrapIdentifier(t));return await this.iAmUsed(e),e}async count(e){let t=await this.init(),r="select count(*) count from "+t.$entityName,n=this.sql.createCommand();if(e){let s=new Ue(n,t);e.__applyToConsumer(s),r+=await s.resolveWhere()}return n.execute(r).then(s=>Number(s.rows[0].count))}async groupBy(e){return await Ja(e,await this.init(),this.sql.createCommand(),this.sql._getSourceSql().orderByNullsFirst,this.sql._getSourceSql().getLimitSqlSyntax)}async find(e){let t=await this.init(),{colKeys:r,select:n}=this.buildSelect(t);n="select "+n,n+=`
|
|
@@ -17,4 +17,4 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
|
17
17
|
|
|
18
18
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
19
19
|
and limitations under the License.
|
|
20
|
-
***************************************************************************** */var Di;function Za(){if(Di)return Ri;Di=1;var i;return function(e){(function(t){var r=typeof Zt=="object"?Zt:typeof self=="object"?self:typeof this=="object"?this:Function("return this;")(),n=s(e);typeof r.Reflect>"u"?r.Reflect=e:n=s(r.Reflect,n),t(n);function s(a,o){return function(l,u){typeof a[l]!="function"&&Object.defineProperty(a,l,{configurable:!0,writable:!0,value:u}),o&&o(l,u)}}})(function(t){var r=Object.prototype.hasOwnProperty,n=typeof Symbol=="function",s=n&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",a=n&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",o=typeof Object.create=="function",l={__proto__:[]}instanceof Array,u=!o&&!l,d={create:o?function(){return dr(Object.create(null))}:l?function(){return dr({__proto__:null})}:function(){return dr({})},has:u?function(m,_){return r.call(m,_)}:function(m,_){return _ in m},get:u?function(m,_){return r.call(m,_)?m[_]:void 0}:function(m,_){return m[_]}},c=Object.getPrototypeOf(Function),h=typeof process=="object"&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL==="true",y=!h&&typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:qn(),p=!h&&typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:xn(),b=!h&&typeof WeakMap=="function"?WeakMap:Bn(),w=new b;function P(m,_,A,R){if(se(A)){if(!Hr(m))throw new TypeError;if(!Gr(_))throw new TypeError;return I(m,_)}else{if(!Hr(m))throw new TypeError;if(!ge(_))throw new TypeError;if(!ge(R)&&!se(R)&&!st(R))throw new TypeError;return st(R)&&(R=void 0),A=je(A),v(m,_,A,R)}}t("decorate",P);function k(m,_){function A(R,B){if(!ge(R))throw new TypeError;if(!se(B)&&!Dn(B))throw new TypeError;fe(m,_,R,B)}return A}t("metadata",k);function M(m,_,A,R){if(!ge(A))throw new TypeError;return se(R)||(R=je(R)),fe(m,_,A,R)}t("defineMetadata",M);function T(m,_,A){if(!ge(_))throw new TypeError;return se(A)||(A=je(A)),$(m,_,A)}t("hasMetadata",T);function g(m,_,A){if(!ge(_))throw new TypeError;return se(A)||(A=je(A)),x(m,_,A)}t("hasOwnMetadata",g);function O(m,_,A){if(!ge(_))throw new TypeError;return se(A)||(A=je(A)),ee(m,_,A)}t("getMetadata",O);function F(m,_,A){if(!ge(_))throw new TypeError;return se(A)||(A=je(A)),W(m,_,A)}t("getOwnMetadata",F);function N(m,_){if(!ge(m))throw new TypeError;return se(_)||(_=je(_)),He(m,_)}t("getMetadataKeys",N);function E(m,_){if(!ge(m))throw new TypeError;return se(_)||(_=je(_)),Be(m,_)}t("getOwnMetadataKeys",E);function C(m,_,A){if(!ge(_))throw new TypeError;se(A)||(A=je(A));var R=S(_,A,!1);if(se(R)||!R.delete(m))return!1;if(R.size>0)return!0;var B=w.get(_);return B.delete(A),B.size>0||w.delete(_),!0}t("deleteMetadata",C);function I(m,_){for(var A=m.length-1;A>=0;--A){var R=m[A],B=R(_);if(!se(B)&&!st(B)){if(!Gr(B))throw new TypeError;_=B}}return _}function v(m,_,A,R){for(var B=m.length-1;B>=0;--B){var he=m[B],J=he(_,A,R);if(!se(J)&&!st(J)){if(!ge(J))throw new TypeError;R=J}}return R}function S(m,_,A){var R=w.get(m);if(se(R)){if(!A)return;R=new y,w.set(m,R)}var B=R.get(_);if(se(B)){if(!A)return;B=new y,R.set(_,B)}return B}function $(m,_,A){var R=x(m,_,A);if(R)return!0;var B=fr(_);return st(B)?!1:$(m,B,A)}function x(m,_,A){var R=S(_,A,!1);return se(R)?!1:Pn(R.has(m))}function ee(m,_,A){var R=x(m,_,A);if(R)return W(m,_,A);var B=fr(_);if(!st(B))return ee(m,B,A)}function W(m,_,A){var R=S(_,A,!1);if(!se(R))return R.get(m)}function fe(m,_,A,R){var B=S(A,R,!0);B.set(m,_)}function He(m,_){var A=Be(m,_),R=fr(m);if(R===null)return A;var B=He(R,_);if(B.length<=0)return A;if(A.length<=0)return B;for(var he=new p,J=[],H=0,q=A;H<q.length;H++){var z=q[H],K=he.has(z);K||(he.add(z),J.push(z))}for(var Ge=0,zr=B;Ge<zr.length;Ge++){var z=zr[Ge],K=he.has(z);K||(he.add(z),J.push(z))}return J}function Be(m,_){var A=[],R=S(m,_,!1);if(se(R))return A;for(var B=R.keys(),he=Mn(B),J=0;;){var H=Ln(he);if(!H)return A.length=J,A;var q=Nn(H);try{A[J]=q}catch(z){try{$n(he)}finally{throw z}}J++}}function ur(m){if(m===null)return 1;switch(typeof m){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return m===null?1:6;default:return 6}}function se(m){return m===void 0}function st(m){return m===null}function Tn(m){return typeof m=="symbol"}function ge(m){return typeof m=="object"?m!==null:typeof m=="function"}function Sn(m,_){switch(ur(m)){case 0:return m;case 1:return m;case 2:return m;case 3:return m;case 4:return m;case 5:return m}var A="string",R=Qr(m,s);if(R!==void 0){var B=R.call(m,A);if(ge(B))throw new TypeError;return B}return Fn(m)}function Fn(m,_){var A,R,B;{var he=m.toString;if(Nt(he)){var R=he.call(m);if(!ge(R))return R}var A=m.valueOf;if(Nt(A)){var R=A.call(m);if(!ge(R))return R}}throw new TypeError}function Pn(m){return!!m}function Rn(m){return""+m}function je(m){var _=Sn(m);return Tn(_)?_:Rn(_)}function Hr(m){return Array.isArray?Array.isArray(m):m instanceof Object?m instanceof Array:Object.prototype.toString.call(m)==="[object Array]"}function Nt(m){return typeof m=="function"}function Gr(m){return typeof m=="function"}function Dn(m){switch(ur(m)){case 3:return!0;case 4:return!0;default:return!1}}function Qr(m,_){var A=m[_];if(A!=null){if(!Nt(A))throw new TypeError;return A}}function Mn(m){var _=Qr(m,a);if(!Nt(_))throw new TypeError;var A=_.call(m);if(!ge(A))throw new TypeError;return A}function Nn(m){return m.value}function Ln(m){var _=m.next();return _.done?!1:_}function $n(m){var _=m.return;_&&_.call(m)}function fr(m){var _=Object.getPrototypeOf(m);if(typeof m!="function"||m===c||_!==c)return _;var A=m.prototype,R=A&&Object.getPrototypeOf(A);if(R==null||R===Object.prototype)return _;var B=R.constructor;return typeof B!="function"||B===m?_:B}function qn(){var m={},_=[],A=function(){function J(H,q,z){this._index=0,this._keys=H,this._values=q,this._selector=z}return J.prototype["@@iterator"]=function(){return this},J.prototype[a]=function(){return this},J.prototype.next=function(){var H=this._index;if(H>=0&&H<this._keys.length){var q=this._selector(this._keys[H],this._values[H]);return H+1>=this._keys.length?(this._index=-1,this._keys=_,this._values=_):this._index++,{value:q,done:!1}}return{value:void 0,done:!0}},J.prototype.throw=function(H){throw this._index>=0&&(this._index=-1,this._keys=_,this._values=_),H},J.prototype.return=function(H){return this._index>=0&&(this._index=-1,this._keys=_,this._values=_),{value:H,done:!0}},J}();return function(){function J(){this._keys=[],this._values=[],this._cacheKey=m,this._cacheIndex=-2}return Object.defineProperty(J.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),J.prototype.has=function(H){return this._find(H,!1)>=0},J.prototype.get=function(H){var q=this._find(H,!1);return q>=0?this._values[q]:void 0},J.prototype.set=function(H,q){var z=this._find(H,!0);return this._values[z]=q,this},J.prototype.delete=function(H){var q=this._find(H,!1);if(q>=0){for(var z=this._keys.length,K=q+1;K<z;K++)this._keys[K-1]=this._keys[K],this._values[K-1]=this._values[K];return this._keys.length--,this._values.length--,H===this._cacheKey&&(this._cacheKey=m,this._cacheIndex=-2),!0}return!1},J.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=m,this._cacheIndex=-2},J.prototype.keys=function(){return new A(this._keys,this._values,R)},J.prototype.values=function(){return new A(this._keys,this._values,B)},J.prototype.entries=function(){return new A(this._keys,this._values,he)},J.prototype["@@iterator"]=function(){return this.entries()},J.prototype[a]=function(){return this.entries()},J.prototype._find=function(H,q){return this._cacheKey!==H&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=H)),this._cacheIndex<0&&q&&(this._cacheIndex=this._keys.length,this._keys.push(H),this._values.push(void 0)),this._cacheIndex},J}();function R(J,H){return J}function B(J,H){return H}function he(J,H){return[J,H]}}function xn(){return function(){function m(){this._map=new y}return Object.defineProperty(m.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),m.prototype.has=function(_){return this._map.has(_)},m.prototype.add=function(_){return this._map.set(_,_),this},m.prototype.delete=function(_){return this._map.delete(_)},m.prototype.clear=function(){this._map.clear()},m.prototype.keys=function(){return this._map.keys()},m.prototype.values=function(){return this._map.values()},m.prototype.entries=function(){return this._map.entries()},m.prototype["@@iterator"]=function(){return this.keys()},m.prototype[a]=function(){return this.keys()},m}()}function Bn(){var m=16,_=d.create(),A=R();return function(){function q(){this._key=R()}return q.prototype.has=function(z){var K=B(z,!1);return K!==void 0?d.has(K,this._key):!1},q.prototype.get=function(z){var K=B(z,!1);return K!==void 0?d.get(K,this._key):void 0},q.prototype.set=function(z,K){var Ge=B(z,!0);return Ge[this._key]=K,this},q.prototype.delete=function(z){var K=B(z,!1);return K!==void 0?delete K[this._key]:!1},q.prototype.clear=function(){this._key=R()},q}();function R(){var q;do q="@@WeakMap@@"+H();while(d.has(_,q));return _[q]=!0,q}function B(q,z){if(!r.call(q,A)){if(!z)return;Object.defineProperty(q,A,{value:d.create()})}return q[A]}function he(q,z){for(var K=0;K<z;++K)q[K]=Math.random()*255|0;return q}function J(q){return typeof Uint8Array=="function"?typeof crypto<"u"?crypto.getRandomValues(new Uint8Array(q)):typeof msCrypto<"u"?msCrypto.getRandomValues(new Uint8Array(q)):he(new Uint8Array(q),q):he(new Array(q),q)}function H(){var q=J(m);q[6]=q[6]&79|64,q[8]=q[8]&191|128;for(var z="",K=0;K<m;++K){var Ge=q[K];(K===4||K===6||K===8)&&(z+="-"),Ge<16&&(z+="0"),z+=Ge.toString(16).toLowerCase()}return z}}function dr(m){return m.__=void 0,delete m.__,m}})}(i||(i={})),Ri}Za();const tr=class tr{constructor(e,t,r){f(this,"actionUrl");f(this,"queue");f(this,"allowed");f(this,"doWork");this.actionUrl=e,this.queue=t,this.allowed=r}async run(e,t,r){t===void 0&&(t=be.apiClient.url),r||(r=ht(be.apiClient.httpClient));let n=await r.post(t+"/"+this.actionUrl,e),s=n;if(s&&s.queuedJobId){let a=D.actionInfo.startBusyWithProgress();try{let o;if(await D.actionInfo.runActionWithoutBlockingUI(async()=>{for(;!o||!o.done;)o&&await new Promise(l=>setTimeout(()=>{l(void 0)},200)),o=await r.post(t+"/"+tr.apiUrlForJobStatus,{queuedJobId:n.queuedJobId}),o.progress&&a.progress(o.progress)}),o.error)throw o.error;return a.progress(1),o.result}finally{a.close()}}else return n}__register(e){e(this.actionUrl,this.queue,this.allowed,async(t,r,n)=>{try{var s=await this.execute(t,r,n);n.success(s)}catch(a){a.isForbiddenError?n.forbidden():n.error(a,void 0)}})}};f(tr,"apiUrlForJobStatus","jobStatusInQueue");let Rt=tr;class Lr extends Error{constructor(t="Forbidden"){super(t);f(this,"isForbiddenError",!0)}}class eo extends Rt{constructor(t,r,n,s){super(t,n.queue??!1,n.allowed);f(this,"types");f(this,"options");f(this,"originalMethod");this.types=r,this.options=n,this.originalMethod=s}async execute(t,r,n){let s={data:{}},a=r.dataProvider;return await kn(r,this.options,async()=>{if(!r.isAllowedForInstance(void 0,this.options.allowed))throw new Lr;t.args=await On(this.types(),t.args,r,a,n);try{s.data=await this.originalMethod(t.args)}catch(o){throw o}}),s}}function qe(i){return(e,t,r)=>{const n=typeof t=="string"?t:t.name.toString(),s=r?r.value:e;let a=s;_n(e);function o(){var d=typeof Reflect.getMetadata=="function"?Reflect.getMetadata("design:paramtypes",e,n):[];return i.paramTypes&&(d=typeof i.paramTypes=="function"?i.paramTypes():i.paramTypes),d}if(e.prototype!==void 0){let d=new eo((i!=null&&i.apiPrefix?i.apiPrefix+"/":"")+n,()=>o(),i,c=>s.apply(void 0,c));return d.doWork=async(c,h,y,p)=>(c=Li(o(),c),i.blockUser===!1?await D.actionInfo.runActionWithoutBlockingUI(async()=>(await d.run({args:c},y,p)).data):(await d.run({args:c},y,p)).data),a=async function(...c){return Pt()?await s.apply(this,c):await d.doWork(c,void 0)},Mi(e,a),a[Nr]=d,r?(r.value=a,r):a}let l=D.classHelpers.get(e.constructor);l||(l=new un,D.classHelpers.set(e.constructor,l));let u={__register(d){let c=new De;for(const h of l.classes.keys()){let y=l.classes.get(h);y.key||(y.key=c.repo(h).metadata.key),d(y.key+"/"+(i!=null&&i.apiPrefix?i.apiPrefix+"/":"")+n,i?i.queue??!1:!1,i.allowed,async(p,b,w)=>{p.args=p.args.map(k=>In(k)?void 0:k);let P=i.allowed;try{let k=b,M;await kn(k,i,async()=>{if(p.args=await On(o(),p.args,k,k.dataProvider,w),D.allEntities.includes(h)){let T=k.repo(h),g;const O=p.rowInfo;if(O.isNewRow)g=T.create(),await T.getEntityRef(g)._updateEntityBasedOnApi(O.data);else{let N=await T.find({where:{...T.metadata.idMetadata.getIdFilter(O.id),$and:[T.metadata.options.apiPrefilter??{}]}});if(N.length!=1)throw new Error("not found or too many matches");g=N[0],await T.getEntityRef(g)._updateEntityBasedOnApi(O.data)}if(!k.isAllowedForInstance(g,P))throw new Lr;let F=ie(g);await F.__validateEntity();try{M={result:await s.apply(g,p.args),rowInfo:{data:await F.toApiJson(),isNewRow:F.isNew(),wasChanged:F.wasChanged(),id:F.getOriginalId()}}}catch(N){throw F.catchSaveErrors(N)}}else{let T=new h(k,k.dataProvider),g=wi(T,k);if(await g._updateEntityBasedOnApi(p.fields),!k.isAllowedForInstance(T,P))throw new Lr;await g.__validateEntity();try{M={result:await s.apply(T,p.args),fields:await g.toApiJson()}}catch(O){throw g.catchSaveErrors(O)}}}),w.success(M)}catch(k){k.isForbiddenError?w.forbidden():w.error(k,void 0)}})}},doWork:async function(d,c,h,y){if(d=Li(o(),d),D.allEntities.includes(e.constructor)){let p=ie(c);await p.__validateEntity();let b=l.classes.get(c.constructor);b.key||(b.key=p.repository.metadata.key+"_methods");try{let w=await new class extends Rt{constructor(){super(...arguments);f(this,"execute")}}(b.key+"/"+(i!=null&&i.apiPrefix?i.apiPrefix+"/":"")+n,(i==null?void 0:i.queue)??!1,i.allowed).run({args:d,rowInfo:{data:await p.toApiJson(),isNewRow:p.isNew(),wasChanged:p.wasChanged(),id:p.getOriginalId()}},h,y);return await p._updateEntityBasedOnApi(w.rowInfo.data,!0),w.result}catch(w){throw p.catchSaveErrors(w)}}else{let p=wi(c,void 0);try{await p.__validateEntity();let b=await new class extends Rt{constructor(){super(...arguments);f(this,"execute")}}(l.classes.get(c.constructor).key+"/"+(i!=null&&i.apiPrefix?i.apiPrefix+"/":"")+n,(i==null?void 0:i.queue)??!1,i.allowed).run({args:d,fields:await p.toApiJson()},h,y);return await p._updateEntityBasedOnApi(b.fields),b.result}catch(b){throw p.catchSaveErrors(b)}}}};return a=async function(...d){let c=this;return Pt()?await s.apply(c,d):u.doWork(d,c)},Mi(e.constructor,a),a[Nr]=u,r?(r.value=a,r):a}}const to={_isUndefined:!0};function Mi(i,e){(i[$i]||(i[$i]=[])).push(e),D.actionInfo.allActions.push(e)}function In(i){return i&&i._isUndefined}class Ni{constructor(e){f(this,"res");this.res=e}progress(e){this.res.progress(e)}}function Li(i,e){if(i)for(let t=0;t<i.length;t++){const r=i[t];for(const n of[De,yt])(e[t]instanceof n||r==n)&&(e[t]=void 0);if(e[t]!=null){let n={valueType:r};if(n=Vr(n,new De),Oe(r,!1)!=null){let a=ie(e[t]);e[t]=a.getId()}n.valueConverter&&(e[t]=n.valueConverter.toJson(e[t]))}}return e.map(t=>t!==void 0?t:to)}async function On(i,e,t,r,n){for(let s=0;s<e.length;s++){const a=e[s];In(a)&&(e[s]=void 0)}if(i)for(let s=0;s<i.length;s++)if(e.length<s&&e.push(void 0),i[s]==De||i[s]==De)e[s]=t;else if(i[s]==yt&&r)e[s]=r;else if(i[s]==Ni)e[s]=new Ni(n);else{let a={valueType:i[s]};a=Vr(a,t),a.valueConverter&&(e[s]=a.valueConverter.fromJson(e[s])),Oe(i[s],!1)!=null&&(e[s]===null||e[s]===void 0||(e[s]=await t.repo(i[s]).findId(e[s])))}return e}const $i=Symbol.for("classBackendMethodsArray");async function kn(i,e,t){if(e.transactional===void 0||e.transactional===!0)return await Ia(i,t);await t(i.dataProvider)}function Cn(i,e){return be.repo(i,e)}D.actionInfo;class ro{constructor(e,t){f(this,"id");f(this,"caption");f(this,"icon");f(this,"where");f(this,"class");f(this,"hide");this.id=e.toString(),this.caption=(t==null?void 0:t.caption)??this.id,this.icon=t==null?void 0:t.icon,this.where=t==null?void 0:t.where,this.class=t==null?void 0:t.class,this.hide=t==null?void 0:t.hide,t!=null&&t.icon&&t.icon.caption===void 0&&(t.icon.caption=t==null?void 0:t.caption)}}const gt={FF_Role_Admin:"FF_Role.Admin"};var io=Object.defineProperty,no=Object.getOwnPropertyDescriptor,We=(i,e,t,r)=>{for(var n=r>1?void 0:r?no(e,t):e,s=i.length-1,a;s>=0;s--)(a=i[s])&&(n=(r?a(e,t,n):a(n))||n);return r&&n&&io(e,t,n),n};const so={ChangeLog__Admin:"changeLog__admin"};let Pe=class{constructor(){f(this,"id","");f(this,"entity","");f(this,"entityId","");f(this,"changeDate",new Date);f(this,"userId","");f(this,"changes",[]);f(this,"newRow",!1);f(this,"deleted",!1)}};We([Y.cuid()],Pe.prototype,"id",2);We([Y.string()],Pe.prototype,"entity",2);We([Y.string()],Pe.prototype,"entityId",2);We([Y.date()],Pe.prototype,"changeDate",2);We([Y.string()],Pe.prototype,"userId",2);We([Y.json({dbName:"changesJson"})],Pe.prototype,"changes",2);We([Y.boolean()],Pe.prototype,"newRow",2);We([Y.boolean()],Pe.prototype,"deleted",2);Pe=We([vn("_ff_change_logs",{caption:"FF Change Logs",allowApiCrud:so.ChangeLog__Admin,defaultOrderBy:{changeDate:"desc"}})],Pe);async function ao(i,e,t){var r;if(Pt()){const n=[],s=new An(i,t),a=(t==null?void 0:t.forceNew)||e.isNew,o=(t==null?void 0:t.forceDate)||new Date;for(const l of s.fields.filter(u=>u.valueChanged()||a&&u.value))try{const u=s.excludedValues.includes(l);n.push({key:l.metadata.key,newValue:u?"***":l.value instanceof er?l.value.id:l.metadata.options.valueConverter.toJson(l.value),oldValue:e.isNew?"---":u?"***":l.originalValue instanceof er?l.originalValue.id:l.metadata.options.valueConverter.toJson(l.originalValue)})}catch(u){throw console.error(l),u}n.length>0&&await Cn(Pe).insert({changeDate:o,changes:n,entity:e.metadata.key,entityId:e.metadata.idMetadata.getId(i),userId:((r=be.user)==null?void 0:r.id)||"",newRow:a})}}async function oo(i,e,t){var a;const r=[],n=new An(i,t),s=(t==null?void 0:t.forceDate)||new Date;for(const o of n.fields)try{const l=n.excludedValues.includes(o);r.push({key:o.metadata.key,newValue:l?"***":"---",oldValue:l?"***":o.originalValue instanceof er?o.originalValue.id:o.metadata.options.valueConverter.toJson(o.originalValue)})}catch(l){throw console.error(o),l}await Cn(Pe).insert({changeDate:s,changes:r,entity:e.metadata.key,entityId:e.metadata.idMetadata.getId(i),userId:((a=be.user)==null?void 0:a.id)||"",deleted:!0})}class An{constructor(e,t){f(this,"fields");f(this,"excludedFields");f(this,"excludedValues");const r=ie(e);t!=null&&t.excludeColumns?this.excludedFields=t.excludeColumns(r.fields):this.excludedFields=[],t!=null&&t.excludeValues?this.excludedValues=t.excludeValues(r.fields):this.excludedValues=[],this.excludedFields.push(...r.fields.toArray().filter(n=>n.metadata.options.serverExpression)),this.excludedFields.push(...r.fields.toArray().filter(n=>n.metadata.options.sqlExpression)),this.fields=r.fields.toArray().filter(n=>!this.excludedFields.includes(n))}}const kt=i=>{if(i)return Array.isArray(i)?i.map(e=>e.id):i.id};function Wr(i,e){return vn(i,{...e,allowApiCrud:(e==null?void 0:e.allowApiCrud)??kt(e==null?void 0:e.permissionApiCrud),allowApiDelete:(e==null?void 0:e.allowApiDelete)??kt(e==null?void 0:e.permissionApiDelete),allowApiInsert:(e==null?void 0:e.allowApiInsert)??kt(e==null?void 0:e.permissionApiInsert),allowApiRead:(e==null?void 0:e.allowApiRead)??kt(e==null?void 0:e.permissionApiRead),allowApiUpdate:(e==null?void 0:e.allowApiUpdate)??kt(e==null?void 0:e.permissionApiUpdate),saved:async(t,r)=>{var n;await((n=e==null?void 0:e.saved)==null?void 0:n.call(e,t,r)),(e==null?void 0:e.changeLog)===!1||Pt()&&await ao(t,r,e==null?void 0:e.changeLog)},deleted:async(t,r)=>{var n;await((n=e==null?void 0:e.deleted)==null?void 0:n.call(e,t,r)),(e==null?void 0:e.changeLog)===!1||Pt()&&await oo(t,r,e==null?void 0:e.changeLog)}})}var En=Object.defineProperty,lo=Object.getOwnPropertyDescriptor,uo=(i,e,t)=>e in i?En(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,te=(i,e,t,r)=>{for(var n=r>1?void 0:r?lo(e,t):e,s=i.length-1,a;s>=0;s--)(a=i[s])&&(n=(r?a(e,t,n):a(n))||n);return r&&n&&En(e,t,n),n},lr=(i,e,t)=>uo(i,typeof e!="symbol"?e+"":e,t);const nt={FF_Role_Auth_Admin:"FF_Role_Auth.Admin",FF_Role_Auth_Invite:"FF_Role_Auth.Invite"};let Me=class{constructor(){f(this,"id");f(this,"createdAt");f(this,"updatedAt");f(this,"name");f(this,"roles",[]);f(this,"accounts");f(this,"sessions")}};te([Y.cuid()],Me.prototype,"id",2);te([Y.createdAt({includeInApi:[nt.FF_Role_Auth_Admin,gt.FF_Role_Admin]})],Me.prototype,"createdAt",2);te([Y.updatedAt({includeInApi:[nt.FF_Role_Auth_Admin,gt.FF_Role_Admin]})],Me.prototype,"updatedAt",2);te([Y.string({required:!0,validate:[Fe.unique(),Fe.required()]})],Me.prototype,"name",2);te([Y.json(()=>[],{includeInApi:[nt.FF_Role_Auth_Admin,gt.FF_Role_Admin],inputType:"selectEnum",valueConverter:{toDb:i=>i===null?null:Array.isArray(i)?i.join(","):i,fromDb:i=>i?i.split(",").map(e=>e.replace("{","").replace("}","")).filter(e=>e!==""):[]}})],Me.prototype,"roles",2);te([or.toMany(()=>_e,"userId")],Me.prototype,"accounts",2);te([or.toMany(()=>rt,"userId")],Me.prototype,"sessions",2);Me=te([Wr("ff_auth.users",{allowApiCrud:[nt.FF_Role_Auth_Admin,gt.FF_Role_Admin],caption:"FF Auth - Users"})],Me);let _e=class{constructor(){f(this,"id");f(this,"createdAt");f(this,"updatedAt");f(this,"userId");f(this,"user");f(this,"provider",Ne.PASSWORD.id);f(this,"providerUserId","");f(this,"email",null);f(this,"hashPassword");f(this,"token");f(this,"expiresAt");f(this,"lastVerifiedAt");f(this,"metadata")}};te([Y.cuid()],_e.prototype,"id",2);te([Y.createdAt()],_e.prototype,"createdAt",2);te([Y.updatedAt()],_e.prototype,"updatedAt",2);te([Y.string()],_e.prototype,"userId",2);te([or.toOne(()=>Me,"userId")],_e.prototype,"user",2);te([Y.string()],_e.prototype,"provider",2);te([Y.string()],_e.prototype,"providerUserId",2);te([Y.string({allowNull:!0})],_e.prototype,"email",2);te([Y.string({includeInApi:!1,allowNull:!0})],_e.prototype,"hashPassword",2);te([Y.string({includeInApi:!1,allowNull:!0})],_e.prototype,"token",2);te([Y.date({includeInApi:!1,allowNull:!0})],_e.prototype,"expiresAt",2);te([Y.date({includeInApi:!1,allowNull:!0})],_e.prototype,"lastVerifiedAt",2);te([Y.json({includeInApi:!1,allowNull:!0})],_e.prototype,"metadata",2);_e=te([Wr("ff_auth.accounts",{allowApiCrud:[nt.FF_Role_Auth_Admin,gt.FF_Role_Admin],caption:"FF Auth - Accounts",changeLog:{excludeColumns:i=>[i.hashPassword,i.token]}})],_e);let rt=class{constructor(){f(this,"id");f(this,"expiresAt");f(this,"userId");f(this,"user")}};te([Y.string()],rt.prototype,"id",2);te([Y.date()],rt.prototype,"expiresAt",2);te([Y.string()],rt.prototype,"userId",2);te([or.toOne(()=>Me,"userId")],rt.prototype,"user",2);rt=te([Wr("ff_auth.users_sessions",{allowApiCrud:[nt.FF_Role_Auth_Admin,gt.FF_Role_Admin],caption:"FF Auth - Users sessions",changeLog:!1})],rt);let Ne=class extends ro{constructor(i,e){super(i,{...e})}};lr(Ne,"DEMO",new Ne("DEMO",{caption:"Demo"}));lr(Ne,"PASSWORD",new Ne("PASSWORD",{caption:"Password"}));lr(Ne,"OTP",new Ne("OTP",{caption:"TOTP"}));lr(Ne,"OAUTH",new Ne("OAUTH",{caption:"OAUTH"}));Ne=te([La()],Ne);var fo=Object.defineProperty,co=Object.getOwnPropertyDescriptor,xe=(i,e,t,r)=>{for(var n=co(e,t),s=i.length-1,a;s>=0;s--)(a=i[s])&&(n=a(e,t,n)||n);return n&&fo(e,t,n),n},we,ke;const Le=(we=class{static _setAbstraction(e){Zr(this,ke,e)}static async signOut(){return await Re(we,ke).signOut()}static async signInDemo(e){return await Re(we,ke).signInDemo(e)}static async invite(e){return await Re(we,ke).invite(e)}static async signUpPassword(e,t){return await Re(we,ke).signUpPassword(e,t)}static async signInPassword(e,t){return await Re(we,ke).signInPassword(e,t)}static async forgotPassword(e){return await Re(we,ke).forgotPassword(e)}static async resetPassword(e,t){return await Re(we,ke).resetPassword(e,t)}static async signInOTP(e){return await Re(we,ke).signInOTP(e)}static async verifyOtp(e,t){return await Re(we,ke).verifyOtp(e,t)}static async signInOAuthGetUrl(e){return await Re(we,ke).signInOAuthGetUrl(e)}},ke=new WeakMap,Yr(we,ke),we);xe([qe({allowed:!0})],Le,"signOut");xe([qe({allowed:!0})],Le,"signInDemo");xe([qe({allowed:nt.FF_Role_Auth_Invite})],Le,"invite");xe([qe({allowed:!0})],Le,"signUpPassword");xe([qe({allowed:!0})],Le,"signInPassword");xe([qe({allowed:!0})],Le,"forgotPassword");xe([qe({allowed:!0})],Le,"resetPassword");xe([qe({allowed:!0})],Le,"signInOTP");xe([qe({allowed:!0})],Le,"verifyOtp");xe([qe({allowed:!0})],Le,"signInOAuthGetUrl");let Mt=Le;function Ve(i){i.focus()}var ho=ue('<div class="login"><p> </p> <form class="svelte-skcj83"><input required type="email"/> <button> </button></form></div>');function yo(i,e){ze(e,!1);let t=Ee(e,"firstlyDataAuth",8),r=Ee(e,"email",12,""),n=Ie(""),s=Ie(""),a=Ie(!1);async function o(){Z(n,""),Z(s,""),Z(a,!0);try{const w=await Mt.forgotPassword(r());Z(s,w.message??"")}catch(w){w&&Z(n,w.message??""),Z(a,!1)}}pt();var l=ho(),u=Q(l);let d;var c=Q(u),h=G(u,2),y=Q(h);nr(y,w=>Ve==null?void 0:Ve(w)),it(()=>tt(y,r));var p=G(y,2),b=Q(p);Ce((w,P)=>{d=mt(u,1,"message",null,d,w),oe(c,`${V(n)??""}${V(s)??""}`),$e(y,"placeholder",(ae(t()),le(()=>{var k;return(k=t().ui)==null?void 0:k.strings.email_placeholder}))),p.disabled=P,oe(b,(ae(t()),le(()=>{var k;return(k=t().ui)==null?void 0:k.strings.send_password_reset_instructions})))},[()=>({error:V(n),success:V(s)}),()=>(ae(r()),V(a),le(()=>!r()||!r().includes("@")||!r().includes(".")||V(a)))],ir),Dt("submit",h,sr(o)),X(i,l),Ke()}var po=(i,e,t)=>e(V(t).name),mo=ue('<div class="oauth-button-icon svelte-1dwkktf"><!></div>'),go=ue('<button class="oauth-button svelte-1dwkktf"><!> <span> </span></button>'),wo=ue('<hr style="margin: 1rem"/> <div class="oauth-container svelte-1dwkktf"></div>',1);function qi(i,e){ze(e,!0);const t=async a=>{const o=await Mt.signInOAuthGetUrl({provider:a,redirect:new URL(window.location.href).searchParams.get("redirect")??"/"});window.location.href=o};var r=St(),n=Se(r);{var s=a=>{var o=wo(),l=G(Se(o),2);hs(l,21,()=>{var u;return((u=e.firstlyDataAuth)==null?void 0:u.providers)??[]},u=>u.name,(u,d)=>{var c=go();c.__click=[po,t,d];var h=Q(c);{var y=w=>{var P=mo(),k=Q(P);ms(k,()=>V(d).raw_svg),X(w,P)};me(h,w=>{V(d).raw_svg&&w(y)})}var p=G(h,2),b=Q(p);Ce(()=>oe(b,V(d).label)),X(u,c)}),X(a,o)};me(n,a=>{var o;(((o=e.firstlyDataAuth)==null?void 0:o.providers)??[].length!==0)&&a(s)})}X(i,r),Ke()}Ji(["click"]);var vo=ue('<div class="login"><p> </p> <form class="svelte-skcj83"> <input type="password" required/> <input type="password" required/> <button> </button></form></div>');function bo(i,e){ze(e,!1);let t=Ee(e,"firstlyDataAuth",8),r=Ee(e,"password1",12,""),n=Ee(e,"password2",12,""),s=Ie(""),a=Ie(""),o=Ie(!1);async function l(){Z(s,""),Z(a,""),Z(o,!0);const T=new URL(location.href).searchParams.get("token");try{const g=await Mt.resetPassword(T??"",r());Z(a,g.message??""),window.location.href="/"}catch(g){g&&Z(s,g.message??""),Z(o,!1)}}pt();var u=vo(),d=Q(u);let c;var h=Q(d),y=G(d,2),p=Q(y),b=G(p),w=G(b),P=G(w),k=G(P,2),M=Q(k);Ce(T=>{c=mt(d,1,"message",null,c,T),oe(h,`${V(s)??""}${V(a)??""}`),oe(p,`${ae(t()),le(()=>{var g;return(g=t().ui)==null?void 0:g.strings.password})??""} `),$e(b,"placeholder",(ae(t()),le(()=>{var g;return(g=t().ui)==null?void 0:g.strings.password_placeholder}))),oe(w,` ${ae(t()),le(()=>{var g;return(g=t().ui)==null?void 0:g.strings.confirm})??""} `),$e(P,"placeholder",(ae(t()),le(()=>{var g;return(g=t().ui)==null?void 0:g.strings.password_placeholder}))),k.disabled=!r()||!n()||V(o),oe(M,(ae(t()),le(()=>{var g;return(g=t().ui)==null?void 0:g.strings.reset})))},[()=>({error:V(s)})],ir),tt(b,r),tt(P,n),Dt("submit",y,sr(l)),X(i,u),Ke()}var _o=ue('<form class="svelte-skcj83"><p> </p> <label> <input required type="email"/></label> <label> <input required type="password"/></label> <button> </button></form>');function Io(i,e){ze(e,!1);let t=Ee(e,"firstlyDataAuth",8),r=Ee(e,"view",8,"login"),n=Ee(e,"email",12,""),s=Ie(""),a=Ie(""),o=Ie(),l=Ie(!1);async function u(){Z(s,""),Z(a,""),Z(l,!0);try{await Mt.signInPassword(n(),V(o)),window.location.href=new URL(window.location.href).searchParams.get("redirect")??"/"}catch(y){y&&Z(s,y.message??""),Z(l,!1)}}pt();var d=St(),c=Se(d);{var h=y=>{var p=_o(),b=Q(p);let w;var P=Q(b),k=G(b,2),M=Q(k),T=G(M);it(()=>tt(T,n)),nr(T,C=>Ve==null?void 0:Ve(C));var g=G(k,2),O=Q(g),F=G(O),N=G(g,2),E=Q(N);Ce(C=>{w=mt(b,1,"message",null,w,C),oe(P,`${V(s)??""}${V(a)??""}`),oe(M,`${ae(t()),le(()=>{var I;return(I=t().ui)==null?void 0:I.strings.email})??""} `),$e(T,"placeholder",(ae(t()),le(()=>{var I;return(I=t().ui)==null?void 0:I.strings.email_placeholder}))),oe(O,`${ae(t()),le(()=>{var I;return(I=t().ui)==null?void 0:I.strings.password})??""} `),$e(F,"placeholder",(ae(t()),le(()=>{var I;return(I=t().ui)==null?void 0:I.strings.password_placeholder}))),N.disabled=!n()||!V(o)||V(l),oe(E,(ae(t()),le(()=>{var I;return(I=t().ui)==null?void 0:I.strings.btn_sign_in})))},[()=>({error:V(s)})],ir),tt(F,()=>V(o),C=>Z(o,C)),Dt("submit",p,sr(u)),X(y,p)};me(c,y=>{r()=="login"&&y(h)})}X(i,d),Ke()}var Oo=ue('<form class="svelte-skcj83"><p> </p> <label> <input required type="email"/></label> <label> <input required type="password"/></label> <button> </button></form>');function ko(i,e){ze(e,!1);let t=Ee(e,"firstlyDataAuth",8),r=Ee(e,"view",8,"login"),n=Ee(e,"email",12,""),s=Ie(""),a=Ie(""),o=Ie(),l=Ie(!1);async function u(){Z(s,""),Z(a,""),Z(l,!0);try{const y=await Mt.signUpPassword(n(),V(o));Z(a,y.message??""),await new Promise(p=>setTimeout(p,5e3)),window.location.href=new URL(window.location.href).searchParams.get("redirect")??"/"}catch(y){y&&Z(s,y.message??""),Z(l,!1)}}pt();var d=St(),c=Se(d);{var h=y=>{var p=Oo(),b=Q(p);let w;var P=Q(b),k=G(b,2),M=Q(k),T=G(M);it(()=>tt(T,n)),nr(T,C=>Ve==null?void 0:Ve(C));var g=G(k,2),O=Q(g),F=G(O),N=G(g,2),E=Q(N);Ce(C=>{w=mt(b,1,"message",null,w,C),oe(P,`${V(s)??""}${V(a)??""}`),oe(M,`${ae(t()),le(()=>{var I;return(I=t().ui)==null?void 0:I.strings.email})??""} `),$e(T,"placeholder",(ae(t()),le(()=>{var I;return(I=t().ui)==null?void 0:I.strings.email_placeholder}))),oe(O,`${ae(t()),le(()=>{var I;return(I=t().ui)==null?void 0:I.strings.password})??""} `),$e(F,"placeholder",(ae(t()),le(()=>{var I;return(I=t().ui)==null?void 0:I.strings.password_placeholder}))),N.disabled=!n()||!V(o)||V(l),oe(E,(ae(t()),le(()=>{var I;return(I=t().ui)==null?void 0:I.strings.btn_sign_up})))},[()=>({error:V(s)})],ir),tt(F,()=>V(o),C=>Z(o,C)),Dt("submit",p,sr(u)),X(y,p)};me(c,y=>{r()=="login"&&y(h)})}X(i,d),Ke()}var Co=ue('<h1 class="svelte-1jjivcr"> </h1>'),Ao=ue('<!> <div class="form-footer svelte-1jjivcr"><!></div> <!>',1),Eo=ue("<hr/> <!>",1),To=ue('<!> <div class="form-footer svelte-1jjivcr"><!> <!></div> <!>',1),So=ue('<!> <div class="form-footer svelte-1jjivcr"><!></div>',1),Fo=ue('<!> <div class="form-footer svelte-1jjivcr"><!></div>',1),Po=ue('<div class="form svelte-1jjivcr"><!> <!> <!> <!> <!></div>'),Ro=ue('<img alt="Authentication" class="svelte-1jjivcr"/>'),Do=ue('<div class="split-layout svelte-1jjivcr"><div class="form-side svelte-1jjivcr"><!></div> <div class="image-side svelte-1jjivcr"><!></div></div>'),Mo=ue('<div class="centered-layout svelte-1jjivcr"><!></div>'),No=ue('<div class="fallback svelte-1jjivcr"><small>- 404 -</small></div> <div class="fallback svelte-1jjivcr"><small>Nothing to see here</small></div>',1),Lo=ue("<!> <!>",1),$o=ue("<div><!></div>");function Bo(i,e){ze(e,!0);const t=u=>{var d=Po(),c=Q(d);{var h=g=>{var O=Co(),F=Q(O);Ce(()=>oe(F,r.ui.strings.app_name)),X(g,O)};me(c,g=>{var O;(O=r.ui)!=null&&O.strings.app_name&&g(h)})}var y=G(c,2);{var p=g=>{const O=wt(()=>{var F;return(F=r.ui)==null?void 0:F.paths.sign_up});at(g,{get path(){return V(O)},children:(F,N)=>{var E=Ao(),C=Se(E);ko(C,{get firstlyDataAuth(){return r},get email(){return V(n)},set email(x){Z(n,x,!0)}});var I=G(C,2),v=Q(I);{var S=x=>{It(x,{get href(){return r.ui.paths.sign_in},children:(ee,W)=>{var fe=vt();Ce(()=>oe(fe,r.ui.strings.back_to_sign_in)),X(ee,fe)},$$slots:{default:!0}})};me(v,x=>{r.ui.paths.sign_in&&x(S)})}var $=G(I,2);qi($,{get firstlyDataAuth(){return r}}),X(F,E)},$$slots:{default:!0}})};me(y,g=>{var O;(O=r.ui)!=null&&O.paths.sign_up&&g(p)})}var b=G(y,2);{var w=g=>{const O=wt(()=>{var F;return(F=r.ui)==null?void 0:F.paths.sign_in});at(g,{get path(){return V(O)},children:(F,N)=>{var E=To(),C=Se(E);Io(C,{get firstlyDataAuth(){return r},get email(){return V(n)},set email(W){Z(n,W,!0)}});var I=G(C,2),v=Q(I);{var S=W=>{It(W,{get href(){return r.ui.paths.forgot_password},children:(fe,He)=>{var Be=vt();Ce(()=>oe(Be,r.ui.strings.forgot_password)),X(fe,Be)},$$slots:{default:!0}})};me(v,W=>{var fe;(fe=r.ui)!=null&&fe.paths.forgot_password&&W(S)})}var $=G(v,2);{var x=W=>{var fe=Eo(),He=G(Se(fe),2);It(He,{get href(){return r.ui.paths.sign_up},children:(Be,ur)=>{var se=vt();Ce(()=>oe(se,r.ui.strings.btn_sign_up)),X(Be,se)},$$slots:{default:!0}}),X(W,fe)};me($,W=>{var fe;(fe=r.ui)!=null&&fe.paths.sign_up&&W(x)})}var ee=G(I,2);qi(ee,{get firstlyDataAuth(){return r}}),X(F,E)},$$slots:{default:!0}})};me(b,g=>{var O;(O=r.ui)!=null&&O.paths.sign_in&&g(w)})}var P=G(b,2);{var k=g=>{const O=wt(()=>{var F;return(F=r.ui)==null?void 0:F.paths.forgot_password});at(g,{get path(){return V(O)},children:(F,N)=>{var E=So(),C=Se(E);yo(C,{get firstlyDataAuth(){return r},get email(){return V(n)},set email($){Z(n,$,!0)}});var I=G(C,2),v=Q(I);{var S=$=>{It($,{get href(){return r.ui.paths.sign_in},children:(x,ee)=>{var W=vt();Ce(()=>oe(W,r.ui.strings.back_to_sign_in)),X(x,W)},$$slots:{default:!0}})};me(v,$=>{var x;(x=r.ui)!=null&&x.paths.sign_in&&$(S)})}X(F,E)},$$slots:{default:!0}})};me(P,g=>{var O;(O=r.ui)!=null&&O.paths.forgot_password&&g(k)})}var M=G(P,2);{var T=g=>{const O=wt(()=>{var F;return(F=r.ui)==null?void 0:F.paths.reset_password});at(g,{get path(){return V(O)},children:(F,N)=>{var E=Fo(),C=Se(E);bo(C,{get firstlyDataAuth(){return r}});var I=G(C,2),v=Q(I);{var S=$=>{It($,{get href(){return r.ui.paths.sign_in},children:(x,ee)=>{var W=vt();Ce(()=>oe(W,r.ui.strings.back_to_sign_in)),X(x,W)},$$slots:{default:!0}})};me(v,$=>{var x;(x=r.ui)!=null&&x.paths.sign_in&&$(S)})}X(F,E)},$$slots:{default:!0}})};me(M,g=>{var O;(O=r.ui)!=null&&O.paths.reset_password&&g(T)})}X(u,d)};let r=e.firstlyData.props,n=ys(""),s=wt(()=>{var u,d;return!!((d=(u=r.ui)==null?void 0:u.images)!=null&&d.main)});var a=$o();let o;var l=Q(a);at(l,{children:(u,d)=>{var c=Lo(),h=Se(c);{var y=w=>{var P=Do(),k=Q(P),M=Q(k);t(M);var T=G(k,2),g=Q(T);{var O=F=>{var N=Ro();Ce(()=>$e(N,"src",r.ui.images.main)),X(F,N)};me(g,F=>{var N,E;(E=(N=r.ui)==null?void 0:N.images)!=null&&E.main&&F(O)})}X(w,P)},p=w=>{var P=Mo(),k=Q(P);t(k),X(w,P)};me(h,w=>{V(s)?w(y):w(p,!1)})}var b=G(h,2);at(b,{fallback:!0,children:(w,P)=>{var k=No();X(w,k)},$$slots:{default:!0}}),X(u,c)},$$slots:{default:!0}}),Ce(u=>o=mt(a,1,"wrapper svelte-1jjivcr",null,o,u),[()=>({"with-image":V(s)})]),X(i,a),Ke()}export{Bo as default};
|
|
20
|
+
***************************************************************************** */var Di;function Za(){if(Di)return Ri;Di=1;var i;return function(e){(function(t){var r=typeof Zt=="object"?Zt:typeof self=="object"?self:typeof this=="object"?this:Function("return this;")(),n=s(e);typeof r.Reflect>"u"?r.Reflect=e:n=s(r.Reflect,n),t(n);function s(a,o){return function(l,u){typeof a[l]!="function"&&Object.defineProperty(a,l,{configurable:!0,writable:!0,value:u}),o&&o(l,u)}}})(function(t){var r=Object.prototype.hasOwnProperty,n=typeof Symbol=="function",s=n&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",a=n&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",o=typeof Object.create=="function",l={__proto__:[]}instanceof Array,u=!o&&!l,d={create:o?function(){return dr(Object.create(null))}:l?function(){return dr({__proto__:null})}:function(){return dr({})},has:u?function(m,_){return r.call(m,_)}:function(m,_){return _ in m},get:u?function(m,_){return r.call(m,_)?m[_]:void 0}:function(m,_){return m[_]}},c=Object.getPrototypeOf(Function),h=typeof process=="object"&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL==="true",y=!h&&typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:qn(),p=!h&&typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:xn(),b=!h&&typeof WeakMap=="function"?WeakMap:Bn(),w=new b;function P(m,_,A,R){if(se(A)){if(!Hr(m))throw new TypeError;if(!Gr(_))throw new TypeError;return I(m,_)}else{if(!Hr(m))throw new TypeError;if(!ge(_))throw new TypeError;if(!ge(R)&&!se(R)&&!st(R))throw new TypeError;return st(R)&&(R=void 0),A=je(A),v(m,_,A,R)}}t("decorate",P);function k(m,_){function A(R,B){if(!ge(R))throw new TypeError;if(!se(B)&&!Dn(B))throw new TypeError;fe(m,_,R,B)}return A}t("metadata",k);function M(m,_,A,R){if(!ge(A))throw new TypeError;return se(R)||(R=je(R)),fe(m,_,A,R)}t("defineMetadata",M);function T(m,_,A){if(!ge(_))throw new TypeError;return se(A)||(A=je(A)),$(m,_,A)}t("hasMetadata",T);function g(m,_,A){if(!ge(_))throw new TypeError;return se(A)||(A=je(A)),x(m,_,A)}t("hasOwnMetadata",g);function O(m,_,A){if(!ge(_))throw new TypeError;return se(A)||(A=je(A)),ee(m,_,A)}t("getMetadata",O);function F(m,_,A){if(!ge(_))throw new TypeError;return se(A)||(A=je(A)),W(m,_,A)}t("getOwnMetadata",F);function N(m,_){if(!ge(m))throw new TypeError;return se(_)||(_=je(_)),He(m,_)}t("getMetadataKeys",N);function E(m,_){if(!ge(m))throw new TypeError;return se(_)||(_=je(_)),Be(m,_)}t("getOwnMetadataKeys",E);function C(m,_,A){if(!ge(_))throw new TypeError;se(A)||(A=je(A));var R=S(_,A,!1);if(se(R)||!R.delete(m))return!1;if(R.size>0)return!0;var B=w.get(_);return B.delete(A),B.size>0||w.delete(_),!0}t("deleteMetadata",C);function I(m,_){for(var A=m.length-1;A>=0;--A){var R=m[A],B=R(_);if(!se(B)&&!st(B)){if(!Gr(B))throw new TypeError;_=B}}return _}function v(m,_,A,R){for(var B=m.length-1;B>=0;--B){var he=m[B],J=he(_,A,R);if(!se(J)&&!st(J)){if(!ge(J))throw new TypeError;R=J}}return R}function S(m,_,A){var R=w.get(m);if(se(R)){if(!A)return;R=new y,w.set(m,R)}var B=R.get(_);if(se(B)){if(!A)return;B=new y,R.set(_,B)}return B}function $(m,_,A){var R=x(m,_,A);if(R)return!0;var B=fr(_);return st(B)?!1:$(m,B,A)}function x(m,_,A){var R=S(_,A,!1);return se(R)?!1:Pn(R.has(m))}function ee(m,_,A){var R=x(m,_,A);if(R)return W(m,_,A);var B=fr(_);if(!st(B))return ee(m,B,A)}function W(m,_,A){var R=S(_,A,!1);if(!se(R))return R.get(m)}function fe(m,_,A,R){var B=S(A,R,!0);B.set(m,_)}function He(m,_){var A=Be(m,_),R=fr(m);if(R===null)return A;var B=He(R,_);if(B.length<=0)return A;if(A.length<=0)return B;for(var he=new p,J=[],H=0,q=A;H<q.length;H++){var z=q[H],K=he.has(z);K||(he.add(z),J.push(z))}for(var Ge=0,zr=B;Ge<zr.length;Ge++){var z=zr[Ge],K=he.has(z);K||(he.add(z),J.push(z))}return J}function Be(m,_){var A=[],R=S(m,_,!1);if(se(R))return A;for(var B=R.keys(),he=Mn(B),J=0;;){var H=Ln(he);if(!H)return A.length=J,A;var q=Nn(H);try{A[J]=q}catch(z){try{$n(he)}finally{throw z}}J++}}function ur(m){if(m===null)return 1;switch(typeof m){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return m===null?1:6;default:return 6}}function se(m){return m===void 0}function st(m){return m===null}function Tn(m){return typeof m=="symbol"}function ge(m){return typeof m=="object"?m!==null:typeof m=="function"}function Sn(m,_){switch(ur(m)){case 0:return m;case 1:return m;case 2:return m;case 3:return m;case 4:return m;case 5:return m}var A="string",R=Qr(m,s);if(R!==void 0){var B=R.call(m,A);if(ge(B))throw new TypeError;return B}return Fn(m)}function Fn(m,_){var A,R,B;{var he=m.toString;if(Nt(he)){var R=he.call(m);if(!ge(R))return R}var A=m.valueOf;if(Nt(A)){var R=A.call(m);if(!ge(R))return R}}throw new TypeError}function Pn(m){return!!m}function Rn(m){return""+m}function je(m){var _=Sn(m);return Tn(_)?_:Rn(_)}function Hr(m){return Array.isArray?Array.isArray(m):m instanceof Object?m instanceof Array:Object.prototype.toString.call(m)==="[object Array]"}function Nt(m){return typeof m=="function"}function Gr(m){return typeof m=="function"}function Dn(m){switch(ur(m)){case 3:return!0;case 4:return!0;default:return!1}}function Qr(m,_){var A=m[_];if(A!=null){if(!Nt(A))throw new TypeError;return A}}function Mn(m){var _=Qr(m,a);if(!Nt(_))throw new TypeError;var A=_.call(m);if(!ge(A))throw new TypeError;return A}function Nn(m){return m.value}function Ln(m){var _=m.next();return _.done?!1:_}function $n(m){var _=m.return;_&&_.call(m)}function fr(m){var _=Object.getPrototypeOf(m);if(typeof m!="function"||m===c||_!==c)return _;var A=m.prototype,R=A&&Object.getPrototypeOf(A);if(R==null||R===Object.prototype)return _;var B=R.constructor;return typeof B!="function"||B===m?_:B}function qn(){var m={},_=[],A=function(){function J(H,q,z){this._index=0,this._keys=H,this._values=q,this._selector=z}return J.prototype["@@iterator"]=function(){return this},J.prototype[a]=function(){return this},J.prototype.next=function(){var H=this._index;if(H>=0&&H<this._keys.length){var q=this._selector(this._keys[H],this._values[H]);return H+1>=this._keys.length?(this._index=-1,this._keys=_,this._values=_):this._index++,{value:q,done:!1}}return{value:void 0,done:!0}},J.prototype.throw=function(H){throw this._index>=0&&(this._index=-1,this._keys=_,this._values=_),H},J.prototype.return=function(H){return this._index>=0&&(this._index=-1,this._keys=_,this._values=_),{value:H,done:!0}},J}();return function(){function J(){this._keys=[],this._values=[],this._cacheKey=m,this._cacheIndex=-2}return Object.defineProperty(J.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),J.prototype.has=function(H){return this._find(H,!1)>=0},J.prototype.get=function(H){var q=this._find(H,!1);return q>=0?this._values[q]:void 0},J.prototype.set=function(H,q){var z=this._find(H,!0);return this._values[z]=q,this},J.prototype.delete=function(H){var q=this._find(H,!1);if(q>=0){for(var z=this._keys.length,K=q+1;K<z;K++)this._keys[K-1]=this._keys[K],this._values[K-1]=this._values[K];return this._keys.length--,this._values.length--,H===this._cacheKey&&(this._cacheKey=m,this._cacheIndex=-2),!0}return!1},J.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=m,this._cacheIndex=-2},J.prototype.keys=function(){return new A(this._keys,this._values,R)},J.prototype.values=function(){return new A(this._keys,this._values,B)},J.prototype.entries=function(){return new A(this._keys,this._values,he)},J.prototype["@@iterator"]=function(){return this.entries()},J.prototype[a]=function(){return this.entries()},J.prototype._find=function(H,q){return this._cacheKey!==H&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=H)),this._cacheIndex<0&&q&&(this._cacheIndex=this._keys.length,this._keys.push(H),this._values.push(void 0)),this._cacheIndex},J}();function R(J,H){return J}function B(J,H){return H}function he(J,H){return[J,H]}}function xn(){return function(){function m(){this._map=new y}return Object.defineProperty(m.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),m.prototype.has=function(_){return this._map.has(_)},m.prototype.add=function(_){return this._map.set(_,_),this},m.prototype.delete=function(_){return this._map.delete(_)},m.prototype.clear=function(){this._map.clear()},m.prototype.keys=function(){return this._map.keys()},m.prototype.values=function(){return this._map.values()},m.prototype.entries=function(){return this._map.entries()},m.prototype["@@iterator"]=function(){return this.keys()},m.prototype[a]=function(){return this.keys()},m}()}function Bn(){var m=16,_=d.create(),A=R();return function(){function q(){this._key=R()}return q.prototype.has=function(z){var K=B(z,!1);return K!==void 0?d.has(K,this._key):!1},q.prototype.get=function(z){var K=B(z,!1);return K!==void 0?d.get(K,this._key):void 0},q.prototype.set=function(z,K){var Ge=B(z,!0);return Ge[this._key]=K,this},q.prototype.delete=function(z){var K=B(z,!1);return K!==void 0?delete K[this._key]:!1},q.prototype.clear=function(){this._key=R()},q}();function R(){var q;do q="@@WeakMap@@"+H();while(d.has(_,q));return _[q]=!0,q}function B(q,z){if(!r.call(q,A)){if(!z)return;Object.defineProperty(q,A,{value:d.create()})}return q[A]}function he(q,z){for(var K=0;K<z;++K)q[K]=Math.random()*255|0;return q}function J(q){return typeof Uint8Array=="function"?typeof crypto<"u"?crypto.getRandomValues(new Uint8Array(q)):typeof msCrypto<"u"?msCrypto.getRandomValues(new Uint8Array(q)):he(new Uint8Array(q),q):he(new Array(q),q)}function H(){var q=J(m);q[6]=q[6]&79|64,q[8]=q[8]&191|128;for(var z="",K=0;K<m;++K){var Ge=q[K];(K===4||K===6||K===8)&&(z+="-"),Ge<16&&(z+="0"),z+=Ge.toString(16).toLowerCase()}return z}}function dr(m){return m.__=void 0,delete m.__,m}})}(i||(i={})),Ri}Za();const tr=class tr{constructor(e,t,r){f(this,"actionUrl");f(this,"queue");f(this,"allowed");f(this,"doWork");this.actionUrl=e,this.queue=t,this.allowed=r}async run(e,t,r){t===void 0&&(t=be.apiClient.url),r||(r=ht(be.apiClient.httpClient));let n=await r.post(t+"/"+this.actionUrl,e),s=n;if(s&&s.queuedJobId){let a=D.actionInfo.startBusyWithProgress();try{let o;if(await D.actionInfo.runActionWithoutBlockingUI(async()=>{for(;!o||!o.done;)o&&await new Promise(l=>setTimeout(()=>{l(void 0)},200)),o=await r.post(t+"/"+tr.apiUrlForJobStatus,{queuedJobId:n.queuedJobId}),o.progress&&a.progress(o.progress)}),o.error)throw o.error;return a.progress(1),o.result}finally{a.close()}}else return n}__register(e){e(this.actionUrl,this.queue,this.allowed,async(t,r,n)=>{try{var s=await this.execute(t,r,n);n.success(s)}catch(a){a.isForbiddenError?n.forbidden():n.error(a,void 0)}})}};f(tr,"apiUrlForJobStatus","jobStatusInQueue");let Rt=tr;class Lr extends Error{constructor(t="Forbidden"){super(t);f(this,"isForbiddenError",!0)}}class eo extends Rt{constructor(t,r,n,s){super(t,n.queue??!1,n.allowed);f(this,"types");f(this,"options");f(this,"originalMethod");this.types=r,this.options=n,this.originalMethod=s}async execute(t,r,n){let s={data:{}},a=r.dataProvider;return await kn(r,this.options,async()=>{if(!r.isAllowedForInstance(void 0,this.options.allowed))throw new Lr;t.args=await On(this.types(),t.args,r,a,n);try{s.data=await this.originalMethod(t.args)}catch(o){throw o}}),s}}function qe(i){return(e,t,r)=>{const n=typeof t=="string"?t:t.name.toString(),s=r?r.value:e;let a=s;_n(e);function o(){var d=typeof Reflect.getMetadata=="function"?Reflect.getMetadata("design:paramtypes",e,n):[];return i.paramTypes&&(d=typeof i.paramTypes=="function"?i.paramTypes():i.paramTypes),d}if(e.prototype!==void 0){let d=new eo((i!=null&&i.apiPrefix?i.apiPrefix+"/":"")+n,()=>o(),i,c=>s.apply(void 0,c));return d.doWork=async(c,h,y,p)=>(c=Li(o(),c),i.blockUser===!1?await D.actionInfo.runActionWithoutBlockingUI(async()=>(await d.run({args:c},y,p)).data):(await d.run({args:c},y,p)).data),a=async function(...c){return Pt()?await s.apply(this,c):await d.doWork(c,void 0)},Mi(e,a),a[Nr]=d,r?(r.value=a,r):a}let l=D.classHelpers.get(e.constructor);l||(l=new un,D.classHelpers.set(e.constructor,l));let u={__register(d){let c=new De;for(const h of l.classes.keys()){let y=l.classes.get(h);y.key||(y.key=c.repo(h).metadata.key),d(y.key+"/"+(i!=null&&i.apiPrefix?i.apiPrefix+"/":"")+n,i?i.queue??!1:!1,i.allowed,async(p,b,w)=>{p.args=p.args.map(k=>In(k)?void 0:k);let P=i.allowed;try{let k=b,M;await kn(k,i,async()=>{if(p.args=await On(o(),p.args,k,k.dataProvider,w),D.allEntities.includes(h)){let T=k.repo(h),g;const O=p.rowInfo;if(O.isNewRow)g=T.create(),await T.getEntityRef(g)._updateEntityBasedOnApi(O.data);else{let N=await T.find({where:{...T.metadata.idMetadata.getIdFilter(O.id),$and:[T.metadata.options.apiPrefilter??{}]}});if(N.length!=1)throw new Error("not found or too many matches");g=N[0],await T.getEntityRef(g)._updateEntityBasedOnApi(O.data)}if(!k.isAllowedForInstance(g,P))throw new Lr;let F=ie(g);await F.__validateEntity();try{M={result:await s.apply(g,p.args),rowInfo:{data:await F.toApiJson(),isNewRow:F.isNew(),wasChanged:F.wasChanged(),id:F.getOriginalId()}}}catch(N){throw F.catchSaveErrors(N)}}else{let T=new h(k,k.dataProvider),g=wi(T,k);if(await g._updateEntityBasedOnApi(p.fields),!k.isAllowedForInstance(T,P))throw new Lr;await g.__validateEntity();try{M={result:await s.apply(T,p.args),fields:await g.toApiJson()}}catch(O){throw g.catchSaveErrors(O)}}}),w.success(M)}catch(k){k.isForbiddenError?w.forbidden():w.error(k,void 0)}})}},doWork:async function(d,c,h,y){if(d=Li(o(),d),D.allEntities.includes(e.constructor)){let p=ie(c);await p.__validateEntity();let b=l.classes.get(c.constructor);b.key||(b.key=p.repository.metadata.key+"_methods");try{let w=await new class extends Rt{constructor(){super(...arguments);f(this,"execute")}}(b.key+"/"+(i!=null&&i.apiPrefix?i.apiPrefix+"/":"")+n,(i==null?void 0:i.queue)??!1,i.allowed).run({args:d,rowInfo:{data:await p.toApiJson(),isNewRow:p.isNew(),wasChanged:p.wasChanged(),id:p.getOriginalId()}},h,y);return await p._updateEntityBasedOnApi(w.rowInfo.data,!0),w.result}catch(w){throw p.catchSaveErrors(w)}}else{let p=wi(c,void 0);try{await p.__validateEntity();let b=await new class extends Rt{constructor(){super(...arguments);f(this,"execute")}}(l.classes.get(c.constructor).key+"/"+(i!=null&&i.apiPrefix?i.apiPrefix+"/":"")+n,(i==null?void 0:i.queue)??!1,i.allowed).run({args:d,fields:await p.toApiJson()},h,y);return await p._updateEntityBasedOnApi(b.fields),b.result}catch(b){throw p.catchSaveErrors(b)}}}};return a=async function(...d){let c=this;return Pt()?await s.apply(c,d):u.doWork(d,c)},Mi(e.constructor,a),a[Nr]=u,r?(r.value=a,r):a}}const to={_isUndefined:!0};function Mi(i,e){(i[$i]||(i[$i]=[])).push(e),D.actionInfo.allActions.push(e)}function In(i){return i&&i._isUndefined}class Ni{constructor(e){f(this,"res");this.res=e}progress(e){this.res.progress(e)}}function Li(i,e){if(i)for(let t=0;t<i.length;t++){const r=i[t];for(const n of[De,yt])(e[t]instanceof n||r==n)&&(e[t]=void 0);if(e[t]!=null){let n={valueType:r};if(n=Vr(n,new De),Oe(r,!1)!=null){let a=ie(e[t]);e[t]=a.getId()}n.valueConverter&&(e[t]=n.valueConverter.toJson(e[t]))}}return e.map(t=>t!==void 0?t:to)}async function On(i,e,t,r,n){for(let s=0;s<e.length;s++){const a=e[s];In(a)&&(e[s]=void 0)}if(i)for(let s=0;s<i.length;s++)if(e.length<s&&e.push(void 0),i[s]==De||i[s]==De)e[s]=t;else if(i[s]==yt&&r)e[s]=r;else if(i[s]==Ni)e[s]=new Ni(n);else{let a={valueType:i[s]};a=Vr(a,t),a.valueConverter&&(e[s]=a.valueConverter.fromJson(e[s])),Oe(i[s],!1)!=null&&(e[s]===null||e[s]===void 0||(e[s]=await t.repo(i[s]).findId(e[s])))}return e}const $i=Symbol.for("classBackendMethodsArray");async function kn(i,e,t){if(e.transactional===void 0||e.transactional===!0)return await Ia(i,t);await t(i.dataProvider)}function Cn(i,e){return be.repo(i,e)}D.actionInfo;class ro{constructor(e,t){f(this,"id");f(this,"caption");f(this,"icon");f(this,"where");f(this,"class");f(this,"hide");this.id=e.toString(),this.caption=(t==null?void 0:t.caption)??this.id,this.icon=t==null?void 0:t.icon,this.where=t==null?void 0:t.where,this.class=t==null?void 0:t.class,this.hide=t==null?void 0:t.hide,t!=null&&t.icon&&t.icon.caption===void 0&&(t.icon.caption=t==null?void 0:t.caption)}}const gt={FF_Role_Admin:"FF_Role.Admin"};var io=Object.defineProperty,no=Object.getOwnPropertyDescriptor,We=(i,e,t,r)=>{for(var n=r>1?void 0:r?no(e,t):e,s=i.length-1,a;s>=0;s--)(a=i[s])&&(n=(r?a(e,t,n):a(n))||n);return r&&n&&io(e,t,n),n};const so={ChangeLog_Admin:"ChangeLog.Admin"};let Pe=class{constructor(){f(this,"id","");f(this,"entity","");f(this,"entityId","");f(this,"changeDate",new Date);f(this,"userId","");f(this,"changes",[]);f(this,"newRow",!1);f(this,"deleted",!1)}};We([Y.cuid()],Pe.prototype,"id",2);We([Y.string()],Pe.prototype,"entity",2);We([Y.string()],Pe.prototype,"entityId",2);We([Y.date()],Pe.prototype,"changeDate",2);We([Y.string()],Pe.prototype,"userId",2);We([Y.json({dbName:"changesJson"})],Pe.prototype,"changes",2);We([Y.boolean()],Pe.prototype,"newRow",2);We([Y.boolean()],Pe.prototype,"deleted",2);Pe=We([vn("_ff_change_logs",{caption:"FF Change Logs",allowApiCrud:so.ChangeLog_Admin,defaultOrderBy:{changeDate:"desc"}})],Pe);async function ao(i,e,t){var r;if(Pt()){const n=[],s=new An(i,t),a=(t==null?void 0:t.forceNew)||e.isNew,o=(t==null?void 0:t.forceDate)||new Date;for(const l of s.fields.filter(u=>u.valueChanged()||a&&u.value))try{const u=s.excludedValues.includes(l);n.push({key:l.metadata.key,newValue:u?"***":l.value instanceof er?l.value.id:l.metadata.options.valueConverter.toJson(l.value),oldValue:e.isNew?"---":u?"***":l.originalValue instanceof er?l.originalValue.id:l.metadata.options.valueConverter.toJson(l.originalValue)})}catch(u){throw console.error(l),u}n.length>0&&await Cn(Pe).insert({changeDate:o,changes:n,entity:e.metadata.key,entityId:e.metadata.idMetadata.getId(i),userId:((r=be.user)==null?void 0:r.id)||"",newRow:a})}}async function oo(i,e,t){var a;const r=[],n=new An(i,t),s=(t==null?void 0:t.forceDate)||new Date;for(const o of n.fields)try{const l=n.excludedValues.includes(o);r.push({key:o.metadata.key,newValue:l?"***":"---",oldValue:l?"***":o.originalValue instanceof er?o.originalValue.id:o.metadata.options.valueConverter.toJson(o.originalValue)})}catch(l){throw console.error(o),l}await Cn(Pe).insert({changeDate:s,changes:r,entity:e.metadata.key,entityId:e.metadata.idMetadata.getId(i),userId:((a=be.user)==null?void 0:a.id)||"",deleted:!0})}class An{constructor(e,t){f(this,"fields");f(this,"excludedFields");f(this,"excludedValues");const r=ie(e);t!=null&&t.excludeColumns?this.excludedFields=t.excludeColumns(r.fields):this.excludedFields=[],t!=null&&t.excludeValues?this.excludedValues=t.excludeValues(r.fields):this.excludedValues=[],this.excludedFields.push(...r.fields.toArray().filter(n=>n.metadata.options.serverExpression)),this.excludedFields.push(...r.fields.toArray().filter(n=>n.metadata.options.sqlExpression)),this.fields=r.fields.toArray().filter(n=>!this.excludedFields.includes(n))}}const kt=i=>{if(i)return Array.isArray(i)?i.map(e=>e.id):i.id};function Wr(i,e){return vn(i,{...e,allowApiCrud:(e==null?void 0:e.allowApiCrud)??kt(e==null?void 0:e.permissionApiCrud),allowApiDelete:(e==null?void 0:e.allowApiDelete)??kt(e==null?void 0:e.permissionApiDelete),allowApiInsert:(e==null?void 0:e.allowApiInsert)??kt(e==null?void 0:e.permissionApiInsert),allowApiRead:(e==null?void 0:e.allowApiRead)??kt(e==null?void 0:e.permissionApiRead),allowApiUpdate:(e==null?void 0:e.allowApiUpdate)??kt(e==null?void 0:e.permissionApiUpdate),saved:async(t,r)=>{var n;await((n=e==null?void 0:e.saved)==null?void 0:n.call(e,t,r)),(e==null?void 0:e.changeLog)===!1||Pt()&&await ao(t,r,e==null?void 0:e.changeLog)},deleted:async(t,r)=>{var n;await((n=e==null?void 0:e.deleted)==null?void 0:n.call(e,t,r)),(e==null?void 0:e.changeLog)===!1||Pt()&&await oo(t,r,e==null?void 0:e.changeLog)}})}var En=Object.defineProperty,lo=Object.getOwnPropertyDescriptor,uo=(i,e,t)=>e in i?En(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,te=(i,e,t,r)=>{for(var n=r>1?void 0:r?lo(e,t):e,s=i.length-1,a;s>=0;s--)(a=i[s])&&(n=(r?a(e,t,n):a(n))||n);return r&&n&&En(e,t,n),n},lr=(i,e,t)=>uo(i,typeof e!="symbol"?e+"":e,t);const nt={FF_Role_Auth_Admin:"FF_Role_Auth.Admin",FF_Role_Auth_Invite:"FF_Role_Auth.Invite"};let Me=class{constructor(){f(this,"id");f(this,"createdAt");f(this,"updatedAt");f(this,"name");f(this,"roles",[]);f(this,"accounts");f(this,"sessions")}};te([Y.cuid()],Me.prototype,"id",2);te([Y.createdAt({includeInApi:[nt.FF_Role_Auth_Admin,gt.FF_Role_Admin]})],Me.prototype,"createdAt",2);te([Y.updatedAt({includeInApi:[nt.FF_Role_Auth_Admin,gt.FF_Role_Admin]})],Me.prototype,"updatedAt",2);te([Y.string({required:!0,validate:[Fe.unique(),Fe.required()]})],Me.prototype,"name",2);te([Y.json(()=>[],{includeInApi:[nt.FF_Role_Auth_Admin,gt.FF_Role_Admin],inputType:"selectEnum",valueConverter:{toDb:i=>i===null?null:Array.isArray(i)?i.join(","):i,fromDb:i=>i?i.split(",").map(e=>e.replace("{","").replace("}","")).filter(e=>e!==""):[]}})],Me.prototype,"roles",2);te([or.toMany(()=>_e,"userId")],Me.prototype,"accounts",2);te([or.toMany(()=>rt,"userId")],Me.prototype,"sessions",2);Me=te([Wr("ff_auth.users",{allowApiCrud:[nt.FF_Role_Auth_Admin,gt.FF_Role_Admin],caption:"FF Auth - Users"})],Me);let _e=class{constructor(){f(this,"id");f(this,"createdAt");f(this,"updatedAt");f(this,"userId");f(this,"user");f(this,"provider",Ne.PASSWORD.id);f(this,"providerUserId","");f(this,"email",null);f(this,"hashPassword");f(this,"token");f(this,"expiresAt");f(this,"lastVerifiedAt");f(this,"metadata")}};te([Y.cuid()],_e.prototype,"id",2);te([Y.createdAt()],_e.prototype,"createdAt",2);te([Y.updatedAt()],_e.prototype,"updatedAt",2);te([Y.string()],_e.prototype,"userId",2);te([or.toOne(()=>Me,"userId")],_e.prototype,"user",2);te([Y.string()],_e.prototype,"provider",2);te([Y.string()],_e.prototype,"providerUserId",2);te([Y.string({allowNull:!0})],_e.prototype,"email",2);te([Y.string({includeInApi:!1,allowNull:!0})],_e.prototype,"hashPassword",2);te([Y.string({includeInApi:!1,allowNull:!0})],_e.prototype,"token",2);te([Y.date({includeInApi:!1,allowNull:!0})],_e.prototype,"expiresAt",2);te([Y.date({includeInApi:!1,allowNull:!0})],_e.prototype,"lastVerifiedAt",2);te([Y.json({includeInApi:!1,allowNull:!0})],_e.prototype,"metadata",2);_e=te([Wr("ff_auth.accounts",{allowApiCrud:[nt.FF_Role_Auth_Admin,gt.FF_Role_Admin],caption:"FF Auth - Accounts",changeLog:{excludeColumns:i=>[i.hashPassword,i.token]}})],_e);let rt=class{constructor(){f(this,"id");f(this,"expiresAt");f(this,"userId");f(this,"user")}};te([Y.string()],rt.prototype,"id",2);te([Y.date()],rt.prototype,"expiresAt",2);te([Y.string()],rt.prototype,"userId",2);te([or.toOne(()=>Me,"userId")],rt.prototype,"user",2);rt=te([Wr("ff_auth.users_sessions",{allowApiCrud:[nt.FF_Role_Auth_Admin,gt.FF_Role_Admin],caption:"FF Auth - Users sessions",changeLog:!1})],rt);let Ne=class extends ro{constructor(i,e){super(i,{...e})}};lr(Ne,"DEMO",new Ne("DEMO",{caption:"Demo"}));lr(Ne,"PASSWORD",new Ne("PASSWORD",{caption:"Password"}));lr(Ne,"OTP",new Ne("OTP",{caption:"TOTP"}));lr(Ne,"OAUTH",new Ne("OAUTH",{caption:"OAUTH"}));Ne=te([La()],Ne);var fo=Object.defineProperty,co=Object.getOwnPropertyDescriptor,xe=(i,e,t,r)=>{for(var n=co(e,t),s=i.length-1,a;s>=0;s--)(a=i[s])&&(n=a(e,t,n)||n);return n&&fo(e,t,n),n},we,ke;const Le=(we=class{static _setAbstraction(e){Zr(this,ke,e)}static async signOut(){return await Re(we,ke).signOut()}static async signInDemo(e){return await Re(we,ke).signInDemo(e)}static async invite(e){return await Re(we,ke).invite(e)}static async signUpPassword(e,t){return await Re(we,ke).signUpPassword(e,t)}static async signInPassword(e,t){return await Re(we,ke).signInPassword(e,t)}static async forgotPassword(e){return await Re(we,ke).forgotPassword(e)}static async resetPassword(e,t){return await Re(we,ke).resetPassword(e,t)}static async signInOTP(e){return await Re(we,ke).signInOTP(e)}static async verifyOtp(e,t){return await Re(we,ke).verifyOtp(e,t)}static async signInOAuthGetUrl(e){return await Re(we,ke).signInOAuthGetUrl(e)}},ke=new WeakMap,Yr(we,ke),we);xe([qe({allowed:!0})],Le,"signOut");xe([qe({allowed:!0})],Le,"signInDemo");xe([qe({allowed:nt.FF_Role_Auth_Invite})],Le,"invite");xe([qe({allowed:!0})],Le,"signUpPassword");xe([qe({allowed:!0})],Le,"signInPassword");xe([qe({allowed:!0})],Le,"forgotPassword");xe([qe({allowed:!0})],Le,"resetPassword");xe([qe({allowed:!0})],Le,"signInOTP");xe([qe({allowed:!0})],Le,"verifyOtp");xe([qe({allowed:!0})],Le,"signInOAuthGetUrl");let Mt=Le;function Ve(i){i.focus()}var ho=ue('<div class="login"><p> </p> <form class="svelte-skcj83"><input required type="email"/> <button> </button></form></div>');function yo(i,e){ze(e,!1);let t=Ee(e,"firstlyDataAuth",8),r=Ee(e,"email",12,""),n=Ie(""),s=Ie(""),a=Ie(!1);async function o(){Z(n,""),Z(s,""),Z(a,!0);try{const w=await Mt.forgotPassword(r());Z(s,w.message??"")}catch(w){w&&Z(n,w.message??""),Z(a,!1)}}pt();var l=ho(),u=Q(l);let d;var c=Q(u),h=G(u,2),y=Q(h);nr(y,w=>Ve==null?void 0:Ve(w)),it(()=>tt(y,r));var p=G(y,2),b=Q(p);Ce((w,P)=>{d=mt(u,1,"message",null,d,w),oe(c,`${V(n)??""}${V(s)??""}`),$e(y,"placeholder",(ae(t()),le(()=>{var k;return(k=t().ui)==null?void 0:k.strings.email_placeholder}))),p.disabled=P,oe(b,(ae(t()),le(()=>{var k;return(k=t().ui)==null?void 0:k.strings.send_password_reset_instructions})))},[()=>({error:V(n),success:V(s)}),()=>(ae(r()),V(a),le(()=>!r()||!r().includes("@")||!r().includes(".")||V(a)))],ir),Dt("submit",h,sr(o)),X(i,l),Ke()}var po=(i,e,t)=>e(V(t).name),mo=ue('<div class="oauth-button-icon svelte-1dwkktf"><!></div>'),go=ue('<button class="oauth-button svelte-1dwkktf"><!> <span> </span></button>'),wo=ue('<hr style="margin: 1rem"/> <div class="oauth-container svelte-1dwkktf"></div>',1);function qi(i,e){ze(e,!0);const t=async a=>{const o=await Mt.signInOAuthGetUrl({provider:a,redirect:new URL(window.location.href).searchParams.get("redirect")??"/"});window.location.href=o};var r=St(),n=Se(r);{var s=a=>{var o=wo(),l=G(Se(o),2);hs(l,21,()=>{var u;return((u=e.firstlyDataAuth)==null?void 0:u.providers)??[]},u=>u.name,(u,d)=>{var c=go();c.__click=[po,t,d];var h=Q(c);{var y=w=>{var P=mo(),k=Q(P);ms(k,()=>V(d).raw_svg),X(w,P)};me(h,w=>{V(d).raw_svg&&w(y)})}var p=G(h,2),b=Q(p);Ce(()=>oe(b,V(d).label)),X(u,c)}),X(a,o)};me(n,a=>{var o;(((o=e.firstlyDataAuth)==null?void 0:o.providers)??[].length!==0)&&a(s)})}X(i,r),Ke()}Ji(["click"]);var vo=ue('<div class="login"><p> </p> <form class="svelte-skcj83"> <input type="password" required/> <input type="password" required/> <button> </button></form></div>');function bo(i,e){ze(e,!1);let t=Ee(e,"firstlyDataAuth",8),r=Ee(e,"password1",12,""),n=Ee(e,"password2",12,""),s=Ie(""),a=Ie(""),o=Ie(!1);async function l(){Z(s,""),Z(a,""),Z(o,!0);const T=new URL(location.href).searchParams.get("token");try{const g=await Mt.resetPassword(T??"",r());Z(a,g.message??""),window.location.href="/"}catch(g){g&&Z(s,g.message??""),Z(o,!1)}}pt();var u=vo(),d=Q(u);let c;var h=Q(d),y=G(d,2),p=Q(y),b=G(p),w=G(b),P=G(w),k=G(P,2),M=Q(k);Ce(T=>{c=mt(d,1,"message",null,c,T),oe(h,`${V(s)??""}${V(a)??""}`),oe(p,`${ae(t()),le(()=>{var g;return(g=t().ui)==null?void 0:g.strings.password})??""} `),$e(b,"placeholder",(ae(t()),le(()=>{var g;return(g=t().ui)==null?void 0:g.strings.password_placeholder}))),oe(w,` ${ae(t()),le(()=>{var g;return(g=t().ui)==null?void 0:g.strings.confirm})??""} `),$e(P,"placeholder",(ae(t()),le(()=>{var g;return(g=t().ui)==null?void 0:g.strings.password_placeholder}))),k.disabled=!r()||!n()||V(o),oe(M,(ae(t()),le(()=>{var g;return(g=t().ui)==null?void 0:g.strings.reset})))},[()=>({error:V(s)})],ir),tt(b,r),tt(P,n),Dt("submit",y,sr(l)),X(i,u),Ke()}var _o=ue('<form class="svelte-skcj83"><p> </p> <label> <input required type="email"/></label> <label> <input required type="password"/></label> <button> </button></form>');function Io(i,e){ze(e,!1);let t=Ee(e,"firstlyDataAuth",8),r=Ee(e,"view",8,"login"),n=Ee(e,"email",12,""),s=Ie(""),a=Ie(""),o=Ie(),l=Ie(!1);async function u(){Z(s,""),Z(a,""),Z(l,!0);try{await Mt.signInPassword(n(),V(o)),window.location.href=new URL(window.location.href).searchParams.get("redirect")??"/"}catch(y){y&&Z(s,y.message??""),Z(l,!1)}}pt();var d=St(),c=Se(d);{var h=y=>{var p=_o(),b=Q(p);let w;var P=Q(b),k=G(b,2),M=Q(k),T=G(M);it(()=>tt(T,n)),nr(T,C=>Ve==null?void 0:Ve(C));var g=G(k,2),O=Q(g),F=G(O),N=G(g,2),E=Q(N);Ce(C=>{w=mt(b,1,"message",null,w,C),oe(P,`${V(s)??""}${V(a)??""}`),oe(M,`${ae(t()),le(()=>{var I;return(I=t().ui)==null?void 0:I.strings.email})??""} `),$e(T,"placeholder",(ae(t()),le(()=>{var I;return(I=t().ui)==null?void 0:I.strings.email_placeholder}))),oe(O,`${ae(t()),le(()=>{var I;return(I=t().ui)==null?void 0:I.strings.password})??""} `),$e(F,"placeholder",(ae(t()),le(()=>{var I;return(I=t().ui)==null?void 0:I.strings.password_placeholder}))),N.disabled=!n()||!V(o)||V(l),oe(E,(ae(t()),le(()=>{var I;return(I=t().ui)==null?void 0:I.strings.btn_sign_in})))},[()=>({error:V(s)})],ir),tt(F,()=>V(o),C=>Z(o,C)),Dt("submit",p,sr(u)),X(y,p)};me(c,y=>{r()=="login"&&y(h)})}X(i,d),Ke()}var Oo=ue('<form class="svelte-skcj83"><p> </p> <label> <input required type="email"/></label> <label> <input required type="password"/></label> <button> </button></form>');function ko(i,e){ze(e,!1);let t=Ee(e,"firstlyDataAuth",8),r=Ee(e,"view",8,"login"),n=Ee(e,"email",12,""),s=Ie(""),a=Ie(""),o=Ie(),l=Ie(!1);async function u(){Z(s,""),Z(a,""),Z(l,!0);try{const y=await Mt.signUpPassword(n(),V(o));Z(a,y.message??""),await new Promise(p=>setTimeout(p,5e3)),window.location.href=new URL(window.location.href).searchParams.get("redirect")??"/"}catch(y){y&&Z(s,y.message??""),Z(l,!1)}}pt();var d=St(),c=Se(d);{var h=y=>{var p=Oo(),b=Q(p);let w;var P=Q(b),k=G(b,2),M=Q(k),T=G(M);it(()=>tt(T,n)),nr(T,C=>Ve==null?void 0:Ve(C));var g=G(k,2),O=Q(g),F=G(O),N=G(g,2),E=Q(N);Ce(C=>{w=mt(b,1,"message",null,w,C),oe(P,`${V(s)??""}${V(a)??""}`),oe(M,`${ae(t()),le(()=>{var I;return(I=t().ui)==null?void 0:I.strings.email})??""} `),$e(T,"placeholder",(ae(t()),le(()=>{var I;return(I=t().ui)==null?void 0:I.strings.email_placeholder}))),oe(O,`${ae(t()),le(()=>{var I;return(I=t().ui)==null?void 0:I.strings.password})??""} `),$e(F,"placeholder",(ae(t()),le(()=>{var I;return(I=t().ui)==null?void 0:I.strings.password_placeholder}))),N.disabled=!n()||!V(o)||V(l),oe(E,(ae(t()),le(()=>{var I;return(I=t().ui)==null?void 0:I.strings.btn_sign_up})))},[()=>({error:V(s)})],ir),tt(F,()=>V(o),C=>Z(o,C)),Dt("submit",p,sr(u)),X(y,p)};me(c,y=>{r()=="login"&&y(h)})}X(i,d),Ke()}var Co=ue('<h1 class="svelte-1jjivcr"> </h1>'),Ao=ue('<!> <div class="form-footer svelte-1jjivcr"><!></div> <!>',1),Eo=ue("<hr/> <!>",1),To=ue('<!> <div class="form-footer svelte-1jjivcr"><!> <!></div> <!>',1),So=ue('<!> <div class="form-footer svelte-1jjivcr"><!></div>',1),Fo=ue('<!> <div class="form-footer svelte-1jjivcr"><!></div>',1),Po=ue('<div class="form svelte-1jjivcr"><!> <!> <!> <!> <!></div>'),Ro=ue('<img alt="Authentication" class="svelte-1jjivcr"/>'),Do=ue('<div class="split-layout svelte-1jjivcr"><div class="form-side svelte-1jjivcr"><!></div> <div class="image-side svelte-1jjivcr"><!></div></div>'),Mo=ue('<div class="centered-layout svelte-1jjivcr"><!></div>'),No=ue('<div class="fallback svelte-1jjivcr"><small>- 404 -</small></div> <div class="fallback svelte-1jjivcr"><small>Nothing to see here</small></div>',1),Lo=ue("<!> <!>",1),$o=ue("<div><!></div>");function Bo(i,e){ze(e,!0);const t=u=>{var d=Po(),c=Q(d);{var h=g=>{var O=Co(),F=Q(O);Ce(()=>oe(F,r.ui.strings.app_name)),X(g,O)};me(c,g=>{var O;(O=r.ui)!=null&&O.strings.app_name&&g(h)})}var y=G(c,2);{var p=g=>{const O=wt(()=>{var F;return(F=r.ui)==null?void 0:F.paths.sign_up});at(g,{get path(){return V(O)},children:(F,N)=>{var E=Ao(),C=Se(E);ko(C,{get firstlyDataAuth(){return r},get email(){return V(n)},set email(x){Z(n,x,!0)}});var I=G(C,2),v=Q(I);{var S=x=>{It(x,{get href(){return r.ui.paths.sign_in},children:(ee,W)=>{var fe=vt();Ce(()=>oe(fe,r.ui.strings.back_to_sign_in)),X(ee,fe)},$$slots:{default:!0}})};me(v,x=>{r.ui.paths.sign_in&&x(S)})}var $=G(I,2);qi($,{get firstlyDataAuth(){return r}}),X(F,E)},$$slots:{default:!0}})};me(y,g=>{var O;(O=r.ui)!=null&&O.paths.sign_up&&g(p)})}var b=G(y,2);{var w=g=>{const O=wt(()=>{var F;return(F=r.ui)==null?void 0:F.paths.sign_in});at(g,{get path(){return V(O)},children:(F,N)=>{var E=To(),C=Se(E);Io(C,{get firstlyDataAuth(){return r},get email(){return V(n)},set email(W){Z(n,W,!0)}});var I=G(C,2),v=Q(I);{var S=W=>{It(W,{get href(){return r.ui.paths.forgot_password},children:(fe,He)=>{var Be=vt();Ce(()=>oe(Be,r.ui.strings.forgot_password)),X(fe,Be)},$$slots:{default:!0}})};me(v,W=>{var fe;(fe=r.ui)!=null&&fe.paths.forgot_password&&W(S)})}var $=G(v,2);{var x=W=>{var fe=Eo(),He=G(Se(fe),2);It(He,{get href(){return r.ui.paths.sign_up},children:(Be,ur)=>{var se=vt();Ce(()=>oe(se,r.ui.strings.btn_sign_up)),X(Be,se)},$$slots:{default:!0}}),X(W,fe)};me($,W=>{var fe;(fe=r.ui)!=null&&fe.paths.sign_up&&W(x)})}var ee=G(I,2);qi(ee,{get firstlyDataAuth(){return r}}),X(F,E)},$$slots:{default:!0}})};me(b,g=>{var O;(O=r.ui)!=null&&O.paths.sign_in&&g(w)})}var P=G(b,2);{var k=g=>{const O=wt(()=>{var F;return(F=r.ui)==null?void 0:F.paths.forgot_password});at(g,{get path(){return V(O)},children:(F,N)=>{var E=So(),C=Se(E);yo(C,{get firstlyDataAuth(){return r},get email(){return V(n)},set email($){Z(n,$,!0)}});var I=G(C,2),v=Q(I);{var S=$=>{It($,{get href(){return r.ui.paths.sign_in},children:(x,ee)=>{var W=vt();Ce(()=>oe(W,r.ui.strings.back_to_sign_in)),X(x,W)},$$slots:{default:!0}})};me(v,$=>{var x;(x=r.ui)!=null&&x.paths.sign_in&&$(S)})}X(F,E)},$$slots:{default:!0}})};me(P,g=>{var O;(O=r.ui)!=null&&O.paths.forgot_password&&g(k)})}var M=G(P,2);{var T=g=>{const O=wt(()=>{var F;return(F=r.ui)==null?void 0:F.paths.reset_password});at(g,{get path(){return V(O)},children:(F,N)=>{var E=Fo(),C=Se(E);bo(C,{get firstlyDataAuth(){return r}});var I=G(C,2),v=Q(I);{var S=$=>{It($,{get href(){return r.ui.paths.sign_in},children:(x,ee)=>{var W=vt();Ce(()=>oe(W,r.ui.strings.back_to_sign_in)),X(x,W)},$$slots:{default:!0}})};me(v,$=>{var x;(x=r.ui)!=null&&x.paths.sign_in&&$(S)})}X(F,E)},$$slots:{default:!0}})};me(M,g=>{var O;(O=r.ui)!=null&&O.paths.reset_password&&g(T)})}X(u,d)};let r=e.firstlyData.props,n=ys(""),s=wt(()=>{var u,d;return!!((d=(u=r.ui)==null?void 0:u.images)!=null&&d.main)});var a=$o();let o;var l=Q(a);at(l,{children:(u,d)=>{var c=Lo(),h=Se(c);{var y=w=>{var P=Do(),k=Q(P),M=Q(k);t(M);var T=G(k,2),g=Q(T);{var O=F=>{var N=Ro();Ce(()=>$e(N,"src",r.ui.images.main)),X(F,N)};me(g,F=>{var N,E;(E=(N=r.ui)==null?void 0:N.images)!=null&&E.main&&F(O)})}X(w,P)},p=w=>{var P=Mo(),k=Q(P);t(k),X(w,P)};me(h,w=>{V(s)?w(y):w(p,!1)})}var b=G(h,2);at(b,{fallback:!0,children:(w,P)=>{var k=No();X(w,k)},$$slots:{default:!0}}),X(u,c)},$$slots:{default:!0}}),Ce(u=>o=mt(a,1,"wrapper svelte-1jjivcr",null,o,u),[()=>({"with-image":V(s)})]),X(i,a),Ke()}export{Bo as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aa as t,U as o}from"./index-AoBb9Ds5.js";function r(a){var e=t("Hello from files");o(a,e)}export{r as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Page-
|
|
2
|
-
var On=Object.defineProperty;var Cn=(e,t,n)=>t in e?On(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var je=(e,t,n)=>Cn(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const u of i)if(u.type==="childList")for(const a of u.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const u={};return i.integrity&&(u.integrity=i.integrity),i.referrerPolicy&&(u.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?u.credentials="include":i.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function r(i){if(i.ep)return;i.ep=!0;const u=n(i);fetch(i.href,u)}})();const xt=!1;var tt=Array.isArray,Nn=Array.prototype.indexOf,nt=Array.from,Ut=Object.defineProperty,re=Object.getOwnPropertyDescriptor,In=Object.getOwnPropertyDescriptors,Dn=Object.prototype,Rn=Array.prototype,Vt=Object.getPrototypeOf,Tt=Object.isExtensible;const W=()=>{};function Ln(e){return typeof(e==null?void 0:e.then)=="function"}function Mn(e){return e()}function de(e){for(var t=0;t<e.length;t++)e[t]()}const L=2,jt=4,Le=8,rt=16,j=32,le=64,it=128,I=256,Oe=512,D=1024,V=2048,X=4096,B=8192,ut=16384,Ht=32768,lt=65536,At=1<<17,kn=1<<18,$t=1<<19,Ge=1<<20,G=Symbol("$state"),Fn=Symbol("legacy props"),ri=Symbol(""),Yt=new class extends Error{constructor(){super(...arguments);je(this,"name","StaleReactionError");je(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function Kt(e){return e===this.v}function Wt(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Gt(e){return!Wt(e,this.v)}function qn(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Bn(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Un(e){throw new Error("https://svelte.dev/e/effect_orphan")}function Vn(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function jn(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function Hn(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function $n(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Yn(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}let fe=!1,Kn=!1;function Wn(){fe=!0}const ft=1,st=2,zt=4,Gn=8,zn=16,Zn=1,Xn=2,Zt=4,Jn=8,Qn=16,er=1,tr=2,P=Symbol(),ui="http://www.w3.org/1999/xhtml",li="@attach";function ot(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}let E=null;function Ce(e){E=e}function fi(e){return at().get(e)}function si(e,t){return at().set(e,t),t}function oi(e){return at().has(e)}function Xt(e,t=!1,n){var r=E={p:E,c:null,d:!1,e:null,m:!1,s:e,x:null,l:null};fe&&!t&&(E.l={s:null,u:null,r1:[],r2:z(!1)}),ct(()=>{r.d=!0})}function Jt(e){const t=E;if(t!==null){const a=t.e;if(a!==null){var n=y,r=w;t.e=null;try{for(var i=0;i<a.length;i++){var u=a[i];q(u.effect),M(u.reaction),sn(u.fn)}}finally{q(n),M(r)}}E=t.p,t.m=!0}return{}}function Ee(){return!fe||E!==null&&E.l===null}function at(e){return E===null&&ot(),E.c??(E.c=new Map(nr(E)||void 0))}function nr(e){let t=e.p;for(;t!==null;){const n=t.c;if(n!==null)return n;t=t.p}return null}function ne(e){if(typeof e!="object"||e===null||G in e)return e;const t=Vt(e);if(t!==Dn&&t!==Rn)return e;var n=new Map,r=tt(e),i=$(0),u=w,a=f=>{var o=w;M(u);var l=f();return M(o),l};return r&&n.set("length",$(e.length)),new Proxy(e,{defineProperty(f,o,l){(!("value"in l)||l.configurable===!1||l.enumerable===!1||l.writable===!1)&&Hn();var c=n.get(o);return c===void 0?c=a(()=>{var v=$(l.value);return n.set(o,v),v}):N(c,l.value,!0),!0},deleteProperty(f,o){var l=n.get(o);if(l===void 0){if(o in f){const s=a(()=>$(P));n.set(o,s),He(i)}}else{if(r&&typeof o=="string"){var c=n.get("length"),v=Number(o);Number.isInteger(v)&&v<c.v&&N(c,v)}N(l,P),He(i)}return!0},get(f,o,l){var d;if(o===G)return e;var c=n.get(o),v=o in f;if(c===void 0&&(!v||(d=re(f,o))!=null&&d.writable)&&(c=a(()=>{var _=ne(v?f[o]:P),b=$(_);return b}),n.set(o,c)),c!==void 0){var s=T(c);return s===P?void 0:s}return Reflect.get(f,o,l)},getOwnPropertyDescriptor(f,o){var l=Reflect.getOwnPropertyDescriptor(f,o);if(l&&"value"in l){var c=n.get(o);c&&(l.value=T(c))}else if(l===void 0){var v=n.get(o),s=v==null?void 0:v.v;if(v!==void 0&&s!==P)return{enumerable:!0,configurable:!0,value:s,writable:!0}}return l},has(f,o){var s;if(o===G)return!0;var l=n.get(o),c=l!==void 0&&l.v!==P||Reflect.has(f,o);if(l!==void 0||y!==null&&(!c||(s=re(f,o))!=null&&s.writable)){l===void 0&&(l=a(()=>{var d=c?ne(f[o]):P,_=$(d);return _}),n.set(o,l));var v=T(l);if(v===P)return!1}return c},set(f,o,l,c){var x;var v=n.get(o),s=o in f;if(r&&o==="length")for(var d=l;d<v.v;d+=1){var _=n.get(d+"");_!==void 0?N(_,P):d in f&&(_=a(()=>$(P)),n.set(d+"",_))}if(v===void 0)(!s||(x=re(f,o))!=null&&x.writable)&&(v=a(()=>$(void 0)),N(v,ne(l)),n.set(o,v));else{s=v.v!==P;var b=a(()=>ne(l));N(v,b)}var h=Reflect.getOwnPropertyDescriptor(f,o);if(h!=null&&h.set&&h.set.call(c,l),!s){if(r&&typeof o=="string"){var m=n.get("length"),p=Number(o);Number.isInteger(p)&&p>=m.v&&N(m,p+1)}He(i)}return!0},ownKeys(f){T(i);var o=Reflect.ownKeys(f).filter(v=>{var s=n.get(v);return s===void 0||s.v!==P});for(var[l,c]of n)c.v!==P&&!(l in f)&&o.push(l);return o},setPrototypeOf(){$n()}})}function He(e,t=1){N(e,e.v+t)}function St(e){try{if(e!==null&&typeof e=="object"&&G in e)return e[G]}catch{}return e}function ai(e,t){return Object.is(St(e),St(t))}function ye(e){var t=L|V,n=w!==null&&(w.f&L)!==0?w:null;return y===null||n!==null&&(n.f&I)!==0?t|=I:y.f|=$t,{ctx:E,deps:null,effects:null,equals:Kt,f:t,fn:e,reactions:null,rv:0,v:null,wv:0,parent:n??y,ac:null}}function ci(e){const t=ye(e);return hn(t),t}function ve(e){const t=ye(e);return t.equals=Gt,t}function Qt(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)Z(t[n])}}function rr(e){for(var t=e.parent;t!==null;){if((t.f&L)===0)return t;t=t.parent}return null}function en(e){var t,n=y;q(rr(e));try{Qt(e),t=wn(e)}finally{q(n)}return t}function tn(e){var t=en(e);if(e.equals(t)||(e.v=t,e.wv=gn()),!oe){var n=(K||(e.f&I)!==0)&&e.deps!==null?X:D;k(e,n)}}const pe=new Map;function z(e,t){var n={f:0,v:e,reactions:null,equals:Kt,rv:0,wv:0};return n}function $(e,t){const n=z(e);return hn(n),n}function he(e,t=!1,n=!0){var i;const r=z(e);return t||(r.equals=Gt),fe&&n&&E!==null&&E.l!==null&&((i=E.l).s??(i.s=[])).push(r),r}function N(e,t,n=!1){w!==null&&(!F||(w.f&At)!==0)&&Ee()&&(w.f&(L|rt|At))!==0&&!(S!=null&&S[1].includes(e)&&S[0]===w)&&Yn();let r=n?ne(t):t;return ie(e,r)}function ie(e,t){if(!e.equals(t)){var n=e.v;oe?pe.set(e,t):pe.set(e,n),e.v=t,(e.f&L)!==0&&((e.f&V)!==0&&en(e),k(e,(e.f&I)===0?D:X)),e.wv=gn(),nn(e,V),Ee()&&y!==null&&(y.f&D)!==0&&(y.f&(j|le))===0&&(R===null?pr([e]):R.push(e))}return t}function Pt(e,t=1){var n=T(e),r=t===1?n++:n--;return N(e,n),r}function nn(e,t){var n=e.reactions;if(n!==null)for(var r=Ee(),i=n.length,u=0;u<i;u++){var a=n[u],f=a.f;(f&V)===0&&(!r&&a===y||(k(a,t),(f&(D|I))!==0&&((f&L)!==0?nn(a,X):dt(a))))}}let ir=!1;var Ot,rn,un,ln;function ur(){if(Ot===void 0){Ot=window,rn=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;un=re(t,"firstChild").get,ln=re(t,"nextSibling").get,Tt(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),Tt(n)&&(n.__t=void 0)}}function Me(e=""){return document.createTextNode(e)}function Ne(e){return un.call(e)}function ke(e){return ln.call(e)}function Ct(e,t){return Ne(e)}function $e(e,t){{var n=Ne(e);return n instanceof Comment&&n.data===""?ke(n):n}}function Nt(e,t=1,n=!1){let r=e;for(;t--;)r=ke(r);return r}function lr(e){e.textContent=""}function fn(e){y===null&&w===null&&Un(),w!==null&&(w.f&I)!==0&&y===null&&Bn(),oe&&qn()}function fr(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function se(e,t,n,r=!0){var i=y,u={ctx:E,deps:null,nodes_start:null,nodes_end:null,f:e|V,first:null,fn:t,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(n)try{Be(u),u.f|=Ht}catch(o){throw Z(u),o}else t!==null&&dt(u);var a=n&&u.deps===null&&u.first===null&&u.nodes_start===null&&u.teardown===null&&(u.f&($t|it))===0;if(!a&&r&&(i!==null&&fr(u,i),w!==null&&(w.f&L)!==0)){var f=w;(f.effects??(f.effects=[])).push(u)}return u}function ct(e){const t=se(Le,null,!1);return k(t,D),t.teardown=e,t}function ze(e){fn();var t=y!==null&&(y.f&j)!==0&&E!==null&&!E.m;if(t){var n=E;(n.e??(n.e=[])).push({fn:e,effect:y,reaction:w})}else{var r=sn(e);return r}}function sr(e){return fn(),vt(e)}function or(e){const t=se(le,e,!0);return(n={})=>new Promise(r=>{n.outro?J(t,()=>{Z(t),r(void 0)}):(Z(t),r(void 0))})}function sn(e){return se(jt,e,!1)}function vi(e,t){var n=E,r={effect:null,ran:!1};n.l.r1.push(r),r.effect=vt(()=>{e(),!r.ran&&(r.ran=!0,N(n.l.r2,!0),U(t))})}function _i(){var e=E;vt(()=>{if(T(e.l.r2)){for(var t of e.l.r1){var n=t.effect;(n.f&D)!==0&&k(n,X),xe(n)&&Be(n),t.ran=!1}e.l.r2.v=!1}})}function vt(e){return se(Le,e,!0)}function It(e,t=[],n=ye){const r=t.map(n);return Fe(()=>e(...r.map(T)))}function Fe(e,t=0){var n=se(Le|rt|t,e,!0);return n}function ue(e,t=!0){return se(Le|j,e,!0,t)}function on(e){var t=e.teardown;if(t!==null){const n=oe,r=w;Dt(!0),M(null);try{t.call(null)}finally{Dt(n),M(r)}}}function an(e,t=!1){var i;var n=e.first;for(e.first=e.last=null;n!==null;){(i=n.ac)==null||i.abort(Yt);var r=n.next;(n.f&le)!==0?n.parent=null:Z(n,t),n=r}}function ar(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&j)===0&&Z(t),t=n}}function Z(e,t=!0){var n=!1;(t||(e.f&kn)!==0)&&e.nodes_start!==null&&e.nodes_end!==null&&(cr(e.nodes_start,e.nodes_end),n=!0),an(e,t&&!n),De(e,0),k(e,ut);var r=e.transitions;if(r!==null)for(const u of r)u.stop();on(e);var i=e.parent;i!==null&&i.first!==null&&cn(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes_start=e.nodes_end=e.ac=null}function cr(e,t){for(;e!==null;){var n=e===t?null:ke(e);e.remove(),e=n}}function cn(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function J(e,t){var n=[];_t(e,n,!0),vn(n,()=>{Z(e),t&&t()})}function vn(e,t){var n=e.length;if(n>0){var r=()=>--n||t();for(var i of e)i.out(r)}else t()}function _t(e,t,n){if((e.f&B)===0){if(e.f^=B,e.transitions!==null)for(const a of e.transitions)(a.is_global||n)&&t.push(a);for(var r=e.first;r!==null;){var i=r.next,u=(r.f<)!==0||(r.f&j)!==0;_t(r,t,u?n:!1),r=i}}}function me(e){_n(e,!0)}function _n(e,t){if((e.f&B)!==0){e.f^=B;for(var n=e.first;n!==null;){var r=n.next,i=(n.f<)!==0||(n.f&j)!==0;_n(n,i?t:!1),n=r}if(e.transitions!==null)for(const u of e.transitions)(u.is_global||t)&&u.in()}}let ge=[],Ze=[];function dn(){var e=ge;ge=[],de(e)}function vr(){var e=Ze;Ze=[],de(e)}function qe(e){ge.length===0&&queueMicrotask(dn),ge.push(e)}function _r(){ge.length>0&&dn(),Ze.length>0&&vr()}function dr(e){var t=y;if((t.f&Ht)===0){if((t.f&it)===0)throw e;t.fn(e)}else pn(e,t)}function pn(e,t){for(;t!==null;){if((t.f&it)!==0)try{t.b.error(e);return}catch{}t=t.parent}throw e}let be=!1,we=null,Q=!1,oe=!1;function Dt(e){oe=e}let _e=[];let w=null,F=!1;function M(e){w=e}let y=null;function q(e){y=e}let S=null;function hn(e){w!==null&&w.f&Ge&&(S===null?S=[w,[e]]:S[1].push(e))}let O=null,C=0,R=null;function pr(e){R=e}let mn=1,Ie=0,K=!1;function gn(){return++mn}function xe(e){var v;var t=e.f;if((t&V)!==0)return!0;if((t&X)!==0){var n=e.deps,r=(t&I)!==0;if(n!==null){var i,u,a=(t&Oe)!==0,f=r&&y!==null&&!K,o=n.length;if(a||f){var l=e,c=l.parent;for(i=0;i<o;i++)u=n[i],(a||!((v=u==null?void 0:u.reactions)!=null&&v.includes(l)))&&(u.reactions??(u.reactions=[])).push(l);a&&(l.f^=Oe),f&&c!==null&&(c.f&I)===0&&(l.f^=I)}for(i=0;i<o;i++)if(u=n[i],xe(u)&&tn(u),u.wv>e.wv)return!0}(!r||y!==null&&!K)&&k(e,D)}return!1}function bn(e,t,n=!0){var r=e.reactions;if(r!==null)for(var i=0;i<r.length;i++){var u=r[i];S!=null&&S[1].includes(e)&&S[0]===w||((u.f&L)!==0?bn(u,t,!1):t===u&&(n?k(u,V):(u.f&D)!==0&&k(u,X),dt(u)))}}function wn(e){var d;var t=O,n=C,r=R,i=w,u=K,a=S,f=E,o=F,l=e.f;O=null,C=0,R=null,K=(l&I)!==0&&(F||!Q||w===null),w=(l&(j|le))===0?e:null,S=null,Ce(e.ctx),F=!1,Ie++,e.f|=Ge,e.ac!==null&&(e.ac.abort(Yt),e.ac=null);try{var c=(0,e.fn)(),v=e.deps;if(O!==null){var s;if(De(e,C),v!==null&&C>0)for(v.length=C+O.length,s=0;s<O.length;s++)v[C+s]=O[s];else e.deps=v=O;if(!K||(l&L)!==0&&e.reactions!==null)for(s=C;s<v.length;s++)((d=v[s]).reactions??(d.reactions=[])).push(e)}else v!==null&&C<v.length&&(De(e,C),v.length=C);if(Ee()&&R!==null&&!F&&v!==null&&(e.f&(L|X|V))===0)for(s=0;s<R.length;s++)bn(R[s],e);return i!==null&&i!==e&&(Ie++,R!==null&&(r===null?r=R:r.push(...R))),c}catch(_){dr(_)}finally{O=t,C=n,R=r,w=i,K=u,S=a,Ce(f),F=o,e.f^=Ge}}function hr(e,t){let n=t.reactions;if(n!==null){var r=Nn.call(n,e);if(r!==-1){var i=n.length-1;i===0?n=t.reactions=null:(n[r]=n[i],n.pop())}}n===null&&(t.f&L)!==0&&(O===null||!O.includes(t))&&(k(t,X),(t.f&(I|Oe))===0&&(t.f^=Oe),Qt(t),De(t,0))}function De(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)hr(e,n[r])}function Be(e){var t=e.f;if((t&ut)===0){k(e,D);var n=y,r=Q;y=e,Q=!0;try{(t&rt)!==0?ar(e):an(e),on(e);var i=wn(e);e.teardown=typeof i=="function"?i:null,e.wv=mn;var u;xt&&Kn&&(e.f&V)!==0&&e.deps}finally{Q=r,y=n}}}function mr(){try{Vn()}catch(e){if(we!==null)pn(e,we);else throw e}}function En(){var e=Q;try{var t=0;for(Q=!0;_e.length>0;){t++>1e3&&mr();var n=_e,r=n.length;_e=[];for(var i=0;i<r;i++){var u=br(n[i]);gr(u)}pe.clear()}}finally{be=!1,Q=e,we=null}}function gr(e){var t=e.length;if(t!==0)for(var n=0;n<t;n++){var r=e[n];(r.f&(ut|B))===0&&xe(r)&&(Be(r),r.deps===null&&r.first===null&&r.nodes_start===null&&(r.teardown===null?cn(r):r.fn=null))}}function dt(e){be||(be=!0,queueMicrotask(En));for(var t=we=e;t.parent!==null;){t=t.parent;var n=t.f;if((n&(le|j))!==0){if((n&D)===0)return;t.f^=D}}_e.push(t)}function br(e){for(var t=[],n=e;n!==null;){var r=n.f,i=(r&(j|le))!==0,u=i&&(r&D)!==0;if(!u&&(r&B)===0){(r&jt)!==0?t.push(n):i?n.f^=D:xe(n)&&Be(n);var a=n.first;if(a!==null){n=a;continue}}var f=n.parent;for(n=n.next;n===null&&f!==null;)n=f.next,f=f.parent}return t}function wr(e){for(var t;;){if(_r(),_e.length===0)return be=!1,we=null,t;be=!0,En()}}function T(e){var t=e.f,n=(t&L)!==0;if(w!==null&&!F){if(!(S!=null&&S[1].includes(e))||S[0]!==w){var r=w.deps;e.rv<Ie&&(e.rv=Ie,O===null&&r!==null&&r[C]===e?C++:O===null?O=[e]:(!K||!O.includes(e))&&O.push(e))}}else if(n&&e.deps===null&&e.effects===null){var i=e,u=i.parent;u!==null&&(u.f&I)===0&&(i.f^=I)}return n&&(i=e,xe(i)&&tn(i)),oe&&pe.has(e)?pe.get(e):e.v}function U(e){var t=F;try{return F=!0,e()}finally{F=t}}const Er=-7169;function k(e,t){e.f=e.f&Er|t}function Xe(e){if(!(typeof e!="object"||!e||e instanceof EventTarget)){if(G in e)Je(e);else if(!Array.isArray(e))for(let t in e){const n=e[t];typeof n=="object"&&n&&G in n&&Je(n)}}}function Je(e,t=new Set){if(typeof e=="object"&&e!==null&&!(e instanceof EventTarget)&&!t.has(e)){t.add(e),e instanceof Date&&e.getTime();for(let r in e)try{Je(e[r],t)}catch{}const n=Vt(e);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){const r=In(n);for(let i in r){const u=r[i].get;if(u)try{u.call(e)}catch{}}}}}function di(e){return e.endsWith("capture")&&e!=="gotpointercapture"&&e!=="lostpointercapture"}const yr=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function pi(e){return yr.includes(e)}const xr={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function hi(e){return e=e.toLowerCase(),xr[e]??e}const Tr=["touchstart","touchmove"];function Ar(e){return Tr.includes(e)}function mi(e,t){if(t){const n=document.body;e.autofocus=!0,qe(()=>{document.activeElement===n&&e.focus()})}}let Rt=!1;function Sr(){Rt||(Rt=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(const n of e.target.elements)(t=n.__on_r)==null||t.call(n)})},{capture:!0}))}function yn(e){var t=w,n=y;M(null),q(null);try{return e()}finally{M(t),q(n)}}function gi(e,t,n,r=n){e.addEventListener(t,()=>yn(n));const i=e.__on_r;i?e.__on_r=()=>{i(),r(!0)}:e.__on_r=()=>r(!0),Sr()}const xn=new Set,Qe=new Set;function Pr(e,t,n,r={}){function i(u){if(r.capture||ce.call(t,u),!u.cancelBubble)return yn(()=>n==null?void 0:n.call(this,u))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?qe(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function Or(e,t,n,r,i){var u={capture:r,passive:i},a=Pr(e,t,n,u);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&ct(()=>{t.removeEventListener(e,a,u)})}function bi(e){for(var t=0;t<e.length;t++)xn.add(e[t]);for(var n of Qe)n(e)}function ce(e){var p;var t=this,n=t.ownerDocument,r=e.type,i=((p=e.composedPath)==null?void 0:p.call(e))||[],u=i[0]||e.target,a=0,f=e.__root;if(f){var o=i.indexOf(f);if(o!==-1&&(t===document||t===window)){e.__root=t;return}var l=i.indexOf(t);if(l===-1)return;o<=l&&(a=o)}if(u=i[a]||e.target,u!==t){Ut(e,"currentTarget",{configurable:!0,get(){return u||n}});var c=w,v=y;M(null),q(null);try{for(var s,d=[];u!==null;){var _=u.assignedSlot||u.parentNode||u.host||null;try{var b=u["__"+r];if(b!=null&&(!u.disabled||e.target===u))if(tt(b)){var[h,...m]=b;h.apply(u,[e,...m])}else b.call(u,e)}catch(x){s?d.push(x):s=x}if(e.cancelBubble||_===t||_===null)break;u=_}if(s){for(let x of d)queueMicrotask(()=>{throw x});throw s}}finally{e.__root=t,delete e.currentTarget,M(c),q(v)}}}function Cr(e){var t=document.createElement("template");return t.innerHTML=e.replaceAll("<!>","<!---->"),t.content}function Re(e,t){var n=y;n.nodes_start===null&&(n.nodes_start=e,n.nodes_end=t)}function pt(e,t){var n=(t&er)!==0,r=(t&tr)!==0,i,u=!e.startsWith("<!>");return()=>{i===void 0&&(i=Cr(u?e:"<!>"+e),n||(i=Ne(i)));var a=r||rn?document.importNode(i,!0):i.cloneNode(!0);if(n){var f=Ne(a),o=a.lastChild;Re(f,o)}else Re(a,a);return a}}function wi(e=""){{var t=Me(e+"");return Re(t,t),t}}function Nr(){var e=document.createDocumentFragment(),t=document.createComment(""),n=Me();return e.append(t,n),Re(t,n),e}function Ae(e,t){e!==null&&e.before(t)}function Lt(e,t){var n=t==null?"":typeof t=="object"?t+"":t;n!==(e.__t??(e.__t=e.nodeValue))&&(e.__t=n,e.nodeValue=n+"")}function Ir(e,t){return Dr(e,t)}const ee=new Map;function Dr(e,{target:t,anchor:n,props:r={},events:i,context:u,intro:a=!0}){ur();var f=new Set,o=v=>{for(var s=0;s<v.length;s++){var d=v[s];if(!f.has(d)){f.add(d);var _=Ar(d);t.addEventListener(d,ce,{passive:_});var b=ee.get(d);b===void 0?(document.addEventListener(d,ce,{passive:_}),ee.set(d,1)):ee.set(d,b+1)}}};o(nt(xn)),Qe.add(o);var l=void 0,c=or(()=>{var v=n??t.appendChild(Me());return ue(()=>{if(u){Xt({});var s=E;s.c=u}i&&(r.$$events=i),l=e(v,r)||{},u&&Jt()}),()=>{var _;for(var s of f){t.removeEventListener(s,ce);var d=ee.get(s);--d===0?(document.removeEventListener(s,ce),ee.delete(s)):ee.set(s,d)}Qe.delete(o),v!==n&&((_=v.parentNode)==null||_.removeChild(v))}});return Rr.set(l,c),l}let Rr=new WeakMap;const Ye=0,Se=1,Ke=2;function Lr(e,t,n,r,i){var u=e,a=Ee(),f=E,o=P,l,c,v,s=a?z(void 0):he(void 0,!1,!1),d=a?z(void 0):he(void 0,!1,!1),_=!1;function b(m,p){_=!0,p&&(q(h),M(h),Ce(f));try{m===Se&&r&&(c?me(c):c=ue(()=>r(u,s))),m!==Ye&&l&&J(l,()=>l=null),m!==Se&&c&&J(c,()=>c=null),m!==Ke&&v&&J(v,()=>v=null)}finally{p&&(Ce(null),M(null),q(null),wr())}}var h=Fe(()=>{if(o!==(o=t())){if(Ln(o)){var m=o;_=!1,m.then(p=>{m===o&&(ie(s,p),b(Se,!0))},p=>{if(m===o)throw ie(d,p),b(Ke,!0),d.v}),qe(()=>{_||b(Ye,!0)})}else ie(s,o),b(Se,!1);return()=>o=P}})}function Mt(e,t,[n,r]=[0,0]){var i=e,u=null,a=null,f=P,o=n>0?lt:0,l=!1;const c=(s,d=!0)=>{l=!0,v(d,s)},v=(s,d)=>{f!==(f=s)&&(f?(u?me(u):d&&(u=ue(()=>d(i))),a&&J(a,()=>{a=null})):(a?me(a):d&&(a=ue(()=>d(i,[n+1,r]))),u&&J(u,()=>{u=null})))};Fe(()=>{l=!1,t(c),l||v(null,null)},o)}function Mr(e,t){return t}function kr(e,t,n,r){for(var i=[],u=t.length,a=0;a<u;a++)_t(t[a].e,i,!0);var f=u>0&&i.length===0&&n!==null;if(f){var o=n.parentNode;lr(o),o.append(n),r.clear(),Y(e,t[0].prev,t[u-1].next)}vn(i,()=>{for(var l=0;l<u;l++){var c=t[l];f||(r.delete(c.k),Y(e,c.prev,c.next)),Z(c.e,!f)}})}function Fr(e,t,n,r,i,u=null){var a=e,f={flags:t,items:new Map,first:null},o=(t&zt)!==0;if(o){var l=e;a=l.appendChild(Me())}var c=null,v=!1,s=ve(()=>{var d=n();return tt(d)?d:d==null?[]:nt(d)});Fe(()=>{var d=T(s),_=d.length;v&&_===0||(v=_===0,qr(d,f,a,i,t,r,n),u!==null&&(_===0?c?me(c):c=ue(()=>u(a)):c!==null&&J(c,()=>{c=null})),T(s))})}function qr(e,t,n,r,i,u,a){var gt,bt,wt,Et;var f=(i&Gn)!==0,o=(i&(ft|st))!==0,l=e.length,c=t.items,v=t.first,s=v,d,_=null,b,h=[],m=[],p,x,g,A;if(f)for(A=0;A<l;A+=1)p=e[A],x=u(p,A),g=c.get(x),g!==void 0&&((gt=g.a)==null||gt.measure(),(b??(b=new Set)).add(g));for(A=0;A<l;A+=1){if(p=e[A],x=u(p,A),g=c.get(x),g===void 0){var Sn=s?s.e.nodes_start:n;_=Ur(Sn,t,_,_===null?t.first:_.next,p,x,A,r,i,a),c.set(x,_),h=[],m=[],s=_.next;continue}if(o&&Br(g,p,A,i),(g.e.f&B)!==0&&(me(g.e),f&&((bt=g.a)==null||bt.unfix(),(b??(b=new Set)).delete(g))),g!==s){if(d!==void 0&&d.has(g)){if(h.length<m.length){var Te=m[0],H;_=Te.prev;var mt=h[0],Ue=h[h.length-1];for(H=0;H<h.length;H+=1)kt(h[H],Te,n);for(H=0;H<m.length;H+=1)d.delete(m[H]);Y(t,mt.prev,Ue.next),Y(t,_,mt),Y(t,Ue,Te),s=Te,_=Ue,A-=1,h=[],m=[]}else d.delete(g),kt(g,s,n),Y(t,g.prev,g.next),Y(t,g,_===null?t.first:_.next),Y(t,_,g),_=g;continue}for(h=[],m=[];s!==null&&s.k!==x;)(s.e.f&B)===0&&(d??(d=new Set)).add(s),m.push(s),s=s.next;if(s===null)continue;g=s}h.push(g),_=g,s=g.next}if(s!==null||d!==void 0){for(var ae=d===void 0?[]:nt(d);s!==null;)(s.e.f&B)===0&&ae.push(s),s=s.next;var Ve=ae.length;if(Ve>0){var Pn=(i&zt)!==0&&l===0?n:null;if(f){for(A=0;A<Ve;A+=1)(wt=ae[A].a)==null||wt.measure();for(A=0;A<Ve;A+=1)(Et=ae[A].a)==null||Et.fix()}kr(t,ae,Pn,c)}}f&&qe(()=>{var yt;if(b!==void 0)for(g of b)(yt=g.a)==null||yt.apply()}),y.first=t.first&&t.first.e,y.last=_&&_.e}function Br(e,t,n,r){(r&ft)!==0&&ie(e.v,t),(r&st)!==0?ie(e.i,n):e.i=n}function Ur(e,t,n,r,i,u,a,f,o,l){var c=(o&ft)!==0,v=(o&zn)===0,s=c?v?he(i,!1,!1):z(i):i,d=(o&st)===0?a:z(a),_={i:d,v:s,k:u,a:null,e:null,prev:n,next:r};try{return _.e=ue(()=>f(e,s,d,l),ir),_.e.prev=n&&n.e,_.e.next=r&&r.e,n===null?t.first=_:(n.next=_,n.e.next=_.e),r!==null&&(r.prev=_,r.e.prev=_.e),_}finally{}}function kt(e,t,n){for(var r=e.next?e.next.e.nodes_start:n,i=t?t.e.nodes_start:n,u=e.e.nodes_start;u!==r;){var a=ke(u);i.before(u),u=a}}function Y(e,t,n){t===null?e.first=n:(t.next=n,t.e.next=n&&n.e),n!==null&&(n.prev=t,n.e.prev=t&&t.e)}function Vr(e=!1){const t=E,n=t.l.u;if(!n)return;let r=()=>Xe(t.s);if(e){let i=0,u={};const a=ye(()=>{let f=!1;const o=t.s;for(const l in o)o[l]!==u[l]&&(u[l]=o[l],f=!0);return f&&i++,i});r=()=>T(a)}n.b.length&&sr(()=>{Ft(t,r),de(n.b)}),ze(()=>{const i=U(()=>n.m.map(Mn));return()=>{for(const u of i)typeof u=="function"&&u()}}),n.a.length&&ze(()=>{Ft(t,r),de(n.a)})}function Ft(e,t){if(e.l.s)for(const n of e.l.s)T(n);t()}function ht(e,t,n){if(e==null)return t(void 0),n&&n(void 0),W;const r=U(()=>e.subscribe(t,n));return r.unsubscribe?()=>r.unsubscribe():r}const te=[];function jr(e,t){return{subscribe:Hr(e,t).subscribe}}function Hr(e,t=W){let n=null;const r=new Set;function i(f){if(Wt(e,f)&&(e=f,n)){const o=!te.length;for(const l of r)l[1](),te.push(l,e);if(o){for(let l=0;l<te.length;l+=2)te[l][0](te[l+1]);te.length=0}}}function u(f){i(f(e))}function a(f,o=W){const l=[f,o];return r.add(l),r.size===1&&(n=t(i,u)||W),f(e),()=>{r.delete(l),r.size===0&&n&&(n(),n=null)}}return{set:i,update:u,subscribe:a}}function Ei(e,t,n){const r=!Array.isArray(e),i=r?[e]:e;if(!i.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const u=t.length<2;return jr(n,(a,f)=>{let o=!1;const l=[];let c=0,v=W;const s=()=>{if(c)return;v();const _=t(r?l[0]:l,a,f);u?a(_):v=typeof _=="function"?_:W},d=i.map((_,b)=>ht(_,h=>{l[b]=h,c&=~(1<<b),o&&s()},()=>{c|=1<<b}));return o=!0,s(),function(){de(d),v(),o=!1}})}function $r(e){let t;return ht(e,n=>t=n)(),t}let Pe=!1,et=Symbol();function yi(e,t,n){const r=n[t]??(n[t]={store:null,source:he(void 0),unsubscribe:W});if(r.store!==e&&!(et in n))if(r.unsubscribe(),r.store=e??null,e==null)r.source.v=void 0,r.unsubscribe=W;else{var i=!0;r.unsubscribe=ht(e,u=>{i?r.source.v=u:N(r.source,u)}),i=!1}return e&&et in n?$r(e):T(r.source)}function xi(e,t){return e.set(t),t}function Ti(){const e={};function t(){ct(()=>{for(var n in e)e[n].unsubscribe();Ut(e,et,{enumerable:!1,value:!0})})}return[e,t]}function Yr(e){var t=Pe;try{return Pe=!1,[e(),Pe]}finally{Pe=t}}const Kr={get(e,t){if(!e.exclude.includes(t))return T(e.version),t in e.special?e.special[t]():e.props[t]},set(e,t,n){return t in e.special||(e.special[t]=Tn({get[t](){return e.props[t]}},t,Zt)),e.special[t](n),Pt(e.version),!0},getOwnPropertyDescriptor(e,t){if(!e.exclude.includes(t)&&t in e.props)return{enumerable:!0,configurable:!0,value:e.props[t]}},deleteProperty(e,t){return e.exclude.includes(t)||(e.exclude.push(t),Pt(e.version)),!0},has(e,t){return e.exclude.includes(t)?!1:t in e.props},ownKeys(e){return Reflect.ownKeys(e.props).filter(t=>!e.exclude.includes(t))}};function Ai(e,t){return new Proxy({props:e,exclude:t,special:{},version:z(0)},Kr)}function Wr(e){var t;return((t=e.ctx)==null?void 0:t.d)??!1}function Tn(e,t,n,r){var m;var i=!fe||(n&Xn)!==0,u=(n&Jn)!==0,a=(n&Qn)!==0,f=r,o=!0,l=()=>(o&&(o=!1,f=a?U(r):r),f),c;if(u){var v=G in e||Fn in e;c=((m=re(e,t))==null?void 0:m.set)??(v&&t in e?p=>e[t]=p:void 0)}var s,d=!1;u?[s,d]=Yr(()=>e[t]):s=e[t],s===void 0&&r!==void 0&&(s=l(),c&&(i&&jn(),c(s)));var _;if(i?_=()=>{var p=e[t];return p===void 0?l():(o=!0,p)}:_=()=>{var p=e[t];return p!==void 0&&(f=void 0),p===void 0?f:p},i&&(n&Zt)===0)return _;if(c){var b=e.$$legacy;return function(p,x){return arguments.length>0?((!i||!x||b||d)&&c(x?_():p),p):_()}}var h=((n&Zn)!==0?ye:ve)(_);return u&&T(h),function(p,x){if(arguments.length>0){const g=x?T(h):i&&u?ne(p):p;return N(h,g),f!==void 0&&(f=g),p}return Wr(h)?h.v:T(h)}}function An(e){E===null&&ot(),fe&&E.l!==null?Gr(E).m.push(e):ze(()=>{const t=U(e);if(typeof t=="function")return t})}function Si(e){E===null&&ot(),An(()=>()=>U(e))}function Gr(e){var t=e.l;return t.u??(t.u={a:[],b:[],m:[]})}const zr="modulepreload",Zr=function(e){return"/api/static/"+e},qt={},We=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let a=function(l){return Promise.all(l.map(c=>Promise.resolve(c).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),o=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));i=a(n.map(l=>{if(l=Zr(l),l in qt)return;qt[l]=!0;const c=l.endsWith(".css"),v=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${v}`))return;const s=document.createElement("link");if(s.rel=c?"stylesheet":zr,c||(s.as="script"),s.crossOrigin="",s.href=l,o&&s.setAttribute("nonce",o),document.head.appendChild(s),c)return new Promise((d,_)=>{s.addEventListener("load",d),s.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${l}`)))})}))}function u(a){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=a,window.dispatchEvent(f),!f.defaultPrevented)throw a}return i.then(a=>{for(const f of a||[])f.status==="rejected"&&u(f.reason);return t().catch(u)})},Xr="5";var Bt;typeof window<"u"&&((Bt=window.__svelte??(window.__svelte={})).v??(Bt.v=new Set)).add(Xr);Wn();var Jr=pt('<button class="svelte-1vqrvep"> </button>'),Qr=pt(' <div class="debug svelte-1vqrvep"></div>',1),ei=pt("<main><!></main> <!>",1);function ti(e,t){Xt(t,!1);let n=Tn(t,"firstlyData",8);const r={auth:We(()=>import("./Page-BcSzu3xq.js"),__vite__mapDeps([0,1])),admin:We(()=>import("./Page-sEK21EQB.js"),[]),storage:We(()=>import("./Page-5iUUg7GN.js"),[])};let i=he();function u(d){N(i,r[d])}const a=()=>Object.keys(r);An(()=>{u(n().module)}),Vr();var f=ei(),o=$e(f),l=Ct(o);{var c=d=>{var _=Nr(),b=$e(_);Lr(b,()=>T(i),null,(h,m)=>{var p=ve(()=>{var{default:g}=T(m);return{ModuleComponent:g}}),x=ve(()=>T(p).ModuleComponent);T(x)(h,{get firstlyData(){return n()}})}),Ae(d,_)};Mt(l,d=>{T(i)&&d(c)})}var v=Nt(o,2);{var s=d=>{var _=Qr(),b=$e(_),h=Nt(b);Fr(h,5,()=>U(a),Mr,(m,p)=>{var x=Jr(),g=Ct(x);It(()=>Lt(g,`Load ${T(p)??""}`)),Or("click",x,()=>u(T(p))),Ae(m,x)}),It(m=>Lt(b,`${m??""} `),[()=>(Xe(n()),U(()=>console.info(n())))],ve),Ae(d,_)};Mt(v,d=>{Xe(n()),U(()=>n().debug)&&d(s)})}Ae(e,f),Jt()}Ir(ti,{target:document.getElementById("app"),props:{firstlyData}});export{N as $,li as A,vt as B,Hr as C,$r as D,jr as E,Ei as F,Xt as G,oi as H,Tn as I,fi as J,Si as K,ri as L,si as M,ui as N,vi as O,_i as P,Vr as Q,Nr as R,$e as S,Mt as T,Ae as U,Jt as V,Ti as W,yi as X,Xe as Y,xi as Z,Ai as _,y as a,he as a0,pt as a1,Ct as a2,Or as a3,Nt as a4,ve as a5,Lt as a6,Fr as a7,ci as a8,$ as a9,wi as aa,Re as b,Cr as c,Fe as d,sn as e,Z as f,Ne as g,ue as h,tt as i,ai as j,ct as k,ye as l,T as m,di as n,Pr as o,bi as p,mi as q,cr as r,hi as s,It as t,U as u,Vt as v,pi as w,In as x,Ee as y,gi as z};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Page-C1pM-UDt.js","assets/Page-BHW08QWz.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var On=Object.defineProperty;var Cn=(e,t,n)=>t in e?On(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var je=(e,t,n)=>Cn(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const u of i)if(u.type==="childList")for(const a of u.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const u={};return i.integrity&&(u.integrity=i.integrity),i.referrerPolicy&&(u.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?u.credentials="include":i.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function r(i){if(i.ep)return;i.ep=!0;const u=n(i);fetch(i.href,u)}})();const xt=!1;var tt=Array.isArray,Nn=Array.prototype.indexOf,nt=Array.from,Ut=Object.defineProperty,re=Object.getOwnPropertyDescriptor,In=Object.getOwnPropertyDescriptors,Dn=Object.prototype,Rn=Array.prototype,Vt=Object.getPrototypeOf,Tt=Object.isExtensible;const W=()=>{};function Ln(e){return typeof(e==null?void 0:e.then)=="function"}function Mn(e){return e()}function de(e){for(var t=0;t<e.length;t++)e[t]()}const L=2,jt=4,Le=8,rt=16,j=32,le=64,it=128,I=256,Oe=512,D=1024,V=2048,X=4096,B=8192,ut=16384,Ht=32768,lt=65536,At=1<<17,kn=1<<18,$t=1<<19,Ge=1<<20,G=Symbol("$state"),Fn=Symbol("legacy props"),ri=Symbol(""),Yt=new class extends Error{constructor(){super(...arguments);je(this,"name","StaleReactionError");je(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function Kt(e){return e===this.v}function Wt(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Gt(e){return!Wt(e,this.v)}function qn(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Bn(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Un(e){throw new Error("https://svelte.dev/e/effect_orphan")}function Vn(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function jn(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function Hn(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function $n(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Yn(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}let fe=!1,Kn=!1;function Wn(){fe=!0}const ft=1,st=2,zt=4,Gn=8,zn=16,Zn=1,Xn=2,Zt=4,Jn=8,Qn=16,er=1,tr=2,P=Symbol(),ui="http://www.w3.org/1999/xhtml",li="@attach";function ot(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}let E=null;function Ce(e){E=e}function fi(e){return at().get(e)}function si(e,t){return at().set(e,t),t}function oi(e){return at().has(e)}function Xt(e,t=!1,n){var r=E={p:E,c:null,d:!1,e:null,m:!1,s:e,x:null,l:null};fe&&!t&&(E.l={s:null,u:null,r1:[],r2:z(!1)}),ct(()=>{r.d=!0})}function Jt(e){const t=E;if(t!==null){const a=t.e;if(a!==null){var n=y,r=w;t.e=null;try{for(var i=0;i<a.length;i++){var u=a[i];q(u.effect),M(u.reaction),sn(u.fn)}}finally{q(n),M(r)}}E=t.p,t.m=!0}return{}}function Ee(){return!fe||E!==null&&E.l===null}function at(e){return E===null&&ot(),E.c??(E.c=new Map(nr(E)||void 0))}function nr(e){let t=e.p;for(;t!==null;){const n=t.c;if(n!==null)return n;t=t.p}return null}function ne(e){if(typeof e!="object"||e===null||G in e)return e;const t=Vt(e);if(t!==Dn&&t!==Rn)return e;var n=new Map,r=tt(e),i=$(0),u=w,a=f=>{var o=w;M(u);var l=f();return M(o),l};return r&&n.set("length",$(e.length)),new Proxy(e,{defineProperty(f,o,l){(!("value"in l)||l.configurable===!1||l.enumerable===!1||l.writable===!1)&&Hn();var c=n.get(o);return c===void 0?c=a(()=>{var v=$(l.value);return n.set(o,v),v}):N(c,l.value,!0),!0},deleteProperty(f,o){var l=n.get(o);if(l===void 0){if(o in f){const s=a(()=>$(P));n.set(o,s),He(i)}}else{if(r&&typeof o=="string"){var c=n.get("length"),v=Number(o);Number.isInteger(v)&&v<c.v&&N(c,v)}N(l,P),He(i)}return!0},get(f,o,l){var d;if(o===G)return e;var c=n.get(o),v=o in f;if(c===void 0&&(!v||(d=re(f,o))!=null&&d.writable)&&(c=a(()=>{var _=ne(v?f[o]:P),b=$(_);return b}),n.set(o,c)),c!==void 0){var s=T(c);return s===P?void 0:s}return Reflect.get(f,o,l)},getOwnPropertyDescriptor(f,o){var l=Reflect.getOwnPropertyDescriptor(f,o);if(l&&"value"in l){var c=n.get(o);c&&(l.value=T(c))}else if(l===void 0){var v=n.get(o),s=v==null?void 0:v.v;if(v!==void 0&&s!==P)return{enumerable:!0,configurable:!0,value:s,writable:!0}}return l},has(f,o){var s;if(o===G)return!0;var l=n.get(o),c=l!==void 0&&l.v!==P||Reflect.has(f,o);if(l!==void 0||y!==null&&(!c||(s=re(f,o))!=null&&s.writable)){l===void 0&&(l=a(()=>{var d=c?ne(f[o]):P,_=$(d);return _}),n.set(o,l));var v=T(l);if(v===P)return!1}return c},set(f,o,l,c){var x;var v=n.get(o),s=o in f;if(r&&o==="length")for(var d=l;d<v.v;d+=1){var _=n.get(d+"");_!==void 0?N(_,P):d in f&&(_=a(()=>$(P)),n.set(d+"",_))}if(v===void 0)(!s||(x=re(f,o))!=null&&x.writable)&&(v=a(()=>$(void 0)),N(v,ne(l)),n.set(o,v));else{s=v.v!==P;var b=a(()=>ne(l));N(v,b)}var h=Reflect.getOwnPropertyDescriptor(f,o);if(h!=null&&h.set&&h.set.call(c,l),!s){if(r&&typeof o=="string"){var m=n.get("length"),p=Number(o);Number.isInteger(p)&&p>=m.v&&N(m,p+1)}He(i)}return!0},ownKeys(f){T(i);var o=Reflect.ownKeys(f).filter(v=>{var s=n.get(v);return s===void 0||s.v!==P});for(var[l,c]of n)c.v!==P&&!(l in f)&&o.push(l);return o},setPrototypeOf(){$n()}})}function He(e,t=1){N(e,e.v+t)}function St(e){try{if(e!==null&&typeof e=="object"&&G in e)return e[G]}catch{}return e}function ai(e,t){return Object.is(St(e),St(t))}function ye(e){var t=L|V,n=w!==null&&(w.f&L)!==0?w:null;return y===null||n!==null&&(n.f&I)!==0?t|=I:y.f|=$t,{ctx:E,deps:null,effects:null,equals:Kt,f:t,fn:e,reactions:null,rv:0,v:null,wv:0,parent:n??y,ac:null}}function ci(e){const t=ye(e);return hn(t),t}function ve(e){const t=ye(e);return t.equals=Gt,t}function Qt(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)Z(t[n])}}function rr(e){for(var t=e.parent;t!==null;){if((t.f&L)===0)return t;t=t.parent}return null}function en(e){var t,n=y;q(rr(e));try{Qt(e),t=wn(e)}finally{q(n)}return t}function tn(e){var t=en(e);if(e.equals(t)||(e.v=t,e.wv=gn()),!oe){var n=(K||(e.f&I)!==0)&&e.deps!==null?X:D;k(e,n)}}const pe=new Map;function z(e,t){var n={f:0,v:e,reactions:null,equals:Kt,rv:0,wv:0};return n}function $(e,t){const n=z(e);return hn(n),n}function he(e,t=!1,n=!0){var i;const r=z(e);return t||(r.equals=Gt),fe&&n&&E!==null&&E.l!==null&&((i=E.l).s??(i.s=[])).push(r),r}function N(e,t,n=!1){w!==null&&(!F||(w.f&At)!==0)&&Ee()&&(w.f&(L|rt|At))!==0&&!(S!=null&&S[1].includes(e)&&S[0]===w)&&Yn();let r=n?ne(t):t;return ie(e,r)}function ie(e,t){if(!e.equals(t)){var n=e.v;oe?pe.set(e,t):pe.set(e,n),e.v=t,(e.f&L)!==0&&((e.f&V)!==0&&en(e),k(e,(e.f&I)===0?D:X)),e.wv=gn(),nn(e,V),Ee()&&y!==null&&(y.f&D)!==0&&(y.f&(j|le))===0&&(R===null?pr([e]):R.push(e))}return t}function Pt(e,t=1){var n=T(e),r=t===1?n++:n--;return N(e,n),r}function nn(e,t){var n=e.reactions;if(n!==null)for(var r=Ee(),i=n.length,u=0;u<i;u++){var a=n[u],f=a.f;(f&V)===0&&(!r&&a===y||(k(a,t),(f&(D|I))!==0&&((f&L)!==0?nn(a,X):dt(a))))}}let ir=!1;var Ot,rn,un,ln;function ur(){if(Ot===void 0){Ot=window,rn=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;un=re(t,"firstChild").get,ln=re(t,"nextSibling").get,Tt(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),Tt(n)&&(n.__t=void 0)}}function Me(e=""){return document.createTextNode(e)}function Ne(e){return un.call(e)}function ke(e){return ln.call(e)}function Ct(e,t){return Ne(e)}function $e(e,t){{var n=Ne(e);return n instanceof Comment&&n.data===""?ke(n):n}}function Nt(e,t=1,n=!1){let r=e;for(;t--;)r=ke(r);return r}function lr(e){e.textContent=""}function fn(e){y===null&&w===null&&Un(),w!==null&&(w.f&I)!==0&&y===null&&Bn(),oe&&qn()}function fr(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function se(e,t,n,r=!0){var i=y,u={ctx:E,deps:null,nodes_start:null,nodes_end:null,f:e|V,first:null,fn:t,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(n)try{Be(u),u.f|=Ht}catch(o){throw Z(u),o}else t!==null&&dt(u);var a=n&&u.deps===null&&u.first===null&&u.nodes_start===null&&u.teardown===null&&(u.f&($t|it))===0;if(!a&&r&&(i!==null&&fr(u,i),w!==null&&(w.f&L)!==0)){var f=w;(f.effects??(f.effects=[])).push(u)}return u}function ct(e){const t=se(Le,null,!1);return k(t,D),t.teardown=e,t}function ze(e){fn();var t=y!==null&&(y.f&j)!==0&&E!==null&&!E.m;if(t){var n=E;(n.e??(n.e=[])).push({fn:e,effect:y,reaction:w})}else{var r=sn(e);return r}}function sr(e){return fn(),vt(e)}function or(e){const t=se(le,e,!0);return(n={})=>new Promise(r=>{n.outro?J(t,()=>{Z(t),r(void 0)}):(Z(t),r(void 0))})}function sn(e){return se(jt,e,!1)}function vi(e,t){var n=E,r={effect:null,ran:!1};n.l.r1.push(r),r.effect=vt(()=>{e(),!r.ran&&(r.ran=!0,N(n.l.r2,!0),U(t))})}function _i(){var e=E;vt(()=>{if(T(e.l.r2)){for(var t of e.l.r1){var n=t.effect;(n.f&D)!==0&&k(n,X),xe(n)&&Be(n),t.ran=!1}e.l.r2.v=!1}})}function vt(e){return se(Le,e,!0)}function It(e,t=[],n=ye){const r=t.map(n);return Fe(()=>e(...r.map(T)))}function Fe(e,t=0){var n=se(Le|rt|t,e,!0);return n}function ue(e,t=!0){return se(Le|j,e,!0,t)}function on(e){var t=e.teardown;if(t!==null){const n=oe,r=w;Dt(!0),M(null);try{t.call(null)}finally{Dt(n),M(r)}}}function an(e,t=!1){var i;var n=e.first;for(e.first=e.last=null;n!==null;){(i=n.ac)==null||i.abort(Yt);var r=n.next;(n.f&le)!==0?n.parent=null:Z(n,t),n=r}}function ar(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&j)===0&&Z(t),t=n}}function Z(e,t=!0){var n=!1;(t||(e.f&kn)!==0)&&e.nodes_start!==null&&e.nodes_end!==null&&(cr(e.nodes_start,e.nodes_end),n=!0),an(e,t&&!n),De(e,0),k(e,ut);var r=e.transitions;if(r!==null)for(const u of r)u.stop();on(e);var i=e.parent;i!==null&&i.first!==null&&cn(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes_start=e.nodes_end=e.ac=null}function cr(e,t){for(;e!==null;){var n=e===t?null:ke(e);e.remove(),e=n}}function cn(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function J(e,t){var n=[];_t(e,n,!0),vn(n,()=>{Z(e),t&&t()})}function vn(e,t){var n=e.length;if(n>0){var r=()=>--n||t();for(var i of e)i.out(r)}else t()}function _t(e,t,n){if((e.f&B)===0){if(e.f^=B,e.transitions!==null)for(const a of e.transitions)(a.is_global||n)&&t.push(a);for(var r=e.first;r!==null;){var i=r.next,u=(r.f<)!==0||(r.f&j)!==0;_t(r,t,u?n:!1),r=i}}}function me(e){_n(e,!0)}function _n(e,t){if((e.f&B)!==0){e.f^=B;for(var n=e.first;n!==null;){var r=n.next,i=(n.f<)!==0||(n.f&j)!==0;_n(n,i?t:!1),n=r}if(e.transitions!==null)for(const u of e.transitions)(u.is_global||t)&&u.in()}}let ge=[],Ze=[];function dn(){var e=ge;ge=[],de(e)}function vr(){var e=Ze;Ze=[],de(e)}function qe(e){ge.length===0&&queueMicrotask(dn),ge.push(e)}function _r(){ge.length>0&&dn(),Ze.length>0&&vr()}function dr(e){var t=y;if((t.f&Ht)===0){if((t.f&it)===0)throw e;t.fn(e)}else pn(e,t)}function pn(e,t){for(;t!==null;){if((t.f&it)!==0)try{t.b.error(e);return}catch{}t=t.parent}throw e}let be=!1,we=null,Q=!1,oe=!1;function Dt(e){oe=e}let _e=[];let w=null,F=!1;function M(e){w=e}let y=null;function q(e){y=e}let S=null;function hn(e){w!==null&&w.f&Ge&&(S===null?S=[w,[e]]:S[1].push(e))}let O=null,C=0,R=null;function pr(e){R=e}let mn=1,Ie=0,K=!1;function gn(){return++mn}function xe(e){var v;var t=e.f;if((t&V)!==0)return!0;if((t&X)!==0){var n=e.deps,r=(t&I)!==0;if(n!==null){var i,u,a=(t&Oe)!==0,f=r&&y!==null&&!K,o=n.length;if(a||f){var l=e,c=l.parent;for(i=0;i<o;i++)u=n[i],(a||!((v=u==null?void 0:u.reactions)!=null&&v.includes(l)))&&(u.reactions??(u.reactions=[])).push(l);a&&(l.f^=Oe),f&&c!==null&&(c.f&I)===0&&(l.f^=I)}for(i=0;i<o;i++)if(u=n[i],xe(u)&&tn(u),u.wv>e.wv)return!0}(!r||y!==null&&!K)&&k(e,D)}return!1}function bn(e,t,n=!0){var r=e.reactions;if(r!==null)for(var i=0;i<r.length;i++){var u=r[i];S!=null&&S[1].includes(e)&&S[0]===w||((u.f&L)!==0?bn(u,t,!1):t===u&&(n?k(u,V):(u.f&D)!==0&&k(u,X),dt(u)))}}function wn(e){var d;var t=O,n=C,r=R,i=w,u=K,a=S,f=E,o=F,l=e.f;O=null,C=0,R=null,K=(l&I)!==0&&(F||!Q||w===null),w=(l&(j|le))===0?e:null,S=null,Ce(e.ctx),F=!1,Ie++,e.f|=Ge,e.ac!==null&&(e.ac.abort(Yt),e.ac=null);try{var c=(0,e.fn)(),v=e.deps;if(O!==null){var s;if(De(e,C),v!==null&&C>0)for(v.length=C+O.length,s=0;s<O.length;s++)v[C+s]=O[s];else e.deps=v=O;if(!K||(l&L)!==0&&e.reactions!==null)for(s=C;s<v.length;s++)((d=v[s]).reactions??(d.reactions=[])).push(e)}else v!==null&&C<v.length&&(De(e,C),v.length=C);if(Ee()&&R!==null&&!F&&v!==null&&(e.f&(L|X|V))===0)for(s=0;s<R.length;s++)bn(R[s],e);return i!==null&&i!==e&&(Ie++,R!==null&&(r===null?r=R:r.push(...R))),c}catch(_){dr(_)}finally{O=t,C=n,R=r,w=i,K=u,S=a,Ce(f),F=o,e.f^=Ge}}function hr(e,t){let n=t.reactions;if(n!==null){var r=Nn.call(n,e);if(r!==-1){var i=n.length-1;i===0?n=t.reactions=null:(n[r]=n[i],n.pop())}}n===null&&(t.f&L)!==0&&(O===null||!O.includes(t))&&(k(t,X),(t.f&(I|Oe))===0&&(t.f^=Oe),Qt(t),De(t,0))}function De(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)hr(e,n[r])}function Be(e){var t=e.f;if((t&ut)===0){k(e,D);var n=y,r=Q;y=e,Q=!0;try{(t&rt)!==0?ar(e):an(e),on(e);var i=wn(e);e.teardown=typeof i=="function"?i:null,e.wv=mn;var u;xt&&Kn&&(e.f&V)!==0&&e.deps}finally{Q=r,y=n}}}function mr(){try{Vn()}catch(e){if(we!==null)pn(e,we);else throw e}}function En(){var e=Q;try{var t=0;for(Q=!0;_e.length>0;){t++>1e3&&mr();var n=_e,r=n.length;_e=[];for(var i=0;i<r;i++){var u=br(n[i]);gr(u)}pe.clear()}}finally{be=!1,Q=e,we=null}}function gr(e){var t=e.length;if(t!==0)for(var n=0;n<t;n++){var r=e[n];(r.f&(ut|B))===0&&xe(r)&&(Be(r),r.deps===null&&r.first===null&&r.nodes_start===null&&(r.teardown===null?cn(r):r.fn=null))}}function dt(e){be||(be=!0,queueMicrotask(En));for(var t=we=e;t.parent!==null;){t=t.parent;var n=t.f;if((n&(le|j))!==0){if((n&D)===0)return;t.f^=D}}_e.push(t)}function br(e){for(var t=[],n=e;n!==null;){var r=n.f,i=(r&(j|le))!==0,u=i&&(r&D)!==0;if(!u&&(r&B)===0){(r&jt)!==0?t.push(n):i?n.f^=D:xe(n)&&Be(n);var a=n.first;if(a!==null){n=a;continue}}var f=n.parent;for(n=n.next;n===null&&f!==null;)n=f.next,f=f.parent}return t}function wr(e){for(var t;;){if(_r(),_e.length===0)return be=!1,we=null,t;be=!0,En()}}function T(e){var t=e.f,n=(t&L)!==0;if(w!==null&&!F){if(!(S!=null&&S[1].includes(e))||S[0]!==w){var r=w.deps;e.rv<Ie&&(e.rv=Ie,O===null&&r!==null&&r[C]===e?C++:O===null?O=[e]:(!K||!O.includes(e))&&O.push(e))}}else if(n&&e.deps===null&&e.effects===null){var i=e,u=i.parent;u!==null&&(u.f&I)===0&&(i.f^=I)}return n&&(i=e,xe(i)&&tn(i)),oe&&pe.has(e)?pe.get(e):e.v}function U(e){var t=F;try{return F=!0,e()}finally{F=t}}const Er=-7169;function k(e,t){e.f=e.f&Er|t}function Xe(e){if(!(typeof e!="object"||!e||e instanceof EventTarget)){if(G in e)Je(e);else if(!Array.isArray(e))for(let t in e){const n=e[t];typeof n=="object"&&n&&G in n&&Je(n)}}}function Je(e,t=new Set){if(typeof e=="object"&&e!==null&&!(e instanceof EventTarget)&&!t.has(e)){t.add(e),e instanceof Date&&e.getTime();for(let r in e)try{Je(e[r],t)}catch{}const n=Vt(e);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){const r=In(n);for(let i in r){const u=r[i].get;if(u)try{u.call(e)}catch{}}}}}function di(e){return e.endsWith("capture")&&e!=="gotpointercapture"&&e!=="lostpointercapture"}const yr=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function pi(e){return yr.includes(e)}const xr={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function hi(e){return e=e.toLowerCase(),xr[e]??e}const Tr=["touchstart","touchmove"];function Ar(e){return Tr.includes(e)}function mi(e,t){if(t){const n=document.body;e.autofocus=!0,qe(()=>{document.activeElement===n&&e.focus()})}}let Rt=!1;function Sr(){Rt||(Rt=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(const n of e.target.elements)(t=n.__on_r)==null||t.call(n)})},{capture:!0}))}function yn(e){var t=w,n=y;M(null),q(null);try{return e()}finally{M(t),q(n)}}function gi(e,t,n,r=n){e.addEventListener(t,()=>yn(n));const i=e.__on_r;i?e.__on_r=()=>{i(),r(!0)}:e.__on_r=()=>r(!0),Sr()}const xn=new Set,Qe=new Set;function Pr(e,t,n,r={}){function i(u){if(r.capture||ce.call(t,u),!u.cancelBubble)return yn(()=>n==null?void 0:n.call(this,u))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?qe(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function Or(e,t,n,r,i){var u={capture:r,passive:i},a=Pr(e,t,n,u);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&ct(()=>{t.removeEventListener(e,a,u)})}function bi(e){for(var t=0;t<e.length;t++)xn.add(e[t]);for(var n of Qe)n(e)}function ce(e){var p;var t=this,n=t.ownerDocument,r=e.type,i=((p=e.composedPath)==null?void 0:p.call(e))||[],u=i[0]||e.target,a=0,f=e.__root;if(f){var o=i.indexOf(f);if(o!==-1&&(t===document||t===window)){e.__root=t;return}var l=i.indexOf(t);if(l===-1)return;o<=l&&(a=o)}if(u=i[a]||e.target,u!==t){Ut(e,"currentTarget",{configurable:!0,get(){return u||n}});var c=w,v=y;M(null),q(null);try{for(var s,d=[];u!==null;){var _=u.assignedSlot||u.parentNode||u.host||null;try{var b=u["__"+r];if(b!=null&&(!u.disabled||e.target===u))if(tt(b)){var[h,...m]=b;h.apply(u,[e,...m])}else b.call(u,e)}catch(x){s?d.push(x):s=x}if(e.cancelBubble||_===t||_===null)break;u=_}if(s){for(let x of d)queueMicrotask(()=>{throw x});throw s}}finally{e.__root=t,delete e.currentTarget,M(c),q(v)}}}function Cr(e){var t=document.createElement("template");return t.innerHTML=e.replaceAll("<!>","<!---->"),t.content}function Re(e,t){var n=y;n.nodes_start===null&&(n.nodes_start=e,n.nodes_end=t)}function pt(e,t){var n=(t&er)!==0,r=(t&tr)!==0,i,u=!e.startsWith("<!>");return()=>{i===void 0&&(i=Cr(u?e:"<!>"+e),n||(i=Ne(i)));var a=r||rn?document.importNode(i,!0):i.cloneNode(!0);if(n){var f=Ne(a),o=a.lastChild;Re(f,o)}else Re(a,a);return a}}function wi(e=""){{var t=Me(e+"");return Re(t,t),t}}function Nr(){var e=document.createDocumentFragment(),t=document.createComment(""),n=Me();return e.append(t,n),Re(t,n),e}function Ae(e,t){e!==null&&e.before(t)}function Lt(e,t){var n=t==null?"":typeof t=="object"?t+"":t;n!==(e.__t??(e.__t=e.nodeValue))&&(e.__t=n,e.nodeValue=n+"")}function Ir(e,t){return Dr(e,t)}const ee=new Map;function Dr(e,{target:t,anchor:n,props:r={},events:i,context:u,intro:a=!0}){ur();var f=new Set,o=v=>{for(var s=0;s<v.length;s++){var d=v[s];if(!f.has(d)){f.add(d);var _=Ar(d);t.addEventListener(d,ce,{passive:_});var b=ee.get(d);b===void 0?(document.addEventListener(d,ce,{passive:_}),ee.set(d,1)):ee.set(d,b+1)}}};o(nt(xn)),Qe.add(o);var l=void 0,c=or(()=>{var v=n??t.appendChild(Me());return ue(()=>{if(u){Xt({});var s=E;s.c=u}i&&(r.$$events=i),l=e(v,r)||{},u&&Jt()}),()=>{var _;for(var s of f){t.removeEventListener(s,ce);var d=ee.get(s);--d===0?(document.removeEventListener(s,ce),ee.delete(s)):ee.set(s,d)}Qe.delete(o),v!==n&&((_=v.parentNode)==null||_.removeChild(v))}});return Rr.set(l,c),l}let Rr=new WeakMap;const Ye=0,Se=1,Ke=2;function Lr(e,t,n,r,i){var u=e,a=Ee(),f=E,o=P,l,c,v,s=a?z(void 0):he(void 0,!1,!1),d=a?z(void 0):he(void 0,!1,!1),_=!1;function b(m,p){_=!0,p&&(q(h),M(h),Ce(f));try{m===Se&&r&&(c?me(c):c=ue(()=>r(u,s))),m!==Ye&&l&&J(l,()=>l=null),m!==Se&&c&&J(c,()=>c=null),m!==Ke&&v&&J(v,()=>v=null)}finally{p&&(Ce(null),M(null),q(null),wr())}}var h=Fe(()=>{if(o!==(o=t())){if(Ln(o)){var m=o;_=!1,m.then(p=>{m===o&&(ie(s,p),b(Se,!0))},p=>{if(m===o)throw ie(d,p),b(Ke,!0),d.v}),qe(()=>{_||b(Ye,!0)})}else ie(s,o),b(Se,!1);return()=>o=P}})}function Mt(e,t,[n,r]=[0,0]){var i=e,u=null,a=null,f=P,o=n>0?lt:0,l=!1;const c=(s,d=!0)=>{l=!0,v(d,s)},v=(s,d)=>{f!==(f=s)&&(f?(u?me(u):d&&(u=ue(()=>d(i))),a&&J(a,()=>{a=null})):(a?me(a):d&&(a=ue(()=>d(i,[n+1,r]))),u&&J(u,()=>{u=null})))};Fe(()=>{l=!1,t(c),l||v(null,null)},o)}function Mr(e,t){return t}function kr(e,t,n,r){for(var i=[],u=t.length,a=0;a<u;a++)_t(t[a].e,i,!0);var f=u>0&&i.length===0&&n!==null;if(f){var o=n.parentNode;lr(o),o.append(n),r.clear(),Y(e,t[0].prev,t[u-1].next)}vn(i,()=>{for(var l=0;l<u;l++){var c=t[l];f||(r.delete(c.k),Y(e,c.prev,c.next)),Z(c.e,!f)}})}function Fr(e,t,n,r,i,u=null){var a=e,f={flags:t,items:new Map,first:null},o=(t&zt)!==0;if(o){var l=e;a=l.appendChild(Me())}var c=null,v=!1,s=ve(()=>{var d=n();return tt(d)?d:d==null?[]:nt(d)});Fe(()=>{var d=T(s),_=d.length;v&&_===0||(v=_===0,qr(d,f,a,i,t,r,n),u!==null&&(_===0?c?me(c):c=ue(()=>u(a)):c!==null&&J(c,()=>{c=null})),T(s))})}function qr(e,t,n,r,i,u,a){var gt,bt,wt,Et;var f=(i&Gn)!==0,o=(i&(ft|st))!==0,l=e.length,c=t.items,v=t.first,s=v,d,_=null,b,h=[],m=[],p,x,g,A;if(f)for(A=0;A<l;A+=1)p=e[A],x=u(p,A),g=c.get(x),g!==void 0&&((gt=g.a)==null||gt.measure(),(b??(b=new Set)).add(g));for(A=0;A<l;A+=1){if(p=e[A],x=u(p,A),g=c.get(x),g===void 0){var Sn=s?s.e.nodes_start:n;_=Ur(Sn,t,_,_===null?t.first:_.next,p,x,A,r,i,a),c.set(x,_),h=[],m=[],s=_.next;continue}if(o&&Br(g,p,A,i),(g.e.f&B)!==0&&(me(g.e),f&&((bt=g.a)==null||bt.unfix(),(b??(b=new Set)).delete(g))),g!==s){if(d!==void 0&&d.has(g)){if(h.length<m.length){var Te=m[0],H;_=Te.prev;var mt=h[0],Ue=h[h.length-1];for(H=0;H<h.length;H+=1)kt(h[H],Te,n);for(H=0;H<m.length;H+=1)d.delete(m[H]);Y(t,mt.prev,Ue.next),Y(t,_,mt),Y(t,Ue,Te),s=Te,_=Ue,A-=1,h=[],m=[]}else d.delete(g),kt(g,s,n),Y(t,g.prev,g.next),Y(t,g,_===null?t.first:_.next),Y(t,_,g),_=g;continue}for(h=[],m=[];s!==null&&s.k!==x;)(s.e.f&B)===0&&(d??(d=new Set)).add(s),m.push(s),s=s.next;if(s===null)continue;g=s}h.push(g),_=g,s=g.next}if(s!==null||d!==void 0){for(var ae=d===void 0?[]:nt(d);s!==null;)(s.e.f&B)===0&&ae.push(s),s=s.next;var Ve=ae.length;if(Ve>0){var Pn=(i&zt)!==0&&l===0?n:null;if(f){for(A=0;A<Ve;A+=1)(wt=ae[A].a)==null||wt.measure();for(A=0;A<Ve;A+=1)(Et=ae[A].a)==null||Et.fix()}kr(t,ae,Pn,c)}}f&&qe(()=>{var yt;if(b!==void 0)for(g of b)(yt=g.a)==null||yt.apply()}),y.first=t.first&&t.first.e,y.last=_&&_.e}function Br(e,t,n,r){(r&ft)!==0&&ie(e.v,t),(r&st)!==0?ie(e.i,n):e.i=n}function Ur(e,t,n,r,i,u,a,f,o,l){var c=(o&ft)!==0,v=(o&zn)===0,s=c?v?he(i,!1,!1):z(i):i,d=(o&st)===0?a:z(a),_={i:d,v:s,k:u,a:null,e:null,prev:n,next:r};try{return _.e=ue(()=>f(e,s,d,l),ir),_.e.prev=n&&n.e,_.e.next=r&&r.e,n===null?t.first=_:(n.next=_,n.e.next=_.e),r!==null&&(r.prev=_,r.e.prev=_.e),_}finally{}}function kt(e,t,n){for(var r=e.next?e.next.e.nodes_start:n,i=t?t.e.nodes_start:n,u=e.e.nodes_start;u!==r;){var a=ke(u);i.before(u),u=a}}function Y(e,t,n){t===null?e.first=n:(t.next=n,t.e.next=n&&n.e),n!==null&&(n.prev=t,n.e.prev=t&&t.e)}function Vr(e=!1){const t=E,n=t.l.u;if(!n)return;let r=()=>Xe(t.s);if(e){let i=0,u={};const a=ye(()=>{let f=!1;const o=t.s;for(const l in o)o[l]!==u[l]&&(u[l]=o[l],f=!0);return f&&i++,i});r=()=>T(a)}n.b.length&&sr(()=>{Ft(t,r),de(n.b)}),ze(()=>{const i=U(()=>n.m.map(Mn));return()=>{for(const u of i)typeof u=="function"&&u()}}),n.a.length&&ze(()=>{Ft(t,r),de(n.a)})}function Ft(e,t){if(e.l.s)for(const n of e.l.s)T(n);t()}function ht(e,t,n){if(e==null)return t(void 0),n&&n(void 0),W;const r=U(()=>e.subscribe(t,n));return r.unsubscribe?()=>r.unsubscribe():r}const te=[];function jr(e,t){return{subscribe:Hr(e,t).subscribe}}function Hr(e,t=W){let n=null;const r=new Set;function i(f){if(Wt(e,f)&&(e=f,n)){const o=!te.length;for(const l of r)l[1](),te.push(l,e);if(o){for(let l=0;l<te.length;l+=2)te[l][0](te[l+1]);te.length=0}}}function u(f){i(f(e))}function a(f,o=W){const l=[f,o];return r.add(l),r.size===1&&(n=t(i,u)||W),f(e),()=>{r.delete(l),r.size===0&&n&&(n(),n=null)}}return{set:i,update:u,subscribe:a}}function Ei(e,t,n){const r=!Array.isArray(e),i=r?[e]:e;if(!i.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const u=t.length<2;return jr(n,(a,f)=>{let o=!1;const l=[];let c=0,v=W;const s=()=>{if(c)return;v();const _=t(r?l[0]:l,a,f);u?a(_):v=typeof _=="function"?_:W},d=i.map((_,b)=>ht(_,h=>{l[b]=h,c&=~(1<<b),o&&s()},()=>{c|=1<<b}));return o=!0,s(),function(){de(d),v(),o=!1}})}function $r(e){let t;return ht(e,n=>t=n)(),t}let Pe=!1,et=Symbol();function yi(e,t,n){const r=n[t]??(n[t]={store:null,source:he(void 0),unsubscribe:W});if(r.store!==e&&!(et in n))if(r.unsubscribe(),r.store=e??null,e==null)r.source.v=void 0,r.unsubscribe=W;else{var i=!0;r.unsubscribe=ht(e,u=>{i?r.source.v=u:N(r.source,u)}),i=!1}return e&&et in n?$r(e):T(r.source)}function xi(e,t){return e.set(t),t}function Ti(){const e={};function t(){ct(()=>{for(var n in e)e[n].unsubscribe();Ut(e,et,{enumerable:!1,value:!0})})}return[e,t]}function Yr(e){var t=Pe;try{return Pe=!1,[e(),Pe]}finally{Pe=t}}const Kr={get(e,t){if(!e.exclude.includes(t))return T(e.version),t in e.special?e.special[t]():e.props[t]},set(e,t,n){return t in e.special||(e.special[t]=Tn({get[t](){return e.props[t]}},t,Zt)),e.special[t](n),Pt(e.version),!0},getOwnPropertyDescriptor(e,t){if(!e.exclude.includes(t)&&t in e.props)return{enumerable:!0,configurable:!0,value:e.props[t]}},deleteProperty(e,t){return e.exclude.includes(t)||(e.exclude.push(t),Pt(e.version)),!0},has(e,t){return e.exclude.includes(t)?!1:t in e.props},ownKeys(e){return Reflect.ownKeys(e.props).filter(t=>!e.exclude.includes(t))}};function Ai(e,t){return new Proxy({props:e,exclude:t,special:{},version:z(0)},Kr)}function Wr(e){var t;return((t=e.ctx)==null?void 0:t.d)??!1}function Tn(e,t,n,r){var m;var i=!fe||(n&Xn)!==0,u=(n&Jn)!==0,a=(n&Qn)!==0,f=r,o=!0,l=()=>(o&&(o=!1,f=a?U(r):r),f),c;if(u){var v=G in e||Fn in e;c=((m=re(e,t))==null?void 0:m.set)??(v&&t in e?p=>e[t]=p:void 0)}var s,d=!1;u?[s,d]=Yr(()=>e[t]):s=e[t],s===void 0&&r!==void 0&&(s=l(),c&&(i&&jn(),c(s)));var _;if(i?_=()=>{var p=e[t];return p===void 0?l():(o=!0,p)}:_=()=>{var p=e[t];return p!==void 0&&(f=void 0),p===void 0?f:p},i&&(n&Zt)===0)return _;if(c){var b=e.$$legacy;return function(p,x){return arguments.length>0?((!i||!x||b||d)&&c(x?_():p),p):_()}}var h=((n&Zn)!==0?ye:ve)(_);return u&&T(h),function(p,x){if(arguments.length>0){const g=x?T(h):i&&u?ne(p):p;return N(h,g),f!==void 0&&(f=g),p}return Wr(h)?h.v:T(h)}}function An(e){E===null&&ot(),fe&&E.l!==null?Gr(E).m.push(e):ze(()=>{const t=U(e);if(typeof t=="function")return t})}function Si(e){E===null&&ot(),An(()=>()=>U(e))}function Gr(e){var t=e.l;return t.u??(t.u={a:[],b:[],m:[]})}const zr="modulepreload",Zr=function(e){return"/api/static/"+e},qt={},We=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let a=function(l){return Promise.all(l.map(c=>Promise.resolve(c).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),o=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));i=a(n.map(l=>{if(l=Zr(l),l in qt)return;qt[l]=!0;const c=l.endsWith(".css"),v=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${v}`))return;const s=document.createElement("link");if(s.rel=c?"stylesheet":zr,c||(s.as="script"),s.crossOrigin="",s.href=l,o&&s.setAttribute("nonce",o),document.head.appendChild(s),c)return new Promise((d,_)=>{s.addEventListener("load",d),s.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${l}`)))})}))}function u(a){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=a,window.dispatchEvent(f),!f.defaultPrevented)throw a}return i.then(a=>{for(const f of a||[])f.status==="rejected"&&u(f.reason);return t().catch(u)})},Xr="5";var Bt;typeof window<"u"&&((Bt=window.__svelte??(window.__svelte={})).v??(Bt.v=new Set)).add(Xr);Wn();var Jr=pt('<button class="svelte-1vqrvep"> </button>'),Qr=pt(' <div class="debug svelte-1vqrvep"></div>',1),ei=pt("<main><!></main> <!>",1);function ti(e,t){Xt(t,!1);let n=Tn(t,"firstlyData",8);const r={auth:We(()=>import("./Page-C1pM-UDt.js"),__vite__mapDeps([0,1])),admin:We(()=>import("./Page-9Ytj29NS.js"),[]),storage:We(()=>import("./Page-CPz6KCw_.js"),[])};let i=he();function u(d){N(i,r[d])}const a=()=>Object.keys(r);An(()=>{u(n().module)}),Vr();var f=ei(),o=$e(f),l=Ct(o);{var c=d=>{var _=Nr(),b=$e(_);Lr(b,()=>T(i),null,(h,m)=>{var p=ve(()=>{var{default:g}=T(m);return{ModuleComponent:g}}),x=ve(()=>T(p).ModuleComponent);T(x)(h,{get firstlyData(){return n()}})}),Ae(d,_)};Mt(l,d=>{T(i)&&d(c)})}var v=Nt(o,2);{var s=d=>{var _=Qr(),b=$e(_),h=Nt(b);Fr(h,5,()=>U(a),Mr,(m,p)=>{var x=Jr(),g=Ct(x);It(()=>Lt(g,`Load ${T(p)??""}`)),Or("click",x,()=>u(T(p))),Ae(m,x)}),It(m=>Lt(b,`${m??""} `),[()=>(Xe(n()),U(()=>console.info(n())))],ve),Ae(d,_)};Mt(v,d=>{Xe(n()),U(()=>n().debug)&&d(s)})}Ae(e,f),Jt()}Ir(ti,{target:document.getElementById("app"),props:{firstlyData}});export{N as $,li as A,vt as B,Hr as C,$r as D,jr as E,Ei as F,Xt as G,oi as H,Tn as I,fi as J,Si as K,ri as L,si as M,ui as N,vi as O,_i as P,Vr as Q,Nr as R,$e as S,Mt as T,Ae as U,Jt as V,Ti as W,yi as X,Xe as Y,xi as Z,Ai as _,y as a,he as a0,pt as a1,Ct as a2,Or as a3,Nt as a4,ve as a5,Lt as a6,Fr as a7,ci as a8,$ as a9,wi as aa,Re as b,Cr as c,Fe as d,sn as e,Z as f,Ne as g,ue as h,tt as i,ai as j,ct as k,ye as l,T as m,di as n,Pr as o,bi as p,mi as q,cr as r,hi as s,It as t,U as u,Vt as v,pi as w,In as x,Ee as y,gi as z};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<!--PLACE_HERE_HEAD-->
|
|
7
|
-
<script type="module" crossorigin src="/api/static/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/api/static/assets/index-AoBb9Ds5.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/api/static/assets/index-DKWpA6v7.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aa as t,U as o}from"./index-RpcgeXPm.js";function r(a){var e=t("Hello from files");o(a,e)}export{r as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aa as e,U as o}from"./index-RpcgeXPm.js";function f(a){var t=e("Hello from admin");o(a,t)}export{f as default};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|