@shumai-one/shumai 0.3.8 → 0.3.10
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-fvwz4mgw.js → chunk-02tqxzgz.js} +2 -2
- package/bin/chunk-09c03qdg.js +2 -0
- package/bin/chunk-0fpgfrv8.js +2 -0
- package/bin/{chunk-p1rrkrn4.js → chunk-0hbqkcsd.js} +1 -1
- package/bin/{chunk-3bm3be9d.js → chunk-0qcp4v52.js} +1 -1
- package/bin/chunk-0te5kcy3.js +2 -0
- package/bin/chunk-15zbprbe.js +1 -0
- package/bin/{chunk-drjaw6a5.js → chunk-1ev668rp.js} +2 -2
- package/bin/{chunk-ykarhcph.js → chunk-1qd83phd.js} +1 -1
- package/bin/{chunk-r5rf62aa.js → chunk-1whn0v5n.js} +1 -1
- package/bin/{chunk-mp5etccz.js → chunk-28axgckk.js} +1 -1
- package/bin/{chunk-pqtwzb3s.js → chunk-2mxqjx3x.js} +1 -1
- package/bin/{chunk-y5g2ge6f.js → chunk-2sk6e4q0.js} +1 -1
- package/bin/{chunk-nffrjwb7.js → chunk-2sp0gkaw.js} +2 -2
- package/bin/{chunk-ygcmv04c.js → chunk-2t2wjzme.js} +2 -2
- package/bin/chunk-301pewt3.js +1 -0
- package/bin/chunk-33hax7fe.js +66 -0
- package/bin/{chunk-h9f55mjv.js → chunk-34f4hk54.js} +2 -2
- package/bin/{chunk-rq4h4p2g.js → chunk-39s0cxq1.js} +2 -2
- package/bin/{chunk-2ejky9qv.js → chunk-41de755j.js} +1 -1
- package/bin/{chunk-5fj5w0gg.js → chunk-42et2rqa.js} +2 -2
- package/bin/{chunk-k5yxntns.js → chunk-42f9r1sg.js} +2 -2
- package/bin/chunk-484yr1a7.js +1 -0
- package/bin/{chunk-ta02azkp.js → chunk-4shqnfq1.js} +1 -1
- package/bin/{chunk-nc632fxz.js → chunk-60xawsa6.js} +2 -2
- package/bin/chunk-62ag2nfa.js +2 -0
- package/bin/chunk-63emv4q3.js +1 -0
- package/bin/chunk-6529sh41.js +2 -0
- package/bin/{chunk-0zbwpfsk.js → chunk-661mcdxj.js} +2 -2
- package/bin/{chunk-6pcs8810.js → chunk-69sf7kb1.js} +1 -1
- package/bin/{chunk-bc2bf144.js → chunk-6gx6gdnk.js} +2 -2
- package/bin/chunk-6w395tfy.js +2 -0
- package/bin/chunk-7735r8d7.js +1 -0
- package/bin/{chunk-xexxh1zq.js → chunk-7m07t899.js} +1 -1
- package/bin/{chunk-tfnh9sk9.js → chunk-7r6h3fta.js} +2 -2
- package/bin/chunk-7xwmj4ew.js +2 -0
- package/bin/{chunk-yr8a8nzv.js → chunk-8r2agmv2.js} +2 -2
- package/bin/{chunk-antsxrw9.js → chunk-8zmk029n.js} +1 -1
- package/bin/{chunk-7r22vcjy.js → chunk-90jcmarf.js} +2 -2
- package/bin/{chunk-qyegjbzd.js → chunk-94fyesf6.js} +1 -1
- package/bin/chunk-94yxj3yy.js +2 -0
- package/bin/{chunk-c24an5j3.js → chunk-9rhckjgf.js} +2 -2
- package/bin/chunk-9ykcjdsv.js +3 -0
- package/bin/chunk-9yn5r2hh.js +2 -0
- package/bin/chunk-a80aab0f.js +2 -0
- package/bin/{chunk-x8ksced7.js → chunk-ag0pavv1.js} +2 -2
- package/bin/{chunk-ve826t5r.js → chunk-at5ksmqs.js} +1 -1
- package/bin/{chunk-7c85cyn0.js → chunk-bv5mh0e0.js} +3 -3
- package/bin/{chunk-6pmsknnk.js → chunk-bxexm2hd.js} +47 -47
- package/bin/{chunk-99f9r6xm.js → chunk-cc9fftnv.js} +2 -2
- package/bin/{chunk-15jsnygy.js → chunk-ch25gq27.js} +2 -2
- package/bin/chunk-csky7q56.js +2 -0
- package/bin/{chunk-mjxay7yv.js → chunk-d4ktgq49.js} +1 -1
- package/bin/{chunk-eqf7k7ax.js → chunk-day61cfg.js} +2 -2
- package/bin/{chunk-rjkj0dr9.js → chunk-dgvcraag.js} +2 -2
- package/bin/{chunk-80g5kcm0.js → chunk-e26p9vrv.js} +1 -1
- package/bin/{chunk-xpce3j7g.js → chunk-emyax05s.js} +1 -1
- package/bin/{chunk-2t0asg3w.js → chunk-enq1hf8g.js} +2 -2
- package/bin/{chunk-q0xv46wa.js → chunk-f03whbny.js} +2 -2
- package/bin/{chunk-k0ysbh3h.js → chunk-fk9pd7ra.js} +1 -1
- package/bin/{chunk-ssz62jfs.js → chunk-fscyvjzb.js} +2 -2
- package/bin/{chunk-21rp4vzr.js → chunk-g2bkj92r.js} +2 -2
- package/bin/chunk-g5qfxnz1.js +2 -0
- package/bin/{chunk-ph43tgr6.js → chunk-g6aq2cyq.js} +1 -1
- package/bin/chunk-gh6j1nsm.js +1 -0
- package/bin/{chunk-xktnqktj.js → chunk-gra1fhdp.js} +2 -2
- package/bin/{chunk-28n8xqhm.js → chunk-gtenq4kq.js} +1 -1
- package/bin/chunk-h5jre78a.js +2 -0
- package/bin/{chunk-thqahbva.js → chunk-hcaw54dj.js} +2 -2
- package/bin/{chunk-jfjjh86p.js → chunk-hsemzjvr.js} +2 -2
- package/bin/chunk-hte6gd36.js +1 -0
- package/bin/{chunk-djqs6m7w.js → chunk-j6dea33m.js} +3 -3
- package/bin/{chunk-n8pas7tj.js → chunk-j99cr9mz.js} +2 -2
- package/bin/chunk-jn805ccq.js +1 -0
- package/bin/{chunk-en96pr5c.js → chunk-k2w676wz.js} +2 -2
- package/bin/{chunk-m7d52gfe.js → chunk-k33qdrdp.js} +1 -1
- package/bin/chunk-kmhkhcy6.js +68 -0
- package/bin/chunk-kp4kn4b4.js +2 -0
- package/bin/{chunk-e4se9q6n.js → chunk-m3ghgqc2.js} +1 -1
- package/bin/chunk-m84qgdyj.js +2 -0
- package/bin/{chunk-9acfydwy.js → chunk-mk5hqjjd.js} +1 -1
- package/bin/{chunk-tvzfm7g8.js → chunk-mnhg12fm.js} +2 -2
- package/bin/{chunk-rjr8c8be.js → chunk-n3vzdzdw.js} +2 -2
- package/bin/{chunk-8bhsdk1v.js → chunk-nw03w9pa.js} +1 -1
- package/bin/{chunk-6vwqg1ra.js → chunk-p31qe5mc.js} +2 -2
- package/bin/chunk-p48npmbh.js +2 -0
- package/bin/{chunk-8fsrs7mh.js → chunk-p9w4ar11.js} +1 -1
- package/bin/chunk-pbztc6kv.js +1 -0
- package/bin/{chunk-9ntwrvhz.js → chunk-pg55qp08.js} +2 -2
- package/bin/{chunk-0qpz48vc.js → chunk-pv4scagf.js} +1 -1
- package/bin/chunk-q0hrd0yw.js +2 -0
- package/bin/{chunk-m49ar48r.js → chunk-qev7trtm.js} +2 -2
- package/bin/chunk-qk9npww4.js +2 -0
- package/bin/{chunk-4g4g02e0.js → chunk-qphebjbv.js} +1 -1
- package/bin/{chunk-0pm8c9bq.js → chunk-rakz3pe6.js} +2 -2
- package/bin/chunk-rjga1vn2.js +2 -0
- package/bin/chunk-rt8yqz51.js +1 -0
- package/bin/chunk-s542e1y0.js +1 -0
- package/bin/chunk-s6e91ky2.js +2 -0
- package/bin/chunk-s9s9hhet.js +2 -0
- package/bin/{chunk-2dxd0bar.js → chunk-s9yzt7s3.js} +2 -2
- package/bin/chunk-sjsn35mp.js +1 -0
- package/bin/{chunk-2q26gz0p.js → chunk-stggq92k.js} +1 -1
- package/bin/{chunk-5f9fk8x0.js → chunk-t16qt2ka.js} +3 -3
- package/bin/chunk-tc5evq8x.js +2 -0
- package/bin/chunk-tjrdsmdw.js +1 -0
- package/bin/{chunk-3mx22sn7.js → chunk-tkh0s7hg.js} +2 -2
- package/bin/{chunk-agdza65r.js → chunk-tsym31yb.js} +2 -2
- package/bin/{chunk-twm329fs.js → chunk-v1ybpqrz.js} +1 -1
- package/bin/chunk-vbkwteh4.js +1 -0
- package/bin/chunk-vevscfh2.js +2 -0
- package/bin/chunk-vg33qt6z.js +11 -0
- package/bin/{chunk-ep138kb3.js → chunk-vgwjg37a.js} +2 -2
- package/bin/chunk-vwz2pa54.js +2 -0
- package/bin/chunk-we3vdyhb.js +1 -0
- package/bin/chunk-whn6dvak.js +1 -0
- package/bin/{chunk-2em77vjv.js → chunk-wwjqqqr4.js} +1 -1
- package/bin/{chunk-jqzvazsf.js → chunk-xext4yvc.js} +1 -1
- package/bin/chunk-xr1wr22v.css +1 -0
- package/bin/chunk-xvpttxen.js +7 -0
- package/bin/chunk-y45tzhdn.js +2 -0
- package/bin/{chunk-kmt9fj1z.js → chunk-y5ptk39s.js} +2 -2
- package/bin/{chunk-bznz6h19.js → chunk-y7b5gy17.js} +1 -1
- package/bin/{chunk-2xaq1y16.js → chunk-y8ffp5zj.js} +2 -2
- package/bin/chunk-yfgwknpa.js +78 -0
- package/bin/{chunk-0mmw31pj.js → chunk-z7b132c0.js} +2 -2
- package/bin/{chunk-wy1ytxw7.js → chunk-zdmcc6ps.js} +3 -3
- package/bin/shumai-app.html +1 -1
- package/bin/shumai-app.js +703 -407
- package/package.json +7 -7
- package/prisma/migrations/20260816020719_add_agent_permission/migration.sql +2 -0
- package/prisma/migrations/20260817022118_add_quota_rules_and_records/migration.sql +68 -0
- package/prisma/migrations/20260818025858_remove_agent_skill_call_count_from_quota_resource_type/migration.sql +14 -0
- package/prisma/migrations/20260819091331_add_kanban_schema/migration.sql +164 -0
- package/prisma/migrations/20260821102514_add_kanban_notifications/migration.sql +26 -0
- package/prisma/migrations/20260821133500_add_c_collation_to_kanban_sort_index/migration.sql +10 -0
- package/prisma/migrations/20260822020609_add_kanban_task_assets/migration.sql +17 -0
- package/prisma/migrations/20260822071734_remove_kanban_task_cancelled_status/migration.sql +28 -0
- package/prisma/schema.prisma +257 -0
- package/bin/chunk-16s5kfy8.css +0 -1
- package/bin/chunk-33r4w0yv.js +0 -2
- package/bin/chunk-4cmw4qmt.js +0 -1
- package/bin/chunk-4d3wm83a.js +0 -2
- package/bin/chunk-5386brz2.js +0 -2
- package/bin/chunk-61bxmjd9.js +0 -2
- package/bin/chunk-75segwsp.js +0 -2
- package/bin/chunk-7eyg2kgv.js +0 -1
- package/bin/chunk-8jfm1j41.js +0 -1
- package/bin/chunk-8n6segk5.js +0 -1
- package/bin/chunk-bapy3qv8.js +0 -1
- package/bin/chunk-cm74nd4n.js +0 -1
- package/bin/chunk-cynjx7ha.js +0 -65
- package/bin/chunk-cyq3m4qz.js +0 -1
- package/bin/chunk-ddff7vm3.js +0 -2
- package/bin/chunk-dn8k5ef5.js +0 -3
- package/bin/chunk-dqdqs0d9.js +0 -1
- package/bin/chunk-drvwchyn.js +0 -2
- package/bin/chunk-eb551xw7.js +0 -1
- package/bin/chunk-f3rqamey.js +0 -2
- package/bin/chunk-g3p6h6sw.js +0 -68
- package/bin/chunk-jg31cnqc.js +0 -2
- package/bin/chunk-jk87gxbb.js +0 -2
- package/bin/chunk-jyk483r4.js +0 -1
- package/bin/chunk-khjybf4y.js +0 -1
- package/bin/chunk-p6ep6grv.js +0 -1
- package/bin/chunk-qhxznkjk.js +0 -11
- package/bin/chunk-qmja7bsr.js +0 -2
- package/bin/chunk-scmhhrte.js +0 -2
- package/bin/chunk-sjr6mvgm.js +0 -78
- package/bin/chunk-vpfj3q7r.js +0 -1
- package/bin/chunk-vqakgjsf.js +0 -1
- package/bin/chunk-wgjghs54.js +0 -7
- package/bin/chunk-x788nk6z.js +0 -2
- package/bin/chunk-xyzsmjtk.js +0 -2
- package/bin/chunk-y03s8bkz.js +0 -1
- package/bin/chunk-yxtb7xn8.js +0 -2
- package/bin/chunk-zaft3sfe.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Af as C5,Bf as E5,xf as y1,yf as U5,zf as u1}from"./chunk-94yxj3yy.js";import{Ff as k8,Gf as v8,Hf as M8}from"./chunk-33hax7fe.js";import{fg as L8}from"./chunk-mnhg12fm.js";import{Yg as g0,Zg as b0}from"./chunk-y8ffp5zj.js";import{Ah as N1,Bh as c1,Ch as l1,Dh as B1,mh as o0,nh as n,oh as u,ph as D1,qh as G5,rh as P5,sh as W5,th as W1,uh as N5,vh as m1,wh as w5,xh as j5,zh as O5}from"./chunk-y45tzhdn.js";import{$h as q1,Yh as S,_h as D,hj as S8,kj as F8,lj as Z8,mj as I8,sl as k,tl as L0,ul as K1}from"./chunk-yfgwknpa.js";import{Mm as T,Om as x0}from"./chunk-wwjqqqr4.js";var a1=T(S(),1);function c0($,J,X="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:$,timeZoneName:X}).format(J).split(/\s/g).slice(2).join(" ")}var K4={},Z1={};function X1($,J){try{let Y=(K4[$]||=new Intl.DateTimeFormat("en-US",{timeZone:$,timeZoneName:"longOffset"}).format)(J).split("GMT")[1];if(Y in Z1)return Z1[Y];return l0(Y,Y.split(":"))}catch{if($ in Z1)return Z1[$];let X=$?.match(q4);if(X)return l0($,X.slice(1));return NaN}}var q4=/([+-]\d\d):?(\d\d)?/;function l0($,J){let X=+(J[0]||0),Y=+(J[1]||0),Q=+(J[2]||0)/60;return Z1[$]=X*60+Y>0?X*60+Y+Q:X*60-Y-Q}class Y1 extends Date{constructor(...$){super();if($.length>1&&typeof $[$.length-1]==="string")this.timeZone=$.pop();if(this.internal=new Date,isNaN(X1(this.timeZone,this)))this.setTime(NaN);else if(!$.length)this.setTime(Date.now());else if(typeof $[0]==="number"&&($.length===1||$.length===2&&typeof $[1]!=="number"))this.setTime($[0]);else if(typeof $[0]==="string")this.setTime(+new Date($[0]));else if($[0]instanceof Date)this.setTime(+$[0]);else this.setTime(+new Date(...$)),d0(this,$)}static tz($,...J){return J.length?new Y1(...J,$):new Y1(Date.now(),$)}withTimeZone($){return new Y1(+this,$)}getTimezoneOffset(){let $=-X1(this.timeZone,this);return $>0?Math.floor($):Math.ceil($)}setTime($){return Date.prototype.setTime.apply(this,arguments),b1(this),+this}[Symbol.for("constructDateFrom")]($){return new Y1(+new Date($),this.timeZone)}}var n0=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(($)=>{if(!n0.test($))return;let J=$.replace(n0,"$1UTC");if(!Y1.prototype[J])return;if($.startsWith("get"))Y1.prototype[$]=function(){return this.internal[J]()};else Y1.prototype[$]=function(){return Date.prototype[J].apply(this.internal,arguments),H4(this),+this},Y1.prototype[J]=function(){return Date.prototype[J].apply(this,arguments),b1(this),+this}});function b1($){$.internal.setTime(+$),$.internal.setUTCSeconds($.internal.getUTCSeconds()-Math.round(-X1($.timeZone,$)*60))}function H4($){Date.prototype.setFullYear.call($,$.internal.getUTCFullYear(),$.internal.getUTCMonth(),$.internal.getUTCDate()),Date.prototype.setHours.call($,$.internal.getUTCHours(),$.internal.getUTCMinutes(),$.internal.getUTCSeconds(),$.internal.getUTCMilliseconds()),d0($)}function d0($,J){let X=Array.isArray(J)?B4(J):+$.internal,Y=X1($.timeZone,$),Q=Y>0?Math.floor(Y):Math.ceil(Y),q=new Date(+$);q.setUTCHours(q.getUTCHours()-1);let K=-new Date(+$).getTimezoneOffset(),G=-new Date(+q).getTimezoneOffset(),_=K-G,H=K;if(_&&K!==Q){let y=Date.prototype.getHours.apply($),f=Array.isArray(J)?J[3]||0:$.internal.getUTCHours();if(y!==f){let l=new Date(+$),i=K-Q;if(i)l.setUTCMinutes(l.getUTCMinutes()+i);let a=X1($.timeZone,l);if((a>0?Math.floor(a):Math.ceil(a))===Q)H=G}}let x=H-Q;if(x)Date.prototype.setUTCMinutes.call($,Date.prototype.getUTCMinutes.call($)+x);let B=new Date(+$);B.setUTCSeconds(0);let N=K>0?B.getSeconds():(B.getSeconds()-60)%60,W=Math.round(-(X1($.timeZone,$)*60))%60;if(W||N)Date.prototype.setUTCSeconds.call($,Date.prototype.getUTCSeconds.call($)+W+N);let C=X1($.timeZone,$),A=C>0?Math.floor(C):Math.ceil(C),v=-new Date(+$).getTimezoneOffset()-A,F=A!==Q,O=v-x,w=A-Q,E=X-A*60*1000,z=w>0&&r0($)-X===w*60*1000&&r0($,E)!==X;if(F&&O&&!z){Date.prototype.setUTCMinutes.call($,Date.prototype.getUTCMinutes.call($)+O);let y=X1($.timeZone,$),f=y>0?Math.floor(y):Math.ceil(y),l=A-f;if(l&&O<0)Date.prototype.setUTCMinutes.call($,Date.prototype.getUTCMinutes.call($)+l)}b1($);let M=(J?X:X+W*1000)-+$.internal;if(M&&Math.abs(M)<1800000)Date.prototype.setTime.call($,+$+M),b1($)}function B4($){return Date.UTC($[0],$.length>1?$[1]:0,$.length>2?$[2]:1,...$.slice(3))}function r0($,J){let X=new Date(J??+$);return X.setUTCSeconds(X.getUTCSeconds()-Math.round(-X1($.timeZone,X)*60)),+X}class p extends Y1{static tz($,...J){return J.length?new p(...J,$):new p(Date.now(),$)}toISOString(){let[$,J,X]=this.tzComponents(),Y=`${$}${J}:${X}`;return this.internal.toISOString().slice(0,-1)+Y}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){let[$,J,X,Y]=this.internal.toUTCString().split(" ");return`${$?.slice(0,-1)} ${X} ${J} ${Y}`}toTimeString(){let $=this.internal.toUTCString().split(" ")[4],[J,X,Y]=this.tzComponents();return`${$} GMT${J}${X}${Y} (${c0(this.timeZone,this)})`}toLocaleString($,J){return Date.prototype.toLocaleString.call(this,$,{...J,timeZone:J?.timeZone||this.timeZone})}toLocaleDateString($,J){return Date.prototype.toLocaleDateString.call(this,$,{...J,timeZone:J?.timeZone||this.timeZone})}toLocaleTimeString($,J){return Date.prototype.toLocaleTimeString.call(this,$,{...J,timeZone:J?.timeZone||this.timeZone})}tzComponents(){let $=this.getTimezoneOffset(),J=$>0?"-":"+",X=String(Math.floor(Math.abs($)/60)).padStart(2,"0"),Y=String(Math.abs($)%60).padStart(2,"0");return[J,X,Y]}withTimeZone($){return new p(+this,$)}[Symbol.for("constructDateFrom")]($){return new p(+new Date($),this.timeZone)}}function i0($,J,X){return n(X?.in||$,+u($)+J)}function s0($,J,X){return i0($,J*o0,X)}function I1($,J,X){return D1($,J*7,X)}function a0($,J,X){return y1($,J*12,X)}function t0($,J){let X,Y=J?.in;return $.forEach((Q)=>{if(!Y&&typeof Q==="object")Y=n.bind(null,Q);let q=u(Q,Y);if(!X||X<q||isNaN(+q))X=q}),n(Y,X||NaN)}function e0($,J){let X,Y=J?.in;return $.forEach((Q)=>{if(!Y&&typeof Q==="object")Y=n.bind(null,Q);let q=u(Q,Y);if(!X||X>q||isNaN(+q))X=q}),n(Y,X||NaN)}function f1($,J,X){let[Y,Q]=W1(X?.in,$,J),q=Y.getFullYear()-Q.getFullYear(),K=Y.getMonth()-Q.getMonth();return q*12+K}function $5($,J){let{start:X,end:Y}=u1(J?.in,$),Q=+X>+Y,q=Q?+X:+Y,K=Q?Y:X;K.setHours(0,0,0,0),K.setDate(1);let G=J?.step??1;if(!G)return[];if(G<0)G=-G,Q=!Q;let _=[];while(+K<=q)_.push(n(X,K)),K.setMonth(K.getMonth()+G);return Q?_.reverse():_}function J5($,J){let X=u($,J?.in);return X.setDate(1),X.setHours(0,0,0,0),X}function X5($,J){let X=u($,J?.in),Y=X.getFullYear();return X.setFullYear(Y+1,0,0),X.setHours(23,59,59,999),X}function Y5($,J){let{start:X,end:Y}=u1(J?.in,$),Q=+X>+Y,q=Q?+X:+Y,K=Q?Y:X;K.setHours(0,0,0,0),K.setMonth(0,1);let G=J?.step??1;if(!G)return[];if(G<0)G=-G,Q=!Q;let _=[];while(+K<=q)_.push(n(X,K)),K.setFullYear(K.getFullYear()+G);return Q?_.reverse():_}function h1($,J){let X=G5(),Y=J?.weekStartsOn??J?.locale?.options?.weekStartsOn??X.weekStartsOn??X.locale?.options?.weekStartsOn??0,Q=u($,J?.in),q=Q.getDay(),K=(q<Y?-7:0)+6-(q-Y);return Q.setDate(Q.getDate()+K),Q.setHours(23,59,59,999),Q}function Q5($,J){return h1($,{...J,weekStartsOn:1})}function _5($,J){let X=u($,J?.in),Y=X.getFullYear(),Q=X.getMonth(),q=n(X,0);return q.setFullYear(Y,Q+1,0),q.setHours(0,0,0,0),q.getDate()}function K5($,J){return+u($)>+u(J)}function q5($,J){return+u($)<+u(J)}function H5($,J,X){let[Y,Q]=W1(X?.in,$,J);return Y.getFullYear()===Q.getFullYear()&&Y.getMonth()===Q.getMonth()}function B5($,J,X){let[Y,Q]=W1(X?.in,$,J);return Y.getFullYear()===Q.getFullYear()}function x5($,J,X){let Y=u($,X?.in),Q=Y.getFullYear(),q=Y.getDate(),K=n(X?.in||$,0);K.setFullYear(Q,J,15),K.setHours(0,0,0,0);let G=_5(K);return Y.setMonth(J,Math.min(q,G)),Y}function V5($,J,X){let Y=u($,X?.in);if(isNaN(+Y))return n(X?.in||$,NaN);return Y.setFullYear(J),Y}function z5($,J){let X=J.startOfMonth($),Y=X.getDay()>0?X.getDay():7,Q=J.addDays($,-Y+1),q=J.addDays(Q,34);return J.getMonth($)===J.getMonth(q)?5:4}function p1($,J){let X=J.startOfMonth($),Y=X.getDay();if(Y===1)return X;else if(Y===0)return J.addDays(X,-6);else return J.addDays(X,-1*(Y-1))}function A5($,J){let X=p1($,J),Y=z5($,J);return J.addDays(X,Y*7-1)}var T1={...N1,labels:{labelDayButton:($,J,X,Y)=>{let Q;if(Y&&typeof Y.format==="function")Q=Y.format.bind(Y);else Q=(K,G)=>B1(K,G,{locale:N1,...X});let q=Q($,"PPPP");if(J.today)q=`Today, ${q}`;if(J.selected)q=`${q}, selected`;return q},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:($)=>`Week ${$}`,labelYearDropdown:"Choose the Year",labelGrid:($,J,X)=>{let Y;if(X&&typeof X.format==="function")Y=X.format.bind(X);else Y=(Q,q)=>B1(Q,q,{locale:N1,...J});return Y($,"LLLL yyyy")},labelGridcell:($,J,X,Y)=>{let Q;if(Y&&typeof Y.format==="function")Q=Y.format.bind(Y);else Q=(K,G)=>B1(K,G,{locale:N1,...X});let q=Q($,"PPPP");if(J?.today)q=`Today, ${q}`;return q},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:($,J,X)=>{let Y;if(X&&typeof X.format==="function")Y=X.format.bind(X);else Y=(Q,q)=>B1(Q,q,{locale:N1,...J});return Y($,"cccc")}}};class m{constructor($,J){this.today=()=>{if(this.overrides?.today)return this.overrides.today();if(this.options.timeZone)return p.tz(this.options.timeZone);return new(this.options.Date??Date)},this.newDate=(X,Y,Q)=>{if(this.overrides?.newDate)return this.overrides.newDate(X,Y,Q);if(this.options.timeZone)return new p(X,Y,Q,this.options.timeZone);return new Date(X,Y,Q)},this.addDays=(X,Y)=>{return this.overrides?.addDays?this.overrides.addDays(X,Y):D1(X,Y)},this.addMonths=(X,Y)=>{return this.overrides?.addMonths?this.overrides.addMonths(X,Y):y1(X,Y)},this.addWeeks=(X,Y)=>{return this.overrides?.addWeeks?this.overrides.addWeeks(X,Y):I1(X,Y)},this.addYears=(X,Y)=>{return this.overrides?.addYears?this.overrides.addYears(X,Y):a0(X,Y)},this.differenceInCalendarDays=(X,Y)=>{return this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(X,Y):m1(X,Y)},this.differenceInCalendarMonths=(X,Y)=>{return this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(X,Y):f1(X,Y)},this.eachMonthOfInterval=(X)=>{return this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(X):$5(X)},this.eachYearOfInterval=(X)=>{let Y=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(X):Y5(X),Q=new Set(Y.map((K)=>this.getYear(K)));if(Q.size===Y.length)return Y;let q=[];return Q.forEach((K)=>{q.push(new Date(K,0,1))}),q},this.endOfBroadcastWeek=(X)=>{return this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(X):A5(X,this)},this.endOfISOWeek=(X)=>{return this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(X):Q5(X)},this.endOfMonth=(X)=>{return this.overrides?.endOfMonth?this.overrides.endOfMonth(X):U5(X)},this.endOfWeek=(X,Y)=>{return this.overrides?.endOfWeek?this.overrides.endOfWeek(X,Y):h1(X,this.options)},this.endOfYear=(X)=>{return this.overrides?.endOfYear?this.overrides.endOfYear(X):X5(X)},this.format=(X,Y,Q)=>{let q=this.overrides?.format?this.overrides.format(X,Y,this.options):B1(X,Y,this.options);if(this.options.numerals&&this.options.numerals!=="latn")return this.replaceDigits(q);return q},this.getISOWeek=(X)=>{return this.overrides?.getISOWeek?this.overrides.getISOWeek(X):c1(X)},this.getMonth=(X,Y)=>{return this.overrides?.getMonth?this.overrides.getMonth(X,this.options):C5(X,this.options)},this.getYear=(X,Y)=>{return this.overrides?.getYear?this.overrides.getYear(X,this.options):E5(X,this.options)},this.getWeek=(X,Y)=>{return this.overrides?.getWeek?this.overrides.getWeek(X,this.options):l1(X,this.options)},this.isAfter=(X,Y)=>{return this.overrides?.isAfter?this.overrides.isAfter(X,Y):K5(X,Y)},this.isBefore=(X,Y)=>{return this.overrides?.isBefore?this.overrides.isBefore(X,Y):q5(X,Y)},this.isDate=(X)=>{return this.overrides?.isDate?this.overrides.isDate(X):j5(X)},this.isSameDay=(X,Y)=>{return this.overrides?.isSameDay?this.overrides.isSameDay(X,Y):w5(X,Y)},this.isSameMonth=(X,Y)=>{return this.overrides?.isSameMonth?this.overrides.isSameMonth(X,Y):H5(X,Y)},this.isSameYear=(X,Y)=>{return this.overrides?.isSameYear?this.overrides.isSameYear(X,Y):B5(X,Y)},this.max=(X)=>{return this.overrides?.max?this.overrides.max(X):t0(X)},this.min=(X)=>{return this.overrides?.min?this.overrides.min(X):e0(X)},this.setMonth=(X,Y)=>{return this.overrides?.setMonth?this.overrides.setMonth(X,Y):x5(X,Y)},this.setYear=(X,Y)=>{return this.overrides?.setYear?this.overrides.setYear(X,Y):V5(X,Y)},this.startOfBroadcastWeek=(X,Y)=>{return this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(X,this):p1(X,this)},this.startOfDay=(X)=>{return this.overrides?.startOfDay?this.overrides.startOfDay(X):N5(X)},this.startOfISOWeek=(X)=>{return this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(X):W5(X)},this.startOfMonth=(X)=>{return this.overrides?.startOfMonth?this.overrides.startOfMonth(X):J5(X)},this.startOfWeek=(X,Y)=>{return this.overrides?.startOfWeek?this.overrides.startOfWeek(X,this.options):P5(X,this.options)},this.startOfYear=(X)=>{return this.overrides?.startOfYear?this.overrides.startOfYear(X):O5(X)},this.options={locale:T1,...$},this.overrides=J}getDigitMap(){let{numerals:$="latn"}=this.options,J=new Intl.NumberFormat("en-US",{numberingSystem:$}),X={};for(let Y=0;Y<10;Y++)X[Y.toString()]=J.format(Y);return X}replaceDigits($){let J=this.getDigitMap();return $.replace(/\d/g,(X)=>J[X]||X)}formatNumber($){return this.replaceDigits($.toString())}getMonthYearOrder(){let $=this.options.locale?.code;if(!$)return"month-first";return m.yearFirstLocales.has($)?"year-first":"month-first"}formatMonthYear($){let{locale:J,timeZone:X,numerals:Y}=this.options,Q=J?.code;if(Q&&m.yearFirstLocales.has(Q))try{return new Intl.DateTimeFormat(Q,{month:"long",year:"numeric",timeZone:X,numberingSystem:Y}).format($)}catch{}let q=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format($,q)}}m.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);var c=new m;class S1{constructor($,J,X=c){this.date=$,this.displayMonth=J,this.outside=Boolean(J&&!X.isSameMonth($,J)),this.dateLib=X,this.isoDate=X.format($,"yyyy-MM-dd"),this.displayMonthId=X.format(J,"yyyy-MM"),this.dateMonthId=X.format($,"yyyy-MM")}isEqualTo($){return this.dateLib.isSameDay($.date,this.date)&&this.dateLib.isSameMonth($.displayMonth,this.displayMonth)}}class K0{constructor($,J){this.date=$,this.weeks=J}}class q0{constructor($,J){this.days=J,this.weekNumber=$}}var V0={};x0(V0,{YearsDropdown:()=>b4,Weeks:()=>g4,Weekdays:()=>v4,Weekday:()=>k4,WeekNumberHeader:()=>L4,WeekNumber:()=>M4,Week:()=>S4,Select:()=>T4,Root:()=>I4,PreviousMonthButton:()=>Z4,Option:()=>F4,NextMonthButton:()=>R4,Nav:()=>E4,MonthsDropdown:()=>C4,Months:()=>O4,MonthGrid:()=>U4,MonthCaption:()=>j4,Month:()=>w4,Footer:()=>N4,DropdownNav:()=>W4,Dropdown:()=>P4,DayButton:()=>A4,Day:()=>z4,Chevron:()=>V4,CaptionLabel:()=>x4});var R5=T(S(),1);function x4($){return R5.default.createElement("span",{...$})}var w1=T(S(),1);function V4($){let{size:J=24,orientation:X="left",className:Y,style:Q}=$;return w1.default.createElement("svg",{className:Y,style:Q,width:J,height:J,viewBox:"0 0 24 24"},X==="up"&&w1.default.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),X==="down"&&w1.default.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),X==="left"&&w1.default.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),X==="right"&&w1.default.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}var F5=T(S(),1);function z4($){let{day:J,modifiers:X,...Y}=$;return F5.default.createElement("td",{...Y})}var n1=T(S(),1);function A4($){let{day:J,modifiers:X,...Y}=$,Q=n1.default.useRef(null);return n1.default.useEffect(()=>{if(X.focused)Q.current?.focus()},[X.focused]),n1.default.createElement("button",{ref:Q,...Y})}var j1=T(S(),1);var V;(function($){$.Root="root",$.Chevron="chevron",$.Day="day",$.DayButton="day_button",$.CaptionLabel="caption_label",$.Dropdowns="dropdowns",$.Dropdown="dropdown",$.DropdownRoot="dropdown_root",$.Footer="footer",$.MonthGrid="month_grid",$.MonthCaption="month_caption",$.MonthsDropdown="months_dropdown",$.Month="month",$.Months="months",$.Nav="nav",$.NextMonthButton="button_next",$.PreviousMonthButton="button_previous",$.Week="week",$.Weeks="weeks",$.Weekday="weekday",$.Weekdays="weekdays",$.WeekNumber="week_number",$.WeekNumberHeader="week_number_header",$.YearsDropdown="years_dropdown"})(V||(V={}));var b;(function($){$.disabled="disabled",$.hidden="hidden",$.outside="outside",$.focused="focused",$.today="today"})(b||(b={}));var o;(function($){$.range_end="range_end",$.range_middle="range_middle",$.range_start="range_start",$.selected="selected"})(o||(o={}));var r;(function($){$.weeks_before_enter="weeks_before_enter",$.weeks_before_exit="weeks_before_exit",$.weeks_after_enter="weeks_after_enter",$.weeks_after_exit="weeks_after_exit",$.caption_after_enter="caption_after_enter",$.caption_after_exit="caption_after_exit",$.caption_before_enter="caption_before_enter",$.caption_before_exit="caption_before_exit"})(r||(r={}));var r1=T(S(),1),H0=r1.createContext(void 0);function V1(){let $=r1.useContext(H0);if($===void 0)throw Error("useDayPicker() must be used within a custom component.");return $}function P4($){let{options:J,className:X,...Y}=$,{classNames:Q,components:q,styles:K}=V1(),G=[Q[V.Dropdown],X].join(" "),_=J?.find(({value:H})=>H===Y.value);return j1.default.createElement("span",{"data-disabled":Y.disabled,className:Q[V.DropdownRoot],style:K?.[V.DropdownRoot]},j1.default.createElement(q.Select,{className:G,...Y},J?.map(({value:H,label:x,disabled:B})=>j1.default.createElement(q.Option,{key:H,value:H,disabled:B},x))),j1.default.createElement("span",{className:Q[V.CaptionLabel],style:K?.[V.CaptionLabel],"aria-hidden":!0},_?.label,j1.default.createElement(q.Chevron,{orientation:"down",size:18,className:Q[V.Chevron],style:K?.[V.Chevron]})))}var Z5=T(S(),1);function W4($){return Z5.default.createElement("div",{...$})}var I5=T(S(),1);function N4($){return I5.default.createElement("div",{...$})}var T5=T(S(),1);function w4($){let{calendarMonth:J,displayIndex:X,...Y}=$;return T5.default.createElement("div",{...Y},$.children)}var S5=T(S(),1);function j4($){let{calendarMonth:J,displayIndex:X,...Y}=$;return S5.default.createElement("div",{...Y})}var k5=T(S(),1);function U4($){return k5.default.createElement("table",{...$})}var v5=T(S(),1);function O4($){return v5.default.createElement("div",{...$})}var M5=T(S(),1);function C4($){let{components:J}=V1();return M5.default.createElement(J.Dropdown,{...$})}var x1=T(S(),1);function E4($){let{onPreviousClick:J,onNextClick:X,previousMonth:Y,nextMonth:Q,...q}=$,{components:K,classNames:G,styles:_,labels:{labelPrevious:H,labelNext:x}}=V1(),B=x1.useCallback((W)=>{if(Q)X?.(W)},[Q,X]),N=x1.useCallback((W)=>{if(Y)J?.(W)},[Y,J]);return x1.default.createElement("nav",{...q},x1.default.createElement(K.PreviousMonthButton,{type:"button",className:G[V.PreviousMonthButton],style:_?.[V.PreviousMonthButton],tabIndex:Y?void 0:-1,"aria-disabled":Y?void 0:!0,"aria-label":H(Y),onClick:N},x1.default.createElement(K.Chevron,{disabled:Y?void 0:!0,className:G[V.Chevron],style:_?.[V.Chevron],orientation:"left"})),x1.default.createElement(K.NextMonthButton,{type:"button",className:G[V.NextMonthButton],style:_?.[V.NextMonthButton],tabIndex:Q?void 0:-1,"aria-disabled":Q?void 0:!0,"aria-label":x(Q),onClick:B},x1.default.createElement(K.Chevron,{disabled:Q?void 0:!0,orientation:"right",className:G[V.Chevron],style:_?.[V.Chevron]})))}var L5=T(S(),1);function R4($){return L5.default.createElement("button",{...$})}var g5=T(S(),1);function F4($){return g5.default.createElement("option",{...$})}var b5=T(S(),1);function Z4($){return b5.default.createElement("button",{...$})}var D5=T(S(),1);function I4($){let{rootRef:J,...X}=$;return D5.default.createElement("div",{...X,ref:J})}var y5=T(S(),1);function T4($){return y5.default.createElement("select",{...$})}var f5=T(S(),1);function S4($){let{week:J,...X}=$;return f5.default.createElement("tr",{...X})}var u5=T(S(),1);function k4($){return u5.default.createElement("th",{...$})}var B0=T(S(),1);function v4($){return B0.default.createElement("thead",{"aria-hidden":!0},B0.default.createElement("tr",{...$}))}var h5=T(S(),1);function M4($){let{week:J,...X}=$;return h5.default.createElement("th",{...X})}var p5=T(S(),1);function L4($){return p5.default.createElement("th",{...$})}var m5=T(S(),1);function g4($){return m5.default.createElement("tbody",{...$})}var c5=T(S(),1);function b4($){let{components:J}=V1();return c5.default.createElement(J.Dropdown,{...$})}var j=T(S(),1);function s($,J,X=!1,Y=c){let{from:Q,to:q}=$,{differenceInCalendarDays:K,isSameDay:G}=Y;if(Q&&q){if(K(q,Q)<0)[Q,q]=[q,Q];return K(J,Q)>=(X?1:0)&&K(q,J)>=(X?1:0)}if(!X&&q)return G(q,J);if(!X&&Q)return G(Q,J);return!1}function U1($){return Boolean($&&typeof $==="object"&&"before"in $&&"after"in $)}function z1($){return Boolean($&&typeof $==="object"&&"from"in $)}function O1($){return Boolean($&&typeof $==="object"&&"after"in $)}function C1($){return Boolean($&&typeof $==="object"&&"before"in $)}function d1($){return Boolean($&&typeof $==="object"&&"dayOfWeek"in $)}function i1($,J){return Array.isArray($)&&$.every(J.isDate)}function e($,J,X=c){let Y=!Array.isArray(J)?[J]:J,{isSameDay:Q,differenceInCalendarDays:q,isAfter:K}=X;return Y.some((G)=>{if(typeof G==="boolean")return G;if(X.isDate(G))return Q($,G);if(i1(G,X))return G.some((_)=>Q($,_));if(z1(G))return s(G,$,!1,X);if(d1(G)){if(!Array.isArray(G.dayOfWeek))return G.dayOfWeek===$.getDay();return G.dayOfWeek.includes($.getDay())}if(U1(G)){let _=q(G.before,$),H=q(G.after,$),x=_>0,B=H<0;if(K(G.before,G.after))return B&&x;else return x||B}if(O1(G))return q($,G.after)>0;if(C1(G))return q(G.before,$)>0;if(typeof G==="function")return G($);return!1})}function l5($,J,X,Y,Q){let{disabled:q,hidden:K,modifiers:G,showOutsideDays:_,broadcastCalendar:H,today:x=Q.today()}=J,{isSameDay:B,isSameMonth:N,startOfMonth:W,isBefore:C,endOfMonth:A,isAfter:P}=Q,v=X&&W(X),F=Y&&A(Y),O={[b.focused]:[],[b.outside]:[],[b.disabled]:[],[b.hidden]:[],[b.today]:[]},w={};for(let E of $){let{date:z,displayMonth:Z}=E,M=Boolean(Z&&!N(z,Z)),y=Boolean(v&&C(z,v)),f=Boolean(F&&P(z,F)),l=Boolean(q&&e(z,q,Q)),i=Boolean(K&&e(z,K,Q))||y||f||!H&&!_&&M||H&&_===!1&&M,a=B(z,x);if(M)O.outside.push(E);if(l)O.disabled.push(E);if(i)O.hidden.push(E);if(a)O.today.push(E);if(G)Object.keys(G).forEach((t)=>{let P1=G?.[t];if(!(P1?e(z,P1,Q):!1))return;if(w[t])w[t].push(E);else w[t]=[E]})}return(E)=>{let z={[b.focused]:!1,[b.disabled]:!1,[b.hidden]:!1,[b.outside]:!1,[b.today]:!1},Z={};for(let M in O){let y=O[M];z[M]=y.some((f)=>f===E)}for(let M in w)Z[M]=w[M].some((y)=>y===E);return{...z,...Z}}}function n5($,J,X={}){return Object.entries($).filter(([,Q])=>Q===!0).reduce((Q,[q])=>{if(X[q])Q.push(X[q]);else if(J[b[q]])Q.push(J[b[q]]);else if(J[o[q]])Q.push(J[o[q]]);return Q},[J[V.Day]])}function r5($){return{...V0,...$}}function d5($){let J={"data-mode":$.mode??void 0,"data-required":"required"in $?$.required:void 0,"data-multiple-months":$.numberOfMonths&&$.numberOfMonths>1||void 0,"data-week-numbers":$.showWeekNumber||void 0,"data-broadcast-calendar":$.broadcastCalendar||void 0,"data-nav-layout":$.navLayout||void 0};return Object.entries($).forEach(([X,Y])=>{if(X.startsWith("data-"))J[X]=Y}),J}function k1(){let $={};for(let J in V)$[V[J]]=`rdp-${V[J]}`;for(let J in b)$[b[J]]=`rdp-${b[J]}`;for(let J in o)$[o[J]]=`rdp-${o[J]}`;for(let J in r)$[r[J]]=`rdp-${r[J]}`;return $}var z0={};x0(z0,{formatYearDropdown:()=>m4,formatWeekdayName:()=>u4,formatWeekNumberHeader:()=>p4,formatWeekNumber:()=>h4,formatMonthDropdown:()=>f4,formatDay:()=>y4,formatCaption:()=>D4});function D4($,J,X){return(X??new m(J)).formatMonthYear($)}function y4($,J,X){return(X??new m(J)).format($,"d")}function f4($,J=c){return J.format($,"LLLL")}function u4($,J,X){return(X??new m(J)).format($,"cccccc")}function h4($,J=c){if($<10)return J.formatNumber(`0${$.toLocaleString()}`);return J.formatNumber(`${$.toLocaleString()}`)}function p4(){return""}function m4($,J=c){return J.format($,"yyyy")}function i5($){return{...z0,...$}}var F0={};x0(F0,{labelYearDropdown:()=>R0,labelWeekday:()=>O0,labelWeekNumberHeader:()=>E0,labelWeekNumber:()=>C0,labelPrevious:()=>U0,labelNext:()=>j0,labelNav:()=>w0,labelMonthDropdown:()=>N0,labelGridcell:()=>W0,labelGrid:()=>P0,labelDayButton:()=>A0});function A0($,J,X,Y){let Q=(Y??new m(X)).format($,"PPPP");if(J.today)Q=`Today, ${Q}`;if(J.selected)Q=`${Q}, selected`;return Q}function P0($,J,X){return(X??new m(J)).formatMonthYear($)}function W0($,J,X,Y){let Q=(Y??new m(X)).format($,"PPPP");if(J?.today)Q=`Today, ${Q}`;return Q}function N0($){return"Choose the Month"}function w0(){return""}function j0($,J){return"Go to the Next Month"}function U0($){return"Go to the Previous Month"}function O0($,J,X){return(X??new m(J)).format($,"cccc")}function C0($,J){return`Week ${$}`}function E0($){return"Week Number"}function R0($){return"Choose the Year"}var G1=($,J,X)=>{if(J)return J;if(X)return typeof X==="function"?X:(...Y)=>X;return $};function o5($,J){let X=J.locale?.labels??{};return{...F0,...$??{},labelDayButton:G1(A0,$?.labelDayButton,X.labelDayButton),labelMonthDropdown:G1(N0,$?.labelMonthDropdown,X.labelMonthDropdown),labelNext:G1(j0,$?.labelNext,X.labelNext),labelPrevious:G1(U0,$?.labelPrevious,X.labelPrevious),labelWeekNumber:G1(C0,$?.labelWeekNumber,X.labelWeekNumber),labelYearDropdown:G1(R0,$?.labelYearDropdown,X.labelYearDropdown),labelGrid:G1(P0,$?.labelGrid,X.labelGrid),labelGridcell:G1(W0,$?.labelGridcell,X.labelGridcell),labelNav:G1(w0,$?.labelNav,X.labelNav),labelWeekNumberHeader:G1(E0,$?.labelWeekNumberHeader,X.labelWeekNumberHeader),labelWeekday:G1(O0,$?.labelWeekday,X.labelWeekday)}}function s5($,J,X,Y,Q){let{startOfMonth:q,startOfYear:K,endOfYear:G,eachMonthOfInterval:_,getMonth:H}=Q;return _({start:K($),end:G($)}).map((N)=>{let W=Y.formatMonthDropdown(N,Q),C=H(N),A=J&&N<q(J)||X&&N>q(X)||!1;return{value:C,label:W,disabled:A}})}function a5($,J={},X={}){let Y={...J?.[V.Day]};return Object.entries($).filter(([,Q])=>Q===!0).forEach(([Q])=>{Y={...Y,...X?.[Q]}}),Y}function t5($,J,X,Y){let Q=Y??$.today(),q=X?$.startOfBroadcastWeek(Q,$):J?$.startOfISOWeek(Q):$.startOfWeek(Q),K=[];for(let G=0;G<7;G++){let _=$.addDays(q,G);K.push(_)}return K}function e5($,J,X,Y,Q=!1){if(!$)return;if(!J)return;let{startOfYear:q,endOfYear:K,eachYearOfInterval:G,getYear:_}=Y,H=q($),x=K(J),B=G({start:H,end:x});if(Q)B.reverse();return B.map((N)=>{let W=X.formatYearDropdown(N,Y);return{value:_(N),label:W,disabled:!1}})}function $8($,J={}){let{weekStartsOn:X,locale:Y}=J,Q=X??Y?.options?.weekStartsOn??0,q=(G)=>{let _=typeof G==="number"||typeof G==="string"?new Date(G):G;return new p(_.getFullYear(),_.getMonth(),_.getDate(),12,0,0,$)},K=(G)=>{let _=q(G);return new Date(_.getFullYear(),_.getMonth(),_.getDate(),0,0,0,0)};return{today:()=>{return q(p.tz($))},newDate:(G,_,H)=>{return new p(G,_,H,12,0,0,$)},startOfDay:(G)=>{return q(G)},startOfWeek:(G,_)=>{let H=q(G),x=_?.weekStartsOn??Q,B=(H.getDay()-x+7)%7;return H.setDate(H.getDate()-B),H},startOfISOWeek:(G)=>{let _=q(G),H=(_.getDay()-1+7)%7;return _.setDate(_.getDate()-H),_},startOfMonth:(G)=>{let _=q(G);return _.setDate(1),_},startOfYear:(G)=>{let _=q(G);return _.setMonth(0,1),_},endOfWeek:(G,_)=>{let H=q(G),N=(((_?.weekStartsOn??Q)+6)%7-H.getDay()+7)%7;return H.setDate(H.getDate()+N),H},endOfISOWeek:(G)=>{let _=q(G),H=(7-_.getDay())%7;return _.setDate(_.getDate()+H),_},endOfMonth:(G)=>{let _=q(G);return _.setMonth(_.getMonth()+1,0),_},endOfYear:(G)=>{let _=q(G);return _.setMonth(11,31),_},eachMonthOfInterval:(G)=>{let _=q(G.start),H=q(G.end),x=[],B=new p(_.getFullYear(),_.getMonth(),1,12,0,0,$),N=H.getFullYear()*12+H.getMonth();while(B.getFullYear()*12+B.getMonth()<=N)x.push(new p(B,$)),B.setMonth(B.getMonth()+1,1);return x},addDays:(G,_)=>{let H=q(G);return H.setDate(H.getDate()+_),H},addWeeks:(G,_)=>{let H=q(G);return H.setDate(H.getDate()+_*7),H},addMonths:(G,_)=>{let H=q(G);return H.setMonth(H.getMonth()+_),H},addYears:(G,_)=>{let H=q(G);return H.setFullYear(H.getFullYear()+_),H},eachYearOfInterval:(G)=>{let _=q(G.start),H=q(G.end),x=[],B=new p(_.getFullYear(),0,1,12,0,0,$);while(B.getFullYear()<=H.getFullYear())x.push(new p(B,$)),B.setFullYear(B.getFullYear()+1,0,1);return x},getWeek:(G,_)=>{let H=K(G);return l1(H,{weekStartsOn:_?.weekStartsOn??Q,firstWeekContainsDate:_?.firstWeekContainsDate??Y?.options?.firstWeekContainsDate??1})},getISOWeek:(G)=>{let _=K(G);return c1(_)},differenceInCalendarDays:(G,_)=>{let H=K(G),x=K(_);return m1(H,x)},differenceInCalendarMonths:(G,_)=>{let H=K(G),x=K(_);return f1(H,x)}}}var E1=T(S(),1);var v1=($)=>{if($ instanceof HTMLElement)return $;return null},Z0=($)=>[...$.querySelectorAll("[data-animated-month]")??[]],c4=($)=>v1($.querySelector("[data-animated-month]")),I0=($)=>v1($.querySelector("[data-animated-caption]")),T0=($)=>v1($.querySelector("[data-animated-weeks]")),l4=($)=>v1($.querySelector("[data-animated-nav]")),n4=($)=>v1($.querySelector("[data-animated-weekdays]"));function J8($,J,{classNames:X,months:Y,focused:Q,dateLib:q}){let K=E1.useRef(null),G=E1.useRef(Y),_=E1.useRef(!1);E1.useLayoutEffect(()=>{let H=G.current;if(G.current=Y,!J||!$.current||!($.current instanceof HTMLElement)||Y.length===0||H.length===0||Y.length!==H.length)return;let x=q.isSameMonth(Y[0].date,H[0].date),B=q.isAfter(Y[0].date,H[0].date),N=B?X[r.caption_after_enter]:X[r.caption_before_enter],W=B?X[r.weeks_after_enter]:X[r.weeks_before_enter],C=K.current,A=$.current.cloneNode(!0);if(A instanceof HTMLElement)Z0(A).forEach((O)=>{if(!(O instanceof HTMLElement))return;let w=c4(O);if(w&&O.contains(w))O.removeChild(w);let E=I0(O);if(E)E.classList.remove(N);let z=T0(O);if(z)z.classList.remove(W)}),K.current=A;else K.current=null;if(_.current||x||Q)return;let P=C instanceof HTMLElement?Z0(C):[],v=Z0($.current);if(v?.every((F)=>F instanceof HTMLElement)&&P?.every((F)=>F instanceof HTMLElement)){_.current=!0;let F=[];$.current.style.isolation="isolate";let O=l4($.current);if(O)O.style.zIndex="1";v.forEach((w,E)=>{let z=P[E];if(!z)return;w.style.position="relative",w.style.overflow="hidden";let Z=I0(w);if(Z)Z.classList.add(N);let M=T0(w);if(M)M.classList.add(W);let y=()=>{if(_.current=!1,$.current)$.current.style.isolation="";if(O)O.style.zIndex="";if(Z)Z.classList.remove(N);if(M)M.classList.remove(W);if(w.style.position="",w.style.overflow="",w.contains(z))w.removeChild(z)};F.push(y),z.style.pointerEvents="none",z.style.position="absolute",z.style.overflow="hidden",z.setAttribute("aria-hidden","true");let f=n4(z);if(f)f.style.opacity="0";let l=I0(z);if(l)l.classList.add(B?X[r.caption_before_exit]:X[r.caption_after_exit]),l.addEventListener("animationend",y);let i=T0(z);if(i)i.classList.add(B?X[r.weeks_before_exit]:X[r.weeks_after_exit]);w.insertBefore(z,w.firstChild)})}})}var o1=T(S(),1);function X8($,J,X,Y){let Q=$[0],q=$[$.length-1],{ISOWeek:K,fixedWeeks:G,broadcastCalendar:_}=X??{},{addDays:H,differenceInCalendarDays:x,differenceInCalendarMonths:B,endOfBroadcastWeek:N,endOfISOWeek:W,endOfMonth:C,endOfWeek:A,isAfter:P,startOfBroadcastWeek:v,startOfISOWeek:F,startOfWeek:O}=Y,w=_?v(Q,Y):K?F(Q):O(Q),E=_?N(q):K?W(C(q)):A(C(q)),z=J&&(_?N(J):K?W(J):A(J)),Z=z&&P(E,z)?z:E,M=x(Z,w),y=B(q,Q)+1,f=[];for(let a=0;a<=M;a++){let t=H(w,a);f.push(t)}let i=(_?35:42)*y;if(G&&f.length<i){let a=i-f.length;for(let t=0;t<a;t++){let P1=H(f[f.length-1],1);f.push(P1)}}return f}function Y8($){let J=[];return $.reduce((X,Y)=>{let Q=Y.weeks.reduce((q,K)=>{return q.concat(K.days.slice())},J.slice());return X.concat(Q.slice())},J.slice())}function G8($,J,X,Y){let{numberOfMonths:Q=1}=X,q=[];for(let K=0;K<Q;K++){let G=Y.addMonths($,K);if(J&&G>J)break;q.push(G)}return q}function S0($,J,X,Y){let{month:Q,defaultMonth:q,today:K=Y.today(),numberOfMonths:G=1}=$,_=Q||q||K,{differenceInCalendarMonths:H,addMonths:x,startOfMonth:B}=Y;if(X&&H(X,_)<G-1){let N=-1*(G-1);_=x(X,N)}if(J&&H(_,J)<0)_=J;return B(_)}function Q8($,J,X,Y){let{addDays:Q,endOfBroadcastWeek:q,endOfISOWeek:K,endOfMonth:G,endOfWeek:_,getISOWeek:H,getWeek:x,startOfBroadcastWeek:B,startOfISOWeek:N,startOfWeek:W}=Y,C=$.reduce((A,P)=>{let v=X.broadcastCalendar?B(P,Y):X.ISOWeek?N(P):W(P),F=X.broadcastCalendar?q(P):X.ISOWeek?K(G(P)):_(G(P)),O=J.filter((Z)=>{return Z>=v&&Z<=F}),w=X.broadcastCalendar?35:42;if(X.fixedWeeks&&O.length<w){let Z=J.filter((M)=>{let y=w-O.length;return M>F&&M<=Q(F,y)});O.push(...Z)}let E=O.reduce((Z,M)=>{let y=X.ISOWeek?H(M):x(M),f=Z.find((i)=>i.weekNumber===y),l=new S1(M,P,Y);if(!f)Z.push(new q0(y,[l]));else f.days.push(l);return Z},[]),z=new K0(P,E);return A.push(z),A},[]);if(!X.reverseMonths)return C;else return C.reverse()}function _8($,J){let{startMonth:X,endMonth:Y}=$,{startOfYear:Q,startOfDay:q,startOfMonth:K,endOfMonth:G,addYears:_,endOfYear:H,today:x}=J,B=$.captionLayout==="dropdown"||$.captionLayout==="dropdown-years";if(X)X=K(X);else if(!X&&B)X=Q(_($.today??x(),-100));if(Y)Y=G(Y);else if(!Y&&B)Y=H($.today??x());return[X?q(X):X,Y?q(Y):Y]}function K8($,J,X,Y){if(X.disableNavigation)return;let{pagedNavigation:Q,numberOfMonths:q=1}=X,{startOfMonth:K,addMonths:G,differenceInCalendarMonths:_}=Y,H=Q?q:1,x=K($);if(!J)return G(x,H);if(_(J,$)<q)return;return G(x,H)}function q8($,J,X,Y){if(X.disableNavigation)return;let{pagedNavigation:Q,numberOfMonths:q}=X,{startOfMonth:K,addMonths:G,differenceInCalendarMonths:_}=Y,H=Q?q??1:1,x=K($);if(!J)return G(x,-H);if(_(x,J)<=0)return;return G(x,-H)}function H8($){let J=[];return $.reduce((X,Y)=>{return X.concat(Y.weeks.slice())},J.slice())}var B8=T(S(),1);function A1($,J){let[X,Y]=B8.useState($);return[J===void 0?X:J,Y]}function x8($,J){let[X,Y]=_8($,J),{startOfMonth:Q,endOfMonth:q}=J,K=S0($,X,Y,J),[G,_]=A1(K,$.month?K:void 0);o1.useEffect(()=>{let w=S0($,X,Y,J);_(w)},[$.timeZone]);let{months:H,weeks:x,days:B,previousMonth:N,nextMonth:W}=o1.useMemo(()=>{let w=G8(G,Y,{numberOfMonths:$.numberOfMonths},J),E=X8(w,$.endMonth?q($.endMonth):void 0,{ISOWeek:$.ISOWeek,fixedWeeks:$.fixedWeeks,broadcastCalendar:$.broadcastCalendar},J),z=Q8(w,E,{broadcastCalendar:$.broadcastCalendar,fixedWeeks:$.fixedWeeks,ISOWeek:$.ISOWeek,reverseMonths:$.reverseMonths},J),Z=H8(z),M=Y8(z),y=q8(G,X,$,J),f=K8(G,Y,$,J);return{months:z,weeks:Z,days:M,previousMonth:y,nextMonth:f}},[J,G.getTime(),Y?.getTime(),X?.getTime(),$.disableNavigation,$.broadcastCalendar,$.endMonth?.getTime(),$.fixedWeeks,$.ISOWeek,$.numberOfMonths,$.pagedNavigation,$.reverseMonths]),{disableNavigation:C,onMonthChange:A}=$,P=(w)=>x.some((E)=>E.days.some((z)=>z.isEqualTo(w))),v=(w)=>{if(C)return;let E=Q(w);if(X&&E<Q(X))E=Q(X);if(Y&&E>Q(Y))E=Q(Y);_(E),A?.(E)};return{months:H,weeks:x,days:B,navStart:X,navEnd:Y,previousMonth:N,nextMonth:W,goToMonth:v,goToDay:(w)=>{if(P(w))return;v(w.date)}}}var v0=T(S(),1);var _1;(function($){$[$.Today=0]="Today",$[$.Selected=1]="Selected",$[$.LastFocused=2]="LastFocused",$[$.FocusedModifier=3]="FocusedModifier"})(_1||(_1={}));function V8($){return!$[b.disabled]&&!$[b.hidden]&&!$[b.outside]}function z8($,J,X,Y){let Q,q=-1;for(let K of $){let G=J(K);if(V8(G)){if(G[b.focused]&&q<_1.FocusedModifier)Q=K,q=_1.FocusedModifier;else if(Y?.isEqualTo(K)&&q<_1.LastFocused)Q=K,q=_1.LastFocused;else if(X(K.date)&&q<_1.Selected)Q=K,q=_1.Selected;else if(G[b.today]&&q<_1.Today)Q=K,q=_1.Today}}if(!Q)Q=$.find((K)=>V8(J(K)));return Q}function A8($,J,X,Y,Q,q,K){let{ISOWeek:G,broadcastCalendar:_}=q,{addDays:H,addMonths:x,addWeeks:B,addYears:N,endOfBroadcastWeek:W,endOfISOWeek:C,endOfWeek:A,max:P,min:v,startOfBroadcastWeek:F,startOfISOWeek:O,startOfWeek:w}=K,z={day:H,week:B,month:x,year:N,startOfWeek:(Z)=>_?F(Z,K):G?O(Z):w(Z),endOfWeek:(Z)=>_?W(Z):G?C(Z):A(Z)}[$](X,J==="after"?1:-1);if(J==="before"&&Y)z=P([Y,z]);else if(J==="after"&&Q)z=v([Q,z]);return z}function k0($,J,X,Y,Q,q,K,G=0){if(G>365)return;let _=A8($,J,X.date,Y,Q,q,K),H=Boolean(q.disabled&&e(_,q.disabled,K)),x=Boolean(q.hidden&&e(_,q.hidden,K)),N=new S1(_,_,K);if(!H&&!x)return N;return k0($,J,N,Y,Q,q,K,G+1)}function P8($,J,X,Y,Q){let{autoFocus:q}=$,[K,G]=v0.useState(),_=z8(J.days,X,Y||(()=>!1),K),[H,x]=v0.useState(q?_:void 0);return{isFocusTarget:(A)=>{return Boolean(_?.isEqualTo(A))},setFocused:x,focused:H,blur:()=>{G(H),x(void 0)},moveFocus:(A,P)=>{if(!H)return;let v=k0(A,P,H,J.navStart,J.navEnd,$,Q);if(!v)return;if($.disableNavigation){if(!J.days.some((O)=>O.isEqualTo(v)))return}J.goToDay(v),x(v)}}}function W8($,J){let{selected:X,required:Y,onSelect:Q}=$,[q,K]=A1(X,Q?X:void 0),G=!Q?q:X,{isSameDay:_}=J,H=(W)=>{return G?.some((C)=>_(C,W))??!1},{min:x,max:B}=$;return{selected:G,select:(W,C,A)=>{let P=[...G??[]];if(H(W)){if(G?.length===x)return;if(Y&&G?.length===1)return;P=G?.filter((v)=>!_(v,W))}else if(G?.length===B)P=[W];else P=[...P,W];if(!Q)K(P);return Q?.(P,W,C,A),P},isSelected:H}}function N8($,J,X=0,Y=0,Q=!1,q=c){let{from:K,to:G}=J||{},{isSameDay:_,isAfter:H,isBefore:x}=q,B;if(!K&&!G)B={from:$,to:X>0?void 0:$};else if(K&&!G)if(_(K,$))if(X===0)B={from:K,to:$};else if(Q)B={from:K,to:void 0};else B=void 0;else if(x($,K))B={from:$,to:K};else B={from:K,to:$};else if(K&&G)if(_(K,$)&&_(G,$))if(Q)B={from:K,to:G};else B=void 0;else if(_(K,$))B={from:K,to:X>0?void 0:$};else if(_(G,$))B={from:$,to:X>0?void 0:$};else if(x($,K))B={from:$,to:G};else if(H($,K))B={from:K,to:$};else if(H($,G))B={from:K,to:$};else throw Error("Invalid range");if(B?.from&&B?.to){let N=q.differenceInCalendarDays(B.to,B.from);if(Y>0&&N>Y)B={from:$,to:void 0};else if(X>1&&N<X)B={from:$,to:void 0}}return B}function w8($,J,X=c){let Y=!Array.isArray(J)?[J]:J,Q=$.from,q=X.differenceInCalendarDays($.to,$.from),K=Math.min(q,6);for(let G=0;G<=K;G++){if(Y.includes(Q.getDay()))return!0;Q=X.addDays(Q,1)}return!1}function M0($,J,X=c){return s($,J.from,!1,X)||s($,J.to,!1,X)||s(J,$.from,!1,X)||s(J,$.to,!1,X)}function j8($,J,X=c){let Y=Array.isArray(J)?J:[J];if(Y.filter((G)=>typeof G!=="function").some((G)=>{if(typeof G==="boolean")return G;if(X.isDate(G))return s($,G,!1,X);if(i1(G,X))return G.some((_)=>s($,_,!1,X));if(z1(G)){if(G.from&&G.to)return M0($,{from:G.from,to:G.to},X);return!1}if(d1(G))return w8($,G.dayOfWeek,X);if(U1(G)){if(X.isAfter(G.before,G.after))return M0($,{from:X.addDays(G.after,1),to:X.addDays(G.before,-1)},X);return e($.from,G,X)||e($.to,G,X)}if(O1(G)||C1(G))return e($.from,G,X)||e($.to,G,X);return!1}))return!0;let K=Y.filter((G)=>typeof G==="function");if(K.length){let G=$.from,_=X.differenceInCalendarDays($.to,$.from);for(let H=0;H<=_;H++){if(K.some((x)=>x(G)))return!0;G=X.addDays(G,1)}}return!1}function U8($,J){let{disabled:X,excludeDisabled:Y,resetOnSelect:Q,selected:q,required:K,onSelect:G}=$,[_,H]=A1(q,G?q:void 0),x=!G?_:q;return{selected:x,select:(W,C,A)=>{let{min:P,max:v}=$,F;if(W){let O=x?.from,w=x?.to,E=!!O&&!!w,z=!!O&&!!w&&J.isSameDay(O,w)&&J.isSameDay(W,O);if(Q&&(E||!x?.from))if(!K&&z)F=void 0;else F={from:W,to:void 0};else F=N8(W,x,P,v,K,J)}if(Y&&X&&F?.from&&F.to){if(j8({from:F.from,to:F.to},X,J))F.from=W,F.to=void 0}if(!G)H(F);return G?.(F,W,C,A),F},isSelected:(W)=>x&&s(x,W,!1,J)}}function O8($,J){let{selected:X,required:Y,onSelect:Q}=$,[q,K]=A1(X,Q?X:void 0),G=!Q?q:X,{isSameDay:_}=J;return{selected:G,select:(B,N,W)=>{let C=B;if(!Y&&G&&G&&_(B,G))C=void 0;if(!Q)K(C);if(Y)Q?.(C,B,N,W);else Q?.(C,B,N,W);return C},isSelected:(B)=>{return G?_(G,B):!1}}}function C8($,J){let X=O8($,J),Y=W8($,J),Q=U8($,J);switch($.mode){case"single":return X;case"multiple":return Y;case"range":return Q;default:return}}function d($,J){if($ instanceof p&&$.timeZone===J)return $;return new p($,J)}function R1($,J,X){if(!X)return d($,J);let Y=d($,J),Q=new p(Y.getFullYear(),Y.getMonth(),Y.getDate(),12,0,0,J);return new Date(Q.getTime())}function E8($,J,X){if(typeof $==="boolean"||typeof $==="function")return $;if($ instanceof Date)return R1($,J,X);if(Array.isArray($))return $.map((Y)=>Y instanceof Date?R1(Y,J,X):Y);if(z1($))return{...$,from:$.from?d($.from,J):$.from,to:$.to?d($.to,J):$.to};if(U1($))return{before:R1($.before,J,X),after:R1($.after,J,X)};if(O1($))return{after:R1($.after,J,X)};if(C1($))return{before:R1($.before,J,X)};return $}function s1($,J,X){if(!$)return $;if(Array.isArray($))return $.map((Y)=>E8(Y,J,X));return E8($,J,X)}function R8($){let J=$,X=J.timeZone;if(X){if(J={...$,timeZone:X},J.today)J.today=d(J.today,X);if(J.month)J.month=d(J.month,X);if(J.defaultMonth)J.defaultMonth=d(J.defaultMonth,X);if(J.startMonth)J.startMonth=d(J.startMonth,X);if(J.endMonth)J.endMonth=d(J.endMonth,X);if(J.mode==="single"&&J.selected)J.selected=d(J.selected,X);else if(J.mode==="multiple"&&J.selected)J.selected=J.selected?.map((U)=>d(U,X));else if(J.mode==="range"&&J.selected)J.selected={from:J.selected.from?d(J.selected.from,X):J.selected.from,to:J.selected.to?d(J.selected.to,X):J.selected.to};if(J.disabled!==void 0)J.disabled=s1(J.disabled,X);if(J.hidden!==void 0)J.hidden=s1(J.hidden,X);if(J.modifiers){let U={};Object.keys(J.modifiers).forEach((I)=>{U[I]=s1(J.modifiers?.[I],X)}),J.modifiers=U}}let{components:Y,formatters:Q,labels:q,dateLib:K,locale:G,classNames:_}=j.useMemo(()=>{let U={...T1,...J.locale},I=J.broadcastCalendar?1:J.weekStartsOn,R=J.noonSafe&&J.timeZone?$8(J.timeZone,{weekStartsOn:I,locale:U}):void 0,h=J.dateLib&&R?{...R,...J.dateLib}:J.dateLib??R,g=new m({locale:U,weekStartsOn:I,firstWeekContainsDate:J.firstWeekContainsDate,useAdditionalWeekYearTokens:J.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:J.useAdditionalDayOfYearTokens,timeZone:J.timeZone,numerals:J.numerals},h);return{dateLib:g,components:r5(J.components),formatters:i5(J.formatters),labels:o5(J.labels,g.options),locale:U,classNames:{...k1(),...J.classNames}}},[J.locale,J.broadcastCalendar,J.weekStartsOn,J.firstWeekContainsDate,J.useAdditionalWeekYearTokens,J.useAdditionalDayOfYearTokens,J.timeZone,J.numerals,J.dateLib,J.noonSafe,J.components,J.formatters,J.labels,J.classNames]);if(!J.today)J={...J,today:K.today()};let{captionLayout:H,mode:x,navLayout:B,numberOfMonths:N=1,onDayBlur:W,onDayClick:C,onDayFocus:A,onDayKeyDown:P,onDayMouseEnter:v,onDayMouseLeave:F,onNextClick:O,onPrevClick:w,showWeekNumber:E,styles:z}=J,{formatCaption:Z,formatDay:M,formatMonthDropdown:y,formatWeekNumber:f,formatWeekNumberHeader:l,formatWeekdayName:i,formatYearDropdown:a}=Q,t=x8(J,K),{days:P1,months:F1,navStart:t1,navEnd:e1,previousMonth:$1,nextMonth:J1,goToMonth:H1}=t,$0=l5(P1,J,t1,e1,K),{isSelected:J0,select:X0,selected:L1}=C8(J,K)??{},{blur:D0,focused:y0,isFocusTarget:g8,moveFocus:f0,setFocused:g1}=P8(J,t,$0,J0??(()=>!1),K),{labelDayButton:b8,labelGridcell:D8,labelGrid:y8,labelMonthDropdown:f8,labelNav:u0,labelPrevious:u8,labelNext:h8,labelWeekday:p8,labelWeekNumber:m8,labelWeekNumberHeader:c8,labelYearDropdown:l8}=q,n8=j.useMemo(()=>t5(K,J.ISOWeek,J.broadcastCalendar,J.today),[K,J.ISOWeek,J.broadcastCalendar,J.today]),h0=x!==void 0||C!==void 0,Y0=j.useCallback(()=>{if(!$1)return;H1($1),w?.($1)},[$1,H1,w]),G0=j.useCallback(()=>{if(!J1)return;H1(J1),O?.(J1)},[H1,J1,O]),r8=j.useCallback((U,I)=>(R)=>{if(R.preventDefault(),R.stopPropagation(),g1(U),I.disabled)return;X0?.(U.date,I,R),C?.(U.date,I,R)},[X0,C,g1]),d8=j.useCallback((U,I)=>(R)=>{g1(U),A?.(U.date,I,R)},[A,g1]),i8=j.useCallback((U,I)=>(R)=>{D0(),W?.(U.date,I,R)},[D0,W]),o8=j.useCallback((U,I)=>(R)=>{let h={ArrowLeft:[R.shiftKey?"month":"day",J.dir==="rtl"?"after":"before"],ArrowRight:[R.shiftKey?"month":"day",J.dir==="rtl"?"before":"after"],ArrowDown:[R.shiftKey?"year":"week","after"],ArrowUp:[R.shiftKey?"year":"week","before"],PageUp:[R.shiftKey?"year":"month","before"],PageDown:[R.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(h[R.key]){R.preventDefault(),R.stopPropagation();let[g,Q1]=h[R.key];f0(g,Q1)}P?.(U.date,I,R)},[f0,P,J.dir]),s8=j.useCallback((U,I)=>(R)=>{v?.(U.date,I,R)},[v]),a8=j.useCallback((U,I)=>(R)=>{F?.(U.date,I,R)},[F]),t8=j.useCallback((U,I)=>(R)=>{let h=Number(R.target.value),g=K.setMonth(K.startOfMonth(U),h);H1(K.addMonths(g,-I))},[K,H1]),e8=j.useCallback((U,I)=>(R)=>{let h=Number(R.target.value),g=K.setYear(K.startOfMonth(U),h);H1(K.addMonths(g,-I))},[K,H1]),{className:$4,style:J4}=j.useMemo(()=>({className:[_[V.Root],J.className].filter(Boolean).join(" "),style:{...z?.[V.Root],...J.style}}),[_,J.className,J.style,z]),X4=d5(J),p0=(U)=>{let I=z?.[V.Dropdown],R=z?.[U];if(!I&&!R)return;return{...I,...R}},m0=j.useRef(null);J8(m0,Boolean(J.animate),{classNames:_,months:F1,focused:y0,dateLib:K});let Y4={dayPickerProps:J,selected:L1,select:X0,isSelected:J0,months:F1,nextMonth:J1,previousMonth:$1,goToMonth:H1,getModifiers:$0,components:Y,classNames:_,styles:z,labels:q,formatters:Q};return j.default.createElement(H0.Provider,{value:Y4},j.default.createElement(Y.Root,{rootRef:J.animate?m0:void 0,className:$4,style:J4,dir:J.dir,id:J.id,lang:J.lang??G.code,nonce:J.nonce,title:J.title,role:J.role,"aria-label":J["aria-label"],"aria-labelledby":J["aria-labelledby"],...X4},j.default.createElement(Y.Months,{className:_[V.Months],style:z?.[V.Months]},!J.hideNavigation&&!B&&j.default.createElement(Y.Nav,{"data-animated-nav":J.animate?"true":void 0,className:_[V.Nav],style:z?.[V.Nav],"aria-label":u0(),onPreviousClick:Y0,onNextClick:G0,previousMonth:$1,nextMonth:J1}),F1.map((U,I)=>{let R=J.reverseMonths?F1.length-1-I:I;return j.default.createElement(Y.Month,{"data-animated-month":J.animate?"true":void 0,className:_[V.Month],style:z?.[V.Month],key:I,displayIndex:I,calendarMonth:U},B==="around"&&!J.hideNavigation&&I===0&&j.default.createElement(Y.PreviousMonthButton,{type:"button",className:_[V.PreviousMonthButton],style:z?.[V.PreviousMonthButton],tabIndex:$1?void 0:-1,"aria-disabled":$1?void 0:!0,"aria-label":u8($1),onClick:Y0,"data-animated-button":J.animate?"true":void 0},j.default.createElement(Y.Chevron,{disabled:$1?void 0:!0,className:_[V.Chevron],style:z?.[V.Chevron],orientation:J.dir==="rtl"?"right":"left"})),j.default.createElement(Y.MonthCaption,{"data-animated-caption":J.animate?"true":void 0,className:_[V.MonthCaption],style:z?.[V.MonthCaption],calendarMonth:U,displayIndex:I},H?.startsWith("dropdown")?j.default.createElement(Y.DropdownNav,{className:_[V.Dropdowns],style:z?.[V.Dropdowns]},(()=>{let h=H==="dropdown"||H==="dropdown-months"?j.default.createElement(Y.MonthsDropdown,{key:"month",className:_[V.MonthsDropdown],"aria-label":f8(),disabled:Boolean(J.disableNavigation),onChange:t8(U.date,R),options:s5(U.date,t1,e1,Q,K),style:p0(V.MonthsDropdown),value:K.getMonth(U.date)}):j.default.createElement("span",{key:"month"},y(U.date,K)),g=H==="dropdown"||H==="dropdown-years"?j.default.createElement(Y.YearsDropdown,{key:"year",className:_[V.YearsDropdown],"aria-label":l8(K.options),disabled:Boolean(J.disableNavigation),onChange:e8(U.date,R),options:e5(t1,e1,Q,K,Boolean(J.reverseYears)),style:p0(V.YearsDropdown),value:K.getYear(U.date)}):j.default.createElement("span",{key:"year"},a(U.date,K));return K.getMonthYearOrder()==="year-first"?[g,h]:[h,g]})(),j.default.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},Z(U.date,K.options,K))):j.default.createElement(Y.CaptionLabel,{className:_[V.CaptionLabel],style:z?.[V.CaptionLabel],role:"status","aria-live":"polite"},Z(U.date,K.options,K))),B==="around"&&!J.hideNavigation&&I===N-1&&j.default.createElement(Y.NextMonthButton,{type:"button",className:_[V.NextMonthButton],style:z?.[V.NextMonthButton],tabIndex:J1?void 0:-1,"aria-disabled":J1?void 0:!0,"aria-label":h8(J1),onClick:G0,"data-animated-button":J.animate?"true":void 0},j.default.createElement(Y.Chevron,{disabled:J1?void 0:!0,className:_[V.Chevron],style:z?.[V.Chevron],orientation:J.dir==="rtl"?"left":"right"})),I===N-1&&B==="after"&&!J.hideNavigation&&j.default.createElement(Y.Nav,{"data-animated-nav":J.animate?"true":void 0,className:_[V.Nav],style:z?.[V.Nav],"aria-label":u0(),onPreviousClick:Y0,onNextClick:G0,previousMonth:$1,nextMonth:J1}),j.default.createElement(Y.MonthGrid,{role:"grid","aria-multiselectable":x==="multiple"||x==="range","aria-label":y8(U.date,K.options,K)||void 0,className:_[V.MonthGrid],style:z?.[V.MonthGrid]},!J.hideWeekdays&&j.default.createElement(Y.Weekdays,{"data-animated-weekdays":J.animate?"true":void 0,className:_[V.Weekdays],style:z?.[V.Weekdays]},E&&j.default.createElement(Y.WeekNumberHeader,{"aria-label":c8(K.options),className:_[V.WeekNumberHeader],style:z?.[V.WeekNumberHeader],scope:"col"},l()),n8.map((h)=>j.default.createElement(Y.Weekday,{"aria-label":p8(h,K.options,K),className:_[V.Weekday],key:String(h),style:z?.[V.Weekday],scope:"col"},i(h,K.options,K)))),j.default.createElement(Y.Weeks,{"data-animated-weeks":J.animate?"true":void 0,className:_[V.Weeks],style:z?.[V.Weeks]},U.weeks.map((h)=>{return j.default.createElement(Y.Week,{className:_[V.Week],key:h.weekNumber,style:z?.[V.Week],week:h},E&&j.default.createElement(Y.WeekNumber,{week:h,style:z?.[V.WeekNumber],"aria-label":m8(h.weekNumber,{locale:G}),className:_[V.WeekNumber],scope:"row",role:"rowheader"},f(h.weekNumber,K)),h.days.map((g)=>{let{date:Q1}=g,L=$0(g);if(L[b.focused]=!L.hidden&&Boolean(y0?.isEqualTo(g)),L[o.selected]=J0?.(Q1)||L.selected,z1(L1)){let{from:Q0,to:_0}=L1;L[o.range_start]=Boolean(Q0&&_0&&K.isSameDay(Q1,Q0)),L[o.range_end]=Boolean(Q0&&_0&&K.isSameDay(Q1,_0)),L[o.range_middle]=s(L1,Q1,!0,K)}let G4=a5(L,z,J.modifiersStyles),Q4=n5(L,_,J.modifiersClassNames),_4=!h0&&!L.hidden?D8(Q1,L,K.options,K):void 0;return j.default.createElement(Y.Day,{key:`${g.isoDate}_${g.displayMonthId}`,day:g,modifiers:L,className:Q4.join(" "),style:G4,role:"gridcell","aria-selected":L.selected||void 0,"aria-label":_4,"data-day":g.isoDate,"data-month":g.outside?g.dateMonthId:void 0,"data-selected":L.selected||void 0,"data-disabled":L.disabled||void 0,"data-hidden":L.hidden||void 0,"data-outside":g.outside||void 0,"data-focused":L.focused||void 0,"data-today":L.today||void 0},!L.hidden&&h0?j.default.createElement(Y.DayButton,{className:_[V.DayButton],style:z?.[V.DayButton],type:"button",day:g,modifiers:L,disabled:!L.focused&&L.disabled||void 0,"aria-disabled":L.focused&&L.disabled||void 0,tabIndex:g8(g)?0:-1,"aria-label":b8(Q1,L,K.options,K),onClick:r8(g,L),onBlur:i8(g,L),onFocus:d8(g,L),onKeyDown:o8(g,L),onMouseEnter:s8(g,L),onMouseLeave:a8(g,L)},M(Q1,K.options,K)):!L.hidden&&M(g.date,K.options,K))}))}))))})),J.footer&&j.default.createElement(Y.Footer,{className:_[V.Footer],style:z?.[V.Footer],role:"status","aria-live":"polite"},J.footer)))}function T8({className:$,classNames:J,showOutsideDays:X=!0,captionLayout:Y="label",buttonVariant:Q="ghost",formatters:q,components:K,...G}){let _=k1();return D(R8,{showOutsideDays:X,className:k("group/calendar bg-background p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,$),captionLayout:Y,formatters:{formatMonthDropdown:(H)=>H.toLocaleString("default",{month:"short"}),...q},classNames:{root:k("w-fit",_.root),months:k("relative flex flex-col gap-4 md:flex-row",_.months),month:k("flex w-full flex-col gap-4",_.month),nav:k("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",_.nav),button_previous:k(L0({variant:Q}),"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",_.button_previous),button_next:k(L0({variant:Q}),"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",_.button_next),month_caption:k("flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)",_.month_caption),dropdowns:k("flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium",_.dropdowns),dropdown_root:k("relative rounded-md border border-input shadow-xs has-focus:border-ring has-focus:ring-[3px] has-focus:ring-ring/50",_.dropdown_root),dropdown:k("absolute inset-0 bg-popover opacity-0",_.dropdown),caption_label:k("font-medium select-none",Y==="label"?"text-sm":"flex h-8 items-center gap-1 rounded-md pr-1 pl-2 text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground",_.caption_label),month_grid:"w-full border-collapse",weekdays:k("flex",_.weekdays),weekday:k("flex-1 rounded-md text-[0.8rem] font-normal text-muted-foreground select-none",_.weekday),week:k("mt-2 flex w-full",_.week),week_number_header:k("w-(--cell-size) select-none",_.week_number_header),week_number:k("text-[0.8rem] text-muted-foreground select-none",_.week_number),day:k("group/day relative aspect-square h-full w-full p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-md",G.showWeekNumber?"[&:nth-child(2)[data-selected=true]_button]:rounded-l-md":"[&:first-child[data-selected=true]_button]:rounded-l-md",_.day),range_start:k("rounded-l-md bg-accent",_.range_start),range_middle:k("rounded-none",_.range_middle),range_end:k("rounded-r-md bg-accent",_.range_end),today:k("rounded-md bg-accent text-accent-foreground data-[selected=true]:rounded-none",_.today),outside:k("text-muted-foreground aria-selected:text-muted-foreground",_.outside),disabled:k("text-muted-foreground opacity-50",_.disabled),hidden:k("invisible",_.hidden),...J},components:{Root:({className:H,rootRef:x,...B})=>{return D("div",{"data-slot":"calendar",ref:x,className:k(H),...B})},Chevron:({className:H,orientation:x,...B})=>{if(x==="left")return D(Z8,{className:k("size-4",H),...B});if(x==="right")return D(I8,{className:k("size-4",H),...B});return D(F8,{className:k("size-4",H),...B})},DayButton:r4,WeekNumber:({children:H,...x})=>{return D("td",{...x,children:D("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:H})})},...K},...G})}function r4({className:$,day:J,modifiers:X,...Y}){let Q=k1(),q=a1.useRef(null);return a1.useEffect(()=>{if(X.focused)q.current?.focus()},[X.focused]),D(K1,{ref:q,variant:"ghost",size:"icon","data-day":J.date.toLocaleDateString(),"data-selected-single":X.selected&&!X.range_start&&!X.range_end&&!X.range_middle,"data-range-start":X.range_start,"data-range-end":X.range_end,"data-range-middle":X.range_middle,className:k("flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-accent-foreground [&>span]:text-xs [&>span]:opacity-70",Q.day,$),...Y})}var M1=T(S(),1);function iY({value:$,onChange:J,placeholder:X="Pick a date",disabled:Y,className:Q}){let[q,K]=M1.useState(!1),[G,_]=M1.useState($);M1.useEffect(()=>{if(q)_($)},[q,$]);let H=Array.from({length:24},(A,P)=>P),x=Array.from({length:12},(A,P)=>P*5),B=(A)=>{if(A){let P=G?new Date(G):new Date;P.setFullYear(A.getFullYear()),P.setMonth(A.getMonth()),P.setDate(A.getDate()),_(P)}else _(void 0)},N=(A,P)=>{let v=G?new Date(G):new Date;if(A==="hour")v.setHours(P);else v.setMinutes(P);_(v)},W=(A)=>{let P=new Date;if(A==="24h")P=s0(P,24);else if(A==="1w")P=I1(P,1);else if(A==="2w")P=I1(P,2);_(P)},C=()=>{J?.(G),K(!1)};return q1(k8,{open:q,onOpenChange:K,children:[D(v8,{asChild:!0,children:q1(K1,{variant:"outline",disabled:Y,className:k("w-full justify-start text-left font-normal h-9",!$&&"text-muted-foreground",Q),children:[D(S8,{className:"mr-2 h-4 w-4"}),$?B1($,"yyyy/MM/dd HH:mm"):D("span",{children:X})]})}),D(M8,{className:"w-[22rem] p-0",align:"start",children:q1("div",{className:"flex flex-col w-full",children:[q1("div",{className:"flex w-full",children:[D(T8,{mode:"single",selected:G,onSelect:B,className:"grow"}),q1("div",{className:"flex flex-col sm:flex-row sm:h-[300px] divide-y sm:divide-y-0 sm:divide-x border-t sm:border-t-0 border-l",children:[q1(g0,{className:"w-64 sm:w-auto [&_[data-orientation=vertical]]:hidden",children:[D("div",{className:"flex sm:flex-col p-2",children:H.map((A)=>D(K1,{size:"icon",variant:G&&G.getHours()===A?"default":"ghost",className:"sm:w-full shrink-0 aspect-square text-xs h-8 w-8",onClick:()=>N("hour",A),children:A.toString().padStart(2,"0")},A))}),D(b0,{orientation:"horizontal",className:"sm:hidden"})]}),q1(g0,{className:"w-64 sm:w-auto [&_[data-orientation=vertical]]:hidden",children:[D("div",{className:"flex sm:flex-col p-2",children:x.map((A)=>D(K1,{size:"icon",variant:G&&G.getMinutes()===A?"default":"ghost",className:"sm:w-full shrink-0 aspect-square text-xs h-8 w-8",onClick:()=>N("minute",A),children:A.toString().padStart(2,"0")},A))}),D(b0,{orientation:"horizontal",className:"sm:hidden"})]})]})]}),D(L8,{}),q1("div",{className:"p-2 flex items-center justify-between bg-muted/50",children:[q1("div",{className:"flex gap-2",children:[D(K1,{variant:"outline",size:"sm",className:"text-[10px] h-7 px-2",onClick:()=>W("24h"),children:"24 Hours"}),D(K1,{variant:"outline",size:"sm",className:"text-[10px] h-7 px-2",onClick:()=>W("1w"),children:"1 Week"}),D(K1,{variant:"outline",size:"sm",className:"text-[10px] h-7 px-2",onClick:()=>W("2w"),children:"2 Weeks"})]}),D(K1,{size:"sm",className:"h-7 px-4",onClick:C,children:"Save"})]})]})})]})}
|
|
2
|
+
export{iY as De};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{S as
|
|
1
|
+
import{$h as Y,Yh as W,_h as b,vi as Z}from"./chunk-yfgwknpa.js";import{Mm as R}from"./chunk-wwjqqqr4.js";var r=Z((u)=>({uploading:0,tasks:{},fileProgress:{},increment:()=>u((d)=>({uploading:d.uploading+1})),decrement:()=>u((d)=>({uploading:d.uploading-1})),startTask:(d,k,F)=>u((o)=>{let l={},s=0;F.forEach((f)=>{l[f.fileId]={fileId:f.fileId,name:f.name,loaded:0,total:f.size,status:"uploading"},s+=f.size});let g={...o.tasks,[d]:{taskId:d,name:k,loaded:0,total:s,files:l}},P={...o.fileProgress};return F.forEach((f)=>{P[f.fileId]=l[f.fileId]}),{tasks:g,fileProgress:P}}),updateFileProgress:(d,k,F)=>u((o)=>{let l=o.tasks[d];if(!l)return{};let s=l.files[k];if(!s)return{};let g={...s,loaded:F},P={...l.files,[k]:g},f=Object.values(P).reduce((p,w)=>p+w.loaded,0);return{tasks:{...o.tasks,[d]:{...l,loaded:f,files:P}},fileProgress:{...o.fileProgress,[k]:g}}}),completeFile:(d,k)=>u((F)=>{let o=F.tasks[d];if(!o)return{};let l=o.files[k];if(!l)return{};let s={...l,status:"completed",loaded:l.total},g={...o.files,[k]:s},P=Object.values(g).reduce((f,p)=>f+p.loaded,0);return{tasks:{...F.tasks,[d]:{...o,loaded:P,files:g}},fileProgress:{...F.fileProgress,[k]:s}}}),failFile:(d,k)=>u((F)=>{let o=F.tasks[d];if(!o)return{};let l=o.files[k];if(!l)return{};let s={...l,status:"failed"},g={...o.files,[k]:s},P=Object.values(g).reduce((f,p)=>f+p.loaded,0);return{tasks:{...F.tasks,[d]:{...o,loaded:P,files:g}},fileProgress:{...F.fileProgress,[k]:s}}})}));var a=R(W(),1);var q=10,Q=10,$=q*Q,S=({spriteUrl:u,thumbnailUrl:d,videoWidth:k,videoHeight:F,className:o=""})=>{let l=a.useRef(null),[s,g]=a.useState({width:0,height:0}),[P,f]=a.useState({width:0,height:0}),[p,w]=a.useState(!1),[c,E]=a.useState(!1),[V,J]=a.useState(!1),[K,N]=a.useState(0),[j,n]=a.useState(0);a.useEffect(()=>{if(!l.current)return;let t=new ResizeObserver((m)=>{for(let B of m)g({width:B.contentRect.width,height:B.contentRect.height})});return t.observe(l.current),()=>t.disconnect()},[]);let X=a.useCallback(()=>{if(c||V)return;J(!0);let t=new Image;t.src=u,t.onload=()=>{f({width:t.naturalWidth,height:t.naturalHeight}),E(!0),J(!1)},t.onerror=()=>{console.error("Failed to load sprite image"),J(!1)}},[u,c,V]),M=()=>{w(!0),X()},A=()=>{w(!1)},D=(t)=>{if(!l.current)return;let m=l.current.getBoundingClientRect(),B=t.clientX-m.left,y=Math.max(0,Math.min(B,m.width));n(y);let T=y/m.width,U=Math.min(Math.floor(T*$),$-1);N(U)},G=a.useMemo(()=>{if(s.width===0||s.height===0)return{};let t=k/F;if(P.width>0&&P.height>0){let z=P.width/q,i=P.height/Q;t=z/i}let m=s.width/s.height,B,y;if(m>t)y=s.height,B=y*t;else B=s.width,y=B/t;let T=Math.ceil(B),U=Math.ceil(y),I=T*q,O=U*Q,v=K%q,x=Math.floor(K/q),C=-(v*T),_=-(x*U);return{backgroundImage:`url(${u})`,backgroundSize:`${I}px ${O}px`,backgroundPosition:`${C}px ${_}px`,backgroundRepeat:"no-repeat",width:`${T}px`,height:`${U}px`,imageRendering:"auto"}},[s,k,F,K,u,P]);return Y("div",{ref:l,className:`relative w-full h-full overflow-hidden cursor-crosshair group bg-black select-none ${o}`,onMouseEnter:M,onMouseLeave:A,onMouseMove:D,children:[b("img",{src:d,alt:"Thumbnail",className:`absolute inset-0 w-full h-full object-contain transition-opacity duration-200 ${p&&c?"opacity-0":"opacity-100"}`,draggable:!1}),p&&!c&&b("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 z-10",children:b("div",{className:"w-6 h-6 border-2 border-white/30 border-t-white rounded-full animate-spin"})}),c&&b("div",{className:`absolute inset-0 flex items-center justify-center transition-opacity duration-75 ${p?"opacity-100":"opacity-0"}`,children:b("div",{style:G})}),p&&b("div",{className:"absolute top-0 bottom-0 w-0.5 bg-red-500 shadow-[0_0_4px_rgba(255,0,0,0.8)] z-20 pointer-events-none",style:{transform:`translateX(${j}px)`}})]})};
|
|
2
|
+
export{S as Qe,r as Re};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Rl as Xq,Sl as Yq}from"./chunk-mk5hqjjd.js";import{Wl as _q}from"./chunk-0qcp4v52.js";import{Xl as a}from"./chunk-4shqnfq1.js";import{Yl as c}from"./chunk-v1ybpqrz.js";import{_l as e}from"./chunk-8zmk029n.js";import{$l as t}from"./chunk-g2bkj92r.js";import{bm as C}from"./chunk-7r6h3fta.js";import{om as n,pm as s}from"./chunk-7m07t899.js";import{qm as o,rm as qq,sm as Jq,tm as Qq,um as u,wm as $q,ym as Zq}from"./chunk-g6aq2cyq.js";import{zm as M}from"./chunk-d4ktgq49.js";import{Am as l}from"./chunk-1whn0v5n.js";import{Gm as i,Hm as m}from"./chunk-34f4hk54.js";import{Im as d}from"./chunk-k33qdrdp.js";import"./chunk-wwjqqqr4.js";function g(q,Q){if(!q)return!1;let J=Q.toLowerCase();for(let[X,Y]of Object.entries(q))if(X.toLowerCase()===J&&Y!==null&&Y.trim().length>0)return!0;return!1}function Kq(q,Q,J){if(Q)return Q;if(g(J,"authorization")||g(J,"cf-aig-authorization"))return"unused";throw Error(`No API key for provider: ${q}`)}function Fq(q){for(let Q of q){if(Q.role==="toolResult")return!0;if(Q.role==="assistant"){if(Q.content.some((J)=>J.type==="toolCall"))return!0}}return!1}function Nq(q){let Q=new Set;for(let J of q)if(J.role==="toolResult")for(let X of J.addedToolNames??[])Q.add(X);return Q}function Aq(q,Q){if(!q)return[];let J=new Map(q.map((X)=>[X.name,X]));return Array.from(Q).map((X)=>J.get(X)).filter((X)=>X!==void 0)}function r(q){return q.type==="text"}function Eq(q){return q.type==="thinking"}function Dq(q){return q.type==="toolCall"}function Pq(q){return q.type==="image"}function wq(q){if(typeof q!=="object"||q===null)return!1;let Q=q;return Q.type==="reasoning.encrypted"&&typeof Q.id==="string"&&Q.id.length>0&&typeof Q.data==="string"&&Q.data.length>0}function jq(q,Q){if(q)return q;if(t("PI_CACHE_RETENTION",Q)==="long")return"long";return"short"}var Uq=(q,Q,J)=>{let X=new d;return(async()=>{let Y={role:"assistant",content:[],api:q.api,provider:q.provider,model:q.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let V=Kq(q.provider,J?.apiKey,J?.headers),j=h(q),F=u(Q.tools,j.supportsOpenAIGrammarTools),$=jq(J?.cacheRetention,J?.env),W=$==="none"?void 0:J?.sessionId,z=Bq(q,Q,V,J?.headers,W,j),Z=yq(q,Q,J,j,$,F),S=await J?.onPayload?.(Z,q);if(S!==void 0)Z=S;let O={...J?.signal?{signal:J.signal}:{},...J?.timeoutMs!==void 0?{timeout:J.timeoutMs}:{},maxRetries:0},{data:P,response:U}=await e(()=>z.chat.completions.create(Z,O).withResponse(),{maxRetries:J?.maxRetries,maxRetryDelayMs:J?.maxRetryDelayMs,signal:J?.signal});await J?.onResponse?.({status:U.status,headers:l(U.headers)},q),X.push({type:"start",partial:Y});let B=null,G=null,N=!1,D=new Map,T=new Map,x=new Map,f=Y.content,v=(_)=>f.indexOf(_),b=(_)=>{let K=_.customInput?.property;if(K===void 0)return"";let E=_.arguments[K];return typeof E==="string"?E:""},k=(_,K,E)=>{let H=_.customInput;if(!H)return;let w=qq(H.jsonBuffer,H.property,K,E);return _.arguments={[H.property]:K},w},Lq=(_)=>{let K=v(_);if(K===-1)return;if(_.type==="text")X.push({type:"text_end",contentIndex:K,content:_.text,partial:Y});else if(_.type==="thinking")X.push({type:"thinking_end",contentIndex:K,content:_.thinking,partial:Y});else if(_.type==="toolCall"){if(_.customInput){let E=k(_,b(_),!0);if(E!==void 0)X.push({type:"toolcall_delta",contentIndex:K,delta:E,partial:Y})}else _.arguments=C(_.partialArgs);delete _.partialArgs,delete _.customInput,delete _.streamIndex,X.push({type:"toolcall_end",contentIndex:K,toolCall:_,partial:Y})}},Vq=()=>{if(!B)B={type:"text",text:""},f.push(B),X.push({type:"text_start",contentIndex:v(B),partial:Y});return B},Wq=(_)=>{if(!G)G={type:"thinking",thinking:"",thinkingSignature:_},f.push(G),X.push({type:"thinking_start",contentIndex:v(G),partial:Y});return G},Gq=(_)=>{if(!_.id)return;let K=x.get(_.id);if(K)_.thoughtSignature=K,x.delete(_.id)},Sq=(_)=>{let K=typeof _.index==="number"?_.index:void 0,E=_.function?.name??_.custom?.name??"",H=K!==void 0?D.get(K):void 0;if(!H&&_.id)H=T.get(_.id);if(!H){let w=_.custom?F.get(E)??"input":void 0,R=w!==void 0;if(H={type:"toolCall",id:_.id||"",name:E,arguments:R?{[w]:""}:{},partialArgs:R?void 0:"",customInput:R?{property:w,jsonBuffer:{input:"",started:!1,closed:!1}}:void 0,streamIndex:K},K!==void 0)D.set(K,H);if(_.id)T.set(_.id,H);f.push(H),X.push({type:"toolcall_start",contentIndex:v(H),partial:Y})}if(K!==void 0&&H.streamIndex===void 0)H.streamIndex=K,D.set(K,H);if(_.id)T.set(_.id,H);if(!H.name&&E)H.name=E;if(_.custom&&!H.customInput){let w=F.get(H.name)??"input";H.arguments={[w]:""},H.customInput={property:w,jsonBuffer:{input:"",started:!1,closed:!1}},delete H.partialArgs}return Gq(H),H};for await(let _ of P){if(!_||typeof _!=="object")continue;if(Y.responseId||=_.id,typeof _.model==="string"&&_.model.length>0&&_.model!==q.id)Y.responseModel||=_.model;if(_.usage)Y.usage=p(_.usage,q);let K=Array.isArray(_.choices)?_.choices[0]:void 0;if(!K)continue;if(!_.usage&&K.usage)Y.usage=p(K.usage,q);if(K.finish_reason){let E=bq(K.finish_reason);if(Y.stopReason=E.stopReason,E.errorMessage)Y.errorMessage=E.errorMessage;N=!0}if(K.delta){if(K.delta.content!==null&&K.delta.content!==void 0&&K.delta.content.length>0){let L=Vq();L.text+=K.delta.content,X.push({type:"text_delta",contentIndex:v(L),delta:K.delta.content,partial:Y})}let E=["reasoning_content","reasoning","reasoning_text"],H=K.delta,w=null;for(let L of E){let A=H[L];if(typeof A==="string"&&A.length>0){w=L;break}}if(w){let L=H[w];if(typeof L==="string"&&L.length>0){let A=q.provider==="opencode-go"&&w==="reasoning"?"reasoning_content":w,y=Wq(A);y.thinking+=L,X.push({type:"thinking_delta",contentIndex:v(y),delta:L,partial:Y})}}if(K?.delta?.tool_calls)for(let L of K.delta.tool_calls){let A=Sq(L);if(!A.id&&L.id)A.id=L.id,T.set(L.id,A);let y=L.function?.name??L.custom?.name;if(!A.name&&y)A.name=y;let I="";if(L.function?.arguments)I=L.function.arguments,A.partialArgs=(A.partialArgs??"")+L.function.arguments,A.arguments=C(A.partialArgs);else if(L.custom?.input){let Oq=b(A)+L.custom.input;I=k(A,Oq,!1)??""}X.push({type:"toolcall_delta",contentIndex:v(A),delta:I,partial:Y})}let R=K.delta.reasoning_details;if(Array.isArray(R)){for(let L of R)if(wq(L)){let A=JSON.stringify(L),y=T.get(L.id);if(y)y.thoughtSignature=A;else x.set(L.id,A)}}}}for(let _ of f)Lq(_);if(J?.signal?.aborted)throw Error("Request was aborted");if(Y.stopReason==="aborted")throw Error("Request was aborted");if(Y.stopReason==="error")throw Error(Y.errorMessage||"Provider returned an error stop reason");if(!N)throw Error("Stream ended without finish_reason");X.push({type:"done",reason:Y.stopReason,message:Y}),X.end()}catch(V){for(let F of Y.content)delete F.index,delete F.partialArgs,delete F.customInput,delete F.streamIndex;Y.stopReason=J?.signal?.aborted?"aborted":"error",Y.errorMessage=s(n(V));let j=V?.error?.metadata?.raw;if(j&&!Y.errorMessage.includes(String(j)))Y.errorMessage+=`
|
|
3
3
|
${j}`;X.push({type:"error",reason:Y.stopReason,error:Y}),X.end()}})(),X},JJ=(q,Q,J)=>{Kq(q.provider,J?.apiKey,J?.headers);let X=$q(q,Q,J,J?.apiKey),Y=J?.reasoning?m(q,J.reasoning):void 0,V=Y==="off"?void 0:Y,j=J?.toolChoice;return Uq(q,Q,{...X,reasoningEffort:V,toolChoice:j})};function Bq(q,Q,J,X,Y,V=h(q)){let j={...q.headers};if(q.provider==="github-copilot"){let F=Xq(Q.messages),$=Yq({messages:Q.messages,hasImages:F});Object.assign(j,$)}if(Y&&V.sendSessionAffinityHeaders)if(V.sessionAffinityFormat==="openrouter")j["x-session-id"]=Y;else{if(V.sessionAffinityFormat==="openai")j.session_id=Y;j["x-client-request-id"]=Y,j["x-session-affinity"]=Y}if(X)Object.assign(j,X);return new c({apiKey:J,baseURL:q.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:j})}function yq(q,Q,J,X=h(q),Y=jq(J?.cacheRetention,J?.env),V=u(Q.tools,X.supportsOpenAIGrammarTools)){let j=hq(q,Q,X,{grammarToolInputProperties:V}),F=Rq(X,Y),$={model:q.id,messages:j,stream:!0,prompt_cache_key:q.baseUrl.includes("api.openai.com")&&Y!=="none"||Y==="long"&&X.supportsLongCacheRetention?_q(J?.sessionId):void 0,prompt_cache_retention:Y==="long"&&X.supportsLongCacheRetention?"24h":void 0};if(X.supportsUsageInStreaming!==!1)$.stream_options={include_usage:!0};if(X.supportsStore)$.store=!1;if(J?.maxTokens)if(X.maxTokensField==="max_tokens")$.max_tokens=J.maxTokens;else $.max_completion_tokens=J.maxTokens;if(J?.temperature!==void 0)$.temperature=J.temperature;let W=X.deferredToolsMode==="kimi"?Nq(Q.messages):new Set,z=Q.tools?.filter((Z)=>!W.has(Z.name));if(z&&z.length>0){if($.tools=Hq(z,X),X.zaiToolStream)$.tool_stream=!0}else if(Fq(Q.messages))$.tools=[];if(F)Tq(j,$.tools,F);if(J?.toolChoice)$.tool_choice=J.toolChoice;if(X.thinkingFormat==="zai"&&q.reasoning){let Z=$;if(Z.thinking=J?.reasoningEffort?{type:"enabled",clear_thinking:!1}:{type:"disabled"},J?.reasoningEffort&&X.supportsReasoningEffort){let S=q.thinkingLevelMap?.[J.reasoningEffort],O=S===void 0?J.reasoningEffort:S;if(typeof O==="string")Z.reasoning_effort=O}}else if(X.thinkingFormat==="qwen"&&q.reasoning)$.enable_thinking=!!J?.reasoningEffort;else if(X.thinkingFormat==="qwen-chat-template"&&q.reasoning)$.chat_template_kwargs={enable_thinking:!!J?.reasoningEffort,preserve_thinking:!0};else if(X.thinkingFormat==="chat-template"&&q.reasoning){let Z=Mq(q,J,X);if(Z)$.chat_template_kwargs=Z}else if(X.thinkingFormat==="deepseek"&&q.reasoning){if(J?.reasoningEffort)$.thinking={type:"enabled"};else if(q.thinkingLevelMap?.off!==null)$.thinking={type:"disabled"};if(J?.reasoningEffort&&X.supportsReasoningEffort)$.reasoning_effort=q.thinkingLevelMap?.[J.reasoningEffort]??J.reasoningEffort}else if(X.thinkingFormat==="openrouter"&&q.reasoning){let Z=$;if(J?.reasoningEffort)Z.reasoning={effort:q.thinkingLevelMap?.[J.reasoningEffort]??J.reasoningEffort};else if(q.thinkingLevelMap?.off!==null)Z.reasoning={effort:q.thinkingLevelMap?.off??"none"}}else if(X.thinkingFormat==="ant-ling"&&q.reasoning&&J?.reasoningEffort){let Z=q.thinkingLevelMap?.[J.reasoningEffort];if(typeof Z==="string")$.reasoning={effort:Z}}else if(X.thinkingFormat==="together"&&q.reasoning){let Z=$;if(Z.reasoning={enabled:!!J?.reasoningEffort},J?.reasoningEffort&&X.supportsReasoningEffort)Z.reasoning_effort=q.thinkingLevelMap?.[J.reasoningEffort]??J.reasoningEffort}else if(X.thinkingFormat==="string-thinking"&&q.reasoning){let Z=$;if(J?.reasoningEffort)Z.thinking=q.thinkingLevelMap?.[J.reasoningEffort]??J.reasoningEffort;else if(q.thinkingLevelMap?.off!==null)Z.thinking=q.thinkingLevelMap?.off??"none"}else if(J?.reasoningEffort&&q.reasoning&&X.supportsReasoningEffort)$.reasoning_effort=q.thinkingLevelMap?.[J.reasoningEffort]??J.reasoningEffort;else if(!J?.reasoningEffort&&q.reasoning&&X.supportsReasoningEffort){let Z=q.thinkingLevelMap?.off;if(typeof Z==="string")$.reasoning_effort=Z}if(q.compat?.openRouterRouting)$.provider=q.compat.openRouterRouting;if(q.compat?.vercelGatewayRouting){let Z=q.compat.vercelGatewayRouting;if(Z.only||Z.order){let S={};if(Z.only)S.only=Z.only;if(Z.order)S.order=Z.order;$.providerOptions={gateway:S}}}return $}function Mq(q,Q,J){let X={};for(let[Y,V]of Object.entries(J.chatTemplateKwargs)){let j=vq(q,Q,V);if(j!==void 0)X[Y]=j}return Object.keys(X).length>0?X:void 0}function vq(q,Q,J){if(typeof J!=="object"||J===null)return J;let X=Q?.reasoningEffort;if(!X&&J.omitWhenOff)return;if(J.$var==="thinking.enabled")return!!X;let Y=X?q.thinkingLevelMap?.[X]:q.thinkingLevelMap?.off;return Y===void 0?X:typeof Y==="string"?Y:void 0}function Rq(q,Q){if(q.cacheControlFormat!=="anthropic"||Q==="none")return;let J=Q==="long"&&q.supportsLongCacheRetention?"1h":void 0;return{type:"ephemeral",...J?{ttl:J}:{}}}function Tq(q,Q,J){fq(q,J),Iq(Q,J),xq(q,J)}function fq(q,Q){for(let J of q)if(J.role==="system"||J.role==="developer"){Cq(J,Q);return}}function xq(q,Q){for(let J=q.length-1;J>=0;J--){let X=q[J];if(X.role==="user"||X.role==="assistant"||X.role==="tool"){if(uq(X,Q))return}}}function Iq(q,Q){if(!q||q.length===0)return;let J=q[q.length-1];J.cache_control=Q}function Cq(q,Q){return zq(q,Q)}function uq(q,Q){if(q.role==="user"||q.role==="assistant"||q.role==="tool")return zq(q,Q);return!1}function zq(q,Q){let J=q.content;if(typeof J==="string"){if(J.length===0)return!1;return q.content=[{type:"text",text:J,cache_control:Q}],!0}if(!Array.isArray(J))return!1;for(let X=J.length-1;X>=0;X--){let Y=J[X];if(Y?.type==="text"){let V=Y;return V.cache_control=Q,!0}}return!1}function hq(q,Q,J,X){let Y=[],V=($)=>{if($.includes("|")){let W=$.indexOf("|"),z=$.slice(0,W).replace(/[^a-zA-Z0-9_-]/g,"_"),Z=$.slice(W+1).replace(/[^a-zA-Z0-9_-]/g,"_"),S=Z.length>0?`${z}_${Z}`:z;if(S.length<=40)return S;let O=a($).slice(0,8);return`${z.slice(0,Math.max(1,40-O.length-1))}_${O}`}if(q.provider==="openai")return $.length>40?$.slice(0,40):$;return $},j=Zq(Q.messages,q,($)=>V($));if(Q.systemPrompt){let W=q.reasoning&&J.supportsDeveloperRole?"developer":"system";Y.push({role:W,content:M(Q.systemPrompt)})}let F=null;for(let $=0;$<j.length;$++){let W=j[$];if(J.requiresAssistantAfterToolResult&&F==="toolResult"&&W.role==="user")Y.push({role:"assistant",content:"I have processed the tool results."});if(W.role==="user")if(typeof W.content==="string")Y.push({role:"user",content:M(W.content)});else{let z=W.content.map((Z)=>{if(Z.type==="text")return{type:"text",text:M(Z.text)};else return{type:"image_url",image_url:{url:`data:${Z.mimeType};base64,${Z.data}`}}});if(z.length===0)continue;Y.push({role:"user",content:z})}else if(W.role==="assistant"){let z={role:"assistant",content:J.requiresAssistantAfterToolResult?"":null},Z=W.content.filter(r).filter((G)=>G.text.trim().length>0).map((G)=>({type:"text",text:M(G.text)})),S=Z.map((G)=>G.text).join(""),O=W.content.filter(Eq).filter((G)=>G.thinking.trim().length>0);if(O.length>0)if(J.requiresThinkingAsText){let G=O.map((N)=>M(N.thinking)).join(`
|
|
4
4
|
|
|
5
5
|
`);z.content=[{type:"text",text:G},...Z]}else{if(S.length>0)z.content=S;let G=O[0].thinkingSignature;if(q.provider==="opencode-go"&&G==="reasoning")G="reasoning_content";if(G&&G.length>0)z[G]=O.map((N)=>N.thinking).join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{B as
|
|
1
|
+
import{Ne as A}from"./chunk-tsym31yb.js";import{Ai as z,_h as v,pi as w}from"./chunk-yfgwknpa.js";var B=(b)=>({queryKey:["projects",b],queryFn:async()=>{let h=await z.api.projects[":projectId"].$get({param:{projectId:b}});if(!h.ok)throw Error("failed to fetch project");return await h.json()}}),H=w("/projects/$projectId/agentsmd")({loader:({context:{queryClient:b},params:{projectId:h}})=>b.ensureQueryData(B(h)),pendingComponent:()=>v(A,{})});
|
|
2
|
+
export{B as me,H as ne};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as x}from"./chunk-zdmcc6ps.js";import"./chunk-s6e91ky2.js";import"./chunk-ch25gq27.js";import{he as f}from"./chunk-90jcmarf.js";import{Ne as c}from"./chunk-tsym31yb.js";import"./chunk-n3vzdzdw.js";import"./chunk-z7b132c0.js";import"./chunk-1ev668rp.js";import"./chunk-mnhg12fm.js";import"./chunk-a80aab0f.js";import"./chunk-0te5kcy3.js";import"./chunk-kmhkhcy6.js";import"./chunk-y8ffp5zj.js";import"./chunk-6w395tfy.js";import"./chunk-rjga1vn2.js";import"./chunk-qk9npww4.js";import"./chunk-y45tzhdn.js";import{Uh as s}from"./chunk-hsemzjvr.js";import{Ai as b,Yh as v,_h as e,di as d,ei as l,qi as p}from"./chunk-yfgwknpa.js";import{Mm as m}from"./chunk-wwjqqqr4.js";var g=m(v(),1);function k(){let{projectId:i,folderId:h}=y.useParams(),{teamId:r,ensureTeamIdForProject:t}=s();g.useEffect(()=>{t(i)},[i,t]);let{data:a}=l(f(i)),o=a?.rootFolder,{data:u}=d({queryKey:["folders",o],queryFn:async()=>{let n=await b.api.folders[":folderId"].$get({param:{folderId:o}});if(!n.ok)throw Error("failed to fetch folder");return await n.json()},enabled:!!o});if(!r||!o||!u)return e(c,{});return e(x,{teamId:r,projectId:i,projectName:a.name??"",assetId:h,rootFolderId:o,isRoot:!1})}var y=p("/projects/$projectId/folders/$folderId_/agentsmd")({component:k});export{y as Route};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
function W(q){if(!(q instanceof Error))return{message:F(q),messageCarriesBody:!1};let w=q,A=I(w),D=K(w),H=D===void 0||q.message.includes(D);return{status:A,body:D,message:q.message,messageCarriesBody:H}}function I(q){if(typeof q.statusCode==="number")return q.statusCode;if(typeof q.status==="number")return q.status;if(typeof q.$metadata?.httpStatusCode==="number")return q.$metadata.httpStatusCode;if(typeof q.$response?.statusCode==="number")return q.$response.statusCode;return}function K(q){let w=P(q);if(w===void 0)return;let A=w.trim();if(A.length===0)return;return V(A,4000)}function P(q){if(typeof q.body==="string")return q.body;if(G(q.error))return F(q.error);let w=q.$response?.body;if(typeof w==="string")return w;if(Q(w))return;if(G(w))return F(w);return}function Q(q){return typeof q==="object"&&q!==null&&"pipe"in q&&typeof q.pipe==="function"}function G(q){return typeof q==="object"&&q!==null&&Object.keys(q).length>0}function X(q,w){if(q.messageCarriesBody||q.status===void 0||q.body===void 0)return w!==void 0&&q.status!==void 0?`${w} (${q.status}): ${q.message}`:q.message;return w!==void 0?`${w} (${q.status}): ${q.body}`:`${q.status}: ${q.body}`}function V(q,w){if(q.length<=w)return q;return`${q.slice(0,w)}... [truncated ${q.length-w} chars]`}function F(q){try{let w=JSON.stringify(q);return w===void 0?String(q):w}catch{return String(q)}}
|
|
3
|
-
export{W as
|
|
3
|
+
export{W as om,X as pm};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Mm as a,Nm as _}from"./chunk-wwjqqqr4.js";var f=_((J)=>{Object.defineProperty(J,"__esModule",{value:!0});J.Allow=J.ALL=J.COLLECTION=J.ATOM=J.SPECIAL=J.INF=J._INFINITY=J.INFINITY=J.NAN=J.BOOL=J.NULL=J.OBJ=J.ARR=J.NUM=J.STR=void 0;J.STR=1;J.NUM=2;J.ARR=4;J.OBJ=8;J.NULL=16;J.BOOL=32;J.NAN=64;J.INFINITY=128;J._INFINITY=256;J.INF=J.INFINITY|J._INFINITY;J.SPECIAL=J.NULL|J.BOOL|J.INF|J.NAN;J.ATOM=J.STR|J.NUM|J.SPECIAL;J.COLLECTION=J.ARR|J.OBJ;J.ALL=J.ATOM|J.COLLECTION;J.Allow={STR:J.STR,NUM:J.NUM,ARR:J.ARR,OBJ:J.OBJ,NULL:J.NULL,BOOL:J.BOOL,NAN:J.NAN,INFINITY:J.INFINITY,_INFINITY:J._INFINITY,INF:J.INF,SPECIAL:J.SPECIAL,ATOM:J.ATOM,COLLECTION:J.COLLECTION,ALL:J.ALL};J.default=J.Allow});var w=_((X)=>{var d=X&&X.__createBinding||(Object.create?function(F,G,H,z){if(z===void 0)z=H;var K=Object.getOwnPropertyDescriptor(G,H);if(!K||("get"in K?!G.__esModule:K.writable||K.configurable))K={enumerable:!0,get:function(){return G[H]}};Object.defineProperty(F,z,K)}:function(F,G,H,z){if(z===void 0)z=H;F[z]=G[H]}),x=X&&X.__exportStar||function(F,G){for(var H in F)if(H!=="default"&&!Object.prototype.hasOwnProperty.call(G,H))d(G,F,H)};Object.defineProperty(X,"__esModule",{value:!0});X.Allow=X.MalformedJSON=X.PartialJSON=X.parseJSON=X.parse=void 0;var Y=f();Object.defineProperty(X,"Allow",{enumerable:!0,get:function(){return Y.Allow}});x(f(),X);class b extends Error{}X.PartialJSON=b;class P extends Error{}X.MalformedJSON=P;function m(F,G=Y.Allow.ALL){if(typeof F!=="string")throw TypeError(`expecting str, got ${typeof F}`);if(!F.trim())throw Error(`${F} is empty`);return p(F.trim(),G)}X.parseJSON=m;var p=(F,G)=>{let H=F.length,z=0,K=(Q)=>{throw new b(`${Q} at position ${z}`)},$=(Q)=>{throw new P(`${Q} at position ${z}`)},U=()=>{if(V(),z>=H)K("Unexpected end of input");if(F[z]==='"')return O();if(F[z]==="{")return c();if(F[z]==="[")return j();if(F.substring(z,z+4)==="null"||Y.Allow.NULL&G&&H-z<4&&"null".startsWith(F.substring(z)))return z+=4,null;if(F.substring(z,z+4)==="true"||Y.Allow.BOOL&G&&H-z<4&&"true".startsWith(F.substring(z)))return z+=4,!0;if(F.substring(z,z+5)==="false"||Y.Allow.BOOL&G&&H-z<5&&"false".startsWith(F.substring(z)))return z+=5,!1;if(F.substring(z,z+8)==="Infinity"||Y.Allow.INFINITY&G&&H-z<8&&"Infinity".startsWith(F.substring(z)))return z+=8,1/0;if(F.substring(z,z+9)==="-Infinity"||Y.Allow._INFINITY&G&&1<H-z&&H-z<9&&"-Infinity".startsWith(F.substring(z)))return z+=9,-1/0;if(F.substring(z,z+3)==="NaN"||Y.Allow.NAN&G&&H-z<3&&"NaN".startsWith(F.substring(z)))return z+=3,NaN;return g()},O=()=>{let Q=z,Z=!1;z++;while(z<H&&(F[z]!=='"'||Z&&F[z-1]==="\\"))Z=F[z]==="\\"?!Z:!1,z++;if(F.charAt(z)=='"')try{return JSON.parse(F.substring(Q,++z-Number(Z)))}catch(q){$(String(q))}else if(Y.Allow.STR&G)try{return JSON.parse(F.substring(Q,z-Number(Z))+'"')}catch(q){return JSON.parse(F.substring(Q,F.lastIndexOf("\\"))+'"')}K("Unterminated string literal")},c=()=>{z++,V();let Q={};try{while(F[z]!=="}"){if(V(),z>=H&&Y.Allow.OBJ&G)return Q;let Z=O();V(),z++;try{let q=U();Q[Z]=q}catch(q){if(Y.Allow.OBJ&G)return Q;else throw q}if(V(),F[z]===",")z++}}catch(Z){if(Y.Allow.OBJ&G)return Q;else K("Expected '}' at end of object")}return z++,Q},j=()=>{z++;let Q=[];try{while(F[z]!=="]")if(Q.push(U()),V(),F[z]===",")z++}catch(Z){if(Y.Allow.ARR&G)return Q;K("Expected ']' at end of array")}return z++,Q},g=()=>{if(z===0){if(F==="-")$("Not sure what '-' is");try{return JSON.parse(F)}catch(Z){if(Y.Allow.NUM&G)try{return JSON.parse(F.substring(0,F.lastIndexOf("e")))}catch(q){}$(String(Z))}}let Q=z;if(F[z]==="-")z++;while(F[z]&&",]}".indexOf(F[z])===-1)z++;if(z==H&&!(Y.Allow.NUM&G))K("Unterminated number literal");try{return JSON.parse(F.substring(Q,z))}catch(Z){if(F.substring(Q,z)==="-")K("Not sure what '-' is");try{return JSON.parse(F.substring(Q,F.lastIndexOf("e")))}catch(q){$(String(q))}}},V=()=>{while(z<H&&`
|
|
3
3
|
\r `.includes(F[z]))z++};return U()},l=m;X.parse=l});var N=a(w(),1),e=new Set(['"',"\\","/","b","f","n","r","t","u"]);function s(F){let G=F.codePointAt(0);return G!==void 0&&G>=0&&G<=31}function t(F){switch(F){case"\b":return"\\b";case"\f":return"\\f";case`
|
|
4
4
|
`:return"\\n";case"\r":return"\\r";case"\t":return"\\t";default:return`\\u${F.codePointAt(0)?.toString(16).padStart(4,"0")??"0000"}`}}function k(F){let G="",H=!1;for(let z=0;z<F.length;z++){let K=F[z];if(!H){if(G+=K,K==='"')H=!0;continue}if(K==='"'){G+=K,H=!1;continue}if(K==="\\"){let $=F[z+1];if($===void 0){G+="\\\\";continue}if($==="u"){let U=F.slice(z+2,z+6);if(/^[0-9a-fA-F]{4}$/.test(U)){G+=`\\u${U}`,z+=5;continue}}if(e.has($)){G+=`\\${$}`,z+=1;continue}G+="\\\\";continue}G+=s(K)?t(K):K}return G}function i(F){try{return JSON.parse(F)}catch(G){let H=k(F);if(H!==F)return JSON.parse(H);throw G}}function n(F){if(!F||F.trim()==="")return{};try{return i(F)}catch{try{return N.parse(F)??{}}catch{try{return N.parse(k(F))??{}}catch{return{}}}}}
|
|
5
|
-
export{i as
|
|
5
|
+
export{i as am,n as bm};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Xf as F}from"./chunk-33hax7fe.js";import{Jk as B,Xk as E,vj as x,wj as z,xl as k,yk as A}from"./chunk-yfgwknpa.js";var J={agent_total_tokens:{label:()=>k.quota_resource_agent_total_tokens(),icon:x,unit:"tokens"},agent_cost:{label:()=>k.quota_resource_agent_cost(),icon:z,unit:"$"},agent_mcp_call_count:{label:()=>k.quota_resource_agent_mcp_call_count(),icon:A,unit:"calls"},agent_bash_call_count:{label:()=>k.quota_resource_agent_bash_call_count(),icon:B,unit:"calls"},agent_tool_call_count:{label:()=>k.quota_resource_agent_tool_call_count(),icon:E,unit:"calls"}};function K(q,w){if(q==="agent_cost")return`$${w.toFixed(2)}`;return w.toLocaleString()}function L(q){switch(F(q)){case"1hour":return k.quota_period_1hour();case"5hour":return k.quota_period_5hour();case"1day":return k.quota_period_1day();case"7day":return k.quota_period_7day();default:return q}}
|
|
2
|
+
export{J as a,K as b,L as c};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$c as Ch,Ac as _,Bc as kk,Cc as h,Dc as dk,Ec as j,Gc as J,Kc as I,Lc as zk,Mc as x,Nc as hk,Oc as Kk,Pc as pW,Qc as y,Rc as dW,Sc as v,Tc as fk,Uc as Xk,Vc as w,Wc as sW,Xc as TW,Yc as Mk,_c as YW,sc as c,tc as V,uc as _k,vc as ek,wc as kW,yc as GW}from"./chunk-jqzvazsf.js";function z(k){return kk(k)&&_(k.toOperationNode)}var Q=h({is(k){return k.kind==="ValueNode"},create(k){return h({kind:"ValueNode",value:k})},createImmediate(k){return h({kind:"ValueNode",value:k,immediate:!0})}});var S=h({is(k){return k.kind==="ColumnNode"},create(k){return h({kind:"ColumnNode",column:J.create(k)})}});var pk=h({is(k){return k.kind==="SelectAllNode"},create(){return h({kind:"SelectAllNode"})}});var Ak=h({is(k){return k.kind==="ReferenceNode"},create(k,W){return h({kind:"ReferenceNode",table:W,column:k})},createSelectAll(k){return h({kind:"ReferenceNode",table:k,column:pk.create()})}});function ok(k){return kk(k)&&"expressionType"in k&&z(k)}function iW(k){return kk(k)&&"expression"in k&&V(k.alias)&&z(k)}var a=h({is(k){return k.kind==="SelectModifierNode"},create(k,W){return h({kind:"SelectModifierNode",modifier:k,of:W})},createWithExpression(k){return h({kind:"SelectModifierNode",rawModifier:k})}});var Yk=h({is(k){return k.kind==="BinaryOperationNode"},create(k,W,$){return h({kind:"BinaryOperationNode",leftOperand:k,operator:W,rightOperand:$})}});var sk=h({is(k){return k.kind==="PrimitiveValueListNode"},create(k){return h({kind:"PrimitiveValueListNode",values:h([...k])})}});var rk=h({is(k){return k.kind==="ValueListNode"},create(k){return h({kind:"ValueListNode",values:h(k)})}});function lW(k){if(j(k))return ih(k);return X(k)}function X(k){if(Wk(k))return p(k);return Q.create(k)}function WW(k){return _k(k)||ek(k)||kW(k)}function Bk(k){if(!WW(k))throw Error(`unsafe immediate value ${JSON.stringify(k)}`);return Q.createImmediate(k)}function ih(k){if(k.some(Wk))return rk.create(k.map((W)=>X(W)));return sk.create(k)}function L(k){if(k.length===3)return hW(k[0],k[1],k[2]);else if(k.length===1)return X(k[0]);throw Error(`invalid arguments: ${JSON.stringify(k)}`)}function hW(k,W,$){if(lh(W)&&oW($))return Yk.create(f(k),PW(W),Q.createImmediate($));return Yk.create(f(k),PW(W),lW($))}function m(k,W,$){return Yk.create(f(k),PW(W),f($))}function UW(k,W){return mk(Object.entries(k).filter(([,$])=>!c($)).map(([$,M])=>hW($,oW(M)?"is":"=",M)),W)}function mk(k,W,$=!0){let M=W==="and"?x.create:hk.create;if(k.length===0)return Yk.create(Q.createImmediate(1),y.create("="),Q.createImmediate(W==="and"?1:0));let G=aW(k[0]);for(let q=1;q<k.length;++q)G=M(G,aW(k[q]));if(k.length>1&&$)return Xk.create(G);return G}function lh(k){return k==="is"||k==="is not"}function oW(k){return kW(k)||ek(k)}function PW(k){if(V(k)&&pW.includes(k))return y.create(k);if(z(k))return k.toOperationNode();throw Error(`invalid operator ${JSON.stringify(k)}`)}function aW(k){return z(k)?k.toOperationNode():k}var $k=h({is(k){return k.kind==="OrderByNode"},create(k){return h({kind:"OrderByNode",items:h([...k])})},cloneWithItems(k,W){return h({...k,items:h([...k.items,...W])})}});var VW=h({is(k){return k.kind==="PartitionByNode"},create(k){return h({kind:"PartitionByNode",items:h(k)})},cloneWithItems(k,W){return h({...k,items:h([...k.items,...W])})}});var xk=h({is(k){return k.kind==="OverNode"},create(){return h({kind:"OverNode"})},cloneWithOrderByItems(k,W){return h({...k,orderBy:k.orderBy?$k.cloneWithItems(k.orderBy,W):$k.create(W)})},cloneWithPartitionByItems(k,W){return h({...k,partitionBy:k.partitionBy?VW.cloneWithItems(k.partitionBy,W):VW.create(W)})}});var Vk=h({is(k){return k.kind==="FromNode"},create(k){return h({kind:"FromNode",froms:h(k)})},cloneWithFroms(k,W){return h({...k,froms:h([...k.froms,...W])})}});var wW=h({is(k){return k.kind==="GroupByNode"},create(k){return h({kind:"GroupByNode",items:h(k)})},cloneWithItems(k,W){return h({...k,items:h([...k.items,...W])})}});var FW=h({is(k){return k.kind==="HavingNode"},create(k){return h({kind:"HavingNode",having:k})},cloneWithOperation(k,W,$){return h({...k,having:W==="And"?x.create(k.having,$):hk.create(k.having,$)})}});var o=h({is(k){return k.kind==="UpdateQueryNode"},create(k,W){return h({kind:"UpdateQueryNode",table:k.length===1?k[0]:sW.create(k),...W&&{with:W}})},createWithoutTable(){return h({kind:"UpdateQueryNode"})},cloneWithFromItems(k,W){return h({...k,from:k.from?Vk.cloneWithFroms(k.from,W):Vk.create(W)})},cloneWithUpdates(k,W){return h({...k,updates:k.updates?h([...k.updates,...W]):W})},cloneWithLimit(k,W){return h({...k,limit:W})}});var Dk=h({is(k){return k.kind==="DeleteQueryNode"},create(k,W){return h({kind:"DeleteQueryNode",from:Vk.create(k),...W&&{with:W}})},cloneWithOrderByItems:(k,W)=>K.cloneWithOrderByItems(k,W),cloneWithoutOrderBy:(k)=>K.cloneWithoutOrderBy(k),cloneWithLimit(k,W){return h({...k,limit:W})},cloneWithoutLimit(k){return h({...k,limit:void 0})},cloneWithUsing(k,W){return h({...k,using:k.using!==void 0?TW.cloneWithTables(k.using,W):TW.create(W)})}});var C=h({is(k){return k.kind==="WhereNode"},create(k){return h({kind:"WhereNode",where:k})},cloneWithOperation(k,W,$){return h({...k,where:W==="And"?x.create(k.where,$):hk.create(k.where,$)})}});var vW=h({is(k){return k.kind==="ReturningNode"},create(k){return h({kind:"ReturningNode",selections:h(k)})},cloneWithSelections(k,W){return h({...k,selections:k.selections?h([...k.selections,...W]):h(W)})}});var rW=h({is(k){return k.kind==="ExplainNode"},create(k,W){return h({kind:"ExplainNode",format:k,options:W})}});var N=h({is(k){return k.kind==="MergeQueryNode"},create(k,W){return h({kind:"MergeQueryNode",into:k,...W&&{with:W}})},cloneWithUsing(k,W){return h({...k,using:W})},cloneWithWhen(k,W){return h({...k,whens:k.whens?h([...k.whens,W]):h([W])})},cloneWithThen(k,W){return h({...k,whens:k.whens?h([...k.whens.slice(0,-1),Mk.cloneWithResult(k.whens[k.whens.length-1],W)]):void 0})}});var AW=h({is(k){return k.kind==="OutputNode"},create(k){return h({kind:"OutputNode",selections:h(k)})},cloneWithSelections(k,W){return h({...k,selections:k.selections?h([...k.selections,...W]):h(W)})}});var K=h({is(k){return Y.is(k)||w.is(k)||o.is(k)||Dk.is(k)||N.is(k)},cloneWithEndModifier(k,W){return h({...k,endModifiers:k.endModifiers?h([...k.endModifiers,W]):h([W])})},cloneWithWhere(k,W){return h({...k,where:k.where?C.cloneWithOperation(k.where,"And",W):C.create(W)})},cloneWithJoin(k,W){return h({...k,joins:k.joins?h([...k.joins,W]):h([W])})},cloneWithReturning(k,W){return h({...k,returning:k.returning?vW.cloneWithSelections(k.returning,W):vW.create(W)})},cloneWithoutReturning(k){return h({...k,returning:void 0})},cloneWithoutWhere(k){return h({...k,where:void 0})},cloneWithExplain(k,W,$){return h({...k,explain:rW.create(W,$?.toOperationNode())})},cloneWithTop(k,W){return h({...k,top:W})},cloneWithOutput(k,W){return h({...k,output:k.output?AW.cloneWithSelections(k.output,W):AW.create(W)})},cloneWithOrderByItems(k,W){return h({...k,orderBy:k.orderBy?$k.cloneWithItems(k.orderBy,W):$k.create(W)})},cloneWithoutOrderBy(k){return h({...k,orderBy:void 0})}});var Y=h({is(k){return k.kind==="SelectQueryNode"},create(k){return h({kind:"SelectQueryNode",...k&&{with:k}})},createFrom(k,W){return h({kind:"SelectQueryNode",from:Vk.create(k),...W&&{with:W}})},cloneWithSelections(k,W){return h({...k,selections:k.selections?h([...k.selections,...W]):h(W)})},cloneWithDistinctOn(k,W){return h({...k,distinctOn:k.distinctOn?h([...k.distinctOn,...W]):h(W)})},cloneWithFrontModifier(k,W){return h({...k,frontModifiers:k.frontModifiers?h([...k.frontModifiers,W]):h([W])})},cloneWithOrderByItems:(k,W)=>K.cloneWithOrderByItems(k,W),cloneWithGroupByItems(k,W){return h({...k,groupBy:k.groupBy?wW.cloneWithItems(k.groupBy,W):wW.create(W)})},cloneWithLimit(k,W){return h({...k,limit:W})},cloneWithOffset(k,W){return h({...k,offset:W})},cloneWithFetch(k,W){return h({...k,fetch:W})},cloneWithHaving(k,W){return h({...k,having:k.having?FW.cloneWithOperation(k.having,"And",W):FW.create(W)})},cloneWithSetOperations(k,W){return h({...k,setOperations:k.setOperations?h([...k.setOperations,...W]):h([...W])})},cloneWithoutSelections(k){return h({...k,selections:[]})},cloneWithoutLimit(k){return h({...k,limit:void 0})},cloneWithoutOffset(k){return h({...k,offset:void 0})},cloneWithoutOrderBy:(k)=>K.cloneWithoutOrderBy(k),cloneWithoutGroupBy(k){return h({...k,groupBy:void 0})}});class Rk{#k;constructor(k){this.#k=h(k)}on(...k){return new Rk({...this.#k,joinNode:Kk.cloneWithOn(this.#k.joinNode,L(k))})}onRef(k,W,$){return new Rk({...this.#k,joinNode:Kk.cloneWithOn(this.#k.joinNode,m(k,W,$))})}onTrue(){return new Rk({...this.#k,joinNode:Kk.cloneWithOn(this.#k.joinNode,v.createWithSql("true"))})}$call(k){return k(this)}toOperationNode(){return this.#k.joinNode}}class ah{#k;get dynamicReference(){return this.#k}get refType(){return}constructor(k){this.#k=k}toOperationNode(){return _W(this.#k)}}function $W(k){return kk(k)&&z(k)&&V(k.dynamicReference)}var g=h({is(k){return k.kind==="OrderByItemNode"},create(k,W){return h({kind:"OrderByItemNode",orderBy:k,direction:W})},cloneWith(k,W){return h({...k,...W})}});var eW=h({is(k){return k.kind==="CollateNode"},create(k){return h({kind:"CollateNode",collation:J.create(k)})}});class Lk{#k;constructor(k){this.#k=h(k)}desc(){return new Lk({node:g.cloneWith(this.#k.node,{direction:v.createWithSql("desc")})})}asc(){return new Lk({node:g.cloneWith(this.#k.node,{direction:v.createWithSql("asc")})})}nullsLast(){return new Lk({node:g.cloneWith(this.#k.node,{nulls:"last"})})}nullsFirst(){return new Lk({node:g.cloneWith(this.#k.node,{nulls:"first"})})}collate(k){return new Lk({node:g.cloneWith(this.#k.node,{collation:eW.create(k)})})}toOperationNode(){return this.#k.node}}function RW(k){return k==="asc"||k==="desc"}function B(k){if(k.length===2)return[mW(k[0],k[1])];if(k.length===1){let[W]=k;if(Array.isArray(W))return fk("orderBy(array) is deprecated, use multiple orderBy calls instead."),W.map(($)=>mW($));return[mW(W)]}throw Error(`Invalid number of arguments at order by! expected 1-2, received ${k.length}`)}function mW(k,W){let $=ph(k);if(g.is($)){if(W)throw Error("Cannot specify direction twice!");return $}return kh($,W)}function ph(k){if(Wk(k))return p(k);if($W(k))return k.toOperationNode();let[W,$]=k.split(" ");if($)return fk("`orderBy('column asc')` is deprecated. Use `orderBy('column', 'asc')` instead."),kh(t(W),$);return t(k)}function kh(k,W){if(typeof W==="string"){if(!RW(W))throw Error(`Invalid order by direction: ${W}`);return g.create(k,v.createWithSql(W))}if(ok(W))return fk("`orderBy(..., expr)` is deprecated. Use `orderBy(..., 'asc')` or `orderBy(..., (ob) => ...)` instead."),g.create(k,W.toOperationNode());let $=g.create(k);if(!W)return $;return W(new Lk({node:$})).toOperationNode()}var Wh=h({is(k){return k.kind==="PartitionByItemNode"},create(k){return h({kind:"PartitionByItemNode",partitionBy:k})}});function hh(k){return Gk(k).map(Wh.create)}class Ck{#k;constructor(k){this.#k=h(k)}orderBy(...k){return new Ck({overNode:xk.cloneWithOrderByItems(this.#k.overNode,B(k))})}clearOrderBy(){return new Ck({overNode:K.cloneWithoutOrderBy(this.#k.overNode)})}partitionBy(k){return new Ck({overNode:xk.cloneWithPartitionByItems(this.#k.overNode,hh(k))})}$call(k){return k(this)}toOperationNode(){return this.#k.overNode}}var Sk=h({is(k){return k.kind==="SelectionNode"},create(k){return h({kind:"SelectionNode",selection:k})},createSelectAll(){return h({kind:"SelectionNode",selection:pk.create()})},createSelectAllFromTable(k){return h({kind:"SelectionNode",selection:Ak.createSelectAll(k)})}});class oh{#k;get table(){return this.#k}constructor(k){this.#k=k}as(k){return new $h(this.#k,k)}}class $h{#k;#W;get table(){return this.#k}get alias(){return this.#W}constructor(k,W){this.#k=k,this.#W=W}toOperationNode(){return I.create(F(this.#k),J.create(this.#W))}}function Mh(k){return kk(k)&&z(k)&&V(k.table)&&V(k.alias)}function n(k){if(j(k))return k.map((W)=>wk(W));else return[wk(k)]}function wk(k){if(V(k))return fW(k);else if(Mh(k))return k.toOperationNode();else return MW(k)}function fW(k){if(k.includes(" as ")){let[$,M]=k.split(" as ").map(Kh);return I.create(F($),J.create(M))}else return F(k)}function F(k){if(k.includes(".")){let[$,M]=k.split(".").map(Kh);return zk.createWithSchema($,M)}else return zk.create(k)}function Kh(k){return k.trim()}function A(k){if(_(k))return A(k(d()));else if(j(k))return k.map((W)=>Gh(W));else return[Gh(k)]}function Gh(k){if(V(k))return Sk.create(Zh(k));else if($W(k))return Sk.create(k.toOperationNode());else return Sk.create(MW(k))}function R(k){if(!k)return[Sk.createSelectAll()];else if(Array.isArray(k))return k.map(Hh);else return[Hh(k)]}function Hh(k){if(V(k))return Sk.createSelectAllFromTable(F(k));throw Error(`invalid value selectAll expression: ${JSON.stringify(k)}`)}var Yh=h({is(k){return k.kind==="ValuesNode"},create(k){return h({kind:"ValuesNode",values:h(k)})}});var Xh=h({is(k){return k.kind==="DefaultInsertValueNode"},create(){return h({kind:"DefaultInsertValueNode"})}});function KW(k){let W=_(k)?k(d()):k,$=j(W)?W:h([W]);return sh($)}function sh(k){let W=rh(k);return[h([...W.keys()].map(S.create)),Yh.create(k.map(($)=>eh($,W)))]}function rh(k){let W=new Map;for(let $ of k){let M=Object.keys($);for(let G of M)if(!W.has(G)&&$[G]!==void 0)W.set(G,W.size)}return W}function eh(k,W){let $=Object.keys(k),M=Array.from({length:W.size}),G=!1,q=$.length;for(let ak of $){let Nk=W.get(ak);if(c(Nk)){q--;continue}let qW=k[ak];if(c(qW)||Wk(qW))G=!0;M[Nk]=qW}if(q<W.size||G){let ak=Xh.create();return rk.create(M.map((Nk)=>c(Nk)?ak:X(Nk)))}return sk.create(M)}var CW=h({is(k){return k.kind==="ColumnUpdateNode"},create(k,W){return h({kind:"ColumnUpdateNode",column:k,value:W})}});function Dh(...k){if(k.length===2)return[CW.create(f(k[0]),X(k[1]))];return ck(k[0])}function ck(k){let W=_(k)?k(d()):k;return Object.entries(W).filter(([$,M])=>M!==void 0).map(([$,M])=>{return CW.create(S.create($),X(M))})}var Lh=h({is(k){return k.kind==="OnDuplicateKeyNode"},create(k){return h({kind:"OnDuplicateKeyNode",updates:k})}});class SW{insertId;numInsertedOrUpdatedRows;constructor(k,W){this.insertId=k,this.numInsertedOrUpdatedRows=W}}class u extends Error{node;constructor(k){super("no result");this.node=k}}function s(k){return Object.prototype.hasOwnProperty.call(k,"prototype")}var E=h({is(k){return k.kind==="OnConflictNode"},create(){return h({kind:"OnConflictNode"})},cloneWith(k,W){return h({...k,...W})},cloneWithIndexWhere(k,W){return h({...k,indexWhere:k.indexWhere?C.cloneWithOperation(k.indexWhere,"And",W):C.create(W)})},cloneWithIndexOrWhere(k,W){return h({...k,indexWhere:k.indexWhere?C.cloneWithOperation(k.indexWhere,"Or",W):C.create(W)})},cloneWithUpdateWhere(k,W){return h({...k,updateWhere:k.updateWhere?C.cloneWithOperation(k.updateWhere,"And",W):C.create(W)})},cloneWithUpdateOrWhere(k,W){return h({...k,updateWhere:k.updateWhere?C.cloneWithOperation(k.updateWhere,"Or",W):C.create(W)})},cloneWithoutIndexWhere(k){return h({...k,indexWhere:void 0})},cloneWithoutUpdateWhere(k){return h({...k,updateWhere:void 0})}});class r{#k;constructor(k){this.#k=h(k)}column(k){let W=S.create(k);return new r({...this.#k,onConflictNode:E.cloneWith(this.#k.onConflictNode,{columns:this.#k.onConflictNode.columns?h([...this.#k.onConflictNode.columns,W]):h([W])})})}columns(k){let W=k.map(S.create);return new r({...this.#k,onConflictNode:E.cloneWith(this.#k.onConflictNode,{columns:this.#k.onConflictNode.columns?h([...this.#k.onConflictNode.columns,...W]):h(W)})})}constraint(k){return new r({...this.#k,onConflictNode:E.cloneWith(this.#k.onConflictNode,{constraint:J.create(k)})})}expression(k){return new r({...this.#k,onConflictNode:E.cloneWith(this.#k.onConflictNode,{indexExpression:k.toOperationNode()})})}where(...k){return new r({...this.#k,onConflictNode:E.cloneWithIndexWhere(this.#k.onConflictNode,L(k))})}whereRef(k,W,$){return new r({...this.#k,onConflictNode:E.cloneWithIndexWhere(this.#k.onConflictNode,m(k,W,$))})}clearWhere(){return new r({...this.#k,onConflictNode:E.cloneWithoutIndexWhere(this.#k.onConflictNode)})}doNothing(){return new zh({...this.#k,onConflictNode:E.cloneWith(this.#k.onConflictNode,{doNothing:!0})})}doUpdateSet(k){return new yk({...this.#k,onConflictNode:E.cloneWith(this.#k.onConflictNode,{updates:ck(k)})})}$call(k){return k(this)}}class zh{#k;constructor(k){this.#k=h(k)}toOperationNode(){return this.#k.onConflictNode}}class yk{#k;constructor(k){this.#k=h(k)}where(...k){return new yk({...this.#k,onConflictNode:E.cloneWithUpdateWhere(this.#k.onConflictNode,L(k))})}whereRef(k,W,$){return new yk({...this.#k,onConflictNode:E.cloneWithUpdateWhere(this.#k.onConflictNode,m(k,W,$))})}clearWhere(){return new yk({...this.#k,onConflictNode:E.cloneWithoutUpdateWhere(this.#k.onConflictNode)})}$call(k){return k(this)}toOperationNode(){return this.#k.onConflictNode}}var Jh=h({is(k){return k.kind==="TopNode"},create(k,W){return h({kind:"TopNode",expression:k,modifiers:W})}});function i(k,W){if(!_k(k)&&!GW(k))throw Error(`Invalid top expression: ${k}`);if(!c(W)&&!k$(W))throw Error(`Invalid top modifiers: ${W}`);return Jh.create(k,W)}function k$(k){return k==="percent"||k==="with ties"||k==="percent with ties"}var Fk=h({is(k){return k.kind==="OrActionNode"},create(k){return h({kind:"OrActionNode",action:k})}});class D{#k;constructor(k){this.#k=h(k)}values(k){let[W,$]=KW(k);return new D({...this.#k,queryNode:w.cloneWith(this.#k.queryNode,{columns:W,values:$})})}columns(k){return new D({...this.#k,queryNode:w.cloneWith(this.#k.queryNode,{columns:h(k.map(S.create))})})}expression(k){return new D({...this.#k,queryNode:w.cloneWith(this.#k.queryNode,{values:p(k)})})}defaultValues(){return new D({...this.#k,queryNode:w.cloneWith(this.#k.queryNode,{defaultValues:!0})})}modifyEnd(k){return new D({...this.#k,queryNode:K.cloneWithEndModifier(this.#k.queryNode,k.toOperationNode())})}ignore(){return new D({...this.#k,queryNode:w.cloneWith(this.#k.queryNode,{orAction:Fk.create("ignore")})})}orIgnore(){return new D({...this.#k,queryNode:w.cloneWith(this.#k.queryNode,{orAction:Fk.create("ignore")})})}orAbort(){return new D({...this.#k,queryNode:w.cloneWith(this.#k.queryNode,{orAction:Fk.create("abort")})})}orFail(){return new D({...this.#k,queryNode:w.cloneWith(this.#k.queryNode,{orAction:Fk.create("fail")})})}orReplace(){return new D({...this.#k,queryNode:w.cloneWith(this.#k.queryNode,{orAction:Fk.create("replace")})})}orRollback(){return new D({...this.#k,queryNode:w.cloneWith(this.#k.queryNode,{orAction:Fk.create("rollback")})})}top(k,W){return new D({...this.#k,queryNode:K.cloneWithTop(this.#k.queryNode,i(k,W))})}onConflict(k){return new D({...this.#k,queryNode:w.cloneWith(this.#k.queryNode,{onConflict:k(new r({onConflictNode:E.create()})).toOperationNode()})})}onDuplicateKeyUpdate(k){return new D({...this.#k,queryNode:w.cloneWith(this.#k.queryNode,{onDuplicateKey:Lh.create(ck(k))})})}returning(k){return new D({...this.#k,queryNode:K.cloneWithReturning(this.#k.queryNode,A(k))})}returningAll(){return new D({...this.#k,queryNode:K.cloneWithReturning(this.#k.queryNode,R())})}output(k){return new D({...this.#k,queryNode:K.cloneWithOutput(this.#k.queryNode,A(k))})}outputAll(k){return new D({...this.#k,queryNode:K.cloneWithOutput(this.#k.queryNode,R(k))})}clearReturning(){return new D({...this.#k,queryNode:K.cloneWithoutReturning(this.#k.queryNode)})}$call(k){return k(this)}$if(k,W){if(k)return W(this);return new D({...this.#k})}$castTo(){return new D(this.#k)}$narrowType(){return new D(this.#k)}$assertType(){return new D(this.#k)}withPlugin(k){return new D({...this.#k,executor:this.#k.executor.withPlugin(k)})}toOperationNode(){return this.#k.executor.transformQuery(this.#k.queryNode,this.#k.queryId)}compile(){return this.#k.executor.compileQuery(this.toOperationNode(),this.#k.queryId)}async execute(){let k=this.compile(),W=await this.#k.executor.executeQuery(k),{adapter:$}=this.#k.executor,M=k.query;if(M.returning&&$.supportsReturning||M.output&&$.supportsOutput)return W.rows;return[new SW(W.insertId,W.numAffectedRows??BigInt(0))]}async executeTakeFirst(){let[k]=await this.execute();return k}async executeTakeFirstOrThrow(k=u){let W=await this.executeTakeFirst();if(W===void 0)throw s(k)?new k(this.toOperationNode()):k(this.toOperationNode());return W}async*stream(k=100){let W=this.compile(),$=this.#k.executor.stream(W,k);for await(let M of $)yield*M.rows}async explain(k,W){return await new D({...this.#k,queryNode:K.cloneWithExplain(this.#k.queryNode,k,W)}).execute()}}class IW{numDeletedRows;constructor(k){this.numDeletedRows=k}}var Ik=h({is(k){return k.kind==="LimitNode"},create(k){return h({kind:"LimitNode",limit:k})}});var P;class HW{#k;constructor(k){this.#k=h(k)}where(...k){return new P({...this.#k,queryNode:K.cloneWithWhere(this.#k.queryNode,L(k))})}whereRef(k,W,$){return new P({...this.#k,queryNode:K.cloneWithWhere(this.#k.queryNode,m(k,W,$))})}clearWhere(){return new P({...this.#k,queryNode:K.cloneWithoutWhere(this.#k.queryNode)})}top(k,W){return new P({...this.#k,queryNode:K.cloneWithTop(this.#k.queryNode,i(k,W))})}using(k){return new P({...this.#k,queryNode:Dk.cloneWithUsing(this.#k.queryNode,n(k))})}innerJoin(...k){return this.#W("InnerJoin",k)}leftJoin(...k){return this.#W("LeftJoin",k)}rightJoin(...k){return this.#W("RightJoin",k)}fullJoin(...k){return this.#W("FullJoin",k)}#W(k,W){return new P({...this.#k,queryNode:K.cloneWithJoin(this.#k.queryNode,Jk(k,W))})}returning(k){return new P({...this.#k,queryNode:K.cloneWithReturning(this.#k.queryNode,A(k))})}returningAll(k){return new P({...this.#k,queryNode:K.cloneWithReturning(this.#k.queryNode,R(k))})}output(k){return new P({...this.#k,queryNode:K.cloneWithOutput(this.#k.queryNode,A(k))})}outputAll(k){return new P({...this.#k,queryNode:K.cloneWithOutput(this.#k.queryNode,R(k))})}clearReturning(){return new P({...this.#k,queryNode:K.cloneWithoutReturning(this.#k.queryNode)})}clearLimit(){return new P({...this.#k,queryNode:Dk.cloneWithoutLimit(this.#k.queryNode)})}orderBy(...k){return new P({...this.#k,queryNode:K.cloneWithOrderByItems(this.#k.queryNode,B(k))})}clearOrderBy(){return new P({...this.#k,queryNode:K.cloneWithoutOrderBy(this.#k.queryNode)})}limit(k){return new P({...this.#k,queryNode:Dk.cloneWithLimit(this.#k.queryNode,Ik.create(X(k)))})}modifyEnd(k){return new P({...this.#k,queryNode:K.cloneWithEndModifier(this.#k.queryNode,k.toOperationNode())})}$call(k){return k(this)}$if(k,W){if(k)return W(this);return new P({...this.#k})}$castTo(){return new P(this.#k)}$narrowType(){return new P(this.#k)}$assertType(){return new P(this.#k)}withPlugin(k){return new P({...this.#k,executor:this.#k.executor.withPlugin(k)})}toOperationNode(){return this.#k.executor.transformQuery(this.#k.queryNode,this.#k.queryId)}compile(){return this.#k.executor.compileQuery(this.toOperationNode(),this.#k.queryId)}async execute(){let k=this.compile(),W=await this.#k.executor.executeQuery(k),{adapter:$}=this.#k.executor,M=k.query;if(M.returning&&$.supportsReturning||M.output&&$.supportsOutput)return W.rows;return[new IW(W.numAffectedRows??BigInt(0))]}async executeTakeFirst(){let[k]=await this.execute();return k}async executeTakeFirstOrThrow(k=u){let W=await this.executeTakeFirst();if(W===void 0)throw s(k)?new k(this.toOperationNode()):k(this.toOperationNode());return W}async*stream(k=100){let W=this.compile(),$=this.#k.executor.stream(W,k);for await(let M of $)yield*M.rows}async explain(k,W){return await new P({...this.#k,queryNode:K.cloneWithExplain(this.#k.queryNode,k,W)}).execute()}}P=HW;class jW{numUpdatedRows;numChangedRows;constructor(k,W){this.numUpdatedRows=k,this.numChangedRows=W}}var U;class jk{#k;constructor(k){this.#k=h(k)}where(...k){return new U({...this.#k,queryNode:K.cloneWithWhere(this.#k.queryNode,L(k))})}whereRef(k,W,$){return new U({...this.#k,queryNode:K.cloneWithWhere(this.#k.queryNode,m(k,W,$))})}clearWhere(){return new U({...this.#k,queryNode:K.cloneWithoutWhere(this.#k.queryNode)})}top(k,W){return new U({...this.#k,queryNode:K.cloneWithTop(this.#k.queryNode,i(k,W))})}from(k){return new U({...this.#k,queryNode:o.cloneWithFromItems(this.#k.queryNode,n(k))})}innerJoin(...k){return this.#W("InnerJoin",k)}leftJoin(...k){return this.#W("LeftJoin",k)}rightJoin(...k){return this.#W("RightJoin",k)}fullJoin(...k){return this.#W("FullJoin",k)}#W(k,W){return new U({...this.#k,queryNode:K.cloneWithJoin(this.#k.queryNode,Jk(k,W))})}orderBy(...k){return new U({...this.#k,queryNode:K.cloneWithOrderByItems(this.#k.queryNode,B(k))})}clearOrderBy(){return new U({...this.#k,queryNode:K.cloneWithoutOrderBy(this.#k.queryNode)})}limit(k){return new U({...this.#k,queryNode:o.cloneWithLimit(this.#k.queryNode,Ik.create(X(k)))})}set(...k){return new U({...this.#k,queryNode:o.cloneWithUpdates(this.#k.queryNode,Dh(...k))})}returning(k){return new U({...this.#k,queryNode:K.cloneWithReturning(this.#k.queryNode,A(k))})}returningAll(k){return new U({...this.#k,queryNode:K.cloneWithReturning(this.#k.queryNode,R(k))})}output(k){return new U({...this.#k,queryNode:K.cloneWithOutput(this.#k.queryNode,A(k))})}outputAll(k){return new U({...this.#k,queryNode:K.cloneWithOutput(this.#k.queryNode,R(k))})}modifyEnd(k){return new U({...this.#k,queryNode:K.cloneWithEndModifier(this.#k.queryNode,k.toOperationNode())})}clearReturning(){return new U({...this.#k,queryNode:K.cloneWithoutReturning(this.#k.queryNode)})}$call(k){return k(this)}$if(k,W){if(k)return W(this);return new U({...this.#k})}$castTo(){return new U(this.#k)}$narrowType(){return new U(this.#k)}$assertType(){return new U(this.#k)}withPlugin(k){return new U({...this.#k,executor:this.#k.executor.withPlugin(k)})}toOperationNode(){return this.#k.executor.transformQuery(this.#k.queryNode,this.#k.queryId)}compile(){return this.#k.executor.compileQuery(this.toOperationNode(),this.#k.queryId)}async execute(){let k=this.compile(),W=await this.#k.executor.executeQuery(k),{adapter:$}=this.#k.executor,M=k.query;if(M.returning&&$.supportsReturning||M.output&&$.supportsOutput)return W.rows;return[new jW(W.numAffectedRows??BigInt(0),W.numChangedRows)]}async executeTakeFirst(){let[k]=await this.execute();return k}async executeTakeFirstOrThrow(k=u){let W=await this.executeTakeFirst();if(W===void 0)throw s(k)?new k(this.toOperationNode()):k(this.toOperationNode());return W}async*stream(k=100){let W=this.compile(),$=this.#k.executor.stream(W,k);for await(let M of $)yield*M.rows}async explain(k,W){return await new U({...this.#k,queryNode:K.cloneWithExplain(this.#k.queryNode,k,W)}).execute()}}U=jk;var EW=h({is(k){return k.kind==="CommonTableExpressionNameNode"},create(k,W){return h({kind:"CommonTableExpressionNameNode",table:zk.create(k),columns:W?h(W.map(S.create)):void 0})}});var Ek=h({is(k){return k.kind==="CommonTableExpressionNode"},create(k,W){return h({kind:"CommonTableExpressionNode",name:k,expression:W})},cloneWith(k,W){return h({...k,...W})}});class gk{#k;constructor(k){this.#k=h(k)}materialized(){return new gk({...this.#k,node:Ek.cloneWith(this.#k.node,{materialized:!0})})}notMaterialized(){return new gk({...this.#k,node:Ek.cloneWith(this.#k.node,{materialized:!1})})}toOperationNode(){return this.#k.node}}function OW(k,W){let $=W(Ph()).toOperationNode();if(_(k))return k(W$($)).toOperationNode();return Ek.create(qh(k),$)}function W$(k){return(W)=>{return new gk({node:Ek.create(qh(W),k)})}}function qh(k){if(k.includes("(")){let W=k.split(/[\(\)]/),$=W[0],M=W[1].split(",").map((G)=>G.trim());return EW.create($,M)}else return EW.create(k)}var tk=h({is(k){return k.kind==="WithNode"},create(k,W){return h({kind:"WithNode",expressions:h([k]),...W})},cloneWithExpression(k,W){return h({...k,expressions:h([...k.expressions,W])})}});var Uh=["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 Vh(k){let W="";for(let $=0;$<k;++$)W+=h$();return W}function h$(){return Uh[~~(Math.random()*Uh.length)]}function T(){return new wh}class wh{#k;get queryId(){if(this.#k===void 0)this.#k=Vh(8);return this.#k}}var Fh=h({is(k){return k.kind==="MatchedNode"},create(k,W=!1){return h({kind:"MatchedNode",not:k,bySource:W})}});function bW(k,W,$){return Mk.create(mk([Fh.create(!k.isMatched,k.bySource),...W&&W.length>0?[W.length===3&&$?m(W[0],W[1],W[2]):L(W)]:[]],"and",!1))}function Ok(k){if(V(k))return v.create([k],[]);if(z(k))return k.toOperationNode();return k}class ZW{#k;#W;#h;constructor(){this.#k=new Promise((k,W)=>{this.#h=W,this.#W=k})}get promise(){return this.#k}resolve=(k)=>{if(this.#W)this.#W(k)};reject=(k)=>{if(this.#h)this.#h(k)}}async function Th(k){let W=new ZW,$=new ZW;return k.provideConnection(async(M)=>{return W.resolve(M),await $.promise}).catch((M)=>W.reject(M)),h({connection:await W.promise,release:$.resolve})}var $$=h([]);class QW{#k;constructor(k=$$){this.#k=k}get plugins(){return this.#k}transformQuery(k,W){for(let $ of this.#k){let M=$.transformQuery({node:k,queryId:W});if(M.kind===k.kind)k=M;else throw Error(["KyselyPlugin.transformQuery must return a node","of the same kind that was given to it.",`The plugin was given a ${k.kind}`,`but it returned a ${M.kind}`].join(" "))}return k}async executeQuery(k){return await this.provideConnection(async(W)=>{let $=await W.executeQuery(k);if("numUpdatedOrDeletedRows"in $)fk("kysely:warning: outdated driver/plugin detected! `QueryResult.numUpdatedOrDeletedRows` has been replaced with `QueryResult.numAffectedRows`.");return await this.#W($,k.queryId)})}async*stream(k,W){let{connection:$,release:M}=await Th(this);try{for await(let G of $.streamQuery(k,W))yield await this.#W(G,k.queryId)}finally{M()}}async#W(k,W){for(let $ of this.#k)k=await $.transformResult({result:k,queryId:W});return k}}class bk extends QW{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(k){return new bk([...this.plugins,k])}withPlugins(k){return new bk([...this.plugins,...k])}withPluginAtFront(k){return new bk([k,...this.plugins])}withoutPlugins(){return new bk([])}}var qk=new bk;class NW{numChangedRows;constructor(k){this.numChangedRows=k}}class Hk{#k;constructor(k){this.#k=h(k)}modifyEnd(k){return new Hk({...this.#k,queryNode:K.cloneWithEndModifier(this.#k.queryNode,k.toOperationNode())})}top(k,W){return new Hk({...this.#k,queryNode:K.cloneWithTop(this.#k.queryNode,i(k,W))})}using(...k){return new O({...this.#k,queryNode:N.cloneWithUsing(this.#k.queryNode,Jk("Using",k))})}returning(k){return new Hk({...this.#k,queryNode:K.cloneWithReturning(this.#k.queryNode,A(k))})}returningAll(k){return new Hk({...this.#k,queryNode:K.cloneWithReturning(this.#k.queryNode,R(k))})}output(k){return new Hk({...this.#k,queryNode:K.cloneWithOutput(this.#k.queryNode,A(k))})}outputAll(k){return new Hk({...this.#k,queryNode:K.cloneWithOutput(this.#k.queryNode,R(k))})}}class O{#k;constructor(k){this.#k=h(k)}modifyEnd(k){return new O({...this.#k,queryNode:K.cloneWithEndModifier(this.#k.queryNode,k.toOperationNode())})}top(k,W){return new O({...this.#k,queryNode:K.cloneWithTop(this.#k.queryNode,i(k,W))})}whenMatched(){return this.#W([])}whenMatchedAnd(...k){return this.#W(k)}whenMatchedAndRef(k,W,$){return this.#W([k,W,$],!0)}#W(k,W){return new BW({...this.#k,queryNode:N.cloneWithWhen(this.#k.queryNode,bW({isMatched:!0},k,W))})}whenNotMatched(){return this.#h([])}whenNotMatchedAnd(...k){return this.#h(k)}whenNotMatchedAndRef(k,W,$){return this.#h([k,W,$],!0)}whenNotMatchedBySource(){return this.#h([],!1,!0)}whenNotMatchedBySourceAnd(...k){return this.#h(k,!1,!0)}whenNotMatchedBySourceAndRef(k,W,$){return this.#h([k,W,$],!0,!0)}returning(k){return new O({...this.#k,queryNode:K.cloneWithReturning(this.#k.queryNode,A(k))})}returningAll(k){return new O({...this.#k,queryNode:K.cloneWithReturning(this.#k.queryNode,R(k))})}output(k){return new O({...this.#k,queryNode:K.cloneWithOutput(this.#k.queryNode,A(k))})}outputAll(k){return new O({...this.#k,queryNode:K.cloneWithOutput(this.#k.queryNode,R(k))})}#h(k,W=!1,$=!1){let M={...this.#k,queryNode:N.cloneWithWhen(this.#k.queryNode,bW({isMatched:!1,bySource:$},k,W))};return new($?BW:vh)(M)}$call(k){return k(this)}$if(k,W){if(k)return W(this);return new O({...this.#k})}toOperationNode(){return this.#k.executor.transformQuery(this.#k.queryNode,this.#k.queryId)}compile(){return this.#k.executor.compileQuery(this.toOperationNode(),this.#k.queryId)}async execute(){let k=this.compile(),W=await this.#k.executor.executeQuery(k),{adapter:$}=this.#k.executor,M=k.query;if(M.returning&&$.supportsReturning||M.output&&$.supportsOutput)return W.rows;return[new NW(W.numAffectedRows)]}async executeTakeFirst(){let[k]=await this.execute();return k}async executeTakeFirstOrThrow(k=u){let W=await this.executeTakeFirst();if(W===void 0)throw s(k)?new k(this.toOperationNode()):k(this.toOperationNode());return W}}class BW{#k;constructor(k){this.#k=h(k)}thenDelete(){return new O({...this.#k,queryNode:N.cloneWithThen(this.#k.queryNode,Ok("delete"))})}thenDoNothing(){return new O({...this.#k,queryNode:N.cloneWithThen(this.#k.queryNode,Ok("do nothing"))})}thenUpdate(k){return new O({...this.#k,queryNode:N.cloneWithThen(this.#k.queryNode,Ok(k(new jk({queryId:this.#k.queryId,executor:qk,queryNode:o.createWithoutTable()}))))})}thenUpdateSet(...k){return this.thenUpdate((W)=>W.set(...k))}}class vh{#k;constructor(k){this.#k=h(k)}thenDoNothing(){return new O({...this.#k,queryNode:N.cloneWithThen(this.#k.queryNode,Ok("do nothing"))})}thenInsertValues(k){let[W,$]=KW(k);return new O({...this.#k,queryNode:N.cloneWithThen(this.#k.queryNode,Ok(w.cloneWith(w.createWithoutInto(),{columns:W,values:$})))})}}class Pk{#k;constructor(k){this.#k=h(k)}selectFrom(k){return nk({queryId:T(),executor:this.#k.executor,queryNode:Y.createFrom(n(k),this.#k.withNode)})}selectNoFrom(k){return nk({queryId:T(),executor:this.#k.executor,queryNode:Y.cloneWithSelections(Y.create(this.#k.withNode),A(k))})}insertInto(k){return new D({queryId:T(),executor:this.#k.executor,queryNode:w.create(F(k),this.#k.withNode)})}replaceInto(k){return new D({queryId:T(),executor:this.#k.executor,queryNode:w.create(F(k),this.#k.withNode,!0)})}deleteFrom(k){return new HW({queryId:T(),executor:this.#k.executor,queryNode:Dk.create(n(k),this.#k.withNode)})}updateTable(k){return new jk({queryId:T(),executor:this.#k.executor,queryNode:o.create(n(k),this.#k.withNode)})}mergeInto(k){return new Hk({queryId:T(),executor:this.#k.executor,queryNode:N.create(fW(k),this.#k.withNode)})}with(k,W){let $=OW(k,W);return new Pk({...this.#k,withNode:this.#k.withNode?tk.cloneWithExpression(this.#k.withNode,$):tk.create($)})}withRecursive(k,W){let $=OW(k,W);return new Pk({...this.#k,withNode:this.#k.withNode?tk.cloneWithExpression(this.#k.withNode,$):tk.create($,{recursive:!0})})}withPlugin(k){return new Pk({...this.#k,executor:this.#k.executor.withPlugin(k)})}withoutPlugins(){return new Pk({...this.#k,executor:this.#k.executor.withoutPlugins()})}withSchema(k){return new Pk({...this.#k,executor:this.#k.executor.withPluginAtFront(new YW(k))})}}function Ph(){return new Pk({executor:qk})}function Ah(k,W){return new Rk({joinNode:Kk.create(k,wk(W))})}function _h(){return new Ck({overNode:xk.create()})}function Jk(k,W){if(W.length===3)return K$(k,W[0],W[1],W[2]);else if(W.length===2)return M$(k,W[0],W[1]);else if(W.length===1)return G$(k,W[0]);else throw Error("not implemented")}function M$(k,W,$){return $(Ah(k,W)).toOperationNode()}function K$(k,W,$,M){return Kk.createWithOn(k,wk(W),m($,"=",M))}function G$(k,W){return Kk.create(k,wk(W))}var mh=h({is(k){return k.kind==="OffsetNode"},create(k){return h({kind:"OffsetNode",offset:k})}});var Rh=h({is(k){return k.kind==="GroupByItemNode"},create(k){return h({kind:"GroupByItemNode",groupBy:k})}});function fh(k){return k=_(k)?k(d()):k,Gk(k).map(Rh.create)}function Tk(k,W,$){if(_(W))W=W(XW());if(!j(W))W=[W];return W.map((M)=>Ch.create(k,p(M),$))}class Z{#k;constructor(k){this.#k=k}get expressionType(){return}as(k){return new zW(this,k)}or(...k){return new DW(hk.create(this.#k,L(k)))}and(...k){return new LW(x.create(this.#k,L(k)))}$castTo(){return new Z(this.#k)}$notNull(){return new Z(this.#k)}toOperationNode(){return this.#k}}class zW{#k;#W;constructor(k,W){this.#k=k,this.#W=W}get expression(){return this.#k}get alias(){return this.#W}toOperationNode(){return I.create(this.#k.toOperationNode(),z(this.#W)?this.#W.toOperationNode():J.create(this.#W))}}class DW{#k;constructor(k){this.#k=k}get expressionType(){return}as(k){return new zW(this,k)}or(...k){return new DW(hk.create(this.#k,L(k)))}$castTo(){return new DW(this.#k)}toOperationNode(){return Xk.create(this.#k)}}class LW{#k;constructor(k){this.#k=k}get expressionType(){return}as(k){return new zW(this,k)}and(...k){return new LW(x.create(this.#k,L(k)))}$castTo(){return new LW(this.#k)}toOperationNode(){return Xk.create(this.#k)}}var Sh=h({is(k){return k.kind==="FetchNode"},create(k,W){return{kind:"FetchNode",rowCount:Q.create(k),modifier:W}}});function Ih(k,W){if(!_k(k)&&!GW(k))throw Error(`Invalid fetch row count: ${k}`);if(!H$(W))throw Error(`Invalid fetch modifier: ${W}`);return Sh.create(k,W)}function H$(k){return k==="only"||k==="with ties"}var H;class xW{#k;constructor(k){this.#k=h(k)}get expressionType(){return}get isSelectQueryBuilder(){return!0}where(...k){return new H({...this.#k,queryNode:K.cloneWithWhere(this.#k.queryNode,L(k))})}whereRef(k,W,$){return new H({...this.#k,queryNode:K.cloneWithWhere(this.#k.queryNode,m(k,W,$))})}having(...k){return new H({...this.#k,queryNode:Y.cloneWithHaving(this.#k.queryNode,L(k))})}havingRef(k,W,$){return new H({...this.#k,queryNode:Y.cloneWithHaving(this.#k.queryNode,m(k,W,$))})}select(k){return new H({...this.#k,queryNode:Y.cloneWithSelections(this.#k.queryNode,A(k))})}distinctOn(k){return new H({...this.#k,queryNode:Y.cloneWithDistinctOn(this.#k.queryNode,Gk(k))})}modifyFront(k){return new H({...this.#k,queryNode:Y.cloneWithFrontModifier(this.#k.queryNode,a.createWithExpression(k.toOperationNode()))})}modifyEnd(k){return new H({...this.#k,queryNode:K.cloneWithEndModifier(this.#k.queryNode,a.createWithExpression(k.toOperationNode()))})}distinct(){return new H({...this.#k,queryNode:Y.cloneWithFrontModifier(this.#k.queryNode,a.create("Distinct"))})}forUpdate(k){return new H({...this.#k,queryNode:K.cloneWithEndModifier(this.#k.queryNode,a.create("ForUpdate",k?dk(k).map(F):void 0))})}forShare(k){return new H({...this.#k,queryNode:K.cloneWithEndModifier(this.#k.queryNode,a.create("ForShare",k?dk(k).map(F):void 0))})}forKeyShare(k){return new H({...this.#k,queryNode:K.cloneWithEndModifier(this.#k.queryNode,a.create("ForKeyShare",k?dk(k).map(F):void 0))})}forNoKeyUpdate(k){return new H({...this.#k,queryNode:K.cloneWithEndModifier(this.#k.queryNode,a.create("ForNoKeyUpdate",k?dk(k).map(F):void 0))})}skipLocked(){return new H({...this.#k,queryNode:K.cloneWithEndModifier(this.#k.queryNode,a.create("SkipLocked"))})}noWait(){return new H({...this.#k,queryNode:K.cloneWithEndModifier(this.#k.queryNode,a.create("NoWait"))})}selectAll(k){return new H({...this.#k,queryNode:Y.cloneWithSelections(this.#k.queryNode,R(k))})}innerJoin(...k){return this.#W("InnerJoin",k)}leftJoin(...k){return this.#W("LeftJoin",k)}rightJoin(...k){return this.#W("RightJoin",k)}fullJoin(...k){return this.#W("FullJoin",k)}crossJoin(...k){return this.#W("CrossJoin",k)}innerJoinLateral(...k){return this.#W("LateralInnerJoin",k)}leftJoinLateral(...k){return this.#W("LateralLeftJoin",k)}crossJoinLateral(...k){return this.#W("LateralCrossJoin",k)}crossApply(...k){return this.#W("CrossApply",k)}outerApply(...k){return this.#W("OuterApply",k)}#W(k,W){return new H({...this.#k,queryNode:K.cloneWithJoin(this.#k.queryNode,Jk(k,W))})}orderBy(...k){return new H({...this.#k,queryNode:K.cloneWithOrderByItems(this.#k.queryNode,B(k))})}groupBy(k){return new H({...this.#k,queryNode:Y.cloneWithGroupByItems(this.#k.queryNode,fh(k))})}limit(k){return new H({...this.#k,queryNode:Y.cloneWithLimit(this.#k.queryNode,Ik.create(X(k)))})}offset(k){return new H({...this.#k,queryNode:Y.cloneWithOffset(this.#k.queryNode,mh.create(X(k)))})}fetch(k,W="only"){return new H({...this.#k,queryNode:Y.cloneWithFetch(this.#k.queryNode,Ih(k,W))})}top(k,W){return new H({...this.#k,queryNode:K.cloneWithTop(this.#k.queryNode,i(k,W))})}union(k){return new H({...this.#k,queryNode:Y.cloneWithSetOperations(this.#k.queryNode,Tk("union",k,!1))})}unionAll(k){return new H({...this.#k,queryNode:Y.cloneWithSetOperations(this.#k.queryNode,Tk("union",k,!0))})}intersect(k){return new H({...this.#k,queryNode:Y.cloneWithSetOperations(this.#k.queryNode,Tk("intersect",k,!1))})}intersectAll(k){return new H({...this.#k,queryNode:Y.cloneWithSetOperations(this.#k.queryNode,Tk("intersect",k,!0))})}except(k){return new H({...this.#k,queryNode:Y.cloneWithSetOperations(this.#k.queryNode,Tk("except",k,!1))})}exceptAll(k){return new H({...this.#k,queryNode:Y.cloneWithSetOperations(this.#k.queryNode,Tk("except",k,!0))})}as(k){return new jh(this,k)}clearSelect(){return new H({...this.#k,queryNode:Y.cloneWithoutSelections(this.#k.queryNode)})}clearWhere(){return new H({...this.#k,queryNode:K.cloneWithoutWhere(this.#k.queryNode)})}clearLimit(){return new H({...this.#k,queryNode:Y.cloneWithoutLimit(this.#k.queryNode)})}clearOffset(){return new H({...this.#k,queryNode:Y.cloneWithoutOffset(this.#k.queryNode)})}clearOrderBy(){return new H({...this.#k,queryNode:K.cloneWithoutOrderBy(this.#k.queryNode)})}clearGroupBy(){return new H({...this.#k,queryNode:Y.cloneWithoutGroupBy(this.#k.queryNode)})}$call(k){return k(this)}$if(k,W){if(k)return W(this);return new H({...this.#k})}$castTo(){return new H(this.#k)}$narrowType(){return new H(this.#k)}$assertType(){return new H(this.#k)}$asTuple(){return new Z(this.toOperationNode())}$asScalar(){return new Z(this.toOperationNode())}withPlugin(k){return new H({...this.#k,executor:this.#k.executor.withPlugin(k)})}toOperationNode(){return this.#k.executor.transformQuery(this.#k.queryNode,this.#k.queryId)}compile(){return this.#k.executor.compileQuery(this.toOperationNode(),this.#k.queryId)}async execute(){let k=this.compile();return(await this.#k.executor.executeQuery(k)).rows}async executeTakeFirst(){let[k]=await this.execute();return k}async executeTakeFirstOrThrow(k=u){let W=await this.executeTakeFirst();if(W===void 0)throw s(k)?new k(this.toOperationNode()):k(this.toOperationNode());return W}async*stream(k=100){let W=this.compile(),$=this.#k.executor.stream(W,k);for await(let M of $)yield*M.rows}async explain(k,W){return await new H({...this.#k,queryNode:K.cloneWithExplain(this.#k.queryNode,k,W)}).execute()}}H=xW;function nk(k){return new xW(k)}class jh{#k;#W;constructor(k,W){this.#k=k,this.#W=W}get expression(){return this.#k}get alias(){return this.#W}get isAliasedSelectQueryBuilder(){return!0}toOperationNode(){return I.create(this.#k.toOperationNode(),J.create(this.#W))}}var e=h({is(k){return k.kind==="AggregateFunctionNode"},create(k,W=[]){return h({kind:"AggregateFunctionNode",func:k,aggregated:W})},cloneWithDistinct(k){return h({...k,distinct:!0})},cloneWithOrderBy(k,W,$=!1){let M=$?"withinGroup":"orderBy";return h({...k,[M]:k[M]?$k.cloneWithItems(k[M],W):$k.create(W)})},cloneWithFilter(k,W){return h({...k,filter:k.filter?C.cloneWithOperation(k.filter,"And",W):C.create(W)})},cloneWithOrFilter(k,W){return h({...k,filter:k.filter?C.cloneWithOperation(k.filter,"Or",W):C.create(W)})},cloneWithOver(k,W){return h({...k,over:W})}});var cW=h({is(k){return k.kind==="FunctionNode"},create(k,W){return h({kind:"FunctionNode",func:k,arguments:W})}});class b{#k;constructor(k){this.#k=h(k)}get expressionType(){return}as(k){return new Eh(this,k)}distinct(){return new b({...this.#k,aggregateFunctionNode:e.cloneWithDistinct(this.#k.aggregateFunctionNode)})}orderBy(...k){return new b({...this.#k,aggregateFunctionNode:K.cloneWithOrderByItems(this.#k.aggregateFunctionNode,B(k))})}clearOrderBy(){return new b({...this.#k,aggregateFunctionNode:K.cloneWithoutOrderBy(this.#k.aggregateFunctionNode)})}withinGroupOrderBy(...k){return new b({...this.#k,aggregateFunctionNode:e.cloneWithOrderBy(this.#k.aggregateFunctionNode,B(k),!0)})}filterWhere(...k){return new b({...this.#k,aggregateFunctionNode:e.cloneWithFilter(this.#k.aggregateFunctionNode,L(k))})}filterWhereRef(k,W,$){return new b({...this.#k,aggregateFunctionNode:e.cloneWithFilter(this.#k.aggregateFunctionNode,m(k,W,$))})}over(k){let W=_h();return new b({...this.#k,aggregateFunctionNode:e.cloneWithOver(this.#k.aggregateFunctionNode,(k?k(W):W).toOperationNode())})}$call(k){return k(this)}$castTo(){return new b(this.#k)}$notNull(){return new b(this.#k)}toOperationNode(){return this.#k.aggregateFunctionNode}}class Eh{#k;#W;constructor(k,W){this.#k=k,this.#W=W}get expression(){return this.#k}get alias(){return this.#W}toOperationNode(){return I.create(this.#k.toOperationNode(),J.create(this.#W))}}function Oh(){let k=($,M)=>{return new Z(cW.create($,Gk(M??[])))},W=($,M)=>{return new b({aggregateFunctionNode:e.create($,M?Gk(M):void 0)})};return Object.assign(k,{agg:W,avg($){return W("avg",[$])},coalesce(...$){return k("coalesce",$)},count($){return W("count",[$])},countAll($){return new b({aggregateFunctionNode:e.create("count",R($))})},max($){return W("max",[$])},min($){return W("min",[$])},sum($){return W("sum",[$])},any($){return k("any",[$])},jsonAgg($){return new b({aggregateFunctionNode:e.create("json_agg",[V($)?F($):$.toOperationNode()])})},toJson($){return new Z(cW.create("to_json",[V($)?F($):$.toOperationNode()]))}})}var bh=h({is(k){return k.kind==="UnaryOperationNode"},create(k,W){return h({kind:"UnaryOperationNode",operator:k,operand:W})}});function Qh(k,W){return bh.create(y.create(k),f(W))}var l=h({is(k){return k.kind==="CaseNode"},create(k){return h({kind:"CaseNode",value:k})},cloneWithWhen(k,W){return h({...k,when:h(k.when?[...k.when,W]:[W])})},cloneWithThen(k,W){return h({...k,when:k.when?h([...k.when.slice(0,-1),Mk.cloneWithResult(k.when[k.when.length-1],W)]):void 0})},cloneWith(k,W){return h({...k,...W})}});class yW{#k;constructor(k){this.#k=h(k)}when(...k){return new gW({...this.#k,node:l.cloneWithWhen(this.#k.node,Mk.create(L(k)))})}}class gW{#k;constructor(k){this.#k=h(k)}then(k){return new Nh({...this.#k,node:l.cloneWithThen(this.#k.node,WW(k)?Bk(k):X(k))})}}class Nh{#k;constructor(k){this.#k=h(k)}when(...k){return new gW({...this.#k,node:l.cloneWithWhen(this.#k.node,Mk.create(L(k)))})}else(k){return new Bh({...this.#k,node:l.cloneWith(this.#k.node,{else:WW(k)?Bk(k):X(k)})})}end(){return new Z(l.cloneWith(this.#k.node,{isStatement:!1}))}endCase(){return new Z(l.cloneWith(this.#k.node,{isStatement:!0}))}}class Bh{#k;constructor(k){this.#k=h(k)}end(){return new Z(l.cloneWith(this.#k.node,{isStatement:!1}))}endCase(){return new Z(l.cloneWith(this.#k.node,{isStatement:!0}))}}var JW=h({is(k){return k.kind==="JSONOperatorChainNode"},create(k){return h({kind:"JSONOperatorChainNode",operator:k,values:h([])})},cloneWithValue(k,W){return h({...k,values:h([...k.values,W])})}});var tW=h({is(k){return k.kind==="JSONPathLegNode"},create(k,W){return h({kind:"JSONPathLegNode",type:k,value:W})}});var Uk=h({is(k){return k.kind==="JSONPathNode"},create(k){return h({kind:"JSONPathNode",inOperator:k,pathLegs:h([])})},cloneWithLeg(k,W){return h({...k,pathLegs:h([...k.pathLegs,W])})}});var Qk=h({is(k){return k.kind==="JSONReferenceNode"},create(k,W){return h({kind:"JSONReferenceNode",reference:k,traversal:W})},cloneWithTraversal(k,W){return h({...k,traversal:W})}});var Z$=/^#-\d+$/;class ik{#k;constructor(k){this.#k=k}at(k){if(typeof k!=="number"&&typeof k!=="string"||typeof k==="number"&&!Number.isInteger(k)||typeof k==="string"&&k!=="last"&&!Z$.test(k))throw Error(`Unexpected index value in .at(...): ${k}`);return this.#W("ArrayLocation",k)}key(k){return this.#W("Member",k)}#W(k,W){if(Qk.is(this.#k))return new uk(Qk.cloneWithTraversal(this.#k,Uk.is(this.#k.traversal)?Uk.cloneWithLeg(this.#k.traversal,tW.create(k,W)):JW.cloneWithValue(this.#k.traversal,Q.createImmediate(W))));return new uk(Uk.cloneWithLeg(this.#k,tW.create(k,W)))}}class uk extends ik{#k;constructor(k){super(k);this.#k=k}get expressionType(){return}as(k){return new xh(this,k)}$castTo(){return new uk(this.#k)}$notNull(){return new uk(this.#k)}toOperationNode(){return this.#k}}class xh{#k;#W;constructor(k,W){this.#k=k,this.#W=W}get expression(){return this.#k}get alias(){return this.#W}toOperationNode(){return I.create(this.#k.toOperationNode(),z(this.#W)?this.#W.toOperationNode():J.create(this.#W))}}var nW=h({is(k){return k.kind==="TupleNode"},create(k){return h({kind:"TupleNode",values:h(k)})}});var Y$=["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"],X$=[/^varchar\(\d+\)$/,/^char\(\d+\)$/,/^decimal\(\d+, \d+\)$/,/^numeric\(\d+, \d+\)$/,/^binary\(\d+\)$/,/^datetime\(\d+\)$/,/^time\(\d+\)$/,/^timetz\(\d+\)$/,/^timestamp\(\d+\)$/,/^timestamptz\(\d+\)$/,/^varbinary\(\d+\)$/],ch=h({is(k){return k.kind==="DataTypeNode"},create(k){return h({kind:"DataTypeNode",dataType:k})}});function yh(k){if(Y$.includes(k))return!0;if(X$.some((W)=>W.test(k)))return!0;return!1}function gh(k){if(z(k))return k.toOperationNode();if(yh(k))return ch.create(k);throw Error(`invalid column data type ${JSON.stringify(k)}`)}var th=h({is(k){return k.kind==="CastNode"},create(k,W){return h({kind:"CastNode",expression:k,dataType:W})}});function XW(k=qk){function W(G,q,vk){return new Z(hW(G,q,vk))}function $(G,q){return new Z(Qh(G,q))}let M=Object.assign(W,{fn:void 0,eb:void 0,selectFrom(G){return nk({queryId:T(),executor:k,queryNode:Y.createFrom(n(G))})},case(G){return new yW({node:l.create(c(G)?void 0:f(G))})},ref(G,q){if(c(q))return new Z(t(G));return new ik(nh(G,q))},jsonPath(){return new ik(Uk.create())},table(G){return new Z(F(G))},val(G){return new Z(X(G))},refTuple(...G){return new Z(nW.create(G.map(f)))},tuple(...G){return new Z(nW.create(G.map(X)))},lit(G){return new Z(Bk(G))},unary:$,not(G){return $("not",G)},exists(G){return $("exists",G)},neg(G){return $("-",G)},between(G,q,vk){return new Z(Yk.create(f(G),y.create("between"),x.create(X(q),X(vk))))},betweenSymmetric(G,q,vk){return new Z(Yk.create(f(G),y.create("between symmetric"),x.create(X(q),X(vk))))},and(G){if(j(G))return new Z(mk(G,"and"));return new Z(UW(G,"and"))},or(G){if(j(G))return new Z(mk(G,"or"));return new Z(UW(G,"or"))},parens(...G){let q=L(G);if(Xk.is(q))return new Z(q);else return new Z(Xk.create(q))},cast(G,q){return new Z(th.create(f(G),gh(q)))},withSchema(G){return XW(k.withPluginAtFront(new YW(G)))}});return M.fn=Oh(),M.eb=M,M}function d(k){return XW()}function p(k){if(z(k))return k.toOperationNode();else if(_(k))return k(d()).toOperationNode();throw Error(`invalid expression: ${JSON.stringify(k)}`)}function MW(k){if(z(k))return k.toOperationNode();else if(_(k))return k(d()).toOperationNode();throw Error(`invalid aliased expression: ${JSON.stringify(k)}`)}function Wk(k){return ok(k)||iW(k)||_(k)}function _W(k){if(V(k))return t(k);return k.toOperationNode()}function Gk(k){if(j(k))return k.map((W)=>f(W));else return[f(k)]}function f(k){if(Wk(k))return p(k);return _W(k)}function nh(k,W){let $=t(k);if(dW(W))return Qk.create($,JW.create(y.create(W)));let M=W.slice(0,-1);if(dW(M))return Qk.create($,Uk.create(y.create(M)));throw Error(`Invalid JSON operator: ${W}`)}function t(k){if(!k.includes("."))return Ak.create(S.create(k));let $=k.split(".").map(uW);if($.length===3)return L$($);if($.length===2)return z$($);throw Error(`invalid column reference ${k}`)}function Zh(k){if(k.includes(" as ")){let[$,M]=k.split(" as ").map(uW);return I.create(t($),J.create(M))}else return t(k)}function D$(k){return S.create(k)}function R3(k){if(k.includes(" ")){let[$,M]=k.split(" ").map(uW);if(!RW(M))throw Error(`invalid order direction "${M}" next to "${$}"`);return B([$,M])[0]}else return D$(k)}function L$(k){let[W,$,M]=k;return Ak.create(S.create(M),zk.createWithSchema(W,$))}function z$(k){let[W,$]=k;return Ak.create(S.create($),zk.create(W))}function uW(k){return k.trim()}class lk{#k;constructor(k){this.#k=h(k)}get expressionType(){return}get isRawBuilder(){return!0}as(k){return new dh(this,k)}$castTo(){return new lk({...this.#k})}$notNull(){return new lk(this.#k)}withPlugin(k){return new lk({...this.#k,plugins:this.#k.plugins!==void 0?h([...this.#k.plugins,k]):h([k])})}toOperationNode(){return this.#h(this.#W())}compile(k){return this.#$(this.#W(k))}async execute(k){let W=this.#W(k);return W.executeQuery(this.#$(W))}#W(k){let W=k!==void 0?k.getExecutor():qk;return this.#k.plugins!==void 0?W.withPlugins(this.#k.plugins):W}#h(k){return k.transformQuery(this.#k.rawNode,this.#k.queryId)}#$(k){return k.compileQuery(this.#h(k),this.#k.queryId)}}function Zk(k){return new lk(k)}class dh{#k;#W;constructor(k,W){this.#k=k,this.#W=W}get expression(){return this.#k}get alias(){return this.#W}get rawBuilder(){return this.#k}toOperationNode(){return I.create(this.#k.toOperationNode(),z(this.#W)?this.#W.toOperationNode():J.create(this.#W))}}var J$=Object.assign((k,...W)=>{return Zk({queryId:T(),rawNode:v.create(k,W?.map(uh)??[])})},{ref(k){return Zk({queryId:T(),rawNode:v.createWithChild(t(k))})},val(k){return Zk({queryId:T(),rawNode:v.createWithChild(X(k))})},value(k){return this.val(k)},table(k){return Zk({queryId:T(),rawNode:v.createWithChild(F(k))})},id(...k){let W=Array(k.length+1).fill(".");return W[0]="",W[W.length-1]="",Zk({queryId:T(),rawNode:v.create(W,k.map(J.create))})},lit(k){return Zk({queryId:T(),rawNode:v.createWithChild(Q.createImmediate(k))})},literal(k){return this.lit(k)},raw(k){return Zk({queryId:T(),rawNode:v.createWithSql(k)})},join(k,W=J$`, `){let $=Array(Math.max(2*k.length-1,0)),M=W.toOperationNode();for(let G=0;G<k.length;++G)if($[2*G]=uh(k[G]),G!==k.length-1)$[2*G+1]=M;return Zk({queryId:T(),rawNode:v.createWithChildren($)})}});function uh(k){if(z(k))return k.toOperationNode();return X(k)}var l3=h({raw(k,W=[]){return h({sql:k,query:v.createWithSql(k),parameters:h(W),queryId:T()})}});
|
|
3
|
-
export{z as
|
|
2
|
+
import{Ob as c,Pb as V,Qb as _k,Rb as ek,Sb as kW,Ub as GW,Wb as _,Xb as kk,Yb as h,Zb as dk,_b as j,ac as J,ec as I,fc as zk,gc as x,hc as hk,ic as Kk,jc as pW,kc as y,lc as dW,mc as v,nc as fk,oc as Xk,pc as w,qc as sW,rc as TW,sc as Mk,uc as YW,vc as Ch}from"./chunk-xext4yvc.js";function z(k){return kk(k)&&_(k.toOperationNode)}var Q=h({is(k){return k.kind==="ValueNode"},create(k){return h({kind:"ValueNode",value:k})},createImmediate(k){return h({kind:"ValueNode",value:k,immediate:!0})}});var S=h({is(k){return k.kind==="ColumnNode"},create(k){return h({kind:"ColumnNode",column:J.create(k)})}});var pk=h({is(k){return k.kind==="SelectAllNode"},create(){return h({kind:"SelectAllNode"})}});var Ak=h({is(k){return k.kind==="ReferenceNode"},create(k,W){return h({kind:"ReferenceNode",table:W,column:k})},createSelectAll(k){return h({kind:"ReferenceNode",table:k,column:pk.create()})}});function ok(k){return kk(k)&&"expressionType"in k&&z(k)}function iW(k){return kk(k)&&"expression"in k&&V(k.alias)&&z(k)}var a=h({is(k){return k.kind==="SelectModifierNode"},create(k,W){return h({kind:"SelectModifierNode",modifier:k,of:W})},createWithExpression(k){return h({kind:"SelectModifierNode",rawModifier:k})}});var Yk=h({is(k){return k.kind==="BinaryOperationNode"},create(k,W,$){return h({kind:"BinaryOperationNode",leftOperand:k,operator:W,rightOperand:$})}});var sk=h({is(k){return k.kind==="PrimitiveValueListNode"},create(k){return h({kind:"PrimitiveValueListNode",values:h([...k])})}});var rk=h({is(k){return k.kind==="ValueListNode"},create(k){return h({kind:"ValueListNode",values:h(k)})}});function lW(k){if(j(k))return ih(k);return X(k)}function X(k){if(Wk(k))return p(k);return Q.create(k)}function WW(k){return _k(k)||ek(k)||kW(k)}function Bk(k){if(!WW(k))throw Error(`unsafe immediate value ${JSON.stringify(k)}`);return Q.createImmediate(k)}function ih(k){if(k.some(Wk))return rk.create(k.map((W)=>X(W)));return sk.create(k)}function L(k){if(k.length===3)return hW(k[0],k[1],k[2]);else if(k.length===1)return X(k[0]);throw Error(`invalid arguments: ${JSON.stringify(k)}`)}function hW(k,W,$){if(lh(W)&&oW($))return Yk.create(f(k),PW(W),Q.createImmediate($));return Yk.create(f(k),PW(W),lW($))}function m(k,W,$){return Yk.create(f(k),PW(W),f($))}function UW(k,W){return mk(Object.entries(k).filter(([,$])=>!c($)).map(([$,M])=>hW($,oW(M)?"is":"=",M)),W)}function mk(k,W,$=!0){let M=W==="and"?x.create:hk.create;if(k.length===0)return Yk.create(Q.createImmediate(1),y.create("="),Q.createImmediate(W==="and"?1:0));let G=aW(k[0]);for(let q=1;q<k.length;++q)G=M(G,aW(k[q]));if(k.length>1&&$)return Xk.create(G);return G}function lh(k){return k==="is"||k==="is not"}function oW(k){return kW(k)||ek(k)}function PW(k){if(V(k)&&pW.includes(k))return y.create(k);if(z(k))return k.toOperationNode();throw Error(`invalid operator ${JSON.stringify(k)}`)}function aW(k){return z(k)?k.toOperationNode():k}var $k=h({is(k){return k.kind==="OrderByNode"},create(k){return h({kind:"OrderByNode",items:h([...k])})},cloneWithItems(k,W){return h({...k,items:h([...k.items,...W])})}});var VW=h({is(k){return k.kind==="PartitionByNode"},create(k){return h({kind:"PartitionByNode",items:h(k)})},cloneWithItems(k,W){return h({...k,items:h([...k.items,...W])})}});var xk=h({is(k){return k.kind==="OverNode"},create(){return h({kind:"OverNode"})},cloneWithOrderByItems(k,W){return h({...k,orderBy:k.orderBy?$k.cloneWithItems(k.orderBy,W):$k.create(W)})},cloneWithPartitionByItems(k,W){return h({...k,partitionBy:k.partitionBy?VW.cloneWithItems(k.partitionBy,W):VW.create(W)})}});var Vk=h({is(k){return k.kind==="FromNode"},create(k){return h({kind:"FromNode",froms:h(k)})},cloneWithFroms(k,W){return h({...k,froms:h([...k.froms,...W])})}});var wW=h({is(k){return k.kind==="GroupByNode"},create(k){return h({kind:"GroupByNode",items:h(k)})},cloneWithItems(k,W){return h({...k,items:h([...k.items,...W])})}});var FW=h({is(k){return k.kind==="HavingNode"},create(k){return h({kind:"HavingNode",having:k})},cloneWithOperation(k,W,$){return h({...k,having:W==="And"?x.create(k.having,$):hk.create(k.having,$)})}});var o=h({is(k){return k.kind==="UpdateQueryNode"},create(k,W){return h({kind:"UpdateQueryNode",table:k.length===1?k[0]:sW.create(k),...W&&{with:W}})},createWithoutTable(){return h({kind:"UpdateQueryNode"})},cloneWithFromItems(k,W){return h({...k,from:k.from?Vk.cloneWithFroms(k.from,W):Vk.create(W)})},cloneWithUpdates(k,W){return h({...k,updates:k.updates?h([...k.updates,...W]):W})},cloneWithLimit(k,W){return h({...k,limit:W})}});var Dk=h({is(k){return k.kind==="DeleteQueryNode"},create(k,W){return h({kind:"DeleteQueryNode",from:Vk.create(k),...W&&{with:W}})},cloneWithOrderByItems:(k,W)=>K.cloneWithOrderByItems(k,W),cloneWithoutOrderBy:(k)=>K.cloneWithoutOrderBy(k),cloneWithLimit(k,W){return h({...k,limit:W})},cloneWithoutLimit(k){return h({...k,limit:void 0})},cloneWithUsing(k,W){return h({...k,using:k.using!==void 0?TW.cloneWithTables(k.using,W):TW.create(W)})}});var C=h({is(k){return k.kind==="WhereNode"},create(k){return h({kind:"WhereNode",where:k})},cloneWithOperation(k,W,$){return h({...k,where:W==="And"?x.create(k.where,$):hk.create(k.where,$)})}});var vW=h({is(k){return k.kind==="ReturningNode"},create(k){return h({kind:"ReturningNode",selections:h(k)})},cloneWithSelections(k,W){return h({...k,selections:k.selections?h([...k.selections,...W]):h(W)})}});var rW=h({is(k){return k.kind==="ExplainNode"},create(k,W){return h({kind:"ExplainNode",format:k,options:W})}});var N=h({is(k){return k.kind==="MergeQueryNode"},create(k,W){return h({kind:"MergeQueryNode",into:k,...W&&{with:W}})},cloneWithUsing(k,W){return h({...k,using:W})},cloneWithWhen(k,W){return h({...k,whens:k.whens?h([...k.whens,W]):h([W])})},cloneWithThen(k,W){return h({...k,whens:k.whens?h([...k.whens.slice(0,-1),Mk.cloneWithResult(k.whens[k.whens.length-1],W)]):void 0})}});var AW=h({is(k){return k.kind==="OutputNode"},create(k){return h({kind:"OutputNode",selections:h(k)})},cloneWithSelections(k,W){return h({...k,selections:k.selections?h([...k.selections,...W]):h(W)})}});var K=h({is(k){return Y.is(k)||w.is(k)||o.is(k)||Dk.is(k)||N.is(k)},cloneWithEndModifier(k,W){return h({...k,endModifiers:k.endModifiers?h([...k.endModifiers,W]):h([W])})},cloneWithWhere(k,W){return h({...k,where:k.where?C.cloneWithOperation(k.where,"And",W):C.create(W)})},cloneWithJoin(k,W){return h({...k,joins:k.joins?h([...k.joins,W]):h([W])})},cloneWithReturning(k,W){return h({...k,returning:k.returning?vW.cloneWithSelections(k.returning,W):vW.create(W)})},cloneWithoutReturning(k){return h({...k,returning:void 0})},cloneWithoutWhere(k){return h({...k,where:void 0})},cloneWithExplain(k,W,$){return h({...k,explain:rW.create(W,$?.toOperationNode())})},cloneWithTop(k,W){return h({...k,top:W})},cloneWithOutput(k,W){return h({...k,output:k.output?AW.cloneWithSelections(k.output,W):AW.create(W)})},cloneWithOrderByItems(k,W){return h({...k,orderBy:k.orderBy?$k.cloneWithItems(k.orderBy,W):$k.create(W)})},cloneWithoutOrderBy(k){return h({...k,orderBy:void 0})}});var Y=h({is(k){return k.kind==="SelectQueryNode"},create(k){return h({kind:"SelectQueryNode",...k&&{with:k}})},createFrom(k,W){return h({kind:"SelectQueryNode",from:Vk.create(k),...W&&{with:W}})},cloneWithSelections(k,W){return h({...k,selections:k.selections?h([...k.selections,...W]):h(W)})},cloneWithDistinctOn(k,W){return h({...k,distinctOn:k.distinctOn?h([...k.distinctOn,...W]):h(W)})},cloneWithFrontModifier(k,W){return h({...k,frontModifiers:k.frontModifiers?h([...k.frontModifiers,W]):h([W])})},cloneWithOrderByItems:(k,W)=>K.cloneWithOrderByItems(k,W),cloneWithGroupByItems(k,W){return h({...k,groupBy:k.groupBy?wW.cloneWithItems(k.groupBy,W):wW.create(W)})},cloneWithLimit(k,W){return h({...k,limit:W})},cloneWithOffset(k,W){return h({...k,offset:W})},cloneWithFetch(k,W){return h({...k,fetch:W})},cloneWithHaving(k,W){return h({...k,having:k.having?FW.cloneWithOperation(k.having,"And",W):FW.create(W)})},cloneWithSetOperations(k,W){return h({...k,setOperations:k.setOperations?h([...k.setOperations,...W]):h([...W])})},cloneWithoutSelections(k){return h({...k,selections:[]})},cloneWithoutLimit(k){return h({...k,limit:void 0})},cloneWithoutOffset(k){return h({...k,offset:void 0})},cloneWithoutOrderBy:(k)=>K.cloneWithoutOrderBy(k),cloneWithoutGroupBy(k){return h({...k,groupBy:void 0})}});class Rk{#k;constructor(k){this.#k=h(k)}on(...k){return new Rk({...this.#k,joinNode:Kk.cloneWithOn(this.#k.joinNode,L(k))})}onRef(k,W,$){return new Rk({...this.#k,joinNode:Kk.cloneWithOn(this.#k.joinNode,m(k,W,$))})}onTrue(){return new Rk({...this.#k,joinNode:Kk.cloneWithOn(this.#k.joinNode,v.createWithSql("true"))})}$call(k){return k(this)}toOperationNode(){return this.#k.joinNode}}class ah{#k;get dynamicReference(){return this.#k}get refType(){return}constructor(k){this.#k=k}toOperationNode(){return _W(this.#k)}}function $W(k){return kk(k)&&z(k)&&V(k.dynamicReference)}var g=h({is(k){return k.kind==="OrderByItemNode"},create(k,W){return h({kind:"OrderByItemNode",orderBy:k,direction:W})},cloneWith(k,W){return h({...k,...W})}});var eW=h({is(k){return k.kind==="CollateNode"},create(k){return h({kind:"CollateNode",collation:J.create(k)})}});class Lk{#k;constructor(k){this.#k=h(k)}desc(){return new Lk({node:g.cloneWith(this.#k.node,{direction:v.createWithSql("desc")})})}asc(){return new Lk({node:g.cloneWith(this.#k.node,{direction:v.createWithSql("asc")})})}nullsLast(){return new Lk({node:g.cloneWith(this.#k.node,{nulls:"last"})})}nullsFirst(){return new Lk({node:g.cloneWith(this.#k.node,{nulls:"first"})})}collate(k){return new Lk({node:g.cloneWith(this.#k.node,{collation:eW.create(k)})})}toOperationNode(){return this.#k.node}}function RW(k){return k==="asc"||k==="desc"}function B(k){if(k.length===2)return[mW(k[0],k[1])];if(k.length===1){let[W]=k;if(Array.isArray(W))return fk("orderBy(array) is deprecated, use multiple orderBy calls instead."),W.map(($)=>mW($));return[mW(W)]}throw Error(`Invalid number of arguments at order by! expected 1-2, received ${k.length}`)}function mW(k,W){let $=ph(k);if(g.is($)){if(W)throw Error("Cannot specify direction twice!");return $}return kh($,W)}function ph(k){if(Wk(k))return p(k);if($W(k))return k.toOperationNode();let[W,$]=k.split(" ");if($)return fk("`orderBy('column asc')` is deprecated. Use `orderBy('column', 'asc')` instead."),kh(t(W),$);return t(k)}function kh(k,W){if(typeof W==="string"){if(!RW(W))throw Error(`Invalid order by direction: ${W}`);return g.create(k,v.createWithSql(W))}if(ok(W))return fk("`orderBy(..., expr)` is deprecated. Use `orderBy(..., 'asc')` or `orderBy(..., (ob) => ...)` instead."),g.create(k,W.toOperationNode());let $=g.create(k);if(!W)return $;return W(new Lk({node:$})).toOperationNode()}var Wh=h({is(k){return k.kind==="PartitionByItemNode"},create(k){return h({kind:"PartitionByItemNode",partitionBy:k})}});function hh(k){return Gk(k).map(Wh.create)}class Ck{#k;constructor(k){this.#k=h(k)}orderBy(...k){return new Ck({overNode:xk.cloneWithOrderByItems(this.#k.overNode,B(k))})}clearOrderBy(){return new Ck({overNode:K.cloneWithoutOrderBy(this.#k.overNode)})}partitionBy(k){return new Ck({overNode:xk.cloneWithPartitionByItems(this.#k.overNode,hh(k))})}$call(k){return k(this)}toOperationNode(){return this.#k.overNode}}var Sk=h({is(k){return k.kind==="SelectionNode"},create(k){return h({kind:"SelectionNode",selection:k})},createSelectAll(){return h({kind:"SelectionNode",selection:pk.create()})},createSelectAllFromTable(k){return h({kind:"SelectionNode",selection:Ak.createSelectAll(k)})}});class oh{#k;get table(){return this.#k}constructor(k){this.#k=k}as(k){return new $h(this.#k,k)}}class $h{#k;#W;get table(){return this.#k}get alias(){return this.#W}constructor(k,W){this.#k=k,this.#W=W}toOperationNode(){return I.create(F(this.#k),J.create(this.#W))}}function Mh(k){return kk(k)&&z(k)&&V(k.table)&&V(k.alias)}function n(k){if(j(k))return k.map((W)=>wk(W));else return[wk(k)]}function wk(k){if(V(k))return fW(k);else if(Mh(k))return k.toOperationNode();else return MW(k)}function fW(k){if(k.includes(" as ")){let[$,M]=k.split(" as ").map(Kh);return I.create(F($),J.create(M))}else return F(k)}function F(k){if(k.includes(".")){let[$,M]=k.split(".").map(Kh);return zk.createWithSchema($,M)}else return zk.create(k)}function Kh(k){return k.trim()}function A(k){if(_(k))return A(k(d()));else if(j(k))return k.map((W)=>Gh(W));else return[Gh(k)]}function Gh(k){if(V(k))return Sk.create(Zh(k));else if($W(k))return Sk.create(k.toOperationNode());else return Sk.create(MW(k))}function R(k){if(!k)return[Sk.createSelectAll()];else if(Array.isArray(k))return k.map(Hh);else return[Hh(k)]}function Hh(k){if(V(k))return Sk.createSelectAllFromTable(F(k));throw Error(`invalid value selectAll expression: ${JSON.stringify(k)}`)}var Yh=h({is(k){return k.kind==="ValuesNode"},create(k){return h({kind:"ValuesNode",values:h(k)})}});var Xh=h({is(k){return k.kind==="DefaultInsertValueNode"},create(){return h({kind:"DefaultInsertValueNode"})}});function KW(k){let W=_(k)?k(d()):k,$=j(W)?W:h([W]);return sh($)}function sh(k){let W=rh(k);return[h([...W.keys()].map(S.create)),Yh.create(k.map(($)=>eh($,W)))]}function rh(k){let W=new Map;for(let $ of k){let M=Object.keys($);for(let G of M)if(!W.has(G)&&$[G]!==void 0)W.set(G,W.size)}return W}function eh(k,W){let $=Object.keys(k),M=Array.from({length:W.size}),G=!1,q=$.length;for(let ak of $){let Nk=W.get(ak);if(c(Nk)){q--;continue}let qW=k[ak];if(c(qW)||Wk(qW))G=!0;M[Nk]=qW}if(q<W.size||G){let ak=Xh.create();return rk.create(M.map((Nk)=>c(Nk)?ak:X(Nk)))}return sk.create(M)}var CW=h({is(k){return k.kind==="ColumnUpdateNode"},create(k,W){return h({kind:"ColumnUpdateNode",column:k,value:W})}});function Dh(...k){if(k.length===2)return[CW.create(f(k[0]),X(k[1]))];return ck(k[0])}function ck(k){let W=_(k)?k(d()):k;return Object.entries(W).filter(([$,M])=>M!==void 0).map(([$,M])=>{return CW.create(S.create($),X(M))})}var Lh=h({is(k){return k.kind==="OnDuplicateKeyNode"},create(k){return h({kind:"OnDuplicateKeyNode",updates:k})}});class SW{insertId;numInsertedOrUpdatedRows;constructor(k,W){this.insertId=k,this.numInsertedOrUpdatedRows=W}}class u extends Error{node;constructor(k){super("no result");this.node=k}}function s(k){return Object.prototype.hasOwnProperty.call(k,"prototype")}var E=h({is(k){return k.kind==="OnConflictNode"},create(){return h({kind:"OnConflictNode"})},cloneWith(k,W){return h({...k,...W})},cloneWithIndexWhere(k,W){return h({...k,indexWhere:k.indexWhere?C.cloneWithOperation(k.indexWhere,"And",W):C.create(W)})},cloneWithIndexOrWhere(k,W){return h({...k,indexWhere:k.indexWhere?C.cloneWithOperation(k.indexWhere,"Or",W):C.create(W)})},cloneWithUpdateWhere(k,W){return h({...k,updateWhere:k.updateWhere?C.cloneWithOperation(k.updateWhere,"And",W):C.create(W)})},cloneWithUpdateOrWhere(k,W){return h({...k,updateWhere:k.updateWhere?C.cloneWithOperation(k.updateWhere,"Or",W):C.create(W)})},cloneWithoutIndexWhere(k){return h({...k,indexWhere:void 0})},cloneWithoutUpdateWhere(k){return h({...k,updateWhere:void 0})}});class r{#k;constructor(k){this.#k=h(k)}column(k){let W=S.create(k);return new r({...this.#k,onConflictNode:E.cloneWith(this.#k.onConflictNode,{columns:this.#k.onConflictNode.columns?h([...this.#k.onConflictNode.columns,W]):h([W])})})}columns(k){let W=k.map(S.create);return new r({...this.#k,onConflictNode:E.cloneWith(this.#k.onConflictNode,{columns:this.#k.onConflictNode.columns?h([...this.#k.onConflictNode.columns,...W]):h(W)})})}constraint(k){return new r({...this.#k,onConflictNode:E.cloneWith(this.#k.onConflictNode,{constraint:J.create(k)})})}expression(k){return new r({...this.#k,onConflictNode:E.cloneWith(this.#k.onConflictNode,{indexExpression:k.toOperationNode()})})}where(...k){return new r({...this.#k,onConflictNode:E.cloneWithIndexWhere(this.#k.onConflictNode,L(k))})}whereRef(k,W,$){return new r({...this.#k,onConflictNode:E.cloneWithIndexWhere(this.#k.onConflictNode,m(k,W,$))})}clearWhere(){return new r({...this.#k,onConflictNode:E.cloneWithoutIndexWhere(this.#k.onConflictNode)})}doNothing(){return new zh({...this.#k,onConflictNode:E.cloneWith(this.#k.onConflictNode,{doNothing:!0})})}doUpdateSet(k){return new yk({...this.#k,onConflictNode:E.cloneWith(this.#k.onConflictNode,{updates:ck(k)})})}$call(k){return k(this)}}class zh{#k;constructor(k){this.#k=h(k)}toOperationNode(){return this.#k.onConflictNode}}class yk{#k;constructor(k){this.#k=h(k)}where(...k){return new yk({...this.#k,onConflictNode:E.cloneWithUpdateWhere(this.#k.onConflictNode,L(k))})}whereRef(k,W,$){return new yk({...this.#k,onConflictNode:E.cloneWithUpdateWhere(this.#k.onConflictNode,m(k,W,$))})}clearWhere(){return new yk({...this.#k,onConflictNode:E.cloneWithoutUpdateWhere(this.#k.onConflictNode)})}$call(k){return k(this)}toOperationNode(){return this.#k.onConflictNode}}var Jh=h({is(k){return k.kind==="TopNode"},create(k,W){return h({kind:"TopNode",expression:k,modifiers:W})}});function i(k,W){if(!_k(k)&&!GW(k))throw Error(`Invalid top expression: ${k}`);if(!c(W)&&!k$(W))throw Error(`Invalid top modifiers: ${W}`);return Jh.create(k,W)}function k$(k){return k==="percent"||k==="with ties"||k==="percent with ties"}var Fk=h({is(k){return k.kind==="OrActionNode"},create(k){return h({kind:"OrActionNode",action:k})}});class D{#k;constructor(k){this.#k=h(k)}values(k){let[W,$]=KW(k);return new D({...this.#k,queryNode:w.cloneWith(this.#k.queryNode,{columns:W,values:$})})}columns(k){return new D({...this.#k,queryNode:w.cloneWith(this.#k.queryNode,{columns:h(k.map(S.create))})})}expression(k){return new D({...this.#k,queryNode:w.cloneWith(this.#k.queryNode,{values:p(k)})})}defaultValues(){return new D({...this.#k,queryNode:w.cloneWith(this.#k.queryNode,{defaultValues:!0})})}modifyEnd(k){return new D({...this.#k,queryNode:K.cloneWithEndModifier(this.#k.queryNode,k.toOperationNode())})}ignore(){return new D({...this.#k,queryNode:w.cloneWith(this.#k.queryNode,{orAction:Fk.create("ignore")})})}orIgnore(){return new D({...this.#k,queryNode:w.cloneWith(this.#k.queryNode,{orAction:Fk.create("ignore")})})}orAbort(){return new D({...this.#k,queryNode:w.cloneWith(this.#k.queryNode,{orAction:Fk.create("abort")})})}orFail(){return new D({...this.#k,queryNode:w.cloneWith(this.#k.queryNode,{orAction:Fk.create("fail")})})}orReplace(){return new D({...this.#k,queryNode:w.cloneWith(this.#k.queryNode,{orAction:Fk.create("replace")})})}orRollback(){return new D({...this.#k,queryNode:w.cloneWith(this.#k.queryNode,{orAction:Fk.create("rollback")})})}top(k,W){return new D({...this.#k,queryNode:K.cloneWithTop(this.#k.queryNode,i(k,W))})}onConflict(k){return new D({...this.#k,queryNode:w.cloneWith(this.#k.queryNode,{onConflict:k(new r({onConflictNode:E.create()})).toOperationNode()})})}onDuplicateKeyUpdate(k){return new D({...this.#k,queryNode:w.cloneWith(this.#k.queryNode,{onDuplicateKey:Lh.create(ck(k))})})}returning(k){return new D({...this.#k,queryNode:K.cloneWithReturning(this.#k.queryNode,A(k))})}returningAll(){return new D({...this.#k,queryNode:K.cloneWithReturning(this.#k.queryNode,R())})}output(k){return new D({...this.#k,queryNode:K.cloneWithOutput(this.#k.queryNode,A(k))})}outputAll(k){return new D({...this.#k,queryNode:K.cloneWithOutput(this.#k.queryNode,R(k))})}clearReturning(){return new D({...this.#k,queryNode:K.cloneWithoutReturning(this.#k.queryNode)})}$call(k){return k(this)}$if(k,W){if(k)return W(this);return new D({...this.#k})}$castTo(){return new D(this.#k)}$narrowType(){return new D(this.#k)}$assertType(){return new D(this.#k)}withPlugin(k){return new D({...this.#k,executor:this.#k.executor.withPlugin(k)})}toOperationNode(){return this.#k.executor.transformQuery(this.#k.queryNode,this.#k.queryId)}compile(){return this.#k.executor.compileQuery(this.toOperationNode(),this.#k.queryId)}async execute(){let k=this.compile(),W=await this.#k.executor.executeQuery(k),{adapter:$}=this.#k.executor,M=k.query;if(M.returning&&$.supportsReturning||M.output&&$.supportsOutput)return W.rows;return[new SW(W.insertId,W.numAffectedRows??BigInt(0))]}async executeTakeFirst(){let[k]=await this.execute();return k}async executeTakeFirstOrThrow(k=u){let W=await this.executeTakeFirst();if(W===void 0)throw s(k)?new k(this.toOperationNode()):k(this.toOperationNode());return W}async*stream(k=100){let W=this.compile(),$=this.#k.executor.stream(W,k);for await(let M of $)yield*M.rows}async explain(k,W){return await new D({...this.#k,queryNode:K.cloneWithExplain(this.#k.queryNode,k,W)}).execute()}}class IW{numDeletedRows;constructor(k){this.numDeletedRows=k}}var Ik=h({is(k){return k.kind==="LimitNode"},create(k){return h({kind:"LimitNode",limit:k})}});var P;class HW{#k;constructor(k){this.#k=h(k)}where(...k){return new P({...this.#k,queryNode:K.cloneWithWhere(this.#k.queryNode,L(k))})}whereRef(k,W,$){return new P({...this.#k,queryNode:K.cloneWithWhere(this.#k.queryNode,m(k,W,$))})}clearWhere(){return new P({...this.#k,queryNode:K.cloneWithoutWhere(this.#k.queryNode)})}top(k,W){return new P({...this.#k,queryNode:K.cloneWithTop(this.#k.queryNode,i(k,W))})}using(k){return new P({...this.#k,queryNode:Dk.cloneWithUsing(this.#k.queryNode,n(k))})}innerJoin(...k){return this.#W("InnerJoin",k)}leftJoin(...k){return this.#W("LeftJoin",k)}rightJoin(...k){return this.#W("RightJoin",k)}fullJoin(...k){return this.#W("FullJoin",k)}#W(k,W){return new P({...this.#k,queryNode:K.cloneWithJoin(this.#k.queryNode,Jk(k,W))})}returning(k){return new P({...this.#k,queryNode:K.cloneWithReturning(this.#k.queryNode,A(k))})}returningAll(k){return new P({...this.#k,queryNode:K.cloneWithReturning(this.#k.queryNode,R(k))})}output(k){return new P({...this.#k,queryNode:K.cloneWithOutput(this.#k.queryNode,A(k))})}outputAll(k){return new P({...this.#k,queryNode:K.cloneWithOutput(this.#k.queryNode,R(k))})}clearReturning(){return new P({...this.#k,queryNode:K.cloneWithoutReturning(this.#k.queryNode)})}clearLimit(){return new P({...this.#k,queryNode:Dk.cloneWithoutLimit(this.#k.queryNode)})}orderBy(...k){return new P({...this.#k,queryNode:K.cloneWithOrderByItems(this.#k.queryNode,B(k))})}clearOrderBy(){return new P({...this.#k,queryNode:K.cloneWithoutOrderBy(this.#k.queryNode)})}limit(k){return new P({...this.#k,queryNode:Dk.cloneWithLimit(this.#k.queryNode,Ik.create(X(k)))})}modifyEnd(k){return new P({...this.#k,queryNode:K.cloneWithEndModifier(this.#k.queryNode,k.toOperationNode())})}$call(k){return k(this)}$if(k,W){if(k)return W(this);return new P({...this.#k})}$castTo(){return new P(this.#k)}$narrowType(){return new P(this.#k)}$assertType(){return new P(this.#k)}withPlugin(k){return new P({...this.#k,executor:this.#k.executor.withPlugin(k)})}toOperationNode(){return this.#k.executor.transformQuery(this.#k.queryNode,this.#k.queryId)}compile(){return this.#k.executor.compileQuery(this.toOperationNode(),this.#k.queryId)}async execute(){let k=this.compile(),W=await this.#k.executor.executeQuery(k),{adapter:$}=this.#k.executor,M=k.query;if(M.returning&&$.supportsReturning||M.output&&$.supportsOutput)return W.rows;return[new IW(W.numAffectedRows??BigInt(0))]}async executeTakeFirst(){let[k]=await this.execute();return k}async executeTakeFirstOrThrow(k=u){let W=await this.executeTakeFirst();if(W===void 0)throw s(k)?new k(this.toOperationNode()):k(this.toOperationNode());return W}async*stream(k=100){let W=this.compile(),$=this.#k.executor.stream(W,k);for await(let M of $)yield*M.rows}async explain(k,W){return await new P({...this.#k,queryNode:K.cloneWithExplain(this.#k.queryNode,k,W)}).execute()}}P=HW;class jW{numUpdatedRows;numChangedRows;constructor(k,W){this.numUpdatedRows=k,this.numChangedRows=W}}var U;class jk{#k;constructor(k){this.#k=h(k)}where(...k){return new U({...this.#k,queryNode:K.cloneWithWhere(this.#k.queryNode,L(k))})}whereRef(k,W,$){return new U({...this.#k,queryNode:K.cloneWithWhere(this.#k.queryNode,m(k,W,$))})}clearWhere(){return new U({...this.#k,queryNode:K.cloneWithoutWhere(this.#k.queryNode)})}top(k,W){return new U({...this.#k,queryNode:K.cloneWithTop(this.#k.queryNode,i(k,W))})}from(k){return new U({...this.#k,queryNode:o.cloneWithFromItems(this.#k.queryNode,n(k))})}innerJoin(...k){return this.#W("InnerJoin",k)}leftJoin(...k){return this.#W("LeftJoin",k)}rightJoin(...k){return this.#W("RightJoin",k)}fullJoin(...k){return this.#W("FullJoin",k)}#W(k,W){return new U({...this.#k,queryNode:K.cloneWithJoin(this.#k.queryNode,Jk(k,W))})}orderBy(...k){return new U({...this.#k,queryNode:K.cloneWithOrderByItems(this.#k.queryNode,B(k))})}clearOrderBy(){return new U({...this.#k,queryNode:K.cloneWithoutOrderBy(this.#k.queryNode)})}limit(k){return new U({...this.#k,queryNode:o.cloneWithLimit(this.#k.queryNode,Ik.create(X(k)))})}set(...k){return new U({...this.#k,queryNode:o.cloneWithUpdates(this.#k.queryNode,Dh(...k))})}returning(k){return new U({...this.#k,queryNode:K.cloneWithReturning(this.#k.queryNode,A(k))})}returningAll(k){return new U({...this.#k,queryNode:K.cloneWithReturning(this.#k.queryNode,R(k))})}output(k){return new U({...this.#k,queryNode:K.cloneWithOutput(this.#k.queryNode,A(k))})}outputAll(k){return new U({...this.#k,queryNode:K.cloneWithOutput(this.#k.queryNode,R(k))})}modifyEnd(k){return new U({...this.#k,queryNode:K.cloneWithEndModifier(this.#k.queryNode,k.toOperationNode())})}clearReturning(){return new U({...this.#k,queryNode:K.cloneWithoutReturning(this.#k.queryNode)})}$call(k){return k(this)}$if(k,W){if(k)return W(this);return new U({...this.#k})}$castTo(){return new U(this.#k)}$narrowType(){return new U(this.#k)}$assertType(){return new U(this.#k)}withPlugin(k){return new U({...this.#k,executor:this.#k.executor.withPlugin(k)})}toOperationNode(){return this.#k.executor.transformQuery(this.#k.queryNode,this.#k.queryId)}compile(){return this.#k.executor.compileQuery(this.toOperationNode(),this.#k.queryId)}async execute(){let k=this.compile(),W=await this.#k.executor.executeQuery(k),{adapter:$}=this.#k.executor,M=k.query;if(M.returning&&$.supportsReturning||M.output&&$.supportsOutput)return W.rows;return[new jW(W.numAffectedRows??BigInt(0),W.numChangedRows)]}async executeTakeFirst(){let[k]=await this.execute();return k}async executeTakeFirstOrThrow(k=u){let W=await this.executeTakeFirst();if(W===void 0)throw s(k)?new k(this.toOperationNode()):k(this.toOperationNode());return W}async*stream(k=100){let W=this.compile(),$=this.#k.executor.stream(W,k);for await(let M of $)yield*M.rows}async explain(k,W){return await new U({...this.#k,queryNode:K.cloneWithExplain(this.#k.queryNode,k,W)}).execute()}}U=jk;var EW=h({is(k){return k.kind==="CommonTableExpressionNameNode"},create(k,W){return h({kind:"CommonTableExpressionNameNode",table:zk.create(k),columns:W?h(W.map(S.create)):void 0})}});var Ek=h({is(k){return k.kind==="CommonTableExpressionNode"},create(k,W){return h({kind:"CommonTableExpressionNode",name:k,expression:W})},cloneWith(k,W){return h({...k,...W})}});class gk{#k;constructor(k){this.#k=h(k)}materialized(){return new gk({...this.#k,node:Ek.cloneWith(this.#k.node,{materialized:!0})})}notMaterialized(){return new gk({...this.#k,node:Ek.cloneWith(this.#k.node,{materialized:!1})})}toOperationNode(){return this.#k.node}}function OW(k,W){let $=W(Ph()).toOperationNode();if(_(k))return k(W$($)).toOperationNode();return Ek.create(qh(k),$)}function W$(k){return(W)=>{return new gk({node:Ek.create(qh(W),k)})}}function qh(k){if(k.includes("(")){let W=k.split(/[\(\)]/),$=W[0],M=W[1].split(",").map((G)=>G.trim());return EW.create($,M)}else return EW.create(k)}var tk=h({is(k){return k.kind==="WithNode"},create(k,W){return h({kind:"WithNode",expressions:h([k]),...W})},cloneWithExpression(k,W){return h({...k,expressions:h([...k.expressions,W])})}});var Uh=["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 Vh(k){let W="";for(let $=0;$<k;++$)W+=h$();return W}function h$(){return Uh[~~(Math.random()*Uh.length)]}function T(){return new wh}class wh{#k;get queryId(){if(this.#k===void 0)this.#k=Vh(8);return this.#k}}var Fh=h({is(k){return k.kind==="MatchedNode"},create(k,W=!1){return h({kind:"MatchedNode",not:k,bySource:W})}});function bW(k,W,$){return Mk.create(mk([Fh.create(!k.isMatched,k.bySource),...W&&W.length>0?[W.length===3&&$?m(W[0],W[1],W[2]):L(W)]:[]],"and",!1))}function Ok(k){if(V(k))return v.create([k],[]);if(z(k))return k.toOperationNode();return k}class ZW{#k;#W;#h;constructor(){this.#k=new Promise((k,W)=>{this.#h=W,this.#W=k})}get promise(){return this.#k}resolve=(k)=>{if(this.#W)this.#W(k)};reject=(k)=>{if(this.#h)this.#h(k)}}async function Th(k){let W=new ZW,$=new ZW;return k.provideConnection(async(M)=>{return W.resolve(M),await $.promise}).catch((M)=>W.reject(M)),h({connection:await W.promise,release:$.resolve})}var $$=h([]);class QW{#k;constructor(k=$$){this.#k=k}get plugins(){return this.#k}transformQuery(k,W){for(let $ of this.#k){let M=$.transformQuery({node:k,queryId:W});if(M.kind===k.kind)k=M;else throw Error(["KyselyPlugin.transformQuery must return a node","of the same kind that was given to it.",`The plugin was given a ${k.kind}`,`but it returned a ${M.kind}`].join(" "))}return k}async executeQuery(k){return await this.provideConnection(async(W)=>{let $=await W.executeQuery(k);if("numUpdatedOrDeletedRows"in $)fk("kysely:warning: outdated driver/plugin detected! `QueryResult.numUpdatedOrDeletedRows` has been replaced with `QueryResult.numAffectedRows`.");return await this.#W($,k.queryId)})}async*stream(k,W){let{connection:$,release:M}=await Th(this);try{for await(let G of $.streamQuery(k,W))yield await this.#W(G,k.queryId)}finally{M()}}async#W(k,W){for(let $ of this.#k)k=await $.transformResult({result:k,queryId:W});return k}}class bk extends QW{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(k){return new bk([...this.plugins,k])}withPlugins(k){return new bk([...this.plugins,...k])}withPluginAtFront(k){return new bk([k,...this.plugins])}withoutPlugins(){return new bk([])}}var qk=new bk;class NW{numChangedRows;constructor(k){this.numChangedRows=k}}class Hk{#k;constructor(k){this.#k=h(k)}modifyEnd(k){return new Hk({...this.#k,queryNode:K.cloneWithEndModifier(this.#k.queryNode,k.toOperationNode())})}top(k,W){return new Hk({...this.#k,queryNode:K.cloneWithTop(this.#k.queryNode,i(k,W))})}using(...k){return new O({...this.#k,queryNode:N.cloneWithUsing(this.#k.queryNode,Jk("Using",k))})}returning(k){return new Hk({...this.#k,queryNode:K.cloneWithReturning(this.#k.queryNode,A(k))})}returningAll(k){return new Hk({...this.#k,queryNode:K.cloneWithReturning(this.#k.queryNode,R(k))})}output(k){return new Hk({...this.#k,queryNode:K.cloneWithOutput(this.#k.queryNode,A(k))})}outputAll(k){return new Hk({...this.#k,queryNode:K.cloneWithOutput(this.#k.queryNode,R(k))})}}class O{#k;constructor(k){this.#k=h(k)}modifyEnd(k){return new O({...this.#k,queryNode:K.cloneWithEndModifier(this.#k.queryNode,k.toOperationNode())})}top(k,W){return new O({...this.#k,queryNode:K.cloneWithTop(this.#k.queryNode,i(k,W))})}whenMatched(){return this.#W([])}whenMatchedAnd(...k){return this.#W(k)}whenMatchedAndRef(k,W,$){return this.#W([k,W,$],!0)}#W(k,W){return new BW({...this.#k,queryNode:N.cloneWithWhen(this.#k.queryNode,bW({isMatched:!0},k,W))})}whenNotMatched(){return this.#h([])}whenNotMatchedAnd(...k){return this.#h(k)}whenNotMatchedAndRef(k,W,$){return this.#h([k,W,$],!0)}whenNotMatchedBySource(){return this.#h([],!1,!0)}whenNotMatchedBySourceAnd(...k){return this.#h(k,!1,!0)}whenNotMatchedBySourceAndRef(k,W,$){return this.#h([k,W,$],!0,!0)}returning(k){return new O({...this.#k,queryNode:K.cloneWithReturning(this.#k.queryNode,A(k))})}returningAll(k){return new O({...this.#k,queryNode:K.cloneWithReturning(this.#k.queryNode,R(k))})}output(k){return new O({...this.#k,queryNode:K.cloneWithOutput(this.#k.queryNode,A(k))})}outputAll(k){return new O({...this.#k,queryNode:K.cloneWithOutput(this.#k.queryNode,R(k))})}#h(k,W=!1,$=!1){let M={...this.#k,queryNode:N.cloneWithWhen(this.#k.queryNode,bW({isMatched:!1,bySource:$},k,W))};return new($?BW:vh)(M)}$call(k){return k(this)}$if(k,W){if(k)return W(this);return new O({...this.#k})}toOperationNode(){return this.#k.executor.transformQuery(this.#k.queryNode,this.#k.queryId)}compile(){return this.#k.executor.compileQuery(this.toOperationNode(),this.#k.queryId)}async execute(){let k=this.compile(),W=await this.#k.executor.executeQuery(k),{adapter:$}=this.#k.executor,M=k.query;if(M.returning&&$.supportsReturning||M.output&&$.supportsOutput)return W.rows;return[new NW(W.numAffectedRows)]}async executeTakeFirst(){let[k]=await this.execute();return k}async executeTakeFirstOrThrow(k=u){let W=await this.executeTakeFirst();if(W===void 0)throw s(k)?new k(this.toOperationNode()):k(this.toOperationNode());return W}}class BW{#k;constructor(k){this.#k=h(k)}thenDelete(){return new O({...this.#k,queryNode:N.cloneWithThen(this.#k.queryNode,Ok("delete"))})}thenDoNothing(){return new O({...this.#k,queryNode:N.cloneWithThen(this.#k.queryNode,Ok("do nothing"))})}thenUpdate(k){return new O({...this.#k,queryNode:N.cloneWithThen(this.#k.queryNode,Ok(k(new jk({queryId:this.#k.queryId,executor:qk,queryNode:o.createWithoutTable()}))))})}thenUpdateSet(...k){return this.thenUpdate((W)=>W.set(...k))}}class vh{#k;constructor(k){this.#k=h(k)}thenDoNothing(){return new O({...this.#k,queryNode:N.cloneWithThen(this.#k.queryNode,Ok("do nothing"))})}thenInsertValues(k){let[W,$]=KW(k);return new O({...this.#k,queryNode:N.cloneWithThen(this.#k.queryNode,Ok(w.cloneWith(w.createWithoutInto(),{columns:W,values:$})))})}}class Pk{#k;constructor(k){this.#k=h(k)}selectFrom(k){return nk({queryId:T(),executor:this.#k.executor,queryNode:Y.createFrom(n(k),this.#k.withNode)})}selectNoFrom(k){return nk({queryId:T(),executor:this.#k.executor,queryNode:Y.cloneWithSelections(Y.create(this.#k.withNode),A(k))})}insertInto(k){return new D({queryId:T(),executor:this.#k.executor,queryNode:w.create(F(k),this.#k.withNode)})}replaceInto(k){return new D({queryId:T(),executor:this.#k.executor,queryNode:w.create(F(k),this.#k.withNode,!0)})}deleteFrom(k){return new HW({queryId:T(),executor:this.#k.executor,queryNode:Dk.create(n(k),this.#k.withNode)})}updateTable(k){return new jk({queryId:T(),executor:this.#k.executor,queryNode:o.create(n(k),this.#k.withNode)})}mergeInto(k){return new Hk({queryId:T(),executor:this.#k.executor,queryNode:N.create(fW(k),this.#k.withNode)})}with(k,W){let $=OW(k,W);return new Pk({...this.#k,withNode:this.#k.withNode?tk.cloneWithExpression(this.#k.withNode,$):tk.create($)})}withRecursive(k,W){let $=OW(k,W);return new Pk({...this.#k,withNode:this.#k.withNode?tk.cloneWithExpression(this.#k.withNode,$):tk.create($,{recursive:!0})})}withPlugin(k){return new Pk({...this.#k,executor:this.#k.executor.withPlugin(k)})}withoutPlugins(){return new Pk({...this.#k,executor:this.#k.executor.withoutPlugins()})}withSchema(k){return new Pk({...this.#k,executor:this.#k.executor.withPluginAtFront(new YW(k))})}}function Ph(){return new Pk({executor:qk})}function Ah(k,W){return new Rk({joinNode:Kk.create(k,wk(W))})}function _h(){return new Ck({overNode:xk.create()})}function Jk(k,W){if(W.length===3)return K$(k,W[0],W[1],W[2]);else if(W.length===2)return M$(k,W[0],W[1]);else if(W.length===1)return G$(k,W[0]);else throw Error("not implemented")}function M$(k,W,$){return $(Ah(k,W)).toOperationNode()}function K$(k,W,$,M){return Kk.createWithOn(k,wk(W),m($,"=",M))}function G$(k,W){return Kk.create(k,wk(W))}var mh=h({is(k){return k.kind==="OffsetNode"},create(k){return h({kind:"OffsetNode",offset:k})}});var Rh=h({is(k){return k.kind==="GroupByItemNode"},create(k){return h({kind:"GroupByItemNode",groupBy:k})}});function fh(k){return k=_(k)?k(d()):k,Gk(k).map(Rh.create)}function Tk(k,W,$){if(_(W))W=W(XW());if(!j(W))W=[W];return W.map((M)=>Ch.create(k,p(M),$))}class Z{#k;constructor(k){this.#k=k}get expressionType(){return}as(k){return new zW(this,k)}or(...k){return new DW(hk.create(this.#k,L(k)))}and(...k){return new LW(x.create(this.#k,L(k)))}$castTo(){return new Z(this.#k)}$notNull(){return new Z(this.#k)}toOperationNode(){return this.#k}}class zW{#k;#W;constructor(k,W){this.#k=k,this.#W=W}get expression(){return this.#k}get alias(){return this.#W}toOperationNode(){return I.create(this.#k.toOperationNode(),z(this.#W)?this.#W.toOperationNode():J.create(this.#W))}}class DW{#k;constructor(k){this.#k=k}get expressionType(){return}as(k){return new zW(this,k)}or(...k){return new DW(hk.create(this.#k,L(k)))}$castTo(){return new DW(this.#k)}toOperationNode(){return Xk.create(this.#k)}}class LW{#k;constructor(k){this.#k=k}get expressionType(){return}as(k){return new zW(this,k)}and(...k){return new LW(x.create(this.#k,L(k)))}$castTo(){return new LW(this.#k)}toOperationNode(){return Xk.create(this.#k)}}var Sh=h({is(k){return k.kind==="FetchNode"},create(k,W){return{kind:"FetchNode",rowCount:Q.create(k),modifier:W}}});function Ih(k,W){if(!_k(k)&&!GW(k))throw Error(`Invalid fetch row count: ${k}`);if(!H$(W))throw Error(`Invalid fetch modifier: ${W}`);return Sh.create(k,W)}function H$(k){return k==="only"||k==="with ties"}var H;class xW{#k;constructor(k){this.#k=h(k)}get expressionType(){return}get isSelectQueryBuilder(){return!0}where(...k){return new H({...this.#k,queryNode:K.cloneWithWhere(this.#k.queryNode,L(k))})}whereRef(k,W,$){return new H({...this.#k,queryNode:K.cloneWithWhere(this.#k.queryNode,m(k,W,$))})}having(...k){return new H({...this.#k,queryNode:Y.cloneWithHaving(this.#k.queryNode,L(k))})}havingRef(k,W,$){return new H({...this.#k,queryNode:Y.cloneWithHaving(this.#k.queryNode,m(k,W,$))})}select(k){return new H({...this.#k,queryNode:Y.cloneWithSelections(this.#k.queryNode,A(k))})}distinctOn(k){return new H({...this.#k,queryNode:Y.cloneWithDistinctOn(this.#k.queryNode,Gk(k))})}modifyFront(k){return new H({...this.#k,queryNode:Y.cloneWithFrontModifier(this.#k.queryNode,a.createWithExpression(k.toOperationNode()))})}modifyEnd(k){return new H({...this.#k,queryNode:K.cloneWithEndModifier(this.#k.queryNode,a.createWithExpression(k.toOperationNode()))})}distinct(){return new H({...this.#k,queryNode:Y.cloneWithFrontModifier(this.#k.queryNode,a.create("Distinct"))})}forUpdate(k){return new H({...this.#k,queryNode:K.cloneWithEndModifier(this.#k.queryNode,a.create("ForUpdate",k?dk(k).map(F):void 0))})}forShare(k){return new H({...this.#k,queryNode:K.cloneWithEndModifier(this.#k.queryNode,a.create("ForShare",k?dk(k).map(F):void 0))})}forKeyShare(k){return new H({...this.#k,queryNode:K.cloneWithEndModifier(this.#k.queryNode,a.create("ForKeyShare",k?dk(k).map(F):void 0))})}forNoKeyUpdate(k){return new H({...this.#k,queryNode:K.cloneWithEndModifier(this.#k.queryNode,a.create("ForNoKeyUpdate",k?dk(k).map(F):void 0))})}skipLocked(){return new H({...this.#k,queryNode:K.cloneWithEndModifier(this.#k.queryNode,a.create("SkipLocked"))})}noWait(){return new H({...this.#k,queryNode:K.cloneWithEndModifier(this.#k.queryNode,a.create("NoWait"))})}selectAll(k){return new H({...this.#k,queryNode:Y.cloneWithSelections(this.#k.queryNode,R(k))})}innerJoin(...k){return this.#W("InnerJoin",k)}leftJoin(...k){return this.#W("LeftJoin",k)}rightJoin(...k){return this.#W("RightJoin",k)}fullJoin(...k){return this.#W("FullJoin",k)}crossJoin(...k){return this.#W("CrossJoin",k)}innerJoinLateral(...k){return this.#W("LateralInnerJoin",k)}leftJoinLateral(...k){return this.#W("LateralLeftJoin",k)}crossJoinLateral(...k){return this.#W("LateralCrossJoin",k)}crossApply(...k){return this.#W("CrossApply",k)}outerApply(...k){return this.#W("OuterApply",k)}#W(k,W){return new H({...this.#k,queryNode:K.cloneWithJoin(this.#k.queryNode,Jk(k,W))})}orderBy(...k){return new H({...this.#k,queryNode:K.cloneWithOrderByItems(this.#k.queryNode,B(k))})}groupBy(k){return new H({...this.#k,queryNode:Y.cloneWithGroupByItems(this.#k.queryNode,fh(k))})}limit(k){return new H({...this.#k,queryNode:Y.cloneWithLimit(this.#k.queryNode,Ik.create(X(k)))})}offset(k){return new H({...this.#k,queryNode:Y.cloneWithOffset(this.#k.queryNode,mh.create(X(k)))})}fetch(k,W="only"){return new H({...this.#k,queryNode:Y.cloneWithFetch(this.#k.queryNode,Ih(k,W))})}top(k,W){return new H({...this.#k,queryNode:K.cloneWithTop(this.#k.queryNode,i(k,W))})}union(k){return new H({...this.#k,queryNode:Y.cloneWithSetOperations(this.#k.queryNode,Tk("union",k,!1))})}unionAll(k){return new H({...this.#k,queryNode:Y.cloneWithSetOperations(this.#k.queryNode,Tk("union",k,!0))})}intersect(k){return new H({...this.#k,queryNode:Y.cloneWithSetOperations(this.#k.queryNode,Tk("intersect",k,!1))})}intersectAll(k){return new H({...this.#k,queryNode:Y.cloneWithSetOperations(this.#k.queryNode,Tk("intersect",k,!0))})}except(k){return new H({...this.#k,queryNode:Y.cloneWithSetOperations(this.#k.queryNode,Tk("except",k,!1))})}exceptAll(k){return new H({...this.#k,queryNode:Y.cloneWithSetOperations(this.#k.queryNode,Tk("except",k,!0))})}as(k){return new jh(this,k)}clearSelect(){return new H({...this.#k,queryNode:Y.cloneWithoutSelections(this.#k.queryNode)})}clearWhere(){return new H({...this.#k,queryNode:K.cloneWithoutWhere(this.#k.queryNode)})}clearLimit(){return new H({...this.#k,queryNode:Y.cloneWithoutLimit(this.#k.queryNode)})}clearOffset(){return new H({...this.#k,queryNode:Y.cloneWithoutOffset(this.#k.queryNode)})}clearOrderBy(){return new H({...this.#k,queryNode:K.cloneWithoutOrderBy(this.#k.queryNode)})}clearGroupBy(){return new H({...this.#k,queryNode:Y.cloneWithoutGroupBy(this.#k.queryNode)})}$call(k){return k(this)}$if(k,W){if(k)return W(this);return new H({...this.#k})}$castTo(){return new H(this.#k)}$narrowType(){return new H(this.#k)}$assertType(){return new H(this.#k)}$asTuple(){return new Z(this.toOperationNode())}$asScalar(){return new Z(this.toOperationNode())}withPlugin(k){return new H({...this.#k,executor:this.#k.executor.withPlugin(k)})}toOperationNode(){return this.#k.executor.transformQuery(this.#k.queryNode,this.#k.queryId)}compile(){return this.#k.executor.compileQuery(this.toOperationNode(),this.#k.queryId)}async execute(){let k=this.compile();return(await this.#k.executor.executeQuery(k)).rows}async executeTakeFirst(){let[k]=await this.execute();return k}async executeTakeFirstOrThrow(k=u){let W=await this.executeTakeFirst();if(W===void 0)throw s(k)?new k(this.toOperationNode()):k(this.toOperationNode());return W}async*stream(k=100){let W=this.compile(),$=this.#k.executor.stream(W,k);for await(let M of $)yield*M.rows}async explain(k,W){return await new H({...this.#k,queryNode:K.cloneWithExplain(this.#k.queryNode,k,W)}).execute()}}H=xW;function nk(k){return new xW(k)}class jh{#k;#W;constructor(k,W){this.#k=k,this.#W=W}get expression(){return this.#k}get alias(){return this.#W}get isAliasedSelectQueryBuilder(){return!0}toOperationNode(){return I.create(this.#k.toOperationNode(),J.create(this.#W))}}var e=h({is(k){return k.kind==="AggregateFunctionNode"},create(k,W=[]){return h({kind:"AggregateFunctionNode",func:k,aggregated:W})},cloneWithDistinct(k){return h({...k,distinct:!0})},cloneWithOrderBy(k,W,$=!1){let M=$?"withinGroup":"orderBy";return h({...k,[M]:k[M]?$k.cloneWithItems(k[M],W):$k.create(W)})},cloneWithFilter(k,W){return h({...k,filter:k.filter?C.cloneWithOperation(k.filter,"And",W):C.create(W)})},cloneWithOrFilter(k,W){return h({...k,filter:k.filter?C.cloneWithOperation(k.filter,"Or",W):C.create(W)})},cloneWithOver(k,W){return h({...k,over:W})}});var cW=h({is(k){return k.kind==="FunctionNode"},create(k,W){return h({kind:"FunctionNode",func:k,arguments:W})}});class b{#k;constructor(k){this.#k=h(k)}get expressionType(){return}as(k){return new Eh(this,k)}distinct(){return new b({...this.#k,aggregateFunctionNode:e.cloneWithDistinct(this.#k.aggregateFunctionNode)})}orderBy(...k){return new b({...this.#k,aggregateFunctionNode:K.cloneWithOrderByItems(this.#k.aggregateFunctionNode,B(k))})}clearOrderBy(){return new b({...this.#k,aggregateFunctionNode:K.cloneWithoutOrderBy(this.#k.aggregateFunctionNode)})}withinGroupOrderBy(...k){return new b({...this.#k,aggregateFunctionNode:e.cloneWithOrderBy(this.#k.aggregateFunctionNode,B(k),!0)})}filterWhere(...k){return new b({...this.#k,aggregateFunctionNode:e.cloneWithFilter(this.#k.aggregateFunctionNode,L(k))})}filterWhereRef(k,W,$){return new b({...this.#k,aggregateFunctionNode:e.cloneWithFilter(this.#k.aggregateFunctionNode,m(k,W,$))})}over(k){let W=_h();return new b({...this.#k,aggregateFunctionNode:e.cloneWithOver(this.#k.aggregateFunctionNode,(k?k(W):W).toOperationNode())})}$call(k){return k(this)}$castTo(){return new b(this.#k)}$notNull(){return new b(this.#k)}toOperationNode(){return this.#k.aggregateFunctionNode}}class Eh{#k;#W;constructor(k,W){this.#k=k,this.#W=W}get expression(){return this.#k}get alias(){return this.#W}toOperationNode(){return I.create(this.#k.toOperationNode(),J.create(this.#W))}}function Oh(){let k=($,M)=>{return new Z(cW.create($,Gk(M??[])))},W=($,M)=>{return new b({aggregateFunctionNode:e.create($,M?Gk(M):void 0)})};return Object.assign(k,{agg:W,avg($){return W("avg",[$])},coalesce(...$){return k("coalesce",$)},count($){return W("count",[$])},countAll($){return new b({aggregateFunctionNode:e.create("count",R($))})},max($){return W("max",[$])},min($){return W("min",[$])},sum($){return W("sum",[$])},any($){return k("any",[$])},jsonAgg($){return new b({aggregateFunctionNode:e.create("json_agg",[V($)?F($):$.toOperationNode()])})},toJson($){return new Z(cW.create("to_json",[V($)?F($):$.toOperationNode()]))}})}var bh=h({is(k){return k.kind==="UnaryOperationNode"},create(k,W){return h({kind:"UnaryOperationNode",operator:k,operand:W})}});function Qh(k,W){return bh.create(y.create(k),f(W))}var l=h({is(k){return k.kind==="CaseNode"},create(k){return h({kind:"CaseNode",value:k})},cloneWithWhen(k,W){return h({...k,when:h(k.when?[...k.when,W]:[W])})},cloneWithThen(k,W){return h({...k,when:k.when?h([...k.when.slice(0,-1),Mk.cloneWithResult(k.when[k.when.length-1],W)]):void 0})},cloneWith(k,W){return h({...k,...W})}});class yW{#k;constructor(k){this.#k=h(k)}when(...k){return new gW({...this.#k,node:l.cloneWithWhen(this.#k.node,Mk.create(L(k)))})}}class gW{#k;constructor(k){this.#k=h(k)}then(k){return new Nh({...this.#k,node:l.cloneWithThen(this.#k.node,WW(k)?Bk(k):X(k))})}}class Nh{#k;constructor(k){this.#k=h(k)}when(...k){return new gW({...this.#k,node:l.cloneWithWhen(this.#k.node,Mk.create(L(k)))})}else(k){return new Bh({...this.#k,node:l.cloneWith(this.#k.node,{else:WW(k)?Bk(k):X(k)})})}end(){return new Z(l.cloneWith(this.#k.node,{isStatement:!1}))}endCase(){return new Z(l.cloneWith(this.#k.node,{isStatement:!0}))}}class Bh{#k;constructor(k){this.#k=h(k)}end(){return new Z(l.cloneWith(this.#k.node,{isStatement:!1}))}endCase(){return new Z(l.cloneWith(this.#k.node,{isStatement:!0}))}}var JW=h({is(k){return k.kind==="JSONOperatorChainNode"},create(k){return h({kind:"JSONOperatorChainNode",operator:k,values:h([])})},cloneWithValue(k,W){return h({...k,values:h([...k.values,W])})}});var tW=h({is(k){return k.kind==="JSONPathLegNode"},create(k,W){return h({kind:"JSONPathLegNode",type:k,value:W})}});var Uk=h({is(k){return k.kind==="JSONPathNode"},create(k){return h({kind:"JSONPathNode",inOperator:k,pathLegs:h([])})},cloneWithLeg(k,W){return h({...k,pathLegs:h([...k.pathLegs,W])})}});var Qk=h({is(k){return k.kind==="JSONReferenceNode"},create(k,W){return h({kind:"JSONReferenceNode",reference:k,traversal:W})},cloneWithTraversal(k,W){return h({...k,traversal:W})}});var Z$=/^#-\d+$/;class ik{#k;constructor(k){this.#k=k}at(k){if(typeof k!=="number"&&typeof k!=="string"||typeof k==="number"&&!Number.isInteger(k)||typeof k==="string"&&k!=="last"&&!Z$.test(k))throw Error(`Unexpected index value in .at(...): ${k}`);return this.#W("ArrayLocation",k)}key(k){return this.#W("Member",k)}#W(k,W){if(Qk.is(this.#k))return new uk(Qk.cloneWithTraversal(this.#k,Uk.is(this.#k.traversal)?Uk.cloneWithLeg(this.#k.traversal,tW.create(k,W)):JW.cloneWithValue(this.#k.traversal,Q.createImmediate(W))));return new uk(Uk.cloneWithLeg(this.#k,tW.create(k,W)))}}class uk extends ik{#k;constructor(k){super(k);this.#k=k}get expressionType(){return}as(k){return new xh(this,k)}$castTo(){return new uk(this.#k)}$notNull(){return new uk(this.#k)}toOperationNode(){return this.#k}}class xh{#k;#W;constructor(k,W){this.#k=k,this.#W=W}get expression(){return this.#k}get alias(){return this.#W}toOperationNode(){return I.create(this.#k.toOperationNode(),z(this.#W)?this.#W.toOperationNode():J.create(this.#W))}}var nW=h({is(k){return k.kind==="TupleNode"},create(k){return h({kind:"TupleNode",values:h(k)})}});var Y$=["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"],X$=[/^varchar\(\d+\)$/,/^char\(\d+\)$/,/^decimal\(\d+, \d+\)$/,/^numeric\(\d+, \d+\)$/,/^binary\(\d+\)$/,/^datetime\(\d+\)$/,/^time\(\d+\)$/,/^timetz\(\d+\)$/,/^timestamp\(\d+\)$/,/^timestamptz\(\d+\)$/,/^varbinary\(\d+\)$/],ch=h({is(k){return k.kind==="DataTypeNode"},create(k){return h({kind:"DataTypeNode",dataType:k})}});function yh(k){if(Y$.includes(k))return!0;if(X$.some((W)=>W.test(k)))return!0;return!1}function gh(k){if(z(k))return k.toOperationNode();if(yh(k))return ch.create(k);throw Error(`invalid column data type ${JSON.stringify(k)}`)}var th=h({is(k){return k.kind==="CastNode"},create(k,W){return h({kind:"CastNode",expression:k,dataType:W})}});function XW(k=qk){function W(G,q,vk){return new Z(hW(G,q,vk))}function $(G,q){return new Z(Qh(G,q))}let M=Object.assign(W,{fn:void 0,eb:void 0,selectFrom(G){return nk({queryId:T(),executor:k,queryNode:Y.createFrom(n(G))})},case(G){return new yW({node:l.create(c(G)?void 0:f(G))})},ref(G,q){if(c(q))return new Z(t(G));return new ik(nh(G,q))},jsonPath(){return new ik(Uk.create())},table(G){return new Z(F(G))},val(G){return new Z(X(G))},refTuple(...G){return new Z(nW.create(G.map(f)))},tuple(...G){return new Z(nW.create(G.map(X)))},lit(G){return new Z(Bk(G))},unary:$,not(G){return $("not",G)},exists(G){return $("exists",G)},neg(G){return $("-",G)},between(G,q,vk){return new Z(Yk.create(f(G),y.create("between"),x.create(X(q),X(vk))))},betweenSymmetric(G,q,vk){return new Z(Yk.create(f(G),y.create("between symmetric"),x.create(X(q),X(vk))))},and(G){if(j(G))return new Z(mk(G,"and"));return new Z(UW(G,"and"))},or(G){if(j(G))return new Z(mk(G,"or"));return new Z(UW(G,"or"))},parens(...G){let q=L(G);if(Xk.is(q))return new Z(q);else return new Z(Xk.create(q))},cast(G,q){return new Z(th.create(f(G),gh(q)))},withSchema(G){return XW(k.withPluginAtFront(new YW(G)))}});return M.fn=Oh(),M.eb=M,M}function d(k){return XW()}function p(k){if(z(k))return k.toOperationNode();else if(_(k))return k(d()).toOperationNode();throw Error(`invalid expression: ${JSON.stringify(k)}`)}function MW(k){if(z(k))return k.toOperationNode();else if(_(k))return k(d()).toOperationNode();throw Error(`invalid aliased expression: ${JSON.stringify(k)}`)}function Wk(k){return ok(k)||iW(k)||_(k)}function _W(k){if(V(k))return t(k);return k.toOperationNode()}function Gk(k){if(j(k))return k.map((W)=>f(W));else return[f(k)]}function f(k){if(Wk(k))return p(k);return _W(k)}function nh(k,W){let $=t(k);if(dW(W))return Qk.create($,JW.create(y.create(W)));let M=W.slice(0,-1);if(dW(M))return Qk.create($,Uk.create(y.create(M)));throw Error(`Invalid JSON operator: ${W}`)}function t(k){if(!k.includes("."))return Ak.create(S.create(k));let $=k.split(".").map(uW);if($.length===3)return L$($);if($.length===2)return z$($);throw Error(`invalid column reference ${k}`)}function Zh(k){if(k.includes(" as ")){let[$,M]=k.split(" as ").map(uW);return I.create(t($),J.create(M))}else return t(k)}function D$(k){return S.create(k)}function R3(k){if(k.includes(" ")){let[$,M]=k.split(" ").map(uW);if(!RW(M))throw Error(`invalid order direction "${M}" next to "${$}"`);return B([$,M])[0]}else return D$(k)}function L$(k){let[W,$,M]=k;return Ak.create(S.create(M),zk.createWithSchema(W,$))}function z$(k){let[W,$]=k;return Ak.create(S.create($),zk.create(W))}function uW(k){return k.trim()}class lk{#k;constructor(k){this.#k=h(k)}get expressionType(){return}get isRawBuilder(){return!0}as(k){return new dh(this,k)}$castTo(){return new lk({...this.#k})}$notNull(){return new lk(this.#k)}withPlugin(k){return new lk({...this.#k,plugins:this.#k.plugins!==void 0?h([...this.#k.plugins,k]):h([k])})}toOperationNode(){return this.#h(this.#W())}compile(k){return this.#$(this.#W(k))}async execute(k){let W=this.#W(k);return W.executeQuery(this.#$(W))}#W(k){let W=k!==void 0?k.getExecutor():qk;return this.#k.plugins!==void 0?W.withPlugins(this.#k.plugins):W}#h(k){return k.transformQuery(this.#k.rawNode,this.#k.queryId)}#$(k){return k.compileQuery(this.#h(k),this.#k.queryId)}}function Zk(k){return new lk(k)}class dh{#k;#W;constructor(k,W){this.#k=k,this.#W=W}get expression(){return this.#k}get alias(){return this.#W}get rawBuilder(){return this.#k}toOperationNode(){return I.create(this.#k.toOperationNode(),z(this.#W)?this.#W.toOperationNode():J.create(this.#W))}}var J$=Object.assign((k,...W)=>{return Zk({queryId:T(),rawNode:v.create(k,W?.map(uh)??[])})},{ref(k){return Zk({queryId:T(),rawNode:v.createWithChild(t(k))})},val(k){return Zk({queryId:T(),rawNode:v.createWithChild(X(k))})},value(k){return this.val(k)},table(k){return Zk({queryId:T(),rawNode:v.createWithChild(F(k))})},id(...k){let W=Array(k.length+1).fill(".");return W[0]="",W[W.length-1]="",Zk({queryId:T(),rawNode:v.create(W,k.map(J.create))})},lit(k){return Zk({queryId:T(),rawNode:v.createWithChild(Q.createImmediate(k))})},literal(k){return this.lit(k)},raw(k){return Zk({queryId:T(),rawNode:v.createWithSql(k)})},join(k,W=J$`, `){let $=Array(Math.max(2*k.length-1,0)),M=W.toOperationNode();for(let G=0;G<k.length;++G)if($[2*G]=uh(k[G]),G!==k.length-1)$[2*G+1]=M;return Zk({queryId:T(),rawNode:v.createWithChildren($)})}});function uh(k){if(z(k))return k.toOperationNode();return X(k)}var l3=h({raw(k,W=[]){return h({sql:k,query:v.createWithSql(k),parameters:h(W),queryId:T()})}});
|
|
3
|
+
export{z as kb,S as lb,pk as mb,ah as nb,t as ob,D$ as pb,R3 as qb,rk as rb,Q as sb,L as tb,K as ub,Y as vb,Vh as wb,T as xb,ZW as yb,Th as zb,QW as Ab,Pk as Bb,Oh as Cb,l as Db,yW as Eb,gh as Fb,p as Gb,oh as Hb,F as Ib,J$ as Jb,l3 as Kb};
|