@open-mercato/cezar 0.8.0 → 0.9.0-pr470.649

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 (247) hide show
  1. package/README.md +109 -14
  2. package/dist/agent-config/catalog.d.ts +64 -0
  3. package/dist/agent-config/catalog.js +205 -0
  4. package/dist/agent-config/catalog.js.map +1 -0
  5. package/dist/agent-config/files.d.ts +46 -0
  6. package/dist/agent-config/files.js +119 -0
  7. package/dist/agent-config/files.js.map +1 -0
  8. package/dist/agent-config/seed.d.ts +7 -0
  9. package/dist/agent-config/seed.js +90 -0
  10. package/dist/agent-config/seed.js.map +1 -0
  11. package/dist/agent-config/service.d.ts +44 -0
  12. package/dist/agent-config/service.js +71 -0
  13. package/dist/agent-config/service.js.map +1 -0
  14. package/dist/agent-config/validate.d.ts +21 -0
  15. package/dist/agent-config/validate.js +76 -0
  16. package/dist/agent-config/validate.js.map +1 -0
  17. package/dist/config.d.ts +34 -4
  18. package/dist/config.js +97 -2
  19. package/dist/config.js.map +1 -1
  20. package/dist/core/agent-env.js +21 -15
  21. package/dist/core/agent-env.js.map +1 -1
  22. package/dist/core/agent-runner.d.ts +16 -6
  23. package/dist/core/agent-runner.js +15 -3
  24. package/dist/core/agent-runner.js.map +1 -1
  25. package/dist/core/ask.d.ts +184 -0
  26. package/dist/core/ask.js +97 -0
  27. package/dist/core/ask.js.map +1 -0
  28. package/dist/core/backend-detect.d.ts +5 -5
  29. package/dist/core/backend-detect.js +37 -5
  30. package/dist/core/backend-detect.js.map +1 -1
  31. package/dist/core/claude-cli-runner.d.ts +5 -1
  32. package/dist/core/claude-cli-runner.js +4 -2
  33. package/dist/core/claude-cli-runner.js.map +1 -1
  34. package/dist/core/claude-ui-mapper.d.ts +9 -0
  35. package/dist/core/claude-ui-mapper.js +34 -3
  36. package/dist/core/claude-ui-mapper.js.map +1 -1
  37. package/dist/core/codex-app-server-runner.d.ts +15 -3
  38. package/dist/core/codex-app-server-runner.js +158 -127
  39. package/dist/core/codex-app-server-runner.js.map +1 -1
  40. package/dist/core/codex-app-server-transport.d.ts +30 -0
  41. package/dist/core/codex-app-server-transport.js +136 -0
  42. package/dist/core/codex-app-server-transport.js.map +1 -0
  43. package/dist/core/codex-model-catalog.d.ts +10 -0
  44. package/dist/core/codex-model-catalog.js +110 -0
  45. package/dist/core/codex-model-catalog.js.map +1 -0
  46. package/dist/core/codex-ui-mapper.d.ts +47 -2
  47. package/dist/core/codex-ui-mapper.js +247 -29
  48. package/dist/core/codex-ui-mapper.js.map +1 -1
  49. package/dist/core/model-identity.d.ts +113 -0
  50. package/dist/core/model-identity.js +119 -0
  51. package/dist/core/model-identity.js.map +1 -0
  52. package/dist/core/model-presets.d.ts +15 -0
  53. package/dist/core/model-presets.js +43 -0
  54. package/dist/core/model-presets.js.map +1 -0
  55. package/dist/core/opencode-server-runner.d.ts +1 -1
  56. package/dist/core/opencode-server-runner.js +7 -12
  57. package/dist/core/opencode-server-runner.js.map +1 -1
  58. package/dist/core/opencode-ui-mapper.d.ts +11 -7
  59. package/dist/core/opencode-ui-mapper.js +62 -19
  60. package/dist/core/opencode-ui-mapper.js.map +1 -1
  61. package/dist/core/pi-runner.d.ts +40 -0
  62. package/dist/core/pi-runner.js +46 -0
  63. package/dist/core/pi-runner.js.map +1 -0
  64. package/dist/core/process-usage.d.ts +3 -0
  65. package/dist/core/process-usage.js +12 -0
  66. package/dist/core/process-usage.js.map +1 -1
  67. package/dist/core/runner-factory.js +3 -0
  68. package/dist/core/runner-factory.js.map +1 -1
  69. package/dist/core/runner-model-catalog.d.ts +28 -0
  70. package/dist/core/runner-model-catalog.js +62 -0
  71. package/dist/core/runner-model-catalog.js.map +1 -0
  72. package/dist/core/secret-redaction.js.map +1 -1
  73. package/dist/core/tool-display.d.ts +2 -2
  74. package/dist/core/tool-display.js +24 -6
  75. package/dist/core/tool-display.js.map +1 -1
  76. package/dist/core/ui-events.d.ts +29 -2
  77. package/dist/git-worktree.d.ts +37 -4
  78. package/dist/git-worktree.js +175 -12
  79. package/dist/git-worktree.js.map +1 -1
  80. package/dist/handoff.d.ts +2 -2
  81. package/dist/handoff.js +2 -0
  82. package/dist/handoff.js.map +1 -1
  83. package/dist/index.js +55 -5
  84. package/dist/index.js.map +1 -1
  85. package/dist/install-as-command.d.ts +1 -1
  86. package/dist/install-as-command.js.map +1 -1
  87. package/dist/paths.d.ts +32 -2
  88. package/dist/paths.js +47 -2
  89. package/dist/paths.js.map +1 -1
  90. package/dist/runs/auto-name.js.map +1 -1
  91. package/dist/runs/retention.js.map +1 -1
  92. package/dist/runs/review-gate.js.map +1 -1
  93. package/dist/runs/store.d.ts +154 -60
  94. package/dist/runs/store.js +103 -19
  95. package/dist/runs/store.js.map +1 -1
  96. package/dist/runs/task-markers.d.ts +6 -2
  97. package/dist/runs/task-markers.js +25 -4
  98. package/dist/runs/task-markers.js.map +1 -1
  99. package/dist/runs/ui-event-sink.js.map +1 -1
  100. package/dist/server/capabilities.d.ts +22 -6
  101. package/dist/server/capabilities.js +85 -8
  102. package/dist/server/capabilities.js.map +1 -1
  103. package/dist/server/checkout.d.ts +128 -0
  104. package/dist/server/checkout.js +296 -0
  105. package/dist/server/checkout.js.map +1 -0
  106. package/dist/server/forge/github.d.ts +281 -10
  107. package/dist/server/forge/github.js +539 -23
  108. package/dist/server/forge/github.js.map +1 -1
  109. package/dist/server/forge/types.d.ts +48 -1
  110. package/dist/server/fs-browse.d.ts +105 -0
  111. package/dist/server/fs-browse.js +182 -0
  112. package/dist/server/fs-browse.js.map +1 -0
  113. package/dist/server/git-changes.d.ts +12 -3
  114. package/dist/server/git-changes.js +23 -5
  115. package/dist/server/git-changes.js.map +1 -1
  116. package/dist/server/github.d.ts +1 -1
  117. package/dist/server/open-in-app.d.ts +2 -1
  118. package/dist/server/open-in-app.js +1 -0
  119. package/dist/server/open-in-app.js.map +1 -1
  120. package/dist/server/project-context.d.ts +103 -0
  121. package/dist/server/project-context.js +153 -0
  122. package/dist/server/project-context.js.map +1 -0
  123. package/dist/server/server.d.ts +110 -0
  124. package/dist/server/server.js +1557 -215
  125. package/dist/server/server.js.map +1 -1
  126. package/dist/server/wsl.js.map +1 -1
  127. package/dist/server-install/platforms/macosx-ngrok.js.map +1 -1
  128. package/dist/server-install/platforms/ubuntu-vps.js +7 -0
  129. package/dist/server-install/platforms/ubuntu-vps.js.map +1 -1
  130. package/dist/server-install/state.js.map +1 -1
  131. package/dist/server-install/steps.js +6 -2
  132. package/dist/server-install/steps.js.map +1 -1
  133. package/dist/server-install/types.d.ts +28 -28
  134. package/dist/server-install/ui.js.map +1 -1
  135. package/dist/skills-banner.js.map +1 -1
  136. package/dist/skills-remote.d.ts +10 -4
  137. package/dist/skills-remote.js +31 -14
  138. package/dist/skills-remote.js.map +1 -1
  139. package/dist/skills.d.ts +29 -0
  140. package/dist/skills.js +72 -14
  141. package/dist/skills.js.map +1 -1
  142. package/dist/todos.d.ts +9 -7
  143. package/dist/todos.js +38 -19
  144. package/dist/todos.js.map +1 -1
  145. package/dist/workflows/run.d.ts +145 -10
  146. package/dist/workflows/run.js +608 -66
  147. package/dist/workflows/run.js.map +1 -1
  148. package/dist/workflows/types.d.ts +42 -42
  149. package/dist/workflows/types.js +2 -1
  150. package/dist/workflows/types.js.map +1 -1
  151. package/dist/workspace/config.d.ts +251 -0
  152. package/dist/workspace/config.js +162 -0
  153. package/dist/workspace/config.js.map +1 -0
  154. package/dist/workspace/migrations.d.ts +45 -0
  155. package/dist/workspace/migrations.js +132 -0
  156. package/dist/workspace/migrations.js.map +1 -0
  157. package/dist/workspace/projects-cli.d.ts +23 -0
  158. package/dist/workspace/projects-cli.js +105 -0
  159. package/dist/workspace/projects-cli.js.map +1 -0
  160. package/dist/workspace/projects.d.ts +81 -0
  161. package/dist/workspace/projects.js +214 -0
  162. package/dist/workspace/projects.js.map +1 -0
  163. package/dist/workspace/semaphore.d.ts +77 -0
  164. package/dist/workspace/semaphore.js +57 -0
  165. package/dist/workspace/semaphore.js.map +1 -0
  166. package/dist/workspace/ui-state.d.ts +23 -0
  167. package/dist/workspace/ui-state.js +42 -0
  168. package/dist/workspace/ui-state.js.map +1 -0
  169. package/package.json +3 -2
  170. package/scripts/mock-claude.mjs +136 -2
  171. package/web/dist/assets/arrow-left-CnSdp92h.js +1 -0
  172. package/web/dist/assets/centered-state-NF79blq7.js +43 -0
  173. package/web/dist/assets/{chunk-BO2N2NFS-BN7h-q1E.js → chunk-BO2N2NFS-DtrdTCWa.js} +4 -4
  174. package/web/dist/assets/commit-list-CL8vSWGw.js +1 -0
  175. package/web/dist/assets/compare-variants-mI-MnhuR.js +1 -0
  176. package/web/dist/assets/diff-view-Bhfvnnn9.js +6 -0
  177. package/web/dist/assets/dist-COA_NSud.js +1 -0
  178. package/web/dist/assets/ellipsis-vertical-CNnSLn5a.js +1 -0
  179. package/web/dist/assets/{file-tuE95HNX.js → file-D4GBh1ao.js} +1 -1
  180. package/web/dist/assets/{git-pull-request-BztcgsRZ.js → git-pull-request-DnR8Xh4_.js} +1 -1
  181. package/web/dist/assets/git-toolbar-rVtFyL4t.js +1 -0
  182. package/web/dist/assets/github-_t0ceKcO.js +1 -0
  183. package/web/dist/assets/{highlighted-body-OFNGDK62-CJIHtxqW.js → highlighted-body-OFNGDK62-BuFJwunK.js} +1 -1
  184. package/web/dist/assets/{image-preview-Ca0UgThg.js → image-preview-DEhW0TFz.js} +1 -1
  185. package/web/dist/assets/index-BfXFhAGQ.js +30 -0
  186. package/web/dist/assets/index-Mov2Rrbw.css +2 -0
  187. package/web/dist/assets/lib-DPEZDBUN.js +1 -0
  188. package/web/dist/assets/mermaid-GHXKKRXX-CN2zQue0.js +1 -0
  189. package/web/dist/assets/project-router-CBzGUqvS.js +1 -0
  190. package/web/dist/assets/{refresh-cw-B4NW5q60.js → refresh-cw-BT8E96Tm.js} +1 -1
  191. package/web/dist/assets/repo-git-C3dJiX3j.js +1 -0
  192. package/web/dist/assets/{run-diff-BKpV1kGk.js → run-diff-HEZcHwRr.js} +3 -3
  193. package/web/dist/assets/run-header-DldbROhB.js +1 -0
  194. package/web/dist/assets/{search-x-C6xG26dv.js → search-x-BDjaMrzG.js} +1 -1
  195. package/web/dist/assets/skill-empty-hint-DTUSp6Vl.js +1 -0
  196. package/web/dist/assets/skills-BIg29xLt.js +1 -0
  197. package/web/dist/assets/{square-terminal-D9l_Xx7B.js → square-terminal-Ckjjn0vb.js} +1 -1
  198. package/web/dist/assets/tab-link-DTQ9FBZY.js +1 -0
  199. package/web/dist/assets/task-changes-DRhQVnFN.js +1 -0
  200. package/web/dist/assets/task-commits-5StODPII.js +1 -0
  201. package/web/dist/assets/task-files-BuylxobG.js +2 -0
  202. package/web/dist/assets/task-thread-DnHR0k7k.js +9 -0
  203. package/web/dist/assets/textarea-Bj_LCreg.js +1 -0
  204. package/web/dist/assets/toml-CcmNWLt0.js +1 -0
  205. package/web/dist/assets/{trash-2-De8Z5Y5-.js → trash-2-DAyZ0VSi.js} +1 -1
  206. package/web/dist/assets/{triangle-alert-DJUyRhTV.js → triangle-alert-Uy8rokUh.js} +1 -1
  207. package/web/dist/assets/{upload-yxUM9nk5.js → upload-CDdyPPo_.js} +1 -1
  208. package/web/dist/assets/use-desktop-TyHAXhMR.js +3 -0
  209. package/web/dist/assets/utils-B8s5qIcK.js +1 -0
  210. package/web/dist/assets/workflows-CwDYZLvG.js +11 -0
  211. package/web/dist/assets/zoomable-image-PEDOqyLQ.js +1 -0
  212. package/web/dist/index.html +10 -19
  213. package/web/dist/assets/arrow-left-bEsJ-6jp.js +0 -1
  214. package/web/dist/assets/centered-state-DzJJpXgm.js +0 -43
  215. package/web/dist/assets/command-eBgVGftz.js +0 -1
  216. package/web/dist/assets/compare-variants-DhqGJuHF.js +0 -1
  217. package/web/dist/assets/dialog-Bf1Cpc3n.js +0 -1
  218. package/web/dist/assets/diff-view-Cqc8LRkj.js +0 -4
  219. package/web/dist/assets/dist-M2QYGAcm.js +0 -1
  220. package/web/dist/assets/dist-ZAIqO3UX.js +0 -1
  221. package/web/dist/assets/folder-20ea3OVM.js +0 -1
  222. package/web/dist/assets/git-toolbar-DAlBoSP5.js +0 -1
  223. package/web/dist/assets/github--sfM4X3j.js +0 -1
  224. package/web/dist/assets/highlighter-ZVyRi_Cx.js +0 -3
  225. package/web/dist/assets/index-DlKq8gF4.css +0 -2
  226. package/web/dist/assets/index-h4gyDJyh.js +0 -11
  227. package/web/dist/assets/loader-circle-Bnw4ga19.js +0 -1
  228. package/web/dist/assets/markdown-DxmCMr30.js +0 -1
  229. package/web/dist/assets/mermaid-GHXKKRXX-DghlHZS5.js +0 -1
  230. package/web/dist/assets/prompt-templates-CsGr-FXH.js +0 -15
  231. package/web/dist/assets/repo-git-CHF2oip_.js +0 -1
  232. package/web/dist/assets/run-header-3CGn6FAM.js +0 -1
  233. package/web/dist/assets/skill-detail-DsD4-dGp.js +0 -1
  234. package/web/dist/assets/skill-empty-hint-Cl3ESoPu.js +0 -1
  235. package/web/dist/assets/skills-5kRcjM1J.js +0 -1
  236. package/web/dist/assets/skills-B13iqWAN.js +0 -1
  237. package/web/dist/assets/tab-link-DkVxOa-q.js +0 -1
  238. package/web/dist/assets/task-changes-DtMiVVwO.js +0 -1
  239. package/web/dist/assets/task-commits-VbSLn_tW.js +0 -1
  240. package/web/dist/assets/task-files-qYDBG3Mx.js +0 -2
  241. package/web/dist/assets/task-thread-BfGERKlB.js +0 -7
  242. package/web/dist/assets/tasks-table-C5fwJmZ7.js +0 -1
  243. package/web/dist/assets/use-desktop-6PwFeCW3.js +0 -3
  244. package/web/dist/assets/utils-CzkLr94M.js +0 -1
  245. package/web/dist/assets/workflows-CnTcKlfV.js +0 -11
  246. package/web/dist/assets/x-DaR4ZfE-.js +0 -1
  247. package/web/dist/assets/zoomable-image-B-76XMUw.js +0 -1
@@ -1,43 +0,0 @@
1
- import{a as e,i as t,o as n,r,s as i,u as a}from"./bundle-mjs-BegPhL5c.js";import{t as o}from"./utils-CzkLr94M.js";var s=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(){}},c=new class extends s{#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`}},l={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},u=new class{#e=l;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 d(e){setTimeout(e,0)}var f=typeof window>`u`||`Deno`in globalThis;function p(){}function m(e,t){return typeof e==`function`?e(t):e}function h(e){return typeof e==`number`&&e>=0&&e!==1/0}function g(e,t){return Math.max(e+(t||0)-Date.now(),0)}function _(e,t){return typeof e==`function`?e(t):e}function v(e,t){return typeof e==`function`?e(t):e}function y(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==x(o,t.options))return!1}else if(!C(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 b(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(S(t.options.mutationKey)!==S(a))return!1}else if(!C(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function x(e,t){return(t?.queryKeyHashFn||S)(e)}function S(e){return JSON.stringify(e,(e,t)=>te(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function C(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>C(e[n],t[n])):!1}var w=Object.prototype.hasOwnProperty;function T(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=ee(e)&&ee(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:w.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=T(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function E(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 ee(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function te(e){if(!ne(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ne(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ne(e){return Object.prototype.toString.call(e)===`[object Object]`}function re(e){return new Promise(t=>{u.setTimeout(t,e)})}function ie(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:T(e,t)}function ae(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function oe(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var se=Symbol();function ce(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===se?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function le(e,t){return typeof e==`function`?e(...t):!!e}function ue(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 de=(()=>{let e=()=>f;return{isServer(){return e()},setIsServer(t){e=t}}})();function fe(){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 pe=d;function me(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=pe,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 D=me(),he=new class extends s{#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 ge(e){return Math.min(1e3*2**e,3e4)}function _e(e){return(e??`online`)!==`online`||he.isOnline()}var ve=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function ye(e){let t=!1,n=0,r,i=fe(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new ve(t);p(n),e.onCancel?.(n)}},s=()=>{t=!0},l=()=>{t=!1},u=()=>c.isFocused()&&(e.networkMode===`always`||he.isOnline())&&e.canRun(),d=()=>_e(e.networkMode)&&e.canRun(),f=e=>{a()||(r?.(),i.resolve(e))},p=e=>{a()||(r?.(),i.reject(e))},m=()=>new Promise(t=>{r=e=>{(a()||u())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),h=()=>{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(f).catch(r=>{if(a())return;let i=e.retry??(de.isServer()?0:3),o=e.retryDelay??ge,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){p(r);return}n++,e.onFail?.(n,r),re(s).then(()=>u()?void 0:m()).then(()=>{t?p(r):h()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:l,canStart:d,start:()=>(d()?h():m().then(h),i)}}var be=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),h(this.gcTime)&&(this.#e=u.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(de.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(u.clearTimeout(this.#e),this.#e=void 0)}};function xe(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=>{ue(e,()=>t.signal,()=>n=!0)},u=ce(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?oe:ae;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Ce:Se,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:Se(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 Se(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 Ce(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var we=class extends be{#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=De(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=De(this.options);e.data!==void 0&&(this.setState(Ee(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=ie(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(p).catch(p):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=>v(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===se||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>_(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:!g(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=ce(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`?xe(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=ye({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof ve&&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 ve){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,...Te(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Ee(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),D.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Te(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:_e(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Ee(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function De(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 Oe=class extends s{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=fe(),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),Ae(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return je(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return je(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 v(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&&!E(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Me(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||v(this.options.enabled,this.#t)!==v(t.enabled,this.#t)||_(this.options.staleTime,this.#t)!==_(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||v(this.options.enabled,this.#t)!==v(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 Pe(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(p)),t}#g(){this.#b();let e=_(this.options.staleTime,this.#t);if(de.isServer()||this.#r.isStale||!h(e))return;let t=g(this.#r.dataUpdatedAt,e)+1;this.#d=u.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,!(de.isServer()||v(this.options.enabled,this.#t)===!1||!h(this.#p)||this.#p===0)&&(this.#f=u.setInterval(()=>{(this.options.refetchIntervalInBackground||c.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(u.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(u.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&&Ae(e,t),o=i&&Me(e,n,t,r);(a||o)&&(l={...l,...Te(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=ie(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=ie(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 g=l.fetchStatus===`fetching`,_=m===`pending`,y=m===`error`,b=_&&g,x=d!==void 0,S={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:y,isInitialLoading:b,isLoading:b,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:g,isRefetching:g&&!_,isLoadingError:y&&!x,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:y&&x,isStale:Ne(e,t),refetch:this.refetch,promise:this.#o,isEnabled:v(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=S.data!==void 0,r=S.status===`error`&&!t,i=e=>{r?e.reject(S.error):t&&e.resolve(S.data)},a=()=>{let e=this.#o=S.promise=fe();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||S.data!==o.value)&&a();break;case`rejected`:(!r||S.error!==o.reason)&&a();break}}return S}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),!E(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){D.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function ke(e,t){return v(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&v(t.retryOnMount,e)===!1)}function Ae(e,t){return ke(e,t)||e.state.data!==void 0&&je(e,t,t.refetchOnMount)}function je(e,t,n){if(v(t.enabled,e)!==!1&&_(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Ne(e,t)}return!1}function Me(e,t,n,r){return(e!==t||v(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Ne(e,n)}function Ne(e,t){return v(t.enabled,e)!==!1&&e.isStaleByTime(_(t.staleTime,e))}function Pe(e,t){return!E(e.getCurrentResult(),t)}var Fe=class extends be{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Ie(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=ye({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),D.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ie(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Le=class extends s{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),E(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&S(t.mutationKey)!==S(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Ie();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){D.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},O=a(i(),1),k=e(),Re=O.createContext(void 0),ze=e=>{let t=O.useContext(Re);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Be=({client:e,children:t})=>(O.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,k.jsx)(Re.Provider,{value:e,children:t})),Ve=O.createContext(!1),He=()=>O.useContext(Ve);Ve.Provider;function Ue(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var We=O.createContext(Ue()),Ge=()=>O.useContext(We),Ke=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?le(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},qe=e=>{O.useEffect(()=>{e.clearReset()},[e])},Je=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||le(n,[e.error,r])),Ye=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))}},Xe=(e,t)=>e.isLoading&&e.isFetching&&!t,Ze=(e,t)=>e?.suspense&&t.isPending,Qe=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function $e(e,t,n){let r=He(),i=Ge(),a=ze(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,Ye(o),Ke(o,i,s),qe(i);let l=!a.getQueryCache().get(o.queryHash),[u]=O.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(O.useSyncExternalStore(O.useCallback(e=>{let t=f?u.subscribe(D.batchCalls(e)):p;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),O.useEffect(()=>{u.setOptions(o)},[o,u]),Ze(o,d))throw Qe(o,u,i);if(Je({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&&!de.isServer()&&Xe(d,r)&&(l?Qe(o,u,i):s?.promise)?.catch(p).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function A(e,t){return $e(e,Oe,t)}function et(e,t){let n=ze(t),[r]=O.useState(()=>new Le(n,e));O.useEffect(()=>{r.setOptions(e)},[r,e]);let i=O.useSyncExternalStore(O.useCallback(e=>r.subscribe(D.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=O.useCallback((e,t)=>{r.mutate(e,t).catch(p)},[r]);if(i.error&&le(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var tt=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,nt=/^[\\/]{2}/;function rt(e,t){return t+e.replace(/\\/g,`/`)}var it=`popstate`;function at(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function ot(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return lt(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:N(t)}return ut(t,n,null,e)}function j(e,t){if(e===!1||e==null)throw Error(t)}function M(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function st(){return Math.random().toString(36).substring(2,10)}function ct(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function lt(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?P(t):t,state:n,key:t&&t.key||r||st(),mask:i}}function N({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function P(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function ut(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=at(e)?e:lt(h.location,e,t);n&&n(r,e),l=u()+1;let d=ct(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=at(e)?e:lt(h.location,e,t);n&&n(r,e),l=u();let i=ct(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return dt(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(it,d),c=e,()=>{i.removeEventListener(it,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function dt(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),j(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:N(t);return i=i.replace(/ $/,`%20`),!n&&nt.test(i)&&(i=r+i),new URL(i,r)}function ft(e,t,n=`/`){return pt(e,t,n,!1)}function pt(e,t,n,r,i){let a=F((typeof t==`string`?P(t):t).pathname||`/`,n);if(a==null)return null;let o=i??ht(e),s=null,c=Mt(a);for(let e=0;s==null&&e<o.length;++e)s=Ot(o[e],c,r);return s}function mt(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function ht(e){let t=gt(e);return vt(t),t}function gt(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;j(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=I([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(j(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),gt(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:Et(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=jt(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of _t(e.path))a(e,t,!0,n)}),t}function _t(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=_t(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function vt(e){e.sort((e,t)=>e.score===t.score?Dt(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var yt=/^:[\w-]+$/,bt=3,xt=2,St=1,Ct=10,wt=-2,Tt=e=>e===`*`;function Et(e,t){let n=e.split(`/`),r=n.length;return n.some(Tt)&&(r+=wt),t&&(r+=xt),n.filter(e=>!Tt(e)).reduce((e,t)=>e+(yt.test(t)?bt:t===``?St:Ct),r)}function Dt(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function Ot(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?At(u,l,s.matcher,s.compiledParams):kt(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=kt({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:I([a,d.pathname]),pathnameBase:Vt(I([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=I([a,d.pathnameBase]))}return o}function kt(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=jt(e.path,e.caseSensitive,e.end);return At(e,t,n,r)}function At(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function jt(e,t=!1,n=!0){M(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function Mt(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return M(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function F(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function Nt(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?P(e):e,a;return n?(n=zt(n),a=n.startsWith(`/`)?Pt(n.substring(1),`/`):Pt(n,t)):a=t,{pathname:a,search:Ht(r),hash:Ut(i)}}function Pt(e,t){let n=Bt(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function Ft(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function It(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Lt(e){let t=It(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Rt(e,t,n,r=!1){let i;typeof e==`string`?i=P(e):(i={...e},j(!i.pathname||!i.pathname.includes(`?`),Ft(`?`,`pathname`,`search`,i)),j(!i.pathname||!i.pathname.includes(`#`),Ft(`#`,`pathname`,`hash`,i)),j(!i.search||!i.search.includes(`#`),Ft(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=Nt(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var zt=e=>e.replace(/[\\/]{2,}/g,`/`),I=e=>zt(e.join(`/`)),Bt=e=>e.replace(/\/+$/,``),Vt=e=>Bt(e).replace(/^\/*/,`/`),Ht=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Ut=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Wt=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Gt(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Kt(e){return I(e.map(e=>e.route.path).filter(Boolean))||`/`}var qt=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Jt(e,t){let n=e;if(typeof n!=`string`||!tt.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(qt)try{let e=new URL(window.location.href),r=nt.test(n)?new URL(rt(n,e.protocol)):new URL(n),a=F(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{M(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Yt=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Yt);var Xt=[`GET`,...Yt];new Set(Xt);var Zt=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Qt(e){try{return Zt.includes(new URL(e).protocol)}catch{return!1}}var L=O.createContext(null);L.displayName=`DataRouter`;var $t=O.createContext(null);$t.displayName=`DataRouterState`;var en=O.createContext(!1);function tn(){return O.useContext(en)}var nn=O.createContext({isTransitioning:!1});nn.displayName=`ViewTransition`;var rn=O.createContext(new Map);rn.displayName=`Fetchers`;var an=O.createContext(null);an.displayName=`Await`;var R=O.createContext(null);R.displayName=`Navigation`;var on=O.createContext(null);on.displayName=`Location`;var z=O.createContext({outlet:null,matches:[],isDataRoute:!1});z.displayName=`Route`;var sn=O.createContext(null);sn.displayName=`RouteError`;var cn=`REACT_ROUTER_ERROR`,ln=`REDIRECT`,un=`ROUTE_ERROR_RESPONSE`;function dn(e){if(e.startsWith(`${cn}:${ln}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function fn(e){if(e.startsWith(`${cn}:${un}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Wt(t.status,t.statusText,t.data)}catch{}}function pn(e,{relative:t}={}){j(B(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=O.useContext(R),{hash:i,pathname:a,search:o}=H(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:I([n,a])),r.createHref({pathname:s,search:o,hash:i})}function B(){return O.useContext(on)!=null}function V(){return j(B(),`useLocation() may be used only in the context of a <Router> component.`),O.useContext(on).location}function mn(e){j(B(),`useMatch() may be used only in the context of a <Router> component.`);let{pathname:t}=V();return O.useMemo(()=>kt(e,Mt(t)),[t,e])}var hn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function gn(e){O.useContext(R).static||O.useLayoutEffect(e)}function _n(){let{isDataRoute:e}=O.useContext(z);return e?Rn():vn()}function vn(){j(B(),`useNavigate() may be used only in the context of a <Router> component.`);let e=O.useContext(L),{basename:t,navigator:n}=O.useContext(R),{matches:r}=O.useContext(z),{pathname:i}=V(),a=JSON.stringify(Lt(r)),o=O.useRef(!1);return gn(()=>{o.current=!0}),O.useCallback((r,s={})=>{if(M(o.current,hn),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Rt(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:I([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}O.createContext(null);function yn(){let{matches:e}=O.useContext(z);return e[e.length-1]?.params??{}}function H(e,{relative:t}={}){let{matches:n}=O.useContext(z),{pathname:r}=V(),i=JSON.stringify(Lt(n));return O.useMemo(()=>Rt(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function bn(e,t){return xn(e,t)}function xn(e,t,n){j(B(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=O.useContext(R),{matches:i}=O.useContext(z),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;Bn(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
2
-
3
- Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=V(),d;if(t){let e=typeof t==`string`?P(t):t;j(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):ft(e,{pathname:p});M(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),M(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=On(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:I([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:I([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?O.createElement(on.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function Sn(){let e=Ln(),t=Gt(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=O.createElement(O.Fragment,null,O.createElement(`p`,null,`💿 Hey developer 👋`),O.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,O.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,O.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),O.createElement(O.Fragment,null,O.createElement(`h2`,null,`Unexpected Application Error!`),O.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?O.createElement(`pre`,{style:i},n):null,o)}var Cn=O.createElement(Sn,null),wn=class extends O.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=fn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:O.createElement(z.Provider,{value:this.props.routeContext},O.createElement(sn.Provider,{value:e,children:this.props.component}));return this.context?O.createElement(En,{error:e},t):t}};wn.contextType=en;var Tn=new WeakMap;function En({children:e,error:t}){let{basename:n}=O.useContext(R);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=dn(t.digest);if(e){let r=Tn.get(t);if(r)throw r;let i=Jt(e.location,n),a=i.absoluteURL||i.to;if(Qt(a))throw Error(`Invalid redirect location`);if(qt&&!Tn.get(t))if(i.isExternal||e.reloadDocument)window.location.href=a;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw Tn.set(t,n),n}return O.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function Dn({routeContext:e,match:t,children:n}){let r=O.useContext(L);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),O.createElement(z.Provider,{value:e},n)}function On(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);j(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:Kt(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||Cn,o&&(s<0&&c===0?(Bn(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?O.createElement(n.route.Component,null):n.route.element?n.route.element:e,O.createElement(Dn,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?O.createElement(wn,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function kn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function An(e){let t=O.useContext(L);return j(t,kn(e)),t}function jn(e){let t=O.useContext($t);return j(t,kn(e)),t}function Mn(e){let t=O.useContext(z);return j(t,kn(e)),t}function Nn(e){let t=Mn(e),n=t.matches[t.matches.length-1];return j(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Pn(){return Nn(`useRouteId`)}function Fn(){let e=jn(`useNavigation`);return O.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function In(){let{matches:e,loaderData:t}=jn(`useMatches`);return O.useMemo(()=>e.map(e=>mt(e,t)),[e,t])}function Ln(){let e=O.useContext(sn),t=jn(`useRouteError`),n=Nn(`useRouteError`);return e===void 0?t.errors?.[n]:e}function Rn(){let{router:e}=An(`useNavigate`),t=Nn(`useNavigate`),n=O.useRef(!1);return gn(()=>{n.current=!0}),O.useCallback(async(r,i={})=>{M(n.current,hn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var zn={};function Bn(e,t,n){!t&&!zn[e]&&(zn[e]=!0,M(!1,n))}O.memo(Vn);function Vn({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return xn(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function Hn({to:e,replace:t,state:n,relative:r}){j(B(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=O.useContext(R);M(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=O.useContext(z),{pathname:o}=V(),s=_n(),c=Rt(e,Lt(a),o,r===`path`),l=JSON.stringify(c);return O.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function Un(e){j(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function Wn({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){j(!B(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=O.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=P(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=O.useMemo(()=>{let e=F(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return M(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:O.createElement(R.Provider,{value:c},O.createElement(on.Provider,{children:t,value:h}))}function Gn({children:e,location:t}){return bn(Kn(e),t)}O.Component;function Kn(e,t=[]){let n=[];return O.Children.forEach(e,(e,r)=>{if(!O.isValidElement(e))return;let i=[...t,r];if(e.type===O.Fragment){n.push.apply(n,Kn(e.props.children,i));return}j(e.type===Un,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),j(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=Kn(e.props.children,i)),n.push(a)}),n}var qn=`get`,Jn=`application/x-www-form-urlencoded`;function Yn(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Xn(e){return Yn(e)&&e.tagName.toLowerCase()===`button`}function Zn(e){return Yn(e)&&e.tagName.toLowerCase()===`form`}function Qn(e){return Yn(e)&&e.tagName.toLowerCase()===`input`}function $n(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function er(e,t){return e.button===0&&(!t||t===`_self`)&&!$n(e)}function tr(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function nr(e,t){let n=tr(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var rr=null;function ir(){if(rr===null)try{new FormData(document.createElement(`form`),0),rr=!1}catch{rr=!0}return rr}var ar=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function or(e){return e!=null&&!ar.has(e)?(M(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Jn}"`),null):e}function sr(e,t){let n,r,i,a,o;if(Zn(e)){let o=e.getAttribute(`action`);r=o?F(o,t):null,n=e.getAttribute(`method`)||qn,i=or(e.getAttribute(`enctype`))||Jn,a=new FormData(e)}else if(Xn(e)||Qn(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?F(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||qn,i=or(e.getAttribute(`formenctype`))||or(o.getAttribute(`enctype`))||Jn,a=new FormData(o,e),!ir()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Yn(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=qn,r=null,i=Jn,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var cr={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},lr=/[&><\u2028\u2029]/g;function ur(e){return e.replace(lr,e=>cr[e])}function dr(e,t){if(e===!1||e==null)throw Error(t)}function fr(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&F(i.pathname,t)===`/`?i.pathname=`${Bt(t)}/_root.${r}`:i.pathname=`${Bt(i.pathname)}.${r}`,i}async function pr(e,n){if(e.id in n)return n[e.id];try{let r=await t(()=>import(e.module),[]);return n[e.id]=r,r}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function mr(e){return e!=null&&typeof e.page==`string`}function hr(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function gr(e,t,n){return xr((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await pr(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(hr).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function _r(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function vr(e,t,{includeHydrateFallback:n}={}){return yr(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function yr(e){return[...new Set(e)]}function br(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function xr(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!mr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(br(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Sr(){let e=O.useContext(L);return dr(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Cr(){let e=O.useContext($t);return dr(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var wr=O.createContext(void 0);wr.displayName=`FrameworkContext`;function Tr(){let e=O.useContext(wr);return dr(e,`You must render this element inside a <HydratedRouter> element`),e}function Er(e,t){let n=O.useContext(wr),[r,i]=O.useState(!1),[a,o]=O.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=O.useRef(null);O.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),O.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:Dr(s,p),onBlur:Dr(c,m),onMouseEnter:Dr(l,p),onMouseLeave:Dr(u,m),onTouchStart:Dr(d,p)}]:[a,f,{}]:[!1,f,{}]}function Dr(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Or({page:e,...t}){let n=tn(),{nonce:r}=Tr(),{router:i}=Sr(),a=O.useMemo(()=>ft(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?O.createElement(Ar,{page:e,matches:a,...t}):O.createElement(jr,{page:e,matches:a,...t})):null}function kr(e){let{manifest:t,routeModules:n}=Tr(),[r,i]=O.useState([]);return O.useEffect(()=>{let r=!1;return gr(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Ar({page:e,matches:t,...n}){let r=V(),{future:i}=Tr(),{basename:a}=Sr(),o=O.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=fr(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return O.createElement(O.Fragment,null,o.map(e=>O.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function jr({page:e,matches:t,...n}){let r=V(),{future:i,manifest:a,routeModules:o}=Tr(),{basename:s}=Sr(),{loaderData:c,matches:l}=Cr(),u=O.useMemo(()=>_r(e,t,l,a,r,`data`),[e,t,l,a,r]),d=O.useMemo(()=>_r(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=O.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=fr(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=O.useMemo(()=>vr(d,a),[d,a]),m=kr(d);return O.createElement(O.Fragment,null,f.map(e=>O.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>O.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>O.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Mr(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}O.Component;var Nr=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Nr&&(window.__reactRouterVersion=`7.18.1`)}catch{}function Pr({basename:e,children:t,useTransitions:n,window:r}){let i=O.useRef();i.current??=ot({window:r,v5Compat:!0});let a=i.current,[o,s]=O.useState({action:a.action,location:a.location}),c=O.useCallback(e=>{n===!1?s(e):O.startTransition(()=>s(e))},[n]);return O.useLayoutEffect(()=>a.listen(c),[a,c]),O.createElement(Wn,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}function Fr({basename:e,children:t,history:n,useTransitions:r}){let[i,a]=O.useState({action:n.action,location:n.location}),o=O.useCallback(e=>{r===!1?a(e):O.startTransition(()=>a(e))},[r]);return O.useLayoutEffect(()=>n.listen(o),[n,o]),O.createElement(Wn,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,useTransitions:r})}Fr.displayName=`unstable_HistoryRouter`;var Ir=O.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=O.useContext(R),v=typeof l==`string`&&tt.test(l),y=Jt(l,h);l=y.to;let b=pn(l,{relative:r}),x=V(),S=null;if(o){let e=Rt(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:I([h,e.pathname])),S=g.createHref(e)}let[C,w,T]=Er(n,p),E=Ur(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function ee(t){e&&e(t),t.defaultPrevented||E(t)}let te=!(y.isExternal||i),ne=O.createElement(`a`,{...p,...T,href:(te?S:void 0)||y.absoluteURL||b,onClick:te?ee:e,ref:Mr(m,w),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return C&&!v?O.createElement(O.Fragment,null,ne,O.createElement(Or,{page:b})):ne});Ir.displayName=`Link`;var Lr=O.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=H(a,{relative:c.relative}),d=V(),f=O.useContext($t),{navigator:p,basename:m}=O.useContext(R),h=f!=null&&ei(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=F(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,w;w=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(S):i;return O.createElement(Ir,{...c,"aria-current":C,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(S):s)});Lr.displayName=`NavLink`;var Rr=O.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=qn,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=O.useContext(R),g=qr(),_=Jr(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&tt.test(s);return O.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?O.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});Rr.displayName=`Form`;function zr({getKey:e,storageKey:t,...n}){let r=O.useContext(wr),{basename:i}=O.useContext(R),a=V(),o=In();Qr({getKey:e,storageKey:t});let s=O.useMemo(()=>{if(!r||!e)return null;let t=Zr(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return n.nonce==null&&r?.nonce&&(n.nonce=r.nonce),O.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${ur(JSON.stringify(t||Yr))}, ${ur(JSON.stringify(s))})`}})}zr.displayName=`ScrollRestoration`;function Br(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Vr(e){let t=O.useContext(L);return j(t,Br(e)),t}function Hr(e){let t=O.useContext($t);return j(t,Br(e)),t}function Ur(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=_n(),d=V(),f=H(e,{relative:o});return O.useCallback(p=>{if(er(p,t)){p.preventDefault();let t=n===void 0?N(d)===N(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?O.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function Wr(e){M(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=O.useRef(tr(e)),n=O.useRef(!1),r=V(),i=O.useMemo(()=>nr(r.search,n.current?null:t.current),[r.search]),a=_n();return[i,O.useCallback((e,t)=>{let r=tr(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var Gr=0,Kr=()=>`__${String(++Gr)}__`;function qr(){let{router:e}=Vr(`useSubmit`),{basename:t}=O.useContext(R),n=Pn(),r=e.fetch,i=e.navigate;return O.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=sr(e,t);if(a.navigate===!1){let e=a.fetcherKey||Kr();await r(e,n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function Jr(e,{relative:t}={}){let{basename:n}=O.useContext(R),r=O.useContext(z);j(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...H(e||`.`,{relative:t})},o=V();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:I([n,a.pathname])),N(a)}var Yr=`react-router-scroll-positions`,Xr={};function Zr(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:F(e.pathname,n)||e.pathname},t)),i??=e.key,i}function Qr({getKey:e,storageKey:t}={}){let{router:n}=Vr(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=Hr(`useScrollRestoration`),{basename:a}=O.useContext(R),o=V(),s=In(),c=Fn();O.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),$r(O.useCallback(()=>{if(c.state===`idle`){let t=Zr(o,s,a,e);Xr[t]=window.scrollY}try{sessionStorage.setItem(t||Yr,JSON.stringify(Xr))}catch(e){M(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(O.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Yr);e&&(Xr=JSON.parse(e))}catch{}},[t]),O.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Xr,()=>window.scrollY,e?(t,n)=>Zr(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),O.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{M(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function $r(e,t){let{capture:n}=t||{};O.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function ei(e,{relative:t}={}){let n=O.useContext(nn);j(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Vr(`useViewTransitionState`),i=H(e,{relative:t});if(!n.isTransitioning)return!1;let a=F(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=F(n.nextLocation.pathname,r)||n.nextLocation.pathname;return kt(i.pathname,o)!=null||kt(i.pathname,a)!=null}var ti=class extends Error{status;manual;command;exists;constructor(e,t,n={}){super(t,n.cause===void 0?void 0:{cause:n.cause}),this.name=`ApiError`,this.status=e,this.manual=n.manual,this.command=n.command,this.exists=n.exists}};function ni(e){try{return JSON.parse(e)}catch{return}}function ri(e){return typeof e==`string`?e:void 0}function ii(e,t,n){let r=ni(n),i=r&&typeof r==`object`?r:{};return new ti(e,ri(i.error)??`${e} ${t||`request failed`}`.trim(),{manual:ri(i.manual),command:ri(i.command),exists:typeof i.exists==`boolean`?i.exists:void 0})}async function ai(e,t){try{return await fetch(e,t)}catch(t){throw t instanceof DOMException&&t.name===`AbortError`?t:new ti(0,`cannot reach the cezar server (${e})`,{cause:t})}}async function oi(e,t={}){let n=await ai(e,t),r=await n.text();if(!n.ok)throw ii(n.status,n.statusText,r);let i=ni(r);if(i===void 0)throw new ti(n.status,`the cezar server answered ${e} with a non-JSON body`);return i}async function si(e,t={}){let n=await ai(e,t),r=await n.text();if(!n.ok)throw ii(n.status,n.statusText,r);return r}function U(e,t={}){return oi(e,{method:`GET`,signal:t.signal})}function W(e,t,n){return oi(t,{method:e,...n===void 0?{}:{headers:{"content-type":`application/json`},body:JSON.stringify(n)}})}var G=(e,t=``)=>`/api/runs/${encodeURIComponent(e)}${t}`;function ci(e){return U(`/api/health`,e)}function li(e){return U(`/api/launch-key`,e)}function ui(e){return U(`/api/runs`,e)}function di(e,t){return U(G(e),t)}function fi(e){return U(`/api/ui-state`,e)}function pi(e){return U(`/api/workflows`,e)}function mi(e){return U(`/api/skills`,e)}function hi(){return W(`POST`,`/api/skills/refresh`)}function gi(e){return U(`/api/todos`,e)}function _i(e){return U(`/api/repo`,e)}function vi(e){return U(`/api/config`,e)}function yi(e){return U(`/api/repo/changes`,e)}function bi(e,t){return U(`/api/repo/commit/${encodeURIComponent(e)}?structured=1`,t)}function xi(e,t){return U(G(e,`/commits`),t)}function Si(e,t,n){return U(G(e,`/commit/${encodeURIComponent(t)}`),n)}function Ci(e={},t){let n=new URLSearchParams;e.limit!==void 0&&n.set(`limit`,String(e.limit)),e.refresh&&n.set(`refresh`,`1`);let r=n.toString();return U(`/api/github${r?`?${r}`:``}`,t)}function wi(e,t,n){return U(`/api/github/comments/${e}/${t}`,n)}function Ti(e,t){return si(G(e,`/diff`),{method:`GET`,signal:t?.signal})}function Ei(e,t){return si(G(e,`/handoff`),{method:`GET`,signal:t?.signal})}function Di(e,t){return U(G(e,`/changes`),t)}function Oi(e,t,n){return U(G(e,`/files?path=${encodeURIComponent(t)}`),n)}function ki(e,t){return G(e,`/files?path=${encodeURIComponent(t)}&raw=1`)}function Ai(e,t){return U(`/api/groups/${encodeURIComponent(e)}`,t)}function ji(e){return W(`POST`,`/api/runs`,e)}function Mi(e){return W(`POST`,G(e,`/cancel`))}function Ni(e,t=!0){return W(`POST`,G(e,`/archive`),{archived:t})}function Pi(){return W(`POST`,`/api/runs/archive-finished`)}function Fi(e){return W(`POST`,G(e,`/finish`))}function Ii(e,t){return W(`POST`,G(e,`/continue`),t===void 0?{}:{text:t})}function Li(e){return W(`POST`,G(e,`/pr`))}function Ri(e,t){return W(`PATCH`,G(e),t)}function zi(e){return W(`DELETE`,G(e))}function Bi(e){return W(`DELETE`,`/api/todos/${encodeURIComponent(e)}`)}function Vi(e,t){return W(`POST`,`/api/todos/${encodeURIComponent(e)}/start`,t?{prompt:t}:void 0)}function Hi(e,t){return W(`POST`,`/api/groups/${encodeURIComponent(e)}/pick`,{runId:t})}function Ui(e){return W(`POST`,G(e,`/open-in-cli`))}function Wi(e){return U(`/api/open-targets`,e)}function Gi(e,t){return W(`POST`,G(e,`/open-in`),{target:t})}function Ki(e,t){return W(`POST`,G(e,`/open-in`),{target:`default`,path:t})}function qi(e,t){return W(`POST`,G(e,`/git/commit`),{message:t})}function Ji(e){return W(`POST`,G(e,`/git/push`))}function Yi(e,t){return W(`POST`,G(e,`/messages`),{text:t.text??``,images:t.images??[]})}function Xi(e){return W(`POST`,`/api/repo/branch`,e)}function Zi(e){return W(`POST`,`/api/plan`,{task:e})}function Qi(e){return W(`POST`,`/api/workflows`,e)}function $i(e){return W(`POST`,`/api/workflows/parse`,{yaml:e})}function ea(e){return W(`DELETE`,`/api/workflows/${encodeURIComponent(e)}`)}function ta(e){return W(`PUT`,`/api/ui-state`,e)}function na(e){return W(`PUT`,`/api/config`,e)}function ra(e){return U(`/api/worktrees`,e)}function ia(){return W(`POST`,`/api/worktrees/reclaim`,{})}function aa(e){return W(`POST`,G(e,`/remove-worktree`))}var K={health:[`health`],runs:{all:[`runs`],list:()=>[`runs`,`list`],detail:e=>[`runs`,`detail`,e],diff:e=>[`runs`,`diff`,e],changes:e=>[`runs`,`changes`,e],file:(e,t)=>[`runs`,`files`,e,t],handoff:e=>[`runs`,`handoff`,e],commits:e=>[`runs`,`commits`,e],commit:(e,t)=>[`runs`,`commit`,e,t]},groups:{detail:e=>[`groups`,e]},todos:[`todos`],workflows:[`workflows`],skills:[`skills`],launchKey:[`launch-key`],repo:[`repo`],repoChanges:[`repo`,`changes`],repoCommit:e=>[`repo`,`commit`,e],uiState:[`ui-state`],config:[`config`],worktrees:[`worktrees`],github:(e={})=>[`github`,e.limit??null],githubComments:(e,t)=>[`github`,`comments`,e,t],openTargets:[`open-targets`]};function oa(){return A({queryKey:K.health,queryFn:({signal:e})=>ci({signal:e}),refetchInterval:5e3})}function sa(){return A({queryKey:K.openTargets,queryFn:({signal:e})=>Wi({signal:e}),staleTime:5*6e4})}function ca(){return A({queryKey:K.runs.list(),queryFn:({signal:e})=>ui({signal:e})})}function la(e){return A({queryKey:K.runs.detail(e??``),queryFn:({signal:t})=>di(e,{signal:t}),enabled:!!e})}function ua(e){return A({queryKey:K.runs.diff(e??``),queryFn:({signal:t})=>Ti(e,{signal:t}),enabled:!!e})}function da(e,t=!1){return A({queryKey:K.runs.changes(e??``),queryFn:({signal:t})=>Di(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:t?4e3:!1,refetchOnWindowFocus:!0,staleTime:0})}function fa(e,t){return A({queryKey:K.runs.file(e??``,t??``),queryFn:({signal:n})=>Oi(e,t,{signal:n}),enabled:!!e&&t!==void 0,retry:!1})}function pa(e){return A({queryKey:K.groups.detail(e??``),queryFn:({signal:t})=>Ai(e,{signal:t}),enabled:!!e})}function ma(e,t=!1){return A({queryKey:K.runs.commits(e??``),queryFn:({signal:t})=>xi(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:t?5e3:!1})}function ha(e,t){return A({queryKey:K.runs.commit(e??``,t??``),queryFn:({signal:n})=>Si(e,t,{signal:n}),enabled:!!e&&!!t,retry:!1})}function ga(e,t=!0){return A({queryKey:K.runs.handoff(e??``),queryFn:({signal:t})=>Ei(e,{signal:t}),enabled:!!e&&t})}function _a(e=!0){return A({queryKey:K.todos,queryFn:({signal:e})=>gi({signal:e}),enabled:e})}function va(){return A({queryKey:K.workflows,queryFn:({signal:e})=>pi({signal:e})})}function ya(e=!0){return A({queryKey:K.skills,queryFn:({signal:e})=>mi({signal:e}),enabled:e})}function ba(){return A({queryKey:K.launchKey,queryFn:({signal:e})=>li({signal:e}),staleTime:1/0})}function xa(){return A({queryKey:K.repo,queryFn:({signal:e})=>_i({signal:e})})}function Sa(){return A({queryKey:K.repoChanges,queryFn:({signal:e})=>yi({signal:e}),retry:!1})}function Ca(e){return A({queryKey:K.repoCommit(e??``),queryFn:({signal:t})=>bi(e,{signal:t}),enabled:!!e,retry:!1})}function wa(){return A({queryKey:K.config,queryFn:({signal:e})=>vi({signal:e})})}function Ta(){return A({queryKey:K.worktrees,queryFn:({signal:e})=>ra({signal:e})})}function Ea(){return A({queryKey:K.uiState,queryFn:({signal:e})=>fi({signal:e})})}function Da(e){let t=ze();return et({mutationFn:t=>Ri(e,t),onSuccess:()=>t.invalidateQueries({queryKey:K.runs.all})})}function Oa(e){let t=ze();return et({mutationFn:t=>Yi(e,t),onSuccess:()=>t.invalidateQueries({queryKey:K.runs.all})})}function ka(e={},t=!0){return A({queryKey:K.github(e),queryFn:({signal:t})=>Ci({limit:e.limit},{signal:t}),enabled:t})}function Aa(e,t,n=!0){return A({queryKey:K.githubComments(e,t),queryFn:({signal:n})=>wi(e,t,{signal:n}),enabled:n,staleTime:6e4})}var ja=a(n(),1),Ma=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Na=r,Pa=(e,t)=>n=>{if(t?.variants==null)return Na(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Ma(t)||Ma(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Na(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)};function Fa(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Ia(...e){return t=>{let n=!1,r=e.map(e=>{let r=Fa(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Fa(e[t],null)}}}}function La(...e){return O.useCallback(Ia(...e),e)}function Ra(e){let t=O.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];Ka(r)&&typeof Xa==`function`&&(r=Xa(r._payload)),O.Children.forEach(r,e=>{if(Wa(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;Ka(n)&&typeof Xa==`function`&&(n=Xa(n._payload)),a=Va(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=O.cloneElement(a,void 0,s):!o&&O.Children.count(r)===1&&O.isValidElement(r)&&(a=r);let c=a?Ua(a):void 0,l=La(n,c);if(!a){if(r||r===0)throw Error(o?Ya(e):Ja(e));return r}let u=Ha(i,a.props??{});return a.type!==O.Fragment&&(u.ref=n?l:c),O.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var za=Ra(`Slot`),Ba=Symbol.for(`radix.slottable`),Va=(e,t)=>{if(`child`in e.props){let t=e.props.child;return O.isValidElement(t)?O.cloneElement(t,void 0,e.props.children(t.props.children)):null}return O.isValidElement(t)?t:null};function Ha(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Ua(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Wa(e){return O.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Ba}var Ga=Symbol.for(`react.lazy`);function Ka(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Ga&&`_payload`in e&&qa(e._payload)}function qa(e){return typeof e==`object`&&!!e&&`then`in e}var Ja=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,Ya=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Xa=O.use,Za=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Ra(`Primitive.${t}`),r=O.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,k.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Qa(e,t){e&&ja.flushSync(()=>e.dispatchEvent(t))}function $a(e,t=[]){let n=[];function r(t,r){let i=O.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=O.useMemo(()=>o,Object.values(o));return(0,k.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=O.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>O.createContext(e));return function(n){let r=n?.[e]||t;return O.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,eo(i,...t)]}function eo(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return O.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}typeof window<`u`&&window.document&&window.document.createElement;function to(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)}}var q=globalThis?.document?O.useLayoutEffect:()=>{},no=O.useInsertionEffect||q;function ro({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=io({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=O.useRef(e!==void 0);O.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,O.useCallback(t=>{if(s){let n=ao(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function io({defaultProp:e,onChange:t}){let[n,r]=O.useState(e),i=O.useRef(n),a=O.useRef(t);return no(()=>{a.current=t},[t]),O.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function ao(e){return typeof e==`function`}function oo(e,t){return O.useReducer((e,n)=>t[e][n]??e,e)}var so=e=>{let{present:t,children:n}=e,r=co(t),i=typeof n==`function`?n({present:r.isPresent}):O.Children.only(n),a=uo(r.ref,po(i));return typeof n==`function`||r.isPresent?O.cloneElement(i,{ref:a}):null};so.displayName=`Presence`;function co(e){let[t,n]=O.useState(),r=O.useRef(null),i=O.useRef(e),a=O.useRef(`none`),o=O.useRef(void 0),[s,c]=oo(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return O.useEffect(()=>{s===`mounted`?(a.current=o.current??fo(r.current),o.current=void 0):a.current=`none`},[s]),q(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=fo(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),q(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=fo(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},s=e=>{e.target===t&&(a.current=fo(r.current))};return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:O.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=fo(t)}else r.current=null;n(e)},[])}}function lo(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function uo(...e){let t=O.useRef(e);return t.current=e,O.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=lo(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():lo(n[e],null)}}},[])}function fo(e){return e?.animationName||`none`}function po(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var mo=O.useId||(()=>void 0),ho=0;function go(e){let[t,n]=O.useState(mo());return q(()=>{e||n(e=>e??String(ho++))},[e]),e||(t?`radix-${t}`:``)}function J(e){let t=O.useRef(e);return O.useEffect(()=>{t.current=e}),O.useMemo(()=>((...e)=>t.current?.(...e)),[])}var _o=`DismissableLayer`,vo=`dismissableLayer.update`,yo=`dismissableLayer.pointerDownOutside`,bo=`dismissableLayer.focusOutside`,xo,So=O.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Co=O.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=O.useContext(So),[d,f]=O.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=O.useState({}),h=La(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=O.useRef(!1),C=Oo(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:O.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),w=ko(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=J(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return O.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T,E]),O.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(xo=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Ao(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=xo))}},[d,p,n,u]),O.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Ao())},[d,u]),O.useEffect(()=>{let e=()=>m({});return document.addEventListener(vo,e),()=>document.removeEventListener(vo,e)},[]),(0,k.jsx)(Za.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:to(e.onFocusCapture,w.onFocusCapture),onBlurCapture:to(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:to(e.onPointerDownCapture,C.onPointerDownCapture)})});Co.displayName=_o;var wo=`DismissableLayerBranch`,To=O.forwardRef((e,t)=>{let n=O.useContext(So),r=O.useRef(null),i=La(t,r);return O.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,k.jsx)(Za.div,{...e,ref:i})});To.displayName=wo;function Eo(){let e=O.useContext(So),[t,n]=O.useState(null);return O.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}var Do=()=>!0;function Oo(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=Do}=t,s=J(e),c=O.useRef(!1),l=O.useRef(!1),u=O.useRef(new Map),d=O.useRef(()=>{});return O.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}function t(){return Array.from(u.current.values()).some(Boolean)}function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}function p(e){l.current&&u.current.set(e.type,!1)}let m=a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||jo(yo,s,p,{discrete:!0})};if(!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:()=>c.current=!0}}function ko(e,t=globalThis?.document){let n=J(e),r=O.useRef(!1);return O.useEffect(()=>{let e=e=>{e.target&&!r.current&&jo(bo,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Ao(){let e=new CustomEvent(vo);document.dispatchEvent(e)}function jo(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Qa(i,a):i.dispatchEvent(a)}var Mo=`focusScope.autoFocusOnMount`,No=`focusScope.autoFocusOnUnmount`,Po={bubbles:!1,cancelable:!0},Fo=`FocusScope`,Io=O.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=O.useState(null),l=J(i),u=J(a),d=O.useRef(null),f=La(t,c),p=O.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;O.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:Y(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Y(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Y(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),O.useEffect(()=>{if(s){Uo.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Mo,Po);s.addEventListener(Mo,l),s.dispatchEvent(t),t.defaultPrevented||(Lo(Ko(zo(s)),{select:!0}),document.activeElement===e&&Y(s))}return()=>{s.removeEventListener(Mo,l),setTimeout(()=>{let t=new CustomEvent(No,Po);s.addEventListener(No,u),s.dispatchEvent(t),t.defaultPrevented||Y(e??document.body,{select:!0}),s.removeEventListener(No,u),Uo.remove(p)},0)}}},[s,l,u,p]);let m=O.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Ro(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Y(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Y(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,k.jsx)(Za.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});Io.displayName=Fo;function Lo(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Y(r,{select:t}),document.activeElement!==n)return}function Ro(e){let t=zo(e);return[Bo(t,e),Bo(t.reverse(),e)]}function zo(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Bo(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Vo(r,{upTo:t})))return r}function Vo(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function Ho(e){return e instanceof HTMLInputElement&&`select`in e}function Y(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Ho(e)&&t&&e.select()}}var Uo=Wo();function Wo(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Go(e,t),e.unshift(t)},remove(t){e=Go(e,t),e[0]?.resume()}}}function Go(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Ko(e){return e.filter(e=>e.tagName!==`A`)}var qo=`Portal`,Jo=O.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=O.useState(!1);q(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?ja.createPortal((0,k.jsx)(Za.div,{...r,ref:t}),o):null});Jo.displayName=qo;var Yo=0,Xo=null;function Zo(){O.useEffect(()=>{Xo||={start:Qo(),end:Qo()};let{start:e,end:t}=Xo;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),Yo++,()=>{Yo===1&&(Xo?.start.remove(),Xo?.end.remove(),Xo=null),Yo=Math.max(0,Yo-1)}},[])}function Qo(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var X=function(){return X=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},X.apply(this,arguments)};function $o(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function es(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var ts=`right-scroll-bar-position`,ns=`width-before-scroll-bar`,rs=`with-scroll-bars-hidden`,is=`--removed-body-scroll-bar-size`;function as(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function os(e,t){var n=(0,O.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var ss=typeof window<`u`?O.useLayoutEffect:O.useEffect,cs=new WeakMap;function ls(e,t){var n=os(t||null,function(t){return e.forEach(function(e){return as(e,t)})});return ss(function(){var t=cs.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||as(e,null)}),i.forEach(function(e){r.has(e)||as(e,a)})}cs.set(n,e)},[e]),n}function us(e){return e}function ds(e,t){t===void 0&&(t=us);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function fs(e){e===void 0&&(e={});var t=ds(null);return t.options=X({async:!0,ssr:!1},e),t}var ps=function(e){var t=e.sideCar,n=$o(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return O.createElement(r,X({},n))};ps.isSideCarExport=!0;function ms(e,t){return e.useMedium(t),ps}var hs=fs(),gs=function(){},_s=O.forwardRef(function(e,t){var n=O.useRef(null),r=O.useState({onScrollCapture:gs,onWheelCapture:gs,onTouchMoveCapture:gs}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=$o(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=ls([n,t]),C=X(X({},b),i);return O.createElement(O.Fragment,null,u&&O.createElement(x,{sideCar:hs,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?O.cloneElement(O.Children.only(s),X(X({},C),{ref:S})):O.createElement(v,X({},C,{className:c,ref:S}),s))});_s.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},_s.classNames={fullWidth:ns,zeroRight:ts};var vs,ys=function(){if(vs)return vs;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function bs(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=ys();return t&&e.setAttribute(`nonce`,t),e}function xs(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Ss(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Cs=function(){var e=0,t=null;return{add:function(n){e==0&&(t=bs())&&(xs(t,n),Ss(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ws=function(){var e=Cs();return function(t,n){O.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ts=function(){var e=ws();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Es={left:0,top:0,right:0,gap:0},Ds=function(e){return parseInt(e||``,10)||0},Os=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[Ds(n),Ds(r),Ds(i)]},ks=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Es;var t=Os(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},As=Ts(),js=`data-scroll-locked`,Ms=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
4
- .${rs} {
5
- overflow: hidden ${r};
6
- padding-right: ${s}px ${r};
7
- }
8
- body[${js}] {
9
- overflow: hidden ${r};
10
- overscroll-behavior: contain;
11
- ${[t&&`position: relative ${r};`,n===`margin`&&`
12
- padding-left: ${i}px;
13
- padding-top: ${a}px;
14
- padding-right: ${o}px;
15
- margin-left:0;
16
- margin-top:0;
17
- margin-right: ${s}px ${r};
18
- `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
19
- }
20
-
21
- .${ts} {
22
- right: ${s}px ${r};
23
- }
24
-
25
- .${ns} {
26
- margin-right: ${s}px ${r};
27
- }
28
-
29
- .${ts} .${ts} {
30
- right: 0 ${r};
31
- }
32
-
33
- .${ns} .${ns} {
34
- margin-right: 0 ${r};
35
- }
36
-
37
- body[${js}] {
38
- ${is}: ${s}px;
39
- }
40
- `},Ns=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Ps=function(){O.useEffect(function(){return document.body.setAttribute(js,(Ns()+1).toString()),function(){var e=Ns()-1;e<=0?document.body.removeAttribute(js):document.body.setAttribute(js,e.toString())}},[])},Fs=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Ps();var a=O.useMemo(function(){return ks(i)},[i]);return O.createElement(As,{styles:Ms(a,!t,i,n?``:`!important`)})},Is=!1;if(typeof window<`u`)try{var Ls=Object.defineProperty({},"passive",{get:function(){return Is=!0,!0}});window.addEventListener(`test`,Ls,Ls),window.removeEventListener(`test`,Ls,Ls)}catch{Is=!1}var Z=Is?{passive:!1}:!1,Rs=function(e){return e.tagName===`TEXTAREA`},zs=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Rs(e)&&n[t]===`visible`)},Bs=function(e){return zs(e,`overflowY`)},Vs=function(e){return zs(e,`overflowX`)},Hs=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Gs(e,r)){var i=Ks(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Us=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Ws=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Gs=function(e,t){return e===`v`?Bs(t):Vs(t)},Ks=function(e,t){return e===`v`?Us(t):Ws(t)},qs=function(e,t){return e===`h`&&t===`rtl`?-1:1},Js=function(e,t,n,r,i){var a=qs(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Ks(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Gs(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Ys=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Xs=function(e){return[e.deltaX,e.deltaY]},Zs=function(e){return e&&`current`in e?e.current:e},Qs=function(e,t){return e[0]===t[0]&&e[1]===t[1]},$s=function(e){return`
41
- .block-interactivity-${e} {pointer-events: none;}
42
- .allow-interactivity-${e} {pointer-events: all;}
43
- `},ec=0,Q=[];function tc(e){var t=O.useRef([]),n=O.useRef([0,0]),r=O.useRef(),i=O.useState(ec++)[0],a=O.useState(Ts)[0],o=O.useRef(e);O.useEffect(function(){o.current=e},[e]),O.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=es([e.lockRef.current],(e.shards||[]).map(Zs),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=O.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Ys(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Hs(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Hs(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Js(h,t,e,h===`h`?s:c,!0)},[]),c=O.useCallback(function(e){var n=e;if(!(!Q.length||Q[Q.length-1]!==a)){var r=`deltaY`in n?Xs(n):Ys(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Qs(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Zs).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=O.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:nc(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=O.useCallback(function(e){n.current=Ys(e),r.current=void 0},[]),d=O.useCallback(function(t){l(t.type,Xs(t),t.target,s(t,e.lockRef.current))},[]),f=O.useCallback(function(t){l(t.type,Ys(t),t.target,s(t,e.lockRef.current))},[]);O.useEffect(function(){return Q.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Z),document.addEventListener(`touchmove`,c,Z),document.addEventListener(`touchstart`,u,Z),function(){Q=Q.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Z),document.removeEventListener(`touchmove`,c,Z),document.removeEventListener(`touchstart`,u,Z)}},[]);var p=e.removeScrollBar,m=e.inert;return O.createElement(O.Fragment,null,m?O.createElement(a,{styles:$s(i)}):null,p?O.createElement(Fs,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function nc(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var rc=ms(hs,tc),ic=O.forwardRef(function(e,t){return O.createElement(_s,X({},e,{ref:t,sideCar:rc}))});ic.classNames=_s.classNames;var ac=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},$=new WeakMap,oc=new WeakMap,sc={},cc=0,lc=function(e){return e&&(e.host||lc(e.parentNode))},uc=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=lc(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},dc=function(e,t,n,r){var i=uc(t,Array.isArray(e)?e:[e]);sc[n]||(sc[n]=new WeakMap);var a=sc[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=($.get(e)||0)+1,l=(a.get(e)||0)+1;$.set(e,c),a.set(e,l),o.push(e),c===1&&i&&oc.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),cc++,function(){o.forEach(function(e){var t=$.get(e)-1,i=a.get(e)-1;$.set(e,t),a.set(e,i),t||(oc.has(e)||e.removeAttribute(r),oc.delete(e)),i||e.removeAttribute(n)}),cc--,cc||($=new WeakMap,$=new WeakMap,oc=new WeakMap,sc={})}},fc=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||ac(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),dc(r,i,n,`aria-hidden`)):function(){return null}},pc=Pa(`inline-flex shrink-0 items-center justify-center gap-[7px] rounded-md font-semibold whitespace-nowrap transition-[background-color,border-color,opacity,filter] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{primary:`bg-primary text-primary-foreground hover:brightness-[0.96]`,contrast:`bg-contrast text-contrast-foreground hover:brightness-[0.96]`,outline:`border border-border bg-card hover:bg-muted`,ghost:`text-muted-foreground hover:bg-muted hover:text-foreground`,"danger-ghost":`text-danger hover:bg-danger/10`},size:{default:`h-9 px-3.5 text-[13.5px]`,sm:`h-[30px] rounded-sm px-2.5 text-[12.5px]`,icon:`size-9`,"icon-sm":`size-[30px] rounded-sm`}},defaultVariants:{variant:`primary`,size:`default`}});function mc({className:e,variant:t=`primary`,size:n=`default`,asChild:r=!1,...i}){return(0,k.jsx)(r?za:`button`,{"data-slot":`button`,"data-variant":t,"data-size":n,className:o(pc({variant:t,size:n,className:e})),...i})}var hc=5e3,gc=[],_c=1,vc=new Set;function yc(e){gc=e;for(let e of vc)e()}function bc(e){return vc.add(e),()=>vc.delete(e)}function xc(e,t={}){let n={id:_c++,message:e,tone:t.tone??`default`};yc([...gc,n]),setTimeout(()=>yc(gc.filter(e=>e.id!==n.id)),hc)}function Sc(){let e=(0,O.useSyncExternalStore)(bc,()=>gc);return e.length===0?null:(0,k.jsx)(`div`,{"data-slot":`toaster`,className:`pointer-events-none fixed inset-x-0 bottom-[calc(16px+env(safe-area-inset-bottom))] z-50 flex flex-col items-center gap-2 px-4`,children:e.map(e=>(0,k.jsx)(`div`,{role:`status`,"data-slot":`toast`,"data-tone":e.tone,className:o(`pointer-events-auto max-w-full rounded-md px-3.5 py-2.5 text-[13px] font-medium shadow-modal`,e.tone===`danger`?`bg-danger text-danger-foreground`:`bg-contrast text-contrast-foreground`),children:e.message},e.id))})}var Cc={primary:`border-primary/25 bg-primary/15 text-primary`,neutral:`border-border bg-card text-foreground shadow-xs`,danger:`border-danger/20 bg-danger/15 text-danger`};function wc({icon:e,tone:t=`neutral`,title:n,subtitle:r,children:i,actions:a,backdrop:s=!1,heading:c=`h1`,className:l}){return(0,k.jsxs)(`div`,{"data-slot":`centered-state`,"data-tone":t,className:o(`relative isolate flex min-h-full flex-1 flex-col items-center justify-center px-6 py-12 text-center`,l),children:[s?(0,k.jsx)(Dc,{}):null,(0,k.jsxs)(`div`,{className:`flex w-full max-w-md flex-col items-center gap-4`,children:[(0,k.jsx)(`div`,{"data-slot":`centered-state-tile`,className:o(`flex size-[72px] items-center justify-center rounded-[18px] border [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-7`,Cc[t]),children:e}),(0,k.jsx)(c,{className:`text-2xl font-semibold text-balance text-foreground`,children:n}),r?(0,k.jsx)(`p`,{className:`text-sm text-pretty text-muted-foreground`,children:r}):null,i?(0,k.jsx)(`div`,{className:`w-full pt-2`,children:i}):null,a?(0,k.jsx)(`div`,{className:`flex items-center justify-center gap-3 pt-2`,children:a}):null]})]})}var Tc=[{top:`6%`,left:`14%`,size:2,tone:`violet`,opacity:.5},{top:`11%`,left:`31%`,size:3,tone:`violet`,opacity:.45},{top:`8%`,left:`52%`,size:2,tone:`pending`,opacity:.4},{top:`15%`,left:`71%`,size:2,tone:`violet`,opacity:.5},{top:`9%`,left:`86%`,size:3,tone:`primary`,opacity:.4},{top:`22%`,left:`8%`,size:2,tone:`pending`,opacity:.4},{top:`27%`,left:`24%`,size:2,tone:`primary`,opacity:.35},{top:`20%`,left:`44%`,size:3,tone:`violet`,opacity:.35},{top:`25%`,left:`62%`,size:2,tone:`violet`,opacity:.4},{top:`30%`,left:`79%`,size:2,tone:`primary`,opacity:.35},{top:`36%`,left:`12%`,size:3,tone:`violet`,opacity:.3},{top:`42%`,left:`35%`,size:2,tone:`pending`,opacity:.28},{top:`47%`,left:`58%`,size:2,tone:`primary`,opacity:.28},{top:`52%`,left:`88%`,size:2,tone:`violet`,opacity:.25},{top:`60%`,left:`29%`,size:3,tone:`violet`,opacity:.22}],Ec={violet:`bg-violet`,primary:`bg-primary`,pending:`bg-pending`};function Dc({className:e}){return(0,k.jsx)(`div`,{"data-slot":`twinkle-backdrop`,"aria-hidden":`true`,className:o(`pointer-events-none absolute inset-0 -z-10 overflow-hidden [mask-image:linear-gradient(to_bottom,black_25%,transparent_88%)]`,e),children:Tc.map((e,t)=>(0,k.jsx)(`span`,{className:o(`absolute rounded-[1px] motion-safe:animate-pulse`,e.size===3?`size-[3px]`:`size-0.5`,Ec[e.tone]),style:{top:e.top,left:e.left,opacity:e.opacity,animationDuration:`3.5s`,animationDelay:`${t%5*700}ms`}},t))})}export{ti as $,y as $t,Aa as A,Vi as At,da as B,yn as Bt,Ra as C,na as Ct,K as D,aa as Dt,Pa as E,hi as Et,Da as F,Un as Ft,ga as G,Fe as Gt,ma as H,et as Ht,xa as I,Gn as It,ya as J,D as Jt,ca as K,we as Kt,Sa as L,V as Lt,oa as M,Ir as Mt,ba as N,Lr as Nt,wa as O,Bi as Ot,sa as P,Hn as Pt,Ta as Q,b as Qt,Ca as R,mn as Rt,Qa as S,Ji as St,La as T,ia as Tt,ua as U,Be as Ut,ha as V,Wr as Vt,fa as W,ze as Wt,Ea as X,S as Xt,_a as Y,m as Yt,va as Z,x as Zt,ro as _,Ui as _t,mc as a,s as an,Xi as at,$a as b,Hi as bt,ic as c,Qi as ct,Io as d,Fi as dt,p as en,Pi as et,Co as f,Ci as ft,so as g,Gi as gt,go as h,Ki as ht,xc as i,c as in,Ii as it,pa as j,Pr as jt,ka as k,ki as kt,Zo as l,zi as lt,J as m,Oi as mt,Dc as n,_ as nn,Mi as nt,pc as o,ji as ot,Eo as p,li as pt,Oa as q,he as qt,Sc as r,se as rn,qi as rt,fc as s,Li as st,wc as t,C as tn,Ni as tt,Jo as u,ea as ut,q as v,$i as vt,Ia as w,ta as wt,Za as x,Zi as xt,to as y,Ri as yt,la as z,_n as zt};
@@ -1 +0,0 @@
1
- import{a as e,s as t,u as n}from"./bundle-mjs-BegPhL5c.js";import{h as r,w as i,x as a}from"./centered-state-DzJJpXgm.js";import{r as o,t as s}from"./utils-CzkLr94M.js";import{a as c,o as l,r as u,t as d}from"./dist-M2QYGAcm.js";import{i as f,o as p,r as m,s as h,t as g}from"./dialog-Bf1Cpc3n.js";var _=o(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),v=o(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),y=n(t(),1),b=1,x=.9,ee=.8,S=.17,C=.1,w=.999,T=.9999,E=.99,D=/[\\\/_+.#"@\[\(\{&]/,O=/[\\\/_+.#"@\[\(\{&]/g,k=/[\s-]/,A=/[\s-]/g;function j(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?b:E;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=j(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=b:D.test(e.charAt(l-1))?(d*=ee,p=e.slice(i,l-1).match(O),p&&i>0&&(d*=w**+p.length)):k.test(e.charAt(l-1))?(d*=x,m=e.slice(i,l-1).match(A),m&&i>0&&(d*=w**+m.length)):(d*=S,i>0&&(d*=w**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=T)),(d<C&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=j(e,t,n,r,l+1,a+2,o),f*C>d&&(d=f*C)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function M(e){return e.toLowerCase().replace(A,` `)}function N(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,j(e,t,M(e),M(t),0,0,{})}var P=`[cmdk-group=""]`,F=`[cmdk-group-items=""]`,te=`[cmdk-group-heading=""]`,I=`[cmdk-item=""]`,L=`${I}:not([aria-disabled="true"])`,R=`cmdk-item-select`,z=`data-value`,ne=(e,t,n)=>N(e,t,n),B=y.createContext(void 0),V=()=>y.useContext(B),H=y.createContext(void 0),U=()=>y.useContext(H),W=y.createContext(void 0),G=y.forwardRef((e,t)=>{let n=X(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),i=X(()=>new Set),o=X(()=>new Map),s=X(()=>new Map),c=X(()=>new Set),l=de(e),{label:u,children:d,value:f,onValueChange:p,filter:m,shouldFilter:h,loop:g,disablePointerSelection:_=!1,vimBindings:v=!0,...b}=e,x=r(),ee=r(),S=r(),C=y.useRef(null),w=pe();Y(()=>{if(f!==void 0){let e=f.trim();n.current.value=e,T.emit()}},[f]),Y(()=>{w(6,j)},[]);let T=y.useMemo(()=>({subscribe:e=>(c.current.add(e),()=>c.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)A(),O(),w(1,k);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(S);e?e.focus():(i=document.getElementById(x))==null||i.focus()}if(w(7,()=>{n.current.selectedItemId=M()?.id,T.emit()}),r||w(5,j),l.current?.value!==void 0){let e=t??``;(o=(a=l.current).onValueChange)==null||o.call(a,e);return}}T.emit()}},emit:()=>{c.current.forEach(e=>e())}}),[]),E=y.useMemo(()=>({value:(e,t,r)=>{t!==s.current.get(e)?.value&&(s.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,D(t,r)),w(2,()=>{O(),T.emit()}))},item:(e,t)=>(i.current.add(e),t&&(o.current.has(t)?o.current.get(t).add(e):o.current.set(t,new Set([e]))),w(3,()=>{A(),O(),n.current.value||k(),T.emit()}),()=>{s.current.delete(e),i.current.delete(e),n.current.filtered.items.delete(e);let t=M();w(4,()=>{A(),t?.getAttribute(`id`)===e&&k(),T.emit()})}),group:e=>(o.current.has(e)||o.current.set(e,new Set),()=>{s.current.delete(e),o.current.delete(e)}),filter:()=>l.current.shouldFilter,label:u||e[`aria-label`],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:x,inputId:S,labelId:ee,listInnerRef:C}),[]);function D(e,t){let r=l.current?.filter??ne;return e?r(e,n.current.search,t):0}function O(){if(!n.current.search||l.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=o.current.get(n),i=0;r.forEach(t=>{let n=e.get(t);i=Math.max(n,i)}),t.push([n,i])});let r=C.current;N().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(F);t?t.appendChild(e.parentElement===t?e:e.closest(`${F} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${F} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=C.current?.querySelector(`${P}[${z}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function k(){let e=N().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(z);T.setState(`value`,e||void 0)}function A(){if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=i.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of i.current){let r=D(s.current.get(t)?.value??``,s.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of o.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function j(){var e;let t=M();t&&(t.parentElement?.firstChild===t&&((e=t.closest(P)?.querySelector(te))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function M(){return C.current?.querySelector(`${I}[aria-selected="true"]`)}function N(){return Array.from(C.current?.querySelectorAll(L)||[])}function V(e){let t=N()[e];t&&T.setState(`value`,t.getAttribute(z))}function U(e){var t;let n=M(),r=N(),i=r.findIndex(e=>e===n),a=r[i+e];(t=l.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&T.setState(`value`,a.getAttribute(z))}function W(e){let t=M()?.closest(P),n;for(;t&&!n;)t=e>0?le(t,P):ue(t,P),n=t?.querySelector(L);n?T.setState(`value`,n.getAttribute(z)):U(e)}let G=()=>V(N().length-1),K=e=>{e.preventDefault(),e.metaKey?G():e.altKey?W(1):U(1)},q=e=>{e.preventDefault(),e.metaKey?V(0):e.altKey?W(-1):U(-1)};return y.createElement(a.div,{ref:t,tabIndex:-1,...b,"cmdk-root":``,onKeyDown:e=>{var t;(t=b.onKeyDown)==null||t.call(b,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:v&&e.ctrlKey&&K(e);break;case`ArrowDown`:K(e);break;case`p`:case`k`:v&&e.ctrlKey&&q(e);break;case`ArrowUp`:q(e);break;case`Home`:e.preventDefault(),V(0);break;case`End`:e.preventDefault(),G();break;case`Enter`:{e.preventDefault();let t=M();if(t){let e=new Event(R);t.dispatchEvent(e)}}}}},y.createElement(`label`,{"cmdk-label":``,htmlFor:E.inputId,id:E.labelId,style:he},u),Q(e,e=>y.createElement(H.Provider,{value:T},y.createElement(B.Provider,{value:E},e))))}),K=y.forwardRef((e,t)=>{let n=r(),o=y.useRef(null),s=y.useContext(W),c=V(),l=de(e),u=l.current?.forceMount??s?.forceMount;Y(()=>{if(!u)return c.item(n,s?.id)},[u]);let d=fe(n,o,[e.value,e.children,o],e.keywords),f=U(),p=Z(e=>e.value&&e.value===d.current),m=Z(e=>u||c.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);y.useEffect(()=>{let t=o.current;if(!(!t||e.disabled))return t.addEventListener(R,h),()=>t.removeEventListener(R,h)},[m,e.onSelect,e.disabled]);function h(){var e,t;g(),(t=(e=l.current).onSelect)==null||t.call(e,d.current)}function g(){f.setState(`value`,d.current,!0)}if(!m)return null;let{disabled:_,value:v,onSelect:b,forceMount:x,keywords:ee,...S}=e;return y.createElement(a.div,{ref:i(o,t),...S,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!_,"aria-selected":!!p,"data-disabled":!!_,"data-selected":!!p,onPointerMove:_||c.getDisablePointerSelection()?void 0:g,onClick:_?void 0:h},e.children)}),q=y.forwardRef((e,t)=>{let{heading:n,children:o,forceMount:s,...c}=e,l=r(),u=y.useRef(null),d=y.useRef(null),f=r(),p=V(),m=Z(e=>s||p.filter()===!1?!0:!e.search||e.filtered.groups.has(l));Y(()=>p.group(l),[]),fe(l,u,[e.value,e.heading,d]);let h=y.useMemo(()=>({id:l,forceMount:s}),[s]);return y.createElement(a.div,{ref:i(u,t),...c,"cmdk-group":``,role:`presentation`,hidden:!m||void 0},n&&y.createElement(`div`,{ref:d,"cmdk-group-heading":``,"aria-hidden":!0,id:f},n),Q(e,e=>y.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?f:void 0},y.createElement(W.Provider,{value:h},e))))}),re=y.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=y.useRef(null),s=Z(e=>!e.search);return!n&&!s?null:y.createElement(a.div,{ref:i(o,t),...r,"cmdk-separator":``,role:`separator`})}),ie=y.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,o=U(),s=Z(e=>e.search),c=Z(e=>e.selectedItemId),l=V();return y.useEffect(()=>{e.value!=null&&o.setState(`search`,e.value)},[e.value]),y.createElement(a.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":c,id:l.inputId,type:`text`,value:i?e.value:s,onChange:e=>{i||o.setState(`search`,e.target.value),n?.(e.target.value)}})}),ae=y.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...o}=e,s=y.useRef(null),c=y.useRef(null),l=Z(e=>e.selectedItemId),u=V();return y.useEffect(()=>{if(c.current&&s.current){let e=c.current,t=s.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),y.createElement(a.div,{ref:i(s,t),...o,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:u.listId},Q(e,e=>y.createElement(`div`,{ref:i(c,u.listInnerRef),"cmdk-list-sizer":``},e)))}),oe=y.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return y.createElement(d,{open:n,onOpenChange:r},y.createElement(l,{container:o},y.createElement(c,{"cmdk-overlay":``,className:i}),y.createElement(u,{"aria-label":e.label,"cmdk-dialog":``,className:a},y.createElement(G,{ref:t,...s}))))}),se=y.forwardRef((e,t)=>Z(e=>e.filtered.count===0)?y.createElement(a.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),ce=y.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...o}=e;return y.createElement(a.div,{ref:t,...o,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Q(e,e=>y.createElement(`div`,{"aria-hidden":!0},e)))}),J=Object.assign(G,{List:ae,Item:K,Input:ie,Group:q,Separator:re,Dialog:oe,Empty:se,Loading:ce});function le(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function ue(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function de(e){let t=y.useRef(e);return Y(()=>{t.current=e}),t}var Y=typeof window>`u`?y.useEffect:y.useLayoutEffect;function X(e){let t=y.useRef();return t.current===void 0&&(t.current=e()),t}function Z(e){let t=U(),n=()=>e(t.snapshot());return y.useSyncExternalStore(t.subscribe,n,n)}function fe(e,t,n,r=[]){let i=y.useRef(),a=V();return Y(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(z,s),i.current=s}),i}var pe=()=>{let[e,t]=y.useState(),n=X(()=>new Map);return Y(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function me(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function Q({asChild:e,children:t},n){return e&&y.isValidElement(t)?y.cloneElement(me(t),{ref:t.ref},n(t.props.children)):n(t)}var he={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},$=e();function ge({className:e,...t}){return(0,$.jsx)(J,{"data-slot":`command`,className:s(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t})}function _e({title:e=`Command Palette`,description:t=`Search for a command to run...`,children:n,className:r,showCloseButton:i=!0,...a}){return(0,$.jsxs)(g,{...a,children:[(0,$.jsxs)(p,{className:`sr-only`,children:[(0,$.jsx)(h,{children:e}),(0,$.jsx)(f,{children:t})]}),(0,$.jsx)(m,{className:s(`overflow-hidden p-0`,r),showCloseButton:i,children:(0,$.jsx)(ge,{className:`**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:n})})]})}function ve({className:e,...t}){return(0,$.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex h-9 items-center gap-2 border-b px-3`,children:[(0,$.jsx)(v,{className:`size-4 shrink-0 opacity-50`}),(0,$.jsx)(J.Input,{"data-slot":`command-input`,className:s(`flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]})}function ye({className:e,...t}){return(0,$.jsx)(J.List,{"data-slot":`command-list`,className:s(`max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto`,e),...t})}function be({...e}){return(0,$.jsx)(J.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e})}function xe({className:e,...t}){return(0,$.jsx)(J.Group,{"data-slot":`command-group`,className:s(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function Se({className:e,...t}){return(0,$.jsx)(J.Separator,{"data-slot":`command-separator`,className:s(`-mx-1 h-px bg-border`,e),...t})}function Ce({className:e,...t}){return(0,$.jsx)(J.Item,{"data-slot":`command-item`,className:s(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...t})}function we({className:e,...t}){return(0,$.jsx)(`span`,{"data-slot":`command-shortcut`,className:s(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t})}export{ve as a,Se as c,_ as d,xe as i,we as l,_e as n,Ce as o,be as r,ye as s,ge as t,v as u};
@@ -1 +0,0 @@
1
- import{a as e,s as t,u as n}from"./bundle-mjs-BegPhL5c.js";import{$ as r,Bt as i,D as a,Ht as o,K as s,Mt as c,Wt as l,a as u,bt as d,i as f,j as p,t as m,zt as h}from"./centered-state-DzJJpXgm.js";import{t as g}from"./utils-CzkLr94M.js";import{n as _}from"./loader-circle-Bnw4ga19.js";import{t as v}from"./search-x-C6xG26dv.js";import{_ as y,a as b,f as x,t as S}from"./tasks-table-C5fwJmZ7.js";import{i as C,n as w,r as T,t as E}from"./run-diff-BKpV1kGk.js";import{n as D,t as O}from"./markdown-DxmCMr30.js";import{F as k,H as A,T as j,_ as M,d as N,f as P,g as F,h as I,m as L,p as R,t as z,v as B}from"./index-h4gyDJyh.js";var V=n(t(),1),H=e();function U(){let{groupId:e}=i(),t=p(e),n=l();if((0,V.useEffect)(()=>{e&&n.invalidateQueries({queryKey:a.groups.detail(e)})},[n,e,(s().data??[]).filter(t=>t.groupId===e).map(e=>`${e.id}:${e.status}:${e.archived}`).sort().join(`,`)]),t.isPending)return(0,H.jsx)(j,{});if(t.isError){let e=t.error instanceof r&&t.error.status===404;return(0,H.jsx)(`div`,{"data-route":`compare`,className:`flex min-h-full flex-col`,children:(0,H.jsx)(m,{icon:e?(0,H.jsx)(v,{}):(0,H.jsx)(k,{}),tone:e?`neutral`:`danger`,title:e?`No such variant group`:`Could not load the variants`,subtitle:e?`No runs share this group id. The group may have been deleted, or a winner was already picked and the others removed.`:t.error.message,actions:(0,H.jsx)(u,{asChild:!0,variant:`outline`,children:(0,H.jsx)(c,{to:`/`,children:`Back to tasks`})})})})}return(0,H.jsx)(W,{groupId:e,variants:t.data.runs})}function W({groupId:e,variants:t}){let n=h(),r=l(),[i,s]=(0,V.useState)(null),c=t.every(e=>S.has(e.status)),u=t[0]?x(t[0]):``,p=o({mutationFn:t=>d(e,t),onSuccess:(t,i)=>{r.invalidateQueries({queryKey:a.runs.all}),r.invalidateQueries({queryKey:a.groups.detail(e)}),n(`/tasks/${t.winner?.id??i}`)},onError:e=>f(e.message,{tone:`danger`})});return(0,H.jsxs)(`div`,{"data-route":`compare`,className:`mx-auto flex w-full max-w-6xl flex-col gap-4 px-4 py-5 md:px-6`,children:[(0,H.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,H.jsxs)(`h1`,{className:`flex items-center gap-2 text-xl font-semibold`,children:[(0,H.jsx)(k,{className:`size-5 shrink-0 text-violet`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate`,title:u,children:u})]}),(0,H.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[t.length,` variants of the same task, each in its own worktree — pick the diff you want to keep. The others are cancelled and archived, their worktrees and branches removed.`]})]}),(0,H.jsx)(`div`,{"data-slot":`compare-columns`,className:g(`grid grid-cols-1 gap-3`,t.length>=3?`md:grid-cols-3`:`md:grid-cols-2`),children:t.map(e=>(0,H.jsx)(G,{variant:e,allTerminal:c,pickPending:p.isPending,onPick:()=>s(e)},e.id))}),(0,H.jsx)(`section`,{"aria-label":`Full diffs`,className:`flex flex-col gap-2`,children:t.map(e=>(0,H.jsx)(K,{variant:e},e.id))}),(0,H.jsx)(N,{open:i!==null,onOpenChange:e=>!e&&s(null),children:(0,H.jsxs)(L,{children:[(0,H.jsxs)(M,{children:[(0,H.jsxs)(B,{children:[`Pick variant `,i?.variant,`?`]}),(0,H.jsxs)(I,{children:[`Variant `,i?.variant,`'s changes go to the review gate. The other`,` `,t.length-1==1?`variant is`:`${t.length-1} variants are`,` `,`cancelled if still open, archived, and their worktrees and branches removed. There is no undo.`]})]}),(0,H.jsxs)(F,{children:[(0,H.jsx)(R,{children:`Keep comparing`}),(0,H.jsxs)(P,{"data-slot":`confirm-pick`,onClick:()=>{i&&p.mutate(i.id),s(null)},children:[(0,H.jsx)(_,{"aria-hidden":`true`}),`Pick variant `,i?.variant]})]})]})})]})}function G({variant:e,allTerminal:t,pickPending:n,onPick:r}){let i=y(e),a=b(e.costUsd);return(0,H.jsxs)(`article`,{"data-slot":`variant-column`,"data-variant":e.variant,className:`flex min-w-0 flex-col gap-3 rounded-lg border border-border bg-card p-3.5 shadow-xs`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{"data-slot":`variant-letter`,"aria-label":`Variant ${e.variant}`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded-full bg-violet/15 font-mono text-xs font-semibold text-violet`,children:e.variant}),(0,H.jsx)(z,{dot:i.tone,pulse:i.pulse,children:i.label}),(0,H.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono text-[11px] text-soft-foreground tabular-nums`,children:[D(e.tokensUsed),a?` · ${a}`:``]})]}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,H.jsx)(`span`,{className:`text-[10.5px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:`git diff --stat`}),(0,H.jsx)(`pre`,{"data-slot":`variant-diffstat`,className:`max-h-36 overflow-auto rounded-md bg-muted/60 px-2.5 py-2 font-mono text-[11px] leading-[1.6] whitespace-pre text-muted-foreground`,children:e.diffStat.trimEnd()||`(no changes)`})]}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,H.jsx)(`span`,{className:`text-[10.5px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:`Progress`}),e.handoffExcerpt?(0,H.jsx)(`div`,{"data-slot":`variant-progress`,className:`max-h-28 min-w-0 overflow-hidden text-[12.5px] text-muted-foreground [mask-image:linear-gradient(to_bottom,black_75%,transparent)]`,children:(0,H.jsx)(O,{children:e.handoffExcerpt})}):(0,H.jsx)(`p`,{"data-slot":`variant-progress`,className:`text-xs text-soft-foreground`,children:`(no progress notes)`})]}),(0,H.jsxs)(u,{"data-slot":`variant-pick`,title:t?`Keep variant ${e.variant}'s changes and archive the others`:`Every variant must finish before you can pick`,disabled:!t||n,onClick:r,children:[(0,H.jsx)(_,{"aria-hidden":`true`}),`Pick this one`]})]})}function K({variant:e}){let[t,n]=(0,V.useState)(!1);return(0,H.jsxs)(w,{open:t,onOpenChange:n,"data-slot":`variant-diff`,"data-variant":e.variant,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card`,children:[(0,H.jsxs)(C,{className:`flex w-full items-center gap-2 px-3.5 py-2.5 text-left text-[13px] font-medium hover:bg-muted/50`,children:[(0,H.jsx)(A,{className:g(`size-3.5 shrink-0 text-soft-foreground transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),`Variant `,e.variant,` — full diff`]}),(0,H.jsx)(T,{children:(0,H.jsx)(`div`,{className:`border-t border-border/50 px-3 py-3`,children:(0,H.jsx)(E,{runId:e.id})})})]})}export{U as CompareVariantsRoute};
@@ -1 +0,0 @@
1
- import{a as e,s as t}from"./bundle-mjs-BegPhL5c.js";import{a as n}from"./centered-state-DzJJpXgm.js";import{t as r}from"./utils-CzkLr94M.js";import{t as i}from"./x-DaR4ZfE-.js";import{a,i as o,n as s,o as c,r as l,s as u,t as d}from"./dist-M2QYGAcm.js";t();var f=e();function p({...e}){return(0,f.jsx)(d,{"data-slot":`dialog`,...e})}function m({...e}){return(0,f.jsx)(c,{"data-slot":`dialog-portal`,...e})}function h({...e}){return(0,f.jsx)(s,{"data-slot":`dialog-close`,...e})}function g({className:e,...t}){return(0,f.jsx)(a,{"data-slot":`dialog-overlay`,className:r(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function _({className:e,children:t,showCloseButton:n=!0,...a}){return(0,f.jsxs)(m,{"data-slot":`dialog-portal`,children:[(0,f.jsx)(g,{}),(0,f.jsxs)(l,{"data-slot":`dialog-content`,className:r(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-modal duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...a,children:[t,n&&(0,f.jsxs)(s,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,f.jsx)(i,{}),(0,f.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function v({className:e,...t}){return(0,f.jsx)(`div`,{"data-slot":`dialog-header`,className:r(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function y({className:e,showCloseButton:t=!1,children:i,...a}){return(0,f.jsxs)(`div`,{"data-slot":`dialog-footer`,className:r(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...a,children:[i,t&&(0,f.jsx)(s,{asChild:!0,children:(0,f.jsx)(n,{variant:`outline`,children:`Close`})})]})}function b({className:e,...t}){return(0,f.jsx)(u,{"data-slot":`dialog-title`,className:r(`text-lg leading-none font-semibold`,e),...t})}function x({className:e,...t}){return(0,f.jsx)(o,{"data-slot":`dialog-description`,className:r(`text-sm text-muted-foreground`,e),...t})}export{y as a,x as i,h as n,v as o,_ as r,b as s,p as t};
@@ -1,4 +0,0 @@
1
- import{a as e,s as t,u as n}from"./bundle-mjs-BegPhL5c.js";import{t as r}from"./utils-CzkLr94M.js";import{i,n as a,r as o}from"./highlighter-ZVyRi_Cx.js";import{H as s,M as c}from"./index-h4gyDJyh.js";import{n as l,t as u}from"./image-preview-Ca0UgThg.js";var d=n(t(),1),f=/[A-Za-z0-9_]+|\s+|[^\sA-Za-z0-9_]+/g,p=300,m=.3;function h(e,t){if(e===t)return null;let n=e.match(f)??[],r=t.match(f)??[];if(n.length===0||r.length===0||n.length>p||r.length>p)return null;let i=r.length+1,a=new Uint16Array((n.length+1)*i);for(let e=1;e<=n.length;e++)for(let t=1;t<=r.length;t++)a[e*i+t]=n[e-1]===r[t-1]?(a[(e-1)*i+(t-1)]??0)+1:Math.max(a[(e-1)*i+t]??0,a[e*i+(t-1)]??0);if((a[n.length*i+r.length]??0)/Math.max(n.length,r.length)<m)return null;let o=Array(n.length).fill(!1),s=Array(r.length).fill(!1),c=n.length,l=r.length;for(;c>0&&l>0;)n[c-1]===r[l-1]?(o[c-1]=!0,s[l-1]=!0,c--,l--):(a[(c-1)*i+l]??0)>=(a[c*i+(l-1)]??0)?c--:l--;return{del:g(n,o),add:g(r,s)}}function g(e,t){let n=[];return e.forEach((e,r)=>{let i=!(t[r]??!1),a=n[n.length-1];a&&a.changed===i?a.text+=e:n.push({text:e,changed:i})}),n}function _(e,t,n){if(!t||t.length===0)return e?e.map(e=>({text:e.content,color:e.color,changed:!1})):n===``?[]:[{text:n,changed:!1}];if(!e||e.length===0)return t.map(e=>({text:e.text,changed:e.changed}));let r=[],i=0,a=0,o=0,s=0;for(;i<e.length&&o<t.length;){let n=e[i],c=t[o],l=n.content.length-a,u=c.text.length-s,d=Math.min(l,u);d>0&&(r.push({text:n.content.slice(a,a+d),color:n.color,changed:c.changed}),a+=d,s+=d),n.content.length-a<=0&&(i++,a=0),c.text.length-s<=0&&(o++,s=0)}for(;i<e.length;){let t=e[i],n=t.content.slice(a);n!==``&&r.push({text:n,color:t.color,changed:!1}),i++,a=0}return r}var v=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/,y=`… (patch truncated)`;function b(e){let t=[],n=!1,r=null,i=0,a=0,o=e.split(`
2
- `);o.at(-1)===``&&o.pop();for(let e of o){let o=v.exec(e);if(o){r={header:e,oldStart:Number(o[1]),oldCount:o[2]===void 0?1:Number(o[2]),newStart:Number(o[3]),newCount:o[4]===void 0?1:Number(o[4]),lines:[]},i=r.oldStart,a=r.newStart,t.push(r);continue}if(e.includes(y)){n=!0,r=null;continue}r&&(e.startsWith(`+`)?r.lines.push({kind:`add`,text:e.slice(1),newLine:a++}):e.startsWith(`-`)?r.lines.push({kind:`del`,text:e.slice(1),oldLine:i++}):e.startsWith(`\\`)||r.lines.push({kind:`context`,text:e.slice(1),oldLine:i++,newLine:a++}))}return{hunks:t,truncated:n}}function x(e,t=!1){let n=[],r=e[0];if(!r)return n;r.newStart>1&&n.push({beforeHunk:0,count:r.newStart-1,oldStart:1,newStart:1});for(let t=1;t<e.length;t++){let r=e[t-1],i=e[t],a=r.oldStart+r.oldCount,o=r.newStart+r.newCount,s=i.newStart-o;s>0&&n.push({beforeHunk:t,count:s,oldStart:a,newStart:o})}if(t){let t=e[e.length-1];n.push({beforeHunk:e.length,oldStart:t.oldStart+t.oldCount,newStart:t.newStart+t.newCount})}return n}function S(e,t){let n=e.count===void 0?t.length:e.newStart+e.count-1,r=e.oldStart-e.newStart,i=[];for(let a=e.newStart;a<=Math.min(n,t.length);a++)i.push({kind:`context`,text:t[a-1]??``,oldLine:a+r,newLine:a});return i}function C(e,t){let n=Array(e.length),r=Array(t.length),i=Math.min(e.length,t.length);for(let a=0;a<i;a++){let i=h(e[a].text,t[a].text);i&&(n[a]=i.del,r[a]=i.add)}return{dels:e,adds:t,delSpans:n,addSpans:r}}function w(e,t,n){let r=0;for(;r<e.lines.length;){let i=e.lines[r];if(i.kind===`del`||i.kind===`add`){let t=[],i=[];for(;r<e.lines.length&&e.lines[r].kind===`del`;)t.push(e.lines[r++]);for(;r<e.lines.length&&e.lines[r].kind===`add`;)i.push(e.lines[r++]);n(C(t,i))}else t(i),r++}}function T(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`line`,cell:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),w(e,e=>i.push({type:`line`,cell:{line:e}}),e=>{e.dels.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.delSpans[n]}})),e.adds.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.addSpans[n]}}))})}),a(e.length),i}function E(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`pair`,left:{line:e},right:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),w(e,e=>i.push({type:`pair`,left:{line:e},right:{line:e}}),e=>{let t=Math.max(e.dels.length,e.adds.length);for(let n=0;n<t;n++){let t=e.dels[n],r=e.adds[n];i.push({type:`pair`,...t?{left:{line:t,spans:e.delSpans[n]}}:{},...r?{right:{line:r,spans:e.addSpans[n]}}:{}})}})}),a(e.length),i}var D=e(),O=1500;function k({files:e,mode:t=`unified`,wrap:n=!1,loadFileText:i,imageSrc:a,onOpenInApp:o,className:s}){let l=(0,d.useMemo)(()=>({adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length}),[e]);return(0,D.jsxs)(`div`,{"data-slot":`diff`,"data-mode":t,className:r(`flex min-w-0 flex-col gap-3`,s),children:[(0,D.jsxs)(`p`,{"data-slot":`diff-totals`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,D.jsxs)(`span`,{children:[l.files,` `,l.files===1?`file`:`files`,` changed`]}),(0,D.jsx)(c,{stat:l})]}),e.map(e=>(0,D.jsx)(j,{file:e,mode:t,wrap:n,loadFileText:i,imageSrc:a,onOpenInApp:o},`${e.oldPath??``}→${e.path}`))]})}var A={added:`added`,deleted:`deleted`,renamed:`renamed`,copied:`copied`};function j({file:e,mode:t,wrap:n,loadFileText:i,imageSrc:a,onOpenInApp:o}){let[l,u]=(0,d.useState)(!0),f=A[e.status];return(0,D.jsxs)(`section`,{"data-slot":`diff-file`,"data-path":e.path,className:`min-w-0 overflow-clip rounded-md border border-border bg-card`,children:[(0,D.jsx)(`header`,{className:`sticky top-[var(--diff-sticky-top,0px)] z-10 rounded-t-md border-b border-border/50 bg-card`,children:(0,D.jsxs)(`button`,{type:`button`,"data-slot":`diff-file-header`,"aria-expanded":l,onClick:()=>u(e=>!e),className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted/50`,children:[(0,D.jsx)(s,{className:r(`size-3.5 shrink-0 text-soft-foreground transition-transform`,l&&`rotate-90`),"aria-hidden":`true`}),(0,D.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`span`,{className:`text-soft-foreground`,children:[e.oldPath,` → `]}),e.path]}):e.path}),f?(0,D.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:f}):null,e.image?(0,D.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:`image`}):e.binary?(0,D.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:`binary`}):null,(0,D.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,D.jsx)(c,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-[11px]`})})]})}),l?(0,D.jsx)(M,{file:e,mode:t,wrap:n,loadFileText:i,imageSrc:a,onOpenInApp:o}):null]})}function M({file:e,mode:t,wrap:n,loadFileText:i,imageSrc:a,onOpenInApp:o}){let s=(0,d.useMemo)(()=>b(e.patch),[e.patch]),c=i!==void 0&&e.status!==`added`&&e.status!==`deleted`,f=(0,d.useMemo)(()=>x(s.hunks,c),[s.hunks,c]),[p,m]=(0,d.useState)(new Map),h=async t=>{if(!i)return;let n=await i(e.path);if(n===null)return;let r=S(t,n.split(`
3
- `));m(e=>new Map(e).set(t.beforeHunk,r))},g=(0,d.useMemo)(()=>{let e=[];s.hunks.forEach((t,n)=>{let r=p.get(n);r&&e.push(...r),e.push(...t.lines)});let t=p.get(s.hunks.length);return t&&e.push(...t),e},[s.hunks,p]),_=(0,d.useMemo)(()=>new Map(g.map((e,t)=>[e,t])),[g]),v=N(e.path,g),y=(0,d.useMemo)(()=>t===`unified`?T(s.hunks,f,p):null,[t,s.hunks,f,p]),C=(0,d.useMemo)(()=>t===`split`?E(s.hunks,f,p):null,[t,s.hunks,f,p]);if(l(e))return(0,D.jsx)(u,{file:e,imageSrc:a,onOpenInApp:o});if(e.binary)return(0,D.jsx)(P,{children:`Binary file — no text diff.`});if(s.hunks.length===0)return(0,D.jsx)(P,{children:s.truncated?`Patch truncated by the server.`:`No content changes (metadata only).`});let w=e=>{if(!v)return null;let t=_.get(e);return t===void 0?null:v[t]??null},O=i!==void 0&&e.status!==`added`&&e.status!==`deleted`;return(0,D.jsxs)(`div`,{"data-slot":`diff-file-body`,"data-wrap":n||void 0,className:r(`py-1 font-mono text-xs leading-[1.7]`,!n&&`overflow-x-auto`),children:[y?y.map((e,t)=>(0,D.jsx)(V,{row:e,wrap:n,tokensFor:w,onExpand:O?h:void 0},t)):null,C?C.map((e,t)=>(0,D.jsx)(H,{row:e,wrap:n,tokensFor:w,onExpand:O?h:void 0},t)):null,s.truncated?(0,D.jsx)(P,{children:`Patch truncated by the server — counts above remain exact.`}):null]})}function N(e,t){let n=(0,d.useMemo)(()=>t.length>O?null:t.map(e=>e.text).join(`
4
- `),[t]),r=(0,d.useMemo)(()=>i(e),[e]),[s,c]=(0,d.useState)(null);return(0,d.useEffect)(()=>{if(n===null||r===null)return;let e=!1;return a(n,r).then(t=>{e||c({text:n,tokens:t.tokens})}),()=>{e=!0}},[n,r]),n===null||r===null?null:s?.text===n?s.tokens:o(n,r)?.tokens??null}function P({children:e}){return(0,D.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:e})}var F={add:`bg-diff-add`,del:`bg-diff-del`,context:void 0},I={add:`+`,del:`−`,context:` `};function L({hunk:e}){return(0,D.jsx)(`div`,{"data-slot":`diff-hunk`,className:`bg-muted/40 px-4 py-0.5 whitespace-pre text-soft-foreground`,children:e.header})}function R({gap:e,onExpand:t}){let n=e.count===void 0?`⋯ unchanged lines to end of file`:`⋯ ${e.count} unchanged ${e.count===1?`line`:`lines`}`;return t?(0,D.jsxs)(`button`,{type:`button`,"data-slot":`diff-gap`,onClick:()=>t(e),className:`block w-full border-y border-border/40 bg-muted/20 px-4 py-0.5 text-left text-[11px] text-soft-foreground hover:bg-muted/50 hover:text-foreground`,children:[n,` — expand`]}):(0,D.jsx)(`div`,{"data-slot":`diff-gap`,className:`border-y border-border/40 bg-muted/20 px-4 py-0.5 text-[11px] text-soft-foreground`,children:n})}function z({cell:e,tokens:t,wrap:n}){let i=_(t,e.spans,e.line.text),a=e.line.kind===`add`?`bg-diff-add-strong`:`bg-diff-del-strong`;return(0,D.jsxs)(`span`,{className:r(`min-w-0 flex-1 pr-4`,n?`break-words whitespace-pre-wrap`:`whitespace-pre`),children:[i.map((t,n)=>(0,D.jsx)(`span`,{"data-word":t.changed?e.line.kind:void 0,style:t.color===void 0?void 0:{color:t.color},className:t.changed?r(`rounded-[2px]`,a):void 0,children:t.text},n)),e.line.text===``?` `:``]})}function B({value:e}){return(0,D.jsx)(`span`,{className:`w-10 shrink-0 pr-2 text-right text-soft-foreground/70 tabular-nums select-none`,children:e??``})}function V({row:e,wrap:t,tokensFor:n,onExpand:i}){if(e.type===`hunk`)return(0,D.jsx)(L,{hunk:e.hunk});if(e.type===`gap`)return(0,D.jsx)(R,{gap:e.gap,onExpand:i});let{line:a}=e.cell;return(0,D.jsxs)(`div`,{"data-slot":`diff-line`,"data-line":a.kind,className:r(`flex`,F[a.kind]),children:[(0,D.jsx)(B,{value:a.oldLine}),(0,D.jsx)(B,{value:a.newLine}),(0,D.jsx)(`span`,{className:`w-4 shrink-0 text-soft-foreground select-none`,children:I[a.kind]}),(0,D.jsx)(z,{cell:e.cell,tokens:n(a),wrap:t})]})}function H({row:e,wrap:t,tokensFor:n,onExpand:r}){return e.type===`hunk`?(0,D.jsx)(L,{hunk:e.hunk}):e.type===`gap`?(0,D.jsx)(R,{gap:e.gap,onExpand:r}):(0,D.jsxs)(`div`,{"data-slot":`diff-pair`,className:`grid grid-cols-2`,children:[(0,D.jsx)(U,{cell:e.left,side:`old`,tokensFor:n,wrap:t}),(0,D.jsx)(U,{cell:e.right,side:`new`,tokensFor:n,wrap:t})]})}function U({cell:e,side:t,tokensFor:n,wrap:i}){if(!e)return(0,D.jsx)(`div`,{"data-slot":`diff-cell-empty`,className:r(`bg-muted/20`,t===`new`&&`border-l border-border/40`)});let{line:a}=e;return(0,D.jsxs)(`div`,{"data-slot":`diff-cell`,"data-line":a.kind,className:r(`flex min-w-0`,F[a.kind],t===`new`&&`border-l border-border/40`),children:[(0,D.jsx)(B,{value:t===`old`?a.oldLine:a.newLine}),(0,D.jsx)(`span`,{className:`w-4 shrink-0 text-soft-foreground select-none`,children:I[a.kind]}),(0,D.jsx)(z,{cell:e,tokens:n(a),wrap:i})]})}export{k as DiffView};
@@ -1 +0,0 @@
1
- import{a as e,s as t,u as n}from"./bundle-mjs-BegPhL5c.js";import{C as r,T as i,_ as a,b as o,c as s,d as c,f as l,g as u,h as d,l as f,p,s as m,u as h,x as g,y as _}from"./centered-state-DzJJpXgm.js";var v=n(t(),1),y=e(),b=`Dialog`,[x,S]=o(b),[C,w]=x(b),T=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:s=!0}=e,c=v.useRef(null),l=v.useRef(null),[u,f]=a({prop:r,defaultProp:i??!1,onChange:o,caller:b});return(0,y.jsx)(C,{scope:t,triggerRef:c,contentRef:l,contentId:d(),titleId:d(),descriptionId:d(),open:u,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(e=>!e),[f]),modal:s,children:n})};T.displayName=b;var E=`DialogTrigger`,D=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,a=w(E,n),o=i(t,a.triggerRef);return(0,y.jsx)(g.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":q(a.open),...r,ref:o,onClick:_(e.onClick,a.onOpenToggle)})});D.displayName=E;var O=`DialogPortal`,[k,A]=x(O,{forceMount:void 0}),j=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=w(O,t);return(0,y.jsx)(k,{scope:t,forceMount:n,children:v.Children.map(r,e=>(0,y.jsx)(u,{present:n||a.open,children:(0,y.jsx)(h,{asChild:!0,container:i,children:e})}))})};j.displayName=O;var M=`DialogOverlay`,N=v.forwardRef((e,t)=>{let n=A(M,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=w(M,e.__scopeDialog);return a.modal?(0,y.jsx)(u,{present:r||a.open,children:(0,y.jsx)(F,{...i,ref:t})}):null});N.displayName=M;var P=r(`DialogOverlay.RemoveScroll`),F=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,a=w(M,n),o=i(t,p());return(0,y.jsx)(s,{as:P,allowPinchZoom:!0,shards:[a.contentRef],children:(0,y.jsx)(g.div,{"data-state":q(a.open),...r,ref:o,style:{pointerEvents:`auto`,...r.style}})})}),I=`DialogContent`,L=v.forwardRef((e,t)=>{let n=A(I,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=w(I,e.__scopeDialog);return(0,y.jsx)(u,{present:r||a.open,children:a.modal?(0,y.jsx)(R,{...i,ref:t}):(0,y.jsx)(z,{...i,ref:t})})});L.displayName=I;var R=v.forwardRef((e,t)=>{let n=w(I,e.__scopeDialog),r=v.useRef(null),a=i(t,n.contentRef,r);return v.useEffect(()=>{let e=r.current;if(e)return m(e)},[]),(0,y.jsx)(B,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:_(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:_(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:_(e.onFocusOutside,e=>e.preventDefault())})}),z=v.forwardRef((e,t)=>{let n=w(I,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return(0,y.jsx)(B,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),B=v.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=w(I,n);return f(),(0,y.jsx)(y.Fragment,{children:(0,y.jsx)(c,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,y.jsx)(l,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":q(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})}),V=`DialogTitle`,H=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(V,n);return(0,y.jsx)(g.h2,{id:i.titleId,...r,ref:t})});H.displayName=V;var U=`DialogDescription`,W=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(U,n);return(0,y.jsx)(g.p,{id:i.descriptionId,...r,ref:t})});W.displayName=U;var G=`DialogClose`,K=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(G,n);return(0,y.jsx)(g.button,{type:`button`,...r,ref:t,onClick:_(e.onClick,()=>i.onOpenChange(!1))})});K.displayName=G;function q(e){return e?`open`:`closed`}export{N as a,D as c,W as i,S as l,K as n,j as o,L as r,H as s,T as t};
@@ -1 +0,0 @@
1
- import{a as e,o as t,s as n,u as r}from"./bundle-mjs-BegPhL5c.js";import{T as i,b as a,m as o,v as s,x as c}from"./centered-state-DzJJpXgm.js";var l=r(t(),1),u=e(),d=r(n(),1);function f(e){let[t,n]=d.useState(void 0);return s(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var p=[`top`,`right`,`bottom`,`left`],m=Math.min,h=Math.max,g=Math.round,_=Math.floor,v=e=>({x:e,y:e}),y={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function b(e,t,n){return h(e,m(t,n))}function x(e,t){return typeof e==`function`?e(t):e}function S(e){return e.split(`-`)[0]}function C(e){return e.split(`-`)[1]}function w(e){return e===`x`?`y`:`x`}function T(e){return e===`y`?`height`:`width`}function E(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function D(e){return w(E(e))}function O(e,t,n){n===void 0&&(n=!1);let r=C(e),i=D(e),a=T(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=L(o)),[o,L(o)]}function k(e){let t=L(e);return[A(e),t,A(t)]}function A(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var j=[`left`,`right`],M=[`right`,`left`],N=[`top`,`bottom`],P=[`bottom`,`top`];function F(e,t,n){switch(e){case`top`:case`bottom`:return n?t?M:j:t?j:M;case`left`:case`right`:return t?N:P;default:return[]}}function I(e,t,n,r){let i=C(e),a=F(S(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(A)))),a}function L(e){let t=S(e);return y[t]+e.slice(t.length)}function R(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function z(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:R(e)}function B(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function V(e,t,n){let{reference:r,floating:i}=e,a=E(t),o=D(t),s=T(o),c=S(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=C(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function ee(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=x(t,e),p=z(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=B(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=B(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var te=50,ne=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:ee},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=V(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<te&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=V(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},re=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=x(e,t)||{};if(l==null)return{};let d=z(u),f={x:n,y:r},p=D(i),h=T(p),g=await o.getDimensions(l),_=p===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,S=_?`clientHeight`:`clientWidth`,w=a.reference[h]+a.reference[p]-f[p]-a.floating[h],E=f[p]-a.reference[p],O=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),k=O?O[S]:0;(!k||!await(o.isElement==null?void 0:o.isElement(O)))&&(k=s.floating[S]||a.floating[h]);let A=w/2-E/2,j=k/2-g[h]/2-1,M=m(d[v],j),N=m(d[y],j),P=k-g[h]-N,F=k/2-g[h]/2+A,I=b(M,F,P),L=!c.arrow&&C(i)!=null&&F!==I&&a.reference[h]/2-(F<M?M:N)-g[h]/2<0,R=L?F<M?F-M:F-P:0;return{[p]:f[p]+R,data:{[p]:I,centerOffset:F-I-R,...L&&{alignmentOffset:R}},reset:L}}}),ie=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=x(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=S(r),_=E(o),v=S(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[L(o)]:k(o)),C=p!==`none`;!d&&C&&b.push(...I(o,m,p,y));let w=[o,...b],T=await s.detectOverflow(t,h),D=[],A=i.flip?.overflows||[];if(l&&D.push(T[g]),u){let e=O(r,a,y);D.push(T[e[0]],T[e[1]])}if(A=[...A,{placement:r,overflows:D}],!D.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=w[e];if(t&&(!(u===`alignment`&&_!==E(t))||A.every(e=>E(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:A},reset:{placement:t}};let n=A.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=A.filter(e=>{if(C){let t=E(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function ae(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function oe(e){return p.some(t=>e[t]>=0)}var se=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=x(e,t);switch(i){case`referenceHidden`:{let e=ae(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:oe(e)}}}case`escaped`:{let e=ae(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:oe(e)}}}default:return{}}}}},ce=new Set([`left`,`top`]);async function le(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=S(n),s=C(n),c=E(n)===`y`,l=ce.has(o)?-1:1,u=a&&c?-1:1,d=x(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var ue=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await le(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},de=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=x(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=E(i),p=w(f),m=u[p],h=u[f],g=(e,t)=>b(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},fe=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=x(e,t),u={x:n,y:r},d=E(i),f=w(d),p=u[f],m=u[d],h=x(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=ce.has(S(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},pe=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=x(e,t),c=await i.detectOverflow(t,s),l=S(n),u=C(n),d=E(n)===`y`,{width:f,height:p}=r.floating,g,_;l===`top`||l===`bottom`?(g=l,_=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(_=l,g=u===`end`?`top`:`bottom`);let v=p-c.top-c.bottom,y=f-c.left-c.right,b=m(p-c[g],v),w=m(f-c[_],y),T=t.middlewareData.shift,D=!T,O=b,k=w;T!=null&&T.enabled.x&&(k=y),T!=null&&T.enabled.y&&(O=v),D&&!u&&(d?k=f-2*h(c.left,c.right):O=p-2*h(c.top,c.bottom)),await o({...t,availableWidth:k,availableHeight:O});let A=await i.getDimensions(a.floating);return f!==A.width||p!==A.height?{reset:{rects:!0}}:{}}}};function me(){return typeof window<`u`}function H(e){return he(e)?(e.nodeName||``).toLowerCase():`#document`}function U(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function W(e){return((he(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function he(e){return me()?e instanceof Node||e instanceof U(e).Node:!1}function G(e){return me()?e instanceof Element||e instanceof U(e).Element:!1}function K(e){return me()?e instanceof HTMLElement||e instanceof U(e).HTMLElement:!1}function ge(e){return!me()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof U(e).ShadowRoot}function _e(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Y(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function ve(e){return/^(table|td|th)$/.test(H(e))}function ye(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var be=/transform|translate|scale|rotate|perspective|filter/,xe=/paint|layout|strict|content/,q=e=>!!e&&e!==`none`,Se;function Ce(e){let t=G(e)?Y(e):e;return q(t.transform)||q(t.translate)||q(t.scale)||q(t.rotate)||q(t.perspective)||!Te()&&(q(t.backdropFilter)||q(t.filter))||be.test(t.willChange||``)||xe.test(t.contain||``)}function we(e){let t=X(e);for(;K(t)&&!J(t);){if(Ce(t))return t;if(ye(t))return null;t=X(t)}return null}function Te(){return Se??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Se}function J(e){return/^(html|body|#document)$/.test(H(e))}function Y(e){return U(e).getComputedStyle(e)}function Ee(e){return G(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function X(e){if(H(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ge(e)&&e.host||W(e);return ge(t)?t.host:t}function De(e){let t=X(e);return J(t)?(e.ownerDocument||e).body:K(t)&&_e(t)?t:De(t)}function Z(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=De(e),i=r===e.ownerDocument?.body,a=U(r);if(i){let e=Oe(a);return t.concat(a,a.visualViewport||[],_e(r)?r:[],e&&n?Z(e):[])}else return t.concat(r,Z(r,[],n))}function Oe(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ke(e){let t=Y(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=K(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=g(n)!==a||g(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Ae(e){return G(e)?e:e.contextElement}function Q(e){let t=Ae(e);if(!K(t))return v(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=ke(t),o=(a?g(n.width):n.width)/r,s=(a?g(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var je=v(0);function Me(e){let t=U(e);return!Te()||!t.visualViewport?je:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ne(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===U(e)}function $(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Ae(e),o=v(1);t&&(r?G(r)&&(o=Q(r)):o=Q(e));let s=Ne(a,n,r)?Me(a):v(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=U(a),t=G(r)?U(r):r,n=e,i=Oe(n);for(;i&&t!==n;){let e=Q(i),t=i.getBoundingClientRect(),r=Y(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=U(i),i=Oe(n)}}return B({width:u,height:d,x:c,y:l})}function Pe(e,t){let n=Ee(e).scrollLeft;return t?t.left+n:$(W(e)).left+n}function Fe(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Pe(e,n),y:n.top+t.scrollTop}}function Ie(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=W(r),s=t?ye(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=v(1),u=v(0),d=K(r);if((d||!a)&&((H(r)!==`body`||_e(o))&&(c=Ee(r)),d)){let e=$(r);l=Q(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Fe(o,c):v(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Le(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Re(e){let t=Ee(e),n=e.ownerDocument.body,r=h(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=h(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Pe(e),o=-t.scrollTop;return Y(n).direction===`rtl`&&(a+=h(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var ze=25;function Be(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=U(e),a=W(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Te()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Pe(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=ze&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Ve(e,t){let n=$(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Q(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function He(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Be(e,n,t);else if(t===`document`)r=Re(W(e));else if(G(t))r=Ve(t,n);else{let n=Me(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return B(r)}function Ue(e,t){let n=t.get(e);if(n)return n;let r=Z(e,[],!1).filter(e=>G(e)&&H(e)!==`body`),i=null,a=Y(e).position===`fixed`,o=a?X(e):e;for(;G(o)&&!J(o);){let e=Y(o),t=Ce(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=X(o)}return t.set(e,r),r}function We(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ye(t)?[]:Ue(t,this._c):[].concat(n),r],o=He(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=He(t,a[e],i);s=h(n.top,s),c=m(n.right,c),l=m(n.bottom,l),u=h(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Ge(e){let{width:t,height:n}=ke(e);return{width:t,height:n}}function Ke(e,t,n){let r=K(t),i=W(t),a=n===`fixed`,o=$(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=v(0);if((r||!a)&&((H(t)!==`body`||_e(i))&&(s=Ee(t)),r)){let e=$(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Pe(i));let l=i&&!r&&!a?Fe(i,s):v(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function qe(e){return Y(e).position===`static`}function Je(e,t){if(!K(e)||Y(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return W(e)===n&&(n=n.ownerDocument.body),n}function Ye(e,t){let n=U(e);if(ye(e))return n;if(!K(e)){let t=X(e);for(;t&&!J(t);){if(G(t)&&!qe(t))return t;t=X(t)}return n}let r=Je(e,t);for(;r&&ve(r)&&qe(r);)r=Je(r,t);return r&&J(r)&&qe(r)&&!Ce(r)?n:r||we(e)||n}var Xe=async function(e){let t=this.getOffsetParent||Ye,n=this.getDimensions,r=await n(e.floating);return{reference:Ke(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ze(e){return Y(e).direction===`rtl`}var Qe={convertOffsetParentRelativeRectToViewportRelativeRect:Ie,getDocumentElement:W,getClippingRect:We,getOffsetParent:Ye,getElementRects:Xe,getClientRects:Le,getDimensions:Ge,getScale:Q,isElement:G,isRTL:Ze};function $e(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function et(e,t,n){let r=null,i,a=W(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let g=_(d),v=_(a.clientWidth-(u+f)),y=_(a.clientHeight-(d+p)),b=_(u),x={rootMargin:-g+`px `+-v+`px `+-y+`px `+-b+`px`,threshold:h(0,m(1,c))||1},S=!0;function C(t){let n=t[0].intersectionRatio;if(!$e(l,e.getBoundingClientRect()))return s();if(n!==c){if(!S)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}S=!1}try{r=new IntersectionObserver(C,{...x,root:a.ownerDocument})}catch{r=new IntersectionObserver(C,x)}r.observe(e)}let c=U(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function tt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Ae(e),u=i||a?[...l?Z(l):[],...t?Z(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?et(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?$(e):null;c&&g();function g(){let t=$(e);h&&!$e(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var nt=ue,rt=de,it=ie,at=pe,ot=se,st=re,ct=fe,lt=(e,t,n)=>{let r=new Map,i=n??{},a={...Qe,...i.platform,_c:r};return ne(e,t,{...i,platform:a})},ut=typeof document<`u`?d.useLayoutEffect:function(){};function dt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!dt(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!dt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function ft(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function pt(e,t){let n=ft(e);return Math.round(t*n)/n}function mt(e){let t=d.useRef(e);return ut(()=>{t.current=e}),t}function ht(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:u}=e,[f,p]=d.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=d.useState(r);dt(m,r)||h(r);let[g,_]=d.useState(null),[v,y]=d.useState(null),b=d.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=d.useCallback(e=>{e!==T.current&&(T.current=e,y(e))},[]),S=a||g,C=o||v,w=d.useRef(null),T=d.useRef(null),E=d.useRef(f),D=c!=null,O=mt(c),k=mt(i),A=mt(u),j=d.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:m};k.current&&(e.platform=k.current),lt(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!dt(E.current,t)&&(E.current=t,l.flushSync(()=>{p(t)}))})},[m,t,n,k,A]);ut(()=>{u===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[u]);let M=d.useRef(!1);ut(()=>(M.current=!0,()=>{M.current=!1}),[]),ut(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,j);j()}},[S,C,j,O,D]);let N=d.useMemo(()=>({reference:w,floating:T,setReference:b,setFloating:x}),[b,x]),P=d.useMemo(()=>({reference:S,floating:C}),[S,C]),F=d.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=pt(P.floating,f.x),r=pt(P.floating,f.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...ft(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,f.x,f.y]);return d.useMemo(()=>({...f,update:j,refs:N,elements:P,floatingStyles:F}),[f,j,N,P,F])}var gt=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:st({element:r.current,padding:i}).fn(n):r?st({element:r,padding:i}).fn(n):{}}}},_t=(e,t)=>{let n=nt(e);return{name:n.name,fn:n.fn,options:[e,t]}},vt=(e,t)=>{let n=rt(e);return{name:n.name,fn:n.fn,options:[e,t]}},yt=(e,t)=>({fn:ct(e).fn,options:[e,t]}),bt=(e,t)=>{let n=it(e);return{name:n.name,fn:n.fn,options:[e,t]}},xt=(e,t)=>{let n=at(e);return{name:n.name,fn:n.fn,options:[e,t]}},St=(e,t)=>{let n=ot(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ct=(e,t)=>{let n=gt(e);return{name:n.name,fn:n.fn,options:[e,t]}},wt=`Arrow`,Tt=d.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,u.jsx)(c.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,u.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Tt.displayName=wt;var Et=Tt,Dt=`Popper`,[Ot,kt]=a(Dt),[At,jt]=Ot(Dt),Mt=e=>{let{__scopePopper:t,children:n}=e,[r,i]=d.useState(null),[a,o]=d.useState(void 0);return(0,u.jsx)(At,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};Mt.displayName=Dt;var Nt=`PopperAnchor`,Pt=d.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...a}=e,o=jt(Nt,n),s=d.useRef(null),l=o.onAnchorChange,f=i(t,d.useCallback(e=>{s.current=e,e&&l(e)},[l])),p=d.useRef(null);d.useEffect(()=>{if(!r)return;let e=p.current;p.current=r.current,e!==p.current&&l(p.current)});let m=o.placementState&&Wt(o.placementState),h=m?.[0],g=m?.[1];return r?null:(0,u.jsx)(c.div,{"data-radix-popper-side":h,"data-radix-popper-align":g,...a,ref:f})});Pt.displayName=Nt;var Ft=`PopperContent`,[It,Lt]=Ot(Ft),Rt=d.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:a=0,align:l=`center`,alignOffset:p=0,arrowPadding:m=0,avoidCollisions:h=!0,collisionBoundary:g=[],collisionPadding:_=0,sticky:v=`partial`,hideWhenDetached:y=!1,updatePositionStrategy:b=`optimized`,onPlaced:x,...S}=e,C=jt(Ft,n),[w,T]=d.useState(null),E=i(t,T),[D,O]=d.useState(null),k=f(D),A=k?.width??0,j=k?.height??0,M=r+(l===`center`?``:`-`+l),N=typeof _==`number`?_:{top:0,right:0,bottom:0,left:0,..._},P=Array.isArray(g)?g:[g],F=P.length>0,I={padding:N,boundary:P.filter(Ht),altBoundary:F},{refs:L,floatingStyles:R,placement:z,isPositioned:B,middlewareData:V}=ht({strategy:`fixed`,placement:M,whileElementsMounted:(...e)=>tt(...e,{animationFrame:b===`always`}),elements:{reference:C.anchor},middleware:[_t({mainAxis:a+j,alignmentAxis:p}),h&&vt({mainAxis:!0,crossAxis:!1,limiter:v===`partial`?yt():void 0,...I}),h&&bt({...I}),xt({...I,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),D&&Ct({element:D,padding:m}),Ut({arrowWidth:A,arrowHeight:j}),y&&St({strategy:`referenceHidden`,...I,boundary:F?I.boundary:void 0})]}),ee=C.setPlacementState;s(()=>(ee(z),()=>{ee(void 0)}),[z,ee]);let[te,ne]=Wt(z),re=o(x);s(()=>{B&&re?.()},[B,re]);let ie=V.arrow?.x,ae=V.arrow?.y,oe=V.arrow?.centerOffset!==0,[se,ce]=d.useState();return s(()=>{w&&ce(window.getComputedStyle(w).zIndex)},[w]),(0,u.jsx)(`div`,{ref:L.setFloating,"data-radix-popper-content-wrapper":``,style:{...R,transform:B?R.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:se,"--radix-popper-transform-origin":[V.transformOrigin?.x,V.transformOrigin?.y].join(` `),...V.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,u.jsx)(It,{scope:n,placedSide:te,placedAlign:ne,onArrowChange:O,arrowX:ie,arrowY:ae,shouldHideArrow:oe,children:(0,u.jsx)(c.div,{"data-side":te,"data-align":ne,...S,ref:E,style:{...S.style,animation:B?void 0:`none`}})})})});Rt.displayName=Ft;var zt=`PopperArrow`,Bt={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Vt=d.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Lt(zt,n),a=Bt[i.placedSide];return(0,u.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,u.jsx)(Et,{...r,ref:t,style:{...r.style,display:`block`}})})});Vt.displayName=zt;function Ht(e){return e!==null}var Ut=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Wt(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function Wt(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Gt=Mt,Kt=Pt,qt=Rt,Jt=Vt;export{kt as a,Gt as i,Jt as n,f as o,qt as r,Kt as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./utils-CzkLr94M.js";var t=e(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),n=e(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]);export{t as n,n as t};
@@ -1 +0,0 @@
1
- import{a as e,s as t,u as n}from"./bundle-mjs-BegPhL5c.js";import{a as r}from"./centered-state-DzJJpXgm.js";import{n as i,r as a,t as o}from"./utils-CzkLr94M.js";import{n as s,t as c}from"./folder-20ea3OVM.js";import{n as l}from"./tab-link-DkVxOa-q.js";import{t as u}from"./file-tuE95HNX.js";import{a as d,i as f,r as p}from"./use-desktop-6PwFeCW3.js";import{t as m}from"./git-pull-request-BztcgsRZ.js";import{t as h}from"./square-terminal-D9l_Xx7B.js";import{t as g}from"./upload-yxUM9nk5.js";import{D as _,E as v,H as y,M as b,O as x,j as S}from"./index-h4gyDJyh.js";var C=a(`file-diff`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),w=n(t(),1),T=e();function E({root:e,selected:t,onSelect:n}){return(0,T.jsx)(`nav`,{"data-slot":`changes-tree`,"aria-label":`Changed files`,className:`min-w-0 text-[13px]`,children:(0,T.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,T.jsx)(O,{dir:e,depth:0,selected:t,onSelect:n},e.path)),e.files.map(e=>(0,T.jsx)(A,{file:e,depth:0,selected:t,onSelect:n},e.path))]})})}function D({adds:e,dels:t}){return(0,T.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] font-medium tabular-nums`,children:[e>0?(0,T.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}):null,e>0&&t>0?` `:null,t>0?(0,T.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]}):null]})}function O({dir:e,depth:t,selected:n,onSelect:r}){let[i,a]=(0,w.useState)(!0);return(0,T.jsxs)(`li`,{children:[(0,T.jsxs)(`button`,{type:`button`,"data-slot":`tree-dir`,"data-path":e.path,"data-state":i?`open`:`closed`,"aria-expanded":i,onClick:()=>a(e=>!e),className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+t*14}px`},children:[(0,T.jsx)(y,{"aria-hidden":`true`,className:o(`size-3.5 shrink-0 transition-transform`,i&&`rotate-90`)}),(0,T.jsx)(c,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,T.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name}),(0,T.jsx)(D,{adds:e.adds,dels:e.dels})]}),i?(0,T.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,T.jsx)(O,{dir:e,depth:t+1,selected:n,onSelect:r},e.path)),e.files.map(e=>(0,T.jsx)(A,{file:e,depth:t+1,selected:n,onSelect:r},e.path))]}):null]})}var k={added:`text-success`,deleted:`text-danger`};function A({file:e,depth:t,selected:n,onSelect:r}){let i=n===e.path;return(0,T.jsx)(`li`,{children:(0,T.jsxs)(`button`,{type:`button`,"data-slot":`tree-file`,"data-path":e.path,"aria-current":i?`true`:void 0,onClick:()=>r(e.path),className:o(`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,i?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${24+t*14}px`},children:[(0,T.jsx)(u,{"aria-hidden":`true`,className:o(`size-3.5 shrink-0`,k[e.status])}),(0,T.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,T.jsx)(D,{adds:e.adds,dels:e.dels})]})})}function j(e,t){return{kind:`dir`,name:e,path:t,dirs:[],files:[],adds:0,dels:0,fileCount:0}}function M(e){let t=e;for(;t.files.length===0&&t.dirs.length===1;){let e=t.dirs[0];t={...e,name:`${t.name}/${e.name}`}}return{...t,dirs:t.dirs.map(M)}}var N=(e,t)=>e.name.localeCompare(t.name);function P(e){let t=j(``,``),n=new Map([[``,t]]),r=e=>{let t=n.get(e);if(t)return t;let i=e.lastIndexOf(`/`),a=r(i===-1?``:e.slice(0,i)),o=j(i===-1?e:e.slice(i+1),e);return a.dirs.push(o),n.set(e,o),o};for(let t of e){let e=t.path.lastIndexOf(`/`);r(e===-1?``:t.path.slice(0,e)).files.push({kind:`file`,name:e===-1?t.path:t.path.slice(e+1),path:t.path,status:t.status,adds:t.adds,dels:t.dels,binary:t.binary})}let i=e=>{e.dirs.forEach(i),e.adds=e.files.reduce((e,t)=>e+t.adds,0)+e.dirs.reduce((e,t)=>e+t.adds,0),e.dels=e.files.reduce((e,t)=>e+t.dels,0)+e.dirs.reduce((e,t)=>e+t.dels,0),e.fileCount=e.files.length+e.dirs.reduce((e,t)=>e+t.fileCount,0),e.dirs.sort(N),e.files.sort(N)};return i(t),{...t,dirs:t.dirs.map(M)}}function F({bar:e,branch:t,stat:n,mode:i,wrap:a,onModeChange:o,onWrapChange:c,onAction:l}){return(0,T.jsxs)(`div`,{"data-slot":`git-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[t?(0,T.jsx)(p,{branch:t}):null,n?(0,T.jsx)(R,{stat:n}):null,(0,T.jsxs)(`span`,{className:`ml-auto flex items-center gap-1`,children:[(0,T.jsx)(`span`,{className:`hidden items-center gap-1 md:flex`,children:(0,T.jsx)(f,{mode:i,wrap:a,onModeChange:o,onWrapChange:c})}),e.secondary.map(e=>(0,T.jsx)(L,{action:e,variant:`outline`,onAction:l},e.id)),(0,T.jsx)(L,{action:e.primary,variant:`primary`,onAction:l}),e.menu.length>0?(0,T.jsxs)(v,{children:[(0,T.jsx)(S,{asChild:!0,children:(0,T.jsx)(r,{variant:`ghost`,size:`icon-sm`,"aria-label":`More git actions`,children:(0,T.jsx)(s,{"aria-hidden":`true`})})}),(0,T.jsx)(_,{align:`end`,"data-slot":`git-toolbar-menu`,children:e.menu.map(e=>(0,T.jsxs)(x,{disabled:!e.enabled,title:e.reason,onSelect:()=>l(e.id),children:[I[e.id],e.label]},e.id))})]}):null]})]})}var I={commit:(0,T.jsx)(d,{"aria-hidden":`true`}),push:(0,T.jsx)(g,{"aria-hidden":`true`}),"create-pr":(0,T.jsx)(m,{"aria-hidden":`true`}),"view-pr":(0,T.jsx)(l,{"aria-hidden":`true`}),"open-terminal":(0,T.jsx)(h,{"aria-hidden":`true`})};function L({action:e,variant:t,onAction:n}){return e.id===`view-pr`?i(e.href)?(0,T.jsx)(r,{asChild:!0,variant:t,size:`sm`,"data-action":e.id,children:(0,T.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:[I[e.id],e.label]})}):(0,T.jsxs)(r,{variant:t,size:`sm`,"data-action":e.id,disabled:!0,title:`View PR unavailable — the recorded PR link is not an http(s) URL`,children:[I[e.id],e.label]}):(0,T.jsxs)(r,{variant:t,size:`sm`,"data-action":e.id,disabled:!e.enabled,title:e.enabled?void 0:e.reason,onClick:()=>n(e.id),children:[I[e.id],e.label]})}function R({stat:e}){return(0,T.jsx)(`span`,{"data-slot":`changes-stat`,children:(0,T.jsx)(b,{stat:{adds:z(e.adds),dels:z(e.dels),files:e.files}})})}function z(e){let[t,n]=(0,w.useState)(e),r=(0,w.useRef)(e);return(0,w.useEffect)(()=>{let t=r.current;if(t===e)return;if(typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||typeof requestAnimationFrame!=`function`){r.current=e,n(e);return}let i=performance.now(),a=0,o=s=>{let c=Math.min(1,(s-i)/350),l=1-(1-c)**3;n(Math.round(t+(e-t)*l)),c<1?a=requestAnimationFrame(o):r.current=e};return a=requestAnimationFrame(o),()=>{cancelAnimationFrame(a),r.current=e,n(e)}},[e]),t}export{C as a,E as i,F as n,P as r,R as t};
@@ -1 +0,0 @@
1
- import{a as e,s as t,u as n}from"./bundle-mjs-BegPhL5c.js";import{A as r,Bt as i,D as a,Ht as o,J as s,Mt as c,Pt as l,Wt as u,X as d,Z as f,a as p,ft as m,i as h,k as g,ot as _,t as v,wt as ee}from"./centered-state-DzJJpXgm.js";import{n as y,r as b,t as x}from"./utils-CzkLr94M.js";import{t as S}from"./arrow-left-bEsJ-6jp.js";import{a as C,i as te,n as w}from"./skill-detail-DsD4-dGp.js";import{n as T}from"./loader-circle-Bnw4ga19.js";import{a as E,d as D,i as O,o as k,r as A,s as j,t as M,u as ne}from"./command-eBgVGftz.js";import{n as N,t as re}from"./tab-link-DkVxOa-q.js";import{a as ie,f as P,l as F,n as I,o as ae,r as L,s as R,u as z}from"./prompt-templates-CsGr-FXH.js";import{t as oe}from"./git-pull-request-BztcgsRZ.js";import{t as se}from"./refresh-cw-B4NW5q60.js";import{t as ce}from"./triangle-alert-DJUyRhTV.js";import{t as B}from"./x-DaR4ZfE-.js";import{r as V,t as H}from"./markdown-DxmCMr30.js";import{c as U,i as W,l as G,s as le,t as ue,u as K}from"./skills-B13iqWAN.js";import{C as de,L as fe,N as pe,P as me,S as he,b as ge,w as _e,x as ve}from"./index-h4gyDJyh.js";var q=b(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),ye=b(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),be=b(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),J=n(t(),1),Y=e();function X({className:e,...t}){return(0,Y.jsx)(`div`,{"data-slot":`skeleton`,className:x(`animate-pulse rounded-md bg-accent`,e),...t})}function Z(e,t=[]){let n=`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`;return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=`\n\nUse these skills where relevant: ${t.join(`, `)}.`),n}function xe(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function Se(e,t,n,r){let i=r?.trim();return t?{workflow:t,task:i||Z(e,n)}:n.length?{steps:xe(n),task:i||Z(e)}:{workflow:`quick-task`,task:i||Z(e)}}function Ce(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function we(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body}`.toLowerCase().includes(n))}function Te(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}var Ee={workflow:null,skills:[]},De=`cez-followup-selection`;function Oe(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.filter(e=>typeof e==`string`):[]}}function ke(){try{let e=localStorage.getItem(De);return e?Oe(JSON.parse(e)):{...Ee}}catch{return{...Ee}}}function Ae(e){try{localStorage.setItem(De,JSON.stringify(e))}catch{}}var Q=`cez-followup-prompt:`;function je(e){try{return localStorage.getItem(Q+e)??``}catch{return``}}function Me(e,t){try{t===``?localStorage.removeItem(Q+e):localStorage.setItem(Q+e,t)}catch{}}function Ne({item:e,workflows:t,skills:n,workflow:r,onWorkflowChange:i,selectedSkills:s,onSkillsChange:l,queuedRunId:f,onQueued:m}){let g=u(),v=d(),y=s.filter(e=>n.some(t=>t.name===e)),[b,x]=(0,J.useState)(()=>je(e.url)),S=(0,J.useRef)(null);(0,J.useEffect)(()=>{Me(e.url,b)},[e.url,b]);let C=(0,J.useMemo)(()=>ie(v.data?.promptTemplates),[v.data?.promptTemplates]),te=e=>{let t=S.current?.selectionStart??b.length,n=L(b,t,e);x(n.text),requestAnimationFrame(()=>{S.current?.focus(),S.current?.setSelectionRange(n.caret,n.caret)})},w=I(C,y),E=(0,J.useRef)(b);E.current=b;let D=(0,J.useRef)(``);(0,J.useEffect)(()=>{let e=ae(E.current,D.current,w);D.current=e.applied,e.text!==E.current&&x(e.text)},[w]);let O=o({mutationFn:()=>_(Se(e,r,y,b)),onSuccess:t=>{let n=`runs`in t?t.runs[0]:t;n&&m(e.url,n.id),y.length>0&&v.data!==void 0&&ee({skillUsage:y.reduce((e,t)=>ue(e,t),v.data.skillUsage)}).then(()=>g.invalidateQueries({queryKey:a.uiState})).catch(()=>{}),Me(e.url,``),x(``),g.invalidateQueries({queryKey:a.runs.all})},onError:e=>h(e.message,{tone:`danger`})}),k=e=>{ge({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),O.isPending||O.mutate())},A=e=>l(s.includes(e)?s.filter(t=>t!==e):[...s,e]);return(0,Y.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Y.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:[(0,Y.jsx)(pe,{"aria-hidden":`true`,className:`size-3.5 text-violet`}),`Hand this to the agent`]}),(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(Fe,{workflows:t,value:r,onChange:i}),(0,Y.jsx)(Ie,{skills:n,selected:y,onToggle:A}),(0,Y.jsx)(de,{templates:C,onInsert:te})]}),y.length>0?(0,Y.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:y.map(e=>(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>A(e),title:`Remove this skill`,className:`inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-px font-mono text-[11px] font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,Y.jsx)(B,{"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,Y.jsx)(he,{ref:S,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:b,onChange:e=>x(e.target.value),onKeyDown:k,placeholder:`Add instructions for the agent… (empty uses the default "${e.kind===`pr`?`Address`:`Fix`} #${e.number}" prompt)`,className:`mt-3 min-h-20 text-[13px]`}),(0,Y.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2.5`,children:[(0,Y.jsxs)(p,{variant:`contrast`,"data-action":`gh-run`,disabled:O.isPending,onClick:()=>O.mutate(),children:[(0,Y.jsx)(fe,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,e.kind===`pr`?`PR`:`issue`]}),(0,Y.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[10.5px] font-medium text-muted-foreground`,children:ve()}),f?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Y.jsx)(T,{"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Y.jsx)(c,{to:`/tasks/${f}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-violet hover:underline`,children:`View task →`})]}):null]})]})}var Pe=`inline-flex h-[26px] items-center gap-1.5 rounded-full border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`;function Fe({workflows:e,value:t,onChange:n}){let[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(``),s=(0,J.useRef)(null),c=G(e,a);return(0,Y.jsxs)(R,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,Y.jsx)(z,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:x(Pe,t&&`border-foreground/60 font-mono text-[11.5px] font-semibold text-foreground`),children:[(0,Y.jsx)(C,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),(0,Y.jsx)(`span`,{className:`max-w-44 truncate`,children:t??`workflow`}),(0,Y.jsx)(D,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Y.jsx)(F,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Y.jsxs)(M,{shouldFilter:!1,children:[(0,Y.jsx)(E,{placeholder:`search workflows…`,value:a,onValueChange:o,onInput:()=>s.current?.scrollTo(0,0)}),(0,Y.jsxs)(j,{ref:s,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[c.length===0?(0,Y.jsx)(A,{children:`Nothing matches.`}):null,(0,Y.jsx)(O,{children:c.map(e=>{let r=t===e.name;return(0,Y.jsxs)(k,{value:`workflow ${e.name}`,keywords:K(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),i(!1)},children:[(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,Y.jsx)(T,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},e.name)})})]})]})})]})}function Ie({skills:e,selected:t,onToggle:n}){let[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(null),l=(0,J.useRef)(null),u=U(e,a),d=u.filter(W),f=u.filter(e=>!W(e)),p=(e,r)=>{let i=t.includes(e.name);return(0,Y.jsxs)(k,{value:`skill ${e.name} ${e.path}`,keywords:K(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.name,"data-selected":i?`true`:void 0,onSelect:()=>n(e.name),children:[(0,Y.jsx)(`span`,{className:x(`shrink-0 font-mono text-xs`,r&&`font-semibold`),children:e.name}),e.description?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Y.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),c(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Y.jsx)(P,{"aria-hidden":`true`,className:`size-3.5`})}),i?(0,Y.jsx)(T,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.path)};return e.length===0?null:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(w,{skill:s,onClose:()=>c(null)}),(0,Y.jsxs)(R,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,Y.jsx)(z,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:x(Pe,t.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Y.jsx)(me,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),`skills`,t.length>0?` · ${t.length}`:``,(0,Y.jsx)(D,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Y.jsx)(F,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Y.jsxs)(M,{shouldFilter:!1,children:[(0,Y.jsx)(E,{placeholder:`search skills…`,value:a,onValueChange:o,onInput:()=>l.current?.scrollTo(0,0)}),(0,Y.jsxs)(j,{ref:l,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[d.length===0&&f.length===0?(0,Y.jsx)(A,{children:`Nothing matches.`}):null,d.length>0?(0,Y.jsx)(O,{heading:`Project skills`,children:d.map(e=>p(e,!0))}):null,f.length>0?(0,Y.jsx)(O,{heading:`Global`,children:f.map(e=>p(e,!1))}):null]})]})})]})]})}var Le=30,Re=1e3;function ze(){return d().data?.githubView===`prs`?(0,Y.jsx)(l,{to:`/github/prs`,replace:!0}):(0,Y.jsx)(Be,{view:`issues`})}function Be({view:e}){let{n:t}=i(),n=g(),r=g({limit:Re},n.data?.available===!0),c=r.data?.available?r.data:n.data,l=r.data?.available===!0,_=u(),y=e=>{_.setQueryData(a.uiState,t=>({...t,githubView:e})),ee({githubView:e}).then(e=>_.setQueryData(a.uiState,e)).catch(e=>{h(e instanceof Error?e.message:String(e),{tone:`danger`}),_.invalidateQueries({queryKey:a.uiState})})},b=o({mutationFn:()=>m({refresh:!0}),onSuccess:e=>{_.setQueryData(a.github({}),e),_.invalidateQueries({queryKey:a.github({limit:Re})})},onError:e=>h(e.message,{tone:`danger`})}),S=f(),C=s(),w=d(),[T,E]=(0,J.useState)(()=>ke().workflow),[D,O]=(0,J.useState)(()=>ke().skills);(0,J.useEffect)(()=>{Ae({workflow:T,skills:[...D]})},[T,D]);let k=S.data?.workflows;(0,J.useEffect)(()=>{k&&T!==null&&!k.some(e=>e.name===T)&&E(null)},[k,T]);let A=C.data,j=w.data?.skillUsage,M=(0,J.useMemo)(()=>le(A??[],j),[A,j]),[N,ie]=(0,J.useState)(new Map),[P,F]=(0,J.useState)(``),[I,ae]=(0,J.useState)([]);if(!c)return n.isError?(0,Y.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(v,{icon:(0,Y.jsx)(ce,{}),tone:`danger`,title:`Could not load GitHub`,subtitle:n.error.message})}):(0,Y.jsx)(_e,{});if(!c.available)return(0,Y.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(v,{icon:(0,Y.jsx)(te,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:c.reason??`unknown reason`,actions:(0,Y.jsx)(p,{variant:`outline`,"data-action":`gh-retry`,disabled:b.isPending,onClick:()=>b.mutate(),children:`Try again`}),children:(0,Y.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,Y.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,Y.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in cezar works without it.`]})})});let L=e===`issues`?c.issues:c.prs,R=c.labelColors??{},z=Ce(L),B=we(L,{query:P,labels:I}),H=P.trim()!==``||I.length>0,U=t===void 0?null:Number.parseInt(t,10),W=U===null?B[0]??null:L.find(e=>e.number===U)??null,G=e===`issues`?`/github`:`/github/prs`;return(0,Y.jsxs)(`div`,{"data-route":`github`,className:`flex h-full min-h-0 items-stretch`,children:[(0,Y.jsxs)(`section`,{"data-slot":`gh-list`,className:x(`w-full min-h-0 flex-col overflow-y-auto overscroll-contain border-border md:flex md:w-[360px] md:shrink-0 md:border-r`,t===void 0?`flex`:`hidden`),children:[(0,Y.jsxs)(`header`,{"data-slot":`gh-header`,className:`sticky top-0 z-10 border-b border-border bg-background/95 px-4 pt-3 backdrop-blur`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,Y.jsx)(`h1`,{className:`text-lg font-semibold`,children:`GitHub`}),c.repo?(0,Y.jsx)(`span`,{"data-slot":`gh-repo`,className:`min-w-0 truncate font-mono text-[11px] text-soft-foreground`,children:c.repo}):null,(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:b.isPending,onClick:()=>b.mutate(),className:`ml-auto flex shrink-0 items-center gap-1 rounded-full border border-border px-1.5 py-px text-[10px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[(0,Y.jsx)(se,{"aria-hidden":`true`,className:x(`size-[9px]`,b.isPending&&`motion-safe:animate-spin`)}),c.syncedAt?`synced ${V(c.syncedAt)} ago`:`refresh`]})]}),(0,Y.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,Y.jsxs)(re,{to:`/github`,active:e===`issues`,onClick:()=>y(`issues`),children:[`Issues · `,Ve(c.issues.length,l)]}),(0,Y.jsxs)(re,{to:`/github/prs`,active:e===`prs`,onClick:()=>y(`prs`),children:[`Pull requests · `,Ve(c.prs.length,l)]})]}),(0,Y.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-2 pb-3`,children:[(0,Y.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,Y.jsx)(ne,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,Y.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:`Search #id, title, author…`,value:P,onChange:e=>F(e.target.value),className:`w-full rounded-md border border-input bg-card py-1 pr-2 pl-7 text-[13px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,Y.jsx)(Ue,{options:z,colors:R,selected:I,onChange:ae})]})]}),B.length===0?(0,Y.jsx)(`p`,{className:`px-4 py-4 text-sm text-soft-foreground`,children:H?`No ${e===`issues`?`issues`:`pull requests`} match your filter.`:`No open ${e===`issues`?`issues`:`pull requests`}.`}):(0,Y.jsx)(`ul`,{"data-slot":`gh-rows`,className:`flex flex-col gap-0.5 px-2 py-2`,children:B.map(t=>(0,Y.jsx)(He,{item:t,view:e,colors:R,active:W?.url===t.url,queued:N.has(t.url)},t.url))})]}),(0,Y.jsx)(`section`,{"data-slot":`gh-detail`,className:x(`min-w-0 min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain`,t===void 0?`hidden md:flex`:`flex`),children:W?(0,Y.jsx)(We,{item:W,listPath:G,colors:R,children:(0,Y.jsx)(Ne,{item:W,workflows:S.data?.workflows??[],skills:M,workflow:T,onWorkflowChange:E,selectedSkills:D,onSkillsChange:O,queuedRunId:N.get(W.url)??null,onQueued:(e,t)=>ie(n=>new Map(n).set(e,t))},W.url)}):(0,Y.jsx)(v,{icon:e===`issues`?(0,Y.jsx)(q,{}):(0,Y.jsx)(oe,{}),tone:`neutral`,heading:`h2`,title:U===null?`Nothing selected`:`Not in the open list`,subtitle:U===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${U} is not among the open ${e===`issues`?`issues`:`pull requests`} — it may be closed, or still outside the fetched batch.`})})]})}function Ve(e,t){return`${e}${!t&&e>=Le?`+`:``}`}function He({item:e,view:t,colors:n,active:r,queued:i}){let a=e.kind===`issue`?q:oe;return(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(c,{to:`${t===`issues`?`/github/issues`:`/github/prs`}/${e.number}`,draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,Z(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},"data-slot":`gh-row`,"data-number":e.number,"aria-current":r?`page`:void 0,title:`Drag into the composer to prefill a task`,className:x(`flex flex-col gap-1 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,r&&`bg-muted`),children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(a,{"aria-hidden":`true`,className:x(`size-3.5 shrink-0`,e.kind===`issue`?`text-success`:`text-violet`)}),(0,Y.jsx)(`span`,{className:x(`min-w-0 truncate text-[13px] font-medium`,r&&`font-semibold`),children:e.title})]}),(0,Y.jsxs)(`span`,{className:`flex items-center gap-2 pl-[22px] font-mono text-[10.5px] text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{children:[`#`,e.number]}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:e.author}),(0,Y.jsx)(`span`,{children:V(e.createdAt)}),(0,Y.jsx)(Ze,{count:e.comments}),e.checks?(0,Y.jsx)($e,{checks:e.checks}):null,i?(0,Y.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-violet`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,Y.jsx)(`span`,{className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,Y.jsx)($,{label:e,color:n[e]},e))}):null]})})}function Ue({options:e,colors:t,selected:n,onChange:r}){let[i,a]=(0,J.useState)(!1),o=e=>r(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,Y.jsxs)(R,{open:i,onOpenChange:a,children:[(0,Y.jsx)(z,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:x(`flex shrink-0 items-center gap-1 rounded-md border border-input bg-card px-2 py-1 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50`,n.length>0&&`border-primary/60 text-foreground`),children:[(0,Y.jsx)(be,{"aria-hidden":`true`,className:`size-3.5`}),n.length>0?`Labels · ${n.length}`:`Labels`]})}),(0,Y.jsx)(F,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,Y.jsxs)(M,{children:[(0,Y.jsx)(E,{placeholder:`Filter labels…`}),(0,Y.jsxs)(j,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Y.jsx)(A,{children:`No labels.`}),n.length>0?(0,Y.jsxs)(k,{value:`__clear__`,onSelect:()=>r([]),className:`text-soft-foreground`,children:[`Clear `,n.length,` filter`,n.length>1?`s`:``]}):null,e.map(e=>{let r=n.includes(e);return(0,Y.jsxs)(k,{value:e,onSelect:()=>o(e),children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:Te(t[e])}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,Y.jsx)(T,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e)})]})]})})]})}function $({label:e,color:t}){return(0,Y.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:Te(t),className:`rounded-full border px-1.5 py-px text-[10px] font-medium`,children:e})}function We({item:e,listPath:t,colors:n,children:r}){let i=e.kind===`pr`?`pull request`:`issue`,a=e.kind===`pr`&&!!(e.additions||e.deletions);return(0,Y.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Y.jsxs)(c,{to:t,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,Y.jsx)(S,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),(0,Y.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[10.5px] text-soft-foreground`,children:[(0,Y.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,Y.jsx)(`span`,{children:i}),`·`,(0,Y.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Y.jsxs)(`span`,{children:[V(e.createdAt),` ago`]}),e.comments?(0,Y.jsxs)(Y.Fragment,{children:[`·`,(0,Y.jsx)(Ze,{count:e.comments})]}):null,a?(0,Y.jsxs)(Y.Fragment,{children:[`·`,(0,Y.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,Y.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions??0]}),` `,(0,Y.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions??0]})]})]}):null,`·`,y(e.url)?(0,Y.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Y.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,Y.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]}),(0,Y.jsx)(`h2`,{className:`mt-2 text-xl leading-snug font-semibold`,children:e.title}),e.labels.length>0||e.checks?(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Y.jsx)($,{label:e,color:n[e]},e)),e.checks?(0,Y.jsx)(Qe,{checks:e.checks,url:e.url}):null]}):null,(0,Y.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:e.body?(0,Y.jsx)(H,{children:e.body}):(0,Y.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,Y.jsx)(Ge,{item:e}),r]})}function Ge({item:e}){let t=r(e.kind,e.number),n=t.data;return t.isPending?(0,Y.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,Y.jsx)(X,{className:`mb-3 h-3 w-24`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsx)(X,{className:`h-14 w-full`}),(0,Y.jsx)(X,{className:`h-14 w-full`})]})]}):!n||!n.available?(0,Y.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,Y.jsxs)(`span`,{children:[`Couldn’t load comments — `,n?.reason??(t.error instanceof Error?t.error.message:`could not load comments`),`. `]}),(0,Y.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Y.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})]})]}):n.comments.length===0?null:(0,Y.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Y.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-soft-foreground uppercase`,children:[`Comments · `,n.comments.length]}),(0,Y.jsx)(`ul`,{className:`flex flex-col gap-5`,children:n.comments.map(e=>(0,Y.jsx)(qe,{comment:e},`${e.kind}-${e.id}`))}),n.truncated?(0,Y.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-soft-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,Y.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var Ke={approved:{label:`approved`,tone:`border-success/40 text-success`},changes_requested:{label:`changes requested`,tone:`border-danger/40 text-danger`},commented:{label:`commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`dismissed`,tone:`border-border text-muted-foreground`}};function qe({comment:e}){let t=e.reviewState?Ke[e.reviewState]:null;return(0,Y.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,Y.jsx)(Je,{url:e.avatarUrl,login:e.author}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Y.jsx)(`span`,{children:V(e.createdAt)}),t?(0,Y.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:x(`rounded-full border px-1.5 py-px font-sans text-[10px] font-medium`,t.tone),children:t.label}):null,(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Y.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,Y.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,Y.jsx)(H,{children:e.body}):(0,Y.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function Je({url:e,login:t}){let[n,r]=(0,J.useState)(!1);return e&&!n?(0,Y.jsx)(`img`,{src:e,alt:``,width:16,height:16,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-4 shrink-0 rounded-full`}):(0,Y.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var Ye={passing:`✓`,failing:`✗`,pending:`○`},Xe={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function Ze({count:e}){return e?(0,Y.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,Y.jsx)(ye,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function Qe({checks:e,url:t}){let n=x(`text-[11px] font-medium`,Xe[e],t&&`hover:underline`),r=`${Ye[e]} checks ${e}`;return t?(0,Y.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,Y.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function $e({checks:e}){return(0,Y.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:x(`shrink-0 font-sans text-[11px] font-semibold`,Xe[e]),children:Ye[e]})}export{ze as GithubIndexRoute,Be as GithubRoute};