@shumai-one/shumai 0.6.0 → 0.6.2
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/bin/chunk-01052ssf.js +32 -0
- package/bin/{chunk-cdk8vqeg.js → chunk-02fvcrej.js} +4 -4
- package/bin/chunk-0bj887zm.js +2 -0
- package/bin/chunk-167z646e.js +2 -0
- package/bin/chunk-1ktk6764.js +10 -0
- package/bin/{chunk-4jj92zwa.js → chunk-1nvd90g2.js} +1 -1
- package/bin/{chunk-ww9qq8yq.js → chunk-1wfg56z3.js} +5 -5
- package/bin/{chunk-3tg10kwz.js → chunk-257dcd2f.js} +2 -2
- package/bin/chunk-26qn7fek.js +2 -0
- package/bin/chunk-2cdxm1cp.js +55 -0
- package/bin/chunk-2jj4j8cn.js +3 -0
- package/bin/chunk-2ne2b54t.js +2 -0
- package/bin/{chunk-h1fbev9c.js → chunk-2nhgdqdg.js} +2 -2
- package/bin/chunk-2vbeqczj.js +1 -0
- package/bin/chunk-37p6bcx2.js +1 -0
- package/bin/chunk-3ckkwdjx.js +13 -0
- package/bin/chunk-3knfx6dm.js +1 -0
- package/bin/chunk-3z85zxkn.js +1 -0
- package/bin/chunk-4mws03es.js +5 -0
- package/bin/chunk-54tbfvya.js +2 -0
- package/bin/chunk-55h9ze53.js +2 -0
- package/bin/chunk-56kh5fxc.js +1 -0
- package/bin/chunk-576nj64j.js +2 -0
- package/bin/{chunk-9gftd4f7.js → chunk-5wapd171.js} +13 -13
- package/bin/chunk-6cnqjngz.js +1 -0
- package/bin/chunk-73yncv54.js +2 -0
- package/bin/chunk-7g46e1wy.js +3 -0
- package/bin/{chunk-3020am4q.js → chunk-7naa7tpn.js} +2 -2
- package/bin/{chunk-6zerk0em.js → chunk-7sgrtxbt.js} +2 -2
- package/bin/{chunk-5bpvwv66.js → chunk-7v7mypc6.js} +2 -2
- package/bin/chunk-82tps5n1.js +2 -0
- package/bin/chunk-84x8p7v5.js +1 -0
- package/bin/{chunk-fxg81vtx.js → chunk-88jg9dq5.js} +2 -2
- package/bin/chunk-8cjet7pp.js +12 -0
- package/bin/chunk-8fyg9dy4.js +2 -0
- package/bin/chunk-8gtfgkrn.js +2 -0
- package/bin/chunk-8mqbztj8.js +2 -0
- package/bin/chunk-8qdtvfx3.css +1 -0
- package/bin/chunk-8xb6yz11.js +2 -0
- package/bin/chunk-8yjsmr7g.js +2 -0
- package/bin/chunk-91rb0jpb.js +2 -0
- package/bin/chunk-96qpjght.js +2 -0
- package/bin/chunk-9f1xk1nt.js +1 -0
- package/bin/chunk-9mk9cvbk.js +1 -0
- package/bin/{chunk-65t6rm5d.js → chunk-9n1w5dw1.js} +3 -3
- package/bin/chunk-9nw5w8vh.js +1 -0
- package/bin/{chunk-cv5xx81e.js → chunk-9t3p4xp6.js} +1 -1
- package/bin/chunk-9xhjy897.js +11 -0
- package/bin/chunk-9zsv6d2f.js +1 -0
- package/bin/chunk-a411xhmm.js +7 -0
- package/bin/{chunk-xbw7ffrz.js → chunk-a74g6h8a.js} +2 -2
- package/bin/chunk-ah8fjb6f.js +2 -0
- package/bin/chunk-atfz7g7e.js +2 -0
- package/bin/{chunk-j4p3eqtd.js → chunk-b5rhvzv9.js} +2 -2
- package/bin/{chunk-rq2h2bwt.js → chunk-b7bnp021.js} +2 -2
- package/bin/chunk-cf5axr8c.js +1 -0
- package/bin/chunk-cgmebxx6.js +2 -0
- package/bin/chunk-cwat1jwx.js +3 -0
- package/bin/chunk-cz13a82m.js +3 -0
- package/bin/chunk-dk42gf7v.js +2 -0
- package/bin/chunk-e4f56spj.js +4 -0
- package/bin/chunk-e4yscwen.js +18 -0
- package/bin/chunk-eb7mzbfm.js +1 -0
- package/bin/chunk-er14d498.js +3 -0
- package/bin/{chunk-sbyyn9yw.js → chunk-eyjfhdp9.js} +2 -2
- package/bin/chunk-f25fe9th.js +393 -0
- package/bin/chunk-f6avg5qe.js +129 -0
- package/bin/{chunk-vjyget8s.js → chunk-fatmqnp1.js} +1 -1
- package/bin/chunk-fvx9k1dc.js +2 -0
- package/bin/chunk-g22wmpk1.js +3 -0
- package/bin/chunk-g6sdezec.js +2 -0
- package/bin/chunk-gtf19jc1.js +2 -0
- package/bin/chunk-gxepkvt2.js +2 -0
- package/bin/chunk-h1n7jqnw.js +1 -0
- package/bin/chunk-hfm82066.js +2 -0
- package/bin/chunk-hnkcgvcj.js +3 -0
- package/bin/{chunk-fg9sr6r9.js → chunk-hpbn0k9n.js} +2 -2
- package/bin/{chunk-qk5hsn6e.js → chunk-hpwv4am3.js} +4 -4
- package/bin/{chunk-d6xezgrg.js → chunk-hw6czrya.js} +1 -1
- package/bin/{chunk-59t9s2jh.js → chunk-hzkjgcre.js} +1 -1
- package/bin/chunk-j2s311yc.js +3 -0
- package/bin/{chunk-6hzktewz.js → chunk-jt02kpfc.js} +2 -2
- package/bin/{chunk-qnyqtaf0.js → chunk-jt0ykktx.js} +1 -1
- package/bin/{chunk-047n9gfs.js → chunk-jzgbxqdg.js} +2 -2
- package/bin/chunk-kj6h5j5a.js +4 -0
- package/bin/chunk-km4gn6b6.js +1 -0
- package/bin/chunk-knj2s8mg.js +16 -0
- package/bin/{chunk-01ym2agz.js → chunk-kvhf12b4.js} +2 -2
- package/bin/chunk-m0q2cgfg.js +2 -0
- package/bin/chunk-m82tkhaa.js +11 -0
- package/bin/chunk-m9adtgzk.js +2 -0
- package/bin/{chunk-rh8dy99a.js → chunk-mcj1xpcc.js} +2 -2
- package/bin/chunk-mcw198kg.js +13 -0
- package/bin/{chunk-5e7r7a9d.js → chunk-mwktrwtx.js} +1 -1
- package/bin/chunk-mzsw9var.js +3 -0
- package/bin/chunk-ns33grgx.js +2 -0
- package/bin/{chunk-emgyjhmx.js → chunk-ny1kbmxt.js} +2 -2
- package/bin/{chunk-czybv3vy.js → chunk-p3f5aevs.js} +1 -1
- package/bin/chunk-p3j6ydk1.js +1 -0
- package/bin/chunk-p4s95471.js +2 -0
- package/bin/chunk-pk406dgy.js +2 -0
- package/bin/chunk-q2bew2vc.js +2 -0
- package/bin/chunk-q5vkxee3.js +5 -0
- package/bin/{chunk-n0wwtjwv.js → chunk-q83h0hkx.js} +2 -2
- package/bin/chunk-q8w4mbw4.js +2 -0
- package/bin/{chunk-hjwpd09v.js → chunk-qwpkcp8d.js} +2 -2
- package/bin/chunk-r1xer8gn.js +5 -0
- package/bin/chunk-s1e4qy3q.js +14 -0
- package/bin/{chunk-w89czwjj.js → chunk-s9ksftq2.js} +1 -1
- package/bin/chunk-srxp5jav.js +42 -0
- package/bin/chunk-swtwaaqe.js +1 -0
- package/bin/chunk-tagdrg7p.js +1 -0
- package/bin/{chunk-da86fpjt.js → chunk-tekwpkjf.js} +2 -2
- package/bin/chunk-twtxnzbv.js +2 -0
- package/bin/{chunk-q7t5zs7n.js → chunk-v05rrxp5.js} +2 -2
- package/bin/{chunk-8s9fehda.js → chunk-v5cn90cf.js} +2 -2
- package/bin/chunk-v5mcjwxy.js +2 -0
- package/bin/{chunk-fyb6t7ct.js → chunk-vcrmjtcz.js} +2 -2
- package/bin/chunk-vkzasgxw.js +2 -0
- package/bin/chunk-vp3czaeh.js +7 -0
- package/bin/chunk-x03jwaga.js +8 -0
- package/bin/chunk-x342vzdx.js +2 -0
- package/bin/chunk-x8mjh387.js +5 -0
- package/bin/chunk-xc54vhfz.js +2 -0
- package/bin/chunk-xvkwbczx.js +3 -0
- package/bin/chunk-y241cxff.js +1 -0
- package/bin/chunk-yk12hydf.js +7 -0
- package/bin/chunk-ympbfzz4.js +2 -0
- package/bin/chunk-yq32evnn.js +20 -0
- package/bin/chunk-z1p13dnc.js +2 -0
- package/bin/chunk-zarz3sqn.js +211 -0
- package/bin/chunk-zezje74z.js +4 -0
- package/bin/chunk-zrszykjf.js +3 -0
- package/bin/shumai-app.html +1 -1
- package/bin/shumai-app.js +947 -1012
- package/package.json +7 -7
- package/prisma/migrations/20261026024507_hash_api_tokens/migration.sql +28 -0
- package/prisma/migrations/20261026031904_add_audit_log_via/migration.sql +2 -0
- package/prisma/migrations/20261029024626_add_oauth_and_jwks/migration.sql +205 -0
- package/prisma/migrations/20261029030321_default_empty_arrays_oauth/migration.sql +25 -0
- package/prisma/schema.prisma +186 -1
- package/bin/chunk-0a4ahz7r.js +0 -2
- package/bin/chunk-0awcpx0a.js +0 -3
- package/bin/chunk-0fbgfgxv.js +0 -12
- package/bin/chunk-0nnqha4f.js +0 -3
- package/bin/chunk-0tvggyy4.js +0 -1
- package/bin/chunk-113baw0m.js +0 -2
- package/bin/chunk-1dbjyarc.js +0 -2
- package/bin/chunk-1qre79kf.js +0 -1
- package/bin/chunk-23780yj6.js +0 -3
- package/bin/chunk-27v3yepb.js +0 -1
- package/bin/chunk-2rq3w8sg.js +0 -2
- package/bin/chunk-3fjgf7eb.js +0 -3
- package/bin/chunk-3pwwg1xm.js +0 -1
- package/bin/chunk-3sfb63fp.js +0 -2
- package/bin/chunk-4g4pxmef.js +0 -3
- package/bin/chunk-4yhvexzk.js +0 -5
- package/bin/chunk-58cbk6e8.js +0 -1
- package/bin/chunk-5m51b7af.js +0 -2
- package/bin/chunk-6bed0rz4.js +0 -1
- package/bin/chunk-6smn0q1n.js +0 -20
- package/bin/chunk-7bbsv8g0.js +0 -2
- package/bin/chunk-83bdgs2c.js +0 -1
- package/bin/chunk-86qtjd30.js +0 -11
- package/bin/chunk-8rekh4h9.js +0 -3
- package/bin/chunk-8sf2hf31.js +0 -2
- package/bin/chunk-9d3w678j.js +0 -1
- package/bin/chunk-9rcg8zgs.js +0 -42
- package/bin/chunk-a23q1kc4.js +0 -5
- package/bin/chunk-a6cdt85k.js +0 -2
- package/bin/chunk-a76h3ehe.js +0 -1
- package/bin/chunk-b1bkd2p4.js +0 -32
- package/bin/chunk-bf5m8f6t.js +0 -2
- package/bin/chunk-cf57fk11.js +0 -2
- package/bin/chunk-d4sbcvpa.js +0 -2
- package/bin/chunk-dzjmwat0.js +0 -14
- package/bin/chunk-eex8sjfs.js +0 -2
- package/bin/chunk-exmwerag.js +0 -18
- package/bin/chunk-f38xyahm.js +0 -1
- package/bin/chunk-fb1bes2h.js +0 -2
- package/bin/chunk-fbvak7q2.js +0 -1
- package/bin/chunk-g2ptqqm3.js +0 -3
- package/bin/chunk-ggwqxn95.js +0 -2
- package/bin/chunk-ghk54h71.js +0 -13
- package/bin/chunk-h9akn41s.js +0 -3
- package/bin/chunk-hdansxny.js +0 -2
- package/bin/chunk-hjzbw975.js +0 -2
- package/bin/chunk-jtkxeat4.js +0 -2
- package/bin/chunk-jw4g9628.js +0 -5
- package/bin/chunk-jxebakyq.js +0 -1
- package/bin/chunk-kfewyax2.js +0 -2
- package/bin/chunk-kk3m4za5.js +0 -1
- package/bin/chunk-m7tnj47b.js +0 -3
- package/bin/chunk-maw5ah8t.js +0 -3
- package/bin/chunk-nahdd2t9.js +0 -2
- package/bin/chunk-nv7tztvh.js +0 -129
- package/bin/chunk-nyjwdxyj.js +0 -3
- package/bin/chunk-p0yfxt5e.js +0 -54
- package/bin/chunk-q27qn367.js +0 -5
- package/bin/chunk-q36sdt2w.js +0 -2
- package/bin/chunk-qbj5pe8t.js +0 -1
- package/bin/chunk-qj0bxb1m.js +0 -2
- package/bin/chunk-qqkr6h07.js +0 -11
- package/bin/chunk-qyqc5j3a.css +0 -1
- package/bin/chunk-qzaf6bre.js +0 -2
- package/bin/chunk-r1e59gf0.js +0 -2
- package/bin/chunk-ra5csbkr.js +0 -2
- package/bin/chunk-rx9g95wk.js +0 -10
- package/bin/chunk-rxyy37wa.js +0 -4
- package/bin/chunk-scez7ppq.js +0 -3
- package/bin/chunk-t2a1vq34.js +0 -7
- package/bin/chunk-t879v3b7.js +0 -1
- package/bin/chunk-tjavzarz.js +0 -3
- package/bin/chunk-treyx8em.js +0 -2
- package/bin/chunk-v3z4z04s.js +0 -2
- package/bin/chunk-v3z63tpw.js +0 -2
- package/bin/chunk-v9bes1fv.js +0 -2
- package/bin/chunk-vmm9m3nv.js +0 -2
- package/bin/chunk-vvr8tnse.js +0 -211
- package/bin/chunk-w3stry4v.js +0 -1
- package/bin/chunk-wk0hk00z.js +0 -1
- package/bin/chunk-x4q082e6.js +0 -2
- package/bin/chunk-x6rf77jm.js +0 -16
- package/bin/chunk-x7dyj53k.js +0 -2
- package/bin/chunk-xcrd0y8v.js +0 -6
- package/bin/chunk-z0z0jn5h.js +0 -4
- package/bin/chunk-zasjhrwc.js +0 -2
- package/bin/chunk-zefds5gg.js +0 -1
- package/bin/chunk-zzzgk1d5.js +0 -4
package/bin/chunk-nyjwdxyj.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Fn,Qt,$o,Ds,ui,di,Kt,Mr,p,Cc,Ln,ze,En,Em,Do,xf,Bt,ds,Oo,kr,Go,Ou}from"./chunk-maw5ah8t.js";function pr(e){return Mr(e)&&Kt(e.toOperationNode)}var Hr=p({is(e){return e.kind==="ValueNode"},create(e){return p({kind:"ValueNode",value:e})},createImmediate(e){return p({kind:"ValueNode",value:e,immediate:!0})}});var l=p({is(e){return e.kind==="AliasNode"},create(e,r){return p({kind:"AliasNode",node:e,alias:r})}});var Zt=p({is(e){return e.kind==="ColumnNode"},create(e){return p({kind:"ColumnNode",column:ze.create(e)})}});var al=p({is(e){return e.kind==="SelectAllNode"},create(){return p({kind:"SelectAllNode"})}});var te=p({is(e){return e.kind==="ReferenceNode"},create(e,r){return p({kind:"ReferenceNode",table:r,column:e})},createSelectAll(e){return p({kind:"ReferenceNode",table:e,column:al.create()})}});var g=p({is(e){return e.kind==="TableNode"},create(e){return p({kind:"TableNode",table:En.create(e)})},createWithSchema(e,r){return p({kind:"TableNode",table:En.createWithSchema(e,r)})}});function Ce(e){return Mr(e)&&"expressionType"in e&&pr(e)}function Wr(e){return Mr(e)&&"expression"in e&&Qt(e.alias)&&pr(e)}var D=p({is(e){return e.kind==="SelectModifierNode"},create(e,r){return p({kind:"SelectModifierNode",modifier:e,of:r})},createWithExpression(e){return p({kind:"SelectModifierNode",rawModifier:e})}});var W=p({is(e){return e.kind==="AndNode"},create(e,r){return p({kind:"AndNode",left:e,right:r})}});var C=p({is(e){return e.kind==="OrNode"},create(e,r){return p({kind:"OrNode",left:e,right:r})}});var Re=p({is(e){return e.kind==="OnNode"},create(e){return p({kind:"OnNode",on:e})},cloneWithOperation(e,r,t){return p({...e,on:r==="And"?W.create(e.on,t):C.create(e.on,t)})}});var R=p({is(e){return e.kind==="JoinNode"},create(e,r){return p({kind:"JoinNode",joinType:e,table:r,on:void 0})},createWithOn(e,r,t){return p({kind:"JoinNode",joinType:e,table:r,on:Re.create(t)})},cloneWithOn(e,r){return p({...e,on:e.on?Re.cloneWithOperation(e.on,"And",r):Re.create(r)})}});var I=p({is(e){return e.kind==="BinaryOperationNode"},create(e,r,t){return p({kind:"BinaryOperationNode",leftOperand:e,operator:r,rightOperand:t})}});var Te=p({is(e){return e.kind==="PrimitiveValueListNode"},create(e){return p({kind:"PrimitiveValueListNode",values:p([...e])})}});var $i=p({is(e){return e.kind==="ValueListNode"},create(e){return p({kind:"ValueListNode",values:p(e)})}});function br(e){if(Ln(e))return wt(e);return m(e)}function m(e){if(V(e))return Ao(e);return Hr.create(e)}function Ae(e){return $o(e)||Ds(e)||ui(e)}function le(e){if(!Ae(e))throw Error(`unsafe immediate value ${JSON.stringify(e)}`);return Hr.createImmediate(e)}function wt(e){if(e.some(V))return $i.create(e.map((r)=>m(r)));return Te.create(e)}function or(e){if(e.length===3)return qe(e[0],e[1],e[2]);else if(e.length===1)return m(e[0]);throw Error(`invalid arguments: ${JSON.stringify(e)}`)}function qe(e,r,t){if(Ot(r)&&Er(t))return I.create(w(e),_e(r),Hr.createImmediate(t));return I.create(w(e),_e(r),br(t))}function N(e,r,t){return I.create(w(e),_e(r),w(t))}function je(e,r){return oe(Object.entries(e).filter(([,t])=>!Fn(t)).map(([t,o])=>qe(t,Er(o)?"is":"=",o)),r)}function oe(e,r,t=!0){let o=r==="and"?W.create:C.create;if(e.length===0)return I.create(Hr.createImmediate(1),Do.create("="),Hr.createImmediate(r==="and"?1:0));let n=Sr(e[0]);for(let u=1;u<e.length;++u)n=o(n,Sr(e[u]));if(e.length>1&&t)return Oo.create(n);return n}function Ot(e){return e==="is"||e==="is not"}function Er(e){return ui(e)||Ds(e)}function _e(e){if(Qt(e)&&Em.includes(e))return Do.create(e);if(pr(e))return e.toOperationNode();throw Error(`invalid operator ${JSON.stringify(e)}`)}function Sr(e){return pr(e)?e.toOperationNode():e}var U=p({is(e){return e.kind==="OrderByNode"},create(e){return p({kind:"OrderByNode",items:p([...e])})},cloneWithItems(e,r){return p({...e,items:p([...e.items,...r])})}});var Ge=p({is(e){return e.kind==="PartitionByNode"},create(e){return p({kind:"PartitionByNode",items:p(e)})},cloneWithItems(e,r){return p({...e,items:p([...e.items,...r])})}});var Ne=p({is(e){return e.kind==="OverNode"},create(){return p({kind:"OverNode"})},cloneWithOrderByItems(e,r){return p({...e,orderBy:e.orderBy?U.cloneWithItems(e.orderBy,r):U.create(r)})},cloneWithPartitionByItems(e,r){return p({...e,partitionBy:e.partitionBy?Ge.cloneWithItems(e.partitionBy,r):Ge.create(r)})}});var X=p({is(e){return e.kind==="FromNode"},create(e){return p({kind:"FromNode",froms:p(e)})},cloneWithFroms(e,r){return p({...e,froms:p([...e.froms,...r])})}});var Ke=p({is(e){return e.kind==="GroupByNode"},create(e){return p({kind:"GroupByNode",items:p(e)})},cloneWithItems(e,r){return p({...e,items:p([...e.items,...r])})}});var He=p({is(e){return e.kind==="HavingNode"},create(e){return p({kind:"HavingNode",having:e})},cloneWithOperation(e,r,t){return p({...e,having:r==="And"?W.create(e.having,t):C.create(e.having,t)})}});var Le=p({is(e){return e.kind==="ListNode"},create(e){return p({kind:"ListNode",items:p(e)})}});var F=p({is(e){return e.kind==="UpdateQueryNode"},create(e,r){return p({kind:"UpdateQueryNode",table:e.length===1?e[0]:Le.create(e),...r&&{with:r}})},createWithoutTable(){return p({kind:"UpdateQueryNode"})},cloneWithFromItems(e,r){return p({...e,from:e.from?X.cloneWithFroms(e.from,r):X.create(r)})},cloneWithUpdates(e,r){return p({...e,updates:e.updates?p([...e.updates,...r]):r})},cloneWithLimit(e,r){return p({...e,limit:r})}});var ye=p({is(e){return e.kind==="UsingNode"},create(e){return p({kind:"UsingNode",tables:p(e)})},cloneWithTables(e,r){return p({...e,tables:p([...e.tables,...r])})}});var _=p({is(e){return e.kind==="DeleteQueryNode"},create(e,r){return p({kind:"DeleteQueryNode",from:X.create(e),...r&&{with:r}})},cloneWithOrderByItems:(e,r)=>pe.cloneWithOrderByItems(e,r),cloneWithoutOrderBy:(e)=>pe.cloneWithoutOrderBy(e),cloneWithLimit(e,r){return p({...e,limit:r})},cloneWithoutLimit(e){return p({...e,limit:void 0})},cloneWithUsing(e,r){return p({...e,using:e.using!==void 0?ye.cloneWithTables(e.using,r):ye.create(r)})}});var O=p({is(e){return e.kind==="WhereNode"},create(e){return p({kind:"WhereNode",where:e})},cloneWithOperation(e,r,t){return p({...e,where:r==="And"?W.create(e.where,t):C.create(e.where,t)})}});var Xe=p({is(e){return e.kind==="ReturningNode"},create(e){return p({kind:"ReturningNode",selections:p(e)})},cloneWithSelections(e,r){return p({...e,selections:e.selections?p([...e.selections,...r]):p(r)})}});var Cr=p({is(e){return e.kind==="ExplainNode"},create(e,r){return p({kind:"ExplainNode",format:e,options:r})}});var k=p({is(e){return e.kind==="MergeQueryNode"},create(e,r){return p({kind:"MergeQueryNode",into:e,...r&&{with:r}})},cloneWithUsing(e,r){return p({...e,using:r})},cloneWithWhen(e,r){return p({...e,whens:e.whens?p([...e.whens,r]):p([r])})},cloneWithThen(e,r){return p({...e,whens:e.whens?p([...e.whens.slice(0,-1),Go.cloneWithResult(e.whens[e.whens.length-1],r)]):void 0})}});var Ye=p({is(e){return e.kind==="OutputNode"},create(e){return p({kind:"OutputNode",selections:p(e)})},cloneWithSelections(e,r){return p({...e,selections:e.selections?p([...e.selections,...r]):p(r)})}});var pe=p({is(e){return Gt.is(e)||kr.is(e)||F.is(e)||_.is(e)||k.is(e)},cloneWithEndModifier(e,r){return p({...e,endModifiers:e.endModifiers?p([...e.endModifiers,r]):p([r])})},cloneWithWhere(e,r){return p({...e,where:e.where?O.cloneWithOperation(e.where,"And",r):O.create(r)})},cloneWithJoin(e,r){return p({...e,joins:e.joins?p([...e.joins,r]):p([r])})},cloneWithReturning(e,r){return p({...e,returning:e.returning?Xe.cloneWithSelections(e.returning,r):Xe.create(r)})},cloneWithoutReturning(e){return p({...e,returning:void 0})},cloneWithoutWhere(e){return p({...e,where:void 0})},cloneWithExplain(e,r,t){return p({...e,explain:Cr.create(r,t?.toOperationNode())})},cloneWithTop(e,r){return p({...e,top:r})},cloneWithOutput(e,r){return p({...e,output:e.output?Ye.cloneWithSelections(e.output,r):Ye.create(r)})},cloneWithOrderByItems(e,r){return p({...e,orderBy:e.orderBy?U.cloneWithItems(e.orderBy,r):U.create(r)})},cloneWithoutOrderBy(e){return p({...e,orderBy:void 0})}});var Gt=p({is(e){return e.kind==="SelectQueryNode"},create(e){return p({kind:"SelectQueryNode",...e&&{with:e}})},createFrom(e,r){return p({kind:"SelectQueryNode",from:X.create(e),...r&&{with:r}})},cloneWithSelections(e,r){return p({...e,selections:e.selections?p([...e.selections,...r]):p(r)})},cloneWithDistinctOn(e,r){return p({...e,distinctOn:e.distinctOn?p([...e.distinctOn,...r]):p(r)})},cloneWithFrontModifier(e,r){return p({...e,frontModifiers:e.frontModifiers?p([...e.frontModifiers,r]):p([r])})},cloneWithOrderByItems:(e,r)=>pe.cloneWithOrderByItems(e,r),cloneWithGroupByItems(e,r){return p({...e,groupBy:e.groupBy?Ke.cloneWithItems(e.groupBy,r):Ke.create(r)})},cloneWithLimit(e,r){return p({...e,limit:r})},cloneWithOffset(e,r){return p({...e,offset:r})},cloneWithFetch(e,r){return p({...e,fetch:r})},cloneWithHaving(e,r){return p({...e,having:e.having?He.cloneWithOperation(e.having,"And",r):He.create(r)})},cloneWithSetOperations(e,r){return p({...e,setOperations:e.setOperations?p([...e.setOperations,...r]):p([...r])})},cloneWithoutSelections(e){return p({...e,selections:[]})},cloneWithoutLimit(e){return p({...e,limit:void 0})},cloneWithoutOffset(e){return p({...e,offset:void 0})},cloneWithoutOrderBy:(e)=>pe.cloneWithoutOrderBy(e),cloneWithoutGroupBy(e){return p({...e,groupBy:void 0})}});class ie{#e;constructor(e){this.#e=p(e)}on(...e){return new ie({...this.#e,joinNode:R.cloneWithOn(this.#e.joinNode,or(e))})}onRef(e,r,t){return new ie({...this.#e,joinNode:R.cloneWithOn(this.#e.joinNode,N(e,r,t))})}onTrue(){return new ie({...this.#e,joinNode:R.cloneWithOn(this.#e.joinNode,Bt.createWithSql("true"))})}$call(e){return e(this)}toOperationNode(){return this.#e.joinNode}}class bf{#e;get dynamicReference(){return this.#e}get refType(){return}constructor(e){this.#e=e}toOperationNode(){return Ze(this.#e)}}function Be(e){return Mr(e)&&pr(e)&&Qt(e.dynamicReference)}var T=p({is(e){return e.kind==="OrderByItemNode"},create(e,r){return p({kind:"OrderByItemNode",orderBy:e,direction:r})},cloneWith(e,r){return p({...e,...r})}});var Rr=p({is(e){return e.kind==="CollateNode"},create(e){return p({kind:"CollateNode",collation:ze.create(e)})}});class j{#e;constructor(e){this.#e=p(e)}desc(){return new j({node:T.cloneWith(this.#e.node,{direction:Bt.createWithSql("desc")})})}asc(){return new j({node:T.cloneWith(this.#e.node,{direction:Bt.createWithSql("asc")})})}nullsLast(){return new j({node:T.cloneWith(this.#e.node,{nulls:"last"})})}nullsFirst(){return new j({node:T.cloneWith(this.#e.node,{nulls:"first"})})}collate(e){return new j({node:T.cloneWith(this.#e.node,{collation:Rr.create(e)})})}toOperationNode(){return this.#e.node}}function rr(e){return e==="asc"||e==="desc"}function E(e){if(e.length===2)return[er(e[0],e[1])];if(e.length===1){let[r]=e;if(Array.isArray(r))return ds("orderBy(array) is deprecated, use multiple orderBy calls instead."),r.map((t)=>er(t));return[er(r)]}throw Error(`Invalid number of arguments at order by! expected 1-2, received ${e.length}`)}function er(e,r){let t=xt(e);if(T.is(t)){if(r)throw Error("Cannot specify direction twice!");return t}return Tr(t,r)}function xt(e){if(V(e))return Ao(e);if(Be(e))return e.toOperationNode();let[r,t]=e.split(" ");if(t)return ds("`orderBy('column asc')` is deprecated. Use `orderBy('column', 'asc')` instead."),Tr(Po(r),t);return Po(e)}function Tr(e,r){if(typeof r==="string"){if(!rr(r))throw Error(`Invalid order by direction: ${r}`);return T.create(e,Bt.createWithSql(r))}if(Ce(r))return ds("`orderBy(..., expr)` is deprecated. Use `orderBy(..., 'asc')` or `orderBy(..., (ob) => ...)` instead."),T.create(e,r.toOperationNode());let t=T.create(e);if(!r)return t;return r(new j({node:t})).toOperationNode()}var Ar=p({is(e){return e.kind==="PartitionByItemNode"},create(e){return p({kind:"PartitionByItemNode",partitionBy:e})}});function qr(e){return z(e).map(Ar.create)}class ne{#e;constructor(e){this.#e=p(e)}orderBy(...e){return new ne({overNode:Ne.cloneWithOrderByItems(this.#e.overNode,E(e))})}clearOrderBy(){return new ne({overNode:pe.cloneWithoutOrderBy(this.#e.overNode)})}partitionBy(e){return new ne({overNode:Ne.cloneWithPartitionByItems(this.#e.overNode,qr(e))})}$call(e){return e(this)}toOperationNode(){return this.#e.overNode}}var se=p({is(e){return e.kind==="SelectionNode"},create(e){return p({kind:"SelectionNode",selection:e})},createSelectAll(){return p({kind:"SelectionNode",selection:al.create()})},createSelectAllFromTable(e){return p({kind:"SelectionNode",selection:te.createSelectAll(e)})}});class wf{#e;get table(){return this.#e}constructor(e){this.#e=e}as(e){return new Lr(this.#e,e)}}class Lr{#e;#r;get table(){return this.#e}get alias(){return this.#r}constructor(e,r){this.#e=e,this.#r=r}toOperationNode(){return l.create(zt(this.#e),ze.create(this.#r))}}function Br(e){return Mr(e)&&pr(e)&&Qt(e.table)&&Qt(e.alias)}function A(e){if(Ln(e))return e.map((r)=>Y(r));else return[Y(e)]}function Y(e){if(Qt(e))return tr(e);else if(Br(e))return e.toOperationNode();else return Fe(e)}function tr(e){if(e.includes(" as ")){let[t,o]=e.split(" as ").map(Dr);return l.create(zt(t),ze.create(o))}else return zt(e)}function zt(e){if(e.includes(".")){let[t,o]=e.split(".").map(Dr);return g.createWithSchema(t,o)}else return g.create(e)}function Dr(e){return e.trim()}function f(e){if(Kt(e))return f(e(q()));else if(Ln(e))return e.map((r)=>Fr(r));else return[Fr(e)]}function Fr(e){if(Qt(e))return se.create(Pr(e));else if(Be(e))return se.create(e.toOperationNode());else return se.create(Fe(e))}function y(e){if(!e)return[se.createSelectAll()];else if(Array.isArray(e))return e.map(vr);else return[vr(e)]}function vr(e){if(Qt(e))return se.createSelectAllFromTable(zt(e));throw Error(`invalid value selectAll expression: ${JSON.stringify(e)}`)}var Vr=p({is(e){return e.kind==="ValuesNode"},create(e){return p({kind:"ValuesNode",values:p(e)})}});var Ur=p({is(e){return e.kind==="DefaultInsertValueNode"},create(){return p({kind:"DefaultInsertValueNode"})}});function ve(e){let r=Kt(e)?e(q()):e,t=Ln(r)?r:p([r]);return gt(t)}function gt(e){let r=Wt(e);return[p([...r.keys()].map(Zt.create)),Vr.create(e.map((t)=>bt(t,r)))]}function Wt(e){let r=new Map;for(let t of e){let o=Object.keys(t);for(let n of o)if(!r.has(n)&&t[n]!==void 0)r.set(n,r.size)}return r}function bt(e,r){let t=Object.keys(e),o=Array.from({length:r.size}),n=!1,u=t.length;for(let Ee of t){let fe=r.get(Ee);if(Fn(fe)){u--;continue}let $e=e[Ee];if(Fn($e)||V($e))n=!0;o[fe]=$e}if(u<r.size||n){let Ee=Ur.create();return $i.create(o.map((fe)=>Fn(fe)?Ee:m(fe)))}return Te.create(o)}var ir=p({is(e){return e.kind==="ColumnUpdateNode"},create(e,r){return p({kind:"ColumnUpdateNode",column:e,value:r})}});function zr(...e){if(e.length===2)return[ir.create(w(e[0]),m(e[1]))];return we(e[0])}function we(e){let r=Kt(e)?e(q()):e;return Object.entries(r).filter(([t,o])=>o!==void 0).map(([t,o])=>ir.create(Zt.create(t),m(o)))}var Jr=p({is(e){return e.kind==="OnDuplicateKeyNode"},create(e){return p({kind:"OnDuplicateKeyNode",updates:e})}});class nr{insertId;numInsertedOrUpdatedRows;constructor(e,r){this.insertId=e,this.numInsertedOrUpdatedRows=r}}class L extends Error{node;constructor(e){super("no result");this.node=e}}function v(e){return Object.prototype.hasOwnProperty.call(e,"prototype")}var x=p({is(e){return e.kind==="OnConflictNode"},create(){return p({kind:"OnConflictNode"})},cloneWith(e,r){return p({...e,...r})},cloneWithIndexWhere(e,r){return p({...e,indexWhere:e.indexWhere?O.cloneWithOperation(e.indexWhere,"And",r):O.create(r)})},cloneWithIndexOrWhere(e,r){return p({...e,indexWhere:e.indexWhere?O.cloneWithOperation(e.indexWhere,"Or",r):O.create(r)})},cloneWithUpdateWhere(e,r){return p({...e,updateWhere:e.updateWhere?O.cloneWithOperation(e.updateWhere,"And",r):O.create(r)})},cloneWithUpdateOrWhere(e,r){return p({...e,updateWhere:e.updateWhere?O.cloneWithOperation(e.updateWhere,"Or",r):O.create(r)})},cloneWithoutIndexWhere(e){return p({...e,indexWhere:void 0})},cloneWithoutUpdateWhere(e){return p({...e,updateWhere:void 0})}});class P{#e;constructor(e){this.#e=p(e)}column(e){let r=Zt.create(e);return new P({...this.#e,onConflictNode:x.cloneWith(this.#e.onConflictNode,{columns:this.#e.onConflictNode.columns?p([...this.#e.onConflictNode.columns,r]):p([r])})})}columns(e){let r=e.map(Zt.create);return new P({...this.#e,onConflictNode:x.cloneWith(this.#e.onConflictNode,{columns:this.#e.onConflictNode.columns?p([...this.#e.onConflictNode.columns,...r]):p(r)})})}constraint(e){return new P({...this.#e,onConflictNode:x.cloneWith(this.#e.onConflictNode,{constraint:ze.create(e)})})}expression(e){return new P({...this.#e,onConflictNode:x.cloneWith(this.#e.onConflictNode,{indexExpression:e.toOperationNode()})})}where(...e){return new P({...this.#e,onConflictNode:x.cloneWithIndexWhere(this.#e.onConflictNode,or(e))})}whereRef(e,r,t){return new P({...this.#e,onConflictNode:x.cloneWithIndexWhere(this.#e.onConflictNode,N(e,r,t))})}clearWhere(){return new P({...this.#e,onConflictNode:x.cloneWithoutIndexWhere(this.#e.onConflictNode)})}doNothing(){return new Qr({...this.#e,onConflictNode:x.cloneWith(this.#e.onConflictNode,{doNothing:!0})})}doUpdateSet(e){return new Oe({...this.#e,onConflictNode:x.cloneWith(this.#e.onConflictNode,{updates:we(e)})})}$call(e){return e(this)}}class Qr{#e;constructor(e){this.#e=p(e)}toOperationNode(){return this.#e.onConflictNode}}class Oe{#e;constructor(e){this.#e=p(e)}where(...e){return new Oe({...this.#e,onConflictNode:x.cloneWithUpdateWhere(this.#e.onConflictNode,or(e))})}whereRef(e,r,t){return new Oe({...this.#e,onConflictNode:x.cloneWithUpdateWhere(this.#e.onConflictNode,N(e,r,t))})}clearWhere(){return new Oe({...this.#e,onConflictNode:x.cloneWithoutUpdateWhere(this.#e.onConflictNode)})}$call(e){return e(this)}toOperationNode(){return this.#e.onConflictNode}}var Ir=p({is(e){return e.kind==="TopNode"},create(e,r){return p({kind:"TopNode",expression:e,modifiers:r})}});function B(e,r){if(!$o(e)&&!di(e))throw Error(`Invalid top expression: ${e}`);if(!Fn(r)&&!St(r))throw Error(`Invalid top modifiers: ${r}`);return Ir.create(e,r)}function St(e){return e==="percent"||e==="with ties"||e==="percent with ties"}var Z=p({is(e){return e.kind==="OrActionNode"},create(e){return p({kind:"OrActionNode",action:e})}});class d{#e;constructor(e){this.#e=p(e)}values(e){let[r,t]=ve(e);return new d({...this.#e,queryNode:kr.cloneWith(this.#e.queryNode,{columns:r,values:t})})}columns(e){return new d({...this.#e,queryNode:kr.cloneWith(this.#e.queryNode,{columns:p(e.map(Zt.create))})})}expression(e){return new d({...this.#e,queryNode:kr.cloneWith(this.#e.queryNode,{values:Ao(e)})})}defaultValues(){return new d({...this.#e,queryNode:kr.cloneWith(this.#e.queryNode,{defaultValues:!0})})}modifyEnd(e){return new d({...this.#e,queryNode:pe.cloneWithEndModifier(this.#e.queryNode,e.toOperationNode())})}ignore(){return new d({...this.#e,queryNode:kr.cloneWith(this.#e.queryNode,{orAction:Z.create("ignore")})})}orIgnore(){return new d({...this.#e,queryNode:kr.cloneWith(this.#e.queryNode,{orAction:Z.create("ignore")})})}orAbort(){return new d({...this.#e,queryNode:kr.cloneWith(this.#e.queryNode,{orAction:Z.create("abort")})})}orFail(){return new d({...this.#e,queryNode:kr.cloneWith(this.#e.queryNode,{orAction:Z.create("fail")})})}orReplace(){return new d({...this.#e,queryNode:kr.cloneWith(this.#e.queryNode,{orAction:Z.create("replace")})})}orRollback(){return new d({...this.#e,queryNode:kr.cloneWith(this.#e.queryNode,{orAction:Z.create("rollback")})})}top(e,r){return new d({...this.#e,queryNode:pe.cloneWithTop(this.#e.queryNode,B(e,r))})}onConflict(e){return new d({...this.#e,queryNode:kr.cloneWith(this.#e.queryNode,{onConflict:e(new P({onConflictNode:x.create()})).toOperationNode()})})}onDuplicateKeyUpdate(e){return new d({...this.#e,queryNode:kr.cloneWith(this.#e.queryNode,{onDuplicateKey:Jr.create(we(e))})})}returning(e){return new d({...this.#e,queryNode:pe.cloneWithReturning(this.#e.queryNode,f(e))})}returningAll(){return new d({...this.#e,queryNode:pe.cloneWithReturning(this.#e.queryNode,y())})}output(e){return new d({...this.#e,queryNode:pe.cloneWithOutput(this.#e.queryNode,f(e))})}outputAll(e){return new d({...this.#e,queryNode:pe.cloneWithOutput(this.#e.queryNode,y(e))})}clearReturning(){return new d({...this.#e,queryNode:pe.cloneWithoutReturning(this.#e.queryNode)})}$call(e){return e(this)}$if(e,r){if(e)return r(this);return new d({...this.#e})}$castTo(){return new d(this.#e)}$narrowType(){return new d(this.#e)}$assertType(){return new d(this.#e)}withPlugin(e){return new d({...this.#e,executor:this.#e.executor.withPlugin(e)})}toOperationNode(){return this.#e.executor.transformQuery(this.#e.queryNode,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){let e=this.compile(),r=await this.#e.executor.executeQuery(e),{adapter:t}=this.#e.executor,o=e.query;if(o.returning&&t.supportsReturning||o.output&&t.supportsOutput)return r.rows;return[new nr(r.insertId,r.numAffectedRows??BigInt(0))]}async executeTakeFirst(){let[e]=await this.execute();return e}async executeTakeFirstOrThrow(e=L){let r=await this.executeTakeFirst();if(r===void 0)throw v(e)?new e(this.toOperationNode()):e(this.toOperationNode());return r}async*stream(e=100){let r=this.compile(),t=this.#e.executor.stream(r,e);for await(let o of t)yield*o.rows}async explain(e,r){return await new d({...this.#e,queryNode:pe.cloneWithExplain(this.#e.queryNode,e,r)}).execute()}}class sr{numDeletedRows;constructor(e){this.numDeletedRows=e}}var ae=p({is(e){return e.kind==="LimitNode"},create(e){return p({kind:"LimitNode",limit:e})}});var c;class Pe{#e;constructor(e){this.#e=p(e)}where(...e){return new c({...this.#e,queryNode:pe.cloneWithWhere(this.#e.queryNode,or(e))})}whereRef(e,r,t){return new c({...this.#e,queryNode:pe.cloneWithWhere(this.#e.queryNode,N(e,r,t))})}clearWhere(){return new c({...this.#e,queryNode:pe.cloneWithoutWhere(this.#e.queryNode)})}top(e,r){return new c({...this.#e,queryNode:pe.cloneWithTop(this.#e.queryNode,B(e,r))})}using(e){return new c({...this.#e,queryNode:_.cloneWithUsing(this.#e.queryNode,A(e))})}innerJoin(...e){return this.#r("InnerJoin",e)}leftJoin(...e){return this.#r("LeftJoin",e)}rightJoin(...e){return this.#r("RightJoin",e)}fullJoin(...e){return this.#r("FullJoin",e)}#r(e,r){return new c({...this.#e,queryNode:pe.cloneWithJoin(this.#e.queryNode,G(e,r))})}returning(e){return new c({...this.#e,queryNode:pe.cloneWithReturning(this.#e.queryNode,f(e))})}returningAll(e){return new c({...this.#e,queryNode:pe.cloneWithReturning(this.#e.queryNode,y(e))})}output(e){return new c({...this.#e,queryNode:pe.cloneWithOutput(this.#e.queryNode,f(e))})}outputAll(e){return new c({...this.#e,queryNode:pe.cloneWithOutput(this.#e.queryNode,y(e))})}clearReturning(){return new c({...this.#e,queryNode:pe.cloneWithoutReturning(this.#e.queryNode)})}clearLimit(){return new c({...this.#e,queryNode:_.cloneWithoutLimit(this.#e.queryNode)})}orderBy(...e){return new c({...this.#e,queryNode:pe.cloneWithOrderByItems(this.#e.queryNode,E(e))})}clearOrderBy(){return new c({...this.#e,queryNode:pe.cloneWithoutOrderBy(this.#e.queryNode)})}limit(e){return new c({...this.#e,queryNode:_.cloneWithLimit(this.#e.queryNode,ae.create(m(e)))})}modifyEnd(e){return new c({...this.#e,queryNode:pe.cloneWithEndModifier(this.#e.queryNode,e.toOperationNode())})}$call(e){return e(this)}$if(e,r){if(e)return r(this);return new c({...this.#e})}$castTo(){return new c(this.#e)}$narrowType(){return new c(this.#e)}$assertType(){return new c(this.#e)}withPlugin(e){return new c({...this.#e,executor:this.#e.executor.withPlugin(e)})}toOperationNode(){return this.#e.executor.transformQuery(this.#e.queryNode,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){let e=this.compile(),r=await this.#e.executor.executeQuery(e),{adapter:t}=this.#e.executor,o=e.query;if(o.returning&&t.supportsReturning||o.output&&t.supportsOutput)return r.rows;return[new sr(r.numAffectedRows??BigInt(0))]}async executeTakeFirst(){let[e]=await this.execute();return e}async executeTakeFirstOrThrow(e=L){let r=await this.executeTakeFirst();if(r===void 0)throw v(e)?new e(this.toOperationNode()):e(this.toOperationNode());return r}async*stream(e=100){let r=this.compile(),t=this.#e.executor.stream(r,e);for await(let o of t)yield*o.rows}async explain(e,r){return await new c({...this.#e,queryNode:pe.cloneWithExplain(this.#e.queryNode,e,r)}).execute()}}c=Pe;class ar{numUpdatedRows;numChangedRows;constructor(e,r){this.numUpdatedRows=e,this.numChangedRows=r}}var h;class ue{#e;constructor(e){this.#e=p(e)}where(...e){return new h({...this.#e,queryNode:pe.cloneWithWhere(this.#e.queryNode,or(e))})}whereRef(e,r,t){return new h({...this.#e,queryNode:pe.cloneWithWhere(this.#e.queryNode,N(e,r,t))})}clearWhere(){return new h({...this.#e,queryNode:pe.cloneWithoutWhere(this.#e.queryNode)})}top(e,r){return new h({...this.#e,queryNode:pe.cloneWithTop(this.#e.queryNode,B(e,r))})}from(e){return new h({...this.#e,queryNode:F.cloneWithFromItems(this.#e.queryNode,A(e))})}innerJoin(...e){return this.#r("InnerJoin",e)}leftJoin(...e){return this.#r("LeftJoin",e)}rightJoin(...e){return this.#r("RightJoin",e)}fullJoin(...e){return this.#r("FullJoin",e)}#r(e,r){return new h({...this.#e,queryNode:pe.cloneWithJoin(this.#e.queryNode,G(e,r))})}orderBy(...e){return new h({...this.#e,queryNode:pe.cloneWithOrderByItems(this.#e.queryNode,E(e))})}clearOrderBy(){return new h({...this.#e,queryNode:pe.cloneWithoutOrderBy(this.#e.queryNode)})}limit(e){return new h({...this.#e,queryNode:F.cloneWithLimit(this.#e.queryNode,ae.create(m(e)))})}set(...e){return new h({...this.#e,queryNode:F.cloneWithUpdates(this.#e.queryNode,zr(...e))})}returning(e){return new h({...this.#e,queryNode:pe.cloneWithReturning(this.#e.queryNode,f(e))})}returningAll(e){return new h({...this.#e,queryNode:pe.cloneWithReturning(this.#e.queryNode,y(e))})}output(e){return new h({...this.#e,queryNode:pe.cloneWithOutput(this.#e.queryNode,f(e))})}outputAll(e){return new h({...this.#e,queryNode:pe.cloneWithOutput(this.#e.queryNode,y(e))})}modifyEnd(e){return new h({...this.#e,queryNode:pe.cloneWithEndModifier(this.#e.queryNode,e.toOperationNode())})}clearReturning(){return new h({...this.#e,queryNode:pe.cloneWithoutReturning(this.#e.queryNode)})}$call(e){return e(this)}$if(e,r){if(e)return r(this);return new h({...this.#e})}$castTo(){return new h(this.#e)}$narrowType(){return new h(this.#e)}$assertType(){return new h(this.#e)}withPlugin(e){return new h({...this.#e,executor:this.#e.executor.withPlugin(e)})}toOperationNode(){return this.#e.executor.transformQuery(this.#e.queryNode,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){let e=this.compile(),r=await this.#e.executor.executeQuery(e),{adapter:t}=this.#e.executor,o=e.query;if(o.returning&&t.supportsReturning||o.output&&t.supportsOutput)return r.rows;return[new ar(r.numAffectedRows??BigInt(0),r.numChangedRows)]}async executeTakeFirst(){let[e]=await this.execute();return e}async executeTakeFirstOrThrow(e=L){let r=await this.executeTakeFirst();if(r===void 0)throw v(e)?new e(this.toOperationNode()):e(this.toOperationNode());return r}async*stream(e=100){let r=this.compile(),t=this.#e.executor.stream(r,e);for await(let o of t)yield*o.rows}async explain(e,r){return await new h({...this.#e,queryNode:pe.cloneWithExplain(this.#e.queryNode,e,r)}).execute()}}h=ue;var ur=p({is(e){return e.kind==="CommonTableExpressionNameNode"},create(e,r){return p({kind:"CommonTableExpressionNameNode",table:g.create(e),columns:r?p(r.map(Zt.create)):void 0})}});var me=p({is(e){return e.kind==="CommonTableExpressionNode"},create(e,r){return p({kind:"CommonTableExpressionNode",name:e,expression:r})},cloneWith(e,r){return p({...e,...r})}});class xe{#e;constructor(e){this.#e=p(e)}materialized(){return new xe({...this.#e,node:me.cloneWith(this.#e.node,{materialized:!0})})}notMaterialized(){return new xe({...this.#e,node:me.cloneWith(this.#e.node,{materialized:!1})})}toOperationNode(){return this.#e.node}}function dr(e,r){let t=r(_r()).toOperationNode();if(Kt(e))return e(kt(t)).toOperationNode();return me.create($r(e),t)}function kt(e){return(r)=>new xe({node:me.create($r(r),e)})}function $r(e){if(e.includes("(")){let r=e.split(/[\(\)]/),t=r[0],o=r[1].split(",").map((n)=>n.trim());return ur.create(t,o)}else return ur.create(e)}var ge=p({is(e){return e.kind==="WithNode"},create(e,r){return p({kind:"WithNode",expressions:p([e]),...r})},cloneWithExpression(e,r){return p({...e,expressions:p([...e.expressions,r])})}});var jr=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"];function Ru(e){let r="";for(let t=0;t<e;++t)r+=Et();return r}function Et(){return jr[~~(Math.random()*jr.length)]}function Je(){return new Gr}class Gr{#e;get queryId(){if(this.#e===void 0)this.#e=Ru(8);return this.#e}}function i(e){return e}class xc{nodeStack=[];#e=p({AliasNode:this.transformAlias.bind(this),ColumnNode:this.transformColumn.bind(this),IdentifierNode:this.transformIdentifier.bind(this),SchemableIdentifierNode:this.transformSchemableIdentifier.bind(this),RawNode:this.transformRaw.bind(this),ReferenceNode:this.transformReference.bind(this),SelectQueryNode:this.transformSelectQuery.bind(this),SelectionNode:this.transformSelection.bind(this),TableNode:this.transformTable.bind(this),FromNode:this.transformFrom.bind(this),SelectAllNode:this.transformSelectAll.bind(this),AndNode:this.transformAnd.bind(this),OrNode:this.transformOr.bind(this),ValueNode:this.transformValue.bind(this),ValueListNode:this.transformValueList.bind(this),PrimitiveValueListNode:this.transformPrimitiveValueList.bind(this),ParensNode:this.transformParens.bind(this),JoinNode:this.transformJoin.bind(this),OperatorNode:this.transformOperator.bind(this),WhereNode:this.transformWhere.bind(this),InsertQueryNode:this.transformInsertQuery.bind(this),DeleteQueryNode:this.transformDeleteQuery.bind(this),ReturningNode:this.transformReturning.bind(this),CreateTableNode:this.transformCreateTable.bind(this),AddColumnNode:this.transformAddColumn.bind(this),ColumnDefinitionNode:this.transformColumnDefinition.bind(this),DropTableNode:this.transformDropTable.bind(this),DataTypeNode:this.transformDataType.bind(this),OrderByNode:this.transformOrderBy.bind(this),OrderByItemNode:this.transformOrderByItem.bind(this),GroupByNode:this.transformGroupBy.bind(this),GroupByItemNode:this.transformGroupByItem.bind(this),UpdateQueryNode:this.transformUpdateQuery.bind(this),ColumnUpdateNode:this.transformColumnUpdate.bind(this),LimitNode:this.transformLimit.bind(this),OffsetNode:this.transformOffset.bind(this),OnConflictNode:this.transformOnConflict.bind(this),OnDuplicateKeyNode:this.transformOnDuplicateKey.bind(this),CreateIndexNode:this.transformCreateIndex.bind(this),DropIndexNode:this.transformDropIndex.bind(this),ListNode:this.transformList.bind(this),PrimaryKeyConstraintNode:this.transformPrimaryKeyConstraint.bind(this),UniqueConstraintNode:this.transformUniqueConstraint.bind(this),ReferencesNode:this.transformReferences.bind(this),CheckConstraintNode:this.transformCheckConstraint.bind(this),WithNode:this.transformWith.bind(this),CommonTableExpressionNode:this.transformCommonTableExpression.bind(this),CommonTableExpressionNameNode:this.transformCommonTableExpressionName.bind(this),HavingNode:this.transformHaving.bind(this),CreateSchemaNode:this.transformCreateSchema.bind(this),DropSchemaNode:this.transformDropSchema.bind(this),AlterTableNode:this.transformAlterTable.bind(this),DropColumnNode:this.transformDropColumn.bind(this),RenameColumnNode:this.transformRenameColumn.bind(this),AlterColumnNode:this.transformAlterColumn.bind(this),ModifyColumnNode:this.transformModifyColumn.bind(this),AddConstraintNode:this.transformAddConstraint.bind(this),DropConstraintNode:this.transformDropConstraint.bind(this),RenameConstraintNode:this.transformRenameConstraint.bind(this),ForeignKeyConstraintNode:this.transformForeignKeyConstraint.bind(this),CreateViewNode:this.transformCreateView.bind(this),RefreshMaterializedViewNode:this.transformRefreshMaterializedView.bind(this),DropViewNode:this.transformDropView.bind(this),GeneratedNode:this.transformGenerated.bind(this),DefaultValueNode:this.transformDefaultValue.bind(this),OnNode:this.transformOn.bind(this),ValuesNode:this.transformValues.bind(this),SelectModifierNode:this.transformSelectModifier.bind(this),CreateTypeNode:this.transformCreateType.bind(this),DropTypeNode:this.transformDropType.bind(this),ExplainNode:this.transformExplain.bind(this),DefaultInsertValueNode:this.transformDefaultInsertValue.bind(this),AggregateFunctionNode:this.transformAggregateFunction.bind(this),OverNode:this.transformOver.bind(this),PartitionByNode:this.transformPartitionBy.bind(this),PartitionByItemNode:this.transformPartitionByItem.bind(this),SetOperationNode:this.transformSetOperation.bind(this),BinaryOperationNode:this.transformBinaryOperation.bind(this),UnaryOperationNode:this.transformUnaryOperation.bind(this),UsingNode:this.transformUsing.bind(this),FunctionNode:this.transformFunction.bind(this),CaseNode:this.transformCase.bind(this),WhenNode:this.transformWhen.bind(this),JSONReferenceNode:this.transformJSONReference.bind(this),JSONPathNode:this.transformJSONPath.bind(this),JSONPathLegNode:this.transformJSONPathLeg.bind(this),JSONOperatorChainNode:this.transformJSONOperatorChain.bind(this),TupleNode:this.transformTuple.bind(this),MergeQueryNode:this.transformMergeQuery.bind(this),MatchedNode:this.transformMatched.bind(this),AddIndexNode:this.transformAddIndex.bind(this),CastNode:this.transformCast.bind(this),FetchNode:this.transformFetch.bind(this),TopNode:this.transformTop.bind(this),OutputNode:this.transformOutput.bind(this),OrActionNode:this.transformOrAction.bind(this),CollateNode:this.transformCollate.bind(this)});transformNode(e,r){if(!e)return e;this.nodeStack.push(e);let t=this.transformNodeImpl(e,r);return this.nodeStack.pop(),p(t)}transformNodeImpl(e,r){return this.#e[e.kind](e,r)}transformNodeList(e,r){if(!e)return e;return p(e.map((t)=>this.transformNode(t,r)))}transformSelectQuery(e,r){return i({kind:"SelectQueryNode",from:this.transformNode(e.from,r),selections:this.transformNodeList(e.selections,r),distinctOn:this.transformNodeList(e.distinctOn,r),joins:this.transformNodeList(e.joins,r),groupBy:this.transformNode(e.groupBy,r),orderBy:this.transformNode(e.orderBy,r),where:this.transformNode(e.where,r),frontModifiers:this.transformNodeList(e.frontModifiers,r),endModifiers:this.transformNodeList(e.endModifiers,r),limit:this.transformNode(e.limit,r),offset:this.transformNode(e.offset,r),with:this.transformNode(e.with,r),having:this.transformNode(e.having,r),explain:this.transformNode(e.explain,r),setOperations:this.transformNodeList(e.setOperations,r),fetch:this.transformNode(e.fetch,r),top:this.transformNode(e.top,r)})}transformSelection(e,r){return i({kind:"SelectionNode",selection:this.transformNode(e.selection,r)})}transformColumn(e,r){return i({kind:"ColumnNode",column:this.transformNode(e.column,r)})}transformAlias(e,r){return i({kind:"AliasNode",node:this.transformNode(e.node,r),alias:this.transformNode(e.alias,r)})}transformTable(e,r){return i({kind:"TableNode",table:this.transformNode(e.table,r)})}transformFrom(e,r){return i({kind:"FromNode",froms:this.transformNodeList(e.froms,r)})}transformReference(e,r){return i({kind:"ReferenceNode",column:this.transformNode(e.column,r),table:this.transformNode(e.table,r)})}transformAnd(e,r){return i({kind:"AndNode",left:this.transformNode(e.left,r),right:this.transformNode(e.right,r)})}transformOr(e,r){return i({kind:"OrNode",left:this.transformNode(e.left,r),right:this.transformNode(e.right,r)})}transformValueList(e,r){return i({kind:"ValueListNode",values:this.transformNodeList(e.values,r)})}transformParens(e,r){return i({kind:"ParensNode",node:this.transformNode(e.node,r)})}transformJoin(e,r){return i({kind:"JoinNode",joinType:e.joinType,table:this.transformNode(e.table,r),on:this.transformNode(e.on,r)})}transformRaw(e,r){return i({kind:"RawNode",sqlFragments:p([...e.sqlFragments]),parameters:this.transformNodeList(e.parameters,r)})}transformWhere(e,r){return i({kind:"WhereNode",where:this.transformNode(e.where,r)})}transformInsertQuery(e,r){return i({kind:"InsertQueryNode",into:this.transformNode(e.into,r),columns:this.transformNodeList(e.columns,r),values:this.transformNode(e.values,r),returning:this.transformNode(e.returning,r),onConflict:this.transformNode(e.onConflict,r),onDuplicateKey:this.transformNode(e.onDuplicateKey,r),endModifiers:this.transformNodeList(e.endModifiers,r),with:this.transformNode(e.with,r),ignore:e.ignore,orAction:this.transformNode(e.orAction,r),replace:e.replace,explain:this.transformNode(e.explain,r),defaultValues:e.defaultValues,top:this.transformNode(e.top,r),output:this.transformNode(e.output,r)})}transformValues(e,r){return i({kind:"ValuesNode",values:this.transformNodeList(e.values,r)})}transformDeleteQuery(e,r){return i({kind:"DeleteQueryNode",from:this.transformNode(e.from,r),using:this.transformNode(e.using,r),joins:this.transformNodeList(e.joins,r),where:this.transformNode(e.where,r),returning:this.transformNode(e.returning,r),endModifiers:this.transformNodeList(e.endModifiers,r),with:this.transformNode(e.with,r),orderBy:this.transformNode(e.orderBy,r),limit:this.transformNode(e.limit,r),explain:this.transformNode(e.explain,r),top:this.transformNode(e.top,r),output:this.transformNode(e.output,r)})}transformReturning(e,r){return i({kind:"ReturningNode",selections:this.transformNodeList(e.selections,r)})}transformCreateTable(e,r){return i({kind:"CreateTableNode",table:this.transformNode(e.table,r),columns:this.transformNodeList(e.columns,r),constraints:this.transformNodeList(e.constraints,r),temporary:e.temporary,ifNotExists:e.ifNotExists,onCommit:e.onCommit,frontModifiers:this.transformNodeList(e.frontModifiers,r),endModifiers:this.transformNodeList(e.endModifiers,r),selectQuery:this.transformNode(e.selectQuery,r)})}transformColumnDefinition(e,r){return i({kind:"ColumnDefinitionNode",column:this.transformNode(e.column,r),dataType:this.transformNode(e.dataType,r),references:this.transformNode(e.references,r),primaryKey:e.primaryKey,autoIncrement:e.autoIncrement,unique:e.unique,notNull:e.notNull,unsigned:e.unsigned,defaultTo:this.transformNode(e.defaultTo,r),check:this.transformNode(e.check,r),generated:this.transformNode(e.generated,r),frontModifiers:this.transformNodeList(e.frontModifiers,r),endModifiers:this.transformNodeList(e.endModifiers,r),nullsNotDistinct:e.nullsNotDistinct,identity:e.identity,ifNotExists:e.ifNotExists})}transformAddColumn(e,r){return i({kind:"AddColumnNode",column:this.transformNode(e.column,r)})}transformDropTable(e,r){return i({kind:"DropTableNode",table:this.transformNode(e.table,r),ifExists:e.ifExists,cascade:e.cascade})}transformOrderBy(e,r){return i({kind:"OrderByNode",items:this.transformNodeList(e.items,r)})}transformOrderByItem(e,r){return i({kind:"OrderByItemNode",orderBy:this.transformNode(e.orderBy,r),direction:this.transformNode(e.direction,r),collation:this.transformNode(e.collation,r),nulls:e.nulls})}transformGroupBy(e,r){return i({kind:"GroupByNode",items:this.transformNodeList(e.items,r)})}transformGroupByItem(e,r){return i({kind:"GroupByItemNode",groupBy:this.transformNode(e.groupBy,r)})}transformUpdateQuery(e,r){return i({kind:"UpdateQueryNode",table:this.transformNode(e.table,r),from:this.transformNode(e.from,r),joins:this.transformNodeList(e.joins,r),where:this.transformNode(e.where,r),updates:this.transformNodeList(e.updates,r),returning:this.transformNode(e.returning,r),endModifiers:this.transformNodeList(e.endModifiers,r),with:this.transformNode(e.with,r),explain:this.transformNode(e.explain,r),limit:this.transformNode(e.limit,r),top:this.transformNode(e.top,r),output:this.transformNode(e.output,r),orderBy:this.transformNode(e.orderBy,r)})}transformColumnUpdate(e,r){return i({kind:"ColumnUpdateNode",column:this.transformNode(e.column,r),value:this.transformNode(e.value,r)})}transformLimit(e,r){return i({kind:"LimitNode",limit:this.transformNode(e.limit,r)})}transformOffset(e,r){return i({kind:"OffsetNode",offset:this.transformNode(e.offset,r)})}transformOnConflict(e,r){return i({kind:"OnConflictNode",columns:this.transformNodeList(e.columns,r),constraint:this.transformNode(e.constraint,r),indexExpression:this.transformNode(e.indexExpression,r),indexWhere:this.transformNode(e.indexWhere,r),updates:this.transformNodeList(e.updates,r),updateWhere:this.transformNode(e.updateWhere,r),doNothing:e.doNothing})}transformOnDuplicateKey(e,r){return i({kind:"OnDuplicateKeyNode",updates:this.transformNodeList(e.updates,r)})}transformCreateIndex(e,r){return i({kind:"CreateIndexNode",name:this.transformNode(e.name,r),table:this.transformNode(e.table,r),columns:this.transformNodeList(e.columns,r),unique:e.unique,using:this.transformNode(e.using,r),ifNotExists:e.ifNotExists,where:this.transformNode(e.where,r),nullsNotDistinct:e.nullsNotDistinct})}transformList(e,r){return i({kind:"ListNode",items:this.transformNodeList(e.items,r)})}transformDropIndex(e,r){return i({kind:"DropIndexNode",name:this.transformNode(e.name,r),table:this.transformNode(e.table,r),ifExists:e.ifExists,cascade:e.cascade})}transformPrimaryKeyConstraint(e,r){return i({kind:"PrimaryKeyConstraintNode",columns:this.transformNodeList(e.columns,r),name:this.transformNode(e.name,r),deferrable:e.deferrable,initiallyDeferred:e.initiallyDeferred})}transformUniqueConstraint(e,r){return i({kind:"UniqueConstraintNode",columns:this.transformNodeList(e.columns,r),name:this.transformNode(e.name,r),nullsNotDistinct:e.nullsNotDistinct,deferrable:e.deferrable,initiallyDeferred:e.initiallyDeferred})}transformForeignKeyConstraint(e,r){return i({kind:"ForeignKeyConstraintNode",columns:this.transformNodeList(e.columns,r),references:this.transformNode(e.references,r),name:this.transformNode(e.name,r),onDelete:e.onDelete,onUpdate:e.onUpdate,deferrable:e.deferrable,initiallyDeferred:e.initiallyDeferred})}transformSetOperation(e,r){return i({kind:"SetOperationNode",operator:e.operator,expression:this.transformNode(e.expression,r),all:e.all})}transformReferences(e,r){return i({kind:"ReferencesNode",table:this.transformNode(e.table,r),columns:this.transformNodeList(e.columns,r),onDelete:e.onDelete,onUpdate:e.onUpdate})}transformCheckConstraint(e,r){return i({kind:"CheckConstraintNode",expression:this.transformNode(e.expression,r),name:this.transformNode(e.name,r)})}transformWith(e,r){return i({kind:"WithNode",expressions:this.transformNodeList(e.expressions,r),recursive:e.recursive})}transformCommonTableExpression(e,r){return i({kind:"CommonTableExpressionNode",name:this.transformNode(e.name,r),materialized:e.materialized,expression:this.transformNode(e.expression,r)})}transformCommonTableExpressionName(e,r){return i({kind:"CommonTableExpressionNameNode",table:this.transformNode(e.table,r),columns:this.transformNodeList(e.columns,r)})}transformHaving(e,r){return i({kind:"HavingNode",having:this.transformNode(e.having,r)})}transformCreateSchema(e,r){return i({kind:"CreateSchemaNode",schema:this.transformNode(e.schema,r),ifNotExists:e.ifNotExists})}transformDropSchema(e,r){return i({kind:"DropSchemaNode",schema:this.transformNode(e.schema,r),ifExists:e.ifExists,cascade:e.cascade})}transformAlterTable(e,r){return i({kind:"AlterTableNode",table:this.transformNode(e.table,r),renameTo:this.transformNode(e.renameTo,r),setSchema:this.transformNode(e.setSchema,r),columnAlterations:this.transformNodeList(e.columnAlterations,r),addConstraint:this.transformNode(e.addConstraint,r),dropConstraint:this.transformNode(e.dropConstraint,r),renameConstraint:this.transformNode(e.renameConstraint,r),addIndex:this.transformNode(e.addIndex,r),dropIndex:this.transformNode(e.dropIndex,r)})}transformDropColumn(e,r){return i({kind:"DropColumnNode",column:this.transformNode(e.column,r)})}transformRenameColumn(e,r){return i({kind:"RenameColumnNode",column:this.transformNode(e.column,r),renameTo:this.transformNode(e.renameTo,r)})}transformAlterColumn(e,r){return i({kind:"AlterColumnNode",column:this.transformNode(e.column,r),dataType:this.transformNode(e.dataType,r),dataTypeExpression:this.transformNode(e.dataTypeExpression,r),setDefault:this.transformNode(e.setDefault,r),dropDefault:e.dropDefault,setNotNull:e.setNotNull,dropNotNull:e.dropNotNull})}transformModifyColumn(e,r){return i({kind:"ModifyColumnNode",column:this.transformNode(e.column,r)})}transformAddConstraint(e,r){return i({kind:"AddConstraintNode",constraint:this.transformNode(e.constraint,r)})}transformDropConstraint(e,r){return i({kind:"DropConstraintNode",constraintName:this.transformNode(e.constraintName,r),ifExists:e.ifExists,modifier:e.modifier})}transformRenameConstraint(e,r){return i({kind:"RenameConstraintNode",oldName:this.transformNode(e.oldName,r),newName:this.transformNode(e.newName,r)})}transformCreateView(e,r){return i({kind:"CreateViewNode",name:this.transformNode(e.name,r),temporary:e.temporary,orReplace:e.orReplace,ifNotExists:e.ifNotExists,materialized:e.materialized,columns:this.transformNodeList(e.columns,r),as:this.transformNode(e.as,r)})}transformRefreshMaterializedView(e,r){return i({kind:"RefreshMaterializedViewNode",name:this.transformNode(e.name,r),concurrently:e.concurrently,withNoData:e.withNoData})}transformDropView(e,r){return i({kind:"DropViewNode",name:this.transformNode(e.name,r),ifExists:e.ifExists,materialized:e.materialized,cascade:e.cascade})}transformGenerated(e,r){return i({kind:"GeneratedNode",byDefault:e.byDefault,always:e.always,identity:e.identity,stored:e.stored,expression:this.transformNode(e.expression,r)})}transformDefaultValue(e,r){return i({kind:"DefaultValueNode",defaultValue:this.transformNode(e.defaultValue,r)})}transformOn(e,r){return i({kind:"OnNode",on:this.transformNode(e.on,r)})}transformSelectModifier(e,r){return i({kind:"SelectModifierNode",modifier:e.modifier,rawModifier:this.transformNode(e.rawModifier,r),of:this.transformNodeList(e.of,r)})}transformCreateType(e,r){return i({kind:"CreateTypeNode",name:this.transformNode(e.name,r),enum:this.transformNode(e.enum,r)})}transformDropType(e,r){return i({kind:"DropTypeNode",name:this.transformNode(e.name,r),ifExists:e.ifExists})}transformExplain(e,r){return i({kind:"ExplainNode",format:e.format,options:this.transformNode(e.options,r)})}transformSchemableIdentifier(e,r){return i({kind:"SchemableIdentifierNode",schema:this.transformNode(e.schema,r),identifier:this.transformNode(e.identifier,r)})}transformAggregateFunction(e,r){return i({kind:"AggregateFunctionNode",func:e.func,aggregated:this.transformNodeList(e.aggregated,r),distinct:e.distinct,orderBy:this.transformNode(e.orderBy,r),withinGroup:this.transformNode(e.withinGroup,r),filter:this.transformNode(e.filter,r),over:this.transformNode(e.over,r)})}transformOver(e,r){return i({kind:"OverNode",orderBy:this.transformNode(e.orderBy,r),partitionBy:this.transformNode(e.partitionBy,r)})}transformPartitionBy(e,r){return i({kind:"PartitionByNode",items:this.transformNodeList(e.items,r)})}transformPartitionByItem(e,r){return i({kind:"PartitionByItemNode",partitionBy:this.transformNode(e.partitionBy,r)})}transformBinaryOperation(e,r){return i({kind:"BinaryOperationNode",leftOperand:this.transformNode(e.leftOperand,r),operator:this.transformNode(e.operator,r),rightOperand:this.transformNode(e.rightOperand,r)})}transformUnaryOperation(e,r){return i({kind:"UnaryOperationNode",operator:this.transformNode(e.operator,r),operand:this.transformNode(e.operand,r)})}transformUsing(e,r){return i({kind:"UsingNode",tables:this.transformNodeList(e.tables,r)})}transformFunction(e,r){return i({kind:"FunctionNode",func:e.func,arguments:this.transformNodeList(e.arguments,r)})}transformCase(e,r){return i({kind:"CaseNode",value:this.transformNode(e.value,r),when:this.transformNodeList(e.when,r),else:this.transformNode(e.else,r),isStatement:e.isStatement})}transformWhen(e,r){return i({kind:"WhenNode",condition:this.transformNode(e.condition,r),result:this.transformNode(e.result,r)})}transformJSONReference(e,r){return i({kind:"JSONReferenceNode",reference:this.transformNode(e.reference,r),traversal:this.transformNode(e.traversal,r)})}transformJSONPath(e,r){return i({kind:"JSONPathNode",inOperator:this.transformNode(e.inOperator,r),pathLegs:this.transformNodeList(e.pathLegs,r)})}transformJSONPathLeg(e,r){return i({kind:"JSONPathLegNode",type:e.type,value:e.value})}transformJSONOperatorChain(e,r){return i({kind:"JSONOperatorChainNode",operator:this.transformNode(e.operator,r),values:this.transformNodeList(e.values,r)})}transformTuple(e,r){return i({kind:"TupleNode",values:this.transformNodeList(e.values,r)})}transformMergeQuery(e,r){return i({kind:"MergeQueryNode",into:this.transformNode(e.into,r),using:this.transformNode(e.using,r),whens:this.transformNodeList(e.whens,r),with:this.transformNode(e.with,r),top:this.transformNode(e.top,r),endModifiers:this.transformNodeList(e.endModifiers,r),output:this.transformNode(e.output,r),returning:this.transformNode(e.returning,r)})}transformMatched(e,r){return i({kind:"MatchedNode",not:e.not,bySource:e.bySource})}transformAddIndex(e,r){return i({kind:"AddIndexNode",name:this.transformNode(e.name,r),columns:this.transformNodeList(e.columns,r),unique:e.unique,using:this.transformNode(e.using,r),ifNotExists:e.ifNotExists})}transformCast(e,r){return i({kind:"CastNode",expression:this.transformNode(e.expression,r),dataType:this.transformNode(e.dataType,r)})}transformFetch(e,r){return i({kind:"FetchNode",rowCount:this.transformNode(e.rowCount,r),modifier:e.modifier})}transformTop(e,r){return i({kind:"TopNode",expression:e.expression,modifiers:e.modifiers})}transformOutput(e,r){return i({kind:"OutputNode",selections:this.transformNodeList(e.selections,r)})}transformDataType(e,r){return e}transformSelectAll(e,r){return e}transformIdentifier(e,r){return e}transformValue(e,r){return e}transformPrimitiveValueList(e,r){return e}transformOperator(e,r){return e}transformDefaultInsertValue(e,r){return e}transformOrAction(e,r){return e}transformCollate(e,r){return e}}var Ct=p({AlterTableNode:!0,CreateIndexNode:!0,CreateSchemaNode:!0,CreateTableNode:!0,CreateTypeNode:!0,CreateViewNode:!0,RefreshMaterializedViewNode:!0,DeleteQueryNode:!0,DropIndexNode:!0,DropSchemaNode:!0,DropTableNode:!0,DropTypeNode:!0,DropViewNode:!0,InsertQueryNode:!0,RawNode:!0,SelectQueryNode:!0,UpdateQueryNode:!0,MergeQueryNode:!0}),Rt={json_agg:!0,to_json:!0};class cr extends xc{#e;#r=new Set;#t=new Set;constructor(e){super();this.#e=e}transformNodeImpl(e,r){if(!this.#s(e))return super.transformNodeImpl(e,r);let t=this.#u(e);for(let u of t)this.#t.add(u);let o=this.#a(e);for(let u of o)this.#r.add(u);let n=super.transformNodeImpl(e,r);for(let u of o)this.#r.delete(u);for(let u of t)this.#t.delete(u);return n}transformSchemableIdentifier(e,r){let t=super.transformSchemableIdentifier(e,r);if(t.schema||!this.#r.has(e.identifier.name))return t;return{...t,schema:ze.create(this.#e)}}transformReferences(e,r){let t=super.transformReferences(e,r);if(t.table.table.schema)return t;return{...t,table:g.createWithSchema(this.#e,t.table.table.identifier.name)}}transformAggregateFunction(e,r){return{...super.transformAggregateFunction({...e,aggregated:[]},r),aggregated:this.#i(e,r,"aggregated")}}transformFunction(e,r){return{...super.transformFunction({...e,arguments:[]},r),arguments:this.#i(e,r,"arguments")}}transformSelectModifier(e,r){return{...super.transformSelectModifier({...e,of:void 0},r),of:e.of?.map((t)=>g.is(t)&&!t.table.schema?{...t,table:this.transformIdentifier(t.table.identifier,r)}:this.transformNode(t,r))}}#i(e,r,t){return Rt[e.func]?e[t].map((o)=>!g.is(o)||o.table.schema?this.transformNode(o,r):{...o,table:this.transformIdentifier(o.table.identifier,r)}):this.transformNodeList(e[t],r)}#s(e){return e.kind in Ct}#a(e){let r=new Set;if("name"in e&&e.name&&En.is(e.name))this.#n(e.name,r);if("from"in e&&e.from)for(let t of e.from.froms)this.#o(t,r);if("into"in e&&e.into)this.#o(e.into,r);if("table"in e&&e.table)this.#o(e.table,r);if("joins"in e&&e.joins)for(let t of e.joins)this.#o(t.table,r);if("using"in e&&e.using)if(R.is(e.using))this.#o(e.using.table,r);else this.#o(e.using,r);return r}#u(e){let r=new Set;if("with"in e&&e.with)this.#m(e.with,r);return r}#o(e,r){if(g.is(e))return this.#n(e.table,r);if(l.is(e)&&g.is(e.node))return this.#n(e.node.table,r);if(Le.is(e)){for(let t of e.items)this.#o(t,r);return}if(ye.is(e)){for(let t of e.tables)this.#o(t,r);return}}#n(e,r){let t=e.identifier.name;if(!this.#r.has(t)&&!this.#t.has(t))r.add(t)}#m(e,r){for(let t of e.expressions){let o=t.name.table.table.identifier.name;if(!this.#t.has(o))r.add(o)}}}class cs{#e;constructor(e){this.#e=new cr(e)}transformQuery(e){return this.#e.transformNode(e.node,e.queryId)}async transformResult(e){return e.result}}var Kr=p({is(e){return e.kind==="MatchedNode"},create(e,r=!1){return p({kind:"MatchedNode",not:e,bySource:r})}});function hr(e,r,t){return Go.create(oe([Kr.create(!e.isMatched,e.bySource),...r&&r.length>0?[r.length===3&&t?N(r[0],r[1],r[2]):or(r)]:[]],"and",!1))}function de(e){if(Qt(e))return Bt.create([e],[]);if(pr(e))return e.toOperationNode();return e}class Gi{#e;#r;#t;constructor(){this.#e=new Promise((e,r)=>{this.#t=r,this.#r=e})}get promise(){return this.#e}resolve=(e)=>{if(this.#r)this.#r(e)};reject=(e)=>{if(this.#t)this.#t(e)}}async function Pu(e){let r=new Gi,t=new Gi;return e.provideConnection(async(o)=>(r.resolve(o),await t.promise)).catch((o)=>r.reject(o)),p({connection:await r.promise,release:t.resolve})}var Tt=p([]);class Sc{#e;constructor(e=Tt){this.#e=e}get plugins(){return this.#e}transformQuery(e,r){for(let t of this.#e){let o=t.transformQuery({node:e,queryId:r});if(o.kind===e.kind)e=o;else throw Error(["KyselyPlugin.transformQuery must return a node","of the same kind that was given to it.",`The plugin was given a ${e.kind}`,`but it returned a ${o.kind}`].join(" "))}return e}async executeQuery(e){return await this.provideConnection(async(r)=>{let t=await r.executeQuery(e);if("numUpdatedOrDeletedRows"in t)ds("kysely:warning: outdated driver/plugin detected! `QueryResult.numUpdatedOrDeletedRows` has been replaced with `QueryResult.numAffectedRows`.");return await this.#r(t,e.queryId)})}async*stream(e,r){let{connection:t,release:o}=await Pu(this);try{for await(let n of t.streamQuery(e,r))yield await this.#r(n,e.queryId)}finally{o()}}async#r(e,r){for(let t of this.#e)e=await t.transformResult({result:e,queryId:r});return e}}class ce extends Sc{get adapter(){throw Error("this query cannot be compiled to SQL")}compileQuery(){throw Error("this query cannot be compiled to SQL")}provideConnection(){throw Error("this query cannot be executed")}withConnectionProvider(){throw Error("this query cannot have a connection provider")}withPlugin(e){return new ce([...this.plugins,e])}withPlugins(e){return new ce([...this.plugins,...e])}withPluginAtFront(e){return new ce([e,...this.plugins])}withoutPlugins(){return new ce([])}}var K=new ce;class fr{numChangedRows;constructor(e){this.numChangedRows=e}}class J{#e;constructor(e){this.#e=p(e)}modifyEnd(e){return new J({...this.#e,queryNode:pe.cloneWithEndModifier(this.#e.queryNode,e.toOperationNode())})}top(e,r){return new J({...this.#e,queryNode:pe.cloneWithTop(this.#e.queryNode,B(e,r))})}using(...e){return new b({...this.#e,queryNode:k.cloneWithUsing(this.#e.queryNode,G("Using",e))})}returning(e){return new J({...this.#e,queryNode:pe.cloneWithReturning(this.#e.queryNode,f(e))})}returningAll(e){return new J({...this.#e,queryNode:pe.cloneWithReturning(this.#e.queryNode,y(e))})}output(e){return new J({...this.#e,queryNode:pe.cloneWithOutput(this.#e.queryNode,f(e))})}outputAll(e){return new J({...this.#e,queryNode:pe.cloneWithOutput(this.#e.queryNode,y(e))})}}class b{#e;constructor(e){this.#e=p(e)}modifyEnd(e){return new b({...this.#e,queryNode:pe.cloneWithEndModifier(this.#e.queryNode,e.toOperationNode())})}top(e,r){return new b({...this.#e,queryNode:pe.cloneWithTop(this.#e.queryNode,B(e,r))})}whenMatched(){return this.#r([])}whenMatchedAnd(...e){return this.#r(e)}whenMatchedAndRef(e,r,t){return this.#r([e,r,t],!0)}#r(e,r){return new lr({...this.#e,queryNode:k.cloneWithWhen(this.#e.queryNode,hr({isMatched:!0},e,r))})}whenNotMatched(){return this.#t([])}whenNotMatchedAnd(...e){return this.#t(e)}whenNotMatchedAndRef(e,r,t){return this.#t([e,r,t],!0)}whenNotMatchedBySource(){return this.#t([],!1,!0)}whenNotMatchedBySourceAnd(...e){return this.#t(e,!1,!0)}whenNotMatchedBySourceAndRef(e,r,t){return this.#t([e,r,t],!0,!0)}returning(e){return new b({...this.#e,queryNode:pe.cloneWithReturning(this.#e.queryNode,f(e))})}returningAll(e){return new b({...this.#e,queryNode:pe.cloneWithReturning(this.#e.queryNode,y(e))})}output(e){return new b({...this.#e,queryNode:pe.cloneWithOutput(this.#e.queryNode,f(e))})}outputAll(e){return new b({...this.#e,queryNode:pe.cloneWithOutput(this.#e.queryNode,y(e))})}#t(e,r=!1,t=!1){let o={...this.#e,queryNode:k.cloneWithWhen(this.#e.queryNode,hr({isMatched:!1,bySource:t},e,r))};return new(t?lr:Xr)(o)}$call(e){return e(this)}$if(e,r){if(e)return r(this);return new b({...this.#e})}toOperationNode(){return this.#e.executor.transformQuery(this.#e.queryNode,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){let e=this.compile(),r=await this.#e.executor.executeQuery(e),{adapter:t}=this.#e.executor,o=e.query;if(o.returning&&t.supportsReturning||o.output&&t.supportsOutput)return r.rows;return[new fr(r.numAffectedRows)]}async executeTakeFirst(){let[e]=await this.execute();return e}async executeTakeFirstOrThrow(e=L){let r=await this.executeTakeFirst();if(r===void 0)throw v(e)?new e(this.toOperationNode()):e(this.toOperationNode());return r}}class lr{#e;constructor(e){this.#e=p(e)}thenDelete(){return new b({...this.#e,queryNode:k.cloneWithThen(this.#e.queryNode,de("delete"))})}thenDoNothing(){return new b({...this.#e,queryNode:k.cloneWithThen(this.#e.queryNode,de("do nothing"))})}thenUpdate(e){return new b({...this.#e,queryNode:k.cloneWithThen(this.#e.queryNode,de(e(new ue({queryId:this.#e.queryId,executor:K,queryNode:F.createWithoutTable()}))))})}thenUpdateSet(...e){return this.thenUpdate((r)=>r.set(...e))}}class Xr{#e;constructor(e){this.#e=p(e)}thenDoNothing(){return new b({...this.#e,queryNode:k.cloneWithThen(this.#e.queryNode,de("do nothing"))})}thenInsertValues(e){let[r,t]=ve(e);return new b({...this.#e,queryNode:k.cloneWithThen(this.#e.queryNode,de(kr.cloneWith(kr.createWithoutInto(),{columns:r,values:t})))})}}class Ns{#e;constructor(e){this.#e=p(e)}selectFrom(e){return We({queryId:Je(),executor:this.#e.executor,queryNode:Gt.createFrom(A(e),this.#e.withNode)})}selectNoFrom(e){return We({queryId:Je(),executor:this.#e.executor,queryNode:Gt.cloneWithSelections(Gt.create(this.#e.withNode),f(e))})}insertInto(e){return new d({queryId:Je(),executor:this.#e.executor,queryNode:kr.create(zt(e),this.#e.withNode)})}replaceInto(e){return new d({queryId:Je(),executor:this.#e.executor,queryNode:kr.create(zt(e),this.#e.withNode,!0)})}deleteFrom(e){return new Pe({queryId:Je(),executor:this.#e.executor,queryNode:_.create(A(e),this.#e.withNode)})}updateTable(e){return new ue({queryId:Je(),executor:this.#e.executor,queryNode:F.create(A(e),this.#e.withNode)})}mergeInto(e){return new J({queryId:Je(),executor:this.#e.executor,queryNode:k.create(tr(e),this.#e.withNode)})}with(e,r){let t=dr(e,r);return new Ns({...this.#e,withNode:this.#e.withNode?ge.cloneWithExpression(this.#e.withNode,t):ge.create(t)})}withRecursive(e,r){let t=dr(e,r);return new Ns({...this.#e,withNode:this.#e.withNode?ge.cloneWithExpression(this.#e.withNode,t):ge.create(t,{recursive:!0})})}withPlugin(e){return new Ns({...this.#e,executor:this.#e.executor.withPlugin(e)})}withoutPlugins(){return new Ns({...this.#e,executor:this.#e.executor.withoutPlugins()})}withSchema(e){return new Ns({...this.#e,executor:this.#e.executor.withPluginAtFront(new cs(e))})}}function _r(){return new Ns({executor:K})}function Yr(e,r){return new ie({joinNode:R.create(e,Y(r))})}function Zr(){return new ne({overNode:Ne.create()})}function G(e,r){if(r.length===3)return qt(e,r[0],r[1],r[2]);else if(r.length===2)return At(e,r[0],r[1]);else if(r.length===1)return Lt(e,r[0]);else throw Error("not implemented")}function At(e,r,t){return t(Yr(e,r)).toOperationNode()}function qt(e,r,t,o){return R.createWithOn(e,Y(r),N(t,"=",o))}function Lt(e,r){return R.create(e,Y(r))}var et=p({is(e){return e.kind==="OffsetNode"},create(e){return p({kind:"OffsetNode",offset:e})}});var rt=p({is(e){return e.kind==="GroupByItemNode"},create(e){return p({kind:"GroupByItemNode",groupBy:e})}});function tt(e){return e=Kt(e)?e(q()):e,z(e).map(rt.create)}function ee(e,r,t){if(Kt(r))r=r(Me());if(!Ln(r))r=[r];return r.map((o)=>Ou.create(e,Ao(o),t))}class a{#e;constructor(e){this.#e=e}get expressionType(){return}as(e){return new Qe(this,e)}or(...e){return new Ve(C.create(this.#e,or(e)))}and(...e){return new Ue(W.create(this.#e,or(e)))}$castTo(){return new a(this.#e)}$notNull(){return new a(this.#e)}toOperationNode(){return this.#e}}class Qe{#e;#r;constructor(e,r){this.#e=e,this.#r=r}get expression(){return this.#e}get alias(){return this.#r}toOperationNode(){return l.create(this.#e.toOperationNode(),pr(this.#r)?this.#r.toOperationNode():ze.create(this.#r))}}class Ve{#e;constructor(e){this.#e=e}get expressionType(){return}as(e){return new Qe(this,e)}or(...e){return new Ve(C.create(this.#e,or(e)))}$castTo(){return new Ve(this.#e)}toOperationNode(){return Oo.create(this.#e)}}class Ue{#e;constructor(e){this.#e=e}get expressionType(){return}as(e){return new Qe(this,e)}and(...e){return new Ue(W.create(this.#e,or(e)))}$castTo(){return new Ue(this.#e)}toOperationNode(){return Oo.create(this.#e)}}var ot=p({is(e){return e.kind==="FetchNode"},create(e,r){return{kind:"FetchNode",rowCount:Hr.create(e),modifier:r}}});function it(e,r){if(!$o(e)&&!di(e))throw Error(`Invalid fetch row count: ${e}`);if(!Dt(r))throw Error(`Invalid fetch modifier: ${r}`);return ot.create(e,r)}function Dt(e){return e==="only"||e==="with ties"}var s;class Nr{#e;constructor(e){this.#e=p(e)}get expressionType(){return}get isSelectQueryBuilder(){return!0}where(...e){return new s({...this.#e,queryNode:pe.cloneWithWhere(this.#e.queryNode,or(e))})}whereRef(e,r,t){return new s({...this.#e,queryNode:pe.cloneWithWhere(this.#e.queryNode,N(e,r,t))})}having(...e){return new s({...this.#e,queryNode:Gt.cloneWithHaving(this.#e.queryNode,or(e))})}havingRef(e,r,t){return new s({...this.#e,queryNode:Gt.cloneWithHaving(this.#e.queryNode,N(e,r,t))})}select(e){return new s({...this.#e,queryNode:Gt.cloneWithSelections(this.#e.queryNode,f(e))})}distinctOn(e){return new s({...this.#e,queryNode:Gt.cloneWithDistinctOn(this.#e.queryNode,z(e))})}modifyFront(e){return new s({...this.#e,queryNode:Gt.cloneWithFrontModifier(this.#e.queryNode,D.createWithExpression(e.toOperationNode()))})}modifyEnd(e){return new s({...this.#e,queryNode:pe.cloneWithEndModifier(this.#e.queryNode,D.createWithExpression(e.toOperationNode()))})}distinct(){return new s({...this.#e,queryNode:Gt.cloneWithFrontModifier(this.#e.queryNode,D.create("Distinct"))})}forUpdate(e){return new s({...this.#e,queryNode:pe.cloneWithEndModifier(this.#e.queryNode,D.create("ForUpdate",e?Cc(e).map(zt):void 0))})}forShare(e){return new s({...this.#e,queryNode:pe.cloneWithEndModifier(this.#e.queryNode,D.create("ForShare",e?Cc(e).map(zt):void 0))})}forKeyShare(e){return new s({...this.#e,queryNode:pe.cloneWithEndModifier(this.#e.queryNode,D.create("ForKeyShare",e?Cc(e).map(zt):void 0))})}forNoKeyUpdate(e){return new s({...this.#e,queryNode:pe.cloneWithEndModifier(this.#e.queryNode,D.create("ForNoKeyUpdate",e?Cc(e).map(zt):void 0))})}skipLocked(){return new s({...this.#e,queryNode:pe.cloneWithEndModifier(this.#e.queryNode,D.create("SkipLocked"))})}noWait(){return new s({...this.#e,queryNode:pe.cloneWithEndModifier(this.#e.queryNode,D.create("NoWait"))})}selectAll(e){return new s({...this.#e,queryNode:Gt.cloneWithSelections(this.#e.queryNode,y(e))})}innerJoin(...e){return this.#r("InnerJoin",e)}leftJoin(...e){return this.#r("LeftJoin",e)}rightJoin(...e){return this.#r("RightJoin",e)}fullJoin(...e){return this.#r("FullJoin",e)}crossJoin(...e){return this.#r("CrossJoin",e)}innerJoinLateral(...e){return this.#r("LateralInnerJoin",e)}leftJoinLateral(...e){return this.#r("LateralLeftJoin",e)}crossJoinLateral(...e){return this.#r("LateralCrossJoin",e)}crossApply(...e){return this.#r("CrossApply",e)}outerApply(...e){return this.#r("OuterApply",e)}#r(e,r){return new s({...this.#e,queryNode:pe.cloneWithJoin(this.#e.queryNode,G(e,r))})}orderBy(...e){return new s({...this.#e,queryNode:pe.cloneWithOrderByItems(this.#e.queryNode,E(e))})}groupBy(e){return new s({...this.#e,queryNode:Gt.cloneWithGroupByItems(this.#e.queryNode,tt(e))})}limit(e){return new s({...this.#e,queryNode:Gt.cloneWithLimit(this.#e.queryNode,ae.create(m(e)))})}offset(e){return new s({...this.#e,queryNode:Gt.cloneWithOffset(this.#e.queryNode,et.create(m(e)))})}fetch(e,r="only"){return new s({...this.#e,queryNode:Gt.cloneWithFetch(this.#e.queryNode,it(e,r))})}top(e,r){return new s({...this.#e,queryNode:pe.cloneWithTop(this.#e.queryNode,B(e,r))})}union(e){return new s({...this.#e,queryNode:Gt.cloneWithSetOperations(this.#e.queryNode,ee("union",e,!1))})}unionAll(e){return new s({...this.#e,queryNode:Gt.cloneWithSetOperations(this.#e.queryNode,ee("union",e,!0))})}intersect(e){return new s({...this.#e,queryNode:Gt.cloneWithSetOperations(this.#e.queryNode,ee("intersect",e,!1))})}intersectAll(e){return new s({...this.#e,queryNode:Gt.cloneWithSetOperations(this.#e.queryNode,ee("intersect",e,!0))})}except(e){return new s({...this.#e,queryNode:Gt.cloneWithSetOperations(this.#e.queryNode,ee("except",e,!1))})}exceptAll(e){return new s({...this.#e,queryNode:Gt.cloneWithSetOperations(this.#e.queryNode,ee("except",e,!0))})}as(e){return new nt(this,e)}clearSelect(){return new s({...this.#e,queryNode:Gt.cloneWithoutSelections(this.#e.queryNode)})}clearWhere(){return new s({...this.#e,queryNode:pe.cloneWithoutWhere(this.#e.queryNode)})}clearLimit(){return new s({...this.#e,queryNode:Gt.cloneWithoutLimit(this.#e.queryNode)})}clearOffset(){return new s({...this.#e,queryNode:Gt.cloneWithoutOffset(this.#e.queryNode)})}clearOrderBy(){return new s({...this.#e,queryNode:pe.cloneWithoutOrderBy(this.#e.queryNode)})}clearGroupBy(){return new s({...this.#e,queryNode:Gt.cloneWithoutGroupBy(this.#e.queryNode)})}$call(e){return e(this)}$if(e,r){if(e)return r(this);return new s({...this.#e})}$castTo(){return new s(this.#e)}$narrowType(){return new s(this.#e)}$assertType(){return new s(this.#e)}$asTuple(){return new a(this.toOperationNode())}$asScalar(){return new a(this.toOperationNode())}withPlugin(e){return new s({...this.#e,executor:this.#e.executor.withPlugin(e)})}toOperationNode(){return this.#e.executor.transformQuery(this.#e.queryNode,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){let e=this.compile();return(await this.#e.executor.executeQuery(e)).rows}async executeTakeFirst(){let[e]=await this.execute();return e}async executeTakeFirstOrThrow(e=L){let r=await this.executeTakeFirst();if(r===void 0)throw v(e)?new e(this.toOperationNode()):e(this.toOperationNode());return r}async*stream(e=100){let r=this.compile(),t=this.#e.executor.stream(r,e);for await(let o of t)yield*o.rows}async explain(e,r){return await new s({...this.#e,queryNode:pe.cloneWithExplain(this.#e.queryNode,e,r)}).execute()}}s=Nr;function We(e){return new Nr(e)}class nt{#e;#r;constructor(e,r){this.#e=e,this.#r=r}get expression(){return this.#e}get alias(){return this.#r}get isAliasedSelectQueryBuilder(){return!0}toOperationNode(){return l.create(this.#e.toOperationNode(),ze.create(this.#r))}}var M=p({is(e){return e.kind==="AggregateFunctionNode"},create(e,r=[]){return p({kind:"AggregateFunctionNode",func:e,aggregated:r})},cloneWithDistinct(e){return p({...e,distinct:!0})},cloneWithOrderBy(e,r,t=!1){let o=t?"withinGroup":"orderBy";return p({...e,[o]:e[o]?U.cloneWithItems(e[o],r):U.create(r)})},cloneWithFilter(e,r){return p({...e,filter:e.filter?O.cloneWithOperation(e.filter,"And",r):O.create(r)})},cloneWithOrFilter(e,r){return p({...e,filter:e.filter?O.cloneWithOperation(e.filter,"Or",r):O.create(r)})},cloneWithOver(e,r){return p({...e,over:r})}});var yr=p({is(e){return e.kind==="FunctionNode"},create(e,r){return p({kind:"FunctionNode",func:e,arguments:r})}});class S{#e;constructor(e){this.#e=p(e)}get expressionType(){return}as(e){return new st(this,e)}distinct(){return new S({...this.#e,aggregateFunctionNode:M.cloneWithDistinct(this.#e.aggregateFunctionNode)})}orderBy(...e){return new S({...this.#e,aggregateFunctionNode:pe.cloneWithOrderByItems(this.#e.aggregateFunctionNode,E(e))})}clearOrderBy(){return new S({...this.#e,aggregateFunctionNode:pe.cloneWithoutOrderBy(this.#e.aggregateFunctionNode)})}withinGroupOrderBy(...e){return new S({...this.#e,aggregateFunctionNode:M.cloneWithOrderBy(this.#e.aggregateFunctionNode,E(e),!0)})}filterWhere(...e){return new S({...this.#e,aggregateFunctionNode:M.cloneWithFilter(this.#e.aggregateFunctionNode,or(e))})}filterWhereRef(e,r,t){return new S({...this.#e,aggregateFunctionNode:M.cloneWithFilter(this.#e.aggregateFunctionNode,N(e,r,t))})}over(e){let r=Zr();return new S({...this.#e,aggregateFunctionNode:M.cloneWithOver(this.#e.aggregateFunctionNode,(e?e(r):r).toOperationNode())})}$call(e){return e(this)}$castTo(){return new S(this.#e)}$notNull(){return new S(this.#e)}toOperationNode(){return this.#e.aggregateFunctionNode}}class st{#e;#r;constructor(e,r){this.#e=e,this.#r=r}get expression(){return this.#e}get alias(){return this.#r}toOperationNode(){return l.create(this.#e.toOperationNode(),ze.create(this.#r))}}function Nu(){let e=(t,o)=>new a(yr.create(t,z(o??[]))),r=(t,o)=>new S({aggregateFunctionNode:M.create(t,o?z(o):void 0)});return Object.assign(e,{agg:r,avg(t){return r("avg",[t])},coalesce(...t){return e("coalesce",t)},count(t){return r("count",[t])},countAll(t){return new S({aggregateFunctionNode:M.create("count",y(t))})},max(t){return r("max",[t])},min(t){return r("min",[t])},sum(t){return r("sum",[t])},any(t){return e("any",[t])},jsonAgg(t){return new S({aggregateFunctionNode:M.create("json_agg",[Qt(t)?zt(t):t.toOperationNode()])})},toJson(t){return new a(yr.create("to_json",[Qt(t)?zt(t):t.toOperationNode()]))}})}var at=p({is(e){return e.kind==="UnaryOperationNode"},create(e,r){return p({kind:"UnaryOperationNode",operator:e,operand:r})}});function ut(e,r){return at.create(Do.create(e),w(r))}var No=p({is(e){return e.kind==="CaseNode"},create(e){return p({kind:"CaseNode",value:e})},cloneWithWhen(e,r){return p({...e,when:p(e.when?[...e.when,r]:[r])})},cloneWithThen(e,r){return p({...e,when:e.when?p([...e.when.slice(0,-1),Go.cloneWithResult(e.when[e.when.length-1],r)]):void 0})},cloneWith(e,r){return p({...e,...r})}});class Ec{#e;constructor(e){this.#e=p(e)}when(...e){return new wr({...this.#e,node:No.cloneWithWhen(this.#e.node,Go.create(or(e)))})}}class wr{#e;constructor(e){this.#e=p(e)}then(e){return new mt({...this.#e,node:No.cloneWithThen(this.#e.node,Ae(e)?le(e):m(e))})}}class mt{#e;constructor(e){this.#e=p(e)}when(...e){return new wr({...this.#e,node:No.cloneWithWhen(this.#e.node,Go.create(or(e)))})}else(e){return new dt({...this.#e,node:No.cloneWith(this.#e.node,{else:Ae(e)?le(e):m(e)})})}end(){return new a(No.cloneWith(this.#e.node,{isStatement:!1}))}endCase(){return new a(No.cloneWith(this.#e.node,{isStatement:!0}))}}class dt{#e;constructor(e){this.#e=p(e)}end(){return new a(No.cloneWith(this.#e.node,{isStatement:!1}))}endCase(){return new a(No.cloneWith(this.#e.node,{isStatement:!0}))}}var Ie=p({is(e){return e.kind==="JSONOperatorChainNode"},create(e){return p({kind:"JSONOperatorChainNode",operator:e,values:p([])})},cloneWithValue(e,r){return p({...e,values:p([...e.values,r])})}});var Or=p({is(e){return e.kind==="JSONPathLegNode"},create(e,r){return p({kind:"JSONPathLegNode",type:e,value:r})}});var H=p({is(e){return e.kind==="JSONPathNode"},create(e){return p({kind:"JSONPathNode",inOperator:e,pathLegs:p([])})},cloneWithLeg(e,r){return p({...e,pathLegs:p([...e.pathLegs,r])})}});var he=p({is(e){return e.kind==="JSONReferenceNode"},create(e,r){return p({kind:"JSONReferenceNode",reference:e,traversal:r})},cloneWithTraversal(e,r){return p({...e,traversal:r})}});var Ft=/^#-\d+$/;class Se{#e;constructor(e){this.#e=e}at(e){if(typeof e!=="number"&&typeof e!=="string"||typeof e==="number"&&!Number.isInteger(e)||typeof e==="string"&&e!=="last"&&!Ft.test(e))throw Error(`Unexpected index value in .at(...): ${e}`);return this.#r("ArrayLocation",e)}key(e){return this.#r("Member",e)}#r(e,r){if(he.is(this.#e))return new be(he.cloneWithTraversal(this.#e,H.is(this.#e.traversal)?H.cloneWithLeg(this.#e.traversal,Or.create(e,r)):Ie.cloneWithValue(this.#e.traversal,Hr.createImmediate(r))));return new be(H.cloneWithLeg(this.#e,Or.create(e,r)))}}class be extends Se{#e;constructor(e){super(e);this.#e=e}get expressionType(){return}as(e){return new ct(this,e)}$castTo(){return new be(this.#e)}$notNull(){return new be(this.#e)}toOperationNode(){return this.#e}}class ct{#e;#r;constructor(e,r){this.#e=e,this.#r=r}get expression(){return this.#e}get alias(){return this.#r}toOperationNode(){return l.create(this.#e.toOperationNode(),pr(this.#r)?this.#r.toOperationNode():ze.create(this.#r))}}var xr=p({is(e){return e.kind==="TupleNode"},create(e){return p({kind:"TupleNode",values:p(e)})}});var vt=["varchar","char","text","integer","int2","int4","int8","smallint","bigint","boolean","real","double precision","float4","float8","decimal","numeric","binary","bytea","date","datetime","time","timetz","timestamp","timestamptz","serial","bigserial","uuid","json","jsonb","blob","varbinary","int4range","int4multirange","int8range","int8multirange","numrange","nummultirange","tsrange","tsmultirange","tstzrange","tstzmultirange","daterange","datemultirange"],Pt=[/^varchar\(\d+\)$/,/^char\(\d+\)$/,/^decimal\(\d+, \d+\)$/,/^numeric\(\d+, \d+\)$/,/^binary\(\d+\)$/,/^datetime\(\d+\)$/,/^time\(\d+\)$/,/^timetz\(\d+\)$/,/^timestamp\(\d+\)$/,/^timestamptz\(\d+\)$/,/^varbinary\(\d+\)$/],ht=p({is(e){return e.kind==="DataTypeNode"},create(e){return p({kind:"DataTypeNode",dataType:e})}});function ft(e){if(vt.includes(e))return!0;if(Pt.some((r)=>r.test(e)))return!0;return!1}function us(e){if(pr(e))return e.toOperationNode();if(ft(e))return ht.create(e);throw Error(`invalid column data type ${JSON.stringify(e)}`)}var pt=p({is(e){return e.kind==="CastNode"},create(e,r){return p({kind:"CastNode",expression:e,dataType:r})}});function Me(e=K){function r(n,u,re){return new a(qe(n,u,re))}function t(n,u){return new a(ut(n,u))}let o=Object.assign(r,{fn:void 0,eb:void 0,selectFrom(n){return We({queryId:Je(),executor:e,queryNode:Gt.createFrom(A(n))})},case(n){return new Ec({node:No.create(Fn(n)?void 0:w(n))})},ref(n,u){if(Fn(u))return new a(Po(n));return new Se(lt(n,u))},jsonPath(){return new Se(H.create())},table(n){return new a(zt(n))},val(n){return new a(m(n))},refTuple(...n){return new a(xr.create(n.map(w)))},tuple(...n){return new a(xr.create(n.map(m)))},lit(n){return new a(le(n))},unary:t,not(n){return t("not",n)},exists(n){return t("exists",n)},neg(n){return t("-",n)},between(n,u,re){return new a(I.create(w(n),Do.create("between"),W.create(m(u),m(re))))},betweenSymmetric(n,u,re){return new a(I.create(w(n),Do.create("between symmetric"),W.create(m(u),m(re))))},and(n){if(Ln(n))return new a(oe(n,"and"));return new a(je(n,"and"))},or(n){if(Ln(n))return new a(oe(n,"or"));return new a(je(n,"or"))},parens(...n){let u=or(n);if(Oo.is(u))return new a(u);else return new a(Oo.create(u))},cast(n,u){return new a(pt.create(w(n),us(u)))},withSchema(n){return Me(e.withPluginAtFront(new cs(n)))}});return o.fn=Nu(),o.eb=o,o}function q(e){return Me()}function Ao(e){if(pr(e))return e.toOperationNode();else if(Kt(e))return e(q()).toOperationNode();throw Error(`invalid expression: ${JSON.stringify(e)}`)}function Fe(e){if(pr(e))return e.toOperationNode();else if(Kt(e))return e(q()).toOperationNode();throw Error(`invalid aliased expression: ${JSON.stringify(e)}`)}function V(e){return Ce(e)||Wr(e)||Kt(e)}function Ze(e){if(Qt(e))return Po(e);return e.toOperationNode()}function z(e){if(Ln(e))return e.map((r)=>w(r));else return[w(e)]}function w(e){if(V(e))return Ao(e);return Ze(e)}function lt(e,r){let t=Po(e);if(xf(r))return he.create(t,Ie.create(Do.create(r)));let o=r.slice(0,-1);if(xf(o))return he.create(t,H.create(Do.create(o)));throw Error(`Invalid JSON operator: ${r}`)}function Po(e){if(!e.includes("."))return te.create(Zt.create(e));let t=e.split(".").map(gr);if(t.length===3)return Mt(t);if(t.length===2)return Vt(t);throw Error(`invalid column reference ${e}`)}function Pr(e){if(e.includes(" as ")){let[t,o]=e.split(" as ").map(gr);return l.create(Po(t),ze.create(o))}else return Po(e)}function vf(e){return Zt.create(e)}function ll(e){if(e.includes(" ")){let[t,o]=e.split(" ").map(gr);if(!rr(o))throw Error(`invalid order direction "${o}" next to "${t}"`);return E([t,o])[0]}else return vf(e)}function Mt(e){let[r,t,o]=e;return te.create(Zt.create(o),g.createWithSchema(r,t))}function Vt(e){let[r,t]=e;return te.create(Zt.create(t),g.create(r))}function gr(e){return e.trim()}class ke{#e;constructor(e){this.#e=p(e)}get expressionType(){return}get isRawBuilder(){return!0}as(e){return new Nt(this,e)}$castTo(){return new ke({...this.#e})}$notNull(){return new ke(this.#e)}withPlugin(e){return new ke({...this.#e,plugins:this.#e.plugins!==void 0?p([...this.#e.plugins,e]):p([e])})}toOperationNode(){return this.#t(this.#r())}compile(e){return this.#i(this.#r(e))}async execute(e){let r=this.#r(e);return r.executeQuery(this.#i(r))}#r(e){let r=e!==void 0?e.getExecutor():K;return this.#e.plugins!==void 0?r.withPlugins(this.#e.plugins):r}#t(e){return e.transformQuery(this.#e.rawNode,this.#e.queryId)}#i(e){return e.compileQuery(this.#t(e),this.#e.queryId)}}function Q(e){return new ke(e)}class Nt{#e;#r;constructor(e,r){this.#e=e,this.#r=r}get expression(){return this.#e}get alias(){return this.#r}get rawBuilder(){return this.#e}toOperationNode(){return l.create(this.#e.toOperationNode(),pr(this.#r)?this.#r.toOperationNode():ze.create(this.#r))}}var De=Object.assign((e,...r)=>Q({queryId:Je(),rawNode:Bt.create(e,r?.map(yt)??[])}),{ref(e){return Q({queryId:Je(),rawNode:Bt.createWithChild(Po(e))})},val(e){return Q({queryId:Je(),rawNode:Bt.createWithChild(m(e))})},value(e){return this.val(e)},table(e){return Q({queryId:Je(),rawNode:Bt.createWithChild(zt(e))})},id(...e){let r=Array(e.length+1).fill(".");return r[0]="",r[r.length-1]="",Q({queryId:Je(),rawNode:Bt.create(r,e.map(ze.create))})},lit(e){return Q({queryId:Je(),rawNode:Bt.createWithChild(Hr.createImmediate(e))})},literal(e){return this.lit(e)},raw(e){return Q({queryId:Je(),rawNode:Bt.createWithSql(e)})},join(e,r=De`, `){let t=Array(Math.max(2*e.length-1,0)),o=r.toOperationNode();for(let n=0;n<e.length;++n)if(t[2*n]=yt(e[n]),n!==e.length-1)t[2*n+1]=o;return Q({queryId:Je(),rawNode:Bt.createWithChildren(t)})}});function yt(e){if(pr(e))return e.toOperationNode();return m(e)}var mr=p({raw(e,r=[]){return p({sql:e,query:Bt.createWithSql(e),parameters:p(r),queryId:Je()})}});
|
|
3
|
-
export{pr,Zt,al,bf,Po,vf,ll,$i,Hr,or,pe,Gt,Ru,Je,xc,cs,Gi,Pu,Sc,Ns,Nu,No,Ec,us,Ao,wf,zt,De,mr};
|
package/bin/chunk-p0yfxt5e.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{je}from"./chunk-tjavzarz.js";function Ue(t){let o=Object.values(t).filter((c)=>typeof c==="number");return Object.entries(t).filter(([c,u])=>o.indexOf(+c)===-1).map(([c,u])=>u)}function ft(t,o="|"){return t.map((n)=>ht(n)).join(o)}function we(t,o){if(typeof o==="bigint")return o.toString();return o}function ke(t){return{get value(){{let n=t();return Object.defineProperty(this,"value",{value:n}),n}throw Error("cached value already set")}}}function eo(t){return t===null||t===void 0}function Me(t){let o=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(o,n)}function to(t,o){let n=t/o,c=Math.round(n),u=4*Number.EPSILON*Math.max(Math.abs(n),1);if(Math.abs(n-c)<u)return 0;return n-c}var Qr=Symbol("evaluating");function ro(t,o,n){let c=void 0;Object.defineProperty(t,o,{get(){if(c===Qr)return;if(c===void 0)c=Qr,c=n();return c},set(u){Object.defineProperty(t,o,{value:u})},configurable:!0})}function L(t,o,n){Object.defineProperty(t,o,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ae(...t){let o={};for(let n of t){let c=Object.getOwnPropertyDescriptors(n);Object.assign(o,c)}return Object.defineProperties({},o)}function oo(t){return JSON.stringify(t)}function no(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var dt="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function ge(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)}var io=ke(()=>{if(B.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(t){return!1}});function me(t){if(ge(t)===!1)return!1;let o=t.constructor;if(o===void 0)return!0;if(typeof o!=="function")return!0;let n=o.prototype;if(ge(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function mt(t){if(me(t))return{...t};if(Array.isArray(t))return[...t];if(t instanceof Map)return new Map(t);if(t instanceof Set)return new Set(t);return t}var so=new Set(["string","number","symbol"]);function le(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Y(t,o,n){let c=new t._zod.constr(o??t._zod.def);if(!o||n?.parent)c._zod.parent=t;return c}function S(t){let o=t;if(!o)return{};if(typeof o==="string")return{error:()=>o};if(o?.message!==void 0){if(o?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");o.error=o.message}if(delete o.message,typeof o.error==="string")return{...o,error:()=>o.error};return o}function ht(t){if(typeof t==="bigint")return t.toString()+"n";if(typeof t==="string")return`"${t}"`;return`${t}`}function co(t){return Object.keys(t).filter((o)=>t[o]._zod.optin!==void 0&&t[o]._zod.optout==="optional")}var uo=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))();function Sc(t,o){let n=t._zod.def,c=n.checks;if(c&&c.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let p=ae(t._zod.def,{get shape(){let f={};for(let m of Reflect.ownKeys(o)){if(!Object.prototype.hasOwnProperty.call(n.shape,m))throw Error(`Unrecognized key: "${String(m)}"`);if(!o[m])continue;L(f,m,n.shape[m])}return L(this,"shape",f),f},checks:[]});return Y(t,p)}function Oc(t,o){let n=t._zod.def,c=n.checks;if(c&&c.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let p=ae(t._zod.def,{get shape(){let f={...t._zod.def.shape};for(let m of Reflect.ownKeys(o)){if(!Object.prototype.hasOwnProperty.call(n.shape,m))throw Error(`Unrecognized key: "${String(m)}"`);if(!o[m])continue;delete f[m]}return L(this,"shape",f),f},checks:[]});return Y(t,p)}function Ic(t,o){if(!me(o))throw Error("Invalid input to extend: expected a plain object");let n=t._zod.def.checks;if(n&&n.length>0){let p=t._zod.def.shape;for(let f of Reflect.ownKeys(o))if(Object.getOwnPropertyDescriptor(p,f)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let u=ae(t._zod.def,{get shape(){let p={...t._zod.def.shape,...o};return L(this,"shape",p),p}});return Y(t,u)}function Ec(t,o){if(!me(o))throw Error("Invalid input to safeExtend: expected a plain object");let n=ae(t._zod.def,{get shape(){let c={...t._zod.def.shape,...o};return L(this,"shape",c),c}});return Y(t,n)}function Tc(t,o){if(!o?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(t._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n=ae(t._zod.def,{get shape(){let c={...t._zod.def.shape,...o._zod.def.shape};return L(this,"shape",c),c},get catchall(){return o._zod.def.catchall},checks:o._zod.def.checks??[]});return Y(t,n)}function ao(t,o,n,c="partial"){let p=o._zod.def.checks;if(p&&p.length>0)throw Error(`.${c}() cannot be used on object schemas containing refinements`);let m=ae(o._zod.def,{get shape(){let _=o._zod.def.shape,b={..._};if(n)for(let z of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(_,z))throw Error(`Unrecognized key: "${String(z)}"`);if(!n[z])continue;b[z]=t?new t({type:"optional",innerType:_[z]}):_[z]}else for(let z of Reflect.ownKeys(_))b[z]=t?new t({type:"optional",innerType:_[z]}):_[z];return L(this,"shape",b),b},checks:[]});return Y(o,m)}function Ac(t,o,n){let c=ae(o._zod.def,{get shape(){let u=o._zod.def.shape,p={...u};if(n)for(let f of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(p,f))throw Error(`Unrecognized key: "${String(f)}"`);if(!n[f])continue;p[f]=new t({type:"nonoptional",innerType:u[f]})}else for(let f of Reflect.ownKeys(u))p[f]=new t({type:"nonoptional",innerType:u[f]});return L(this,"shape",p),p}});return Y(o,c)}function he(t,o=0){if(t.aborted===!0)return!0;for(let n=o;n<t.issues.length;n++)if(t.issues[n]?.continue!==!0)return!0;return!1}function lo(t,o=0){if(t.aborted===!0)return!0;for(let n=o;n<t.issues.length;n++)if(t.issues[n]?.continue===!1)return!0;return!1}function te(t,o){return o.map((n)=>{var c;return(c=n).path??(c.path=[]),n.path.unshift(t),n})}function $e(t){return typeof t==="string"?t:t?.message}function _t(t,o,n){var c;for(let u=o;u<t.length;u++)(c=t[u]).schema??(c.schema=n)}function ne(t,o,n){var c;let u=t.inst?._zod?.traits;if(u?.has("$ZodType"))if(u.has("$ZodCheck"))(c=t).schema??(c.schema=t.inst);else t.schema=t.inst;let p=t.schema!==t.inst?t.schema?._zod.def?.error:void 0,f=t.message?t.message:$e(t.inst?._zod.def?.error?.(t))??$e(p?.(t))??$e(o?.error?.(t))??$e(n.customError?.(t))??$e(n.localeError?.(t))??"Invalid input",{inst:m,schema:_,continue:b,input:z,...w}=t;if(w.path??(w.path=[]),w.message=f,o?.reportInput)w.input=z;return w}var Nc=/[\uD800-\uDBFF]/;function Je(t){let o=t.length;if(!Nc.test(t))return o;let n=o;for(let c=0;c<o-1;c++)if((t.charCodeAt(c)&64512)===55296&&(t.charCodeAt(c+1)&64512)===56320)n--,c++;return n}function Be(t){if(Array.isArray(t))return"array";if(typeof t==="string")return"string";return"unknown"}function po(t){let o=typeof t;switch(o){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let n=t;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return o}function _e(...t){let[o,n,c]=t;if(typeof o==="string")return{message:o,code:"custom",input:n,inst:c};return{...o}}function fo(t,o){for(let n in o){let c=Object.getOwnPropertyDescriptor(o,n);if(c.get)Object.defineProperty(t,n,{...c,enumerable:!1});else Cc(t,n,c.value)}}function de(t,o,n,c=!0){return Object.defineProperty(t,o,{configurable:!0,writable:!0,enumerable:c,value:n}),n}function gt(t,o,n){return de(t,o,n,!1)}function Cc(t,o,n){Object.defineProperty(t,o,{configurable:!0,get(){return this==null?n:de(this,o,n.bind(this))},set(c){de(this,o,c)}})}function jc(t,o){let n=Object.getPrototypeOf(t);return o in n?void 0:n}var pt,ue=!1,Rc={configurable:!0,get(){ue=!0;return}};function E(t,o,n){let c=Object.getPrototypeOf(t._zod);if(o in c&&pt!==t._zod){pt=void 0;return}pt=t._zod,Object.defineProperty(c,o,{configurable:!0,get(){Object.defineProperty(this,o,Rc);let u=ue;ue=!1;try{let p=n(this);if(ue)delete this[o];else Object.defineProperty(this,o,{configurable:!0,writable:!0,value:p});return ue=ue||u,p}catch(p){throw delete this[o],ue=ue||u,p}},set(u){Object.defineProperty(this,o,{configurable:!0,writable:!0,value:u})}})}function Dc(t,o,n,c){let u=jc(t,o);if(!u)return;Object.defineProperty(u,o,{configurable:!0,get(){let p={configurable:!0,writable:!0,enumerable:c,value:void 0};return Object.defineProperty(this,o,p),p.value=n(this),Object.defineProperty(this,o,p),p.value},set(p){Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:c,value:p})}})}var Lc="~constantCatch";function mo(t){let o=()=>t;return o[Lc]=!0,o}var _o,Zr=Object.freeze({status:"aborted"}),xt={value:void 0,enumerable:!1},xo="captureStackTrace"in Error?Error:null;function Fc(t){let o=xo;if(o){let n=o.stackTraceLimit;if(typeof n==="number"){try{o.stackTraceLimit=0}catch{return xo=null,new t}try{return new t}finally{o.stackTraceLimit=n}}}return new t}function v(t,o,n,c){let u={};function p(k){this.def=k,this.constr=w,this.traits=new Set}p.prototype=u;let f=n,m=f&&new WeakSet;function _(k,Z){if(!k._zod){xt.value=new p(Z);try{Object.defineProperty(k,"_zod",xt)}finally{xt.value=void 0}}if(k._zod.traits.has(t))return;if(k._zod.traits.add(t),o(k,Z),m){let O=Object.getPrototypeOf(k),I=k._zod.constr.prototype,J=O;while(J&&J!==I)J=Object.getPrototypeOf(J);let q=J??O;if(!m.has(q))m.add(q),fo(q,f)}let P=w.prototype;for(let O in P){if(!Object.prototype.hasOwnProperty.call(P,O))continue;if(!(O in k))k[O]=P[O].bind(k)}}let b=c?.Parent??Object;class z extends b{}Object.defineProperty(z,"name",{value:t});function w(k){let Z=c?.Parent?Fc(z):this;_(Z,k);let P=Z._zod.deferred;if(P){for(let I of P)I();Z._zod.deferred=void 0}let O=globalThis.__zod_globalConfig?.postProcessor;if(O)O(Z);return Z}return Object.defineProperty(w,"init",{value:_}),Object.defineProperty(w,Symbol.hasInstance,{value:(k)=>{if(c?.Parent&&k instanceof c.Parent)return!0;return k?._zod?.traits?.has(t)}}),Object.defineProperty(w,"name",{value:t}),w}class ie extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ze extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`);this.name="ZodEncodeError"}}(_o=globalThis).__zod_globalConfig??(_o.__zod_globalConfig={});var B=globalThis.__zod_globalConfig;function W(t){if(t)Object.assign(B,t);return B}function Uc(){let t=this._zod;return t.message??(t.message=JSON.stringify(t.def,we,2)),t.message}function Mc(t){this._zod.message=t}var Jc={get:Uc,set:Mc,enumerable:!0,configurable:!0},zt={value:void 0,enumerable:!1},vt={value:void 0,enumerable:!1},yo=new WeakSet([Object.prototype,Error.prototype]),bo=(t,o)=>{t.name="$ZodError",zt.value=t._zod,Object.defineProperty(t,"_zod",zt),vt.value=o,Object.defineProperty(t,"issues",vt),zt.value=void 0,vt.value=void 0,Object.defineProperty(t,"message",Jc);let n=Object.getPrototypeOf(t);if(!yo.has(n))yo.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let c=()=>this.message;return Object.defineProperty(this,"toString",{value:c,configurable:!0,writable:!0}),c},set(c){Object.defineProperty(this,"toString",{value:c,configurable:!0,writable:!0})}})},si=v("$ZodError",bo),$t=v("$ZodError",bo,void 0,{Parent:Error});function Bc(t,o,n){if(!Object.prototype.hasOwnProperty.call(t,o))if(o==="__proto__")Object.defineProperty(t,o,{value:n(),writable:!0,enumerable:!0,configurable:!0});else t[o]=n();return t[o]}function wt(t,o=(n)=>n.message){let n={},c=[];for(let u of t.issues)if(u.path.length>0)Bc(n,u.path[0],()=>[]).push(o(u));else c.push(o(u));return{formErrors:c,fieldErrors:n}}function kt(t,o=(n)=>n.message){let n={_errors:[]},c=(u,p=[])=>{for(let f of u.issues)if(f.code==="invalid_union"&&f.errors.length)f.errors.map((m)=>c({issues:m},[...p,...f.path]));else if(f.code==="invalid_key")c({issues:f.issues},[...p,...f.path]);else if(f.code==="invalid_element")c({issues:f.issues},[...p,...f.path]);else{let m=[...p,...f.path];if(m.length===0)n._errors.push(o(f));else{let _=n,b=0;while(b<m.length){let z=m[b],w=b===m.length-1;if(z==="_errors"){if(w)_._errors.push(o(f));b++;continue}if(!Object.prototype.hasOwnProperty.call(_,z))Object.defineProperty(_,z,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let k=_[z];if(w)k._errors.push(o(f));_=k,b++}}}};return c(t),n}function Vc(t){let o=[],n=t.map((c)=>typeof c==="object"?c.key:c);for(let c of n)if(typeof c==="number")o.push(`[${c}]`);else if(typeof c==="symbol")o.push(`[${JSON.stringify(String(c))}]`);else if(/[^\w$]/.test(c))o.push(`[${JSON.stringify(c)}]`);else{if(o.length)o.push(".");o.push(c)}return o.join("")}function gf(t){let o=[],n=[...t.issues].sort((c,u)=>(c.path??[]).length-(u.path??[]).length);for(let c of n)if(o.push(`\u2716 ${c.message}`),c.path?.length)o.push(` \u2192 at ${Vc(c.path)}`);return o.join(`
|
|
3
|
-
`)}function Ve(t,o){return{callee:o?.callee??t,Err:o?.Err}}var Ke=(t)=>{let o=(n,c,u,p)=>{let f=u?{...u,async:!1}:{async:!1},m=n._zod.run({value:c,issues:[]},f);if(m instanceof Promise)throw new ie;if(m.issues.length){let _=new(p?.Err??t)(m.issues.map((b)=>ne(b,f,W())));throw dt(_,p?.callee??o),_}return m.value};return o};var We=(t)=>{let o=async(n,c,u,p)=>{let f=u?{...u,async:!0}:{async:!0},m=n._zod.run({value:c,issues:[]},f);if(m instanceof Promise)m=await m;if(m.issues.length){let _=new(p?.Err??t)(m.issues.map((b)=>ne(b,f,W())));throw dt(_,p?.callee??o),_}return m.value};return o};var Pe=(t)=>(o,n,c)=>{let u=c?{...c,async:!1}:{async:!1},p=o._zod.run({value:n,issues:[]},u);if(p instanceof Promise)throw new ie;return p.issues.length?{success:!1,error:new(t??si)(p.issues.map((f)=>ne(f,u,W())))}:{success:!0,data:p.value}},zo=Pe($t),Oe=(t)=>async(o,n,c)=>{let u=c?{...c,async:!0}:{async:!0},p=o._zod.run({value:n,issues:[]},u);if(p instanceof Promise)p=await p;return p.issues.length?{success:!1,error:new t(p.issues.map((f)=>ne(f,u,W())))}:{success:!0,data:p.value}},vo=Oe($t);var $o=(t)=>{let o=Ke(t),n=(c,u,p,f)=>{let m=p?{...p,direction:"backward"}:{direction:"backward"};return o(c,u,m,Ve(n,f))};return n};var wo=(t)=>{let o=Ke(t),n=(c,u,p,f)=>o(c,u,p,Ve(n,f));return n};var ko=(t)=>{let o=We(t),n=async(c,u,p,f)=>{let m=p?{...p,direction:"backward"}:{direction:"backward"};return await o(c,u,m,Ve(n,f))};return n};var Zo=(t)=>{let o=We(t),n=async(c,u,p,f)=>await o(c,u,p,Ve(n,f));return n};var Po=(t)=>(o,n,c)=>{let u=c?{...c,direction:"backward"}:{direction:"backward"};return Pe(t)(o,n,u)};var So=(t)=>(o,n,c)=>Pe(t)(o,n,c);var Oo=(t)=>async(o,n,c)=>{let u=c?{...c,direction:"backward"}:{direction:"backward"};return Oe(t)(o,n,u)};var Io=(t)=>async(o,n,c)=>Oe(t)(o,n,c);var Eo=/^[cC][0-9a-z]{6,}$/,To=/^[0-9a-z]+$/,Ao=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,No=/^[0-9a-vA-V]{20}$/,Co=/^[A-Za-z0-9]{27}$/,jo=/^[a-zA-Z0-9_-]{21}$/;function Ro(t){return new RegExp(`^[a-zA-Z0-9_-]{${t}}$`)}var Do=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Lo=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Pt=(t)=>{if(!t)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var Fo=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Wc="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Uo(){return new RegExp(Wc,"u")}var Mo=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Jo=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var Bo=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Vo=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ko=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ot=/^[A-Za-z0-9_-]*$/;var Wo=/^https?$/,Go=/^\+[1-9]\d{6,14}$/;var qo="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function Gc(t){return new RegExp(`^${t}$`)}var Yo=Gc(qo);function Zt(t){return typeof t.precision==="number"?t.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":t.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${t.precision}}`:t.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Xo(t){return new RegExp(`^${Zt(t)}$`)}function Ho(t){let o=["Z"];if(t.offset)o.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${Zt({precision:t.precision,seconds:!0})}(?:${o.join("|")})`,c=t.local?`${n}|${Zt({precision:t.precision})}`:n;return new RegExp(`^${qo}T(?:${c})$`)}var Qo=(t)=>{let o=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${o}$`)},en=/^-?\d+n?$/,Ge=/^-?\d+$/,Ie=/^-?\d+(?:\.\d+)?$/,tn=/^(?:true|false)$/i,rn=/^null$/i;var on=/^[^A-Z]*$/,nn=/^[^a-z]*$/;var M=v("$ZodCheck",(t,o)=>{var n;t._zod??(t._zod={}),t._zod.def=o,(n=t._zod).onattach??(n.onattach=[])});var It=(t)=>{let o=t.value;return!eo(o)&&o.length!==void 0},qe={number:"number",bigint:"bigint",object:"date"},Et=v("$ZodCheckLessThan",(t,o)=>{M.init(t,o);let n=qe[typeof o.value];t._zod.onattach.push((c)=>{let u=c._zod.bag,p=(o.inclusive?u.maximum:u.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(o.value<p)if(o.inclusive)u.maximum=o.value;else u.exclusiveMaximum=o.value}),t._zod.check=(c)=>{if(o.inclusive?c.value<=o.value:c.value<o.value)return;c.issues.push({origin:qe[typeof c.value]??n,code:"too_big",maximum:typeof o.value==="object"?o.value.getTime():o.value,input:c.value,inclusive:o.inclusive,inst:t,continue:!o.abort})}}),Tt=v("$ZodCheckGreaterThan",(t,o)=>{M.init(t,o);let n=qe[typeof o.value];t._zod.onattach.push((c)=>{let u=c._zod.bag,p=(o.inclusive?u.minimum:u.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(o.value>p)if(o.inclusive)u.minimum=o.value;else u.exclusiveMinimum=o.value}),t._zod.check=(c)=>{if(o.inclusive?c.value>=o.value:c.value>o.value)return;c.issues.push({origin:qe[typeof c.value]??n,code:"too_small",minimum:typeof o.value==="object"?o.value.getTime():o.value,input:c.value,inclusive:o.inclusive,inst:t,continue:!o.abort})}}),sn=v("$ZodCheckMultipleOf",(t,o)=>{M.init(t,o),t._zod.onattach.push((n)=>{var c;(c=n._zod.bag).multipleOf??(c.multipleOf=o.value)}),t._zod.check=(n)=>{if(typeof n.value!==typeof o.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof n.value==="bigint"?o.value!==BigInt(0)&&n.value%o.value===BigInt(0):to(n.value,o.value)===0)return;n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:o.value,input:n.value,inst:t,continue:!o.abort})}}),cn=v("$ZodCheckNumberFormat",(t,o)=>{M.init(t,o),o.format=o.format||"float64";let n=o.format?.includes("int"),c=n?"int":"number",[u,p]=uo[o.format];t._zod.onattach.push((f)=>{let m=f._zod.bag;if(m.format=o.format,m.minimum=u,m.maximum=p,n)m.pattern=Ge}),t._zod.check=(f)=>{let m=f.value;if(n){if(!Number.isInteger(m)){f.issues.push({expected:c,format:o.format,code:"invalid_type",continue:!1,input:m,inst:t});return}if(!Number.isSafeInteger(m)){if(m>0)f.issues.push({input:m,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:c,inclusive:!0,continue:!o.abort});else f.issues.push({input:m,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:c,inclusive:!0,continue:!o.abort});return}}if(m<u)f.issues.push({origin:"number",input:m,code:"too_small",minimum:u,inclusive:!0,inst:t,continue:!o.abort});if(m>p)f.issues.push({origin:"number",input:m,code:"too_big",maximum:p,inclusive:!0,inst:t,continue:!o.abort})}});var un=v("$ZodCheckMaxLength",(t,o)=>{var n;M.init(t,o),(n=t._zod.def).when??(n.when=It),t._zod.onattach.push((c)=>{let u=c._zod.bag.maximum??Number.POSITIVE_INFINITY;if(o.maximum<u)c._zod.bag.maximum=o.maximum}),t._zod.check=(c)=>{let u=c.value,p=u.length;if((typeof u==="string"&&p>o.maximum?Je(u):p)<=o.maximum)return;let m=Be(u);c.issues.push({origin:m,code:"too_big",maximum:o.maximum,inclusive:!0,input:u,inst:t,continue:!o.abort})}}),an=v("$ZodCheckMinLength",(t,o)=>{var n;M.init(t,o),(n=t._zod.def).when??(n.when=It),t._zod.onattach.push((c)=>{let u=c._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(o.minimum>u)c._zod.bag.minimum=o.minimum}),t._zod.check=(c)=>{let u=c.value,p=u.length;if((typeof u==="string"&&p>=o.minimum&&p<o.minimum*2?Je(u):p)>=o.minimum)return;let m=Be(u);c.issues.push({origin:m,code:"too_small",minimum:o.minimum,inclusive:!0,input:u,inst:t,continue:!o.abort})}}),ln=v("$ZodCheckLengthEquals",(t,o)=>{var n;M.init(t,o),(n=t._zod.def).when??(n.when=It),t._zod.onattach.push((c)=>{let u=c._zod.bag;u.minimum=o.length,u.maximum=o.length,u.length=o.length}),t._zod.check=(c)=>{let u=c.value,p=u.length,f=typeof u==="string"&&p>=o.length&&p<=o.length*2?Je(u):p;if(f===o.length)return;let m=Be(u),_=f>o.length;c.issues.push({origin:m,..._?{code:"too_big",maximum:o.length}:{code:"too_small",minimum:o.length},inclusive:!0,exact:!0,input:c.value,inst:t,continue:!o.abort})}}),Ee=v("$ZodCheckStringFormat",(t,o)=>{var n,c;if(M.init(t,o),t._zod.onattach.push((u)=>{let p=u._zod.bag;if(p.format=o.format,o.pattern)p.patterns??(p.patterns=new Set),p.patterns.add(o.pattern)}),o.pattern)(n=t._zod).check??(n.check=(u)=>{if(o.pattern.lastIndex=0,o.pattern.test(u.value))return;u.issues.push({origin:"string",code:"invalid_format",format:o.format,input:u.value,...o.pattern?{pattern:o.pattern.toString()}:{},inst:t,continue:!o.abort})});else(c=t._zod).check??(c.check=()=>{})}),pn=v("$ZodCheckRegex",(t,o)=>{Ee.init(t,o),t._zod.check=(n)=>{if(o.pattern.lastIndex=0,o.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:o.pattern.toString(),inst:t,continue:!o.abort})}}),fn=v("$ZodCheckLowerCase",(t,o)=>{o.pattern??(o.pattern=on),Ee.init(t,o)}),dn=v("$ZodCheckUpperCase",(t,o)=>{o.pattern??(o.pattern=nn),Ee.init(t,o)}),mn=v("$ZodCheckIncludes",(t,o)=>{M.init(t,o);let n=le(o.includes),c=new RegExp(typeof o.position==="number"?`^.{${o.position},}${n}`:n);o.pattern=c,t._zod.onattach.push((u)=>{let p=u._zod.bag;p.patterns??(p.patterns=new Set),p.patterns.add(c)}),t._zod.check=(u)=>{if(u.value.includes(o.includes,o.position))return;u.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:o.includes,input:u.value,inst:t,continue:!o.abort})}}),hn=v("$ZodCheckStartsWith",(t,o)=>{M.init(t,o);let n=new RegExp(`^${le(o.prefix)}.*`);o.pattern??(o.pattern=n),t._zod.onattach.push((c)=>{let u=c._zod.bag;u.patterns??(u.patterns=new Set),u.patterns.add(n)}),t._zod.check=(c)=>{if(c.value.startsWith(o.prefix))return;c.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:o.prefix,input:c.value,inst:t,continue:!o.abort})}}),_n=v("$ZodCheckEndsWith",(t,o)=>{M.init(t,o);let n=new RegExp(`.*${le(o.suffix)}$`);o.pattern??(o.pattern=n),t._zod.onattach.push((c)=>{let u=c._zod.bag;u.patterns??(u.patterns=new Set),u.patterns.add(n)}),t._zod.check=(c)=>{if(c.value.endsWith(o.suffix))return;c.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:o.suffix,input:c.value,inst:t,continue:!o.abort})}});var gn=v("$ZodCheckOverwrite",(t,o)=>{M.init(t,o),t._zod.check=(n)=>{n.value=o.tx(n.value)}});class At{constructor(t=[],o={}){this.content=[],this.indent=0,this.args=t,this.closed=o}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t==="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
|
|
4
|
-
`).filter((p)=>p),c=Math.min(...n.map((p)=>p.length-p.trimStart().length)),u=n.map((p)=>p.slice(c)).map((p)=>" ".repeat(this.indent*2)+p);for(let p of u)this.content.push(p)}compile(){let t=Function,o=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
5
|
-
${o.join(`
|
|
6
|
-
`)}
|
|
7
|
-
};`)(...Object.values(this.closed))}}var yn={major:4,minor:5,patch:4};var A=v("$ZodType",(t,o)=>{var n;t??(t={}),t._zod.def=o,t._zod.bag=t._zod.bag||{},t._zod.version=yn;let c=t._zod.def.checks,u=t._zod.traits.has("$ZodCheck")?[t,...c??[]]:c?.length?[...c]:[];for(let p of u)for(let f of p._zod.onattach)f(t);if(u.length===0)(n=t._zod).deferred??(n.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let p=(m,_,b)=>{if(m.memo)return m;let z=he(m),w;for(let k of _){if(k._zod.def.when){if(lo(m))continue;if(!k._zod.def.when(m))continue}else if(z)continue;let Z=m.issues.length,P=k._zod.check(m);if(P instanceof Promise&&b?.async===!1)throw new ie;if(w||P instanceof Promise)w=(w??Promise.resolve()).then(async()=>{if(await P,m.issues.length===Z)return;if(_t(m.issues,Z,t),!z)z=he(m,Z)});else{if(m.issues.length===Z)continue;if(_t(m.issues,Z,t),!z)z=he(m,Z)}}if(w)return w.then(()=>m);return m},f=(m,_,b)=>{if(he(m))return m.aborted=!0,m;let z=p(_,u,b);if(z instanceof Promise){if(b.async===!1)throw new ie;return z.then((w)=>t._zod.parse(w,b))}return t._zod.parse(z,b)};t._zod.run=(m,_)=>{if(_.skipChecks)return t._zod.parse(m,_);if(_.direction==="backward"){let z=t._zod.parse({value:m.value,issues:[]},{..._,skipChecks:!0});if(z instanceof Promise)return z.then((w)=>f(w,m,_));return f(z,m,_)}let b=t._zod.parse(m,_);if(b instanceof Promise){if(_.async===!1)throw new ie;return b.then((z)=>p(z,u,_))}return p(b,u,_)}}},{get "~standard"(){return gt(this,"~standard",jt(this))},set "~standard"(t){de(this,"~standard",t)}}),bn=(t)=>t.success?{value:t.data}:{issues:t.error?.issues};function jt(t){return{validate:(o)=>{try{return bn(zo(t,o))}catch(n){return vo(t,o).then(bn)}},vendor:"zod",version:1}}var He=v("$ZodString",(t,o)=>{A.init(t,o),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??Qo(t._zod.bag),t._zod.parse=(n,c)=>{if(o.coerce)try{n.value=String(n.value)}catch(u){}if(typeof n.value==="string")return n;return n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:t}),n}}),j=v("$ZodStringFormat",(t,o)=>{Ee.init(t,o),He.init(t,o)}),An=v("$ZodGUID",(t,o)=>{o.pattern??(o.pattern=Lo),j.init(t,o)}),Nn=v("$ZodUUID",(t,o)=>{if(o.version){let c={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[o.version];if(c===void 0)throw Error(`Invalid UUID version: "${o.version}"`);o.pattern??(o.pattern=Pt(c))}else o.pattern??(o.pattern=Pt());j.init(t,o)}),Cn=v("$ZodEmail",(t,o)=>{o.pattern??(o.pattern=Fo),j.init(t,o)}),jn=1,Rn=2;function qc(t,o){if(!o.normalize&&o.protocol?.source===Wo.source&&!/^https?:\/\//i.test(t))return jn;try{return new URL(t)}catch{return Rn}}var Yc=/[\t\n\r]/g;function Xc(t){return t.replace(Yc,"")}function Hc(t,o){return o.lastIndex=0,o.test(t.hostname)}function Qc(t,o){return o.lastIndex=0,o.test(t.protocol.endsWith(":")?t.protocol.slice(0,-1):t.protocol)}var Dn=v("$ZodURL",(t,o)=>{j.init(t,o),t._zod.check=(n)=>{try{let c=n.value.trim(),u=qc(c,o);if(u===jn){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:t,continue:!o.abort});return}if(u===Rn){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!o.abort});return}if(o.hostname&&!Hc(u,o.hostname))n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:o.hostname.source,input:n.value,inst:t,continue:!o.abort});if(o.protocol&&!Qc(u,o.protocol))n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:o.protocol.source,input:n.value,inst:t,continue:!o.abort});n.value=o.normalize?u.href:Xc(c);return}catch(c){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!o.abort})}}}),Ln=v("$ZodEmoji",(t,o)=>{o.pattern??(o.pattern=Uo()),j.init(t,o)}),Fn=v("$ZodNanoID",(t,o)=>{if(o.length!==void 0&&(!Number.isInteger(o.length)||o.length<1))throw Error(`Invalid nanoid length: ${o.length}`);o.pattern??(o.pattern=o.length===void 0?jo:Ro(o.length)),j.init(t,o)}),Un=v("$ZodCUID",(t,o)=>{o.pattern??(o.pattern=Eo),j.init(t,o)}),Mn=v("$ZodCUID2",(t,o)=>{o.pattern??(o.pattern=To),j.init(t,o)}),Jn=v("$ZodULID",(t,o)=>{o.pattern??(o.pattern=Ao),j.init(t,o)}),Bn=v("$ZodXID",(t,o)=>{o.pattern??(o.pattern=No),j.init(t,o)}),Vn=v("$ZodKSUID",(t,o)=>{o.pattern??(o.pattern=Co),j.init(t,o)}),Kn=v("$ZodISODateTime",(t,o)=>{if(o.pattern??(o.pattern=Ho(o)),j.init(t,o),o.local||o.precision===-1)t._zod.bag.laxFormat=!0,t._zod.onattach.push((n)=>{n._zod.bag.laxFormat=!0})}),Wn=v("$ZodISODate",(t,o)=>{o.pattern??(o.pattern=Yo),j.init(t,o)}),Gn=v("$ZodISOTime",(t,o)=>{o.pattern??(o.pattern=Xo(o)),j.init(t,o)}),qn=v("$ZodISODuration",(t,o)=>{o.pattern??(o.pattern=Do),j.init(t,o)}),Yn=v("$ZodIPv4",(t,o)=>{o.pattern??(o.pattern=Mo),j.init(t,o),t._zod.bag.format="ipv4"}),eu=/^[0-9a-fA-F:.]+$/;function Xn(t){if(!eu.test(t))return!1;try{return new URL(`http://[${t}]`),!0}catch{return!1}}var Hn=v("$ZodIPv6",(t,o)=>{o.pattern??(o.pattern=Jo),j.init(t,o),t._zod.bag.format="ipv6",t._zod.check=(n)=>{if(!Xn(n.value))n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:t,continue:!o.abort})}});var Qn=v("$ZodCIDRv4",(t,o)=>{o.pattern??(o.pattern=Bo),j.init(t,o)});function tu(t){let o=t.split("/");if(o.length!==2)return!1;let[n,c]=o;if(!c)return!1;let u=Number(c);if(`${u}`!==c)return!1;if(u<0||u>128)return!1;return Xn(n)}var ei=v("$ZodCIDRv6",(t,o)=>{o.pattern??(o.pattern=Vo),j.init(t,o),t._zod.check=(n)=>{if(!tu(n.value))n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:t,continue:!o.abort})}});function ti(t){if(t==="")return!0;if(/\s/.test(t))return!1;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var ri=v("$ZodBase64",(t,o)=>{o.pattern??(o.pattern=Ko),j.init(t,o),t._zod.bag.contentEncoding="base64",t._zod.check=(n)=>{if(ti(n.value))return;n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!o.abort})}});function ru(t){if(!Ot.test(t))return!1;let o=t.replace(/[-_]/g,(c)=>c==="-"?"+":"/"),n=o.padEnd(Math.ceil(o.length/4)*4,"=");return ti(n)}var oi=v("$ZodBase64URL",(t,o)=>{o.pattern??(o.pattern=Ot),j.init(t,o),t._zod.bag.contentEncoding="base64url",t._zod.check=(n)=>{if(ru(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!o.abort})}}),ni=v("$ZodE164",(t,o)=>{o.pattern??(o.pattern=Go),j.init(t,o)});function ou(t,o=null){try{let n=t.split(".");if(n.length!==3)return!1;let[c]=n;if(!c)return!1;let u=JSON.parse(atob(c));if("typ"in u&&u?.typ!=="JWT")return!1;if(!u.alg)return!1;if(o&&(!("alg"in u)||u.alg!==o))return!1;return!0}catch{return!1}}var ci=v("$ZodJWT",(t,o)=>{j.init(t,o),t._zod.check=(n)=>{if(ou(n.value,o.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!o.abort})}});var Dt=v("$ZodNumber",(t,o)=>{A.init(t,o),t._zod.pattern=t._zod.bag.pattern??Ie,t._zod.parse=(n,c)=>{if(o.coerce)try{n.value=Number(n.value)}catch(f){}let u=n.value;if(typeof u==="number"&&!Number.isNaN(u)&&Number.isFinite(u))return n;let p=typeof u==="number"?Number.isNaN(u)?"NaN":!Number.isFinite(u)?String(u):void 0:void 0;return n.issues.push({expected:"number",code:"invalid_type",input:u,inst:t,...p?{received:p}:{}}),n}}),ui=v("$ZodNumberFormat",(t,o)=>{cn.init(t,o),Dt.init(t,o)}),pi=v("$ZodBoolean",(t,o)=>{A.init(t,o),t._zod.pattern=tn,t._zod.parse=(n,c)=>{if(o.coerce)try{n.value=Boolean(n.value)}catch(p){}let u=n.value;if(typeof u==="boolean")return n;return n.issues.push({expected:"boolean",code:"invalid_type",input:u,inst:t}),n}}),fi=v("$ZodBigInt",(t,o)=>{A.init(t,o),t._zod.pattern=en,t._zod.parse=(n,c)=>{if(o.coerce)try{n.value=BigInt(n.value)}catch(u){}if(typeof n.value==="bigint")return n;return n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:t}),n}});var di=v("$ZodNull",(t,o)=>{A.init(t,o),t._zod.pattern=rn,t._zod.values=new Set([null]),t._zod.parse=(n,c)=>{let u=n.value;if(u===null)return n;return n.issues.push({expected:"null",code:"invalid_type",input:u,inst:t}),n}}),mi=v("$ZodAny",(t,o)=>{A.init(t,o),t._zod.parse=(n)=>n}),hi=v("$ZodUnknown",(t,o)=>{A.init(t,o),t._zod.parse=(n)=>n}),_i=v("$ZodNever",(t,o)=>{A.init(t,o),t._zod.parse=(n,c)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)}),gi=v("$ZodVoid",(t,o)=>{A.init(t,o),t._zod.parse=(n,c)=>{let u=n.value;if(typeof u>"u")return n;return n.issues.push({expected:"void",code:"invalid_type",input:u,inst:t}),n}}),xi=v("$ZodDate",(t,o)=>{A.init(t,o),t._zod.parse=(n,c)=>{if(o.coerce)try{n.value=new Date(n.value)}catch(m){}let u=n.value,p=u instanceof Date;if(p&&!Number.isNaN(u.getTime()))return n;return n.issues.push({expected:"date",code:"invalid_type",input:u,...p?{received:"Invalid Date"}:{},inst:t}),n}});function zn(t,o,n){if(t.issues.length)o.issues.push(...te(n,t.issues));o.value[n]=t.value}var yi=v("$ZodArray",(t,o)=>{A.init(t,o);let n=B.memoizer;n?.attach(t),t._zod.parse=(c,u)=>{let p=c.value;if(!Array.isArray(p))return c.issues.push({expected:"array",code:"invalid_type",input:p,inst:t}),c;c.value=n?n.alloc(t,c,Array(p.length),u):Array(p.length);let f=[];for(let m=0;m<p.length;m++){let _=p[m],b=o.element._zod.run({value:_,issues:[]},u);if(b instanceof Promise)f.push(b.then((z)=>zn(z,c,m)));else zn(b,c,m)}if(f.length)return Promise.all(f).then(()=>c);return c}});function Xe(t,o,n,c,u,p){let f=n in c,m=p==="optional";if(!f&&m&&u==="optional")return;if(t.issues.length){if(u!==void 0&&m&&!f)return;o.issues.push(...te(n,t.issues))}if(!f&&u===void 0){if(!t.issues.length)o.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}if(t.value===void 0){if(f)o.value[n]=void 0}else o.value[n]=t.value}var nu=[];function bi(t){let o=Object.keys(t.shape),n=Object.getOwnPropertySymbols(t.shape),c=n.length?n:nu,u=c.length?[...o,...c]:o;for(let f of u)if(!t.shape?.[f]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(f)}": expected a Zod schema`);let p=co(t.shape);return{...t,allKeys:u,symbolKeys:c,keySet:new Set(o),numKeys:o.length,optionalKeys:new Set(p)}}function zi(t,o,n,c,u,p){let f=[],m=u.keySet,_=u.catchall._zod,b=_.def.type,{optin:z,optout:w}=_;for(let k in o){if(m.has(k))continue;if(k==="__proto__"){if(b==="never")f.push(k);continue}if(b==="never"){f.push(k);continue}let Z=_.run({value:o[k],issues:[]},c);if(Z instanceof Promise)t.push(Z.then((P)=>Xe(P,n,k,o,z,w)));else Xe(Z,n,k,o,z,w)}if(f.length)n.issues.push({code:"unrecognized_keys",keys:f,input:o,inst:p,continue:!0});if(!t.length)return n;return Promise.all(t).then(()=>n)}var Nt=new WeakMap,iu=v("$ZodObject",(t,o)=>{if(A.init(t,o),!Object.getOwnPropertyDescriptor(o,"shape")?.get){let _=o.shape;Nt.set(o,_),Object.defineProperty(o,"shape",{get:()=>{let b={..._};return Object.defineProperty(o,"shape",{value:b}),Nt.set(o,b),b}})}let c=ke(()=>bi(o));E(t,"propValues",(_)=>{let b=_.def.shape,z={};for(let w in b){let k=b[w]._zod;if(k.values){if(!Object.prototype.hasOwnProperty.call(z,w))L(z,w,new Set);for(let Z of k.values)z[w].add(Z);if(k.optin!==void 0)z[w].add(void 0)}}return z});let u=ge,p=o.catchall,f,m=B.memoizer;m?.attach(t),t._zod.parse=(_,b)=>{f??(f=c.value);let z=_.value;if(!u(z))return _.issues.push({expected:"object",code:"invalid_type",input:z,inst:t}),_;_.value=m?m.alloc(t,_,{},b):{};let w=[],k=f.shape;for(let Z of f.allKeys){if(Z==="__proto__")continue;let P=k[Z],O=P._zod.optin,I=P._zod.optout,J=P._zod.run({value:z[Z],issues:[]},b);if(J instanceof Promise)w.push(J.then((q)=>Xe(q,_,Z,z,O,I)));else Xe(J,_,Z,z,O,I)}if(!p)return w.length?Promise.all(w).then(()=>_):_;return zi(w,z,_,b,c.value,t)}}),vi=v("$ZodObjectJIT",(t,o)=>{iu.init(t,o);let n=t._zod.parse,c=ke(()=>bi(o)),u=B.memoizer,p=(Z)=>{let P=c.value,O=P.symbolKeys,I=new At(["payload","ctx"],{shape:Z,inst:t,memo:u,syms:O}),J=(K)=>`shape[${K}]._zod.run({ value: input[${K}], issues: [] }, ctx)`,q=(K,R)=>`
|
|
8
|
-
for (let i = 0; i < ${K}.issues.length; i++) {
|
|
9
|
-
const iss = ${K}.issues[i];
|
|
10
|
-
iss.path = iss.path ? [${R}, ...iss.path] : [${R}];
|
|
11
|
-
payload.issues.push(iss);
|
|
12
|
-
}`;I.write("const input = payload.value;");let qr=Object.create(null),kc=0;for(let K of P.allKeys)qr[K]=`key_${kc++}`;I.write(u?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let K of P.allKeys){if(K==="__proto__")continue;let R=qr[K],Q=typeof K==="symbol"?`syms[${O.indexOf(K)}]`:oo(K),lt=`${Q} in input`,Yr=Z[K],Xr=Yr?._zod?.optin,Hr=Xr!==void 0,Zc=Yr?._zod?.optout==="optional";if(I.write(`const ${R} = ${J(Q)};`),Hr&&Zc){let Pc=Xr==="optional"?`${R}_present`:`${R}.value !== undefined || ${R}_present`;I.write(`
|
|
13
|
-
const ${R}_present = ${lt};
|
|
14
|
-
if (!${R}.issues.length || ${R}_present) {
|
|
15
|
-
if (${R}.issues.length) {${q(R,Q)}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (${Pc}) {
|
|
19
|
-
newResult[${Q}] = ${R}.value;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
`)}else if(!Hr)I.write(`
|
|
24
|
-
const ${R}_present = ${lt};
|
|
25
|
-
if (${R}.issues.length) {${q(R,Q)}
|
|
26
|
-
}
|
|
27
|
-
if (!${R}_present && !${R}.issues.length) {
|
|
28
|
-
payload.issues.push({
|
|
29
|
-
code: "invalid_type",
|
|
30
|
-
expected: "nonoptional",
|
|
31
|
-
input: undefined,
|
|
32
|
-
path: [${Q}]
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (${R}_present) {
|
|
37
|
-
newResult[${Q}] = ${R}.value;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
`);else I.write(`
|
|
41
|
-
if (${R}.issues.length) {${q(R,Q)}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (${R}.value === undefined) {
|
|
45
|
-
if (${lt}) {
|
|
46
|
-
newResult[${Q}] = undefined;
|
|
47
|
-
}
|
|
48
|
-
} else {
|
|
49
|
-
newResult[${Q}] = ${R}.value;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
`)}return I.write("payload.value = newResult;"),I.write("return payload;"),I.compile()},f,m=ge,_=!B.jitless,z=_&&io.value,w=o.catchall,k;t._zod.parse=(Z,P)=>{k??(k=c.value);let O=Z.value;if(!m(O))return Z.issues.push({expected:"object",code:"invalid_type",input:O,inst:t}),Z;if(_&&z&&P?.async===!1&&P.jitless!==!0){if(!f)f=p(o.shape);if(Z=f(Z,P),!w)return Z;return zi([],O,Z,P,k,t)}return n(Z,P)}});function vn(t,o,n,c){for(let p of t)if(p.issues.length===0)return o.value=p.value,o;let u=t.filter((p)=>!he(p));if(u.length===1)return o.value=u[0].value,u[0];return o.issues.push({code:"invalid_union",input:o.value,inst:n,errors:t.map((p)=>p.issues.map((f)=>ne(f,c,W())))}),o}var Lt=v("$ZodUnion",(t,o)=>{A.init(t,o),E(t,"optin",(c)=>c.def.options.some((u)=>u._zod.optin==="defaulted")?"defaulted":c.def.options.some((u)=>u._zod.optin!==void 0)?"optional":void 0),E(t,"optout",(c)=>c.def.options.some((u)=>u._zod.optout==="optional")?"optional":void 0),E(t,"values",(c)=>{if(c.def.options.every((u)=>u._zod.values))return new Set(c.def.options.flatMap((u)=>Array.from(u._zod.values)));return}),E(t,"pattern",(c)=>{if(c.def.options.every((u)=>u._zod.pattern)){let u=c.def.options.map((p)=>p._zod.pattern);return new RegExp(`^(${u.map((p)=>Me(p.source)).join("|")})$`)}return});let n=o.options.length===1?o.options[0]._zod.run:null;t._zod.parse=(c,u)=>{if(n)return n(c,u);let p=!1,f=[];for(let m of o.options){let _=m._zod.run({value:c.value,issues:[]},u);if(_ instanceof Promise)f.push(_),p=!0;else{if(_.issues.length===0)return _;f.push(_)}}if(!p)return vn(f,c,t,u);return Promise.all(f).then((m)=>vn(m,c,t,u))}});var $i=v("$ZodDiscriminatedUnion",(t,o)=>{o.inclusive=!1,Lt.init(t,o);let n=t._zod.parse;E(t,"propValues",(u)=>{let p={};for(let f of u.def.options){let m=f._zod.propValues;if(!m||Object.keys(m).length===0)throw Error(`Invalid discriminated union option at index "${u.def.options.indexOf(f)}"`);for(let[_,b]of Object.entries(m)){if(!Object.prototype.hasOwnProperty.call(p,_))L(p,_,new Set);for(let z of b)p[_].add(z)}}return p}),o.options.forEach((u,p)=>{let f=Nt.get(u._zod.def);if(f&&!Object.prototype.hasOwnProperty.call(f,o.discriminator))throw Error(`Invalid discriminated union option at index "${p}"`)});let c=ke(()=>{let u=o.options,p=new Map;for(let f of u){let m=f._zod.propValues?.[o.discriminator];if(!m||m.size===0)throw Error(`Invalid discriminated union option at index "${o.options.indexOf(f)}"`);for(let _ of m){if(p.has(_))throw Error(`Duplicate discriminator value "${String(_)}"`);p.set(_,f)}}return p});t._zod.parse=(u,p)=>{let f=u.value;if(!ge(f))return u.issues.push({code:"invalid_type",expected:"object",input:f,inst:t}),u;let m=c.value.get(f?.[o.discriminator]);if(m)return m._zod.run(u,p);if(o.unionFallback||p.direction==="backward")return n(u,p);return u.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:o.discriminator,options:Array.from(c.value.keys()),input:f,path:[o.discriminator],inst:t}),u}}),wi=v("$ZodIntersection",(t,o)=>{A.init(t,o),t._zod.parse=(n,c)=>{let u=n.value,p=o.left._zod.run({value:u,issues:[]},c),f=o.right._zod.run({value:u,issues:[]},c);if(p instanceof Promise||f instanceof Promise)return Promise.all([p,f]).then(([_,b])=>$n(n,_,b));return $n(n,p,f)}});function Ct(t,o){if(t===o)return{valid:!0,data:t};if(t instanceof Date&&o instanceof Date&&+t===+o)return{valid:!0,data:t};if(me(t)&&me(o)){let n=Object.keys(o),c=Object.keys(t).filter((p)=>n.indexOf(p)!==-1),u={...t,...o};if(Object.prototype.hasOwnProperty.call(u,"__proto__"))delete u.__proto__;for(let p of c){if(p==="__proto__")continue;let f=Ct(t[p],o[p]);if(!f.valid)return{valid:!1,mergeErrorPath:[p,...f.mergeErrorPath]};u[p]=f.data}return{valid:!0,data:u}}if(Array.isArray(t)&&Array.isArray(o)){if(t.length!==o.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let c=0;c<t.length;c++){let u=t[c],p=o[c],f=Ct(u,p);if(!f.valid)return{valid:!1,mergeErrorPath:[c,...f.mergeErrorPath]};n.push(f.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function $n(t,o,n){let c=new Map,u,p=new Map,f=(b,z)=>{let w;if(b.code==="unrecognized_keys"&&!b.path?.length)u??(u=b),w=b.keys;else if(b.code==="invalid_key"&&b.origin==="record"&&b.path?.length===1){let k=String(b.path[0]);if(!p.has(k))p.set(k,b);w=[k]}else return!1;for(let k of w){if(!c.has(k))c.set(k,{});c.get(k)[z]=!0}return!0};for(let b of o.issues)if(!f(b,"l"))t.issues.push(b);for(let b of n.issues)if(!f(b,"r"))t.issues.push(b);let m=[...c].filter(([,b])=>b.l&&b.r).map(([b])=>b);if(m.length){let b=u?m.filter((z)=>u.keys.includes(z)):[];if(b.length)t.issues.push({...u,keys:b});for(let z of m)if(!b.includes(z)&&p.has(z))t.issues.push(p.get(z))}let _=Ct(o.value,n.value);if(!_.valid){if(he(t))return t;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(_.mergeErrorPath)}`)}return t.value=_.data,t}var ki=v("$ZodTuple",(t,o)=>{A.init(t,o);let n=o.items,c=B.memoizer;c?.attach(t),t._zod.parse=(u,p)=>{let f=u.value;if(!Array.isArray(f))return u.issues.push({input:f,inst:t,expected:"tuple",code:"invalid_type"}),u;u.value=c?c.alloc(t,u,[],p):[];let m=[],_=wn(n,"optin"),b=wn(n,"optout");if(!o.rest){if(f.length<_)return u.issues.push({code:"too_small",minimum:_,inclusive:!0,input:f,inst:t,origin:"array"}),u;if(f.length>n.length)u.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:f,inst:t,origin:"array"})}let z=Array(n.length);for(let w=0;w<n.length;w++){let k=n[w]._zod.run({value:f[w],issues:[]},p);if(k instanceof Promise)m.push(k.then((Z)=>{z[w]=Z}));else z[w]=k}if(o.rest){let w=n.length-1,k=f.slice(n.length);for(let Z of k){w++;let P=o.rest._zod.run({value:Z,issues:[]},p);if(P instanceof Promise)m.push(P.then((O)=>kn(O,u,w)));else kn(P,u,w)}}if(m.length)return Promise.all(m).then(()=>Zn(z,u,n,f,b));return Zn(z,u,n,f,b)}});function wn(t,o){for(let n=t.length-1;n>=0;n--)if(!(o==="optin"?t[n]._zod.optin!==void 0:t[n]._zod.optout==="optional"))return n+1;return 0}function kn(t,o,n){if(t.issues.length)o.issues.push(...te(n,t.issues));o.value[n]=t.value}function Zn(t,o,n,c,u){for(let p=0;p<n.length;p++){let f=t[p],m=p<c.length;if(!m&&p>=u&&n[p]._zod.optin==="optional"){o.value.length=p;break}if(f.issues.length){if(!m&&p>=u){o.value.length=p;break}o.issues.push(...te(p,f.issues))}o.value[p]=f.value}for(let p=o.value.length-1;p>=c.length;p--)if(n[p]._zod.optout==="optional"&&o.value[p]===void 0)o.value.length=p;else break;return o}var Zi=v("$ZodRecord",(t,o)=>{A.init(t,o);let n=B.memoizer;n?.attach(t),t._zod.parse=(c,u)=>{let p=c.value;if(!me(p))return c.issues.push({expected:"record",code:"invalid_type",input:p,inst:t}),c;let f=[],m=o.keyType._zod.values;if(m&&!o.partial){c.value=n?n.alloc(t,c,{},u):{};let _=new Set;for(let z of m)if(typeof z==="string"||typeof z==="number"||typeof z==="symbol"){if(_.add(typeof z==="number"?z.toString():z),z==="__proto__")continue;let w=o.keyType._zod.run({value:z,issues:[]},u);if(w instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(w.issues.length){c.issues.push({code:"invalid_key",origin:"record",issues:w.issues.map((P)=>ne(P,u,W())),input:z,path:[z],inst:t});continue}let k=w.value;if(k==="__proto__")continue;let Z=o.valueType._zod.run({value:p[z],issues:[]},u);if(Z instanceof Promise)f.push(Z.then((P)=>{if(P.issues.length)c.issues.push(...te(z,P.issues));c.value[k]=P.value}));else{if(Z.issues.length)c.issues.push(...te(z,Z.issues));c.value[k]=Z.value}}let b;for(let z in p)if(!_.has(z))if(o.mode==="loose"){if(z==="__proto__")continue;c.value[z]=p[z]}else b=b??[],b.push(z);if(b&&b.length>0)c.issues.push({code:"unrecognized_keys",input:p,inst:t,keys:b,continue:!0})}else{c.value=n?n.alloc(t,c,{},u):{};let _;for(let b of Reflect.ownKeys(p)){if(b==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(p,b))continue;let z=o.keyType._zod.run({value:b,issues:[]},u);if(z instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof b==="string"&&Ie.test(b)&&z.issues.length){let P=o.keyType._zod.run({value:Number(b),issues:[]},u);if(P instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(P.issues.length===0)z=P}if(z.issues.length){if(o.mode==="loose")c.value[b]=p[b];else if(m)_=_??[],_.push(b);else c.issues.push({code:"invalid_key",origin:"record",issues:z.issues.map((P)=>ne(P,u,W())),input:b,path:[b],inst:t});continue}let k=z.value;if(k==="__proto__")continue;let Z=o.valueType._zod.run({value:p[b],issues:[]},u);if(Z instanceof Promise)f.push(Z.then((P)=>{if(P.issues.length)c.issues.push(...te(b,P.issues));c.value[k]=P.value}));else{if(Z.issues.length)c.issues.push(...te(b,Z.issues));c.value[k]=Z.value}}if(_&&_.length>0)c.issues.push({code:"unrecognized_keys",input:p,inst:t,keys:_,continue:!0})}if(f.length)return Promise.all(f).then(()=>c);return c}});var Pi=v("$ZodEnum",(t,o)=>{A.init(t,o);let n=Ue(o.entries),c=new Set(n);t._zod.values=c;let u=n.filter((p)=>so.has(typeof p));t._zod.pattern=new RegExp(u.length?`^(${u.map((p)=>le(p.toString())).join("|")})$`:"^[^\\s\\S]$"),t._zod.parse=(p,f)=>{let m=p.value;if(c.has(m))return p;return p.issues.push({code:"invalid_value",values:n,input:m,inst:t}),p}}),Si=v("$ZodLiteral",(t,o)=>{A.init(t,o);let n=new Set(o.values);t._zod.values=n,t._zod.pattern=new RegExp(o.values.length?`^(${o.values.map((c)=>typeof c==="string"?le(c):c?le(c.toString()):String(c)).join("|")})$`:"^[^\\s\\S]$"),t._zod.parse=(c,u)=>{let p=c.value;if(n.has(p))return c;return c.issues.push({code:"invalid_value",values:o.values,input:p,inst:t}),c}});var Oi=v("$ZodTransform",(t,o)=>{A.init(t,o),t._zod.optin="optional",B.memoizer?.guard(t),t._zod.parse=(n,c)=>{if(c.direction==="backward")throw new Ze(t.constructor.name);let u=o.transform(n.value,n);if(c.async)return(u instanceof Promise?u:Promise.resolve(u)).then((f)=>(n.value=f,n));if(u instanceof Promise)throw new ie;return n.value=u,n}});function Pn(t,o){return t.value=o.issues.length?void 0:o.value,t}var Ft=v("$ZodOptional",(t,o)=>{A.init(t,o),E(t,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),t._zod.optout="optional",E(t,"values",(n)=>{let c=n.def.innerType._zod.values;return c?new Set([...c,void 0]):void 0}),E(t,"pattern",(n)=>{let c=n.def.innerType._zod.pattern;return c?new RegExp(`^(${Me(c.source)})?$`):void 0}),t._zod.parse=(n,c)=>{if(n.value===void 0){if(o.innerType._zod.optin!=="defaulted")return n;let u=o.innerType._zod.run({value:n.value,issues:[]},c);if(u instanceof Promise)return u.then((p)=>Pn(n,p));return Pn(n,u)}return o.innerType._zod.run(n,c)}}),Ii=v("$ZodExactOptional",(t,o)=>{Ft.init(t,o),E(t,"values",(n)=>n.def.innerType._zod.values),E(t,"pattern",(n)=>n.def.innerType._zod.pattern),t._zod.parse=(n,c)=>o.innerType._zod.run(n,c)}),Ei=v("$ZodNullable",(t,o)=>{A.init(t,o),E(t,"optin",(n)=>n.def.innerType._zod.optin),E(t,"optout",(n)=>n.def.innerType._zod.optout),E(t,"pattern",(n)=>{let c=n.def.innerType._zod.pattern;return c?new RegExp(`^(${Me(c.source)}|null)$`):void 0}),E(t,"values",(n)=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),t._zod.parse=(n,c)=>{if(n.value===null)return n;return o.innerType._zod.run(n,c)}}),Ti=v("$ZodDefault",(t,o)=>{A.init(t,o),t._zod.optin="defaulted",E(t,"values",(n)=>n.def.innerType._zod.values),t._zod.parse=(n,c)=>{if(c.direction==="backward")return o.innerType._zod.run(n,c);if(n.value===void 0)return n.value=o.defaultValue,n;let u=o.innerType._zod.run(n,c);if(u instanceof Promise)return u.then((p)=>Sn(p,o));return Sn(u,o)}});function Sn(t,o){if(t.value===void 0)t.value=o.defaultValue;return t}var Ai=v("$ZodPrefault",(t,o)=>{A.init(t,o),t._zod.optin="defaulted",E(t,"values",(n)=>n.def.innerType._zod.values),t._zod.parse=(n,c)=>{if(c.direction==="backward")return o.innerType._zod.run(n,c);if(n.value===void 0)n.value=o.defaultValue;return o.innerType._zod.run(n,c)}}),Ni=v("$ZodNonOptional",(t,o)=>{A.init(t,o),E(t,"values",(n)=>{let c=n.def.innerType._zod.values;return c?new Set([...c].filter((u)=>u!==void 0)):void 0}),t._zod.parse=(n,c)=>{let u=o.innerType._zod.run(n,c);if(u instanceof Promise)return u.then((p)=>On(p,t));return On(u,t)}});function On(t,o){if(!t.issues.length&&t.value===void 0)t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:o});return t}function In(t,o,n,c){if(!o.issues.length){if(t.value=o.value,o.memo)t.memo=!0;return t}return t.value=n.catchValue({...o,value:t.value,error:{issues:o.issues.map((u)=>ne(u,c,W()))},input:t.value}),t}var Ci=v("$ZodCatch",(t,o)=>{A.init(t,o),E(t,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),E(t,"optout",(n)=>n.def.innerType._zod.optout),E(t,"values",(n)=>n.def.innerType._zod.values),t._zod.parse=(n,c)=>{if(c.direction==="backward")return o.innerType._zod.run(n,c);let u=o.innerType._zod.run({value:n.value,issues:[]},c);if(u instanceof Promise)return u.then((p)=>In(n,p,o,c));return In(n,u,o,c)}});var Ut=v("$ZodPipe",(t,o)=>{A.init(t,o),E(t,"values",(n)=>n.def.in._zod.values),E(t,"optin",(n)=>n.def.in._zod.optin),E(t,"optout",(n)=>n.def.out._zod.optout),E(t,"propValues",(n)=>n.def.in._zod.propValues),t._zod.parse=(n,c)=>{if(c.direction==="backward"){let p=o.out._zod.run(n,c);if(p instanceof Promise)return p.then((f)=>Ye(f,o.in,c));return Ye(p,o.in,c)}let u=o.in._zod.run(n,c);if(u instanceof Promise)return u.then((p)=>Ye(p,o.out,c));return Ye(u,o.out,c)}});function Ye(t,o,n){if(t.issues.some((c)=>c.code!=="unrecognized_keys"))return t.aborted=!0,t;return o._zod.run({value:t.value,issues:t.issues},n)}var ji=v("$ZodPreprocess",(t,o)=>{Ut.init(t,o)}),Ri=v("$ZodReadonly",(t,o)=>{A.init(t,o),E(t,"propValues",(n)=>n.def.innerType._zod.propValues),E(t,"values",(n)=>n.def.innerType._zod.values),E(t,"optin",(n)=>n.def.innerType?._zod?.optin),E(t,"optout",(n)=>n.def.innerType?._zod?.optout),t._zod.parse=(n,c)=>{if(c.direction==="backward")return o.innerType._zod.run(n,c);let u=o.innerType._zod.run(n,c);if(u instanceof Promise)return u.then(En);return En(u)}});function En(t){if(!t.memo)t.value=Object.freeze(t.value);return t}var Di=v("$ZodLazy",(t,o)=>{A.init(t,o),ro(t._zod,"innerType",()=>{let n=o;if(!n._cachedInner)n._cachedInner=o.getter();return n._cachedInner}),E(t,"pattern",(n)=>n.innerType?._zod?.pattern),E(t,"propValues",(n)=>n.innerType?._zod?.propValues),E(t,"optin",(n)=>n.innerType?._zod?.optin??void 0),E(t,"optout",(n)=>n.innerType?._zod?.optout??void 0),t._zod.parse=(n,c)=>t._zod.innerType._zod.run(n,c)}),Li=v("$ZodCustom",(t,o)=>{M.init(t,o),A.init(t,o),t._zod.parse=(n,c)=>n,t._zod.check=(n)=>{let c=n.value,u=o.fn(c);if(u instanceof Promise)return u.then((p)=>Tn(p,n,c,t));Tn(u,n,c,t);return}});function Tn(t,o,n,c){if(!t){let u={code:"custom",input:n,inst:c,path:[...c._zod.def.path??[]],continue:!c._zod.def.abort};if(c._zod.def.params)u.params=c._zod.def.params;o.issues.push(_e(u))}}class Mi extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var Jt="~memo",Fi=[];function Mt(t){return t.map((o)=>o.path?{...o,path:o.path.slice()}:{...o})}var Ui=new WeakMap;function Ji(t,o){let n=Ui.get(t);if(n!==void 0)return n;if(o.has(t))return!0;o.add(t);let c=!1,u=(m)=>{if(!c&&m?._zod&&Ji(m,o))c=!0},p=t._zod.def,f=p.type;switch(f){case"object":{for(let m of Reflect.ownKeys(p.shape))u(p.shape[m]);u(p.catchall);break}case"array":u(p.element);break;case"tuple":for(let m of p.items)u(m);u(p.rest);break;case"record":case"map":u(p.keyType),u(p.valueType);break;case"set":u(p.valueType);break;case"union":for(let m of p.options)u(m);break;case"intersection":u(p.left),u(p.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":u(p.innerType);break;case"pipe":u(p.in),u(p.out);break;case"function":u(p.input),u(p.output);break;case"lazy":u(t._zod.innerType);break;case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let m in p){let _=Object.getOwnPropertyDescriptor(p,m);if(!_||_.get)continue;let b=_.value;if(!b||typeof b!=="object")continue;if(b._zod)u(b);else if(Array.isArray(b))for(let z of b)u(z)}}return o.delete(t),Ui.set(t,c),c}function su(t,o){let n=t.buckets.get(o);if(!n)n=new Map,t.buckets.set(o,n);return n}var Qe,et=[],cu={alloc(t,o,n){let c=Qe;if(!c)return n;Qe=void 0;let u={value:n,issues:null};return c.set(o.value,u),et.push(u),n},guard(t){var o;(o=t._zod).deferred??(o.deferred=[]),t._zod.deferred.push(()=>{let n=t._zod.parse,c=(u,p)=>{if(p.direction!=="backward"&&uu(p,u.value))throw new Mi;return n(u,p)};if(t._zod.parse=c,t._zod.run===n)t._zod.run=c})},attach(t){var o;let n,c,u;(o=t._zod).deferred??(o.deferred=[]),t._zod.deferred.push(()=>{let p=t._zod.parse,f=(m,_)=>{if(n===void 0){if(n=Ji(t,new Set),!n){if(t._zod.parse=p,t._zod.run===f)t._zod.run=p;return p(m,_)}}let b=m.value;if(b===null||typeof b!=="object")return p(m,_);let z=_[Jt];if(!z)z={buckets:new Map,backEdges:void 0},_[Jt]=z;let w;if(c===_)w=u;else w=su(z,t),c=_,u=w;let k=w.get(b);if(k){if(m.value=k.value,k.issues){if(k.issues.length)m.issues.push(...Mt(k.issues))}else m.memo=!0,z.backEdges??(z.backEdges=new Set),z.backEdges.add(k.value);return m}Qe=w;let Z=et.length,P=p(m,_);Qe=void 0;let O=et.length>Z?et.pop():void 0;if(P instanceof Promise)return P.then((I)=>{if(O)O.issues=I.issues.length?Mt(I.issues):Fi;return I});if(O)O.issues=P.issues.length?Mt(P.issues):Fi;return P};if(t._zod.parse=f,t._zod.run===p)t._zod.run=f})}};function Bt(){return cu}function uu(t,o){let n=t[Jt]?.backEdges;return n!==void 0&&o!==null&&typeof o==="object"&&n.has(o)}var au=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function o(p){return t[p]??null}let n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",credit_card:"credit card number",jwt:"JWT",template_literal:"input"},c={nan:"NaN"};function u(p,f){if(p==="number"&&typeof f==="number"&&!Number.isFinite(f))return String(f);return c[p]??p}return(p)=>{switch(p.code){case"invalid_type":{let f=u(p.expected),m=po(p.input),_=u(m,p.input);return`Invalid input: expected ${f}, received ${_}`}case"invalid_value":if(p.values.length===1)return`Invalid input: expected ${ht(p.values[0])}`;return`Invalid option: expected one of ${ft(p.values,"|")}`;case"too_big":{let f=p.exact?"exactly ":p.inclusive?"<=":"<",m=o(p.origin);if(m)return`Too big: expected ${p.origin??"value"} to have ${f}${p.maximum.toString()} ${m.unit??"elements"}`;return`Too big: expected ${p.origin??"value"} to be ${f}${p.maximum.toString()}`}case"too_small":{let f=p.exact?"exactly ":p.inclusive?">=":">",m=o(p.origin);if(m)return`Too small: expected ${p.origin} to have ${f}${p.minimum.toString()} ${m.unit}`;return`Too small: expected ${p.origin} to be ${f}${p.minimum.toString()}`}case"invalid_format":{let f=p;if(f.format==="starts_with")return`Invalid string: must start with "${f.prefix}"`;if(f.format==="ends_with")return`Invalid string: must end with "${f.suffix}"`;if(f.format==="includes")return`Invalid string: must include "${f.includes}"`;if(f.format==="regex")return`Invalid string: must match pattern ${f.pattern}`;return`Invalid ${n[f.format]??p.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${p.divisor}`;case"unrecognized_keys":return`Unrecognized key${p.keys.length>1?"s":""}: ${ft(p.keys,", ")}`;case"invalid_key":return`Invalid key in ${p.origin}`;case"invalid_union":if(p.options&&Array.isArray(p.options)&&p.options.length>0)return`Invalid discriminator value. Expected ${p.options.map((m)=>`'${m}'`).join(" | ")}`;if(p.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${p.origin}`;default:return"Invalid input"}}};function Vt(){return{localeError:au()}}var Bi;class Vi{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...o){let n=o[0];if(this._map.set(t,n),n&&typeof n==="object"&&"id"in n)this._idmap.set(n.id,t);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let o=this._map.get(t);if(o&&typeof o==="object"&&"id"in o)this._idmap.delete(o.id);return this._map.delete(t),this}get(t){let o=t._zod.parent;if(o){let n={...this.get(o)??{}};delete n.id;let c={...n,...this._map.get(t)};return Object.keys(c).length?c:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Ki(){return new Vi}(Bi=globalThis).__zod_globalRegistry??(Bi.__zod_globalRegistry=Ki());var pe=globalThis.__zod_globalRegistry;function Wi(t,o){return new t({type:"string",...S(o)})}function Gi(t,o){return new t({type:"string",coerce:!0,...S(o)})}function Kt(t,o){return new t({type:"string",format:"email",check:"string_format",abort:!1,...S(o)})}function qi(t,o){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...S(o)})}function Yi(t,o){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...S(o)})}function Xi(t,o){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...S(o)})}function Qi(t,o){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...S(o)})}function es(t,o){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...S(o)})}function Wt(t,o){return new t({type:"string",format:"url",check:"string_format",abort:!1,...S(o)})}function ts(t,o){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...S(o)})}function rs(t,o){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...S(o)})}function os(t,o){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...S(o)})}function ns(t,o){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...S(o)})}function is(t,o){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...S(o)})}function ss(t,o){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...S(o)})}function cs(t,o){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...S(o)})}function Gt(t,o){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...S(o)})}function qt(t,o){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...S(o)})}function us(t,o){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...S(o)})}function as(t,o){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...S(o)})}function ls(t,o){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...S(o)})}function ps(t,o){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...S(o)})}function fs(t,o){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...S(o)})}function ds(t,o){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...S(o)})}function tt(t,o){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...S(o)})}function rt(t,o){return new t({type:"string",format:"date",check:"string_format",...S(o)})}function Xt(t,o){return new t({type:"string",format:"time",check:"string_format",precision:null,...S(o)})}function Ht(t,o){return new t({type:"string",format:"duration",check:"string_format",...S(o)})}function ms(t,o){return new t({type:"number",checks:[],...S(o)})}function hs(t,o){return new t({type:"number",coerce:!0,checks:[],...S(o)})}function _s(t,o){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...S(o)})}function gs(t,o){return new t({type:"boolean",...S(o)})}function xs(t,o){return new t({type:"boolean",coerce:!0,...S(o)})}function ys(t,o){return new t({type:"bigint",coerce:!0,...S(o)})}function bs(t,o){return new t({type:"null",...S(o)})}function zs(t){return new t({type:"any"})}function vs(t){return new t({type:"unknown"})}function $s(t,o){return new t({type:"never",...S(o)})}function ws(t,o){return new t({type:"void",...S(o)})}function ks(t,o){return new t({type:"date",...S(o)})}function Zs(t,o){return new t({type:"date",coerce:!0,...S(o)})}function ye(t,o){return new Et({check:"less_than",...S(o),value:t,inclusive:!1})}function se(t,o){return new Et({check:"less_than",...S(o),value:t,inclusive:!0})}function be(t,o){return new Tt({check:"greater_than",...S(o),value:t,inclusive:!1})}function ce(t,o){return new Tt({check:"greater_than",...S(o),value:t,inclusive:!0})}function Te(t,o){return new sn({check:"multiple_of",...S(o),value:t})}function ot(t,o){return new un({check:"max_length",...S(o),maximum:t})}function ze(t,o){return new an({check:"min_length",...S(o),minimum:t})}function nt(t,o){return new ln({check:"length_equals",...S(o),length:t})}function Qt(t,o){return new pn({check:"string_format",format:"regex",...S(o),pattern:t})}function er(t){return new fn({check:"string_format",format:"lowercase",...S(t)})}function tr(t){return new dn({check:"string_format",format:"uppercase",...S(t)})}function rr(t,o){return new mn({check:"string_format",format:"includes",...S(o),includes:t})}function or(t,o){return new hn({check:"string_format",format:"starts_with",...S(o),prefix:t})}function nr(t,o){return new _n({check:"string_format",format:"ends_with",...S(o),suffix:t})}function fe(t){return new gn({check:"overwrite",tx:t})}function ir(t){return fe((o)=>o.normalize(t))}function sr(){return fe((t)=>t.trim())}function cr(){return fe((t)=>t.toLowerCase())}function ur(){return fe((t)=>t.toUpperCase())}function ar(){return fe((t)=>no(t))}function Ss(t,o,n){return new t({type:"array",element:o,...S(n)})}function Os(t,o,n){let c=S(n);return c.abort??(c.abort=!0),new t({type:"custom",check:"custom",fn:o,...c})}function Is(t,o,n){return new t({type:"custom",check:"custom",fn:o,...S(n)})}function Es(t,o){let n=lu((c)=>(c.addIssue=(u)=>{if(typeof u==="string")c.issues.push(_e(u,c.value,n._zod.def));else{let p=u;if(p.fatal)p.continue=!1;if(p.code??(p.code="custom"),!("input"in p))p.input=c.value;p.inst??(p.inst=n),p.continue??(p.continue=!n._zod.def.abort),c.issues.push(_e(p))}},t(c.value,c)),o);return n}function lu(t,o){let n=new M({check:"custom",...S(o)});return n._zod.check=t,n}function Ae(t,...o){for(let n of o)for(let c of Reflect.ownKeys(n))if(Object.prototype.propertyIsEnumerable.call(n,c))L(t,c,n[c]);return t}function Ce(t){let o=t?.target??"draft-2020-12";if(o==="draft-4")o="draft-04";if(o==="draft-7")o="draft-07";return{processors:t.processors??{},metadataRegistry:t?.metadata??pe,target:o,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:t?.cycles??"ref",reused:t?.reused??"inline",intersections:[],deferred:[],external:t?.external??void 0}}function F(t,o,n,c,u){let p=typeof o.unrepresentable==="function"?o.unrepresentable({zodSchema:t,path:c.path,message:u}):o.unrepresentable;if(p==="any")return!1;if(p===void 0||p==="throw")throw Error(u);return Object.assign(n,p),!0}function C(t,o,n={path:[],schemaPath:[]}){var c;let u=t._zod.def,p=o.seen.get(t);if(p){if(p.count++,n.schemaPath.includes(t))p.cycle=n.path;return p.schema}let f={schema:{},count:1,cycle:void 0,path:n.path};o.seen.set(t,f),o.sharedDefsExtractedFor=void 0,o.sharedEmitDoneFor=void 0;let m=t._zod.toJSONSchema?.();if(m)f.schema=m;else{let z={...n,schemaPath:[...n.schemaPath,t],path:n.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(o,f.schema,z);else{let k=f.schema,Z=o.processors[u.type];if(!Z)throw Error(`[toJSONSchema]: Non-representable type encountered: ${u.type}`);Z(t,o,k,z)}let w=t._zod.parent;if(w){if(!f.ref)f.ref=w;C(w,o,z),o.seen.get(w).isParent=!0}}let _=o.metadataRegistry.get(t);if(_)Ae(f.schema,_);if(o.io==="input"&&V(t))delete f.schema.examples,delete f.schema.default;if(o.io==="input"&&"_prefault"in f.schema)(c=f.schema).default??(c.default=f.schema._prefault);return delete f.schema._prefault,o.seen.get(t).schema}function Ts(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function Re(t,o){let n=t.seen.get(o);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");if(t.external&&t.sharedDefsExtractedFor===t.external)return;let c=new Map;for(let f of t.seen.entries()){let m=t.metadataRegistry.get(f[0])?.id;if(m){let _=c.get(m);if(_&&_!==f[0])throw Error(`Duplicate schema id "${m}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);c.set(m,f[0])}}let u=(f)=>{let m=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){let w=t.external.registry.get(f[0])?.id,k=t.external.uri??((P)=>P);if(w)return{ref:k(w)};let Z=f[1].defId??f[1].schema.id??`schema${t.counter++}`;return f[1].defId=Z,{defId:Z,ref:`${k("__shared")}#/${m}/${Ts(Z)}`}}let _="#",b=`${_}/${m}/`;if(f[1]===n&&!f[1].schema.id)return{ref:_};let z=f[1].schema.id??`__schema${t.counter++}`;return{defId:z,ref:b+Ts(z)}},p=(f)=>{if(f[1].schema.$ref)return;let m=f[1],{ref:_,defId:b}=u(f);if(m.def={...m.schema},b)m.defId=b;let z=m.schema;for(let w in z)delete z[w];z.$ref=_};if(t.cycles==="throw")for(let f of t.seen.entries()){let m=f[1];if(m.cycle)throw Error(`Cycle detected: #/${m.cycle?.join("/")}/<root>
|
|
53
|
-
|
|
54
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let f of t.seen.entries()){let m=f[1];if(o===f[0]){p(f);continue}if(t.external){let b=t.external.registry.get(f[0])?.id;if(o!==f[0]&&b){p(f);continue}}if(t.metadataRegistry.get(f[0])?.id){p(f);continue}if(m.cycle){p(f);continue}if(m.count>1){if(t.reused==="ref"){p(f);continue}}}if(t.external)t.sharedDefsExtractedFor=t.external}function Cs(t){let o=t.anyOf;if(!Array.isArray(o)||o.length===0||t.type!==void 0)return;let n=[];for(let c of o){if(!c||typeof c!=="object")return;Cs(c);let u=Object.keys(c);if(u.length!==1||u[0]!=="type")return;let p=c.type;for(let f of Array.isArray(p)?p:[p]){if(typeof f!=="string")return;if(!n.includes(f))n.push(f)}}delete t.anyOf,t.type=n.length===1?n[0]:n}var js=new Set(["type","properties","required","additionalProperties"]),As=["oneOf","anyOf"];function Ns(t){let o=t.additionalProperties;if(o===void 0||o===!1||typeof o!=="object"||o===null)return null;return Object.keys(o).length?o:null}function lr(t){let o=[];for(let p of t){if(typeof p!=="object"||p.type!=="object")return null;for(let f in p)if(!js.has(f))return null;o.push(p)}let n={},c=new Set;for(let p of o){for(let f in p.properties){if(Object.prototype.hasOwnProperty.call(n,f))continue;let m=[];for(let b of o){let z=b.properties?.[f]??Ns(b);if(z===null||z===void 0)continue;if(!m.some((w)=>JSON.stringify(w)===JSON.stringify(z)))m.push(z)}let _=m.length===1?m[0]:lr(m)??{allOf:m};L(n,f,_)}for(let f of p.required??[])c.add(f)}let u={type:"object",properties:n};if(c.size)u.required=[...c];if(o.every((p)=>p.additionalProperties===!1))u.additionalProperties=!1;else{let p=[];for(let f of o){let m=Ns(f);if(m&&!p.some((_)=>JSON.stringify(_)===JSON.stringify(m)))p.push(m)}if(p.length===1)u.additionalProperties=p[0];else if(p.length>1)u.additionalProperties={allOf:p}}return u}function pu(t){let o=t.allOf;if(!Array.isArray(o)||o.length<2)return;for(let u of js)if(u in t)return;let n=o.filter((u)=>As.some((p)=>Array.isArray(u[p]))),c=null;if(!n.length)c=lr(o);else{let u=n[0],p=As.find((_)=>Array.isArray(u[_]));if(Object.keys(u).length!==1)return;let f=o.filter((_)=>_!==u),m=u[p].map((_)=>lr([...f,_]));if(m.some((_)=>!_))return;c={[p]:m}}if(!c)return;delete t.allOf,Ae(t,c)}function De(t,o){let n=t.seen.get(o);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let c=(m)=>{let _=t.seen.get(m);if(_.ref===null)return;let b=_.def??_.schema,z={...b},w=_.ref;if(_.ref=null,w){c(w);let Z=t.seen.get(w),P=Z.schema;if(P.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"))b.allOf=b.allOf??[],b.allOf.push(P);else Ae(b,P);if(Ae(b,z),m._zod.parent===w)for(let I in b){if(I==="$ref"||I==="allOf")continue;if(!(I in z))delete b[I]}if(P.$ref&&Z.def)for(let I in b){if(I==="$ref"||I==="allOf")continue;if(I in Z.def&&JSON.stringify(b[I])===JSON.stringify(Z.def[I]))delete b[I]}}let k=m._zod.parent;if(k&&k!==w){c(k);let Z=t.seen.get(k);if(Z?.schema.$ref){if(b.$ref=Z.schema.$ref,Z.def)for(let P in b){if(P==="$ref"||P==="allOf")continue;if(P in Z.def&&JSON.stringify(b[P])===JSON.stringify(Z.def[P]))delete b[P]}}}t.override({zodSchema:m,jsonSchema:b,path:_.path??[]})};if(!t.external||t.sharedEmitDoneFor!==t.external){for(let m of[...t.seen.entries()].reverse())c(m[0]);if(t.target!=="openapi-3.0")for(let m of t.seen.entries())Cs(m[1].def??m[1].schema);for(let m of t.deferred)m();if(t.intersections.length){let m=new Map;for(let _ of t.seen.values())for(let b of[_.schema,_.def]){let z=b?.allOf;if(!Array.isArray(z))continue;let w=m.get(z);if(w)w.push(b);else m.set(z,[b])}for(let _ of t.intersections)for(let b of m.get(_)??[])pu(b)}}let u={};if(t.target==="draft-2020-12")u.$schema="https://json-schema.org/draft/2020-12/schema";else if(t.target==="draft-07")u.$schema="http://json-schema.org/draft-07/schema#";else if(t.target==="draft-04")u.$schema="http://json-schema.org/draft-04/schema#";else if(t.target==="openapi-3.0");if(t.external?.uri){let m=t.external.registry.get(o)?.id;if(!m)throw Error("Schema is missing an `id` property");u.$id=t.external.uri(m)}Ae(u,n.defId?n.schema:n.def??n.schema);let p=t.metadataRegistry.get(o)?.id;if(p!==void 0&&u.id===p)delete u.id;let f=t.external?.defs??{};if(!t.external||t.sharedEmitDoneFor!==t.external)for(let m of t.seen.entries()){let _=m[1];if(_.def&&_.defId){if(_.def.id===_.defId)delete _.def.id;L(f,_.defId,_.def)}}if(t.external)t.sharedEmitDoneFor=t.external;if(t.external);else if(Object.keys(f).length>0)if(t.target==="draft-2020-12")u.$defs=f;else u.definitions=f;try{let m=JSON.parse(JSON.stringify(u));return Object.defineProperty(m,"~standard",{value:{...o["~standard"],jsonSchema:{input:Ne(o,"input",t.processors),output:Ne(o,"output",t.processors)}},enumerable:!1,writable:!1}),m}catch(m){throw Error("Error converting schema to JSON.")}}function V(t,o){let n=o??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);let c=t._zod.def;if(c.type==="transform")return!0;if(c.type==="array")return V(c.element,n);if(c.type==="set")return V(c.valueType,n);if(c.type==="lazy")return V(c.getter(),n);if(c.type==="promise"||c.type==="optional"||c.type==="nonoptional"||c.type==="nullable"||c.type==="readonly"||c.type==="default"||c.type==="prefault"||c.type==="catch")return V(c.innerType,n);if(c.type==="intersection")return V(c.left,n)||V(c.right,n);if(c.type==="record"||c.type==="map")return V(c.keyType,n)||V(c.valueType,n);if(c.type==="pipe"){if(t._zod.traits.has("$ZodCodec"))return!0;return V(c.in,n)||V(c.out,n)}if(c.type==="object"){for(let u in c.shape)if(V(c.shape[u],n))return!0;return!1}if(c.type==="union"){for(let u of c.options)if(V(u,n))return!0;return!1}if(c.type==="tuple"){for(let u of c.items)if(V(u,n))return!0;if(c.rest&&V(c.rest,n))return!0;return!1}return!1}var Ds=(t,o={})=>(n)=>{let c=Ce({...n,processors:o});return C(t,c),Re(c,t),De(c,t)},Ne=(t,o,n={})=>(c)=>{let{libraryOptions:u,target:p}=c??{},f=Ce({...u??{},target:p,io:o,processors:n});return C(t,f),Re(f,t),De(f,t)};var fu={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},dr=(t,o,n,c)=>{let u=n;u.type="string";let{minimum:p,maximum:f,format:m,patterns:_,contentEncoding:b,laxFormat:z}=t._zod.bag;if(typeof p==="number")u.minLength=p;if(typeof f==="number")u.maxLength=f;if(m){if(u.format=fu[m]??m,u.format==="")delete u.format;if(m==="time"||z)delete u.format}if(b)u.contentEncoding=b;if(_&&_.size>0){let w=[..._];if(w.length===1)u.pattern=w[0].source;else if(w.length>1)u.allOf=[...w.map((k)=>({...o.target==="draft-07"||o.target==="draft-04"||o.target==="openapi-3.0"?{type:"string"}:{},pattern:k.source}))]}},mr=(t,o,n,c)=>{let u=n,{minimum:p,maximum:f,format:m,multipleOf:_,exclusiveMaximum:b,exclusiveMinimum:z}=t._zod.bag;if(typeof m==="string"&&m.includes("int"))u.type="integer";else u.type="number";let w=typeof z==="number"&&z>=(p??Number.NEGATIVE_INFINITY),k=typeof b==="number"&&b<=(f??Number.POSITIVE_INFINITY),Z=o.target==="draft-04"||o.target==="openapi-3.0";if(w)if(Z)u.minimum=z,u.exclusiveMinimum=!0;else u.exclusiveMinimum=z;else if(typeof p==="number")u.minimum=p;if(k)if(Z)u.maximum=b,u.exclusiveMaximum=!0;else u.exclusiveMaximum=b;else if(typeof f==="number")u.maximum=f;if(typeof _==="number")if(Number.isFinite(_)&&_!==0)u.multipleOf=Math.abs(_);else F(t,o,u,c,`A multipleOf divisor of ${_} cannot be represented in JSON Schema`)},hr=(t,o,n,c)=>{n.type="boolean"},_r=(t,o,n,c)=>{F(t,o,n,c,"BigInt cannot be represented in JSON Schema")},Fs=(t,o,n,c)=>{F(t,o,n,c,"Symbols cannot be represented in JSON Schema")},gr=(t,o,n,c)=>{if(o.target==="openapi-3.0")n.type="string",n.nullable=!0,n.enum=[null];else n.type="null"},Us=(t,o,n,c)=>{F(t,o,n,c,"Undefined cannot be represented in JSON Schema")},xr=(t,o,n,c)=>{F(t,o,n,c,"Void cannot be represented in JSON Schema")},yr=(t,o,n,c)=>{n.not={}},br=(t,o,n,c)=>{},zr=(t,o,n,c)=>{},vr=(t,o,n,c)=>{F(t,o,n,c,"Date cannot be represented in JSON Schema")},$r=(t,o,n,c)=>{let u=t._zod.def,p=Ue(u.entries);if(p.length===0){n.not={};return}if(p.every((f)=>typeof f==="number"))n.type="number";if(p.every((f)=>typeof f==="string"))n.type="string";n.enum=p},wr=(t,o,n,c)=>{let u=t._zod.def;if(u.values.length===0){n.not={};return}let p=[];for(let f of u.values)if(f===void 0){if(F(t,o,n,c,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof f==="bigint"){if(F(t,o,n,c,"BigInt literals cannot be represented in JSON Schema"))return;p.push(Number(f))}else p.push(f);if(p.length===0);else if(p.length===1){let f=p[0];if(n.type=f===null?"null":typeof f,o.target==="draft-04"||o.target==="openapi-3.0")n.enum=[f];else n.const=f}else{if(p.every((f)=>typeof f==="number"))n.type="number";if(p.every((f)=>typeof f==="string"))n.type="string";if(p.every((f)=>typeof f==="boolean"))n.type="boolean";if(p.every((f)=>f===null))n.type="null";n.enum=p}},Ms=(t,o,n,c)=>{F(t,o,n,c,"NaN cannot be represented in JSON Schema")},Js=(t,o,n,c)=>{let u=n,p=t._zod.pattern;if(!p)throw Error("Pattern not found in template literal");u.type="string",u.pattern=p.source},Bs=(t,o,n,c)=>{let u=n,p={type:"string",format:"binary",contentEncoding:"binary"},{minimum:f,maximum:m,mime:_}=t._zod.bag;if(f!==void 0)p.minLength=f;if(m!==void 0)p.maxLength=m;if(_)if(_.length===1)p.contentMediaType=_[0],Object.assign(u,p);else Object.assign(u,p),u.anyOf=_.map((b)=>({contentMediaType:b}));else Object.assign(u,p)},Vs=(t,o,n,c)=>{n.type="boolean"},kr=(t,o,n,c)=>{F(t,o,n,c,"Custom types cannot be represented in JSON Schema")},Ks=(t,o,n,c)=>{F(t,o,n,c,"Function types cannot be represented in JSON Schema")},Pr=(t,o,n,c)=>{F(t,o,n,c,"Transforms cannot be represented in JSON Schema")},Ws=(t,o,n,c)=>{F(t,o,n,c,"Map cannot be represented in JSON Schema")},Gs=(t,o,n,c)=>{F(t,o,n,c,"Set cannot be represented in JSON Schema")},Sr=(t,o,n,c)=>{let u=n,p=t._zod.def,{minimum:f,maximum:m}=t._zod.bag;if(typeof f==="number")u.minItems=f;if(typeof m==="number")u.maxItems=m;u.type="array",u.items=C(p.element,o,{...c,path:[...c.path,"items"]})};function Le(t){let o=t._zod.def;if(o.type==="pipe"&&o.in._zod.traits.has("$ZodTransform"))return Le(o.out);if(o.type==="catch")return Le(o.innerType);return t._zod.optin}var Or=(t,o,n,c)=>{let u=n,p=t._zod.def,f=p.shape;if(Object.getOwnPropertySymbols(f).length&&F(t,o,u,c,"Symbol keys cannot be represented in JSON Schema"))return;u.type="object",u.properties={};for(let z in f)L(u.properties,z,C(f[z],o,{...c,path:[...c.path,"properties",z]}));let _=new Set(Object.keys(f)),b=new Set([..._].filter((z)=>{let w=p.shape[z];if(o.io==="input")return Le(w)===void 0;else return w._zod.optout===void 0}));if(b.size>0)u.required=Array.from(b);if(p.catchall?._zod.def.type==="never")u.additionalProperties=!1;else if(!p.catchall){if(o.io==="output")u.additionalProperties=!1}else if(p.catchall)u.additionalProperties=C(p.catchall,o,{...c,path:[...c.path,"additionalProperties"]})},Ir=(t,o,n,c)=>{let u=t._zod.def,p=u.inclusive===!1,f=u.options.map((m,_)=>C(m,o,{...c,path:[...c.path,p?"oneOf":"anyOf",_]}));if(p)n.oneOf=f;else n.anyOf=f},Er=(t,o,n,c)=>{let u=t._zod.def,p=C(u.left,o,{...c,path:[...c.path,"allOf",0]}),f=C(u.right,o,{...c,path:[...c.path,"allOf",1]}),m=(b)=>("allOf"in b)&&Object.keys(b).length===1,_=[...m(p)?p.allOf:[p],...m(f)?f.allOf:[f]];n.allOf=_,o.intersections.push(_)},Tr=(t,o,n,c)=>{let u=n,p=t._zod.def;u.type="array";let f=o.target==="draft-2020-12"?"prefixItems":"items",m=o.target==="draft-2020-12"?"items":o.target==="openapi-3.0"?"items":"additionalItems",_=p.items.map((O,I)=>C(O,o,{...c,path:[...c.path,f,I]})),b=p.rest?C(p.rest,o,{...c,path:[...c.path,m,...o.target==="openapi-3.0"?[p.items.length]:[]]}):null,z=p.items.length;while(z>0){let O=p.items[z-1];if(!(o.io==="input"?Le(O)!==void 0:O._zod.optout==="optional"))break;z--}let w=p.items.length,k=!p.rest;if(o.target==="draft-2020-12"){if(u.prefixItems=_,k)u.items=!1;else if(b)u.items=b;if(z>0)u.minItems=z;if(k)u.maxItems=w}else if(o.target==="openapi-3.0"){if(u.items={anyOf:_},b)u.items.anyOf.push(b);if(z>0)u.minItems=z;if(k)u.maxItems=w}else{if(u.items=_,k)u.additionalItems=!1;else if(b)u.additionalItems=b;if(z>0)u.minItems=z;if(k)u.maxItems=w}let{minimum:Z,maximum:P}=t._zod.bag;if(typeof Z==="number")u.minItems=Z;if(typeof P==="number")u.maxItems=P};function pr(t,o,n){if(o.$ref){if(n.has(o))return o;n.add(o);let P=t.get(o)?.def;if(!P)return o;let O=pr(t,P,n);return O===P?o:O}for(let P of["anyOf","oneOf"]){let O=o[P];if(!Array.isArray(O))continue;let I=O.map((J)=>pr(t,J,n));if(I.some((J,q)=>J!==O[q]))o={...o,[P]:I}}let c=Array.isArray(o.type)?o.type:[o.type],u=!c.includes("string")&&c.some((P)=>P==="number"||P==="integer"),p=o.enum??(o.const!==void 0?[o.const]:void 0);if(!u&&!p?.some((P)=>typeof P==="number"))return o;let{minimum:f,maximum:m,exclusiveMinimum:_,exclusiveMaximum:b,multipleOf:z,format:w,id:k,...Z}=o;if(Z.enum)Z.enum=Z.enum.map((P)=>typeof P==="number"?String(P):P);else if(typeof Z.const==="number")Z.const=String(Z.const);if(!u)return Z;if(Z.type="string",!p)Z.pattern=(c.includes("number")?Ie:Ge).source;return Z}var fr=new WeakMap;function du(t){let o=new Map;for(let c of t.seen.values())if(c.def&&!o.has(c.schema))o.set(c.schema,c);let n=new Map;for(let c of fr.get(t)??[]){let u=t.seen.get(c),p=(u?.def??u?.schema)?.propertyNames;if(!p||p===!0||n.has(p))continue;let f=pr(o,p,new Set);if(f!==p)n.set(p,f)}if(!n.size)return;for(let c of t.seen.values())for(let u of[c.schema,c.def]){let p=u&&n.get(u.propertyNames);if(p)u.propertyNames=p}}var Ar=(t,o,n,c)=>{let u=n,p=t._zod.def;u.type="object";let f=p.keyType,_=f._zod.bag?.patterns;if(p.mode==="loose"&&_&&_.size>0){let w=C(p.valueType,o,{...c,path:[...c.path,"patternProperties","*"]});u.patternProperties={};for(let k of _)L(u.patternProperties,k.source,w)}else{if(o.target==="draft-07"||o.target==="draft-2020-12"){u.propertyNames=C(p.keyType,o,{...c,path:[...c.path,"propertyNames"]});let w=fr.get(o);if(!w)w=[],fr.set(o,w),o.deferred.push(()=>du(o));w.push(t)}u.additionalProperties=C(p.valueType,o,{...c,path:[...c.path,"additionalProperties"]})}let b=f._zod.values,z=o.io==="input"&&Le(p.valueType)!==void 0;if(b&&!p.partial&&!z){let w=[...b].filter((k)=>typeof k==="string"||typeof k==="number");if(w.length>0)u.required=w.map(String)}},Nr=(t,o,n,c)=>{let u=t._zod.def,p=C(u.innerType,o,c),f=o.seen.get(t);if(o.target==="openapi-3.0")f.ref=u.innerType,n.nullable=!0;else n.anyOf=[p,{type:"null"}]},Cr=(t,o,n,c)=>{let u=t._zod.def;C(u.innerType,o,c);let p=o.seen.get(t);p.ref=u.innerType},jr=Symbol();function qs(t,o,n,c,u){let p=!1,f=JSON.stringify(t,(m,_)=>{if(typeof _!=="bigint")return _;return p=!0,null});if(!p)return JSON.parse(f);return F(o,n,c,u,"BigInt defaults cannot be represented in JSON Schema"),jr}var Rr=(t,o,n,c)=>{let u=t._zod.def;C(u.innerType,o,c);let p=o.seen.get(t);p.ref=u.innerType;let f=qs(u.defaultValue,t,o,n,c);if(f!==jr)n.default=f},Dr=(t,o,n,c)=>{let u=t._zod.def;C(u.innerType,o,c);let p=o.seen.get(t);if(p.ref=u.innerType,o.io!=="input")return;let f=qs(u.defaultValue,t,o,n,c);if(f!==jr)n._prefault=f},Lr=(t,o,n,c)=>{let u=t._zod.def;C(u.innerType,o,c);let p=o.seen.get(t);p.ref=u.innerType;let f;try{f=u.catchValue(void 0)}catch{F(t,o,n,c,"Dynamic catch values are not supported in JSON Schema");return}n.default=f},Fr=(t,o,n,c)=>{let u=t._zod.def,p=u.in._zod.traits.has("$ZodTransform"),f=o.io==="input"?p?u.out:u.in:u.out;C(f,o,c);let m=o.seen.get(t);m.ref=f},Ur=(t,o,n,c)=>{let u=t._zod.def;C(u.innerType,o,c);let p=o.seen.get(t);p.ref=u.innerType,n.readOnly=!0},Ys=(t,o,n,c)=>{let u=t._zod.def;C(u.innerType,o,c);let p=o.seen.get(t);p.ref=u.innerType},it=(t,o,n,c)=>{let u=t._zod.def;C(u.innerType,o,c);let p=o.seen.get(t);p.ref=u.innerType},Mr=(t,o,n,c)=>{let u=t._zod.innerType;C(u,o,c);let p=o.seen.get(t);p.ref=u},Ls={string:dr,number:mr,boolean:hr,bigint:_r,symbol:Fs,null:gr,undefined:Us,void:xr,never:yr,any:br,unknown:zr,date:vr,enum:$r,literal:wr,nan:Ms,template_literal:Js,file:Bs,success:Vs,custom:kr,function:Ks,transform:Pr,map:Ws,set:Gs,array:Sr,object:Or,union:Ir,intersection:Er,tuple:Tr,record:Ar,nullable:Nr,nonoptional:Cr,default:Rr,prefault:Dr,catch:Lr,pipe:Fr,readonly:Ur,promise:Ys,optional:it,lazy:Mr};function ii(t,o){if("_idmap"in t){let c=t,u=Ce({...o,processors:Ls}),p={};for(let _ of c._idmap.entries()){let[b,z]=_;C(z,u)}let f={},m={registry:c,uri:o?.uri,defs:p};u.external=m;for(let _ of c._idmap.entries()){let[b,z]=_;Re(u,z),L(f,b,De(u,z))}if(Object.keys(p).length>0){let _=u.target==="draft-2020-12"?"$defs":"definitions";f.__shared={[_]:p}}return{schemas:f}}let n=Ce({...o,processors:Ls});return C(t,n),Re(n,t),De(n,t)}var Xs=new WeakSet([Object.prototype,Error.prototype]);function st(t,o,n){Object.defineProperty(t,o,{configurable:!0,enumerable:!1,get(){let c=n(this);return Object.defineProperty(this,o,{value:c,configurable:!0,writable:!0}),c},set(c){Object.defineProperty(this,o,{value:c,configurable:!0,writable:!0})}})}var zu=(t,o)=>{si.init(t,o),t.name="ZodError";let n=Object.getPrototypeOf(t);if(Xs.has(n))return;Xs.add(n),st(n,"format",(c)=>(u)=>kt(c,u)),st(n,"flatten",(c)=>(u)=>wt(c,u)),st(n,"addIssue",(c)=>(u)=>{c.issues.push(u),c.message=JSON.stringify(c.issues,we,2)}),st(n,"addIssues",(c)=>(u)=>{c.issues.push(...u),c.message=JSON.stringify(c.issues,we,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var G=v("ZodError",zu,void 0,{Parent:Error});var Hs=Ke(G),Qs=We(G),Iu=Pe(G),Tu=Oe(G),ec=$o(G),tc=wo(G),rc=ko(G),oc=Zo(G),nc=Po(G),ic=So(G),sc=Oo(G),cc=Io(G);function $u(){if(!B.localeError)W(Vt())}function Fe(){if(!B.memoizer)W({memoizer:Bt()})}var N=v("ZodType",(t,o)=>($u(),A.init(t,o),t.def=o,t.type=o.type,t),{check(...t){let o=this.def;return this.clone(ae(o,{checks:[...o.checks??[],...t.map((n)=>typeof n==="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...t){return this.check(...t)},clone(t,o){return Y(this,t,o)},brand(){return this},register(t,o){return t.add(this,o),this},refine(t,o){return this.check(fa(t,o))},superRefine(t,o){return this.check(da(t,o))},overwrite(t){return this.check(fe(t))},optional(){return Se(this)},exactOptional(){return Qu(this)},nullable(){return s(this)},nullish(){return Se(s(this))},nonoptional(t){return ia(this,t)},array(){return i(this)},or(t){return T([this,t])},and(t){return Rs(this,t)},transform(t){return ac(this,yc(t))},default(t){return ra(this,t)},prefault(t){return na(this,t)},catch(t){return ca(this,t)},pipe(t){return ac(this,t)},readonly(){return la(this)},describe(t){let o=this.clone();return pe.add(o,{description:t}),o},meta(...t){if(t.length===0)return pe.get(this);let o=this.clone();return pe.add(o,t[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(t,...o){return o.length===0?t(this):t(this,...o)},get "~standard"(){return gt(this,"~standard",{...jt(this),jsonSchema:{input:Ne(this,"input"),output:Ne(this,"output")}})},set "~standard"(t){de(this,"~standard",t)},parse:function t(o,n){return Hs(this,o,n,{callee:t})},parseAsync:async function t(o,n){return await Qs(this,o,n,{callee:t})},safeParse(t,o){return Iu(this,t,o)},async safeParseAsync(t,o){return Tu(this,t,o)},get spa(){return this?.safeParseAsync},set spa(t){de(this,"spa",t)},encode:function t(o,n){return ec(this,o,n,{callee:t})},decode:function t(o,n){return tc(this,o,n,{callee:t})},encodeAsync:async function t(o,n){return await rc(this,o,n,{callee:t})},decodeAsync:async function t(o,n){return await oc(this,o,n,{callee:t})},safeEncode(t,o){return nc(this,t,o)},safeDecode(t,o){return ic(this,t,o)},async safeEncodeAsync(t,o){return sc(this,t,o)},async safeDecodeAsync(t,o){return cc(this,t,o)},toJSONSchema(t){return Ds(this,{})(t)},get description(){return pe.get(this)?.description},get _def(){return this._zod.def}}),lc=v("_ZodString",(t,o)=>{He.init(t,o),N.init(t,o),t._zod.processJSONSchema=(c,u,p)=>dr(t,c,u,p);let n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null},{regex(...t){return this.check(Qt(...t))},includes(...t){return this.check(rr(...t))},startsWith(...t){return this.check(or(...t))},endsWith(...t){return this.check(nr(...t))},min(...t){return this.check(ze(...t))},max(...t){return this.check(ot(...t))},length(...t){return this.check(nt(...t))},nonempty(...t){return this.check(ze(1,...t))},lowercase(t){return this.check(er(t))},uppercase(t){return this.check(tr(t))},trim(){return this.check(sr())},normalize(...t){return this.check(ir(...t))},toLowerCase(){return this.check(cr())},toUpperCase(){return this.check(ur())},slugify(){return this.check(ar())}}),Jr=v("ZodString",(t,o)=>{He.init(t,o),lc.init(t,o)},{email(t){return this.check(Kt(dc,t))},url(t){return this.check(Wt(mc,t))},jwt(t){return this.check(ds(Lu,t))},emoji(t){return this.check(ts(ku,t))},guid(t){return this.check(qi(wu,t))},uuid(t){return this.check(Yi(ct,t))},uuidv4(t){return this.check(Xi(ct,t))},uuidv6(t){return this.check(Qi(ct,t))},uuidv7(t){return this.check(es(ct,t))},nanoid(t){return this.check(rs(Zu,t))},cuid(t){return this.check(os(Pu,t))},cuid2(t){return this.check(ns(Su,t))},ulid(t){return this.check(is(Ou,t))},base64(t){return this.check(ls(ju,t))},base64url(t){return this.check(ps(Ru,t))},xid(t){return this.check(ss(Eu,t))},ksuid(t){return this.check(cs(Au,t))},ipv4(t){return this.check(Gt(hc,t))},ipv6(t){return this.check(qt(_c,t))},cidrv4(t){return this.check(us(Nu,t))},cidrv6(t){return this.check(as(Cu,t))},e164(t){return this.check(fs(Du,t))},datetime(t){return this.check(tt(Br,t))},date(t){return this.check(rt(Vr,t))},time(t){return this.check(Xt(pc,t))},duration(t){return this.check(Ht(fc,t))}});function e(t){return Wi(Jr,t)}var D=v("ZodStringFormat",(t,o)=>{j.init(t,o),lc.init(t,o)}),Br=v("ZodISODateTime",(t,o)=>{Kn.init(t,o),D.init(t,o)}),Vr=v("ZodISODate",(t,o)=>{Wn.init(t,o),D.init(t,o)}),pc=v("ZodISOTime",(t,o)=>{Gn.init(t,o),D.init(t,o)}),fc=v("ZodISODuration",(t,o)=>{qn.init(t,o),D.init(t,o)}),dc=v("ZodEmail",(t,o)=>{Cn.init(t,o),D.init(t,o)});function ho(t){return Kt(dc,t)}var wu=v("ZodGUID",(t,o)=>{An.init(t,o),D.init(t,o)});var ct=v("ZodUUID",(t,o)=>{Nn.init(t,o),D.init(t,o)});var mc=v("ZodURL",(t,o)=>{Dn.init(t,o),D.init(t,o)});function ai(t){return Wt(mc,t)}var ku=v("ZodEmoji",(t,o)=>{Ln.init(t,o),D.init(t,o)});var Zu=v("ZodNanoID",(t,o)=>{Fn.init(t,o),D.init(t,o)});var Pu=v("ZodCUID",(t,o)=>{Un.init(t,o),D.init(t,o)});var Su=v("ZodCUID2",(t,o)=>{Mn.init(t,o),D.init(t,o)});var Ou=v("ZodULID",(t,o)=>{Jn.init(t,o),D.init(t,o)});var Eu=v("ZodXID",(t,o)=>{Bn.init(t,o),D.init(t,o)});var Au=v("ZodKSUID",(t,o)=>{Vn.init(t,o),D.init(t,o)});var hc=v("ZodIPv4",(t,o)=>{Yn.init(t,o),D.init(t,o)});function vc(t){return Gt(hc,t)}var _c=v("ZodIPv6",(t,o)=>{Hn.init(t,o),D.init(t,o)});function Af(t){return qt(_c,t)}var Nu=v("ZodCIDRv4",(t,o)=>{Qn.init(t,o),D.init(t,o)});var Cu=v("ZodCIDRv6",(t,o)=>{ei.init(t,o),D.init(t,o)});var ju=v("ZodBase64",(t,o)=>{ri.init(t,o),D.init(t,o)});var Ru=v("ZodBase64URL",(t,o)=>{oi.init(t,o),D.init(t,o)});var Du=v("ZodE164",(t,o)=>{ni.init(t,o),D.init(t,o)});var Lu=v("ZodJWT",(t,o)=>{ci.init(t,o),D.init(t,o)});var at=v("ZodNumber",(t,o)=>{Dt.init(t,o),N.init(t,o),t._zod.processJSONSchema=(c,u,p)=>mr(t,c,u,p);let n=t._zod.bag;t.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??0.5),t.isFinite=!0,t.format=n.format??null},{gt(t,o){return this.check(be(t,o))},gte(t,o){return this.check(ce(t,o))},min(t,o){return this.check(ce(t,o))},lt(t,o){return this.check(ye(t,o))},lte(t,o){return this.check(se(t,o))},max(t,o){return this.check(se(t,o))},int(t){return this.check(h(t))},safe(t){return this.check(h(t))},positive(t){return this.check(be(0,t))},nonnegative(t){return this.check(ce(0,t))},negative(t){return this.check(ye(0,t))},nonpositive(t){return this.check(se(0,t))},multipleOf(t,o){return this.check(Te(t,o))},step(t,o){return this.check(Te(t,o))},finite(){return this}});function a(t){return ms(at,t)}var Fu=v("ZodNumberFormat",(t,o)=>{ui.init(t,o),at.init(t,o)});function h(t){return _s(Fu,t)}var Kr=v("ZodBoolean",(t,o)=>{pi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>hr(t,n,c,u)});function d(t){return gs(Kr,t)}var gc=v("ZodBigInt",(t,o)=>{fi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(c,u,p)=>_r(t,c,u,p);let n=t._zod.bag;t.minValue=n.minimum??null,t.maxValue=n.maximum??null,t.format=n.format??null},{gte(t,o){return this.check(ce(t,o))},min(t,o){return this.check(ce(t,o))},gt(t,o){return this.check(be(t,o))},lt(t,o){return this.check(ye(t,o))},lte(t,o){return this.check(se(t,o))},max(t,o){return this.check(se(t,o))},positive(t){return this.check(be(BigInt(0),t))},negative(t){return this.check(ye(BigInt(0),t))},nonpositive(t){return this.check(se(BigInt(0),t))},nonnegative(t){return this.check(ce(BigInt(0),t))},multipleOf(t,o){return this.check(Te(t,o))}});var Uu=v("ZodNull",(t,o)=>{di.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>gr(t,n,c,u)});function go(t){return bs(Uu,t)}var Ju=v("ZodAny",(t,o)=>{mi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>br(t,n,c,u)});function x(){return zs(Ju)}var Bu=v("ZodUnknown",(t,o)=>{hi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>zr(t,n,c,u)});function U(){return vs(Bu)}var Vu=v("ZodNever",(t,o)=>{_i.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>yr(t,n,c,u)});function _f(t){return $s(Vu,t)}var Ku=v("ZodVoid",(t,o)=>{gi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>xr(t,n,c,u)});function Rt(t){return ws(Ku,t)}var Wr=v("ZodDate",(t,o)=>{xi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(c,u,p)=>vr(t,c,u,p),t.min=(c,u)=>t.check(ce(c,u)),t.max=(c,u)=>t.check(se(c,u));let n=t._zod.bag;t.minDate=n.minimum?new Date(n.minimum):null,t.maxDate=n.maximum?new Date(n.maximum):null});function ee(t){return ks(Wr,t)}var Wu=v("ZodArray",(t,o)=>{Fe(),yi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Sr(t,n,c,u),t.element=o.element},{min(t,o){return this.check(ze(t,o))},nonempty(t){return this.check(ze(1,t))},max(t,o){return this.check(ot(t,o))},length(t,o){return this.check(nt(t,o))},unwrap(){return this.element}});function i(t,o){return Ss(Wu,t,o)}var va=v("ZodObject",(t,o)=>{Fe(),vi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Or(t,n,c,u),Dc(t,"shape",(n)=>n._zod.def.shape,!1)},{keyof(){return g(Object.keys(this._zod.def.shape))},catchall(t){return this.clone({...this._zod.def,catchall:t})},passthrough(){return this.clone({...this._zod.def,catchall:U()})},loose(){return this.clone({...this._zod.def,catchall:U()})},strict(){return this.clone({...this._zod.def,catchall:_f()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(t){return Ic(this,t)},safeExtend(t){return Ec(this,t)},merge(t){return Tc(this,t)},pick(t){return Sc(this,t)},omit(t){return Oc(this,t)},partial(...t){return ao(wa,this,t[0])},exactPartial(...t){return ao(bc,this,t[0],"exactPartial")},required(...t){return Ac(zc,this,t[0])}});function r(t,o){let n={type:"object",shape:t??{},...S(o)};return new va(n)}function oe(t,o){return new va({type:"object",shape:t,catchall:U(),...S(o)})}var xc=v("ZodUnion",(t,o)=>{Lt.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Ir(t,n,c,u),t.options=o.options});function T(t,o){return new xc({type:"union",options:t,...S(o)})}var Gu=v("ZodDiscriminatedUnion",(t,o)=>{xc.init(t,o),$i.init(t,o)});function re(t,o,n){return new Gu({type:"union",options:o,discriminator:t,...S(n)})}var qu=v("ZodIntersection",(t,o)=>{wi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Er(t,n,c,u)});function Rs(t,o){return new qu({type:"intersection",left:t,right:o})}var Yu=v("ZodTuple",(t,o)=>{Fe(),ki.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Tr(t,n,c,u)},{rest(t){return this.clone({...this._zod.def,rest:t})},partial(){let t=this._zod.def;if(t.checks?.length)throw Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...t,items:t.items.map((o)=>new wa({type:"optional",innerType:o}))})}});function Hi(t,o,n){let c=o instanceof A,u=c?n:o;return new Yu({type:"tuple",items:t,rest:c?o:null,...S(u)})}var uc=v("ZodRecord",(t,o)=>{Fe(),Zi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Ar(t,n,c,u),t.keyType=o.keyType,t.valueType=o.valueType});function y(t,o,n){if(!o||!o._zod)return new uc({type:"record",keyType:e(),valueType:t,...S(o)});return new uc({type:"record",keyType:t,valueType:o,...S(n)})}var ut=v("ZodEnum",(t,o)=>{Pi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(c,u,p)=>$r(t,c,u,p),t.enum=o.entries,t.options=Object.values(o.entries);let n=new Set(Object.keys(o.entries));t.extract=(c,u)=>{let p={};for(let f of c)if(n.has(f))p[f]=o.entries[f];else throw Error(`Key ${f} not found in enum`);return new ut({...o,checks:[],...S(u),entries:p})},t.exclude=(c,u)=>{let p={...o.entries};for(let f of c)if(n.has(f))delete p[f];else throw Error(`Key ${f} not found in enum`);return new ut({...o,checks:[],...S(u),entries:p})}});function g(t,o){let n=Array.isArray(t)?Object.fromEntries(t.map((c)=>[c,c])):t;return new ut({type:"enum",entries:n,...S(o)})}function Yt(t,o){return new ut({type:"enum",entries:t,...S(o)})}var Xu=v("ZodLiteral",(t,o)=>{Si.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>wr(t,n,c,u),t.values=new Set(o.values),Object.defineProperty(t,"value",{get(){if(o.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return o.values[0]}})});function l(t,o){return new Xu({type:"literal",values:Array.isArray(t)?t:[t],...S(o)})}var Hu=v("ZodTransform",(t,o)=>{Fe(),Oi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Pr(t,n,c,u),t._zod.parse=(n,c)=>{if(c.direction==="backward")throw new Ze(t.constructor.name);n.addIssue=(p)=>{if(typeof p==="string")n.issues.push(_e(p,n.value,o));else{let f=p;if(f.fatal)f.continue=!1;if(f.code??(f.code="custom"),!("input"in f))f.input=n.value;f.inst??(f.inst=t),n.issues.push(_e(f))}};let u=o.transform(n.value,n);if(u instanceof Promise)return u.then((p)=>(n.value=p,n));return n.value=u,n}});function yc(t){return new Hu({type:"transform",transform:t})}var wa=v("ZodOptional",(t,o)=>{Ft.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>it(t,n,c,u),t.unwrap=()=>t._zod.def.innerType});function Se(t){return new wa({type:"optional",innerType:t})}var bc=v("ZodExactOptional",(t,o)=>{Ii.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>it(t,n,c,u),t.unwrap=()=>t._zod.def.innerType});function Qu(t){return new bc({type:"optional",innerType:t})}var ea=v("ZodNullable",(t,o)=>{Ei.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Nr(t,n,c,u),t.unwrap=()=>t._zod.def.innerType});function s(t){return new ea({type:"nullable",innerType:t})}var ta=v("ZodDefault",(t,o)=>{Ti.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Rr(t,n,c,u),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function ra(t,o){return new ta({type:"default",innerType:t,get defaultValue(){return typeof o==="function"?o():mt(o)}})}var oa=v("ZodPrefault",(t,o)=>{Ai.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Dr(t,n,c,u),t.unwrap=()=>t._zod.def.innerType});function na(t,o){return new oa({type:"prefault",innerType:t,get defaultValue(){return typeof o==="function"?o():mt(o)}})}var zc=v("ZodNonOptional",(t,o)=>{Ni.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Cr(t,n,c,u),t.unwrap=()=>t._zod.def.innerType});function ia(t,o){return new zc({type:"nonoptional",innerType:t,...S(o)})}var sa=v("ZodCatch",(t,o)=>{Ci.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Lr(t,n,c,u),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function ca(t,o){return new sa({type:"catch",innerType:t,catchValue:typeof o==="function"?o:mo(o)})}var $c=v("ZodPipe",(t,o)=>{Ut.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Fr(t,n,c,u),t.in=o.in,t.out=o.out});function ac(t,o){return new $c({type:"pipe",in:t,out:o})}var ua=v("ZodPreprocess",(t,o)=>{$c.init(t,o),ji.init(t,o)}),aa=v("ZodReadonly",(t,o)=>{Ri.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Ur(t,n,c,u),t.unwrap=()=>t._zod.def.innerType});function la(t){return new aa({type:"readonly",innerType:t})}var pa=v("ZodLazy",(t,o)=>{Di.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Mr(t,n,c,u),t.unwrap=()=>t._zod.def.getter()});function St(t){return new pa({type:"lazy",getter:t})}var Gr=v("ZodCustom",(t,o)=>{Li.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>kr(t,n,c,u)});function bt(t,o){return Os(Gr,t??(()=>!0),o)}function fa(t,o={}){return Is(Gr,t,o)}function da(t,o){return Es(t,o)}function Mu(t,o={}){let n=new Gr({type:"custom",check:"custom",fn:(c)=>c instanceof t,abort:!0,...S(o)});return n._zod.bag.Class=t,n._zod.check=(c)=>{if(!(c.value instanceof t))c.issues.push({code:"invalid_type",expected:t.name,input:c.value,inst:n,path:[...n._zod.def.path??[]]})},n}function li(t){let o=St(()=>T([e(t),a(),d(),go(),i(o),y(e(),o)]));return o}function xa(t,o){return new ua({type:"pipe",in:yc(t),out:o})}var Ps={};je(Ps,{bigint:()=>ha,boolean:()=>wc,date:()=>_a,number:()=>wm,string:()=>vm});function vm(t){return Gi(Jr,t)}function wm(t){return hs(at,t)}function wc(t){return xs(Kr,t)}function ha(t){return ys(gc,t)}function _a(t){return Zs(Wr,t)}function X(t){return tt(Br,t)}function jA(t){return rt(Vr,t)}export{Zr,si,gf,ii,Iu,Tu,e,ho,ai,vc,Af,a,h,d,go,x,U,_f,Rt,ee,i,va,r,oe,T,re,Rs,Hi,y,g,Yt,l,wa,Se,s,St,bt,Mu,li,xa,X,jA,vm,wm,wc,Ps};
|
package/bin/chunk-q27qn367.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Xt,qt}from"./chunk-exmwerag.js";import{w,V}from"./chunk-tjavzarz.js";var Ko=w(function(he){var{hasOwn:K}=Xt(),{streamCollector:te}=Xt();he.streamCollector=te;var{buildQueryString:Q,HttpResponse:J}=qt(),H=V("https"),{Readable:oe}=V("stream"),N=V("http2");function I(e){let t=e&&typeof e==="object"&&"reason"in e?e.reason:void 0;if(t){if(t instanceof Error){let s=Error("Request aborted");return s.name="AbortError",s.cause=t,s}let n=Error(String(t));return n.name="AbortError",n}let o=Error("Request aborted");return o.name="AbortError",o}var ne=["ECONNRESET","EPIPE","ETIMEDOUT"],G=(e)=>{let t={};for(let o in e){if(!K(e,o))continue;let n=e[o];t[o]=Array.isArray(n)?n.join(","):n}return t},h={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:(e)=>clearTimeout(e)},F=1000,se=(e,t,o=0)=>{if(!o)return-1;let n=(s)=>{let i=h.setTimeout(()=>{e.destroy(),t(Object.assign(Error(`@smithy/node-http-handler - the request socket did not establish a connection with the server within the configured timeout of ${o} ms.`),{name:"TimeoutError"}))},o-s),c=(a)=>{if(a?.connecting)a.on("connect",()=>{h.clearTimeout(i)});else h.clearTimeout(i)};if(e.socket)c(e.socket);else e.on("socket",c)};if(o<2000)return n(0),0;return h.setTimeout(n.bind(null,F),F)},re=(e,t,o=0,n,s)=>{if(o)return h.setTimeout(()=>{let i=`@smithy/node-http-handler - [${n?"ERROR":"WARN"}] a request has exceeded the configured ${o} ms requestTimeout.`;if(n){let c=Object.assign(Error(i),{name:"TimeoutError",code:"ETIMEDOUT"});e.destroy(c),t(c)}else i+=" Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.",s?.warn?.(i)},o);return-1},ie=3000,ce=(e,{keepAlive:t,keepAliveMsecs:o},n=ie)=>{if(t!==!0)return-1;let s=()=>{if(e.socket)e.socket.setKeepAlive(t,o||0);else e.on("socket",(i)=>{i.setKeepAlive(t,o||0)})};if(n===0)return s(),0;return h.setTimeout(s,n)},j=3000,ae=(e,t,o=0)=>{let n=(s)=>{let i=o-s,c=()=>{e.destroy(),t(Object.assign(Error(`@smithy/node-http-handler - the request socket timed out after ${o} ms of inactivity (configured by client requestHandler).`),{name:"TimeoutError"}))};if(e.socket)e.socket.setTimeout(i,c),e.on("close",()=>e.socket?.removeListener("timeout",c));else e.setTimeout(i,c)};if(0<o&&o<6000)return n(0),0;return h.setTimeout(n.bind(null,o===0?0:j),j)},B=6000;async function X(e,t,o=B,n=!1){let s=t.headers,i=s?s.Expect||s.expect:void 0,c=-1,a=!0;if(!n&&i==="100-continue")a=await Promise.race([new Promise((u)=>{c=Number(h.setTimeout(()=>u(!0),Math.max(B,o)))}),new Promise((u)=>{e.on("continue",()=>{h.clearTimeout(c),u(!0)}),e.on("response",()=>{h.clearTimeout(c),u(!1)}),e.on("error",()=>{h.clearTimeout(c),u(!1)})})]);if(a)ue(e,t.body)}function ue(e,t){if(t instanceof oe){t.pipe(e);return}if(t){let o=Buffer.isBuffer(t);if(o||typeof t==="string"){if(o&&t.byteLength===0)e.end();else e.end(t);return}let s=t;if(typeof s==="object"&&s.buffer&&typeof s.byteOffset==="number"&&typeof s.byteLength==="number"){e.end(Buffer.from(s.buffer,s.byteOffset,s.byteLength));return}e.end(Buffer.from(t));return}e.end()}var fe=0,O=void 0,W=void 0;class L{config;configProvider;socketWarningTimestamp=0;externalAgent=!1;metadata={handlerProtocol:"http/1.1"};static create(e){if(typeof e?.handle==="function")return e;return new L(e)}static checkSocketUsage(e,t,o=console){let{sockets:n,requests:s,maxSockets:i}=e;if(typeof i!=="number"||i===1/0)return t;let c=15000;if(Date.now()-c<t)return t;if(n&&s)for(let a in n){if(!K(n,a))continue;let u=n[a]?.length??0,l=s[a]?.length??0;if(u>=i&&l>=2*i)return o?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${u} and ${l} additional requests are enqueued.
|
|
3
|
-
See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
|
|
4
|
-
or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`),Date.now()}return t}constructor(e){this.configProvider=new Promise((t,o)=>{if(typeof e==="function")e().then((n)=>{t(this.resolveDefaultConfig(n))}).catch(o);else t(this.resolveDefaultConfig(e))})}destroy(){this.config?.httpAgent?.destroy(),this.config?.httpsAgent?.destroy()}async handle(e,{abortSignal:t,requestTimeout:o}={}){if(!this.config)this.config=await this.configProvider;let n=this.config,s=n.logger,i=e.protocol==="https:";if(!i&&!this.config.httpAgent)this.config.httpAgent=await this.config.httpAgentProvider();return new Promise((c,a)=>{let u=void 0,l=-1,m=-1,T=-1,C=-1,E=-1,k=()=>{h.clearTimeout(l),h.clearTimeout(m),h.clearTimeout(T),h.clearTimeout(C),h.clearTimeout(E)},U=async(r)=>{await u,k(),c(r)},p=async(r)=>{await u,k(),a(r)};if(t?.aborted){let r=I(t);p(r);return}let S=e.headers,R=S?(S.Expect??S.expect)==="100-continue":!1,x=i?n.httpsAgent:n.httpAgent;if(R&&!this.externalAgent)x=new(i?H.Agent:O)({keepAlive:!1,maxSockets:1/0});l=h.setTimeout(()=>{this.socketWarningTimestamp=L.checkSocketUsage(x,this.socketWarningTimestamp,s)},n.socketAcquisitionWarningTimeout??(n.requestTimeout??2000)+(n.connectionTimeout??1000));let D=e.query?Q(e.query):"",v=void 0;if(e.username!=null||e.password!=null){let r=e.username??"",f=e.password??"";v=`${r}:${f}`}let P=e.path;if(D)P+=`?${D}`;if(e.fragment)P+=`#${e.fragment}`;let y=e.hostname??"";if(y[0]==="["&&y.endsWith("]"))y=e.hostname.slice(1,-1);else y=e.hostname;let _={headers:e.headers,host:y,method:e.method,path:P,port:e.port,agent:x,auth:v},g=(i?H.request:W)(_,(r)=>{let f=new J({statusCode:r.statusCode||-1,reason:r.statusMessage,headers:G(r.headers),body:r});U({response:f})});if(g.on("error",(r)=>{if(ne.includes(r.code))p(Object.assign(r,{name:"TimeoutError"}));else p(r)}),t){let r=()=>{g.destroy();let f=I(t);p(f)};if(typeof t.addEventListener==="function"){let f=t;f.addEventListener("abort",r,{once:!0}),g.once("close",()=>f.removeEventListener("abort",r))}else t.onabort=r}let b=o??n.requestTimeout;m=se(g,p,n.connectionTimeout),T=re(g,p,b,n.throwOnRequestTimeout,s??console),C=ae(g,p,n.socketTimeout);let d=_.agent;if(typeof d==="object"&&"keepAlive"in d)E=ce(g,{keepAlive:d.keepAlive,keepAliveMsecs:d.keepAliveMsecs});u=X(g,e,b,this.externalAgent).catch((r)=>(k(),a(r)))})}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then((o)=>{if(e===Symbol.for("logger"))return{...o,logger:o.logger??t};return{...o,[e]:t}})}httpHandlerConfigs(){return this.config??{}}resolveDefaultConfig(e){let{requestTimeout:t,connectionTimeout:o,socketTimeout:n,socketAcquisitionWarningTimeout:s,httpAgent:i,httpsAgent:c,throwOnRequestTimeout:a,logger:u}=e||{},l=!0,m=50;return{connectionTimeout:o,requestTimeout:t,socketTimeout:n,socketAcquisitionWarningTimeout:s,throwOnRequestTimeout:a,httpAgentProvider:async()=>{let T=V("http"),{Agent:C,request:E}=T.default??T;if(W=E,O=C,i instanceof O||typeof i?.destroy==="function")return this.externalAgent=!0,i;return new O({keepAlive:!0,maxSockets:50,...i})},httpsAgent:(()=>{if(c instanceof H.Agent||typeof c?.destroy==="function")return this.externalAgent=!0,c;return new H.Agent({keepAlive:!0,maxSockets:50,...c})})(),logger:u}}}var de=new Uint16Array(1);class M{id=de[0]++;total=0;max=0;session;refs=0;constructor(e){e.unref(),this.session=e}retain(){if(this.session.destroyed)throw Error("@smithy/node-http-handler - cannot acquire reference to destroyed session.");this.refs+=1,this.total+=1,this.max=Math.max(this.refs,this.max),this.session.ref()}free(){if(this.session.destroyed)return;if(this.refs-=1,this.refs===0)this.session.unref();if(this.refs<0)throw Error("@smithy/node-http-handler - ClientHttp2Session refcount at zero, cannot decrement.")}deref(){return this.session}close(){if(!this.session.closed)this.session.close()}destroy(){if(this.refs=0,!this.session.destroyed)this.session.destroy()}useCount(){return this.refs}}class Y{sessions=[];maxConcurrency=0;constructor(e){this.sessions=(e??[]).map((t)=>new M(t))}poll(){let e=!1;for(let t of this.sessions){if(t.deref().destroyed){e=!0;continue}if(!this.maxConcurrency||t.useCount()<this.maxConcurrency)return t}if(e){for(let t of this.sessions)if(t.deref().destroyed)this.remove(t)}}offerLast(e){this.sessions.push(e)}remove(e){let t=this.sessions.indexOf(e);if(t>-1)this.sessions.splice(t,1)}[Symbol.iterator](){return this.sessions[Symbol.iterator]()}setMaxConcurrency(e){this.maxConcurrency=e}destroy(e){this.remove(e),e.destroy()}}class Z{config;connectOptions;connectionPools=new Map;constructor(e){if(this.config=e,this.config.maxConcurrency&&this.config.maxConcurrency<=0)throw RangeError("maxConcurrency must be greater than zero.")}lease(e,t){let o=this.getUrlString(e),n=this.getPool(o);if(!this.config.disableConcurrency&&!t.isEventStream){let u=n.poll();if(u)return u.retain(),u}let s=new M(this.connect(o)),i=s.deref();if(this.config.maxConcurrency)i.settings({maxConcurrentStreams:this.config.maxConcurrency},(u)=>{if(u)throw Error("Fail to set maxConcurrentStreams to "+this.config.maxConcurrency+"when creating new session for "+e.destination.toString())});let c=()=>{this.removeFromPoolAndClose(o,s)},a=()=>{this.removeFromPoolAndCheckedDestroy(o,s)};if(i.on("goaway",c),i.on("error",a),i.on("frameError",a),i.on("close",a),t.requestTimeout)i.setTimeout(t.requestTimeout,a);return n.offerLast(s),s.retain(),s}release(e,t){t.free()}createIsolatedSession(e,t){let o=this.getUrlString(e),n=new M(this.connect(o)),s=n.deref();s.settings({maxConcurrentStreams:1});let i=()=>{n.destroy()};if(s.on("error",i),s.on("frameError",i),s.on("close",i),t.requestTimeout)s.setTimeout(t.requestTimeout,i);return n.retain(),n}destroy(){for(let[e,t]of this.connectionPools){for(let o of[...t])o.destroy();this.connectionPools.delete(e)}}setMaxConcurrentStreams(e){if(e&&e<=0)throw RangeError("maxConcurrentStreams must be greater than zero.");this.config.maxConcurrency=e;for(let t of this.connectionPools.values())t.setMaxConcurrency(e)}setDisableConcurrentStreams(e){this.config.disableConcurrency=e}setNodeHttp2ConnectOptions(e){this.connectOptions=e}debug(){let e={};for(let[t,o]of this.connectionPools){let n=[];for(let s of o)n.push({id:s.id,active:s.useCount(),maxConcurrent:s.max,totalRequests:s.total});e[t]={sessions:n}}return e}removeFromPoolAndClose(e,t){this.connectionPools.get(e)?.remove(t),t.close()}removeFromPoolAndCheckedDestroy(e,t){this.connectionPools.get(e)?.remove(t),t.destroy()}getPool(e){if(!this.connectionPools.has(e)){let t=new Y;if(this.config.maxConcurrency)t.setMaxConcurrency(this.config.maxConcurrency);this.connectionPools.set(e,t)}return this.connectionPools.get(e)}getUrlString(e){return e.destination.toString()}connect(e){return this.connectOptions===void 0?N.connect(e):N.connect(e,this.connectOptions)}}var{constants:z}=N;class q{config;configProvider;metadata={handlerProtocol:"h2"};connectionManager=new Z({});static create(e){if(typeof e?.handle==="function")return e;return new q(e)}constructor(e){this.configProvider=new Promise((t,o)=>{if(typeof e==="function")e().then((n)=>{t(n||{})}).catch(o);else t(e||{})})}destroy(){this.connectionManager.destroy()}async handle(e,{abortSignal:t,requestTimeout:o,isEventStream:n}={}){if(!this.config){this.config=await this.configProvider;let{disableConcurrentStreams:u,maxConcurrentStreams:l,nodeHttp2ConnectOptions:m}=this.config;if(this.connectionManager.setDisableConcurrentStreams(u??!1),l)this.connectionManager.setMaxConcurrentStreams(l);if(m)this.connectionManager.setNodeHttp2ConnectOptions(m)}let{requestTimeout:s,disableConcurrentStreams:i}=this.config,c=i||n,a=o??s;return new Promise((u,l)=>{let m=!1,T=void 0,C=async(r)=>{await T,u(r)},E=async(r)=>{await T,l(r)};if(t?.aborted){m=!0;let r=I(t);E(r);return}let{hostname:k,method:U,port:p,protocol:S,query:R}=e,x="";if(e.username!=null||e.password!=null){let r=e.username??"",f=e.password??"";x=`${r}:${f}@`}let D=`${S}//${x}${k}${p?`:${p}`:""}`,v={destination:new URL(D)},P={requestTimeout:this.config?.sessionTimeout,isEventStream:n},y=c?this.connectionManager.createIsolatedSession(v,P):this.connectionManager.lease(v,P),_=y.deref(),A=(r)=>{if(c)y.destroy();m=!0,E(r)},g=R?Q(R):"",b=e.path;if(g)b+=`?${g}`;if(e.fragment)b+=`#${e.fragment}`;let d=_.request({...e.headers,[z.HTTP2_HEADER_PATH]:b,[z.HTTP2_HEADER_METHOD]:U});if(a)d.setTimeout(a,()=>{d.close();let r=Error(`Stream timed out because of no activity for ${a} ms`);r.name="TimeoutError",A(r)});if(t){let r=()=>{d.close();let f=I(t);A(f)};if(typeof t.addEventListener==="function"){let f=t;f.addEventListener("abort",r,{once:!0}),d.once("close",()=>f.removeEventListener("abort",r))}else t.onabort=r}d.on("frameError",(r,f,ee)=>{A(Error(`Frame type id ${r} in stream id ${ee} has failed with code ${f}.`))}),d.on("error",A),d.on("aborted",()=>{A(Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${d.rstCode}.`))}),d.on("response",(r)=>{let f=new J({statusCode:r[":status"]??-1,headers:G(r),body:d});if(m=!0,C({response:f}),c)_.close()}),d.on("close",()=>{if(c)y.destroy();else this.connectionManager.release(v,y);if(!m)A(Error("Unexpected error: http2 request did not get a response"))}),T=X(d,e,a)})}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then((o)=>({...o,[e]:t}))}httpHandlerConfigs(){return this.config??{}}}he.DEFAULT_REQUEST_TIMEOUT=fe;he.NodeHttp2Handler=q;he.NodeHttpHandler=L});
|
|
5
|
-
export{Ko};
|
package/bin/chunk-q36sdt2w.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{I}from"./chunk-vvr8tnse.js";var e=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],ga=I("bell",e);
|
|
2
|
-
export{ga};
|