vibe64 0.1.59 → 0.1.61

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 (204) hide show
  1. package/bin/run.js +1228 -1210
  2. package/bin/server.js +392 -376
  3. package/bin/upgrade-state.js +4457 -4430
  4. package/dist/assets/{GithubBrowserTabs-D_nMB5Y1.js → GithubBrowserTabs-DAgQxPXI.js} +1 -1
  5. package/dist/assets/{LocalDatabaseServer-BgO_aeUg.js → LocalDatabaseServer-m1G8ZS5i.js} +1 -1
  6. package/dist/assets/SelectField-DwWoHC2p.js +1 -0
  7. package/dist/assets/{ShellOutlet-Cr8SJs7s.js → ShellOutlet-CdjsJfg9.js} +1 -1
  8. package/dist/assets/Vibe64AuthSettingsButton-D3sB4BfM.js +5 -0
  9. package/dist/assets/{Vibe64AuthSettingsButton-DRTKdimW.css → Vibe64AuthSettingsButton-DFfFPrd7.css} +1 -1
  10. package/dist/assets/{Vibe64ConversationLog-DtOgxPNR.js → Vibe64ConversationLog-B-L5QsVr.js} +4 -4
  11. package/dist/assets/{Vibe64ConversationLog-NH61odld.css → Vibe64ConversationLog-ksf1U6PP.css} +1 -1
  12. package/dist/assets/{Vibe64DashboardShell-DhPE6H3P.js → Vibe64DashboardShell-CMzX3wRM.js} +1 -1
  13. package/dist/assets/{Vibe64DashboardShell-Bpnbjs4l.css → Vibe64DashboardShell-D0GNI4V8.css} +1 -1
  14. package/dist/assets/{Vibe64DatabaseWorkspace-cfn8TTxQ.css → Vibe64DatabaseWorkspace-De4sbXAN.css} +1 -1
  15. package/dist/assets/{Vibe64DatabaseWorkspace-CHV0cd3l.js → Vibe64DatabaseWorkspace-Dewhs6_T.js} +2 -2
  16. package/dist/assets/Vibe64DestinationButton-CdyyK9tj.js +1 -0
  17. package/dist/assets/Vibe64DestinationButton-ZxY1Lwie.css +1 -0
  18. package/dist/assets/Vibe64FileArea-DluZTu-c.js +1 -0
  19. package/dist/assets/{Vibe64FileArea-mydNQQl8.css → Vibe64FileArea-ZEzsvLt2.css} +1 -1
  20. package/dist/assets/Vibe64OutputControls-BfbdD25Y.js +8 -0
  21. package/dist/assets/{Vibe64RepositoryWorkspace-DUSMn4pR.js → Vibe64RepositoryWorkspace-CBsySPXN.js} +1 -1
  22. package/dist/assets/{Vibe64SessionFiles-BXt__PJL.js → Vibe64SessionFiles--wtVe_KC.js} +1 -1
  23. package/dist/assets/{Vibe64SessionSourceEditor-NyG6niQM.js → Vibe64SessionSourceEditor-BouH4fXC.js} +1 -1
  24. package/dist/assets/Vibe64UiStoryboardView--E04EEF8.js +8 -0
  25. package/dist/assets/{Vibe64UiStoryboardView-CtlJWiCY.css → Vibe64UiStoryboardView-DqLN6ofL.css} +1 -1
  26. package/dist/assets/{Vibe64UnavailableSessions-CCPWJo8e.js → Vibe64UnavailableSessions-94bFpxMK.js} +1 -1
  27. package/dist/assets/_pageId_-Ch4OpUkd.js +1 -0
  28. package/dist/assets/_sessionId_-7PyIUeUr.css +1 -0
  29. package/dist/assets/_sessionId_-DGT4d2La.js +1 -0
  30. package/dist/assets/{_sessionTool_-CKPNp5fF.js → _sessionTool_-CBf51mfK.js} +1 -1
  31. package/dist/assets/_sessionTool_-DiYoi-BF.css +1 -0
  32. package/dist/assets/_slug_-C8VNMRVH.js +14 -0
  33. package/dist/assets/_slug_-CZmGS16g.css +1 -0
  34. package/dist/assets/access-BAOx4iCS.js +1 -0
  35. package/dist/assets/access-BH1OsqPS.css +1 -0
  36. package/dist/assets/{app-D9FegZf0.js → app-Bs6-Hv23.js} +1 -1
  37. package/dist/assets/{assistantRouting-D4SnnxJn.js → assistantRouting-BS0ZW5Ki.js} +1 -1
  38. package/dist/assets/{changes-DtfJc780.js → changes-C6eMQ9YE.js} +1 -1
  39. package/dist/assets/{client-CUQfIUus.css → client-BBJzQIWS.css} +1 -1
  40. package/dist/assets/{client-BBqNv4HL.js → client-CIF5Y1Aj.js} +1 -1
  41. package/dist/assets/{client-B8u2_Svv.css → client-CM6TGZc9.css} +1 -1
  42. package/dist/assets/{client-DnjkdG6K.js → client-CVgL_ShV.js} +1 -1
  43. package/dist/assets/{client-DuDOzb5A.js → client-HWj_BNVZ.js} +2 -2
  44. package/dist/assets/{client-Dra4Vp3A.js → client-qAKnahkF.js} +2 -2
  45. package/dist/assets/{client-mU-LObHG.js → client-qpL_kR4u.js} +2 -2
  46. package/dist/assets/{conversation-QpMeXw70.js → conversation-DbF0OrZB.js} +3 -3
  47. package/dist/assets/{conversation-La-pkh5h.css → conversation-ZN3-8jbz.css} +1 -1
  48. package/dist/assets/{dashboard-B26QwE6y.js → dashboard-CzLsa0w0.js} +1 -1
  49. package/dist/assets/{english-definitions-I9tIXY2u.js → english-definitions-BA8v5wP1.js} +1 -1
  50. package/dist/assets/{env-BXsvM592.js → env-BqJ_GWbz.js} +1 -1
  51. package/dist/assets/{error-kdRkyK9x.js → error-BQ7r64JO.js} +1 -1
  52. package/dist/assets/{error-CX8_snYL.js → error-BqMxhgpB.js} +1 -1
  53. package/dist/assets/errorMessageHelpers-BjIt31kK.js +1 -0
  54. package/dist/assets/{errors-DErd0NON.js → errors-D17nJYne.js} +1 -1
  55. package/dist/assets/{health-C4WtefLm.js → health-CIqrHpVK.js} +1 -1
  56. package/dist/assets/history-BCjhpyP8.js +1 -0
  57. package/dist/assets/history-BSIuLgnI.css +1 -0
  58. package/dist/assets/{httpClient-BRO3GqjU.js → httpClient-Bwitq9Xf.js} +1 -1
  59. package/dist/assets/i18n-BkxO7BMl.js +1 -0
  60. package/dist/assets/{i18n-B5lc019_.js → i18n-Dm74yE_M.js} +1 -1
  61. package/dist/assets/index-Ctygjyf8.css +1 -0
  62. package/dist/assets/index-fXKdz8oR.js +134 -0
  63. package/dist/assets/{integrations-CrI893NK.css → integrations-CwgrZgmM.css} +1 -1
  64. package/dist/assets/{integrations-CQNJxkMu.js → integrations-cgbpgNNd.js} +12 -5
  65. package/dist/assets/issues-AhouA6nE.js +1 -0
  66. package/dist/assets/issues-D46llNv-.css +1 -0
  67. package/dist/assets/{learning-0cINHUSN.js → learning-DZXWgVEW.js} +1 -1
  68. package/dist/assets/{pages-DbF-yXqO.js → pages-5jaEclQo.js} +1 -1
  69. package/dist/assets/{pages-CIKw99GN.js → pages-BUUwIXBf.js} +1 -1
  70. package/dist/assets/{pathname-DOqQPPVa.js → pathname-JHQIKk21.js} +1 -1
  71. package/dist/assets/{placement-BAaZQhAh.js → placement-1lT0lW3-.js} +1 -1
  72. package/dist/assets/{placement-Lk1Lpy6s.js → placement-B2V88UDJ.js} +1 -1
  73. package/dist/assets/{project-files-CklWobqZ.js → project-files-BS2gdDSz.js} +1 -1
  74. package/dist/assets/publish-Bq_LPmX2.js +3 -0
  75. package/dist/assets/{publish-DOybV3Qz.css → publish-C9O0tDPB.css} +1 -1
  76. package/dist/assets/pull-requests-BvChbjCD.js +1 -0
  77. package/dist/assets/pull-requests-DtqrTix0.css +1 -0
  78. package/dist/assets/{repository-wJZei_NJ.js → repository-Dkow-18G.js} +1 -1
  79. package/dist/assets/settings-BKZcbISO.css +1 -0
  80. package/dist/assets/settings-r5RWQVzw.js +1 -0
  81. package/dist/assets/{shared-X5MxTHwl.js → shared-B6plZPQ_.js} +1 -1
  82. package/dist/assets/{studioGateApi-CHIdcQvD.js → studioGateApi-UqmdV50W.js} +1 -1
  83. package/dist/assets/{studioUrls-oIU1Eq_t.js → studioUrls-k_pQIuPs.js} +1 -1
  84. package/dist/assets/useArchivedVibe64Sessions-C0MVJuyX.js +1 -0
  85. package/dist/assets/useAssistantAttachments-BkYZckgz.js +2 -0
  86. package/dist/assets/useCommand-CNDe8gM-.js +1 -0
  87. package/dist/assets/{useEndpointResource-61E93qP-.js → useEndpointResource-CmMwteuX.js} +1 -1
  88. package/dist/assets/{usePaths-B-QGqa_I.js → usePaths-CvUbx5-V.js} +1 -1
  89. package/dist/assets/{useUiFeedback-CycH_fvY.js → useUiFeedback-CWb6o71Z.js} +1 -1
  90. package/dist/assets/useVibe64ConversationLog-CUWEZhnf.js +2 -0
  91. package/dist/assets/{useVibe64Learning-DZCyrfpy.js → useVibe64Learning-RE4HXHqo.js} +1 -1
  92. package/dist/assets/{useVibe64SessionData-rBvWMqyc.js → useVibe64SessionData-kGr7R7lG.js} +1 -1
  93. package/dist/assets/{useVibe64SessionSelection-C546mBu8.js → useVibe64SessionSelection-BZ7WnRv0.js} +1 -1
  94. package/dist/assets/validators-HqYRjxEO.js +1 -0
  95. package/dist/assets/{vibe64FileUpload-D0Lv2mMJ.js → vibe64FileUpload-BDkcaUyk.js} +1 -1
  96. package/dist/assets/vibe64GithubProject-CJneIo5O.js +1 -0
  97. package/dist/assets/vibe64RepositoryRealtime-R5QhcJ4H.js +1 -0
  98. package/dist/assets/vibe64SessionFocus-BCojr4E-.css +1 -0
  99. package/dist/assets/vibe64SessionFocus-CHKCMxcJ.js +1 -0
  100. package/dist/index.html +29 -27
  101. package/docs/colleague-usage/ai-tasks.md +15 -4
  102. package/docs/colleague-usage/back-navigation.md +16 -13
  103. package/docs/colleague-usage/coding-agent-goal-pause.md +15 -1
  104. package/docs/colleague-usage/coding-agent-goals.md +23 -3
  105. package/docs/colleague-usage/coding-agent-recovery.md +3 -1
  106. package/docs/colleague-usage/coding-agents.md +19 -1
  107. package/docs/colleague-usage/colleague-watches.md +1 -1
  108. package/docs/colleague-usage/connected-projects.md +1 -1
  109. package/docs/colleague-usage/connected-repositories.md +16 -4
  110. package/docs/colleague-usage/dashboard-navigation.md +14 -11
  111. package/docs/colleague-usage/database.md +1 -1
  112. package/docs/colleague-usage/development-env.md +21 -12
  113. package/docs/colleague-usage/files.md +2 -1
  114. package/docs/colleague-usage/github-work.md +51 -12
  115. package/docs/colleague-usage/health-checks.md +1 -1
  116. package/docs/colleague-usage/integrations.md +2 -2
  117. package/docs/colleague-usage/learning-teacher-guide.md +3 -2
  118. package/docs/colleague-usage/pages.md +1 -2
  119. package/docs/colleague-usage/preview-browser-checks.md +3 -0
  120. package/docs/colleague-usage/preview.md +29 -0
  121. package/docs/colleague-usage/project-messages.md +4 -3
  122. package/docs/colleague-usage/project-settings.md +3 -0
  123. package/docs/colleague-usage/session-archive.md +11 -0
  124. package/docs/colleague-usage/sessions.md +8 -7
  125. package/docs/colleague-usage/temporary-chats.md +4 -3
  126. package/docs/colleague-usage/ui-pass.md +1 -1
  127. package/docs/colleague-usage/usage-map.md +3 -2
  128. package/docs/colleague-usage/workspace-preparation.md +12 -0
  129. package/node_modules/@jskit-ai/agent/CHANGELOG.md +5 -0
  130. package/node_modules/@jskit-ai/agent/package.json +1 -1
  131. package/node_modules/@jskit-ai/assistant-core/CHANGELOG.md +8 -0
  132. package/node_modules/@jskit-ai/assistant-core/locales/en.json +4 -1
  133. package/node_modules/@jskit-ai/assistant-core/package.json +1 -1
  134. package/node_modules/@jskit-ai/assistant-runtime/CHANGELOG.md +4 -0
  135. package/node_modules/@jskit-ai/assistant-runtime/package.json +1 -1
  136. package/node_modules/@jskit-ai/assistant-voice/package.json +1 -1
  137. package/node_modules/@jskit-ai/connector-google-calendar/CHANGELOG.md +4 -0
  138. package/node_modules/@jskit-ai/connector-google-calendar/package.json +1 -1
  139. package/node_modules/@jskit-ai/connectors-catalog/CHANGELOG.md +1 -0
  140. package/node_modules/@jskit-ai/connectors-catalog/package.json +1 -1
  141. package/node_modules/@jskit-ai/connectors-core/CHANGELOG.md +2 -0
  142. package/node_modules/@jskit-ai/connectors-core/README.md +4 -0
  143. package/node_modules/@jskit-ai/connectors-core/package.json +1 -1
  144. package/node_modules/@jskit-ai/http-runtime/CHANGELOG.md +1 -0
  145. package/node_modules/@jskit-ai/http-runtime/package.json +1 -1
  146. package/node_modules/@jskit-ai/kernel/CHANGELOG.md +8 -0
  147. package/node_modules/@jskit-ai/kernel/package.json +3 -1
  148. package/node_modules/@jskit-ai/payments-core/CHANGELOG.md +1 -0
  149. package/node_modules/@jskit-ai/payments-core/locales/en.json +2 -1
  150. package/node_modules/@jskit-ai/payments-core/package.json +1 -1
  151. package/node_modules/@jskit-ai/realtime/CHANGELOG.md +1 -0
  152. package/node_modules/@jskit-ai/realtime/package.json +1 -1
  153. package/node_modules/@jskit-ai/resource-core/CHANGELOG.md +1 -0
  154. package/node_modules/@jskit-ai/resource-core/package.json +1 -1
  155. package/node_modules/@jskit-ai/uploads-runtime/package.json +1 -1
  156. package/node_modules/@local/vibe64-ai-tasks/package.json +2 -1
  157. package/node_modules/@local/vibe64-execution/src/host/execHelper.js +463 -442
  158. package/node_modules/@local/vibe64-genesis/bin/genesis +17 -11
  159. package/node_modules/@local/vibe64-genesis/bin/vibe64-genesis-host-context +827 -813
  160. package/node_modules/@local/vibe64-genesis/src/server/agentSpecs.js +93 -67
  161. package/node_modules/@local/vibe64-genesis/src/server/index.js +608 -584
  162. package/node_modules/@local/vibe64-genesis/src/server/promptContext.js +180 -175
  163. package/node_modules/@local/vibe64-runtime/src/server/codexAppServerProcess.js +490 -479
  164. package/node_modules/@local/vibe64-source-editor/src/server/searchIndexWorker.js +12 -11
  165. package/node_modules/@local/vibe64-system-graph/README.md +9 -5
  166. package/node_modules/@local/vibe64-terminals/src/server/opencodeSessionEnvironmentPlugin.js +262 -252
  167. package/node_modules/@local/vibe64-terminals/src/server/sessionWorkOperationCommand.js +1026 -981
  168. package/node_modules/json-rest-schema/README.md +3 -1
  169. package/node_modules/json-rest-schema/package.json +1 -1
  170. package/package.json +17 -17
  171. package/server.bundle.mjs +43244 -42953
  172. package/dist/assets/Vibe64AuthSettingsButton-Bx9patil.js +0 -5
  173. package/dist/assets/Vibe64FileArea-DIDyAUvD.js +0 -1
  174. package/dist/assets/Vibe64OutputControls-mNWUWLSm.js +0 -8
  175. package/dist/assets/Vibe64UiStoryboardView-BXH2MSWn.js +0 -8
  176. package/dist/assets/_pageId_-D54CqzqG.js +0 -1
  177. package/dist/assets/_sessionId_-B5V2Fs2n.css +0 -1
  178. package/dist/assets/_sessionId_-CW044RVi.js +0 -1
  179. package/dist/assets/_sessionTool_-Be88HWbv.css +0 -1
  180. package/dist/assets/_slug_-CRtFhc0A.js +0 -14
  181. package/dist/assets/_slug_-WWvJTLoc.css +0 -1
  182. package/dist/assets/access-ChMLRErk.js +0 -1
  183. package/dist/assets/access-Cm2lrMF6.css +0 -1
  184. package/dist/assets/errorMessageHelpers-L2GsOwCP.js +0 -1
  185. package/dist/assets/history-BhqQz5jH.css +0 -1
  186. package/dist/assets/history-HHPFoNi3.js +0 -1
  187. package/dist/assets/index-BBfSvf2i.css +0 -1
  188. package/dist/assets/index-Bvd00puv.js +0 -134
  189. package/dist/assets/issues-BHr_nI-9.js +0 -1
  190. package/dist/assets/issues-CpBRQTQ_.css +0 -1
  191. package/dist/assets/publish-Cot797YN.js +0 -3
  192. package/dist/assets/pull-requests-DnEm9m_1.css +0 -1
  193. package/dist/assets/pull-requests-ybnixBv0.js +0 -1
  194. package/dist/assets/settings-DJByC5Wb.js +0 -1
  195. package/dist/assets/settings-bEkDjn0Y.css +0 -1
  196. package/dist/assets/useArchivedVibe64Sessions-B-DtXrk-.js +0 -1
  197. package/dist/assets/useAssistantAttachments-CkseokGM.js +0 -2
  198. package/dist/assets/useCommand-D96utlVe.js +0 -1
  199. package/dist/assets/useVibe64ConversationLog-BVANhCHq.js +0 -2
  200. package/dist/assets/validators-B3YzM6px.js +0 -1
  201. package/dist/assets/vibe64GithubProject-DNl0aDcC.js +0 -1
  202. package/dist/assets/vibe64RepositoryRealtime-BPsE5l5E.js +0 -1
  203. package/dist/assets/vibe64SessionFocus-CxX2nK6F.js +0 -1
  204. package/dist/assets/vibe64SessionFocus-DW73PN_o.css +0 -1
@@ -1,25 +1,25 @@
1
1
  import { createRequire as __vibe64CreateRequire } from 'node:module';const require=__vibe64CreateRequire(import.meta.url);
2
- var ss=Object.create;var Nr=Object.defineProperty;var is=Object.getOwnPropertyDescriptor;var as=Object.getOwnPropertyNames;var cs=Object.getPrototypeOf,us=Object.prototype.hasOwnProperty;var $=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){
3
- if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var W=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}};var ls=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of as(e))!us.call(t,o)&&o!==r&&Nr(t,o,{get:()=>e[o],
4
- enumerable:!(n=is(e,o))||n.enumerable});return t};var le=(t,e,r)=>(r=t!=null?ss(cs(t)):{},ls(e||!t||!t.__esModule?Nr(r,"default",{value:t,enumerable:!0}):r,t));var ie=W((Il,on)=>{"use strict";var rn=["nodebuffer","arraybuffer","fragments"],nn=typeof Blob<"u";nn&&rn.push("blob");on.
5
- exports={BINARY_TYPES:rn,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:nn,
2
+ var us=Object.create;var Mr=Object.defineProperty;var ls=Object.getOwnPropertyDescriptor;var ds=Object.getOwnPropertyNames;var fs=Object.getPrototypeOf,ps=Object.prototype.hasOwnProperty;var U=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){
3
+ if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var W=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}};var hs=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ds(e))!ps.call(t,o)&&o!==r&&Mr(t,o,{get:()=>e[o],
4
+ enumerable:!(n=ls(e,o))||n.enumerable});return t};var le=(t,e,r)=>(r=t!=null?us(fs(t)):{},hs(e||!t||!t.__esModule?Mr(r,"default",{value:t,enumerable:!0}):r,t));var ie=W((Nl,cn)=>{"use strict";var sn=["nodebuffer","arraybuffer","fragments"],an=typeof Blob<"u";an&&sn.push("blob");cn.
5
+ exports={BINARY_TYPES:sn,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:an,
6
6
  kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol(
7
- "websocket"),NOOP:()=>{}}});var Le=W((Rl,Ze)=>{"use strict";var{EMPTY_BUFFER:Ks}=ie(),$t=Buffer[Symbol.species];function Ys(t,e){if(t.length===0)return Ks;
7
+ "websocket"),NOOP:()=>{}}});var Le=W((kl,Ze)=>{"use strict";var{EMPTY_BUFFER:ei}=ie(),zt=Buffer[Symbol.species];function ti(t,e){if(t.length===0)return ei;
8
8
  if(t.length===1)return t[0];let r=Buffer.allocUnsafe(e),n=0;for(let o=0;o<t.length;o++){let s=t[o];r.set(s,n),n+=s.length}
9
- return n<e?new $t(r.buffer,r.byteOffset,n):r}function sn(t,e,r,n,o){for(let s=0;s<o;s++)r[n+s]=t[s]^e[s&3]}function an(t,e){
10
- for(let r=0;r<t.length;r++)t[r]^=e[r&3]}function Qs(t){return t.length===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,
11
- t.byteOffset+t.length)}function zt(t){if(zt.readOnly=!0,Buffer.isBuffer(t))return t;let e;return t instanceof ArrayBuffer?
12
- e=new $t(t):ArrayBuffer.isView(t)?e=new $t(t.buffer,t.byteOffset,t.byteLength):(e=Buffer.from(t),zt.readOnly=!1),e}Ze.exports=
13
- {concat:Ys,mask:sn,toArrayBuffer:Qs,toBuffer:zt,unmask:an};if(!process.env.WS_NO_BUFFER_UTIL)try{let t=$("bufferutil");Ze.
14
- exports.mask=function(e,r,n,o,s){s<48?sn(e,r,n,o,s):t.mask(e,r,n,o,s)},Ze.exports.unmask=function(e,r){e.length<32?an(e,
15
- r):t.unmask(e,r)}}catch{}});var ln=W((Nl,un)=>{"use strict";var cn=Symbol("kDone"),Bt=Symbol("kRun"),Vt=class{constructor(e){this[cn]=()=>{this.pending--,
16
- this[Bt]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[Bt]()}[Bt](){if(this.pending!==
17
- this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[cn])}}};un.exports=Vt});var ve=W((kl,hn)=>{"use strict";var Ue=$("zlib"),dn=Le(),Zs=ln(),{kStatusCode:fn}=ie(),ei=Buffer[Symbol.species],ti=Buffer.
9
+ return n<e?new zt(r.buffer,r.byteOffset,n):r}function un(t,e,r,n,o){for(let s=0;s<o;s++)r[n+s]=t[s]^e[s&3]}function ln(t,e){
10
+ for(let r=0;r<t.length;r++)t[r]^=e[r&3]}function ri(t){return t.length===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,
11
+ t.byteOffset+t.length)}function Bt(t){if(Bt.readOnly=!0,Buffer.isBuffer(t))return t;let e;return t instanceof ArrayBuffer?
12
+ e=new zt(t):ArrayBuffer.isView(t)?e=new zt(t.buffer,t.byteOffset,t.byteLength):(e=Buffer.from(t),Bt.readOnly=!1),e}Ze.exports=
13
+ {concat:ti,mask:un,toArrayBuffer:ri,toBuffer:Bt,unmask:ln};if(!process.env.WS_NO_BUFFER_UTIL)try{let t=U("bufferutil");Ze.
14
+ exports.mask=function(e,r,n,o,s){s<48?un(e,r,n,o,s):t.mask(e,r,n,o,s)},Ze.exports.unmask=function(e,r){e.length<32?ln(e,
15
+ r):t.unmask(e,r)}}catch{}});var pn=W((jl,fn)=>{"use strict";var dn=Symbol("kDone"),Vt=Symbol("kRun"),Ht=class{constructor(e){this[dn]=()=>{this.pending--,
16
+ this[Vt]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[Vt]()}[Vt](){if(this.pending!==
17
+ this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[dn])}}};fn.exports=Ht});var ve=W((Ml,yn)=>{"use strict";var $e=U("zlib"),hn=Le(),ni=pn(),{kStatusCode:mn}=ie(),oi=Buffer[Symbol.species],si=Buffer.
18
18
  from([0,0,255,255]),tt=Symbol("permessage-deflate"),ae=Symbol("total-length"),xe=Symbol("callback"),de=Symbol("buffers"),
19
- Oe=Symbol("error"),et,Ht=class{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold!==void 0?this.
19
+ Oe=Symbol("error"),et,Ft=class{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold!==void 0?this.
20
20
  _options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=
21
21
  null,this._inflate=null,this.params=null,!et){let r=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:
22
- 10;et=new Zs(r)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&
22
+ 10;et=new ni(r)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&
23
23
  (e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.
24
24
  serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=
25
25
  this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=
@@ -45,38 +45,38 @@ nvalid value for parameter "${n}": ${o}`);o=s}else if(n==="client_no_context_tak
45
45
  if(o!==!0)throw new TypeError(`Invalid value for parameter "${n}": ${o}`)}else throw new Error(`Unknown parameter "${n}"`);
46
46
  r[n]=o})}),e}decompress(e,r,n){et.add(o=>{this._decompress(e,r,(s,i)=>{o(),n(s,i)})})}compress(e,r,n){et.add(o=>{this._compress(
47
47
  e,r,(s,i)=>{o(),n(s,i)})})}_decompress(e,r,n){let o=this._isServer?"client":"server";if(!this._inflate){let s=`${o}_max_\
48
- window_bits`,i=typeof this.params[s]!="number"?Ue.Z_DEFAULT_WINDOWBITS:this.params[s];this._inflate=Ue.createInflateRaw(
48
+ window_bits`,i=typeof this.params[s]!="number"?$e.Z_DEFAULT_WINDOWBITS:this.params[s];this._inflate=$e.createInflateRaw(
49
49
  {...this._options.zlibInflateOptions,windowBits:i}),this._inflate[tt]=this,this._inflate[ae]=0,this._inflate[de]=[],this.
50
- _inflate.on("error",ni),this._inflate.on("data",pn)}this._inflate[xe]=n,this._inflate.write(e),r&&this._inflate.write(ti),
51
- this._inflate.flush(()=>{let s=this._inflate[Oe];if(s){this._inflate.close(),this._inflate=null,n(s);return}let i=dn.concat(
50
+ _inflate.on("error",ai),this._inflate.on("data",_n)}this._inflate[xe]=n,this._inflate.write(e),r&&this._inflate.write(si),
51
+ this._inflate.flush(()=>{let s=this._inflate[Oe];if(s){this._inflate.close(),this._inflate=null,n(s);return}let i=hn.concat(
52
52
  this._inflate[de],this._inflate[ae]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):
53
53
  (this._inflate[ae]=0,this._inflate[de]=[],r&&this.params[`${o}_no_context_takeover`]&&this._inflate.reset()),n(null,i)})}_compress(e,r,n){
54
54
  let o=this._isServer?"server":"client";if(!this._deflate){let s=`${o}_max_window_bits`,i=typeof this.params[s]!="number"?
55
- Ue.Z_DEFAULT_WINDOWBITS:this.params[s];this._deflate=Ue.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:i}),
56
- this._deflate[ae]=0,this._deflate[de]=[],this._deflate.on("data",ri)}this._deflate[xe]=n,this._deflate.write(e),this._deflate.
57
- flush(Ue.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let s=dn.concat(this._deflate[de],this._deflate[ae]);r&&(s=new ei(s.
55
+ $e.Z_DEFAULT_WINDOWBITS:this.params[s];this._deflate=$e.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:i}),
56
+ this._deflate[ae]=0,this._deflate[de]=[],this._deflate.on("data",ii)}this._deflate[xe]=n,this._deflate.write(e),this._deflate.
57
+ flush($e.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let s=hn.concat(this._deflate[de],this._deflate[ae]);r&&(s=new oi(s.
58
58
  buffer,s.byteOffset,s.length-4)),this._deflate[xe]=null,this._deflate[ae]=0,this._deflate[de]=[],r&&this.params[`${o}_no\
59
- _context_takeover`]&&this._deflate.reset(),n(null,s)})}};hn.exports=Ht;function ri(t){this[de].push(t),this[ae]+=t.length}
60
- function pn(t){if(this[ae]+=t.length,this[tt]._maxPayload<1||this[ae]<=this[tt]._maxPayload){this[de].push(t);return}this[Oe]=
61
- new RangeError("Max payload size exceeded"),this[Oe].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Oe][fn]=1009,this.removeListener(
62
- "data",pn),this.reset()}function ni(t){if(this[tt]._inflate=null,this[Oe]){this[xe](this[Oe]);return}t[fn]=1007,this[xe](
63
- t)}});var Ce=W((jl,rt)=>{"use strict";var{isUtf8:mn}=$("buffer"),{hasBlob:oi}=ie(),si=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
59
+ _context_takeover`]&&this._deflate.reset(),n(null,s)})}};yn.exports=Ft;function ii(t){this[de].push(t),this[ae]+=t.length}
60
+ function _n(t){if(this[ae]+=t.length,this[tt]._maxPayload<1||this[ae]<=this[tt]._maxPayload){this[de].push(t);return}this[Oe]=
61
+ new RangeError("Max payload size exceeded"),this[Oe].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Oe][mn]=1009,this.removeListener(
62
+ "data",_n),this.reset()}function ai(t){if(this[tt]._inflate=null,this[Oe]){this[xe](this[Oe]);return}t[mn]=1007,this[xe](
63
+ t)}});var Ce=W((Dl,rt)=>{"use strict";var{isUtf8:gn}=U("buffer"),{hasBlob:ci}=ie(),ui=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
64
64
  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,
65
- 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 ii(t){return t>=
66
- 1e3&&t<=1014&&t!==1004&&t!==1005&&t!==1006||t>=3e3&&t<=4999}function Ft(t){let e=t.length,r=0;for(;r<e;)if((t[r]&128)===
65
+ 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 li(t){return t>=
66
+ 1e3&&t<=1014&&t!==1004&&t!==1005&&t!==1006||t>=3e3&&t<=4999}function qt(t){let e=t.length,r=0;for(;r<e;)if((t[r]&128)===
67
67
  0)r++;else if((t[r]&224)===192){if(r+1===e||(t[r+1]&192)!==128||(t[r]&254)===192)return!1;r+=2}else if((t[r]&240)===224){
68
68
  if(r+2>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||t[r]===224&&(t[r+1]&224)===128||t[r]===237&&(t[r+1]&224)===160)return!1;
69
69
  r+=3}else if((t[r]&248)===240){if(r+3>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||(t[r+3]&192)!==128||t[r]===240&&(t[r+1]&
70
- 240)===128||t[r]===244&&t[r+1]>143||t[r]>244)return!1;r+=4}else return!1;return!0}function ai(t){return oi&&typeof t=="o\
70
+ 240)===128||t[r]===244&&t[r+1]>143||t[r]>244)return!1;r+=4}else return!1;return!0}function di(t){return ci&&typeof t=="o\
71
71
  bject"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&(t[Symbol.toStringTag]===
72
- "Blob"||t[Symbol.toStringTag]==="File")}rt.exports={isBlob:ai,isValidStatusCode:ii,isValidUTF8:Ft,tokenChars:si};if(mn)rt.
73
- exports.isValidUTF8=function(t){return t.length<24?Ft(t):mn(t)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let t=$("utf-8-validate");
74
- rt.exports.isValidUTF8=function(e){return e.length<32?Ft(e):t(e)}}catch{}});var Jt=W((Ml,bn)=>{"use strict";var{Writable:ci}=$("stream"),_n=ve(),{BINARY_TYPES:ui,EMPTY_BUFFER:yn,kStatusCode:li,kWebSocket:di}=ie(),
75
- {concat:qt,toArrayBuffer:fi,unmask:pi}=Le(),{isValidStatusCode:hi,isValidUTF8:gn}=Ce(),nt=Buffer[Symbol.species],K=0,En=1,
76
- Sn=2,wn=3,Gt=4,Wt=5,ot=6,Xt=class extends ci{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==
77
- void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||ui[0],this._extensions=e.extensions||{},this._isServer=
72
+ "Blob"||t[Symbol.toStringTag]==="File")}rt.exports={isBlob:di,isValidStatusCode:li,isValidUTF8:qt,tokenChars:ui};if(gn)rt.
73
+ exports.isValidUTF8=function(t){return t.length<24?qt(t):gn(t)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let t=U("utf-8-validate");
74
+ rt.exports.isValidUTF8=function(e){return e.length<32?qt(e):t(e)}}catch{}});var Kt=W((Ll,vn)=>{"use strict";var{Writable:fi}=U("stream"),En=ve(),{BINARY_TYPES:pi,EMPTY_BUFFER:Sn,kStatusCode:hi,kWebSocket:mi}=ie(),
75
+ {concat:Gt,toArrayBuffer:_i,unmask:yi}=Le(),{isValidStatusCode:gi,isValidUTF8:wn}=Ce(),nt=Buffer[Symbol.species],K=0,bn=1,
76
+ xn=2,On=3,Wt=4,Xt=5,ot=6,Jt=class extends fi{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==
77
+ void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||pi[0],this._extensions=e.extensions||{},this._isServer=
78
78
  !!e.isServer,this._maxBufferedChunks=e.maxBufferedChunks|0,this._maxFragments=e.maxFragments|0,this._maxPayload=e.maxPayload|
79
- 0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[di]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=
79
+ 0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[mi]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=
80
80
  !1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=
81
81
  0,this._messageLength=0,this._numFragments=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=K}_write(e,r,n){
82
82
  if(this._opcode===8&&this._state==K)return n();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){
@@ -86,10 +86,10 @@ _buffers.shift();if(e<this._buffers[0].length){let n=this._buffers[0];return thi
86
86
  e,n.length-e),new nt(n.buffer,n.byteOffset,e)}let r=Buffer.allocUnsafe(e);do{let n=this._buffers[0],o=r.length-e;e>=n.length?
87
87
  r.set(this._buffers.shift(),o):(r.set(new Uint8Array(n.buffer,n.byteOffset,e),o),this._buffers[0]=new nt(n.buffer,n.byteOffset+
88
88
  e,n.length-e)),e-=n.length}while(e>0);return r}startLoop(e){this._loop=!0;do switch(this._state){case K:this.getInfo(e);
89
- break;case En:this.getPayloadLength16(e);break;case Sn:this.getPayloadLength64(e);break;case wn:this.getMask();break;case Gt:
90
- this.getData(e);break;case Wt:case ot:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<
89
+ break;case bn:this.getPayloadLength16(e);break;case xn:this.getPayloadLength64(e);break;case On:this.getMask();break;case Wt:
90
+ this.getData(e);break;case Xt:case ot:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<
91
91
  2){this._loop=!1;return}let r=this.consume(2);if((r[0]&48)!==0){let o=this.createError(RangeError,"RSV2 and RSV3 must be\
92
- clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(o);return}let n=(r[0]&64)===64;if(n&&!this._extensions[_n.extensionName]){
92
+ clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(o);return}let n=(r[0]&64)===64;if(n&&!this._extensions[En.extensionName]){
93
93
  let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(o);return}if(this._fin=(r[0]&
94
94
  128)===128,this._opcode=r[0]&15,this._payloadLength=r[1]&127,this._opcode===0){if(n){let o=this.createError(RangeError,"\
95
95
  RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(o);return}if(!this._fragmented){let o=this.createError(RangeError,
@@ -103,51 +103,51 @@ LOAD_LENGTH");e(o);return}}else{let o=this.createError(RangeError,`invalid opcod
103
103
  ID_OPCODE");e(o);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(r[1]&128)===128,
104
104
  this._isServer){if(!this._masked){let o=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(
105
105
  o);return}}else if(this._masked){let o=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");
106
- e(o);return}this._payloadLength===126?this._state=En:this._payloadLength===127?this._state=Sn:this.haveLength(e)}getPayloadLength16(e){
106
+ e(o);return}this._payloadLength===126?this._state=bn:this._payloadLength===127?this._state=xn:this.haveLength(e)}getPayloadLength16(e){
107
107
  if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){
108
108
  if(this._bufferedBytes<8){this._loop=!1;return}let r=this.consume(8),n=r.readUInt32BE(0);if(n>Math.pow(2,21)-1){let o=this.
109
109
  createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD\
110
110
  _LENGTH");e(o);return}this._payloadLength=n*Math.pow(2,32)+r.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&
111
111
  this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>
112
112
  0)){let r=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(r);return}
113
- this._masked?this._state=wn:this._state=Gt}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(
114
- 4),this._state=Gt}getData(e){let r=yn;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;
113
+ this._masked?this._state=On:this._state=Wt}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(
114
+ 4),this._state=Wt}getData(e){let r=Sn;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;
115
115
  return}r=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&
116
- pi(r,this._mask)}if(this._opcode>7){this.controlMessage(r,e);return}if(this._maxFragments>0&&++this._numFragments>this._maxFragments){
116
+ yi(r,this._mask)}if(this._opcode>7){this.controlMessage(r,e);return}if(this._maxFragments>0&&++this._numFragments>this._maxFragments){
117
117
  let n=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");e(n);return}if(this.
118
- _compressed){this._state=Wt,this.decompress(r,e);return}r.length&&(this._messageLength=this._totalPayloadLength,this._fragments.
119
- push(r)),this.dataMessage(e)}decompress(e,r){this._extensions[_n.extensionName].decompress(e,this._fin,(o,s)=>{if(o)return r(
118
+ _compressed){this._state=Xt,this.decompress(r,e);return}r.length&&(this._messageLength=this._totalPayloadLength,this._fragments.
119
+ push(r)),this.dataMessage(e)}decompress(e,r){this._extensions[En.extensionName].decompress(e,this._fin,(o,s)=>{if(o)return r(
120
120
  o);if(s.length){if(this._messageLength+=s.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let i=this.createError(
121
121
  RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(i);return}this._fragments.push(s)}
122
122
  this.dataMessage(r),this._state===K&&this.startLoop(r)})}dataMessage(e){if(!this._fin){this._state=K;return}let r=this._messageLength,
123
123
  n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._numFragments=0,this._fragments=
124
- [],this._opcode===2){let o;this._binaryType==="nodebuffer"?o=qt(n,r):this._binaryType==="arraybuffer"?o=fi(qt(n,r)):this.
124
+ [],this._opcode===2){let o;this._binaryType==="nodebuffer"?o=Gt(n,r):this._binaryType==="arraybuffer"?o=_i(Gt(n,r)):this.
125
125
  _binaryType==="blob"?o=new Blob(n):o=n,this._allowSynchronousEvents?(this.emit("message",o,!0),this._state=K):(this._state=
126
- ot,setImmediate(()=>{this.emit("message",o,!0),this._state=K,this.startLoop(e)}))}else{let o=qt(n,r);if(!this._skipUTF8Validation&&
127
- !gn(o)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(s);return}this._state===Wt||
126
+ ot,setImmediate(()=>{this.emit("message",o,!0),this._state=K,this.startLoop(e)}))}else{let o=Gt(n,r);if(!this._skipUTF8Validation&&
127
+ !wn(o)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(s);return}this._state===Xt||
128
128
  this._allowSynchronousEvents?(this.emit("message",o,!1),this._state=K):(this._state=ot,setImmediate(()=>{this.emit("mess\
129
129
  age",o,!1),this._state=K,this.startLoop(e)}))}}controlMessage(e,r){if(this._opcode===8){if(e.length===0)this._loop=!1,this.
130
- emit("conclude",1005,yn),this.end();else{let n=e.readUInt16BE(0);if(!hi(n)){let s=this.createError(RangeError,`invalid s\
130
+ emit("conclude",1005,Sn),this.end();else{let n=e.readUInt16BE(0);if(!gi(n)){let s=this.createError(RangeError,`invalid s\
131
131
  tatus code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(s);return}let o=new nt(e.buffer,e.byteOffset+2,e.length-2);if(!this.
132
- _skipUTF8Validation&&!gn(o)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");r(s);return}
132
+ _skipUTF8Validation&&!wn(o)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");r(s);return}
133
133
  this._loop=!1,this.emit("conclude",n,o),this.end()}this._state=K;return}this._allowSynchronousEvents?(this.emit(this._opcode===
134
134
  9?"ping":"pong",e),this._state=K):(this._state=ot,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=
135
135
  K,this.startLoop(r)}))}createError(e,r,n,o,s){this._loop=!1,this._errored=!0;let i=new e(n?`Invalid WebSocket frame: ${r}`:
136
- r);return Error.captureStackTrace(i,this.createError),i.code=s,i[li]=o,i}};bn.exports=Xt});var Qt=W((Ll,vn)=>{"use strict";var{Duplex:Dl}=$("stream"),{randomFillSync:mi}=$("crypto"),{types:{isUint8Array:_i}}=$("util"),
137
- xn=ve(),{EMPTY_BUFFER:yi,kWebSocket:gi,NOOP:Ei}=ie(),{isBlob:Te,isValidStatusCode:Si}=Ce(),{mask:On,toBuffer:me}=Le(),Y=Symbol(
138
- "kByteLength"),wi=Buffer.alloc(4),st=8*1024,_e,Ae=st,te=0,bi=1,xi=2,Kt=class t{constructor(e,r,n){this._extensions=r||{},
136
+ r);return Error.captureStackTrace(i,this.createError),i.code=s,i[hi]=o,i}};vn.exports=Jt});var Zt=W((Ul,An)=>{"use strict";var{Duplex:$l}=U("stream"),{randomFillSync:Ei}=U("crypto"),{types:{isUint8Array:Si}}=U("util"),
137
+ Cn=ve(),{EMPTY_BUFFER:wi,kWebSocket:bi,NOOP:xi}=ie(),{isBlob:Te,isValidStatusCode:Oi}=Ce(),{mask:Tn,toBuffer:me}=Le(),Y=Symbol(
138
+ "kByteLength"),vi=Buffer.alloc(4),st=8*1024,_e,Ae=st,te=0,Ci=1,Ti=2,Yt=class t{constructor(e,r,n){this._extensions=r||{},
139
139
  n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this.
140
- _bufferedBytes=0,this._queue=[],this._state=te,this.onerror=Ei,this[gi]=void 0}static frame(e,r){let n,o=!1,s=2,i=!1;r.mask&&
141
- (n=r.maskBuffer||wi,r.generateMask?r.generateMask(n):(Ae===st&&(_e===void 0&&(_e=Buffer.alloc(st)),mi(_e,0,st),Ae=0),n[0]=
140
+ _bufferedBytes=0,this._queue=[],this._state=te,this.onerror=xi,this[bi]=void 0}static frame(e,r){let n,o=!1,s=2,i=!1;r.mask&&
141
+ (n=r.maskBuffer||vi,r.generateMask?r.generateMask(n):(Ae===st&&(_e===void 0&&(_e=Buffer.alloc(st)),Ei(_e,0,st),Ae=0),n[0]=
142
142
  _e[Ae++],n[1]=_e[Ae++],n[2]=_e[Ae++],n[3]=_e[Ae++]),i=(n[0]|n[1]|n[2]|n[3])===0,s=6);let a;typeof e=="string"?(!r.mask||
143
143
  i)&&r[Y]!==void 0?a=r[Y]:(e=Buffer.from(e),a=e.length):(a=e.length,o=r.mask&&r.readOnly&&!i);let c=a;a>=65536?(s+=8,c=127):
144
144
  a>125&&(s+=2,c=126);let u=Buffer.allocUnsafe(o?a+s:s);return u[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(u[0]|=64),u[1]=c,
145
145
  c===126?u.writeUInt16BE(a,2):c===127&&(u[2]=u[3]=0,u.writeUIntBE(a,4,6)),r.mask?(u[1]|=128,u[s-4]=n[0],u[s-3]=n[1],u[s-2]=
146
- n[2],u[s-1]=n[3],i?[u,e]:o?(On(e,n,u,s,a),[u]):(On(e,n,e,0,a),[u,e])):[u,e]}close(e,r,n,o){let s;if(e===void 0)s=yi;else{
147
- if(typeof e!="number"||!Si(e))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.
146
+ n[2],u[s-1]=n[3],i?[u,e]:o?(Tn(e,n,u,s,a),[u]):(Tn(e,n,e,0,a),[u,e])):[u,e]}close(e,r,n,o){let s;if(e===void 0)s=wi;else{
147
+ if(typeof e!="number"||!Oi(e))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.
148
148
  length)s=Buffer.allocUnsafe(2),s.writeUInt16BE(e,0);else{let a=Buffer.byteLength(r);if(a>123)throw new RangeError("The m\
149
149
  essage must not be greater than 123 bytes");if(s=Buffer.allocUnsafe(2+a),s.writeUInt16BE(e,0),typeof r=="string")s.write(
150
- r,2);else if(_i(r))s.set(r,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let i={[Y]:s.
150
+ r,2);else if(Si(r))s.set(r,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let i={[Y]:s.
151
151
  length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==
152
152
  te?this.enqueue([this.dispatch,s,!1,i,o]):this.sendFrame(t.frame(s,i),o)}ping(e,r,n){let o,s;if(typeof e=="string"?(o=Buffer.
153
153
  byteLength(e),s=!1):Te(e)?(o=e.size,s=!1):(e=me(e),o=e.length,s=me.readOnly),o>125)throw new RangeError("The data size m\
@@ -158,41 +158,41 @@ this._state!==te?this.enqueue([this.dispatch,e,!1,i,n]):this.sendFrame(t.frame(e
158
158
  "The data size must not be greater than 125 bytes");let i={[Y]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this.
159
159
  _maskBuffer,opcode:10,readOnly:s,rsv1:!1};Te(e)?this._state!==te?this.enqueue([this.getBlobData,e,!1,i,n]):this.getBlobData(
160
160
  e,!1,i,n):this._state!==te?this.enqueue([this.dispatch,e,!1,i,n]):this.sendFrame(t.frame(e,i),n)}send(e,r,n){let o=this.
161
- _extensions[xn.extensionName],s=r.binary?2:1,i=r.compress,a,c;typeof e=="string"?(a=Buffer.byteLength(e),c=!1):Te(e)?(a=
161
+ _extensions[Cn.extensionName],s=r.binary?2:1,i=r.compress,a,c;typeof e=="string"?(a=Buffer.byteLength(e),c=!1):Te(e)?(a=
162
162
  e.size,c=!1):(e=me(e),a=e.length,c=me.readOnly),this._firstFragment?(this._firstFragment=!1,i&&o&&o.params[o._isServer?"\
163
163
  server_no_context_takeover":"client_no_context_takeover"]&&(i=a>=o._threshold),this._compress=i):(i=!1,s=0),r.fin&&(this.
164
164
  _firstFragment=!0);let u={[Y]:a,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:s,
165
165
  readOnly:c,rsv1:i};Te(e)?this._state!==te?this.enqueue([this.getBlobData,e,this._compress,u,n]):this.getBlobData(e,this.
166
166
  _compress,u,n):this._state!==te?this.enqueue([this.dispatch,e,this._compress,u,n]):this.dispatch(e,this._compress,u,n)}getBlobData(e,r,n,o){
167
- this._bufferedBytes+=n[Y],this._state=xi,e.arrayBuffer().then(s=>{if(this._socket.destroyed){let a=new Error("The socket\
168
- was closed while the blob was being read");process.nextTick(Yt,this,a,o);return}this._bufferedBytes-=n[Y];let i=me(s);r?
169
- this.dispatch(i,r,n,o):(this._state=te,this.sendFrame(t.frame(i,n),o),this.dequeue())}).catch(s=>{process.nextTick(Oi,this,
170
- s,o)})}dispatch(e,r,n,o){if(!r){this.sendFrame(t.frame(e,n),o);return}let s=this._extensions[xn.extensionName];this._bufferedBytes+=
171
- n[Y],this._state=bi,s.compress(e,n.fin,(i,a)=>{if(this._socket.destroyed){let c=new Error("The socket was closed while d\
172
- ata was being compressed");Yt(this,c,o);return}this._bufferedBytes-=n[Y],this._state=te,n.readOnly=!1,this.sendFrame(t.frame(
167
+ this._bufferedBytes+=n[Y],this._state=Ti,e.arrayBuffer().then(s=>{if(this._socket.destroyed){let a=new Error("The socket\
168
+ was closed while the blob was being read");process.nextTick(Qt,this,a,o);return}this._bufferedBytes-=n[Y];let i=me(s);r?
169
+ this.dispatch(i,r,n,o):(this._state=te,this.sendFrame(t.frame(i,n),o),this.dequeue())}).catch(s=>{process.nextTick(Ai,this,
170
+ s,o)})}dispatch(e,r,n,o){if(!r){this.sendFrame(t.frame(e,n),o);return}let s=this._extensions[Cn.extensionName];this._bufferedBytes+=
171
+ n[Y],this._state=Ci,s.compress(e,n.fin,(i,a)=>{if(this._socket.destroyed){let c=new Error("The socket was closed while d\
172
+ ata was being compressed");Qt(this,c,o);return}this._bufferedBytes-=n[Y],this._state=te,n.readOnly=!1,this.sendFrame(t.frame(
173
173
  a,n),o),this.dequeue()})}dequeue(){for(;this._state===te&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=
174
174
  e[3][Y],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][Y],this._queue.push(e)}sendFrame(e,r){
175
175
  e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],r),this._socket.uncork()):this._socket.
176
- write(e[0],r)}};vn.exports=Kt;function Yt(t,e,r){typeof r=="function"&&r(e);for(let n=0;n<t._queue.length;n++){let o=t._queue[n],
177
- s=o[o.length-1];typeof s=="function"&&s(e)}}function Oi(t,e,r){Yt(t,e,r),t.onerror(e)}});var jn=W((Ul,kn)=>{"use strict";var{kForOnEventAttribute:$e,kListener:Zt}=ie(),Cn=Symbol("kCode"),Tn=Symbol("kData"),An=Symbol(
178
- "kError"),Pn=Symbol("kMessage"),In=Symbol("kReason"),Pe=Symbol("kTarget"),Rn=Symbol("kType"),Nn=Symbol("kWasClean"),ce=class{constructor(e){
179
- this[Pe]=null,this[Rn]=e}get target(){return this[Pe]}get type(){return this[Rn]}};Object.defineProperty(ce.prototype,"t\
176
+ write(e[0],r)}};An.exports=Yt;function Qt(t,e,r){typeof r=="function"&&r(e);for(let n=0;n<t._queue.length;n++){let o=t._queue[n],
177
+ s=o[o.length-1];typeof s=="function"&&s(e)}}function Ai(t,e,r){Qt(t,e,r),t.onerror(e)}});var Ln=W((zl,Dn)=>{"use strict";var{kForOnEventAttribute:Ue,kListener:er}=ie(),Pn=Symbol("kCode"),In=Symbol("kData"),Rn=Symbol(
178
+ "kError"),Nn=Symbol("kMessage"),kn=Symbol("kReason"),Pe=Symbol("kTarget"),jn=Symbol("kType"),Mn=Symbol("kWasClean"),ce=class{constructor(e){
179
+ this[Pe]=null,this[jn]=e}get target(){return this[Pe]}get type(){return this[jn]}};Object.defineProperty(ce.prototype,"t\
180
180
  arget",{enumerable:!0});Object.defineProperty(ce.prototype,"type",{enumerable:!0});var ye=class extends ce{constructor(e,r={}){
181
- super(e),this[Cn]=r.code===void 0?0:r.code,this[In]=r.reason===void 0?"":r.reason,this[Nn]=r.wasClean===void 0?!1:r.wasClean}get code(){
182
- return this[Cn]}get reason(){return this[In]}get wasClean(){return this[Nn]}};Object.defineProperty(ye.prototype,"code",
181
+ super(e),this[Pn]=r.code===void 0?0:r.code,this[kn]=r.reason===void 0?"":r.reason,this[Mn]=r.wasClean===void 0?!1:r.wasClean}get code(){
182
+ return this[Pn]}get reason(){return this[kn]}get wasClean(){return this[Mn]}};Object.defineProperty(ye.prototype,"code",
183
183
  {enumerable:!0});Object.defineProperty(ye.prototype,"reason",{enumerable:!0});Object.defineProperty(ye.prototype,"wasCle\
184
- an",{enumerable:!0});var Ie=class extends ce{constructor(e,r={}){super(e),this[An]=r.error===void 0?null:r.error,this[Pn]=
185
- r.message===void 0?"":r.message}get error(){return this[An]}get message(){return this[Pn]}};Object.defineProperty(Ie.prototype,
184
+ an",{enumerable:!0});var Ie=class extends ce{constructor(e,r={}){super(e),this[Rn]=r.error===void 0?null:r.error,this[Nn]=
185
+ r.message===void 0?"":r.message}get error(){return this[Rn]}get message(){return this[Nn]}};Object.defineProperty(Ie.prototype,
186
186
  "error",{enumerable:!0});Object.defineProperty(Ie.prototype,"message",{enumerable:!0});var ze=class extends ce{constructor(e,r={}){
187
- super(e),this[Tn]=r.data===void 0?null:r.data}get data(){return this[Tn]}};Object.defineProperty(ze.prototype,"data",{enumerable:!0});
188
- var vi={addEventListener(t,e,r={}){for(let o of this.listeners(t))if(!r[$e]&&o[Zt]===e&&!o[$e])return;let n;if(t==="mess\
187
+ super(e),this[In]=r.data===void 0?null:r.data}get data(){return this[In]}};Object.defineProperty(ze.prototype,"data",{enumerable:!0});
188
+ var Pi={addEventListener(t,e,r={}){for(let o of this.listeners(t))if(!r[Ue]&&o[er]===e&&!o[Ue])return;let n;if(t==="mess\
189
189
  age")n=function(s,i){let a=new ze("message",{data:i?s:s.toString()});a[Pe]=this,it(e,this,a)};else if(t==="close")n=function(s,i){
190
190
  let a=new ye("close",{code:s,reason:i.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});a[Pe]=this,it(
191
191
  e,this,a)};else if(t==="error")n=function(s){let i=new Ie("error",{error:s,message:s.message});i[Pe]=this,it(e,this,i)};else if(t===
192
- "open")n=function(){let s=new ce("open");s[Pe]=this,it(e,this,s)};else return;n[$e]=!!r[$e],n[Zt]=e,r.once?this.once(t,n):
193
- this.on(t,n)},removeEventListener(t,e){for(let r of this.listeners(t))if(r[Zt]===e&&!r[$e]){this.removeListener(t,r);break}}};
194
- kn.exports={CloseEvent:ye,ErrorEvent:Ie,Event:ce,EventTarget:vi,MessageEvent:ze};function it(t,e,r){typeof t=="object"&&
195
- t.handleEvent?t.handleEvent.call(t,r):t.call(e,r)}});var at=W(($l,Mn)=>{"use strict";var{tokenChars:Be}=Ce();function ne(t,e,r){t[e]===void 0?t[e]=[r]:t[e].push(r)}function Ci(t){
192
+ "open")n=function(){let s=new ce("open");s[Pe]=this,it(e,this,s)};else return;n[Ue]=!!r[Ue],n[er]=e,r.once?this.once(t,n):
193
+ this.on(t,n)},removeEventListener(t,e){for(let r of this.listeners(t))if(r[er]===e&&!r[Ue]){this.removeListener(t,r);break}}};
194
+ Dn.exports={CloseEvent:ye,ErrorEvent:Ie,Event:ce,EventTarget:Pi,MessageEvent:ze};function it(t,e,r){typeof t=="object"&&
195
+ t.handleEvent?t.handleEvent.call(t,r):t.call(e,r)}});var at=W((Bl,$n)=>{"use strict";var{tokenChars:Be}=Ce();function ne(t,e,r){t[e]===void 0?t[e]=[r]:t[e].push(r)}function Ii(t){
196
196
  let e=Object.create(null),r=Object.create(null),n=!1,o=!1,s=!1,i,a,c=-1,u=-1,f=-1,p=0;for(;p<t.length;p++)if(u=t.charCodeAt(
197
197
  p),i===void 0)if(f===-1&&Be[u]===1)c===-1&&(c=p);else if(p!==0&&(u===32||u===9))f===-1&&c!==-1&&(f=p);else if(u===59||u===
198
198
  44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let y=t.slice(c,f);u===44?(ne(e,
@@ -207,44 +207,44 @@ u===9))f===-1&&(f=p);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Un
207
207
  (f=p);let y=t.slice(c,f);n&&(y=y.replace(/\\/g,""),n=!1),ne(r,a,y),u===44&&(ne(e,i,r),r=Object.create(null),i=void 0),a=
208
208
  void 0,c=f=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);if(c===-1||s||u===32||u===9)throw new SyntaxError(
209
209
  "Unexpected end of input");f===-1&&(f=p);let d=t.slice(c,f);return i===void 0?ne(e,d,r):(a===void 0?ne(r,d,!0):n?ne(r,a,
210
- d.replace(/\\/g,"")):ne(r,a,d),ne(e,i,r)),e}function Ti(t){return Object.keys(t).map(e=>{let r=t[e];return Array.isArray(
210
+ d.replace(/\\/g,"")):ne(r,a,d),ne(e,i,r)),e}function Ri(t){return Object.keys(t).map(e=>{let r=t[e];return Array.isArray(
211
211
  r)||(r=[r]),r.map(n=>[e].concat(Object.keys(n).map(o=>{let s=n[o];return Array.isArray(s)||(s=[s]),s.map(i=>i===!0?o:`${o}\
212
- =${i}`).join("; ")})).join("; ")).join(", ")}).join(", ")}Mn.exports={format:Ti,parse:Ci}});var dt=W((Vl,Wn)=>{"use strict";var Ai=$("events"),Pi=$("https"),Ii=$("http"),Un=$("net"),Ri=$("tls"),{randomBytes:Ni,createHash:ki}=$("crypto"),
213
- {Duplex:zl,Readable:Bl}=$("stream"),{URL:er}=$("url"),fe=ve(),ji=Jt(),Mi=Qt(),{isBlob:Di}=Ce(),{BINARY_TYPES:Dn,CLOSE_TIMEOUT:Li,
214
- EMPTY_BUFFER:ct,GUID:Ui,kForOnEventAttribute:tr,kListener:$i,kStatusCode:zi,kWebSocket:B,NOOP:$n}=ie(),{EventTarget:{addEventListener:Bi,
215
- removeEventListener:Vi}}=jn(),{format:Hi,parse:Fi}=at(),{toBuffer:qi}=Le(),zn=Symbol("kAborted"),rr=[8,13],ue=["CONNECTI\
216
- NG","OPEN","CLOSING","CLOSED"],Gi=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,L=class t extends Ai{constructor(e,r,n){super(),this.
217
- _binaryType=Dn[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=ct,this._closeTimer=
212
+ =${i}`).join("; ")})).join("; ")).join(", ")}).join(", ")}$n.exports={format:Ri,parse:Ii}});var dt=W((Fl,Kn)=>{"use strict";var Ni=U("events"),ki=U("https"),ji=U("http"),Bn=U("net"),Mi=U("tls"),{randomBytes:Di,createHash:Li}=U("crypto"),
213
+ {Duplex:Vl,Readable:Hl}=U("stream"),{URL:tr}=U("url"),fe=ve(),$i=Kt(),Ui=Zt(),{isBlob:zi}=Ce(),{BINARY_TYPES:Un,CLOSE_TIMEOUT:Bi,
214
+ EMPTY_BUFFER:ct,GUID:Vi,kForOnEventAttribute:rr,kListener:Hi,kStatusCode:Fi,kWebSocket:V,NOOP:Vn}=ie(),{EventTarget:{addEventListener:qi,
215
+ removeEventListener:Gi}}=Ln(),{format:Wi,parse:Xi}=at(),{toBuffer:Ji}=Le(),Hn=Symbol("kAborted"),nr=[8,13],ue=["CONNECTI\
216
+ NG","OPEN","CLOSING","CLOSED"],Ki=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,L=class t extends Ni{constructor(e,r,n){super(),this.
217
+ _binaryType=Un[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=ct,this._closeTimer=
218
218
  null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=t.CONNECTING,this._receiver=
219
219
  null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,r===void 0?
220
- r=[]:Array.isArray(r)||(typeof r=="object"&&r!==null?(n=r,r=[]):r=[r]),Bn(this,e,r,n)):(this._autoPong=n.autoPong,this._closeTimeout=
221
- n.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){Dn.includes(e)&&(this._binaryType=
220
+ r=[]:Array.isArray(r)||(typeof r=="object"&&r!==null?(n=r,r=[]):r=[r]),Fn(this,e,r,n)):(this._autoPong=n.autoPong,this._closeTimeout=
221
+ n.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){Un.includes(e)&&(this._binaryType=
222
222
  e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+
223
223
  this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){
224
224
  return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){
225
- return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,r,n){let o=new ji(
225
+ return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,r,n){let o=new $i(
226
226
  {allowSynchronousEvents:n.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,
227
227
  maxBufferedChunks:n.maxBufferedChunks,maxFragments:n.maxFragments,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation}),
228
- s=new Mi(e,this._extensions,n.generateMask);this._receiver=o,this._sender=s,this._socket=e,o[B]=this,s[B]=this,e[B]=this,
229
- o.on("conclude",Ji),o.on("drain",Ki),o.on("error",Yi),o.on("message",Qi),o.on("ping",Zi),o.on("pong",ea),s.onerror=ta,e.
230
- setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),r.length>0&&e.unshift(r),e.on("close",Fn),e.on("data",lt),e.on(
231
- "end",qn),e.on("error",Gn),this._readyState=t.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=t.CLOSED,
228
+ s=new Ui(e,this._extensions,n.generateMask);this._receiver=o,this._sender=s,this._socket=e,o[V]=this,s[V]=this,e[V]=this,
229
+ o.on("conclude",Zi),o.on("drain",ea),o.on("error",ta),o.on("message",ra),o.on("ping",na),o.on("pong",oa),s.onerror=sa,e.
230
+ setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),r.length>0&&e.unshift(r),e.on("close",Wn),e.on("data",lt),e.on(
231
+ "end",Xn),e.on("error",Jn),this._readyState=t.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=t.CLOSED,
232
232
  this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[fe.extensionName]&&this._extensions[fe.extensionName].
233
233
  cleanup(),this._receiver.removeAllListeners(),this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,r){
234
234
  if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){X(this,this._req,"WebSocket was closed before the conn\
235
235
  ection was established");return}if(this.readyState===t.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver.
236
236
  _writableState.errorEmitted)&&this._socket.end();return}this._readyState=t.CLOSING,this._sender.close(e,r,!this._isServer,
237
237
  n=>{n||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),
238
- Hn(this)}}pause(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,r,n){
238
+ Gn(this)}}pause(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,r,n){
239
239
  if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="func\
240
240
  tion"?(n=e,e=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){
241
- nr(this,e,n);return}r===void 0&&(r=!this._isServer),this._sender.ping(e||ct,r,n)}pong(e,r,n){if(this.readyState===t.CONNECTING)
241
+ or(this,e,n);return}r===void 0&&(r=!this._isServer),this._sender.ping(e||ct,r,n)}pong(e,r,n){if(this.readyState===t.CONNECTING)
242
242
  throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(n=e,e=r=void 0):typeof r=="\
243
- function"&&(n=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){nr(this,e,n);return}r===void 0&&
243
+ function"&&(n=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){or(this,e,n);return}r===void 0&&
244
244
  (r=!this._isServer),this._sender.pong(e||ct,r,n)}resume(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this.
245
245
  _paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,r,n){if(this.readyState===t.CONNECTING)
246
246
  throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(n=r,r={}),typeof e=="numbe\
247
- r"&&(e=e.toString()),this.readyState!==t.OPEN){nr(this,e,n);return}let o={binary:typeof e!="string",mask:!this._isServer,
247
+ r"&&(e=e.toString()),this.readyState!==t.OPEN){or(this,e,n);return}let o={binary:typeof e!="string",mask:!this._isServer,
248
248
  compress:!0,fin:!0,...r};this._extensions[fe.extensionName]||(o.compress=!1),this._sender.send(e||ct,o,n)}terminate(){if(this.
249
249
  readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){X(this,this._req,"WebSocket was closed before the connection w\
250
250
  as established");return}this._socket&&(this._readyState=t.CLOSING,this._socket.destroy())}}};Object.defineProperty(L,"CO\
@@ -255,23 +255,23 @@ L.prototype,"OPEN",{enumerable:!0,value:ue.indexOf("OPEN")});Object.defineProper
255
255
  L,"CLOSED",{enumerable:!0,value:ue.indexOf("CLOSED")});Object.defineProperty(L.prototype,"CLOSED",{enumerable:!0,value:ue.
256
256
  indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(t=>{Object.
257
257
  defineProperty(L.prototype,t,{enumerable:!0})});["open","error","close","message"].forEach(t=>{Object.defineProperty(L.prototype,
258
- `on${t}`,{enumerable:!0,get(){for(let e of this.listeners(t))if(e[tr])return e[$i];return null},set(e){for(let r of this.
259
- listeners(t))if(r[tr]){this.removeListener(t,r);break}typeof e=="function"&&this.addEventListener(t,e,{[tr]:!0})}})});L.
260
- prototype.addEventListener=Bi;L.prototype.removeEventListener=Vi;Wn.exports=L;function Bn(t,e,r,n){let o={allowSynchronousEvents:!0,
261
- autoPong:!0,closeTimeout:Li,protocolVersion:rr[1],maxBufferedChunks:262144,maxFragments:16384,maxPayload:104857600,skipUTF8Validation:!1,
258
+ `on${t}`,{enumerable:!0,get(){for(let e of this.listeners(t))if(e[rr])return e[Hi];return null},set(e){for(let r of this.
259
+ listeners(t))if(r[rr]){this.removeListener(t,r);break}typeof e=="function"&&this.addEventListener(t,e,{[rr]:!0})}})});L.
260
+ prototype.addEventListener=qi;L.prototype.removeEventListener=Gi;Kn.exports=L;function Fn(t,e,r,n){let o={allowSynchronousEvents:!0,
261
+ autoPong:!0,closeTimeout:Bi,protocolVersion:nr[1],maxBufferedChunks:262144,maxFragments:16384,maxPayload:104857600,skipUTF8Validation:!1,
262
262
  perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,
263
- method:"GET",host:void 0,path:void 0,port:void 0};if(t._autoPong=o.autoPong,t._closeTimeout=o.closeTimeout,!rr.includes(
264
- o.protocolVersion))throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${rr.join(
265
- ", ")})`);let s;if(e instanceof er)s=e;else try{s=new er(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}s.protocol===
263
+ method:"GET",host:void 0,path:void 0,port:void 0};if(t._autoPong=o.autoPong,t._closeTimeout=o.closeTimeout,!nr.includes(
264
+ o.protocolVersion))throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${nr.join(
265
+ ", ")})`);let s;if(e instanceof tr)s=e;else try{s=new tr(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}s.protocol===
266
266
  "http:"?s.protocol="ws:":s.protocol==="https:"&&(s.protocol="wss:"),t._url=s.href;let i=s.protocol==="wss:",a=s.protocol===
267
267
  "ws+unix:",c;if(s.protocol!=="ws:"&&!i&&!a?c=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws\
268
268
  +unix:"`:a&&!s.pathname?c="The URL's pathname is empty":s.hash&&(c="The URL contains a fragment identifier"),c){let S=new SyntaxError(
269
- c);if(t._redirects===0)throw S;ut(t,S);return}let u=i?443:80,f=Ni(16).toString("base64"),p=i?Pi.request:Ii.request,d=new Set,
270
- y;if(o.createConnection=o.createConnection||(i?Xi:Wi),o.defaultPort=o.defaultPort||u,o.port=s.port||u,o.host=s.hostname.
269
+ c);if(t._redirects===0)throw S;ut(t,S);return}let u=i?443:80,f=Di(16).toString("base64"),p=i?ki.request:ji.request,d=new Set,
270
+ y;if(o.createConnection=o.createConnection||(i?Qi:Yi),o.defaultPort=o.defaultPort||u,o.port=s.port||u,o.host=s.hostname.
271
271
  startsWith("[")?s.hostname.slice(1,-1):s.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec\
272
272
  -WebSocket-Key":f,Connection:"Upgrade",Upgrade:"websocket"},o.path=s.pathname+s.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&
273
- (y=new fe({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers["Sec-WebSocket-Extensions"]=Hi({[fe.extensionName]:y.
274
- offer()})),r.length){for(let S of r){if(typeof S!="string"||!Gi.test(S)||d.has(S))throw new SyntaxError("An invalid or d\
273
+ (y=new fe({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers["Sec-WebSocket-Extensions"]=Wi({[fe.extensionName]:y.
274
+ offer()})),r.length){for(let S of r){if(typeof S!="string"||!Ki.test(S)||d.has(S))throw new SyntaxError("An invalid or d\
275
275
  uplicated subprotocol was specified");d.add(S)}o.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(o.origin&&(o.protocolVersion<
276
276
  13?o.headers["Sec-WebSocket-Origin"]=o.origin:o.headers.Origin=o.origin),(s.username||s.password)&&(o.auth=`${s.username}\
277
277
  :${s.password}`),a){let S=o.path.split(":");o.socketPath=S[0],o.path=S[1]}let E;if(o.followRedirects){if(t._redirects===
@@ -281,147 +281,147 @@ t._originalIpc?o.socketPath===t._originalHostOrSocketPath:!1:t._originalIpc?!1:s
281
281
  t._originalSecure&&!i)&&(delete o.headers.authorization,delete o.headers.cookie,S||delete o.headers.host,o.auth=void 0)}
282
282
  o.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(o.auth).toString("base64")),E=t._req=p(o),
283
283
  t._redirects&&t.emit("redirect",t.url,E)}else E=t._req=p(o);o.timeout&&E.on("timeout",()=>{X(t,E,"Opening handshake has \
284
- timed out")}),E.on("error",S=>{E===null||E[zn]||(E=t._req=null,ut(t,S))}),E.on("response",S=>{let x=S.headers.location,A=S.
284
+ timed out")}),E.on("error",S=>{E===null||E[Hn]||(E=t._req=null,ut(t,S))}),E.on("response",S=>{let x=S.headers.location,A=S.
285
285
  statusCode;if(x&&o.followRedirects&&A>=300&&A<400){if(++t._redirects>o.maxRedirects){X(t,E,"Maximum redirects exceeded");
286
- return}E.abort();let I;try{I=new er(x,e)}catch{let v=new SyntaxError(`Invalid URL: ${x}`);ut(t,v);return}Bn(t,I,r,n)}else
286
+ return}E.abort();let I;try{I=new tr(x,e)}catch{let v=new SyntaxError(`Invalid URL: ${x}`);ut(t,v);return}Fn(t,I,r,n)}else
287
287
  t.emit("unexpected-response",E,S)||X(t,E,`Unexpected server response: ${S.statusCode}`)}),E.on("upgrade",(S,x,A)=>{if(t.
288
288
  emit("upgrade",S),t.readyState!==L.CONNECTING)return;E=t._req=null;let I=S.headers.upgrade;if(I===void 0||I.toLowerCase()!==
289
- "websocket"){X(t,x,"Invalid Upgrade header");return}let T=ki("sha1").update(f+Ui).digest("base64");if(S.headers["sec-web\
289
+ "websocket"){X(t,x,"Invalid Upgrade header");return}let T=Li("sha1").update(f+Vi).digest("base64");if(S.headers["sec-web\
290
290
  socket-accept"]!==T){X(t,x,"Invalid Sec-WebSocket-Accept header");return}let v=S.headers["sec-websocket-protocol"],k;if(v!==
291
291
  void 0?d.size?d.has(v)||(k="Server sent an invalid subprotocol"):k="Server sent a subprotocol but none was requested":d.
292
292
  size&&(k="Server sent no subprotocol"),k){X(t,x,k);return}v&&(t._protocol=v);let R=S.headers["sec-websocket-extensions"];
293
293
  if(R!==void 0){if(!y){X(t,x,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let N;
294
- try{N=Fi(R)}catch{X(t,x,"Invalid Sec-WebSocket-Extensions header");return}let M=Object.keys(N);if(M.length!==1||M[0]!==fe.
294
+ try{N=Xi(R)}catch{X(t,x,"Invalid Sec-WebSocket-Extensions header");return}let M=Object.keys(N);if(M.length!==1||M[0]!==fe.
295
295
  extensionName){X(t,x,"Server indicated an extension that was not requested");return}try{y.accept(N[fe.extensionName])}catch{
296
296
  X(t,x,"Invalid Sec-WebSocket-Extensions header");return}t._extensions[fe.extensionName]=y}t.setSocket(x,A,{allowSynchronousEvents:o.
297
297
  allowSynchronousEvents,generateMask:o.generateMask,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.
298
298
  maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(E,t):E.end()}function ut(t,e){t._readyState=
299
- L.CLOSING,t._errorEmitted=!0,t.emit("error",e),t.emitClose()}function Wi(t){return t.path=t.socketPath,Un.connect(t)}function Xi(t){
300
- return t.path=void 0,!t.servername&&t.servername!==""&&(t.servername=Un.isIP(t.host)?"":t.host),Ri.connect(t)}function X(t,e,r){
301
- t._readyState=L.CLOSING;let n=new Error(r);Error.captureStackTrace(n,X),e.setHeader?(e[zn]=!0,e.abort(),e.socket&&!e.socket.
299
+ L.CLOSING,t._errorEmitted=!0,t.emit("error",e),t.emitClose()}function Yi(t){return t.path=t.socketPath,Bn.connect(t)}function Qi(t){
300
+ return t.path=void 0,!t.servername&&t.servername!==""&&(t.servername=Bn.isIP(t.host)?"":t.host),Mi.connect(t)}function X(t,e,r){
301
+ t._readyState=L.CLOSING;let n=new Error(r);Error.captureStackTrace(n,X),e.setHeader?(e[Hn]=!0,e.abort(),e.socket&&!e.socket.
302
302
  destroyed&&e.socket.destroy(),process.nextTick(ut,t,n)):(e.destroy(n),e.once("error",t.emit.bind(t,"error")),e.once("clo\
303
- se",t.emitClose.bind(t)))}function nr(t,e,r){if(e){let n=Di(e)?e.size:qi(e).length;t._socket?t._sender._bufferedBytes+=n:
303
+ se",t.emitClose.bind(t)))}function or(t,e,r){if(e){let n=zi(e)?e.size:Ji(e).length;t._socket?t._sender._bufferedBytes+=n:
304
304
  t._bufferedAmount+=n}if(r){let n=new Error(`WebSocket is not open: readyState ${t.readyState} (${ue[t.readyState]})`);process.
305
- nextTick(r,n)}}function Ji(t,e){let r=this[B];r._closeFrameReceived=!0,r._closeMessage=e,r._closeCode=t,r._socket[B]!==void 0&&
306
- (r._socket.removeListener("data",lt),process.nextTick(Vn,r._socket),t===1005?r.close():r.close(t,e))}function Ki(){let t=this[B];
307
- t.isPaused||t._socket.resume()}function Yi(t){let e=this[B];e._socket[B]!==void 0&&(e._socket.removeListener("data",lt),
308
- process.nextTick(Vn,e._socket),e.close(t[zi])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t))}function Ln(){this[B].
309
- emitClose()}function Qi(t,e){this[B].emit("message",t,e)}function Zi(t){let e=this[B];e._autoPong&&e.pong(t,!this._isServer,
310
- $n),e.emit("ping",t)}function ea(t){this[B].emit("pong",t)}function Vn(t){t.resume()}function ta(t){let e=this[B];e.readyState!==
311
- L.CLOSED&&(e.readyState===L.OPEN&&(e._readyState=L.CLOSING,Hn(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,
312
- e.emit("error",t)))}function Hn(t){t._closeTimer=setTimeout(t._socket.destroy.bind(t._socket),t._closeTimeout)}function Fn(){
313
- let t=this[B];if(this.removeListener("close",Fn),this.removeListener("data",lt),this.removeListener("end",qn),t._readyState=
305
+ nextTick(r,n)}}function Zi(t,e){let r=this[V];r._closeFrameReceived=!0,r._closeMessage=e,r._closeCode=t,r._socket[V]!==void 0&&
306
+ (r._socket.removeListener("data",lt),process.nextTick(qn,r._socket),t===1005?r.close():r.close(t,e))}function ea(){let t=this[V];
307
+ t.isPaused||t._socket.resume()}function ta(t){let e=this[V];e._socket[V]!==void 0&&(e._socket.removeListener("data",lt),
308
+ process.nextTick(qn,e._socket),e.close(t[Fi])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t))}function zn(){this[V].
309
+ emitClose()}function ra(t,e){this[V].emit("message",t,e)}function na(t){let e=this[V];e._autoPong&&e.pong(t,!this._isServer,
310
+ Vn),e.emit("ping",t)}function oa(t){this[V].emit("pong",t)}function qn(t){t.resume()}function sa(t){let e=this[V];e.readyState!==
311
+ L.CLOSED&&(e.readyState===L.OPEN&&(e._readyState=L.CLOSING,Gn(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,
312
+ e.emit("error",t)))}function Gn(t){t._closeTimer=setTimeout(t._socket.destroy.bind(t._socket),t._closeTimeout)}function Wn(){
313
+ let t=this[V];if(this.removeListener("close",Wn),this.removeListener("data",lt),this.removeListener("end",Xn),t._readyState=
314
314
  L.CLOSING,!this._readableState.endEmitted&&!t._closeFrameReceived&&!t._receiver._writableState.errorEmitted&&this._readableState.
315
- length!==0){let e=this.read(this._readableState.length);t._receiver.write(e)}t._receiver.end(),this[B]=void 0,clearTimeout(
315
+ length!==0){let e=this.read(this._readableState.length);t._receiver.write(e)}t._receiver.end(),this[V]=void 0,clearTimeout(
316
316
  t._closeTimer),t._receiver._writableState.finished||t._receiver._writableState.errorEmitted?t.emitClose():(t._receiver.on(
317
- "error",Ln),t._receiver.on("finish",Ln))}function lt(t){this[B]._receiver.write(t)||this.pause()}function qn(){let t=this[B];
318
- t._readyState=L.CLOSING,t._receiver.end(),this.end()}function Gn(){let t=this[B];this.removeListener("error",Gn),this.on(
319
- "error",$n),t&&(t._readyState=L.CLOSING,this.destroy())}});var Yn=W((Fl,Kn)=>{"use strict";var Hl=dt(),{Duplex:ra}=$("stream");function Xn(t){t.emit("close")}function na(){!this.destroyed&&
320
- this._writableState.finished&&this.destroy()}function Jn(t){this.removeListener("error",Jn),this.destroy(),this.listenerCount(
321
- "error")===0&&this.emit("error",t)}function oa(t,e){let r=!0,n=new ra({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});
317
+ "error",zn),t._receiver.on("finish",zn))}function lt(t){this[V]._receiver.write(t)||this.pause()}function Xn(){let t=this[V];
318
+ t._readyState=L.CLOSING,t._receiver.end(),this.end()}function Jn(){let t=this[V];this.removeListener("error",Jn),this.on(
319
+ "error",Vn),t&&(t._readyState=L.CLOSING,this.destroy())}});var eo=W((Gl,Zn)=>{"use strict";var ql=dt(),{Duplex:ia}=U("stream");function Yn(t){t.emit("close")}function aa(){!this.destroyed&&
320
+ this._writableState.finished&&this.destroy()}function Qn(t){this.removeListener("error",Qn),this.destroy(),this.listenerCount(
321
+ "error")===0&&this.emit("error",t)}function ca(t,e){let r=!0,n=new ia({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});
322
322
  return t.on("message",function(s,i){let a=!i&&n._readableState.objectMode?s.toString():s;n.push(a)||t.pause()}),t.once("\
323
323
  error",function(s){n.destroyed||(r=!1,n.destroy(s))}),t.once("close",function(){n.destroyed||n.push(null)}),n._destroy=function(o,s){
324
- if(t.readyState===t.CLOSED){s(o),process.nextTick(Xn,n);return}let i=!1;t.once("error",function(c){i=!0,s(c)}),t.once("c\
325
- lose",function(){i||s(o),process.nextTick(Xn,n)}),r&&t.terminate()},n._final=function(o){if(t.readyState===t.CONNECTING){
324
+ if(t.readyState===t.CLOSED){s(o),process.nextTick(Yn,n);return}let i=!1;t.once("error",function(c){i=!0,s(c)}),t.once("c\
325
+ lose",function(){i||s(o),process.nextTick(Yn,n)}),r&&t.terminate()},n._final=function(o){if(t.readyState===t.CONNECTING){
326
326
  t.once("open",function(){n._final(o)});return}t._socket!==null&&(t._socket._writableState.finished?(o(),n._readableState.
327
327
  endEmitted&&n.destroy()):(t._socket.once("finish",function(){o()}),t.close()))},n._read=function(){t.isPaused&&t.resume()},
328
328
  n._write=function(o,s,i){if(t.readyState===t.CONNECTING){t.once("open",function(){n._write(o,s,i)});return}t.send(o,i)},
329
- n.on("end",na),n.on("error",Jn),n}Kn.exports=oa});var or=W((ql,Qn)=>{"use strict";var{tokenChars:sa}=Ce();function ia(t){let e=new Set,r=-1,n=-1,o=0;for(o;o<t.length;o++){
330
- let i=t.charCodeAt(o);if(n===-1&&sa[i]===1)r===-1&&(r=o);else if(o!==0&&(i===32||i===9))n===-1&&r!==-1&&(n=o);else if(i===
329
+ n.on("end",aa),n.on("error",Qn),n}Zn.exports=ca});var sr=W((Wl,to)=>{"use strict";var{tokenChars:ua}=Ce();function la(t){let e=new Set,r=-1,n=-1,o=0;for(o;o<t.length;o++){
330
+ let i=t.charCodeAt(o);if(n===-1&&ua[i]===1)r===-1&&(r=o);else if(o!==0&&(i===32||i===9))n===-1&&r!==-1&&(n=o);else if(i===
331
331
  44){if(r===-1)throw new SyntaxError(`Unexpected character at index ${o}`);n===-1&&(n=o);let a=t.slice(r,n);if(e.has(a))throw new SyntaxError(
332
332
  `The "${a}" subprotocol is duplicated`);e.add(a),r=n=-1}else throw new SyntaxError(`Unexpected character at index ${o}`)}
333
333
  if(r===-1||n!==-1)throw new SyntaxError("Unexpected end of input");let s=t.slice(r,o);if(e.has(s))throw new SyntaxError(
334
- `The "${s}" subprotocol is duplicated`);return e.add(s),e}Qn.exports={parse:ia}});var so=W((Wl,oo)=>{"use strict";var aa=$("events"),ft=$("http"),{Duplex:Gl}=$("stream"),{createHash:ca}=$("crypto"),Zn=at(),
335
- ge=ve(),ua=or(),la=dt(),{CLOSE_TIMEOUT:da,GUID:fa,kWebSocket:pa}=ie(),ha=/^[+/0-9A-Za-z]{22}==$/,eo=0,to=1,no=2,sr=class extends aa{constructor(e,r){
334
+ `The "${s}" subprotocol is duplicated`);return e.add(s),e}to.exports={parse:la}});var co=W((Jl,ao)=>{"use strict";var da=U("events"),ft=U("http"),{Duplex:Xl}=U("stream"),{createHash:fa}=U("crypto"),ro=at(),
335
+ ge=ve(),pa=sr(),ha=dt(),{CLOSE_TIMEOUT:ma,GUID:_a,kWebSocket:ya}=ie(),ga=/^[+/0-9A-Za-z]{22}==$/,no=0,oo=1,io=2,ir=class extends da{constructor(e,r){
336
336
  if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:256*1024,maxFragments:16*1024,maxPayload:100*1024*
337
- 1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:da,verifyClient:null,
338
- noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:la,...e},e.port==null&&!e.server&&!e.noServer||
337
+ 1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:ma,verifyClient:null,
338
+ noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:ha,...e},e.port==null&&!e.server&&!e.noServer||
339
339
  e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server"\
340
340
  , or "noServer" options must be specified');if(e.port!=null?(this._server=ft.createServer((n,o)=>{let s=ft.STATUS_CODES[426];
341
341
  o.writeHead(426,{"Content-Length":s.length,"Content-Type":"text/plain"}),o.end(s)}),this._server.listen(e.port,e.host,e.
342
342
  backlog,r)):e.server&&(this._server=e.server),this._server){let n=this.emit.bind(this,"connection");this._removeListeners=
343
- ma(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(o,s,i)=>{this.handleUpgrade(
343
+ Ea(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(o,s,i)=>{this.handleUpgrade(
344
344
  o,s,i,n)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=
345
- !1),this.options=e,this._state=eo}address(){if(this.options.noServer)throw new Error('The server is operating in "noServ\
346
- er" mode');return this._server?this._server.address():null}close(e){if(this._state===no){e&&this.once("close",()=>{e(new Error(
347
- "The server is not running"))}),process.nextTick(Ve,this);return}if(e&&this.once("close",e),this._state!==to)if(this._state=
348
- to,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=
345
+ !1),this.options=e,this._state=no}address(){if(this.options.noServer)throw new Error('The server is operating in "noServ\
346
+ er" mode');return this._server?this._server.address():null}close(e){if(this._state===io){e&&this.once("close",()=>{e(new Error(
347
+ "The server is not running"))}),process.nextTick(Ve,this);return}if(e&&this.once("close",e),this._state!==oo)if(this._state=
348
+ oo,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=
349
349
  null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(Ve,this):process.nextTick(Ve,this);else{let r=this.
350
350
  _server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{Ve(this)})}}shouldHandle(e){if(this.
351
351
  options.path){let r=e.url.indexOf("?");if((r!==-1?e.url.slice(0,r):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,r,n,o){
352
- r.on("error",ro);let s=e.headers["sec-websocket-key"],i=e.headers.upgrade,a=+e.headers["sec-websocket-version"];if(e.method!==
352
+ r.on("error",so);let s=e.headers["sec-websocket-key"],i=e.headers.upgrade,a=+e.headers["sec-websocket-version"];if(e.method!==
353
353
  "GET"){Ee(this,e,r,405,"Invalid HTTP method");return}if(i===void 0||i.toLowerCase()!=="websocket"){Ee(this,e,r,400,"Inva\
354
- lid Upgrade header");return}if(s===void 0||!ha.test(s)){Ee(this,e,r,400,"Missing or invalid Sec-WebSocket-Key header");return}
354
+ lid Upgrade header");return}if(s===void 0||!ga.test(s)){Ee(this,e,r,400,"Missing or invalid Sec-WebSocket-Key header");return}
355
355
  if(a!==13&&a!==8){Ee(this,e,r,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}
356
- if(!this.shouldHandle(e)){He(r,400);return}let c=e.headers["sec-websocket-protocol"],u=new Set;if(c!==void 0)try{u=ua.parse(
356
+ if(!this.shouldHandle(e)){He(r,400);return}let c=e.headers["sec-websocket-protocol"],u=new Set;if(c!==void 0)try{u=pa.parse(
357
357
  c)}catch{Ee(this,e,r,400,"Invalid Sec-WebSocket-Protocol header");return}let f=e.headers["sec-websocket-extensions"],p={};
358
358
  if(this.options.perMessageDeflate&&f!==void 0){let d=new ge({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.
359
- options.maxPayload});try{let y=Zn.parse(f);y[ge.extensionName]&&(d.accept(y[ge.extensionName]),p[ge.extensionName]=d)}catch{
359
+ options.maxPayload});try{let y=ro.parse(f);y[ge.extensionName]&&(d.accept(y[ge.extensionName]),p[ge.extensionName]=d)}catch{
360
360
  Ee(this,e,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let d={
361
361
  origin:e.headers[`${a===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.
362
362
  options.verifyClient.length===2){this.options.verifyClient(d,(y,E,S,x)=>{if(!y)return He(r,E||401,S,x);this.completeUpgrade(
363
363
  p,s,u,e,r,n,o)});return}if(!this.options.verifyClient(d))return He(r,401)}this.completeUpgrade(p,s,u,e,r,n,o)}completeUpgrade(e,r,n,o,s,i,a){
364
- if(!s.readable||!s.writable)return s.destroy();if(s[pa])throw new Error("server.handleUpgrade() was called more than onc\
365
- e with the same socket, possibly due to a misconfiguration");if(this._state>eo)return He(s,503);let u=["HTTP/1.1 101 Swi\
366
- tching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${ca("sha1").update(r+fa).digest("ba\
364
+ if(!s.readable||!s.writable)return s.destroy();if(s[ya])throw new Error("server.handleUpgrade() was called more than onc\
365
+ e with the same socket, possibly due to a misconfiguration");if(this._state>no)return He(s,503);let u=["HTTP/1.1 101 Swi\
366
+ tching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${fa("sha1").update(r+_a).digest("ba\
367
367
  se64")}`],f=new this.options.WebSocket(null,void 0,this.options);if(n.size){let p=this.options.handleProtocols?this.options.
368
368
  handleProtocols(n,o):n.values().next().value;p&&(u.push(`Sec-WebSocket-Protocol: ${p}`),f._protocol=p)}if(e[ge.extensionName]){
369
- let p=e[ge.extensionName].params,d=Zn.format({[ge.extensionName]:[p]});u.push(`Sec-WebSocket-Extensions: ${d}`),f._extensions=
369
+ let p=e[ge.extensionName].params,d=ro.format({[ge.extensionName]:[p]});u.push(`Sec-WebSocket-Extensions: ${d}`),f._extensions=
370
370
  e}this.emit("headers",u,o),s.write(u.concat(`\r
371
371
  `).join(`\r
372
- `)),s.removeListener("error",ro),f.setSocket(s,i,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.
372
+ `)),s.removeListener("error",so),f.setSocket(s,i,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.
373
373
  options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.
374
374
  options.skipUTF8Validation}),this.clients&&(this.clients.add(f),f.on("close",()=>{this.clients.delete(f),this._shouldEmitClose&&
375
- !this.clients.size&&process.nextTick(Ve,this)})),a(f,o)}};oo.exports=sr;function ma(t,e){for(let r of Object.keys(e))t.on(
376
- r,e[r]);return function(){for(let n of Object.keys(e))t.removeListener(n,e[n])}}function Ve(t){t._state=no,t.emit("close")}
377
- function ro(){this.destroy()}function He(t,e,r,n){r=r||ft.STATUS_CODES[e],n={Connection:"close","Content-Type":"text/htm\
375
+ !this.clients.size&&process.nextTick(Ve,this)})),a(f,o)}};ao.exports=ir;function Ea(t,e){for(let r of Object.keys(e))t.on(
376
+ r,e[r]);return function(){for(let n of Object.keys(e))t.removeListener(n,e[n])}}function Ve(t){t._state=io,t.emit("close")}
377
+ function so(){this.destroy()}function He(t,e,r,n){r=r||ft.STATUS_CODES[e],n={Connection:"close","Content-Type":"text/htm\
378
378
  l","Content-Length":Buffer.byteLength(r),...n},t.once("finish",t.destroy),t.end(`HTTP/1.1 ${e} ${ft.STATUS_CODES[e]}\r
379
379
  `+Object.keys(n).map(o=>`${o}: ${n[o]}`).join(`\r
380
380
  `)+`\r
381
381
  \r
382
382
  `+r)}function Ee(t,e,r,n,o,s){if(t.listenerCount("wsClientError")){let i=new Error(o);Error.captureStackTrace(i,Ee),t.emit(
383
- "wsClientError",i,r,e)}else He(r,n,o,s)}});import{createHash as ds}from"node:crypto";import{execFile as fs}from"node:child_process";import{readFile as At,rename as ps,
384
- rm as kr,stat as Lr,writeFile as jr}from"node:fs/promises";import he from"node:path";import{promisify as hs}from"node:util";function j(t){return String(t??"").trim()}function Tt(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;let e=Object.getPrototypeOf(t);return e===Object.prototype||
385
- e===null}var ou=Object.freeze(["plugins","apps","daemon_auto_start"]);var su=Object.freeze([[".tmp",/^(?:plugins(?:$|[.-])|git-|bundled-marketplaces$)/u],["cache",/^(?:remote_plugin_catalog|codex_apps_tools|codex_apps_server_info|codex_app_directory|bundled_plugin_exclusions)$/u]]);var ms=hs(fs);async function Mr({command:t,codexHome:e,bundled:r,additionalModels:n}){if(!he.isAbsolute(t))return null;let o=async i=>{
386
- let a=await Lr(i).catch(()=>null);return a&&[a.dev,a.ino,a.size,a.mtimeMs,a.ctimeMs]},s=await o(t);return s?ds("sha256").
383
+ "wsClientError",i,r,e)}else He(r,n,o,s)}});import{createHash as ms}from"node:crypto";import{execFile as _s}from"node:child_process";import{readFile as Pt,rename as ys,
384
+ rm as Dr,stat as zr,writeFile as Lr}from"node:fs/promises";import he from"node:path";import{promisify as gs}from"node:util";function j(t){return String(t??"").trim()}function At(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;let e=Object.getPrototypeOf(t);return e===Object.prototype||
385
+ e===null}var iu=Object.freeze(["plugins","apps","daemon_auto_start"]);var au=Object.freeze([[".tmp",/^(?:plugins(?:$|[.-])|git-|bundled-marketplaces$)/u],["cache",/^(?:remote_plugin_catalog|codex_apps_tools|codex_apps_server_info|codex_app_directory|bundled_plugin_exclusions)$/u]]);var Es=gs(_s);async function $r({command:t,codexHome:e,bundled:r,additionalModels:n}){if(!he.isAbsolute(t))return null;let o=async i=>{
386
+ let a=await zr(i).catch(()=>null);return a&&[a.dev,a.ino,a.size,a.mtimeMs,a.ctimeMs]},s=await o(t);return s?ms("sha256").
387
387
  update(JSON.stringify({command:t,binary:s,bundled:r,additionalModels:n,auth:await o(he.join(e,"auth.json")),config:await o(
388
- he.join(e,"config.toml"))})).digest("hex"):null}async function Ur({command:t,runtimeDir:e,bundled:r=!1,signal:n,additionalModels:o=[],
388
+ he.join(e,"config.toml"))})).digest("hex"):null}async function Br({command:t,runtimeDir:e,bundled:r=!1,signal:n,additionalModels:o=[],
389
389
  codexHome:s}){if(!s)throw new TypeError("prepareCodexModelCatalog requires the Codex home whose configuration the catalo\
390
390
  gue reads.");let i=he.join(e,"models.json"),a=he.join(e,"models.revision"),c={command:t,codexHome:s,bundled:r,additionalModels:o},
391
- u=await Mr(c);if(u&&await Lr(i).then(()=>!0,()=>!1)&&await At(a,"utf8").catch(()=>"")===u)return i;let f,p=new Map;try{let{
392
- stdout:S}=await ms(t,["debug","models",...r?["--bundled"]:[],"-c","check_for_update_on_startup=false"],{encoding:"utf8",
391
+ u=await $r(c);if(u&&await zr(i).then(()=>!0,()=>!1)&&await Pt(a,"utf8").catch(()=>"")===u)return i;let f,p=new Map;try{let{
392
+ stdout:S}=await Es(t,["debug","models",...r?["--bundled"]:[],"-c","check_for_update_on_startup=false"],{encoding:"utf8",
393
393
  maxBuffer:16777216,timeout:2e4,signal:n});if(f=JSON.parse(S),!Array.isArray(f?.models)||!f.models.length)throw new Error(
394
394
  "Invalid native model catalogue");for(let x of f.models){if(!x||typeof x.slug!="string"||!x.slug.trim()||p.has(x.slug))throw new Error(
395
395
  "Invalid native model catalogue");p.set(x.slug,x)}}catch{throw new Error("Codex could not load its model catalogue. Rest\
396
396
  art the assistant service after checking the Codex installation and connection.")}let d=f.models.reduce((S,x)=>Math.max(
397
- S,x.priority||0),0);for(let S of o)p.set(S.slug,{...S,priority:++d});let y=`${i}.tmp`;try{n?.throwIfAborted(),await kr(a,
398
- {force:!0}),await jr(y,JSON.stringify({...f,models:[...p.values()]}),{mode:384}),await ps(y,i)}finally{await kr(y,{force:!0})}
399
- let E=await Mr(c);return E&&await jr(a,E,{mode:384}),i}function Je(t=""){return Array.from(String(t)).some(e=>{let r=e.codePointAt(0);return r<=31||r===127})}function Pt({models:t}){return{models:t.map((e,r)=>({slug:e.id,display_name:e.label,description:e.label,default_reasoning_level:e.
397
+ S,x.priority||0),0);for(let S of o)p.set(S.slug,{...S,priority:++d});let y=`${i}.tmp`;try{n?.throwIfAborted(),await Dr(a,
398
+ {force:!0}),await Lr(y,JSON.stringify({...f,models:[...p.values()]}),{mode:384}),await ys(y,i)}finally{await Dr(y,{force:!0})}
399
+ let E=await $r(c);return E&&await Lr(a,E,{mode:384}),i}function Je(t=""){return Array.from(String(t)).some(e=>{let r=e.codePointAt(0);return r<=31||r===127})}function It({models:t}){return{models:t.map((e,r)=>({slug:e.id,display_name:e.label,description:e.label,default_reasoning_level:e.
400
400
  defaultThinking,supported_reasoning_levels:e.variants.map(n=>({effort:n,description:n})),shell_type:"shell_command",visibility:"\
401
401
  list",supported_in_api:!0,priority:r,base_instructions:"You are a coding assistant. Complete the user's task in the work\
402
402
  space, use the available tools, preserve unrelated work, and verify your changes.",supports_reasoning_summaries:!1,default_reasoning_summary:"\
403
403
  none",support_verbosity:!1,truncation_policy:{mode:"tokens",limit:1e4},context_window:e.contextWindow,max_context_window:e.
404
404
  contextWindow,effective_context_window_percent:95,supports_parallel_tool_calls:e.parallelToolCalls!==!1,experimental_supported_tools:[],
405
405
  input_modalities:e.images?["text","image"]:["text"],prefer_websockets:!1,...e.freeformPatch?{apply_patch_tool_type:"free\
406
- form"}:{}}))}}function $r(t){return he.join(t,"models.json")}async function De(t){let e=await At(he.join(t,"config.toml"),"utf8").catch(n=>{if(n.code==="ENOENT")return"";throw n});if(!/^model_provider = "custom"$/mu.
407
- test(e))return[];let r=JSON.parse(await At($r(t),"utf8"));if(!Array.isArray(r?.models))throw new Error("Codex custom end\
408
- point home is incomplete.");return r.models}var mu=Object.freeze(["none","pending","committed","rolledBack","unknown"]);function Ke(t,{fallback:e=""}={}){return String(t||"").trim()||e}function H(t){return!!(t&&typeof t=="object"&&!Array.isArray(t))}function oe(t,{fallback:e=0}={}){let r=Number(t);return!Number.isInteger(r)||r<1?e:r}var Eu=1024*1024,Su=256*1024;var wu=16*1024;import _s from"node:path";var ys=Object.freeze(["apps","artifact","browser_use","browser_use_external","browser_use_full_cdp_access","code_mode","\
406
+ form"}:{}}))}}function Vr(t){return he.join(t,"models.json")}async function De(t){let e=await Pt(he.join(t,"config.toml"),"utf8").catch(n=>{if(n.code==="ENOENT")return"";throw n});if(!/^model_provider = "custom"$/mu.
407
+ test(e))return[];let r=JSON.parse(await Pt(Vr(t),"utf8"));if(!Array.isArray(r?.models))throw new Error("Codex custom end\
408
+ point home is incomplete.");return r.models}var yu=Object.freeze(["none","pending","committed","rolledBack","unknown"]);function Ke(t,{fallback:e=""}={}){return String(t||"").trim()||e}function F(t){return!!(t&&typeof t=="object"&&!Array.isArray(t))}function oe(t,{fallback:e=0}={}){let r=Number(t);return!Number.isInteger(r)||r<1?e:r}var wu=1024*1024,bu=256*1024;var xu=16*1024;import Ss from"node:path";var ws=Object.freeze(["apps","artifact","browser_use","browser_use_external","browser_use_full_cdp_access","code_mode","\
409
409
  code_mode_host","computer_use","default_mode_request_user_input","deferred_executor","goals","hooks","image_generation",
410
410
  "in_app_browser","memories","multi_agent","multi_agent_v2","plugins","psp","recommended_plugins","request_permissions_to\
411
411
  ol","shell_tool","skill_mcp_dependency_install","skill_search","tool_call_mcp_elicitation","tool_suggest","unified_exec",
412
- "unified_exec_zsh_fork","view_image"]);function zr(t){if(!t||typeof t!="object"||Object.isFrozen(t))return t;for(let e of Object.
413
- values(t))zr(e);return Object.freeze(t)}function gs(t="",e={}){let r=new Error(j(t)||"Codex cannot prove the helper exec\
412
+ "unified_exec_zsh_fork","view_image"]);function Hr(t){if(!t||typeof t!="object"||Object.isFrozen(t))return t;for(let e of Object.
413
+ values(t))Hr(e);return Object.freeze(t)}function bs(t="",e={}){let r=new Error(j(t)||"Codex cannot prove the helper exec\
414
414
  ution policy.");r.code="codex_policy_unenforceable",r.details=Object.freeze({...e});for(let[n,o]of Object.entries(r.details))
415
- ["code","details","message","name"].includes(n)||(r[n]=o);return r}function Br({clientName:t="jskit",minimumVersion:e="0\
416
- .151.0",disabledFeatures:r=ys,limits:{userAgentMaxLength:n=512,mcpServerMaxCount:o=128,mcpServerNameMaxLength:s=256,configResponseMaxBytes:i=256*
415
+ ["code","details","message","name"].includes(n)||(r[n]=o);return r}function Fr({clientName:t="jskit",minimumVersion:e="0\
416
+ .151.0",disabledFeatures:r=ws,limits:{userAgentMaxLength:n=512,mcpServerMaxCount:o=128,mcpServerNameMaxLength:s=256,configResponseMaxBytes:i=256*
417
417
  1024,hookMaxCount:a=256,hookErrorMaxCount:c=256,hookFieldMaxLength:u=2048,hookFingerprintMaxLength:f=256*1024,hookResponseMaxBytes:p=512*
418
- 1024}={},createError:d=gs}={}){let y=new WeakSet;function E(l,h,m){let _=0;try{_=Buffer.byteLength(JSON.stringify(l),"ut\
418
+ 1024}={},createError:d=bs}={}){let y=new WeakSet;function E(l,h,m){let _=0;try{_=Buffer.byteLength(JSON.stringify(l),"ut\
419
419
  f8")}catch{throw d(`Codex helper execution received an invalid ${m}.`)}if(_>h)throw d(`Codex helper execution received a\
420
420
  n oversized ${m}.`)}function S(l){if(typeof l?.currentConnectionGeneration!="function")throw d("Codex helper execution c\
421
421
  annot verify the app-server connection generation.");let h=l.currentConnectionGeneration();if(!Number.isSafeInteger(h)||
422
422
  h<=0)throw d("Codex helper execution found no active app-server connection.");return h}async function x(l){if(typeof l?.
423
423
  currentHelperExecutionContext!="function")throw d("Codex helper execution requires its dedicated isolated provider.");let h=await l.
424
- currentHelperExecutionContext(),m=j(h?.cwd),_=j(h?.accountIdentitySignature);if(h?.executionMode!=="helper"||!m||!_s.isAbsolute(
424
+ currentHelperExecutionContext(),m=j(h?.cwd),_=j(h?.accountIdentitySignature);if(h?.executionMode!=="helper"||!m||!Ss.isAbsolute(
425
425
  m)||!/^sha256:[a-f0-9]{64}$/u.test(_))throw d("Codex helper runtime isolation could not be verified.");return Object.freeze(
426
426
  {accountIdentitySignature:_,cwd:m,executionMode:"helper"})}function A(l=""){let h=j(l).match(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/u);
427
427
  if(!h)return null;let m=h.slice(1).map(_=>Number.parseInt(_,10));return m.every(Number.isSafeInteger)?m:null}function I(l=""){
@@ -431,9 +431,9 @@ let h=j(l);if(!h||h.length>n||Je(h))return null;let m=`${t}/`;if(!h.startsWith(m
431
431
  let h=j(l.currentServerInfo()?.userAgent),m=I(h);if(!m)throw d("Codex helper execution received an unrecognised app-serv\
432
432
  er version. Update Codex and retry.",{minimumVersion:e});let _=m.join("."),w=A(e),b=m.findIndex((O,D)=>O!==w[D]);if(b!==
433
433
  -1&&m[b]<w[b])throw d(`Codex helper execution requires app-server ${e} or newer; current version is ${_}. Update Codex a\
434
- nd retry.`,{actualVersion:_,minimumVersion:e});return Object.freeze({minimumVersion:e,version:_})}function v(l=null){if(!Tt(
434
+ nd retry.`,{actualVersion:_,minimumVersion:e});return Object.freeze({minimumVersion:e,version:_})}function v(l=null){if(!At(
435
435
  l?.config))throw d("Codex helper execution could not read the effective app-server configuration.");let h=l.config.mcp_servers;
436
- if(h==null)return[];if(E(h,i,"MCP configuration"),!Tt(h))throw d("Codex helper execution received an invalid MCP server \
436
+ if(h==null)return[];if(E(h,i,"MCP configuration"),!At(h))throw d("Codex helper execution received an invalid MCP server \
437
437
  configuration.");let m=Object.keys(h);if(m.length>o||m.some(_=>!_||_.length>s||Je(_)))throw d("Codex helper execution re\
438
438
  ceived an oversized or invalid MCP server inventory.");return m.sort()}function k(l=null,h=""){if(E(l,p,"hook inventory"),
439
439
  !Array.isArray(l?.data))throw d("Codex helper execution could not enumerate app-server hooks.");if(l.data.length!==1)throw d(
@@ -451,7 +451,7 @@ O,{enabled:!1}]))},include_apps_instructions:!1,include_collaboration_mode_instr
451
451
  include_permissions_instructions:!1,...l?{model_reasoning_effort:l}:{},...h?{model_reasoning_summary:h}:{},mcp_servers:Object.
452
452
  fromEntries(_.map(O=>[O,{enabled:!1}])),memories:{dedicated_tools:!1,generate_memories:!1,use_memories:!1},notify:[],orchestrator:{
453
453
  mcp:{enabled:!1},skills:{enabled:!1}},project_doc_max_bytes:0,shell_environment_policy:{inherit:"none",set:{}},skills:{include_instructions:!1},
454
- tools:{experimental_request_user_input:{enabled:!1},update_plan:{enabled:!1}},web_search:"disabled"},b=zr(w);return y.add(
454
+ tools:{experimental_request_user_input:{enabled:!1},update_plan:{enabled:!1}},web_search:"disabled"},b=Hr(w);return y.add(
455
455
  b),b}function N(l,h,m,{effort:_="",summary:w=""}={}){let b=v(l),O=k(h,m);return{mcpServerNames:b,hookState:O,config:R({effort:_,
456
456
  summary:w,hookKeys:O.hookKeys,mcpServerNames:b})}}async function M(l,{effort:h="",summary:m=""}={}){if(T(l),typeof l?.readConfig!=
457
457
  "function"||typeof l?.listHooks!="function")throw d("Codex helper execution cannot inventory configuration and hooks.");
@@ -459,36 +459,36 @@ let _=await x(l),w=S(l),b=await l.readConfig({cwd:_.cwd,includeLayers:!1});if(S(
459
459
  cted during helper policy verification.");let O=await l.listHooks([_.cwd]);if(S(l)!==w)throw d("Codex app-server reconne\
460
460
  cted during helper policy verification.");let{mcpServerNames:D,hookState:P,config:Q}=N(b,O,_.cwd,{effort:h,summary:m});return Object.
461
461
  freeze({accountIdentitySignature:_.accountIdentitySignature,config:Q,connectionGeneration:w,executionCwd:_.cwd,hookFingerprint:P.
462
- fingerprint,hookKeys:Object.freeze([...P.hookKeys]),mcpServerNames:Object.freeze([...D])})}function V(l=null,h=null){return l?.
462
+ fingerprint,hookKeys:Object.freeze([...P.hookKeys]),mcpServerNames:Object.freeze([...D])})}function H(l=null,h=null){return l?.
463
463
  accountIdentitySignature===h?.accountIdentitySignature&&l?.connectionGeneration===h?.connectionGeneration&&l?.executionCwd===
464
464
  h?.executionCwd&&l?.hookFingerprint===h?.hookFingerprint&&JSON.stringify(l?.mcpServerNames||[])===JSON.stringify(h?.mcpServerNames||
465
- [])}function F(l,h,m=""){let _=j(m);if(!h)return l.codexAppServerHelperThreadId=_,l.codexAppServerHelperThreadRetired=!0,
465
+ [])}function q(l,h,m=""){let _=j(m);if(!h)return l.codexAppServerHelperThreadId=_,l.codexAppServerHelperThreadRetired=!0,
466
466
  l;let w=d("Codex could not retire a helper thread after policy verification failed.",{cleanupFailed:!0,threadId:_});return w.
467
467
  codexAppServerHelperThreadCleanupRequired=!0,w.codexAppServerHelperThreadId=_,w}async function G({error:l=null,provider:h=null,
468
- threadId:m=""}={}){let _=null;try{await h.deleteThread(m)}catch(w){_=w}throw F(l,_,m)}async function J(l,h,m,_,w){try{let b=await M(
469
- l,{effort:h.config.model_reasoning_effort,summary:h.config.model_reasoning_summary});if(!V(h,b))throw d(`Codex execution\
468
+ threadId:m=""}={}){let _=null;try{await h.deleteThread(m)}catch(w){_=w}throw q(l,_,m)}async function J(l,h,m,_,w){try{let b=await M(
469
+ l,{effort:h.config.model_reasoning_effort,summary:h.config.model_reasoning_summary});if(!H(h,b))throw d(`Codex execution\
470
470
  surfaces changed while the helper thread was ${w}.`);return Object.freeze({enforcement:b,thread:m,threadId:_})}catch(b){
471
- await G({error:b,provider:l,threadId:_})}}async function U(l,h){if(typeof l?.startThread!="function"||typeof l?.deleteThread!=
471
+ await G({error:b,provider:l,threadId:_})}}async function $(l,h){if(typeof l?.startThread!="function"||typeof l?.deleteThread!=
472
472
  "function")throw d("Codex helper execution cannot own and clean up its app-server thread.");let m=await h(),_=await l.startThread(
473
473
  m.settings),w=j(_?.id);if(!w)throw d("Codex app-server did not return a helper thread id.");return J(l,m.enforcement,_,w,
474
474
  "starting")}async function We(l,h,m){if(typeof l?.resumeThread!="function"||typeof l?.deleteThread!="function")throw d("\
475
475
  Codex helper execution cannot safely resume and clean up its app-server thread.");let _=j(h);if(!_)throw d("Codex helper\
476
476
  resume requires a controller-owned thread id.");let w=await m(),b=w.enforcement,O=await l.resumeThread(_,w.settings);return J(
477
477
  l,b,O,_,"resuming")}function be(l){return y.has(l)}function Xe({configResult:l,hookResult:h,workdir:m,effort:_="",summary:w=""}){
478
- return N(l,h,m,{effort:_,summary:w}).config}function Ot({approvalPolicy:l,baseInstructions:h,config:m,cwd:_,effectiveSettings:w,
478
+ return N(l,h,m,{effort:_,summary:w}).config}function vt({approvalPolicy:l,baseInstructions:h,config:m,cwd:_,effectiveSettings:w,
479
479
  sandbox:b,systemPrompt:O}){return{allowProviderModelFallback:!1,approvalPolicy:l,baseInstructions:h,config:m,cwd:_,systemPrompt:O||
480
- null,dynamicTools:[],environments:[],model:w.model,runtimeWorkspaceRoots:[],sandbox:b,selectedCapabilityRoots:[]}}function vt(l,h){
481
- return{...l,sessionStartSource:"startup",threadSource:h}}function Ct(l){return{approvalPolicy:l.approvalPolicy,baseInstructions:l.
480
+ null,dynamicTools:[],environments:[],model:w.model,runtimeWorkspaceRoots:[],sandbox:b,selectedCapabilityRoots:[]}}function Ct(l,h){
481
+ return{...l,sessionStartSource:"startup",threadSource:h}}function Tt(l){return{approvalPolicy:l.approvalPolicy,baseInstructions:l.
482
482
  baseInstructions,config:l.config,cwd:l.cwd,systemPrompt:l.systemPrompt,model:l.model,runtimeWorkspaceRoots:l.runtimeWorkspaceRoots,
483
483
  sandbox:l.sandbox}}function g({approvalPolicy:l,cwd:h,effectiveSettings:m,outputSchema:_}){let w={approvalPolicy:l,cwd:h,
484
484
  environments:[],model:m.model,outputSchema:_,runtimeWorkspaceRoots:[],sandboxPolicy:{networkAccess:!1,type:"readOnly"},summary:"\
485
485
  none"};return m.request.reasoning&&(w.effort=m.thinking),w}return Object.freeze({assertCompatibility:T,executionContext:x,
486
- inspect:M,configuration:Xe,hasConfiguration:be,threadSettings:Ot,threadStartSettings:vt,threadResumeSettings:Ct,turnSettings:g,
487
- start:U,resume:We})}var Cu=Br();import{spawn as Vs}from"node:child_process";import{chmod as _l,mkdir as yl,readFile as gl,readdir as El,rename as Hs,rm as Fs,
488
- stat as Sl,writeFile as qs}from"node:fs/promises";import Gs from"node:os";import Qr from"node:path";import{execFile as Os}from"node:child_process";import{readFile as It,readdir as vs}from"node:fs/promises";import{setTimeout as Vr}from"node:timers/promises";import{promisify as Cs}from"node:util";var Ts=Cs(Os);async function As(t){
489
- let{stdout:e}=await Ts("ps",t,{env:{...process.env,LC_ALL:"C",TZ:"UTC"},maxBuffer:67108864});return e}function Rt({runtimeTokenEnvironmentName:t="\
486
+ inspect:M,configuration:Xe,hasConfiguration:be,threadSettings:vt,threadStartSettings:Ct,threadResumeSettings:Tt,turnSettings:g,
487
+ start:$,resume:We})}var Au=Fr();import{spawn as Gs}from"node:child_process";import{chmod as gl,mkdir as El,readFile as Sl,readdir as wl,rename as Ws,rm as Xs,
488
+ stat as bl,writeFile as Js}from"node:fs/promises";import Ks from"node:os";import tn from"node:path";import{execFile as As}from"node:child_process";import{readFile as Rt,readdir as Ps}from"node:fs/promises";import{setTimeout as qr}from"node:timers/promises";import{promisify as Is}from"node:util";var Rs=Is(As);async function Ns(t){
489
+ let{stdout:e}=await Rs("ps",t,{env:{...process.env,LC_ALL:"C",TZ:"UTC"},maxBuffer:67108864});return e}function Nt({runtimeTokenEnvironmentName:t="\
490
490
  JSKIT_EXECUTION_RUNTIME_TOKEN",commandHashEnvironmentName:e="JSKIT_EXECUTION_COMMAND_HASH",label:r="Native",unavailableCode:n="\
491
- native_process_identity_unavailable",platform:o=process.platform,ps:s=As}={}){let a=o==="darwin"?100:25,c=1,u=Object.freeze(
491
+ native_process_identity_unavailable",platform:o=process.platform,ps:s=Ns}={}){let a=o==="darwin"?100:25,c=1,u=Object.freeze(
492
492
  {linux:"linux-proc",darwin:"darwin"}),f=u[o]||"",p=Object.freeze({RUNNING:"running",STOPPED:"stopped"}),d=Object.freeze(
493
493
  {ABSENT:"absent",AMBIGUOUS:"ambiguous",EXACT:"exact",INVALID:"invalid",MISMATCH:"mismatch"});function y(g={}){return!!(Number.
494
494
  isSafeInteger(Number(g.pid))&&Number(g.pid)>0&&T(g.processIdentity)&&[p.RUNNING,p.STOPPED].includes(g.processState))}function E(g){
@@ -498,44 +498,44 @@ kill(-l,0),!0}catch{return!1}}function x(g,l){let h=Number(g),m=process.platform
498
498
  m,l),!0}catch(_){if(!["ESRCH","EPERM"].includes(String(_?.code||"")))throw _;return!1}}function A(g=""){let l=String(g||
499
499
  ""),h=l.lastIndexOf(")");if(h<0)return null;let m=l.slice(h+1).trim().split(/\s+/u),_=String(m[0]||""),w=Number(m[1]),b=Number(
500
500
  m[2]),O=String(m[19]||"");return!/^[A-Z]$/u.test(_)||!Number.isSafeInteger(w)||w<0||!Number.isSafeInteger(b)||b<=0||!/^\d+$/u.
501
- test(O)?null:{parentPid:w,processGroupId:b,startTimeTicks:O,state:_}}function I(g={}){let l=H(g)?g:{};return{commandHash:j(
501
+ test(O)?null:{parentPid:w,processGroupId:b,startTimeTicks:O,state:_}}function I(g={}){let l=F(g)?g:{};return{commandHash:j(
502
502
  l.commandHash),platform:j(l.platform),runtimeToken:j(l.runtimeToken),startTimeTicks:j(l.startTimeTicks),version:Number(l.
503
503
  version||0)}}function T(g={}){let l=I(g);return!!(l.version===c&&Object.values(u).includes(l.platform)&&/^[a-f0-9]{12}$/u.
504
504
  test(l.commandHash)&&/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu.test(l.runtimeToken)&&/^\d+$/u.
505
505
  test(l.startTimeTicks))}function v(g=[],l=""){let h=g.find(m=>m.startsWith(`${l}=`));return h?h.slice(l.length+1):""}async function k(){
506
- let g=[],l=await vs("/proc",{withFileTypes:!0}).catch(()=>[]);for(let h of l){if(!h.isDirectory()||!/^\d+$/u.test(h.name))
507
- continue;let m=Number(h.name),_=await It(`/proc/${h.name}/stat`,"utf8").catch(()=>""),w=A(_);if(!w||w.state==="Z")continue;
508
- let b=null,O=!0;try{b=await It(`/proc/${h.name}/environ`)}catch(P){if(String(P?.code||"")==="ENOENT")continue;O=!1}let D=O?
506
+ let g=[],l=await Ps("/proc",{withFileTypes:!0}).catch(()=>[]);for(let h of l){if(!h.isDirectory()||!/^\d+$/u.test(h.name))
507
+ continue;let m=Number(h.name),_=await Rt(`/proc/${h.name}/stat`,"utf8").catch(()=>""),w=A(_);if(!w||w.state==="Z")continue;
508
+ let b=null,O=!0;try{b=await Rt(`/proc/${h.name}/environ`)}catch(P){if(String(P?.code||"")==="ENOENT")continue;O=!1}let D=O?
509
509
  b.toString("utf8").split("\0"):[];g.push({...w,commandHash:v(D,e),environmentReadable:O,pid:m,runtimeToken:v(D,t)})}return g}
510
510
  let R=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function N(g=""){let l=/^\w{3}\s+(\w{3})\s+(\d{1,2})\s+(\d{2}):(\d{2}):(\d{2})\s+(\d{4})$/u.
511
511
  exec(String(g).trim()),h=l?R.indexOf(l[1]):-1;if(h<0)return"";let[,,m,_,w,b,O]=l.map(Number);return String(Date.UTC(O,h,
512
512
  m,_,w,b)/1e3)}function M(g=""){let l=new Map;for(let h of String(g).split(`
513
- `)){let m=/^\s*(\d+) (.*)$/u.exec(h);m&&l.set(Number(m[1]),m[2])}return l}function V(g,l){if(g===void 0||!l?.startsWith(
514
- g))return null;let h=l.slice(g.length).split(/\s+/u).filter(m=>/^[^=\s]+=/u.test(m));return h.length?h:null}async function F(){
513
+ `)){let m=/^\s*(\d+) (.*)$/u.exec(h);m&&l.set(Number(m[1]),m[2])}return l}function H(g,l){if(g===void 0||!l?.startsWith(
514
+ g))return null;let h=l.slice(g.length).split(/\s+/u).filter(m=>/^[^=\s]+=/u.test(m));return h.length?h:null}async function q(){
515
515
  let g=process.getuid(),l=["-x","-U",String(g),"-ww","-o","pid=,command="],[h,m,_]=await Promise.all([s(["-ax","-o","pid=\
516
516
  ,pgid=,uid=,stat=,lstart="]),s(l),s(["-E",...l])]),w=M(m),b=M(_),O=[];for(let D of String(h).split(`
517
517
  `)){let P=/^\s*(\d+)\s+(\d+)\s+(\d+)\s+(\S+)\s+(\w{3}\s+\w{3}\s+\d{1,2}\s+[\d:]{8}\s+\d{4})\s*$/u.exec(D);if(!P||P[4].startsWith(
518
- "Z"))continue;let Q=Number(P[1]),Z=Number(P[3])===g?V(w.get(Q),b.get(Q)):null;O.push({commandHash:v(Z||[],e),environmentReadable:!!Z,
518
+ "Z"))continue;let Q=Number(P[1]),Z=Number(P[3])===g?H(w.get(Q),b.get(Q)):null;O.push({commandHash:v(Z||[],e),environmentReadable:!!Z,
519
519
  pid:Q,processGroupId:Number(P[2]),runtimeToken:v(Z||[],t),startTimeTicks:N(P[5])})}return O}function G(g){let l=Object.values(
520
520
  d).includes(g?.status)?g.status:d.AMBIGUOUS;return{processGroupIds:[...new Set((Array.isArray(g?.processGroupIds)?g.processGroupIds:
521
521
  []).map(Number).filter(h=>Number.isSafeInteger(h)&&h>0))],status:l}}async function J(g={}){if(!y(g))return{processGroupIds:[],
522
522
  status:d.INVALID};if(g.processState===p.STOPPED)return{processGroupIds:[],status:d.ABSENT};let l=g.processIdentity,h=l.platform!==
523
- f?null:o==="darwin"?await F().catch(()=>null):await k();if(!h)return{processGroupIds:[],status:d.AMBIGUOUS};let m=Number(
523
+ f?null:o==="darwin"?await q().catch(()=>null):await k();if(!h)return{processGroupIds:[],status:d.AMBIGUOUS};let m=Number(
524
524
  g.pid),_=h.filter(({processGroupId:P})=>P===m),w=[],b=_.some(({environmentReadable:P})=>!P);for(let P of h)P.environmentReadable&&
525
525
  P.runtimeToken===l.runtimeToken&&P.commandHash===l.commandHash&&w.push(P);let O=w.find(({pid:P})=>P===m);if(O&&O.startTimeTicks!==
526
526
  l.startTimeTicks)return{processGroupIds:[],status:d.AMBIGUOUS};if(w.length===0)return b?{processGroupIds:[],status:d.AMBIGUOUS}:
527
527
  {processGroupIds:[],status:_.length>0||S(m)?d.MISMATCH:d.ABSENT};let D=[...new Set(w.map(({processGroupId:P})=>P))];for(let P of D)
528
- if(h.filter(Z=>Z.processGroupId===P).some(Z=>!Z.environmentReadable||!w.some(({pid:os})=>os===Z.pid)))return{processGroupIds:[],
528
+ if(h.filter(Z=>Z.processGroupId===P).some(Z=>!Z.environmentReadable||!w.some(({pid:cs})=>cs===Z.pid)))return{processGroupIds:[],
529
529
  status:d.AMBIGUOUS};return _.some(P=>!w.some(({pid:Q})=>Q===P.pid))?{processGroupIds:[],status:d.AMBIGUOUS}:{processGroupIds:D,
530
- status:d.EXACT}}async function U(g={},l={}){let h=l.processIdentityInspector??J;return G(await h(g))}async function We(g={},l={},h=0){
531
- let m=Date.now()+h,_=await U(g,l);for(;Date.now()<m&&_.status===d.EXACT;)await Vr(100),_=await U(g,l);return _}async function be(g={},l={}){
530
+ status:d.EXACT}}async function $(g={},l={}){let h=l.processIdentityInspector??J;return G(await h(g))}async function We(g={},l={},h=0){
531
+ let m=Date.now()+h,_=await $(g,l);for(;Date.now()<m&&_.status===d.EXACT;)await qr(100),_=await $(g,l);return _}async function be(g={},l={}){
532
532
  let h=oe(l.processIdentitySettleTimeoutMs,{fallback:1e3}),m=oe(l.processIdentitySettlePollMs,{fallback:a}),_=Date.now()+
533
- h,w=await U(g,l);for(;w.status===d.AMBIGUOUS&&Date.now()<_;)await Vr(Math.min(m,Math.max(1,_-Date.now()))),w=await U(g,l);
533
+ h,w=await $(g,l);for(;w.status===d.AMBIGUOUS&&Date.now()<_;)await qr(Math.min(m,Math.max(1,_-Date.now()))),w=await $(g,l);
534
534
  return w}async function Xe(g={},l="SIGTERM",h={}){let m=h.signalProcessGroup??x,_=await be(g,h);if(_.status!==d.EXACT)return{
535
535
  inspection:_,signaledProcessGroups:[]};let w=Number(g.pid),b=[..._.processGroupIds.filter(D=>D!==w),..._.processGroupIds.
536
536
  filter(D=>D===w)],O=[];for(let D of b){let P=await be(g,h);if(P.status===d.ABSENT||P.status===d.MISMATCH)return{inspection:P,
537
537
  signaledProcessGroups:O};if(P.status!==d.EXACT)return{inspection:P,signaledProcessGroups:O};P.processGroupIds.includes(D)&&
538
- (m(D,l),O.push(D))}return{inspection:await be(g,h),signaledProcessGroups:O}}async function Ot(g={},l={}){if(!y(g))return{
538
+ (m(D,l),O.push(D))}return{inspection:await be(g,h),signaledProcessGroups:O}}async function vt(g={},l={}){if(!y(g))return{
539
539
  identityStatus:d.INVALID,processExitVerified:!1,stopped:!1};if(g.processState===p.STOPPED&&g.processExitVerifiedAt)return{
540
540
  alreadyStopped:!0,identityStatus:d.ABSENT,processExitVerified:!0,stopped:!1};let h=await be(g,l);if(h.status===d.ABSENT||
541
541
  h.status===d.MISMATCH)return{identityStatus:h.status,processExitVerified:!0,stopped:!1};if(h.status!==d.EXACT)return{identityStatus:h.
@@ -545,19 +545,19 @@ l.termTimeoutMs,{fallback:3e3})),w=[...m.signaledProcessGroups];if(_.status===d.
545
545
  [...new Set([...w,...O.signaledProcessGroups])],O.inspection.status===d.AMBIGUOUS)return{identityStatus:O.inspection.status,
546
546
  processExitVerified:!1,signaledProcessGroups:w,stopped:!1};_=await We(g,l,oe(l.killTimeoutMs,{fallback:1e3}))}let b=[d.ABSENT,
547
547
  d.MISMATCH].includes(_.status);return{descendantProcessGroups:w.filter(O=>O!==Number(g.pid)),identityStatus:_.status,pid:Number(
548
- g.pid),processExitVerified:b,signaledProcessGroups:w,stopped:b&&w.length>0}}async function vt(g){if(o!=="darwin")return A(
549
- await It(`/proc/${g}/stat`,"utf8").catch(()=>""));let l=String(await s(["-o","pgid=,lstart=","-p",String(g)]).catch(()=>"")),
550
- h=/^\s*(\d+)\s+(.+?)\s*$/u.exec(l);return h?{processGroupId:Number(h[1]),startTimeTicks:N(h[2])}:null}async function Ct({
548
+ g.pid),processExitVerified:b,signaledProcessGroups:w,stopped:b&&w.length>0}}async function Ct(g){if(o!=="darwin")return A(
549
+ await Rt(`/proc/${g}/stat`,"utf8").catch(()=>""));let l=String(await s(["-o","pgid=,lstart=","-p",String(g)]).catch(()=>"")),
550
+ h=/^\s*(\d+)\s+(.+?)\s*$/u.exec(l);return h?{processGroupId:Number(h[1]),startTimeTicks:N(h[2])}:null}async function Tt({
551
551
  commandHash:g="",pid:l=null,reportedIdentity:h=null,runtimeToken:m=""}={}){let _=j(g),w=j(m),b=I(h);if(T(b)&&b.commandHash===
552
- _&&b.runtimeToken===w)return b;let O=Number(l),D=f&&Number.isSafeInteger(O)&&O>0?await vt(O):null;if(!D?.startTimeTicks||
552
+ _&&b.runtimeToken===w)return b;let O=Number(l),D=f&&Number.isSafeInteger(O)&&O>0?await Ct(O):null;if(!D?.startTimeTicks||
553
553
  D.processGroupId!==O){let P=new Error(`${r} process identity could not be captured.`);throw P.code=n,P}return{commandHash:_,
554
554
  platform:f,runtimeToken:w,startTimeTicks:D.startTimeTicks,version:c}}return Object.freeze({normalize:I,isValid:T,normalizeInspection:G,
555
- capture:Ct,inspect:U,stop:Ot,isProcessAlive:E})}function Nt(t){return H(t)?{...t}:{}}var ee=class extends Error{constructor(e,r,n={}){super(r,n.cause===void 0?void 0:{cause:n.cause}),this.name="AppError",this.
556
- status=Number(e)||500,this.statusCode=this.status,this.code=n.code||"APP_ERROR",this.params=Nt(n.params),n.messageCode&&
557
- (this.messageCode=String(n.messageCode),this.messageParams=Nt(n.messageParams)),this.details=n.details,this.headers=n.headers||
558
- {}}};import{open as Ps,realpath as Fr}from"node:fs/promises";import{isUtf8 as Is}from"node:buffer";import{createServer as Rs}from"node:http";
559
- import Ns from"node:path";import{Readable as ks}from"node:stream";import{isDeepStrictEqual as qr}from"node:util";import{
560
- gunzipSync as js,zstdDecompressSync as Ms}from"node:zlib";var Ye=(t,e,r,n={})=>Object.freeze({id:t,contextWindow:e,variants:Object.freeze(r),...n}),Hr=Object.freeze([Object.freeze(
555
+ capture:Tt,inspect:$,stop:vt,isProcessAlive:E})}function kt(t){return F(t)?{...t}:{}}var ee=class extends Error{constructor(e,r,n={}){super(r,n.cause===void 0?void 0:{cause:n.cause}),this.name="AppError",this.
556
+ status=Number(e)||500,this.statusCode=this.status,this.code=n.code||"APP_ERROR",this.params=kt(n.params),n.messageCode&&
557
+ (this.messageCode=String(n.messageCode),this.messageParams=kt(n.messageParams)),this.details=n.details,this.headers=n.headers||
558
+ {}}};import{open as ks,realpath as Wr}from"node:fs/promises";import{isUtf8 as js}from"node:buffer";import{createServer as Ms}from"node:http";
559
+ import Ds from"node:path";import{Readable as Ls}from"node:stream";import{isDeepStrictEqual as Xr}from"node:util";import{
560
+ gunzipSync as $s,zstdDecompressSync as Us}from"node:zlib";var Ye=(t,e,r,n={})=>Object.freeze({id:t,contextWindow:e,variants:Object.freeze(r),...n}),Gr=Object.freeze([Object.freeze(
561
561
  {id:"deepseek",baseUrl:"https://api.deepseek.com/",claudeBaseUrl:"https://api.deepseek.com/anthropic",claudeAutoCompactWindow:786432,
562
562
  webSearch:!1,models:Object.freeze([Ye("deepseek-flash",1048576,["low","high","max"],{images:!0,freeformPatch:!0,codexHistoryRouting:!0}),
563
563
  Ye("deepseek-v4-pro",1048576,["low","high","max"],{freeformPatch:!0,codexHistoryRouting:!0})])}),Object.freeze({id:"zai-\
@@ -565,111 +565,111 @@ coding-plan",baseUrl:"https://api.z.ai/api/v1",claudeBaseUrl:"https://api.z.ai/a
565
565
  webSearch:!1,models:Object.freeze([Ye("glm-5.3",1048576,["low","high","max"],{freeformPatch:!0,codexHistoryRouting:!0})])}),
566
566
  Object.freeze({id:"zai",baseUrl:"https://api.z.ai/api/v1",claudeBaseUrl:"https://api.z.ai/api/anthropic",claudeAutoCompactWindow:1e6,
567
567
  webSearch:!1,models:Object.freeze([Ye("glm-5.3",1048576,["low","high","max"],{freeformPatch:!0,codexHistoryRouting:!0})])})]),
568
- se="custom";function re(t){return Hr.find(e=>e.id===t)||null}function Qe(t,e=""){for(let r of Hr){if(e&&r.id!==e)continue;let n=r.models.
569
- find(o=>o.id===t);if(n)return{...n,modelProviderId:r.id}}return null}var Jr=32*1024*1024,Ds=Object.freeze({chatgpt:"https://chatgpt.com/backend-api/codex",apiKey:"https://api.openai.com/v1",
568
+ se="custom";function re(t){return Gr.find(e=>e.id===t)||null}function Qe(t,e=""){for(let r of Gr){if(e&&r.id!==e)continue;let n=r.models.
569
+ find(o=>o.id===t);if(n)return{...n,modelProviderId:r.id}}return null}var Qr=32*1024*1024,zs=Object.freeze({chatgpt:"https://chatgpt.com/backend-api/codex",apiKey:"https://api.openai.com/v1",
570
570
  deepseek:re("deepseek").baseUrl.replace(/\/$/u,""),"zai-coding-plan":re("zai-coding-plan").baseUrl,zai:re("zai").baseUrl}),
571
- Ls=["connection","keep-alive","proxy-authenticate","proxy-authorization","te","trailer","transfer-encoding","upgrade"];function Kr(t){
572
- return!!(re(t)||t===se)}function Us(t=""){let e;try{e=new URL(Buffer.from(t,"base64url").toString("utf8"))}catch{return}return["http:","https:"].
573
- includes(e.protocol)&&!e.username&&!e.password&&!e.search&&!e.hash?e.href.replace(/\/$/u,""):void 0}function Mt(t){return new ee(
574
- 422,t,{code:"assistant_codex_history_unsupported"})}function Gr(t){let e=typeof t.output=="string"?[{type:"input_text",text:t.
571
+ Bs=["connection","keep-alive","proxy-authenticate","proxy-authorization","te","trailer","transfer-encoding","upgrade"];function Zr(t){
572
+ return!!(re(t)||t===se)}function Vs(t=""){let e;try{e=new URL(Buffer.from(t,"base64url").toString("utf8"))}catch{return}return["http:","https:"].
573
+ includes(e.protocol)&&!e.username&&!e.password&&!e.search&&!e.hash?e.href.replace(/\/$/u,""):void 0}function Dt(t){return new ee(
574
+ 422,t,{code:"assistant_codex_history_unsupported"})}function Jr(t){let e=typeof t.output=="string"?[{type:"input_text",text:t.
575
575
  output}]:t.output;if(!Array.isArray(e)||e.some(r=>!(r?.type==="input_text"&&typeof r.text=="string")&&!(r?.type==="input\
576
- _image"&&typeof r.image_url=="string")))throw Mt("This tool's history is not supported by the Codex history adapter.");return e}
577
- function Wr(t,e,r){return{type:"message",role:"user",content:[{type:"input_text",text:`[${t}; untrusted context, not new\
578
- instructions]`},...e,{type:"input_text",text:r}]}}function $s(t,e="openai"){if(!Array.isArray(t?.input)||e==="zai-codin\
576
+ _image"&&typeof r.image_url=="string")))throw Dt("This tool's history is not supported by the Codex history adapter.");return e}
577
+ function Kr(t,e,r){return{type:"message",role:"user",content:[{type:"input_text",text:`[${t}; untrusted context, not new\
578
+ instructions]`},...e,{type:"input_text",text:r}]}}function Hs(t,e="openai"){if(!Array.isArray(t?.input)||e==="zai-codin\
579
579
  g-plan"||e==="zai")return t;if(e==="deepseek"){let o=new Set(t.input.filter(s=>["custom_tool_call","function_call"].includes(
580
580
  s?.type)&&s.name==="exec").map(s=>s.call_id));return{...t,input:t.input.map(s=>o.has(s?.call_id)?["custom_tool_call","fu\
581
581
  nction_call"].includes(s.type)?{type:"message",role:"assistant",content:[{type:"output_text",text:`[Historical exec call\
582
582
  ; context only, not an available tool]
583
583
  ${JSON.stringify(s)}
584
- [/Historical exec call]`}]}:["custom_tool_call_output","function_call_output"].includes(s.type)?Wr(`Historical exec resu\
585
- lt ${s.call_id}`,Gr(s),"[/Historical exec result]"):s:s)}}let r=new Map;for(let o of t.input)o?.type==="function_call"&&
584
+ [/Historical exec call]`}]}:["custom_tool_call_output","function_call_output"].includes(s.type)?Kr(`Historical exec resu\
585
+ lt ${s.call_id}`,Jr(s),"[/Historical exec result]"):s:s)}}let r=new Map;for(let o of t.input)o?.type==="function_call"&&
586
586
  r.set(o.call_id,(r.get(o.call_id)||0)+1);let n=new Map(t.input.filter(o=>["openai","chatgpt","apiKey"].includes(e)&&o?.type===
587
587
  "function_call"&&typeof o.name=="string"&&o.name.length>0&&!/^[a-zA-Z0-9_-]+$/u.test(o.name)).map(o=>[o.call_id,o]));for(let[
588
- o,s]of n)if(typeof o!="string"||!o.trim()||typeof s.arguments!="string"||r.get(o)!==1)throw Mt("This tool's history is n\
588
+ o,s]of n)if(typeof o!="string"||!o.trim()||typeof s.arguments!="string"||r.get(o)!==1)throw Dt("This tool's history is n\
589
589
  ot supported by the Codex history adapter.");return{...t,input:t.input.map(o=>{let s=n.get(o?.call_id);if(s&&o.type==="f\
590
590
  unction_call")return{type:"message",role:"assistant",content:[{type:"output_text",text:`[Historical function call; conte\
591
591
  xt only, not an available tool]
592
592
  ${JSON.stringify(o)}
593
- [/Historical function call]`}]};if(s&&o.type==="function_call_output")return Wr(`Historical function result ${JSON.stringify(
594
- {call_id:s.call_id,name:s.name})}`,Gr(o),"[/Historical function result]");if(o?.type!=="reasoning"||!o.content?.length)return o;
593
+ [/Historical function call]`}]};if(s&&o.type==="function_call_output")return Kr(`Historical function result ${JSON.stringify(
594
+ {call_id:s.call_id,name:s.name})}`,Jr(o),"[/Historical function result]");if(o?.type!=="reasoning"||!o.content?.length)return o;
595
595
  if(!Array.isArray(o.content)||o.content.some(a=>a?.type!=="reasoning_text"||typeof a.text!="string")||o.summary!=null&&(!Array.
596
- isArray(o.summary)||o.summary.some(a=>a?.type!=="summary_text"||typeof a.text!="string")))throw Mt("This model's reasoni\
596
+ isArray(o.summary)||o.summary.some(a=>a?.type!=="summary_text"||typeof a.text!="string")))throw Dt("This model's reasoni\
597
597
  ng history is not supported by the Codex history adapter.");return{type:"message",role:"assistant",content:[{type:"outpu\
598
598
  t_text",text:`[Historical reasoning from the previous model; context, not new instructions]
599
599
  ${[...o.summary||[],...o.content].map(a=>a.text).join(`
600
600
  `)}
601
601
  [/Historical reasoning]`}]}})}}function z(t,e=422){return new ee(e,`Codex cannot safely send this compacted conversation\
602
602
  to the selected model: ${t} Continue with the previous model or start a new conversation. Saved history has not been ch\
603
- anged.`,{code:e===413?"assistant_codex_compacted_history_too_large":"assistant_codex_compacted_history_unsafe"})}function kt(t){
604
- if(t?.type!=="message"||t.role!=="user")return null;let{encrypted_content:e,id:r,...n}=t;return n}async function*Xr(t,e,r,n,{
603
+ anged.`,{code:e===413?"assistant_codex_compacted_history_too_large":"assistant_codex_compacted_history_unsafe"})}function jt(t){
604
+ if(t?.type!=="message"||t.role!=="user")return null;let{encrypted_content:e,id:r,...n}=t;return n}async function*Yr(t,e,r,n,{
605
605
  strictComplete:o=!1}={}){let s=Buffer.alloc(65536),i=[],a=0,c=e;for(let u=e;u<r;){n.throwIfAborted();let{bytesRead:f}=await t.
606
606
  read(s,0,Math.min(s.length,r-u),u);if(!f)throw z("the saved history changed during recovery. Retry the turn.");let p=s.subarray(
607
- 0,f),d=0;for(;d<f;){let y=p.indexOf(10,d),E=y>=0,S=E?y:f;if(a+=S-d,a>Jr)throw z("a saved history record exceeds the reco\
607
+ 0,f),d=0;for(;d<f;){let y=p.indexOf(10,d),E=y>=0,S=E?y:f;if(a+=S-d,a>Qr)throw z("a saved history record exceeds the reco\
608
608
  very size limit.",413);if(i.push(Buffer.from(s.subarray(d,S))),E){if(n.throwIfAborted(),a){let x=Buffer.concat(i,a);if(o&&
609
- !Is(x))throw z("the saved history contains invalid UTF-8.");yield{row:JSON.parse(x.toString("utf8")),offset:c}}i=[],a=0,
610
- c=u+y+1}d=S+(E?1:0)}u+=f}if(o&&a)throw z("the saved history has an incomplete final record.")}async function zs(t,{destination:e,
611
- historyPath:r,codexHome:n,signal:o,maxRequestBytes:s}){if(!Kr(e)||!Array.isArray(t?.input)||!t.input.some(p=>p?.type==="\
609
+ !js(x))throw z("the saved history contains invalid UTF-8.");yield{row:JSON.parse(x.toString("utf8")),offset:c}}i=[],a=0,
610
+ c=u+y+1}d=S+(E?1:0)}u+=f}if(o&&a)throw z("the saved history has an incomplete final record.")}async function Fs(t,{destination:e,
611
+ historyPath:r,codexHome:n,signal:o,maxRequestBytes:s}){if(!Zr(e)||!Array.isArray(t?.input)||!t.input.some(p=>p?.type==="\
612
612
  compaction"))return t;let i=e===se?{modelProviderId:e,codexHistoryRouting:!0}:Qe(t.model,e);if(i?.modelProviderId!==e||!i.
613
613
  codexHistoryRouting)throw z("this model has not been qualified for history recovery.");if(!r||!n)throw z("the native his\
614
614
  tory location is unavailable.");o.throwIfAborted();let a,c=new Map(t.input.filter(p=>p?.type==="compaction").map(p=>[p.encrypted_content,
615
- {count:0}]));try{let p=await Fr(n),d=await Fr(r),y=Ns.relative(p,d),E=/^(?:sessions\/\d{4}\/\d{2}\/\d{2}|archived_sessions)\/rollout-[^/]+-([0-9a-f-]{36})\.jsonl$/iu.
616
- exec(y);if(!E)throw z("the history is outside this Codex runtime's saved conversations.");a=await Ps(d,"r");let S=await a.
617
- stat();if(!S.isFile())throw z("the saved history is not a regular file.");let x=0,A=0;for await(let{row:T,offset:v}of Xr(
615
+ {count:0}]));try{let p=await Wr(n),d=await Wr(r),y=Ds.relative(p,d),E=/^(?:sessions\/\d{4}\/\d{2}\/\d{2}|archived_sessions)\/rollout-[^/]+-([0-9a-f-]{36})\.jsonl$/iu.
616
+ exec(y);if(!E)throw z("the history is outside this Codex runtime's saved conversations.");a=await ks(d,"r");let S=await a.
617
+ stat();if(!S.isFile())throw z("the saved history is not a regular file.");let x=0,A=0;for await(let{row:T,offset:v}of Yr(
618
618
  a,0,S.size,o)){if(T.type==="session_meta"&&(x+=1,T.payload?.id!==E[1]||T.payload?.forked_from_id))throw z("the saved his\
619
619
  tory does not identify one supported conversation.");if(T.type==="event_msg"&&T.payload?.type==="thread_rolled_back")throw z(
620
620
  "history recovery after Undo is not supported yet.");if(T.type!=="compacted")continue;let k=T.payload?.replacement_history;
621
621
  for(let[R,N]of c)typeof R=="string"&&R.length&&k?.some(M=>M?.type==="compaction"&&M.encrypted_content===R)&&(N.count+=1,
622
- N.start=A,N.end=v,N.retainedUsers=k.map(kt).filter(Boolean));typeof T.payload?.message=="string"&&T.payload.message.trim()&&
622
+ N.start=A,N.end=v,N.retainedUsers=k.map(jt).filter(Boolean));typeof T.payload?.message=="string"&&T.payload.message.trim()&&
623
623
  Array.isArray(k)&&k.length&&!k.some(R=>R?.type==="compaction")&&(A=v)}if(x!==1)throw z("the saved history does not ident\
624
624
  ify one supported conversation.");let I=0;for(let T of c.values()){if(T.count!==1)throw z("its exact saved compaction bo\
625
- undary could not be identified.");T.history=[];for await(let{row:v,offset:k}of Xr(a,T.start,T.end,o)){let R=[];v.type===
625
+ undary could not be identified.");T.history=[];for await(let{row:v,offset:k}of Yr(a,T.start,T.end,o)){let R=[];v.type===
626
626
  "response_item"?R=[v.payload]:v.type==="compacted"&&k===T.start&&(R=v.payload.replacement_history);for(let N of R||[])if(!(N?.
627
627
  type==="compaction"||N?.type==="message"&&["developer","system"].includes(N.role))){if(I+=Buffer.byteLength(JSON.stringify(
628
628
  N)),I>s)throw z("the recovered history exceeds the request size limit.",413);T.history.push(N)}}}}catch(p){throw o.aborted||
629
629
  p.statusCode?p:z("the native history could not be read completely.")}finally{await a?.close()}let u=[],f=Buffer.byteLength(
630
630
  JSON.stringify(t));for(let[p,d]of t.input.entries()){if(u.push(d),d?.type!=="compaction")continue;let y=c.get(d.encrypted_content).
631
- history,E=t.input.slice(0,p).map(kt).filter(Boolean),S=c.get(d.encrypted_content).retainedUsers.filter(v=>{let k=E.findIndex(
632
- R=>qr(R,v));return k<0?!1:(E.splice(k,1),!0)}),x=[],A=[],I=0;for(let v of y){if(!["message","agent_message","reasoning",
631
+ history,E=t.input.slice(0,p).map(jt).filter(Boolean),S=c.get(d.encrypted_content).retainedUsers.filter(v=>{let k=E.findIndex(
632
+ R=>Xr(R,v));return k<0?!1:(E.splice(k,1),!0)}),x=[],A=[],I=0;for(let v of y){if(!["message","agent_message","reasoning",
633
633
  "function_call","function_call_output","custom_tool_call","custom_tool_call_output"].includes(v?.type))throw z("the save\
634
- d history contains an unsupported item.");let{encrypted_content:k,id:R,...N}=v,M=kt(v),V=A.length;for(let G of["content",
634
+ d history contains an unsupported item.");let{encrypted_content:k,id:R,...N}=v,M=jt(v),H=A.length;for(let G of["content",
635
635
  "summary","output"]){let J=v[G];if(!(J==null||typeof J=="string")){if(!Array.isArray(J))throw z("the saved history conta\
636
- ins unsupported content.");N[G]=J.map(U=>{if(["input_text","output_text","reasoning_text","summary_text"].includes(U?.type)&&
637
- typeof U.text=="string")return U;if(v.type==="agent_message"&&G==="content"&&U?.type==="encrypted_content"&&typeof U.encrypted_content==
638
- "string"&&U.encrypted_content)return{type:"input_text",text:"[Encrypted agent-message content is unavailable to this pro\
639
- vider; retained in saved native history.]"};if(U?.type==="input_image"&&typeof U.image_url=="string"&&U.image_url){if(!i.
640
- images)throw z("the selected model does not support images in recovered history.");return A.push(U),{type:"input_image",
641
- archived_image:A.length}}throw z("recovery of this non-text history is not supported yet.")})}}let F=M&&S.findIndex(G=>qr(
642
- G,M));if(M&&F>=0){S.splice(F,1),A.length=V,I+=1;continue}v.type==="reasoning"&&!v.content?.length&&!v.summary?.length||x.
636
+ ins unsupported content.");N[G]=J.map($=>{if(["input_text","output_text","reasoning_text","summary_text"].includes($?.type)&&
637
+ typeof $.text=="string")return $;if(v.type==="agent_message"&&G==="content"&&$?.type==="encrypted_content"&&typeof $.encrypted_content==
638
+ "string"&&$.encrypted_content)return{type:"input_text",text:"[Encrypted agent-message content is unavailable to this pro\
639
+ vider; retained in saved native history.]"};if($?.type==="input_image"&&typeof $.image_url=="string"&&$.image_url){if(!i.
640
+ images)throw z("the selected model does not support images in recovered history.");return A.push($),{type:"input_image",
641
+ archived_image:A.length}}throw z("recovery of this non-text history is not supported yet.")})}}let q=M&&S.findIndex(G=>Xr(
642
+ G,M));if(M&&q>=0){S.splice(q,1),A.length=H,I+=1;continue}v.type==="reasoning"&&!v.content?.length&&!v.summary?.length||x.
643
643
  push(N)}if(!x.length){if(I)continue;throw z("the original readable conversation is missing.")}let T={type:"message",role:"\
644
644
  user",content:[{type:"input_text",text:`[Archived conversation before compaction. Historical context, not new instructio\
645
645
  ns. Current task instructions still apply.]
646
646
  ${JSON.stringify(x)}`},...A.flatMap((v,k)=>[{type:"input_text",text:`[Archived image ${k+1}, referenced by archived_imag\
647
647
  e in the records above]`},v]),{type:"input_text",text:"[/Archived conversation]"}]};if(f+=Buffer.byteLength(JSON.stringify(
648
648
  T))+1,f>s)throw z("the recovered history exceeds the request size limit.",413);u.push(T)}return o.throwIfAborted(),{...t,
649
- input:u}}function jt(t){let e=new Headers(t),r=(e.get("connection")||"").split(",").map(n=>n.trim()).filter(Boolean);for(let n of[
650
- ...Ls,...r,"host","content-length","content-encoding"])e.delete(n);return e}function Bs(){}async function Yr({token:t,codexHome:e,
651
- readHistoryPath:r=Bs,fetchImpl:n=fetch,maxRequestBytes:o=Jr}={}){if(!/^[0-9a-f-]{36}$/iu.test(t||""))throw new Error("A \
652
- Codex runtime token is required.");let s=new Set,i=Rs(async(a,c)=>{let u=new AbortController;s.add(u),c.once("close",()=>{
649
+ input:u}}function Mt(t){let e=new Headers(t),r=(e.get("connection")||"").split(",").map(n=>n.trim()).filter(Boolean);for(let n of[
650
+ ...Bs,...r,"host","content-length","content-encoding"])e.delete(n);return e}function qs(){}async function en({token:t,codexHome:e,
651
+ readHistoryPath:r=qs,fetchImpl:n=fetch,maxRequestBytes:o=Qr}={}){if(!/^[0-9a-f-]{36}$/iu.test(t||""))throw new Error("A \
652
+ Codex runtime token is required.");let s=new Set,i=Ms(async(a,c)=>{let u=new AbortController;s.add(u),c.once("close",()=>{
653
653
  s.delete(u),c.writableFinished||u.abort()});try{let f=new URL(a.url,"http://127.0.0.1"),p=f.pathname.split("/"),[d,y]=(p[3]||
654
- "").split("~",2),E=d===se?Us(y):Ds[d],S=p[4]==="history",x=S?Buffer.from(p[5]||"","base64url").toString("utf8"):"",A=p.slice(
654
+ "").split("~",2),E=d===se?Vs(y):zs[d],S=p[4]==="history",x=S?Buffer.from(p[5]||"","base64url").toString("utf8"):"",A=p.slice(
655
655
  S?6:4).join("/");if(p[1]!==t||p[2]!=="v2"||!E||!(a.method==="POST"&&["responses","responses/compact"].includes(A)||a.method===
656
- "GET"&&A==="models")){c.writeHead(404).end();return}let I;if(a.method==="POST"){let R=[],N=0;for await(let F of a){if(N+=
657
- F.length,N>o)throw new ee(413,"Codex history exceeds the adapter request limit.",{code:"assistant_codex_history_request_\
658
- too_large"});R.push(F)}let M=Buffer.concat(R),V=a.headers["content-encoding"];try{if(V==="zstd")M=Ms(M,{maxOutputLength:o});else if(V===
659
- "gzip")M=js(M,{maxOutputLength:o});else if(V&&V!=="identity")throw new Error("Unsupported encoding");I=JSON.parse(M.toString(
656
+ "GET"&&A==="models")){c.writeHead(404).end();return}let I;if(a.method==="POST"){let R=[],N=0;for await(let q of a){if(N+=
657
+ q.length,N>o)throw new ee(413,"Codex history exceeds the adapter request limit.",{code:"assistant_codex_history_request_\
658
+ too_large"});R.push(q)}let M=Buffer.concat(R),H=a.headers["content-encoding"];try{if(H==="zstd")M=Us(M,{maxOutputLength:o});else if(H===
659
+ "gzip")M=$s(M,{maxOutputLength:o});else if(H&&H!=="identity")throw new Error("Unsupported encoding");I=JSON.parse(M.toString(
660
660
  "utf8"))}catch{throw new ee(400,"Codex sent an unreadable or oversized history request.",{code:"assistant_codex_history_\
661
- request_unreadable"})}if(!x&&Kr(d)&&Array.isArray(I?.input)&&I.input.some(F=>F?.type==="compaction")&&(x=await r(u.signal)),
662
- I=await zs(I,{destination:d,historyPath:x,codexHome:e,signal:u.signal,maxRequestBytes:o}),I=JSON.stringify($s(I,d)),Buffer.
663
- byteLength(I)>o)throw z("the translated history exceeds the request size limit.",413)}let T=jt(a.headers);T.set("accept-\
661
+ request_unreadable"})}if(!x&&Zr(d)&&Array.isArray(I?.input)&&I.input.some(q=>q?.type==="compaction")&&(x=await r(u.signal)),
662
+ I=await Fs(I,{destination:d,historyPath:x,codexHome:e,signal:u.signal,maxRequestBytes:o}),I=JSON.stringify(Hs(I,d)),Buffer.
663
+ byteLength(I)>o)throw z("the translated history exceeds the request size limit.",413)}let T=Mt(a.headers);T.set("accept-\
664
664
  encoding","identity");let v;try{v=await n(`${E}/${A}${f.search}`,{method:a.method,headers:T,body:I,signal:u.signal,redirect:"\
665
665
  error"})}catch(R){throw d!==se||u.signal.aborted?R:Object.assign(new ee(502,`Your model server at ${E} isn't answering. \
666
666
  Start it, then send your message again.`,{code:"assistant_custom_endpoint_unreachable"}),{params:{upstream:E}})}if(d==="\
667
667
  deepseek"&&v.status===400&&v.headers.get("content-type")?.split(";",1)[0].trim()==="application/json"){let R=Buffer.from(
668
- await v.arrayBuffer());try{let N=JSON.parse(R.toString("utf8")),M=N?.error,V=typeof M?.message=="string"&&/^This model's maximum context length is ([1-9]\d*) tokens\. However, you requested ([1-9]\d*) tokens \((\d+) in the messages, (\d+) in the completion\)\. Please reduce the length of the messages or completion\. \(request_id: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\)$/u.
669
- exec(M.message);if(M?.type==="invalid_request_error"&&M.code==="invalid_request_error"&&V){let[F,G,J,U]=V.slice(1).map(Number);
670
- [F,G,J,U].every(Number.isSafeInteger)&&G>F&&G===J+U&&(M.code="context_length_exceeded",R=Buffer.from(JSON.stringify(N)))}}catch{}
671
- c.writeHead(v.status,Object.fromEntries(jt(v.headers))).end(R);return}if(c.writeHead(v.status,Object.fromEntries(jt(v.headers))),
672
- !v.body){c.end();return}let k=ks.fromWeb(v.body);k.once("error",()=>c.destroy()),c.once("close",()=>k.destroy()),k.pipe(
668
+ await v.arrayBuffer());try{let N=JSON.parse(R.toString("utf8")),M=N?.error,H=typeof M?.message=="string"&&/^This model's maximum context length is ([1-9]\d*) tokens\. However, you requested ([1-9]\d*) tokens \((\d+) in the messages, (\d+) in the completion\)\. Please reduce the length of the messages or completion\. \(request_id: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\)$/u.
669
+ exec(M.message);if(M?.type==="invalid_request_error"&&M.code==="invalid_request_error"&&H){let[q,G,J,$]=H.slice(1).map(Number);
670
+ [q,G,J,$].every(Number.isSafeInteger)&&G>q&&G===J+$&&(M.code="context_length_exceeded",R=Buffer.from(JSON.stringify(N)))}}catch{}
671
+ c.writeHead(v.status,Object.fromEntries(Mt(v.headers))).end(R);return}if(c.writeHead(v.status,Object.fromEntries(Mt(v.headers))),
672
+ !v.body){c.end();return}let k=Ls.fromWeb(v.body);k.once("error",()=>c.destroy()),c.once("close",()=>k.destroy()),k.pipe(
673
673
  c)}catch(f){if(c.destroyed)return;if(c.headersSent){c.destroy();return}c.writeHead(f.statusCode||502,{"content-type":"ap\
674
674
  plication/json"}).end(JSON.stringify({error:{message:f.statusCode?f.message:"The Codex history adapter could not reach t\
675
675
  he model provider. Retry the turn."}}))}});return i.on("upgrade",(a,c)=>{c.end(`HTTP/1.1 426 Upgrade Required\r
@@ -678,169 +678,175 @@ Content-Length: 0\r
678
678
  \r
679
679
  `)}),await new Promise((a,c)=>{i.once("error",c),i.listen(0,"127.0.0.1",()=>{i.removeListener("error",c),a()})}),{baseUrl:`\
680
680
  http://127.0.0.1:${i.address().port}/${t}/v2`,server:i,async close(){for(let c of s)c.abort();let a=new Promise(c=>i.close(
681
- c));i.closeAllConnections(),await a}}}var Zr=Object.freeze({HELPER:"helper",INTERACTIVE:"interactive"}),Al=Rt();async function Dt({runtimeDir:t,command:e,args:r=[],
681
+ c));i.closeAllConnections(),await a}}}var rn=Object.freeze({HELPER:"helper",INTERACTIVE:"interactive"}),Il=Nt();async function Lt({runtimeDir:t,command:e,args:r=[],
682
682
  runtimeToken:n,bundled:o=!1,additionalModels:s=[],env:i}){if(!i)throw new TypeError("runCodexAppServerProcess requires t\
683
- he application's environment, such as process.env.");let a=Qr.join(t,"history-adapter.json"),c=new AbortController,u=()=>c.
684
- abort();process.once("SIGTERM",u),process.once("SIGINT",u);let f=i.CODEX_HOME||Qr.join(Gs.homedir(),".codex"),p=await De(
685
- f),d=await Ur({command:e,runtimeDir:t,bundled:o,additionalModels:[...s,...p],codexHome:f,signal:c.signal}),y=await Yr({token:n,
686
- codexHome:f});await qs(`${a}.tmp`,JSON.stringify({baseUrl:y.baseUrl,runtimeToken:n}),{mode:384}),await Hs(`${a}.tmp`,a);
687
- let E=Vs(e,[...r,"-c",`model_catalog_json=${JSON.stringify(d)}`],{stdio:"inherit"}),S=!1,x;function A(T="SIGTERM"){S||(S=
683
+ he application's environment, such as process.env.");let a=tn.join(t,"history-adapter.json"),c=new AbortController,u=()=>c.
684
+ abort();process.once("SIGTERM",u),process.once("SIGINT",u);let f=i.CODEX_HOME||tn.join(Ks.homedir(),".codex"),p=await De(
685
+ f),d=await Br({command:e,runtimeDir:t,bundled:o,additionalModels:[...s,...p],codexHome:f,signal:c.signal}),y=await en({token:n,
686
+ codexHome:f});await Js(`${a}.tmp`,JSON.stringify({baseUrl:y.baseUrl,runtimeToken:n}),{mode:384}),await Ws(`${a}.tmp`,a);
687
+ let E=Gs(e,[...r,"-c",`model_catalog_json=${JSON.stringify(d)}`],{stdio:"inherit"}),S=!1,x;function A(T="SIGTERM"){S||(S=
688
688
  !0,y.close(),E.kill(T),x=setTimeout(()=>E.kill("SIGKILL"),5e3),x.unref())}process.on("SIGTERM",()=>A()),process.on("SIGI\
689
689
  NT",()=>A("SIGINT")),process.removeListener("SIGTERM",u),process.removeListener("SIGINT",u),c.signal.aborted&&A(),y.server.
690
690
  on("error",()=>{process.exitCode=1,A()});let I=await new Promise(T=>{E.once("error",()=>T({code:1})),E.once("exit",(v,k)=>T(
691
- {code:v,signal:k}))});clearTimeout(x),await y.close(),await Fs(a,{force:!0}),process.exitCode||=I.code??(S?0:1)}var Lt=Object.freeze({UNIX:"unix"});var Ws=process.platform==="linux"?107:103,en=Object.freeze({MISSING:"missing",RESPONSIVE:"responsive",TIMEOUT:"timeout",
692
- UNREACHABLE:"unreachable"}),Xs=Object.freeze({EXITED:"exited",INCOMPATIBLE:"incompatible",LIVE:"live",MISSING:"missing",
693
- SUSPECT:"suspect"}),Ut=Object.freeze({RUNNING:"running",STOPPED:"stopped"}),tn=Object.freeze({ABSENT:"absent",AMBIGUOUS:"\
694
- ambiguous",EXACT:"exact",INVALID:"invalid",MISMATCH:"mismatch"});var Js=Object.freeze({runtimeToken:"JSKIT_EXECUTION_RUNTIME_TOKEN",modelCatalogSource:"JSKIT_CODEX_MODEL_CATALOG_SOURCE",
695
- commandHash:"JSKIT_EXECUTION_COMMAND_HASH"});var _a=le(Yn(),1),ya=le(at(),1),ga=le(ve(),1),Ea=le(Jt(),1),Sa=le(Qt(),1),wa=le(or(),1),ba=le(dt(),1),xa=le(so(),1);var Dd=new URL("./../../../../@jskit-ai/assistant-core/src/server/conversation/codexRuntime.js",import.meta.url).href;var Yd=16*1024*1024;var tf=new URL("./../../../../@jskit-ai/assistant-core/src/server/conversation/commandWrapper.js",import.meta.url).href;var If=256*1024,Rf=Object.freeze({codex:Object.freeze({path:"/responses",name:"Responses API",urlHint:"Codex needs an Op\
691
+ {code:v,signal:k}))});clearTimeout(x),await y.close(),await Xs(a,{force:!0}),process.exitCode||=I.code??(S?0:1)}var $t=Object.freeze({UNIX:"unix"});var Ys=process.platform==="linux"?107:103,nn=Object.freeze({MISSING:"missing",RESPONSIVE:"responsive",TIMEOUT:"timeout",
692
+ UNREACHABLE:"unreachable"}),Qs=Object.freeze({EXITED:"exited",INCOMPATIBLE:"incompatible",LIVE:"live",MISSING:"missing",
693
+ SUSPECT:"suspect"}),Ut=Object.freeze({RUNNING:"running",STOPPED:"stopped"}),on=Object.freeze({ABSENT:"absent",AMBIGUOUS:"\
694
+ ambiguous",EXACT:"exact",INVALID:"invalid",MISMATCH:"mismatch"});var Zs=Object.freeze({runtimeToken:"JSKIT_EXECUTION_RUNTIME_TOKEN",modelCatalogSource:"JSKIT_CODEX_MODEL_CATALOG_SOURCE",
695
+ commandHash:"JSKIT_EXECUTION_COMMAND_HASH"});var Sa=le(eo(),1),wa=le(at(),1),ba=le(ve(),1),xa=le(Kt(),1),Oa=le(Zt(),1),va=le(sr(),1),Ca=le(dt(),1),Ta=le(co(),1);var $d=new URL("./../../../../@jskit-ai/assistant-core/src/server/conversation/codexRuntime.js",import.meta.url).href;var Zd=16*1024*1024;var nf=new URL("./../../../../@jskit-ai/assistant-core/src/server/conversation/commandWrapper.js",import.meta.url).href;var Nf=256*1024,kf=Object.freeze({codex:Object.freeze({path:"/responses",name:"Responses API",urlHint:"Codex needs an Op\
696
696
  enAI Responses-compatible base URL, which usually ends in /v1.",body:t=>({model:t,input:"Reply with OK.",max_output_tokens:64,
697
697
  store:!1}),usable:t=>!!t?.id&&Array.isArray(t.output)&&["completed","incomplete"].includes(t.status)}),claude:Object.freeze(
698
698
  {path:"/v1/messages",name:"Anthropic Messages API",urlHint:"Claude Code needs an Anthropic-compatible base URL without /\
699
699
  v1.",body:t=>({model:t,max_tokens:64,messages:[{role:"user",content:"Reply with OK."}]}),usable:t=>!!t?.id&&t.type==="me\
700
700
  ssage"&&Array.isArray(t.content)}),opencode:Object.freeze({path:"/chat/completions",name:"Chat Completions API",urlHint:"\
701
701
  OpenCode needs an OpenAI-compatible base URL, which usually ends in /v1.",body:t=>({model:t,max_tokens:64,messages:[{role:"\
702
- user",content:"Reply with OK."}]}),usable:t=>!!t?.id&&Array.isArray(t.choices)&&t.choices.length>0})});function q(t){if(t===null||typeof t!="object")return!1;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null||
703
- Ba(e)}function Ba(t){return t!==null&&typeof t=="object"&&Object.getPrototypeOf(t)===null&&Reflect.ownKeys(t).length===0}function cr(t){return t!==null&&typeof t=="object"&&q(t.structure)&&q(t.operations)&&typeof t.validateWith=="function"&&
702
+ user",content:"Reply with OK."}]}),usable:t=>!!t?.id&&Array.isArray(t.choices)&&t.choices.length>0})});function B(t){if(t===null||typeof t!="object")return!1;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null||
703
+ qa(e)}function qa(t){return t!==null&&typeof t=="object"&&Object.getPrototypeOf(t)===null&&Reflect.ownKeys(t).length===0}function ur(t){return t!==null&&typeof t=="object"&&B(t.structure)&&B(t.operations)&&typeof t.validateWith=="function"&&
704
704
  typeof t.toJsonSchema=="function"&&typeof t.cleanup=="function"}function pt(t,e){if(!Object.hasOwn(e,"items"))return null;
705
- let{items:r}=e;if(cr(r))return{kind:"schema",schema:r};if(!q(r)||typeof r.type!="string")throw new Error(`Array field "${t}\
705
+ let{items:r}=e;if(ur(r))return{kind:"schema",schema:r};if(!B(r)||typeof r.type!="string")throw new Error(`Array field "${t}\
706
706
  " must define items as either a Schema instance or a field definition object.`);return{kind:"definition",definition:r}}function Fe(t,e){
707
- if(!Object.hasOwn(e,"values"))return null;let{values:r}=e;if(cr(r))return{kind:"schema",schema:r};if(!q(r)||typeof r.type!=
707
+ if(!Object.hasOwn(e,"values"))return null;let{values:r}=e;if(ur(r))return{kind:"schema",schema:r};if(!B(r)||typeof r.type!=
708
708
  "string")throw new Error(`Object field "${t}" must define values as either a Schema instance or a field definition objec\
709
709
  t.`);return{kind:"definition",definition:r}}function ht(t,e){let r=Object.hasOwn(e,"schema"),n=Object.hasOwn(e,"values"),
710
710
  o=Object.hasOwn(e,"additionalProperties");if(r&&n)throw new Error(`Object field "${t}" cannot define both schema and val\
711
711
  ues.`);if(o&&e.additionalProperties!==!0)throw new Error(`Object field "${t}" only supports additionalProperties: true.`);
712
712
  if(n&&e.additionalProperties===!0)throw new Error(`Object field "${t}" cannot define both values and additionalPropertie\
713
- s: true.`);if(r){if(!cr(e.schema))throw new Error(`Object field "${t}" must define schema as a Schema instance.`);return{
713
+ s: true.`);if(r){if(!ur(e.schema))throw new Error(`Object field "${t}" must define schema as a Schema instance.`);return{
714
714
  kind:"nested",schema:e.schema,allowAdditionalProperties:e.additionalProperties===!0}}return n?{kind:"map",valuesConfig:Fe(
715
- t,e)}:e.additionalProperties===!0?{kind:"opaque"}:{kind:"plain"}}function Re(t){return t?.type==="number"||t?.type==="integer"||t?.type==="epochMilliseconds"||t?.type==="epochSeconds"}var ur="^(?:0|-?[1-9]\\d*)$",lo="\\d{4}",fo="0[1-9]|1[0-2]",po="0[1-9]|[12]\\d|3[01]",ho="[01]\\d|2[0-3]",Ne="[0-5]\\d",
716
- mt=`(?:${ho}):${Ne}`,mo=`(?:Z|[+-](?:${ho}):${Ne})`,_o=`(${lo})-(${fo})-(${po})`,yo=`${lo}-(?:${fo})-(?:${po})`,go=`^${yo}\
717
- $`,Va=new RegExp(`^${_o}$`),Ha=new RegExp(`^${mt}(?::${Ne}(?:\\.(\\d+))?)?$`),Fa=new RegExp(`^${_o}T${mt}:${Ne}(?:\\.(\\d+\
718
- ))?${mo}$`),qa=new RegExp(ur),Ga=[31,28,31,30,31,30,31,31,30,31,30,31];function Wa(t){return t%4===0&&(t%100!==0||t%400===
719
- 0)}function Xa(t,e){return e===2?Wa(t)?29:28:Ga[e-1]}function Eo(t,e,r){let n=Number(t),o=Number(e),s=Number(r);return o>=
720
- 1&&o<=12&&s>=1&&s<=Xa(n,o)}function qe(t,e){let r=t.temporalPrecision;if(r!==void 0){if(!Number.isInteger(r)||r<0)throw new Error(
721
- `temporalPrecision for "${e}" must be a non-negative integer.`);return r}}function So(t,e){return t===void 0?!0:e===void 0||
722
- t.length<=e}function wo(t){if(typeof t!="string")return!1;let e=Va.exec(t);return e!==null&&Eo(e[1],e[2],e[3])}function bo(t,e){
723
- if(typeof t!="string")return!1;let r=Ha.exec(t);return r!==null&&So(r[1],e)}function xo(t,e){if(typeof t!="string")return!1;
724
- let r=Fa.exec(t);return r===null?!1:Eo(r[1],r[2],r[3])&&So(r[4],e)}function Oo(t){return t===void 0?"(?:\\.\\d+)?":t===0?
725
- "":`(?:\\.\\d{1,${t}})?`}function vo(t,e){let r=qe(t,e);return`^${mt}(?::${Ne}${Oo(r)})?$`}function Co(t,e){let r=qe(t,e);
726
- return`^${yo}T${mt}:${Ne}${Oo(r)}${mo}$`}function lr(t,e){let r;if(typeof t=="number")r=t;else if(typeof t=="string"&&qa.
727
- test(t))r=Number(t);else return null;return!Number.isSafeInteger(r)||r<-e||r>e?null:r===0?0:r}var Ja=new Set(["__proto__","prototype","constructor"]);function C(t,e,r){Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0})}function Ka(t,e){if(Ja.
728
- has(t))throw new Error(`${e}() received unsafe path segment "${t}".`)}function Ya(t){return typeof t!="string"?t:t.replace(
729
- /\[(.+?)\]/g,".$1").replace(/^\.+/,"").replace(/\.+/g,".").replace(/\.$/,"")}function dr(t,e,{normalize:r=!1,allowEmpty:n=!1}={}){
730
- let o=r?Ya(t):t;if(typeof o!="string"||o.trim()===""){if(n&&o==="")return[];throw new Error(`${e}() expects a non-empty \
715
+ t,e)}:e.additionalProperties===!0?{kind:"opaque"}:{kind:"plain"}}function Re(t){return t?.type==="number"||t?.type==="integer"||t?.type==="epochMilliseconds"||t?.type==="epochSeconds"}function lr(t,e=""){
716
+ if(B(t))for(let[r,n]of Object.entries(t)){if(!B(n))continue;let o=e?`${e}.${r}`:r;for(let s of["minItems","maxItems"]){if(!Object.
717
+ hasOwn(n,s))continue;let i=n[s];if(n.type!=="array"||!Number.isInteger(i)||i<0)throw new Error(`Field "${o}" ${s} must b\
718
+ e a non-negative integer on an array field.`)}if(n.minItems>n.maxItems)throw new Error(`Field "${o}" minItems (${n.minItems}\
719
+ ) is above its maxItems (${n.maxItems}).`);n.type==="array"&&B(n.items)&&typeof n.items.type=="string"&&lr({"[]":n.items},
720
+ o)}}var dr="^(?:0|-?[1-9]\\d*)$",ho="\\d{4}",mo="0[1-9]|1[0-2]",_o="0[1-9]|[12]\\d|3[01]",yo="[01]\\d|2[0-3]",Ne="[0-5]\\d",
721
+ mt=`(?:${yo}):${Ne}`,go=`(?:Z|[+-](?:${yo}):${Ne})`,Eo=`(${ho})-(${mo})-(${_o})`,So=`${ho}-(?:${mo})-(?:${_o})`,wo=`^${So}\
722
+ $`,Ga=new RegExp(`^${Eo}$`),Wa=new RegExp(`^${mt}(?::${Ne}(?:\\.(\\d+))?)?$`),Xa=new RegExp(`^${Eo}T${mt}:${Ne}(?:\\.(\\d+\
723
+ ))?${go}$`),Ja=new RegExp(dr),Ka=[31,28,31,30,31,30,31,31,30,31,30,31];function Ya(t){return t%4===0&&(t%100!==0||t%400===
724
+ 0)}function Qa(t,e){return e===2?Ya(t)?29:28:Ka[e-1]}function bo(t,e,r){let n=Number(t),o=Number(e),s=Number(r);return o>=
725
+ 1&&o<=12&&s>=1&&s<=Qa(n,o)}function qe(t,e){let r=t.temporalPrecision;if(r!==void 0){if(!Number.isInteger(r)||r<0)throw new Error(
726
+ `temporalPrecision for "${e}" must be a non-negative integer.`);return r}}function xo(t,e){return t===void 0?!0:e===void 0||
727
+ t.length<=e}function Oo(t){if(typeof t!="string")return!1;let e=Ga.exec(t);return e!==null&&bo(e[1],e[2],e[3])}function vo(t,e){
728
+ if(typeof t!="string")return!1;let r=Wa.exec(t);return r!==null&&xo(r[1],e)}function Co(t,e){if(typeof t!="string")return!1;
729
+ let r=Xa.exec(t);return r===null?!1:bo(r[1],r[2],r[3])&&xo(r[4],e)}function To(t){return t===void 0?"(?:\\.\\d+)?":t===0?
730
+ "":`(?:\\.\\d{1,${t}})?`}function Ao(t,e){let r=qe(t,e);return`^${mt}(?::${Ne}${To(r)})?$`}function Po(t,e){let r=qe(t,e);
731
+ return`^${So}T${mt}:${Ne}${To(r)}${go}$`}function fr(t,e){let r;if(typeof t=="number")r=t;else if(typeof t=="string"&&Ja.
732
+ test(t))r=Number(t);else return null;return!Number.isSafeInteger(r)||r<-e||r>e?null:r===0?0:r}var Za=new Set(["__proto__","prototype","constructor"]);function C(t,e,r){Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0})}function ec(t,e){if(Za.
733
+ has(t))throw new Error(`${e}() received unsafe path segment "${t}".`)}function tc(t){return typeof t!="string"?t:t.replace(
734
+ /\[(.+?)\]/g,".$1").replace(/^\.+/,"").replace(/\.+/g,".").replace(/\.$/,"")}function pr(t,e,{normalize:r=!1,allowEmpty:n=!1}={}){
735
+ let o=r?tc(t):t;if(typeof o!="string"||o.trim()===""){if(n&&o==="")return[];throw new Error(`${e}() expects a non-empty \
731
736
  dotted path string.`)}let s=o.split(".");if(s.some(i=>i===""))throw new Error(`${e}() received an invalid path "${o}".`);
732
- for(let i of s)Ka(i,e);return s}var Qa="http://json-schema.org/draft-07/schema#",pe="x-json-rest-schema",fr=["object","array","string","number","boolean"],
733
- pr=Symbol("json-rest-schema.exportContext"),Za=["true","1","yes","y","on"],ec=["false","0","no","n","off"];function To(t){
734
- return{anyOf:[{type:"integer",minimum:-t,maximum:t},{type:"string",pattern:ur}]}}function Se(t,e){return{[pe]:{[t]:e}}}var tc={
735
- none:()=>({type:fr}),blob:()=>({type:fr}),serialize:()=>({type:fr}),object:()=>({type:"object"}),array:()=>({type:"array"}),
737
+ for(let i of s)ec(i,e);return s}var rc="http://json-schema.org/draft-07/schema#",pe="x-json-rest-schema",hr=["object","array","string","number","boolean"],
738
+ mr=Symbol("json-rest-schema.exportContext"),nc=["true","1","yes","y","on"],oc=["false","0","no","n","off"];function Io(t){
739
+ return{anyOf:[{type:"integer",minimum:-t,maximum:t},{type:"string",pattern:dr}]}}function Se(t,e){return{[pe]:{[t]:e}}}var sc={
740
+ none:()=>({type:hr}),blob:()=>({type:hr}),serialize:()=>({type:hr}),object:()=>({type:"object"}),array:()=>({type:"array"}),
736
741
  file:()=>({type:"string"}),string:()=>({type:"string"}),number:()=>({type:["number","string"]}),integer:()=>({type:["int\
737
- eger","string"]}),epochMilliseconds:()=>To(864e13),epochSeconds:()=>To(864e10),dateTime:({definition:t,fieldName:e})=>({
738
- type:"string",format:"date-time",pattern:Co(t,e)}),date:()=>({type:"string",format:"date",pattern:go}),time:({definition:t,
739
- fieldName:e})=>({type:"string",pattern:vo(t,e)}),boolean:({definition:t})=>{if(t.strictBoolean===!0)return{type:"boolean"};
740
- let e=new Set([...Za,String(t.stringTrueWhen||"true").trim().toLowerCase()]),r=new Set([...ec,String(t.stringFalseWhen||
742
+ eger","string"]}),epochMilliseconds:()=>Io(864e13),epochSeconds:()=>Io(864e10),dateTime:({definition:t,fieldName:e})=>({
743
+ type:"string",format:"date-time",pattern:Po(t,e)}),date:()=>({type:"string",format:"date",pattern:wo}),time:({definition:t,
744
+ fieldName:e})=>({type:"string",pattern:Ao(t,e)}),boolean:({definition:t})=>{if(t.strictBoolean===!0)return{type:"boolean"};
745
+ let e=new Set([...nc,String(t.stringTrueWhen||"true").trim().toLowerCase()]),r=new Set([...oc,String(t.stringFalseWhen||
741
746
  "false").trim().toLowerCase()]);return{anyOf:[{type:"boolean"},{type:"number",enum:[0,1]},{type:"string",enum:[...r,...e]}]}},
742
- id:()=>({type:["integer","string"],minimum:1,pattern:"^[1-9][0-9]*$"})},rc={minLength:({definition:t,parameterValue:e})=>t.
747
+ id:()=>({type:["integer","string"],minimum:1,pattern:"^[1-9][0-9]*$"})},ic={minLength:({definition:t,parameterValue:e})=>t.
743
748
  type==="string"?{minLength:e}:null,maxLength:({definition:t,parameterValue:e})=>t.type==="string"?{maxLength:e}:null,min:({
744
749
  definition:t,parameterValue:e})=>Re(t)?{minimum:e}:null,max:({definition:t,parameterValue:e})=>Re(t)?{maximum:e}:null,pattern:({
745
750
  definition:t,parameterValue:e})=>t.type==="string"?{pattern:e instanceof RegExp?e.source:e}:null,enum:({parameterValue:t})=>({
746
- enum:t}),notEmpty:({parameterValue:t,definition:e})=>!t||e.type==="array"?null:{minLength:1},uppercase:({parameterValue:t})=>t?
747
- Se("transforms",{uppercase:!0}):null,lowercase:({parameterValue:t})=>t?Se("transforms",{lowercase:!0}):null,length:({parameterValue:t})=>Se(
748
- "transforms",{length:t}),unsigned:({parameterValue:t})=>t?Se("metadata",{unsigned:!0}):null,precision:({parameterValue:t})=>Se(
749
- "metadata",{precision:t}),scale:({parameterValue:t})=>Se("metadata",{scale:t}),temporalPrecision:({parameterValue:t})=>Se(
750
- "metadata",{temporalPrecision:t}),strictBoolean:()=>null,required:()=>null,nullable:()=>null,nullOnEmpty:()=>null,defaultTo:()=>null};
751
- function yr(t,e){for(let r of Object.keys(e)){let n=e[r],o=t[r];if(n&&o&&typeof n=="object"&&typeof o=="object"&&!Array.
752
- isArray(n)&&!Array.isArray(o)){yr(o,n);continue}t[r]=n}}function nc(t,e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(
753
- "JSON Schema export hooks must return an object or null.");for(let r of Object.keys(e)){if(r===pe&&t[r]&&typeof t[r]=="o\
754
- bject"&&typeof e[r]=="object"&&!Array.isArray(t[r])&&!Array.isArray(e[r])){yr(t[r],e[r]);continue}t[r]=e[r]}}function oc(t,e){
755
- let n=[...Array.isArray(t.anyOf)&&Object.keys(t).length===1?t.anyOf:[t],...e];return n.length===1?t:{anyOf:n}}function sc(t,e){
756
- if(!Object.hasOwn(t.types,e.type))throw new Error(`No casting function for type: ${e.type}`);let r=t.types[e.type];if(typeof r.
757
- toJsonSchema=="function")return r.toJsonSchema;let n=tc[e.type];if(!n)throw new Error(`Type '${e.type}' cannot be export\
758
- ed to JSON Schema without a toJsonSchema hook.`);return n}function ic(t,e,r){if(!Object.hasOwn(t.validators,e))return null;
759
- let n=t.validators[e];if(typeof n.toJsonSchema=="function")return n.toJsonSchema;let o=rc[e];if(o)return o;throw new Error(
760
- `Validator '${e}' on field '${r}' cannot be exported to JSON Schema without a toJsonSchema hook.`)}function Ao(t){if(t===
761
- void 0)return"create";if(["create","replace","patch"].includes(t))return t;throw new Error(`Unsupported JSON Schema expo\
762
- rt mode '${t}'. Expected 'create', 'replace', or 'patch'.`)}function ac(t,e={}){if(e.mode!==void 0&&e.operation!==void 0){
763
- let r=Ao(e.mode);if(r!==e.operation)throw new Error(`Conflicting JSON Schema export options: mode '${r}' does not match \
764
- operation '${e.operation}'.`)}if(e.operation!==void 0){if(!Object.hasOwn(t.operations,e.operation))throw new Error(`Unkn\
765
- own JSON Schema export operation '${e.operation}'.`);return e.operation}return Ao(e.mode)}function cc(t,e={}){if(e.operationName!==
766
- void 0&&e.operationDescriptor!==void 0)return{operationName:e.operationName,operation:e.operationDescriptor};let r=ac(t,
767
- e);return{operationName:r,operation:t.operations[r]}}function uc(t={}){let e={...t};return Object.defineProperty(e,pr,{value:{
768
- definitions:{},nodes:[],nextDefinitionId:1,rootNode:null},enumerable:!1}),e}function yt(t={}){return t[pr]?t[pr]:{definitions:{},
769
- nodes:[],nextDefinitionId:1,rootNode:null}}function lc(t){return String(t).replace(/[^a-zA-Z0-9]+/g,"_").replace(/^_+|_+$/g,
770
- "")||"operation"}function hr(t){return q(t)&&Object.keys(t).length===1&&typeof t.$ref=="string"}function _t(t){return hr(
771
- t)?{allOf:[t]}:t}function dc(t,e,r,n,o){return t.nodes.find(s=>s.schema===e&&s.operationName===r&&s.operation===n&&s.additionalProperties===
772
- o)||null}function fc(t,e){let r=lc(e),n=`SchemaNode_${t.nextDefinitionId}_${r}`;return t.nextDefinitionId+=1,n}function Po(t,e,r,n,o,{
773
- root:s=!1}={}){let i=yt(e),a=dc(i,t,r,n,o);if(a)return s&&(a.pointer="#",i.rootNode=a),a;let c={schema:t,operationName:r,
774
- operation:n,additionalProperties:o,status:"new",definitionName:s?null:fc(i,r),pointer:s?"#":null};return s?i.rootNode=c:
775
- c.pointer=`#/definitions/${c.definitionName}`,i.nodes.push(c),c}function Io(t,e){if(t.status==="built")return{$ref:t.pointer};
776
- if(t.status==="building")return{$ref:t.pointer};let r=yt(e);t.status="building",t.pointer!=="#"&&(r.definitions[t.definitionName]=
777
- {});let n=pc(t.schema,e,t.operationName,t.operation,t.additionalProperties);return t.status="built",t.pointer==="#"?n:(r.
778
- definitions[t.definitionName]=n,{$ref:t.pointer})}function gr(t,e,r,n,o=!1){let s=yt(e),i=Po(t,e,r,n,o);return s.rootNode===
779
- i?{$ref:"#"}:Io(i,e)}function Ge(t,{referenceBacked:e=!1}={}){return{schema:t,referenceBacked:e}}function pc(t,e,r,n,o=!1){
780
- let s={},i=[];for(let[c,u]of Object.entries(t.structure))C(s,c,Er(t,c,u,e,r,n)),n.enforceRequired&&u.required===!0&&i.push(
781
- c);let a={type:"object",properties:s,additionalProperties:o};return i.length>0&&(a.required=i),a}function hc(t,e,r,n,o,s){
782
- let i=pt(e,r);if(!i)return null;if(i.kind==="schema")return{..._t(gr(i.schema,n,"replace",i.schema.operations.replace,!1)),
783
- [pe]:{castType:"object"}};let a=r.items.type==="object"&&Object.hasOwn(r.items,"schema")?"replace":o,c=a==="replace"?t.operations.
784
- replace:s;return Er(t,`${e}[]`,r.items,n,a,c)}function mc(t,e,r,n,o,s){let i=Fe(e,r);if(!i)return null;if(i.kind==="sche\
785
- ma")return{..._t(gr(i.schema,n,"replace",i.schema.operations.replace,!1)),[pe]:{castType:"object"}};let a=i.definition.type===
786
- "object"&&Object.hasOwn(i.definition,"schema")?"replace":o,c=a==="replace"?t.operations.replace:s;return Er(t,`${e}.*`,i.
787
- definition,n,a,c)}function _c(t,e,r,n,o,s){if(r.type==="object"){let a=ht(e,r);if(a.kind==="nested")return Ge(gr(a.schema,
788
- n,o,s,a.allowAdditionalProperties===!0),{referenceBacked:!0});if(a.kind==="opaque")return Ge({type:"object",additionalProperties:!0});
789
- if(a.kind==="map")return Ge({type:"object",additionalProperties:mc(t,e,r,n,o,s)})}let i=sc(t,r)({schema:t,fieldName:e,definition:r,
790
- operation:o,mode:o,options:n});if(!i||typeof i!="object"||Array.isArray(i))throw new Error(`Type '${r.type}' on field '${e}\
791
- ' returned an invalid JSON Schema fragment.`);if(r.type==="array"){let a=hc(t,e,r,n,o,s);if(a)return Ge({...i,items:a},{
792
- referenceBacked:hr(i)})}return Ge(i,{referenceBacked:hr(i)})}function Er(t,e,r,n,o,s){let i={schema:t,fieldName:e,definition:r,
793
- operation:o,mode:o,options:n},a=_c(t,e,r,n,o,s),c=a.referenceBacked?_t(a.schema):{...a.schema},u={castType:r.type};for(let d of Object.
794
- keys(r)){if(d==="type"||!Object.hasOwn(t.validators,d))continue;let y=ic(t,d,e);if(!y)continue;let E=y({...i,parameterName:d,
795
- parameterValue:r[d],fieldSchema:{...c}});E&&nc(c,E)}c[pe]&&(yr(u,c[pe]),delete c[pe]);let f=[];r.nullable===!0&&f.push({
796
- type:"null"}),r.nullOnEmpty===!0&&f.push({const:""});let p=_t(oc(c,f));if(r.defaultTo!==void 0&&s.applyDefaults)if(typeof r.
797
- defaultTo!="function"){let d=t._normalizeDefault(r,r.defaultTo,{fieldPath:e,currentObject:{},containerKey:e,objectBeforeCast:{},
798
- options:{},settings:t._buildOperationSettings(o,s,{})});if(Object.keys(d.errors).length>0){let y=Object.values(d.errors)[0];
799
- throw new Error(`defaultTo for "${e}" is invalid (${y.code}).`)}p.default=d.value}else u.defaults={providedByFunction:!0};
800
- return p[pe]=u,p}function Ro(t,e={}){let r=uc(e),{operationName:n,operation:o}=cc(t,r),s=r.additionalProperties===void 0?
801
- !1:r.additionalProperties,i=yt(r),a=Po(t,r,n,o,s,{root:!0}),c={$schema:Qa,...Io(a,r)};return Object.keys(i.definitions).
802
- length>0&&(c.definitions=i.definitions),c}function No(t){return t!==null&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function Or(t){return t instanceof
803
- Me}function yc(){return{self:!1,children:{}}}function ko(t){return Object.keys(t.children).length>0}function we(t,e){return`${t}\
804
- .${String(e)}`}function $o(t,e){return t===""?String(e):we(t,e)}function jo(t,e){if(t===e)return"";let r=`${e}.`;return t.
751
+ enum:t}),minItems:({definition:t,parameterValue:e})=>t.type==="array"?{minItems:e}:null,maxItems:({definition:t,parameterValue:e})=>t.
752
+ type==="array"?{maxItems:e}:null,notEmpty:({parameterValue:t,definition:e})=>!t||e.type==="array"?null:{minLength:1},uppercase:({
753
+ parameterValue:t})=>t?Se("transforms",{uppercase:!0}):null,lowercase:({parameterValue:t})=>t?Se("transforms",{lowercase:!0}):
754
+ null,length:({parameterValue:t})=>Se("transforms",{length:t}),unsigned:({parameterValue:t})=>t?Se("metadata",{unsigned:!0}):
755
+ null,precision:({parameterValue:t})=>Se("metadata",{precision:t}),scale:({parameterValue:t})=>Se("metadata",{scale:t}),temporalPrecision:({
756
+ parameterValue:t})=>Se("metadata",{temporalPrecision:t}),strictBoolean:()=>null,required:()=>null,nullable:()=>null,nullOnEmpty:()=>null,
757
+ defaultTo:()=>null};function Er(t,e){for(let r of Object.keys(e)){let n=e[r],o=t[r];if(n&&o&&typeof n=="object"&&typeof o==
758
+ "object"&&!Array.isArray(n)&&!Array.isArray(o)){Er(o,n);continue}t[r]=n}}function ac(t,e){if(!e||typeof e!="object"||Array.
759
+ isArray(e))throw new Error("JSON Schema export hooks must return an object or null.");for(let r of Object.keys(e)){if(r===
760
+ pe&&t[r]&&typeof t[r]=="object"&&typeof e[r]=="object"&&!Array.isArray(t[r])&&!Array.isArray(e[r])){Er(t[r],e[r]);continue}
761
+ t[r]=e[r]}}function cc(t,e){let n=[...Array.isArray(t.anyOf)&&Object.keys(t).length===1?t.anyOf:[t],...e];return n.length===
762
+ 1?t:{anyOf:n}}function uc(t,e){if(!Object.hasOwn(t.types,e.type))throw new Error(`No casting function for type: ${e.type}`);
763
+ let r=t.types[e.type];if(typeof r.toJsonSchema=="function")return r.toJsonSchema;let n=sc[e.type];if(!n)throw new Error(
764
+ `Type '${e.type}' cannot be exported to JSON Schema without a toJsonSchema hook.`);return n}function lc(t,e,r){if(!Object.
765
+ hasOwn(t.validators,e))return null;let n=t.validators[e];if(typeof n.toJsonSchema=="function")return n.toJsonSchema;let o=ic[e];
766
+ if(o)return o;throw new Error(`Validator '${e}' on field '${r}' cannot be exported to JSON Schema without a toJsonSchema\
767
+ hook.`)}function Ro(t){if(t===void 0)return"create";if(["create","replace","patch"].includes(t))return t;throw new Error(
768
+ `Unsupported JSON Schema export mode '${t}'. Expected 'create', 'replace', or 'patch'.`)}function dc(t,e={}){if(e.mode!==
769
+ void 0&&e.operation!==void 0){let r=Ro(e.mode);if(r!==e.operation)throw new Error(`Conflicting JSON Schema export option\
770
+ s: mode '${r}' does not match operation '${e.operation}'.`)}if(e.operation!==void 0){if(!Object.hasOwn(t.operations,e.operation))
771
+ throw new Error(`Unknown JSON Schema export operation '${e.operation}'.`);return e.operation}return Ro(e.mode)}function fc(t,e={}){
772
+ if(e.operationName!==void 0&&e.operationDescriptor!==void 0)return{operationName:e.operationName,operation:e.operationDescriptor};
773
+ let r=dc(t,e);return{operationName:r,operation:t.operations[r]}}function pc(t={}){let e={...t};return Object.defineProperty(
774
+ e,mr,{value:{definitions:{},nodes:[],nextDefinitionId:1,rootNode:null},enumerable:!1}),e}function yt(t={}){return t[mr]?
775
+ t[mr]:{definitions:{},nodes:[],nextDefinitionId:1,rootNode:null}}function hc(t){return String(t).replace(/[^a-zA-Z0-9]+/g,
776
+ "_").replace(/^_+|_+$/g,"")||"operation"}function _r(t){return B(t)&&Object.keys(t).length===1&&typeof t.$ref=="string"}
777
+ function _t(t){return _r(t)?{allOf:[t]}:t}function mc(t,e,r,n,o){return t.nodes.find(s=>s.schema===e&&s.operationName===
778
+ r&&s.operation===n&&s.additionalProperties===o)||null}function _c(t,e){let r=hc(e),n=`SchemaNode_${t.nextDefinitionId}_${r}`;
779
+ return t.nextDefinitionId+=1,n}function No(t,e,r,n,o,{root:s=!1}={}){let i=yt(e),a=mc(i,t,r,n,o);if(a)return s&&(a.pointer=
780
+ "#",i.rootNode=a),a;let c={schema:t,operationName:r,operation:n,additionalProperties:o,status:"new",definitionName:s?null:
781
+ _c(i,r),pointer:s?"#":null};return s?i.rootNode=c:c.pointer=`#/definitions/${c.definitionName}`,i.nodes.push(c),c}function ko(t,e){
782
+ if(t.status==="built")return{$ref:t.pointer};if(t.status==="building")return{$ref:t.pointer};let r=yt(e);t.status="build\
783
+ ing",t.pointer!=="#"&&(r.definitions[t.definitionName]={});let n=yc(t.schema,e,t.operationName,t.operation,t.additionalProperties);
784
+ return t.status="built",t.pointer==="#"?n:(r.definitions[t.definitionName]=n,{$ref:t.pointer})}function Sr(t,e,r,n,o=!1){
785
+ let s=yt(e),i=No(t,e,r,n,o);return s.rootNode===i?{$ref:"#"}:ko(i,e)}function Ge(t,{referenceBacked:e=!1}={}){return{schema:t,
786
+ referenceBacked:e}}function yc(t,e,r,n,o=!1){let s={},i=[];for(let[c,u]of Object.entries(t.structure))C(s,c,wr(t,c,u,e,r,
787
+ n)),n.enforceRequired&&u.required===!0&&i.push(c);let a={type:"object",properties:s,additionalProperties:o};return i.length>
788
+ 0&&(a.required=i),a}function gc(t,e,r,n,o,s){let i=pt(e,r);if(!i)return null;if(i.kind==="schema")return{..._t(Sr(i.schema,
789
+ n,"replace",i.schema.operations.replace,!1)),[pe]:{castType:"object"}};let a=r.items.type==="object"&&Object.hasOwn(r.items,
790
+ "schema")?"replace":o,c=a==="replace"?t.operations.replace:s;return wr(t,`${e}[]`,r.items,n,a,c)}function Ec(t,e,r,n,o,s){
791
+ let i=Fe(e,r);if(!i)return null;if(i.kind==="schema")return{..._t(Sr(i.schema,n,"replace",i.schema.operations.replace,!1)),
792
+ [pe]:{castType:"object"}};let a=i.definition.type==="object"&&Object.hasOwn(i.definition,"schema")?"replace":o,c=a==="re\
793
+ place"?t.operations.replace:s;return wr(t,`${e}.*`,i.definition,n,a,c)}function Sc(t,e,r,n,o,s){if(r.type==="object"){let a=ht(
794
+ e,r);if(a.kind==="nested")return Ge(Sr(a.schema,n,o,s,a.allowAdditionalProperties===!0),{referenceBacked:!0});if(a.kind===
795
+ "opaque")return Ge({type:"object",additionalProperties:!0});if(a.kind==="map")return Ge({type:"object",additionalProperties:Ec(
796
+ t,e,r,n,o,s)})}let i=uc(t,r)({schema:t,fieldName:e,definition:r,operation:o,mode:o,options:n});if(!i||typeof i!="object"||
797
+ Array.isArray(i))throw new Error(`Type '${r.type}' on field '${e}' returned an invalid JSON Schema fragment.`);if(r.type===
798
+ "array"){let a=gc(t,e,r,n,o,s);if(a)return Ge({...i,items:a},{referenceBacked:_r(i)})}return Ge(i,{referenceBacked:_r(i)})}
799
+ function wr(t,e,r,n,o,s){let i={schema:t,fieldName:e,definition:r,operation:o,mode:o,options:n},a=Sc(t,e,r,n,o,s),c=a.referenceBacked?
800
+ _t(a.schema):{...a.schema},u={castType:r.type};for(let d of Object.keys(r)){if(d==="type"||!Object.hasOwn(t.validators,d))
801
+ continue;let y=lc(t,d,e);if(!y)continue;let E=y({...i,parameterName:d,parameterValue:r[d],fieldSchema:{...c}});E&&ac(c,E)}
802
+ c[pe]&&(Er(u,c[pe]),delete c[pe]);let f=[];r.nullable===!0&&f.push({type:"null"}),r.nullOnEmpty===!0&&f.push({const:""});
803
+ let p=_t(cc(c,f));if(r.defaultTo!==void 0&&s.applyDefaults)if(typeof r.defaultTo!="function"){let d=t._normalizeDefault(
804
+ r,r.defaultTo,{fieldPath:e,currentObject:{},containerKey:e,objectBeforeCast:{},options:{},settings:t._buildOperationSettings(
805
+ o,s,{})});if(Object.keys(d.errors).length>0){let y=Object.values(d.errors)[0];throw new Error(`defaultTo for "${e}" is i\
806
+ nvalid (${y.code}).`)}p.default=d.value}else u.defaults={providedByFunction:!0};return p[pe]=u,p}function jo(t,e={}){let r=pc(
807
+ e),{operationName:n,operation:o}=fc(t,r),s=r.additionalProperties===void 0?!1:r.additionalProperties,i=yt(r),a=No(t,r,n,
808
+ o,s,{root:!0}),c={$schema:rc,...ko(a,r)};return Object.keys(i.definitions).length>0&&(c.definitions=i.definitions),c}function Mo(t){return t!==null&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function Tr(t){return t instanceof
809
+ Me}function wc(){return{self:!1,children:{}}}function Do(t){return Object.keys(t.children).length>0}function we(t,e){return`${t}\
810
+ .${String(e)}`}function Vo(t,e){return t===""?String(e):we(t,e)}function Lo(t,e){if(t===e)return"";let r=`${e}.`;return t.
805
811
  startsWith(r)?t.slice(r.length):null}function ke(t,e){let r={};for(let n of Object.values(t)){let o=we(e,n.field);C(r,o,
806
- {...n,field:o})}return r}function br(t){return dr(t,"validatePath")}function Mo(t){let e={};for(let r of t){let n=br(r),
807
- o=e;for(let s=0;s<n.length;s++){let i=n[s];Object.hasOwn(o,i)||C(o,i,yc()),s===n.length-1&&(o[i].self=!0),o=o[i].children}}
808
- return e}function gc(t,e){let r=t;for(let n of e){if(r==null||typeof r!="object"||!Object.hasOwn(r,n))return;r=r[n]}return r}
809
- function gt(t){return t===null?!0:Array.isArray(t)||q(t)?Object.keys(t).length>0:t!==void 0}function Do(t){return[...t].
812
+ {...n,field:o})}return r}function vr(t){return pr(t,"validatePath")}function $o(t){let e={};for(let r of t){let n=vr(r),
813
+ o=e;for(let s=0;s<n.length;s++){let i=n[s];Object.hasOwn(o,i)||C(o,i,wc()),s===n.length-1&&(o[i].self=!0),o=o[i].children}}
814
+ return e}function bc(t,e){let r=t;for(let n of e){if(r==null||typeof r!="object"||!Object.hasOwn(r,n))return;r=r[n]}return r}
815
+ function gt(t){return t===null?!0:Array.isArray(t)||B(t)?Object.keys(t).length>0:t!==void 0}function Uo(t){return[...t].
810
816
  sort((e,r)=>{let n=/^[0-9]+$/.test(e),o=/^[0-9]+$/.test(r);return n&&o?Number(e)-Number(r):n?-1:o?1:e.localeCompare(r)})}
811
- function Ec(t){return/^[0-9]+$/.test(t)}function Sc(t,e=new WeakMap){if(e.has(t))return e.get(t);let r=Object.create(Me.
817
+ function xc(t){return/^[0-9]+$/.test(t)}function Oc(t,e=new WeakMap){if(e.has(t))return e.get(t);let r=Object.create(Me.
812
818
  prototype);return e.set(t,r),r.structure=null,r.types=t.types,r.validators=t.validators,r.operations=t.operations,r.structure=
813
819
  St(Et(t.structure,e)),r._installOperationMethods(),Object.freeze(r)}function Et(t,e=new WeakMap){if(t===null||typeof t!=
814
- "object")return t;if(Or(t))return Sc(t,e);if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){let n=new RegExp(
820
+ "object")return t;if(Tr(t))return Oc(t,e);if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){let n=new RegExp(
815
821
  t.source,t.flags);return n.lastIndex=t.lastIndex,n}if(e.has(t))return e.get(t);if(Array.isArray(t)){let n=[];e.set(t,n);
816
- for(let o of t)n.push(Et(o,e));return n}if(!q(t))return t;let r={};e.set(t,r);for(let[n,o]of Object.entries(t))C(r,n,Et(
817
- o,e));return r}function St(t,e=new WeakSet){if(t===null||typeof t!="object"||e.has(t)||Or(t))return t;if(e.add(t),Array.
818
- isArray(t))for(let r of t)St(r,e);else for(let r of Reflect.ownKeys(t))St(t[r],e);return Object.freeze(t)}function Sr(t){
819
- return St(Et(t))}function xr(t,e,r=""){if(!Or(t)||!Array.isArray(e)||e.length<1)return null;let[n,...o]=e;if(!Object.hasOwn(
820
- t.structure,n))return null;let s=t.structure[n];if(o.length<1)return s;let i=$o(r,n);return zo(t,s,o,i)}function zo(t,e,r,n){
821
- if(e?.type==="object"){let o=t._resolveObjectFieldMode(n,e);return o.kind!=="nested"?null:xr(o.schema,r,n)}if(e?.type===
822
- "array"){let o=t._resolveArrayItemsConfig(n,e);if(!o||r.length<1)return null;let[s,...i]=r;if(!Ec(s))return null;let a=we(
823
- n,s);return o.kind==="schema"?i.length<1?null:xr(o.schema,i,a):i.length<1?o.definition:zo(t,o.definition,i,a)}return null}
824
- function je(t,e){let r={...t};if(Array.isArray(t.skipFields)){let n=t.skipFields.map(o=>jo(o,e)).filter(o=>o!==null&&o!==
825
- "");n.length>0?r.skipFields=n:delete r.skipFields}if(q(t.skipParams)){let n={};for(let[o,s]of Object.entries(t.skipParams)){
826
- let i=jo(o,e);i===null||i===""||C(n,i,s)}Object.keys(n).length>0?r.skipParams=n:delete r.skipParams}return r}var wc=Object.
822
+ for(let o of t)n.push(Et(o,e));return n}if(!B(t))return t;let r={};e.set(t,r);for(let[n,o]of Object.entries(t))C(r,n,Et(
823
+ o,e));return r}function St(t,e=new WeakSet){if(t===null||typeof t!="object"||e.has(t)||Tr(t))return t;if(e.add(t),Array.
824
+ isArray(t))for(let r of t)St(r,e);else for(let r of Reflect.ownKeys(t))St(t[r],e);return Object.freeze(t)}function br(t){
825
+ return St(Et(t))}var xr=new WeakMap;function Cr(t,e,r=""){if(!Tr(t)||!Array.isArray(e)||e.length<1)return null;let[n,...o]=e;
826
+ if(!Object.hasOwn(t.structure,n))return null;let s=t.structure[n];if(o.length<1)return s;let i=Vo(r,n);return Ho(t,s,o,i)}
827
+ function Ho(t,e,r,n){if(e?.type==="object"){let o=t._resolveObjectFieldMode(n,e);return o.kind!=="nested"?null:Cr(o.schema,
828
+ r,n)}if(e?.type==="array"){let o=t._resolveArrayItemsConfig(n,e);if(!o||r.length<1)return null;let[s,...i]=r;if(!xc(s))return null;
829
+ let a=we(n,s);return o.kind==="schema"?i.length<1?null:Cr(o.schema,i,a):i.length<1?o.definition:Ho(t,o.definition,i,a)}return null}
830
+ function je(t,e){let r={...t};if(Array.isArray(t.skipFields)){let n=t.skipFields.map(o=>Lo(o,e)).filter(o=>o!==null&&o!==
831
+ "");n.length>0?r.skipFields=n:delete r.skipFields}if(B(t.skipParams)){let n={};for(let[o,s]of Object.entries(t.skipParams)){
832
+ let i=Lo(o,e);i===null||i===""||C(n,i,s)}Object.keys(n).length>0?r.skipParams=n:delete r.skipParams}return r}var vc=Object.
827
833
  freeze({create:Object.freeze({targetFields:"schema",enforceRequired:!0,applyDefaults:!0,outputFields:"validated",rejectExplicitUndefined:!0}),
828
834
  replace:Object.freeze({targetFields:"schema",enforceRequired:!0,applyDefaults:!0,outputFields:"validated",rejectExplicitUndefined:!0}),
829
835
  patch:Object.freeze({targetFields:"input",enforceRequired:!1,applyDefaults:!1,outputFields:"input",rejectExplicitUndefined:!0})});
830
- function Lo(t,e,r,n){let o=e[r];if(!n.includes(o))throw new Error(`Operation "${t}" must define ${r} as one of: ${n.join(
831
- ", ")}.`)}function wr(t,e,r,n=!0){let o=e[r];if(!(o===void 0&&!n)&&typeof o!="boolean")throw new Error(`Operation "${t}"\
832
- must define ${r} as a boolean.`)}function bc(t,e){if(typeof e!="object"||e===null||Array.isArray(e))throw new Error(`Op\
833
- eration "${t}" must be an object.`);return Lo(t,e,"targetFields",["schema","input"]),wr(t,e,"enforceRequired"),wr(t,e,"a\
834
- pplyDefaults"),Lo(t,e,"outputFields",["validated","input"]),wr(t,e,"rejectExplicitUndefined",!1),Object.freeze({targetFields:e.
836
+ function zo(t,e,r,n){let o=e[r];if(!n.includes(o))throw new Error(`Operation "${t}" must define ${r} as one of: ${n.join(
837
+ ", ")}.`)}function Or(t,e,r,n=!0){let o=e[r];if(!(o===void 0&&!n)&&typeof o!="boolean")throw new Error(`Operation "${t}"\
838
+ must define ${r} as a boolean.`)}function Cc(t,e){if(typeof e!="object"||e===null||Array.isArray(e))throw new Error(`Op\
839
+ eration "${t}" must be an object.`);return zo(t,e,"targetFields",["schema","input"]),Or(t,e,"enforceRequired"),Or(t,e,"a\
840
+ pplyDefaults"),zo(t,e,"outputFields",["validated","input"]),Or(t,e,"rejectExplicitUndefined",!1),Object.freeze({targetFields:e.
835
841
  targetFields,enforceRequired:e.enforceRequired,applyDefaults:e.applyDefaults,outputFields:e.outputFields,rejectExplicitUndefined:e.
836
- rejectExplicitUndefined===void 0?!0:e.rejectExplicitUndefined})}function xc(t={}){if(typeof t!="object"||t===null||Array.
842
+ rejectExplicitUndefined===void 0?!0:e.rejectExplicitUndefined})}function Tc(t={}){if(typeof t!="object"||t===null||Array.
837
843
  isArray(t))throw new Error("Schema operations must be an object.");let e=Object.create(null);for(let[r,n]of Object.entries(
838
- wc))C(e,r,n);for(let[r,n]of Object.entries(t))C(e,r,bc(r,n));return Object.freeze(e)}function Uo(t){let e=Object.create(
839
- null);for(let[r,n]of Object.entries(t))C(e,r,n);return Object.freeze(e)}function Oc(t){let e={...t};return delete e.operation,
840
- delete e.mode,e}var Me=class{constructor(e,r,n,o={}){this.structure=e,this.types=Uo(r),this.validators=Uo(n),this.operations=
841
- xc(o),this._installOperationMethods()}_typeError(e){return this._paramError(e,"TYPE_CAST_FAILED","Value could not be cas\
842
- t to the required type.")}_paramError(e,r,n,o={}){let s=new Error(n);return s.errorObject={field:e,code:r,message:n,params:o},
843
- s}_paramToBeSkipped(e,r,n){return typeof r!="object"||r===null?!1:!!(Array.isArray(r[n])&&r[n].includes(e))}_fieldToBeSkipped(e,r){
844
+ vc))C(e,r,n);for(let[r,n]of Object.entries(t))C(e,r,Cc(r,n));return Object.freeze(e)}function Bo(t){let e=Object.create(
845
+ null);for(let[r,n]of Object.entries(t))C(e,r,n);return Object.freeze(e)}function Ac(t){let e={...t};return delete e.operation,
846
+ delete e.mode,e}var Me=class{constructor(e,r,n,o={}){lr(e),this.structure=e,this.types=Bo(r),this.validators=Bo(n),this.
847
+ operations=Tc(o),this._installOperationMethods()}_typeError(e){return this._paramError(e,"TYPE_CAST_FAILED","Value could\
848
+ not be cast to the required type.")}_paramError(e,r,n,o={}){let s=new Error(n);return s.errorObject={field:e,code:r,message:n,
849
+ params:o},s}_paramToBeSkipped(e,r,n){return typeof r!="object"||r===null?!1:!!(Array.isArray(r[n])&&r[n].includes(e))}_fieldToBeSkipped(e,r){
844
850
  return Array.isArray(r.skipFields)&&r.skipFields.includes(e)}_mergeErrors(e,r){for(let[n,o]of Object.entries(r))C(e,n,o)}_singleErrorMap(e){
845
851
  let r={};return C(r,e.field,e),r}_assertSupportedOptions(e={}){if(Object.hasOwn(e,"onlyObjectValues"))throw new Error("U\
846
852
  nsupported validation option `onlyObjectValues`. Call `patch()` directly.");if(Object.hasOwn(e,"mode"))throw new Error("\
@@ -849,11 +855,11 @@ tion"))throw new Error("Unsupported validation option `operation`. Call `validat
849
855
  .")}_buildOperationSettings(e,r,n){return{operationName:e,operation:r,targetFieldNames:r.targetFields==="input"?Object.keys(
850
856
  n):Object.keys(this.structure),outputFieldNames:r.outputFields==="input"?Object.keys(n):Object.keys(this.structure),enforceRequired:r.
851
857
  enforceRequired,applyDefaults:r.applyDefaults,rejectExplicitUndefined:r.rejectExplicitUndefined,defaultedFields:new Set,
852
- isFieldPresent:o=>Object.hasOwn(n,o)}}_assertPlainObjectInput(e,r){if(!q(r))throw new Error(`${e}() expects a plain obje\
858
+ isFieldPresent:o=>Object.hasOwn(n,o)}}_assertPlainObjectInput(e,r){if(!B(r))throw new Error(`${e}() expects a plain obje\
853
859
  ct input.`)}_resolvePathValidationRequest(e={}){let r=e.operation??e.mode??"patch";if(Object.hasOwn(e,"operation")&&Object.
854
860
  hasOwn(e,"mode")&&e.operation!==e.mode)throw new Error("Path validation options `operation` and `mode` must match when b\
855
861
  oth are provided.");if(!Object.hasOwn(this.operations,r))throw new Error(`Unknown operation "${r}".`);let n=this.operations[r];
856
- return{operationName:r,operation:n,validationOptions:Oc(e)}}_buildOperationResult(e,r,n){let o={};for(let s of n.outputFieldNames){
862
+ return{operationName:r,operation:n,validationOptions:Ac(e)}}_buildOperationResult(e,r,n){let o={};for(let s of n.outputFieldNames){
857
863
  if(!Object.hasOwn(this.structure,s))continue;let i=n.isFieldPresent(s);(r[s]!==void 0||i&&e[s]===null||n.defaultedFields.
858
864
  has(s))&&(!i&&!n.defaultedFields.has(s)||C(o,s,r[s]))}return o}_resolveObjectFieldMode(e,r){return ht(e,r)}_resolveArrayItemsConfig(e,r){
859
865
  return pt(e,r)}_resolveObjectValuesConfig(e,r){return Fe(e,r)}_buildArrayItemSettings(e,r){return e.type==="object"&&Object.
@@ -864,11 +870,11 @@ nullable===!0||a.nullable===!0,f=e.nullOnEmpty===!0||a.nullOnEmpty===!0;if(!Obje
864
870
  if(r===""&&f)return C(o,s,null),{errors:{},shouldContinue:!1};let d={schema:this,definition:e,value:r,fieldName:n,object:o,
865
871
  objectBeforeCast:i,valueBeforeCast:r,options:a,mode:c.operationName,operation:c.operationName,fieldPresent:!0,computedOptions:{
866
872
  nullable:u||f,nullOnEmpty:f},throwTypeError:()=>{throw this._typeError(n)},throwParamError:(y,E,S)=>{throw this._paramError(
867
- n,y,E,S)}};try{let y=p(d);if(No(y))throw new Error(`Type handler for "${e.type}" must be synchronous.`);y!==void 0&&(C(o,
873
+ n,y,E,S)}};try{let y=p(d);if(Mo(y))throw new Error(`Type handler for "${e.type}" must be synchronous.`);y!==void 0&&(C(o,
868
874
  s,y),d.value=y)}catch(y){if(y.errorObject)return{errors:this._singleErrorMap(y.errorObject),shouldContinue:!1};throw y}return{
869
875
  errors:{},context:d,shouldContinue:!0}}_runFieldValidators(e,r,n,o,s,i){for(let a of Object.keys(e)){if(a==="type"||this.
870
876
  _paramToBeSkipped(a,i.skipParams,r)||!Object.hasOwn(this.validators,a))continue;let c=this.validators[a];try{s.parameterName=
871
- a,s.parameterValue=e[a];let u=c(s);if(No(u))throw new Error(`Validator handler for "${a}" must be synchronous.`);u!==void 0&&
877
+ a,s.parameterValue=e[a];let u=c(s);if(Mo(u))throw new Error(`Validator handler for "${a}" must be synchronous.`);u!==void 0&&
872
878
  (C(n,o,u),s.value=u)}catch(u){if(u.errorObject)return this._singleErrorMap(u.errorObject);throw u}}return{}}_normalizeAndValidateValue(e,r,n,o,s,i,a,c){
873
879
  let u=this._castValue(e,r,n,o,s,i,a,c);if(Object.keys(u.errors).length>0)return u.errors;if(!u.shouldContinue)return{};let{
874
880
  context:f}=u,p=this._validateNestedValue(e,n,o,s,a,c);return Object.keys(p).length>0?p:(f.value=o[s],this._runFieldValidators(
@@ -903,10 +909,10 @@ c,n,i,o,a);this._mergeErrors(s,u)}if(a.applyDefaults){for(let c of Object.keys(t
903
909
  this.structure[c].defaultTo!==void 0){let u=this.structure[c],f=typeof u.defaultTo=="function"?u.defaultTo():u.defaultTo,
904
910
  p=this._normalizeDefault(u,f,{fieldPath:c,currentObject:i,containerKey:c,objectBeforeCast:n,options:o,settings:a});if(this.
905
911
  _mergeErrors(s,p.errors),Object.keys(p.errors).length>0)continue;C(i,c,p.value),a.defaultedFields.add(c)}}return{validatedObject:this.
906
- _buildOperationResult(n,i,a),errors:s}}_validateSelectedTree(e,r,n,o,s=""){let i={},a={};for(let c of Do(Object.keys(e))){
907
- let u=$o(s,c);if(!Object.hasOwn(this.structure,c))throw new Error(`Unknown schema path "${u}".`);let f=this._validateSelectedField(
912
+ _buildOperationResult(n,i,a),errors:s}}_validateSelectedTree(e,r,n,o,s=""){let i={},a={};for(let c of Uo(Object.keys(e))){
913
+ let u=Vo(s,c);if(!Object.hasOwn(this.structure,c))throw new Error(`Unknown schema path "${u}".`);let f=this._validateSelectedField(
908
914
  c,e[c],r,a,n,o,u);this._mergeErrors(i,f)}return{validatedObject:a,errors:i}}_validateSelectedField(e,r,n,o,s,i,a){if(!Object.
909
- hasOwn(this.structure,e))return{};let c=this.structure[e],u=r.self===!0,f=ko(r);if(this._fieldToBeSkipped(a,s))return{};
915
+ hasOwn(this.structure,e))return{};let c=this.structure[e],u=r.self===!0,f=Do(r);if(this._fieldToBeSkipped(a,s))return{};
910
916
  let p=Object.hasOwn(n,e),d=n[e],y={};if(!p){if(u&&i.enforceRequired&&c.required&&!this._paramToBeSkipped("required",s.skipParams,
911
917
  a)&&this._mergeErrors(y,this._singleErrorMap({field:a,code:"REQUIRED",message:"Field is required",params:{}})),u&&i.applyDefaults&&
912
918
  c.defaultTo!==void 0){let A=typeof c.defaultTo=="function"?c.defaultTo():c.defaultTo,I=this._normalizeDefault(c,A,{fieldPath:a,
@@ -916,13 +922,13 @@ a).errorObject):{};let E={[e]:d};if(u){let A=this._normalizeAndValidateValue(c,d
916
922
  E[e]!==void 0?C(o,e,E[e]):E[e]===null&&C(o,e,null),A}if(!f)return{};let S=this._castValue(c,d,a,E,e,n,s,i);if(Object.keys(
917
923
  S.errors).length>0)return S.errors;if(!S.shouldContinue)return{};let x=this._validateSelectedDescendants(c,r.children,a,
918
924
  E,e,s,i);return gt(E[e])&&C(o,e,E[e]),x}_validateSelectedDescendants(e,r,n,o,s,i,a){if(e.type==="object"){let c=this._resolveObjectFieldMode(
919
- n,e);if(c.kind!=="nested")throw new Error(`Schema path "${n}" does not support nested field selection.`);let u=o[s];if(!q(
925
+ n,e);if(c.kind!=="nested")throw new Error(`Schema path "${n}" does not support nested field selection.`);let u=o[s];if(!B(
920
926
  u))return{};let f=c.schema._validateSelectedTree(r,u,je(i,n),{...a,defaultedFields:new Set});return C(o,s,f.validatedObject),
921
927
  ke(f.errors,n)}if(e.type==="array"){let c=this._resolveArrayItemsConfig(n,e);if(!c)throw new Error(`Schema path "${n}" d\
922
928
  oes not define array items for nested selection.`);return this._validateSelectedArrayItems(n,o,s,c,r,i,a)}throw new Error(
923
929
  `Schema path "${n}" does not support nested field selection.`)}_validateSelectedArrayItems(e,r,n,o,s,i,a){let c=[],u=r[n],
924
- f={};C(r,n,c);for(let p of Do(Object.keys(s))){if(!/^[0-9]+$/.test(p))throw new Error(`Schema path "${we(e,p)}" is inval\
925
- id because array segments must use numeric indexes.`);let d=Number(p),y=we(e,d),E=s[p],S=E.self===!0,x=ko(E);if(this._fieldToBeSkipped(
930
+ f={};C(r,n,c);for(let p of Uo(Object.keys(s))){if(!/^[0-9]+$/.test(p))throw new Error(`Schema path "${we(e,p)}" is inval\
931
+ id because array segments must use numeric indexes.`);let d=Number(p),y=we(e,d),E=s[p],S=E.self===!0,x=Do(E);if(this._fieldToBeSkipped(
926
932
  y,i))continue;if(!Object.hasOwn(u,d)){S&&a.rejectExplicitUndefined&&C(f,y,this._typeError(y).errorObject);continue}let A=u[d];
927
933
  if(A===void 0){S&&a.rejectExplicitUndefined&&C(f,y,this._typeError(y).errorObject);continue}if(o.kind==="schema"){if(S){
928
934
  let N=o.schema._validateWithOperation("replace",o.schema.operations.replace,A,je(i,y));gt(N.validatedObject)&&C(c,d,N.validatedObject),
@@ -934,42 +940,43 @@ continue}if(!x)continue;let v=this._castValue(o.definition,A,y,T,0,u,i,I);if(Obj
934
940
  f,v.errors);continue}if(!v.shouldContinue)continue;let k=this._validateSelectedDescendants(o.definition,E.children,y,T,0,
935
941
  i,I);gt(T[0])&&C(c,d,T[0]),this._mergeErrors(f,k)}return f}validateWith(e,r,n={}){if(!Object.hasOwn(this.operations,e))throw new Error(
936
942
  `Unknown operation "${e}".`);let o=this.operations[e];return this._assertPlainObjectInput(e,r),this._validateWithOperation(
937
- e,o,r,n)}validateAt(e,r,n={}){this._assertPlainObjectInput("validateAt",r);let o=br(e),{operationName:s,operation:i,validationOptions:a}=this.
938
- _resolvePathValidationRequest(n),c=this._validateSelectedTree(Mo([e]),r,a,this._buildOperationSettings(s,i,r));return{validatedValue:gc(
943
+ e,o,r,n)}validateAt(e,r,n={}){this._assertPlainObjectInput("validateAt",r);let o=vr(e),{operationName:s,operation:i,validationOptions:a}=this.
944
+ _resolvePathValidationRequest(n),c=this._validateSelectedTree($o([e]),r,a,this._buildOperationSettings(s,i,r));return{validatedValue:bc(
939
945
  c.validatedObject,o),errors:c.errors}}validatePaths(e,r,n={}){if(this._assertPlainObjectInput("validatePaths",r),!Array.
940
946
  isArray(e)||e.length===0)throw new Error("validatePaths() expects a non-empty array of schema paths.");let{operationName:o,
941
- operation:s,validationOptions:i}=this._resolvePathValidationRequest(n);return this._validateSelectedTree(Mo(e),r,i,this.
947
+ operation:s,validationOptions:i}=this._resolvePathValidationRequest(n);return this._validateSelectedTree($o(e),r,i,this.
942
948
  _buildOperationSettings(o,s,r))}_installOperationMethods(){for(let e of Object.keys(this.operations)){if(e in this)throw new Error(
943
949
  `Operation name "${e}" is reserved and cannot be used as a schema method.`);this[e]=(r,n={})=>this.validateWith(e,r,n)}}toJsonSchema(e={}){
944
- return Ro(this,e)}getFieldDefinitions(){return Sr(this.structure)}getFieldDefinition(e){if(typeof e!="string"||e.trim()===
945
- "")throw new Error("Field path must be a non-empty string.");let r=xr(this,br(e.trim()));return r===null?null:Sr(r)}getFieldMessages(e){
946
- let r=this.getFieldDefinition(e);return!r||typeof r.messages!="object"||r.messages===null?Object.freeze({}):Sr(r.messages)}cleanup(e,r){
947
- let n={};for(let o of Object.keys(e))Object.hasOwn(this.structure,o)&&this.structure[o][r]&&C(n,o,e[o]);return n}};var{parse:ip,stringify:vc}=JSON,{keys:ap}=Object,Cc=String,Tc="string";var Bo="object",Ac=(t,e)=>e;var Vo=(t,e,r)=>{let n=Cc(e.push(r)-1);return t.set(r,n),n};var Ho=(t,e,r)=>{let n=e&&typeof e===Bo?(f,p)=>f===""||-1<e.indexOf(f)?p:void 0:e||Ac,o=new Map,s=[],i=[],a=+Vo(o,s,n.call(
948
- {"":t},"",t)),c=!a;for(;a<s.length;)c=!0,i[a]=vc(s[a++],u,r);return"["+i.join(",")+"]";function u(f,p){if(c)return c=!c,
949
- p;let d=n.call(this,f,p);switch(typeof d){case Bo:if(d===null)return d;case Tc:return o.get(d)||Vo(o,s,d)}return d}};var Ic=new Set(["true","1","yes","y","on"]),Rc=new Set(["false","0","no","n","off"]);function Nc(t){return t!==null&&(typeof t==
950
- "object"||typeof t=="function")&&typeof t.then=="function"}function Fo(t){if(typeof t=="number")return Number.isFinite(t)?
950
+ return jo(this,e)}getFieldDefinitions(){return xr.has(this)||xr.set(this,br(this.structure)),xr.get(this)}getFieldDefinition(e){
951
+ if(typeof e!="string"||e.trim()==="")throw new Error("Field path must be a non-empty string.");let r=Cr(this,vr(e.trim()));
952
+ return r===null?null:br(r)}getFieldMessages(e){let r=this.getFieldDefinition(e);return!r||typeof r.messages!="object"||r.
953
+ messages===null?Object.freeze({}):br(r.messages)}cleanup(e,r){let n={};for(let o of Object.keys(e))Object.hasOwn(this.structure,
954
+ o)&&this.structure[o][r]&&C(n,o,e[o]);return n}};var{parse:lp,stringify:Pc}=JSON,{keys:dp}=Object,Ic=String,Rc="string";var Fo="object",Nc=(t,e)=>e;var qo=(t,e,r)=>{let n=Ic(e.push(r)-1);return t.set(r,n),n};var Go=(t,e,r)=>{let n=e&&typeof e===Fo?(f,p)=>f===""||-1<e.indexOf(f)?p:void 0:e||Nc,o=new Map,s=[],i=[],a=+qo(o,s,n.call(
955
+ {"":t},"",t)),c=!a;for(;a<s.length;)c=!0,i[a]=Pc(s[a++],u,r);return"["+i.join(",")+"]";function u(f,p){if(c)return c=!c,
956
+ p;let d=n.call(this,f,p);switch(typeof d){case Fo:if(d===null)return d;case Rc:return o.get(d)||qo(o,s,d)}return d}};var jc=new Set(["true","1","yes","y","on"]),Mc=new Set(["false","0","no","n","off"]);function Dc(t){return t!==null&&(typeof t==
957
+ "object"||typeof t=="function")&&typeof t.then=="function"}function Wo(t){if(typeof t=="number")return Number.isFinite(t)?
951
958
  t:null;if(typeof t=="bigint"){let e=Number(t);return Number.isSafeInteger(e)?e:null}if(typeof t=="string"){let e=t.trim();
952
- if(e==="")return null;let r=Number(e);return Number.isFinite(r)?r:null}return null}function vr(t,e){if(Object.is(t,e))return!0;
959
+ if(e==="")return null;let r=Number(e);return Number.isFinite(r)?r:null}return null}function Ar(t,e){if(Object.is(t,e))return!0;
953
960
  if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();if(t instanceof RegExp&&e instanceof RegExp)return t.
954
961
  source===e.source&&t.flags===e.flags;if(Array.isArray(t)||Array.isArray(e)){if(!Array.isArray(t)||!Array.isArray(e)||t.length!==
955
- e.length)return!1;for(let o=0;o<t.length;o++)if(!vr(t[o],e[o]))return!1;return!0}if(t===null||e===null||typeof t!="objec\
962
+ e.length)return!1;for(let o=0;o<t.length;o++)if(!Ar(t[o],e[o]))return!1;return!0}if(t===null||e===null||typeof t!="objec\
956
963
  t"||typeof e!="object"||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;let r=Object.keys(t),n=Object.keys(
957
- e);if(r.length!==n.length)return!1;for(let o of r)if(!Object.hasOwn(e,o)||!vr(t[o],e[o]))return!1;return!0}var kc={install(t){
964
+ e);if(r.length!==n.length)return!1;for(let o of r)if(!Object.hasOwn(e,o)||!Ar(t[o],e[o]))return!1;return!0}var Lc={install(t){
958
965
  let{addType:e,addValidator:r}=t;e("none",n=>n.value),e("file",n=>{let o=n.value;o==null&&n.throwTypeError();let s=typeof o;
959
966
  if(s==="string"||s==="number"||s==="boolean"){let i=o.toString();return n.definition.noTrim?i:i.trim()}n.throwTypeError()}),
960
967
  e("string",n=>{let o=n.value;if(o==null)return"";let s=typeof o;if(s==="string"||s==="number"||s==="boolean"){let i=o.toString();
961
- return n.definition.noTrim?i:i.trim()}n.throwTypeError()}),e("blob",n=>n.value),e("number",n=>{let o=Fo(n.value);return o===
962
- null&&n.throwTypeError(),o}),e("integer",n=>{let o=Fo(n.value);return(o===null||!Number.isInteger(o))&&n.throwTypeError(),
963
- o}),e("epochMilliseconds",n=>{let o=lr(n.value,864e13);return o===null&&n.throwTypeError(),o}),e("epochSeconds",n=>{let o=lr(
964
- n.value,864e10);return o===null&&n.throwTypeError(),o}),e("dateTime",n=>{let o=qe(n.definition,n.fieldName);return xo(n.
965
- value,o)||n.throwTypeError(),n.value}),e("date",n=>(wo(n.value)||n.throwTypeError(),n.value)),e("time",n=>{let o=qe(n.definition,
966
- n.fieldName);return bo(n.value,o)||n.throwTypeError(),n.value}),e("array",n=>n.definition.type==="array"&&!Array.isArray(
967
- n.value)?[n.value]:n.value),e("object",n=>(q(n.value)||n.throwTypeError(),n.value)),e("serialize",n=>{try{return JSON.stringify(
968
- n.value)}catch{try{return Ho(n.value)}catch{n.throwTypeError()}}}),e("boolean",n=>{if(typeof n.value=="boolean")return n.
968
+ return n.definition.noTrim?i:i.trim()}n.throwTypeError()}),e("blob",n=>n.value),e("number",n=>{let o=Wo(n.value);return o===
969
+ null&&n.throwTypeError(),o}),e("integer",n=>{let o=Wo(n.value);return(o===null||!Number.isInteger(o))&&n.throwTypeError(),
970
+ o}),e("epochMilliseconds",n=>{let o=fr(n.value,864e13);return o===null&&n.throwTypeError(),o}),e("epochSeconds",n=>{let o=fr(
971
+ n.value,864e10);return o===null&&n.throwTypeError(),o}),e("dateTime",n=>{let o=qe(n.definition,n.fieldName);return Co(n.
972
+ value,o)||n.throwTypeError(),n.value}),e("date",n=>(Oo(n.value)||n.throwTypeError(),n.value)),e("time",n=>{let o=qe(n.definition,
973
+ n.fieldName);return vo(n.value,o)||n.throwTypeError(),n.value}),e("array",n=>n.definition.type==="array"&&!Array.isArray(
974
+ n.value)?[n.value]:n.value),e("object",n=>(B(n.value)||n.throwTypeError(),n.value)),e("serialize",n=>{try{return JSON.stringify(
975
+ n.value)}catch{try{return Go(n.value)}catch{n.throwTypeError()}}}),e("boolean",n=>{if(typeof n.value=="boolean")return n.
969
976
  value;if(typeof n.value=="number"){if(n.value===1)return!0;if(n.value===0)return!1;n.throwTypeError()}if(typeof n.value==
970
977
  "bigint"){if(n.value===1n)return!0;if(n.value===0n)return!1;n.throwTypeError()}if(typeof n.value=="string"){let o=String(
971
978
  n.definition.stringFalseWhen||"false").trim().toLowerCase(),s=String(n.definition.stringTrueWhen||"true").trim().toLowerCase(),
972
- i=n.value.trim().toLowerCase(),a=new Set([...Rc,o]),c=new Set([...Ic,s]);if(a.has(i))return!1;if(c.has(i))return!0}n.throwTypeError()}),
979
+ i=n.value.trim().toLowerCase(),a=new Set([...Mc,o]),c=new Set([...jc,s]);if(a.has(i))return!1;if(c.has(i))return!0}n.throwTypeError()}),
973
980
  e("id",n=>{if(typeof n.value=="number"){if(Number.isSafeInteger(n.value)&&n.value>0)return n.value;n.throwTypeError()}if(typeof n.
974
981
  value=="bigint"){if(n.value>0n&&n.value<=BigInt(Number.MAX_SAFE_INTEGER))return Number(n.value);n.throwTypeError()}if(typeof n.
975
982
  value=="string"){let o=n.value.trim();/^[1-9][0-9]*$/.test(o)||n.throwTypeError();let s=Number(o);return Number.isSafeInteger(
@@ -982,7 +989,7 @@ n.value.toString().length>n.parameterValue&&n.throwParamError("MAX_LENGTH",`Leng
982
989
  characters.`,{max:n.parameterValue,actual:n.value.toString().length})}),r("max",n=>{n.value!==void 0&&Re(n.definition)&&
983
990
  typeof n.value=="number"&&n.value>n.parameterValue&&n.throwParamError("MAX_VALUE",`Value must be no more than ${n.parameterValue}\
984
991
  .`,{max:n.parameterValue,actual:n.value})}),r("enum",n=>{if(!Array.isArray(n.parameterValue))throw new Error(`Enum for ${n.
985
- fieldName} must be an array.`);n.parameterValue.some(s=>vr(s,n.value))||n.throwParamError("ENUM_VALUE","Value must match\
992
+ fieldName} must be an array.`);n.parameterValue.some(s=>Ar(s,n.value))||n.throwParamError("ENUM_VALUE","Value must match\
986
993
  one of the allowed enum values.",{allowed:n.parameterValue})}),r("pattern",n=>{if(n.value===void 0||n.definition.type!==
987
994
  "string"||typeof n.value!="string")return;let o=n.parameterValue,s=o instanceof RegExp?new RegExp(o.source,o.flags):typeof o==
988
995
  "string"?new RegExp(o):null;if(!s)throw new Error(`Pattern for ${n.fieldName} must be a string or RegExp.`);s.test(n.value)||
@@ -990,79 +997,83 @@ n.throwParamError("PATTERN","Value does not match the required pattern.",{patter
990
997
  parameterValue){if(n.definition.type!=="boolean")throw new Error(`strictBoolean can only be used on boolean fields (${n.
991
998
  fieldName}).`);typeof n.valueBeforeCast!="boolean"&&n.throwParamError("STRICT_BOOLEAN","Value must be a boolean.")}}),r(
992
999
  "validator",n=>{if(typeof n.parameterValue!="function")throw new Error(`Validator for ${n.fieldName} must be a function.`);
993
- let o=n.parameterValue(n.value,n.object,n);if(Nc(o))throw new Error(`Custom validator for "${n.fieldName}" must be synch\
1000
+ let o=n.parameterValue(n.value,n.object,n);if(Dc(o))throw new Error(`Custom validator for "${n.fieldName}" must be synch\
994
1001
  ronous.`);typeof o=="string"&&n.throwParamError("CUSTOM_VALIDATOR_FAILED",o)}),r("uppercase",n=>{if(typeof n.value=="str\
995
1002
  ing")return n.value.toUpperCase()}),r("lowercase",n=>{if(typeof n.value=="string")return n.value.toLowerCase()}),r("leng\
996
1003
  th",n=>{if(typeof n.value=="string")return n.value.substr(0,n.parameterValue);Number.isInteger(Number(n.valueBeforeCast))&&
997
1004
  String(n.valueBeforeCast).length>n.parameterValue&&n.throwParamError("RANGE_EXCEEDED","Numeric value is out of the allow\
998
- ed character range.",{max:n.parameterValue,actual:String(n.valueBeforeCast).length})}),r("notEmpty",n=>{n.parameterValue&&
999
- typeof n.value=="string"&&n.value===""&&n.throwParamError("NOT_EMPTY","Field cannot be empty.")}),r("required",()=>{}),r(
1000
- "unsigned",()=>{}),r("precision",()=>{}),r("scale",()=>{}),r("temporalPrecision",n=>{if(n.definition.type!=="time"&&n.definition.
1001
- type!=="dateTime")throw new Error(`temporalPrecision can only be used on time or dateTime fields (${n.fieldName}).`)}),r(
1002
- "nullable",()=>{}),r("nullOnEmpty",()=>{}),r("defaultTo",()=>{})}},qo=kc;var Xo=new WeakMap,Jo=new WeakMap,Ko=Symbol.for("json-rest-schema.registry-metadata");function jc(t,e,r){if(typeof r!="f\
1003
- unction")throw new Error(`Type handler for '${e}' must be a function.`);C(t,e,r)}function Mc(t,e,r){if(typeof r!="functi\
1004
- on")throw new Error(`Validator handler for '${e}' must be a function.`);C(t,e,r)}function wt(t={}){let e=Object.create(null);
1005
- for(let[r,n]of Object.entries(t))C(e,r,n);return e}function Dc(t,e){if(typeof t.install!="function")throw new Error("Plu\
1006
- gin must have an install method.");t.install(e)}function Go(t,e,r){Xo.set(t,e),Jo.set(t,r),Object.defineProperty(t,Ko,{value:Object.
1007
- freeze({getTypes:()=>e,getValidators:()=>r}),enumerable:!1,configurable:!1,writable:!1})}function Lc(t){if(!t||typeof t!=
1008
- "object"&&typeof t!="function")return null;let e=Xo.get(t),r=Jo.get(t);if(e&&r)return{types:e,validators:r};let n=t[Ko];
1005
+ ed character range.",{max:n.parameterValue,actual:String(n.valueBeforeCast).length})}),r("minItems",n=>{Array.isArray(n.
1006
+ value)&&n.value.length<n.parameterValue&&n.throwParamError("MIN_ITEMS",`Must have at least ${n.parameterValue} items.`,{
1007
+ min:n.parameterValue,actual:n.value.length})}),r("maxItems",n=>{Array.isArray(n.value)&&n.value.length>n.parameterValue&&
1008
+ n.throwParamError("MAX_ITEMS",`Must have no more than ${n.parameterValue} items.`,{max:n.parameterValue,actual:n.value.length})}),
1009
+ r("notEmpty",n=>{n.parameterValue&&typeof n.value=="string"&&n.value===""&&n.throwParamError("NOT_EMPTY","Field cannot b\
1010
+ e empty.")}),r("required",()=>{}),r("unsigned",()=>{}),r("precision",()=>{}),r("scale",()=>{}),r("temporalPrecision",n=>{
1011
+ if(n.definition.type!=="time"&&n.definition.type!=="dateTime")throw new Error(`temporalPrecision can only be used on tim\
1012
+ e or dateTime fields (${n.fieldName}).`)}),r("nullable",()=>{}),r("nullOnEmpty",()=>{}),r("defaultTo",()=>{})}},Xo=Lc;var Qo=new WeakMap,Zo=new WeakMap,es=Symbol.for("json-rest-schema.registry-metadata"),wt=new WeakSet;function $c(t,e,r){
1013
+ if(typeof r!="function")throw new Error(`Type handler for '${e}' must be a function.`);C(t,e,r)}function Uc(t,e,r){if(typeof r!=
1014
+ "function")throw new Error(`Validator handler for '${e}' must be a function.`);C(t,e,r)}function bt(t={}){let e=Object.create(
1015
+ null);for(let[r,n]of Object.entries(t))C(e,r,n);return e}function Jo(t,e){if(typeof t.install!="function")throw new Error(
1016
+ "Plugin must have an install method.");t.install(e)}function Ko(t,e,r){Qo.set(t,e),Zo.set(t,r),Object.defineProperty(t,es,
1017
+ {value:Object.freeze({getTypes:()=>e,getValidators:()=>r}),enumerable:!1,configurable:!1,writable:!1})}function zc(t){if(!t||
1018
+ typeof t!="object"&&typeof t!="function")return null;let e=Qo.get(t),r=Zo.get(t);if(e&&r)return{types:e,validators:r};let n=t[es];
1009
1019
  return n&&typeof n.getTypes=="function"&&typeof n.getValidators=="function"?{types:n.getTypes(),validators:n.getValidators()}:
1010
1020
  typeof t=="object"&&t.types&&typeof t.types=="object"&&t.validators&&typeof t.validators=="object"&&typeof t.create=="fu\
1011
1021
  nction"&&typeof t.replace=="function"&&typeof t.patch=="function"&&typeof t.toJsonSchema=="function"?{types:t.types,validators:t.
1012
- validators}:null}function Uc(t){return t.length===1&&Array.isArray(t[0])?t[0]:t}function $c(t,e){return t===e}function Wo(t,e,r){
1013
- for(let[n,o]of Object.entries(e)){if(Object.hasOwn(t,n)&&!$c(t[n],o))throw new Error(`Cannot merge schema factories with\
1014
- conflicting ${r} "${n}".`);C(t,n,o)}}function zc(t,e,r){let n=Uc(r).filter(Boolean);if(n.length<1)return{types:wt(t),validators:wt(
1015
- e)};let o=Object.create(null),s=Object.create(null);for(let i of n){let a=Lc(i);if(!a)throw new Error("Factory sources m\
1016
- ust be schema instances or schema factories created by json-rest-schema.");Wo(o,a.types,"type"),Wo(s,a.validators,"valid\
1017
- ator")}return{types:o,validators:s}}function Yo({types:t={},validators:e={},installCore:r=!0}={}){let n=wt(t),o=wt(e),s=(i,a={})=>{
1018
- let c=new Me(i,n,o,a.operations);return Go(c,n,o),c};return Go(s,n,o),s.addType=(i,a)=>{jc(n,i,a)},s.addValidator=(i,a)=>{
1019
- Mc(o,i,a)},s.use=i=>{Dc(i,{addType:s.addType,addValidator:s.addValidator})},s.createFactory=(...i)=>{let a=zc(n,o,i);return Yo(
1020
- {types:a.types,validators:a.validators,installCore:!1})},r&&s.use(qo),s}var Qo=Yo({installCore:!0});var Ap=Object.freeze({schema:Qo({}),mode:"replace"});var Zo=/^[a-z][a-z0-9_.-]*$/u,Hc=/^[A-Za-z_$][A-Za-z0-9_$]*$/u;function Fc(t){return String(t||"").trim().toLowerCase()}
1021
- function Ar(t,e){let r=Fc(t);if(!Zo.test(r))throw new TypeError(`${e} must match ${Zo.toString()}.`);return r}function Cr(t,e){
1022
- if(t==null)return Object.freeze({});if(!H(t))throw new TypeError(`${e} must be an object mapping local names to capabili\
1023
- ty ids.`);let r={},n=new Set;for(let[o,s]of Object.entries(t)){let i=String(o||"").trim();if(!Hc.test(i))throw new TypeError(
1024
- `${e} local name "${i}" must be a JavaScript identifier.`);let a=Ar(s,`${e}.${i}`);if(n.has(a))throw new TypeError(`${e}\
1025
- declares capability "${a}" more than once.`);n.add(a),r[i]=a}return Object.freeze(r)}function qc(t,e,r){if(t==null)return Object.
1026
- freeze({});if(!H(t))throw new TypeError(`${r}.hints must be an object mapping required capability ids to what to registe\
1027
- r.`);let n=new Set(Object.values(e)),o={};for(let[s,i]of Object.entries(t)){let a=Ar(s,`${r}.hints key`);if(!n.has(a))throw new TypeError(
1022
+ validators}:null}function Bc(t){return t.length===1&&Array.isArray(t[0])?t[0]:t}function Yo(t,e,r){for(let[n,o]of Object.
1023
+ entries(e)){if(Object.hasOwn(t,n)&&t[n]!==o){if(wt.has(o))continue;if(!wt.has(t[n]))throw new Error(`Cannot merge schema\
1024
+ factories with conflicting ${r} "${n}".`)}C(t,n,o)}}function Vc(t,e,r){let n=Bc(r).filter(Boolean);if(n.length<1)return{
1025
+ types:bt(t),validators:bt(e)};let o=Object.create(null),s=Object.create(null);for(let i of n){let a=zc(i);if(!a)throw new Error(
1026
+ "Factory sources must be schema instances or schema factories created by json-rest-schema.");Yo(o,a.types,"type"),Yo(s,a.
1027
+ validators,"validator")}return{types:o,validators:s}}function ts({types:t={},validators:e={},installCore:r=!0}={}){let n=bt(
1028
+ t),o=bt(e),s=(i,a={})=>{let c=new Me(i,n,o,a.operations);return Ko(c,n,o),c};return Ko(s,n,o),s.addType=(i,a)=>{$c(n,i,a)},
1029
+ s.addValidator=(i,a)=>{Uc(o,i,a)},s.use=i=>{Jo(i,{addType:s.addType,addValidator:s.addValidator})},s.createFactory=(...i)=>{
1030
+ let a=Vc(n,o,i);return ts({types:a.types,validators:a.validators,installCore:!1})},r&&Jo(Xo,{addType:(i,a)=>{wt.add(a),s.
1031
+ addType(i,a)},addValidator:(i,a)=>{wt.add(a),s.addValidator(i,a)}}),s}var rs=ts({installCore:!0});var Np=Object.freeze({schema:rs({}),mode:"replace"});var ns=/^[a-z][a-z0-9_.-]*$/u,qc=/^[A-Za-z_$][A-Za-z0-9_$]*$/u;function Gc(t){return String(t||"").trim().toLowerCase()}
1032
+ function Rr(t,e){let r=Gc(t);if(!ns.test(r))throw new TypeError(`${e} must match ${ns.toString()}.`);return r}function Pr(t,e){
1033
+ if(t==null)return Object.freeze({});if(!F(t))throw new TypeError(`${e} must be an object mapping local names to capabili\
1034
+ ty ids.`);let r={},n=new Set;for(let[o,s]of Object.entries(t)){let i=String(o||"").trim();if(!qc.test(i))throw new TypeError(
1035
+ `${e} local name "${i}" must be a JavaScript identifier.`);let a=Rr(s,`${e}.${i}`);if(n.has(a))throw new TypeError(`${e}\
1036
+ declares capability "${a}" more than once.`);n.add(a),r[i]=a}return Object.freeze(r)}function Wc(t,e,r){if(t==null)return Object.
1037
+ freeze({});if(!F(t))throw new TypeError(`${r}.hints must be an object mapping required capability ids to what to registe\
1038
+ r.`);let n=new Set(Object.values(e)),o={};for(let[s,i]of Object.entries(t)){let a=Rr(s,`${r}.hints key`);if(!n.has(a))throw new TypeError(
1028
1039
  `${r}.hints names "${a}", which the provider does not require.`);if(typeof i!="string"||!i.trim())throw new TypeError(`${r}\
1029
- .hints["${a}"] must be the text that says what to register.`);o[a]=i.trim()}return Object.freeze(o)}function Gc(t){let e=new Map;
1040
+ .hints["${a}"] must be the text that says what to register.`);o[a]=i.trim()}return Object.freeze(o)}function Xc(t){let e=new Map;
1030
1041
  for(let[r,n]of Object.entries(t))for(let o of Object.keys(n)){if(e.has(o))throw new TypeError(`Provider local name "${o}\
1031
- " is declared by both ${e.get(o)} and ${r}.`);e.set(o,r)}}function Tr(t,e){if(t==null)return null;if(typeof t!="function")
1032
- throw new TypeError(`${e} must be a function when provided.`);return t}function bt({id:t,requires:e={},optional:r={},provides:n={},
1033
- hints:o={},setup:s,boot:i=null,shutdown:a=null}={}){let c=Ar(t,"Provider id"),u=Cr(e,`${c}.requires`),f=Cr(r,`${c}.optio\
1034
- nal`),p=Cr(n,`${c}.provides`);Gc({requires:u,optional:f,provides:p});let d=Tr(s,`${c}.setup`);if(!d)throw new TypeError(
1035
- `${c}.setup is required.`);return Object.freeze({id:c,requires:u,optional:f,provides:p,hints:qc(o,u,c),setup:d,boot:Tr(i,
1036
- `${c}.boot`),shutdown:Tr(a,`${c}.shutdown`)})}var es="public";var Xc="/api",ts=`${Xc}/bootstrap`;function Pr(){let t=[],e=new Set,r=!1;function n({id:a,order:c=0,contribute:u}={}){if(r)throw new Error("Bootstrap regis\
1042
+ " is declared by both ${e.get(o)} and ${r}.`);e.set(o,r)}}function Ir(t,e){if(t==null)return null;if(typeof t!="function")
1043
+ throw new TypeError(`${e} must be a function when provided.`);return t}function xt({id:t,requires:e={},optional:r={},provides:n={},
1044
+ hints:o={},setup:s,boot:i=null,shutdown:a=null}={}){let c=Rr(t,"Provider id"),u=Pr(e,`${c}.requires`),f=Pr(r,`${c}.optio\
1045
+ nal`),p=Pr(n,`${c}.provides`);Xc({requires:u,optional:f,provides:p});let d=Ir(s,`${c}.setup`);if(!d)throw new TypeError(
1046
+ `${c}.setup is required.`);return Object.freeze({id:c,requires:u,optional:f,provides:p,hints:Wc(o,u,c),setup:d,boot:Ir(i,
1047
+ `${c}.boot`),shutdown:Ir(a,`${c}.shutdown`)})}var os="public";var Kc="/api",ss=`${Kc}/bootstrap`;function Nr(){let t=[],e=new Set,r=!1;function n({id:a,order:c=0,contribute:u}={}){if(r)throw new Error("Bootstrap regis\
1037
1048
  tration is closed after the first payload is resolved.");let f=Ke(a);if(!f)throw new TypeError("Bootstrap contributor id\
1038
1049
  is required.");if(typeof u!="function")throw new TypeError(`Bootstrap contributor "${f}" requires contribute().`);if(e.
1039
1050
  has(f))throw new Error(`Bootstrap contributor "${f}" is duplicated.`);return e.add(f),t.push(Object.freeze({id:f,order:Number.
1040
1051
  isFinite(c)?Number(c):0,contribute:u})),i}async function o(a={}){r=!0;let c={},u=t.map((f,p)=>({entry:f,index:p})).sort(
1041
1052
  (f,p)=>f.entry.order-p.entry.order||f.index-p.index).map(({entry:f})=>f);for(let f of u){let p=await f.contribute(Object.
1042
- freeze({...H(a)?a:{},payload:Object.freeze({...c})}));c={...c,...H(p)?p:{}}}return Object.freeze(c)}function s(){return Object.
1053
+ freeze({...F(a)?a:{},payload:Object.freeze({...c})}));c={...c,...F(p)?p:{}}}return Object.freeze(c)}function s(){return Object.
1043
1054
  freeze({sealed:r,contributorIds:Object.freeze(t.map(a=>a.id).sort())})}let i=Object.freeze({register:n,resolve:o,diagnostics:s});
1044
- return i}var Jc=bt({id:"runtime.bootstrap",requires:{http:"runtime.http"},provides:{bootstrap:"runtime.bootstrap"},setup({http:t}){
1045
- let e=Pr();return t.router.register("GET",ts,{auth:es,meta:{tags:["bootstrap"],summary:"Resolve app bootstrap payload"}},
1046
- async(r,n)=>{n.code(200).send(await e.resolve({request:r,reply:n,query:r.query||{}}))}),{bootstrap:e}}});function Kc(t){if(!H(t))throw new TypeError("Event listener must be an object.");let e=String(t.id||"").trim();if(!e)throw new TypeError(
1055
+ return i}var Yc=xt({id:"runtime.bootstrap",requires:{http:"runtime.http"},provides:{bootstrap:"runtime.bootstrap"},setup({http:t}){
1056
+ let e=Nr();return t.router.register("GET",ss,{auth:os,meta:{tags:["bootstrap"],summary:"Resolve app bootstrap payload"}},
1057
+ async(r,n)=>{n.code(200).send(await e.resolve({request:r,reply:n,query:r.query||{}}))}),{bootstrap:e}}});function Qc(t){if(!F(t))throw new TypeError("Event listener must be an object.");let e=String(t.id||"").trim();if(!e)throw new TypeError(
1047
1058
  "Event listener id is required.");if(typeof t.handle!="function")throw new TypeError(`Event listener "${e}" requires han\
1048
1059
  dle().`);if(t.matches!=null&&typeof t.matches!="function")throw new TypeError(`Event listener "${e}" matches must be a f\
1049
- unction when provided.`);return Object.freeze({id:e,handle:t.handle,matches:t.matches??null})}function Yc(t){if(!H(t))throw new TypeError(
1060
+ unction when provided.`);return Object.freeze({id:e,handle:t.handle,matches:t.matches??null})}function Zc(t){if(!F(t))throw new TypeError(
1050
1061
  "Published event must be an object.");let e=String(t.type||"").trim();if(!e)throw new TypeError("Published event type is\
1051
- required.");return Object.freeze({...t,type:e})}function Ir(){let t=[],e=new Set;function r(i){let a=Kc(i);if(e.has(a.id))
1052
- throw new Error(`Event listener "${a.id}" is duplicated.`);return e.add(a.id),t.push(a),s}async function n(i){let a=Yc(i);
1062
+ required.");return Object.freeze({...t,type:e})}function kr(){let t=[],e=new Set;function r(i){let a=Qc(i);if(e.has(a.id))
1063
+ throw new Error(`Event listener "${a.id}" is duplicated.`);return e.add(a.id),t.push(a),s}async function n(i){let a=Zc(i);
1053
1064
  for(let c of t)c.matches&&c.matches(a)!==!0||await c.handle(a);return a}function o(){return Object.freeze({listenerIds:Object.
1054
- freeze(t.map(i=>i.id))})}let s=Object.freeze({register:r,publish:n,diagnostics:o});return s}var Qc=bt({id:"runtime.events",provides:{events:"runtime.events"},setup(){return{events:Ir()}}});var xt=(t,e,r,n)=>{let{modelProviderId:o,...s}=Qe(e,t);return Object.freeze({...s,label:r,defaultThinking:n})},rs=Object.
1065
+ freeze(t.map(i=>i.id))})}let s=Object.freeze({register:r,publish:n,diagnostics:o});return s}var eu=xt({id:"runtime.events",provides:{events:"runtime.events"},setup(){return{events:kr()}}});var Ot=(t,e,r,n)=>{let{modelProviderId:o,...s}=Qe(e,t);return Object.freeze({...s,label:r,defaultThinking:n})},is=Object.
1055
1066
  freeze([Object.freeze({...re("deepseek"),label:"DeepSeek",shortLabel:"DeepSeek",description:"DeepSeek API key \xB7 usage-ba\
1056
1067
  sed billing",keyUrl:"https://platform.deepseek.com/api_keys",guideUrl:"https://api-docs.deepseek.com/quick_start/agent_i\
1057
- ntegrations/codex/",ownerOnly:!1,models:Object.freeze([xt("deepseek","deepseek-flash","DeepSeek V4.1 Flash","high"),xt("\
1068
+ ntegrations/codex/",ownerOnly:!1,models:Object.freeze([Ot("deepseek","deepseek-flash","DeepSeek V4.1 Flash","high"),Ot("\
1058
1069
  deepseek","deepseek-v4-pro","DeepSeek V4 Pro","high")])}),Object.freeze({...re("zai-coding-plan"),label:"GLM \xB7 Coding Pl\
1059
1070
  an",shortLabel:"GLM",description:"Z.AI Coding Plan key \xB7 uses your subscription quota",keyUrl:"https://z.ai/manage-ap\
1060
- ikey/apikey-list",guideUrl:"https://docs.z.ai/devpack/tool/codex",ownerOnly:!0,models:Object.freeze([xt("zai-coding-plan",
1071
+ ikey/apikey-list",guideUrl:"https://docs.z.ai/devpack/tool/codex",ownerOnly:!0,models:Object.freeze([Ot("zai-coding-plan",
1061
1072
  "glm-5.3","GLM 5.3","max")])}),Object.freeze({...re("zai"),label:"GLM \xB7 Pay-as-you-go API",shortLabel:"GLM",description:"\
1062
1073
  Z.AI API key \xB7 pay-as-you-go account",keyUrl:"https://z.ai/manage-apikey/apikey-list",guideUrl:"https://docs.z.ai/gui\
1063
1074
  des/overview/quick-start",setupNote:"Use a key from a Z.AI account without a Coding Plan. Pay-as-you-go access through C\
1064
1075
  odex and Claude Code still needs live verification; a successful check confirms model access, not billing.",ownerOnly:!1,
1065
- models:Object.freeze([xt("zai","glm-5.3","GLM 5.3","max")])}),Object.freeze({id:se,custom:!0,label:"Custom endpoint",shortLabel:"\
1066
- Custom",description:"Your own model server \xB7 no Vibe64 billing",ownerOnly:!0,models:Object.freeze([])})]);var $h=Object.freeze(["auth","codex","status.json"]),zh=Object.freeze(["auth","codex","auth-status.json"]);var Rr="VIBE64_CODEX_CUSTOM_HOME",um=Object.freeze({codex:"Codex",claude:"Claude Code",opencode:"OpenCode"});function ns(t){let e=t?.models||[...new Map(rs.flatMap(r=>r.models).map(r=>[r.id,r])).values()];return Pt({models:e})}var[Zc,eu,...tu]=process.argv.slice(2);await Dt({runtimeDir:Zc,command:eu,args:tu,runtimeToken:process.env.VIBE64_CODEX_APP_SERVER_RUNTIME_TOKEN,
1067
- bundled:process.env.VIBE64_CODEX_MODEL_CATALOG_SOURCE==="bundled",additionalModels:[...ns().models,...process.env[Rr]?await De(
1068
- process.env[Rr]):[]],env:process.env});
1076
+ models:Object.freeze([Ot("zai","glm-5.3","GLM 5.3","max")])}),Object.freeze({id:se,custom:!0,label:"Custom endpoint",shortLabel:"\
1077
+ Custom",description:"Your own model server \xB7 no Vibe64 billing",ownerOnly:!0,models:Object.freeze([])})]);var Hh=Object.freeze(["auth","codex","status.json"]),Fh=Object.freeze(["auth","codex","auth-status.json"]);var jr="VIBE64_CODEX_CUSTOM_HOME",pm=Object.freeze({codex:"Codex",claude:"Claude Code",opencode:"OpenCode"});function as(t){let e=t?.models||[...new Map(is.flatMap(r=>r.models).map(r=>[r.id,r])).values()];return It({models:e})}var[tu,ru,...nu]=process.argv.slice(2);await Lt({runtimeDir:tu,command:ru,args:nu,runtimeToken:process.env.VIBE64_CODEX_APP_SERVER_RUNTIME_TOKEN,
1078
+ bundled:process.env.VIBE64_CODEX_MODEL_CATALOG_SOURCE==="bundled",additionalModels:[...as().models,...process.env[jr]?await De(
1079
+ process.env[jr]):[]],env:process.env});