@maincode-ai/matilda-code 0.21.12 → 0.21.13-nightly.20261026.e0eae1d8c

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 (194) hide show
  1. package/bundled/mainy/SKILL.md +0 -2
  2. package/bundled/mainy/docs/_meta.ts +0 -2
  3. package/bundled/mainy/docs/configuration/auth.md +5 -10
  4. package/bundled/mainy/docs/configuration/model-providers.md +31 -217
  5. package/bundled/mainy/docs/configuration/settings.md +32 -4
  6. package/bundled/mainy/docs/features/auto-mode.md +1 -1
  7. package/bundled/mainy/docs/features/channels/_meta.ts +0 -3
  8. package/bundled/mainy/docs/features/channels/overview.md +8 -16
  9. package/bundled/mainy/docs/features/commands.md +4 -4
  10. package/bundled/mainy/docs/features/hooks.md +9 -7
  11. package/bundled/mainy/docs/features/language.md +2 -29
  12. package/bundled/mainy/docs/features/sub-agents.md +1 -1
  13. package/bundled/mainy/docs/features/worktree.md +3 -5
  14. package/bundled/mainy/docs/integration-github-action.md +3 -3
  15. package/bundled/mainy/docs/matilda-serve.md +1 -1
  16. package/bundled/mainy/docs/quickstart.md +2 -2
  17. package/bundled/mainy/docs/support/troubleshooting.md +3 -10
  18. package/chunks/agent-4FTU3WN6.js +3 -0
  19. package/chunks/agent-headless-QJUVHPFC.js +3 -0
  20. package/chunks/{askUserQuestion-2QI4NSFJ.js → askUserQuestion-QKX4NEFX.js} +1 -1
  21. package/chunks/{ca-I2HEEIL7.js → ca-C2V7I65K.js} +6 -6
  22. package/chunks/{chunk-6E766NPX.js → chunk-2ONZZ46N.js} +2 -2
  23. package/chunks/chunk-36K4HBVM.js +7 -0
  24. package/chunks/{chunk-EQGA7LH7.js → chunk-3B2HABK7.js} +1 -1
  25. package/chunks/{chunk-MCQUPLRE.js → chunk-5NMK4Y7C.js} +1 -1
  26. package/chunks/chunk-5YT4GCK7.js +14 -0
  27. package/chunks/{chunk-27Q5KW3A.js → chunk-62AFAL4I.js} +10 -10
  28. package/chunks/chunk-75KP2FVD.js +81 -0
  29. package/chunks/chunk-7ZODGQO6.js +4 -0
  30. package/chunks/chunk-BZB7HYRC.js +37 -0
  31. package/chunks/{chunk-YRQP3SLC.js → chunk-EXNHJQCD.js} +1 -1
  32. package/chunks/chunk-FCGYRGV4.js +9 -0
  33. package/chunks/chunk-G4YMVWG4.js +8 -0
  34. package/chunks/{chunk-6T2GIM76.js → chunk-HDARIAVM.js} +1 -1
  35. package/chunks/{chunk-YJAKOETP.js → chunk-HM5LCKDB.js} +2 -2
  36. package/chunks/chunk-IIQ5YERM.js +120 -0
  37. package/chunks/{chunk-CSJTA7NE.js → chunk-JGJ7BVZN.js} +18 -18
  38. package/chunks/{chunk-GTVCJCHR.js → chunk-JIKQI4MZ.js} +1 -1
  39. package/chunks/{chunk-WV3IUPZS.js → chunk-LHDCAN7Z.js} +1 -1
  40. package/chunks/chunk-LZDHANXA.js +89 -0
  41. package/chunks/{chunk-PGXQZVLX.js → chunk-NOE4UNQN.js} +1 -1
  42. package/chunks/chunk-OEZS5R3S.js +207 -0
  43. package/chunks/{chunk-OOEH6ZSV.js → chunk-PTMCLADZ.js} +1 -1
  44. package/chunks/{chunk-2HTPVSGT.js → chunk-PYZNGIIR.js} +1 -1
  45. package/chunks/chunk-QJJTUDDA.js +56 -0
  46. package/chunks/{chunk-LUNDTQ3G.js → chunk-R34HYLL4.js} +1 -1
  47. package/chunks/{chunk-QVCGLQCI.js → chunk-RK4LPGBV.js} +3 -3
  48. package/chunks/{chunk-DE3HKC2W.js → chunk-RYHMPK5G.js} +1 -1
  49. package/chunks/chunk-SR7ARGUY.js +13 -0
  50. package/chunks/{chunk-JRECUFB3.js → chunk-SY6JRCN3.js} +636 -654
  51. package/chunks/chunk-TUKNB5CQ.js +33 -0
  52. package/chunks/{chunk-VTGICC67.js → chunk-TZ4FRU6B.js} +1 -1
  53. package/chunks/chunk-U7V7APDV.js +9 -0
  54. package/chunks/{chunk-CZGZ3KK7.js → chunk-UVWZ44ZW.js} +1 -1
  55. package/chunks/{chunk-HYVP4472.js → chunk-V6UPUMP3.js} +1 -1
  56. package/chunks/{chunk-DOOFGSRV.js → chunk-VLDZBRTL.js} +1 -1
  57. package/chunks/{computer-use-WKDNUTLD.js → computer-use-OXAMR75N.js} +1 -1
  58. package/chunks/contextCommand-ERLW5VWL.js +3 -0
  59. package/chunks/{cron-create-F2LXM2OA.js → cron-create-AUDQ6STP.js} +1 -1
  60. package/chunks/{cron-delete-DE6Q2S2L.js → cron-delete-P5HE3PDD.js} +1 -1
  61. package/chunks/{cron-list-IAQEJVV7.js → cron-list-NR5FZBK2.js} +1 -1
  62. package/chunks/{de-AQXFJYZI.js → de-KOUI2CEW.js} +5 -5
  63. package/chunks/{devtools-5JRKK3E7.js → devtools-G5DWLP2N.js} +1 -1
  64. package/chunks/dist-XXTQNTKQ.js +42 -0
  65. package/chunks/dist-ZFZZLIQU.js +3 -0
  66. package/chunks/{edit-QQNJZ55P.js → edit-REFR5ROS.js} +1 -1
  67. package/chunks/{en-EJLDYIBM.js → en-RMYRLXC2.js} +4 -4
  68. package/chunks/{enter-worktree-5X5SAMBJ.js → enter-worktree-WO3DT2G7.js} +1 -1
  69. package/chunks/{enterPlanMode-HP35SPLN.js → enterPlanMode-PLRHEU5A.js} +1 -1
  70. package/chunks/{exit-worktree-SRKZBEYF.js → exit-worktree-J5PW6DCV.js} +1 -1
  71. package/chunks/{exitPlanMode-WSPTGGVN.js → exitPlanMode-KXUPNLCJ.js} +2 -2
  72. package/chunks/{fr-6TDHK7F2.js → fr-R3QF3LA2.js} +5 -5
  73. package/chunks/glob-ZVTVRDQO.js +22 -0
  74. package/chunks/{goal-tools-C6BSBHCF.js → goal-tools-XVKQJL5I.js} +1 -1
  75. package/chunks/{grep-MVCOBUYW.js → grep-R7CWUNNE.js} +1 -1
  76. package/chunks/{ja-GGNJR7AR.js → ja-A5OQLXUZ.js} +5 -5
  77. package/chunks/{keychain-token-storage-KQK6MNOJ.js → keychain-token-storage-IM4UB4P4.js} +1 -1
  78. package/chunks/{ls-JYJXFSXN.js → ls-DEAFYDVV.js} +1 -1
  79. package/chunks/{lsp-DYDK6XCS.js → lsp-DL7W47VY.js} +1 -1
  80. package/chunks/matildaAgentContentGenerator-57EIU5XE.js +8 -0
  81. package/chunks/mcp-client-X7LEGSP3.js +3 -0
  82. package/chunks/monitor-KPWTMH3V.js +32 -0
  83. package/chunks/{multipart-parser-JI75T2O5.js → multipart-parser-FKHYAVGR.js} +1 -1
  84. package/chunks/notebook-edit-3ZH5M2TC.js +17 -0
  85. package/chunks/openaiContentGenerator-6PXSD3T7.js +37 -0
  86. package/chunks/{pt-D6L2QTDM.js → pt-RG3S3KA7.js} +5 -5
  87. package/chunks/read-file-JNS7WRUP.js +3 -0
  88. package/chunks/ripGrep-ICJDGIIV.js +3 -0
  89. package/chunks/{ru-BNJCHDYO.js → ru-5S5HLRT7.js} +5 -5
  90. package/chunks/scheduler-QC2PPMFP.js +8 -0
  91. package/chunks/{send-message-P3SMWNEE.js → send-message-V2WYLN5X.js} +1 -1
  92. package/chunks/{serve-FXH6EBQ6.js → serve-NUVQULZJ.js} +59 -48
  93. package/chunks/shell-5LNI7URE.js +3 -0
  94. package/chunks/{skill-HZPFEAPF.js → skill-QFATRHQW.js} +1 -1
  95. package/chunks/src-6UPZ7TVB.js +3 -0
  96. package/chunks/src-LZEU4AYF.js +5 -0
  97. package/chunks/{symbol-search-EAIZPWN7.js → symbol-search-WL6ZHUUN.js} +1 -1
  98. package/chunks/{syntheticOutput-432LXITX.js → syntheticOutput-3KW6SQAF.js} +1 -1
  99. package/chunks/task-create-PNW5SN27.js +3 -0
  100. package/chunks/{task-detach-XMSJ3HBM.js → task-detach-B7PDPFBA.js} +1 -1
  101. package/chunks/task-list-GGZATGK5.js +9 -0
  102. package/chunks/{task-stop-NTS62FLG.js → task-stop-UKBBE2KG.js} +1 -1
  103. package/chunks/{task-update-AR26UFYZ.js → task-update-4RHVUBUV.js} +1 -1
  104. package/chunks/{team-create-PYXFVIR5.js → team-create-2TJC3X57.js} +1 -1
  105. package/chunks/team-delete-4UJ7SU65.js +8 -0
  106. package/chunks/todoWrite-NEBVKOSG.js +3 -0
  107. package/chunks/{tool-search-RKZDSRYS.js → tool-search-R5GS64YR.js} +1 -1
  108. package/chunks/{web-fetch-VW3SVDQ6.js → web-fetch-H3XJMAEF.js} +17 -17
  109. package/chunks/{web-search-XQUIZARL.js → web-search-Q6RWPEIB.js} +1 -1
  110. package/chunks/{workflow-YXNXDRWZ.js → workflow-3A7KN3E3.js} +2 -2
  111. package/chunks/write-file-O7Q6SKZC.js +15 -0
  112. package/cli.js +502 -498
  113. package/locales/ca.js +1 -28
  114. package/locales/de.js +1 -28
  115. package/locales/en.js +1 -30
  116. package/locales/fr.js +1 -30
  117. package/locales/ja.js +1 -28
  118. package/locales/pt.js +1 -28
  119. package/locales/ru.js +1 -28
  120. package/package.json +2 -2
  121. package/sandbox-macos-permissive-closed.sb +0 -1
  122. package/sandbox-macos-permissive-open.sb +0 -1
  123. package/sandbox-macos-permissive-proxied.sb +0 -1
  124. package/sandbox-macos-restrictive-closed.sb +0 -1
  125. package/sandbox-macos-restrictive-open.sb +0 -1
  126. package/sandbox-macos-restrictive-proxied.sb +0 -1
  127. package/bundled/mainy/docs/features/channels/dingtalk.md +0 -134
  128. package/bundled/mainy/docs/features/channels/feishu.md +0 -186
  129. package/bundled/mainy/docs/features/channels/weixin.md +0 -106
  130. package/bundled/mainy/docs/integration-jetbrains.md +0 -81
  131. package/bundled/mainy/docs/integration-zed.md +0 -72
  132. package/chunks/agent-WM63A6NK.js +0 -3
  133. package/chunks/agent-headless-QIUBDKPW.js +0 -3
  134. package/chunks/anthropicContentGenerator-VKFTAIU3.js +0 -39
  135. package/chunks/chunk-2MOGYHWM.js +0 -8
  136. package/chunks/chunk-3IRGBRSP.js +0 -113
  137. package/chunks/chunk-3YLXGE6T.js +0 -8
  138. package/chunks/chunk-4F4DA5UI.js +0 -8
  139. package/chunks/chunk-4J6DC24J.js +0 -59
  140. package/chunks/chunk-4Q2SNBUH.js +0 -18
  141. package/chunks/chunk-5C2RJ5RR.js +0 -37
  142. package/chunks/chunk-6EQMZNIY.js +0 -8
  143. package/chunks/chunk-6GBNB5Z2.js +0 -3
  144. package/chunks/chunk-6Z2MV7ZY.js +0 -186
  145. package/chunks/chunk-BVOCFLC4.js +0 -56
  146. package/chunks/chunk-FPO57O66.js +0 -39
  147. package/chunks/chunk-G7R2XEEF.js +0 -7
  148. package/chunks/chunk-GOJCMVJJ.js +0 -8
  149. package/chunks/chunk-JCE3JAVC.js +0 -25
  150. package/chunks/chunk-KHHJYBR5.js +0 -9
  151. package/chunks/chunk-LJR4RZZ2.js +0 -3
  152. package/chunks/chunk-MO2HXJG5.js +0 -9
  153. package/chunks/chunk-O44XK65C.js +0 -8
  154. package/chunks/chunk-OA56BXPD.js +0 -3
  155. package/chunks/chunk-PA6532AY.js +0 -6
  156. package/chunks/chunk-QN6Y6NPA.js +0 -3
  157. package/chunks/chunk-S3CWEVTS.js +0 -15
  158. package/chunks/chunk-SDTWBD62.js +0 -8
  159. package/chunks/chunk-U347OO7S.js +0 -9
  160. package/chunks/chunk-UIRBHC5X.js +0 -3
  161. package/chunks/chunk-VI74YQQO.js +0 -8
  162. package/chunks/chunk-VYZOOSMP.js +0 -30
  163. package/chunks/chunk-WC2VTVCE.js +0 -27
  164. package/chunks/chunk-WVY2P6WH.js +0 -26
  165. package/chunks/chunk-WZ75OGYY.js +0 -14
  166. package/chunks/chunk-XMZIY7XX.js +0 -13
  167. package/chunks/chunk-YV3PUOBU.js +0 -65
  168. package/chunks/contextCommand-DAB3HOHY.js +0 -3
  169. package/chunks/dist-7UYRLSLE.js +0 -3
  170. package/chunks/dist-ME6647DQ.js +0 -195
  171. package/chunks/dist-P6SLWL5V.js +0 -42
  172. package/chunks/dist-VG3ZDJ2A.js +0 -28
  173. package/chunks/dist-YTCHM57U.js +0 -23
  174. package/chunks/fileFromPath-7UCWPD4W.js +0 -3
  175. package/chunks/geminiContentGenerator-RJ73DQAP.js +0 -8
  176. package/chunks/glob-QQ6LGKDX.js +0 -22
  177. package/chunks/matildaAgentContentGenerator-YUYS4336.js +0 -8
  178. package/chunks/matildaContentGenerator-O4Z2QPCP.js +0 -8
  179. package/chunks/matildaOAuth2-7COTQQR2.js +0 -3
  180. package/chunks/mcp-client-RXVQU5VI.js +0 -3
  181. package/chunks/monitor-77KXDXPR.js +0 -32
  182. package/chunks/notebook-edit-TKJD2EQZ.js +0 -17
  183. package/chunks/openaiContentGenerator-2EALAM3U.js +0 -3
  184. package/chunks/read-file-3KUAH6ND.js +0 -3
  185. package/chunks/ripGrep-U2PLKXMY.js +0 -3
  186. package/chunks/scheduler-J7VU2V5Y.js +0 -8
  187. package/chunks/shell-PXR2AXDD.js +0 -3
  188. package/chunks/src-RFAEPLY7.js +0 -3
  189. package/chunks/src-WZTRMETQ.js +0 -5
  190. package/chunks/task-create-Z3QRCMX4.js +0 -3
  191. package/chunks/task-list-GXAJW3JP.js +0 -9
  192. package/chunks/team-delete-OMYVUAQU.js +0 -8
  193. package/chunks/todoWrite-5NZ7CHTC.js +0 -3
  194. package/chunks/write-file-XDDLTGSG.js +0 -15
@@ -0,0 +1,33 @@
1
+ // Force strict mode and setup for ESM
2
+ "use strict";
3
+ import{b as W}from"./chunk-GZPNIYVZ.js";import{a as Ct,c as Tt,d as pr,f as Nn}from"./chunk-OWGSC52X.js";var Un=pr((Pt,Qn)=>{W();(function(f,s){typeof Pt=="object"&&typeof Qn<"u"?s(Pt):typeof define=="function"&&define.amd?define(["exports"],s):(f=typeof globalThis<"u"?globalThis:f||self,s(f.WebStreamsPolyfill={}))})(Pt,function(f){"use strict";function s(){}function l(e){return typeof e=="object"&&e!==null||typeof e=="function"}let b=s;function d(e,t){try{Object.defineProperty(e,"name",{value:t,configurable:!0})}catch{}}let R=Promise,C=Promise.prototype.then,fe=Promise.reject.bind(R);function P(e){return new R(e)}function S(e){return P(t=>t(e))}function c(e){return fe(e)}function B(e,t,r){return C.call(e,t,r)}function v(e,t,r){B(B(e,t,r),void 0,b)}function L(e,t){v(e,t)}function Q(e,t){v(e,void 0,t)}function U(e,t,r){return B(e,t,r)}function Ce(e){B(e,void 0,b)}let de=e=>{if(typeof queueMicrotask=="function")de=queueMicrotask;else{let t=S(void 0);de=r=>B(t,r)}return de(e)};function ce(e,t,r){if(typeof e!="function")throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function K(e,t,r){try{return S(ce(e,t,r))}catch(n){return c(n)}}let wr=16384;class O{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(t){let r=this._back,n=r;r._elements.length===wr-1&&(n={_elements:[],_next:void 0}),r._elements.push(t),n!==r&&(this._back=n,r._next=n),++this._size}shift(){let t=this._front,r=t,n=this._cursor,o=n+1,a=t._elements,i=a[n];return o===wr&&(r=t._next,o=0),--this._size,this._cursor=o,t!==r&&(this._front=r),a[n]=void 0,i}forEach(t){let r=this._cursor,n=this._front,o=n._elements;for(;(r!==o.length||n._next!==void 0)&&!(r===o.length&&(n=n._next,o=n._elements,r=0,o.length===0));)t(o[r]),++r}peek(){let t=this._front,r=this._cursor;return t._elements[r]}}let Cr=Symbol("[[AbortSteps]]"),Tr=Symbol("[[ErrorSteps]]"),At=Symbol("[[CancelSteps]]"),Wt=Symbol("[[PullSteps]]"),Bt=Symbol("[[ReleaseSteps]]");function Pr(e,t){e._ownerReadableStream=t,t._reader=e,t._state==="readable"?Ot(e):t._state==="closed"?ro(e):vr(e,t._storedError)}function kt(e,t){let r=e._ownerReadableStream;return D(r,t)}function Y(e){let t=e._ownerReadableStream;t._state==="readable"?Ft(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):no(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),t._readableStreamController[Bt](),t._reader=void 0,e._ownerReadableStream=void 0}function He(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function Ot(e){e._closedPromise=P((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r})}function vr(e,t){Ot(e),Ft(e,t)}function ro(e){Ot(e),Er(e)}function Ft(e,t){e._closedPromise_reject!==void 0&&(Ce(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function no(e,t){vr(e,t)}function Er(e){e._closedPromise_resolve!==void 0&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}let qr=Number.isFinite||function(e){return typeof e=="number"&&isFinite(e)},oo=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function ao(e){return typeof e=="object"||typeof e=="function"}function $(e,t){if(e!==void 0&&!ao(e))throw new TypeError(`${t} is not an object.`)}function F(e,t){if(typeof e!="function")throw new TypeError(`${t} is not a function.`)}function io(e){return typeof e=="object"&&e!==null||typeof e=="function"}function Ar(e,t){if(!io(e))throw new TypeError(`${t} is not an object.`)}function V(e,t,r){if(e===void 0)throw new TypeError(`Parameter ${t} is required in '${r}'.`)}function zt(e,t,r){if(e===void 0)throw new TypeError(`${t} is required in '${r}'.`)}function It(e){return Number(e)}function Wr(e){return e===0?0:e}function so(e){return Wr(oo(e))}function jt(e,t){let n=Number.MAX_SAFE_INTEGER,o=Number(e);if(o=Wr(o),!qr(o))throw new TypeError(`${t} is not a finite number`);if(o=so(o),o<0||o>n)throw new TypeError(`${t} is outside the accepted range of 0 to ${n}, inclusive`);return!qr(o)||o===0?0:o}function Dt(e,t){if(!ie(e))throw new TypeError(`${t} is not a ReadableStream.`)}function Te(e){return new ee(e)}function Br(e,t){e._reader._readRequests.push(t)}function Mt(e,t,r){let o=e._reader._readRequests.shift();r?o._closeSteps():o._chunkSteps(t)}function Ge(e){return e._reader._readRequests.length}function kr(e){let t=e._reader;return!(t===void 0||!te(t))}class ee{constructor(t){if(V(t,1,"ReadableStreamDefaultReader"),Dt(t,"First parameter"),se(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");Pr(this,t),this._readRequests=new O}get closed(){return te(this)?this._closedPromise:c(xe("closed"))}cancel(t=void 0){return te(this)?this._ownerReadableStream===void 0?c(He("cancel")):kt(this,t):c(xe("cancel"))}read(){if(!te(this))return c(xe("read"));if(this._ownerReadableStream===void 0)return c(He("read from"));let t,r,n=P((a,i)=>{t=a,r=i});return Ie(this,{_chunkSteps:a=>t({value:a,done:!1}),_closeSteps:()=>t({value:void 0,done:!0}),_errorSteps:a=>r(a)}),n}releaseLock(){if(!te(this))throw xe("releaseLock");this._ownerReadableStream!==void 0&&lo(this)}}Object.defineProperties(ee.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),d(ee.prototype.cancel,"cancel"),d(ee.prototype.read,"read"),d(ee.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(ee.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});function te(e){return!l(e)||!Object.prototype.hasOwnProperty.call(e,"_readRequests")?!1:e instanceof ee}function Ie(e,t){let r=e._ownerReadableStream;r._disturbed=!0,r._state==="closed"?t._closeSteps():r._state==="errored"?t._errorSteps(r._storedError):r._readableStreamController[Wt](t)}function lo(e){Y(e);let t=new TypeError("Reader was released");Or(e,t)}function Or(e,t){let r=e._readRequests;e._readRequests=new O,r.forEach(n=>{n._errorSteps(t)})}function xe(e){return new TypeError(`ReadableStreamDefaultReader.prototype.${e} can only be used on a ReadableStreamDefaultReader`)}let uo=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class Fr{constructor(t,r){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=t,this._preventCancel=r}next(){let t=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?U(this._ongoingPromise,t,t):t(),this._ongoingPromise}return(t){let r=()=>this._returnSteps(t);return this._ongoingPromise?U(this._ongoingPromise,r,r):r()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});let t=this._reader,r,n,o=P((i,u)=>{r=i,n=u});return Ie(t,{_chunkSteps:i=>{this._ongoingPromise=void 0,de(()=>r({value:i,done:!1}))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,Y(t),r({value:void 0,done:!0})},_errorSteps:i=>{this._ongoingPromise=void 0,this._isFinished=!0,Y(t),n(i)}}),o}_returnSteps(t){if(this._isFinished)return Promise.resolve({value:t,done:!0});this._isFinished=!0;let r=this._reader;if(!this._preventCancel){let n=kt(r,t);return Y(r),U(n,()=>({value:t,done:!0}))}return Y(r),S({value:t,done:!0})}}let zr={next(){return Ir(this)?this._asyncIteratorImpl.next():c(jr("next"))},return(e){return Ir(this)?this._asyncIteratorImpl.return(e):c(jr("return"))}};Object.setPrototypeOf(zr,uo);function fo(e,t){let r=Te(e),n=new Fr(r,t),o=Object.create(zr);return o._asyncIteratorImpl=n,o}function Ir(e){if(!l(e)||!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl"))return!1;try{return e._asyncIteratorImpl instanceof Fr}catch{return!1}}function jr(e){return new TypeError(`ReadableStreamAsyncIterator.${e} can only be used on a ReadableSteamAsyncIterator`)}let Dr=Number.isNaN||function(e){return e!==e};var Lt,$t,Nt;function je(e){return e.slice()}function Mr(e,t,r,n,o){new Uint8Array(e).set(new Uint8Array(r,n,o),t)}let H=e=>(typeof e.transfer=="function"?H=t=>t.transfer():typeof structuredClone=="function"?H=t=>structuredClone(t,{transfer:[t]}):H=t=>t,H(e)),re=e=>(typeof e.detached=="boolean"?re=t=>t.detached:re=t=>t.byteLength===0,re(e));function Lr(e,t,r){if(e.slice)return e.slice(t,r);let n=r-t,o=new ArrayBuffer(n);return Mr(o,0,e,t,n),o}function Ze(e,t){let r=e[t];if(r!=null){if(typeof r!="function")throw new TypeError(`${String(t)} is not a function`);return r}}function co(e){let t={[Symbol.iterator]:()=>e.iterator},r=async function*(){return yield*t}(),n=r.next;return{iterator:r,nextMethod:n,done:!1}}let Qt=(Nt=(Lt=Symbol.asyncIterator)!==null&&Lt!==void 0?Lt:($t=Symbol.for)===null||$t===void 0?void 0:$t.call(Symbol,"Symbol.asyncIterator"))!==null&&Nt!==void 0?Nt:"@@asyncIterator";function $r(e,t="sync",r){if(r===void 0)if(t==="async"){if(r=Ze(e,Qt),r===void 0){let a=Ze(e,Symbol.iterator),i=$r(e,"sync",a);return co(i)}}else r=Ze(e,Symbol.iterator);if(r===void 0)throw new TypeError("The object is not iterable");let n=ce(r,e,[]);if(!l(n))throw new TypeError("The iterator method must return an object");let o=n.next;return{iterator:n,nextMethod:o,done:!1}}function ho(e){let t=ce(e.nextMethod,e.iterator,[]);if(!l(t))throw new TypeError("The iterator.next() method must return an object");return t}function bo(e){return!!e.done}function mo(e){return e.value}function po(e){return!(typeof e!="number"||Dr(e)||e<0)}function Nr(e){let t=Lr(e.buffer,e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}function Ut(e){let t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function Yt(e,t,r){if(!po(r)||r===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");e._queue.push({value:t,size:r}),e._queueTotalSize+=r}function yo(e){return e._queue.peek().value}function ne(e){e._queue=new O,e._queueTotalSize=0}function Qr(e){return e===DataView}function _o(e){return Qr(e.constructor)}function So(e){return Qr(e)?1:e.BYTES_PER_ELEMENT}class he{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!Vt(this))throw Xt("view");return this._view}respond(t){if(!Vt(this))throw Xt("respond");if(V(t,1,"respond"),t=jt(t,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");if(re(this._view.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");et(this._associatedReadableByteStreamController,t)}respondWithNewView(t){if(!Vt(this))throw Xt("respondWithNewView");if(V(t,1,"respondWithNewView"),!ArrayBuffer.isView(t))throw new TypeError("You can only respond with array buffer views");if(this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");if(re(t.buffer))throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");tt(this._associatedReadableByteStreamController,t)}}Object.defineProperties(he.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),d(he.prototype.respond,"respond"),d(he.prototype.respondWithNewView,"respondWithNewView"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(he.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class G{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!be(this))throw Me("byobRequest");return Zt(this)}get desiredSize(){if(!be(this))throw Me("desiredSize");return Kr(this)}close(){if(!be(this))throw Me("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");let t=this._controlledReadableByteStream._state;if(t!=="readable")throw new TypeError(`The stream (in ${t} state) is not in the readable state and cannot be closed`);De(this)}enqueue(t){if(!be(this))throw Me("enqueue");if(V(t,1,"enqueue"),!ArrayBuffer.isView(t))throw new TypeError("chunk must be an array buffer view");if(t.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(t.buffer.byteLength===0)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");let r=this._controlledReadableByteStream._state;if(r!=="readable")throw new TypeError(`The stream (in ${r} state) is not in the readable state and cannot be enqueued to`);Ke(this,t)}error(t=void 0){if(!be(this))throw Me("error");z(this,t)}[At](t){Ur(this),ne(this);let r=this._cancelAlgorithm(t);return Je(this),r}[Wt](t){let r=this._controlledReadableByteStream;if(this._queueTotalSize>0){Jr(this,t);return}let n=this._autoAllocateChunkSize;if(n!==void 0){let o;try{o=new ArrayBuffer(n)}catch(i){t._errorSteps(i);return}let a={buffer:o,bufferByteLength:n,byteOffset:0,byteLength:n,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(a)}Br(r,t),me(this)}[Bt](){if(this._pendingPullIntos.length>0){let t=this._pendingPullIntos.peek();t.readerType="none",this._pendingPullIntos=new O,this._pendingPullIntos.push(t)}}}Object.defineProperties(G.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),d(G.prototype.close,"close"),d(G.prototype.enqueue,"enqueue"),d(G.prototype.error,"error"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(G.prototype,Symbol.toStringTag,{value:"ReadableByteStreamController",configurable:!0});function be(e){return!l(e)||!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")?!1:e instanceof G}function Vt(e){return!l(e)||!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")?!1:e instanceof he}function me(e){if(!To(e))return;if(e._pulling){e._pullAgain=!0;return}e._pulling=!0;let r=e._pullAlgorithm();v(r,()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,me(e)),null),n=>(z(e,n),null))}function Ur(e){Gt(e),e._pendingPullIntos=new O}function Ht(e,t){let r=!1;e._state==="closed"&&(r=!0);let n=Yr(t);t.readerType==="default"?Mt(e,n,r):Wo(e,n,r)}function Yr(e){let t=e.bytesFilled,r=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/r)}function Xe(e,t,r,n){e._queue.push({buffer:t,byteOffset:r,byteLength:n}),e._queueTotalSize+=n}function Vr(e,t,r,n){let o;try{o=Lr(t,r,r+n)}catch(a){throw z(e,a),a}Xe(e,o,0,n)}function Hr(e,t){t.bytesFilled>0&&Vr(e,t.buffer,t.byteOffset,t.bytesFilled),Pe(e)}function Gr(e,t){let r=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),n=t.bytesFilled+r,o=r,a=!1,i=n%t.elementSize,u=n-i;u>=t.minimumFill&&(o=u-t.bytesFilled,a=!0);let p=e._queue;for(;o>0;){let h=p.peek(),y=Math.min(o,h.byteLength),_=t.byteOffset+t.bytesFilled;Mr(t.buffer,_,h.buffer,h.byteOffset,y),h.byteLength===y?p.shift():(h.byteOffset+=y,h.byteLength-=y),e._queueTotalSize-=y,xr(e,y,t),o-=y}return a}function xr(e,t,r){r.bytesFilled+=t}function Zr(e){e._queueTotalSize===0&&e._closeRequested?(Je(e),Ye(e._controlledReadableByteStream)):me(e)}function Gt(e){e._byobRequest!==null&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function xt(e){for(;e._pendingPullIntos.length>0;){if(e._queueTotalSize===0)return;let t=e._pendingPullIntos.peek();Gr(e,t)&&(Pe(e),Ht(e._controlledReadableByteStream,t))}}function go(e){let t=e._controlledReadableByteStream._reader;for(;t._readRequests.length>0;){if(e._queueTotalSize===0)return;let r=t._readRequests.shift();Jr(e,r)}}function Ro(e,t,r,n){let o=e._controlledReadableByteStream,a=t.constructor,i=So(a),{byteOffset:u,byteLength:p}=t,h=r*i,y;try{y=H(t.buffer)}catch(w){n._errorSteps(w);return}let _={buffer:y,bufferByteLength:y.byteLength,byteOffset:u,byteLength:p,bytesFilled:0,minimumFill:h,elementSize:i,viewConstructor:a,readerType:"byob"};if(e._pendingPullIntos.length>0){e._pendingPullIntos.push(_),rn(o,n);return}if(o._state==="closed"){let w=new a(_.buffer,_.byteOffset,0);n._closeSteps(w);return}if(e._queueTotalSize>0){if(Gr(e,_)){let w=Yr(_);Zr(e),n._chunkSteps(w);return}if(e._closeRequested){let w=new TypeError("Insufficient bytes to fill elements in the given buffer");z(e,w),n._errorSteps(w);return}}e._pendingPullIntos.push(_),rn(o,n),me(e)}function wo(e,t){t.readerType==="none"&&Pe(e);let r=e._controlledReadableByteStream;if(Jt(r))for(;nn(r)>0;){let n=Pe(e);Ht(r,n)}}function Co(e,t,r){if(xr(e,t,r),r.readerType==="none"){Hr(e,r),xt(e);return}if(r.bytesFilled<r.minimumFill)return;Pe(e);let n=r.bytesFilled%r.elementSize;if(n>0){let o=r.byteOffset+r.bytesFilled;Vr(e,r.buffer,o-n,n)}r.bytesFilled-=n,Ht(e._controlledReadableByteStream,r),xt(e)}function Xr(e,t){let r=e._pendingPullIntos.peek();Gt(e),e._controlledReadableByteStream._state==="closed"?wo(e,r):Co(e,t,r),me(e)}function Pe(e){return e._pendingPullIntos.shift()}function To(e){let t=e._controlledReadableByteStream;return t._state!=="readable"||e._closeRequested||!e._started?!1:!!(kr(t)&&Ge(t)>0||Jt(t)&&nn(t)>0||Kr(e)>0)}function Je(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function De(e){let t=e._controlledReadableByteStream;if(!(e._closeRequested||t._state!=="readable")){if(e._queueTotalSize>0){e._closeRequested=!0;return}if(e._pendingPullIntos.length>0){let r=e._pendingPullIntos.peek();if(r.bytesFilled%r.elementSize!==0){let n=new TypeError("Insufficient bytes to fill elements in the given buffer");throw z(e,n),n}}Je(e),Ye(t)}}function Ke(e,t){let r=e._controlledReadableByteStream;if(e._closeRequested||r._state!=="readable")return;let{buffer:n,byteOffset:o,byteLength:a}=t;if(re(n))throw new TypeError("chunk's buffer is detached and so cannot be enqueued");let i=H(n);if(e._pendingPullIntos.length>0){let u=e._pendingPullIntos.peek();if(re(u.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");Gt(e),u.buffer=H(u.buffer),u.readerType==="none"&&Hr(e,u)}if(kr(r))if(go(e),Ge(r)===0)Xe(e,i,o,a);else{e._pendingPullIntos.length>0&&Pe(e);let u=new Uint8Array(i,o,a);Mt(r,u,!1)}else Jt(r)?(Xe(e,i,o,a),xt(e)):Xe(e,i,o,a);me(e)}function z(e,t){let r=e._controlledReadableByteStream;r._state==="readable"&&(Ur(e),ne(e),Je(e),qn(r,t))}function Jr(e,t){let r=e._queue.shift();e._queueTotalSize-=r.byteLength,Zr(e);let n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);t._chunkSteps(n)}function Zt(e){if(e._byobRequest===null&&e._pendingPullIntos.length>0){let t=e._pendingPullIntos.peek(),r=new Uint8Array(t.buffer,t.byteOffset+t.bytesFilled,t.byteLength-t.bytesFilled),n=Object.create(he.prototype);vo(n,e,r),e._byobRequest=n}return e._byobRequest}function Kr(e){let t=e._controlledReadableByteStream._state;return t==="errored"?null:t==="closed"?0:e._strategyHWM-e._queueTotalSize}function et(e,t){let r=e._pendingPullIntos.peek();if(e._controlledReadableByteStream._state==="closed"){if(t!==0)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(t===0)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(r.bytesFilled+t>r.byteLength)throw new RangeError("bytesWritten out of range")}r.buffer=H(r.buffer),Xr(e,t)}function tt(e,t){let r=e._pendingPullIntos.peek();if(e._controlledReadableByteStream._state==="closed"){if(t.byteLength!==0)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(t.byteLength===0)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(r.byteOffset+r.bytesFilled!==t.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(r.bufferByteLength!==t.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(r.bytesFilled+t.byteLength>r.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");let o=t.byteLength;r.buffer=H(t.buffer),Xr(e,o)}function en(e,t,r,n,o,a,i){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,t._byobRequest=null,t._queue=t._queueTotalSize=void 0,ne(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=a,t._pullAlgorithm=n,t._cancelAlgorithm=o,t._autoAllocateChunkSize=i,t._pendingPullIntos=new O,e._readableStreamController=t;let u=r();v(S(u),()=>(t._started=!0,me(t),null),p=>(z(t,p),null))}function Po(e,t,r){let n=Object.create(G.prototype),o,a,i;t.start!==void 0?o=()=>t.start(n):o=()=>{},t.pull!==void 0?a=()=>t.pull(n):a=()=>S(void 0),t.cancel!==void 0?i=p=>t.cancel(p):i=()=>S(void 0);let u=t.autoAllocateChunkSize;if(u===0)throw new TypeError("autoAllocateChunkSize must be greater than 0");en(e,n,o,a,i,r,u)}function vo(e,t,r){e._associatedReadableByteStreamController=t,e._view=r}function Xt(e){return new TypeError(`ReadableStreamBYOBRequest.prototype.${e} can only be used on a ReadableStreamBYOBRequest`)}function Me(e){return new TypeError(`ReadableByteStreamController.prototype.${e} can only be used on a ReadableByteStreamController`)}function Eo(e,t){$(e,t);let r=e?.mode;return{mode:r===void 0?void 0:qo(r,`${t} has member 'mode' that`)}}function qo(e,t){if(e=`${e}`,e!=="byob")throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamReaderMode`);return e}function Ao(e,t){var r;$(e,t);let n=(r=e?.min)!==null&&r!==void 0?r:1;return{min:jt(n,`${t} has member 'min' that`)}}function tn(e){return new oe(e)}function rn(e,t){e._reader._readIntoRequests.push(t)}function Wo(e,t,r){let o=e._reader._readIntoRequests.shift();r?o._closeSteps(t):o._chunkSteps(t)}function nn(e){return e._reader._readIntoRequests.length}function Jt(e){let t=e._reader;return!(t===void 0||!pe(t))}class oe{constructor(t){if(V(t,1,"ReadableStreamBYOBReader"),Dt(t,"First parameter"),se(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!be(t._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");Pr(this,t),this._readIntoRequests=new O}get closed(){return pe(this)?this._closedPromise:c(rt("closed"))}cancel(t=void 0){return pe(this)?this._ownerReadableStream===void 0?c(He("cancel")):kt(this,t):c(rt("cancel"))}read(t,r={}){if(!pe(this))return c(rt("read"));if(!ArrayBuffer.isView(t))return c(new TypeError("view must be an array buffer view"));if(t.byteLength===0)return c(new TypeError("view must have non-zero byteLength"));if(t.buffer.byteLength===0)return c(new TypeError("view's buffer must have non-zero byteLength"));if(re(t.buffer))return c(new TypeError("view's buffer has been detached"));let n;try{n=Ao(r,"options")}catch(h){return c(h)}let o=n.min;if(o===0)return c(new TypeError("options.min must be greater than 0"));if(_o(t)){if(o>t.byteLength)return c(new RangeError("options.min must be less than or equal to view's byteLength"))}else if(o>t.length)return c(new RangeError("options.min must be less than or equal to view's length"));if(this._ownerReadableStream===void 0)return c(He("read from"));let a,i,u=P((h,y)=>{a=h,i=y});return on(this,t,o,{_chunkSteps:h=>a({value:h,done:!1}),_closeSteps:h=>a({value:h,done:!0}),_errorSteps:h=>i(h)}),u}releaseLock(){if(!pe(this))throw rt("releaseLock");this._ownerReadableStream!==void 0&&Bo(this)}}Object.defineProperties(oe.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),d(oe.prototype.cancel,"cancel"),d(oe.prototype.read,"read"),d(oe.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(oe.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});function pe(e){return!l(e)||!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")?!1:e instanceof oe}function on(e,t,r,n){let o=e._ownerReadableStream;o._disturbed=!0,o._state==="errored"?n._errorSteps(o._storedError):Ro(o._readableStreamController,t,r,n)}function Bo(e){Y(e);let t=new TypeError("Reader was released");an(e,t)}function an(e,t){let r=e._readIntoRequests;e._readIntoRequests=new O,r.forEach(n=>{n._errorSteps(t)})}function rt(e){return new TypeError(`ReadableStreamBYOBReader.prototype.${e} can only be used on a ReadableStreamBYOBReader`)}function Le(e,t){let{highWaterMark:r}=e;if(r===void 0)return t;if(Dr(r)||r<0)throw new RangeError("Invalid highWaterMark");return r}function nt(e){let{size:t}=e;return t||(()=>1)}function ot(e,t){$(e,t);let r=e?.highWaterMark,n=e?.size;return{highWaterMark:r===void 0?void 0:It(r),size:n===void 0?void 0:ko(n,`${t} has member 'size' that`)}}function ko(e,t){return F(e,t),r=>It(e(r))}function Oo(e,t){$(e,t);let r=e?.abort,n=e?.close,o=e?.start,a=e?.type,i=e?.write;return{abort:r===void 0?void 0:Fo(r,e,`${t} has member 'abort' that`),close:n===void 0?void 0:zo(n,e,`${t} has member 'close' that`),start:o===void 0?void 0:Io(o,e,`${t} has member 'start' that`),write:i===void 0?void 0:jo(i,e,`${t} has member 'write' that`),type:a}}function Fo(e,t,r){return F(e,r),n=>K(e,t,[n])}function zo(e,t,r){return F(e,r),()=>K(e,t,[])}function Io(e,t,r){return F(e,r),n=>ce(e,t,[n])}function jo(e,t,r){return F(e,r),(n,o)=>K(e,t,[n,o])}function sn(e,t){if(!ve(e))throw new TypeError(`${t} is not a WritableStream.`)}function Do(e){if(typeof e!="object"||e===null)return!1;try{return typeof e.aborted=="boolean"}catch{return!1}}let Mo=typeof AbortController=="function";function Lo(){if(Mo)return new AbortController}class ae{constructor(t={},r={}){t===void 0?t=null:Ar(t,"First parameter");let n=ot(r,"Second parameter"),o=Oo(t,"First parameter");if(un(this),o.type!==void 0)throw new RangeError("Invalid type is specified");let i=nt(n),u=Le(n,1);ea(this,o,u,i)}get locked(){if(!ve(this))throw ut("locked");return Ee(this)}abort(t=void 0){return ve(this)?Ee(this)?c(new TypeError("Cannot abort a stream that already has a writer")):at(this,t):c(ut("abort"))}close(){return ve(this)?Ee(this)?c(new TypeError("Cannot close a stream that already has a writer")):N(this)?c(new TypeError("Cannot close an already-closing stream")):fn(this):c(ut("close"))}getWriter(){if(!ve(this))throw ut("getWriter");return ln(this)}}Object.defineProperties(ae.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),d(ae.prototype.abort,"abort"),d(ae.prototype.close,"close"),d(ae.prototype.getWriter,"getWriter"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(ae.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});function ln(e){return new x(e)}function $o(e,t,r,n,o=1,a=()=>1){let i=Object.create(ae.prototype);un(i);let u=Object.create(qe.prototype);return pn(i,u,e,t,r,n,o,a),i}function un(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new O,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function ve(e){return!l(e)||!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")?!1:e instanceof ae}function Ee(e){return e._writer!==void 0}function at(e,t){var r;if(e._state==="closed"||e._state==="errored")return S(void 0);e._writableStreamController._abortReason=t,(r=e._writableStreamController._abortController)===null||r===void 0||r.abort(t);let n=e._state;if(n==="closed"||n==="errored")return S(void 0);if(e._pendingAbortRequest!==void 0)return e._pendingAbortRequest._promise;let o=!1;n==="erroring"&&(o=!0,t=void 0);let a=P((i,u)=>{e._pendingAbortRequest={_promise:void 0,_resolve:i,_reject:u,_reason:t,_wasAlreadyErroring:o}});return e._pendingAbortRequest._promise=a,o||er(e,t),a}function fn(e){let t=e._state;if(t==="closed"||t==="errored")return c(new TypeError(`The stream (in ${t} state) is not in the writable state and cannot be closed`));let r=P((o,a)=>{let i={_resolve:o,_reject:a};e._closeRequest=i}),n=e._writer;return n!==void 0&&e._backpressure&&t==="writable"&&lr(n),ta(e._writableStreamController),r}function No(e){return P((r,n)=>{let o={_resolve:r,_reject:n};e._writeRequests.push(o)})}function Kt(e,t){if(e._state==="writable"){er(e,t);return}tr(e)}function er(e,t){let r=e._writableStreamController;e._state="erroring",e._storedError=t;let n=e._writer;n!==void 0&&cn(n,t),!Ho(e)&&r._started&&tr(e)}function tr(e){e._state="errored",e._writableStreamController[Tr]();let t=e._storedError;if(e._writeRequests.forEach(o=>{o._reject(t)}),e._writeRequests=new O,e._pendingAbortRequest===void 0){it(e);return}let r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,r._wasAlreadyErroring){r._reject(t),it(e);return}let n=e._writableStreamController[Cr](r._reason);v(n,()=>(r._resolve(),it(e),null),o=>(r._reject(o),it(e),null))}function Qo(e){e._inFlightWriteRequest._resolve(void 0),e._inFlightWriteRequest=void 0}function Uo(e,t){e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,Kt(e,t)}function Yo(e){e._inFlightCloseRequest._resolve(void 0),e._inFlightCloseRequest=void 0,e._state==="erroring"&&(e._storedError=void 0,e._pendingAbortRequest!==void 0&&(e._pendingAbortRequest._resolve(),e._pendingAbortRequest=void 0)),e._state="closed";let r=e._writer;r!==void 0&&gn(r)}function Vo(e,t){e._inFlightCloseRequest._reject(t),e._inFlightCloseRequest=void 0,e._pendingAbortRequest!==void 0&&(e._pendingAbortRequest._reject(t),e._pendingAbortRequest=void 0),Kt(e,t)}function N(e){return!(e._closeRequest===void 0&&e._inFlightCloseRequest===void 0)}function Ho(e){return!(e._inFlightWriteRequest===void 0&&e._inFlightCloseRequest===void 0)}function Go(e){e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0}function xo(e){e._inFlightWriteRequest=e._writeRequests.shift()}function it(e){e._closeRequest!==void 0&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);let t=e._writer;t!==void 0&&ir(t,e._storedError)}function rr(e,t){let r=e._writer;r!==void 0&&t!==e._backpressure&&(t?la(r):lr(r)),e._backpressure=t}class x{constructor(t){if(V(t,1,"WritableStreamDefaultWriter"),sn(t,"First parameter"),Ee(t))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=t,t._writer=this;let r=t._state;if(r==="writable")!N(t)&&t._backpressure?dt(this):Rn(this),ft(this);else if(r==="erroring")sr(this,t._storedError),ft(this);else if(r==="closed")Rn(this),ia(this);else{let n=t._storedError;sr(this,n),Sn(this,n)}}get closed(){return ye(this)?this._closedPromise:c(_e("closed"))}get desiredSize(){if(!ye(this))throw _e("desiredSize");if(this._ownerWritableStream===void 0)throw Ne("desiredSize");return Ko(this)}get ready(){return ye(this)?this._readyPromise:c(_e("ready"))}abort(t=void 0){return ye(this)?this._ownerWritableStream===void 0?c(Ne("abort")):Zo(this,t):c(_e("abort"))}close(){if(!ye(this))return c(_e("close"));let t=this._ownerWritableStream;return t===void 0?c(Ne("close")):N(t)?c(new TypeError("Cannot close an already-closing stream")):dn(this)}releaseLock(){if(!ye(this))throw _e("releaseLock");this._ownerWritableStream!==void 0&&hn(this)}write(t=void 0){return ye(this)?this._ownerWritableStream===void 0?c(Ne("write to")):bn(this,t):c(_e("write"))}}Object.defineProperties(x.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),d(x.prototype.abort,"abort"),d(x.prototype.close,"close"),d(x.prototype.releaseLock,"releaseLock"),d(x.prototype.write,"write"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(x.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});function ye(e){return!l(e)||!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")?!1:e instanceof x}function Zo(e,t){let r=e._ownerWritableStream;return at(r,t)}function dn(e){let t=e._ownerWritableStream;return fn(t)}function Xo(e){let t=e._ownerWritableStream,r=t._state;return N(t)||r==="closed"?S(void 0):r==="errored"?c(t._storedError):dn(e)}function Jo(e,t){e._closedPromiseState==="pending"?ir(e,t):sa(e,t)}function cn(e,t){e._readyPromiseState==="pending"?wn(e,t):ua(e,t)}function Ko(e){let t=e._ownerWritableStream,r=t._state;return r==="errored"||r==="erroring"?null:r==="closed"?0:yn(t._writableStreamController)}function hn(e){let t=e._ownerWritableStream,r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");cn(e,r),Jo(e,r),t._writer=void 0,e._ownerWritableStream=void 0}function bn(e,t){let r=e._ownerWritableStream,n=r._writableStreamController,o=ra(n,t);if(r!==e._ownerWritableStream)return c(Ne("write to"));let a=r._state;if(a==="errored")return c(r._storedError);if(N(r)||a==="closed")return c(new TypeError("The stream is closing or closed and cannot be written to"));if(a==="erroring")return c(r._storedError);let i=No(r);return na(n,t,o),i}let mn={};class qe{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!nr(this))throw ar("abortReason");return this._abortReason}get signal(){if(!nr(this))throw ar("signal");if(this._abortController===void 0)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(t=void 0){if(!nr(this))throw ar("error");this._controlledWritableStream._state==="writable"&&_n(this,t)}[Cr](t){let r=this._abortAlgorithm(t);return st(this),r}[Tr](){ne(this)}}Object.defineProperties(qe.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(qe.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});function nr(e){return!l(e)||!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream")?!1:e instanceof qe}function pn(e,t,r,n,o,a,i,u){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,ne(t),t._abortReason=void 0,t._abortController=Lo(),t._started=!1,t._strategySizeAlgorithm=u,t._strategyHWM=i,t._writeAlgorithm=n,t._closeAlgorithm=o,t._abortAlgorithm=a;let p=or(t);rr(e,p);let h=r(),y=S(h);v(y,()=>(t._started=!0,lt(t),null),_=>(t._started=!0,Kt(e,_),null))}function ea(e,t,r,n){let o=Object.create(qe.prototype),a,i,u,p;t.start!==void 0?a=()=>t.start(o):a=()=>{},t.write!==void 0?i=h=>t.write(h,o):i=()=>S(void 0),t.close!==void 0?u=()=>t.close():u=()=>S(void 0),t.abort!==void 0?p=h=>t.abort(h):p=()=>S(void 0),pn(e,o,a,i,u,p,r,n)}function st(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function ta(e){Yt(e,mn,0),lt(e)}function ra(e,t){try{return e._strategySizeAlgorithm(t)}catch(r){return $e(e,r),1}}function yn(e){return e._strategyHWM-e._queueTotalSize}function na(e,t,r){try{Yt(e,t,r)}catch(o){$e(e,o);return}let n=e._controlledWritableStream;if(!N(n)&&n._state==="writable"){let o=or(e);rr(n,o)}lt(e)}function lt(e){let t=e._controlledWritableStream;if(!e._started||t._inFlightWriteRequest!==void 0)return;if(t._state==="erroring"){tr(t);return}if(e._queue.length===0)return;let n=yo(e);n===mn?oa(e):aa(e,n)}function $e(e,t){e._controlledWritableStream._state==="writable"&&_n(e,t)}function oa(e){let t=e._controlledWritableStream;Go(t),Ut(e);let r=e._closeAlgorithm();st(e),v(r,()=>(Yo(t),null),n=>(Vo(t,n),null))}function aa(e,t){let r=e._controlledWritableStream;xo(r);let n=e._writeAlgorithm(t);v(n,()=>{Qo(r);let o=r._state;if(Ut(e),!N(r)&&o==="writable"){let a=or(e);rr(r,a)}return lt(e),null},o=>(r._state==="writable"&&st(e),Uo(r,o),null))}function or(e){return yn(e)<=0}function _n(e,t){let r=e._controlledWritableStream;st(e),er(r,t)}function ut(e){return new TypeError(`WritableStream.prototype.${e} can only be used on a WritableStream`)}function ar(e){return new TypeError(`WritableStreamDefaultController.prototype.${e} can only be used on a WritableStreamDefaultController`)}function _e(e){return new TypeError(`WritableStreamDefaultWriter.prototype.${e} can only be used on a WritableStreamDefaultWriter`)}function Ne(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function ft(e){e._closedPromise=P((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r,e._closedPromiseState="pending"})}function Sn(e,t){ft(e),ir(e,t)}function ia(e){ft(e),gn(e)}function ir(e,t){e._closedPromise_reject!==void 0&&(Ce(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected")}function sa(e,t){Sn(e,t)}function gn(e){e._closedPromise_resolve!==void 0&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved")}function dt(e){e._readyPromise=P((t,r)=>{e._readyPromise_resolve=t,e._readyPromise_reject=r}),e._readyPromiseState="pending"}function sr(e,t){dt(e),wn(e,t)}function Rn(e){dt(e),lr(e)}function wn(e,t){e._readyPromise_reject!==void 0&&(Ce(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected")}function la(e){dt(e)}function ua(e,t){sr(e,t)}function lr(e){e._readyPromise_resolve!==void 0&&(e._readyPromise_resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled")}function fa(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof globalThis<"u")return globalThis}let ur=fa();function da(e){if(!(typeof e=="function"||typeof e=="object")||e.name!=="DOMException")return!1;try{return new e,!0}catch{return!1}}function ca(){let e=ur?.DOMException;return da(e)?e:void 0}function ha(){let e=function(r,n){this.message=r||"",this.name=n||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return d(e,"DOMException"),e.prototype=Object.create(Error.prototype),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,configurable:!0}),e}let ba=ca()||ha();function Cn(e,t,r,n,o,a){let i=Te(e),u=ln(t);e._disturbed=!0;let p=!1,h=S(void 0);return P((y,_)=>{let w;if(a!==void 0){if(w=()=>{let m=a.reason!==void 0?a.reason:new ba("Aborted","AbortError"),g=[];n||g.push(()=>t._state==="writable"?at(t,m):S(void 0)),o||g.push(()=>e._state==="readable"?D(e,m):S(void 0)),A(()=>Promise.all(g.map(T=>T())),!0,m)},a.aborted){w();return}a.addEventListener("abort",w)}function M(){return P((m,g)=>{function T(k){k?m():B(ke(),T,g)}T(!1)})}function ke(){return p?S(!0):B(u._readyPromise,()=>P((m,g)=>{Ie(i,{_chunkSteps:T=>{h=B(bn(u,T),void 0,s),m(!1)},_closeSteps:()=>m(!0),_errorSteps:g})}))}if(X(e,i._closedPromise,m=>(n?I(!0,m):A(()=>at(t,m),!0,m),null)),X(t,u._closedPromise,m=>(o?I(!0,m):A(()=>D(e,m),!0,m),null)),q(e,i._closedPromise,()=>(r?I():A(()=>Xo(u)),null)),N(t)||t._state==="closed"){let m=new TypeError("the destination writable stream closed before all data could be piped to it");o?I(!0,m):A(()=>D(e,m),!0,m)}Ce(M());function ue(){let m=h;return B(h,()=>m!==h?ue():void 0)}function X(m,g,T){m._state==="errored"?T(m._storedError):Q(g,T)}function q(m,g,T){m._state==="closed"?T():L(g,T)}function A(m,g,T){if(p)return;p=!0,t._state==="writable"&&!N(t)?L(ue(),k):k();function k(){return v(m(),()=>J(g,T),Oe=>J(!0,Oe)),null}}function I(m,g){p||(p=!0,t._state==="writable"&&!N(t)?L(ue(),()=>J(m,g)):J(m,g))}function J(m,g){return hn(u),Y(i),a!==void 0&&a.removeEventListener("abort",w),m?_(g):y(void 0),null}})}class Z{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!ct(this))throw bt("desiredSize");return fr(this)}close(){if(!ct(this))throw bt("close");if(!We(this))throw new TypeError("The stream is not in a state that permits close");Se(this)}enqueue(t=void 0){if(!ct(this))throw bt("enqueue");if(!We(this))throw new TypeError("The stream is not in a state that permits enqueue");return Ae(this,t)}error(t=void 0){if(!ct(this))throw bt("error");j(this,t)}[At](t){ne(this);let r=this._cancelAlgorithm(t);return ht(this),r}[Wt](t){let r=this._controlledReadableStream;if(this._queue.length>0){let n=Ut(this);this._closeRequested&&this._queue.length===0?(ht(this),Ye(r)):Qe(this),t._chunkSteps(n)}else Br(r,t),Qe(this)}[Bt](){}}Object.defineProperties(Z.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),d(Z.prototype.close,"close"),d(Z.prototype.enqueue,"enqueue"),d(Z.prototype.error,"error"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Z.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});function ct(e){return!l(e)||!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")?!1:e instanceof Z}function Qe(e){if(!Tn(e))return;if(e._pulling){e._pullAgain=!0;return}e._pulling=!0;let r=e._pullAlgorithm();v(r,()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,Qe(e)),null),n=>(j(e,n),null))}function Tn(e){let t=e._controlledReadableStream;return!We(e)||!e._started?!1:!!(se(t)&&Ge(t)>0||fr(e)>0)}function ht(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function Se(e){if(!We(e))return;let t=e._controlledReadableStream;e._closeRequested=!0,e._queue.length===0&&(ht(e),Ye(t))}function Ae(e,t){if(!We(e))return;let r=e._controlledReadableStream;if(se(r)&&Ge(r)>0)Mt(r,t,!1);else{let n;try{n=e._strategySizeAlgorithm(t)}catch(o){throw j(e,o),o}try{Yt(e,t,n)}catch(o){throw j(e,o),o}}Qe(e)}function j(e,t){let r=e._controlledReadableStream;r._state==="readable"&&(ne(e),ht(e),qn(r,t))}function fr(e){let t=e._controlledReadableStream._state;return t==="errored"?null:t==="closed"?0:e._strategyHWM-e._queueTotalSize}function ma(e){return!Tn(e)}function We(e){let t=e._controlledReadableStream._state;return!e._closeRequested&&t==="readable"}function Pn(e,t,r,n,o,a,i){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,ne(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=i,t._strategyHWM=a,t._pullAlgorithm=n,t._cancelAlgorithm=o,e._readableStreamController=t;let u=r();v(S(u),()=>(t._started=!0,Qe(t),null),p=>(j(t,p),null))}function pa(e,t,r,n){let o=Object.create(Z.prototype),a,i,u;t.start!==void 0?a=()=>t.start(o):a=()=>{},t.pull!==void 0?i=()=>t.pull(o):i=()=>S(void 0),t.cancel!==void 0?u=p=>t.cancel(p):u=()=>S(void 0),Pn(e,o,a,i,u,r,n)}function bt(e){return new TypeError(`ReadableStreamDefaultController.prototype.${e} can only be used on a ReadableStreamDefaultController`)}function ya(e,t){return be(e._readableStreamController)?Sa(e):_a(e)}function _a(e,t){let r=Te(e),n=!1,o=!1,a=!1,i=!1,u,p,h,y,_,w=P(q=>{_=q});function M(){return n?(o=!0,S(void 0)):(n=!0,Ie(r,{_chunkSteps:A=>{de(()=>{o=!1;let I=A,J=A;a||Ae(h._readableStreamController,I),i||Ae(y._readableStreamController,J),n=!1,o&&M()})},_closeSteps:()=>{n=!1,a||Se(h._readableStreamController),i||Se(y._readableStreamController),(!a||!i)&&_(void 0)},_errorSteps:()=>{n=!1}}),S(void 0))}function ke(q){if(a=!0,u=q,i){let A=je([u,p]),I=D(e,A);_(I)}return w}function ue(q){if(i=!0,p=q,a){let A=je([u,p]),I=D(e,A);_(I)}return w}function X(){}return h=Ue(X,M,ke),y=Ue(X,M,ue),Q(r._closedPromise,q=>(j(h._readableStreamController,q),j(y._readableStreamController,q),(!a||!i)&&_(void 0),null)),[h,y]}function Sa(e){let t=Te(e),r=!1,n=!1,o=!1,a=!1,i=!1,u,p,h,y,_,w=P(m=>{_=m});function M(m){Q(m._closedPromise,g=>(m!==t||(z(h._readableStreamController,g),z(y._readableStreamController,g),(!a||!i)&&_(void 0)),null))}function ke(){pe(t)&&(Y(t),t=Te(e),M(t)),Ie(t,{_chunkSteps:g=>{de(()=>{n=!1,o=!1;let T=g,k=g;if(!a&&!i)try{k=Nr(g)}catch(Oe){z(h._readableStreamController,Oe),z(y._readableStreamController,Oe),_(D(e,Oe));return}a||Ke(h._readableStreamController,T),i||Ke(y._readableStreamController,k),r=!1,n?X():o&&q()})},_closeSteps:()=>{r=!1,a||De(h._readableStreamController),i||De(y._readableStreamController),h._readableStreamController._pendingPullIntos.length>0&&et(h._readableStreamController,0),y._readableStreamController._pendingPullIntos.length>0&&et(y._readableStreamController,0),(!a||!i)&&_(void 0)},_errorSteps:()=>{r=!1}})}function ue(m,g){te(t)&&(Y(t),t=tn(e),M(t));let T=g?y:h,k=g?h:y;on(t,m,1,{_chunkSteps:Fe=>{de(()=>{n=!1,o=!1;let ze=g?i:a;if(g?a:i)ze||tt(T._readableStreamController,Fe);else{let $n;try{$n=Nr(Fe)}catch(mr){z(T._readableStreamController,mr),z(k._readableStreamController,mr),_(D(e,mr));return}ze||tt(T._readableStreamController,Fe),Ke(k._readableStreamController,$n)}r=!1,n?X():o&&q()})},_closeSteps:Fe=>{r=!1;let ze=g?i:a,wt=g?a:i;ze||De(T._readableStreamController),wt||De(k._readableStreamController),Fe!==void 0&&(ze||tt(T._readableStreamController,Fe),!wt&&k._readableStreamController._pendingPullIntos.length>0&&et(k._readableStreamController,0)),(!ze||!wt)&&_(void 0)},_errorSteps:()=>{r=!1}})}function X(){if(r)return n=!0,S(void 0);r=!0;let m=Zt(h._readableStreamController);return m===null?ke():ue(m._view,!1),S(void 0)}function q(){if(r)return o=!0,S(void 0);r=!0;let m=Zt(y._readableStreamController);return m===null?ke():ue(m._view,!0),S(void 0)}function A(m){if(a=!0,u=m,i){let g=je([u,p]),T=D(e,g);_(T)}return w}function I(m){if(i=!0,p=m,a){let g=je([u,p]),T=D(e,g);_(T)}return w}function J(){}return h=En(J,X,A),y=En(J,q,I),M(t),[h,y]}function ga(e){return l(e)&&typeof e.getReader<"u"}function Ra(e){return ga(e)?Ca(e.getReader()):wa(e)}function wa(e){let t,r=$r(e,"async"),n=s;function o(){let i;try{i=ho(r)}catch(p){return c(p)}let u=S(i);return U(u,p=>{if(!l(p))throw new TypeError("The promise returned by the iterator.next() method must fulfill with an object");if(bo(p))Se(t._readableStreamController);else{let y=mo(p);Ae(t._readableStreamController,y)}})}function a(i){let u=r.iterator,p;try{p=Ze(u,"return")}catch(_){return c(_)}if(p===void 0)return S(void 0);let h;try{h=ce(p,u,[i])}catch(_){return c(_)}let y=S(h);return U(y,_=>{if(!l(_))throw new TypeError("The promise returned by the iterator.return() method must fulfill with an object")})}return t=Ue(n,o,a,0),t}function Ca(e){let t,r=s;function n(){let a;try{a=e.read()}catch(i){return c(i)}return U(a,i=>{if(!l(i))throw new TypeError("The promise returned by the reader.read() method must fulfill with an object");if(i.done)Se(t._readableStreamController);else{let u=i.value;Ae(t._readableStreamController,u)}})}function o(a){try{return S(e.cancel(a))}catch(i){return c(i)}}return t=Ue(r,n,o,0),t}function Ta(e,t){$(e,t);let r=e,n=r?.autoAllocateChunkSize,o=r?.cancel,a=r?.pull,i=r?.start,u=r?.type;return{autoAllocateChunkSize:n===void 0?void 0:jt(n,`${t} has member 'autoAllocateChunkSize' that`),cancel:o===void 0?void 0:Pa(o,r,`${t} has member 'cancel' that`),pull:a===void 0?void 0:va(a,r,`${t} has member 'pull' that`),start:i===void 0?void 0:Ea(i,r,`${t} has member 'start' that`),type:u===void 0?void 0:qa(u,`${t} has member 'type' that`)}}function Pa(e,t,r){return F(e,r),n=>K(e,t,[n])}function va(e,t,r){return F(e,r),n=>K(e,t,[n])}function Ea(e,t,r){return F(e,r),n=>ce(e,t,[n])}function qa(e,t){if(e=`${e}`,e!=="bytes")throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamType`);return e}function Aa(e,t){return $(e,t),{preventCancel:!!e?.preventCancel}}function vn(e,t){$(e,t);let r=e?.preventAbort,n=e?.preventCancel,o=e?.preventClose,a=e?.signal;return a!==void 0&&Wa(a,`${t} has member 'signal' that`),{preventAbort:!!r,preventCancel:!!n,preventClose:!!o,signal:a}}function Wa(e,t){if(!Do(e))throw new TypeError(`${t} is not an AbortSignal.`)}function Ba(e,t){$(e,t);let r=e?.readable;zt(r,"readable","ReadableWritablePair"),Dt(r,`${t} has member 'readable' that`);let n=e?.writable;return zt(n,"writable","ReadableWritablePair"),sn(n,`${t} has member 'writable' that`),{readable:r,writable:n}}class E{constructor(t={},r={}){t===void 0?t=null:Ar(t,"First parameter");let n=ot(r,"Second parameter"),o=Ta(t,"First parameter");if(dr(this),o.type==="bytes"){if(n.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");let a=Le(n,0);Po(this,o,a)}else{let a=nt(n),i=Le(n,1);pa(this,o,i,a)}}get locked(){if(!ie(this))throw ge("locked");return se(this)}cancel(t=void 0){return ie(this)?se(this)?c(new TypeError("Cannot cancel a stream that already has a reader")):D(this,t):c(ge("cancel"))}getReader(t=void 0){if(!ie(this))throw ge("getReader");return Eo(t,"First parameter").mode===void 0?Te(this):tn(this)}pipeThrough(t,r={}){if(!ie(this))throw ge("pipeThrough");V(t,1,"pipeThrough");let n=Ba(t,"First parameter"),o=vn(r,"Second parameter");if(se(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(Ee(n.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");let a=Cn(this,n.writable,o.preventClose,o.preventAbort,o.preventCancel,o.signal);return Ce(a),n.readable}pipeTo(t,r={}){if(!ie(this))return c(ge("pipeTo"));if(t===void 0)return c("Parameter 1 is required in 'pipeTo'.");if(!ve(t))return c(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let n;try{n=vn(r,"Second parameter")}catch(o){return c(o)}return se(this)?c(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):Ee(t)?c(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):Cn(this,t,n.preventClose,n.preventAbort,n.preventCancel,n.signal)}tee(){if(!ie(this))throw ge("tee");let t=ya(this);return je(t)}values(t=void 0){if(!ie(this))throw ge("values");let r=Aa(t,"First parameter");return fo(this,r.preventCancel)}[Qt](t){return this.values(t)}static from(t){return Ra(t)}}Object.defineProperties(E,{from:{enumerable:!0}}),Object.defineProperties(E.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),d(E.from,"from"),d(E.prototype.cancel,"cancel"),d(E.prototype.getReader,"getReader"),d(E.prototype.pipeThrough,"pipeThrough"),d(E.prototype.pipeTo,"pipeTo"),d(E.prototype.tee,"tee"),d(E.prototype.values,"values"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(E.prototype,Symbol.toStringTag,{value:"ReadableStream",configurable:!0}),Object.defineProperty(E.prototype,Qt,{value:E.prototype.values,writable:!0,configurable:!0});function Ue(e,t,r,n=1,o=()=>1){let a=Object.create(E.prototype);dr(a);let i=Object.create(Z.prototype);return Pn(a,i,e,t,r,n,o),a}function En(e,t,r){let n=Object.create(E.prototype);dr(n);let o=Object.create(G.prototype);return en(n,o,e,t,r,0,void 0),n}function dr(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function ie(e){return!l(e)||!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")?!1:e instanceof E}function se(e){return e._reader!==void 0}function D(e,t){if(e._disturbed=!0,e._state==="closed")return S(void 0);if(e._state==="errored")return c(e._storedError);Ye(e);let r=e._reader;if(r!==void 0&&pe(r)){let o=r._readIntoRequests;r._readIntoRequests=new O,o.forEach(a=>{a._closeSteps(void 0)})}let n=e._readableStreamController[At](t);return U(n,s)}function Ye(e){e._state="closed";let t=e._reader;if(t!==void 0&&(Er(t),te(t))){let r=t._readRequests;t._readRequests=new O,r.forEach(n=>{n._closeSteps()})}}function qn(e,t){e._state="errored",e._storedError=t;let r=e._reader;r!==void 0&&(Ft(r,t),te(r)?Or(r,t):an(r,t))}function ge(e){return new TypeError(`ReadableStream.prototype.${e} can only be used on a ReadableStream`)}function An(e,t){$(e,t);let r=e?.highWaterMark;return zt(r,"highWaterMark","QueuingStrategyInit"),{highWaterMark:It(r)}}let Wn=e=>e.byteLength;d(Wn,"size");class mt{constructor(t){V(t,1,"ByteLengthQueuingStrategy"),t=An(t,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=t.highWaterMark}get highWaterMark(){if(!kn(this))throw Bn("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!kn(this))throw Bn("size");return Wn}}Object.defineProperties(mt.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(mt.prototype,Symbol.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});function Bn(e){return new TypeError(`ByteLengthQueuingStrategy.prototype.${e} can only be used on a ByteLengthQueuingStrategy`)}function kn(e){return!l(e)||!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")?!1:e instanceof mt}let On=()=>1;d(On,"size");class pt{constructor(t){V(t,1,"CountQueuingStrategy"),t=An(t,"First parameter"),this._countQueuingStrategyHighWaterMark=t.highWaterMark}get highWaterMark(){if(!zn(this))throw Fn("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!zn(this))throw Fn("size");return On}}Object.defineProperties(pt.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(pt.prototype,Symbol.toStringTag,{value:"CountQueuingStrategy",configurable:!0});function Fn(e){return new TypeError(`CountQueuingStrategy.prototype.${e} can only be used on a CountQueuingStrategy`)}function zn(e){return!l(e)||!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")?!1:e instanceof pt}function ka(e,t){$(e,t);let r=e?.cancel,n=e?.flush,o=e?.readableType,a=e?.start,i=e?.transform,u=e?.writableType;return{cancel:r===void 0?void 0:Ia(r,e,`${t} has member 'cancel' that`),flush:n===void 0?void 0:Oa(n,e,`${t} has member 'flush' that`),readableType:o,start:a===void 0?void 0:Fa(a,e,`${t} has member 'start' that`),transform:i===void 0?void 0:za(i,e,`${t} has member 'transform' that`),writableType:u}}function Oa(e,t,r){return F(e,r),n=>K(e,t,[n])}function Fa(e,t,r){return F(e,r),n=>ce(e,t,[n])}function za(e,t,r){return F(e,r),(n,o)=>K(e,t,[n,o])}function Ia(e,t,r){return F(e,r),n=>K(e,t,[n])}class yt{constructor(t={},r={},n={}){t===void 0&&(t=null);let o=ot(r,"Second parameter"),a=ot(n,"Third parameter"),i=ka(t,"First parameter");if(i.readableType!==void 0)throw new RangeError("Invalid readableType specified");if(i.writableType!==void 0)throw new RangeError("Invalid writableType specified");let u=Le(a,0),p=nt(a),h=Le(o,1),y=nt(o),_,w=P(M=>{_=M});ja(this,w,h,y,u,p),Ma(this,i),i.start!==void 0?_(i.start(this._transformStreamController)):_(void 0)}get readable(){if(!In(this))throw Ln("readable");return this._readable}get writable(){if(!In(this))throw Ln("writable");return this._writable}}Object.defineProperties(yt.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(yt.prototype,Symbol.toStringTag,{value:"TransformStream",configurable:!0});function ja(e,t,r,n,o,a){function i(){return t}function u(w){return Na(e,w)}function p(w){return Qa(e,w)}function h(){return Ua(e)}e._writable=$o(i,u,h,p,r,n);function y(){return Ya(e)}function _(w){return Va(e,w)}e._readable=Ue(i,y,_,o,a),e._backpressure=void 0,e._backpressureChangePromise=void 0,e._backpressureChangePromise_resolve=void 0,_t(e,!0),e._transformStreamController=void 0}function In(e){return!l(e)||!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")?!1:e instanceof yt}function jn(e,t){j(e._readable._readableStreamController,t),cr(e,t)}function cr(e,t){gt(e._transformStreamController),$e(e._writable._writableStreamController,t),hr(e)}function hr(e){e._backpressure&&_t(e,!1)}function _t(e,t){e._backpressureChangePromise!==void 0&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=P(r=>{e._backpressureChangePromise_resolve=r}),e._backpressure=t}class le{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!St(this))throw Rt("desiredSize");let t=this._controlledTransformStream._readable._readableStreamController;return fr(t)}enqueue(t=void 0){if(!St(this))throw Rt("enqueue");Dn(this,t)}error(t=void 0){if(!St(this))throw Rt("error");La(this,t)}terminate(){if(!St(this))throw Rt("terminate");$a(this)}}Object.defineProperties(le.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),d(le.prototype.enqueue,"enqueue"),d(le.prototype.error,"error"),d(le.prototype.terminate,"terminate"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(le.prototype,Symbol.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});function St(e){return!l(e)||!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")?!1:e instanceof le}function Da(e,t,r,n,o){t._controlledTransformStream=e,e._transformStreamController=t,t._transformAlgorithm=r,t._flushAlgorithm=n,t._cancelAlgorithm=o,t._finishPromise=void 0,t._finishPromise_resolve=void 0,t._finishPromise_reject=void 0}function Ma(e,t){let r=Object.create(le.prototype),n,o,a;t.transform!==void 0?n=i=>t.transform(i,r):n=i=>{try{return Dn(r,i),S(void 0)}catch(u){return c(u)}},t.flush!==void 0?o=()=>t.flush(r):o=()=>S(void 0),t.cancel!==void 0?a=i=>t.cancel(i):a=()=>S(void 0),Da(e,r,n,o,a)}function gt(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0,e._cancelAlgorithm=void 0}function Dn(e,t){let r=e._controlledTransformStream,n=r._readable._readableStreamController;if(!We(n))throw new TypeError("Readable side is not in a state that permits enqueue");try{Ae(n,t)}catch(a){throw cr(r,a),r._readable._storedError}ma(n)!==r._backpressure&&_t(r,!0)}function La(e,t){jn(e._controlledTransformStream,t)}function Mn(e,t){let r=e._transformAlgorithm(t);return U(r,void 0,n=>{throw jn(e._controlledTransformStream,n),n})}function $a(e){let t=e._controlledTransformStream,r=t._readable._readableStreamController;Se(r);let n=new TypeError("TransformStream terminated");cr(t,n)}function Na(e,t){let r=e._transformStreamController;if(e._backpressure){let n=e._backpressureChangePromise;return U(n,()=>{let o=e._writable;if(o._state==="erroring")throw o._storedError;return Mn(r,t)})}return Mn(r,t)}function Qa(e,t){let r=e._transformStreamController;if(r._finishPromise!==void 0)return r._finishPromise;let n=e._readable;r._finishPromise=P((a,i)=>{r._finishPromise_resolve=a,r._finishPromise_reject=i});let o=r._cancelAlgorithm(t);return gt(r),v(o,()=>(n._state==="errored"?Be(r,n._storedError):(j(n._readableStreamController,t),br(r)),null),a=>(j(n._readableStreamController,a),Be(r,a),null)),r._finishPromise}function Ua(e){let t=e._transformStreamController;if(t._finishPromise!==void 0)return t._finishPromise;let r=e._readable;t._finishPromise=P((o,a)=>{t._finishPromise_resolve=o,t._finishPromise_reject=a});let n=t._flushAlgorithm();return gt(t),v(n,()=>(r._state==="errored"?Be(t,r._storedError):(Se(r._readableStreamController),br(t)),null),o=>(j(r._readableStreamController,o),Be(t,o),null)),t._finishPromise}function Ya(e){return _t(e,!1),e._backpressureChangePromise}function Va(e,t){let r=e._transformStreamController;if(r._finishPromise!==void 0)return r._finishPromise;let n=e._writable;r._finishPromise=P((a,i)=>{r._finishPromise_resolve=a,r._finishPromise_reject=i});let o=r._cancelAlgorithm(t);return gt(r),v(o,()=>(n._state==="errored"?Be(r,n._storedError):($e(n._writableStreamController,t),hr(e),br(r)),null),a=>($e(n._writableStreamController,a),hr(e),Be(r,a),null)),r._finishPromise}function Rt(e){return new TypeError(`TransformStreamDefaultController.prototype.${e} can only be used on a TransformStreamDefaultController`)}function br(e){e._finishPromise_resolve!==void 0&&(e._finishPromise_resolve(),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function Be(e,t){e._finishPromise_reject!==void 0&&(Ce(e._finishPromise),e._finishPromise_reject(t),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function Ln(e){return new TypeError(`TransformStream.prototype.${e} can only be used on a TransformStream`)}f.ByteLengthQueuingStrategy=mt,f.CountQueuingStrategy=pt,f.ReadableByteStreamController=G,f.ReadableStream=E,f.ReadableStreamBYOBReader=oe,f.ReadableStreamBYOBRequest=he,f.ReadableStreamDefaultController=Z,f.ReadableStreamDefaultReader=ee,f.TransformStream=yt,f.TransformStreamDefaultController=le,f.WritableStream=ae,f.WritableStreamDefaultController=qe,f.WritableStreamDefaultWriter=x})});var Yn=pr(()=>{W();if(!globalThis.ReadableStream)try{let f=Ct("node:process"),{emitWarning:s}=f;try{f.emitWarning=()=>{},Object.assign(globalThis,Ct("node:stream/web")),f.emitWarning=s}catch(l){throw f.emitWarning=s,l}}catch{Object.assign(globalThis,Un())}try{let{Blob:f}=Ct("buffer");f&&!f.prototype.stream&&(f.prototype.stream=function(l){let b=0,d=this;return new ReadableStream({type:"bytes",async pull(R){let fe=await d.slice(b,Math.min(d.size,b+65536)).arrayBuffer();b+=fe.byteLength,R.enqueue(new Uint8Array(fe)),b===d.size&&R.close()}})})}catch{}});async function*yr(f,s=!0){for(let l of f)if("stream"in l)yield*l.stream();else if(ArrayBuffer.isView(l))if(s){let b=l.byteOffset,d=l.byteOffset+l.byteLength;for(;b!==d;){let R=Math.min(d-b,Vn),C=l.buffer.slice(b,b+R);b+=C.byteLength,yield new Uint8Array(C)}}else yield l;else{let b=0,d=l;for(;b!==d.size;){let C=await d.slice(b,Math.min(d.size,b+Vn)).arrayBuffer();b+=C.byteLength,yield new Uint8Array(C)}}}var li,Vn,Hn,Ha,Re,vt=Tt(()=>{W();li=Nn(Yn(),1);Vn=65536;Hn=class _r{#e=[];#t="";#r=0;#n="transparent";constructor(s=[],l={}){if(typeof s!="object"||s===null)throw new TypeError("Failed to construct 'Blob': The provided value cannot be converted to a sequence.");if(typeof s[Symbol.iterator]!="function")throw new TypeError("Failed to construct 'Blob': The object must have a callable @@iterator property.");if(typeof l!="object"&&typeof l!="function")throw new TypeError("Failed to construct 'Blob': parameter 2 cannot convert to dictionary.");l===null&&(l={});let b=new TextEncoder;for(let R of s){let C;ArrayBuffer.isView(R)?C=new Uint8Array(R.buffer.slice(R.byteOffset,R.byteOffset+R.byteLength)):R instanceof ArrayBuffer?C=new Uint8Array(R.slice(0)):R instanceof _r?C=R:C=b.encode(`${R}`),this.#r+=ArrayBuffer.isView(C)?C.byteLength:C.size,this.#e.push(C)}this.#n=`${l.endings===void 0?"transparent":l.endings}`;let d=l.type===void 0?"":String(l.type);this.#t=/^[\x20-\x7E]*$/.test(d)?d:""}get size(){return this.#r}get type(){return this.#t}async text(){let s=new TextDecoder,l="";for await(let b of yr(this.#e,!1))l+=s.decode(b,{stream:!0});return l+=s.decode(),l}async arrayBuffer(){let s=new Uint8Array(this.size),l=0;for await(let b of yr(this.#e,!1))s.set(b,l),l+=b.length;return s.buffer}stream(){let s=yr(this.#e,!0);return new globalThis.ReadableStream({type:"bytes",async pull(l){let b=await s.next();b.done?l.close():l.enqueue(b.value)},async cancel(){await s.return()}})}slice(s=0,l=this.size,b=""){let{size:d}=this,R=s<0?Math.max(d+s,0):Math.min(s,d),C=l<0?Math.max(d+l,0):Math.min(l,d),fe=Math.max(C-R,0),P=this.#e,S=[],c=0;for(let v of P){if(c>=fe)break;let L=ArrayBuffer.isView(v)?v.byteLength:v.size;if(R&&L<=R)R-=L,C-=L;else{let Q;ArrayBuffer.isView(v)?(Q=v.subarray(R,Math.min(L,C)),c+=Q.byteLength):(Q=v.slice(R,Math.min(L,C)),c+=Q.size),C-=L,S.push(Q),R=0}}let B=new _r([],{type:String(b).toLowerCase()});return B.#r=fe,B.#e=S,B}get[Symbol.toStringTag](){return"Blob"}static[Symbol.hasInstance](s){return s&&typeof s=="object"&&typeof s.constructor=="function"&&(typeof s.stream=="function"||typeof s.arrayBuffer=="function")&&/^(Blob|File)$/.test(s[Symbol.toStringTag])}};Object.defineProperties(Hn.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}});Ha=Hn,Re=Ha});var Ga,xa,Et,Sr=Tt(()=>{W();vt();Ga=class extends Re{#e=0;#t="";constructor(s,l,b={}){if(arguments.length<2)throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`);super(s,b),b===null&&(b={});let d=b.lastModified===void 0?Date.now():Number(b.lastModified);Number.isNaN(d)||(this.#e=d),this.#t=String(l)}get name(){return this.#t}get lastModified(){return this.#e}get[Symbol.toStringTag](){return"File"}static[Symbol.hasInstance](s){return!!s&&s instanceof Re&&/^(File)$/.test(s[Symbol.toStringTag])}},xa=Ga,Et=xa});function Si(f,s=Re){var l=`${Gn()}${Gn()}`.replace(/\./g,"").slice(-28).padStart(32,"-"),b=[],d=`--${l}\r
4
+ Content-Disposition: form-data; name="`;return f.forEach((R,C)=>typeof R=="string"?b.push(d+gr(C)+`"\r
5
+ \r
6
+ ${R.replace(/\r(?!\n)|(?<!\r)\n/g,`\r
7
+ `)}\r
8
+ `):b.push(d+gr(C)+`"; filename="${gr(R.name,1)}"\r
9
+ Content-Type: ${R.type||"application/octet-stream"}\r
10
+ \r
11
+ `,R,`\r
12
+ `)),b.push(`--${l}--`),new s(b,{type:"multipart/form-data; boundary="+l})}var Ve,Za,Xa,Gn,Ja,xn,gr,we,yi,Ka=Tt(()=>{W();vt();Sr();({toStringTag:Ve,iterator:Za,hasInstance:Xa}=Symbol),Gn=Math.random,Ja="append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(","),xn=(f,s,l)=>(f+="",/^(Blob|File)$/.test(s&&s[Ve])?[(l=l!==void 0?l+"":s[Ve]=="File"?s.name:"blob",f),s.name!==l||s[Ve]=="blob"?new Et([s],l,s):s]:[f,s+""]),gr=(f,s)=>(s?f:f.replace(/\r?\n|\r/g,`\r
13
+ `)).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),we=(f,s,l)=>{if(s.length<l)throw new TypeError(`Failed to execute '${f}' on 'FormData': ${l} arguments required, but only ${s.length} present.`)},yi=class{#e=[];constructor(...s){if(s.length)throw new TypeError("Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.")}get[Ve](){return"FormData"}[Za](){return this.entries()}static[Xa](s){return s&&typeof s=="object"&&s[Ve]==="FormData"&&!Ja.some(l=>typeof s[l]!="function")}append(...s){we("append",arguments,2),this.#e.push(xn(...s))}delete(s){we("delete",arguments,1),s+="",this.#e=this.#e.filter(([l])=>l!==s)}get(s){we("get",arguments,1),s+="";for(var l=this.#e,b=l.length,d=0;d<b;d++)if(l[d][0]===s)return l[d][1];return null}getAll(s,l){return we("getAll",arguments,1),l=[],s+="",this.#e.forEach(b=>b[0]===s&&l.push(b[1])),l}has(s){return we("has",arguments,1),s+="",this.#e.some(l=>l[0]===s)}forEach(s,l){we("forEach",arguments,1);for(var[b,d]of this)s.call(l,d,b,this)}set(...s){we("set",arguments,2);var l=[],b=!0;s=xn(...s),this.#e.forEach(d=>{d[0]===s[0]?b&&(b=!l.push(s)):l.push(d)}),b&&l.push(s),this.#e=l}*entries(){yield*this.#e}*keys(){for(var[s]of this)yield s}*values(){for(var[,s]of this)yield s}}});var Xn=pr((wi,Zn)=>{W();if(!globalThis.DOMException)try{let{MessageChannel:f}=Ct("worker_threads"),s=new f().port1,l=new ArrayBuffer;s.postMessage(l,[l,l])}catch(f){f.constructor.name==="DOMException"&&(globalThis.DOMException=f.constructor)}Zn.exports=globalThis.DOMException});import{statSync as Jn,createReadStream as ei,promises as ti}from"node:fs";import{basename as ri}from"node:path";var Kn,Rr,qi,Ai,Wi,Bi,eo,to,qt,ni=Tt(()=>{W();Kn=Nn(Xn(),1);Sr();vt();({stat:Rr}=ti),qi=(f,s)=>eo(Jn(f),f,s),Ai=(f,s)=>Rr(f).then(l=>eo(l,f,s)),Wi=(f,s)=>Rr(f).then(l=>to(l,f,s)),Bi=(f,s)=>to(Jn(f),f,s),eo=(f,s,l="")=>new Re([new qt({path:s,size:f.size,lastModified:f.mtimeMs,start:0})],{type:l}),to=(f,s,l="")=>new Et([new qt({path:s,size:f.size,lastModified:f.mtimeMs,start:0})],ri(s),{type:l,lastModified:f.mtimeMs}),qt=class f{#e;#t;constructor(s){this.#e=s.path,this.#t=s.start,this.size=s.size,this.lastModified=s.lastModified}slice(s,l){return new f({path:this.#e,lastModified:this.lastModified,size:l-s,start:this.#t+s})}async*stream(){let{mtimeMs:s}=await Rr(this.#e);if(s>this.lastModified)throw new Kn.default("The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.","NotReadableError");yield*ei(this.#e,{start:this.#t,end:this.#t+this.size-1})}get[Symbol.toStringTag](){return"Blob"}}});export{Re as a,vt as b,Et as c,yi as d,Si as e,Ka as f,qi as g,Ai as h,Wi as i,Bi as j,ni as k};
14
+ /*! Bundled license information:
15
+
16
+ web-streams-polyfill/dist/ponyfill.es2018.js:
17
+ (**
18
+ * @license
19
+ * web-streams-polyfill v3.3.3
20
+ * Copyright 2024 Mattias Buelens, Diwank Singh Tomer and other contributors.
21
+ * This code is released under the MIT license.
22
+ * SPDX-License-Identifier: MIT
23
+ *)
24
+
25
+ fetch-blob/index.js:
26
+ (*! fetch-blob. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> *)
27
+
28
+ formdata-polyfill/esm.min.js:
29
+ (*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> *)
30
+
31
+ node-domexception/index.js:
32
+ (*! node-domexception. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> *)
33
+ */
@@ -1,6 +1,6 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{f}from"./chunk-2MOGYHWM.js";import{f as u}from"./chunk-QKYGQLWC.js";import{g as m,i as c,p as l,q as p}from"./chunk-6E766NPX.js";import{b as n}from"./chunk-GZPNIYVZ.js";n();var o=2e3;function T(e){return e.length<=o?e:`${e.slice(0,o)}
3
+ import{f}from"./chunk-G4YMVWG4.js";import{f as u}from"./chunk-QKYGQLWC.js";import{g as m,i as c,p as l,q as p}from"./chunk-2ONZZ46N.js";import{b as n}from"./chunk-GZPNIYVZ.js";n();var o=2e3;function T(e){return e.length<=o?e:`${e.slice(0,o)}
4
4
  \u2026 (${e.length-o} more characters)`}var s=class extends m{constructor(t,r){super(r);this.config=t}getDescription(){return`Create task: ${this.params.subject}`}async getDefaultPermission(){return"ask"}getConfirmationDetails(t){let r={type:"info",title:"Confirm TaskCreate",prompt:`Create task: ${this.params.subject}
5
5
 
6
6
  `+T(this.params.description),onConfirm:async()=>{}};return Promise.resolve(r)}async execute(){let t=u(this.config.getTeamContext()?.teamName);if(!t){let a="No active team. Create a team first.";return{llmContent:a,returnDisplay:a,error:{message:a}}}let r=await f(t,{subject:this.params.subject,description:this.params.description,activeForm:this.params.activeForm,metadata:this.params.metadata}),i=`Task #${r.id} created: "${r.subject}"`;return{llmContent:i,returnDisplay:i}}},d=class e extends c{constructor(t){super(e.Name,p.TASK_CREATE,"Create a new task in the team task list. Tasks are automatically assigned to idle teammates.","other",{type:"object",properties:{subject:{type:"string",description:"Short title for the task.",maxLength:200},description:{type:"string",description:"Detailed description of the task.",maxLength:1e4},activeForm:{type:"string",maxLength:200,description:'Present tense label for UI (e.g., "Running tests").'},metadata:{type:"object",description:"Optional arbitrary metadata."}},required:["subject","description"],additionalProperties:!1});this.config=t}static Name=l.TASK_CREATE;createInvocation(t){return new s(this.config,t)}toAutoClassifierInput(t){return{subject:t.subject,description:t.description}}};export{T as a,d as b};
@@ -0,0 +1,9 @@
1
+ // Force strict mode and setup for ESM
2
+ "use strict";
3
+ import{b as d}from"./chunk-GZPNIYVZ.js";import{a as g,d as E,f as P}from"./chunk-OWGSC52X.js";var k=E((vr,ze)=>{"use strict";d();var je=["nodebuffer","arraybuffer","fragments"],Ve=typeof Blob<"u";Ve&&je.push("blob");ze.exports={BINARY_TYPES:je,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:Ve,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Z=E((wr,ie)=>{"use strict";d();var{EMPTY_BUFFER:Kt}=k(),Se=Buffer[Symbol.species];function Xt(t,e){if(t.length===0)return Kt;if(t.length===1)return t[0];let s=Buffer.allocUnsafe(e),r=0;for(let i=0;i<t.length;i++){let n=t[i];s.set(n,r),r+=n.length}return r<e?new Se(s.buffer,s.byteOffset,r):s}function He(t,e,s,r,i){for(let n=0;n<i;n++)s[r+n]=t[n]^e[n&3]}function Ye(t,e){for(let s=0;s<t.length;s++)t[s]^=e[s&3]}function Zt(t){return t.length===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.length)}function Ee(t){if(Ee.readOnly=!0,Buffer.isBuffer(t))return t;let e;return t instanceof ArrayBuffer?e=new Se(t):ArrayBuffer.isView(t)?e=new Se(t.buffer,t.byteOffset,t.byteLength):(e=Buffer.from(t),Ee.readOnly=!1),e}ie.exports={concat:Xt,mask:He,toArrayBuffer:Zt,toBuffer:Ee,unmask:Ye};if(!process.env.WS_NO_BUFFER_UTIL)try{let t=g("bufferutil");ie.exports.mask=function(e,s,r,i,n){n<48?He(e,s,r,i,n):t.mask(e,s,r,i,n)},ie.exports.unmask=function(e,s){e.length<32?Ye(e,s):t.unmask(e,s)}}catch{}});var Ze=E((Tr,Xe)=>{"use strict";d();var Ke=Symbol("kDone"),ve=Symbol("kRun"),be=class{constructor(e){this[Ke]=()=>{this.pending--,this[ve]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[ve]()}[ve](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[Ke])}}};Xe.exports=be});var $=E((Cr,tt)=>{"use strict";d();var Q=g("zlib"),Qe=Z(),Qt=Ze(),{kStatusCode:Je}=k(),Jt=Buffer[Symbol.species],es=Buffer.from([0,0,255,255]),oe=Symbol("permessage-deflate"),C=Symbol("total-length"),q=Symbol("callback"),B=Symbol("buffers"),G=Symbol("error"),ne,we=class{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!ne){let s=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;ne=new Qt(s)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[q];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let s=this._options,r=e.find(i=>!(s.serverNoContextTakeover===!1&&i.server_no_context_takeover||i.server_max_window_bits&&(s.serverMaxWindowBits===!1||typeof s.serverMaxWindowBits=="number"&&s.serverMaxWindowBits>i.server_max_window_bits)||typeof s.clientMaxWindowBits=="number"&&!i.client_max_window_bits));if(!r)throw new Error("None of the extension offers can be accepted");return s.serverNoContextTakeover&&(r.server_no_context_takeover=!0),s.clientNoContextTakeover&&(r.client_no_context_takeover=!0),typeof s.serverMaxWindowBits=="number"&&(r.server_max_window_bits=s.serverMaxWindowBits),typeof s.clientMaxWindowBits=="number"?r.client_max_window_bits=s.clientMaxWindowBits:(r.client_max_window_bits===!0||s.clientMaxWindowBits===!1)&&delete r.client_max_window_bits,r}acceptAsClient(e){let s=e[0];if(this._options.clientNoContextTakeover===!1&&s.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!s.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(s.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&s.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return s}normalizeParams(e){return e.forEach(s=>{Object.keys(s).forEach(r=>{let i=s[r];if(i.length>1)throw new Error(`Parameter "${r}" must have only a single value`);if(i=i[0],r==="client_max_window_bits"){if(i!==!0){let n=+i;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${r}": ${i}`);i=n}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${r}": ${i}`)}else if(r==="server_max_window_bits"){let n=+i;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${r}": ${i}`);i=n}else if(r==="client_no_context_takeover"||r==="server_no_context_takeover"){if(i!==!0)throw new TypeError(`Invalid value for parameter "${r}": ${i}`)}else throw new Error(`Unknown parameter "${r}"`);s[r]=i})}),e}decompress(e,s,r){ne.add(i=>{this._decompress(e,s,(n,o)=>{i(),r(n,o)})})}compress(e,s,r){ne.add(i=>{this._compress(e,s,(n,o)=>{i(),r(n,o)})})}_decompress(e,s,r){let i=this._isServer?"client":"server";if(!this._inflate){let n=`${i}_max_window_bits`,o=typeof this.params[n]!="number"?Q.Z_DEFAULT_WINDOWBITS:this.params[n];this._inflate=Q.createInflateRaw({...this._options.zlibInflateOptions,windowBits:o}),this._inflate[oe]=this,this._inflate[C]=0,this._inflate[B]=[],this._inflate.on("error",ss),this._inflate.on("data",et)}this._inflate[q]=r,this._inflate.write(e),s&&this._inflate.write(es),this._inflate.flush(()=>{let n=this._inflate[G];if(n){this._inflate.close(),this._inflate=null,r(n);return}let o=Qe.concat(this._inflate[B],this._inflate[C]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[C]=0,this._inflate[B]=[],s&&this.params[`${i}_no_context_takeover`]&&this._inflate.reset()),r(null,o)})}_compress(e,s,r){let i=this._isServer?"server":"client";if(!this._deflate){let n=`${i}_max_window_bits`,o=typeof this.params[n]!="number"?Q.Z_DEFAULT_WINDOWBITS:this.params[n];this._deflate=Q.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:o}),this._deflate[C]=0,this._deflate[B]=[],this._deflate.on("data",ts)}this._deflate[q]=r,this._deflate.write(e),this._deflate.flush(Q.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let n=Qe.concat(this._deflate[B],this._deflate[C]);s&&(n=new Jt(n.buffer,n.byteOffset,n.length-4)),this._deflate[q]=null,this._deflate[C]=0,this._deflate[B]=[],s&&this.params[`${i}_no_context_takeover`]&&this._deflate.reset(),r(null,n)})}};tt.exports=we;function ts(t){this[B].push(t),this[C]+=t.length}function et(t){if(this[C]+=t.length,this[oe]._maxPayload<1||this[C]<=this[oe]._maxPayload){this[B].push(t);return}this[G]=new RangeError("Max payload size exceeded"),this[G].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[G][Je]=1009,this.removeListener("data",et),this.reset()}function ss(t){if(this[oe]._inflate=null,this[G]){this[q](this[G]);return}t[Je]=1007,this[q](t)}});var j=E((Nr,ae)=>{"use strict";d();var{isUtf8:st}=g("buffer"),{hasBlob:rs}=k(),is=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function ns(t){return t>=1e3&&t<=1014&&t!==1004&&t!==1005&&t!==1006||t>=3e3&&t<=4999}function Oe(t){let e=t.length,s=0;for(;s<e;)if((t[s]&128)===0)s++;else if((t[s]&224)===192){if(s+1===e||(t[s+1]&192)!==128||(t[s]&254)===192)return!1;s+=2}else if((t[s]&240)===224){if(s+2>=e||(t[s+1]&192)!==128||(t[s+2]&192)!==128||t[s]===224&&(t[s+1]&224)===128||t[s]===237&&(t[s+1]&224)===160)return!1;s+=3}else if((t[s]&248)===240){if(s+3>=e||(t[s+1]&192)!==128||(t[s+2]&192)!==128||(t[s+3]&192)!==128||t[s]===240&&(t[s+1]&240)===128||t[s]===244&&t[s+1]>143||t[s]>244)return!1;s+=4}else return!1;return!0}function os(t){return rs&&typeof t=="object"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&(t[Symbol.toStringTag]==="Blob"||t[Symbol.toStringTag]==="File")}ae.exports={isBlob:os,isValidStatusCode:ns,isValidUTF8:Oe,tokenChars:is};if(st)ae.exports.isValidUTF8=function(t){return t.length<24?Oe(t):st(t)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let t=g("utf-8-validate");ae.exports.isValidUTF8=function(e){return e.length<32?Oe(e):t(e)}}catch{}});var Ne=E((Br,lt)=>{"use strict";d();var{Writable:as}=g("stream"),rt=$(),{BINARY_TYPES:fs,EMPTY_BUFFER:it,kStatusCode:ls,kWebSocket:hs}=k(),{concat:Te,toArrayBuffer:cs,unmask:us}=Z(),{isValidStatusCode:ds,isValidUTF8:nt}=j(),fe=Buffer[Symbol.species],b=0,ot=1,at=2,ft=3,ke=4,Ce=5,le=6,Le=class extends as{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||fs[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxBufferedChunks=e.maxBufferedChunks|0,this._maxFragments=e.maxFragments|0,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[hs]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=b}_write(e,s,r){if(this._opcode===8&&this._state==b)return r();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){r(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));return}this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(r)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let r=this._buffers[0];return this._buffers[0]=new fe(r.buffer,r.byteOffset+e,r.length-e),new fe(r.buffer,r.byteOffset,e)}let s=Buffer.allocUnsafe(e);do{let r=this._buffers[0],i=s.length-e;e>=r.length?s.set(this._buffers.shift(),i):(s.set(new Uint8Array(r.buffer,r.byteOffset,e),i),this._buffers[0]=new fe(r.buffer,r.byteOffset+e,r.length-e)),e-=r.length}while(e>0);return s}startLoop(e){this._loop=!0;do switch(this._state){case b:this.getInfo(e);break;case ot:this.getPayloadLength16(e);break;case at:this.getPayloadLength64(e);break;case ft:this.getMask();break;case ke:this.getData(e);break;case Ce:case le:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let s=this.consume(2);if((s[0]&48)!==0){let i=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(i);return}let r=(s[0]&64)===64;if(r&&!this._extensions[rt.extensionName]){let i=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(i);return}if(this._fin=(s[0]&128)===128,this._opcode=s[0]&15,this._payloadLength=s[1]&127,this._opcode===0){if(r){let i=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(i);return}if(!this._fragmented){let i=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(i);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let i=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(i);return}this._compressed=r}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let i=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(i);return}if(r){let i=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(i);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let i=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(i);return}}else{let i=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(i);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(s[1]&128)===128,this._isServer){if(!this._masked){let i=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(i);return}}else if(this._masked){let i=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(i);return}this._payloadLength===126?this._state=ot:this._payloadLength===127?this._state=at:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let s=this.consume(8),r=s.readUInt32BE(0);if(r>Math.pow(2,21)-1){let i=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(i);return}this._payloadLength=r*Math.pow(2,32)+s.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let s=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(s);return}this._masked?this._state=ft:this._state=ke}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=ke}getData(e){let s=it;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}s=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&us(s,this._mask)}if(this._opcode>7){this.controlMessage(s,e);return}if(this._compressed){this._state=Ce,this.decompress(s,e);return}if(s.length){if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){let r=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");e(r);return}this._messageLength=this._totalPayloadLength,this._fragments.push(s)}this.dataMessage(e)}decompress(e,s){this._extensions[rt.extensionName].decompress(e,this._fin,(i,n)=>{if(i)return s(i);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let o=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");s(o);return}if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){let o=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");s(o);return}this._fragments.push(n)}this.dataMessage(s),this._state===b&&this.startLoop(s)})}dataMessage(e){if(!this._fin){this._state=b;return}let s=this._messageLength,r=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let i;this._binaryType==="nodebuffer"?i=Te(r,s):this._binaryType==="arraybuffer"?i=cs(Te(r,s)):this._binaryType==="blob"?i=new Blob(r):i=r,this._allowSynchronousEvents?(this.emit("message",i,!0),this._state=b):(this._state=le,setImmediate(()=>{this.emit("message",i,!0),this._state=b,this.startLoop(e)}))}else{let i=Te(r,s);if(!this._skipUTF8Validation&&!nt(i)){let n=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(n);return}this._state===Ce||this._allowSynchronousEvents?(this.emit("message",i,!1),this._state=b):(this._state=le,setImmediate(()=>{this.emit("message",i,!1),this._state=b,this.startLoop(e)}))}}controlMessage(e,s){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,it),this.end();else{let r=e.readUInt16BE(0);if(!ds(r)){let n=this.createError(RangeError,`invalid status code ${r}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");s(n);return}let i=new fe(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!nt(i)){let n=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");s(n);return}this._loop=!1,this.emit("conclude",r,i),this.end()}this._state=b;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=b):(this._state=le,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=b,this.startLoop(s)}))}createError(e,s,r,i,n){this._loop=!1,this._errored=!0;let o=new e(r?`Invalid WebSocket frame: ${s}`:s);return Error.captureStackTrace(o,this.createError),o.code=n,o[ls]=i,o}};lt.exports=Le});var Re=E((Ir,ut)=>{"use strict";d();var{Duplex:Ur}=g("stream"),{randomFillSync:_s}=g("crypto"),{types:{isUint8Array:ms}}=g("util"),ht=$(),{EMPTY_BUFFER:ps,kWebSocket:gs,NOOP:ys}=k(),{isBlob:V,isValidStatusCode:xs}=j(),{mask:ct,toBuffer:U}=Z(),w=Symbol("kByteLength"),Ss=Buffer.alloc(4),he=8*1024,I,z=he,O=0,Es=1,vs=2,Pe=class t{constructor(e,s,r){this._extensions=s||{},r&&(this._generateMask=r,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=O,this.onerror=ys,this[gs]=void 0}static frame(e,s){let r,i=!1,n=2,o=!1;s.mask&&(r=s.maskBuffer||Ss,s.generateMask?s.generateMask(r):(z===he&&(I===void 0&&(I=Buffer.alloc(he)),_s(I,0,he),z=0),r[0]=I[z++],r[1]=I[z++],r[2]=I[z++],r[3]=I[z++]),o=(r[0]|r[1]|r[2]|r[3])===0,n=6);let f;typeof e=="string"?(!s.mask||o)&&s[w]!==void 0?f=s[w]:(e=Buffer.from(e),f=e.length):(f=e.length,i=s.mask&&s.readOnly&&!o);let l=f;f>=65536?(n+=8,l=127):f>125&&(n+=2,l=126);let a=Buffer.allocUnsafe(i?f+n:n);return a[0]=s.fin?s.opcode|128:s.opcode,s.rsv1&&(a[0]|=64),a[1]=l,l===126?a.writeUInt16BE(f,2):l===127&&(a[2]=a[3]=0,a.writeUIntBE(f,4,6)),s.mask?(a[1]|=128,a[n-4]=r[0],a[n-3]=r[1],a[n-2]=r[2],a[n-1]=r[3],o?[a,e]:i?(ct(e,r,a,n,f),[a]):(ct(e,r,e,0,f),[a,e])):[a,e]}close(e,s,r,i){let n;if(e===void 0)n=ps;else{if(typeof e!="number"||!xs(e))throw new TypeError("First argument must be a valid error code number");if(s===void 0||!s.length)n=Buffer.allocUnsafe(2),n.writeUInt16BE(e,0);else{let f=Buffer.byteLength(s);if(f>123)throw new RangeError("The message must not be greater than 123 bytes");if(n=Buffer.allocUnsafe(2+f),n.writeUInt16BE(e,0),typeof s=="string")n.write(s,2);else if(ms(s))n.set(s,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let o={[w]:n.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==O?this.enqueue([this.dispatch,n,!1,o,i]):this.sendFrame(t.frame(n,o),i)}ping(e,s,r){let i,n;if(typeof e=="string"?(i=Buffer.byteLength(e),n=!1):V(e)?(i=e.size,n=!1):(e=U(e),i=e.length,n=U.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[w]:i,fin:!0,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:9,readOnly:n,rsv1:!1};V(e)?this._state!==O?this.enqueue([this.getBlobData,e,!1,o,r]):this.getBlobData(e,!1,o,r):this._state!==O?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(t.frame(e,o),r)}pong(e,s,r){let i,n;if(typeof e=="string"?(i=Buffer.byteLength(e),n=!1):V(e)?(i=e.size,n=!1):(e=U(e),i=e.length,n=U.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[w]:i,fin:!0,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:10,readOnly:n,rsv1:!1};V(e)?this._state!==O?this.enqueue([this.getBlobData,e,!1,o,r]):this.getBlobData(e,!1,o,r):this._state!==O?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(t.frame(e,o),r)}send(e,s,r){let i=this._extensions[ht.extensionName],n=s.binary?2:1,o=s.compress,f,l;typeof e=="string"?(f=Buffer.byteLength(e),l=!1):V(e)?(f=e.size,l=!1):(e=U(e),f=e.length,l=U.readOnly),this._firstFragment?(this._firstFragment=!1,o&&i&&i.params[i._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(o=f>=i._threshold),this._compress=o):(o=!1,n=0),s.fin&&(this._firstFragment=!0);let a={[w]:f,fin:s.fin,generateMask:this._generateMask,mask:s.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:l,rsv1:o};V(e)?this._state!==O?this.enqueue([this.getBlobData,e,this._compress,a,r]):this.getBlobData(e,this._compress,a,r):this._state!==O?this.enqueue([this.dispatch,e,this._compress,a,r]):this.dispatch(e,this._compress,a,r)}getBlobData(e,s,r,i){this._bufferedBytes+=r[w],this._state=vs,e.arrayBuffer().then(n=>{if(this._socket.destroyed){let f=new Error("The socket was closed while the blob was being read");process.nextTick(Be,this,f,i);return}this._bufferedBytes-=r[w];let o=U(n);s?this.dispatch(o,s,r,i):(this._state=O,this.sendFrame(t.frame(o,r),i),this.dequeue())}).catch(n=>{process.nextTick(bs,this,n,i)})}dispatch(e,s,r,i){if(!s){this.sendFrame(t.frame(e,r),i);return}let n=this._extensions[ht.extensionName];this._bufferedBytes+=r[w],this._state=Es,n.compress(e,r.fin,(o,f)=>{if(this._socket.destroyed){let l=new Error("The socket was closed while data was being compressed");Be(this,l,i);return}this._bufferedBytes-=r[w],this._state=O,r.readOnly=!1,this.sendFrame(t.frame(f,r),i),this.dequeue()})}dequeue(){for(;this._state===O&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][w],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][w],this._queue.push(e)}sendFrame(e,s){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],s),this._socket.uncork()):this._socket.write(e[0],s)}};ut.exports=Pe;function Be(t,e,s){typeof s=="function"&&s(e);for(let r=0;r<t._queue.length;r++){let i=t._queue[r],n=i[i.length-1];typeof n=="function"&&n(e)}}function bs(t,e,s){Be(t,e,s),t.onerror(e)}});var Et=E((Mr,St)=>{"use strict";d();var{kForOnEventAttribute:J,kListener:Ue}=k(),dt=Symbol("kCode"),_t=Symbol("kData"),mt=Symbol("kError"),pt=Symbol("kMessage"),gt=Symbol("kReason"),H=Symbol("kTarget"),yt=Symbol("kType"),xt=Symbol("kWasClean"),L=class{constructor(e){this[H]=null,this[yt]=e}get target(){return this[H]}get type(){return this[yt]}};Object.defineProperty(L.prototype,"target",{enumerable:!0});Object.defineProperty(L.prototype,"type",{enumerable:!0});var D=class extends L{constructor(e,s={}){super(e),this[dt]=s.code===void 0?0:s.code,this[gt]=s.reason===void 0?"":s.reason,this[xt]=s.wasClean===void 0?!1:s.wasClean}get code(){return this[dt]}get reason(){return this[gt]}get wasClean(){return this[xt]}};Object.defineProperty(D.prototype,"code",{enumerable:!0});Object.defineProperty(D.prototype,"reason",{enumerable:!0});Object.defineProperty(D.prototype,"wasClean",{enumerable:!0});var Y=class extends L{constructor(e,s={}){super(e),this[mt]=s.error===void 0?null:s.error,this[pt]=s.message===void 0?"":s.message}get error(){return this[mt]}get message(){return this[pt]}};Object.defineProperty(Y.prototype,"error",{enumerable:!0});Object.defineProperty(Y.prototype,"message",{enumerable:!0});var ee=class extends L{constructor(e,s={}){super(e),this[_t]=s.data===void 0?null:s.data}get data(){return this[_t]}};Object.defineProperty(ee.prototype,"data",{enumerable:!0});var ws={addEventListener(t,e,s={}){for(let i of this.listeners(t))if(!s[J]&&i[Ue]===e&&!i[J])return;let r;if(t==="message")r=function(n,o){let f=new ee("message",{data:o?n:n.toString()});f[H]=this,ce(e,this,f)};else if(t==="close")r=function(n,o){let f=new D("close",{code:n,reason:o.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});f[H]=this,ce(e,this,f)};else if(t==="error")r=function(n){let o=new Y("error",{error:n,message:n.message});o[H]=this,ce(e,this,o)};else if(t==="open")r=function(){let n=new L("open");n[H]=this,ce(e,this,n)};else return;r[J]=!!s[J],r[Ue]=e,s.once?this.once(t,r):this.on(t,r)},removeEventListener(t,e){for(let s of this.listeners(t))if(s[Ue]===e&&!s[J]){this.removeListener(t,s);break}}};St.exports={CloseEvent:D,ErrorEvent:Y,Event:L,EventTarget:ws,MessageEvent:ee};function ce(t,e,s){typeof t=="object"&&t.handleEvent?t.handleEvent.call(t,s):t.call(e,s)}});var ue=E((Ar,vt)=>{"use strict";d();var{tokenChars:te}=j();function T(t,e,s){t[e]===void 0?t[e]=[s]:t[e].push(s)}function Os(t){let e=Object.create(null),s=Object.create(null),r=!1,i=!1,n=!1,o,f,l=-1,a=-1,h=-1,c=0;for(;c<t.length;c++)if(a=t.charCodeAt(c),o===void 0)if(h===-1&&te[a]===1)l===-1&&(l=c);else if(c!==0&&(a===32||a===9))h===-1&&l!==-1&&(h=c);else if(a===59||a===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${c}`);h===-1&&(h=c);let y=t.slice(l,h);a===44?(T(e,y,s),s=Object.create(null)):o=y,l=h=-1}else throw new SyntaxError(`Unexpected character at index ${c}`);else if(f===void 0)if(h===-1&&te[a]===1)l===-1&&(l=c);else if(a===32||a===9)h===-1&&l!==-1&&(h=c);else if(a===59||a===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${c}`);h===-1&&(h=c),T(s,t.slice(l,h),!0),a===44&&(T(e,o,s),s=Object.create(null),o=void 0),l=h=-1}else if(a===61&&l!==-1&&h===-1)f=t.slice(l,c),l=h=-1;else throw new SyntaxError(`Unexpected character at index ${c}`);else if(i){if(te[a]!==1)throw new SyntaxError(`Unexpected character at index ${c}`);l===-1?l=c:r||(r=!0),i=!1}else if(n)if(te[a]===1)l===-1&&(l=c);else if(a===34&&l!==-1)n=!1,h=c;else if(a===92)i=!0;else throw new SyntaxError(`Unexpected character at index ${c}`);else if(a===34&&t.charCodeAt(c-1)===61)n=!0;else if(h===-1&&te[a]===1)l===-1&&(l=c);else if(l!==-1&&(a===32||a===9))h===-1&&(h=c);else if(a===59||a===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${c}`);h===-1&&(h=c);let y=t.slice(l,h);r&&(y=y.replace(/\\/g,""),r=!1),T(s,f,y),a===44&&(T(e,o,s),s=Object.create(null),o=void 0),f=void 0,l=h=-1}else throw new SyntaxError(`Unexpected character at index ${c}`);if(l===-1||n||a===32||a===9)throw new SyntaxError("Unexpected end of input");h===-1&&(h=c);let m=t.slice(l,h);return o===void 0?T(e,m,s):(f===void 0?T(s,m,!0):r?T(s,f,m.replace(/\\/g,"")):T(s,f,m),T(e,o,s)),e}function Ts(t){return Object.keys(t).map(e=>{let s=t[e];return Array.isArray(s)||(s=[s]),s.map(r=>[e].concat(Object.keys(r).map(i=>{let n=r[i];return Array.isArray(n)||(n=[n]),n.map(o=>o===!0?i:`${i}=${o}`).join("; ")})).join("; ")).join(", ")}).join(", ")}vt.exports={format:Ts,parse:Os}});var pe=E(($r,Ut)=>{"use strict";d();var ks=g("events"),Cs=g("https"),Ls=g("http"),Ot=g("net"),Ns=g("tls"),{randomBytes:Ps,createHash:Bs}=g("crypto"),{Duplex:qr,Readable:Gr}=g("stream"),{URL:Ie}=g("url"),R=$(),Rs=Ne(),Us=Re(),{isBlob:Is}=j(),{BINARY_TYPES:bt,CLOSE_TIMEOUT:Ds,EMPTY_BUFFER:de,GUID:Ms,kForOnEventAttribute:De,kListener:Fs,kStatusCode:As,kWebSocket:x,NOOP:Tt}=k(),{EventTarget:{addEventListener:Ws,removeEventListener:qs}}=Et(),{format:Gs,parse:$s}=ue(),{toBuffer:js}=Z(),kt=Symbol("kAborted"),Me=[8,13],N=["CONNECTING","OPEN","CLOSING","CLOSED"],Vs=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,_=class t extends ks{constructor(e,s,r){super(),this._binaryType=bt[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=de,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=t.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,s===void 0?s=[]:Array.isArray(s)||(typeof s=="object"&&s!==null?(r=s,s=[]):s=[s]),Ct(this,e,s,r)):(this._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){bt.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,s,r){let i=new Rs({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:r.maxBufferedChunks,maxFragments:r.maxFragments,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),n=new Us(e,this._extensions,r.generateMask);this._receiver=i,this._sender=n,this._socket=e,i[x]=this,n[x]=this,e[x]=this,i.on("conclude",Ys),i.on("drain",Ks),i.on("error",Xs),i.on("message",Zs),i.on("ping",Qs),i.on("pong",Js),n.onerror=er,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),s.length>0&&e.unshift(s),e.on("close",Pt),e.on("data",me),e.on("end",Bt),e.on("error",Rt),this._readyState=t.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[R.extensionName]&&this._extensions[R.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,s){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){v(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===t.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=t.CLOSING,this._sender.close(e,s,!this._isServer,r=>{r||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Nt(this)}}pause(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,s,r){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(r=e,e=s=void 0):typeof s=="function"&&(r=s,s=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){Fe(this,e,r);return}s===void 0&&(s=!this._isServer),this._sender.ping(e||de,s,r)}pong(e,s,r){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(r=e,e=s=void 0):typeof s=="function"&&(r=s,s=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){Fe(this,e,r);return}s===void 0&&(s=!this._isServer),this._sender.pong(e||de,s,r)}resume(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,s,r){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof s=="function"&&(r=s,s={}),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){Fe(this,e,r);return}let i={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...s};this._extensions[R.extensionName]||(i.compress=!1),this._sender.send(e||de,i,r)}terminate(){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){v(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=t.CLOSING,this._socket.destroy())}}};Object.defineProperty(_,"CONNECTING",{enumerable:!0,value:N.indexOf("CONNECTING")});Object.defineProperty(_.prototype,"CONNECTING",{enumerable:!0,value:N.indexOf("CONNECTING")});Object.defineProperty(_,"OPEN",{enumerable:!0,value:N.indexOf("OPEN")});Object.defineProperty(_.prototype,"OPEN",{enumerable:!0,value:N.indexOf("OPEN")});Object.defineProperty(_,"CLOSING",{enumerable:!0,value:N.indexOf("CLOSING")});Object.defineProperty(_.prototype,"CLOSING",{enumerable:!0,value:N.indexOf("CLOSING")});Object.defineProperty(_,"CLOSED",{enumerable:!0,value:N.indexOf("CLOSED")});Object.defineProperty(_.prototype,"CLOSED",{enumerable:!0,value:N.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(t=>{Object.defineProperty(_.prototype,t,{enumerable:!0})});["open","error","close","message"].forEach(t=>{Object.defineProperty(_.prototype,`on${t}`,{enumerable:!0,get(){for(let e of this.listeners(t))if(e[De])return e[Fs];return null},set(e){for(let s of this.listeners(t))if(s[De]){this.removeListener(t,s);break}typeof e=="function"&&this.addEventListener(t,e,{[De]:!0})}})});_.prototype.addEventListener=Ws;_.prototype.removeEventListener=qs;Ut.exports=_;function Ct(t,e,s,r){let i={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:Ds,protocolVersion:Me[1],maxBufferedChunks:1048576,maxFragments:131072,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(t._autoPong=i.autoPong,t._closeTimeout=i.closeTimeout,!Me.includes(i.protocolVersion))throw new RangeError(`Unsupported protocol version: ${i.protocolVersion} (supported versions: ${Me.join(", ")})`);let n;if(e instanceof Ie)n=e;else try{n=new Ie(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}n.protocol==="http:"?n.protocol="ws:":n.protocol==="https:"&&(n.protocol="wss:"),t._url=n.href;let o=n.protocol==="wss:",f=n.protocol==="ws+unix:",l;if(n.protocol!=="ws:"&&!o&&!f?l=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:f&&!n.pathname?l="The URL's pathname is empty":n.hash&&(l="The URL contains a fragment identifier"),l){let u=new SyntaxError(l);if(t._redirects===0)throw u;_e(t,u);return}let a=o?443:80,h=Ps(16).toString("base64"),c=o?Cs.request:Ls.request,m=new Set,y;if(i.createConnection=i.createConnection||(o?Hs:zs),i.defaultPort=i.defaultPort||a,i.port=n.port||a,i.host=n.hostname.startsWith("[")?n.hostname.slice(1,-1):n.hostname,i.headers={...i.headers,"Sec-WebSocket-Version":i.protocolVersion,"Sec-WebSocket-Key":h,Connection:"Upgrade",Upgrade:"websocket"},i.path=n.pathname+n.search,i.timeout=i.handshakeTimeout,i.perMessageDeflate&&(y=new R({...i.perMessageDeflate,isServer:!1,maxPayload:i.maxPayload}),i.headers["Sec-WebSocket-Extensions"]=Gs({[R.extensionName]:y.offer()})),s.length){for(let u of s){if(typeof u!="string"||!Vs.test(u)||m.has(u))throw new SyntaxError("An invalid or duplicated subprotocol was specified");m.add(u)}i.headers["Sec-WebSocket-Protocol"]=s.join(",")}if(i.origin&&(i.protocolVersion<13?i.headers["Sec-WebSocket-Origin"]=i.origin:i.headers.Origin=i.origin),(n.username||n.password)&&(i.auth=`${n.username}:${n.password}`),f){let u=i.path.split(":");i.socketPath=u[0],i.path=u[1]}let p;if(i.followRedirects){if(t._redirects===0){t._originalIpc=f,t._originalSecure=o,t._originalHostOrSocketPath=f?i.socketPath:n.host;let u=r&&r.headers;if(r={...r,headers:{}},u)for(let[S,A]of Object.entries(u))r.headers[S.toLowerCase()]=A}else if(t.listenerCount("redirect")===0){let u=f?t._originalIpc?i.socketPath===t._originalHostOrSocketPath:!1:t._originalIpc?!1:n.host===t._originalHostOrSocketPath;(!u||t._originalSecure&&!o)&&(delete i.headers.authorization,delete i.headers.cookie,u||delete i.headers.host,i.auth=void 0)}i.auth&&!r.headers.authorization&&(r.headers.authorization="Basic "+Buffer.from(i.auth).toString("base64")),p=t._req=c(i),t._redirects&&t.emit("redirect",t.url,p)}else p=t._req=c(i);i.timeout&&p.on("timeout",()=>{v(t,p,"Opening handshake has timed out")}),p.on("error",u=>{p===null||p[kt]||(p=t._req=null,_e(t,u))}),p.on("response",u=>{let S=u.headers.location,A=u.statusCode;if(S&&i.followRedirects&&A>=300&&A<400){if(++t._redirects>i.maxRedirects){v(t,p,"Maximum redirects exceeded");return}p.abort();let K;try{K=new Ie(S,e)}catch{let W=new SyntaxError(`Invalid URL: ${S}`);_e(t,W);return}Ct(t,K,s,r)}else t.emit("unexpected-response",p,u)||v(t,p,`Unexpected server response: ${u.statusCode}`)}),p.on("upgrade",(u,S,A)=>{if(t.emit("upgrade",u),t.readyState!==_.CONNECTING)return;p=t._req=null;let K=u.headers.upgrade;if(K===void 0||K.toLowerCase()!=="websocket"){v(t,S,"Invalid Upgrade header");return}let qe=Bs("sha1").update(h+Ms).digest("base64");if(u.headers["sec-websocket-accept"]!==qe){v(t,S,"Invalid Sec-WebSocket-Accept header");return}let W=u.headers["sec-websocket-protocol"],X;if(W!==void 0?m.size?m.has(W)||(X="Server sent an invalid subprotocol"):X="Server sent a subprotocol but none was requested":m.size&&(X="Server sent no subprotocol"),X){v(t,S,X);return}W&&(t._protocol=W);let Ge=u.headers["sec-websocket-extensions"];if(Ge!==void 0){if(!y){v(t,S,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let ye;try{ye=$s(Ge)}catch{v(t,S,"Invalid Sec-WebSocket-Extensions header");return}let $e=Object.keys(ye);if($e.length!==1||$e[0]!==R.extensionName){v(t,S,"Server indicated an extension that was not requested");return}try{y.accept(ye[R.extensionName])}catch{v(t,S,"Invalid Sec-WebSocket-Extensions header");return}t._extensions[R.extensionName]=y}t.setSocket(S,A,{allowSynchronousEvents:i.allowSynchronousEvents,generateMask:i.generateMask,maxBufferedChunks:i.maxBufferedChunks,maxFragments:i.maxFragments,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation})}),i.finishRequest?i.finishRequest(p,t):p.end()}function _e(t,e){t._readyState=_.CLOSING,t._errorEmitted=!0,t.emit("error",e),t.emitClose()}function zs(t){return t.path=t.socketPath,Ot.connect(t)}function Hs(t){return t.path=void 0,!t.servername&&t.servername!==""&&(t.servername=Ot.isIP(t.host)?"":t.host),Ns.connect(t)}function v(t,e,s){t._readyState=_.CLOSING;let r=new Error(s);Error.captureStackTrace(r,v),e.setHeader?(e[kt]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(_e,t,r)):(e.destroy(r),e.once("error",t.emit.bind(t,"error")),e.once("close",t.emitClose.bind(t)))}function Fe(t,e,s){if(e){let r=Is(e)?e.size:js(e).length;t._socket?t._sender._bufferedBytes+=r:t._bufferedAmount+=r}if(s){let r=new Error(`WebSocket is not open: readyState ${t.readyState} (${N[t.readyState]})`);process.nextTick(s,r)}}function Ys(t,e){let s=this[x];s._closeFrameReceived=!0,s._closeMessage=e,s._closeCode=t,s._socket[x]!==void 0&&(s._socket.removeListener("data",me),process.nextTick(Lt,s._socket),t===1005?s.close():s.close(t,e))}function Ks(){let t=this[x];t.isPaused||t._socket.resume()}function Xs(t){let e=this[x];e._socket[x]!==void 0&&(e._socket.removeListener("data",me),process.nextTick(Lt,e._socket),e.close(t[As])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t))}function wt(){this[x].emitClose()}function Zs(t,e){this[x].emit("message",t,e)}function Qs(t){let e=this[x];e._autoPong&&e.pong(t,!this._isServer,Tt),e.emit("ping",t)}function Js(t){this[x].emit("pong",t)}function Lt(t){t.resume()}function er(t){let e=this[x];e.readyState!==_.CLOSED&&(e.readyState===_.OPEN&&(e._readyState=_.CLOSING,Nt(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t)))}function Nt(t){t._closeTimer=setTimeout(t._socket.destroy.bind(t._socket),t._closeTimeout)}function Pt(){let t=this[x];if(this.removeListener("close",Pt),this.removeListener("data",me),this.removeListener("end",Bt),t._readyState=_.CLOSING,!this._readableState.endEmitted&&!t._closeFrameReceived&&!t._receiver._writableState.errorEmitted&&this._readableState.length!==0){let e=this.read(this._readableState.length);t._receiver.write(e)}t._receiver.end(),this[x]=void 0,clearTimeout(t._closeTimer),t._receiver._writableState.finished||t._receiver._writableState.errorEmitted?t.emitClose():(t._receiver.on("error",wt),t._receiver.on("finish",wt))}function me(t){this[x]._receiver.write(t)||this.pause()}function Bt(){let t=this[x];t._readyState=_.CLOSING,t._receiver.end(),this.end()}function Rt(){let t=this[x];this.removeListener("error",Rt),this.on("error",Tt),t&&(t._readyState=_.CLOSING,this.destroy())}});var Ft=E((zr,Mt)=>{"use strict";d();var Vr=pe(),{Duplex:tr}=g("stream");function It(t){t.emit("close")}function sr(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Dt(t){this.removeListener("error",Dt),this.destroy(),this.listenerCount("error")===0&&this.emit("error",t)}function rr(t,e){let s=!0,r=new tr({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return t.on("message",function(n,o){let f=!o&&r._readableState.objectMode?n.toString():n;r.push(f)||t.pause()}),t.once("error",function(n){r.destroyed||(s=!1,r.destroy(n))}),t.once("close",function(){r.destroyed||r.push(null)}),r._destroy=function(i,n){if(t.readyState===t.CLOSED){n(i),process.nextTick(It,r);return}let o=!1;t.once("error",function(l){o=!0,n(l)}),t.once("close",function(){o||n(i),process.nextTick(It,r)}),s&&t.terminate()},r._final=function(i){if(t.readyState===t.CONNECTING){t.once("open",function(){r._final(i)});return}t._socket!==null&&(t._socket._writableState.finished?(i(),r._readableState.endEmitted&&r.destroy()):(t._socket.once("finish",function(){i()}),t.close()))},r._read=function(){t.isPaused&&t.resume()},r._write=function(i,n,o){if(t.readyState===t.CONNECTING){t.once("open",function(){r._write(i,n,o)});return}t.send(i,o)},r.on("end",sr),r.on("error",Dt),r}Mt.exports=rr});var Ae=E((Yr,At)=>{"use strict";d();var{tokenChars:ir}=j();function nr(t){let e=new Set,s=-1,r=-1,i=0;for(i;i<t.length;i++){let o=t.charCodeAt(i);if(r===-1&&ir[o]===1)s===-1&&(s=i);else if(i!==0&&(o===32||o===9))r===-1&&s!==-1&&(r=i);else if(o===44){if(s===-1)throw new SyntaxError(`Unexpected character at index ${i}`);r===-1&&(r=i);let f=t.slice(s,r);if(e.has(f))throw new SyntaxError(`The "${f}" subprotocol is duplicated`);e.add(f),s=r=-1}else throw new SyntaxError(`Unexpected character at index ${i}`)}if(s===-1||r!==-1)throw new SyntaxError("Unexpected end of input");let n=t.slice(s,i);if(e.has(n))throw new SyntaxError(`The "${n}" subprotocol is duplicated`);return e.add(n),e}At.exports={parse:nr}});var zt=E((Zr,Vt)=>{"use strict";d();var or=g("events"),ge=g("http"),{Duplex:Xr}=g("stream"),{createHash:ar}=g("crypto"),Wt=ue(),M=$(),fr=Ae(),lr=pe(),{CLOSE_TIMEOUT:hr,GUID:cr,kWebSocket:ur}=k(),dr=/^[+/0-9A-Za-z]{22}==$/,qt=0,Gt=1,jt=2,We=class extends or{constructor(e,s){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:1024*1024,maxFragments:128*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:hr,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:lr,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=ge.createServer((r,i)=>{let n=ge.STATUS_CODES[426];i.writeHead(426,{"Content-Length":n.length,"Content-Type":"text/plain"}),i.end(n)}),this._server.listen(e.port,e.host,e.backlog,s)):e.server&&(this._server=e.server),this._server){let r=this.emit.bind(this,"connection");this._removeListeners=_r(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(i,n,o)=>{this.handleUpgrade(i,n,o,r)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=qt}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===jt){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(se,this);return}if(e&&this.once("close",e),this._state!==Gt)if(this._state=Gt,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(se,this):process.nextTick(se,this);else{let s=this._server;this._removeListeners(),this._removeListeners=this._server=null,s.close(()=>{se(this)})}}shouldHandle(e){if(this.options.path){let s=e.url.indexOf("?");if((s!==-1?e.url.slice(0,s):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,s,r,i){s.on("error",$t);let n=e.headers["sec-websocket-key"],o=e.headers.upgrade,f=+e.headers["sec-websocket-version"];if(e.method!=="GET"){F(this,e,s,405,"Invalid HTTP method");return}if(o===void 0||o.toLowerCase()!=="websocket"){F(this,e,s,400,"Invalid Upgrade header");return}if(n===void 0||!dr.test(n)){F(this,e,s,400,"Missing or invalid Sec-WebSocket-Key header");return}if(f!==13&&f!==8){F(this,e,s,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){re(s,400);return}let l=e.headers["sec-websocket-protocol"],a=new Set;if(l!==void 0)try{a=fr.parse(l)}catch{F(this,e,s,400,"Invalid Sec-WebSocket-Protocol header");return}let h=e.headers["sec-websocket-extensions"],c={};if(this.options.perMessageDeflate&&h!==void 0){let m=new M({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let y=Wt.parse(h);y[M.extensionName]&&(m.accept(y[M.extensionName]),c[M.extensionName]=m)}catch{F(this,e,s,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let m={origin:e.headers[`${f===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(m,(y,p,u,S)=>{if(!y)return re(s,p||401,u,S);this.completeUpgrade(c,n,a,e,s,r,i)});return}if(!this.options.verifyClient(m))return re(s,401)}this.completeUpgrade(c,n,a,e,s,r,i)}completeUpgrade(e,s,r,i,n,o,f){if(!n.readable||!n.writable)return n.destroy();if(n[ur])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>qt)return re(n,503);let a=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${ar("sha1").update(s+cr).digest("base64")}`],h=new this.options.WebSocket(null,void 0,this.options);if(r.size){let c=this.options.handleProtocols?this.options.handleProtocols(r,i):r.values().next().value;c&&(a.push(`Sec-WebSocket-Protocol: ${c}`),h._protocol=c)}if(e[M.extensionName]){let c=e[M.extensionName].params,m=Wt.format({[M.extensionName]:[c]});a.push(`Sec-WebSocket-Extensions: ${m}`),h._extensions=e}this.emit("headers",a,i),n.write(a.concat(`\r
4
+ `).join(`\r
5
+ `)),n.removeListener("error",$t),h.setSocket(n,o,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(h),h.on("close",()=>{this.clients.delete(h),this._shouldEmitClose&&!this.clients.size&&process.nextTick(se,this)})),f(h,i)}};Vt.exports=We;function _r(t,e){for(let s of Object.keys(e))t.on(s,e[s]);return function(){for(let r of Object.keys(e))t.removeListener(r,e[r])}}function se(t){t._state=jt,t.emit("close")}function $t(){this.destroy()}function re(t,e,s,r){s=s||ge.STATUS_CODES[e],r={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(s),...r},t.once("finish",t.destroy),t.end(`HTTP/1.1 ${e} ${ge.STATUS_CODES[e]}\r
6
+ `+Object.keys(r).map(i=>`${i}: ${r[i]}`).join(`\r
7
+ `)+`\r
8
+ \r
9
+ `+s)}function F(t,e,s,r,i,n){if(t.listenerCount("wsClientError")){let o=new Error(i);Error.captureStackTrace(o,F),t.emit("wsClientError",o,s,e)}else re(s,r,i,n)}});d();var mr=P(Ft(),1),pr=P(ue(),1),gr=P($(),1),yr=P(Ne(),1),xr=P(Re(),1),Sr=P(Ae(),1),Ht=P(pe(),1),Er=P(zt(),1);var Jr=Ht.default;export{Er as a,Jr as b};
@@ -1,6 +1,6 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{a as c}from"./chunk-HYVP4472.js";import{p as u}from"./chunk-6E766NPX.js";import{b as m}from"./chunk-GZPNIYVZ.js";m();import{AsyncLocalStorage as h}from"node:async_hooks";var a=new h,r=new WeakMap,p={turns:"max_turn_requests",session_turns:"max_turn_requests",loop_detected:"max_turn_requests",continuations:"max_turn_requests",session_tokens:"max_tokens"},k=class{jobs=new Map;joinsJobs;wake;closed=!1;revision=0;task;lastResponse;stop;ended;finished;constructor(e={}){this.joinsJobs=e.joinsJobs??!0}begin(e,t,s=e){this.task||(this.task={startUuid:e,rootUuid:s,recorder:t},this.ended&&this.finish(this.ended).catch(()=>{}))}get taskStartUuid(){return this.task?.startUuid}get taskRef(){return this.task?{startUuid:this.task.startUuid,rootUuid:this.task.rootUuid}:void 0}noteResponse(e){this.lastResponse=e}noteStop(e){this.stop=e}finish(e){let t=this.task;return t?(this.finished??=this.recordOutcome(t,e),this.finished):(this.ended??=e,Promise.resolve(void 0))}async recordOutcome(e,t){let s=this.stop&&(t.outcome==="completed"||t.outcome==="error")?p[this.stop]:t.outcome,i=s==="completed"&&this.lastResponse?.finalAnswer?this.lastResponse:void 0,n=t.limitKind??(s==="max_tokens"||s==="max_turn_requests"?this.stop:void 0);return await e.recorder.recordTaskOutcome({taskStartUuid:e.startUuid,outcome:s,...n?{limitKind:n}:{},...s==="completed"?{finalAnswerUuid:i?i.recordId??i.id:null}:{}}),{outcome:s,...i&&{finalAnswerId:i.id}}}static get current(){return a.getStore()}run(e){return a.run(this,e)}static detached(e){return a.run(void 0,e)}static register(e,t,s){let i=a.getStore();e.originTask??=s?.originTask??i?.taskRef;let n=s?.status==="running"?r.get(s):void 0,o=n??(i?.joinsJobs?i:void 0);if(o){if(n&&s&&n.consume(s),e.completion==="detached"||!n&&e.status!=="running"){o.changed();return}if(r.set(e,o),o.closed){t();return}o.jobs.set(e,t),o.changed()}}static changed(e){e&&r.get(e)?.changed()}static abandoned(e){return r.get(e)?.closed===!0}static detach(e){let t=r.get(e);return!t||t.closed||!t.owns(e)||e.status!=="running"?!1:(e.completion="detached",t.consume(e),t.changed(),!0)}owns(e){return this.jobs.has(e)}consume(e){r.delete(e),this.jobs.delete(e)}get pending(){return this.jobs.size>0}get position(){return this.revision}get paused(){return[...this.jobs.keys()].some(e=>e.status==="paused")}get running(){return[...this.jobs.keys()].filter(e=>e.status==="running")}changed(){this.revision++,this.wake?.()}async wait(e,t,s){this.closed||t.aborted||e!==this.revision||await new Promise(i=>{let n,o=()=>{clearTimeout(n),t.removeEventListener("abort",o),this.wake=void 0,i()};this.wake=o,t.addEventListener("abort",o,{once:!0}),s!==void 0&&(n=setTimeout(o,s))})}close(){this.closed=!0;for(let[e,t]of this.jobs)e.status==="running"&&t();this.changed()}};function g(d,e){let t=s=>{let i=s.description.replace(/[\p{Cc}\s]+/gu," ").trim(),n=Math.max(1,Math.round((e-s.startTime)/6e4));return`background ${s.kind} "${i.length>80?`${i.slice(0,77)}...`:i}" (running ${n} min)`};return{displayText:`Still waiting on ${d.map(t).join(", ")}.`,modelText:d.map(s=>["<task-notification>",`<task-id>${c(s.id)}</task-id>`,`<kind>${s.kind}</kind>`,"<status>running</status>",`<summary>${c(`The ${t(s)} is still running, and this request cannot finish until it does. If the request needs its result, keep waiting. If it should keep running after the request, such as a server or watcher, call ${u.TASK_DETACH}. If it is no longer needed, call ${u.TASK_STOP}.`)}</summary>`,"</task-notification>"].join(`
3
+ import{a as c}from"./chunk-V6UPUMP3.js";import{p as u}from"./chunk-2ONZZ46N.js";import{b as m}from"./chunk-GZPNIYVZ.js";m();import{AsyncLocalStorage as h}from"node:async_hooks";var a=new h,r=new WeakMap,p={turns:"max_turn_requests",session_turns:"max_turn_requests",loop_detected:"max_turn_requests",continuations:"max_turn_requests",session_tokens:"max_tokens"},k=class{jobs=new Map;joinsJobs;wake;closed=!1;revision=0;task;lastResponse;stop;ended;finished;constructor(e={}){this.joinsJobs=e.joinsJobs??!0}begin(e,t,s=e){this.task||(this.task={startUuid:e,rootUuid:s,recorder:t},this.ended&&this.finish(this.ended).catch(()=>{}))}get taskStartUuid(){return this.task?.startUuid}get taskRef(){return this.task?{startUuid:this.task.startUuid,rootUuid:this.task.rootUuid}:void 0}noteResponse(e){this.lastResponse=e}noteStop(e){this.stop=e}finish(e){let t=this.task;return t?(this.finished??=this.recordOutcome(t,e),this.finished):(this.ended??=e,Promise.resolve(void 0))}async recordOutcome(e,t){let s=this.stop&&(t.outcome==="completed"||t.outcome==="error")?p[this.stop]:t.outcome,i=s==="completed"&&this.lastResponse?.finalAnswer?this.lastResponse:void 0,n=t.limitKind??(s==="max_tokens"||s==="max_turn_requests"?this.stop:void 0);return await e.recorder.recordTaskOutcome({taskStartUuid:e.startUuid,outcome:s,...n?{limitKind:n}:{},...s==="completed"?{finalAnswerUuid:i?i.recordId??i.id:null}:{}}),{outcome:s,...i&&{finalAnswerId:i.id}}}static get current(){return a.getStore()}run(e){return a.run(this,e)}static detached(e){return a.run(void 0,e)}static register(e,t,s){let i=a.getStore();e.originTask??=s?.originTask??i?.taskRef;let n=s?.status==="running"?r.get(s):void 0,o=n??(i?.joinsJobs?i:void 0);if(o){if(n&&s&&n.consume(s),e.completion==="detached"||!n&&e.status!=="running"){o.changed();return}if(r.set(e,o),o.closed){t();return}o.jobs.set(e,t),o.changed()}}static changed(e){e&&r.get(e)?.changed()}static abandoned(e){return r.get(e)?.closed===!0}static detach(e){let t=r.get(e);return!t||t.closed||!t.owns(e)||e.status!=="running"?!1:(e.completion="detached",t.consume(e),t.changed(),!0)}owns(e){return this.jobs.has(e)}consume(e){r.delete(e),this.jobs.delete(e)}get pending(){return this.jobs.size>0}get position(){return this.revision}get paused(){return[...this.jobs.keys()].some(e=>e.status==="paused")}get running(){return[...this.jobs.keys()].filter(e=>e.status==="running")}changed(){this.revision++,this.wake?.()}async wait(e,t,s){this.closed||t.aborted||e!==this.revision||await new Promise(i=>{let n,o=()=>{clearTimeout(n),t.removeEventListener("abort",o),this.wake=void 0,i()};this.wake=o,t.addEventListener("abort",o,{once:!0}),s!==void 0&&(n=setTimeout(o,s))})}close(){this.closed=!0;for(let[e,t]of this.jobs)e.status==="running"&&t();this.changed()}};function g(d,e){let t=s=>{let i=s.description.replace(/[\p{Cc}\s]+/gu," ").trim(),n=Math.max(1,Math.round((e-s.startTime)/6e4));return`background ${s.kind} "${i.length>80?`${i.slice(0,77)}...`:i}" (running ${n} min)`};return{displayText:`Still waiting on ${d.map(t).join(", ")}.`,modelText:d.map(s=>["<task-notification>",`<task-id>${c(s.id)}</task-id>`,`<kind>${s.kind}</kind>`,"<status>running</status>",`<summary>${c(`The ${t(s)} is still running, and this request cannot finish until it does. If the request needs its result, keep waiting. If it should keep running after the request, such as a server or watcher, call ${u.TASK_DETACH}. If it is no longer needed, call ${u.TASK_STOP}.`)}</summary>`,"</task-notification>"].join(`
4
4
  `)).join(`
5
5
  `)}}export{k as a,g as b};
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{b as o}from"./chunk-GZPNIYVZ.js";o();function l(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}var c=/<[^<>]*>/g;function r(t){return t!==void 0&&/\s/.test(t)}function a(t){let e=t.codePointAt(0);return e===void 0?!1:e===173||e===1564||e===12644||e===65279||e===65440||e>=0&&e<=31||e>=127&&e<=159||e>=4447&&e<=4448||e>=6068&&e<=6069||e>=6155&&e<=6159||e>=8203&&e<=8207||e>=8234&&e<=8238||e>=8288&&e<=8303||e>=65024&&e<=65039||e>=65520&&e<=65528||e>=113824&&e<=113827||e>=119155&&e<=119162||e>=917504&&e<=921599}function x(t){let e="";for(let i of t)a(i)||(e+=i);return e.toLowerCase()}function d(t){let e=x(t),i=e.length;if(i<2||e[0]!=="<"||e[i-1]!==">")return;let n=1;for(;n<i&&r(e[n]);)n++;let s=!1;for(e[n]==="/"&&(s=!0,n++);n<i&&r(e[n]);)n++;let f="system-reminder";if(e.slice(n,n+f.length)===f){if(n+=f.length,n<i-1&&r(e[n])){for(;n<i&&r(e[n]);)n++;for(;n<i&&e[n]!==">";)n++}for(;n<i&&r(e[n]);)n++;for(e[n]==="/"&&n++;n<i&&r(e[n]);)n++;if(!(n!==i-1||e[n]!==">"))return s?"closing":"other"}}function g(t){let e=d(t);return e==="closing"?"<\\/system-reminder>":e==="other"?l(t):t}function u(t){return t.replace(c,g)}export{l as a,u as b};
3
+ import{b as o}from"./chunk-GZPNIYVZ.js";o();function x(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}var c=/<[^<>]*>/g;function r(t){return t!==void 0&&/\s/.test(t)}function d(t){let e=t.codePointAt(0);return e===void 0?!1:e===173||e===1564||e===12644||e===65279||e===65440||e>=0&&e<=31||e>=127&&e<=159||e>=4447&&e<=4448||e>=6068&&e<=6069||e>=6155&&e<=6159||e>=8203&&e<=8207||e>=8234&&e<=8238||e>=8288&&e<=8303||e>=65024&&e<=65039||e>=65520&&e<=65528||e>=113824&&e<=113827||e>=119155&&e<=119162||e>=917504&&e<=921599}function l(t){let e="";for(let i of t)d(i)||(e+=i);return e.toLowerCase()}function u(t){let e=l(t),i=e.length;if(i<2||e[0]!=="<"||e[i-1]!==">")return;let n=1;for(;n<i&&r(e[n]);)n++;let s=!1;for(e[n]==="/"&&(s=!0,n++);n<i&&r(e[n]);)n++;let f="system-reminder";if(e.slice(n,n+f.length)===f){if(n+=f.length,n<i-1&&r(e[n])){for(;n<i&&r(e[n]);)n++;for(;n<i&&e[n]!==">";)n++}for(;n<i&&r(e[n]);)n++;for(e[n]==="/"&&n++;n<i&&r(e[n]);)n++;if(!(n!==i-1||e[n]!==">"))return s?"closing":"other"}}function m(t){let e=u(t);return e==="closing"?"<\\/system-reminder>":e==="other"?x(t):t}function a(t){return t.replace(c,m)}function p(t){return Array.isArray(t)?t.map(g):g(t)}function g(t){return typeof t=="string"?a(t):t.text===void 0?t:{...t,text:a(t.text)}}export{x as a,a as b,p as c};
4
4
  /**
5
5
  * @license
6
6
  * Copyright 2025 Matilda
@@ -1,6 +1,6 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{y as A}from"./chunk-DE3HKC2W.js";import{b as C}from"./chunk-LUNDTQ3G.js";import{g as O,i as S,p as W,q as P}from"./chunk-6E766NPX.js";import{Q as T,ba as I}from"./chunk-27Q5KW3A.js";import{b as E}from"./chunk-GZPNIYVZ.js";E();import*as h from"fs/promises";import*as f from"fs";import*as u from"path";var R=I("TODO_WRITE"),z={name:"todo_write",description:"Creates and manages a structured task list for your current coding session. This helps track progress, organize complex tasks, and demonstrate thoroughness.",parametersJsonSchema:{type:"object",properties:{todos:{type:"array",items:{type:"object",properties:{content:{type:"string",minLength:1},status:{type:"string",enum:["pending","in_progress","completed"]},id:{type:"string"}},required:["content","status","id"],additionalProperties:!1},description:"The updated todo list"}},required:["todos"],$schema:"http://json-schema.org/draft-07/schema#"}},j=`
3
+ import{y as A}from"./chunk-RYHMPK5G.js";import{b as C}from"./chunk-R34HYLL4.js";import{g as O,i as S,p as W,q as P}from"./chunk-2ONZZ46N.js";import{Q as T,ba as I}from"./chunk-62AFAL4I.js";import{b as E}from"./chunk-GZPNIYVZ.js";E();import*as h from"fs/promises";import*as f from"fs";import*as u from"path";var R=I("TODO_WRITE"),z={name:"todo_write",description:"Creates and manages a structured task list for your current coding session. This helps track progress, organize complex tasks, and demonstrate thoroughness.",parametersJsonSchema:{type:"object",properties:{todos:{type:"array",items:{type:"object",properties:{content:{type:"string",minLength:1},status:{type:"string",enum:["pending","in_progress","completed"]},id:{type:"string"}},required:["content","status","id"],additionalProperties:!1},description:"The updated todo list"}},required:["todos"],$schema:"http://json-schema.org/draft-07/schema#"}},j=`
4
4
  Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
5
5
  It also helps the user understand the progress of the task and overall progress of their requests.
6
6
 
@@ -1,6 +1,6 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{Ui as V,k as H,l as K,u as x}from"./chunk-JRECUFB3.js";import"./chunk-M53RP3YP.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-2HTPVSGT.js";import"./chunk-MO2HXJG5.js";import"./chunk-2MOGYHWM.js";import"./chunk-S3CWEVTS.js";import"./chunk-TISQNFB5.js";import"./chunk-47XR7IMP.js";import"./chunk-MTMU7JYZ.js";import"./chunk-QKYGQLWC.js";import"./chunk-WV3IUPZS.js";import"./chunk-RNKDFE2S.js";import"./chunk-BVOCFLC4.js";import"./chunk-MCQUPLRE.js";import"./chunk-CZGZ3KK7.js";import"./chunk-HYVP4472.js";import"./chunk-WC2VTVCE.js";import"./chunk-KHHJYBR5.js";import"./chunk-6EQMZNIY.js";import"./chunk-DOOFGSRV.js";import"./chunk-DE3HKC2W.js";import"./chunk-GTVCJCHR.js";import"./chunk-QVCGLQCI.js";import"./chunk-VI74YQQO.js";import"./chunk-YV3PUOBU.js";import"./chunk-3IRGBRSP.js";import"./chunk-DC7LAFZZ.js";import"./chunk-4F4DA5UI.js";import"./chunk-3YLXGE6T.js";import"./chunk-JCE3JAVC.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import{i as S}from"./chunk-6Z2MV7ZY.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-PGXQZVLX.js";import"./chunk-LUNDTQ3G.js";import"./chunk-YRQP3SLC.js";import{g as G,i as X}from"./chunk-6E766NPX.js";import"./chunk-27Q5KW3A.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as d}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";d();d();d();import{homedir as we}from"node:os";d();import{join as R}from"node:path";import{homedir as E}from"node:os";var l="0.5.2",me="https://matilda.maincode.com/assets/computer-use",he="https://github.com/trycua/cua/releases/download";function U(e=process.platform,t=process.arch,o=l){let r=o;if(e==="darwin"){let n=`cua-driver-rs-${r}-${t==="arm64"?"darwin-arm64":"darwin-x86_64"}`;return{asset:`${n}.tar.gz`,extractDir:n,binaryRelPath:"CuaDriver.app/Contents/MacOS/cua-driver",hasApp:!0}}if(e==="linux"){if(t!=="x64")throw new Error(`Computer Use: unsupported Linux arch '${t}' (only x64).`);return{asset:`cua-driver-rs-${r}-linux-x86_64-binary.tar.gz`,extractDir:".",binaryRelPath:"cua-driver",hasApp:!1}}if(e==="win32"){let n=`cua-driver-rs-${r}-${t==="arm64"?"windows-arm64":"windows-x86_64"}`;return{asset:`${n}.zip`,extractDir:n,binaryRelPath:"cua-driver.exe",hasApp:!1}}throw new Error(`Computer Use: unsupported platform '${e}'.`)}function N(e,t=process.env,o=l){let r=[],i=t.MATILDA_COMPUTER_USE_DOWNLOAD_HOST;return i&&r.push(`${ye(i)}/cua-driver-rs/v${o}/${e}`),r.push(`${me}/cua-driver-rs/v${o}/${e}`),r.push(`${he}/cua-driver-rs-v${o}/${e}`),r}function Y(e=process.env,t=l){return N("checksums.txt",e,t)}var fe="MATILDA_COMPUTER_USE_MAX_IMAGE_DIMENSION";function J(e){if(e===void 0||typeof e=="string"&&e.trim()==="")return;let t=typeof e=="number"?e:Number(e);if(!(!Number.isInteger(t)||t<0))return t}function Q(e,t=process.env){let o=J(t[fe]);return o!==void 0?o:J(e)}function ge(e=E()){return R(e,".matilda","computer-use")}function M(e=E(),t=l){return R(ge(e),`cua-driver-rs-${t}`)}function u(e=E(),t=process.platform,o=process.arch,r=l){let i=U(t,o,r);return R(M(e,r),i.extractDir,i.binaryRelPath)}function h(e=l){return`cua-driver-rs@${e}`}function ye(e){return e.endsWith("/")?e.slice(0,-1):e}var f=class e{static singleton;binary;onProgress;maxImageDimension;client;startPromise;constructor(t){this.binary=t.binary,this.onProgress=t.onProgress??(()=>{}),this.maxImageDimension=t.maxImageDimension}setMaxImageDimension(t){this.maxImageDimension=t}static shared(){return e.singleton||(e.singleton=new e({binary:u(we())})),e.singleton}static setSharedForTest(t){e.singleton=t}isStarted(){return this.client!==void 0}async start(t){if(!this.client)return this.startPromise?this.startPromise:(this.startPromise=this.doStart(t).finally(()=>{this.startPromise=void 0}),this.startPromise)}async doStart(t){let o=t??this.onProgress;o("Starting Computer Use driver...");let r=new K({command:this.binary,args:["mcp"],env:x()}),i=new H({name:"matilda-code-computer-use",version:"1.0.0"},{capabilities:{}});await i.connect(r),this.client=i,await this.applyRuntimeConfig(i,o)}async applyRuntimeConfig(t,o){if(this.maxImageDimension!==void 0)try{await t.callTool({name:"set_config",arguments:{max_image_dimension:this.maxImageDimension}})}catch(r){let i=r instanceof Error?r.message:String(r);o(`Computer Use: could not apply max_image_dimension=${this.maxImageDimension} (${i}); using driver default.`)}}async listTools(){if(!this.client)throw new Error("ComputerUseClient not started");return this.client.listTools()}async callTool(t,o){if(!this.client)throw new Error("ComputerUseClient not started");try{return await this.client.callTool({name:t,arguments:o})}catch(r){if(!Z(r))throw r;let i=r;for(let n=0;n<3;n++){if(await this.stop(),await this.start(),!this.client)throw new Error("ComputerUseClient reconnect failed");try{return await this.client.callTool({name:t,arguments:o})}catch(s){if(!Z(s))throw s;i=s,await new Promise(a=>setTimeout(a,1e3))}}throw i}}async stop(){let t=this.client;if(this.client=void 0,t)try{await t.close()}catch{}}};function Z(e){let t=e instanceof Error?e.message:String(e);return/connection closed|not connected|connection refused|daemon transport error|os error 61/i.test(t)}d();var j=["bring_to_front","check_for_update","check_permissions","click","double_click","drag","end_session","get_accessibility_tree","get_agent_cursor_state","get_config","get_cursor_position","get_recording_state","get_screen_size","get_window_state","hotkey","kill_app","launch_app","list_apps","list_windows","move_cursor","page","press_key","replay_trajectory","right_click","scroll","set_agent_cursor_enabled","set_agent_cursor_motion","set_agent_cursor_style","set_config","set_value","start_recording","start_session","stop_recording","type_text","zoom"],g={bring_to_front:{description:'Activate a window so subsequent input tools with `dispatch:"foreground"` land on it without a per-call SetForegroundWindow flash. **Windows-only:** on macOS this tool returns an error pointing to the platform-native `NSRunningApplication.activate` (which the macOS input tools don\'t need because CGEvent.postToPid reaches backgrounded windows). On Linux this tool also stubs out; use `wmctrl -a` or `xdotool windowactivate` if you need explicit activation.',parameterSchema:{additionalProperties:!1,properties:{pid:{type:"integer"},window_id:{type:"integer"}},required:["pid"],type:"object"}},check_for_update:{description:"Check whether a newer cua-driver-rs release is available on GitHub. Returns the current and latest versions, an `update_available` boolean, the install one-liner, and the release notes URL. Read-only \u2014 never installs. Mirror of `cua-driver check-update --json`.",parameterSchema:{additionalProperties:!1,properties:{},type:"object"}},check_permissions:{description:"Report TCC permission status for Accessibility and Screen Recording. By default also raises the system permission dialogs for any missing grants \u2014 Apple's request APIs are no-ops when the grant is already active, so this is safe to call repeatedly. Pass {\"prompt\": false} for a purely read-only status check.\n\nReturns: `accessibility` + `screen_recording` (booleans from the TCC preflight APIs), `screen_recording_capturable` (a live ScreenCaptureKit probe \u2014 if it disagrees with `screen_recording`, the preflight grant belongs to a different process), and `source` (which TCC identity the booleans reflect: the CuaDriver daemon vs the launching terminal/IDE). macOS attributes grants to the responsible process, so a standalone call from a terminal reports the terminal's grants, not the driver's.",parameterSchema:{additionalProperties:!1,properties:{prompt:{description:"Raise the system permission prompts for missing grants. Default true.",type:"boolean"}},type:"object"}},click:{description:`Left-click against a target pid. **Prefer \`element_index\` over pixel coordinates** \u2014 element_index works on backgrounded / minimized / hidden / off-Space windows, surfaces a stable handle that survives rebuilds, and tells you what you're clicking via the cached element's role + label. Reach for \`x, y\` only when the target is a canvas / video / WebGL / custom-drawn surface that doesn't appear in the AX tree.
3
+ import{Ci as V,k as H,l as K,w as x}from"./chunk-SY6JRCN3.js";import"./chunk-M53RP3YP.js";import"./chunk-FCGYRGV4.js";import"./chunk-G4YMVWG4.js";import"./chunk-5YT4GCK7.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-PYZNGIIR.js";import"./chunk-QJJTUDDA.js";import"./chunk-5NMK4Y7C.js";import"./chunk-47XR7IMP.js";import"./chunk-UVWZ44ZW.js";import"./chunk-QKYGQLWC.js";import"./chunk-LHDCAN7Z.js";import"./chunk-V6UPUMP3.js";import"./chunk-RNKDFE2S.js";import"./chunk-VLDZBRTL.js";import"./chunk-RYHMPK5G.js";import"./chunk-JIKQI4MZ.js";import"./chunk-RK4LPGBV.js";import"./chunk-75KP2FVD.js";import"./chunk-7ZODGQO6.js";import"./chunk-TISQNFB5.js";import"./chunk-IIQ5YERM.js";import"./chunk-DC7LAFZZ.js";import"./chunk-LZDHANXA.js";import"./chunk-U7V7APDV.js";import"./chunk-SR7ARGUY.js";import{i as S}from"./chunk-OEZS5R3S.js";import"./chunk-NOE4UNQN.js";import"./chunk-R34HYLL4.js";import"./chunk-EXNHJQCD.js";import{g as G,i as X}from"./chunk-2ONZZ46N.js";import"./chunk-62AFAL4I.js";import"./chunk-36K4HBVM.js";import"./chunk-FWDMPRKU.js";import{b as d}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";d();d();d();import{homedir as we}from"node:os";d();import{join as R}from"node:path";import{homedir as E}from"node:os";var l="0.5.2",me="https://matilda.maincode.com/assets/computer-use",he="https://github.com/trycua/cua/releases/download";function U(e=process.platform,t=process.arch,o=l){let r=o;if(e==="darwin"){let n=`cua-driver-rs-${r}-${t==="arm64"?"darwin-arm64":"darwin-x86_64"}`;return{asset:`${n}.tar.gz`,extractDir:n,binaryRelPath:"CuaDriver.app/Contents/MacOS/cua-driver",hasApp:!0}}if(e==="linux"){if(t!=="x64")throw new Error(`Computer Use: unsupported Linux arch '${t}' (only x64).`);return{asset:`cua-driver-rs-${r}-linux-x86_64-binary.tar.gz`,extractDir:".",binaryRelPath:"cua-driver",hasApp:!1}}if(e==="win32"){let n=`cua-driver-rs-${r}-${t==="arm64"?"windows-arm64":"windows-x86_64"}`;return{asset:`${n}.zip`,extractDir:n,binaryRelPath:"cua-driver.exe",hasApp:!1}}throw new Error(`Computer Use: unsupported platform '${e}'.`)}function N(e,t=process.env,o=l){let r=[],i=t.MATILDA_COMPUTER_USE_DOWNLOAD_HOST;return i&&r.push(`${ye(i)}/cua-driver-rs/v${o}/${e}`),r.push(`${me}/cua-driver-rs/v${o}/${e}`),r.push(`${he}/cua-driver-rs-v${o}/${e}`),r}function Y(e=process.env,t=l){return N("checksums.txt",e,t)}var fe="MATILDA_COMPUTER_USE_MAX_IMAGE_DIMENSION";function J(e){if(e===void 0||typeof e=="string"&&e.trim()==="")return;let t=typeof e=="number"?e:Number(e);if(!(!Number.isInteger(t)||t<0))return t}function Q(e,t=process.env){let o=J(t[fe]);return o!==void 0?o:J(e)}function ge(e=E()){return R(e,".matilda","computer-use")}function M(e=E(),t=l){return R(ge(e),`cua-driver-rs-${t}`)}function u(e=E(),t=process.platform,o=process.arch,r=l){let i=U(t,o,r);return R(M(e,r),i.extractDir,i.binaryRelPath)}function h(e=l){return`cua-driver-rs@${e}`}function ye(e){return e.endsWith("/")?e.slice(0,-1):e}var f=class e{static singleton;binary;onProgress;maxImageDimension;client;startPromise;constructor(t){this.binary=t.binary,this.onProgress=t.onProgress??(()=>{}),this.maxImageDimension=t.maxImageDimension}setMaxImageDimension(t){this.maxImageDimension=t}static shared(){return e.singleton||(e.singleton=new e({binary:u(we())})),e.singleton}static setSharedForTest(t){e.singleton=t}isStarted(){return this.client!==void 0}async start(t){if(!this.client)return this.startPromise?this.startPromise:(this.startPromise=this.doStart(t).finally(()=>{this.startPromise=void 0}),this.startPromise)}async doStart(t){let o=t??this.onProgress;o("Starting Computer Use driver...");let r=new K({command:this.binary,args:["mcp"],env:x()}),i=new H({name:"matilda-code-computer-use",version:"1.0.0"},{capabilities:{}});await i.connect(r),this.client=i,await this.applyRuntimeConfig(i,o)}async applyRuntimeConfig(t,o){if(this.maxImageDimension!==void 0)try{await t.callTool({name:"set_config",arguments:{max_image_dimension:this.maxImageDimension}})}catch(r){let i=r instanceof Error?r.message:String(r);o(`Computer Use: could not apply max_image_dimension=${this.maxImageDimension} (${i}); using driver default.`)}}async listTools(){if(!this.client)throw new Error("ComputerUseClient not started");return this.client.listTools()}async callTool(t,o){if(!this.client)throw new Error("ComputerUseClient not started");try{return await this.client.callTool({name:t,arguments:o})}catch(r){if(!Z(r))throw r;let i=r;for(let n=0;n<3;n++){if(await this.stop(),await this.start(),!this.client)throw new Error("ComputerUseClient reconnect failed");try{return await this.client.callTool({name:t,arguments:o})}catch(s){if(!Z(s))throw s;i=s,await new Promise(a=>setTimeout(a,1e3))}}throw i}}async stop(){let t=this.client;if(this.client=void 0,t)try{await t.close()}catch{}}};function Z(e){let t=e instanceof Error?e.message:String(e);return/connection closed|not connected|connection refused|daemon transport error|os error 61/i.test(t)}d();var j=["bring_to_front","check_for_update","check_permissions","click","double_click","drag","end_session","get_accessibility_tree","get_agent_cursor_state","get_config","get_cursor_position","get_recording_state","get_screen_size","get_window_state","hotkey","kill_app","launch_app","list_apps","list_windows","move_cursor","page","press_key","replay_trajectory","right_click","scroll","set_agent_cursor_enabled","set_agent_cursor_motion","set_agent_cursor_style","set_config","set_value","start_recording","start_session","stop_recording","type_text","zoom"],g={bring_to_front:{description:'Activate a window so subsequent input tools with `dispatch:"foreground"` land on it without a per-call SetForegroundWindow flash. **Windows-only:** on macOS this tool returns an error pointing to the platform-native `NSRunningApplication.activate` (which the macOS input tools don\'t need because CGEvent.postToPid reaches backgrounded windows). On Linux this tool also stubs out; use `wmctrl -a` or `xdotool windowactivate` if you need explicit activation.',parameterSchema:{additionalProperties:!1,properties:{pid:{type:"integer"},window_id:{type:"integer"}},required:["pid"],type:"object"}},check_for_update:{description:"Check whether a newer cua-driver-rs release is available on GitHub. Returns the current and latest versions, an `update_available` boolean, the install one-liner, and the release notes URL. Read-only \u2014 never installs. Mirror of `cua-driver check-update --json`.",parameterSchema:{additionalProperties:!1,properties:{},type:"object"}},check_permissions:{description:"Report TCC permission status for Accessibility and Screen Recording. By default also raises the system permission dialogs for any missing grants \u2014 Apple's request APIs are no-ops when the grant is already active, so this is safe to call repeatedly. Pass {\"prompt\": false} for a purely read-only status check.\n\nReturns: `accessibility` + `screen_recording` (booleans from the TCC preflight APIs), `screen_recording_capturable` (a live ScreenCaptureKit probe \u2014 if it disagrees with `screen_recording`, the preflight grant belongs to a different process), and `source` (which TCC identity the booleans reflect: the CuaDriver daemon vs the launching terminal/IDE). macOS attributes grants to the responsible process, so a standalone call from a terminal reports the terminal's grants, not the driver's.",parameterSchema:{additionalProperties:!1,properties:{prompt:{description:"Raise the system permission prompts for missing grants. Default true.",type:"boolean"}},type:"object"}},click:{description:`Left-click against a target pid. **Prefer \`element_index\` over pixel coordinates** \u2014 element_index works on backgrounded / minimized / hidden / off-Space windows, surfaces a stable handle that survives rebuilds, and tells you what you're clicking via the cached element's role + label. Reach for \`x, y\` only when the target is a canvas / video / WebGL / custom-drawn surface that doesn't appear in the AX tree.
4
4
 
5
5
  Two addressing modes:
6
6
 
@@ -0,0 +1,3 @@
1
+ // Force strict mode and setup for ESM
2
+ "use strict";
3
+ import{c as a,d as b,e as c}from"./chunk-BZB7HYRC.js";import"./chunk-HM5LCKDB.js";import"./chunk-SY6JRCN3.js";import"./chunk-M53RP3YP.js";import"./chunk-FCGYRGV4.js";import"./chunk-G4YMVWG4.js";import"./chunk-5YT4GCK7.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-PYZNGIIR.js";import"./chunk-QJJTUDDA.js";import"./chunk-5NMK4Y7C.js";import"./chunk-47XR7IMP.js";import"./chunk-UVWZ44ZW.js";import"./chunk-QKYGQLWC.js";import"./chunk-LHDCAN7Z.js";import"./chunk-V6UPUMP3.js";import"./chunk-RNKDFE2S.js";import"./chunk-VLDZBRTL.js";import"./chunk-RYHMPK5G.js";import"./chunk-JIKQI4MZ.js";import"./chunk-RK4LPGBV.js";import"./chunk-75KP2FVD.js";import"./chunk-7ZODGQO6.js";import"./chunk-TISQNFB5.js";import"./chunk-IIQ5YERM.js";import"./chunk-DC7LAFZZ.js";import"./chunk-LZDHANXA.js";import"./chunk-U7V7APDV.js";import"./chunk-SR7ARGUY.js";import"./chunk-OEZS5R3S.js";import"./chunk-NOE4UNQN.js";import"./chunk-R34HYLL4.js";import"./chunk-EXNHJQCD.js";import"./chunk-2ONZZ46N.js";import"./chunk-62AFAL4I.js";import"./chunk-36K4HBVM.js";import"./chunk-FWDMPRKU.js";import"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";export{a as collectContextData,c as contextCommand,b as formatContextUsageText};
@@ -1,6 +1,6 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{a as p,c as f}from"./chunk-TXMXCR7D.js";import{a as y}from"./chunk-YULUB745.js";import{a as n}from"./chunk-2HTPVSGT.js";import"./chunk-TISQNFB5.js";import"./chunk-LUNDTQ3G.js";import{g as m,i as c,p as d,q as h}from"./chunk-6E766NPX.js";import"./chunk-27Q5KW3A.js";import"./chunk-FWDMPRKU.js";import{b as u}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";u();var i=class extends m{constructor(e,t){super(t);this.config=e}getDescription(){return`${this.params.cron}: ${this.params.prompt}`}async getDefaultPermission(){return"ask"}async execute(){let e=this.config.getCronScheduler(),t=this.params.recurring!==!1,s=this.params.durable===!0;try{p(this.params.cron),f(this.params.cron,new Date);let r=s?await e.createDurable(this.params.cron,this.params.prompt,t):e.create(this.params.cron,this.params.prompt,t),o=y(r.cronExpr),w=`Scheduled ${r.id} (${o})${s?" [durable]":""}`,l=s?`Persisted to ${n}`:"Session-only (not written to disk, dies when Matilda exits)";return{llmContent:t?`Scheduled recurring job ${r.id} (${r.cronExpr}). ${l}. Auto-expires after 7 days. Use CronDelete to cancel sooner.`:`Scheduled one-shot task ${r.id} (${r.cronExpr}). ${l}. It will fire once then auto-delete.`,returnDisplay:w}}catch(r){let o=r instanceof Error?r.message:String(r);return{llmContent:`Error creating cron job: ${o}`,returnDisplay:o,error:{message:o}}}}},g=class a extends c{constructor(e){super(a.Name,h.CRON_CREATE,`Schedule a prompt to be enqueued at a future time. Use for both recurring schedules and one-shot reminders.
3
+ import{a as p,c as f}from"./chunk-TXMXCR7D.js";import{a as y}from"./chunk-YULUB745.js";import{a as n}from"./chunk-PYZNGIIR.js";import"./chunk-TISQNFB5.js";import"./chunk-R34HYLL4.js";import{g as m,i as c,p as d,q as h}from"./chunk-2ONZZ46N.js";import"./chunk-62AFAL4I.js";import"./chunk-FWDMPRKU.js";import{b as u}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";u();var i=class extends m{constructor(e,t){super(t);this.config=e}getDescription(){return`${this.params.cron}: ${this.params.prompt}`}async getDefaultPermission(){return"ask"}async execute(){let e=this.config.getCronScheduler(),t=this.params.recurring!==!1,s=this.params.durable===!0;try{p(this.params.cron),f(this.params.cron,new Date);let r=s?await e.createDurable(this.params.cron,this.params.prompt,t):e.create(this.params.cron,this.params.prompt,t),o=y(r.cronExpr),w=`Scheduled ${r.id} (${o})${s?" [durable]":""}`,l=s?`Persisted to ${n}`:"Session-only (not written to disk, dies when Matilda exits)";return{llmContent:t?`Scheduled recurring job ${r.id} (${r.cronExpr}). ${l}. Auto-expires after 7 days. Use CronDelete to cancel sooner.`:`Scheduled one-shot task ${r.id} (${r.cronExpr}). ${l}. It will fire once then auto-delete.`,returnDisplay:w}}catch(r){let o=r instanceof Error?r.message:String(r);return{llmContent:`Error creating cron job: ${o}`,returnDisplay:o,error:{message:o}}}}},g=class a extends c{constructor(e){super(a.Name,h.CRON_CREATE,`Schedule a prompt to be enqueued at a future time. Use for both recurring schedules and one-shot reminders.
4
4
 
5
5
  Uses standard 5-field cron in the user's local timezone: minute hour day-of-month month day-of-week. "0 9 * * *" means 9am local \u2014 no timezone conversion needed.
6
6
 
@@ -1,3 +1,3 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{a as d,f as u}from"./chunk-2HTPVSGT.js";import"./chunk-TISQNFB5.js";import"./chunk-LUNDTQ3G.js";import{g as l,i as c,p as m,q as p}from"./chunk-6E766NPX.js";import{d as n}from"./chunk-27Q5KW3A.js";import"./chunk-FWDMPRKU.js";import{b as i}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";i();var s=class extends l{constructor(r,o){super(o);this.config=r}getDescription(){return this.params.id}async execute(){let r=this.config.getCronScheduler(),o;try{o=await r.delete(this.params.id),o||(o=await u(this.config.getProjectRoot(),[this.params.id])>0)}catch(e){let t=`Failed to cancel job ${this.params.id}: ${n(e)}`;return{llmContent:t,returnDisplay:t,error:{message:t}}}if(o){let e=`Cancelled job ${this.params.id}.`,t=`Cancelled ${this.params.id}`;return{llmContent:e,returnDisplay:t}}else{let e=`Job ${this.params.id} not found.`;return{llmContent:e,returnDisplay:e,error:{message:e}}}}},f=class a extends c{constructor(r){super(a.Name,p.CRON_DELETE,`Cancel a cron job previously scheduled with CronCreate. Removes it from the in-memory session store or from ${d} (durable jobs).`,"other",{type:"object",properties:{id:{type:"string",description:"Job ID returned by CronCreate."}},required:["id"],additionalProperties:!1},!0,!1,!0,!1,"cron delete cancel remove");this.config=r}static Name=m.CRON_DELETE;createInvocation(r){return new s(this.config,r)}};export{f as CronDeleteTool};
3
+ import{a as d,f as u}from"./chunk-PYZNGIIR.js";import"./chunk-TISQNFB5.js";import"./chunk-R34HYLL4.js";import{g as l,i as c,p as m,q as p}from"./chunk-2ONZZ46N.js";import{d as n}from"./chunk-62AFAL4I.js";import"./chunk-FWDMPRKU.js";import{b as i}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";i();var s=class extends l{constructor(r,o){super(o);this.config=r}getDescription(){return this.params.id}async execute(){let r=this.config.getCronScheduler(),o;try{o=await r.delete(this.params.id),o||(o=await u(this.config.getProjectRoot(),[this.params.id])>0)}catch(e){let t=`Failed to cancel job ${this.params.id}: ${n(e)}`;return{llmContent:t,returnDisplay:t,error:{message:t}}}if(o){let e=`Cancelled job ${this.params.id}.`,t=`Cancelled ${this.params.id}`;return{llmContent:e,returnDisplay:t}}else{let e=`Job ${this.params.id} not found.`;return{llmContent:e,returnDisplay:e,error:{message:e}}}}},f=class a extends c{constructor(r){super(a.Name,p.CRON_DELETE,`Cancel a cron job previously scheduled with CronCreate. Removes it from the in-memory session store or from ${d} (durable jobs).`,"other",{type:"object",properties:{id:{type:"string",description:"Job ID returned by CronCreate."}},required:["id"],additionalProperties:!1},!0,!1,!0,!1,"cron delete cancel remove");this.config=r}static Name=m.CRON_DELETE;createInvocation(r){return new s(this.config,r)}};export{f as CronDeleteTool};
@@ -1,5 +1,5 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{a as m}from"./chunk-YULUB745.js";import{a as d,c as g}from"./chunk-2HTPVSGT.js";import"./chunk-TISQNFB5.js";import"./chunk-LUNDTQ3G.js";import{g as l,i as c,p,q as u}from"./chunk-6E766NPX.js";import"./chunk-27Q5KW3A.js";import"./chunk-FWDMPRKU.js";import{b as a}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";a();var s=class extends l{constructor(e,t){super(t);this.config=e}getDescription(){return""}async execute(){let e=this.config.getCronScheduler(),t;try{t=await g(this.config.getProjectRoot())}catch(r){let o=r instanceof Error?r.message:String(r);return{llmContent:`Error listing cron jobs: ${o}`,returnDisplay:o,error:{message:o}}}let n=[...t.map(r=>({id:r.id,cron:r.cron,prompt:r.prompt,recurring:r.recurring,durable:!0})),...e.list().filter(r=>!r.durable).map(r=>({id:r.id,cron:r.cronExpr,prompt:r.prompt,recurring:r.recurring,durable:!1}))];if(n.length===0){let r="No active cron jobs.";return{llmContent:r,returnDisplay:r}}let y=n.map(r=>{let o=r.recurring?"recurring":"one-shot",h=r.durable?"durable":"session-only";return`${r.id} \u2014 ${r.cron} (${o}) [${h}]: ${r.prompt}`}).join(`
3
+ import{a as m}from"./chunk-YULUB745.js";import{a as d,c as g}from"./chunk-PYZNGIIR.js";import"./chunk-TISQNFB5.js";import"./chunk-R34HYLL4.js";import{g as l,i as c,p,q as u}from"./chunk-2ONZZ46N.js";import"./chunk-62AFAL4I.js";import"./chunk-FWDMPRKU.js";import{b as a}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";a();var s=class extends l{constructor(e,t){super(t);this.config=e}getDescription(){return""}async execute(){let e=this.config.getCronScheduler(),t;try{t=await g(this.config.getProjectRoot())}catch(r){let o=r instanceof Error?r.message:String(r);return{llmContent:`Error listing cron jobs: ${o}`,returnDisplay:o,error:{message:o}}}let n=[...t.map(r=>({id:r.id,cron:r.cron,prompt:r.prompt,recurring:r.recurring,durable:!0})),...e.list().filter(r=>!r.durable).map(r=>({id:r.id,cron:r.cronExpr,prompt:r.prompt,recurring:r.recurring,durable:!1}))];if(n.length===0){let r="No active cron jobs.";return{llmContent:r,returnDisplay:r}}let y=n.map(r=>{let o=r.recurring?"recurring":"one-shot",h=r.durable?"durable":"session-only";return`${r.id} \u2014 ${r.cron} (${o}) [${h}]: ${r.prompt}`}).join(`
4
4
  `),T=n.map(r=>`${r.id} ${m(r.cron)} [${r.durable?"durable":"session-only"}]`).join(`
5
5
  `);return{llmContent:y,returnDisplay:T}}},f=class i extends c{constructor(e){super(i.Name,u.CRON_LIST,`List all cron jobs scheduled via CronCreate, both session-only and durable (${d}).`,"other",{type:"object",properties:{},additionalProperties:!1},!0,!1,!0,!1,"cron list scheduled jobs");this.config=e}static Name=p.CRON_LIST;createInvocation(e){return new s(this.config,e)}};export{f as CronListTool};