@bryanhu/codexly 0.5.0 → 0.7.0

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 (210) hide show
  1. package/CHANGELOG.md +33 -1
  2. package/README.md +3 -2
  3. package/README.zh-CN.md +3 -2
  4. package/dist/{chunk-4PA52XB7.js → chunk-CGZ44LHJ.js} +22 -18
  5. package/dist/{chunk-AGMOIRX4.js → chunk-DEKHLAWT.js} +1 -1
  6. package/dist/{chunk-UAJCHOZK.js → chunk-NAHIDASP.js} +6 -6
  7. package/dist/{chunk-ZSWNUDDK.js → chunk-TEWPWZPG.js} +1 -1
  8. package/dist/cli.js +7 -23
  9. package/dist/client/index.js +2 -2
  10. package/dist/protocol/index.js +1 -1
  11. package/dist/providers/codex/index.js +2 -2
  12. package/dist/server/index.js +4 -4
  13. package/dist/web/.vite/manifest.json +175 -175
  14. package/dist/web/.vite/manifest.json.br +0 -0
  15. package/dist/web/.vite/manifest.json.gz +0 -0
  16. package/dist/web/assets/{button-group-GolVMDRO.js → button-group-b2-xCzBP.js} +1 -1
  17. package/dist/web/assets/button-group-b2-xCzBP.js.br +0 -0
  18. package/dist/web/assets/button-group-b2-xCzBP.js.gz +0 -0
  19. package/dist/web/assets/check-DExH7zwT.js +1 -0
  20. package/dist/web/assets/check-DExH7zwT.js.br +0 -0
  21. package/dist/web/assets/check-DExH7zwT.js.gz +0 -0
  22. package/dist/web/assets/{checkbox-37DlWLBa.js → checkbox-Cft8ypsb.js} +1 -1
  23. package/dist/web/assets/checkbox-Cft8ypsb.js.br +0 -0
  24. package/dist/web/assets/checkbox-Cft8ypsb.js.gz +0 -0
  25. package/dist/web/assets/{chunk-BO2N2NFS-C9R62W5i.js → chunk-BO2N2NFS-bEY6272A.js} +4 -4
  26. package/dist/web/assets/chunk-BO2N2NFS-bEY6272A.js.br +0 -0
  27. package/dist/web/assets/chunk-BO2N2NFS-bEY6272A.js.gz +0 -0
  28. package/dist/web/assets/{code-highlighter-B_sQt157.js → code-highlighter-Cm84nMIT.js} +1 -1
  29. package/dist/web/assets/code-highlighter-Cm84nMIT.js.br +0 -0
  30. package/dist/web/assets/code-highlighter-Cm84nMIT.js.gz +0 -0
  31. package/dist/web/assets/{code-languages-lQDTaxNN.js → code-languages-D5Nrl7sO.js} +1 -1
  32. package/dist/web/assets/code-languages-D5Nrl7sO.js.br +0 -0
  33. package/dist/web/assets/code-languages-D5Nrl7sO.js.gz +0 -0
  34. package/dist/web/assets/{context-menu-Dag_JnAP.js → context-menu-CZuXyHCN.js} +1 -1
  35. package/dist/web/assets/context-menu-CZuXyHCN.js.br +0 -0
  36. package/dist/web/assets/context-menu-CZuXyHCN.js.gz +0 -0
  37. package/dist/web/assets/{dist-D75B5EEW.js → dist-ByRtqJXv.js} +1 -1
  38. package/dist/web/assets/dist-ByRtqJXv.js.br +0 -0
  39. package/dist/web/assets/dist-ByRtqJXv.js.gz +0 -0
  40. package/dist/web/assets/dist-hozmU7_C.js +1 -0
  41. package/dist/web/assets/dist-hozmU7_C.js.br +0 -0
  42. package/dist/web/assets/{dist-rI8Y0b5t.js.gz → dist-hozmU7_C.js.gz} +0 -0
  43. package/dist/web/assets/{es2015-Bu8fG2VP.js → es2015-Cd8ehGwJ.js} +1 -1
  44. package/dist/web/assets/es2015-Cd8ehGwJ.js.br +0 -0
  45. package/dist/web/assets/es2015-Cd8ehGwJ.js.gz +0 -0
  46. package/dist/web/assets/{file-code-corner-BfUyC-bF.js → file-code-corner-D1h7_C7f.js} +1 -1
  47. package/dist/web/assets/file-code-corner-D1h7_C7f.js.br +0 -0
  48. package/dist/web/assets/file-code-corner-D1h7_C7f.js.gz +0 -0
  49. package/dist/web/assets/{file-navigation-view-preference-De4_ih3I.js → file-navigation-view-preference-BikLLmlP.js} +1 -1
  50. package/dist/web/assets/file-navigation-view-preference-BikLLmlP.js.br +0 -0
  51. package/dist/web/assets/file-navigation-view-preference-BikLLmlP.js.gz +0 -0
  52. package/dist/web/assets/{file-review-dialog-D6itznUk.js → file-review-dialog-DVVtiNEL.js} +2 -2
  53. package/dist/web/assets/file-review-dialog-DVVtiNEL.js.br +0 -0
  54. package/dist/web/assets/file-review-dialog-DVVtiNEL.js.gz +0 -0
  55. package/dist/web/assets/{file-tree-CFUaXf_b.js → file-tree-CbuG5nkz.js} +1 -1
  56. package/dist/web/assets/file-tree-CbuG5nkz.js.br +0 -0
  57. package/dist/web/assets/file-tree-CbuG5nkz.js.gz +0 -0
  58. package/dist/web/assets/{git-commit-horizontal-BsjVPZ9W.js → git-commit-horizontal-BJGxHnV4.js} +1 -1
  59. package/dist/web/assets/git-commit-horizontal-BJGxHnV4.js.br +0 -0
  60. package/dist/web/assets/git-commit-horizontal-BJGxHnV4.js.gz +0 -0
  61. package/dist/web/assets/{git-history-panel-DIr_4cfP.js → git-history-panel-4j8odsDb.js} +2 -2
  62. package/dist/web/assets/git-history-panel-4j8odsDb.js.br +0 -0
  63. package/dist/web/assets/git-history-panel-4j8odsDb.js.gz +0 -0
  64. package/dist/web/assets/global-settings-dialog-Dhqfe3qK.js +1 -0
  65. package/dist/web/assets/global-settings-dialog-Dhqfe3qK.js.br +0 -0
  66. package/dist/web/assets/global-settings-dialog-Dhqfe3qK.js.gz +0 -0
  67. package/dist/web/assets/{highlighted-body-OFNGDK62-J6vd4AIe.js → highlighted-body-OFNGDK62-oKnqW5V8.js} +1 -1
  68. package/dist/web/assets/highlighted-body-OFNGDK62-oKnqW5V8.js.br +0 -0
  69. package/dist/web/assets/highlighted-body-OFNGDK62-oKnqW5V8.js.gz +0 -0
  70. package/dist/web/assets/{index-CMCPev5S.js → index-C1A_OTjT.js} +3 -3
  71. package/dist/web/assets/index-C1A_OTjT.js.br +0 -0
  72. package/dist/web/assets/index-C1A_OTjT.js.gz +0 -0
  73. package/dist/web/assets/index-lKikkWES.css +2 -0
  74. package/dist/web/assets/index-lKikkWES.css.br +0 -0
  75. package/dist/web/assets/index-lKikkWES.css.gz +0 -0
  76. package/dist/web/assets/{lazy-message-response-kziUJe0I.js → lazy-message-response-DNUwJy0d.js} +2 -2
  77. package/dist/web/assets/lazy-message-response-DNUwJy0d.js.br +0 -0
  78. package/dist/web/assets/lazy-message-response-DNUwJy0d.js.gz +0 -0
  79. package/dist/web/assets/loader-circle-CYc50iXi.js +1 -0
  80. package/dist/web/assets/loader-circle-CYc50iXi.js.br +0 -0
  81. package/dist/web/assets/loader-circle-CYc50iXi.js.gz +0 -0
  82. package/dist/web/assets/mermaid-GHXKKRXX-8A2qFznr.js +1 -0
  83. package/dist/web/assets/mermaid-GHXKKRXX-8A2qFznr.js.br +0 -0
  84. package/dist/web/assets/mermaid-GHXKKRXX-8A2qFznr.js.gz +0 -0
  85. package/dist/web/assets/{message-response-BH1WLiOG.js → message-response-DVL8_J3z.js} +1 -1
  86. package/dist/web/assets/message-response-DVL8_J3z.js.br +0 -0
  87. package/dist/web/assets/message-response-DVL8_J3z.js.gz +0 -0
  88. package/dist/web/assets/{patch-diff-viewer-BP7d9z00.js → patch-diff-viewer-BgNx-ffs.js} +2 -2
  89. package/dist/web/assets/patch-diff-viewer-BgNx-ffs.js.br +0 -0
  90. package/dist/web/assets/patch-diff-viewer-BgNx-ffs.js.gz +0 -0
  91. package/dist/web/assets/{project-file-popup-page-BqEZEv1s.js → project-file-popup-page-BwPTSc8o.js} +1 -1
  92. package/dist/web/assets/project-file-popup-page-BwPTSc8o.js.br +0 -0
  93. package/dist/web/assets/project-file-popup-page-BwPTSc8o.js.gz +0 -0
  94. package/dist/web/assets/{project-source-panel-BkRa6eOs.js → project-source-panel-DWDcX3T9.js} +3 -3
  95. package/dist/web/assets/project-source-panel-DWDcX3T9.js.br +0 -0
  96. package/dist/web/assets/project-source-panel-DWDcX3T9.js.gz +0 -0
  97. package/dist/web/assets/{prompt-input-controls-5tCLhg2X.js → prompt-input-controls-CT6f-1tO.js} +1 -1
  98. package/dist/web/assets/prompt-input-controls-CT6f-1tO.js.br +0 -0
  99. package/dist/web/assets/prompt-input-controls-CT6f-1tO.js.gz +0 -0
  100. package/dist/web/assets/{prompt-reference-token-Dnq6GpIQ.js → prompt-reference-token-CTm_xv2R.js} +1 -1
  101. package/dist/web/assets/prompt-reference-token-CTm_xv2R.js.br +0 -0
  102. package/dist/web/assets/prompt-reference-token-CTm_xv2R.js.gz +0 -0
  103. package/dist/web/assets/{provider-connection-queries-BPczkhUT.js → provider-connection-queries-CLpiOnBN.js} +1 -1
  104. package/dist/web/assets/provider-connection-queries-CLpiOnBN.js.br +0 -0
  105. package/dist/web/assets/provider-connection-queries-CLpiOnBN.js.gz +0 -0
  106. package/dist/web/assets/{shiki-bundle-VSjMZiOC.js → shiki-bundle-Dhkx9AYM.js} +1 -1
  107. package/dist/web/assets/shiki-bundle-Dhkx9AYM.js.br +0 -0
  108. package/dist/web/assets/shiki-bundle-Dhkx9AYM.js.gz +0 -0
  109. package/dist/web/assets/{tooltip-jGsHGylL.js → tooltip-BU1Qoscx.js} +1 -1
  110. package/dist/web/assets/tooltip-BU1Qoscx.js.br +0 -0
  111. package/dist/web/assets/tooltip-BU1Qoscx.js.gz +0 -0
  112. package/dist/web/assets/{upload-D6X3pnK5.js → upload-BDX8w8rQ.js} +1 -1
  113. package/dist/web/assets/upload-BDX8w8rQ.js.br +0 -0
  114. package/dist/web/assets/upload-BDX8w8rQ.js.gz +0 -0
  115. package/dist/web/assets/{useInfiniteQuery-Bs3l5hx7.js → useInfiniteQuery-Bj31MvqL.js} +1 -1
  116. package/dist/web/assets/useInfiniteQuery-Bj31MvqL.js.br +0 -0
  117. package/dist/web/assets/useInfiniteQuery-Bj31MvqL.js.gz +0 -0
  118. package/dist/web/assets/{workbench-inspector-changes-BbHDvE9x.js → workbench-inspector-changes-CWIx9Os6.js} +2 -2
  119. package/dist/web/assets/workbench-inspector-changes-CWIx9Os6.js.br +0 -0
  120. package/dist/web/assets/workbench-inspector-changes-CWIx9Os6.js.gz +0 -0
  121. package/dist/web/assets/{workbench-pet-canvas-DRzsdZ1c.js → workbench-pet-canvas-CO4nVH5z.js} +1 -1
  122. package/dist/web/assets/workbench-pet-canvas-CO4nVH5z.js.br +0 -0
  123. package/dist/web/assets/workbench-pet-canvas-CO4nVH5z.js.gz +0 -0
  124. package/dist/web/assets/workbench-shell-DVC3DE5a.js +15 -0
  125. package/dist/web/assets/workbench-shell-DVC3DE5a.js.br +0 -0
  126. package/dist/web/assets/workbench-shell-DVC3DE5a.js.gz +0 -0
  127. package/dist/web/index.html +12 -12
  128. package/dist/web/index.html.br +0 -0
  129. package/dist/web/index.html.gz +0 -0
  130. package/package.json +1 -1
  131. package/dist/web/assets/button-group-GolVMDRO.js.br +0 -0
  132. package/dist/web/assets/button-group-GolVMDRO.js.gz +0 -0
  133. package/dist/web/assets/check-DufG-ZUa.js +0 -1
  134. package/dist/web/assets/check-DufG-ZUa.js.br +0 -0
  135. package/dist/web/assets/check-DufG-ZUa.js.gz +0 -0
  136. package/dist/web/assets/checkbox-37DlWLBa.js.br +0 -0
  137. package/dist/web/assets/checkbox-37DlWLBa.js.gz +0 -0
  138. package/dist/web/assets/chunk-BO2N2NFS-C9R62W5i.js.br +0 -0
  139. package/dist/web/assets/chunk-BO2N2NFS-C9R62W5i.js.gz +0 -0
  140. package/dist/web/assets/code-highlighter-B_sQt157.js.br +0 -0
  141. package/dist/web/assets/code-highlighter-B_sQt157.js.gz +0 -0
  142. package/dist/web/assets/code-languages-lQDTaxNN.js.br +0 -0
  143. package/dist/web/assets/code-languages-lQDTaxNN.js.gz +0 -0
  144. package/dist/web/assets/context-menu-Dag_JnAP.js.br +0 -0
  145. package/dist/web/assets/context-menu-Dag_JnAP.js.gz +0 -0
  146. package/dist/web/assets/dist-D75B5EEW.js.br +0 -0
  147. package/dist/web/assets/dist-D75B5EEW.js.gz +0 -0
  148. package/dist/web/assets/dist-rI8Y0b5t.js +0 -1
  149. package/dist/web/assets/dist-rI8Y0b5t.js.br +0 -0
  150. package/dist/web/assets/es2015-Bu8fG2VP.js.br +0 -0
  151. package/dist/web/assets/es2015-Bu8fG2VP.js.gz +0 -0
  152. package/dist/web/assets/file-code-corner-BfUyC-bF.js.br +0 -1
  153. package/dist/web/assets/file-code-corner-BfUyC-bF.js.gz +0 -0
  154. package/dist/web/assets/file-navigation-view-preference-De4_ih3I.js.br +0 -0
  155. package/dist/web/assets/file-navigation-view-preference-De4_ih3I.js.gz +0 -0
  156. package/dist/web/assets/file-review-dialog-D6itznUk.js.br +0 -0
  157. package/dist/web/assets/file-review-dialog-D6itznUk.js.gz +0 -0
  158. package/dist/web/assets/file-tree-CFUaXf_b.js.br +0 -0
  159. package/dist/web/assets/file-tree-CFUaXf_b.js.gz +0 -0
  160. package/dist/web/assets/git-commit-horizontal-BsjVPZ9W.js.br +0 -0
  161. package/dist/web/assets/git-commit-horizontal-BsjVPZ9W.js.gz +0 -0
  162. package/dist/web/assets/git-history-panel-DIr_4cfP.js.br +0 -0
  163. package/dist/web/assets/git-history-panel-DIr_4cfP.js.gz +0 -0
  164. package/dist/web/assets/global-settings-dialog-CWeXTy89.js +0 -1
  165. package/dist/web/assets/global-settings-dialog-CWeXTy89.js.br +0 -0
  166. package/dist/web/assets/global-settings-dialog-CWeXTy89.js.gz +0 -0
  167. package/dist/web/assets/highlighted-body-OFNGDK62-J6vd4AIe.js.br +0 -0
  168. package/dist/web/assets/highlighted-body-OFNGDK62-J6vd4AIe.js.gz +0 -0
  169. package/dist/web/assets/index-CMCPev5S.js.br +0 -0
  170. package/dist/web/assets/index-CMCPev5S.js.gz +0 -0
  171. package/dist/web/assets/index-CcSDzrvO.css +0 -2
  172. package/dist/web/assets/index-CcSDzrvO.css.br +0 -0
  173. package/dist/web/assets/index-CcSDzrvO.css.gz +0 -0
  174. package/dist/web/assets/lazy-message-response-kziUJe0I.js.br +0 -0
  175. package/dist/web/assets/lazy-message-response-kziUJe0I.js.gz +0 -0
  176. package/dist/web/assets/loader-circle-DUyazd0N.js +0 -1
  177. package/dist/web/assets/loader-circle-DUyazd0N.js.br +0 -0
  178. package/dist/web/assets/loader-circle-DUyazd0N.js.gz +0 -0
  179. package/dist/web/assets/mermaid-GHXKKRXX-6KIGYUKQ.js +0 -1
  180. package/dist/web/assets/mermaid-GHXKKRXX-6KIGYUKQ.js.br +0 -0
  181. package/dist/web/assets/mermaid-GHXKKRXX-6KIGYUKQ.js.gz +0 -0
  182. package/dist/web/assets/message-response-BH1WLiOG.js.br +0 -0
  183. package/dist/web/assets/message-response-BH1WLiOG.js.gz +0 -0
  184. package/dist/web/assets/patch-diff-viewer-BP7d9z00.js.br +0 -0
  185. package/dist/web/assets/patch-diff-viewer-BP7d9z00.js.gz +0 -0
  186. package/dist/web/assets/project-file-popup-page-BqEZEv1s.js.br +0 -0
  187. package/dist/web/assets/project-file-popup-page-BqEZEv1s.js.gz +0 -0
  188. package/dist/web/assets/project-source-panel-BkRa6eOs.js.br +0 -0
  189. package/dist/web/assets/project-source-panel-BkRa6eOs.js.gz +0 -0
  190. package/dist/web/assets/prompt-input-controls-5tCLhg2X.js.br +0 -0
  191. package/dist/web/assets/prompt-input-controls-5tCLhg2X.js.gz +0 -0
  192. package/dist/web/assets/prompt-reference-token-Dnq6GpIQ.js.br +0 -3
  193. package/dist/web/assets/prompt-reference-token-Dnq6GpIQ.js.gz +0 -0
  194. package/dist/web/assets/provider-connection-queries-BPczkhUT.js.br +0 -0
  195. package/dist/web/assets/provider-connection-queries-BPczkhUT.js.gz +0 -0
  196. package/dist/web/assets/shiki-bundle-VSjMZiOC.js.br +0 -0
  197. package/dist/web/assets/shiki-bundle-VSjMZiOC.js.gz +0 -0
  198. package/dist/web/assets/tooltip-jGsHGylL.js.br +0 -0
  199. package/dist/web/assets/tooltip-jGsHGylL.js.gz +0 -0
  200. package/dist/web/assets/upload-D6X3pnK5.js.br +0 -0
  201. package/dist/web/assets/upload-D6X3pnK5.js.gz +0 -0
  202. package/dist/web/assets/useInfiniteQuery-Bs3l5hx7.js.br +0 -0
  203. package/dist/web/assets/useInfiniteQuery-Bs3l5hx7.js.gz +0 -0
  204. package/dist/web/assets/workbench-inspector-changes-BbHDvE9x.js.br +0 -0
  205. package/dist/web/assets/workbench-inspector-changes-BbHDvE9x.js.gz +0 -0
  206. package/dist/web/assets/workbench-pet-canvas-DRzsdZ1c.js.br +0 -0
  207. package/dist/web/assets/workbench-pet-canvas-DRzsdZ1c.js.gz +0 -0
  208. package/dist/web/assets/workbench-shell-wnOOfeVI.js +0 -15
  209. package/dist/web/assets/workbench-shell-wnOOfeVI.js.br +0 -0
  210. package/dist/web/assets/workbench-shell-wnOOfeVI.js.gz +0 -0
@@ -1 +1 @@
1
- import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{i as n,t as r}from"./react-runtime-CVaUQXZF.js";import{S as i,_ as a,a as o,d as s,g as c,i as l,l as u,m as d,n as f,o as p,r as m,s as ee,t as te,u as ne,x as h,y as re}from"./dist-rI8Y0b5t.js";var ie=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ae=new class extends ie{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},oe={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},se=new class{#e=oe;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function ce(e){setTimeout(e,0)}var le=typeof window>`u`||`Deno`in globalThis;function ue(){}function de(e,t){return typeof e==`function`?e(t):e}function fe(e){return typeof e==`number`&&e>=0&&e!==1/0}function pe(e,t){return Math.max(e+(t||0)-Date.now(),0)}function me(e,t){return typeof e==`function`?e(t):e}function he(e,t){return typeof e==`function`?e(t):e}function ge(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==ve(o,t.options))return!1}else if(!be(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function _e(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(ye(t.options.mutationKey)!==ye(a))return!1}else if(!be(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function ve(e,t){return(t?.queryKeyHashFn||ye)(e)}function ye(e){return JSON.stringify(e,(e,t)=>Te(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function be(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!be(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!be(e[r],t[r]))return!1;return!0}return!1}var xe=Object.prototype.hasOwnProperty;function Se(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=we(e)&&we(t);if(!r&&!(Te(e)&&Te(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:xe.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Se(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function Ce(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function we(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Te(e){if(!Ee(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Ee(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Ee(e){return Object.prototype.toString.call(e)===`[object Object]`}function De(e){return new Promise(t=>{se.setTimeout(t,e)})}function Oe(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Se(e,t)}function ke(e){return e}function Ae(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function je(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Me=Symbol();function Ne(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Me?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Pe(e,t){return typeof e==`function`?e(...t):!!e}function Fe(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var Ie=(()=>{let e=()=>le;return{isServer(){return e()},setIsServer(t){e=t}}})();function Le(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var Re=ce;function ze(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Re,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var Be=ze(),Ve=new class extends ie{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function He(e){return Math.min(1e3*2**e,3e4)}function Ue(e){return(e??`online`)!==`online`||Ve.isOnline()}var We=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Ge(e){let t=!1,n=0,r,i=Le(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new We(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>ae.isFocused()&&(e.networkMode===`always`||Ve.isOnline())&&e.canRun(),u=()=>Ue(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(Ie.isServer()?0:3),o=e.retryDelay??He,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),De(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var Ke=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),fe(this.gcTime)&&(this.#e=se.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ie.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(se.clearTimeout(this.#e),this.#e=void 0)}};function qe(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Fe(e,()=>t.signal,()=>n=!0)},u=Ne(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?je:Ae;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Ye:Je,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Je(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Je(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Ye(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Xe(e,t){return t?Je(e,t)!=null:!1}function Ze(e,t){return!t||!e.getPreviousPageParam?!1:Ye(e,t)!=null}var Qe=class extends Ke{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=tt(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=tt(this.options);e.data!==void 0&&(this.setState(et(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Oe(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(ue).catch(ue):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>he(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Me||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>me(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!pe(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=Ne(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?qe(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=Ge({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof We&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof We){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...$e(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...et(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),Be.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function $e(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ue(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function et(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function tt(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var nt=class extends ie{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=Le(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),it(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return at(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return at(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof he(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Ce(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&ot(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||he(this.options.enabled,this.#t)!==he(t.enabled,this.#t)||me(this.options.staleTime,this.#t)!==me(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||he(this.options.enabled,this.#t)!==he(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return ct(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(ue)),t}#g(){this.#b();let e=me(this.options.staleTime,this.#t);if(Ie.isServer()||this.#r.isStale||!fe(e))return;let t=pe(this.#r.dataUpdatedAt,e)+1;this.#d=se.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(Ie.isServer()||he(this.options.enabled,this.#t)===!1||!fe(this.#p)||this.#p===0)&&(this.#f=se.setInterval(()=>{(this.options.refetchIntervalInBackground||ae.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(se.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(se.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&it(e,t),o=i&&ot(e,n,t,r);(a||o)&&(l={...l,...$e(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let ee=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,ee=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=Oe(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!ee)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=Oe(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let te=l.fetchStatus===`fetching`,ne=m===`pending`,h=m===`error`,re=ne&&te,ie=d!==void 0,ae={status:m,fetchStatus:l.fetchStatus,isPending:ne,isSuccess:m===`success`,isError:h,isInitialLoading:re,isLoading:re,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:te,isRefetching:te&&!ne,isLoadingError:h&&!ie,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:h&&ie,isStale:st(e,t),refetch:this.refetch,promise:this.#o,isEnabled:he(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=ae.data!==void 0,r=ae.status===`error`&&!t,i=e=>{r?e.reject(ae.error):t&&e.resolve(ae.data)},a=()=>{let e=this.#o=ae.promise=Le();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||ae.data!==o.value)&&a();break;case`rejected`:(!r||ae.error!==o.reason)&&a();break}}return ae}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!Ce(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){Be.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function rt(e,t){return he(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&he(t.retryOnMount,e)===!1)}function it(e,t){return rt(e,t)||e.state.data!==void 0&&at(e,t,t.refetchOnMount)}function at(e,t,n){if(he(t.enabled,e)!==!1&&me(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&st(e,t)}return!1}function ot(e,t,n,r){return(e!==t||he(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&st(e,n)}function st(e,t){return he(t.enabled,e)!==!1&&e.isStaleByTime(me(t.staleTime,e))}function ct(e,t){return!Ce(e.getCurrentResult(),t)}var g=t(n(),1),_=r(),lt=g.createContext(void 0),ut=e=>{let t=g.useContext(lt);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},dt=({client:e,children:t})=>(g.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,_.jsx)(lt.Provider,{value:e,children:t})),ft=g.createContext(!1),pt=()=>g.useContext(ft);ft.Provider;function mt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ht=g.createContext(mt()),gt=()=>g.useContext(ht),_t=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Pe(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},vt=e=>{g.useEffect(()=>{e.clearReset()},[e])},yt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Pe(n,[e.error,r])),bt=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},xt=(e,t)=>e.isLoading&&e.isFetching&&!t,St=(e,t)=>e?.suspense&&t.isPending,Ct=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function wt(e,t,n){let r=pt(),i=gt(),a=ut(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,bt(o),_t(o,i,s),vt(i);let l=!a.getQueryCache().get(o.queryHash),[u]=g.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(g.useSyncExternalStore(g.useCallback(e=>{let t=f?u.subscribe(Be.batchCalls(e)):ue;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),g.useEffect(()=>{u.setOptions(o)},[o,u]),St(o,d))throw Ct(o,u,i);if(yt({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!Ie.isServer()&&xt(d,r)&&(l?Ct(o,u,i):s?.promise)?.catch(ue).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function Tt(e){return e}function Et(e){return e}function Dt(e){return y(e)&&!v(e)&&!Lt(e)&&Symbol.asyncIterator in e}function v(e){return Array.isArray(e)}function Ot(e){return typeof e==`bigint`}function kt(e){return typeof e==`boolean`}function At(e){return e instanceof globalThis.Date}function jt(e){return typeof e==`function`}function Mt(e){return y(e)&&!v(e)&&!Lt(e)&&Symbol.iterator in e}function Nt(e){return e===null}function Pt(e){return typeof e==`number`}function y(e){return typeof e==`object`&&!!e}function Ft(e){return e instanceof globalThis.RegExp}function b(e){return typeof e==`string`}function It(e){return typeof e==`symbol`}function Lt(e){return e instanceof globalThis.Uint8Array}function x(e){return e===void 0}function Rt(e){return e.map(e=>Ut(e))}function zt(e){return new Date(e.getTime())}function Bt(e){return new Uint8Array(e)}function Vt(e){return new RegExp(e.source,e.flags)}function Ht(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=Ut(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=Ut(e[n]);return t}function Ut(e){return v(e)?Rt(e):At(e)?zt(e):Lt(e)?Bt(e):Ft(e)?Vt(e):y(e)?Ht(e):e}function Wt(e){return Ut(e)}function Gt(e,t){return Wt(t===void 0?e:{...t,...e})}function Kt(e){return Zt(e)&&globalThis.Symbol.asyncIterator in e}function qt(e){return Zt(e)&&globalThis.Symbol.iterator in e}function Jt(e){return e instanceof globalThis.Promise}function Yt(e){return e instanceof Date&&globalThis.Number.isFinite(e.getTime())}function Xt(e){return e instanceof globalThis.Uint8Array}function Zt(e){return typeof e==`object`&&!!e}function Qt(e){return globalThis.Array.isArray(e)&&!globalThis.ArrayBuffer.isView(e)}function $t(e){return e===void 0}function en(e){return e===null}function tn(e){return typeof e==`boolean`}function nn(e){return typeof e==`number`}function rn(e){return globalThis.Number.isInteger(e)}function an(e){return typeof e==`bigint`}function on(e){return typeof e==`string`}function sn(e){return typeof e==`function`}function cn(e){return typeof e==`symbol`}var ln;(function(e){e.InstanceMode=`default`,e.ExactOptionalPropertyTypes=!1,e.AllowArrayObject=!1,e.AllowNaN=!1,e.AllowNullVoid=!1;function t(t,n){return e.ExactOptionalPropertyTypes?n in t:t[n]!==void 0}e.IsExactOptionalProperty=t;function n(t){let n=Zt(t);return e.AllowArrayObject?n:n&&!Qt(t)}e.IsObjectLike=n;function r(e){return n(e)&&!(e instanceof Date)&&!(e instanceof Uint8Array)}e.IsRecordLike=r;function i(t){return e.AllowNaN?nn(t):Number.isFinite(t)}e.IsNumberLike=i;function a(t){let n=$t(t);return e.AllowNullVoid?n||t===null:n}e.IsVoidLike=a})(ln||={});function un(e){return globalThis.Object.freeze(e).map(e=>hn(e))}function dn(e){return e}function fn(e){return e}function pn(e){return e}function mn(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=hn(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=hn(e[n]);return globalThis.Object.freeze(t)}function hn(e){return v(e)?un(e):At(e)?dn(e):Lt(e)?fn(e):Ft(e)?pn(e):y(e)?mn(e):e}function S(e,t){let n=t===void 0?e:{...t,...e};switch(ln.InstanceMode){case`freeze`:return hn(n);case`clone`:return Wt(n);default:return n}}var gn=class extends Error{constructor(e){super(e)}},_n=Symbol.for(`TypeBox.Transform`),vn=Symbol.for(`TypeBox.Readonly`),yn=Symbol.for(`TypeBox.Optional`),bn=Symbol.for(`TypeBox.Hint`),C=Symbol.for(`TypeBox.Kind`);function xn(e){return y(e)&&e[vn]===`Readonly`}function Sn(e){return y(e)&&e[yn]===`Optional`}function Cn(e){return w(e,`Any`)}function wn(e){return w(e,`Argument`)}function Tn(e){return w(e,`Array`)}function En(e){return w(e,`AsyncIterator`)}function Dn(e){return w(e,`BigInt`)}function On(e){return w(e,`Boolean`)}function kn(e){return w(e,`Computed`)}function An(e){return w(e,`Constructor`)}function jn(e){return w(e,`Date`)}function Mn(e){return w(e,`Function`)}function Nn(e){return w(e,`Integer`)}function Pn(e){return w(e,`Intersect`)}function Fn(e){return w(e,`Iterator`)}function w(e,t){return y(e)&&C in e&&e[C]===t}function In(e){return kt(e)||Pt(e)||b(e)}function Ln(e){return w(e,`Literal`)}function Rn(e){return w(e,`MappedKey`)}function zn(e){return w(e,`MappedResult`)}function Bn(e){return w(e,`Never`)}function Vn(e){return w(e,`Not`)}function Hn(e){return w(e,`Null`)}function Un(e){return w(e,`Number`)}function Wn(e){return w(e,`Object`)}function Gn(e){return w(e,`Promise`)}function Kn(e){return w(e,`Record`)}function qn(e){return w(e,`Ref`)}function Jn(e){return w(e,`RegExp`)}function Yn(e){return w(e,`String`)}function Xn(e){return w(e,`Symbol`)}function Zn(e){return w(e,`TemplateLiteral`)}function Qn(e){return w(e,`This`)}function $n(e){return y(e)&&_n in e}function er(e){return w(e,`Tuple`)}function tr(e){return w(e,`Undefined`)}function T(e){return w(e,`Union`)}function nr(e){return w(e,`Uint8Array`)}function rr(e){return w(e,`Unknown`)}function ir(e){return w(e,`Unsafe`)}function ar(e){return w(e,`Void`)}function or(e){return y(e)&&C in e&&b(e[C])}function sr(e){return Cn(e)||wn(e)||Tn(e)||On(e)||Dn(e)||En(e)||kn(e)||An(e)||jn(e)||Mn(e)||Nn(e)||Pn(e)||Fn(e)||Ln(e)||Rn(e)||zn(e)||Bn(e)||Vn(e)||Hn(e)||Un(e)||Wn(e)||Gn(e)||Kn(e)||qn(e)||Jn(e)||Yn(e)||Xn(e)||Zn(e)||Qn(e)||er(e)||tr(e)||T(e)||nr(e)||rr(e)||ir(e)||ar(e)||or(e)}var cr=`Argument.Any.Array.AsyncIterator.BigInt.Boolean.Computed.Constructor.Date.Enum.Function.Integer.Intersect.Iterator.Literal.MappedKey.MappedResult.Not.Null.Number.Object.Promise.Record.Ref.RegExp.String.Symbol.TemplateLiteral.This.Tuple.Undefined.Union.Uint8Array.Unknown.Void`.split(`.`);function lr(e){try{return new RegExp(e),!0}catch{return!1}}function ur(e){if(!b(e))return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=7&&n<=13||n===27||n===127)return!1}return!0}function dr(e){return pr(e)||j(e)}function fr(e){return x(e)||Ot(e)}function E(e){return x(e)||Pt(e)}function pr(e){return x(e)||kt(e)}function D(e){return x(e)||b(e)}function mr(e){return x(e)||b(e)&&ur(e)&&lr(e)}function hr(e){return x(e)||b(e)&&ur(e)}function gr(e){return x(e)||j(e)}function _r(e){return y(e)&&e[yn]===`Optional`}function vr(e){return O(e,`Any`)&&D(e.$id)}function yr(e){return O(e,`Argument`)&&Pt(e.index)}function br(e){return O(e,`Array`)&&e.type===`array`&&D(e.$id)&&j(e.items)&&E(e.minItems)&&E(e.maxItems)&&pr(e.uniqueItems)&&gr(e.contains)&&E(e.minContains)&&E(e.maxContains)}function xr(e){return O(e,`AsyncIterator`)&&e.type===`AsyncIterator`&&D(e.$id)&&j(e.items)}function Sr(e){return O(e,`BigInt`)&&e.type===`bigint`&&D(e.$id)&&fr(e.exclusiveMaximum)&&fr(e.exclusiveMinimum)&&fr(e.maximum)&&fr(e.minimum)&&fr(e.multipleOf)}function Cr(e){return O(e,`Boolean`)&&e.type===`boolean`&&D(e.$id)}function wr(e){return O(e,`Computed`)&&b(e.target)&&v(e.parameters)&&e.parameters.every(e=>j(e))}function Tr(e){return O(e,`Constructor`)&&e.type===`Constructor`&&D(e.$id)&&v(e.parameters)&&e.parameters.every(e=>j(e))&&j(e.returns)}function Er(e){return O(e,`Date`)&&e.type===`Date`&&D(e.$id)&&E(e.exclusiveMaximumTimestamp)&&E(e.exclusiveMinimumTimestamp)&&E(e.maximumTimestamp)&&E(e.minimumTimestamp)&&E(e.multipleOfTimestamp)}function Dr(e){return O(e,`Function`)&&e.type===`Function`&&D(e.$id)&&v(e.parameters)&&e.parameters.every(e=>j(e))&&j(e.returns)}function Or(e){return O(e,`Integer`)&&e.type===`integer`&&D(e.$id)&&E(e.exclusiveMaximum)&&E(e.exclusiveMinimum)&&E(e.maximum)&&E(e.minimum)&&E(e.multipleOf)}function kr(e){return y(e)&&Object.entries(e).every(([e,t])=>ur(e)&&j(t))}function Ar(e){return O(e,`Intersect`)&&!(b(e.type)&&e.type!==`object`)&&v(e.allOf)&&e.allOf.every(e=>j(e)&&!Xr(e))&&D(e.type)&&(pr(e.unevaluatedProperties)||gr(e.unevaluatedProperties))&&D(e.$id)}function jr(e){return O(e,`Iterator`)&&e.type===`Iterator`&&D(e.$id)&&j(e.items)}function O(e,t){return y(e)&&C in e&&e[C]===t}function Mr(e){return Fr(e)&&b(e.const)}function Nr(e){return Fr(e)&&Pt(e.const)}function Pr(e){return Fr(e)&&kt(e.const)}function Fr(e){return O(e,`Literal`)&&D(e.$id)&&Ir(e.const)}function Ir(e){return kt(e)||Pt(e)||b(e)}function Lr(e){return O(e,`MappedKey`)&&v(e.keys)&&e.keys.every(e=>Pt(e)||b(e))}function Rr(e){return O(e,`MappedResult`)&&kr(e.properties)}function zr(e){return O(e,`Never`)&&y(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function Br(e){return O(e,`Not`)&&j(e.not)}function Vr(e){return O(e,`Null`)&&e.type===`null`&&D(e.$id)}function Hr(e){return O(e,`Number`)&&e.type===`number`&&D(e.$id)&&E(e.exclusiveMaximum)&&E(e.exclusiveMinimum)&&E(e.maximum)&&E(e.minimum)&&E(e.multipleOf)}function k(e){return O(e,`Object`)&&e.type===`object`&&D(e.$id)&&kr(e.properties)&&dr(e.additionalProperties)&&E(e.minProperties)&&E(e.maxProperties)}function Ur(e){return O(e,`Promise`)&&e.type===`Promise`&&D(e.$id)&&j(e.item)}function A(e){return O(e,`Record`)&&e.type===`object`&&D(e.$id)&&dr(e.additionalProperties)&&y(e.patternProperties)&&(e=>{let t=Object.getOwnPropertyNames(e.patternProperties);return t.length===1&&lr(t[0])&&y(e.patternProperties)&&j(e.patternProperties[t[0]])})(e)}function Wr(e){return O(e,`Ref`)&&D(e.$id)&&b(e.$ref)}function Gr(e){return O(e,`RegExp`)&&D(e.$id)&&b(e.source)&&b(e.flags)&&E(e.maxLength)&&E(e.minLength)}function Kr(e){return O(e,`String`)&&e.type===`string`&&D(e.$id)&&E(e.minLength)&&E(e.maxLength)&&mr(e.pattern)&&hr(e.format)}function qr(e){return O(e,`Symbol`)&&e.type===`symbol`&&D(e.$id)}function Jr(e){return O(e,`TemplateLiteral`)&&e.type===`string`&&b(e.pattern)&&e.pattern[0]===`^`&&e.pattern[e.pattern.length-1]===`$`}function Yr(e){return O(e,`This`)&&D(e.$id)&&b(e.$ref)}function Xr(e){return y(e)&&_n in e}function Zr(e){return O(e,`Tuple`)&&e.type===`array`&&D(e.$id)&&Pt(e.minItems)&&Pt(e.maxItems)&&e.minItems===e.maxItems&&(x(e.items)&&x(e.additionalItems)&&e.minItems===0||v(e.items)&&e.items.every(e=>j(e)))}function Qr(e){return O(e,`Undefined`)&&e.type===`undefined`&&D(e.$id)}function $r(e){return O(e,`Union`)&&D(e.$id)&&y(e)&&v(e.anyOf)&&e.anyOf.every(e=>j(e))}function ei(e){return O(e,`Uint8Array`)&&e.type===`Uint8Array`&&D(e.$id)&&E(e.minByteLength)&&E(e.maxByteLength)}function ti(e){return O(e,`Unknown`)&&D(e.$id)}function ni(e){return O(e,`Unsafe`)}function ri(e){return O(e,`Void`)&&e.type===`void`&&D(e.$id)}function ii(e){return y(e)&&C in e&&b(e[C])&&!cr.includes(e[C])}function j(e){return y(e)&&(vr(e)||yr(e)||br(e)||Cr(e)||Sr(e)||xr(e)||wr(e)||Tr(e)||Er(e)||Dr(e)||Or(e)||Ar(e)||jr(e)||Fr(e)||Lr(e)||Rr(e)||zr(e)||Br(e)||Vr(e)||Hr(e)||k(e)||Ur(e)||A(e)||Wr(e)||Gr(e)||Kr(e)||qr(e)||Jr(e)||Yr(e)||Zr(e)||Qr(e)||$r(e)||ei(e)||ti(e)||ni(e)||ri(e)||ii(e))}var ai=`(true|false)`,oi=`(0|[1-9][0-9]*)`,si=`(.*)`,ci=`(?!.*)`;`${ai}`;var li=`^${oi}$`,ui=`^${si}$`,di=`^${ci}$`,fi=new Map;function pi(e){return fi.has(e)}function mi(e,t){fi.set(e,t)}function hi(e){return fi.get(e)}var gi=new Map;function _i(e){return gi.has(e)}function vi(e){return gi.get(e)}function yi(e,t){return e.includes(t)}function bi(e){return[...new Set(e)]}function xi(e,t){return e.filter(e=>t.includes(e))}function Si(e,t){return e.reduce((e,t)=>xi(e,t),t)}function Ci(e){return e.length===1?e[0]:e.length>1?Si(e.slice(1),e[0]):[]}function wi(e){let t=[];for(let n of e)t.push(...n);return t}function Ti(e){return S({[C]:`Any`},e)}function Ei(e,t){return S({[C]:`Array`,type:`array`,items:e},t)}function Di(e){return S({[C]:`Argument`,index:e})}function Oi(e,t){return S({[C]:`AsyncIterator`,type:`AsyncIterator`,items:e},t)}function M(e,t,n){return S({[C]:`Computed`,target:e,parameters:t},n)}function ki(e,t){let{[t]:n,...r}=e;return r}function Ai(e,t){return t.reduce((e,t)=>ki(e,t),e)}function N(e){return S({[C]:`Never`,not:{}},e)}function P(e){return S({[C]:`MappedResult`,properties:e})}function ji(e,t,n){return S({[C]:`Constructor`,type:`Constructor`,parameters:e,returns:t},n)}function Mi(e,t,n){return S({[C]:`Function`,type:`Function`,parameters:e,returns:t},n)}function Ni(e,t){return S({[C]:`Union`,anyOf:e},t)}function Pi(e){return e.some(e=>Sn(e))}function Fi(e){return e.map(e=>Sn(e)?Ii(e):e)}function Ii(e){return Ai(e,[yn])}function Li(e,t){return Pi(e)?xo(Ni(Fi(e),t)):Ni(Fi(e),t)}function Ri(e,t){return e.length===1?S(e[0],t):e.length===0?N(t):Li(e,t)}function F(e,t){return e.length===0?N(t):e.length===1?S(e[0],t):Ni(e,t)}var zi=class extends gn{};function Bi(e){return e.replace(/\\\$/g,`$`).replace(/\\\*/g,`*`).replace(/\\\^/g,`^`).replace(/\\\|/g,`|`).replace(/\\\(/g,`(`).replace(/\\\)/g,`)`)}function Vi(e,t,n){return e[t]===n&&e.charCodeAt(t-1)!==92}function Hi(e,t){return Vi(e,t,`(`)}function Ui(e,t){return Vi(e,t,`)`)}function Wi(e,t){return Vi(e,t,`|`)}function Gi(e){if(!(Hi(e,0)&&Ui(e,e.length-1)))return!1;let t=0;for(let n=0;n<e.length;n++)if(Hi(e,n)&&(t+=1),Ui(e,n)&&--t,t===0&&n!==e.length-1)return!1;return!0}function Ki(e){return e.slice(1,e.length-1)}function qi(e){let t=0;for(let n=0;n<e.length;n++)if(Hi(e,n)&&(t+=1),Ui(e,n)&&--t,Wi(e,n)&&t===0)return!0;return!1}function Ji(e){for(let t=0;t<e.length;t++)if(Hi(e,t))return!0;return!1}function Yi(e){let[t,n]=[0,0],r=[];for(let i=0;i<e.length;i++)if(Hi(e,i)&&(t+=1),Ui(e,i)&&--t,Wi(e,i)&&t===0){let t=e.slice(n,i);t.length>0&&r.push(Zi(t)),n=i+1}let i=e.slice(n);return i.length>0&&r.push(Zi(i)),r.length===0?{type:`const`,const:``}:r.length===1?r[0]:{type:`or`,expr:r}}function Xi(e){function t(e,t){if(!Hi(e,t))throw new zi(`TemplateLiteralParser: Index must point to open parens`);let n=0;for(let r=t;r<e.length;r++)if(Hi(e,r)&&(n+=1),Ui(e,r)&&--n,n===0)return[t,r];throw new zi(`TemplateLiteralParser: Unclosed group parens in expression`)}function n(e,t){for(let n=t;n<e.length;n++)if(Hi(e,n))return[t,n];return[t,e.length]}let r=[];for(let i=0;i<e.length;i++)if(Hi(e,i)){let[n,a]=t(e,i),o=e.slice(n,a+1);r.push(Zi(o)),i=a}else{let[t,a]=n(e,i),o=e.slice(t,a);o.length>0&&r.push(Zi(o)),i=a-1}return r.length===0?{type:`const`,const:``}:r.length===1?r[0]:{type:`and`,expr:r}}function Zi(e){return Gi(e)?Zi(Ki(e)):qi(e)?Yi(e):Ji(e)?Xi(e):{type:`const`,const:Bi(e)}}function Qi(e){return Zi(e.slice(1,e.length-1))}var $i=class extends gn{};function ea(e){return e.type===`or`&&e.expr.length===2&&e.expr[0].type===`const`&&e.expr[0].const===`0`&&e.expr[1].type===`const`&&e.expr[1].const===`[1-9][0-9]*`}function ta(e){return e.type===`or`&&e.expr.length===2&&e.expr[0].type===`const`&&e.expr[0].const===`true`&&e.expr[1].type===`const`&&e.expr[1].const===`false`}function na(e){return e.type===`const`&&e.const===`.*`}function ra(e){return ea(e)||na(e)?!1:ta(e)?!0:e.type===`and`||e.type===`or`?e.expr.every(e=>ra(e)):e.type===`const`||(()=>{throw new $i(`Unknown expression type`)})()}function ia(e){return ra(Qi(e.pattern))}var aa=class extends gn{};function*oa(e){if(e.length===1)return yield*e[0];for(let t of e[0])for(let n of oa(e.slice(1)))yield`${t}${n}`}function*sa(e){return yield*oa(e.expr.map(e=>[...ua(e)]))}function*ca(e){for(let t of e.expr)yield*ua(t)}function*la(e){return yield e.const}function*ua(e){return e.type===`and`?yield*sa(e):e.type===`or`?yield*ca(e):e.type===`const`?yield*la(e):(()=>{throw new aa(`Unknown expression`)})()}function da(e){let t=Qi(e.pattern);return ra(t)?[...ua(t)]:[]}function I(e,t){return S({[C]:`Literal`,const:e,type:typeof e},t)}function fa(e){return S({[C]:`Boolean`,type:`boolean`},e)}function pa(e){return S({[C]:`BigInt`,type:`bigint`},e)}function ma(e){return S({[C]:`Number`,type:`number`},e)}function ha(e){return S({[C]:`String`,type:`string`},e)}function*ga(e){let t=e.trim().replace(/"|'/g,``);return t===`boolean`?yield fa():t===`number`?yield ma():t===`bigint`?yield pa():t===`string`?yield ha():yield(()=>{let e=t.split(`|`).map(e=>I(e.trim()));return e.length===0?N():e.length===1?e[0]:Ri(e)})()}function*_a(e){if(e[1]!==`{`)return yield*[I(`$`),...va(e.slice(1))];for(let t=2;t<e.length;t++)if(e[t]===`}`){let n=ga(e.slice(2,t)),r=va(e.slice(t+1));return yield*[...n,...r]}yield I(e)}function*va(e){for(let t=0;t<e.length;t++)if(e[t]===`$`)return yield*[I(e.slice(0,t)),..._a(e.slice(t))];yield I(e)}function ya(e){return[...va(e)]}var ba=class extends gn{};function xa(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Sa(e,t){return Zn(e)?e.pattern.slice(1,e.pattern.length-1):T(e)?`(${e.anyOf.map(e=>Sa(e,t)).join(`|`)})`:Un(e)||Nn(e)||Dn(e)?`${t}${oi}`:Yn(e)?`${t}${si}`:Ln(e)?`${t}${xa(e.const.toString())}`:On(e)?`${t}${ai}`:(()=>{throw new ba(`Unexpected Kind '${e[C]}'`)})()}function Ca(e){return`^${e.map(e=>Sa(e,``)).join(``)}\$`}function wa(e){return Ri(da(e).map(e=>I(e)))}function Ta(e,t){let n=b(e)?Ca(ya(e)):Ca(e);return S({[C]:`TemplateLiteral`,type:`string`,pattern:n},t)}function Ea(e){return da(e).map(e=>e.toString())}function Da(e){let t=[];for(let n of e)t.push(...ka(n));return t}function Oa(e){return[e.toString()]}function ka(e){return[...new Set(Zn(e)?Ea(e):T(e)?Da(e.anyOf):Ln(e)?Oa(e.const):Un(e)||Nn(e)?[`[number]`]:[])]}function Aa(e,t,n){let r={};for(let i of Object.getOwnPropertyNames(t))r[i]=Wa(e,ka(t[i]),n);return r}function ja(e,t,n){return Aa(e,t.properties,n)}function Ma(e,t,n){return P(ja(e,t,n))}function Na(e,t){return e.map(e=>Va(e,t))}function Pa(e){return e.filter(e=>!Bn(e))}function Fa(e,t){return Ao(Pa(Na(e,t)))}function Ia(e){return e.some(e=>Bn(e))?[]:e}function La(e,t){return Ri(Ia(Na(e,t)))}function Ra(e,t){return t in e?e[t]:t===`[number]`?Ri(e):N()}function za(e,t){return t===`[number]`?e:N()}function Ba(e,t){return t in e?e[t]:N()}function Va(e,t){return Pn(e)?Fa(e.allOf,t):T(e)?La(e.anyOf,t):er(e)?Ra(e.items??[],t):Tn(e)?za(e.items,t):Wn(e)?Ba(e.properties,t):N()}function Ha(e,t){return t.map(t=>Va(e,t))}function Ua(e,t){return Ri(Ha(e,t))}function Wa(e,t,n){if(qn(e)||qn(t)){if(!sr(e)||!sr(t))throw new gn(`Index types using Ref parameters require both Type and Key to be of TSchema`);return M(`Index`,[e,t])}return zn(t)?Ma(e,t,n):Rn(t)?Ja(e,t,n):S(sr(t)?Ua(e,ka(t)):Ua(e,t),n)}function Ga(e,t,n){return{[t]:Wa(e,[t],Wt(n))}}function Ka(e,t,n){return t.reduce((t,r)=>({...t,...Ga(e,r,n)}),{})}function qa(e,t,n){return Ka(e,t.keys,n)}function Ja(e,t,n){return P(qa(e,t,n))}function Ya(e,t){return S({[C]:`Iterator`,type:`Iterator`,items:e},t)}function Xa(e){return globalThis.Object.keys(e).filter(t=>!Sn(e[t]))}function Za(e,t){let n=Xa(e);return S(n.length>0?{[C]:`Object`,type:`object`,required:n,properties:e}:{[C]:`Object`,type:`object`,properties:e},t)}var L=Za;function Qa(e,t){return S({[C]:`Promise`,type:`Promise`,item:e},t)}function $a(e){return S(Ai(e,[vn]))}function eo(e){return S({...e,[vn]:`Readonly`})}function to(e,t){return t===!1?$a(e):eo(e)}function no(e,t){let n=t??!0;return zn(e)?ao(e,n):to(e,n)}function ro(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=no(e[r],t);return n}function io(e,t){return ro(e.properties,t)}function ao(e,t){return P(io(e,t))}function oo(e,t){return S(e.length>0?{[C]:`Tuple`,type:`array`,items:e,additionalItems:!1,minItems:e.length,maxItems:e.length}:{[C]:`Tuple`,type:`array`,minItems:e.length,maxItems:e.length},t)}function so(e,t){return e in t?ho(e,t[e]):P(t)}function co(e){return{[e]:I(e)}}function lo(e){let t={};for(let n of e)t[n]=I(n);return t}function uo(e,t){return yi(t,e)?co(e):lo(t)}function fo(e,t){return so(e,uo(e,t))}function po(e,t){return t.map(t=>ho(e,t))}function mo(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(t))n[r]=ho(e,t[r]);return n}function ho(e,t){let n={...t};return Sn(t)?xo(ho(e,Ai(t,[yn]))):xn(t)?no(ho(e,Ai(t,[vn]))):zn(t)?so(e,t.properties):Rn(t)?fo(e,t.keys):An(t)?ji(po(e,t.parameters),ho(e,t.returns),n):Mn(t)?Mi(po(e,t.parameters),ho(e,t.returns),n):En(t)?Oi(ho(e,t.items),n):Fn(t)?Ya(ho(e,t.items),n):Pn(t)?jo(po(e,t.allOf),n):T(t)?F(po(e,t.anyOf),n):er(t)?oo(po(e,t.items??[]),n):Wn(t)?L(mo(e,t.properties),n):Tn(t)?Ei(ho(e,t.items),n):Gn(t)?Qa(ho(e,t.item),n):t}function go(e,t){let n={};for(let r of e)n[r]=ho(r,t);return n}function _o(e,t,n){let r=sr(e)?ka(e):e;return L(go(r,t({[C]:`MappedKey`,keys:r})),n)}function vo(e){return S(Ai(e,[yn]))}function yo(e){return S({...e,[yn]:`Optional`})}function bo(e,t){return t===!1?vo(e):yo(e)}function xo(e,t){let n=t??!0;return zn(e)?wo(e,n):bo(e,n)}function So(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=xo(e[r],t);return n}function Co(e,t){return So(e.properties,t)}function wo(e,t){return P(Co(e,t))}function To(e,t={}){let n=e.every(e=>Wn(e)),r=sr(t.unevaluatedProperties)?{unevaluatedProperties:t.unevaluatedProperties}:{};return S(t.unevaluatedProperties===!1||sr(t.unevaluatedProperties)||n?{...r,[C]:`Intersect`,type:`object`,allOf:e}:{...r,[C]:`Intersect`,allOf:e},t)}function Eo(e){return e.every(e=>Sn(e))}function Do(e){return Ai(e,[yn])}function Oo(e){return e.map(e=>Sn(e)?Do(e):e)}function ko(e,t){return Eo(e)?xo(To(Oo(e),t)):To(Oo(e),t)}function Ao(e,t={}){if(e.length===1)return S(e[0],t);if(e.length===0)return N(t);if(e.some(e=>$n(e)))throw Error(`Cannot intersect transform types`);return ko(e,t)}function jo(e,t){if(e.length===1)return S(e[0],t);if(e.length===0)return N(t);if(e.some(e=>$n(e)))throw Error(`Cannot intersect transform types`);return To(e,t)}function Mo(...e){let[t,n]=typeof e[0]==`string`?[e[0],e[1]]:[e[0].$id,e[1]];if(typeof t!=`string`)throw new gn(`Ref: $ref must be a string`);return S({[C]:`Ref`,$ref:t},n)}function No(e,t){return M(`Awaited`,[M(e,t)])}function Po(e){return M(`Awaited`,[Mo(e)])}function Fo(e){return jo(Ro(e))}function Io(e){return F(Ro(e))}function Lo(e){return zo(e)}function Ro(e){return e.map(e=>zo(e))}function zo(e,t){return S(kn(e)?No(e.target,e.parameters):Pn(e)?Fo(e.allOf):T(e)?Io(e.anyOf):Gn(e)?Lo(e.item):qn(e)?Po(e.$ref):e,t)}function Bo(e){let t=[];for(let n of e)t.push(qo(n));return t}function Vo(e){return wi(Bo(e))}function Ho(e){return Ci(Bo(e))}function Uo(e){return e.map((e,t)=>t.toString())}function Wo(e){return[`[number]`]}function Go(e){return globalThis.Object.getOwnPropertyNames(e)}function Ko(e){return Jo?globalThis.Object.getOwnPropertyNames(e).map(e=>e[0]===`^`&&e[e.length-1]===`$`?e.slice(1,e.length-1):e):[]}function qo(e){return Pn(e)?Vo(e.allOf):T(e)?Ho(e.anyOf):er(e)?Uo(e.items??[]):Tn(e)?Wo(e.items):Wn(e)?Go(e.properties):Kn(e)?Ko(e.patternProperties):[]}var Jo=!1;function Yo(e){Jo=!0;let t=qo(e);return Jo=!1,`^(${t.map(e=>`(${e})`).join(`|`)})$`}function Xo(e,t){return M(`KeyOf`,[M(e,t)])}function Zo(e){return M(`KeyOf`,[Mo(e)])}function Qo(e,t){return S(Ri($o(qo(e))),t)}function $o(e){return e.map(e=>e===`[number]`?ma():I(e))}function es(e,t){return kn(e)?Xo(e.target,e.parameters):qn(e)?Zo(e.$ref):zn(e)?rs(e,t):Qo(e,t)}function ts(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=es(e[r],Wt(t));return n}function ns(e,t){return ts(e.properties,t)}function rs(e,t){return P(ns(e,t))}function is(e){let t=[];for(let n of e)t.push(...qo(n));return bi(t)}function as(e){return e.filter(e=>!Bn(e))}function os(e,t){let n=[];for(let r of e)n.push(...Ha(r,[t]));return as(n)}function ss(e,t){let n={};for(let r of t)n[r]=Ao(os(e,r));return n}function cs(e,t){return L(ss(e,is(e)),t)}function ls(e){return S({[C]:`Date`,type:`Date`},e)}function us(e){return S({[C]:`Null`,type:`null`},e)}function ds(e){return S({[C]:`Symbol`,type:`symbol`},e)}function fs(e){return S({[C]:`Undefined`,type:`undefined`},e)}function ps(e){return S({[C]:`Uint8Array`,type:`Uint8Array`},e)}function ms(e){return S({[C]:`Unknown`},e)}function hs(e){return e.map(e=>vs(e,!1))}function gs(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=no(vs(e[n],!1));return t}function _s(e,t){return t===!0?e:no(e)}function vs(e,t){return Dt(e)||Mt(e)?_s(Ti(),t):v(e)?no(oo(hs(e))):Lt(e)?ps():At(e)?ls():y(e)?_s(L(gs(e)),t):jt(e)?_s(Mi([],ms()),t):x(e)?fs():Nt(e)?us():It(e)?ds():Ot(e)?pa():Pt(e)||kt(e)||b(e)?I(e):L({})}function ys(e,t){return S(vs(e,!0),t)}function bs(e,t){return An(e)?oo(e.parameters,t):N(t)}function xs(e,t){if(x(e))throw Error(`Enum undefined or empty`);let n=globalThis.Object.getOwnPropertyNames(e).filter(e=>isNaN(e)).map(t=>e[t]);return F([...new Set(n)].map(e=>I(e)),{...t,[bn]:`Enum`})}var Ss=class extends gn{},R;(function(e){e[e.Union=0]=`Union`,e[e.True=1]=`True`,e[e.False=2]=`False`})(R||={});function Cs(e){return e===R.False?e:R.True}function ws(e){throw new Ss(e)}function z(e){return zr(e)||Ar(e)||$r(e)||ti(e)||vr(e)}function B(e,t){return zr(t)?Hs(e,t):Ar(t)?Rs(e,t):$r(t)?wc(e,t):ti(t)?Ec(e,t):vr(t)?Ts(e,t):ws(`StructuralRight`)}function Ts(e,t){return R.True}function Es(e,t){return Ar(t)?Rs(e,t):$r(t)&&t.anyOf.some(e=>vr(e)||ti(e))?R.True:$r(t)?R.Union:ti(t)||vr(t)?R.True:R.Union}function Ds(e,t){return ti(e)?R.False:vr(e)?R.Union:zr(e)?R.True:R.False}function Os(e,t){return k(t)&&ac(t)?R.True:z(t)?B(e,t):br(t)?Cs(H(e.items,t.items)):R.False}function ks(e,t){return z(t)?B(e,t):xr(t)?Cs(H(e.items,t.items)):R.False}function As(e,t){return z(t)?B(e,t):k(t)?V(e,t):A(t)?fc(e,t):Sr(t)?R.True:R.False}function js(e,t){return Pr(e)||Cr(e)?R.True:R.False}function Ms(e,t){return z(t)?B(e,t):k(t)?V(e,t):A(t)?fc(e,t):Cr(t)?R.True:R.False}function Ns(e,t){return z(t)?B(e,t):k(t)?V(e,t):Tr(t)?e.parameters.length>t.parameters.length?R.False:e.parameters.every((e,n)=>Cs(H(t.parameters[n],e))===R.True)?Cs(H(e.returns,t.returns)):R.False:R.False}function Ps(e,t){return z(t)?B(e,t):k(t)?V(e,t):A(t)?fc(e,t):Er(t)?R.True:R.False}function Fs(e,t){return z(t)?B(e,t):k(t)?V(e,t):Dr(t)?e.parameters.length>t.parameters.length?R.False:e.parameters.every((e,n)=>Cs(H(t.parameters[n],e))===R.True)?Cs(H(e.returns,t.returns)):R.False:R.False}function Is(e,t){return Fr(e)&&Pt(e.const)||Hr(e)||Or(e)?R.True:R.False}function Ls(e,t){return Or(t)||Hr(t)?R.True:z(t)?B(e,t):k(t)?V(e,t):A(t)?fc(e,t):R.False}function Rs(e,t){return t.allOf.every(t=>H(e,t)===R.True)?R.True:R.False}function zs(e,t){return e.allOf.some(e=>H(e,t)===R.True)?R.True:R.False}function Bs(e,t){return z(t)?B(e,t):jr(t)?Cs(H(e.items,t.items)):R.False}function Vs(e,t){return Fr(t)&&t.const===e.const?R.True:z(t)?B(e,t):k(t)?V(e,t):A(t)?fc(e,t):Kr(t)?hc(e,t):Hr(t)?qs(e,t):Or(t)?Is(e,t):Cr(t)?js(e,t):R.False}function Hs(e,t){return R.False}function Us(e,t){return R.True}function Ws(e){let[t,n]=[e,0];for(;Br(t);)t=t.not,n+=1;return n%2==0?t:ms()}function Gs(e,t){return Br(e)?H(Ws(e),t):Br(t)?H(e,Ws(t)):ws(`Invalid fallthrough for Not`)}function Ks(e,t){return z(t)?B(e,t):k(t)?V(e,t):A(t)?fc(e,t):Vr(t)?R.True:R.False}function qs(e,t){return Nr(e)||Hr(e)||Or(e)?R.True:R.False}function Js(e,t){return z(t)?B(e,t):k(t)?V(e,t):A(t)?fc(e,t):Or(t)||Hr(t)?R.True:R.False}function Ys(e,t){return Object.getOwnPropertyNames(e.properties).length===t}function Xs(e){return ac(e)}function Zs(e){return Ys(e,0)||Ys(e,1)&&`description`in e.properties&&$r(e.properties.description)&&e.properties.description.anyOf.length===2&&(Kr(e.properties.description.anyOf[0])&&Qr(e.properties.description.anyOf[1])||Kr(e.properties.description.anyOf[1])&&Qr(e.properties.description.anyOf[0]))}function Qs(e){return Ys(e,0)}function $s(e){return Ys(e,0)}function ec(e){return Ys(e,0)}function tc(e){return Ys(e,0)}function nc(e){return ac(e)}function rc(e){let t=ma();return Ys(e,0)||Ys(e,1)&&`length`in e.properties&&Cs(H(e.properties.length,t))===R.True}function ic(e){return Ys(e,0)}function ac(e){let t=ma();return Ys(e,0)||Ys(e,1)&&`length`in e.properties&&Cs(H(e.properties.length,t))===R.True}function oc(e){let t=Mi([Ti()],Ti());return Ys(e,0)||Ys(e,1)&&`then`in e.properties&&Cs(H(e.properties.then,t))===R.True}function sc(e,t){return H(e,t)===R.False||_r(e)&&!_r(t)?R.False:R.True}function V(e,t){return ti(e)?R.False:vr(e)?R.Union:zr(e)||Mr(e)&&Xs(t)||Nr(e)&&Qs(t)||Pr(e)&&$s(t)||qr(e)&&Zs(t)||Sr(e)&&ec(t)||Kr(e)&&Xs(t)||qr(e)&&Zs(t)||Hr(e)&&Qs(t)||Or(e)&&Qs(t)||Cr(e)&&$s(t)||ei(e)&&nc(t)||Er(e)&&tc(t)||Tr(e)&&ic(t)||Dr(e)&&rc(t)?R.True:A(e)&&Kr(uc(e))?t[bn]===`Record`?R.True:R.False:A(e)&&Hr(uc(e))&&Ys(t,0)?R.True:R.False}function cc(e,t){return z(t)?B(e,t):A(t)?fc(e,t):k(t)?(()=>{for(let n of Object.getOwnPropertyNames(t.properties)){if(!(n in e.properties)&&!_r(t.properties[n]))return R.False;if(_r(t.properties[n]))return R.True;if(sc(e.properties[n],t.properties[n])===R.False)return R.False}return R.True})():R.False}function lc(e,t){return z(t)?B(e,t):k(t)&&oc(t)?R.True:Ur(t)?Cs(H(e.item,t.item)):R.False}function uc(e){return li in e.patternProperties?ma():ui in e.patternProperties?ha():ws(`Unknown record key pattern`)}function dc(e){return li in e.patternProperties?e.patternProperties[li]:ui in e.patternProperties?e.patternProperties[ui]:ws(`Unable to get record value schema`)}function fc(e,t){let[n,r]=[uc(t),dc(t)];return Mr(e)&&Hr(n)&&Cs(H(e,r))===R.True?R.True:ei(e)&&Hr(n)||Kr(e)&&Hr(n)||br(e)&&Hr(n)?H(e,r):k(e)?(()=>{for(let t of Object.getOwnPropertyNames(e.properties))if(sc(r,e.properties[t])===R.False)return R.False;return R.True})():R.False}function pc(e,t){return z(t)?B(e,t):k(t)?V(e,t):A(t)?H(dc(e),dc(t)):R.False}function mc(e,t){return H(Gr(e)?ha():e,Gr(t)?ha():t)}function hc(e,t){return Fr(e)&&b(e.const)||Kr(e)?R.True:R.False}function gc(e,t){return z(t)?B(e,t):k(t)?V(e,t):A(t)?fc(e,t):Kr(t)?R.True:R.False}function _c(e,t){return z(t)?B(e,t):k(t)?V(e,t):A(t)?fc(e,t):qr(t)?R.True:R.False}function vc(e,t){return Jr(e)?H(wa(e),t):Jr(t)?H(e,wa(t)):ws(`Invalid fallthrough for TemplateLiteral`)}function yc(e,t){return br(t)&&e.items!==void 0&&e.items.every(e=>H(e,t.items)===R.True)}function bc(e,t){return zr(e)?R.True:ti(e)?R.False:vr(e)?R.Union:R.False}function xc(e,t){return z(t)?B(e,t):k(t)&&ac(t)||br(t)&&yc(e,t)?R.True:Zr(t)?x(e.items)&&!x(t.items)||!x(e.items)&&x(t.items)?R.False:x(e.items)&&!x(t.items)||e.items.every((e,n)=>H(e,t.items[n])===R.True)?R.True:R.False:R.False}function Sc(e,t){return z(t)?B(e,t):k(t)?V(e,t):A(t)?fc(e,t):ei(t)?R.True:R.False}function Cc(e,t){return z(t)?B(e,t):k(t)?V(e,t):A(t)?fc(e,t):ri(t)?Oc(e,t):Qr(t)?R.True:R.False}function wc(e,t){return t.anyOf.some(t=>H(e,t)===R.True)?R.True:R.False}function Tc(e,t){return e.anyOf.every(e=>H(e,t)===R.True)?R.True:R.False}function Ec(e,t){return R.True}function Dc(e,t){return zr(t)?Hs(e,t):Ar(t)?Rs(e,t):$r(t)?wc(e,t):vr(t)?Ts(e,t):Kr(t)?hc(e,t):Hr(t)?qs(e,t):Or(t)?Is(e,t):Cr(t)?js(e,t):br(t)?Ds(e,t):Zr(t)?bc(e,t):k(t)?V(e,t):ti(t)?R.True:R.False}function Oc(e,t){return Qr(e)||Qr(e)?R.True:R.False}function kc(e,t){return Ar(t)?Rs(e,t):$r(t)?wc(e,t):ti(t)?Ec(e,t):vr(t)?Ts(e,t):k(t)?V(e,t):ri(t)?R.True:R.False}function H(e,t){return Jr(e)||Jr(t)?vc(e,t):Gr(e)||Gr(t)?mc(e,t):Br(e)||Br(t)?Gs(e,t):vr(e)?Es(e,t):br(e)?Os(e,t):Sr(e)?As(e,t):Cr(e)?Ms(e,t):xr(e)?ks(e,t):Tr(e)?Ns(e,t):Er(e)?Ps(e,t):Dr(e)?Fs(e,t):Or(e)?Ls(e,t):Ar(e)?zs(e,t):jr(e)?Bs(e,t):Fr(e)?Vs(e,t):zr(e)?Us(e,t):Vr(e)?Ks(e,t):Hr(e)?Js(e,t):k(e)?cc(e,t):A(e)?pc(e,t):Kr(e)?gc(e,t):qr(e)?_c(e,t):Zr(e)?xc(e,t):Ur(e)?lc(e,t):ei(e)?Sc(e,t):Qr(e)?Cc(e,t):$r(e)?Tc(e,t):ti(e)?Dc(e,t):ri(e)?kc(e,t):ws(`Unknown left type operand '${e[C]}'`)}function Ac(e,t){return H(e,t)}function jc(e,t,n,r,i){let a={};for(let o of globalThis.Object.getOwnPropertyNames(e))a[o]=Fc(e[o],t,n,r,Wt(i));return a}function Mc(e,t,n,r,i){return jc(e.properties,t,n,r,i)}function Nc(e,t,n,r,i){return P(Mc(e,t,n,r,i))}function Pc(e,t,n,r){let i=Ac(e,t);return i===R.Union?F([n,r]):i===R.True?n:r}function Fc(e,t,n,r,i){return zn(e)?Nc(e,t,n,r,i):Rn(e)?S(zc(e,t,n,r,i)):S(Pc(e,t,n,r),i)}function Ic(e,t,n,r,i){return{[e]:Fc(I(e),t,n,r,Wt(i))}}function Lc(e,t,n,r,i){return e.reduce((e,a)=>({...e,...Ic(a,t,n,r,i)}),{})}function Rc(e,t,n,r,i){return Lc(e.keys,t,n,r,i)}function zc(e,t,n,r,i){return P(Rc(e,t,n,r,i))}function Bc(e){return e.allOf.every(e=>Uc(e))}function Vc(e){return e.anyOf.some(e=>Uc(e))}function Hc(e){return!Uc(e.not)}function Uc(e){return e[C]===`Intersect`?Bc(e):e[C]===`Union`?Vc(e):e[C]===`Not`?Hc(e):e[C]===`Undefined`}function Wc(e,t){return Kc(wa(e),t)}function Gc(e,t){let n=e.filter(e=>Ac(e,t)===R.False);return n.length===1?n[0]:F(n)}function Kc(e,t,n={}){return Zn(e)?S(Wc(e,t),n):zn(e)?S(Yc(e,t),n):S(T(e)?Gc(e.anyOf,t):Ac(e,t)===R.False?e:N(),n)}function qc(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=Kc(e[r],t);return n}function Jc(e,t){return qc(e.properties,t)}function Yc(e,t){return P(Jc(e,t))}function Xc(e,t){return Qc(wa(e),t)}function Zc(e,t){let n=e.filter(e=>Ac(e,t)!==R.False);return n.length===1?n[0]:F(n)}function Qc(e,t,n){return Zn(e)?S(Xc(e,t),n):zn(e)?S(tl(e,t),n):S(T(e)?Zc(e.anyOf,t):Ac(e,t)===R.False?N():e,n)}function $c(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=Qc(e[r],t);return n}function el(e,t){return $c(e.properties,t)}function tl(e,t){return P(el(e,t))}function nl(e,t){return An(e)?S(e.returns,t):N(t)}function rl(e){return no(xo(e))}function il(e,t,n){return S({[C]:`Record`,type:`object`,patternProperties:{[e]:t}},n)}function al(e,t,n){let r={};for(let n of e)r[n]=t;return L(r,{...n,[bn]:`Record`})}function ol(e,t,n){return ia(e)?al(ka(e),t,n):il(e.pattern,t,n)}function sl(e,t,n){return al(ka(F(e)),t,n)}function cl(e,t,n){return al([e.toString()],t,n)}function ll(e,t,n){return il(e.source,t,n)}function ul(e,t,n){return il(x(e.pattern)?ui:e.pattern,t,n)}function dl(e,t,n){return il(ui,t,n)}function fl(e,t,n){return il(di,t,n)}function pl(e,t,n){return L({true:t,false:t},n)}function ml(e,t,n){return il(li,t,n)}function hl(e,t,n){return il(li,t,n)}function gl(e,t,n={}){return T(e)?sl(e.anyOf,t,n):Zn(e)?ol(e,t,n):Ln(e)?cl(e.const,t,n):On(e)?pl(e,t,n):Nn(e)?ml(e,t,n):Un(e)?hl(e,t,n):Jn(e)?ll(e,t,n):Yn(e)?ul(e,t,n):Cn(e)?dl(e,t,n):Bn(e)?fl(e,t,n):N(n)}function _l(e){return globalThis.Object.getOwnPropertyNames(e.patternProperties)[0]}function vl(e){let t=_l(e);return t===ui?ha():t===li?ma():ha({pattern:t})}function yl(e){return e.patternProperties[_l(e)]}function bl(e,t){return t.parameters=Pl(e,t.parameters),t.returns=Fl(e,t.returns),t}function xl(e,t){return t.parameters=Pl(e,t.parameters),t.returns=Fl(e,t.returns),t}function Sl(e,t){return t.allOf=Pl(e,t.allOf),t}function Cl(e,t){return t.anyOf=Pl(e,t.anyOf),t}function wl(e,t){return x(t.items)||(t.items=Pl(e,t.items)),t}function Tl(e,t){return t.items=Fl(e,t.items),t}function El(e,t){return t.items=Fl(e,t.items),t}function Dl(e,t){return t.items=Fl(e,t.items),t}function Ol(e,t){return t.item=Fl(e,t.item),t}function kl(e,t){let n=Nl(e,t.properties);return{...t,...L(n)}}function Al(e,t){let n=gl(Fl(e,vl(t)),Fl(e,yl(t)));return{...t,...n}}function jl(e,t){return t.index in e?e[t.index]:ms()}function Ml(e,t){let n=xn(t),r=Sn(t),i=Fl(e,t);return n&&r?rl(i):n&&!r?no(i):!n&&r?xo(i):i}function Nl(e,t){return globalThis.Object.getOwnPropertyNames(t).reduce((n,r)=>({...n,[r]:Ml(e,t[r])}),{})}function Pl(e,t){return t.map(t=>Fl(e,t))}function Fl(e,t){return An(t)?bl(e,t):Mn(t)?xl(e,t):Pn(t)?Sl(e,t):T(t)?Cl(e,t):er(t)?wl(e,t):Tn(t)?Tl(e,t):En(t)?El(e,t):Fn(t)?Dl(e,t):Gn(t)?Ol(e,t):Wn(t)?kl(e,t):Kn(t)?Al(e,t):wn(t)?jl(e,t):t}function Il(e,t){return Fl(t,Gt(e))}function Ll(e){return S({[C]:`Integer`,type:`integer`},e)}function Rl(e,t,n){return{[e]:Yl(I(e),t,Wt(n))}}function zl(e,t,n){return e.reduce((e,r)=>({...e,...Rl(r,t,n)}),{})}function Bl(e,t,n){return zl(e.keys,t,n)}function Vl(e,t,n){return P(Bl(e,t,n))}function Hl(e){let[t,n]=[e.slice(0,1),e.slice(1)];return[t.toLowerCase(),n].join(``)}function Ul(e){let[t,n]=[e.slice(0,1),e.slice(1)];return[t.toUpperCase(),n].join(``)}function Wl(e){return e.toUpperCase()}function Gl(e){return e.toLowerCase()}function Kl(e,t,n){let r=Qi(e.pattern);return ra(r)?Ta([F(Jl([...ua(r)].map(e=>I(e)),t))],n):{...e,pattern:ql(e.pattern,t)}}function ql(e,t){return typeof e==`string`?t===`Uncapitalize`?Hl(e):t===`Capitalize`?Ul(e):t===`Uppercase`?Wl(e):t===`Lowercase`?Gl(e):e:e.toString()}function Jl(e,t){return e.map(e=>Yl(e,t))}function Yl(e,t,n={}){return Rn(e)?Vl(e,t,n):Zn(e)?Kl(e,t,n):T(e)?F(Jl(e.anyOf,t),n):Ln(e)?I(ql(e.const,t),n):S(e,n)}function Xl(e,t={}){return Yl(e,`Capitalize`,t)}function Zl(e,t={}){return Yl(e,`Lowercase`,t)}function Ql(e,t={}){return Yl(e,`Uncapitalize`,t)}function $l(e,t={}){return Yl(e,`Uppercase`,t)}function eu(e,t,n){let r={};for(let i of globalThis.Object.getOwnPropertyNames(e))r[i]=uu(e[i],t,Wt(n));return r}function tu(e,t,n){return eu(e.properties,t,n)}function nu(e,t,n){return P(tu(e,t,n))}function ru(e,t){return e.map(e=>lu(e,t))}function iu(e,t){return e.map(e=>lu(e,t))}function au(e,t){let{[t]:n,...r}=e;return r}function ou(e,t){return t.reduce((e,t)=>au(e,t),e)}function su(e,t,n){let r=Ai(e,[_n,`$id`,`required`,`properties`]);return L(ou(n,t),r)}function cu(e){return F(e.reduce((e,t)=>In(t)?[...e,I(t)]:e,[]))}function lu(e,t){return Pn(e)?jo(ru(e.allOf,t)):T(e)?F(iu(e.anyOf,t)):Wn(e)?su(e,t,e.properties):L({})}function uu(e,t,n){let r=v(t)?cu(t):t,i=sr(t)?ka(t):t,a=qn(e),o=qn(t);return zn(e)?nu(e,i,n):Rn(t)?mu(e,t,n):a&&o||!a&&o||a&&!o?M(`Omit`,[e,r],n):S({...lu(e,i),...n})}function du(e,t,n){return{[t]:uu(e,[t],Wt(n))}}function fu(e,t,n){return t.reduce((t,r)=>({...t,...du(e,r,n)}),{})}function pu(e,t,n){return fu(e,t.keys,n)}function mu(e,t,n){return P(pu(e,t,n))}function hu(e,t,n){let r={};for(let i of globalThis.Object.getOwnPropertyNames(e))r[i]=wu(e[i],t,Wt(n));return r}function gu(e,t,n){return hu(e.properties,t,n)}function _u(e,t,n){return P(gu(e,t,n))}function vu(e,t){return e.map(e=>Cu(e,t))}function yu(e,t){return e.map(e=>Cu(e,t))}function bu(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function xu(e,t,n){let r=Ai(e,[_n,`$id`,`required`,`properties`]);return L(bu(n,t),r)}function Su(e){return F(e.reduce((e,t)=>In(t)?[...e,I(t)]:e,[]))}function Cu(e,t){return Pn(e)?jo(vu(e.allOf,t)):T(e)?F(yu(e.anyOf,t)):Wn(e)?xu(e,t,e.properties):L({})}function wu(e,t,n){let r=v(t)?Su(t):t,i=sr(t)?ka(t):t,a=qn(e),o=qn(t);return zn(e)?_u(e,i,n):Rn(t)?Ou(e,t,n):a&&o||!a&&o||a&&!o?M(`Pick`,[e,r],n):S({...Cu(e,i),...n})}function Tu(e,t,n){return{[t]:wu(e,[t],Wt(n))}}function Eu(e,t,n){return t.reduce((t,r)=>({...t,...Tu(e,r,n)}),{})}function Du(e,t,n){return Eu(e,t.keys,n)}function Ou(e,t,n){return P(Du(e,t,n))}function ku(e,t){return M(`Partial`,[M(e,t)])}function Au(e){return M(`Partial`,[Mo(e)])}function ju(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=xo(e[n]);return t}function Mu(e,t){let n=Ai(e,[_n,`$id`,`required`,`properties`]);return L(ju(t),n)}function Nu(e){return e.map(e=>Pu(e))}function Pu(e){return kn(e)?ku(e.target,e.parameters):qn(e)?Au(e.$ref):Pn(e)?jo(Nu(e.allOf)):T(e)?F(Nu(e.anyOf)):Wn(e)?Mu(e,e.properties):Dn(e)||On(e)||Nn(e)||Ln(e)||Hn(e)||Un(e)||Yn(e)||Xn(e)||tr(e)?e:L({})}function Fu(e,t){return zn(e)?Ru(e,t):S({...Pu(e),...t})}function Iu(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=Fu(e[r],Wt(t));return n}function Lu(e,t){return Iu(e.properties,t)}function Ru(e,t){return P(Lu(e,t))}function zu(e,t){return M(`Required`,[M(e,t)])}function Bu(e){return M(`Required`,[Mo(e)])}function Vu(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=Ai(e[n],[yn]);return t}function Hu(e,t){let n=Ai(e,[_n,`$id`,`required`,`properties`]);return L(Vu(t),n)}function Uu(e){return e.map(e=>Wu(e))}function Wu(e){return kn(e)?zu(e.target,e.parameters):qn(e)?Bu(e.$ref):Pn(e)?jo(Uu(e.allOf)):T(e)?F(Uu(e.anyOf)):Wn(e)?Hu(e,e.properties):Dn(e)||On(e)||Nn(e)||Ln(e)||Hn(e)||Un(e)||Yn(e)||Xn(e)||tr(e)?e:L({})}function Gu(e,t){return zn(e)?Ju(e,t):S({...Wu(e),...t})}function Ku(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=Gu(e[r],t);return n}function qu(e,t){return Ku(e.properties,t)}function Ju(e,t){return P(qu(e,t))}function Yu(e,t){return t.map(t=>qn(t)?Xu(e,t.$ref):_d(e,t))}function Xu(e,t){return t in e?qn(e[t])?Xu(e,e[t].$ref):_d(e,e[t]):N()}function Zu(e){return zo(e[0])}function Qu(e){return Wa(e[0],e[1])}function $u(e){return es(e[0])}function ed(e){return Fu(e[0])}function td(e){return uu(e[0],e[1])}function nd(e){return wu(e[0],e[1])}function rd(e){return Gu(e[0])}function id(e,t,n){let r=Yu(e,n);return t===`Awaited`?Zu(r):t===`Index`?Qu(r):t===`KeyOf`?$u(r):t===`Partial`?ed(r):t===`Omit`?td(r):t===`Pick`?nd(r):t===`Required`?rd(r):N()}function ad(e,t){return Ei(_d(e,t))}function od(e,t){return Oi(_d(e,t))}function sd(e,t,n){return ji(gd(e,t),_d(e,n))}function cd(e,t,n){return Mi(gd(e,t),_d(e,n))}function ld(e,t){return jo(gd(e,t))}function ud(e,t){return Ya(_d(e,t))}function dd(e,t){return L(globalThis.Object.keys(t).reduce((n,r)=>({...n,[r]:_d(e,t[r])}),{}))}function fd(e,t){let[n,r]=[_d(e,yl(t)),_l(t)],i=Gt(t);return i.patternProperties[r]=n,i}function pd(e,t){return qn(t)?{...Xu(e,t.$ref),[_n]:t[_n]}:t}function md(e,t){return oo(gd(e,t))}function hd(e,t){return F(gd(e,t))}function gd(e,t){return t.map(t=>_d(e,t))}function _d(e,t){return Sn(t)?S(_d(e,Ai(t,[yn])),t):xn(t)?S(_d(e,Ai(t,[vn])),t):$n(t)?S(pd(e,t),t):Tn(t)?S(ad(e,t.items),t):En(t)?S(od(e,t.items),t):kn(t)?S(id(e,t.target,t.parameters)):An(t)?S(sd(e,t.parameters,t.returns),t):Mn(t)?S(cd(e,t.parameters,t.returns),t):Pn(t)?S(ld(e,t.allOf),t):Fn(t)?S(ud(e,t.items),t):Wn(t)?S(dd(e,t.properties),t):Kn(t)?S(fd(e,t)):er(t)?S(md(e,t.items||[]),t):T(t)?S(hd(e,t.anyOf),t):t}function vd(e,t){return t in e?_d(e,e[t]):N()}function yd(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,n)=>({...t,[n]:vd(e,n)}),{})}var bd=class{constructor(e){let t=yd(e),n=this.WithIdentifiers(t);this.$defs=n}Import(e,t){let n={...this.$defs,[e]:S(this.$defs[e],t)};return S({[C]:`Import`,$defs:n,$ref:e})}WithIdentifiers(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,n)=>({...t,[n]:{...e[n],$id:n}}),{})}};function xd(e){return new bd(e)}function Sd(e,t){return S({[C]:`Not`,not:e},t)}function Cd(e,t){return Mn(e)?oo(e.parameters,t):N()}var wd=0;function Td(e,t={}){x(t.$id)&&(t.$id=`T${wd++}`);let n=Gt(e({[C]:`This`,$ref:`${t.$id}`}));return n.$id=t.$id,S({[bn]:`Recursive`,...n},t)}function Ed(e,t){let n=b(e)?new globalThis.RegExp(e):e;return S({[C]:`RegExp`,type:`RegExp`,source:n.source,flags:n.flags},t)}function Dd(e){return Pn(e)?e.allOf:T(e)?e.anyOf:er(e)?e.items??[]:[]}function Od(e){return Dd(e)}function kd(e,t){return Mn(e)?S(e.returns,t):N(t)}var Ad=class{constructor(e){this.schema=e}Decode(e){return new jd(this.schema,e)}},jd=class{constructor(e,t){this.schema=e,this.decode=t}EncodeTransform(e,t){let n={Encode:n=>t[_n].Encode(e(n)),Decode:e=>this.decode(t[_n].Decode(e))};return{...t,[_n]:n}}EncodeSchema(e,t){let n={Decode:this.decode,Encode:e};return{...t,[_n]:n}}Encode(e){return $n(this.schema)?this.EncodeTransform(e,this.schema):this.EncodeSchema(e,this.schema)}};function Md(e){return new Ad(e)}function Nd(e={}){return S({[C]:e[C]??`Unsafe`},e)}function Pd(e){return S({[C]:`Void`,type:`void`},e)}var U=e({Any:()=>Ti,Argument:()=>Di,Array:()=>Ei,AsyncIterator:()=>Oi,Awaited:()=>zo,BigInt:()=>pa,Boolean:()=>fa,Capitalize:()=>Xl,Composite:()=>cs,Const:()=>ys,Constructor:()=>ji,ConstructorParameters:()=>bs,Date:()=>ls,Enum:()=>xs,Exclude:()=>Kc,Extends:()=>Fc,Extract:()=>Qc,Function:()=>Mi,Index:()=>Wa,InstanceType:()=>nl,Instantiate:()=>Il,Integer:()=>Ll,Intersect:()=>jo,Iterator:()=>Ya,KeyOf:()=>es,Literal:()=>I,Lowercase:()=>Zl,Mapped:()=>_o,Module:()=>xd,Never:()=>N,Not:()=>Sd,Null:()=>us,Number:()=>ma,Object:()=>L,Omit:()=>uu,Optional:()=>xo,Parameters:()=>Cd,Partial:()=>Fu,Pick:()=>wu,Promise:()=>Qa,Readonly:()=>no,ReadonlyOptional:()=>rl,Record:()=>gl,Recursive:()=>Td,Ref:()=>Mo,RegExp:()=>Ed,Required:()=>Gu,Rest:()=>Od,ReturnType:()=>kd,String:()=>ha,Symbol:()=>ds,TemplateLiteral:()=>Ta,Transform:()=>Md,Tuple:()=>oo,Uint8Array:()=>ps,Uncapitalize:()=>Ql,Undefined:()=>fs,Union:()=>F,Unknown:()=>ms,Unsafe:()=>Nd,Uppercase:()=>$l,Void:()=>Pd}),Fd=U.Union([U.Object({enabled:U.Literal(!1),selectedPetId:U.Union([U.String(),U.Null()])},{additionalProperties:!1}),U.Object({enabled:U.Literal(!0),selectedPetId:U.String({minLength:1})},{additionalProperties:!1})]),Id=U.Object({columns:U.Integer({minimum:1}),height:U.Integer({minimum:1}),rows:U.Integer({minimum:1}),width:U.Integer({minimum:1})},{additionalProperties:!1}),Ld=U.Object({durationMs:U.Integer({minimum:1}),spriteIndex:U.Integer({maximum:255,minimum:0})},{additionalProperties:!1}),Rd=U.Object({fallback:U.String({minLength:1}),frames:U.Array(Ld,{maxItems:512,minItems:1}),loopStart:U.Union([U.Integer({minimum:0}),U.Null()])},{additionalProperties:!1}),zd=U.Object({animations:U.Record(U.String({minLength:1}),Rd),assetId:U.String({pattern:`^[a-f0-9]{64}$`}),availability:U.Union([U.Literal(`downloadable`),U.Literal(`ready`)]),description:U.String(),displayName:U.String({minLength:1}),frame:Id,id:U.String({minLength:1}),source:U.Union([U.Literal(`builtin`),U.Literal(`custom`),U.Literal(`legacy`)])},{additionalProperties:!1}),Bd=U.Object({data:U.Array(zd)},{additionalProperties:!1});U.Object({petId:U.String({minLength:1})},{additionalProperties:!1});var Vd=U.Object({data:zd},{additionalProperties:!1}),Hd=U.String({pattern:`^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:-(?:(?:0|[1-9][0-9]*)|[0-9]*[A-Za-z-][0-9A-Za-z-]*)(?:\\.(?:(?:0|[1-9][0-9]*)|[0-9]*[A-Za-z-][0-9A-Za-z-]*))*)?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$`}),Ud=U.Union([U.Literal(`current`),U.Literal(`available`),U.Literal(`restart-required`),U.Literal(`check-failed`)]),Wd=U.Object({appVersion:Hd,codexVersion:Hd,latestVersion:U.Union([Hd,U.Null()]),releaseNotes:U.Union([U.String({maxLength:32768}),U.Null()]),status:Ud,updateAvailable:U.Boolean()},{additionalProperties:!1});U.Object({version:Hd},{additionalProperties:!1});var Gd=U.Object({appVersion:Hd,codexVersion:Hd,latestVersion:Hd,releaseNotes:U.Null(),status:U.Literal(`restart-required`),updateAvailable:U.Literal(!1)},{additionalProperties:!1}),Kd=U.Union([U.Literal(`local`),U.Literal(`lan`)]),qd=U.Object({authenticated:U.Boolean(),mode:Kd,version:U.Literal(1)},{additionalProperties:!1});U.Object({code:U.String({minLength:1})},{additionalProperties:!1});var Jd=U.String({maxLength:32768,minLength:1,pattern:`^(?!.*[\\u0000\\r\\n])(?:/|[A-Za-z]:[\\\\/]|\\\\\\\\[^\\\\/]+[\\\\/][^\\\\/]+).*$`}),Yd=U.String({maxLength:64,minLength:1}),Xd=U.Object({path:Jd},{additionalProperties:!1}),Zd=U.Object({id:Yd,path:Jd},{additionalProperties:!1}),Qd=U.Readonly(U.Array(Zd,{minItems:1,uniqueItems:!0})),$d=U.Readonly(U.Array(Xd,{minItems:1,uniqueItems:!0}));U.Object({rootPath:Jd},{additionalProperties:!1}),pi(`date-time`)||mi(`date-time`,e=>!Number.isNaN(Date.parse(e)));var ef=U.String({format:`date-time`}),tf=U.Union([ef,U.Null()]),W=U.String({minLength:1,pattern:`^(?![A-Za-z]:)(?!/)(?!.*(?:^|/)\\.\\.?(?:/|$))(?!.*//)(?!.*\\\\)(?!.*\\/$).+$`}),nf=U.String({maxLength:128,minLength:1,pattern:`^[A-Za-z0-9._:-]+$`});U.Object({query:U.String({maxLength:256}),rootPath:U.Optional(Jd),sessionId:nf},{additionalProperties:!1});var rf=U.Object({name:U.String({minLength:1}),path:W,rootId:Yd,rootPath:Jd},{additionalProperties:!1}),af=U.Object({data:U.Array(rf,{maxItems:50})},{additionalProperties:!1});U.Object({rootPath:U.Optional(Jd),sessionId:nf},{additionalProperties:!1});var of=U.Object({},{additionalProperties:!1}),sf=U.String({maxLength:32768,minLength:1,pattern:`^[^\\u0000\\r\\n]+$`}),cf=U.Object({createdAt:ef,id:U.String({minLength:1}),name:U.String({minLength:1}),roots:Qd},{additionalProperties:!1}),lf=Jd;U.Object({includeHidden:U.Optional(U.Boolean()),path:U.Optional(lf)},{additionalProperties:!1});var uf=U.Object({name:U.String({minLength:1}),path:lf},{additionalProperties:!1}),df=U.Object({name:U.String({minLength:1}),path:lf},{additionalProperties:!1}),ff=U.Object({entries:U.Array(uf),parentPath:U.Union([lf,U.Null()]),path:lf,roots:U.Array(df)},{additionalProperties:!1}),pf=U.Union([U.Literal(`file`),U.Literal(`image`)]);U.Object({includeHidden:U.Optional(U.Boolean()),kind:pf,path:U.Optional(lf)},{additionalProperties:!1});var mf=U.Object({name:U.String({minLength:1}),path:lf,type:U.Union([U.Literal(`directory`),U.Literal(`file`)])},{additionalProperties:!1}),hf=U.Object({entries:U.Array(mf),parentPath:U.Union([lf,U.Null()]),path:lf,roots:U.Array(df)},{additionalProperties:!1});U.Object({path:lf},{additionalProperties:!1}),U.Object({roots:$d},{additionalProperties:!1});var gf=U.Object({project:cf},{additionalProperties:!1}),_f=U.Union([U.Literal(`visual-studio-code`),U.Literal(`system-default`),U.Literal(`zed`),U.Literal(`windsurf`),U.Literal(`finder`),U.Literal(`terminal`),U.Literal(`ghostty`),U.Literal(`xcode`),U.Literal(`android-studio`),U.Literal(`file-manager`),U.Literal(`gnome-terminal`),U.Literal(`konsole`),U.Literal(`xfce-terminal`),U.Literal(`explorer`),U.Literal(`windows-terminal`),U.Literal(`command-prompt`)]),vf=U.Union([U.Literal(`editor`),U.Literal(`file-manager`),U.Literal(`system-default`),U.Literal(`terminal`),U.Literal(`tool`)]),yf=U.Object({id:_f,kind:vf,name:U.String({minLength:1})},{additionalProperties:!1}),bf=U.Union([U.Literal(`darwin`),U.Literal(`linux`),U.Literal(`win32`)]),xf=U.Object({apps:U.Array(yf,{uniqueItems:!0}),platform:bf},{additionalProperties:!1});U.Object({appId:_f,path:U.Optional(sf)},{additionalProperties:!1});var Sf=U.Object({appId:_f,path:U.Optional(sf)},{additionalProperties:!1});U.Object({projectIds:U.Array(U.String({minLength:1}),{minItems:1,uniqueItems:!0})},{additionalProperties:!1}),U.Object({name:U.String({maxLength:200,minLength:1,pattern:`\\S`})},{additionalProperties:!1});var Cf=U.Object({project:cf},{additionalProperties:!1});U.Object({},{additionalProperties:!1});var wf=U.Object({projectId:U.String({minLength:1}),status:U.Literal(`removed`)},{additionalProperties:!1}),Tf=U.Object({id:U.String({minLength:1}),pinned:U.Boolean(),projectId:U.String({minLength:1}),title:U.String({minLength:1}),updatedAt:ef},{additionalProperties:!1}),Ef=U.Union([U.Literal(`pending`),U.Literal(`running`),U.Literal(`completed`),U.Literal(`failed`),U.Literal(`declined`),U.Literal(`interrupted`)]),Df=U.Object({branch:U.Optional(U.String({minLength:1})),instructions:U.Optional(U.String({minLength:1})),sha:U.Optional(U.String({minLength:1})),title:U.Optional(U.String({minLength:1})),type:U.Union([U.Literal(`uncommitted_changes`),U.Literal(`base_branch`),U.Literal(`commit`),U.Literal(`custom`)])},{additionalProperties:!1}),Of=U.Intersect([Df,U.Union([U.Object({type:U.Literal(`uncommitted_changes`)}),U.Object({branch:U.String({minLength:1}),type:U.Literal(`base_branch`)}),U.Object({sha:U.String({minLength:1}),type:U.Literal(`commit`)}),U.Object({instructions:U.String({minLength:1}),type:U.Literal(`custom`)})])]),kf=50*1024*1024,Af=50*1024*1024,jf=10*1024*1024,Mf=50*1024*1024,Nf=Math.max(kf,jf),Pf=1500,Ff=512*1024*1024,If=`.png,.jpg,.jpeg,.webp,.gif`,Lf=`.asm,.astro,.awk,.bash,.bat,.c,.cc,.conf,.cs,.cpp,.css,.csv,.cxx,.def,.dic,.diff,.doc,.docx,.dot,.eml,.ejs,.ex,.exs,.go,.gradle,.graphql,.groovy,.h,.hh,.htm,.html,.hbs,.hcl,.hs,.ics,.ifb,.iif,.in,.ini,.jade,.java,.jinja2,.jl,.js,.jsx,.json,.json5,.kt,.kts,.ksh,.list,.liquid,.lua,.log,.markdown,.md,.mht,.mhtml,.mime,.mjs,.nws,.ndjson,.odt,.pdf,.pl,.patch,.php,.pot,.ppa,.pps,.ppt,.pptx,.pwz,.py,.properties,.proto,.ps1,.pug,.r,.rb,.rst,.rtf,.rs,.s,.sass,.scala,.scss,.sh,.sql,.srt,.text,.tex,.tf,.tmpl,.toml,.ts,.tsx,.tsv,.txt,.vcf,.vtt,.vbs,.wiz,.xla,.xlb,.xlc,.xlm,.xls,.xlsx,.xlt,.xlw,.xml,.yaml,.yml,.zsh`.split(`,`),Rf=`application/csv,application/graphql,application/javascript,application/json,application/msword,application/pdf,application/rtf,application/toml,application/typescript,application/vnd.ms-excel,application/vnd.ms-powerpoint,application/vnd.oasis.opendocument.text,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/x-httpd-php,application/x-iif,application/x-ndjson,application/x-patch,application/x-protobuf,application/x-rust,application/x-shellscript,application/x-sql,application/x-toml,application/x-typescript,application/x-yaml,application/yaml,message/rfc822,text/calendar,text/csv,text/css,text/html,text/javascript,text/jsx,text/markdown,text/plain,text/rtf,text/tsx,text/tsv,text/vtt,text/x-c,text/x-c++,text/x-csharp,text/x-diff,text/x-go,text/x-java,text/x-makefile,text/x-python,text/x-rst,text/x-rust,text/x-shellscript,text/x-sql,text/x-typescript,text/x-yaml,text/xml`.split(`,`),zf=[...Lf,...Rf].join(`,`);U.Union([U.Literal(`image/gif`),U.Literal(`image/jpeg`),U.Literal(`image/png`),U.Literal(`image/webp`)]);var Bf=U.String({maxLength:255,minLength:1}),Vf=U.Union([U.Literal(`file`),U.Literal(`image`),U.Literal(`text`)]),Hf=U.Object({name:U.String({minLength:1})},{additionalProperties:!1});function Uf(e,t){let n=new Set(t.map(e=>e.name)),r=e,i=!1;for(;r.length>0;){let e=/^\s*\$([^\s$]+)/u.exec(r),t=e?.[1];if(e===null||t===void 0||!n.has(t))break;r=r.slice(e[0].length),i=!0}return i?r.trimStart():e}var Wf=U.Object({id:U.String({minLength:1}),kind:Vf,mediaType:Bf,name:U.String({maxLength:255,minLength:1}),size:U.Integer({maximum:Ff,minimum:1})},{additionalProperties:!1});U.Object({},{additionalProperties:!1});var Gf=U.Object({attachmentId:U.String({minLength:1}),status:U.Literal(`opened`)},{additionalProperties:!1}),Kf=U.Union([U.Literal(`commentary`),U.Literal(`final_answer`)]),qf=U.Object({attachments:U.Optional(U.Array(Wf,{maxItems:Pf})),id:U.String({minLength:1}),phase:U.Optional(Kf),role:U.Union([U.Literal(`user`),U.Literal(`assistant`)]),skills:U.Optional(U.Array(Hf)),text:U.String(),type:U.Literal(`message`)},{additionalProperties:!1}),Jf=U.Object({content:U.String(),id:U.String({minLength:1}),summary:U.String(),type:U.Literal(`reasoning`)},{additionalProperties:!1}),Yf=U.Object({bytes:U.Integer({minimum:0}),lines:U.Integer({minimum:0})},{additionalProperties:!1}),Xf=U.Object({command:U.String(),cwd:U.String(),exitCode:U.Optional(U.Integer()),id:U.String({minLength:1}),output:U.Optional(U.String()),outputOmitted:Yf,status:Ef,type:U.Literal(`command`)},{additionalProperties:!1}),Zf=U.Object({command:U.String({minLength:1}),cwd:U.String({minLength:1}),id:U.String({minLength:1}),itemId:U.String({minLength:1})},{additionalProperties:!1}),Qf=U.Object({data:U.Array(Zf)},{additionalProperties:!1}),$f=U.Object({status:U.Literal(`terminated`),terminalId:U.String({minLength:1})},{additionalProperties:!1}),ep=U.Union([U.String(),U.Null()]),tp=U.Union([U.Number(),U.Null()]),np={description:ep,id:U.String({minLength:1}),required:U.Boolean(),title:U.String({minLength:1})},rp=U.Object({label:U.String({minLength:1}),value:U.String()},{additionalProperties:!1}),ip=U.Union([U.Object({...np,defaultValue:U.Union([U.String(),U.Null()]),format:U.Union([U.Literal(`email`),U.Literal(`uri`),U.Literal(`date`),U.Literal(`date-time`),U.Null()]),maxLength:U.Union([U.Integer({minimum:0}),U.Null()]),minLength:U.Union([U.Integer({minimum:0}),U.Null()]),type:U.Literal(`string`)},{additionalProperties:!1}),U.Object({...np,defaultValue:U.Union([U.String(),U.Null()]),options:U.Array(rp,{minItems:1}),type:U.Literal(`select`)},{additionalProperties:!1}),U.Object({...np,defaultValue:U.Array(U.String()),maximum:U.Union([U.Integer({minimum:0}),U.Null()]),minimum:U.Union([U.Integer({minimum:0}),U.Null()]),options:U.Array(rp,{minItems:1}),type:U.Literal(`multi_select`)},{additionalProperties:!1}),U.Object({...np,defaultValue:tp,maximum:tp,minimum:tp,type:U.Union([U.Literal(`number`),U.Literal(`integer`)])},{additionalProperties:!1}),U.Object({...np,defaultValue:U.Union([U.Boolean(),U.Null()]),type:U.Literal(`boolean`)},{additionalProperties:!1})]),ap=U.Record(U.String(),U.Union([U.String(),U.Number(),U.Boolean(),U.Array(U.String())])),op=U.Union([U.Object({action:U.Literal(`accept`),content:ap},{additionalProperties:!1}),U.Object({action:U.Union([U.Literal(`decline`),U.Literal(`cancel`)]),content:U.Null()},{additionalProperties:!1})]),sp=U.Union([U.Literal(`pending`),U.Literal(`resolved`),U.Literal(`expired`)]),cp=U.Union([U.Literal(`allow`),U.Literal(`allow_for_session`),U.Literal(`deny`)]),lp=U.Object({host:U.String({minLength:1}),protocol:U.Union([U.Literal(`http`),U.Literal(`https`),U.Literal(`socks5Tcp`),U.Literal(`socks5Udp`)])},{additionalProperties:!1}),up={createdAt:ef,expiresAt:tf,itemId:U.String({minLength:1}),projectId:U.String({minLength:1}),requestId:U.String({minLength:1}),status:sp,taskId:U.String({minLength:1}),turnId:U.String({minLength:1})},dp={itemId:U.String({minLength:1}),projectId:U.String({minLength:1}),taskId:U.String({minLength:1}),turnId:U.String({minLength:1})},fp=U.Object({description:U.String(),label:U.String({minLength:1})},{additionalProperties:!1}),pp={header:U.String({minLength:1}),id:U.String({minLength:1}),isSecret:U.Boolean(),prompt:U.String({minLength:1})},mp=U.Union([U.Object({...pp,isOther:U.Boolean(),options:U.Array(fp,{minItems:1}),type:U.Literal(`choice`)},{additionalProperties:!1}),U.Object({...pp,isOther:U.Literal(!0),options:U.Array(fp,{maxItems:0}),type:U.Literal(`choice`)},{additionalProperties:!1}),U.Object({...pp,isOther:U.Literal(!1),options:U.Array(fp,{maxItems:2,minItems:2}),type:U.Literal(`confirmation`)},{additionalProperties:!1}),U.Object({...pp,isOther:U.Boolean(),options:U.Array(fp,{maxItems:0}),type:U.Literal(`short_text`)},{additionalProperties:!1})]),hp=U.Object({...up,availableDecisions:U.Array(cp,{minItems:1}),grantRoot:U.Union([U.String(),U.Null()]),reason:U.Union([U.String(),U.Null()]),type:U.Literal(`file_change_approval`)},{additionalProperties:!1}),gp=U.Union([U.Literal(`network`),U.Literal(`file_system`)]),_p=U.Union([U.Literal(`read`),U.Literal(`write`),U.Literal(`deny`)]),vp=U.Union([U.Object({type:U.Literal(`path`),value:U.String({minLength:1})},{additionalProperties:!1}),U.Object({type:U.Literal(`glob`),value:U.String({minLength:1})},{additionalProperties:!1}),U.Object({kind:U.Union([U.Literal(`root`),U.Literal(`minimal`),U.Literal(`project_roots`),U.Literal(`tmpdir`),U.Literal(`slash_tmp`),U.Literal(`unknown`)]),path:U.Union([U.String({minLength:1}),U.Null()]),subpath:U.Union([U.String(),U.Null()]),type:U.Literal(`special`)},{additionalProperties:!1})]),yp=U.Object({entries:U.Array(U.Object({access:_p,path:vp},{additionalProperties:!1})),globScanMaxDepth:U.Union([U.Integer({minimum:0}),U.Null()]),read:U.Union([U.Array(U.String({minLength:1})),U.Null()]),write:U.Union([U.Array(U.String({minLength:1})),U.Null()])},{additionalProperties:!1}),bp=U.Object({fileSystem:U.Union([yp,U.Null()]),network:U.Union([U.Object({enabled:U.Union([U.Boolean(),U.Null()])},{additionalProperties:!1}),U.Null()])},{additionalProperties:!1}),xp=U.Object({...up,additionalPermissions:U.Optional(U.Union([bp,U.Null()])),availableDecisions:U.Array(cp,{minItems:1}),command:U.Union([U.String(),U.Null()]),cwd:U.Union([U.String(),U.Null()]),networkAccess:U.Union([lp,U.Null()]),reason:U.Union([U.String(),U.Null()]),type:U.Literal(`command_approval`)},{additionalProperties:!1}),Sp=U.Object({...up,cwd:U.String({minLength:1}),environmentId:U.Union([U.String({minLength:1}),U.Null()]),permissions:bp,reason:U.Union([U.String(),U.Null()]),type:U.Literal(`permissions_approval`)},{additionalProperties:!1}),Cp=U.Object({...up,questions:U.Array(mp,{minItems:1,maxItems:3}),type:U.Literal(`user_input`)},{additionalProperties:!1}),wp={...up,message:U.String({minLength:1}),serverName:U.String({minLength:1}),type:U.Literal(`mcp_elicitation`)},Tp=U.Object({...wp,fields:U.Array(ip),mode:U.Literal(`form`)},{additionalProperties:!1}),Ep=U.Object({...wp,mode:U.Literal(`url`),url:U.String({minLength:1})},{additionalProperties:!1}),Dp=U.Object({...wp,mode:U.Literal(`unsupported`)},{additionalProperties:!1}),Op=U.Union([Tp,Ep,Dp]),kp=U.Union([xp,hp,Sp,Cp,Op]);function Ap(e){return U.Union([U.Object({...xp.properties,status:U.Literal(e)},{additionalProperties:!1}),U.Object({...hp.properties,status:U.Literal(e)},{additionalProperties:!1}),U.Object({...Sp.properties,status:U.Literal(e)},{additionalProperties:!1}),U.Object({...Cp.properties,status:U.Literal(e)},{additionalProperties:!1}),U.Object({...Tp.properties,status:U.Literal(e)},{additionalProperties:!1}),U.Object({...Ep.properties,status:U.Literal(e)},{additionalProperties:!1}),U.Object({...Dp.properties,status:U.Literal(e)},{additionalProperties:!1})])}var jp=Ap(`pending`),Mp=Ap(`resolved`),Np=Ap(`expired`),Pp=U.Object({decision:cp},{additionalProperties:!1}),Fp=U.Object({answers:U.Record(U.String(),U.Array(U.String({minLength:1}),{maxItems:1,minItems:1}))},{additionalProperties:!1}),Ip=U.Object({grantedPermissions:U.Array(gp,{maxItems:2,uniqueItems:!0}),scope:U.Union([U.Literal(`turn`),U.Literal(`session`)])},{additionalProperties:!1});U.Union([U.Object({...dp,resolution:Pp,type:U.Literal(`command_approval`)},{additionalProperties:!1}),U.Object({...dp,resolution:Pp,type:U.Literal(`file_change_approval`)},{additionalProperties:!1}),U.Object({...dp,resolution:Ip,type:U.Literal(`permissions_approval`)},{additionalProperties:!1}),U.Object({...dp,resolution:Fp,type:U.Literal(`user_input`)},{additionalProperties:!1}),U.Object({...dp,resolution:op,type:U.Literal(`mcp_elicitation`)},{additionalProperties:!1})]);var Lp=U.Object({request:kp},{additionalProperties:!1}),Rp=U.Object({diff:U.String(),kind:U.Union([U.Literal(`create`),U.Literal(`update`),U.Literal(`delete`)]),path:U.String({minLength:1})},{additionalProperties:!1}),zp=U.String({maxLength:64,minLength:64,pattern:`^[a-f0-9]{64}$`}),Bp=U.String({maxLength:1024,minLength:1,pattern:`\\S`}),Vp=U.String({maxLength:1024,minLength:1,pattern:`^(?!\\.{1,2}$)(?!.*[\\u0000\\r\\n])[^/\\\\]+$`}),Hp=U.Array(W,{maxItems:500,minItems:1,uniqueItems:!0}),Up=U.String({maxLength:1e4,minLength:1,pattern:`\\S`}),Wp=U.Object({diff:U.String(),kind:U.Union([U.Literal(`create`),U.Literal(`update`),U.Literal(`delete`)]),path:W},{additionalProperties:!1}),Gp=U.Object({baseBranches:U.Array(U.String({minLength:1}),{uniqueItems:!0}),branch:U.Union([U.String({minLength:1}),U.Null()]),branches:U.Array(Bp,{uniqueItems:!0}),repositoryMode:U.Union([U.Literal(`root`),U.Literal(`children`),U.Literal(`none`)]),snapshot:zp,staged:U.Array(Wp),unstaged:U.Array(Wp)},{additionalProperties:!1});U.Object({includeDiff:U.Optional(U.Boolean()),repository:U.Optional(Vp),rootPath:Jd},{additionalProperties:!1});var Kp=U.Object({authoredAt:U.String({format:`date-time`}),authorEmail:U.String({maxLength:320,minLength:1}),authorName:U.String({maxLength:512,minLength:1,pattern:`\\S`}),sha:U.String({maxLength:64,minLength:40,pattern:`^[a-f0-9]+$`}),title:U.String({maxLength:1e4,minLength:1,pattern:`\\S`})},{additionalProperties:!1}),qp=U.String({maxLength:20,minLength:1,pattern:`^[0-9]+$`});U.Object({cursor:U.Optional(qp),repository:U.Optional(W),rootPath:Jd},{additionalProperties:!1});var Jp=U.Object({branch:U.Union([Bp,U.Null()]),commits:U.Array(Kp,{maxItems:20}),nextCursor:U.Union([qp,U.Null()]),repositories:U.Array(W,{maxItems:256,uniqueItems:!0}),repository:U.Union([W,U.Null()]),repositoryMode:U.Union([U.Literal(`root`),U.Literal(`children`)])},{additionalProperties:!1}),Yp=U.String({maxLength:64,minLength:40,pattern:`^[a-f0-9]+$`}),Xp=U.String({maxLength:20,minLength:1,pattern:`^[0-9]+$`});U.Object({cursor:U.Optional(Xp),repository:U.Optional(W),rootPath:Jd,sha:Yp},{additionalProperties:!1});var Zp=U.Object({kind:U.Union([U.Literal(`create`),U.Literal(`update`),U.Literal(`delete`)]),path:W},{additionalProperties:!1}),Qp=U.Object({files:U.Array(Zp,{maxItems:100}),nextCursor:U.Union([Xp,U.Null()])},{additionalProperties:!1});U.Object({path:W,repository:U.Optional(W),rootPath:Jd,sha:Yp},{additionalProperties:!1});var $p=U.Object({diff:U.String({maxLength:512*1024}),truncated:U.Boolean()},{additionalProperties:!1});U.Object({branch:Bp,expectedSnapshot:zp},{additionalProperties:!1}),U.Object({branch:Bp,expectedSnapshot:zp},{additionalProperties:!1});var em=U.Object({branch:U.Union([Bp,U.Null()]),current:U.Boolean(),path:lf},{additionalProperties:!1}),tm=U.Object({worktrees:U.Array(em,{maxItems:256})},{additionalProperties:!1});U.Object({branch:Bp,expectedSnapshot:zp},{additionalProperties:!1}),U.Object({path:lf},{additionalProperties:!1});var nm=U.Object({project:cf,worktree:em},{additionalProperties:!1});U.Object({expectedSnapshot:zp,paths:Hp,repository:U.Optional(Vp)},{additionalProperties:!1});var rm=U.Object({message:Up,snapshot:zp},{additionalProperties:!1});U.Object({action:U.Union([U.Literal(`commit`),U.Literal(`commit_and_push`)]),expectedSnapshot:zp,message:Up,paths:Hp,repository:U.Optional(Vp)},{additionalProperties:!1});var im=U.Object({branch:U.Union([U.String({minLength:1}),U.Null()]),commitSha:U.String({maxLength:64,minLength:7,pattern:`^[a-f0-9]+$`}),message:Up,pushError:U.Union([U.String({minLength:1}),U.Null()]),pushStatus:U.Union([U.Literal(`not_requested`),U.Literal(`pushed`),U.Literal(`failed`),U.Literal(`not_configured`)])},{additionalProperties:!1}),am=U.Object({path:W,type:U.Union([U.Literal(`directory`),U.Literal(`file`)])},{additionalProperties:!1});U.Object({path:U.Optional(W),rootPath:U.Optional(Jd)},{additionalProperties:!1});var om=U.Object({entries:U.Array(am),path:U.Union([W,U.Null()])},{additionalProperties:!1}),sm=U.String({maxLength:255,minLength:1,pattern:`^(?!\\.\\.?$)[^/\\\\\\u0000\\r\\n]+$`});U.Object({name:sm,path:W},{additionalProperties:!1});var cm=U.Object({path:W},{additionalProperties:!1});U.Object({path:W},{additionalProperties:!1});var lm=U.Object({path:W,status:U.Literal(`deleted`)},{additionalProperties:!1});U.Object({cursor:U.Optional(U.Integer({minimum:0})),path:sf,rootPath:U.Optional(Jd)},{additionalProperties:!1});var um=U.Object({content:U.String(),nextCursor:U.Union([U.Integer({minimum:0}),U.Null()]),path:sf},{additionalProperties:!1}),dm=U.Object({changes:U.Array(Rp),id:U.String({minLength:1}),status:Ef,type:U.Literal(`file_change`)},{additionalProperties:!1}),fm=U.Object({id:U.String({minLength:1}),input:U.Optional(U.Unknown()),name:U.String({minLength:1}),output:U.Optional(U.Unknown()),progress:U.Optional(U.String({maxLength:8192})),status:Ef,type:U.Literal(`tool`)},{additionalProperties:!1}),pm=U.Object({fasterModel:U.Optional(U.String({minLength:1})),id:U.String({minLength:1}),kind:U.Literal(`safety_buffering`),model:U.String({minLength:1}),status:Ef,type:U.Literal(`runtime_status`)},{additionalProperties:!1}),mm=U.Object({fromModel:U.String({minLength:1}),id:U.String({minLength:1}),kind:U.Literal(`model_rerouted`),status:U.Literal(`completed`),toModel:U.String({minLength:1}),type:U.Literal(`runtime_status`)},{additionalProperties:!1}),hm=U.Object({detail:U.Optional(U.String({maxLength:8192})),durationMs:U.Optional(U.Integer({minimum:0})),eventName:U.String({minLength:1}),id:U.String({minLength:1}),kind:U.Literal(`hook`),status:Ef,type:U.Literal(`runtime_status`)},{additionalProperties:!1}),gm=U.Union([pm,mm,hm]),_m=U.Object({id:U.String({minLength:1}),text:U.String(),type:U.Literal(`plan`)},{additionalProperties:!1}),vm=U.Object({detail:U.Optional(U.String()),id:U.String({minLength:1}),label:U.String({minLength:1}),status:U.Optional(Ef),transient:U.Optional(U.Boolean()),type:U.Literal(`activity`)},{additionalProperties:!1}),ym=U.Union([U.Literal(`in_progress`),U.Literal(`approved`),U.Literal(`denied`),U.Literal(`timed_out`),U.Literal(`aborted`)]),bm=U.Object({detail:U.String(),type:U.Union([U.Literal(`command`),U.Literal(`file_change`),U.Literal(`network_access`),U.Literal(`mcp_tool_call`),U.Literal(`permissions`)])},{additionalProperties:!1}),xm=U.Object({action:bm,id:U.String({minLength:1}),rationale:U.Optional(U.String()),riskLevel:U.Optional(U.Union([U.Literal(`low`),U.Literal(`medium`),U.Literal(`high`),U.Literal(`critical`)])),status:ym,targetItemId:U.Optional(U.String({minLength:1})),type:U.Literal(`approval_review`),userAuthorization:U.Optional(U.Union([U.Literal(`unknown`),U.Literal(`low`),U.Literal(`medium`),U.Literal(`high`)]))},{additionalProperties:!1}),Sm=U.Union([U.Object({type:U.Literal(`uncommitted_changes`)},{additionalProperties:!1}),U.Object({branch:U.String({minLength:1}),type:U.Literal(`base_branch`)},{additionalProperties:!1}),U.Object({sha:U.String({minLength:1}),title:U.Optional(U.String({minLength:1})),type:U.Literal(`commit`)},{additionalProperties:!1}),U.Object({instructions:U.String({minLength:1}),type:U.Literal(`custom`)},{additionalProperties:!1})]),Cm=U.Object({id:U.String({minLength:1}),target:Sm,type:U.Literal(`review`)},{additionalProperties:!1}),wm=U.Union([qf,Jf,Xf,dm,fm,_m,vm,xm,Cm,gm]),Tm=U.Union([U.Literal(`running`),U.Literal(`completed`),U.Literal(`failed`),U.Literal(`interrupted`)]),Em=U.Object({completedAt:tf,error:U.Union([U.String(),U.Null()]),id:U.String({minLength:1}),items:U.Array(wm),startedAt:tf,status:Tm},{additionalProperties:!1}),Dm=U.Object({id:U.String({minLength:1}),kind:Vf,mediaType:Bf,name:U.String({maxLength:255,minLength:1}),size:U.Integer({maximum:Nf,minimum:1})},{additionalProperties:!1}),Om=U.Object({attachment:Dm},{additionalProperties:!1}),km=U.Union([U.Literal(`user`),U.Literal(`repo`),U.Literal(`system`),U.Literal(`admin`)]),Am=U.Object({description:U.String(),displayName:U.String({minLength:1}),id:U.String({minLength:1}),name:U.String({minLength:1}),scope:km},{additionalProperties:!1}),jm=U.Union([U.Literal(`starting`),U.Literal(`ready`),U.Literal(`failed`),U.Literal(`cancelled`)]),Mm=U.Union([U.Literal(`unknown`),U.Literal(`unsupported`),U.Literal(`notLoggedIn`),U.Literal(`bearerToken`),U.Literal(`oAuth`)]),Nm=U.Literal(`reauthenticationRequired`),Pm=U.Object({authStatus:U.Union([Mm,U.Null()]),description:U.Union([U.String(),U.Null()]),error:U.Union([U.String({maxLength:8192}),U.Null()]),failureReason:U.Union([Nm,U.Null()]),name:U.String({minLength:1}),status:jm,title:U.Union([U.String(),U.Null()]),toolCount:U.Integer({minimum:0}),version:U.Union([U.String(),U.Null()])},{additionalProperties:!1}),Fm=U.Object({data:U.Array(Pm,{uniqueItems:!0})},{additionalProperties:!1}),Im=U.Object({id:U.String({minLength:1}),name:U.String({minLength:1})},{additionalProperties:!1}),Lm=U.Object({id:U.String({minLength:1})},{additionalProperties:!1}),Rm={attachments:U.Array(Lm),skills:U.Array(Im),text:U.String({maxLength:1e5}),type:U.Literal(`prompt`)},zm=U.Union([U.Object({...Rm,text:U.String({maxLength:1e5,minLength:1})},{additionalProperties:!1}),U.Object({...Rm,attachments:U.Array(Lm,{minItems:1})},{additionalProperties:!1}),U.Object({...Rm,skills:U.Array(Im,{minItems:1})},{additionalProperties:!1})]),Bm=U.Union([U.Literal(`editing`),U.Literal(`queued`)]),Vm=U.Object({attachments:U.Array(Wf,{maxItems:Pf}),clientUserMessageId:U.String({minLength:1}),id:U.String({minLength:1}),skills:U.Array(Im),status:Bm,text:U.String({maxLength:1e5})},{additionalProperties:!1}),Hm=U.Object({data:U.Array(Vm),nextCursor:U.Union([U.String({minLength:1}),U.Null()])},{additionalProperties:!1}),Um=U.Union([U.Literal(`active`),U.Literal(`paused`),U.Literal(`blocked`),U.Literal(`usage_limited`),U.Literal(`budget_limited`),U.Literal(`complete`)]),Wm=U.Object({createdAt:ef,objective:U.String({maxLength:4e3,minLength:1}),status:Um,timeUsedSeconds:U.Integer({minimum:0}),tokenBudget:U.Union([U.Integer({minimum:0}),U.Null()]),tokensUsed:U.Integer({minimum:0}),updatedAt:ef},{additionalProperties:!1});U.Object({status:U.Union([U.Literal(`active`),U.Literal(`paused`)])},{additionalProperties:!1});var Gm=U.Object({goal:Wm},{additionalProperties:!1}),Km=U.Object({cleared:U.Boolean()},{additionalProperties:!1}),qm=`gpt-5.6-luna`,Jm=U.Object({mcp_elicitations:U.Boolean(),request_permissions:U.Boolean(),rules:U.Boolean(),sandbox_approval:U.Boolean(),skill_approval:U.Boolean()},{additionalProperties:!1}),Ym=U.Object({granular:Jm},{additionalProperties:!1}),Xm=U.Union([U.Literal(`on-request`),Ym,U.Literal(`never`)]),Zm=U.Union([U.Literal(`untrusted`),U.Literal(`on-request`),Ym,U.Literal(`never`)]),Qm=U.Union([U.Literal(`user`),U.Literal(`auto_review`)]),$m=U.Union([U.Literal(`read-only`),U.Literal(`workspace-write`),U.Literal(`danger-full-access`)]),eh={model:U.String({minLength:1}),reasoningEffort:U.String({minLength:1}),sandboxMode:$m},th=U.Object({approvalPolicy:Zm,approvalsReviewer:Qm,...eh},{additionalProperties:!1}),nh=U.Literal(`plan`),rh={commitMessageModel:U.String({minLength:1}),commitMessagePrompt:U.String({maxLength:4e3}),defaultOpenAppId:U.Union([U.Exclude(_f,U.Literal(`system-default`)),U.Null()]),fastMode:U.Boolean(),followUpBehavior:U.Union([U.Literal(`queue`),U.Literal(`steer`)]),pet:Fd,...eh},ih=U.Object({approvalPolicy:Xm,approvalsReviewer:Qm,...rh},{additionalProperties:!1}),ah=U.Object({settings:ih},{additionalProperties:!1}),oh=U.Object({approvalPolicy:Zm,approvalsReviewer:Qm,fastMode:U.Boolean(),...eh},{additionalProperties:!1}),sh=U.Object({settings:oh},{additionalProperties:!1}),ch=U.Object({settings:th},{additionalProperties:!1}),lh={collaborationMode:U.Optional(nh),fastMode:U.Optional(U.Literal(!0)),goalMode:U.Optional(U.Literal(!0)),...eh},uh=U.Object({approvalPolicy:Zm,approvalsReviewer:Qm,...lh},{additionalProperties:!1}),dh=U.Object({description:U.String(),id:U.String({minLength:1})},{additionalProperties:!1}),fh=U.Object({defaultReasoningEffort:U.String({minLength:1}),description:U.String(),displayName:U.String({minLength:1}),id:U.String({minLength:1}),isDefault:U.Boolean(),supportedReasoningEfforts:U.Array(dh,{minItems:1})},{additionalProperties:!1}),ph=U.Object({contextWindow:U.Union([U.Integer({minimum:1}),U.Null()]),usedTokens:U.Integer({minimum:0})},{additionalProperties:!1}),mh=`temporary`,hh=`/v1/temporary`,gh=U.Union([U.Literal(`pending`),U.Literal(`in_progress`),U.Literal(`completed`)]),_h=U.Object({status:gh,text:U.String({minLength:1})},{additionalProperties:!1}),vh=U.Object({explanation:U.Union([U.String(),U.Null()]),steps:U.Array(_h)},{additionalProperties:!1}),yh=U.Object({contextUsage:U.Union([ph,U.Null()]),goal:U.Union([Wm,U.Null()]),id:U.String({minLength:1}),plan:U.Union([vh,U.Null()]),pendingRequests:U.Array(jp),pinned:U.Boolean(),projectId:U.String({minLength:1}),settings:th,status:U.Union([U.Literal(`idle`),U.Literal(`running`),U.Literal(`failed`)]),title:U.String({minLength:1}),turns:U.Array(Em),turnsNextCursor:U.Union([U.String({minLength:1}),U.Null()]),updatedAt:ef},{additionalProperties:!1});function bh(e){return U.Object({data:U.Array(e),nextCursor:U.Union([U.String(),U.Null()])},{additionalProperties:!1})}var xh=bh(cf),Sh=xh,Ch=bh(Tf),wh=bh(fh),Th=bh(Am),Eh=U.Object({status:U.Literal(`ok`),version:U.Literal(1)},{additionalProperties:!1}),Dh=U.Object({feedback:U.Object({upload:U.Boolean()},{additionalProperties:!1}),goals:U.Object({clear:U.Boolean(),read:U.Boolean(),update:U.Boolean()},{additionalProperties:!1}),provider:U.String({minLength:1}),skills:U.Object({list:U.Boolean(),use:U.Boolean()},{additionalProperties:!1}),tasks:U.Object({fork:U.Boolean(),list:U.Boolean(),read:U.Boolean(),start:U.Boolean()},{additionalProperties:!1}),turns:U.Object({compact:U.Boolean(),interrupt:U.Boolean(),review:U.Boolean(),start:U.Boolean(),steer:U.Boolean()},{additionalProperties:!1})},{additionalProperties:!1}),Oh=U.Union([U.Literal(`official`),U.Literal(`custom`)]),kh=U.Union([U.Literal(`disconnected`),U.Literal(`pending`),U.Literal(`connected`),U.Literal(`failed`)]),Ah=U.Union([U.Object({email:U.Union([U.String({maxLength:320}),U.Null()]),planType:U.Union([U.String({maxLength:64}),U.Null()]),type:U.Literal(`chatgpt`)},{additionalProperties:!1}),U.Object({type:U.Literal(`apiKey`)},{additionalProperties:!1})]),jh=U.Object({error:U.Union([U.String({maxLength:1e3}),U.Null()]),loginId:U.String({maxLength:256,minLength:1}),state:U.Union([U.Literal(`pending`),U.Literal(`failed`)])},{additionalProperties:!1}),Mh=U.Object({account:U.Union([Ah,U.Null()]),customBaseUrl:U.Union([U.String({maxLength:2048,minLength:1}),U.Null()]),mode:Oh,pendingLogin:U.Union([jh,U.Null()]),state:kh},{additionalProperties:!1});U.Object({},{additionalProperties:!1});var Nh=U.Object({authUrl:U.String({maxLength:8192,minLength:1}),loginId:U.String({maxLength:256,minLength:1}),status:Mh},{additionalProperties:!1});U.Object({apiKey:U.Optional(U.String({maxLength:16384,minLength:1})),baseUrl:U.String({maxLength:2048,minLength:1}),models:U.Optional(U.Array(U.Object({id:U.String({maxLength:256,minLength:1,pattern:`.*\\S.*`}),name:U.String({maxLength:256,minLength:1,pattern:`.*\\S.*`})},{additionalProperties:!1}),{maxItems:1e3}))},{additionalProperties:!1});var Ph=U.Object({models:wh,status:Mh},{additionalProperties:!1});U.Object({loginId:U.String({maxLength:256,minLength:1})},{additionalProperties:!1});var Fh=U.Object({status:Mh},{additionalProperties:!1});U.Object({customBaseUrl:U.Union([U.String({maxLength:2048,minLength:1}),U.Null()]),customModels:U.Union([wh,U.Null()]),mode:Oh,updatedAt:ef},{additionalProperties:!1});function Ih(e){return e.mode===`official`&&e.state===`connected`&&e.account?.type===`chatgpt`}var Lh=U.Object({sequence:U.Integer({minimum:0}),sessionId:U.String({minLength:1})},{additionalProperties:!1});U.Object({},{additionalProperties:!1});var Rh=U.Object({task:Tf},{additionalProperties:!1});U.Object({pinned:U.Boolean()},{additionalProperties:!1});var zh=U.Object({task:Tf},{additionalProperties:!1});U.Object({title:U.String({maxLength:200,minLength:1,pattern:`\\S`})},{additionalProperties:!1});var Bh=U.Object({task:Tf},{additionalProperties:!1});U.Object({},{additionalProperties:!1});var Vh=U.Object({status:U.Literal(`archived`),taskId:U.String({minLength:1})},{additionalProperties:!1});U.Object({},{additionalProperties:!1});var Hh=U.Object({task:Tf},{additionalProperties:!1});U.Object({},{additionalProperties:!1});var Uh=U.Object({status:U.Literal(`deleted`),taskId:U.String({minLength:1})},{additionalProperties:!1}),Wh=U.Object({status:U.Union([U.Literal(`busy`),U.Literal(`notLoaded`),U.Literal(`notSubscribed`),U.Literal(`unsubscribed`)]),taskId:U.String({minLength:1})},{additionalProperties:!1});U.Object({target:Of},{additionalProperties:!1});var Gh=U.Object({taskId:U.String({minLength:1}),turn:Em},{additionalProperties:!1});U.Object({},{additionalProperties:!1});var Kh=U.Object({status:U.Literal(`compacting`),taskId:U.String({minLength:1})},{additionalProperties:!1});U.Object({lastTurnId:U.Optional(U.String({minLength:1}))},{additionalProperties:!1});var qh=U.Object({task:Tf},{additionalProperties:!1});U.Object({},{additionalProperties:!1});var Jh=Fm;U.Object({classification:U.String({maxLength:100,minLength:1}),includeLogs:U.Boolean(),reason:U.String({maxLength:4e3,minLength:1})},{additionalProperties:!1});var Yh=U.Object({status:U.Literal(`sent`),taskId:U.String({minLength:1})},{additionalProperties:!1});U.Object({input:zm,options:uh},{additionalProperties:!1});var Xh=U.Object({checkpoint:Lh,taskId:U.String({minLength:1}),turn:Em},{additionalProperties:!1});U.Object({input:zm,taskId:U.String({minLength:1})},{additionalProperties:!1});var Zh=U.Object({status:U.Literal(`accepted`),taskId:U.String({minLength:1}),turnId:U.String({minLength:1})},{additionalProperties:!1});U.Object({clientUserMessageId:U.String({minLength:1}),input:zm},{additionalProperties:!1});var Qh=U.Object({queuedSubmission:Vm},{additionalProperties:!1});U.Object({input:zm,status:U.Union([U.Literal(`editing`),U.Literal(`queued`)])},{additionalProperties:!1});var $h=Qh,eg=U.Object({deleted:U.Boolean()},{additionalProperties:!1});U.Object({queuedSubmissionIds:U.Array(U.String({minLength:1}),{uniqueItems:!0})},{additionalProperties:!1});var tg=U.Object({status:U.Literal(`reordered`)},{additionalProperties:!1});U.Object({queuedSubmissionId:U.Optional(U.String({minLength:1}))},{additionalProperties:!1});var ng=U.Object({taskId:U.String({minLength:1}),turn:Em},{additionalProperties:!1});U.Object({taskId:U.String({minLength:1})},{additionalProperties:!1});var rg=U.Object({status:U.Literal(`interrupting`),taskId:U.String({minLength:1}),turnId:U.String({minLength:1})},{additionalProperties:!1}),ig=U.Union([U.Literal(`ACCESS_DENIED`),U.Literal(`IDEMPOTENCY_KEY_REQUIRED`),U.Literal(`IDEMPOTENCY_CONFLICT`),U.Literal(`IDEMPOTENCY_CAPACITY_EXCEEDED`),U.Literal(`INVALID_REQUEST`),U.Literal(`PROJECT_NOT_FOUND`),U.Literal(`PROJECT_FILE_NOT_FOUND`),U.Literal(`PROJECT_FILE_CONFLICT`),U.Literal(`PROJECT_FILE_MUTATION_FAILED`),U.Literal(`TASK_NOT_FOUND`),U.Literal(`TURN_NOT_FOUND`),U.Literal(`TURN_NOT_RUNNING`),U.Literal(`ATTACHMENT_NOT_FOUND`),U.Literal(`PENDING_REQUEST_NOT_FOUND`),U.Literal(`PENDING_REQUEST_EXPIRED`),U.Literal(`PENDING_REQUEST_ALREADY_RESOLVED`),U.Literal(`PENDING_REQUEST_MISMATCH`),U.Literal(`PAIRING_FAILED`),U.Literal(`PAIRING_RATE_LIMITED`),U.Literal(`GIT_STATUS_CHANGED`),U.Literal(`GIT_REPOSITORY_UNAVAILABLE`),U.Literal(`GIT_PATH_UNAVAILABLE`),U.Literal(`GIT_COMMIT_FAILED`),U.Literal(`GIT_BRANCH_ALREADY_ACTIVE`),U.Literal(`GIT_BRANCH_ALREADY_EXISTS`),U.Literal(`GIT_BRANCH_CREATE_FAILED`),U.Literal(`GIT_BRANCH_INVALID`),U.Literal(`GIT_BRANCH_NOT_FOUND`),U.Literal(`GIT_BRANCH_SWITCH_FAILED`),U.Literal(`GIT_WORKTREE_ALREADY_ACTIVE`),U.Literal(`GIT_WORKTREE_CREATE_FAILED`),U.Literal(`GIT_WORKTREE_NOT_FOUND`),U.Literal(`GIT_MUTATION_IN_PROGRESS`),U.Literal(`GIT_REPOSITORY_READ_ONLY`),U.Literal(`COMMIT_MESSAGE_GENERATION_FAILED`),U.Literal(`UPDATE_NOT_AVAILABLE`),U.Literal(`UPDATE_CHECK_FAILED`),U.Literal(`UPDATE_INSTALL_FAILED`),U.Literal(`PET_NOT_FOUND`),U.Literal(`PET_ASSET_INVALID`),U.Literal(`PET_DOWNLOAD_FAILED`),U.Literal(`PROVIDER_ERROR`)]),ag=U.Object({code:ig,message:U.String({minLength:1}),retryable:U.Boolean()},{additionalProperties:!1}),og=U.String({minLength:1}),sg=U.Integer({minimum:0}),cg=U.String({format:`date-time`}),lg={originalByteLength:U.Integer({minimum:0}),truncated:U.Boolean()},ug={provider:U.String({minLength:1}),sequence:sg,sessionId:og,taskId:U.String({minLength:1}),timestamp:cg,version:U.Literal(2)};function G(e){return U.Object({...ug,...e},{additionalProperties:!1})}var dg=G({payload:U.Object({turn:Em},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`turn.started`)}),fg=G({itemId:U.String({minLength:1}),payload:U.Object({delta:U.String()},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`message.delta`)}),pg=G({itemId:U.String({minLength:1}),payload:U.Object({delta:U.String(),field:U.Union([U.Literal(`content`),U.Literal(`summary`)]),sectionIndex:U.Optional(U.Integer({minimum:0}))},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`reasoning.delta`)}),mg=G({itemId:U.String({minLength:1}),payload:U.Object({delta:U.String()},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`plan.delta`)}),hg=G({itemId:U.String({minLength:1}),payload:U.Object({message:U.String({maxLength:8192})},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`tool.progress`)}),gg=G({itemId:U.String({minLength:1}),payload:U.Object({changes:U.Array(Rp,{maxItems:100}),...lg},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`file_change.updated`)}),_g=G({payload:U.Object({code:U.Union([U.Literal(`runtime_warning`),U.Literal(`guardian_warning`),U.Literal(`strict_review_required`),U.Literal(`model_verification`),U.Literal(`hook_status`)]),level:U.Union([U.Literal(`info`),U.Literal(`warning`)]),message:U.String({maxLength:8192,minLength:1})},{additionalProperties:!1}),type:U.Literal(`task.notice`)}),vg=G({payload:U.Object({error:U.Union([U.String({maxLength:8192}),U.Null()]),failureReason:U.Union([Nm,U.Null()]),name:U.String({minLength:1}),status:jm},{additionalProperties:!1}),type:U.Literal(`mcp_server.status_updated`)}),yg=G({payload:U.Object({status:U.Union([U.Literal(`idle`),U.Literal(`running`),U.Literal(`failed`)])},{additionalProperties:!1}),type:U.Literal(`task.status_updated`)}),bg=G({payload:U.Object({},{additionalProperties:!1}),type:U.Literal(`task.metadata_changed`)}),xg=G({payload:U.Object({reason:U.Union([U.Literal(`archived`),U.Literal(`deleted`)])},{additionalProperties:!1}),type:U.Literal(`task.removed`)}),Sg=G({payload:U.Object({},{additionalProperties:!1}),type:U.Literal(`skills.changed`)}),Cg=G({payload:U.Object({},{additionalProperties:!1}),type:U.Literal(`queue.changed`)}),wg=G({payload:U.Object({rootPath:U.String({minLength:1})},{additionalProperties:!1}),type:U.Literal(`project.git_metadata_changed`)}),Tg=G({itemId:U.String({minLength:1}),payload:U.Object({delta:U.String()},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`command.output_delta`)}),Eg=G({itemId:U.String({minLength:1}),payload:U.Object({item:wm},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`item.completed`)}),Dg=G({itemId:U.String({minLength:1}),payload:U.Object({item:wm},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`item.started`)}),Og=G({payload:U.Object({turn:Em},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`turn.completed`)}),kg=G({payload:U.Object({code:U.Optional(U.Union([U.Literal(`context_window_exceeded`),U.Literal(`session_budget_exceeded`),U.Literal(`usage_limit_exceeded`),U.Literal(`server_overloaded`),U.Literal(`policy_blocked`),U.Literal(`connection_failed`),U.Literal(`internal_error`),U.Literal(`unauthorized`),U.Literal(`bad_request`),U.Literal(`sandbox_error`),U.Literal(`other`)])),httpStatusCode:U.Optional(U.Integer({maximum:599,minimum:100})),message:U.String({minLength:1}),willRetry:U.Boolean()},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`provider.error`)}),Ag=G({payload:U.Object({usage:ph},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`usage.updated`)}),jg=G({payload:U.Object({plan:vh},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`plan.updated`)}),Mg=G({payload:U.Object({goal:Wm},{additionalProperties:!1}),type:U.Literal(`goal.updated`)}),Ng=G({payload:U.Object({},{additionalProperties:!1}),type:U.Literal(`goal.cleared`)});function Pg(e,t){return G({itemId:U.String({minLength:1}),payload:U.Object({request:t},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(e)})}var Fg=Pg(`pending_request.created`,jp),Ig=Pg(`pending_request.resolved`,Mp),Lg=Pg(`pending_request.expired`,Np),Rg=U.Union([dg,fg,pg,Tg,mg,hg,gg,Dg,Eg,Og,Ag,jg,Mg,Ng,kg,_g,vg,yg,bg,xg,Sg,Cg,wg,Fg,Ig,Lg]),zg=U.Object({events:U.Array(Rg,{maxItems:64,minItems:1}),type:U.Literal(`events.batch`),version:U.Literal(3)},{additionalProperties:!1}),Bg=U.Object({latestSequence:sg,sessionId:og,type:U.Literal(`connection.ready`),version:U.Literal(3)},{additionalProperties:!1}),Vg=U.Object({latestSequence:sg,reason:U.Union([U.Literal(`event_retention_exceeded`),U.Literal(`session_changed`),U.Literal(`sequence_gap`)]),sessionId:og,type:U.Literal(`resync.required`),version:U.Literal(3)},{additionalProperties:!1}),Hg=U.Union([Bg,Vg,zg]),Ug=U.Object({checkpoint:Lh,snapshot:yh},{additionalProperties:!1}),Wg=class extends gn{constructor(e){super(`Unable to dereference schema with $id '${e.$ref}'`),this.schema=e}};function Gg(e,t){let n=t.find(t=>t.$id===e.$ref);if(n===void 0)throw new Wg(e);return qg(n,t)}function Kg(e,t){return!on(e.$id)||t.some(t=>t.$id===e.$id)||t.push(e),t}function qg(e,t){return e[C]===`This`||e[C]===`Ref`?Gg(e,t):e}var Jg=class extends gn{constructor(e){super(`Unable to hash value`),this.value=e}},Yg;(function(e){e[e.Undefined=0]=`Undefined`,e[e.Null=1]=`Null`,e[e.Boolean=2]=`Boolean`,e[e.Number=3]=`Number`,e[e.String=4]=`String`,e[e.Object=5]=`Object`,e[e.Array=6]=`Array`,e[e.Date=7]=`Date`,e[e.Uint8Array=8]=`Uint8Array`,e[e.Symbol=9]=`Symbol`,e[e.BigInt=10]=`BigInt`})(Yg||={});var Xg=BigInt(`14695981039346656037`),[Zg,Qg]=[BigInt(`1099511628211`),BigInt(`18446744073709551616`)],$g=Array.from({length:256}).map((e,t)=>BigInt(t)),e_=new Float64Array(1),t_=new DataView(e_.buffer),n_=new Uint8Array(e_.buffer);function*r_(e){let t=e===0?1:Math.ceil(Math.floor(Math.log2(e)+1)/8);for(let n=0;n<t;n++)yield e>>8*(t-1-n)&255}function i_(e){K(Yg.Array);for(let t of e)h_(t)}function a_(e){K(Yg.Boolean),K(+!!e)}function o_(e){K(Yg.BigInt),t_.setBigInt64(0,e);for(let e of n_)K(e)}function s_(e){K(Yg.Date),h_(e.getTime())}function c_(e){K(Yg.Null)}function l_(e){K(Yg.Number),t_.setFloat64(0,e);for(let e of n_)K(e)}function u_(e){K(Yg.Object);for(let t of globalThis.Object.getOwnPropertyNames(e).sort())h_(t),h_(e[t])}function d_(e){K(Yg.String);for(let t=0;t<e.length;t++)for(let n of r_(e.charCodeAt(t)))K(n)}function f_(e){K(Yg.Symbol),h_(e.description)}function p_(e){K(Yg.Uint8Array);for(let t=0;t<e.length;t++)K(e[t])}function m_(e){return K(Yg.Undefined)}function h_(e){if(Qt(e))return i_(e);if(tn(e))return a_(e);if(an(e))return o_(e);if(Yt(e))return s_(e);if(en(e))return c_(e);if(nn(e))return l_(e);if(Zt(e))return u_(e);if(on(e))return d_(e);if(cn(e))return f_(e);if(Xt(e))return p_(e);if($t(e))return m_(e);throw new Jg(e)}function K(e){Xg^=$g[e],Xg=Xg*Zg%Qg}function g_(e){return Xg=BigInt(`14695981039346656037`),h_(e),Xg}var __=class extends gn{constructor(e){super(`Unknown type`),this.schema=e}};function v_(e){return e[C]===`Any`||e[C]===`Unknown`}function q(e){return e!==void 0}function y_(e,t,n){return!0}function b_(e,t,n){return!0}function x_(e,t,n){if(!Qt(n)||q(e.minItems)&&!(n.length>=e.minItems)||q(e.maxItems)&&!(n.length<=e.maxItems))return!1;for(let r of n)if(!J(e.items,t,r))return!1;if(e.uniqueItems===!0&&!(function(){let e=new Set;for(let t of n){let n=g_(t);if(e.has(n))return!1;e.add(n)}return!0})())return!1;if(!(q(e.contains)||nn(e.minContains)||nn(e.maxContains)))return!0;let r=q(e.contains)?e.contains:N(),i=n.reduce((e,n)=>J(r,t,n)?e+1:e,0);return!(i===0||nn(e.minContains)&&i<e.minContains||nn(e.maxContains)&&i>e.maxContains)}function S_(e,t,n){return Kt(n)}function C_(e,t,n){return!(!an(n)||q(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)||q(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)||q(e.maximum)&&!(n<=e.maximum)||q(e.minimum)&&!(n>=e.minimum)||q(e.multipleOf)&&n%e.multipleOf!==BigInt(0))}function w_(e,t,n){return tn(n)}function T_(e,t,n){return J(e.returns,t,n.prototype)}function E_(e,t,n){return!(!Yt(n)||q(e.exclusiveMaximumTimestamp)&&!(n.getTime()<e.exclusiveMaximumTimestamp)||q(e.exclusiveMinimumTimestamp)&&!(n.getTime()>e.exclusiveMinimumTimestamp)||q(e.maximumTimestamp)&&!(n.getTime()<=e.maximumTimestamp)||q(e.minimumTimestamp)&&!(n.getTime()>=e.minimumTimestamp)||q(e.multipleOfTimestamp)&&n.getTime()%e.multipleOfTimestamp!==0)}function D_(e,t,n){return sn(n)}function O_(e,t,n){let r=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];return J(i,[...t,...r],n)}function k_(e,t,n){return!(!rn(n)||q(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)||q(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)||q(e.maximum)&&!(n<=e.maximum)||q(e.minimum)&&!(n>=e.minimum)||q(e.multipleOf)&&n%e.multipleOf!==0)}function A_(e,t,n){let r=e.allOf.every(e=>J(e,t,n));if(e.unevaluatedProperties===!1){let t=new RegExp(Yo(e)),i=Object.getOwnPropertyNames(n).every(e=>t.test(e));return r&&i}else if(sr(e.unevaluatedProperties)){let i=new RegExp(Yo(e)),a=Object.getOwnPropertyNames(n).every(r=>i.test(r)||J(e.unevaluatedProperties,t,n[r]));return r&&a}else return r}function j_(e,t,n){return qt(n)}function M_(e,t,n){return n===e.const}function N_(e,t,n){return!1}function P_(e,t,n){return!J(e.not,t,n)}function F_(e,t,n){return en(n)}function I_(e,t,n){return!(!ln.IsNumberLike(n)||q(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)||q(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)||q(e.minimum)&&!(n>=e.minimum)||q(e.maximum)&&!(n<=e.maximum)||q(e.multipleOf)&&n%e.multipleOf!==0)}function L_(e,t,n){if(!ln.IsObjectLike(n)||q(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)||q(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties))return!1;let r=Object.getOwnPropertyNames(e.properties);for(let i of r){let r=e.properties[i];if(e.required&&e.required.includes(i)){if(!J(r,t,n[i])||(Uc(r)||v_(r))&&!(i in n))return!1}else if(ln.IsExactOptionalProperty(n,i)&&!J(r,t,n[i]))return!1}if(e.additionalProperties===!1){let t=Object.getOwnPropertyNames(n);return e.required&&e.required.length===r.length&&t.length===r.length?!0:t.every(e=>r.includes(e))}else if(typeof e.additionalProperties==`object`)return Object.getOwnPropertyNames(n).every(i=>r.includes(i)||J(e.additionalProperties,t,n[i]));else return!0}function R_(e,t,n){return Jt(n)}function z_(e,t,n){if(!ln.IsRecordLike(n)||q(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)||q(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties))return!1;let[r,i]=Object.entries(e.patternProperties)[0],a=new RegExp(r),o=Object.entries(n).every(([e,n])=>!a.test(e)||J(i,t,n)),s=typeof e.additionalProperties!=`object`||Object.entries(n).every(([n,r])=>a.test(n)?!0:J(e.additionalProperties,t,r)),c=e.additionalProperties!==!1||Object.getOwnPropertyNames(n).every(e=>a.test(e));return o&&s&&c}function B_(e,t,n){return J(qg(e,t),t,n)}function V_(e,t,n){let r=new RegExp(e.source,e.flags);return q(e.minLength)&&!(n.length>=e.minLength)||q(e.maxLength)&&!(n.length<=e.maxLength)?!1:r.test(n)}function H_(e,t,n){return!on(n)||q(e.minLength)&&!(n.length>=e.minLength)||q(e.maxLength)&&!(n.length<=e.maxLength)||q(e.pattern)&&!new RegExp(e.pattern).test(n)?!1:q(e.format)?pi(e.format)?hi(e.format)(n):!1:!0}function U_(e,t,n){return cn(n)}function W_(e,t,n){return on(n)&&new RegExp(e.pattern).test(n)}function G_(e,t,n){return J(qg(e,t),t,n)}function K_(e,t,n){if(!Qt(n)||e.items===void 0&&n.length!==0||n.length!==e.maxItems)return!1;if(!e.items)return!0;for(let r=0;r<e.items.length;r++)if(!J(e.items[r],t,n[r]))return!1;return!0}function q_(e,t,n){return $t(n)}function J_(e,t,n){return e.anyOf.some(e=>J(e,t,n))}function Y_(e,t,n){return!(!Xt(n)||q(e.maxByteLength)&&!(n.length<=e.maxByteLength)||q(e.minByteLength)&&!(n.length>=e.minByteLength))}function X_(e,t,n){return!0}function Z_(e,t,n){return ln.IsVoidLike(n)}function Q_(e,t,n){return _i(e[C])?vi(e[C])(e,n):!1}function J(e,t,n){let r=q(e.$id)?Kg(e,t):t,i=e;switch(i[C]){case`Any`:return y_(i,r,n);case`Argument`:return b_(i,r,n);case`Array`:return x_(i,r,n);case`AsyncIterator`:return S_(i,r,n);case`BigInt`:return C_(i,r,n);case`Boolean`:return w_(i,r,n);case`Constructor`:return T_(i,r,n);case`Date`:return E_(i,r,n);case`Function`:return D_(i,r,n);case`Import`:return O_(i,r,n);case`Integer`:return k_(i,r,n);case`Intersect`:return A_(i,r,n);case`Iterator`:return j_(i,r,n);case`Literal`:return M_(i,r,n);case`Never`:return N_(i,r,n);case`Not`:return P_(i,r,n);case`Null`:return F_(i,r,n);case`Number`:return I_(i,r,n);case`Object`:return L_(i,r,n);case`Promise`:return R_(i,r,n);case`Record`:return z_(i,r,n);case`Ref`:return B_(i,r,n);case`RegExp`:return V_(i,r,n);case`String`:return H_(i,r,n);case`Symbol`:return U_(i,r,n);case`TemplateLiteral`:return W_(i,r,n);case`This`:return G_(i,r,n);case`Tuple`:return K_(i,r,n);case`Undefined`:return q_(i,r,n);case`Union`:return J_(i,r,n);case`Uint8Array`:return Y_(i,r,n);case`Unknown`:return X_(i,r,n);case`Void`:return Z_(i,r,n);default:if(!_i(i[C]))throw new __(i);return Q_(i,r,n)}}function $_(...e){return e.length===3?J(e[0],e[1],e[2]):J(e[0],[],e[1])}var ev=class extends Error{constructor(e,t){super(e,t),this.name=`CodexlyEventError`}};function tv(e,t,n){let r=t===`temporary`?`${hh}/events`:`/v1/projects/${encodeURIComponent(t)}/events`,i=e?new URL(`${e}${r}`):new URL(r,globalThis.location.href);return i.protocol=i.protocol===`https:`?`wss:`:`ws:`,i.searchParams.set(`afterSequence`,String(n)),i.toString()}function nv(e,t,n){return{latestSequence:t,reason:n,sessionId:e,type:`resync.required`,version:3}}function rv(e){let t=e.reconnectDelayMs??250,n=!0,r=!0,i=e.afterSequence,a=0,o,s,c,l=t=>{e.onConnectionState?.(t)},u=(e,t)=>{let n=s;n!==void 0&&(c?.(),c=void 0,s=void 0,n.close(e,t))},d=t=>{r=!1,e.onResyncRequired(t),u(1e3,`Snapshot resync required`),l(`closed`)},f=(t,n)=>{r=!1,e.onError?.(new ev(t,n===void 0?void 0:{cause:n})),u(1002,`Invalid Agent Event frame`),l(`closed`)},p=()=>{if(!n)return;o=void 0;let u=!1,m=e.webSocketFactory(tv(e.baseUrl,e.projectId,i));s=m;let ee=()=>n&&s===m,te=t=>{if(!ee())return;let n;try{n=JSON.parse(String(t.data))}catch(e){f(`Codexly event frame is not valid JSON`,e);return}if(!$_(Hg,n)){f(`Codexly event frame does not match the protocol schema`);return}let r=n;if(r.type===`resync.required`){d(r);return}if(r.type===`connection.ready`){if(r.sessionId!==e.sessionId||r.latestSequence<i){d(nv(r.sessionId,r.latestSequence,`session_changed`));return}u=!0,a=0,l(`connected`);return}if(!u){f(`Codexly event arrived before connection.ready`);return}for(let t of r.events){if(t.sessionId!==e.sessionId){d(nv(t.sessionId,t.sequence,`session_changed`));return}if(!(t.sequence<=i)){if(t.sequence!==i+1){d(nv(t.sessionId,t.sequence,`sequence_gap`));return}if(i=t.sequence,e.onEvent(t),!ee())return}}},ne=()=>{!n||s!==m||e.onError?.(new ev(`Codexly event connection failed`))},h=()=>{if(s!==m||(c?.(),c=void 0,s=void 0,!n))return;if(!r){l(`closed`);return}l(`reconnecting`);let e=Math.min(t*2**a,5e3);a+=1,o=setTimeout(p,e)};c=()=>{m.removeEventListener(`message`,te),m.removeEventListener(`error`,ne),m.removeEventListener(`close`,h)},m.addEventListener(`message`,te),m.addEventListener(`error`,ne),m.addEventListener(`close`,h)};return l(`connecting`),p(),()=>{n&&(n=!1,r=!1,o!==void 0&&clearTimeout(o),u(1e3,`Subscription cancelled`),l(`closed`))}}var Y=[];for(let e=0;e<256;++e)Y.push((e+256).toString(16).slice(1));function iv(e,t=0){return(Y[e[t+0]]+Y[e[t+1]]+Y[e[t+2]]+Y[e[t+3]]+`-`+Y[e[t+4]]+Y[e[t+5]]+`-`+Y[e[t+6]]+Y[e[t+7]]+`-`+Y[e[t+8]]+Y[e[t+9]]+`-`+Y[e[t+10]]+Y[e[t+11]]+Y[e[t+12]]+Y[e[t+13]]+Y[e[t+14]]+Y[e[t+15]]).toLowerCase()}var av=new Uint8Array(16);function ov(){return crypto.getRandomValues(av)}function sv(e,t,n){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():cv(e,t,n)}function cv(e,t,n){e||={};let r=e.random??e.rng?.()??ov();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return iv(r)}var lv=15e4,uv=class extends Error{status;constructor(e,t,n){super(n??`Codexly request failed with ${String(e)} ${t}`.trim()),this.name=`CodexlyHttpError`,this.status=e}},dv=class extends uv{code;retryable;constructor(e,t,n){super(e,t,n.message),this.name=`CodexlyMutationError`,this.code=n.code,this.retryable=n.retryable}},fv=class extends Error{constructor(e,t){super(e,t),this.name=`CodexlyResponseError`}};function X(e,t){let n=new URLSearchParams;for(let[e,r]of Object.entries(t))r!==void 0&&n.set(e,String(r));let r=n.toString();return r?`${e}?${r}`:e}function Z(e){return e===`temporary`?hh:`/v1/projects/${encodeURIComponent(e)}`}function Q(e,t){return`${Z(e)}/tasks/${encodeURIComponent(t)}`}function pv(e,t,n,r){return`${e.replace(/\/$/u,``)}${Q(t,n)}/attachments/${encodeURIComponent(r)}`}function mv(e,t,n,r){let i=X(`${Z(t)}/files/image`,{path:n,rootPath:r});return`${e.replace(/\/$/u,``)}${i}`}function hv(e,t,n){return`${e.replace(/\/$/u,``)}${Z(t)}/attachments/${encodeURIComponent(n)}`}function gv(e,t=``){return`${t.replace(/\/$/u,``)}/v1/pets/assets/${encodeURIComponent(e)}`}var _v=class{baseUrl;fetchImplementation;requestTimeouts;webSocketFactory;unauthorizedListeners=new Set;constructor(e={}){this.baseUrl=e.baseUrl?.replace(/\/$/u,``)??``,this.fetchImplementation=e.fetch??globalThis.fetch.bind(globalThis),this.requestTimeouts={mutationMs:e.requestTimeouts?.mutationMs??6e4,queryMs:e.requestTimeouts?.queryMs??3e4,readMs:e.requestTimeouts?.readMs??15e3},this.webSocketFactory=e.webSocketFactory??(e=>new WebSocket(e))}async getHealth(e={}){return this.read(`/v1/health`,Eh,e)}async getAppInfo(e={}){return this.read(`/v1/app-info`,Wd,e)}async installAppUpdate(e,t={}){return this.mutation(`/v1/app-update`,{version:e},Gd,t,`POST`,lv)}async getAccessStatus(e={}){return this.read(`/v1/access`,qd,e)}async pairAccess(e){return this.request(`/v1/access/pair`,qd,{body:JSON.stringify({code:e}),headers:{"content-type":`application/json`},method:`POST`},ag,{timeoutMs:this.requestTimeouts.mutationMs})}async logoutAccess(){return this.request(`/v1/access/logout`,qd,{body:`{}`,headers:{"content-type":`application/json`},method:`POST`},ag,{timeoutMs:this.requestTimeouts.mutationMs})}subscribeUnauthorized(e){return this.unauthorizedListeners.add(e),()=>this.unauthorizedListeners.delete(e)}async getCapabilities(e={}){return this.read(`/v1/capabilities`,Dh,e)}async listModels(e={}){return this.read(`/v1/models`,wh,e)}async getProviderConnection(e={}){return this.read(`/v1/provider-connection`,Mh,e)}async startOfficialProviderLogin(e={}){return this.mutation(`/v1/provider-connection/official-login`,{},Nh,e)}async cancelProviderLogin(e,t={}){return this.mutation(`/v1/provider-connection/official-login/cancel`,{loginId:e},Fh,t)}async configureCustomProvider(e,t={}){return this.mutation(`/v1/provider-connection/custom`,e,Ph,t,`PUT`)}async logoutProvider(e={}){return this.mutation(`/v1/provider-connection/logout`,{},Fh,e)}async getGlobalSettings(e={}){return this.read(`/v1/settings`,ah,e)}async listWorkbenchPets(e={}){return this.read(`/v1/pets`,Bd,e)}async downloadWorkbenchPet(e,t={}){return this.mutation(`/v1/pets/downloads`,{petId:e},Vd,t)}async updateGlobalSettings(e,t={}){return this.mutation(`/v1/settings`,e,ah,t,`PUT`)}subscribeEvents(e){return rv({...e,baseUrl:this.baseUrl,webSocketFactory:this.webSocketFactory})}mutation(e,t,n,r,i=`POST`,a=this.requestTimeouts.mutationMs){return this.request(e,n,{body:JSON.stringify(t),headers:{"content-type":`application/json`,"idempotency-key":r.idempotencyKey??sv()},method:i},ag,{...r.signal===void 0?{}:{signal:r.signal},timeoutMs:a})}read(e,t,n,r){return this.request(e,t,{},r,{...n.signal===void 0?{}:{signal:n.signal},timeoutMs:n.signal===void 0?this.requestTimeouts.readMs:this.requestTimeouts.queryMs})}async request(e,t,n={},r,i={}){let a=AbortSignal.timeout(i.timeoutMs??this.requestTimeouts.readMs),o=i.signal===void 0?a:AbortSignal.any([i.signal,a]),s=await this.fetchImplementation(`${this.baseUrl}${e}`,{...n,credentials:`same-origin`,headers:{accept:`application/json`,...n.headers},signal:o});if(!s.ok){if(s.status===401)for(let e of this.unauthorizedListeners)try{e()}catch{}if(r!==void 0){let e;try{e=await s.json()}catch(e){throw new fv(`Codexly error response is not valid JSON`,{cause:e})}throw $_(r,e)?new dv(s.status,s.statusText,e):new fv(`Codexly error response does not match the protocol schema`)}try{let e=await s.json();if(typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`&&e.message.length>0)throw new uv(s.status,s.statusText,e.message)}catch(e){if(e instanceof uv)throw e}throw new uv(s.status,s.statusText)}let c;try{c=await s.json()}catch(e){throw new fv(`Codexly response is not valid JSON`,{cause:e})}if(!$_(t,c))throw new fv(`Codexly response does not match the protocol schema`);return c}},vv=class extends _v{async listSkills(e,t={}){return this.read(`${Z(e)}/skills`,Th,t)}async listMcpServers(e,t,n={}){return this.read(`${Q(e,t)}/mcp-servers`,Fm,n,ag)}async retryMcpServers(e,t,n={}){return this.mutation(`${Q(e,t)}/mcp-servers/retry`,{},Jh,n)}async listProjects(e={}){return this.read(`/v1/projects`,xh,e)}async listProjectDirectories(e,t={}){return this.read(X(`/v1/project-directories`,{path:e,includeHidden:t.includeHidden===!0?`true`:void 0}),ff,t)}async listHostFiles(e,t,n={}){return this.read(X(`/v1/host-files`,{kind:e,path:t,includeHidden:n.includeHidden===!0?`true`:void 0}),hf,n)}async reorderProjects(e,t={}){return this.mutation(`/v1/projects/order`,{projectIds:e},Sh,t,`PUT`)}async getProjectDefaults(e,t={}){return this.read(`${Z(e)}/defaults`,sh,t)}async updateProjectDefaults(e,t,n={}){return this.mutation(`${Z(e)}/defaults`,t,sh,n,`PUT`)}async addProject(e,t={}){return this.mutation(`/v1/projects`,{roots:e.map(e=>({path:e}))},gf,t)}async renameProject(e,t,n={}){return this.mutation(`${Z(e)}/rename`,{name:t},Cf,n)}async removeProject(e,t={}){return this.mutation(`${Z(e)}/remove`,{},wf,t)}async getProjectOpenCapabilities(e,t={}){return this.read(`${Z(e)}/open-capabilities`,xf,t)}async openProject(e,t,n,r={}){return this.mutation(X(`${Z(e)}/open`,{rootPath:t}),n,Sf,r)}async getProjectGitStatus(e,t,n={}){return this.read(X(`/v1/projects/${encodeURIComponent(e)}/git/status`,{includeDiff:t.includeDiff===!0?`true`:void 0,repository:t.repository,rootPath:t.rootPath}),Gp,n)}async getProjectGitHistory(e,t,n={}){return this.read(X(`${Z(e)}/git/history`,{cursor:t.cursor,repository:t.repository,rootPath:t.rootPath}),Jp,n)}async getProjectGitCommitFiles(e,t,n={}){return this.read(X(`${Z(e)}/git/commit-files`,{cursor:t.cursor,repository:t.repository,rootPath:t.rootPath,sha:t.sha}),Qp,n)}async getProjectGitCommitFileDiff(e,t,n={}){return this.read(X(`${Z(e)}/git/commit-diff`,{path:t.path,repository:t.repository,rootPath:t.rootPath,sha:t.sha}),$p,n)}async switchProjectBranch(e,t,n,r={}){return this.mutation(X(`${Z(e)}/git/branch`,{rootPath:t}),n,Gp,r)}async createProjectBranch(e,t,n,r={}){return this.mutation(X(`${Z(e)}/git/branches`,{rootPath:t}),n,Gp,r)}async listProjectWorktrees(e,t,n={}){return this.read(X(`${Z(e)}/git/worktrees`,{rootPath:t}),tm,n)}async createProjectWorktree(e,t,n,r={}){return this.mutation(X(`${Z(e)}/git/worktrees`,{rootPath:t}),n,nm,r)}async switchProjectWorktree(e,t,n,r={}){return this.mutation(X(`${Z(e)}/git/worktree`,{rootPath:t}),n,nm,r)}async generateCommitMessage(e,t,n,r={}){return this.mutation(X(`${Z(e)}/git/commit-message`,{rootPath:t}),n,rm,r)}async commitProjectChanges(e,t,n,r={}){return this.mutation(X(`${Z(e)}/git/commits`,{rootPath:t}),n,im,r)}async listProjectFiles(e,t,n,r={}){let i=X(`/v1/projects/${encodeURIComponent(e)}/files/tree`,{path:n??void 0,rootPath:t});return this.read(i,om,r)}async renameProjectFile(e,t,n,r={}){return this.mutation(X(`/v1/projects/${encodeURIComponent(e)}/files/rename`,{rootPath:t}),n,cm,r)}async deleteProjectFile(e,t,n,r={}){return this.mutation(X(`/v1/projects/${encodeURIComponent(e)}/files/delete`,{rootPath:t}),n,lm,r)}async searchProjectFiles(e,t,n,r,i={}){let a=X(`/v1/projects/${encodeURIComponent(e)}/files/search`,{query:n,rootPath:t,sessionId:r});return this.read(a,af,i)}async stopProjectFileSearch(e,t,n,r={}){return this.mutation(`/v1/projects/${encodeURIComponent(e)}/files/search/stop`,{rootPath:t,sessionId:n},of,r)}async readProjectSourceFile(e,t,n,r,i={}){let a=X(`${Z(e)}/files/source`,{cursor:r,path:n,rootPath:t});return this.read(a,um,i)}},yv=class extends vv{async archiveTask(e,t,n={}){return this.mutation(`${Q(e,t)}/archive`,{},Vh,n)}async unarchiveTask(e,t,n={}){return this.mutation(`${Q(e,t)}/unarchive`,{},Hh,n)}async deleteTask(e,t,n={}){return this.mutation(Q(e,t),{},Uh,n,`DELETE`)}},bv=class extends yv{async updateTaskGoal(e,t,n,r={}){return this.mutation(`${Q(e,t)}/goal`,n,Gm,r,`PUT`)}async clearTaskGoal(e,t,n={}){return this.mutation(`${Q(e,t)}/goal`,{},Km,n,`DELETE`)}},xv=class extends bv{async listQueuedSubmissions(e,t,n={},r={}){return this.read(X(`${Q(e,t)}/queue`,n),Hm,r)}async addQueuedSubmission(e,t,n,r,i={}){return this.mutation(`${Q(e,t)}/queue`,{clientUserMessageId:r,input:n},Qh,i)}async updateQueuedSubmission(e,t,n,r,i,a={}){return this.mutation(`${Q(e,t)}/queue/${encodeURIComponent(n)}`,{input:r,status:i},$h,a,`PUT`)}async deleteQueuedSubmission(e,t,n,r={}){return this.mutation(`${Q(e,t)}/queue/${encodeURIComponent(n)}`,{},eg,r,`DELETE`)}async reorderQueuedSubmissions(e,t,n,r={}){return this.mutation(`${Q(e,t)}/queue/reorder`,{queuedSubmissionIds:n},tg,r,`PUT`)}async startQueuedSubmission(e,t,n,r={}){return this.mutation(`${Q(e,t)}/queue/start`,{...n===void 0?{}:{queuedSubmissionId:n}},ng,r)}async listTasks(e,t={},n={}){let r=X(`${Z(e)}/tasks`,t);return this.read(r,Ch,n)}async readTask(e,t,n={}){let{cursor:r,...i}=n;return this.read(X(Q(e,t),{cursor:r}),Ug,i)}getTaskAttachmentUrl(e,t,n){return pv(this.baseUrl,e,t,n)}async openTaskAttachment(e,t,n,r={}){return this.mutation(`${Q(e,t)}/attachments/${encodeURIComponent(n)}/open`,{},Gf,r)}async listBackgroundTerminals(e,t,n={}){return this.read(`${Q(e,t)}/background-terminals`,Qf,n)}async terminateBackgroundTerminal(e,t,n,r={}){return this.mutation(`${Q(e,t)}/background-terminals/${encodeURIComponent(n)}/terminate`,{},$f,r)}async getTaskSettings(e,t,n={}){return this.read(`${Q(e,t)}/settings`,ch,n)}async updateTaskSettings(e,t,n,r={}){return this.mutation(`${Q(e,t)}/settings`,n,ch,r,`PUT`)}async startTask(e,t={}){return this.mutation(`${Z(e)}/tasks`,{},Rh,t)}async pinTask(e,t,n,r={}){return this.mutation(`${Q(e,t)}/pin`,{pinned:n},zh,r,`PUT`)}async renameTask(e,t,n,r={}){return this.mutation(`${Q(e,t)}/rename`,{title:n},Bh,r)}async unsubscribeTask(e,t){return this.request(`${Q(e,t)}/unsubscribe`,Wh,{body:`{}`,headers:{"content-type":`application/json`},method:`POST`})}async startReview(e,t,n,r={}){return this.mutation(`${Q(e,t)}/review`,n,Gh,r)}async compactTask(e,t,n={}){return this.mutation(`${Q(e,t)}/compact`,{},Kh,n)}async forkTask(e,t,n,r={}){return this.mutation(`${Q(e,t)}/fork`,n,qh,r)}async uploadFeedback(e,t,n,r={}){return this.mutation(`${Q(e,t)}/feedback`,n,Yh,r)}async uploadAttachment(e,t,n={}){let r=new FormData;return r.set(`attachment`,t.content,t.name),this.request(`${Z(e)}/attachments/${t.kind}`,Om,{body:r,headers:{"idempotency-key":n.idempotencyKey??sv()},method:`POST`},ag,{...n.signal===void 0?{}:{signal:n.signal},timeoutMs:this.requestTimeouts.mutationMs})}async importHostAttachment(e,t,n,r={}){return this.mutation(`${Z(e)}/attachments/${t}/host`,{path:n},Om,r)}async startTurn(e,t,n,r,i={}){return this.mutation(`${Q(e,t)}/turns`,{input:n,options:r},Xh,i)}async steerTurn(e,t,n,r,i={}){return this.mutation(`${Q(e,t)}/turns/${encodeURIComponent(n)}/steer`,{input:r,taskId:t},Zh,i)}async interruptTurn(e,t,n,r={}){return this.mutation(`${Q(e,t)}/turns/${encodeURIComponent(n)}/interrupt`,{taskId:t},rg,r)}async resolvePendingRequest(e,t,n={}){let r={itemId:e.itemId,projectId:e.projectId,resolution:t,taskId:e.taskId,turnId:e.turnId,type:e.type};return this.mutation(`${Q(e.projectId,e.taskId)}/pending-requests/${encodeURIComponent(e.requestId)}/resolve`,r,Lp,n)}},Sv=class extends xv{},Cv=`pinned`,wv=`search-source`,Tv=3e4;function Ev(e,t){return[`projects`,e,`tasks`,t,`queue`]}var Dv=new Sv,Ov=Object.defineProperty,kv=(e,t)=>Ov(e,`name`,{value:t,configurable:!0}),Av=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),jv=g.forwardRef(kv(function(e,t){return(0,_.jsx)(d.span,{...e,ref:t,style:{...Av,...e.style}})},`VisuallyHidden`)),Mv=Object.defineProperty,$=(e,t)=>Mv(e,`name`,{value:t,configurable:!0}),[Nv,Pv]=c(`Tooltip`,[ee]),Fv=ee(),Iv=`TooltipProvider`,Lv=700,Rv=`tooltip.open`,[zv,Bv]=Nv(Iv),Vv=$(e=>{let{__scopeTooltip:t,delayDuration:n=Lv,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=g.useRef(!0),s=g.useRef(!1),c=g.useRef(0);return g.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,_.jsx)(zv,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:g.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:g.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:g.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})},`TooltipProvider`),Hv=`Tooltip`,[Uv,Wv]=Nv(Hv),Gv=$(e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Bv(Hv,e.__scopeTooltip),l=Fv(t),[d,f]=g.useState(null),[m,ee]=g.useState(void 0),ne=u(),h=g.useRef(0),re=o??c.disableHoverableContent,ie=s??c.delayDuration,ae=g.useRef(!1),[oe,se]=te({prop:r,defaultProp:i??!1,onChange:$(e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Rv))):c.onClose(),a?.(e)},`onChange`),caller:Hv}),ce=g.useMemo(()=>oe?ae.current?`delayed-open`:`instant-open`:`closed`,[oe]),le=g.useCallback(()=>{window.clearTimeout(h.current),h.current=0,ae.current=!1,se(!0)},[se]),ue=g.useCallback(()=>{window.clearTimeout(h.current),h.current=0,se(!1)},[se]),de=g.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{ae.current=!0,se(!0),h.current=0},ie)},[ie,se]);g.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]);let fe=m??ne;return(0,_.jsx)(p,{...l,children:(0,_.jsx)(Uv,{scope:t,contentId:fe,setContentId:ee,open:oe,stateAttribute:ce,trigger:d,onTriggerChange:f,onTriggerEnter:g.useCallback(()=>{c.isOpenDelayedRef.current?de():le()},[c.isOpenDelayedRef,de,le]),onTriggerLeave:g.useCallback(()=>{re?ue():(window.clearTimeout(h.current),h.current=0)},[ue,re]),onOpen:le,onClose:ue,disableHoverableContent:re,children:n})})},`Tooltip`),Kv=`TooltipTrigger`,qv=g.forwardRef($(function(e,t){let{__scopeTooltip:n,...r}=e,o=Wv(Kv,n),s=Bv(Kv,n),c=Fv(n),u=i(t,g.useRef(null),o.onTriggerChange),f=g.useRef(!1),p=g.useRef(!1),m=g.useCallback(()=>f.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener(`pointerup`,m),[m]),(0,_.jsx)(l,{asChild:!0,...c,children:(0,_.jsx)(d.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:u,onPointerMove:a(e.onPointerMove,e=>{e.pointerType!==`touch`&&!p.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),p.current=!0)}),onPointerLeave:a(e.onPointerLeave,()=>{o.onTriggerLeave(),p.current=!1}),onPointerDown:a(e.onPointerDown,()=>{o.open&&o.onClose(),f.current=!0,document.addEventListener(`pointerup`,m,{once:!0})}),onFocus:a(e.onFocus,()=>{f.current||o.onOpen()}),onBlur:a(e.onBlur,o.onClose),onClick:a(e.onClick,o.onClose)})})},`TooltipTrigger`)),Jv=`TooltipPortal`,[Yv,Xv]=Nv(Jv,{forceMount:void 0}),Zv=$(e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Wv(Jv,t);return(0,_.jsx)(Yv,{scope:t,forceMount:n,children:(0,_.jsx)(f,{present:n||a.open,children:(0,_.jsx)(m,{asChild:!0,container:i,children:r})})})},`TooltipPortal`),Qv=`TooltipContent`,$v=g.forwardRef($(function(e,t){let n=Xv(Qv,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Wv(Qv,e.__scopeTooltip);return(0,_.jsx)(f,{present:r||o.open,children:o.disableHoverableContent?(0,_.jsx)(ny,{side:i,...a,ref:t}):(0,_.jsx)(ey,{side:i,...a,ref:t})})},`TooltipContent`)),ey=g.forwardRef($(function(e,t){let n=Wv(Qv,e.__scopeTooltip),r=Bv(Qv,e.__scopeTooltip),a=g.useRef(null),o=i(t,a),[s,c]=g.useState(null),{trigger:l,onClose:u}=n,d=a.current,{onPointerInTransitChange:f}=r,p=g.useCallback(()=>{c(null),f(!1)},[f]),m=g.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=iy(r,ry(r,n.getBoundingClientRect())),a=ay(t.getBoundingClientRect()),o=sy([...i,...a]);c(o),f(!0)},[f]);return g.useEffect(()=>()=>p(),[p]),g.useEffect(()=>{if(l&&d){let e=$(e=>m(e,d),`handleTriggerLeave`),t=$(e=>m(e,l),`handleContentLeave`);return l.addEventListener(`pointerleave`,e),d.addEventListener(`pointerleave`,t),()=>{l.removeEventListener(`pointerleave`,e),d.removeEventListener(`pointerleave`,t)}}},[l,d,m,p]),g.useEffect(()=>{if(s){let e=$(e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=l?.contains(t)||d?.contains(t),i=!oy(n,s);r?p():i&&(p(),u())},`handleTrackPointerGrace`);return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[l,d,s,u,p]),(0,_.jsx)(ny,{...e,ref:o})},`TooltipContentHoverable`)),ty=h(`TooltipContent`),ny=g.forwardRef($(function(e,t){let{__scopeTooltip:n,children:r,"aria-label":i,id:a,onEscapeKeyDown:c,onPointerDownOutside:l,...u}=e,d=Wv(Qv,n),f=Fv(n),{onClose:p}=d;g.useEffect(()=>(document.addEventListener(Rv,p),()=>document.removeEventListener(Rv,p)),[p]),g.useEffect(()=>{if(d.trigger){let e=$(e=>{e.target instanceof Node&&e.target.contains(d.trigger)&&p()},`handleScroll`);return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[d.trigger,p]);let{setContentId:m}=d;return ne(()=>(m(a),()=>{m(void 0)}),[a,m]),(0,_.jsx)(s,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:p,children:(0,_.jsxs)(o,{"data-state":d.stateAttribute,role:i?void 0:`tooltip`,id:i?void 0:d.contentId,...f,...u,ref:t,style:{...u.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,_.jsx)(ty,{children:r}),i?(0,_.jsx)(jv,{id:d.contentId,role:`tooltip`,children:i}):null]})})},`TooltipContentImpl`));function ry(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}$(ry,`getExitSideFromRect`);function iy(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}$(iy,`getPaddedExitPoints`);function ay(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}$(ay,`getPointsFromRect`);function oy(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}$(oy,`isPointInPolygon`);function sy(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),cy(t)}$(sy,`getHull`);function cy(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}$(cy,`getHullPresorted`);var ly=Vv,uy=Gv,dy=qv,fy=Zv,py=$v;function my({delayDuration:e=350,disableHoverableContent:t=!0,skipDelayDuration:n=150,...r}){return(0,_.jsx)(ly,{"data-slot":`tooltip-provider`,delayDuration:e,disableHoverableContent:t,skipDelayDuration:n,...r})}function hy(e){return(0,_.jsx)(uy,{"data-slot":`tooltip`,...e})}function gy(e){return(0,_.jsx)(dy,{"data-slot":`tooltip-trigger`,...e})}function _y({children:e,className:t,collisionPadding:n=8,sideOffset:r=8,...i}){return(0,_.jsx)(fy,{children:(0,_.jsx)(py,{className:re(`pointer-events-none z-50 w-fit max-w-[min(20rem,calc(100vw-1rem))] whitespace-normal rounded-control bg-foreground px-2 py-1 text-meta text-raised shadow-floating`,t),collisionPadding:n,"data-slot":`tooltip-content`,sideOffset:r,...i,children:e})})}export{ue as $,Ct as A,Qe as B,jf as C,Tt as D,Et as E,gt as F,Ve as G,Ze as H,pt as I,ye as J,Be as K,dt as L,_t as M,yt as N,wt as O,vt as P,ge as Q,ut as R,Af as S,Uf as T,Ke as U,Xe as V,Ge as W,ke as X,ve as Y,_e as Z,mh as _,Av as a,Me as at,If as b,Tv as c,hv as d,be as et,mv as f,Ih as g,sv as h,gy as i,Pe as it,St as j,bt as k,Dv as l,gv as m,_y as n,me as nt,Cv as o,ae as ot,pv as p,de as q,my as r,Ce as rt,wv as s,ie as st,hy as t,Se as tt,Ev as u,qm as v,Mf as w,kf as x,zf as y,nt as z};
1
+ import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{i as n,t as r}from"./react-runtime-CVaUQXZF.js";import{S as i,_ as a,a as o,d as s,g as c,i as l,l as u,m as d,n as f,o as p,r as m,s as ee,t as te,u as ne,x as h,y as re}from"./dist-hozmU7_C.js";var ie=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ae=new class extends ie{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},oe={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},se=new class{#e=oe;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function ce(e){setTimeout(e,0)}var le=typeof window>`u`||`Deno`in globalThis;function ue(){}function de(e,t){return typeof e==`function`?e(t):e}function fe(e){return typeof e==`number`&&e>=0&&e!==1/0}function pe(e,t){return Math.max(e+(t||0)-Date.now(),0)}function me(e,t){return typeof e==`function`?e(t):e}function he(e,t){return typeof e==`function`?e(t):e}function ge(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==ve(o,t.options))return!1}else if(!be(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function _e(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(ye(t.options.mutationKey)!==ye(a))return!1}else if(!be(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function ve(e,t){return(t?.queryKeyHashFn||ye)(e)}function ye(e){return JSON.stringify(e,(e,t)=>Te(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function be(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!be(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!be(e[r],t[r]))return!1;return!0}return!1}var xe=Object.prototype.hasOwnProperty;function Se(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=we(e)&&we(t);if(!r&&!(Te(e)&&Te(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:xe.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Se(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function Ce(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function we(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Te(e){if(!Ee(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Ee(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Ee(e){return Object.prototype.toString.call(e)===`[object Object]`}function De(e){return new Promise(t=>{se.setTimeout(t,e)})}function Oe(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Se(e,t)}function ke(e){return e}function Ae(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function je(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Me=Symbol();function Ne(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Me?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Pe(e,t){return typeof e==`function`?e(...t):!!e}function Fe(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var Ie=(()=>{let e=()=>le;return{isServer(){return e()},setIsServer(t){e=t}}})();function Le(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var Re=ce;function ze(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Re,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var Be=ze(),Ve=new class extends ie{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function He(e){return Math.min(1e3*2**e,3e4)}function Ue(e){return(e??`online`)!==`online`||Ve.isOnline()}var We=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Ge(e){let t=!1,n=0,r,i=Le(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new We(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>ae.isFocused()&&(e.networkMode===`always`||Ve.isOnline())&&e.canRun(),u=()=>Ue(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(Ie.isServer()?0:3),o=e.retryDelay??He,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),De(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var Ke=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),fe(this.gcTime)&&(this.#e=se.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ie.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(se.clearTimeout(this.#e),this.#e=void 0)}};function qe(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Fe(e,()=>t.signal,()=>n=!0)},u=Ne(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?je:Ae;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Ye:Je,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Je(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Je(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Ye(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Xe(e,t){return t?Je(e,t)!=null:!1}function Ze(e,t){return!t||!e.getPreviousPageParam?!1:Ye(e,t)!=null}var Qe=class extends Ke{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=tt(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=tt(this.options);e.data!==void 0&&(this.setState(et(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Oe(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(ue).catch(ue):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>he(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Me||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>me(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!pe(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=Ne(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?qe(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=Ge({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof We&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof We){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...$e(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...et(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),Be.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function $e(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ue(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function et(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function tt(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var nt=class extends ie{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=Le(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),it(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return at(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return at(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof he(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Ce(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&ot(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||he(this.options.enabled,this.#t)!==he(t.enabled,this.#t)||me(this.options.staleTime,this.#t)!==me(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||he(this.options.enabled,this.#t)!==he(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return ct(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(ue)),t}#g(){this.#b();let e=me(this.options.staleTime,this.#t);if(Ie.isServer()||this.#r.isStale||!fe(e))return;let t=pe(this.#r.dataUpdatedAt,e)+1;this.#d=se.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(Ie.isServer()||he(this.options.enabled,this.#t)===!1||!fe(this.#p)||this.#p===0)&&(this.#f=se.setInterval(()=>{(this.options.refetchIntervalInBackground||ae.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(se.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(se.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&it(e,t),o=i&&ot(e,n,t,r);(a||o)&&(l={...l,...$e(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let ee=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,ee=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=Oe(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!ee)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=Oe(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let te=l.fetchStatus===`fetching`,ne=m===`pending`,h=m===`error`,re=ne&&te,ie=d!==void 0,ae={status:m,fetchStatus:l.fetchStatus,isPending:ne,isSuccess:m===`success`,isError:h,isInitialLoading:re,isLoading:re,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:te,isRefetching:te&&!ne,isLoadingError:h&&!ie,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:h&&ie,isStale:st(e,t),refetch:this.refetch,promise:this.#o,isEnabled:he(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=ae.data!==void 0,r=ae.status===`error`&&!t,i=e=>{r?e.reject(ae.error):t&&e.resolve(ae.data)},a=()=>{let e=this.#o=ae.promise=Le();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||ae.data!==o.value)&&a();break;case`rejected`:(!r||ae.error!==o.reason)&&a();break}}return ae}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!Ce(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){Be.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function rt(e,t){return he(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&he(t.retryOnMount,e)===!1)}function it(e,t){return rt(e,t)||e.state.data!==void 0&&at(e,t,t.refetchOnMount)}function at(e,t,n){if(he(t.enabled,e)!==!1&&me(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&st(e,t)}return!1}function ot(e,t,n,r){return(e!==t||he(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&st(e,n)}function st(e,t){return he(t.enabled,e)!==!1&&e.isStaleByTime(me(t.staleTime,e))}function ct(e,t){return!Ce(e.getCurrentResult(),t)}var g=t(n(),1),_=r(),lt=g.createContext(void 0),ut=e=>{let t=g.useContext(lt);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},dt=({client:e,children:t})=>(g.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,_.jsx)(lt.Provider,{value:e,children:t})),ft=g.createContext(!1),pt=()=>g.useContext(ft);ft.Provider;function mt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ht=g.createContext(mt()),gt=()=>g.useContext(ht),_t=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Pe(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},vt=e=>{g.useEffect(()=>{e.clearReset()},[e])},yt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Pe(n,[e.error,r])),bt=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},xt=(e,t)=>e.isLoading&&e.isFetching&&!t,St=(e,t)=>e?.suspense&&t.isPending,Ct=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function wt(e,t,n){let r=pt(),i=gt(),a=ut(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,bt(o),_t(o,i,s),vt(i);let l=!a.getQueryCache().get(o.queryHash),[u]=g.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(g.useSyncExternalStore(g.useCallback(e=>{let t=f?u.subscribe(Be.batchCalls(e)):ue;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),g.useEffect(()=>{u.setOptions(o)},[o,u]),St(o,d))throw Ct(o,u,i);if(yt({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!Ie.isServer()&&xt(d,r)&&(l?Ct(o,u,i):s?.promise)?.catch(ue).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function Tt(e){return e}function Et(e){return e}function Dt(e){return y(e)&&!v(e)&&!Lt(e)&&Symbol.asyncIterator in e}function v(e){return Array.isArray(e)}function Ot(e){return typeof e==`bigint`}function kt(e){return typeof e==`boolean`}function At(e){return e instanceof globalThis.Date}function jt(e){return typeof e==`function`}function Mt(e){return y(e)&&!v(e)&&!Lt(e)&&Symbol.iterator in e}function Nt(e){return e===null}function Pt(e){return typeof e==`number`}function y(e){return typeof e==`object`&&!!e}function Ft(e){return e instanceof globalThis.RegExp}function b(e){return typeof e==`string`}function It(e){return typeof e==`symbol`}function Lt(e){return e instanceof globalThis.Uint8Array}function x(e){return e===void 0}function Rt(e){return e.map(e=>Ut(e))}function zt(e){return new Date(e.getTime())}function Bt(e){return new Uint8Array(e)}function Vt(e){return new RegExp(e.source,e.flags)}function Ht(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=Ut(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=Ut(e[n]);return t}function Ut(e){return v(e)?Rt(e):At(e)?zt(e):Lt(e)?Bt(e):Ft(e)?Vt(e):y(e)?Ht(e):e}function Wt(e){return Ut(e)}function Gt(e,t){return Wt(t===void 0?e:{...t,...e})}function Kt(e){return Zt(e)&&globalThis.Symbol.asyncIterator in e}function qt(e){return Zt(e)&&globalThis.Symbol.iterator in e}function Jt(e){return e instanceof globalThis.Promise}function Yt(e){return e instanceof Date&&globalThis.Number.isFinite(e.getTime())}function Xt(e){return e instanceof globalThis.Uint8Array}function Zt(e){return typeof e==`object`&&!!e}function Qt(e){return globalThis.Array.isArray(e)&&!globalThis.ArrayBuffer.isView(e)}function $t(e){return e===void 0}function en(e){return e===null}function tn(e){return typeof e==`boolean`}function nn(e){return typeof e==`number`}function rn(e){return globalThis.Number.isInteger(e)}function an(e){return typeof e==`bigint`}function on(e){return typeof e==`string`}function sn(e){return typeof e==`function`}function cn(e){return typeof e==`symbol`}var ln;(function(e){e.InstanceMode=`default`,e.ExactOptionalPropertyTypes=!1,e.AllowArrayObject=!1,e.AllowNaN=!1,e.AllowNullVoid=!1;function t(t,n){return e.ExactOptionalPropertyTypes?n in t:t[n]!==void 0}e.IsExactOptionalProperty=t;function n(t){let n=Zt(t);return e.AllowArrayObject?n:n&&!Qt(t)}e.IsObjectLike=n;function r(e){return n(e)&&!(e instanceof Date)&&!(e instanceof Uint8Array)}e.IsRecordLike=r;function i(t){return e.AllowNaN?nn(t):Number.isFinite(t)}e.IsNumberLike=i;function a(t){let n=$t(t);return e.AllowNullVoid?n||t===null:n}e.IsVoidLike=a})(ln||={});function un(e){return globalThis.Object.freeze(e).map(e=>hn(e))}function dn(e){return e}function fn(e){return e}function pn(e){return e}function mn(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=hn(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=hn(e[n]);return globalThis.Object.freeze(t)}function hn(e){return v(e)?un(e):At(e)?dn(e):Lt(e)?fn(e):Ft(e)?pn(e):y(e)?mn(e):e}function S(e,t){let n=t===void 0?e:{...t,...e};switch(ln.InstanceMode){case`freeze`:return hn(n);case`clone`:return Wt(n);default:return n}}var gn=class extends Error{constructor(e){super(e)}},_n=Symbol.for(`TypeBox.Transform`),vn=Symbol.for(`TypeBox.Readonly`),yn=Symbol.for(`TypeBox.Optional`),bn=Symbol.for(`TypeBox.Hint`),C=Symbol.for(`TypeBox.Kind`);function xn(e){return y(e)&&e[vn]===`Readonly`}function Sn(e){return y(e)&&e[yn]===`Optional`}function Cn(e){return w(e,`Any`)}function wn(e){return w(e,`Argument`)}function Tn(e){return w(e,`Array`)}function En(e){return w(e,`AsyncIterator`)}function Dn(e){return w(e,`BigInt`)}function On(e){return w(e,`Boolean`)}function kn(e){return w(e,`Computed`)}function An(e){return w(e,`Constructor`)}function jn(e){return w(e,`Date`)}function Mn(e){return w(e,`Function`)}function Nn(e){return w(e,`Integer`)}function Pn(e){return w(e,`Intersect`)}function Fn(e){return w(e,`Iterator`)}function w(e,t){return y(e)&&C in e&&e[C]===t}function In(e){return kt(e)||Pt(e)||b(e)}function Ln(e){return w(e,`Literal`)}function Rn(e){return w(e,`MappedKey`)}function zn(e){return w(e,`MappedResult`)}function Bn(e){return w(e,`Never`)}function Vn(e){return w(e,`Not`)}function Hn(e){return w(e,`Null`)}function Un(e){return w(e,`Number`)}function Wn(e){return w(e,`Object`)}function Gn(e){return w(e,`Promise`)}function Kn(e){return w(e,`Record`)}function qn(e){return w(e,`Ref`)}function Jn(e){return w(e,`RegExp`)}function Yn(e){return w(e,`String`)}function Xn(e){return w(e,`Symbol`)}function Zn(e){return w(e,`TemplateLiteral`)}function Qn(e){return w(e,`This`)}function $n(e){return y(e)&&_n in e}function er(e){return w(e,`Tuple`)}function tr(e){return w(e,`Undefined`)}function T(e){return w(e,`Union`)}function nr(e){return w(e,`Uint8Array`)}function rr(e){return w(e,`Unknown`)}function ir(e){return w(e,`Unsafe`)}function ar(e){return w(e,`Void`)}function or(e){return y(e)&&C in e&&b(e[C])}function sr(e){return Cn(e)||wn(e)||Tn(e)||On(e)||Dn(e)||En(e)||kn(e)||An(e)||jn(e)||Mn(e)||Nn(e)||Pn(e)||Fn(e)||Ln(e)||Rn(e)||zn(e)||Bn(e)||Vn(e)||Hn(e)||Un(e)||Wn(e)||Gn(e)||Kn(e)||qn(e)||Jn(e)||Yn(e)||Xn(e)||Zn(e)||Qn(e)||er(e)||tr(e)||T(e)||nr(e)||rr(e)||ir(e)||ar(e)||or(e)}var cr=`Argument.Any.Array.AsyncIterator.BigInt.Boolean.Computed.Constructor.Date.Enum.Function.Integer.Intersect.Iterator.Literal.MappedKey.MappedResult.Not.Null.Number.Object.Promise.Record.Ref.RegExp.String.Symbol.TemplateLiteral.This.Tuple.Undefined.Union.Uint8Array.Unknown.Void`.split(`.`);function lr(e){try{return new RegExp(e),!0}catch{return!1}}function ur(e){if(!b(e))return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=7&&n<=13||n===27||n===127)return!1}return!0}function dr(e){return pr(e)||j(e)}function fr(e){return x(e)||Ot(e)}function E(e){return x(e)||Pt(e)}function pr(e){return x(e)||kt(e)}function D(e){return x(e)||b(e)}function mr(e){return x(e)||b(e)&&ur(e)&&lr(e)}function hr(e){return x(e)||b(e)&&ur(e)}function gr(e){return x(e)||j(e)}function _r(e){return y(e)&&e[yn]===`Optional`}function vr(e){return O(e,`Any`)&&D(e.$id)}function yr(e){return O(e,`Argument`)&&Pt(e.index)}function br(e){return O(e,`Array`)&&e.type===`array`&&D(e.$id)&&j(e.items)&&E(e.minItems)&&E(e.maxItems)&&pr(e.uniqueItems)&&gr(e.contains)&&E(e.minContains)&&E(e.maxContains)}function xr(e){return O(e,`AsyncIterator`)&&e.type===`AsyncIterator`&&D(e.$id)&&j(e.items)}function Sr(e){return O(e,`BigInt`)&&e.type===`bigint`&&D(e.$id)&&fr(e.exclusiveMaximum)&&fr(e.exclusiveMinimum)&&fr(e.maximum)&&fr(e.minimum)&&fr(e.multipleOf)}function Cr(e){return O(e,`Boolean`)&&e.type===`boolean`&&D(e.$id)}function wr(e){return O(e,`Computed`)&&b(e.target)&&v(e.parameters)&&e.parameters.every(e=>j(e))}function Tr(e){return O(e,`Constructor`)&&e.type===`Constructor`&&D(e.$id)&&v(e.parameters)&&e.parameters.every(e=>j(e))&&j(e.returns)}function Er(e){return O(e,`Date`)&&e.type===`Date`&&D(e.$id)&&E(e.exclusiveMaximumTimestamp)&&E(e.exclusiveMinimumTimestamp)&&E(e.maximumTimestamp)&&E(e.minimumTimestamp)&&E(e.multipleOfTimestamp)}function Dr(e){return O(e,`Function`)&&e.type===`Function`&&D(e.$id)&&v(e.parameters)&&e.parameters.every(e=>j(e))&&j(e.returns)}function Or(e){return O(e,`Integer`)&&e.type===`integer`&&D(e.$id)&&E(e.exclusiveMaximum)&&E(e.exclusiveMinimum)&&E(e.maximum)&&E(e.minimum)&&E(e.multipleOf)}function kr(e){return y(e)&&Object.entries(e).every(([e,t])=>ur(e)&&j(t))}function Ar(e){return O(e,`Intersect`)&&!(b(e.type)&&e.type!==`object`)&&v(e.allOf)&&e.allOf.every(e=>j(e)&&!Xr(e))&&D(e.type)&&(pr(e.unevaluatedProperties)||gr(e.unevaluatedProperties))&&D(e.$id)}function jr(e){return O(e,`Iterator`)&&e.type===`Iterator`&&D(e.$id)&&j(e.items)}function O(e,t){return y(e)&&C in e&&e[C]===t}function Mr(e){return Fr(e)&&b(e.const)}function Nr(e){return Fr(e)&&Pt(e.const)}function Pr(e){return Fr(e)&&kt(e.const)}function Fr(e){return O(e,`Literal`)&&D(e.$id)&&Ir(e.const)}function Ir(e){return kt(e)||Pt(e)||b(e)}function Lr(e){return O(e,`MappedKey`)&&v(e.keys)&&e.keys.every(e=>Pt(e)||b(e))}function Rr(e){return O(e,`MappedResult`)&&kr(e.properties)}function zr(e){return O(e,`Never`)&&y(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function Br(e){return O(e,`Not`)&&j(e.not)}function Vr(e){return O(e,`Null`)&&e.type===`null`&&D(e.$id)}function Hr(e){return O(e,`Number`)&&e.type===`number`&&D(e.$id)&&E(e.exclusiveMaximum)&&E(e.exclusiveMinimum)&&E(e.maximum)&&E(e.minimum)&&E(e.multipleOf)}function k(e){return O(e,`Object`)&&e.type===`object`&&D(e.$id)&&kr(e.properties)&&dr(e.additionalProperties)&&E(e.minProperties)&&E(e.maxProperties)}function Ur(e){return O(e,`Promise`)&&e.type===`Promise`&&D(e.$id)&&j(e.item)}function A(e){return O(e,`Record`)&&e.type===`object`&&D(e.$id)&&dr(e.additionalProperties)&&y(e.patternProperties)&&(e=>{let t=Object.getOwnPropertyNames(e.patternProperties);return t.length===1&&lr(t[0])&&y(e.patternProperties)&&j(e.patternProperties[t[0]])})(e)}function Wr(e){return O(e,`Ref`)&&D(e.$id)&&b(e.$ref)}function Gr(e){return O(e,`RegExp`)&&D(e.$id)&&b(e.source)&&b(e.flags)&&E(e.maxLength)&&E(e.minLength)}function Kr(e){return O(e,`String`)&&e.type===`string`&&D(e.$id)&&E(e.minLength)&&E(e.maxLength)&&mr(e.pattern)&&hr(e.format)}function qr(e){return O(e,`Symbol`)&&e.type===`symbol`&&D(e.$id)}function Jr(e){return O(e,`TemplateLiteral`)&&e.type===`string`&&b(e.pattern)&&e.pattern[0]===`^`&&e.pattern[e.pattern.length-1]===`$`}function Yr(e){return O(e,`This`)&&D(e.$id)&&b(e.$ref)}function Xr(e){return y(e)&&_n in e}function Zr(e){return O(e,`Tuple`)&&e.type===`array`&&D(e.$id)&&Pt(e.minItems)&&Pt(e.maxItems)&&e.minItems===e.maxItems&&(x(e.items)&&x(e.additionalItems)&&e.minItems===0||v(e.items)&&e.items.every(e=>j(e)))}function Qr(e){return O(e,`Undefined`)&&e.type===`undefined`&&D(e.$id)}function $r(e){return O(e,`Union`)&&D(e.$id)&&y(e)&&v(e.anyOf)&&e.anyOf.every(e=>j(e))}function ei(e){return O(e,`Uint8Array`)&&e.type===`Uint8Array`&&D(e.$id)&&E(e.minByteLength)&&E(e.maxByteLength)}function ti(e){return O(e,`Unknown`)&&D(e.$id)}function ni(e){return O(e,`Unsafe`)}function ri(e){return O(e,`Void`)&&e.type===`void`&&D(e.$id)}function ii(e){return y(e)&&C in e&&b(e[C])&&!cr.includes(e[C])}function j(e){return y(e)&&(vr(e)||yr(e)||br(e)||Cr(e)||Sr(e)||xr(e)||wr(e)||Tr(e)||Er(e)||Dr(e)||Or(e)||Ar(e)||jr(e)||Fr(e)||Lr(e)||Rr(e)||zr(e)||Br(e)||Vr(e)||Hr(e)||k(e)||Ur(e)||A(e)||Wr(e)||Gr(e)||Kr(e)||qr(e)||Jr(e)||Yr(e)||Zr(e)||Qr(e)||$r(e)||ei(e)||ti(e)||ni(e)||ri(e)||ii(e))}var ai=`(true|false)`,oi=`(0|[1-9][0-9]*)`,si=`(.*)`,ci=`(?!.*)`;`${ai}`;var li=`^${oi}$`,ui=`^${si}$`,di=`^${ci}$`,fi=new Map;function pi(e){return fi.has(e)}function mi(e,t){fi.set(e,t)}function hi(e){return fi.get(e)}var gi=new Map;function _i(e){return gi.has(e)}function vi(e){return gi.get(e)}function yi(e,t){return e.includes(t)}function bi(e){return[...new Set(e)]}function xi(e,t){return e.filter(e=>t.includes(e))}function Si(e,t){return e.reduce((e,t)=>xi(e,t),t)}function Ci(e){return e.length===1?e[0]:e.length>1?Si(e.slice(1),e[0]):[]}function wi(e){let t=[];for(let n of e)t.push(...n);return t}function Ti(e){return S({[C]:`Any`},e)}function Ei(e,t){return S({[C]:`Array`,type:`array`,items:e},t)}function Di(e){return S({[C]:`Argument`,index:e})}function Oi(e,t){return S({[C]:`AsyncIterator`,type:`AsyncIterator`,items:e},t)}function M(e,t,n){return S({[C]:`Computed`,target:e,parameters:t},n)}function ki(e,t){let{[t]:n,...r}=e;return r}function Ai(e,t){return t.reduce((e,t)=>ki(e,t),e)}function N(e){return S({[C]:`Never`,not:{}},e)}function P(e){return S({[C]:`MappedResult`,properties:e})}function ji(e,t,n){return S({[C]:`Constructor`,type:`Constructor`,parameters:e,returns:t},n)}function Mi(e,t,n){return S({[C]:`Function`,type:`Function`,parameters:e,returns:t},n)}function Ni(e,t){return S({[C]:`Union`,anyOf:e},t)}function Pi(e){return e.some(e=>Sn(e))}function Fi(e){return e.map(e=>Sn(e)?Ii(e):e)}function Ii(e){return Ai(e,[yn])}function Li(e,t){return Pi(e)?xo(Ni(Fi(e),t)):Ni(Fi(e),t)}function Ri(e,t){return e.length===1?S(e[0],t):e.length===0?N(t):Li(e,t)}function F(e,t){return e.length===0?N(t):e.length===1?S(e[0],t):Ni(e,t)}var zi=class extends gn{};function Bi(e){return e.replace(/\\\$/g,`$`).replace(/\\\*/g,`*`).replace(/\\\^/g,`^`).replace(/\\\|/g,`|`).replace(/\\\(/g,`(`).replace(/\\\)/g,`)`)}function Vi(e,t,n){return e[t]===n&&e.charCodeAt(t-1)!==92}function Hi(e,t){return Vi(e,t,`(`)}function Ui(e,t){return Vi(e,t,`)`)}function Wi(e,t){return Vi(e,t,`|`)}function Gi(e){if(!(Hi(e,0)&&Ui(e,e.length-1)))return!1;let t=0;for(let n=0;n<e.length;n++)if(Hi(e,n)&&(t+=1),Ui(e,n)&&--t,t===0&&n!==e.length-1)return!1;return!0}function Ki(e){return e.slice(1,e.length-1)}function qi(e){let t=0;for(let n=0;n<e.length;n++)if(Hi(e,n)&&(t+=1),Ui(e,n)&&--t,Wi(e,n)&&t===0)return!0;return!1}function Ji(e){for(let t=0;t<e.length;t++)if(Hi(e,t))return!0;return!1}function Yi(e){let[t,n]=[0,0],r=[];for(let i=0;i<e.length;i++)if(Hi(e,i)&&(t+=1),Ui(e,i)&&--t,Wi(e,i)&&t===0){let t=e.slice(n,i);t.length>0&&r.push(Zi(t)),n=i+1}let i=e.slice(n);return i.length>0&&r.push(Zi(i)),r.length===0?{type:`const`,const:``}:r.length===1?r[0]:{type:`or`,expr:r}}function Xi(e){function t(e,t){if(!Hi(e,t))throw new zi(`TemplateLiteralParser: Index must point to open parens`);let n=0;for(let r=t;r<e.length;r++)if(Hi(e,r)&&(n+=1),Ui(e,r)&&--n,n===0)return[t,r];throw new zi(`TemplateLiteralParser: Unclosed group parens in expression`)}function n(e,t){for(let n=t;n<e.length;n++)if(Hi(e,n))return[t,n];return[t,e.length]}let r=[];for(let i=0;i<e.length;i++)if(Hi(e,i)){let[n,a]=t(e,i),o=e.slice(n,a+1);r.push(Zi(o)),i=a}else{let[t,a]=n(e,i),o=e.slice(t,a);o.length>0&&r.push(Zi(o)),i=a-1}return r.length===0?{type:`const`,const:``}:r.length===1?r[0]:{type:`and`,expr:r}}function Zi(e){return Gi(e)?Zi(Ki(e)):qi(e)?Yi(e):Ji(e)?Xi(e):{type:`const`,const:Bi(e)}}function Qi(e){return Zi(e.slice(1,e.length-1))}var $i=class extends gn{};function ea(e){return e.type===`or`&&e.expr.length===2&&e.expr[0].type===`const`&&e.expr[0].const===`0`&&e.expr[1].type===`const`&&e.expr[1].const===`[1-9][0-9]*`}function ta(e){return e.type===`or`&&e.expr.length===2&&e.expr[0].type===`const`&&e.expr[0].const===`true`&&e.expr[1].type===`const`&&e.expr[1].const===`false`}function na(e){return e.type===`const`&&e.const===`.*`}function ra(e){return ea(e)||na(e)?!1:ta(e)?!0:e.type===`and`||e.type===`or`?e.expr.every(e=>ra(e)):e.type===`const`||(()=>{throw new $i(`Unknown expression type`)})()}function ia(e){return ra(Qi(e.pattern))}var aa=class extends gn{};function*oa(e){if(e.length===1)return yield*e[0];for(let t of e[0])for(let n of oa(e.slice(1)))yield`${t}${n}`}function*sa(e){return yield*oa(e.expr.map(e=>[...ua(e)]))}function*ca(e){for(let t of e.expr)yield*ua(t)}function*la(e){return yield e.const}function*ua(e){return e.type===`and`?yield*sa(e):e.type===`or`?yield*ca(e):e.type===`const`?yield*la(e):(()=>{throw new aa(`Unknown expression`)})()}function da(e){let t=Qi(e.pattern);return ra(t)?[...ua(t)]:[]}function I(e,t){return S({[C]:`Literal`,const:e,type:typeof e},t)}function fa(e){return S({[C]:`Boolean`,type:`boolean`},e)}function pa(e){return S({[C]:`BigInt`,type:`bigint`},e)}function ma(e){return S({[C]:`Number`,type:`number`},e)}function ha(e){return S({[C]:`String`,type:`string`},e)}function*ga(e){let t=e.trim().replace(/"|'/g,``);return t===`boolean`?yield fa():t===`number`?yield ma():t===`bigint`?yield pa():t===`string`?yield ha():yield(()=>{let e=t.split(`|`).map(e=>I(e.trim()));return e.length===0?N():e.length===1?e[0]:Ri(e)})()}function*_a(e){if(e[1]!==`{`)return yield*[I(`$`),...va(e.slice(1))];for(let t=2;t<e.length;t++)if(e[t]===`}`){let n=ga(e.slice(2,t)),r=va(e.slice(t+1));return yield*[...n,...r]}yield I(e)}function*va(e){for(let t=0;t<e.length;t++)if(e[t]===`$`)return yield*[I(e.slice(0,t)),..._a(e.slice(t))];yield I(e)}function ya(e){return[...va(e)]}var ba=class extends gn{};function xa(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Sa(e,t){return Zn(e)?e.pattern.slice(1,e.pattern.length-1):T(e)?`(${e.anyOf.map(e=>Sa(e,t)).join(`|`)})`:Un(e)||Nn(e)||Dn(e)?`${t}${oi}`:Yn(e)?`${t}${si}`:Ln(e)?`${t}${xa(e.const.toString())}`:On(e)?`${t}${ai}`:(()=>{throw new ba(`Unexpected Kind '${e[C]}'`)})()}function Ca(e){return`^${e.map(e=>Sa(e,``)).join(``)}\$`}function wa(e){return Ri(da(e).map(e=>I(e)))}function Ta(e,t){let n=b(e)?Ca(ya(e)):Ca(e);return S({[C]:`TemplateLiteral`,type:`string`,pattern:n},t)}function Ea(e){return da(e).map(e=>e.toString())}function Da(e){let t=[];for(let n of e)t.push(...ka(n));return t}function Oa(e){return[e.toString()]}function ka(e){return[...new Set(Zn(e)?Ea(e):T(e)?Da(e.anyOf):Ln(e)?Oa(e.const):Un(e)||Nn(e)?[`[number]`]:[])]}function Aa(e,t,n){let r={};for(let i of Object.getOwnPropertyNames(t))r[i]=Wa(e,ka(t[i]),n);return r}function ja(e,t,n){return Aa(e,t.properties,n)}function Ma(e,t,n){return P(ja(e,t,n))}function Na(e,t){return e.map(e=>Va(e,t))}function Pa(e){return e.filter(e=>!Bn(e))}function Fa(e,t){return Ao(Pa(Na(e,t)))}function Ia(e){return e.some(e=>Bn(e))?[]:e}function La(e,t){return Ri(Ia(Na(e,t)))}function Ra(e,t){return t in e?e[t]:t===`[number]`?Ri(e):N()}function za(e,t){return t===`[number]`?e:N()}function Ba(e,t){return t in e?e[t]:N()}function Va(e,t){return Pn(e)?Fa(e.allOf,t):T(e)?La(e.anyOf,t):er(e)?Ra(e.items??[],t):Tn(e)?za(e.items,t):Wn(e)?Ba(e.properties,t):N()}function Ha(e,t){return t.map(t=>Va(e,t))}function Ua(e,t){return Ri(Ha(e,t))}function Wa(e,t,n){if(qn(e)||qn(t)){if(!sr(e)||!sr(t))throw new gn(`Index types using Ref parameters require both Type and Key to be of TSchema`);return M(`Index`,[e,t])}return zn(t)?Ma(e,t,n):Rn(t)?Ja(e,t,n):S(sr(t)?Ua(e,ka(t)):Ua(e,t),n)}function Ga(e,t,n){return{[t]:Wa(e,[t],Wt(n))}}function Ka(e,t,n){return t.reduce((t,r)=>({...t,...Ga(e,r,n)}),{})}function qa(e,t,n){return Ka(e,t.keys,n)}function Ja(e,t,n){return P(qa(e,t,n))}function Ya(e,t){return S({[C]:`Iterator`,type:`Iterator`,items:e},t)}function Xa(e){return globalThis.Object.keys(e).filter(t=>!Sn(e[t]))}function Za(e,t){let n=Xa(e);return S(n.length>0?{[C]:`Object`,type:`object`,required:n,properties:e}:{[C]:`Object`,type:`object`,properties:e},t)}var L=Za;function Qa(e,t){return S({[C]:`Promise`,type:`Promise`,item:e},t)}function $a(e){return S(Ai(e,[vn]))}function eo(e){return S({...e,[vn]:`Readonly`})}function to(e,t){return t===!1?$a(e):eo(e)}function no(e,t){let n=t??!0;return zn(e)?ao(e,n):to(e,n)}function ro(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=no(e[r],t);return n}function io(e,t){return ro(e.properties,t)}function ao(e,t){return P(io(e,t))}function oo(e,t){return S(e.length>0?{[C]:`Tuple`,type:`array`,items:e,additionalItems:!1,minItems:e.length,maxItems:e.length}:{[C]:`Tuple`,type:`array`,minItems:e.length,maxItems:e.length},t)}function so(e,t){return e in t?ho(e,t[e]):P(t)}function co(e){return{[e]:I(e)}}function lo(e){let t={};for(let n of e)t[n]=I(n);return t}function uo(e,t){return yi(t,e)?co(e):lo(t)}function fo(e,t){return so(e,uo(e,t))}function po(e,t){return t.map(t=>ho(e,t))}function mo(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(t))n[r]=ho(e,t[r]);return n}function ho(e,t){let n={...t};return Sn(t)?xo(ho(e,Ai(t,[yn]))):xn(t)?no(ho(e,Ai(t,[vn]))):zn(t)?so(e,t.properties):Rn(t)?fo(e,t.keys):An(t)?ji(po(e,t.parameters),ho(e,t.returns),n):Mn(t)?Mi(po(e,t.parameters),ho(e,t.returns),n):En(t)?Oi(ho(e,t.items),n):Fn(t)?Ya(ho(e,t.items),n):Pn(t)?jo(po(e,t.allOf),n):T(t)?F(po(e,t.anyOf),n):er(t)?oo(po(e,t.items??[]),n):Wn(t)?L(mo(e,t.properties),n):Tn(t)?Ei(ho(e,t.items),n):Gn(t)?Qa(ho(e,t.item),n):t}function go(e,t){let n={};for(let r of e)n[r]=ho(r,t);return n}function _o(e,t,n){let r=sr(e)?ka(e):e;return L(go(r,t({[C]:`MappedKey`,keys:r})),n)}function vo(e){return S(Ai(e,[yn]))}function yo(e){return S({...e,[yn]:`Optional`})}function bo(e,t){return t===!1?vo(e):yo(e)}function xo(e,t){let n=t??!0;return zn(e)?wo(e,n):bo(e,n)}function So(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=xo(e[r],t);return n}function Co(e,t){return So(e.properties,t)}function wo(e,t){return P(Co(e,t))}function To(e,t={}){let n=e.every(e=>Wn(e)),r=sr(t.unevaluatedProperties)?{unevaluatedProperties:t.unevaluatedProperties}:{};return S(t.unevaluatedProperties===!1||sr(t.unevaluatedProperties)||n?{...r,[C]:`Intersect`,type:`object`,allOf:e}:{...r,[C]:`Intersect`,allOf:e},t)}function Eo(e){return e.every(e=>Sn(e))}function Do(e){return Ai(e,[yn])}function Oo(e){return e.map(e=>Sn(e)?Do(e):e)}function ko(e,t){return Eo(e)?xo(To(Oo(e),t)):To(Oo(e),t)}function Ao(e,t={}){if(e.length===1)return S(e[0],t);if(e.length===0)return N(t);if(e.some(e=>$n(e)))throw Error(`Cannot intersect transform types`);return ko(e,t)}function jo(e,t){if(e.length===1)return S(e[0],t);if(e.length===0)return N(t);if(e.some(e=>$n(e)))throw Error(`Cannot intersect transform types`);return To(e,t)}function Mo(...e){let[t,n]=typeof e[0]==`string`?[e[0],e[1]]:[e[0].$id,e[1]];if(typeof t!=`string`)throw new gn(`Ref: $ref must be a string`);return S({[C]:`Ref`,$ref:t},n)}function No(e,t){return M(`Awaited`,[M(e,t)])}function Po(e){return M(`Awaited`,[Mo(e)])}function Fo(e){return jo(Ro(e))}function Io(e){return F(Ro(e))}function Lo(e){return zo(e)}function Ro(e){return e.map(e=>zo(e))}function zo(e,t){return S(kn(e)?No(e.target,e.parameters):Pn(e)?Fo(e.allOf):T(e)?Io(e.anyOf):Gn(e)?Lo(e.item):qn(e)?Po(e.$ref):e,t)}function Bo(e){let t=[];for(let n of e)t.push(qo(n));return t}function Vo(e){return wi(Bo(e))}function Ho(e){return Ci(Bo(e))}function Uo(e){return e.map((e,t)=>t.toString())}function Wo(e){return[`[number]`]}function Go(e){return globalThis.Object.getOwnPropertyNames(e)}function Ko(e){return Jo?globalThis.Object.getOwnPropertyNames(e).map(e=>e[0]===`^`&&e[e.length-1]===`$`?e.slice(1,e.length-1):e):[]}function qo(e){return Pn(e)?Vo(e.allOf):T(e)?Ho(e.anyOf):er(e)?Uo(e.items??[]):Tn(e)?Wo(e.items):Wn(e)?Go(e.properties):Kn(e)?Ko(e.patternProperties):[]}var Jo=!1;function Yo(e){Jo=!0;let t=qo(e);return Jo=!1,`^(${t.map(e=>`(${e})`).join(`|`)})$`}function Xo(e,t){return M(`KeyOf`,[M(e,t)])}function Zo(e){return M(`KeyOf`,[Mo(e)])}function Qo(e,t){return S(Ri($o(qo(e))),t)}function $o(e){return e.map(e=>e===`[number]`?ma():I(e))}function es(e,t){return kn(e)?Xo(e.target,e.parameters):qn(e)?Zo(e.$ref):zn(e)?rs(e,t):Qo(e,t)}function ts(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=es(e[r],Wt(t));return n}function ns(e,t){return ts(e.properties,t)}function rs(e,t){return P(ns(e,t))}function is(e){let t=[];for(let n of e)t.push(...qo(n));return bi(t)}function as(e){return e.filter(e=>!Bn(e))}function os(e,t){let n=[];for(let r of e)n.push(...Ha(r,[t]));return as(n)}function ss(e,t){let n={};for(let r of t)n[r]=Ao(os(e,r));return n}function cs(e,t){return L(ss(e,is(e)),t)}function ls(e){return S({[C]:`Date`,type:`Date`},e)}function us(e){return S({[C]:`Null`,type:`null`},e)}function ds(e){return S({[C]:`Symbol`,type:`symbol`},e)}function fs(e){return S({[C]:`Undefined`,type:`undefined`},e)}function ps(e){return S({[C]:`Uint8Array`,type:`Uint8Array`},e)}function ms(e){return S({[C]:`Unknown`},e)}function hs(e){return e.map(e=>vs(e,!1))}function gs(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=no(vs(e[n],!1));return t}function _s(e,t){return t===!0?e:no(e)}function vs(e,t){return Dt(e)||Mt(e)?_s(Ti(),t):v(e)?no(oo(hs(e))):Lt(e)?ps():At(e)?ls():y(e)?_s(L(gs(e)),t):jt(e)?_s(Mi([],ms()),t):x(e)?fs():Nt(e)?us():It(e)?ds():Ot(e)?pa():Pt(e)||kt(e)||b(e)?I(e):L({})}function ys(e,t){return S(vs(e,!0),t)}function bs(e,t){return An(e)?oo(e.parameters,t):N(t)}function xs(e,t){if(x(e))throw Error(`Enum undefined or empty`);let n=globalThis.Object.getOwnPropertyNames(e).filter(e=>isNaN(e)).map(t=>e[t]);return F([...new Set(n)].map(e=>I(e)),{...t,[bn]:`Enum`})}var Ss=class extends gn{},R;(function(e){e[e.Union=0]=`Union`,e[e.True=1]=`True`,e[e.False=2]=`False`})(R||={});function Cs(e){return e===R.False?e:R.True}function ws(e){throw new Ss(e)}function z(e){return zr(e)||Ar(e)||$r(e)||ti(e)||vr(e)}function B(e,t){return zr(t)?Hs(e,t):Ar(t)?Rs(e,t):$r(t)?wc(e,t):ti(t)?Ec(e,t):vr(t)?Ts(e,t):ws(`StructuralRight`)}function Ts(e,t){return R.True}function Es(e,t){return Ar(t)?Rs(e,t):$r(t)&&t.anyOf.some(e=>vr(e)||ti(e))?R.True:$r(t)?R.Union:ti(t)||vr(t)?R.True:R.Union}function Ds(e,t){return ti(e)?R.False:vr(e)?R.Union:zr(e)?R.True:R.False}function Os(e,t){return k(t)&&ac(t)?R.True:z(t)?B(e,t):br(t)?Cs(H(e.items,t.items)):R.False}function ks(e,t){return z(t)?B(e,t):xr(t)?Cs(H(e.items,t.items)):R.False}function As(e,t){return z(t)?B(e,t):k(t)?V(e,t):A(t)?fc(e,t):Sr(t)?R.True:R.False}function js(e,t){return Pr(e)||Cr(e)?R.True:R.False}function Ms(e,t){return z(t)?B(e,t):k(t)?V(e,t):A(t)?fc(e,t):Cr(t)?R.True:R.False}function Ns(e,t){return z(t)?B(e,t):k(t)?V(e,t):Tr(t)?e.parameters.length>t.parameters.length?R.False:e.parameters.every((e,n)=>Cs(H(t.parameters[n],e))===R.True)?Cs(H(e.returns,t.returns)):R.False:R.False}function Ps(e,t){return z(t)?B(e,t):k(t)?V(e,t):A(t)?fc(e,t):Er(t)?R.True:R.False}function Fs(e,t){return z(t)?B(e,t):k(t)?V(e,t):Dr(t)?e.parameters.length>t.parameters.length?R.False:e.parameters.every((e,n)=>Cs(H(t.parameters[n],e))===R.True)?Cs(H(e.returns,t.returns)):R.False:R.False}function Is(e,t){return Fr(e)&&Pt(e.const)||Hr(e)||Or(e)?R.True:R.False}function Ls(e,t){return Or(t)||Hr(t)?R.True:z(t)?B(e,t):k(t)?V(e,t):A(t)?fc(e,t):R.False}function Rs(e,t){return t.allOf.every(t=>H(e,t)===R.True)?R.True:R.False}function zs(e,t){return e.allOf.some(e=>H(e,t)===R.True)?R.True:R.False}function Bs(e,t){return z(t)?B(e,t):jr(t)?Cs(H(e.items,t.items)):R.False}function Vs(e,t){return Fr(t)&&t.const===e.const?R.True:z(t)?B(e,t):k(t)?V(e,t):A(t)?fc(e,t):Kr(t)?hc(e,t):Hr(t)?qs(e,t):Or(t)?Is(e,t):Cr(t)?js(e,t):R.False}function Hs(e,t){return R.False}function Us(e,t){return R.True}function Ws(e){let[t,n]=[e,0];for(;Br(t);)t=t.not,n+=1;return n%2==0?t:ms()}function Gs(e,t){return Br(e)?H(Ws(e),t):Br(t)?H(e,Ws(t)):ws(`Invalid fallthrough for Not`)}function Ks(e,t){return z(t)?B(e,t):k(t)?V(e,t):A(t)?fc(e,t):Vr(t)?R.True:R.False}function qs(e,t){return Nr(e)||Hr(e)||Or(e)?R.True:R.False}function Js(e,t){return z(t)?B(e,t):k(t)?V(e,t):A(t)?fc(e,t):Or(t)||Hr(t)?R.True:R.False}function Ys(e,t){return Object.getOwnPropertyNames(e.properties).length===t}function Xs(e){return ac(e)}function Zs(e){return Ys(e,0)||Ys(e,1)&&`description`in e.properties&&$r(e.properties.description)&&e.properties.description.anyOf.length===2&&(Kr(e.properties.description.anyOf[0])&&Qr(e.properties.description.anyOf[1])||Kr(e.properties.description.anyOf[1])&&Qr(e.properties.description.anyOf[0]))}function Qs(e){return Ys(e,0)}function $s(e){return Ys(e,0)}function ec(e){return Ys(e,0)}function tc(e){return Ys(e,0)}function nc(e){return ac(e)}function rc(e){let t=ma();return Ys(e,0)||Ys(e,1)&&`length`in e.properties&&Cs(H(e.properties.length,t))===R.True}function ic(e){return Ys(e,0)}function ac(e){let t=ma();return Ys(e,0)||Ys(e,1)&&`length`in e.properties&&Cs(H(e.properties.length,t))===R.True}function oc(e){let t=Mi([Ti()],Ti());return Ys(e,0)||Ys(e,1)&&`then`in e.properties&&Cs(H(e.properties.then,t))===R.True}function sc(e,t){return H(e,t)===R.False||_r(e)&&!_r(t)?R.False:R.True}function V(e,t){return ti(e)?R.False:vr(e)?R.Union:zr(e)||Mr(e)&&Xs(t)||Nr(e)&&Qs(t)||Pr(e)&&$s(t)||qr(e)&&Zs(t)||Sr(e)&&ec(t)||Kr(e)&&Xs(t)||qr(e)&&Zs(t)||Hr(e)&&Qs(t)||Or(e)&&Qs(t)||Cr(e)&&$s(t)||ei(e)&&nc(t)||Er(e)&&tc(t)||Tr(e)&&ic(t)||Dr(e)&&rc(t)?R.True:A(e)&&Kr(uc(e))?t[bn]===`Record`?R.True:R.False:A(e)&&Hr(uc(e))&&Ys(t,0)?R.True:R.False}function cc(e,t){return z(t)?B(e,t):A(t)?fc(e,t):k(t)?(()=>{for(let n of Object.getOwnPropertyNames(t.properties)){if(!(n in e.properties)&&!_r(t.properties[n]))return R.False;if(_r(t.properties[n]))return R.True;if(sc(e.properties[n],t.properties[n])===R.False)return R.False}return R.True})():R.False}function lc(e,t){return z(t)?B(e,t):k(t)&&oc(t)?R.True:Ur(t)?Cs(H(e.item,t.item)):R.False}function uc(e){return li in e.patternProperties?ma():ui in e.patternProperties?ha():ws(`Unknown record key pattern`)}function dc(e){return li in e.patternProperties?e.patternProperties[li]:ui in e.patternProperties?e.patternProperties[ui]:ws(`Unable to get record value schema`)}function fc(e,t){let[n,r]=[uc(t),dc(t)];return Mr(e)&&Hr(n)&&Cs(H(e,r))===R.True?R.True:ei(e)&&Hr(n)||Kr(e)&&Hr(n)||br(e)&&Hr(n)?H(e,r):k(e)?(()=>{for(let t of Object.getOwnPropertyNames(e.properties))if(sc(r,e.properties[t])===R.False)return R.False;return R.True})():R.False}function pc(e,t){return z(t)?B(e,t):k(t)?V(e,t):A(t)?H(dc(e),dc(t)):R.False}function mc(e,t){return H(Gr(e)?ha():e,Gr(t)?ha():t)}function hc(e,t){return Fr(e)&&b(e.const)||Kr(e)?R.True:R.False}function gc(e,t){return z(t)?B(e,t):k(t)?V(e,t):A(t)?fc(e,t):Kr(t)?R.True:R.False}function _c(e,t){return z(t)?B(e,t):k(t)?V(e,t):A(t)?fc(e,t):qr(t)?R.True:R.False}function vc(e,t){return Jr(e)?H(wa(e),t):Jr(t)?H(e,wa(t)):ws(`Invalid fallthrough for TemplateLiteral`)}function yc(e,t){return br(t)&&e.items!==void 0&&e.items.every(e=>H(e,t.items)===R.True)}function bc(e,t){return zr(e)?R.True:ti(e)?R.False:vr(e)?R.Union:R.False}function xc(e,t){return z(t)?B(e,t):k(t)&&ac(t)||br(t)&&yc(e,t)?R.True:Zr(t)?x(e.items)&&!x(t.items)||!x(e.items)&&x(t.items)?R.False:x(e.items)&&!x(t.items)||e.items.every((e,n)=>H(e,t.items[n])===R.True)?R.True:R.False:R.False}function Sc(e,t){return z(t)?B(e,t):k(t)?V(e,t):A(t)?fc(e,t):ei(t)?R.True:R.False}function Cc(e,t){return z(t)?B(e,t):k(t)?V(e,t):A(t)?fc(e,t):ri(t)?Oc(e,t):Qr(t)?R.True:R.False}function wc(e,t){return t.anyOf.some(t=>H(e,t)===R.True)?R.True:R.False}function Tc(e,t){return e.anyOf.every(e=>H(e,t)===R.True)?R.True:R.False}function Ec(e,t){return R.True}function Dc(e,t){return zr(t)?Hs(e,t):Ar(t)?Rs(e,t):$r(t)?wc(e,t):vr(t)?Ts(e,t):Kr(t)?hc(e,t):Hr(t)?qs(e,t):Or(t)?Is(e,t):Cr(t)?js(e,t):br(t)?Ds(e,t):Zr(t)?bc(e,t):k(t)?V(e,t):ti(t)?R.True:R.False}function Oc(e,t){return Qr(e)||Qr(e)?R.True:R.False}function kc(e,t){return Ar(t)?Rs(e,t):$r(t)?wc(e,t):ti(t)?Ec(e,t):vr(t)?Ts(e,t):k(t)?V(e,t):ri(t)?R.True:R.False}function H(e,t){return Jr(e)||Jr(t)?vc(e,t):Gr(e)||Gr(t)?mc(e,t):Br(e)||Br(t)?Gs(e,t):vr(e)?Es(e,t):br(e)?Os(e,t):Sr(e)?As(e,t):Cr(e)?Ms(e,t):xr(e)?ks(e,t):Tr(e)?Ns(e,t):Er(e)?Ps(e,t):Dr(e)?Fs(e,t):Or(e)?Ls(e,t):Ar(e)?zs(e,t):jr(e)?Bs(e,t):Fr(e)?Vs(e,t):zr(e)?Us(e,t):Vr(e)?Ks(e,t):Hr(e)?Js(e,t):k(e)?cc(e,t):A(e)?pc(e,t):Kr(e)?gc(e,t):qr(e)?_c(e,t):Zr(e)?xc(e,t):Ur(e)?lc(e,t):ei(e)?Sc(e,t):Qr(e)?Cc(e,t):$r(e)?Tc(e,t):ti(e)?Dc(e,t):ri(e)?kc(e,t):ws(`Unknown left type operand '${e[C]}'`)}function Ac(e,t){return H(e,t)}function jc(e,t,n,r,i){let a={};for(let o of globalThis.Object.getOwnPropertyNames(e))a[o]=Fc(e[o],t,n,r,Wt(i));return a}function Mc(e,t,n,r,i){return jc(e.properties,t,n,r,i)}function Nc(e,t,n,r,i){return P(Mc(e,t,n,r,i))}function Pc(e,t,n,r){let i=Ac(e,t);return i===R.Union?F([n,r]):i===R.True?n:r}function Fc(e,t,n,r,i){return zn(e)?Nc(e,t,n,r,i):Rn(e)?S(zc(e,t,n,r,i)):S(Pc(e,t,n,r),i)}function Ic(e,t,n,r,i){return{[e]:Fc(I(e),t,n,r,Wt(i))}}function Lc(e,t,n,r,i){return e.reduce((e,a)=>({...e,...Ic(a,t,n,r,i)}),{})}function Rc(e,t,n,r,i){return Lc(e.keys,t,n,r,i)}function zc(e,t,n,r,i){return P(Rc(e,t,n,r,i))}function Bc(e){return e.allOf.every(e=>Uc(e))}function Vc(e){return e.anyOf.some(e=>Uc(e))}function Hc(e){return!Uc(e.not)}function Uc(e){return e[C]===`Intersect`?Bc(e):e[C]===`Union`?Vc(e):e[C]===`Not`?Hc(e):e[C]===`Undefined`}function Wc(e,t){return Kc(wa(e),t)}function Gc(e,t){let n=e.filter(e=>Ac(e,t)===R.False);return n.length===1?n[0]:F(n)}function Kc(e,t,n={}){return Zn(e)?S(Wc(e,t),n):zn(e)?S(Yc(e,t),n):S(T(e)?Gc(e.anyOf,t):Ac(e,t)===R.False?e:N(),n)}function qc(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=Kc(e[r],t);return n}function Jc(e,t){return qc(e.properties,t)}function Yc(e,t){return P(Jc(e,t))}function Xc(e,t){return Qc(wa(e),t)}function Zc(e,t){let n=e.filter(e=>Ac(e,t)!==R.False);return n.length===1?n[0]:F(n)}function Qc(e,t,n){return Zn(e)?S(Xc(e,t),n):zn(e)?S(tl(e,t),n):S(T(e)?Zc(e.anyOf,t):Ac(e,t)===R.False?N():e,n)}function $c(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=Qc(e[r],t);return n}function el(e,t){return $c(e.properties,t)}function tl(e,t){return P(el(e,t))}function nl(e,t){return An(e)?S(e.returns,t):N(t)}function rl(e){return no(xo(e))}function il(e,t,n){return S({[C]:`Record`,type:`object`,patternProperties:{[e]:t}},n)}function al(e,t,n){let r={};for(let n of e)r[n]=t;return L(r,{...n,[bn]:`Record`})}function ol(e,t,n){return ia(e)?al(ka(e),t,n):il(e.pattern,t,n)}function sl(e,t,n){return al(ka(F(e)),t,n)}function cl(e,t,n){return al([e.toString()],t,n)}function ll(e,t,n){return il(e.source,t,n)}function ul(e,t,n){return il(x(e.pattern)?ui:e.pattern,t,n)}function dl(e,t,n){return il(ui,t,n)}function fl(e,t,n){return il(di,t,n)}function pl(e,t,n){return L({true:t,false:t},n)}function ml(e,t,n){return il(li,t,n)}function hl(e,t,n){return il(li,t,n)}function gl(e,t,n={}){return T(e)?sl(e.anyOf,t,n):Zn(e)?ol(e,t,n):Ln(e)?cl(e.const,t,n):On(e)?pl(e,t,n):Nn(e)?ml(e,t,n):Un(e)?hl(e,t,n):Jn(e)?ll(e,t,n):Yn(e)?ul(e,t,n):Cn(e)?dl(e,t,n):Bn(e)?fl(e,t,n):N(n)}function _l(e){return globalThis.Object.getOwnPropertyNames(e.patternProperties)[0]}function vl(e){let t=_l(e);return t===ui?ha():t===li?ma():ha({pattern:t})}function yl(e){return e.patternProperties[_l(e)]}function bl(e,t){return t.parameters=Pl(e,t.parameters),t.returns=Fl(e,t.returns),t}function xl(e,t){return t.parameters=Pl(e,t.parameters),t.returns=Fl(e,t.returns),t}function Sl(e,t){return t.allOf=Pl(e,t.allOf),t}function Cl(e,t){return t.anyOf=Pl(e,t.anyOf),t}function wl(e,t){return x(t.items)||(t.items=Pl(e,t.items)),t}function Tl(e,t){return t.items=Fl(e,t.items),t}function El(e,t){return t.items=Fl(e,t.items),t}function Dl(e,t){return t.items=Fl(e,t.items),t}function Ol(e,t){return t.item=Fl(e,t.item),t}function kl(e,t){let n=Nl(e,t.properties);return{...t,...L(n)}}function Al(e,t){let n=gl(Fl(e,vl(t)),Fl(e,yl(t)));return{...t,...n}}function jl(e,t){return t.index in e?e[t.index]:ms()}function Ml(e,t){let n=xn(t),r=Sn(t),i=Fl(e,t);return n&&r?rl(i):n&&!r?no(i):!n&&r?xo(i):i}function Nl(e,t){return globalThis.Object.getOwnPropertyNames(t).reduce((n,r)=>({...n,[r]:Ml(e,t[r])}),{})}function Pl(e,t){return t.map(t=>Fl(e,t))}function Fl(e,t){return An(t)?bl(e,t):Mn(t)?xl(e,t):Pn(t)?Sl(e,t):T(t)?Cl(e,t):er(t)?wl(e,t):Tn(t)?Tl(e,t):En(t)?El(e,t):Fn(t)?Dl(e,t):Gn(t)?Ol(e,t):Wn(t)?kl(e,t):Kn(t)?Al(e,t):wn(t)?jl(e,t):t}function Il(e,t){return Fl(t,Gt(e))}function Ll(e){return S({[C]:`Integer`,type:`integer`},e)}function Rl(e,t,n){return{[e]:Yl(I(e),t,Wt(n))}}function zl(e,t,n){return e.reduce((e,r)=>({...e,...Rl(r,t,n)}),{})}function Bl(e,t,n){return zl(e.keys,t,n)}function Vl(e,t,n){return P(Bl(e,t,n))}function Hl(e){let[t,n]=[e.slice(0,1),e.slice(1)];return[t.toLowerCase(),n].join(``)}function Ul(e){let[t,n]=[e.slice(0,1),e.slice(1)];return[t.toUpperCase(),n].join(``)}function Wl(e){return e.toUpperCase()}function Gl(e){return e.toLowerCase()}function Kl(e,t,n){let r=Qi(e.pattern);return ra(r)?Ta([F(Jl([...ua(r)].map(e=>I(e)),t))],n):{...e,pattern:ql(e.pattern,t)}}function ql(e,t){return typeof e==`string`?t===`Uncapitalize`?Hl(e):t===`Capitalize`?Ul(e):t===`Uppercase`?Wl(e):t===`Lowercase`?Gl(e):e:e.toString()}function Jl(e,t){return e.map(e=>Yl(e,t))}function Yl(e,t,n={}){return Rn(e)?Vl(e,t,n):Zn(e)?Kl(e,t,n):T(e)?F(Jl(e.anyOf,t),n):Ln(e)?I(ql(e.const,t),n):S(e,n)}function Xl(e,t={}){return Yl(e,`Capitalize`,t)}function Zl(e,t={}){return Yl(e,`Lowercase`,t)}function Ql(e,t={}){return Yl(e,`Uncapitalize`,t)}function $l(e,t={}){return Yl(e,`Uppercase`,t)}function eu(e,t,n){let r={};for(let i of globalThis.Object.getOwnPropertyNames(e))r[i]=uu(e[i],t,Wt(n));return r}function tu(e,t,n){return eu(e.properties,t,n)}function nu(e,t,n){return P(tu(e,t,n))}function ru(e,t){return e.map(e=>lu(e,t))}function iu(e,t){return e.map(e=>lu(e,t))}function au(e,t){let{[t]:n,...r}=e;return r}function ou(e,t){return t.reduce((e,t)=>au(e,t),e)}function su(e,t,n){let r=Ai(e,[_n,`$id`,`required`,`properties`]);return L(ou(n,t),r)}function cu(e){return F(e.reduce((e,t)=>In(t)?[...e,I(t)]:e,[]))}function lu(e,t){return Pn(e)?jo(ru(e.allOf,t)):T(e)?F(iu(e.anyOf,t)):Wn(e)?su(e,t,e.properties):L({})}function uu(e,t,n){let r=v(t)?cu(t):t,i=sr(t)?ka(t):t,a=qn(e),o=qn(t);return zn(e)?nu(e,i,n):Rn(t)?mu(e,t,n):a&&o||!a&&o||a&&!o?M(`Omit`,[e,r],n):S({...lu(e,i),...n})}function du(e,t,n){return{[t]:uu(e,[t],Wt(n))}}function fu(e,t,n){return t.reduce((t,r)=>({...t,...du(e,r,n)}),{})}function pu(e,t,n){return fu(e,t.keys,n)}function mu(e,t,n){return P(pu(e,t,n))}function hu(e,t,n){let r={};for(let i of globalThis.Object.getOwnPropertyNames(e))r[i]=wu(e[i],t,Wt(n));return r}function gu(e,t,n){return hu(e.properties,t,n)}function _u(e,t,n){return P(gu(e,t,n))}function vu(e,t){return e.map(e=>Cu(e,t))}function yu(e,t){return e.map(e=>Cu(e,t))}function bu(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function xu(e,t,n){let r=Ai(e,[_n,`$id`,`required`,`properties`]);return L(bu(n,t),r)}function Su(e){return F(e.reduce((e,t)=>In(t)?[...e,I(t)]:e,[]))}function Cu(e,t){return Pn(e)?jo(vu(e.allOf,t)):T(e)?F(yu(e.anyOf,t)):Wn(e)?xu(e,t,e.properties):L({})}function wu(e,t,n){let r=v(t)?Su(t):t,i=sr(t)?ka(t):t,a=qn(e),o=qn(t);return zn(e)?_u(e,i,n):Rn(t)?Ou(e,t,n):a&&o||!a&&o||a&&!o?M(`Pick`,[e,r],n):S({...Cu(e,i),...n})}function Tu(e,t,n){return{[t]:wu(e,[t],Wt(n))}}function Eu(e,t,n){return t.reduce((t,r)=>({...t,...Tu(e,r,n)}),{})}function Du(e,t,n){return Eu(e,t.keys,n)}function Ou(e,t,n){return P(Du(e,t,n))}function ku(e,t){return M(`Partial`,[M(e,t)])}function Au(e){return M(`Partial`,[Mo(e)])}function ju(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=xo(e[n]);return t}function Mu(e,t){let n=Ai(e,[_n,`$id`,`required`,`properties`]);return L(ju(t),n)}function Nu(e){return e.map(e=>Pu(e))}function Pu(e){return kn(e)?ku(e.target,e.parameters):qn(e)?Au(e.$ref):Pn(e)?jo(Nu(e.allOf)):T(e)?F(Nu(e.anyOf)):Wn(e)?Mu(e,e.properties):Dn(e)||On(e)||Nn(e)||Ln(e)||Hn(e)||Un(e)||Yn(e)||Xn(e)||tr(e)?e:L({})}function Fu(e,t){return zn(e)?Ru(e,t):S({...Pu(e),...t})}function Iu(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=Fu(e[r],Wt(t));return n}function Lu(e,t){return Iu(e.properties,t)}function Ru(e,t){return P(Lu(e,t))}function zu(e,t){return M(`Required`,[M(e,t)])}function Bu(e){return M(`Required`,[Mo(e)])}function Vu(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=Ai(e[n],[yn]);return t}function Hu(e,t){let n=Ai(e,[_n,`$id`,`required`,`properties`]);return L(Vu(t),n)}function Uu(e){return e.map(e=>Wu(e))}function Wu(e){return kn(e)?zu(e.target,e.parameters):qn(e)?Bu(e.$ref):Pn(e)?jo(Uu(e.allOf)):T(e)?F(Uu(e.anyOf)):Wn(e)?Hu(e,e.properties):Dn(e)||On(e)||Nn(e)||Ln(e)||Hn(e)||Un(e)||Yn(e)||Xn(e)||tr(e)?e:L({})}function Gu(e,t){return zn(e)?Ju(e,t):S({...Wu(e),...t})}function Ku(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=Gu(e[r],t);return n}function qu(e,t){return Ku(e.properties,t)}function Ju(e,t){return P(qu(e,t))}function Yu(e,t){return t.map(t=>qn(t)?Xu(e,t.$ref):_d(e,t))}function Xu(e,t){return t in e?qn(e[t])?Xu(e,e[t].$ref):_d(e,e[t]):N()}function Zu(e){return zo(e[0])}function Qu(e){return Wa(e[0],e[1])}function $u(e){return es(e[0])}function ed(e){return Fu(e[0])}function td(e){return uu(e[0],e[1])}function nd(e){return wu(e[0],e[1])}function rd(e){return Gu(e[0])}function id(e,t,n){let r=Yu(e,n);return t===`Awaited`?Zu(r):t===`Index`?Qu(r):t===`KeyOf`?$u(r):t===`Partial`?ed(r):t===`Omit`?td(r):t===`Pick`?nd(r):t===`Required`?rd(r):N()}function ad(e,t){return Ei(_d(e,t))}function od(e,t){return Oi(_d(e,t))}function sd(e,t,n){return ji(gd(e,t),_d(e,n))}function cd(e,t,n){return Mi(gd(e,t),_d(e,n))}function ld(e,t){return jo(gd(e,t))}function ud(e,t){return Ya(_d(e,t))}function dd(e,t){return L(globalThis.Object.keys(t).reduce((n,r)=>({...n,[r]:_d(e,t[r])}),{}))}function fd(e,t){let[n,r]=[_d(e,yl(t)),_l(t)],i=Gt(t);return i.patternProperties[r]=n,i}function pd(e,t){return qn(t)?{...Xu(e,t.$ref),[_n]:t[_n]}:t}function md(e,t){return oo(gd(e,t))}function hd(e,t){return F(gd(e,t))}function gd(e,t){return t.map(t=>_d(e,t))}function _d(e,t){return Sn(t)?S(_d(e,Ai(t,[yn])),t):xn(t)?S(_d(e,Ai(t,[vn])),t):$n(t)?S(pd(e,t),t):Tn(t)?S(ad(e,t.items),t):En(t)?S(od(e,t.items),t):kn(t)?S(id(e,t.target,t.parameters)):An(t)?S(sd(e,t.parameters,t.returns),t):Mn(t)?S(cd(e,t.parameters,t.returns),t):Pn(t)?S(ld(e,t.allOf),t):Fn(t)?S(ud(e,t.items),t):Wn(t)?S(dd(e,t.properties),t):Kn(t)?S(fd(e,t)):er(t)?S(md(e,t.items||[]),t):T(t)?S(hd(e,t.anyOf),t):t}function vd(e,t){return t in e?_d(e,e[t]):N()}function yd(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,n)=>({...t,[n]:vd(e,n)}),{})}var bd=class{constructor(e){let t=yd(e),n=this.WithIdentifiers(t);this.$defs=n}Import(e,t){let n={...this.$defs,[e]:S(this.$defs[e],t)};return S({[C]:`Import`,$defs:n,$ref:e})}WithIdentifiers(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,n)=>({...t,[n]:{...e[n],$id:n}}),{})}};function xd(e){return new bd(e)}function Sd(e,t){return S({[C]:`Not`,not:e},t)}function Cd(e,t){return Mn(e)?oo(e.parameters,t):N()}var wd=0;function Td(e,t={}){x(t.$id)&&(t.$id=`T${wd++}`);let n=Gt(e({[C]:`This`,$ref:`${t.$id}`}));return n.$id=t.$id,S({[bn]:`Recursive`,...n},t)}function Ed(e,t){let n=b(e)?new globalThis.RegExp(e):e;return S({[C]:`RegExp`,type:`RegExp`,source:n.source,flags:n.flags},t)}function Dd(e){return Pn(e)?e.allOf:T(e)?e.anyOf:er(e)?e.items??[]:[]}function Od(e){return Dd(e)}function kd(e,t){return Mn(e)?S(e.returns,t):N(t)}var Ad=class{constructor(e){this.schema=e}Decode(e){return new jd(this.schema,e)}},jd=class{constructor(e,t){this.schema=e,this.decode=t}EncodeTransform(e,t){let n={Encode:n=>t[_n].Encode(e(n)),Decode:e=>this.decode(t[_n].Decode(e))};return{...t,[_n]:n}}EncodeSchema(e,t){let n={Decode:this.decode,Encode:e};return{...t,[_n]:n}}Encode(e){return $n(this.schema)?this.EncodeTransform(e,this.schema):this.EncodeSchema(e,this.schema)}};function Md(e){return new Ad(e)}function Nd(e={}){return S({[C]:e[C]??`Unsafe`},e)}function Pd(e){return S({[C]:`Void`,type:`void`},e)}var U=e({Any:()=>Ti,Argument:()=>Di,Array:()=>Ei,AsyncIterator:()=>Oi,Awaited:()=>zo,BigInt:()=>pa,Boolean:()=>fa,Capitalize:()=>Xl,Composite:()=>cs,Const:()=>ys,Constructor:()=>ji,ConstructorParameters:()=>bs,Date:()=>ls,Enum:()=>xs,Exclude:()=>Kc,Extends:()=>Fc,Extract:()=>Qc,Function:()=>Mi,Index:()=>Wa,InstanceType:()=>nl,Instantiate:()=>Il,Integer:()=>Ll,Intersect:()=>jo,Iterator:()=>Ya,KeyOf:()=>es,Literal:()=>I,Lowercase:()=>Zl,Mapped:()=>_o,Module:()=>xd,Never:()=>N,Not:()=>Sd,Null:()=>us,Number:()=>ma,Object:()=>L,Omit:()=>uu,Optional:()=>xo,Parameters:()=>Cd,Partial:()=>Fu,Pick:()=>wu,Promise:()=>Qa,Readonly:()=>no,ReadonlyOptional:()=>rl,Record:()=>gl,Recursive:()=>Td,Ref:()=>Mo,RegExp:()=>Ed,Required:()=>Gu,Rest:()=>Od,ReturnType:()=>kd,String:()=>ha,Symbol:()=>ds,TemplateLiteral:()=>Ta,Transform:()=>Md,Tuple:()=>oo,Uint8Array:()=>ps,Uncapitalize:()=>Ql,Undefined:()=>fs,Union:()=>F,Unknown:()=>ms,Unsafe:()=>Nd,Uppercase:()=>$l,Void:()=>Pd}),Fd=U.Union([U.Object({enabled:U.Literal(!1),selectedPetId:U.Union([U.String(),U.Null()])},{additionalProperties:!1}),U.Object({enabled:U.Literal(!0),selectedPetId:U.String({minLength:1})},{additionalProperties:!1})]),Id=U.Object({columns:U.Integer({minimum:1}),height:U.Integer({minimum:1}),rows:U.Integer({minimum:1}),width:U.Integer({minimum:1})},{additionalProperties:!1}),Ld=U.Object({durationMs:U.Integer({minimum:1}),spriteIndex:U.Integer({maximum:255,minimum:0})},{additionalProperties:!1}),Rd=U.Object({fallback:U.String({minLength:1}),frames:U.Array(Ld,{maxItems:512,minItems:1}),loopStart:U.Union([U.Integer({minimum:0}),U.Null()])},{additionalProperties:!1}),zd=U.Object({animations:U.Record(U.String({minLength:1}),Rd),assetId:U.String({pattern:`^[a-f0-9]{64}$`}),availability:U.Union([U.Literal(`downloadable`),U.Literal(`ready`)]),description:U.String(),displayName:U.String({minLength:1}),frame:Id,id:U.String({minLength:1}),source:U.Union([U.Literal(`builtin`),U.Literal(`custom`),U.Literal(`legacy`)])},{additionalProperties:!1}),Bd=U.Object({data:U.Array(zd)},{additionalProperties:!1});U.Object({petId:U.String({minLength:1})},{additionalProperties:!1});var Vd=U.Object({data:zd},{additionalProperties:!1}),Hd=U.String({pattern:`^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:-(?:(?:0|[1-9][0-9]*)|[0-9]*[A-Za-z-][0-9A-Za-z-]*)(?:\\.(?:(?:0|[1-9][0-9]*)|[0-9]*[A-Za-z-][0-9A-Za-z-]*))*)?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$`}),Ud=U.Union([U.Literal(`current`),U.Literal(`available`),U.Literal(`restart-required`),U.Literal(`check-failed`)]),Wd=U.Object({appVersion:Hd,codexVersion:Hd,latestVersion:U.Union([Hd,U.Null()]),releaseNotes:U.Union([U.String({maxLength:32768}),U.Null()]),status:Ud,updateAvailable:U.Boolean()},{additionalProperties:!1});U.Object({version:Hd},{additionalProperties:!1});var Gd=U.Object({appVersion:Hd,codexVersion:Hd,latestVersion:Hd,releaseNotes:U.Null(),status:U.Literal(`restart-required`),updateAvailable:U.Literal(!1)},{additionalProperties:!1}),Kd=U.Union([U.Literal(`local`),U.Literal(`lan`)]),qd=U.Object({authenticated:U.Boolean(),mode:Kd,version:U.Literal(1)},{additionalProperties:!1});U.Object({code:U.String({minLength:1})},{additionalProperties:!1});var Jd=U.String({maxLength:32768,minLength:1,pattern:`^(?!.*[\\u0000\\r\\n])(?:/|[A-Za-z]:[\\\\/]|\\\\\\\\[^\\\\/]+[\\\\/][^\\\\/]+).*$`}),Yd=U.String({maxLength:64,minLength:1}),Xd=U.Object({path:Jd},{additionalProperties:!1}),Zd=U.Object({id:Yd,path:Jd},{additionalProperties:!1}),Qd=U.Readonly(U.Array(Zd,{minItems:1,uniqueItems:!0})),$d=U.Readonly(U.Array(Xd,{minItems:1,uniqueItems:!0}));U.Object({rootPath:Jd},{additionalProperties:!1}),pi(`date-time`)||mi(`date-time`,e=>!Number.isNaN(Date.parse(e)));var ef=U.String({format:`date-time`}),tf=U.Union([ef,U.Null()]),W=U.String({minLength:1,pattern:`^(?![A-Za-z]:)(?!/)(?!.*(?:^|/)\\.\\.?(?:/|$))(?!.*//)(?!.*\\\\)(?!.*\\/$).+$`}),nf=U.String({maxLength:128,minLength:1,pattern:`^[A-Za-z0-9._:-]+$`});U.Object({query:U.String({maxLength:256}),rootPath:U.Optional(Jd),sessionId:nf},{additionalProperties:!1});var rf=U.Object({name:U.String({minLength:1}),path:W,rootId:Yd,rootPath:Jd},{additionalProperties:!1}),af=U.Object({data:U.Array(rf,{maxItems:50})},{additionalProperties:!1});U.Object({rootPath:U.Optional(Jd),sessionId:nf},{additionalProperties:!1});var of=U.Object({},{additionalProperties:!1}),sf=U.String({maxLength:32768,minLength:1,pattern:`^[^\\u0000\\r\\n]+$`}),cf=U.Object({createdAt:ef,id:U.String({minLength:1}),name:U.String({minLength:1}),roots:Qd},{additionalProperties:!1}),lf=Jd;U.Object({includeHidden:U.Optional(U.Boolean()),path:U.Optional(lf)},{additionalProperties:!1});var uf=U.Object({name:U.String({minLength:1}),path:lf},{additionalProperties:!1}),df=U.Object({name:U.String({minLength:1}),path:lf},{additionalProperties:!1}),ff=U.Object({entries:U.Array(uf),parentPath:U.Union([lf,U.Null()]),path:lf,roots:U.Array(df)},{additionalProperties:!1}),pf=U.Union([U.Literal(`file`),U.Literal(`image`)]);U.Object({includeHidden:U.Optional(U.Boolean()),kind:pf,path:U.Optional(lf)},{additionalProperties:!1});var mf=U.Object({name:U.String({minLength:1}),path:lf,type:U.Union([U.Literal(`directory`),U.Literal(`file`)])},{additionalProperties:!1}),hf=U.Object({entries:U.Array(mf),parentPath:U.Union([lf,U.Null()]),path:lf,roots:U.Array(df)},{additionalProperties:!1});U.Object({path:lf},{additionalProperties:!1}),U.Object({roots:$d},{additionalProperties:!1});var gf=U.Object({project:cf},{additionalProperties:!1}),_f=U.Union([U.Literal(`visual-studio-code`),U.Literal(`system-default`),U.Literal(`zed`),U.Literal(`windsurf`),U.Literal(`finder`),U.Literal(`terminal`),U.Literal(`ghostty`),U.Literal(`xcode`),U.Literal(`android-studio`),U.Literal(`file-manager`),U.Literal(`gnome-terminal`),U.Literal(`konsole`),U.Literal(`xfce-terminal`),U.Literal(`explorer`),U.Literal(`windows-terminal`),U.Literal(`command-prompt`)]),vf=U.Union([U.Literal(`editor`),U.Literal(`file-manager`),U.Literal(`system-default`),U.Literal(`terminal`),U.Literal(`tool`)]),yf=U.Object({id:_f,kind:vf,name:U.String({minLength:1})},{additionalProperties:!1}),bf=U.Union([U.Literal(`darwin`),U.Literal(`linux`),U.Literal(`win32`)]),xf=U.Object({apps:U.Array(yf,{uniqueItems:!0}),platform:bf},{additionalProperties:!1});U.Object({appId:_f,path:U.Optional(sf)},{additionalProperties:!1});var Sf=U.Object({appId:_f,path:U.Optional(sf)},{additionalProperties:!1});U.Object({projectIds:U.Array(U.String({minLength:1}),{minItems:1,uniqueItems:!0})},{additionalProperties:!1}),U.Object({name:U.String({maxLength:200,minLength:1,pattern:`\\S`})},{additionalProperties:!1});var Cf=U.Object({project:cf},{additionalProperties:!1});U.Object({},{additionalProperties:!1});var wf=U.Object({projectId:U.String({minLength:1}),status:U.Literal(`removed`)},{additionalProperties:!1}),Tf=U.Object({id:U.String({minLength:1}),pinned:U.Boolean(),projectId:U.String({minLength:1}),title:U.String({minLength:1}),updatedAt:ef},{additionalProperties:!1}),Ef=U.Union([U.Literal(`pending`),U.Literal(`running`),U.Literal(`completed`),U.Literal(`failed`),U.Literal(`declined`),U.Literal(`interrupted`)]),Df=U.Object({branch:U.Optional(U.String({minLength:1})),instructions:U.Optional(U.String({minLength:1})),sha:U.Optional(U.String({minLength:1})),title:U.Optional(U.String({minLength:1})),type:U.Union([U.Literal(`uncommitted_changes`),U.Literal(`base_branch`),U.Literal(`commit`),U.Literal(`custom`)])},{additionalProperties:!1}),Of=U.Intersect([Df,U.Union([U.Object({type:U.Literal(`uncommitted_changes`)}),U.Object({branch:U.String({minLength:1}),type:U.Literal(`base_branch`)}),U.Object({sha:U.String({minLength:1}),type:U.Literal(`commit`)}),U.Object({instructions:U.String({minLength:1}),type:U.Literal(`custom`)})])]),kf=50*1024*1024,Af=50*1024*1024,jf=10*1024*1024,Mf=50*1024*1024,Nf=Math.max(kf,jf),Pf=1500,Ff=512*1024*1024,If=`.png,.jpg,.jpeg,.webp,.gif`,Lf=`.asm,.astro,.awk,.bash,.bat,.c,.cc,.conf,.cs,.cpp,.css,.csv,.cxx,.def,.dic,.diff,.doc,.docx,.dot,.eml,.ejs,.ex,.exs,.go,.gradle,.graphql,.groovy,.h,.hh,.htm,.html,.hbs,.hcl,.hs,.ics,.ifb,.iif,.in,.ini,.jade,.java,.jinja2,.jl,.js,.jsx,.json,.json5,.kt,.kts,.ksh,.list,.liquid,.lua,.log,.markdown,.md,.mht,.mhtml,.mime,.mjs,.nws,.ndjson,.odt,.pdf,.pl,.patch,.php,.pot,.ppa,.pps,.ppt,.pptx,.pwz,.py,.properties,.proto,.ps1,.pug,.r,.rb,.rst,.rtf,.rs,.s,.sass,.scala,.scss,.sh,.sql,.srt,.text,.tex,.tf,.tmpl,.toml,.ts,.tsx,.tsv,.txt,.vcf,.vtt,.vbs,.wiz,.xla,.xlb,.xlc,.xlm,.xls,.xlsx,.xlt,.xlw,.xml,.yaml,.yml,.zsh`.split(`,`),Rf=`application/csv,application/graphql,application/javascript,application/json,application/msword,application/pdf,application/rtf,application/toml,application/typescript,application/vnd.ms-excel,application/vnd.ms-powerpoint,application/vnd.oasis.opendocument.text,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/x-httpd-php,application/x-iif,application/x-ndjson,application/x-patch,application/x-protobuf,application/x-rust,application/x-shellscript,application/x-sql,application/x-toml,application/x-typescript,application/x-yaml,application/yaml,message/rfc822,text/calendar,text/csv,text/css,text/html,text/javascript,text/jsx,text/markdown,text/plain,text/rtf,text/tsx,text/tsv,text/vtt,text/x-c,text/x-c++,text/x-csharp,text/x-diff,text/x-go,text/x-java,text/x-makefile,text/x-python,text/x-rst,text/x-rust,text/x-shellscript,text/x-sql,text/x-typescript,text/x-yaml,text/xml`.split(`,`),zf=[...Lf,...Rf].join(`,`);U.Union([U.Literal(`image/gif`),U.Literal(`image/jpeg`),U.Literal(`image/png`),U.Literal(`image/webp`)]);var Bf=U.String({maxLength:255,minLength:1}),Vf=U.Union([U.Literal(`file`),U.Literal(`image`),U.Literal(`text`)]),Hf=U.Object({name:U.String({minLength:1})},{additionalProperties:!1});function Uf(e,t){let n=new Set(t.map(e=>e.name)),r=e,i=!1;for(;r.length>0;){let e=/^\s*\$([^\s$]+)/u.exec(r),t=e?.[1];if(e===null||t===void 0||!n.has(t))break;r=r.slice(e[0].length),i=!0}return i?r.trimStart():e}var Wf=U.Object({id:U.String({minLength:1}),kind:Vf,mediaType:Bf,name:U.String({maxLength:255,minLength:1}),size:U.Integer({maximum:Ff,minimum:1})},{additionalProperties:!1});U.Object({},{additionalProperties:!1});var Gf=U.Object({attachmentId:U.String({minLength:1}),status:U.Literal(`opened`)},{additionalProperties:!1}),Kf=U.Union([U.Literal(`commentary`),U.Literal(`final_answer`)]),qf=U.Object({attachments:U.Optional(U.Array(Wf,{maxItems:Pf})),id:U.String({minLength:1}),phase:U.Optional(Kf),role:U.Union([U.Literal(`user`),U.Literal(`assistant`)]),skills:U.Optional(U.Array(Hf)),text:U.String(),type:U.Literal(`message`)},{additionalProperties:!1}),Jf=U.Object({content:U.String(),id:U.String({minLength:1}),summary:U.String(),type:U.Literal(`reasoning`)},{additionalProperties:!1}),Yf=U.Object({bytes:U.Integer({minimum:0}),lines:U.Integer({minimum:0})},{additionalProperties:!1}),Xf=U.Object({command:U.String(),cwd:U.String(),exitCode:U.Optional(U.Integer()),id:U.String({minLength:1}),output:U.Optional(U.String()),outputOmitted:Yf,status:Ef,type:U.Literal(`command`)},{additionalProperties:!1}),Zf=U.Object({command:U.String({minLength:1}),cwd:U.String({minLength:1}),id:U.String({minLength:1}),itemId:U.String({minLength:1})},{additionalProperties:!1}),Qf=U.Object({data:U.Array(Zf)},{additionalProperties:!1}),$f=U.Object({status:U.Literal(`terminated`),terminalId:U.String({minLength:1})},{additionalProperties:!1}),ep=U.Union([U.String(),U.Null()]),tp=U.Union([U.Number(),U.Null()]),np={description:ep,id:U.String({minLength:1}),required:U.Boolean(),title:U.String({minLength:1})},rp=U.Object({label:U.String({minLength:1}),value:U.String()},{additionalProperties:!1}),ip=U.Union([U.Object({...np,defaultValue:U.Union([U.String(),U.Null()]),format:U.Union([U.Literal(`email`),U.Literal(`uri`),U.Literal(`date`),U.Literal(`date-time`),U.Null()]),maxLength:U.Union([U.Integer({minimum:0}),U.Null()]),minLength:U.Union([U.Integer({minimum:0}),U.Null()]),type:U.Literal(`string`)},{additionalProperties:!1}),U.Object({...np,defaultValue:U.Union([U.String(),U.Null()]),options:U.Array(rp,{minItems:1}),type:U.Literal(`select`)},{additionalProperties:!1}),U.Object({...np,defaultValue:U.Array(U.String()),maximum:U.Union([U.Integer({minimum:0}),U.Null()]),minimum:U.Union([U.Integer({minimum:0}),U.Null()]),options:U.Array(rp,{minItems:1}),type:U.Literal(`multi_select`)},{additionalProperties:!1}),U.Object({...np,defaultValue:tp,maximum:tp,minimum:tp,type:U.Union([U.Literal(`number`),U.Literal(`integer`)])},{additionalProperties:!1}),U.Object({...np,defaultValue:U.Union([U.Boolean(),U.Null()]),type:U.Literal(`boolean`)},{additionalProperties:!1})]),ap=U.Record(U.String(),U.Union([U.String(),U.Number(),U.Boolean(),U.Array(U.String())])),op=U.Union([U.Object({action:U.Literal(`accept`),content:ap},{additionalProperties:!1}),U.Object({action:U.Union([U.Literal(`decline`),U.Literal(`cancel`)]),content:U.Null()},{additionalProperties:!1})]),sp=U.Union([U.Literal(`pending`),U.Literal(`resolved`),U.Literal(`expired`)]),cp=U.Union([U.Literal(`allow`),U.Literal(`allow_for_session`),U.Literal(`deny`)]),lp=U.Object({host:U.String({minLength:1}),protocol:U.Union([U.Literal(`http`),U.Literal(`https`),U.Literal(`socks5Tcp`),U.Literal(`socks5Udp`)])},{additionalProperties:!1}),up={createdAt:ef,expiresAt:tf,itemId:U.String({minLength:1}),projectId:U.String({minLength:1}),requestId:U.String({minLength:1}),status:sp,taskId:U.String({minLength:1}),turnId:U.String({minLength:1})},dp={itemId:U.String({minLength:1}),projectId:U.String({minLength:1}),taskId:U.String({minLength:1}),turnId:U.String({minLength:1})},fp=U.Object({description:U.String(),label:U.String({minLength:1})},{additionalProperties:!1}),pp={header:U.String({minLength:1}),id:U.String({minLength:1}),isSecret:U.Boolean(),prompt:U.String({minLength:1})},mp=U.Union([U.Object({...pp,isOther:U.Boolean(),options:U.Array(fp,{minItems:1}),type:U.Literal(`choice`)},{additionalProperties:!1}),U.Object({...pp,isOther:U.Literal(!0),options:U.Array(fp,{maxItems:0}),type:U.Literal(`choice`)},{additionalProperties:!1}),U.Object({...pp,isOther:U.Literal(!1),options:U.Array(fp,{maxItems:2,minItems:2}),type:U.Literal(`confirmation`)},{additionalProperties:!1}),U.Object({...pp,isOther:U.Boolean(),options:U.Array(fp,{maxItems:0}),type:U.Literal(`short_text`)},{additionalProperties:!1})]),hp=U.Object({...up,availableDecisions:U.Array(cp,{minItems:1}),grantRoot:U.Union([U.String(),U.Null()]),reason:U.Union([U.String(),U.Null()]),type:U.Literal(`file_change_approval`)},{additionalProperties:!1}),gp=U.Union([U.Literal(`network`),U.Literal(`file_system`)]),_p=U.Union([U.Literal(`read`),U.Literal(`write`),U.Literal(`deny`)]),vp=U.Union([U.Object({type:U.Literal(`path`),value:U.String({minLength:1})},{additionalProperties:!1}),U.Object({type:U.Literal(`glob`),value:U.String({minLength:1})},{additionalProperties:!1}),U.Object({kind:U.Union([U.Literal(`root`),U.Literal(`minimal`),U.Literal(`project_roots`),U.Literal(`tmpdir`),U.Literal(`slash_tmp`),U.Literal(`unknown`)]),path:U.Union([U.String({minLength:1}),U.Null()]),subpath:U.Union([U.String(),U.Null()]),type:U.Literal(`special`)},{additionalProperties:!1})]),yp=U.Object({entries:U.Array(U.Object({access:_p,path:vp},{additionalProperties:!1})),globScanMaxDepth:U.Union([U.Integer({minimum:0}),U.Null()]),read:U.Union([U.Array(U.String({minLength:1})),U.Null()]),write:U.Union([U.Array(U.String({minLength:1})),U.Null()])},{additionalProperties:!1}),bp=U.Object({fileSystem:U.Union([yp,U.Null()]),network:U.Union([U.Object({enabled:U.Union([U.Boolean(),U.Null()])},{additionalProperties:!1}),U.Null()])},{additionalProperties:!1}),xp=U.Object({...up,additionalPermissions:U.Optional(U.Union([bp,U.Null()])),availableDecisions:U.Array(cp,{minItems:1}),command:U.Union([U.String(),U.Null()]),cwd:U.Union([U.String(),U.Null()]),networkAccess:U.Union([lp,U.Null()]),reason:U.Union([U.String(),U.Null()]),type:U.Literal(`command_approval`)},{additionalProperties:!1}),Sp=U.Object({...up,cwd:U.String({minLength:1}),environmentId:U.Union([U.String({minLength:1}),U.Null()]),permissions:bp,reason:U.Union([U.String(),U.Null()]),type:U.Literal(`permissions_approval`)},{additionalProperties:!1}),Cp=U.Object({...up,questions:U.Array(mp,{minItems:1,maxItems:3}),type:U.Literal(`user_input`)},{additionalProperties:!1}),wp={...up,message:U.String({minLength:1}),serverName:U.String({minLength:1}),type:U.Literal(`mcp_elicitation`)},Tp=U.Object({...wp,fields:U.Array(ip),mode:U.Literal(`form`)},{additionalProperties:!1}),Ep=U.Object({...wp,mode:U.Literal(`url`),url:U.String({minLength:1})},{additionalProperties:!1}),Dp=U.Object({...wp,mode:U.Literal(`unsupported`)},{additionalProperties:!1}),Op=U.Union([Tp,Ep,Dp]),kp=U.Union([xp,hp,Sp,Cp,Op]);function Ap(e){return U.Union([U.Object({...xp.properties,status:U.Literal(e)},{additionalProperties:!1}),U.Object({...hp.properties,status:U.Literal(e)},{additionalProperties:!1}),U.Object({...Sp.properties,status:U.Literal(e)},{additionalProperties:!1}),U.Object({...Cp.properties,status:U.Literal(e)},{additionalProperties:!1}),U.Object({...Tp.properties,status:U.Literal(e)},{additionalProperties:!1}),U.Object({...Ep.properties,status:U.Literal(e)},{additionalProperties:!1}),U.Object({...Dp.properties,status:U.Literal(e)},{additionalProperties:!1})])}var jp=Ap(`pending`),Mp=Ap(`resolved`),Np=Ap(`expired`),Pp=U.Object({decision:cp},{additionalProperties:!1}),Fp=U.Object({answers:U.Record(U.String(),U.Array(U.String({minLength:1}),{maxItems:1,minItems:1}))},{additionalProperties:!1}),Ip=U.Object({grantedPermissions:U.Array(gp,{maxItems:2,uniqueItems:!0}),scope:U.Union([U.Literal(`turn`),U.Literal(`session`)])},{additionalProperties:!1});U.Union([U.Object({...dp,resolution:Pp,type:U.Literal(`command_approval`)},{additionalProperties:!1}),U.Object({...dp,resolution:Pp,type:U.Literal(`file_change_approval`)},{additionalProperties:!1}),U.Object({...dp,resolution:Ip,type:U.Literal(`permissions_approval`)},{additionalProperties:!1}),U.Object({...dp,resolution:Fp,type:U.Literal(`user_input`)},{additionalProperties:!1}),U.Object({...dp,resolution:op,type:U.Literal(`mcp_elicitation`)},{additionalProperties:!1})]);var Lp=U.Object({request:kp},{additionalProperties:!1}),Rp=U.Object({diff:U.String(),kind:U.Union([U.Literal(`create`),U.Literal(`update`),U.Literal(`delete`)]),path:U.String({minLength:1})},{additionalProperties:!1}),zp=U.String({maxLength:64,minLength:64,pattern:`^[a-f0-9]{64}$`}),Bp=U.String({maxLength:1024,minLength:1,pattern:`\\S`}),Vp=U.String({maxLength:1024,minLength:1,pattern:`^(?!\\.{1,2}$)(?!.*[\\u0000\\r\\n])[^/\\\\]+$`}),Hp=U.Array(W,{maxItems:500,minItems:1,uniqueItems:!0}),Up=U.String({maxLength:1e4,minLength:1,pattern:`\\S`}),Wp=U.Object({diff:U.String(),kind:U.Union([U.Literal(`create`),U.Literal(`update`),U.Literal(`delete`)]),path:W},{additionalProperties:!1}),Gp=U.Object({baseBranches:U.Array(U.String({minLength:1}),{uniqueItems:!0}),branch:U.Union([U.String({minLength:1}),U.Null()]),branches:U.Array(Bp,{uniqueItems:!0}),repositoryMode:U.Union([U.Literal(`root`),U.Literal(`children`),U.Literal(`none`)]),snapshot:zp,staged:U.Array(Wp),unstaged:U.Array(Wp)},{additionalProperties:!1});U.Object({includeDiff:U.Optional(U.Boolean()),repository:U.Optional(Vp),rootPath:Jd},{additionalProperties:!1});var Kp=U.Object({authoredAt:U.String({format:`date-time`}),authorEmail:U.String({maxLength:320,minLength:1}),authorName:U.String({maxLength:512,minLength:1,pattern:`\\S`}),sha:U.String({maxLength:64,minLength:40,pattern:`^[a-f0-9]+$`}),title:U.String({maxLength:1e4,minLength:1,pattern:`\\S`})},{additionalProperties:!1}),qp=U.String({maxLength:20,minLength:1,pattern:`^[0-9]+$`});U.Object({cursor:U.Optional(qp),repository:U.Optional(W),rootPath:Jd},{additionalProperties:!1});var Jp=U.Object({branch:U.Union([Bp,U.Null()]),commits:U.Array(Kp,{maxItems:20}),nextCursor:U.Union([qp,U.Null()]),repositories:U.Array(W,{maxItems:256,uniqueItems:!0}),repository:U.Union([W,U.Null()]),repositoryMode:U.Union([U.Literal(`root`),U.Literal(`children`)])},{additionalProperties:!1}),Yp=U.String({maxLength:64,minLength:40,pattern:`^[a-f0-9]+$`}),Xp=U.String({maxLength:20,minLength:1,pattern:`^[0-9]+$`});U.Object({cursor:U.Optional(Xp),repository:U.Optional(W),rootPath:Jd,sha:Yp},{additionalProperties:!1});var Zp=U.Object({kind:U.Union([U.Literal(`create`),U.Literal(`update`),U.Literal(`delete`)]),path:W},{additionalProperties:!1}),Qp=U.Object({files:U.Array(Zp,{maxItems:100}),nextCursor:U.Union([Xp,U.Null()])},{additionalProperties:!1});U.Object({path:W,repository:U.Optional(W),rootPath:Jd,sha:Yp},{additionalProperties:!1});var $p=U.Object({diff:U.String({maxLength:512*1024}),truncated:U.Boolean()},{additionalProperties:!1});U.Object({branch:Bp,expectedSnapshot:zp},{additionalProperties:!1}),U.Object({branch:Bp,expectedSnapshot:zp},{additionalProperties:!1});var em=U.Object({branch:U.Union([Bp,U.Null()]),current:U.Boolean(),path:lf},{additionalProperties:!1}),tm=U.Object({worktrees:U.Array(em,{maxItems:256})},{additionalProperties:!1});U.Object({branch:Bp,expectedSnapshot:zp},{additionalProperties:!1}),U.Object({path:lf},{additionalProperties:!1});var nm=U.Object({project:cf,worktree:em},{additionalProperties:!1});U.Object({expectedSnapshot:zp,paths:Hp,repository:U.Optional(Vp)},{additionalProperties:!1});var rm=U.Object({message:Up,snapshot:zp},{additionalProperties:!1});U.Object({action:U.Union([U.Literal(`commit`),U.Literal(`commit_and_push`)]),expectedSnapshot:zp,message:Up,paths:Hp,repository:U.Optional(Vp)},{additionalProperties:!1});var im=U.Object({branch:U.Union([U.String({minLength:1}),U.Null()]),commitSha:U.String({maxLength:64,minLength:7,pattern:`^[a-f0-9]+$`}),message:Up,pushError:U.Union([U.String({minLength:1}),U.Null()]),pushStatus:U.Union([U.Literal(`not_requested`),U.Literal(`pushed`),U.Literal(`failed`),U.Literal(`not_configured`)])},{additionalProperties:!1}),am=U.Object({path:W,type:U.Union([U.Literal(`directory`),U.Literal(`file`)])},{additionalProperties:!1});U.Object({path:U.Optional(W),rootPath:U.Optional(Jd)},{additionalProperties:!1});var om=U.Object({entries:U.Array(am),path:U.Union([W,U.Null()])},{additionalProperties:!1}),sm=U.String({maxLength:255,minLength:1,pattern:`^(?!\\.\\.?$)[^/\\\\\\u0000\\r\\n]+$`});U.Object({name:sm,path:W},{additionalProperties:!1});var cm=U.Object({path:W},{additionalProperties:!1});U.Object({path:W},{additionalProperties:!1});var lm=U.Object({path:W,status:U.Literal(`deleted`)},{additionalProperties:!1});U.Object({cursor:U.Optional(U.Integer({minimum:0})),path:sf,rootPath:U.Optional(Jd)},{additionalProperties:!1});var um=U.Object({content:U.String(),nextCursor:U.Union([U.Integer({minimum:0}),U.Null()]),path:sf},{additionalProperties:!1}),dm=U.Object({changes:U.Array(Rp),id:U.String({minLength:1}),status:Ef,type:U.Literal(`file_change`)},{additionalProperties:!1}),fm=U.Object({id:U.String({minLength:1}),input:U.Optional(U.Unknown()),name:U.String({minLength:1}),output:U.Optional(U.Unknown()),progress:U.Optional(U.String({maxLength:8192})),status:Ef,type:U.Literal(`tool`)},{additionalProperties:!1}),pm=U.Object({fasterModel:U.Optional(U.String({minLength:1})),id:U.String({minLength:1}),kind:U.Literal(`safety_buffering`),model:U.String({minLength:1}),status:Ef,type:U.Literal(`runtime_status`)},{additionalProperties:!1}),mm=U.Object({fromModel:U.String({minLength:1}),id:U.String({minLength:1}),kind:U.Literal(`model_rerouted`),status:U.Literal(`completed`),toModel:U.String({minLength:1}),type:U.Literal(`runtime_status`)},{additionalProperties:!1}),hm=U.Object({detail:U.Optional(U.String({maxLength:8192})),durationMs:U.Optional(U.Integer({minimum:0})),eventName:U.String({minLength:1}),id:U.String({minLength:1}),kind:U.Literal(`hook`),status:Ef,type:U.Literal(`runtime_status`)},{additionalProperties:!1}),gm=U.Union([pm,mm,hm]),_m=U.Object({id:U.String({minLength:1}),text:U.String(),type:U.Literal(`plan`)},{additionalProperties:!1}),vm=U.Object({detail:U.Optional(U.String()),id:U.String({minLength:1}),label:U.String({minLength:1}),status:U.Optional(Ef),transient:U.Optional(U.Boolean()),type:U.Literal(`activity`)},{additionalProperties:!1}),ym=U.Union([U.Literal(`in_progress`),U.Literal(`approved`),U.Literal(`denied`),U.Literal(`timed_out`),U.Literal(`aborted`)]),bm=U.Object({detail:U.String(),type:U.Union([U.Literal(`command`),U.Literal(`file_change`),U.Literal(`network_access`),U.Literal(`mcp_tool_call`),U.Literal(`permissions`)])},{additionalProperties:!1}),xm=U.Object({action:bm,id:U.String({minLength:1}),rationale:U.Optional(U.String()),riskLevel:U.Optional(U.Union([U.Literal(`low`),U.Literal(`medium`),U.Literal(`high`),U.Literal(`critical`)])),status:ym,targetItemId:U.Optional(U.String({minLength:1})),type:U.Literal(`approval_review`),userAuthorization:U.Optional(U.Union([U.Literal(`unknown`),U.Literal(`low`),U.Literal(`medium`),U.Literal(`high`)]))},{additionalProperties:!1}),Sm=U.Union([U.Object({type:U.Literal(`uncommitted_changes`)},{additionalProperties:!1}),U.Object({branch:U.String({minLength:1}),type:U.Literal(`base_branch`)},{additionalProperties:!1}),U.Object({sha:U.String({minLength:1}),title:U.Optional(U.String({minLength:1})),type:U.Literal(`commit`)},{additionalProperties:!1}),U.Object({instructions:U.String({minLength:1}),type:U.Literal(`custom`)},{additionalProperties:!1})]),Cm=U.Object({id:U.String({minLength:1}),target:Sm,type:U.Literal(`review`)},{additionalProperties:!1}),wm=U.Union([qf,Jf,Xf,dm,fm,_m,vm,xm,Cm,gm]),Tm=U.Union([U.Literal(`running`),U.Literal(`completed`),U.Literal(`failed`),U.Literal(`interrupted`)]),Em=U.Object({completedAt:tf,error:U.Union([U.String(),U.Null()]),id:U.String({minLength:1}),items:U.Array(wm),startedAt:tf,status:Tm},{additionalProperties:!1}),Dm=U.Object({id:U.String({minLength:1}),kind:Vf,mediaType:Bf,name:U.String({maxLength:255,minLength:1}),size:U.Integer({maximum:Nf,minimum:1})},{additionalProperties:!1}),Om=U.Object({attachment:Dm},{additionalProperties:!1}),km=U.Union([U.Literal(`user`),U.Literal(`repo`),U.Literal(`system`),U.Literal(`admin`)]),Am=U.Object({description:U.String(),displayName:U.String({minLength:1}),id:U.String({minLength:1}),name:U.String({minLength:1}),scope:km},{additionalProperties:!1}),jm=U.Union([U.Literal(`starting`),U.Literal(`ready`),U.Literal(`failed`),U.Literal(`cancelled`)]),Mm=U.Union([U.Literal(`unknown`),U.Literal(`unsupported`),U.Literal(`notLoggedIn`),U.Literal(`bearerToken`),U.Literal(`oAuth`)]),Nm=U.Literal(`reauthenticationRequired`),Pm=U.Object({authStatus:U.Union([Mm,U.Null()]),description:U.Union([U.String(),U.Null()]),error:U.Union([U.String({maxLength:8192}),U.Null()]),failureReason:U.Union([Nm,U.Null()]),name:U.String({minLength:1}),status:jm,title:U.Union([U.String(),U.Null()]),tools:U.Array(U.String({minLength:1}),{uniqueItems:!0}),version:U.Union([U.String(),U.Null()])},{additionalProperties:!1}),Fm=U.Object({data:U.Array(Pm,{uniqueItems:!0})},{additionalProperties:!1}),Im=U.Object({id:U.String({minLength:1}),name:U.String({minLength:1})},{additionalProperties:!1}),Lm=U.Object({id:U.String({minLength:1})},{additionalProperties:!1}),Rm={attachments:U.Array(Lm),skills:U.Array(Im),text:U.String({maxLength:1e5}),type:U.Literal(`prompt`)},zm=U.Union([U.Object({...Rm,text:U.String({maxLength:1e5,minLength:1})},{additionalProperties:!1}),U.Object({...Rm,attachments:U.Array(Lm,{minItems:1})},{additionalProperties:!1}),U.Object({...Rm,skills:U.Array(Im,{minItems:1})},{additionalProperties:!1})]),Bm=U.Union([U.Literal(`editing`),U.Literal(`queued`)]),Vm=U.Object({attachments:U.Array(Wf,{maxItems:Pf}),clientUserMessageId:U.String({minLength:1}),id:U.String({minLength:1}),skills:U.Array(Im),status:Bm,text:U.String({maxLength:1e5})},{additionalProperties:!1}),Hm=U.Object({data:U.Array(Vm),nextCursor:U.Union([U.String({minLength:1}),U.Null()])},{additionalProperties:!1}),Um=U.Union([U.Literal(`active`),U.Literal(`paused`),U.Literal(`blocked`),U.Literal(`usage_limited`),U.Literal(`budget_limited`),U.Literal(`complete`)]),Wm=U.Object({createdAt:ef,objective:U.String({maxLength:4e3,minLength:1}),status:Um,timeUsedSeconds:U.Integer({minimum:0}),tokenBudget:U.Union([U.Integer({minimum:0}),U.Null()]),tokensUsed:U.Integer({minimum:0}),updatedAt:ef},{additionalProperties:!1});U.Object({status:U.Union([U.Literal(`active`),U.Literal(`paused`)])},{additionalProperties:!1});var Gm=U.Object({goal:Wm},{additionalProperties:!1}),Km=U.Object({cleared:U.Boolean()},{additionalProperties:!1}),qm=`gpt-5.6-luna`,Jm=U.Object({mcp_elicitations:U.Boolean(),request_permissions:U.Boolean(),rules:U.Boolean(),sandbox_approval:U.Boolean(),skill_approval:U.Boolean()},{additionalProperties:!1}),Ym=U.Object({granular:Jm},{additionalProperties:!1}),Xm=U.Union([U.Literal(`on-request`),Ym,U.Literal(`never`)]),Zm=U.Union([U.Literal(`untrusted`),U.Literal(`on-request`),Ym,U.Literal(`never`)]),Qm=U.Union([U.Literal(`user`),U.Literal(`auto_review`)]),$m=U.Union([U.Literal(`read-only`),U.Literal(`workspace-write`),U.Literal(`danger-full-access`)]),eh={model:U.String({minLength:1}),reasoningEffort:U.String({minLength:1}),sandboxMode:$m},th=U.Object({approvalPolicy:Zm,approvalsReviewer:Qm,...eh},{additionalProperties:!1}),nh=U.Literal(`plan`),rh={commitMessageModel:U.String({minLength:1}),commitMessagePrompt:U.String({maxLength:4e3}),defaultOpenAppId:U.Union([U.Exclude(_f,U.Literal(`system-default`)),U.Null()]),fastMode:U.Boolean(),followUpBehavior:U.Union([U.Literal(`queue`),U.Literal(`steer`)]),pet:Fd,...eh},ih=U.Object({approvalPolicy:Xm,approvalsReviewer:Qm,...rh},{additionalProperties:!1}),ah=U.Object({settings:ih},{additionalProperties:!1}),oh=U.Object({approvalPolicy:Zm,approvalsReviewer:Qm,fastMode:U.Boolean(),...eh},{additionalProperties:!1}),sh=U.Object({settings:oh},{additionalProperties:!1}),ch=U.Object({settings:th},{additionalProperties:!1}),lh={collaborationMode:U.Optional(nh),fastMode:U.Optional(U.Literal(!0)),goalMode:U.Optional(U.Literal(!0)),...eh},uh=U.Object({approvalPolicy:Zm,approvalsReviewer:Qm,...lh},{additionalProperties:!1}),dh=U.Object({description:U.String(),id:U.String({minLength:1})},{additionalProperties:!1}),fh=U.Object({defaultReasoningEffort:U.String({minLength:1}),description:U.String(),displayName:U.String({minLength:1}),id:U.String({minLength:1}),isDefault:U.Boolean(),supportedReasoningEfforts:U.Array(dh,{minItems:1})},{additionalProperties:!1}),ph=U.Object({contextWindow:U.Union([U.Integer({minimum:1}),U.Null()]),usedTokens:U.Integer({minimum:0})},{additionalProperties:!1}),mh=`temporary`,hh=`/v1/temporary`,gh=U.Union([U.Literal(`pending`),U.Literal(`in_progress`),U.Literal(`completed`)]),_h=U.Object({status:gh,text:U.String({minLength:1})},{additionalProperties:!1}),vh=U.Object({explanation:U.Union([U.String(),U.Null()]),steps:U.Array(_h)},{additionalProperties:!1}),yh=U.Object({contextUsage:U.Union([ph,U.Null()]),goal:U.Union([Wm,U.Null()]),id:U.String({minLength:1}),plan:U.Union([vh,U.Null()]),pendingRequests:U.Array(jp),pinned:U.Boolean(),projectId:U.String({minLength:1}),settings:th,status:U.Union([U.Literal(`idle`),U.Literal(`running`),U.Literal(`failed`)]),title:U.String({minLength:1}),turns:U.Array(Em),turnsNextCursor:U.Union([U.String({minLength:1}),U.Null()]),updatedAt:ef},{additionalProperties:!1});function bh(e){return U.Object({data:U.Array(e),nextCursor:U.Union([U.String(),U.Null()])},{additionalProperties:!1})}var xh=bh(cf),Sh=xh,Ch=bh(Tf),wh=bh(fh),Th=bh(Am),Eh=U.Object({status:U.Literal(`ok`),version:U.Literal(1)},{additionalProperties:!1}),Dh=U.Object({feedback:U.Object({upload:U.Boolean()},{additionalProperties:!1}),goals:U.Object({clear:U.Boolean(),read:U.Boolean(),update:U.Boolean()},{additionalProperties:!1}),provider:U.String({minLength:1}),skills:U.Object({list:U.Boolean(),use:U.Boolean()},{additionalProperties:!1}),tasks:U.Object({fork:U.Boolean(),list:U.Boolean(),read:U.Boolean(),start:U.Boolean()},{additionalProperties:!1}),turns:U.Object({compact:U.Boolean(),interrupt:U.Boolean(),review:U.Boolean(),start:U.Boolean(),steer:U.Boolean()},{additionalProperties:!1})},{additionalProperties:!1}),Oh=U.Union([U.Literal(`official`),U.Literal(`custom`)]),kh=U.Union([U.Literal(`disconnected`),U.Literal(`pending`),U.Literal(`connected`),U.Literal(`failed`)]),Ah=U.Union([U.Object({email:U.Union([U.String({maxLength:320}),U.Null()]),planType:U.Union([U.String({maxLength:64}),U.Null()]),type:U.Literal(`chatgpt`)},{additionalProperties:!1}),U.Object({type:U.Literal(`apiKey`)},{additionalProperties:!1})]),jh=U.Object({error:U.Union([U.String({maxLength:1e3}),U.Null()]),loginId:U.String({maxLength:256,minLength:1}),state:U.Union([U.Literal(`pending`),U.Literal(`failed`)])},{additionalProperties:!1}),Mh=U.Object({account:U.Union([Ah,U.Null()]),customBaseUrl:U.Union([U.String({maxLength:2048,minLength:1}),U.Null()]),mode:Oh,pendingLogin:U.Union([jh,U.Null()]),state:kh},{additionalProperties:!1});U.Object({},{additionalProperties:!1});var Nh=U.Object({authUrl:U.String({maxLength:8192,minLength:1}),loginId:U.String({maxLength:256,minLength:1}),status:Mh},{additionalProperties:!1});U.Object({apiKey:U.Optional(U.String({maxLength:16384,minLength:1})),baseUrl:U.String({maxLength:2048,minLength:1}),models:U.Optional(U.Array(U.Object({id:U.String({maxLength:256,minLength:1,pattern:`.*\\S.*`}),name:U.String({maxLength:256,minLength:1,pattern:`.*\\S.*`})},{additionalProperties:!1}),{maxItems:1e3}))},{additionalProperties:!1});var Ph=U.Object({models:wh,status:Mh},{additionalProperties:!1});U.Object({loginId:U.String({maxLength:256,minLength:1})},{additionalProperties:!1});var Fh=U.Object({status:Mh},{additionalProperties:!1});U.Object({customBaseUrl:U.Union([U.String({maxLength:2048,minLength:1}),U.Null()]),customModels:U.Union([wh,U.Null()]),mode:Oh,updatedAt:ef},{additionalProperties:!1});function Ih(e){return e.mode===`official`&&e.state===`connected`&&e.account?.type===`chatgpt`}var Lh=U.Object({sequence:U.Integer({minimum:0}),sessionId:U.String({minLength:1})},{additionalProperties:!1});U.Object({},{additionalProperties:!1});var Rh=U.Object({task:Tf},{additionalProperties:!1});U.Object({pinned:U.Boolean()},{additionalProperties:!1});var zh=U.Object({task:Tf},{additionalProperties:!1});U.Object({title:U.String({maxLength:200,minLength:1,pattern:`\\S`})},{additionalProperties:!1});var Bh=U.Object({task:Tf},{additionalProperties:!1});U.Object({},{additionalProperties:!1});var Vh=U.Object({status:U.Literal(`archived`),taskId:U.String({minLength:1})},{additionalProperties:!1});U.Object({},{additionalProperties:!1});var Hh=U.Object({task:Tf},{additionalProperties:!1});U.Object({},{additionalProperties:!1});var Uh=U.Object({status:U.Literal(`deleted`),taskId:U.String({minLength:1})},{additionalProperties:!1}),Wh=U.Object({status:U.Union([U.Literal(`busy`),U.Literal(`notLoaded`),U.Literal(`notSubscribed`),U.Literal(`unsubscribed`)]),taskId:U.String({minLength:1})},{additionalProperties:!1});U.Object({target:Of},{additionalProperties:!1});var Gh=U.Object({taskId:U.String({minLength:1}),turn:Em},{additionalProperties:!1});U.Object({},{additionalProperties:!1});var Kh=U.Object({status:U.Literal(`compacting`),taskId:U.String({minLength:1})},{additionalProperties:!1});U.Object({lastTurnId:U.Optional(U.String({minLength:1}))},{additionalProperties:!1});var qh=U.Object({task:Tf},{additionalProperties:!1});U.Object({},{additionalProperties:!1});var Jh=Fm;U.Object({classification:U.String({maxLength:100,minLength:1}),includeLogs:U.Boolean(),reason:U.String({maxLength:4e3,minLength:1})},{additionalProperties:!1});var Yh=U.Object({status:U.Literal(`sent`),taskId:U.String({minLength:1})},{additionalProperties:!1});U.Object({input:zm,options:uh},{additionalProperties:!1});var Xh=U.Object({checkpoint:Lh,taskId:U.String({minLength:1}),turn:Em},{additionalProperties:!1});U.Object({input:zm,taskId:U.String({minLength:1})},{additionalProperties:!1});var Zh=U.Object({status:U.Literal(`accepted`),taskId:U.String({minLength:1}),turnId:U.String({minLength:1})},{additionalProperties:!1});U.Object({clientUserMessageId:U.String({minLength:1}),input:zm},{additionalProperties:!1});var Qh=U.Object({queuedSubmission:Vm},{additionalProperties:!1});U.Object({input:zm,status:U.Union([U.Literal(`editing`),U.Literal(`queued`)])},{additionalProperties:!1});var $h=Qh,eg=U.Object({deleted:U.Boolean()},{additionalProperties:!1});U.Object({queuedSubmissionIds:U.Array(U.String({minLength:1}),{uniqueItems:!0})},{additionalProperties:!1});var tg=U.Object({status:U.Literal(`reordered`)},{additionalProperties:!1});U.Object({queuedSubmissionId:U.Optional(U.String({minLength:1}))},{additionalProperties:!1});var ng=U.Object({taskId:U.String({minLength:1}),turn:Em},{additionalProperties:!1});U.Object({taskId:U.String({minLength:1})},{additionalProperties:!1});var rg=U.Object({status:U.Literal(`interrupting`),taskId:U.String({minLength:1}),turnId:U.String({minLength:1})},{additionalProperties:!1}),ig=U.Union([U.Literal(`ACCESS_DENIED`),U.Literal(`IDEMPOTENCY_KEY_REQUIRED`),U.Literal(`IDEMPOTENCY_CONFLICT`),U.Literal(`IDEMPOTENCY_CAPACITY_EXCEEDED`),U.Literal(`INVALID_REQUEST`),U.Literal(`PROJECT_NOT_FOUND`),U.Literal(`PROJECT_FILE_NOT_FOUND`),U.Literal(`PROJECT_FILE_CONFLICT`),U.Literal(`PROJECT_FILE_MUTATION_FAILED`),U.Literal(`TASK_NOT_FOUND`),U.Literal(`TURN_NOT_FOUND`),U.Literal(`TURN_NOT_RUNNING`),U.Literal(`ATTACHMENT_NOT_FOUND`),U.Literal(`PENDING_REQUEST_NOT_FOUND`),U.Literal(`PENDING_REQUEST_EXPIRED`),U.Literal(`PENDING_REQUEST_ALREADY_RESOLVED`),U.Literal(`PENDING_REQUEST_MISMATCH`),U.Literal(`PAIRING_FAILED`),U.Literal(`PAIRING_RATE_LIMITED`),U.Literal(`GIT_STATUS_CHANGED`),U.Literal(`GIT_REPOSITORY_UNAVAILABLE`),U.Literal(`GIT_PATH_UNAVAILABLE`),U.Literal(`GIT_COMMIT_FAILED`),U.Literal(`GIT_BRANCH_ALREADY_ACTIVE`),U.Literal(`GIT_BRANCH_ALREADY_EXISTS`),U.Literal(`GIT_BRANCH_CREATE_FAILED`),U.Literal(`GIT_BRANCH_INVALID`),U.Literal(`GIT_BRANCH_NOT_FOUND`),U.Literal(`GIT_BRANCH_SWITCH_FAILED`),U.Literal(`GIT_WORKTREE_ALREADY_ACTIVE`),U.Literal(`GIT_WORKTREE_CREATE_FAILED`),U.Literal(`GIT_WORKTREE_NOT_FOUND`),U.Literal(`GIT_MUTATION_IN_PROGRESS`),U.Literal(`GIT_REPOSITORY_READ_ONLY`),U.Literal(`COMMIT_MESSAGE_GENERATION_FAILED`),U.Literal(`UPDATE_NOT_AVAILABLE`),U.Literal(`UPDATE_CHECK_FAILED`),U.Literal(`UPDATE_INSTALL_FAILED`),U.Literal(`PET_NOT_FOUND`),U.Literal(`PET_ASSET_INVALID`),U.Literal(`PET_DOWNLOAD_FAILED`),U.Literal(`PROVIDER_ERROR`)]),ag=U.Object({code:ig,message:U.String({minLength:1}),retryable:U.Boolean()},{additionalProperties:!1}),og=U.String({minLength:1}),sg=U.Integer({minimum:0}),cg=U.String({format:`date-time`}),lg={originalByteLength:U.Integer({minimum:0}),truncated:U.Boolean()},ug={provider:U.String({minLength:1}),sequence:sg,sessionId:og,taskId:U.String({minLength:1}),timestamp:cg,version:U.Literal(2)};function G(e){return U.Object({...ug,...e},{additionalProperties:!1})}var dg=G({payload:U.Object({turn:Em},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`turn.started`)}),fg=G({itemId:U.String({minLength:1}),payload:U.Object({delta:U.String()},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`message.delta`)}),pg=G({itemId:U.String({minLength:1}),payload:U.Object({delta:U.String(),field:U.Union([U.Literal(`content`),U.Literal(`summary`)]),sectionIndex:U.Optional(U.Integer({minimum:0}))},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`reasoning.delta`)}),mg=G({itemId:U.String({minLength:1}),payload:U.Object({delta:U.String()},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`plan.delta`)}),hg=G({itemId:U.String({minLength:1}),payload:U.Object({message:U.String({maxLength:8192})},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`tool.progress`)}),gg=G({itemId:U.String({minLength:1}),payload:U.Object({changes:U.Array(Rp,{maxItems:100}),...lg},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`file_change.updated`)}),_g=G({payload:U.Object({code:U.Union([U.Literal(`runtime_warning`),U.Literal(`guardian_warning`),U.Literal(`strict_review_required`),U.Literal(`model_verification`),U.Literal(`hook_status`)]),level:U.Union([U.Literal(`info`),U.Literal(`warning`)]),message:U.String({maxLength:8192,minLength:1})},{additionalProperties:!1}),type:U.Literal(`task.notice`)}),vg=G({payload:U.Object({error:U.Union([U.String({maxLength:8192}),U.Null()]),failureReason:U.Union([Nm,U.Null()]),name:U.String({minLength:1}),status:jm},{additionalProperties:!1}),type:U.Literal(`mcp_server.status_updated`)}),yg=G({payload:U.Object({status:U.Union([U.Literal(`idle`),U.Literal(`running`),U.Literal(`failed`)])},{additionalProperties:!1}),type:U.Literal(`task.status_updated`)}),bg=G({payload:U.Object({},{additionalProperties:!1}),type:U.Literal(`task.metadata_changed`)}),xg=G({payload:U.Object({reason:U.Union([U.Literal(`archived`),U.Literal(`deleted`)])},{additionalProperties:!1}),type:U.Literal(`task.removed`)}),Sg=G({payload:U.Object({},{additionalProperties:!1}),type:U.Literal(`skills.changed`)}),Cg=G({payload:U.Object({},{additionalProperties:!1}),type:U.Literal(`queue.changed`)}),wg=G({payload:U.Object({rootPath:U.String({minLength:1})},{additionalProperties:!1}),type:U.Literal(`project.git_metadata_changed`)}),Tg=G({itemId:U.String({minLength:1}),payload:U.Object({delta:U.String()},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`command.output_delta`)}),Eg=G({itemId:U.String({minLength:1}),payload:U.Object({item:wm},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`item.completed`)}),Dg=G({itemId:U.String({minLength:1}),payload:U.Object({item:wm},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`item.started`)}),Og=G({payload:U.Object({turn:Em},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`turn.completed`)}),kg=G({payload:U.Object({code:U.Optional(U.Union([U.Literal(`context_window_exceeded`),U.Literal(`session_budget_exceeded`),U.Literal(`usage_limit_exceeded`),U.Literal(`server_overloaded`),U.Literal(`policy_blocked`),U.Literal(`connection_failed`),U.Literal(`internal_error`),U.Literal(`unauthorized`),U.Literal(`bad_request`),U.Literal(`sandbox_error`),U.Literal(`other`)])),httpStatusCode:U.Optional(U.Integer({maximum:599,minimum:100})),message:U.String({minLength:1}),willRetry:U.Boolean()},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`provider.error`)}),Ag=G({payload:U.Object({usage:ph},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`usage.updated`)}),jg=G({payload:U.Object({plan:vh},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`plan.updated`)}),Mg=G({payload:U.Object({goal:Wm},{additionalProperties:!1}),type:U.Literal(`goal.updated`)}),Ng=G({payload:U.Object({},{additionalProperties:!1}),type:U.Literal(`goal.cleared`)});function Pg(e,t){return G({itemId:U.String({minLength:1}),payload:U.Object({request:t},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(e)})}var Fg=Pg(`pending_request.created`,jp),Ig=Pg(`pending_request.resolved`,Mp),Lg=Pg(`pending_request.expired`,Np),Rg=U.Union([dg,fg,pg,Tg,mg,hg,gg,Dg,Eg,Og,Ag,jg,Mg,Ng,kg,_g,vg,yg,bg,xg,Sg,Cg,wg,Fg,Ig,Lg]),zg=U.Object({events:U.Array(Rg,{maxItems:64,minItems:1}),type:U.Literal(`events.batch`),version:U.Literal(3)},{additionalProperties:!1}),Bg=U.Object({latestSequence:sg,sessionId:og,type:U.Literal(`connection.ready`),version:U.Literal(3)},{additionalProperties:!1}),Vg=U.Object({latestSequence:sg,reason:U.Union([U.Literal(`event_retention_exceeded`),U.Literal(`session_changed`),U.Literal(`sequence_gap`)]),sessionId:og,type:U.Literal(`resync.required`),version:U.Literal(3)},{additionalProperties:!1}),Hg=U.Union([Bg,Vg,zg]),Ug=U.Object({checkpoint:Lh,snapshot:yh},{additionalProperties:!1}),Wg=class extends gn{constructor(e){super(`Unable to dereference schema with $id '${e.$ref}'`),this.schema=e}};function Gg(e,t){let n=t.find(t=>t.$id===e.$ref);if(n===void 0)throw new Wg(e);return qg(n,t)}function Kg(e,t){return!on(e.$id)||t.some(t=>t.$id===e.$id)||t.push(e),t}function qg(e,t){return e[C]===`This`||e[C]===`Ref`?Gg(e,t):e}var Jg=class extends gn{constructor(e){super(`Unable to hash value`),this.value=e}},Yg;(function(e){e[e.Undefined=0]=`Undefined`,e[e.Null=1]=`Null`,e[e.Boolean=2]=`Boolean`,e[e.Number=3]=`Number`,e[e.String=4]=`String`,e[e.Object=5]=`Object`,e[e.Array=6]=`Array`,e[e.Date=7]=`Date`,e[e.Uint8Array=8]=`Uint8Array`,e[e.Symbol=9]=`Symbol`,e[e.BigInt=10]=`BigInt`})(Yg||={});var Xg=BigInt(`14695981039346656037`),[Zg,Qg]=[BigInt(`1099511628211`),BigInt(`18446744073709551616`)],$g=Array.from({length:256}).map((e,t)=>BigInt(t)),e_=new Float64Array(1),t_=new DataView(e_.buffer),n_=new Uint8Array(e_.buffer);function*r_(e){let t=e===0?1:Math.ceil(Math.floor(Math.log2(e)+1)/8);for(let n=0;n<t;n++)yield e>>8*(t-1-n)&255}function i_(e){K(Yg.Array);for(let t of e)h_(t)}function a_(e){K(Yg.Boolean),K(+!!e)}function o_(e){K(Yg.BigInt),t_.setBigInt64(0,e);for(let e of n_)K(e)}function s_(e){K(Yg.Date),h_(e.getTime())}function c_(e){K(Yg.Null)}function l_(e){K(Yg.Number),t_.setFloat64(0,e);for(let e of n_)K(e)}function u_(e){K(Yg.Object);for(let t of globalThis.Object.getOwnPropertyNames(e).sort())h_(t),h_(e[t])}function d_(e){K(Yg.String);for(let t=0;t<e.length;t++)for(let n of r_(e.charCodeAt(t)))K(n)}function f_(e){K(Yg.Symbol),h_(e.description)}function p_(e){K(Yg.Uint8Array);for(let t=0;t<e.length;t++)K(e[t])}function m_(e){return K(Yg.Undefined)}function h_(e){if(Qt(e))return i_(e);if(tn(e))return a_(e);if(an(e))return o_(e);if(Yt(e))return s_(e);if(en(e))return c_(e);if(nn(e))return l_(e);if(Zt(e))return u_(e);if(on(e))return d_(e);if(cn(e))return f_(e);if(Xt(e))return p_(e);if($t(e))return m_(e);throw new Jg(e)}function K(e){Xg^=$g[e],Xg=Xg*Zg%Qg}function g_(e){return Xg=BigInt(`14695981039346656037`),h_(e),Xg}var __=class extends gn{constructor(e){super(`Unknown type`),this.schema=e}};function v_(e){return e[C]===`Any`||e[C]===`Unknown`}function q(e){return e!==void 0}function y_(e,t,n){return!0}function b_(e,t,n){return!0}function x_(e,t,n){if(!Qt(n)||q(e.minItems)&&!(n.length>=e.minItems)||q(e.maxItems)&&!(n.length<=e.maxItems))return!1;for(let r of n)if(!J(e.items,t,r))return!1;if(e.uniqueItems===!0&&!(function(){let e=new Set;for(let t of n){let n=g_(t);if(e.has(n))return!1;e.add(n)}return!0})())return!1;if(!(q(e.contains)||nn(e.minContains)||nn(e.maxContains)))return!0;let r=q(e.contains)?e.contains:N(),i=n.reduce((e,n)=>J(r,t,n)?e+1:e,0);return!(i===0||nn(e.minContains)&&i<e.minContains||nn(e.maxContains)&&i>e.maxContains)}function S_(e,t,n){return Kt(n)}function C_(e,t,n){return!(!an(n)||q(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)||q(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)||q(e.maximum)&&!(n<=e.maximum)||q(e.minimum)&&!(n>=e.minimum)||q(e.multipleOf)&&n%e.multipleOf!==BigInt(0))}function w_(e,t,n){return tn(n)}function T_(e,t,n){return J(e.returns,t,n.prototype)}function E_(e,t,n){return!(!Yt(n)||q(e.exclusiveMaximumTimestamp)&&!(n.getTime()<e.exclusiveMaximumTimestamp)||q(e.exclusiveMinimumTimestamp)&&!(n.getTime()>e.exclusiveMinimumTimestamp)||q(e.maximumTimestamp)&&!(n.getTime()<=e.maximumTimestamp)||q(e.minimumTimestamp)&&!(n.getTime()>=e.minimumTimestamp)||q(e.multipleOfTimestamp)&&n.getTime()%e.multipleOfTimestamp!==0)}function D_(e,t,n){return sn(n)}function O_(e,t,n){let r=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];return J(i,[...t,...r],n)}function k_(e,t,n){return!(!rn(n)||q(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)||q(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)||q(e.maximum)&&!(n<=e.maximum)||q(e.minimum)&&!(n>=e.minimum)||q(e.multipleOf)&&n%e.multipleOf!==0)}function A_(e,t,n){let r=e.allOf.every(e=>J(e,t,n));if(e.unevaluatedProperties===!1){let t=new RegExp(Yo(e)),i=Object.getOwnPropertyNames(n).every(e=>t.test(e));return r&&i}else if(sr(e.unevaluatedProperties)){let i=new RegExp(Yo(e)),a=Object.getOwnPropertyNames(n).every(r=>i.test(r)||J(e.unevaluatedProperties,t,n[r]));return r&&a}else return r}function j_(e,t,n){return qt(n)}function M_(e,t,n){return n===e.const}function N_(e,t,n){return!1}function P_(e,t,n){return!J(e.not,t,n)}function F_(e,t,n){return en(n)}function I_(e,t,n){return!(!ln.IsNumberLike(n)||q(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)||q(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)||q(e.minimum)&&!(n>=e.minimum)||q(e.maximum)&&!(n<=e.maximum)||q(e.multipleOf)&&n%e.multipleOf!==0)}function L_(e,t,n){if(!ln.IsObjectLike(n)||q(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)||q(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties))return!1;let r=Object.getOwnPropertyNames(e.properties);for(let i of r){let r=e.properties[i];if(e.required&&e.required.includes(i)){if(!J(r,t,n[i])||(Uc(r)||v_(r))&&!(i in n))return!1}else if(ln.IsExactOptionalProperty(n,i)&&!J(r,t,n[i]))return!1}if(e.additionalProperties===!1){let t=Object.getOwnPropertyNames(n);return e.required&&e.required.length===r.length&&t.length===r.length?!0:t.every(e=>r.includes(e))}else if(typeof e.additionalProperties==`object`)return Object.getOwnPropertyNames(n).every(i=>r.includes(i)||J(e.additionalProperties,t,n[i]));else return!0}function R_(e,t,n){return Jt(n)}function z_(e,t,n){if(!ln.IsRecordLike(n)||q(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)||q(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties))return!1;let[r,i]=Object.entries(e.patternProperties)[0],a=new RegExp(r),o=Object.entries(n).every(([e,n])=>!a.test(e)||J(i,t,n)),s=typeof e.additionalProperties!=`object`||Object.entries(n).every(([n,r])=>a.test(n)?!0:J(e.additionalProperties,t,r)),c=e.additionalProperties!==!1||Object.getOwnPropertyNames(n).every(e=>a.test(e));return o&&s&&c}function B_(e,t,n){return J(qg(e,t),t,n)}function V_(e,t,n){let r=new RegExp(e.source,e.flags);return q(e.minLength)&&!(n.length>=e.minLength)||q(e.maxLength)&&!(n.length<=e.maxLength)?!1:r.test(n)}function H_(e,t,n){return!on(n)||q(e.minLength)&&!(n.length>=e.minLength)||q(e.maxLength)&&!(n.length<=e.maxLength)||q(e.pattern)&&!new RegExp(e.pattern).test(n)?!1:q(e.format)?pi(e.format)?hi(e.format)(n):!1:!0}function U_(e,t,n){return cn(n)}function W_(e,t,n){return on(n)&&new RegExp(e.pattern).test(n)}function G_(e,t,n){return J(qg(e,t),t,n)}function K_(e,t,n){if(!Qt(n)||e.items===void 0&&n.length!==0||n.length!==e.maxItems)return!1;if(!e.items)return!0;for(let r=0;r<e.items.length;r++)if(!J(e.items[r],t,n[r]))return!1;return!0}function q_(e,t,n){return $t(n)}function J_(e,t,n){return e.anyOf.some(e=>J(e,t,n))}function Y_(e,t,n){return!(!Xt(n)||q(e.maxByteLength)&&!(n.length<=e.maxByteLength)||q(e.minByteLength)&&!(n.length>=e.minByteLength))}function X_(e,t,n){return!0}function Z_(e,t,n){return ln.IsVoidLike(n)}function Q_(e,t,n){return _i(e[C])?vi(e[C])(e,n):!1}function J(e,t,n){let r=q(e.$id)?Kg(e,t):t,i=e;switch(i[C]){case`Any`:return y_(i,r,n);case`Argument`:return b_(i,r,n);case`Array`:return x_(i,r,n);case`AsyncIterator`:return S_(i,r,n);case`BigInt`:return C_(i,r,n);case`Boolean`:return w_(i,r,n);case`Constructor`:return T_(i,r,n);case`Date`:return E_(i,r,n);case`Function`:return D_(i,r,n);case`Import`:return O_(i,r,n);case`Integer`:return k_(i,r,n);case`Intersect`:return A_(i,r,n);case`Iterator`:return j_(i,r,n);case`Literal`:return M_(i,r,n);case`Never`:return N_(i,r,n);case`Not`:return P_(i,r,n);case`Null`:return F_(i,r,n);case`Number`:return I_(i,r,n);case`Object`:return L_(i,r,n);case`Promise`:return R_(i,r,n);case`Record`:return z_(i,r,n);case`Ref`:return B_(i,r,n);case`RegExp`:return V_(i,r,n);case`String`:return H_(i,r,n);case`Symbol`:return U_(i,r,n);case`TemplateLiteral`:return W_(i,r,n);case`This`:return G_(i,r,n);case`Tuple`:return K_(i,r,n);case`Undefined`:return q_(i,r,n);case`Union`:return J_(i,r,n);case`Uint8Array`:return Y_(i,r,n);case`Unknown`:return X_(i,r,n);case`Void`:return Z_(i,r,n);default:if(!_i(i[C]))throw new __(i);return Q_(i,r,n)}}function $_(...e){return e.length===3?J(e[0],e[1],e[2]):J(e[0],[],e[1])}var ev=class extends Error{constructor(e,t){super(e,t),this.name=`CodexlyEventError`}};function tv(e,t,n){let r=t===`temporary`?`${hh}/events`:`/v1/projects/${encodeURIComponent(t)}/events`,i=e?new URL(`${e}${r}`):new URL(r,globalThis.location.href);return i.protocol=i.protocol===`https:`?`wss:`:`ws:`,i.searchParams.set(`afterSequence`,String(n)),i.toString()}function nv(e,t,n){return{latestSequence:t,reason:n,sessionId:e,type:`resync.required`,version:3}}function rv(e){let t=e.reconnectDelayMs??250,n=!0,r=!0,i=e.afterSequence,a=0,o,s,c,l=t=>{e.onConnectionState?.(t)},u=(e,t)=>{let n=s;n!==void 0&&(c?.(),c=void 0,s=void 0,n.close(e,t))},d=t=>{r=!1,e.onResyncRequired(t),u(1e3,`Snapshot resync required`),l(`closed`)},f=(t,n)=>{r=!1,e.onError?.(new ev(t,n===void 0?void 0:{cause:n})),u(1002,`Invalid Agent Event frame`),l(`closed`)},p=()=>{if(!n)return;o=void 0;let u=!1,m=e.webSocketFactory(tv(e.baseUrl,e.projectId,i));s=m;let ee=()=>n&&s===m,te=t=>{if(!ee())return;let n;try{n=JSON.parse(String(t.data))}catch(e){f(`Codexly event frame is not valid JSON`,e);return}if(!$_(Hg,n)){f(`Codexly event frame does not match the protocol schema`);return}let r=n;if(r.type===`resync.required`){d(r);return}if(r.type===`connection.ready`){if(r.sessionId!==e.sessionId||r.latestSequence<i){d(nv(r.sessionId,r.latestSequence,`session_changed`));return}u=!0,a=0,l(`connected`);return}if(!u){f(`Codexly event arrived before connection.ready`);return}for(let t of r.events){if(t.sessionId!==e.sessionId){d(nv(t.sessionId,t.sequence,`session_changed`));return}if(!(t.sequence<=i)){if(t.sequence!==i+1){d(nv(t.sessionId,t.sequence,`sequence_gap`));return}if(i=t.sequence,e.onEvent(t),!ee())return}}},ne=()=>{!n||s!==m||e.onError?.(new ev(`Codexly event connection failed`))},h=()=>{if(s!==m||(c?.(),c=void 0,s=void 0,!n))return;if(!r){l(`closed`);return}l(`reconnecting`);let e=Math.min(t*2**a,5e3);a+=1,o=setTimeout(p,e)};c=()=>{m.removeEventListener(`message`,te),m.removeEventListener(`error`,ne),m.removeEventListener(`close`,h)},m.addEventListener(`message`,te),m.addEventListener(`error`,ne),m.addEventListener(`close`,h)};return l(`connecting`),p(),()=>{n&&(n=!1,r=!1,o!==void 0&&clearTimeout(o),u(1e3,`Subscription cancelled`),l(`closed`))}}var Y=[];for(let e=0;e<256;++e)Y.push((e+256).toString(16).slice(1));function iv(e,t=0){return(Y[e[t+0]]+Y[e[t+1]]+Y[e[t+2]]+Y[e[t+3]]+`-`+Y[e[t+4]]+Y[e[t+5]]+`-`+Y[e[t+6]]+Y[e[t+7]]+`-`+Y[e[t+8]]+Y[e[t+9]]+`-`+Y[e[t+10]]+Y[e[t+11]]+Y[e[t+12]]+Y[e[t+13]]+Y[e[t+14]]+Y[e[t+15]]).toLowerCase()}var av=new Uint8Array(16);function ov(){return crypto.getRandomValues(av)}function sv(e,t,n){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():cv(e,t,n)}function cv(e,t,n){e||={};let r=e.random??e.rng?.()??ov();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return iv(r)}var lv=15e4,uv=class extends Error{status;constructor(e,t,n){super(n??`Codexly request failed with ${String(e)} ${t}`.trim()),this.name=`CodexlyHttpError`,this.status=e}},dv=class extends uv{code;retryable;constructor(e,t,n){super(e,t,n.message),this.name=`CodexlyMutationError`,this.code=n.code,this.retryable=n.retryable}},fv=class extends Error{constructor(e,t){super(e,t),this.name=`CodexlyResponseError`}};function X(e,t){let n=new URLSearchParams;for(let[e,r]of Object.entries(t))r!==void 0&&n.set(e,String(r));let r=n.toString();return r?`${e}?${r}`:e}function Z(e){return e===`temporary`?hh:`/v1/projects/${encodeURIComponent(e)}`}function Q(e,t){return`${Z(e)}/tasks/${encodeURIComponent(t)}`}function pv(e,t,n,r){return`${e.replace(/\/$/u,``)}${Q(t,n)}/attachments/${encodeURIComponent(r)}`}function mv(e,t,n,r){let i=X(`${Z(t)}/files/image`,{path:n,rootPath:r});return`${e.replace(/\/$/u,``)}${i}`}function hv(e,t,n){return`${e.replace(/\/$/u,``)}${Z(t)}/attachments/${encodeURIComponent(n)}`}function gv(e,t=``){return`${t.replace(/\/$/u,``)}/v1/pets/assets/${encodeURIComponent(e)}`}var _v=class{baseUrl;fetchImplementation;requestTimeouts;webSocketFactory;unauthorizedListeners=new Set;constructor(e={}){this.baseUrl=e.baseUrl?.replace(/\/$/u,``)??``,this.fetchImplementation=e.fetch??globalThis.fetch.bind(globalThis),this.requestTimeouts={mutationMs:e.requestTimeouts?.mutationMs??6e4,queryMs:e.requestTimeouts?.queryMs??3e4,readMs:e.requestTimeouts?.readMs??15e3},this.webSocketFactory=e.webSocketFactory??(e=>new WebSocket(e))}async getHealth(e={}){return this.read(`/v1/health`,Eh,e)}async getAppInfo(e={}){return this.read(`/v1/app-info`,Wd,e)}async installAppUpdate(e,t={}){return this.mutation(`/v1/app-update`,{version:e},Gd,t,`POST`,lv)}async getAccessStatus(e={}){return this.read(`/v1/access`,qd,e)}async pairAccess(e){return this.request(`/v1/access/pair`,qd,{body:JSON.stringify({code:e}),headers:{"content-type":`application/json`},method:`POST`},ag,{timeoutMs:this.requestTimeouts.mutationMs})}async logoutAccess(){return this.request(`/v1/access/logout`,qd,{body:`{}`,headers:{"content-type":`application/json`},method:`POST`},ag,{timeoutMs:this.requestTimeouts.mutationMs})}subscribeUnauthorized(e){return this.unauthorizedListeners.add(e),()=>this.unauthorizedListeners.delete(e)}async getCapabilities(e={}){return this.read(`/v1/capabilities`,Dh,e)}async listModels(e={}){return this.read(`/v1/models`,wh,e)}async getProviderConnection(e={}){return this.read(`/v1/provider-connection`,Mh,e)}async startOfficialProviderLogin(e={}){return this.mutation(`/v1/provider-connection/official-login`,{},Nh,e)}async cancelProviderLogin(e,t={}){return this.mutation(`/v1/provider-connection/official-login/cancel`,{loginId:e},Fh,t)}async configureCustomProvider(e,t={}){return this.mutation(`/v1/provider-connection/custom`,e,Ph,t,`PUT`)}async logoutProvider(e={}){return this.mutation(`/v1/provider-connection/logout`,{},Fh,e)}async getGlobalSettings(e={}){return this.read(`/v1/settings`,ah,e)}async listWorkbenchPets(e={}){return this.read(`/v1/pets`,Bd,e)}async downloadWorkbenchPet(e,t={}){return this.mutation(`/v1/pets/downloads`,{petId:e},Vd,t)}async updateGlobalSettings(e,t={}){return this.mutation(`/v1/settings`,e,ah,t,`PUT`)}subscribeEvents(e){return rv({...e,baseUrl:this.baseUrl,webSocketFactory:this.webSocketFactory})}mutation(e,t,n,r,i=`POST`,a=this.requestTimeouts.mutationMs){return this.request(e,n,{body:JSON.stringify(t),headers:{"content-type":`application/json`,"idempotency-key":r.idempotencyKey??sv()},method:i},ag,{...r.signal===void 0?{}:{signal:r.signal},timeoutMs:a})}read(e,t,n,r){return this.request(e,t,{},r,{...n.signal===void 0?{}:{signal:n.signal},timeoutMs:n.signal===void 0?this.requestTimeouts.readMs:this.requestTimeouts.queryMs})}async request(e,t,n={},r,i={}){let a=AbortSignal.timeout(i.timeoutMs??this.requestTimeouts.readMs),o=i.signal===void 0?a:AbortSignal.any([i.signal,a]),s=await this.fetchImplementation(`${this.baseUrl}${e}`,{...n,credentials:`same-origin`,headers:{accept:`application/json`,...n.headers},signal:o});if(!s.ok){if(s.status===401)for(let e of this.unauthorizedListeners)try{e()}catch{}if(r!==void 0){let e;try{e=await s.json()}catch(e){throw new fv(`Codexly error response is not valid JSON`,{cause:e})}throw $_(r,e)?new dv(s.status,s.statusText,e):new fv(`Codexly error response does not match the protocol schema`)}try{let e=await s.json();if(typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`&&e.message.length>0)throw new uv(s.status,s.statusText,e.message)}catch(e){if(e instanceof uv)throw e}throw new uv(s.status,s.statusText)}let c;try{c=await s.json()}catch(e){throw new fv(`Codexly response is not valid JSON`,{cause:e})}if(!$_(t,c))throw new fv(`Codexly response does not match the protocol schema`);return c}},vv=class extends _v{async listSkills(e,t={}){return this.read(`${Z(e)}/skills`,Th,t)}async listMcpServers(e,t,n={}){return this.read(`${Q(e,t)}/mcp-servers`,Fm,n,ag)}async retryMcpServers(e,t,n={}){return this.mutation(`${Q(e,t)}/mcp-servers/retry`,{},Jh,n)}async listProjects(e={}){return this.read(`/v1/projects`,xh,e)}async listProjectDirectories(e,t={}){return this.read(X(`/v1/project-directories`,{path:e,includeHidden:t.includeHidden===!0?`true`:void 0}),ff,t)}async listHostFiles(e,t,n={}){return this.read(X(`/v1/host-files`,{kind:e,path:t,includeHidden:n.includeHidden===!0?`true`:void 0}),hf,n)}async reorderProjects(e,t={}){return this.mutation(`/v1/projects/order`,{projectIds:e},Sh,t,`PUT`)}async getProjectDefaults(e,t={}){return this.read(`${Z(e)}/defaults`,sh,t)}async updateProjectDefaults(e,t,n={}){return this.mutation(`${Z(e)}/defaults`,t,sh,n,`PUT`)}async addProject(e,t={}){return this.mutation(`/v1/projects`,{roots:e.map(e=>({path:e}))},gf,t)}async renameProject(e,t,n={}){return this.mutation(`${Z(e)}/rename`,{name:t},Cf,n)}async removeProject(e,t={}){return this.mutation(`${Z(e)}/remove`,{},wf,t)}async getProjectOpenCapabilities(e,t={}){return this.read(`${Z(e)}/open-capabilities`,xf,t)}async openProject(e,t,n,r={}){return this.mutation(X(`${Z(e)}/open`,{rootPath:t}),n,Sf,r)}async getProjectGitStatus(e,t,n={}){return this.read(X(`/v1/projects/${encodeURIComponent(e)}/git/status`,{includeDiff:t.includeDiff===!0?`true`:void 0,repository:t.repository,rootPath:t.rootPath}),Gp,n)}async getProjectGitHistory(e,t,n={}){return this.read(X(`${Z(e)}/git/history`,{cursor:t.cursor,repository:t.repository,rootPath:t.rootPath}),Jp,n)}async getProjectGitCommitFiles(e,t,n={}){return this.read(X(`${Z(e)}/git/commit-files`,{cursor:t.cursor,repository:t.repository,rootPath:t.rootPath,sha:t.sha}),Qp,n)}async getProjectGitCommitFileDiff(e,t,n={}){return this.read(X(`${Z(e)}/git/commit-diff`,{path:t.path,repository:t.repository,rootPath:t.rootPath,sha:t.sha}),$p,n)}async switchProjectBranch(e,t,n,r={}){return this.mutation(X(`${Z(e)}/git/branch`,{rootPath:t}),n,Gp,r)}async createProjectBranch(e,t,n,r={}){return this.mutation(X(`${Z(e)}/git/branches`,{rootPath:t}),n,Gp,r)}async listProjectWorktrees(e,t,n={}){return this.read(X(`${Z(e)}/git/worktrees`,{rootPath:t}),tm,n)}async createProjectWorktree(e,t,n,r={}){return this.mutation(X(`${Z(e)}/git/worktrees`,{rootPath:t}),n,nm,r)}async switchProjectWorktree(e,t,n,r={}){return this.mutation(X(`${Z(e)}/git/worktree`,{rootPath:t}),n,nm,r)}async generateCommitMessage(e,t,n,r={}){return this.mutation(X(`${Z(e)}/git/commit-message`,{rootPath:t}),n,rm,r)}async commitProjectChanges(e,t,n,r={}){return this.mutation(X(`${Z(e)}/git/commits`,{rootPath:t}),n,im,r)}async listProjectFiles(e,t,n,r={}){let i=X(`/v1/projects/${encodeURIComponent(e)}/files/tree`,{path:n??void 0,rootPath:t});return this.read(i,om,r)}async renameProjectFile(e,t,n,r={}){return this.mutation(X(`/v1/projects/${encodeURIComponent(e)}/files/rename`,{rootPath:t}),n,cm,r)}async deleteProjectFile(e,t,n,r={}){return this.mutation(X(`/v1/projects/${encodeURIComponent(e)}/files/delete`,{rootPath:t}),n,lm,r)}async searchProjectFiles(e,t,n,r,i={}){let a=X(`/v1/projects/${encodeURIComponent(e)}/files/search`,{query:n,rootPath:t,sessionId:r});return this.read(a,af,i)}async stopProjectFileSearch(e,t,n,r={}){return this.mutation(`/v1/projects/${encodeURIComponent(e)}/files/search/stop`,{rootPath:t,sessionId:n},of,r)}async readProjectSourceFile(e,t,n,r,i={}){let a=X(`${Z(e)}/files/source`,{cursor:r,path:n,rootPath:t});return this.read(a,um,i)}},yv=class extends vv{async archiveTask(e,t,n={}){return this.mutation(`${Q(e,t)}/archive`,{},Vh,n)}async unarchiveTask(e,t,n={}){return this.mutation(`${Q(e,t)}/unarchive`,{},Hh,n)}async deleteTask(e,t,n={}){return this.mutation(Q(e,t),{},Uh,n,`DELETE`)}},bv=class extends yv{async updateTaskGoal(e,t,n,r={}){return this.mutation(`${Q(e,t)}/goal`,n,Gm,r,`PUT`)}async clearTaskGoal(e,t,n={}){return this.mutation(`${Q(e,t)}/goal`,{},Km,n,`DELETE`)}},xv=class extends bv{async listQueuedSubmissions(e,t,n={},r={}){return this.read(X(`${Q(e,t)}/queue`,n),Hm,r)}async addQueuedSubmission(e,t,n,r,i={}){return this.mutation(`${Q(e,t)}/queue`,{clientUserMessageId:r,input:n},Qh,i)}async updateQueuedSubmission(e,t,n,r,i,a={}){return this.mutation(`${Q(e,t)}/queue/${encodeURIComponent(n)}`,{input:r,status:i},$h,a,`PUT`)}async deleteQueuedSubmission(e,t,n,r={}){return this.mutation(`${Q(e,t)}/queue/${encodeURIComponent(n)}`,{},eg,r,`DELETE`)}async reorderQueuedSubmissions(e,t,n,r={}){return this.mutation(`${Q(e,t)}/queue/reorder`,{queuedSubmissionIds:n},tg,r,`PUT`)}async startQueuedSubmission(e,t,n,r={}){return this.mutation(`${Q(e,t)}/queue/start`,{...n===void 0?{}:{queuedSubmissionId:n}},ng,r)}async listTasks(e,t={},n={}){let r=X(`${Z(e)}/tasks`,t);return this.read(r,Ch,n)}async readTask(e,t,n={}){let{cursor:r,...i}=n;return this.read(X(Q(e,t),{cursor:r}),Ug,i)}getTaskAttachmentUrl(e,t,n){return pv(this.baseUrl,e,t,n)}async openTaskAttachment(e,t,n,r={}){return this.mutation(`${Q(e,t)}/attachments/${encodeURIComponent(n)}/open`,{},Gf,r)}async listBackgroundTerminals(e,t,n={}){return this.read(`${Q(e,t)}/background-terminals`,Qf,n)}async terminateBackgroundTerminal(e,t,n,r={}){return this.mutation(`${Q(e,t)}/background-terminals/${encodeURIComponent(n)}/terminate`,{},$f,r)}async getTaskSettings(e,t,n={}){return this.read(`${Q(e,t)}/settings`,ch,n)}async updateTaskSettings(e,t,n,r={}){return this.mutation(`${Q(e,t)}/settings`,n,ch,r,`PUT`)}async startTask(e,t={}){return this.mutation(`${Z(e)}/tasks`,{},Rh,t)}async pinTask(e,t,n,r={}){return this.mutation(`${Q(e,t)}/pin`,{pinned:n},zh,r,`PUT`)}async renameTask(e,t,n,r={}){return this.mutation(`${Q(e,t)}/rename`,{title:n},Bh,r)}async unsubscribeTask(e,t){return this.request(`${Q(e,t)}/unsubscribe`,Wh,{body:`{}`,headers:{"content-type":`application/json`},method:`POST`})}async startReview(e,t,n,r={}){return this.mutation(`${Q(e,t)}/review`,n,Gh,r)}async compactTask(e,t,n={}){return this.mutation(`${Q(e,t)}/compact`,{},Kh,n)}async forkTask(e,t,n,r={}){return this.mutation(`${Q(e,t)}/fork`,n,qh,r)}async uploadFeedback(e,t,n,r={}){return this.mutation(`${Q(e,t)}/feedback`,n,Yh,r)}async uploadAttachment(e,t,n={}){let r=new FormData;return r.set(`attachment`,t.content,t.name),this.request(`${Z(e)}/attachments/${t.kind}`,Om,{body:r,headers:{"idempotency-key":n.idempotencyKey??sv()},method:`POST`},ag,{...n.signal===void 0?{}:{signal:n.signal},timeoutMs:this.requestTimeouts.mutationMs})}async importHostAttachment(e,t,n,r={}){return this.mutation(`${Z(e)}/attachments/${t}/host`,{path:n},Om,r)}async startTurn(e,t,n,r,i={}){return this.mutation(`${Q(e,t)}/turns`,{input:n,options:r},Xh,i)}async steerTurn(e,t,n,r,i={}){return this.mutation(`${Q(e,t)}/turns/${encodeURIComponent(n)}/steer`,{input:r,taskId:t},Zh,i)}async interruptTurn(e,t,n,r={}){return this.mutation(`${Q(e,t)}/turns/${encodeURIComponent(n)}/interrupt`,{taskId:t},rg,r)}async resolvePendingRequest(e,t,n={}){let r={itemId:e.itemId,projectId:e.projectId,resolution:t,taskId:e.taskId,turnId:e.turnId,type:e.type};return this.mutation(`${Q(e.projectId,e.taskId)}/pending-requests/${encodeURIComponent(e.requestId)}/resolve`,r,Lp,n)}},Sv=class extends xv{},Cv=`pinned`,wv=`search-source`,Tv=3e4;function Ev(e,t){return[`projects`,e,`tasks`,t,`queue`]}var Dv=new Sv,Ov=Object.defineProperty,kv=(e,t)=>Ov(e,`name`,{value:t,configurable:!0}),Av=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),jv=g.forwardRef(kv(function(e,t){return(0,_.jsx)(d.span,{...e,ref:t,style:{...Av,...e.style}})},`VisuallyHidden`)),Mv=Object.defineProperty,$=(e,t)=>Mv(e,`name`,{value:t,configurable:!0}),[Nv,Pv]=c(`Tooltip`,[ee]),Fv=ee(),Iv=`TooltipProvider`,Lv=700,Rv=`tooltip.open`,[zv,Bv]=Nv(Iv),Vv=$(e=>{let{__scopeTooltip:t,delayDuration:n=Lv,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=g.useRef(!0),s=g.useRef(!1),c=g.useRef(0);return g.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,_.jsx)(zv,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:g.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:g.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:g.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})},`TooltipProvider`),Hv=`Tooltip`,[Uv,Wv]=Nv(Hv),Gv=$(e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Bv(Hv,e.__scopeTooltip),l=Fv(t),[d,f]=g.useState(null),[m,ee]=g.useState(void 0),ne=u(),h=g.useRef(0),re=o??c.disableHoverableContent,ie=s??c.delayDuration,ae=g.useRef(!1),[oe,se]=te({prop:r,defaultProp:i??!1,onChange:$(e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Rv))):c.onClose(),a?.(e)},`onChange`),caller:Hv}),ce=g.useMemo(()=>oe?ae.current?`delayed-open`:`instant-open`:`closed`,[oe]),le=g.useCallback(()=>{window.clearTimeout(h.current),h.current=0,ae.current=!1,se(!0)},[se]),ue=g.useCallback(()=>{window.clearTimeout(h.current),h.current=0,se(!1)},[se]),de=g.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{ae.current=!0,se(!0),h.current=0},ie)},[ie,se]);g.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]);let fe=m??ne;return(0,_.jsx)(p,{...l,children:(0,_.jsx)(Uv,{scope:t,contentId:fe,setContentId:ee,open:oe,stateAttribute:ce,trigger:d,onTriggerChange:f,onTriggerEnter:g.useCallback(()=>{c.isOpenDelayedRef.current?de():le()},[c.isOpenDelayedRef,de,le]),onTriggerLeave:g.useCallback(()=>{re?ue():(window.clearTimeout(h.current),h.current=0)},[ue,re]),onOpen:le,onClose:ue,disableHoverableContent:re,children:n})})},`Tooltip`),Kv=`TooltipTrigger`,qv=g.forwardRef($(function(e,t){let{__scopeTooltip:n,...r}=e,o=Wv(Kv,n),s=Bv(Kv,n),c=Fv(n),u=i(t,g.useRef(null),o.onTriggerChange),f=g.useRef(!1),p=g.useRef(!1),m=g.useCallback(()=>f.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener(`pointerup`,m),[m]),(0,_.jsx)(l,{asChild:!0,...c,children:(0,_.jsx)(d.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:u,onPointerMove:a(e.onPointerMove,e=>{e.pointerType!==`touch`&&!p.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),p.current=!0)}),onPointerLeave:a(e.onPointerLeave,()=>{o.onTriggerLeave(),p.current=!1}),onPointerDown:a(e.onPointerDown,()=>{o.open&&o.onClose(),f.current=!0,document.addEventListener(`pointerup`,m,{once:!0})}),onFocus:a(e.onFocus,()=>{f.current||o.onOpen()}),onBlur:a(e.onBlur,o.onClose),onClick:a(e.onClick,o.onClose)})})},`TooltipTrigger`)),Jv=`TooltipPortal`,[Yv,Xv]=Nv(Jv,{forceMount:void 0}),Zv=$(e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Wv(Jv,t);return(0,_.jsx)(Yv,{scope:t,forceMount:n,children:(0,_.jsx)(f,{present:n||a.open,children:(0,_.jsx)(m,{asChild:!0,container:i,children:r})})})},`TooltipPortal`),Qv=`TooltipContent`,$v=g.forwardRef($(function(e,t){let n=Xv(Qv,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Wv(Qv,e.__scopeTooltip);return(0,_.jsx)(f,{present:r||o.open,children:o.disableHoverableContent?(0,_.jsx)(ny,{side:i,...a,ref:t}):(0,_.jsx)(ey,{side:i,...a,ref:t})})},`TooltipContent`)),ey=g.forwardRef($(function(e,t){let n=Wv(Qv,e.__scopeTooltip),r=Bv(Qv,e.__scopeTooltip),a=g.useRef(null),o=i(t,a),[s,c]=g.useState(null),{trigger:l,onClose:u}=n,d=a.current,{onPointerInTransitChange:f}=r,p=g.useCallback(()=>{c(null),f(!1)},[f]),m=g.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=iy(r,ry(r,n.getBoundingClientRect())),a=ay(t.getBoundingClientRect()),o=sy([...i,...a]);c(o),f(!0)},[f]);return g.useEffect(()=>()=>p(),[p]),g.useEffect(()=>{if(l&&d){let e=$(e=>m(e,d),`handleTriggerLeave`),t=$(e=>m(e,l),`handleContentLeave`);return l.addEventListener(`pointerleave`,e),d.addEventListener(`pointerleave`,t),()=>{l.removeEventListener(`pointerleave`,e),d.removeEventListener(`pointerleave`,t)}}},[l,d,m,p]),g.useEffect(()=>{if(s){let e=$(e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=l?.contains(t)||d?.contains(t),i=!oy(n,s);r?p():i&&(p(),u())},`handleTrackPointerGrace`);return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[l,d,s,u,p]),(0,_.jsx)(ny,{...e,ref:o})},`TooltipContentHoverable`)),ty=h(`TooltipContent`),ny=g.forwardRef($(function(e,t){let{__scopeTooltip:n,children:r,"aria-label":i,id:a,onEscapeKeyDown:c,onPointerDownOutside:l,...u}=e,d=Wv(Qv,n),f=Fv(n),{onClose:p}=d;g.useEffect(()=>(document.addEventListener(Rv,p),()=>document.removeEventListener(Rv,p)),[p]),g.useEffect(()=>{if(d.trigger){let e=$(e=>{e.target instanceof Node&&e.target.contains(d.trigger)&&p()},`handleScroll`);return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[d.trigger,p]);let{setContentId:m}=d;return ne(()=>(m(a),()=>{m(void 0)}),[a,m]),(0,_.jsx)(s,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:p,children:(0,_.jsxs)(o,{"data-state":d.stateAttribute,role:i?void 0:`tooltip`,id:i?void 0:d.contentId,...f,...u,ref:t,style:{...u.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,_.jsx)(ty,{children:r}),i?(0,_.jsx)(jv,{id:d.contentId,role:`tooltip`,children:i}):null]})})},`TooltipContentImpl`));function ry(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}$(ry,`getExitSideFromRect`);function iy(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}$(iy,`getPaddedExitPoints`);function ay(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}$(ay,`getPointsFromRect`);function oy(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}$(oy,`isPointInPolygon`);function sy(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),cy(t)}$(sy,`getHull`);function cy(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}$(cy,`getHullPresorted`);var ly=Vv,uy=Gv,dy=qv,fy=Zv,py=$v;function my({delayDuration:e=350,disableHoverableContent:t=!0,skipDelayDuration:n=150,...r}){return(0,_.jsx)(ly,{"data-slot":`tooltip-provider`,delayDuration:e,disableHoverableContent:t,skipDelayDuration:n,...r})}function hy(e){return(0,_.jsx)(uy,{"data-slot":`tooltip`,...e})}function gy(e){return(0,_.jsx)(dy,{"data-slot":`tooltip-trigger`,...e})}function _y({children:e,className:t,collisionPadding:n=8,sideOffset:r=8,...i}){return(0,_.jsx)(fy,{children:(0,_.jsx)(py,{className:re(`pointer-events-none z-50 w-fit max-w-[min(20rem,calc(100vw-1rem))] whitespace-normal rounded-control bg-foreground px-2 py-1 text-meta text-raised shadow-floating`,t),collisionPadding:n,"data-slot":`tooltip-content`,sideOffset:r,...i,children:e})})}export{ue as $,Ct as A,Qe as B,jf as C,Tt as D,Et as E,gt as F,Ve as G,Ze as H,pt as I,ye as J,Be as K,dt as L,_t as M,yt as N,wt as O,vt as P,ge as Q,ut as R,Af as S,Uf as T,Ke as U,Xe as V,Ge as W,ke as X,ve as Y,_e as Z,mh as _,Av as a,Me as at,If as b,Tv as c,hv as d,be as et,mv as f,Ih as g,sv as h,gy as i,Pe as it,St as j,bt as k,Dv as l,gv as m,_y as n,me as nt,Cv as o,ae as ot,pv as p,de as q,my as r,Ce as rt,wv as s,ie as st,hy as t,Se as tt,Ev as u,qm as v,Mf as w,kf as x,zf as y,nt as z};