@kyro-cms/core 0.12.71 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +150 -76
- package/dist/{WebhookService-DQyM9fVo.d.ts → WebhookService-BLi5Rz2m.d.ts} +1 -1
- package/dist/{WebhookService-bo1NrgBW.d.cts → WebhookService-BOJMgjBm.d.cts} +1 -1
- package/dist/WebhookService-BcuD8tnn.d.cts +143 -0
- package/dist/WebhookService-CFe6Zd0_.d.cts +143 -0
- package/dist/WebhookService-CGxHtw7E.d.cts +143 -0
- package/dist/WebhookService-CNC1lYz7.d.ts +143 -0
- package/dist/WebhookService-CVXmjbtQ.d.cts +143 -0
- package/dist/WebhookService-D5PSI5t6.d.cts +143 -0
- package/dist/WebhookService-DPCCn_12.d.ts +143 -0
- package/dist/WebhookService-Dk1lzSrG.d.cts +143 -0
- package/dist/WebhookService-Dncnbgm9.d.cts +143 -0
- package/dist/WebhookService-I6hdue2Y.d.ts +143 -0
- package/dist/WebhookService-KnQ2UDlW.d.ts +143 -0
- package/dist/WebhookService-UY5p89Bj.d.ts +143 -0
- package/dist/WebhookService-YZXBCRXA.d.ts +143 -0
- package/dist/WebhookService-fk0FGRlk.d.ts +143 -0
- package/dist/WebhookService-vsFnWrOh.d.ts +143 -0
- package/dist/WebhookService-zrDmAx7L.d.cts +143 -0
- package/dist/api-handler-graphql.cjs +1 -1
- package/dist/api-handler-graphql.js +1 -1
- package/dist/api-handler-trpc.cjs +1 -1
- package/dist/api-handler-trpc.js +1 -1
- package/dist/api-handler.cjs +1 -1
- package/dist/api-handler.js +1 -1
- package/dist/{base-urWvrsX8.d.cts → base-B--L0lCn.d.cts} +1 -1
- package/dist/base-B-i-tjm1.d.ts +218 -0
- package/dist/base-B-siit_y.d.cts +218 -0
- package/dist/base-B8SyZI4D.d.ts +218 -0
- package/dist/base-BCgFt3Yx.d.ts +218 -0
- package/dist/base-BHRGJ40F.d.cts +218 -0
- package/dist/base-BVoDPNjJ.d.cts +218 -0
- package/dist/base-BaOJ5uWd.d.cts +218 -0
- package/dist/base-BfPaVEAE.d.cts +218 -0
- package/dist/base-BxrX5EPU.d.cts +218 -0
- package/dist/base-CAb9EYQs.d.ts +218 -0
- package/dist/base-CcZIEll-.d.ts +218 -0
- package/dist/base-CyG7aF1e.d.cts +218 -0
- package/dist/{base-BcfNgOqZ.d.ts → base-DOImeJ-F.d.ts} +1 -1
- package/dist/base-DbnwE42-.d.cts +218 -0
- package/dist/base-NyiSsD-n.d.ts +218 -0
- package/dist/base-OYfoYPYP.d.ts +218 -0
- package/dist/base-xflndGDO.d.ts +218 -0
- package/dist/bootstrap-QQ6D3OYG.js +1 -0
- package/dist/bootstrap-QVKSKXJF.cjs +1 -0
- package/dist/bootstrap-RILR44UM.cjs +1 -0
- package/dist/bootstrap-ZRRUPRUR.js +1 -0
- package/dist/chunk-262YP5XA.cjs +1 -0
- package/dist/chunk-2FSOHXOU.cjs +56 -0
- package/dist/chunk-2OS5Y4LE.cjs +1 -0
- package/dist/chunk-2PXXQKN3.cjs +3 -0
- package/dist/{chunk-K6ZW5M6S.cjs → chunk-355R4LS5.cjs} +3 -3
- package/dist/chunk-35IVNLMA.js +122 -0
- package/dist/{chunk-FSWDDVLA.js → chunk-3GXLOYM3.js} +1 -1
- package/dist/chunk-3KZXF4US.js +2 -0
- package/dist/{chunk-H7PC2ENZ.cjs → chunk-3LAWUINR.cjs} +1 -1
- package/dist/chunk-3O3AVMWM.cjs +1 -0
- package/dist/chunk-3U6MKWET.cjs +120 -0
- package/dist/chunk-4BMWWGJN.js +384 -0
- package/dist/chunk-5A7E7N4B.cjs +431 -0
- package/dist/chunk-6DD4J7LI.js +2 -0
- package/dist/chunk-6GGPY7U2.js +4 -0
- package/dist/chunk-6MNLRAKM.cjs +121 -0
- package/dist/chunk-6NBZDW53.js +133 -0
- package/dist/{chunk-2HATK4C5.js → chunk-73Y63IPP.js} +4 -4
- package/dist/chunk-7K6ZUNJM.js +4 -0
- package/dist/chunk-7NKNSRCB.cjs +448 -0
- package/dist/chunk-A3IOQOV6.js +2 -0
- package/dist/chunk-A3XVL6ED.cjs +3 -0
- package/dist/{chunk-LKQHIOPW.cjs → chunk-APDQ6ZTG.cjs} +1 -1
- package/dist/chunk-ATI2UZ7U.js +2 -0
- package/dist/chunk-B4AC23SG.js +122 -0
- package/dist/chunk-BD6XHMMM.cjs +2 -0
- package/dist/chunk-CH4TZZI5.js +449 -0
- package/dist/{chunk-26KFM3P6.js → chunk-CNHUCCQJ.js} +1 -1
- package/dist/chunk-CRP6PSCE.js +2 -0
- package/dist/chunk-DI6TCZSE.js +122 -0
- package/dist/chunk-DORUYZQV.cjs +1 -0
- package/dist/chunk-E4H3ZZ7U.js +4 -0
- package/dist/chunk-EFKEVWAD.js +4 -0
- package/dist/chunk-EI7FRSNY.js +57 -0
- package/dist/chunk-EON4XLKQ.cjs +1 -0
- package/dist/chunk-EUQAOYEO.cjs +121 -0
- package/dist/chunk-EVAUBT7H.js +57 -0
- package/dist/chunk-EYHD7HZE.cjs +1 -0
- package/dist/chunk-EYYIPA5N.js +432 -0
- package/dist/chunk-F2O4QO5N.cjs +383 -0
- package/dist/chunk-FBWLSWZ4.js +122 -0
- package/dist/chunk-FDKU7HJX.js +2 -0
- package/dist/chunk-FGN6IMPY.cjs +3 -0
- package/dist/chunk-FK2BG4HU.js +3 -0
- package/dist/chunk-GV2IB4WQ.cjs +56 -0
- package/dist/chunk-GWIZT2P5.js +57 -0
- package/dist/chunk-H3FJ54KB.cjs +121 -0
- package/dist/chunk-HY3EAWB2.js +4 -0
- package/dist/chunk-I6UJVO2P.js +57 -0
- package/dist/chunk-IQSF6XRV.js +57 -0
- package/dist/chunk-IXGDTAES.js +4 -0
- package/dist/chunk-JA44K75G.js +2 -0
- package/dist/chunk-JZ7Z6WC2.cjs +3 -0
- package/dist/chunk-K5XGP57D.cjs +19 -0
- package/dist/chunk-KEITOXIP.js +2 -0
- package/dist/chunk-LPFRMQFQ.js +121 -0
- package/dist/chunk-LYU44UNN.cjs +56 -0
- package/dist/chunk-MDLJTZLV.cjs +1 -0
- package/dist/chunk-MFNN5DYG.cjs +1 -0
- package/dist/chunk-MJAODEFC.cjs +121 -0
- package/dist/chunk-MYHNTJLR.cjs +56 -0
- package/dist/chunk-N2YHO2WI.cjs +3 -0
- package/dist/chunk-N4FXLQE3.cjs +132 -0
- package/dist/chunk-NPBXLPOP.js +3 -0
- package/dist/chunk-ON5XJEPO.cjs +3 -0
- package/dist/chunk-OT2Z4XBD.cjs +1 -0
- package/dist/chunk-PFTBTWSC.cjs +1 -0
- package/dist/chunk-PTPVFLET.js +20 -0
- package/dist/chunk-PZDLPRJF.js +4 -0
- package/dist/chunk-Q5TFO66G.cjs +1 -0
- package/dist/chunk-QUTYCUST.js +4 -0
- package/dist/chunk-REKKBAQX.cjs +56 -0
- package/dist/chunk-REQ622YC.js +3 -0
- package/dist/chunk-RTNQP6BV.js +2 -0
- package/dist/chunk-RUJW47ZJ.js +2 -0
- package/dist/chunk-RXYCFZJC.cjs +121 -0
- package/dist/chunk-RYHOWZLK.js +2 -0
- package/dist/chunk-S2MZNEBQ.cjs +1 -0
- package/dist/chunk-S73YERS2.js +57 -0
- package/dist/chunk-SBNMXQNO.cjs +2 -0
- package/dist/chunk-SMQ6736Y.js +57 -0
- package/dist/chunk-T3DJ3UTP.cjs +121 -0
- package/dist/chunk-TJZO7ZSX.cjs +3 -0
- package/dist/chunk-TKUNRCRH.js +4 -0
- package/dist/chunk-TQLCOMKC.js +4 -0
- package/dist/chunk-TRXYDWGE.cjs +1 -0
- package/dist/chunk-TS55CUNJ.js +57 -0
- package/dist/chunk-UFBJ3WOZ.js +2 -0
- package/dist/chunk-UQRVQUVR.js +2 -0
- package/dist/chunk-UW5W35NP.js +122 -0
- package/dist/chunk-VI7WCO2J.cjs +3 -0
- package/dist/chunk-W2GPP6RB.js +122 -0
- package/dist/chunk-WHOA7YJU.cjs +1 -0
- package/dist/chunk-WNRUPL26.js +2 -0
- package/dist/chunk-WXT2XW7T.js +13 -0
- package/dist/chunk-XFYSADHV.cjs +2 -0
- package/dist/chunk-XIAJQLGS.js +2 -0
- package/dist/chunk-XK6UB77Q.js +4 -0
- package/dist/chunk-Y2VHO66Q.cjs +3 -0
- package/dist/chunk-Y5O2OD7J.cjs +3 -0
- package/dist/chunk-YARB43JG.cjs +56 -0
- package/dist/chunk-YLCEMVYY.cjs +56 -0
- package/dist/chunk-YSOM57GK.cjs +3 -0
- package/dist/chunk-Z3UVDGYS.cjs +56 -0
- package/dist/chunk-ZTLGK6R4.cjs +12 -0
- package/dist/chunk-ZUBJ6RLQ.cjs +1 -0
- package/dist/cli/index.cjs +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/client.cjs +10 -10
- package/dist/client.d.cts +1265 -0
- package/dist/client.d.ts +1265 -0
- package/dist/client.js +10 -10
- package/dist/drizzle/index.cjs +1 -1
- package/dist/drizzle/index.d.cts +3 -3
- package/dist/drizzle/index.d.ts +3 -3
- package/dist/drizzle/index.js +1 -1
- package/dist/fields/index.cjs +1 -1
- package/dist/fields/index.d.cts +2 -2
- package/dist/fields/index.d.ts +2 -2
- package/dist/fields/index.js +1 -1
- package/dist/graphql/index.d.cts +3 -3
- package/dist/graphql/index.d.ts +3 -3
- package/dist/index-8Ino7vKq.d.ts +105 -0
- package/dist/{index-d1m_oup7.d.cts → index-B9BFNOHd.d.cts} +1 -1
- package/dist/index-BMcYFpTv.d.cts +105 -0
- package/dist/index-BttsFZDa.d.ts +105 -0
- package/dist/index-ByOM1Y5x.d.ts +105 -0
- package/dist/index-C6xmtRio.d.cts +105 -0
- package/dist/index-CTI3K_uq.d.cts +105 -0
- package/dist/index-CTL4zv_u.d.ts +105 -0
- package/dist/index-CaDbioSg.d.ts +105 -0
- package/dist/index-CxA9uOv0.d.ts +105 -0
- package/dist/{index-4cH-BjtP.d.ts → index-D6AXbuPI.d.ts} +1 -1
- package/dist/index-DF0KDBaM.d.cts +105 -0
- package/dist/index-DG4Xu7gA.d.cts +105 -0
- package/dist/index-DS3DpJli.d.cts +105 -0
- package/dist/index-NGnJpSgf.d.ts +105 -0
- package/dist/index-Zrg3sZ6R.d.cts +105 -0
- package/dist/index-eHex8Iwj.d.ts +105 -0
- package/dist/index-rm7uyOK1.d.cts +105 -0
- package/dist/index.cjs +32 -32
- package/dist/index.d.cts +73 -11
- package/dist/index.d.ts +73 -11
- package/dist/index.js +32 -32
- package/dist/lib-A2D63VXD.cjs +1 -0
- package/dist/lib-JQD2JAOO.js +2 -0
- package/dist/local-KR3AIGVA.cjs +1 -0
- package/dist/local-T7GISZBL.js +1 -0
- package/dist/mongo-auth-adapter-GR2CFFEA.js +1 -0
- package/dist/mongo-auth-adapter-UOO2LZUJ.cjs +1 -0
- package/dist/mongodb/index.cjs +1 -1
- package/dist/mongodb/index.d.cts +4 -3
- package/dist/mongodb/index.d.ts +4 -3
- package/dist/mongodb/index.js +1 -1
- package/dist/nodemailer-transport-3VWVUBM5.cjs +1 -0
- package/dist/nodemailer-transport-7RHATUKL.js +1 -0
- package/dist/nodemailer-transport-CHO2WKIY.js +1 -0
- package/dist/nodemailer-transport-ED2IXNGW.cjs +1 -0
- package/dist/rest/index.cjs +1 -1
- package/dist/rest/index.d.cts +4 -4
- package/dist/rest/index.d.ts +4 -4
- package/dist/rest/index.js +1 -1
- package/dist/templates/index.cjs +1 -1
- package/dist/templates/index.d.cts +2 -2
- package/dist/templates/index.d.ts +2 -2
- package/dist/templates/index.js +1 -1
- package/dist/trpc/index.cjs +1 -1
- package/dist/trpc/index.d.cts +3 -3
- package/dist/trpc/index.d.ts +3 -3
- package/dist/trpc/index.js +1 -1
- package/dist/types-6ShQp2EM.d.cts +839 -0
- package/dist/types-B5Qz1svz.d.cts +822 -0
- package/dist/types-B9oXBEKI.d.cts +330 -0
- package/dist/types-B9oXBEKI.d.ts +330 -0
- package/dist/types-BCOhfwHC.d.ts +839 -0
- package/dist/types-BRDBNacn.d.ts +839 -0
- package/dist/types-Bii0bhUV.d.cts +329 -0
- package/dist/types-Bii0bhUV.d.ts +329 -0
- package/dist/{types-BADIMVGF.d.ts → types-Bt2_ycUO.d.ts} +36 -1
- package/dist/types-C4wXHImf.d.ts +822 -0
- package/dist/types-C8yIAV6K.d.cts +839 -0
- package/dist/types-CORUQhY-.d.ts +839 -0
- package/dist/types-Cdssrcbz.d.cts +839 -0
- package/dist/types-CjGqxBd3.d.cts +330 -0
- package/dist/types-CjGqxBd3.d.ts +330 -0
- package/dist/types-DBGR-eQl.d.cts +839 -0
- package/dist/types-DCWgPFmi.d.cts +822 -0
- package/dist/types-DROqAsr0.d.cts +330 -0
- package/dist/types-DROqAsr0.d.ts +330 -0
- package/dist/{types-YAVR0H9Z.d.cts → types-DsF64Wrc.d.cts} +36 -1
- package/dist/types-DxaK39ix.d.cts +330 -0
- package/dist/types-DxaK39ix.d.ts +330 -0
- package/dist/types-IeKFn7Ky.d.ts +839 -0
- package/dist/types-QglJ7PwT.d.cts +839 -0
- package/dist/types-ZrjEVWfi.d.ts +811 -0
- package/dist/types-dEy5JxvN.d.ts +822 -0
- package/dist/types-tVJc9YbX.d.cts +811 -0
- package/dist/types-zt5qIvje.d.ts +839 -0
- package/dist/ws/index.cjs +1 -1
- package/dist/ws/index.d.cts +121 -1
- package/dist/ws/index.d.ts +121 -1
- package/dist/ws/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-5M3FKE2V.js +0 -2
- package/dist/chunk-WCFHS7EZ.cjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a as a$3}from'./chunk-LWM4WABU.js';import {a as a$2}from'./chunk-D6SDGHY6.js';import {a as a$5,i as i$1}from'./chunk-4ZWLNGLS.js';import {r as r$1,p as p$1,n as n$1,c as c$2,q as q$1,o as o$1,J as J$1,b as b$4,a as a$6,F as F$2,D as D$1,C as C$1,e as e$
|
|
1
|
+
import {a as a$3}from'./chunk-LWM4WABU.js';import {a as a$2}from'./chunk-D6SDGHY6.js';import {a as a$5,i as i$1}from'./chunk-4ZWLNGLS.js';import {r as r$1,p as p$1,n as n$1,c as c$2,q as q$1,o as o$1,J as J$1,b as b$4,a as a$6,F as F$2,D as D$1,C as C$1,e as e$4,H as H$2,x as x$1,d as d$3,y as y$2,k as k$1,f as f$3,A as A$2,j as j$1,z as z$2,u as u$1,v as v$1,w as w$1,g as g$3,E as E$1,B as B$2,t as t$1,s as s$1,m as m$1,i as i$2,l as l$1,h as h$1}from'./chunk-X473JI7Z.js';import {wa as wa$1,a as a$1,ua as ua$1,Aa as Aa$1,ra as ra$1,Da as Da$1,Na as Na$1,qa as qa$1,ka as ka$1,za as za$1,i,Ga as Ga$1,Ea as Ea$1,f as f$1,Ma as Ma$1,Qa as Qa$1,Ra as Ra$1,Sa as Sa$1,Oa as Oa$1,Ta as Ta$1,Ua as Ua$1,b as b$1,ya as ya$1,la as la$1,Pa as Pa$1,sa as sa$1,va as va$1,La as La$1,ma as ma$1,Fa as Fa$1,k,Ja as Ja$1,Ia as Ia$1,ha as ha$1,t,s,u,r,Ca as Ca$1,ja,d as d$1,j,Ha as Ha$1,Ka as Ka$1,Ba as Ba$1,h,w,pa as pa$1,ga as ga$1,Va as Va$1,oa as oa$1,na as na$1,xa as xa$1,ta as ta$1,m,I,G as G$1,L,D,v,O,Y,C,x,R,P,fa as fa$1,X,ea as ea$1,c as c$1,Z,K,y as y$1,_,E,H as H$1,W,ba as ba$1,Q as Q$1,U,T,e,N as N$1,S,ia as ia$1,g as g$1,V,M,$,B as B$1,aa as aa$1,da as da$1,A as A$1,z as z$1,J,F as F$1,n,q,Wa as Wa$1,o,l,p,ca as ca$1,Xa as Xa$1,Ya as Ya$1,$a as $a$1,ib}from'./chunk-35IVNLMA.js';import {n as n$2,e as e$2,f as f$2}from'./chunk-AWQGDMOE.js';import {a as a$4,b as b$3,c as c$4,d as d$2}from'./chunk-GQGFNTDZ.js';import {b as b$2,e as e$3}from'./chunk-KEITOXIP.js';import {c as c$3}from'./chunk-FUFS65Q5.js';import {g as g$2}from'./chunk-47CXBWMA.js';import {c,g,b,d,a,f,e as e$1}from'./chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
2
|
var _s=c((_w,ja)=>{g();function jp(){return Object.keys(globalThis).some(t=>t.startsWith("__NEXT"))}ja.exports=function(){return !!(globalThis.Deno||globalThis.Bun||jp())};});function qa(t,e){return (e?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(t)}function vs(t,e=false){let r=[],n=0;for(;n<t.length;){let s=t[n],i=F(function(o){if(!e)throw new TypeError(o);r.push({type:"INVALID_CHAR",index:n,value:t[n++]});},"ErrorOrInvalid");if(s==="*"){r.push({type:"ASTERISK",index:n,value:t[n++]});continue}if(s==="+"||s==="?"){r.push({type:"OTHER_MODIFIER",index:n,value:t[n++]});continue}if(s==="\\"){r.push({type:"ESCAPED_CHAR",index:n++,value:t[n++]});continue}if(s==="{"){r.push({type:"OPEN",index:n,value:t[n++]});continue}if(s==="}"){r.push({type:"CLOSE",index:n,value:t[n++]});continue}if(s===":"){let o="",a=n+1;for(;a<t.length;){let l=t.substr(a,1);if(a===n+1&&Up.test(l)||a!==n+1&&Bp.test(l)){o+=t[a++];continue}break}if(!o){i(`Missing parameter name at ${n}`);continue}r.push({type:"NAME",index:n,value:o}),n=a;continue}if(s==="("){let o=1,a="",l=n+1,c=false;if(t[l]==="?"){i(`Pattern cannot start with "?" at ${l}`);continue}for(;l<t.length;){if(!qa(t[l],false)){i(`Invalid character '${t[l]}' at ${l}.`),c=true;break}if(t[l]==="\\"){a+=t[l++]+t[l++];continue}if(t[l]===")"){if(o--,o===0){l++;break}}else if(t[l]==="("&&(o++,t[l+1]!=="?")){i(`Capturing groups are not allowed at ${l}`),c=true;break}a+=t[l++];}if(c)continue;if(o){i(`Unbalanced pattern at ${n}`);continue}if(!a){i(`Missing pattern at ${n}`);continue}r.push({type:"REGEX",index:n,value:a}),n=l;continue}r.push({type:"CHAR",index:n,value:t[n++]});}return r.push({type:"END",index:n,value:""}),r}function ks(t,e={}){let r=vs(t);e.delimiter??="/#?",e.prefixes??="./";let n=`[^${me(e.delimiter)}]+?`,s=[],i=0,o=0,l=new Set,c=F(P=>{if(o<r.length&&r[o].type===P)return r[o++].value},"tryConsume"),u=F(()=>c("OTHER_MODIFIER")??c("ASTERISK"),"tryConsumeModifier"),h=F(P=>{let T=c(P);if(T!==void 0)return T;let{type:S,index:v}=r[o];throw new TypeError(`Unexpected ${S} at ${v}, expected ${P}`)},"mustConsume"),d=F(()=>{let P="",T;for(;T=c("CHAR")??c("ESCAPED_CHAR");)P+=T;return P},"consumeText"),p=F(P=>P,"DefaultEncodePart"),_=e.encodePart||p,w="",R=F(P=>{w+=P;},"appendToPendingFixedValue"),C=F(()=>{w.length&&(s.push(new wt(3,"","",_(w),"",3)),w="");},"maybeAddPartFromPendingFixedValue"),I=F((P,T,S,v,O)=>{let g=3;switch(O){case "?":g=1;break;case "*":g=0;break;case "+":g=2;break}if(!T&&!S&&g===3){R(P);return}if(C(),!T&&!S){if(!P)return;s.push(new wt(3,"","",_(P),"",g));return}let x;S?S==="*"?x=Ss:x=S:x=n;let E=2;x===n?(E=1,x=""):x===Ss&&(E=0,x="");let k;if(T?k=T:S&&(k=i++),l.has(k))throw new TypeError(`Duplicate name '${k}'.`);l.add(k),s.push(new wt(E,k,_(P),x,_(v),g));},"addPart");for(;o<r.length;){let P=c("CHAR"),T=c("NAME"),S=c("REGEX");if(!T&&!S&&(S=c("ASTERISK")),T||S){let O=P??"";e.prefixes.indexOf(O)===-1&&(R(O),O=""),C();let g=u();I(O,T,S,"",g);continue}let v=P??c("ESCAPED_CHAR");if(v){R(v);continue}if(c("OPEN")){let O=d(),g=c("NAME"),x=c("REGEX");!g&&!x&&(x=c("ASTERISK"));let E=d();h("CLOSE");let k=u();I(O,g,x,E,k);continue}C(),h("END");}return s}function me(t){return t.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function Es(t){return t&&t.ignoreCase?"ui":"u"}function Ua(t,e,r){return Ts(ks(t,r),e,r)}function rt(t){switch(t){case 0:return "*";case 1:return "?";case 2:return "+";case 3:return ""}}function Ts(t,e,r={}){r.delimiter??="/#?",r.prefixes??="./",r.sensitive??=false,r.strict??=false,r.end??=true,r.start??=true,r.endsWith="";let n=r.start?"^":"";for(let a of t){if(a.type===3){a.modifier===3?n+=me(a.value):n+=`(?:${me(a.value)})${rt(a.modifier)}`;continue}e&&e.push(a.name);let l=`[^${me(r.delimiter)}]+?`,c=a.value;if(a.type===1?c=l:a.type===0&&(c=Ss),!a.prefix.length&&!a.suffix.length){a.modifier===3||a.modifier===1?n+=`(${c})${rt(a.modifier)}`:n+=`((?:${c})${rt(a.modifier)})`;continue}if(a.modifier===3||a.modifier===1){n+=`(?:${me(a.prefix)}(${c})${me(a.suffix)})`,n+=rt(a.modifier);continue}n+=`(?:${me(a.prefix)}`,n+=`((?:${c})(?:`,n+=me(a.suffix),n+=me(a.prefix),n+=`(?:${c}))*)${me(a.suffix)})`,a.modifier===0&&(n+="?");}let s=`[${me(r.endsWith)}]|$`,i=`[${me(r.delimiter)}]`;if(r.end)return r.strict||(n+=`${i}?`),r.endsWith.length?n+=`(?=${s})`:n+="$",new RegExp(n,Es(r));r.strict||(n+=`(?:${i}(?=${s}))?`);let o=false;if(t.length){let a=t[t.length-1];a.type===3&&a.modifier===3&&(o=r.delimiter.indexOf(a)>-1);}return o||(n+=`(?=${i}|${s})`),new RegExp(n,Es(r))}function Ba(t,e){return t.length?t[0]==="/"?true:!e||t.length<2?false:(t[0]=="\\"||t[0]=="{")&&t[1]=="/":false}function Cs(t,e){return t.startsWith(e)?t.substring(e.length,t.length):t}function Ma(t,e){return t.endsWith(e)?t.substr(0,t.length-e.length):t}function As(t){return !t||t.length<2?false:t[0]==="["||(t[0]==="\\"||t[0]==="{")&&t[1]==="["}function Rs(t){if(!t)return true;for(let e of $a)if(t.test(e))return true;return false}function Na(t,e){if(t=Cs(t,"#"),e||t==="")return t;let r=new URL("https://example.com");return r.hash=t,r.hash?r.hash.substring(1,r.hash.length):""}function Ga(t,e){if(t=Cs(t,"?"),e||t==="")return t;let r=new URL("https://example.com");return r.search=t,r.search?r.search.substring(1,r.search.length):""}function za(t,e){return e||t===""?t:As(t)?Fs(t):Os(t)}function Ha(t,e){if(e||t==="")return t;let r=new URL("https://example.com");return r.password=t,r.password}function Va(t,e){if(e||t==="")return t;let r=new URL("https://example.com");return r.username=t,r.username}function Wa(t,e,r){if(r||t==="")return t;if(e&&!$a.includes(e))return new URL(`${e}:${t}`).pathname;let n=t[0]=="/";return t=new URL(n?t:"/-"+t,"https://example.com").pathname,n||(t=t.substring(2,t.length)),t}function Ka(t,e,r){return Ls(e)===t&&(t=""),r||t===""?t:Is(t)}function Qa(t,e){return t=Ma(t,":"),e||t===""?t:Lr(t)}function Ls(t){switch(t){case "ws":case "http":return "80";case "wws":case "https":return "443";case "ftp":return "21";default:return ""}}function Lr(t){if(t==="")return t;if(/^[-+.A-Za-z0-9]*$/.test(t))return t.toLowerCase();throw new TypeError(`Invalid protocol '${t}'.`)}function Za(t){if(t==="")return t;let e=new URL("https://example.com");return e.username=t,e.username}function Ja(t){if(t==="")return t;let e=new URL("https://example.com");return e.password=t,e.password}function Os(t){if(t==="")return t;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(t))throw new TypeError(`Invalid hostname '${t}'`);let e=new URL("https://example.com");return e.hostname=t,e.hostname}function Fs(t){if(t==="")return t;if(/[^0-9a-fA-F[\]:]/g.test(t))throw new TypeError(`Invalid IPv6 hostname '${t}'`);return t.toLowerCase()}function Is(t){if(t===""||/^[0-9]*$/.test(t)&&parseInt(t)<=65535)return t;throw new TypeError(`Invalid port '${t}'.`)}function Ya(t){if(t==="")return t;let e=new URL("https://example.com");return e.pathname=t[0]!=="/"?"/-"+t:t,t[0]!=="/"?e.pathname.substring(2,e.pathname.length):e.pathname}function Xa(t){return t===""?t:new URL(`data:${t}`).pathname}function el(t){if(t==="")return t;let e=new URL("https://example.com");return e.search=t,e.search.substring(1,e.search.length)}function tl(t){if(t==="")return t;let e=new URL("https://example.com");return e.hash=t,e.hash.substring(1,e.hash.length)}function Ps(t,e){if(typeof t!="string")throw new TypeError("parameter 1 is not of type 'string'.");let r=new URL(t,e);return {protocol:r.protocol.substring(0,r.protocol.length-1),username:r.username,password:r.password,hostname:r.hostname,port:r.port,pathname:r.pathname,search:r.search!==""?r.search.substring(1,r.search.length):void 0,hash:r.hash!==""?r.hash.substring(1,r.hash.length):void 0}}function Te(t,e){return e?_t(t):t}function xt(t,e,r){let n;if(typeof e.baseURL=="string")try{n=new URL(e.baseURL),e.protocol===void 0&&(t.protocol=Te(n.protocol.substring(0,n.protocol.length-1),r)),!r&&e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.username===void 0&&(t.username=Te(n.username,r)),!r&&e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.username===void 0&&e.password===void 0&&(t.password=Te(n.password,r)),e.protocol===void 0&&e.hostname===void 0&&(t.hostname=Te(n.hostname,r)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&(t.port=Te(n.port,r)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.pathname===void 0&&(t.pathname=Te(n.pathname,r)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.pathname===void 0&&e.search===void 0&&(t.search=Te(n.search.substring(1,n.search.length),r)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.pathname===void 0&&e.search===void 0&&e.hash===void 0&&(t.hash=Te(n.hash.substring(1,n.hash.length),r));}catch{throw new TypeError(`invalid baseURL '${e.baseURL}'.`)}if(typeof e.protocol=="string"&&(t.protocol=Qa(e.protocol,r)),typeof e.username=="string"&&(t.username=Va(e.username,r)),typeof e.password=="string"&&(t.password=Ha(e.password,r)),typeof e.hostname=="string"&&(t.hostname=za(e.hostname,r)),typeof e.port=="string"&&(t.port=Ka(e.port,t.protocol,r)),typeof e.pathname=="string"){if(t.pathname=e.pathname,n&&!Ba(t.pathname,r)){let s=n.pathname.lastIndexOf("/");s>=0&&(t.pathname=Te(n.pathname.substring(0,s+1),r)+t.pathname);}t.pathname=Wa(t.pathname,t.protocol,r);}return typeof e.search=="string"&&(t.search=Ga(e.search,r)),typeof e.hash=="string"&&(t.hash=Na(e.hash,r)),t}function _t(t){return t.replace(/([+*?:{}()\\])/g,"\\$1")}function nl(t){return t.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function sl(t,e){e.delimiter??="/#?",e.prefixes??="./",e.sensitive??=false,e.strict??=false,e.end??=true,e.start??=true,e.endsWith="";let r=".*",n=`[^${nl(e.delimiter)}]+?`,s=/[$_\u200C\u200D\p{ID_Continue}]/u,i="";for(let o=0;o<t.length;++o){let a=t[o];if(a.type===3){if(a.modifier===3){i+=_t(a.value);continue}i+=`{${_t(a.value)}}${rt(a.modifier)}`;continue}let l=a.hasCustomName(),c=!!a.suffix.length||!!a.prefix.length&&(a.prefix.length!==1||!e.prefixes.includes(a.prefix)),u=o>0?t[o-1]:null,h=o<t.length-1?t[o+1]:null;if(!c&&l&&a.type===1&&a.modifier===3&&h&&!h.prefix.length&&!h.suffix.length)if(h.type===3){let d=h.value.length>0?h.value[0]:"";c=s.test(d);}else c=!h.hasCustomName();if(!c&&!a.prefix.length&&u&&u.type===3){let d=u.value[u.value.length-1];c=e.prefixes.includes(d);}c&&(i+="{"),i+=_t(a.prefix),l&&(i+=`:${a.name}`),a.type===2?i+=`(${a.value})`:a.type===1?l||(i+=`(${n})`):a.type===0&&(!l&&(!u||u.type===3||u.modifier!==3||c||a.prefix!=="")?i+="*":i+=`(${r})`),a.type===1&&l&&a.suffix.length&&s.test(a.suffix[0])&&(i+="\\"),i+=_t(a.suffix),c&&(i+="}"),a.modifier!==3&&(i+=rt(a.modifier));}return i}var qp,F,wt,Up,Bp,Ss,He,Mp,$p,$a,rl,ws,ze,Or,il=b(()=>{g();qp=Object.defineProperty,F=(t,e)=>qp(t,"name",{value:e,configurable:true}),wt=class{type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(t,e,r,n,s,i){this.type=t,this.name=e,this.prefix=r,this.value=n,this.suffix=s,this.modifier=i;}hasCustomName(){return this.name!==""&&typeof this.name!="number"}};F(wt,"Part");Up=/[$_\p{ID_Start}]/u,Bp=/[$_\u200C\u200D\p{ID_Continue}]/u,Ss=".*";F(qa,"isASCII");F(vs,"lexer");F(ks,"parse");F(me,"escapeString");F(Es,"flags");F(Ua,"stringToRegexp");F(rt,"modifierToString");F(Ts,"partsToRegexp");He={delimiter:"",prefixes:"",sensitive:true,strict:true},Mp={delimiter:".",prefixes:"",sensitive:true,strict:true},$p={delimiter:"/",prefixes:"/",sensitive:true,strict:true};F(Ba,"isAbsolutePathname");F(Cs,"maybeStripPrefix");F(Ma,"maybeStripSuffix");F(As,"treatAsIPv6Hostname");$a=["ftp","file","http","https","ws","wss"];F(Rs,"isSpecialScheme");F(Na,"canonicalizeHash");F(Ga,"canonicalizeSearch");F(za,"canonicalizeHostname");F(Ha,"canonicalizePassword");F(Va,"canonicalizeUsername");F(Wa,"canonicalizePathname");F(Ka,"canonicalizePort");F(Qa,"canonicalizeProtocol");F(Ls,"defaultPortForProtocol");F(Lr,"protocolEncodeCallback");F(Za,"usernameEncodeCallback");F(Ja,"passwordEncodeCallback");F(Os,"hostnameEncodeCallback");F(Fs,"ipv6HostnameEncodeCallback");F(Is,"portEncodeCallback");F(Ya,"standardURLPathnameEncodeCallback");F(Xa,"pathURLPathnameEncodeCallback");F(el,"searchEncodeCallback");F(tl,"hashEncodeCallback");rl=class{#o;#r=[];#n={};#t=0;#p=1;#w=0;#s=0;#y=0;#l=0;#i=false;constructor(t){this.#o=t;}get result(){return this.#n}parse(){for(this.#r=vs(this.#o,true);this.#t<this.#r.length;this.#t+=this.#p){if(this.#p=1,this.#r[this.#t].type==="END"){if(this.#s===0){this.#b(),this.#k()?this.#e(9,1):this.#d()?this.#e(8,1):this.#e(7,0);continue}else if(this.#s===2){this.#f(5);continue}this.#e(10,0);break}if(this.#y>0)if(this.#T())this.#y-=1;else continue;if(this.#L()){this.#y+=1;continue}switch(this.#s){case 0:this.#h()&&this.#f(1);break;case 1:if(this.#h()){this.#O();let t=7,e=1;this.#E()?(t=2,e=3):this.#i&&(t=2),this.#e(t,e);}break;case 2:this.#g()?this.#f(3):(this.#v()||this.#d()||this.#k())&&this.#f(5);break;case 3:this.#x()?this.#e(4,1):this.#g()&&this.#e(5,1);break;case 4:this.#g()&&this.#e(5,1);break;case 5:this.#F()?this.#l+=1:this.#_()&&(this.#l-=1),this.#P()&&!this.#l?this.#e(6,1):this.#v()?this.#e(7,0):this.#d()?this.#e(8,1):this.#k()&&this.#e(9,1);break;case 6:this.#v()?this.#e(7,0):this.#d()?this.#e(8,1):this.#k()&&this.#e(9,1);break;case 7:this.#d()?this.#e(8,1):this.#k()&&this.#e(9,1);break;case 8:this.#k()&&this.#e(9,1);break;}}this.#n.hostname!==void 0&&this.#n.port===void 0&&(this.#n.port="");}#e(t,e){switch(this.#s){case 0:break;case 1:this.#n.protocol=this.#S();break;case 2:break;case 3:this.#n.username=this.#S();break;case 4:this.#n.password=this.#S();break;case 5:this.#n.hostname=this.#S();break;case 6:this.#n.port=this.#S();break;case 7:this.#n.pathname=this.#S();break;case 8:this.#n.search=this.#S();break;case 9:this.#n.hash=this.#S();break;}this.#s!==0&&t!==10&&([1,2,3,4].includes(this.#s)&&[6,7,8,9].includes(t)&&(this.#n.hostname??=""),[1,2,3,4,5,6].includes(this.#s)&&[8,9].includes(t)&&(this.#n.pathname??=this.#i?"/":""),[1,2,3,4,5,6,7].includes(this.#s)&&t===9&&(this.#n.search??="")),this.#m(t,e);}#m(t,e){this.#s=t,this.#w=this.#t+e,this.#t+=e,this.#p=0;}#b(){this.#t=this.#w,this.#p=0;}#f(t){this.#b(),this.#s=t;}#u(t){return t<0&&(t=this.#r.length-t),t<this.#r.length?this.#r[t]:this.#r[this.#r.length-1]}#c(t,e){let r=this.#u(t);return r.value===e&&(r.type==="CHAR"||r.type==="ESCAPED_CHAR"||r.type==="INVALID_CHAR")}#h(){return this.#c(this.#t,":")}#E(){return this.#c(this.#t+1,"/")&&this.#c(this.#t+2,"/")}#g(){return this.#c(this.#t,"@")}#x(){return this.#c(this.#t,":")}#P(){return this.#c(this.#t,":")}#v(){return this.#c(this.#t,"/")}#d(){if(this.#c(this.#t,"?"))return true;if(this.#r[this.#t].value!=="?")return false;let t=this.#u(this.#t-1);return t.type!=="NAME"&&t.type!=="REGEX"&&t.type!=="CLOSE"&&t.type!=="ASTERISK"}#k(){return this.#c(this.#t,"#")}#L(){return this.#r[this.#t].type=="OPEN"}#T(){return this.#r[this.#t].type=="CLOSE"}#F(){return this.#c(this.#t,"[")}#_(){return this.#c(this.#t,"]")}#S(){let t=this.#r[this.#t],e=this.#u(this.#w).index;return this.#o.substring(e,t.index)}#O(){let t={};Object.assign(t,He),t.encodePart=Lr;let e=Ua(this.#S(),void 0,t);this.#i=Rs(e);}};F(rl,"Parser");ws=["protocol","username","password","hostname","port","pathname","search","hash"],ze="*";F(Ps,"extractValues");F(Te,"processBaseURLString");F(xt,"applyInit");F(_t,"escapePatternString");F(nl,"escapeRegexpString");F(sl,"partsToPattern");Or=class{#o;#r={};#n={};#t={};#p={};#w=false;constructor(t={},e,r){try{let n;if(typeof e=="string"?n=e:r=e,typeof t=="string"){let a=new rl(t);if(a.parse(),t=a.result,n===void 0&&typeof t.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");t.baseURL=n;}else {if(!t||typeof t!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(n)throw new TypeError("parameter 1 is not of type 'string'.")}typeof r>"u"&&(r={ignoreCase:!1});let s={ignoreCase:r.ignoreCase===!0},i={pathname:ze,protocol:ze,username:ze,password:ze,hostname:ze,port:ze,search:ze,hash:ze};this.#o=xt(i,t,!0),Ls(this.#o.protocol)===this.#o.port&&(this.#o.port="");let o;for(o of ws){if(!(o in this.#o))continue;let a={},l=this.#o[o];switch(this.#n[o]=[],o){case "protocol":Object.assign(a,He),a.encodePart=Lr;break;case "username":Object.assign(a,He),a.encodePart=Za;break;case "password":Object.assign(a,He),a.encodePart=Ja;break;case "hostname":Object.assign(a,Mp),As(l)?a.encodePart=Fs:a.encodePart=Os;break;case "port":Object.assign(a,He),a.encodePart=Is;break;case "pathname":Rs(this.#r.protocol)?(Object.assign(a,$p,s),a.encodePart=Ya):(Object.assign(a,He,s),a.encodePart=Xa);break;case "search":Object.assign(a,He,s),a.encodePart=el;break;case "hash":Object.assign(a,He,s),a.encodePart=tl;break}try{this.#p[o]=ks(l,a),this.#r[o]=Ts(this.#p[o],this.#n[o],a),this.#t[o]=sl(this.#p[o],a),this.#w=this.#w||this.#p[o].some(c=>c.type===2);}catch{throw new TypeError(`invalid ${o} pattern '${this.#o[o]}'.`)}}}catch(n){throw new TypeError(`Failed to construct 'URLPattern': ${n.message}`)}}get[Symbol.toStringTag](){return "URLPattern"}test(t={},e){let r={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof t!="string"&&e)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof t>"u")return false;try{typeof t=="object"?r=xt(r,t,!1):r=xt(r,Ps(t,e),!1);}catch{return false}let n;for(n of ws)if(!this.#r[n].exec(r[n]))return false;return true}exec(t={},e){let r={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof t!="string"&&e)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof t>"u")return;try{typeof t=="object"?r=xt(r,t,!1):r=xt(r,Ps(t,e),!1);}catch{return null}let n={};e?n.inputs=[t,e]:n.inputs=[t];let s;for(s of ws){let i=this.#r[s].exec(r[s]);if(!i)return null;let o={};for(let[a,l]of this.#n[s].entries())if(typeof l=="string"||typeof l=="number"){let c=i[a+1];o[l]=c;}n[s]={input:r[s]??"",groups:o};}return n}static compareComponent(t,e,r){let n=F((a,l)=>{for(let c of ["type","modifier","prefix","value","suffix"]){if(a[c]<l[c])return -1;if(a[c]!==l[c])return 1}return 0},"comparePart"),s=new wt(3,"","","","",3),i=new wt(0,"","","","",3),o=F((a,l)=>{let c=0;for(;c<Math.min(a.length,l.length);++c){let u=n(a[c],l[c]);if(u)return u}return a.length===l.length?0:n(a[c]??s,l[c]??s)},"comparePartList");return !e.#t[t]&&!r.#t[t]?0:e.#t[t]&&!r.#t[t]?o(e.#p[t],[i]):!e.#t[t]&&r.#t[t]?o([i],r.#p[t]):o(e.#p[t],r.#p[t])}get protocol(){return this.#t.protocol}get username(){return this.#t.username}get password(){return this.#t.password}get hostname(){return this.#t.hostname}get port(){return this.#t.port}get pathname(){return this.#t.pathname}get search(){return this.#t.search}get hash(){return this.#t.hash}get hasRegExpGroups(){return this.#w}};F(Or,"URLPattern");});var ol={};d(ol,{URLPattern:()=>Or});var al=b(()=>{g();il();globalThis.URLPattern||(globalThis.URLPattern=Or);});var We=c(de=>{g();Object.defineProperty(de,"__esModule",{value:true});de.isPromise=Fr;de.isActualPromise=cl;de.handleMaybePromise=Ve;de.fakePromise=Ce;de.createDeferredPromise=Np;de.iterateAsync=ul;de.iterateAsyncVoid=ul;de.fakeRejectPromise=nt;de.mapMaybePromise=Gp;de.mapAsyncIterator=zp;de.promiseLikeFinally=fl;de.unfakePromise=hl;var Ir=Symbol.for("@whatwg-node/promise-helpers/FakePromise");function Fr(t){return t?.then!=null}function cl(t){let e=t;return e&&e.then&&e.catch&&e.finally}function Ve(t,e,r,n){let s=Ce().then(t).then(e,r);return n&&(s=s.finally(n)),hl(s)}function Ce(t){return t&&cl(t)?t:Fr(t)?{then:(e,r)=>Ce(t.then(e,r)),catch:e=>Ce(t.then(r=>r,e)),finally:e=>Ce(e?fl(t,e):t),[Symbol.toStringTag]:"Promise"}:{then(e){if(e)try{return Ce(e(t))}catch(r){return nt(r)}return this},catch(){return this},finally(e){if(e)try{return Ce(e()).then(()=>t,()=>t)}catch(r){return nt(r)}return this},[Symbol.toStringTag]:"Promise",__fakePromiseValue:t,[Ir]:"resolved"}}function Np(){if(Promise.withResolvers)return Promise.withResolvers();let t,e;return {promise:new Promise(function(s,i){t=s,e=i;}),get resolve(){return t},get reject(){return e}}}function ul(t,e,r){if(t?.length===0)return;let n=t[Symbol.iterator](),s=0;function i(){let{done:o,value:a}=n.next();if(o)return;let l=false;function c(){l=true;}return Ve(function(){return e(a,c,s++)},function(h){if(h&&r?.push(h),!l)return i()})}return i()}function nt(t){return {then(e,r){if(r)try{return Ce(r(t))}catch(n){return nt(n)}return this},catch(e){if(e)try{return Ce(e(t))}catch(r){return nt(r)}return this},finally(e){if(e)try{e();}catch(r){return nt(r)}return this},__fakeRejectError:t,[Symbol.toStringTag]:"Promise",[Ir]:"rejected"}}function Gp(t,e,r){return Ve(()=>t,e,r)}function zp(t,e,r,n){Symbol.asyncIterator in t&&(t=t[Symbol.asyncIterator]());let s,i,o;if(n){let c;o=u=>(c||=Ve(n,()=>u,()=>u),c);}typeof t.return=="function"&&(s=t.return,i=c=>{let u=()=>{throw c};return s.call(t).then(u,u)});function a(c){return c.done?o?o(c):c:Ve(()=>c.value,u=>Ve(()=>e(u),ll,i))}let l;if(r){let c,u=r;l=h=>(c||=Ve(()=>h,d=>Ve(()=>u(d),ll,i)),c);}return {next(){return t.next().then(a,l)},return(){let c=s?s.call(t).then(a,l):Ce({value:void 0,done:true});return o?c.then(o):c},throw(c){return typeof t.throw=="function"?t.throw(c).then(a,l):i?i(c):nt(c)},[Symbol.asyncIterator](){return this}}}function ll(t){return {value:t,done:false}}function Hp(t){return t?.[Ir]==="resolved"}function Vp(t){return t?.[Ir]==="rejected"}function fl(t,e){return "finally"in t?t.finally(e):t.then(r=>{let n=e();return Fr(n)?n.then(()=>r):r},r=>{let n=e();if(Fr(n))return n.then(()=>{throw r});throw r})}function hl(t){if(Hp(t))return t.__fakePromiseValue;if(Vp(t))throw t.__fakeRejectError;return t}});var Ds=c((Lw,dl)=>{g();var{EventEmitter:Wp}=a("events"),{inherits:Kp}=a("util");function st(t){if(typeof t=="string"&&(t=Buffer.from(t)),!Buffer.isBuffer(t))throw new TypeError("The needle has to be a String or a Buffer.");let e=t.length,r=e-1;if(e===0)throw new Error("The needle cannot be an empty String/Buffer.");if(e>256)throw new Error("The needle cannot have a length bigger than 256.");this.maxMatches=1/0,this.matches=0,this._occ=new Uint8Array(256).fill(e),this._lookbehind_size=0,this._needle=t,this._bufpos=0,this._lookbehind=Buffer.alloc(r);for(var n=0;n<r;++n)this._occ[t[n]]=r-n;}Kp(st,Wp);st.prototype.reset=function(){this._lookbehind_size=0,this.matches=0,this._bufpos=0;};st.prototype.push=function(t,e){Buffer.isBuffer(t)||(t=Buffer.from(t,"binary"));let r=t.length;this._bufpos=e||0;let n;for(;n!==r&&this.matches<this.maxMatches;)n=this._sbmh_feed(t);return n};st.prototype._sbmh_feed=function(t){let e=t.length,r=this._needle,n=r.length,s=n-1,i=r[s],o=-this._lookbehind_size,a;if(o<0){for(;o<0&&o<=e-n;){if(a=t[o+s],a===i&&this._sbmh_memcmp(t,o,s))return this._lookbehind_size=0,++this.matches,this.emit("info",true),this._bufpos=o+n;o+=this._occ[a];}for(;o<0&&!this._sbmh_memcmp(t,o,e-o);)++o;if(o>=0)this.emit("info",false,this._lookbehind,0,this._lookbehind_size),this._lookbehind_size=0;else {let l=this._lookbehind_size+o;return l>0&&this.emit("info",false,this._lookbehind,0,l),this._lookbehind_size-=l,this._lookbehind.copy(this._lookbehind,0,l,this._lookbehind_size),t.copy(this._lookbehind,this._lookbehind_size),this._lookbehind_size+=e,this._bufpos=e,e}}if(o=t.indexOf(r,o+this._bufpos),o!==-1)return ++this.matches,o===0?this.emit("info",true):this.emit("info",true,t,this._bufpos,o),this._bufpos=o+n;for(o=e-s,o<0&&(o=0);o!==e&&(t[o]!==r[0]||Buffer.compare(t.subarray(o+1,e),r.subarray(1,e-o))!==0);)++o;return o!==e&&(t.copy(this._lookbehind,0,o,e),this._lookbehind_size=e-o),o!==0&&this.emit("info",false,t,this._bufpos,o),this._bufpos=e,e};st.prototype._sbmh_lookup_char=function(t,e){return e<0?this._lookbehind[this._lookbehind_size+e]:t[e]};st.prototype._sbmh_memcmp=function(t,e,r){for(var n=0;n<r;++n)if(this._sbmh_lookup_char(t,e+n)!==this._needle[n])return false;return true};dl.exports=st;});var bl=c((Fw,ml)=>{g();var Qp=a("util").inherits,pl=a("stream").Readable;function js(t){pl.call(this,t);}Qp(js,pl);js.prototype._read=function(t){};ml.exports=js;});var Dr=c((Dw,yl)=>{g();yl.exports=function(e,r,n){if(!e||e[r]===void 0||e[r]===null)return n;if(typeof e[r]!="number"||isNaN(e[r]))throw new TypeError("Limit "+r+" is not a valid number");return e[r]};});var wl=c((qw,_l)=>{g();var xl=a("events").EventEmitter,Zp=a("util").inherits,gl=Dr(),Jp=Ds(),Yp=Buffer.from(`\r
|
|
3
3
|
\r
|
|
4
4
|
`),Xp=/\r\n/g,em=/^([^:]+):[ \t]?([\x00-\xFF]+)?$/;function St(t){xl.call(this),t=t||{};let e=this;this.nread=0,this.maxed=false,this.npairs=0,this.maxHeaderPairs=gl(t,"maxHeaderPairs",2e3),this.maxHeaderSize=gl(t,"maxHeaderSize",80*1024),this.buffer="",this.header={},this.finished=false,this.ss=new Jp(Yp),this.ss.on("info",function(r,n,s,i){n&&!e.maxed&&(e.nread+i-s>=e.maxHeaderSize?(i=e.maxHeaderSize-e.nread+s,e.nread=e.maxHeaderSize,e.maxed=true):e.nread+=i-s,e.buffer+=n.toString("binary",s,i)),r&&e._finish();});}Zp(St,xl);St.prototype.push=function(t){let e=this.ss.push(t);if(this.finished)return e};St.prototype.reset=function(){this.finished=false,this.buffer="",this.header={},this.ss.reset();};St.prototype._finish=function(){this.buffer&&this._parseHeader(),this.ss.matches=this.ss.maxMatches;let t=this.header;this.header={},this.buffer="",this.finished=true,this.nread=this.npairs=0,this.maxed=false,this.emit("header",t);};St.prototype._parseHeader=function(){if(this.npairs===this.maxHeaderPairs)return;let t=this.buffer.split(Xp),e=t.length,r,n;for(var s=0;s<e;++s){if(t[s].length===0)continue;if((t[s][0]===" "||t[s][0]===" ")&&n){this.header[n][this.header[n].length-1]+=t[s];continue}let i=t[s].indexOf(":");if(i===-1||i===0)return;if(r=em.exec(t[s]),n=r[1].toLowerCase(),this.header[n]=this.header[n]||[],this.header[n].push(r[2]||""),++this.npairs===this.maxHeaderPairs)break}};_l.exports=St;});var Us=c((Bw,El)=>{g();var qs=a("stream").Writable,tm=a("util").inherits,rm=Ds(),Sl=bl(),nm=wl(),sm=45,im=Buffer.from("-"),om=Buffer.from(`\r
|
|
@@ -18,9 +18,9 @@ var _s=c((_w,ja)=>{g();function jp(){return Object.keys(globalThis).some(t=>t.st
|
|
|
18
18
|
`))),cancel:a=>{r?.return?.(a),s?.return?.(a);}})}function Ic(t,e,r){return Object.defineProperty(e,"name",{configurable:true,enumerable:true,value:r||e.name||t}),e}function Dc(t){return t?.arrayBuffer!=null}});var nn=c(rn=>{g();Object.defineProperty(rn,"__esModule",{value:true});rn.PonyfillBody=void 0;var Ae=a("buffer"),Ue=a("stream"),hb=zl(),tn=We(),Tt=Hr(),db=si(),jc=di(),qe=kt(),se=be(),Y;(function(t){t.ReadableStream="ReadableStream",t.Blob="Blob",t.FormData="FormData",t.String="String",t.Readable="Readable",t.Buffer="Buffer",t.AsyncIterable="AsyncIterable";})(Y||(Y={}));var pi=class{bodyInit;options;bodyUsed=false;contentType=null;contentLength=null;constructor(e,r={}){this.bodyInit=e,this.options=r;let{bodyFactory:n,contentType:s,contentLength:i,bodyType:o,buffer:a}=pb(e);this._bodyFactory=n,this.contentType=s,this.contentLength=i,this.bodyType=o,this._buffer=a,this._signal=r.signal;}bodyType;_bodyFactory=()=>null;_generatedBody=null;_buffer;_signal;generateBody(){if(this._generatedBody?.readable?.destroyed&&this._buffer&&(this._generatedBody.readable=Ue.Readable.from(this._buffer)),this._generatedBody)return this._generatedBody;let e=this._bodyFactory();return this._generatedBody=e,e}handleContentLengthHeader(e=false){let r=this.headers.get("content-type");r?this.contentType=r:this.contentType&&this.headers.set("content-type",this.contentType);let n=this.headers.get("content-length");e&&this.bodyInit==null&&!n&&(this.contentLength=0,this.headers.set("content-length","0")),n?this.contentLength=parseInt(n,10):this.contentLength&&this.headers.set("content-length",this.contentLength.toString());}get body(){let e=this.generateBody();if(e!=null){let r=e,n=e.readable;return new Proxy(e.readable,{get(s,i){if(i in r){let o=r[i];return typeof o=="function"?o.bind(r):o}if(i in n){let o=n[i];return typeof o=="function"?o.bind(n):o}}})}return null}_chunks=null;_doCollectChunksFromReadableJob(){if(this.bodyType===Y.AsyncIterable){if(Array.fromAsync)return (0, tn.handleMaybePromise)(()=>Array.fromAsync(this.bodyInit),o=>(this._chunks=o,this._chunks));let n=this.bodyInit[Symbol.asyncIterator](),s=[],i=()=>(0, tn.handleMaybePromise)(()=>n.next(),({value:o,done:a})=>(o&&s.push(o),a?(this._chunks=s,this._chunks):i()));return i()}let e=this.generateBody();if(!e)return this._chunks=[],(0, se.fakePromise)(this._chunks);if(e.readable.destroyed)return (0, se.fakePromise)(this._chunks=[]);let r=[];return new Promise((n,s)=>{e.readable.on("data",i=>{r.push(i);}),e.readable.once("error",s),e.readable.once("end",()=>{n(this._chunks=r);});})}_collectChunksFromReadable(){return this._chunks?(0, se.fakePromise)(this._chunks):(this._chunks||=this._doCollectChunksFromReadableJob(),this._chunks)}_blob=null;blob(){return this._blob?(0, se.fakePromise)(this._blob):(this.bodyType===Y.String&&(this._text=this.bodyInit,this._blob=new Tt.PonyfillBlob([this._text],{type:this.contentType||"text/plain;charset=UTF-8",size:this.contentLength})),this.bodyType===Y.Blob?(this._blob=this.bodyInit,(0, se.fakePromise)(this._blob)):this._buffer?(this._blob=new Tt.PonyfillBlob([this._buffer],{type:this.contentType||"",size:this.contentLength}),(0, se.fakePromise)(this._blob)):(0, se.fakePromise)((0, tn.handleMaybePromise)(()=>this._collectChunksFromReadable(),e=>(this._blob=new Tt.PonyfillBlob(e,{type:this.contentType||"",size:this.contentLength}),this._blob))))}_formData=null;formData(e){if(this._formData)return (0, se.fakePromise)(this._formData);if(this.bodyType===Y.FormData)return this._formData=this.bodyInit,(0, se.fakePromise)(this._formData);if(this._formData=new jc.PonyfillFormData,this.generateBody()==null)return (0, se.fakePromise)(this._formData);let n={...this.options.formDataLimits,...e?.formDataLimits};return new Promise((s,i)=>{let o=this.body?.readable;if(!o)return i(new Error("No stream available"));let a=null,l=new hb.Busboy({headers:{"content-length":typeof this.contentLength=="number"?this.contentLength.toString():this.contentLength||"","content-type":this.contentType||""},limits:n,defCharset:"utf-8"});this._signal&&(0, Ue.addAbortSignal)(this._signal,l);let c=false,u=h=>{c||(c=true,o.unpipe(l),l.destroy(),a&&(a.destroy(),a=null),h?i(h):s(this._formData));};o.on("error",u),l.on("field",(h,d,p,_)=>{if(p)return u(new Error(`Field name size exceeded: ${n?.fieldNameSize} bytes`));if(_)return u(new Error(`Field value size exceeded: ${n?.fieldSize} bytes`));this._formData.set(h,d);}),l.on("file",(h,d,p,_,w)=>{a=d;let R=[];d.on("data",C=>{R.push(C);}),d.on("error",u),d.on("limit",()=>{u(new Error(`File size limit exceeded: ${n?.fileSize} bytes`));}),d.on("close",()=>{d.truncated&&u(new Error(`File size limit exceeded: ${n?.fileSize} bytes`)),a=null;let C=new db.PonyfillFile(R,p,{type:w});this._formData.set(h,C);});}),l.on("fieldsLimit",()=>{u(new Error(`Fields limit exceeded: ${n?.fields}`));}),l.on("filesLimit",()=>{u(new Error(`Files limit exceeded: ${n?.files}`));}),l.on("partsLimit",()=>{u(new Error(`Parts limit exceeded: ${n?.parts}`));}),l.on("end",u),l.on("finish",u),l.on("close",u),l.on("error",u),o.pipe(l);})}buffer(){if(this._buffer)return (0, se.fakePromise)(this._buffer);if(this._text)return this._buffer=Ae.Buffer.from(this._text,"utf-8"),(0, se.fakePromise)(this._buffer);if(this.bodyType===Y.String)return this.text().then(e=>(this._text=e,this._buffer=Ae.Buffer.from(e,"utf-8"),this._buffer));if(this.bodyType===Y.Blob){if((0, Tt.hasBufferMethod)(this.bodyInit))return this.bodyInit.buffer().then(e=>(this._buffer=e,this._buffer));if((0, Tt.hasBytesMethod)(this.bodyInit))return this.bodyInit.bytes().then(e=>(this._buffer=Ae.Buffer.from(e),this._buffer));if((0, Tt.hasArrayBufferMethod)(this.bodyInit))return this.bodyInit.arrayBuffer().then(e=>(this._buffer=Ae.Buffer.from(e,void 0,e.byteLength),this._buffer))}return (0, se.fakePromise)((0, tn.handleMaybePromise)(()=>this._collectChunksFromReadable(),e=>e.length===1?(this._buffer=e[0],this._buffer):(this._buffer=Ae.Buffer.concat(e),this._buffer)))}bytes(){return this.buffer()}arrayBuffer(){return this.buffer()}_json=null;json(){return this._json?(0, se.fakePromise)(this._json):this.text().then(e=>{try{this._json=JSON.parse(e);}catch(r){throw r instanceof SyntaxError&&(r.message+=`, "${e}" is not valid JSON`),r}return this._json})}_text=null;text(){return this._text?(0, se.fakePromise)(this._text):this.bodyType===Y.String?(this._text=this.bodyInit,(0, se.fakePromise)(this._text)):this.buffer().then(e=>(this._text=e.toString("utf-8"),this._text))}};rn.PonyfillBody=pi;function pb(t){if(t==null)return {bodyFactory:()=>null,contentType:null,contentLength:null};if(typeof t=="string"){let e=Ae.Buffer.byteLength(t);return {bodyType:Y.String,contentType:"text/plain;charset=UTF-8",contentLength:e,bodyFactory(){let r=Ue.Readable.from(Ae.Buffer.from(t,"utf-8"));return new qe.PonyfillReadableStream(r)}}}if(Ae.Buffer.isBuffer(t)){let e=t;return {bodyType:Y.Buffer,contentType:null,contentLength:t.length,buffer:t,bodyFactory(){let r=Ue.Readable.from(e);return new qe.PonyfillReadableStream(r)}}}if((0, se.isArrayBufferView)(t)){let e=Ae.Buffer.from(t.buffer,t.byteOffset,t.byteLength);return {bodyType:Y.Buffer,contentLength:t.byteLength,contentType:null,buffer:e,bodyFactory(){let r=Ue.Readable.from(e);return new qe.PonyfillReadableStream(r)}}}if(t instanceof qe.PonyfillReadableStream&&t.readable!=null){let e=t;return {bodyType:Y.ReadableStream,bodyFactory:()=>e,contentType:null,contentLength:null}}if(bb(t)){let e=t;return {bodyType:Y.Blob,contentType:t.type,contentLength:t.size,bodyFactory(){return e.stream()}}}if(t instanceof ArrayBuffer){let e=t.byteLength,r=Ae.Buffer.from(t,void 0,t.byteLength);return {bodyType:Y.Buffer,contentType:null,contentLength:e,buffer:r,bodyFactory(){let n=Ue.Readable.from(r);return new qe.PonyfillReadableStream(n)}}}if(t instanceof Ue.Readable)return {bodyType:Y.Readable,contentType:null,contentLength:null,bodyFactory(){return new qe.PonyfillReadableStream(t)}};if(yb(t))return {bodyType:Y.String,contentType:"application/x-www-form-urlencoded;charset=UTF-8",contentLength:null,bodyFactory(){return new qe.PonyfillReadableStream(Ue.Readable.from(t.toString()))}};if(mb(t)){let e=Math.random().toString(36).substr(2),r=`multipart/form-data; boundary=${e}`;return {bodyType:Y.FormData,contentType:r,contentLength:null,bodyFactory(){return (0, jc.getStreamFromFormData)(t,e)}}}if(gb(t))return {contentType:null,contentLength:null,bodyFactory(){return new qe.PonyfillReadableStream(t)}};if(t[Symbol.iterator]||t[Symbol.asyncIterator])return {contentType:null,contentLength:null,bodyType:Y.AsyncIterable,bodyFactory(){let e=Ue.Readable.from(t);return new qe.PonyfillReadableStream(e)}};throw new Error("Unknown body type")}function mb(t){return t?.forEach!=null}function bb(t){return t?.stream!=null&&typeof t.stream=="function"}function yb(t){return t?.sort!=null}function gb(t){return t?.getReader!=null}});var sn=c(Zt=>{g();Object.defineProperty(Zt,"__esModule",{value:true});Zt.PonyfillHeaders=void 0;Zt.isHeadersLike=Ke;var xb=a("util"),mi=en();function Ke(t){return t?.get&&t?.forEach}var bi=class{headersInit;_map;objectNormalizedKeysOfHeadersInit=[];objectOriginalKeysOfHeadersInit=[];_setCookies;constructor(e){this.headersInit=e;}_get(e){let r=e.toLowerCase();if(r==="set-cookie"&&this._setCookies?.length)return this._setCookies.join(", ");if(this._map)return this._map.get(r)||null;if(this.headersInit==null)return null;if(Array.isArray(this.headersInit)){let n=this.headersInit.filter(([s])=>s.toLowerCase()===r);return n.length===0?null:n.length===1?n[0][1]:n.map(([,s])=>s).join(", ")}else {if(Ke(this.headersInit))return this.headersInit.get(r);{let n=this.headersInit[e]||this.headersInit[r];if(n!=null)return n;this.objectNormalizedKeysOfHeadersInit.length||Object.keys(this.headersInit).forEach(o=>{this.objectOriginalKeysOfHeadersInit.push(o),this.objectNormalizedKeysOfHeadersInit.push(o.toLowerCase());});let s=this.objectNormalizedKeysOfHeadersInit.indexOf(r);if(s===-1)return null;let i=this.objectOriginalKeysOfHeadersInit[s];return this.headersInit[i]}}}getMap(){if(!this._map)if(this._setCookies||=[],this.headersInit!=null)if(Array.isArray(this.headersInit)){this._map=new Map;for(let[e,r]of this.headersInit){let n=e.toLowerCase();if(n==="set-cookie"){Array.isArray(r)?this._setCookies.push(...r):r!=null&&this._setCookies.push(r);continue}this._map.set(n,r);}}else if(Ke(this.headersInit))this._map=new Map,this.headersInit.forEach((e,r)=>{if(r==="set-cookie"){this._setCookies||=[],Array.isArray(e)?this._setCookies.push(...e):e!=null&&this._setCookies.push(e);return}this._map.set(r,e);});else {this._map=new Map;for(let e in this.headersInit){let r=this.headersInit[e];if(r!=null){let n=e.toLowerCase();if(n==="set-cookie"){if(this._setCookies||=[],Array.isArray(r)){this._setCookies.push(...r);continue}this._setCookies.push(r);continue}this._map.set(n,r);}}}else this._map=new Map;return this._map}append(e,r){let n=e.toLowerCase();if(n==="set-cookie"){this._setCookies||=[],this._setCookies.push(r);return}let s=this.getMap().get(n),i=s?`${s}, ${r}`:r;this.getMap().set(n,i);}get(e){let r=this._get(e);return r==null?null:r.toString()}has(e){return e.toLowerCase()==="set-cookie"?!!this._setCookies?.length:!!this._get(e)}set(e,r){let n=e.toLowerCase();if(n==="set-cookie"){this._setCookies=[r];return}if(!this._map&&this.headersInit!=null)if(Array.isArray(this.headersInit)){let s=this.headersInit.find(([i])=>i.toLowerCase()===n);s?s[1]=r:this.headersInit.push([n,r]);return}else if(Ke(this.headersInit)){this.headersInit.set(n,r);return}else {this.headersInit[n]=r;return}this.getMap().set(n,r);}delete(e){let r=e.toLowerCase();if(r==="set-cookie"){this._setCookies=[];return}this.getMap().delete(r);}forEach(e){if(this._setCookies?.forEach(r=>{e(r,"set-cookie",this);}),!this._map){if(this.headersInit){if(Array.isArray(this.headersInit)){this.headersInit.forEach(([r,n])=>{e(n,r,this);});return}if(Ke(this.headersInit)){this.headersInit.forEach(e);return}Object.entries(this.headersInit).forEach(([r,n])=>{n!=null&&e(n,r,this);});}return}this.getMap().forEach((r,n)=>{e(r,n,this);});}*_keys(){if(this._setCookies?.length&&(yield "set-cookie"),!this._map&&this.headersInit){if(Array.isArray(this.headersInit)){yield*this.headersInit.map(([e])=>e)[Symbol.iterator]();return}if(Ke(this.headersInit)){yield*this.headersInit.keys();return}yield*Object.keys(this.headersInit)[Symbol.iterator]();return}yield*this.getMap().keys();}keys(){return new mi.PonyfillIteratorObject(this._keys(),"HeadersIterator")}*_values(){if(this._setCookies?.length&&(yield*this._setCookies),!this._map&&this.headersInit){if(Array.isArray(this.headersInit)){yield*this.headersInit.map(([,e])=>e)[Symbol.iterator]();return}if(Ke(this.headersInit)){yield*this.headersInit.values();return}yield*Object.values(this.headersInit)[Symbol.iterator]();return}yield*this.getMap().values();}values(){return new mi.PonyfillIteratorObject(this._values(),"HeadersIterator")}*_entries(){if(this._setCookies?.length&&(yield*this._setCookies.map(e=>["set-cookie",e])),!this._map&&this.headersInit){if(Array.isArray(this.headersInit)){yield*this.headersInit;return}if(Ke(this.headersInit)){yield*this.headersInit.entries();return}yield*Object.entries(this.headersInit);return}yield*this.getMap().entries();}entries(){return new mi.PonyfillIteratorObject(this._entries(),"HeadersIterator")}getSetCookie(){return this._setCookies||this.getMap(),this._setCookies}[Symbol.iterator](){return this.entries()}[Symbol.for("nodejs.util.inspect.custom")](){let e={};return this.forEach((r,n)=>{n==="set-cookie"?e["set-cookie"]=this._setCookies||[]:e[n]=r?.includes(",")?r.split(",").map(s=>s.trim()):r;}),`Headers ${(0, xb.inspect)(e)}`}};Zt.PonyfillHeaders=bi;});var Yt=c(on=>{g();Object.defineProperty(on,"__esModule",{value:true});on.PonyfillResponse=void 0;var _b=a("http"),wb=nn(),yi=sn(),Jt="application/json; charset=utf-8",gi=class t extends wb.PonyfillBody{headers;constructor(e,r){super(e||null,r),this.headers=r?.headers&&(0, yi.isHeadersLike)(r.headers)?r.headers:new yi.PonyfillHeaders(r?.headers),this.status=r?.status||200,this.statusText=r?.statusText||_b.STATUS_CODES[this.status]||"OK",this.url=r?.url||"",this.redirected=r?.redirected||false,this.type=r?.type||"default",this.handleContentLengthHeader();}get ok(){return this.status>=200&&this.status<300}status;statusText;url;redirected;type;clone(){return this}static error(){return new t(null,{status:500,statusText:"Internal Server Error"})}static redirect(e,r=302){if(r<300||r>399)throw new RangeError("Invalid status code");return new t(null,{headers:{location:e},status:r})}static json(e,r){let n=JSON.stringify(e);if(!r)r={headers:{"content-type":Jt,"content-length":Buffer.byteLength(n).toString()}};else if(!r.headers)r.headers={"content-type":Jt,"content-length":Buffer.byteLength(n).toString()};else if((0, yi.isHeadersLike)(r.headers))r.headers.has("content-type")||r.headers.set("content-type",Jt),r.headers.has("content-length")||r.headers.set("content-length",Buffer.byteLength(n).toString());else if(Array.isArray(r.headers)){let s=false,i=false;for(let[o]of r.headers){if(i&&s)break;!s&&o.toLowerCase()==="content-type"?s=true:!i&&o.toLowerCase()==="content-length"&&(i=true);}s||r.headers.push(["content-type",Jt]),i||r.headers.push(["content-length",Buffer.byteLength(n).toString()]);}else typeof r.headers=="object"&&(r.headers?.["content-type"]==null&&(r.headers["content-type"]=Jt),r.headers?.["content-length"]==null&&(r.headers["content-length"]=Buffer.byteLength(n).toString()));return new t(n,r)}[Symbol.toStringTag]="Response"};on.PonyfillResponse=gi;});var Uc=c(_i=>{g();Object.defineProperty(_i,"__esModule",{value:true});_i.fetchCurl=vb;var qc=a("stream"),Sb=a("tls"),Eb=We(),Pb=Yt(),xi=be();function vb(t){let{Curl:e,CurlFeature:r,CurlPause:n,CurlProgressFunc:s}=globalThis.libcurl,i=new e;i.enable(r.NoDataParsing),i.setOpt("URL",t.url),process.env.NODE_TLS_REJECT_UNAUTHORIZED==="0"&&i.setOpt("SSL_VERIFYPEER",false),process.env.NODE_EXTRA_CA_CERTS?i.setOpt("CAINFO",process.env.NODE_EXTRA_CA_CERTS):i.setOpt("CAINFO_BLOB",Sb.rootCertificates.join(`
|
|
19
19
|
`)),i.enable(r.StreamResponse);let o;if(t._signal===null?o=void 0:t._signal&&(o=t._signal),i.setStreamProgressCallback(function(){return o?.aborted?process.env.DEBUG?s.Continue:1:0}),t.bodyType==="String")i.setOpt("POSTFIELDS",t.bodyInit);else {let p=t.body!=null?(0, xi.isNodeReadable)(t.body)?t.body:qc.Readable.from(t.body):null;p&&(i.setOpt("UPLOAD",true),i.setUploadStream(p));}process.env.DEBUG&&i.setOpt("VERBOSE",true),i.setOpt("TRANSFER_ENCODING",false),i.setOpt("HTTP_TRANSFER_DECODING",true),i.setOpt("FOLLOWLOCATION",t.redirect==="follow"),i.setOpt("MAXREDIRS",20),i.setOpt("ACCEPT_ENCODING",""),i.setOpt("CUSTOMREQUEST",t.method);let a=t.headersSerializer||xi.defaultHeadersSerializer,l,c=a(t.headers,p=>{l=Number(p);});l!=null&&i.setOpt("INFILESIZE",l),i.setOpt("HTTPHEADER",c),i.enable(r.NoHeaderParsing);let u=(0, Eb.createDeferredPromise)(),h;function d(){if(i.isOpen)try{i.pause(n.Recv);}catch(p){u.reject(p);}}return o?.addEventListener("abort",d,{once:true}),i.once("end",function(){try{i.close();}catch(_){u.reject(_);}o?.removeEventListener("abort",d);}),i.once("error",function(_){h&&!h.closed&&!h.destroyed?h.destroy(_):(_.message==="Operation was aborted by an application callback"&&(_.message="The operation was aborted."),u.reject(_));try{i.close();}catch(w){u.reject(w);}}),i.once("stream",function(_,w,R){let C=_.pipe(new qc.PassThrough,{end:true}),P=R.toString("utf8").split(/\r?\n|\r/g).filter(S=>S&&!S.startsWith("HTTP/")?(t.redirect==="error"&&S.toLowerCase().includes("location")&&(0, xi.shouldRedirect)(w)&&(_.destroyed||_.resume(),C.destroy(),u.reject(new Error("redirect is not allowed"))),true):false).map(S=>S.split(/:\s(.+)/).slice(0,2)),T=new Pb.PonyfillResponse(C,{status:w,headers:P,url:i.getInfo(e.info.REDIRECT_URL)?.toString()||t.url,redirected:Number(i.getInfo(e.info.REDIRECT_COUNT))>0});u.resolve(T),h=C;}),setImmediate(()=>{i.perform();}),u.promise}});var Xt=c(an=>{g();Object.defineProperty(an,"__esModule",{value:true});an.PonyfillURL=void 0;var kb=(at(),f(ot)),Tb=kb.__importDefault(a("buffer")),Cb=a("crypto"),Bc=globalThis.URL,wi=class extends Bc{static blobRegistry=new Map;static createObjectURL(e){let r=`blob:whatwgnode:${(0, Cb.randomUUID)()}`;return this.blobRegistry.set(r,e),r}static revokeObjectURL(e){this.blobRegistry.has(e)?this.blobRegistry.delete(e):Bc.revokeObjectURL(e);}static getBlobFromURL(e){return this.blobRegistry.get(e)||Tb.default?.resolveObjectURL?.(e)}};an.PonyfillURL=wi;});var cn=c(ln=>{g();Object.defineProperty(ln,"__esModule",{value:true});ln.PonyfillRequest=void 0;var Ab=a("http"),Rb=a("https"),Lb=nn(),Mc=sn(),Ob=Xt();function Fb(t){return t[Symbol.toStringTag]==="Request"}function Ib(t){return t?.href!=null}var Si=class extends Lb.PonyfillBody{constructor(e,r){let n,s,i=null,o;if(typeof e=="string"?n=e:Ib(e)?s=e:Fb(e)&&(e._parsedUrl?s=e._parsedUrl:e._url?n=e._url:n=e.url,i=e.body,o=e),r!=null&&(i=r.body||null,o=r),super(i,o),this._url=n,this._parsedUrl=s,this.cache=o?.cache||"default",this.credentials=o?.credentials||"same-origin",this.headers=o?.headers&&(0, Mc.isHeadersLike)(o.headers)?o.headers:new Mc.PonyfillHeaders(o?.headers),this.integrity=o?.integrity||"",this.keepalive=o?.keepalive!=null?o?.keepalive:false,this.method=o?.method?.toUpperCase()||"GET",this.mode=o?.mode||"cors",this.redirect=o?.redirect||"follow",this.referrer=o?.referrer||"about:client",this.referrerPolicy=o?.referrerPolicy||"no-referrer",this.headersSerializer=o?.headersSerializer,this.duplex=o?.duplex||"half",this.destination="document",this.priority="auto",this.method!=="GET"&&this.method!=="HEAD"&&this.handleContentLengthHeader(true),o?.agent!=null){let a=s?.protocol||n||this.url;o.agent===false?this.agent=false:a.startsWith("http:")&&o.agent instanceof Ab.Agent?this.agent=o.agent:a.startsWith("https:")&&o.agent instanceof Rb.Agent&&(this.agent=o.agent);}}headersSerializer;cache;credentials;destination;headers;integrity;keepalive;method;mode;priority;redirect;referrer;referrerPolicy;_url;get signal(){return this._signal||=new AbortController().signal,this._signal}get url(){if(this._url==null)if(this._parsedUrl)this._url=this._parsedUrl.toString();else throw new TypeError("Invalid URL");return this._url}_parsedUrl;get parsedUrl(){if(this._parsedUrl==null)if(this._url!=null)this._parsedUrl=new Ob.PonyfillURL(this._url,"http://localhost");else throw new TypeError("Invalid URL");return this._parsedUrl}duplex;agent;clone(){return this}[Symbol.toStringTag]="Request"};ln.PonyfillRequest=Si;});var Hc=c(Ei=>{g();Object.defineProperty(Ei,"__esModule",{value:true});Ei.fetchNodeHttp=zc;var Db=(at(),f(ot)),Gc=a("http"),jb=a("https"),$c=a("stream"),Ct=Db.__importDefault(a("zlib")),Nc=We(),qb=cn(),Ub=Yt(),Bb=Xt(),Re=be();function Mb(t){if(t.startsWith("http:"))return Gc.request;if(t.startsWith("https:"))return jb.request;throw new Error(`Unsupported protocol: ${t.split(":")[0]||t}`)}function zc(t){return new Promise((e,r)=>{try{let n=Mb(t.parsedUrl?.protocol||t.url),i=(t.headersSerializer||Re.getHeadersObj)(t.headers);i["accept-encoding"]||=Re.DEFAULT_ACCEPT_ENCODING,i["user-agent"]==null&&i["User-Agent"]==null&&(i["user-agent"]="node");let o;t._signal==null?o=void 0:t._signal&&(o=t._signal);let a;if(t.parsedUrl?a=n(t.parsedUrl,{method:t.method,headers:i,signal:o,agent:t.agent}):a=n(t.url,{method:t.method,headers:i,signal:o,agent:t.agent}),a.once("error",r),a.once("response",l=>{let c;switch(l.headers["content-encoding"]){case "x-gzip":case "gzip":c=Ct.default.createGunzip();break;case "x-deflate":case "deflate":c=Ct.default.createInflate();break;case "x-deflate-raw":case "deflate-raw":c=Ct.default.createInflateRaw();break;case "br":c=Ct.default.createBrotliDecompress();break;case "zstd":Ct.default.createZstdDecompress!=null&&(c=Ct.default.createZstdDecompress());break}if(l.headers.location&&(0,Re.shouldRedirect)(l.statusCode)){if(t.redirect==="error"){let _=new Error("Redirects are not allowed");r(_),l.resume();return}if(t.redirect==="follow"){let _=new Bb.PonyfillURL(l.headers.location,t.parsedUrl||t.url),w=zc(new qb.PonyfillRequest(_,t));e(w.then(R=>(R.redirected=!0,R))),l.resume();return}}c||=new $c.PassThrough,(0,Re.pipeThrough)({src:l,dest:c,signal:o,onError:_=>{l.destroyed||l.destroy(_),c.destroyed||c.destroy(_),r(_);}});let h=l.statusCode||200,d=l.statusMessage||Gc.STATUS_CODES[h];d==null&&(d="");let p=new Ub.PonyfillResponse(c||l,{status:h,statusText:d,headers:l.headers,url:t.url,signal:o});e(p);}),t._buffer!=null)(0,Nc.handleMaybePromise)(()=>(0,Re.safeWrite)(t._buffer,a),()=>(0,Re.endStream)(a),r);else if(t.bodyType==="String")(0,Nc.handleMaybePromise)(()=>(0,Re.safeWrite)(t.bodyInit,a),()=>(0,Re.endStream)(a),r);else {let l=t.body!=null?(0,Re.isNodeReadable)(t.body)?t.body:$c.Readable.from(t.body):null;l?l.pipe(a):(0,Re.endStream)(a);}}catch(n){r(n);}})}});var Qc=c(Pi=>{g();Object.defineProperty(Pi,"__esModule",{value:true});Pi.fetchPonyfill=Kc;var $b=a("buffer"),un=a("fs"),Nb=a("url"),Gb=Uc(),zb=Hc(),Hb=cn(),At=Yt(),Vb=Xt(),Vc=be(),Wc=";base64";async function Wb(t){let e=(0, Nb.fileURLToPath)(t);try{await un.promises.access(e,un.promises.constants.R_OK);let r=await un.promises.stat(e,{bigint:!0}),n=(0,un.createReadStream)(e);return new At.PonyfillResponse(n,{status:200,statusText:"OK",headers:{"content-type":"application/octet-stream","last-modified":r.mtime.toUTCString()}})}catch(r){if(r.code==="ENOENT")return new At.PonyfillResponse(null,{status:404,statusText:"Not Found"});if(r.code==="EACCES")return new At.PonyfillResponse(null,{status:403,statusText:"Forbidden"});throw r}}function Kb(t){let[e="text/plain",...r]=t.substring(5).split(","),n=decodeURIComponent(r.join(","));if(e.endsWith(Wc)){let s=$b.Buffer.from(n,"base64url"),i=e.slice(0,-Wc.length);return new At.PonyfillResponse(s,{status:200,statusText:"OK",headers:{"content-type":i}})}return new At.PonyfillResponse(n,{status:200,statusText:"OK",headers:{"content-type":e}})}function Qb(t){let e=Vb.PonyfillURL.getBlobFromURL(t);if(!e)throw new TypeError("Invalid Blob URL");return new At.PonyfillResponse(e,{status:200,headers:{"content-type":e.type,"content-length":e.size.toString()}})}function Zb(t){return t!=null&&t.href!=null}function Kc(t,e){if(typeof t=="string"||Zb(t)){let n=new Hb.PonyfillRequest(t,e);return Kc(n)}let r=t;if(r.url.startsWith("data:")){let n=Kb(r.url);return (0, Vc.fakePromise)(n)}if(r.url.startsWith("file:"))return Wb(r.url);if(r.url.startsWith("blob:")){let n=Qb(r.url);return (0, Vc.fakePromise)(n)}return globalThis.libcurl&&!r.agent?(0, Gb.fetchCurl)(r):(0, zb.fetchNodeHttp)(r)}});var Ti=c(ct=>{g();Object.defineProperty(ct,"__esModule",{value:true});ct.PonyfillTextDecoder=ct.PonyfillTextEncoder=void 0;ct.PonyfillBtoa=Yb;var er=a("buffer"),Jb=be(),vi=class{encoding;constructor(e="utf-8"){this.encoding=e;}encode(e){return er.Buffer.from(e,this.encoding)}encodeInto(e,r){let s=this.encode(e).copy(r);return {read:s,written:s}}};ct.PonyfillTextEncoder=vi;var ki=class{encoding;fatal=false;ignoreBOM=false;constructor(e="utf-8",r){this.encoding=e,r&&(this.fatal=r.fatal||false,this.ignoreBOM=r.ignoreBOM||false);}decode(e){return er.Buffer.isBuffer(e)?e.toString(this.encoding):(0, Jb.isArrayBufferView)(e)?er.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString(this.encoding):er.Buffer.from(e).toString(this.encoding)}};ct.PonyfillTextDecoder=ki;function Yb(t){return er.Buffer.from(t,"binary").toString("base64")}});var Zc=c(fn=>{g();Object.defineProperty(fn,"__esModule",{value:true});fn.PonyfillURLSearchParams=void 0;fn.PonyfillURLSearchParams=globalThis.URLSearchParams;});var Ri=c(dn=>{g();Object.defineProperty(dn,"__esModule",{value:true});dn.PonyfillWritableStream=void 0;var hn=a("events"),Ci=a("stream"),Jc=We(),Qe=be(),Ai=class{writable;constructor(e){if(e instanceof Ci.Writable)this.writable=e;else if(e){let r=new Ci.Writable({write(i,o,a){try{let l=e.write?.(i,s);l instanceof Promise?l.then(()=>{a();},c=>{a(c);}):a();}catch(l){a(l);}},final(i){let o=e.close?.();o instanceof Promise?o.then(()=>{i();},a=>{i(a);}):i();}});this.writable=r;let n=new AbortController,s={signal:n.signal,error(i){r.destroy(i);}};r.once("error",i=>n.abort(i)),r.once("close",()=>n.abort());}else this.writable=new Ci.Writable;}getWriter(){let e=this.writable;return {get closed(){return (0, hn.once)(e,"close")},get desiredSize(){return e.writableLength},get ready(){return (0, hn.once)(e,"drain")},releaseLock(){},write(r){let n=(0, Qe.fakePromise)();return r==null?n:n.then(()=>(0, Qe.safeWrite)(r,e))},close(){return !e.errored&&e.closed?(0, Qe.fakePromise)():e.errored?(0, Jc.fakeRejectPromise)(e.errored):(0, Qe.fakePromise)().then(()=>(0, Qe.endStream)(e))},abort(r){return e.destroy(r),(0, hn.once)(e,"close")}}}close(){return !this.writable.errored&&this.writable.closed?(0, Qe.fakePromise)():this.writable.errored?(0, Jc.fakeRejectPromise)(this.writable.errored):(0, Qe.fakePromise)().then(()=>(0, Qe.endStream)(this.writable))}abort(e){return this.writable.destroy(e),(0, hn.once)(this.writable,"close")}locked=false};dn.PonyfillWritableStream=Ai;});var tr=c(pn=>{g();Object.defineProperty(pn,"__esModule",{value:true});pn.PonyfillTransformStream=void 0;var Li=a("stream"),Xb=kt(),ey=be(),ty=Ri(),Oi=class{transform;writable;readable;constructor(e){if(e instanceof Li.Transform)this.transform=e;else if(e){let r={enqueue(s){n.push(s);},error(s){n.destroy(s);},terminate(){(0, ey.endStream)(n);},get desiredSize(){return n.writableLength}},n=new Li.Transform({read(){},write(s,i,o){try{let a=e.transform?.(s,r);a instanceof Promise?a.then(()=>{o();},l=>{o(l);}):o();}catch(a){o(a);}},final(s){try{let i=e.flush?.(r);i instanceof Promise?i.then(()=>{s();},o=>{s(o);}):s();}catch(i){s(i);}}});this.transform=n;}else this.transform=new Li.Transform;this.writable=new ty.PonyfillWritableStream(this.transform),this.readable=new Xb.PonyfillReadableStream(this.transform);}};pn.PonyfillTransformStream=Oi;});var Yc=c(mn=>{g();Object.defineProperty(mn,"__esModule",{value:true});mn.PonyfillCompressionStream=void 0;var ry=(at(),f(ot)),rr=ry.__importDefault(a("zlib")),ny=tr(),sy=be(),Fi=class extends ny.PonyfillTransformStream{static supportedFormats=(0, sy.getSupportedFormats)();constructor(e){switch(e){case "x-gzip":case "gzip":super(rr.default.createGzip());break;case "x-deflate":case "deflate":super(rr.default.createDeflate());break;case "deflate-raw":super(rr.default.createDeflateRaw());break;case "br":super(rr.default.createBrotliCompress());break;case "zstd":super(rr.default.createZstdCompress());break;default:throw new Error(`Unsupported compression format: ${e}`)}}};mn.PonyfillCompressionStream=Fi;});var Xc=c(bn=>{g();Object.defineProperty(bn,"__esModule",{value:true});bn.PonyfillDecompressionStream=void 0;var iy=(at(),f(ot)),nr=iy.__importDefault(a("zlib")),oy=tr(),ay=be(),Ii=class extends oy.PonyfillTransformStream{static supportedFormats=(0, ay.getSupportedFormats)();constructor(e){switch(e){case "x-gzip":case "gzip":super(nr.default.createGunzip());break;case "x-deflate":case "deflate":super(nr.default.createInflate());break;case "deflate-raw":super(nr.default.createInflateRaw());break;case "br":super(nr.default.createBrotliDecompress());break;case "zstd":super(nr.default.createZstdDecompress());break;default:throw new TypeError(`Unsupported compression format: '${e}'`)}}};bn.PonyfillDecompressionStream=Ii;});var ru=c(Rt=>{g();Object.defineProperty(Rt,"__esModule",{value:true});Rt.PonyfillTextEncoderStream=Rt.PonyfillTextDecoderStream=void 0;var eu=Ti(),tu=tr(),Di=class extends tu.PonyfillTransformStream{textDecoder;constructor(e,r){super({transform:(n,s)=>s.enqueue(this.textDecoder.decode(n,{stream:true}))}),this.textDecoder=new eu.PonyfillTextDecoder(e,r);}get encoding(){return this.textDecoder.encoding}get fatal(){return this.textDecoder.fatal}get ignoreBOM(){return this.textDecoder.ignoreBOM}};Rt.PonyfillTextDecoderStream=Di;var ji=class extends tu.PonyfillTransformStream{textEncoder;constructor(e){super({transform:(r,n)=>n.enqueue(this.textEncoder.encode(r))}),this.textEncoder=new eu.PonyfillTextEncoder(e);}get encoding(){return this.textEncoder.encoding}encode(e){return this.textEncoder.encode(e)}};Rt.PonyfillTextEncoderStream=ji;});var su=c(U=>{g();Object.defineProperty(U,"__esModule",{value:true});U.TextEncoderStream=U.TextDecoderStream=U.IteratorObject=U.DecompressionStream=U.CompressionStream=U.TransformStream=U.WritableStream=U.URLSearchParams=U.URL=U.btoa=U.TextDecoder=U.TextEncoder=U.Blob=U.FormData=U.File=U.ReadableStream=U.Response=U.Request=U.Body=U.Headers=U.fetch=void 0;var ly=Qc();Object.defineProperty(U,"fetch",{enumerable:true,get:function(){return ly.fetchPonyfill}});var cy=sn();Object.defineProperty(U,"Headers",{enumerable:true,get:function(){return cy.PonyfillHeaders}});var uy=nn();Object.defineProperty(U,"Body",{enumerable:true,get:function(){return uy.PonyfillBody}});var fy=cn();Object.defineProperty(U,"Request",{enumerable:true,get:function(){return fy.PonyfillRequest}});var hy=Yt();Object.defineProperty(U,"Response",{enumerable:true,get:function(){return hy.PonyfillResponse}});var dy=kt();Object.defineProperty(U,"ReadableStream",{enumerable:true,get:function(){return dy.PonyfillReadableStream}});var py=si();Object.defineProperty(U,"File",{enumerable:true,get:function(){return py.PonyfillFile}});var my=di();Object.defineProperty(U,"FormData",{enumerable:true,get:function(){return my.PonyfillFormData}});var by=Hr();Object.defineProperty(U,"Blob",{enumerable:true,get:function(){return by.PonyfillBlob}});var qi=Ti();Object.defineProperty(U,"TextEncoder",{enumerable:true,get:function(){return qi.PonyfillTextEncoder}});Object.defineProperty(U,"TextDecoder",{enumerable:true,get:function(){return qi.PonyfillTextDecoder}});Object.defineProperty(U,"btoa",{enumerable:true,get:function(){return qi.PonyfillBtoa}});var yy=Xt();Object.defineProperty(U,"URL",{enumerable:true,get:function(){return yy.PonyfillURL}});var gy=Zc();Object.defineProperty(U,"URLSearchParams",{enumerable:true,get:function(){return gy.PonyfillURLSearchParams}});var xy=Ri();Object.defineProperty(U,"WritableStream",{enumerable:true,get:function(){return xy.PonyfillWritableStream}});var _y=tr();Object.defineProperty(U,"TransformStream",{enumerable:true,get:function(){return _y.PonyfillTransformStream}});var wy=Yc();Object.defineProperty(U,"CompressionStream",{enumerable:true,get:function(){return wy.PonyfillCompressionStream}});var Sy=Xc();Object.defineProperty(U,"DecompressionStream",{enumerable:true,get:function(){return Sy.PonyfillDecompressionStream}});var Ey=en();Object.defineProperty(U,"IteratorObject",{enumerable:true,get:function(){return Ey.PonyfillIteratorObject}});var nu=ru();Object.defineProperty(U,"TextDecoderStream",{enumerable:true,get:function(){return nu.PonyfillTextDecoderStream}});Object.defineProperty(U,"TextEncoderStream",{enumerable:true,get:function(){return nu.PonyfillTextEncoderStream}});});var ou=c((o1,iu)=>{g();var Py=_s(),V;iu.exports=function(e={}){let r={};if(r.URLPattern=globalThis.URLPattern,!r.URLPattern){let n=(al(),f(ol));r.URLPattern=n.URLPattern;}if(e.skipPonyfill||Py())return {fetch:globalThis.fetch,Headers:globalThis.Headers,Request:globalThis.Request,Response:globalThis.Response,FormData:globalThis.FormData,ReadableStream:globalThis.ReadableStream,WritableStream:globalThis.WritableStream,TransformStream:globalThis.TransformStream,CompressionStream:globalThis.CompressionStream,DecompressionStream:globalThis.DecompressionStream,TextDecoderStream:globalThis.TextDecoderStream,TextEncoderStream:globalThis.TextEncoderStream,Blob:globalThis.Blob,File:globalThis.File,crypto:globalThis.crypto,btoa:globalThis.btoa,TextEncoder:globalThis.TextEncoder,TextDecoder:globalThis.TextDecoder,URLPattern:r.URLPattern,URL:globalThis.URL,URLSearchParams:globalThis.URLSearchParams};if(V||=su(),r.fetch=V.fetch,r.Request=V.Request,r.Response=V.Response,r.Headers=V.Headers,r.FormData=V.FormData,r.ReadableStream=V.ReadableStream,r.URL=V.URL,r.URLSearchParams=V.URLSearchParams,r.WritableStream=V.WritableStream,r.TransformStream=V.TransformStream,r.CompressionStream=V.CompressionStream,r.DecompressionStream=V.DecompressionStream,r.TextDecoderStream=V.TextDecoderStream,r.TextEncoderStream=V.TextEncoderStream,r.Blob=V.Blob,r.File=V.File,r.crypto=globalThis.crypto,r.btoa=V.btoa,r.TextEncoder=V.TextEncoder,r.TextDecoder=V.TextDecoder,e.formDataLimits&&(r.Body=class extends V.Body{constructor(s,i){super(s,{formDataLimits:e.formDataLimits,...i});}},r.Request=class extends V.Request{constructor(s,i){super(s,{formDataLimits:e.formDataLimits,...i});}},r.Response=class extends V.Response{constructor(s,i){super(s,{formDataLimits:e.formDataLimits,...i});}}),!r.crypto){let n=a("crypto");r.crypto=n.webcrypto;}return r};});var sr=c((lu,K)=>{g();var au=ou(),vy=_s(),Z=au();if(!vy())try{let t="node-libcurl";globalThis.libcurl=globalThis.libcurl||a(t);}catch{}K.exports.fetch=Z.fetch;K.exports.Headers=Z.Headers;K.exports.Request=Z.Request;K.exports.Response=Z.Response;K.exports.FormData=Z.FormData;K.exports.ReadableStream=Z.ReadableStream;K.exports.WritableStream=Z.WritableStream;K.exports.TransformStream=Z.TransformStream;K.exports.CompressionStream=Z.CompressionStream;K.exports.DecompressionStream=Z.DecompressionStream;K.exports.TextDecoderStream=Z.TextDecoderStream;K.exports.TextEncoderStream=Z.TextEncoderStream;K.exports.Blob=Z.Blob;K.exports.File=Z.File;K.exports.crypto=Z.crypto;K.exports.btoa=Z.btoa;K.exports.TextEncoder=Z.TextEncoder;K.exports.TextDecoder=Z.TextDecoder;K.exports.URLPattern=Z.URLPattern;K.exports.URL=Z.URL;K.exports.URLSearchParams=Z.URLSearchParams;lu.createFetch=au;});g();function mr(t,e){for(let r of t){if(r.name===e)return true;if("tabs"in r&&r.tabs){for(let n of r.tabs)if(mr(n.fields,e))return true}if("fields"in r&&r.fields&&mr(r.fields,e))return true}return false}var Hn=class extends Error{errors;constructor(e){super(`Configuration validation failed:
|
|
20
20
|
${e.join(`
|
|
21
|
-
`)}`),this.name="ConfigValidationError",this.errors=e;}};function Vn(t){let e=[];if(t.slug?/^[a-z][a-z0-9_-]*$/.test(t.slug)||e.push(`Collection slug "${t.slug}" must be lowercase alphanumeric with dashes`):e.push('Collection is missing a "slug" property'),!t.fields||t.fields.length===0)e.push(`Collection "${t.slug}" has no fields defined`);else {let r=Ye(t.fields,t.slug);e.push(...r);}if(t.access)for(let[r,n]of Object.entries(t.access))typeof n!="boolean"&&typeof n!="function"&&e.push(`Collection "${t.slug}" has invalid access.${r} (must be boolean or function)`);if(t.admin?.useAsTitle&&(mr(t.fields,t.admin.useAsTitle)||e.push(`Collection "${t.slug}" admin.useAsTitle references unknown field "${t.admin.useAsTitle}"`)),t.admin?.defaultColumns)for(let r of t.admin.defaultColumns)mr(t.fields,r)||e.push(`Collection "${t.slug}" admin.defaultColumns references unknown field "${r}"`);if(t.upload&&t.upload.fileSize&&t.upload.fileSize<=0&&e.push(`Collection "${t.slug}" upload.fileSize must be positive`),t.versions&&t.versions.maxPerDoc&&t.versions.maxPerDoc<=0&&e.push(`Collection "${t.slug}" versions.maxPerDoc must be positive`),t.auth){let r=t.fields.some(s=>s.name==="email"),n=t.fields.some(s=>s.name==="password");r||e.push(`Collection "${t.slug}" with auth enabled requires an "email" field`),n||e.push(`Collection "${t.slug}" with auth enabled requires a "password" field`);}return e}function Wn(t){let e=[];if(t.slug?/^[a-z][a-z0-9_-]*$/.test(t.slug)||e.push(`Global slug "${t.slug}" must be lowercase alphanumeric with dashes`):e.push('Global is missing a "slug" property'),!t.fields||t.fields.length===0)e.push(`Global "${t.slug}" has no fields defined`);else {let r=Ye(t.fields,`global:${t.slug}`);e.push(...r);}return e}function Ye(t,e){let r=[],n=new Set;for(let s=0;s<t.length;s++){let i=t[s];if(i.type==="row"||i.type==="collapsible"||i.type==="tabs"){if("fields"in i&&i.fields){let a=Ye(i.fields,e);r.push(...a);}else if("tabs"in i)for(let a of i.tabs){let l=Ye(a.fields,e);r.push(...l);}continue}let o=i.name;if(!o){r.push(`${e}: Field at index ${s} is missing a "name" property`);continue}if(n.has(o)&&r.push(`${e}: Duplicate field name "${o}"`),n.add(o),/^[a-zA-Z][a-zA-Z0-9_]*$/.test(o)||r.push(`${e}: Field name "${o}" must be alphanumeric with underscores`),!i.type){r.push(`${e}: Field "${o}" is missing a "type" property`);continue}switch(i.type){case "relationship":i.relationTo||r.push(`${e}: Relationship field "${o}" is missing "relationTo"`);break;case "array":if(!i.fields||i.fields.length===0)r.push(`${e}: Array field "${o}" has no fields defined`);else {let a=Ye(i.fields,`${e}.${o}`);r.push(...a);}break;case "group":if(!i.fields||i.fields.length===0)r.push(`${e}: Group field "${o}" has no fields defined`);else {let a=Ye(i.fields,`${e}.${o}`);r.push(...a);}break;case "blocks":if(!i.blocks||i.blocks.length===0)r.push(`${e}: Blocks field "${o}" has no blocks defined`);else {let a=bd(i.blocks,`${e}.${o}`);r.push(...a);}break;case "select":case "radio":if(typeof i.options=="function")break;if((!i.options||i.options.length===0)&&!i.dynamicOptions)r.push(`${e}: ${i.type} field "${o}" has no options defined`);else if(Array.isArray(i.options)){let a=i.options.map(c=>c.value),l=new Set(a);a.length!==l.size&&r.push(`${e}: ${i.type} field "${o}" has duplicate option values`);}break;case "upload":i.relationTo||r.push(`${e}: Upload field "${o}" is missing "relationTo"`);break}"min"in i&&"max"in i&&i.min>i.max&&r.push(`${e}: Field "${o}" has min greater than max`),"minLength"in i&&"maxLength"in i&&i.minLength>i.maxLength&&r.push(`${e}: Field "${o}" has minLength greater than maxLength`),"minRows"in i&&"maxRows"in i&&i.minRows>i.maxRows&&r.push(`${e}: Field "${o}" has minRows greater than maxRows`);}return r}function bd(t,e){let r=[],n=new Set;for(let s of t){if(!s.slug){r.push(`${e}: Block is missing a "slug" property`);continue}if(n.has(s.slug)&&r.push(`${e}: Duplicate block slug "${s.slug}"`),n.add(s.slug),s.label||r.push(`${e}: Block "${s.slug}" is missing a "label" property`),!s.fields||s.fields.length===0)r.push(`${e}: Block "${s.slug}" has no fields defined`);else {let i=Ye(s.fields,`${e}.${s.slug}`);r.push(...i);}}return r}function ko(t,e=[]){let r=[],n=new Set;for(let s of t)n.has(s.slug)&&r.push(`Duplicate collection slug "${s.slug}"`),n.add(s.slug);for(let s of e)n.has(s.slug)&&r.push(`Duplicate global slug "${s.slug}"`),n.add(s.slug);for(let s of t){let i=Vn(s);r.push(...i);}for(let s of e){let i=Wn(s);r.push(...i);}for(let s of t){let i=pr(s.fields,t);r.push(...i);}if(r.length>0)throw new Hn(r)}function pr(t,e){let r=[],n=new Set(e.map(s=>s.slug));for(let s of t){if(s.type==="relationship"){let i=Array.isArray(s.relationTo)?s.relationTo:[s.relationTo];for(let o of i)o!=="*"&&!n.has(o)&&console.warn(`[Kyro Config Warning]: Relationship field "${s.name}" references unknown collection "${o}". Select options will not be available until this collection is registered.`);}if(s.type==="upload"){let i=Array.isArray(s.relationTo)?s.relationTo:[s.relationTo];for(let o of i)n.has(o)||r.push(`Upload field "${s.name}" references unknown collection "${o}"`);}if("fields"in s&&s.fields){let i=pr(s.fields,e);r.push(...i);}if("tabs"in s)for(let i of s.tabs){let o=pr(i.fields,e);r.push(...o);}if("blocks"in s)for(let i of s.blocks){let o=pr(i.fields,e);r.push(...o);}}return r}var y={};d(y,{BRAND:()=>ca$1,DIRTY:()=>p,EMPTY_PATH:()=>l,INVALID:()=>o,NEVER:()=>Wa$1,OK:()=>q,ParseStatus:()=>n,Schema:()=>v,ZodAny:()=>F$1,ZodArray:()=>J,ZodBigInt:()=>z$1,ZodBoolean:()=>A$1,ZodBranded:()=>da$1,ZodCatch:()=>aa$1,ZodDate:()=>B$1,ZodDefault:()=>$,ZodDiscriminatedUnion:()=>M,ZodEffects:()=>Y,ZodEnum:()=>V,ZodError:()=>g$1,ZodFirstPartyTypeKind:()=>ia$1,ZodFunction:()=>S,ZodIntersection:()=>N$1,ZodIssueCode:()=>e,ZodLazy:()=>T,ZodLiteral:()=>U,ZodMap:()=>Q$1,ZodNaN:()=>ba$1,ZodNativeEnum:()=>W,ZodNever:()=>H$1,ZodNull:()=>E,ZodNullable:()=>_,ZodNumber:()=>y$1,ZodObject:()=>K,ZodOptional:()=>Z,ZodParsedType:()=>c$1,ZodPipeline:()=>ea$1,ZodPromise:()=>X,ZodReadonly:()=>fa$1,ZodRecord:()=>P,ZodSchema:()=>v,ZodSet:()=>R,ZodString:()=>x,ZodSymbol:()=>C,ZodTransformer:()=>Y,ZodTuple:()=>O,ZodType:()=>v,ZodUndefined:()=>D,ZodUnion:()=>L,ZodUnknown:()=>G$1,ZodVoid:()=>I,addIssueToContext:()=>m,any:()=>ta$1,array:()=>xa$1,bigint:()=>na$1,boolean:()=>oa$1,coerce:()=>Va$1,custom:()=>ga$1,date:()=>pa$1,datetimeRegex:()=>w,defaultErrorMap:()=>h,discriminatedUnion:()=>Ba$1,effect:()=>Na$1,enum:()=>Ka$1,function:()=>Ha$1,getErrorMap:()=>j,getParsedType:()=>d$1,instanceof:()=>ja,intersection:()=>Ca$1,isAborted:()=>r,isAsync:()=>u,isDirty:()=>s,isValid:()=>t,late:()=>ha$1,lazy:()=>Ia$1,literal:()=>Ja$1,makeIssue:()=>k,map:()=>Fa$1,nan:()=>ma$1,nativeEnum:()=>La$1,never:()=>va$1,null:()=>sa$1,nullable:()=>Pa$1,number:()=>la$1,object:()=>ya$1,objectUtil:()=>b$1,oboolean:()=>Ua$1,onumber:()=>Ta$1,optional:()=>Oa$1,ostring:()=>Sa$1,pipeline:()=>Ra$1,preprocess:()=>Qa$1,promise:()=>Ma$1,quotelessJson:()=>f$1,record:()=>Ea$1,set:()=>Ga$1,setErrorMap:()=>i,strictObject:()=>za$1,string:()=>ka$1,symbol:()=>qa$1,transformer:()=>Na$1,tuple:()=>Da$1,undefined:()=>ra$1,union:()=>Aa$1,unknown:()=>ua$1,util:()=>a$1,void:()=>wa$1});g();g();g();function ae(t){switch(t.type){case "text":return yd(t);case "number":return gd(t);case "checkbox":return xd(t);case "date":return _d(t);case "email":return wd(t);case "password":return Sd(t);case "textarea":return Ed(t);case "select":return Pd(t);case "radio":return vd(t);case "color":return kd(t);case "richtext":return Td(t);case "json":return Cd(t);case "code":return Ad(t);case "upload":return To(t);case "image":return To(t);case "markdown":return Rd(t);case "relationship":return Co(t);case "relationship-block":return Co(t);case "array":return Ld(t);case "list":return Od(t);case "group":return Fd(t);case "blocks":return Id(t);case "row":return Dd(t);case "collapsible":return jd(t);case "tabs":return qd(t);default:return y.any()}}function yd(t){let e=y.string();return t.minLength&&(e=e.min(t.minLength)),t.maxLength&&(e=e.max(t.maxLength)),t.pattern&&(e=e.regex(new RegExp(t.pattern))),t.variant==="email"&&(e=e.email()),t.variant==="url"&&(e=e.url()),t.hasMany&&(e=y.array(e)),t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function gd(t){let e=t.integer?y.coerce.number().int():y.coerce.number();return t.min!==void 0&&(e=e.min(t.min)),t.max!==void 0&&(e=e.max(t.max)),t.step&&(e=e.refine(r=>Number.isInteger(r/t.step),`Value must be divisible by ${t.step}`)),t.hasMany&&(e=y.array(e)),t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function xd(t){let e=y.boolean();return t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function _d(t){let e=y.string().refine(r=>!isNaN(Date.parse(r)),"Invalid date format");return t.minDate&&(e=e.refine(r=>new Date(r)>=new Date(t.minDate),`Date must be after ${t.minDate}`)),t.maxDate&&(e=e.refine(r=>new Date(r)<=new Date(t.maxDate),`Date must be before ${t.maxDate}`)),t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function wd(t){let e=y.string().email("Invalid email");return t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function Sd(t){let e=y.string().min(6,"Password must be at least 6 characters");return t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function Ed(t){let e=y.string();return t.minLength&&(e=e.min(t.minLength)),t.maxLength&&(e=e.max(t.maxLength)),t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function Pd(t){let e;if(Array.isArray(t.options)&&t.options.length>0){let r=t.options.map(n=>n.value);t.hasMany?e=y.array(y.enum(r)):e=y.enum(r);}else e=t.hasMany?y.array(y.string()):y.string();return t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function vd(t){let e;if(Array.isArray(t.options)&&t.options.length>0){let r=t.options.map(n=>n.value);e=y.enum(r);}else e=y.string();return t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function kd(t){let e=y.string();return t.format==="hex"&&(e=e.regex(/^#[0-9A-Fa-f]{6}$/)),t.format==="rgb"&&(e=e.regex(/^rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\)$/)),t.format==="hsl"&&(e=e.regex(/^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/)),t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function Td(t){let e=y.array(y.record(y.any()));return t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function Cd(t){let e=y.union([y.record(y.any()),y.array(y.any())]);return t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function Ad(t){let e=y.string();return t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function To(t){let e;if(t.relationTo){let r=y.object({id:y.string(),url:y.string().optional(),filename:y.string().optional(),mimeType:y.string().optional()});e=y.union([y.string(),r]);}else e=y.string();return t.hasMany&&(e=y.array(e)),t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function Rd(t){let e=y.string();return t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function Co(t){let e;return Array.isArray(t.relationTo)?e=y.object({relationTo:y.enum(t.relationTo),value:y.string()}):e=y.union([y.string(),y.object({relationTo:y.string(),value:y.string()})]),t.hasMany&&(e=y.array(e)),t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function Ld(t){let e=y.object(Object.fromEntries(t.fields.filter(n=>n.name).map(n=>[n.name,ae(n)]))).passthrough(),r=y.array(e);return t.minRows&&(r=r.min(t.minRows)),t.maxRows&&(r=r.max(t.maxRows)),t.required||(r=r.optional().nullable()),t.validate&&(r=ee(r,t.validate)),r}function Od(t){let e=y.array(y.string());return t.required||(e=e.optional().nullable()),e}function Fd(t){let e=y.object(Object.fromEntries(t.fields.filter(r=>r.name).map(r=>[r.name,ae(r)])));return t.required?e:e.optional().nullable()}function Id(t){let e=t.blocks||[];e.map(i=>y.object({blockType:y.literal(i.slug),...Object.fromEntries(i.fields.filter(o=>o.name).map(o=>[o.name,ae(o)]))}));let n=e.map(i=>i.slug),s;if(n.length>0){let i=y.object({blockType:y.enum(n)}).catchall(y.any()),o=y.object({blockType:y.string()}).catchall(y.any());s=y.array(y.union([i,o,y.record(y.any())]));}else s=y.array(y.union([y.object({blockType:y.string()}).catchall(y.any()),y.record(y.any())]));return t.minRows&&(s=s.min(t.minRows)),t.maxRows&&(s=s.max(t.maxRows)),t.required||(s=s.optional().nullable()),t.validate&&(s=ee(s,t.validate)),s}function Dd(t){return y.object(Object.fromEntries(t.fields.filter(r=>r.name).map(r=>[r.name,ae(r)])))}function jd(t){return y.object(Object.fromEntries(t.fields.filter(r=>r.name).map(r=>[r.name,ae(r)])))}function qd(t){let e={};for(let r of t.tabs)for(let n of r.fields)n.name&&(e[n.name]=ae(n));return y.object(e).passthrough().optional()}function ee(t,e){return t.refine(async r=>await e(r,{required:false})===true,{message:"Custom validation failed"})}function pt(t){let e={};for(let r of t)if(r.type==="tabs"&&"tabs"in r){let n={};for(let s of r.tabs){let i=pt(s.fields);Object.assign(n,i);}r.name?e[r.name]=y.object(n).passthrough().optional():Object.assign(e,n);}else if(r.type==="row"&&"fields"in r){let n=pt(r.fields);r.name?e[r.name]=y.object(n).passthrough().optional():Object.assign(e,n);}else if(r.type==="collapsible"&&"fields"in r){let n=pt(r.fields);r.name?e[r.name]=y.object(n).passthrough().optional():Object.assign(e,n);}else {if(!r.name)continue;e[r.name]=ae(r);}return e}function Fe(t){let e={};for(let r of t)if(r.type==="tabs"&&"tabs"in r){let n={};for(let s of r.tabs){let i=Fe(s.fields);Object.assign(n,i);}r.name?e[r.name]=y.object(n).passthrough().optional().nullable():Object.assign(e,n);}else if(r.type==="row"&&"fields"in r){let n=Fe(r.fields);r.name?e[r.name]=y.object(n).passthrough().optional().nullable():Object.assign(e,n);}else if(r.type==="collapsible"&&"fields"in r){let n=Fe(r.fields);r.name?e[r.name]=y.object(n).passthrough().optional().nullable():Object.assign(e,n);}else if(r.type==="group"&&"fields"in r)r.name?e[r.name]=y.object(Fe(r.fields)).passthrough().optional().nullable():Object.assign(e,Fe(r.fields));else {if(!r.name)continue;e[r.name]=ae(r).optional().nullable();}return e}function Ao(t){let e=pt(t.fields);return t.timestamps&&(e.createdAt=y.string().optional(),e.updatedAt=y.string().optional()),t.tenantScoped&&(e.tenantId=y.string().optional()),e.id=y.string().optional(),y.object(e).passthrough()}function Ro(t){let e=pt(t.fields);return y.object(e).passthrough()}function Lo(t){let e={};for(let r of t.fields)if(r.name)if(r.type==="tabs"&&"tabs"in r){let n={};for(let s of r.tabs)for(let i of s.fields)i.name&&(n[i.name]=ae(i).optional().nullable());e[r.name]=y.object(n).optional().nullable();}else if(r.type==="row"&&"fields"in r){let n={};for(let s of r.fields)s.name&&(n[s.name]=ae(s).optional().nullable());Object.assign(e,n);}else r.type==="collapsible"&&"fields"in r?e[r.name]=y.object(Fe(r.fields)).optional().nullable():r.type==="group"&&"fields"in r?e[r.name]=y.object(Fe(r.fields)).optional().nullable():e[r.name]=ae(r).optional().nullable();return y.object(e).passthrough()}function Oo(t){let e={};for(let r of t.fields)r.name&&(e[r.name]=y.object({equals:y.any().optional(),not_equals:y.any().optional(),in:y.array(y.any()).optional(),not_in:y.array(y.any()).optional(),greater_than:y.number().optional(),greater_than_equal:y.number().optional(),less_than:y.number().optional(),less_than_equal:y.number().optional(),like:y.string().optional(),not_like:y.string().optional(),contains:y.string().optional(),exists:y.boolean().optional()}).optional());return e.AND=y.array(y.lazy(()=>y.object(e))).optional(),e.OR=y.array(y.lazy(()=>y.object(e))).optional(),y.object(e).optional()}function Fo(t){let e=pt(t.fields);return e.id=y.string().optional(),y.object(e).passthrough()}function Io(t){let e={};for(let r of t.fields)if(r.name)if(r.type==="tabs"&&"tabs"in r){let n={};for(let s of r.tabs)for(let i of s.fields)i.name&&(n[i.name]=ae(i).optional().nullable());e[r.name]=y.object(n).optional().nullable();}else r.type==="collapsible"&&"fields"in r?e[r.name]=y.object(Fe(r.fields)).optional().nullable():r.type==="group"&&"fields"in r?e[r.name]=y.object(Fe(r.fields)).optional().nullable():e[r.name]=ae(r).optional().nullable();return y.object(e).passthrough()}g();var qt=class{storageProviders=$a$1();collections=new Map;globals=new Map;plugins=[];schemaCache=new Map;initialized=false;addCollection(e){if(this.initialized)throw new Error("Cannot add collections after Registry has been initialized");if(this.collections.has(e.slug)){console.warn(`[Registry] Duplicate collection slug "${e.slug}" \u2014 skipping`);return}let r={...e,fields:[...e.fields]};for(let s of this.plugins){let i=s.extensions?.collections?.find(o=>o.slug===r.slug);i&&(r={...r,...i.config,fields:[...r.fields,...i.config.fields||[]]});}if(r.seo){let s=a$2(),i=r.fields.findIndex(o=>o.type==="tabs");if(i!==-1){let o=r.fields[i];r.fields[i]={...o,tabs:[...o.tabs,{label:"SEO Settings",fields:s.fields}]};}else r.fields.push(s);}r.fields=this.applyFieldDefaults(r);let n=Vn(r);if(n.length>0)throw new Error(`Invalid collection config: ${n.join(", ")}`);this.collections.set(r.slug,r),this.clearSchemaCache(r.slug);}addCollections(e){for(let r of e)this.addCollection(r);}getCollection(e){return this.collections.get(e)}getCollections(){return Array.from(this.collections.values())}getCollectionSlugs(){return Array.from(this.collections.keys())}hasCollection(e){return this.collections.has(e)}removeCollection(e){if(this.initialized)throw new Error("Cannot remove collections after Registry has been initialized");return this.clearSchemaCache(e),this.collections.delete(e)}addGlobal(e){if(this.initialized)throw new Error("Cannot add globals after Registry has been initialized");this._addGlobalUnsafe(e);}addGlobalPostInit(e){this.globals.has(e.slug)&&this.globals.delete(e.slug),this._addGlobalUnsafe(e);}_addGlobalUnsafe(e){if(this.globals.has(e.slug)){console.warn(`[Registry] Duplicate global slug "${e.slug}" \u2014 skipping`);return}let r=Wn(e);if(r.length>0)throw new Error(`Invalid global config: ${r.join(", ")}`);let n={...e};for(let s of this.plugins){let i=s.extensions?.globals?.find(o=>o.slug===n.slug);i&&(n={...n,...i.config,fields:[...n.fields||[],...i.config.fields||[]]});}this.globals.set(n.slug,n),this.clearSchemaCache(`global:${n.slug}`);}addGlobals(e){for(let r of e)this.addGlobal(r);}getGlobal(e){return this.globals.get(e)}getGlobals(){return Array.from(this.globals.values())}getGlobalSlugs(){return Array.from(this.globals.keys())}hasGlobal(e){return this.globals.has(e)}removeGlobal(e){if(this.initialized)throw new Error("Cannot remove globals after Registry has been initialized");return this.clearSchemaCache(`global:${e}`),this.globals.delete(e)}addPlugin(e){if(this.initialized)throw new Error("Cannot add plugins after Registry has been initialized");this.plugins.push(e);}getPlugins(){return [...this.plugins]}getZodSchema(e){let r=this.schemaCache.get(e);if(r)return r;let n=this.collections.get(e);if(n){let i=Ao(n);return this.schemaCache.set(e,i),i}let s=this.globals.get(e);if(s){let i=Fo(s);return this.schemaCache.set(`global:${e}`,i),i}throw new Error(`No collection or global found with slug "${e}"`)}getCreateZodSchema(e){let r=`${e}:create`,n=this.schemaCache.get(r);if(n)return n;let s=this.collections.get(e);if(s){let i=Ro(s);return this.schemaCache.set(r,i),i}throw new Error(`No collection found with slug "${e}"`)}getUpdateZodSchema(e){let r=`${e}:update`,n=this.schemaCache.get(r);if(n)return n;let s=this.collections.get(e);if(s){let o=Lo(s);return this.schemaCache.set(r,o),o}let i=this.globals.get(e);if(i){let o=Io(i);return this.schemaCache.set(`global:${e}:update`,o),o}throw new Error(`No collection or global found with slug "${e}"`)}getWhereZodSchema(e){let r=`${e}:where`,n=this.schemaCache.get(r);if(n)return n;let s=this.collections.get(e);if(s){let i=Oo(s);return this.schemaCache.set(r,i),i}throw new Error(`No collection found with slug "${e}"`)}getFieldZodSchema(e){return ae(e)}clearSchemaCache(e){this.schemaCache.delete(e),this.schemaCache.delete(`${e}:create`),this.schemaCache.delete(`${e}:update`),this.schemaCache.delete(`${e}:where`);}applyFieldDefaults(e){let r=[...e.fields];return r.some(n=>n.name==="id")||r.unshift({name:"id",type:"text",admin:{readOnly:true,hidden:true}}),e.tenantScoped&&!r.some(n=>n.name==="tenantId")&&r.push({name:"tenantId",type:"text",required:true,admin:{readOnly:true,hidden:true}}),e.timestamps&&!r.some(n=>n.name==="createdAt")&&(r.push({name:"createdAt",type:"date",admin:{readOnly:true,hidden:true}}),r.push({name:"updatedAt",type:"date",admin:{readOnly:true,hidden:true}})),e.versions?.drafts&&!r.some(n=>n.name==="status")&&r.push({name:"status",type:"select",options:[{value:"draft",label:"Draft"},{value:"published",label:"Published"}],admin:{readOnly:true,hidden:true}}),e.auth&&!r.some(n=>n.name==="password")&&r.push({name:"password",type:"password",required:true,admin:{hidden:true}}),r}getFields(e){let r=this.collections.get(e);if(r)return r.fields;let n=this.globals.get(e);if(n)return n.fields;throw new Error(`No collection or global found with slug "${e}"`)}getFieldMap(e){let r=this.getFields(e),n=new Map,s=i=>{for(let o of i){if(o.name&&n.set(o.name,o),"fields"in o&&o.fields&&s(o.fields),"tabs"in o)for(let a of o.tabs)s(a.fields);if("blocks"in o)for(let a of o.blocks)s(a.fields);}};return s(r),n}getVisibleFields(e){return this.getFields(e).filter(n=>!n.admin?.hidden)}validate(){let e=this.getCollections(),r=this.getGlobals();ko(e,r);}async init(e){this.validate();for(let r of this.plugins){r.init&&await r.init(e||this);let n=r.collections||[];for(let i of n)i.slug&&!this.hasCollection(i.slug)&&this.addCollection(i);let s=r.globals||[];for(let i of s)i.slug&&!this.hasGlobal(i.slug)&&this.addGlobal(i);}this.initialized=true;}isInitialized(){return this.initialized}getPaginationDefaults(e){let r=this.collections.get(e);return {defaultLimit:r?.admin?.pagination?.defaultLimit||10,limits:r?.admin?.pagination?.limits||[10,25,50,100]}}getDefaultSort(e){let n=this.collections.get(e)?.admin?.useAsTitle;return n||"createdAt"}getDefaultColumns(e){let r=this.collections.get(e);return r?.admin?.defaultColumns?r.admin.defaultColumns:this.getVisibleFields(e).slice(0,4).map(s=>s.name)}getAdminTitle(e){let r=this.collections.get(e);return r?.label||r?.admin?.description||e}getAdminLabel(e){let r=this.collections.get(e);return r?.singularLabel||r?.label||e}getAdminGroup(e){return this.collections.get(e)?.admin?.group}getStats(){let e=0;for(let r of this.collections.values())e+=r.fields.length;for(let r of this.globals.values())e+=r.fields.length;return {collections:this.collections.size,globals:this.globals.size,plugins:this.plugins.length,fields:e}}toJSON(){return {collections:this.getCollections(),globals:this.getGlobals()}}},mt=null;function Ud(){return mt||(mt=new qt),mt}function Bd(){mt=null;}function Kn(){return mt=new qt,mt}g();var xe=class{name;displayName;adminEntry;version;description;hooks={};collections=[];globals=[];fields=[];extensions={collections:[],globals:[]};adminComponents={};adminStyles=[];serverMiddleware;clientMiddleware;constructor(e){this.name=e;}async init(e){}async beforeInit(e){}async afterInit(e){}getCollections(){return this.collections}getGlobals(){return this.globals}getHooks(){return this.hooks}},br=class{plugins=new Map;hooks=new Map;register(e){if(this.plugins.has(e.name))throw new Error(`Plugin "${e.name}" is already registered`);this.plugins.set(e.name,e);let r=e.getHooks?.()||{};for(let[n,s]of Object.entries(r))if(Array.isArray(s))for(let i of s)this.registerHook(n,i);}unregister(e){let r=this.plugins.get(e);if(!r)return;let n=r.getHooks?.()||{};for(let[s,i]of Object.entries(n))if(Array.isArray(i))for(let o of i)this.unregisterHook(s,o);this.plugins.delete(e);}get(e){return this.plugins.get(e)}getAll(){return Array.from(this.plugins.values())}has(e){return this.plugins.has(e)}registerHook(e,r){this.hooks.has(e)||this.hooks.set(e,[]),this.hooks.get(e).push(r);}unregisterHook(e,r){let n=this.hooks.get(e);if(n){let s=n.indexOf(r);s>-1&&n.splice(s,1);}}async executeHook(e,r){let n=this.hooks.get(e)||[],s=r;for(let i of n)try{let o=await i({...r,data:s});o!==void 0&&(s=o);}catch(o){console.error(`[PluginManager] Error in hook "${e}":`,o);}return s}getAllCollections(){let e=[];for(let r of this.plugins.values()){let n=r.getCollections?.()||[];e.push(...n);}return e}getAllGlobals(){let e=[];for(let r of this.plugins.values()){let n=r.getGlobals?.()||[];e.push(...n);}return e}getAllFields(){let e=[];for(let r of this.plugins.values())e.push(...r.fields);return e}getAdminComponents(){let e={};for(let r of this.plugins.values())Object.assign(e,r.adminComponents);return e}getAdminStyles(){let e=[];for(let r of this.plugins.values())e.push(...r.adminStyles);return e}},Qn=class extends xe{constructor(){super("seo"),this.displayName="Core SEO",this.description="Advanced SEO features including sitemaps, robots.txt, and structured data",this.adminEntry="@kyro-cms/admin/plugins/seo-admin",this.collections.push({slug:"seo-settings",label:"SEO Settings",fields:[{name:"sitemap",type:"checkbox",label:"Enable Sitemap",defaultValue:true},{name:"robotsTxt",type:"richtext",label:"robots.txt Content"},{name:"canonicalUrl",type:"text",variant:"url",label:"Canonical URL"},{name:"ogImage",type:"text",label:"Default OG Image URL"}]});}},Zn=class extends xe{constructor(){super("analytics"),this.displayName="Core Analytics",this.description="Built-in privacy-friendly analytics and dashboards",this.collections.push({slug:"analytics-events",label:"Analytics Events",fields:[{name:"name",type:"text",required:true},{name:"properties",type:"json",label:"Event Properties"},{name:"timestamp",type:"date",required:true},{name:"userId",type:"text",label:"User ID"},{name:"sessionId",type:"text",label:"Session ID"}]}),this.adminComponents.AnalyticsDashboard={};}},Jn=class extends xe{constructor(){super("comments"),this.description="Commenting system for products and posts",this.collections.push({slug:"comments",label:"Comments",fields:[{name:"content",type:"richtext",required:true},{name:"author",type:"text",required:true},{name:"email",type:"email"},{name:"approved",type:"checkbox",defaultValue:false},{name:"parent",type:"text",label:"Parent Comment ID"},{name:"resourceType",type:"text",required:true},{name:"resourceId",type:"text",required:true}]}),this.adminComponents.CommentModeration={};}},Yn=class extends xe{constructor(){super("reviews"),this.description="Product reviews and ratings",this.collections.push({slug:"reviews",label:"Reviews",fields:[{name:"rating",type:"number",required:true,min:1,max:5},{name:"title",type:"text"},{name:"content",type:"richtext",required:true},{name:"author",type:"relationship",relationTo:"customers"},{name:"product",type:"relationship",relationTo:"products",required:true},{name:"approved",type:"checkbox",defaultValue:false},{name:"verified",type:"checkbox",label:"Verified Purchase"},{name:"helpful",type:"number",label:"Helpful Count",defaultValue:0}]}),this.adminComponents.ReviewModeration={};}},Xn=class extends xe{constructor(){super("wishlist"),this.description="Customer wishlists",this.collections.push({slug:"wishlists",label:"Wishlists",fields:[{name:"customer",type:"relationship",relationTo:"customers",required:true},{name:"name",type:"text",label:"Wishlist Name",defaultValue:"My Wishlist"},{name:"items",type:"blocks",label:"Items",blocks:[{slug:"wishlist-item",label:"Item",fields:[{name:"product",type:"relationship",relationTo:"products"},{name:"quantity",type:"number",defaultValue:1},{name:"addedAt",type:"date"},{name:"priority",type:"select",options:[{label:"Low",value:"low"},{label:"Medium",value:"medium"},{label:"High",value:"high"}]}]}]}]});}},Dg={SEO:Qn,Analytics:Zn,Comments:Jn,Reviews:Yn,Wishlist:Xn};g();var Do=new Set(["type","admin","label","singularLabel","labelPlural","relationTo","required","hasMany","defaultValue","validate","options","dynamicOptions","filterOptions","hooks","min","max","minLength","maxLength","minRows","maxRows","minDate","maxDate","step","integer","variant","pattern","format","fields","tabs","blocks"]);function jo(t){return typeof t!="object"||t===null||Array.isArray(t)?false:Object.keys(t).some(e=>Do.has(e))}function yr(t,e=""){let r={};for(let[n,s]of Object.entries(t)){let i=e?`${e}.${n}`:n;s&&typeof s=="object"&&!Array.isArray(s)&&!jo(s)?Object.assign(r,yr(s,i)):r[i]=s;}return r}function _e(t,e,r,n=true){let s=e.split(".");if(s.length===0)return false;let i=s[0],o=s.slice(1).join("."),a=i.match(/^(?:tab|tabs)\[(.+?)\]$/i);if(a){let l=a[1].toLowerCase();for(let c of t)if(c.type==="tabs"&&c.tabs&&Array.isArray(c.tabs)){for(let u of c.tabs)if((u.label||u.name||"").toLowerCase()===l&&u.fields&&Array.isArray(u.fields))return _e(u.fields,o,r,n)}return false}for(let l of t){if(l.name===i)if(o){if(l.fields&&Array.isArray(l.fields))return _e(l.fields,o,r,n);if(l.type==="tabs"&&l.tabs&&Array.isArray(l.tabs)){for(let u of l.tabs)if(u.fields&&Array.isArray(u.fields)&&_e(u.fields,o,r,n))return true;return false}if(l.type==="blocks"&&l.blocks&&Array.isArray(l.blocks)){let u=o.split(".")[0],h=o.split(".").slice(1).join(".");if(!h)return false;for(let d of l.blocks)if(d.slug===u&&d.fields&&Array.isArray(d.fields))return _e(d.fields,h,r,n);return false}return l.type==="array"&&l.fields&&Array.isArray(l.fields)?_e(l.fields,o,r,n):false}else return Object.assign(l,r),true;if(l.type==="blocks"&&l.blocks&&Array.isArray(l.blocks)){for(let u of l.blocks)if(u.slug===i&&u.fields&&Array.isArray(u.fields)&&_e(u.fields,o,r,n))return true}if(!l.name||l.type==="tabs"||l.type==="row"||l.type==="collapsible"){if(l.fields&&Array.isArray(l.fields)&&_e(l.fields,e,r,false))return true;if(l.type==="tabs"&&l.tabs&&Array.isArray(l.tabs)){for(let u of l.tabs)if(u.fields&&Array.isArray(u.fields)&&_e(u.fields,e,r,false))return true}}}return n&&!o&&r&&r.type?(t.push({name:i,...r}),true):false}function es(t,e){if(!e)return;let r=Array.isArray(e)?e:Object.entries(e).map(([s,i])=>({slug:i?.slug||s,...i}));function n(s){for(let i of s){if(i.type==="blocks"){Array.isArray(i.blocks)||(i.blocks=[]);for(let o of r){let a=i.blocks.findIndex(l=>l.slug===o.slug);a>=0?i.blocks[a]={...i.blocks[a],...o}:i.blocks.push(o);}return true}if(i.fields&&Array.isArray(i.fields)&&n(i.fields))return true;if(i.type==="tabs"&&i.tabs&&Array.isArray(i.tabs)){for(let o of i.tabs)if(o.fields&&Array.isArray(o.fields)&&n(o.fields))return true}}return false}n(t);}function ts(t,e){if(!e)return;let r=Array.isArray(e)?e:Object.entries(e).map(([s,i])=>({label:i?.label||s,...Array.isArray(i)?{fields:i}:i})),n=t.find(s=>s.type==="tabs");if(n&&Array.isArray(n.tabs))for(let s of r){let i=n.tabs.find(o=>(o.label||o.name||"").toLowerCase()===(s.label||s.name||"").toLowerCase());i?(s.fields&&Array.isArray(s.fields)&&(Array.isArray(i.fields)||(i.fields=[]),i.fields.push(...s.fields)),Object.assign(i,s)):n.tabs.push(s);}else {let s=[...t];t.length=0,t.push({type:"tabs",tabs:[{label:"General",fields:s},...r]});}}function rs(t,e){if(e)for(let r of t){let n=e[r.slug];if(n){let{fields:s,blocks:i,tabs:o,labels:a,label:l,singularLabel:c,labelPlural:u,hidden:h,timestamps:d,versions:p,seo:_,access:w,hooks:R,admin:C,...I}=n;if(l&&(r.label=l),c&&(r.singularLabel=c),u&&(r.labelPlural=u),a&&(a.singular&&(r.singularLabel=a.singular),a.plural&&(r.labelPlural=a.plural)),d!==void 0&&(r.timestamps=d),p!==void 0&&(r.versions={...r.versions,...p}),_!==void 0&&(r.seo=_),w&&(r.access={...r.access,...w}),R&&(r.hooks={...r.hooks,...R}),(C||I)&&(r.admin={...r.admin,...C,...I}),i&&es(r.fields,i),o&&ts(r.fields,o),s){let P=yr(s);for(let[T,S]of Object.entries(P))_e(r.fields,T,S);}}}}function ns(t,e){if(e)for(let r of t){let n=e[r.slug];if(n){let{fields:s,blocks:i,tabs:o,label:a,hidden:l,versions:c,access:u,hooks:h,admin:d,...p}=n;if(a&&(r.label=a),c!==void 0&&(r.versions={...r.versions,...c}),u&&(r.access={...r.access,...u}),h&&(r.hooks={...r.hooks,...h}),(d||p)&&(r.admin={...r.admin,...d,...p}),i&&es(r.fields,i),o&&ts(r.fields,o),s){let _=yr(s);for(let[w,R]of Object.entries(_))_e(r.fields,w,R);}}}}g();g();var Me={red:"\x1B[31m",yellow:"\x1B[33m",magenta:"\x1B[35m",cyan:"\x1B[36m",reset:"\x1B[0m"},qo=Me.yellow+"WARN"+Me.reset,Uo=Me.cyan+"INFO"+Me.reset,Bo=Me.red+"ERR"+Me.reset,Mo=Me.magenta+"DEBUG"+Me.reset,Ut={debug:0,info:1,warn:2,error:3,silent:4},gr=()=>{},xr=t=>(...e)=>console.log(t,...e),Md=console.debug?(...t)=>console.debug(Mo,...t):xr(Mo),$d=console.info?(...t)=>console.info(Uo,...t):xr(Uo),Nd=console.warn?(...t)=>console.warn(qo,...t):xr(qo),Gd=console.error?(...t)=>console.error(Bo,...t):xr(Bo),_r=(t=globalThis.process?.env.DEBUG==="1"?"debug":"info")=>{let e=Ut[t];return {debug:e>Ut.debug?gr:Md,info:e>Ut.info?gr:$d,warn:e>Ut.warn?gr:Nd,error:e>Ut.error?gr:Gd}};g();g();var wr=Symbol.for("@whatwg-node/promise-helpers/FakePromise");function G(t){return t?.then!=null}function zd(t){let e=t;return e&&e.then&&e.catch&&e.finally}function A(t,e,r,n){let s=N().then(t).then(e,r);return Mt(s)}function N(t){return t&&zd(t)?t:G(t)?{then:(e,r)=>N(t.then(e,r)),catch:e=>N(t.then(r=>r,e)),finally:e=>N(e?Wd(t,e):t),[Symbol.toStringTag]:"Promise"}:{then(e){if(e)try{return N(e(t))}catch(r){return bt(r)}return this},catch(){return this},finally(e){if(e)try{return N(e()).then(()=>t,()=>t)}catch(r){return bt(r)}return this},[Symbol.toStringTag]:"Promise",__fakePromiseValue:t,[wr]:"resolved"}}function Bt(){if(Promise.withResolvers)return Promise.withResolvers();let t,e;return {promise:new Promise(function(s,i){t=s,e=i;}),get resolve(){return t},get reject(){return e}}}function Q(t,e,r){if(t?.length===0)return;let n=t[Symbol.iterator](),s=0;function i(){let{done:o,value:a}=n.next();if(o)return;let l=false;function c(){l=true;}return A(function(){return e(a,c,s++)},function(h){if(h&&r?.push(h),!l)return i()})}return i()}function bt(t){return {then(e,r){if(r)try{return N(r(t))}catch(n){return bt(n)}return this},catch(e){if(e)try{return N(e(t))}catch(r){return bt(r)}return this},finally(e){if(e)try{e();}catch(r){return bt(r)}return this},__fakeRejectError:t,[Symbol.toStringTag]:"Promise",[wr]:"rejected"}}function Ie(t,e,r,n){Symbol.asyncIterator in t&&(t=t[Symbol.asyncIterator]());let s,i,o;typeof t.return=="function"&&(s=t.return,i=c=>{let u=()=>{throw c};return s.call(t).then(u,u)});function a(c){return c.done?c:A(()=>c.value,u=>A(()=>e(u),$o,i))}let l;if(r){let c,u=r;l=h=>(c||=A(()=>h,d=>A(()=>u(d),$o,i)),c);}return {next(){return t.next().then(a,l)},return(){let c=s?s.call(t).then(a,l):N({value:void 0,done:true});return o?c.then(o):c},throw(c){return typeof t.throw=="function"?t.throw(c).then(a,l):i?i(c):bt(c)},[Symbol.asyncIterator](){return this}}}function $o(t){return {value:t,done:false}}function Hd(t){return t?.[wr]==="resolved"}function Vd(t){return t?.[wr]==="rejected"}function Wd(t,e){return "finally"in t?t.finally(e):t.then(r=>{let n=e();return G(n)?n.then(()=>r):r},r=>{let n=e();if(G(n))return n.then(()=>{throw r});throw r})}function Mt(t){if(Hd(t))return t.__fakePromiseValue;if(Vd(t))throw t.__fakeRejectError;return t}g();var No='<!doctype html><html lang=en><head><meta charset=utf-8><title>__TITLE__</title><link rel=icon href=https://raw.githubusercontent.com/graphql-hive/graphql-yoga/refs/heads/main/website/src/app/favicon.ico><link crossorigin rel=stylesheet href=https://unpkg.com/@graphql-yoga/graphiql@4.4.4/dist/graphiql.css></head><body id=body class=no-focus-outline><noscript>You need to enable JavaScript to run this app.</noscript><div id=root>Loading __TITLE__...</div><script>function prepareBlob(r){const o=new Blob([r],{type:"application/javascript"});return URL.createObjectURL(o)}const workers={},workerUrls={editorWorkerService:"https://unpkg.com/@graphql-yoga/graphiql@4.4.4/dist/monacoeditorwork/editor.worker.bundle.js",json:"https://unpkg.com/@graphql-yoga/graphiql@4.4.4/dist/monacoeditorwork/json.worker.bundle.js",graphql:"https://unpkg.com/@graphql-yoga/graphiql@4.4.4/dist/monacoeditorwork/graphql.worker..bundle.js"};function prepareWorkers(){return Promise.all(Object.entries(workerUrls).map(async([r,o])=>{const e=await fetch(o),t=await e.text();workers[r]=prepareBlob(t)}))}self.MonacoEnvironment={globalAPI:!1,getWorkerUrl:function(r,o){return workers[o]}}</script><script src=https://unpkg.com/@graphql-yoga/graphiql@4.4.4/dist/yoga-graphiql.umd.js></script><script>prepareWorkers().finally(()=>{YogaGraphiQL.renderYogaGraphiQL(root,__OPTS__)})</script></body></html>';function Kd({headers:t,method:e}){return e==="GET"&&!!t?.get("accept")?.includes("text/html")}var Qd=t=>No.replace("__TITLE__",t?.title||"Yoga GraphiQL").replace("__OPTS__",JSON.stringify(t??{}));function Go(t){let e=t.logger??console,r;typeof t?.options=="function"?r=t?.options:typeof t?.options=="object"?r=()=>t?.options:t?.options===false?r=()=>false:r=()=>({});let n=t?.render??Qd;return {onRequest({request:s,serverContext:i,fetchAPI:o,endResponse:a,url:l}){let c=t.getGraphQLEndpoint();if(Kd(s)&&(s.url.endsWith(c)||s.url.endsWith(`${c}/`)||l.pathname===c||l.pathname===`${c}/`||t.getGraphQLEndpointURLPattern().test(l)))return e.debug("Rendering GraphiQL"),A(()=>r(s,i),u=>{if(u)return A(()=>n({...u===true?{}:u}),h=>{let d=new o.Response(h,{headers:{"Content-Type":"text/html"},status:200});a(d);})})}}}g();function ss(t){return t?.[Symbol.toStringTag]==="GraphQLSchema"}var zo=t=>{if(t==null)return {};if(ss(t))return {onPluginInit({setSchema:e}){e(t);}};if("then"in t){let e;return {onRequestParse(){return {onRequestParseDone(){if(!e)return A(()=>t,r=>{e=r;})}}},onEnveloped({setSchema:r}){if(e==null)throw new Error("You provide a promise of a schema but it hasn't been resolved yet. Make sure you use this plugin with GraphQL Yoga.");if(!ss(e))throw new Error("The resolved schema is not a valid GraphQLSchema instance.");r(e);}}}if(typeof t=="function"){let e=new WeakMap;return {onRequestParse({request:r,serverContext:n}){return {onRequestParseDone(){return A(()=>t({...n,request:r}),s=>{if(!ss(s))throw new Error("The factory function did not return a valid GraphQLSchema.");e.set(r,s);})}}},onEnveloped({setSchema:r,context:n}){if(n?.request==null)throw new Error("Request object is not available in the context. Make sure you use this plugin with GraphQL Yoga.");let s=e.get(n.request);if(s==null)throw new Error("No schema found for this request. Make sure you use this plugin with GraphQL Yoga.");r(s);}}}throw new Error("Invalid schema definition provided, expected a schema, promise or function.")};g();g();g();function te(t){return Sr(t,[])}function Sr(t,e){switch(typeof t){case "string":return JSON.stringify(t);case "function":return t.name?`[function ${t.name}]`:"[function]";case "object":return Zd(t,e);default:return String(t)}}function Ho(t){return (t.name="GraphQLError")?t.toString():`${t.name}: ${t.message};
|
|
21
|
+
`)}`),this.name="ConfigValidationError",this.errors=e;}};function Vn(t){let e=[];if(t.slug?/^[a-z][a-z0-9_-]*$/.test(t.slug)||e.push(`Collection slug "${t.slug}" must be lowercase alphanumeric with dashes`):e.push('Collection is missing a "slug" property'),!t.fields||t.fields.length===0)e.push(`Collection "${t.slug}" has no fields defined`);else {let r=Ye(t.fields,t.slug);e.push(...r);}if(t.access)for(let[r,n]of Object.entries(t.access))typeof n!="boolean"&&typeof n!="function"&&e.push(`Collection "${t.slug}" has invalid access.${r} (must be boolean or function)`);if(t.admin?.useAsTitle&&(mr(t.fields,t.admin.useAsTitle)||e.push(`Collection "${t.slug}" admin.useAsTitle references unknown field "${t.admin.useAsTitle}"`)),t.admin?.defaultColumns)for(let r of t.admin.defaultColumns)mr(t.fields,r)||e.push(`Collection "${t.slug}" admin.defaultColumns references unknown field "${r}"`);if(t.upload&&t.upload.fileSize&&t.upload.fileSize<=0&&e.push(`Collection "${t.slug}" upload.fileSize must be positive`),t.versions&&t.versions.maxPerDoc&&t.versions.maxPerDoc<=0&&e.push(`Collection "${t.slug}" versions.maxPerDoc must be positive`),t.auth){let r=t.fields.some(s=>s.name==="email"),n=t.fields.some(s=>s.name==="password");r||e.push(`Collection "${t.slug}" with auth enabled requires an "email" field`),n||e.push(`Collection "${t.slug}" with auth enabled requires a "password" field`);}return e}function Wn(t){let e=[];if(t.slug?/^[a-z][a-z0-9_-]*$/.test(t.slug)||e.push(`Global slug "${t.slug}" must be lowercase alphanumeric with dashes`):e.push('Global is missing a "slug" property'),!t.fields||t.fields.length===0)e.push(`Global "${t.slug}" has no fields defined`);else {let r=Ye(t.fields,`global:${t.slug}`);e.push(...r);}return e}function Ye(t,e){let r=[],n=new Set;for(let s=0;s<t.length;s++){let i=t[s];if(i.type==="row"||i.type==="collapsible"||i.type==="tabs"){if("fields"in i&&i.fields){let a=Ye(i.fields,e);r.push(...a);}else if("tabs"in i)for(let a of i.tabs){let l=Ye(a.fields,e);r.push(...l);}continue}let o=i.name;if(!o){r.push(`${e}: Field at index ${s} is missing a "name" property`);continue}if(n.has(o)&&r.push(`${e}: Duplicate field name "${o}"`),n.add(o),/^[a-zA-Z][a-zA-Z0-9_]*$/.test(o)||r.push(`${e}: Field name "${o}" must be alphanumeric with underscores`),!i.type){r.push(`${e}: Field "${o}" is missing a "type" property`);continue}switch(i.type){case "relationship":i.relationTo||r.push(`${e}: Relationship field "${o}" is missing "relationTo"`);break;case "array":if(!i.fields||i.fields.length===0)r.push(`${e}: Array field "${o}" has no fields defined`);else {let a=Ye(i.fields,`${e}.${o}`);r.push(...a);}break;case "group":if(!i.fields||i.fields.length===0)r.push(`${e}: Group field "${o}" has no fields defined`);else {let a=Ye(i.fields,`${e}.${o}`);r.push(...a);}break;case "blocks":if(!i.blocks||i.blocks.length===0)r.push(`${e}: Blocks field "${o}" has no blocks defined`);else {let a=bd(i.blocks,`${e}.${o}`);r.push(...a);}break;case "select":case "radio":if(typeof i.options=="function")break;if((!i.options||i.options.length===0)&&!i.dynamicOptions)r.push(`${e}: ${i.type} field "${o}" has no options defined`);else if(Array.isArray(i.options)){let a=i.options.map(c=>typeof c=="object"&&c!==null&&"value"in c?c.value:c),l=new Set(a);a.length!==l.size&&r.push(`${e}: ${i.type} field "${o}" has duplicate option values`);}break;case "upload":i.relationTo||r.push(`${e}: Upload field "${o}" is missing "relationTo"`);break}"min"in i&&"max"in i&&i.min>i.max&&r.push(`${e}: Field "${o}" has min greater than max`),"minLength"in i&&"maxLength"in i&&i.minLength>i.maxLength&&r.push(`${e}: Field "${o}" has minLength greater than maxLength`),"minRows"in i&&"maxRows"in i&&i.minRows>i.maxRows&&r.push(`${e}: Field "${o}" has minRows greater than maxRows`);}return r}function bd(t,e){let r=[],n=new Set;for(let s of t){if(!s.slug){r.push(`${e}: Block is missing a "slug" property`);continue}if(n.has(s.slug)&&r.push(`${e}: Duplicate block slug "${s.slug}"`),n.add(s.slug),s.label||r.push(`${e}: Block "${s.slug}" is missing a "label" property`),!s.fields||s.fields.length===0)r.push(`${e}: Block "${s.slug}" has no fields defined`);else {let i=Ye(s.fields,`${e}.${s.slug}`);r.push(...i);}}return r}function ko(t,e=[]){let r=[],n=new Set;for(let s of t)n.has(s.slug)&&r.push(`Duplicate collection slug "${s.slug}"`),n.add(s.slug);for(let s of e)n.has(s.slug)&&r.push(`Duplicate global slug "${s.slug}"`),n.add(s.slug);for(let s of t){let i=Vn(s);r.push(...i);}for(let s of e){let i=Wn(s);r.push(...i);}for(let s of t){let i=pr(s.fields,t);r.push(...i);}if(r.length>0)throw new Hn(r)}function pr(t,e){let r=[],n=new Set(e.map(s=>s.slug));for(let s of t){if(s.type==="relationship"){let i=Array.isArray(s.relationTo)?s.relationTo:[s.relationTo];for(let o of i)o!=="*"&&!n.has(o)&&console.warn(`[Kyro Config Warning]: Relationship field "${s.name}" references unknown collection "${o}". Select options will not be available until this collection is registered.`);}if(s.type==="upload"){let i=Array.isArray(s.relationTo)?s.relationTo:[s.relationTo];for(let o of i)n.has(o)||r.push(`Upload field "${s.name}" references unknown collection "${o}"`);}if("fields"in s&&s.fields){let i=pr(s.fields,e);r.push(...i);}if("tabs"in s)for(let i of s.tabs){let o=pr(i.fields,e);r.push(...o);}if("blocks"in s)for(let i of s.blocks){let o=pr(i.fields,e);r.push(...o);}}return r}var y={};d(y,{BRAND:()=>ca$1,DIRTY:()=>p,EMPTY_PATH:()=>l,INVALID:()=>o,NEVER:()=>Wa$1,OK:()=>q,ParseStatus:()=>n,Schema:()=>v,ZodAny:()=>F$1,ZodArray:()=>J,ZodBigInt:()=>z$1,ZodBoolean:()=>A$1,ZodBranded:()=>da$1,ZodCatch:()=>aa$1,ZodDate:()=>B$1,ZodDefault:()=>$,ZodDiscriminatedUnion:()=>M,ZodEffects:()=>Y,ZodEnum:()=>V,ZodError:()=>g$1,ZodFirstPartyTypeKind:()=>ia$1,ZodFunction:()=>S,ZodIntersection:()=>N$1,ZodIssueCode:()=>e,ZodLazy:()=>T,ZodLiteral:()=>U,ZodMap:()=>Q$1,ZodNaN:()=>ba$1,ZodNativeEnum:()=>W,ZodNever:()=>H$1,ZodNull:()=>E,ZodNullable:()=>_,ZodNumber:()=>y$1,ZodObject:()=>K,ZodOptional:()=>Z,ZodParsedType:()=>c$1,ZodPipeline:()=>ea$1,ZodPromise:()=>X,ZodReadonly:()=>fa$1,ZodRecord:()=>P,ZodSchema:()=>v,ZodSet:()=>R,ZodString:()=>x,ZodSymbol:()=>C,ZodTransformer:()=>Y,ZodTuple:()=>O,ZodType:()=>v,ZodUndefined:()=>D,ZodUnion:()=>L,ZodUnknown:()=>G$1,ZodVoid:()=>I,addIssueToContext:()=>m,any:()=>ta$1,array:()=>xa$1,bigint:()=>na$1,boolean:()=>oa$1,coerce:()=>Va$1,custom:()=>ga$1,date:()=>pa$1,datetimeRegex:()=>w,defaultErrorMap:()=>h,discriminatedUnion:()=>Ba$1,effect:()=>Na$1,enum:()=>Ka$1,function:()=>Ha$1,getErrorMap:()=>j,getParsedType:()=>d$1,instanceof:()=>ja,intersection:()=>Ca$1,isAborted:()=>r,isAsync:()=>u,isDirty:()=>s,isValid:()=>t,late:()=>ha$1,lazy:()=>Ia$1,literal:()=>Ja$1,makeIssue:()=>k,map:()=>Fa$1,nan:()=>ma$1,nativeEnum:()=>La$1,never:()=>va$1,null:()=>sa$1,nullable:()=>Pa$1,number:()=>la$1,object:()=>ya$1,objectUtil:()=>b$1,oboolean:()=>Ua$1,onumber:()=>Ta$1,optional:()=>Oa$1,ostring:()=>Sa$1,pipeline:()=>Ra$1,preprocess:()=>Qa$1,promise:()=>Ma$1,quotelessJson:()=>f$1,record:()=>Ea$1,set:()=>Ga$1,setErrorMap:()=>i,strictObject:()=>za$1,string:()=>ka$1,symbol:()=>qa$1,transformer:()=>Na$1,tuple:()=>Da$1,undefined:()=>ra$1,union:()=>Aa$1,unknown:()=>ua$1,util:()=>a$1,void:()=>wa$1});g();g();g();function ae(t){switch(t.type){case "text":return yd(t);case "number":return gd(t);case "checkbox":return xd(t);case "date":return _d(t);case "email":return wd(t);case "password":return Sd(t);case "textarea":return Ed(t);case "select":return Pd(t);case "radio":return vd(t);case "color":return kd(t);case "richtext":return Td(t);case "json":return Cd(t);case "code":return Ad(t);case "upload":return To(t);case "image":return To(t);case "markdown":return Rd(t);case "relationship":return Co(t);case "relationship-block":return Co(t);case "array":return Ld(t);case "list":return Od(t);case "group":return Fd(t);case "blocks":return Id(t);case "row":return Dd(t);case "collapsible":return jd(t);case "tabs":return qd(t);default:return y.any()}}function yd(t){let e=y.string();return t.minLength&&(e=e.min(t.minLength)),t.maxLength&&(e=e.max(t.maxLength)),t.pattern&&(e=e.regex(new RegExp(t.pattern))),t.variant==="email"&&(e=e.email()),t.variant==="url"&&(e=e.url()),t.hasMany&&(e=y.array(e)),t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function gd(t){let e=t.integer?y.coerce.number().int():y.coerce.number();return t.min!==void 0&&(e=e.min(t.min)),t.max!==void 0&&(e=e.max(t.max)),t.step&&(e=e.refine(r=>Number.isInteger(r/t.step),`Value must be divisible by ${t.step}`)),t.hasMany&&(e=y.array(e)),t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function xd(t){let e=y.boolean();return t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function _d(t){let e=y.string().refine(r=>!isNaN(Date.parse(r)),"Invalid date format");return t.minDate&&(e=e.refine(r=>new Date(r)>=new Date(t.minDate),`Date must be after ${t.minDate}`)),t.maxDate&&(e=e.refine(r=>new Date(r)<=new Date(t.maxDate),`Date must be before ${t.maxDate}`)),t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function wd(t){let e=y.string().email("Invalid email");return t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function Sd(t){let e=y.string().min(6,"Password must be at least 6 characters");return t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function Ed(t){let e=y.string();return t.minLength&&(e=e.min(t.minLength)),t.maxLength&&(e=e.max(t.maxLength)),t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function Pd(t){let e;if(Array.isArray(t.options)&&t.options.length>0){let r=t.options.map(n=>n.value);t.hasMany?e=y.array(y.enum(r)):e=y.enum(r);}else e=t.hasMany?y.array(y.string()):y.string();return t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function vd(t){let e;if(Array.isArray(t.options)&&t.options.length>0){let r=t.options.map(n=>n.value);e=y.enum(r);}else e=y.string();return t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function kd(t){let e=y.string();return t.format==="hex"&&(e=e.regex(/^#[0-9A-Fa-f]{6}$/)),t.format==="rgb"&&(e=e.regex(/^rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\)$/)),t.format==="hsl"&&(e=e.regex(/^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/)),t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function Td(t){let e=y.array(y.record(y.any()));return t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function Cd(t){let e=y.union([y.record(y.any()),y.array(y.any())]);return t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function Ad(t){let e=y.string();return t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function To(t){let e;if(t.relationTo){let r=y.object({id:y.string(),url:y.string().optional(),filename:y.string().optional(),mimeType:y.string().optional()});e=y.union([y.string(),r]);}else e=y.string();return t.hasMany&&(e=y.array(e)),t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function Rd(t){let e=y.string();return t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function Co(t){let e;return Array.isArray(t.relationTo)?e=y.object({relationTo:y.enum(t.relationTo),value:y.string()}):e=y.union([y.string(),y.object({relationTo:y.string(),value:y.string()})]),t.hasMany&&(e=y.array(e)),t.required||(e=e.optional().nullable()),t.validate&&(e=ee(e,t.validate)),e}function Ld(t){let e=y.object(Object.fromEntries(t.fields.filter(n=>n.name).map(n=>[n.name,ae(n)]))).passthrough(),r=y.array(e);return t.minRows&&(r=r.min(t.minRows)),t.maxRows&&(r=r.max(t.maxRows)),t.required||(r=r.optional().nullable()),t.validate&&(r=ee(r,t.validate)),r}function Od(t){let e=y.array(y.string());return t.required||(e=e.optional().nullable()),e}function Fd(t){let e=y.object(Object.fromEntries(t.fields.filter(r=>r.name).map(r=>[r.name,ae(r)])));return t.required?e:e.optional().nullable()}function Id(t){let e=t.blocks||[];e.map(i=>y.object({blockType:y.literal(i.slug),...Object.fromEntries(i.fields.filter(o=>o.name).map(o=>[o.name,ae(o)]))}));let n=e.map(i=>i.slug),s;if(n.length>0){let i=y.object({blockType:y.enum(n)}).catchall(y.any()),o=y.object({blockType:y.string()}).catchall(y.any());s=y.array(y.union([i,o,y.record(y.any())]));}else s=y.array(y.union([y.object({blockType:y.string()}).catchall(y.any()),y.record(y.any())]));return t.minRows&&(s=s.min(t.minRows)),t.maxRows&&(s=s.max(t.maxRows)),t.required||(s=s.optional().nullable()),t.validate&&(s=ee(s,t.validate)),s}function Dd(t){return y.object(Object.fromEntries(t.fields.filter(r=>r.name).map(r=>[r.name,ae(r)])))}function jd(t){return y.object(Object.fromEntries(t.fields.filter(r=>r.name).map(r=>[r.name,ae(r)])))}function qd(t){let e={};for(let r of t.tabs)for(let n of r.fields)n.name&&(e[n.name]=ae(n));return y.object(e).passthrough().optional()}function ee(t,e){return t.refine(async r=>await e(r,{required:false})===true,{message:"Custom validation failed"})}function pt(t){let e={};for(let r of t)if(r.type==="tabs"&&"tabs"in r){let n={};for(let s of r.tabs){let i=pt(s.fields);Object.assign(n,i);}r.name?e[r.name]=y.object(n).passthrough().optional():Object.assign(e,n);}else if(r.type==="row"&&"fields"in r){let n=pt(r.fields);r.name?e[r.name]=y.object(n).passthrough().optional():Object.assign(e,n);}else if(r.type==="collapsible"&&"fields"in r){let n=pt(r.fields);r.name?e[r.name]=y.object(n).passthrough().optional():Object.assign(e,n);}else {if(!r.name)continue;e[r.name]=ae(r);}return e}function Fe(t){let e={};for(let r of t)if(r.type==="tabs"&&"tabs"in r){let n={};for(let s of r.tabs){let i=Fe(s.fields);Object.assign(n,i);}r.name?e[r.name]=y.object(n).passthrough().optional().nullable():Object.assign(e,n);}else if(r.type==="row"&&"fields"in r){let n=Fe(r.fields);r.name?e[r.name]=y.object(n).passthrough().optional().nullable():Object.assign(e,n);}else if(r.type==="collapsible"&&"fields"in r){let n=Fe(r.fields);r.name?e[r.name]=y.object(n).passthrough().optional().nullable():Object.assign(e,n);}else if(r.type==="group"&&"fields"in r)r.name?e[r.name]=y.object(Fe(r.fields)).passthrough().optional().nullable():Object.assign(e,Fe(r.fields));else {if(!r.name)continue;e[r.name]=ae(r).optional().nullable();}return e}function Ao(t){let e=pt(t.fields);return t.timestamps&&(e.createdAt=y.string().optional(),e.updatedAt=y.string().optional()),t.tenantScoped&&(e.tenantId=y.string().optional()),e.id=y.string().optional(),y.object(e).passthrough()}function Ro(t){let e=pt(t.fields);return y.object(e).passthrough()}function Lo(t){let e={};for(let r of t.fields)if(r.name)if(r.type==="tabs"&&"tabs"in r){let n={};for(let s of r.tabs)for(let i of s.fields)i.name&&(n[i.name]=ae(i).optional().nullable());e[r.name]=y.object(n).optional().nullable();}else if(r.type==="row"&&"fields"in r){let n={};for(let s of r.fields)s.name&&(n[s.name]=ae(s).optional().nullable());Object.assign(e,n);}else r.type==="collapsible"&&"fields"in r?e[r.name]=y.object(Fe(r.fields)).optional().nullable():r.type==="group"&&"fields"in r?e[r.name]=y.object(Fe(r.fields)).optional().nullable():e[r.name]=ae(r).optional().nullable();return y.object(e).passthrough()}function Oo(t){let e={};for(let r of t.fields)r.name&&(e[r.name]=y.object({equals:y.any().optional(),not_equals:y.any().optional(),in:y.array(y.any()).optional(),not_in:y.array(y.any()).optional(),greater_than:y.number().optional(),greater_than_equal:y.number().optional(),less_than:y.number().optional(),less_than_equal:y.number().optional(),like:y.string().optional(),not_like:y.string().optional(),contains:y.string().optional(),exists:y.boolean().optional()}).optional());return e.AND=y.array(y.lazy(()=>y.object(e))).optional(),e.OR=y.array(y.lazy(()=>y.object(e))).optional(),y.object(e).optional()}function Fo(t){let e=pt(t.fields);return e.id=y.string().optional(),y.object(e).passthrough()}function Io(t){let e={};for(let r of t.fields)if(r.name)if(r.type==="tabs"&&"tabs"in r){let n={};for(let s of r.tabs)for(let i of s.fields)i.name&&(n[i.name]=ae(i).optional().nullable());e[r.name]=y.object(n).optional().nullable();}else r.type==="collapsible"&&"fields"in r?e[r.name]=y.object(Fe(r.fields)).optional().nullable():r.type==="group"&&"fields"in r?e[r.name]=y.object(Fe(r.fields)).optional().nullable():e[r.name]=ae(r).optional().nullable();return y.object(e).passthrough()}g();var qt=class{storageProviders=$a$1();collections=new Map;globals=new Map;plugins=[];schemaCache=new Map;initialized=false;addCollection(e){if(this.initialized)throw new Error("Cannot add collections after Registry has been initialized");if(this.collections.has(e.slug)){console.warn(`[Registry] Duplicate collection slug "${e.slug}" \u2014 skipping`);return}let r={...e,fields:[...e.fields]};for(let s of this.plugins){let i=s.extensions?.collections?.find(o=>o.slug===r.slug);i&&(r={...r,...i.config,fields:[...r.fields,...i.config.fields||[]]});}if(r.seo){let s=a$2(),i=r.fields.findIndex(o=>o.type==="tabs");if(i!==-1){let o=r.fields[i];r.fields[i]={...o,tabs:[...o.tabs,{label:"SEO Settings",fields:s.fields}]};}else r.fields.push(s);}r.fields=this.applyFieldDefaults(r);let n=Vn(r);if(n.length>0)throw new Error(`Invalid collection config: ${n.join(", ")}`);this.collections.set(r.slug,r),this.clearSchemaCache(r.slug);}addCollections(e){for(let r of e)this.addCollection(r);}getCollection(e){return this.collections.get(e)}getCollections(){return Array.from(this.collections.values())}getCollectionSlugs(){return Array.from(this.collections.keys())}hasCollection(e){return this.collections.has(e)}removeCollection(e){if(this.initialized)throw new Error("Cannot remove collections after Registry has been initialized");return this.clearSchemaCache(e),this.collections.delete(e)}addGlobal(e){if(this.initialized)throw new Error("Cannot add globals after Registry has been initialized");this._addGlobalUnsafe(e);}addGlobalPostInit(e){this.globals.has(e.slug)&&this.globals.delete(e.slug),this._addGlobalUnsafe(e);}_addGlobalUnsafe(e){if(this.globals.has(e.slug)){console.warn(`[Registry] Duplicate global slug "${e.slug}" \u2014 skipping`);return}let r=Wn(e);if(r.length>0)throw new Error(`Invalid global config: ${r.join(", ")}`);let n={...e};for(let s of this.plugins){let i=s.extensions?.globals?.find(o=>o.slug===n.slug);i&&(n={...n,...i.config,fields:[...n.fields||[],...i.config.fields||[]]});}this.globals.set(n.slug,n),this.clearSchemaCache(`global:${n.slug}`);}addGlobals(e){for(let r of e)this.addGlobal(r);}getGlobal(e){return this.globals.get(e)}getGlobals(){return Array.from(this.globals.values())}getGlobalSlugs(){return Array.from(this.globals.keys())}hasGlobal(e){return this.globals.has(e)}removeGlobal(e){if(this.initialized)throw new Error("Cannot remove globals after Registry has been initialized");return this.clearSchemaCache(`global:${e}`),this.globals.delete(e)}addPlugin(e){if(this.initialized)throw new Error("Cannot add plugins after Registry has been initialized");this.plugins.push(e);}getPlugins(){return [...this.plugins]}getZodSchema(e){let r=this.schemaCache.get(e);if(r)return r;let n=this.collections.get(e);if(n){let i=Ao(n);return this.schemaCache.set(e,i),i}let s=this.globals.get(e);if(s){let i=Fo(s);return this.schemaCache.set(`global:${e}`,i),i}throw new Error(`No collection or global found with slug "${e}"`)}getCreateZodSchema(e){let r=`${e}:create`,n=this.schemaCache.get(r);if(n)return n;let s=this.collections.get(e);if(s){let i=Ro(s);return this.schemaCache.set(r,i),i}throw new Error(`No collection found with slug "${e}"`)}getUpdateZodSchema(e){let r=`${e}:update`,n=this.schemaCache.get(r);if(n)return n;let s=this.collections.get(e);if(s){let o=Lo(s);return this.schemaCache.set(r,o),o}let i=this.globals.get(e);if(i){let o=Io(i);return this.schemaCache.set(`global:${e}:update`,o),o}throw new Error(`No collection or global found with slug "${e}"`)}getWhereZodSchema(e){let r=`${e}:where`,n=this.schemaCache.get(r);if(n)return n;let s=this.collections.get(e);if(s){let i=Oo(s);return this.schemaCache.set(r,i),i}throw new Error(`No collection found with slug "${e}"`)}getFieldZodSchema(e){return ae(e)}clearSchemaCache(e){this.schemaCache.delete(e),this.schemaCache.delete(`${e}:create`),this.schemaCache.delete(`${e}:update`),this.schemaCache.delete(`${e}:where`);}applyFieldDefaults(e){let r=[...e.fields];return r.some(n=>n.name==="id")||r.unshift({name:"id",type:"text",admin:{readOnly:true,hidden:true}}),e.tenantScoped&&!r.some(n=>n.name==="tenantId")&&r.push({name:"tenantId",type:"text",required:true,admin:{readOnly:true,hidden:true}}),e.timestamps&&!r.some(n=>n.name==="createdAt")&&(r.push({name:"createdAt",type:"date",admin:{readOnly:true,hidden:true}}),r.push({name:"updatedAt",type:"date",admin:{readOnly:true,hidden:true}})),e.versions?.drafts&&!r.some(n=>n.name==="status")&&r.push({name:"status",type:"select",options:[{value:"draft",label:"Draft"},{value:"published",label:"Published"}],admin:{readOnly:true,hidden:true}}),e.auth&&!r.some(n=>n.name==="password")&&r.push({name:"password",type:"password",required:true,admin:{hidden:true}}),r}getFields(e){let r=this.collections.get(e);if(r)return r.fields;let n=this.globals.get(e);if(n)return n.fields;throw new Error(`No collection or global found with slug "${e}"`)}getFieldMap(e){let r=this.getFields(e),n=new Map,s=i=>{for(let o of i){if(o.name&&n.set(o.name,o),"fields"in o&&o.fields&&s(o.fields),"tabs"in o)for(let a of o.tabs)s(a.fields);if("blocks"in o)for(let a of o.blocks)s(a.fields);}};return s(r),n}getVisibleFields(e){return this.getFields(e).filter(n=>!n.admin?.hidden)}validate(){let e=this.getCollections(),r=this.getGlobals();ko(e,r);}async init(e){this.validate();for(let r of this.plugins){r.init&&await r.init(e||this);let n=r.collections||[];for(let i of n)i.slug&&!this.hasCollection(i.slug)&&this.addCollection(i);let s=r.globals||[];for(let i of s)i.slug&&!this.hasGlobal(i.slug)&&this.addGlobal(i);}this.initialized=true;}isInitialized(){return this.initialized}getPaginationDefaults(e){let r=this.collections.get(e);return {defaultLimit:r?.admin?.pagination?.defaultLimit||10,limits:r?.admin?.pagination?.limits||[10,25,50,100]}}getDefaultSort(e){let n=this.collections.get(e)?.admin?.useAsTitle;return n||"createdAt"}getDefaultColumns(e){let r=this.collections.get(e);return r?.admin?.defaultColumns?r.admin.defaultColumns:this.getVisibleFields(e).slice(0,4).map(s=>s.name)}getAdminTitle(e){let r=this.collections.get(e);return r?.label||r?.admin?.description||e}getAdminLabel(e){let r=this.collections.get(e);return r?.singularLabel||r?.label||e}getAdminGroup(e){return this.collections.get(e)?.admin?.group}getStats(){let e=0;for(let r of this.collections.values())e+=r.fields.length;for(let r of this.globals.values())e+=r.fields.length;return {collections:this.collections.size,globals:this.globals.size,plugins:this.plugins.length,fields:e}}toJSON(){return {collections:this.getCollections(),globals:this.getGlobals()}}},mt=null;function Ud(){return mt||(mt=new qt),mt}function Bd(){mt=null;}function Kn(){return mt=new qt,mt}g();var xe=class{name;displayName;adminEntry;version;description;hooks={};collections=[];globals=[];fields=[];extensions={collections:[],globals:[]};adminComponents={};adminStyles=[];serverMiddleware;clientMiddleware;constructor(e){this.name=e;}async init(e){}async beforeInit(e){}async afterInit(e){}getCollections(){return this.collections}getGlobals(){return this.globals}getHooks(){return this.hooks}},br=class{plugins=new Map;hooks=new Map;register(e){if(this.plugins.has(e.name))throw new Error(`Plugin "${e.name}" is already registered`);this.plugins.set(e.name,e);let r=e.getHooks?.()||{};for(let[n,s]of Object.entries(r))if(Array.isArray(s))for(let i of s)this.registerHook(n,i);}unregister(e){let r=this.plugins.get(e);if(!r)return;let n=r.getHooks?.()||{};for(let[s,i]of Object.entries(n))if(Array.isArray(i))for(let o of i)this.unregisterHook(s,o);this.plugins.delete(e);}get(e){return this.plugins.get(e)}getAll(){return Array.from(this.plugins.values())}has(e){return this.plugins.has(e)}registerHook(e,r){this.hooks.has(e)||this.hooks.set(e,[]),this.hooks.get(e).push(r);}unregisterHook(e,r){let n=this.hooks.get(e);if(n){let s=n.indexOf(r);s>-1&&n.splice(s,1);}}async executeHook(e,r){let n=this.hooks.get(e)||[],s=r;for(let i of n)try{let o=await i({...r,data:s});o!==void 0&&(s=o);}catch(o){console.error(`[PluginManager] Error in hook "${e}":`,o);}return s}getAllCollections(){let e=[];for(let r of this.plugins.values()){let n=r.getCollections?.()||[];e.push(...n);}return e}getAllGlobals(){let e=[];for(let r of this.plugins.values()){let n=r.getGlobals?.()||[];e.push(...n);}return e}getAllFields(){let e=[];for(let r of this.plugins.values())e.push(...r.fields);return e}getAdminComponents(){let e={};for(let r of this.plugins.values())Object.assign(e,r.adminComponents);return e}getAdminStyles(){let e=[];for(let r of this.plugins.values())e.push(...r.adminStyles);return e}},Qn=class extends xe{constructor(){super("seo"),this.displayName="Core SEO",this.description="Advanced SEO features including sitemaps, robots.txt, and structured data",this.adminEntry="@kyro-cms/admin/plugins/seo-admin",this.collections.push({slug:"seo-settings",label:"SEO Settings",fields:[{name:"sitemap",type:"checkbox",label:"Enable Sitemap",defaultValue:true},{name:"robotsTxt",type:"richtext",label:"robots.txt Content"},{name:"canonicalUrl",type:"text",variant:"url",label:"Canonical URL"},{name:"ogImage",type:"text",label:"Default OG Image URL"}]});}},Zn=class extends xe{constructor(){super("analytics"),this.displayName="Core Analytics",this.description="Built-in privacy-friendly analytics and dashboards",this.collections.push({slug:"analytics-events",label:"Analytics Events",fields:[{name:"name",type:"text",required:true},{name:"properties",type:"json",label:"Event Properties"},{name:"timestamp",type:"date",required:true},{name:"userId",type:"text",label:"User ID"},{name:"sessionId",type:"text",label:"Session ID"}]}),this.adminComponents.AnalyticsDashboard={};}},Jn=class extends xe{constructor(){super("comments"),this.description="Commenting system for products and posts",this.collections.push({slug:"comments",label:"Comments",fields:[{name:"content",type:"richtext",required:true},{name:"author",type:"text",required:true},{name:"email",type:"email"},{name:"approved",type:"checkbox",defaultValue:false},{name:"parent",type:"text",label:"Parent Comment ID"},{name:"resourceType",type:"text",required:true},{name:"resourceId",type:"text",required:true}]}),this.adminComponents.CommentModeration={};}},Yn=class extends xe{constructor(){super("reviews"),this.description="Product reviews and ratings",this.collections.push({slug:"reviews",label:"Reviews",fields:[{name:"rating",type:"number",required:true,min:1,max:5},{name:"title",type:"text"},{name:"content",type:"richtext",required:true},{name:"author",type:"relationship",relationTo:"customers"},{name:"product",type:"relationship",relationTo:"products",required:true},{name:"approved",type:"checkbox",defaultValue:false},{name:"verified",type:"checkbox",label:"Verified Purchase"},{name:"helpful",type:"number",label:"Helpful Count",defaultValue:0}]}),this.adminComponents.ReviewModeration={};}},Xn=class extends xe{constructor(){super("wishlist"),this.description="Customer wishlists",this.collections.push({slug:"wishlists",label:"Wishlists",fields:[{name:"customer",type:"relationship",relationTo:"customers",required:true},{name:"name",type:"text",label:"Wishlist Name",defaultValue:"My Wishlist"},{name:"items",type:"blocks",label:"Items",blocks:[{slug:"wishlist-item",label:"Item",fields:[{name:"product",type:"relationship",relationTo:"products"},{name:"quantity",type:"number",defaultValue:1},{name:"addedAt",type:"date"},{name:"priority",type:"select",options:[{label:"Low",value:"low"},{label:"Medium",value:"medium"},{label:"High",value:"high"}]}]}]}]});}},Dg={SEO:Qn,Analytics:Zn,Comments:Jn,Reviews:Yn,Wishlist:Xn};g();var Do=new Set(["type","admin","label","singularLabel","labelPlural","relationTo","required","hasMany","defaultValue","validate","options","dynamicOptions","filterOptions","hooks","min","max","minLength","maxLength","minRows","maxRows","minDate","maxDate","step","integer","variant","pattern","format","fields","tabs","blocks"]);function jo(t){return typeof t!="object"||t===null||Array.isArray(t)?false:Object.keys(t).some(e=>Do.has(e))}function yr(t,e=""){let r={};for(let[n,s]of Object.entries(t)){let i=e?`${e}.${n}`:n;s&&typeof s=="object"&&!Array.isArray(s)&&!jo(s)?Object.assign(r,yr(s,i)):r[i]=s;}return r}function _e(t,e,r,n=true){let s=e.split(".");if(s.length===0)return false;let i=s[0],o=s.slice(1).join("."),a=i.match(/^(?:tab|tabs)\[(.+?)\]$/i);if(a){let l=a[1].toLowerCase();for(let c of t)if(c.type==="tabs"&&c.tabs&&Array.isArray(c.tabs)){for(let u of c.tabs)if((u.label||u.name||"").toLowerCase()===l&&u.fields&&Array.isArray(u.fields))return _e(u.fields,o,r,n)}return false}for(let l of t){if(l.name===i)if(o){if(l.fields&&Array.isArray(l.fields))return _e(l.fields,o,r,n);if(l.type==="tabs"&&l.tabs&&Array.isArray(l.tabs)){for(let u of l.tabs)if(u.fields&&Array.isArray(u.fields)&&_e(u.fields,o,r,n))return true;return false}if(l.type==="blocks"&&l.blocks&&Array.isArray(l.blocks)){let u=o.split(".")[0],h=o.split(".").slice(1).join(".");if(!h)return false;for(let d of l.blocks)if(d.slug===u&&d.fields&&Array.isArray(d.fields))return _e(d.fields,h,r,n);return false}return l.type==="array"&&l.fields&&Array.isArray(l.fields)?_e(l.fields,o,r,n):false}else return Object.assign(l,r),true;if(l.type==="blocks"&&l.blocks&&Array.isArray(l.blocks)){for(let u of l.blocks)if(u.slug===i&&u.fields&&Array.isArray(u.fields)&&_e(u.fields,o,r,n))return true}if(!l.name||l.type==="tabs"||l.type==="row"||l.type==="collapsible"){if(l.fields&&Array.isArray(l.fields)&&_e(l.fields,e,r,false))return true;if(l.type==="tabs"&&l.tabs&&Array.isArray(l.tabs)){for(let u of l.tabs)if(u.fields&&Array.isArray(u.fields)&&_e(u.fields,e,r,false))return true}}}return n&&!o&&r&&r.type?(t.push({name:i,...r}),true):false}function es(t,e){if(!e)return;let r=Array.isArray(e)?e:Object.entries(e).map(([s,i])=>({slug:i?.slug||s,...i}));function n(s){for(let i of s){if(i.type==="blocks"){Array.isArray(i.blocks)||(i.blocks=[]);for(let o of r){let a=i.blocks.findIndex(l=>l.slug===o.slug);a>=0?i.blocks[a]={...i.blocks[a],...o}:i.blocks.push(o);}return true}if(i.fields&&Array.isArray(i.fields)&&n(i.fields))return true;if(i.type==="tabs"&&i.tabs&&Array.isArray(i.tabs)){for(let o of i.tabs)if(o.fields&&Array.isArray(o.fields)&&n(o.fields))return true}}return false}n(t);}function ts(t,e){if(!e)return;let r=Array.isArray(e)?e:Object.entries(e).map(([s,i])=>({label:i?.label||s,...Array.isArray(i)?{fields:i}:i})),n=t.find(s=>s.type==="tabs");if(n&&Array.isArray(n.tabs))for(let s of r){let i=n.tabs.find(o=>(o.label||o.name||"").toLowerCase()===(s.label||s.name||"").toLowerCase());i?(s.fields&&Array.isArray(s.fields)&&(Array.isArray(i.fields)||(i.fields=[]),i.fields.push(...s.fields)),Object.assign(i,s)):n.tabs.push(s);}else {let s=[...t];t.length=0,t.push({type:"tabs",tabs:[{label:"General",fields:s},...r]});}}function rs(t,e){if(e)for(let r of t){let n=e[r.slug];if(n){let{fields:s,blocks:i,tabs:o,labels:a,label:l,singularLabel:c,labelPlural:u,hidden:h,timestamps:d,versions:p,seo:_,access:w,hooks:R,admin:C,...I}=n;if(l&&(r.label=l),c&&(r.singularLabel=c),u&&(r.labelPlural=u),a&&(a.singular&&(r.singularLabel=a.singular),a.plural&&(r.labelPlural=a.plural)),d!==void 0&&(r.timestamps=d),p!==void 0&&(r.versions={...r.versions,...p}),_!==void 0&&(r.seo=_),w&&(r.access={...r.access,...w}),R&&(r.hooks={...r.hooks,...R}),(C||I)&&(r.admin={...r.admin,...C,...I}),i&&es(r.fields,i),o&&ts(r.fields,o),s){let P=yr(s);for(let[T,S]of Object.entries(P))_e(r.fields,T,S);}}}}function ns(t,e){if(e)for(let r of t){let n=e[r.slug];if(n){let{fields:s,blocks:i,tabs:o,label:a,hidden:l,versions:c,access:u,hooks:h,admin:d,...p}=n;if(a&&(r.label=a),c!==void 0&&(r.versions={...r.versions,...c}),u&&(r.access={...r.access,...u}),h&&(r.hooks={...r.hooks,...h}),(d||p)&&(r.admin={...r.admin,...d,...p}),i&&es(r.fields,i),o&&ts(r.fields,o),s){let _=yr(s);for(let[w,R]of Object.entries(_))_e(r.fields,w,R);}}}}g();g();var Me={red:"\x1B[31m",yellow:"\x1B[33m",magenta:"\x1B[35m",cyan:"\x1B[36m",reset:"\x1B[0m"},qo=Me.yellow+"WARN"+Me.reset,Uo=Me.cyan+"INFO"+Me.reset,Bo=Me.red+"ERR"+Me.reset,Mo=Me.magenta+"DEBUG"+Me.reset,Ut={debug:0,info:1,warn:2,error:3,silent:4},gr=()=>{},xr=t=>(...e)=>console.log(t,...e),Md=console.debug?(...t)=>console.debug(Mo,...t):xr(Mo),$d=console.info?(...t)=>console.info(Uo,...t):xr(Uo),Nd=console.warn?(...t)=>console.warn(qo,...t):xr(qo),Gd=console.error?(...t)=>console.error(Bo,...t):xr(Bo),_r=(t=globalThis.process?.env.DEBUG==="1"?"debug":"info")=>{let e=Ut[t];return {debug:e>Ut.debug?gr:Md,info:e>Ut.info?gr:$d,warn:e>Ut.warn?gr:Nd,error:e>Ut.error?gr:Gd}};g();g();var wr=Symbol.for("@whatwg-node/promise-helpers/FakePromise");function G(t){return t?.then!=null}function zd(t){let e=t;return e&&e.then&&e.catch&&e.finally}function A(t,e,r,n){let s=N().then(t).then(e,r);return Mt(s)}function N(t){return t&&zd(t)?t:G(t)?{then:(e,r)=>N(t.then(e,r)),catch:e=>N(t.then(r=>r,e)),finally:e=>N(e?Wd(t,e):t),[Symbol.toStringTag]:"Promise"}:{then(e){if(e)try{return N(e(t))}catch(r){return bt(r)}return this},catch(){return this},finally(e){if(e)try{return N(e()).then(()=>t,()=>t)}catch(r){return bt(r)}return this},[Symbol.toStringTag]:"Promise",__fakePromiseValue:t,[wr]:"resolved"}}function Bt(){if(Promise.withResolvers)return Promise.withResolvers();let t,e;return {promise:new Promise(function(s,i){t=s,e=i;}),get resolve(){return t},get reject(){return e}}}function Q(t,e,r){if(t?.length===0)return;let n=t[Symbol.iterator](),s=0;function i(){let{done:o,value:a}=n.next();if(o)return;let l=false;function c(){l=true;}return A(function(){return e(a,c,s++)},function(h){if(h&&r?.push(h),!l)return i()})}return i()}function bt(t){return {then(e,r){if(r)try{return N(r(t))}catch(n){return bt(n)}return this},catch(e){if(e)try{return N(e(t))}catch(r){return bt(r)}return this},finally(e){if(e)try{e();}catch(r){return bt(r)}return this},__fakeRejectError:t,[Symbol.toStringTag]:"Promise",[wr]:"rejected"}}function Ie(t,e,r,n){Symbol.asyncIterator in t&&(t=t[Symbol.asyncIterator]());let s,i,o;typeof t.return=="function"&&(s=t.return,i=c=>{let u=()=>{throw c};return s.call(t).then(u,u)});function a(c){return c.done?c:A(()=>c.value,u=>A(()=>e(u),$o,i))}let l;if(r){let c,u=r;l=h=>(c||=A(()=>h,d=>A(()=>u(d),$o,i)),c);}return {next(){return t.next().then(a,l)},return(){let c=s?s.call(t).then(a,l):N({value:void 0,done:true});return o?c.then(o):c},throw(c){return typeof t.throw=="function"?t.throw(c).then(a,l):i?i(c):bt(c)},[Symbol.asyncIterator](){return this}}}function $o(t){return {value:t,done:false}}function Hd(t){return t?.[wr]==="resolved"}function Vd(t){return t?.[wr]==="rejected"}function Wd(t,e){return "finally"in t?t.finally(e):t.then(r=>{let n=e();return G(n)?n.then(()=>r):r},r=>{let n=e();if(G(n))return n.then(()=>{throw r});throw r})}function Mt(t){if(Hd(t))return t.__fakePromiseValue;if(Vd(t))throw t.__fakeRejectError;return t}g();var No='<!doctype html><html lang=en><head><meta charset=utf-8><title>__TITLE__</title><link rel=icon href=https://raw.githubusercontent.com/graphql-hive/graphql-yoga/refs/heads/main/website/src/app/favicon.ico><link crossorigin rel=stylesheet href=https://unpkg.com/@graphql-yoga/graphiql@4.4.4/dist/graphiql.css></head><body id=body class=no-focus-outline><noscript>You need to enable JavaScript to run this app.</noscript><div id=root>Loading __TITLE__...</div><script>function prepareBlob(r){const o=new Blob([r],{type:"application/javascript"});return URL.createObjectURL(o)}const workers={},workerUrls={editorWorkerService:"https://unpkg.com/@graphql-yoga/graphiql@4.4.4/dist/monacoeditorwork/editor.worker.bundle.js",json:"https://unpkg.com/@graphql-yoga/graphiql@4.4.4/dist/monacoeditorwork/json.worker.bundle.js",graphql:"https://unpkg.com/@graphql-yoga/graphiql@4.4.4/dist/monacoeditorwork/graphql.worker..bundle.js"};function prepareWorkers(){return Promise.all(Object.entries(workerUrls).map(async([r,o])=>{const e=await fetch(o),t=await e.text();workers[r]=prepareBlob(t)}))}self.MonacoEnvironment={globalAPI:!1,getWorkerUrl:function(r,o){return workers[o]}}</script><script src=https://unpkg.com/@graphql-yoga/graphiql@4.4.4/dist/yoga-graphiql.umd.js></script><script>prepareWorkers().finally(()=>{YogaGraphiQL.renderYogaGraphiQL(root,__OPTS__)})</script></body></html>';function Kd({headers:t,method:e}){return e==="GET"&&!!t?.get("accept")?.includes("text/html")}var Qd=t=>No.replace("__TITLE__",t?.title||"Yoga GraphiQL").replace("__OPTS__",JSON.stringify(t??{}));function Go(t){let e=t.logger??console,r;typeof t?.options=="function"?r=t?.options:typeof t?.options=="object"?r=()=>t?.options:t?.options===false?r=()=>false:r=()=>({});let n=t?.render??Qd;return {onRequest({request:s,serverContext:i,fetchAPI:o,endResponse:a,url:l}){let c=t.getGraphQLEndpoint();if(Kd(s)&&(s.url.endsWith(c)||s.url.endsWith(`${c}/`)||l.pathname===c||l.pathname===`${c}/`||t.getGraphQLEndpointURLPattern().test(l)))return e.debug("Rendering GraphiQL"),A(()=>r(s,i),u=>{if(u)return A(()=>n({...u===true?{}:u}),h=>{let d=new o.Response(h,{headers:{"Content-Type":"text/html"},status:200});a(d);})})}}}g();function ss(t){return t?.[Symbol.toStringTag]==="GraphQLSchema"}var zo=t=>{if(t==null)return {};if(ss(t))return {onPluginInit({setSchema:e}){e(t);}};if("then"in t){let e;return {onRequestParse(){return {onRequestParseDone(){if(!e)return A(()=>t,r=>{e=r;})}}},onEnveloped({setSchema:r}){if(e==null)throw new Error("You provide a promise of a schema but it hasn't been resolved yet. Make sure you use this plugin with GraphQL Yoga.");if(!ss(e))throw new Error("The resolved schema is not a valid GraphQLSchema instance.");r(e);}}}if(typeof t=="function"){let e=new WeakMap;return {onRequestParse({request:r,serverContext:n}){return {onRequestParseDone(){return A(()=>t({...n,request:r}),s=>{if(!ss(s))throw new Error("The factory function did not return a valid GraphQLSchema.");e.set(r,s);})}}},onEnveloped({setSchema:r,context:n}){if(n?.request==null)throw new Error("Request object is not available in the context. Make sure you use this plugin with GraphQL Yoga.");let s=e.get(n.request);if(s==null)throw new Error("No schema found for this request. Make sure you use this plugin with GraphQL Yoga.");r(s);}}}throw new Error("Invalid schema definition provided, expected a schema, promise or function.")};g();g();g();function te(t){return Sr(t,[])}function Sr(t,e){switch(typeof t){case "string":return JSON.stringify(t);case "function":return t.name?`[function ${t.name}]`:"[function]";case "object":return Zd(t,e);default:return String(t)}}function Ho(t){return (t.name="GraphQLError")?t.toString():`${t.name}: ${t.message};
|
|
22
22
|
${t.stack}`}function Zd(t,e){if(t===null)return "null";if(t instanceof Error)return t.name==="AggregateError"?Ho(t)+`
|
|
23
|
-
`+Vo(t.errors,e):Ho(t);if(e.includes(t))return "[Circular]";let r=[...e,t];if(Jd(t)){let n=t.toJSON();if(n!==t)return typeof n=="string"?n:Sr(n,r)}else if(Array.isArray(t))return Vo(t,r);return Yd(t,r)}function Jd(t){return typeof t.toJSON=="function"}function Yd(t,e){let r=Object.entries(t);return r.length===0?"{}":e.length>3?"["+Xd(t)+"]":"{ "+r.map(([s,i])=>s+": "+Sr(i,e)).join(", ")+" }"}function Vo(t,e){if(t.length===0)return "[]";if(e.length>3)return "[Array]";let r=t.length,n=[];for(let s=0;s<r;++s)n.push(Sr(t[s],e));return "["+n.join(", ")+"]"}function Xd(t){let e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof t.constructor=="function"){let r=t.constructor.name;if(typeof r=="string"&&r!=="")return r}return e}g();var ep=["message","locations","path","nodes","source","positions","originalError","name","stack","extensions","coordinate"];function tp(t){return t!=null&&typeof t=="object"&&Object.keys(t).every(e=>ep.includes(e))}function z(t,e){e?.originalError&&!(e.originalError instanceof Error)&&tp(e.originalError)&&(e.originalError=z(e.originalError.message,e.originalError));let r=b$4,n=a$6.major>=16?new r(t,e):new r(t,e?.nodes,e?.source,e?.positions,e?.path,e?.originalError,e?.extensions);return e?.coordinate&&n.coordinate==null&&Object.defineProperties(n,{coordinate:{value:e.coordinate,enumerable:true,configurable:true}}),n}function le(t,e,r,n){let s=E$1(t,e,r);if(!s.coordinate&&n&&s.coordinate==null){let i=`${n.parentType.name}.${n.fieldName}`;Object.defineProperties(s,{coordinate:{value:i,enumerable:true,configurable:true}});}return s}g();function Wo(t){return t!=null&&typeof t=="object"&&Symbol.iterator in t}function is(t){return typeof t=="object"&&t!==null}function Ko(t,e,r){let n=r;for(let s of t)n=A(()=>n,i=>e(i,s));return n}function Er(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function os(t,e,r={}){let n={},i=(e.arguments??[]).reduce((o,a)=>({...o,[a.name.value]:a}),{});for(let o of t.args){let a=i[o.name];if(!a){if("default"in o&&o.default)n[o.name]="value"in o.default?o.default.value:g$3(o.default.literal);else if(o.defaultValue!==void 0)n[o.name]=o.defaultValue;else if(j$1(o.type))throw z(`Argument "${o.name}" of required type "${te(o.type)}" was not provided.`,{nodes:[e]});continue}let l=a.value,c=l.kind===d$4.NULL;if(l.kind===d$4.VARIABLE){let h=l.name.value;if(r==null||!Er(r,h)){if(o.defaultValue!==void 0)n[o.name]=o.defaultValue;else if(j$1(o.type))throw z(`Argument "${o.name}" of required type "${te(o.type)}" was provided the variable "$${h}" which was not provided a runtime value.`,{nodes:[l]});continue}c=r[h]==null;}if(c&&j$1(o.type))throw z(`Argument "${o.name}" of non-null type "${te(o.type)}" must not be null.`,{nodes:[l]});let u=A$2(l,o.type,r);if(u===void 0)throw z(`Argument "${o.name}" has invalid value ${f$3(l)}.`,{nodes:[l]});n[o.name]=u;}return n}g();function $e(t){let e=new WeakMap;return function(n){let s=e.get(n);if(s===void 0){let i=t(n);return e.set(n,i),i}return s}}function Qo(t){let e=new WeakMap;return function(n,s,i){let o=e.get(n);if(!o){o=new WeakMap,e.set(n,o);let c=new WeakMap;o.set(s,c);let u=t(n,s,i);return c.set(i,u),u}let a=o.get(s);if(!a){a=new WeakMap,o.set(s,a);let c=t(n,s,i);return a.set(i,c),c}let l=a.get(i);if(l===void 0){let c=t(n,s,i);return a.set(i,c),c}return l}}function Zo(t){let e=new WeakMap;return function(n,s,i,o,a){let l=e.get(n);if(!l){l=new WeakMap,e.set(n,l);let p=new WeakMap;l.set(s,p);let _=new WeakMap;p.set(i,_);let w=new WeakMap;_.set(o,w);let R=t(n,s,i,o,a);return w.set(a,R),R}let c=l.get(s);if(!c){c=new WeakMap,l.set(s,c);let p=new WeakMap;c.set(i,p);let _=new WeakMap;p.set(o,_);let w=t(n,s,i,o,a);return _.set(a,w),w}let u=c.get(i);if(!u){u=new WeakMap,c.set(i,u);let p=new WeakMap;u.set(o,p);let _=t(n,s,i,o,a);return p.set(a,_),_}let h=u.get(o);if(!h){h=new WeakMap,u.set(o,h);let p=t(n,s,i,o,a);return h.set(a,p),p}let d=h.get(a);if(d===void 0){let p=t(n,s,i,o,a);return h.set(a,p),p}return d}}g();function Jo(t,e,r){let s=Yo(t).get(e);if(s==null)throw z(`Schema is not configured to execute ${e} operation.`,{nodes:r});return s}var Yo=$e(function(e){let r=new Map,n=e.getQueryType();n&&r.set("query",n);let s=e.getMutationType();s&&r.set("mutation",s);let i=e.getSubscriptionType();return i&&r.set("subscription",i),r});g();g();var Xe=class extends Map{get[Symbol.toStringTag](){return "AccumulatorMap"}add(e,r){let n=this.get(e);n===void 0?this.set(e,[r]):n.push(r);}};g();var Xo=new r$1({name:"defer",description:"Directs the executor to defer this fragment when the `if` argument is true or undefined.",locations:[c$2.FRAGMENT_SPREAD,c$2.INLINE_FRAGMENT],args:{if:{type:new n$1(q$1),description:"Deferred when true or undefined.",defaultValue:true},label:{type:p$1,description:"Unique name"}}}),ea=new r$1({name:"stream",description:"Directs the executor to stream plural fields when the `if` argument is true or undefined.",locations:[c$2.FIELD],args:{if:{type:new n$1(q$1),description:"Stream when true or undefined.",defaultValue:true},label:{type:p$1,description:"Unique name"},initialCount:{defaultValue:0,type:o$1,description:"Number of items to return immediately"}}});function yt(t,e,r,n,s,i,o,a){for(let l of s.selections)switch(l.kind){case d$4.FIELD:{if(!as(r,l))continue;i.add(np(l),l);break}case d$4.INLINE_FRAGMENT:{if(!as(r,l)||!ta(t,l,n))continue;let c=ra(r,l);if(c){let u=new Xe;yt(t,e,r,n,l.selectionSet,u,o,a),o.push({label:c.label,fields:u});}else yt(t,e,r,n,l.selectionSet,i,o,a);break}case d$4.FRAGMENT_SPREAD:{let c=l.name.value;if(!as(r,l))continue;let u=ra(r,l);if(a.has(c)&&!u)continue;let h=e[c];if(!h||!ta(t,h,n))continue;if(u||a.add(c),u){let d=new Xe;yt(t,e,r,n,h.selectionSet,d,o,a),o.push({label:u.label,fields:d});}else yt(t,e,r,n,h.selectionSet,i,o,a);break}}}function ls(t,e,r,n,s){let i=new Xe,o=[];return yt(t,e,r,n,s,i,o,new Set),{fields:i,patches:o}}function as(t,e){return !(B$2(t$1,e,t)?.if===true||B$2(s$1,e,t)?.if===false)}function ta(t,e,r){let n=e.typeCondition;if(!n)return true;let s=y$2(t,n);return s===r?true:m$1(s)?t.getPossibleTypes(s).includes(r):false}function np(t){return t.alias?t.alias.value:t.name.value}function ra(t,e){let r=B$2(Xo,e,t);if(r&&r.if!==false)return {label:typeof r.label=="string"?r.label:void 0}}var na=Zo(function(e,r,n,s,i){let o=new Xe,a=new Set,l=[],c={fields:o,patches:l};for(let u of i)u.selectionSet&&yt(e,r,n,s,u.selectionSet,o,l,a);return c});g();function Pr(t){return t?.[Symbol.asyncIterator]!=null}g();function et(t,e,r){return {prev:t,key:e,typename:r}}function re(t){let e=[],r=t;for(;r;)e.push(r.key),r=r.prev;return e.reverse()}function sa(t){return t.map(e=>typeof e=="number"?"["+e.toString()+"]":"."+e).join("")}g();g();function gt(t,e){let r={...e,...t};for(let n of Object.keys(r))n in t&&n in e&&(r[n]=(s,i)=>t[n](s,()=>e[n](s,i)));return r}var tt=t=>({fn(e,r){return e?(...n)=>{let s;return e(t,()=>{s=r(...n);}),s}:r},asyncFn(e,r){return e?(...n)=>{let s;return A(()=>e(t,()=>(s=r(...n),G(s)?s.then(()=>{}):void 0)),()=>s)}:r}});g();g();g();var ia=new WeakMap;g();function sp(t){return t.length===1?t[0]:{schema:t[0],document:t[1],rootValue:t[2],contextValue:t[3],variableValues:t[4],operationName:t[5],fieldResolver:t[6],subscribeFieldResolver:t[7]}}var cs=t=>((...e)=>t(sp(e)));function ip(t){return t.length===1?t[0]:{schema:t[0],document:t[1],rootValue:t[2],contextValue:t[3],variableValues:t[4],operationName:t[5],fieldResolver:t[6],typeResolver:t[7]}}var us=t=>((...e)=>t(ip(e)));function ce(t){return typeof t=="object"&&t!=null&&typeof t[Symbol.asyncIterator]=="function"}function fs(t,e){if(ce(t.result))return {onNext:e};e({args:t.args,result:t.result,setResult:t.setResult});}function hs(t,e){let r;function n(){return r||(r=t[Symbol.asyncIterator]()),r}let s=false;return {[Symbol.asyncIterator](){return this},next(){return n().next().then(i=>(i.done&&s===false&&(s=true,e()),i))},return(){let i=n().return?.();return s===false&&(s=true,e()),i||N({done:true,value:void 0})},throw(i){let o=n().throw?.();if(o)return o;throw i},[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")](){return N()}}}function oa(t,e){let r;function n(){return r||(r=t[Symbol.asyncIterator]()),r}return {[Symbol.asyncIterator](){return this},next(){return n().next().catch(s=>(e(s),{done:true,value:void 0}))},return(){return n().return?.()||N({done:true,value:void 0})},throw(s){let i=n().throw?.();if(i)return i;throw s},[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")](){return N()}}}function vr(t){throw Error(`No \`${t}\` function found! Register it using "useEngine" plugin.`)}function aa({plugins:t}){let e=null,r=false,n=()=>vr("parse"),s=()=>vr("validate"),i=()=>vr("execute"),o=()=>vr("subscribe"),a,l=(P,T=-1)=>{if(e!==P&&(e=P,r))for(let[S,v]of t.entries())S!==T&&v.onSchemaChange&&v.onSchemaChange({schema:e,replaceSchema:O=>{l(O,S);}});},c=[];for(let P=0;P<t.length;P++){let T=t[P],S=[];T.onPluginInit?.({plugins:t,addPlugin:v=>{S.push(v);},setSchema:v=>l(v,P),registerContextErrorHandler:v=>c.push(v)}),S.length&&t.splice(P+1,0,...S);}let u={init:[],parse:[],validate:[],subscribe:[],execute:[],context:[]};for(let{onContextBuilding:P,onExecute:T,onParse:S,onSubscribe:v,onValidate:O,onEnveloped:g,instrumentation:x}of t)g&&u.init.push(g),P&&u.context.push(P),T&&u.execute.push(T),S&&u.parse.push(S),v&&u.subscribe.push(v),O&&u.validate.push(O),x&&(a=a?gt(a,x):x);let h=P=>{for(let[T,S]of u.init.entries())S({context:P,extendContext:v=>{P&&Object.assign(P,v);},setSchema:v=>l(v,T)});},d=u.parse.length?P=>(T,S)=>{let v=null,O=n,g=P,x=[];for(let E of u.parse){let k=E({context:g,extendContext:L=>{Object.assign(g,L);},params:{source:T,options:S},parseFn:O,setParseFn:L=>{O=L;},setParsedDocument:L=>{v=L;}});k&&x.push(k);}if(v===null)try{v=O(T,S);}catch(E){v=E;}for(let E of x)E({context:g,extendContext:k=>{Object.assign(g,k);},replaceParseResult:k=>{v=k;},result:v});if(v===null)throw new Error("Failed to parse document.");if(v instanceof Error)throw v;return ia.set(v,T.toString()),v}:()=>n,p=u.validate.length?P=>(T,S,v,O,g)=>{let x=v?[...v]:void 0,E=s,k=null,L=P,j=[];for(let W of u.validate){let $=W({context:L,extendContext:J=>{Object.assign(L,J);},params:{schema:T,documentAST:S,rules:x,typeInfo:O,options:g},validateFn:E,addValidationRule:J=>{x||(x=[]),x.push(J);},setValidationFn:J=>{E=J;},setResult:J=>{k=J;}});$&&j.push($);}if(k||(k=E(T,S,x,O,g)),!k)return;let M=k.length===0;for(let W of j)W({valid:M,result:k,context:L,extendContext:$=>{Object.assign(L,$);},setResult:$=>{k=$;}});return k}:()=>s,_=u.context.length?P=>T=>{let S=[],v=P;T&&Object.assign(v,T);let O=false;return A(()=>Q(u.context,(g,x)=>g({context:v,extendContext:E=>{Object.assign(v,E);},breakContextBuilding:()=>{O=true,x();}}),S),()=>O?v:A(()=>Q(S,g=>g({context:v,extendContext(x){Object.assign(v,x);}})),()=>v),g=>{let x=g;for(let E of c)E({context:v,error:x,setError:k=>{x=k;}});throw x})}:P=>T=>(T&&Object.assign(P,T),P),R=u.subscribe.length?cs(P=>{let T=o,S=[],v=P.contextValue||{},O;return A(()=>Q(u.subscribe,(g,x)=>g({subscribeFn:T,setSubscribeFn:E=>{T=E;},context:v,extendContext:E=>{Object.assign(v,E);},args:P,setResultAndStopExecution:E=>{O=E,x();}}),S),()=>{let g=[],x=[];for(let{onSubscribeResult:E,onSubscribeError:k}of S)E&&g.push(E),k&&x.push(k);return A(()=>O||T(P),E=>{let k=[],L=[];for(let j of g){let M=j({args:P,result:E,setResult:W=>{E=W;}});M&&(M.onNext&&k.push(M.onNext),M.onEnd&&L.push(M.onEnd));}return k.length&&ce(E)&&(E=Ie(E,j=>A(()=>Q(k,M=>M({args:P,result:j,setResult:W=>j=W})),()=>j))),L.length&&ce(E)&&(E=hs(E,()=>{for(let j of L)j();})),x.length&&ce(E)&&(E=oa(E,j=>{let M=j;for(let W of x)W({error:M,setError:$=>{M=$;}});throw M})),E})})}):cs(o),I=u.execute.length?us(P=>{let T=i,S,v=[],O=[],g=P.contextValue||{};return A(()=>Q(u.execute,(x,E)=>x({executeFn:T,setExecuteFn:k=>{T=k;},setResultAndStopExecution:k=>{S=k,E();},context:g,extendContext:k=>{if(typeof k=="object")Object.assign(g,k);else throw new Error(`Invalid context extension provided! Expected "object", got: "${JSON.stringify(k)}" (${typeof k})`)},args:P}),v),()=>A(()=>S||T({...P,contextValue:g}),x=>A(()=>Q(v,E=>E.onExecuteDone?.({args:P,result:x,setResult:k=>{x=k;}}),O),()=>{let E=[],k=[];for(let{onNext:L,onEnd:j}of O)L&&E.push(L),j&&k.push(j);return E.length&&ce(x)&&(x=Ie(x,L=>A(()=>Q(E,j=>j({args:P,result:L,setResult:M=>{L=M;}})),()=>L))),k.length&&ce(x)&&(x=hs(x,()=>{for(let L of k)L();})),x})))}):us(i);if(r=true,e)for(let[P,T]of t.entries())T.onSchemaChange?.({schema:e,replaceSchema:S=>l(S,P)});return {getCurrentSchema(){return e},init:h,parse:d,validate:p,execute:I,subscribe:R,contextFactory:_,instrumentation:a}}function op(t){return t!=null}function la(t){let e=t.plugins.filter(op),r=aa({plugins:e}),n=r.instrumentation,s=(i={})=>{let o=tt({context:i}),a=r;return o.fn(n?.init,r.init)(i),{parse:o.fn(n?.parse,a.parse(i)),validate:o.fn(n?.validate,a.validate(i)),contextFactory:o.fn(n?.context,a.contextFactory(i)),execute:o.asyncFn(n?.execute,a.execute),subscribe:o.asyncFn(n?.subscribe,a.subscribe),schema:a.getCurrentSchema()}};return s._plugins=e,s}g();var ap="Unexpected error.";function lp(t){return t instanceof Error&&t.name==="GraphQLError"}function ca(t){return lp(t)?t.originalError!=null?ca(t.originalError):true:false}function cp(t,e,r){let n=new Error(t);if(n.name="GraphQLError",r){let s=e instanceof Error?{message:e.message,stack:e.stack}:{message:String(e)};Object.defineProperty(n,"extensions",{get(){return s}});}return Object.defineProperty(n,"toJSON",{value(){return {message:n.message,extensions:n.extensions}}}),n}var up=t=>(e,r)=>ca(e)?e:cp(r,e,t),fp=globalThis.process?.env?.NODE_ENV==="development",hp=up(fp),dp=(t,e)=>({result:r,setResult:n})=>{r.errors!=null&&n({...r,errors:r.errors.map(s=>t(s,e))});};function ua(t){let e=t?.maskError??hp,r=t?.errorMessage||ap,n=dp(e,r);return {onPluginInit(s){s.registerContextErrorHandler(({error:i,setError:o})=>{o(e(i,r));});},onExecute(){return {onExecuteDone(s){return fs(s,n)}}},onSubscribe(){return {onSubscribeResult(s){return fs(s,n)},onSubscribeError({error:s,setError:i}){i(e(s,r));}}}}}g();var fa=t=>({onContextBuilding({context:e,extendContext:r}){return A(()=>t(e),n=>r(n))}});g();var ha=t=>({onExecute:({setExecuteFn:e})=>{t.execute&&e(t.execute);},onParse:({setParseFn:e})=>{t.parse&&e(t.parse);},onValidate:({setValidationFn:e,addValidationRule:r})=>{t.validate&&e(t.validate),t.specifiedRules?.map(r);},onSubscribe:({setSubscribeFn:e})=>{t.subscribe&&e(t.subscribe);}});g();g();g();g();var Ne=class extends Error{error;suppressed;constructor(e,r,n){super(n),this.error=e,this.suppressed=r,this.name="SuppressedError",Error.captureStackTrace(this,this.constructor);}};g();var H={get dispose(){return Symbol.dispose||Symbol.for("dispose")},get asyncDispose(){return Symbol.asyncDispose||Symbol.for("asyncDispose")}};g();function kr(t){return t?.[H.dispose]!=null}function da(t){return t?.[H.asyncDispose]!=null}var pp=globalThis.SuppressedError||Ne,Tr=class t{callbacks=[];get disposed(){return this.callbacks.length===0}use(e){return da(e)?this.callbacks.push(()=>e[H.asyncDispose]()):kr(e)&&this.callbacks.push(()=>e[H.dispose]()),e}adopt(e,r){return r&&this.callbacks.push(()=>r(e)),e}defer(e){e&&this.callbacks.push(e);}move(){let e=new t;return e.callbacks=this.callbacks,this.callbacks=[],e}disposeAsync(){return this[H.asyncDispose]()}_error;_iterateCallbacks(){let e=this.callbacks.pop();if(e)return A(e,()=>this._iterateCallbacks(),r=>(this._error=this._error?new pp(r,this._error):r,this._iterateCallbacks()))}[H.asyncDispose](){let e=this._iterateCallbacks();if(e?.then)return e.then(()=>{if(this._error){let r=this._error;throw this._error=void 0,r}});if(this._error){let r=this._error;throw this._error=void 0,r}}[Symbol.toStringTag]="AsyncDisposableStack"};g();var pa=globalThis.AsyncDisposableStack||Tr;g();function we(t){if(t instanceof Error)return t;if(typeof t=="object"&&t!=null&&"message"in t&&typeof t.message=="string"){let e;"cause"in t&&(e={cause:t.cause});let r=new Error(t.message,e);return "stack"in t&&typeof t.stack=="string"&&(r.stack=t.stack),"name"in t&&typeof t.name=="string"&&(r.name=t.name),r}return new Error(String(t))}g();function ma(t){let e=t[Symbol.asyncIterator](),r,n,s=false;async function i(){if(s)return {value:void 0,done:true};try{if(!r){if(n)return await n,await i();let l;n=new Promise(u=>{l=u;});let c=await e.next();return c.done?(s=!0,await i()):(r=c.value[Symbol.asyncIterator](),n=void 0,l(),await i())}let o=r,a=await r.next();return a.done?(r===o&&(r=void 0),await i()):a}catch(o){throw s=true,o}}return {next:i,async return(){return s=true,await Promise.all([r?.return?.(),e.return?.()]),{value:void 0,done:true}},async throw(o){throw s=true,await Promise.all([r?.throw?.(o),e.throw?.(o)]),o},[Symbol.asyncIterator](){return this},async[H.asyncDispose](){s=true,await Promise.all([r?.[H.asyncDispose]?.(),e?.[H.asyncDispose]?.()]);}}}g();function ds(t,e){if(!t)throw new Error(e??"Unexpected invariant triggered.")}g();function ps(t,e,r){e?.throwIfAborted();let n=Object.create(null),s=[];for(let o in t){let a=A(()=>t[o],l=>{n[o]=l;});G(a)&&s.push(a);}if(!s.length)return n;let i=s.length===1?s[0]:Promise.all(s);return r?Promise.race([r,i]).then(()=>n):i.then(()=>n)}g();function ba(t,e,r,n){let s=[],i=n?.maxErrors;try{let o=bp(t,e,r,a=>{if(i!=null&&s.length>=i)throw z("Too many errors processing variables, error limit reached. Execution aborted.");s.push(a);});if(s.length===0)return {coerced:o}}catch(o){s.push(o);}return {errors:s}}function bp(t,e,r,n){let s={};for(let i of e){let o=i.variable.name.value,a=y$2(t,i.type);if(!k$1(a)){let c=f$3(i.type);n(z(`Variable "$${o}" expected value of type "${c}" which cannot be used as an input type.`,{nodes:i.type}));continue}if(!Er(r,o)){if(i.defaultValue)s[o]=A$2(i.defaultValue,a);else if(j$1(a)){let c=te(a);n(z(`Variable "$${o}" of required type "${c}" was not provided.`,{nodes:i}));}continue}let l=r[o];if(l===null&&j$1(a)){let c=te(a);n(z(`Variable "$${o}" of non-null type "${c}" must not be null.`,{nodes:i}));continue}s[o]=z$2(l,a,(c,u,h)=>{let d=`Variable "$${o}" got invalid value `+te(u);c.length>0&&(d+=` at "${o}${sa(c)}"`),n(z(d+"; "+h.message,{nodes:i,originalError:h}));});}return s}var yp=Qo((t,e,r)=>na(t.schema,t.fragments,t.variableValues,e,r));function va(t){let e=Ta(t);return "schema"in e?ka(e):{errors:e.map(r=>(Object.defineProperty(r,"extensions",{value:{...r.extensions,http:{...r.extensions?.http||{},status:400}}}),r))}}function ka(t){return t.signal?.throwIfAborted(),A(()=>_p(t),e=>{let r=ya(e,t.errors);return t.subsequentPayloads.size>0?{initialResult:{...r,hasNext:true},subsequentResults:Dp(t)}:r},e=>(t.signal?.throwIfAborted(),e.errors?t.errors.push(...e.errors):t.errors.push(e),ya(null,t.errors)))}function ya(t,e){return e.length===0?{data:t}:{errors:e,data:t}}var gp=$e(function(e){let r=Object.create(null);for(let n of e.definitions)n.kind===d$4.FRAGMENT_DEFINITION&&(r[n.name.value]=n);return r});function Ta(t){let{schema:e,document:r,rootValue:n,contextValue:s,variableValues:i,operationName:o,fieldResolver:a,typeResolver:l,subscribeFieldResolver:c,signal:u,schemaCoordinateInErrors:h}=t;u?.throwIfAborted(),x$1(e);let d=gp(r),p;for(let I of r.definitions)switch(I.kind){case d$4.OPERATION_DEFINITION:if(o==null){if(p!==void 0)return [z("Must provide operation name if query contains multiple operations.",{extensions:{code:"OPERATION_RESOLUTION_FAILURE"}})];p=I;}else I.name?.value===o&&(p=I);break;}if(p==null)return o!=null?[z(`Unknown operation named "${o}".`,{extensions:{code:"OPERATION_RESOLUTION_FAILURE"}})]:[z("Must provide an operation.",{extensions:{code:"OPERATION_RESOLUTION_FAILURE"}})];let _=p.variableDefinitions??[],w=ba(e,_,i??{},{maxErrors:50});if(w.errors)return w.errors;u?.throwIfAborted();let R,C;if(u){let I=new Set,P=Bt();C=P.promise;let T=()=>{P.reject(u.reason),u.removeEventListener("abort",T);};u.addEventListener("abort",T,{once:true}),C.catch(()=>{for(let S of I)S();I.clear();}),R=S=>{I.add(S);};}return {schema:e,fragments:d,rootValue:n,contextValue:s,operation:p,variableValues:w.coerced,fieldResolver:a??wa,typeResolver:l??Tp,subscribeFieldResolver:c??wa,subsequentPayloads:new Set,errors:[],signal:u,onSignalAbort:R,signalPromise:C,schemaCoordinateInErrors:h}}function xp(t,e){return {...t,rootValue:e,subsequentPayloads:new Set,errors:[]}}function _p(t){let{operation:e,schema:r,fragments:n,variableValues:s,rootValue:i}=t,o=Jo(r,e.operation,[e]);o==null&&z(`Schema is not configured to execute ${e.operation} operation.`,{nodes:e});let{fields:a,patches:l}=ls(r,n,s,o,e.selectionSet),c=void 0,u;e.operation==="mutation"?u=wp(t,o,i,c,a):u=ys(t,o,i,c,a);for(let h of l){let{label:d,fields:p}=h;Ia(t,o,i,p,d,c);}return u}function wp(t,e,r,n,s){return Ko(s,(i,[o,a])=>{let l=et(n,o,e.name);return t.signal?.throwIfAborted(),A(()=>Ca(t,e,r,a,l),c=>(c===void 0||(i[o]=c),i))},Object.create(null))}function ys(t,e,r,n,s,i){let o=Object.create(null),a=false;try{for(let[l,c]of s){t.signal?.throwIfAborted();let u=et(n,l,e.name),h=Ca(t,e,r,c,u,i);h!==void 0&&(o[l]=h,G(h)&&(a=!0));}}catch(l){if(l!==t.signal?.reason&&a)return A(()=>ps(o,t.signal),()=>{throw l},()=>{throw l});throw l}return a?ps(o,t.signal,t.signalPromise):o}function Ca(t,e,r,n,s,i){let o=i?.errors??t.errors,a=Da(t.schema,e,n[0]);if(!a)return;let l=a.type,c=a.resolve??t.fieldResolver,u=Aa(t,a,n,e,s);try{t.signal?.throwIfAborted();let h=os(a,n[0],t.variableValues),d=t.contextValue,p=c(r,h,d,u),_;return G(p)?_=p.then(w=>Ge(t,l,n,u,s,w,i)):_=Ge(t,l,n,u,s,p,i),G(_)?_.then(void 0,w=>{if(w instanceof AggregateError){let I;for(let P of w.errors){P=we(P);let T=le(P,n,re(s),t.schemaCoordinateInErrors&&u);I=ye(T,l,o),he(t,s,i);}return I}w=we(w);let R=le(w,n,re(s),t.schemaCoordinateInErrors&&u),C=ye(R,l,o);return he(t,s,i),C}):_}catch(h){if(h instanceof AggregateError){let w;for(let R of h.errors){R=we(R);let C=le(R,n,re(s),t.schemaCoordinateInErrors&&u);w=ye(C,l,o),he(t,s,i);}return w}let d=we(h),p=le(d,n,re(s),t.schemaCoordinateInErrors&&u),_=ye(p,l,o);return he(t,s,i),_}}function Aa(t,e,r,n,s){return {fieldName:e.name,fieldNodes:r,returnType:e.type,parentType:n,path:s,schema:t.schema,fragments:t.fragments,rootValue:t.rootValue,operation:t.operation,variableValues:t.variableValues,signal:t.signal}}var Sp="CRITICAL_ERROR";function ye(t,e,r){if(j$1(e)||t.extensions?.[Sp])throw t;return r.push(t),null}function Ge(t,e,r,n,s,i,o){if(i instanceof Error)throw i;if(j$1(e)){let a=Ge(t,e.ofType,r,n,s,i,o);if(a===null)throw new Error(`Cannot return null for non-nullable field ${n.parentType.name}.${n.fieldName}.`);return a}if(i==null)return null;if(i$2(e))return Pp(t,e,r,n,s,i,o);if(l$1(e))return vp(e,i);if(m$1(e))return kp(t,e,r,n,s,i,o);if(h$1(e))return ms(t,e,r,n,s,i,o);console.assert(false,"Cannot complete value of unexpected output type: "+te(e));}function Ra(t,e,r){if(typeof r.key=="number")return;let n=B$2(ea,e[0],t.variableValues);if(n&&n.if!==false)return ds(typeof n.initialCount=="number","initialCount must be a number"),ds(n.initialCount>=0,"initialCount must be a positive integer"),{initialCount:n.initialCount,label:typeof n.label=="string"?n.label:void 0}}async function Ep(t,e,r,n,s,i,o){t.signal?.throwIfAborted(),i.return&&t.onSignalAbort?.(()=>{i.return?.();});let a=o?.errors??t.errors,l=Ra(t,r,s),c=false,u=[],h=0;for(;;){if(l&&typeof l.initialCount=="number"&&h>=l.initialCount){Fp(h,i,t,r,n,e,s,l.label,o);break}let d=et(s,h,void 0),p;try{if(p=await i.next(),p.done)break}catch(_){let w=we(_),R=le(w,r,re(d),t.schemaCoordinateInErrors&&n);u.push(ye(R,e,a));break}La(p.value,u,a,t,e,r,n,d,o)&&(c=true),h+=1;}return c?Promise.all(u):u}function Pp(t,e,r,n,s,i,o){let a=e.ofType,l=o?.errors??t.errors;if(Pr(i)){let _=i[Symbol.asyncIterator]();return Ep(t,a,r,n,s,_,o)}if(!Wo(i))throw z(`Expected Iterable, but did not find one for field "${n.parentType.name}.${n.fieldName}".`);let c=Ra(t,r,s),u=false,h=o,d=[],p=0;for(let _ of i){let w=et(s,p,void 0);if(c&&typeof c.initialCount=="number"&&p>=c.initialCount){h=Lp(s,w,_,t,r,n,a,c.label,h),p++;continue}La(_,d,l,t,a,r,n,w,o)&&(u=true),p++;}return u?Promise.all(d):d}function La(t,e,r,n,s,i,o,a,l){try{let c;if(G(t)?c=t.then(u=>Ge(n,s,i,o,a,u,l)):c=Ge(n,s,i,o,a,t,l),G(c))return e.push(c.then(void 0,u=>{u=we(u);let h=le(u,i,re(a),n.schemaCoordinateInErrors&&o),d=ye(h,s,r);return he(n,a,l),d})),!0;e.push(c);}catch(c){let u=we(c),h=le(u,i,re(a),n.schemaCoordinateInErrors&&o),d=ye(h,s,r);he(n,a,l),e.push(d);}return false}function vp(t,e){let r;try{r=t.serialize(e);}catch(n){throw n instanceof b$4?new Error(n.message):n}if(r==null)throw new Error(`Expected \`${te(t)}.serialize(${te(e)})\` to return non-nullable value, returned: ${te(r)}`);return r}function kp(t,e,r,n,s,i,o){let a=e.resolveType??t.typeResolver,l=t.contextValue,c=a(i,l,n,e);return G(c)?c.then(u=>ms(t,ga(u,t,e,r,n,i),r,n,s,i,o)):ms(t,ga(c,t,e,r,n,i),r,n,s,i,o)}function ga(t,e,r,n,s,i){if(t==null)throw z(`Abstract type "${r.name}" must resolve to an Object type at runtime for field "${s.parentType.name}.${s.fieldName}". Either the "${r.name}" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.`,{nodes:n});if(h$1(t)){if(a$6.major>=16)throw z("Support for returning GraphQLObjectType from resolveType was removed in graphql-js@16.0.0 please return type name instead.");t=t.name;}if(typeof t!="string")throw z(`Abstract type "${r.name}" must resolve to an Object type at runtime for field "${s.parentType.name}.${s.fieldName}" with value ${te(i)}, received "${te(t)}".`);let o=e.schema.getType(t);if(o==null)throw z(`Abstract type "${r.name}" was resolved to a type "${t}" that does not exist inside the schema.`,{nodes:n});if(!h$1(o))throw z(`Abstract type "${r.name}" was resolved to a non-object type "${t}".`,{nodes:n});if(!e.schema.isSubType(r,o))throw z(`Runtime Object type "${o.name}" is not a possible type for "${r.name}".`,{nodes:n});return o}function ms(t,e,r,n,s,i,o){if(e.isTypeOf){let a=e.isTypeOf(i,t.contextValue,n);if(G(a))return a.then(l=>{if(!l)throw xa(e,i,r);return _a(t,e,r,s,i,o)});if(!a)throw xa(e,i,r)}return _a(t,e,r,s,i,o)}function xa(t,e,r){return z(`Expected value of type "${t.name}" but got: ${te(e)}.`,{nodes:r})}function _a(t,e,r,n,s,i){let{fields:o,patches:a}=yp(t,e,r),l=ys(t,e,s,n,o,i);for(let c of a){let{label:u,fields:h}=c;Ia(t,e,s,h,u,n,i);}return l}var Tp=function(t,e,r,n){if(is(t)&&typeof t.__typename=="string")return t.__typename;let s=r.schema.getPossibleTypes(n),i=[];for(let o=0;o<s.length;o++){let a=s[o];if(a.isTypeOf){let l=a.isTypeOf(t,e,r);if(G(l))i[o]=l;else if(l)return a.name}}if(i.length)return Promise.all(i).then(o=>{for(let a=0;a<o.length;a++)if(o[a])return s[a].name})},wa=function(t,e,r,n){if(is(t)||typeof t=="function"){let s=t[n.fieldName];return typeof s=="function"?t[n.fieldName](e,r,n):s}};function Oa(t){let e=Ta(t);if(!("schema"in e)){for(let n of e){let s=n.extensions||={},i=s.http||={};i.status=400,n.extensions.code="BAD_USER_INPUT";}return {errors:e}}let r=Ap(e);return G(r)?r.then(n=>Sa(e,n)):Sa(e,r)}function Fa(t){return t?.initialResult}function gs(t){let e=t.subsequentResults,r=false,n=false;return {[Symbol.asyncIterator](){return this},next(){return n?N({value:void 0,done:n}):r?e.next():(r=true,N({value:t.initialResult,done:n}))},return(){return n=true,e.return()},throw(s){return n=true,e.throw(s)},[H.asyncDispose](){return n=true,e?.[H.asyncDispose]?.()}}}async function*Cp(t){"initialResult"in t?yield*gs(t):yield t;}function Sa(t,e){return Pr(e)?ma(Ie(e,r=>A(()=>ka(xp(t,r)),Cp),r=>{throw r instanceof AggregateError?new AggregateError(r.errors.map(n=>Ea(n,t.operation)),r.message):Ea(r,t.operation)})):e}function Ea(t,e){return z(t.message,{originalError:t,nodes:[e]})}function Ap(t){try{let e=Rp(t);return G(e)?e.then(void 0,r=>({errors:[r]})):e}catch(e){return {errors:[e]}}}function Rp(t){let{schema:e,fragments:r,operation:n,variableValues:s,rootValue:i}=t,o=e.getSubscriptionType();if(o==null)throw z("Schema is not configured to execute subscription operation.",{nodes:n});let{fields:a}=ls(e,r,s,o,n.selectionSet),[l,c]=[...a.entries()][0],u=c[0].name.value,h=Da(e,o,c[0]);if(!h)throw z(`The subscription field "${u}" is not defined.`,{nodes:c});let d=et(void 0,l,o.name),p=Aa(t,h,c,o,d);try{let _=os(h,c[0],s),w=t.contextValue,C=(h.subscribe??t.subscribeFieldResolver)(i,_,w,p);return G(C)?C.then(I=>Pa(I,t.signal,t.onSignalAbort)).then(void 0,I=>{throw le(I,c,re(d),t.schemaCoordinateInErrors&&p)}):Pa(C,t.signal,t.onSignalAbort)}catch(_){throw le(_,c,re(d),t.schemaCoordinateInErrors&&p)}}function Pa(t,e,r){if(e?.throwIfAborted(),t instanceof Error)throw t;if(!Pr(t))throw z(`Subscription field must return Async Iterable. Received: ${te(t)}.`);return r?{[Symbol.asyncIterator](){let n=t[Symbol.asyncIterator]();return n.return&&r?.(()=>{n.return?.();}),n}}:t}function Ia(t,e,r,n,s,i,o){let a=new bs({label:s,path:i,parentContext:o,exeContext:t}),l;try{l=ys(t,e,r,i,n,a),G(l)&&(l=l.then(null,c=>(a.errors.push(c),null)));}catch(c){a.errors.push(c),l=null;}a.addData(l);}function Lp(t,e,r,n,s,i,o,a,l){let c=new Ar({label:a,path:e,parentContext:l,exeContext:n}),u;try{try{G(r)?u=r.then(d=>Ge(n,o,s,i,e,d,c)):u=Ge(n,o,s,i,e,r,c),G(u)&&(u=u.then(void 0,d=>{d=we(d);let p=le(d,s,re(e),n.schemaCoordinateInErrors&&i),_=ye(p,o,c.errors);return he(n,e,c),_}));}catch(d){let p=we(d),_=le(p,s,re(e),n.schemaCoordinateInErrors&&i);u=ye(_,o,c.errors),he(n,e,c);}}catch(d){return c.errors.push(d),he(n,t,c),c.addItems(null),c}let h;return G(u)?h=u.then(d=>[d],d=>(c.errors.push(d),he(n,t,c),null)):h=[u],c.addItems(h),c}async function Op(t,e,r,n,s,i,o){let a;try{let{value:c,done:u}=await t.next();if(u)return i.setIsCompletedIterator(),{done:u,value:void 0};a=c;}catch(c){let u=we(c),h=le(u,r,re(o),e.schemaCoordinateInErrors&&n);return {done:true,value:ye(h,s,i.errors)}}let l;try{return l=Ge(e,s,r,n,o,a,i),G(l)&&(l=l.then(void 0,c=>{let u=le(c,r,re(o),e.schemaCoordinateInErrors&&n),h=ye(u,s,i.errors);return he(e,o,i),h})),{done:!1,value:l}}catch(c){let u=le(c,r,re(o),e.schemaCoordinateInErrors&&n),h=ye(u,s,i.errors);return he(e,o,i),{done:false,value:h}}}async function Fp(t,e,r,n,s,i,o,a,l){let c=t,u=l??void 0;for(;;){let h=et(o,c,void 0),d=new Ar({label:a,path:h,parentContext:u,iterator:e,exeContext:r}),p;try{p=await Op(e,r,n,s,i,d,h);}catch(C){d.errors.push(C),he(r,o,d),d.addItems(null),e?.return&&e.return().catch(()=>{});return}let{done:_,value:w}=p,R;if(G(w)?R=w.then(C=>[C],C=>(d.errors.push(C),he(r,o,d),null)):R=[w],d.addItems(R),_)break;u=d,c++;}}function he(t,e,r){let n=re(e);t.subsequentPayloads.forEach(s=>{if(s!==r){for(let i=0;i<n.length;i++)if(s.path[i]!==n[i])return;xs(s)&&s.iterator?.return&&s.iterator.return().catch(()=>{}),t.subsequentPayloads.delete(s);}});}function Ip(t){let e=[];for(let r of t.subsequentPayloads){let n={};if(r.isCompleted){if(t.subsequentPayloads.delete(r),xs(r)){let s=r.items;if(r.isCompletedIterator)continue;n.items=s;}else {let s=r.data;n.data=s??null;}n.path=r.path,r.label&&(n.label=r.label),r.errors.length>0&&(n.errors=r.errors),e.push(n);}}return e}function Dp(t){let e=false;async function r(){if(e)return {value:void 0,done:true};let s=Array.from(t.subsequentPayloads).map(a=>a.promise);if(t.signalPromise?await Promise.race([t.signalPromise,...s]):await Promise.race(s),e)return {value:void 0,done:true};let i=Ip(t),o=t.subsequentPayloads.size>0;return !i.length&&o?r():(o||(e=true),{value:i.length?{incremental:i,hasNext:o}:{hasNext:o},done:false})}function n(){let s=[];return t.subsequentPayloads.forEach(i=>{xs(i)&&i.iterator?.return&&s.push(i.iterator.return());}),Promise.all(s)}return {[Symbol.asyncIterator](){return this},next:r,async return(){return await n(),e=true,{value:void 0,done:true}},async throw(s){throw await n(),e=true,s},async[H.asyncDispose](){await n(),e=true;}}}var bs=class{type;errors;label;path;promise;data;parentContext;isCompleted;_exeContext;_resolve;constructor(e){this.type="defer",this.label=e.label,this.path=re(e.path),this.parentContext=e.parentContext,this.errors=[],this._exeContext=e.exeContext,this._exeContext.subsequentPayloads.add(this),this.isCompleted=false,this.data=null,this.promise=new Promise(r=>{this._resolve=n=>{r(n);};}).then(r=>{this.data=r,this.isCompleted=true;});}addData(e){let r=this.parentContext?.promise;if(r){this._resolve?.(r.then(()=>e));return}this._resolve?.(e);}},Ar=class{type;errors;label;path;items;promise;parentContext;iterator;isCompletedIterator;isCompleted;_exeContext;_resolve;constructor(e){this.type="stream",this.items=null,this.label=e.label,this.path=re(e.path),this.parentContext=e.parentContext,this.iterator=e.iterator,this.errors=[],this._exeContext=e.exeContext,this._exeContext.subsequentPayloads.add(this),this.isCompleted=false,this.items=null,this.promise=new Promise(r=>{this._resolve=n=>{r(n);};}).then(r=>{this.items=r,this.isCompleted=true;});}addItems(e){let r=this.parentContext?.promise;if(r){this._resolve?.(r.then(()=>e));return}this._resolve?.(e);}setIsCompletedIterator(){this.isCompletedIterator=true;}};function xs(t){return t.type==="stream"}function Da(t,e,r){let n=r.name.value;return n===u$1.name&&t.getQueryType()===e?u$1:n===v$1.name&&t.getQueryType()===e?v$1:n===w$1.name?w$1:e.getFields()[n]}g();function Rr(t){let e=F$2(t.document,t.operationName);if(e==null)throw new Error("Must provide an operation.");return e.operation==="subscription"?Oa(t):A(()=>va(t),r=>Fa(r)?gs(r):r)}var ag=e$1(sr(),1);g();var Uy=e$1(sr(),1);g();function fu(t){return t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function"}function ky(t){if(t.socket?.localPort)return t.socket?.localPort;let r=(t.headers?.[":authority"]||t.headers?.host)?.split(":")?.[1];return r||80}function Ty(t){if(t.headers?.[":authority"])return t.headers?.[":authority"];if(t.headers?.host)return t.headers?.host;let e=ky(t);if(t.hostname)return t.hostname+":"+e;let r=t.socket?.localAddress;return r&&!r?.includes("::")&&!r?.includes("ffff")?`${r}:${e}`:"localhost"}function Cy(t){let e=Ty(t),r=t.protocol||(t.socket?.encrypted?"https":"http"),n=t.originalUrl||t.url||"/graphql";return `${r}://${e}${n}`}function Ay(t){let e=t[Symbol.toStringTag];return !!(typeof t=="string"||e==="Uint8Array"||e==="Blob"||e==="FormData"||e==="URLSearchParams"||fu(t))}function Bi(t,e,r,n){let s=t.raw||t.req||t,i=Cy(s);if(t.query){let c=new e.URL(i);for(let u in t.query)c.searchParams.set(u,t.query[u]);i=c.toString();}let o=t.headers;if(t.headers?.[":method"]){o={};for(let c in t.headers)c.startsWith(":")||(o[c]=t.headers[c]);}let a=n?zi():new AbortController;if(r?.once){let c=()=>{a.signal.aborted||(Object.defineProperty(s,"aborted",{value:true}),a.abort(r.errored??void 0));};r.once("error",c),r.once("close",c),r.once("finish",()=>{r.removeListener("close",c);});}if(t.method==="GET"||t.method==="HEAD")return new e.Request(i,{method:t.method,headers:o,signal:a.signal});let l=t.body;if(l!=null&&Object.keys(l).length>0){if(Ay(l))return new e.Request(i,{method:t.method||"GET",headers:o,body:l,signal:a.signal});let c=new e.Request(i,{method:t.method||"GET",headers:o,signal:a.signal});return c.headers.get("content-type")?.includes("json")||c.headers.set("content-type","application/json; charset=utf-8"),new Proxy(c,{get(u,h,d){switch(h){case "json":return ()=>N(l);case "text":return ()=>N(JSON.stringify(l));default:{let p=Reflect.get(c,h,c);return typeof p=="function"?function(...w){return p.apply(this===d?c:this,w)}:p}}}})}return new e.Request(i,{method:t.method,headers:o,signal:a.signal,body:s,duplex:"half"})}function hu(t){return t.read!=null}function du(t){return hu(t)}function Mi(t){return t!=null&&t.setHeader!=null&&t.end!=null&&t.once!=null&&t.write!=null}function Ry(t){return t!=null&&t.getReader!=null}function pu(t){return t!=null&&t.request!=null&&t.respondWith!=null}function Ly(t){t?.socket?.setTimeout?.(0),t?.socket?.setNoDelay?.(true),t?.socket?.setKeepAlive?.(true);}function ir(t){t.end(null,null,null);}function Oy(t,e){let r=false,n=()=>{r=true;};t.once("error",n),t.once("close",n),t.once("finish",()=>{t.removeListener("close",n),t.removeListener("error",n);});let s=e[Symbol.asyncIterator]();return mu(()=>s.next(),t,()=>r)}function cu(t){t.end(null,null,null);}function mu(t,e,r){let n=()=>A(t,s=>r?.()||s.done?cu(e):A(()=>yn(s.value,e),()=>r?.()?cu(e):n()));return n()}function yn(t,e){if(!e.write(t))return new Promise(n=>e.once("drain",n))}var Fy=globalThis.process?.versions?.node?.startsWith("1");function bu(t,e,r,n){if(e.closed||e.destroyed||e.writableEnded)return;if(!t){e.statusCode=404,ir(e);return}if(n&&t.headers?.headersInit&&!Array.isArray(t.headers.headersInit)&&!t.headers.headersInit.get&&!t.headers._map&&!t.headers._setCookies?.length)e.writeHead(t.status,t.statusText,t.headers.headersInit);else {if(e.setHeaders&&!Fy)e.setHeaders(t.headers);else {let o=false;t.headers.forEach((a,l)=>{if(l==="set-cookie"){if(o)return;o=true;let c=t.headers.getSetCookie?.();if(c){e.setHeader("set-cookie",c);return}}e.setHeader(l,a);});}e.writeHead(t.status,t.statusText);}if(t.bodyType==="String"){let o=t.bodyInit;return A(()=>yn(o,e),()=>ir(e))}let s=t._buffer;if(s)return A(()=>yn(s,e),()=>ir(e));let i=t.body;if(i==null){ir(e);return}if(i[Symbol.toStringTag]==="Uint8Array")return A(()=>yn(i,e),()=>ir(e));if(Ly(r),hu(i)){e.once("close",()=>{i.destroy();}),i.pipe(e,{end:true});return}if(Ry(i))return Iy(r,e,i);if(fu(i))return Oy(e,i)}function Iy(t,e,r){let n=r.getReader();return t?.once?.("error",s=>{n.cancel(s);}),mu(()=>n.read(),e)}function yu(t){return t!=null&&typeof t=="object"&&("body"in t||"cache"in t||"credentials"in t||"headers"in t||"integrity"in t||"keepalive"in t||"method"in t||"mode"in t||"redirect"in t||"referrer"in t||"referrerPolicy"in t||"signal"in t||"window"in t)}function ut(...t){let[e,...r]=t.filter(n=>n!=null&&typeof n=="object");return r.forEach(n=>{let s=Object.getOwnPropertyNames(n).reduce((i,o)=>(Object.getOwnPropertyDescriptor(n,o)&&(i[o]=Object.getOwnPropertyDescriptor(n,o)),i),{});Object.getOwnPropertySymbols(n).forEach(i=>{let o=Object.getOwnPropertyDescriptor(n,i);o?.enumerable&&(s[i]=o);}),Object.defineProperties(e,s);}),e}function $i(t,e){return new e(t.stack||t.message||t.toString(),{status:t.status||500})}function Ni(t,e){return t==null?e==null?{}:{waitUntil:e}:ut(Object.create(t),{waitUntil:e},t)}function Gi(t,e){if(e?.aborted)throw e.reason;if(G(t)&&e){let s=function(){n.reject(e.reason);};let n=Bt();return e.addEventListener("abort",s,{once:true}),t.then(function(o){n.resolve(o);}).catch(function(o){n.reject(o);}).finally(()=>{e.removeEventListener("abort",s);}),n.promise}return t}var Dy=["SIGINT","exit","SIGTERM"],gn=new Set,uu=false;function jy(){if(!uu){uu=true;for(let t of Dy)globalThis.process.once(t,function(){return Promise.allSettled([...gn].map(r=>!r.disposed&&r.disposeAsync()))});}}function gu(t){globalThis.process&&(jy(),gn.has(t)||(gn.add(t),t.defer(()=>{gn.delete(t);})));}var Ui=class extends EventTarget{aborted=false;_onabort=null;_reason;constructor(){super();let e=globalThis.process?.getBuiltinModule?.("node:events");e?.kMaxEventTargetListeners&&(this[e.kMaxEventTargetListeners]=0);}throwIfAborted(){if(this._nativeCtrl?.signal?.throwIfAborted)return this._nativeCtrl.signal.throwIfAborted();if(this.aborted)throw this._reason}_nativeCtrl;ensureNativeCtrl(){if(!this._nativeCtrl){let e=this.aborted;this._nativeCtrl=new AbortController,e&&this._nativeCtrl.abort(this._reason);}return this._nativeCtrl}abort(e){if(this._nativeCtrl?.abort)return this._nativeCtrl?.abort(e);this._reason=e||new DOMException("This operation was aborted","AbortError"),this.aborted=true,this.dispatchEvent(new Event("abort"));}get signal(){return this._nativeCtrl?.signal?this._nativeCtrl.signal:this}get reason(){return this._nativeCtrl?.signal?this._nativeCtrl.signal.reason:this._reason}get onabort(){return this._onabort?this._onabort:this._onabort}set onabort(e){if(this._nativeCtrl?.signal){this._nativeCtrl.signal.onabort=e;return}this._onabort&&this.removeEventListener("abort",this._onabort),this._onabort=e,e&&this.addEventListener("abort",e);}};function zi(){return globalThis.Bun||globalThis.Deno?new AbortController:new Proxy(new Ui,{get(t,e,r){if(e.toString().includes("kDependantSignals")){let n=t.ensureNativeCtrl();return Reflect.get(n.signal,e,n.signal)}return Reflect.get(t,e,r)},set(t,e,r,n){if(e.toString().includes("kDependantSignals")){let s=t.ensureNativeCtrl();return Reflect.set(s.signal,e,r,s.signal)}return Reflect.set(t,e,r,n)},getPrototypeOf(){return AbortSignal.prototype}})}g();function xu(t){return !!t.onData}function _u({req:t,res:e,fetchAPI:r,controller:n}){let s=t.getMethod(),i,o=[],a=[S=>{o.push(S);}],l=S=>{for(let v of a)v(S);},c=false,u=[()=>{c=true;}],h=()=>{for(let S of u)S();};e.onData(function(S,v){l(Buffer.from(Buffer.from(S,0,S.byteLength))),v&&h();});let d;if(s!=="get"&&s!=="head"){i="half",n.signal.addEventListener("abort",()=>{h();},{once:true});let S;d=()=>(S||(S=new r.ReadableStream({start(v){for(let O of o)v.enqueue(O);if(c){v.close();return}a.push(O=>{v.enqueue(O);}),u.push(()=>{if(n.signal.reason){v.error(n.signal.reason);return}v.desiredSize&&v.close();});}})),S);}let p=new r.Headers;t.forEach((S,v)=>{p.append(S,v);});let _=`http://localhost${t.getUrl()}`,w=t.getQuery();w&&(_+=`?${w}`);let R;function C(){return d?c?P():d():null}let I=new r.Request(_,{method:s,headers:p,get body(){return C()},signal:n.signal,duplex:i});function P(){return R||(R=o.length===1?o[0]:Buffer.concat(o)),R}function T(){return c?N(P()):new Promise((S,v)=>{try{u.push(()=>{S(P());});}catch(O){v(O);}})}return Object.defineProperties(I,{body:{get(){return C()},configurable:true,enumerable:true},json:{value(){return T().then(S=>S.toString("utf8")).then(S=>JSON.parse(S))},configurable:true,enumerable:true},text:{value(){return T().then(S=>S.toString("utf8"))},configurable:true,enumerable:true},arrayBuffer:{value(){return T()},configurable:true,enumerable:true}}),I}function qy(t,e){return new e.WritableStream({write(r){t.cork(()=>{t.write(r);});},close(){t.cork(()=>{t.end();});}})}function wu(t,e,r,n){if(!e){t.writeStatus("404 Not Found"),t.end();return}let s=e._buffer,i=e.bodyType==="String"?e.bodyInit:void 0;if(!r.signal.aborted&&(t.cork(()=>{t.writeStatus(`${e.status} ${e.statusText}`);let o=false;for(let[a,l]of e.headers)if(a!=="content-length"&&a!=="transfer-encoding"){if(a==="set-cookie"){if(o)continue;o=true;let c=e.headers.getSetCookie?.();if(c){for(let u of c)t.writeHeader(a,u);continue}}t.writeHeader(a,l);}i?t.end(i):s?t.end(s):e.body||t.end();}),!(i||s||!e.body)))return r.signal.addEventListener("abort",()=>{e.body?.locked||e.body?.cancel(r.signal.reason);},{once:true}),e.body.pipeTo(qy(t,n),{signal:r.signal}).catch(o=>{if(!r.signal.aborted)throw o})}function By(t){try{return !!t?.request}catch{return false}}var My={};function Su(t,e){let r=e?.__useSingleWriteHead==null?true:e.__useSingleWriteHead,n={...Uy,...e?.fetchAPI},s=e?.__useCustomAbortCtrl==null?n.Request!==globalThis.Request:e.__useCustomAbortCtrl,i=typeof t=="function"?t:t.handle,o=[],a=[],l,c=new Set,u;function h(){return u||(u=new pa,e?.disposeOnProcessTerminate&&gu(u),u.defer(()=>{if(c.size>0)return Promise.allSettled(c).then(()=>{c.clear();},()=>{c.clear();})})),u}function d(g){G(g)&&(h(),c.add(g),g.then(()=>{c.delete(g);},x=>{console.error(`Unexpected error while waiting: ${x.message||x}`),c.delete(g);}));}if(e?.plugins!=null)for(let g of e.plugins){g.instrumentation&&(l=l?gt(l,g.instrumentation):g.instrumentation),g.onRequest&&o.push(g.onRequest),g.onResponse&&a.push(g.onResponse);let x=g[H.dispose];x&&h().defer(x);let E=g[H.asyncDispose];E&&h().defer(E),g.onDispose&&h().defer(g.onDispose);}let p=o.length>0||a.length>0?function(x,E){let k=i,L;if(o.length===0)return W();let j=x.parsedUrl||new Proxy(My,{get($,J,ie){return j=new n.URL(x.url,"http://localhost"),Reflect.get(j,J,j)}});function M($){return a.length===0?$:A(()=>Q(a,J=>J({request:x,response:$,serverContext:E,setResponse(ie){$=ie;},fetchAPI:n})),()=>$)}function W(){return L?M(L):A(()=>k(x,E),M)}return A(()=>Q(o,($,J)=>$({request:x,setRequest(ie){x=ie;},serverContext:E,fetchAPI:n,url:j,requestHandler:k,setRequestHandler(ie){k=ie;},endResponse(ie){L=ie,ie&&J();}})),W)}:i;if(l?.request){let g=p;p=(x,E)=>tt({request:x}).asyncFn(l.request,g)(x,E);}function _(g,...x){let E=x.length>1?ut(...x):x[0]||{};E.waitUntil||(E.waitUntil=d);let k=Bi(g,n,void 0,s);return p(k,E)}function w(g,x,...E){let k=x.raw||x,L=E.length>1?ut(...E):E[0]||{};L.waitUntil||(L.waitUntil=d);let j=Bi(g,n,k,s);return p(j,L)}function R(g,x,...E){let k={req:g,res:x,waitUntil:d};return Mt(N().then(()=>w(g,x,k,...E)).catch(L=>$i(L,n.Response)).then(L=>bu(L,x,g,r)).catch(L=>console.error(`Unexpected error while handling request: ${L.message||L}`)))}function C(g,x,...E){let k={res:g,req:x,waitUntil:d},j=E.filter(ne=>ne!=null).length>0?ut(k,...E):k,M=s?zi():new AbortController,W=g.end.bind(g),$=false;g.end=function(ne){return $=true,W(ne)},g.onAborted.bind(g)(function(){M.abort();}),g.onAborted=function(ne){M.signal.addEventListener("abort",ne,{once:true});};let ie=_u({req:x,res:g,fetchAPI:n,controller:M});return A(()=>A(()=>p(ie,j),ne=>ne,ne=>$i(ne,n.Response)),ne=>{if(!M.signal.aborted&&!$)return A(()=>wu(g,ne,M,n),Ee=>Ee,Ee=>{console.error(`Unexpected error while handling request: ${Ee.message||Ee}`);})})}function I(g,...x){if(!g.respondWith||!g.request)throw new TypeError(`Expected FetchEvent, got ${g}`);let E=x.filter(j=>j!=null),k=E.length>0?ut({},g,...E):Ni(g),L=p(g.request,k);g.respondWith(L);}function P(g,...x){let E=x.filter(L=>L!=null),k=E.length>1?ut({},...E):Ni(E[0],E[0]==null||E[0].waitUntil==null?d:void 0);return p(g,k)}let T=(g,...x)=>{if(typeof g=="string"||"href"in g){let[k,...L]=x;if(yu(k)){let M=new n.Request(g,k),W=P(M,...L),$=k.signal;return $?Gi(W,$):W}let j=new n.Request(g);return P(j,...x)}let E=P(g,...x);return Gi(E,g.signal)},S=(g,...x)=>{let[E,...k]=x;if(du(g)){if(!Mi(E))throw new TypeError(`Expected ServerResponse, got ${E}`);return R(g,E,...k)}if(xu(g))return C(g,E,...k);if(Mi(E))throw new TypeError("Got Node response without Node request");return By(g)?pu(g)?I(g,...x):P(g.request,g,...x):T(g,...x)},v={handleRequest:P,fetch:T,handleNodeRequest:_,handleNodeRequestAndResponse:w,requestListener:R,handleEvent:I,handleUWS:C,handle:S,get disposableStack(){return h()},[H.asyncDispose](){return u&&!u.disposed?u.disposeAsync():N()},dispose(){return u&&!u.disposed?u.disposeAsync():N()},waitUntil:d},O=new Proxy(S,{has:(g,x)=>x in v||x in S||t&&x in t,get:(g,x)=>{if(globalThis.Deno||x===Symbol.asyncDispose||x===Symbol.dispose){let L=Reflect.get(v,x,v);if(L)return L}let E=v[x];if(E)return E.bind?E.bind(v):E;let k=S[x];if(k)return k.bind?k.bind(S):k;if(t){let L=t[x];if(L)return L.bind?function(...j){let M=t[x](...j);return M===t?O:M}:L}},apply(g,x,E){return S(...E)}});return O}g();function $y(t,e){let r=t.headers.get("origin");if(e===false||r==null)return null;let n={};if(e.origin==null||e.origin.length===0||e.origin.includes("*")?(n["Access-Control-Allow-Origin"]=r,n.Vary="Origin"):typeof e.origin=="string"?n["Access-Control-Allow-Origin"]=e.origin:Array.isArray(e.origin)&&(e.origin.length===1?n["Access-Control-Allow-Origin"]=e.origin[0]:e.origin.includes(r)?(n["Access-Control-Allow-Origin"]=r,n.Vary="Origin"):n["Access-Control-Allow-Origin"]="null"),e.methods?.length)n["Access-Control-Allow-Methods"]=e.methods.join(", ");else {let s=t.headers.get("access-control-request-method");s&&(n["Access-Control-Allow-Methods"]=s);}if(e.allowedHeaders?.length)n["Access-Control-Allow-Headers"]=e.allowedHeaders.join(", ");else {let s=t.headers.get("access-control-request-headers");s&&(n["Access-Control-Allow-Headers"]=s,n.Vary?n.Vary+=", Access-Control-Request-Headers":n.Vary="Access-Control-Request-Headers");}return e.credentials!=null?e.credentials===true&&(n["Access-Control-Allow-Credentials"]="true"):n["Access-Control-Allow-Origin"]!=="*"&&(n["Access-Control-Allow-Credentials"]="true"),e.exposedHeaders&&(n["Access-Control-Expose-Headers"]=e.exposedHeaders.join(", ")),e.maxAge&&(n["Access-Control-Max-Age"]=e.maxAge.toString()),n}function Ny(t,e,r){return A(()=>e(t,r),n=>$y(t,n))}function Eu(t){let e=()=>({});if(t!=null)if(typeof t=="function")e=t;else if(typeof t=="object"){let r={...t};e=()=>r;}else t===false&&(e=()=>false);return {onRequest({request:r,fetchAPI:n,endResponse:s}){if(r.method.toUpperCase()==="OPTIONS"){let i=new n.Response(null,{status:204,headers:{"Content-Length":"0"}});s(i);}},onResponse({request:r,serverContext:n,response:s}){return A(()=>Ny(r,e,n),i=>{if(i!=null)for(let o in i)s.headers.set(o,i[o]);})}}}g();g();var Gy=["message","locations","path","nodes","source","positions","originalError","name","stack","extensions","coordinate"];function zy(t){return t!=null&&typeof t=="object"&&Object.keys(t).every(e=>Gy.includes(e))}function B(t,e){e?.originalError&&!(e.originalError instanceof Error)&&zy(e.originalError)&&(e.originalError=B(e.originalError.message,e.originalError));let r=b$4,n=a$6.major>=16?new r(t,e):new r(t,e?.nodes,e?.source,e?.positions,e?.path,e?.originalError,e?.extensions);return e?.coordinate&&n.coordinate==null&&Object.defineProperties(n,{coordinate:{value:e.coordinate,enumerable:true,configurable:true}}),n}function xn(t){return t.coordinate}g();g();function Pu(t){return t?.[Symbol.asyncIterator]!=null}function Hy(t){return t!=null&&typeof t=="object"&&"errors"in t}function Vy(t){return t!=null&&typeof t.toString=="function"}function Le(t){return t instanceof b$4}function _n(t){return t instanceof b$4?t.originalError!=null?_n(t.originalError):true:false}function Hi(t){return typeof t=="object"&&t?.constructor?.name==="DOMException"&&(t.name==="AbortError"||t.name==="TimeoutError")}function Lt(t,e,r){let n=new Set;if(Hy(t))for(let s of t.errors){let i=Lt(s,e,r);for(let o of i)n.add(o);}else if(Hi(t))r.debug("Request aborted");else if(e){let s=e.maskError(t,e.errorMessage,e.isDev);s!==t&&r.error(t),n.add(Le(s)?s:B(s.message,{originalError:s}));}else Le(t)?n.add(t):t instanceof Error?n.add(B(t.message,{originalError:t})):typeof t=="string"?n.add(B(t,{extensions:{code:"INTERNAL_SERVER_ERROR",unexpected:true}})):Vy(t)?n.add(B(t.toString(),{extensions:{code:"INTERNAL_SERVER_ERROR",unexpected:true}})):(r.error(t),n.add(B("Unexpected error.",{extensions:{unexpected:true}})));return Array.from(n)}function Ot(t,e={},r=false){let n,s=false;if("extensions"in t&&t.extensions?.http&&(t.extensions.http.headers&&Object.assign(e,t.extensions.http.headers),t.extensions.http.status&&(n=t.extensions.http.status)),"errors"in t&&t.errors?.length)for(let i of t.errors)if(i.extensions?.http){if(i.extensions.http.headers&&Object.assign(e,i.extensions.http.headers),r&&i.extensions.http.spec)continue;i.extensions.http.status&&(!n||i.extensions.http.status>n)&&(n=i.extensions.http.status);}else (!_n(i)||i.extensions?.unexpected)&&(s=true);else n||=200;return n||(s&&!("data"in t)?n=500:n=200),{status:n,headers:e}}function vu(t){return Array.isArray(t)&&t.length>0&&t.some(Le)}g();function ku(t){return {onResponse({response:e}){Cu(e.headers,t);}}}function Tu(t){return {onRequest({request:e}){Cu(e.headers,t);}}}function Cu(t,e){for(let r of t.keys())e.includes(r)||t.delete(r);}g();var Lu=e$1(sr(),1);g();var Au=e$1(sr(),1);function Vi(t){let e=t.get("operationName")||void 0,r=t.get("query")||void 0,n=t.get("variables")||void 0,s=t.get("extensions")||void 0;return {operationName:e,query:r,variables:n?JSON.parse(n):void 0,extensions:s?JSON.parse(s):void 0}}function Ru(t){let e=new Au.URLSearchParams(t);return Vi(e)}function Be(t,e){let r=t.headers.get("content-type");return r=r?.split(",")[0]||null,r===e||!!r?.startsWith(`${e};`)}function Ou(t){return t.method==="GET"}function Fu(t){let e=t.url.substring(t.url.indexOf("?")+1),r=new Lu.URLSearchParams(e);return Vi(r)}g();function Iu(t){return t.method==="POST"&&Be(t,"application/x-www-form-urlencoded")}function Du(t){return t.text().then(Ru)}g();function ju(t){return t.method==="POST"&&Be(t,"application/graphql")}function qu(t){return t.text().then(e=>({query:e}))}g();function Uu(t){return t.method==="POST"&&(Be(t,"application/json")||Be(t,"application/graphql+json"))}function Bu(t){return A(()=>t.json(),e=>{if(e==null)throw B(`POST body is expected to be object but received ${e}`,{extensions:{http:{status:400},code:"BAD_REQUEST"}});let r=typeof e;if(r!=="object")throw B(`POST body is expected to be object but received ${r}`,{extensions:{http:{status:400},code:"BAD_REQUEST"}});return e},e=>{if(e instanceof b$4)throw e;let r={http:{spec:true,status:400},code:"BAD_REQUEST"};throw e instanceof Error&&(r.originalError={name:e.name,message:e.message}),B("POST body sent invalid JSON.",{extensions:r})})}g();function Mu(t){return t.method==="POST"&&Be(t,"multipart/form-data")}function $u(t){return A(()=>t.formData(),e=>{let r=e.get("operations");if(!r)throw B('Missing multipart form field "operations"');if(typeof r!="string")throw B('Multipart form field "operations" must be a string');let n;try{n=JSON.parse(r);}catch{throw B('Multipart form field "operations" must be a valid JSON string')}let s=e.get("map");if(s!=null){if(typeof s!="string")throw B('Multipart form field "map" must be a string');let i;try{i=JSON.parse(s);}catch{throw B('Multipart form field "map" must be a valid JSON string')}for(let o in i){let a=e.get(o),l=i[o];for(let c of l)Wy(n,c,a);}}return n},e=>{throw e instanceof Error&&e.message.startsWith("File size limit exceeded: ")?B(e.message,{extensions:{http:{status:413}}}):e})}function Wy(t,e,r){let n=e.split("."),s=t;for(let i=0;i<n.length;i++){let o=n[i];if(o==="__proto__"||o==="constructor"||o==="prototype")return;i===n.length-1?s[o]=r:(o in s||(s[o]={}),s=s[o]);}}g();var Ky=new Set(["query","variables","operationName","extensions"]);function Qy(t,e){if(t==null||typeof t!="object")throw B('Invalid "params" in the request body',{extensions:{http:{spec:true,status:400},code:"BAD_REQUEST"}});for(let r in t)if(t[r]!=null&&!Ky.has(r)){if(e?.includes(r))continue;throw B(`Unexpected parameter "${r}" in the request body.`,{extensions:{http:{status:400},code:"BAD_REQUEST"}})}}function Zy(t,e){if(!Jy(t))throw B(`Expected params to be an object but given ${or(t)}.`,{extensions:{http:{status:400,headers:{Allow:"GET, POST"}},code:"BAD_REQUEST"}});if(Qy(t,e),t.query==null)throw B("Must provide query string.",{extensions:{http:{spec:true,status:400,headers:{Allow:"GET, POST"}},code:"BAD_REQUEST"}});let r=or(t.query);if(r!=="string")throw B(`Expected "query" param to be a string, but given ${r}.`,{extensions:{http:{status:400,headers:{Allow:"GET, POST"}},code:"BAD_REQUEST"}});let n=or(t.variables);if(!["object","null","undefined"].includes(n))throw B(`Expected "variables" param to be empty or an object, but given ${n}.`,{extensions:{http:{status:400,headers:{Allow:"GET, POST"}},code:"BAD_REQUEST"}});let s=or(t.extensions);if(!["object","null","undefined"].includes(s))throw B(`Expected "extensions" param to be empty or an object, but given ${s}.`,{extensions:{http:{status:400,headers:{Allow:"GET, POST"}},code:"BAD_REQUEST"}});return t}function Nu(t){return {onParams({params:e}){Zy(e,t);}}}function or(t){return t===null?"null":Array.isArray(t)?"array":typeof t}function Jy(t){return or(t)==="object"}g();function Yy(t){return t==="GET"||t==="POST"}function Gu(){return {onRequestParse({request:t}){if(!Yy(t.method))throw B("GraphQL only supports GET and POST requests.",{extensions:{http:{status:405,headers:{Allow:"GET, POST"}},code:"BAD_REQUEST"}})}}}g();function zu(){return {onValidate(){return ({valid:t,result:e})=>{if(!t)for(let r of e)r.extensions||={},r.extensions.code||="GRAPHQL_VALIDATION_FAILED",r.extensions.http||={},r.extensions.http.spec=r.extensions.http.spec==null?true:r.extensions.http.spec,r.extensions.http.status||=400;}}}}g();function Hu(t){return {onRequestParse(){return {onRequestParseDone({requestParserResult:e}){if(Array.isArray(e)){if(!t)throw B("Batching is not supported.",{extensions:{http:{status:400},code:"BAD_REQUEST"}});if(e.length>t)throw B(`Batching is limited to ${t} operations per request.`,{extensions:{http:{status:413},code:"BAD_REQUEST"}})}}}}}}g();function Xy(t,e,r){let n=e?F$2(e,r)??void 0:void 0;if(!n)throw B("Could not determine what operation to execute.",{extensions:{code:"OPERATION_RESOLUTION_FAILURE",http:{status:400}}});if(n.operation==="mutation"&&t==="GET")throw B("Can only perform a mutation operation from a POST request.",{extensions:{http:{status:405,headers:{Allow:"POST"}},code:"BAD_REQUEST"}})}function Vu(){return {onParse(){return ({result:t,context:{request:e,params:{operationName:r}={}}})=>{if(e)if(t instanceof Error){if(t instanceof b$4){let n=t.extensions||={};n.code||="GRAPHQL_PARSE_FAILED";let s=n.http||={};s.spec||=true,s.status||=400;}}else Xy(e.method,t,r);}}}}g();function Wu({id:t=Date.now().toString(),logger:e=console,endpoint:r="/health"}={}){return {onRequest({endResponse:n,fetchAPI:s,request:i}){if(i.url.endsWith(r)){e.debug("Responding Health Check");let o=new s.Response(null,{status:200,headers:{"x-yoga-id":t}});n(o);}}}}g();g();g();var Ft=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Qu=new Set,Wi=typeof process=="object"&&process?process:{},Zu=(t,e,r,n)=>{typeof Wi.emitWarning=="function"?Wi.emitWarning(t,e,r,n):console.error(`[${r}] ${e}: ${t}`);},wn=globalThis.AbortController,Ku=globalThis.AbortSignal;if(typeof wn>"u"){Ku=class{onabort;_onabort=[];reason;aborted=false;addEventListener(n,s){this._onabort.push(s);}},wn=class{constructor(){e();}signal=new Ku;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=true;for(let s of this.signal._onabort)s(n);this.signal.onabort?.(n);}}};let t=Wi.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=false,Zu("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e));};}var eg=t=>!Qu.has(t);var Ze=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),Ju=t=>Ze(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?It:null:null,It=class extends Array{constructor(e){super(e),this.fill(0);}},Ki=class t{heap;length;static#o=false;static create(e){let r=Ju(e);if(!r)return [];t.#o=true;let n=new t(e,r);return t.#o=false,n}constructor(e,r){if(!t.#o)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},Sn=class t{#o;#r;#n;#t;#p;#w;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#s;#y;#l;#i;#e;#m;#b;#f;#u;#c;#h;#E;#g;#x;#P;#v;#d;static unsafeExposeInternals(e){return {starts:e.#g,ttls:e.#x,sizes:e.#E,keyMap:e.#l,keyList:e.#i,valList:e.#e,next:e.#m,prev:e.#b,get head(){return e.#f},get tail(){return e.#u},free:e.#c,isBackgroundFetch:r=>e.#a(r),backgroundFetch:(r,n,s,i)=>e.#q(r,n,s,i),moveToTail:r=>e.#I(r),indexes:r=>e.#C(r),rindexes:r=>e.#A(r),isStale:r=>e.#_(r)}}get max(){return this.#o}get maxSize(){return this.#r}get calculatedSize(){return this.#y}get size(){return this.#s}get fetchMethod(){return this.#p}get memoMethod(){return this.#w}get dispose(){return this.#n}get disposeAfter(){return this.#t}constructor(e){let{max:r=0,ttl:n,ttlResolution:s=1,ttlAutopurge:i,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:l,dispose:c,disposeAfter:u,noDisposeOnSet:h,noUpdateTTL:d,maxSize:p=0,maxEntrySize:_=0,sizeCalculation:w,fetchMethod:R,memoMethod:C,noDeleteOnFetchRejection:I,noDeleteOnStaleGet:P,allowStaleOnFetchRejection:T,allowStaleOnFetchAbort:S,ignoreFetchAbort:v}=e;if(r!==0&&!Ze(r))throw new TypeError("max option must be a nonnegative integer");let O=r?Ju(r):Array;if(!O)throw new Error("invalid max value: "+r);if(this.#o=r,this.#r=p,this.maxEntrySize=_||this.#r,this.sizeCalculation=w,this.sizeCalculation){if(!this.#r&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(C!==void 0&&typeof C!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#w=C,R!==void 0&&typeof R!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#p=R,this.#v=!!R,this.#l=new Map,this.#i=new Array(r).fill(void 0),this.#e=new Array(r).fill(void 0),this.#m=new O(r),this.#b=new O(r),this.#f=0,this.#u=0,this.#c=Ki.create(r),this.#s=0,this.#y=0,typeof c=="function"&&(this.#n=c),typeof u=="function"?(this.#t=u,this.#h=[]):(this.#t=void 0,this.#h=void 0),this.#P=!!this.#n,this.#d=!!this.#t,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!I,this.allowStaleOnFetchRejection=!!T,this.allowStaleOnFetchAbort=!!S,this.ignoreFetchAbort=!!v,this.maxEntrySize!==0){if(this.#r!==0&&!Ze(this.#r))throw new TypeError("maxSize must be a positive integer if specified");if(!Ze(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#S();}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!P,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=Ze(s)||s===0?s:1,this.ttlAutopurge=!!i,this.ttl=n||0,this.ttl){if(!Ze(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#k();}if(this.#o===0&&this.ttl===0&&this.#r===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#o&&!this.#r){let g="LRU_CACHE_UNBOUNDED";eg(g)&&(Qu.add(g),Zu("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",g,t));}}getRemainingTTL(e){return this.#l.has(e)?1/0:0}#k(){let e=new It(this.#o),r=new It(this.#o);this.#x=e,this.#g=r,this.#F=(i,o,a=Ft.now())=>{if(r[i]=o!==0?a:0,e[i]=o,o!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#_(i)&&this.#R(this.#i[i],"expire");},o+1);l.unref&&l.unref();}},this.#L=i=>{r[i]=e[i]!==0?Ft.now():0;},this.#T=(i,o)=>{if(e[o]){let a=e[o],l=r[o];if(!a||!l)return;i.ttl=a,i.start=l,i.now=n||s();let c=i.now-l;i.remainingTTL=a-c;}};let n=0,s=()=>{let i=Ft.now();if(this.ttlResolution>0){n=i;let o=setTimeout(()=>n=0,this.ttlResolution);o.unref&&o.unref();}return i};this.getRemainingTTL=i=>{let o=this.#l.get(i);if(o===void 0)return 0;let a=e[o],l=r[o];if(!a||!l)return 1/0;let c=(n||s())-l;return a-c},this.#_=i=>{let o=r[i],a=e[i];return !!a&&!!o&&(n||s())-o>a};}#L=()=>{};#T=()=>{};#F=()=>{};#_=()=>false;#S(){let e=new It(this.#o);this.#y=0,this.#E=e,this.#O=r=>{this.#y-=e[r],e[r]=0;},this.#U=(r,n,s,i)=>{if(this.#a(n))return 0;if(!Ze(s))if(i){if(typeof i!="function")throw new TypeError("sizeCalculation must be a function");if(s=i(n,r),!Ze(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s},this.#D=(r,n,s)=>{if(e[r]=n,this.#r){let i=this.#r-e[r];for(;this.#y>i;)this.#j(true);}this.#y+=e[r],s&&(s.entrySize=n,s.totalCalculatedSize=this.#y);};}#O=e=>{};#D=(e,r,n)=>{};#U=(e,r,n,s)=>{if(n||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#C({allowStale:e=this.allowStale}={}){if(this.#s)for(let r=this.#u;!(!this.#B(r)||((e||!this.#_(r))&&(yield r),r===this.#f));)r=this.#b[r];}*#A({allowStale:e=this.allowStale}={}){if(this.#s)for(let r=this.#f;!(!this.#B(r)||((e||!this.#_(r))&&(yield r),r===this.#u));)r=this.#m[r];}#B(e){return e!==void 0&&this.#l.get(this.#i[e])===e}*entries(){for(let e of this.#C())this.#e[e]!==void 0&&this.#i[e]!==void 0&&!this.#a(this.#e[e])&&(yield [this.#i[e],this.#e[e]]);}*rentries(){for(let e of this.#A())this.#e[e]!==void 0&&this.#i[e]!==void 0&&!this.#a(this.#e[e])&&(yield [this.#i[e],this.#e[e]]);}*keys(){for(let e of this.#C()){let r=this.#i[e];r!==void 0&&!this.#a(this.#e[e])&&(yield r);}}*rkeys(){for(let e of this.#A()){let r=this.#i[e];r!==void 0&&!this.#a(this.#e[e])&&(yield r);}}*values(){for(let e of this.#C())this.#e[e]!==void 0&&!this.#a(this.#e[e])&&(yield this.#e[e]);}*rvalues(){for(let e of this.#A())this.#e[e]!==void 0&&!this.#a(this.#e[e])&&(yield this.#e[e]);}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,r={}){for(let n of this.#C()){let s=this.#e[n],i=this.#a(s)?s.__staleWhileFetching:s;if(i!==void 0&&e(i,this.#i[n],this))return this.get(this.#i[n],r)}}forEach(e,r=this){for(let n of this.#C()){let s=this.#e[n],i=this.#a(s)?s.__staleWhileFetching:s;i!==void 0&&e.call(r,i,this.#i[n],this);}}rforEach(e,r=this){for(let n of this.#A()){let s=this.#e[n],i=this.#a(s)?s.__staleWhileFetching:s;i!==void 0&&e.call(r,i,this.#i[n],this);}}purgeStale(){let e=false;for(let r of this.#A({allowStale:true}))this.#_(r)&&(this.#R(this.#i[r],"expire"),e=true);return e}info(e){let r=this.#l.get(e);if(r===void 0)return;let n=this.#e[r],s=this.#a(n)?n.__staleWhileFetching:n;if(s===void 0)return;let i={value:s};if(this.#x&&this.#g){let o=this.#x[r],a=this.#g[r];if(o&&a){let l=o-(Ft.now()-a);i.ttl=l,i.start=Date.now();}}return this.#E&&(i.size=this.#E[r]),i}dump(){let e=[];for(let r of this.#C({allowStale:true})){let n=this.#i[r],s=this.#e[r],i=this.#a(s)?s.__staleWhileFetching:s;if(i===void 0||n===void 0)continue;let o={value:i};if(this.#x&&this.#g){o.ttl=this.#x[r];let a=Ft.now()-this.#g[r];o.start=Math.floor(Date.now()-a);}this.#E&&(o.size=this.#E[r]),e.unshift([n,o]);}return e}load(e){this.clear();for(let[r,n]of e){if(n.start){let s=Date.now()-n.start;n.start=Ft.now()-s;}this.set(r,n.value,n);}}set(e,r,n={}){if(r===void 0)return this.delete(e),this;let{ttl:s=this.ttl,start:i,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:l}=n,{noUpdateTTL:c=this.noUpdateTTL}=n,u=this.#U(e,r,n.size||0,a);if(this.maxEntrySize&&u>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=true),this.#R(e,"set"),this;let h=this.#s===0?void 0:this.#l.get(e);if(h===void 0)h=this.#s===0?this.#u:this.#c.length!==0?this.#c.pop():this.#s===this.#o?this.#j(false):this.#s,this.#i[h]=e,this.#e[h]=r,this.#l.set(e,h),this.#m[this.#u]=h,this.#b[h]=this.#u,this.#u=h,this.#s++,this.#D(h,u,l),l&&(l.set="add"),c=false;else {this.#I(h);let d=this.#e[h];if(r!==d){if(this.#v&&this.#a(d)){d.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=d;p!==void 0&&!o&&(this.#P&&this.#n?.(p,e,"set"),this.#d&&this.#h?.push([p,e,"set"]));}else o||(this.#P&&this.#n?.(d,e,"set"),this.#d&&this.#h?.push([d,e,"set"]));if(this.#O(h),this.#D(h,u,l),this.#e[h]=r,l){l.set="replace";let p=d&&this.#a(d)?d.__staleWhileFetching:d;p!==void 0&&(l.oldValue=p);}}else l&&(l.set="update");}if(s!==0&&!this.#x&&this.#k(),this.#x&&(c||this.#F(h,s,i),l&&this.#T(l,h)),!o&&this.#d&&this.#h){let d=this.#h,p;for(;p=d?.shift();)this.#t?.(...p);}return this}pop(){try{for(;this.#s;){let e=this.#e[this.#f];if(this.#j(!0),this.#a(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#d&&this.#h){let e=this.#h,r;for(;r=e?.shift();)this.#t?.(...r);}}}#j(e){let r=this.#f,n=this.#i[r],s=this.#e[r];return this.#v&&this.#a(s)?s.__abortController.abort(new Error("evicted")):(this.#P||this.#d)&&(this.#P&&this.#n?.(s,n,"evict"),this.#d&&this.#h?.push([s,n,"evict"])),this.#O(r),e&&(this.#i[r]=void 0,this.#e[r]=void 0,this.#c.push(r)),this.#s===1?(this.#f=this.#u=0,this.#c.length=0):this.#f=this.#m[r],this.#l.delete(n),this.#s--,r}has(e,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:s}=r,i=this.#l.get(e);if(i!==void 0){let o=this.#e[i];if(this.#a(o)&&o.__staleWhileFetching===void 0)return false;if(this.#_(i))s&&(s.has="stale",this.#T(s,i));else return n&&this.#L(i),s&&(s.has="hit",this.#T(s,i)),true}else s&&(s.has="miss");return false}peek(e,r={}){let{allowStale:n=this.allowStale}=r,s=this.#l.get(e);if(s===void 0||!n&&this.#_(s))return;let i=this.#e[s];return this.#a(i)?i.__staleWhileFetching:i}#q(e,r,n,s){let i=r===void 0?void 0:this.#e[r];if(this.#a(i))return i;let o=new wn,{signal:a}=n;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let l={signal:o.signal,options:n,context:s},c=(w,R=false)=>{let{aborted:C}=o.signal,I=n.ignoreFetchAbort&&w!==void 0;if(n.status&&(C&&!R?(n.status.fetchAborted=true,n.status.fetchError=o.signal.reason,I&&(n.status.fetchAbortIgnored=true)):n.status.fetchResolved=true),C&&!I&&!R)return h(o.signal.reason);let P=p;return this.#e[r]===p&&(w===void 0?P.__staleWhileFetching?this.#e[r]=P.__staleWhileFetching:this.#R(e,"fetch"):(n.status&&(n.status.fetchUpdated=true),this.set(e,w,l.options))),w},u=w=>(n.status&&(n.status.fetchRejected=true,n.status.fetchError=w),h(w)),h=w=>{let{aborted:R}=o.signal,C=R&&n.allowStaleOnFetchAbort,I=C||n.allowStaleOnFetchRejection,P=I||n.noDeleteOnFetchRejection,T=p;if(this.#e[r]===p&&(!P||T.__staleWhileFetching===void 0?this.#R(e,"fetch"):C||(this.#e[r]=T.__staleWhileFetching)),I)return n.status&&T.__staleWhileFetching!==void 0&&(n.status.returnedStale=true),T.__staleWhileFetching;if(T.__returned===T)throw w},d=(w,R)=>{let C=this.#p?.(e,i,l);C&&C instanceof Promise&&C.then(I=>w(I===void 0?void 0:I),R),o.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(w(void 0),n.allowStaleOnFetchAbort&&(w=I=>c(I,true)));});};n.status&&(n.status.fetchDispatched=true);let p=new Promise(d).then(c,u),_=Object.assign(p,{__abortController:o,__staleWhileFetching:i,__returned:void 0});return r===void 0?(this.set(e,_,{...l.options,status:void 0}),r=this.#l.get(e)):this.#e[r]=_,_}#a(e){if(!this.#v)return false;let r=e;return !!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof wn}async fetch(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:l=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:h=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:_=this.allowStaleOnFetchAbort,context:w,forceRefresh:R=false,status:C,signal:I}=r;if(!this.#v)return C&&(C.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:i,status:C});let P={allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:i,ttl:o,noDisposeOnSet:a,size:l,sizeCalculation:c,noUpdateTTL:u,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:_,ignoreFetchAbort:p,status:C,signal:I},T=this.#l.get(e);if(T===void 0){C&&(C.fetch="miss");let S=this.#q(e,T,P,w);return S.__returned=S}else {let S=this.#e[T];if(this.#a(S)){let E=n&&S.__staleWhileFetching!==void 0;return C&&(C.fetch="inflight",E&&(C.returnedStale=true)),E?S.__staleWhileFetching:S.__returned=S}let v=this.#_(T);if(!R&&!v)return C&&(C.fetch="hit"),this.#I(T),s&&this.#L(T),C&&this.#T(C,T),S;let O=this.#q(e,T,P,w),x=O.__staleWhileFetching!==void 0&&n;return C&&(C.fetch=v?"stale":"refresh",x&&v&&(C.returnedStale=true)),x?O.__staleWhileFetching:O.__returned=O}}async forceFetch(e,r={}){let n=await this.fetch(e,r);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(e,r={}){let n=this.#w;if(!n)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:i,...o}=r,a=this.get(e,o);if(!i&&a!==void 0)return a;let l=n(e,a,{options:o,context:s});return this.set(e,l,o),l}get(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:o}=r,a=this.#l.get(e);if(a!==void 0){let l=this.#e[a],c=this.#a(l);return o&&this.#T(o,a),this.#_(a)?(o&&(o.get="stale"),c?(o&&n&&l.__staleWhileFetching!==void 0&&(o.returnedStale=true),n?l.__staleWhileFetching:void 0):(i||this.#R(e,"expire"),o&&n&&(o.returnedStale=true),n?l:void 0)):(o&&(o.get="hit"),c?l.__staleWhileFetching:(this.#I(a),s&&this.#L(a),l))}else o&&(o.get="miss");}#M(e,r){this.#b[r]=e,this.#m[e]=r;}#I(e){e!==this.#u&&(e===this.#f?this.#f=this.#m[e]:this.#M(this.#b[e],this.#m[e]),this.#M(this.#u,e),this.#u=e);}delete(e){return this.#R(e,"delete")}#R(e,r){let n=false;if(this.#s!==0){let s=this.#l.get(e);if(s!==void 0)if(n=true,this.#s===1)this.#$(r);else {this.#O(s);let i=this.#e[s];if(this.#a(i)?i.__abortController.abort(new Error("deleted")):(this.#P||this.#d)&&(this.#P&&this.#n?.(i,e,r),this.#d&&this.#h?.push([i,e,r])),this.#l.delete(e),this.#i[s]=void 0,this.#e[s]=void 0,s===this.#u)this.#u=this.#b[s];else if(s===this.#f)this.#f=this.#m[s];else {let o=this.#b[s];this.#m[o]=this.#m[s];let a=this.#m[s];this.#b[a]=this.#b[s];}this.#s--,this.#c.push(s);}}if(this.#d&&this.#h?.length){let s=this.#h,i;for(;i=s?.shift();)this.#t?.(...i);}return n}clear(){return this.#$("delete")}#$(e){for(let r of this.#A({allowStale:true})){let n=this.#e[r];if(this.#a(n))n.__abortController.abort(new Error("deleted"));else {let s=this.#i[r];this.#P&&this.#n?.(n,s,e),this.#d&&this.#h?.push([n,s,e]);}}if(this.#l.clear(),this.#e.fill(void 0),this.#i.fill(void 0),this.#x&&this.#g&&(this.#x.fill(0),this.#g.fill(0)),this.#E&&this.#E.fill(0),this.#f=0,this.#u=0,this.#c.length=0,this.#y=0,this.#s=0,this.#d&&this.#h){let r=this.#h,n;for(;n=r?.shift();)this.#t?.(...n);}}};var tg=1024,rg=36e5;function En({max:t=tg,ttl:e=rg}={}){return new Sn({max:t,ttl:e})}function Yu({documentCache:t=En(),errorCache:e=En(),validationCache:r=true}){let n=En();return {onParse({params:s,setParsedDocument:i}){let o=s.source.toString(),a=t.get(o);if(a){i(a);return}let l=e.get(o);if(l)throw l;return ({result:c})=>{c!=null&&(c instanceof Error?e.set(o,c):t.set(o,c));}},onValidate({params:{schema:s,documentAST:i,rules:o},setResult:a}){if(s!=null&&r!==false){let l=o?.map(d=>d.name).join(",")||"",c=n.get(l);c||(c=new WeakMap,n.set(l,c));let u=c.get(s);u||(u=new WeakMap,c.set(s,u));let h=u.get(i);if(h){a(h);return}return ({result:d})=>{d!=null&&u?.set(i,d);}}}}}g();var ng=()=>true;function Dt(t){let e=t.match||ng;return {onRequestParse({request:r,setRequestParser:n}){e(r)&&n(t.parse);}}}g();g();function Xu(t){let e=(t.headers.get("accept")||"*/*").replace(/\s/g,"").toLowerCase().split(","),r=[];for(let n of e){let[s,...i]=n.split(";");s===void 0||(i?.find(a=>a.includes("charset="))||"charset=utf-8")!=="charset=utf-8"||r.push(s);}return r.reverse()}function ef(t,e){let[r,n]=t.split("/"),[s,i]=e.split("/");return (s==="*"||s===r)&&(i==="*"||i===n)}g();g();function jt(t){if(Array.isArray(t))return `[${t.map(n=>{let s=tf(n);return (n.stringify||JSON.stringify)(s)}).join(",")}]`;let e=tf(t);return (t.stringify||JSON.stringify)(e)}function tf(t){if(t.errors?.length||t.extensions?.http){let e={...t};if(e.errors&&=e.errors.map(rf),e.extensions){let{http:r,...n}=t.extensions;e.extensions=Object.keys(n).length?n:void 0;}return e}return t}function rf(t){if(Le(t)){let e="toJSON"in t&&typeof t.toJSON=="function"?t.toJSON():Object(t),{http:r,unexpected:n,...s}=e.extensions||{};return B(t.message,{nodes:t.nodes,source:t.source,positions:t.positions,path:t.path,originalError:rf(t.originalError||void 0),extensions:Object.keys(s).length?s:void 0,coordinate:xn(t)})}return t}function nf(t,e){let n=Ot(t,{Connection:"keep-alive","Content-Type":'multipart/mixed; boundary="-"',"Transfer-Encoding":"chunked"}),s,i=new e.TextEncoder,o=new e.ReadableStream({start(a){if(ce(t))s=t[Symbol.asyncIterator]();else {let l=false;s={next:()=>l?N({done:true,value:null}):(l=true,N({done:false,value:t}))};}a.enqueue(i.encode(`\r
|
|
23
|
+
`+Vo(t.errors,e):Ho(t);if(e.includes(t))return "[Circular]";let r=[...e,t];if(Jd(t)){let n=t.toJSON();if(n!==t)return typeof n=="string"?n:Sr(n,r)}else if(Array.isArray(t))return Vo(t,r);return Yd(t,r)}function Jd(t){return typeof t.toJSON=="function"}function Yd(t,e){let r=Object.entries(t);return r.length===0?"{}":e.length>3?"["+Xd(t)+"]":"{ "+r.map(([s,i])=>s+": "+Sr(i,e)).join(", ")+" }"}function Vo(t,e){if(t.length===0)return "[]";if(e.length>3)return "[Array]";let r=t.length,n=[];for(let s=0;s<r;++s)n.push(Sr(t[s],e));return "["+n.join(", ")+"]"}function Xd(t){let e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof t.constructor=="function"){let r=t.constructor.name;if(typeof r=="string"&&r!=="")return r}return e}g();var ep=["message","locations","path","nodes","source","positions","originalError","name","stack","extensions","coordinate"];function tp(t){return t!=null&&typeof t=="object"&&Object.keys(t).every(e=>ep.includes(e))}function z(t,e){e?.originalError&&!(e.originalError instanceof Error)&&tp(e.originalError)&&(e.originalError=z(e.originalError.message,e.originalError));let r=b$4,n=a$6.major>=16?new r(t,e):new r(t,e?.nodes,e?.source,e?.positions,e?.path,e?.originalError,e?.extensions);return e?.coordinate&&n.coordinate==null&&Object.defineProperties(n,{coordinate:{value:e.coordinate,enumerable:true,configurable:true}}),n}function le(t,e,r,n){let s=E$1(t,e,r);if(!s.coordinate&&n&&s.coordinate==null){let i=`${n.parentType.name}.${n.fieldName}`;Object.defineProperties(s,{coordinate:{value:i,enumerable:true,configurable:true}});}return s}g();function Wo(t){return t!=null&&typeof t=="object"&&Symbol.iterator in t}function is(t){return typeof t=="object"&&t!==null}function Ko(t,e,r){let n=r;for(let s of t)n=A(()=>n,i=>e(i,s));return n}function Er(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function os(t,e,r={}){let n={},i=(e.arguments??[]).reduce((o,a)=>({...o,[a.name.value]:a}),{});for(let o of t.args){let a=i[o.name];if(!a){if("default"in o&&o.default)n[o.name]="value"in o.default?o.default.value:g$3(o.default.literal);else if(o.defaultValue!==void 0)n[o.name]=o.defaultValue;else if(j$1(o.type))throw z(`Argument "${o.name}" of required type "${te(o.type)}" was not provided.`,{nodes:[e]});continue}let l=a.value,c=l.kind===d$3.NULL;if(l.kind===d$3.VARIABLE){let h=l.name.value;if(r==null||!Er(r,h)){if(o.defaultValue!==void 0)n[o.name]=o.defaultValue;else if(j$1(o.type))throw z(`Argument "${o.name}" of required type "${te(o.type)}" was provided the variable "$${h}" which was not provided a runtime value.`,{nodes:[l]});continue}c=r[h]==null;}if(c&&j$1(o.type))throw z(`Argument "${o.name}" of non-null type "${te(o.type)}" must not be null.`,{nodes:[l]});let u=A$2(l,o.type,r);if(u===void 0)throw z(`Argument "${o.name}" has invalid value ${f$3(l)}.`,{nodes:[l]});n[o.name]=u;}return n}g();function $e(t){let e=new WeakMap;return function(n){let s=e.get(n);if(s===void 0){let i=t(n);return e.set(n,i),i}return s}}function Qo(t){let e=new WeakMap;return function(n,s,i){let o=e.get(n);if(!o){o=new WeakMap,e.set(n,o);let c=new WeakMap;o.set(s,c);let u=t(n,s,i);return c.set(i,u),u}let a=o.get(s);if(!a){a=new WeakMap,o.set(s,a);let c=t(n,s,i);return a.set(i,c),c}let l=a.get(i);if(l===void 0){let c=t(n,s,i);return a.set(i,c),c}return l}}function Zo(t){let e=new WeakMap;return function(n,s,i,o,a){let l=e.get(n);if(!l){l=new WeakMap,e.set(n,l);let p=new WeakMap;l.set(s,p);let _=new WeakMap;p.set(i,_);let w=new WeakMap;_.set(o,w);let R=t(n,s,i,o,a);return w.set(a,R),R}let c=l.get(s);if(!c){c=new WeakMap,l.set(s,c);let p=new WeakMap;c.set(i,p);let _=new WeakMap;p.set(o,_);let w=t(n,s,i,o,a);return _.set(a,w),w}let u=c.get(i);if(!u){u=new WeakMap,c.set(i,u);let p=new WeakMap;u.set(o,p);let _=t(n,s,i,o,a);return p.set(a,_),_}let h=u.get(o);if(!h){h=new WeakMap,u.set(o,h);let p=t(n,s,i,o,a);return h.set(a,p),p}let d=h.get(a);if(d===void 0){let p=t(n,s,i,o,a);return h.set(a,p),p}return d}}g();function Jo(t,e,r){let s=Yo(t).get(e);if(s==null)throw z(`Schema is not configured to execute ${e} operation.`,{nodes:r});return s}var Yo=$e(function(e){let r=new Map,n=e.getQueryType();n&&r.set("query",n);let s=e.getMutationType();s&&r.set("mutation",s);let i=e.getSubscriptionType();return i&&r.set("subscription",i),r});g();g();var Xe=class extends Map{get[Symbol.toStringTag](){return "AccumulatorMap"}add(e,r){let n=this.get(e);n===void 0?this.set(e,[r]):n.push(r);}};g();var Xo=new r$1({name:"defer",description:"Directs the executor to defer this fragment when the `if` argument is true or undefined.",locations:[c$2.FRAGMENT_SPREAD,c$2.INLINE_FRAGMENT],args:{if:{type:new n$1(q$1),description:"Deferred when true or undefined.",defaultValue:true},label:{type:p$1,description:"Unique name"}}}),ea=new r$1({name:"stream",description:"Directs the executor to stream plural fields when the `if` argument is true or undefined.",locations:[c$2.FIELD],args:{if:{type:new n$1(q$1),description:"Stream when true or undefined.",defaultValue:true},label:{type:p$1,description:"Unique name"},initialCount:{defaultValue:0,type:o$1,description:"Number of items to return immediately"}}});function yt(t,e,r,n,s,i,o,a){for(let l of s.selections)switch(l.kind){case d$3.FIELD:{if(!as(r,l))continue;i.add(np(l),l);break}case d$3.INLINE_FRAGMENT:{if(!as(r,l)||!ta(t,l,n))continue;let c=ra(r,l);if(c){let u=new Xe;yt(t,e,r,n,l.selectionSet,u,o,a),o.push({label:c.label,fields:u});}else yt(t,e,r,n,l.selectionSet,i,o,a);break}case d$3.FRAGMENT_SPREAD:{let c=l.name.value;if(!as(r,l))continue;let u=ra(r,l);if(a.has(c)&&!u)continue;let h=e[c];if(!h||!ta(t,h,n))continue;if(u||a.add(c),u){let d=new Xe;yt(t,e,r,n,h.selectionSet,d,o,a),o.push({label:u.label,fields:d});}else yt(t,e,r,n,h.selectionSet,i,o,a);break}}}function ls(t,e,r,n,s){let i=new Xe,o=[];return yt(t,e,r,n,s,i,o,new Set),{fields:i,patches:o}}function as(t,e){return !(B$2(t$1,e,t)?.if===true||B$2(s$1,e,t)?.if===false)}function ta(t,e,r){let n=e.typeCondition;if(!n)return true;let s=y$2(t,n);return s===r?true:m$1(s)?t.getPossibleTypes(s).includes(r):false}function np(t){return t.alias?t.alias.value:t.name.value}function ra(t,e){let r=B$2(Xo,e,t);if(r&&r.if!==false)return {label:typeof r.label=="string"?r.label:void 0}}var na=Zo(function(e,r,n,s,i){let o=new Xe,a=new Set,l=[],c={fields:o,patches:l};for(let u of i)u.selectionSet&&yt(e,r,n,s,u.selectionSet,o,l,a);return c});g();function Pr(t){return t?.[Symbol.asyncIterator]!=null}g();function et(t,e,r){return {prev:t,key:e,typename:r}}function re(t){let e=[],r=t;for(;r;)e.push(r.key),r=r.prev;return e.reverse()}function sa(t){return t.map(e=>typeof e=="number"?"["+e.toString()+"]":"."+e).join("")}g();g();function gt(t,e){let r={...e,...t};for(let n of Object.keys(r))n in t&&n in e&&(r[n]=(s,i)=>t[n](s,()=>e[n](s,i)));return r}var tt=t=>({fn(e,r){return e?(...n)=>{let s;return e(t,()=>{s=r(...n);}),s}:r},asyncFn(e,r){return e?(...n)=>{let s;return A(()=>e(t,()=>(s=r(...n),G(s)?s.then(()=>{}):void 0)),()=>s)}:r}});g();g();g();var ia=new WeakMap;g();function sp(t){return t.length===1?t[0]:{schema:t[0],document:t[1],rootValue:t[2],contextValue:t[3],variableValues:t[4],operationName:t[5],fieldResolver:t[6],subscribeFieldResolver:t[7]}}var cs=t=>((...e)=>t(sp(e)));function ip(t){return t.length===1?t[0]:{schema:t[0],document:t[1],rootValue:t[2],contextValue:t[3],variableValues:t[4],operationName:t[5],fieldResolver:t[6],typeResolver:t[7]}}var us=t=>((...e)=>t(ip(e)));function ce(t){return typeof t=="object"&&t!=null&&typeof t[Symbol.asyncIterator]=="function"}function fs(t,e){if(ce(t.result))return {onNext:e};e({args:t.args,result:t.result,setResult:t.setResult});}function hs(t,e){let r;function n(){return r||(r=t[Symbol.asyncIterator]()),r}let s=false;return {[Symbol.asyncIterator](){return this},next(){return n().next().then(i=>(i.done&&s===false&&(s=true,e()),i))},return(){let i=n().return?.();return s===false&&(s=true,e()),i||N({done:true,value:void 0})},throw(i){let o=n().throw?.();if(o)return o;throw i},[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")](){return N()}}}function oa(t,e){let r;function n(){return r||(r=t[Symbol.asyncIterator]()),r}return {[Symbol.asyncIterator](){return this},next(){return n().next().catch(s=>(e(s),{done:true,value:void 0}))},return(){return n().return?.()||N({done:true,value:void 0})},throw(s){let i=n().throw?.();if(i)return i;throw s},[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")](){return N()}}}function vr(t){throw Error(`No \`${t}\` function found! Register it using "useEngine" plugin.`)}function aa({plugins:t}){let e=null,r=false,n=()=>vr("parse"),s=()=>vr("validate"),i=()=>vr("execute"),o=()=>vr("subscribe"),a,l=(P,T=-1)=>{if(e!==P&&(e=P,r))for(let[S,v]of t.entries())S!==T&&v.onSchemaChange&&v.onSchemaChange({schema:e,replaceSchema:O=>{l(O,S);}});},c=[];for(let P=0;P<t.length;P++){let T=t[P],S=[];T.onPluginInit?.({plugins:t,addPlugin:v=>{S.push(v);},setSchema:v=>l(v,P),registerContextErrorHandler:v=>c.push(v)}),S.length&&t.splice(P+1,0,...S);}let u={init:[],parse:[],validate:[],subscribe:[],execute:[],context:[]};for(let{onContextBuilding:P,onExecute:T,onParse:S,onSubscribe:v,onValidate:O,onEnveloped:g,instrumentation:x}of t)g&&u.init.push(g),P&&u.context.push(P),T&&u.execute.push(T),S&&u.parse.push(S),v&&u.subscribe.push(v),O&&u.validate.push(O),x&&(a=a?gt(a,x):x);let h=P=>{for(let[T,S]of u.init.entries())S({context:P,extendContext:v=>{P&&Object.assign(P,v);},setSchema:v=>l(v,T)});},d=u.parse.length?P=>(T,S)=>{let v=null,O=n,g=P,x=[];for(let E of u.parse){let k=E({context:g,extendContext:L=>{Object.assign(g,L);},params:{source:T,options:S},parseFn:O,setParseFn:L=>{O=L;},setParsedDocument:L=>{v=L;}});k&&x.push(k);}if(v===null)try{v=O(T,S);}catch(E){v=E;}for(let E of x)E({context:g,extendContext:k=>{Object.assign(g,k);},replaceParseResult:k=>{v=k;},result:v});if(v===null)throw new Error("Failed to parse document.");if(v instanceof Error)throw v;return ia.set(v,T.toString()),v}:()=>n,p=u.validate.length?P=>(T,S,v,O,g)=>{let x=v?[...v]:void 0,E=s,k=null,L=P,j=[];for(let W of u.validate){let $=W({context:L,extendContext:J=>{Object.assign(L,J);},params:{schema:T,documentAST:S,rules:x,typeInfo:O,options:g},validateFn:E,addValidationRule:J=>{x||(x=[]),x.push(J);},setValidationFn:J=>{E=J;},setResult:J=>{k=J;}});$&&j.push($);}if(k||(k=E(T,S,x,O,g)),!k)return;let M=k.length===0;for(let W of j)W({valid:M,result:k,context:L,extendContext:$=>{Object.assign(L,$);},setResult:$=>{k=$;}});return k}:()=>s,_=u.context.length?P=>T=>{let S=[],v=P;T&&Object.assign(v,T);let O=false;return A(()=>Q(u.context,(g,x)=>g({context:v,extendContext:E=>{Object.assign(v,E);},breakContextBuilding:()=>{O=true,x();}}),S),()=>O?v:A(()=>Q(S,g=>g({context:v,extendContext(x){Object.assign(v,x);}})),()=>v),g=>{let x=g;for(let E of c)E({context:v,error:x,setError:k=>{x=k;}});throw x})}:P=>T=>(T&&Object.assign(P,T),P),R=u.subscribe.length?cs(P=>{let T=o,S=[],v=P.contextValue||{},O;return A(()=>Q(u.subscribe,(g,x)=>g({subscribeFn:T,setSubscribeFn:E=>{T=E;},context:v,extendContext:E=>{Object.assign(v,E);},args:P,setResultAndStopExecution:E=>{O=E,x();}}),S),()=>{let g=[],x=[];for(let{onSubscribeResult:E,onSubscribeError:k}of S)E&&g.push(E),k&&x.push(k);return A(()=>O||T(P),E=>{let k=[],L=[];for(let j of g){let M=j({args:P,result:E,setResult:W=>{E=W;}});M&&(M.onNext&&k.push(M.onNext),M.onEnd&&L.push(M.onEnd));}return k.length&&ce(E)&&(E=Ie(E,j=>A(()=>Q(k,M=>M({args:P,result:j,setResult:W=>j=W})),()=>j))),L.length&&ce(E)&&(E=hs(E,()=>{for(let j of L)j();})),x.length&&ce(E)&&(E=oa(E,j=>{let M=j;for(let W of x)W({error:M,setError:$=>{M=$;}});throw M})),E})})}):cs(o),I=u.execute.length?us(P=>{let T=i,S,v=[],O=[],g=P.contextValue||{};return A(()=>Q(u.execute,(x,E)=>x({executeFn:T,setExecuteFn:k=>{T=k;},setResultAndStopExecution:k=>{S=k,E();},context:g,extendContext:k=>{if(typeof k=="object")Object.assign(g,k);else throw new Error(`Invalid context extension provided! Expected "object", got: "${JSON.stringify(k)}" (${typeof k})`)},args:P}),v),()=>A(()=>S||T({...P,contextValue:g}),x=>A(()=>Q(v,E=>E.onExecuteDone?.({args:P,result:x,setResult:k=>{x=k;}}),O),()=>{let E=[],k=[];for(let{onNext:L,onEnd:j}of O)L&&E.push(L),j&&k.push(j);return E.length&&ce(x)&&(x=Ie(x,L=>A(()=>Q(E,j=>j({args:P,result:L,setResult:M=>{L=M;}})),()=>L))),k.length&&ce(x)&&(x=hs(x,()=>{for(let L of k)L();})),x})))}):us(i);if(r=true,e)for(let[P,T]of t.entries())T.onSchemaChange?.({schema:e,replaceSchema:S=>l(S,P)});return {getCurrentSchema(){return e},init:h,parse:d,validate:p,execute:I,subscribe:R,contextFactory:_,instrumentation:a}}function op(t){return t!=null}function la(t){let e=t.plugins.filter(op),r=aa({plugins:e}),n=r.instrumentation,s=(i={})=>{let o=tt({context:i}),a=r;return o.fn(n?.init,r.init)(i),{parse:o.fn(n?.parse,a.parse(i)),validate:o.fn(n?.validate,a.validate(i)),contextFactory:o.fn(n?.context,a.contextFactory(i)),execute:o.asyncFn(n?.execute,a.execute),subscribe:o.asyncFn(n?.subscribe,a.subscribe),schema:a.getCurrentSchema()}};return s._plugins=e,s}g();var ap="Unexpected error.";function lp(t){return t instanceof Error&&t.name==="GraphQLError"}function ca(t){return lp(t)?t.originalError!=null?ca(t.originalError):true:false}function cp(t,e,r){let n=new Error(t);if(n.name="GraphQLError",r){let s=e instanceof Error?{message:e.message,stack:e.stack}:{message:String(e)};Object.defineProperty(n,"extensions",{get(){return s}});}return Object.defineProperty(n,"toJSON",{value(){return {message:n.message,extensions:n.extensions}}}),n}var up=t=>(e,r)=>ca(e)?e:cp(r,e,t),fp=globalThis.process?.env?.NODE_ENV==="development",hp=up(fp),dp=(t,e)=>({result:r,setResult:n})=>{r.errors!=null&&n({...r,errors:r.errors.map(s=>t(s,e))});};function ua(t){let e=t?.maskError??hp,r=t?.errorMessage||ap,n=dp(e,r);return {onPluginInit(s){s.registerContextErrorHandler(({error:i,setError:o})=>{o(e(i,r));});},onExecute(){return {onExecuteDone(s){return fs(s,n)}}},onSubscribe(){return {onSubscribeResult(s){return fs(s,n)},onSubscribeError({error:s,setError:i}){i(e(s,r));}}}}}g();var fa=t=>({onContextBuilding({context:e,extendContext:r}){return A(()=>t(e),n=>r(n))}});g();var ha=t=>({onExecute:({setExecuteFn:e})=>{t.execute&&e(t.execute);},onParse:({setParseFn:e})=>{t.parse&&e(t.parse);},onValidate:({setValidationFn:e,addValidationRule:r})=>{t.validate&&e(t.validate),t.specifiedRules?.map(r);},onSubscribe:({setSubscribeFn:e})=>{t.subscribe&&e(t.subscribe);}});g();g();g();g();var Ne=class extends Error{error;suppressed;constructor(e,r,n){super(n),this.error=e,this.suppressed=r,this.name="SuppressedError",Error.captureStackTrace(this,this.constructor);}};g();var H={get dispose(){return Symbol.dispose||Symbol.for("dispose")},get asyncDispose(){return Symbol.asyncDispose||Symbol.for("asyncDispose")}};g();function kr(t){return t?.[H.dispose]!=null}function da(t){return t?.[H.asyncDispose]!=null}var pp=globalThis.SuppressedError||Ne,Tr=class t{callbacks=[];get disposed(){return this.callbacks.length===0}use(e){return da(e)?this.callbacks.push(()=>e[H.asyncDispose]()):kr(e)&&this.callbacks.push(()=>e[H.dispose]()),e}adopt(e,r){return r&&this.callbacks.push(()=>r(e)),e}defer(e){e&&this.callbacks.push(e);}move(){let e=new t;return e.callbacks=this.callbacks,this.callbacks=[],e}disposeAsync(){return this[H.asyncDispose]()}_error;_iterateCallbacks(){let e=this.callbacks.pop();if(e)return A(e,()=>this._iterateCallbacks(),r=>(this._error=this._error?new pp(r,this._error):r,this._iterateCallbacks()))}[H.asyncDispose](){let e=this._iterateCallbacks();if(e?.then)return e.then(()=>{if(this._error){let r=this._error;throw this._error=void 0,r}});if(this._error){let r=this._error;throw this._error=void 0,r}}[Symbol.toStringTag]="AsyncDisposableStack"};g();var pa=globalThis.AsyncDisposableStack||Tr;g();function we(t){if(t instanceof Error)return t;if(typeof t=="object"&&t!=null&&"message"in t&&typeof t.message=="string"){let e;"cause"in t&&(e={cause:t.cause});let r=new Error(t.message,e);return "stack"in t&&typeof t.stack=="string"&&(r.stack=t.stack),"name"in t&&typeof t.name=="string"&&(r.name=t.name),r}return new Error(String(t))}g();function ma(t){let e=t[Symbol.asyncIterator](),r,n,s=false;async function i(){if(s)return {value:void 0,done:true};try{if(!r){if(n)return await n,await i();let l;n=new Promise(u=>{l=u;});let c=await e.next();return c.done?(s=!0,await i()):(r=c.value[Symbol.asyncIterator](),n=void 0,l(),await i())}let o=r,a=await r.next();return a.done?(r===o&&(r=void 0),await i()):a}catch(o){throw s=true,o}}return {next:i,async return(){return s=true,await Promise.all([r?.return?.(),e.return?.()]),{value:void 0,done:true}},async throw(o){throw s=true,await Promise.all([r?.throw?.(o),e.throw?.(o)]),o},[Symbol.asyncIterator](){return this},async[H.asyncDispose](){s=true,await Promise.all([r?.[H.asyncDispose]?.(),e?.[H.asyncDispose]?.()]);}}}g();function ds(t,e){if(!t)throw new Error(e??"Unexpected invariant triggered.")}g();function ps(t,e,r){e?.throwIfAborted();let n=Object.create(null),s=[];for(let o in t){let a=A(()=>t[o],l=>{n[o]=l;});G(a)&&s.push(a);}if(!s.length)return n;let i=s.length===1?s[0]:Promise.all(s);return r?Promise.race([r,i]).then(()=>n):i.then(()=>n)}g();function ba(t,e,r,n){let s=[],i=n?.maxErrors;try{let o=bp(t,e,r,a=>{if(i!=null&&s.length>=i)throw z("Too many errors processing variables, error limit reached. Execution aborted.");s.push(a);});if(s.length===0)return {coerced:o}}catch(o){s.push(o);}return {errors:s}}function bp(t,e,r,n){let s={};for(let i of e){let o=i.variable.name.value,a=y$2(t,i.type);if(!k$1(a)){let c=f$3(i.type);n(z(`Variable "$${o}" expected value of type "${c}" which cannot be used as an input type.`,{nodes:i.type}));continue}if(!Er(r,o)){if(i.defaultValue)s[o]=A$2(i.defaultValue,a);else if(j$1(a)){let c=te(a);n(z(`Variable "$${o}" of required type "${c}" was not provided.`,{nodes:i}));}continue}let l=r[o];if(l===null&&j$1(a)){let c=te(a);n(z(`Variable "$${o}" of non-null type "${c}" must not be null.`,{nodes:i}));continue}s[o]=z$2(l,a,(c,u,h)=>{let d=`Variable "$${o}" got invalid value `+te(u);c.length>0&&(d+=` at "${o}${sa(c)}"`),n(z(d+"; "+h.message,{nodes:i,originalError:h}));});}return s}var yp=Qo((t,e,r)=>na(t.schema,t.fragments,t.variableValues,e,r));function va(t){let e=Ta(t);return "schema"in e?ka(e):{errors:e.map(r=>(Object.defineProperty(r,"extensions",{value:{...r.extensions,http:{...r.extensions?.http||{},status:400}}}),r))}}function ka(t){return t.signal?.throwIfAborted(),A(()=>_p(t),e=>{let r=ya(e,t.errors);return t.subsequentPayloads.size>0?{initialResult:{...r,hasNext:true},subsequentResults:Dp(t)}:r},e=>(t.signal?.throwIfAborted(),e.errors?t.errors.push(...e.errors):t.errors.push(e),ya(null,t.errors)))}function ya(t,e){return e.length===0?{data:t}:{errors:e,data:t}}var gp=$e(function(e){let r=Object.create(null);for(let n of e.definitions)n.kind===d$3.FRAGMENT_DEFINITION&&(r[n.name.value]=n);return r});function Ta(t){let{schema:e,document:r,rootValue:n,contextValue:s,variableValues:i,operationName:o,fieldResolver:a,typeResolver:l,subscribeFieldResolver:c,signal:u,schemaCoordinateInErrors:h}=t;u?.throwIfAborted(),x$1(e);let d=gp(r),p;for(let I of r.definitions)switch(I.kind){case d$3.OPERATION_DEFINITION:if(o==null){if(p!==void 0)return [z("Must provide operation name if query contains multiple operations.",{extensions:{code:"OPERATION_RESOLUTION_FAILURE"}})];p=I;}else I.name?.value===o&&(p=I);break;}if(p==null)return o!=null?[z(`Unknown operation named "${o}".`,{extensions:{code:"OPERATION_RESOLUTION_FAILURE"}})]:[z("Must provide an operation.",{extensions:{code:"OPERATION_RESOLUTION_FAILURE"}})];let _=p.variableDefinitions??[],w=ba(e,_,i??{},{maxErrors:50});if(w.errors)return w.errors;u?.throwIfAborted();let R,C;if(u){let I=new Set,P=Bt();C=P.promise;let T=()=>{P.reject(u.reason),u.removeEventListener("abort",T);};u.addEventListener("abort",T,{once:true}),C.catch(()=>{for(let S of I)S();I.clear();}),R=S=>{I.add(S);};}return {schema:e,fragments:d,rootValue:n,contextValue:s,operation:p,variableValues:w.coerced,fieldResolver:a??wa,typeResolver:l??Tp,subscribeFieldResolver:c??wa,subsequentPayloads:new Set,errors:[],signal:u,onSignalAbort:R,signalPromise:C,schemaCoordinateInErrors:h}}function xp(t,e){return {...t,rootValue:e,subsequentPayloads:new Set,errors:[]}}function _p(t){let{operation:e,schema:r,fragments:n,variableValues:s,rootValue:i}=t,o=Jo(r,e.operation,[e]);o==null&&z(`Schema is not configured to execute ${e.operation} operation.`,{nodes:e});let{fields:a,patches:l}=ls(r,n,s,o,e.selectionSet),c=void 0,u;e.operation==="mutation"?u=wp(t,o,i,c,a):u=ys(t,o,i,c,a);for(let h of l){let{label:d,fields:p}=h;Ia(t,o,i,p,d,c);}return u}function wp(t,e,r,n,s){return Ko(s,(i,[o,a])=>{let l=et(n,o,e.name);return t.signal?.throwIfAborted(),A(()=>Ca(t,e,r,a,l),c=>(c===void 0||(i[o]=c),i))},Object.create(null))}function ys(t,e,r,n,s,i){let o=Object.create(null),a=false;try{for(let[l,c]of s){t.signal?.throwIfAborted();let u=et(n,l,e.name),h=Ca(t,e,r,c,u,i);h!==void 0&&(o[l]=h,G(h)&&(a=!0));}}catch(l){if(l!==t.signal?.reason&&a)return A(()=>ps(o,t.signal),()=>{throw l},()=>{throw l});throw l}return a?ps(o,t.signal,t.signalPromise):o}function Ca(t,e,r,n,s,i){let o=i?.errors??t.errors,a=Da(t.schema,e,n[0]);if(!a)return;let l=a.type,c=a.resolve??t.fieldResolver,u=Aa(t,a,n,e,s);try{t.signal?.throwIfAborted();let h=os(a,n[0],t.variableValues),d=t.contextValue,p=c(r,h,d,u),_;return G(p)?_=p.then(w=>Ge(t,l,n,u,s,w,i)):_=Ge(t,l,n,u,s,p,i),G(_)?_.then(void 0,w=>{if(w instanceof AggregateError){let I;for(let P of w.errors){P=we(P);let T=le(P,n,re(s),t.schemaCoordinateInErrors&&u);I=ye(T,l,o),he(t,s,i);}return I}w=we(w);let R=le(w,n,re(s),t.schemaCoordinateInErrors&&u),C=ye(R,l,o);return he(t,s,i),C}):_}catch(h){if(h instanceof AggregateError){let w;for(let R of h.errors){R=we(R);let C=le(R,n,re(s),t.schemaCoordinateInErrors&&u);w=ye(C,l,o),he(t,s,i);}return w}let d=we(h),p=le(d,n,re(s),t.schemaCoordinateInErrors&&u),_=ye(p,l,o);return he(t,s,i),_}}function Aa(t,e,r,n,s){return {fieldName:e.name,fieldNodes:r,returnType:e.type,parentType:n,path:s,schema:t.schema,fragments:t.fragments,rootValue:t.rootValue,operation:t.operation,variableValues:t.variableValues,signal:t.signal}}var Sp="CRITICAL_ERROR";function ye(t,e,r){if(j$1(e)||t.extensions?.[Sp])throw t;return r.push(t),null}function Ge(t,e,r,n,s,i,o){if(i instanceof Error)throw i;if(j$1(e)){let a=Ge(t,e.ofType,r,n,s,i,o);if(a===null)throw new Error(`Cannot return null for non-nullable field ${n.parentType.name}.${n.fieldName}.`);return a}if(i==null)return null;if(i$2(e))return Pp(t,e,r,n,s,i,o);if(l$1(e))return vp(e,i);if(m$1(e))return kp(t,e,r,n,s,i,o);if(h$1(e))return ms(t,e,r,n,s,i,o);console.assert(false,"Cannot complete value of unexpected output type: "+te(e));}function Ra(t,e,r){if(typeof r.key=="number")return;let n=B$2(ea,e[0],t.variableValues);if(n&&n.if!==false)return ds(typeof n.initialCount=="number","initialCount must be a number"),ds(n.initialCount>=0,"initialCount must be a positive integer"),{initialCount:n.initialCount,label:typeof n.label=="string"?n.label:void 0}}async function Ep(t,e,r,n,s,i,o){t.signal?.throwIfAborted(),i.return&&t.onSignalAbort?.(()=>{i.return?.();});let a=o?.errors??t.errors,l=Ra(t,r,s),c=false,u=[],h=0;for(;;){if(l&&typeof l.initialCount=="number"&&h>=l.initialCount){Fp(h,i,t,r,n,e,s,l.label,o);break}let d=et(s,h,void 0),p;try{if(p=await i.next(),p.done)break}catch(_){let w=we(_),R=le(w,r,re(d),t.schemaCoordinateInErrors&&n);u.push(ye(R,e,a));break}La(p.value,u,a,t,e,r,n,d,o)&&(c=true),h+=1;}return c?Promise.all(u):u}function Pp(t,e,r,n,s,i,o){let a=e.ofType,l=o?.errors??t.errors;if(Pr(i)){let _=i[Symbol.asyncIterator]();return Ep(t,a,r,n,s,_,o)}if(!Wo(i))throw z(`Expected Iterable, but did not find one for field "${n.parentType.name}.${n.fieldName}".`);let c=Ra(t,r,s),u=false,h=o,d=[],p=0;for(let _ of i){let w=et(s,p,void 0);if(c&&typeof c.initialCount=="number"&&p>=c.initialCount){h=Lp(s,w,_,t,r,n,a,c.label,h),p++;continue}La(_,d,l,t,a,r,n,w,o)&&(u=true),p++;}return u?Promise.all(d):d}function La(t,e,r,n,s,i,o,a,l){try{let c;if(G(t)?c=t.then(u=>Ge(n,s,i,o,a,u,l)):c=Ge(n,s,i,o,a,t,l),G(c))return e.push(c.then(void 0,u=>{u=we(u);let h=le(u,i,re(a),n.schemaCoordinateInErrors&&o),d=ye(h,s,r);return he(n,a,l),d})),!0;e.push(c);}catch(c){let u=we(c),h=le(u,i,re(a),n.schemaCoordinateInErrors&&o),d=ye(h,s,r);he(n,a,l),e.push(d);}return false}function vp(t,e){let r;try{r=t.serialize(e);}catch(n){throw n instanceof b$4?new Error(n.message):n}if(r==null)throw new Error(`Expected \`${te(t)}.serialize(${te(e)})\` to return non-nullable value, returned: ${te(r)}`);return r}function kp(t,e,r,n,s,i,o){let a=e.resolveType??t.typeResolver,l=t.contextValue,c=a(i,l,n,e);return G(c)?c.then(u=>ms(t,ga(u,t,e,r,n,i),r,n,s,i,o)):ms(t,ga(c,t,e,r,n,i),r,n,s,i,o)}function ga(t,e,r,n,s,i){if(t==null)throw z(`Abstract type "${r.name}" must resolve to an Object type at runtime for field "${s.parentType.name}.${s.fieldName}". Either the "${r.name}" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.`,{nodes:n});if(h$1(t)){if(a$6.major>=16)throw z("Support for returning GraphQLObjectType from resolveType was removed in graphql-js@16.0.0 please return type name instead.");t=t.name;}if(typeof t!="string")throw z(`Abstract type "${r.name}" must resolve to an Object type at runtime for field "${s.parentType.name}.${s.fieldName}" with value ${te(i)}, received "${te(t)}".`);let o=e.schema.getType(t);if(o==null)throw z(`Abstract type "${r.name}" was resolved to a type "${t}" that does not exist inside the schema.`,{nodes:n});if(!h$1(o))throw z(`Abstract type "${r.name}" was resolved to a non-object type "${t}".`,{nodes:n});if(!e.schema.isSubType(r,o))throw z(`Runtime Object type "${o.name}" is not a possible type for "${r.name}".`,{nodes:n});return o}function ms(t,e,r,n,s,i,o){if(e.isTypeOf){let a=e.isTypeOf(i,t.contextValue,n);if(G(a))return a.then(l=>{if(!l)throw xa(e,i,r);return _a(t,e,r,s,i,o)});if(!a)throw xa(e,i,r)}return _a(t,e,r,s,i,o)}function xa(t,e,r){return z(`Expected value of type "${t.name}" but got: ${te(e)}.`,{nodes:r})}function _a(t,e,r,n,s,i){let{fields:o,patches:a}=yp(t,e,r),l=ys(t,e,s,n,o,i);for(let c of a){let{label:u,fields:h}=c;Ia(t,e,s,h,u,n,i);}return l}var Tp=function(t,e,r,n){if(is(t)&&typeof t.__typename=="string")return t.__typename;let s=r.schema.getPossibleTypes(n),i=[];for(let o=0;o<s.length;o++){let a=s[o];if(a.isTypeOf){let l=a.isTypeOf(t,e,r);if(G(l))i[o]=l;else if(l)return a.name}}if(i.length)return Promise.all(i).then(o=>{for(let a=0;a<o.length;a++)if(o[a])return s[a].name})},wa=function(t,e,r,n){if(is(t)||typeof t=="function"){let s=t[n.fieldName];return typeof s=="function"?t[n.fieldName](e,r,n):s}};function Oa(t){let e=Ta(t);if(!("schema"in e)){for(let n of e){let s=n.extensions||={},i=s.http||={};i.status=400,n.extensions.code="BAD_USER_INPUT";}return {errors:e}}let r=Ap(e);return G(r)?r.then(n=>Sa(e,n)):Sa(e,r)}function Fa(t){return t?.initialResult}function gs(t){let e=t.subsequentResults,r=false,n=false;return {[Symbol.asyncIterator](){return this},next(){return n?N({value:void 0,done:n}):r?e.next():(r=true,N({value:t.initialResult,done:n}))},return(){return n=true,e.return()},throw(s){return n=true,e.throw(s)},[H.asyncDispose](){return n=true,e?.[H.asyncDispose]?.()}}}async function*Cp(t){"initialResult"in t?yield*gs(t):yield t;}function Sa(t,e){return Pr(e)?ma(Ie(e,r=>A(()=>ka(xp(t,r)),Cp),r=>{throw r instanceof AggregateError?new AggregateError(r.errors.map(n=>Ea(n,t.operation)),r.message):Ea(r,t.operation)})):e}function Ea(t,e){return z(t.message,{originalError:t,nodes:[e]})}function Ap(t){try{let e=Rp(t);return G(e)?e.then(void 0,r=>({errors:[r]})):e}catch(e){return {errors:[e]}}}function Rp(t){let{schema:e,fragments:r,operation:n,variableValues:s,rootValue:i}=t,o=e.getSubscriptionType();if(o==null)throw z("Schema is not configured to execute subscription operation.",{nodes:n});let{fields:a}=ls(e,r,s,o,n.selectionSet),[l,c]=[...a.entries()][0],u=c[0].name.value,h=Da(e,o,c[0]);if(!h)throw z(`The subscription field "${u}" is not defined.`,{nodes:c});let d=et(void 0,l,o.name),p=Aa(t,h,c,o,d);try{let _=os(h,c[0],s),w=t.contextValue,C=(h.subscribe??t.subscribeFieldResolver)(i,_,w,p);return G(C)?C.then(I=>Pa(I,t.signal,t.onSignalAbort)).then(void 0,I=>{throw le(I,c,re(d),t.schemaCoordinateInErrors&&p)}):Pa(C,t.signal,t.onSignalAbort)}catch(_){throw le(_,c,re(d),t.schemaCoordinateInErrors&&p)}}function Pa(t,e,r){if(e?.throwIfAborted(),t instanceof Error)throw t;if(!Pr(t))throw z(`Subscription field must return Async Iterable. Received: ${te(t)}.`);return r?{[Symbol.asyncIterator](){let n=t[Symbol.asyncIterator]();return n.return&&r?.(()=>{n.return?.();}),n}}:t}function Ia(t,e,r,n,s,i,o){let a=new bs({label:s,path:i,parentContext:o,exeContext:t}),l;try{l=ys(t,e,r,i,n,a),G(l)&&(l=l.then(null,c=>(a.errors.push(c),null)));}catch(c){a.errors.push(c),l=null;}a.addData(l);}function Lp(t,e,r,n,s,i,o,a,l){let c=new Ar({label:a,path:e,parentContext:l,exeContext:n}),u;try{try{G(r)?u=r.then(d=>Ge(n,o,s,i,e,d,c)):u=Ge(n,o,s,i,e,r,c),G(u)&&(u=u.then(void 0,d=>{d=we(d);let p=le(d,s,re(e),n.schemaCoordinateInErrors&&i),_=ye(p,o,c.errors);return he(n,e,c),_}));}catch(d){let p=we(d),_=le(p,s,re(e),n.schemaCoordinateInErrors&&i);u=ye(_,o,c.errors),he(n,e,c);}}catch(d){return c.errors.push(d),he(n,t,c),c.addItems(null),c}let h;return G(u)?h=u.then(d=>[d],d=>(c.errors.push(d),he(n,t,c),null)):h=[u],c.addItems(h),c}async function Op(t,e,r,n,s,i,o){let a;try{let{value:c,done:u}=await t.next();if(u)return i.setIsCompletedIterator(),{done:u,value:void 0};a=c;}catch(c){let u=we(c),h=le(u,r,re(o),e.schemaCoordinateInErrors&&n);return {done:true,value:ye(h,s,i.errors)}}let l;try{return l=Ge(e,s,r,n,o,a,i),G(l)&&(l=l.then(void 0,c=>{let u=le(c,r,re(o),e.schemaCoordinateInErrors&&n),h=ye(u,s,i.errors);return he(e,o,i),h})),{done:!1,value:l}}catch(c){let u=le(c,r,re(o),e.schemaCoordinateInErrors&&n),h=ye(u,s,i.errors);return he(e,o,i),{done:false,value:h}}}async function Fp(t,e,r,n,s,i,o,a,l){let c=t,u=l??void 0;for(;;){let h=et(o,c,void 0),d=new Ar({label:a,path:h,parentContext:u,iterator:e,exeContext:r}),p;try{p=await Op(e,r,n,s,i,d,h);}catch(C){d.errors.push(C),he(r,o,d),d.addItems(null),e?.return&&e.return().catch(()=>{});return}let{done:_,value:w}=p,R;if(G(w)?R=w.then(C=>[C],C=>(d.errors.push(C),he(r,o,d),null)):R=[w],d.addItems(R),_)break;u=d,c++;}}function he(t,e,r){let n=re(e);t.subsequentPayloads.forEach(s=>{if(s!==r){for(let i=0;i<n.length;i++)if(s.path[i]!==n[i])return;xs(s)&&s.iterator?.return&&s.iterator.return().catch(()=>{}),t.subsequentPayloads.delete(s);}});}function Ip(t){let e=[];for(let r of t.subsequentPayloads){let n={};if(r.isCompleted){if(t.subsequentPayloads.delete(r),xs(r)){let s=r.items;if(r.isCompletedIterator)continue;n.items=s;}else {let s=r.data;n.data=s??null;}n.path=r.path,r.label&&(n.label=r.label),r.errors.length>0&&(n.errors=r.errors),e.push(n);}}return e}function Dp(t){let e=false;async function r(){if(e)return {value:void 0,done:true};let s=Array.from(t.subsequentPayloads).map(a=>a.promise);if(t.signalPromise?await Promise.race([t.signalPromise,...s]):await Promise.race(s),e)return {value:void 0,done:true};let i=Ip(t),o=t.subsequentPayloads.size>0;return !i.length&&o?r():(o||(e=true),{value:i.length?{incremental:i,hasNext:o}:{hasNext:o},done:false})}function n(){let s=[];return t.subsequentPayloads.forEach(i=>{xs(i)&&i.iterator?.return&&s.push(i.iterator.return());}),Promise.all(s)}return {[Symbol.asyncIterator](){return this},next:r,async return(){return await n(),e=true,{value:void 0,done:true}},async throw(s){throw await n(),e=true,s},async[H.asyncDispose](){await n(),e=true;}}}var bs=class{type;errors;label;path;promise;data;parentContext;isCompleted;_exeContext;_resolve;constructor(e){this.type="defer",this.label=e.label,this.path=re(e.path),this.parentContext=e.parentContext,this.errors=[],this._exeContext=e.exeContext,this._exeContext.subsequentPayloads.add(this),this.isCompleted=false,this.data=null,this.promise=new Promise(r=>{this._resolve=n=>{r(n);};}).then(r=>{this.data=r,this.isCompleted=true;});}addData(e){let r=this.parentContext?.promise;if(r){this._resolve?.(r.then(()=>e));return}this._resolve?.(e);}},Ar=class{type;errors;label;path;items;promise;parentContext;iterator;isCompletedIterator;isCompleted;_exeContext;_resolve;constructor(e){this.type="stream",this.items=null,this.label=e.label,this.path=re(e.path),this.parentContext=e.parentContext,this.iterator=e.iterator,this.errors=[],this._exeContext=e.exeContext,this._exeContext.subsequentPayloads.add(this),this.isCompleted=false,this.items=null,this.promise=new Promise(r=>{this._resolve=n=>{r(n);};}).then(r=>{this.items=r,this.isCompleted=true;});}addItems(e){let r=this.parentContext?.promise;if(r){this._resolve?.(r.then(()=>e));return}this._resolve?.(e);}setIsCompletedIterator(){this.isCompletedIterator=true;}};function xs(t){return t.type==="stream"}function Da(t,e,r){let n=r.name.value;return n===u$1.name&&t.getQueryType()===e?u$1:n===v$1.name&&t.getQueryType()===e?v$1:n===w$1.name?w$1:e.getFields()[n]}g();function Rr(t){let e=F$2(t.document,t.operationName);if(e==null)throw new Error("Must provide an operation.");return e.operation==="subscription"?Oa(t):A(()=>va(t),r=>Fa(r)?gs(r):r)}var ag=e$1(sr(),1);g();var Uy=e$1(sr(),1);g();function fu(t){return t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function"}function ky(t){if(t.socket?.localPort)return t.socket?.localPort;let r=(t.headers?.[":authority"]||t.headers?.host)?.split(":")?.[1];return r||80}function Ty(t){if(t.headers?.[":authority"])return t.headers?.[":authority"];if(t.headers?.host)return t.headers?.host;let e=ky(t);if(t.hostname)return t.hostname+":"+e;let r=t.socket?.localAddress;return r&&!r?.includes("::")&&!r?.includes("ffff")?`${r}:${e}`:"localhost"}function Cy(t){let e=Ty(t),r=t.protocol||(t.socket?.encrypted?"https":"http"),n=t.originalUrl||t.url||"/graphql";return `${r}://${e}${n}`}function Ay(t){let e=t[Symbol.toStringTag];return !!(typeof t=="string"||e==="Uint8Array"||e==="Blob"||e==="FormData"||e==="URLSearchParams"||fu(t))}function Bi(t,e,r,n){let s=t.raw||t.req||t,i=Cy(s);if(t.query){let c=new e.URL(i);for(let u in t.query)c.searchParams.set(u,t.query[u]);i=c.toString();}let o=t.headers;if(t.headers?.[":method"]){o={};for(let c in t.headers)c.startsWith(":")||(o[c]=t.headers[c]);}let a=n?zi():new AbortController;if(r?.once){let c=()=>{a.signal.aborted||(Object.defineProperty(s,"aborted",{value:true}),a.abort(r.errored??void 0));};r.once("error",c),r.once("close",c),r.once("finish",()=>{r.removeListener("close",c);});}if(t.method==="GET"||t.method==="HEAD")return new e.Request(i,{method:t.method,headers:o,signal:a.signal});let l=t.body;if(l!=null&&Object.keys(l).length>0){if(Ay(l))return new e.Request(i,{method:t.method||"GET",headers:o,body:l,signal:a.signal});let c=new e.Request(i,{method:t.method||"GET",headers:o,signal:a.signal});return c.headers.get("content-type")?.includes("json")||c.headers.set("content-type","application/json; charset=utf-8"),new Proxy(c,{get(u,h,d){switch(h){case "json":return ()=>N(l);case "text":return ()=>N(JSON.stringify(l));default:{let p=Reflect.get(c,h,c);return typeof p=="function"?function(...w){return p.apply(this===d?c:this,w)}:p}}}})}return new e.Request(i,{method:t.method,headers:o,signal:a.signal,body:s,duplex:"half"})}function hu(t){return t.read!=null}function du(t){return hu(t)}function Mi(t){return t!=null&&t.setHeader!=null&&t.end!=null&&t.once!=null&&t.write!=null}function Ry(t){return t!=null&&t.getReader!=null}function pu(t){return t!=null&&t.request!=null&&t.respondWith!=null}function Ly(t){t?.socket?.setTimeout?.(0),t?.socket?.setNoDelay?.(true),t?.socket?.setKeepAlive?.(true);}function ir(t){t.end(null,null,null);}function Oy(t,e){let r=false,n=()=>{r=true;};t.once("error",n),t.once("close",n),t.once("finish",()=>{t.removeListener("close",n),t.removeListener("error",n);});let s=e[Symbol.asyncIterator]();return mu(()=>s.next(),t,()=>r)}function cu(t){t.end(null,null,null);}function mu(t,e,r){let n=()=>A(t,s=>r?.()||s.done?cu(e):A(()=>yn(s.value,e),()=>r?.()?cu(e):n()));return n()}function yn(t,e){if(!e.write(t))return new Promise(n=>e.once("drain",n))}var Fy=globalThis.process?.versions?.node?.startsWith("1");function bu(t,e,r,n){if(e.closed||e.destroyed||e.writableEnded)return;if(!t){e.statusCode=404,ir(e);return}if(n&&t.headers?.headersInit&&!Array.isArray(t.headers.headersInit)&&!t.headers.headersInit.get&&!t.headers._map&&!t.headers._setCookies?.length)e.writeHead(t.status,t.statusText,t.headers.headersInit);else {if(e.setHeaders&&!Fy)e.setHeaders(t.headers);else {let o=false;t.headers.forEach((a,l)=>{if(l==="set-cookie"){if(o)return;o=true;let c=t.headers.getSetCookie?.();if(c){e.setHeader("set-cookie",c);return}}e.setHeader(l,a);});}e.writeHead(t.status,t.statusText);}if(t.bodyType==="String"){let o=t.bodyInit;return A(()=>yn(o,e),()=>ir(e))}let s=t._buffer;if(s)return A(()=>yn(s,e),()=>ir(e));let i=t.body;if(i==null){ir(e);return}if(i[Symbol.toStringTag]==="Uint8Array")return A(()=>yn(i,e),()=>ir(e));if(Ly(r),hu(i)){e.once("close",()=>{i.destroy();}),i.pipe(e,{end:true});return}if(Ry(i))return Iy(r,e,i);if(fu(i))return Oy(e,i)}function Iy(t,e,r){let n=r.getReader();return t?.once?.("error",s=>{n.cancel(s);}),mu(()=>n.read(),e)}function yu(t){return t!=null&&typeof t=="object"&&("body"in t||"cache"in t||"credentials"in t||"headers"in t||"integrity"in t||"keepalive"in t||"method"in t||"mode"in t||"redirect"in t||"referrer"in t||"referrerPolicy"in t||"signal"in t||"window"in t)}function ut(...t){let[e,...r]=t.filter(n=>n!=null&&typeof n=="object");return r.forEach(n=>{let s=Object.getOwnPropertyNames(n).reduce((i,o)=>(Object.getOwnPropertyDescriptor(n,o)&&(i[o]=Object.getOwnPropertyDescriptor(n,o)),i),{});Object.getOwnPropertySymbols(n).forEach(i=>{let o=Object.getOwnPropertyDescriptor(n,i);o?.enumerable&&(s[i]=o);}),Object.defineProperties(e,s);}),e}function $i(t,e){return new e(t.stack||t.message||t.toString(),{status:t.status||500})}function Ni(t,e){return t==null?e==null?{}:{waitUntil:e}:ut(Object.create(t),{waitUntil:e},t)}function Gi(t,e){if(e?.aborted)throw e.reason;if(G(t)&&e){let s=function(){n.reject(e.reason);};let n=Bt();return e.addEventListener("abort",s,{once:true}),t.then(function(o){n.resolve(o);}).catch(function(o){n.reject(o);}).finally(()=>{e.removeEventListener("abort",s);}),n.promise}return t}var Dy=["SIGINT","exit","SIGTERM"],gn=new Set,uu=false;function jy(){if(!uu){uu=true;for(let t of Dy)globalThis.process.once(t,function(){return Promise.allSettled([...gn].map(r=>!r.disposed&&r.disposeAsync()))});}}function gu(t){globalThis.process&&(jy(),gn.has(t)||(gn.add(t),t.defer(()=>{gn.delete(t);})));}var Ui=class extends EventTarget{aborted=false;_onabort=null;_reason;constructor(){super();let e=globalThis.process?.getBuiltinModule?.("node:events");e?.kMaxEventTargetListeners&&(this[e.kMaxEventTargetListeners]=0);}throwIfAborted(){if(this._nativeCtrl?.signal?.throwIfAborted)return this._nativeCtrl.signal.throwIfAborted();if(this.aborted)throw this._reason}_nativeCtrl;ensureNativeCtrl(){if(!this._nativeCtrl){let e=this.aborted;this._nativeCtrl=new AbortController,e&&this._nativeCtrl.abort(this._reason);}return this._nativeCtrl}abort(e){if(this._nativeCtrl?.abort)return this._nativeCtrl?.abort(e);this._reason=e||new DOMException("This operation was aborted","AbortError"),this.aborted=true,this.dispatchEvent(new Event("abort"));}get signal(){return this._nativeCtrl?.signal?this._nativeCtrl.signal:this}get reason(){return this._nativeCtrl?.signal?this._nativeCtrl.signal.reason:this._reason}get onabort(){return this._onabort?this._onabort:this._onabort}set onabort(e){if(this._nativeCtrl?.signal){this._nativeCtrl.signal.onabort=e;return}this._onabort&&this.removeEventListener("abort",this._onabort),this._onabort=e,e&&this.addEventListener("abort",e);}};function zi(){return globalThis.Bun||globalThis.Deno?new AbortController:new Proxy(new Ui,{get(t,e,r){if(e.toString().includes("kDependantSignals")){let n=t.ensureNativeCtrl();return Reflect.get(n.signal,e,n.signal)}return Reflect.get(t,e,r)},set(t,e,r,n){if(e.toString().includes("kDependantSignals")){let s=t.ensureNativeCtrl();return Reflect.set(s.signal,e,r,s.signal)}return Reflect.set(t,e,r,n)},getPrototypeOf(){return AbortSignal.prototype}})}g();function xu(t){return !!t.onData}function _u({req:t,res:e,fetchAPI:r,controller:n}){let s=t.getMethod(),i,o=[],a=[S=>{o.push(S);}],l=S=>{for(let v of a)v(S);},c=false,u=[()=>{c=true;}],h=()=>{for(let S of u)S();};e.onData(function(S,v){l(Buffer.from(Buffer.from(S,0,S.byteLength))),v&&h();});let d;if(s!=="get"&&s!=="head"){i="half",n.signal.addEventListener("abort",()=>{h();},{once:true});let S;d=()=>(S||(S=new r.ReadableStream({start(v){for(let O of o)v.enqueue(O);if(c){v.close();return}a.push(O=>{v.enqueue(O);}),u.push(()=>{if(n.signal.reason){v.error(n.signal.reason);return}v.desiredSize&&v.close();});}})),S);}let p=new r.Headers;t.forEach((S,v)=>{p.append(S,v);});let _=`http://localhost${t.getUrl()}`,w=t.getQuery();w&&(_+=`?${w}`);let R;function C(){return d?c?P():d():null}let I=new r.Request(_,{method:s,headers:p,get body(){return C()},signal:n.signal,duplex:i});function P(){return R||(R=o.length===1?o[0]:Buffer.concat(o)),R}function T(){return c?N(P()):new Promise((S,v)=>{try{u.push(()=>{S(P());});}catch(O){v(O);}})}return Object.defineProperties(I,{body:{get(){return C()},configurable:true,enumerable:true},json:{value(){return T().then(S=>S.toString("utf8")).then(S=>JSON.parse(S))},configurable:true,enumerable:true},text:{value(){return T().then(S=>S.toString("utf8"))},configurable:true,enumerable:true},arrayBuffer:{value(){return T()},configurable:true,enumerable:true}}),I}function qy(t,e){return new e.WritableStream({write(r){t.cork(()=>{t.write(r);});},close(){t.cork(()=>{t.end();});}})}function wu(t,e,r,n){if(!e){t.writeStatus("404 Not Found"),t.end();return}let s=e._buffer,i=e.bodyType==="String"?e.bodyInit:void 0;if(!r.signal.aborted&&(t.cork(()=>{t.writeStatus(`${e.status} ${e.statusText}`);let o=false;for(let[a,l]of e.headers)if(a!=="content-length"&&a!=="transfer-encoding"){if(a==="set-cookie"){if(o)continue;o=true;let c=e.headers.getSetCookie?.();if(c){for(let u of c)t.writeHeader(a,u);continue}}t.writeHeader(a,l);}i?t.end(i):s?t.end(s):e.body||t.end();}),!(i||s||!e.body)))return r.signal.addEventListener("abort",()=>{e.body?.locked||e.body?.cancel(r.signal.reason);},{once:true}),e.body.pipeTo(qy(t,n),{signal:r.signal}).catch(o=>{if(!r.signal.aborted)throw o})}function By(t){try{return !!t?.request}catch{return false}}var My={};function Su(t,e){let r=e?.__useSingleWriteHead==null?true:e.__useSingleWriteHead,n={...Uy,...e?.fetchAPI},s=e?.__useCustomAbortCtrl==null?n.Request!==globalThis.Request:e.__useCustomAbortCtrl,i=typeof t=="function"?t:t.handle,o=[],a=[],l,c=new Set,u;function h(){return u||(u=new pa,e?.disposeOnProcessTerminate&&gu(u),u.defer(()=>{if(c.size>0)return Promise.allSettled(c).then(()=>{c.clear();},()=>{c.clear();})})),u}function d(g){G(g)&&(h(),c.add(g),g.then(()=>{c.delete(g);},x=>{console.error(`Unexpected error while waiting: ${x.message||x}`),c.delete(g);}));}if(e?.plugins!=null)for(let g of e.plugins){g.instrumentation&&(l=l?gt(l,g.instrumentation):g.instrumentation),g.onRequest&&o.push(g.onRequest),g.onResponse&&a.push(g.onResponse);let x=g[H.dispose];x&&h().defer(x);let E=g[H.asyncDispose];E&&h().defer(E),g.onDispose&&h().defer(g.onDispose);}let p=o.length>0||a.length>0?function(x,E){let k=i,L;if(o.length===0)return W();let j=x.parsedUrl||new Proxy(My,{get($,J,ie){return j=new n.URL(x.url,"http://localhost"),Reflect.get(j,J,j)}});function M($){return a.length===0?$:A(()=>Q(a,J=>J({request:x,response:$,serverContext:E,setResponse(ie){$=ie;},fetchAPI:n})),()=>$)}function W(){return L?M(L):A(()=>k(x,E),M)}return A(()=>Q(o,($,J)=>$({request:x,setRequest(ie){x=ie;},serverContext:E,fetchAPI:n,url:j,requestHandler:k,setRequestHandler(ie){k=ie;},endResponse(ie){L=ie,ie&&J();}})),W)}:i;if(l?.request){let g=p;p=(x,E)=>tt({request:x}).asyncFn(l.request,g)(x,E);}function _(g,...x){let E=x.length>1?ut(...x):x[0]||{};E.waitUntil||(E.waitUntil=d);let k=Bi(g,n,void 0,s);return p(k,E)}function w(g,x,...E){let k=x.raw||x,L=E.length>1?ut(...E):E[0]||{};L.waitUntil||(L.waitUntil=d);let j=Bi(g,n,k,s);return p(j,L)}function R(g,x,...E){let k={req:g,res:x,waitUntil:d};return Mt(N().then(()=>w(g,x,k,...E)).catch(L=>$i(L,n.Response)).then(L=>bu(L,x,g,r)).catch(L=>console.error(`Unexpected error while handling request: ${L.message||L}`)))}function C(g,x,...E){let k={res:g,req:x,waitUntil:d},j=E.filter(ne=>ne!=null).length>0?ut(k,...E):k,M=s?zi():new AbortController,W=g.end.bind(g),$=false;g.end=function(ne){return $=true,W(ne)},g.onAborted.bind(g)(function(){M.abort();}),g.onAborted=function(ne){M.signal.addEventListener("abort",ne,{once:true});};let ie=_u({req:x,res:g,fetchAPI:n,controller:M});return A(()=>A(()=>p(ie,j),ne=>ne,ne=>$i(ne,n.Response)),ne=>{if(!M.signal.aborted&&!$)return A(()=>wu(g,ne,M,n),Ee=>Ee,Ee=>{console.error(`Unexpected error while handling request: ${Ee.message||Ee}`);})})}function I(g,...x){if(!g.respondWith||!g.request)throw new TypeError(`Expected FetchEvent, got ${g}`);let E=x.filter(j=>j!=null),k=E.length>0?ut({},g,...E):Ni(g),L=p(g.request,k);g.respondWith(L);}function P(g,...x){let E=x.filter(L=>L!=null),k=E.length>1?ut({},...E):Ni(E[0],E[0]==null||E[0].waitUntil==null?d:void 0);return p(g,k)}let T=(g,...x)=>{if(typeof g=="string"||"href"in g){let[k,...L]=x;if(yu(k)){let M=new n.Request(g,k),W=P(M,...L),$=k.signal;return $?Gi(W,$):W}let j=new n.Request(g);return P(j,...x)}let E=P(g,...x);return Gi(E,g.signal)},S=(g,...x)=>{let[E,...k]=x;if(du(g)){if(!Mi(E))throw new TypeError(`Expected ServerResponse, got ${E}`);return R(g,E,...k)}if(xu(g))return C(g,E,...k);if(Mi(E))throw new TypeError("Got Node response without Node request");return By(g)?pu(g)?I(g,...x):P(g.request,g,...x):T(g,...x)},v={handleRequest:P,fetch:T,handleNodeRequest:_,handleNodeRequestAndResponse:w,requestListener:R,handleEvent:I,handleUWS:C,handle:S,get disposableStack(){return h()},[H.asyncDispose](){return u&&!u.disposed?u.disposeAsync():N()},dispose(){return u&&!u.disposed?u.disposeAsync():N()},waitUntil:d},O=new Proxy(S,{has:(g,x)=>x in v||x in S||t&&x in t,get:(g,x)=>{if(globalThis.Deno||x===Symbol.asyncDispose||x===Symbol.dispose){let L=Reflect.get(v,x,v);if(L)return L}let E=v[x];if(E)return E.bind?E.bind(v):E;let k=S[x];if(k)return k.bind?k.bind(S):k;if(t){let L=t[x];if(L)return L.bind?function(...j){let M=t[x](...j);return M===t?O:M}:L}},apply(g,x,E){return S(...E)}});return O}g();function $y(t,e){let r=t.headers.get("origin");if(e===false||r==null)return null;let n={};if(e.origin==null||e.origin.length===0||e.origin.includes("*")?(n["Access-Control-Allow-Origin"]=r,n.Vary="Origin"):typeof e.origin=="string"?n["Access-Control-Allow-Origin"]=e.origin:Array.isArray(e.origin)&&(e.origin.length===1?n["Access-Control-Allow-Origin"]=e.origin[0]:e.origin.includes(r)?(n["Access-Control-Allow-Origin"]=r,n.Vary="Origin"):n["Access-Control-Allow-Origin"]="null"),e.methods?.length)n["Access-Control-Allow-Methods"]=e.methods.join(", ");else {let s=t.headers.get("access-control-request-method");s&&(n["Access-Control-Allow-Methods"]=s);}if(e.allowedHeaders?.length)n["Access-Control-Allow-Headers"]=e.allowedHeaders.join(", ");else {let s=t.headers.get("access-control-request-headers");s&&(n["Access-Control-Allow-Headers"]=s,n.Vary?n.Vary+=", Access-Control-Request-Headers":n.Vary="Access-Control-Request-Headers");}return e.credentials!=null?e.credentials===true&&(n["Access-Control-Allow-Credentials"]="true"):n["Access-Control-Allow-Origin"]!=="*"&&(n["Access-Control-Allow-Credentials"]="true"),e.exposedHeaders&&(n["Access-Control-Expose-Headers"]=e.exposedHeaders.join(", ")),e.maxAge&&(n["Access-Control-Max-Age"]=e.maxAge.toString()),n}function Ny(t,e,r){return A(()=>e(t,r),n=>$y(t,n))}function Eu(t){let e=()=>({});if(t!=null)if(typeof t=="function")e=t;else if(typeof t=="object"){let r={...t};e=()=>r;}else t===false&&(e=()=>false);return {onRequest({request:r,fetchAPI:n,endResponse:s}){if(r.method.toUpperCase()==="OPTIONS"){let i=new n.Response(null,{status:204,headers:{"Content-Length":"0"}});s(i);}},onResponse({request:r,serverContext:n,response:s}){return A(()=>Ny(r,e,n),i=>{if(i!=null)for(let o in i)s.headers.set(o,i[o]);})}}}g();g();var Gy=["message","locations","path","nodes","source","positions","originalError","name","stack","extensions","coordinate"];function zy(t){return t!=null&&typeof t=="object"&&Object.keys(t).every(e=>Gy.includes(e))}function B(t,e){e?.originalError&&!(e.originalError instanceof Error)&&zy(e.originalError)&&(e.originalError=B(e.originalError.message,e.originalError));let r=b$4,n=a$6.major>=16?new r(t,e):new r(t,e?.nodes,e?.source,e?.positions,e?.path,e?.originalError,e?.extensions);return e?.coordinate&&n.coordinate==null&&Object.defineProperties(n,{coordinate:{value:e.coordinate,enumerable:true,configurable:true}}),n}function xn(t){return t.coordinate}g();g();function Pu(t){return t?.[Symbol.asyncIterator]!=null}function Hy(t){return t!=null&&typeof t=="object"&&"errors"in t}function Vy(t){return t!=null&&typeof t.toString=="function"}function Le(t){return t instanceof b$4}function _n(t){return t instanceof b$4?t.originalError!=null?_n(t.originalError):true:false}function Hi(t){return typeof t=="object"&&t?.constructor?.name==="DOMException"&&(t.name==="AbortError"||t.name==="TimeoutError")}function Lt(t,e,r){let n=new Set;if(Hy(t))for(let s of t.errors){let i=Lt(s,e,r);for(let o of i)n.add(o);}else if(Hi(t))r.debug("Request aborted");else if(e){let s=e.maskError(t,e.errorMessage,e.isDev);s!==t&&r.error(t),n.add(Le(s)?s:B(s.message,{originalError:s}));}else Le(t)?n.add(t):t instanceof Error?n.add(B(t.message,{originalError:t})):typeof t=="string"?n.add(B(t,{extensions:{code:"INTERNAL_SERVER_ERROR",unexpected:true}})):Vy(t)?n.add(B(t.toString(),{extensions:{code:"INTERNAL_SERVER_ERROR",unexpected:true}})):(r.error(t),n.add(B("Unexpected error.",{extensions:{unexpected:true}})));return Array.from(n)}function Ot(t,e={},r=false){let n,s=false;if("extensions"in t&&t.extensions?.http&&(t.extensions.http.headers&&Object.assign(e,t.extensions.http.headers),t.extensions.http.status&&(n=t.extensions.http.status)),"errors"in t&&t.errors?.length)for(let i of t.errors)if(i.extensions?.http){if(i.extensions.http.headers&&Object.assign(e,i.extensions.http.headers),r&&i.extensions.http.spec)continue;i.extensions.http.status&&(!n||i.extensions.http.status>n)&&(n=i.extensions.http.status);}else (!_n(i)||i.extensions?.unexpected)&&(s=true);else n||=200;return n||(s&&!("data"in t)?n=500:n=200),{status:n,headers:e}}function vu(t){return Array.isArray(t)&&t.length>0&&t.some(Le)}g();function ku(t){return {onResponse({response:e}){Cu(e.headers,t);}}}function Tu(t){return {onRequest({request:e}){Cu(e.headers,t);}}}function Cu(t,e){for(let r of t.keys())e.includes(r)||t.delete(r);}g();var Lu=e$1(sr(),1);g();var Au=e$1(sr(),1);function Vi(t){let e=t.get("operationName")||void 0,r=t.get("query")||void 0,n=t.get("variables")||void 0,s=t.get("extensions")||void 0;return {operationName:e,query:r,variables:n?JSON.parse(n):void 0,extensions:s?JSON.parse(s):void 0}}function Ru(t){let e=new Au.URLSearchParams(t);return Vi(e)}function Be(t,e){let r=t.headers.get("content-type");return r=r?.split(",")[0]||null,r===e||!!r?.startsWith(`${e};`)}function Ou(t){return t.method==="GET"}function Fu(t){let e=t.url.substring(t.url.indexOf("?")+1),r=new Lu.URLSearchParams(e);return Vi(r)}g();function Iu(t){return t.method==="POST"&&Be(t,"application/x-www-form-urlencoded")}function Du(t){return t.text().then(Ru)}g();function ju(t){return t.method==="POST"&&Be(t,"application/graphql")}function qu(t){return t.text().then(e=>({query:e}))}g();function Uu(t){return t.method==="POST"&&(Be(t,"application/json")||Be(t,"application/graphql+json"))}function Bu(t){return A(()=>t.json(),e=>{if(e==null)throw B(`POST body is expected to be object but received ${e}`,{extensions:{http:{status:400},code:"BAD_REQUEST"}});let r=typeof e;if(r!=="object")throw B(`POST body is expected to be object but received ${r}`,{extensions:{http:{status:400},code:"BAD_REQUEST"}});return e},e=>{if(e instanceof b$4)throw e;let r={http:{spec:true,status:400},code:"BAD_REQUEST"};throw e instanceof Error&&(r.originalError={name:e.name,message:e.message}),B("POST body sent invalid JSON.",{extensions:r})})}g();function Mu(t){return t.method==="POST"&&Be(t,"multipart/form-data")}function $u(t){return A(()=>t.formData(),e=>{let r=e.get("operations");if(!r)throw B('Missing multipart form field "operations"');if(typeof r!="string")throw B('Multipart form field "operations" must be a string');let n;try{n=JSON.parse(r);}catch{throw B('Multipart form field "operations" must be a valid JSON string')}let s=e.get("map");if(s!=null){if(typeof s!="string")throw B('Multipart form field "map" must be a string');let i;try{i=JSON.parse(s);}catch{throw B('Multipart form field "map" must be a valid JSON string')}for(let o in i){let a=e.get(o),l=i[o];for(let c of l)Wy(n,c,a);}}return n},e=>{throw e instanceof Error&&e.message.startsWith("File size limit exceeded: ")?B(e.message,{extensions:{http:{status:413}}}):e})}function Wy(t,e,r){let n=e.split("."),s=t;for(let i=0;i<n.length;i++){let o=n[i];if(o==="__proto__"||o==="constructor"||o==="prototype")return;i===n.length-1?s[o]=r:(o in s||(s[o]={}),s=s[o]);}}g();var Ky=new Set(["query","variables","operationName","extensions"]);function Qy(t,e){if(t==null||typeof t!="object")throw B('Invalid "params" in the request body',{extensions:{http:{spec:true,status:400},code:"BAD_REQUEST"}});for(let r in t)if(t[r]!=null&&!Ky.has(r)){if(e?.includes(r))continue;throw B(`Unexpected parameter "${r}" in the request body.`,{extensions:{http:{status:400},code:"BAD_REQUEST"}})}}function Zy(t,e){if(!Jy(t))throw B(`Expected params to be an object but given ${or(t)}.`,{extensions:{http:{status:400,headers:{Allow:"GET, POST"}},code:"BAD_REQUEST"}});if(Qy(t,e),t.query==null)throw B("Must provide query string.",{extensions:{http:{spec:true,status:400,headers:{Allow:"GET, POST"}},code:"BAD_REQUEST"}});let r=or(t.query);if(r!=="string")throw B(`Expected "query" param to be a string, but given ${r}.`,{extensions:{http:{status:400,headers:{Allow:"GET, POST"}},code:"BAD_REQUEST"}});let n=or(t.variables);if(!["object","null","undefined"].includes(n))throw B(`Expected "variables" param to be empty or an object, but given ${n}.`,{extensions:{http:{status:400,headers:{Allow:"GET, POST"}},code:"BAD_REQUEST"}});let s=or(t.extensions);if(!["object","null","undefined"].includes(s))throw B(`Expected "extensions" param to be empty or an object, but given ${s}.`,{extensions:{http:{status:400,headers:{Allow:"GET, POST"}},code:"BAD_REQUEST"}});return t}function Nu(t){return {onParams({params:e}){Zy(e,t);}}}function or(t){return t===null?"null":Array.isArray(t)?"array":typeof t}function Jy(t){return or(t)==="object"}g();function Yy(t){return t==="GET"||t==="POST"}function Gu(){return {onRequestParse({request:t}){if(!Yy(t.method))throw B("GraphQL only supports GET and POST requests.",{extensions:{http:{status:405,headers:{Allow:"GET, POST"}},code:"BAD_REQUEST"}})}}}g();function zu(){return {onValidate(){return ({valid:t,result:e})=>{if(!t)for(let r of e)r.extensions||={},r.extensions.code||="GRAPHQL_VALIDATION_FAILED",r.extensions.http||={},r.extensions.http.spec=r.extensions.http.spec==null?true:r.extensions.http.spec,r.extensions.http.status||=400;}}}}g();function Hu(t){return {onRequestParse(){return {onRequestParseDone({requestParserResult:e}){if(Array.isArray(e)){if(!t)throw B("Batching is not supported.",{extensions:{http:{status:400},code:"BAD_REQUEST"}});if(e.length>t)throw B(`Batching is limited to ${t} operations per request.`,{extensions:{http:{status:413},code:"BAD_REQUEST"}})}}}}}}g();function Xy(t,e,r){let n=e?F$2(e,r)??void 0:void 0;if(!n)throw B("Could not determine what operation to execute.",{extensions:{code:"OPERATION_RESOLUTION_FAILURE",http:{status:400}}});if(n.operation==="mutation"&&t==="GET")throw B("Can only perform a mutation operation from a POST request.",{extensions:{http:{status:405,headers:{Allow:"POST"}},code:"BAD_REQUEST"}})}function Vu(){return {onParse(){return ({result:t,context:{request:e,params:{operationName:r}={}}})=>{if(e)if(t instanceof Error){if(t instanceof b$4){let n=t.extensions||={};n.code||="GRAPHQL_PARSE_FAILED";let s=n.http||={};s.spec||=true,s.status||=400;}}else Xy(e.method,t,r);}}}}g();function Wu({id:t=Date.now().toString(),logger:e=console,endpoint:r="/health"}={}){return {onRequest({endResponse:n,fetchAPI:s,request:i}){if(i.url.endsWith(r)){e.debug("Responding Health Check");let o=new s.Response(null,{status:200,headers:{"x-yoga-id":t}});n(o);}}}}g();g();g();var Ft=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Qu=new Set,Wi=typeof process=="object"&&process?process:{},Zu=(t,e,r,n)=>{typeof Wi.emitWarning=="function"?Wi.emitWarning(t,e,r,n):console.error(`[${r}] ${e}: ${t}`);},wn=globalThis.AbortController,Ku=globalThis.AbortSignal;if(typeof wn>"u"){Ku=class{onabort;_onabort=[];reason;aborted=false;addEventListener(n,s){this._onabort.push(s);}},wn=class{constructor(){e();}signal=new Ku;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=true;for(let s of this.signal._onabort)s(n);this.signal.onabort?.(n);}}};let t=Wi.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=false,Zu("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e));};}var eg=t=>!Qu.has(t);var Ze=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),Ju=t=>Ze(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?It:null:null,It=class extends Array{constructor(e){super(e),this.fill(0);}},Ki=class t{heap;length;static#o=false;static create(e){let r=Ju(e);if(!r)return [];t.#o=true;let n=new t(e,r);return t.#o=false,n}constructor(e,r){if(!t.#o)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},Sn=class t{#o;#r;#n;#t;#p;#w;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#s;#y;#l;#i;#e;#m;#b;#f;#u;#c;#h;#E;#g;#x;#P;#v;#d;static unsafeExposeInternals(e){return {starts:e.#g,ttls:e.#x,sizes:e.#E,keyMap:e.#l,keyList:e.#i,valList:e.#e,next:e.#m,prev:e.#b,get head(){return e.#f},get tail(){return e.#u},free:e.#c,isBackgroundFetch:r=>e.#a(r),backgroundFetch:(r,n,s,i)=>e.#q(r,n,s,i),moveToTail:r=>e.#I(r),indexes:r=>e.#C(r),rindexes:r=>e.#A(r),isStale:r=>e.#_(r)}}get max(){return this.#o}get maxSize(){return this.#r}get calculatedSize(){return this.#y}get size(){return this.#s}get fetchMethod(){return this.#p}get memoMethod(){return this.#w}get dispose(){return this.#n}get disposeAfter(){return this.#t}constructor(e){let{max:r=0,ttl:n,ttlResolution:s=1,ttlAutopurge:i,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:l,dispose:c,disposeAfter:u,noDisposeOnSet:h,noUpdateTTL:d,maxSize:p=0,maxEntrySize:_=0,sizeCalculation:w,fetchMethod:R,memoMethod:C,noDeleteOnFetchRejection:I,noDeleteOnStaleGet:P,allowStaleOnFetchRejection:T,allowStaleOnFetchAbort:S,ignoreFetchAbort:v}=e;if(r!==0&&!Ze(r))throw new TypeError("max option must be a nonnegative integer");let O=r?Ju(r):Array;if(!O)throw new Error("invalid max value: "+r);if(this.#o=r,this.#r=p,this.maxEntrySize=_||this.#r,this.sizeCalculation=w,this.sizeCalculation){if(!this.#r&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(C!==void 0&&typeof C!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#w=C,R!==void 0&&typeof R!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#p=R,this.#v=!!R,this.#l=new Map,this.#i=new Array(r).fill(void 0),this.#e=new Array(r).fill(void 0),this.#m=new O(r),this.#b=new O(r),this.#f=0,this.#u=0,this.#c=Ki.create(r),this.#s=0,this.#y=0,typeof c=="function"&&(this.#n=c),typeof u=="function"?(this.#t=u,this.#h=[]):(this.#t=void 0,this.#h=void 0),this.#P=!!this.#n,this.#d=!!this.#t,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!I,this.allowStaleOnFetchRejection=!!T,this.allowStaleOnFetchAbort=!!S,this.ignoreFetchAbort=!!v,this.maxEntrySize!==0){if(this.#r!==0&&!Ze(this.#r))throw new TypeError("maxSize must be a positive integer if specified");if(!Ze(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#S();}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!P,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=Ze(s)||s===0?s:1,this.ttlAutopurge=!!i,this.ttl=n||0,this.ttl){if(!Ze(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#k();}if(this.#o===0&&this.ttl===0&&this.#r===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#o&&!this.#r){let g="LRU_CACHE_UNBOUNDED";eg(g)&&(Qu.add(g),Zu("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",g,t));}}getRemainingTTL(e){return this.#l.has(e)?1/0:0}#k(){let e=new It(this.#o),r=new It(this.#o);this.#x=e,this.#g=r,this.#F=(i,o,a=Ft.now())=>{if(r[i]=o!==0?a:0,e[i]=o,o!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#_(i)&&this.#R(this.#i[i],"expire");},o+1);l.unref&&l.unref();}},this.#L=i=>{r[i]=e[i]!==0?Ft.now():0;},this.#T=(i,o)=>{if(e[o]){let a=e[o],l=r[o];if(!a||!l)return;i.ttl=a,i.start=l,i.now=n||s();let c=i.now-l;i.remainingTTL=a-c;}};let n=0,s=()=>{let i=Ft.now();if(this.ttlResolution>0){n=i;let o=setTimeout(()=>n=0,this.ttlResolution);o.unref&&o.unref();}return i};this.getRemainingTTL=i=>{let o=this.#l.get(i);if(o===void 0)return 0;let a=e[o],l=r[o];if(!a||!l)return 1/0;let c=(n||s())-l;return a-c},this.#_=i=>{let o=r[i],a=e[i];return !!a&&!!o&&(n||s())-o>a};}#L=()=>{};#T=()=>{};#F=()=>{};#_=()=>false;#S(){let e=new It(this.#o);this.#y=0,this.#E=e,this.#O=r=>{this.#y-=e[r],e[r]=0;},this.#U=(r,n,s,i)=>{if(this.#a(n))return 0;if(!Ze(s))if(i){if(typeof i!="function")throw new TypeError("sizeCalculation must be a function");if(s=i(n,r),!Ze(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s},this.#D=(r,n,s)=>{if(e[r]=n,this.#r){let i=this.#r-e[r];for(;this.#y>i;)this.#j(true);}this.#y+=e[r],s&&(s.entrySize=n,s.totalCalculatedSize=this.#y);};}#O=e=>{};#D=(e,r,n)=>{};#U=(e,r,n,s)=>{if(n||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#C({allowStale:e=this.allowStale}={}){if(this.#s)for(let r=this.#u;!(!this.#B(r)||((e||!this.#_(r))&&(yield r),r===this.#f));)r=this.#b[r];}*#A({allowStale:e=this.allowStale}={}){if(this.#s)for(let r=this.#f;!(!this.#B(r)||((e||!this.#_(r))&&(yield r),r===this.#u));)r=this.#m[r];}#B(e){return e!==void 0&&this.#l.get(this.#i[e])===e}*entries(){for(let e of this.#C())this.#e[e]!==void 0&&this.#i[e]!==void 0&&!this.#a(this.#e[e])&&(yield [this.#i[e],this.#e[e]]);}*rentries(){for(let e of this.#A())this.#e[e]!==void 0&&this.#i[e]!==void 0&&!this.#a(this.#e[e])&&(yield [this.#i[e],this.#e[e]]);}*keys(){for(let e of this.#C()){let r=this.#i[e];r!==void 0&&!this.#a(this.#e[e])&&(yield r);}}*rkeys(){for(let e of this.#A()){let r=this.#i[e];r!==void 0&&!this.#a(this.#e[e])&&(yield r);}}*values(){for(let e of this.#C())this.#e[e]!==void 0&&!this.#a(this.#e[e])&&(yield this.#e[e]);}*rvalues(){for(let e of this.#A())this.#e[e]!==void 0&&!this.#a(this.#e[e])&&(yield this.#e[e]);}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,r={}){for(let n of this.#C()){let s=this.#e[n],i=this.#a(s)?s.__staleWhileFetching:s;if(i!==void 0&&e(i,this.#i[n],this))return this.get(this.#i[n],r)}}forEach(e,r=this){for(let n of this.#C()){let s=this.#e[n],i=this.#a(s)?s.__staleWhileFetching:s;i!==void 0&&e.call(r,i,this.#i[n],this);}}rforEach(e,r=this){for(let n of this.#A()){let s=this.#e[n],i=this.#a(s)?s.__staleWhileFetching:s;i!==void 0&&e.call(r,i,this.#i[n],this);}}purgeStale(){let e=false;for(let r of this.#A({allowStale:true}))this.#_(r)&&(this.#R(this.#i[r],"expire"),e=true);return e}info(e){let r=this.#l.get(e);if(r===void 0)return;let n=this.#e[r],s=this.#a(n)?n.__staleWhileFetching:n;if(s===void 0)return;let i={value:s};if(this.#x&&this.#g){let o=this.#x[r],a=this.#g[r];if(o&&a){let l=o-(Ft.now()-a);i.ttl=l,i.start=Date.now();}}return this.#E&&(i.size=this.#E[r]),i}dump(){let e=[];for(let r of this.#C({allowStale:true})){let n=this.#i[r],s=this.#e[r],i=this.#a(s)?s.__staleWhileFetching:s;if(i===void 0||n===void 0)continue;let o={value:i};if(this.#x&&this.#g){o.ttl=this.#x[r];let a=Ft.now()-this.#g[r];o.start=Math.floor(Date.now()-a);}this.#E&&(o.size=this.#E[r]),e.unshift([n,o]);}return e}load(e){this.clear();for(let[r,n]of e){if(n.start){let s=Date.now()-n.start;n.start=Ft.now()-s;}this.set(r,n.value,n);}}set(e,r,n={}){if(r===void 0)return this.delete(e),this;let{ttl:s=this.ttl,start:i,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:l}=n,{noUpdateTTL:c=this.noUpdateTTL}=n,u=this.#U(e,r,n.size||0,a);if(this.maxEntrySize&&u>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=true),this.#R(e,"set"),this;let h=this.#s===0?void 0:this.#l.get(e);if(h===void 0)h=this.#s===0?this.#u:this.#c.length!==0?this.#c.pop():this.#s===this.#o?this.#j(false):this.#s,this.#i[h]=e,this.#e[h]=r,this.#l.set(e,h),this.#m[this.#u]=h,this.#b[h]=this.#u,this.#u=h,this.#s++,this.#D(h,u,l),l&&(l.set="add"),c=false;else {this.#I(h);let d=this.#e[h];if(r!==d){if(this.#v&&this.#a(d)){d.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=d;p!==void 0&&!o&&(this.#P&&this.#n?.(p,e,"set"),this.#d&&this.#h?.push([p,e,"set"]));}else o||(this.#P&&this.#n?.(d,e,"set"),this.#d&&this.#h?.push([d,e,"set"]));if(this.#O(h),this.#D(h,u,l),this.#e[h]=r,l){l.set="replace";let p=d&&this.#a(d)?d.__staleWhileFetching:d;p!==void 0&&(l.oldValue=p);}}else l&&(l.set="update");}if(s!==0&&!this.#x&&this.#k(),this.#x&&(c||this.#F(h,s,i),l&&this.#T(l,h)),!o&&this.#d&&this.#h){let d=this.#h,p;for(;p=d?.shift();)this.#t?.(...p);}return this}pop(){try{for(;this.#s;){let e=this.#e[this.#f];if(this.#j(!0),this.#a(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#d&&this.#h){let e=this.#h,r;for(;r=e?.shift();)this.#t?.(...r);}}}#j(e){let r=this.#f,n=this.#i[r],s=this.#e[r];return this.#v&&this.#a(s)?s.__abortController.abort(new Error("evicted")):(this.#P||this.#d)&&(this.#P&&this.#n?.(s,n,"evict"),this.#d&&this.#h?.push([s,n,"evict"])),this.#O(r),e&&(this.#i[r]=void 0,this.#e[r]=void 0,this.#c.push(r)),this.#s===1?(this.#f=this.#u=0,this.#c.length=0):this.#f=this.#m[r],this.#l.delete(n),this.#s--,r}has(e,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:s}=r,i=this.#l.get(e);if(i!==void 0){let o=this.#e[i];if(this.#a(o)&&o.__staleWhileFetching===void 0)return false;if(this.#_(i))s&&(s.has="stale",this.#T(s,i));else return n&&this.#L(i),s&&(s.has="hit",this.#T(s,i)),true}else s&&(s.has="miss");return false}peek(e,r={}){let{allowStale:n=this.allowStale}=r,s=this.#l.get(e);if(s===void 0||!n&&this.#_(s))return;let i=this.#e[s];return this.#a(i)?i.__staleWhileFetching:i}#q(e,r,n,s){let i=r===void 0?void 0:this.#e[r];if(this.#a(i))return i;let o=new wn,{signal:a}=n;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let l={signal:o.signal,options:n,context:s},c=(w,R=false)=>{let{aborted:C}=o.signal,I=n.ignoreFetchAbort&&w!==void 0;if(n.status&&(C&&!R?(n.status.fetchAborted=true,n.status.fetchError=o.signal.reason,I&&(n.status.fetchAbortIgnored=true)):n.status.fetchResolved=true),C&&!I&&!R)return h(o.signal.reason);let P=p;return this.#e[r]===p&&(w===void 0?P.__staleWhileFetching?this.#e[r]=P.__staleWhileFetching:this.#R(e,"fetch"):(n.status&&(n.status.fetchUpdated=true),this.set(e,w,l.options))),w},u=w=>(n.status&&(n.status.fetchRejected=true,n.status.fetchError=w),h(w)),h=w=>{let{aborted:R}=o.signal,C=R&&n.allowStaleOnFetchAbort,I=C||n.allowStaleOnFetchRejection,P=I||n.noDeleteOnFetchRejection,T=p;if(this.#e[r]===p&&(!P||T.__staleWhileFetching===void 0?this.#R(e,"fetch"):C||(this.#e[r]=T.__staleWhileFetching)),I)return n.status&&T.__staleWhileFetching!==void 0&&(n.status.returnedStale=true),T.__staleWhileFetching;if(T.__returned===T)throw w},d=(w,R)=>{let C=this.#p?.(e,i,l);C&&C instanceof Promise&&C.then(I=>w(I===void 0?void 0:I),R),o.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(w(void 0),n.allowStaleOnFetchAbort&&(w=I=>c(I,true)));});};n.status&&(n.status.fetchDispatched=true);let p=new Promise(d).then(c,u),_=Object.assign(p,{__abortController:o,__staleWhileFetching:i,__returned:void 0});return r===void 0?(this.set(e,_,{...l.options,status:void 0}),r=this.#l.get(e)):this.#e[r]=_,_}#a(e){if(!this.#v)return false;let r=e;return !!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof wn}async fetch(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:l=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:h=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:_=this.allowStaleOnFetchAbort,context:w,forceRefresh:R=false,status:C,signal:I}=r;if(!this.#v)return C&&(C.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:i,status:C});let P={allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:i,ttl:o,noDisposeOnSet:a,size:l,sizeCalculation:c,noUpdateTTL:u,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:_,ignoreFetchAbort:p,status:C,signal:I},T=this.#l.get(e);if(T===void 0){C&&(C.fetch="miss");let S=this.#q(e,T,P,w);return S.__returned=S}else {let S=this.#e[T];if(this.#a(S)){let E=n&&S.__staleWhileFetching!==void 0;return C&&(C.fetch="inflight",E&&(C.returnedStale=true)),E?S.__staleWhileFetching:S.__returned=S}let v=this.#_(T);if(!R&&!v)return C&&(C.fetch="hit"),this.#I(T),s&&this.#L(T),C&&this.#T(C,T),S;let O=this.#q(e,T,P,w),x=O.__staleWhileFetching!==void 0&&n;return C&&(C.fetch=v?"stale":"refresh",x&&v&&(C.returnedStale=true)),x?O.__staleWhileFetching:O.__returned=O}}async forceFetch(e,r={}){let n=await this.fetch(e,r);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(e,r={}){let n=this.#w;if(!n)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:i,...o}=r,a=this.get(e,o);if(!i&&a!==void 0)return a;let l=n(e,a,{options:o,context:s});return this.set(e,l,o),l}get(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:o}=r,a=this.#l.get(e);if(a!==void 0){let l=this.#e[a],c=this.#a(l);return o&&this.#T(o,a),this.#_(a)?(o&&(o.get="stale"),c?(o&&n&&l.__staleWhileFetching!==void 0&&(o.returnedStale=true),n?l.__staleWhileFetching:void 0):(i||this.#R(e,"expire"),o&&n&&(o.returnedStale=true),n?l:void 0)):(o&&(o.get="hit"),c?l.__staleWhileFetching:(this.#I(a),s&&this.#L(a),l))}else o&&(o.get="miss");}#M(e,r){this.#b[r]=e,this.#m[e]=r;}#I(e){e!==this.#u&&(e===this.#f?this.#f=this.#m[e]:this.#M(this.#b[e],this.#m[e]),this.#M(this.#u,e),this.#u=e);}delete(e){return this.#R(e,"delete")}#R(e,r){let n=false;if(this.#s!==0){let s=this.#l.get(e);if(s!==void 0)if(n=true,this.#s===1)this.#$(r);else {this.#O(s);let i=this.#e[s];if(this.#a(i)?i.__abortController.abort(new Error("deleted")):(this.#P||this.#d)&&(this.#P&&this.#n?.(i,e,r),this.#d&&this.#h?.push([i,e,r])),this.#l.delete(e),this.#i[s]=void 0,this.#e[s]=void 0,s===this.#u)this.#u=this.#b[s];else if(s===this.#f)this.#f=this.#m[s];else {let o=this.#b[s];this.#m[o]=this.#m[s];let a=this.#m[s];this.#b[a]=this.#b[s];}this.#s--,this.#c.push(s);}}if(this.#d&&this.#h?.length){let s=this.#h,i;for(;i=s?.shift();)this.#t?.(...i);}return n}clear(){return this.#$("delete")}#$(e){for(let r of this.#A({allowStale:true})){let n=this.#e[r];if(this.#a(n))n.__abortController.abort(new Error("deleted"));else {let s=this.#i[r];this.#P&&this.#n?.(n,s,e),this.#d&&this.#h?.push([n,s,e]);}}if(this.#l.clear(),this.#e.fill(void 0),this.#i.fill(void 0),this.#x&&this.#g&&(this.#x.fill(0),this.#g.fill(0)),this.#E&&this.#E.fill(0),this.#f=0,this.#u=0,this.#c.length=0,this.#y=0,this.#s=0,this.#d&&this.#h){let r=this.#h,n;for(;n=r?.shift();)this.#t?.(...n);}}};var tg=1024,rg=36e5;function En({max:t=tg,ttl:e=rg}={}){return new Sn({max:t,ttl:e})}function Yu({documentCache:t=En(),errorCache:e=En(),validationCache:r=true}){let n=En();return {onParse({params:s,setParsedDocument:i}){let o=s.source.toString(),a=t.get(o);if(a){i(a);return}let l=e.get(o);if(l)throw l;return ({result:c})=>{c!=null&&(c instanceof Error?e.set(o,c):t.set(o,c));}},onValidate({params:{schema:s,documentAST:i,rules:o},setResult:a}){if(s!=null&&r!==false){let l=o?.map(d=>d.name).join(",")||"",c=n.get(l);c||(c=new WeakMap,n.set(l,c));let u=c.get(s);u||(u=new WeakMap,c.set(s,u));let h=u.get(i);if(h){a(h);return}return ({result:d})=>{d!=null&&u?.set(i,d);}}}}}g();var ng=()=>true;function Dt(t){let e=t.match||ng;return {onRequestParse({request:r,setRequestParser:n}){e(r)&&n(t.parse);}}}g();g();function Xu(t){let e=(t.headers.get("accept")||"*/*").replace(/\s/g,"").toLowerCase().split(","),r=[];for(let n of e){let[s,...i]=n.split(";");s===void 0||(i?.find(a=>a.includes("charset="))||"charset=utf-8")!=="charset=utf-8"||r.push(s);}return r.reverse()}function ef(t,e){let[r,n]=t.split("/"),[s,i]=e.split("/");return (s==="*"||s===r)&&(i==="*"||i===n)}g();g();function jt(t){if(Array.isArray(t))return `[${t.map(n=>{let s=tf(n);return (n.stringify||JSON.stringify)(s)}).join(",")}]`;let e=tf(t);return (t.stringify||JSON.stringify)(e)}function tf(t){if(t.errors?.length||t.extensions?.http){let e={...t};if(e.errors&&=e.errors.map(rf),e.extensions){let{http:r,...n}=t.extensions;e.extensions=Object.keys(n).length?n:void 0;}return e}return t}function rf(t){if(Le(t)){let e="toJSON"in t&&typeof t.toJSON=="function"?t.toJSON():Object(t),{http:r,unexpected:n,...s}=e.extensions||{};return B(t.message,{nodes:t.nodes,source:t.source,positions:t.positions,path:t.path,originalError:rf(t.originalError||void 0),extensions:Object.keys(s).length?s:void 0,coordinate:xn(t)})}return t}function nf(t,e){let n=Ot(t,{Connection:"keep-alive","Content-Type":'multipart/mixed; boundary="-"',"Transfer-Encoding":"chunked"}),s,i=new e.TextEncoder,o=new e.ReadableStream({start(a){if(ce(t))s=t[Symbol.asyncIterator]();else {let l=false;s={next:()=>l?N({done:true,value:null}):(l=true,N({done:false,value:t}))};}a.enqueue(i.encode(`\r
|
|
24
24
|
`)),a.enqueue(i.encode("---"));},pull(a){return A(()=>s.next(),({done:l,value:c})=>{if(c!=null){a.enqueue(i.encode(`\r
|
|
25
25
|
`)),a.enqueue(i.encode("Content-Type: application/json; charset=utf-8")),a.enqueue(i.encode(`\r
|
|
26
26
|
`));let u=jt(c),h=i.encode(u);a.enqueue(i.encode("Content-Length: "+h.byteLength)),a.enqueue(i.encode(`\r
|
|
@@ -53,5 +53,5 @@ const yoga = createYoga({
|
|
|
53
53
|
graphqlEndpoint: '__REQUEST_PATH__',
|
|
54
54
|
})
|
|
55
55
|
</code>
|
|
56
|
-
</pre></section></main></body></html>`;var og=function(e){return new e.fetchAPI.Response(cf.replace(/__GRAPHIQL_LINK__/g,e.graphqlEndpoint).replace(/__REQUEST_PATH__/g,e.url.pathname),{status:200,statusText:"OK",headers:{"Content-Type":"text/html"}})};function uf(t){let e=t.landingPageRenderer||og;return {onRequest({request:r,fetchAPI:n,endResponse:s,url:i}){let o=t.getGraphQLEndpoint();if(!r.url.endsWith(o)&&!r.url.endsWith(`${o}/`)&&i.pathname!==o&&i.pathname!==`${o}/`&&!t.getGraphQLEndpointURLPattern().test(i)){if(t.showLandingPage===true&&r.method==="GET"&&r.headers?.get("accept")?.includes("text/html")){let a=e({request:r,fetchAPI:n,url:i,graphqlEndpoint:o,get urlPattern(){return t.getGraphQLEndpointURLPattern()}});if(G(a))return a.then(s);s(a);return}s(new n.Response("",{status:404,statusText:"Not Found"}));}}}}g();function Pn({request:t,result:e,fetchAPI:r,onResultProcessHooks:n,serverContext:s}){let i,o=[],a="*/*";return A(()=>Q(n,l=>l({request:t,acceptableMediaTypes:o,result:e,setResult(c){e=c;},resultProcessor:i,setResultProcessor(c,u){i=c,a=u;},serverContext:s})),()=>i?i(e,r,a):new r.Response(null,{status:406,statusText:"Not Acceptable",headers:{accept:o.join("; charset=utf-8, ")}}))}function ff({params:t,enveloped:e}){let r=e.parse(t.query),n=e.validate(e.schema,r);return n.length>0?{errors:n}:A(()=>e.contextFactory(),s=>{let i={schema:e.schema,document:r,contextValue:s,variableValues:t.variables,operationName:t.operationName};return (F$2(r,t.operationName)?.operation==="subscription"?e.subscribe:e.execute)(i)})}g();function hf(t){return t?.status&&t?.headers}g();function df(t){return Le(t)?t.toJSON():t instanceof Error?{message:t.message,stack:t.stack,cause:t.cause}:t}var pf=(t,e,r=globalThis.process?.env?.NODE_ENV==="development")=>{if(_n(t))return t;let n={code:"INTERNAL_SERVER_ERROR",unexpected:true},s={extensions:n};return Le(t)?(s.nodes=t.nodes,s.source=t.source,s.positions=t.positions,s.path=t.path,s.coordinate=xn(t),r&&t.originalError&&(n.originalError=df(t.originalError)),t.extensions?.http&&(n.http=t.extensions.http)):r&&(n.originalError=df(t)),B(e,s)};var Qi=class{getEnveloped;logger;fetchAPI;plugins;instrumentation;onRequestParseHooks;onParamsHooks;onExecutionResultHooks;onResultProcessHooks;maskedErrorsOpts;id;_graphqlEndpoint;_graphqlEndpointURLPattern;version="5.21.2";constructor(e){if(this.id=e?.id??"yoga",this.fetchAPI={...ag},e?.fetchAPI)for(let a in e.fetchAPI)e.fetchAPI[a]&&(this.fetchAPI[a]=e.fetchAPI[a]);let r=e?.logging==null?true:e.logging;this.logger=typeof r=="boolean"?r===true?_r():_r("silent"):typeof r=="string"?_r(r):r;let n=typeof e?.maskedErrors=="object"&&e.maskedErrors.maskError||pf,s=new WeakSet;this.maskedErrorsOpts=e?.maskedErrors===false?null:{errorMessage:"Unexpected error.",...typeof e?.maskedErrors=="object"?e.maskedErrors:{},maskError:(a,l)=>{if(s.has(a))return a;let c=n(a,l,this.maskedErrorsOpts?.isDev);return c!==a&&this.logger.error(a),s.add(c),c}};let i=this.maskedErrorsOpts==null?null:this.maskedErrorsOpts,o=0;e?.batching&&(typeof e.batching=="boolean"?o=10:o=e.batching.limit??10),this.graphqlEndpoint=e?.graphqlEndpoint||"/graphql",this.plugins=[ha({parse:e$3,validate:D$1,execute:Rr,subscribe:Rr,specifiedRules:C$1}),!!e?.schema&&zo(e.schema),e?.allowedHeaders?.request!=null&&Tu(e.allowedHeaders.request),e?.context!=null&&fa(a=>e?.context?typeof e.context=="function"?e.context(a):e.context:{}),Wu({id:this.id,logger:this.logger,endpoint:e?.healthCheckEndpoint}),e?.cors!==false&&Eu(e?.cors),e?.graphiql!==false&&Go({getGraphQLEndpoint:()=>this._graphqlEndpoint,getGraphQLEndpointURLPattern:()=>this.getUrlPatternForGraphQLEndpoint(),options:e?.graphiql,render:e?.renderGraphiQL,logger:this.logger}),Dt({match:Ou,parse:Fu}),Dt({match:Uu,parse:Bu}),e?.multipart!==false&&Dt({match:Mu,parse:$u}),Dt({match:ju,parse:qu}),Dt({match:Iu,parse:Du}),lf(),...e?.plugins??[],e?.parserAndValidationCache!==false&&Yu(!e?.parserAndValidationCache||e?.parserAndValidationCache===true?{}:e?.parserAndValidationCache),Hu(o),Nu(e?.extraParamNames),uf({getGraphQLEndpoint:()=>this.graphqlEndpoint,getGraphQLEndpointURLPattern:()=>this.getUrlPatternForGraphQLEndpoint(),showLandingPage:e?.landingPage!==false,landingPageRenderer:typeof e?.landingPage=="function"?e.landingPage:void 0}),Gu(),Vu(),i!==null&&{onSubscribe(){return {onSubscribeError({error:a}){if(Hi(a))throw a}}}},i!==null&&ua(i),e?.allowedHeaders?.response!=null&&ku(e.allowedHeaders.response),zu()],this.getEnveloped=la({plugins:this.plugins}),this.plugins=this.getEnveloped._plugins,this.onRequestParseHooks=[],this.onParamsHooks=[],this.onExecutionResultHooks=[],this.onResultProcessHooks=[];for(let a of this.plugins)a&&(a.onYogaInit&&a.onYogaInit({yoga:this}),a.onRequestParse&&this.onRequestParseHooks.push(a.onRequestParse),a.onParams&&this.onParamsHooks.push(a.onParams),a.onExecutionResult&&this.onExecutionResultHooks.push(a.onExecutionResult),a.onResultProcess&&this.onResultProcessHooks.push(a.onResultProcess),a.instrumentation&&(this.instrumentation=this.instrumentation?gt(this.instrumentation,a.instrumentation):a.instrumentation));}get graphqlEndpoint(){return this._graphqlEndpoint}set graphqlEndpoint(e){this._graphqlEndpoint=e,this._graphqlEndpointURLPattern=void 0;}getUrlPatternForGraphQLEndpoint(){return this._graphqlEndpointURLPattern??=new this.fetchAPI.URLPattern({pathname:this._graphqlEndpoint}),this._graphqlEndpointURLPattern}handleParams=({request:e,context:r,params:n})=>{let s=r.request===e?{params:n}:{request:e,params:n};Object.assign(r,s);let i=this.getEnveloped(r);return this.logger.debug("Processing GraphQL Parameters"),A(()=>A(()=>ff({params:n,enveloped:i}),o=>(this.logger.debug("Processing GraphQL Parameters done."),o),o=>({errors:Lt(o,this.maskedErrorsOpts,this.logger)})),o=>(ce(o)&&(o=Ie(o,a=>a,a=>{if(a.name==="AbortError")throw this.logger.debug("Request aborted"),a;return {errors:Lt(a,this.maskedErrorsOpts,this.logger)}})),o))};getResultForParams=({params:e,request:r},n)=>{let s,i=this.handleParams;return A(()=>Q(this.onParamsHooks,o=>o({params:e,request:r,setParams(a){e=a;},paramsHandler:i,setParamsHandler(a){i=a;},setResult(a){s=a;},fetchAPI:this.fetchAPI,context:n})),()=>A(()=>s||i({request:r,params:e,context:n}),o=>A(()=>Q(this.onExecutionResultHooks,a=>a({result:o,setResult(l){o=l;},request:r,context:n})),()=>o)))};parseRequest=(e,r)=>{let n=new Proxy({},{get:(a,l,c)=>(n=new this.fetchAPI.URL(e.url,"http://localhost"),Reflect.get(n,l,n))}),s,i,o=[];return A(()=>Q(this.onRequestParseHooks,(a,l)=>A(()=>a({request:e,url:n,requestParser:s,serverContext:r,setRequestParser(c){s=c;},endResponse(c){i=c,l();},fetchAPI:this.fetchAPI}),c=>c?.onRequestParseDone),o),()=>i?{response:i}:(this.logger.debug("Parsing request to extract GraphQL parameters"),s?A(()=>s(e),a=>{if(hf(a))return {response:a};let l=a;return A(()=>Q(o,c=>c({requestParserResult:l,setRequestParserResult(u){l=u;}})),()=>({requestParserResult:l}))}):{response:new this.fetchAPI.Response(null,{status:415,statusText:"Unsupported Media Type"})}))};handle=(e,r)=>{let n=this.instrumentation&&tt({request:e}),s=this.instrumentation?.requestParse?n.asyncFn(this.instrumentation?.requestParse,this.parseRequest):this.parseRequest;return Mt(N().then(()=>s(e,r)).then(({response:i,requestParserResult:o})=>{if(i)return i;let a=this.instrumentation?.operation?(l,c)=>tt({context:c,request:l.request}).asyncFn(this.instrumentation?.operation,this.getResultForParams)(l,c):this.getResultForParams;return A(()=>Array.isArray(o)?Promise.all(o.map(l=>N().then(()=>a({params:l,request:e},Object.create(r))).catch(c=>({errors:Lt(c,this.maskedErrorsOpts,this.logger)})))):a({params:o,request:e},r),l=>(this.instrumentation?.resultProcess?n.asyncFn(this.instrumentation.resultProcess,Pn):Pn)({request:e,result:l,fetchAPI:this.fetchAPI,onResultProcessHooks:this.onResultProcessHooks,serverContext:r}))}).catch(i=>{let a={errors:Lt(i,this.maskedErrorsOpts,this.logger)};return Pn({request:e,result:a,fetchAPI:this.fetchAPI,onResultProcessHooks:this.onResultProcessHooks,serverContext:r})}))}};function mf(t){let e=new Qi(t);return Su(e,{fetchAPI:e.fetchAPI,plugins:e.plugins,disposeOnProcessTerminate:t.disposeOnProcessTerminate})}g();var lg={aws:{type:"aws",configKey:"s3",displayName:"S3 Compatible (AWS, Backblaze, Wasabi, etc.)",configFields:[{name:"bucket",type:"text",label:"Bucket Name",required:true},{name:"region",type:"text",label:"Region",defaultValue:"us-east-1",admin:{placeholder:"us-east-1"}},{name:"accessKeyId",type:"text",label:"Access Key ID",required:true},{name:"secretAccessKey",type:"password",label:"Secret Access Key",required:true},{name:"endpoint",type:"text",label:"Endpoint URL",admin:{placeholder:"https://s3.custom.com"}},{name:"cdnUrl",type:"text",label:"CDN URL",admin:{placeholder:"https://cdn.example.com"}},{name:"prefix",type:"text",label:"Path Prefix",admin:{placeholder:"uploads"}}]},r2:{type:"r2",configKey:"r2",displayName:"Cloudflare R2",configFields:[{name:"accountId",type:"text",label:"Account ID",required:true,admin:{placeholder:"Your Cloudflare Account ID"}},{name:"accessKeyId",type:"text",label:"Access Key ID",required:true},{name:"secretAccessKey",type:"password",label:"Secret Access Key",required:true},{name:"bucket",type:"text",label:"Bucket Name",required:true},{name:"publicDevUrl",type:"text",label:"Public Dev URL ID",admin:{placeholder:"pub-xxxxxxxxxxxxxxxx",description:"Enter ONLY the ID (e.g., pub-b8d8c4cc8bcf4d868ddd95efc1b305aa). Do NOT include https:// or the full URL. Found in R2 Dashboard \u2192 Public Dev URL."}},{name:"cdnUrl",type:"text",label:"Custom CDN URL",admin:{placeholder:"https://assets.example.com (optional)"}},{name:"prefix",type:"text",label:"Path Prefix",admin:{placeholder:"uploads (optional)",description:"Optional prefix for all object keys. Do not use '/' as prefix."}}]},gcs:{type:"gcs",configKey:"gcs",displayName:"Google Cloud Storage",configFields:[{name:"bucket",type:"text",label:"Bucket Name",required:true},{name:"projectId",type:"text",label:"Project ID"},{name:"clientEmail",type:"text",label:"Client Email"},{name:"privateKey",type:"password",label:"Private Key"},{name:"cdnUrl",type:"text",label:"CDN URL"},{name:"prefix",type:"text",label:"Path Prefix"}]},digitalocean:{type:"digitalocean",configKey:"digitalocean",displayName:"DigitalOcean Spaces",configFields:[{name:"bucket",type:"text",label:"Bucket Name",required:true},{name:"region",type:"text",label:"Region",defaultValue:"nyc3"},{name:"accessKeyId",type:"text",label:"Access Key ID",required:true},{name:"secretAccessKey",type:"password",label:"Secret Access Key",required:true},{name:"cdnUrl",type:"text",label:"CDN URL"},{name:"prefix",type:"text",label:"Path Prefix"}]},backblaze:{type:"backblaze",configKey:"backblaze",displayName:"Backblaze B2",configFields:[{name:"bucket",type:"text",label:"Bucket Name",required:true},{name:"accountId",type:"text",label:"Account ID"},{name:"applicationKeyId",type:"text",label:"Application Key ID",required:true},{name:"applicationKey",type:"password",label:"Application Key",required:true},{name:"cdnUrl",type:"text",label:"CDN URL"},{name:"prefix",type:"text",label:"Path Prefix"}]},wasabi:{type:"wasabi",configKey:"wasabi",displayName:"Wasabi",configFields:[{name:"bucket",type:"text",label:"Bucket Name",required:true},{name:"region",type:"text",label:"Region",defaultValue:"us-east-1"},{name:"accessKeyId",type:"text",label:"Access Key ID",required:true},{name:"secretAccessKey",type:"password",label:"Secret Access Key",required:true},{name:"cdnUrl",type:"text",label:"CDN URL"},{name:"prefix",type:"text",label:"Path Prefix"}]}};function cg(t,e){switch(t){case "r2":return e?.endpoint||`https://${e?.accountId||""}.r2.cloudflarestorage.com`;case "digitalocean":return e?.endpoint||`https://${e?.region||"nyc3"}.digitaloceanspaces.com`;case "backblaze":return e?.endpoint||"https://s3.backblazeb2.com";case "wasabi":return e?.endpoint||`https://s3.${e?.region||"us-east-1"}.wasabisys.com`;default:return e?.endpoint}}function bf(t,e){return {provider:t,bucket:e?.bucket||"",region:e?.region||"us-east-1",accessKeyId:e?.accessKeyId||e?.clientEmail||e?.applicationKeyId||"",secretAccessKey:e?.secretAccessKey||e?.privateKey||e?.applicationKey||"",endpoint:cg(t,e),cdnUrl:e?.cdnUrl,prefix:e?.prefix,accountId:e?.accountId,publicDevUrl:e?.publicDevUrl}}function ug(t,e,r){let n=r[e.configKey]||{};return bf(t,n)}function fg(t,e,r){let n=r?.[e.configKey]||r;return bf(t,n)}var Zi=class extends xe{constructor(){super("@kyro-cms/storage-s3"),this.version="1.0.0",this.description="S3-compatible storage (AWS R2 GCS DigitalOcean Backblaze Wasabi)";}async init(e){let r=e.registry?.storageProviders;if(!r)return;let n=this.name;for(let s of Object.values(lg))r.register({type:s.type,displayName:s.displayName,pluginName:n,configKey:s.configKey,configFields:s.configFields,extractConfig:i=>ug(s.type,s,i),extractRawConfig:i=>fg(s.type,s,i),factory:i=>Xa$1(i)});}},yf=new Zi;g();var Ji=class extends xe{constructor(){super("@kyro-cms/storage-cloudinary"),this.version="1.0.0",this.description="Cloudinary image and video storage";}async init(e){let r=e.registry?.storageProviders;r&&r.register({type:"cloudinary",displayName:"Cloudinary",pluginName:this.name,configKey:"cloudinary",configFields:[{name:"cloudName",type:"text",label:"Cloud Name",required:true},{name:"apiKey",type:"text",label:"API Key",required:true},{name:"apiSecret",type:"password",label:"API Secret",required:true},{name:"folder",type:"text",label:"Folder",admin:{placeholder:"Optional folder path"}},{name:"uploadPreset",type:"text",label:"Upload Preset (optional)",admin:{placeholder:"Leave empty for signed uploads",description:"If not set, uploads will be signed with API Secret"}}],extractConfig:n=>({cloudName:n.cloudinary?.cloudName||"",apiKey:n.cloudinary?.apiKey||"",apiSecret:n.cloudinary?.apiSecret||"",folder:n.cloudinary?.folder,uploadPreset:n.cloudinary?.uploadPreset}),extractRawConfig:n=>{let s=n?.cloudinary||n;return {cloudName:s?.cloudName||"",apiKey:s?.apiKey||"",apiSecret:s?.apiSecret||"",folder:s?.folder,uploadPreset:s?.uploadPreset}},factory:n=>Ya$1(n)});}},gf=new Ji;var hg=[yf,gf],Yi=class{registry;db;pubsub;webhookService;settings;pluginManager;wsServer;config;constructor(e){this.config=e,this.registry=Kn(),this.db=e.adapter||e.db,this.pubsub=new b$2(this.registry),this.webhookService=n$2(this.db),this.pluginManager=new br;for(let r of hg)this.pluginManager.register(r),this.registry.addPlugin(r);if(e.plugins)for(let r of e.plugins)this.pluginManager.register(r),this.registry.addPlugin(r);e.collections&&e.admin?.collectionOverrides&&rs(e.collections,e.admin.collectionOverrides),e.globals&&e.admin?.globalOverrides&&ns(e.globals,e.admin.globalOverrides),e.collections&&this.registry.addCollections(e.collections),e.globals&&this.registry.addGlobals(e.globals);}async init(){await this.pluginManager.executeHook("beforeInit",{kyro:this}),await this.registry.init(this),await this.pluginManager.executeHook("afterInit",{kyro:this}),this.registry.addGlobalPostInit(a$3);let e={slug:"plugin-settings",admin:{hidden:true},fields:[{name:"states",type:"json"}]};if(this.registry.addGlobalPostInit(e),!this.db)throw new Error("Database adapter is null \u2014 failed to load at startup. Check the server console for the exact error.");let r={slug:a$4,fields:[{name:"userId",type:"text",required:true},{name:"name",type:"text",required:true},{name:"key",type:"text",required:true},{name:"keyPrefix",type:"text",required:true},{name:"permissions",type:"json"},{name:"lastUsedAt",type:"date"},{name:"expiresAt",type:"date"}]},n={slug:e$2,fields:[{name:"name",type:"text",required:true},{name:"url",type:"text",required:true},{name:"events",type:"json",required:true},{name:"collections",type:"json"},{name:"status",type:"text",required:true},{name:"secret",type:"text"},{name:"headers",type:"json"},{name:"action",type:"text"},{name:"config",type:"json"},{name:"lastTriggered",type:"date"},{name:"lastError",type:"text"}]},s={slug:f$2,fields:[{name:"webhookId",type:"text",required:true},{name:"event",type:"text",required:true},{name:"payload",type:"json",required:true},{name:"attempt",type:"number",required:true},{name:"status",type:"text",required:true},{name:"responseStatus",type:"number"},{name:"responseBody",type:"text"},{name:"error",type:"text"},{name:"duration",type:"number"},{name:"deliveredAt",type:"date"},{name:"nextRetryAt",type:"date"}]},i=this.registry.getGlobals();if(this.db instanceof c$3&&this.db.dialect==="postgres"){let o=this.db,a=a$4.replace(/-/g,"_");o.schema&&!o.schema[a]&&(o.schema[a]=g$2);}await this.db.init([...this.registry.getCollections(),r,n,s],i),await this.loadPluginState(),this.pubsub.autoRegisterHooks();}async loadSettings(){if(this.settings)return this.settings;try{let e=await this.db.findOne({collection:"_globals_access-settings",where:{},draft:!0});e&&(this.settings={access:e});}catch{}return this.settings||{}}async loadPluginState(){let e=this.registry.storageProviders,r=e.getAllPluginNames(),n={};try{let s=await this.db.findOne({collection:"_globals_plugin-settings",where:{},draft:!0});s&&s.states&&(n=s.states);}catch{}for(let s of r)n[s]!==void 0&&e.setPluginEnabled(s,n[s]);}async getREST(e){let r=typeof this.config.auth=="object"?this.config.auth:null,n=r?.secret,s=r?.checkSession!==false;return ib({registry:this.registry,db:this.db,authSecret:n,authAdapter:this.config.authAdapter,checkSession:s,...e,cors:this.config.cors,webhookService:this.webhookService,settings:this.settings})}getGraphQL(e){let r=J$1({registry:this.registry,db:this.db,settings:this.settings});return {fetch:mf({schema:r,context:async({request:s})=>{let i=c$4(s),o,a;if(i&&this.db){let c=await b$3(i,this.db);c.user&&(o=c.user,a=d$3(c));}let l=e?.tenantId;return {db:this.db,registry:this.registry,user:o,req:s,tenantId:l,apiKey:a,relationLoader:new H$2({db:this.db,tenantId:l,user:o})}},graphiql:this.config.graphQL?.disablePlayground!==true,plugins:[]}).fetch,schema:r}}getTRPC(e){return {fetch:async(r,n)=>{let i=new URL(r.url).pathname.replace(/^\/api\/trpc\//,""),[o,...a]=i.split("."),l=a.join(".");if(l=l.replace(/\.(query|mutate|subscribe)$/,""),!o||!l)return new Response(JSON.stringify({error:{message:"Invalid tRPC path",code:-32600,data:{code:"BAD_REQUEST",httpStatus:400}}}),{status:400,headers:{"Content-Type":"application/json"}});let c=await a$5({db:this.db,registry:this.registry,req:r,user:e?.user,tenantId:e?.tenantId,settings:this.settings}),h=i$1(c)[o];if(!h)return new Response(JSON.stringify({error:{message:`Collection '${o}' not found`,code:-32601,data:{code:"NOT_FOUND",httpStatus:404}}}),{status:404,headers:{"Content-Type":"application/json"}});let d=h[l];if(typeof d!="function")return new Response(JSON.stringify({error:{message:`Procedure '${l}' not found`,code:-32601,data:{code:"NOT_FOUND",httpStatus:404}}}),{status:404,headers:{"Content-Type":"application/json"}});try{let p={};if(r.method==="POST"||r.method==="PATCH")p=await r.json().catch(()=>({}));else {let R=new URL(r.url).searchParams.get("input");if(R)try{p=JSON.parse(decodeURIComponent(R));}catch{}}let _=p?.["0"]??p,w=await d({..._,collection:o});return new Response(JSON.stringify({result:{data:w}}),{status:200,headers:{"Content-Type":"application/json"}})}catch(p){let _=p.message||"Internal error",w=_.includes("not found")?404:_.includes("denied")||_.includes("authentication required")?403:_.includes("conflict")?409:500,R=w===404?-32601:w===403?-32001:w===409?-32002:-32603;return new Response(JSON.stringify({error:{message:_,code:R,data:{code:"INTERNAL_SERVER_ERROR",httpStatus:w}}}),{status:w,headers:{"Content-Type":"application/json"}})}},router:null}}getWS(){return this.wsServer}async startWebSocket(e){let r=this.settings?.access?.apiAccess;if(r?.wsEnabled===false)return null;let n=async o=>{let a=await b$3(o,this.db);if(!a.valid)throw new Error(a.error||"Invalid API key");if(!a.user)throw new Error("API key has no associated user");return a.user},s=e?.port||8080,i=globalThis;if(i.__KYRO_WS_SERVER__)try{await i.__KYRO_WS_SERVER__.close();}catch{}return this.wsServer=d$2({pubsub:this.pubsub,port:s,requireAuth:e?.requireAuth??r?.requireAuth,verifyToken:e?.verifyToken||n}),i.__KYRO_WS_SERVER__=this.wsServer,this.wsServer}async shutdown(){await this.pluginManager.executeHook("beforeServerStop",{kyro:this}),this.wsServer&&await this.wsServer.close(),await this.db.disconnect(),await this.pluginManager.executeHook("afterServerStop",{kyro:this});}};function dg(t){return new Yi(t)}function Bv(t){let e=dg(t),r=null;return async function(s,i){return r||(r=e.init()),await r,(await e.getREST()).fetch(s,i)}}g();var xf={debug:0,info:1,warn:2,error:3,none:4},Xi=class{level;constructor(){let e=typeof process<"u"?process.env?.KYRO_LOG_LEVEL:void 0;this.level=e||"info";}setLevel(e){this.level=e;}getLevel(){return this.level}shouldLog(e){return xf[e]>=xf[this.level]}debug(...e){this.shouldLog("debug")&&console.debug("[Kyro DEBUG]",...e);}info(...e){this.shouldLog("info")&&console.log("[Kyro]",...e);}warn(...e){this.shouldLog("warn")&&console.warn("[Kyro WARN]",...e);}error(...e){this.shouldLog("error")&&console.error("[Kyro ERROR]",...e);}},Zv=new Xi;
|
|
56
|
+
</pre></section></main></body></html>`;var og=function(e){return new e.fetchAPI.Response(cf.replace(/__GRAPHIQL_LINK__/g,e.graphqlEndpoint).replace(/__REQUEST_PATH__/g,e.url.pathname),{status:200,statusText:"OK",headers:{"Content-Type":"text/html"}})};function uf(t){let e=t.landingPageRenderer||og;return {onRequest({request:r,fetchAPI:n,endResponse:s,url:i}){let o=t.getGraphQLEndpoint();if(!r.url.endsWith(o)&&!r.url.endsWith(`${o}/`)&&i.pathname!==o&&i.pathname!==`${o}/`&&!t.getGraphQLEndpointURLPattern().test(i)){if(t.showLandingPage===true&&r.method==="GET"&&r.headers?.get("accept")?.includes("text/html")){let a=e({request:r,fetchAPI:n,url:i,graphqlEndpoint:o,get urlPattern(){return t.getGraphQLEndpointURLPattern()}});if(G(a))return a.then(s);s(a);return}s(new n.Response("",{status:404,statusText:"Not Found"}));}}}}g();function Pn({request:t,result:e,fetchAPI:r,onResultProcessHooks:n,serverContext:s}){let i,o=[],a="*/*";return A(()=>Q(n,l=>l({request:t,acceptableMediaTypes:o,result:e,setResult(c){e=c;},resultProcessor:i,setResultProcessor(c,u){i=c,a=u;},serverContext:s})),()=>i?i(e,r,a):new r.Response(null,{status:406,statusText:"Not Acceptable",headers:{accept:o.join("; charset=utf-8, ")}}))}function ff({params:t,enveloped:e}){let r=e.parse(t.query),n=e.validate(e.schema,r);return n.length>0?{errors:n}:A(()=>e.contextFactory(),s=>{let i={schema:e.schema,document:r,contextValue:s,variableValues:t.variables,operationName:t.operationName};return (F$2(r,t.operationName)?.operation==="subscription"?e.subscribe:e.execute)(i)})}g();function hf(t){return t?.status&&t?.headers}g();function df(t){return Le(t)?t.toJSON():t instanceof Error?{message:t.message,stack:t.stack,cause:t.cause}:t}var pf=(t,e,r=globalThis.process?.env?.NODE_ENV==="development")=>{if(_n(t))return t;let n={code:"INTERNAL_SERVER_ERROR",unexpected:true},s={extensions:n};return Le(t)?(s.nodes=t.nodes,s.source=t.source,s.positions=t.positions,s.path=t.path,s.coordinate=xn(t),r&&t.originalError&&(n.originalError=df(t.originalError)),t.extensions?.http&&(n.http=t.extensions.http)):r&&(n.originalError=df(t)),B(e,s)};var Qi=class{getEnveloped;logger;fetchAPI;plugins;instrumentation;onRequestParseHooks;onParamsHooks;onExecutionResultHooks;onResultProcessHooks;maskedErrorsOpts;id;_graphqlEndpoint;_graphqlEndpointURLPattern;version="5.21.2";constructor(e){if(this.id=e?.id??"yoga",this.fetchAPI={...ag},e?.fetchAPI)for(let a in e.fetchAPI)e.fetchAPI[a]&&(this.fetchAPI[a]=e.fetchAPI[a]);let r=e?.logging==null?true:e.logging;this.logger=typeof r=="boolean"?r===true?_r():_r("silent"):typeof r=="string"?_r(r):r;let n=typeof e?.maskedErrors=="object"&&e.maskedErrors.maskError||pf,s=new WeakSet;this.maskedErrorsOpts=e?.maskedErrors===false?null:{errorMessage:"Unexpected error.",...typeof e?.maskedErrors=="object"?e.maskedErrors:{},maskError:(a,l)=>{if(s.has(a))return a;let c=n(a,l,this.maskedErrorsOpts?.isDev);return c!==a&&this.logger.error(a),s.add(c),c}};let i=this.maskedErrorsOpts==null?null:this.maskedErrorsOpts,o=0;e?.batching&&(typeof e.batching=="boolean"?o=10:o=e.batching.limit??10),this.graphqlEndpoint=e?.graphqlEndpoint||"/graphql",this.plugins=[ha({parse:e$4,validate:D$1,execute:Rr,subscribe:Rr,specifiedRules:C$1}),!!e?.schema&&zo(e.schema),e?.allowedHeaders?.request!=null&&Tu(e.allowedHeaders.request),e?.context!=null&&fa(a=>e?.context?typeof e.context=="function"?e.context(a):e.context:{}),Wu({id:this.id,logger:this.logger,endpoint:e?.healthCheckEndpoint}),e?.cors!==false&&Eu(e?.cors),e?.graphiql!==false&&Go({getGraphQLEndpoint:()=>this._graphqlEndpoint,getGraphQLEndpointURLPattern:()=>this.getUrlPatternForGraphQLEndpoint(),options:e?.graphiql,render:e?.renderGraphiQL,logger:this.logger}),Dt({match:Ou,parse:Fu}),Dt({match:Uu,parse:Bu}),e?.multipart!==false&&Dt({match:Mu,parse:$u}),Dt({match:ju,parse:qu}),Dt({match:Iu,parse:Du}),lf(),...e?.plugins??[],e?.parserAndValidationCache!==false&&Yu(!e?.parserAndValidationCache||e?.parserAndValidationCache===true?{}:e?.parserAndValidationCache),Hu(o),Nu(e?.extraParamNames),uf({getGraphQLEndpoint:()=>this.graphqlEndpoint,getGraphQLEndpointURLPattern:()=>this.getUrlPatternForGraphQLEndpoint(),showLandingPage:e?.landingPage!==false,landingPageRenderer:typeof e?.landingPage=="function"?e.landingPage:void 0}),Gu(),Vu(),i!==null&&{onSubscribe(){return {onSubscribeError({error:a}){if(Hi(a))throw a}}}},i!==null&&ua(i),e?.allowedHeaders?.response!=null&&ku(e.allowedHeaders.response),zu()],this.getEnveloped=la({plugins:this.plugins}),this.plugins=this.getEnveloped._plugins,this.onRequestParseHooks=[],this.onParamsHooks=[],this.onExecutionResultHooks=[],this.onResultProcessHooks=[];for(let a of this.plugins)a&&(a.onYogaInit&&a.onYogaInit({yoga:this}),a.onRequestParse&&this.onRequestParseHooks.push(a.onRequestParse),a.onParams&&this.onParamsHooks.push(a.onParams),a.onExecutionResult&&this.onExecutionResultHooks.push(a.onExecutionResult),a.onResultProcess&&this.onResultProcessHooks.push(a.onResultProcess),a.instrumentation&&(this.instrumentation=this.instrumentation?gt(this.instrumentation,a.instrumentation):a.instrumentation));}get graphqlEndpoint(){return this._graphqlEndpoint}set graphqlEndpoint(e){this._graphqlEndpoint=e,this._graphqlEndpointURLPattern=void 0;}getUrlPatternForGraphQLEndpoint(){return this._graphqlEndpointURLPattern??=new this.fetchAPI.URLPattern({pathname:this._graphqlEndpoint}),this._graphqlEndpointURLPattern}handleParams=({request:e,context:r,params:n})=>{let s=r.request===e?{params:n}:{request:e,params:n};Object.assign(r,s);let i=this.getEnveloped(r);return this.logger.debug("Processing GraphQL Parameters"),A(()=>A(()=>ff({params:n,enveloped:i}),o=>(this.logger.debug("Processing GraphQL Parameters done."),o),o=>({errors:Lt(o,this.maskedErrorsOpts,this.logger)})),o=>(ce(o)&&(o=Ie(o,a=>a,a=>{if(a.name==="AbortError")throw this.logger.debug("Request aborted"),a;return {errors:Lt(a,this.maskedErrorsOpts,this.logger)}})),o))};getResultForParams=({params:e,request:r},n)=>{let s,i=this.handleParams;return A(()=>Q(this.onParamsHooks,o=>o({params:e,request:r,setParams(a){e=a;},paramsHandler:i,setParamsHandler(a){i=a;},setResult(a){s=a;},fetchAPI:this.fetchAPI,context:n})),()=>A(()=>s||i({request:r,params:e,context:n}),o=>A(()=>Q(this.onExecutionResultHooks,a=>a({result:o,setResult(l){o=l;},request:r,context:n})),()=>o)))};parseRequest=(e,r)=>{let n=new Proxy({},{get:(a,l,c)=>(n=new this.fetchAPI.URL(e.url,"http://localhost"),Reflect.get(n,l,n))}),s,i,o=[];return A(()=>Q(this.onRequestParseHooks,(a,l)=>A(()=>a({request:e,url:n,requestParser:s,serverContext:r,setRequestParser(c){s=c;},endResponse(c){i=c,l();},fetchAPI:this.fetchAPI}),c=>c?.onRequestParseDone),o),()=>i?{response:i}:(this.logger.debug("Parsing request to extract GraphQL parameters"),s?A(()=>s(e),a=>{if(hf(a))return {response:a};let l=a;return A(()=>Q(o,c=>c({requestParserResult:l,setRequestParserResult(u){l=u;}})),()=>({requestParserResult:l}))}):{response:new this.fetchAPI.Response(null,{status:415,statusText:"Unsupported Media Type"})}))};handle=(e,r)=>{let n=this.instrumentation&&tt({request:e}),s=this.instrumentation?.requestParse?n.asyncFn(this.instrumentation?.requestParse,this.parseRequest):this.parseRequest;return Mt(N().then(()=>s(e,r)).then(({response:i,requestParserResult:o})=>{if(i)return i;let a=this.instrumentation?.operation?(l,c)=>tt({context:c,request:l.request}).asyncFn(this.instrumentation?.operation,this.getResultForParams)(l,c):this.getResultForParams;return A(()=>Array.isArray(o)?Promise.all(o.map(l=>N().then(()=>a({params:l,request:e},Object.create(r))).catch(c=>({errors:Lt(c,this.maskedErrorsOpts,this.logger)})))):a({params:o,request:e},r),l=>(this.instrumentation?.resultProcess?n.asyncFn(this.instrumentation.resultProcess,Pn):Pn)({request:e,result:l,fetchAPI:this.fetchAPI,onResultProcessHooks:this.onResultProcessHooks,serverContext:r}))}).catch(i=>{let a={errors:Lt(i,this.maskedErrorsOpts,this.logger)};return Pn({request:e,result:a,fetchAPI:this.fetchAPI,onResultProcessHooks:this.onResultProcessHooks,serverContext:r})}))}};function mf(t){let e=new Qi(t);return Su(e,{fetchAPI:e.fetchAPI,plugins:e.plugins,disposeOnProcessTerminate:t.disposeOnProcessTerminate})}g();var lg={aws:{type:"aws",configKey:"s3",displayName:"S3 Compatible (AWS, Backblaze, Wasabi, etc.)",configFields:[{name:"bucket",type:"text",label:"Bucket Name",required:true},{name:"region",type:"text",label:"Region",defaultValue:"us-east-1",admin:{placeholder:"us-east-1"}},{name:"accessKeyId",type:"text",label:"Access Key ID",required:true},{name:"secretAccessKey",type:"password",label:"Secret Access Key",required:true},{name:"endpoint",type:"text",label:"Endpoint URL",admin:{placeholder:"https://s3.custom.com"}},{name:"cdnUrl",type:"text",label:"CDN URL",admin:{placeholder:"https://cdn.example.com"}},{name:"prefix",type:"text",label:"Path Prefix",admin:{placeholder:"uploads"}}]},r2:{type:"r2",configKey:"r2",displayName:"Cloudflare R2",configFields:[{name:"accountId",type:"text",label:"Account ID",required:true,admin:{placeholder:"Your Cloudflare Account ID"}},{name:"accessKeyId",type:"text",label:"Access Key ID",required:true},{name:"secretAccessKey",type:"password",label:"Secret Access Key",required:true},{name:"bucket",type:"text",label:"Bucket Name",required:true},{name:"publicDevUrl",type:"text",label:"Public Dev URL ID",admin:{placeholder:"pub-xxxxxxxxxxxxxxxx",description:"Enter ONLY the ID (e.g., pub-b8d8c4cc8bcf4d868ddd95efc1b305aa). Do NOT include https:// or the full URL. Found in R2 Dashboard \u2192 Public Dev URL."}},{name:"cdnUrl",type:"text",label:"Custom CDN URL",admin:{placeholder:"https://assets.example.com (optional)"}},{name:"prefix",type:"text",label:"Path Prefix",admin:{placeholder:"uploads (optional)",description:"Optional prefix for all object keys. Do not use '/' as prefix."}}]},gcs:{type:"gcs",configKey:"gcs",displayName:"Google Cloud Storage",configFields:[{name:"bucket",type:"text",label:"Bucket Name",required:true},{name:"projectId",type:"text",label:"Project ID"},{name:"clientEmail",type:"text",label:"Client Email"},{name:"privateKey",type:"password",label:"Private Key"},{name:"cdnUrl",type:"text",label:"CDN URL"},{name:"prefix",type:"text",label:"Path Prefix"}]},digitalocean:{type:"digitalocean",configKey:"digitalocean",displayName:"DigitalOcean Spaces",configFields:[{name:"bucket",type:"text",label:"Bucket Name",required:true},{name:"region",type:"text",label:"Region",defaultValue:"nyc3"},{name:"accessKeyId",type:"text",label:"Access Key ID",required:true},{name:"secretAccessKey",type:"password",label:"Secret Access Key",required:true},{name:"cdnUrl",type:"text",label:"CDN URL"},{name:"prefix",type:"text",label:"Path Prefix"}]},backblaze:{type:"backblaze",configKey:"backblaze",displayName:"Backblaze B2",configFields:[{name:"bucket",type:"text",label:"Bucket Name",required:true},{name:"accountId",type:"text",label:"Account ID"},{name:"applicationKeyId",type:"text",label:"Application Key ID",required:true},{name:"applicationKey",type:"password",label:"Application Key",required:true},{name:"cdnUrl",type:"text",label:"CDN URL"},{name:"prefix",type:"text",label:"Path Prefix"}]},wasabi:{type:"wasabi",configKey:"wasabi",displayName:"Wasabi",configFields:[{name:"bucket",type:"text",label:"Bucket Name",required:true},{name:"region",type:"text",label:"Region",defaultValue:"us-east-1"},{name:"accessKeyId",type:"text",label:"Access Key ID",required:true},{name:"secretAccessKey",type:"password",label:"Secret Access Key",required:true},{name:"cdnUrl",type:"text",label:"CDN URL"},{name:"prefix",type:"text",label:"Path Prefix"}]}};function cg(t,e){switch(t){case "r2":return e?.endpoint||`https://${e?.accountId||""}.r2.cloudflarestorage.com`;case "digitalocean":return e?.endpoint||`https://${e?.region||"nyc3"}.digitaloceanspaces.com`;case "backblaze":return e?.endpoint||"https://s3.backblazeb2.com";case "wasabi":return e?.endpoint||`https://s3.${e?.region||"us-east-1"}.wasabisys.com`;default:return e?.endpoint}}function bf(t,e){return {provider:t,bucket:e?.bucket||"",region:e?.region||"us-east-1",accessKeyId:e?.accessKeyId||e?.clientEmail||e?.applicationKeyId||"",secretAccessKey:e?.secretAccessKey||e?.privateKey||e?.applicationKey||"",endpoint:cg(t,e),cdnUrl:e?.cdnUrl,prefix:e?.prefix,accountId:e?.accountId,publicDevUrl:e?.publicDevUrl}}function ug(t,e,r){let n=r[e.configKey]||{};return bf(t,n)}function fg(t,e,r){let n=r?.[e.configKey]||r;return bf(t,n)}var Zi=class extends xe{constructor(){super("@kyro-cms/storage-s3"),this.version="1.0.0",this.description="S3-compatible storage (AWS R2 GCS DigitalOcean Backblaze Wasabi)";}async init(e){let r=e.registry?.storageProviders;if(!r)return;let n=this.name;for(let s of Object.values(lg))r.register({type:s.type,displayName:s.displayName,pluginName:n,configKey:s.configKey,configFields:s.configFields,extractConfig:i=>ug(s.type,s,i),extractRawConfig:i=>fg(s.type,s,i),factory:i=>Xa$1(i)});}},yf=new Zi;g();var Ji=class extends xe{constructor(){super("@kyro-cms/storage-cloudinary"),this.version="1.0.0",this.description="Cloudinary image and video storage";}async init(e){let r=e.registry?.storageProviders;r&&r.register({type:"cloudinary",displayName:"Cloudinary",pluginName:this.name,configKey:"cloudinary",configFields:[{name:"cloudName",type:"text",label:"Cloud Name",required:true},{name:"apiKey",type:"text",label:"API Key",required:true},{name:"apiSecret",type:"password",label:"API Secret",required:true},{name:"folder",type:"text",label:"Folder",admin:{placeholder:"Optional folder path"}},{name:"uploadPreset",type:"text",label:"Upload Preset (optional)",admin:{placeholder:"Leave empty for signed uploads",description:"If not set, uploads will be signed with API Secret"}}],extractConfig:n=>({cloudName:n.cloudinary?.cloudName||"",apiKey:n.cloudinary?.apiKey||"",apiSecret:n.cloudinary?.apiSecret||"",folder:n.cloudinary?.folder,uploadPreset:n.cloudinary?.uploadPreset}),extractRawConfig:n=>{let s=n?.cloudinary||n;return {cloudName:s?.cloudName||"",apiKey:s?.apiKey||"",apiSecret:s?.apiSecret||"",folder:s?.folder,uploadPreset:s?.uploadPreset}},factory:n=>Ya$1(n)});}},gf=new Ji;var hg=[yf,gf],Yi=class{registry;db;pubsub;webhookService;settings;pluginManager;wsServer;config;constructor(e){this.config=e,this.registry=Kn(),this.db=e.adapter||e.db,this.pubsub=new b$2(this.registry),this.webhookService=n$2(this.db),this.pluginManager=new br;for(let r of hg)this.pluginManager.register(r),this.registry.addPlugin(r);if(e.plugins)for(let r of e.plugins)this.pluginManager.register(r),this.registry.addPlugin(r);e.collections&&e.admin?.collectionOverrides&&rs(e.collections,e.admin.collectionOverrides),e.globals&&e.admin?.globalOverrides&&ns(e.globals,e.admin.globalOverrides),e.collections&&this.registry.addCollections(e.collections),e.globals&&this.registry.addGlobals(e.globals);}async init(){await this.pluginManager.executeHook("beforeInit",{kyro:this}),await this.registry.init(this),await this.pluginManager.executeHook("afterInit",{kyro:this}),this.registry.addGlobalPostInit(a$3);let e={slug:"plugin-settings",admin:{hidden:true},fields:[{name:"states",type:"json"}]};if(this.registry.addGlobalPostInit(e),!this.db)throw new Error("Database adapter is null \u2014 failed to load at startup. Check the server console for the exact error.");let r={slug:a$4,fields:[{name:"userId",type:"text",required:true},{name:"name",type:"text",required:true},{name:"key",type:"text",required:true},{name:"keyPrefix",type:"text",required:true},{name:"permissions",type:"json"},{name:"lastUsedAt",type:"date"},{name:"expiresAt",type:"date"}]},n={slug:e$2,fields:[{name:"name",type:"text",required:true},{name:"url",type:"text",required:true},{name:"events",type:"json",required:true},{name:"collections",type:"json"},{name:"status",type:"text",required:true},{name:"secret",type:"text"},{name:"headers",type:"json"},{name:"action",type:"text"},{name:"config",type:"json"},{name:"lastTriggered",type:"date"},{name:"lastError",type:"text"}]},s={slug:f$2,fields:[{name:"webhookId",type:"text",required:true},{name:"event",type:"text",required:true},{name:"payload",type:"json",required:true},{name:"attempt",type:"number",required:true},{name:"status",type:"text",required:true},{name:"responseStatus",type:"number"},{name:"responseBody",type:"text"},{name:"error",type:"text"},{name:"duration",type:"number"},{name:"deliveredAt",type:"date"},{name:"nextRetryAt",type:"date"}]},i=this.registry.getGlobals();if(this.db instanceof c$3&&this.db.dialect==="postgres"){let o=this.db,a=a$4.replace(/-/g,"_");o.schema&&!o.schema[a]&&(o.schema[a]=g$2);}await this.db.init([...this.registry.getCollections(),r,n,s],i),await this.loadPluginState(),this.pubsub.autoRegisterHooks();}async loadSettings(){if(this.settings)return this.settings;try{let e=await this.db.findOne({collection:"_globals_access-settings",where:{},draft:!0});e&&(this.settings={access:e});}catch{}return this.settings||{}}async loadPluginState(){let e=this.registry.storageProviders,r=e.getAllPluginNames(),n={};try{let s=await this.db.findOne({collection:"_globals_plugin-settings",where:{},draft:!0});s&&s.states&&(n=s.states);}catch{}for(let s of r)n[s]!==void 0&&e.setPluginEnabled(s,n[s]);}async getREST(e){let r=typeof this.config.auth=="object"?this.config.auth:null,n=r?.secret,s=r?.checkSession!==false;return ib({registry:this.registry,db:this.db,authSecret:n,authAdapter:this.config.authAdapter,checkSession:s,...e,cors:this.config.cors,webhookService:this.webhookService,settings:this.settings})}getGraphQL(e){let r=J$1({registry:this.registry,db:this.db,settings:this.settings});return {fetch:mf({schema:r,context:async({request:s})=>{let i=c$4(s),o,a;if(i&&this.db){let c=await b$3(i,this.db);c.user&&(o=c.user,a=d$2(c));}let l=e?.tenantId;return {db:this.db,registry:this.registry,user:o,req:s,tenantId:l,apiKey:a,relationLoader:new H$2({db:this.db,tenantId:l,user:o})}},graphiql:this.config.graphQL?.disablePlayground!==true,plugins:[]}).fetch,schema:r}}getTRPC(e){return {fetch:async(r,n)=>{let i=new URL(r.url).pathname.replace(/^\/api\/trpc\//,""),[o,...a]=i.split("."),l=a.join(".");if(l=l.replace(/\.(query|mutate|subscribe)$/,""),!o||!l)return new Response(JSON.stringify({error:{message:"Invalid tRPC path",code:-32600,data:{code:"BAD_REQUEST",httpStatus:400}}}),{status:400,headers:{"Content-Type":"application/json"}});let c=await a$5({db:this.db,registry:this.registry,req:r,user:e?.user,tenantId:e?.tenantId,settings:this.settings}),h=i$1(c)[o];if(!h)return new Response(JSON.stringify({error:{message:`Collection '${o}' not found`,code:-32601,data:{code:"NOT_FOUND",httpStatus:404}}}),{status:404,headers:{"Content-Type":"application/json"}});let d=h[l];if(typeof d!="function")return new Response(JSON.stringify({error:{message:`Procedure '${l}' not found`,code:-32601,data:{code:"NOT_FOUND",httpStatus:404}}}),{status:404,headers:{"Content-Type":"application/json"}});try{let p={};if(r.method==="POST"||r.method==="PATCH")p=await r.json().catch(()=>({}));else {let R=new URL(r.url).searchParams.get("input");if(R)try{p=JSON.parse(decodeURIComponent(R));}catch{}}let _=p?.["0"]??p,w=await d({..._,collection:o});return new Response(JSON.stringify({result:{data:w}}),{status:200,headers:{"Content-Type":"application/json"}})}catch(p){let _=p.message||"Internal error",w=_.includes("not found")?404:_.includes("denied")||_.includes("authentication required")?403:_.includes("conflict")?409:500,R=w===404?-32601:w===403?-32001:w===409?-32002:-32603;return new Response(JSON.stringify({error:{message:_,code:R,data:{code:"INTERNAL_SERVER_ERROR",httpStatus:w}}}),{status:w,headers:{"Content-Type":"application/json"}})}},router:null}}getWS(){return this.wsServer}async startWebSocket(e){let r=this.settings?.access?.apiAccess;if(r?.wsEnabled===false)return null;let n=async o=>{let a=await b$3(o,this.db);if(!a.valid)throw new Error(a.error||"Invalid API key");if(!a.user)throw new Error("API key has no associated user");return a.user},s=e?.port||8080,i=globalThis;if(i.__KYRO_WS_SERVER__)try{await i.__KYRO_WS_SERVER__.close();}catch{}return this.wsServer=e$3({pubsub:this.pubsub,port:s,requireAuth:e?.requireAuth??r?.requireAuth,verifyToken:e?.verifyToken||n}),i.__KYRO_WS_SERVER__=this.wsServer,this.wsServer}async shutdown(){await this.pluginManager.executeHook("beforeServerStop",{kyro:this}),this.wsServer&&await this.wsServer.close(),await this.db.disconnect(),await this.pluginManager.executeHook("afterServerStop",{kyro:this});}};function dg(t){return new Yi(t)}function Bv(t){let e=dg(t),r=null;return async function(s,i){return r||(r=e.init()),await r,(await e.getREST()).fetch(s,i)}}g();var xf={debug:0,info:1,warn:2,error:3,none:4},Xi=class{level;constructor(){let e=typeof process<"u"?process.env?.KYRO_LOG_LEVEL:void 0;this.level=e||"info";}setLevel(e){this.level=e;}getLevel(){return this.level}shouldLog(e){return xf[e]>=xf[this.level]}debug(...e){this.shouldLog("debug")&&console.debug("[Kyro DEBUG]",...e);}info(...e){this.shouldLog("info")&&console.log("[Kyro]",...e);}warn(...e){this.shouldLog("warn")&&console.warn("[Kyro WARN]",...e);}error(...e){this.shouldLog("error")&&console.error("[Kyro ERROR]",...e);}},Zv=new Xi;
|
|
57
57
|
export{yr as A,_e as B,es as C,ts as D,rs as E,ns as F,Yi as G,dg as H,Bv as I,Xi as J,Zv as K,Hn as a,Vn as b,Wn as c,Ye as d,ko as e,y as f,ae as g,Ao as h,Ro as i,Lo as j,Oo as k,Fo as l,qt as m,Ud as n,Bd as o,Kn as p,xe as q,br as r,Qn as s,Zn as t,Jn as u,Yn as v,Xn as w,Dg as x,Do as y,jo as z};
|