gemi 0.161.0 → 0.163.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.
Files changed (43) hide show
  1. package/dist/ai/index.js +1 -1
  2. package/dist/auth/AuthManager.d.ts +31 -11
  3. package/dist/auth/AuthManager.d.ts.map +1 -1
  4. package/dist/auth/UserProvider.d.ts +7 -0
  5. package/dist/auth/UserProvider.d.ts.map +1 -1
  6. package/dist/auth/config.d.ts +10 -0
  7. package/dist/auth/config.d.ts.map +1 -1
  8. package/dist/{chunk-3yvdvv3d.js → chunk-6abrc83j.js} +1 -1
  9. package/dist/chunk-6atxvmvj.js +117 -0
  10. package/dist/{chunk-sadtazf5.js.map → chunk-6atxvmvj.js.map} +8 -8
  11. package/dist/{chunk-75ajptxk.js → chunk-my8hz9k0.js} +1 -1
  12. package/dist/chunk-p4ka241x.js +5 -0
  13. package/dist/{chunk-mp9hfbs3.js.map → chunk-p4ka241x.js.map} +3 -3
  14. package/dist/{chunk-cjefq3ry.js → chunk-qttv23e7.js} +1 -1
  15. package/dist/{chunk-jr7hdp5z.js → chunk-s7tn2t8x.js} +1 -1
  16. package/dist/{chunk-pg16c4nx.js → chunk-tx3t5qnt.js} +1 -1
  17. package/dist/{chunk-5z7mqgkp.js → chunk-y4bjsyt4.js} +1 -1
  18. package/dist/{chunk-36x1a1mz.js → chunk-yb41jbdc.js} +2 -2
  19. package/dist/{chunk-36x1a1mz.js.map → chunk-yb41jbdc.js.map} +1 -1
  20. package/dist/client/index.js +1 -1
  21. package/dist/client/index.js.map +1 -1
  22. package/dist/facades/index.js +1 -1
  23. package/dist/http/Metadata.d.ts +29 -1
  24. package/dist/http/Metadata.d.ts.map +1 -1
  25. package/dist/http/index.js +1 -1
  26. package/dist/i18n/index.js +1 -1
  27. package/dist/kernel/index.js +1 -1
  28. package/dist/orm/index.js +1 -1
  29. package/dist/server/index.js +1 -1
  30. package/dist/services/index.js +1 -1
  31. package/dist/services/router/ViewRouteDispatcher.d.ts +2 -0
  32. package/dist/services/router/ViewRouteDispatcher.d.ts.map +1 -1
  33. package/dist/services/router/config.d.ts +15 -1
  34. package/dist/services/router/config.d.ts.map +1 -1
  35. package/package.json +1 -1
  36. package/dist/chunk-mp9hfbs3.js +0 -5
  37. package/dist/chunk-sadtazf5.js +0 -117
  38. /package/dist/{chunk-3yvdvv3d.js.map → chunk-6abrc83j.js.map} +0 -0
  39. /package/dist/{chunk-75ajptxk.js.map → chunk-my8hz9k0.js.map} +0 -0
  40. /package/dist/{chunk-cjefq3ry.js.map → chunk-qttv23e7.js.map} +0 -0
  41. /package/dist/{chunk-jr7hdp5z.js.map → chunk-s7tn2t8x.js.map} +0 -0
  42. /package/dist/{chunk-pg16c4nx.js.map → chunk-tx3t5qnt.js.map} +0 -0
  43. /package/dist/{chunk-5z7mqgkp.js.map → chunk-y4bjsyt4.js.map} +0 -0
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{$f as r,Af as p,Jg as v,Qf as q,Ze as a,af as c,ag as s,bf as e,bg as t,cf as f,cg as u,df as h,ef as i,ff as j,mf as k,nf as l,of as m,pf as n,qf as o}from"../chunk-sadtazf5.js";import"../chunk-99be7vbh.js";import"../chunk-n3pc62tc.js";import{Fi as d,Hi as g,gi as b}from"../chunk-jr7hdp5z.js";import"../chunk-kscwjycy.js";import"../chunk-mp9hfbs3.js";import"../chunk-hkp00b9x.js";import"../chunk-70kpm72z.js";import"../chunk-1btx3kkv.js";import"../chunk-egzfxdr1.js";import"../chunk-rh811v1f.js";import"../chunk-wamxfhh6.js";import"../chunk-cd847h0t.js";import"../chunk-zh0knwen.js";import"../chunk-04ffq2ge.js";import"../chunk-pfjky33c.js";import"../chunk-vqar6ysw.js";import"../chunk-mxhy19a9.js";import"../chunk-22jm6sn1.js";import"../chunk-yc2pnb1w.js";import"../chunk-7effp39a.js";import"../chunk-51fvpq55.js";import"../chunk-wgre66wq.js";export{f as Url,d as Storage,r as Runs,j as Redis,a as Redirect,l as RateLimiter,e as Query,h as Meta,g as Log,m as Lock,c as Lang,s as Features,b as Facade,u as DB,n as Crypt,i as Cookie,o as Connections,t as ConnectionQueries,p as ChangeFeed,k as Cache,q as Broadcast,v as Auth};
2
+ import{$f as r,Af as p,Jg as v,Qf as q,Ze as a,af as c,ag as s,bf as e,bg as t,cf as f,cg as u,df as h,ef as i,ff as j,mf as k,nf as l,of as m,pf as n,qf as o}from"../chunk-6atxvmvj.js";import"../chunk-99be7vbh.js";import"../chunk-n3pc62tc.js";import{Fi as d,Hi as g,gi as b}from"../chunk-s7tn2t8x.js";import"../chunk-kscwjycy.js";import"../chunk-p4ka241x.js";import"../chunk-hkp00b9x.js";import"../chunk-70kpm72z.js";import"../chunk-1btx3kkv.js";import"../chunk-egzfxdr1.js";import"../chunk-rh811v1f.js";import"../chunk-wamxfhh6.js";import"../chunk-cd847h0t.js";import"../chunk-zh0knwen.js";import"../chunk-04ffq2ge.js";import"../chunk-pfjky33c.js";import"../chunk-vqar6ysw.js";import"../chunk-mxhy19a9.js";import"../chunk-22jm6sn1.js";import"../chunk-yc2pnb1w.js";import"../chunk-7effp39a.js";import"../chunk-51fvpq55.js";import"../chunk-wgre66wq.js";export{f as Url,d as Storage,r as Runs,j as Redis,a as Redirect,l as RateLimiter,e as Query,h as Meta,g as Log,m as Lock,c as Lang,s as Features,b as Facade,u as DB,n as Crypt,i as Cookie,o as Connections,t as ConnectionQueries,p as ChangeFeed,k as Cache,q as Broadcast,v as Auth};
3
3
 
4
4
  //# debugId=435BD7644974A79A64756E2164756E21
@@ -20,6 +20,19 @@ export type OpenGraphParams = {
20
20
  */
21
21
  twitterCard?: "summary" | "summary_large_image";
22
22
  };
23
+ /**
24
+ * The app-wide default title and metadata (`route.view.meta`, #1042): used for
25
+ * each field that no handler (or `onNotFound`) set. See `ViewRouteConfig.meta`.
26
+ */
27
+ export type DefaultViewMeta = {
28
+ title?: string;
29
+ description?: string;
30
+ /**
31
+ * Every field is optional: `title` and `description` default to the page's
32
+ * own, `type` to `"website"`. `url` is left out of the page unless given.
33
+ */
34
+ openGraph?: Partial<OpenGraphParams>;
35
+ };
23
36
  /**
24
37
  * Attributes for the document's `<html>` element, handed to the root (or a
25
38
  * static view's) layout as its `htmlAttributes` prop.
@@ -44,6 +57,8 @@ export declare class Metadata {
44
57
  * none, so the client keeps what the skipped segments put there.
45
58
  */
46
59
  touched: boolean;
60
+ /** The fields a handler set, which the app's default (`route.view.meta`) leaves alone. */
61
+ private setFields;
47
62
  render(): {
48
63
  title: any;
49
64
  description: any;
@@ -64,6 +79,19 @@ export declare class Metadata {
64
79
  fonts(fonts: MetaFont[]): void;
65
80
  title(title: string): void;
66
81
  description(description: string): void;
67
- openGraph({ title, description, type, url, image, imageAlt, imageWidth, imageHeight, twitterImage, twitterImageAlt, twitterImageWidth, twitterImageHeight, twitterCard, }: OpenGraphParams): void;
82
+ /** Whether every field the app's default could fill was set by a handler. */
83
+ get hasAllDefaultFields(): boolean;
84
+ /**
85
+ * Fills each of `title`, `description` and `openGraph` that no handler set
86
+ * from the app's default (`route.view.meta`, #1042). Field by field: a
87
+ * handler's `Meta.title` keeps its title and still gets the default
88
+ * description. Not a handler call, so `touched` stays as it was.
89
+ *
90
+ * The default's Open Graph fields fall back to the page's title and
91
+ * description and to `type: "website"`; `url` is only rendered when given.
92
+ */
93
+ applyDefaults(defaults: DefaultViewMeta): void;
94
+ openGraph(params: OpenGraphParams): void;
95
+ private normalizeOpenGraph;
68
96
  }
69
97
  //# sourceMappingURL=Metadata.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Metadata.d.ts","sourceRoot":"","sources":["../../http/Metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAuC,MAAM,iBAAiB,CAAC;AAGrF,YAAY,EAAE,QAAQ,EAAE,CAAC;AAEzB,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAA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B,CAAC;AAEF,gFAAgF;AAChF,MAAM,MAAM,aAAa,GAAG;IAC1B,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,qBAAa,QAAQ;IACnB,OAAO,EAAE,GAAG,CASV;IAEF;;;;OAIG;IACH,OAAO,UAAS;IAEhB,0FAA0F;IAC1F,OAAO,CAAC,SAAS,CAAoC;IAErD,MAAM;;;;;;;;;;IAaN,iFAAiF;IACjF,cAAc,CAAC,UAAU,EAAE,cAAc;IAQzC,SAAS,CAAC,GAAG,EAAE,MAAM;IAKrB,wFAAwF;IACxF,MAAM,CAAC,OAAO,EAAE,MAAM;IAKtB,UAAU,CAAC,KAAK,EAAE,aAAa,EAAE;IAKjC,6FAA6F;IAC7F,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE;IAMvB,KAAK,CAAC,KAAK,EAAE,MAAM;IAMnB,WAAW,CAAC,WAAW,EAAE,MAAM;IAM/B,6EAA6E;IAC7E,IAAI,mBAAmB,YAEtB;IAED;;;;;;;;OAQG;IACH,aAAa,CAAC,QAAQ,EAAE,eAAe;IAkBvC,SAAS,CAAC,MAAM,EAAE,eAAe;IAMjC,OAAO,CAAC,kBAAkB;CAmC3B"}
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{$e as L,$g as oa,Kg as $,Lg as aa,Mg as ba,Pg as ca,Qg as da,Rg as ea,Sg as fa,Tg as ga,Ug as ha,Vg as ia,Wg as ja,Xe as I,Xg as ka,Ye as J,Yg as la,Zg as ma,_e as K,_g as na,ah as pa,bh as qa,ch as ra,dh as sa,eh as ta,ge as q,he as r,ie as s,je as t,ke as u,kg as _,le as v,me as w,ne as D,se as E,ve as F,we as G,xe as H}from"../chunk-sadtazf5.js";import"../chunk-99be7vbh.js";import"../chunk-n3pc62tc.js";import{$h as p,Ai as X,Bi as Y,Ci as Z,Eh as a,Fh as b,Gh as d,Lh as e,Mh as f,Nh as g,Oh as h,Ph as i,Qh as j,Vh as n,Wh as o,ai as x,bi as y,ci as z,di as A,ei as B,fi as C,pi as M,qi as N,ri as O,si as P,ti as Q,ui as R,vi as S,wi as T,xi as U,yi as V,zi as W}from"../chunk-jr7hdp5z.js";import{Pi as c}from"../chunk-kscwjycy.js";import{Ui as k,Vi as l,Wi as m}from"../chunk-mp9hfbs3.js";import"../chunk-hkp00b9x.js";import"../chunk-70kpm72z.js";import"../chunk-1btx3kkv.js";import"../chunk-egzfxdr1.js";import"../chunk-rh811v1f.js";import"../chunk-wamxfhh6.js";import"../chunk-cd847h0t.js";import"../chunk-zh0knwen.js";import"../chunk-04ffq2ge.js";import"../chunk-pfjky33c.js";import"../chunk-vqar6ysw.js";import"../chunk-mxhy19a9.js";import"../chunk-22jm6sn1.js";import"../chunk-yc2pnb1w.js";import"../chunk-7effp39a.js";import"../chunk-51fvpq55.js";import"../chunk-wgre66wq.js";export{g as toRangeHeaderValue,s as toMiddlewareList,k as stateKey,Z as safeFetch,f as resolveRange,e as parseRangeHeader,h as parseContentRange,w as parseByteSize,ha as middlewareConfigDefaults,r as httpError,d as getCookies,j as formatUnsatisfiedContentRange,i as formatContentRange,pa as defineResourcePolicy,ga as defineMiddlewareConfig,t as createUnsatisfiableResponse,u as createStreamResponse,K as createFileResponse,H as clientIp,X as classifyAddress,ba as authorizeChannel,L as ViewRouter,n as ValidationError,U as TooManyRedirectsError,S as TooLargeError,R as TimeoutError,qa as SitemapError,ra as Sitemap,J as SameSiteBounceMiddleware,Y as SafeResponse,M as SafeFetchError,I as SAME_SITE_BOUNCE_PARAM,sa as RobotsTxt,ta as Robots,oa as ResourcePolicy,b as ResourceController,m as RequestState,c as RequestBreakerError,G as RateLimitMiddleware,E as RateLimitExceededError,z as RangeNotSatisfiableError,ma as PoliciesServiceProvider,na as Policies,v as PayloadTooLargeError,A as NotFoundError,V as NetworkError,l as MissingRequestStateError,F as Middleware,ea as McpToolDeclaration,fa as McpRouter,da as McpRouteDeclaration,ca as McpModelParam,o as InvalidValidationRuleError,N as InvalidUrlError,y as InsufficientPermissionsError,W as HttpStatusError,q as HttpResponse,p as HttpRequest,B as FileNotFoundError,Q as DnsError,ka as CorsMiddleware,a as Controller,T as ContentTypeError,aa as ChannelRouter,$ as ChannelDeclaration,ja as CacheMiddleware,la as CSRFMiddleware,_ as BodyLimitMiddleware,O as BlockedHostError,P as BlockedAddressError,x as AuthorizationError,ia as AuthenticationMiddleware,C as AuthenticationError,D as ApiRouter};
2
+ import{$e as L,$g as oa,Kg as $,Lg as aa,Mg as ba,Pg as ca,Qg as da,Rg as ea,Sg as fa,Tg as ga,Ug as ha,Vg as ia,Wg as ja,Xe as I,Xg as ka,Ye as J,Yg as la,Zg as ma,_e as K,_g as na,ah as pa,bh as qa,ch as ra,dh as sa,eh as ta,ge as q,he as r,ie as s,je as t,ke as u,kg as _,le as v,me as w,ne as D,se as E,ve as F,we as G,xe as H}from"../chunk-6atxvmvj.js";import"../chunk-99be7vbh.js";import"../chunk-n3pc62tc.js";import{$h as p,Ai as X,Bi as Y,Ci as Z,Eh as a,Fh as b,Gh as d,Lh as e,Mh as f,Nh as g,Oh as h,Ph as i,Qh as j,Vh as n,Wh as o,ai as x,bi as y,ci as z,di as A,ei as B,fi as C,pi as M,qi as N,ri as O,si as P,ti as Q,ui as R,vi as S,wi as T,xi as U,yi as V,zi as W}from"../chunk-s7tn2t8x.js";import{Pi as c}from"../chunk-kscwjycy.js";import{Ui as k,Vi as l,Wi as m}from"../chunk-p4ka241x.js";import"../chunk-hkp00b9x.js";import"../chunk-70kpm72z.js";import"../chunk-1btx3kkv.js";import"../chunk-egzfxdr1.js";import"../chunk-rh811v1f.js";import"../chunk-wamxfhh6.js";import"../chunk-cd847h0t.js";import"../chunk-zh0knwen.js";import"../chunk-04ffq2ge.js";import"../chunk-pfjky33c.js";import"../chunk-vqar6ysw.js";import"../chunk-mxhy19a9.js";import"../chunk-22jm6sn1.js";import"../chunk-yc2pnb1w.js";import"../chunk-7effp39a.js";import"../chunk-51fvpq55.js";import"../chunk-wgre66wq.js";export{g as toRangeHeaderValue,s as toMiddlewareList,k as stateKey,Z as safeFetch,f as resolveRange,e as parseRangeHeader,h as parseContentRange,w as parseByteSize,ha as middlewareConfigDefaults,r as httpError,d as getCookies,j as formatUnsatisfiedContentRange,i as formatContentRange,pa as defineResourcePolicy,ga as defineMiddlewareConfig,t as createUnsatisfiableResponse,u as createStreamResponse,K as createFileResponse,H as clientIp,X as classifyAddress,ba as authorizeChannel,L as ViewRouter,n as ValidationError,U as TooManyRedirectsError,S as TooLargeError,R as TimeoutError,qa as SitemapError,ra as Sitemap,J as SameSiteBounceMiddleware,Y as SafeResponse,M as SafeFetchError,I as SAME_SITE_BOUNCE_PARAM,sa as RobotsTxt,ta as Robots,oa as ResourcePolicy,b as ResourceController,m as RequestState,c as RequestBreakerError,G as RateLimitMiddleware,E as RateLimitExceededError,z as RangeNotSatisfiableError,ma as PoliciesServiceProvider,na as Policies,v as PayloadTooLargeError,A as NotFoundError,V as NetworkError,l as MissingRequestStateError,F as Middleware,ea as McpToolDeclaration,fa as McpRouter,da as McpRouteDeclaration,ca as McpModelParam,o as InvalidValidationRuleError,N as InvalidUrlError,y as InsufficientPermissionsError,W as HttpStatusError,q as HttpResponse,p as HttpRequest,B as FileNotFoundError,Q as DnsError,ka as CorsMiddleware,a as Controller,T as ContentTypeError,aa as ChannelRouter,$ as ChannelDeclaration,ja as CacheMiddleware,la as CSRFMiddleware,_ as BodyLimitMiddleware,O as BlockedHostError,P as BlockedAddressError,x as AuthorizationError,ia as AuthenticationMiddleware,C as AuthenticationError,D as ApiRouter};
3
3
 
4
4
  //# debugId=D06EAB8AC67553BC64756E2164756E21
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{da as T}from"../chunk-m683535s.js";import"../chunk-mvd4mc8p.js";import{bb as D}from"../chunk-hdr0m0md.js";import{de as b,ee as w}from"../chunk-z94ms1jv.js";import"../chunk-fv1r0w0r.js";import{af as j}from"../chunk-sadtazf5.js";import"../chunk-99be7vbh.js";import"../chunk-n3pc62tc.js";import"../chunk-jr7hdp5z.js";import"../chunk-kscwjycy.js";import"../chunk-mp9hfbs3.js";import"../chunk-hkp00b9x.js";import"../chunk-70kpm72z.js";import"../chunk-1btx3kkv.js";import"../chunk-egzfxdr1.js";import"../chunk-rh811v1f.js";import"../chunk-wamxfhh6.js";import"../chunk-cd847h0t.js";import"../chunk-zh0knwen.js";import"../chunk-04ffq2ge.js";import{Vk as V,Wk as X,Xk as E,Yk as L,Zk as R,_k as S}from"../chunk-pfjky33c.js";import"../chunk-vqar6ysw.js";import"../chunk-mxhy19a9.js";import"../chunk-22jm6sn1.js";import"../chunk-yc2pnb1w.js";import"../chunk-7effp39a.js";import"../chunk-51fvpq55.js";import"../chunk-wgre66wq.js";import{createElement as J,Fragment as M,isValidElement as U}from"react";function $(q,B){let G=Object.values(B).some((z)=>typeof z==="function"&&U(z(""))),Q=/{{([^{}]+?)(?::([^{}\[\]]+?))?(?:\[(.*?)\])?}}/g;if(!G)return q.replace(Q,(W,O,_,Z)=>{let C=O.includes(":")?O.split(":")[0]:O,H=B[C];if(H===void 0)return W;if(typeof H==="function"){let K=H(Z!==void 0?Z:"");if(U(K))throw Error("JSX returned in string context");return String(K)}if(_)switch(_.toLowerCase()){case"number":return Number(H).toString();case"string":return String(H);case"boolean":return Boolean(H).toString();default:return String(H)}return String(H)});else{let z=[],W=0,O=null;while((O=Q.exec(q))!==null){let[_,Z,C,H]=O,F=O.index,K=Z.includes(":")?Z.split(":")[0]:Z;if(F>W)z.push(q.substring(W,F));let Y=B[K];if(Y===void 0)z.push(_);else if(typeof Y==="function"){let A=Y(H!==void 0?H:"");z.push(A)}else if(C)switch(C.toLowerCase()){case"number":z.push(Number(Y).toString());break;case"string":z.push(String(Y));break;case"boolean":z.push(Boolean(Y).toString());break;default:z.push(String(Y))}else z.push(String(Y));W=F+_.length}if(W<q.length)z.push(q.substring(W));return J(M,{},...z)}}class P{name;dictionary;constructor(q,B){this.name=q;this.dictionary=B}reference(q){if(typeof window<"u")throw Error("Cannot use reference in the browser");if(!this.dictionary?.[q])throw Error(`Translation not found for ${String(q)}`);return this.dictionary[q]}render(q,...B){let{locale:G=j.locale(),params:Q}={params:{},...B[0]};if(typeof window<"u")throw Error("Cannot use render in the browser");if(!this.dictionary?.[q]?.[G])throw Error(`Translation not found for ${String(q)} in ${String(G)}`);return $(this.dictionary[q][G],Q??{})}static create(q,B){return new P(q,B)}static text(q,...B){let{locale:G=j.locale(),params:Q}={params:{},...B?.[0]};if(!q?.[G])throw Error(`Translation not found for ${String(G)}`);return $(q[G],Q??{})}}async function N(q,B,...G){let{locale:Q=j.locale(),params:z}={params:{},...G[0]},O=(await q.load(String(Q)))[B];if(typeof O!=="string")throw Error(`Translation not found for "${B}" in "${String(Q)}" (dictionary ${q.id})`);return $(O,z??{})}export{w as translationConfigDefaults,N as translate,V as resolveLocale,X as negotiateLocale,L as isValidTimeZone,b as defineTranslationConfig,T as defineDictionary,R as createFormatter,S as Translator,D as TranslationServiceProvider,P as Dictionary,E as DEFAULT_TIME_ZONE};
2
+ import{da as T}from"../chunk-m683535s.js";import"../chunk-mvd4mc8p.js";import{bb as D}from"../chunk-hdr0m0md.js";import{de as b,ee as w}from"../chunk-z94ms1jv.js";import"../chunk-fv1r0w0r.js";import{af as j}from"../chunk-6atxvmvj.js";import"../chunk-99be7vbh.js";import"../chunk-n3pc62tc.js";import"../chunk-s7tn2t8x.js";import"../chunk-kscwjycy.js";import"../chunk-p4ka241x.js";import"../chunk-hkp00b9x.js";import"../chunk-70kpm72z.js";import"../chunk-1btx3kkv.js";import"../chunk-egzfxdr1.js";import"../chunk-rh811v1f.js";import"../chunk-wamxfhh6.js";import"../chunk-cd847h0t.js";import"../chunk-zh0knwen.js";import"../chunk-04ffq2ge.js";import{Vk as V,Wk as X,Xk as E,Yk as L,Zk as R,_k as S}from"../chunk-pfjky33c.js";import"../chunk-vqar6ysw.js";import"../chunk-mxhy19a9.js";import"../chunk-22jm6sn1.js";import"../chunk-yc2pnb1w.js";import"../chunk-7effp39a.js";import"../chunk-51fvpq55.js";import"../chunk-wgre66wq.js";import{createElement as J,Fragment as M,isValidElement as U}from"react";function $(q,B){let G=Object.values(B).some((z)=>typeof z==="function"&&U(z(""))),Q=/{{([^{}]+?)(?::([^{}\[\]]+?))?(?:\[(.*?)\])?}}/g;if(!G)return q.replace(Q,(W,O,_,Z)=>{let C=O.includes(":")?O.split(":")[0]:O,H=B[C];if(H===void 0)return W;if(typeof H==="function"){let K=H(Z!==void 0?Z:"");if(U(K))throw Error("JSX returned in string context");return String(K)}if(_)switch(_.toLowerCase()){case"number":return Number(H).toString();case"string":return String(H);case"boolean":return Boolean(H).toString();default:return String(H)}return String(H)});else{let z=[],W=0,O=null;while((O=Q.exec(q))!==null){let[_,Z,C,H]=O,F=O.index,K=Z.includes(":")?Z.split(":")[0]:Z;if(F>W)z.push(q.substring(W,F));let Y=B[K];if(Y===void 0)z.push(_);else if(typeof Y==="function"){let A=Y(H!==void 0?H:"");z.push(A)}else if(C)switch(C.toLowerCase()){case"number":z.push(Number(Y).toString());break;case"string":z.push(String(Y));break;case"boolean":z.push(Boolean(Y).toString());break;default:z.push(String(Y))}else z.push(String(Y));W=F+_.length}if(W<q.length)z.push(q.substring(W));return J(M,{},...z)}}class P{name;dictionary;constructor(q,B){this.name=q;this.dictionary=B}reference(q){if(typeof window<"u")throw Error("Cannot use reference in the browser");if(!this.dictionary?.[q])throw Error(`Translation not found for ${String(q)}`);return this.dictionary[q]}render(q,...B){let{locale:G=j.locale(),params:Q}={params:{},...B[0]};if(typeof window<"u")throw Error("Cannot use render in the browser");if(!this.dictionary?.[q]?.[G])throw Error(`Translation not found for ${String(q)} in ${String(G)}`);return $(this.dictionary[q][G],Q??{})}static create(q,B){return new P(q,B)}static text(q,...B){let{locale:G=j.locale(),params:Q}={params:{},...B?.[0]};if(!q?.[G])throw Error(`Translation not found for ${String(G)}`);return $(q[G],Q??{})}}async function N(q,B,...G){let{locale:Q=j.locale(),params:z}={params:{},...G[0]},O=(await q.load(String(Q)))[B];if(typeof O!=="string")throw Error(`Translation not found for "${B}" in "${String(Q)}" (dictionary ${q.id})`);return $(O,z??{})}export{w as translationConfigDefaults,N as translate,V as resolveLocale,X as negotiateLocale,L as isValidTimeZone,b as defineTranslationConfig,T as defineDictionary,R as createFormatter,S as Translator,D as TranslationServiceProvider,P as Dictionary,E as DEFAULT_TIME_ZONE};
3
3
 
4
4
  //# debugId=2CCE3E84667E619364756E2164756E21
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Fa as E}from"../chunk-e9c02bq0.js";import{ab as p}from"../chunk-cjefq3ry.js";import{bb as H}from"../chunk-hdr0m0md.js";import{Cb as L,Db as Q,Eb as T,Ib as U,Jb as y,Kb as F,Lb as C,Ob as D,Pb as I,Sb as b,Vb as f,Wb as k,Xb as m,ob as g,pb as W,qb as _,rb as l,sb as P,tb as u,ub as $,vb as V,wb as q,xb as B,yb as K}from"../chunk-75ajptxk.js";import"../chunk-5z7mqgkp.js";import"../chunk-z2btwd27.js";import"../chunk-3tyqnh59.js";import{Zd as h}from"../chunk-nc1gstvq.js";import"../chunk-z94ms1jv.js";import"../chunk-fv1r0w0r.js";import{Ce as a,De as d,Dg as A,Hg as R,Ve as n,We as v,zg as w}from"../chunk-sadtazf5.js";import"../chunk-99be7vbh.js";import"../chunk-n3pc62tc.js";import"../chunk-jr7hdp5z.js";import"../chunk-kscwjycy.js";import"../chunk-mp9hfbs3.js";import"../chunk-hkp00b9x.js";import{ij as M}from"../chunk-70kpm72z.js";import"../chunk-1btx3kkv.js";import"../chunk-egzfxdr1.js";import"../chunk-rh811v1f.js";import"../chunk-wamxfhh6.js";import"../chunk-cd847h0t.js";import"../chunk-zh0knwen.js";import"../chunk-04ffq2ge.js";import"../chunk-h4h8m3yr.js";import"../chunk-pfjky33c.js";import{$k as O,bl as z}from"../chunk-vqar6ysw.js";import"../chunk-mxhy19a9.js";import"../chunk-22jm6sn1.js";import"../chunk-yc2pnb1w.js";import"../chunk-7effp39a.js";import"../chunk-51fvpq55.js";import"../chunk-wgre66wq.js";var N=[C,I,E,T,L,k,B,Q,D,y,_,U,f,V,F,H,b,K,q,m,$];class S{config={};providers=[];services=[];serviceInstances=[];serviceTokens=new Set;servicesBooted=!1;models=[];app=new z;boot(){if(this.models.length>0)p(...this.models);else s();this.app.config.merge(this.config),z.setInstance(this.app),this.app.registerMany([...N,...this.providers]),this.registerServices()}registerServices(){let j=this.serviceTokens;this.serviceInstances=[],this.serviceTokens=new Set,this.servicesBooted=!1;let X=new Map;for(let G of this.services){let J=typeof G==="function"?new G:G,x=J.constructor;if(!x.token)throw Error(`Service [${x.name}] is listed in \`services\` but does not declare a \`static token\`.`);let Y=X.get(x.token);if(Y)throw Error(`Services [${Y}] and [${x.name}] both declare the token "${x.token}". Tokens are the container's keys, so they must be unique.`);X.set(x.token,x.name);let Z=x;if(!j.has(x.token)&&this.app.bound(Z))throw Error(`Service [${x.name}] declares the token "${x.token}", which is already bound in the container by the framework or a provider. Binding it would replace that service everywhere, so pick a token nothing else owns.`);this.app.instance(Z,J),this.serviceInstances.push(J),this.serviceTokens.add(x.token)}}async waitForBoot(){await this.app.boot(),await this.bootServices(),l(this.app)}async bootServices(){if(this.servicesBooted)return;for(let j of this.serviceInstances)await j.boot();this.servicesBooted=!0}shutdown(j){return this.run(()=>this.app.shutdown(j))}run(j){return O.run(this.app,j)}resolve(j){return this.app.make(j)}apiRoutes(){return this.app.make(A)}viewRoutes(){return this.app.make(w)}domains(){return this.app.make(R)}queue(){return this.app.make(h)}mcpHttp(){return this.app.config.get("route.mcp.remote.enabled")===!0?this.app.make(g):null}sockets(){return this.app.config.get("route.channels")?this.app.make(u):null}globalMiddleware(j){return P(j)}destroy(){if(this.app.resolved(W))this.app.make(W).stop();if(this.app.flush(),z.getInstance()===this.app)z.setInstance(void 0);O.disable()}}function s(){if(Bun.env.NODE_ENV==="production")return;let j=M();if(j.length===0)return;console.warn(`[gemi] ${j.length} model${j.length===1?" is":"s are"} registered, but Kernel.models is empty.
2
+ import{Fa as E}from"../chunk-e9c02bq0.js";import{ab as p}from"../chunk-qttv23e7.js";import{bb as H}from"../chunk-hdr0m0md.js";import{Cb as L,Db as Q,Eb as T,Ib as U,Jb as y,Kb as F,Lb as C,Ob as D,Pb as I,Sb as b,Vb as f,Wb as k,Xb as m,ob as g,pb as W,qb as _,rb as l,sb as P,tb as u,ub as $,vb as V,wb as q,xb as B,yb as K}from"../chunk-my8hz9k0.js";import"../chunk-y4bjsyt4.js";import"../chunk-z2btwd27.js";import"../chunk-3tyqnh59.js";import{Zd as h}from"../chunk-nc1gstvq.js";import"../chunk-z94ms1jv.js";import"../chunk-fv1r0w0r.js";import{Ce as a,De as d,Dg as A,Hg as R,Ve as n,We as v,zg as w}from"../chunk-6atxvmvj.js";import"../chunk-99be7vbh.js";import"../chunk-n3pc62tc.js";import"../chunk-s7tn2t8x.js";import"../chunk-kscwjycy.js";import"../chunk-p4ka241x.js";import"../chunk-hkp00b9x.js";import{ij as M}from"../chunk-70kpm72z.js";import"../chunk-1btx3kkv.js";import"../chunk-egzfxdr1.js";import"../chunk-rh811v1f.js";import"../chunk-wamxfhh6.js";import"../chunk-cd847h0t.js";import"../chunk-zh0knwen.js";import"../chunk-04ffq2ge.js";import"../chunk-h4h8m3yr.js";import"../chunk-pfjky33c.js";import{$k as O,bl as z}from"../chunk-vqar6ysw.js";import"../chunk-mxhy19a9.js";import"../chunk-22jm6sn1.js";import"../chunk-yc2pnb1w.js";import"../chunk-7effp39a.js";import"../chunk-51fvpq55.js";import"../chunk-wgre66wq.js";var N=[C,I,E,T,L,k,B,Q,D,y,_,U,f,V,F,H,b,K,q,m,$];class S{config={};providers=[];services=[];serviceInstances=[];serviceTokens=new Set;servicesBooted=!1;models=[];app=new z;boot(){if(this.models.length>0)p(...this.models);else s();this.app.config.merge(this.config),z.setInstance(this.app),this.app.registerMany([...N,...this.providers]),this.registerServices()}registerServices(){let j=this.serviceTokens;this.serviceInstances=[],this.serviceTokens=new Set,this.servicesBooted=!1;let X=new Map;for(let G of this.services){let J=typeof G==="function"?new G:G,x=J.constructor;if(!x.token)throw Error(`Service [${x.name}] is listed in \`services\` but does not declare a \`static token\`.`);let Y=X.get(x.token);if(Y)throw Error(`Services [${Y}] and [${x.name}] both declare the token "${x.token}". Tokens are the container's keys, so they must be unique.`);X.set(x.token,x.name);let Z=x;if(!j.has(x.token)&&this.app.bound(Z))throw Error(`Service [${x.name}] declares the token "${x.token}", which is already bound in the container by the framework or a provider. Binding it would replace that service everywhere, so pick a token nothing else owns.`);this.app.instance(Z,J),this.serviceInstances.push(J),this.serviceTokens.add(x.token)}}async waitForBoot(){await this.app.boot(),await this.bootServices(),l(this.app)}async bootServices(){if(this.servicesBooted)return;for(let j of this.serviceInstances)await j.boot();this.servicesBooted=!0}shutdown(j){return this.run(()=>this.app.shutdown(j))}run(j){return O.run(this.app,j)}resolve(j){return this.app.make(j)}apiRoutes(){return this.app.make(A)}viewRoutes(){return this.app.make(w)}domains(){return this.app.make(R)}queue(){return this.app.make(h)}mcpHttp(){return this.app.config.get("route.mcp.remote.enabled")===!0?this.app.make(g):null}sockets(){return this.app.config.get("route.channels")?this.app.make(u):null}globalMiddleware(j){return P(j)}destroy(){if(this.app.resolved(W))this.app.make(W).stop();if(this.app.flush(),z.getInstance()===this.app)z.setInstance(void 0);O.disable()}}function s(){if(Bun.env.NODE_ENV==="production")return;let j=M();if(j.length===0)return;console.warn(`[gemi] ${j.length} model${j.length===1?" is":"s are"} registered, but Kernel.models is empty.
3
3
  Nested relation reads resolve a model by name, so a policy on a subclass that does not own its
4
4
  `+" name is skipped inside every include \u2014 scoped at the root, "+`unscoped in an include, with nothing
5
5
  to notice it. Declaring the modules registers each class under its own name and audits the set:
package/dist/orm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ca as A6}from"../chunk-e0w1mf72.js";import{$a as F6,Ga as z9,Ha as J9,Ia as n,Ja as b9,Ka as S3,La as R6,Ma as I6,Na as q0,Oa as a5,Pa as b3,Qa as U6,Ra as $3,Sa as I0,Ta as e4,Ua as $7,Va as Z7,Wa as p5,Xa as X7,Ya as z7,Za as J7,_a as N6,ab as O6}from"../chunk-cjefq3ry.js";import{fh as Q6,gh as _6,hh as C6,ih as L6,jh as T6}from"../chunk-99be7vbh.js";import{Ah as P6,Bh as j6,Ch as K6,Dh as r5,kh as A0,lh as o,mh as j,nh as i,qh as R,rh as x,sh as d,th as W6,uh as M6,vh as X5,wh as B6,xh as h3,yh as k,zh as D6}from"../chunk-n3pc62tc.js";import"../chunk-mp9hfbs3.js";import{fj as e8,gj as a,hj as l,ij as C9,jj as B3,lj as V6,mj as G6,rj as l4,sj as o4,tj as t4,uj as r4,vj as a4}from"../chunk-70kpm72z.js";import{Aj as s8,Bj as $0,Cj as i8,Dj as d5,Ej as n8,Fj as _5,Gj as l8,Ij as o8,Jj as c5,Kj as t8,Lj as r8,Mj as s5,Nj as L3,Oj as f0,Pj as p3,Qj as d3,Rj as c,Sj as a8,Tj as g0,Uj as i5,wj as K,xj as T,yj as k0,zj as g}from"../chunk-1btx3kkv.js";import{$j as X6,ak as e0,bk as T0,ck as F3,fk as z6,hk as J6,ik as Y6,jk as n5,kk as l5,lk as u5,mk as O3,nk as H6,ok as o5,pk as t5}from"../chunk-cd847h0t.js";import{Ak as $6,Ck as Z6,Ek as m5}from"../chunk-zh0knwen.js";import{cl as h5}from"../chunk-vqar6ysw.js";import"../chunk-mxhy19a9.js";import"../chunk-wgre66wq.js";function N0($,Z,X,z,J,Y){let H=X0($,Z),G=B0($,H,Z,Y),V=X.quoteIdent(z),W=`${V}.`,M=G.parentFields.map((L,C)=>{let F=`${W}${X.quoteIdent(Z3(H,Z,G.childFields[C]))}`,N=`${J}${X.quoteIdent(Z3($,Z,L))}`;return`${F} = ${N}`}).join(" and ");if(!G.join)return{child:H,source:`${X.quoteIdent(H.table)} as ${V}`,correlation:M,qualifier:W};let B=`${W}${X.quoteIdent(Z3(H,Z,G.childFields[0]))}`,D=`${J}${X.quoteIdent(Z3($,Z,G.parentFields[0]))}`,P=X.quoteIdent(`${z}j`);return{child:H,source:`${X.quoteIdent(H.table)} as ${V} join ${X.quoteIdent(G.join.table)} as ${P} on ${P}.${X.quoteIdent(G.join.childColumn)} = ${B}`,correlation:`${P}.${X.quoteIdent(G.join.parentColumn)} = ${D}`,qualifier:W}}function Z3($,Z,X){let z=$.fields[X];if(!z)throw new c($.name,Z.name,`it joins on '${X}', which is not a field on ${$.name}.`);return z.column}function u($,Z,X){let z=X3($);if(typeof Z!=="object"||Z===null||Array.isArray(Z))throw Z9($,X,z);let J=Object.keys(Z).filter((H)=>Z[H]!==void 0),Y=Z;for(let H of z){if(H.length===1&&J.includes(H[0]))return $9($,X,H[0],Y[H[0]]),H;let G=H.join("_");if(H.length>1&&J.includes(G)){let V=Y[G];if(V&&typeof V==="object"&&!Array.isArray(V))for(let W of H)$9($,X,`${G}.${W}`,V[W]);return H}}throw Z9($,X,z)}function x3($){if($===null||$===void 0)return!1;let Z=typeof $;if(Z!=="object")return Z!=="function"&&Z!=="symbol";if(Array.isArray($))return!1;if($ instanceof Date||ArrayBuffer.isView($))return!0;let X=Object.getPrototypeOf($);return X!==Object.prototype&&X!==null}function $9($,Z,X,z){if(z===void 0||x3(z))return;throw new T(`${Z.argument}.${X}`,Z.model,Z.operation,`A unique key takes a plain value to match, not ${z===null?"null":Array.isArray(z)?"an array":"a filter object"}. Use findFirst/findMany (or updateMany/deleteMany) to filter on ${$.name}.${X.split(".").pop()}.`)}function v3($,Z,X){u($,Z,{model:$.name,operation:X,argument:"where"})}function X3($){let Z=[];if($.primaryKey.length>0)Z.push($.primaryKey);for(let X of $.uniques)Z.push(X);return Z}function Z9($,Z,X){let z=X.map((H)=>H.length===1?H[0]:H.join("_")).join(", "),Y=Z.argument.startsWith("data.")?`Name it by one of those, or reach it through the ${$.name} model directly.`:`Use ${Z.operation==="delete"||Z.operation==="update"?`${Z.operation}Many`:"findFirst"} to query on anything else.`;return new K(Z.argument,Z.model,Z.operation,`${$.name} needs a unique field here. It declares: ${z}. ${Y}`)}function y($,Z,X){let z=Z.castParameter($);if(!z)return i(X);return i((J,Y)=>{let H=X(J,Y);if(H===null||H===void 0)return null;let G=k(H);if(G==="db")return null;if(G==="json")return"null";if(G==="any")throw Error("gemi ORM bug: Prisma.AnyNull reached the parameter binder. It is a filter operand only, and both the filter and write paths are supposed to have handled it before this point.");return JSON.stringify(H)},z)}function f($,Z,X,z){if(Z===void 0||Z===null)return null;if(typeof Z!=="object"||Array.isArray(Z))throw new T("where",$.name,X.operation,"Expected an object.");let J=[];for(let Y of Object.keys(Z).sort()){let H=Z[Y];if(H===void 0)continue;let G=(W)=>z(W)?.[Y];if(Y==="AND"||Y==="OR"){let W=X9($,H,X,G,Y);if(W)J.push(W);continue}if(Y===z0){J.push(j7($,H,X,G));continue}if(Y==="NOT"){let W=X9($,H,X,G,"AND");if(W)J.push(R(j("not "),w0(W)));continue}if(Y in $.relations){let W=B7($,$.relations[Y],H,X,G);if(W)J.push(W);continue}let V=$.fields[Y];if(!V){let W=P7($,Y,H,X,G);if(W){J.push(W);continue}throw new g(Y,$.name,Object.keys($.fields))}J.push(u3($,V,H,X,G))}if(J.length===0)return null;if(J.length===1)return J[0];return t(J," and ")}function B7($,Z,X,z,J){let Y=z9(Z.kind),H=D7($,Z,X,Y,z),G=z.relationDepth??0,V=z.dialect,W=z.qualifier??`${V.quoteIdent($.table)}.`,M=N0($,Z,V,`_r${G}`,W,z.operation),B=M.child,D=j(M.correlation),P={...z,qualifier:M.qualifier,relationDepth:G+1},L=[];for(let C of Y){if(!(C in H))continue;let F=H[C],N=(I)=>H.direct?J(I):J(I)?.[C];if(F===null){L.push(k3(M,D,null,C==="is"));continue}let _=f(B,F,P,N);if(C==="every"){if(!_)continue;L.push(k3(M,D,R(j("not "),w0(_)),!0));continue}let Q=C==="none"||C==="isNot";L.push(k3(M,D,_,Q))}if(L.length===0)return null;if(L.length===1)return L[0];return t(L," and ")}function k3($,Z,X,z){let J=[j(`${z?"not ":""}exists (select 1 from ${$.source} where `),Z];if(X)J.push(j(" and "),X);return J.push(j(")")),R(...J)}function D7($,Z,X,z,J){let Y=`where.${Z.name}`,H=Z.kind==="many";if(X===null){if(H)throw new K(Y,$.name,J.operation,`${Z.name} is a to-many relation, so null is not a filter for it. Use { none: {} } for "has no related rows".`);return{is:null,direct:!0}}if(typeof X!=="object"||Array.isArray(X))throw new T(Y,$.name,J.operation,H?`Expected an object holding ${z.join(", ")}.`:"Expected an object, or null.");if(J9(X,z))return X;if(H)throw new K(Y,$.name,J.operation,`Expected one of ${z.join(", ")}. A to-many relation has no `+"single reading of a bare filter \u2014 { some: \u2026 } and { every: \u2026 } mean "+"different things.");return{is:X,direct:!0}}function P7($,Z,X,z,J){let Y=X3($).find((V)=>V.length>1&&V.join("_")===Z);if(!Y)return null;if(typeof X!=="object"||X===null||Array.isArray(X))throw new T(`where.${Z}`,$.name,z.operation,`Expected an object holding ${Y.join(" and ")}.`);let H=X,G=[];for(let V of Y){if(H[V]===void 0)throw new K(`where.${Z}`,$.name,z.operation,`Missing '${V}'. A composite key needs all of ${Y.join(", ")}.`);if(!x3(H[V]))throw new T(`where.${Z}.${V}`,$.name,z.operation,`A composite key takes a plain value for each of ${Y.join(", ")}, not a filter, an array or null.`);G.push(u3($,$.fields[V],H[V],z,(W)=>J(W)?.[V]))}return G.length===1?G[0]:t(G," and ")}function X9($,Z,X,z,J){let Y=[];if(Array.isArray(Z))for(let H=0;H<Z.length;H++){let G=f($,Z[H],X,(V)=>z(V)?.[H]);if(G)Y.push(G)}else{let H=f($,Z,X,z);if(H)Y.push(H)}if(Y.length===0)return J==="AND"?null:Y9;if(Y.length===1)return Y[0];return t(Y,J==="AND"?" and ":" or ")}var Y9=j("false");function t($,Z){return R(j("("),x($,Z),j(")"))}function w0($){return $.text.startsWith("(")?$:t([$],"")}var y3=new Set(["equals","not","in","notIn","lt","lte","gt","gte","contains","startsWith","endsWith","mode"]),H9={lt:"<",lte:"<=",gt:">",gte:">="},z0="$compositeIn",V9=Symbol("gemi.orm.compositeInFromPlanner");function G9($,Z){return{[V9]:!0,fields:$,values:Z}}function j7($,Z,X,z){let{dialect:J}=X,H=K7($,Z,X).map((V)=>{let W=$.fields[V];if(!W)throw new g(V,$.name,Object.keys($.fields));return W}),G=H.map((V)=>`${X.qualifier??""}${J.quoteIdent(V.column)}`);return J.compositeIn(G,H.map((V)=>V.type),(V)=>z(V).values)}function K7($,Z,X){let z=()=>{throw new g(z0,$.name,Object.keys($.fields))};if(typeof Z!=="object"||Z===null||Array.isArray(Z))return z();if(Z[V9]!==!0)return z();let J=(G)=>{throw new K(z0,$.name,X.operation,G)},{fields:Y,values:H}=Z;if(!Array.isArray(Y)||Y.length===0)return J(`the planner built a '${z0}' with no fields.`);if(!Y.every((G)=>typeof G==="string"))return J(`the planner built a '${z0}' with a non-string field.`);if(!Array.isArray(H))return J(`the planner built a '${z0}' with no values.`);if(!H.every((G)=>Array.isArray(G)&&G.length===Y.length))return J(`the planner built a '${z0}' whose tuples do not all have ${Y.length} value(s).`);return Y}var Q7=["equals","has","hasEvery","hasSome","isEmpty"],f3=new Set(Q7);function _7($,Z,X,z,J,Y){let{dialect:H}=J;if(O0($,Z,`where.${Z.name}`,J.operation,H),Array.isArray(z))throw new T(`where.${Z.name}`,$.name,J.operation,`'${Z.name}' is a scalar list, and a bare array is not a filter on `+"one \u2014 Prisma rejects it here too. Say which comparison you mean: "+`{ ${Z.name}: { equals: [...] } } for the whole list, or { ${Z.name}: { hasEvery: [...] } } for "contains all of these". A bare array *is* accepted as a value in \`data\`.`);if(!m3(z))throw new T(`where.${Z.name}`,$.name,J.operation,`'${Z.name}' is a scalar list. Expected an object holding ${[...f3].sort().join(", ")}; received ${z===null?"null":typeof z}.`);let G=z,V=[];for(let W of Object.keys(G).sort()){let M=G[W];if(M===void 0)continue;if(!f3.has(W))throw new T(`where.${Z.name}.${W}`,$.name,J.operation,`'${Z.name}' is a scalar list, and a list filter takes ${[...f3].sort().join(", ")}. The scalar operators \u2014 `+`${[...y3].sort().join(", ")} \u2014 apply to a single value and `+"Prisma does not offer them here.");let B=(D)=>Y(D)?.[W];V.push(C7($,Z,X,W,M,J,B))}if(V.length===0)return j("true");if(V.length===1)return V[0];return t(V," and ")}function C7($,Z,X,z,J,Y,H){let{dialect:G}=Y;if(z==="equals")return L7($,Z,X,J,Y,H);if(z==="isEmpty"){if(typeof J!=="boolean")throw new T(`where.${Z.name}.isEmpty`,$.name,Y.operation,`Expected true or false, received ${J===null?"null":typeof J}.`);return G.listIsEmpty(X,J)}if(z==="has"){let W=T7(Z);return G.listHas(X,y(W,G,F0(W,G,H)))}if(!Array.isArray(J))throw new T(`where.${Z.name}.${z}`,$.name,Y.operation,`Expected an array, received ${J===null?"null":typeof J}.`);let V=y(Z,G,F0(Z,G,H));return z==="hasEvery"?G.listHasEvery(X,V):G.listHasSome(X,V)}function L7($,Z,X,z,J,Y){let{dialect:H}=J;if(z===null)return j(`${X} is null`);if(!Array.isArray(z))throw new T(`where.${Z.name}.equals`,$.name,J.operation,`'${Z.name}' is a scalar list, so it compares against an array. Received ${typeof z}. For "is this element present", use { ${Z.name}: { has: \u2026 } }.`);return R(j(`${X} = `),y(Z,H,F0(Z,H,Y)))}function T7($){return{...$,isList:!1}}function O0($,Z,X,z,J){if(J.listFilters.size>0)return;throw new K(X,$.name,z,`'${Z.name}' is a scalar list, and ${J.name} has no array type to hold one. Prisma refuses the column itself on ${J.name} \u2014 `+'"the current connector does not support lists of primitive types" \u2014 so '+`this is a difference between the databases rather than a gap in the ORM. The generated artifact is dialect-agnostic, which is why this surfaces here rather than at \`prisma generate\`: the schema was generated against Postgres and DATABASE_URL names a ${J.name} database, which has no '${Z.column}' column either. It works on postgres.`)}var R7=["equals","not","string_contains","string_starts_with","string_ends_with","array_contains","lt","lte","gt","gte"],g3=new Set(R7),I7=["has_key","has_some_keys","has_every_key"],z3=new Set(I7);function W9($,Z,X,z,J,Y,H,G){let V=z!=="has_key",W=`where.${Z.name}.${z}`,M=(D)=>{if(!(V?Array.isArray(D)&&D.every((L)=>typeof L==="string"):typeof D==="string"))throw new T(W,$.name,Y.operation,V?"Expected an array of key names, like ['a', 'b'].":"Expected a key name, like 'a'.");return D};M(J);let B=(D,P)=>M(G(D,P));return Y.dialect.jsonHasKeys(X,H,B,z==="has_key"?"one":z==="has_some_keys"?"some":"every",Array.isArray(J)?J.length:0)}function U7($,Z,X,z,J,Y){let{dialect:H}=J;if(Z.type!=="Json")throw new K(`${Z.name}.path`,$.name,J.operation,`A 'path' filter reads inside a JSON document, and '${Z.name}' is a ${Z.type} column.`);A7($,Z,z.path,J);let G=(M)=>Y(M)?.path,V=Object.keys(z).filter((M)=>M!=="path"&&z[M]!==void 0).sort();if(V.length===0)throw new K(`${Z.name}.path`,$.name,J.operation,`A 'path' needs a filter beside it \u2014 ${[...g3,...z3].sort().join(", ")}. Prisma refuses a bare path too.`);let W=[];for(let M of V){if(z3.has(M)){W.push(W9($,Z,X,M,z[M],J,G,(P)=>Y(P)?.[M]));continue}if(!g3.has(M))throw new K(`${Z.name}.${M}`,$.name,J.operation,`A JSON path filter takes ${[...g3,...z3].sort().join(", ")}.`);if(!H.jsonFilters.has(M))throw new K(`${Z.name}.${M}`,$.name,J.operation,`'${M}' on a JSON path is not available on ${H.name}. Prisma refuses it here too, so this is a difference between the databases rather than a gap in the ORM. It works on postgres.`);let B=z[M],D=B===null?"json":k(B);if(D&&(M==="equals"||M==="not")){W.push(N7(D,X,G,Z,H,M==="not"));continue}if(D&&B!==null){let P=M==="array_contains"?"'array_contains' tests containment against a document, and a sentinel is not one":`'${M}' compares an extracted value against a scalar, and a sentinel is not one`;throw new T(`where.${Z.name}.${M}`,$.name,J.operation,`${x0(D)} asks which kind of null a value is, which `+`only 'equals' and 'not' can express \u2014 ${P}. Prisma refuses it under this operator too. Write { ${Z.name}: { path: [\u2026], equals: ${x0(D)} } }, `+"or filter the column itself \u2014 "+`{ ${Z.name}: { equals: ${x0(D)} } }.`)}if(M9(B))throw new T(`where.${Z.name}.${M}`,$.name,J.operation,"Prisma.AnyNull is a question rather than a value \u2014 'either kind of "+"null' \u2014 so it cannot appear inside a document. Ask it directly: "+`{ ${Z.name}: { path: [\u2026], equals: Prisma.AnyNull } }.`);F7(M,B,$,Z,J),W.push(O7(M,X,G,Z,H,(P)=>Y(P)?.[M]))}return W.length===1?W[0]:t(W," and ")}function N7($,Z,X,z,J,Y){let H=()=>R(J.jsonValueAt(Z,X),j(Y?" is not null":" is null")),G=()=>R(J.jsonValueAt(Z,X),j(Y?" <> ":" = "),y(z,J,()=>J.encode(h3,z)));if($==="db")return H();if($==="json")return G();return t([G(),H()],Y?" and ":" or ")}function F7($,Z,X,z,J){let Y=$==="string_contains"||$==="string_starts_with"||$==="string_ends_with";if(Y&&typeof Z!=="string")throw new T(`where.${z.name}.${$}`,X.name,J.operation,`Expected a string, received ${Z===null?"null":typeof Z}. Prisma raises here too \u2014 without this the pattern becomes `+`'%${String(Z)}%', which runs and returns the wrong rows.`);if(Z===null)throw new T(`where.${z.name}.${$}`,X.name,J.operation,$==="array_contains"?"null cannot be tested for containment through a JSON path: the operand binds as SQL NULL rather than as the JSON value, and "+"'x @> NULL' is NULL rather than true \u2014 the query would run and "+`match nothing. A null *inside* the document is an ordinary value and still compiles: { ${z.name}: { path: [\u2026], array_contains: [null] } }.`:`null cannot be compared through a JSON path with '${$}', which `+"compares the extracted value as a number \u2014 the comparison against "+`NULL is NULL rather than true, so the query would run and match nothing. Prisma refuses it here too. For "the value at this path is a JSON null", use equals or not: { ${z.name}: { path: [\u2026], equals: null } }.`);if($==="array_contains"||Y)return;if(typeof Z==="object")throw new K(`where.${z.name}.${$}`,X.name,J.operation,`'${$}' on a JSON path compares the extracted value as a scalar, so `+"an object or array operand cannot be expressed \u2014 it would bind as "+`'${String(Z)}' and match nothing. Prisma accepts one here; gemi does not yet. Use array_contains for containment, or narrow the path until it names a scalar.`)}function O7($,Z,X,z,J,Y){if($==="array_contains")return J.jsonArrayContains(Z,X,Y);let H=$==="string_contains"||$==="string_starts_with"||$==="string_ends_with",G=J.jsonExtract(Z,X,!0);if(H){let B=$==="string_contains"?(D)=>`%${D}%`:$==="string_starts_with"?(D)=>`${D}%`:(D)=>`%${D}`;return R(j("("),G,j(") like "),i((D,P)=>{let L=Y(D,P);return L===null||L===void 0?null:B(String(L))}))}let V=$==="equals"?"=":$==="not"?"<>":H9[$],W=$!=="equals"&&$!=="not",M=W?R(j("cast(("),G,j(") as real)")):R(j("("),G,j(")"));return R(M,j(` ${V} `),i((B,D)=>{let P=Y(B,D);if(P===null||P===void 0)return null;if(W)return Number(P);return J.jsonComparesAsText?String(P):P}))}function A7($,Z,X,z){let{dialect:J}=z,Y=J.jsonPathSyntax==="array"?"array":"jsonpath",H=Array.isArray(X)?"array":typeof X==="string"?"jsonpath":"other";if(Array.isArray(X)&&X.length===0||X==="")throw new K(`${Z.name}.path`,$.name,z.operation,`A JSON path cannot be empty. ${J.jsonPathSyntax==="array"?`On ${J.name} an empty array selects the whole document, `+"which is a filter on the column rather than on a path \u2014 write "+`{ ${Z.name}: { equals: \u2026 } } if that is what you meant.`:`On ${J.name} an empty string raises inside json_extract.`}`);if(H===Y){if(Y!=="array")return;let V=X.findIndex((B)=>typeof B!=="string");if(V===-1)return;let W=X[V],M=W===null?"null":W===void 0?"undefined":Array.isArray(W)?"an array":typeof W==="object"?"an object":`a ${typeof W}`;throw new K(`${Z.name}.path`,$.name,z.operation,`A JSON path is an array of strings, and path[${V}] is ${M}. `+(typeof W==="number"?'An array index is a key too \u2014 write ["items", "0"] rather than '+`["items", 0]; it reaches the same element, because ${J.name} takes the path as text. Prisma's path is string[] and its client refuses a number here too.`:"Prisma's path is string[] too."))}throw new K(`${Z.name}.path`,$.name,z.operation,J.jsonPathSyntax==="array"?`On ${J.name} a JSON path is an array of keys \u2014 ["a", "b"] \u2014 `+"not a JSONPath string. Prisma splits them the same way, and refuses the other form on each database.":`On ${J.name} a JSON path is a JSONPath string \u2014 "$.a.b" \u2014 not `+"an array of keys. Prisma splits them the same way, and refuses the other form on each database.")}function u3($,Z,X,z,J){let{dialect:Y}=z,H=`${z.qualifier??""}${Y.quoteIdent(Z.column)}`,G=k(X);if(G)throw new T(`where.${Z.name}`,$.name,z.operation,`${x0(G)} is not a filter on `+"its own \u2014 Prisma rejects it here too. Write it as an explicit "+`comparison: { ${Z.name}: { equals: ${x0(G)} } }.`);if(Z.isList)return _7($,Z,H,X,z,J);if(!m3(X))return J3(H,Z,X,Y,J);let V=X,W=Object.keys(V).sort();if(V.path!==void 0)return U7($,Z,H,V,z,J);let M=V.mode==="insensitive";if(V.mode!==void 0&&V.mode!=="default"){if(!M)throw new T(`mode: ${JSON.stringify(V.mode)}`,$.name,z.operation,"Prisma takes 'default' or 'insensitive'.");if(!Y.supportsInsensitiveMode)throw new K('mode: "insensitive"',$.name,z.operation,`The ${Y.name} dialect cannot express it \u2014 Prisma rejects it `+"here too. Note SQLite's LIKE is already case-insensitive for ASCII.")}let B=[];for(let D of W){let P=V[D];if(P===void 0||D==="mode")continue;if(Z.type==="Json"&&z3.has(D)){B.push(W9($,Z,H,D,P,z,void 0,(C)=>J(C)?.[D]));continue}if(!y3.has(D))throw new T(`where.${Z.name}.${D}`,$.name,z.operation,`A scalar filter takes ${[...y3].sort().join(", ")}.`);if(D!=="equals"&&D!=="not"&&M9(P))throw new T(`where.${Z.name}.${D}`,$.name,z.operation,`Prisma.AnyNull means 'either kind of null', which only 'equals' and 'not' can express. Write { ${Z.name}: { equals: Prisma.AnyNull } }, or name the one you mean with Prisma.DbNull or Prisma.JsonNull.`);let L=(C)=>J(C)?.[D];switch(D){case"equals":B.push(J3(H,Z,P,Y,L));break;case"not":B.push(S7($,Z,P,z,L,H));break;case"in":case"notIn":B.push(q7($,H,Z,P,z,L,D==="notIn"));break;case"lt":case"lte":case"gt":case"gte":B.push(R(j(`${H} ${H9[D]} `),y(Z,Y,F0(Z,Y,L))));break;case"contains":case"startsWith":case"endsWith":if(typeof P!=="string")throw new T(`where.${Z.name}.${D}`,$.name,z.operation,`Expected a string, received ${P===null?"null":typeof P}.`);if(Z.type!=="String")throw new K(`where.${Z.name}.${D}`,$.name,z.operation,`'${Z.name}' is a ${Z.type}, and ${D} only applies to strings.`);B.push(Y.like(H,M,E7(D,L)));break}}if(B.length===0)return j("true");if(B.length===1)return B[0];return t(B," and ")}function x0($){return`Prisma.${$==="db"?"DbNull":$==="json"?"JsonNull":"AnyNull"}`}function M9($){if(k($)==="any")return!0;return Array.isArray($)&&$.some((Z)=>k(Z)==="any")}function S7($,Z,X,z,J,Y){if(X===null||k(X)==="db")return j(`${Y} is not null`);if(k(X)==="json")return R(j("not "),w0(J3(Y,Z,X,z.dialect,J)));if(k(X)==="any")return R(j("not "),w0(J3(Y,Z,X,z.dialect,J)));if(!m3(X))return R(j(`${Y} <> `),y(Z,z.dialect,F0(Z,z.dialect,J)));let H=u3($,Z,X,z,J);return R(j("not "),w0(H))}function J3($,Z,X,z,J){if(X===null||k(X)==="db")return j(`${$} is null`);if(k(X)==="any")return t([j(`${$} is null`),b7($,Z,z)]," or ");return R(j(`${$} = `),y(Z,z,F0(Z,z,J)))}function b7($,Z,X){return R(j(`${$} = `),y(Z,X,()=>X.encode(h3,Z)))}function q7($,Z,X,z,J,Y,H){let{dialect:G}=J;if(!Array.isArray(z))throw new T(`where.${X.name}.${H?"notIn":"in"}`,$.name,J.operation,"Expected an array.");if(z.length===0)return H?j("true"):Y9;return G.inList(Z,H,z.length,(V)=>{return Y(V).map((M)=>G.encode(M,X))})}function E7($,Z){return(X)=>{let z=String(Z(X));if($==="contains")return`%${z}%`;if($==="startsWith")return`${z}%`;return`%${z}`}}function F0($,Z,X){return(z)=>Z.encode(X(z),$)}function m3($){return typeof $==="object"&&$!==null&&!Array.isArray($)&&!($ instanceof Date)&&!ArrayBuffer.isView($)}function B9($,Z,X,z,J,Y,H){let G=`orderBy.${Z.name}`;if(typeof X!=="object"||X===null||Array.isArray(X))throw new T(G,$.name,z,Z.kind==="many"?'Expected { _count: "asc" | "desc" }.':`Expected an object naming one field of ${Z.model}.`);let V=X,W=Object.keys(V).filter((C)=>C!=="where");if(W.length!==1)throw new K(G,$.name,z,W.length===0?"Name the field to order by.":`Name exactly one field to order by; got ${W.join(", ")}. `+"Order by several with an array: [{ a: \u2026 }, { b: \u2026 }].");let[M]=W,B=N0($,Z,J,`_o${H}`,`${J.quoteIdent($.table)}.`,z),D=w7($,Z,B.child,M,V[M],z,B.qualifier,J),P=f(B.child,V.where,{dialect:J,operation:z,qualifier:B.qualifier},(C)=>Y(C)?.where),L=[j(`(select ${D.expression} from ${B.source} where ${B.correlation}`)];if(P)L.push(j(" and "),P);return L.push(j(")")),{expression:R(...L),direction:D.direction,nulls:D.nulls}}function w7($,Z,X,z,J,Y,H,G){let V=`orderBy.${Z.name}.${z}`,{direction:W,nulls:M}=x7($,V,J,Y);if(z===n){if(Z.kind!=="many")throw new K(V,$.name,Y,`${Z.name} is a to-one relation, so its count is 0 or 1. Order by one of ${X.name}'s fields instead.`);return{expression:"count(*)",direction:W,nulls:M}}if(Z.kind==="many")throw new K(V,$.name,Y,`${Z.name} is a to-many relation, so ordering by '${z}' has no single answer for a parent with several children. Only `+"{ _count: \u2026 } is supported.");let B=X.fields[z];if(!B)throw new K(V,$.name,Y,`'${z}' is not a field on ${X.name}. Known fields: ${Object.keys(X.fields).join(", ")}.`);return{expression:`${H}${G.quoteIdent(B.column)}`,direction:W,nulls:M}}function x7($,Z,X,z){if(X==="asc"||X==="desc")return{direction:X};if(typeof X==="object"&&X!==null){let{sort:J,nulls:Y}=X;if(J!=="asc"&&J!=="desc")throw new T(Z,$.name,z,'Expected "asc" or "desc".');if(Y===void 0)return{direction:J};if(Y!=="first"&&Y!=="last")throw new K(`${Z}.nulls`,$.name,z,'Expected "first" or "last".');return{direction:J,nulls:Y}}throw new K(Z,$.name,z,'Expected "asc", "desc", or { sort, nulls }.')}var v7=new Set(["asc","desc"]),k7=new Set(["first","last"]);function D0($,Z,X,z){if(Z===void 0||Z===null)return[];let J=Array.isArray(Z),Y=J?Z:[Z],H=[];for(let G=0;G<Y.length;G++){let V=Y[G],W=(M)=>{let B=z?.locate(M);return J?B?.[G]:B};if(typeof V!=="object"||V===null)throw new T("orderBy",$.name,X,"Expected an object or an array of objects.");for(let[M,B]of Object.entries(V)){if(B===void 0)continue;if(M in $.relations){if(!z)throw new K(`orderBy.${M}`,$.name,X,"Ordering by a relation is not implemented here.");let P=B9($,$.relations[M],B,X,z.dialect,(L)=>W(L)?.[M],H.length);H.push({column:M,direction:P.direction,...P.nulls?{nulls:P.nulls}:{},expression:P.expression});continue}let D=$.fields[M];if(!D)throw new g(M,$.name,Object.keys($.fields));H.push({column:D.column,...D9($,M,B,X)})}}return H}function D9($,Z,X,z){if(typeof X==="string"){if(!v7.has(X))throw new T(`orderBy.${Z}: ${JSON.stringify(X)}`,$.name,z,'Expected "asc" or "desc".');return{direction:X}}if(typeof X==="object"&&X!==null){let{sort:J,nulls:Y}=X,H=D9($,Z,J,z).direction;if(Y===void 0)return{direction:H};if(typeof Y!=="string"||!k7.has(Y))throw new K(`orderBy.${Z}.nulls: ${JSON.stringify(Y)}`,$.name,z,'Expected "first" or "last".');return{direction:H,nulls:Y}}throw new K(`orderBy.${Z}`,$.name,z,'Expected "asc", "desc", or { sort, nulls }.')}function Y3($){return $.map((Z)=>({...Z,direction:Z.direction==="asc"?"desc":"asc",...Z.nulls?{nulls:Z.nulls==="first"?"last":"first"}:{}}))}function r($,Z,X){if($.length===0)return null;return x($.map((z)=>{let J=` ${z.direction}`+(z.nulls?` nulls ${z.nulls}`:"");if(z.expression)return x([z.expression,j(J)],"");return j(`${X??""}${Z.quoteIdent(z.column)}${J}`)}),", ")}function H3($,Z,X,z,J){if(typeof J!=="number"||!Number.isInteger(J))throw new T(X,$,Z,`Expected an integer, got ${JSON.stringify(J)}.`);if(z==="skip"&&J<0)throw new T(X,$,Z,"A 'skip' counts rows to pass over, so it cannot be negative. Prisma rejects one too.")}function Q0($,Z,X,z,J,Y=!1){if(X?.take!==void 0)H3($.name,Z,"take","take",X.take);if(X?.skip!==void 0)H3($.name,Z,"skip","skip",X.skip);let H=Y?1:X?.take,G=X?.skip,V=J;if((H!==void 0||G!==void 0)&&V.length===0&&!Y)V=$.primaryKey.map((P)=>({column:$.fields[P]?.column??P,direction:"asc"}));let M=typeof H==="number"&&H<0;if(M)V=Y3(V);let B=H===void 0?null:Y?()=>1:(P)=>Math.abs(Number(P?.take)),D=G===void 0?null:(P)=>Number(P?.skip);return{clause:z.paginate(B,D),terms:V,reversed:M}}function J0($,Z,X){let z=Z?.select,J=Z?.omit;if(z!==void 0&&Z?.include!==void 0)throw new K("select + include",$.name,X,"Prisma allows only one of them on the same query.");if(z!==void 0&&J!==void 0)throw new K("select + omit",$.name,X,"'select' names what to keep and 'omit' what to drop, so the two describe different column lists. Prisma allows only one of them on "+"the same query. Drop the 'omit' \u2014 a 'select' already excludes "+"everything it does not name.");if(z===void 0||z===null)return f7($,J,X);if(typeof z!=="object"||Array.isArray(z))throw new T("select",$.name,X,"Expected an object.");let Y=[];for(let[G,V]of Object.entries($.fields))if(z[G]===!0)Y.push(V);let H=0;for(let G of Object.keys(z)){let V=z[G];if(V===void 0)continue;if(G in $.relations){if(V!==!1)H++;continue}if(G===n){if(V!==!1)H++;continue}if(!(G in $.fields))throw new g(G,$.name,Object.keys($.fields));if(typeof V!=="boolean")throw new T(`select.${G}`,$.name,X,"Expected true or false.")}if(Y.length===0&&H===0)throw new K("select",$.name,X,"At least one field must be selected.");return Y}function f7($,Z,X){if(Z===void 0||Z===null)return Object.values($.fields);if(typeof Z!=="object"||Array.isArray(Z))throw new T("omit",$.name,X,"Expected an object of fields.");let z=new Set;for(let Y of Object.keys(Z)){let H=Z[Y];if(H===void 0)continue;if(Y in $.relations)throw new K(`omit.${Y}`,$.name,X,`'${Y}' is a relation, not a column. A relation is already absent unless an 'include' asks for it.`);if(!(Y in $.fields))throw new g(Y,$.name,Object.keys($.fields));if(typeof H!=="boolean")throw new T(`omit.${Y}`,$.name,X,"Expected true or false.");if(H)z.add(Y)}let J=Object.values($.fields).filter((Y)=>!z.has(Y.name));if(J.length===0)throw new K("omit",$.name,X,`It omits every field on ${$.name}, which leaves no column to select. Prisma rejects that too.`);return J}function V3($,Z,X){if(X.length===0)return{fields:Z};let z=new Set(Z.map((H)=>H.name)),J=X.filter((H)=>!z.has(H));if(J.length===0)return{fields:Z};let Y=new Set([...z,...J]);return{fields:Object.values($.fields).filter((H)=>Y.has(H.name)),hidden:J}}var P9=new Set(["where","orderBy","select","omit","include","take","skip"]),j9=new Set(["where","select","omit","include"]),M3=10;function y0($){return[...new Set($.map((Z)=>Z.strategy))].sort()}function S0($,Z,X,z,J=P0){let Y=h0($,Z,z);if(Y.length===0)return{plans:[],keyFields:[]};let H=[],G=new Set;for(let V of Y){T9($,V,z);let W=U9($,V);R9(W,V.node,z,2);let M=J.plan({parent:$,child:W,relation:V.relation,as:V.as,node:V.node,locate:V.locate,dialect:X,operation:z});H.push(M);for(let B of M.parentFields)G.add(B)}return{plans:H,keyFields:[...G]}}async function D3($,Z,X,z,J){let Y=Array.isArray(X)?X:X===null||X===void 0?[]:[X];if(Y.length===0)return;for(let H of $){if(H.root)continue;await H.load(Y,z,J)}if(Z&&Z.length>0)for(let H of Y)for(let G of Z)delete H[G]}function h0($,Z,X){if(Z===void 0||Z===null)return[];let{include:z,select:J}=Z;L9($,z,J,X);let Y=[];if(z!==void 0&&z!==null){if(typeof z!=="object"||Array.isArray(z))throw new T("include",$.name,X,"Expected an object.");for(let H of Object.keys(z).sort()){let G=z[H];if(G===void 0||G===!1)continue;if(H===n)continue;let V=$.relations[H];if(!V)throw new f0(H,$.name,Object.keys($.relations));Y.push({as:H,relation:V,node:G,locate:(W)=>W?.include?.[H]})}return Y}if(J!==void 0&&J!==null&&typeof J==="object")for(let H of Object.keys(J).sort()){let G=J[H];if(G===void 0||G===!1)continue;let V=$.relations[H];if(!V)continue;Y.push({as:H,relation:V,node:G,locate:(W)=>W?.select?.[H]})}return Y}function L9($,Z,X,z,J){if(Z===void 0||X===void 0)return;throw new K(J?`${J}: select + include`:"select + include",$.name,z,"Prisma allows only one of them on the same query, at any level.")}function T9($,Z,X){let z=Z.node;if(z===!0)return;if(typeof z!=="object"||z===null||Array.isArray(z))throw new T(Z.as,$.name,X,"Expected true or an object of relation arguments.");let J=z;L9($,J.include,J.select,X,Z.as);let Y=Z.relation.kind==="many";for(let H of Object.keys(J).sort()){if(J[H]===void 0)continue;if(Y&&(H==="take"||H==="skip")){g7($,Z,X,H,J[H]);continue}if(Y?P9.has(H):j9.has(H))continue;if(H==="lock")throw new k0(`${Z.as}.lock`,$.name,X,"'lock' locks the rows of the model being queried, not an included relation's. Lock the related rows with their own locking read in the same transaction.");if(H==="orderBy"&&!Y)throw new K(`${Z.as}.orderBy`,$.name,X,"Prisma does not accept 'orderBy' on a to-one relation \u2014 there is at "+"most one row to order.");if(H==="take"||H==="skip")throw new K(`${Z.as}.${H}`,$.name,X,`Prisma does not accept '${H}' on a to-one relation.`);throw new K(`${Z.as}.${H}`,$.name,X,`A relation node takes ${[...Y?P9:j9].sort().join(", ")}.`)}}function g7($,Z,X,z,J){H3($.name,X,`${Z.as}.${z}`,z,J)}function c3($,Z){let X=$.node;if(typeof X!=="object"||X===null||Array.isArray(X))return;for(let z of["take","skip"]){if(X[z]===void 0)continue;throw new K(`${$.as}.${z}`,$.parent.name,$.operation,`A '${z}' inside a to-many relation is per parent, and the batched `+"relation planner serves every parent from one query \u2014 so the only "+`limit it could emit would page every parent's children as one set. Only the lateral join strategy can express it, by paginating inside a subquery that already runs once per parent row, and it needs Postgres: ${Z}. Load '${$.as}' as its own query, or narrow it with 'where'.`)}}function R9($,Z,X,z){if(typeof Z!=="object"||Z===null||Array.isArray(Z))return;if(Z.select!==void 0)J0($,Z,X);let J=h0($,Z,X);if(J.length===0)return;if(z>M3)throw new p3($.name,M3);for(let Y of J)T9($,Y,X),R9(U9($,Y),Y.node,X,z+1)}function I9($,Z,X,z){if($.parentFields.length!==1)throw new K(X.name,Z.name,z,`${X.name} joins on ${$.parentFields.length} fields (${$.parentFields.join(", ")}), and it is planned through a join table, which links two models by a single primary key each side. Prisma does not build an implicit many-to-many over a composite key.`);return{parentField:$.parentFields[0],childField:$.childFields[0],join:$.join}}function B0($,Z,X,z){if(X.joinTable)return h7($,Z,X);if(X.from.length>0)return K9($,X,X.from,X.to,z);let J=y7($,Z,X);if(J.from.length===0)throw new c($.name,X.name,`neither ${$.name}.${X.name} nor ${Z.name}.${J.name} holds the foreign key.`);return K9($,X,J.to,J.from,z)}function K9($,Z,X,z,J){if(X.length===0)throw new K(Z.name,$.name,J,`${Z.name} names no join fields.`);if(X.length!==z.length)throw new c($.name,Z.name,`it joins ${X.length} field(s) to ${z.length}: ${X.join(", ")} against ${z.join(", ")}.`);return{parentFields:X,childFields:z}}function y7($,Z,X){let z=Object.values(Z.relations).filter((J)=>J.relationName===X.relationName&&!(Z.name===$.name&&J.name===X.name));if(z.length!==1)throw new c($.name,X.name,z.length===0?`${Z.name} declares no relation named '${X.relationName}'.`:`${Z.name} declares ${z.length} relations named '${X.relationName}'.`);return z[0]}function h7($,Z,X){let{table:z,a:J,b:Y}=X.joinTable;if(J===Y){let G=X.joinTable.ownerColumn;if(!G)throw new K(X.name,$.name,"include",`${X.name} is a self-referential implicit many-to-many, and the generated artifact predates support for one. Re-run \`prisma generate\`.`);return{parentFields:[G3($,X)],childFields:[G3(Z,X)],join:{table:z,parentColumn:G,childColumn:G==="A"?"B":"A"}}}if($.name!==J&&$.name!==Y)throw new c($.name,X.name,`the join table '${z}' connects ${J} and ${Y}, neither of which is ${$.name}.`);let H=$.name===J?"A":"B";return{parentFields:[G3($,X)],childFields:[G3(Z,X)],join:{table:z,parentColumn:H,childColumn:H==="A"?"B":"A"}}}function G3($,Z){if($.primaryKey.length!==1)throw new c($.name,Z.name,`an implicit many-to-many joins on ${$.name}'s primary key, which has ${$.primaryKey.length} fields.`);return $.primaryKey[0]}function W3($,Z,X){let z=$.fields[X];if(!z)throw new c($.name,Z.name,`it joins on '${X}', which is not a field on ${$.name}.`);return z}function U9($,Z){return X0($,Z.relation,Z.as)}function X0($,Z,X=Z.name){let z=Z.model;if(!a(z))throw new d3($.name,X,z,C9());let J=l(z)?.$schema;if(!J)throw new g0(z);return J}var Q9="batched",P0={name:Q9,plan($){c3($,"this query planned with the batched strategy");let Z=B0($.parent,$.child,$.relation,$.operation);for(let Y of Z.parentFields)_9($.parent,$.relation,W3($.parent,$.relation,Y));for(let Y of Z.childFields)_9($.child,$.relation,W3($.child,$.relation,Y));let X=W3($.parent,$.relation,Z.parentFields[0]),z=W3($.child,$.relation,Z.childFields[0]),J=$.relation.kind==="many";return{as:$.as,model:$.relation.model,kind:$.relation.kind,parentFields:Z.parentFields,strategy:Q9,load(Y,H,G){let V={parentKeyField:X,childKeyField:z,many:J,parents:Y,args:H,executor:G};return Z.join?m7($,Z,V):u7($,Z,V)}}}};async function u7($,Z,X){let{keys:z,byKey:J}=O9(X.parents,Z.parentFields);if(z.length===0)return;let Y=$.locate(X.args),H=N9(Y,Z.childFields,z,$.child,$.dialect),G=await X.executor.exec($.relation.model,"findMany",H.args,!0);for(let V of G){let W=J.get(v0(Z.childFields.map((M)=>V[M])));if(!W)continue;for(let M of W)F9(M,$.as,V,X.many)}if(H.hidden)for(let V of G)for(let W of Z.childFields)delete V[W]}async function m7($,Z,X){let{keys:z,byKey:J}=O9(X.parents,Z.parentFields);if(z.length===0)return;let{dialect:Y}=$,H=Z.join,G=await p7(Y,H,z.map((P)=>Y.encode(P[0],X.parentKeyField)),X.executor),V=new Map,W=[];for(let P of G){let L=v0([Y.decode(P[H.parentColumn],X.parentKeyField)]),C=J.get(L);if(!C)continue;let F=Y.decode(P[H.childColumn],X.childKeyField),N=v0([F]),_=V.get(N);if(_===void 0)_=[],V.set(N,_),W.push([F]);for(let Q of C)_.push(Q)}if(W.length===0)return;let M=$.locate(X.args),B=N9(M,Z.childFields,W,$.child,$.dialect),D=await X.executor.exec($.relation.model,"findMany",B.args,!0);for(let P of D){let L=V.get(v0([P[Z.childFields[0]]]));if(!L)continue;for(let C of L)F9(C,$.as,P,X.many)}if(B.hidden)for(let P of D)delete P[Z.childFields[0]]}async function p7($,Z,X,z){let J=R(j(`select ${$.quoteIdent(Z.parentColumn)}, ${$.quoteIdent(Z.childColumn)} from ${$.quoteIdent(Z.table)} where `),$.inList($.quoteIdent(Z.parentColumn),!1,X.length,()=>X)),{text:Y,binders:H}=d(J,$,{model:Z.table,operation:"include"}),G=A0();return z.query(Y,H.map((V)=>V(void 0,G)))}function N9($,Z,X,z,J){let Y=$===!0||$===null||typeof $!=="object"?{}:$,H=Z.length===1?{[Z[0]]:{in:X.map((B)=>B[0])}}:d7(z,Z,X,J),G={where:Y.where===void 0?H:{AND:[Y.where,H]}};if(Y.orderBy!==void 0)G.orderBy=Y.orderBy;if(Y.include!==void 0)G.include=Y.include;let V=Y.omit;if(V!==void 0){let B=Z.filter((D)=>V[D]===!0);if(B.length===0)G.omit=V;else{let D={...V};for(let P of B)delete D[P];return G.omit=D,{args:G,hidden:!0}}}let W=Y.select;if(W===void 0)return{args:G,hidden:!1};let M=Z.filter((B)=>W[B]!==!0);if(M.length===0)return G.select=W,{args:G,hidden:!1};G.select={...W};for(let B of M)G.select[B]=!0;return{args:G,hidden:!0}}function d7($,Z,X,z){let J=Z.map((Y)=>$.fields[Y]?.type);if(J.every((Y)=>Y!==void 0)&&z.canBindCompositeIn(J))return{[z0]:G9(Z,X)};return{OR:X.map((Y)=>Object.fromEntries(Z.map((H,G)=>[H,Y[G]])))}}function v0($){return JSON.stringify($.map(c7))}function F9($,Z,X,z){if(z){$[Z].push(X);return}if($[Z]===null)$[Z]=X}function O9($,Z){let X=new Map,z=[];for(let J of $){let Y=Z.map((V)=>J[V]);if(Y.some((V)=>V===null||V===void 0))continue;let H=v0(Y),G=X.get(H);if(G===void 0)G=[],X.set(H,G),z.push(Y);G.push(J)}return{keys:z,byKey:X}}function c7($){if(typeof $!=="object"||$===null)return $;if($ instanceof Date)return $.getTime();if(ArrayBuffer.isView($)){let Z=new Uint8Array($.buffer,$.byteOffset,$.byteLength),X="";for(let z of Z)X+=z.toString(16).padStart(2,"0");return`bytes:${X}`}throw Error(`Cannot key a relation stitch on ${Object.prototype.toString.call($)}.`)}function _9($,Z,X){if(X.isList)throw new c($.name,Z.name,`it joins on '${X.name}', a ${X.type} list \u2014 which decodes to a new `+"array per row and so cannot be compared between the two sides.");if(X.type!=="Json")return;throw new c($.name,Z.name,`it joins on '${X.name}', a ${X.type} \u2014 which decodes to a new object `+"per row and so cannot be compared between the two sides.")}var A9=(()=>{try{return Function("return 1")()===1}catch{return!1}})(),S9=!0;function s7($){S9=$}function i7(){return A9}function u0($,Z,X=[]){if(A9&&S9)return n7($,Z,X);return s3($,Z,X)}function s3($,Z,X=[]){let z=$.map((G)=>({key:G.name,column:G.column,field:G,decode:Z.needsDecode(G)})),J=z.length,Y=X.map((G)=>({key:G.key,many:G.kind==="many"})),H=Y.length;return(G)=>{let V=[];for(let W=0;W<G.length;W++){let M=G[W],B={};for(let D=0;D<J;D++){let P=z[D],L=M[P.column];B[P.key]=P.decode?Z.decode(L,P.field):L??null}for(let D=0;D<H;D++)B[Y[D].key]=Y[D].many?[]:null;V.push(B)}return V}}function n7($,Z,X){let z=[];for(let Y=0;Y<$.length;Y++){let H=$[Y],G=JSON.stringify(H.name),V=JSON.stringify(H.column);z.push(Z.needsDecode(H)?`${G}: d.decode(row[${V}], f[${Y}])`:`${G}: row[${V}] ?? null`)}for(let Y of X)z.push(`${JSON.stringify(Y.key)}: ${Y.kind==="many"?"[]":"null"}`);let J=`
2
+ import{ca as A6}from"../chunk-e0w1mf72.js";import{$a as F6,Ga as z9,Ha as J9,Ia as n,Ja as b9,Ka as S3,La as R6,Ma as I6,Na as q0,Oa as a5,Pa as b3,Qa as U6,Ra as $3,Sa as I0,Ta as e4,Ua as $7,Va as Z7,Wa as p5,Xa as X7,Ya as z7,Za as J7,_a as N6,ab as O6}from"../chunk-qttv23e7.js";import{fh as Q6,gh as _6,hh as C6,ih as L6,jh as T6}from"../chunk-99be7vbh.js";import{Ah as P6,Bh as j6,Ch as K6,Dh as r5,kh as A0,lh as o,mh as j,nh as i,qh as R,rh as x,sh as d,th as W6,uh as M6,vh as X5,wh as B6,xh as h3,yh as k,zh as D6}from"../chunk-n3pc62tc.js";import"../chunk-p4ka241x.js";import{fj as e8,gj as a,hj as l,ij as C9,jj as B3,lj as V6,mj as G6,rj as l4,sj as o4,tj as t4,uj as r4,vj as a4}from"../chunk-70kpm72z.js";import{Aj as s8,Bj as $0,Cj as i8,Dj as d5,Ej as n8,Fj as _5,Gj as l8,Ij as o8,Jj as c5,Kj as t8,Lj as r8,Mj as s5,Nj as L3,Oj as f0,Pj as p3,Qj as d3,Rj as c,Sj as a8,Tj as g0,Uj as i5,wj as K,xj as T,yj as k0,zj as g}from"../chunk-1btx3kkv.js";import{$j as X6,ak as e0,bk as T0,ck as F3,fk as z6,hk as J6,ik as Y6,jk as n5,kk as l5,lk as u5,mk as O3,nk as H6,ok as o5,pk as t5}from"../chunk-cd847h0t.js";import{Ak as $6,Ck as Z6,Ek as m5}from"../chunk-zh0knwen.js";import{cl as h5}from"../chunk-vqar6ysw.js";import"../chunk-mxhy19a9.js";import"../chunk-wgre66wq.js";function N0($,Z,X,z,J,Y){let H=X0($,Z),G=B0($,H,Z,Y),V=X.quoteIdent(z),W=`${V}.`,M=G.parentFields.map((L,C)=>{let F=`${W}${X.quoteIdent(Z3(H,Z,G.childFields[C]))}`,N=`${J}${X.quoteIdent(Z3($,Z,L))}`;return`${F} = ${N}`}).join(" and ");if(!G.join)return{child:H,source:`${X.quoteIdent(H.table)} as ${V}`,correlation:M,qualifier:W};let B=`${W}${X.quoteIdent(Z3(H,Z,G.childFields[0]))}`,D=`${J}${X.quoteIdent(Z3($,Z,G.parentFields[0]))}`,P=X.quoteIdent(`${z}j`);return{child:H,source:`${X.quoteIdent(H.table)} as ${V} join ${X.quoteIdent(G.join.table)} as ${P} on ${P}.${X.quoteIdent(G.join.childColumn)} = ${B}`,correlation:`${P}.${X.quoteIdent(G.join.parentColumn)} = ${D}`,qualifier:W}}function Z3($,Z,X){let z=$.fields[X];if(!z)throw new c($.name,Z.name,`it joins on '${X}', which is not a field on ${$.name}.`);return z.column}function u($,Z,X){let z=X3($);if(typeof Z!=="object"||Z===null||Array.isArray(Z))throw Z9($,X,z);let J=Object.keys(Z).filter((H)=>Z[H]!==void 0),Y=Z;for(let H of z){if(H.length===1&&J.includes(H[0]))return $9($,X,H[0],Y[H[0]]),H;let G=H.join("_");if(H.length>1&&J.includes(G)){let V=Y[G];if(V&&typeof V==="object"&&!Array.isArray(V))for(let W of H)$9($,X,`${G}.${W}`,V[W]);return H}}throw Z9($,X,z)}function x3($){if($===null||$===void 0)return!1;let Z=typeof $;if(Z!=="object")return Z!=="function"&&Z!=="symbol";if(Array.isArray($))return!1;if($ instanceof Date||ArrayBuffer.isView($))return!0;let X=Object.getPrototypeOf($);return X!==Object.prototype&&X!==null}function $9($,Z,X,z){if(z===void 0||x3(z))return;throw new T(`${Z.argument}.${X}`,Z.model,Z.operation,`A unique key takes a plain value to match, not ${z===null?"null":Array.isArray(z)?"an array":"a filter object"}. Use findFirst/findMany (or updateMany/deleteMany) to filter on ${$.name}.${X.split(".").pop()}.`)}function v3($,Z,X){u($,Z,{model:$.name,operation:X,argument:"where"})}function X3($){let Z=[];if($.primaryKey.length>0)Z.push($.primaryKey);for(let X of $.uniques)Z.push(X);return Z}function Z9($,Z,X){let z=X.map((H)=>H.length===1?H[0]:H.join("_")).join(", "),Y=Z.argument.startsWith("data.")?`Name it by one of those, or reach it through the ${$.name} model directly.`:`Use ${Z.operation==="delete"||Z.operation==="update"?`${Z.operation}Many`:"findFirst"} to query on anything else.`;return new K(Z.argument,Z.model,Z.operation,`${$.name} needs a unique field here. It declares: ${z}. ${Y}`)}function y($,Z,X){let z=Z.castParameter($);if(!z)return i(X);return i((J,Y)=>{let H=X(J,Y);if(H===null||H===void 0)return null;let G=k(H);if(G==="db")return null;if(G==="json")return"null";if(G==="any")throw Error("gemi ORM bug: Prisma.AnyNull reached the parameter binder. It is a filter operand only, and both the filter and write paths are supposed to have handled it before this point.");return JSON.stringify(H)},z)}function f($,Z,X,z){if(Z===void 0||Z===null)return null;if(typeof Z!=="object"||Array.isArray(Z))throw new T("where",$.name,X.operation,"Expected an object.");let J=[];for(let Y of Object.keys(Z).sort()){let H=Z[Y];if(H===void 0)continue;let G=(W)=>z(W)?.[Y];if(Y==="AND"||Y==="OR"){let W=X9($,H,X,G,Y);if(W)J.push(W);continue}if(Y===z0){J.push(j7($,H,X,G));continue}if(Y==="NOT"){let W=X9($,H,X,G,"AND");if(W)J.push(R(j("not "),w0(W)));continue}if(Y in $.relations){let W=B7($,$.relations[Y],H,X,G);if(W)J.push(W);continue}let V=$.fields[Y];if(!V){let W=P7($,Y,H,X,G);if(W){J.push(W);continue}throw new g(Y,$.name,Object.keys($.fields))}J.push(u3($,V,H,X,G))}if(J.length===0)return null;if(J.length===1)return J[0];return t(J," and ")}function B7($,Z,X,z,J){let Y=z9(Z.kind),H=D7($,Z,X,Y,z),G=z.relationDepth??0,V=z.dialect,W=z.qualifier??`${V.quoteIdent($.table)}.`,M=N0($,Z,V,`_r${G}`,W,z.operation),B=M.child,D=j(M.correlation),P={...z,qualifier:M.qualifier,relationDepth:G+1},L=[];for(let C of Y){if(!(C in H))continue;let F=H[C],N=(I)=>H.direct?J(I):J(I)?.[C];if(F===null){L.push(k3(M,D,null,C==="is"));continue}let _=f(B,F,P,N);if(C==="every"){if(!_)continue;L.push(k3(M,D,R(j("not "),w0(_)),!0));continue}let Q=C==="none"||C==="isNot";L.push(k3(M,D,_,Q))}if(L.length===0)return null;if(L.length===1)return L[0];return t(L," and ")}function k3($,Z,X,z){let J=[j(`${z?"not ":""}exists (select 1 from ${$.source} where `),Z];if(X)J.push(j(" and "),X);return J.push(j(")")),R(...J)}function D7($,Z,X,z,J){let Y=`where.${Z.name}`,H=Z.kind==="many";if(X===null){if(H)throw new K(Y,$.name,J.operation,`${Z.name} is a to-many relation, so null is not a filter for it. Use { none: {} } for "has no related rows".`);return{is:null,direct:!0}}if(typeof X!=="object"||Array.isArray(X))throw new T(Y,$.name,J.operation,H?`Expected an object holding ${z.join(", ")}.`:"Expected an object, or null.");if(J9(X,z))return X;if(H)throw new K(Y,$.name,J.operation,`Expected one of ${z.join(", ")}. A to-many relation has no `+"single reading of a bare filter \u2014 { some: \u2026 } and { every: \u2026 } mean "+"different things.");return{is:X,direct:!0}}function P7($,Z,X,z,J){let Y=X3($).find((V)=>V.length>1&&V.join("_")===Z);if(!Y)return null;if(typeof X!=="object"||X===null||Array.isArray(X))throw new T(`where.${Z}`,$.name,z.operation,`Expected an object holding ${Y.join(" and ")}.`);let H=X,G=[];for(let V of Y){if(H[V]===void 0)throw new K(`where.${Z}`,$.name,z.operation,`Missing '${V}'. A composite key needs all of ${Y.join(", ")}.`);if(!x3(H[V]))throw new T(`where.${Z}.${V}`,$.name,z.operation,`A composite key takes a plain value for each of ${Y.join(", ")}, not a filter, an array or null.`);G.push(u3($,$.fields[V],H[V],z,(W)=>J(W)?.[V]))}return G.length===1?G[0]:t(G," and ")}function X9($,Z,X,z,J){let Y=[];if(Array.isArray(Z))for(let H=0;H<Z.length;H++){let G=f($,Z[H],X,(V)=>z(V)?.[H]);if(G)Y.push(G)}else{let H=f($,Z,X,z);if(H)Y.push(H)}if(Y.length===0)return J==="AND"?null:Y9;if(Y.length===1)return Y[0];return t(Y,J==="AND"?" and ":" or ")}var Y9=j("false");function t($,Z){return R(j("("),x($,Z),j(")"))}function w0($){return $.text.startsWith("(")?$:t([$],"")}var y3=new Set(["equals","not","in","notIn","lt","lte","gt","gte","contains","startsWith","endsWith","mode"]),H9={lt:"<",lte:"<=",gt:">",gte:">="},z0="$compositeIn",V9=Symbol("gemi.orm.compositeInFromPlanner");function G9($,Z){return{[V9]:!0,fields:$,values:Z}}function j7($,Z,X,z){let{dialect:J}=X,H=K7($,Z,X).map((V)=>{let W=$.fields[V];if(!W)throw new g(V,$.name,Object.keys($.fields));return W}),G=H.map((V)=>`${X.qualifier??""}${J.quoteIdent(V.column)}`);return J.compositeIn(G,H.map((V)=>V.type),(V)=>z(V).values)}function K7($,Z,X){let z=()=>{throw new g(z0,$.name,Object.keys($.fields))};if(typeof Z!=="object"||Z===null||Array.isArray(Z))return z();if(Z[V9]!==!0)return z();let J=(G)=>{throw new K(z0,$.name,X.operation,G)},{fields:Y,values:H}=Z;if(!Array.isArray(Y)||Y.length===0)return J(`the planner built a '${z0}' with no fields.`);if(!Y.every((G)=>typeof G==="string"))return J(`the planner built a '${z0}' with a non-string field.`);if(!Array.isArray(H))return J(`the planner built a '${z0}' with no values.`);if(!H.every((G)=>Array.isArray(G)&&G.length===Y.length))return J(`the planner built a '${z0}' whose tuples do not all have ${Y.length} value(s).`);return Y}var Q7=["equals","has","hasEvery","hasSome","isEmpty"],f3=new Set(Q7);function _7($,Z,X,z,J,Y){let{dialect:H}=J;if(O0($,Z,`where.${Z.name}`,J.operation,H),Array.isArray(z))throw new T(`where.${Z.name}`,$.name,J.operation,`'${Z.name}' is a scalar list, and a bare array is not a filter on `+"one \u2014 Prisma rejects it here too. Say which comparison you mean: "+`{ ${Z.name}: { equals: [...] } } for the whole list, or { ${Z.name}: { hasEvery: [...] } } for "contains all of these". A bare array *is* accepted as a value in \`data\`.`);if(!m3(z))throw new T(`where.${Z.name}`,$.name,J.operation,`'${Z.name}' is a scalar list. Expected an object holding ${[...f3].sort().join(", ")}; received ${z===null?"null":typeof z}.`);let G=z,V=[];for(let W of Object.keys(G).sort()){let M=G[W];if(M===void 0)continue;if(!f3.has(W))throw new T(`where.${Z.name}.${W}`,$.name,J.operation,`'${Z.name}' is a scalar list, and a list filter takes ${[...f3].sort().join(", ")}. The scalar operators \u2014 `+`${[...y3].sort().join(", ")} \u2014 apply to a single value and `+"Prisma does not offer them here.");let B=(D)=>Y(D)?.[W];V.push(C7($,Z,X,W,M,J,B))}if(V.length===0)return j("true");if(V.length===1)return V[0];return t(V," and ")}function C7($,Z,X,z,J,Y,H){let{dialect:G}=Y;if(z==="equals")return L7($,Z,X,J,Y,H);if(z==="isEmpty"){if(typeof J!=="boolean")throw new T(`where.${Z.name}.isEmpty`,$.name,Y.operation,`Expected true or false, received ${J===null?"null":typeof J}.`);return G.listIsEmpty(X,J)}if(z==="has"){let W=T7(Z);return G.listHas(X,y(W,G,F0(W,G,H)))}if(!Array.isArray(J))throw new T(`where.${Z.name}.${z}`,$.name,Y.operation,`Expected an array, received ${J===null?"null":typeof J}.`);let V=y(Z,G,F0(Z,G,H));return z==="hasEvery"?G.listHasEvery(X,V):G.listHasSome(X,V)}function L7($,Z,X,z,J,Y){let{dialect:H}=J;if(z===null)return j(`${X} is null`);if(!Array.isArray(z))throw new T(`where.${Z.name}.equals`,$.name,J.operation,`'${Z.name}' is a scalar list, so it compares against an array. Received ${typeof z}. For "is this element present", use { ${Z.name}: { has: \u2026 } }.`);return R(j(`${X} = `),y(Z,H,F0(Z,H,Y)))}function T7($){return{...$,isList:!1}}function O0($,Z,X,z,J){if(J.listFilters.size>0)return;throw new K(X,$.name,z,`'${Z.name}' is a scalar list, and ${J.name} has no array type to hold one. Prisma refuses the column itself on ${J.name} \u2014 `+'"the current connector does not support lists of primitive types" \u2014 so '+`this is a difference between the databases rather than a gap in the ORM. The generated artifact is dialect-agnostic, which is why this surfaces here rather than at \`prisma generate\`: the schema was generated against Postgres and DATABASE_URL names a ${J.name} database, which has no '${Z.column}' column either. It works on postgres.`)}var R7=["equals","not","string_contains","string_starts_with","string_ends_with","array_contains","lt","lte","gt","gte"],g3=new Set(R7),I7=["has_key","has_some_keys","has_every_key"],z3=new Set(I7);function W9($,Z,X,z,J,Y,H,G){let V=z!=="has_key",W=`where.${Z.name}.${z}`,M=(D)=>{if(!(V?Array.isArray(D)&&D.every((L)=>typeof L==="string"):typeof D==="string"))throw new T(W,$.name,Y.operation,V?"Expected an array of key names, like ['a', 'b'].":"Expected a key name, like 'a'.");return D};M(J);let B=(D,P)=>M(G(D,P));return Y.dialect.jsonHasKeys(X,H,B,z==="has_key"?"one":z==="has_some_keys"?"some":"every",Array.isArray(J)?J.length:0)}function U7($,Z,X,z,J,Y){let{dialect:H}=J;if(Z.type!=="Json")throw new K(`${Z.name}.path`,$.name,J.operation,`A 'path' filter reads inside a JSON document, and '${Z.name}' is a ${Z.type} column.`);A7($,Z,z.path,J);let G=(M)=>Y(M)?.path,V=Object.keys(z).filter((M)=>M!=="path"&&z[M]!==void 0).sort();if(V.length===0)throw new K(`${Z.name}.path`,$.name,J.operation,`A 'path' needs a filter beside it \u2014 ${[...g3,...z3].sort().join(", ")}. Prisma refuses a bare path too.`);let W=[];for(let M of V){if(z3.has(M)){W.push(W9($,Z,X,M,z[M],J,G,(P)=>Y(P)?.[M]));continue}if(!g3.has(M))throw new K(`${Z.name}.${M}`,$.name,J.operation,`A JSON path filter takes ${[...g3,...z3].sort().join(", ")}.`);if(!H.jsonFilters.has(M))throw new K(`${Z.name}.${M}`,$.name,J.operation,`'${M}' on a JSON path is not available on ${H.name}. Prisma refuses it here too, so this is a difference between the databases rather than a gap in the ORM. It works on postgres.`);let B=z[M],D=B===null?"json":k(B);if(D&&(M==="equals"||M==="not")){W.push(N7(D,X,G,Z,H,M==="not"));continue}if(D&&B!==null){let P=M==="array_contains"?"'array_contains' tests containment against a document, and a sentinel is not one":`'${M}' compares an extracted value against a scalar, and a sentinel is not one`;throw new T(`where.${Z.name}.${M}`,$.name,J.operation,`${x0(D)} asks which kind of null a value is, which `+`only 'equals' and 'not' can express \u2014 ${P}. Prisma refuses it under this operator too. Write { ${Z.name}: { path: [\u2026], equals: ${x0(D)} } }, `+"or filter the column itself \u2014 "+`{ ${Z.name}: { equals: ${x0(D)} } }.`)}if(M9(B))throw new T(`where.${Z.name}.${M}`,$.name,J.operation,"Prisma.AnyNull is a question rather than a value \u2014 'either kind of "+"null' \u2014 so it cannot appear inside a document. Ask it directly: "+`{ ${Z.name}: { path: [\u2026], equals: Prisma.AnyNull } }.`);F7(M,B,$,Z,J),W.push(O7(M,X,G,Z,H,(P)=>Y(P)?.[M]))}return W.length===1?W[0]:t(W," and ")}function N7($,Z,X,z,J,Y){let H=()=>R(J.jsonValueAt(Z,X),j(Y?" is not null":" is null")),G=()=>R(J.jsonValueAt(Z,X),j(Y?" <> ":" = "),y(z,J,()=>J.encode(h3,z)));if($==="db")return H();if($==="json")return G();return t([G(),H()],Y?" and ":" or ")}function F7($,Z,X,z,J){let Y=$==="string_contains"||$==="string_starts_with"||$==="string_ends_with";if(Y&&typeof Z!=="string")throw new T(`where.${z.name}.${$}`,X.name,J.operation,`Expected a string, received ${Z===null?"null":typeof Z}. Prisma raises here too \u2014 without this the pattern becomes `+`'%${String(Z)}%', which runs and returns the wrong rows.`);if(Z===null)throw new T(`where.${z.name}.${$}`,X.name,J.operation,$==="array_contains"?"null cannot be tested for containment through a JSON path: the operand binds as SQL NULL rather than as the JSON value, and "+"'x @> NULL' is NULL rather than true \u2014 the query would run and "+`match nothing. A null *inside* the document is an ordinary value and still compiles: { ${z.name}: { path: [\u2026], array_contains: [null] } }.`:`null cannot be compared through a JSON path with '${$}', which `+"compares the extracted value as a number \u2014 the comparison against "+`NULL is NULL rather than true, so the query would run and match nothing. Prisma refuses it here too. For "the value at this path is a JSON null", use equals or not: { ${z.name}: { path: [\u2026], equals: null } }.`);if($==="array_contains"||Y)return;if(typeof Z==="object")throw new K(`where.${z.name}.${$}`,X.name,J.operation,`'${$}' on a JSON path compares the extracted value as a scalar, so `+"an object or array operand cannot be expressed \u2014 it would bind as "+`'${String(Z)}' and match nothing. Prisma accepts one here; gemi does not yet. Use array_contains for containment, or narrow the path until it names a scalar.`)}function O7($,Z,X,z,J,Y){if($==="array_contains")return J.jsonArrayContains(Z,X,Y);let H=$==="string_contains"||$==="string_starts_with"||$==="string_ends_with",G=J.jsonExtract(Z,X,!0);if(H){let B=$==="string_contains"?(D)=>`%${D}%`:$==="string_starts_with"?(D)=>`${D}%`:(D)=>`%${D}`;return R(j("("),G,j(") like "),i((D,P)=>{let L=Y(D,P);return L===null||L===void 0?null:B(String(L))}))}let V=$==="equals"?"=":$==="not"?"<>":H9[$],W=$!=="equals"&&$!=="not",M=W?R(j("cast(("),G,j(") as real)")):R(j("("),G,j(")"));return R(M,j(` ${V} `),i((B,D)=>{let P=Y(B,D);if(P===null||P===void 0)return null;if(W)return Number(P);return J.jsonComparesAsText?String(P):P}))}function A7($,Z,X,z){let{dialect:J}=z,Y=J.jsonPathSyntax==="array"?"array":"jsonpath",H=Array.isArray(X)?"array":typeof X==="string"?"jsonpath":"other";if(Array.isArray(X)&&X.length===0||X==="")throw new K(`${Z.name}.path`,$.name,z.operation,`A JSON path cannot be empty. ${J.jsonPathSyntax==="array"?`On ${J.name} an empty array selects the whole document, `+"which is a filter on the column rather than on a path \u2014 write "+`{ ${Z.name}: { equals: \u2026 } } if that is what you meant.`:`On ${J.name} an empty string raises inside json_extract.`}`);if(H===Y){if(Y!=="array")return;let V=X.findIndex((B)=>typeof B!=="string");if(V===-1)return;let W=X[V],M=W===null?"null":W===void 0?"undefined":Array.isArray(W)?"an array":typeof W==="object"?"an object":`a ${typeof W}`;throw new K(`${Z.name}.path`,$.name,z.operation,`A JSON path is an array of strings, and path[${V}] is ${M}. `+(typeof W==="number"?'An array index is a key too \u2014 write ["items", "0"] rather than '+`["items", 0]; it reaches the same element, because ${J.name} takes the path as text. Prisma's path is string[] and its client refuses a number here too.`:"Prisma's path is string[] too."))}throw new K(`${Z.name}.path`,$.name,z.operation,J.jsonPathSyntax==="array"?`On ${J.name} a JSON path is an array of keys \u2014 ["a", "b"] \u2014 `+"not a JSONPath string. Prisma splits them the same way, and refuses the other form on each database.":`On ${J.name} a JSON path is a JSONPath string \u2014 "$.a.b" \u2014 not `+"an array of keys. Prisma splits them the same way, and refuses the other form on each database.")}function u3($,Z,X,z,J){let{dialect:Y}=z,H=`${z.qualifier??""}${Y.quoteIdent(Z.column)}`,G=k(X);if(G)throw new T(`where.${Z.name}`,$.name,z.operation,`${x0(G)} is not a filter on `+"its own \u2014 Prisma rejects it here too. Write it as an explicit "+`comparison: { ${Z.name}: { equals: ${x0(G)} } }.`);if(Z.isList)return _7($,Z,H,X,z,J);if(!m3(X))return J3(H,Z,X,Y,J);let V=X,W=Object.keys(V).sort();if(V.path!==void 0)return U7($,Z,H,V,z,J);let M=V.mode==="insensitive";if(V.mode!==void 0&&V.mode!=="default"){if(!M)throw new T(`mode: ${JSON.stringify(V.mode)}`,$.name,z.operation,"Prisma takes 'default' or 'insensitive'.");if(!Y.supportsInsensitiveMode)throw new K('mode: "insensitive"',$.name,z.operation,`The ${Y.name} dialect cannot express it \u2014 Prisma rejects it `+"here too. Note SQLite's LIKE is already case-insensitive for ASCII.")}let B=[];for(let D of W){let P=V[D];if(P===void 0||D==="mode")continue;if(Z.type==="Json"&&z3.has(D)){B.push(W9($,Z,H,D,P,z,void 0,(C)=>J(C)?.[D]));continue}if(!y3.has(D))throw new T(`where.${Z.name}.${D}`,$.name,z.operation,`A scalar filter takes ${[...y3].sort().join(", ")}.`);if(D!=="equals"&&D!=="not"&&M9(P))throw new T(`where.${Z.name}.${D}`,$.name,z.operation,`Prisma.AnyNull means 'either kind of null', which only 'equals' and 'not' can express. Write { ${Z.name}: { equals: Prisma.AnyNull } }, or name the one you mean with Prisma.DbNull or Prisma.JsonNull.`);let L=(C)=>J(C)?.[D];switch(D){case"equals":B.push(J3(H,Z,P,Y,L));break;case"not":B.push(S7($,Z,P,z,L,H));break;case"in":case"notIn":B.push(q7($,H,Z,P,z,L,D==="notIn"));break;case"lt":case"lte":case"gt":case"gte":B.push(R(j(`${H} ${H9[D]} `),y(Z,Y,F0(Z,Y,L))));break;case"contains":case"startsWith":case"endsWith":if(typeof P!=="string")throw new T(`where.${Z.name}.${D}`,$.name,z.operation,`Expected a string, received ${P===null?"null":typeof P}.`);if(Z.type!=="String")throw new K(`where.${Z.name}.${D}`,$.name,z.operation,`'${Z.name}' is a ${Z.type}, and ${D} only applies to strings.`);B.push(Y.like(H,M,E7(D,L)));break}}if(B.length===0)return j("true");if(B.length===1)return B[0];return t(B," and ")}function x0($){return`Prisma.${$==="db"?"DbNull":$==="json"?"JsonNull":"AnyNull"}`}function M9($){if(k($)==="any")return!0;return Array.isArray($)&&$.some((Z)=>k(Z)==="any")}function S7($,Z,X,z,J,Y){if(X===null||k(X)==="db")return j(`${Y} is not null`);if(k(X)==="json")return R(j("not "),w0(J3(Y,Z,X,z.dialect,J)));if(k(X)==="any")return R(j("not "),w0(J3(Y,Z,X,z.dialect,J)));if(!m3(X))return R(j(`${Y} <> `),y(Z,z.dialect,F0(Z,z.dialect,J)));let H=u3($,Z,X,z,J);return R(j("not "),w0(H))}function J3($,Z,X,z,J){if(X===null||k(X)==="db")return j(`${$} is null`);if(k(X)==="any")return t([j(`${$} is null`),b7($,Z,z)]," or ");return R(j(`${$} = `),y(Z,z,F0(Z,z,J)))}function b7($,Z,X){return R(j(`${$} = `),y(Z,X,()=>X.encode(h3,Z)))}function q7($,Z,X,z,J,Y,H){let{dialect:G}=J;if(!Array.isArray(z))throw new T(`where.${X.name}.${H?"notIn":"in"}`,$.name,J.operation,"Expected an array.");if(z.length===0)return H?j("true"):Y9;return G.inList(Z,H,z.length,(V)=>{return Y(V).map((M)=>G.encode(M,X))})}function E7($,Z){return(X)=>{let z=String(Z(X));if($==="contains")return`%${z}%`;if($==="startsWith")return`${z}%`;return`%${z}`}}function F0($,Z,X){return(z)=>Z.encode(X(z),$)}function m3($){return typeof $==="object"&&$!==null&&!Array.isArray($)&&!($ instanceof Date)&&!ArrayBuffer.isView($)}function B9($,Z,X,z,J,Y,H){let G=`orderBy.${Z.name}`;if(typeof X!=="object"||X===null||Array.isArray(X))throw new T(G,$.name,z,Z.kind==="many"?'Expected { _count: "asc" | "desc" }.':`Expected an object naming one field of ${Z.model}.`);let V=X,W=Object.keys(V).filter((C)=>C!=="where");if(W.length!==1)throw new K(G,$.name,z,W.length===0?"Name the field to order by.":`Name exactly one field to order by; got ${W.join(", ")}. `+"Order by several with an array: [{ a: \u2026 }, { b: \u2026 }].");let[M]=W,B=N0($,Z,J,`_o${H}`,`${J.quoteIdent($.table)}.`,z),D=w7($,Z,B.child,M,V[M],z,B.qualifier,J),P=f(B.child,V.where,{dialect:J,operation:z,qualifier:B.qualifier},(C)=>Y(C)?.where),L=[j(`(select ${D.expression} from ${B.source} where ${B.correlation}`)];if(P)L.push(j(" and "),P);return L.push(j(")")),{expression:R(...L),direction:D.direction,nulls:D.nulls}}function w7($,Z,X,z,J,Y,H,G){let V=`orderBy.${Z.name}.${z}`,{direction:W,nulls:M}=x7($,V,J,Y);if(z===n){if(Z.kind!=="many")throw new K(V,$.name,Y,`${Z.name} is a to-one relation, so its count is 0 or 1. Order by one of ${X.name}'s fields instead.`);return{expression:"count(*)",direction:W,nulls:M}}if(Z.kind==="many")throw new K(V,$.name,Y,`${Z.name} is a to-many relation, so ordering by '${z}' has no single answer for a parent with several children. Only `+"{ _count: \u2026 } is supported.");let B=X.fields[z];if(!B)throw new K(V,$.name,Y,`'${z}' is not a field on ${X.name}. Known fields: ${Object.keys(X.fields).join(", ")}.`);return{expression:`${H}${G.quoteIdent(B.column)}`,direction:W,nulls:M}}function x7($,Z,X,z){if(X==="asc"||X==="desc")return{direction:X};if(typeof X==="object"&&X!==null){let{sort:J,nulls:Y}=X;if(J!=="asc"&&J!=="desc")throw new T(Z,$.name,z,'Expected "asc" or "desc".');if(Y===void 0)return{direction:J};if(Y!=="first"&&Y!=="last")throw new K(`${Z}.nulls`,$.name,z,'Expected "first" or "last".');return{direction:J,nulls:Y}}throw new K(Z,$.name,z,'Expected "asc", "desc", or { sort, nulls }.')}var v7=new Set(["asc","desc"]),k7=new Set(["first","last"]);function D0($,Z,X,z){if(Z===void 0||Z===null)return[];let J=Array.isArray(Z),Y=J?Z:[Z],H=[];for(let G=0;G<Y.length;G++){let V=Y[G],W=(M)=>{let B=z?.locate(M);return J?B?.[G]:B};if(typeof V!=="object"||V===null)throw new T("orderBy",$.name,X,"Expected an object or an array of objects.");for(let[M,B]of Object.entries(V)){if(B===void 0)continue;if(M in $.relations){if(!z)throw new K(`orderBy.${M}`,$.name,X,"Ordering by a relation is not implemented here.");let P=B9($,$.relations[M],B,X,z.dialect,(L)=>W(L)?.[M],H.length);H.push({column:M,direction:P.direction,...P.nulls?{nulls:P.nulls}:{},expression:P.expression});continue}let D=$.fields[M];if(!D)throw new g(M,$.name,Object.keys($.fields));H.push({column:D.column,...D9($,M,B,X)})}}return H}function D9($,Z,X,z){if(typeof X==="string"){if(!v7.has(X))throw new T(`orderBy.${Z}: ${JSON.stringify(X)}`,$.name,z,'Expected "asc" or "desc".');return{direction:X}}if(typeof X==="object"&&X!==null){let{sort:J,nulls:Y}=X,H=D9($,Z,J,z).direction;if(Y===void 0)return{direction:H};if(typeof Y!=="string"||!k7.has(Y))throw new K(`orderBy.${Z}.nulls: ${JSON.stringify(Y)}`,$.name,z,'Expected "first" or "last".');return{direction:H,nulls:Y}}throw new K(`orderBy.${Z}`,$.name,z,'Expected "asc", "desc", or { sort, nulls }.')}function Y3($){return $.map((Z)=>({...Z,direction:Z.direction==="asc"?"desc":"asc",...Z.nulls?{nulls:Z.nulls==="first"?"last":"first"}:{}}))}function r($,Z,X){if($.length===0)return null;return x($.map((z)=>{let J=` ${z.direction}`+(z.nulls?` nulls ${z.nulls}`:"");if(z.expression)return x([z.expression,j(J)],"");return j(`${X??""}${Z.quoteIdent(z.column)}${J}`)}),", ")}function H3($,Z,X,z,J){if(typeof J!=="number"||!Number.isInteger(J))throw new T(X,$,Z,`Expected an integer, got ${JSON.stringify(J)}.`);if(z==="skip"&&J<0)throw new T(X,$,Z,"A 'skip' counts rows to pass over, so it cannot be negative. Prisma rejects one too.")}function Q0($,Z,X,z,J,Y=!1){if(X?.take!==void 0)H3($.name,Z,"take","take",X.take);if(X?.skip!==void 0)H3($.name,Z,"skip","skip",X.skip);let H=Y?1:X?.take,G=X?.skip,V=J;if((H!==void 0||G!==void 0)&&V.length===0&&!Y)V=$.primaryKey.map((P)=>({column:$.fields[P]?.column??P,direction:"asc"}));let M=typeof H==="number"&&H<0;if(M)V=Y3(V);let B=H===void 0?null:Y?()=>1:(P)=>Math.abs(Number(P?.take)),D=G===void 0?null:(P)=>Number(P?.skip);return{clause:z.paginate(B,D),terms:V,reversed:M}}function J0($,Z,X){let z=Z?.select,J=Z?.omit;if(z!==void 0&&Z?.include!==void 0)throw new K("select + include",$.name,X,"Prisma allows only one of them on the same query.");if(z!==void 0&&J!==void 0)throw new K("select + omit",$.name,X,"'select' names what to keep and 'omit' what to drop, so the two describe different column lists. Prisma allows only one of them on "+"the same query. Drop the 'omit' \u2014 a 'select' already excludes "+"everything it does not name.");if(z===void 0||z===null)return f7($,J,X);if(typeof z!=="object"||Array.isArray(z))throw new T("select",$.name,X,"Expected an object.");let Y=[];for(let[G,V]of Object.entries($.fields))if(z[G]===!0)Y.push(V);let H=0;for(let G of Object.keys(z)){let V=z[G];if(V===void 0)continue;if(G in $.relations){if(V!==!1)H++;continue}if(G===n){if(V!==!1)H++;continue}if(!(G in $.fields))throw new g(G,$.name,Object.keys($.fields));if(typeof V!=="boolean")throw new T(`select.${G}`,$.name,X,"Expected true or false.")}if(Y.length===0&&H===0)throw new K("select",$.name,X,"At least one field must be selected.");return Y}function f7($,Z,X){if(Z===void 0||Z===null)return Object.values($.fields);if(typeof Z!=="object"||Array.isArray(Z))throw new T("omit",$.name,X,"Expected an object of fields.");let z=new Set;for(let Y of Object.keys(Z)){let H=Z[Y];if(H===void 0)continue;if(Y in $.relations)throw new K(`omit.${Y}`,$.name,X,`'${Y}' is a relation, not a column. A relation is already absent unless an 'include' asks for it.`);if(!(Y in $.fields))throw new g(Y,$.name,Object.keys($.fields));if(typeof H!=="boolean")throw new T(`omit.${Y}`,$.name,X,"Expected true or false.");if(H)z.add(Y)}let J=Object.values($.fields).filter((Y)=>!z.has(Y.name));if(J.length===0)throw new K("omit",$.name,X,`It omits every field on ${$.name}, which leaves no column to select. Prisma rejects that too.`);return J}function V3($,Z,X){if(X.length===0)return{fields:Z};let z=new Set(Z.map((H)=>H.name)),J=X.filter((H)=>!z.has(H));if(J.length===0)return{fields:Z};let Y=new Set([...z,...J]);return{fields:Object.values($.fields).filter((H)=>Y.has(H.name)),hidden:J}}var P9=new Set(["where","orderBy","select","omit","include","take","skip"]),j9=new Set(["where","select","omit","include"]),M3=10;function y0($){return[...new Set($.map((Z)=>Z.strategy))].sort()}function S0($,Z,X,z,J=P0){let Y=h0($,Z,z);if(Y.length===0)return{plans:[],keyFields:[]};let H=[],G=new Set;for(let V of Y){T9($,V,z);let W=U9($,V);R9(W,V.node,z,2);let M=J.plan({parent:$,child:W,relation:V.relation,as:V.as,node:V.node,locate:V.locate,dialect:X,operation:z});H.push(M);for(let B of M.parentFields)G.add(B)}return{plans:H,keyFields:[...G]}}async function D3($,Z,X,z,J){let Y=Array.isArray(X)?X:X===null||X===void 0?[]:[X];if(Y.length===0)return;for(let H of $){if(H.root)continue;await H.load(Y,z,J)}if(Z&&Z.length>0)for(let H of Y)for(let G of Z)delete H[G]}function h0($,Z,X){if(Z===void 0||Z===null)return[];let{include:z,select:J}=Z;L9($,z,J,X);let Y=[];if(z!==void 0&&z!==null){if(typeof z!=="object"||Array.isArray(z))throw new T("include",$.name,X,"Expected an object.");for(let H of Object.keys(z).sort()){let G=z[H];if(G===void 0||G===!1)continue;if(H===n)continue;let V=$.relations[H];if(!V)throw new f0(H,$.name,Object.keys($.relations));Y.push({as:H,relation:V,node:G,locate:(W)=>W?.include?.[H]})}return Y}if(J!==void 0&&J!==null&&typeof J==="object")for(let H of Object.keys(J).sort()){let G=J[H];if(G===void 0||G===!1)continue;let V=$.relations[H];if(!V)continue;Y.push({as:H,relation:V,node:G,locate:(W)=>W?.select?.[H]})}return Y}function L9($,Z,X,z,J){if(Z===void 0||X===void 0)return;throw new K(J?`${J}: select + include`:"select + include",$.name,z,"Prisma allows only one of them on the same query, at any level.")}function T9($,Z,X){let z=Z.node;if(z===!0)return;if(typeof z!=="object"||z===null||Array.isArray(z))throw new T(Z.as,$.name,X,"Expected true or an object of relation arguments.");let J=z;L9($,J.include,J.select,X,Z.as);let Y=Z.relation.kind==="many";for(let H of Object.keys(J).sort()){if(J[H]===void 0)continue;if(Y&&(H==="take"||H==="skip")){g7($,Z,X,H,J[H]);continue}if(Y?P9.has(H):j9.has(H))continue;if(H==="lock")throw new k0(`${Z.as}.lock`,$.name,X,"'lock' locks the rows of the model being queried, not an included relation's. Lock the related rows with their own locking read in the same transaction.");if(H==="orderBy"&&!Y)throw new K(`${Z.as}.orderBy`,$.name,X,"Prisma does not accept 'orderBy' on a to-one relation \u2014 there is at "+"most one row to order.");if(H==="take"||H==="skip")throw new K(`${Z.as}.${H}`,$.name,X,`Prisma does not accept '${H}' on a to-one relation.`);throw new K(`${Z.as}.${H}`,$.name,X,`A relation node takes ${[...Y?P9:j9].sort().join(", ")}.`)}}function g7($,Z,X,z,J){H3($.name,X,`${Z.as}.${z}`,z,J)}function c3($,Z){let X=$.node;if(typeof X!=="object"||X===null||Array.isArray(X))return;for(let z of["take","skip"]){if(X[z]===void 0)continue;throw new K(`${$.as}.${z}`,$.parent.name,$.operation,`A '${z}' inside a to-many relation is per parent, and the batched `+"relation planner serves every parent from one query \u2014 so the only "+`limit it could emit would page every parent's children as one set. Only the lateral join strategy can express it, by paginating inside a subquery that already runs once per parent row, and it needs Postgres: ${Z}. Load '${$.as}' as its own query, or narrow it with 'where'.`)}}function R9($,Z,X,z){if(typeof Z!=="object"||Z===null||Array.isArray(Z))return;if(Z.select!==void 0)J0($,Z,X);let J=h0($,Z,X);if(J.length===0)return;if(z>M3)throw new p3($.name,M3);for(let Y of J)T9($,Y,X),R9(U9($,Y),Y.node,X,z+1)}function I9($,Z,X,z){if($.parentFields.length!==1)throw new K(X.name,Z.name,z,`${X.name} joins on ${$.parentFields.length} fields (${$.parentFields.join(", ")}), and it is planned through a join table, which links two models by a single primary key each side. Prisma does not build an implicit many-to-many over a composite key.`);return{parentField:$.parentFields[0],childField:$.childFields[0],join:$.join}}function B0($,Z,X,z){if(X.joinTable)return h7($,Z,X);if(X.from.length>0)return K9($,X,X.from,X.to,z);let J=y7($,Z,X);if(J.from.length===0)throw new c($.name,X.name,`neither ${$.name}.${X.name} nor ${Z.name}.${J.name} holds the foreign key.`);return K9($,X,J.to,J.from,z)}function K9($,Z,X,z,J){if(X.length===0)throw new K(Z.name,$.name,J,`${Z.name} names no join fields.`);if(X.length!==z.length)throw new c($.name,Z.name,`it joins ${X.length} field(s) to ${z.length}: ${X.join(", ")} against ${z.join(", ")}.`);return{parentFields:X,childFields:z}}function y7($,Z,X){let z=Object.values(Z.relations).filter((J)=>J.relationName===X.relationName&&!(Z.name===$.name&&J.name===X.name));if(z.length!==1)throw new c($.name,X.name,z.length===0?`${Z.name} declares no relation named '${X.relationName}'.`:`${Z.name} declares ${z.length} relations named '${X.relationName}'.`);return z[0]}function h7($,Z,X){let{table:z,a:J,b:Y}=X.joinTable;if(J===Y){let G=X.joinTable.ownerColumn;if(!G)throw new K(X.name,$.name,"include",`${X.name} is a self-referential implicit many-to-many, and the generated artifact predates support for one. Re-run \`prisma generate\`.`);return{parentFields:[G3($,X)],childFields:[G3(Z,X)],join:{table:z,parentColumn:G,childColumn:G==="A"?"B":"A"}}}if($.name!==J&&$.name!==Y)throw new c($.name,X.name,`the join table '${z}' connects ${J} and ${Y}, neither of which is ${$.name}.`);let H=$.name===J?"A":"B";return{parentFields:[G3($,X)],childFields:[G3(Z,X)],join:{table:z,parentColumn:H,childColumn:H==="A"?"B":"A"}}}function G3($,Z){if($.primaryKey.length!==1)throw new c($.name,Z.name,`an implicit many-to-many joins on ${$.name}'s primary key, which has ${$.primaryKey.length} fields.`);return $.primaryKey[0]}function W3($,Z,X){let z=$.fields[X];if(!z)throw new c($.name,Z.name,`it joins on '${X}', which is not a field on ${$.name}.`);return z}function U9($,Z){return X0($,Z.relation,Z.as)}function X0($,Z,X=Z.name){let z=Z.model;if(!a(z))throw new d3($.name,X,z,C9());let J=l(z)?.$schema;if(!J)throw new g0(z);return J}var Q9="batched",P0={name:Q9,plan($){c3($,"this query planned with the batched strategy");let Z=B0($.parent,$.child,$.relation,$.operation);for(let Y of Z.parentFields)_9($.parent,$.relation,W3($.parent,$.relation,Y));for(let Y of Z.childFields)_9($.child,$.relation,W3($.child,$.relation,Y));let X=W3($.parent,$.relation,Z.parentFields[0]),z=W3($.child,$.relation,Z.childFields[0]),J=$.relation.kind==="many";return{as:$.as,model:$.relation.model,kind:$.relation.kind,parentFields:Z.parentFields,strategy:Q9,load(Y,H,G){let V={parentKeyField:X,childKeyField:z,many:J,parents:Y,args:H,executor:G};return Z.join?m7($,Z,V):u7($,Z,V)}}}};async function u7($,Z,X){let{keys:z,byKey:J}=O9(X.parents,Z.parentFields);if(z.length===0)return;let Y=$.locate(X.args),H=N9(Y,Z.childFields,z,$.child,$.dialect),G=await X.executor.exec($.relation.model,"findMany",H.args,!0);for(let V of G){let W=J.get(v0(Z.childFields.map((M)=>V[M])));if(!W)continue;for(let M of W)F9(M,$.as,V,X.many)}if(H.hidden)for(let V of G)for(let W of Z.childFields)delete V[W]}async function m7($,Z,X){let{keys:z,byKey:J}=O9(X.parents,Z.parentFields);if(z.length===0)return;let{dialect:Y}=$,H=Z.join,G=await p7(Y,H,z.map((P)=>Y.encode(P[0],X.parentKeyField)),X.executor),V=new Map,W=[];for(let P of G){let L=v0([Y.decode(P[H.parentColumn],X.parentKeyField)]),C=J.get(L);if(!C)continue;let F=Y.decode(P[H.childColumn],X.childKeyField),N=v0([F]),_=V.get(N);if(_===void 0)_=[],V.set(N,_),W.push([F]);for(let Q of C)_.push(Q)}if(W.length===0)return;let M=$.locate(X.args),B=N9(M,Z.childFields,W,$.child,$.dialect),D=await X.executor.exec($.relation.model,"findMany",B.args,!0);for(let P of D){let L=V.get(v0([P[Z.childFields[0]]]));if(!L)continue;for(let C of L)F9(C,$.as,P,X.many)}if(B.hidden)for(let P of D)delete P[Z.childFields[0]]}async function p7($,Z,X,z){let J=R(j(`select ${$.quoteIdent(Z.parentColumn)}, ${$.quoteIdent(Z.childColumn)} from ${$.quoteIdent(Z.table)} where `),$.inList($.quoteIdent(Z.parentColumn),!1,X.length,()=>X)),{text:Y,binders:H}=d(J,$,{model:Z.table,operation:"include"}),G=A0();return z.query(Y,H.map((V)=>V(void 0,G)))}function N9($,Z,X,z,J){let Y=$===!0||$===null||typeof $!=="object"?{}:$,H=Z.length===1?{[Z[0]]:{in:X.map((B)=>B[0])}}:d7(z,Z,X,J),G={where:Y.where===void 0?H:{AND:[Y.where,H]}};if(Y.orderBy!==void 0)G.orderBy=Y.orderBy;if(Y.include!==void 0)G.include=Y.include;let V=Y.omit;if(V!==void 0){let B=Z.filter((D)=>V[D]===!0);if(B.length===0)G.omit=V;else{let D={...V};for(let P of B)delete D[P];return G.omit=D,{args:G,hidden:!0}}}let W=Y.select;if(W===void 0)return{args:G,hidden:!1};let M=Z.filter((B)=>W[B]!==!0);if(M.length===0)return G.select=W,{args:G,hidden:!1};G.select={...W};for(let B of M)G.select[B]=!0;return{args:G,hidden:!0}}function d7($,Z,X,z){let J=Z.map((Y)=>$.fields[Y]?.type);if(J.every((Y)=>Y!==void 0)&&z.canBindCompositeIn(J))return{[z0]:G9(Z,X)};return{OR:X.map((Y)=>Object.fromEntries(Z.map((H,G)=>[H,Y[G]])))}}function v0($){return JSON.stringify($.map(c7))}function F9($,Z,X,z){if(z){$[Z].push(X);return}if($[Z]===null)$[Z]=X}function O9($,Z){let X=new Map,z=[];for(let J of $){let Y=Z.map((V)=>J[V]);if(Y.some((V)=>V===null||V===void 0))continue;let H=v0(Y),G=X.get(H);if(G===void 0)G=[],X.set(H,G),z.push(Y);G.push(J)}return{keys:z,byKey:X}}function c7($){if(typeof $!=="object"||$===null)return $;if($ instanceof Date)return $.getTime();if(ArrayBuffer.isView($)){let Z=new Uint8Array($.buffer,$.byteOffset,$.byteLength),X="";for(let z of Z)X+=z.toString(16).padStart(2,"0");return`bytes:${X}`}throw Error(`Cannot key a relation stitch on ${Object.prototype.toString.call($)}.`)}function _9($,Z,X){if(X.isList)throw new c($.name,Z.name,`it joins on '${X.name}', a ${X.type} list \u2014 which decodes to a new `+"array per row and so cannot be compared between the two sides.");if(X.type!=="Json")return;throw new c($.name,Z.name,`it joins on '${X.name}', a ${X.type} \u2014 which decodes to a new object `+"per row and so cannot be compared between the two sides.")}var A9=(()=>{try{return Function("return 1")()===1}catch{return!1}})(),S9=!0;function s7($){S9=$}function i7(){return A9}function u0($,Z,X=[]){if(A9&&S9)return n7($,Z,X);return s3($,Z,X)}function s3($,Z,X=[]){let z=$.map((G)=>({key:G.name,column:G.column,field:G,decode:Z.needsDecode(G)})),J=z.length,Y=X.map((G)=>({key:G.key,many:G.kind==="many"})),H=Y.length;return(G)=>{let V=[];for(let W=0;W<G.length;W++){let M=G[W],B={};for(let D=0;D<J;D++){let P=z[D],L=M[P.column];B[P.key]=P.decode?Z.decode(L,P.field):L??null}for(let D=0;D<H;D++)B[Y[D].key]=Y[D].many?[]:null;V.push(B)}return V}}function n7($,Z,X){let z=[];for(let Y=0;Y<$.length;Y++){let H=$[Y],G=JSON.stringify(H.name),V=JSON.stringify(H.column);z.push(Z.needsDecode(H)?`${G}: d.decode(row[${V}], f[${Y}])`:`${G}: row[${V}] ?? null`)}for(let Y of X)z.push(`${JSON.stringify(Y.key)}: ${Y.kind==="many"?"[]":"null"}`);let J=`
3
3
  return function shape(rows) {
4
4
  const out = [];
5
5
  for (let i = 0; i < rows.length; i++) {
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{Da as f}from"../chunk-s0z61m9j.js";import{Ea as S}from"../chunk-a5qn2sq8.js";import{ll as Q,nl as Z,ol as P,pl as y,ql as U,rl as A}from"../chunk-yc2pnb1w.js";import{vl as H}from"../chunk-7effp39a.js";import"../chunk-51fvpq55.js";import{Dl as F}from"../chunk-wgre66wq.js";var x="/__gemi__/health",$=Symbol.for("gemi.server.health");function V(){let z=globalThis;return z[$]??={lagMs:0,consecutiveBreaches:0,degraded:!1,timer:void 0},z[$]}function W(){let z=V(),B=Q();return{healthy:!B&&!z.degraded,shuttingDown:B,lagMs:z.lagMs,consecutiveBreaches:z.consecutiveBreaches}}function E(z,B){let I=V();I.lagMs=z,I.consecutiveBreaches=z>B.maxLagMs?I.consecutiveBreaches+1:0;let J=I.consecutiveBreaches>=B.breaches;if(J&&!I.degraded)console.warn(`[gemi] Health: degraded (event-loop lag ${Math.round(z)}ms, ${I.consecutiveBreaches} samples in a row over ${B.maxLagMs}ms).`);else if(!J&&I.degraded)console.log(`[gemi] Health: recovered (event-loop lag ${Math.round(z)}ms).`);I.degraded=J}function G(z){let B=V();if(B.timer)return;let I=performance.now()+z.intervalMs;B.timer=setInterval(()=>{let J=performance.now();E(Math.max(0,J-I),z),I=J+z.intervalMs},z.intervalMs),B.timer.unref?.()}function _(z=process.env){return{paths:D(z.GEMI_HEALTH_PATH),intervalMs:O("GEMI_HEALTH_INTERVAL_MS",z.GEMI_HEALTH_INTERVAL_MS,500),maxLagMs:O("GEMI_HEALTH_MAX_LAG_MS",z.GEMI_HEALTH_MAX_LAG_MS,1000),breaches:Math.ceil(O("GEMI_HEALTH_BREACHES",z.GEMI_HEALTH_BREACHES,3))}}function D(z){if(z===void 0||z.trim()==="")return[x];if(z.trim().toLowerCase()==="off")return[];let B=z.split(",").map((J)=>J.trim()).filter(Boolean);if(B.filter((J)=>!J.startsWith("/")).length>0)throw Error(`GEMI_HEALTH_PATH: expected comma-separated paths starting with "/", or "off"; got ${JSON.stringify(z)}.`);return B}function O(z,B,I){if(B===void 0||B.trim()==="")return I;let J=Number(B);if(Number.isFinite(J)&&J>0)return J;return console.warn(`[gemi] Ignoring ${z}="${B}": expected a positive number.`),I}function j(z,B){if(B.length===0)return z;let I=new Set(B);return async(J,K)=>{if(!B.some((b)=>J.url.includes(b))||!I.has(new URL(J.url).pathname))return z(J,K);return y(R(J.method))}}function R(z){let B={"Cache-Control":"no-store","Content-Type":"text/plain; charset=utf-8"};if(z!=="GET"&&z!=="HEAD")return new Response("Method Not Allowed",{status:405,headers:{...B,Allow:"GET, HEAD"}});let{healthy:I,shuttingDown:J}=W();return new Response(z==="HEAD"?null:I?"ok":J?"shutting down":"degraded",{status:I?200:503,headers:B})}var L=Symbol.for("gemi.server.devGeneration"),X={graceMs:1e4,providerTimeoutMs:5000};class Y{app;inFlight=0;waiters=new Set;constructor(z){this.app=z}track(z){return async(B,I)=>{this.inFlight++;try{return await z(B,I)}finally{if(this.inFlight--,this.inFlight===0)this.wake()}}}get pending(){return this.inFlight}async retire({graceMs:z,providerTimeoutMs:B}){try{await this.idle(z),await Promise.resolve().then(()=>this.app.shutdown({timeoutMs:B}))}catch(I){C(I)}}idle(z){if(this.inFlight===0)return Promise.resolve();return new Promise((B)=>{let I=()=>{clearTimeout(J),this.waiters.delete(I),B()},J=setTimeout(I,z);this.waiters.add(I)})}wake(){for(let z of this.waiters)z()}}function N(z,B=X){let I=globalThis,J=I[L];if(I[L]=z,!J||J===z||typeof J.retire!=="function")return Promise.resolve();let K=J.retire.bind(J);return Promise.resolve().then(()=>K(B)).catch(C)}function C(z){console.error("[gemi] Shutting down the application a reload replaced failed:",z)}class k{app;instrumentation;handleSignals;server;stopping;settings;constructor(z){this.app=new S({kernel:z.kernel}),this.handleSignals=z.handleSignals??!0,this.instrumentation=U(z.instrumentation??((B,I)=>I(B)))}async start(){process.env.ROOT_DIR=H();let z=Bun.env.NODE_ENV==="production",B=_();if(z)G(B);let I=j(this.instrumentation,B.paths);if(z){if(this.handleSignals)A(()=>this.stop());this.settings=Z()}try{await this.app.waitForBoot()}catch(J){if(!z)this.app.shutdown({timeoutMs:X.providerTimeoutMs});throw J}if(z){let{httpProd:J}=await import("../chunk-3yvdvv3d.js");this.server=await J(this.app,I)}else{f();let{httpDev:J}=await import("../chunk-pg16c4nx.js"),K=new Y(this.app);this.server=await J(this.app,K.track(I)),N(K)}return this.server}stop(z={}){let B=this.app.sockets();return this.stopping??=P({server:this.server,closeSockets:B?()=>B.shutdown():void 0,shutdownProviders:(I)=>this.app.shutdown(I),settings:{...this.settings??Z(),...z}}),this.stopping}}export{W as liveness,Q as isShuttingDown,k as Server};
2
+ import{Da as f}from"../chunk-s0z61m9j.js";import{Ea as S}from"../chunk-a5qn2sq8.js";import{ll as Q,nl as Z,ol as P,pl as y,ql as U,rl as A}from"../chunk-yc2pnb1w.js";import{vl as H}from"../chunk-7effp39a.js";import"../chunk-51fvpq55.js";import{Dl as F}from"../chunk-wgre66wq.js";var x="/__gemi__/health",$=Symbol.for("gemi.server.health");function V(){let z=globalThis;return z[$]??={lagMs:0,consecutiveBreaches:0,degraded:!1,timer:void 0},z[$]}function W(){let z=V(),B=Q();return{healthy:!B&&!z.degraded,shuttingDown:B,lagMs:z.lagMs,consecutiveBreaches:z.consecutiveBreaches}}function E(z,B){let I=V();I.lagMs=z,I.consecutiveBreaches=z>B.maxLagMs?I.consecutiveBreaches+1:0;let J=I.consecutiveBreaches>=B.breaches;if(J&&!I.degraded)console.warn(`[gemi] Health: degraded (event-loop lag ${Math.round(z)}ms, ${I.consecutiveBreaches} samples in a row over ${B.maxLagMs}ms).`);else if(!J&&I.degraded)console.log(`[gemi] Health: recovered (event-loop lag ${Math.round(z)}ms).`);I.degraded=J}function G(z){let B=V();if(B.timer)return;let I=performance.now()+z.intervalMs;B.timer=setInterval(()=>{let J=performance.now();E(Math.max(0,J-I),z),I=J+z.intervalMs},z.intervalMs),B.timer.unref?.()}function _(z=process.env){return{paths:D(z.GEMI_HEALTH_PATH),intervalMs:O("GEMI_HEALTH_INTERVAL_MS",z.GEMI_HEALTH_INTERVAL_MS,500),maxLagMs:O("GEMI_HEALTH_MAX_LAG_MS",z.GEMI_HEALTH_MAX_LAG_MS,1000),breaches:Math.ceil(O("GEMI_HEALTH_BREACHES",z.GEMI_HEALTH_BREACHES,3))}}function D(z){if(z===void 0||z.trim()==="")return[x];if(z.trim().toLowerCase()==="off")return[];let B=z.split(",").map((J)=>J.trim()).filter(Boolean);if(B.filter((J)=>!J.startsWith("/")).length>0)throw Error(`GEMI_HEALTH_PATH: expected comma-separated paths starting with "/", or "off"; got ${JSON.stringify(z)}.`);return B}function O(z,B,I){if(B===void 0||B.trim()==="")return I;let J=Number(B);if(Number.isFinite(J)&&J>0)return J;return console.warn(`[gemi] Ignoring ${z}="${B}": expected a positive number.`),I}function j(z,B){if(B.length===0)return z;let I=new Set(B);return async(J,K)=>{if(!B.some((b)=>J.url.includes(b))||!I.has(new URL(J.url).pathname))return z(J,K);return y(R(J.method))}}function R(z){let B={"Cache-Control":"no-store","Content-Type":"text/plain; charset=utf-8"};if(z!=="GET"&&z!=="HEAD")return new Response("Method Not Allowed",{status:405,headers:{...B,Allow:"GET, HEAD"}});let{healthy:I,shuttingDown:J}=W();return new Response(z==="HEAD"?null:I?"ok":J?"shutting down":"degraded",{status:I?200:503,headers:B})}var L=Symbol.for("gemi.server.devGeneration"),X={graceMs:1e4,providerTimeoutMs:5000};class Y{app;inFlight=0;waiters=new Set;constructor(z){this.app=z}track(z){return async(B,I)=>{this.inFlight++;try{return await z(B,I)}finally{if(this.inFlight--,this.inFlight===0)this.wake()}}}get pending(){return this.inFlight}async retire({graceMs:z,providerTimeoutMs:B}){try{await this.idle(z),await Promise.resolve().then(()=>this.app.shutdown({timeoutMs:B}))}catch(I){C(I)}}idle(z){if(this.inFlight===0)return Promise.resolve();return new Promise((B)=>{let I=()=>{clearTimeout(J),this.waiters.delete(I),B()},J=setTimeout(I,z);this.waiters.add(I)})}wake(){for(let z of this.waiters)z()}}function N(z,B=X){let I=globalThis,J=I[L];if(I[L]=z,!J||J===z||typeof J.retire!=="function")return Promise.resolve();let K=J.retire.bind(J);return Promise.resolve().then(()=>K(B)).catch(C)}function C(z){console.error("[gemi] Shutting down the application a reload replaced failed:",z)}class k{app;instrumentation;handleSignals;server;stopping;settings;constructor(z){this.app=new S({kernel:z.kernel}),this.handleSignals=z.handleSignals??!0,this.instrumentation=U(z.instrumentation??((B,I)=>I(B)))}async start(){process.env.ROOT_DIR=H();let z=Bun.env.NODE_ENV==="production",B=_();if(z)G(B);let I=j(this.instrumentation,B.paths);if(z){if(this.handleSignals)A(()=>this.stop());this.settings=Z()}try{await this.app.waitForBoot()}catch(J){if(!z)this.app.shutdown({timeoutMs:X.providerTimeoutMs});throw J}if(z){let{httpProd:J}=await import("../chunk-6abrc83j.js");this.server=await J(this.app,I)}else{f();let{httpDev:J}=await import("../chunk-tx3t5qnt.js"),K=new Y(this.app);this.server=await J(this.app,K.track(I)),N(K)}return this.server}stop(z={}){let B=this.app.sockets();return this.stopping??=P({server:this.server,closeSockets:B?()=>B.shutdown():void 0,shutdownProviders:(I)=>this.app.shutdown(I),settings:{...this.settings??Z(),...z}}),this.stopping}}export{W as liveness,Q as isShuttingDown,k as Server};
3
3
 
4
4
  //# debugId=0C1B7267BE4B619964756E2164756E21
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{db as E8}from"../chunk-8m9kgynj.js";import{Ab as H8,Bb as U8,Cb as O8,Db as S8,Eb as R8,Fb as T4,Gb as X6,Hb as C,Ib as _8,Jb as f8,Kb as C8,Lb as k8,Mb as b8,Nb as T8,Ob as P8,Pb as V8,Qb as I8,Rb as v8,Sb as q8,Tb as w8,Ub as y8,Vb as A8,Wb as h8,Xb as g8,eb as gZ,fb as EZ,gb as mZ,hb as cZ,ib as uZ,jb as f4,kb as pZ,lb as O4,mb as S4,nb as q1,ob as dZ,pb as lZ,qb as X8,ub as B8,vb as j8,wb as M8,xb as L8,yb as F8,zb as D8}from"../chunk-75ajptxk.js";import{_b as k4}from"../chunk-5z7mqgkp.js";import{Ad as W8,Bd as Z8,Cd as $8,Dd as J8,Ed as Q8,Fd as Y8,Gd as K8,Hd as G8,Id as z8,td as nZ,ud as iZ,vd as sZ,wd as oZ,xd as aZ,yd as rZ,zd as eZ}from"../chunk-z2btwd27.js";import{Jd as tZ}from"../chunk-3tyqnh59.js";import{Kd as SZ,Ld as RZ,Md as _Z,Nd as fZ,Od as CZ,Pd as kZ,Qd as bZ,Rd as TZ,Sd as PZ,Td as VZ,Ud as IZ,Vd as vZ,Wd as qZ,Xd as wZ,Yd as yZ,Zd as AZ,ce as hZ}from"../chunk-nc1gstvq.js";import{de as N8,ee as x8}from"../chunk-z94ms1jv.js";import"../chunk-fv1r0w0r.js";import{Ae as j4,Be as M4,Bf as q5,Cf as z6,Df as w5,Dg as LZ,Fe as mW,Ge as cW,He as uW,Hf as y5,Ie as pW,If as A5,Ig as w1,Je as dW,Jf as g5,Ke as lW,Le as nW,Me as iW,Mf as E5,Ne as sW,Nf as m5,Oe as w0,Of as c5,Pe as oW,Pf as u5,Qe as aW,Re as tW,Rf as p5,Se as rW,Sf as d5,Te as eW,Tf as l5,Tg as NZ,Uf as n5,Ug as xZ,Vf as i5,Wf as s5,Xf as o5,Yf as a5,Zf as t5,_f as r5,dg as k,eg as i,fg as e5,gf as G5,gg as WZ,hf as z5,hg as ZZ,if as X5,ig as $Z,jf as B5,jg as JZ,kf as j5,lf as M5,lg as QZ,mg as YZ,ng as KZ,oe as Z6,og as GZ,pe as AW,pg as zZ,qe as hW,re as gW,rf as f5,sf as C5,sg as XZ,te as EW,tf as k5,tg as BZ,uf as b5,ug as jZ,vf as T5,wf as P5,xe as $6,xf as V5,ye as B4,yf as I5,ze as c0,zf as v5,zg as MZ}from"../chunk-sadtazf5.js";import"../chunk-99be7vbh.js";import"../chunk-n3pc62tc.js";import{$h as U4,Di as Q5,Ei as Y5,Gi as K5,Ii as P1,Mh as X4,Nh as K4,Oh as M1,ci as t,ei as d,ii as G4,ji as L1,ki as T1,li as W5,mi as Z5,ni as $5,oi as J5}from"../chunk-jr7hdp5z.js";import"../chunk-kscwjycy.js";import{Si as r}from"../chunk-mp9hfbs3.js";import{$i as O5,_i as U5,aj as b1,bj as S5,cj as v0,dj as R5,ej as _5}from"../chunk-hkp00b9x.js";import{kj as F5,lj as D5,mj as H5}from"../chunk-70kpm72z.js";import"../chunk-1btx3kkv.js";import{Vj as h5}from"../chunk-egzfxdr1.js";import{Xj as L5,Yj as N5,Zj as x5}from"../chunk-rh811v1f.js";import"../chunk-wamxfhh6.js";import"../chunk-cd847h0t.js";import"../chunk-zh0knwen.js";import"../chunk-04ffq2ge.js";import{Pk as FZ,Qk as DZ,Rk as HZ,Sk as UZ,Uk as OZ}from"../chunk-h4h8m3yr.js";import"../chunk-pfjky33c.js";import{cl as w}from"../chunk-vqar6ysw.js";import"../chunk-mxhy19a9.js";import"../chunk-22jm6sn1.js";import"../chunk-yc2pnb1w.js";import"../chunk-7effp39a.js";import"../chunk-51fvpq55.js";import{Dl as A0}from"../chunk-wgre66wq.js";import{Buffer as y0}from"buffer";class h0 extends L1{client;config;constructor(...W){super();this.config=W}async connect(){let W=await import("../chunk-jry03jqj.js");return this.client??=new W.S3Client(...this.config),{sdk:W,client:this.client}}async put(W,{signal:Z}={}){Z?.throwIfAborted();let $,J,Q,Y=process.env.BUCKET_NAME;if(W instanceof Blob)$=W,Q=`${Bun.randomUUIDv7()}.${W.type.split("/")[1].split(";")[0]}`,J=W.type;else $=W.body,Q=W.name,Y=W.bucket??Y,J=W.contentType||($ instanceof Blob||$ instanceof File?$.type:void 0);J=J||void 0;let K=$ instanceof y0?$:$ instanceof Blob||$ instanceof File?y0.from(await $.arrayBuffer()):"",{sdk:G,client:X}=await this.connect();return Z?.throwIfAborted(),await X.send(new G.PutObjectCommand({Bucket:Y,Key:Q,Body:K,ContentType:J}),{abortSignal:Z}),Q}async delete(W){let Z=typeof W==="string"?W:W.name,$=(typeof W==="string"?void 0:W.bucket)??process.env.BUCKET_NAME;if(!Z)throw Error("Object name has to be specified");let{sdk:J,client:Q}=await this.connect();try{await Q.send(new J.DeleteObjectCommand({Bucket:$,Key:Z}))}catch(Y){if(Y?.name==="NoSuchKey"||Y?.$metadata?.httpStatusCode===404)return;throw Y}}async*pages(W,{bucket:Z,signal:$}){let{sdk:J,client:Q}=await this.connect(),Y;do{$?.throwIfAborted();let K=await Q.send(new J.ListObjectsV2Command({Bucket:Z??process.env.BUCKET_NAME,Prefix:W,ContinuationToken:Y}),{abortSignal:$});yield(K.Contents??[]).map((G)=>({name:G.Key,size:G.Size??0,lastModified:G.LastModified??new Date(0)})),Y=K.IsTruncated?K.NextContinuationToken:void 0}while(Y)}async*objects(W,Z={}){for await(let $ of this.pages(W,Z))yield*$}async deletePrefix(W,Z={}){G4(W);let $=Z.bucket??process.env.BUCKET_NAME,{sdk:J,client:Q}=await this.connect(),Y=0;for await(let K of this.pages(W,{...Z,bucket:$})){if(K.length===0)continue;Z.signal?.throwIfAborted();let X=(await Q.send(new J.DeleteObjectsCommand({Bucket:$,Delete:{Objects:K.map((z)=>({Key:z.name})),Quiet:!0}}),{abortSignal:Z.signal}))?.Errors??[];if(X.length>0){let z=X[0];throw Error(`S3 could not delete ${X.length} object(s) under "${W}", e.g. "${z.Key}": ${z.Code??"unknown"} ${z.Message??""}`.trim())}Y+=K.length}return Y}async list(W){let{sdk:Z,client:$}=await this.connect();return await $.send(new Z.ListObjectsV2Command({Bucket:process.env.BUCKET_NAME,Prefix:W}))}async fetch(W,{signal:Z}={}){Z?.throwIfAborted();let $=process.env.BUCKET_NAME,J;if(typeof W==="string")J=W;else $=W.bucket??$,J=W.name;if(!J)throw Error("Object name has to be specified");let{sdk:Q,client:Y}=await this.connect();Z?.throwIfAborted();let K=await Y.send(new Q.GetObjectCommand({Bucket:$,Key:J}),{abortSignal:Z}),G=T1(K.Body.transformToWebStream(),Z);return Z?.throwIfAborted(),new Response(G,{headers:{"Content-Type":K.ContentType,"Content-Length":K.ContentLength.toString(),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":K.LastModified?.toUTCString()||"",ETag:K.ETag||""}})}async read(W){let Z=typeof W==="string"?{name:W}:W,$=Z.bucket??process.env.BUCKET_NAME,{name:J,range:Q=null}=Z;if(!J)throw Error("Object name has to be specified");let{sdk:Y,client:K}=await this.connect(),G;try{G=await K.send(new Y.GetObjectCommand({Bucket:$,Key:J,Range:Q?K4(Q):void 0}))}catch(j){if(j?.name==="InvalidRange"||j?.$metadata?.httpStatusCode===416)throw new t(await this.size({name:J,bucket:$}));if(j?.name==="NoSuchKey"||j?.$metadata?.httpStatusCode===404)throw new d(J);throw j}let X=M1(G.ContentRange),z=Boolean(X)&&G.$metadata?.httpStatusCode===206,B=X?.total??G.ContentLength??0;return{body:G.Body.transformToWebStream(),start:X?.start??0,end:X?.end??B-1,total:B,partial:z,type:G.ContentType??"application/octet-stream",etag:G.ETag||void 0,lastModified:G.LastModified,name:J}}async size(W){let Z=typeof W==="string"?W:W.name,$=(typeof W==="string"?void 0:W.bucket)??process.env.BUCKET_NAME,{sdk:J,client:Q}=await this.connect();try{return(await Q.send(new J.HeadObjectCommand({Bucket:$,Key:Z}))).ContentLength??0}catch(Y){if(Y?.name==="NotFound"||Y?.$metadata?.httpStatusCode===404)throw new d(Z);throw Y}}}import{Buffer as g0}from"buffer";import{Readable as s6}from"stream";function z4(W){return W?.statusCode===404||W?.details?.errorCode==="BlobNotFound"||W?.code==="BlobNotFound"}function o6(W){return W?.statusCode===416||W?.details?.errorCode==="InvalidRange"||W?.code==="InvalidRange"}class E0 extends L1{config;serviceClientPromise=null;constructor(W={}){super();this.config=W}async serviceClient(){if(this.config.serviceClient)return this.config.serviceClient;return this.serviceClientPromise??=(async()=>{let W;try{W=await import("@azure/storage-blob")}catch{throw Error("AzureBlobDriver requires the '@azure/storage-blob' package. Install it with `bun add @azure/storage-blob`, or pass a pre-built `serviceClient`.")}let Z=this.config.connectionString??process.env.AZURE_STORAGE_CONNECTION_STRING;if(this.config.url)return new W.BlobServiceClient(this.config.url,this.config.credential);if(Z)return W.BlobServiceClient.fromConnectionString(Z);throw Error("AzureBlobDriver needs a connection string (AZURE_STORAGE_CONNECTION_STRING), a `url`, or a `serviceClient`.")})(),this.serviceClientPromise}async blob(W,Z){if(!W)throw Error("Object name has to be specified");let $=Z??this.config.container??process.env.BUCKET_NAME;if(!$)throw Error("AzureBlobDriver needs a container name, from `bucket`, the `container` config, or BUCKET_NAME.");return(await this.serviceClient()).getContainerClient($).getBlockBlobClient(W)}async put(W,{signal:Z}={}){Z?.throwIfAborted();let $,J,Q,Y;if(W instanceof Blob)$=W,Q=`${Bun.randomUUIDv7()}.${W.type.split("/")[1].split(";")[0]}`,J=W.type;else $=W.body,Q=W.name,Y=W.bucket,J=W.contentType??($ instanceof Blob||$ instanceof File?$.type:void 0);let K=$ instanceof g0?$:g0.from(await $.arrayBuffer()),G=await this.blob(Q,Y);return Z?.throwIfAborted(),await G.uploadData(K,{blobHTTPHeaders:J?{blobContentType:J}:void 0,abortSignal:Z}),Q}async*objects(W,{bucket:Z,signal:$}={}){$?.throwIfAborted();let J=Z??this.config.container??process.env.BUCKET_NAME;if(!J)throw Error("AzureBlobDriver needs a container name, from `bucket`, the `container` config, or BUCKET_NAME.");let Y=(await this.serviceClient()).getContainerClient(J);for await(let K of Y.listBlobsFlat({prefix:W}))$?.throwIfAborted(),yield{name:K.name,size:K.properties?.contentLength??0,lastModified:K.properties?.lastModified??new Date(0)}}async list(W){let Z=this.config.container??process.env.BUCKET_NAME,J=(await this.serviceClient()).getContainerClient(Z),Q=[];for await(let Y of J.listBlobsFlat({prefix:W}))Q.push(Y.name);return Q}async fetch(W,{signal:Z}={}){Z?.throwIfAborted();let $=await this.download(typeof W==="string"?{name:W}:{name:W.name,bucket:W.bucket},Z);return new Response($.body,{headers:{"Content-Type":$.type,"Content-Length":String($.total),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":$.lastModified?.toUTCString()??"",ETag:$.etag??""}})}async read(W){return this.download(typeof W==="string"?{name:W}:W)}async download(W,Z){let{name:$,bucket:J,range:Q=null}=W,Y=await this.blob($,J);Z?.throwIfAborted();let K,G,X=Q?.kind==="suffix"||Q?.kind==="offset"&&Q.end===null&&Q.start===0;if(Q&&X){let H=await this.size({name:$,bucket:J}),p=X4(Q,H);if(!p)throw new t(H);K=p.start,G=p.length}else if(Q?.kind==="offset")K=Q.start,G=Q.end===null?void 0:Q.end-Q.start+1;let z;try{z=await Y.download(K,G,Z?{abortSignal:Z}:void 0)}catch(H){if(o6(H))throw new t(await this.size({name:$,bucket:J}));if(z4(H))throw new d($);throw H}let B=M1(z.contentRange),j=Boolean(B),x=B?.total??z.contentLength??0,O=await a6(z);if(O instanceof ReadableStream)O=T1(O,Z);return Z?.throwIfAborted(),{body:O,start:B?.start??0,end:B?.end??x-1,total:x,partial:j,type:z.contentType??"application/octet-stream",etag:z.etag||void 0,lastModified:z.lastModified,name:$}}async size(W){let Z=typeof W==="string"?W:W.name,$=typeof W==="string"?void 0:W.bucket,J=await this.blob(Z,$);try{return(await J.getProperties()).contentLength??0}catch(Q){if(z4(Q))throw new d(Z);throw Q}}async delete(W){let Z=typeof W==="string"?W:W.name,$=typeof W==="string"?void 0:W.bucket,J=await this.blob(Z,$);try{await J.delete()}catch(Q){if(z4(Q))return;throw Q}}}async function a6(W){if(W.blobBody)return await W.blobBody;if(W.readableStreamBody)return s6.toWeb(W.readableStreamBody);return null}function t6(W){return W}class L4 extends Error{code="ERR_RATE_LIMITER_TIMEOUT";constructor(W){super(`RedisRateLimiter: Redis did not answer within ${W}ms.`);this.name="RedisRateLimiterTimeoutError"}}class V1 extends Error{code="ERR_RATE_LIMITER_DISCONNECTED";constructor(){super("RedisRateLimiter: the Redis client is not connected.");this.name="RedisRateLimiterDisconnectedError"}}var m0=1000,r6=60000,e6=`
2
+ import{db as E8}from"../chunk-8m9kgynj.js";import{Ab as H8,Bb as U8,Cb as O8,Db as S8,Eb as R8,Fb as T4,Gb as X6,Hb as C,Ib as _8,Jb as f8,Kb as C8,Lb as k8,Mb as b8,Nb as T8,Ob as P8,Pb as V8,Qb as I8,Rb as v8,Sb as q8,Tb as w8,Ub as y8,Vb as A8,Wb as h8,Xb as g8,eb as gZ,fb as EZ,gb as mZ,hb as cZ,ib as uZ,jb as f4,kb as pZ,lb as O4,mb as S4,nb as q1,ob as dZ,pb as lZ,qb as X8,ub as B8,vb as j8,wb as M8,xb as L8,yb as F8,zb as D8}from"../chunk-my8hz9k0.js";import{_b as k4}from"../chunk-y4bjsyt4.js";import{Ad as W8,Bd as Z8,Cd as $8,Dd as J8,Ed as Q8,Fd as Y8,Gd as K8,Hd as G8,Id as z8,td as nZ,ud as iZ,vd as sZ,wd as oZ,xd as aZ,yd as rZ,zd as eZ}from"../chunk-z2btwd27.js";import{Jd as tZ}from"../chunk-3tyqnh59.js";import{Kd as SZ,Ld as RZ,Md as _Z,Nd as fZ,Od as CZ,Pd as kZ,Qd as bZ,Rd as TZ,Sd as PZ,Td as VZ,Ud as IZ,Vd as vZ,Wd as qZ,Xd as wZ,Yd as yZ,Zd as AZ,ce as hZ}from"../chunk-nc1gstvq.js";import{de as N8,ee as x8}from"../chunk-z94ms1jv.js";import"../chunk-fv1r0w0r.js";import{Ae as j4,Be as M4,Bf as q5,Cf as z6,Df as w5,Dg as LZ,Fe as mW,Ge as cW,He as uW,Hf as y5,Ie as pW,If as A5,Ig as w1,Je as dW,Jf as g5,Ke as lW,Le as nW,Me as iW,Mf as E5,Ne as sW,Nf as m5,Oe as w0,Of as c5,Pe as oW,Pf as u5,Qe as aW,Re as tW,Rf as p5,Se as rW,Sf as d5,Te as eW,Tf as l5,Tg as NZ,Uf as n5,Ug as xZ,Vf as i5,Wf as s5,Xf as o5,Yf as a5,Zf as t5,_f as r5,dg as k,eg as i,fg as e5,gf as G5,gg as WZ,hf as z5,hg as ZZ,if as X5,ig as $Z,jf as B5,jg as JZ,kf as j5,lf as M5,lg as QZ,mg as YZ,ng as KZ,oe as Z6,og as GZ,pe as AW,pg as zZ,qe as hW,re as gW,rf as f5,sf as C5,sg as XZ,te as EW,tf as k5,tg as BZ,uf as b5,ug as jZ,vf as T5,wf as P5,xe as $6,xf as V5,ye as B4,yf as I5,ze as c0,zf as v5,zg as MZ}from"../chunk-6atxvmvj.js";import"../chunk-99be7vbh.js";import"../chunk-n3pc62tc.js";import{$h as U4,Di as Q5,Ei as Y5,Gi as K5,Ii as P1,Mh as X4,Nh as K4,Oh as M1,ci as t,ei as d,ii as G4,ji as L1,ki as T1,li as W5,mi as Z5,ni as $5,oi as J5}from"../chunk-s7tn2t8x.js";import"../chunk-kscwjycy.js";import{Si as r}from"../chunk-p4ka241x.js";import{$i as O5,_i as U5,aj as b1,bj as S5,cj as v0,dj as R5,ej as _5}from"../chunk-hkp00b9x.js";import{kj as F5,lj as D5,mj as H5}from"../chunk-70kpm72z.js";import"../chunk-1btx3kkv.js";import{Vj as h5}from"../chunk-egzfxdr1.js";import{Xj as L5,Yj as N5,Zj as x5}from"../chunk-rh811v1f.js";import"../chunk-wamxfhh6.js";import"../chunk-cd847h0t.js";import"../chunk-zh0knwen.js";import"../chunk-04ffq2ge.js";import{Pk as FZ,Qk as DZ,Rk as HZ,Sk as UZ,Uk as OZ}from"../chunk-h4h8m3yr.js";import"../chunk-pfjky33c.js";import{cl as w}from"../chunk-vqar6ysw.js";import"../chunk-mxhy19a9.js";import"../chunk-22jm6sn1.js";import"../chunk-yc2pnb1w.js";import"../chunk-7effp39a.js";import"../chunk-51fvpq55.js";import{Dl as A0}from"../chunk-wgre66wq.js";import{Buffer as y0}from"buffer";class h0 extends L1{client;config;constructor(...W){super();this.config=W}async connect(){let W=await import("../chunk-jry03jqj.js");return this.client??=new W.S3Client(...this.config),{sdk:W,client:this.client}}async put(W,{signal:Z}={}){Z?.throwIfAborted();let $,J,Q,Y=process.env.BUCKET_NAME;if(W instanceof Blob)$=W,Q=`${Bun.randomUUIDv7()}.${W.type.split("/")[1].split(";")[0]}`,J=W.type;else $=W.body,Q=W.name,Y=W.bucket??Y,J=W.contentType||($ instanceof Blob||$ instanceof File?$.type:void 0);J=J||void 0;let K=$ instanceof y0?$:$ instanceof Blob||$ instanceof File?y0.from(await $.arrayBuffer()):"",{sdk:G,client:X}=await this.connect();return Z?.throwIfAborted(),await X.send(new G.PutObjectCommand({Bucket:Y,Key:Q,Body:K,ContentType:J}),{abortSignal:Z}),Q}async delete(W){let Z=typeof W==="string"?W:W.name,$=(typeof W==="string"?void 0:W.bucket)??process.env.BUCKET_NAME;if(!Z)throw Error("Object name has to be specified");let{sdk:J,client:Q}=await this.connect();try{await Q.send(new J.DeleteObjectCommand({Bucket:$,Key:Z}))}catch(Y){if(Y?.name==="NoSuchKey"||Y?.$metadata?.httpStatusCode===404)return;throw Y}}async*pages(W,{bucket:Z,signal:$}){let{sdk:J,client:Q}=await this.connect(),Y;do{$?.throwIfAborted();let K=await Q.send(new J.ListObjectsV2Command({Bucket:Z??process.env.BUCKET_NAME,Prefix:W,ContinuationToken:Y}),{abortSignal:$});yield(K.Contents??[]).map((G)=>({name:G.Key,size:G.Size??0,lastModified:G.LastModified??new Date(0)})),Y=K.IsTruncated?K.NextContinuationToken:void 0}while(Y)}async*objects(W,Z={}){for await(let $ of this.pages(W,Z))yield*$}async deletePrefix(W,Z={}){G4(W);let $=Z.bucket??process.env.BUCKET_NAME,{sdk:J,client:Q}=await this.connect(),Y=0;for await(let K of this.pages(W,{...Z,bucket:$})){if(K.length===0)continue;Z.signal?.throwIfAborted();let X=(await Q.send(new J.DeleteObjectsCommand({Bucket:$,Delete:{Objects:K.map((z)=>({Key:z.name})),Quiet:!0}}),{abortSignal:Z.signal}))?.Errors??[];if(X.length>0){let z=X[0];throw Error(`S3 could not delete ${X.length} object(s) under "${W}", e.g. "${z.Key}": ${z.Code??"unknown"} ${z.Message??""}`.trim())}Y+=K.length}return Y}async list(W){let{sdk:Z,client:$}=await this.connect();return await $.send(new Z.ListObjectsV2Command({Bucket:process.env.BUCKET_NAME,Prefix:W}))}async fetch(W,{signal:Z}={}){Z?.throwIfAborted();let $=process.env.BUCKET_NAME,J;if(typeof W==="string")J=W;else $=W.bucket??$,J=W.name;if(!J)throw Error("Object name has to be specified");let{sdk:Q,client:Y}=await this.connect();Z?.throwIfAborted();let K=await Y.send(new Q.GetObjectCommand({Bucket:$,Key:J}),{abortSignal:Z}),G=T1(K.Body.transformToWebStream(),Z);return Z?.throwIfAborted(),new Response(G,{headers:{"Content-Type":K.ContentType,"Content-Length":K.ContentLength.toString(),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":K.LastModified?.toUTCString()||"",ETag:K.ETag||""}})}async read(W){let Z=typeof W==="string"?{name:W}:W,$=Z.bucket??process.env.BUCKET_NAME,{name:J,range:Q=null}=Z;if(!J)throw Error("Object name has to be specified");let{sdk:Y,client:K}=await this.connect(),G;try{G=await K.send(new Y.GetObjectCommand({Bucket:$,Key:J,Range:Q?K4(Q):void 0}))}catch(j){if(j?.name==="InvalidRange"||j?.$metadata?.httpStatusCode===416)throw new t(await this.size({name:J,bucket:$}));if(j?.name==="NoSuchKey"||j?.$metadata?.httpStatusCode===404)throw new d(J);throw j}let X=M1(G.ContentRange),z=Boolean(X)&&G.$metadata?.httpStatusCode===206,B=X?.total??G.ContentLength??0;return{body:G.Body.transformToWebStream(),start:X?.start??0,end:X?.end??B-1,total:B,partial:z,type:G.ContentType??"application/octet-stream",etag:G.ETag||void 0,lastModified:G.LastModified,name:J}}async size(W){let Z=typeof W==="string"?W:W.name,$=(typeof W==="string"?void 0:W.bucket)??process.env.BUCKET_NAME,{sdk:J,client:Q}=await this.connect();try{return(await Q.send(new J.HeadObjectCommand({Bucket:$,Key:Z}))).ContentLength??0}catch(Y){if(Y?.name==="NotFound"||Y?.$metadata?.httpStatusCode===404)throw new d(Z);throw Y}}}import{Buffer as g0}from"buffer";import{Readable as s6}from"stream";function z4(W){return W?.statusCode===404||W?.details?.errorCode==="BlobNotFound"||W?.code==="BlobNotFound"}function o6(W){return W?.statusCode===416||W?.details?.errorCode==="InvalidRange"||W?.code==="InvalidRange"}class E0 extends L1{config;serviceClientPromise=null;constructor(W={}){super();this.config=W}async serviceClient(){if(this.config.serviceClient)return this.config.serviceClient;return this.serviceClientPromise??=(async()=>{let W;try{W=await import("@azure/storage-blob")}catch{throw Error("AzureBlobDriver requires the '@azure/storage-blob' package. Install it with `bun add @azure/storage-blob`, or pass a pre-built `serviceClient`.")}let Z=this.config.connectionString??process.env.AZURE_STORAGE_CONNECTION_STRING;if(this.config.url)return new W.BlobServiceClient(this.config.url,this.config.credential);if(Z)return W.BlobServiceClient.fromConnectionString(Z);throw Error("AzureBlobDriver needs a connection string (AZURE_STORAGE_CONNECTION_STRING), a `url`, or a `serviceClient`.")})(),this.serviceClientPromise}async blob(W,Z){if(!W)throw Error("Object name has to be specified");let $=Z??this.config.container??process.env.BUCKET_NAME;if(!$)throw Error("AzureBlobDriver needs a container name, from `bucket`, the `container` config, or BUCKET_NAME.");return(await this.serviceClient()).getContainerClient($).getBlockBlobClient(W)}async put(W,{signal:Z}={}){Z?.throwIfAborted();let $,J,Q,Y;if(W instanceof Blob)$=W,Q=`${Bun.randomUUIDv7()}.${W.type.split("/")[1].split(";")[0]}`,J=W.type;else $=W.body,Q=W.name,Y=W.bucket,J=W.contentType??($ instanceof Blob||$ instanceof File?$.type:void 0);let K=$ instanceof g0?$:g0.from(await $.arrayBuffer()),G=await this.blob(Q,Y);return Z?.throwIfAborted(),await G.uploadData(K,{blobHTTPHeaders:J?{blobContentType:J}:void 0,abortSignal:Z}),Q}async*objects(W,{bucket:Z,signal:$}={}){$?.throwIfAborted();let J=Z??this.config.container??process.env.BUCKET_NAME;if(!J)throw Error("AzureBlobDriver needs a container name, from `bucket`, the `container` config, or BUCKET_NAME.");let Y=(await this.serviceClient()).getContainerClient(J);for await(let K of Y.listBlobsFlat({prefix:W}))$?.throwIfAborted(),yield{name:K.name,size:K.properties?.contentLength??0,lastModified:K.properties?.lastModified??new Date(0)}}async list(W){let Z=this.config.container??process.env.BUCKET_NAME,J=(await this.serviceClient()).getContainerClient(Z),Q=[];for await(let Y of J.listBlobsFlat({prefix:W}))Q.push(Y.name);return Q}async fetch(W,{signal:Z}={}){Z?.throwIfAborted();let $=await this.download(typeof W==="string"?{name:W}:{name:W.name,bucket:W.bucket},Z);return new Response($.body,{headers:{"Content-Type":$.type,"Content-Length":String($.total),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":$.lastModified?.toUTCString()??"",ETag:$.etag??""}})}async read(W){return this.download(typeof W==="string"?{name:W}:W)}async download(W,Z){let{name:$,bucket:J,range:Q=null}=W,Y=await this.blob($,J);Z?.throwIfAborted();let K,G,X=Q?.kind==="suffix"||Q?.kind==="offset"&&Q.end===null&&Q.start===0;if(Q&&X){let H=await this.size({name:$,bucket:J}),p=X4(Q,H);if(!p)throw new t(H);K=p.start,G=p.length}else if(Q?.kind==="offset")K=Q.start,G=Q.end===null?void 0:Q.end-Q.start+1;let z;try{z=await Y.download(K,G,Z?{abortSignal:Z}:void 0)}catch(H){if(o6(H))throw new t(await this.size({name:$,bucket:J}));if(z4(H))throw new d($);throw H}let B=M1(z.contentRange),j=Boolean(B),x=B?.total??z.contentLength??0,O=await a6(z);if(O instanceof ReadableStream)O=T1(O,Z);return Z?.throwIfAborted(),{body:O,start:B?.start??0,end:B?.end??x-1,total:x,partial:j,type:z.contentType??"application/octet-stream",etag:z.etag||void 0,lastModified:z.lastModified,name:$}}async size(W){let Z=typeof W==="string"?W:W.name,$=typeof W==="string"?void 0:W.bucket,J=await this.blob(Z,$);try{return(await J.getProperties()).contentLength??0}catch(Q){if(z4(Q))throw new d(Z);throw Q}}async delete(W){let Z=typeof W==="string"?W:W.name,$=typeof W==="string"?void 0:W.bucket,J=await this.blob(Z,$);try{await J.delete()}catch(Q){if(z4(Q))return;throw Q}}}async function a6(W){if(W.blobBody)return await W.blobBody;if(W.readableStreamBody)return s6.toWeb(W.readableStreamBody);return null}function t6(W){return W}class L4 extends Error{code="ERR_RATE_LIMITER_TIMEOUT";constructor(W){super(`RedisRateLimiter: Redis did not answer within ${W}ms.`);this.name="RedisRateLimiterTimeoutError"}}class V1 extends Error{code="ERR_RATE_LIMITER_DISCONNECTED";constructor(){super("RedisRateLimiter: the Redis client is not connected.");this.name="RedisRateLimiterDisconnectedError"}}var m0=1000,r6=60000,e6=`
3
3
  local currentKey = KEYS[1]
4
4
  local previousKey = KEYS[2]
5
5
  local limit = tonumber(ARGV[1])
@@ -72,6 +72,8 @@ export declare class ViewRouteDispatcher {
72
72
  readonly localeRouting: LocaleRouting;
73
73
  /** See `ViewRouteConfig.theme`. */
74
74
  readonly theme: ThemeConfig | false;
75
+ /** See `ViewRouteConfig.meta`. */
76
+ readonly defaultMeta: ViewRouteConfig["meta"];
75
77
  /**
76
78
  * `auth` is the app's `auth` config: gemi's `/auth` view routes are mounted
77
79
  * for the features it turns on (#1040).
@@ -1 +1 @@
1
- {"version":3,"file":"ViewRouteDispatcher.d.ts","sourceRoot":"","sources":["../../../services/router/ViewRouteDispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAE,KAAK,cAAc,EAAmC,MAAM,2BAA2B,CAAC;AAEjG,OAAO,EAEL,KAAK,cAAc,EAEpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,eAAe,EACrB,MAAM,UAAU,CAAC;AAWlB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAUxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAiBpD,OAAO,EAIL,KAAK,cAAc,EAEpB,MAAM,kBAAkB,CAAC;AA4G1B;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAE/C;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,MAAM,EAAE,QAY9D;AAaD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAA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AAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACtC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC3B;;;;WAIG;QACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAClC;;;;;;;;;;;WAWG;QACH,WAAW,CAAC,EAAE;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,EAAE,CAAA;SAAE,CAAC;QACpD;;;WAGG;QACH,qBAAqB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACjD;;;;WAIG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,wEAAwE;QACxE,aAAa,CAAC,EAAE,cAAc,CAAC;QAC/B;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB;CA0+BJ"}
@@ -1,5 +1,6 @@
1
1
  import type { JSX } from "react";
2
2
  import type { HttpRequest } from "../../http/HttpRequest";
3
+ import type { DefaultViewMeta } from "../../http/Metadata";
3
4
  import type { ApiRouter } from "../../http/ApiRouter";
4
5
  import type { ChannelRouterClass } from "../../http/ChannelRouter";
5
6
  import type { McpRouter } from "../../http/McpRouter";
@@ -84,6 +85,19 @@ export interface ViewRouteConfig {
84
85
  onNotFound?: (req: HttpRequest, info: {
85
86
  status: number;
86
87
  }) => void | Promise<void>;
88
+ /**
89
+ * The app-wide default title, description and Open Graph tags (#1042), for
90
+ * a view whose handlers set none: a view with no handler, one whose handler
91
+ * never calls `Meta.title`, and the `404` view when `onNotFound` sets none.
92
+ * Without it such a page is titled `"Gemi App"`.
93
+ *
94
+ * Field by field: a handler's `Meta.title` keeps its title and the page
95
+ * still gets this `description` and `openGraph`. A function runs per
96
+ * request after the handlers (and `onNotFound`), so it can read the
97
+ * request and the locale, e.g. for a translated default. A `route.domains`
98
+ * group's `view` inherits it or sets its own.
99
+ */
100
+ meta?: DefaultViewMeta | ((req: HttpRequest) => DefaultViewMeta | Promise<DefaultViewMeta>);
87
101
  onRequestStart?: (req: HttpRequest) => void | Promise<void>;
88
102
  onRequestEnd?: (req: HttpRequest) => void | Promise<void>;
89
103
  onRequestFail?: (req: HttpRequest, error: any) => void | Promise<void>;
@@ -263,5 +277,5 @@ export interface RouteConfig {
263
277
  }
264
278
  export declare function defineRouteConfig(config: RouteConfig): RouteConfig;
265
279
  export declare function apiRouteConfigDefaults(): Omit<Required<ApiRouteConfig>, "rootRouter">;
266
- export declare function viewRouteConfigDefaults(): Omit<Required<ViewRouteConfig>, "root" | "rootRouter">;
280
+ export declare function viewRouteConfigDefaults(): Omit<Required<ViewRouteConfig>, "root" | "rootRouter" | "meta">;
267
281
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../services/router/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGxD,MAAM,WAAW,cAAc;IAI7B,UAAU,EAAE,OAAO,SAAS,CAAC;IAE7B,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IA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AA;KAAE,CAAC;CAC5C;AAID,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;;;;;;OAUG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,gBAAgB,CAAC;IAExC,MAAM,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAE7B,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAE5B;;;;;;;;;;;;;OAaG;IACH,GAAG,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC1B;AAGD,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,cAAc,CAAC;IACpB,IAAI,EAAE,eAAe,CAAC;IACtB,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,kBAAkB,CAAC;CAC/B;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAElE;AAGD,wBAAgB,sBAAsB,IAAI,IAAI,CAC5C,QAAQ,CAAC,cAAc,CAAC,EACxB,YAAY,CACb,CAMA;AAED,wBAAgB,uBAAuB,IAAI,IAAI,CAC7C,QAAQ,CAAC,eAAe,CAAC,EACzB,MAAM,GAAG,YAAY,GAAG,MAAM,CAC/B,CAWA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemi",
3
- "version": "0.161.0",
3
+ "version": "0.163.0",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "Enes Tufekci <enes@gemijs.dev>",
@@ -1,5 +0,0 @@
1
- // @bun
2
- function v(j){return Object.freeze({name:j})}class T extends Error{key;constructor(j){super(`Request state "${j.name}" is not set. Check that whatever sets it (a middleware, \`context()\`) ran for this request.`);this.key=j;this.name="MissingRequestStateError"}}class K{#j=new Map;get(j){return this.#j.get(j)}require(j){if(!this.#j.has(j))throw new T(j);return this.#j.get(j)}set(j,J){return this.#j.set(j,J),J}has(j){return this.#j.has(j)}delete(j){return this.#j.delete(j)}static carry(j,J){for(let[Q,V]of j.#j)if(!J.#j.has(Q))J.#j.set(Q,V)}}function P(){for(let j of["HOST_NAME","APP_URL"]){let J=process.env[j]?.trim().replace(/\/+$/,"");if(J)return J}return}function g(j){let J=P(),Q=J===void 0?"fallback":J===process.env.HOST_NAME?.trim().replace(/\/+$/,"")?"HOST_NAME":"APP_URL",V=J??j?.trim().replace(/\/+$/,"");if(!V)throw Error("The app's public origin is not configured: set HOST_NAME (or APP_URL), e.g. HOST_NAME=https://example.com.");let $=URL.canParse(V)?new URL(V).protocol:null;if($!=="http:"&&$!=="https:")throw Error(`The app's public origin from ${Q} (${JSON.stringify(V)}) is not an absolute http(s) URL, e.g. https://example.com.`);return V}import{AsyncLocalStorage as y}from"async_hooks";var C=new Set(["woff2","woff","truetype","opentype","collection","embedded-opentype","svg"]),S={woff2:"woff2",woff:"woff",ttf:"truetype",otf:"opentype",ttc:"collection",eot:"embedded-opentype",svg:"svg"};var I=new Set(["auto","block","swap","fallback","optional"]),w=/^[a-zA-Z0-9.%+\- ]+$/,R=/^[uU]\+[0-9a-fA-F?]{1,6}(-[0-9a-fA-F]{1,6})?(\s*,\s*[uU]\+[0-9a-fA-F?]{1,6}(-[0-9a-fA-F]{1,6})?)*$/;function G(j){throw TypeError(`Meta.fonts: ${j}`)}function q(j){let J=(j.split(/[?#]/)[0]??"").split("/").pop()??"",Q=J.lastIndexOf(".");return Q===-1?null:S[J.slice(Q+1).toLowerCase()]??null}function U(j,J){if(J===void 0||J===null)return null;let Q=String(J).trim();if(!Q||!w.test(Q))G(`${j} ${JSON.stringify(J)} is not a valid font-${j} value`);return Q}function W(j){if(!Array.isArray(j))G("expected an array of fonts");return j.map((J)=>{if(typeof J?.family!=="string"||!J.family.trim())G("every font needs a family");let Q=typeof J.src==="string"?[{url:J.src}]:J.src;if(!Array.isArray(Q)||Q.length===0)G(`font "${J.family}" needs a src`);let V=Q.map((Z)=>{if(typeof Z?.url!=="string"||!Z.url.trim())G(`font "${J.family}" has a source without a url`);if(Z.format!==void 0&&!C.has(Z.format))G(`font "${J.family}" has an unknown format ${JSON.stringify(Z.format)}`);return{url:Z.url.trim(),format:Z.format??q(Z.url)}}),$=J.display??"swap";if(!I.has($))G(`display ${JSON.stringify($)} is not a valid font-display value`);let X=J.unicodeRange?.trim()||null;if(X&&!R.test(X))G(`unicodeRange ${JSON.stringify(J.unicodeRange)} is not a valid unicode-range`);return{family:J.family.trim(),src:V,weight:U("weight",J.weight),style:U("style",J.style),stretch:U("stretch",J.stretch),display:$,unicodeRange:X,preload:J.preload===!0}})}class Y{content={title:"Gemi App",description:null,openGraph:null,htmlAttributes:null,canonical:null,alternates:null,fonts:null,robots:null};touched=!1;render(){return{title:this.content.title,description:this.content.description,openGraph:this.content.openGraph,htmlAttributes:this.content.htmlAttributes,canonical:this.content.canonical,alternates:this.content.alternates,fonts:this.content.fonts,robots:this.content.robots}}htmlAttributes(j){this.touched=!0;let J=Object.fromEntries(Object.entries(j).filter(([,Q])=>Q!==void 0));this.content.htmlAttributes={...this.content.htmlAttributes,...J}}canonical(j){this.touched=!0,this.content.canonical=j}robots(j){this.touched=!0,this.content.robots=j}alternates(j){this.touched=!0,this.content.alternates=j}fonts(j){let J=W(j);this.touched=!0,this.content.fonts=[...this.content.fonts??[],...J]}title(j){this.touched=!0,this.content.title=j}description(j){this.touched=!0,this.content.description=j}openGraph({title:j,description:J,type:Q,url:V,image:$,imageAlt:X,imageWidth:Z,imageHeight:D,twitterImage:H=$,twitterImageAlt:E=X,twitterImageWidth:b=Z,twitterImageHeight:x=D,twitterCard:A=H?"summary_large_image":"summary"}){this.touched=!0;let N=(z)=>z&&!z.startsWith("http")?`${P()}${z}`:z;this.content.openGraph=Object.fromEntries(Object.entries({title:j,description:J,type:Q,url:V,image:N($),imageAlt:X,imageWidth:Z,imageHeight:D,twitterImage:N(H),twitterImageAlt:E,twitterImageWidth:b,twitterImageHeight:x,twitterCard:A}).filter(([z,O])=>O!==void 0))}}function F(j,J,Q={}){return[`${j}=${J}`,Q.maxAge?`Max-Age=${Q.maxAge}`:"",Q.httpOnly?"HttpOnly":"",Q.secure?"Secure":"",Q.sameSite?`SameSite=${Q.sameSite}`:"SameSite=Strict",Q.path?`Path=${Q.path}`:"Path=/",Q.domain?`Domain=${Q.domain}`:"",Q.expires?`Expires=${Q.expires.toUTCString()}`:"",Q.partitioned?"Partitioned":""].filter((V)=>V!=="").join("; ")}var B=new y;class M{req;cookies=new Set;headers=new Headers;serverQueries=null;user=null;csrfHmac=null;locale=null;metadata=new Y;rangeRequest=null;sessionId=null;featureEvaluations=null;featureContext=null;featureBuckets=null;pendingWork=new Set;ended=!1;constructor(j){this.req=j}waitUntil(j){if(this.ended)return;let J=Promise.resolve(j).then(()=>{},()=>{});this.pendingWork.add(J),J.then(()=>this.pendingWork.delete(J))}hasPendingWork(){return this.pendingWork.size>0}async whenIdle(){while(this.pendingWork.size>0)await Promise.all(Array.from(this.pendingWork))}setLocale(j){this.locale=j}renderMeta(){return this.metadata.render()}setCSRFHmac(j){this.csrfHmac=j}setCookie(j,J,Q={}){this.cookies.add(F(j,J,Q))}deleteCookie(j,J={}){this.cookies.add(F(j,"",{...J,maxAge:-1}))}setHeaders(j,J){this.headers.set(j,J)}setUser(j){this.user=j}setRequest(j){this.req=j}destroy(){this.ended=!0,delete this.cookies,delete this.headers,this.serverQueries=null,this.sessionId=null,this.featureEvaluations=null,this.featureContext=null,this.featureBuckets=null,delete this.user}}var _="session_id";function k(){let j=L.getStore();if(!j)return null;if(j.sessionId)return j.sessionId;let J=j.req?.cookies?.get(_);if(J)j.sessionId=J;return j.sessionId}function a(){let j=L.getStore();if(!j)return null;let J=k();if(J)return J;let Q=Bun.randomUUIDv7();return j.sessionId=Q,j.setCookie(_,Q,{httpOnly:!0,secure:Bun.env.NODE_ENV==="production",sameSite:"Lax",expires:new Date(Date.now()+31536000000)}),Q}class L{static getStore(){return B.getStore()}static setRequest(j){B.getStore().req=j}static run(j,J,Q){let V=new M(j);if(Q){if(V.user=Q.user,Q.state&&j.state)K.carry(Q.state,j.state)}return B.run(V,J)}static runWith(j,J){return B.run(j,J)}static exit(j){return B.exit(j)}}
3
- export{P as Si,g as Ti,v as Ui,T as Vi,K as Wi,k as Xi,a as Yi,L as Zi};
4
-
5
- //# debugId=40C08A3AB39E76ED64756E2164756E21