@shumai-one/shumai 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/bin/chunk-01052ssf.js +32 -0
  2. package/bin/{chunk-w4ydfy9d.js → chunk-02fvcrej.js} +4 -4
  3. package/bin/chunk-0bj887zm.js +2 -0
  4. package/bin/chunk-167z646e.js +2 -0
  5. package/bin/chunk-1ktk6764.js +10 -0
  6. package/bin/{chunk-p1ed0pa6.js → chunk-1nvd90g2.js} +1 -1
  7. package/bin/{chunk-kywdke0y.js → chunk-1wfg56z3.js} +5 -5
  8. package/bin/{chunk-ahgq10a7.js → chunk-257dcd2f.js} +2 -2
  9. package/bin/chunk-26qn7fek.js +2 -0
  10. package/bin/chunk-2cdxm1cp.js +55 -0
  11. package/bin/chunk-2jj4j8cn.js +3 -0
  12. package/bin/chunk-2ne2b54t.js +2 -0
  13. package/bin/{chunk-qqj2m1b1.js → chunk-2nhgdqdg.js} +2 -2
  14. package/bin/chunk-2vbeqczj.js +1 -0
  15. package/bin/chunk-37p6bcx2.js +1 -0
  16. package/bin/chunk-3ckkwdjx.js +13 -0
  17. package/bin/chunk-3knfx6dm.js +1 -0
  18. package/bin/chunk-3z85zxkn.js +1 -0
  19. package/bin/chunk-4mws03es.js +5 -0
  20. package/bin/chunk-54tbfvya.js +2 -0
  21. package/bin/chunk-55h9ze53.js +2 -0
  22. package/bin/chunk-56kh5fxc.js +1 -0
  23. package/bin/chunk-576nj64j.js +2 -0
  24. package/bin/{chunk-dfecgpce.js → chunk-5wapd171.js} +13 -13
  25. package/bin/chunk-6cnqjngz.js +1 -0
  26. package/bin/chunk-73yncv54.js +2 -0
  27. package/bin/chunk-7g46e1wy.js +3 -0
  28. package/bin/{chunk-jq3pq545.js → chunk-7naa7tpn.js} +2 -2
  29. package/bin/{chunk-am6dg0a5.js → chunk-7sgrtxbt.js} +2 -2
  30. package/bin/{chunk-3me1v3z5.js → chunk-7v7mypc6.js} +2 -2
  31. package/bin/chunk-82tps5n1.js +2 -0
  32. package/bin/chunk-84x8p7v5.js +1 -0
  33. package/bin/{chunk-fxtzy5f5.js → chunk-88jg9dq5.js} +2 -2
  34. package/bin/chunk-8cjet7pp.js +12 -0
  35. package/bin/chunk-8fyg9dy4.js +2 -0
  36. package/bin/chunk-8gtfgkrn.js +2 -0
  37. package/bin/chunk-8mqbztj8.js +2 -0
  38. package/bin/chunk-8xb6yz11.js +2 -0
  39. package/bin/chunk-8yjsmr7g.js +2 -0
  40. package/bin/chunk-91rb0jpb.js +2 -0
  41. package/bin/chunk-96qpjght.js +2 -0
  42. package/bin/chunk-9f1xk1nt.js +1 -0
  43. package/bin/chunk-9mk9cvbk.js +1 -0
  44. package/bin/{chunk-r5g84kj4.js → chunk-9n1w5dw1.js} +3 -3
  45. package/bin/chunk-9nw5w8vh.js +1 -0
  46. package/bin/{chunk-3j82q2gj.js → chunk-9t3p4xp6.js} +1 -1
  47. package/bin/chunk-9xhjy897.js +11 -0
  48. package/bin/chunk-9zsv6d2f.js +1 -0
  49. package/bin/chunk-a411xhmm.js +7 -0
  50. package/bin/{chunk-s01p4w8d.js → chunk-a74g6h8a.js} +2 -2
  51. package/bin/chunk-ah8fjb6f.js +2 -0
  52. package/bin/chunk-atfz7g7e.js +2 -0
  53. package/bin/{chunk-swz6v48q.js → chunk-b5rhvzv9.js} +2 -2
  54. package/bin/{chunk-bg6waaf9.js → chunk-b7bnp021.js} +2 -2
  55. package/bin/chunk-cf5axr8c.js +1 -0
  56. package/bin/chunk-cgmebxx6.js +2 -0
  57. package/bin/chunk-cwat1jwx.js +3 -0
  58. package/bin/chunk-cz13a82m.js +3 -0
  59. package/bin/chunk-dk42gf7v.js +2 -0
  60. package/bin/chunk-e4f56spj.js +4 -0
  61. package/bin/chunk-e4yscwen.js +18 -0
  62. package/bin/chunk-eb7mzbfm.js +1 -0
  63. package/bin/chunk-er14d498.js +3 -0
  64. package/bin/{chunk-bs6saf4d.js → chunk-eyjfhdp9.js} +2 -2
  65. package/bin/chunk-f25fe9th.js +393 -0
  66. package/bin/chunk-f6avg5qe.js +129 -0
  67. package/bin/chunk-fatmqnp1.js +2 -0
  68. package/bin/chunk-fvx9k1dc.js +2 -0
  69. package/bin/{chunk-h6f2gyt5.js → chunk-g22wmpk1.js} +2 -2
  70. package/bin/chunk-g6sdezec.js +2 -0
  71. package/bin/chunk-gtf19jc1.js +2 -0
  72. package/bin/chunk-gxepkvt2.js +2 -0
  73. package/bin/chunk-h1n7jqnw.js +1 -0
  74. package/bin/chunk-hfm82066.js +2 -0
  75. package/bin/chunk-hnkcgvcj.js +3 -0
  76. package/bin/{chunk-agcnbjxk.js → chunk-hpbn0k9n.js} +2 -2
  77. package/bin/{chunk-d4hk62q2.js → chunk-hpwv4am3.js} +4 -4
  78. package/bin/{chunk-acmr8v0d.js → chunk-hw6czrya.js} +1 -1
  79. package/bin/{chunk-r9gp9yqw.js → chunk-hzkjgcre.js} +1 -1
  80. package/bin/chunk-j2s311yc.js +3 -0
  81. package/bin/{chunk-6hzktewz.js → chunk-jt02kpfc.js} +2 -2
  82. package/bin/{chunk-c60j1b4w.js → chunk-jt0ykktx.js} +1 -1
  83. package/bin/{chunk-sd6w0z6a.js → chunk-jzgbxqdg.js} +2 -2
  84. package/bin/chunk-kj6h5j5a.js +4 -0
  85. package/bin/chunk-km4gn6b6.js +1 -0
  86. package/bin/chunk-knj2s8mg.js +16 -0
  87. package/bin/{chunk-1eqw2dpx.js → chunk-kvhf12b4.js} +2 -2
  88. package/bin/chunk-m0q2cgfg.js +2 -0
  89. package/bin/chunk-m82tkhaa.js +11 -0
  90. package/bin/chunk-m9adtgzk.js +2 -0
  91. package/bin/{chunk-0tvnfy4k.js → chunk-mcj1xpcc.js} +2 -2
  92. package/bin/chunk-mcw198kg.js +13 -0
  93. package/bin/{chunk-9s0k533c.js → chunk-mwktrwtx.js} +1 -1
  94. package/bin/{chunk-wsprap60.js → chunk-mzsw9var.js} +2 -2
  95. package/bin/chunk-ns33grgx.js +2 -0
  96. package/bin/{chunk-xsfy8hz3.js → chunk-ny1kbmxt.js} +2 -2
  97. package/bin/{chunk-16n160h1.js → chunk-p3f5aevs.js} +1 -1
  98. package/bin/chunk-p3j6ydk1.js +1 -0
  99. package/bin/chunk-p4s95471.js +2 -0
  100. package/bin/chunk-pk406dgy.js +2 -0
  101. package/bin/chunk-q2bew2vc.js +2 -0
  102. package/bin/chunk-q5vkxee3.js +5 -0
  103. package/bin/{chunk-hzv1mhr5.js → chunk-q83h0hkx.js} +2 -2
  104. package/bin/{chunk-fre31bhw.js → chunk-q8w4mbw4.js} +2 -2
  105. package/bin/{chunk-b7qs7hxg.js → chunk-qwpkcp8d.js} +2 -2
  106. package/bin/chunk-r1xer8gn.js +5 -0
  107. package/bin/chunk-s1e4qy3q.js +14 -0
  108. package/bin/{chunk-b9d8xdhb.js → chunk-s9ksftq2.js} +1 -1
  109. package/bin/chunk-srxp5jav.js +42 -0
  110. package/bin/chunk-swtwaaqe.js +1 -0
  111. package/bin/chunk-tagdrg7p.js +1 -0
  112. package/bin/{chunk-d18v5vmp.js → chunk-tekwpkjf.js} +2 -2
  113. package/bin/chunk-twtxnzbv.js +2 -0
  114. package/bin/{chunk-c6f8x05m.js → chunk-v05rrxp5.js} +2 -2
  115. package/bin/{chunk-ht5rht98.js → chunk-v5cn90cf.js} +2 -2
  116. package/bin/chunk-v5mcjwxy.js +2 -0
  117. package/bin/{chunk-jb8vbeb0.js → chunk-vcrmjtcz.js} +2 -2
  118. package/bin/chunk-vkzasgxw.js +2 -0
  119. package/bin/chunk-vp3czaeh.js +7 -0
  120. package/bin/chunk-x03jwaga.js +8 -0
  121. package/bin/chunk-x342vzdx.js +2 -0
  122. package/bin/chunk-x8mjh387.js +5 -0
  123. package/bin/chunk-xc54vhfz.js +2 -0
  124. package/bin/chunk-xvkwbczx.js +3 -0
  125. package/bin/chunk-y241cxff.js +1 -0
  126. package/bin/chunk-yk12hydf.js +7 -0
  127. package/bin/chunk-ympbfzz4.js +2 -0
  128. package/bin/{chunk-n412a1hp.js → chunk-yq32evnn.js} +6 -6
  129. package/bin/chunk-z1p13dnc.js +2 -0
  130. package/bin/chunk-zarz3sqn.js +211 -0
  131. package/bin/chunk-zezje74z.js +4 -0
  132. package/bin/chunk-zrszykjf.js +3 -0
  133. package/bin/shumai-app.html +1 -1
  134. package/bin/shumai-app.js +942 -1015
  135. package/package.json +7 -7
  136. package/prisma/migrations/20261026024507_hash_api_tokens/migration.sql +28 -0
  137. package/prisma/migrations/20261026031904_add_audit_log_via/migration.sql +2 -0
  138. package/prisma/migrations/20261029024626_add_oauth_and_jwks/migration.sql +205 -0
  139. package/prisma/migrations/20261029030321_default_empty_arrays_oauth/migration.sql +25 -0
  140. package/prisma/schema.prisma +186 -1
  141. package/bin/chunk-0502p2k7.js +0 -3
  142. package/bin/chunk-0b0t6y8h.js +0 -11
  143. package/bin/chunk-1vt9ss7d.js +0 -2
  144. package/bin/chunk-23780yj6.js +0 -3
  145. package/bin/chunk-2cpsfc87.js +0 -1
  146. package/bin/chunk-2w0d9veg.js +0 -2
  147. package/bin/chunk-2xp9prpq.js +0 -1
  148. package/bin/chunk-3gqs15zq.js +0 -2
  149. package/bin/chunk-3pw7z25v.js +0 -3
  150. package/bin/chunk-3tx9v8kj.js +0 -2
  151. package/bin/chunk-3wdtp4ht.js +0 -1
  152. package/bin/chunk-57axjy7y.js +0 -1
  153. package/bin/chunk-5aqthcm6.js +0 -5
  154. package/bin/chunk-5gq4q1bb.js +0 -2
  155. package/bin/chunk-5r1br11d.js +0 -2
  156. package/bin/chunk-61hrdg0g.js +0 -1
  157. package/bin/chunk-6aa4xmnw.js +0 -2
  158. package/bin/chunk-6mrgtn78.js +0 -18
  159. package/bin/chunk-6s55r0z9.js +0 -1
  160. package/bin/chunk-6vkfzzvt.js +0 -5
  161. package/bin/chunk-7dprpnm6.js +0 -2
  162. package/bin/chunk-7rycq6wb.js +0 -129
  163. package/bin/chunk-895gzdtp.js +0 -7
  164. package/bin/chunk-8d1p8qpv.js +0 -1
  165. package/bin/chunk-8r3k84dh.js +0 -2
  166. package/bin/chunk-99sarrvt.js +0 -3
  167. package/bin/chunk-b21z62fj.js +0 -1
  168. package/bin/chunk-bv589v2m.js +0 -3
  169. package/bin/chunk-c8kjpmfe.js +0 -2
  170. package/bin/chunk-c9xyejnk.js +0 -2
  171. package/bin/chunk-cb9peqy5.js +0 -2
  172. package/bin/chunk-ckczqmrz.js +0 -5
  173. package/bin/chunk-cr33cs6j.js +0 -2
  174. package/bin/chunk-cxet91kt.js +0 -2
  175. package/bin/chunk-d7e351jd.js +0 -6
  176. package/bin/chunk-ebcfbn00.js +0 -2
  177. package/bin/chunk-f0b4a9y3.js +0 -2
  178. package/bin/chunk-fkn6f4qt.js +0 -4
  179. package/bin/chunk-g78vapcm.js +0 -2
  180. package/bin/chunk-gdpfwxea.js +0 -4
  181. package/bin/chunk-gwqqq0b1.js +0 -32
  182. package/bin/chunk-h3cwf9aw.js +0 -2
  183. package/bin/chunk-h4ty530v.js +0 -16
  184. package/bin/chunk-h58yfx7w.js +0 -2
  185. package/bin/chunk-h9ngpxyd.js +0 -1
  186. package/bin/chunk-hbr17jvr.js +0 -13
  187. package/bin/chunk-hc0xbmtt.js +0 -5
  188. package/bin/chunk-j9t7tvt5.js +0 -2
  189. package/bin/chunk-jvt8q0eg.js +0 -2
  190. package/bin/chunk-jzgtthsj.js +0 -3
  191. package/bin/chunk-jzjhg7ng.js +0 -1
  192. package/bin/chunk-k547syp2.js +0 -2
  193. package/bin/chunk-k7sjpke6.js +0 -2
  194. package/bin/chunk-k8ct1qgv.js +0 -3
  195. package/bin/chunk-k9q4nn8b.js +0 -11
  196. package/bin/chunk-keetdtxb.js +0 -2
  197. package/bin/chunk-kjjw8mbg.js +0 -1
  198. package/bin/chunk-mey80kv9.js +0 -54
  199. package/bin/chunk-nfncawpm.js +0 -12
  200. package/bin/chunk-nvwt8atc.js +0 -1
  201. package/bin/chunk-p1d500sf.js +0 -211
  202. package/bin/chunk-q0vs124k.js +0 -2
  203. package/bin/chunk-q5795f3s.js +0 -2
  204. package/bin/chunk-q5j3b0h5.js +0 -3
  205. package/bin/chunk-qd7pvaxb.js +0 -2
  206. package/bin/chunk-qhpt7170.js +0 -2
  207. package/bin/chunk-qt78vs3g.js +0 -2
  208. package/bin/chunk-ra6mdjr0.js +0 -1
  209. package/bin/chunk-ryfvaz6v.js +0 -3
  210. package/bin/chunk-s22eapcc.js +0 -2
  211. package/bin/chunk-sbg86tch.js +0 -2
  212. package/bin/chunk-sbqy6m8t.js +0 -1
  213. package/bin/chunk-sdp9w627.js +0 -14
  214. package/bin/chunk-sn0nypvd.js +0 -42
  215. package/bin/chunk-sv92vkyh.js +0 -2
  216. package/bin/chunk-t6cn018t.js +0 -3
  217. package/bin/chunk-ts4d1mxf.js +0 -2
  218. package/bin/chunk-wkdkc12e.js +0 -4
  219. package/bin/chunk-xgnvktq6.js +0 -10
  220. package/bin/chunk-xjw3mpvx.js +0 -1
  221. package/bin/chunk-xznq2axj.js +0 -1
  222. package/bin/chunk-y4v08wq7.js +0 -1
  223. package/bin/chunk-yncvy335.js +0 -3
  224. package/bin/chunk-ytzddcj2.js +0 -1
  225. package/bin/chunk-zxqasmvz.js +0 -2
@@ -0,0 +1,11 @@
1
+ // @bun
2
+ import{Il,Wo,br,at,Tn,hr,sr}from"./chunk-e4yscwen.js";import{L,ae}from"./chunk-2jj4j8cn.js";var Ts=L(function(fr){var{Readable:Ht}=ae("stream"),{NoOpLogger:qt,normalizeProvider:ge}=br(),{HttpResponse:me,HttpRequest:k}=sr(),{parseRfc7231DateTime:Gt,v4:Ae}=hr(),{hasOwn:Wt}=Wo(),be=(e)=>e?.body instanceof Ht||typeof ReadableStream<"u"&&e?.body instanceof ReadableStream,$t=["AccessDeniedException","AuthFailure","InvalidSignatureException","RequestExpired","RequestInTheFuture","RequestTimeTooSkewed","SignatureDoesNotMatch"],Vt=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],zt=["TimeoutError","RequestTimeout","RequestTimeoutException"],jt=[500,502,503,504],Kt=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],Xt=["EHOSTUNREACH","ENETUNREACH","ENOTFOUND","EAI_AGAIN"],W=(e)=>e?.$retryable!==void 0,ye=(e)=>$t.includes(e.name),Se=(e)=>e.$metadata?.clockSkewCorrected,_e=(e)=>{let i=new Set(["Failed to fetch","NetworkError when attempting to fetch resource","The Internet connection appears to be offline","Load failed","Network request failed"]);if(!(e&&e instanceof TypeError))return!1;return i.has(e.message)},E=(e)=>e.$metadata?.httpStatusCode===429||Vt.includes(e.name)||e.$retryable?.throttling==!0,T=(e,i=0)=>W(e)||Se(e)||e.name==="InvalidSignatureException"&&e.message?.includes("Signature expired")||zt.includes(e.name)||Kt.includes(e?.code||"")||Xt.includes(e?.code||"")||jt.includes(e.$metadata?.httpStatusCode||0)||_e(e)||we(e)||e.cause!==void 0&&i<=10&&T(e.cause,i+1),Me=(e)=>{if(e.$metadata?.httpStatusCode!==void 0){let i=e.$metadata.httpStatusCode;if(500<=i&&i<=599&&!T(e))return!0;return!1}return!1};function we(e){return e.code==="ERR_HTTP2_STREAM_ERROR"&&e.message.includes("NGHTTP2_REFUSED_STREAM")}var ve=100,I=20000,Ee=500,F=500,Te=5,Re=10,V=1,N="amz-sdk-invocation-id",D="amz-sdk-request";function Pe(e,i){if(!me.isInstance(e))return;for(let a in e.headers){if(!Wt(e.headers,a))continue;let c=a.toLowerCase();if(c==="retry-after"){let s=e.headers[a],o=NaN;if(s.endsWith("GMT"))try{o=(Gt(s).getTime()-Date.now())/1000}catch(u){i?.trace?.("Failed to parse retry-after header"),i?.trace?.(u)}else if(s.match(/ GMT, ((\d+)|(\d+\.\d+))$/))o=Number(s.match(/ GMT, ([\d.]+)$/)?.[1]);else if(s.match(/^((\d+)|(\d+\.\d+))$/))o=Number(s);else if(Date.parse(s)>=Date.now())o=(Date.parse(s)-Date.now())/1000;if(isNaN(o))return;return new Date(Date.now()+o*1000)}else if(c==="x-amz-retry-after"){let s=e.headers[a],o=Number(s);if(isNaN(o)){i?.trace?.(`Failed to parse x-amz-retry-after=${s}`);return}return new Date(Date.now()+o)}}}function Qt(e,i){return Pe(e,i)}var xe=(e)=>{if(e instanceof Error)return e;if(e instanceof Object)return Object.assign(Error(),e);if(typeof e==="string")return Error(e);return Error(`AWS SDK error wrapper for ${e}`)};function Oe(e){return(i)=>(a,c)=>async(s)=>{let o=await i.retryStrategy(),u=await i.maxAttempts();if(Zt(o)){o=o;let t=await o.acquireInitialRetryToken((c.partition_id??"")+(c.__retryLongPoll?":longpoll":"")),r=Error(),n=0,p=0,{request:d}=s,l=k.isInstance(d);if(l)d.headers[N]=Ae();while(!0)try{if(l)d.headers[D]=`attempt=${n+1}; max=${u}`;let{response:f,output:h}=await a(s);return o.recordSuccess(t),h.$metadata.attempts=n+1,h.$metadata.totalRetryDelay=p,{response:f,output:h}}catch(f){let h=er(f,i.logger);if(r=xe(f),l&&e(d))throw(c.logger instanceof qt?console:c.logger)?.warn("An error was encountered in a non-retryable streaming request."),r;try{t=await o.refreshRetryTokenForRetry(t,h)}catch(A){if(!r.$metadata)r.$metadata={};throw r.$metadata.attempts=n+1,r.$metadata.totalRetryDelay=p,r}n=t.getRetryCount();let g=t.getRetryDelay();if(p+=(t?.$retryLog?.acquisitionDelay??0)+g,g>0)await Jt(g)}}else{if(o=o,o?.mode)c.userAgent=[...c.userAgent||[],["cfg/retry-mode",o.mode]];return o.retry(a,s)}}}var Jt=(e)=>new Promise((i)=>setTimeout(i,e)),Zt=(e)=>typeof e.acquireInitialRetryToken<"u"&&typeof e.refreshRetryTokenForRetry<"u"&&typeof e.recordSuccess<"u",er=(e,i)=>{let a={error:e,errorType:tr(e)},c=Pe(e.$response,i);if(c)a.retryAfterHint=c;return a},tr=(e)=>{if(E(e))return"THROTTLING";if(T(e))return"TRANSIENT";if(Me(e))return"SERVER_ERROR";return"CLIENT_ERROR"},ke={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0};function rr(e){let i=Oe(e);return(a)=>({applyToStack:(c)=>{c.add(i(a),ke)}})}class R{static setTimeoutFn=(e,i)=>setTimeout(e,i);beta;minCapacity;minFillRate;scaleConstant;smooth;enabled=!1;availableTokens=0;lastMaxRate=0;measuredTxRate=0;requestCount=0;fillRate;lastThrottleTime;lastTimestamp=0;lastTxRateBucket;maxCapacity;timeWindow=0;constructor(e){this.beta=e?.beta??0.7,this.minCapacity=e?.minCapacity??1,this.minFillRate=e?.minFillRate??0.5,this.scaleConstant=e?.scaleConstant??0.4,this.smooth=e?.smooth??0.8,this.lastThrottleTime=this.getCurrentTimeInSeconds(),this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}async getSendToken(){return this.acquireTokenBucket(1)}updateClientSendingRate(e){let i;this.updateMeasuredRate();let a=e;if(a?.errorType==="THROTTLING"||E(a?.error??e)){let o=!this.enabled?this.measuredTxRate:Math.min(this.measuredTxRate,this.fillRate);this.lastMaxRate=o,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),i=this.cubicThrottle(o),this.enableTokenBucket()}else this.calculateTimeWindow(),i=this.cubicSuccess(this.getCurrentTimeInSeconds());let s=Math.min(i,2*this.measuredTxRate);this.updateTokenBucketRate(s)}getCurrentTimeInSeconds(){return Date.now()/1000}async acquireTokenBucket(e){if(!this.enabled)return;this.refillTokenBucket();while(e>this.availableTokens){let i=(e-this.availableTokens)/this.fillRate*1000;await new Promise((a)=>R.setTimeoutFn(a,i)),this.refillTokenBucket()}this.availableTokens=this.availableTokens-e}refillTokenBucket(){let e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=e;return}let i=(e-this.lastTimestamp)*this.fillRate;this.availableTokens=Math.min(this.maxCapacity,this.availableTokens+i),this.lastTimestamp=e}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,0.3333333333333333))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.availableTokens=Math.min(this.availableTokens,this.maxCapacity)}updateMeasuredRate(){let e=this.getCurrentTimeInSeconds(),i=Math.floor(e*2)/2;if(this.requestCount++,i>this.lastTxRateBucket){let a=this.requestCount/(i-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(a*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=i}}getPrecise(e){return parseFloat(e.toFixed(8))}}class m{static v2026=typeof process<"u"&&process.env?.SMITHY_NEW_RETRIES_2026==="true";static delay(){return m.v2026?50:100}static throttlingDelay(){return m.v2026?1000:500}static cost(){return m.v2026?14:5}static throttlingCost(){return m.v2026?5:10}static modifiedCostType(){return m.v2026?"THROTTLING":"TRANSIENT"}}class Fe{x=m.delay();computeNextBackoffDelay(e){let i=Math.random(),a=2,c=i*Math.min(this.x*2**e,I);return Math.floor(c)}setDelayBase(e){this.x=e}}class H{delay;count;cost;longPoll;$retryLog={acquisitionDelay:0};constructor(e,i,a,c){this.delay=e,this.count=i,this.cost=a,this.longPoll=c}getRetryCount(){return this.count}getRetryDelay(){return Math.min(I,this.delay)}getRetryCost(){return this.cost}isLongPoll(){return this.longPoll}}var S;(function(e){e.STANDARD="standard",e.ADAPTIVE="adaptive"})(S||(S={}));var M=3,Ie=S.STANDARD,O={incompatible:1,attempts:2,capacity:3},v=class{mode=S.STANDARD;retryBackoffStrategy;capacity=F;maxAttemptsProvider;baseDelay;constructor(i){if(typeof i==="number")this.maxAttemptsProvider=async()=>i;else if(typeof i==="function")this.maxAttemptsProvider=i;else if(i&&typeof i==="object")this.maxAttemptsProvider=async()=>i.maxAttempts,this.baseDelay=i.baseDelay,this.retryBackoffStrategy=i.backoff;this.maxAttemptsProvider??=async()=>M,this.baseDelay??=m.delay(),this.retryBackoffStrategy??=new Fe}async acquireInitialRetryToken(i){return new H(m.delay(),0,void 0,m.v2026&&i.includes(":longpoll"))}async refreshRetryTokenForRetry(i,a){let c=await this.getMaxAttempts(),s=this.retryCode(i,a,c),o=s===0,u=i.isLongPoll?.();if(o||u){let t=a.errorType;this.retryBackoffStrategy.setDelayBase(t==="THROTTLING"?m.throttlingDelay():this.baseDelay);let r=this.retryBackoffStrategy.computeNextBackoffDelay(i.getRetryCount()),n=r;if(a.retryAfterHint instanceof Date)n=Math.max(r,Math.min(a.retryAfterHint.getTime()-Date.now(),r+5000));if(!o){let p=m.v2026&&s===O.capacity&&u?n:0;if(p>0)await new Promise((d)=>setTimeout(d,p))}else{let p=this.getCapacityCost(t);this.capacity-=p;let d=new H(0,i.getRetryCount()+1,p,i.isLongPoll?.()??!1);return await new Promise((l)=>setTimeout(l,n)),d.$retryLog.acquisitionDelay=n,d}}throw Error("No retry token available")}recordSuccess(i){this.capacity=Math.min(F,this.capacity+(i.getRetryCost()??V))}getCapacity(){return this.capacity}async maxAttempts(){return this.maxAttemptsProvider()}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch(i){return console.warn(`Max attempts provider could not resolve. Using default of ${M}`),M}}retryCode(i,a,c){let s=i.getRetryCount()+1,o=this.isRetryableError(a.errorType)?0:O.incompatible,u=s<c?0:O.attempts,t=this.capacity>=this.getCapacityCost(a.errorType)?0:O.capacity;return o||u||t}getCapacityCost(i){return i===m.modifiedCostType()?m.throttlingCost():m.cost()}isRetryableError(i){return i==="THROTTLING"||i==="TRANSIENT"}},Ne=class{mode=S.ADAPTIVE;rateLimiter;standardRetryStrategy;constructor(i,a){let{rateLimiter:c}=a??{};this.rateLimiter=c??new R,this.standardRetryStrategy=a?new v({maxAttempts:typeof i==="number"?i:3,...a}):new v(i)}async acquireInitialRetryToken(i){let a=await this.standardRetryStrategy.acquireInitialRetryToken(i);return await this.rateLimiter.getSendToken(),a}async refreshRetryTokenForRetry(i,a){this.rateLimiter.updateClientSendingRate(a);let c=await this.standardRetryStrategy.refreshRetryTokenForRetry(i,a);return await this.rateLimiter.getSendToken(),c}recordSuccess(i){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(i)}async maxAttemptsProvider(){return this.standardRetryStrategy.maxAttempts()}};class De extends v{computeNextBackoffDelay;constructor(e,i=m.delay()){super(typeof e==="function"?e:async()=>e);if(typeof i==="number")this.computeNextBackoffDelay=()=>i;else this.computeNextBackoffDelay=i;this.retryBackoffStrategy.computeNextBackoffDelay=(a)=>{let c=a+1;return this.computeNextBackoffDelay(c)}}}var nr=(e,i)=>{let a=e,c=V,s=Te,o=Re,u=e,t=(d)=>d.name==="TimeoutError"?o:s,r=(d)=>t(d)<=u;return Object.freeze({hasRetryTokens:r,retrieveRetryTokens:(d)=>{if(!r(d))throw Error("No retry token available");let l=t(d);return u-=l,l},releaseRetryTokens:(d)=>{u+=d??c,u=Math.min(u,a)}})},Ce=(e,i)=>Math.floor(Math.min(I,Math.random()*2**i*e)),Be=(e)=>{if(!e)return!1;return W(e)||ye(e)||E(e)||T(e)};class z{maxAttemptsProvider;retryDecider;delayDecider;retryQuota;mode=S.STANDARD;constructor(e,i){this.maxAttemptsProvider=e,this.retryDecider=i?.retryDecider??Be,this.delayDecider=i?.delayDecider??Ce,this.retryQuota=i?.retryQuota??nr(F)}shouldRetry(e,i,a){return i<a&&this.retryDecider(e)&&this.retryQuota.hasRetryTokens(e)}async getMaxAttempts(){let e;try{e=await this.maxAttemptsProvider()}catch(i){e=M}return e}async retry(e,i,a){let c,s=0,o=0,u=await this.getMaxAttempts(),{request:t}=i;if(k.isInstance(t))t.headers[N]=Ae();while(!0)try{if(k.isInstance(t))t.headers[D]=`attempt=${s+1}; max=${u}`;if(a?.beforeRequest)await a.beforeRequest();let{response:r,output:n}=await e(i);if(a?.afterRequest)a.afterRequest(r);return this.retryQuota.releaseRetryTokens(c),n.$metadata.attempts=s+1,n.$metadata.totalRetryDelay=o,{response:r,output:n}}catch(r){let n=xe(r);if(s++,this.shouldRetry(n,s,u)){c=this.retryQuota.retrieveRetryTokens(n);let p=this.delayDecider(E(n)?Ee:ve,s),d=ir(n.$response),l=Math.max(d||0,p);o+=l,await new Promise((f)=>setTimeout(f,l));continue}if(!n.$metadata)n.$metadata={};throw n.$metadata.attempts=s,n.$metadata.totalRetryDelay=o,n}}}var ir=(e)=>{if(!me.isInstance(e))return;let i=Object.keys(e.headers).find((o)=>o.toLowerCase()==="retry-after");if(!i)return;let a=e.headers[i],c=Number(a);if(!Number.isNaN(c))return Math.min(c*1000,20000);let s=new Date(a);return Math.min(s.getTime()-Date.now(),20000)};class Le extends z{rateLimiter;constructor(e,i){let{rateLimiter:a,...c}=i??{};super(e,c);this.rateLimiter=a??new R,this.mode=S.ADAPTIVE}async retry(e,i){return super.retry(e,i,{beforeRequest:async()=>this.rateLimiter.getSendToken(),afterRequest:(a)=>{this.rateLimiter.updateClientSendingRate(a)}})}}var q="AWS_MAX_ATTEMPTS",G="max_attempts",or={environmentVariableSelector:(e)=>{let i=e[q];if(!i)return;let a=parseInt(i);if(Number.isNaN(a))throw Error(`Environment variable ${q} mast be a number, got "${i}"`);return a},configFileSelector:(e)=>{let i=e[G];if(!i)return;let a=parseInt(i);if(Number.isNaN(a))throw Error(`Shared config file entry ${G} mast be a number, got "${i}"`);return a},default:M},ar=(e,i)=>{let{retryStrategy:a,retryMode:c}=e,{defaultMaxAttempts:s=M,defaultBaseDelay:o=m.delay()}=i??{},u=ge(e.maxAttempts??s),t=a?Promise.resolve(a):void 0,r=async()=>{let n=await u();if(await ge(c)()===S.ADAPTIVE)return new Ne(u,{maxAttempts:n,baseDelay:o});return new v({maxAttempts:n,baseDelay:o})};return Object.assign(e,{maxAttempts:u,retryStrategy:()=>t??=r()})},Ue="AWS_RETRY_MODE",He="retry_mode",cr={environmentVariableSelector:(e)=>e[Ue],configFileSelector:(e)=>e[He],default:Ie},qe=()=>(e)=>async(i)=>{let{request:a}=i;if(k.isInstance(a))delete a.headers[N],delete a.headers[D];return e(i)},Ge={name:"omitRetryHeadersMiddleware",tags:["RETRY","HEADERS","OMIT_RETRY_HEADERS"],relation:"before",toMiddleware:"awsAuthMiddleware",override:!0},ur=(e)=>({applyToStack:(i)=>{i.addRelativeTo(qe(),Ge)}}),dr=Oe(be),lr=rr(be);fr.AdaptiveRetryStrategy=Ne;fr.CONFIG_MAX_ATTEMPTS=G;fr.CONFIG_RETRY_MODE=He;fr.ConfiguredRetryStrategy=De;fr.DEFAULT_MAX_ATTEMPTS=M;fr.DEFAULT_RETRY_DELAY_BASE=ve;fr.DEFAULT_RETRY_MODE=Ie;fr.DefaultRateLimiter=R;fr.DeprecatedAdaptiveRetryStrategy=Le;fr.DeprecatedStandardRetryStrategy=z;fr.ENV_MAX_ATTEMPTS=q;fr.ENV_RETRY_MODE=Ue;fr.INITIAL_RETRY_TOKENS=F;fr.INVOCATION_ID_HEADER=N;fr.MAXIMUM_RETRY_DELAY=I;fr.NODE_MAX_ATTEMPT_CONFIG_OPTIONS=or;fr.NODE_RETRY_MODE_CONFIG_OPTIONS=cr;fr.NO_RETRY_INCREMENT=V;fr.REQUEST_HEADER=D;fr.RETRY_COST=Te;fr.RETRY_MODES=S;fr.Retry=m;fr.StandardRetryStrategy=v;fr.THROTTLING_RETRY_DELAY_BASE=Ee;fr.TIMEOUT_RETRY_COST=Re;fr.defaultDelayDecider=Ce;fr.defaultRetryDecider=Be;fr.getOmitRetryHeadersPlugin=ur;fr.getRetryAfterHint=Qt;fr.getRetryPlugin=lr;fr.isBrowserNetworkError=_e;fr.isClockSkewCorrectedError=Se;fr.isClockSkewError=ye;fr.isNodeJsHttp2TransientError=we;fr.isRetryableByTrait=W;fr.isServerError=Me;fr.isThrottlingError=E;fr.isTransientError=T;fr.omitRetryHeadersMiddleware=qe;fr.omitRetryHeadersMiddlewareOptions=Ge;fr.resolveRetryConfig=ar;fr.retryMiddleware=dr;fr.retryMiddlewareOptions=ke});var $e=L(function(sn){var _={REQUEST_ID:Symbol.for("_AWS_LAMBDA_REQUEST_ID"),X_RAY_TRACE_ID:Symbol.for("_AWS_LAMBDA_X_RAY_TRACE_ID"),TENANT_ID:Symbol.for("_AWS_LAMBDA_TENANT_ID"),TRACEPARENT:Symbol.for("_AWS_LAMBDA_TRACEPARENT"),TRACESTATE:Symbol.for("_AWS_LAMBDA_TRACESTATE"),BAGGAGE:Symbol.for("_AWS_LAMBDA_BAGGAGE")},Y=["true","1"].includes(process.env?.AWS_LAMBDA_NODEJS_NO_GLOBAL_AWSLAMBDA??"");if(!Y)globalThis.awslambda=globalThis.awslambda||{};class C{static PROTECTED_KEYS=_;isProtectedKey(e){return Object.values(_).includes(e)}getRequestId(){return this.get(_.REQUEST_ID)??"-"}getXRayTraceId(){return this.get(_.X_RAY_TRACE_ID)}getTenantId(){return this.get(_.TENANT_ID)}getTraceparent(){return this.get(_.TRACEPARENT)}getTracestate(){return this.get(_.TRACESTATE)}getBaggage(){return this.get(_.BAGGAGE)}}class We extends C{currentContext;getContext(){return this.currentContext}hasContext(){return this.currentContext!==void 0}get(e){return this.currentContext?.[e]}set(e,i){if(this.isProtectedKey(e))throw Error(`Cannot modify protected Lambda context field: ${String(e)}`);this.currentContext=this.currentContext||{},this.currentContext[e]=i}run(e,i){return this.currentContext=e,i()}}class K extends C{als;static async create(){let e=new K,i=await import("async_hooks");return e.als=new i.AsyncLocalStorage,e}getContext(){return this.als.getStore()}hasContext(){return this.als.getStore()!==void 0}get(e){return this.als.getStore()?.[e]}set(e,i){if(this.isProtectedKey(e))throw Error(`Cannot modify protected Lambda context field: ${String(e)}`);let a=this.als.getStore();if(!a)throw Error("No context available");a[e]=i}run(e,i){return this.als.run(e,i)}}sn.InvokeStore=void 0;(function(e){let i=null;async function a(c){if(!i)i=(async()=>{let o=c===!0||"AWS_LAMBDA_MAX_CONCURRENCY"in process.env?await K.create():new We;if(!Y&&globalThis.awslambda?.InvokeStore)return globalThis.awslambda.InvokeStore;else if(!Y&&globalThis.awslambda)return globalThis.awslambda.InvokeStore=o,o;else return o})();return i}e.getInstanceAsync=a,e._testing=process.env.AWS_LAMBDA_BENCHMARK_MODE==="1"?{reset:()=>{if(i=null,globalThis.awslambda?.InvokeStore)delete globalThis.awslambda.InvokeStore;globalThis.awslambda={InvokeStore:void 0}}}:void 0})(sn.InvokeStore||(sn.InvokeStore={}));sn.InvokeStoreBase=C});var Ko=L(function(wn){var{getSmithyContext:X,hasOwn:an}=Wo();wn.getSmithyContext=X;var{HttpRequest:Q}=sr(),{requestBuilder:cn}=sr();wn.requestBuilder=cn;var{HttpApiKeyAuthLocation:Ve}=Il(),un=(e,i)=>{if(!i||i.length===0)return e;let a=[];for(let c of i)for(let s of e)if(s.schemeId.split("#")[1]===c)a.push(s);for(let c of e)if(!a.find(({schemeId:s})=>s===c.schemeId))a.push(c);return a};function dn(e){let i=new Map;for(let a of e)i.set(a.schemeId,a);return i}var J=(e,i)=>(a,c)=>async(s)=>{let o=e.httpAuthSchemeProvider(await i.httpAuthSchemeParametersProvider(e,c,s.input)),u=e.authSchemePreference?await e.authSchemePreference():[],t=un(o,u),r=dn(e.httpAuthSchemes),n=X(c),p=[];for(let d of t){let l=r.get(d.schemeId);if(!l){p.push(`HttpAuthScheme \`${d.schemeId}\` was not enabled for this service.`);continue}let f=l.identityProvider(await i.identityProviderConfigProvider(e));if(!f){p.push(`HttpAuthScheme \`${d.schemeId}\` did not have an IdentityProvider configured.`);continue}let{identityProperties:h={},signingProperties:g={}}=d.propertiesExtractor?.(e,c)||{};d.identityProperties=Object.assign(d.identityProperties||{},h),d.signingProperties=Object.assign(d.signingProperties||{},g),n.selectedHttpAuthScheme={httpAuthOption:d,identity:await f(d.identityProperties),signer:l.signer};break}if(!n.selectedHttpAuthScheme)throw Error(p.join(`
3
+ `));return a(s)},ze={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"},ln=(e,{httpAuthSchemeParametersProvider:i,identityProviderConfigProvider:a})=>({applyToStack:(c)=>{c.addRelativeTo(J(e,{httpAuthSchemeParametersProvider:i,identityProviderConfigProvider:a}),ze)}}),Ye={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"serializerMiddleware"},fn=(e,{httpAuthSchemeParametersProvider:i,identityProviderConfigProvider:a})=>({applyToStack:(c)=>{c.addRelativeTo(J(e,{httpAuthSchemeParametersProvider:i,identityProviderConfigProvider:a}),Ye)}}),pn=(e)=>(i)=>{throw i},hn=(e,i)=>{},je=(e)=>(i,a)=>async(c)=>{if(!Q.isInstance(c.request))return i(c);let o=X(a).selectedHttpAuthScheme;if(!o)throw Error("No HttpAuthScheme was selected: unable to sign request");let{httpAuthOption:{signingProperties:u={}},identity:t,signer:r}=o,n=await i({...c,request:await r.sign(c.request,t,u)}).catch((r.errorHandler||pn)(u));return(r.successHandler||hn)(n.response,u),n},Ke={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:"retryMiddleware"},gn=(e)=>({applyToStack:(i)=>{i.addRelativeTo(je(),Ke)}}),mn=(e)=>{if(typeof e==="function")return e;let i=Promise.resolve(e);return()=>i},An=async(e,i,a,c=(o)=>o,...s)=>{let o=new e(a);return o=c(o)??o,await i.send(o,...s)};function bn(e,i,a,c,s){return async function*(u,t,...r){let n=t,p=u.startingToken??n[a],d=!0,l;while(d){if(n[a]=p,s)n[s]=n[s]??u.pageSize;if(u.client instanceof e)l=await An(i,u.client,t,u.withCommand,...r);else throw Error(`Invalid client, expected instance of ${e.name}`);yield l;let f=p;p=yn(l,c),d=!!(p&&(!u.stopOnSameToken||p!==f))}return}}var yn=(e,i)=>{let a=e,c=i.split(".");for(let s of c){if(!a||typeof a!=="object")return;a=a[s]}return a};function Sn(e,i,a){if(!e.__smithy_context)e.__smithy_context={features:{}};else if(!e.__smithy_context.features)e.__smithy_context.features={};e.__smithy_context.features[i]=a}class Xe{authSchemes=new Map;constructor(e){for(let i in e){if(!an(e,i))continue;let a=e[i];if(a!==void 0)this.authSchemes.set(i,a)}}getIdentityProvider(e){return this.authSchemes.get(e)}}class Qe{async sign(e,i,a){if(!a)throw Error("request could not be signed with `apiKey` since the `name` and `in` signer properties are missing");if(!a.name)throw Error("request could not be signed with `apiKey` since the `name` signer property is missing");if(!a.in)throw Error("request could not be signed with `apiKey` since the `in` signer property is missing");if(!i.apiKey)throw Error("request could not be signed with `apiKey` since the `apiKey` is not defined");let c=Q.clone(e);if(a.in===Ve.QUERY)c.query[a.name]=i.apiKey;else if(a.in===Ve.HEADER)c.headers[a.name]=a.scheme?`${a.scheme} ${i.apiKey}`:i.apiKey;else throw Error("request can only be signed with `apiKey` locations `query` or `header`, but found: `"+a.in+"`");return c}}class Je{async sign(e,i,a){let c=Q.clone(e);if(!i.token)throw Error("request could not be signed with `token` since the `token` is not defined");return c.headers.Authorization=`Bearer ${i.token}`,c}}class Ze{async sign(e,i,a){return e}}var et=(e)=>function(a){return rt(a)&&a.expiration.getTime()-Date.now()<e},tt=300000,_n=et(tt),rt=(e)=>e.expiration!==void 0,Mn=(e,i,a)=>{if(e===void 0)return;let c=typeof e!=="function"?async()=>Promise.resolve(e):e,s,o,u,t=!1,r=async(n)=>{if(!o)o=c(n);try{s=await o,u=!0,t=!1}finally{o=void 0}return s};if(i===void 0)return async(n)=>{if(!u||n?.forceRefresh)s=await r(n);return s};return async(n)=>{if(!u||n?.forceRefresh)s=await r(n);if(t)return s;if(!a(s))return t=!0,s;if(i(s))return await r(n),s;return s}};wn.DefaultIdentityProviderConfig=Xe;wn.EXPIRATION_MS=tt;wn.HttpApiKeyAuthSigner=Qe;wn.HttpBearerAuthSigner=Je;wn.NoAuthSigner=Ze;wn.createIsIdentityExpiredFunction=et;wn.createPaginator=bn;wn.doesIdentityRequireRefresh=rt;wn.getHttpAuthSchemeEndpointRuleSetPlugin=ln;wn.getHttpAuthSchemePlugin=fn;wn.getHttpSigningPlugin=gn;wn.httpAuthSchemeEndpointRuleSetMiddlewareOptions=ze;wn.httpAuthSchemeMiddleware=J;wn.httpAuthSchemeMiddlewareOptions=Ye;wn.httpSigningMiddleware=je;wn.httpSigningMiddlewareOptions=Ke;wn.isIdentityExpired=_n;wn.memoizeIdentityProvider=Mn;wn.normalizeProvider=mn;wn.setFeature=Sn});var nt=L(function(P,Z){(function(e,i){typeof P=="object"&&typeof Z=="object"?Z.exports=i():typeof define=="function"&&define.amd?define([],i):typeof P=="object"?P.bowser=i():e.bowser=i()})(P,function(){return function(e){var i={};function a(c){if(i[c])return i[c].exports;var s=i[c]={i:c,l:!1,exports:{}};return e[c].call(s.exports,s,s.exports,a),s.l=!0,s.exports}return a.m=e,a.c=i,a.d=function(c,s,o){a.o(c,s)||Object.defineProperty(c,s,{enumerable:!0,get:o})},a.r=function(c){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(c,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(c,"__esModule",{value:!0})},a.t=function(c,s){if(1&s&&(c=a(c)),8&s)return c;if(4&s&&typeof c=="object"&&c&&c.__esModule)return c;var o=Object.create(null);if(a.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:c}),2&s&&typeof c!="string")for(var u in c)a.d(o,u,function(t){return c[t]}.bind(null,u));return o},a.n=function(c){var s=c&&c.__esModule?function(){return c.default}:function(){return c};return a.d(s,"a",s),s},a.o=function(c,s){return Object.prototype.hasOwnProperty.call(c,s)},a.p="",a(a.s=90)}({17:function(e,i,a){i.__esModule=!0,i.default=void 0;var c=a(18),s=function(){function o(){}return o.getFirstMatch=function(u,t){var r=t.match(u);return r&&r.length>0&&r[1]||""},o.getSecondMatch=function(u,t){var r=t.match(u);return r&&r.length>1&&r[2]||""},o.matchAndReturnConst=function(u,t,r){if(u.test(t))return r},o.getWindowsVersionName=function(u){switch(u){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},o.getMacOSVersionName=function(u){var t=u.split(".").splice(0,2).map(function(p){return parseInt(p,10)||0});t.push(0);var r=t[0],n=t[1];if(r===10)switch(n){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}switch(r){case 11:return"Big Sur";case 12:return"Monterey";case 13:return"Ventura";case 14:return"Sonoma";case 15:return"Sequoia";default:return}},o.getAndroidVersionName=function(u){var t=u.split(".").splice(0,2).map(function(r){return parseInt(r,10)||0});if(t.push(0),!(t[0]===1&&t[1]<5))return t[0]===1&&t[1]<6?"Cupcake":t[0]===1&&t[1]>=6?"Donut":t[0]===2&&t[1]<2?"Eclair":t[0]===2&&t[1]===2?"Froyo":t[0]===2&&t[1]>2?"Gingerbread":t[0]===3?"Honeycomb":t[0]===4&&t[1]<1?"Ice Cream Sandwich":t[0]===4&&t[1]<4?"Jelly Bean":t[0]===4&&t[1]>=4?"KitKat":t[0]===5?"Lollipop":t[0]===6?"Marshmallow":t[0]===7?"Nougat":t[0]===8?"Oreo":t[0]===9?"Pie":void 0},o.getVersionPrecision=function(u){return u.split(".").length},o.compareVersions=function(u,t,r){r===void 0&&(r=!1);var n=o.getVersionPrecision(u),p=o.getVersionPrecision(t),d=Math.max(n,p),l=0,f=o.map([u,t],function(h){var g=d-o.getVersionPrecision(h),A=h+Array(g+1).join(".0");return o.map(A.split("."),function(w){return Array(20-w.length).join("0")+w}).reverse()});for(r&&(l=d-Math.min(n,p)),d-=1;d>=l;){if(f[0][d]>f[1][d])return 1;if(f[0][d]===f[1][d]){if(d===l)return 0;d-=1}else if(f[0][d]<f[1][d])return-1}},o.map=function(u,t){var r,n=[];if(Array.prototype.map)return Array.prototype.map.call(u,t);for(r=0;r<u.length;r+=1)n.push(t(u[r]));return n},o.find=function(u,t){var r,n;if(Array.prototype.find)return Array.prototype.find.call(u,t);for(r=0,n=u.length;r<n;r+=1){var p=u[r];if(t(p,r))return p}},o.assign=function(u){for(var t,r,n=u,p=arguments.length,d=Array(p>1?p-1:0),l=1;l<p;l++)d[l-1]=arguments[l];if(Object.assign)return Object.assign.apply(Object,[u].concat(d));var f=function(){var h=d[t];typeof h=="object"&&h!==null&&Object.keys(h).forEach(function(g){n[g]=h[g]})};for(t=0,r=d.length;t<r;t+=1)f();return u},o.getBrowserAlias=function(u){return c.BROWSER_ALIASES_MAP[u]},o.getBrowserTypeByAlias=function(u){return c.BROWSER_MAP[u]||""},o}();i.default=s,e.exports=i.default},18:function(e,i,a){i.__esModule=!0,i.ENGINE_MAP=i.OS_MAP=i.PLATFORMS_MAP=i.BROWSER_MAP=i.BROWSER_ALIASES_MAP=void 0,i.BROWSER_ALIASES_MAP={AmazonBot:"amazonbot","Amazon Silk":"amazon_silk","Android Browser":"android",BaiduSpider:"baiduspider",Bada:"bada",BingCrawler:"bingcrawler",Brave:"brave",BlackBerry:"blackberry","ChatGPT-User":"chatgpt_user",Chrome:"chrome",ClaudeBot:"claudebot",Chromium:"chromium",Diffbot:"diffbot",DuckDuckBot:"duckduckbot",DuckDuckGo:"duckduckgo",Electron:"electron",Epiphany:"epiphany",FacebookExternalHit:"facebookexternalhit",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot",GPTBot:"gptbot","Internet Explorer":"ie",InternetArchiveCrawler:"internetarchivecrawler","K-Meleon":"k_meleon",LibreWolf:"librewolf",Linespider:"linespider",Maxthon:"maxthon","Meta-ExternalAds":"meta_externalads","Meta-ExternalAgent":"meta_externalagent","Meta-ExternalFetcher":"meta_externalfetcher","Meta-WebIndexer":"meta_webindexer","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver","OAI-SearchBot":"oai_searchbot",Omgilibot:"omgilibot",Opera:"opera","Opera Coast":"opera_coast","Pale Moon":"pale_moon",PerplexityBot:"perplexitybot","Perplexity-User":"perplexity_user",PhantomJS:"phantomjs",PingdomBot:"pingdombot",Puffin:"puffin",QQ:"qq",QQLite:"qqlite",QupZilla:"qupzilla",Roku:"roku",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SlackBot:"slackbot",SeaMonkey:"seamonkey",Sleipnir:"sleipnir","Sogou Browser":"sogou",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat",YahooSlurp:"yahooslurp","Yandex Browser":"yandex",YandexBot:"yandexbot",YouBot:"youbot"},i.BROWSER_MAP={amazonbot:"AmazonBot",amazon_silk:"Amazon Silk",android:"Android Browser",baiduspider:"BaiduSpider",bada:"Bada",bingcrawler:"BingCrawler",blackberry:"BlackBerry",brave:"Brave",chatgpt_user:"ChatGPT-User",chrome:"Chrome",claudebot:"ClaudeBot",chromium:"Chromium",diffbot:"Diffbot",duckduckbot:"DuckDuckBot",duckduckgo:"DuckDuckGo",edge:"Microsoft Edge",electron:"Electron",epiphany:"Epiphany",facebookexternalhit:"FacebookExternalHit",firefox:"Firefox",focus:"Focus",generic:"Generic",google_search:"Google Search",googlebot:"Googlebot",gptbot:"GPTBot",ie:"Internet Explorer",internetarchivecrawler:"InternetArchiveCrawler",k_meleon:"K-Meleon",librewolf:"LibreWolf",linespider:"Linespider",maxthon:"Maxthon",meta_externalads:"Meta-ExternalAds",meta_externalagent:"Meta-ExternalAgent",meta_externalfetcher:"Meta-ExternalFetcher",meta_webindexer:"Meta-WebIndexer",mz:"MZ Browser",naver:"NAVER Whale Browser",oai_searchbot:"OAI-SearchBot",omgilibot:"Omgilibot",opera:"Opera",opera_coast:"Opera Coast",pale_moon:"Pale Moon",perplexitybot:"PerplexityBot",perplexity_user:"Perplexity-User",phantomjs:"PhantomJS",pingdombot:"PingdomBot",puffin:"Puffin",qq:"QQ Browser",qqlite:"QQ Browser Lite",qupzilla:"QupZilla",roku:"Roku",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",slackbot:"SlackBot",sleipnir:"Sleipnir",sogou:"Sogou Browser",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yahooslurp:"YahooSlurp",yandex:"Yandex Browser",yandexbot:"YandexBot",youbot:"YouBot"},i.PLATFORMS_MAP={bot:"bot",desktop:"desktop",mobile:"mobile",tablet:"tablet",tv:"tv"},i.OS_MAP={Android:"Android",Bada:"Bada",BlackBerry:"BlackBerry",ChromeOS:"Chrome OS",HarmonyOS:"HarmonyOS",iOS:"iOS",Linux:"Linux",MacOS:"macOS",PlayStation4:"PlayStation 4",Roku:"Roku",Tizen:"Tizen",WebOS:"WebOS",Windows:"Windows",WindowsPhone:"Windows Phone"},i.ENGINE_MAP={Blink:"Blink",EdgeHTML:"EdgeHTML",Gecko:"Gecko",Presto:"Presto",Trident:"Trident",WebKit:"WebKit"}},90:function(e,i,a){i.__esModule=!0,i.default=void 0;var c,s=(c=a(91))&&c.__esModule?c:{default:c},o=a(18);function u(r,n){for(var p=0;p<n.length;p++){var d=n[p];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(r,d.key,d)}}var t=function(){function r(){}var n,p,d;return r.getParser=function(l,f,h){if(f===void 0&&(f=!1),h===void 0&&(h=null),typeof l!="string")throw Error("UserAgent should be a string");return new s.default(l,f,h)},r.parse=function(l,f){return f===void 0&&(f=null),new s.default(l,f).getResult()},n=r,d=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}],(p=null)&&u(n.prototype,p),d&&u(n,d),r}();i.default=t,e.exports=i.default},91:function(e,i,a){i.__esModule=!0,i.default=void 0;var c=r(a(92)),s=r(a(93)),o=r(a(94)),u=r(a(95)),t=r(a(17));function r(p){return p&&p.__esModule?p:{default:p}}var n=function(){function p(l,f,h){if(f===void 0&&(f=!1),h===void 0&&(h=null),l==null||l==="")throw Error("UserAgent parameter can't be empty");this._ua=l;var g=!1;typeof f=="boolean"?(g=f,this._hints=h):this._hints=f!=null&&typeof f=="object"?f:null,this.parsedResult={},g!==!0&&this.parse()}var d=p.prototype;return d.getHints=function(){return this._hints},d.hasBrand=function(l){if(!this._hints||!Array.isArray(this._hints.brands))return!1;var f=l.toLowerCase();return this._hints.brands.some(function(h){return h.brand&&h.brand.toLowerCase()===f})},d.getBrandVersion=function(l){if(this._hints&&Array.isArray(this._hints.brands)){var f=l.toLowerCase(),h=this._hints.brands.find(function(g){return g.brand&&g.brand.toLowerCase()===f});return h?h.version:void 0}},d.getUA=function(){return this._ua},d.test=function(l){return l.test(this._ua)},d.parseBrowser=function(){var l=this;this.parsedResult.browser={};var f=t.default.find(c.default,function(h){if(typeof h.test=="function")return h.test(l);if(Array.isArray(h.test))return h.test.some(function(g){return l.test(g)});throw Error("Browser's test function is not valid")});return f&&(this.parsedResult.browser=f.describe(this.getUA(),this)),this.parsedResult.browser},d.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},d.getBrowserName=function(l){return l?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},d.getBrowserVersion=function(){return this.getBrowser().version},d.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},d.parseOS=function(){var l=this;this.parsedResult.os={};var f=t.default.find(s.default,function(h){if(typeof h.test=="function")return h.test(l);if(Array.isArray(h.test))return h.test.some(function(g){return l.test(g)});throw Error("Browser's test function is not valid")});return f&&(this.parsedResult.os=f.describe(this.getUA())),this.parsedResult.os},d.getOSName=function(l){var f=this.getOS().name;return l?String(f).toLowerCase()||"":f||""},d.getOSVersion=function(){return this.getOS().version},d.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},d.getPlatformType=function(l){l===void 0&&(l=!1);var f=this.getPlatform().type;return l?String(f).toLowerCase()||"":f||""},d.parsePlatform=function(){var l=this;this.parsedResult.platform={};var f=t.default.find(o.default,function(h){if(typeof h.test=="function")return h.test(l);if(Array.isArray(h.test))return h.test.some(function(g){return l.test(g)});throw Error("Browser's test function is not valid")});return f&&(this.parsedResult.platform=f.describe(this.getUA())),this.parsedResult.platform},d.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},d.getEngineName=function(l){return l?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},d.parseEngine=function(){var l=this;this.parsedResult.engine={};var f=t.default.find(u.default,function(h){if(typeof h.test=="function")return h.test(l);if(Array.isArray(h.test))return h.test.some(function(g){return l.test(g)});throw Error("Browser's test function is not valid")});return f&&(this.parsedResult.engine=f.describe(this.getUA())),this.parsedResult.engine},d.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},d.getResult=function(){return t.default.assign({},this.parsedResult)},d.satisfies=function(l){var f=this,h={},g=0,A={},w=0;if(Object.keys(l).forEach(function(y){var x=l[y];typeof x=="string"?(A[y]=x,w+=1):typeof x=="object"&&(h[y]=x,g+=1)}),g>0){var ue=Object.keys(h),de=t.default.find(ue,function(y){return f.isOS(y)});if(de){var le=this.satisfies(h[de]);if(le!==void 0)return le}var fe=t.default.find(ue,function(y){return f.isPlatform(y)});if(fe){var pe=this.satisfies(h[fe]);if(pe!==void 0)return pe}}if(w>0){var Ut=Object.keys(A),he=t.default.find(Ut,function(y){return f.isBrowser(y,!0)});if(he!==void 0)return this.compareVersion(A[he])}},d.isBrowser=function(l,f){f===void 0&&(f=!1);var h=this.getBrowserName().toLowerCase(),g=l.toLowerCase(),A=t.default.getBrowserTypeByAlias(g);return f&&A&&(g=A.toLowerCase()),g===h},d.compareVersion=function(l){var f=[0],h=l,g=!1,A=this.getBrowserVersion();if(typeof A=="string")return l[0]===">"||l[0]==="<"?(h=l.substr(1),l[1]==="="?(g=!0,h=l.substr(2)):f=[],l[0]===">"?f.push(1):f.push(-1)):l[0]==="="?h=l.substr(1):l[0]==="~"&&(g=!0,h=l.substr(1)),f.indexOf(t.default.compareVersions(A,h,g))>-1},d.isOS=function(l){return this.getOSName(!0)===String(l).toLowerCase()},d.isPlatform=function(l){return this.getPlatformType(!0)===String(l).toLowerCase()},d.isEngine=function(l){return this.getEngineName(!0)===String(l).toLowerCase()},d.is=function(l,f){return f===void 0&&(f=!1),this.isBrowser(l,f)||this.isOS(l)||this.isPlatform(l)},d.some=function(l){var f=this;return l===void 0&&(l=[]),l.some(function(h){return f.is(h)})},p}();i.default=n,e.exports=i.default},92:function(e,i,a){i.__esModule=!0,i.default=void 0;var c,s=(c=a(17))&&c.__esModule?c:{default:c},o=/version\/(\d+(\.?_?\d+)+)/i,u=[{test:[/gptbot/i],describe:function(t){var r={name:"GPTBot"},n=s.default.getFirstMatch(/gptbot\/(\d+(\.\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/chatgpt-user/i],describe:function(t){var r={name:"ChatGPT-User"},n=s.default.getFirstMatch(/chatgpt-user\/(\d+(\.\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/oai-searchbot/i],describe:function(t){var r={name:"OAI-SearchBot"},n=s.default.getFirstMatch(/oai-searchbot\/(\d+(\.\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe:function(t){var r={name:"ClaudeBot"},n=s.default.getFirstMatch(/(?:claudebot|claude-web|claude-user|claude-searchbot)\/(\d+(\.\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/omgilibot/i,/webzio-extended/i],describe:function(t){var r={name:"Omgilibot"},n=s.default.getFirstMatch(/(?:omgilibot|webzio-extended)\/(\d+(\.\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/diffbot/i],describe:function(t){var r={name:"Diffbot"},n=s.default.getFirstMatch(/diffbot\/(\d+(\.\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/perplexitybot/i],describe:function(t){var r={name:"PerplexityBot"},n=s.default.getFirstMatch(/perplexitybot\/(\d+(\.\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/perplexity-user/i],describe:function(t){var r={name:"Perplexity-User"},n=s.default.getFirstMatch(/perplexity-user\/(\d+(\.\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/youbot/i],describe:function(t){var r={name:"YouBot"},n=s.default.getFirstMatch(/youbot\/(\d+(\.\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/meta-webindexer/i],describe:function(t){var r={name:"Meta-WebIndexer"},n=s.default.getFirstMatch(/meta-webindexer\/(\d+(\.\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/meta-externalads/i],describe:function(t){var r={name:"Meta-ExternalAds"},n=s.default.getFirstMatch(/meta-externalads\/(\d+(\.\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/meta-externalagent/i],describe:function(t){var r={name:"Meta-ExternalAgent"},n=s.default.getFirstMatch(/meta-externalagent\/(\d+(\.\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/meta-externalfetcher/i],describe:function(t){var r={name:"Meta-ExternalFetcher"},n=s.default.getFirstMatch(/meta-externalfetcher\/(\d+(\.\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/googlebot/i],describe:function(t){var r={name:"Googlebot"},n=s.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/linespider/i],describe:function(t){var r={name:"Linespider"},n=s.default.getFirstMatch(/(?:linespider)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/amazonbot/i],describe:function(t){var r={name:"AmazonBot"},n=s.default.getFirstMatch(/amazonbot\/(\d+(\.\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/bingbot/i],describe:function(t){var r={name:"BingCrawler"},n=s.default.getFirstMatch(/bingbot\/(\d+(\.\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/baiduspider/i],describe:function(t){var r={name:"BaiduSpider"},n=s.default.getFirstMatch(/baiduspider\/(\d+(\.\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/duckduckbot/i],describe:function(t){var r={name:"DuckDuckBot"},n=s.default.getFirstMatch(/duckduckbot\/(\d+(\.\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/ia_archiver/i],describe:function(t){var r={name:"InternetArchiveCrawler"},n=s.default.getFirstMatch(/ia_archiver\/(\d+(\.\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe:function(){return{name:"FacebookExternalHit"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe:function(t){var r={name:"SlackBot"},n=s.default.getFirstMatch(/(?:slackbot|slack-imgproxy)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/yahoo!?[\s/]*slurp/i],describe:function(){return{name:"YahooSlurp"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe:function(){return{name:"YandexBot"}}},{test:[/pingdom/i],describe:function(){return{name:"PingdomBot"}}},{test:[/opera/i],describe:function(t){var r={name:"Opera"},n=s.default.getFirstMatch(o,t)||s.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:[/opr\/|opios/i],describe:function(t){var r={name:"Opera"},n=s.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/SamsungBrowser/i],describe:function(t){var r={name:"Samsung Internet for Android"},n=s.default.getFirstMatch(o,t)||s.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:[/Whale/i],describe:function(t){var r={name:"NAVER Whale Browser"},n=s.default.getFirstMatch(o,t)||s.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return n&&(r.version=n),r}},{test:[/PaleMoon/i],describe:function(t){var r={name:"Pale Moon"},n=s.default.getFirstMatch(o,t)||s.default.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i,t);return n&&(r.version=n),r}},{test:[/MZBrowser/i],describe:function(t){var r={name:"MZ Browser"},n=s.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/focus/i],describe:function(t){var r={name:"Focus"},n=s.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/swing/i],describe:function(t){var r={name:"Swing"},n=s.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/coast/i],describe:function(t){var r={name:"Opera Coast"},n=s.default.getFirstMatch(o,t)||s.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(t){var r={name:"Opera Touch"},n=s.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/yabrowser/i],describe:function(t){var r={name:"Yandex Browser"},n=s.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/ucbrowser/i],describe:function(t){var r={name:"UC Browser"},n=s.default.getFirstMatch(o,t)||s.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:[/Maxthon|mxios/i],describe:function(t){var r={name:"Maxthon"},n=s.default.getFirstMatch(o,t)||s.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:[/epiphany/i],describe:function(t){var r={name:"Epiphany"},n=s.default.getFirstMatch(o,t)||s.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:[/puffin/i],describe:function(t){var r={name:"Puffin"},n=s.default.getFirstMatch(o,t)||s.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:[/sleipnir/i],describe:function(t){var r={name:"Sleipnir"},n=s.default.getFirstMatch(o,t)||s.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:[/k-meleon/i],describe:function(t){var r={name:"K-Meleon"},n=s.default.getFirstMatch(o,t)||s.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:[/micromessenger/i],describe:function(t){var r={name:"WeChat"},n=s.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/qqbrowser/i],describe:function(t){var r={name:/qqbrowserlite/i.test(t)?"QQ Browser Lite":"QQ Browser"},n=s.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/msie|trident/i],describe:function(t){var r={name:"Internet Explorer"},n=s.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:[/\sedg\//i],describe:function(t){var r={name:"Microsoft Edge"},n=s.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:[/edg([ea]|ios)/i],describe:function(t){var r={name:"Microsoft Edge"},n=s.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:[/vivaldi/i],describe:function(t){var r={name:"Vivaldi"},n=s.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:[/seamonkey/i],describe:function(t){var r={name:"SeaMonkey"},n=s.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:[/sailfish/i],describe:function(t){var r={name:"Sailfish"},n=s.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,t);return n&&(r.version=n),r}},{test:[/silk/i],describe:function(t){var r={name:"Amazon Silk"},n=s.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:[/phantom/i],describe:function(t){var r={name:"PhantomJS"},n=s.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:[/slimerjs/i],describe:function(t){var r={name:"SlimerJS"},n=s.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(t){var r={name:"BlackBerry"},n=s.default.getFirstMatch(o,t)||s.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(t){var r={name:"WebOS Browser"},n=s.default.getFirstMatch(o,t)||s.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:[/bada/i],describe:function(t){var r={name:"Bada"},n=s.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:[/tizen/i],describe:function(t){var r={name:"Tizen"},n=s.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/qupzilla/i],describe:function(t){var r={name:"QupZilla"},n=s.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/librewolf/i],describe:function(t){var r={name:"LibreWolf"},n=s.default.getFirstMatch(/(?:librewolf)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:[/firefox|iceweasel|fxios/i],describe:function(t){var r={name:"Firefox"},n=s.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:[/electron/i],describe:function(t){var r={name:"Electron"},n=s.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:[/sogoumobilebrowser/i,/metasr/i,/se 2\.[x]/i],describe:function(t){var r={name:"Sogou Browser"},n=s.default.getFirstMatch(/(?:sogoumobilebrowser)[\s/](\d+(\.?_?\d+)+)/i,t),p=s.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t),d=s.default.getFirstMatch(/se ([\d.]+)x/i,t),l=n||p||d;return l&&(r.version=l),r}},{test:[/MiuiBrowser/i],describe:function(t){var r={name:"Miui"},n=s.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:function(t){return!!t.hasBrand("DuckDuckGo")||t.test(/\sDdg\/[\d.]+$/i)},describe:function(t,r){var n={name:"DuckDuckGo"};if(r){var p=r.getBrandVersion("DuckDuckGo");if(p)return n.version=p,n}var d=s.default.getFirstMatch(/\sDdg\/([\d.]+)$/i,t);return d&&(n.version=d),n}},{test:function(t){return t.hasBrand("Brave")},describe:function(t,r){var n={name:"Brave"};if(r){var p=r.getBrandVersion("Brave");if(p)return n.version=p,n}return n}},{test:[/chromium/i],describe:function(t){var r={name:"Chromium"},n=s.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/chrome|crios|crmo/i],describe:function(t){var r={name:"Chrome"},n=s.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:[/GSA/i],describe:function(t){var r={name:"Google Search"},n=s.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:function(t){var r=!t.test(/like android/i),n=t.test(/android/i);return r&&n},describe:function(t){var r={name:"Android Browser"},n=s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/playstation 4/i],describe:function(t){var r={name:"PlayStation 4"},n=s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/safari|applewebkit/i],describe:function(t){var r={name:"Safari"},n=s.default.getFirstMatch(o,t);return n&&(r.version=n),r}},{test:[/.*/i],describe:function(t){var r=t.search("\\(")!==-1?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:s.default.getFirstMatch(r,t),version:s.default.getSecondMatch(r,t)}}}];i.default=u,e.exports=i.default},93:function(e,i,a){i.__esModule=!0,i.default=void 0;var c,s=(c=a(17))&&c.__esModule?c:{default:c},o=a(18),u=[{test:[/Roku\/DVP/],describe:function(t){var r=s.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:o.OS_MAP.Roku,version:r}}},{test:[/windows phone/i],describe:function(t){var r=s.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:o.OS_MAP.WindowsPhone,version:r}}},{test:[/windows /i],describe:function(t){var r=s.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),n=s.default.getWindowsVersionName(r);return{name:o.OS_MAP.Windows,version:r,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(t){var r={name:o.OS_MAP.iOS},n=s.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,t);return n&&(r.version=n),r}},{test:[/macintosh/i],describe:function(t){var r=s.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),n=s.default.getMacOSVersionName(r),p={name:o.OS_MAP.MacOS,version:r};return n&&(p.versionName=n),p}},{test:[/(ipod|iphone|ipad)/i],describe:function(t){var r=s.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,t).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:r}}},{test:[/OpenHarmony/i],describe:function(t){var r=s.default.getFirstMatch(/OpenHarmony\s+(\d+(\.\d+)*)/i,t);return{name:o.OS_MAP.HarmonyOS,version:r}}},{test:function(t){var r=!t.test(/like android/i),n=t.test(/android/i);return r&&n},describe:function(t){var r=s.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),n=s.default.getAndroidVersionName(r),p={name:o.OS_MAP.Android,version:r};return n&&(p.versionName=n),p}},{test:[/(web|hpw)[o0]s/i],describe:function(t){var r=s.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),n={name:o.OS_MAP.WebOS};return r&&r.length&&(n.version=r),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(t){var r=s.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,t)||s.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,t)||s.default.getFirstMatch(/\bbb(\d+)/i,t);return{name:o.OS_MAP.BlackBerry,version:r}}},{test:[/bada/i],describe:function(t){var r=s.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:o.OS_MAP.Bada,version:r}}},{test:[/tizen/i],describe:function(t){var r=s.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:o.OS_MAP.Tizen,version:r}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(t){var r=s.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:o.OS_MAP.PlayStation4,version:r}}}];i.default=u,e.exports=i.default},94:function(e,i,a){i.__esModule=!0,i.default=void 0;var c,s=(c=a(17))&&c.__esModule?c:{default:c},o=a(18),u=[{test:[/googlebot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Google"}}},{test:[/linespider/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Line"}}},{test:[/amazonbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Amazon"}}},{test:[/gptbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/chatgpt-user/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/oai-searchbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/baiduspider/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Baidu"}}},{test:[/bingbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Bing"}}},{test:[/duckduckbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"DuckDuckGo"}}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Anthropic"}}},{test:[/omgilibot/i,/webzio-extended/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Webz.io"}}},{test:[/diffbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Diffbot"}}},{test:[/perplexitybot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Perplexity AI"}}},{test:[/perplexity-user/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Perplexity AI"}}},{test:[/youbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"You.com"}}},{test:[/ia_archiver/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Internet Archive"}}},{test:[/meta-webindexer/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalads/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalagent/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalfetcher/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Slack"}}},{test:[/yahoo/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Yahoo"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Yandex"}}},{test:[/pingdom/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Pingdom"}}},{test:[/huawei/i],describe:function(t){var r=s.default.getFirstMatch(/(can-l01)/i,t)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return r&&(n.model=r),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(t){var r=t.test(/ipod|iphone/i),n=t.test(/like (ipod|iphone)/i);return r&&!n},describe:function(t){var r=s.default.getFirstMatch(/(ipod|iphone)/i,t);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:r}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/Nokia/i],describe:function(t){var r=s.default.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i,t),n={type:o.PLATFORMS_MAP.mobile,vendor:"Nokia"};return r&&(n.model=r),n}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(t){return t.getBrowserName(!0)==="blackberry"},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(t){return t.getBrowserName(!0)==="bada"},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(t){return t.getBrowserName()==="windows phone"},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(t){var r=Number(String(t.getOSVersion()).split(".")[0]);return t.getOSName(!0)==="android"&&r>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(t){return t.getOSName(!0)==="android"},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:[/smart-?tv|smarttv/i],describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:[/netcast/i],describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(t){return t.getOSName(!0)==="macos"},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(t){return t.getOSName(!0)==="windows"},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(t){return t.getOSName(!0)==="linux"},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(t){return t.getOSName(!0)==="playstation 4"},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(t){return t.getOSName(!0)==="roku"},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];i.default=u,e.exports=i.default},95:function(e,i,a){i.__esModule=!0,i.default=void 0;var c,s=(c=a(17))&&c.__esModule?c:{default:c},o=a(18),u=[{test:function(t){return t.getBrowserName(!0)==="microsoft edge"},describe:function(t){if(/\sedg\//i.test(t))return{name:o.ENGINE_MAP.Blink};var r=s.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:o.ENGINE_MAP.EdgeHTML,version:r}}},{test:[/trident/i],describe:function(t){var r={name:o.ENGINE_MAP.Trident},n=s.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:function(t){return t.test(/presto/i)},describe:function(t){var r={name:o.ENGINE_MAP.Presto},n=s.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:function(t){var r=t.test(/gecko/i),n=t.test(/like gecko/i);return r&&!n},describe:function(t){var r={name:o.ENGINE_MAP.Gecko},n=s.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(t){var r={name:o.ENGINE_MAP.WebKit},n=s.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return n&&(r.version=n),r}}];i.default=u,e.exports=i.default}})})});var Yt=L(function(qi){var{Retry:Yn,RETRY_MODES:it}=Ts(),{HttpRequest:se,parseUrl:jn}=sr(),{InvokeStore:st}=$e(),{normalizeProvider:Kn}=Ko(),{platform:Xn,release:Qn}=ae("os"),{versions:ee,env:ot}=ae("process"),{isValidHostLabel:Jn,isIpAddress:ft,customEndpointFunctions:Zn}=Tn(),{EndpointError:ei,resolveEndpoint:ti}=Tn();qi.EndpointError=ei;qi.isIpAddress=ft;qi.resolveEndpoint=ti;var{loadConfig:ri,NODE_REGION_CONFIG_OPTIONS:pt,NODE_REGION_CONFIG_FILE_OPTIONS:ht}=at(),{REGION_ENV_NAME:ni,REGION_INI_NAME:ii,resolveRegionConfig:si}=at();qi.NODE_REGION_CONFIG_FILE_OPTIONS=ht;qi.NODE_REGION_CONFIG_OPTIONS=pt;qi.REGION_ENV_NAME=ni;qi.REGION_INI_NAME=ii;qi.resolveRegionConfig=si;var U={warningEmitted:!1},oi=(e)=>{if(e&&!U.warningEmitted){if(process.env.AWS_SDK_JS_NODE_VERSION_SUPPORT_WARNING_DISABLED==="true"){U.warningEmitted=!0;return}let i=parseInt(e.substring(1,e.indexOf("."))),a=22;if(i<a)U.warningEmitted=!0,process.emitWarning(`NodeVersionSupportWarning: The AWS SDK for JavaScript (v3)
4
+ versions published after the first week of January 2027
5
+ will require node >=${a}. You are running node ${e}.
6
+
7
+ To continue receiving updates to AWS services, bug fixes,
8
+ and security updates please upgrade to node >=${a}.
9
+
10
+ More information can be found at: https://a.co/c895JFp`)}},ai=()=>(e,i)=>async(a)=>(i.__retryLongPoll=!0,e(a)),ci={name:"longPollMiddleware",tags:["RETRY"],step:"initialize",override:!0},ui=(e)=>({applyToStack:(i)=>{i.add(ai(),ci)}});function di(e,i,a){if(!e.$source)e.$source={};return e.$source[i]=a,e}Yn.v2026||=typeof process==="object"&&process.env?.AWS_NEW_RETRIES_2026==="true";function b(e,i,a){if(!e.__aws_sdk_context)e.__aws_sdk_context={features:{}};else if(!e.__aws_sdk_context.features)e.__aws_sdk_context.features={};e.__aws_sdk_context.features[i]=a}function li(e,i,a){if(!e.$source)e.$source={};return e.$source[i]=a,e}function fi(e){return e}var gt=(e)=>(i)=>async(a)=>{if(!se.isInstance(a.request))return i(a);let{request:c}=a,{handlerProtocol:s=""}=e.requestHandler.metadata||{};if(s.indexOf("h2")>=0&&!c.headers[":authority"])delete c.headers.host,c.headers[":authority"]=c.hostname+(c.port?":"+c.port:"");else if(!c.headers.host){let o=c.hostname;if(c.port!=null)o+=`:${c.port}`;c.headers.host=o}return i(a)},mt={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},pi=(e)=>({applyToStack:(i)=>{i.add(gt(e),mt)}}),At=()=>(e,i)=>async(a)=>{try{let c=await e(a),{clientName:s,commandName:o,logger:u,dynamoDbDocumentClientOptions:t={}}=i,{overrideInputFilterSensitiveLog:r,overrideOutputFilterSensitiveLog:n}=t,p=r??i.inputFilterSensitiveLog,d=n??i.outputFilterSensitiveLog,{$metadata:l,...f}=c.output;return u?.info?.({clientName:s,commandName:o,input:p(a.input),output:d(f),metadata:l}),c}catch(c){let{clientName:s,commandName:o,logger:u,dynamoDbDocumentClientOptions:t={}}=i,{overrideInputFilterSensitiveLog:r}=t,n=r??i.inputFilterSensitiveLog;throw u?.error?.({clientName:s,commandName:o,input:n(a.input),error:c,metadata:c.$metadata}),c}},bt={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},hi=(e)=>({applyToStack:(i)=>{i.add(At(),bt)}}),yt={step:"build",tags:["RECURSION_DETECTION","TRACE_CONTEXT_PROPAGATION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},gi="AWS_LAMBDA_FUNCTION_NAME",mi="_X_AMZN_TRACE_ID",te="X-Amzn-Trace-Id",ie="traceparent",St="tracestate",_t="baggage",Mt=()=>(e)=>async(i)=>{let{request:a}=i;if(!se.isInstance(a))return e(i);let c;{let s=Object.keys(a.headers??{}).find((o)=>o.toLowerCase()===te.toLowerCase())??te;if(!a.headers.hasOwnProperty(s)){let o=process.env[gi],u=process.env[mi];c??=await st.getInstanceAsync();let r=c?.getXRayTraceId()??u,n=(p)=>typeof p==="string"&&p.length>0;if(n(o)&&n(r))a.headers[te]=r}}if(Ai(a.headers),!a.headers[ie]){let o=(c??=await st.getInstanceAsync())?.getTraceparent?.();if(o){a.headers[ie]=o;let u=c?.getTracestate?.();if(u)a.headers[St]=u;let t=c?.getBaggage?.();if(t)a.headers[_t]=t}}return e(i)};function Ai(e){for(let i of Object.keys(e)){let a=i.toLowerCase();if(i!==a&&(a===ie||a===St||a===_t))e[a]=e[i],delete e[i]}}var bi=(e)=>({applyToStack:(i)=>{i.add(Mt(),yt)}}),oe=void 0;function yi(e){if(e===void 0)return!0;return typeof e==="string"&&e.length<=50}function Si(e){let i=Kn(e.userAgentAppId??oe),{customUserAgent:a}=e;return Object.assign(e,{customUserAgent:typeof a==="string"?[[a]]:a,userAgentAppId:async()=>{let c=await i();if(!yi(c)){let s=e.logger?.constructor?.name==="NoOpLogger"||!e.logger?console:e.logger;if(typeof c!=="string")s?.warn("userAgentAppId must be a string or undefined.");else if(c.length>50)s?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.")}return c}})}var wt={partitions:[{id:"aws",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-east-1",name:"aws",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$",regions:{"af-south-1":{description:"Africa (Cape Town)"},"ap-east-1":{description:"Asia Pacific (Hong Kong)"},"ap-east-2":{description:"Asia Pacific (Taipei)"},"ap-northeast-1":{description:"Asia Pacific (Tokyo)"},"ap-northeast-2":{description:"Asia Pacific (Seoul)"},"ap-northeast-3":{description:"Asia Pacific (Osaka)"},"ap-south-1":{description:"Asia Pacific (Mumbai)"},"ap-south-2":{description:"Asia Pacific (Hyderabad)"},"ap-southeast-1":{description:"Asia Pacific (Singapore)"},"ap-southeast-2":{description:"Asia Pacific (Sydney)"},"ap-southeast-3":{description:"Asia Pacific (Jakarta)"},"ap-southeast-4":{description:"Asia Pacific (Melbourne)"},"ap-southeast-5":{description:"Asia Pacific (Malaysia)"},"ap-southeast-6":{description:"Asia Pacific (New Zealand)"},"ap-southeast-7":{description:"Asia Pacific (Thailand)"},"aws-global":{description:"aws global region"},"ca-central-1":{description:"Canada (Central)"},"ca-west-1":{description:"Canada West (Calgary)"},"eu-central-1":{description:"Europe (Frankfurt)"},"eu-central-2":{description:"Europe (Zurich)"},"eu-north-1":{description:"Europe (Stockholm)"},"eu-south-1":{description:"Europe (Milan)"},"eu-south-2":{description:"Europe (Spain)"},"eu-west-1":{description:"Europe (Ireland)"},"eu-west-2":{description:"Europe (London)"},"eu-west-3":{description:"Europe (Paris)"},"il-central-1":{description:"Israel (Tel Aviv)"},"me-central-1":{description:"Middle East (UAE)"},"me-south-1":{description:"Middle East (Bahrain)"},"mx-central-1":{description:"Mexico (Central)"},"sa-east-1":{description:"South America (Sao Paulo)"},"us-east-1":{description:"US East (N. Virginia)"},"us-east-2":{description:"US East (Ohio)"},"us-west-1":{description:"US West (N. California)"},"us-west-2":{description:"US West (Oregon)"}}},{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn",dualStackDnsSuffix:"api.amazonwebservices.com.cn",implicitGlobalRegion:"cn-northwest-1",name:"aws-cn",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:{"aws-cn-global":{description:"aws-cn global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-eusc",outputs:{dnsSuffix:"amazonaws.eu",dualStackDnsSuffix:"api.amazonwebservices.eu",implicitGlobalRegion:"eusc-de-east-1",name:"aws-eusc",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eusc\\-(de)\\-\\w+\\-\\d+$",regions:{"eusc-de-east-1":{description:"AWS European Sovereign Cloud (Germany)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"api.aws.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"aws-iso global region"},"us-iso-east-1":{description:"US ISO East"},"us-iso-west-1":{description:"US ISO WEST"}}},{id:"aws-iso-b",outputs:{dnsSuffix:"sc2s.sgov.gov",dualStackDnsSuffix:"api.aws.scloud",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"aws-iso-b global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"},"us-isob-west-1":{description:"US ISOB West"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"api.cloud-aws.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"aws-iso-e-global":{description:"aws-iso-e global region"},"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"api.aws.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{"aws-iso-f-global":{description:"aws-iso-f global region"},"us-isof-east-1":{description:"US ISOF EAST"},"us-isof-south-1":{description:"US ISOF SOUTH"}}},{id:"aws-us-gov",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-gov-west-1",name:"aws-us-gov",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-gov\\-\\w+\\-\\d+$",regions:{"aws-us-gov-global":{description:"aws-us-gov global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}}],version:"1.1"},vt=wt,Et="",Tt=(e)=>{let{partitions:i}=vt;for(let c of i){let{regions:s,outputs:o}=c;for(let[u,t]of Object.entries(s))if(u===e)return{...o,...t}}for(let c of i){let{regionRegex:s,outputs:o}=c;if(new RegExp(s).test(e))return{...o}}let a=i.find((c)=>c.id==="aws");if(!a)throw Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...a.outputs}},Rt=(e,i="")=>{vt=e,Et=i},_i=()=>{Rt(wt,"")},Pt=()=>Et,Mi=/\d{12}\.ddb/;async function wi(e,i,a){if(a.request?.headers?.["smithy-protocol"]==="rpc-v2-cbor")b(e,"PROTOCOL_RPC_V2_CBOR","M");if(typeof i.retryStrategy==="function"){let o=await i.retryStrategy();if(typeof o.mode==="string")switch(o.mode){case it.ADAPTIVE:b(e,"RETRY_MODE_ADAPTIVE","F");break;case it.STANDARD:b(e,"RETRY_MODE_STANDARD","E");break}}if(typeof i.accountIdEndpointMode==="function"){let o=e.endpointV2;if(String(o?.url?.hostname).match(Mi))b(e,"ACCOUNT_ID_ENDPOINT","O");switch(await i.accountIdEndpointMode?.()){case"disabled":b(e,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":b(e,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":b(e,"ACCOUNT_ID_MODE_REQUIRED","R");break}}let s=e.__smithy_context?.selectedHttpAuthScheme?.identity;if(s?.$source){let o=s;if(o.accountId)b(e,"RESOLVED_ACCOUNT_ID","T");for(let[u,t]of Object.entries(o.$source??{}))b(e,u,t)}}var ct="user-agent",re="x-amz-user-agent",ut=" ",ne="/",vi=/[^!$%&'*+\-.^_`|~\w]/g,Ei=/[^!$%&'*+\-.^_`|~\w#]/g,dt="-",Ti=1024;function Ri(e){let i="";for(let a in e){let c=e[a];if(i.length+c.length+1<=Ti){if(i.length)i+=","+c;else i+=c;continue}break}return i}var xt=(e)=>(i,a)=>async(c)=>{let{request:s}=c;if(!se.isInstance(s))return i(c);let{headers:o}=s,u=a?.userAgent?.map(B)||[],t=(await e.defaultUserAgentProvider()).map(B);await wi(a,e,c);let r=a;t.push(`m/${Ri(Object.assign({},a.__smithy_context?.features,r.__aws_sdk_context?.features))}`);let n=e?.customUserAgent?.map(B)||[],p=await e.userAgentAppId();if(p)t.push(B(["app",`${p}`]));let d=Pt(),l=(d?[d]:[]).concat([...t,...u,...n]).join(ut),f=[...t.filter((h)=>h.startsWith("aws-sdk-")),...n].join(ut);if(e.runtime!=="browser"){if(f)o[re]=o[re]?`${o[ct]} ${f}`:f;o[ct]=l}else o[re]=l;return i({...c,request:s})},B=(e)=>{let i=e[0].split(ne).map((u)=>u.replace(vi,dt)).join(ne),a=e[1]?.replace(Ei,dt),c=i.indexOf(ne),s=i.substring(0,c),o=i.substring(c+1);if(s==="api")o=o.toLowerCase();return[s,o,a].filter((u)=>u&&u.length>0).reduce((u,t,r)=>{switch(r){case 0:return t;case 1:return`${u}/${t}`;default:return`${u}#${t}`}},"")},Ot={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},Pi=(e)=>({applyToStack:(i)=>{i.add(xt(e),Ot)}}),xi=()=>{let e=["deno","bun","llrt"];for(let i of e)if(ee[i])return[`md/${i}`,ee[i]];return["md/nodejs",ee.node]},kt={isCrtAvailable:!1},Oi=()=>{if(kt.isCrtAvailable)return["md/crt-avail"];return null},Ft=({serviceId:e,clientVersion:i})=>{let a=xi();return async(c)=>{let s=[["aws-sdk-js",i],["ua","2.1"],[`os/${Xn()}`,Qn()],["lang/js"],a],o=Oi();if(o)s.push(o);if(e)s.push([`api/${e}`,i]);if(ot.AWS_EXECUTION_ENV)s.push([`exec-env/${ot.AWS_EXECUTION_ENV}`]);let u=await c?.userAgentAppId?.();return u?[...s,[`app/${u}`]]:[...s]}},ki=Ft,It="AWS_SDK_UA_APP_ID",Nt="sdk_ua_app_id",Fi="sdk-ua-app-id",Ii={environmentVariableSelector:(e)=>e[It],configFileSelector:(e)=>e[Nt]??e[Fi],default:oe},Ni=({serviceId:e,clientVersion:i})=>async(a)=>{let c=nt(),s=c.parse??c.default.parse??(()=>""),o=typeof window<"u"&&window?.navigator?.userAgent?s(window.navigator.userAgent):void 0,u=[["aws-sdk-js",i],["ua","2.1"],[`os/${o?.os?.name||"other"}`,o?.os?.version],["lang/js"],["md/browser",`${o?.browser?.name??"unknown"}_${o?.browser?.version??"unknown"}`]];if(e)u.push([`api/${e}`,i]);let t=await a?.userAgentAppId?.();if(t)u.push([`app/${t}`]);return u},Di={os(e){if(/iPhone|iPad|iPod/.test(e))return"iOS";if(/Macintosh|Mac OS X/.test(e))return"macOS";if(/Windows NT/.test(e))return"Windows";if(/Android/.test(e))return"Android";if(/Linux/.test(e))return"Linux";return},browser(e){if(/EdgiOS|EdgA|Edg\//.test(e))return"Microsoft Edge";if(/Firefox\//.test(e))return"Firefox";if(/Chrome\//.test(e))return"Chrome";if(/Safari\//.test(e))return"Safari";return}},ce=(e,i=!1)=>{if(i){for(let a of e.split("."))if(!ce(a))return!1;return!0}if(!Jn(e))return!1;if(e.length<3||e.length>63)return!1;if(e!==e.toLowerCase())return!1;if(ft(e))return!1;return!0},lt=":",Ci="/",Dt=(e)=>{let i=e.split(lt);if(i.length<6)return null;let[a,c,s,o,u,...t]=i;if(a!=="arn"||c===""||s===""||t.join(lt)==="")return null;let r=t.map((n)=>n.split(Ci)).flat();return{partition:c,service:s,region:o,accountId:u,resourceId:r}},Ct={isVirtualHostableS3Bucket:ce,parseArn:Dt,partition:Tt};Zn.aws=Ct;var Bi=(e)=>{if(typeof e.endpointProvider!=="function")throw Error("@aws-sdk/util-endpoint - endpointProvider and endpoint missing in config for this client.");let{endpoint:i}=e;if(i===void 0)e.endpoint=async()=>Bt(e.endpointProvider({Region:typeof e.region==="function"?await e.region():e.region,UseDualStack:typeof e.useDualstackEndpoint==="function"?await e.useDualstackEndpoint():e.useDualstackEndpoint,UseFIPS:typeof e.useFipsEndpoint==="function"?await e.useFipsEndpoint():e.useFipsEndpoint,Endpoint:void 0},{logger:e.logger}));return e},Bt=(e)=>jn(e.url);function Li(e={}){return ri({...pt,async default(){if(!Lt.silence)console.warn("@aws-sdk - WARN - default STS region of us-east-1 used. See @aws-sdk/credential-providers README and set a region explicitly.");return"us-east-1"}},{...ht,...e})}var Lt={silence:!1},Ui=(e)=>({setRegion(i){e.region=i},region(){return e.region}}),Hi=(e)=>({region:e.region()});qi.DEFAULT_UA_APP_ID=oe;qi.NODE_APP_ID_CONFIG_OPTIONS=Ii;qi.UA_APP_ID_ENV_NAME=It;qi.UA_APP_ID_INI_NAME=Nt;qi.awsEndpointFunctions=Ct;qi.createDefaultUserAgentProvider=Ft;qi.createUserAgentStringParsingProvider=Ni;qi.crtAvailability=kt;qi.defaultUserAgent=ki;qi.emitWarningIfUnsupportedVersion=oi;qi.fallback=Di;qi.getAwsRegionExtensionConfiguration=Ui;qi.getHostHeaderPlugin=pi;qi.getLoggerPlugin=hi;qi.getLongPollPlugin=ui;qi.getRecursionDetectionPlugin=bi;qi.getUserAgentMiddlewareOptions=Ot;qi.getUserAgentPlugin=Pi;qi.getUserAgentPrefix=Pt;qi.hostHeaderMiddleware=gt;qi.hostHeaderMiddlewareOptions=mt;qi.isVirtualHostableS3Bucket=ce;qi.loggerMiddleware=At;qi.loggerMiddlewareOptions=bt;qi.parseArn=Dt;qi.partition=Tt;qi.recursionDetectionMiddleware=Mt;qi.recursionDetectionMiddlewareOptions=yt;qi.resolveAwsRegionExtensionConfiguration=Hi;qi.resolveDefaultAwsRegionalEndpointsConfig=Bi;qi.resolveHostHeaderConfig=fi;qi.resolveUserAgentConfig=Si;qi.setCredentialFeature=di;qi.setFeature=b;qi.setPartitionInfo=Rt;qi.setTokenFeature=li;qi.state=U;qi.stsRegionDefaultResolver=Li;qi.stsRegionWarning=Lt;qi.toEndpointV1=Bt;qi.useDefaultPartitionInfo=_i;qi.userAgentMiddleware=xt});
11
+ export{Ts,Ko,Yt};
@@ -0,0 +1 @@
1
+ import{w,Z,Y,a,g,Je,Qr,K,qe,Ge,F,tp,Lb,Wb,Jb,Yb,Xb,n_,$E,HE,PS,jS,kk,_a}from"./chunk-zarz3sqn.js";import{Zi,du}from"./chunk-73yncv54.js";import{jn}from"./chunk-fvx9k1dc.js";Z();var p=Je("/consent")({component:x});function x(){let r=p.useSearch(),o=Qr((e)=>e.user),n=o&&typeof o==="object"?o:null,[s,d]=w(null),[m,i]=w(null),c=r.client_id||"MCP Client",u=r.scope?r.scope.split(" "):["mcp"],l=async(e)=>{d(e?"accept":"deny"),i(null);try{let t=await tp.oauth2.consent({accept:e});if(t.data?.url)window.location.href=t.data.url;else if(t.error)i(t.error.message||n_()),d(null)}catch(t){i(t instanceof Error?t.message:n_()),d(null)}};return g(_a,{children:[g("div",{className:"mb-6",children:[g("div",{className:"flex items-center gap-2 mb-2 text-primary",children:[a(du,{className:"w-6 h-6"}),a("h1",{className:"text-2xl font-bold tracking-tight text-foreground",children:Jb()})]}),a("p",{className:"text-muted-foreground text-sm",children:Yb()})]}),m&&a("div",{className:"mb-6 p-3 bg-destructive/10 border border-destructive/20 text-destructive rounded-xl text-sm text-center font-medium",children:m}),g("div",{className:"space-y-4 rounded-xl border border-border bg-card p-4 mb-6 shadow-xs",children:[g("div",{className:"flex items-center justify-between text-sm pb-3 border-b border-border",children:[g("span",{className:"text-muted-foreground flex items-center gap-1.5",children:[a(Zi,{className:"w-4 h-4"}),Lb()]}),a("span",{className:"font-mono font-medium text-foreground text-xs bg-muted px-2 py-0.5 rounded",children:c})]}),n&&g("div",{className:"flex items-center justify-between text-sm pb-3 border-b border-border",children:[g("span",{className:"text-muted-foreground flex items-center gap-1.5",children:[a(jn,{className:"w-4 h-4"}),PS()]}),a("span",{className:"font-medium text-foreground text-xs",children:n.email||n.name})]}),g("div",{className:"pt-1",children:[a("span",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground block mb-2",children:kk()}),a("div",{className:"space-y-2",children:g("div",{className:"flex items-start gap-2 text-sm bg-muted/50 p-2.5 rounded-lg border border-border/50",children:[a(qe,{className:"w-4 h-4 text-emerald-500 mt-0.5 shrink-0"}),g("div",{children:[a("p",{className:"font-medium text-foreground text-xs",children:jS()}),a("div",{className:"flex flex-wrap gap-1 mt-1",children:u.map((e)=>a("span",{className:"font-mono text-[10px] text-muted-foreground bg-background px-1.5 py-0.5 rounded border border-border",children:e},e))})]})]})})]})]}),g("div",{className:"flex gap-3",children:[a(F,{type:"button",variant:"outline",className:"flex-1 h-11 rounded-xl cursor-pointer",disabled:s!==null,onClick:()=>l(!1),children:s==="deny"?g(Y,{children:[a(K,{className:"w-4 h-4 animate-spin mr-2"}),HE()]}):g(Y,{children:[a(Ge,{className:"w-4 h-4 mr-1.5"}),$E()]})}),a(F,{type:"button",className:"flex-1 h-11 bg-primary text-primary-foreground font-semibold rounded-xl shadow-xs cursor-pointer",disabled:s!==null,onClick:()=>l(!0),children:s==="accept"?g(Y,{children:[a(K,{className:"w-4 h-4 animate-spin mr-2"}),Xb()]}):g(Y,{children:[a(qe,{className:"w-4 h-4 mr-1.5"}),Wb()]})})]})]})}export{p as Route};
@@ -0,0 +1,7 @@
1
+ // @bun
2
+ function So(e){return typeof e>"u"||e===void 0}function dr(e){return typeof e==="string"}function zs(e){return typeof e==="number"}function Vi(e){return typeof e==="boolean"}function Fa(e){return e===null}function rf(e){return e instanceof Date}function La(e){return typeof e==="bigint"}function zg(e){return typeof Buffer<"u"&&Buffer.isBuffer(e)}function fr(e){return typeof e==="function"}function sn(e){return typeof e==="object"&&e!==null}function C(e){return Object.freeze(e)}function xe(e){if(x(e))return e;else return[e]}function x(e){return Array.isArray(e)}function Io(e){return e}var st=C({is(e){return e.kind==="IdentifierNode"},create(e){return C({kind:"IdentifierNode",name:e})}});var jg=["preserve rows","delete rows","drop"],fo=C({is(e){return e.kind==="CreateTableNode"},create(e){return C({kind:"CreateTableNode",table:e,columns:C([])})},cloneWithColumn(e,t){return C({...e,columns:C([...e.columns,t])})},cloneWithConstraint(e,t){return C({...e,constraints:e.constraints?C([...e.constraints,t]):C([t])})},cloneWithFrontModifier(e,t){return C({...e,frontModifiers:e.frontModifiers?C([...e.frontModifiers,t]):C([t])})},cloneWithEndModifier(e,t){return C({...e,endModifiers:e.endModifiers?C([...e.endModifiers,t]):C([t])})},cloneWith(e,t){return C({...e,...t})}});var po=C({is(e){return e.kind==="SchemableIdentifierNode"},create(e){return C({kind:"SchemableIdentifierNode",identifier:st.create(e)})},createWithSchema(e,t){return C({kind:"SchemableIdentifierNode",schema:st.create(e),identifier:st.create(t)})}});var l=C({is(e){return e.kind==="AliasNode"},create(e,t){return C({kind:"AliasNode",node:e,alias:t})}});var mo=C({is(e){return e.kind==="TableNode"},create(e){return C({kind:"TableNode",table:po.create(e)})},createWithSchema(e,t){return C({kind:"TableNode",table:po.createWithSchema(e,t)})}});function Rr(e){return sn(e)&&fr(e.toOperationNode)}function Le(e){return sn(e)&&"expressionType"in e&&Rr(e)}function Ct(e){return sn(e)&&"expression"in e&&dr(e.alias)&&Rr(e)}var I=C({is(e){return e.kind==="SelectModifierNode"},create(e,t){return C({kind:"SelectModifierNode",modifier:e,of:t})},createWithExpression(e){return C({kind:"SelectModifierNode",rawModifier:e})}});var v=C({is(e){return e.kind==="AndNode"},create(e,t){return C({kind:"AndNode",left:e,right:t})}});var T=C({is(e){return e.kind==="OrNode"},create(e,t){return C({kind:"OrNode",left:e,right:t})}});var De=C({is(e){return e.kind==="OnNode"},create(e){return C({kind:"OnNode",on:e})},cloneWithOperation(e,t,r){return C({...e,on:t==="And"?v.create(e.on,r):T.create(e.on,r)})}});var L=C({is(e){return e.kind==="JoinNode"},create(e,t){return C({kind:"JoinNode",joinType:e,table:t,on:void 0})},createWithOn(e,t,r){return C({kind:"JoinNode",joinType:e,table:t,on:De.create(r)})},cloneWithOn(e,t){return C({...e,on:e.on?De.cloneWithOperation(e.on,"And",t):De.create(t)})}});var X=C({is(e){return e.kind==="BinaryOperationNode"},create(e,t,r){return C({kind:"BinaryOperationNode",leftOperand:e,operator:t,rightOperand:r})}});var Lr=["=","==","!=","<>",">",">=","<","<=","in","not in","is","is not","like","not like","match","ilike","not ilike","@>","<@","^@","&&","?","?&","?|","!<","!>","<=>","!~","~","~*","!~*","@@","@@@","!!","<->","regexp","is distinct from","is not distinct from"],Dr=["+","-","*","/","%","^","&","|","#","<<",">>"],kt=["->","->>"],Br=[...Lr,...Dr,"&&","||"],qr=["exists","not exists"],Mr=["not","-",...qr],Et=[...Br,...kt,...Mr,"between","between symmetric"],S=C({is(e){return e.kind==="OperatorNode"},create(e){return C({kind:"OperatorNode",operator:e})}});function Ke(e){return dr(e)&&kt.includes(e)}var Wt=C({is(e){return e.kind==="ColumnNode"},create(e){return C({kind:"ColumnNode",column:st.create(e)})}});var dc=C({is(e){return e.kind==="SelectAllNode"},create(){return C({kind:"SelectAllNode"})}});var Za=C({is(e){return e.kind==="ReferenceNode"},create(e,t){return C({kind:"ReferenceNode",table:t,column:e})},createSelectAll(e){return C({kind:"ReferenceNode",table:e,column:dc.create()})}});class pm{#e;get dynamicReference(){return this.#e}get refType(){return}constructor(e){this.#e=e}toOperationNode(){return He(this.#e)}}function Be(e){return sn(e)&&Rr(e)&&dr(e.dynamicReference)}var D=C({is(e){return e.kind==="OrderByItemNode"},create(e,t){return C({kind:"OrderByItemNode",orderBy:e,direction:t})},cloneWith(e,t){return C({...e,...t})}});var tr=C({is(e){return e.kind==="RawNode"},create(e,t){return C({kind:"RawNode",sqlFragments:C(e),parameters:C(t)})},createWithSql(e){return tr.create([e],[])},createWithChild(e){return tr.create(["",""],[e])},createWithChildren(e){return tr.create(Array(e.length+1).fill(""),e)}});var At=C({is(e){return e.kind==="CollateNode"},create(e){return C({kind:"CollateNode",collation:st.create(e)})}});class Z{#e;constructor(e){this.#e=C(e)}desc(){return new Z({node:D.cloneWith(this.#e.node,{direction:tr.createWithSql("desc")})})}asc(){return new Z({node:D.cloneWith(this.#e.node,{direction:tr.createWithSql("asc")})})}nullsLast(){return new Z({node:D.cloneWith(this.#e.node,{nulls:"last"})})}nullsFirst(){return new Z({node:D.cloneWith(this.#e.node,{nulls:"first"})})}collate(e){return new Z({node:D.cloneWith(this.#e.node,{collation:At.create(e)})})}toOperationNode(){return this.#e.node}}var Rt=new Set;function hi(e){if(Rt.has(e))return;Rt.add(e),console.log(e)}function Xe(e){return e==="asc"||e==="desc"}function k(e){if(e.length===2)return[Ye(e[0],e[1])];if(e.length===1){let[t]=e;if(Array.isArray(t))return hi("orderBy(array) is deprecated, use multiple orderBy calls instead."),t.map((r)=>Ye(r));return[Ye(t)]}throw Error(`Invalid number of arguments at order by! expected 1-2, received ${e.length}`)}function Ye(e,t){let r=Pr(e);if(D.is(r)){if(t)throw Error("Cannot specify direction twice!");return r}return Tt(r,t)}function Pr(e){if(J(e))return Ho(e);if(Be(e))return e.toOperationNode();let[t,r]=e.split(" ");if(r)return hi("`orderBy('column asc')` is deprecated. Use `orderBy('column', 'asc')` instead."),Tt(is(t),r);return is(e)}function Tt(e,t){if(typeof t==="string"){if(!Xe(t))throw Error(`Invalid order by direction: ${t}`);return D.create(e,tr.createWithSql(t))}if(Le(t))return hi("`orderBy(..., expr)` is deprecated. Use `orderBy(..., 'asc')` or `orderBy(..., (ob) => ...)` instead."),D.create(e,t.toOperationNode());let r=D.create(e);if(!t)return r;return t(new Z({node:r})).toOperationNode()}var pe=C({is(e){return e.kind==="JSONReferenceNode"},create(e,t){return C({kind:"JSONReferenceNode",reference:e,traversal:t})},cloneWithTraversal(e,t){return C({...e,traversal:t})}});var qe=C({is(e){return e.kind==="JSONOperatorChainNode"},create(e){return C({kind:"JSONOperatorChainNode",operator:e,values:C([])})},cloneWithValue(e,t){return C({...e,values:C([...e.values,t])})}});var ee=C({is(e){return e.kind==="JSONPathNode"},create(e){return C({kind:"JSONPathNode",inOperator:e,pathLegs:C([])})},cloneWithLeg(e,t){return C({...e,pathLegs:C([...e.pathLegs,t])})}});function He(e){if(dr(e))return is(e);return e.toOperationNode()}function Q(e){if(x(e))return e.map((t)=>w(t));else return[w(e)]}function w(e){if(J(e))return Ho(e);return He(e)}function Lt(e,t){let r=is(e);if(Ke(t))return pe.create(r,qe.create(S.create(t)));let i=t.slice(0,-1);if(Ke(i))return pe.create(r,ee.create(S.create(i)));throw Error(`Invalid JSON operator: ${t}`)}function is(e){if(!e.includes("."))return Za.create(Wt.create(e));let r=e.split(".").map(Ze);if(r.length===3)return Ir(r);if(r.length===2)return Fr(r);throw Error(`invalid column reference ${e}`)}function Dt(e){if(e.includes(" as ")){let[r,i]=e.split(" as ").map(Ze);return l.create(is(r),st.create(i))}else return is(e)}function mm(e){return Wt.create(e)}function fc(e){if(e.includes(" ")){let[r,i]=e.split(" ").map(Ze);if(!Xe(i))throw Error(`invalid order direction "${i}" next to "${r}"`);return k([r,i])[0]}else return mm(e)}function Ir(e){let[t,r,i]=e;return Za.create(Wt.create(i),mo.createWithSchema(t,r))}function Fr(e){let[t,r]=e;return Za.create(Wt.create(r),mo.create(t))}function Ze(e){return e.trim()}var Me=C({is(e){return e.kind==="PrimitiveValueListNode"},create(e){return C({kind:"PrimitiveValueListNode",values:C([...e])})}});var Ba=C({is(e){return e.kind==="ValueListNode"},create(e){return C({kind:"ValueListNode",values:C(e)})}});var _n=C({is(e){return e.kind==="ValueNode"},create(e){return C({kind:"ValueNode",value:e})},createImmediate(e){return C({kind:"ValueNode",value:e,immediate:!0})}});function Bt(e){if(x(e))return Vr(e);return d(e)}function d(e){if(J(e))return Ho(e);return _n.create(e)}function Pe(e){return zs(e)||Vi(e)||Fa(e)}function ge(e){if(!Pe(e))throw Error(`unsafe immediate value ${JSON.stringify(e)}`);return _n.createImmediate(e)}function Vr(e){if(e.some(J))return Ba.create(e.map((t)=>d(t)));return Me.create(e)}var E=C({is(e){return e.kind==="ParensNode"},create(e){return C({kind:"ParensNode",node:e})}});function yr(e){if(e.length===3)return Ie(e[0],e[1],e[2]);else if(e.length===1)return d(e[0]);throw Error(`invalid arguments: ${JSON.stringify(e)}`)}function Ie(e,t,r){if(Ur(t)&&Mt(r))return X.create(w(e),et(t),_n.createImmediate(r));return X.create(w(e),et(t),Bt(r))}function N(e,t,r){return X.create(w(e),et(t),w(r))}function tt(e,t){return de(Object.entries(e).filter(([,r])=>!So(r)).map(([r,i])=>Ie(r,Mt(i)?"is":"=",i)),t)}function de(e,t,r=!0){let i=t==="and"?v.create:T.create;if(e.length===0)return X.create(_n.createImmediate(1),S.create("="),_n.createImmediate(t==="and"?1:0));let n=qt(e[0]);for(let a=1;a<e.length;++a)n=i(n,qt(e[a]));if(e.length>1&&r)return E.create(n);return n}function Ur(e){return e==="is"||e==="is not"}function Mt(e){return Fa(e)||Vi(e)}function et(e){if(dr(e)&&Et.includes(e))return S.create(e);if(Rr(e))return e.toOperationNode();throw Error(`invalid operator ${JSON.stringify(e)}`)}function qt(e){return Rr(e)?e.toOperationNode():e}var _=C({is(e){return e.kind==="OrderByNode"},create(e){return C({kind:"OrderByNode",items:C([...e])})},cloneWithItems(e,t){return C({...e,items:C([...e.items,...t])})}});var rt=C({is(e){return e.kind==="PartitionByNode"},create(e){return C({kind:"PartitionByNode",items:C(e)})},cloneWithItems(e,t){return C({...e,items:C([...e.items,...t])})}});var ve=C({is(e){return e.kind==="OverNode"},create(){return C({kind:"OverNode"})},cloneWithOrderByItems(e,t){return C({...e,orderBy:e.orderBy?_.cloneWithItems(e.orderBy,t):_.create(t)})},cloneWithPartitionByItems(e,t){return C({...e,partitionBy:e.partitionBy?rt.cloneWithItems(e.partitionBy,t):rt.create(t)})}});var oe=C({is(e){return e.kind==="FromNode"},create(e){return C({kind:"FromNode",froms:C(e)})},cloneWithFroms(e,t){return C({...e,froms:C([...e.froms,...t])})}});var it=C({is(e){return e.kind==="GroupByNode"},create(e){return C({kind:"GroupByNode",items:C(e)})},cloneWithItems(e,t){return C({...e,items:C([...e.items,...t])})}});var ot=C({is(e){return e.kind==="HavingNode"},create(e){return C({kind:"HavingNode",having:e})},cloneWithOperation(e,t,r){return C({...e,having:t==="And"?v.create(e.having,r):T.create(e.having,r)})}});var u=C({is(e){return e.kind==="InsertQueryNode"},create(e,t,r){return C({kind:"InsertQueryNode",into:e,...t&&{with:t},replace:r})},createWithoutInto(){return C({kind:"InsertQueryNode"})},cloneWith(e,t){return C({...e,...t})}});var Fe=C({is(e){return e.kind==="ListNode"},create(e){return C({kind:"ListNode",items:C(e)})}});var F=C({is(e){return e.kind==="UpdateQueryNode"},create(e,t){return C({kind:"UpdateQueryNode",table:e.length===1?e[0]:Fe.create(e),...t&&{with:t}})},createWithoutTable(){return C({kind:"UpdateQueryNode"})},cloneWithFromItems(e,t){return C({...e,from:e.from?oe.cloneWithFroms(e.from,t):oe.create(t)})},cloneWithUpdates(e,t){return C({...e,updates:e.updates?C([...e.updates,...t]):t})},cloneWithLimit(e,t){return C({...e,limit:t})}});var be=C({is(e){return e.kind==="UsingNode"},create(e){return C({kind:"UsingNode",tables:C(e)})},cloneWithTables(e,t){return C({...e,tables:C([...e.tables,...t])})}});var te=C({is(e){return e.kind==="DeleteQueryNode"},create(e,t){return C({kind:"DeleteQueryNode",from:oe.create(e),...t&&{with:t}})},cloneWithOrderByItems:(e,t)=>Oe.cloneWithOrderByItems(e,t),cloneWithoutOrderBy:(e)=>Oe.cloneWithoutOrderBy(e),cloneWithLimit(e,t){return C({...e,limit:t})},cloneWithoutLimit(e){return C({...e,limit:void 0})},cloneWithUsing(e,t){return C({...e,using:e.using!==void 0?be.cloneWithTables(e.using,t):be.create(t)})}});var O=C({is(e){return e.kind==="WhereNode"},create(e){return C({kind:"WhereNode",where:e})},cloneWithOperation(e,t,r){return C({...e,where:t==="And"?v.create(e.where,r):T.create(e.where,r)})}});var nt=C({is(e){return e.kind==="ReturningNode"},create(e){return C({kind:"ReturningNode",selections:C(e)})},cloneWithSelections(e,t){return C({...e,selections:e.selections?C([...e.selections,...t]):C(t)})}});var Pt=C({is(e){return e.kind==="ExplainNode"},create(e,t){return C({kind:"ExplainNode",format:e,options:t})}});var R=C({is(e){return e.kind==="WhenNode"},create(e){return C({kind:"WhenNode",condition:e})},cloneWithResult(e,t){return C({...e,result:t})}});var A=C({is(e){return e.kind==="MergeQueryNode"},create(e,t){return C({kind:"MergeQueryNode",into:e,...t&&{with:t}})},cloneWithUsing(e,t){return C({...e,using:t})},cloneWithWhen(e,t){return C({...e,whens:e.whens?C([...e.whens,t]):C([t])})},cloneWithThen(e,t){return C({...e,whens:e.whens?C([...e.whens.slice(0,-1),R.cloneWithResult(e.whens[e.whens.length-1],t)]):void 0})}});var at=C({is(e){return e.kind==="OutputNode"},create(e){return C({kind:"OutputNode",selections:C(e)})},cloneWithSelections(e,t){return C({...e,selections:e.selections?C([...e.selections,...t]):C(t)})}});var Oe=C({is(e){return nr.is(e)||u.is(e)||F.is(e)||te.is(e)||A.is(e)},cloneWithEndModifier(e,t){return C({...e,endModifiers:e.endModifiers?C([...e.endModifiers,t]):C([t])})},cloneWithWhere(e,t){return C({...e,where:e.where?O.cloneWithOperation(e.where,"And",t):O.create(t)})},cloneWithJoin(e,t){return C({...e,joins:e.joins?C([...e.joins,t]):C([t])})},cloneWithReturning(e,t){return C({...e,returning:e.returning?nt.cloneWithSelections(e.returning,t):nt.create(t)})},cloneWithoutReturning(e){return C({...e,returning:void 0})},cloneWithoutWhere(e){return C({...e,where:void 0})},cloneWithExplain(e,t,r){return C({...e,explain:Pt.create(t,r?.toOperationNode())})},cloneWithTop(e,t){return C({...e,top:t})},cloneWithOutput(e,t){return C({...e,output:e.output?at.cloneWithSelections(e.output,t):at.create(t)})},cloneWithOrderByItems(e,t){return C({...e,orderBy:e.orderBy?_.cloneWithItems(e.orderBy,t):_.create(t)})},cloneWithoutOrderBy(e){return C({...e,orderBy:void 0})}});var nr=C({is(e){return e.kind==="SelectQueryNode"},create(e){return C({kind:"SelectQueryNode",...e&&{with:e}})},createFrom(e,t){return C({kind:"SelectQueryNode",from:oe.create(e),...t&&{with:t}})},cloneWithSelections(e,t){return C({...e,selections:e.selections?C([...e.selections,...t]):C(t)})},cloneWithDistinctOn(e,t){return C({...e,distinctOn:e.distinctOn?C([...e.distinctOn,...t]):C(t)})},cloneWithFrontModifier(e,t){return C({...e,frontModifiers:e.frontModifiers?C([...e.frontModifiers,t]):C([t])})},cloneWithOrderByItems:(e,t)=>Oe.cloneWithOrderByItems(e,t),cloneWithGroupByItems(e,t){return C({...e,groupBy:e.groupBy?it.cloneWithItems(e.groupBy,t):it.create(t)})},cloneWithLimit(e,t){return C({...e,limit:t})},cloneWithOffset(e,t){return C({...e,offset:t})},cloneWithFetch(e,t){return C({...e,fetch:t})},cloneWithHaving(e,t){return C({...e,having:e.having?ot.cloneWithOperation(e.having,"And",t):ot.create(t)})},cloneWithSetOperations(e,t){return C({...e,setOperations:e.setOperations?C([...e.setOperations,...t]):C([...t])})},cloneWithoutSelections(e){return C({...e,selections:[]})},cloneWithoutLimit(e){return C({...e,limit:void 0})},cloneWithoutOffset(e){return C({...e,offset:void 0})},cloneWithoutOrderBy:(e)=>Oe.cloneWithoutOrderBy(e),cloneWithoutGroupBy(e){return C({...e,groupBy:void 0})}});class he{#e;constructor(e){this.#e=C(e)}on(...e){return new he({...this.#e,joinNode:L.cloneWithOn(this.#e.joinNode,yr(e))})}onRef(e,t,r){return new he({...this.#e,joinNode:L.cloneWithOn(this.#e.joinNode,N(e,t,r))})}onTrue(){return new he({...this.#e,joinNode:L.cloneWithOn(this.#e.joinNode,tr.createWithSql("true"))})}$call(e){return e(this)}toOperationNode(){return this.#e.joinNode}}var Ft=C({is(e){return e.kind==="PartitionByItemNode"},create(e){return C({kind:"PartitionByItemNode",partitionBy:e})}});function Vt(e){return Q(e).map(Ft.create)}class ue{#e;constructor(e){this.#e=C(e)}orderBy(...e){return new ue({overNode:ve.cloneWithOrderByItems(this.#e.overNode,k(e))})}clearOrderBy(){return new ue({overNode:Oe.cloneWithoutOrderBy(this.#e.overNode)})}partitionBy(e){return new ue({overNode:ve.cloneWithPartitionByItems(this.#e.overNode,Vt(e))})}$call(e){return e(this)}toOperationNode(){return this.#e.overNode}}var me=C({is(e){return e.kind==="SelectionNode"},create(e){return C({kind:"SelectionNode",selection:e})},createSelectAll(){return C({kind:"SelectionNode",selection:dc.create()})},createSelectAllFromTable(e){return C({kind:"SelectionNode",selection:Za.createSelectAll(e)})}});function c(e){if(fr(e))return c(e(B()));else if(x(e))return e.map((t)=>Ut(t));else return[Ut(e)]}function Ut(e){if(dr(e))return me.create(Dt(e));else if(Be(e))return me.create(e.toOperationNode());else return me.create(Ve(e))}function y(e){if(!e)return[me.createSelectAll()];else if(Array.isArray(e))return e.map(zt);else return[zt(e)]}function zt(e){if(dr(e))return me.createSelectAllFromTable(or(e));throw Error(`invalid value selectAll expression: ${JSON.stringify(e)}`)}var Jt=C({is(e){return e.kind==="ValuesNode"},create(e){return C({kind:"ValuesNode",values:C(e)})}});var Qt=C({is(e){return e.kind==="DefaultInsertValueNode"},create(){return C({kind:"DefaultInsertValueNode"})}});function Ue(e){let t=fr(e)?e(B()):e,r=x(t)?t:C([t]);return zr(r)}function zr(e){let t=Jr(e);return[C([...t.keys()].map(Wt.create)),Jt.create(e.map((r)=>Qr(r,t)))]}function Jr(e){let t=new Map;for(let r of e){let i=Object.keys(r);for(let n of i)if(!t.has(n)&&r[n]!==void 0)t.set(n,t.size)}return t}function Qr(e,t){let r=Object.keys(e),i=Array.from({length:t.size}),n=!1,a=r.length;for(let H of r){let Y=t.get(H);if(So(Y)){a--;continue}let we=e[H];if(So(we)||J(we))n=!0;i[Y]=we}if(a<t.size||n){let H=Qt.create();return Ba.create(i.map((Y)=>So(Y)?H:d(Y)))}return Me.create(i)}var pt=C({is(e){return e.kind==="ColumnUpdateNode"},create(e,t){return C({kind:"ColumnUpdateNode",column:e,value:t})}});function _t(...e){if(e.length===2)return[pt.create(w(e[0]),d(e[1]))];return We(e[0])}function We(e){let t=fr(e)?e(B()):e;return Object.entries(t).filter(([r,i])=>i!==void 0).map(([r,i])=>pt.create(Wt.create(r),d(i)))}var $t=C({is(e){return e.kind==="OnDuplicateKeyNode"},create(e){return C({kind:"OnDuplicateKeyNode",updates:e})}});class dt{insertId;numInsertedOrUpdatedRows;constructor(e,t){this.insertId=e,this.numInsertedOrUpdatedRows=t}}class q extends Error{node;constructor(e){super("no result");this.node=e}}function V(e){return Object.prototype.hasOwnProperty.call(e,"prototype")}var g=C({is(e){return e.kind==="OnConflictNode"},create(){return C({kind:"OnConflictNode"})},cloneWith(e,t){return C({...e,...t})},cloneWithIndexWhere(e,t){return C({...e,indexWhere:e.indexWhere?O.cloneWithOperation(e.indexWhere,"And",t):O.create(t)})},cloneWithIndexOrWhere(e,t){return C({...e,indexWhere:e.indexWhere?O.cloneWithOperation(e.indexWhere,"Or",t):O.create(t)})},cloneWithUpdateWhere(e,t){return C({...e,updateWhere:e.updateWhere?O.cloneWithOperation(e.updateWhere,"And",t):O.create(t)})},cloneWithUpdateOrWhere(e,t){return C({...e,updateWhere:e.updateWhere?O.cloneWithOperation(e.updateWhere,"Or",t):O.create(t)})},cloneWithoutIndexWhere(e){return C({...e,indexWhere:void 0})},cloneWithoutUpdateWhere(e){return C({...e,updateWhere:void 0})}});class U{#e;constructor(e){this.#e=C(e)}column(e){let t=Wt.create(e);return new U({...this.#e,onConflictNode:g.cloneWith(this.#e.onConflictNode,{columns:this.#e.onConflictNode.columns?C([...this.#e.onConflictNode.columns,t]):C([t])})})}columns(e){let t=e.map(Wt.create);return new U({...this.#e,onConflictNode:g.cloneWith(this.#e.onConflictNode,{columns:this.#e.onConflictNode.columns?C([...this.#e.onConflictNode.columns,...t]):C(t)})})}constraint(e){return new U({...this.#e,onConflictNode:g.cloneWith(this.#e.onConflictNode,{constraint:st.create(e)})})}expression(e){return new U({...this.#e,onConflictNode:g.cloneWith(this.#e.onConflictNode,{indexExpression:e.toOperationNode()})})}where(...e){return new U({...this.#e,onConflictNode:g.cloneWithIndexWhere(this.#e.onConflictNode,yr(e))})}whereRef(e,t,r){return new U({...this.#e,onConflictNode:g.cloneWithIndexWhere(this.#e.onConflictNode,N(e,t,r))})}clearWhere(){return new U({...this.#e,onConflictNode:g.cloneWithoutIndexWhere(this.#e.onConflictNode)})}doNothing(){return new Gt({...this.#e,onConflictNode:g.cloneWith(this.#e.onConflictNode,{doNothing:!0})})}doUpdateSet(e){return new Se({...this.#e,onConflictNode:g.cloneWith(this.#e.onConflictNode,{updates:We(e)})})}$call(e){return e(this)}}class Gt{#e;constructor(e){this.#e=C(e)}toOperationNode(){return this.#e.onConflictNode}}class Se{#e;constructor(e){this.#e=C(e)}where(...e){return new Se({...this.#e,onConflictNode:g.cloneWithUpdateWhere(this.#e.onConflictNode,yr(e))})}whereRef(e,t,r){return new Se({...this.#e,onConflictNode:g.cloneWithUpdateWhere(this.#e.onConflictNode,N(e,t,r))})}clearWhere(){return new Se({...this.#e,onConflictNode:g.cloneWithoutUpdateWhere(this.#e.onConflictNode)})}$call(e){return e(this)}toOperationNode(){return this.#e.onConflictNode}}var Kt=C({is(e){return e.kind==="TopNode"},create(e,t){return C({kind:"TopNode",expression:e,modifiers:t})}});function M(e,t){if(!zs(e)&&!La(e))throw Error(`Invalid top expression: ${e}`);if(!So(t)&&!_r(t))throw Error(`Invalid top modifiers: ${t}`);return Kt.create(e,t)}function _r(e){return e==="percent"||e==="with ties"||e==="percent with ties"}var ne=C({is(e){return e.kind==="OrActionNode"},create(e){return C({kind:"OrActionNode",action:e})}});class h{#e;constructor(e){this.#e=C(e)}values(e){let[t,r]=Ue(e);return new h({...this.#e,queryNode:u.cloneWith(this.#e.queryNode,{columns:t,values:r})})}columns(e){return new h({...this.#e,queryNode:u.cloneWith(this.#e.queryNode,{columns:C(e.map(Wt.create))})})}expression(e){return new h({...this.#e,queryNode:u.cloneWith(this.#e.queryNode,{values:Ho(e)})})}defaultValues(){return new h({...this.#e,queryNode:u.cloneWith(this.#e.queryNode,{defaultValues:!0})})}modifyEnd(e){return new h({...this.#e,queryNode:Oe.cloneWithEndModifier(this.#e.queryNode,e.toOperationNode())})}ignore(){return new h({...this.#e,queryNode:u.cloneWith(this.#e.queryNode,{orAction:ne.create("ignore")})})}orIgnore(){return new h({...this.#e,queryNode:u.cloneWith(this.#e.queryNode,{orAction:ne.create("ignore")})})}orAbort(){return new h({...this.#e,queryNode:u.cloneWith(this.#e.queryNode,{orAction:ne.create("abort")})})}orFail(){return new h({...this.#e,queryNode:u.cloneWith(this.#e.queryNode,{orAction:ne.create("fail")})})}orReplace(){return new h({...this.#e,queryNode:u.cloneWith(this.#e.queryNode,{orAction:ne.create("replace")})})}orRollback(){return new h({...this.#e,queryNode:u.cloneWith(this.#e.queryNode,{orAction:ne.create("rollback")})})}top(e,t){return new h({...this.#e,queryNode:Oe.cloneWithTop(this.#e.queryNode,M(e,t))})}onConflict(e){return new h({...this.#e,queryNode:u.cloneWith(this.#e.queryNode,{onConflict:e(new U({onConflictNode:g.create()})).toOperationNode()})})}onDuplicateKeyUpdate(e){return new h({...this.#e,queryNode:u.cloneWith(this.#e.queryNode,{onDuplicateKey:$t.create(We(e))})})}returning(e){return new h({...this.#e,queryNode:Oe.cloneWithReturning(this.#e.queryNode,c(e))})}returningAll(){return new h({...this.#e,queryNode:Oe.cloneWithReturning(this.#e.queryNode,y())})}output(e){return new h({...this.#e,queryNode:Oe.cloneWithOutput(this.#e.queryNode,c(e))})}outputAll(e){return new h({...this.#e,queryNode:Oe.cloneWithOutput(this.#e.queryNode,y(e))})}clearReturning(){return new h({...this.#e,queryNode:Oe.cloneWithoutReturning(this.#e.queryNode)})}$call(e){return e(this)}$if(e,t){if(e)return t(this);return new h({...this.#e})}$castTo(){return new h(this.#e)}$narrowType(){return new h(this.#e)}$assertType(){return new h(this.#e)}withPlugin(e){return new h({...this.#e,executor:this.#e.executor.withPlugin(e)})}toOperationNode(){return this.#e.executor.transformQuery(this.#e.queryNode,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){let e=this.compile(),t=await this.#e.executor.executeQuery(e),{adapter:r}=this.#e.executor,i=e.query;if(i.returning&&r.supportsReturning||i.output&&r.supportsOutput)return t.rows;return[new dt(t.insertId,t.numAffectedRows??BigInt(0))]}async executeTakeFirst(){let[e]=await this.execute();return e}async executeTakeFirstOrThrow(e=q){let t=await this.executeTakeFirst();if(t===void 0)throw V(e)?new e(this.toOperationNode()):e(this.toOperationNode());return t}async*stream(e=100){let t=this.compile(),r=this.#e.executor.stream(t,e);for await(let i of r)yield*i.rows}async explain(e,t){return await new h({...this.#e,queryNode:Oe.cloneWithExplain(this.#e.queryNode,e,t)}).execute()}}class ht{numDeletedRows;constructor(e){this.numDeletedRows=e}}var fe=C({is(e){return e.kind==="LimitNode"},create(e){return C({kind:"LimitNode",limit:e})}});var m;class ze{#e;constructor(e){this.#e=C(e)}where(...e){return new m({...this.#e,queryNode:Oe.cloneWithWhere(this.#e.queryNode,yr(e))})}whereRef(e,t,r){return new m({...this.#e,queryNode:Oe.cloneWithWhere(this.#e.queryNode,N(e,t,r))})}clearWhere(){return new m({...this.#e,queryNode:Oe.cloneWithoutWhere(this.#e.queryNode)})}top(e,t){return new m({...this.#e,queryNode:Oe.cloneWithTop(this.#e.queryNode,M(e,t))})}using(e){return new m({...this.#e,queryNode:te.cloneWithUsing(this.#e.queryNode,P(e))})}innerJoin(...e){return this.#t("InnerJoin",e)}leftJoin(...e){return this.#t("LeftJoin",e)}rightJoin(...e){return this.#t("RightJoin",e)}fullJoin(...e){return this.#t("FullJoin",e)}#t(e,t){return new m({...this.#e,queryNode:Oe.cloneWithJoin(this.#e.queryNode,re(e,t))})}returning(e){return new m({...this.#e,queryNode:Oe.cloneWithReturning(this.#e.queryNode,c(e))})}returningAll(e){return new m({...this.#e,queryNode:Oe.cloneWithReturning(this.#e.queryNode,y(e))})}output(e){return new m({...this.#e,queryNode:Oe.cloneWithOutput(this.#e.queryNode,c(e))})}outputAll(e){return new m({...this.#e,queryNode:Oe.cloneWithOutput(this.#e.queryNode,y(e))})}clearReturning(){return new m({...this.#e,queryNode:Oe.cloneWithoutReturning(this.#e.queryNode)})}clearLimit(){return new m({...this.#e,queryNode:te.cloneWithoutLimit(this.#e.queryNode)})}orderBy(...e){return new m({...this.#e,queryNode:Oe.cloneWithOrderByItems(this.#e.queryNode,k(e))})}clearOrderBy(){return new m({...this.#e,queryNode:Oe.cloneWithoutOrderBy(this.#e.queryNode)})}limit(e){return new m({...this.#e,queryNode:te.cloneWithLimit(this.#e.queryNode,fe.create(d(e)))})}modifyEnd(e){return new m({...this.#e,queryNode:Oe.cloneWithEndModifier(this.#e.queryNode,e.toOperationNode())})}$call(e){return e(this)}$if(e,t){if(e)return t(this);return new m({...this.#e})}$castTo(){return new m(this.#e)}$narrowType(){return new m(this.#e)}$assertType(){return new m(this.#e)}withPlugin(e){return new m({...this.#e,executor:this.#e.executor.withPlugin(e)})}toOperationNode(){return this.#e.executor.transformQuery(this.#e.queryNode,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){let e=this.compile(),t=await this.#e.executor.executeQuery(e),{adapter:r}=this.#e.executor,i=e.query;if(i.returning&&r.supportsReturning||i.output&&r.supportsOutput)return t.rows;return[new ht(t.numAffectedRows??BigInt(0))]}async executeTakeFirst(){let[e]=await this.execute();return e}async executeTakeFirstOrThrow(e=q){let t=await this.executeTakeFirst();if(t===void 0)throw V(e)?new e(this.toOperationNode()):e(this.toOperationNode());return t}async*stream(e=100){let t=this.compile(),r=this.#e.executor.stream(t,e);for await(let i of r)yield*i.rows}async explain(e,t){return await new m({...this.#e,queryNode:Oe.cloneWithExplain(this.#e.queryNode,e,t)}).execute()}}m=ze;class ut{numUpdatedRows;numChangedRows;constructor(e,t){this.numUpdatedRows=e,this.numChangedRows=t}}var f;class ce{#e;constructor(e){this.#e=C(e)}where(...e){return new f({...this.#e,queryNode:Oe.cloneWithWhere(this.#e.queryNode,yr(e))})}whereRef(e,t,r){return new f({...this.#e,queryNode:Oe.cloneWithWhere(this.#e.queryNode,N(e,t,r))})}clearWhere(){return new f({...this.#e,queryNode:Oe.cloneWithoutWhere(this.#e.queryNode)})}top(e,t){return new f({...this.#e,queryNode:Oe.cloneWithTop(this.#e.queryNode,M(e,t))})}from(e){return new f({...this.#e,queryNode:F.cloneWithFromItems(this.#e.queryNode,P(e))})}innerJoin(...e){return this.#t("InnerJoin",e)}leftJoin(...e){return this.#t("LeftJoin",e)}rightJoin(...e){return this.#t("RightJoin",e)}fullJoin(...e){return this.#t("FullJoin",e)}#t(e,t){return new f({...this.#e,queryNode:Oe.cloneWithJoin(this.#e.queryNode,re(e,t))})}orderBy(...e){return new f({...this.#e,queryNode:Oe.cloneWithOrderByItems(this.#e.queryNode,k(e))})}clearOrderBy(){return new f({...this.#e,queryNode:Oe.cloneWithoutOrderBy(this.#e.queryNode)})}limit(e){return new f({...this.#e,queryNode:F.cloneWithLimit(this.#e.queryNode,fe.create(d(e)))})}set(...e){return new f({...this.#e,queryNode:F.cloneWithUpdates(this.#e.queryNode,_t(...e))})}returning(e){return new f({...this.#e,queryNode:Oe.cloneWithReturning(this.#e.queryNode,c(e))})}returningAll(e){return new f({...this.#e,queryNode:Oe.cloneWithReturning(this.#e.queryNode,y(e))})}output(e){return new f({...this.#e,queryNode:Oe.cloneWithOutput(this.#e.queryNode,c(e))})}outputAll(e){return new f({...this.#e,queryNode:Oe.cloneWithOutput(this.#e.queryNode,y(e))})}modifyEnd(e){return new f({...this.#e,queryNode:Oe.cloneWithEndModifier(this.#e.queryNode,e.toOperationNode())})}clearReturning(){return new f({...this.#e,queryNode:Oe.cloneWithoutReturning(this.#e.queryNode)})}$call(e){return e(this)}$if(e,t){if(e)return t(this);return new f({...this.#e})}$castTo(){return new f(this.#e)}$narrowType(){return new f(this.#e)}$assertType(){return new f(this.#e)}withPlugin(e){return new f({...this.#e,executor:this.#e.executor.withPlugin(e)})}toOperationNode(){return this.#e.executor.transformQuery(this.#e.queryNode,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){let e=this.compile(),t=await this.#e.executor.executeQuery(e),{adapter:r}=this.#e.executor,i=e.query;if(i.returning&&r.supportsReturning||i.output&&r.supportsOutput)return t.rows;return[new ut(t.numAffectedRows??BigInt(0),t.numChangedRows)]}async executeTakeFirst(){let[e]=await this.execute();return e}async executeTakeFirstOrThrow(e=q){let t=await this.executeTakeFirst();if(t===void 0)throw V(e)?new e(this.toOperationNode()):e(this.toOperationNode());return t}async*stream(e=100){let t=this.compile(),r=this.#e.executor.stream(t,e);for await(let i of r)yield*i.rows}async explain(e,t){return await new f({...this.#e,queryNode:Oe.cloneWithExplain(this.#e.queryNode,e,t)}).execute()}}f=ce;var mt=C({is(e){return e.kind==="CommonTableExpressionNameNode"},create(e,t){return C({kind:"CommonTableExpressionNameNode",table:mo.create(e),columns:t?C(t.map(Wt.create)):void 0})}});var le=C({is(e){return e.kind==="CommonTableExpressionNode"},create(e,t){return C({kind:"CommonTableExpressionNode",name:e,expression:t})},cloneWith(e,t){return C({...e,...t})}});class Ce{#e;constructor(e){this.#e=C(e)}materialized(){return new Ce({...this.#e,node:le.cloneWith(this.#e.node,{materialized:!0})})}notMaterialized(){return new Ce({...this.#e,node:le.cloneWith(this.#e.node,{materialized:!1})})}toOperationNode(){return this.#e.node}}function ft(e,t){let r=t(Ht()).toOperationNode();if(fr(e))return e($r(r)).toOperationNode();return le.create(jt(e),r)}function $r(e){return(t)=>new Ce({node:le.create(jt(t),e)})}function jt(e){if(e.includes("(")){let t=e.split(/[\(\)]/),r=t[0],i=t[1].split(",").map((n)=>n.trim());return mt.create(r,i)}else return mt.create(e)}var ke=C({is(e){return e.kind==="WithNode"},create(e,t){return C({kind:"WithNode",expressions:C([e]),...t})},cloneWithExpression(e,t){return C({...e,expressions:C([...e.expressions,t])})}});var Yt=["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 nf(e){let t="";for(let r=0;r<e;++r)t+=Gr();return t}function Gr(){return Yt[~~(Math.random()*Yt.length)]}function It(){return new Xt}class Xt{#e;get queryId(){if(this.#e===void 0)this.#e=nf(8);return this.#e}}function o(e){return e}class Du{nodeStack=[];#e=C({AliasNode:this.transformAlias.bind(this),ColumnNode:this.transformColumn.bind(this),IdentifierNode:this.transformIdentifier.bind(this),SchemableIdentifierNode:this.transformSchemableIdentifier.bind(this),RawNode:this.transformRaw.bind(this),ReferenceNode:this.transformReference.bind(this),SelectQueryNode:this.transformSelectQuery.bind(this),SelectionNode:this.transformSelection.bind(this),TableNode:this.transformTable.bind(this),FromNode:this.transformFrom.bind(this),SelectAllNode:this.transformSelectAll.bind(this),AndNode:this.transformAnd.bind(this),OrNode:this.transformOr.bind(this),ValueNode:this.transformValue.bind(this),ValueListNode:this.transformValueList.bind(this),PrimitiveValueListNode:this.transformPrimitiveValueList.bind(this),ParensNode:this.transformParens.bind(this),JoinNode:this.transformJoin.bind(this),OperatorNode:this.transformOperator.bind(this),WhereNode:this.transformWhere.bind(this),InsertQueryNode:this.transformInsertQuery.bind(this),DeleteQueryNode:this.transformDeleteQuery.bind(this),ReturningNode:this.transformReturning.bind(this),CreateTableNode:this.transformCreateTable.bind(this),AddColumnNode:this.transformAddColumn.bind(this),ColumnDefinitionNode:this.transformColumnDefinition.bind(this),DropTableNode:this.transformDropTable.bind(this),DataTypeNode:this.transformDataType.bind(this),OrderByNode:this.transformOrderBy.bind(this),OrderByItemNode:this.transformOrderByItem.bind(this),GroupByNode:this.transformGroupBy.bind(this),GroupByItemNode:this.transformGroupByItem.bind(this),UpdateQueryNode:this.transformUpdateQuery.bind(this),ColumnUpdateNode:this.transformColumnUpdate.bind(this),LimitNode:this.transformLimit.bind(this),OffsetNode:this.transformOffset.bind(this),OnConflictNode:this.transformOnConflict.bind(this),OnDuplicateKeyNode:this.transformOnDuplicateKey.bind(this),CreateIndexNode:this.transformCreateIndex.bind(this),DropIndexNode:this.transformDropIndex.bind(this),ListNode:this.transformList.bind(this),PrimaryKeyConstraintNode:this.transformPrimaryKeyConstraint.bind(this),UniqueConstraintNode:this.transformUniqueConstraint.bind(this),ReferencesNode:this.transformReferences.bind(this),CheckConstraintNode:this.transformCheckConstraint.bind(this),WithNode:this.transformWith.bind(this),CommonTableExpressionNode:this.transformCommonTableExpression.bind(this),CommonTableExpressionNameNode:this.transformCommonTableExpressionName.bind(this),HavingNode:this.transformHaving.bind(this),CreateSchemaNode:this.transformCreateSchema.bind(this),DropSchemaNode:this.transformDropSchema.bind(this),AlterTableNode:this.transformAlterTable.bind(this),DropColumnNode:this.transformDropColumn.bind(this),RenameColumnNode:this.transformRenameColumn.bind(this),AlterColumnNode:this.transformAlterColumn.bind(this),ModifyColumnNode:this.transformModifyColumn.bind(this),AddConstraintNode:this.transformAddConstraint.bind(this),DropConstraintNode:this.transformDropConstraint.bind(this),RenameConstraintNode:this.transformRenameConstraint.bind(this),ForeignKeyConstraintNode:this.transformForeignKeyConstraint.bind(this),CreateViewNode:this.transformCreateView.bind(this),RefreshMaterializedViewNode:this.transformRefreshMaterializedView.bind(this),DropViewNode:this.transformDropView.bind(this),GeneratedNode:this.transformGenerated.bind(this),DefaultValueNode:this.transformDefaultValue.bind(this),OnNode:this.transformOn.bind(this),ValuesNode:this.transformValues.bind(this),SelectModifierNode:this.transformSelectModifier.bind(this),CreateTypeNode:this.transformCreateType.bind(this),DropTypeNode:this.transformDropType.bind(this),ExplainNode:this.transformExplain.bind(this),DefaultInsertValueNode:this.transformDefaultInsertValue.bind(this),AggregateFunctionNode:this.transformAggregateFunction.bind(this),OverNode:this.transformOver.bind(this),PartitionByNode:this.transformPartitionBy.bind(this),PartitionByItemNode:this.transformPartitionByItem.bind(this),SetOperationNode:this.transformSetOperation.bind(this),BinaryOperationNode:this.transformBinaryOperation.bind(this),UnaryOperationNode:this.transformUnaryOperation.bind(this),UsingNode:this.transformUsing.bind(this),FunctionNode:this.transformFunction.bind(this),CaseNode:this.transformCase.bind(this),WhenNode:this.transformWhen.bind(this),JSONReferenceNode:this.transformJSONReference.bind(this),JSONPathNode:this.transformJSONPath.bind(this),JSONPathLegNode:this.transformJSONPathLeg.bind(this),JSONOperatorChainNode:this.transformJSONOperatorChain.bind(this),TupleNode:this.transformTuple.bind(this),MergeQueryNode:this.transformMergeQuery.bind(this),MatchedNode:this.transformMatched.bind(this),AddIndexNode:this.transformAddIndex.bind(this),CastNode:this.transformCast.bind(this),FetchNode:this.transformFetch.bind(this),TopNode:this.transformTop.bind(this),OutputNode:this.transformOutput.bind(this),OrActionNode:this.transformOrAction.bind(this),CollateNode:this.transformCollate.bind(this)});transformNode(e,t){if(!e)return e;this.nodeStack.push(e);let r=this.transformNodeImpl(e,t);return this.nodeStack.pop(),C(r)}transformNodeImpl(e,t){return this.#e[e.kind](e,t)}transformNodeList(e,t){if(!e)return e;return C(e.map((r)=>this.transformNode(r,t)))}transformSelectQuery(e,t){return o({kind:"SelectQueryNode",from:this.transformNode(e.from,t),selections:this.transformNodeList(e.selections,t),distinctOn:this.transformNodeList(e.distinctOn,t),joins:this.transformNodeList(e.joins,t),groupBy:this.transformNode(e.groupBy,t),orderBy:this.transformNode(e.orderBy,t),where:this.transformNode(e.where,t),frontModifiers:this.transformNodeList(e.frontModifiers,t),endModifiers:this.transformNodeList(e.endModifiers,t),limit:this.transformNode(e.limit,t),offset:this.transformNode(e.offset,t),with:this.transformNode(e.with,t),having:this.transformNode(e.having,t),explain:this.transformNode(e.explain,t),setOperations:this.transformNodeList(e.setOperations,t),fetch:this.transformNode(e.fetch,t),top:this.transformNode(e.top,t)})}transformSelection(e,t){return o({kind:"SelectionNode",selection:this.transformNode(e.selection,t)})}transformColumn(e,t){return o({kind:"ColumnNode",column:this.transformNode(e.column,t)})}transformAlias(e,t){return o({kind:"AliasNode",node:this.transformNode(e.node,t),alias:this.transformNode(e.alias,t)})}transformTable(e,t){return o({kind:"TableNode",table:this.transformNode(e.table,t)})}transformFrom(e,t){return o({kind:"FromNode",froms:this.transformNodeList(e.froms,t)})}transformReference(e,t){return o({kind:"ReferenceNode",column:this.transformNode(e.column,t),table:this.transformNode(e.table,t)})}transformAnd(e,t){return o({kind:"AndNode",left:this.transformNode(e.left,t),right:this.transformNode(e.right,t)})}transformOr(e,t){return o({kind:"OrNode",left:this.transformNode(e.left,t),right:this.transformNode(e.right,t)})}transformValueList(e,t){return o({kind:"ValueListNode",values:this.transformNodeList(e.values,t)})}transformParens(e,t){return o({kind:"ParensNode",node:this.transformNode(e.node,t)})}transformJoin(e,t){return o({kind:"JoinNode",joinType:e.joinType,table:this.transformNode(e.table,t),on:this.transformNode(e.on,t)})}transformRaw(e,t){return o({kind:"RawNode",sqlFragments:C([...e.sqlFragments]),parameters:this.transformNodeList(e.parameters,t)})}transformWhere(e,t){return o({kind:"WhereNode",where:this.transformNode(e.where,t)})}transformInsertQuery(e,t){return o({kind:"InsertQueryNode",into:this.transformNode(e.into,t),columns:this.transformNodeList(e.columns,t),values:this.transformNode(e.values,t),returning:this.transformNode(e.returning,t),onConflict:this.transformNode(e.onConflict,t),onDuplicateKey:this.transformNode(e.onDuplicateKey,t),endModifiers:this.transformNodeList(e.endModifiers,t),with:this.transformNode(e.with,t),ignore:e.ignore,orAction:this.transformNode(e.orAction,t),replace:e.replace,explain:this.transformNode(e.explain,t),defaultValues:e.defaultValues,top:this.transformNode(e.top,t),output:this.transformNode(e.output,t)})}transformValues(e,t){return o({kind:"ValuesNode",values:this.transformNodeList(e.values,t)})}transformDeleteQuery(e,t){return o({kind:"DeleteQueryNode",from:this.transformNode(e.from,t),using:this.transformNode(e.using,t),joins:this.transformNodeList(e.joins,t),where:this.transformNode(e.where,t),returning:this.transformNode(e.returning,t),endModifiers:this.transformNodeList(e.endModifiers,t),with:this.transformNode(e.with,t),orderBy:this.transformNode(e.orderBy,t),limit:this.transformNode(e.limit,t),explain:this.transformNode(e.explain,t),top:this.transformNode(e.top,t),output:this.transformNode(e.output,t)})}transformReturning(e,t){return o({kind:"ReturningNode",selections:this.transformNodeList(e.selections,t)})}transformCreateTable(e,t){return o({kind:"CreateTableNode",table:this.transformNode(e.table,t),columns:this.transformNodeList(e.columns,t),constraints:this.transformNodeList(e.constraints,t),temporary:e.temporary,ifNotExists:e.ifNotExists,onCommit:e.onCommit,frontModifiers:this.transformNodeList(e.frontModifiers,t),endModifiers:this.transformNodeList(e.endModifiers,t),selectQuery:this.transformNode(e.selectQuery,t)})}transformColumnDefinition(e,t){return o({kind:"ColumnDefinitionNode",column:this.transformNode(e.column,t),dataType:this.transformNode(e.dataType,t),references:this.transformNode(e.references,t),primaryKey:e.primaryKey,autoIncrement:e.autoIncrement,unique:e.unique,notNull:e.notNull,unsigned:e.unsigned,defaultTo:this.transformNode(e.defaultTo,t),check:this.transformNode(e.check,t),generated:this.transformNode(e.generated,t),frontModifiers:this.transformNodeList(e.frontModifiers,t),endModifiers:this.transformNodeList(e.endModifiers,t),nullsNotDistinct:e.nullsNotDistinct,identity:e.identity,ifNotExists:e.ifNotExists})}transformAddColumn(e,t){return o({kind:"AddColumnNode",column:this.transformNode(e.column,t)})}transformDropTable(e,t){return o({kind:"DropTableNode",table:this.transformNode(e.table,t),ifExists:e.ifExists,cascade:e.cascade})}transformOrderBy(e,t){return o({kind:"OrderByNode",items:this.transformNodeList(e.items,t)})}transformOrderByItem(e,t){return o({kind:"OrderByItemNode",orderBy:this.transformNode(e.orderBy,t),direction:this.transformNode(e.direction,t),collation:this.transformNode(e.collation,t),nulls:e.nulls})}transformGroupBy(e,t){return o({kind:"GroupByNode",items:this.transformNodeList(e.items,t)})}transformGroupByItem(e,t){return o({kind:"GroupByItemNode",groupBy:this.transformNode(e.groupBy,t)})}transformUpdateQuery(e,t){return o({kind:"UpdateQueryNode",table:this.transformNode(e.table,t),from:this.transformNode(e.from,t),joins:this.transformNodeList(e.joins,t),where:this.transformNode(e.where,t),updates:this.transformNodeList(e.updates,t),returning:this.transformNode(e.returning,t),endModifiers:this.transformNodeList(e.endModifiers,t),with:this.transformNode(e.with,t),explain:this.transformNode(e.explain,t),limit:this.transformNode(e.limit,t),top:this.transformNode(e.top,t),output:this.transformNode(e.output,t),orderBy:this.transformNode(e.orderBy,t)})}transformColumnUpdate(e,t){return o({kind:"ColumnUpdateNode",column:this.transformNode(e.column,t),value:this.transformNode(e.value,t)})}transformLimit(e,t){return o({kind:"LimitNode",limit:this.transformNode(e.limit,t)})}transformOffset(e,t){return o({kind:"OffsetNode",offset:this.transformNode(e.offset,t)})}transformOnConflict(e,t){return o({kind:"OnConflictNode",columns:this.transformNodeList(e.columns,t),constraint:this.transformNode(e.constraint,t),indexExpression:this.transformNode(e.indexExpression,t),indexWhere:this.transformNode(e.indexWhere,t),updates:this.transformNodeList(e.updates,t),updateWhere:this.transformNode(e.updateWhere,t),doNothing:e.doNothing})}transformOnDuplicateKey(e,t){return o({kind:"OnDuplicateKeyNode",updates:this.transformNodeList(e.updates,t)})}transformCreateIndex(e,t){return o({kind:"CreateIndexNode",name:this.transformNode(e.name,t),table:this.transformNode(e.table,t),columns:this.transformNodeList(e.columns,t),unique:e.unique,using:this.transformNode(e.using,t),ifNotExists:e.ifNotExists,where:this.transformNode(e.where,t),nullsNotDistinct:e.nullsNotDistinct})}transformList(e,t){return o({kind:"ListNode",items:this.transformNodeList(e.items,t)})}transformDropIndex(e,t){return o({kind:"DropIndexNode",name:this.transformNode(e.name,t),table:this.transformNode(e.table,t),ifExists:e.ifExists,cascade:e.cascade})}transformPrimaryKeyConstraint(e,t){return o({kind:"PrimaryKeyConstraintNode",columns:this.transformNodeList(e.columns,t),name:this.transformNode(e.name,t),deferrable:e.deferrable,initiallyDeferred:e.initiallyDeferred})}transformUniqueConstraint(e,t){return o({kind:"UniqueConstraintNode",columns:this.transformNodeList(e.columns,t),name:this.transformNode(e.name,t),nullsNotDistinct:e.nullsNotDistinct,deferrable:e.deferrable,initiallyDeferred:e.initiallyDeferred})}transformForeignKeyConstraint(e,t){return o({kind:"ForeignKeyConstraintNode",columns:this.transformNodeList(e.columns,t),references:this.transformNode(e.references,t),name:this.transformNode(e.name,t),onDelete:e.onDelete,onUpdate:e.onUpdate,deferrable:e.deferrable,initiallyDeferred:e.initiallyDeferred})}transformSetOperation(e,t){return o({kind:"SetOperationNode",operator:e.operator,expression:this.transformNode(e.expression,t),all:e.all})}transformReferences(e,t){return o({kind:"ReferencesNode",table:this.transformNode(e.table,t),columns:this.transformNodeList(e.columns,t),onDelete:e.onDelete,onUpdate:e.onUpdate})}transformCheckConstraint(e,t){return o({kind:"CheckConstraintNode",expression:this.transformNode(e.expression,t),name:this.transformNode(e.name,t)})}transformWith(e,t){return o({kind:"WithNode",expressions:this.transformNodeList(e.expressions,t),recursive:e.recursive})}transformCommonTableExpression(e,t){return o({kind:"CommonTableExpressionNode",name:this.transformNode(e.name,t),materialized:e.materialized,expression:this.transformNode(e.expression,t)})}transformCommonTableExpressionName(e,t){return o({kind:"CommonTableExpressionNameNode",table:this.transformNode(e.table,t),columns:this.transformNodeList(e.columns,t)})}transformHaving(e,t){return o({kind:"HavingNode",having:this.transformNode(e.having,t)})}transformCreateSchema(e,t){return o({kind:"CreateSchemaNode",schema:this.transformNode(e.schema,t),ifNotExists:e.ifNotExists})}transformDropSchema(e,t){return o({kind:"DropSchemaNode",schema:this.transformNode(e.schema,t),ifExists:e.ifExists,cascade:e.cascade})}transformAlterTable(e,t){return o({kind:"AlterTableNode",table:this.transformNode(e.table,t),renameTo:this.transformNode(e.renameTo,t),setSchema:this.transformNode(e.setSchema,t),columnAlterations:this.transformNodeList(e.columnAlterations,t),addConstraint:this.transformNode(e.addConstraint,t),dropConstraint:this.transformNode(e.dropConstraint,t),renameConstraint:this.transformNode(e.renameConstraint,t),addIndex:this.transformNode(e.addIndex,t),dropIndex:this.transformNode(e.dropIndex,t)})}transformDropColumn(e,t){return o({kind:"DropColumnNode",column:this.transformNode(e.column,t)})}transformRenameColumn(e,t){return o({kind:"RenameColumnNode",column:this.transformNode(e.column,t),renameTo:this.transformNode(e.renameTo,t)})}transformAlterColumn(e,t){return o({kind:"AlterColumnNode",column:this.transformNode(e.column,t),dataType:this.transformNode(e.dataType,t),dataTypeExpression:this.transformNode(e.dataTypeExpression,t),setDefault:this.transformNode(e.setDefault,t),dropDefault:e.dropDefault,setNotNull:e.setNotNull,dropNotNull:e.dropNotNull})}transformModifyColumn(e,t){return o({kind:"ModifyColumnNode",column:this.transformNode(e.column,t)})}transformAddConstraint(e,t){return o({kind:"AddConstraintNode",constraint:this.transformNode(e.constraint,t)})}transformDropConstraint(e,t){return o({kind:"DropConstraintNode",constraintName:this.transformNode(e.constraintName,t),ifExists:e.ifExists,modifier:e.modifier})}transformRenameConstraint(e,t){return o({kind:"RenameConstraintNode",oldName:this.transformNode(e.oldName,t),newName:this.transformNode(e.newName,t)})}transformCreateView(e,t){return o({kind:"CreateViewNode",name:this.transformNode(e.name,t),temporary:e.temporary,orReplace:e.orReplace,ifNotExists:e.ifNotExists,materialized:e.materialized,columns:this.transformNodeList(e.columns,t),as:this.transformNode(e.as,t)})}transformRefreshMaterializedView(e,t){return o({kind:"RefreshMaterializedViewNode",name:this.transformNode(e.name,t),concurrently:e.concurrently,withNoData:e.withNoData})}transformDropView(e,t){return o({kind:"DropViewNode",name:this.transformNode(e.name,t),ifExists:e.ifExists,materialized:e.materialized,cascade:e.cascade})}transformGenerated(e,t){return o({kind:"GeneratedNode",byDefault:e.byDefault,always:e.always,identity:e.identity,stored:e.stored,expression:this.transformNode(e.expression,t)})}transformDefaultValue(e,t){return o({kind:"DefaultValueNode",defaultValue:this.transformNode(e.defaultValue,t)})}transformOn(e,t){return o({kind:"OnNode",on:this.transformNode(e.on,t)})}transformSelectModifier(e,t){return o({kind:"SelectModifierNode",modifier:e.modifier,rawModifier:this.transformNode(e.rawModifier,t),of:this.transformNodeList(e.of,t)})}transformCreateType(e,t){return o({kind:"CreateTypeNode",name:this.transformNode(e.name,t),enum:this.transformNode(e.enum,t)})}transformDropType(e,t){return o({kind:"DropTypeNode",name:this.transformNode(e.name,t),ifExists:e.ifExists})}transformExplain(e,t){return o({kind:"ExplainNode",format:e.format,options:this.transformNode(e.options,t)})}transformSchemableIdentifier(e,t){return o({kind:"SchemableIdentifierNode",schema:this.transformNode(e.schema,t),identifier:this.transformNode(e.identifier,t)})}transformAggregateFunction(e,t){return o({kind:"AggregateFunctionNode",func:e.func,aggregated:this.transformNodeList(e.aggregated,t),distinct:e.distinct,orderBy:this.transformNode(e.orderBy,t),withinGroup:this.transformNode(e.withinGroup,t),filter:this.transformNode(e.filter,t),over:this.transformNode(e.over,t)})}transformOver(e,t){return o({kind:"OverNode",orderBy:this.transformNode(e.orderBy,t),partitionBy:this.transformNode(e.partitionBy,t)})}transformPartitionBy(e,t){return o({kind:"PartitionByNode",items:this.transformNodeList(e.items,t)})}transformPartitionByItem(e,t){return o({kind:"PartitionByItemNode",partitionBy:this.transformNode(e.partitionBy,t)})}transformBinaryOperation(e,t){return o({kind:"BinaryOperationNode",leftOperand:this.transformNode(e.leftOperand,t),operator:this.transformNode(e.operator,t),rightOperand:this.transformNode(e.rightOperand,t)})}transformUnaryOperation(e,t){return o({kind:"UnaryOperationNode",operator:this.transformNode(e.operator,t),operand:this.transformNode(e.operand,t)})}transformUsing(e,t){return o({kind:"UsingNode",tables:this.transformNodeList(e.tables,t)})}transformFunction(e,t){return o({kind:"FunctionNode",func:e.func,arguments:this.transformNodeList(e.arguments,t)})}transformCase(e,t){return o({kind:"CaseNode",value:this.transformNode(e.value,t),when:this.transformNodeList(e.when,t),else:this.transformNode(e.else,t),isStatement:e.isStatement})}transformWhen(e,t){return o({kind:"WhenNode",condition:this.transformNode(e.condition,t),result:this.transformNode(e.result,t)})}transformJSONReference(e,t){return o({kind:"JSONReferenceNode",reference:this.transformNode(e.reference,t),traversal:this.transformNode(e.traversal,t)})}transformJSONPath(e,t){return o({kind:"JSONPathNode",inOperator:this.transformNode(e.inOperator,t),pathLegs:this.transformNodeList(e.pathLegs,t)})}transformJSONPathLeg(e,t){return o({kind:"JSONPathLegNode",type:e.type,value:e.value})}transformJSONOperatorChain(e,t){return o({kind:"JSONOperatorChainNode",operator:this.transformNode(e.operator,t),values:this.transformNodeList(e.values,t)})}transformTuple(e,t){return o({kind:"TupleNode",values:this.transformNodeList(e.values,t)})}transformMergeQuery(e,t){return o({kind:"MergeQueryNode",into:this.transformNode(e.into,t),using:this.transformNode(e.using,t),whens:this.transformNodeList(e.whens,t),with:this.transformNode(e.with,t),top:this.transformNode(e.top,t),endModifiers:this.transformNodeList(e.endModifiers,t),output:this.transformNode(e.output,t),returning:this.transformNode(e.returning,t)})}transformMatched(e,t){return o({kind:"MatchedNode",not:e.not,bySource:e.bySource})}transformAddIndex(e,t){return o({kind:"AddIndexNode",name:this.transformNode(e.name,t),columns:this.transformNodeList(e.columns,t),unique:e.unique,using:this.transformNode(e.using,t),ifNotExists:e.ifNotExists})}transformCast(e,t){return o({kind:"CastNode",expression:this.transformNode(e.expression,t),dataType:this.transformNode(e.dataType,t)})}transformFetch(e,t){return o({kind:"FetchNode",rowCount:this.transformNode(e.rowCount,t),modifier:e.modifier})}transformTop(e,t){return o({kind:"TopNode",expression:e.expression,modifiers:e.modifiers})}transformOutput(e,t){return o({kind:"OutputNode",selections:this.transformNodeList(e.selections,t)})}transformDataType(e,t){return e}transformSelectAll(e,t){return e}transformIdentifier(e,t){return e}transformValue(e,t){return e}transformPrimitiveValueList(e,t){return e}transformOperator(e,t){return e}transformDefaultInsertValue(e,t){return e}transformOrAction(e,t){return e}transformCollate(e,t){return e}}var Kr=C({AlterTableNode:!0,CreateIndexNode:!0,CreateSchemaNode:!0,CreateTableNode:!0,CreateTypeNode:!0,CreateViewNode:!0,RefreshMaterializedViewNode:!0,DeleteQueryNode:!0,DropIndexNode:!0,DropSchemaNode:!0,DropTableNode:!0,DropTypeNode:!0,DropViewNode:!0,InsertQueryNode:!0,RawNode:!0,SelectQueryNode:!0,UpdateQueryNode:!0,MergeQueryNode:!0}),jr={json_agg:!0,to_json:!0};class ct extends Du{#e;#t=new Set;#r=new Set;constructor(e){super();this.#e=e}transformNodeImpl(e,t){if(!this.#s(e))return super.transformNodeImpl(e,t);let r=this.#p(e);for(let a of r)this.#r.add(a);let i=this.#a(e);for(let a of i)this.#t.add(a);let n=super.transformNodeImpl(e,t);for(let a of i)this.#t.delete(a);for(let a of r)this.#r.delete(a);return n}transformSchemableIdentifier(e,t){let r=super.transformSchemableIdentifier(e,t);if(r.schema||!this.#t.has(e.identifier.name))return r;return{...r,schema:st.create(this.#e)}}transformReferences(e,t){let r=super.transformReferences(e,t);if(r.table.table.schema)return r;return{...r,table:mo.createWithSchema(this.#e,r.table.table.identifier.name)}}transformAggregateFunction(e,t){return{...super.transformAggregateFunction({...e,aggregated:[]},t),aggregated:this.#o(e,t,"aggregated")}}transformFunction(e,t){return{...super.transformFunction({...e,arguments:[]},t),arguments:this.#o(e,t,"arguments")}}transformSelectModifier(e,t){return{...super.transformSelectModifier({...e,of:void 0},t),of:e.of?.map((r)=>mo.is(r)&&!r.table.schema?{...r,table:this.transformIdentifier(r.table.identifier,t)}:this.transformNode(r,t))}}#o(e,t,r){return jr[e.func]?e[r].map((i)=>!mo.is(i)||i.table.schema?this.transformNode(i,t):{...i,table:this.transformIdentifier(i.table.identifier,t)}):this.transformNodeList(e[r],t)}#s(e){return e.kind in Kr}#a(e){let t=new Set;if("name"in e&&e.name&&po.is(e.name))this.#n(e.name,t);if("from"in e&&e.from)for(let r of e.from.froms)this.#i(r,t);if("into"in e&&e.into)this.#i(e.into,t);if("table"in e&&e.table)this.#i(e.table,t);if("joins"in e&&e.joins)for(let r of e.joins)this.#i(r.table,t);if("using"in e&&e.using)if(L.is(e.using))this.#i(e.using.table,t);else this.#i(e.using,t);return t}#p(e){let t=new Set;if("with"in e&&e.with)this.#d(e.with,t);return t}#i(e,t){if(mo.is(e))return this.#n(e.table,t);if(l.is(e)&&mo.is(e.node))return this.#n(e.node.table,t);if(Fe.is(e)){for(let r of e.items)this.#i(r,t);return}if(be.is(e)){for(let r of e.tables)this.#i(r,t);return}}#n(e,t){let r=e.identifier.name;if(!this.#t.has(r)&&!this.#r.has(r))t.add(r)}#d(e,t){for(let r of e.expressions){let i=r.name.table.table.identifier.name;if(!this.#r.has(i))t.add(i)}}}class js{#e;constructor(e){this.#e=new ct(e)}transformQuery(e){return this.#e.transformNode(e.node,e.queryId)}async transformResult(e){return e.result}}var Zt=C({is(e){return e.kind==="MatchedNode"},create(e,t=!1){return C({kind:"MatchedNode",not:e,bySource:t})}});function lt(e,t,r){return R.create(de([Zt.create(!e.isMatched,e.bySource),...t&&t.length>0?[t.length===3&&r?N(t[0],t[1],t[2]):yr(t)]:[]],"and",!1))}function Ne(e){if(dr(e))return tr.create([e],[]);if(Rr(e))return e.toOperationNode();return e}class Ua{#e;#t;#r;constructor(){this.#e=new Promise((e,t)=>{this.#r=t,this.#t=e})}get promise(){return this.#e}resolve=(e)=>{if(this.#t)this.#t(e)};reject=(e)=>{if(this.#r)this.#r(e)}}async function of(e){let t=new Ua,r=new Ua;return e.provideConnection(async(i)=>(t.resolve(i),await r.promise)).catch((i)=>t.reject(i)),C({connection:await t.promise,release:r.resolve})}var Hr=C([]);class Nu{#e;constructor(e=Hr){this.#e=e}get plugins(){return this.#e}transformQuery(e,t){for(let r of this.#e){let i=r.transformQuery({node:e,queryId:t});if(i.kind===e.kind)e=i;else throw Error(["KyselyPlugin.transformQuery must return a node","of the same kind that was given to it.",`The plugin was given a ${e.kind}`,`but it returned a ${i.kind}`].join(" "))}return e}async executeQuery(e){return await this.provideConnection(async(t)=>{let r=await t.executeQuery(e);if("numUpdatedOrDeletedRows"in r)hi("kysely:warning: outdated driver/plugin detected! `QueryResult.numUpdatedOrDeletedRows` has been replaced with `QueryResult.numAffectedRows`.");return await this.#t(r,e.queryId)})}async*stream(e,t){let{connection:r,release:i}=await of(this);try{for await(let n of r.streamQuery(e,t))yield await this.#t(n,e.queryId)}finally{i()}}async#t(e,t){for(let r of this.#e)e=await r.transformResult({result:e,queryId:t});return e}}class ye extends Nu{get adapter(){throw Error("this query cannot be compiled to SQL")}compileQuery(){throw Error("this query cannot be compiled to SQL")}provideConnection(){throw Error("this query cannot be executed")}withConnectionProvider(){throw Error("this query cannot have a connection provider")}withPlugin(e){return new ye([...this.plugins,e])}withPlugins(e){return new ye([...this.plugins,...e])}withPluginAtFront(e){return new ye([e,...this.plugins])}withoutPlugins(){return new ye([])}}var ie=new ye;class Nt{numChangedRows;constructor(e){this.numChangedRows=e}}class G{#e;constructor(e){this.#e=C(e)}modifyEnd(e){return new G({...this.#e,queryNode:Oe.cloneWithEndModifier(this.#e.queryNode,e.toOperationNode())})}top(e,t){return new G({...this.#e,queryNode:Oe.cloneWithTop(this.#e.queryNode,M(e,t))})}using(...e){return new b({...this.#e,queryNode:A.cloneWithUsing(this.#e.queryNode,re("Using",e))})}returning(e){return new G({...this.#e,queryNode:Oe.cloneWithReturning(this.#e.queryNode,c(e))})}returningAll(e){return new G({...this.#e,queryNode:Oe.cloneWithReturning(this.#e.queryNode,y(e))})}output(e){return new G({...this.#e,queryNode:Oe.cloneWithOutput(this.#e.queryNode,c(e))})}outputAll(e){return new G({...this.#e,queryNode:Oe.cloneWithOutput(this.#e.queryNode,y(e))})}}class b{#e;constructor(e){this.#e=C(e)}modifyEnd(e){return new b({...this.#e,queryNode:Oe.cloneWithEndModifier(this.#e.queryNode,e.toOperationNode())})}top(e,t){return new b({...this.#e,queryNode:Oe.cloneWithTop(this.#e.queryNode,M(e,t))})}whenMatched(){return this.#t([])}whenMatchedAnd(...e){return this.#t(e)}whenMatchedAndRef(e,t,r){return this.#t([e,t,r],!0)}#t(e,t){return new yt({...this.#e,queryNode:A.cloneWithWhen(this.#e.queryNode,lt({isMatched:!0},e,t))})}whenNotMatched(){return this.#r([])}whenNotMatchedAnd(...e){return this.#r(e)}whenNotMatchedAndRef(e,t,r){return this.#r([e,t,r],!0)}whenNotMatchedBySource(){return this.#r([],!1,!0)}whenNotMatchedBySourceAnd(...e){return this.#r(e,!1,!0)}whenNotMatchedBySourceAndRef(e,t,r){return this.#r([e,t,r],!0,!0)}returning(e){return new b({...this.#e,queryNode:Oe.cloneWithReturning(this.#e.queryNode,c(e))})}returningAll(e){return new b({...this.#e,queryNode:Oe.cloneWithReturning(this.#e.queryNode,y(e))})}output(e){return new b({...this.#e,queryNode:Oe.cloneWithOutput(this.#e.queryNode,c(e))})}outputAll(e){return new b({...this.#e,queryNode:Oe.cloneWithOutput(this.#e.queryNode,y(e))})}#r(e,t=!1,r=!1){let i={...this.#e,queryNode:A.cloneWithWhen(this.#e.queryNode,lt({isMatched:!1,bySource:r},e,t))};return new(r?yt:er)(i)}$call(e){return e(this)}$if(e,t){if(e)return t(this);return new b({...this.#e})}toOperationNode(){return this.#e.executor.transformQuery(this.#e.queryNode,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){let e=this.compile(),t=await this.#e.executor.executeQuery(e),{adapter:r}=this.#e.executor,i=e.query;if(i.returning&&r.supportsReturning||i.output&&r.supportsOutput)return t.rows;return[new Nt(t.numAffectedRows)]}async executeTakeFirst(){let[e]=await this.execute();return e}async executeTakeFirstOrThrow(e=q){let t=await this.executeTakeFirst();if(t===void 0)throw V(e)?new e(this.toOperationNode()):e(this.toOperationNode());return t}}class yt{#e;constructor(e){this.#e=C(e)}thenDelete(){return new b({...this.#e,queryNode:A.cloneWithThen(this.#e.queryNode,Ne("delete"))})}thenDoNothing(){return new b({...this.#e,queryNode:A.cloneWithThen(this.#e.queryNode,Ne("do nothing"))})}thenUpdate(e){return new b({...this.#e,queryNode:A.cloneWithThen(this.#e.queryNode,Ne(e(new ce({queryId:this.#e.queryId,executor:ie,queryNode:F.createWithoutTable()}))))})}thenUpdateSet(...e){return this.thenUpdate((t)=>t.set(...e))}}class er{#e;constructor(e){this.#e=C(e)}thenDoNothing(){return new b({...this.#e,queryNode:A.cloneWithThen(this.#e.queryNode,Ne("do nothing"))})}thenInsertValues(e){let[t,r]=Ue(e);return new b({...this.#e,queryNode:A.cloneWithThen(this.#e.queryNode,Ne(u.cloneWith(u.createWithoutInto(),{columns:t,values:r})))})}}class gi{#e;constructor(e){this.#e=C(e)}selectFrom(e){return Ee({queryId:It(),executor:this.#e.executor,queryNode:nr.createFrom(P(e),this.#e.withNode)})}selectNoFrom(e){return Ee({queryId:It(),executor:this.#e.executor,queryNode:nr.cloneWithSelections(nr.create(this.#e.withNode),c(e))})}insertInto(e){return new h({queryId:It(),executor:this.#e.executor,queryNode:u.create(or(e),this.#e.withNode)})}replaceInto(e){return new h({queryId:It(),executor:this.#e.executor,queryNode:u.create(or(e),this.#e.withNode,!0)})}deleteFrom(e){return new ze({queryId:It(),executor:this.#e.executor,queryNode:te.create(P(e),this.#e.withNode)})}updateTable(e){return new ce({queryId:It(),executor:this.#e.executor,queryNode:F.create(P(e),this.#e.withNode)})}mergeInto(e){return new G({queryId:It(),executor:this.#e.executor,queryNode:A.create(wt(e),this.#e.withNode)})}with(e,t){let r=ft(e,t);return new gi({...this.#e,withNode:this.#e.withNode?ke.cloneWithExpression(this.#e.withNode,r):ke.create(r)})}withRecursive(e,t){let r=ft(e,t);return new gi({...this.#e,withNode:this.#e.withNode?ke.cloneWithExpression(this.#e.withNode,r):ke.create(r,{recursive:!0})})}withPlugin(e){return new gi({...this.#e,executor:this.#e.executor.withPlugin(e)})}withoutPlugins(){return new gi({...this.#e,executor:this.#e.executor.withoutPlugins()})}withSchema(e){return new gi({...this.#e,executor:this.#e.executor.withPluginAtFront(new js(e))})}}function Ht(){return new gi({executor:ie})}function rr(e,t){return new he({joinNode:L.create(e,se(t))})}function ir(){return new ue({overNode:ve.create()})}function re(e,t){if(t.length===3)return Xr(e,t[0],t[1],t[2]);else if(t.length===2)return Yr(e,t[0],t[1]);else if(t.length===1)return Zr(e,t[0]);else throw Error("not implemented")}function Yr(e,t,r){return r(rr(e,t)).toOperationNode()}function Xr(e,t,r,i){return L.createWithOn(e,se(t),N(r,"=",i))}function Zr(e,t){return L.create(e,se(t))}var sr=C({is(e){return e.kind==="OffsetNode"},create(e){return C({kind:"OffsetNode",offset:e})}});var ar=C({is(e){return e.kind==="GroupByItemNode"},create(e){return C({kind:"GroupByItemNode",groupBy:e})}});function pr(e){return e=fr(e)?e(B()):e,Q(e).map(ar.create)}var Je=C({is(e){return e.kind==="SetOperationNode"},create(e,t,r){return C({kind:"SetOperationNode",operator:e,expression:t,all:r})}});function ae(e,t,r){if(fr(t))t=t(Qe());if(!x(t))t=[t];return t.map((i)=>Je.create(e,Ho(i),r))}class p{#e;constructor(e){this.#e=e}get expressionType(){return}as(e){return new Ge(this,e)}or(...e){return new _e(T.create(this.#e,yr(e)))}and(...e){return new $e(v.create(this.#e,yr(e)))}$castTo(){return new p(this.#e)}$notNull(){return new p(this.#e)}toOperationNode(){return this.#e}}class Ge{#e;#t;constructor(e,t){this.#e=e,this.#t=t}get expression(){return this.#e}get alias(){return this.#t}toOperationNode(){return l.create(this.#e.toOperationNode(),Rr(this.#t)?this.#t.toOperationNode():st.create(this.#t))}}class _e{#e;constructor(e){this.#e=e}get expressionType(){return}as(e){return new Ge(this,e)}or(...e){return new _e(T.create(this.#e,yr(e)))}$castTo(){return new _e(this.#e)}toOperationNode(){return E.create(this.#e)}}class $e{#e;constructor(e){this.#e=e}get expressionType(){return}as(e){return new Ge(this,e)}and(...e){return new $e(v.create(this.#e,yr(e)))}$castTo(){return new $e(this.#e)}toOperationNode(){return E.create(this.#e)}}var hr=C({is(e){return e.kind==="FetchNode"},create(e,t){return{kind:"FetchNode",rowCount:_n.create(e),modifier:t}}});function ur(e,t){if(!zs(e)&&!La(e))throw Error(`Invalid fetch row count: ${e}`);if(!ei(t))throw Error(`Invalid fetch modifier: ${t}`);return hr.create(e,t)}function ei(e){return e==="only"||e==="with ties"}var s;class Ot{#e;constructor(e){this.#e=C(e)}get expressionType(){return}get isSelectQueryBuilder(){return!0}where(...e){return new s({...this.#e,queryNode:Oe.cloneWithWhere(this.#e.queryNode,yr(e))})}whereRef(e,t,r){return new s({...this.#e,queryNode:Oe.cloneWithWhere(this.#e.queryNode,N(e,t,r))})}having(...e){return new s({...this.#e,queryNode:nr.cloneWithHaving(this.#e.queryNode,yr(e))})}havingRef(e,t,r){return new s({...this.#e,queryNode:nr.cloneWithHaving(this.#e.queryNode,N(e,t,r))})}select(e){return new s({...this.#e,queryNode:nr.cloneWithSelections(this.#e.queryNode,c(e))})}distinctOn(e){return new s({...this.#e,queryNode:nr.cloneWithDistinctOn(this.#e.queryNode,Q(e))})}modifyFront(e){return new s({...this.#e,queryNode:nr.cloneWithFrontModifier(this.#e.queryNode,I.createWithExpression(e.toOperationNode()))})}modifyEnd(e){return new s({...this.#e,queryNode:Oe.cloneWithEndModifier(this.#e.queryNode,I.createWithExpression(e.toOperationNode()))})}distinct(){return new s({...this.#e,queryNode:nr.cloneWithFrontModifier(this.#e.queryNode,I.create("Distinct"))})}forUpdate(e){return new s({...this.#e,queryNode:Oe.cloneWithEndModifier(this.#e.queryNode,I.create("ForUpdate",e?xe(e).map(or):void 0))})}forShare(e){return new s({...this.#e,queryNode:Oe.cloneWithEndModifier(this.#e.queryNode,I.create("ForShare",e?xe(e).map(or):void 0))})}forKeyShare(e){return new s({...this.#e,queryNode:Oe.cloneWithEndModifier(this.#e.queryNode,I.create("ForKeyShare",e?xe(e).map(or):void 0))})}forNoKeyUpdate(e){return new s({...this.#e,queryNode:Oe.cloneWithEndModifier(this.#e.queryNode,I.create("ForNoKeyUpdate",e?xe(e).map(or):void 0))})}skipLocked(){return new s({...this.#e,queryNode:Oe.cloneWithEndModifier(this.#e.queryNode,I.create("SkipLocked"))})}noWait(){return new s({...this.#e,queryNode:Oe.cloneWithEndModifier(this.#e.queryNode,I.create("NoWait"))})}selectAll(e){return new s({...this.#e,queryNode:nr.cloneWithSelections(this.#e.queryNode,y(e))})}innerJoin(...e){return this.#t("InnerJoin",e)}leftJoin(...e){return this.#t("LeftJoin",e)}rightJoin(...e){return this.#t("RightJoin",e)}fullJoin(...e){return this.#t("FullJoin",e)}crossJoin(...e){return this.#t("CrossJoin",e)}innerJoinLateral(...e){return this.#t("LateralInnerJoin",e)}leftJoinLateral(...e){return this.#t("LateralLeftJoin",e)}crossJoinLateral(...e){return this.#t("LateralCrossJoin",e)}crossApply(...e){return this.#t("CrossApply",e)}outerApply(...e){return this.#t("OuterApply",e)}#t(e,t){return new s({...this.#e,queryNode:Oe.cloneWithJoin(this.#e.queryNode,re(e,t))})}orderBy(...e){return new s({...this.#e,queryNode:Oe.cloneWithOrderByItems(this.#e.queryNode,k(e))})}groupBy(e){return new s({...this.#e,queryNode:nr.cloneWithGroupByItems(this.#e.queryNode,pr(e))})}limit(e){return new s({...this.#e,queryNode:nr.cloneWithLimit(this.#e.queryNode,fe.create(d(e)))})}offset(e){return new s({...this.#e,queryNode:nr.cloneWithOffset(this.#e.queryNode,sr.create(d(e)))})}fetch(e,t="only"){return new s({...this.#e,queryNode:nr.cloneWithFetch(this.#e.queryNode,ur(e,t))})}top(e,t){return new s({...this.#e,queryNode:Oe.cloneWithTop(this.#e.queryNode,M(e,t))})}union(e){return new s({...this.#e,queryNode:nr.cloneWithSetOperations(this.#e.queryNode,ae("union",e,!1))})}unionAll(e){return new s({...this.#e,queryNode:nr.cloneWithSetOperations(this.#e.queryNode,ae("union",e,!0))})}intersect(e){return new s({...this.#e,queryNode:nr.cloneWithSetOperations(this.#e.queryNode,ae("intersect",e,!1))})}intersectAll(e){return new s({...this.#e,queryNode:nr.cloneWithSetOperations(this.#e.queryNode,ae("intersect",e,!0))})}except(e){return new s({...this.#e,queryNode:nr.cloneWithSetOperations(this.#e.queryNode,ae("except",e,!1))})}exceptAll(e){return new s({...this.#e,queryNode:nr.cloneWithSetOperations(this.#e.queryNode,ae("except",e,!0))})}as(e){return new mr(this,e)}clearSelect(){return new s({...this.#e,queryNode:nr.cloneWithoutSelections(this.#e.queryNode)})}clearWhere(){return new s({...this.#e,queryNode:Oe.cloneWithoutWhere(this.#e.queryNode)})}clearLimit(){return new s({...this.#e,queryNode:nr.cloneWithoutLimit(this.#e.queryNode)})}clearOffset(){return new s({...this.#e,queryNode:nr.cloneWithoutOffset(this.#e.queryNode)})}clearOrderBy(){return new s({...this.#e,queryNode:Oe.cloneWithoutOrderBy(this.#e.queryNode)})}clearGroupBy(){return new s({...this.#e,queryNode:nr.cloneWithoutGroupBy(this.#e.queryNode)})}$call(e){return e(this)}$if(e,t){if(e)return t(this);return new s({...this.#e})}$castTo(){return new s(this.#e)}$narrowType(){return new s(this.#e)}$assertType(){return new s(this.#e)}$asTuple(){return new p(this.toOperationNode())}$asScalar(){return new p(this.toOperationNode())}withPlugin(e){return new s({...this.#e,executor:this.#e.executor.withPlugin(e)})}toOperationNode(){return this.#e.executor.transformQuery(this.#e.queryNode,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){let e=this.compile();return(await this.#e.executor.executeQuery(e)).rows}async executeTakeFirst(){let[e]=await this.execute();return e}async executeTakeFirstOrThrow(e=q){let t=await this.executeTakeFirst();if(t===void 0)throw V(e)?new e(this.toOperationNode()):e(this.toOperationNode());return t}async*stream(e=100){let t=this.compile(),r=this.#e.executor.stream(t,e);for await(let i of r)yield*i.rows}async explain(e,t){return await new s({...this.#e,queryNode:Oe.cloneWithExplain(this.#e.queryNode,e,t)}).execute()}}s=Ot;function Ee(e){return new Ot(e)}class mr{#e;#t;constructor(e,t){this.#e=e,this.#t=t}get expression(){return this.#e}get alias(){return this.#t}get isAliasedSelectQueryBuilder(){return!0}toOperationNode(){return l.create(this.#e.toOperationNode(),st.create(this.#t))}}var z=C({is(e){return e.kind==="AggregateFunctionNode"},create(e,t=[]){return C({kind:"AggregateFunctionNode",func:e,aggregated:t})},cloneWithDistinct(e){return C({...e,distinct:!0})},cloneWithOrderBy(e,t,r=!1){let i=r?"withinGroup":"orderBy";return C({...e,[i]:e[i]?_.cloneWithItems(e[i],t):_.create(t)})},cloneWithFilter(e,t){return C({...e,filter:e.filter?O.cloneWithOperation(e.filter,"And",t):O.create(t)})},cloneWithOrFilter(e,t){return C({...e,filter:e.filter?O.cloneWithOperation(e.filter,"Or",t):O.create(t)})},cloneWithOver(e,t){return C({...e,over:t})}});var xt=C({is(e){return e.kind==="FunctionNode"},create(e,t){return C({kind:"FunctionNode",func:e,arguments:t})}});class W{#e;constructor(e){this.#e=C(e)}get expressionType(){return}as(e){return new cr(this,e)}distinct(){return new W({...this.#e,aggregateFunctionNode:z.cloneWithDistinct(this.#e.aggregateFunctionNode)})}orderBy(...e){return new W({...this.#e,aggregateFunctionNode:Oe.cloneWithOrderByItems(this.#e.aggregateFunctionNode,k(e))})}clearOrderBy(){return new W({...this.#e,aggregateFunctionNode:Oe.cloneWithoutOrderBy(this.#e.aggregateFunctionNode)})}withinGroupOrderBy(...e){return new W({...this.#e,aggregateFunctionNode:z.cloneWithOrderBy(this.#e.aggregateFunctionNode,k(e),!0)})}filterWhere(...e){return new W({...this.#e,aggregateFunctionNode:z.cloneWithFilter(this.#e.aggregateFunctionNode,yr(e))})}filterWhereRef(e,t,r){return new W({...this.#e,aggregateFunctionNode:z.cloneWithFilter(this.#e.aggregateFunctionNode,N(e,t,r))})}over(e){let t=ir();return new W({...this.#e,aggregateFunctionNode:z.cloneWithOver(this.#e.aggregateFunctionNode,(e?e(t):t).toOperationNode())})}$call(e){return e(this)}$castTo(){return new W(this.#e)}$notNull(){return new W(this.#e)}toOperationNode(){return this.#e.aggregateFunctionNode}}class cr{#e;#t;constructor(e,t){this.#e=e,this.#t=t}get expression(){return this.#e}get alias(){return this.#t}toOperationNode(){return l.create(this.#e.toOperationNode(),st.create(this.#t))}}function sf(){let e=(r,i)=>new p(xt.create(r,Q(i??[]))),t=(r,i)=>new W({aggregateFunctionNode:z.create(r,i?Q(i):void 0)});return Object.assign(e,{agg:t,avg(r){return t("avg",[r])},coalesce(...r){return e("coalesce",r)},count(r){return t("count",[r])},countAll(r){return new W({aggregateFunctionNode:z.create("count",y(r))})},max(r){return t("max",[r])},min(r){return t("min",[r])},sum(r){return t("sum",[r])},any(r){return e("any",[r])},jsonAgg(r){return new W({aggregateFunctionNode:z.create("json_agg",[dr(r)?or(r):r.toOperationNode()])})},toJson(r){return new p(xt.create("to_json",[dr(r)?or(r):r.toOperationNode()]))}})}var lr=C({is(e){return e.kind==="UnaryOperationNode"},create(e,t){return C({kind:"UnaryOperationNode",operator:e,operand:t})}});function Nr(e,t){return lr.create(S.create(e),w(t))}var as=C({is(e){return e.kind==="CaseNode"},create(e){return C({kind:"CaseNode",value:e})},cloneWithWhen(e,t){return C({...e,when:C(e.when?[...e.when,t]:[t])})},cloneWithThen(e,t){return C({...e,when:e.when?C([...e.when.slice(0,-1),R.cloneWithResult(e.when[e.when.length-1],t)]):void 0})},cloneWith(e,t){return C({...e,...t})}});class Fu{#e;constructor(e){this.#e=C(e)}when(...e){return new gt({...this.#e,node:as.cloneWithWhen(this.#e.node,R.create(yr(e)))})}}class gt{#e;constructor(e){this.#e=C(e)}then(e){return new wr({...this.#e,node:as.cloneWithThen(this.#e.node,Pe(e)?ge(e):d(e))})}}class wr{#e;constructor(e){this.#e=C(e)}when(...e){return new gt({...this.#e,node:as.cloneWithWhen(this.#e.node,R.create(yr(e)))})}else(e){return new Or({...this.#e,node:as.cloneWith(this.#e.node,{else:Pe(e)?ge(e):d(e)})})}end(){return new p(as.cloneWith(this.#e.node,{isStatement:!1}))}endCase(){return new p(as.cloneWith(this.#e.node,{isStatement:!0}))}}class Or{#e;constructor(e){this.#e=C(e)}end(){return new p(as.cloneWith(this.#e.node,{isStatement:!1}))}endCase(){return new p(as.cloneWith(this.#e.node,{isStatement:!0}))}}var vt=C({is(e){return e.kind==="JSONPathLegNode"},create(e,t){return C({kind:"JSONPathLegNode",type:e,value:t})}});var ti=/^#-\d+$/;class Re{#e;constructor(e){this.#e=e}at(e){if(typeof e!=="number"&&typeof e!=="string"||typeof e==="number"&&!Number.isInteger(e)||typeof e==="string"&&e!=="last"&&!ti.test(e))throw Error(`Unexpected index value in .at(...): ${e}`);return this.#t("ArrayLocation",e)}key(e){return this.#t("Member",e)}#t(e,t){if(pe.is(this.#e))return new Ae(pe.cloneWithTraversal(this.#e,ee.is(this.#e.traversal)?ee.cloneWithLeg(this.#e.traversal,vt.create(e,t)):qe.cloneWithValue(this.#e.traversal,_n.createImmediate(t))));return new Ae(ee.cloneWithLeg(this.#e,vt.create(e,t)))}}class Ae extends Re{#e;constructor(e){super(e);this.#e=e}get expressionType(){return}as(e){return new xr(this,e)}$castTo(){return new Ae(this.#e)}$notNull(){return new Ae(this.#e)}toOperationNode(){return this.#e}}class xr{#e;#t;constructor(e,t){this.#e=e,this.#t=t}get expression(){return this.#e}get alias(){return this.#t}toOperationNode(){return l.create(this.#e.toOperationNode(),Rr(this.#t)?this.#t.toOperationNode():st.create(this.#t))}}var bt=C({is(e){return e.kind==="TupleNode"},create(e){return C({kind:"TupleNode",values:C(e)})}});var ri=["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"],ii=[/^varchar\(\d+\)$/,/^char\(\d+\)$/,/^decimal\(\d+, \d+\)$/,/^numeric\(\d+, \d+\)$/,/^binary\(\d+\)$/,/^datetime\(\d+\)$/,/^time\(\d+\)$/,/^timetz\(\d+\)$/,/^timestamp\(\d+\)$/,/^timestamptz\(\d+\)$/,/^varbinary\(\d+\)$/],gr=C({is(e){return e.kind==="DataTypeNode"},create(e){return C({kind:"DataTypeNode",dataType:e})}});function vr(e){if(ri.includes(e))return!0;if(ii.some((t)=>t.test(e)))return!0;return!1}function qs(e){if(Rr(e))return e.toOperationNode();if(vr(e))return gr.create(e);throw Error(`invalid column data type ${JSON.stringify(e)}`)}var br=C({is(e){return e.kind==="CastNode"},create(e,t){return C({kind:"CastNode",expression:e,dataType:t})}});function Qe(e=ie){function t(n,a,j){return new p(Ie(n,a,j))}function r(n,a){return new p(Nr(n,a))}let i=Object.assign(t,{fn:void 0,eb:void 0,selectFrom(n){return Ee({queryId:It(),executor:e,queryNode:nr.createFrom(P(n))})},case(n){return new Fu({node:as.create(So(n)?void 0:w(n))})},ref(n,a){if(So(a))return new p(is(n));return new Re(Lt(n,a))},jsonPath(){return new Re(ee.create())},table(n){return new p(or(n))},val(n){return new p(d(n))},refTuple(...n){return new p(bt.create(n.map(w)))},tuple(...n){return new p(bt.create(n.map(d)))},lit(n){return new p(ge(n))},unary:r,not(n){return r("not",n)},exists(n){return r("exists",n)},neg(n){return r("-",n)},between(n,a,j){return new p(X.create(w(n),S.create("between"),v.create(d(a),d(j))))},betweenSymmetric(n,a,j){return new p(X.create(w(n),S.create("between symmetric"),v.create(d(a),d(j))))},and(n){if(x(n))return new p(de(n,"and"));return new p(tt(n,"and"))},or(n){if(x(n))return new p(de(n,"or"));return new p(tt(n,"or"))},parens(...n){let a=yr(n);if(E.is(a))return new p(a);else return new p(E.create(a))},cast(n,a){return new p(br.create(w(n),qs(a)))},withSchema(n){return Qe(e.withPluginAtFront(new js(n)))}});return i.fn=sf(),i.eb=i,i}function B(e){return Qe()}function Ho(e){if(Rr(e))return e.toOperationNode();else if(fr(e))return e(B()).toOperationNode();throw Error(`invalid expression: ${JSON.stringify(e)}`)}function Ve(e){if(Rr(e))return e.toOperationNode();else if(fr(e))return e(B()).toOperationNode();throw Error(`invalid aliased expression: ${JSON.stringify(e)}`)}function J(e){return Le(e)||Ct(e)||fr(e)}class hm{#e;get table(){return this.#e}constructor(e){this.#e=e}as(e){return new Wr(this.#e,e)}}class Wr{#e;#t;get table(){return this.#e}get alias(){return this.#t}constructor(e,t){this.#e=e,this.#t=t}toOperationNode(){return l.create(or(this.#e),st.create(this.#t))}}function Sr(e){return sn(e)&&Rr(e)&&dr(e.table)&&dr(e.alias)}function P(e){if(x(e))return e.map((t)=>se(t));else return[se(e)]}function se(e){if(dr(e))return wt(e);else if(Sr(e))return e.toOperationNode();else return Ve(e)}function wt(e){if(e.includes(" as ")){let[r,i]=e.split(" as ").map(Cr);return l.create(or(r),st.create(i))}else return or(e)}function or(e){if(e.includes(".")){let[r,i]=e.split(".").map(Cr);return mo.createWithSchema(r,i)}else return mo.create(e)}function Cr(e){return e.trim()}var $s=C({is(e){return e.kind==="CreateViewNode"},create(e){return C({kind:"CreateViewNode",name:po.create(e)})},cloneWith(e,t){return C({...e,...t})}});class Te{#e;constructor(e){this.#e=C(e)}get expressionType(){return}get isRawBuilder(){return!0}as(e){return new kr(this,e)}$castTo(){return new Te({...this.#e})}$notNull(){return new Te(this.#e)}withPlugin(e){return new Te({...this.#e,plugins:this.#e.plugins!==void 0?C([...this.#e.plugins,e]):C([e])})}toOperationNode(){return this.#r(this.#t())}compile(e){return this.#o(this.#t(e))}async execute(e){let t=this.#t(e);return t.executeQuery(this.#o(t))}#t(e){let t=e!==void 0?e.getExecutor():ie;return this.#e.plugins!==void 0?t.withPlugins(this.#e.plugins):t}#r(e){return e.transformQuery(this.#e.rawNode,this.#e.queryId)}#o(e){return e.compileQuery(this.#r(e),this.#e.queryId)}}function K(e){return new Te(e)}class kr{#e;#t;constructor(e,t){this.#e=e,this.#t=t}get expression(){return this.#e}get alias(){return this.#t}get rawBuilder(){return this.#e}toOperationNode(){return l.create(this.#e.toOperationNode(),Rr(this.#t)?this.#t.toOperationNode():st.create(this.#t))}}var je=Object.assign((e,...t)=>K({queryId:It(),rawNode:tr.create(e,t?.map(Er)??[])}),{ref(e){return K({queryId:It(),rawNode:tr.createWithChild(is(e))})},val(e){return K({queryId:It(),rawNode:tr.createWithChild(d(e))})},value(e){return this.val(e)},table(e){return K({queryId:It(),rawNode:tr.createWithChild(or(e))})},id(...e){let t=Array(e.length+1).fill(".");return t[0]="",t[t.length-1]="",K({queryId:It(),rawNode:tr.create(t,e.map(st.create))})},lit(e){return K({queryId:It(),rawNode:tr.createWithChild(_n.createImmediate(e))})},literal(e){return this.lit(e)},raw(e){return K({queryId:It(),rawNode:tr.createWithSql(e)})},join(e,t=je`, `){let r=Array(Math.max(2*e.length-1,0)),i=t.toOperationNode();for(let n=0;n<e.length;++n)if(r[2*n]=Er(e[n]),n!==e.length-1)r[2*n+1]=i;return K({queryId:It(),rawNode:tr.createWithChildren(r)})}});function Er(e){if(Rr(e))return e.toOperationNode();return d(e)}class St{nodeStack=[];get parentNode(){return this.nodeStack[this.nodeStack.length-2]}#e=C({AliasNode:this.visitAlias.bind(this),ColumnNode:this.visitColumn.bind(this),IdentifierNode:this.visitIdentifier.bind(this),SchemableIdentifierNode:this.visitSchemableIdentifier.bind(this),RawNode:this.visitRaw.bind(this),ReferenceNode:this.visitReference.bind(this),SelectQueryNode:this.visitSelectQuery.bind(this),SelectionNode:this.visitSelection.bind(this),TableNode:this.visitTable.bind(this),FromNode:this.visitFrom.bind(this),SelectAllNode:this.visitSelectAll.bind(this),AndNode:this.visitAnd.bind(this),OrNode:this.visitOr.bind(this),ValueNode:this.visitValue.bind(this),ValueListNode:this.visitValueList.bind(this),PrimitiveValueListNode:this.visitPrimitiveValueList.bind(this),ParensNode:this.visitParens.bind(this),JoinNode:this.visitJoin.bind(this),OperatorNode:this.visitOperator.bind(this),WhereNode:this.visitWhere.bind(this),InsertQueryNode:this.visitInsertQuery.bind(this),DeleteQueryNode:this.visitDeleteQuery.bind(this),ReturningNode:this.visitReturning.bind(this),CreateTableNode:this.visitCreateTable.bind(this),AddColumnNode:this.visitAddColumn.bind(this),ColumnDefinitionNode:this.visitColumnDefinition.bind(this),DropTableNode:this.visitDropTable.bind(this),DataTypeNode:this.visitDataType.bind(this),OrderByNode:this.visitOrderBy.bind(this),OrderByItemNode:this.visitOrderByItem.bind(this),GroupByNode:this.visitGroupBy.bind(this),GroupByItemNode:this.visitGroupByItem.bind(this),UpdateQueryNode:this.visitUpdateQuery.bind(this),ColumnUpdateNode:this.visitColumnUpdate.bind(this),LimitNode:this.visitLimit.bind(this),OffsetNode:this.visitOffset.bind(this),OnConflictNode:this.visitOnConflict.bind(this),OnDuplicateKeyNode:this.visitOnDuplicateKey.bind(this),CreateIndexNode:this.visitCreateIndex.bind(this),DropIndexNode:this.visitDropIndex.bind(this),ListNode:this.visitList.bind(this),PrimaryKeyConstraintNode:this.visitPrimaryKeyConstraint.bind(this),UniqueConstraintNode:this.visitUniqueConstraint.bind(this),ReferencesNode:this.visitReferences.bind(this),CheckConstraintNode:this.visitCheckConstraint.bind(this),WithNode:this.visitWith.bind(this),CommonTableExpressionNode:this.visitCommonTableExpression.bind(this),CommonTableExpressionNameNode:this.visitCommonTableExpressionName.bind(this),HavingNode:this.visitHaving.bind(this),CreateSchemaNode:this.visitCreateSchema.bind(this),DropSchemaNode:this.visitDropSchema.bind(this),AlterTableNode:this.visitAlterTable.bind(this),DropColumnNode:this.visitDropColumn.bind(this),RenameColumnNode:this.visitRenameColumn.bind(this),AlterColumnNode:this.visitAlterColumn.bind(this),ModifyColumnNode:this.visitModifyColumn.bind(this),AddConstraintNode:this.visitAddConstraint.bind(this),DropConstraintNode:this.visitDropConstraint.bind(this),RenameConstraintNode:this.visitRenameConstraint.bind(this),ForeignKeyConstraintNode:this.visitForeignKeyConstraint.bind(this),CreateViewNode:this.visitCreateView.bind(this),RefreshMaterializedViewNode:this.visitRefreshMaterializedView.bind(this),DropViewNode:this.visitDropView.bind(this),GeneratedNode:this.visitGenerated.bind(this),DefaultValueNode:this.visitDefaultValue.bind(this),OnNode:this.visitOn.bind(this),ValuesNode:this.visitValues.bind(this),SelectModifierNode:this.visitSelectModifier.bind(this),CreateTypeNode:this.visitCreateType.bind(this),DropTypeNode:this.visitDropType.bind(this),ExplainNode:this.visitExplain.bind(this),DefaultInsertValueNode:this.visitDefaultInsertValue.bind(this),AggregateFunctionNode:this.visitAggregateFunction.bind(this),OverNode:this.visitOver.bind(this),PartitionByNode:this.visitPartitionBy.bind(this),PartitionByItemNode:this.visitPartitionByItem.bind(this),SetOperationNode:this.visitSetOperation.bind(this),BinaryOperationNode:this.visitBinaryOperation.bind(this),UnaryOperationNode:this.visitUnaryOperation.bind(this),UsingNode:this.visitUsing.bind(this),FunctionNode:this.visitFunction.bind(this),CaseNode:this.visitCase.bind(this),WhenNode:this.visitWhen.bind(this),JSONReferenceNode:this.visitJSONReference.bind(this),JSONPathNode:this.visitJSONPath.bind(this),JSONPathLegNode:this.visitJSONPathLeg.bind(this),JSONOperatorChainNode:this.visitJSONOperatorChain.bind(this),TupleNode:this.visitTuple.bind(this),MergeQueryNode:this.visitMergeQuery.bind(this),MatchedNode:this.visitMatched.bind(this),AddIndexNode:this.visitAddIndex.bind(this),CastNode:this.visitCast.bind(this),FetchNode:this.visitFetch.bind(this),TopNode:this.visitTop.bind(this),OutputNode:this.visitOutput.bind(this),OrActionNode:this.visitOrAction.bind(this),CollateNode:this.visitCollate.bind(this)});visitNode=(e)=>{this.nodeStack.push(e),this.#e[e.kind](e),this.nodeStack.pop()}}var oi=/'/g,ni=/['"]/g;class ho extends St{#e="";#t=[];get numParameters(){return this.#t.length}compileQuery(e,t){return this.#e="",this.#t=[],this.nodeStack.splice(0,this.nodeStack.length),this.visitNode(e),C({query:e,queryId:t,sql:this.getSql(),parameters:[...this.#t]})}getSql(){return this.#e}visitSelectQuery(e){let t=this.parentNode!==void 0&&!E.is(this.parentNode)&&!u.is(this.parentNode)&&!fo.is(this.parentNode)&&!$s.is(this.parentNode)&&!Je.is(this.parentNode);if(this.parentNode===void 0&&e.explain)this.visitNode(e.explain),this.append(" ");if(t)this.append("(");if(e.with)this.visitNode(e.with),this.append(" ");if(this.append("select"),e.distinctOn)this.append(" "),this.compileDistinctOn(e.distinctOn);if(e.frontModifiers?.length)this.append(" "),this.compileList(e.frontModifiers," ");if(e.top)this.append(" "),this.visitNode(e.top);if(e.selections)this.append(" "),this.compileList(e.selections);if(e.from)this.append(" "),this.visitNode(e.from);if(e.joins)this.append(" "),this.compileList(e.joins," ");if(e.where)this.append(" "),this.visitNode(e.where);if(e.groupBy)this.append(" "),this.visitNode(e.groupBy);if(e.having)this.append(" "),this.visitNode(e.having);if(e.setOperations)this.append(" "),this.compileList(e.setOperations," ");if(e.orderBy)this.append(" "),this.visitNode(e.orderBy);if(e.limit)this.append(" "),this.visitNode(e.limit);if(e.offset)this.append(" "),this.visitNode(e.offset);if(e.fetch)this.append(" "),this.visitNode(e.fetch);if(e.endModifiers?.length)this.append(" "),this.compileList(this.sortSelectModifiers([...e.endModifiers])," ");if(t)this.append(")")}visitFrom(e){this.append("from "),this.compileList(e.froms)}visitSelection(e){this.visitNode(e.selection)}visitColumn(e){this.visitNode(e.column)}compileDistinctOn(e){this.append("distinct on ("),this.compileList(e),this.append(")")}compileList(e,t=", "){let r=e.length-1;for(let i=0;i<=r;i++)if(this.visitNode(e[i]),i<r)this.append(t)}visitWhere(e){this.append("where "),this.visitNode(e.where)}visitHaving(e){this.append("having "),this.visitNode(e.having)}visitInsertQuery(e){let t=this.parentNode!==void 0&&!E.is(this.parentNode)&&!tr.is(this.parentNode)&&!R.is(this.parentNode);if(this.parentNode===void 0&&e.explain)this.visitNode(e.explain),this.append(" ");if(t)this.append("(");if(e.with)this.visitNode(e.with),this.append(" ");if(this.append(e.replace?"replace":"insert"),e.ignore)hi("`InsertQueryNode.ignore` is deprecated. Use `InsertQueryNode.orAction` instead."),this.append(" ignore");if(e.orAction)this.append(" "),this.visitNode(e.orAction);if(e.top)this.append(" "),this.visitNode(e.top);if(e.into)this.append(" into "),this.visitNode(e.into);if(e.columns)this.append(" ("),this.compileList(e.columns),this.append(")");if(e.output)this.append(" "),this.visitNode(e.output);if(e.values)this.append(" "),this.visitNode(e.values);if(e.defaultValues)this.append(" "),this.append("default values");if(e.onConflict)this.append(" "),this.visitNode(e.onConflict);if(e.onDuplicateKey)this.append(" "),this.visitNode(e.onDuplicateKey);if(e.returning)this.append(" "),this.visitNode(e.returning);if(t)this.append(")");if(e.endModifiers?.length)this.append(" "),this.compileList(e.endModifiers," ")}visitValues(e){this.append("values "),this.compileList(e.values)}visitDeleteQuery(e){let t=this.parentNode!==void 0&&!E.is(this.parentNode)&&!tr.is(this.parentNode);if(this.parentNode===void 0&&e.explain)this.visitNode(e.explain),this.append(" ");if(t)this.append("(");if(e.with)this.visitNode(e.with),this.append(" ");if(this.append("delete "),e.top)this.visitNode(e.top),this.append(" ");if(this.visitNode(e.from),e.output)this.append(" "),this.visitNode(e.output);if(e.using)this.append(" "),this.visitNode(e.using);if(e.joins)this.append(" "),this.compileList(e.joins," ");if(e.where)this.append(" "),this.visitNode(e.where);if(e.orderBy)this.append(" "),this.visitNode(e.orderBy);if(e.limit)this.append(" "),this.visitNode(e.limit);if(e.returning)this.append(" "),this.visitNode(e.returning);if(t)this.append(")");if(e.endModifiers?.length)this.append(" "),this.compileList(e.endModifiers," ")}visitReturning(e){this.append("returning "),this.compileList(e.selections)}visitAlias(e){this.visitNode(e.node),this.append(" as "),this.visitNode(e.alias)}visitReference(e){if(e.table)this.visitNode(e.table),this.append(".");this.visitNode(e.column)}visitSelectAll(e){this.append("*")}visitIdentifier(e){this.append(this.getLeftIdentifierWrapper()),this.compileUnwrappedIdentifier(e),this.append(this.getRightIdentifierWrapper())}compileUnwrappedIdentifier(e){if(!dr(e.name))throw Error("a non-string identifier was passed to compileUnwrappedIdentifier.");this.append(this.sanitizeIdentifier(e.name))}visitAnd(e){this.visitNode(e.left),this.append(" and "),this.visitNode(e.right)}visitOr(e){this.visitNode(e.left),this.append(" or "),this.visitNode(e.right)}visitValue(e){if(e.immediate)this.appendImmediateValue(e.value);else this.appendValue(e.value)}visitValueList(e){this.append("("),this.compileList(e.values),this.append(")")}visitTuple(e){this.append("("),this.compileList(e.values),this.append(")")}visitPrimitiveValueList(e){this.append("(");let{values:t}=e;for(let r=0;r<t.length;++r)if(this.appendValue(t[r]),r!==t.length-1)this.append(", ");this.append(")")}visitParens(e){this.append("("),this.visitNode(e.node),this.append(")")}visitJoin(e){if(this.append(ai[e.joinType]),this.append(" "),this.visitNode(e.table),e.on)this.append(" "),this.visitNode(e.on)}visitOn(e){this.append("on "),this.visitNode(e.on)}visitRaw(e){let{sqlFragments:t,parameters:r}=e;for(let i=0;i<t.length;++i)if(this.append(t[i]),r.length>i)this.visitNode(r[i])}visitOperator(e){this.append(e.operator)}visitTable(e){this.visitNode(e.table)}visitSchemableIdentifier(e){if(e.schema)this.visitNode(e.schema),this.append(".");this.visitNode(e.identifier)}visitCreateTable(e){if(this.append("create "),e.frontModifiers?.length)this.compileList(e.frontModifiers," "),this.append(" ");if(e.temporary)this.append("temporary ");if(this.append("table "),e.ifNotExists)this.append("if not exists ");if(this.visitNode(e.table),!e.selectQuery)this.append(" ("),this.compileList([...e.columns,...e.constraints??[]]),this.append(")");if(e.onCommit)this.append(" on commit "),this.append(e.onCommit);if(e.endModifiers?.length)this.append(" "),this.compileList(e.endModifiers," ");if(e.selectQuery)this.append(" as "),this.visitNode(e.selectQuery)}visitColumnDefinition(e){if(e.ifNotExists)this.append("if not exists ");if(this.visitNode(e.column),this.append(" "),this.visitNode(e.dataType),e.unsigned)this.append(" unsigned");if(e.frontModifiers&&e.frontModifiers.length>0)this.append(" "),this.compileList(e.frontModifiers," ");if(e.generated)this.append(" "),this.visitNode(e.generated);if(e.identity)this.append(" identity");if(e.defaultTo)this.append(" "),this.visitNode(e.defaultTo);if(e.notNull)this.append(" not null");if(e.unique)this.append(" unique");if(e.nullsNotDistinct)this.append(" nulls not distinct");if(e.primaryKey)this.append(" primary key");if(e.autoIncrement)this.append(" "),this.append(this.getAutoIncrement());if(e.references)this.append(" "),this.visitNode(e.references);if(e.check)this.append(" "),this.visitNode(e.check);if(e.endModifiers&&e.endModifiers.length>0)this.append(" "),this.compileList(e.endModifiers," ")}getAutoIncrement(){return"auto_increment"}visitReferences(e){if(this.append("references "),this.visitNode(e.table),this.append(" ("),this.compileList(e.columns),this.append(")"),e.onDelete)this.append(" on delete "),this.append(e.onDelete);if(e.onUpdate)this.append(" on update "),this.append(e.onUpdate)}visitDropTable(e){if(this.append("drop table "),e.ifExists)this.append("if exists ");if(this.visitNode(e.table),e.cascade)this.append(" cascade")}visitDataType(e){this.append(e.dataType)}visitOrderBy(e){this.append("order by "),this.compileList(e.items)}visitOrderByItem(e){if(this.visitNode(e.orderBy),e.collation)this.append(" "),this.visitNode(e.collation);if(e.direction)this.append(" "),this.visitNode(e.direction);if(e.nulls)this.append(" nulls "),this.append(e.nulls)}visitGroupBy(e){this.append("group by "),this.compileList(e.items)}visitGroupByItem(e){this.visitNode(e.groupBy)}visitUpdateQuery(e){let t=this.parentNode!==void 0&&!E.is(this.parentNode)&&!tr.is(this.parentNode)&&!R.is(this.parentNode);if(this.parentNode===void 0&&e.explain)this.visitNode(e.explain),this.append(" ");if(t)this.append("(");if(e.with)this.visitNode(e.with),this.append(" ");if(this.append("update "),e.top)this.visitNode(e.top),this.append(" ");if(e.table)this.visitNode(e.table),this.append(" ");if(this.append("set "),e.updates)this.compileList(e.updates);if(e.output)this.append(" "),this.visitNode(e.output);if(e.from)this.append(" "),this.visitNode(e.from);if(e.joins){if(!e.from)throw Error("Joins in an update query are only supported as a part of a PostgreSQL 'update set from join' query. If you want to create a MySQL 'update join set' query, see https://kysely.dev/docs/examples/update/my-sql-joins");this.append(" "),this.compileList(e.joins," ")}if(e.where)this.append(" "),this.visitNode(e.where);if(e.returning)this.append(" "),this.visitNode(e.returning);if(e.orderBy)this.append(" "),this.visitNode(e.orderBy);if(e.limit)this.append(" "),this.visitNode(e.limit);if(t)this.append(")");if(e.endModifiers?.length)this.append(" "),this.compileList(e.endModifiers," ")}visitColumnUpdate(e){this.visitNode(e.column),this.append(" = "),this.visitNode(e.value)}visitLimit(e){this.append("limit "),this.visitNode(e.limit)}visitOffset(e){this.append("offset "),this.visitNode(e.offset)}visitOnConflict(e){if(this.append("on conflict"),e.columns)this.append(" ("),this.compileList(e.columns),this.append(")");else if(e.constraint)this.append(" on constraint "),this.visitNode(e.constraint);else if(e.indexExpression)this.append(" ("),this.visitNode(e.indexExpression),this.append(")");if(e.indexWhere)this.append(" "),this.visitNode(e.indexWhere);if(e.doNothing===!0)this.append(" do nothing");else if(e.updates){if(this.append(" do update set "),this.compileList(e.updates),e.updateWhere)this.append(" "),this.visitNode(e.updateWhere)}}visitOnDuplicateKey(e){this.append("on duplicate key update "),this.compileList(e.updates)}visitCreateIndex(e){if(this.append("create "),e.unique)this.append("unique ");if(this.append("index "),e.ifNotExists)this.append("if not exists ");if(this.visitNode(e.name),e.table)this.append(" on "),this.visitNode(e.table);if(e.using)this.append(" using "),this.visitNode(e.using);if(e.columns)this.append(" ("),this.compileList(e.columns),this.append(")");if(e.nullsNotDistinct)this.append(" nulls not distinct");if(e.where)this.append(" "),this.visitNode(e.where)}visitDropIndex(e){if(this.append("drop index "),e.ifExists)this.append("if exists ");if(this.visitNode(e.name),e.table)this.append(" on "),this.visitNode(e.table);if(e.cascade)this.append(" cascade")}visitCreateSchema(e){if(this.append("create schema "),e.ifNotExists)this.append("if not exists ");this.visitNode(e.schema)}visitDropSchema(e){if(this.append("drop schema "),e.ifExists)this.append("if exists ");if(this.visitNode(e.schema),e.cascade)this.append(" cascade")}visitPrimaryKeyConstraint(e){if(e.name)this.append("constraint "),this.visitNode(e.name),this.append(" ");this.append("primary key ("),this.compileList(e.columns),this.append(")"),this.buildDeferrable(e)}buildDeferrable(e){if(e.deferrable!==void 0)if(e.deferrable)this.append(" deferrable");else this.append(" not deferrable");if(e.initiallyDeferred!==void 0)if(e.initiallyDeferred)this.append(" initially deferred");else this.append(" initially immediate")}visitUniqueConstraint(e){if(e.name)this.append("constraint "),this.visitNode(e.name),this.append(" ");if(this.append("unique"),e.nullsNotDistinct)this.append(" nulls not distinct");this.append(" ("),this.compileList(e.columns),this.append(")"),this.buildDeferrable(e)}visitCheckConstraint(e){if(e.name)this.append("constraint "),this.visitNode(e.name),this.append(" ");this.append("check ("),this.visitNode(e.expression),this.append(")")}visitForeignKeyConstraint(e){if(e.name)this.append("constraint "),this.visitNode(e.name),this.append(" ");if(this.append("foreign key ("),this.compileList(e.columns),this.append(") "),this.visitNode(e.references),e.onDelete)this.append(" on delete "),this.append(e.onDelete);if(e.onUpdate)this.append(" on update "),this.append(e.onUpdate);this.buildDeferrable(e)}visitList(e){this.compileList(e.items)}visitWith(e){if(this.append("with "),e.recursive)this.append("recursive ");this.compileList(e.expressions)}visitCommonTableExpression(e){if(this.visitNode(e.name),this.append(" as "),Vi(e.materialized)){if(!e.materialized)this.append("not ");this.append("materialized ")}this.visitNode(e.expression)}visitCommonTableExpressionName(e){if(this.visitNode(e.table),e.columns)this.append("("),this.compileList(e.columns),this.append(")")}visitAlterTable(e){if(this.append("alter table "),this.visitNode(e.table),this.append(" "),e.renameTo)this.append("rename to "),this.visitNode(e.renameTo);if(e.setSchema)this.append("set schema "),this.visitNode(e.setSchema);if(e.addConstraint)this.visitNode(e.addConstraint);if(e.dropConstraint)this.visitNode(e.dropConstraint);if(e.renameConstraint)this.visitNode(e.renameConstraint);if(e.columnAlterations)this.compileColumnAlterations(e.columnAlterations);if(e.addIndex)this.visitNode(e.addIndex);if(e.dropIndex)this.visitNode(e.dropIndex)}visitAddColumn(e){this.append("add column "),this.visitNode(e.column)}visitRenameColumn(e){this.append("rename column "),this.visitNode(e.column),this.append(" to "),this.visitNode(e.renameTo)}visitDropColumn(e){this.append("drop column "),this.visitNode(e.column)}visitAlterColumn(e){if(this.append("alter column "),this.visitNode(e.column),this.append(" "),e.dataType){if(this.announcesNewColumnDataType())this.append("type ");if(this.visitNode(e.dataType),e.dataTypeExpression)this.append("using "),this.visitNode(e.dataTypeExpression)}if(e.setDefault)this.append("set default "),this.visitNode(e.setDefault);if(e.dropDefault)this.append("drop default");if(e.setNotNull)this.append("set not null");if(e.dropNotNull)this.append("drop not null")}visitModifyColumn(e){this.append("modify column "),this.visitNode(e.column)}visitAddConstraint(e){this.append("add "),this.visitNode(e.constraint)}visitDropConstraint(e){if(this.append("drop constraint "),e.ifExists)this.append("if exists ");if(this.visitNode(e.constraintName),e.modifier==="cascade")this.append(" cascade");else if(e.modifier==="restrict")this.append(" restrict")}visitRenameConstraint(e){this.append("rename constraint "),this.visitNode(e.oldName),this.append(" to "),this.visitNode(e.newName)}visitSetOperation(e){if(this.append(e.operator),this.append(" "),e.all)this.append("all ");this.visitNode(e.expression)}visitCreateView(e){if(this.append("create "),e.orReplace)this.append("or replace ");if(e.materialized)this.append("materialized ");if(e.temporary)this.append("temporary ");if(this.append("view "),e.ifNotExists)this.append("if not exists ");if(this.visitNode(e.name),this.append(" "),e.columns)this.append("("),this.compileList(e.columns),this.append(") ");if(e.as)this.append("as "),this.visitNode(e.as)}visitRefreshMaterializedView(e){if(this.append("refresh materialized view "),e.concurrently)this.append("concurrently ");if(this.visitNode(e.name),e.withNoData)this.append(" with no data");else this.append(" with data")}visitDropView(e){if(this.append("drop "),e.materialized)this.append("materialized ");if(this.append("view "),e.ifExists)this.append("if exists ");if(this.visitNode(e.name),e.cascade)this.append(" cascade")}visitGenerated(e){if(this.append("generated "),e.always)this.append("always ");if(e.byDefault)this.append("by default ");if(this.append("as "),e.identity)this.append("identity");if(e.expression)this.append("("),this.visitNode(e.expression),this.append(")");if(e.stored)this.append(" stored")}visitDefaultValue(e){this.append("default "),this.visitNode(e.defaultValue)}visitSelectModifier(e){if(e.rawModifier)this.visitNode(e.rawModifier);else this.append(si[e.modifier]);if(e.of)this.append(" of "),this.compileList(e.of,", ")}visitCreateType(e){if(this.append("create type "),this.visitNode(e.name),e.enum)this.append(" as enum "),this.visitNode(e.enum)}visitDropType(e){if(this.append("drop type "),e.ifExists)this.append("if exists ");this.visitNode(e.name)}visitExplain(e){if(this.append("explain"),e.options||e.format){if(this.append(" "),this.append(this.getLeftExplainOptionsWrapper()),e.options){if(this.visitNode(e.options),e.format)this.append(this.getExplainOptionsDelimiter())}if(e.format)this.append("format"),this.append(this.getExplainOptionAssignment()),this.append(e.format);this.append(this.getRightExplainOptionsWrapper())}}visitDefaultInsertValue(e){this.append("default")}visitAggregateFunction(e){if(this.append(e.func),this.append("("),e.distinct)this.append("distinct ");if(this.compileList(e.aggregated),e.orderBy)this.append(" "),this.visitNode(e.orderBy);if(this.append(")"),e.withinGroup)this.append(" within group ("),this.visitNode(e.withinGroup),this.append(")");if(e.filter)this.append(" filter("),this.visitNode(e.filter),this.append(")");if(e.over)this.append(" "),this.visitNode(e.over)}visitOver(e){if(this.append("over("),e.partitionBy){if(this.visitNode(e.partitionBy),e.orderBy)this.append(" ")}if(e.orderBy)this.visitNode(e.orderBy);this.append(")")}visitPartitionBy(e){this.append("partition by "),this.compileList(e.items)}visitPartitionByItem(e){this.visitNode(e.partitionBy)}visitBinaryOperation(e){this.visitNode(e.leftOperand),this.append(" "),this.visitNode(e.operator),this.append(" "),this.visitNode(e.rightOperand)}visitUnaryOperation(e){if(this.visitNode(e.operator),!this.isMinusOperator(e.operator))this.append(" ");this.visitNode(e.operand)}isMinusOperator(e){return S.is(e)&&e.operator==="-"}visitUsing(e){this.append("using "),this.compileList(e.tables)}visitFunction(e){this.append(e.func),this.append("("),this.compileList(e.arguments),this.append(")")}visitCase(e){if(this.append("case"),e.value)this.append(" "),this.visitNode(e.value);if(e.when)this.append(" "),this.compileList(e.when," ");if(e.else)this.append(" else "),this.visitNode(e.else);if(this.append(" end"),e.isStatement)this.append(" case")}visitWhen(e){if(this.append("when "),this.visitNode(e.condition),e.result)this.append(" then "),this.visitNode(e.result)}visitJSONReference(e){this.visitNode(e.reference),this.visitNode(e.traversal)}visitJSONPath(e){if(e.inOperator)this.visitNode(e.inOperator);this.append("'$");for(let t of e.pathLegs)this.visitNode(t);this.append("'")}visitJSONPathLeg(e){let t=e.type==="ArrayLocation",r=String(e.value);if(t)this.append("["),this.append(this.sanitizeStringLiteral(r)),this.append("]");else this.append('."'),this.append(this.sanitizeJSONPathMemberValue(r)),this.append('"')}visitJSONOperatorChain(e){for(let t=0,r=e.values.length;t<r;t++){if(t===r-1)this.visitNode(e.operator);else this.append("->");this.visitNode(e.values[t])}}visitMergeQuery(e){if(e.with)this.visitNode(e.with),this.append(" ");if(this.append("merge "),e.top)this.visitNode(e.top),this.append(" ");if(this.append("into "),this.visitNode(e.into),e.using)this.append(" "),this.visitNode(e.using);if(e.whens)this.append(" "),this.compileList(e.whens," ");if(e.returning)this.append(" "),this.visitNode(e.returning);if(e.output)this.append(" "),this.visitNode(e.output);if(e.endModifiers?.length)this.append(" "),this.compileList(e.endModifiers," ")}visitMatched(e){if(e.not)this.append("not ");if(this.append("matched"),e.bySource)this.append(" by source")}visitAddIndex(e){if(this.append("add "),e.unique)this.append("unique ");if(this.append("index "),this.visitNode(e.name),e.columns)this.append(" ("),this.compileList(e.columns),this.append(")");if(e.using)this.append(" using "),this.visitNode(e.using)}visitCast(e){this.append("cast("),this.visitNode(e.expression),this.append(" as "),this.visitNode(e.dataType),this.append(")")}visitFetch(e){this.append("fetch next "),this.visitNode(e.rowCount),this.append(` rows ${e.modifier}`)}visitOutput(e){this.append("output "),this.compileList(e.selections)}visitTop(e){if(this.append(`top(${e.expression})`),e.modifiers)this.append(` ${e.modifiers}`)}visitOrAction(e){this.append(e.action)}visitCollate(e){this.append("collate "),this.visitNode(e.collation)}append(e){this.#e+=e}appendValue(e){this.addParameter(e),this.append(this.getCurrentParameterPlaceholder())}getLeftIdentifierWrapper(){return'"'}getRightIdentifierWrapper(){return'"'}getCurrentParameterPlaceholder(){return"$"+this.numParameters}getLeftExplainOptionsWrapper(){return"("}getExplainOptionAssignment(){return" "}getExplainOptionsDelimiter(){return", "}getRightExplainOptionsWrapper(){return")"}sanitizeIdentifier(e){let t=this.getLeftIdentifierWrapper(),r=this.getRightIdentifierWrapper(),i="";for(let n of e)if(i+=n,n===t)i+=t;else if(n===r)i+=r;return i}sanitizeStringLiteral(e){return e.replace(oi,"''")}sanitizeJSONPathMemberValue(e){return e.replace(ni,(t)=>t==="'"?"''":"\\\"")}addParameter(e){this.#t.push(e)}appendImmediateValue(e){if(dr(e))this.appendStringLiteral(e);else if(zs(e)||Vi(e)||La(e))this.append(e.toString());else if(Fa(e))this.append("null");else if(rf(e))this.appendImmediateValue(e.toISOString());else throw Error(`invalid immediate value ${e}`)}appendStringLiteral(e){this.append("'"),this.append(this.sanitizeStringLiteral(e)),this.append("'")}sortSelectModifiers(e){return e.sort((t,r)=>t.modifier&&r.modifier?Ar[t.modifier]-Ar[r.modifier]:1),C(e)}compileColumnAlterations(e){this.compileList(e)}announcesNewColumnDataType(){return!0}}var si=C({ForKeyShare:"for key share",ForNoKeyUpdate:"for no key update",ForUpdate:"for update",ForShare:"for share",NoWait:"nowait",SkipLocked:"skip locked",Distinct:"distinct"}),Ar=C({ForKeyShare:1,ForNoKeyUpdate:1,ForUpdate:1,ForShare:1,NoWait:2,SkipLocked:2,Distinct:0}),ai=C({InnerJoin:"inner join",LeftJoin:"left join",RightJoin:"right join",FullJoin:"full join",CrossJoin:"cross join",LateralInnerJoin:"inner join lateral",LateralLeftJoin:"left join lateral",LateralCrossJoin:"cross join lateral",OuterApply:"outer apply",CrossApply:"cross apply",Using:"using"});var gm="kysely_migration",Am="kysely_migration_lock";function _m(e){let t=e.filter((i)=>i.pk>0),r=t.length===1?t[0]:void 0;return r?.type.toLowerCase()==="integer"?r.name:void 0}async function Tr(e,t,r){let i=_m(r);if(!i)return;let{rows:n}=await je`
3
+ PRAGMA index_list(${je.id(t)})
4
+ `.execute(e.withoutPlugins());return n.some((a)=>a.origin==="pk")?void 0:i}function af(e,t,r){return{name:e.name,isView:e.type==="view",columns:t.map((i)=>({name:i.name,dataType:i.type,isNullable:i.notnull===0,isAutoIncrementing:i.name===r,hasDefaultValue:i.dflt_value!=null}))}}async function pi(e,t){let{rows:r}=await je`
5
+ PRAGMA table_info(${je.id(t)})
6
+ `.execute(e.withoutPlugins());if(r.length===0)return;let i=await Tr(e,t,r);return af({name:t},r,i)}async function qg(e,t){if(t.length===0)return[];try{return await e.introspection.getTables()}catch{return(await Promise.all(t.map((r)=>pi(e,r)))).filter((r)=>r!==void 0)}}function Lu(e){let t=e;async function r(){return[]}async function i(n={withInternalKyselyTables:!1}){let a=t.selectFrom("sqlite_schema").where("type","=","table").where("name","not like","sqlite_%").select("name");if(!n.withInternalKyselyTables)a=a.where("name","!=",gm).where("name","!=",Am);let j=await a.execute();return Promise.all(j.map(async({name:H})=>{let Y=await e.selectFrom(je`pragma_table_info(${H})`.as("table_info")).select(["cid","name","type","notnull","dflt_value","pk"]).execute(),we=await Tr(e,H,Y);return af({name:H},Y,we)}))}return{getSchemas:r,getTables:i,getMetadata:async(n)=>({tables:await i(n)})}}
7
+ export{So,dr,zs,Vi,Fa,rf,La,zg,fr,sn,C,Io,st,jg,fo,po,mo,Rr,Wt,dc,Za,pm,tr,hi,is,mm,fc,Ba,_n,yr,Oe,nr,nf,It,Du,js,Ua,of,Nu,gi,sf,as,Fu,qs,Ho,hm,or,$s,je,ho,gm,Am,_m,af,qg,Lu};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- function Ps(i){let t=3735928559,h=1103547991;for(let e=0;e<i.length;e++){let l=i.charCodeAt(e);t=Math.imul(t^l,2654435761),h=Math.imul(h^l,1597334677)}return t=Math.imul(t^t>>>16,2246822507)^Math.imul(h^h>>>13,3266489909),h=Math.imul(h^h>>>16,2246822507)^Math.imul(t^t>>>13,3266489909),(h>>>0).toString(36)+(t>>>0).toString(36)}
3
- export{Ps};
2
+ function mi(i){let t=3735928559,h=1103547991;for(let e=0;e<i.length;e++){let l=i.charCodeAt(e);t=Math.imul(t^l,2654435761),h=Math.imul(h^l,1597334677)}return t=Math.imul(t^t>>>16,2246822507)^Math.imul(h^h>>>13,3266489909),h=Math.imul(h^h>>>16,2246822507)^Math.imul(t^t>>>13,3266489909),(h>>>0).toString(36)+(t>>>0).toString(36)}
3
+ export{mi};
@@ -0,0 +1,2 @@
1
+ import{Q,S,M,w,Z,Y,a,g,ie,X,R,z,K,ao,$t,Be,Bt,Er,xr,Re,Ue,Ge,B,jb,qb,Vb,fw,Vm,e_,$w,dE,LE,ZE,Dr,B_,mh,yh,s0,tT,aT,RT,y0,Wh,Lp,PR,VM,dg,fg,bO,Jn,pg,Ie,Pt,ln,nn,ha,Xe,et,tt,rt,be,ts,Fi,ar,Ir}from"./chunk-zarz3sqn.js";import{ro}from"./chunk-55h9ze53.js";import{Gd,Bi}from"./chunk-1ktk6764.js";import{rs}from"./chunk-hpbn0k9n.js";var Ce=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],ae=z("brain",Ce);Z();function va({projectId:m,contextAssetId:k,file:f,currentTime:ne,frameRate:C,startTimecode:V,formatTimestamp:I,onTyping:le,onSelectMessage:W,selectedMessageId:de}){let{isHistoryMode:p,setIsHistoryMode:A,currentSessionId:me,chatAssets:ce,removeAsset:ue,messages:h,historySessions:J,isStreaming:_,fetchHistorySessions:U,loadSession:pe,deleteSession:fe,startNewSession:G,sendMessage:ge,abortActiveSession:xe,selectedAgentId:T,setSelectedAgentId:j,inputText:he,setInputText:ve}=Ir(),{teamId:c,ensureTeamIdForProject:ee}=Pt(),{videoTimeDisplayMode:ye}=ar(),[q,D]=w(null);S(()=>{if(m)ee(m)},[m,ee]);let{data:we=[],isSuccess:te}=X({queryKey:["chat-agents",m],queryFn:async()=>{if(!m)return[];let e=await R.api.projects[":projectId"]["chat-agents"].$get({param:{projectId:m}});if(!e.ok)throw Error("failed to fetch agents");return e.json()},enabled:!!m}),N=we.filter((e)=>e.type==="chat"&&e.enabled);S(()=>{if(!te)return;if(N.length>0){if(!N.some((t)=>t.id===T))j(N[0].id)}else if(T!==null)j(null)},[te,N,T,j]);let re=M(null),E=M(null),F=M(!0),H=M(!0);S(()=>{H.current=!0,F.current=!0},[m,k,p]),S(()=>{let e=E.current?.querySelector('[data-slot="scroll-area-viewport"]');if(!e)return;let{scrollTop:t,isAtBottom:i}=Ir.getState(),r=setTimeout(()=>{if(i)e.scrollTop=e.scrollHeight;else e.scrollTop=t;let d=setTimeout(()=>{H.current=!1},50);return()=>clearTimeout(d)},0);return()=>clearTimeout(r)},[m,k,p]),S(()=>{let e=E.current?.querySelector('[data-slot="scroll-area-viewport"]');if(!e)return;let t=()=>{if(H.current)return;let i=e.scrollTop,r=e.scrollHeight-i-e.clientHeight<10;Ir.getState().setScrollState(i,r)};return e.addEventListener("scroll",t),()=>{e.removeEventListener("scroll",t)}},[m,k,p]);let{ref:ke,isDropTarget:Ne}=ln({id:"chatbot-sidebar",data:{type:"chatbot-sidebar"}});S(()=>{if(!p){let{isAtBottom:e}=Ir.getState();if(e||_){let t=F.current?"auto":"smooth";re.current?.scrollIntoView({behavior:t})}F.current=!1}},[h,_,p]),S(()=>{if(p&&c)U(c)},[p,U,c]);let v=ie(),_e=Q(()=>{v.invalidateQueries({queryKey:["search"]}),v.invalidateQueries({queryKey:["folders"]}),v.invalidateQueries({queryKey:["files"]}),v.invalidateQueries({queryKey:["file"]}),v.invalidateQueries({queryKey:["version_stacks"]}),v.invalidateQueries({queryKey:["projects"]})},[v]),O=(e)=>{if(typeof e==="string")return e;if(Array.isArray(e))return e.map((t)=>{if(typeof t==="string")return t;if(t&&typeof t==="object"&&"type"in t&&t.type==="text"&&"text"in t)return String(t.text);return""}).join("");return""},oe=(e)=>e.replace(/<@([a-zA-Z0-9_-]+)>/g,"@$1").replace(/^\[([^\]]+)\]:/gm,"\\[$1\\]:"),Se=(e)=>{switch(e.role){case"user":case"custom":{let t=e;if(e.role==="custom"&&t.customType==="context_display_info"){let d=t.details?.assets||[];if(d.length===0)return null;return g("div",{className:"text-xs text-muted-foreground bg-muted/40 p-2.5 rounded-lg border border-border/50 space-y-1 my-1",children:[a("div",{className:"font-semibold",children:qb()}),a("ul",{className:"list-disc list-inside space-y-0.5",children:d.map((s)=>g("li",{className:"truncate",children:[s.name," ",g("span",{className:"text-muted-foreground/70",children:["(",s.type,")"]})]},s.id))})]},e.id)}if(e.role==="user"||t.customType==="shumai_message"){let r=t.details,d=r?.referencedAssets||[],s=r?.attachedFiles||[],n=r?.position,u=r?.annotation||r?.annotations&&r.annotations.length>0,l=!r?.currentAsset?.id||k&&r.currentAsset.id===k||f?.id&&r.currentAsset.id===f.id,x=de===e.id,y="";if(n?.type==="time")if(I)y=I(n.seconds);else if(C){let o=Math.round(n.seconds*C);y=ro(o,C,ye,V)}else{let o=Math.floor(n.seconds/60),b=Math.floor(n.seconds%60);y=`${o.toString().padStart(2,"0")}:${b.toString().padStart(2,"0")}`}else if(n?.type==="page")y=y0({page:n.page});let se=O(t.content),Te=s.length>0||d.length>0;return a("div",{onClick:()=>{if(l&&W)W(e)},className:B("flex flex-col items-end w-full group transition-all duration-150",l&&(u||n)&&"cursor-pointer"),children:g("div",{className:B("bg-primary text-primary-foreground rounded-lg px-3 py-2 text-sm whitespace-pre-wrap shadow-xs break-words transition-all border",Te?"w-full":"max-w-[85%]",x?"border-blue-500 dark:border-blue-400":"border-transparent"),children:[g("div",{className:"text-sm leading-relaxed whitespace-pre-wrap break-words",children:[u&&a("span",{className:"inline-flex items-center align-middle mr-1.5 p-0.5 rounded bg-primary-foreground/20 text-primary-foreground",title:$w(),children:a(ha,{className:"w-3.5 h-3.5"})}),n&&a("span",{className:"inline-flex items-center align-middle mr-1.5 px-1.5 py-0.5 rounded text-xs font-mono font-bold bg-primary-foreground/20 text-primary-foreground",children:y}),se&&a("span",{children:se})]}),s.length>0&&g("div",{className:"mt-2.5 w-full",children:[a("div",{className:"text-xs font-medium text-primary-foreground/70 mb-1",children:Vb()}),a("div",{className:"flex flex-col gap-1.5 w-full",children:s.map((o)=>{let b=o.name||"file",P=Fi(b)||o.mediaType==="image"||o.mimeType?.startsWith("image/");return g("div",{className:B("group/att relative flex items-center w-full max-w-full rounded-lg border border-primary-foreground/15 bg-primary-foreground/10 hover:bg-primary-foreground/15 transition-colors overflow-hidden",P?"h-18 p-1.5 gap-2.5 cursor-pointer":"h-9 px-2.5 gap-2.5"),onClick:(L)=>{if(L.stopPropagation(),o.url)if(P)D({url:o.url,name:b});else window.open(o.url,"_blank","noreferrer")},children:[P&&o.url?a("div",{className:"h-full aspect-square rounded-md overflow-hidden bg-black/20 shrink-0",children:a("img",{src:o.url,alt:b,className:"w-full h-full object-cover group-hover/att:scale-105 transition-transform duration-200"})}):a(Er,{className:"w-4 h-4 text-primary-foreground/70 shrink-0"}),a("div",{className:"min-w-0 flex-1 overflow-hidden",children:a("p",{className:"text-xs font-medium text-primary-foreground truncate block w-full",title:b,children:b})}),o.url&&a("a",{href:o.url,target:"_blank",rel:"noreferrer",download:b,className:"p-1 text-primary-foreground/70 hover:text-primary-foreground shrink-0 rounded-md hover:bg-primary-foreground/20 transition-colors opacity-0 group-hover/att:opacity-100",onClick:(L)=>L.stopPropagation(),title:Dr(),children:a(Bt,{className:"w-3.5 h-3.5"})})]},o.id)})})]}),d.length>0&&g("div",{className:"mt-2.5 w-full",children:[a("div",{className:"text-xs font-medium text-primary-foreground/70 mb-1",children:jb()}),a("div",{className:"flex flex-col gap-1.5 w-full",children:d.map((o)=>g("div",{className:"flex items-center justify-between w-full h-9 px-2.5 rounded-lg border border-primary-foreground/15 bg-primary-foreground/10 hover:bg-primary-foreground/15 transition-colors overflow-hidden",children:[g("div",{className:"flex items-center gap-2.5 min-w-0 flex-1",children:[o.type==="folder"?a(xr,{className:"w-4 h-4 text-primary-foreground/70 shrink-0"}):a(Er,{className:"w-4 h-4 text-primary-foreground/70 shrink-0"}),a("span",{className:"text-xs font-medium truncate text-primary-foreground",title:o.name,children:o.name})]}),a("span",{className:"text-[10px] text-primary-foreground/60 uppercase shrink-0 font-mono ml-2",children:o.type})]},o.id))})]})]})},e.id)}let i=t.content||"";return a("div",{className:"text-center text-xs text-muted-foreground italic bg-muted/20 py-1.5 rounded",children:O(i)},e.id)}case"assistant":{let i=e.content;if(!i)return null;let r=[];if(i.forEach((s,n)=>{if(!s||typeof s!=="object")return;let u=s;switch(u.type){case"text":{let l=u.text;if(typeof l!=="string"||!l.trim())return;r.push(a("div",{className:"text-sm leading-[1.8] prose prose-sm dark:prose-invert max-w-none break-words",children:a(ts,{components:{pre:({node:x,...y})=>a("pre",{className:"whitespace-pre-wrap break-all break-words bg-muted text-foreground p-4 rounded-md border border-border/50 font-mono text-sm",...y})},children:oe(l)})},`txt-${n}`));break}case"thinking":{let l=u.thinking;if(typeof l!=="string"||!l.trim())return;r.push(g("details",{className:"group border border-border/50 rounded-lg bg-muted/20 my-2 overflow-hidden",children:[g("summary",{className:"flex items-center gap-2 p-2.5 text-xs font-medium text-muted-foreground select-none cursor-pointer hover:bg-muted/40 transition-colors list-none [&::-webkit-details-marker]:hidden",children:[a(ae,{className:"h-3.5 w-3.5 text-primary/70 animate-pulse"}),a("span",{children:Wh()||"Thinking"}),a(Be,{className:"h-3 w-3 ml-auto transition-transform group-open:rotate-180"})]}),a("div",{className:"p-3 pt-0 text-xs text-muted-foreground/90 border-t border-border/40 bg-muted/10 leading-relaxed prose prose-sm dark:prose-invert max-w-none whitespace-pre-wrap font-sans",children:a(ts,{children:oe(l)})})]},`think-${n}`));break}case"toolCall":{let l=String(u.name||u.toolName||Jn()),x=u.arguments||u.args;r.push(g("details",{className:"group border border-border/50 rounded-lg bg-violet-500/5 my-2 overflow-hidden",children:[g("summary",{className:"flex items-center gap-2 p-2.5 text-xs font-semibold text-violet-600 dark:text-violet-400 select-none cursor-pointer hover:bg-violet-500/10 transition-colors list-none [&::-webkit-details-marker]:hidden",children:[a(rs,{className:"h-3.5 w-3.5"}),a("span",{children:Vm()}),a("span",{className:"font-mono bg-violet-500/10 px-1.5 py-0.5 rounded text-[11px] text-violet-700 dark:text-violet-300",children:l}),a(Be,{className:"h-3 w-3 ml-auto transition-transform group-open:rotate-180"})]}),!!x&&g("div",{className:"p-3 pt-0 text-[10px] text-muted-foreground/90 border-t border-border/40 bg-violet-500/5 font-sans",children:[a("div",{className:"text-[9px] text-muted-foreground/60 uppercase font-bold tracking-wider mb-1.5",children:dg()||"Arguments"}),a("pre",{className:"font-mono bg-muted/30 p-2 rounded border border-border/30 overflow-x-auto max-h-32",children:JSON.stringify(x,null,2)})]})]},`tool-${n}`));break}case"image":{let l=String(u.mimeType||"image/png"),x=String(u.data||"");r.push(a("div",{className:"my-2 max-w-full",children:x?a("img",{src:x.startsWith("data:")?x:`data:${l};base64,${x}`,alt:"Attached asset",className:"max-h-60 rounded border border-border/50 object-contain shadow-xs"}):a("div",{className:"text-xs text-muted-foreground italic flex items-center gap-1.5 py-1",children:mh()})},`img-${n}`));break}default:{let l=JSON.stringify(s,null,2);if(l==="{}")return;r.push(a("pre",{className:"text-xs text-foreground/80 font-mono whitespace-pre-wrap break-words bg-muted/20 p-2 rounded",children:l},`other-${n}`))}}}),r.length===0)return null;let d=!1;if(i.length>0){let s=i[i.length-1];if(typeof s==="string"&&s.trim().length>0)d=!0;else if(s&&typeof s==="object"){let n=s;if(n.type==="text"&&typeof n.text==="string"&&n.text.trim().length>0)d=!0}}return g("div",{className:"flex flex-col w-full space-y-1",children:[a("div",{className:"space-y-2 w-full",children:r}),d&&a("div",{className:"text-[10px] text-muted-foreground self-start italic pt-1",children:dE()})]},e.id)}case"toolResult":return a("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/40 p-2 rounded-md border border-border/50",children:a("span",{className:"font-semibold",children:fg({name:e.toolName||"tool"})})},e.id);case"thinking_level_change":{let i=e.content||"";return a("div",{className:"text-center text-xs text-muted-foreground italic bg-muted/20 py-1.5 rounded",children:O(i)},e.id)}default:return null}};return g("div",{ref:ke,className:B("relative flex flex-col h-full bg-background transition-colors duration-200 min-h-0"),children:[Ne&&a("div",{className:"absolute inset-0 bg-accent/30 border-2 border-primary z-50 pointer-events-none flex items-center justify-center p-6 text-center animate-in fade-in duration-150",children:g("div",{className:"bg-background/95 text-foreground px-4 py-3 rounded-xl border border-border/80 flex flex-col items-center gap-2 shadow-lg max-w-[80%] animate-in zoom-in-95 duration-150",children:[a($t,{className:"h-6 w-6 text-primary animate-bounce"}),a("span",{className:"text-sm font-semibold text-foreground",children:e_()})]})}),g("div",{className:"h-12 border-b border-border flex items-center justify-between px-4 flex-shrink-0 bg-background/50 backdrop-blur-sm",children:[g("div",{className:"flex items-center gap-2",children:[p&&a("button",{onClick:()=>A(!1),className:"p-1 rounded-md hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",title:fw(),children:a(Gd,{className:"h-4 w-4"})}),a($t,{className:"h-5 w-5 text-primary"}),a("span",{className:"font-semibold text-sm",children:p?B_():PR()})]}),a("div",{className:"flex items-center gap-1",children:!p?g(Y,{children:[a("button",{onClick:G,className:"p-1.5 rounded-md hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",title:s0(),children:a(Re,{className:"h-4 w-4"})}),a("button",{onClick:()=>A(!0),className:"p-1.5 rounded-md hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",title:B_(),children:a(ao,{className:"h-4 w-4"})})]}):g("button",{onClick:()=>{G(),A(!1)},className:"flex items-center gap-1 text-xs bg-primary text-primary-foreground px-2.5 py-1 rounded-md hover:bg-primary/90 transition-colors shadow-xs cursor-pointer",children:[a(Re,{className:"h-3.5 w-3.5"}),a("span",{children:s0()})]})})]}),p?a(Ie,{className:"flex-1 p-3",children:J.length===0?a("div",{className:"text-center text-xs text-muted-foreground py-8",children:aT()}):a("div",{className:"space-y-1",children:J.map((e)=>{let t=e.id===me;return g("div",{onClick:()=>{if(c)pe(c,e.id),A(!1)},className:B("group flex items-center justify-between p-2.5 rounded-lg text-xs cursor-pointer transition-all border border-transparent",t?"bg-accent/80 text-accent-foreground font-medium border-border/40":"hover:bg-muted/60 text-muted-foreground hover:text-foreground"),children:[g("div",{className:"flex flex-col min-w-0 pr-2",children:[a("span",{className:"truncate text-foreground font-medium text-xs",children:e.name||pg()}),a("span",{className:"text-[10px] text-muted-foreground",children:nn(e.updatedAt)})]}),a("button",{onClick:(i)=>{if(i.stopPropagation(),c&&window.confirm(ZE()))fe(c,e.id)},className:"opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity text-muted-foreground hover:text-destructive p-1 rounded hover:bg-muted cursor-pointer",title:LE(),children:a(Ue,{className:"h-4 w-4"})})]},e.id)})})}):g(Y,{children:[a(Ie,{ref:E,className:"flex-1 p-4 min-h-0 [&>div>div]:!block",children:h.length===0?g("div",{className:"flex flex-col items-center justify-center h-48 border-2 border-dashed border-border rounded-lg text-muted-foreground p-4 text-center",children:[a($t,{className:"h-8 w-8 mb-2 opacity-50 text-muted-foreground"}),a("p",{className:"text-sm",children:e_()})]}):g("div",{className:"space-y-4 pb-4",children:[h.map(Se),_&&h.length>0&&(h[h.length-1].role==="user"||h[h.length-1].customType==="shumai_message")&&g("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground italic",children:[a(K,{className:"h-3 w-3 animate-spin text-primary"}),a("span",{children:VM()})]}),a("div",{ref:re})]})}),a("div",{className:"p-2 flex-shrink-0 bg-background",children:a(Bi,{projectId:m,value:he,onChangeText:ve,placeholder:bO(),disabled:!T||!c,isStreaming:_,onAbort:()=>{if(c)xe(c)},allowMentions:!1,allowAttachments:!0,workspaceAssets:ce,onRemoveWorkspaceAsset:ue,allowMarkup:!0,canMarkup:!!f&&["image","video","pdf"].includes(f.proxyType||""),markupDisabledTooltip:!f?RT():yh(),allowTimestamp:f?.proxyType==="video"||f?.proxyType==="pdf",currentTime:ne,frameRate:C||f?.media?.metadata?.frameRate||30,startTimecode:V||f?.media?.metadata?.startTimecode,formatTimestamp:I||(f?.proxyType==="pdf"?(e)=>y0({page:Math.round(e)}):void 0),onTyping:le,onSendMessage:(e,t,i,r,d,s)=>{if(!c)return;ge(c,e,m,k,_e,t,i,d,s)},bottomLeftExtra:a("div",{className:"flex items-center gap-1.5 min-w-0 max-w-full",children:N.length>0?g(Xe,{value:T||"",onValueChange:(e)=>j(e),disabled:_,children:[a(tt,{className:"h-8 border-none bg-transparent hover:bg-muted text-muted-foreground hover:text-foreground focus:ring-0 focus:ring-offset-0 px-2 py-0 gap-1.5 text-xs shrink-0 select-none shadow-none max-w-full cursor-pointer",children:a(et,{placeholder:Lp()})}),a(rt,{children:N.map((e)=>a(be,{value:e.id,className:"cursor-pointer",children:g("div",{className:"flex items-center gap-2",children:[e.avatar?a("img",{src:e.avatar,alt:e.name,className:"w-4 h-4 rounded-full object-cover"}):a($t,{className:"w-4 h-4 text-muted-foreground"}),a("span",{className:"text-xs",children:e.name})]})},e.id))})]}):a("div",{className:"flex items-center gap-1.5 px-2 py-1 text-[11px] text-muted-foreground/60 italic select-none",children:a("span",{children:tT()})})})})})]}),q&&g("div",{className:"fixed inset-0 z-[100] bg-black/95 flex flex-col items-center justify-center p-4 animate-in fade-in duration-200",onClick:()=>D(null),children:[a("button",{className:"absolute top-4 right-4 text-white/70 hover:text-white hover:bg-white/20 rounded-full p-2 transition-colors z-50 cursor-pointer",children:a(Ge,{className:"w-8 h-8"})}),a("div",{className:"w-full h-full flex items-center justify-center p-2",children:a("img",{src:q.url,alt:q.name,className:"max-w-full max-h-[85vh] object-contain rounded shadow-2xl cursor-zoom-out",onClick:(e)=>{e.stopPropagation(),D(null)}})}),a("div",{className:"absolute bottom-6 text-white text-sm font-medium bg-black/50 px-4 py-2 rounded-full backdrop-blur-sm",children:q.name})]})]})}
2
+ export{va};
@@ -0,0 +1,2 @@
1
+ import{z}from"./chunk-zarz3sqn.js";var e=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Uo=z("users",e);
2
+ export{Uo};
@@ -1,2 +1,2 @@
1
- import{I}from"./chunk-p1d500sf.js";var a=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],ua=I("save",a);
2
- export{ua};
1
+ import{z}from"./chunk-zarz3sqn.js";var a=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],al=z("save",a);
2
+ export{al};