@bryanhu/codexly 0.10.0 → 0.11.1

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 (209) hide show
  1. package/CHANGELOG.md +27 -1
  2. package/dist/{chunk-NWT36LJF.js → chunk-2NJ4CTQP.js} +35 -18
  3. package/dist/{chunk-4XTWUO2V.js → chunk-GUHYAMAQ.js} +1 -1
  4. package/dist/{chunk-H36A2TLY.js → chunk-HHEP4NNE.js} +10 -3
  5. package/dist/{chunk-Q4C3XTOX.js → chunk-YMFGL4ZR.js} +26 -96
  6. package/dist/cli.js +146 -26
  7. package/dist/client/index.js +5 -2
  8. package/dist/protocol/index.js +1 -1
  9. package/dist/providers/codex/index.js +2 -2
  10. package/dist/server/index.js +4 -4
  11. package/dist/web/.vite/manifest.json +177 -177
  12. package/dist/web/.vite/manifest.json.br +0 -0
  13. package/dist/web/.vite/manifest.json.gz +0 -0
  14. package/dist/web/assets/{button-group-CiKTUtu2.js → button-group-Bt_Rr9-f.js} +1 -1
  15. package/dist/web/assets/button-group-Bt_Rr9-f.js.br +0 -0
  16. package/dist/web/assets/button-group-Bt_Rr9-f.js.gz +0 -0
  17. package/dist/web/assets/check-C92ZHwwX.js +1 -0
  18. package/dist/web/assets/check-C92ZHwwX.js.br +0 -0
  19. package/dist/web/assets/check-C92ZHwwX.js.gz +0 -0
  20. package/dist/web/assets/{checkbox-BW4uILvi.js → checkbox-BBHD70U-.js} +1 -1
  21. package/dist/web/assets/checkbox-BBHD70U-.js.br +0 -0
  22. package/dist/web/assets/checkbox-BBHD70U-.js.gz +0 -0
  23. package/dist/web/assets/{chunk-BO2N2NFS-BUKjYgWS.js → chunk-BO2N2NFS-ng4dbem1.js} +4 -4
  24. package/dist/web/assets/chunk-BO2N2NFS-ng4dbem1.js.br +0 -0
  25. package/dist/web/assets/{chunk-BO2N2NFS-BUKjYgWS.js.gz → chunk-BO2N2NFS-ng4dbem1.js.gz} +0 -0
  26. package/dist/web/assets/{code-highlighter-C1j1Kcu-.js → code-highlighter-BMwFeSBd.js} +1 -1
  27. package/dist/web/assets/code-highlighter-BMwFeSBd.js.br +0 -0
  28. package/dist/web/assets/code-highlighter-BMwFeSBd.js.gz +0 -0
  29. package/dist/web/assets/{code-languages-CaP8M7cE.js → code-languages-rKSHZYzu.js} +1 -1
  30. package/dist/web/assets/code-languages-rKSHZYzu.js.br +0 -0
  31. package/dist/web/assets/code-languages-rKSHZYzu.js.gz +0 -0
  32. package/dist/web/assets/{context-menu-D--ol5Is.js → context-menu-03SuSeWI.js} +1 -1
  33. package/dist/web/assets/context-menu-03SuSeWI.js.br +0 -0
  34. package/dist/web/assets/context-menu-03SuSeWI.js.gz +0 -0
  35. package/dist/web/assets/{dist-Dg2zCzgZ.js → dist-B_DB3jSu.js} +1 -1
  36. package/dist/web/assets/dist-B_DB3jSu.js.br +0 -0
  37. package/dist/web/assets/{dist-Dg2zCzgZ.js.gz → dist-B_DB3jSu.js.gz} +0 -0
  38. package/dist/web/assets/dist-DBbCRukl.js +1 -0
  39. package/dist/web/assets/dist-DBbCRukl.js.br +0 -0
  40. package/dist/web/assets/dist-DBbCRukl.js.gz +0 -0
  41. package/dist/web/assets/{es2015-keiDyoog.js → es2015-BUwabepB.js} +1 -1
  42. package/dist/web/assets/es2015-BUwabepB.js.br +0 -0
  43. package/dist/web/assets/es2015-BUwabepB.js.gz +0 -0
  44. package/dist/web/assets/{file-code-corner-DBltovZx.js → file-code-corner-CJDhFrYy.js} +1 -1
  45. package/dist/web/assets/file-code-corner-CJDhFrYy.js.br +3 -0
  46. package/dist/web/assets/file-code-corner-CJDhFrYy.js.gz +0 -0
  47. package/dist/web/assets/{file-navigation-view-preference-CufNNsrc.js → file-navigation-view-preference-DeIXQ8c4.js} +1 -1
  48. package/dist/web/assets/file-navigation-view-preference-DeIXQ8c4.js.br +0 -0
  49. package/dist/web/assets/file-navigation-view-preference-DeIXQ8c4.js.gz +0 -0
  50. package/dist/web/assets/{file-review-dialog-BJcvPK95.js → file-review-dialog-L7snJJP8.js} +2 -2
  51. package/dist/web/assets/file-review-dialog-L7snJJP8.js.br +0 -0
  52. package/dist/web/assets/file-review-dialog-L7snJJP8.js.gz +0 -0
  53. package/dist/web/assets/{file-tree-Br65eBgL.js → file-tree-DvTv0Re2.js} +1 -1
  54. package/dist/web/assets/file-tree-DvTv0Re2.js.br +0 -0
  55. package/dist/web/assets/file-tree-DvTv0Re2.js.gz +0 -0
  56. package/dist/web/assets/{git-commit-horizontal-B8Fh6uIt.js → git-commit-horizontal-hgIO8zJZ.js} +1 -1
  57. package/dist/web/assets/git-commit-horizontal-hgIO8zJZ.js.br +0 -0
  58. package/dist/web/assets/git-commit-horizontal-hgIO8zJZ.js.gz +0 -0
  59. package/dist/web/assets/{git-history-panel-BPu7_V4u.js → git-history-panel-DZY20FzY.js} +2 -2
  60. package/dist/web/assets/git-history-panel-DZY20FzY.js.br +0 -0
  61. package/dist/web/assets/git-history-panel-DZY20FzY.js.gz +0 -0
  62. package/dist/web/assets/global-settings-dialog-cA1SWDdi.js +1 -0
  63. package/dist/web/assets/global-settings-dialog-cA1SWDdi.js.br +0 -0
  64. package/dist/web/assets/global-settings-dialog-cA1SWDdi.js.gz +0 -0
  65. package/dist/web/assets/{highlighted-body-OFNGDK62-B9UneXsh.js → highlighted-body-OFNGDK62-UIjGvJpu.js} +1 -1
  66. package/dist/web/assets/highlighted-body-OFNGDK62-UIjGvJpu.js.br +0 -0
  67. package/dist/web/assets/highlighted-body-OFNGDK62-UIjGvJpu.js.gz +0 -0
  68. package/dist/web/assets/index-CldcNq0q.css +2 -0
  69. package/dist/web/assets/index-CldcNq0q.css.br +0 -0
  70. package/dist/web/assets/index-CldcNq0q.css.gz +0 -0
  71. package/dist/web/assets/index-WZ8-8oYp.js +4 -0
  72. package/dist/web/assets/index-WZ8-8oYp.js.br +0 -0
  73. package/dist/web/assets/index-WZ8-8oYp.js.gz +0 -0
  74. package/dist/web/assets/{lazy-message-response-BUy_3K13.js → lazy-message-response-SjU6ZsaR.js} +2 -2
  75. package/dist/web/assets/lazy-message-response-SjU6ZsaR.js.br +0 -0
  76. package/dist/web/assets/lazy-message-response-SjU6ZsaR.js.gz +0 -0
  77. package/dist/web/assets/loader-circle-CJOhkEC8.js +1 -0
  78. package/dist/web/assets/loader-circle-CJOhkEC8.js.br +0 -0
  79. package/dist/web/assets/loader-circle-CJOhkEC8.js.gz +0 -0
  80. package/dist/web/assets/mermaid-GHXKKRXX-CDYc39nv.js +1 -0
  81. package/dist/web/assets/mermaid-GHXKKRXX-CDYc39nv.js.br +0 -0
  82. package/dist/web/assets/mermaid-GHXKKRXX-CDYc39nv.js.gz +0 -0
  83. package/dist/web/assets/{message-response-CHiSTCUA.js → message-response-BXln58hx.js} +1 -1
  84. package/dist/web/assets/message-response-BXln58hx.js.br +0 -0
  85. package/dist/web/assets/message-response-BXln58hx.js.gz +0 -0
  86. package/dist/web/assets/{patch-diff-viewer-yBAeFKQ9.js → patch-diff-viewer-BnoOysqK.js} +2 -2
  87. package/dist/web/assets/patch-diff-viewer-BnoOysqK.js.br +0 -0
  88. package/dist/web/assets/patch-diff-viewer-BnoOysqK.js.gz +0 -0
  89. package/dist/web/assets/{project-file-popup-page-CCl_CU2a.js → project-file-popup-page-C5dOvxw_.js} +1 -1
  90. package/dist/web/assets/project-file-popup-page-C5dOvxw_.js.br +0 -0
  91. package/dist/web/assets/project-file-popup-page-C5dOvxw_.js.gz +0 -0
  92. package/dist/web/assets/{project-source-panel-bvidcsWq.js → project-source-panel-CDrU5_qN.js} +3 -3
  93. package/dist/web/assets/project-source-panel-CDrU5_qN.js.br +0 -0
  94. package/dist/web/assets/project-source-panel-CDrU5_qN.js.gz +0 -0
  95. package/dist/web/assets/{prompt-input-controls-DWd_vgsW.js → prompt-input-controls-C_Zm2pL8.js} +1 -1
  96. package/dist/web/assets/prompt-input-controls-C_Zm2pL8.js.br +0 -0
  97. package/dist/web/assets/prompt-input-controls-C_Zm2pL8.js.gz +0 -0
  98. package/dist/web/assets/{prompt-reference-token-BHH5NHbF.js → prompt-reference-token-XDhhAENk.js} +1 -1
  99. package/dist/web/assets/prompt-reference-token-XDhhAENk.js.br +0 -0
  100. package/dist/web/assets/prompt-reference-token-XDhhAENk.js.gz +0 -0
  101. package/dist/web/assets/{provider-connection-queries-DCBm4pti.js → provider-connection-queries-BBs1XjP6.js} +1 -1
  102. package/dist/web/assets/provider-connection-queries-BBs1XjP6.js.br +0 -0
  103. package/dist/web/assets/provider-connection-queries-BBs1XjP6.js.gz +0 -0
  104. package/dist/web/assets/{shiki-bundle-D5WnlOUZ.js → shiki-bundle-CGkIRfLa.js} +1 -1
  105. package/dist/web/assets/shiki-bundle-CGkIRfLa.js.br +0 -0
  106. package/dist/web/assets/shiki-bundle-CGkIRfLa.js.gz +0 -0
  107. package/dist/web/assets/tooltip-BPVbHVEF.js +1 -0
  108. package/dist/web/assets/tooltip-BPVbHVEF.js.br +0 -0
  109. package/dist/web/assets/tooltip-BPVbHVEF.js.gz +0 -0
  110. package/dist/web/assets/{upload-CsaycpyW.js → upload-Bz26q2Ar.js} +1 -1
  111. package/dist/web/assets/upload-Bz26q2Ar.js.br +0 -0
  112. package/dist/web/assets/upload-Bz26q2Ar.js.gz +0 -0
  113. package/dist/web/assets/{useInfiniteQuery-6E3mPgZn.js → useInfiniteQuery-DJg78OO5.js} +1 -1
  114. package/dist/web/assets/useInfiniteQuery-DJg78OO5.js.br +0 -0
  115. package/dist/web/assets/useInfiniteQuery-DJg78OO5.js.gz +0 -0
  116. package/dist/web/assets/{workbench-inspector-changes-BqeP4QV0.js → workbench-inspector-changes-B4eOJNJh.js} +2 -2
  117. package/dist/web/assets/workbench-inspector-changes-B4eOJNJh.js.br +0 -0
  118. package/dist/web/assets/workbench-inspector-changes-B4eOJNJh.js.gz +0 -0
  119. package/dist/web/assets/{workbench-pet-canvas-B2MZ33ry.js → workbench-pet-canvas-C_XAi7ez.js} +1 -1
  120. package/dist/web/assets/workbench-pet-canvas-C_XAi7ez.js.br +0 -0
  121. package/dist/web/assets/workbench-pet-canvas-C_XAi7ez.js.gz +0 -0
  122. package/dist/web/assets/workbench-shell-DQbj_ooS.js +15 -0
  123. package/dist/web/assets/workbench-shell-DQbj_ooS.js.br +0 -0
  124. package/dist/web/assets/workbench-shell-DQbj_ooS.js.gz +0 -0
  125. package/dist/web/index.html +12 -12
  126. package/dist/web/index.html.br +0 -0
  127. package/dist/web/index.html.gz +0 -0
  128. package/package.json +2 -2
  129. package/dist/web/assets/button-group-CiKTUtu2.js.br +0 -0
  130. package/dist/web/assets/button-group-CiKTUtu2.js.gz +0 -0
  131. package/dist/web/assets/check-DqH8BaGS.js +0 -1
  132. package/dist/web/assets/check-DqH8BaGS.js.br +0 -0
  133. package/dist/web/assets/check-DqH8BaGS.js.gz +0 -0
  134. package/dist/web/assets/checkbox-BW4uILvi.js.br +0 -0
  135. package/dist/web/assets/checkbox-BW4uILvi.js.gz +0 -0
  136. package/dist/web/assets/chunk-BO2N2NFS-BUKjYgWS.js.br +0 -0
  137. package/dist/web/assets/code-highlighter-C1j1Kcu-.js.br +0 -0
  138. package/dist/web/assets/code-highlighter-C1j1Kcu-.js.gz +0 -0
  139. package/dist/web/assets/code-languages-CaP8M7cE.js.br +0 -0
  140. package/dist/web/assets/code-languages-CaP8M7cE.js.gz +0 -0
  141. package/dist/web/assets/context-menu-D--ol5Is.js.br +0 -0
  142. package/dist/web/assets/context-menu-D--ol5Is.js.gz +0 -0
  143. package/dist/web/assets/dist-B3LT8os9.js +0 -1
  144. package/dist/web/assets/dist-B3LT8os9.js.br +0 -0
  145. package/dist/web/assets/dist-B3LT8os9.js.gz +0 -0
  146. package/dist/web/assets/dist-Dg2zCzgZ.js.br +0 -0
  147. package/dist/web/assets/es2015-keiDyoog.js.br +0 -0
  148. package/dist/web/assets/es2015-keiDyoog.js.gz +0 -0
  149. package/dist/web/assets/file-code-corner-DBltovZx.js.br +0 -0
  150. package/dist/web/assets/file-code-corner-DBltovZx.js.gz +0 -0
  151. package/dist/web/assets/file-navigation-view-preference-CufNNsrc.js.br +0 -0
  152. package/dist/web/assets/file-navigation-view-preference-CufNNsrc.js.gz +0 -0
  153. package/dist/web/assets/file-review-dialog-BJcvPK95.js.br +0 -0
  154. package/dist/web/assets/file-review-dialog-BJcvPK95.js.gz +0 -0
  155. package/dist/web/assets/file-tree-Br65eBgL.js.br +0 -0
  156. package/dist/web/assets/file-tree-Br65eBgL.js.gz +0 -0
  157. package/dist/web/assets/git-commit-horizontal-B8Fh6uIt.js.br +0 -0
  158. package/dist/web/assets/git-commit-horizontal-B8Fh6uIt.js.gz +0 -0
  159. package/dist/web/assets/git-history-panel-BPu7_V4u.js.br +0 -0
  160. package/dist/web/assets/git-history-panel-BPu7_V4u.js.gz +0 -0
  161. package/dist/web/assets/global-settings-dialog-mq0z2Wkd.js +0 -1
  162. package/dist/web/assets/global-settings-dialog-mq0z2Wkd.js.br +0 -0
  163. package/dist/web/assets/global-settings-dialog-mq0z2Wkd.js.gz +0 -0
  164. package/dist/web/assets/highlighted-body-OFNGDK62-B9UneXsh.js.br +0 -0
  165. package/dist/web/assets/highlighted-body-OFNGDK62-B9UneXsh.js.gz +0 -0
  166. package/dist/web/assets/index-CLUF6YQa.css +0 -2
  167. package/dist/web/assets/index-CLUF6YQa.css.br +0 -0
  168. package/dist/web/assets/index-CLUF6YQa.css.gz +0 -0
  169. package/dist/web/assets/index-CdL6pn7l.js +0 -4
  170. package/dist/web/assets/index-CdL6pn7l.js.br +0 -0
  171. package/dist/web/assets/index-CdL6pn7l.js.gz +0 -0
  172. package/dist/web/assets/lazy-message-response-BUy_3K13.js.br +0 -0
  173. package/dist/web/assets/lazy-message-response-BUy_3K13.js.gz +0 -0
  174. package/dist/web/assets/loader-circle-DYfMWclN.js +0 -1
  175. package/dist/web/assets/loader-circle-DYfMWclN.js.br +0 -0
  176. package/dist/web/assets/loader-circle-DYfMWclN.js.gz +0 -0
  177. package/dist/web/assets/mermaid-GHXKKRXX-DN7BNS3K.js +0 -1
  178. package/dist/web/assets/mermaid-GHXKKRXX-DN7BNS3K.js.br +0 -0
  179. package/dist/web/assets/mermaid-GHXKKRXX-DN7BNS3K.js.gz +0 -0
  180. package/dist/web/assets/message-response-CHiSTCUA.js.br +0 -0
  181. package/dist/web/assets/message-response-CHiSTCUA.js.gz +0 -0
  182. package/dist/web/assets/patch-diff-viewer-yBAeFKQ9.js.br +0 -0
  183. package/dist/web/assets/patch-diff-viewer-yBAeFKQ9.js.gz +0 -0
  184. package/dist/web/assets/project-file-popup-page-CCl_CU2a.js.br +0 -0
  185. package/dist/web/assets/project-file-popup-page-CCl_CU2a.js.gz +0 -0
  186. package/dist/web/assets/project-source-panel-bvidcsWq.js.br +0 -0
  187. package/dist/web/assets/project-source-panel-bvidcsWq.js.gz +0 -0
  188. package/dist/web/assets/prompt-input-controls-DWd_vgsW.js.br +0 -0
  189. package/dist/web/assets/prompt-input-controls-DWd_vgsW.js.gz +0 -0
  190. package/dist/web/assets/prompt-reference-token-BHH5NHbF.js.br +0 -0
  191. package/dist/web/assets/prompt-reference-token-BHH5NHbF.js.gz +0 -0
  192. package/dist/web/assets/provider-connection-queries-DCBm4pti.js.br +0 -0
  193. package/dist/web/assets/provider-connection-queries-DCBm4pti.js.gz +0 -0
  194. package/dist/web/assets/shiki-bundle-D5WnlOUZ.js.br +0 -0
  195. package/dist/web/assets/shiki-bundle-D5WnlOUZ.js.gz +0 -0
  196. package/dist/web/assets/tooltip-4ec-13io.js +0 -1
  197. package/dist/web/assets/tooltip-4ec-13io.js.br +0 -0
  198. package/dist/web/assets/tooltip-4ec-13io.js.gz +0 -0
  199. package/dist/web/assets/upload-CsaycpyW.js.br +0 -0
  200. package/dist/web/assets/upload-CsaycpyW.js.gz +0 -0
  201. package/dist/web/assets/useInfiniteQuery-6E3mPgZn.js.br +0 -4
  202. package/dist/web/assets/useInfiniteQuery-6E3mPgZn.js.gz +0 -0
  203. package/dist/web/assets/workbench-inspector-changes-BqeP4QV0.js.br +0 -0
  204. package/dist/web/assets/workbench-inspector-changes-BqeP4QV0.js.gz +0 -0
  205. package/dist/web/assets/workbench-pet-canvas-B2MZ33ry.js.br +0 -0
  206. package/dist/web/assets/workbench-pet-canvas-B2MZ33ry.js.gz +0 -0
  207. package/dist/web/assets/workbench-shell-CgE4WjAp.js +0 -15
  208. package/dist/web/assets/workbench-shell-CgE4WjAp.js.br +0 -0
  209. package/dist/web/assets/workbench-shell-CgE4WjAp.js.gz +0 -0
@@ -0,0 +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-DBbCRukl.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 v(e)&&!Ot(e)&&!Rt(e)&&Symbol.asyncIterator in e}function Ot(e){return Array.isArray(e)}function kt(e){return typeof e==`bigint`}function At(e){return typeof e==`boolean`}function jt(e){return e instanceof globalThis.Date}function Mt(e){return typeof e==`function`}function Nt(e){return v(e)&&!Ot(e)&&!Rt(e)&&Symbol.iterator in e}function Pt(e){return e===null}function Ft(e){return typeof e==`number`}function v(e){return typeof e==`object`&&!!e}function It(e){return e instanceof globalThis.RegExp}function y(e){return typeof e==`string`}function Lt(e){return typeof e==`symbol`}function Rt(e){return e instanceof globalThis.Uint8Array}function b(e){return e===void 0}function zt(e){return e.map(e=>Wt(e))}function Bt(e){return new Date(e.getTime())}function Vt(e){return new Uint8Array(e)}function Ht(e){return new RegExp(e.source,e.flags)}function Ut(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=Wt(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=Wt(e[n]);return t}function Wt(e){return Ot(e)?zt(e):jt(e)?Bt(e):Rt(e)?Vt(e):It(e)?Ht(e):v(e)?Ut(e):e}function Gt(e){return Wt(e)}function Kt(e,t){return Gt(t===void 0?e:{...t,...e})}function qt(e){return Qt(e)&&globalThis.Symbol.asyncIterator in e}function Jt(e){return Qt(e)&&globalThis.Symbol.iterator in e}function Yt(e){return e instanceof globalThis.Promise}function Xt(e){return e instanceof Date&&globalThis.Number.isFinite(e.getTime())}function Zt(e){return e instanceof globalThis.Uint8Array}function Qt(e){return typeof e==`object`&&!!e}function $t(e){return globalThis.Array.isArray(e)&&!globalThis.ArrayBuffer.isView(e)}function en(e){return e===void 0}function tn(e){return e===null}function nn(e){return typeof e==`boolean`}function rn(e){return typeof e==`number`}function an(e){return globalThis.Number.isInteger(e)}function on(e){return typeof e==`bigint`}function sn(e){return typeof e==`string`}function cn(e){return typeof e==`function`}function ln(e){return typeof e==`symbol`}var un;(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=Qt(t);return e.AllowArrayObject?n:n&&!$t(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?rn(t):Number.isFinite(t)}e.IsNumberLike=i;function a(t){let n=en(t);return e.AllowNullVoid?n||t===null:n}e.IsVoidLike=a})(un||={});function dn(e){return globalThis.Object.freeze(e).map(e=>gn(e))}function fn(e){return e}function pn(e){return e}function mn(e){return e}function hn(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=gn(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=gn(e[n]);return globalThis.Object.freeze(t)}function gn(e){return Ot(e)?dn(e):jt(e)?fn(e):Rt(e)?pn(e):It(e)?mn(e):v(e)?hn(e):e}function x(e,t){let n=t===void 0?e:{...t,...e};switch(un.InstanceMode){case`freeze`:return gn(n);case`clone`:return Gt(n);default:return n}}var _n=class extends Error{constructor(e){super(e)}},vn=Symbol.for(`TypeBox.Transform`),yn=Symbol.for(`TypeBox.Readonly`),bn=Symbol.for(`TypeBox.Optional`),xn=Symbol.for(`TypeBox.Hint`),S=Symbol.for(`TypeBox.Kind`);function Sn(e){return v(e)&&e[yn]===`Readonly`}function Cn(e){return v(e)&&e[bn]===`Optional`}function wn(e){return C(e,`Any`)}function Tn(e){return C(e,`Argument`)}function En(e){return C(e,`Array`)}function Dn(e){return C(e,`AsyncIterator`)}function On(e){return C(e,`BigInt`)}function kn(e){return C(e,`Boolean`)}function An(e){return C(e,`Computed`)}function jn(e){return C(e,`Constructor`)}function Mn(e){return C(e,`Date`)}function Nn(e){return C(e,`Function`)}function Pn(e){return C(e,`Integer`)}function Fn(e){return C(e,`Intersect`)}function In(e){return C(e,`Iterator`)}function C(e,t){return v(e)&&S in e&&e[S]===t}function Ln(e){return At(e)||Ft(e)||y(e)}function Rn(e){return C(e,`Literal`)}function zn(e){return C(e,`MappedKey`)}function Bn(e){return C(e,`MappedResult`)}function Vn(e){return C(e,`Never`)}function Hn(e){return C(e,`Not`)}function Un(e){return C(e,`Null`)}function Wn(e){return C(e,`Number`)}function Gn(e){return C(e,`Object`)}function Kn(e){return C(e,`Promise`)}function qn(e){return C(e,`Record`)}function w(e){return C(e,`Ref`)}function Jn(e){return C(e,`RegExp`)}function Yn(e){return C(e,`String`)}function Xn(e){return C(e,`Symbol`)}function Zn(e){return C(e,`TemplateLiteral`)}function Qn(e){return C(e,`This`)}function $n(e){return v(e)&&vn in e}function er(e){return C(e,`Tuple`)}function tr(e){return C(e,`Undefined`)}function T(e){return C(e,`Union`)}function nr(e){return C(e,`Uint8Array`)}function rr(e){return C(e,`Unknown`)}function ir(e){return C(e,`Unsafe`)}function ar(e){return C(e,`Void`)}function or(e){return v(e)&&S in e&&y(e[S])}function sr(e){return wn(e)||Tn(e)||En(e)||kn(e)||On(e)||Dn(e)||An(e)||jn(e)||Mn(e)||Nn(e)||Pn(e)||Fn(e)||In(e)||Rn(e)||zn(e)||Bn(e)||Vn(e)||Hn(e)||Un(e)||Wn(e)||Gn(e)||Kn(e)||qn(e)||w(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(!y(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 b(e)||kt(e)}function E(e){return b(e)||Ft(e)}function pr(e){return b(e)||At(e)}function D(e){return b(e)||y(e)}function mr(e){return b(e)||y(e)&&ur(e)&&lr(e)}function hr(e){return b(e)||y(e)&&ur(e)}function gr(e){return b(e)||j(e)}function _r(e){return v(e)&&e[bn]===`Optional`}function vr(e){return O(e,`Any`)&&D(e.$id)}function yr(e){return O(e,`Argument`)&&Ft(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`)&&y(e.target)&&Ot(e.parameters)&&e.parameters.every(e=>j(e))}function Tr(e){return O(e,`Constructor`)&&e.type===`Constructor`&&D(e.$id)&&Ot(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)&&Ot(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 v(e)&&Object.entries(e).every(([e,t])=>ur(e)&&j(t))}function Ar(e){return O(e,`Intersect`)&&!(y(e.type)&&e.type!==`object`)&&Ot(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 v(e)&&S in e&&e[S]===t}function Mr(e){return Fr(e)&&y(e.const)}function Nr(e){return Fr(e)&&Ft(e.const)}function Pr(e){return Fr(e)&&At(e.const)}function Fr(e){return O(e,`Literal`)&&D(e.$id)&&Ir(e.const)}function Ir(e){return At(e)||Ft(e)||y(e)}function Lr(e){return O(e,`MappedKey`)&&Ot(e.keys)&&e.keys.every(e=>Ft(e)||y(e))}function Rr(e){return O(e,`MappedResult`)&&kr(e.properties)}function zr(e){return O(e,`Never`)&&v(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)&&v(e.patternProperties)&&(e=>{let t=Object.getOwnPropertyNames(e.patternProperties);return t.length===1&&lr(t[0])&&v(e.patternProperties)&&j(e.patternProperties[t[0]])})(e)}function Wr(e){return O(e,`Ref`)&&D(e.$id)&&y(e.$ref)}function Gr(e){return O(e,`RegExp`)&&D(e.$id)&&y(e.source)&&y(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`&&y(e.pattern)&&e.pattern[0]===`^`&&e.pattern[e.pattern.length-1]===`$`}function Yr(e){return O(e,`This`)&&D(e.$id)&&y(e.$ref)}function Xr(e){return v(e)&&vn in e}function Zr(e){return O(e,`Tuple`)&&e.type===`array`&&D(e.$id)&&Ft(e.minItems)&&Ft(e.maxItems)&&e.minItems===e.maxItems&&(b(e.items)&&b(e.additionalItems)&&e.minItems===0||Ot(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)&&v(e)&&Ot(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 v(e)&&S in e&&y(e[S])&&!cr.includes(e[S])}function j(e){return v(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 x({[S]:`Any`},e)}function Ei(e,t){return x({[S]:`Array`,type:`array`,items:e},t)}function Di(e){return x({[S]:`Argument`,index:e})}function Oi(e,t){return x({[S]:`AsyncIterator`,type:`AsyncIterator`,items:e},t)}function M(e,t,n){return x({[S]:`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 x({[S]:`Never`,not:{}},e)}function P(e){return x({[S]:`MappedResult`,properties:e})}function ji(e,t,n){return x({[S]:`Constructor`,type:`Constructor`,parameters:e,returns:t},n)}function Mi(e,t,n){return x({[S]:`Function`,type:`Function`,parameters:e,returns:t},n)}function Ni(e,t){return x({[S]:`Union`,anyOf:e},t)}function Pi(e){return e.some(e=>Cn(e))}function Fi(e){return e.map(e=>Cn(e)?Ii(e):e)}function Ii(e){return Ai(e,[bn])}function Li(e,t){return Pi(e)?xo(Ni(Fi(e),t)):Ni(Fi(e),t)}function Ri(e,t){return e.length===1?x(e[0],t):e.length===0?N(t):Li(e,t)}function F(e,t){return e.length===0?N(t):e.length===1?x(e[0],t):Ni(e,t)}var zi=class extends _n{};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 _n{};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 _n{};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 x({[S]:`Literal`,const:e,type:typeof e},t)}function fa(e){return x({[S]:`Boolean`,type:`boolean`},e)}function pa(e){return x({[S]:`BigInt`,type:`bigint`},e)}function ma(e){return x({[S]:`Number`,type:`number`},e)}function ha(e){return x({[S]:`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 _n{};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(`|`)})`:Wn(e)||Pn(e)||On(e)?`${t}${oi}`:Yn(e)?`${t}${si}`:Rn(e)?`${t}${xa(e.const.toString())}`:kn(e)?`${t}${ai}`:(()=>{throw new ba(`Unexpected Kind '${e[S]}'`)})()}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=y(e)?Ca(ya(e)):Ca(e);return x({[S]:`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):Rn(e)?Oa(e.const):Wn(e)||Pn(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=>!Vn(e))}function Fa(e,t){return Ao(Pa(Na(e,t)))}function Ia(e){return e.some(e=>Vn(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 Fn(e)?Fa(e.allOf,t):T(e)?La(e.anyOf,t):er(e)?Ra(e.items??[],t):En(e)?za(e.items,t):Gn(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(w(e)||w(t)){if(!sr(e)||!sr(t))throw new _n(`Index types using Ref parameters require both Type and Key to be of TSchema`);return M(`Index`,[e,t])}return Bn(t)?Ma(e,t,n):zn(t)?Ja(e,t,n):x(sr(t)?Ua(e,ka(t)):Ua(e,t),n)}function Ga(e,t,n){return{[t]:Wa(e,[t],Gt(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 x({[S]:`Iterator`,type:`Iterator`,items:e},t)}function Xa(e){return globalThis.Object.keys(e).filter(t=>!Cn(e[t]))}function Za(e,t){let n=Xa(e);return x(n.length>0?{[S]:`Object`,type:`object`,required:n,properties:e}:{[S]:`Object`,type:`object`,properties:e},t)}var L=Za;function Qa(e,t){return x({[S]:`Promise`,type:`Promise`,item:e},t)}function $a(e){return x(Ai(e,[yn]))}function eo(e){return x({...e,[yn]:`Readonly`})}function to(e,t){return t===!1?$a(e):eo(e)}function no(e,t){let n=t??!0;return Bn(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 x(e.length>0?{[S]:`Tuple`,type:`array`,items:e,additionalItems:!1,minItems:e.length,maxItems:e.length}:{[S]:`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 Cn(t)?xo(ho(e,Ai(t,[bn]))):Sn(t)?no(ho(e,Ai(t,[yn]))):Bn(t)?so(e,t.properties):zn(t)?fo(e,t.keys):jn(t)?ji(po(e,t.parameters),ho(e,t.returns),n):Nn(t)?Mi(po(e,t.parameters),ho(e,t.returns),n):Dn(t)?Oi(ho(e,t.items),n):In(t)?Ya(ho(e,t.items),n):Fn(t)?jo(po(e,t.allOf),n):T(t)?F(po(e,t.anyOf),n):er(t)?oo(po(e,t.items??[]),n):Gn(t)?L(mo(e,t.properties),n):En(t)?Ei(ho(e,t.items),n):Kn(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({[S]:`MappedKey`,keys:r})),n)}function vo(e){return x(Ai(e,[bn]))}function yo(e){return x({...e,[bn]:`Optional`})}function bo(e,t){return t===!1?vo(e):yo(e)}function xo(e,t){let n=t??!0;return Bn(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=>Gn(e)),r=sr(t.unevaluatedProperties)?{unevaluatedProperties:t.unevaluatedProperties}:{};return x(t.unevaluatedProperties===!1||sr(t.unevaluatedProperties)||n?{...r,[S]:`Intersect`,type:`object`,allOf:e}:{...r,[S]:`Intersect`,allOf:e},t)}function Eo(e){return e.every(e=>Cn(e))}function Do(e){return Ai(e,[bn])}function Oo(e){return e.map(e=>Cn(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 x(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 x(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 _n(`Ref: $ref must be a string`);return x({[S]:`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 x(An(e)?No(e.target,e.parameters):Fn(e)?Fo(e.allOf):T(e)?Io(e.anyOf):Kn(e)?Lo(e.item):w(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 Fn(e)?Vo(e.allOf):T(e)?Ho(e.anyOf):er(e)?Uo(e.items??[]):En(e)?Wo(e.items):Gn(e)?Go(e.properties):qn(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 x(Ri($o(qo(e))),t)}function $o(e){return e.map(e=>e===`[number]`?ma():I(e))}function es(e,t){return An(e)?Xo(e.target,e.parameters):w(e)?Zo(e.$ref):Bn(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],Gt(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=>!Vn(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 x({[S]:`Date`,type:`Date`},e)}function us(e){return x({[S]:`Null`,type:`null`},e)}function ds(e){return x({[S]:`Symbol`,type:`symbol`},e)}function fs(e){return x({[S]:`Undefined`,type:`undefined`},e)}function ps(e){return x({[S]:`Uint8Array`,type:`Uint8Array`},e)}function ms(e){return x({[S]:`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)||Nt(e)?_s(Ti(),t):Ot(e)?no(oo(hs(e))):Rt(e)?ps():jt(e)?ls():v(e)?_s(L(gs(e)),t):Mt(e)?_s(Mi([],ms()),t):b(e)?fs():Pt(e)?us():Lt(e)?ds():kt(e)?pa():Ft(e)||At(e)||y(e)?I(e):L({})}function ys(e,t){return x(vs(e,!0),t)}function bs(e,t){return jn(e)?oo(e.parameters,t):N(t)}function xs(e,t){if(b(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,[xn]:`Enum`})}var Ss=class extends _n{},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)&&Ft(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[xn]===`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)&&y(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)?b(e.items)&&!b(t.items)||!b(e.items)&&b(t.items)?R.False:b(e.items)&&!b(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[S]}'`)}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,Gt(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 Bn(e)?Nc(e,t,n,r,i):zn(e)?x(zc(e,t,n,r,i)):x(Pc(e,t,n,r),i)}function Ic(e,t,n,r,i){return{[e]:Fc(I(e),t,n,r,Gt(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[S]===`Intersect`?Bc(e):e[S]===`Union`?Vc(e):e[S]===`Not`?Hc(e):e[S]===`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)?x(Wc(e,t),n):Bn(e)?x(Yc(e,t),n):x(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)?x(Xc(e,t),n):Bn(e)?x(tl(e,t),n):x(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 jn(e)?x(e.returns,t):N(t)}function rl(e){return no(xo(e))}function il(e,t,n){return x({[S]:`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,[xn]:`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(b(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):Rn(e)?cl(e.const,t,n):kn(e)?pl(e,t,n):Pn(e)?ml(e,t,n):Wn(e)?hl(e,t,n):Jn(e)?ll(e,t,n):Yn(e)?ul(e,t,n):wn(e)?dl(e,t,n):Vn(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 b(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=Sn(t),r=Cn(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 jn(t)?bl(e,t):Nn(t)?xl(e,t):Fn(t)?Sl(e,t):T(t)?Cl(e,t):er(t)?wl(e,t):En(t)?Tl(e,t):Dn(t)?El(e,t):In(t)?Dl(e,t):Kn(t)?Ol(e,t):Gn(t)?kl(e,t):qn(t)?Al(e,t):Tn(t)?jl(e,t):t}function Il(e,t){return Fl(t,Kt(e))}function Ll(e){return x({[S]:`Integer`,type:`integer`},e)}function Rl(e,t,n){return{[e]:Yl(I(e),t,Gt(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 zn(e)?Vl(e,t,n):Zn(e)?Kl(e,t,n):T(e)?F(Jl(e.anyOf,t),n):Rn(e)?I(ql(e.const,t),n):x(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,Gt(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,[vn,`$id`,`required`,`properties`]);return L(ou(n,t),r)}function cu(e){return F(e.reduce((e,t)=>Ln(t)?[...e,I(t)]:e,[]))}function lu(e,t){return Fn(e)?jo(ru(e.allOf,t)):T(e)?F(iu(e.anyOf,t)):Gn(e)?su(e,t,e.properties):L({})}function uu(e,t,n){let r=Ot(t)?cu(t):t,i=sr(t)?ka(t):t,a=w(e),o=w(t);return Bn(e)?nu(e,i,n):zn(t)?mu(e,t,n):a&&o||!a&&o||a&&!o?M(`Omit`,[e,r],n):x({...lu(e,i),...n})}function du(e,t,n){return{[t]:uu(e,[t],Gt(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,Gt(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,[vn,`$id`,`required`,`properties`]);return L(bu(n,t),r)}function Su(e){return F(e.reduce((e,t)=>Ln(t)?[...e,I(t)]:e,[]))}function Cu(e,t){return Fn(e)?jo(vu(e.allOf,t)):T(e)?F(yu(e.anyOf,t)):Gn(e)?xu(e,t,e.properties):L({})}function wu(e,t,n){let r=Ot(t)?Su(t):t,i=sr(t)?ka(t):t,a=w(e),o=w(t);return Bn(e)?_u(e,i,n):zn(t)?Ou(e,t,n):a&&o||!a&&o||a&&!o?M(`Pick`,[e,r],n):x({...Cu(e,i),...n})}function Tu(e,t,n){return{[t]:wu(e,[t],Gt(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,[vn,`$id`,`required`,`properties`]);return L(ju(t),n)}function Nu(e){return e.map(e=>Pu(e))}function Pu(e){return An(e)?ku(e.target,e.parameters):w(e)?Au(e.$ref):Fn(e)?jo(Nu(e.allOf)):T(e)?F(Nu(e.anyOf)):Gn(e)?Mu(e,e.properties):On(e)||kn(e)||Pn(e)||Rn(e)||Un(e)||Wn(e)||Yn(e)||Xn(e)||tr(e)?e:L({})}function Fu(e,t){return Bn(e)?Ru(e,t):x({...Pu(e),...t})}function Iu(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=Fu(e[r],Gt(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],[bn]);return t}function Hu(e,t){let n=Ai(e,[vn,`$id`,`required`,`properties`]);return L(Vu(t),n)}function Uu(e){return e.map(e=>Wu(e))}function Wu(e){return An(e)?zu(e.target,e.parameters):w(e)?Bu(e.$ref):Fn(e)?jo(Uu(e.allOf)):T(e)?F(Uu(e.anyOf)):Gn(e)?Hu(e,e.properties):On(e)||kn(e)||Pn(e)||Rn(e)||Un(e)||Wn(e)||Yn(e)||Xn(e)||tr(e)?e:L({})}function Gu(e,t){return Bn(e)?Ju(e,t):x({...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=>w(t)?Xu(e,t.$ref):_d(e,t))}function Xu(e,t){return t in e?w(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=Kt(t);return i.patternProperties[r]=n,i}function pd(e,t){return w(t)?{...Xu(e,t.$ref),[vn]:t[vn]}: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 Cn(t)?x(_d(e,Ai(t,[bn])),t):Sn(t)?x(_d(e,Ai(t,[yn])),t):$n(t)?x(pd(e,t),t):En(t)?x(ad(e,t.items),t):Dn(t)?x(od(e,t.items),t):An(t)?x(id(e,t.target,t.parameters)):jn(t)?x(sd(e,t.parameters,t.returns),t):Nn(t)?x(cd(e,t.parameters,t.returns),t):Fn(t)?x(ld(e,t.allOf),t):In(t)?x(ud(e,t.items),t):Gn(t)?x(dd(e,t.properties),t):qn(t)?x(fd(e,t)):er(t)?x(md(e,t.items||[]),t):T(t)?x(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]:x(this.$defs[e],t)};return x({[S]:`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 x({[S]:`Not`,not:e},t)}function Cd(e,t){return Nn(e)?oo(e.parameters,t):N()}var wd=0;function Td(e,t={}){b(t.$id)&&(t.$id=`T${wd++}`);let n=Kt(e({[S]:`This`,$ref:`${t.$id}`}));return n.$id=t.$id,x({[xn]:`Recursive`,...n},t)}function Ed(e,t){let n=y(e)?new globalThis.RegExp(e):e;return x({[S]:`RegExp`,type:`RegExp`,source:n.source,flags:n.flags},t)}function Dd(e){return Fn(e)?e.allOf:T(e)?e.anyOf:er(e)?e.items??[]:[]}function Od(e){return Dd(e)}function kd(e,t){return Nn(e)?x(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[vn].Encode(e(n)),Decode:e=>this.decode(t[vn].Decode(e))};return{...t,[vn]:n}}EncodeSchema(e,t){let n={Decode:this.decode,Encode:e};return{...t,[vn]: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 x({[S]:e[S]??`Unsafe`},e)}function Pd(e){return x({[S]:`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.Union([U.Literal(`checking`),U.Literal(`backing-up`),U.Literal(`downloading`),U.Literal(`installing`),U.Literal(`rolling-back`),U.Literal(`completed`)]),Gd=U.Object({percent:U.Integer({maximum:100,minimum:0}),phase:Wd},{additionalProperties:!1}),Kd=U.Object({progress:U.Union([Gd,U.Null()])},{additionalProperties:!1}),qd=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 Jd=U.Object({appVersion:Hd,codexVersion:Hd,latestVersion:Hd,releaseNotes:U.Null(),status:U.Literal(`restart-required`),updateAvailable:U.Literal(!1)},{additionalProperties:!1}),Yd=U.Union([U.Literal(`local`),U.Literal(`lan`)]),Xd=U.Object({authenticated:U.Boolean(),mode:Yd,version:U.Literal(1)},{additionalProperties:!1});U.Object({code:U.String({minLength:1})},{additionalProperties:!1});var Zd=U.String({maxLength:32768,minLength:1,pattern:`^(?!.*[\\u0000\\r\\n])(?:/|[A-Za-z]:[\\\\/]|\\\\\\\\[^\\\\/]+[\\\\/][^\\\\/]+).*$`}),Qd=U.String({maxLength:64,minLength:1}),$d=U.Object({path:Zd},{additionalProperties:!1}),ef=U.Object({id:Qd,path:Zd},{additionalProperties:!1}),tf=U.Readonly(U.Array(ef,{minItems:1,uniqueItems:!0})),nf=U.Readonly(U.Array($d,{minItems:1,uniqueItems:!0}));U.Object({rootPath:Zd},{additionalProperties:!1}),pi(`date-time`)||mi(`date-time`,e=>!Number.isNaN(Date.parse(e)));var rf=U.String({format:`date-time`}),af=U.Union([rf,U.Null()]),W=U.String({minLength:1,pattern:`^(?![A-Za-z]:)(?!/)(?!.*(?:^|/)\\.\\.?(?:/|$))(?!.*//)(?!.*\\\\)(?!.*\\/$).+$`}),of=U.String({maxLength:128,minLength:1,pattern:`^[A-Za-z0-9._:-]+$`});U.Object({query:U.String({maxLength:256}),rootPath:U.Optional(Zd),sessionId:of},{additionalProperties:!1});var sf=U.Object({name:U.String({minLength:1}),path:W,rootId:Qd,rootPath:Zd},{additionalProperties:!1}),cf=U.Object({data:U.Array(sf,{maxItems:50})},{additionalProperties:!1});U.Object({rootPath:U.Optional(Zd),sessionId:of},{additionalProperties:!1});var lf=U.Object({},{additionalProperties:!1}),uf=U.String({maxLength:32768,minLength:1,pattern:`^[^\\u0000\\r\\n]+$`}),df=U.Object({createdAt:rf,id:U.String({minLength:1}),name:U.String({minLength:1}),roots:tf},{additionalProperties:!1}),ff=Zd;U.Object({includeHidden:U.Optional(U.Boolean()),path:U.Optional(ff)},{additionalProperties:!1});var pf=U.Object({name:U.String({minLength:1}),path:ff},{additionalProperties:!1}),mf=U.Object({name:U.String({minLength:1}),path:ff},{additionalProperties:!1}),hf=U.Object({entries:U.Array(pf),parentPath:U.Union([ff,U.Null()]),path:ff,roots:U.Array(mf)},{additionalProperties:!1}),gf=U.Union([U.Literal(`file`),U.Literal(`image`)]);U.Object({includeHidden:U.Optional(U.Boolean()),kind:gf,path:U.Optional(ff)},{additionalProperties:!1});var _f=U.Object({name:U.String({minLength:1}),path:ff,type:U.Union([U.Literal(`directory`),U.Literal(`file`)])},{additionalProperties:!1}),vf=U.Object({entries:U.Array(_f),parentPath:U.Union([ff,U.Null()]),path:ff,roots:U.Array(mf)},{additionalProperties:!1});U.Object({path:ff},{additionalProperties:!1}),U.Object({roots:nf},{additionalProperties:!1});var yf=U.Object({project:df},{additionalProperties:!1}),bf=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`)]),xf=U.Union([U.Literal(`editor`),U.Literal(`file-manager`),U.Literal(`system-default`),U.Literal(`terminal`),U.Literal(`tool`)]),Sf=U.Object({id:bf,kind:xf,name:U.String({minLength:1})},{additionalProperties:!1}),Cf=U.Union([U.Literal(`darwin`),U.Literal(`linux`),U.Literal(`win32`)]),wf=U.Object({apps:U.Array(Sf,{uniqueItems:!0}),platform:Cf},{additionalProperties:!1});U.Object({appId:bf,path:U.Optional(uf)},{additionalProperties:!1});var Tf=U.Object({appId:bf,path:U.Optional(uf)},{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 Ef=U.Object({project:df},{additionalProperties:!1});U.Object({},{additionalProperties:!1});var Df=U.Object({projectId:U.String({minLength:1}),status:U.Literal(`removed`)},{additionalProperties:!1}),Of=U.Object({id:U.String({minLength:1}),pinned:U.Boolean(),projectId:U.String({minLength:1}),title:U.String({minLength:1}),updatedAt:rf},{additionalProperties:!1}),kf=U.Union([U.Literal(`pending`),U.Literal(`running`),U.Literal(`completed`),U.Literal(`failed`),U.Literal(`declined`),U.Literal(`interrupted`)]),Af=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}),jf=U.Intersect([Af,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`)})])]),Mf=50*1024*1024,Nf=50*1024*1024,Pf=10*1024*1024,Ff=50*1024*1024,If=Math.max(Mf,Pf),Lf=1500,Rf=512*1024*1024,zf=`.png,.jpg,.jpeg,.webp,.gif`,Bf=`.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(`,`),Vf=`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(`,`),Hf=[...Bf,...Vf].join(`,`);U.Union([U.Literal(`image/gif`),U.Literal(`image/jpeg`),U.Literal(`image/png`),U.Literal(`image/webp`)]);var Uf=U.String({maxLength:255,minLength:1}),Wf=U.Union([U.Literal(`file`),U.Literal(`image`),U.Literal(`text`)]),Gf=U.Object({name:U.String({minLength:1})},{additionalProperties:!1});function Kf(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 qf=U.Object({id:U.String({minLength:1}),kind:Wf,mediaType:Uf,name:U.String({maxLength:255,minLength:1}),size:U.Integer({maximum:Rf,minimum:1})},{additionalProperties:!1});U.Object({},{additionalProperties:!1});var Jf=U.Object({attachmentId:U.String({minLength:1}),status:U.Literal(`opened`)},{additionalProperties:!1}),Yf=U.Union([U.Literal(`commentary`),U.Literal(`final_answer`)]),Xf=U.Object({attachments:U.Optional(U.Array(qf,{maxItems:Lf})),id:U.String({minLength:1}),phase:U.Optional(Yf),role:U.Union([U.Literal(`user`),U.Literal(`assistant`)]),skills:U.Optional(U.Array(Gf)),text:U.String(),type:U.Literal(`message`)},{additionalProperties:!1}),Zf=U.Object({content:U.String(),id:U.String({minLength:1}),summary:U.String(),type:U.Literal(`reasoning`)},{additionalProperties:!1}),Qf=U.Object({bytes:U.Integer({minimum:0}),lines:U.Integer({minimum:0})},{additionalProperties:!1}),$f=U.Object({command:U.String(),cwd:U.String(),exitCode:U.Optional(U.Integer()),id:U.String({minLength:1}),output:U.Optional(U.String()),outputOmitted:Qf,status:kf,type:U.Literal(`command`)},{additionalProperties:!1}),ep=U.Object({command:U.String({minLength:1}),cwd:U.String({minLength:1}),id:U.String({minLength:1}),itemId:U.String({minLength:1})},{additionalProperties:!1}),tp=U.Object({data:U.Array(ep)},{additionalProperties:!1}),np=U.Object({status:U.Literal(`terminated`),terminalId:U.String({minLength:1})},{additionalProperties:!1}),rp=U.Union([U.String(),U.Null()]),ip=U.Union([U.Number(),U.Null()]),ap={description:rp,id:U.String({minLength:1}),required:U.Boolean(),title:U.String({minLength:1})},op=U.Object({label:U.String({minLength:1}),value:U.String()},{additionalProperties:!1}),sp=U.Union([U.Object({...ap,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({...ap,defaultValue:U.Union([U.String(),U.Null()]),options:U.Array(op,{minItems:1}),type:U.Literal(`select`)},{additionalProperties:!1}),U.Object({...ap,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(op,{minItems:1}),type:U.Literal(`multi_select`)},{additionalProperties:!1}),U.Object({...ap,defaultValue:ip,maximum:ip,minimum:ip,type:U.Union([U.Literal(`number`),U.Literal(`integer`)])},{additionalProperties:!1}),U.Object({...ap,defaultValue:U.Union([U.Boolean(),U.Null()]),type:U.Literal(`boolean`)},{additionalProperties:!1})]),cp=U.Record(U.String(),U.Union([U.String(),U.Number(),U.Boolean(),U.Array(U.String())])),lp=U.Union([U.Object({action:U.Literal(`accept`),content:cp},{additionalProperties:!1}),U.Object({action:U.Union([U.Literal(`decline`),U.Literal(`cancel`)]),content:U.Null()},{additionalProperties:!1})]),up=U.Union([U.Literal(`pending`),U.Literal(`resolved`),U.Literal(`expired`)]),dp=U.Union([U.Literal(`allow`),U.Literal(`allow_for_session`),U.Literal(`deny`)]),fp=U.Object({host:U.String({minLength:1}),protocol:U.Union([U.Literal(`http`),U.Literal(`https`),U.Literal(`socks5Tcp`),U.Literal(`socks5Udp`)])},{additionalProperties:!1}),pp={createdAt:rf,expiresAt:af,itemId:U.String({minLength:1}),projectId:U.String({minLength:1}),requestId:U.String({minLength:1}),status:up,taskId:U.String({minLength:1}),turnId:U.String({minLength:1})},mp={itemId:U.String({minLength:1}),projectId:U.String({minLength:1}),taskId:U.String({minLength:1}),turnId:U.String({minLength:1})},hp=U.Object({description:U.String(),label:U.String({minLength:1})},{additionalProperties:!1}),gp={header:U.String({minLength:1}),id:U.String({minLength:1}),isSecret:U.Boolean(),prompt:U.String({minLength:1})},_p=U.Union([U.Object({...gp,isOther:U.Boolean(),options:U.Array(hp,{minItems:1}),type:U.Literal(`choice`)},{additionalProperties:!1}),U.Object({...gp,isOther:U.Literal(!0),options:U.Array(hp,{maxItems:0}),type:U.Literal(`choice`)},{additionalProperties:!1}),U.Object({...gp,isOther:U.Literal(!1),options:U.Array(hp,{maxItems:2,minItems:2}),type:U.Literal(`confirmation`)},{additionalProperties:!1}),U.Object({...gp,isOther:U.Boolean(),options:U.Array(hp,{maxItems:0}),type:U.Literal(`short_text`)},{additionalProperties:!1})]),vp=U.Object({...pp,availableDecisions:U.Array(dp,{minItems:1}),grantRoot:U.Union([U.String(),U.Null()]),reason:U.Union([U.String(),U.Null()]),type:U.Literal(`file_change_approval`)},{additionalProperties:!1}),yp=U.Union([U.Literal(`network`),U.Literal(`file_system`)]),bp=U.Union([U.Literal(`read`),U.Literal(`write`),U.Literal(`deny`)]),xp=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})]),Sp=U.Object({entries:U.Array(U.Object({access:bp,path:xp},{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}),Cp=U.Object({fileSystem:U.Union([Sp,U.Null()]),network:U.Union([U.Object({enabled:U.Union([U.Boolean(),U.Null()])},{additionalProperties:!1}),U.Null()])},{additionalProperties:!1}),wp=U.Object({...pp,additionalPermissions:U.Optional(U.Union([Cp,U.Null()])),availableDecisions:U.Array(dp,{minItems:1}),command:U.Union([U.String(),U.Null()]),cwd:U.Union([U.String(),U.Null()]),kind:U.Union([U.Literal(`command`),U.Literal(`write_stdin`)]),networkAccess:U.Union([fp,U.Null()]),reason:U.Union([U.String(),U.Null()]),type:U.Literal(`command_approval`)},{additionalProperties:!1}),Tp=U.Object({...pp,cwd:U.String({minLength:1}),environmentId:U.Union([U.String({minLength:1}),U.Null()]),permissions:Cp,reason:U.Union([U.String(),U.Null()]),type:U.Literal(`permissions_approval`)},{additionalProperties:!1}),Ep=U.Object({...pp,questions:U.Array(_p,{minItems:1,maxItems:3}),type:U.Literal(`user_input`)},{additionalProperties:!1}),Dp={...pp,message:U.String({minLength:1}),serverName:U.String({minLength:1}),type:U.Literal(`mcp_elicitation`)},Op=U.Object({...Dp,fields:U.Array(sp),mode:U.Literal(`form`)},{additionalProperties:!1}),kp=U.Object({...Dp,mode:U.Literal(`url`),url:U.String({minLength:1})},{additionalProperties:!1}),Ap=U.Object({...Dp,mode:U.Literal(`unsupported`)},{additionalProperties:!1}),jp=U.Union([Op,kp,Ap]),Mp=U.Union([wp,vp,Tp,Ep,jp]);function Np(e){return U.Union([U.Object({...wp.properties,status:U.Literal(e)},{additionalProperties:!1}),U.Object({...vp.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({...Op.properties,status:U.Literal(e)},{additionalProperties:!1}),U.Object({...kp.properties,status:U.Literal(e)},{additionalProperties:!1}),U.Object({...Ap.properties,status:U.Literal(e)},{additionalProperties:!1})])}var Pp=Np(`pending`),Fp=Np(`resolved`),Ip=Np(`expired`),Lp=U.Object({decision:dp},{additionalProperties:!1}),Rp=U.Object({answers:U.Record(U.String(),U.Array(U.String({minLength:1}),{maxItems:1,minItems:1}))},{additionalProperties:!1}),zp=U.Object({grantedPermissions:U.Array(yp,{maxItems:2,uniqueItems:!0}),scope:U.Union([U.Literal(`turn`),U.Literal(`session`)])},{additionalProperties:!1});U.Union([U.Object({...mp,resolution:Lp,type:U.Literal(`command_approval`)},{additionalProperties:!1}),U.Object({...mp,resolution:Lp,type:U.Literal(`file_change_approval`)},{additionalProperties:!1}),U.Object({...mp,resolution:zp,type:U.Literal(`permissions_approval`)},{additionalProperties:!1}),U.Object({...mp,resolution:Rp,type:U.Literal(`user_input`)},{additionalProperties:!1}),U.Object({...mp,resolution:lp,type:U.Literal(`mcp_elicitation`)},{additionalProperties:!1})]);var Bp=U.Object({request:Mp},{additionalProperties:!1}),Vp=U.Object({diff:U.String(),kind:U.Union([U.Literal(`create`),U.Literal(`update`),U.Literal(`delete`)]),path:U.String({minLength:1})},{additionalProperties:!1}),Hp=U.String({maxLength:64,minLength:64,pattern:`^[a-f0-9]{64}$`}),Up=U.String({maxLength:1024,minLength:1,pattern:`\\S`}),Wp=U.String({maxLength:1024,minLength:1,pattern:`^(?!\\.{1,2}$)(?!.*[\\u0000\\r\\n])[^/\\\\]+$`}),Gp=U.Array(W,{maxItems:500,minItems:1,uniqueItems:!0}),Kp=U.String({maxLength:1e4,minLength:1,pattern:`\\S`}),qp=U.Object({diff:U.String(),kind:U.Union([U.Literal(`create`),U.Literal(`update`),U.Literal(`delete`)]),path:W},{additionalProperties:!1}),Jp=U.Object({baseBranches:U.Array(U.String({minLength:1}),{uniqueItems:!0}),branch:U.Union([U.String({minLength:1}),U.Null()]),branches:U.Array(Up,{uniqueItems:!0}),repositoryMode:U.Union([U.Literal(`root`),U.Literal(`children`),U.Literal(`none`)]),snapshot:Hp,staged:U.Array(qp),unstaged:U.Array(qp)},{additionalProperties:!1});U.Object({includeDiff:U.Optional(U.Boolean()),repository:U.Optional(Wp),rootPath:Zd},{additionalProperties:!1});var Yp=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}),Xp=U.String({maxLength:20,minLength:1,pattern:`^[0-9]+$`});U.Object({cursor:U.Optional(Xp),repository:U.Optional(W),rootPath:Zd},{additionalProperties:!1});var Zp=U.Object({branch:U.Union([Up,U.Null()]),commits:U.Array(Yp,{maxItems:20}),nextCursor:U.Union([Xp,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}),Qp=U.String({maxLength:64,minLength:40,pattern:`^[a-f0-9]+$`}),$p=U.String({maxLength:20,minLength:1,pattern:`^[0-9]+$`});U.Object({cursor:U.Optional($p),repository:U.Optional(W),rootPath:Zd,sha:Qp},{additionalProperties:!1});var em=U.Object({kind:U.Union([U.Literal(`create`),U.Literal(`update`),U.Literal(`delete`)]),path:W},{additionalProperties:!1}),tm=U.Object({files:U.Array(em,{maxItems:100}),nextCursor:U.Union([$p,U.Null()])},{additionalProperties:!1});U.Object({path:W,repository:U.Optional(W),rootPath:Zd,sha:Qp},{additionalProperties:!1});var nm=U.Object({diff:U.String({maxLength:512*1024}),truncated:U.Boolean()},{additionalProperties:!1});U.Object({branch:Up,expectedSnapshot:Hp},{additionalProperties:!1}),U.Object({branch:Up,expectedSnapshot:Hp},{additionalProperties:!1});var rm=U.Object({branch:U.Union([Up,U.Null()]),current:U.Boolean(),path:ff},{additionalProperties:!1}),im=U.Object({worktrees:U.Array(rm,{maxItems:256})},{additionalProperties:!1});U.Object({branch:Up,expectedSnapshot:Hp},{additionalProperties:!1}),U.Object({path:ff},{additionalProperties:!1});var am=U.Object({project:df,worktree:rm},{additionalProperties:!1});U.Object({expectedSnapshot:Hp,paths:Gp,repository:U.Optional(Wp)},{additionalProperties:!1});var om=U.Object({message:Kp,snapshot:Hp},{additionalProperties:!1});U.Object({action:U.Union([U.Literal(`commit`),U.Literal(`commit_and_push`)]),expectedSnapshot:Hp,message:Kp,paths:Gp,repository:U.Optional(Wp)},{additionalProperties:!1});var sm=U.Object({branch:U.Union([U.String({minLength:1}),U.Null()]),commitSha:U.String({maxLength:64,minLength:7,pattern:`^[a-f0-9]+$`}),message:Kp,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}),cm=U.Object({path:W,type:U.Union([U.Literal(`directory`),U.Literal(`file`)])},{additionalProperties:!1});U.Object({path:U.Optional(W),rootPath:U.Optional(Zd)},{additionalProperties:!1});var lm=U.Object({entries:U.Array(cm),path:U.Union([W,U.Null()])},{additionalProperties:!1}),um=U.String({maxLength:255,minLength:1,pattern:`^(?!\\.\\.?$)[^/\\\\\\u0000\\r\\n]+$`});U.Object({name:um,path:W},{additionalProperties:!1});var dm=U.Object({path:W},{additionalProperties:!1});U.Object({path:W},{additionalProperties:!1});var fm=U.Object({path:W,status:U.Literal(`deleted`)},{additionalProperties:!1});U.Object({cursor:U.Optional(U.Integer({minimum:0})),path:uf,rootPath:U.Optional(Zd)},{additionalProperties:!1});var pm=U.Object({content:U.String(),nextCursor:U.Union([U.Integer({minimum:0}),U.Null()]),path:uf},{additionalProperties:!1}),mm=U.Object({changes:U.Array(Vp),id:U.String({minLength:1}),status:kf,type:U.Literal(`file_change`)},{additionalProperties:!1}),hm=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:kf,type:U.Literal(`tool`)},{additionalProperties:!1}),gm=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:kf,type:U.Literal(`runtime_status`)},{additionalProperties:!1}),_m=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}),vm=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:kf,type:U.Literal(`runtime_status`)},{additionalProperties:!1}),ym=U.Union([gm,_m,vm]),bm=U.Object({id:U.String({minLength:1}),text:U.String(),type:U.Literal(`plan`)},{additionalProperties:!1}),xm=U.Object({detail:U.Optional(U.String()),id:U.String({minLength:1}),label:U.String({minLength:1}),status:U.Optional(kf),transient:U.Optional(U.Boolean()),type:U.Literal(`activity`)},{additionalProperties:!1}),Sm=U.Union([U.Literal(`in_progress`),U.Literal(`approved`),U.Literal(`denied`),U.Literal(`timed_out`),U.Literal(`aborted`)]),Cm=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}),wm=U.Object({action:Cm,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:Sm,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}),Tm=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})]),Em=U.Object({id:U.String({minLength:1}),target:Tm,type:U.Literal(`review`)},{additionalProperties:!1}),Dm=U.Union([Xf,Zf,$f,mm,hm,bm,xm,wm,Em,ym]),Om=U.Union([U.Literal(`running`),U.Literal(`completed`),U.Literal(`failed`),U.Literal(`interrupted`)]),km=U.Object({completedAt:af,error:U.Union([U.String(),U.Null()]),id:U.String({minLength:1}),items:U.Array(Dm),startedAt:af,status:Om},{additionalProperties:!1}),Am=U.Object({id:U.String({minLength:1}),kind:Wf,mediaType:Uf,name:U.String({maxLength:255,minLength:1}),size:U.Integer({maximum:If,minimum:1})},{additionalProperties:!1}),jm=U.Object({attachment:Am},{additionalProperties:!1}),Mm=U.Union([U.Literal(`user`),U.Literal(`repo`),U.Literal(`system`),U.Literal(`admin`)]),Nm=U.Object({description:U.String(),displayName:U.String({minLength:1}),id:U.String({minLength:1}),name:U.String({minLength:1}),scope:Mm},{additionalProperties:!1}),Pm=U.Union([U.Literal(`notStarted`),U.Literal(`starting`),U.Literal(`connected`),U.Literal(`authenticationRequired`),U.Literal(`failed`),U.Literal(`cancelled`),U.Literal(`disabled`),U.Literal(`unknown`)]),Fm=U.Union([U.Literal(`starting`),U.Literal(`ready`),U.Literal(`failed`),U.Literal(`cancelled`)]),Im=U.Literal(`reauthenticationRequired`),Lm=U.Object({displayName:U.String({minLength:1}),name:U.String({minLength:1}),status:Pm,toolCount:U.Integer({minimum:0})},{additionalProperties:!1}),Rm=U.Object({data:U.Array(Lm,{uniqueItems:!0})},{additionalProperties:!1}),zm=U.Object({id:U.String({minLength:1}),name:U.String({minLength:1})},{additionalProperties:!1}),Bm=U.Object({id:U.String({minLength:1})},{additionalProperties:!1}),Vm={attachments:U.Array(Bm),skills:U.Array(zm),text:U.String({maxLength:1e5}),type:U.Literal(`prompt`)},Hm=U.Union([U.Object({...Vm,text:U.String({maxLength:1e5,minLength:1})},{additionalProperties:!1}),U.Object({...Vm,attachments:U.Array(Bm,{minItems:1})},{additionalProperties:!1}),U.Object({...Vm,skills:U.Array(zm,{minItems:1})},{additionalProperties:!1})]),Um=U.Union([U.Literal(`editing`),U.Literal(`queued`)]),Wm=U.Object({attachments:U.Array(qf,{maxItems:Lf}),clientUserMessageId:U.String({minLength:1}),id:U.String({minLength:1}),skills:U.Array(zm),status:Um,text:U.String({maxLength:1e5})},{additionalProperties:!1}),Gm=U.Object({data:U.Array(Wm),nextCursor:U.Union([U.String({minLength:1}),U.Null()])},{additionalProperties:!1}),Km=U.Union([U.Literal(`active`),U.Literal(`paused`),U.Literal(`blocked`),U.Literal(`usage_limited`),U.Literal(`budget_limited`),U.Literal(`complete`)]),qm=U.Object({createdAt:rf,objective:U.String({maxLength:4e3,minLength:1}),status:Km,timeUsedSeconds:U.Integer({minimum:0}),tokenBudget:U.Union([U.Integer({minimum:0}),U.Null()]),tokensUsed:U.Integer({minimum:0}),updatedAt:rf},{additionalProperties:!1});U.Object({status:U.Union([U.Literal(`active`),U.Literal(`paused`)])},{additionalProperties:!1});var Jm=U.Object({goal:qm},{additionalProperties:!1}),Ym=U.Object({cleared:U.Boolean()},{additionalProperties:!1}),Xm=`gpt-5.6-luna`,Zm=U.Object({mcp_elicitations:U.Boolean(),request_permissions:U.Boolean(),rules:U.Boolean(),sandbox_approval:U.Boolean(),skill_approval:U.Boolean()},{additionalProperties:!1}),Qm=U.Object({granular:Zm},{additionalProperties:!1}),$m=U.Union([U.Literal(`on-request`),Qm,U.Literal(`never`)]),eh=U.Union([U.Literal(`untrusted`),U.Literal(`on-request`),Qm,U.Literal(`never`)]),th=U.Union([U.Literal(`user`),U.Literal(`auto_review`)]),nh=U.Union([U.Literal(`read-only`),U.Literal(`workspace-write`),U.Literal(`danger-full-access`)]),rh={model:U.String({minLength:1}),reasoningEffort:U.String({minLength:1}),sandboxMode:nh},ih=U.Object({approvalPolicy:eh,approvalsReviewer:th,...rh},{additionalProperties:!1}),ah=U.Literal(`plan`),oh={commitMessageModel:U.String({minLength:1}),commitMessagePrompt:U.String({maxLength:4e3}),defaultOpenAppId:U.Union([U.Exclude(bf,U.Literal(`system-default`)),U.Null()]),fastMode:U.Boolean(),followUpBehavior:U.Union([U.Literal(`queue`),U.Literal(`steer`)]),pet:Fd,...rh},sh=U.Object({approvalPolicy:$m,approvalsReviewer:th,...oh},{additionalProperties:!1}),ch=U.Object({settings:sh},{additionalProperties:!1}),lh=U.Object({approvalPolicy:eh,approvalsReviewer:th,fastMode:U.Boolean(),...rh},{additionalProperties:!1}),uh=U.Object({settings:lh},{additionalProperties:!1}),dh=U.Object({settings:ih},{additionalProperties:!1}),fh={collaborationMode:U.Optional(ah),fastMode:U.Optional(U.Literal(!0)),goalMode:U.Optional(U.Literal(!0)),...rh},ph=U.Object({approvalPolicy:eh,approvalsReviewer:th,...fh},{additionalProperties:!1}),mh=U.Object({description:U.String(),id:U.String({minLength:1})},{additionalProperties:!1}),hh=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(mh,{minItems:1})},{additionalProperties:!1}),gh=U.Object({contextWindow:U.Union([U.Integer({minimum:1}),U.Null()]),usedTokens:U.Integer({minimum:0})},{additionalProperties:!1}),_h=`temporary`,vh=`/v1/temporary`,yh=U.Union([U.Literal(`pending`),U.Literal(`in_progress`),U.Literal(`completed`)]),bh=U.Object({status:yh,text:U.String({minLength:1})},{additionalProperties:!1}),xh=U.Object({explanation:U.Union([U.String(),U.Null()]),steps:U.Array(bh)},{additionalProperties:!1}),Sh=U.Object({contextUsage:U.Union([gh,U.Null()]),goal:U.Union([qm,U.Null()]),id:U.String({minLength:1}),plan:U.Union([xh,U.Null()]),pendingRequests:U.Array(Pp),pinned:U.Boolean(),projectId:U.String({minLength:1}),settings:ih,status:U.Union([U.Literal(`idle`),U.Literal(`running`),U.Literal(`failed`)]),title:U.String({minLength:1}),turns:U.Array(km),turnsNextCursor:U.Union([U.String({minLength:1}),U.Null()]),updatedAt:rf},{additionalProperties:!1});function Ch(e){return U.Object({data:U.Array(e),nextCursor:U.Union([U.String(),U.Null()])},{additionalProperties:!1})}var wh=Ch(df),Th=wh,Eh=Ch(Of),Dh=Ch(hh),Oh=Ch(Nm),kh=U.Object({status:U.Literal(`ok`),version:U.Literal(1)},{additionalProperties:!1}),Ah=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}),jh=U.Union([U.Literal(`official`),U.Literal(`custom`)]),Mh=U.Union([U.Literal(`disconnected`),U.Literal(`pending`),U.Literal(`connected`),U.Literal(`failed`)]),Nh=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})]),Ph=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}),Fh=U.Object({account:U.Union([Nh,U.Null()]),customBaseUrl:U.Union([U.String({maxLength:2048,minLength:1}),U.Null()]),mode:jh,pendingLogin:U.Union([Ph,U.Null()]),state:Mh},{additionalProperties:!1});U.Object({},{additionalProperties:!1});var Ih=U.Object({authUrl:U.String({maxLength:8192,minLength:1}),loginId:U.String({maxLength:256,minLength:1}),status:Fh},{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 Lh=U.Object({models:Dh,status:Fh},{additionalProperties:!1});U.Object({loginId:U.String({maxLength:256,minLength:1})},{additionalProperties:!1});var Rh=U.Object({status:Fh},{additionalProperties:!1});U.Object({customBaseUrl:U.Union([U.String({maxLength:2048,minLength:1}),U.Null()]),customModels:U.Union([Dh,U.Null()]),mode:jh,updatedAt:rf},{additionalProperties:!1});function zh(e){return e.mode===`official`&&e.state===`connected`&&e.account?.type===`chatgpt`}var Bh=U.Object({sequence:U.Integer({minimum:0}),sessionId:U.String({minLength:1})},{additionalProperties:!1});U.Object({},{additionalProperties:!1});var Vh=U.Object({task:Of},{additionalProperties:!1});U.Object({pinned:U.Boolean()},{additionalProperties:!1});var Hh=U.Object({task:Of},{additionalProperties:!1});U.Object({title:U.String({maxLength:200,minLength:1,pattern:`\\S`})},{additionalProperties:!1});var Uh=U.Object({task:Of},{additionalProperties:!1});U.Object({},{additionalProperties:!1});var Wh=U.Object({status:U.Literal(`archived`),taskId:U.String({minLength:1})},{additionalProperties:!1});U.Object({},{additionalProperties:!1});var Gh=U.Object({task:Of},{additionalProperties:!1});U.Object({},{additionalProperties:!1});var Kh=U.Object({status:U.Literal(`deleted`),taskId:U.String({minLength:1})},{additionalProperties:!1}),qh=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:jf},{additionalProperties:!1});var Jh=U.Object({taskId:U.String({minLength:1}),turn:km},{additionalProperties:!1});U.Object({},{additionalProperties:!1});var Yh=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 Xh=U.Object({task:Of},{additionalProperties:!1});U.Object({},{additionalProperties:!1});var Zh=Rm;U.Object({classification:U.String({maxLength:100,minLength:1}),includeLogs:U.Boolean(),reason:U.String({maxLength:4e3,minLength:1})},{additionalProperties:!1});var Qh=U.Object({status:U.Literal(`sent`),taskId:U.String({minLength:1})},{additionalProperties:!1});U.Object({input:Hm,options:ph},{additionalProperties:!1});var $h=U.Object({checkpoint:Bh,taskId:U.String({minLength:1}),turn:km},{additionalProperties:!1});U.Object({input:Hm,taskId:U.String({minLength:1})},{additionalProperties:!1});var eg=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:Hm},{additionalProperties:!1});var tg=U.Object({queuedSubmission:Wm},{additionalProperties:!1});U.Object({input:Hm,status:U.Union([U.Literal(`editing`),U.Literal(`queued`)])},{additionalProperties:!1});var ng=tg,rg=U.Object({deleted:U.Boolean()},{additionalProperties:!1});U.Object({queuedSubmissionIds:U.Array(U.String({minLength:1}),{uniqueItems:!0})},{additionalProperties:!1});var ig=U.Object({status:U.Literal(`reordered`)},{additionalProperties:!1});U.Object({queuedSubmissionId:U.Optional(U.String({minLength:1}))},{additionalProperties:!1});var ag=U.Object({taskId:U.String({minLength:1}),turn:km},{additionalProperties:!1});U.Object({taskId:U.String({minLength:1})},{additionalProperties:!1});var og=U.Object({status:U.Literal(`interrupting`),taskId:U.String({minLength:1}),turnId:U.String({minLength:1})},{additionalProperties:!1}),sg=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`)]),cg=U.Object({code:sg,message:U.String({minLength:1}),retryable:U.Boolean()},{additionalProperties:!1}),lg=U.String({minLength:1}),ug=U.Integer({minimum:0}),dg=U.String({format:`date-time`}),fg={originalByteLength:U.Integer({minimum:0}),truncated:U.Boolean()},pg={provider:U.String({minLength:1}),sequence:ug,sessionId:lg,taskId:U.String({minLength:1}),timestamp:dg,version:U.Literal(2)};function G(e){return U.Object({...pg,...e},{additionalProperties:!1})}var mg=G({payload:U.Object({turn:km},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`turn.started`)}),hg=G({itemId:U.String({minLength:1}),payload:U.Object({delta:U.String()},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`message.delta`)}),gg=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`)}),_g=G({itemId:U.String({minLength:1}),payload:U.Object({delta:U.String()},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`plan.delta`)}),vg=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`)}),yg=G({itemId:U.String({minLength:1}),payload:U.Object({changes:U.Array(Vp,{maxItems:100}),...fg},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`file_change.updated`)}),bg=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`)}),xg=G({payload:U.Object({error:U.Union([U.String({maxLength:8192}),U.Null()]),failureReason:U.Union([Im,U.Null()]),name:U.String({minLength:1}),status:Fm},{additionalProperties:!1}),type:U.Literal(`mcp_server.status_updated`)}),Sg=G({payload:U.Object({status:U.Union([U.Literal(`idle`),U.Literal(`running`),U.Literal(`failed`)])},{additionalProperties:!1}),type:U.Literal(`task.status_updated`)}),Cg=G({payload:U.Object({},{additionalProperties:!1}),type:U.Literal(`task.metadata_changed`)}),wg=G({payload:U.Object({reason:U.Union([U.Literal(`archived`),U.Literal(`deleted`)])},{additionalProperties:!1}),type:U.Literal(`task.removed`)}),Tg=G({payload:U.Object({},{additionalProperties:!1}),type:U.Literal(`skills.changed`)}),Eg=G({payload:U.Object({},{additionalProperties:!1}),type:U.Literal(`queue.changed`)}),Dg=G({payload:U.Object({rootPath:U.String({minLength:1})},{additionalProperties:!1}),type:U.Literal(`project.git_metadata_changed`)}),Og=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`)}),kg=G({itemId:U.String({minLength:1}),payload:U.Object({item:Dm},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`item.completed`)}),Ag=G({itemId:U.String({minLength:1}),payload:U.Object({item:Dm},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`item.started`)}),jg=G({payload:U.Object({turn:km},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`turn.completed`)}),Mg=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(`rate_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`)}),Ng=G({payload:U.Object({usage:gh},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`usage.updated`)}),Pg=G({payload:U.Object({plan:xh},{additionalProperties:!1}),turnId:U.String({minLength:1}),type:U.Literal(`plan.updated`)}),Fg=G({payload:U.Object({goal:qm},{additionalProperties:!1}),type:U.Literal(`goal.updated`)}),Ig=G({payload:U.Object({},{additionalProperties:!1}),type:U.Literal(`goal.cleared`)});function Lg(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 Rg=Lg(`pending_request.created`,Pp),zg=Lg(`pending_request.resolved`,Fp),Bg=Lg(`pending_request.expired`,Ip),Vg=U.Union([mg,hg,gg,Og,_g,vg,yg,Ag,kg,jg,Ng,Pg,Fg,Ig,Mg,bg,xg,Sg,Cg,wg,Tg,Eg,Dg,Rg,zg,Bg]),Hg=U.Object({events:U.Array(Vg,{maxItems:64,minItems:1}),type:U.Literal(`events.batch`),version:U.Literal(3)},{additionalProperties:!1}),Ug=U.Object({latestSequence:ug,sessionId:lg,type:U.Literal(`connection.ready`),version:U.Literal(3)},{additionalProperties:!1}),Wg=U.Object({latestSequence:ug,reason:U.Union([U.Literal(`event_retention_exceeded`),U.Literal(`session_changed`),U.Literal(`sequence_gap`)]),sessionId:lg,type:U.Literal(`resync.required`),version:U.Literal(3)},{additionalProperties:!1}),Gg=U.Union([Ug,Wg,Hg]),Kg=U.Object({checkpoint:Bh,snapshot:Sh},{additionalProperties:!1}),qg=class extends _n{constructor(e){super(`Unable to dereference schema with $id '${e.$ref}'`),this.schema=e}};function Jg(e,t){let n=t.find(t=>t.$id===e.$ref);if(n===void 0)throw new qg(e);return Xg(n,t)}function Yg(e,t){return!sn(e.$id)||t.some(t=>t.$id===e.$id)||t.push(e),t}function Xg(e,t){return e[S]===`This`||e[S]===`Ref`?Jg(e,t):e}var Zg=class extends _n{constructor(e){super(`Unable to hash value`),this.value=e}},Qg;(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`})(Qg||={});var $g=BigInt(`14695981039346656037`),[e_,t_]=[BigInt(`1099511628211`),BigInt(`18446744073709551616`)],n_=Array.from({length:256}).map((e,t)=>BigInt(t)),r_=new Float64Array(1),i_=new DataView(r_.buffer),a_=new Uint8Array(r_.buffer);function*o_(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 s_(e){K(Qg.Array);for(let t of e)v_(t)}function c_(e){K(Qg.Boolean),K(+!!e)}function l_(e){K(Qg.BigInt),i_.setBigInt64(0,e);for(let e of a_)K(e)}function u_(e){K(Qg.Date),v_(e.getTime())}function d_(e){K(Qg.Null)}function f_(e){K(Qg.Number),i_.setFloat64(0,e);for(let e of a_)K(e)}function p_(e){K(Qg.Object);for(let t of globalThis.Object.getOwnPropertyNames(e).sort())v_(t),v_(e[t])}function m_(e){K(Qg.String);for(let t=0;t<e.length;t++)for(let n of o_(e.charCodeAt(t)))K(n)}function h_(e){K(Qg.Symbol),v_(e.description)}function g_(e){K(Qg.Uint8Array);for(let t=0;t<e.length;t++)K(e[t])}function __(e){return K(Qg.Undefined)}function v_(e){if($t(e))return s_(e);if(nn(e))return c_(e);if(on(e))return l_(e);if(Xt(e))return u_(e);if(tn(e))return d_(e);if(rn(e))return f_(e);if(Qt(e))return p_(e);if(sn(e))return m_(e);if(ln(e))return h_(e);if(Zt(e))return g_(e);if(en(e))return __(e);throw new Zg(e)}function K(e){$g^=n_[e],$g=$g*e_%t_}function y_(e){return $g=BigInt(`14695981039346656037`),v_(e),$g}var b_=class extends _n{constructor(e){super(`Unknown type`),this.schema=e}};function x_(e){return e[S]===`Any`||e[S]===`Unknown`}function q(e){return e!==void 0}function S_(e,t,n){return!0}function C_(e,t,n){return!0}function w_(e,t,n){if(!$t(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=y_(t);if(e.has(n))return!1;e.add(n)}return!0})())return!1;if(!(q(e.contains)||rn(e.minContains)||rn(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||rn(e.minContains)&&i<e.minContains||rn(e.maxContains)&&i>e.maxContains)}function T_(e,t,n){return qt(n)}function E_(e,t,n){return!(!on(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 D_(e,t,n){return nn(n)}function O_(e,t,n){return J(e.returns,t,n.prototype)}function k_(e,t,n){return!(!Xt(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 A_(e,t,n){return cn(n)}function j_(e,t,n){let r=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];return J(i,[...t,...r],n)}function M_(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!==0)}function N_(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 P_(e,t,n){return Jt(n)}function F_(e,t,n){return n===e.const}function I_(e,t,n){return!1}function L_(e,t,n){return!J(e.not,t,n)}function R_(e,t,n){return tn(n)}function z_(e,t,n){return!(!un.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 B_(e,t,n){if(!un.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)||x_(r))&&!(i in n))return!1}else if(un.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 V_(e,t,n){return Yt(n)}function H_(e,t,n){if(!un.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 U_(e,t,n){return J(Xg(e,t),t,n)}function W_(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 G_(e,t,n){return!sn(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 K_(e,t,n){return ln(n)}function q_(e,t,n){return sn(n)&&new RegExp(e.pattern).test(n)}function J_(e,t,n){return J(Xg(e,t),t,n)}function Y_(e,t,n){if(!$t(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 X_(e,t,n){return en(n)}function Z_(e,t,n){return e.anyOf.some(e=>J(e,t,n))}function Q_(e,t,n){return!(!Zt(n)||q(e.maxByteLength)&&!(n.length<=e.maxByteLength)||q(e.minByteLength)&&!(n.length>=e.minByteLength))}function $_(e,t,n){return!0}function ev(e,t,n){return un.IsVoidLike(n)}function tv(e,t,n){return _i(e[S])?vi(e[S])(e,n):!1}function J(e,t,n){let r=q(e.$id)?Yg(e,t):t,i=e;switch(i[S]){case`Any`:return S_(i,r,n);case`Argument`:return C_(i,r,n);case`Array`:return w_(i,r,n);case`AsyncIterator`:return T_(i,r,n);case`BigInt`:return E_(i,r,n);case`Boolean`:return D_(i,r,n);case`Constructor`:return O_(i,r,n);case`Date`:return k_(i,r,n);case`Function`:return A_(i,r,n);case`Import`:return j_(i,r,n);case`Integer`:return M_(i,r,n);case`Intersect`:return N_(i,r,n);case`Iterator`:return P_(i,r,n);case`Literal`:return F_(i,r,n);case`Never`:return I_(i,r,n);case`Not`:return L_(i,r,n);case`Null`:return R_(i,r,n);case`Number`:return z_(i,r,n);case`Object`:return B_(i,r,n);case`Promise`:return V_(i,r,n);case`Record`:return H_(i,r,n);case`Ref`:return U_(i,r,n);case`RegExp`:return W_(i,r,n);case`String`:return G_(i,r,n);case`Symbol`:return K_(i,r,n);case`TemplateLiteral`:return q_(i,r,n);case`This`:return J_(i,r,n);case`Tuple`:return Y_(i,r,n);case`Undefined`:return X_(i,r,n);case`Union`:return Z_(i,r,n);case`Uint8Array`:return Q_(i,r,n);case`Unknown`:return $_(i,r,n);case`Void`:return ev(i,r,n);default:if(!_i(i[S]))throw new b_(i);return tv(i,r,n)}}function nv(...e){return e.length===3?J(e[0],e[1],e[2]):J(e[0],[],e[1])}var rv=class extends Error{constructor(e,t){super(e,t),this.name=`CodexlyEventError`}};function iv(e,t,n){let r=t===`temporary`?`${vh}/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 av(e,t,n){return{latestSequence:t,reason:n,sessionId:e,type:`resync.required`,version:3}}function ov(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 rv(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(iv(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(!nv(Gg,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(av(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(av(t.sessionId,t.sequence,`session_changed`));return}if(!(t.sequence<=i)){if(t.sequence!==i+1){d(av(t.sessionId,t.sequence,`sequence_gap`));return}if(i=t.sequence,e.onEvent(t),!ee())return}}},ne=()=>{!n||s!==m||e.onError?.(new rv(`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 sv(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 cv=new Uint8Array(16);function lv(){return crypto.getRandomValues(cv)}function uv(e,t,n){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():dv(e,t,n)}function dv(e,t,n){e||={};let r=e.random??e.rng?.()??lv();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 sv(r)}var fv=15e4,pv=class extends Error{status;constructor(e,t,n){super(n??`Codexly request failed with ${String(e)} ${t}`.trim()),this.name=`CodexlyHttpError`,this.status=e}},mv=class extends pv{code;retryable;constructor(e,t,n){super(e,t,n.message),this.name=`CodexlyMutationError`,this.code=n.code,this.retryable=n.retryable}},hv=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`?vh:`/v1/projects/${encodeURIComponent(e)}`}function Q(e,t){return`${Z(e)}/tasks/${encodeURIComponent(t)}`}function gv(e,t,n,r){return`${e.replace(/\/$/u,``)}${Q(t,n)}/attachments/${encodeURIComponent(r)}`}function _v(e,t,n,r){let i=X(`${Z(t)}/files/image`,{path:n,rootPath:r});return`${e.replace(/\/$/u,``)}${i}`}function vv(e,t,n){return`${e.replace(/\/$/u,``)}${Z(t)}/attachments/${encodeURIComponent(n)}`}function yv(e,t=``){return`${t.replace(/\/$/u,``)}/v1/pets/assets/${encodeURIComponent(e)}`}var bv=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`,kh,e)}async getAppInfo(e={}){return this.read(`/v1/app-info`,qd,e)}async getAppUpdateProgress(e={}){return this.read(`/v1/app-update/progress`,Kd,e)}async installAppUpdate(e,t={}){return this.mutation(`/v1/app-update`,{version:e},Jd,t,`POST`,fv)}async getAccessStatus(e={}){return this.read(`/v1/access`,Xd,e)}async pairAccess(e){return this.request(`/v1/access/pair`,Xd,{body:JSON.stringify({code:e}),headers:{"content-type":`application/json`},method:`POST`},cg,{timeoutMs:this.requestTimeouts.mutationMs})}async logoutAccess(){return this.request(`/v1/access/logout`,Xd,{body:`{}`,headers:{"content-type":`application/json`},method:`POST`},cg,{timeoutMs:this.requestTimeouts.mutationMs})}subscribeUnauthorized(e){return this.unauthorizedListeners.add(e),()=>this.unauthorizedListeners.delete(e)}async getCapabilities(e={}){return this.read(`/v1/capabilities`,Ah,e)}async listModels(e={}){return this.read(`/v1/models`,Dh,e)}async getProviderConnection(e={}){return this.read(`/v1/provider-connection`,Fh,e)}async startOfficialProviderLogin(e={}){return this.mutation(`/v1/provider-connection/official-login`,{},Ih,e)}async cancelProviderLogin(e,t={}){return this.mutation(`/v1/provider-connection/official-login/cancel`,{loginId:e},Rh,t)}async configureCustomProvider(e,t={}){return this.mutation(`/v1/provider-connection/custom`,e,Lh,t,`PUT`)}async logoutProvider(e={}){return this.mutation(`/v1/provider-connection/logout`,{},Rh,e)}async getGlobalSettings(e={}){return this.read(`/v1/settings`,ch,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,ch,t,`PUT`)}subscribeEvents(e){return ov({...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??uv()},method:i},cg,{...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 hv(`Codexly error response is not valid JSON`,{cause:e})}throw nv(r,e)?new mv(s.status,s.statusText,e):new hv(`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 pv(s.status,s.statusText,e.message)}catch(e){if(e instanceof pv)throw e}throw new pv(s.status,s.statusText)}let c;try{c=await s.json()}catch(e){throw new hv(`Codexly response is not valid JSON`,{cause:e})}if(!nv(t,c))throw new hv(`Codexly response does not match the protocol schema`);return c}},xv=class extends bv{async listSkills(e,t={}){return this.read(`${Z(e)}/skills`,Oh,t)}async listMcpServers(e,t,n={}){return this.read(`${Q(e,t)}/mcp-servers`,Rm,n,cg)}async retryMcpServers(e,t,n={}){return this.mutation(`${Q(e,t)}/mcp-servers/retry`,{},Zh,n)}async listProjects(e={}){return this.read(`/v1/projects`,wh,e)}async listProjectDirectories(e,t={}){return this.read(X(`/v1/project-directories`,{path:e,includeHidden:t.includeHidden===!0?`true`:void 0}),hf,t)}async listHostFiles(e,t,n={}){return this.read(X(`/v1/host-files`,{kind:e,path:t,includeHidden:n.includeHidden===!0?`true`:void 0}),vf,n)}async reorderProjects(e,t={}){return this.mutation(`/v1/projects/order`,{projectIds:e},Th,t,`PUT`)}async getProjectDefaults(e,t={}){return this.read(`${Z(e)}/defaults`,uh,t)}async updateProjectDefaults(e,t,n={}){return this.mutation(`${Z(e)}/defaults`,t,uh,n,`PUT`)}async addProject(e,t={}){return this.mutation(`/v1/projects`,{roots:e.map(e=>({path:e}))},yf,t)}async renameProject(e,t,n={}){return this.mutation(`${Z(e)}/rename`,{name:t},Ef,n)}async removeProject(e,t={}){return this.mutation(`${Z(e)}/remove`,{},Df,t)}async getProjectOpenCapabilities(e,t={}){return this.read(`${Z(e)}/open-capabilities`,wf,t)}async openProject(e,t,n,r={}){return this.mutation(X(`${Z(e)}/open`,{rootPath:t}),n,Tf,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}),Jp,n)}async getProjectGitHistory(e,t,n={}){return this.read(X(`${Z(e)}/git/history`,{cursor:t.cursor,repository:t.repository,rootPath:t.rootPath}),Zp,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}),tm,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}),nm,n)}async switchProjectBranch(e,t,n,r={}){return this.mutation(X(`${Z(e)}/git/branch`,{rootPath:t}),n,Jp,r)}async createProjectBranch(e,t,n,r={}){return this.mutation(X(`${Z(e)}/git/branches`,{rootPath:t}),n,Jp,r)}async listProjectWorktrees(e,t,n={}){return this.read(X(`${Z(e)}/git/worktrees`,{rootPath:t}),im,n)}async createProjectWorktree(e,t,n,r={}){return this.mutation(X(`${Z(e)}/git/worktrees`,{rootPath:t}),n,am,r)}async switchProjectWorktree(e,t,n,r={}){return this.mutation(X(`${Z(e)}/git/worktree`,{rootPath:t}),n,am,r)}async generateCommitMessage(e,t,n,r={}){return this.mutation(X(`${Z(e)}/git/commit-message`,{rootPath:t}),n,om,r)}async commitProjectChanges(e,t,n,r={}){return this.mutation(X(`${Z(e)}/git/commits`,{rootPath:t}),n,sm,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,lm,r)}async renameProjectFile(e,t,n,r={}){return this.mutation(X(`/v1/projects/${encodeURIComponent(e)}/files/rename`,{rootPath:t}),n,dm,r)}async deleteProjectFile(e,t,n,r={}){return this.mutation(X(`/v1/projects/${encodeURIComponent(e)}/files/delete`,{rootPath:t}),n,fm,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,cf,i)}async stopProjectFileSearch(e,t,n,r={}){return this.mutation(`/v1/projects/${encodeURIComponent(e)}/files/search/stop`,{rootPath:t,sessionId:n},lf,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,pm,i)}},Sv=class extends xv{async archiveTask(e,t,n={}){return this.mutation(`${Q(e,t)}/archive`,{},Wh,n)}async unarchiveTask(e,t,n={}){return this.mutation(`${Q(e,t)}/unarchive`,{},Gh,n)}async deleteTask(e,t,n={}){return this.mutation(Q(e,t),{},Kh,n,`DELETE`)}},Cv=class extends Sv{async updateTaskGoal(e,t,n,r={}){return this.mutation(`${Q(e,t)}/goal`,n,Jm,r,`PUT`)}async clearTaskGoal(e,t,n={}){return this.mutation(`${Q(e,t)}/goal`,{},Ym,n,`DELETE`)}},wv=class extends Cv{async listQueuedSubmissions(e,t,n={},r={}){return this.read(X(`${Q(e,t)}/queue`,n),Gm,r)}async addQueuedSubmission(e,t,n,r,i={}){return this.mutation(`${Q(e,t)}/queue`,{clientUserMessageId:r,input:n},tg,i)}async updateQueuedSubmission(e,t,n,r,i,a={}){return this.mutation(`${Q(e,t)}/queue/${encodeURIComponent(n)}`,{input:r,status:i},ng,a,`PUT`)}async deleteQueuedSubmission(e,t,n,r={}){return this.mutation(`${Q(e,t)}/queue/${encodeURIComponent(n)}`,{},rg,r,`DELETE`)}async reorderQueuedSubmissions(e,t,n,r={}){return this.mutation(`${Q(e,t)}/queue/reorder`,{queuedSubmissionIds:n},ig,r,`PUT`)}async startQueuedSubmission(e,t,n,r={}){return this.mutation(`${Q(e,t)}/queue/start`,{...n===void 0?{}:{queuedSubmissionId:n}},ag,r)}async listTasks(e,t={},n={}){let r=X(`${Z(e)}/tasks`,t);return this.read(r,Eh,n)}async readTask(e,t,n={}){let{cursor:r,...i}=n;return this.read(X(Q(e,t),{cursor:r}),Kg,i)}getTaskAttachmentUrl(e,t,n){return gv(this.baseUrl,e,t,n)}async openTaskAttachment(e,t,n,r={}){return this.mutation(`${Q(e,t)}/attachments/${encodeURIComponent(n)}/open`,{},Jf,r)}async listBackgroundTerminals(e,t,n={}){return this.read(`${Q(e,t)}/background-terminals`,tp,n)}async terminateBackgroundTerminal(e,t,n,r={}){return this.mutation(`${Q(e,t)}/background-terminals/${encodeURIComponent(n)}/terminate`,{},np,r)}async getTaskSettings(e,t,n={}){return this.read(`${Q(e,t)}/settings`,dh,n)}async updateTaskSettings(e,t,n,r={}){return this.mutation(`${Q(e,t)}/settings`,n,dh,r,`PUT`)}async startTask(e,t={}){return this.mutation(`${Z(e)}/tasks`,{},Vh,t)}async pinTask(e,t,n,r={}){return this.mutation(`${Q(e,t)}/pin`,{pinned:n},Hh,r,`PUT`)}async renameTask(e,t,n,r={}){return this.mutation(`${Q(e,t)}/rename`,{title:n},Uh,r)}async unsubscribeTask(e,t){return this.request(`${Q(e,t)}/unsubscribe`,qh,{body:`{}`,headers:{"content-type":`application/json`},method:`POST`})}async startReview(e,t,n,r={}){return this.mutation(`${Q(e,t)}/review`,n,Jh,r)}async compactTask(e,t,n={}){return this.mutation(`${Q(e,t)}/compact`,{},Yh,n)}async forkTask(e,t,n,r={}){return this.mutation(`${Q(e,t)}/fork`,n,Xh,r)}async uploadFeedback(e,t,n,r={}){return this.mutation(`${Q(e,t)}/feedback`,n,Qh,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}`,jm,{body:r,headers:{"idempotency-key":n.idempotencyKey??uv()},method:`POST`},cg,{...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},jm,r)}async startTurn(e,t,n,r,i={}){return this.mutation(`${Q(e,t)}/turns`,{input:n,options:r},$h,i)}async steerTurn(e,t,n,r,i={}){return this.mutation(`${Q(e,t)}/turns/${encodeURIComponent(n)}/steer`,{input:r,taskId:t},eg,i)}async interruptTurn(e,t,n,r={}){return this.mutation(`${Q(e,t)}/turns/${encodeURIComponent(n)}/interrupt`,{taskId:t},og,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,Bp,n)}},Tv=class extends wv{},Ev=`pinned`,Dv=`search-source`,Ov=3e4;function kv(e,t){return[`projects`,e,`tasks`,t,`queue`]}var Av=new Tv,jv=Object.defineProperty,Mv=(e,t)=>jv(e,`name`,{value:t,configurable:!0}),Nv=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`}),Pv=g.forwardRef(Mv(function(e,t){return(0,_.jsx)(d.span,{...e,ref:t,style:{...Nv,...e.style}})},`VisuallyHidden`)),Fv=Object.defineProperty,$=(e,t)=>Fv(e,`name`,{value:t,configurable:!0}),[Iv,Lv]=c(`Tooltip`,[ee]),Rv=ee(),zv=`TooltipProvider`,Bv=700,Vv=`tooltip.open`,[Hv,Uv]=Iv(zv),Wv=$(e=>{let{__scopeTooltip:t,delayDuration:n=Bv,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)(Hv,{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`),Gv=`Tooltip`,[Kv,qv]=Iv(Gv),Jv=$(e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Uv(Gv,e.__scopeTooltip),l=Rv(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(Vv))):c.onClose(),a?.(e)},`onChange`),caller:Gv}),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)(Kv,{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`),Yv=`TooltipTrigger`,Xv=g.forwardRef($(function(e,t){let{__scopeTooltip:n,...r}=e,o=qv(Yv,n),s=Uv(Yv,n),c=Rv(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`)),Zv=`TooltipPortal`,[Qv,$v]=Iv(Zv,{forceMount:void 0}),ey=$(e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=qv(Zv,t);return(0,_.jsx)(Qv,{scope:t,forceMount:n,children:(0,_.jsx)(f,{present:n||a.open,children:(0,_.jsx)(m,{asChild:!0,container:i,children:r})})})},`TooltipPortal`),ty=`TooltipContent`,ny=g.forwardRef($(function(e,t){let n=$v(ty,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=qv(ty,e.__scopeTooltip);return(0,_.jsx)(f,{present:r||o.open,children:o.disableHoverableContent?(0,_.jsx)(ay,{side:i,...a,ref:t}):(0,_.jsx)(ry,{side:i,...a,ref:t})})},`TooltipContent`)),ry=g.forwardRef($(function(e,t){let n=qv(ty,e.__scopeTooltip),r=Uv(ty,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=sy(r,oy(r,n.getBoundingClientRect())),a=cy(t.getBoundingClientRect()),o=uy([...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=!ly(n,s);r?p():i&&(p(),u())},`handleTrackPointerGrace`);return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[l,d,s,u,p]),(0,_.jsx)(ay,{...e,ref:o})},`TooltipContentHoverable`)),iy=h(`TooltipContent`),ay=g.forwardRef($(function(e,t){let{__scopeTooltip:n,children:r,"aria-label":i,id:a,onEscapeKeyDown:c,onPointerDownOutside:l,...u}=e,d=qv(ty,n),f=Rv(n),{onClose:p}=d;g.useEffect(()=>(document.addEventListener(Vv,p),()=>document.removeEventListener(Vv,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)(iy,{children:r}),i?(0,_.jsx)(Pv,{id:d.contentId,role:`tooltip`,children:i}):null]})})},`TooltipContentImpl`));function oy(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`)}}$(oy,`getExitSideFromRect`);function sy(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}$(sy,`getPaddedExitPoints`);function cy(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}]}$(cy,`getPointsFromRect`);function ly(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}$(ly,`isPointInPolygon`);function uy(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)),dy(t)}$(uy,`getHull`);function dy(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)}$(dy,`getHullPresorted`);var fy=Wv,py=Jv,my=Xv,hy=ey,gy=ny;function _y({delayDuration:e=350,disableHoverableContent:t=!0,skipDelayDuration:n=150,...r}){return(0,_.jsx)(fy,{"data-slot":`tooltip-provider`,delayDuration:e,disableHoverableContent:t,skipDelayDuration:n,...r})}function vy(e){return(0,_.jsx)(py,{"data-slot":`tooltip`,...e})}function yy(e){return(0,_.jsx)(my,{"data-slot":`tooltip-trigger`,...e})}function by({children:e,className:t,collisionPadding:n=8,sideOffset:r=8,...i}){return(0,_.jsx)(hy,{children:(0,_.jsx)(gy,{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,Pf 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,Nf as S,Kf as T,Ke as U,Xe as V,Ge as W,ke as X,ve as Y,_e as Z,_h as _,Nv as a,Me as at,zf as b,Ov as c,vv as d,be as et,_v as f,zh as g,uv as h,yy as i,Pe as it,St as j,bt as k,Av as l,yv as m,by as n,me as nt,Ev as o,ae as ot,gv as p,de as q,_y as r,Ce as rt,Dv as s,ie as st,vy as t,Se as tt,kv as u,Xm as v,Ff as w,Mf as x,Hf as y,nt as z};
@@ -1 +1 @@
1
- import{w as e}from"./dist-B3LT8os9.js";var t=e(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]);export{t};
1
+ import{w as e}from"./dist-DBbCRukl.js";var t=e(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]);export{t};
@@ -1 +1 @@
1
- import{H as e,O as t,V as n,z as r}from"./tooltip-4ec-13io.js";var i=class extends r{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(t,r){let{state:i}=t,a=super.createResult(t,r),{isFetching:o,isRefetching:s,isError:c,isRefetchError:l}=a,u=i.fetchMeta?.fetchMore?.direction,d=c&&u===`forward`,f=o&&u===`forward`,p=c&&u===`backward`,m=o&&u===`backward`;return{...a,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:n(r,i.data),hasPreviousPage:e(r,i.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:s&&!f&&!m}}};function a(e,n){return t(e,i,n)}export{a as t};
1
+ import{H as e,O as t,V as n,z as r}from"./tooltip-BPVbHVEF.js";var i=class extends r{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(t,r){let{state:i}=t,a=super.createResult(t,r),{isFetching:o,isRefetching:s,isError:c,isRefetchError:l}=a,u=i.fetchMeta?.fetchMore?.direction,d=c&&u===`forward`,f=o&&u===`forward`,p=c&&u===`backward`,m=o&&u===`backward`;return{...a,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:n(r,i.data),hasPreviousPage:e(r,i.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:s&&!f&&!m}}};function a(e,n){return t(e,i,n)}export{a as t};
@@ -1,2 +1,2 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CVaUQXZF.js";import{C as r,D as i,I as a,v as o,w as s,y as c}from"./dist-B3LT8os9.js";import{R as l,i as u,n as d,t as f}from"./tooltip-4ec-13io.js";import{a as p,c as m,l as h,o as g,t as _}from"./checkbox-BW4uILvi.js";import{n as v,r as y,t as b}from"./loader-circle-DYfMWclN.js";import{t as x}from"./check-DqH8BaGS.js";import{a as S,i as C,o as w,r as T,t as E}from"./file-tree-Br65eBgL.js";import{n as D,t as O}from"./button-group-CiKTUtu2.js";import{S as k,r as ee,y as te}from"./prompt-input-controls-DWd_vgsW.js";import{n as ne,r as A,t as j}from"./file-navigation-view-preference-CufNNsrc.js";import{t as M}from"./upload-CsaycpyW.js";import{At as N,B as re,C as ie,F as ae,I as oe,L as se,M as ce,R as le,Rt as P,S as ue,kt as F,w as I,x as de,z as L}from"./index-CdL6pn7l.js";var R=s(`file-minus-corner`,[[`path`,{d:`M20 14V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12`,key:`l9p8hp`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),z=e(t(),1),B=n(),V=r(`min-w-0 text-foreground outline-none transition-[border-color,box-shadow] placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50`,{defaultVariants:{variant:`default`},variants:{variant:{default:`min-h-20 w-full resize-y rounded-control bg-control px-3 py-2 text-body focus-visible:shadow-focus`,embedded:`flex-1 resize-none bg-transparent`}}});function H({className:e,variant:t=`default`,...n}){return(0,B.jsx)(`textarea`,{className:c(V({className:e,variant:t})),"data-slot":`textarea`,"data-variant":t,...n})}function fe({className:e,...t}){return(0,B.jsx)(`div`,{className:c(`group/input-group flex w-full min-w-0 items-center`,e),"data-slot":`input-group`,role:`group`,...t})}function pe({align:e=`inline-start`,className:t,...n}){return(0,B.jsx)(`div`,{className:c(`flex shrink-0 items-center`,t),"data-align":e,"data-slot":`input-group-addon`,role:`group`,...n})}function me({className:e,...t}){return(0,B.jsx)(H,{className:c(`min-w-0 flex-1`,e),"data-slot":`input-group-control`,variant:`embedded`,...t})}function U(e){return[...e].sort((e,t)=>e.kind===t.kind?e.name.localeCompare(t.name,`en`):e.kind===`file`?-1:1)}function W(e){let t=[e.name],n=e;for(;n.children.size===1;){let e=n.children.values().next().value;if(e?.kind!==`folder`)break;t.push(e.name),n=e}return{children:U([...n.children.values()].map(e=>e.kind===`folder`?W(e):e)),kind:`folder`,name:t.join(`/`),path:n.path}}function G(e){let t={children:new Map,kind:`folder`,name:``,path:``};for(let n of e){let e=n.path.split(`/`),r=e.pop();if(r===void 0)continue;let i=t;for(let t of e){let e=i.path===``?t:`${i.path}/${t}`,n=i.children.get(t);if(n?.kind===`folder`){i=n;continue}let r={children:new Map,kind:`folder`,name:t,path:e};i.children.set(t,r),i=r}i.children.set(r,{kind:`file`,name:r,path:n.path,status:n.kind})}return U([...t.children.values()].map(e=>e.kind===`folder`?W(e):e))}function K(e,t){for(let n of e)n.kind===`folder`&&(t.add(n.path),K(n.children,t))}function q(e){return e===`create`?`text-diff-added`:e===`delete`?`text-danger`:`text-warning`}function J(e){let t=c(`size-3.5`,q(e));return e===`create`?(0,B.jsx)(k,{"aria-hidden":`true`,className:t}):e===`delete`?(0,B.jsx)(R,{"aria-hidden":`true`,className:t}):(0,B.jsx)(D,{"aria-hidden":`true`,className:t})}function Y(e){return e===`create`?`A`:e===`delete`?`D`:`M`}function X({changesByPath:e,disabled:t,label:n,nodes:r,onOpenFileDiff:i,onTogglePath:a,selectedPaths:o}){return r.map(r=>{if(r.kind===`folder`)return(0,B.jsx)(C,{name:r.name,path:r.path,children:(0,B.jsx)(X,{changesByPath:e,disabled:t,label:n,nodes:r.children,onOpenFileDiff:i,onTogglePath:a,selectedPaths:o})},r.path);let s=o.has(r.path),c=e.get(r.path);return(0,B.jsxs)(T,{"aria-label":r.path,className:q(r.status),icon:J(r.status),name:r.name,onClick:()=>{c!==void 0&&i(c)},path:r.path,trailing:(0,B.jsx)(`span`,{className:`ml-auto w-3 text-center text-meta font-semibold text-muted-foreground`,children:Y(r.status)}),children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,className:`size-5 shrink-0`}),(0,B.jsx)(_,{"aria-label":`${n}: ${r.path}`,checked:s,disabled:t,onCheckedChange:()=>{a(r.path)},onClick:e=>{e.stopPropagation()}}),(0,B.jsx)(S,{children:J(r.status)}),(0,B.jsx)(w,{title:r.path,children:r.name})]},r.path)})}function Z({changes:e,disabled:t=!1,label:n,onOpenFileDiff:r,onSelectedPathsChange:i,selectedPaths:a,viewMode:o=`tree`}){let s=(0,z.useMemo)(()=>G(e),[e]),l=(0,z.useMemo)(()=>new Map(e.map(e=>[e.path,e])),[e]),u=(0,z.useMemo)(()=>[...new Set(e.map(e=>e.path))],[e]),d=(0,z.useMemo)(()=>{let e=new Set;return K(s,e),e},[s]);if(u.length===0)return null;let f=u.filter(e=>a.has(e)).length,p=f===0?!1:f===u.length||`indeterminate`,m=e=>{let t=new Set(a);t.has(e)?t.delete(e):t.add(e),i(t)};return(0,B.jsxs)(`section`,{"aria-label":n,className:`py-0.5`,children:[(0,B.jsxs)(`div`,{className:`flex min-h-7 items-center gap-1.5 px-3`,children:[(0,B.jsx)(_,{"aria-label":n,checked:p,disabled:t||u.length===0,onCheckedChange:e=>{let t=new Set(a);for(let n of u)e===!0?t.add(n):t.delete(n);i(t)}}),(0,B.jsx)(`h3`,{className:`text-label font-semibold text-foreground`,children:n}),(0,B.jsx)(`span`,{className:`ml-auto text-caption text-muted-foreground`,children:u.length})]}),o===`list`?(0,B.jsx)(`div`,{className:`px-1 font-mono text-label`,"data-slot":`commit-changes-list`,role:`list`,children:e.toSorted((e,t)=>e.path.localeCompare(t.path,`en`)).map(e=>(0,B.jsxs)(`div`,{className:`flex min-h-7 items-center gap-1.5 rounded-control px-2 hover:bg-control-hover`,role:`listitem`,children:[(0,B.jsx)(_,{"aria-label":`${n}: ${e.path}`,checked:a.has(e.path),disabled:t,onCheckedChange:()=>{m(e.path)}}),(0,B.jsxs)(`button`,{"aria-label":e.path,className:c(`flex min-w-0 flex-1 items-center gap-1.5 text-left outline-none focus-visible:shadow-focus`,q(e.kind)),onClick:()=>{r(e)},type:`button`,children:[J(e.kind),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.path,children:e.path}),(0,B.jsx)(`span`,{className:`w-3 text-center text-meta font-semibold text-muted-foreground`,children:Y(e.kind)})]})]},e.path))}):s.length===0?null:(0,B.jsx)(E,{"aria-label":n,className:`px-1`,defaultExpanded:d,children:(0,B.jsx)(X,{changesByPath:l,disabled:t,label:n,nodes:s,onOpenFileDiff:r,onTogglePath:m,selectedPaths:a})})]})}function he(e){let t=new Map;for(let n of e.staged)t.set(n.path,{path:n.path,staged:!0,unstaged:!1});for(let n of e.unstaged){let e=t.get(n.path);t.set(n.path,{path:n.path,staged:e?.staged??!1,unstaged:!0})}return[...t.values()].sort((e,t)=>e.path.localeCompare(t.path,`en`))}function ge(e){if(e.repositoryMode!==`children`)return[];let t=new Set;for(let n of[...e.staged,...e.unstaged]){let e=n.path.indexOf(`/`);e>0&&t.add(n.path.slice(0,e))}return[...t].toSorted((e,t)=>e.localeCompare(t,`en`))}function Q(e,t){return{identity:e,message:``,selectedPaths:new Set(t.map(e=>e.path))}}function $({error:e=null,gitStatus:t,isCommitting:n=!1,isGenerating:r=!1,isRepositoryLoading:a=!1,onCommit:s,onGenerateMessage:l,onOpenFileDiff:p,onSelectRepository:h=()=>void 0,repositories:g=[],result:_=null,selectedRepository:y=null}){let{t:S}=i(`workbench`),[C,w]=j(`changes`),T=(0,z.useMemo)(()=>he(t),[t]),E=`${y??`root`}:${t.snapshot}`,[D,k]=(0,z.useState)(()=>Q(E,T)),N=(0,z.useRef)(m());D.identity!==E&&k(Q(E,T));let{message:P,selectedPaths:F}=D,R=P.includes(`
2
- `)?3:1,V=r||n,H=g.length>0||t.repositoryMode===`children`,U=!H||y!==null&&!a&&t.repositoryMode===`root`,W=U&&F.size>0&&!V&&_===null,G=W&&P.trim().length>0,K=()=>N.current.run(async()=>{let e=await l({expectedSnapshot:t.snapshot,paths:[...F],...y===null?{}:{repository:y}});k(t=>({...t,message:e}))}),q=e=>N.current.run(()=>s({action:e,expectedSnapshot:t.snapshot,message:P,paths:[...F],...y===null?{}:{repository:y}}));return(0,B.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,"data-slot":`commit-changes-panel`,children:[H?(0,B.jsxs)(`div`,{className:`shrink-0 border-b border-separator px-3 py-2`,children:[(0,B.jsx)(`label`,{className:`text-label font-medium`,id:`commit-repository-label`,children:S(`commit.repository`)}),(0,B.jsxs)(ae,{disabled:V||_!==null,onValueChange:h,...y===null?{}:{value:y},children:[(0,B.jsx)(L,{"aria-labelledby":`commit-repository-label`,className:`mt-1 w-full`,children:(0,B.jsx)(re,{placeholder:S(`commit.selectRepository`)})}),(0,B.jsx)(oe,{position:`popper`,children:(0,B.jsx)(se,{children:g.map(e=>(0,B.jsx)(le,{value:e,children:e},e))})})]}),a?(0,B.jsx)(`p`,{className:`mt-1 text-caption text-muted-foreground`,role:`status`,children:S(`commit.repositoryLoading`)}):null,g.length===0?(0,B.jsx)(`p`,{className:`mt-1 text-caption text-danger`,role:`alert`,children:S(`commit.repositoryUnavailable`)}):null]}):null,e===null?null:(0,B.jsx)(`p`,{className:`mx-3 mt-2 shrink-0 text-caption text-danger`,role:`alert`,children:e.message}),U?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{className:`shrink-0 px-3 py-2`,children:[(0,B.jsxs)(fe,{className:c(`gap-1 rounded-surface border border-separator-strong bg-panel shadow-sm focus-within:border-brand focus-within:shadow-focus`,R===1?`h-8 max-workbench:h-11`:`h-18 max-workbench:h-21`),children:[(0,B.jsx)(me,{"aria-label":S(`commit.commitMessage`),className:`h-full min-h-0 overflow-y-auto px-2 py-1.5 text-label leading-5 focus-visible:!outline-none max-workbench:py-3`,disabled:V||_!==null,id:`commit-message`,onChange:e=>{let t=e.currentTarget.value;k(e=>({...e,message:t}))},placeholder:S(`commit.messagePlaceholder`),rows:R,value:P}),(0,B.jsx)(pe,{align:`inline-end`,className:`ml-auto`,children:(0,B.jsxs)(f,{children:[(0,B.jsx)(u,{asChild:!0,children:(0,B.jsx)(ee,{"aria-label":S(`commit.generateMessage`),className:`size-7 shrink-0 justify-center p-0 [&_svg]:size-3.5 max-workbench:size-11`,disabled:!W,onClick:()=>{K().catch(()=>void 0)},type:`button`,children:r?(0,B.jsx)(b,{"aria-hidden":`true`,className:`animate-spin`}):(0,B.jsx)(te,{"aria-hidden":`true`})})}),(0,B.jsx)(d,{side:`top`,children:S(`commit.generateMessage`)})]})})]}),_===null?(0,B.jsxs)(O,{className:`mt-2 w-full`,children:[(0,B.jsxs)(o,{className:`flex-1 rounded-r-none`,disabled:!G,onClick:()=>{q(`commit`).catch(()=>void 0)},type:`button`,children:[n?(0,B.jsx)(b,{"aria-hidden":`true`,className:`animate-spin`}):(0,B.jsx)(x,{"aria-hidden":`true`}),S(`commit.commit`)]}),(0,B.jsxs)(de,{children:[(0,B.jsx)(ce,{asChild:!0,children:(0,B.jsx)(o,{"aria-label":S(`commit.commitActions`),className:`w-10 rounded-l-none border-l border-brand-contrast/30 px-0`,disabled:!G,type:`button`,children:(0,B.jsx)(v,{"aria-hidden":`true`})})}),(0,B.jsx)(ue,{align:`end`,children:(0,B.jsxs)(ie,{children:[(0,B.jsxs)(I,{onSelect:()=>{q(`commit`).catch(()=>void 0)},children:[(0,B.jsx)(x,{"aria-hidden":`true`,className:`size-3.5`}),S(`commit.commit`)]}),(0,B.jsxs)(I,{onSelect:()=>{q(`commit_and_push`).catch(()=>void 0)},children:[(0,B.jsx)(M,{"aria-hidden":`true`,className:`size-3.5`}),S(`commit.commitAndPush`)]})]})})]})]}):(0,B.jsx)(`p`,{className:`mt-2 font-mono text-caption text-muted-foreground`,role:`status`,children:_.commitSha.slice(0,7)})]}),(0,B.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col border-t border-separator`,children:[(0,B.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center gap-1 px-3 text-label font-semibold`,children:[(0,B.jsx)(`span`,{children:S(`commit.changes`)}),(0,B.jsx)(`span`,{className:`ml-auto text-caption font-normal text-muted-foreground`,children:S(`commit.totalFiles`,{count:T.length})}),(0,B.jsxs)(f,{children:[(0,B.jsx)(u,{asChild:!0,children:(0,B.jsx)(o,{"aria-label":S(C===`tree`?`diff.showFileList`:`diff.showFileTree`),onClick:()=>{w(C===`tree`?`list`:`tree`)},size:`icon-sm`,type:`button`,variant:`ghost`,children:C===`tree`?(0,B.jsx)(ne,{"aria-hidden":`true`,className:`size-3.5`}):(0,B.jsx)(A,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,B.jsx)(d,{children:S(C===`tree`?`diff.showFileList`:`diff.showFileTree`)})]})]}),(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain py-0.5`,"data-slot":`commit-changes-scroll`,children:[(0,B.jsx)(Z,{changes:t.staged,disabled:V||_!==null,label:S(`commit.staged`),onOpenFileDiff:p,onSelectedPathsChange:e=>{k(t=>({...t,selectedPaths:e}))},selectedPaths:F,viewMode:C}),(0,B.jsx)(Z,{changes:t.unstaged,disabled:V||_!==null,label:S(`commit.unstaged`),onOpenFileDiff:p,onSelectedPathsChange:e=>{k(t=>({...t,selectedPaths:e}))},selectedPaths:F,viewMode:C})]})]})]}):null]})}function _e(e){return e.pushStatus===`pushed`?`commit.commitAndPushSucceeded`:e.pushStatus===`not_requested`?`commit.commitSucceeded`:null}function ve({client:e,detailsError:t=null,detailsPending:n=!1,gitStatus:r,onOpenFileDiff:a,projectId:o,rootPath:s}){let{t:c}=i(`workbench`),u=l(),d=h(N(o,s,e)),f=h({...F(o,s,e),meta:{actionNotification:{successMessage:!1}}}),m=(0,z.useMemo)(()=>ge(r),[r]),[_,v]=(0,z.useState)(),[b,x]=(0,z.useState)(null),S=b!==null&&m.includes(b)?b:m[0]??null,C=y(P(o,s,S,r.repositoryMode===`children`,e)),w=r.repositoryMode===`root`?r:C.data??r,T=_?.snapshot===w.snapshot?_.result:null;return(0,B.jsx)($,{error:t??C.error,gitStatus:w,isCommitting:f.isPending,isGenerating:d.isPending,isRepositoryLoading:n||C.isFetching,onCommit:async e=>{let t=e.expectedSnapshot,n=await f.mutateAsync(e);v({result:n,snapshot:t}),u.invalidateQueries({queryKey:[`projects`,o,s,`git-status`]}),u.invalidateQueries({queryKey:[`projects`,o,s,`git-history`]});let r=_e(n);if(r!==null){g(c(r));return}p(Error(n.pushError??c(`commit.commitCompletePushFailed`)))},onGenerateMessage:async e=>(await d.mutateAsync(e)).message,onOpenFileDiff:a,onSelectRepository:e=>{v(void 0),d.reset(),f.reset(),x(e)},repositories:m,result:T,selectedRepository:S})}function ye({client:e,detailsError:t,detailsPending:n,detailsStatus:r,gitStatus:i,gitStatusError:o,onOpenFileDiff:s,projectId:c,rootPath:l}){return c!==void 0&&e!==void 0&&i!==void 0?(0,B.jsx)(ve,{client:e,detailsError:t,detailsPending:n,gitStatus:r??i,onOpenFileDiff:s,projectId:c,rootPath:l}):o===null?(0,B.jsx)(`p`,{className:`p-3 text-caption text-muted-foreground`,role:`status`,children:a.t(`inspector.gitLoading`,{ns:`conversation`})}):(0,B.jsx)(`p`,{className:`p-3 text-caption text-danger`,role:`alert`,children:o.message})}export{ye as WorkbenchInspectorChanges};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CVaUQXZF.js";import{C as r,D as i,I as a,v as o,w as s,y as c}from"./dist-DBbCRukl.js";import{R as l,i as u,n as d,t as f}from"./tooltip-BPVbHVEF.js";import{a as p,c as m,l as h,o as g,t as _}from"./checkbox-BBHD70U-.js";import{n as v,r as y,t as b}from"./loader-circle-CJOhkEC8.js";import{t as x}from"./check-C92ZHwwX.js";import{a as S,i as C,o as w,r as T,t as E}from"./file-tree-DvTv0Re2.js";import{n as D,t as ee}from"./button-group-Bt_Rr9-f.js";import{S as O,r as te,y as ne}from"./prompt-input-controls-C_Zm2pL8.js";import{n as re,r as k,t as A}from"./file-navigation-view-preference-DeIXQ8c4.js";import{t as j}from"./upload-Bz26q2Ar.js";import{B as M,C as ie,Dt as N,F as ae,I as oe,It as P,L as se,M as ce,Ot as F,R as le,S as ue,w as I,x as de,z as L}from"./index-WZ8-8oYp.js";var R=s(`file-minus-corner`,[[`path`,{d:`M20 14V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12`,key:`l9p8hp`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),z=e(t(),1),B=n(),V=r(`min-w-0 text-foreground outline-none transition-[border-color,box-shadow] placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50`,{defaultVariants:{variant:`default`},variants:{variant:{default:`min-h-20 w-full resize-y rounded-control bg-control px-3 py-2 text-body focus-visible:shadow-focus`,embedded:`flex-1 resize-none bg-transparent`}}});function H({className:e,variant:t=`default`,...n}){return(0,B.jsx)(`textarea`,{className:c(V({className:e,variant:t})),"data-slot":`textarea`,"data-variant":t,...n})}function fe({className:e,...t}){return(0,B.jsx)(`div`,{className:c(`group/input-group flex w-full min-w-0 items-center`,e),"data-slot":`input-group`,role:`group`,...t})}function pe({align:e=`inline-start`,className:t,...n}){return(0,B.jsx)(`div`,{className:c(`flex shrink-0 items-center`,t),"data-align":e,"data-slot":`input-group-addon`,role:`group`,...n})}function me({className:e,...t}){return(0,B.jsx)(H,{className:c(`min-w-0 flex-1`,e),"data-slot":`input-group-control`,variant:`embedded`,...t})}function U(e){return[...e].sort((e,t)=>e.kind===t.kind?e.name.localeCompare(t.name,`en`):e.kind===`file`?-1:1)}function W(e){let t=[e.name],n=e;for(;n.children.size===1;){let e=n.children.values().next().value;if(e?.kind!==`folder`)break;t.push(e.name),n=e}return{children:U([...n.children.values()].map(e=>e.kind===`folder`?W(e):e)),kind:`folder`,name:t.join(`/`),path:n.path}}function G(e){let t={children:new Map,kind:`folder`,name:``,path:``};for(let n of e){let e=n.path.split(`/`),r=e.pop();if(r===void 0)continue;let i=t;for(let t of e){let e=i.path===``?t:`${i.path}/${t}`,n=i.children.get(t);if(n?.kind===`folder`){i=n;continue}let r={children:new Map,kind:`folder`,name:t,path:e};i.children.set(t,r),i=r}i.children.set(r,{kind:`file`,name:r,path:n.path,status:n.kind})}return U([...t.children.values()].map(e=>e.kind===`folder`?W(e):e))}function K(e,t){for(let n of e)n.kind===`folder`&&(t.add(n.path),K(n.children,t))}function q(e){return e===`create`?`text-diff-added`:e===`delete`?`text-danger`:`text-warning`}function J(e){let t=c(`size-3.5`,q(e));return e===`create`?(0,B.jsx)(O,{"aria-hidden":`true`,className:t}):e===`delete`?(0,B.jsx)(R,{"aria-hidden":`true`,className:t}):(0,B.jsx)(D,{"aria-hidden":`true`,className:t})}function Y(e){return e===`create`?`A`:e===`delete`?`D`:`M`}function X({changesByPath:e,disabled:t,label:n,nodes:r,onOpenFileDiff:i,onTogglePath:a,selectedPaths:o}){return r.map(r=>{if(r.kind===`folder`)return(0,B.jsx)(C,{name:r.name,path:r.path,children:(0,B.jsx)(X,{changesByPath:e,disabled:t,label:n,nodes:r.children,onOpenFileDiff:i,onTogglePath:a,selectedPaths:o})},r.path);let s=o.has(r.path),c=e.get(r.path);return(0,B.jsxs)(T,{"aria-label":r.path,className:q(r.status),icon:J(r.status),name:r.name,onClick:()=>{c!==void 0&&i(c)},path:r.path,trailing:(0,B.jsx)(`span`,{className:`ml-auto w-3 text-center text-meta font-semibold text-muted-foreground`,children:Y(r.status)}),children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,className:`size-5 shrink-0`}),(0,B.jsx)(_,{"aria-label":`${n}: ${r.path}`,checked:s,disabled:t,onCheckedChange:()=>{a(r.path)},onClick:e=>{e.stopPropagation()}}),(0,B.jsx)(S,{children:J(r.status)}),(0,B.jsx)(w,{title:r.path,children:r.name})]},r.path)})}function Z({changes:e,disabled:t=!1,label:n,onOpenFileDiff:r,onSelectedPathsChange:i,selectedPaths:a,viewMode:o=`tree`}){let s=(0,z.useMemo)(()=>G(e),[e]),l=(0,z.useMemo)(()=>new Map(e.map(e=>[e.path,e])),[e]),u=(0,z.useMemo)(()=>[...new Set(e.map(e=>e.path))],[e]),d=(0,z.useMemo)(()=>{let e=new Set;return K(s,e),e},[s]);if(u.length===0)return null;let f=u.filter(e=>a.has(e)).length,p=f===0?!1:f===u.length||`indeterminate`,m=e=>{let t=new Set(a);t.has(e)?t.delete(e):t.add(e),i(t)};return(0,B.jsxs)(`section`,{"aria-label":n,className:`py-0.5`,children:[(0,B.jsxs)(`div`,{className:`flex min-h-7 items-center gap-1.5 px-3`,children:[(0,B.jsx)(_,{"aria-label":n,checked:p,disabled:t||u.length===0,onCheckedChange:e=>{let t=new Set(a);for(let n of u)e===!0?t.add(n):t.delete(n);i(t)}}),(0,B.jsx)(`h3`,{className:`text-label font-semibold text-foreground`,children:n}),(0,B.jsx)(`span`,{className:`ml-auto text-caption text-muted-foreground`,children:u.length})]}),o===`list`?(0,B.jsx)(`div`,{className:`px-1 font-mono text-label`,"data-slot":`commit-changes-list`,role:`list`,children:e.toSorted((e,t)=>e.path.localeCompare(t.path,`en`)).map(e=>(0,B.jsxs)(`div`,{className:`flex min-h-7 items-center gap-1.5 rounded-control px-2 hover:bg-control-hover`,role:`listitem`,children:[(0,B.jsx)(_,{"aria-label":`${n}: ${e.path}`,checked:a.has(e.path),disabled:t,onCheckedChange:()=>{m(e.path)}}),(0,B.jsxs)(`button`,{"aria-label":e.path,className:c(`flex min-w-0 flex-1 items-center gap-1.5 text-left outline-none focus-visible:shadow-focus`,q(e.kind)),onClick:()=>{r(e)},type:`button`,children:[J(e.kind),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.path,children:e.path}),(0,B.jsx)(`span`,{className:`w-3 text-center text-meta font-semibold text-muted-foreground`,children:Y(e.kind)})]})]},e.path))}):s.length===0?null:(0,B.jsx)(E,{"aria-label":n,className:`px-1`,defaultExpanded:d,children:(0,B.jsx)(X,{changesByPath:l,disabled:t,label:n,nodes:s,onOpenFileDiff:r,onTogglePath:m,selectedPaths:a})})]})}function he(e){let t=new Map;for(let n of e.staged)t.set(n.path,{path:n.path,staged:!0,unstaged:!1});for(let n of e.unstaged){let e=t.get(n.path);t.set(n.path,{path:n.path,staged:e?.staged??!1,unstaged:!0})}return[...t.values()].sort((e,t)=>e.path.localeCompare(t.path,`en`))}function ge(e){if(e.repositoryMode!==`children`)return[];let t=new Set;for(let n of[...e.staged,...e.unstaged]){let e=n.path.indexOf(`/`);e>0&&t.add(n.path.slice(0,e))}return[...t].toSorted((e,t)=>e.localeCompare(t,`en`))}function Q(e,t){return{identity:e,message:``,selectedPaths:new Set(t.map(e=>e.path))}}function $({error:e=null,gitStatus:t,isCommitting:n=!1,isGenerating:r=!1,isRepositoryLoading:a=!1,onCommit:s,onGenerateMessage:l,onOpenFileDiff:p,onSelectRepository:h=()=>void 0,repositories:g=[],result:_=null,selectedRepository:y=null}){let{t:S}=i(`workbench`),[C,w]=A(`changes`),T=(0,z.useMemo)(()=>he(t),[t]),E=`${y??`root`}:${t.snapshot}`,[D,O]=(0,z.useState)(()=>Q(E,T)),N=(0,z.useRef)(m());D.identity!==E&&O(Q(E,T));let{message:P,selectedPaths:F}=D,R=P.includes(`
2
+ `)?3:1,V=r||n,H=g.length>0||t.repositoryMode===`children`,U=!H||y!==null&&!a&&t.repositoryMode===`root`,W=U&&F.size>0&&!V&&_===null,G=W&&P.trim().length>0,K=()=>N.current.run(async()=>{let e=await l({expectedSnapshot:t.snapshot,paths:[...F],...y===null?{}:{repository:y}});O(t=>({...t,message:e}))}),q=e=>N.current.run(()=>s({action:e,expectedSnapshot:t.snapshot,message:P,paths:[...F],...y===null?{}:{repository:y}}));return(0,B.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,"data-slot":`commit-changes-panel`,children:[H?(0,B.jsxs)(`div`,{className:`shrink-0 border-b border-separator px-3 py-2`,children:[(0,B.jsx)(`label`,{className:`text-label font-medium`,id:`commit-repository-label`,children:S(`commit.repository`)}),(0,B.jsxs)(ae,{disabled:V||_!==null,onValueChange:h,...y===null?{}:{value:y},children:[(0,B.jsx)(L,{"aria-labelledby":`commit-repository-label`,className:`mt-1 w-full`,children:(0,B.jsx)(M,{placeholder:S(`commit.selectRepository`)})}),(0,B.jsx)(oe,{position:`popper`,children:(0,B.jsx)(se,{children:g.map(e=>(0,B.jsx)(le,{value:e,children:e},e))})})]}),a?(0,B.jsx)(`p`,{className:`mt-1 text-caption text-muted-foreground`,role:`status`,children:S(`commit.repositoryLoading`)}):null,g.length===0?(0,B.jsx)(`p`,{className:`mt-1 text-caption text-danger`,role:`alert`,children:S(`commit.repositoryUnavailable`)}):null]}):null,e===null?null:(0,B.jsx)(`p`,{className:`mx-3 mt-2 shrink-0 text-caption text-danger`,role:`alert`,children:e.message}),U?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{className:`shrink-0 px-3 py-2`,children:[(0,B.jsxs)(fe,{className:c(`gap-1 rounded-surface border border-separator-strong bg-panel shadow-sm focus-within:border-brand focus-within:shadow-focus`,R===1?`h-8 max-workbench:h-11`:`h-18 max-workbench:h-21`),children:[(0,B.jsx)(me,{"aria-label":S(`commit.commitMessage`),className:`h-full min-h-0 overflow-y-auto px-2 py-1.5 text-label leading-5 focus-visible:!outline-none max-workbench:py-3`,disabled:V||_!==null,id:`commit-message`,onChange:e=>{let t=e.currentTarget.value;O(e=>({...e,message:t}))},placeholder:S(`commit.messagePlaceholder`),rows:R,value:P}),(0,B.jsx)(pe,{align:`inline-end`,className:`ml-auto`,children:(0,B.jsxs)(f,{children:[(0,B.jsx)(u,{asChild:!0,children:(0,B.jsx)(te,{"aria-label":S(`commit.generateMessage`),className:`size-7 shrink-0 justify-center p-0 [&_svg]:size-3.5 max-workbench:size-11`,disabled:!W,onClick:()=>{K().catch(()=>void 0)},type:`button`,children:r?(0,B.jsx)(b,{"aria-hidden":`true`,className:`animate-spin`}):(0,B.jsx)(ne,{"aria-hidden":`true`})})}),(0,B.jsx)(d,{side:`top`,children:S(`commit.generateMessage`)})]})})]}),_===null?(0,B.jsxs)(ee,{className:`mt-2 w-full`,children:[(0,B.jsxs)(o,{className:`flex-1 rounded-r-none`,disabled:!G,onClick:()=>{q(`commit`).catch(()=>void 0)},type:`button`,children:[n?(0,B.jsx)(b,{"aria-hidden":`true`,className:`animate-spin`}):(0,B.jsx)(x,{"aria-hidden":`true`}),S(`commit.commit`)]}),(0,B.jsxs)(de,{children:[(0,B.jsx)(ce,{asChild:!0,children:(0,B.jsx)(o,{"aria-label":S(`commit.commitActions`),className:`w-10 rounded-l-none border-l border-brand-contrast/30 px-0`,disabled:!G,type:`button`,children:(0,B.jsx)(v,{"aria-hidden":`true`})})}),(0,B.jsx)(ue,{align:`end`,children:(0,B.jsxs)(ie,{children:[(0,B.jsxs)(I,{onSelect:()=>{q(`commit`).catch(()=>void 0)},children:[(0,B.jsx)(x,{"aria-hidden":`true`,className:`size-3.5`}),S(`commit.commit`)]}),(0,B.jsxs)(I,{onSelect:()=>{q(`commit_and_push`).catch(()=>void 0)},children:[(0,B.jsx)(j,{"aria-hidden":`true`,className:`size-3.5`}),S(`commit.commitAndPush`)]})]})})]})]}):(0,B.jsx)(`p`,{className:`mt-2 font-mono text-caption text-muted-foreground`,role:`status`,children:_.commitSha.slice(0,7)})]}),(0,B.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col border-t border-separator`,children:[(0,B.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center gap-1 px-3 text-label font-semibold`,children:[(0,B.jsx)(`span`,{children:S(`commit.changes`)}),(0,B.jsx)(`span`,{className:`ml-auto text-caption font-normal text-muted-foreground`,children:S(`commit.totalFiles`,{count:T.length})}),(0,B.jsxs)(f,{children:[(0,B.jsx)(u,{asChild:!0,children:(0,B.jsx)(o,{"aria-label":S(C===`tree`?`diff.showFileList`:`diff.showFileTree`),onClick:()=>{w(C===`tree`?`list`:`tree`)},size:`icon-sm`,type:`button`,variant:`ghost`,children:C===`tree`?(0,B.jsx)(re,{"aria-hidden":`true`,className:`size-3.5`}):(0,B.jsx)(k,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,B.jsx)(d,{children:S(C===`tree`?`diff.showFileList`:`diff.showFileTree`)})]})]}),(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain py-0.5`,"data-slot":`commit-changes-scroll`,children:[(0,B.jsx)(Z,{changes:t.staged,disabled:V||_!==null,label:S(`commit.staged`),onOpenFileDiff:p,onSelectedPathsChange:e=>{O(t=>({...t,selectedPaths:e}))},selectedPaths:F,viewMode:C}),(0,B.jsx)(Z,{changes:t.unstaged,disabled:V||_!==null,label:S(`commit.unstaged`),onOpenFileDiff:p,onSelectedPathsChange:e=>{O(t=>({...t,selectedPaths:e}))},selectedPaths:F,viewMode:C})]})]})]}):null]})}function _e(e){return e.pushStatus===`pushed`?`commit.commitAndPushSucceeded`:e.pushStatus===`not_requested`?`commit.commitSucceeded`:null}function ve({client:e,detailsError:t=null,detailsPending:n=!1,gitStatus:r,onOpenFileDiff:a,projectId:o,rootPath:s}){let{t:c}=i(`workbench`),u=l(),d=h(F(o,s,e)),f=h({...N(o,s,e),meta:{actionNotification:{successMessage:!1}}}),m=(0,z.useMemo)(()=>ge(r),[r]),[_,v]=(0,z.useState)(),[b,x]=(0,z.useState)(null),S=b!==null&&m.includes(b)?b:m[0]??null,C=y(P(o,s,S,r.repositoryMode===`children`,e)),w=r.repositoryMode===`root`?r:C.data??r,T=_?.snapshot===w.snapshot?_.result:null;return(0,B.jsx)($,{error:t??C.error,gitStatus:w,isCommitting:f.isPending,isGenerating:d.isPending,isRepositoryLoading:n||C.isFetching,onCommit:async e=>{let t=e.expectedSnapshot,n=await f.mutateAsync(e);v({result:n,snapshot:t}),u.invalidateQueries({queryKey:[`projects`,o,s,`git-status`]}),u.invalidateQueries({queryKey:[`projects`,o,s,`git-history`]});let r=_e(n);if(r!==null){g(c(r));return}p(Error(n.pushError??c(`commit.commitCompletePushFailed`)))},onGenerateMessage:async e=>(await d.mutateAsync(e)).message,onOpenFileDiff:a,onSelectRepository:e=>{v(void 0),d.reset(),f.reset(),x(e)},repositories:m,result:T,selectedRepository:S})}function ye({client:e,detailsError:t,detailsPending:n,detailsStatus:r,gitStatus:i,gitStatusError:o,onOpenFileDiff:s,projectId:c,rootPath:l}){return c!==void 0&&e!==void 0&&i!==void 0?(0,B.jsx)(ve,{client:e,detailsError:t,detailsPending:n,gitStatus:r??i,onOpenFileDiff:s,projectId:c,rootPath:l}):o===null?(0,B.jsx)(`p`,{className:`p-3 text-caption text-muted-foreground`,role:`status`,children:a.t(`inspector.gitLoading`,{ns:`conversation`})}):(0,B.jsx)(`p`,{className:`p-3 text-caption text-danger`,role:`alert`,children:o.message})}export{ye as WorkbenchInspectorChanges};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CVaUQXZF.js";import{D as r,w as i}from"./dist-B3LT8os9.js";import{D as a,E as o,h as s,l as c,m as l}from"./tooltip-4ec-13io.js";import{m as u}from"./prompt-input-controls-DWd_vgsW.js";var d=i(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),f=i(`git-fork`,[[`circle`,{cx:`12`,cy:`18`,r:`3`,key:`1mpf1b`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`path`,{d:`M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9`,key:`1uq4wg`}],[`path`,{d:`M12 12v3`,key:`158kv8`}]]),p=i(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),m=e(t(),1),h=n();function g(e,t,n){let r=0;for(let i=0;i<e.length;){let a=e.codePointAt(i);if(a===void 0)break;if(i+=a>65535?2:1,r+=1,r>t)return new File([e],n,{type:`text/plain`})}}function _(e,t){return t===void 0||t.trim()===``||t.split(`,`).some(t=>{let n=t.trim();return n.startsWith(`.`)?e.name.toLowerCase().endsWith(n.toLowerCase()):n.endsWith(`/*`)?e.type.startsWith(n.slice(0,-1)):e.type===n})}function v(e){e.previewUrl.startsWith(`blob:`)&&URL.revokeObjectURL(e.previewUrl)}function y({attachments:e,children:t,className:n=``,disabled:i=!1,fileAccept:a,globalDrop:o=!1,imageAccept:c,largePasteCharacterThreshold:l=1/0,maxFileTotalSize:d=1/0,maxFileSize:f=1/0,maxImageSize:p=1/0,maxImages:y=1/0,maxImageTotalSize:b=1/0,multiple:x=!1,onAttachmentsChange:S,onError:C,onPaste:w,onPasteCapture:T,onSubmit:E,pastedTextFileName:D=`Pasted text.txt`,resetKey:O,...k}){let{t:A}=r(`conversation`),[j,M]=(0,m.useState)([]),N=e??j,P=(0,m.useRef)(N),F=(0,m.useRef)(e!==void 0),I=(0,m.useRef)(O);P.current=N,F.current=e!==void 0;let L=(0,m.useCallback)(t=>{if(e!==void 0){S?.(t(e));return}M(e=>[...t(e)])},[e,S]),R=(0,m.useCallback)((e,t=!1)=>{L(n=>{if(i)return n;let r=[],o=n.filter(e=>e.kind===`image`).length,l=n.reduce((e,t)=>e+(t.kind===`image`?t.size:0),0),u=n.reduce((e,t)=>e+(t.kind===`image`?0:t.size),0);for(let n of e){let e=t?`text`:_(n,c)?`image`:`file`;if(!(e===`text`||(e===`image`?_(n,c):_(n,a)))){C?.({code:`invalid_file_type`,message:A(`agentComponents.invalidFileType`,{name:n.name})});continue}if(e!==`image`&&n.size>f){C?.({code:`file_too_large`,message:A(`agentComponents.fileTooLarge`,{name:n.name})});continue}if(e===`image`&&n.size>p){C?.({code:`file_too_large`,message:A(`agentComponents.fileTooLarge`,{name:n.name})});continue}if(e===`image`&&o>=y){C?.({code:`too_many_images`,message:A(`agentComponents.tooManyImages`,{count:y})});continue}if(e===`image`&&l+n.size>b){C?.({code:`total_size_exceeded`,message:A(`agentComponents.totalImageSizeExceeded`)});continue}if(e!==`image`&&u+n.size>d){C?.({code:`total_size_exceeded`,message:A(`agentComponents.totalAttachmentSizeExceeded`)});continue}if(r.push({file:n,id:s(),kind:e,mediaType:n.type,name:n.name,previewUrl:URL.createObjectURL(n),size:n.size,source:`browser`}),e===`image`?(o+=1,l+=n.size):u+=n.size,!x)break}return[...n,...r]})},[i,a,c,f,d,p,y,b,x,C,A,L]),z=(0,m.useCallback)(()=>{L(e=>(e.forEach(v),[]))},[L]);(0,m.useLayoutEffect)(()=>{I.current!==O&&(I.current=O,e===void 0&&z())},[e,z,O]);let B=(0,m.useCallback)(e=>{L(t=>{let n=t.find(t=>t.id===e);return n!==void 0&&v(n),t.filter(t=>t.id!==e)})},[L]);(0,m.useEffect)(()=>()=>{F.current||P.current.forEach(v)},[]),(0,m.useEffect)(()=>{e===void 0&&S?.(j)},[e,j,S]),(0,m.useEffect)(()=>{if(!o||i)return;let e=e=>{e.dataTransfer?.types.includes(`Files`)===!0&&e.preventDefault()},t=e=>{e.dataTransfer?.files.length&&(e.preventDefault(),R([...e.dataTransfer.files]))};return document.addEventListener(`dragover`,e),document.addEventListener(`drop`,t),()=>{document.removeEventListener(`dragover`,e),document.removeEventListener(`drop`,t)}},[R,i,o]);let V=(0,m.useMemo)(()=>({clear:z,disabled:i,files:N,remove:B}),[z,i,N,B]);return(0,h.jsx)(u.Provider,{value:V,children:(0,h.jsx)(`form`,{...k,className:`overflow-visible rounded-surface border border-transparent bg-raised shadow-floating transition-[border-color,box-shadow] focus-within:border-brand focus-within:shadow-focus ${n}`,"data-prompt-input":``,onPasteCapture:e=>{if(T?.(e),i||e.defaultPrevented||e.clipboardData.files.length>0)return;let t=g(e.clipboardData.getData(`text/plain`),l,D);t!==void 0&&(e.preventDefault(),R([t],!0))},onPaste:e=>{if(w?.(e),i||e.defaultPrevented)return;let t=[...e.clipboardData.files];t.length>0&&(e.preventDefault(),R(t))},onSubmit:e=>{e.preventDefault();let t=new FormData(e.currentTarget).get(`message`);E?.({files:N,text:typeof t==`string`?t:``},e)},children:t})})}function b(e){return e.approvalPolicy===`never`?`never`:e.approvalPolicy===`on-request`&&e.approvalsReviewer===`auto_review`?`auto-review`:`on-request`}function x(e,t){return t===`auto-review`?{...e,approvalPolicy:`on-request`,approvalsReviewer:`auto_review`}:{...e,approvalPolicy:t,approvalsReviewer:`user`}}var S=[`workbench-pets`];function C(e=c){return a({queryFn:({signal:t})=>e.listWorkbenchPets({signal:t}),queryKey:S,staleTime:3e4})}function w(e,t){let n=e?.data??[],r=n.findIndex(e=>e.id===t.id);return r<0?{data:[...n,t]}:{data:n.map((e,n)=>n===r?t:e)}}function T(e,t=c){return o({meta:{actionNotification:{successMessage:!1}},mutationFn:async e=>{let n=`workbench-pet-${e}-${globalThis.crypto.randomUUID()}`;return t.downloadWorkbenchPet(e,{idempotencyKey:n})},mutationKey:[`workbench-pets`,`download`],onSuccess:({data:t})=>{e.setQueryData(S,e=>w(e,t))},scope:{id:`workbench-pet-download`}})}function E(e){return e!==void 0&&e.frames.length>0}function D(e,t){let n=new Set,r=t;for(;!n.has(r);){n.add(r);let t=e[r];if(t!==void 0&&E(t))return t;if(t!==void 0)r=t.fallback;else if(r!==`idle`)r=`idle`;else return}}var O=class{#e;#t;#n=`idle`;#r=!1;#i=0;#a=!1;#o;#s=!0;constructor(e){this.#e=e.animations,this.#t=e.onFrame}play(e){this.#n=e,this.#l()}setReducedMotion(e){this.#a!==e&&(this.#a=e,this.#l())}setVisible(e){this.#s!==e&&(this.#s=e,this.#l())}dispose(){this.#r=!0,this.#i+=1,this.#c()}#c(){this.#o!==void 0&&clearTimeout(this.#o),this.#o=void 0}#l(){if(this.#i+=1,this.#c(),this.#r||!this.#s)return;let e=D(this.#e,this.#n);e!==void 0&&this.#u(e,0,this.#i)}#u(e,t,n){if(n!==this.#i||this.#r||!this.#s)return;let r=e.frames[t];if(r===void 0||(this.#t(r.spriteIndex),this.#a))return;let i=t+1,a=e.loopStart??-1;i>=e.frames.length&&a<0||(this.#o=setTimeout(()=>{this.#o=void 0,this.#u(e,i<e.frames.length?i:a,n)},r.durationMs))}};async function k(e,t){let n=await fetch(e,{credentials:`same-origin`,signal:t});if(!n.ok)throw Error(`Unable to load pet asset: ${String(n.status)}`);return createImageBitmap(await n.blob())}function A(e,t,n,r){let i=e.getContext(`2d`);if(i===null)throw Error(`Canvas 2D context is unavailable`);let a=Math.max(1,e.clientWidth||n.width),o=Math.max(1,e.clientHeight||n.height),s=Math.min(3,Math.max(1,globalThis.devicePixelRatio||1)),c=Math.round(a*s),l=Math.round(o*s);e.width!==c&&(e.width=c),e.height!==l&&(e.height=l);let u=r%n.columns,d=Math.floor(r/n.columns);i.clearRect(0,0,c,l),i.imageSmoothingEnabled=!1,i.drawImage(t,u*n.width,d*n.height,n.width,n.height,0,0,c,l)}function j(){let[e,t]=(0,m.useState)(!1);return(0,m.useEffect)(()=>{let e=matchMedia(`(prefers-reduced-motion: reduce)`),n=()=>{t(e.matches)};return n(),e.addEventListener(`change`,n),()=>{e.removeEventListener(`change`,n)}},[]),e}function M({animationName:e,pet:t}){let n=(0,m.useRef)(null),[r,i]=(0,m.useState)(null),[a,o]=(0,m.useState)(!1),s=j(),c=l(t.assetId);return(0,m.useEffect)(()=>{let e=new AbortController,t=!0;return i(null),o(!1),typeof createImageBitmap==`function`?(k(c,e.signal).then(e=>{t?i(e):e.close()}).catch(()=>{t&&!e.signal.aborted&&o(!0)}),()=>{t=!1,e.abort()}):(o(!0),()=>{e.abort()})},[c]),(0,m.useEffect)(()=>()=>{r?.close()},[r]),(0,m.useEffect)(()=>{let i=n.current;if(i===null||r===null)return;let a=0,c=e=>{a=e;try{A(i,r,t.frame,e)}catch{o(!0)}},l=new O({animations:t.animations,onFrame:c});l.setReducedMotion(s),l.setVisible(document.visibilityState===`visible`),l.play(e);let u=new ResizeObserver(()=>{c(a)});u.observe(i);let d=()=>{l.setVisible(document.visibilityState===`visible`)};return document.addEventListener(`visibilitychange`,d),()=>{u.disconnect(),document.removeEventListener(`visibilitychange`,d),l.dispose()}},[e,r,t.animations,t.frame,s]),a?(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`workbench-pet-static-fallback`,style:{backgroundImage:`url(${c})`,backgroundSize:`${String(t.frame.columns*100)}% ${String(t.frame.rows*100)}%`}}):(0,h.jsx)(`canvas`,{"aria-hidden":`true`,className:`workbench-pet-canvas`,ref:n})}export{b as a,f as c,x as i,d as l,T as n,y as o,C as r,p as s,M as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CVaUQXZF.js";import{D as r,w as i}from"./dist-DBbCRukl.js";import{D as a,E as o,h as s,l as c,m as l}from"./tooltip-BPVbHVEF.js";import{m as u}from"./prompt-input-controls-C_Zm2pL8.js";var d=i(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),f=i(`git-fork`,[[`circle`,{cx:`12`,cy:`18`,r:`3`,key:`1mpf1b`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`path`,{d:`M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9`,key:`1uq4wg`}],[`path`,{d:`M12 12v3`,key:`158kv8`}]]),p=i(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),m=e(t(),1),h=n();function g(e,t,n){let r=0;for(let i=0;i<e.length;){let a=e.codePointAt(i);if(a===void 0)break;if(i+=a>65535?2:1,r+=1,r>t)return new File([e],n,{type:`text/plain`})}}function _(e,t){return t===void 0||t.trim()===``||t.split(`,`).some(t=>{let n=t.trim();return n.startsWith(`.`)?e.name.toLowerCase().endsWith(n.toLowerCase()):n.endsWith(`/*`)?e.type.startsWith(n.slice(0,-1)):e.type===n})}function v(e){e.previewUrl.startsWith(`blob:`)&&URL.revokeObjectURL(e.previewUrl)}function y({attachments:e,children:t,className:n=``,disabled:i=!1,fileAccept:a,globalDrop:o=!1,imageAccept:c,largePasteCharacterThreshold:l=1/0,maxFileTotalSize:d=1/0,maxFileSize:f=1/0,maxImageSize:p=1/0,maxImages:y=1/0,maxImageTotalSize:b=1/0,multiple:x=!1,onAttachmentsChange:S,onError:C,onPaste:w,onPasteCapture:T,onSubmit:E,pastedTextFileName:D=`Pasted text.txt`,resetKey:O,...k}){let{t:A}=r(`conversation`),[j,M]=(0,m.useState)([]),N=e??j,P=(0,m.useRef)(N),F=(0,m.useRef)(e!==void 0),I=(0,m.useRef)(O);P.current=N,F.current=e!==void 0;let L=(0,m.useCallback)(t=>{if(e!==void 0){S?.(t(e));return}M(e=>[...t(e)])},[e,S]),R=(0,m.useCallback)((e,t=!1)=>{L(n=>{if(i)return n;let r=[],o=n.filter(e=>e.kind===`image`).length,l=n.reduce((e,t)=>e+(t.kind===`image`?t.size:0),0),u=n.reduce((e,t)=>e+(t.kind===`image`?0:t.size),0);for(let n of e){let e=t?`text`:_(n,c)?`image`:`file`;if(!(e===`text`||(e===`image`?_(n,c):_(n,a)))){C?.({code:`invalid_file_type`,message:A(`agentComponents.invalidFileType`,{name:n.name})});continue}if(e!==`image`&&n.size>f){C?.({code:`file_too_large`,message:A(`agentComponents.fileTooLarge`,{name:n.name})});continue}if(e===`image`&&n.size>p){C?.({code:`file_too_large`,message:A(`agentComponents.fileTooLarge`,{name:n.name})});continue}if(e===`image`&&o>=y){C?.({code:`too_many_images`,message:A(`agentComponents.tooManyImages`,{count:y})});continue}if(e===`image`&&l+n.size>b){C?.({code:`total_size_exceeded`,message:A(`agentComponents.totalImageSizeExceeded`)});continue}if(e!==`image`&&u+n.size>d){C?.({code:`total_size_exceeded`,message:A(`agentComponents.totalAttachmentSizeExceeded`)});continue}if(r.push({file:n,id:s(),kind:e,mediaType:n.type,name:n.name,previewUrl:URL.createObjectURL(n),size:n.size,source:`browser`}),e===`image`?(o+=1,l+=n.size):u+=n.size,!x)break}return[...n,...r]})},[i,a,c,f,d,p,y,b,x,C,A,L]),z=(0,m.useCallback)(()=>{L(e=>(e.forEach(v),[]))},[L]);(0,m.useLayoutEffect)(()=>{I.current!==O&&(I.current=O,e===void 0&&z())},[e,z,O]);let B=(0,m.useCallback)(e=>{L(t=>{let n=t.find(t=>t.id===e);return n!==void 0&&v(n),t.filter(t=>t.id!==e)})},[L]);(0,m.useEffect)(()=>()=>{F.current||P.current.forEach(v)},[]),(0,m.useEffect)(()=>{e===void 0&&S?.(j)},[e,j,S]),(0,m.useEffect)(()=>{if(!o||i)return;let e=e=>{e.dataTransfer?.types.includes(`Files`)===!0&&e.preventDefault()},t=e=>{e.dataTransfer?.files.length&&(e.preventDefault(),R([...e.dataTransfer.files]))};return document.addEventListener(`dragover`,e),document.addEventListener(`drop`,t),()=>{document.removeEventListener(`dragover`,e),document.removeEventListener(`drop`,t)}},[R,i,o]);let V=(0,m.useMemo)(()=>({clear:z,disabled:i,files:N,remove:B}),[z,i,N,B]);return(0,h.jsx)(u.Provider,{value:V,children:(0,h.jsx)(`form`,{...k,className:`overflow-visible rounded-surface border border-transparent bg-raised shadow-floating transition-[border-color,box-shadow] focus-within:border-brand focus-within:shadow-focus ${n}`,"data-prompt-input":``,onPasteCapture:e=>{if(T?.(e),i||e.defaultPrevented||e.clipboardData.files.length>0)return;let t=g(e.clipboardData.getData(`text/plain`),l,D);t!==void 0&&(e.preventDefault(),R([t],!0))},onPaste:e=>{if(w?.(e),i||e.defaultPrevented)return;let t=[...e.clipboardData.files];t.length>0&&(e.preventDefault(),R(t))},onSubmit:e=>{e.preventDefault();let t=new FormData(e.currentTarget).get(`message`);E?.({files:N,text:typeof t==`string`?t:``},e)},children:t})})}function b(e){return e.approvalPolicy===`never`?`never`:e.approvalPolicy===`on-request`&&e.approvalsReviewer===`auto_review`?`auto-review`:`on-request`}function x(e,t){return t===`auto-review`?{...e,approvalPolicy:`on-request`,approvalsReviewer:`auto_review`}:{...e,approvalPolicy:t,approvalsReviewer:`user`}}var S=[`workbench-pets`];function C(e=c){return a({queryFn:({signal:t})=>e.listWorkbenchPets({signal:t}),queryKey:S,staleTime:3e4})}function w(e,t){let n=e?.data??[],r=n.findIndex(e=>e.id===t.id);return r<0?{data:[...n,t]}:{data:n.map((e,n)=>n===r?t:e)}}function T(e,t=c){return o({meta:{actionNotification:{successMessage:!1}},mutationFn:async e=>{let n=`workbench-pet-${e}-${globalThis.crypto.randomUUID()}`;return t.downloadWorkbenchPet(e,{idempotencyKey:n})},mutationKey:[`workbench-pets`,`download`],onSuccess:({data:t})=>{e.setQueryData(S,e=>w(e,t))},scope:{id:`workbench-pet-download`}})}function E(e){return e!==void 0&&e.frames.length>0}function D(e,t){let n=new Set,r=t;for(;!n.has(r);){n.add(r);let t=e[r];if(t!==void 0&&E(t))return t;if(t!==void 0)r=t.fallback;else if(r!==`idle`)r=`idle`;else return}}var O=class{#e;#t;#n=`idle`;#r=!1;#i=0;#a=!1;#o;#s=!0;constructor(e){this.#e=e.animations,this.#t=e.onFrame}play(e){this.#n=e,this.#l()}setReducedMotion(e){this.#a!==e&&(this.#a=e,this.#l())}setVisible(e){this.#s!==e&&(this.#s=e,this.#l())}dispose(){this.#r=!0,this.#i+=1,this.#c()}#c(){this.#o!==void 0&&clearTimeout(this.#o),this.#o=void 0}#l(){if(this.#i+=1,this.#c(),this.#r||!this.#s)return;let e=D(this.#e,this.#n);e!==void 0&&this.#u(e,0,this.#i)}#u(e,t,n){if(n!==this.#i||this.#r||!this.#s)return;let r=e.frames[t];if(r===void 0||(this.#t(r.spriteIndex),this.#a))return;let i=t+1,a=e.loopStart??-1;i>=e.frames.length&&a<0||(this.#o=setTimeout(()=>{this.#o=void 0,this.#u(e,i<e.frames.length?i:a,n)},r.durationMs))}};async function k(e,t){let n=await fetch(e,{credentials:`same-origin`,signal:t});if(!n.ok)throw Error(`Unable to load pet asset: ${String(n.status)}`);return createImageBitmap(await n.blob())}function A(e,t,n,r){let i=e.getContext(`2d`);if(i===null)throw Error(`Canvas 2D context is unavailable`);let a=Math.max(1,e.clientWidth||n.width),o=Math.max(1,e.clientHeight||n.height),s=Math.min(3,Math.max(1,globalThis.devicePixelRatio||1)),c=Math.round(a*s),l=Math.round(o*s);e.width!==c&&(e.width=c),e.height!==l&&(e.height=l);let u=r%n.columns,d=Math.floor(r/n.columns);i.clearRect(0,0,c,l),i.imageSmoothingEnabled=!1,i.drawImage(t,u*n.width,d*n.height,n.width,n.height,0,0,c,l)}function j(){let[e,t]=(0,m.useState)(!1);return(0,m.useEffect)(()=>{let e=matchMedia(`(prefers-reduced-motion: reduce)`),n=()=>{t(e.matches)};return n(),e.addEventListener(`change`,n),()=>{e.removeEventListener(`change`,n)}},[]),e}function M({animationName:e,pet:t}){let n=(0,m.useRef)(null),[r,i]=(0,m.useState)(null),[a,o]=(0,m.useState)(!1),s=j(),c=l(t.assetId);return(0,m.useEffect)(()=>{let e=new AbortController,t=!0;return i(null),o(!1),typeof createImageBitmap==`function`?(k(c,e.signal).then(e=>{t?i(e):e.close()}).catch(()=>{t&&!e.signal.aborted&&o(!0)}),()=>{t=!1,e.abort()}):(o(!0),()=>{e.abort()})},[c]),(0,m.useEffect)(()=>()=>{r?.close()},[r]),(0,m.useEffect)(()=>{let i=n.current;if(i===null||r===null)return;let a=0,c=e=>{a=e;try{A(i,r,t.frame,e)}catch{o(!0)}},l=new O({animations:t.animations,onFrame:c});l.setReducedMotion(s),l.setVisible(document.visibilityState===`visible`),l.play(e);let u=new ResizeObserver(()=>{c(a)});u.observe(i);let d=()=>{l.setVisible(document.visibilityState===`visible`)};return document.addEventListener(`visibilitychange`,d),()=>{u.disconnect(),document.removeEventListener(`visibilitychange`,d),l.dispose()}},[e,r,t.animations,t.frame,s]),a?(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`workbench-pet-static-fallback`,style:{backgroundImage:`url(${c})`,backgroundSize:`${String(t.frame.columns*100)}% ${String(t.frame.rows*100)}%`}}):(0,h.jsx)(`canvas`,{"aria-hidden":`true`,className:`workbench-pet-canvas`,ref:n})}export{b as a,f as c,x as i,d as l,T as n,y as o,C as r,p as s,M as t};