@shumai-one/shumai 0.3.9 → 0.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/bin/{chunk-q3y6kdkh.js → chunk-02tqxzgz.js} +2 -2
  2. package/bin/chunk-09c03qdg.js +2 -0
  3. package/bin/{chunk-p65avrcv.js → chunk-0fpgfrv8.js} +2 -2
  4. package/bin/{chunk-fbqr4v70.js → chunk-0hbqkcsd.js} +1 -1
  5. package/bin/{chunk-zafjhkkk.js → chunk-0qcp4v52.js} +1 -1
  6. package/bin/chunk-0te5kcy3.js +2 -0
  7. package/bin/chunk-15zbprbe.js +1 -0
  8. package/bin/{chunk-ptmxkptc.js → chunk-1ev668rp.js} +2 -2
  9. package/bin/{chunk-z7m6sa7g.js → chunk-1qd83phd.js} +1 -1
  10. package/bin/{chunk-mwrheqe3.js → chunk-1whn0v5n.js} +1 -1
  11. package/bin/{chunk-s78r8f5v.js → chunk-28axgckk.js} +1 -1
  12. package/bin/{chunk-r0c9vmfm.js → chunk-2mxqjx3x.js} +1 -1
  13. package/bin/{chunk-x6ta6e2v.js → chunk-2sk6e4q0.js} +1 -1
  14. package/bin/{chunk-awaf0g5z.js → chunk-2sp0gkaw.js} +2 -2
  15. package/bin/{chunk-fhd9yadg.js → chunk-2t2wjzme.js} +2 -2
  16. package/bin/chunk-301pewt3.js +1 -0
  17. package/bin/chunk-33hax7fe.js +66 -0
  18. package/bin/{chunk-9fc118ea.js → chunk-34f4hk54.js} +2 -2
  19. package/bin/{chunk-331s5eb9.js → chunk-39s0cxq1.js} +2 -2
  20. package/bin/{chunk-c32x8x6z.js → chunk-41de755j.js} +1 -1
  21. package/bin/{chunk-naaa5ejw.js → chunk-42et2rqa.js} +2 -2
  22. package/bin/{chunk-pfwt5734.js → chunk-42f9r1sg.js} +2 -2
  23. package/bin/chunk-484yr1a7.js +1 -0
  24. package/bin/{chunk-jx9tqjh9.js → chunk-4shqnfq1.js} +1 -1
  25. package/bin/{chunk-h7jb1xb4.js → chunk-60xawsa6.js} +2 -2
  26. package/bin/chunk-62ag2nfa.js +2 -0
  27. package/bin/chunk-63emv4q3.js +1 -0
  28. package/bin/chunk-6529sh41.js +2 -0
  29. package/bin/{chunk-4yp5add5.js → chunk-661mcdxj.js} +2 -2
  30. package/bin/{chunk-n3997tqa.js → chunk-69sf7kb1.js} +1 -1
  31. package/bin/{chunk-0kfcfd0x.js → chunk-6gx6gdnk.js} +2 -2
  32. package/bin/chunk-6w395tfy.js +2 -0
  33. package/bin/chunk-7735r8d7.js +1 -0
  34. package/bin/{chunk-tx42kfdh.js → chunk-7m07t899.js} +1 -1
  35. package/bin/{chunk-dt9wfyf2.js → chunk-7r6h3fta.js} +2 -2
  36. package/bin/{chunk-5657zj59.js → chunk-7xwmj4ew.js} +1 -1
  37. package/bin/{chunk-vf6mpxrd.js → chunk-8r2agmv2.js} +2 -2
  38. package/bin/{chunk-dntwxkyf.js → chunk-8zmk029n.js} +1 -1
  39. package/bin/{chunk-hx2y4d75.js → chunk-90jcmarf.js} +2 -2
  40. package/bin/{chunk-7wh2mr72.js → chunk-94fyesf6.js} +1 -1
  41. package/bin/chunk-94yxj3yy.js +2 -0
  42. package/bin/{chunk-zwny8t7c.js → chunk-9rhckjgf.js} +1 -1
  43. package/bin/chunk-9ykcjdsv.js +3 -0
  44. package/bin/chunk-9yn5r2hh.js +2 -0
  45. package/bin/chunk-a80aab0f.js +2 -0
  46. package/bin/{chunk-rq6bvf0t.js → chunk-ag0pavv1.js} +1 -1
  47. package/bin/{chunk-6ja68bbj.js → chunk-at5ksmqs.js} +1 -1
  48. package/bin/{chunk-11j7ejan.js → chunk-bv5mh0e0.js} +3 -3
  49. package/bin/{chunk-7w01v7bw.js → chunk-bxexm2hd.js} +3 -3
  50. package/bin/{chunk-5ex69zt3.js → chunk-cc9fftnv.js} +2 -2
  51. package/bin/{chunk-r7crhkhn.js → chunk-ch25gq27.js} +2 -2
  52. package/bin/chunk-csky7q56.js +2 -0
  53. package/bin/{chunk-z71h48pj.js → chunk-d4ktgq49.js} +1 -1
  54. package/bin/{chunk-jvn0xnj8.js → chunk-day61cfg.js} +2 -2
  55. package/bin/{chunk-03ec6p4p.js → chunk-dgvcraag.js} +2 -2
  56. package/bin/{chunk-va9hwggw.js → chunk-e26p9vrv.js} +1 -1
  57. package/bin/{chunk-f37ywvvp.js → chunk-emyax05s.js} +1 -1
  58. package/bin/{chunk-3h4t28zz.js → chunk-enq1hf8g.js} +2 -2
  59. package/bin/{chunk-mffjg6zb.js → chunk-f03whbny.js} +2 -2
  60. package/bin/{chunk-vtm39m0n.js → chunk-fk9pd7ra.js} +1 -1
  61. package/bin/{chunk-8hex1hjk.js → chunk-fscyvjzb.js} +2 -2
  62. package/bin/{chunk-nw1ch5d8.js → chunk-g2bkj92r.js} +2 -2
  63. package/bin/chunk-g5qfxnz1.js +2 -0
  64. package/bin/{chunk-5efr8prc.js → chunk-g6aq2cyq.js} +1 -1
  65. package/bin/chunk-gh6j1nsm.js +1 -0
  66. package/bin/{chunk-wjk0f9fq.js → chunk-gra1fhdp.js} +2 -2
  67. package/bin/{chunk-79wjyt2p.js → chunk-gtenq4kq.js} +1 -1
  68. package/bin/chunk-h5jre78a.js +2 -0
  69. package/bin/{chunk-wth2f791.js → chunk-hcaw54dj.js} +2 -2
  70. package/bin/{chunk-8qryr65z.js → chunk-hsemzjvr.js} +2 -2
  71. package/bin/chunk-hte6gd36.js +1 -0
  72. package/bin/{chunk-vwayy6dy.js → chunk-j6dea33m.js} +3 -3
  73. package/bin/{chunk-bdwtaj3w.js → chunk-j99cr9mz.js} +2 -2
  74. package/bin/chunk-jn805ccq.js +1 -0
  75. package/bin/{chunk-tfwtxwth.js → chunk-k2w676wz.js} +2 -2
  76. package/bin/{chunk-ej18j83b.js → chunk-k33qdrdp.js} +1 -1
  77. package/bin/chunk-kmhkhcy6.js +68 -0
  78. package/bin/chunk-kp4kn4b4.js +2 -0
  79. package/bin/{chunk-9s1fdecm.js → chunk-m3ghgqc2.js} +1 -1
  80. package/bin/chunk-m84qgdyj.js +2 -0
  81. package/bin/{chunk-jt7fdhke.js → chunk-mk5hqjjd.js} +1 -1
  82. package/bin/{chunk-p2wyyvfa.js → chunk-mnhg12fm.js} +2 -2
  83. package/bin/{chunk-nc9hbzad.js → chunk-n3vzdzdw.js} +2 -2
  84. package/bin/{chunk-a6s80m0k.js → chunk-nw03w9pa.js} +1 -1
  85. package/bin/{chunk-7a4347xe.js → chunk-p31qe5mc.js} +2 -2
  86. package/bin/chunk-p48npmbh.js +2 -0
  87. package/bin/{chunk-6ts9djn2.js → chunk-p9w4ar11.js} +1 -1
  88. package/bin/chunk-pbztc6kv.js +1 -0
  89. package/bin/{chunk-v2dksv7p.js → chunk-pg55qp08.js} +2 -2
  90. package/bin/{chunk-agvb6bpw.js → chunk-pv4scagf.js} +1 -1
  91. package/bin/chunk-q0hrd0yw.js +2 -0
  92. package/bin/{chunk-wy82m4nq.js → chunk-qev7trtm.js} +2 -2
  93. package/bin/chunk-qk9npww4.js +2 -0
  94. package/bin/{chunk-zq665ybs.js → chunk-qphebjbv.js} +1 -1
  95. package/bin/{chunk-qp1hkx9k.js → chunk-rakz3pe6.js} +2 -2
  96. package/bin/chunk-rjga1vn2.js +2 -0
  97. package/bin/chunk-rt8yqz51.js +1 -0
  98. package/bin/chunk-s542e1y0.js +1 -0
  99. package/bin/{chunk-0rydta2q.js → chunk-s6e91ky2.js} +1 -1
  100. package/bin/{chunk-w4e52ade.js → chunk-s9s9hhet.js} +1 -1
  101. package/bin/{chunk-39j992fb.js → chunk-s9yzt7s3.js} +2 -2
  102. package/bin/chunk-sjsn35mp.js +1 -0
  103. package/bin/{chunk-0x6zt5yg.js → chunk-stggq92k.js} +1 -1
  104. package/bin/{chunk-zvq0btde.js → chunk-t16qt2ka.js} +3 -3
  105. package/bin/chunk-tc5evq8x.js +2 -0
  106. package/bin/chunk-tjrdsmdw.js +1 -0
  107. package/bin/{chunk-tk362keq.js → chunk-tkh0s7hg.js} +2 -2
  108. package/bin/{chunk-nn753fbs.js → chunk-tsym31yb.js} +2 -2
  109. package/bin/{chunk-a2m63585.js → chunk-v1ybpqrz.js} +1 -1
  110. package/bin/chunk-vbkwteh4.js +1 -0
  111. package/bin/chunk-vevscfh2.js +2 -0
  112. package/bin/chunk-vg33qt6z.js +11 -0
  113. package/bin/{chunk-wzw7rrfy.js → chunk-vgwjg37a.js} +2 -2
  114. package/bin/chunk-vwz2pa54.js +2 -0
  115. package/bin/chunk-we3vdyhb.js +1 -0
  116. package/bin/chunk-whn6dvak.js +1 -0
  117. package/bin/{chunk-j4byth37.js → chunk-wwjqqqr4.js} +1 -1
  118. package/bin/{chunk-mv4v52ah.js → chunk-xext4yvc.js} +1 -1
  119. package/bin/chunk-xr1wr22v.css +1 -0
  120. package/bin/chunk-xvpttxen.js +7 -0
  121. package/bin/chunk-y45tzhdn.js +2 -0
  122. package/bin/{chunk-c4yr75hy.js → chunk-y5ptk39s.js} +2 -2
  123. package/bin/{chunk-ytgtf0ak.js → chunk-y7b5gy17.js} +1 -1
  124. package/bin/{chunk-zcxajg6j.js → chunk-y8ffp5zj.js} +2 -2
  125. package/bin/chunk-yfgwknpa.js +78 -0
  126. package/bin/{chunk-yvknqnkb.js → chunk-z7b132c0.js} +2 -2
  127. package/bin/{chunk-v5c6t1w3.js → chunk-zdmcc6ps.js} +2 -2
  128. package/bin/shumai-app.html +1 -1
  129. package/bin/shumai-app.js +485 -291
  130. package/package.json +7 -7
  131. package/prisma/migrations/20260819091331_add_kanban_schema/migration.sql +164 -0
  132. package/prisma/migrations/20260821102514_add_kanban_notifications/migration.sql +26 -0
  133. package/prisma/migrations/20260821133500_add_c_collation_to_kanban_sort_index/migration.sql +10 -0
  134. package/prisma/migrations/20260822020609_add_kanban_task_assets/migration.sql +17 -0
  135. package/prisma/migrations/20260822071734_remove_kanban_task_cancelled_status/migration.sql +28 -0
  136. package/prisma/schema.prisma +187 -0
  137. package/bin/chunk-0h1yw3eq.js +0 -1
  138. package/bin/chunk-1eqdvehm.js +0 -2
  139. package/bin/chunk-2ckj039r.js +0 -2
  140. package/bin/chunk-2wcfw38x.js +0 -1
  141. package/bin/chunk-4st1t79p.js +0 -2
  142. package/bin/chunk-5ctpz542.js +0 -78
  143. package/bin/chunk-7t9c532y.js +0 -1
  144. package/bin/chunk-7zvv37z0.js +0 -7
  145. package/bin/chunk-9vjkb4vh.js +0 -1
  146. package/bin/chunk-ar79dg9g.js +0 -2
  147. package/bin/chunk-b0kh9jpt.js +0 -1
  148. package/bin/chunk-d5v9nz51.js +0 -1
  149. package/bin/chunk-ddt5224b.js +0 -2
  150. package/bin/chunk-eekmnfn4.js +0 -2
  151. package/bin/chunk-ff8zrme6.js +0 -1
  152. package/bin/chunk-g2qeb32y.js +0 -2
  153. package/bin/chunk-gtqchcj0.js +0 -2
  154. package/bin/chunk-hdx9q31r.js +0 -1
  155. package/bin/chunk-hk5pwxhf.js +0 -2
  156. package/bin/chunk-jkpxykx9.css +0 -1
  157. package/bin/chunk-jq28ge97.js +0 -1
  158. package/bin/chunk-n3e4agsa.js +0 -2
  159. package/bin/chunk-ppwy5dja.js +0 -1
  160. package/bin/chunk-px660tvj.js +0 -2
  161. package/bin/chunk-qbs0nvbn.js +0 -3
  162. package/bin/chunk-qt6j0fm6.js +0 -65
  163. package/bin/chunk-t6gqzden.js +0 -1
  164. package/bin/chunk-tn24as5d.js +0 -2
  165. package/bin/chunk-v2n1hwt3.js +0 -1
  166. package/bin/chunk-vhcsdnzv.js +0 -2
  167. package/bin/chunk-wk153p7c.js +0 -1
  168. package/bin/chunk-y8wj6g7y.js +0 -11
  169. package/bin/chunk-ympx92ct.js +0 -1
  170. package/bin/chunk-yx6mahz0.js +0 -1
  171. package/bin/chunk-z8s40zfa.js +0 -68
@@ -1,10 +1,10 @@
1
1
  // @bun
2
- import{nm as I8,om as b,sm as a}from"./chunk-j4byth37.js";var gZ=b((tU,fZ)=>{function O0(Z,$){if(typeof $==="boolean")$={forever:$};if(this._originalTimeouts=JSON.parse(JSON.stringify(Z)),this._timeouts=Z,this._options=$||{},this._maxRetryTime=$&&$.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever)this._cachedTimeouts=this._timeouts.slice(0)}fZ.exports=O0;O0.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};O0.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);if(this._timer)clearTimeout(this._timer);this._timeouts=[],this._cachedTimeouts=null};O0.prototype.retry=function(Z){if(this._timeout)clearTimeout(this._timeout);if(!Z)return!1;var $=new Date().getTime();if(Z&&$-this._operationStart>=this._maxRetryTime)return this._errors.push(Z),this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(Z);var Q=this._timeouts.shift();if(Q===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),Q=this._cachedTimeouts.slice(-1);else return!1;var Y=this;if(this._timer=setTimeout(function(){if(Y._attempts++,Y._operationTimeoutCb){if(Y._timeout=setTimeout(function(){Y._operationTimeoutCb(Y._attempts)},Y._operationTimeout),Y._options.unref)Y._timeout.unref()}Y._fn(Y._attempts)},Q),this._options.unref)this._timer.unref();return!0};O0.prototype.attempt=function(Z,$){if(this._fn=Z,$){if($.timeout)this._operationTimeout=$.timeout;if($.cb)this._operationTimeoutCb=$.cb}var Q=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){Q._operationTimeoutCb()},Q._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};O0.prototype.try=function(Z){console.log("Using RetryOperation.try() is deprecated"),this.attempt(Z)};O0.prototype.start=function(Z){console.log("Using RetryOperation.start() is deprecated"),this.attempt(Z)};O0.prototype.start=O0.prototype.try;O0.prototype.errors=function(){return this._errors};O0.prototype.attempts=function(){return this._attempts};O0.prototype.mainError=function(){if(this._errors.length===0)return null;var Z={},$=null,Q=0;for(var Y=0;Y<this._errors.length;Y++){var W=this._errors[Y],J=W.message,K=(Z[J]||0)+1;if(Z[J]=K,K>=Q)$=W,Q=K}return $}});var mZ=b((kJ)=>{var hJ=gZ();kJ.operation=function(Z){var $=kJ.timeouts(Z);return new hJ($,{forever:Z&&(Z.forever||Z.retries===1/0),unref:Z&&Z.unref,maxRetryTime:Z&&Z.maxRetryTime})};kJ.timeouts=function(Z){if(Z instanceof Array)return[].concat(Z);var $={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var Q in Z)$[Q]=Z[Q];if($.minTimeout>$.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var Y=[];for(var W=0;W<$.retries;W++)Y.push(this.createTimeout(W,$));if(Z&&Z.forever&&!Y.length)Y.push(this.createTimeout(W,$));return Y.sort(function(J,K){return J-K}),Y};kJ.createTimeout=function(Z,$){var Q=$.randomize?Math.random()+1:1,Y=Math.round(Q*Math.max($.minTimeout,1)*Math.pow($.factor,Z));return Y=Math.min(Y,$.maxTimeout),Y};kJ.wrap=function(Z,$,Q){if($ instanceof Array)Q=$,$=null;if(!Q){Q=[];for(var Y in Z)if(typeof Z[Y]==="function")Q.push(Y)}for(var W=0;W<Q.length;W++){var J=Q[W],K=Z[J];Z[J]=function(H){var w=kJ.operation($),F=Array.prototype.slice.call(arguments,1),z=F.pop();F.push(function(G){if(w.retry(G))return;if(G)arguments[0]=w.mainError();z.apply(this,arguments)}),w.attempt(function(){H.apply(Z,F)})}.bind(Z,K),Z[J].options=$}}});var dZ=b((ZD,H1)=>{var gJ=mZ(),bJ=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"];class z8 extends Error{constructor(Z){super();if(Z instanceof Error)this.originalError=Z,{message:Z}=Z;else this.originalError=Error(Z),this.originalError.stack=this.stack;this.name="AbortError",this.message=Z}}var mJ=(Z,$,Q)=>{let Y=Q.retries-($-1);return Z.attemptNumber=$,Z.retriesLeft=Y,Z},uJ=(Z)=>bJ.includes(Z),uZ=(Z,$)=>new Promise((Q,Y)=>{$={onFailedAttempt:()=>{},retries:10,...$};let W=gJ.operation($);W.attempt(async(J)=>{try{Q(await Z(J))}catch(K){if(!(K instanceof Error)){Y(TypeError(`Non-error was thrown: "${K}". You should only throw errors.`));return}if(K instanceof z8)W.stop(),Y(K.originalError);else if(K instanceof TypeError&&!uJ(K.message))W.stop(),Y(K);else{mJ(K,J,$);try{await $.onFailedAttempt(K)}catch(q){Y(q);return}if(!W.retry(K))Y(W.mainError())}}})});H1.exports=uZ;H1.exports.default=uZ;H1.exports.AbortError=z8});var F8=b(($D,sZ)=>{var w1=Object.prototype.hasOwnProperty,rZ=Object.prototype.toString,lZ=Object.defineProperty,cZ=Object.getOwnPropertyDescriptor,pZ=function($){if(typeof Array.isArray==="function")return Array.isArray($);return rZ.call($)==="[object Array]"},iZ=function($){if(!$||rZ.call($)!=="[object Object]")return!1;var Q=w1.call($,"constructor"),Y=$.constructor&&$.constructor.prototype&&w1.call($.constructor.prototype,"isPrototypeOf");if($.constructor&&!Q&&!Y)return!1;var W;for(W in $);return typeof W>"u"||w1.call($,W)},aZ=function($,Q){if(lZ&&Q.name==="__proto__")lZ($,Q.name,{enumerable:!0,configurable:!0,value:Q.newValue,writable:!0});else $[Q.name]=Q.newValue},nZ=function($,Q){if(Q==="__proto__"){if(!w1.call($,Q))return;else if(cZ)return cZ($,Q).value}return $[Q]};sZ.exports=function Z(){var $,Q,Y,W,J,K,q=arguments[0],H=1,w=arguments.length,F=!1;if(typeof q==="boolean")F=q,q=arguments[1]||{},H=2;if(q==null||typeof q!=="object"&&typeof q!=="function")q={};for(;H<w;++H)if($=arguments[H],$!=null){for(Q in $)if(Y=nZ(q,Q),W=nZ($,Q),q!==W){if(F&&W&&(iZ(W)||(J=pZ(W)))){if(J)J=!1,K=Y&&pZ(Y)?Y:[];else K=Y&&iZ(Y)?Y:{};aZ(q,{name:Q,newValue:Z(F,K,W)})}else if(typeof W<"u")aZ(q,{name:Q,newValue:W})}}return q}});var oZ=b((QD,dJ)=>{dJ.exports={name:"gaxios",version:"7.1.4",description:"A simple common HTTP client specifically for Google APIs and services.",main:"build/cjs/src/index.js",types:"build/cjs/src/index.d.ts",files:["build/"],exports:{".":{import:{types:"./build/esm/src/index.d.ts",default:"./build/esm/src/index.js"},require:{types:"./build/cjs/src/index.d.ts",default:"./build/cjs/src/index.js"}}},scripts:{lint:"gts check --no-inline-config",test:"c8 mocha build/esm/test","presystem-test":"npm run compile","system-test":"mocha build/esm/system-test --timeout 80000",compile:"tsc -b ./tsconfig.json ./tsconfig.cjs.json && node utils/enable-esm.mjs",fix:"gts fix",prepare:"npm run compile",pretest:"npm run compile",webpack:"webpack","prebrowser-test":"npm run compile","browser-test":"node build/browser-test/browser-test-runner.js",docs:"jsdoc -c .jsdoc.js","docs-test":"linkinator docs","predocs-test":"npm run docs","samples-test":"cd samples/ && npm link ../ && npm test && cd ../",prelint:"cd samples; npm link ../; npm install",clean:"gts clean"},repository:{type:"git",directory:"packages/gaxios",url:"https://github.com/googleapis/google-cloud-node-core.git"},keywords:["google"],engines:{node:">=18"},author:"Google, LLC",license:"Apache-2.0",devDependencies:{"@babel/plugin-proposal-private-methods":"^7.18.6","@types/cors":"^2.8.6","@types/express":"^5.0.0","@types/extend":"^3.0.1","@types/mocha":"^10.0.10","@types/multiparty":"4.2.1","@types/mv":"^2.1.0","@types/ncp":"^2.0.8","@types/node":"^22.13.1","@types/sinon":"^17.0.3","@types/tmp":"^0.2.6",assert:"^2.0.0",browserify:"^17.0.0",c8:"^10.1.3",cors:"^2.8.5",express:"^5.0.0",gts:"^6.0.2","is-docker":"^3.0.0",jsdoc:"^4.0.4","jsdoc-fresh":"^5.0.0","jsdoc-region-tag":"^4.0.0",karma:"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-remap-coverage":"^0.1.5","karma-sourcemap-loader":"^0.4.0","karma-webpack":"^5.0.1",linkinator:"^6.1.2",mocha:"^11.1.0",multiparty:"^4.2.1",mv:"^2.1.1",ncp:"^2.0.0",nock:"^14.0.5","null-loader":"^4.0.1","pack-n-play":"^4.0.0",puppeteer:"^24.0.0",sinon:"^21.0.0","stream-browserify":"^3.0.0",tmp:"0.2.5","ts-loader":"^9.5.2",typescript:"5.8.3",webpack:"^5.97.1","webpack-cli":"^6.0.1"},dependencies:{extend:"^3.0.2","https-proxy-agent":"^7.0.1","node-fetch":"^3.3.2"},homepage:"https://github.com/googleapis/google-cloud-node-core/tree/main/packages/gaxios"}});var eZ=b((YD,tZ)=>{var lJ=oZ();tZ.exports={pkg:lJ}});var D8=b((j0)=>{var $$=j0&&j0.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(j0,"__esModule",{value:!0});j0.GaxiosError=j0.GAXIOS_ERROR_SYMBOL=void 0;j0.defaultErrorRedactor=Q$;var Z$=$$(F8()),cJ=$$(eZ()),G8=cJ.default.pkg;j0.GAXIOS_ERROR_SYMBOL=Symbol.for(`${G8.name}-gaxios-error`);class U8 extends Error{config;response;code;status;error;[j0.GAXIOS_ERROR_SYMBOL]=G8.version;static[Symbol.hasInstance](Z){if(Z&&typeof Z==="object"&&j0.GAXIOS_ERROR_SYMBOL in Z&&Z[j0.GAXIOS_ERROR_SYMBOL]===G8.version)return!0;return Function.prototype[Symbol.hasInstance].call(U8,Z)}constructor(Z,$,Q,Y){super(Z,{cause:Y});if(this.config=$,this.response=Q,this.error=Y instanceof Error?Y:void 0,this.config=(0,Z$.default)(!0,{},$),this.response)this.response.config=(0,Z$.default)(!0,{},this.response.config);if(this.response){try{this.response.data=pJ(this.config.responseType,this.response?.bodyUsed?this.response?.data:void 0)}catch{}this.status=this.response.status}if(Y instanceof DOMException)this.code=Y.name;else if(Y&&typeof Y==="object"&&"code"in Y&&(typeof Y.code==="string"||typeof Y.code==="number"))this.code=Y.code}static extractAPIErrorFromResponse(Z,$="The request failed"){let Q=$;if(typeof Z.data==="string")Q=Z.data;if(Z.data&&typeof Z.data==="object"&&"error"in Z.data&&Z.data.error&&!Z.ok){if(typeof Z.data.error==="string")return{message:Z.data.error,code:Z.status,status:Z.statusText};if(typeof Z.data.error==="object"){Q="message"in Z.data.error&&typeof Z.data.error.message==="string"?Z.data.error.message:Q;let Y="status"in Z.data.error&&typeof Z.data.error.status==="string"?Z.data.error.status:Z.statusText,W="code"in Z.data.error&&typeof Z.data.error.code==="number"?Z.data.error.code:Z.status;if("errors"in Z.data.error&&Array.isArray(Z.data.error.errors)){let J=[];for(let K of Z.data.error.errors)if(typeof K==="object"&&"message"in K&&typeof K.message==="string")J.push(K.message);return Object.assign({message:J.join(`
2
+ import{Mm as I8,Nm as b,Rm as a}from"./chunk-wwjqqqr4.js";var gZ=b((tU,fZ)=>{function O0(Z,$){if(typeof $==="boolean")$={forever:$};if(this._originalTimeouts=JSON.parse(JSON.stringify(Z)),this._timeouts=Z,this._options=$||{},this._maxRetryTime=$&&$.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever)this._cachedTimeouts=this._timeouts.slice(0)}fZ.exports=O0;O0.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};O0.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);if(this._timer)clearTimeout(this._timer);this._timeouts=[],this._cachedTimeouts=null};O0.prototype.retry=function(Z){if(this._timeout)clearTimeout(this._timeout);if(!Z)return!1;var $=new Date().getTime();if(Z&&$-this._operationStart>=this._maxRetryTime)return this._errors.push(Z),this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(Z);var Q=this._timeouts.shift();if(Q===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),Q=this._cachedTimeouts.slice(-1);else return!1;var Y=this;if(this._timer=setTimeout(function(){if(Y._attempts++,Y._operationTimeoutCb){if(Y._timeout=setTimeout(function(){Y._operationTimeoutCb(Y._attempts)},Y._operationTimeout),Y._options.unref)Y._timeout.unref()}Y._fn(Y._attempts)},Q),this._options.unref)this._timer.unref();return!0};O0.prototype.attempt=function(Z,$){if(this._fn=Z,$){if($.timeout)this._operationTimeout=$.timeout;if($.cb)this._operationTimeoutCb=$.cb}var Q=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){Q._operationTimeoutCb()},Q._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};O0.prototype.try=function(Z){console.log("Using RetryOperation.try() is deprecated"),this.attempt(Z)};O0.prototype.start=function(Z){console.log("Using RetryOperation.start() is deprecated"),this.attempt(Z)};O0.prototype.start=O0.prototype.try;O0.prototype.errors=function(){return this._errors};O0.prototype.attempts=function(){return this._attempts};O0.prototype.mainError=function(){if(this._errors.length===0)return null;var Z={},$=null,Q=0;for(var Y=0;Y<this._errors.length;Y++){var W=this._errors[Y],J=W.message,K=(Z[J]||0)+1;if(Z[J]=K,K>=Q)$=W,Q=K}return $}});var mZ=b((kJ)=>{var hJ=gZ();kJ.operation=function(Z){var $=kJ.timeouts(Z);return new hJ($,{forever:Z&&(Z.forever||Z.retries===1/0),unref:Z&&Z.unref,maxRetryTime:Z&&Z.maxRetryTime})};kJ.timeouts=function(Z){if(Z instanceof Array)return[].concat(Z);var $={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var Q in Z)$[Q]=Z[Q];if($.minTimeout>$.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var Y=[];for(var W=0;W<$.retries;W++)Y.push(this.createTimeout(W,$));if(Z&&Z.forever&&!Y.length)Y.push(this.createTimeout(W,$));return Y.sort(function(J,K){return J-K}),Y};kJ.createTimeout=function(Z,$){var Q=$.randomize?Math.random()+1:1,Y=Math.round(Q*Math.max($.minTimeout,1)*Math.pow($.factor,Z));return Y=Math.min(Y,$.maxTimeout),Y};kJ.wrap=function(Z,$,Q){if($ instanceof Array)Q=$,$=null;if(!Q){Q=[];for(var Y in Z)if(typeof Z[Y]==="function")Q.push(Y)}for(var W=0;W<Q.length;W++){var J=Q[W],K=Z[J];Z[J]=function(H){var w=kJ.operation($),F=Array.prototype.slice.call(arguments,1),z=F.pop();F.push(function(G){if(w.retry(G))return;if(G)arguments[0]=w.mainError();z.apply(this,arguments)}),w.attempt(function(){H.apply(Z,F)})}.bind(Z,K),Z[J].options=$}}});var dZ=b((ZD,H1)=>{var gJ=mZ(),bJ=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"];class z8 extends Error{constructor(Z){super();if(Z instanceof Error)this.originalError=Z,{message:Z}=Z;else this.originalError=Error(Z),this.originalError.stack=this.stack;this.name="AbortError",this.message=Z}}var mJ=(Z,$,Q)=>{let Y=Q.retries-($-1);return Z.attemptNumber=$,Z.retriesLeft=Y,Z},uJ=(Z)=>bJ.includes(Z),uZ=(Z,$)=>new Promise((Q,Y)=>{$={onFailedAttempt:()=>{},retries:10,...$};let W=gJ.operation($);W.attempt(async(J)=>{try{Q(await Z(J))}catch(K){if(!(K instanceof Error)){Y(TypeError(`Non-error was thrown: "${K}". You should only throw errors.`));return}if(K instanceof z8)W.stop(),Y(K.originalError);else if(K instanceof TypeError&&!uJ(K.message))W.stop(),Y(K);else{mJ(K,J,$);try{await $.onFailedAttempt(K)}catch(q){Y(q);return}if(!W.retry(K))Y(W.mainError())}}})});H1.exports=uZ;H1.exports.default=uZ;H1.exports.AbortError=z8});var F8=b(($D,sZ)=>{var w1=Object.prototype.hasOwnProperty,rZ=Object.prototype.toString,lZ=Object.defineProperty,cZ=Object.getOwnPropertyDescriptor,pZ=function($){if(typeof Array.isArray==="function")return Array.isArray($);return rZ.call($)==="[object Array]"},iZ=function($){if(!$||rZ.call($)!=="[object Object]")return!1;var Q=w1.call($,"constructor"),Y=$.constructor&&$.constructor.prototype&&w1.call($.constructor.prototype,"isPrototypeOf");if($.constructor&&!Q&&!Y)return!1;var W;for(W in $);return typeof W>"u"||w1.call($,W)},aZ=function($,Q){if(lZ&&Q.name==="__proto__")lZ($,Q.name,{enumerable:!0,configurable:!0,value:Q.newValue,writable:!0});else $[Q.name]=Q.newValue},nZ=function($,Q){if(Q==="__proto__"){if(!w1.call($,Q))return;else if(cZ)return cZ($,Q).value}return $[Q]};sZ.exports=function Z(){var $,Q,Y,W,J,K,q=arguments[0],H=1,w=arguments.length,F=!1;if(typeof q==="boolean")F=q,q=arguments[1]||{},H=2;if(q==null||typeof q!=="object"&&typeof q!=="function")q={};for(;H<w;++H)if($=arguments[H],$!=null){for(Q in $)if(Y=nZ(q,Q),W=nZ($,Q),q!==W){if(F&&W&&(iZ(W)||(J=pZ(W)))){if(J)J=!1,K=Y&&pZ(Y)?Y:[];else K=Y&&iZ(Y)?Y:{};aZ(q,{name:Q,newValue:Z(F,K,W)})}else if(typeof W<"u")aZ(q,{name:Q,newValue:W})}}return q}});var oZ=b((QD,dJ)=>{dJ.exports={name:"gaxios",version:"7.1.4",description:"A simple common HTTP client specifically for Google APIs and services.",main:"build/cjs/src/index.js",types:"build/cjs/src/index.d.ts",files:["build/"],exports:{".":{import:{types:"./build/esm/src/index.d.ts",default:"./build/esm/src/index.js"},require:{types:"./build/cjs/src/index.d.ts",default:"./build/cjs/src/index.js"}}},scripts:{lint:"gts check --no-inline-config",test:"c8 mocha build/esm/test","presystem-test":"npm run compile","system-test":"mocha build/esm/system-test --timeout 80000",compile:"tsc -b ./tsconfig.json ./tsconfig.cjs.json && node utils/enable-esm.mjs",fix:"gts fix",prepare:"npm run compile",pretest:"npm run compile",webpack:"webpack","prebrowser-test":"npm run compile","browser-test":"node build/browser-test/browser-test-runner.js",docs:"jsdoc -c .jsdoc.js","docs-test":"linkinator docs","predocs-test":"npm run docs","samples-test":"cd samples/ && npm link ../ && npm test && cd ../",prelint:"cd samples; npm link ../; npm install",clean:"gts clean"},repository:{type:"git",directory:"packages/gaxios",url:"https://github.com/googleapis/google-cloud-node-core.git"},keywords:["google"],engines:{node:">=18"},author:"Google, LLC",license:"Apache-2.0",devDependencies:{"@babel/plugin-proposal-private-methods":"^7.18.6","@types/cors":"^2.8.6","@types/express":"^5.0.0","@types/extend":"^3.0.1","@types/mocha":"^10.0.10","@types/multiparty":"4.2.1","@types/mv":"^2.1.0","@types/ncp":"^2.0.8","@types/node":"^22.13.1","@types/sinon":"^17.0.3","@types/tmp":"^0.2.6",assert:"^2.0.0",browserify:"^17.0.0",c8:"^10.1.3",cors:"^2.8.5",express:"^5.0.0",gts:"^6.0.2","is-docker":"^3.0.0",jsdoc:"^4.0.4","jsdoc-fresh":"^5.0.0","jsdoc-region-tag":"^4.0.0",karma:"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-remap-coverage":"^0.1.5","karma-sourcemap-loader":"^0.4.0","karma-webpack":"^5.0.1",linkinator:"^6.1.2",mocha:"^11.1.0",multiparty:"^4.2.1",mv:"^2.1.1",ncp:"^2.0.0",nock:"^14.0.5","null-loader":"^4.0.1","pack-n-play":"^4.0.0",puppeteer:"^24.0.0",sinon:"^21.0.0","stream-browserify":"^3.0.0",tmp:"0.2.5","ts-loader":"^9.5.2",typescript:"5.8.3",webpack:"^5.97.1","webpack-cli":"^6.0.1"},dependencies:{extend:"^3.0.2","https-proxy-agent":"^7.0.1","node-fetch":"^3.3.2"},homepage:"https://github.com/googleapis/google-cloud-node-core/tree/main/packages/gaxios"}});var eZ=b((YD,tZ)=>{var lJ=oZ();tZ.exports={pkg:lJ}});var D8=b((j0)=>{var $$=j0&&j0.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(j0,"__esModule",{value:!0});j0.GaxiosError=j0.GAXIOS_ERROR_SYMBOL=void 0;j0.defaultErrorRedactor=Q$;var Z$=$$(F8()),cJ=$$(eZ()),G8=cJ.default.pkg;j0.GAXIOS_ERROR_SYMBOL=Symbol.for(`${G8.name}-gaxios-error`);class U8 extends Error{config;response;code;status;error;[j0.GAXIOS_ERROR_SYMBOL]=G8.version;static[Symbol.hasInstance](Z){if(Z&&typeof Z==="object"&&j0.GAXIOS_ERROR_SYMBOL in Z&&Z[j0.GAXIOS_ERROR_SYMBOL]===G8.version)return!0;return Function.prototype[Symbol.hasInstance].call(U8,Z)}constructor(Z,$,Q,Y){super(Z,{cause:Y});if(this.config=$,this.response=Q,this.error=Y instanceof Error?Y:void 0,this.config=(0,Z$.default)(!0,{},$),this.response)this.response.config=(0,Z$.default)(!0,{},this.response.config);if(this.response){try{this.response.data=pJ(this.config.responseType,this.response?.bodyUsed?this.response?.data:void 0)}catch{}this.status=this.response.status}if(Y instanceof DOMException)this.code=Y.name;else if(Y&&typeof Y==="object"&&"code"in Y&&(typeof Y.code==="string"||typeof Y.code==="number"))this.code=Y.code}static extractAPIErrorFromResponse(Z,$="The request failed"){let Q=$;if(typeof Z.data==="string")Q=Z.data;if(Z.data&&typeof Z.data==="object"&&"error"in Z.data&&Z.data.error&&!Z.ok){if(typeof Z.data.error==="string")return{message:Z.data.error,code:Z.status,status:Z.statusText};if(typeof Z.data.error==="object"){Q="message"in Z.data.error&&typeof Z.data.error.message==="string"?Z.data.error.message:Q;let Y="status"in Z.data.error&&typeof Z.data.error.status==="string"?Z.data.error.status:Z.statusText,W="code"in Z.data.error&&typeof Z.data.error.code==="number"?Z.data.error.code:Z.status;if("errors"in Z.data.error&&Array.isArray(Z.data.error.errors)){let J=[];for(let K of Z.data.error.errors)if(typeof K==="object"&&"message"in K&&typeof K.message==="string")J.push(K.message);return Object.assign({message:J.join(`
3
3
  `)||Q,code:W,status:Y},Z.data.error)}return Object.assign({message:Q,code:W,status:Y},Z.data.error)}}return{message:Q,code:Z.status,status:Z.statusText}}}j0.GaxiosError=U8;function pJ(Z,$){switch(Z){case"stream":return $;case"json":return JSON.parse(JSON.stringify($));case"arraybuffer":return JSON.parse(Buffer.from($).toString("utf8"));case"blob":return JSON.parse($.text());default:return $}}function Q$(Z){function Q(J){if(!J)return;J.forEach((K,q)=>{if(/^authentication$/i.test(q)||/^authorization$/i.test(q)||/secret/i.test(q))J.set(q,"<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.")})}function Y(J,K){if(typeof J==="object"&&J!==null&&typeof J[K]==="string"){let q=J[K];if(/grant_type=/i.test(q)||/assertion=/i.test(q)||/secret/i.test(q))J[K]="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>."}}function W(J){if(!J||typeof J!=="object")return;else if(J instanceof FormData||J instanceof URLSearchParams||"forEach"in J&&"set"in J)J.forEach((K,q)=>{if(["grant_type","assertion"].includes(q)||/secret/.test(q))J.set(q,"<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.")});else{if("grant_type"in J)J.grant_type="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.";if("assertion"in J)J.assertion="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.";if("client_secret"in J)J.client_secret="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>."}}if(Z.config){if(Q(Z.config.headers),Y(Z.config,"data"),W(Z.config.data),Y(Z.config,"body"),W(Z.config.body),Z.config.url.searchParams.has("token"))Z.config.url.searchParams.set("token","<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.");if(Z.config.url.searchParams.has("client_secret"))Z.config.url.searchParams.set("client_secret","<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.")}if(Z.response){if(Q$({config:Z.response.config}),Q(Z.response.headers),Z.response.bodyUsed)Y(Z.response,"data"),W(Z.response.data)}return Z}});var V$=b((W$)=>{Object.defineProperty(W$,"__esModule",{value:!0});W$.getRetryConfig=iJ;async function iJ(Z){let $=Y$(Z);if(!Z||!Z.config||!$&&!Z.config.retry)return{shouldRetry:!1};$=$||{},$.currentRetryAttempt=$.currentRetryAttempt||0,$.retry=$.retry===void 0||$.retry===null?3:$.retry,$.httpMethodsToRetry=$.httpMethodsToRetry||["GET","HEAD","PUT","OPTIONS","DELETE"],$.noResponseRetries=$.noResponseRetries===void 0||$.noResponseRetries===null?2:$.noResponseRetries,$.retryDelayMultiplier=$.retryDelayMultiplier?$.retryDelayMultiplier:2,$.timeOfFirstRequest=$.timeOfFirstRequest?$.timeOfFirstRequest:Date.now(),$.totalTimeout=$.totalTimeout?$.totalTimeout:Number.MAX_SAFE_INTEGER,$.maxRetryDelay=$.maxRetryDelay?$.maxRetryDelay:Number.MAX_SAFE_INTEGER;let Q=[[100,199],[408,408],[429,429],[500,599]];if($.statusCodesToRetry=$.statusCodesToRetry||Q,Z.config.retryConfig=$,!await($.shouldRetry||aJ)(Z))return{shouldRetry:!1,config:Z.config};let W=nJ($);Z.config.retryConfig.currentRetryAttempt+=1;let J=$.retryBackoff?$.retryBackoff(Z,W):new Promise((K)=>{setTimeout(K,W)});if($.onRetryAttempt)await $.onRetryAttempt(Z);return await J,{shouldRetry:!0,config:Z.config}}function aJ(Z){let $=Y$(Z);if(Z.config.signal?.aborted&&Z.code!=="TimeoutError"||Z.code==="AbortError")return!1;if(!$||$.retry===0)return!1;if(!Z.response&&($.currentRetryAttempt||0)>=$.noResponseRetries)return!1;if(!$.httpMethodsToRetry||!$.httpMethodsToRetry.includes(Z.config.method?.toUpperCase()||"GET"))return!1;if(Z.response&&Z.response.status){let Q=!1;for(let[Y,W]of $.statusCodesToRetry){let J=Z.response.status;if(J>=Y&&J<=W){Q=!0;break}}if(!Q)return!1}if($.currentRetryAttempt=$.currentRetryAttempt||0,$.currentRetryAttempt>=$.retry)return!1;return!0}function Y$(Z){if(Z&&Z.config&&Z.config.retryConfig)return Z.config.retryConfig;return}function nJ(Z){let Q=(Z.currentRetryAttempt?0:Z.retryDelay??100)+(Math.pow(Z.retryDelayMultiplier,Z.currentRetryAttempt)-1)/2*1000,Y=Z.totalTimeout-(Date.now()-Z.timeOfFirstRequest);return Math.min(Q,Y,Z.maxRetryDelay)}});var M8=b((X$)=>{Object.defineProperty(X$,"__esModule",{value:!0});X$.GaxiosInterceptorManager=void 0;class J$ extends Set{}X$.GaxiosInterceptorManager=J$});var w$=b((T4)=>{var sJ=T4&&T4.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}},N4;Object.defineProperty(T4,"__esModule",{value:!0});T4.Gaxios=void 0;var oJ=sJ(F8()),tJ=a("https"),z4=D8(),eJ=V$(),q$=a("stream"),H$=M8(),Z7=async()=>globalThis.crypto?.randomUUID()||(await import("crypto")).randomUUID(),$7=204;class N8{agentCache=new Map;defaults;interceptors;constructor(Z){this.defaults=Z||{},this.interceptors={request:new H$.GaxiosInterceptorManager,response:new H$.GaxiosInterceptorManager}}fetch(...Z){let $=Z[0],Q=Z[1],Y=void 0,W=new Headers;if(typeof $==="string")Y=new URL($);else if($ instanceof URL)Y=$;else if($&&$.url)Y=new URL($.url);if($&&typeof $==="object"&&"headers"in $)N4.mergeHeaders(W,$.headers);if(Q)N4.mergeHeaders(W,new Headers(Q.headers));if(typeof $==="object"&&!($ instanceof URL))return this.request({...Q,...$,headers:W,url:Y});else return this.request({...Q,headers:W,url:Y})}async request(Z={}){let $=await this.#Y(Z);return $=await this.#$($),this.#Q(this._request($))}async _defaultAdapter(Z){let $=Z.fetchImplementation||this.defaults.fetchImplementation||await N4.#K(),Q={...Z};delete Q.data;let Y=await $(Z.url,Q),W=await this.getResponseData(Z,Y);if(!Object.getOwnPropertyDescriptor(Y,"data")?.configurable)Object.defineProperties(Y,{data:{configurable:!0,writable:!0,enumerable:!0,value:W}});return Object.assign(Y,{config:Z,data:W})}async _request(Z){try{let $;if(Z.adapter)$=await Z.adapter(Z,this._defaultAdapter.bind(this));else $=await this._defaultAdapter(Z);if(!Z.validateStatus($.status)){if(Z.responseType==="stream"){let Y=[];for await(let W of $.data)Y.push(W);$.data=Y.toString()}let Q=z4.GaxiosError.extractAPIErrorFromResponse($,`Request failed with status code ${$.status}`);throw new z4.GaxiosError(Q?.message,Z,$,Q)}return $}catch($){let Q;if($ instanceof z4.GaxiosError)Q=$;else if($ instanceof Error)Q=new z4.GaxiosError($.message,Z,void 0,$);else Q=new z4.GaxiosError("Unexpected Gaxios Error",Z,void 0,$);let{shouldRetry:Y,config:W}=await(0,eJ.getRetryConfig)(Q);if(Y&&W)return Q.config.retryConfig.currentRetryAttempt=W.retryConfig.currentRetryAttempt,Z.retryConfig=Q.config?.retryConfig,this.#W(Z),this._request(Z);if(Z.errorRedactor)Z.errorRedactor(Q);throw Q}}async getResponseData(Z,$){if($.status===$7)return"";if(Z.maxContentLength&&$.headers.has("content-length")&&Z.maxContentLength<Number.parseInt($.headers?.get("content-length")||""))throw new z4.GaxiosError("Response's `Content-Length` is over the limit.",Z,Object.assign($,{config:Z}));switch(Z.responseType){case"stream":return $.body;case"json":{let Q=await $.text();try{return JSON.parse(Q)}catch{return Q}}case"arraybuffer":return $.arrayBuffer();case"blob":return $.blob();case"text":return $.text();default:return this.getResponseDataFromContentType($)}}#Z(Z,$=[]){let Q=new URL(Z),Y=[...$],W=(process.env.NO_PROXY??process.env.no_proxy)?.split(",")||[];for(let J of W)Y.push(J.trim());for(let J of Y)if(J instanceof RegExp){if(J.test(Q.toString()))return!1}else if(J instanceof URL){if(J.origin===Q.origin)return!1}else if(J.startsWith("*.")||J.startsWith(".")){let K=J.replace(/^\*\./,".");if(Q.hostname.endsWith(K))return!1}else if(J===Q.origin||J===Q.hostname||J===Q.href)return!1;return!0}async#$(Z){let $=Promise.resolve(Z);for(let Q of this.interceptors.request.values())if(Q)$=$.then(Q.resolved,Q.rejected);return $}async#Q(Z){let $=Promise.resolve(Z);for(let Q of this.interceptors.response.values())if(Q)$=$.then(Q.resolved,Q.rejected);return $}async#Y(Z){let $=new Headers(this.defaults.headers);N4.mergeHeaders($,Z.headers);let Q=(0,oJ.default)(!0,{},this.defaults,Z);if(!Q.url)throw Error("URL is required.");if(Q.baseURL)Q.url=new URL(Q.url,Q.baseURL);if(Q.url=new URL(Q.url),Q.params)if(Q.paramsSerializer){let J=Q.paramsSerializer(Q.params);if(J.startsWith("?"))J=J.slice(1);let K=Q.url.toString().includes("?")?"&":"?";Q.url=Q.url+K+J}else{let J=Q.url instanceof URL?Q.url:new URL(Q.url);for(let[K,q]of new URLSearchParams(Q.params))J.searchParams.append(K,q);Q.url=J}if(typeof Z.maxContentLength==="number")Q.size=Z.maxContentLength;if(typeof Z.maxRedirects==="number")Q.follow=Z.maxRedirects;let Y=typeof Q.data==="string"||Q.data instanceof ArrayBuffer||Q.data instanceof Blob||globalThis.File&&Q.data instanceof File||Q.data instanceof FormData||Q.data instanceof q$.Readable||Q.data instanceof ReadableStream||Q.data instanceof String||Q.data instanceof URLSearchParams||ArrayBuffer.isView(Q.data)||["Blob","File","FormData"].includes(Q.data?.constructor?.name||"");if(Q.multipart?.length){let J=await Z7();$.set("content-type",`multipart/related; boundary=${J}`),Q.body=q$.Readable.from(this.getMultipartRequest(Q.multipart,J))}else if(Y)Q.body=Q.data;else if(typeof Q.data==="object")if($.get("Content-Type")==="application/x-www-form-urlencoded")Q.body=Q.paramsSerializer?Q.paramsSerializer(Q.data):new URLSearchParams(Q.data);else{if(!$.has("content-type"))$.set("content-type","application/json");Q.body=JSON.stringify(Q.data)}else if(Q.data)Q.body=Q.data;if(Q.validateStatus=Q.validateStatus||this.validateStatus,Q.responseType=Q.responseType||"unknown",!$.has("accept")&&Q.responseType==="json")$.set("accept","application/json");let W=Q.proxy||process?.env?.HTTPS_PROXY||process?.env?.https_proxy||process?.env?.HTTP_PROXY||process?.env?.http_proxy;if(Q.agent);else if(W&&this.#Z(Q.url,Q.noProxy)){let J=await N4.#X();if(this.agentCache.has(W))Q.agent=this.agentCache.get(W);else Q.agent=new J(W,{cert:Q.cert,key:Q.key}),this.agentCache.set(W,Q.agent)}else if(Q.cert&&Q.key)if(this.agentCache.has(Q.key))Q.agent=this.agentCache.get(Q.key);else Q.agent=new tJ.Agent({cert:Q.cert,key:Q.key}),this.agentCache.set(Q.key,Q.agent);if(typeof Q.errorRedactor!=="function"&&Q.errorRedactor!==!1)Q.errorRedactor=z4.defaultErrorRedactor;if(Q.body&&!("duplex"in Q))Q.duplex="half";return this.#W(Q),Object.assign(Q,{headers:$,url:Q.url instanceof URL?Q.url:new URL(Q.url)})}#W(Z){if(Z.timeout){let $=AbortSignal.timeout(Z.timeout);if(Z.signal&&!Z.signal.aborted)Z.signal=AbortSignal.any([Z.signal,$]);else Z.signal=$}}validateStatus(Z){return Z>=200&&Z<300}async getResponseDataFromContentType(Z){let $=Z.headers.get("Content-Type");if($===null)return Z.text();if($=$.toLowerCase(),$.includes("application/json")){let Q=await Z.text();try{Q=JSON.parse(Q)}catch{}return Q}else if($.match(/^text\//))return Z.text();else return Z.blob()}async*getMultipartRequest(Z,$){let Q=`--${$}--`;for(let Y of Z){let W=Y.headers.get("Content-Type")||"application/octet-stream";if(yield`--${$}\r
4
4
  Content-Type: ${W}\r
5
5
  \r
6
6
  `,typeof Y.content==="string")yield Y.content;else yield*Y.content;yield`\r
7
- `}yield Q}static#V;static#J;static async#X(){return this.#V||=(await import("./chunk-f37ywvvp.js").then((m)=>I8(m.default))).HttpsProxyAgent,this.#V}static async#K(){let Z=typeof window<"u"&&!!window;return this.#J||=Z?window.fetch:(await import("node-fetch")).default,this.#J}static mergeHeaders(Z,...$){Z=Z instanceof Headers?Z:new Headers(Z);for(let Q of $)(Q instanceof Headers?Q:new Headers(Q)).forEach((W,J)=>{J==="set-cookie"?Z.append(J,W):Z.set(J,W)});return Z}}T4.Gaxios=N8;N4=N8});var G0=b((I0)=>{var Q7=I0&&I0.__createBinding||(Object.create?function(Z,$,Q,Y){if(Y===void 0)Y=Q;var W=Object.getOwnPropertyDescriptor($,Q);if(!W||("get"in W?!$.__esModule:W.writable||W.configurable))W={enumerable:!0,get:function(){return $[Q]}};Object.defineProperty(Z,Y,W)}:function(Z,$,Q,Y){if(Y===void 0)Y=Q;Z[Y]=$[Q]}),Y7=I0&&I0.__exportStar||function(Z,$){for(var Q in Z)if(Q!=="default"&&!Object.prototype.hasOwnProperty.call($,Q))Q7($,Z,Q)};Object.defineProperty(I0,"__esModule",{value:!0});I0.instance=I0.Gaxios=I0.GaxiosError=void 0;I0.request=V7;var z$=w$();Object.defineProperty(I0,"Gaxios",{enumerable:!0,get:function(){return z$.Gaxios}});var W7=D8();Object.defineProperty(I0,"GaxiosError",{enumerable:!0,get:function(){return W7.GaxiosError}});Y7(M8(),I0);I0.instance=new z$.Gaxios;async function V7(Z){return I0.instance.request(Z)}});var T8=b((F$,z1)=>{(function(Z){var $,Q=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Y=Math.ceil,W=Math.floor,J="[BigNumber Error] ",K=J+"Number primitive has more than 15 significant digits: ",q=100000000000000,H=14,w=9007199254740991,F=[1,10,100,1000,1e4,1e5,1e6,1e7,1e8,1e9,10000000000,100000000000,1000000000000,10000000000000],z=1e7,G=1e9;function D(f){var S,d,h,_=g.prototype={constructor:g,toString:null,valueOf:null},n=new g(1),o=20,t=4,J0=-7,$0=21,V0=-1e7,q0=1e7,L0=!1,R0=1,H0=0,H4={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},w4="0123456789abcdefghijklmnopqrstuvwxyz",X8=!0;function g(U,M){var N,v,L,A,j,B,R,E,C=this;if(!(C instanceof g))return new g(U,M);if(M==null){if(U&&U._isBigNumber===!0){if(C.s=U.s,!U.c||U.e>q0)C.c=C.e=null;else if(U.e<V0)C.c=[C.e=0];else C.e=U.e,C.c=U.c.slice();return}if((B=typeof U=="number")&&U*0==0){if(C.s=1/U<0?(U=-U,-1):1,U===~~U){for(A=0,j=U;j>=10;j/=10,A++);if(A>q0)C.c=C.e=null;else C.e=A,C.c=[U];return}E=String(U)}else{if(!Q.test(E=String(U)))return h(C,E,B);C.s=E.charCodeAt(0)==45?(E=E.slice(1),-1):1}if((A=E.indexOf("."))>-1)E=E.replace(".","");if((j=E.search(/e/i))>0){if(A<0)A=j;A+=+E.slice(j+1),E=E.substring(0,j)}else if(A<0)A=E.length}else{if(O(M,2,w4.length,"Base"),M==10&&X8)return C=new g(U),v0(C,o+C.e+1,t);if(E=String(U),B=typeof U=="number"){if(U*0!=0)return h(C,E,B,M);if(C.s=1/U<0?(E=E.slice(1),-1):1,g.DEBUG&&E.replace(/^0\.0*|\./,"").length>15)throw Error(K+U)}else C.s=E.charCodeAt(0)===45?(E=E.slice(1),-1):1;N=w4.slice(0,M),A=j=0;for(R=E.length;j<R;j++)if(N.indexOf(v=E.charAt(j))<0){if(v=="."){if(j>A){A=R;continue}}else if(!L){if(E==E.toUpperCase()&&(E=E.toLowerCase())||E==E.toLowerCase()&&(E=E.toUpperCase())){L=!0,j=-1,A=0;continue}}return h(C,String(U),B,M)}if(B=!1,E=d(E,M,10,C.s),(A=E.indexOf("."))>-1)E=E.replace(".","");else A=E.length}for(j=0;E.charCodeAt(j)===48;j++);for(R=E.length;E.charCodeAt(--R)===48;);if(E=E.slice(j,++R)){if(R-=j,B&&g.DEBUG&&R>15&&(U>w||U!==W(U)))throw Error(K+C.s*U);if((A=A-j-1)>q0)C.c=C.e=null;else if(A<V0)C.c=[C.e=0];else{if(C.e=A,C.c=[],j=(A+1)%H,A<0)j+=H;if(j<R){if(j)C.c.push(+E.slice(0,j));for(R-=H;j<R;)C.c.push(+E.slice(j,j+=H));j=H-(E=E.slice(j)).length}else j-=R;for(;j--;E+="0");C.c.push(+E)}}else C.c=[C.e=0]}g.clone=D,g.ROUND_UP=0,g.ROUND_DOWN=1,g.ROUND_CEIL=2,g.ROUND_FLOOR=3,g.ROUND_HALF_UP=4,g.ROUND_HALF_DOWN=5,g.ROUND_HALF_EVEN=6,g.ROUND_HALF_CEIL=7,g.ROUND_HALF_FLOOR=8,g.EUCLID=9,g.config=g.set=function(U){var M,N;if(U!=null)if(typeof U=="object"){if(U.hasOwnProperty(M="DECIMAL_PLACES"))N=U[M],O(N,0,G,M),o=N;if(U.hasOwnProperty(M="ROUNDING_MODE"))N=U[M],O(N,0,8,M),t=N;if(U.hasOwnProperty(M="EXPONENTIAL_AT"))if(N=U[M],N&&N.pop)O(N[0],-G,0,M),O(N[1],0,G,M),J0=N[0],$0=N[1];else O(N,-G,G,M),J0=-($0=N<0?-N:N);if(U.hasOwnProperty(M="RANGE"))if(N=U[M],N&&N.pop)O(N[0],-G,-1,M),O(N[1],1,G,M),V0=N[0],q0=N[1];else if(O(N,-G,G,M),N)V0=-(q0=N<0?-N:N);else throw Error(J+M+" cannot be zero: "+N);if(U.hasOwnProperty(M="CRYPTO"))if(N=U[M],N===!!N)if(N)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))L0=N;else throw L0=!N,Error(J+"crypto unavailable");else L0=N;else throw Error(J+M+" not true or false: "+N);if(U.hasOwnProperty(M="MODULO_MODE"))N=U[M],O(N,0,9,M),R0=N;if(U.hasOwnProperty(M="POW_PRECISION"))N=U[M],O(N,0,G,M),H0=N;if(U.hasOwnProperty(M="FORMAT"))if(N=U[M],typeof N=="object")H4=N;else throw Error(J+M+" not an object: "+N);if(U.hasOwnProperty(M="ALPHABET"))if(N=U[M],typeof N=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(N))X8=N.slice(0,10)=="0123456789",w4=N;else throw Error(J+M+" invalid: "+N)}else throw Error(J+"Object expected: "+U);return{DECIMAL_PLACES:o,ROUNDING_MODE:t,EXPONENTIAL_AT:[J0,$0],RANGE:[V0,q0],CRYPTO:L0,MODULO_MODE:R0,POW_PRECISION:H0,FORMAT:H4,ALPHABET:w4}},g.isBigNumber=function(U){if(!U||U._isBigNumber!==!0)return!1;if(!g.DEBUG)return!0;var M,N,v=U.c,L=U.e,A=U.s;Z:if({}.toString.call(v)=="[object Array]"){if((A===1||A===-1)&&L>=-G&&L<=G&&L===W(L)){if(v[0]===0){if(L===0&&v.length===1)return!0;break Z}if(M=(L+1)%H,M<1)M+=H;if(String(v[0]).length==M){for(M=0;M<v.length;M++)if(N=v[M],N<0||N>=q||N!==W(N))break Z;if(N!==0)return!0}}}else if(v===null&&L===null&&(A===null||A===1||A===-1))return!0;throw Error(J+"Invalid BigNumber: "+U)},g.maximum=g.max=function(){return xZ(arguments,-1)},g.minimum=g.min=function(){return xZ(arguments,1)},g.random=function(){var U=9007199254740992,M=Math.random()*U&2097151?function(){return W(Math.random()*U)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(N){var v,L,A,j,B,R=0,E=[],C=new g(n);if(N==null)N=o;else O(N,0,G);if(j=Y(N/H),L0)if(crypto.getRandomValues){v=crypto.getRandomValues(new Uint32Array(j*=2));for(;R<j;)if(B=v[R]*131072+(v[R+1]>>>11),B>=9000000000000000)L=crypto.getRandomValues(new Uint32Array(2)),v[R]=L[0],v[R+1]=L[1];else E.push(B%100000000000000),R+=2;R=j/2}else if(crypto.randomBytes){v=crypto.randomBytes(j*=7);for(;R<j;)if(B=(v[R]&31)*281474976710656+v[R+1]*1099511627776+v[R+2]*4294967296+v[R+3]*16777216+(v[R+4]<<16)+(v[R+5]<<8)+v[R+6],B>=9000000000000000)crypto.randomBytes(7).copy(v,R);else E.push(B%100000000000000),R+=7;R=j/7}else throw L0=!1,Error(J+"crypto unavailable");if(!L0){for(;R<j;)if(B=M(),B<9000000000000000)E[R++]=B%100000000000000}if(j=E[--R],N%=H,j&&N)B=F[H-N],E[R]=W(j/B)*B;for(;E[R]===0;E.pop(),R--);if(R<0)E=[A=0];else{for(A=-1;E[0]===0;E.splice(0,1),A-=H);for(R=1,B=E[0];B>=10;B/=10,R++);if(R<H)A-=H-R}return C.e=A,C.c=E,C}}(),g.sum=function(){var U=1,M=arguments,N=new g(M[0]);for(;U<M.length;)N=N.plus(M[U++]);return N},d=function(){var U="0123456789";function M(N,v,L,A){var j,B=[0],R,E=0,C=N.length;for(;E<C;){for(R=B.length;R--;B[R]*=v);B[0]+=A.indexOf(N.charAt(E++));for(j=0;j<B.length;j++)if(B[j]>L-1){if(B[j+1]==null)B[j+1]=0;B[j+1]+=B[j]/L|0,B[j]%=L}}return B.reverse()}return function(N,v,L,A,j){var B,R,E,C,k,c,p,Q0,X0=N.indexOf("."),z0=o,e=t;if(X0>=0)C=H0,H0=0,N=N.replace(".",""),Q0=new g(v),c=Q0.pow(N.length-X0),H0=C,Q0.c=M(m(I(c.c),c.e,"0"),10,L,U),Q0.e=Q0.c.length;p=M(N,v,L,j?(B=w4,U):(B=U,w4)),E=C=p.length;for(;p[--C]==0;p.pop());if(!p[0])return B.charAt(0);if(X0<0)--E;else c.c=p,c.e=E,c.s=A,c=S(c,Q0,z0,e,L),p=c.c,k=c.r,E=c.e;if(R=E+z0+1,X0=p[R],C=L/2,k=k||R<0||p[R+1]!=null,k=e<4?(X0!=null||k)&&(e==0||e==(c.s<0?3:2)):X0>C||X0==C&&(e==4||k||e==6&&p[R-1]&1||e==(c.s<0?8:7)),R<1||!p[0])N=k?m(B.charAt(1),-z0,B.charAt(0)):B.charAt(0);else{if(p.length=R,k){for(--L;++p[--R]>L;)if(p[R]=0,!R)++E,p=[1].concat(p)}for(C=p.length;!p[--C];);for(X0=0,N="";X0<=C;N+=B.charAt(p[X0++]));N=m(N,E,B.charAt(0))}return N}}(),S=function(){function U(v,L,A){var j,B,R,E,C=0,k=v.length,c=L%z,p=L/z|0;for(v=v.slice();k--;)R=v[k]%z,E=v[k]/z|0,j=p*R+E*c,B=c*R+j%z*z+C,C=(B/A|0)+(j/z|0)+p*E,v[k]=B%A;if(C)v=[C].concat(v);return v}function M(v,L,A,j){var B,R;if(A!=j)R=A>j?1:-1;else for(B=R=0;B<A;B++)if(v[B]!=L[B]){R=v[B]>L[B]?1:-1;break}return R}function N(v,L,A,j){var B=0;for(;A--;)v[A]-=B,B=v[A]<L[A]?1:0,v[A]=B*j+v[A]-L[A];for(;!v[0]&&v.length>1;v.splice(0,1));}return function(v,L,A,j,B){var R,E,C,k,c,p,Q0,X0,z0,e,Y0,D0,q1,H8,w8,l0,u4,E0=v.s==L.s?1:-1,M0=v.c,K0=L.c;if(!M0||!M0[0]||!K0||!K0[0])return new g(!v.s||!L.s||(M0?K0&&M0[0]==K0[0]:!K0)?NaN:M0&&M0[0]==0||!K0?E0*0:E0/0);if(X0=new g(E0),z0=X0.c=[],E=v.e-L.e,E0=A+E+1,!B)B=q,E=T(v.e/H)-T(L.e/H),E0=E0/H|0;for(C=0;K0[C]==(M0[C]||0);C++);if(K0[C]>(M0[C]||0))E--;if(E0<0)z0.push(1),k=!0;else{if(H8=M0.length,l0=K0.length,C=0,E0+=2,c=W(B/(K0[0]+1)),c>1)K0=U(K0,c,B),M0=U(M0,c,B),l0=K0.length,H8=M0.length;q1=l0,e=M0.slice(0,l0),Y0=e.length;for(;Y0<l0;e[Y0++]=0);if(u4=K0.slice(),u4=[0].concat(u4),w8=K0[0],K0[1]>=B/2)w8++;do{if(c=0,R=M(K0,e,l0,Y0),R<0){if(D0=e[0],l0!=Y0)D0=D0*B+(e[1]||0);if(c=W(D0/w8),c>1){if(c>=B)c=B-1;p=U(K0,c,B),Q0=p.length,Y0=e.length;while(M(p,e,Q0,Y0)==1)c--,N(p,l0<Q0?u4:K0,Q0,B),Q0=p.length,R=1}else{if(c==0)R=c=1;p=K0.slice(),Q0=p.length}if(Q0<Y0)p=[0].concat(p);if(N(e,p,Y0,B),Y0=e.length,R==-1)while(M(K0,e,l0,Y0)<1)c++,N(e,l0<Y0?u4:K0,Y0,B),Y0=e.length}else if(R===0)c++,e=[0];if(z0[C++]=c,e[0])e[Y0++]=M0[q1]||0;else e=[M0[q1]],Y0=1}while((q1++<H8||e[0]!=null)&&E0--);if(k=e[0]!=null,!z0[0])z0.splice(0,1)}if(B==q){for(C=1,E0=z0[0];E0>=10;E0/=10,C++);v0(X0,A+(X0.e=C+E*H-1)+1,j,k)}else X0.e=E,X0.r=+k;return X0}}();function K8(U,M,N,v){var L,A,j,B,R;if(N==null)N=t;else O(N,0,8);if(!U.c)return U.toString();if(L=U.c[0],j=U.e,M==null)R=I(U.c),R=v==1||v==2&&(j<=J0||j>=$0)?x(R,j):m(R,j,"0");else if(U=v0(new g(U),M,N),A=U.e,R=I(U.c),B=R.length,v==1||v==2&&(M<=A||A<=J0)){for(;B<M;R+="0",B++);R=x(R,A)}else if(M-=j+(v===2&&A>j),R=m(R,A,"0"),A+1>B){if(--M>0)for(R+=".";M--;R+="0");}else if(M+=A-B,M>0){if(A+1==B)R+=".";for(;M--;R+="0");}return U.s<0&&L?"-"+R:R}function xZ(U,M){var N,v,L=1,A=new g(U[0]);for(;L<U.length;L++)if(v=new g(U[L]),!v.s||(N=P(A,v))===M||N===0&&A.s===M)A=v;return A}function q8(U,M,N){var v=1,L=M.length;for(;!M[--L];M.pop());for(L=M[0];L>=10;L/=10,v++);if((N=v+N*H-1)>q0)U.c=U.e=null;else if(N<V0)U.c=[U.e=0];else U.e=N,U.c=M;return U}h=function(){var U=/^(-?)0([xbo])(?=\w[\w.]*$)/i,M=/^([^.]+)\.$/,N=/^\.([^.]+)$/,v=/^-?(Infinity|NaN)$/,L=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(A,j,B,R){var E,C=B?j:j.replace(L,"");if(v.test(C))A.s=isNaN(C)?null:C<0?-1:1;else{if(!B){if(C=C.replace(U,function(k,c,p){return E=(p=p.toLowerCase())=="x"?16:p=="b"?2:8,!R||R==E?c:k}),R)E=R,C=C.replace(M,"$1").replace(N,"0.$1");if(j!=C)return new g(C,E)}if(g.DEBUG)throw Error(J+"Not a"+(R?" base "+R:"")+" number: "+j);A.s=null}A.c=A.e=null}}();function v0(U,M,N,v){var L,A,j,B,R,E,C,k=U.c,c=F;if(k){Z:{for(L=1,B=k[0];B>=10;B/=10,L++);if(A=M-L,A<0)A+=H,j=M,R=k[E=0],C=W(R/c[L-j-1]%10);else if(E=Y((A+1)/H),E>=k.length)if(v){for(;k.length<=E;k.push(0));R=C=0,L=1,A%=H,j=A-H+1}else break Z;else{R=B=k[E];for(L=1;B>=10;B/=10,L++);A%=H,j=A-H+L,C=j<0?0:W(R/c[L-j-1]%10)}if(v=v||M<0||k[E+1]!=null||(j<0?R:R%c[L-j-1]),v=N<4?(C||v)&&(N==0||N==(U.s<0?3:2)):C>5||C==5&&(N==4||v||N==6&&(A>0?j>0?R/c[L-j]:0:k[E-1])%10&1||N==(U.s<0?8:7)),M<1||!k[0]){if(k.length=0,v)M-=U.e+1,k[0]=c[(H-M%H)%H],U.e=-M||0;else k[0]=U.e=0;return U}if(A==0)k.length=E,B=1,E--;else k.length=E+1,B=c[H-A],k[E]=j>0?W(R/c[L-j]%c[j])*B:0;if(v)for(;;)if(E==0){for(A=1,j=k[0];j>=10;j/=10,A++);j=k[0]+=B;for(B=1;j>=10;j/=10,B++);if(A!=B){if(U.e++,k[0]==q)k[0]=1}break}else{if(k[E]+=B,k[E]!=q)break;k[E--]=0,B=1}for(A=k.length;k[--A]===0;k.pop());}if(U.e>q0)U.c=U.e=null;else if(U.e<V0)U.c=[U.e=0]}return U}function n0(U){var M,N=U.e;if(N===null)return U.toString();return M=I(U.c),M=N<=J0||N>=$0?x(M,N):m(M,N,"0"),U.s<0?"-"+M:M}if(_.absoluteValue=_.abs=function(){var U=new g(this);if(U.s<0)U.s=1;return U},_.comparedTo=function(U,M){return P(this,new g(U,M))},_.decimalPlaces=_.dp=function(U,M){var N,v,L,A=this;if(U!=null){if(O(U,0,G),M==null)M=t;else O(M,0,8);return v0(new g(A),U+A.e+1,M)}if(!(N=A.c))return null;if(v=((L=N.length-1)-T(this.e/H))*H,L=N[L])for(;L%10==0;L/=10,v--);if(v<0)v=0;return v},_.dividedBy=_.div=function(U,M){return S(this,new g(U,M),o,t)},_.dividedToIntegerBy=_.idiv=function(U,M){return S(this,new g(U,M),0,1)},_.exponentiatedBy=_.pow=function(U,M){var N,v,L,A,j,B,R,E,C,k=this;if(U=new g(U),U.c&&!U.isInteger())throw Error(J+"Exponent not an integer: "+n0(U));if(M!=null)M=new g(M);if(B=U.e>14,!k.c||!k.c[0]||k.c[0]==1&&!k.e&&k.c.length==1||!U.c||!U.c[0])return C=new g(Math.pow(+n0(k),B?U.s*(2-y(U)):+n0(U))),M?C.mod(M):C;if(R=U.s<0,M){if(M.c?!M.c[0]:!M.s)return new g(NaN);if(v=!R&&k.isInteger()&&M.isInteger(),v)k=k.mod(M)}else if(U.e>9&&(k.e>0||k.e<-1||(k.e==0?k.c[0]>1||B&&k.c[1]>=240000000:k.c[0]<80000000000000||B&&k.c[0]<=99999750000000))){if(A=k.s<0&&y(U)?-0:0,k.e>-1)A=1/A;return new g(R?1/A:A)}else if(H0)A=Y(H0/H+2);if(B){if(N=new g(0.5),R)U.s=1;E=y(U)}else L=Math.abs(+n0(U)),E=L%2;C=new g(n);for(;;){if(E){if(C=C.times(k),!C.c)break;if(A){if(C.c.length>A)C.c.length=A}else if(v)C=C.mod(M)}if(L){if(L=W(L/2),L===0)break;E=L%2}else if(U=U.times(N),v0(U,U.e+1,1),U.e>14)E=y(U);else{if(L=+n0(U),L===0)break;E=L%2}if(k=k.times(k),A){if(k.c&&k.c.length>A)k.c.length=A}else if(v)k=k.mod(M)}if(v)return C;if(R)C=n.div(C);return M?C.mod(M):A?v0(C,H0,t,j):C},_.integerValue=function(U){var M=new g(this);if(U==null)U=t;else O(U,0,8);return v0(M,M.e+1,U)},_.isEqualTo=_.eq=function(U,M){return P(this,new g(U,M))===0},_.isFinite=function(){return!!this.c},_.isGreaterThan=_.gt=function(U,M){return P(this,new g(U,M))>0},_.isGreaterThanOrEqualTo=_.gte=function(U,M){return(M=P(this,new g(U,M)))===1||M===0},_.isInteger=function(){return!!this.c&&T(this.e/H)>this.c.length-2},_.isLessThan=_.lt=function(U,M){return P(this,new g(U,M))<0},_.isLessThanOrEqualTo=_.lte=function(U,M){return(M=P(this,new g(U,M)))===-1||M===0},_.isNaN=function(){return!this.s},_.isNegative=function(){return this.s<0},_.isPositive=function(){return this.s>0},_.isZero=function(){return!!this.c&&this.c[0]==0},_.minus=function(U,M){var N,v,L,A,j=this,B=j.s;if(U=new g(U,M),M=U.s,!B||!M)return new g(NaN);if(B!=M)return U.s=-M,j.plus(U);var R=j.e/H,E=U.e/H,C=j.c,k=U.c;if(!R||!E){if(!C||!k)return C?(U.s=-M,U):new g(k?j:NaN);if(!C[0]||!k[0])return k[0]?(U.s=-M,U):new g(C[0]?j:t==3?-0:0)}if(R=T(R),E=T(E),C=C.slice(),B=R-E){if(A=B<0)B=-B,L=C;else E=R,L=k;L.reverse();for(M=B;M--;L.push(0));L.reverse()}else{v=(A=(B=C.length)<(M=k.length))?B:M;for(B=M=0;M<v;M++)if(C[M]!=k[M]){A=C[M]<k[M];break}}if(A)L=C,C=k,k=L,U.s=-U.s;if(M=(v=k.length)-(N=C.length),M>0)for(;M--;C[N++]=0);M=q-1;for(;v>B;){if(C[--v]<k[v]){for(N=v;N&&!C[--N];C[N]=M);--C[N],C[v]+=q}C[v]-=k[v]}for(;C[0]==0;C.splice(0,1),--E);if(!C[0])return U.s=t==3?-1:1,U.c=[U.e=0],U;return q8(U,C,E)},_.modulo=_.mod=function(U,M){var N,v,L=this;if(U=new g(U,M),!L.c||!U.s||U.c&&!U.c[0])return new g(NaN);else if(!U.c||L.c&&!L.c[0])return new g(L);if(R0==9)v=U.s,U.s=1,N=S(L,U,0,3),U.s=v,N.s*=v;else N=S(L,U,0,R0);if(U=L.minus(N.times(U)),!U.c[0]&&R0==1)U.s=L.s;return U},_.multipliedBy=_.times=function(U,M){var N,v,L,A,j,B,R,E,C,k,c,p,Q0,X0,z0,e=this,Y0=e.c,D0=(U=new g(U,M)).c;if(!Y0||!D0||!Y0[0]||!D0[0]){if(!e.s||!U.s||Y0&&!Y0[0]&&!D0||D0&&!D0[0]&&!Y0)U.c=U.e=U.s=null;else if(U.s*=e.s,!Y0||!D0)U.c=U.e=null;else U.c=[0],U.e=0;return U}if(v=T(e.e/H)+T(U.e/H),U.s*=e.s,R=Y0.length,k=D0.length,R<k)Q0=Y0,Y0=D0,D0=Q0,L=R,R=k,k=L;for(L=R+k,Q0=[];L--;Q0.push(0));X0=q,z0=z;for(L=k;--L>=0;){N=0,c=D0[L]%z0,p=D0[L]/z0|0;for(j=R,A=L+j;A>L;)E=Y0[--j]%z0,C=Y0[j]/z0|0,B=p*E+C*c,E=c*E+B%z0*z0+Q0[A]+N,N=(E/X0|0)+(B/z0|0)+p*C,Q0[A--]=E%X0;Q0[A]=N}if(N)++v;else Q0.splice(0,1);return q8(U,Q0,v)},_.negated=function(){var U=new g(this);return U.s=-U.s||null,U},_.plus=function(U,M){var N,v=this,L=v.s;if(U=new g(U,M),M=U.s,!L||!M)return new g(NaN);if(L!=M)return U.s=-M,v.minus(U);var A=v.e/H,j=U.e/H,B=v.c,R=U.c;if(!A||!j){if(!B||!R)return new g(L/0);if(!B[0]||!R[0])return R[0]?U:new g(B[0]?v:L*0)}if(A=T(A),j=T(j),B=B.slice(),L=A-j){if(L>0)j=A,N=R;else L=-L,N=B;N.reverse();for(;L--;N.push(0));N.reverse()}if(L=B.length,M=R.length,L-M<0)N=R,R=B,B=N,M=L;for(L=0;M;)L=(B[--M]=B[M]+R[M]+L)/q|0,B[M]=q===B[M]?0:B[M]%q;if(L)B=[L].concat(B),++j;return q8(U,B,j)},_.precision=_.sd=function(U,M){var N,v,L,A=this;if(U!=null&&U!==!!U){if(O(U,1,G),M==null)M=t;else O(M,0,8);return v0(new g(A),U,M)}if(!(N=A.c))return null;if(L=N.length-1,v=L*H+1,L=N[L]){for(;L%10==0;L/=10,v--);for(L=N[0];L>=10;L/=10,v++);}if(U&&A.e+1>v)v=A.e+1;return v},_.shiftedBy=function(U){return O(U,-w,w),this.times("1e"+U)},_.squareRoot=_.sqrt=function(){var U,M,N,v,L,A=this,j=A.c,B=A.s,R=A.e,E=o+4,C=new g("0.5");if(B!==1||!j||!j[0])return new g(!B||B<0&&(!j||j[0])?NaN:j?A:1/0);if(B=Math.sqrt(+n0(A)),B==0||B==1/0){if(M=I(j),(M.length+R)%2==0)M+="0";if(B=Math.sqrt(+M),R=T((R+1)/2)-(R<0||R%2),B==1/0)M="5e"+R;else M=B.toExponential(),M=M.slice(0,M.indexOf("e")+1)+R;N=new g(M)}else N=new g(B+"");if(N.c[0]){if(R=N.e,B=R+E,B<3)B=0;for(;;)if(L=N,N=C.times(L.plus(S(A,L,E,1))),I(L.c).slice(0,B)===(M=I(N.c)).slice(0,B)){if(N.e<R)--B;if(M=M.slice(B-3,B+1),M=="9999"||!v&&M=="4999"){if(!v){if(v0(L,L.e+o+2,0),L.times(L).eq(A)){N=L;break}}E+=4,B+=4,v=1}else{if(!+M||!+M.slice(1)&&M.charAt(0)=="5")v0(N,N.e+o+2,1),U=!N.times(N).eq(A);break}}}return v0(N,N.e+o+1,t,U)},_.toExponential=function(U,M){if(U!=null)O(U,0,G),U++;return K8(this,U,M,1)},_.toFixed=function(U,M){if(U!=null)O(U,0,G),U=U+this.e+1;return K8(this,U,M)},_.toFormat=function(U,M,N){var v,L=this;if(N==null)if(U!=null&&M&&typeof M=="object")N=M,M=null;else if(U&&typeof U=="object")N=U,U=M=null;else N=H4;else if(typeof N!="object")throw Error(J+"Argument not an object: "+N);if(v=L.toFixed(U,M),L.c){var A,j=v.split("."),B=+N.groupSize,R=+N.secondaryGroupSize,E=N.groupSeparator||"",C=j[0],k=j[1],c=L.s<0,p=c?C.slice(1):C,Q0=p.length;if(R)A=B,B=R,R=A,Q0-=A;if(B>0&&Q0>0){A=Q0%B||B,C=p.substr(0,A);for(;A<Q0;A+=B)C+=E+p.substr(A,B);if(R>0)C+=E+p.slice(A);if(c)C="-"+C}v=k?C+(N.decimalSeparator||"")+((R=+N.fractionGroupSize)?k.replace(new RegExp("\\d{"+R+"}\\B","g"),"$&"+(N.fractionGroupSeparator||"")):k):C}return(N.prefix||"")+v+(N.suffix||"")},_.toFraction=function(U){var M,N,v,L,A,j,B,R,E,C,k,c,p=this,Q0=p.c;if(U!=null){if(B=new g(U),!B.isInteger()&&(B.c||B.s!==1)||B.lt(n))throw Error(J+"Argument "+(B.isInteger()?"out of range: ":"not an integer: ")+n0(B))}if(!Q0)return new g(p);M=new g(n),E=N=new g(n),v=R=new g(n),c=I(Q0),A=M.e=c.length-p.e-1,M.c[0]=F[(j=A%H)<0?H+j:j],U=!U||B.comparedTo(M)>0?A>0?M:E:B,j=q0,q0=1/0,B=new g(c),R.c[0]=0;for(;;){if(C=S(B,M,0,1),L=N.plus(C.times(v)),L.comparedTo(U)==1)break;N=v,v=L,E=R.plus(C.times(L=E)),R=L,M=B.minus(C.times(L=M)),B=L}return L=S(U.minus(N),v,0,1),R=R.plus(L.times(E)),N=N.plus(L.times(v)),R.s=E.s=p.s,A=A*2,k=S(E,v,A,t).minus(p).abs().comparedTo(S(R,N,A,t).minus(p).abs())<1?[E,v]:[R,N],q0=j,k},_.toNumber=function(){return+n0(this)},_.toPrecision=function(U,M){if(U!=null)O(U,1,G);return K8(this,U,M,2)},_.toString=function(U){var M,N=this,v=N.s,L=N.e;if(L===null)if(v){if(M="Infinity",v<0)M="-"+M}else M="NaN";else{if(U==null)M=L<=J0||L>=$0?x(I(N.c),L):m(I(N.c),L,"0");else if(U===10&&X8)N=v0(new g(N),o+L+1,t),M=m(I(N.c),N.e,"0");else O(U,2,w4.length,"Base"),M=d(m(I(N.c),L,"0"),10,U,v,!0);if(v<0&&N.c[0])M="-"+M}return M},_.valueOf=_.toJSON=function(){return n0(this)},_._isBigNumber=!0,f!=null)g.set(f);return g}function T(f){var S=f|0;return f>0||f===S?S:S-1}function I(f){var S,d,h=1,_=f.length,n=f[0]+"";for(;h<_;){S=f[h++]+"",d=H-S.length;for(;d--;S="0"+S);n+=S}for(_=n.length;n.charCodeAt(--_)===48;);return n.slice(0,_+1||1)}function P(f,S){var d,h,_=f.c,n=S.c,o=f.s,t=S.s,J0=f.e,$0=S.e;if(!o||!t)return null;if(d=_&&!_[0],h=n&&!n[0],d||h)return d?h?0:-t:o;if(o!=t)return o;if(d=o<0,h=J0==$0,!_||!n)return h?0:!_^d?1:-1;if(!h)return J0>$0^d?1:-1;t=(J0=_.length)<($0=n.length)?J0:$0;for(o=0;o<t;o++)if(_[o]!=n[o])return _[o]>n[o]^d?1:-1;return J0==$0?0:J0>$0^d?1:-1}function O(f,S,d,h){if(f<S||f>d||f!==W(f))throw Error(J+(h||"Argument")+(typeof f=="number"?f<S||f>d?" out of range: ":" not an integer: ":" not a primitive number: ")+String(f))}function y(f){var S=f.c.length-1;return T(f.e/H)==S&&f.c[S]%2!=0}function x(f,S){return(f.length>1?f.charAt(0)+"."+f.slice(1):f)+(S<0?"e":"e+")+S}function m(f,S,d){var h,_;if(S<0){for(_=d+".";++S;_+=d);f=_+f}else if(h=f.length,++S>h){for(_=d,S-=h;--S;_+=d);f+=_}else if(S<h)f=f.slice(0,S)+"."+f.slice(S);return f}if($=D(),$.default=$.BigNumber=$,typeof define=="function"&&define.amd)define(function(){return $});else if(typeof z1<"u"&&z1.exports)z1.exports=$;else{if(!Z)Z=typeof self<"u"&&self?self:window;Z.BigNumber=$}})(F$)});var M$=b((qD,D$)=>{var G$=T8(),U$=qD;(function(){function Z(w){return w<10?"0"+w:w}var $=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,Q=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,Y,W,J={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':"\\\"","\\":"\\\\"},K;function q(w){return Q.lastIndex=0,Q.test(w)?'"'+w.replace(Q,function(F){var z=J[F];return typeof z==="string"?z:"\\u"+("0000"+F.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+w+'"'}function H(w,F){var z,G,D,T,I=Y,P,O=F[w],y=O!=null&&(O instanceof G$||G$.isBigNumber(O));if(O&&typeof O==="object"&&typeof O.toJSON==="function")O=O.toJSON(w);if(typeof K==="function")O=K.call(F,w,O);switch(typeof O){case"string":if(y)return O;else return q(O);case"number":return isFinite(O)?String(O):"null";case"boolean":case"null":case"bigint":return String(O);case"object":if(!O)return"null";if(Y+=W,P=[],Object.prototype.toString.apply(O)==="[object Array]"){T=O.length;for(z=0;z<T;z+=1)P[z]=H(z,O)||"null";return D=P.length===0?"[]":Y?`[
7
+ `}yield Q}static#V;static#J;static async#X(){return this.#V||=(await import("./chunk-emyax05s.js").then((m)=>I8(m.default))).HttpsProxyAgent,this.#V}static async#K(){let Z=typeof window<"u"&&!!window;return this.#J||=Z?window.fetch:(await import("node-fetch")).default,this.#J}static mergeHeaders(Z,...$){Z=Z instanceof Headers?Z:new Headers(Z);for(let Q of $)(Q instanceof Headers?Q:new Headers(Q)).forEach((W,J)=>{J==="set-cookie"?Z.append(J,W):Z.set(J,W)});return Z}}T4.Gaxios=N8;N4=N8});var G0=b((I0)=>{var Q7=I0&&I0.__createBinding||(Object.create?function(Z,$,Q,Y){if(Y===void 0)Y=Q;var W=Object.getOwnPropertyDescriptor($,Q);if(!W||("get"in W?!$.__esModule:W.writable||W.configurable))W={enumerable:!0,get:function(){return $[Q]}};Object.defineProperty(Z,Y,W)}:function(Z,$,Q,Y){if(Y===void 0)Y=Q;Z[Y]=$[Q]}),Y7=I0&&I0.__exportStar||function(Z,$){for(var Q in Z)if(Q!=="default"&&!Object.prototype.hasOwnProperty.call($,Q))Q7($,Z,Q)};Object.defineProperty(I0,"__esModule",{value:!0});I0.instance=I0.Gaxios=I0.GaxiosError=void 0;I0.request=V7;var z$=w$();Object.defineProperty(I0,"Gaxios",{enumerable:!0,get:function(){return z$.Gaxios}});var W7=D8();Object.defineProperty(I0,"GaxiosError",{enumerable:!0,get:function(){return W7.GaxiosError}});Y7(M8(),I0);I0.instance=new z$.Gaxios;async function V7(Z){return I0.instance.request(Z)}});var T8=b((F$,z1)=>{(function(Z){var $,Q=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Y=Math.ceil,W=Math.floor,J="[BigNumber Error] ",K=J+"Number primitive has more than 15 significant digits: ",q=100000000000000,H=14,w=9007199254740991,F=[1,10,100,1000,1e4,1e5,1e6,1e7,1e8,1e9,10000000000,100000000000,1000000000000,10000000000000],z=1e7,G=1e9;function D(f){var S,d,h,_=g.prototype={constructor:g,toString:null,valueOf:null},n=new g(1),o=20,t=4,J0=-7,$0=21,V0=-1e7,q0=1e7,L0=!1,R0=1,H0=0,H4={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},w4="0123456789abcdefghijklmnopqrstuvwxyz",X8=!0;function g(U,M){var N,v,L,A,j,B,R,E,C=this;if(!(C instanceof g))return new g(U,M);if(M==null){if(U&&U._isBigNumber===!0){if(C.s=U.s,!U.c||U.e>q0)C.c=C.e=null;else if(U.e<V0)C.c=[C.e=0];else C.e=U.e,C.c=U.c.slice();return}if((B=typeof U=="number")&&U*0==0){if(C.s=1/U<0?(U=-U,-1):1,U===~~U){for(A=0,j=U;j>=10;j/=10,A++);if(A>q0)C.c=C.e=null;else C.e=A,C.c=[U];return}E=String(U)}else{if(!Q.test(E=String(U)))return h(C,E,B);C.s=E.charCodeAt(0)==45?(E=E.slice(1),-1):1}if((A=E.indexOf("."))>-1)E=E.replace(".","");if((j=E.search(/e/i))>0){if(A<0)A=j;A+=+E.slice(j+1),E=E.substring(0,j)}else if(A<0)A=E.length}else{if(O(M,2,w4.length,"Base"),M==10&&X8)return C=new g(U),v0(C,o+C.e+1,t);if(E=String(U),B=typeof U=="number"){if(U*0!=0)return h(C,E,B,M);if(C.s=1/U<0?(E=E.slice(1),-1):1,g.DEBUG&&E.replace(/^0\.0*|\./,"").length>15)throw Error(K+U)}else C.s=E.charCodeAt(0)===45?(E=E.slice(1),-1):1;N=w4.slice(0,M),A=j=0;for(R=E.length;j<R;j++)if(N.indexOf(v=E.charAt(j))<0){if(v=="."){if(j>A){A=R;continue}}else if(!L){if(E==E.toUpperCase()&&(E=E.toLowerCase())||E==E.toLowerCase()&&(E=E.toUpperCase())){L=!0,j=-1,A=0;continue}}return h(C,String(U),B,M)}if(B=!1,E=d(E,M,10,C.s),(A=E.indexOf("."))>-1)E=E.replace(".","");else A=E.length}for(j=0;E.charCodeAt(j)===48;j++);for(R=E.length;E.charCodeAt(--R)===48;);if(E=E.slice(j,++R)){if(R-=j,B&&g.DEBUG&&R>15&&(U>w||U!==W(U)))throw Error(K+C.s*U);if((A=A-j-1)>q0)C.c=C.e=null;else if(A<V0)C.c=[C.e=0];else{if(C.e=A,C.c=[],j=(A+1)%H,A<0)j+=H;if(j<R){if(j)C.c.push(+E.slice(0,j));for(R-=H;j<R;)C.c.push(+E.slice(j,j+=H));j=H-(E=E.slice(j)).length}else j-=R;for(;j--;E+="0");C.c.push(+E)}}else C.c=[C.e=0]}g.clone=D,g.ROUND_UP=0,g.ROUND_DOWN=1,g.ROUND_CEIL=2,g.ROUND_FLOOR=3,g.ROUND_HALF_UP=4,g.ROUND_HALF_DOWN=5,g.ROUND_HALF_EVEN=6,g.ROUND_HALF_CEIL=7,g.ROUND_HALF_FLOOR=8,g.EUCLID=9,g.config=g.set=function(U){var M,N;if(U!=null)if(typeof U=="object"){if(U.hasOwnProperty(M="DECIMAL_PLACES"))N=U[M],O(N,0,G,M),o=N;if(U.hasOwnProperty(M="ROUNDING_MODE"))N=U[M],O(N,0,8,M),t=N;if(U.hasOwnProperty(M="EXPONENTIAL_AT"))if(N=U[M],N&&N.pop)O(N[0],-G,0,M),O(N[1],0,G,M),J0=N[0],$0=N[1];else O(N,-G,G,M),J0=-($0=N<0?-N:N);if(U.hasOwnProperty(M="RANGE"))if(N=U[M],N&&N.pop)O(N[0],-G,-1,M),O(N[1],1,G,M),V0=N[0],q0=N[1];else if(O(N,-G,G,M),N)V0=-(q0=N<0?-N:N);else throw Error(J+M+" cannot be zero: "+N);if(U.hasOwnProperty(M="CRYPTO"))if(N=U[M],N===!!N)if(N)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))L0=N;else throw L0=!N,Error(J+"crypto unavailable");else L0=N;else throw Error(J+M+" not true or false: "+N);if(U.hasOwnProperty(M="MODULO_MODE"))N=U[M],O(N,0,9,M),R0=N;if(U.hasOwnProperty(M="POW_PRECISION"))N=U[M],O(N,0,G,M),H0=N;if(U.hasOwnProperty(M="FORMAT"))if(N=U[M],typeof N=="object")H4=N;else throw Error(J+M+" not an object: "+N);if(U.hasOwnProperty(M="ALPHABET"))if(N=U[M],typeof N=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(N))X8=N.slice(0,10)=="0123456789",w4=N;else throw Error(J+M+" invalid: "+N)}else throw Error(J+"Object expected: "+U);return{DECIMAL_PLACES:o,ROUNDING_MODE:t,EXPONENTIAL_AT:[J0,$0],RANGE:[V0,q0],CRYPTO:L0,MODULO_MODE:R0,POW_PRECISION:H0,FORMAT:H4,ALPHABET:w4}},g.isBigNumber=function(U){if(!U||U._isBigNumber!==!0)return!1;if(!g.DEBUG)return!0;var M,N,v=U.c,L=U.e,A=U.s;Z:if({}.toString.call(v)=="[object Array]"){if((A===1||A===-1)&&L>=-G&&L<=G&&L===W(L)){if(v[0]===0){if(L===0&&v.length===1)return!0;break Z}if(M=(L+1)%H,M<1)M+=H;if(String(v[0]).length==M){for(M=0;M<v.length;M++)if(N=v[M],N<0||N>=q||N!==W(N))break Z;if(N!==0)return!0}}}else if(v===null&&L===null&&(A===null||A===1||A===-1))return!0;throw Error(J+"Invalid BigNumber: "+U)},g.maximum=g.max=function(){return xZ(arguments,-1)},g.minimum=g.min=function(){return xZ(arguments,1)},g.random=function(){var U=9007199254740992,M=Math.random()*U&2097151?function(){return W(Math.random()*U)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(N){var v,L,A,j,B,R=0,E=[],C=new g(n);if(N==null)N=o;else O(N,0,G);if(j=Y(N/H),L0)if(crypto.getRandomValues){v=crypto.getRandomValues(new Uint32Array(j*=2));for(;R<j;)if(B=v[R]*131072+(v[R+1]>>>11),B>=9000000000000000)L=crypto.getRandomValues(new Uint32Array(2)),v[R]=L[0],v[R+1]=L[1];else E.push(B%100000000000000),R+=2;R=j/2}else if(crypto.randomBytes){v=crypto.randomBytes(j*=7);for(;R<j;)if(B=(v[R]&31)*281474976710656+v[R+1]*1099511627776+v[R+2]*4294967296+v[R+3]*16777216+(v[R+4]<<16)+(v[R+5]<<8)+v[R+6],B>=9000000000000000)crypto.randomBytes(7).copy(v,R);else E.push(B%100000000000000),R+=7;R=j/7}else throw L0=!1,Error(J+"crypto unavailable");if(!L0){for(;R<j;)if(B=M(),B<9000000000000000)E[R++]=B%100000000000000}if(j=E[--R],N%=H,j&&N)B=F[H-N],E[R]=W(j/B)*B;for(;E[R]===0;E.pop(),R--);if(R<0)E=[A=0];else{for(A=-1;E[0]===0;E.splice(0,1),A-=H);for(R=1,B=E[0];B>=10;B/=10,R++);if(R<H)A-=H-R}return C.e=A,C.c=E,C}}(),g.sum=function(){var U=1,M=arguments,N=new g(M[0]);for(;U<M.length;)N=N.plus(M[U++]);return N},d=function(){var U="0123456789";function M(N,v,L,A){var j,B=[0],R,E=0,C=N.length;for(;E<C;){for(R=B.length;R--;B[R]*=v);B[0]+=A.indexOf(N.charAt(E++));for(j=0;j<B.length;j++)if(B[j]>L-1){if(B[j+1]==null)B[j+1]=0;B[j+1]+=B[j]/L|0,B[j]%=L}}return B.reverse()}return function(N,v,L,A,j){var B,R,E,C,k,c,p,Q0,X0=N.indexOf("."),z0=o,e=t;if(X0>=0)C=H0,H0=0,N=N.replace(".",""),Q0=new g(v),c=Q0.pow(N.length-X0),H0=C,Q0.c=M(m(I(c.c),c.e,"0"),10,L,U),Q0.e=Q0.c.length;p=M(N,v,L,j?(B=w4,U):(B=U,w4)),E=C=p.length;for(;p[--C]==0;p.pop());if(!p[0])return B.charAt(0);if(X0<0)--E;else c.c=p,c.e=E,c.s=A,c=S(c,Q0,z0,e,L),p=c.c,k=c.r,E=c.e;if(R=E+z0+1,X0=p[R],C=L/2,k=k||R<0||p[R+1]!=null,k=e<4?(X0!=null||k)&&(e==0||e==(c.s<0?3:2)):X0>C||X0==C&&(e==4||k||e==6&&p[R-1]&1||e==(c.s<0?8:7)),R<1||!p[0])N=k?m(B.charAt(1),-z0,B.charAt(0)):B.charAt(0);else{if(p.length=R,k){for(--L;++p[--R]>L;)if(p[R]=0,!R)++E,p=[1].concat(p)}for(C=p.length;!p[--C];);for(X0=0,N="";X0<=C;N+=B.charAt(p[X0++]));N=m(N,E,B.charAt(0))}return N}}(),S=function(){function U(v,L,A){var j,B,R,E,C=0,k=v.length,c=L%z,p=L/z|0;for(v=v.slice();k--;)R=v[k]%z,E=v[k]/z|0,j=p*R+E*c,B=c*R+j%z*z+C,C=(B/A|0)+(j/z|0)+p*E,v[k]=B%A;if(C)v=[C].concat(v);return v}function M(v,L,A,j){var B,R;if(A!=j)R=A>j?1:-1;else for(B=R=0;B<A;B++)if(v[B]!=L[B]){R=v[B]>L[B]?1:-1;break}return R}function N(v,L,A,j){var B=0;for(;A--;)v[A]-=B,B=v[A]<L[A]?1:0,v[A]=B*j+v[A]-L[A];for(;!v[0]&&v.length>1;v.splice(0,1));}return function(v,L,A,j,B){var R,E,C,k,c,p,Q0,X0,z0,e,Y0,D0,q1,H8,w8,l0,u4,E0=v.s==L.s?1:-1,M0=v.c,K0=L.c;if(!M0||!M0[0]||!K0||!K0[0])return new g(!v.s||!L.s||(M0?K0&&M0[0]==K0[0]:!K0)?NaN:M0&&M0[0]==0||!K0?E0*0:E0/0);if(X0=new g(E0),z0=X0.c=[],E=v.e-L.e,E0=A+E+1,!B)B=q,E=T(v.e/H)-T(L.e/H),E0=E0/H|0;for(C=0;K0[C]==(M0[C]||0);C++);if(K0[C]>(M0[C]||0))E--;if(E0<0)z0.push(1),k=!0;else{if(H8=M0.length,l0=K0.length,C=0,E0+=2,c=W(B/(K0[0]+1)),c>1)K0=U(K0,c,B),M0=U(M0,c,B),l0=K0.length,H8=M0.length;q1=l0,e=M0.slice(0,l0),Y0=e.length;for(;Y0<l0;e[Y0++]=0);if(u4=K0.slice(),u4=[0].concat(u4),w8=K0[0],K0[1]>=B/2)w8++;do{if(c=0,R=M(K0,e,l0,Y0),R<0){if(D0=e[0],l0!=Y0)D0=D0*B+(e[1]||0);if(c=W(D0/w8),c>1){if(c>=B)c=B-1;p=U(K0,c,B),Q0=p.length,Y0=e.length;while(M(p,e,Q0,Y0)==1)c--,N(p,l0<Q0?u4:K0,Q0,B),Q0=p.length,R=1}else{if(c==0)R=c=1;p=K0.slice(),Q0=p.length}if(Q0<Y0)p=[0].concat(p);if(N(e,p,Y0,B),Y0=e.length,R==-1)while(M(K0,e,l0,Y0)<1)c++,N(e,l0<Y0?u4:K0,Y0,B),Y0=e.length}else if(R===0)c++,e=[0];if(z0[C++]=c,e[0])e[Y0++]=M0[q1]||0;else e=[M0[q1]],Y0=1}while((q1++<H8||e[0]!=null)&&E0--);if(k=e[0]!=null,!z0[0])z0.splice(0,1)}if(B==q){for(C=1,E0=z0[0];E0>=10;E0/=10,C++);v0(X0,A+(X0.e=C+E*H-1)+1,j,k)}else X0.e=E,X0.r=+k;return X0}}();function K8(U,M,N,v){var L,A,j,B,R;if(N==null)N=t;else O(N,0,8);if(!U.c)return U.toString();if(L=U.c[0],j=U.e,M==null)R=I(U.c),R=v==1||v==2&&(j<=J0||j>=$0)?x(R,j):m(R,j,"0");else if(U=v0(new g(U),M,N),A=U.e,R=I(U.c),B=R.length,v==1||v==2&&(M<=A||A<=J0)){for(;B<M;R+="0",B++);R=x(R,A)}else if(M-=j+(v===2&&A>j),R=m(R,A,"0"),A+1>B){if(--M>0)for(R+=".";M--;R+="0");}else if(M+=A-B,M>0){if(A+1==B)R+=".";for(;M--;R+="0");}return U.s<0&&L?"-"+R:R}function xZ(U,M){var N,v,L=1,A=new g(U[0]);for(;L<U.length;L++)if(v=new g(U[L]),!v.s||(N=P(A,v))===M||N===0&&A.s===M)A=v;return A}function q8(U,M,N){var v=1,L=M.length;for(;!M[--L];M.pop());for(L=M[0];L>=10;L/=10,v++);if((N=v+N*H-1)>q0)U.c=U.e=null;else if(N<V0)U.c=[U.e=0];else U.e=N,U.c=M;return U}h=function(){var U=/^(-?)0([xbo])(?=\w[\w.]*$)/i,M=/^([^.]+)\.$/,N=/^\.([^.]+)$/,v=/^-?(Infinity|NaN)$/,L=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(A,j,B,R){var E,C=B?j:j.replace(L,"");if(v.test(C))A.s=isNaN(C)?null:C<0?-1:1;else{if(!B){if(C=C.replace(U,function(k,c,p){return E=(p=p.toLowerCase())=="x"?16:p=="b"?2:8,!R||R==E?c:k}),R)E=R,C=C.replace(M,"$1").replace(N,"0.$1");if(j!=C)return new g(C,E)}if(g.DEBUG)throw Error(J+"Not a"+(R?" base "+R:"")+" number: "+j);A.s=null}A.c=A.e=null}}();function v0(U,M,N,v){var L,A,j,B,R,E,C,k=U.c,c=F;if(k){Z:{for(L=1,B=k[0];B>=10;B/=10,L++);if(A=M-L,A<0)A+=H,j=M,R=k[E=0],C=W(R/c[L-j-1]%10);else if(E=Y((A+1)/H),E>=k.length)if(v){for(;k.length<=E;k.push(0));R=C=0,L=1,A%=H,j=A-H+1}else break Z;else{R=B=k[E];for(L=1;B>=10;B/=10,L++);A%=H,j=A-H+L,C=j<0?0:W(R/c[L-j-1]%10)}if(v=v||M<0||k[E+1]!=null||(j<0?R:R%c[L-j-1]),v=N<4?(C||v)&&(N==0||N==(U.s<0?3:2)):C>5||C==5&&(N==4||v||N==6&&(A>0?j>0?R/c[L-j]:0:k[E-1])%10&1||N==(U.s<0?8:7)),M<1||!k[0]){if(k.length=0,v)M-=U.e+1,k[0]=c[(H-M%H)%H],U.e=-M||0;else k[0]=U.e=0;return U}if(A==0)k.length=E,B=1,E--;else k.length=E+1,B=c[H-A],k[E]=j>0?W(R/c[L-j]%c[j])*B:0;if(v)for(;;)if(E==0){for(A=1,j=k[0];j>=10;j/=10,A++);j=k[0]+=B;for(B=1;j>=10;j/=10,B++);if(A!=B){if(U.e++,k[0]==q)k[0]=1}break}else{if(k[E]+=B,k[E]!=q)break;k[E--]=0,B=1}for(A=k.length;k[--A]===0;k.pop());}if(U.e>q0)U.c=U.e=null;else if(U.e<V0)U.c=[U.e=0]}return U}function n0(U){var M,N=U.e;if(N===null)return U.toString();return M=I(U.c),M=N<=J0||N>=$0?x(M,N):m(M,N,"0"),U.s<0?"-"+M:M}if(_.absoluteValue=_.abs=function(){var U=new g(this);if(U.s<0)U.s=1;return U},_.comparedTo=function(U,M){return P(this,new g(U,M))},_.decimalPlaces=_.dp=function(U,M){var N,v,L,A=this;if(U!=null){if(O(U,0,G),M==null)M=t;else O(M,0,8);return v0(new g(A),U+A.e+1,M)}if(!(N=A.c))return null;if(v=((L=N.length-1)-T(this.e/H))*H,L=N[L])for(;L%10==0;L/=10,v--);if(v<0)v=0;return v},_.dividedBy=_.div=function(U,M){return S(this,new g(U,M),o,t)},_.dividedToIntegerBy=_.idiv=function(U,M){return S(this,new g(U,M),0,1)},_.exponentiatedBy=_.pow=function(U,M){var N,v,L,A,j,B,R,E,C,k=this;if(U=new g(U),U.c&&!U.isInteger())throw Error(J+"Exponent not an integer: "+n0(U));if(M!=null)M=new g(M);if(B=U.e>14,!k.c||!k.c[0]||k.c[0]==1&&!k.e&&k.c.length==1||!U.c||!U.c[0])return C=new g(Math.pow(+n0(k),B?U.s*(2-y(U)):+n0(U))),M?C.mod(M):C;if(R=U.s<0,M){if(M.c?!M.c[0]:!M.s)return new g(NaN);if(v=!R&&k.isInteger()&&M.isInteger(),v)k=k.mod(M)}else if(U.e>9&&(k.e>0||k.e<-1||(k.e==0?k.c[0]>1||B&&k.c[1]>=240000000:k.c[0]<80000000000000||B&&k.c[0]<=99999750000000))){if(A=k.s<0&&y(U)?-0:0,k.e>-1)A=1/A;return new g(R?1/A:A)}else if(H0)A=Y(H0/H+2);if(B){if(N=new g(0.5),R)U.s=1;E=y(U)}else L=Math.abs(+n0(U)),E=L%2;C=new g(n);for(;;){if(E){if(C=C.times(k),!C.c)break;if(A){if(C.c.length>A)C.c.length=A}else if(v)C=C.mod(M)}if(L){if(L=W(L/2),L===0)break;E=L%2}else if(U=U.times(N),v0(U,U.e+1,1),U.e>14)E=y(U);else{if(L=+n0(U),L===0)break;E=L%2}if(k=k.times(k),A){if(k.c&&k.c.length>A)k.c.length=A}else if(v)k=k.mod(M)}if(v)return C;if(R)C=n.div(C);return M?C.mod(M):A?v0(C,H0,t,j):C},_.integerValue=function(U){var M=new g(this);if(U==null)U=t;else O(U,0,8);return v0(M,M.e+1,U)},_.isEqualTo=_.eq=function(U,M){return P(this,new g(U,M))===0},_.isFinite=function(){return!!this.c},_.isGreaterThan=_.gt=function(U,M){return P(this,new g(U,M))>0},_.isGreaterThanOrEqualTo=_.gte=function(U,M){return(M=P(this,new g(U,M)))===1||M===0},_.isInteger=function(){return!!this.c&&T(this.e/H)>this.c.length-2},_.isLessThan=_.lt=function(U,M){return P(this,new g(U,M))<0},_.isLessThanOrEqualTo=_.lte=function(U,M){return(M=P(this,new g(U,M)))===-1||M===0},_.isNaN=function(){return!this.s},_.isNegative=function(){return this.s<0},_.isPositive=function(){return this.s>0},_.isZero=function(){return!!this.c&&this.c[0]==0},_.minus=function(U,M){var N,v,L,A,j=this,B=j.s;if(U=new g(U,M),M=U.s,!B||!M)return new g(NaN);if(B!=M)return U.s=-M,j.plus(U);var R=j.e/H,E=U.e/H,C=j.c,k=U.c;if(!R||!E){if(!C||!k)return C?(U.s=-M,U):new g(k?j:NaN);if(!C[0]||!k[0])return k[0]?(U.s=-M,U):new g(C[0]?j:t==3?-0:0)}if(R=T(R),E=T(E),C=C.slice(),B=R-E){if(A=B<0)B=-B,L=C;else E=R,L=k;L.reverse();for(M=B;M--;L.push(0));L.reverse()}else{v=(A=(B=C.length)<(M=k.length))?B:M;for(B=M=0;M<v;M++)if(C[M]!=k[M]){A=C[M]<k[M];break}}if(A)L=C,C=k,k=L,U.s=-U.s;if(M=(v=k.length)-(N=C.length),M>0)for(;M--;C[N++]=0);M=q-1;for(;v>B;){if(C[--v]<k[v]){for(N=v;N&&!C[--N];C[N]=M);--C[N],C[v]+=q}C[v]-=k[v]}for(;C[0]==0;C.splice(0,1),--E);if(!C[0])return U.s=t==3?-1:1,U.c=[U.e=0],U;return q8(U,C,E)},_.modulo=_.mod=function(U,M){var N,v,L=this;if(U=new g(U,M),!L.c||!U.s||U.c&&!U.c[0])return new g(NaN);else if(!U.c||L.c&&!L.c[0])return new g(L);if(R0==9)v=U.s,U.s=1,N=S(L,U,0,3),U.s=v,N.s*=v;else N=S(L,U,0,R0);if(U=L.minus(N.times(U)),!U.c[0]&&R0==1)U.s=L.s;return U},_.multipliedBy=_.times=function(U,M){var N,v,L,A,j,B,R,E,C,k,c,p,Q0,X0,z0,e=this,Y0=e.c,D0=(U=new g(U,M)).c;if(!Y0||!D0||!Y0[0]||!D0[0]){if(!e.s||!U.s||Y0&&!Y0[0]&&!D0||D0&&!D0[0]&&!Y0)U.c=U.e=U.s=null;else if(U.s*=e.s,!Y0||!D0)U.c=U.e=null;else U.c=[0],U.e=0;return U}if(v=T(e.e/H)+T(U.e/H),U.s*=e.s,R=Y0.length,k=D0.length,R<k)Q0=Y0,Y0=D0,D0=Q0,L=R,R=k,k=L;for(L=R+k,Q0=[];L--;Q0.push(0));X0=q,z0=z;for(L=k;--L>=0;){N=0,c=D0[L]%z0,p=D0[L]/z0|0;for(j=R,A=L+j;A>L;)E=Y0[--j]%z0,C=Y0[j]/z0|0,B=p*E+C*c,E=c*E+B%z0*z0+Q0[A]+N,N=(E/X0|0)+(B/z0|0)+p*C,Q0[A--]=E%X0;Q0[A]=N}if(N)++v;else Q0.splice(0,1);return q8(U,Q0,v)},_.negated=function(){var U=new g(this);return U.s=-U.s||null,U},_.plus=function(U,M){var N,v=this,L=v.s;if(U=new g(U,M),M=U.s,!L||!M)return new g(NaN);if(L!=M)return U.s=-M,v.minus(U);var A=v.e/H,j=U.e/H,B=v.c,R=U.c;if(!A||!j){if(!B||!R)return new g(L/0);if(!B[0]||!R[0])return R[0]?U:new g(B[0]?v:L*0)}if(A=T(A),j=T(j),B=B.slice(),L=A-j){if(L>0)j=A,N=R;else L=-L,N=B;N.reverse();for(;L--;N.push(0));N.reverse()}if(L=B.length,M=R.length,L-M<0)N=R,R=B,B=N,M=L;for(L=0;M;)L=(B[--M]=B[M]+R[M]+L)/q|0,B[M]=q===B[M]?0:B[M]%q;if(L)B=[L].concat(B),++j;return q8(U,B,j)},_.precision=_.sd=function(U,M){var N,v,L,A=this;if(U!=null&&U!==!!U){if(O(U,1,G),M==null)M=t;else O(M,0,8);return v0(new g(A),U,M)}if(!(N=A.c))return null;if(L=N.length-1,v=L*H+1,L=N[L]){for(;L%10==0;L/=10,v--);for(L=N[0];L>=10;L/=10,v++);}if(U&&A.e+1>v)v=A.e+1;return v},_.shiftedBy=function(U){return O(U,-w,w),this.times("1e"+U)},_.squareRoot=_.sqrt=function(){var U,M,N,v,L,A=this,j=A.c,B=A.s,R=A.e,E=o+4,C=new g("0.5");if(B!==1||!j||!j[0])return new g(!B||B<0&&(!j||j[0])?NaN:j?A:1/0);if(B=Math.sqrt(+n0(A)),B==0||B==1/0){if(M=I(j),(M.length+R)%2==0)M+="0";if(B=Math.sqrt(+M),R=T((R+1)/2)-(R<0||R%2),B==1/0)M="5e"+R;else M=B.toExponential(),M=M.slice(0,M.indexOf("e")+1)+R;N=new g(M)}else N=new g(B+"");if(N.c[0]){if(R=N.e,B=R+E,B<3)B=0;for(;;)if(L=N,N=C.times(L.plus(S(A,L,E,1))),I(L.c).slice(0,B)===(M=I(N.c)).slice(0,B)){if(N.e<R)--B;if(M=M.slice(B-3,B+1),M=="9999"||!v&&M=="4999"){if(!v){if(v0(L,L.e+o+2,0),L.times(L).eq(A)){N=L;break}}E+=4,B+=4,v=1}else{if(!+M||!+M.slice(1)&&M.charAt(0)=="5")v0(N,N.e+o+2,1),U=!N.times(N).eq(A);break}}}return v0(N,N.e+o+1,t,U)},_.toExponential=function(U,M){if(U!=null)O(U,0,G),U++;return K8(this,U,M,1)},_.toFixed=function(U,M){if(U!=null)O(U,0,G),U=U+this.e+1;return K8(this,U,M)},_.toFormat=function(U,M,N){var v,L=this;if(N==null)if(U!=null&&M&&typeof M=="object")N=M,M=null;else if(U&&typeof U=="object")N=U,U=M=null;else N=H4;else if(typeof N!="object")throw Error(J+"Argument not an object: "+N);if(v=L.toFixed(U,M),L.c){var A,j=v.split("."),B=+N.groupSize,R=+N.secondaryGroupSize,E=N.groupSeparator||"",C=j[0],k=j[1],c=L.s<0,p=c?C.slice(1):C,Q0=p.length;if(R)A=B,B=R,R=A,Q0-=A;if(B>0&&Q0>0){A=Q0%B||B,C=p.substr(0,A);for(;A<Q0;A+=B)C+=E+p.substr(A,B);if(R>0)C+=E+p.slice(A);if(c)C="-"+C}v=k?C+(N.decimalSeparator||"")+((R=+N.fractionGroupSize)?k.replace(new RegExp("\\d{"+R+"}\\B","g"),"$&"+(N.fractionGroupSeparator||"")):k):C}return(N.prefix||"")+v+(N.suffix||"")},_.toFraction=function(U){var M,N,v,L,A,j,B,R,E,C,k,c,p=this,Q0=p.c;if(U!=null){if(B=new g(U),!B.isInteger()&&(B.c||B.s!==1)||B.lt(n))throw Error(J+"Argument "+(B.isInteger()?"out of range: ":"not an integer: ")+n0(B))}if(!Q0)return new g(p);M=new g(n),E=N=new g(n),v=R=new g(n),c=I(Q0),A=M.e=c.length-p.e-1,M.c[0]=F[(j=A%H)<0?H+j:j],U=!U||B.comparedTo(M)>0?A>0?M:E:B,j=q0,q0=1/0,B=new g(c),R.c[0]=0;for(;;){if(C=S(B,M,0,1),L=N.plus(C.times(v)),L.comparedTo(U)==1)break;N=v,v=L,E=R.plus(C.times(L=E)),R=L,M=B.minus(C.times(L=M)),B=L}return L=S(U.minus(N),v,0,1),R=R.plus(L.times(E)),N=N.plus(L.times(v)),R.s=E.s=p.s,A=A*2,k=S(E,v,A,t).minus(p).abs().comparedTo(S(R,N,A,t).minus(p).abs())<1?[E,v]:[R,N],q0=j,k},_.toNumber=function(){return+n0(this)},_.toPrecision=function(U,M){if(U!=null)O(U,1,G);return K8(this,U,M,2)},_.toString=function(U){var M,N=this,v=N.s,L=N.e;if(L===null)if(v){if(M="Infinity",v<0)M="-"+M}else M="NaN";else{if(U==null)M=L<=J0||L>=$0?x(I(N.c),L):m(I(N.c),L,"0");else if(U===10&&X8)N=v0(new g(N),o+L+1,t),M=m(I(N.c),N.e,"0");else O(U,2,w4.length,"Base"),M=d(m(I(N.c),L,"0"),10,U,v,!0);if(v<0&&N.c[0])M="-"+M}return M},_.valueOf=_.toJSON=function(){return n0(this)},_._isBigNumber=!0,f!=null)g.set(f);return g}function T(f){var S=f|0;return f>0||f===S?S:S-1}function I(f){var S,d,h=1,_=f.length,n=f[0]+"";for(;h<_;){S=f[h++]+"",d=H-S.length;for(;d--;S="0"+S);n+=S}for(_=n.length;n.charCodeAt(--_)===48;);return n.slice(0,_+1||1)}function P(f,S){var d,h,_=f.c,n=S.c,o=f.s,t=S.s,J0=f.e,$0=S.e;if(!o||!t)return null;if(d=_&&!_[0],h=n&&!n[0],d||h)return d?h?0:-t:o;if(o!=t)return o;if(d=o<0,h=J0==$0,!_||!n)return h?0:!_^d?1:-1;if(!h)return J0>$0^d?1:-1;t=(J0=_.length)<($0=n.length)?J0:$0;for(o=0;o<t;o++)if(_[o]!=n[o])return _[o]>n[o]^d?1:-1;return J0==$0?0:J0>$0^d?1:-1}function O(f,S,d,h){if(f<S||f>d||f!==W(f))throw Error(J+(h||"Argument")+(typeof f=="number"?f<S||f>d?" out of range: ":" not an integer: ":" not a primitive number: ")+String(f))}function y(f){var S=f.c.length-1;return T(f.e/H)==S&&f.c[S]%2!=0}function x(f,S){return(f.length>1?f.charAt(0)+"."+f.slice(1):f)+(S<0?"e":"e+")+S}function m(f,S,d){var h,_;if(S<0){for(_=d+".";++S;_+=d);f=_+f}else if(h=f.length,++S>h){for(_=d,S-=h;--S;_+=d);f+=_}else if(S<h)f=f.slice(0,S)+"."+f.slice(S);return f}if($=D(),$.default=$.BigNumber=$,typeof define=="function"&&define.amd)define(function(){return $});else if(typeof z1<"u"&&z1.exports)z1.exports=$;else{if(!Z)Z=typeof self<"u"&&self?self:window;Z.BigNumber=$}})(F$)});var M$=b((qD,D$)=>{var G$=T8(),U$=qD;(function(){function Z(w){return w<10?"0"+w:w}var $=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,Q=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,Y,W,J={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':"\\\"","\\":"\\\\"},K;function q(w){return Q.lastIndex=0,Q.test(w)?'"'+w.replace(Q,function(F){var z=J[F];return typeof z==="string"?z:"\\u"+("0000"+F.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+w+'"'}function H(w,F){var z,G,D,T,I=Y,P,O=F[w],y=O!=null&&(O instanceof G$||G$.isBigNumber(O));if(O&&typeof O==="object"&&typeof O.toJSON==="function")O=O.toJSON(w);if(typeof K==="function")O=K.call(F,w,O);switch(typeof O){case"string":if(y)return O;else return q(O);case"number":return isFinite(O)?String(O):"null";case"boolean":case"null":case"bigint":return String(O);case"object":if(!O)return"null";if(Y+=W,P=[],Object.prototype.toString.apply(O)==="[object Array]"){T=O.length;for(z=0;z<T;z+=1)P[z]=H(z,O)||"null";return D=P.length===0?"[]":Y?`[
8
8
  `+Y+P.join(`,
9
9
  `+Y)+`
10
10
  `+I+"]":"["+P.join(",")+"]",Y=I,D}if(K&&typeof K==="object"){T=K.length;for(z=0;z<T;z+=1)if(typeof K[z]==="string"){if(G=K[z],D=H(G,O),D)P.push(q(G)+(Y?": ":":")+D)}}else Object.keys(O).forEach(function(x){var m=H(x,O);if(m)P.push(q(x)+(Y?": ":":")+m)});return D=P.length===0?"{}":Y?`{
@@ -41,4 +41,4 @@ ${z}`)}return K},b0=DU(DJ);class OZ extends V8{create(Z,$){var Q;let{api_version
41
41
  `,"\r"]);K1.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function IU(Z,$){let W=$!==null&&$!==void 0?$:0,J=Z.indexOf(10,W),K=Z.indexOf(13,W);if(J===-1&&K===-1)return null;let q;if(J!==-1&&K!==-1)q=Math.min(J,K);else q=J!==-1?J:K;if(Z[q]===10)return{preceding:q,index:q+1,carriage:!1};return{preceding:q,index:q+1,carriage:!0}}var t1={off:0,error:200,warn:300,info:400,debug:500},WV=(Z,$,Q)=>{if(!Z)return;if(ZU(t1,Z))return Z;N0(Q).warn(`${$} was set to ${JSON.stringify(Z)}, expected one of ${JSON.stringify(Object.keys(t1))}`);return};function V1(){}function c1(Z,$,Q){if(!$||t1[Z]>t1[Q])return V1;else return $[Z].bind($)}var NU={error:V1,warn:V1,info:V1,debug:V1},VV=new WeakMap;function N0(Z){var $;let Q=Z.logger,Y=($=Z.logLevel)!==null&&$!==void 0?$:"off";if(!Q)return NU;let W=VV.get(Q);if(W&&W[0]===Y)return W[1];let J={error:c1("error",Q,Y),warn:c1("warn",Q,Y),info:c1("info",Q,Y),debug:c1("debug",Q,Y)};return VV.set(Q,[Y,J]),J}var M4=(Z)=>{if(Z.options)Z.options=Object.assign({},Z.options),delete Z.options.headers;if(Z.headers)Z.headers=Object.fromEntries((Z.headers instanceof Headers?[...Z.headers]:Object.entries(Z.headers)).map(([$,Q])=>[$,$.toLowerCase()==="x-goog-api-key"||$.toLowerCase()==="authorization"||$.toLowerCase()==="cookie"||$.toLowerCase()==="set-cookie"?"***":Q]));if("retryOfRequestLogID"in Z){if(Z.retryOfRequestLogID)Z.retryOf=Z.retryOfRequestLogID;delete Z.retryOfRequestLogID}return Z};class k4{constructor(Z,$,Q){this.iterator=Z,this.controller=$,this.client=Q}static fromSSEResponse(Z,$,Q){let Y=!1,W=Q?N0(Q):console;function J(){return m0(this,arguments,function*(){var q,H,w,F;if(Y)throw new C0("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Y=!0;let z=!1;try{try{for(var G=!0,D=u0(TU(Z,$)),T;T=yield r(D.next()),q=T.done,!q;G=!0){F=T.value,G=!1;let I=F;if(z)continue;if(I.data.startsWith("[DONE]")){z=!0;continue}else try{yield yield r(JSON.parse(I.data))}catch(P){throw W.error("Could not parse message into JSON:",I.data),W.error("From chunk:",I.raw),P}}}catch(I){H={error:I}}finally{try{if(!G&&!q&&(w=D.return))yield r(w.call(D))}finally{if(H)throw H.error}}z=!0}catch(I){if(XZ(I))return yield r(void 0);throw I}finally{if(!z)$.abort()}})}return new k4(J,$,Q)}static fromReadableStream(Z,$,Q){let Y=!1;function W(){return m0(this,arguments,function*(){var q,H,w,F;let z=new K1,G=FJ(Z);try{for(var D=!0,T=u0(G),I;I=yield r(T.next()),q=I.done,!q;D=!0){F=I.value,D=!1;let P=F;for(let O of z.decode(P))yield yield r(O)}}catch(P){H={error:P}}finally{try{if(!D&&!q&&(w=T.return))yield r(w.call(T))}finally{if(H)throw H.error}}for(let P of z.flush())yield yield r(P)})}function J(){return m0(this,arguments,function*(){var q,H,w,F;if(Y)throw new C0("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Y=!0;let z=!1;try{try{for(var G=!0,D=u0(W()),T;T=yield r(D.next()),q=T.done,!q;G=!0){F=T.value,G=!1;let I=F;if(z)continue;if(I)yield yield r(JSON.parse(I))}}catch(I){H={error:I}}finally{try{if(!G&&!q&&(w=D.return))yield r(w.call(D))}finally{if(H)throw H.error}}z=!0}catch(I){if(XZ(I))return yield r(void 0);throw I}finally{if(!z)$.abort()}})}return new k4(J,$,Q)}[Symbol.asyncIterator](){return this.iterator()}tee(){let Z=[],$=[],Q=this.iterator(),Y=(W)=>{return{next:()=>{if(W.length===0){let J=Q.next();Z.push(J),$.push(J)}return W.shift()}}};return[new k4(()=>Y(Z),this.controller,this.client),new k4(()=>Y($),this.controller,this.client)]}toReadableStream(){let Z=this,$;return zJ({async start(){$=Z[Symbol.asyncIterator]()},async pull(Q){try{let{value:Y,done:W}=await $.next();if(W)return Q.close();let J=kZ(JSON.stringify(Y)+`
42
42
  `);Q.enqueue(J)}catch(Y){Q.error(Y)}},async cancel(){var Q;await((Q=$.return)===null||Q===void 0?void 0:Q.call($))}})}}function TU(Z,$){return m0(this,arguments,function*(){var Y,W,J,K;if(!Z.body){if($.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new C0("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new C0("Attempted to iterate over a response with no body")}let q=new MJ,H=new K1,w=FJ(Z.body);try{for(var F=!0,z=u0(BU(w)),G;G=yield r(z.next()),Y=G.done,!Y;F=!0){K=G.value,F=!1;let D=K;for(let T of H.decode(D)){let I=q.decode(T);if(I)yield yield r(I)}}}catch(D){W={error:D}}finally{try{if(!F&&!Y&&(J=z.return))yield r(J.call(z))}finally{if(W)throw W.error}}for(let D of H.flush()){let T=q.decode(D);if(T)yield yield r(T)}})}function BU(Z){return m0(this,arguments,function*(){var Q,Y,W,J;try{for(var K=!0,q=u0(Z),H;H=yield r(q.next()),Q=H.done,!Q;K=!0){J=H.value,K=!1;let w=J;if(w==null)continue;let F=w instanceof ArrayBuffer?new Uint8Array(w):typeof w==="string"?kZ(w):w;yield yield r(F)}}catch(w){Y={error:w}}finally{try{if(!K&&!Q&&(W=q.return))yield r(W.call(q))}finally{if(Y)throw Y.error}}})}class MJ{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(Z){if(Z.endsWith("\r"))Z=Z.substring(0,Z.length-1);if(!Z){if(!this.event&&!this.data.length)return null;let W={event:this.event,data:this.data.join(`
43
43
  `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],W}if(this.chunks.push(Z),Z.startsWith(":"))return null;let[$,Q,Y]=LU(Z,":");if(Y.startsWith(" "))Y=Y.substring(1);if($==="event")this.event=Y;else if($==="data")this.data.push(Y);return null}}function LU(Z,$){let Q=Z.indexOf($);if(Q!==-1)return[Z.substring(0,Q),$,Z.substring(Q+$.length)];return[Z,"",""]}async function RU(Z,$){let{response:Q,requestLogID:Y,retryOfRequestLogID:W,startTime:J}=$,K=await(async()=>{var q;if($.options.stream){if(N0(Z).debug("response",Q.status,Q.url,Q.headers,Q.body),$.options.__streamClass)return $.options.__streamClass.fromSSEResponse(Q,$.controller,Z);return k4.fromSSEResponse(Q,$.controller,Z)}if(Q.status===204)return null;if($.options.__binaryResponse)return Q;let H=Q.headers.get("content-type"),w=(q=H===null||H===void 0?void 0:H.split(";")[0])===null||q===void 0?void 0:q.trim();if((w===null||w===void 0?void 0:w.includes("application/json"))||(w===null||w===void 0?void 0:w.endsWith("+json"))){if(Q.headers.get("content-length")==="0")return;return await Q.json()}return await Q.text()})();return N0(Z).debug(`[${Y}] response parsed`,M4({retryOfRequestLogID:W,url:Q.url,status:Q.status,body:K,durationMs:Date.now()-J})),K}class yZ extends Promise{constructor(Z,$,Q=RU){super((Y)=>{Y(null)});this.responsePromise=$,this.parseResponse=Q,this.client=Z}_thenUnwrap(Z){return new yZ(this.client,this.responsePromise,async($,Q)=>Z(await this.parseResponse($,Q),Q))}asResponse(){return this.responsePromise.then((Z)=>Z.response)}async withResponse(){let[Z,$]=await Promise.all([this.parse(),this.asResponse()]);return{data:Z,response:$}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then((Z)=>this.parseResponse(this.client,Z));return this.parsedPromise}then(Z,$){return this.parse().then(Z,$)}catch(Z){return this.parse().catch(Z)}finally(Z){return this.parse().finally(Z)}}var IJ=Symbol("brand.privateNullableHeaders");function*AU(Z){if(!Z)return;if(IJ in Z){let{values:Y,nulls:W}=Z;yield*Y.entries();for(let J of W)yield[J,null];return}let $=!1,Q;if(Z instanceof Headers)Q=Z.entries();else if(ZV(Z))Q=Z;else $=!0,Q=Object.entries(Z!==null&&Z!==void 0?Z:{});for(let Y of Q){let W=Y[0];if(typeof W!=="string")throw TypeError("expected header name to be a string");let J=ZV(Y[1])?Y[1]:[Y[1]],K=!1;for(let q of J){if(q===void 0)continue;if($&&!K)K=!0,yield[W,null];yield[W,q]}}}var Y1=(Z)=>{let $=new Headers,Q=new Set;for(let Y of Z){let W=new Set;for(let[J,K]of AU(Y)){let q=J.toLowerCase();if(!W.has(q))$.delete(J),W.add(q);if(K===null)$.delete(J),Q.add(q);else $.append(J,K),Q.delete(q)}}return{[IJ]:!0,values:$,nulls:Q}},d6=(Z)=>{var $,Q,Y,W,J;if(typeof globalThis.process<"u")return((Q=($=globalThis.process.env)===null||$===void 0?void 0:$[Z])===null||Q===void 0?void 0:Q.trim())||void 0;if(typeof globalThis.Deno<"u")return((J=(W=(Y=globalThis.Deno.env)===null||Y===void 0?void 0:Y.get)===null||W===void 0?void 0:W.call(Y,Z))===null||J===void 0?void 0:J.trim())||void 0;return},NJ;class J8{constructor(Z){var $,Q,Y,W,J,K,q,{baseURL:H=d6("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:w=($=d6("GEMINI_API_KEY"))!==null&&$!==void 0?$:null,apiVersion:F="v1beta"}=Z,z=V4(Z,["baseURL","apiKey","apiVersion"]);let G=Object.assign(Object.assign({apiKey:w,apiVersion:F},z),{baseURL:H||"https://generativelanguage.googleapis.com"});this.baseURL=G.baseURL,this.timeout=(Q=G.timeout)!==null&&Q!==void 0?Q:J8.DEFAULT_TIMEOUT,this.logger=(Y=G.logger)!==null&&Y!==void 0?Y:console;let D="warn";this.logLevel=D,this.logLevel=(J=(W=WV(G.logLevel,"ClientOptions.logLevel",this))!==null&&W!==void 0?W:WV(d6("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&J!==void 0?J:D,this.fetchOptions=G.fetchOptions,this.maxRetries=(K=G.maxRetries)!==null&&K!==void 0?K:2,this.fetch=(q=G.fetch)!==null&&q!==void 0?q:WU(),this.encoder=XU,this._options=G,this.apiKey=w,this.apiVersion=F,this.clientAdapter=G.clientAdapter}withOptions(Z){return new this.constructor(Object.assign(Object.assign(Object.assign({},this._options),{baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,apiVersion:this.apiVersion}),Z))}baseURLOverridden(){return this.baseURL!=="https://generativelanguage.googleapis.com"}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:Z,nulls:$}){if(Z.has("authorization")||Z.has("x-goog-api-key"))return;if(this.apiKey&&Z.get("x-goog-api-key"))return;if($.has("x-goog-api-key"))return;throw Error('Could not resolve authentication method. Expected the apiKey to be set. Or for the "x-goog-api-key" headers to be explicitly omitted')}async authHeaders(Z){let $=Y1([Z.headers]);if($.values.has("authorization")||$.values.has("x-goog-api-key"))return;if(this.apiKey)return Y1([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter&&this.clientAdapter.isVertexAI())return Y1([await this.clientAdapter.getAuthHeaders()]);return}stringifyQuery(Z){return KU(Z)}getUserAgent(){return`${this.constructor.name}/JS ${qU}`}defaultIdempotencyKey(){return`stainless-node-retry-${rG()}`}makeStatusError(Z,$,Q,Y){return T0.generate(Z,$,Q,Y)}buildURL(Z,$,Q){let Y=!this.baseURLOverridden()&&Q||this.baseURL,W=oG(Z)?new URL(Z):new URL(Y+(Y.endsWith("/")&&Z.startsWith("/")?Z.slice(1):Z)),J=this.defaultQuery(),K=Object.fromEntries(W.searchParams);if(!$V(J)||!$V(K))$=Object.assign(Object.assign(Object.assign({},K),J),$);if(typeof $==="object"&&$&&!Array.isArray($))W.search=this.stringifyQuery($);return W.toString()}async prepareOptions(Z){if(this.clientAdapter&&this.clientAdapter.isVertexAI()&&!Z.path.startsWith(`/${this.apiVersion}/projects/`)){let $=Z.path.slice(this.apiVersion.length+1);Z.path=`/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${$}`}}async prepareRequest(Z,{url:$,options:Q}){}get(Z,$){return this.methodRequest("get",Z,$)}post(Z,$){return this.methodRequest("post",Z,$)}patch(Z,$){return this.methodRequest("patch",Z,$)}put(Z,$){return this.methodRequest("put",Z,$)}delete(Z,$){return this.methodRequest("delete",Z,$)}methodRequest(Z,$,Q){return this.request(Promise.resolve(Q).then((Y)=>{return Object.assign({method:Z,path:$},Y)}))}request(Z,$=null){return new yZ(this,this.makeRequest(Z,$,void 0))}async makeRequest(Z,$,Q){var Y,W,J;let K=await Z,q=(Y=K.maxRetries)!==null&&Y!==void 0?Y:this.maxRetries;if($==null)$=q;await this.prepareOptions(K);let{req:H,url:w,timeout:F}=await this.buildRequest(K,{retryCount:q-$});await this.prepareRequest(H,{url:w,options:K});let z="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),G=Q===void 0?"":`, retryOf: ${Q}`,D=Date.now();if(N0(this).debug(`[${z}] sending request`,M4({retryOfRequestLogID:Q,method:K.method,url:w,options:K,headers:H.headers})),(W=K.signal)===null||W===void 0?void 0:W.aborted)throw new o1;let T=new AbortController,I=await this.fetchWithTimeout(w,H,F,T).catch(KZ),P=Date.now();if(I instanceof globalThis.Error){let y=`retrying, ${$} attempts remaining`;if((J=K.signal)===null||J===void 0?void 0:J.aborted)throw new o1;let x=XZ(I)||/timed? ?out/i.test(String(I)+("cause"in I?String(I.cause):""));if($)return N0(this).info(`[${z}] connection ${x?"timed out":"failed"} - ${y}`),N0(this).debug(`[${z}] connection ${x?"timed out":"failed"} (${y})`,M4({retryOfRequestLogID:Q,url:w,durationMs:P-D,message:I.message})),this.retryRequest(K,$,Q!==null&&Q!==void 0?Q:z);if(N0(this).info(`[${z}] connection ${x?"timed out":"failed"} - error; no more retries left`),N0(this).debug(`[${z}] connection ${x?"timed out":"failed"} (error; no more retries left)`,M4({retryOfRequestLogID:Q,url:w,durationMs:P-D,message:I.message})),x)throw new BZ;throw new X1({cause:I})}let O=`[${z}${G}] ${H.method} ${w} ${I.ok?"succeeded":"failed"} with status ${I.status} in ${P-D}ms`;if(!I.ok){let y=await this.shouldRetry(I);if($&&y){let h=`retrying, ${$} attempts remaining`;return await JU(I.body),N0(this).info(`${O} - ${h}`),N0(this).debug(`[${z}] response error (${h})`,M4({retryOfRequestLogID:Q,url:I.url,status:I.status,headers:I.headers,durationMs:P-D})),this.retryRequest(K,$,Q!==null&&Q!==void 0?Q:z,I.headers)}let x=y?"error; no more retries left":"error; not retryable";N0(this).info(`${O} - ${x}`);let m=await I.text().catch((h)=>KZ(h).message),f=QU(m),S=f?void 0:m;throw N0(this).debug(`[${z}] response error (${x})`,M4({retryOfRequestLogID:Q,url:I.url,status:I.status,headers:I.headers,message:S,durationMs:Date.now()-D})),this.makeStatusError(I.status,f,S,I.headers)}return N0(this).info(O),N0(this).debug(`[${z}] response start`,M4({retryOfRequestLogID:Q,url:I.url,status:I.status,headers:I.headers,durationMs:P-D})),{response:I,options:K,controller:T,requestLogID:z,retryOfRequestLogID:Q,startTime:D}}async fetchWithTimeout(Z,$,Q,Y){let W=$||{},{signal:J,method:K}=W,q=V4(W,["signal","method"]),H=this._makeAbort(Y);if(J)J.addEventListener("abort",H,{once:!0});let w=setTimeout(H,Q),F=globalThis.ReadableStream&&q.body instanceof globalThis.ReadableStream||typeof q.body==="object"&&q.body!==null&&Symbol.asyncIterator in q.body,z=Object.assign(Object.assign(Object.assign({signal:Y.signal},F?{duplex:"half"}:{}),{method:"GET"}),q);if(K)z.method=K.toUpperCase();try{return await this.fetch.call(void 0,Z,z)}finally{clearTimeout(w)}}async shouldRetry(Z){let $=Z.headers.get("x-should-retry");if($==="true")return!0;if($==="false")return!1;if(Z.status===408)return!0;if(Z.status===409)return!0;if(Z.status===429)return!0;if(Z.status>=500)return!0;return!1}async retryRequest(Z,$,Q,Y){var W;let J,K=Y===null||Y===void 0?void 0:Y.get("retry-after-ms");if(K){let H=parseFloat(K);if(!Number.isNaN(H))J=H}let q=Y===null||Y===void 0?void 0:Y.get("retry-after");if(q&&!J){let H=parseFloat(q);if(!Number.isNaN(H))J=H*1000;else J=Date.parse(q)-Date.now()}if(J===void 0){let H=(W=Z.maxRetries)!==null&&W!==void 0?W:this.maxRetries;J=this.calculateDefaultRetryTimeoutMillis($,H)}return await YU(J),this.makeRequest(Z,$-1,Q)}calculateDefaultRetryTimeoutMillis(Z,$){let W=$-Z,J=Math.min(0.5*Math.pow(2,W),8),K=1-Math.random()*0.25;return J*K*1000}async buildRequest(Z,{retryCount:$=0}={}){var Q,Y,W;let J=Object.assign({},Z),{method:K,path:q,query:H,defaultBaseURL:w}=J,F=this.buildURL(q,H,w);if("timeout"in J)$U("timeout",J.timeout);J.timeout=(Q=J.timeout)!==null&&Q!==void 0?Q:this.timeout;let{bodyHeaders:z,body:G}=this.buildBody({options:J}),D=await this.buildHeaders({options:Z,method:K,bodyHeaders:z,retryCount:$});return{req:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({method:K,headers:D},J.signal&&{signal:J.signal}),globalThis.ReadableStream&&G instanceof globalThis.ReadableStream&&{duplex:"half"}),G&&{body:G}),(Y=this.fetchOptions)!==null&&Y!==void 0?Y:{}),(W=J.fetchOptions)!==null&&W!==void 0?W:{}),url:F,timeout:J.timeout}}async buildHeaders({options:Z,method:$,bodyHeaders:Q,retryCount:Y}){let W={};if(this.idempotencyHeader&&$!=="get"){if(!Z.idempotencyKey)Z.idempotencyKey=this.defaultIdempotencyKey();W[this.idempotencyHeader]=Z.idempotencyKey}let J=await this.authHeaders(Z),K=Y1([W,{Accept:"application/json","User-Agent":this.getUserAgent()},this._options.defaultHeaders,Q,Z.headers,J]);return this.validateHeaders(K),K.values}_makeAbort(Z){return()=>Z.abort()}buildBody({options:{body:Z,headers:$}}){if(!Z)return{bodyHeaders:void 0,body:void 0};let Q=Y1([$]);if(ArrayBuffer.isView(Z)||Z instanceof ArrayBuffer||Z instanceof DataView||typeof Z==="string"&&Q.values.has("content-type")||globalThis.Blob&&Z instanceof globalThis.Blob||Z instanceof FormData||Z instanceof URLSearchParams||globalThis.ReadableStream&&Z instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:Z};else if(typeof Z==="object"&&((Symbol.asyncIterator in Z)||(Symbol.iterator in Z)&&("next"in Z)&&typeof Z.next==="function"))return{bodyHeaders:void 0,body:VU(Z)};else if(typeof Z==="object"&&Q.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(Z)};else return this.encoder({body:Z,headers:Q})}}J8.DEFAULT_TIMEOUT=60000;class w0 extends J8{constructor(){super(...arguments);this.interactions=new jZ(this),this.webhooks=new hZ(this)}}NJ=w0;w0.GeminiNextGenAPIClient=NJ;w0.GeminiNextGenAPIClientError=C0;w0.APIError=T0;w0.APIConnectionError=X1;w0.APIConnectionTimeoutError=BZ;w0.APIUserAbortError=o1;w0.NotFoundError=PZ;w0.ConflictError=SZ;w0.RateLimitError=vZ;w0.BadRequestError=LZ;w0.AuthenticationError=RZ;w0.InternalServerError=EZ;w0.PermissionDeniedError=AZ;w0.UnprocessableEntityError=CZ;w0.toFile=GU;w0.Interactions=jZ;w0.Webhooks=hZ;var JV="x-goog-api-key",W1="https://www.googleapis.com/auth/cloud-platform";class TJ{constructor(Z){if(Z.apiKey!==void 0){this.apiKey=Z.apiKey;return}let $=PU(Z.googleAuthOptions);this.googleAuth=new KV.GoogleAuth($)}async addAuthHeaders(Z,$){if(this.apiKey!==void 0){if(this.apiKey.startsWith("auth_tokens/"))throw Error("Ephemeral tokens are only supported by the live API.");this.addKeyHeader(Z);return}return this.addGoogleAuthHeaders(Z,$)}addKeyHeader(Z){if(Z.get(JV)!==null)return;if(this.apiKey===void 0)throw Error("Trying to set API key header but apiKey is not set");Z.append(JV,this.apiKey)}async addGoogleAuthHeaders(Z,$){if(this.googleAuth===void 0)throw Error("Trying to set google-auth headers but googleAuth is unset");let Q=await this.googleAuth.getRequestHeaders($);for(let[Y,W]of Q){if(Z.get(Y)!==null)continue;Z.append(Y,W)}}}function PU(Z){let $;if(!Z)return $={scopes:[W1]},$;else{if($=Z,!$.scopes)return $.scopes=[W1],$;else if(typeof $.scopes==="string"&&$.scopes!==W1||Array.isArray($.scopes)&&$.scopes.indexOf(W1)<0)throw Error(`Invalid auth scopes. Scopes must include: ${W1}`);return $}}class BJ{async download(Z,$){if(Z.downloadPath){let Q=await SU(Z,$);if(Q instanceof I4){let Y=Jw(Z.downloadPath);Kw.fromWeb(Q.responseInternal.body).pipe(Y),await qw(Y)}else try{await Xw(Z.downloadPath,Q,{encoding:"base64"})}catch(Y){throw Error(`Failed to write file to ${Z.downloadPath}: ${Y}`)}}}}async function SU(Z,$){var Q,Y,W;let J=NZ(Z.file);if(J!==void 0)return await $.request({path:`files/${J}:download`,httpMethod:"GET",queryParams:{alt:"media"},httpOptions:(Q=Z.config)===null||Q===void 0?void 0:Q.httpOptions,abortSignal:(Y=Z.config)===null||Y===void 0?void 0:Y.abortSignal});else if(_V(Z.file)){let K=(W=Z.file.video)===null||W===void 0?void 0:W.videoBytes;if(typeof K==="string")return K;else throw Error("Failed to download generated video, Uri or videoBytes not found.")}else if(hV(Z.file)){let K=Z.file.videoBytes;if(typeof K==="string")return K;else throw Error("Failed to download video, Uri or videoBytes not found.")}else throw Error("Unsupported file type")}class LJ{create(Z,$,Q){return new RJ(Z,$,Q)}}class RJ{constructor(Z,$,Q){this.url=Z,this.headers=$,this.callbacks=Q}connect(){this.ws=new qV.WebSocket(this.url,{headers:this.headers}),this.ws.onopen=this.callbacks.onopen,this.ws.onerror=this.callbacks.onerror,this.ws.onclose=this.callbacks.onclose,this.ws.onmessage=this.callbacks.onmessage}send(Z){if(this.ws===void 0)throw Error("WebSocket is not connected");this.ws.send(Z)}close(){if(this.ws===void 0)throw Error("WebSocket is not connected");this.ws.close()}}function CU(Z,$){let Q={},Y=V(Z,["name"]);if(Y!=null)X(Q,["_url","name"],Y);return Q}function vU(Z,$){let Q={},Y=V(Z,["name"]);if(Y!=null)X(Q,["_url","name"],Y);return Q}function EU(Z,$){let Q={},Y=V(Z,["sdkHttpResponse"]);if(Y!=null)X(Q,["sdkHttpResponse"],Y);return Q}function OU(Z,$){let Q={},Y=V(Z,["sdkHttpResponse"]);if(Y!=null)X(Q,["sdkHttpResponse"],Y);return Q}function jU(Z,$,Q){let Y={};if(V(Z,["validationDataset"])!==void 0)throw Error("validationDataset parameter is not supported in Gemini API.");let W=V(Z,["tunedModelDisplayName"]);if($!==void 0&&W!=null)X($,["displayName"],W);if(V(Z,["description"])!==void 0)throw Error("description parameter is not supported in Gemini API.");let J=V(Z,["epochCount"]);if($!==void 0&&J!=null)X($,["tuningTask","hyperparameters","epochCount"],J);let K=V(Z,["learningRateMultiplier"]);if(K!=null)X(Y,["tuningTask","hyperparameters","learningRateMultiplier"],K);if(V(Z,["exportLastCheckpointOnly"])!==void 0)throw Error("exportLastCheckpointOnly parameter is not supported in Gemini API.");if(V(Z,["preTunedModelCheckpointId"])!==void 0)throw Error("preTunedModelCheckpointId parameter is not supported in Gemini API.");if(V(Z,["adapterSize"])!==void 0)throw Error("adapterSize parameter is not supported in Gemini API.");if(V(Z,["tuningMode"])!==void 0)throw Error("tuningMode parameter is not supported in Gemini API.");if(V(Z,["customBaseModel"])!==void 0)throw Error("customBaseModel parameter is not supported in Gemini API.");let q=V(Z,["batchSize"]);if($!==void 0&&q!=null)X($,["tuningTask","hyperparameters","batchSize"],q);let H=V(Z,["learningRate"]);if($!==void 0&&H!=null)X($,["tuningTask","hyperparameters","learningRate"],H);if(V(Z,["labels"])!==void 0)throw Error("labels parameter is not supported in Gemini API.");if(V(Z,["beta"])!==void 0)throw Error("beta parameter is not supported in Gemini API.");if(V(Z,["baseTeacherModel"])!==void 0)throw Error("baseTeacherModel parameter is not supported in Gemini API.");if(V(Z,["tunedTeacherModelSource"])!==void 0)throw Error("tunedTeacherModelSource parameter is not supported in Gemini API.");if(V(Z,["sftLossWeightMultiplier"])!==void 0)throw Error("sftLossWeightMultiplier parameter is not supported in Gemini API.");if(V(Z,["outputUri"])!==void 0)throw Error("outputUri parameter is not supported in Gemini API.");if(V(Z,["encryptionSpec"])!==void 0)throw Error("encryptionSpec parameter is not supported in Gemini API.");return Y}function _U(Z,$,Q){let Y={},W=V(Q,["config","method"]);if(W===void 0)W="SUPERVISED_FINE_TUNING";if(W==="SUPERVISED_FINE_TUNING"){let S=V(Z,["validationDataset"]);if($!==void 0&&S!=null)X($,["supervisedTuningSpec"],l6(S))}else if(W==="PREFERENCE_TUNING"){let S=V(Z,["validationDataset"]);if($!==void 0&&S!=null)X($,["preferenceOptimizationSpec"],l6(S))}else if(W==="DISTILLATION"){let S=V(Z,["validationDataset"]);if($!==void 0&&S!=null)X($,["distillationSpec"],l6(S))}let J=V(Z,["tunedModelDisplayName"]);if($!==void 0&&J!=null)X($,["tunedModelDisplayName"],J);let K=V(Z,["description"]);if($!==void 0&&K!=null)X($,["description"],K);let q=V(Q,["config","method"]);if(q===void 0)q="SUPERVISED_FINE_TUNING";if(q==="SUPERVISED_FINE_TUNING"){let S=V(Z,["epochCount"]);if($!==void 0&&S!=null)X($,["supervisedTuningSpec","hyperParameters","epochCount"],S)}else if(q==="PREFERENCE_TUNING"){let S=V(Z,["epochCount"]);if($!==void 0&&S!=null)X($,["preferenceOptimizationSpec","hyperParameters","epochCount"],S)}else if(q==="DISTILLATION"){let S=V(Z,["epochCount"]);if($!==void 0&&S!=null)X($,["distillationSpec","hyperParameters","epochCount"],S)}let H=V(Q,["config","method"]);if(H===void 0)H="SUPERVISED_FINE_TUNING";if(H==="SUPERVISED_FINE_TUNING"){let S=V(Z,["learningRateMultiplier"]);if($!==void 0&&S!=null)X($,["supervisedTuningSpec","hyperParameters","learningRateMultiplier"],S)}else if(H==="PREFERENCE_TUNING"){let S=V(Z,["learningRateMultiplier"]);if($!==void 0&&S!=null)X($,["preferenceOptimizationSpec","hyperParameters","learningRateMultiplier"],S)}else if(H==="DISTILLATION"){let S=V(Z,["learningRateMultiplier"]);if($!==void 0&&S!=null)X($,["distillationSpec","hyperParameters","learningRateMultiplier"],S)}let w=V(Q,["config","method"]);if(w===void 0)w="SUPERVISED_FINE_TUNING";if(w==="SUPERVISED_FINE_TUNING"){let S=V(Z,["exportLastCheckpointOnly"]);if($!==void 0&&S!=null)X($,["supervisedTuningSpec","exportLastCheckpointOnly"],S)}else if(w==="PREFERENCE_TUNING"){let S=V(Z,["exportLastCheckpointOnly"]);if($!==void 0&&S!=null)X($,["preferenceOptimizationSpec","exportLastCheckpointOnly"],S)}else if(w==="DISTILLATION"){let S=V(Z,["exportLastCheckpointOnly"]);if($!==void 0&&S!=null)X($,["distillationSpec","exportLastCheckpointOnly"],S)}let F=V(Q,["config","method"]);if(F===void 0)F="SUPERVISED_FINE_TUNING";if(F==="SUPERVISED_FINE_TUNING"){let S=V(Z,["adapterSize"]);if($!==void 0&&S!=null)X($,["supervisedTuningSpec","hyperParameters","adapterSize"],S)}else if(F==="PREFERENCE_TUNING"){let S=V(Z,["adapterSize"]);if($!==void 0&&S!=null)X($,["preferenceOptimizationSpec","hyperParameters","adapterSize"],S)}else if(F==="DISTILLATION"){let S=V(Z,["adapterSize"]);if($!==void 0&&S!=null)X($,["distillationSpec","hyperParameters","adapterSize"],S)}let z=V(Q,["config","method"]);if(z===void 0)z="SUPERVISED_FINE_TUNING";if(z==="SUPERVISED_FINE_TUNING"){let S=V(Z,["tuningMode"]);if($!==void 0&&S!=null)X($,["supervisedTuningSpec","tuningMode"],S)}else if(z==="DISTILLATION"){let S=V(Z,["tuningMode"]);if($!==void 0&&S!=null)X($,["distillationSpec","tuningMode"],S)}let G=V(Z,["customBaseModel"]);if($!==void 0&&G!=null)X($,["customBaseModel"],G);let D=V(Q,["config","method"]);if(D===void 0)D="SUPERVISED_FINE_TUNING";if(D==="SUPERVISED_FINE_TUNING"){let S=V(Z,["batchSize"]);if($!==void 0&&S!=null)X($,["supervisedTuningSpec","hyperParameters","batchSize"],S)}else if(D==="DISTILLATION"){let S=V(Z,["batchSize"]);if($!==void 0&&S!=null)X($,["distillationSpec","hyperParameters","batchSize"],S)}let T=V(Q,["config","method"]);if(T===void 0)T="SUPERVISED_FINE_TUNING";if(T==="SUPERVISED_FINE_TUNING"){let S=V(Z,["learningRate"]);if($!==void 0&&S!=null)X($,["supervisedTuningSpec","hyperParameters","learningRate"],S)}else if(T==="DISTILLATION"){let S=V(Z,["learningRate"]);if($!==void 0&&S!=null)X($,["distillationSpec","hyperParameters","learningRate"],S)}let I=V(Z,["labels"]);if($!==void 0&&I!=null)X($,["labels"],I);let P=V(Z,["beta"]);if($!==void 0&&P!=null)X($,["preferenceOptimizationSpec","hyperParameters","beta"],P);let O=V(Z,["baseTeacherModel"]);if($!==void 0&&O!=null)X($,["distillationSpec","baseTeacherModel"],O);let y=V(Z,["tunedTeacherModelSource"]);if($!==void 0&&y!=null)X($,["distillationSpec","tunedTeacherModelSource"],y);let x=V(Z,["sftLossWeightMultiplier"]);if($!==void 0&&x!=null)X($,["distillationSpec","hyperParameters","sftLossWeightMultiplier"],x);let m=V(Z,["outputUri"]);if($!==void 0&&m!=null)X($,["outputUri"],m);let f=V(Z,["encryptionSpec"]);if($!==void 0&&f!=null)X($,["encryptionSpec"],f);return Y}function hU(Z,$){let Q={},Y=V(Z,["baseModel"]);if(Y!=null)X(Q,["baseModel"],Y);let W=V(Z,["preTunedModel"]);if(W!=null)X(Q,["preTunedModel"],W);let J=V(Z,["trainingDataset"]);if(J!=null)uU(J);let K=V(Z,["config"]);if(K!=null)jU(K,Q);return Q}function kU(Z,$){let Q={},Y=V(Z,["baseModel"]);if(Y!=null)X(Q,["baseModel"],Y);let W=V(Z,["preTunedModel"]);if(W!=null)X(Q,["preTunedModel"],W);let J=V(Z,["trainingDataset"]);if(J!=null)dU(J,Q,$);let K=V(Z,["config"]);if(K!=null)_U(K,Q,$);return Q}function yU(Z,$){let Q={},Y=V(Z,["name"]);if(Y!=null)X(Q,["_url","name"],Y);return Q}function xU(Z,$){let Q={},Y=V(Z,["name"]);if(Y!=null)X(Q,["_url","name"],Y);return Q}function fU(Z,$,Q){let Y={},W=V(Z,["pageSize"]);if($!==void 0&&W!=null)X($,["_query","pageSize"],W);let J=V(Z,["pageToken"]);if($!==void 0&&J!=null)X($,["_query","pageToken"],J);let K=V(Z,["filter"]);if($!==void 0&&K!=null)X($,["_query","filter"],K);return Y}function gU(Z,$){let Q={},Y=V(Z,["config"]);if(Y!=null)fU(Y,Q);return Q}function bU(Z,$){let Q={},Y=V(Z,["sdkHttpResponse"]);if(Y!=null)X(Q,["sdkHttpResponse"],Y);let W=V(Z,["nextPageToken"]);if(W!=null)X(Q,["nextPageToken"],W);let J=V(Z,["tuningJobs"]);if(J!=null){let K=J;if(Array.isArray(K))K=K.map((q)=>{return wZ(q)});X(Q,["tuningJobs"],K)}return Q}function mU(Z,$){let Q={},Y=V(Z,["name"]);if(Y!=null)X(Q,["model"],Y);let W=V(Z,["name"]);if(W!=null)X(Q,["endpoint"],W);return Q}function uU(Z,$){let Q={};if(V(Z,["gcsUri"])!==void 0)throw Error("gcsUri parameter is not supported in Gemini API.");if(V(Z,["vertexDatasetResource"])!==void 0)throw Error("vertexDatasetResource parameter is not supported in Gemini API.");let Y=V(Z,["examples"]);if(Y!=null){let W=Y;if(Array.isArray(W))W=W.map((J)=>{return J});X(Q,["examples","examples"],W)}return Q}function dU(Z,$,Q){let Y={},W=V(Q,["config","method"]);if(W===void 0)W="SUPERVISED_FINE_TUNING";if(W==="SUPERVISED_FINE_TUNING"){let K=V(Z,["gcsUri"]);if($!==void 0&&K!=null)X($,["supervisedTuningSpec","trainingDatasetUri"],K)}else if(W==="PREFERENCE_TUNING"){let K=V(Z,["gcsUri"]);if($!==void 0&&K!=null)X($,["preferenceOptimizationSpec","trainingDatasetUri"],K)}else if(W==="DISTILLATION"){let K=V(Z,["gcsUri"]);if($!==void 0&&K!=null)X($,["distillationSpec","promptDatasetUri"],K)}let J=V(Q,["config","method"]);if(J===void 0)J="SUPERVISED_FINE_TUNING";if(J==="SUPERVISED_FINE_TUNING"){let K=V(Z,["vertexDatasetResource"]);if($!==void 0&&K!=null)X($,["supervisedTuningSpec","trainingDatasetUri"],K)}else if(J==="PREFERENCE_TUNING"){let K=V(Z,["vertexDatasetResource"]);if($!==void 0&&K!=null)X($,["preferenceOptimizationSpec","trainingDatasetUri"],K)}else if(J==="DISTILLATION"){let K=V(Z,["vertexDatasetResource"]);if($!==void 0&&K!=null)X($,["distillationSpec","promptDatasetUri"],K)}if(V(Z,["examples"])!==void 0)throw Error("examples parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");return Y}function lU(Z,$){let Q={},Y=V(Z,["sdkHttpResponse"]);if(Y!=null)X(Q,["sdkHttpResponse"],Y);let W=V(Z,["name"]);if(W!=null)X(Q,["name"],W);let J=V(Z,["state"]);if(J!=null)X(Q,["state"],jV(J));let K=V(Z,["createTime"]);if(K!=null)X(Q,["createTime"],K);let q=V(Z,["tuningTask","startTime"]);if(q!=null)X(Q,["startTime"],q);let H=V(Z,["tuningTask","completeTime"]);if(H!=null)X(Q,["endTime"],H);let w=V(Z,["updateTime"]);if(w!=null)X(Q,["updateTime"],w);let F=V(Z,["description"]);if(F!=null)X(Q,["description"],F);let z=V(Z,["baseModel"]);if(z!=null)X(Q,["baseModel"],z);let G=V(Z,["_self"]);if(G!=null)X(Q,["tunedModel"],mU(G));return Q}function wZ(Z,$){let Q={},Y=V(Z,["sdkHttpResponse"]);if(Y!=null)X(Q,["sdkHttpResponse"],Y);let W=V(Z,["name"]);if(W!=null)X(Q,["name"],W);let J=V(Z,["state"]);if(J!=null)X(Q,["state"],jV(J));let K=V(Z,["createTime"]);if(K!=null)X(Q,["createTime"],K);let q=V(Z,["startTime"]);if(q!=null)X(Q,["startTime"],q);let H=V(Z,["endTime"]);if(H!=null)X(Q,["endTime"],H);let w=V(Z,["updateTime"]);if(w!=null)X(Q,["updateTime"],w);let F=V(Z,["error"]);if(F!=null)X(Q,["error"],F);let z=V(Z,["description"]);if(z!=null)X(Q,["description"],z);let G=V(Z,["baseModel"]);if(G!=null)X(Q,["baseModel"],G);let D=V(Z,["tunedModel"]);if(D!=null)X(Q,["tunedModel"],D);let T=V(Z,["preTunedModel"]);if(T!=null)X(Q,["preTunedModel"],T);let I=V(Z,["supervisedTuningSpec"]);if(I!=null)X(Q,["supervisedTuningSpec"],I);let P=V(Z,["preferenceOptimizationSpec"]);if(P!=null)X(Q,["preferenceOptimizationSpec"],P);let O=V(Z,["distillationSpec"]);if(O!=null)X(Q,["distillationSpec"],O);let y=V(Z,["tuningDataStats"]);if(y!=null)X(Q,["tuningDataStats"],y);let x=V(Z,["encryptionSpec"]);if(x!=null)X(Q,["encryptionSpec"],x);let m=V(Z,["partnerModelTuningSpec"]);if(m!=null)X(Q,["partnerModelTuningSpec"],m);let f=V(Z,["customBaseModel"]);if(f!=null)X(Q,["customBaseModel"],f);let S=V(Z,["evaluateDatasetRuns"]);if(S!=null){let R0=S;if(Array.isArray(R0))R0=R0.map((H0)=>{return H0});X(Q,["evaluateDatasetRuns"],R0)}let d=V(Z,["experiment"]);if(d!=null)X(Q,["experiment"],d);let h=V(Z,["fullFineTuningSpec"]);if(h!=null)X(Q,["fullFineTuningSpec"],h);let _=V(Z,["labels"]);if(_!=null)X(Q,["labels"],_);let n=V(Z,["outputUri"]);if(n!=null)X(Q,["outputUri"],n);let o=V(Z,["pipelineJob"]);if(o!=null)X(Q,["pipelineJob"],o);let t=V(Z,["serviceAccount"]);if(t!=null)X(Q,["serviceAccount"],t);let J0=V(Z,["tunedModelDisplayName"]);if(J0!=null)X(Q,["tunedModelDisplayName"],J0);let $0=V(Z,["tuningJobState"]);if($0!=null)X(Q,["tuningJobState"],$0);let V0=V(Z,["veoTuningSpec"]);if(V0!=null)X(Q,["veoTuningSpec"],V0);let q0=V(Z,["distillationSamplingSpec"]);if(q0!=null)X(Q,["distillationSamplingSpec"],q0);let L0=V(Z,["tuningJobMetadata"]);if(L0!=null)X(Q,["tuningJobMetadata"],L0);return Q}function cU(Z,$){let Q={},Y=V(Z,["sdkHttpResponse"]);if(Y!=null)X(Q,["sdkHttpResponse"],Y);let W=V(Z,["name"]);if(W!=null)X(Q,["name"],W);let J=V(Z,["metadata"]);if(J!=null)X(Q,["metadata"],J);let K=V(Z,["done"]);if(K!=null)X(Q,["done"],K);let q=V(Z,["error"]);if(q!=null)X(Q,["error"],q);return Q}function l6(Z,$){let Q={},Y=V(Z,["gcsUri"]);if(Y!=null)X(Q,["validationDatasetUri"],Y);let W=V(Z,["vertexDatasetResource"]);if(W!=null)X(Q,["validationDatasetUri"],W);return Q}class AJ extends a0{constructor(Z){super();this.apiClient=Z,this.list=async($={})=>{return new q4(e0.PAGED_ITEM_TUNING_JOBS,(Q)=>this.listInternal(Q),await this.listInternal($),$)},this.get=async($)=>{return await this.getInternal($)},this.tune=async($)=>{var Q;if(this.apiClient.isVertexAI())if($.baseModel.startsWith("projects/")){let Y={tunedModelName:$.baseModel};if((Q=$.config)===null||Q===void 0?void 0:Q.preTunedModelCheckpointId)Y.checkpointId=$.config.preTunedModelCheckpointId;let W=Object.assign(Object.assign({},$),{preTunedModel:Y});return W.baseModel=void 0,await this.tuneInternal(W)}else{let Y=Object.assign({},$);return await this.tuneInternal(Y)}else{let Y=Object.assign({},$),W=await this.tuneMldevInternal(Y),J="";if(W.metadata!==void 0&&W.metadata.tunedModel!==void 0)J=W.metadata.tunedModel;else if(W.name!==void 0&&W.name.includes("/operations/"))J=W.name.split("/operations/")[0];return{name:J,state:p6.JOB_STATE_QUEUED}}}}async getInternal(Z){var $,Q,Y,W;let J,K="",q={};if(this.apiClient.isVertexAI()){let H=xU(Z);return K=u("{name}",H._url),q=H._query,delete H._url,delete H._query,J=this.apiClient.request({path:K,queryParams:q,body:JSON.stringify(H),httpMethod:"GET",httpOptions:($=Z.config)===null||$===void 0?void 0:$.httpOptions,abortSignal:(Q=Z.config)===null||Q===void 0?void 0:Q.abortSignal}).then((w)=>{return w.json().then((F)=>{let z=F;return z.sdkHttpResponse={headers:w.headers},z})}),J.then((w)=>{return wZ(w)})}else{let H=yU(Z);return K=u("{name}",H._url),q=H._query,delete H._url,delete H._query,J=this.apiClient.request({path:K,queryParams:q,body:JSON.stringify(H),httpMethod:"GET",httpOptions:(Y=Z.config)===null||Y===void 0?void 0:Y.httpOptions,abortSignal:(W=Z.config)===null||W===void 0?void 0:W.abortSignal}).then((w)=>{return w.json().then((F)=>{let z=F;return z.sdkHttpResponse={headers:w.headers},z})}),J.then((w)=>{return lU(w)})}}async listInternal(Z){var $,Q;let Y,W="",J={};if(this.apiClient.isVertexAI()){let K=gU(Z);return W=u("tuningJobs",K._url),J=K._query,delete K._url,delete K._query,Y=this.apiClient.request({path:W,queryParams:J,body:JSON.stringify(K),httpMethod:"GET",httpOptions:($=Z.config)===null||$===void 0?void 0:$.httpOptions,abortSignal:(Q=Z.config)===null||Q===void 0?void 0:Q.abortSignal}).then((q)=>{return q.json().then((H)=>{let w=H;return w.sdkHttpResponse={headers:q.headers},w})}),Y.then((q)=>{let H=bU(q),w=new DV;return Object.assign(w,H),w})}else throw Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async cancel(Z){var $,Q,Y,W;let J,K="",q={};if(this.apiClient.isVertexAI()){let H=vU(Z);return K=u("{name}:cancel",H._url),q=H._query,delete H._url,delete H._query,J=this.apiClient.request({path:K,queryParams:q,body:JSON.stringify(H),httpMethod:"POST",httpOptions:($=Z.config)===null||$===void 0?void 0:$.httpOptions,abortSignal:(Q=Z.config)===null||Q===void 0?void 0:Q.abortSignal}).then((w)=>{return w.json().then((F)=>{let z=F;return z.sdkHttpResponse={headers:w.headers},z})}),J.then((w)=>{let F=OU(w),z=new t6;return Object.assign(z,F),z})}else{let H=CU(Z);return K=u("{name}:cancel",H._url),q=H._query,delete H._url,delete H._query,J=this.apiClient.request({path:K,queryParams:q,body:JSON.stringify(H),httpMethod:"POST",httpOptions:(Y=Z.config)===null||Y===void 0?void 0:Y.httpOptions,abortSignal:(W=Z.config)===null||W===void 0?void 0:W.abortSignal}).then((w)=>{return w.json().then((F)=>{let z=F;return z.sdkHttpResponse={headers:w.headers},z})}),J.then((w)=>{let F=EU(w),z=new t6;return Object.assign(z,F),z})}}async tuneInternal(Z){var $,Q;let Y,W="",J={};if(this.apiClient.isVertexAI()){let K=kU(Z,Z);return W=u("tuningJobs",K._url),J=K._query,delete K._url,delete K._query,Y=this.apiClient.request({path:W,queryParams:J,body:JSON.stringify(K),httpMethod:"POST",httpOptions:($=Z.config)===null||$===void 0?void 0:$.httpOptions,abortSignal:(Q=Z.config)===null||Q===void 0?void 0:Q.abortSignal}).then((q)=>{return q.json().then((H)=>{let w=H;return w.sdkHttpResponse={headers:q.headers},w})}),Y.then((q)=>{return wZ(q)})}else throw Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async tuneMldevInternal(Z){var $,Q;let Y,W="",J={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");else{let K=hU(Z);return W=u("tunedModels",K._url),J=K._query,delete K._url,delete K._query,Y=this.apiClient.request({path:W,queryParams:J,body:JSON.stringify(K),httpMethod:"POST",httpOptions:($=Z.config)===null||$===void 0?void 0:$.httpOptions,abortSignal:(Q=Z.config)===null||Q===void 0?void 0:Q.abortSignal}).then((q)=>{return q.json().then((H)=>{let w=H;return w.sdkHttpResponse={headers:q.headers},w})}),Y.then((q)=>{return cU(q)})}}}var PJ=8388608,SJ=3,CJ=1000,vJ=2,J4="x-goog-upload-status";async function pU(Z,$,Q,Y){var W;let J=await EJ(Z,$,Q,Y),K=await(J===null||J===void 0?void 0:J.json());if(((W=J===null||J===void 0?void 0:J.headers)===null||W===void 0?void 0:W[J4])!=="final")throw Error("Failed to upload file: Upload status is not finalized.");return K.file}async function iU(Z,$,Q,Y){var W;let J=await EJ(Z,$,Q,Y),K=await(J===null||J===void 0?void 0:J.json());if(((W=J===null||J===void 0?void 0:J.headers)===null||W===void 0?void 0:W[J4])!=="final")throw Error("Failed to upload file: Upload status is not finalized.");let q=FZ(K),H=new $8;return Object.assign(H,q),H}async function EJ(Z,$,Q,Y){var W,J,K;let q=$,H=(Y===null||Y===void 0?void 0:Y.baseUrl)||((W=Q.clientOptions.httpOptions)===null||W===void 0?void 0:W.baseUrl);if(H){let D=new URL(H),T=new URL($);T.protocol=D.protocol,T.host=D.host,T.port=D.port,q=T.toString()}let w=0,F=0,z=new I4(new Response),G="upload";w=Z.size;while(F<w){let D=Math.min(PJ,w-F),T=Z.slice(F,F+D);if(F+D>=w)G+=", finalize";let I=0,P=CJ;while(I<SJ){let O=Object.assign(Object.assign({},(Y===null||Y===void 0?void 0:Y.headers)||{}),{"X-Goog-Upload-Command":G,"X-Goog-Upload-Offset":String(F),"Content-Length":String(D)});if(z=await Q.request({path:"",body:T,httpMethod:"POST",httpOptions:Object.assign(Object.assign({},Y),{apiVersion:"",baseUrl:q,headers:O})}),(J=z===null||z===void 0?void 0:z.headers)===null||J===void 0?void 0:J[J4])break;I++,await OJ(P),P=P*vJ}if(F+=D,((K=z===null||z===void 0?void 0:z.headers)===null||K===void 0?void 0:K[J4])!=="active")break;if(w<=F)throw Error("All content has been uploaded, but the upload status is not finalized.")}return z}async function aU(Z){return{size:Z.size,type:Z.type}}function OJ(Z){return new Promise(($)=>setTimeout($,Z))}class jJ{async stat(Z){let $={size:0,type:void 0};if(typeof Z==="string"){let Q=await Z8.stat(Z);return $.size=Q.size,$.type=this.inferMimeType(Z),$}else return await aU(Z)}async upload(Z,$,Q,Y){if(typeof Z==="string")return await this.uploadFileFromPath(Z,$,Q,Y);else return pU(Z,$,Q,Y)}async uploadToFileSearchStore(Z,$,Q,Y){if(typeof Z==="string")return await this.uploadFileToFileSearchStoreFromPath(Z,$,Q,Y);else return iU(Z,$,Q,Y)}inferMimeType(Z){let $=Z.slice(Z.lastIndexOf(".")+1);return{aac:"audio/aac",abw:"application/x-abiword",arc:"application/x-freearc",avi:"video/x-msvideo",azw:"application/vnd.amazon.ebook",bin:"application/octet-stream",bmp:"image/bmp",bz:"application/x-bzip",bz2:"application/x-bzip2",csh:"application/x-csh",css:"text/css",csv:"text/csv",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",eot:"application/vnd.ms-fontobject",epub:"application/epub+zip",gz:"application/gzip",gif:"image/gif",htm:"text/html",html:"text/html",ico:"image/vnd.microsoft.icon",ics:"text/calendar",jar:"application/java-archive",jpeg:"image/jpeg",jpg:"image/jpeg",js:"text/javascript",json:"application/json",jsonld:"application/ld+json",kml:"application/vnd.google-earth.kml+xml",kmz:"application/vnd.google-earth.kmz+xml",mjs:"text/javascript",mp3:"audio/mpeg",mp4:"video/mp4",mpeg:"video/mpeg",mpkg:"application/vnd.apple.installer+xml",odt:"application/vnd.oasis.opendocument.text",oga:"audio/ogg",ogv:"video/ogg",ogx:"application/ogg",opus:"audio/opus",otf:"font/otf",png:"image/png",pdf:"application/pdf",php:"application/x-httpd-php",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",rar:"application/vnd.rar",rtf:"application/rtf",sh:"application/x-sh",svg:"image/svg+xml",swf:"application/x-shockwave-flash",tar:"application/x-tar",tif:"image/tiff",tiff:"image/tiff",ts:"video/mp2t",ttf:"font/ttf",txt:"text/plain",vsd:"application/vnd.visio",wav:"audio/wav",weba:"audio/webm",webm:"video/webm",webp:"image/webp",woff:"font/woff",woff2:"font/woff2",xhtml:"application/xhtml+xml",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xml:"application/xml",xul:"application/vnd.mozilla.xul+xml",zip:"application/zip","3gp":"video/3gpp","3g2":"video/3gpp2","7z":"application/x-7z-compressed"}[$.toLowerCase()]}async uploadFileFromPath(Z,$,Q,Y){var W;let J=await this.uploadFileFromPathInternal(Z,$,Q,Y),K=await(J===null||J===void 0?void 0:J.json());if(((W=J===null||J===void 0?void 0:J.headers)===null||W===void 0?void 0:W[J4])!=="final")throw Error("Failed to upload file: Upload status is not finalized.");return K.file}async uploadFileToFileSearchStoreFromPath(Z,$,Q,Y){var W;let J=await this.uploadFileFromPathInternal(Z,$,Q,Y),K=await(J===null||J===void 0?void 0:J.json());if(((W=J===null||J===void 0?void 0:J.headers)===null||W===void 0?void 0:W[J4])!=="final")throw Error("Failed to upload file: Upload status is not finalized.");let q=FZ(K),H=new $8;return Object.assign(H,q),H}async uploadFileFromPathInternal(Z,$,Q,Y){var W,J,K;let q=$,H=(Y===null||Y===void 0?void 0:Y.baseUrl)||((W=Q.clientOptions.httpOptions)===null||W===void 0?void 0:W.baseUrl);if(H){let I=new URL(H),P=new URL($);P.protocol=I.protocol,P.host=I.host,P.port=I.port,q=P.toString()}let w=0,F=0,z=new I4(new Response),G="upload",D,T=HV.basename(Z);try{if(D=await Z8.open(Z,"r"),!D)throw Error("Failed to open file");w=(await D.stat()).size;while(F<w){let I=Math.min(PJ,w-F);if(F+I>=w)G+=", finalize";let P=new Uint8Array(I),{bytesRead:O}=await D.read(P,0,I,F);if(O!==I)throw Error(`Failed to read ${I} bytes from file at offset ${F}. bytes actually read: ${O}`);let y=new Blob([P]),x=0,m=CJ;while(x<SJ){let f=Object.assign(Object.assign({},(Y===null||Y===void 0?void 0:Y.headers)||{}),{"X-Goog-Upload-Command":G,"X-Goog-Upload-Offset":String(F),"Content-Length":String(O),"X-Goog-Upload-File-Name":T});if(z=await Q.request({path:"",body:y,httpMethod:"POST",httpOptions:Object.assign(Object.assign({},Y),{apiVersion:"",baseUrl:q,headers:f})}),(J=z===null||z===void 0?void 0:z.headers)===null||J===void 0?void 0:J[J4])break;x++,await OJ(m),m=m*vJ}if(F+=O,((K=z===null||z===void 0?void 0:z.headers)===null||K===void 0?void 0:K[J4])!=="active")break;if(w<=F)throw Error("All content has been uploaded, but the upload status is not finalized.")}return z}finally{if(D)await D.close()}}}class _J extends pV{async registerFiles(Z){if(typeof process>"u"||!process.versions||!process.versions.node)throw Error("registerFiles is only supported in Node.js environments.");let Q=await Z.auth.getRequestHeaders(),Y=Z.config||{},W=Y.httpOptions||{},J=Object.assign({},W.headers||{});if(Q)if(typeof Q[Symbol.iterator]==="function")for(let[K,q]of Q)J[K]=q;else for(let[K,q]of Object.entries(Q))J[K]=q;return this._registerFiles({uris:Z.uris,config:Object.assign(Object.assign({},Y),{httpOptions:Object.assign(Object.assign({},W),{headers:J})})})}}var nU="gl-node/";function rU(Z){var $;if(Z.enterprise!==void 0||Z.vertexai!==void 0){if(Z.enterprise!==void 0&&Z.vertexai!==void 0&&Z.enterprise!==Z.vertexai)throw Error("enterprise and vertexAI flags have conflicting values, please set enterprise value only.");return($=Z.enterprise)!==null&&$!==void 0?$:Z.vertexai}let Q=X4("GOOGLE_GENAI_USE_ENTERPRISE"),Y=X4("GOOGLE_GENAI_USE_VERTEXAI"),W=XV(Q),J=XV(Y);if(Q!==void 0&&Y!==void 0&&W!==J)console.warn("Warning: Both GOOGLE_GENAI_USE_ENTERPRISE and GOOGLE_GENAI_USE_VERTEXAI are set with conflicting values. The value of GOOGLE_GENAI_USE_ENTERPRISE will be used.");if(Q!==void 0)return W;if(Y!==void 0)return J;return!1}class sU{getNextGenClient(){var Z;let $=this.httpOptions;if(this._nextGenClient===void 0)this._nextGenClient=new w0({baseURL:this.apiClient.getBaseUrl(),apiKey:this.apiKey,apiVersion:this.apiClient.getApiVersion(),clientAdapter:this.apiClient,defaultHeaders:this.apiClient.getDefaultHeaders(),timeout:$===null||$===void 0?void 0:$.timeout,maxRetries:(Z=$===null||$===void 0?void 0:$.retryOptions)===null||Z===void 0?void 0:Z.attempts});if($===null||$===void 0?void 0:$.extraBody)console.warn("GoogleGenAI.interactions: Client level httpOptions.extraBody is not supported by the interactions client and will be ignored.");return this._nextGenClient}get interactions(){if(this._interactions!==void 0)return this._interactions;return console.warn("GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions."),this._interactions=this.getNextGenClient().interactions,this._interactions}get webhooks(){if(this._webhooks!==void 0)return this._webhooks;return this._webhooks=this.getNextGenClient().webhooks,this._webhooks}constructor(Z){var $,Q,Y,W;if((Z.project||Z.location)&&Z.apiKey)throw Error("Project/location and API key are mutually exclusive in the client initializer.");this.vertexai=rU(Z);let J=oU(),K=X4("GOOGLE_CLOUD_PROJECT"),q=X4("GOOGLE_CLOUD_LOCATION");if(this.apiKey=($=Z.apiKey)!==null&&$!==void 0?$:J,this.project=(Q=Z.project)!==null&&Q!==void 0?Q:K,this.location=(Y=Z.location)!==null&&Y!==void 0?Y:q,!this.vertexai&&!this.apiKey)console.warn("API key should be set when using the Gemini API.");if(this.vertexai){if((W=Z.googleAuthOptions)===null||W===void 0?void 0:W.credentials)console.debug("The user provided Google Cloud credentials will take precedence over the API key from the environment variable."),this.apiKey=void 0;if((K||q)&&Z.apiKey)console.debug("The user provided Vertex AI API key will take precedence over the project/location from the environment variables."),this.project=void 0,this.location=void 0;else if((Z.project||Z.location)&&J)console.debug("The user provided project/location will take precedence over the API key from the environment variables."),this.apiKey=void 0;else if((K||q)&&J)console.debug("The project/location from the environment variables will take precedence over the API key from the environment variables."),this.apiKey=void 0;if(!this.location&&!this.apiKey)this.location="global"}let H=Fw(Z.httpOptions,this.vertexai,X4("GOOGLE_VERTEX_BASE_URL"),X4("GOOGLE_GEMINI_BASE_URL"));if(H)if(Z.httpOptions)Z.httpOptions.baseUrl=H;else Z.httpOptions={baseUrl:H};this.apiVersion=Z.apiVersion,this.httpOptions=Z.httpOptions;let w=new TJ({apiKey:this.apiKey,googleAuthOptions:Z.googleAuthOptions});this.apiClient=new eV({auth:w,project:this.project,location:this.location,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:this.httpOptions,userAgentExtra:nU+process.version,uploader:new jJ,downloader:new BJ}),this.models=new JJ(this.apiClient),this.live=new WJ(this.apiClient,w,new LJ),this.batches=new mV(this.apiClient),this.chats=new lV(this.models,this.apiClient),this.caches=new uV(this.apiClient),this.files=new _J(this.apiClient),this.operations=new XJ(this.apiClient),this.authTokens=new KJ(this.apiClient),this.tunings=new AJ(this.apiClient),this.fileSearchStores=new HJ(this.apiClient)}}function X4(Z){var $,Q,Y;return(Y=(Q=($=process===null||process===void 0?void 0:process.env)===null||$===void 0?void 0:$[Z])===null||Q===void 0?void 0:Q.trim())!==null&&Y!==void 0?Y:void 0}function XV(Z){if(Z===void 0)return!1;return Z.toLowerCase()==="true"}function oU(){let Z=X4("GOOGLE_API_KEY"),$=X4("GEMINI_API_KEY");if(Z&&$)console.warn("Both GOOGLE_API_KEY and GEMINI_API_KEY are set. Using GOOGLE_API_KEY.");return Z||$||void 0}
44
- export{bW as Ml,mW as Nl,iW as Ol,i6 as Pl,sU as Ql};
44
+ export{bW as jm,mW as km,iW as lm,i6 as mm,sU as nm};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ga as e,Ha as p,Ia as t}from"./chunk-j6dea33m.js";import"./chunk-bv5mh0e0.js";import"./chunk-8r2agmv2.js";import"./chunk-s9yzt7s3.js";import"./chunk-xext4yvc.js";import"./chunk-k2w676wz.js";import"./chunk-wwjqqqr4.js";export{t as kyselyAdapter,e as getKyselyDatabaseType,p as createKyselyAdapter};
@@ -0,0 +1 @@
1
+ import{k as a}from"./chunk-09c03qdg.js";import"./chunk-s9s9hhet.js";import"./chunk-xvpttxen.js";import"./chunk-bxexm2hd.js";import"./chunk-9yn5r2hh.js";import"./chunk-cc9fftnv.js";import"./chunk-62ag2nfa.js";import"./chunk-ch25gq27.js";import"./chunk-h5jre78a.js";import"./chunk-nw03w9pa.js";import"./chunk-csky7q56.js";import"./chunk-q0hrd0yw.js";import"./chunk-6529sh41.js";import"./chunk-vwz2pa54.js";import"./chunk-gra1fhdp.js";import"./chunk-661mcdxj.js";import"./chunk-kp4kn4b4.js";import"./chunk-f03whbny.js";import"./chunk-p48npmbh.js";import"./chunk-g5qfxnz1.js";import"./chunk-94yxj3yy.js";import"./chunk-enq1hf8g.js";import"./chunk-vgwjg37a.js";import"./chunk-33hax7fe.js";import"./chunk-n3vzdzdw.js";import"./chunk-z7b132c0.js";import"./chunk-1ev668rp.js";import"./chunk-mnhg12fm.js";import"./chunk-a80aab0f.js";import"./chunk-0te5kcy3.js";import"./chunk-kmhkhcy6.js";import"./chunk-y8ffp5zj.js";import"./chunk-6w395tfy.js";import"./chunk-rjga1vn2.js";import"./chunk-dgvcraag.js";import"./chunk-39s0cxq1.js";import"./chunk-qk9npww4.js";import"./chunk-y45tzhdn.js";import"./chunk-02tqxzgz.js";import"./chunk-42et2rqa.js";import"./chunk-hsemzjvr.js";import{_h as e,qi as t}from"./chunk-yfgwknpa.js";import"./chunk-wwjqqqr4.js";function o(){let{shareId:s,folderId:n}=r.useParams();return e(a,{shareId:s,initialFolderId:n})}var r=t("/share/$shareId/folders/$folderId")({component:o});export{r as Route};
@@ -1,2 +1,2 @@
1
- import{Nh as r,ci as n,il as c,pi as e}from"./chunk-5ctpz542.js";var i=(o)=>({queryKey:["projects",o],queryFn:async()=>{let t=await e.api.projects[":projectId"].$get({param:{projectId:o}});if(!t.ok)throw Error("Failed to fetch project");return await t.json()}}),l=(o)=>({queryKey:["collections",o],queryFn:async()=>{let t=await e.api.collections[":collectionId"].$get({param:{collectionId:o}});if(!t.ok)throw Error("Failed to fetch collection");return await t.json()}}),u=n("/projects/$projectId/collections/$collectionId")({loader:({context:{queryClient:o},params:{projectId:t}})=>o.ensureQueryData(i(t)),pendingComponent:()=>r("div",{children:c.loading_collection()})});
2
- export{i as Oe,l as Pe,u as Qe};
1
+ import{Ai as e,_h as r,pi as n,xl as c}from"./chunk-yfgwknpa.js";var i=(o)=>({queryKey:["projects",o],queryFn:async()=>{let t=await e.api.projects[":projectId"].$get({param:{projectId:o}});if(!t.ok)throw Error("Failed to fetch project");return await t.json()}}),l=(o)=>({queryKey:["collections",o],queryFn:async()=>{let t=await e.api.collections[":collectionId"].$get({param:{collectionId:o}});if(!t.ok)throw Error("Failed to fetch collection");return await t.json()}}),u=n("/projects/$projectId/collections/$collectionId")({loader:({context:{queryClient:o},params:{projectId:t}})=>o.ensureQueryData(i(t)),pendingComponent:()=>r("div",{children:c.loading_collection()})});
2
+ export{i as ee,l as fe,u as ge};
@@ -1,2 +1,2 @@
1
- import{Qg as f}from"./chunk-vhcsdnzv.js";import{Nh as b,Oh as q}from"./chunk-5ctpz542.js";function z(){return q("div",{className:"flex h-screen flex-col bg-background min-h-0",children:[q("div",{className:"flex h-14 items-center justify-between border-b px-6 shrink-0",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-4 w-24"}),b("span",{className:"text-muted-foreground",children:"/"}),b(f,{className:"h-4 w-32"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-8 w-8 rounded-md"}),b(f,{className:"h-8 w-20 rounded-md"})]})]}),q("div",{className:"flex flex-1 overflow-hidden",children:[q("div",{className:"w-[240px] border-r p-4 space-y-4 hidden md:block shrink-0",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-4 w-4 rounded"}),b(f,{className:"h-4 w-24"})]}),q("div",{className:"pl-4 space-y-3",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-3 w-3 rounded"}),b(f,{className:"h-3 w-28"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-3 w-3 rounded"}),b(f,{className:"h-3 w-20"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-3 w-3 rounded"}),b(f,{className:"h-3 w-24"})]})]})]}),q("div",{className:"flex-1 p-6 space-y-6 overflow-y-auto",children:[q("div",{className:"flex items-center justify-between border-b pb-4",children:[q("div",{className:"flex items-center gap-4",children:[b(f,{className:"h-5 w-40"}),b(f,{className:"h-4 w-20"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-8 w-8 rounded"}),b(f,{className:"h-8 w-8 rounded"}),b(f,{className:"h-8 w-32 rounded"})]})]}),q("div",{className:"space-y-4",children:[b("div",{className:"flex items-center gap-2",children:b(f,{className:"h-4 w-24"})}),b("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5",children:Array.from({length:10}).map((w,v)=>q("div",{className:"flex flex-col rounded-lg border bg-card p-3 space-y-3",children:[b(f,{className:"aspect-square w-full rounded-md"}),q("div",{className:"space-y-2",children:[b(f,{className:"h-4 w-3/4"}),q("div",{className:"flex justify-between items-center",children:[b(f,{className:"h-3 w-1/4"}),b(f,{className:"h-3 w-1/3"})]})]})]},v))})]})]})]})]})}function A(){return q("div",{className:"h-screen flex flex-col bg-background",children:[q("div",{className:"flex h-14 items-center justify-between border-b px-6 shrink-0",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-4 w-16"}),b("span",{className:"text-muted-foreground",children:"/"}),b(f,{className:"h-4 w-28"}),b("span",{className:"text-muted-foreground",children:"/"}),b(f,{className:"h-4 w-32"})]}),b("div",{className:"flex items-center gap-2",children:b(f,{className:"h-8 w-20 rounded"})})]}),q("div",{className:"flex flex-1 overflow-hidden",children:[q("div",{className:"w-[280px] border-r p-4 flex flex-col gap-4 shrink-0 hidden md:flex",children:[b(f,{className:"h-5 w-24"}),b("div",{className:"space-y-3 flex-1 overflow-y-auto",children:Array.from({length:4}).map((w,v)=>q("div",{className:"flex gap-3 p-2 rounded border",children:[b(f,{className:"h-12 w-12 rounded bg-muted shrink-0"}),q("div",{className:"space-y-2 flex-1",children:[b(f,{className:"h-3 w-2/3"}),b(f,{className:"h-2 w-1/2"})]})]},v))})]}),q("div",{className:"flex-1 bg-muted/20 p-6 flex flex-col justify-between relative min-w-0",children:[b("div",{className:"flex-1 flex items-center justify-center",children:b(f,{className:"w-full max-w-4xl aspect-video rounded-lg shadow-lg"})}),q("div",{className:"mt-4 flex items-center justify-between shrink-0",children:[q("div",{className:"flex items-center gap-4",children:[b(f,{className:"h-8 w-8 rounded-full"}),b(f,{className:"h-4 w-32"})]}),b(f,{className:"h-4 w-24"})]})]}),q("div",{className:"w-[360px] border-l p-4 flex flex-col gap-6 shrink-0 hidden lg:flex bg-card",children:[q("div",{className:"space-y-4",children:[b(f,{className:"h-5 w-32"}),b("div",{className:"space-y-3",children:Array.from({length:3}).map((w,v)=>q("div",{className:"flex justify-between items-center py-1 border-b",children:[b(f,{className:"h-3 w-20"}),b(f,{className:"h-3 w-32"})]},v))})]}),q("div",{className:"flex-1 flex flex-col gap-4",children:[b(f,{className:"h-5 w-24"}),b("div",{className:"space-y-3 flex-1 overflow-y-auto",children:Array.from({length:3}).map((w,v)=>q("div",{className:"flex gap-3 p-3 rounded-lg border bg-muted/10",children:[b(f,{className:"h-8 w-8 rounded-full shrink-0"}),q("div",{className:"space-y-2 flex-1",children:[q("div",{className:"flex justify-between",children:[b(f,{className:"h-3 w-24"}),b(f,{className:"h-2 w-12"})]}),b(f,{className:"h-3 w-full"}),b(f,{className:"h-3 w-5/6"})]})]},v))})]})]})]})]})}
2
- export{z as jf,A as kf};
1
+ import{_g as f}from"./chunk-6w395tfy.js";import{$h as q,_h as b}from"./chunk-yfgwknpa.js";function z(){return q("div",{className:"flex h-screen flex-col bg-background min-h-0",children:[q("div",{className:"flex h-14 items-center justify-between border-b px-6 shrink-0",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-4 w-24"}),b("span",{className:"text-muted-foreground",children:"/"}),b(f,{className:"h-4 w-32"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-8 w-8 rounded-md"}),b(f,{className:"h-8 w-20 rounded-md"})]})]}),q("div",{className:"flex flex-1 overflow-hidden",children:[q("div",{className:"w-[240px] border-r p-4 space-y-4 hidden md:block shrink-0",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-4 w-4 rounded"}),b(f,{className:"h-4 w-24"})]}),q("div",{className:"pl-4 space-y-3",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-3 w-3 rounded"}),b(f,{className:"h-3 w-28"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-3 w-3 rounded"}),b(f,{className:"h-3 w-20"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-3 w-3 rounded"}),b(f,{className:"h-3 w-24"})]})]})]}),q("div",{className:"flex-1 p-6 space-y-6 overflow-y-auto",children:[q("div",{className:"flex items-center justify-between border-b pb-4",children:[q("div",{className:"flex items-center gap-4",children:[b(f,{className:"h-5 w-40"}),b(f,{className:"h-4 w-20"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-8 w-8 rounded"}),b(f,{className:"h-8 w-8 rounded"}),b(f,{className:"h-8 w-32 rounded"})]})]}),q("div",{className:"space-y-4",children:[b("div",{className:"flex items-center gap-2",children:b(f,{className:"h-4 w-24"})}),b("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5",children:Array.from({length:10}).map((w,v)=>q("div",{className:"flex flex-col rounded-lg border bg-card p-3 space-y-3",children:[b(f,{className:"aspect-square w-full rounded-md"}),q("div",{className:"space-y-2",children:[b(f,{className:"h-4 w-3/4"}),q("div",{className:"flex justify-between items-center",children:[b(f,{className:"h-3 w-1/4"}),b(f,{className:"h-3 w-1/3"})]})]})]},v))})]})]})]})]})}function A(){return q("div",{className:"h-screen flex flex-col bg-background",children:[q("div",{className:"flex h-14 items-center justify-between border-b px-6 shrink-0",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-4 w-16"}),b("span",{className:"text-muted-foreground",children:"/"}),b(f,{className:"h-4 w-28"}),b("span",{className:"text-muted-foreground",children:"/"}),b(f,{className:"h-4 w-32"})]}),b("div",{className:"flex items-center gap-2",children:b(f,{className:"h-8 w-20 rounded"})})]}),q("div",{className:"flex flex-1 overflow-hidden",children:[q("div",{className:"w-[280px] border-r p-4 flex flex-col gap-4 shrink-0 hidden md:flex",children:[b(f,{className:"h-5 w-24"}),b("div",{className:"space-y-3 flex-1 overflow-y-auto",children:Array.from({length:4}).map((w,v)=>q("div",{className:"flex gap-3 p-2 rounded border",children:[b(f,{className:"h-12 w-12 rounded bg-muted shrink-0"}),q("div",{className:"space-y-2 flex-1",children:[b(f,{className:"h-3 w-2/3"}),b(f,{className:"h-2 w-1/2"})]})]},v))})]}),q("div",{className:"flex-1 bg-muted/20 p-6 flex flex-col justify-between relative min-w-0",children:[b("div",{className:"flex-1 flex items-center justify-center",children:b(f,{className:"w-full max-w-4xl aspect-video rounded-lg shadow-lg"})}),q("div",{className:"mt-4 flex items-center justify-between shrink-0",children:[q("div",{className:"flex items-center gap-4",children:[b(f,{className:"h-8 w-8 rounded-full"}),b(f,{className:"h-4 w-32"})]}),b(f,{className:"h-4 w-24"})]})]}),q("div",{className:"w-[360px] border-l p-4 flex flex-col gap-6 shrink-0 hidden lg:flex bg-card",children:[q("div",{className:"space-y-4",children:[b(f,{className:"h-5 w-32"}),b("div",{className:"space-y-3",children:Array.from({length:3}).map((w,v)=>q("div",{className:"flex justify-between items-center py-1 border-b",children:[b(f,{className:"h-3 w-20"}),b(f,{className:"h-3 w-32"})]},v))})]}),q("div",{className:"flex-1 flex flex-col gap-4",children:[b(f,{className:"h-5 w-24"}),b("div",{className:"space-y-3 flex-1 overflow-y-auto",children:Array.from({length:3}).map((w,v)=>q("div",{className:"flex gap-3 p-3 rounded-lg border bg-muted/10",children:[b(f,{className:"h-8 w-8 rounded-full shrink-0"}),q("div",{className:"space-y-2 flex-1",children:[q("div",{className:"flex justify-between",children:[b(f,{className:"h-3 w-24"}),b(f,{className:"h-2 w-12"})]}),b(f,{className:"h-3 w-full"}),b(f,{className:"h-3 w-5/6"})]})]},v))})]})]})]})]})}
2
+ export{z as Ne,A as Oe};
@@ -21,4 +21,4 @@ you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
21
21
  new OpenAI({ apiKey, dangerouslyAllowBrowser: true });
22
22
 
23
23
  https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
24
- `);this.baseURL=z.baseURL,this.timeout=z.timeout??x2.DEFAULT_TIMEOUT,this.logger=z.logger??console;let N="warn";this.logLevel=N,this.logLevel=Z2(z.logLevel,"ClientOptions.logLevel",this)??Z2(a("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??N,this.fetchOptions=z.fetchOptions,this.maxRetries=z.maxRetries??2,this.fetch=z.fetch??b2(),E(this,m0,g2,"f"),this._options=z,this.apiKey=typeof Z==="string"?Z:"Missing Key",this.organization=Y,this.project=$,this.webhookSecret=G}withOptions(X){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...X})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:X,nulls:Z}){return}async authHeaders(X){return V([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(X){return n2(X)}getUserAgent(){return`${this.constructor.name}/JS ${NX}`}defaultIdempotencyKey(){return`stainless-node-retry-${u0()}`}makeStatusError(X,Z,Y,$){return f.generate(X,Z,Y,$)}async _callApiKey(){let X=this._options.apiKey;if(typeof X!=="function")return!1;let Z;try{Z=await X()}catch(Y){if(Y instanceof U)throw Y;throw new U(`Failed to get token from 'apiKey' function: ${Y.message}`,{cause:Y})}if(typeof Z!=="string"||!Z)throw new U(`Expected 'apiKey' function argument to return a string but it returned ${Z}`);return this.apiKey=Z,!0}buildURL(X,Z,Y){let $=!K(this,O2,"m",y3).call(this)&&Y||this.baseURL,G=C2(X)?new URL(X):new URL($+($.endsWith("/")&&X.startsWith("/")?X.slice(1):X)),W=this.defaultQuery();if(!D2(W))Z={...W,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))G.search=this.stringifyQuery(Z);return G.toString()}async prepareOptions(X){await this._callApiKey()}async prepareRequest(X,{url:Z,options:Y}){}get(X,Z){return this.methodRequest("get",X,Z)}post(X,Z){return this.methodRequest("post",X,Z)}patch(X,Z){return this.methodRequest("patch",X,Z)}put(X,Z){return this.methodRequest("put",X,Z)}delete(X,Z){return this.methodRequest("delete",X,Z)}methodRequest(X,Z,Y){return this.request(Promise.resolve(Y).then(($)=>{return{method:X,path:Z,...$}}))}request(X,Z=null){return new xX(this,this.makeRequest(X,Z,void 0))}async makeRequest(X,Z,Y){let $=await X,G=$.maxRetries??this.maxRetries;if(Z==null)Z=G;await this.prepareOptions($);let{req:W,url:z,timeout:N}=await this.buildRequest($,{retryCount:G-Z});await this.prepareRequest(W,{url:z,options:$});let w="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),F=Y===void 0?"":`, retryOf: ${Y}`,M=Date.now();if(S(this).debug(`[${w}] sending request`,GX({retryOfRequestLogID:Y,method:$.method,url:z,options:$,headers:W.headers})),$.signal?.aborted)throw new I;let H=new AbortController,B=await this.fetchWithTimeout(z,W,N,H).catch(wZ),q=Date.now();if(B instanceof globalThis.Error){let C=`retrying, ${Z} attempts remaining`;if($.signal?.aborted)throw new I;let P=VZ(B)||/timed? ?out/i.test(String(B)+("cause"in B?String(B.cause):""));if(Z)return S(this).info(`[${w}] connection ${P?"timed out":"failed"} - ${C}`),S(this).debug(`[${w}] connection ${P?"timed out":"failed"} (${C})`,GX({retryOfRequestLogID:Y,url:z,durationMs:q-M,message:B.message})),this.retryRequest($,Z,Y??w);if(S(this).info(`[${w}] connection ${P?"timed out":"failed"} - error; no more retries left`),S(this).debug(`[${w}] connection ${P?"timed out":"failed"} (error; no more retries left)`,GX({retryOfRequestLogID:Y,url:z,durationMs:q-M,message:B.message})),P)throw new OX;throw new LX({cause:B})}let T=[...B.headers.entries()].filter(([C])=>C==="x-request-id").map(([C,P])=>", "+C+": "+JSON.stringify(P)).join(""),D=`[${w}${F}${T}] ${W.method} ${z} ${B.ok?"succeeded":"failed"} with status ${B.status} in ${q-M}ms`;if(!B.ok){let C=await this.shouldRetry(B);if(Z&&C){let j=`retrying, ${Z} attempts remaining`;return await v2(B.body),S(this).info(`${D} - ${j}`),S(this).debug(`[${w}] response error (${j})`,GX({retryOfRequestLogID:Y,url:B.url,status:B.status,headers:B.headers,durationMs:q-M})),this.retryRequest($,Z,Y??w,B.headers)}let P=C?"error; no more retries left":"error; not retryable";S(this).info(`${D} - ${P}`);let x=await B.text().catch((j)=>wZ(j).message),_=S2(x),R=_?void 0:x;throw S(this).debug(`[${w}] response error (${P})`,GX({retryOfRequestLogID:Y,url:B.url,status:B.status,headers:B.headers,message:R,durationMs:Date.now()-M})),this.makeStatusError(B.status,_,R,B.headers)}return S(this).info(D),S(this).debug(`[${w}] response start`,GX({retryOfRequestLogID:Y,url:B.url,status:B.status,headers:B.headers,durationMs:q-M})),{response:B,options:$,controller:H,requestLogID:w,retryOfRequestLogID:Y,startTime:M}}getAPIList(X,Z,Y){return this.requestAPIList(Z,Y&&"then"in Y?Y.then(($)=>({method:"get",path:X,...$})):{method:"get",path:X,...Y})}requestAPIList(X,Z){let Y=this.makeRequest(Z,null,void 0);return new q0(this,Y,X)}async fetchWithTimeout(X,Z,Y,$){let{signal:G,method:W,...z}=Z||{},N=this._makeAbort($);if(G)G.addEventListener("abort",N,{once:!0});let w=setTimeout(N,Y),F=globalThis.ReadableStream&&z.body instanceof globalThis.ReadableStream||typeof z.body==="object"&&z.body!==null&&Symbol.asyncIterator in z.body,M={signal:$.signal,...F?{duplex:"half"}:{},method:"GET",...z};if(W)M.method=W.toUpperCase();try{return await this.fetch.call(void 0,X,M)}finally{clearTimeout(w)}}async shouldRetry(X){let Z=X.headers.get("x-should-retry");if(Z==="true")return!0;if(Z==="false")return!1;if(X.status===408)return!0;if(X.status===409)return!0;if(X.status===429)return!0;if(X.status>=500)return!0;return!1}async retryRequest(X,Z,Y,$){let G,W=$?.get("retry-after-ms");if(W){let N=parseFloat(W);if(!Number.isNaN(N))G=N}let z=$?.get("retry-after");if(z&&!G){let N=parseFloat(z);if(!Number.isNaN(N))G=N*1000;else G=Date.parse(z)-Date.now()}if(G===void 0){let N=X.maxRetries??this.maxRetries;G=this.calculateDefaultRetryTimeoutMillis(Z,N)}return await s(G),this.makeRequest(X,Z-1,Y)}calculateDefaultRetryTimeoutMillis(X,Z){let G=Z-X,W=Math.min(0.5*Math.pow(2,G),8),z=1-Math.random()*0.25;return W*z*1000}async buildRequest(X,{retryCount:Z=0}={}){let Y={...X},{method:$,path:G,query:W,defaultBaseURL:z}=Y,N=this.buildURL(G,W,z);if("timeout"in Y)R2("timeout",Y.timeout);Y.timeout=Y.timeout??this.timeout;let{bodyHeaders:w,body:F}=this.buildBody({options:Y}),M=await this.buildHeaders({options:X,method:$,bodyHeaders:w,retryCount:Z});return{req:{method:$,headers:M,...Y.signal&&{signal:Y.signal},...globalThis.ReadableStream&&F instanceof globalThis.ReadableStream&&{duplex:"half"},...F&&{body:F},...this.fetchOptions??{},...Y.fetchOptions??{}},url:N,timeout:Y.timeout}}async buildHeaders({options:X,method:Z,bodyHeaders:Y,retryCount:$}){let G={};if(this.idempotencyHeader&&Z!=="get"){if(!X.idempotencyKey)X.idempotencyKey=this.defaultIdempotencyKey();G[this.idempotencyHeader]=X.idempotencyKey}let W=V([G,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String($),...X.timeout?{"X-Stainless-Timeout":String(Math.trunc(X.timeout/1000))}:{},...y2(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders(X),this._options.defaultHeaders,Y,X.headers]);return this.validateHeaders(W),W.values}_makeAbort(X){return()=>X.abort()}buildBody({options:{body:X,headers:Z}}){if(!X)return{bodyHeaders:void 0,body:void 0};let Y=V([Z]);if(ArrayBuffer.isView(X)||X instanceof ArrayBuffer||X instanceof DataView||typeof X==="string"&&Y.values.has("content-type")||globalThis.Blob&&X instanceof globalThis.Blob||X instanceof FormData||X instanceof URLSearchParams||globalThis.ReadableStream&&X instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:X};else if(typeof X==="object"&&((Symbol.asyncIterator in X)||(Symbol.iterator in X)&&("next"in X)&&typeof X.next==="function"))return{bodyHeaders:void 0,body:w0(X)};else if(typeof X==="object"&&Y.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(X)};else return K(this,m0,"f").call(this,{body:X,headers:Y})}}x2=L,m0=new WeakMap,O2=new WeakSet,y3=function(){return this.baseURL!=="https://api.openai.com/v1"};L.OpenAI=x2;L.DEFAULT_TIMEOUT=600000;L.OpenAIError=U;L.APIError=f;L.APIConnectionError=LX;L.APIConnectionTimeoutError=OX;L.APIUserAbortError=I;L.NotFoundError=TZ;L.ConflictError=MZ;L.RateLimitError=qZ;L.BadRequestError=HZ;L.AuthenticationError=UZ;L.InternalServerError=LZ;L.PermissionDeniedError=FZ;L.UnprocessableEntityError=EZ;L.InvalidWebhookSignatureError=$X;L.toFile=O0;L.Completions=sX;L.Chat=CX;L.Embeddings=oX;L.Files=XZ;L.Images=GZ;L.Audio=QX;L.Moderations=KZ;L.Models=WZ;L.FineTuning=ZX;L.Graders=bX;L.VectorStores=qX;L.Webhooks=NZ;L.Beta=XX;L.Batches=nX;L.Uploads=vX;L.Responses=MX;L.Realtime=FX;L.Conversations=IX;L.Evals=yX;L.Containers=jX;L.Skills=EX;L.Videos=QZ;class b3 extends L{constructor({baseURL:X=a("OPENAI_BASE_URL"),apiKey:Z=a("AZURE_OPENAI_API_KEY"),apiVersion:Y=a("OPENAI_API_VERSION"),endpoint:$,deployment:G,azureADTokenProvider:W,dangerouslyAllowBrowser:z,...N}={}){if(!Y)throw new U("The OPENAI_API_VERSION environment variable is missing or empty; either provide it, or instantiate the AzureOpenAI client with an apiVersion option, like new AzureOpenAI({ apiVersion: 'My API Version' }).");if(typeof W==="function")z=!0;if(!W&&!Z)throw new U("Missing credentials. Please pass one of `apiKey` and `azureADTokenProvider`, or set the `AZURE_OPENAI_API_KEY` environment variable.");if(W&&Z)throw new U("The `apiKey` and `azureADTokenProvider` arguments are mutually exclusive; only one can be passed at a time.");if(N.defaultQuery={...N.defaultQuery,"api-version":Y},!X){if(!$)$=process.env.AZURE_OPENAI_ENDPOINT;if(!$)throw new U("Must provide one of the `baseURL` or `endpoint` arguments, or the `AZURE_OPENAI_ENDPOINT` environment variable");X=`${$}/openai`}else if($)throw new U("baseURL and endpoint are mutually exclusive");super({apiKey:W??Z,baseURL:X,...N,...z!==void 0?{dangerouslyAllowBrowser:z}:{}});this.apiVersion="",this.apiVersion=Y,this.deploymentName=G}async buildRequest(X,Z={}){if(J8.has(X.path)&&X.method==="post"&&X.body!==void 0){if(!gX(X.body))throw Error("Expected request body to be an object");let Y=this.deploymentName||X.body.model||X.__metadata?.model;if(Y!==void 0&&!this.baseURL.includes("/deployments"))X.path=`/deployments/${Y}${X.path}`}return super.buildRequest(X,Z)}async authHeaders(X){if(typeof this._options.apiKey==="string")return V([{"api-key":this.apiKey}]);return super.authHeaders(X)}}var J8=new Set(["/completions","/chat/completions","/embeddings","/audio/transcriptions","/audio/translations","/audio/speech","/images/generations","/batches","/images/edits"]);export{L as zl,b3 as Al};
24
+ `);this.baseURL=z.baseURL,this.timeout=z.timeout??x2.DEFAULT_TIMEOUT,this.logger=z.logger??console;let N="warn";this.logLevel=N,this.logLevel=Z2(z.logLevel,"ClientOptions.logLevel",this)??Z2(a("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??N,this.fetchOptions=z.fetchOptions,this.maxRetries=z.maxRetries??2,this.fetch=z.fetch??b2(),E(this,m0,g2,"f"),this._options=z,this.apiKey=typeof Z==="string"?Z:"Missing Key",this.organization=Y,this.project=$,this.webhookSecret=G}withOptions(X){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...X})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:X,nulls:Z}){return}async authHeaders(X){return V([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(X){return n2(X)}getUserAgent(){return`${this.constructor.name}/JS ${NX}`}defaultIdempotencyKey(){return`stainless-node-retry-${u0()}`}makeStatusError(X,Z,Y,$){return f.generate(X,Z,Y,$)}async _callApiKey(){let X=this._options.apiKey;if(typeof X!=="function")return!1;let Z;try{Z=await X()}catch(Y){if(Y instanceof U)throw Y;throw new U(`Failed to get token from 'apiKey' function: ${Y.message}`,{cause:Y})}if(typeof Z!=="string"||!Z)throw new U(`Expected 'apiKey' function argument to return a string but it returned ${Z}`);return this.apiKey=Z,!0}buildURL(X,Z,Y){let $=!K(this,O2,"m",y3).call(this)&&Y||this.baseURL,G=C2(X)?new URL(X):new URL($+($.endsWith("/")&&X.startsWith("/")?X.slice(1):X)),W=this.defaultQuery();if(!D2(W))Z={...W,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))G.search=this.stringifyQuery(Z);return G.toString()}async prepareOptions(X){await this._callApiKey()}async prepareRequest(X,{url:Z,options:Y}){}get(X,Z){return this.methodRequest("get",X,Z)}post(X,Z){return this.methodRequest("post",X,Z)}patch(X,Z){return this.methodRequest("patch",X,Z)}put(X,Z){return this.methodRequest("put",X,Z)}delete(X,Z){return this.methodRequest("delete",X,Z)}methodRequest(X,Z,Y){return this.request(Promise.resolve(Y).then(($)=>{return{method:X,path:Z,...$}}))}request(X,Z=null){return new xX(this,this.makeRequest(X,Z,void 0))}async makeRequest(X,Z,Y){let $=await X,G=$.maxRetries??this.maxRetries;if(Z==null)Z=G;await this.prepareOptions($);let{req:W,url:z,timeout:N}=await this.buildRequest($,{retryCount:G-Z});await this.prepareRequest(W,{url:z,options:$});let w="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),F=Y===void 0?"":`, retryOf: ${Y}`,M=Date.now();if(S(this).debug(`[${w}] sending request`,GX({retryOfRequestLogID:Y,method:$.method,url:z,options:$,headers:W.headers})),$.signal?.aborted)throw new I;let H=new AbortController,B=await this.fetchWithTimeout(z,W,N,H).catch(wZ),q=Date.now();if(B instanceof globalThis.Error){let C=`retrying, ${Z} attempts remaining`;if($.signal?.aborted)throw new I;let P=VZ(B)||/timed? ?out/i.test(String(B)+("cause"in B?String(B.cause):""));if(Z)return S(this).info(`[${w}] connection ${P?"timed out":"failed"} - ${C}`),S(this).debug(`[${w}] connection ${P?"timed out":"failed"} (${C})`,GX({retryOfRequestLogID:Y,url:z,durationMs:q-M,message:B.message})),this.retryRequest($,Z,Y??w);if(S(this).info(`[${w}] connection ${P?"timed out":"failed"} - error; no more retries left`),S(this).debug(`[${w}] connection ${P?"timed out":"failed"} (error; no more retries left)`,GX({retryOfRequestLogID:Y,url:z,durationMs:q-M,message:B.message})),P)throw new OX;throw new LX({cause:B})}let T=[...B.headers.entries()].filter(([C])=>C==="x-request-id").map(([C,P])=>", "+C+": "+JSON.stringify(P)).join(""),D=`[${w}${F}${T}] ${W.method} ${z} ${B.ok?"succeeded":"failed"} with status ${B.status} in ${q-M}ms`;if(!B.ok){let C=await this.shouldRetry(B);if(Z&&C){let j=`retrying, ${Z} attempts remaining`;return await v2(B.body),S(this).info(`${D} - ${j}`),S(this).debug(`[${w}] response error (${j})`,GX({retryOfRequestLogID:Y,url:B.url,status:B.status,headers:B.headers,durationMs:q-M})),this.retryRequest($,Z,Y??w,B.headers)}let P=C?"error; no more retries left":"error; not retryable";S(this).info(`${D} - ${P}`);let x=await B.text().catch((j)=>wZ(j).message),_=S2(x),R=_?void 0:x;throw S(this).debug(`[${w}] response error (${P})`,GX({retryOfRequestLogID:Y,url:B.url,status:B.status,headers:B.headers,message:R,durationMs:Date.now()-M})),this.makeStatusError(B.status,_,R,B.headers)}return S(this).info(D),S(this).debug(`[${w}] response start`,GX({retryOfRequestLogID:Y,url:B.url,status:B.status,headers:B.headers,durationMs:q-M})),{response:B,options:$,controller:H,requestLogID:w,retryOfRequestLogID:Y,startTime:M}}getAPIList(X,Z,Y){return this.requestAPIList(Z,Y&&"then"in Y?Y.then(($)=>({method:"get",path:X,...$})):{method:"get",path:X,...Y})}requestAPIList(X,Z){let Y=this.makeRequest(Z,null,void 0);return new q0(this,Y,X)}async fetchWithTimeout(X,Z,Y,$){let{signal:G,method:W,...z}=Z||{},N=this._makeAbort($);if(G)G.addEventListener("abort",N,{once:!0});let w=setTimeout(N,Y),F=globalThis.ReadableStream&&z.body instanceof globalThis.ReadableStream||typeof z.body==="object"&&z.body!==null&&Symbol.asyncIterator in z.body,M={signal:$.signal,...F?{duplex:"half"}:{},method:"GET",...z};if(W)M.method=W.toUpperCase();try{return await this.fetch.call(void 0,X,M)}finally{clearTimeout(w)}}async shouldRetry(X){let Z=X.headers.get("x-should-retry");if(Z==="true")return!0;if(Z==="false")return!1;if(X.status===408)return!0;if(X.status===409)return!0;if(X.status===429)return!0;if(X.status>=500)return!0;return!1}async retryRequest(X,Z,Y,$){let G,W=$?.get("retry-after-ms");if(W){let N=parseFloat(W);if(!Number.isNaN(N))G=N}let z=$?.get("retry-after");if(z&&!G){let N=parseFloat(z);if(!Number.isNaN(N))G=N*1000;else G=Date.parse(z)-Date.now()}if(G===void 0){let N=X.maxRetries??this.maxRetries;G=this.calculateDefaultRetryTimeoutMillis(Z,N)}return await s(G),this.makeRequest(X,Z-1,Y)}calculateDefaultRetryTimeoutMillis(X,Z){let G=Z-X,W=Math.min(0.5*Math.pow(2,G),8),z=1-Math.random()*0.25;return W*z*1000}async buildRequest(X,{retryCount:Z=0}={}){let Y={...X},{method:$,path:G,query:W,defaultBaseURL:z}=Y,N=this.buildURL(G,W,z);if("timeout"in Y)R2("timeout",Y.timeout);Y.timeout=Y.timeout??this.timeout;let{bodyHeaders:w,body:F}=this.buildBody({options:Y}),M=await this.buildHeaders({options:X,method:$,bodyHeaders:w,retryCount:Z});return{req:{method:$,headers:M,...Y.signal&&{signal:Y.signal},...globalThis.ReadableStream&&F instanceof globalThis.ReadableStream&&{duplex:"half"},...F&&{body:F},...this.fetchOptions??{},...Y.fetchOptions??{}},url:N,timeout:Y.timeout}}async buildHeaders({options:X,method:Z,bodyHeaders:Y,retryCount:$}){let G={};if(this.idempotencyHeader&&Z!=="get"){if(!X.idempotencyKey)X.idempotencyKey=this.defaultIdempotencyKey();G[this.idempotencyHeader]=X.idempotencyKey}let W=V([G,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String($),...X.timeout?{"X-Stainless-Timeout":String(Math.trunc(X.timeout/1000))}:{},...y2(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders(X),this._options.defaultHeaders,Y,X.headers]);return this.validateHeaders(W),W.values}_makeAbort(X){return()=>X.abort()}buildBody({options:{body:X,headers:Z}}){if(!X)return{bodyHeaders:void 0,body:void 0};let Y=V([Z]);if(ArrayBuffer.isView(X)||X instanceof ArrayBuffer||X instanceof DataView||typeof X==="string"&&Y.values.has("content-type")||globalThis.Blob&&X instanceof globalThis.Blob||X instanceof FormData||X instanceof URLSearchParams||globalThis.ReadableStream&&X instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:X};else if(typeof X==="object"&&((Symbol.asyncIterator in X)||(Symbol.iterator in X)&&("next"in X)&&typeof X.next==="function"))return{bodyHeaders:void 0,body:w0(X)};else if(typeof X==="object"&&Y.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(X)};else return K(this,m0,"f").call(this,{body:X,headers:Y})}}x2=L,m0=new WeakMap,O2=new WeakSet,y3=function(){return this.baseURL!=="https://api.openai.com/v1"};L.OpenAI=x2;L.DEFAULT_TIMEOUT=600000;L.OpenAIError=U;L.APIError=f;L.APIConnectionError=LX;L.APIConnectionTimeoutError=OX;L.APIUserAbortError=I;L.NotFoundError=TZ;L.ConflictError=MZ;L.RateLimitError=qZ;L.BadRequestError=HZ;L.AuthenticationError=UZ;L.InternalServerError=LZ;L.PermissionDeniedError=FZ;L.UnprocessableEntityError=EZ;L.InvalidWebhookSignatureError=$X;L.toFile=O0;L.Completions=sX;L.Chat=CX;L.Embeddings=oX;L.Files=XZ;L.Images=GZ;L.Audio=QX;L.Moderations=KZ;L.Models=WZ;L.FineTuning=ZX;L.Graders=bX;L.VectorStores=qX;L.Webhooks=NZ;L.Beta=XX;L.Batches=nX;L.Uploads=vX;L.Responses=MX;L.Realtime=FX;L.Conversations=IX;L.Evals=yX;L.Containers=jX;L.Skills=EX;L.Videos=QZ;class b3 extends L{constructor({baseURL:X=a("OPENAI_BASE_URL"),apiKey:Z=a("AZURE_OPENAI_API_KEY"),apiVersion:Y=a("OPENAI_API_VERSION"),endpoint:$,deployment:G,azureADTokenProvider:W,dangerouslyAllowBrowser:z,...N}={}){if(!Y)throw new U("The OPENAI_API_VERSION environment variable is missing or empty; either provide it, or instantiate the AzureOpenAI client with an apiVersion option, like new AzureOpenAI({ apiVersion: 'My API Version' }).");if(typeof W==="function")z=!0;if(!W&&!Z)throw new U("Missing credentials. Please pass one of `apiKey` and `azureADTokenProvider`, or set the `AZURE_OPENAI_API_KEY` environment variable.");if(W&&Z)throw new U("The `apiKey` and `azureADTokenProvider` arguments are mutually exclusive; only one can be passed at a time.");if(N.defaultQuery={...N.defaultQuery,"api-version":Y},!X){if(!$)$=process.env.AZURE_OPENAI_ENDPOINT;if(!$)throw new U("Must provide one of the `baseURL` or `endpoint` arguments, or the `AZURE_OPENAI_ENDPOINT` environment variable");X=`${$}/openai`}else if($)throw new U("baseURL and endpoint are mutually exclusive");super({apiKey:W??Z,baseURL:X,...N,...z!==void 0?{dangerouslyAllowBrowser:z}:{}});this.apiVersion="",this.apiVersion=Y,this.deploymentName=G}async buildRequest(X,Z={}){if(J8.has(X.path)&&X.method==="post"&&X.body!==void 0){if(!gX(X.body))throw Error("Expected request body to be an object");let Y=this.deploymentName||X.body.model||X.__metadata?.model;if(Y!==void 0&&!this.baseURL.includes("/deployments"))X.path=`/deployments/${Y}${X.path}`}return super.buildRequest(X,Z)}async authHeaders(X){if(typeof this._options.apiKey==="string")return V([{"api-key":this.apiKey}]);return super.authHeaders(X)}}var J8=new Set(["/completions","/chat/completions","/embeddings","/audio/transcriptions","/audio/translations","/audio/speech","/images/generations","/batches","/images/edits"]);export{L as Yl,b3 as Zl};
@@ -0,0 +1 @@
1
+ import{Ae as p1,Be as T1,Ce as m1,te as y1,ue as L1,ve as q1,xe as k_,ye as u_,ze as D1}from"./chunk-q0hrd0yw.js";import{De as r_}from"./chunk-6529sh41.js";import{Ee as L_}from"./chunk-vwz2pa54.js";import"./chunk-p48npmbh.js";import"./chunk-g5qfxnz1.js";import"./chunk-94yxj3yy.js";import"./chunk-vgwjg37a.js";import{Mf as l,Nf as j_,Yf as s}from"./chunk-33hax7fe.js";import{$f as V_,ag as Q_,bg as f_,cg as N_,dg as d}from"./chunk-z7b132c0.js";import"./chunk-1ev668rp.js";import"./chunk-mnhg12fm.js";import"./chunk-0te5kcy3.js";import{Hg as U1,Ig as P1,Jg as b1,Sg as O1,Ug as F1,Wg as Z_,Xg as m_}from"./chunk-kmhkhcy6.js";import{Yg as y_}from"./chunk-y8ffp5zj.js";import{$g as E1}from"./chunk-rjga1vn2.js";import{eh as k}from"./chunk-39s0cxq1.js";import{Dh as l_,oh as V1}from"./chunk-y45tzhdn.js";import{Eh as S1}from"./chunk-02tqxzgz.js";import{Fh as X_,Gh as H_,Hh as z_}from"./chunk-42et2rqa.js";import{Ih as P_,Kh as b_,Lh as O_,Mh as Y_}from"./chunk-hsemzjvr.js";import{$h as J,Ai as G,Al as w_,Bj as v1,Bl as F_,Cl as B_,Dl as K_,El as Y1,Fj as C1,Fl as c,Hl as E_,Ik as n,Il as A_,Jl as G_,Ki as R_,Kl as C_,Lk as U_,Ll as S_,Mi as g,Ml as D_,Nl as p_,Oi as Z1,Ol as T_,Pl as c_,Qi as f1,Tk as _1,Ui as N1,Uj as M1,Uk as $1,Yh as __,Yj as o_,Yk as J1,Zh as q_,_h as _,ai as o,di as i,ej as $_,fi as x,fk as w1,gi as K1,hj as h1,lj as X1,mj as H1,ok as t,qi as g1,sl as m,ul as P,xl as W,yl as M_}from"./chunk-yfgwknpa.js";import{Mm as e}from"./chunk-wwjqqqr4.js";var r=e(__(),1);function W1({scope:$,onScopeChange:H,selectedGoal:F,onClearGoal:h,onCreateTask:L,canCreateTask:B=!0}){return J("header",{className:"h-14 border-b border-border bg-card/60 backdrop-blur-sm px-4 flex items-center justify-between gap-3 shrink-0 select-none",children:[J("div",{className:"flex items-center gap-3 min-w-0",children:[J("div",{className:"flex items-center bg-muted/60 p-0.5 rounded-lg border border-border/50",children:[J(P,{variant:$==="team"?"secondary":"ghost",size:"sm",onClick:()=>H("team"),className:`h-7 px-2.5 text-xs font-medium gap-1.5 transition-all ${$==="team"?"bg-background text-foreground shadow-xs":"text-muted-foreground hover:text-foreground"}`,children:[_($1,{className:"w-3.5 h-3.5"}),_("span",{children:W.team_tasks()})]}),J(P,{variant:$==="my"?"secondary":"ghost",size:"sm",onClick:()=>H("my"),className:`h-7 px-2.5 text-xs font-medium gap-1.5 transition-all ${$==="my"?"bg-background text-foreground shadow-xs":"text-muted-foreground hover:text-foreground"}`,children:[_(_1,{className:"w-3.5 h-3.5"}),_("span",{children:W.my_tasks()})]})]}),F&&J("div",{className:"hidden sm:flex items-center gap-1.5 px-2 py-1 rounded-md bg-sidebar-accent border border-sidebar-border text-xs text-sidebar-accent-foreground min-w-0 max-w-[200px] md:max-w-[280px]",children:[_(n,{className:"w-3.5 h-3.5 text-sidebar-primary shrink-0"}),_("span",{className:"truncate font-medium",children:F.id===s?W.unassigned():F.title}),_(P,{variant:"ghost",size:"icon-xs",onClick:h,className:"h-4 w-4 p-0 ml-0.5 text-muted-foreground hover:text-foreground",title:W.clear_filter(),children:_(J1,{className:"w-3 h-3"})})]})]}),B&&_("div",{className:"flex items-center gap-2 shrink-0",children:J(P,{size:"sm",onClick:L,className:"h-8 px-3 text-xs gap-1.5 shadow-xs",children:[_(t,{className:"w-3.5 h-3.5"}),_("span",{children:W.create_task()})]})})]})}var W_=e(__(),1);var J_=e(__(),1);function d_({teamId:$,isOpen:H,onClose:F,goalToEdit:h}){let L=o(),[B,U]=J_.useState(""),[M,b]=J_.useState("");J_.useEffect(()=>{if(h)U(h.title),b(h.description||"");else U(""),b("")},[h,H]);let{mutate:y,isPending:C}=x({mutationFn:async()=>{let X=await G.api.teams[":teamId"].kanban.goals.$post({param:{teamId:$},json:{title:B.trim(),description:M.trim()||void 0}});if(!X.ok){let w=await X.json().catch(()=>({message:W.error()}));throw Error(w.message||W.error())}return await X.json()},onSuccess:()=>{L.invalidateQueries({queryKey:["teams",$,"kanban","goals"]}),c.success(W.goal_created()),F()},onError:(X)=>{c.error(X.message)}}),{mutate:S,isPending:O}=x({mutationFn:async()=>{if(!h)return;let X=await G.api.teams[":teamId"].kanban.goals[":goalId"].$patch({param:{teamId:$,goalId:h.id},json:{title:B.trim(),description:M.trim()||null}});if(!X.ok){let w=await X.json().catch(()=>({message:W.error()}));throw Error(w.message||W.error())}return await X.json()},onSuccess:()=>{L.invalidateQueries({queryKey:["teams",$,"kanban","goals"]}),c.success(W.goal_updated()),F()},onError:(X)=>{c.error(X.message)}}),T=(X)=>{if(X.preventDefault(),!B.trim())return;if(h)S();else y()},Q=C||O;return _(M_,{open:H,onOpenChange:(X)=>!X&&F(),children:_(w_,{className:"sm:max-w-xl",children:J("form",{onSubmit:T,className:"space-y-4",children:[J(F_,{children:[_(K_,{children:h?W.edit_goal():W.create_goal()}),_(Y1,{children:h?W.edit_goal():W.create_first_goal()})]}),J("div",{className:"space-y-3 py-2",children:[J("div",{className:"space-y-1.5",children:[_(k,{htmlFor:"goal-title",children:W.goal_title()}),_(E_,{id:"goal-title",value:B,onChange:(X)=>U(X.target.value),placeholder:W.goal_title_placeholder(),required:!0,autoFocus:!0})]}),J("div",{className:"space-y-1.5",children:[_(k,{htmlFor:"goal-description",children:W.goal_description()}),_(L_,{id:"goal-description",value:M,onChange:(X)=>b(X.target.value),placeholder:W.goal_description_placeholder(),rows:3})]})]}),J(B_,{children:[_(P,{type:"button",variant:"outline",onClick:F,disabled:Q,children:W.cancel()}),J(P,{type:"submit",disabled:!B.trim()||Q,children:[Q&&_(g,{className:"w-4 h-4 mr-1.5 animate-spin"}),h?W.save_changes():W.create()]})]})]})})})}function z1({teamId:$,selectedGoalId:H,onSelectGoal:F,isOwnerOrEditor:h=!0}){let L=o(),[B,U]=W_.useState(!1),[M,b]=W_.useState(null),[y,C]=W_.useState(null),[S,O]=W_.useState(!1),{data:T,isLoading:Q}=i({queryKey:["teams",$,"kanban","goals"],queryFn:async()=>{let z=await G.api.teams[":teamId"].kanban.goals.$get({param:{teamId:$},query:{}});if(!z.ok)throw Error("Failed to fetch goals");return await z.json()},enabled:!!$}),X=T?.data||[],w=X.reduce((z,Z)=>z+(Z.taskCount||0),0),{mutate:q,isPending:V}=x({mutationFn:async(z)=>{let Z=await G.api.teams[":teamId"].kanban.goals[":goalId"].$delete({param:{teamId:$,goalId:z}});if(!Z.ok){let N=await Z.json().catch(()=>({message:W.error()}));throw Error(N.message||W.error())}return await Z.json()},onSuccess:(z,Z)=>{if(L.invalidateQueries({queryKey:["teams",$,"kanban","goals"]}),L.invalidateQueries({queryKey:["teams",$,"kanban","tasks"]}),c.success(W.goal_deleted()),H===Z)F(null);C(null)},onError:(z)=>{c.error(z.message)}});if(S)return J("div",{className:"border-r border-sidebar-border bg-sidebar flex flex-col items-center w-12 shrink-0 transition-all duration-300",children:[_("div",{className:"h-14 flex items-center justify-center border-b border-sidebar-border w-full shrink-0",children:_(P,{variant:"ghost",size:"icon-sm",onClick:()=>O(!1),title:W.goals(),className:"text-sidebar-foreground/70 hover:text-sidebar-foreground",children:_(H1,{className:"w-4 h-4"})})}),J("div",{className:"mt-3 flex flex-col items-center gap-2",children:[_(P,{variant:H===null?"secondary":"ghost",size:"icon-sm",onClick:()=>F(null),title:W.all_tasks(),className:m("w-8 h-8 rounded-md",H===null&&"bg-sidebar-accent text-sidebar-accent-foreground"),children:_(o_,{className:"w-4 h-4"})}),_(P,{variant:"ghost",size:"icon-sm",onClick:()=>U(!0),title:W.new_goal(),className:"w-8 h-8 rounded-md text-sidebar-foreground/70 hover:text-sidebar-foreground",children:_(t,{className:"w-4 h-4"})})]}),B&&_(d_,{teamId:$,isOpen:B,onClose:()=>U(!1)})]});return J("aside",{className:"w-64 border-r border-sidebar-border bg-sidebar flex flex-col shrink-0 transition-all duration-300 select-none",children:[J("div",{className:"h-14 px-3 flex items-center justify-between border-b border-sidebar-border shrink-0",children:[J("div",{className:"flex items-center gap-2 font-semibold text-xs tracking-wider uppercase text-sidebar-foreground/70",children:[_(n,{className:"w-4 h-4 text-sidebar-primary"}),_("span",{children:W.goals()})]}),J("div",{className:"flex items-center gap-1",children:[h&&_(P,{variant:"ghost",size:"icon-sm",onClick:()=>U(!0),className:"h-7 w-7 text-sidebar-foreground/70 hover:text-sidebar-foreground",title:W.new_goal(),children:_(t,{className:"w-4 h-4"})}),_(P,{variant:"ghost",size:"icon-sm",onClick:()=>O(!0),className:"h-7 w-7 text-sidebar-foreground/70 hover:text-sidebar-foreground",title:"Collapse",children:_(X1,{className:"w-4 h-4"})})]})]}),_(y_,{className:"flex-1 p-2",children:J("div",{className:"space-y-1",children:[J("div",{onClick:()=>F(null),className:m("flex items-center justify-between px-2.5 py-1 rounded-md text-xs font-medium cursor-pointer transition-colors group h-8 min-h-[32px]",H===null?"bg-sidebar-accent text-sidebar-accent-foreground font-semibold shadow-xs":"text-sidebar-foreground/70 hover:bg-sidebar-accent/50 hover:text-sidebar-foreground"),children:[J("div",{className:"flex items-center gap-2 truncate min-w-0",children:[_(o_,{className:"w-3.5 h-3.5 shrink-0 text-sidebar-primary"}),_("span",{className:"truncate",children:W.all_tasks()})]}),w>0&&_("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded-full bg-sidebar-border text-sidebar-foreground/60 shrink-0",children:w})]}),Q?_("div",{className:"flex items-center justify-center p-4",children:_(g,{className:"w-4 h-4 animate-spin text-muted-foreground"})}):X.length===0?_("div",{className:"px-2.5 py-4 text-center text-xs text-muted-foreground",children:W.no_goals_yet()}):X.map((z)=>{let Z=H===z.id,N=z.id===s,K=N?W.unassigned():z.title,v=h&&!N;return J("div",{onClick:()=>F(z.id),className:m("flex items-center justify-between px-2.5 py-1 rounded-md text-xs font-medium cursor-pointer transition-colors group relative min-h-[32px]",Z?"bg-sidebar-accent text-sidebar-accent-foreground font-semibold shadow-xs":"text-sidebar-foreground/70 hover:bg-sidebar-accent/50 hover:text-sidebar-foreground"),children:[J("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[_(n,{className:m("w-3.5 h-3.5 shrink-0",Z?"text-sidebar-primary":"text-muted-foreground")}),_("span",{className:"line-clamp-2 break-words leading-tight",title:K,children:K})]}),_("div",{className:"flex items-center shrink-0 ml-1",children:v?J(q_,{children:[(z.taskCount??0)>0&&_("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded-full bg-sidebar-border text-sidebar-foreground/60 group-hover:hidden group-focus-within:hidden [&:has(~_div_[data-state=open])]:hidden",children:z.taskCount}),_("div",{className:"hidden group-hover:flex group-focus-within:flex [&:has([data-state=open])]:flex items-center",onClick:(f)=>f.stopPropagation(),children:J(P_,{modal:!1,children:[_(b_,{asChild:!0,children:_(P,{variant:"ghost",size:"icon-xs",className:"h-6 w-6 p-0 text-muted-foreground hover:text-foreground",children:_(R_,{className:"w-3.5 h-3.5"})})}),J(O_,{align:"end",className:"w-36",children:[J(Y_,{onClick:()=>{b(z)},children:[_(Z1,{className:"w-3.5 h-3.5 mr-2"}),W.edit()]}),J(Y_,{className:"text-destructive focus:text-destructive focus:bg-destructive/10",onClick:()=>{C(z)},children:[_(U_,{className:"w-3.5 h-3.5 mr-2"}),W.delete()]})]})]})})]}):(z.taskCount??0)>0&&_("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded-full bg-sidebar-border text-sidebar-foreground/60",children:z.taskCount})})]},z.id)})]})}),(B||M)&&_(d_,{teamId:$,isOpen:B||!!M,goalToEdit:M,onClose:()=>{U(!1),b(null)}}),y&&_(A_,{open:!!y,onOpenChange:(z)=>!z&&C(null),children:J(G_,{children:[J(C_,{children:[_(D_,{children:W.delete_goal()}),_(p_,{children:W.delete_goal_confirm({title:y.title})})]}),J(S_,{children:[_(c_,{disabled:V,children:W.cancel()}),J(T_,{onClick:()=>q(y.id),disabled:V,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[V&&_(g,{className:"w-4 h-4 mr-1.5 animate-spin"}),W.delete()]})]})]})})]})}var A1=e(__(),1);var g_=e(__(),1);function Q1($){return+V1($)<Date.now()}function B1({task:$,onClick:H,onDelete:F,disabled:h,isFirst:L,isLast:B,showBottomIndicator:U,currentUserId:M,currentUserRole:b}){let{source:y}=m_(),C=!!y,S=b?.toLowerCase()==="owner",O=b?.toLowerCase()==="editor",T=!!M&&$.creator?.id===M,Q=$.reporter?.id===M||T,X=$.assignee?.id===M,w=S||O||Q||X,q=T||S||Q,V=h||!w,{ref:z,isDragging:Z}=F1({id:$.id,data:{type:"kanban_task",task:$},disabled:V}),{ref:N,isDropTarget:K}=Z_({id:`reorder-before-${$.id}`,data:{type:"reorder",task:$,position:"before"},disabled:Z||h}),{ref:v,isDropTarget:f}=Z_({id:`reorder-after-${$.id}`,data:{type:"reorder",task:$,position:"after"},disabled:Z||h}),R=$.isAgentTask,A=$.status===l.BLOCKED,E=$.dueDate?Q1(new Date($.dueDate))&&$.status!==l.DONE:!1;return J("div",{className:"relative",children:[_("div",{ref:N,className:m("absolute left-0 right-0 z-20",L?"-top-6 h-[calc(50%+24px)]":"-top-1 h-[calc(50%+4px)]",C&&!Z?"pointer-events-auto":"pointer-events-none")}),_("div",{ref:v,className:m("absolute bottom-0 left-0 right-0 z-20",B?"-bottom-6 h-[calc(50%+24px)]":"h-1/2",C&&!Z?"pointer-events-auto":"pointer-events-none")}),K&&!Z&&_("div",{className:"absolute -top-1.5 left-0 right-0 h-[3px] rounded-full bg-primary shadow-[0_0_8px_rgba(var(--primary),0.6)] z-30 pointer-events-none"}),(f||U)&&!Z&&_("div",{className:"absolute -bottom-1.5 left-0 right-0 h-[3px] rounded-full bg-primary shadow-[0_0_8px_rgba(var(--primary),0.6)] z-30 pointer-events-none"}),J("div",{ref:z,onClick:()=>H($),className:m("group relative flex flex-col gap-2 p-3 rounded-lg border text-card-foreground transition-all duration-200 cursor-pointer select-none",Z&&"opacity-40 scale-95 shadow-lg ring-2 ring-primary",!Z&&"hover:shadow-md","border-border/80 bg-card hover:border-primary/50 shadow-2xs",A&&"border-red-500/60 bg-red-500/[0.03] ring-1 ring-red-500/20"),children:[J("div",{className:"flex items-center justify-between gap-1.5 min-w-0",children:[J("div",{className:"flex items-center gap-1.5 min-w-0 flex-1",children:[_("span",{className:m("px-1.5 py-0.5 rounded text-[10px] font-medium border uppercase tracking-wider shrink-0",u_($.priority)),children:k_($.priority)}),R&&J("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-semibold bg-orange-500/15 text-orange-600 dark:text-orange-400 border border-orange-500/30 shrink-0",children:[_($_,{className:"w-3 h-3"}),_("span",{children:W.task_type_agent()})]}),$.goal&&J("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-muted text-muted-foreground border border-border/70 truncate max-w-[130px]",children:[_(n,{className:"w-2.5 h-2.5 shrink-0"}),_("span",{className:"truncate",children:$.goal.title})]})]}),_("div",{className:"flex items-center gap-1 shrink-0",children:q&&_("div",{className:"opacity-0 group-hover:opacity-100 [&:has([data-state=open])]:opacity-100 focus-within:opacity-100 transition-opacity flex items-center",onClick:(I)=>I.stopPropagation(),children:J(P_,{modal:!1,children:[_(b_,{asChild:!0,children:_(P,{variant:"ghost",size:"icon-xs",className:"h-5 w-5 p-0 text-muted-foreground hover:text-foreground",children:_(R_,{className:"w-3.5 h-3.5"})})}),_(O_,{align:"end",className:"w-32",children:J(Y_,{className:"text-destructive focus:text-destructive focus:bg-destructive/10",onClick:()=>F?.($),children:[_(U_,{className:"w-3.5 h-3.5 mr-2"}),W.delete()]})})]})})})]}),_("h4",{className:"text-xs font-semibold leading-snug line-clamp-2 text-foreground break-words",children:$.title}),A&&J("div",{className:"flex items-start gap-1.5 p-1.5 rounded bg-red-500/10 border border-red-500/20 text-[11px] text-red-600 dark:text-red-400",children:[_(N1,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),_("span",{className:"line-clamp-2 break-words",children:$.latestStatusEvent?.blockReason||$.latestStatusEvent?.reason||$.latestStatusEvent?.summary||W.status_blocked()})]}),$.status===l.IN_REVIEW&&$.latestStatusEvent?.summary&&J("div",{className:"flex items-start gap-1.5 p-1.5 rounded bg-purple-500/10 border border-purple-500/20 text-[11px] text-purple-600 dark:text-purple-400",children:[_(f1,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),_("span",{className:"line-clamp-2 break-words",children:$.latestStatusEvent.summary})]}),J("div",{className:"flex items-center justify-between gap-2 pt-1 mt-auto border-t border-border/40 text-[11px] text-muted-foreground",children:[_("div",{className:"flex items-center gap-1.5 min-w-0",children:$.assignee?J(q_,{children:[R?_("div",{className:"w-5 h-5 rounded-full bg-orange-500/15 border border-orange-500/30 flex items-center justify-center shrink-0",children:_($_,{className:"w-3 h-3 text-orange-600 dark:text-orange-400"})}):J(X_,{size:"sm",className:"w-5 h-5 border border-border",children:[_(H_,{src:$.assignee.image}),_(z_,{className:"text-[9px]",children:$.assignee.name.slice(0,2).toUpperCase()})]}),_("span",{className:"truncate text-xs font-medium text-foreground/80 max-w-[90px]",children:$.assignee.name})]}):_("span",{className:"text-[11px] italic text-muted-foreground/60",children:W.unassigned()})}),J("div",{className:"flex items-center gap-2 shrink-0",children:[$.dueDate&&J("div",{className:m("flex items-center gap-1 text-[10px] font-mono",E?"text-red-500 font-semibold":"text-muted-foreground"),title:l_(new Date($.dueDate),"yyyy/MM/dd HH:mm"),children:[_(h1,{className:"w-3 h-3"}),_("span",{children:l_(new Date($.dueDate),"MM/dd")})]}),$.assetCount>0&&J("div",{className:"flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground",title:W.linked_assets_count({count:$.assetCount}),children:[_(v1,{className:"w-3 h-3"}),_("span",{children:$.assetCount})]}),$.dependencyCount>0&&J("div",{className:"flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground",title:`${$.dependencyCount} dependencies`,children:[_(M1,{className:"w-3 h-3"}),_("span",{children:$.dependencyCount})]}),$.commentCount>0&&J("div",{className:"flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground",title:`${$.commentCount} comments`,children:[_(w1,{className:"w-3 h-3"}),_("span",{children:$.commentCount})]})]})]})]})]})}function R1({teamId:$,status:H,selectedGoalId:F,scope:h,currentUserId:L,currentUserRole:B,onTaskClick:U,onDeleteTask:M,onCreateTaskInColumn:b}){let y=B?.toLowerCase()==="owner"||B?.toLowerCase()==="editor",C=h==="my"?L:void 0,{data:S,fetchNextPage:O,hasNextPage:T,isFetchingNextPage:Q,isLoading:X}=K1({queryKey:["teams",$,"kanban","tasks",{status:H,goalId:F,assigneeId:C}],queryFn:async({pageParam:D=""})=>{let j=await G.api.teams[":teamId"].kanban.tasks.$get({param:{teamId:$},query:{status:H,goalId:F||void 0,assigneeId:C||void 0,first:"20",after:D||void 0}});if(!j.ok)throw Error("Failed to fetch column tasks");return await j.json()},initialPageParam:"",getNextPageParam:(D)=>D.pageInfo?.cursor||void 0,refetchInterval:5000,enabled:!!$}),{ref:w,inView:q}=E1({threshold:0.1});g_.useEffect(()=>{if(q&&T&&!Q)O()},[q,T,Q,O]);let V=g_.useMemo(()=>{return S?.pages?.flatMap((D)=>Array.isArray(D?.data)?D.data:[])||[]},[S]),{source:z,target:Z}=m_(),N=V.filter((D)=>D.id!==z?.id).at(-1),{ref:K,isDropTarget:v}=Z_({id:H,data:{type:"kanban_column",status:H,lastTask:N}}),f=z?.data?.type==="kanban_task",R=f&&(v||Z?.data?.type==="kanban_column"&&Z.data.status===H||Z?.data?.type==="reorder"&&Z.data.task?.status===H),A=f&&Z?.data?.type==="kanban_column"&&Z.data.status===H,E=S?.pages?.[0]?.pageInfo?.total??V.length,I=q1(H);return J("div",{ref:K,className:m("flex flex-col h-full max-h-full w-80 md:w-84 shrink-0 rounded-xl bg-card/60 border border-border/70 shadow-xs transition-colors duration-200 overflow-hidden select-none",R&&"ring-2 ring-primary/60 bg-primary/[0.03] border-primary/40"),children:[J("div",{className:"h-11 px-3.5 flex items-center justify-between border-b border-border/60 bg-card/80 shrink-0",children:[J("div",{className:"flex items-center gap-2 min-w-0",children:[_("div",{className:m("w-2.5 h-2.5 rounded-full shrink-0",I.dot)}),_("h3",{className:"text-xs font-bold tracking-wide uppercase text-foreground/90 truncate",children:L1(H)})]}),_("div",{className:"flex items-center gap-1 shrink-0",children:_("span",{className:"text-[11px] font-mono px-2 py-0.5 rounded-full bg-muted font-medium text-muted-foreground",children:E})})]}),_(y_,{className:"flex-1 min-h-0 [&>div>div]:block!",children:J("div",{className:"p-2.5 space-y-2.5 min-h-full flex flex-col",children:[X?_("div",{className:"flex items-center justify-center py-10",children:_(g,{className:"w-5 h-5 animate-spin text-muted-foreground"})}):V.length===0?_("div",{className:"flex flex-col items-center justify-center py-10 px-4 text-center",children:_("p",{className:"text-xs text-muted-foreground/70",children:W.no_tasks_in_column()})}):V.map((D,j)=>_(B1,{task:D,onClick:U,onDelete:M,isFirst:j===0,isLast:j===V.length-1,showBottomIndicator:A&&D.id===N?.id,currentUserId:L,currentUserRole:B},D.id)),_("div",{ref:w,className:"h-2"}),Q&&_("div",{className:"flex justify-center py-2",children:_(g,{className:"w-4 h-4 animate-spin text-muted-foreground"})})]})}),y&&_("div",{className:"p-2 border-t border-border/50 bg-card/90 shrink-0",children:J(P,{variant:"ghost",size:"sm",onClick:()=>b(H),className:"w-full justify-center h-8 text-xs font-medium text-muted-foreground hover:text-foreground hover:bg-muted/80 border border-dashed border-border/80",children:[_(t,{className:"w-3.5 h-3.5 mr-1.5"}),_("span",{children:W.create_task()})]})})]})}function G1({teamId:$,selectedGoalId:H,scope:F,currentUserId:h,currentUserRole:L,onTaskClick:B,onCreateTaskInColumn:U}){let M=o(),[b,y]=A1.useState(null),{mutate:C,isPending:S}=x({mutationFn:async(Q)=>{let X=await G.api.teams[":teamId"].kanban.tasks[":taskId"].$delete({param:{teamId:$,taskId:Q}});if(!X.ok){let w=await X.json().catch(()=>({message:W.error()}));throw Error(w.message||W.error())}return await X.json()},onSuccess:()=>{M.invalidateQueries({queryKey:["teams",$,"kanban","tasks"]}),M.invalidateQueries({queryKey:["teams",$,"kanban","goals"]}),c.success(W.task_deleted()),y(null)},onError:(Q)=>{c.error(Q.message)}}),{mutate:O}=x({mutationFn:async({taskId:Q,fromStatus:X,status:w,reason:q,beforeIndex:V,afterIndex:z})=>{let Z=await G.api.teams[":teamId"].kanban.tasks[":taskId"].$patch({param:{teamId:$,taskId:Q},json:{fromStatus:X,status:w,reason:q,beforeIndex:V,afterIndex:z}});if(!Z.ok){let N=await Z.json().catch(()=>({message:W.error()}));throw Error(N.message||W.error())}return await Z.json()},onMutate:async({taskId:Q,status:X,targetTaskId:w,position:q})=>{await M.cancelQueries({queryKey:["teams",$,"kanban","tasks"]});let V=M.getQueriesData({queryKey:["teams",$,"kanban","tasks"]}),z=null,Z=(N)=>{return N[0]==="teams"&&N[1]===$&&N[2]==="kanban"&&N[3]==="tasks"&&typeof N[4]==="object"&&N[4]!==null&&"status"in N[4]};if(M.setQueriesData({predicate:(N)=>Z(N.queryKey)},(N)=>{if(!N||!Array.isArray(N.pages))return N;let K=!1,v=N.pages.map((f)=>{if(!f||!Array.isArray(f.data))return f;let R=f.data.find((A)=>A.id===Q);if(R)return z={...R,status:X},K=!0,{...f,data:f.data.filter((A)=>A.id!==Q),pageInfo:{...f.pageInfo,total:Math.max(0,(f.pageInfo?.total??f.data.length)-1)}};return f});return K?{...N,pages:v}:N}),z){let N=z;M.setQueriesData({predicate:(K)=>{if(!Z(K.queryKey))return!1;return K.queryKey[4]?.status===X}},(K)=>{if(!K||!Array.isArray(K.pages))return K;let v=K.pages.flatMap((E)=>E?.data??[]).filter((E)=>E.id!==Q),f=v.length;if(w){let E=v.findIndex((I)=>I.id===w);if(E!==-1)f=q==="before"?E:E+1}v.splice(f,0,N);let R=0,A=K.pages.map((E,I)=>{let D=E?.data?E.data.length:0,j=I===0&&D===0?1:I===K.pages.length-1?v.length-R:D,h_=v.slice(R,R+j);return R+=j,{...E,data:h_,pageInfo:{...E?.pageInfo,total:(E?.pageInfo?.total??0)+1}}});if(R<v.length&&A.length>0){let E=A.length-1;A[E]={...A[E],data:[...A[E]?.data??[],...v.slice(R)]}}return{...K,pages:A}})}return{previousQueries:V}},onError:(Q,X,w)=>{if(w?.previousQueries)for(let[q,V]of w.previousQueries)M.setQueryData(q,V);c.error(Q.message)},onSettled:()=>{M.invalidateQueries({queryKey:["teams",$,"kanban","tasks"]})}}),T=(Q)=>{if(Q.canceled)return;let{source:X,target:w}=Q.operation;if(!X||!w)return;let q=X.data;if(q?.type!=="kanban_task"||!q.task)return;let V=q.task,z=L?.toLowerCase()==="owner",Z=L?.toLowerCase()==="editor",N=V.reporter?.id===h||V.creator?.id===h,K=V.assignee?.id===h;if(!z&&!Z&&!N&&!K){c.error(W.cannot_change_task_status_permission());return}let v=w.data;if(!v)return;if(v.type==="reorder"&&v.task&&v.position){let f=v.task,R=f.status;if(V.id===f.id)return;let A=v.position==="before"?f.sortIndex??void 0:void 0,E=v.position==="after"?f.sortIndex??void 0:void 0;O({taskId:V.id,fromStatus:V.status,status:R,beforeIndex:A,afterIndex:E,targetTaskId:f.id,position:v.position});return}if(v.type==="kanban_column"&&v.status){let{status:f,lastTask:R}=v;if(R){if(V.id===R.id){if(V.status===f)return;O({taskId:V.id,fromStatus:V.status,status:f});return}O({taskId:V.id,fromStatus:V.status,status:f,afterIndex:R.sortIndex??void 0,targetTaskId:R.id,position:"after"});return}if(V.status===f)return;O({taskId:V.id,fromStatus:V.status,status:f})}};return J(O1,{sensors:[b1.configure({activationConstraints:[new P1.Distance({value:8})]}),U1],onDragEnd:T,children:[_("div",{className:"flex-1 min-h-0 overflow-x-auto overflow-y-hidden p-4 bg-background/50",children:_("div",{className:"flex gap-4 h-full min-w-max pb-2",children:y1.map((Q)=>_(R1,{teamId:$,status:Q,selectedGoalId:H,scope:F,currentUserId:h,currentUserRole:L,onTaskClick:B,onDeleteTask:(X)=>y(X),onCreateTaskInColumn:U},Q))})}),b&&_(A_,{open:!!b,onOpenChange:(Q)=>!Q&&y(null),children:J(G_,{children:[J(C_,{children:[_(D_,{children:W.delete_task()}),_(p_,{children:W.delete_task_confirm({title:b.title})})]}),J(S_,{children:[_(c_,{disabled:S,children:W.cancel()}),J(T_,{onClick:()=>C(b.id),disabled:S,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[S&&_(g,{className:"w-4 h-4 mr-1.5 animate-spin"}),W.delete()]})]})]})})]})}var p=e(__(),1);function c1({teamId:$,isOpen:H,onClose:F,initialGoalId:h}){let L=o(),B=h===s||!h?"none":h,[U,M]=p.useState(""),[b,y]=p.useState(""),[C,S]=p.useState(!1),[O,T]=p.useState(j_.MEDIUM),[Q,X]=p.useState(B),[w,q]=p.useState("none"),[V,z]=p.useState("none"),[Z,N]=p.useState(void 0),[K,v]=p.useState(void 0),[f,R]=p.useState(null),[A,E]=p.useState(null),[I,D]=p.useState(null),[j,h_]=p.useState([]),[I_,x_]=p.useState([]),[a_,t_]=p.useState(!1),{data:s_}=i({queryKey:["teams",$,"me"],queryFn:async()=>{let Y=await G.api.teams[":teamId"].me.$get({param:{teamId:$}});if(!Y.ok)return null;return await Y.json()},enabled:!!$&&H});p.useEffect(()=>{if(H)M(""),y(""),S(!1),T(j_.MEDIUM),X(B),q("none"),z(s_?.id||"none"),N(void 0),v(void 0),R(null),E(null),D(null),h_([]),x_([])},[H,B,s_?.id]);let{data:e_=[]}=i({queryKey:["teams",$,"members","human"],queryFn:async()=>{let Y=await G.api.teams[":teamId"].members.$get({param:{teamId:$},query:{includeAgents:"false"}});if(!Y.ok)return[];let u=await Y.json();return Array.isArray(u)?u:[]},enabled:!!$&&H}),{data:j1=[]}=i({queryKey:["teams",$,"agents"],queryFn:async()=>{let Y=await G.api.teams[":teamId"].agents.$get({param:{teamId:$}});if(!Y.ok)return[];return await Y.json()||[]},enabled:!!$&&H}),{data:I1}=i({queryKey:["teams",$,"kanban","goals"],queryFn:async()=>{let Y=await G.api.teams[":teamId"].kanban.goals.$get({param:{teamId:$},query:{}});if(!Y.ok)return{data:[]};return await Y.json()},enabled:!!$&&H}),x1=I1?.data||[],{mutate:i1,isPending:v_}=x({mutationFn:async()=>{let Y=await G.api.teams[":teamId"].kanban.tasks.$post({param:{teamId:$},json:{title:U.trim(),description:b.trim()||void 0,isAgentTask:C,priority:O,goalId:Q!=="none"?Q:void 0,assigneeId:w!=="none"?w:void 0,reporterId:V!=="none"?V:void 0,startDate:Z?Z.toISOString():void 0,dueDate:K?K.toISOString():void 0,projectId:f||void 0,targetFolderId:A||void 0,parentIds:j.length>0?j:void 0,assetIds:I_.length>0?I_.map((u)=>u.id):void 0}});if(!Y.ok){let u=await Y.text().catch(()=>""),a=W.error();if(u)try{let n_=JSON.parse(u);if(n_&&typeof n_.message==="string")a=n_.message}catch{a=u}throw Error(a)}return await Y.json()},onSuccess:()=>{L.invalidateQueries({queryKey:["teams",$,"kanban","tasks"]}),L.invalidateQueries({queryKey:["teams",$,"kanban","goals"]}),c.success(W.task_created()),F()},onError:(Y)=>{c.error(Y.message)}}),n1=(Y)=>{if(Y.preventDefault(),!U.trim()||v_)return;i1()},i_=C;return _(M_,{open:H,onOpenChange:(Y)=>!Y&&F(),children:J(w_,{className:"sm:max-w-3xl max-h-[90vh] overflow-y-auto",children:[J("form",{onSubmit:n1,className:"space-y-4",children:[_(F_,{children:_(K_,{children:W.create_task()})}),J("div",{className:"space-y-3.5 py-1",children:[J("div",{className:"space-y-1.5",children:[_(k,{htmlFor:"create-task-title",children:W.task_title()}),_(E_,{id:"create-task-title",value:U,onChange:(Y)=>M(Y.target.value),placeholder:W.task_title_placeholder(),required:!0,autoFocus:!0})]}),J("div",{className:"space-y-1.5",children:[_(k,{htmlFor:"create-task-desc",children:W.task_description()}),_(L_,{id:"create-task-desc",value:b,onChange:(Y)=>y(Y.target.value),placeholder:W.task_description_placeholder(),rows:3})]}),J("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[J("div",{className:"sm:col-span-2 flex items-center justify-between space-x-2 rounded-lg border border-border/80 bg-muted/30 p-2.5 h-14",children:[J("div",{className:"space-y-0.5 min-w-0 pr-2",children:[J(k,{htmlFor:"create-is-agent-task",className:"text-xs font-medium cursor-pointer flex items-center gap-1.5",children:[_($_,{className:"w-3.5 h-3.5 text-orange-500"}),_("span",{children:W.task_type_agent()})]}),_("p",{className:"text-[11px] text-muted-foreground line-clamp-1",children:W.task_type_agent_desc()})]}),_(S1,{id:"create-is-agent-task",checked:C,onCheckedChange:(Y)=>{S(Y),q("none")}})]}),J("div",{className:"space-y-1.5",children:[_(k,{className:"text-xs font-medium text-muted-foreground",children:W.task_priority()}),J(V_,{value:O,onValueChange:(Y)=>T(Y),children:[_(f_,{className:"w-full h-9 text-xs",children:_(Q_,{})}),_(N_,{children:Object.values(j_).map((Y)=>_(d,{value:Y,children:_("span",{className:m("px-1.5 py-0.5 rounded text-[10px] uppercase font-medium",u_(Y)),children:k_(Y)})},Y))})]})]}),J("div",{className:"space-y-1.5",children:[_(k,{className:"text-xs font-medium text-muted-foreground",children:W.goals()}),J(V_,{value:Q,onValueChange:X,children:[_(f_,{className:"w-full h-9 text-xs",children:_(Q_,{placeholder:"None"})}),J(N_,{children:[_(d,{value:"none",children:_("span",{className:"text-muted-foreground italic",children:"None"})}),x1.filter((Y)=>Y.id!==s).map((Y)=>_(d,{value:Y.id,children:J("div",{className:"flex items-center gap-2",children:[_(n,{className:"w-3.5 h-3.5 text-primary"}),_("span",{children:Y.title})]})},Y.id))]})]})]}),J("div",{className:"space-y-1.5",children:[_(k,{className:"text-xs font-medium text-muted-foreground",children:i_?W.select_agent():W.assignee()}),J(V_,{value:w,onValueChange:q,children:[_(f_,{className:"w-full h-9 text-xs",children:_(Q_,{placeholder:W.unassigned()})}),J(N_,{children:[_(d,{value:"none",children:_("span",{className:"text-muted-foreground italic",children:W.unassigned()})}),i_?j1.map((Y)=>_(d,{value:Y.id,children:J("div",{className:"flex items-center gap-2",children:[_($_,{className:"w-3.5 h-3.5 text-purple-500"}),_("span",{children:Y.name})]})},Y.id)):e_.map((Y)=>_(d,{value:Y.id,children:J("div",{className:"flex items-center gap-2",children:[J(X_,{size:"sm",className:"w-4 h-4",children:[_(H_,{src:Y.image}),_(z_,{className:"text-[8px]",children:Y.name.slice(0,2).toUpperCase()})]}),_("span",{children:Y.name})]})},Y.id))]})]})]}),J("div",{className:"space-y-1.5",children:[_(k,{className:"text-xs font-medium text-muted-foreground",children:W.reporter()}),J(V_,{value:V,onValueChange:z,children:[_(f_,{className:"w-full h-9 text-xs",children:_(Q_,{placeholder:W.unassigned()})}),J(N_,{children:[_(d,{value:"none",children:_("span",{className:"text-muted-foreground italic",children:W.unassigned()})}),e_.map((Y)=>_(d,{value:Y.id,children:J("div",{className:"flex items-center gap-2",children:[J(X_,{size:"sm",className:"w-4 h-4",children:[_(H_,{src:Y.image}),_(z_,{className:"text-[8px]",children:Y.name.slice(0,2).toUpperCase()})]}),_("span",{children:Y.name})]})},Y.id))]})]})]}),i_&&J("div",{className:"sm:col-span-2 space-y-1.5",children:[_(k,{className:"text-xs font-medium text-muted-foreground",children:W.target_folder()}),J(P,{type:"button",variant:"outline",size:"sm",onClick:()=>t_(!0),className:"w-full justify-start h-9 text-xs truncate font-normal",children:[_(C1,{className:"w-3.5 h-3.5 mr-2 text-primary shrink-0"}),_("span",{className:"truncate",children:I||W.select_target_folder()})]})]}),J("div",{className:"space-y-1.5",children:[_(k,{className:"text-xs font-medium text-muted-foreground",children:W.start_date()}),_(r_,{value:Z,onChange:N,placeholder:W.start_date(),className:"h-9 text-xs"})]}),J("div",{className:"space-y-1.5",children:[_(k,{className:"text-xs font-medium text-muted-foreground",children:W.due_date()}),_(r_,{value:K,onChange:v,placeholder:W.due_date(),className:"h-9 text-xs"})]}),J("div",{className:"sm:col-span-2 space-y-1.5",children:[_(k,{className:"text-xs font-medium text-muted-foreground",children:W.parent_tasks()}),_(D1,{teamId:$,value:j,onChange:h_})]}),_("div",{className:"sm:col-span-2 pt-1",children:_(p1,{teamId:$,projectId:f,assets:I_,onAddAssets:(Y)=>x_((u)=>[...u,...Y]),onRemoveAsset:(Y)=>x_((u)=>u.filter((a)=>a.id!==Y))})})]})]}),J(B_,{children:[_(P,{type:"button",variant:"outline",onClick:F,disabled:v_,children:W.cancel()}),J(P,{type:"submit",disabled:!U.trim()||v_,children:[v_&&_(g,{className:"w-4 h-4 mr-1.5 animate-spin"}),W.create()]})]})]}),a_&&_(T1,{teamId:$,currentProjectId:f,currentTargetFolderId:A,isOpen:a_,onClose:()=>t_(!1),onSelect:(Y,u,a)=>{R(Y),E(u),D(a||"Selected Folder")}})]})})}function k1({teamId:$,initialTaskId:H}){let[F,h]=r.useState("team"),[L,B]=r.useState(null),[U,M]=r.useState(H??null),[b,y]=r.useState(!1);r.useEffect(()=>{if(H)M(H)},[H]);let[C,S]=r.useState(l.TODO),{data:O,isLoading:T}=i({queryKey:["teams",$,"me"],queryFn:async()=>{let Z=await G.api.teams[":teamId"].me.$get({param:{teamId:$}});if(!Z.ok)throw Error("Failed to fetch me");return await Z.json()},enabled:!!$}),{data:Q}=i({queryKey:["teams",$,"kanban","goals"],queryFn:async()=>{let Z=await G.api.teams[":teamId"].kanban.goals.$get({param:{teamId:$},query:{}});if(!Z.ok)return{data:[]};return await Z.json()},enabled:!!$}),X=Q?.data||[],w=L?X.find((Z)=>Z.id===L)||null:null,q=O?.role?.toLowerCase()==="owner"||O?.role?.toLowerCase()==="editor",V=(Z=l.TODO)=>{S(Z),y(!0)},z=(Z)=>{M(Z.id)};if(T)return _("div",{className:"flex h-full items-center justify-center",children:_(g,{className:"w-8 h-8 animate-spin text-muted-foreground"})});return J("div",{className:"flex flex-row h-full bg-background overflow-hidden font-sans",children:[_(z1,{teamId:$,selectedGoalId:L,onSelectGoal:B,isOwnerOrEditor:q}),J("div",{className:"flex-1 flex flex-col min-w-0 h-full overflow-hidden",children:[_(W1,{scope:F,onScopeChange:h,selectedGoal:w,onClearGoal:()=>B(null),onCreateTask:()=>V(l.TODO),canCreateTask:q}),_(G1,{teamId:$,selectedGoalId:L,scope:F,currentUserId:O?.id,currentUserRole:O?.role,onTaskClick:z,onCreateTaskInColumn:(Z)=>V(Z)})]}),U&&_(m1,{teamId:$,taskId:U,isOpen:!!U,onClose:()=>M(null),canEdit:q}),b&&_(c1,{teamId:$,isOpen:b,initialStatus:C,initialGoalId:L,onClose:()=>y(!1)})]})}function d1(){let{teamId:$}=u1.useParams(),{taskId:H}=u1.useSearch();return _(k1,{teamId:$,initialTaskId:H})}var u1=g1("/teams/$teamId/kanban")({component:d1});export{u1 as Route};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Fa as a}from"./chunk-rakz3pe6.js";import"./chunk-wwjqqqr4.js";export default a();