@shepai/cli 1.90.1 → 1.91.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/dist/packages/core/src/application/ports/output/services/worktree-service.interface.d.ts +6 -0
  2. package/dist/packages/core/src/application/ports/output/services/worktree-service.interface.d.ts.map +1 -1
  3. package/dist/packages/core/src/application/use-cases/features/cleanup-feature-worktree.use-case.d.ts.map +1 -1
  4. package/dist/packages/core/src/application/use-cases/features/cleanup-feature-worktree.use-case.js +8 -0
  5. package/dist/packages/core/src/infrastructure/services/git/worktree.service.d.ts +1 -0
  6. package/dist/packages/core/src/infrastructure/services/git/worktree.service.d.ts.map +1 -1
  7. package/dist/packages/core/src/infrastructure/services/git/worktree.service.js +8 -0
  8. package/dist/src/presentation/web/app/actions/get-feature-phase-timings.d.ts +1 -0
  9. package/dist/src/presentation/web/app/actions/get-feature-phase-timings.d.ts.map +1 -1
  10. package/dist/src/presentation/web/app/actions/get-feature-phase-timings.js +3 -0
  11. package/dist/src/presentation/web/app/api/attachments/preview/route.d.ts.map +1 -1
  12. package/dist/src/presentation/web/app/api/attachments/preview/route.js +47 -11
  13. package/dist/src/presentation/web/components/common/feature-drawer-tabs/activity-tab.d.ts.map +1 -1
  14. package/dist/src/presentation/web/components/common/feature-drawer-tabs/activity-tab.js +9 -6
  15. package/dist/src/presentation/web/components/common/feature-drawer-tabs/overview-tab.d.ts.map +1 -1
  16. package/dist/src/presentation/web/components/common/feature-drawer-tabs/overview-tab.js +2 -1
  17. package/dist/src/presentation/web/components/common/inline-attachments/index.d.ts +3 -0
  18. package/dist/src/presentation/web/components/common/inline-attachments/index.d.ts.map +1 -0
  19. package/dist/src/presentation/web/components/common/inline-attachments/index.js +1 -0
  20. package/dist/src/presentation/web/components/common/inline-attachments/inline-attachments.d.ts +20 -0
  21. package/dist/src/presentation/web/components/common/inline-attachments/inline-attachments.d.ts.map +1 -0
  22. package/dist/src/presentation/web/components/common/inline-attachments/inline-attachments.js +72 -0
  23. package/dist/src/presentation/web/components/common/inline-attachments/inline-attachments.stories.d.ts +16 -0
  24. package/dist/src/presentation/web/components/common/inline-attachments/inline-attachments.stories.d.ts.map +1 -0
  25. package/dist/src/presentation/web/components/common/inline-attachments/inline-attachments.stories.js +46 -0
  26. package/dist/tsconfig.build.tsbuildinfo +1 -1
  27. package/package.json +1 -1
  28. package/web/.next/BUILD_ID +1 -1
  29. package/web/.next/build-manifest.json +2 -2
  30. package/web/.next/fallback-build-manifest.json +2 -2
  31. package/web/.next/prerender-manifest.json +3 -3
  32. package/web/.next/required-server-files.js +1 -1
  33. package/web/.next/required-server-files.json +1 -1
  34. package/web/.next/server/app/(dashboard)/@drawer/create/page/server-reference-manifest.json +18 -18
  35. package/web/.next/server/app/(dashboard)/@drawer/create/page.js.nft.json +1 -1
  36. package/web/.next/server/app/(dashboard)/@drawer/create/page_client-reference-manifest.js +1 -1
  37. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/server-reference-manifest.json +21 -21
  38. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js.nft.json +1 -1
  39. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page_client-reference-manifest.js +1 -1
  40. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/server-reference-manifest.json +14 -14
  41. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js.nft.json +1 -1
  42. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  43. package/web/.next/server/app/(dashboard)/create/page/server-reference-manifest.json +18 -18
  44. package/web/.next/server/app/(dashboard)/create/page.js.nft.json +1 -1
  45. package/web/.next/server/app/(dashboard)/create/page_client-reference-manifest.js +1 -1
  46. package/web/.next/server/app/(dashboard)/feature/[featureId]/page/server-reference-manifest.json +21 -21
  47. package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js.nft.json +1 -1
  48. package/web/.next/server/app/(dashboard)/feature/[featureId]/page_client-reference-manifest.js +1 -1
  49. package/web/.next/server/app/(dashboard)/page/server-reference-manifest.json +14 -14
  50. package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
  51. package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
  52. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/server-reference-manifest.json +14 -14
  53. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js.nft.json +1 -1
  54. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  55. package/web/.next/server/app/_global-error.html +2 -2
  56. package/web/.next/server/app/_global-error.rsc +1 -1
  57. package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  58. package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  59. package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  60. package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  61. package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  62. package/web/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
  63. package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  64. package/web/.next/server/app/api/attachments/preview/route.js.nft.json +1 -1
  65. package/web/.next/server/app/settings/page/server-reference-manifest.json +5 -5
  66. package/web/.next/server/app/settings/page.js.nft.json +1 -1
  67. package/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  68. package/web/.next/server/app/skills/page/server-reference-manifest.json +6 -6
  69. package/web/.next/server/app/skills/page.js.nft.json +1 -1
  70. package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  71. package/web/.next/server/app/tools/page/server-reference-manifest.json +6 -6
  72. package/web/.next/server/app/tools/page.js.nft.json +1 -1
  73. package/web/.next/server/app/tools/page_client-reference-manifest.js +1 -1
  74. package/web/.next/server/app/version/page/server-reference-manifest.json +1 -1
  75. package/web/.next/server/app/version/page_client-reference-manifest.js +1 -1
  76. package/web/.next/server/chunks/[root-of-the-server]__0b10355c._.js +1 -1
  77. package/web/.next/server/chunks/[root-of-the-server]__0b10355c._.js.map +1 -1
  78. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js +1 -1
  79. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js.map +1 -1
  80. package/web/.next/server/chunks/ssr/7f428_lucide-react_dist_esm_icons_9027d30a._.js +1 -1
  81. package/web/.next/server/chunks/ssr/7f428_lucide-react_dist_esm_icons_9027d30a._.js.map +1 -1
  82. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_@drawer_repository_[repositoryId]_page_actions_da7eef33.js +1 -1
  83. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_@drawer_repository_[repositoryId]_page_actions_da7eef33.js.map +1 -1
  84. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_repository_[repositoryId]_page_actions_0a9251aa.js +1 -1
  85. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_repository_[repositoryId]_page_actions_0a9251aa.js.map +1 -1
  86. package/web/.next/server/chunks/ssr/[root-of-the-server]__11033878._.js +1 -1
  87. package/web/.next/server/chunks/ssr/[root-of-the-server]__11033878._.js.map +1 -1
  88. package/web/.next/server/chunks/ssr/[root-of-the-server]__17143953._.js +1 -1
  89. package/web/.next/server/chunks/ssr/[root-of-the-server]__17143953._.js.map +1 -1
  90. package/web/.next/server/chunks/ssr/[root-of-the-server]__357d99f9._.js +1 -1
  91. package/web/.next/server/chunks/ssr/[root-of-the-server]__4be9a9bb._.js +1 -1
  92. package/web/.next/server/chunks/ssr/[root-of-the-server]__5d87af2e._.js +1 -1
  93. package/web/.next/server/chunks/ssr/[root-of-the-server]__9de266fa._.js +1 -1
  94. package/web/.next/server/chunks/ssr/[root-of-the-server]__9de266fa._.js.map +1 -1
  95. package/web/.next/server/chunks/ssr/[root-of-the-server]__aad040c0._.js +1 -1
  96. package/web/.next/server/chunks/ssr/[root-of-the-server]__aad040c0._.js.map +1 -1
  97. package/web/.next/server/chunks/ssr/[root-of-the-server]__b3a4cef4._.js +1 -1
  98. package/web/.next/server/chunks/ssr/[root-of-the-server]__b3a4cef4._.js.map +1 -1
  99. package/web/.next/server/chunks/ssr/[root-of-the-server]__c2173b6d._.js +1 -1
  100. package/web/.next/server/chunks/ssr/[root-of-the-server]__c2173b6d._.js.map +1 -1
  101. package/web/.next/server/chunks/ssr/[root-of-the-server]__f0d8d054._.js +2 -2
  102. package/web/.next/server/chunks/ssr/[root-of-the-server]__fdc75809._.js +1 -1
  103. package/web/.next/server/chunks/ssr/[root-of-the-server]__fdc75809._.js.map +1 -1
  104. package/web/.next/server/chunks/ssr/{_2fa756cd._.js → _05b3aacb._.js} +2 -2
  105. package/web/.next/server/chunks/ssr/{_2fa756cd._.js.map → _05b3aacb._.js.map} +1 -1
  106. package/web/.next/server/chunks/ssr/_135edb9c._.js +1 -1
  107. package/web/.next/server/chunks/ssr/_135edb9c._.js.map +1 -1
  108. package/web/.next/server/chunks/ssr/_752e01fd._.js +1 -1
  109. package/web/.next/server/chunks/ssr/_752e01fd._.js.map +1 -1
  110. package/web/.next/server/chunks/ssr/_8dacd1e7._.js +1 -1
  111. package/web/.next/server/chunks/ssr/_8dacd1e7._.js.map +1 -1
  112. package/web/.next/server/chunks/ssr/_cc77a143._.js +1 -1
  113. package/web/.next/server/chunks/ssr/_cc77a143._.js.map +1 -1
  114. package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js +1 -1
  115. package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js.map +1 -1
  116. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_021a05f2.js +1 -1
  117. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_021a05f2.js.map +1 -1
  118. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_1fa8042e.js +1 -1
  119. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_1fa8042e.js.map +1 -1
  120. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_24684200.js +1 -1
  121. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_24684200.js.map +1 -1
  122. package/web/.next/server/chunks/ssr/src_presentation_web_c4348b8a._.js +2 -2
  123. package/web/.next/server/chunks/ssr/src_presentation_web_c4348b8a._.js.map +1 -1
  124. package/web/.next/server/chunks/ssr/src_presentation_web_components_bf50c527._.js +1 -1
  125. package/web/.next/server/chunks/ssr/src_presentation_web_components_bf50c527._.js.map +1 -1
  126. package/web/.next/server/chunks/ssr/src_presentation_web_components_de814675._.js +1 -1
  127. package/web/.next/server/chunks/ssr/src_presentation_web_components_de814675._.js.map +1 -1
  128. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js +1 -1
  129. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js.map +1 -1
  130. package/web/.next/server/chunks/ssr/src_presentation_web_e4510d10._.js +2 -2
  131. package/web/.next/server/chunks/ssr/src_presentation_web_e4510d10._.js.map +1 -1
  132. package/web/.next/server/pages/500.html +2 -2
  133. package/web/.next/server/server-reference-manifest.js +1 -1
  134. package/web/.next/server/server-reference-manifest.json +28 -28
  135. package/web/.next/static/chunks/{4906aba274bc6920.js → 0414e6b21f189456.js} +1 -1
  136. package/web/.next/static/chunks/205b12234277ba2f.js +1 -0
  137. package/web/.next/static/chunks/{bb3e32c60cb2e794.js → 24744618941b8239.js} +1 -1
  138. package/web/.next/static/chunks/2a09571d38368a18.css +2 -0
  139. package/web/.next/static/chunks/{54de5c2f98832b92.js → 2ea28eba896e489b.js} +1 -1
  140. package/web/.next/static/chunks/55e7ff9b53257d70.js +1 -0
  141. package/web/.next/static/chunks/{132ff681f7e12121.js → 7fb81216c7dd303e.js} +1 -1
  142. package/web/.next/static/chunks/{7c7da9e978216d2b.js → c0233da545286fe1.js} +1 -1
  143. package/web/.next/static/chunks/{4354b4b30513e7f0.js → d5c051b708c9eafd.js} +2 -2
  144. package/web/.next/static/chunks/{0cbb35f940c9feef.js → dcc6eeb6b6e4c578.js} +1 -1
  145. package/web/.next/static/chunks/{38bb02c07a427f1e.js → fb39605881b728b1.js} +1 -1
  146. package/web/.next/static/chunks/{c0f23bc23fd8b8ad.js → fbdf11fbbe42fcff.js} +1 -1
  147. package/web/.next/static/chunks/5c55da0e28e6cdc8.js +0 -1
  148. package/web/.next/static/chunks/cb5c85c5e16e82d3.js +0 -1
  149. package/web/.next/static/chunks/f98eb6cb17b61cb2.css +0 -2
  150. /package/web/.next/static/{o8F4OKh6WJmRpbTqaCZ67 → yZWy0Cxn_PmaNJkxer58a}/_buildManifest.js +0 -0
  151. /package/web/.next/static/{o8F4OKh6WJmRpbTqaCZ67 → yZWy0Cxn_PmaNJkxer58a}/_clientMiddlewareManifest.json +0 -0
  152. /package/web/.next/static/{o8F4OKh6WJmRpbTqaCZ67 → yZWy0Cxn_PmaNJkxer58a}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,38573,e=>{"use strict";let t=(0,e.i(3645).default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);e.s(["Terminal",()=>t],38573)},30702,e=>{"use strict";let t=(0,e.i(3645).default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);e.s(["ExternalLink",()=>t],30702)},23925,1012,e=>{"use strict";let t=(0,e.i(3645).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["default",()=>t],1012),e.s(["Check",()=>t],23925)},41957,e=>{"use strict";var t=e.i(20314),r=e.i(79054),s=e.i(87620),o=r.forwardRef((e,r)=>(0,t.jsx)(s.Primitive.label,{...e,ref:r,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));o.displayName="Label",e.s(["Label",()=>o,"Root",()=>o],27572);var i=e.i(27572),i=i,n=e.i(94237),a=e.i(31777);let l=(0,n.cva)("text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=r.forwardRef(({className:e,...r},s)=>(0,t.jsx)(i.Root,{ref:s,className:(0,a.cn)(l(),e),...r}));c.displayName=i.Root.displayName,e.s(["Label",()=>c],41957)},23405,e=>{"use strict";var t=e.i(79054);function r(e){let r=t.useRef({value:e,previous:e});return t.useMemo(()=>(r.current.value!==e&&(r.current.previous=r.current.value,r.current.value=e),r.current.previous),[e])}e.s(["usePrevious",()=>r])},61569,e=>{"use strict";let t=(0,e.i(3645).default)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);e.s(["default",()=>t])},93752,e=>{"use strict";let t=(0,e.i(3645).default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);e.s(["default",()=>t])},11345,e=>{"use strict";let t=(0,e.i(3645).default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);e.s(["ChevronLeft",()=>t],11345)},76016,e=>{"use strict";let t=(0,e.i(3645).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["ChevronRight",()=>t],76016)},87889,e=>{"use strict";let t=(0,e.i(3645).default)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);e.s(["Eye",()=>t],87889)},99105,e=>{"use strict";let t=(0,e.i(3645).default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);e.s(["ChevronDown",()=>t],99105)},87342,e=>{"use strict";var t=e.i(79054),r=e.i(22528),s=e.i(5978),o=e.i(86874),i=e.i(20314);function n(e){let n=e+"CollectionProvider",[a,l]=(0,r.createContextScope)(n),[c,d]=a(n,{collectionRef:{current:null},itemMap:new Map}),u=e=>{let{scope:r,children:s}=e,o=t.default.useRef(null),n=t.default.useRef(new Map).current;return(0,i.jsx)(c,{scope:r,itemMap:n,collectionRef:o,children:s})};u.displayName=n;let p=e+"CollectionSlot",f=(0,o.createSlot)(p),h=t.default.forwardRef((e,t)=>{let{scope:r,children:o}=e,n=d(p,r),a=(0,s.useComposedRefs)(t,n.collectionRef);return(0,i.jsx)(f,{ref:a,children:o})});h.displayName=p;let m=e+"CollectionItemSlot",v="data-radix-collection-item",x=(0,o.createSlot)(m),g=t.default.forwardRef((e,r)=>{let{scope:o,children:n,...a}=e,l=t.default.useRef(null),c=(0,s.useComposedRefs)(r,l),u=d(m,o);return t.default.useEffect(()=>(u.itemMap.set(l,{ref:l,...a}),()=>void u.itemMap.delete(l))),(0,i.jsx)(x,{...{[v]:""},ref:c,children:n})});return g.displayName=m,[{Provider:u,Slot:h,ItemSlot:g},function(r){let s=d(e+"CollectionConsumer",r);return t.default.useCallback(()=>{let e=s.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${v}]`));return Array.from(s.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current))},[s.collectionRef,s.itemMap])},l]}var a=new WeakMap;function l(e,t){var r,s;let o,i,n;if("at"in Array.prototype)return Array.prototype.at.call(e,t);let a=(r=e,s=t,o=r.length,(n=(i=c(s))>=0?i:o+i)<0||n>=o?-1:n);return -1===a?void 0:e[a]}function c(e){return e!=e||0===e?0:Math.trunc(e)}(class e extends Map{#e;constructor(e){super(e),this.#e=[...super.keys()],a.set(this,!0)}set(e,t){return a.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,r){let s,o=this.has(t),i=this.#e.length,n=c(e),a=n>=0?n:i+n,l=a<0||a>=i?-1:a;if(l===this.size||o&&l===this.size-1||-1===l)return this.set(t,r),this;let d=this.size+ +!o;n<0&&a++;let u=[...this.#e],p=!1;for(let e=a;e<d;e++)if(a===e){let i=u[e];u[e]===t&&(i=u[e+1]),o&&this.delete(t),s=this.get(i),this.set(t,r)}else{p||u[e-1]!==t||(p=!0);let r=u[p?e:e-1],o=s;s=this.get(r),this.delete(r),this.set(r,o)}return this}with(t,r,s){let o=new e(this);return o.insert(t,r,s),o}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,r){let s=this.#e.indexOf(e);return -1===s?this:this.insert(s,t,r)}after(e){let t=this.#e.indexOf(e);if(-1!==(t=-1===t||t===this.size-1?-1:t+1))return this.entryAt(t)}setAfter(e,t,r){let s=this.#e.indexOf(e);return -1===s?this:this.insert(s+1,t,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){let t=l(this.#e,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=l(this.#e,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return l(this.#e,e)}from(e,t){let r=this.indexOf(e);if(-1===r)return;let s=r+t;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.at(s)}keyFrom(e,t){let r=this.indexOf(e);if(-1===r)return;let s=r+t;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.keyAt(s)}find(e,t){let r=0;for(let s of this){if(Reflect.apply(e,t,[s,r,this]))return s;r++}}findIndex(e,t){let r=0;for(let s of this){if(Reflect.apply(e,t,[s,r,this]))return r;r++}return -1}filter(t,r){let s=[],o=0;for(let e of this)Reflect.apply(t,r,[e,o,this])&&s.push(e),o++;return new e(s)}map(t,r){let s=[],o=0;for(let e of this)s.push([e[0],Reflect.apply(t,r,[e,o,this])]),o++;return new e(s)}reduce(...e){let[t,r]=e,s=0,o=r??this.at(0);for(let r of this)o=0===s&&1===e.length?r:Reflect.apply(t,this,[o,r,s,this]),s++;return o}reduceRight(...e){let[t,r]=e,s=r??this.at(-1);for(let r=this.size-1;r>=0;r--){let o=this.at(r);s=r===this.size-1&&1===e.length?o:Reflect.apply(t,this,[s,o,r,this])}return s}toSorted(t){return new e([...this.entries()].sort(t))}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let r=this.keyAt(e),s=this.get(r);t.set(r,s)}return t}toSpliced(...t){let r=[...this.entries()];return r.splice(...t),new e(r)}slice(t,r){let s=new e,o=this.size-1;if(void 0===t)return s;t<0&&(t+=this.size),void 0!==r&&r>0&&(o=r-1);for(let e=t;e<=o;e++){let t=this.keyAt(e),r=this.get(t);s.set(t,r)}return s}every(e,t){let r=0;for(let s of this){if(!Reflect.apply(e,t,[s,r,this]))return!1;r++}return!0}some(e,t){let r=0;for(let s of this){if(Reflect.apply(e,t,[s,r,this]))return!0;r++}return!1}}),e.s(["createCollection",()=>n])},49228,e=>{"use strict";let t=(0,e.i(3645).default)("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);e.s(["GitBranch",()=>t],49228)},83902,e=>{"use strict";let t=(0,e.i(3645).default)("rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);e.s(["Rocket",()=>t],83902)},51911,32639,39188,e=>{"use strict";var t=e.i(20314),r=e.i(79054),s=e.i(91967),o=e.i(5978),i=e.i(22528),n=e.i(36589),a=e.i(23405),l=e.i(77624),c=e.i(87620),d="Switch",[u,p]=(0,i.createContextScope)(d),[f,h]=u(d),m=r.forwardRef((e,i)=>{let{__scopeSwitch:a,name:l,checked:u,defaultChecked:p,required:h,disabled:m,value:v="on",onCheckedChange:x,form:k,...b}=e,[w,R]=r.useState(null),C=(0,o.useComposedRefs)(i,e=>R(e)),j=r.useRef(!1),P=!w||k||!!w.closest("form"),[A,N]=(0,n.useControllableState)({prop:u,defaultProp:p??!1,onChange:x,caller:d});return(0,t.jsxs)(f,{scope:a,checked:A,disabled:m,children:[(0,t.jsx)(c.Primitive.button,{type:"button",role:"switch","aria-checked":A,"aria-required":h,"data-state":y(A),"data-disabled":m?"":void 0,disabled:m,value:v,...b,ref:C,onClick:(0,s.composeEventHandlers)(e.onClick,e=>{N(e=>!e),P&&(j.current=e.isPropagationStopped(),j.current||e.stopPropagation())})}),P&&(0,t.jsx)(g,{control:w,bubbles:!j.current,name:l,value:v,checked:A,required:h,disabled:m,form:k,style:{transform:"translateX(-100%)"}})]})});m.displayName=d;var v="SwitchThumb",x=r.forwardRef((e,r)=>{let{__scopeSwitch:s,...o}=e,i=h(v,s);return(0,t.jsx)(c.Primitive.span,{"data-state":y(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:r})});x.displayName=v;var g=r.forwardRef(({__scopeSwitch:e,control:s,checked:i,bubbles:n=!0,...c},d)=>{let u=r.useRef(null),p=(0,o.useComposedRefs)(u,d),f=(0,a.usePrevious)(i),h=(0,l.useSize)(s);return r.useEffect(()=>{let e=u.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(f!==i&&t){let r=new Event("click",{bubbles:n});t.call(e,i),e.dispatchEvent(r)}},[f,i,n]),(0,t.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i,...c,tabIndex:-1,ref:p,style:{...c.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function y(e){return e?"checked":"unchecked"}g.displayName="SwitchBubbleInput",e.s(["Root",()=>m,"Switch",()=>m,"SwitchThumb",()=>x,"Thumb",()=>x,"createSwitchScope",()=>p],95291);var k=e.i(95291),k=k,b=e.i(31777);function w({className:e,size:r="default",...s}){return(0,t.jsx)(k.Root,{"data-slot":"switch","data-size":r,className:(0,b.cn)("peer group/switch focus-visible:border-ring focus-visible:ring-ring/50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80 inline-flex shrink-0 cursor-pointer items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6",e),...s,children:(0,t.jsx)(k.Thumb,{"data-slot":"switch-thumb",className:(0,b.cn)("bg-background dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}e.s(["Switch",()=>w],51911);var R=e.i(21023);let C=(0,R.createServerReference)("00b3d3258a7fdab47eb0bc75b98e6190613d394380",R.callServer,void 0,R.findSourceMapURL,"getAllAgentModels");e.s(["getAllAgentModels",()=>C],32639);let j=(0,R.createServerReference)("600c6cafd7fa51135ad9fba70f11cff6784b8b960e",R.callServer,void 0,R.findSourceMapURL,"updateAgentAndModel");e.s(["updateAgentAndModel",()=>j],39188)},90382,e=>{"use strict";var t=e.i(20314),r=e.i(79054),s=e.i(91967),o=e.i(5978),i=e.i(22528),n=e.i(53532),a=e.i(41687),l=e.i(56720),c=e.i(13123),d=e.i(52740),u=e.i(39979),p=e.i(85995),f=e.i(87620),h=e.i(86874),m=e.i(36589),v=e.i(73772),x=e.i(13044),g="Popover",[y,k]=(0,i.createContextScope)(g,[d.createPopperScope]),b=(0,d.createPopperScope)(),[w,R]=y(g),C=e=>{let{__scopePopover:s,children:o,open:i,defaultOpen:n,onOpenChange:a,modal:l=!1}=e,u=b(s),p=r.useRef(null),[f,h]=r.useState(!1),[v,x]=(0,m.useControllableState)({prop:i,defaultProp:n??!1,onChange:a,caller:g});return(0,t.jsx)(d.Root,{...u,children:(0,t.jsx)(w,{scope:s,contentId:(0,c.useId)(),triggerRef:p,open:v,onOpenChange:x,onOpenToggle:r.useCallback(()=>x(e=>!e),[x]),hasCustomAnchor:f,onCustomAnchorAdd:r.useCallback(()=>h(!0),[]),onCustomAnchorRemove:r.useCallback(()=>h(!1),[]),modal:l,children:o})})};C.displayName=g;var j="PopoverAnchor",P=r.forwardRef((e,s)=>{let{__scopePopover:o,...i}=e,n=R(j,o),a=b(o),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=n;return r.useEffect(()=>(l(),()=>c()),[l,c]),(0,t.jsx)(d.Anchor,{...a,...i,ref:s})});P.displayName=j;var A="PopoverTrigger",N=r.forwardRef((e,r)=>{let{__scopePopover:i,...n}=e,a=R(A,i),l=b(i),c=(0,o.useComposedRefs)(r,a.triggerRef),u=(0,t.jsx)(f.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":B(a.open),...n,ref:c,onClick:(0,s.composeEventHandlers)(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?u:(0,t.jsx)(d.Anchor,{asChild:!0,...l,children:u})});N.displayName=A;var S="PopoverPortal",[M,O]=y(S,{forceMount:void 0}),T=e=>{let{__scopePopover:r,forceMount:s,children:o,container:i}=e,n=R(S,r);return(0,t.jsx)(M,{scope:r,forceMount:s,children:(0,t.jsx)(p.Presence,{present:s||n.open,children:(0,t.jsx)(u.Portal,{asChild:!0,container:i,children:o})})})};T.displayName=S;var z="PopoverContent",E=r.forwardRef((e,r)=>{let s=O(z,e.__scopePopover),{forceMount:o=s.forceMount,...i}=e,n=R(z,e.__scopePopover);return(0,t.jsx)(p.Presence,{present:o||n.open,children:n.modal?(0,t.jsx)(D,{...i,ref:r}):(0,t.jsx)(I,{...i,ref:r})})});E.displayName=z;var F=(0,h.createSlot)("PopoverContent.RemoveScroll"),D=r.forwardRef((e,i)=>{let n=R(z,e.__scopePopover),a=r.useRef(null),l=(0,o.useComposedRefs)(i,a),c=r.useRef(!1);return r.useEffect(()=>{let e=a.current;if(e)return(0,v.hideOthers)(e)},[]),(0,t.jsx)(x.RemoveScroll,{as:F,allowPinchZoom:!0,children:(0,t.jsx)(q,{...e,ref:l,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,s.composeEventHandlers)(e.onCloseAutoFocus,e=>{e.preventDefault(),c.current||n.triggerRef.current?.focus()}),onPointerDownOutside:(0,s.composeEventHandlers)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;c.current=2===t.button||r},{checkForDefaultPrevented:!1}),onFocusOutside:(0,s.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),I=r.forwardRef((e,s)=>{let o=R(z,e.__scopePopover),i=r.useRef(!1),n=r.useRef(!1);return(0,t.jsx)(q,{...e,ref:s,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(i.current||o.triggerRef.current?.focus(),t.preventDefault()),i.current=!1,n.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(i.current=!0,"pointerdown"===t.detail.originalEvent.type&&(n.current=!0));let r=t.target;o.triggerRef.current?.contains(r)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&n.current&&t.preventDefault()}})}),q=r.forwardRef((e,r)=>{let{__scopePopover:s,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:c,disableOutsidePointerEvents:u,onEscapeKeyDown:p,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,...v}=e,x=R(z,s),g=b(s);return(0,a.useFocusGuards)(),(0,t.jsx)(l.FocusScope,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:i,onUnmountAutoFocus:c,children:(0,t.jsx)(n.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:m,onEscapeKeyDown:p,onPointerDownOutside:f,onFocusOutside:h,onDismiss:()=>x.onOpenChange(!1),children:(0,t.jsx)(d.Content,{"data-state":B(x.open),role:"dialog",id:x.contentId,...g,...v,ref:r,style:{...v.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),L="PopoverClose",H=r.forwardRef((e,r)=>{let{__scopePopover:o,...i}=e,n=R(L,o);return(0,t.jsx)(f.Primitive.button,{type:"button",...i,ref:r,onClick:(0,s.composeEventHandlers)(e.onClick,()=>n.onOpenChange(!1))})});H.displayName=L;var _=r.forwardRef((e,r)=>{let{__scopePopover:s,...o}=e,i=b(s);return(0,t.jsx)(d.Arrow,{...i,...o,ref:r})});function B(e){return e?"open":"closed"}_.displayName="PopoverArrow",e.s(["Anchor",()=>P,"Arrow",()=>_,"Close",()=>H,"Content",()=>E,"Popover",()=>C,"PopoverAnchor",()=>P,"PopoverArrow",()=>_,"PopoverClose",()=>H,"PopoverContent",()=>E,"PopoverPortal",()=>T,"PopoverTrigger",()=>N,"Portal",()=>T,"Root",()=>C,"Trigger",()=>N,"createPopoverScope",()=>k],89920);var U=e.i(89920),U=U,K=e.i(31777);let G=U.Root,X=U.Trigger;U.Anchor;let $=r.forwardRef(({className:e,align:r="center",sideOffset:s=4,...o},i)=>(0,t.jsx)(U.Portal,{children:(0,t.jsx)(U.Content,{ref:i,align:r,sideOffset:s,className:(0,K.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-none",e),...o})}));$.displayName=U.Content.displayName,e.s(["Popover",()=>G,"PopoverContent",()=>$,"PopoverTrigger",()=>X],90382)},41413,e=>{"use strict";var t=e.i(20314),r=e.i(79054),s=e.i(23925),o=e.i(11345),i=e.i(76016),n=e.i(32639),a=e.i(39188),l=e.i(86782),c=e.i(29847),d=e.i(35364),u=e.i(90382),p=e.i(31777);function f({initialAgentType:e,initialModel:f,onAgentModelChange:h,disabled:m,className:v,mode:x}){let[g,y]=r.useState(!1),[k,b]=r.useState([]),[w,R]=r.useState(!0),[C,j]=r.useState(e),[P,A]=r.useState(f),[N,S]=r.useState(null),[M,O]=r.useState(0),[T,z]=r.useState(null);r.useEffect(()=>{(0,n.getAllAgentModels)().then(b).finally(()=>R(!1))},[]),r.useEffect(()=>{if(!g){let e=setTimeout(()=>{O(0),z(null)},150);return()=>clearTimeout(e)}},[g]);let E=async(e,t)=>{if(y(!1),e!==C||t!==P){if("override"===x){j(e),A(t),h?.(e,t);return}j(e),A(t),h?.(e,t),S(null);try{let r=await (0,a.updateAgentAndModel)(e,t||null);r.ok||(j(C),A(P),h?.(C,P),S(r.error??"Failed to save"))}catch{j(C),A(P),h?.(C,P),S("Failed to save")}}},F=(0,l.getAgentTypeIcon)(C),D=k.find(e=>e.agentType===C)?.label??C,I=P?(0,c.getModelMeta)(P).displayName||P:null,q=T?k.find(e=>e.agentType===T):null;return(0,t.jsxs)("div",{className:(0,p.cn)("flex flex-col gap-1",v),children:[(0,t.jsxs)(u.Popover,{open:g,onOpenChange:y,children:[(0,t.jsx)(u.PopoverTrigger,{asChild:!0,children:(0,t.jsx)(d.Button,{variant:"outline",role:"combobox","aria-expanded":g,disabled:(m??!1)||w,className:"w-auto cursor-pointer justify-start font-normal hover:border-violet-300 hover:bg-violet-50/50 dark:hover:border-violet-700 dark:hover:bg-violet-950/30",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 truncate",children:[(0,t.jsx)(F,{className:"h-4 w-4 shrink-0"}),w?"Loading…":(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:D}),I?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-muted-foreground/50 text-xs",children:"·"}),(0,t.jsx)("span",{className:"text-xs font-medium",children:I})]}):null]})]})})}),(0,t.jsx)(u.PopoverContent,{className:"w-(--radix-popover-trigger-width) overflow-hidden p-0",align:"start",children:(0,t.jsxs)("div",{className:"flex transition-transform duration-200 ease-in-out",style:{transform:`translateX(${1===M?"-50%":"0%"})`,width:"200%"},children:[(0,t.jsxs)("div",{className:"w-1/2 shrink-0",children:[(0,t.jsx)("div",{className:"text-muted-foreground border-b px-3 py-2 text-xs font-medium",children:"Select agent"}),k.map(e=>{let r=(0,l.getAgentTypeIcon)(e.agentType),o=C===e.agentType,n=e.models.length>0;return(0,t.jsxs)("button",{type:"button",className:(0,p.cn)("flex w-full cursor-pointer items-center gap-2.5 px-3 py-2 text-xs transition-colors","hover:bg-accent hover:text-accent-foreground",o&&"bg-accent/50"),onClick:()=>{n?(z(e.agentType),requestAnimationFrame(()=>{requestAnimationFrame(()=>O(1))})):E(e.agentType,"")},children:[(0,t.jsx)(r,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"flex-1 text-left",children:e.label}),o&&!n?(0,t.jsx)(s.Check,{className:"text-primary h-3.5 w-3.5 shrink-0"}):null,n?(0,t.jsx)(i.ChevronRight,{className:"text-muted-foreground h-3.5 w-3.5 shrink-0"}):null]},e.agentType)})]}),(0,t.jsx)("div",{className:"w-1/2 shrink-0",children:q?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{type:"button",className:"text-muted-foreground hover:text-foreground flex w-full cursor-pointer items-center gap-1.5 border-b px-3 py-2 text-xs font-medium transition-colors",onClick:()=>{O(0),setTimeout(()=>z(null),220)},children:[(0,t.jsx)(o.ChevronLeft,{className:"h-3.5 w-3.5"}),q.label]}),q.models.map(e=>{let r=C===q.agentType&&P===e.id;return(0,t.jsxs)("button",{type:"button",className:(0,p.cn)("flex w-full cursor-pointer items-center gap-3 px-3 py-2 text-left transition-colors","hover:bg-accent hover:text-accent-foreground",r&&"bg-accent/50"),onClick:()=>E(q.agentType,e.id),children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,t.jsx)("span",{className:"text-xs font-medium",children:e.displayName}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:e.description})]}),r?(0,t.jsx)(s.Check,{className:"text-primary h-3.5 w-3.5 shrink-0"}):null]},e.id)})]}):null})]})})]}),!!N&&(0,t.jsx)("p",{className:"text-destructive text-sm",children:N})]})}e.s(["AgentModelPicker",()=>f])}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,38573,e=>{"use strict";let t=(0,e.i(3645).default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);e.s(["Terminal",()=>t],38573)},30702,e=>{"use strict";let t=(0,e.i(3645).default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);e.s(["ExternalLink",()=>t],30702)},23925,1012,e=>{"use strict";let t=(0,e.i(3645).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["default",()=>t],1012),e.s(["Check",()=>t],23925)},41957,e=>{"use strict";var t=e.i(20314),r=e.i(79054),s=e.i(87620),o=r.forwardRef((e,r)=>(0,t.jsx)(s.Primitive.label,{...e,ref:r,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));o.displayName="Label",e.s(["Label",()=>o,"Root",()=>o],27572);var i=e.i(27572),i=i,n=e.i(94237),a=e.i(31777);let l=(0,n.cva)("text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=r.forwardRef(({className:e,...r},s)=>(0,t.jsx)(i.Root,{ref:s,className:(0,a.cn)(l(),e),...r}));c.displayName=i.Root.displayName,e.s(["Label",()=>c],41957)},23405,e=>{"use strict";var t=e.i(79054);function r(e){let r=t.useRef({value:e,previous:e});return t.useMemo(()=>(r.current.value!==e&&(r.current.previous=r.current.value,r.current.value=e),r.current.previous),[e])}e.s(["usePrevious",()=>r])},61569,e=>{"use strict";let t=(0,e.i(3645).default)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);e.s(["default",()=>t])},93752,e=>{"use strict";let t=(0,e.i(3645).default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);e.s(["default",()=>t])},11345,e=>{"use strict";let t=(0,e.i(3645).default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);e.s(["ChevronLeft",()=>t],11345)},76016,e=>{"use strict";let t=(0,e.i(3645).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["ChevronRight",()=>t],76016)},87889,e=>{"use strict";let t=(0,e.i(3645).default)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);e.s(["Eye",()=>t],87889)},99105,e=>{"use strict";let t=(0,e.i(3645).default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);e.s(["ChevronDown",()=>t],99105)},87342,e=>{"use strict";var t=e.i(79054),r=e.i(22528),s=e.i(5978),o=e.i(86874),i=e.i(20314);function n(e){let n=e+"CollectionProvider",[a,l]=(0,r.createContextScope)(n),[c,d]=a(n,{collectionRef:{current:null},itemMap:new Map}),u=e=>{let{scope:r,children:s}=e,o=t.default.useRef(null),n=t.default.useRef(new Map).current;return(0,i.jsx)(c,{scope:r,itemMap:n,collectionRef:o,children:s})};u.displayName=n;let p=e+"CollectionSlot",f=(0,o.createSlot)(p),h=t.default.forwardRef((e,t)=>{let{scope:r,children:o}=e,n=d(p,r),a=(0,s.useComposedRefs)(t,n.collectionRef);return(0,i.jsx)(f,{ref:a,children:o})});h.displayName=p;let m=e+"CollectionItemSlot",v="data-radix-collection-item",x=(0,o.createSlot)(m),g=t.default.forwardRef((e,r)=>{let{scope:o,children:n,...a}=e,l=t.default.useRef(null),c=(0,s.useComposedRefs)(r,l),u=d(m,o);return t.default.useEffect(()=>(u.itemMap.set(l,{ref:l,...a}),()=>void u.itemMap.delete(l))),(0,i.jsx)(x,{...{[v]:""},ref:c,children:n})});return g.displayName=m,[{Provider:u,Slot:h,ItemSlot:g},function(r){let s=d(e+"CollectionConsumer",r);return t.default.useCallback(()=>{let e=s.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${v}]`));return Array.from(s.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current))},[s.collectionRef,s.itemMap])},l]}var a=new WeakMap;function l(e,t){var r,s;let o,i,n;if("at"in Array.prototype)return Array.prototype.at.call(e,t);let a=(r=e,s=t,o=r.length,(n=(i=c(s))>=0?i:o+i)<0||n>=o?-1:n);return -1===a?void 0:e[a]}function c(e){return e!=e||0===e?0:Math.trunc(e)}(class e extends Map{#e;constructor(e){super(e),this.#e=[...super.keys()],a.set(this,!0)}set(e,t){return a.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,r){let s,o=this.has(t),i=this.#e.length,n=c(e),a=n>=0?n:i+n,l=a<0||a>=i?-1:a;if(l===this.size||o&&l===this.size-1||-1===l)return this.set(t,r),this;let d=this.size+ +!o;n<0&&a++;let u=[...this.#e],p=!1;for(let e=a;e<d;e++)if(a===e){let i=u[e];u[e]===t&&(i=u[e+1]),o&&this.delete(t),s=this.get(i),this.set(t,r)}else{p||u[e-1]!==t||(p=!0);let r=u[p?e:e-1],o=s;s=this.get(r),this.delete(r),this.set(r,o)}return this}with(t,r,s){let o=new e(this);return o.insert(t,r,s),o}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,r){let s=this.#e.indexOf(e);return -1===s?this:this.insert(s,t,r)}after(e){let t=this.#e.indexOf(e);if(-1!==(t=-1===t||t===this.size-1?-1:t+1))return this.entryAt(t)}setAfter(e,t,r){let s=this.#e.indexOf(e);return -1===s?this:this.insert(s+1,t,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){let t=l(this.#e,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=l(this.#e,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return l(this.#e,e)}from(e,t){let r=this.indexOf(e);if(-1===r)return;let s=r+t;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.at(s)}keyFrom(e,t){let r=this.indexOf(e);if(-1===r)return;let s=r+t;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.keyAt(s)}find(e,t){let r=0;for(let s of this){if(Reflect.apply(e,t,[s,r,this]))return s;r++}}findIndex(e,t){let r=0;for(let s of this){if(Reflect.apply(e,t,[s,r,this]))return r;r++}return -1}filter(t,r){let s=[],o=0;for(let e of this)Reflect.apply(t,r,[e,o,this])&&s.push(e),o++;return new e(s)}map(t,r){let s=[],o=0;for(let e of this)s.push([e[0],Reflect.apply(t,r,[e,o,this])]),o++;return new e(s)}reduce(...e){let[t,r]=e,s=0,o=r??this.at(0);for(let r of this)o=0===s&&1===e.length?r:Reflect.apply(t,this,[o,r,s,this]),s++;return o}reduceRight(...e){let[t,r]=e,s=r??this.at(-1);for(let r=this.size-1;r>=0;r--){let o=this.at(r);s=r===this.size-1&&1===e.length?o:Reflect.apply(t,this,[s,o,r,this])}return s}toSorted(t){return new e([...this.entries()].sort(t))}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let r=this.keyAt(e),s=this.get(r);t.set(r,s)}return t}toSpliced(...t){let r=[...this.entries()];return r.splice(...t),new e(r)}slice(t,r){let s=new e,o=this.size-1;if(void 0===t)return s;t<0&&(t+=this.size),void 0!==r&&r>0&&(o=r-1);for(let e=t;e<=o;e++){let t=this.keyAt(e),r=this.get(t);s.set(t,r)}return s}every(e,t){let r=0;for(let s of this){if(!Reflect.apply(e,t,[s,r,this]))return!1;r++}return!0}some(e,t){let r=0;for(let s of this){if(Reflect.apply(e,t,[s,r,this]))return!0;r++}return!1}}),e.s(["createCollection",()=>n])},49228,e=>{"use strict";let t=(0,e.i(3645).default)("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);e.s(["GitBranch",()=>t],49228)},83902,e=>{"use strict";let t=(0,e.i(3645).default)("rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);e.s(["Rocket",()=>t],83902)},51911,13705,34516,e=>{"use strict";var t=e.i(20314),r=e.i(79054),s=e.i(91967),o=e.i(5978),i=e.i(22528),n=e.i(36589),a=e.i(23405),l=e.i(77624),c=e.i(87620),d="Switch",[u,p]=(0,i.createContextScope)(d),[f,h]=u(d),m=r.forwardRef((e,i)=>{let{__scopeSwitch:a,name:l,checked:u,defaultChecked:p,required:h,disabled:m,value:v="on",onCheckedChange:x,form:k,...b}=e,[w,R]=r.useState(null),C=(0,o.useComposedRefs)(i,e=>R(e)),j=r.useRef(!1),P=!w||k||!!w.closest("form"),[A,N]=(0,n.useControllableState)({prop:u,defaultProp:p??!1,onChange:x,caller:d});return(0,t.jsxs)(f,{scope:a,checked:A,disabled:m,children:[(0,t.jsx)(c.Primitive.button,{type:"button",role:"switch","aria-checked":A,"aria-required":h,"data-state":y(A),"data-disabled":m?"":void 0,disabled:m,value:v,...b,ref:C,onClick:(0,s.composeEventHandlers)(e.onClick,e=>{N(e=>!e),P&&(j.current=e.isPropagationStopped(),j.current||e.stopPropagation())})}),P&&(0,t.jsx)(g,{control:w,bubbles:!j.current,name:l,value:v,checked:A,required:h,disabled:m,form:k,style:{transform:"translateX(-100%)"}})]})});m.displayName=d;var v="SwitchThumb",x=r.forwardRef((e,r)=>{let{__scopeSwitch:s,...o}=e,i=h(v,s);return(0,t.jsx)(c.Primitive.span,{"data-state":y(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:r})});x.displayName=v;var g=r.forwardRef(({__scopeSwitch:e,control:s,checked:i,bubbles:n=!0,...c},d)=>{let u=r.useRef(null),p=(0,o.useComposedRefs)(u,d),f=(0,a.usePrevious)(i),h=(0,l.useSize)(s);return r.useEffect(()=>{let e=u.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(f!==i&&t){let r=new Event("click",{bubbles:n});t.call(e,i),e.dispatchEvent(r)}},[f,i,n]),(0,t.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i,...c,tabIndex:-1,ref:p,style:{...c.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function y(e){return e?"checked":"unchecked"}g.displayName="SwitchBubbleInput",e.s(["Root",()=>m,"Switch",()=>m,"SwitchThumb",()=>x,"Thumb",()=>x,"createSwitchScope",()=>p],95291);var k=e.i(95291),k=k,b=e.i(31777);function w({className:e,size:r="default",...s}){return(0,t.jsx)(k.Root,{"data-slot":"switch","data-size":r,className:(0,b.cn)("peer group/switch focus-visible:border-ring focus-visible:ring-ring/50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80 inline-flex shrink-0 cursor-pointer items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6",e),...s,children:(0,t.jsx)(k.Thumb,{"data-slot":"switch-thumb",className:(0,b.cn)("bg-background dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}e.s(["Switch",()=>w],51911);var R=e.i(21023);let C=(0,R.createServerReference)("00415db0d37c4112198d9f76610b3e2a72bbdac54e",R.callServer,void 0,R.findSourceMapURL,"getAllAgentModels");e.s(["getAllAgentModels",()=>C],13705);let j=(0,R.createServerReference)("60d836fa9516401bf80646b055367ecc5bf1a6515d",R.callServer,void 0,R.findSourceMapURL,"updateAgentAndModel");e.s(["updateAgentAndModel",()=>j],34516)},90382,e=>{"use strict";var t=e.i(20314),r=e.i(79054),s=e.i(91967),o=e.i(5978),i=e.i(22528),n=e.i(53532),a=e.i(41687),l=e.i(56720),c=e.i(13123),d=e.i(52740),u=e.i(39979),p=e.i(85995),f=e.i(87620),h=e.i(86874),m=e.i(36589),v=e.i(73772),x=e.i(13044),g="Popover",[y,k]=(0,i.createContextScope)(g,[d.createPopperScope]),b=(0,d.createPopperScope)(),[w,R]=y(g),C=e=>{let{__scopePopover:s,children:o,open:i,defaultOpen:n,onOpenChange:a,modal:l=!1}=e,u=b(s),p=r.useRef(null),[f,h]=r.useState(!1),[v,x]=(0,m.useControllableState)({prop:i,defaultProp:n??!1,onChange:a,caller:g});return(0,t.jsx)(d.Root,{...u,children:(0,t.jsx)(w,{scope:s,contentId:(0,c.useId)(),triggerRef:p,open:v,onOpenChange:x,onOpenToggle:r.useCallback(()=>x(e=>!e),[x]),hasCustomAnchor:f,onCustomAnchorAdd:r.useCallback(()=>h(!0),[]),onCustomAnchorRemove:r.useCallback(()=>h(!1),[]),modal:l,children:o})})};C.displayName=g;var j="PopoverAnchor",P=r.forwardRef((e,s)=>{let{__scopePopover:o,...i}=e,n=R(j,o),a=b(o),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=n;return r.useEffect(()=>(l(),()=>c()),[l,c]),(0,t.jsx)(d.Anchor,{...a,...i,ref:s})});P.displayName=j;var A="PopoverTrigger",N=r.forwardRef((e,r)=>{let{__scopePopover:i,...n}=e,a=R(A,i),l=b(i),c=(0,o.useComposedRefs)(r,a.triggerRef),u=(0,t.jsx)(f.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":B(a.open),...n,ref:c,onClick:(0,s.composeEventHandlers)(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?u:(0,t.jsx)(d.Anchor,{asChild:!0,...l,children:u})});N.displayName=A;var S="PopoverPortal",[M,O]=y(S,{forceMount:void 0}),T=e=>{let{__scopePopover:r,forceMount:s,children:o,container:i}=e,n=R(S,r);return(0,t.jsx)(M,{scope:r,forceMount:s,children:(0,t.jsx)(p.Presence,{present:s||n.open,children:(0,t.jsx)(u.Portal,{asChild:!0,container:i,children:o})})})};T.displayName=S;var z="PopoverContent",E=r.forwardRef((e,r)=>{let s=O(z,e.__scopePopover),{forceMount:o=s.forceMount,...i}=e,n=R(z,e.__scopePopover);return(0,t.jsx)(p.Presence,{present:o||n.open,children:n.modal?(0,t.jsx)(D,{...i,ref:r}):(0,t.jsx)(I,{...i,ref:r})})});E.displayName=z;var F=(0,h.createSlot)("PopoverContent.RemoveScroll"),D=r.forwardRef((e,i)=>{let n=R(z,e.__scopePopover),a=r.useRef(null),l=(0,o.useComposedRefs)(i,a),c=r.useRef(!1);return r.useEffect(()=>{let e=a.current;if(e)return(0,v.hideOthers)(e)},[]),(0,t.jsx)(x.RemoveScroll,{as:F,allowPinchZoom:!0,children:(0,t.jsx)(q,{...e,ref:l,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,s.composeEventHandlers)(e.onCloseAutoFocus,e=>{e.preventDefault(),c.current||n.triggerRef.current?.focus()}),onPointerDownOutside:(0,s.composeEventHandlers)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;c.current=2===t.button||r},{checkForDefaultPrevented:!1}),onFocusOutside:(0,s.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),I=r.forwardRef((e,s)=>{let o=R(z,e.__scopePopover),i=r.useRef(!1),n=r.useRef(!1);return(0,t.jsx)(q,{...e,ref:s,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(i.current||o.triggerRef.current?.focus(),t.preventDefault()),i.current=!1,n.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(i.current=!0,"pointerdown"===t.detail.originalEvent.type&&(n.current=!0));let r=t.target;o.triggerRef.current?.contains(r)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&n.current&&t.preventDefault()}})}),q=r.forwardRef((e,r)=>{let{__scopePopover:s,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:c,disableOutsidePointerEvents:u,onEscapeKeyDown:p,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,...v}=e,x=R(z,s),g=b(s);return(0,a.useFocusGuards)(),(0,t.jsx)(l.FocusScope,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:i,onUnmountAutoFocus:c,children:(0,t.jsx)(n.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:m,onEscapeKeyDown:p,onPointerDownOutside:f,onFocusOutside:h,onDismiss:()=>x.onOpenChange(!1),children:(0,t.jsx)(d.Content,{"data-state":B(x.open),role:"dialog",id:x.contentId,...g,...v,ref:r,style:{...v.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),L="PopoverClose",H=r.forwardRef((e,r)=>{let{__scopePopover:o,...i}=e,n=R(L,o);return(0,t.jsx)(f.Primitive.button,{type:"button",...i,ref:r,onClick:(0,s.composeEventHandlers)(e.onClick,()=>n.onOpenChange(!1))})});H.displayName=L;var _=r.forwardRef((e,r)=>{let{__scopePopover:s,...o}=e,i=b(s);return(0,t.jsx)(d.Arrow,{...i,...o,ref:r})});function B(e){return e?"open":"closed"}_.displayName="PopoverArrow",e.s(["Anchor",()=>P,"Arrow",()=>_,"Close",()=>H,"Content",()=>E,"Popover",()=>C,"PopoverAnchor",()=>P,"PopoverArrow",()=>_,"PopoverClose",()=>H,"PopoverContent",()=>E,"PopoverPortal",()=>T,"PopoverTrigger",()=>N,"Portal",()=>T,"Root",()=>C,"Trigger",()=>N,"createPopoverScope",()=>k],89920);var U=e.i(89920),U=U,K=e.i(31777);let G=U.Root,X=U.Trigger;U.Anchor;let $=r.forwardRef(({className:e,align:r="center",sideOffset:s=4,...o},i)=>(0,t.jsx)(U.Portal,{children:(0,t.jsx)(U.Content,{ref:i,align:r,sideOffset:s,className:(0,K.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-none",e),...o})}));$.displayName=U.Content.displayName,e.s(["Popover",()=>G,"PopoverContent",()=>$,"PopoverTrigger",()=>X],90382)},41413,e=>{"use strict";var t=e.i(20314),r=e.i(79054),s=e.i(23925),o=e.i(11345),i=e.i(76016),n=e.i(13705),a=e.i(34516),l=e.i(86782),c=e.i(29847),d=e.i(35364),u=e.i(90382),p=e.i(31777);function f({initialAgentType:e,initialModel:f,onAgentModelChange:h,disabled:m,className:v,mode:x}){let[g,y]=r.useState(!1),[k,b]=r.useState([]),[w,R]=r.useState(!0),[C,j]=r.useState(e),[P,A]=r.useState(f),[N,S]=r.useState(null),[M,O]=r.useState(0),[T,z]=r.useState(null);r.useEffect(()=>{(0,n.getAllAgentModels)().then(b).finally(()=>R(!1))},[]),r.useEffect(()=>{if(!g){let e=setTimeout(()=>{O(0),z(null)},150);return()=>clearTimeout(e)}},[g]);let E=async(e,t)=>{if(y(!1),e!==C||t!==P){if("override"===x){j(e),A(t),h?.(e,t);return}j(e),A(t),h?.(e,t),S(null);try{let r=await (0,a.updateAgentAndModel)(e,t||null);r.ok||(j(C),A(P),h?.(C,P),S(r.error??"Failed to save"))}catch{j(C),A(P),h?.(C,P),S("Failed to save")}}},F=(0,l.getAgentTypeIcon)(C),D=k.find(e=>e.agentType===C)?.label??C,I=P?(0,c.getModelMeta)(P).displayName||P:null,q=T?k.find(e=>e.agentType===T):null;return(0,t.jsxs)("div",{className:(0,p.cn)("flex flex-col gap-1",v),children:[(0,t.jsxs)(u.Popover,{open:g,onOpenChange:y,children:[(0,t.jsx)(u.PopoverTrigger,{asChild:!0,children:(0,t.jsx)(d.Button,{variant:"outline",role:"combobox","aria-expanded":g,disabled:(m??!1)||w,className:"w-auto cursor-pointer justify-start font-normal hover:border-violet-300 hover:bg-violet-50/50 dark:hover:border-violet-700 dark:hover:bg-violet-950/30",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 truncate",children:[(0,t.jsx)(F,{className:"h-4 w-4 shrink-0"}),w?"Loading…":(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:D}),I?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-muted-foreground/50 text-xs",children:"·"}),(0,t.jsx)("span",{className:"text-xs font-medium",children:I})]}):null]})]})})}),(0,t.jsx)(u.PopoverContent,{className:"w-(--radix-popover-trigger-width) overflow-hidden p-0",align:"start",children:(0,t.jsxs)("div",{className:"flex transition-transform duration-200 ease-in-out",style:{transform:`translateX(${1===M?"-50%":"0%"})`,width:"200%"},children:[(0,t.jsxs)("div",{className:"w-1/2 shrink-0",children:[(0,t.jsx)("div",{className:"text-muted-foreground border-b px-3 py-2 text-xs font-medium",children:"Select agent"}),k.map(e=>{let r=(0,l.getAgentTypeIcon)(e.agentType),o=C===e.agentType,n=e.models.length>0;return(0,t.jsxs)("button",{type:"button",className:(0,p.cn)("flex w-full cursor-pointer items-center gap-2.5 px-3 py-2 text-xs transition-colors","hover:bg-accent hover:text-accent-foreground",o&&"bg-accent/50"),onClick:()=>{n?(z(e.agentType),requestAnimationFrame(()=>{requestAnimationFrame(()=>O(1))})):E(e.agentType,"")},children:[(0,t.jsx)(r,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"flex-1 text-left",children:e.label}),o&&!n?(0,t.jsx)(s.Check,{className:"text-primary h-3.5 w-3.5 shrink-0"}):null,n?(0,t.jsx)(i.ChevronRight,{className:"text-muted-foreground h-3.5 w-3.5 shrink-0"}):null]},e.agentType)})]}),(0,t.jsx)("div",{className:"w-1/2 shrink-0",children:q?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{type:"button",className:"text-muted-foreground hover:text-foreground flex w-full cursor-pointer items-center gap-1.5 border-b px-3 py-2 text-xs font-medium transition-colors",onClick:()=>{O(0),setTimeout(()=>z(null),220)},children:[(0,t.jsx)(o.ChevronLeft,{className:"h-3.5 w-3.5"}),q.label]}),q.models.map(e=>{let r=C===q.agentType&&P===e.id;return(0,t.jsxs)("button",{type:"button",className:(0,p.cn)("flex w-full cursor-pointer items-center gap-3 px-3 py-2 text-left transition-colors","hover:bg-accent hover:text-accent-foreground",r&&"bg-accent/50"),onClick:()=>E(q.agentType,e.id),children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,t.jsx)("span",{className:"text-xs font-medium",children:e.displayName}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:e.description})]}),r?(0,t.jsx)(s.Check,{className:"text-primary h-3.5 w-3.5 shrink-0"}):null]},e.id)})]}):null})]})})]}),!!N&&(0,t.jsx)("p",{className:"text-destructive text-sm",children:N})]})}e.s(["AgentModelPicker",()=>f])}]);
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,24042,64970,e=>{"use strict";var t=e.i(3645);let n=(0,t.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);e.s(["Play",()=>n],24042);let r=(0,t.default)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);e.s(["Square",()=>r],64970)},81803,72714,60253,2287,17466,99348,e=>{"use strict";var t=e.i(20314),n=e.i(83428),r=e.i(51251),a=e.i(31777),o=e.i(35364),l=e.i(8361);function i({label:e,onClick:i,loading:s,error:u,icon:d,iconOnly:c=!1,variant:f="outline",size:p="sm"}){let m=(0,l.useSoundAction)("click");return(0,t.jsxs)(o.Button,{variant:f,size:p,"aria-label":e,disabled:s,onClick:()=>{m.play(),i()},className:(0,a.cn)("gap-1.5",u&&"text-destructive hover:text-destructive",!u&&c&&"ghost"===f&&"text-muted-foreground cursor-pointer rounded-full transition-colors hover:text-blue-500"),children:[s?(0,t.jsx)(n.Loader2,{className:"size-4 animate-spin"}):u?(0,t.jsx)(r.CircleAlert,{className:"size-4"}):(0,t.jsx)(d,{className:"size-4"}),c?null:e]})}e.s(["ActionButton",()=>i],72714),e.s([],81803);var s=e.i(79054),u=e.i(30702),d=e.i(38573),c=e.i(17406),f=e.i(81846),p=e.i(90033),m=e.i(90537);e.s(["X",()=>m.default],60253);var m=m;let g=p.Dialog.Root,h=p.Dialog.Trigger,v=p.Dialog.Portal,w=p.Dialog.Close,y=s.forwardRef(({className:e,onClick:n,...r},o)=>(0,t.jsx)(p.Dialog.Overlay,{ref:o,className:(0,a.cn)("fixed inset-0 z-50 bg-black/80",e),onClick:e=>{e.stopPropagation(),n?.(e)},...r}));y.displayName=p.Dialog.Overlay.displayName;let x=s.forwardRef(({className:e,children:n,...r},o)=>(0,t.jsxs)(v,{children:[(0,t.jsx)(y,{}),(0,t.jsxs)(p.Dialog.Content,{ref:o,className:(0,a.cn)("bg-background fixed top-[50%] left-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg sm:rounded-lg",e),...r,children:[n,(0,t.jsxs)(p.Dialog.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 cursor-pointer rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:pointer-events-none",children:[(0,t.jsx)(m.default,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));x.displayName=p.Dialog.Content.displayName;let b=({className:e,...n})=>(0,t.jsx)("div",{className:(0,a.cn)("flex flex-col space-y-1.5 text-center sm:text-left",e),...n});b.displayName="DialogHeader";let D=({className:e,...n})=>(0,t.jsx)("div",{className:(0,a.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...n});D.displayName="DialogFooter";let j=s.forwardRef(({className:e,...n},r)=>(0,t.jsx)(p.Dialog.Title,{ref:r,className:(0,a.cn)("text-lg leading-none font-semibold tracking-tight",e),...n}));j.displayName=p.Dialog.Title.displayName;let R=s.forwardRef(({className:e,...n},r)=>(0,t.jsx)(p.Dialog.Description,{ref:r,className:(0,a.cn)("text-muted-foreground text-sm",e),...n}));R.displayName=p.Dialog.Description.displayName,e.s(["Dialog",()=>g,"DialogClose",()=>w,"DialogContent",()=>x,"DialogDescription",()=>R,"DialogFooter",()=>D,"DialogHeader",()=>b,"DialogTitle",()=>j,"DialogTrigger",()=>h],2287);var C=e.i(21023);let T=(0,C.createServerReference)("40362fd8fbc87b6344436dc0e69b0599e49a3e0978",C.callServer,void 0,C.findSourceMapURL,"getDeploymentLogs");function N({open:e,onOpenChange:n,targetId:r}){let{logs:a,isConnected:o}=function(e){let[t,n]=(0,s.useState)([]),[r,a]=(0,s.useState)(!1),o=(0,s.useRef)(null),l=(0,s.useCallback)(()=>{o.current&&(o.current.close(),o.current=null),a(!1)},[]);return(0,s.useEffect)(()=>{if(!e){n([]),a(!1);return}T(e).then(e=>{e&&n(e)}).catch(()=>{});let t=new EventSource(`/api/deployment-logs?targetId=${e}`);return o.current=t,t.onopen=()=>{a(!0)},t.addEventListener("log",e=>{let t=JSON.parse(e.data);n(e=>[...e,t])}),t.onerror=()=>{a(!1)},()=>{t.close(),o.current=null}},[e,l]),{logs:t,isConnected:r}}(e?r:null);return(0,t.jsx)(E,{open:e,onOpenChange:n,logs:a,isConnected:o})}function E({open:e,onOpenChange:n,logs:r,isConnected:a}){let o=(0,s.useRef)(null),l=(0,s.useRef)(!0),i=(0,s.useCallback)(()=>{let e=o.current;e&&(l.current=e.scrollTop+e.clientHeight>=e.scrollHeight-50)},[]);return(0,s.useEffect)(()=>{l.current&&o.current&&(o.current.scrollTop=o.current.scrollHeight)},[r]),(0,t.jsx)(g,{open:e,onOpenChange:n,children:(0,t.jsxs)(x,{className:"flex h-[calc(100vh-48px)] max-h-[calc(100vh-48px)] w-full max-w-[calc(100vw-48px)] flex-col gap-0 bg-zinc-950 p-0 text-zinc-100 sm:rounded-lg","aria-describedby":void 0,children:[(0,t.jsxs)(b,{className:"flex flex-row items-center justify-between border-b border-zinc-800 px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(d.Terminal,{className:"h-4 w-4 text-zinc-400"}),(0,t.jsx)(j,{className:"text-sm font-medium text-zinc-100",children:"Server Logs"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 pr-8",children:[(0,t.jsx)("span",{className:`inline-block h-2 w-2 rounded-full ${a?"bg-green-500":"bg-zinc-500"}`}),(0,t.jsx)("span",{className:"text-xs text-zinc-400",children:a?"Connected":"Disconnected"})]})]}),(0,t.jsxs)("div",{ref:o,onScroll:i,className:"flex-1 overflow-auto p-4 font-mono text-sm leading-relaxed",children:[0===r.length?(0,t.jsx)("p",{className:"text-zinc-500",children:"Waiting for log output..."}):r.map(e=>(0,t.jsx)(S,{entry:e},`${e.timestamp}-${e.stream}-${e.line}`)),!a&&r.length>0&&(0,t.jsx)("div",{className:"mt-2 border-t border-zinc-800 pt-2 text-zinc-500",children:"[Server stopped]"})]})]})})}function S({entry:e}){return(0,t.jsx)("div",{"data-stream":e.stream,className:"stderr"===e.stream?"text-red-400":"text-zinc-200",children:(0,t.jsx)("span",{className:"break-all whitespace-pre-wrap",children:e.line})})}function $({status:e,url:r,targetId:a}){let[o,l]=(0,s.useState)(!1),i=a&&(e===c.DeploymentState.Booting||e===c.DeploymentState.Ready);switch(e){case c.DeploymentState.Booting:return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(f.Badge,{className:"border-transparent bg-blue-50 text-blue-700 hover:bg-blue-50",children:[(0,t.jsx)(n.Loader2,{className:"mr-1 h-3.5 w-3.5 animate-spin"}),"Starting...",i?(0,t.jsx)("button",{type:"button","aria-label":"View server logs",className:"ml-1.5 inline-flex items-center rounded-sm p-0.5 hover:bg-blue-100",onClick:e=>{e.stopPropagation(),l(!0)},children:(0,t.jsx)(d.Terminal,{className:"h-3 w-3"})}):null]}),i?(0,t.jsx)(N,{open:o,onOpenChange:l,targetId:a}):null]});case c.DeploymentState.Ready:return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(f.Badge,{className:"border-transparent bg-green-50 text-green-700 hover:bg-green-50",children:[(0,t.jsx)("span",{className:"mr-1 inline-block h-2 w-2 rounded-full bg-green-500"}),r?(0,t.jsxs)("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 hover:underline",onClick:e=>e.stopPropagation(),children:[r,(0,t.jsx)(u.ExternalLink,{className:"h-3 w-3"})]}):"Ready",i?(0,t.jsx)("button",{type:"button","aria-label":"View server logs",className:"ml-1.5 inline-flex items-center rounded-sm p-0.5 hover:bg-green-100",onClick:e=>{e.stopPropagation(),l(!0)},children:(0,t.jsx)(d.Terminal,{className:"h-3 w-3"})}):null]}),i?(0,t.jsx)(N,{open:o,onOpenChange:l,targetId:a}):null]});default:return null}}e.s(["DeploymentStatusBadge",()=>$],17466),e.s([],99348)},45811,e=>{"use strict";let t;var n=e.i(20314),r=e.i(48249),a=e.i(567),o=e.i(79054);let l=o.default.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),i=()=>{let e=o.default.useContext(l);if(!e)throw Error("useDrawerContext must be used within a Drawer.Root");return e};function s(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function u(){return d(/^iPhone/)||d(/^iPad/)||d(/^Mac/)&&navigator.maxTouchPoints>1}function d(e){return"u">typeof window&&null!=window.navigator?e.test(window.navigator.platform):void 0}!function(e){if(!e||"u"<typeof document)return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}("[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(\n[data-state=closed]\n){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}");let c="u">typeof window?o.useLayoutEffect:o.useEffect;function f(...e){return(...t)=>{for(let n of e)"function"==typeof n&&n(...t)}}let p="u">typeof document&&window.visualViewport;function m(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function g(e){for(m(e)&&(e=e.parentElement);e&&!m(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}let h=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),v=0;function w(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function y(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let t=g(e);if(t!==document.documentElement&&t!==document.body&&t!==e){let n=t.getBoundingClientRect().top,r=e.getBoundingClientRect().top;e.getBoundingClientRect().bottom>t.getBoundingClientRect().bottom+24&&(t.scrollTop+=r-n)}e=t.parentElement}}function x(e){return e instanceof HTMLInputElement&&!h.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function b(...e){return o.useCallback(function(...e){return t=>e.forEach(e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)})}(...e),e)}let D=new WeakMap;function j(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([t,n])=>{t.startsWith("--")?e.style.setProperty(t,n):(r[t]=e.style[t],e.style[t]=n)}),n||D.set(e,r)}let R=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function C(e,t){if(!e)return null;let n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform,a=r.match(/^matrix3d\((.+)\)$/);return a?parseFloat(a[1].split(", ")[R(t)?13:12]):(a=r.match(/^matrix\((.+)\)$/))?parseFloat(a[1].split(", ")[R(t)?5:4]):null}function T(e,t){if(!e)return()=>{};let n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}let N=[.32,.72,0,1],E="vaul-dragging";function S(e){let t=o.default.useRef(e);return o.default.useEffect(()=>{t.current=e}),o.default.useMemo(()=>(...e)=>null==t.current?void 0:t.current.call(t,...e),[])}function $({prop:e,defaultProp:t,onChange:n=()=>{}}){let[r,a]=function({defaultProp:e,onChange:t}){let n=o.default.useState(e),[r]=n,a=o.default.useRef(r),l=S(t);return o.default.useEffect(()=>{a.current!==r&&(l(r),a.current=r)},[r,a,l]),n}({defaultProp:t,onChange:n}),l=void 0!==e,i=l?e:r,s=S(n);return[i,o.default.useCallback(t=>{if(l){let n="function"==typeof t?t(e):t;n!==e&&s(n)}else a(t)},[l,e,a,s])]}let k=()=>()=>{},P=null;function M({open:e,onOpenChange:n,children:r,onDrag:i,onRelease:d,snapPoints:m,shouldScaleBackground:h=!1,setBackgroundColorOnScale:b=!0,closeThreshold:T=.25,scrollLockTimeout:S=100,dismissible:k=!0,handleOnly:M=!1,fadeFromIndex:O=m&&m.length-1,activeSnapPoint:z,setActiveSnapPoint:L,fixed:B,modal:F=!0,onClose:A,nested:I,noBodyStyles:H=!1,direction:W="bottom",defaultOpen:q=!1,disablePreventScroll:Y=!0,snapToSequentialPoint:U=!1,preventScrollRestoration:X=!1,repositionInputs:V=!0,onAnimationEnd:K,container:J,autoFocus:_=!1}){var G,Q;let[Z=!1,ee]=$({defaultProp:q,prop:e,onChange:e=>{null==n||n(e),e||I||ek(),setTimeout(()=>{null==K||K(e)},500),e&&!F&&"u">typeof window&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),e||(document.body.style.pointerEvents="auto")}}),[et,en]=o.default.useState(!1),[er,ea]=o.default.useState(!1),[eo,el]=o.default.useState(!1),ei=o.default.useRef(null),es=o.default.useRef(null),eu=o.default.useRef(null),ed=o.default.useRef(null),ec=o.default.useRef(null),ef=o.default.useRef(!1),ep=o.default.useRef(null),em=o.default.useRef(0),eg=o.default.useRef(!1),eh=o.default.useRef(!q),ev=o.default.useRef(0),ew=o.default.useRef(null),ey=o.default.useRef((null==(G=ew.current)?void 0:G.getBoundingClientRect().height)||0),ex=o.default.useRef((null==(Q=ew.current)?void 0:Q.getBoundingClientRect().width)||0),eb=o.default.useRef(0),eD=o.default.useCallback(e=>{m&&e===eN.length-1&&(es.current=new Date)},[]),{activeSnapPoint:ej,activeSnapPointIndex:eR,setActiveSnapPoint:eC,onRelease:eT,snapPointsOffset:eN,onDrag:eE,shouldFade:eS,getPercentageDragged:e$}=function({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:r,overlayRef:a,fadeFromIndex:l,onSnapPointChange:i,direction:s="bottom",container:u,snapToSequentialPoint:d}){let[c,f]=$({prop:e,defaultProp:null==n?void 0:n[0],onChange:t}),[p,m]=o.default.useState("u">typeof window?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);o.default.useEffect(()=>{function e(){m({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);let g=o.default.useMemo(()=>c===(null==n?void 0:n[n.length-1])||null,[n,c]),h=o.default.useMemo(()=>{var e;return null!=(e=null==n?void 0:n.findIndex(e=>e===c))?e:null},[n,c]),v=n&&n.length>0&&(l||0===l)&&!Number.isNaN(l)&&n[l]===c||!n,w=o.default.useMemo(()=>{var e;let t=u?{width:u.getBoundingClientRect().width,height:u.getBoundingClientRect().height}:"u">typeof window?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};return null!=(e=null==n?void 0:n.map(e=>{let n="string"==typeof e,r=0;if(n&&(r=parseInt(e,10)),R(s)){let a=n?r:p?e*t.height:0;return p?"bottom"===s?t.height-a:-t.height+a:a}let a=n?r:p?e*t.width:0;return p?"right"===s?t.width-a:-t.width+a:a}))?e:[]},[n,p,u]),y=o.default.useMemo(()=>null!==h?null==w?void 0:w[h]:null,[w,h]),x=o.default.useCallback(e=>{var t;let o=null!=(t=null==w?void 0:w.findIndex(t=>t===e))?t:null;i(o),j(r.current,{transition:`transform 0.5s cubic-bezier(${N.join(",")})`,transform:R(s)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`}),w&&o!==w.length-1&&void 0!==l&&o!==l&&o<l?j(a.current,{transition:`opacity 0.5s cubic-bezier(${N.join(",")})`,opacity:"0"}):j(a.current,{transition:`opacity 0.5s cubic-bezier(${N.join(",")})`,opacity:"1"}),f(null==n?void 0:n[Math.max(o,0)])},[r.current,n,w,l,a,f]);return o.default.useEffect(()=>{if(c||e){var t;let r=null!=(t=null==n?void 0:n.findIndex(t=>t===e||t===c))?t:-1;w&&-1!==r&&"number"==typeof w[r]&&x(w[r])}},[c,e,n,w,x]),{isLastSnapPoint:g,activeSnapPoint:c,shouldFade:v,getPercentageDragged:function(e,t){if(!n||"number"!=typeof h||!w||void 0===l)return null;let r=h===l-1;if(h>=l&&t)return 0;if(r&&!t)return 1;if(!v&&!r)return null;let a=r?h+1:h-1,o=e/Math.abs(r?w[a]-w[a-1]:w[a+1]-w[a]);return r?1-o:o},setActiveSnapPoint:f,activeSnapPointIndex:h,onRelease:function({draggedDistance:e,closeDrawer:t,velocity:r,dismissible:o}){if(void 0===l)return;let i="bottom"===s||"right"===s?(null!=y?y:0)-e:(null!=y?y:0)+e,u=h===l-1,c=0===h,f=e>0;if(u&&j(a.current,{transition:`opacity 0.5s cubic-bezier(${N.join(",")})`}),!d&&r>2&&!f)return void(o?t():x(w[0]));if(!d&&r>2&&f&&w&&n)return void x(w[n.length-1]);let p=null==w?void 0:w.reduce((e,t)=>"number"!=typeof e||"number"!=typeof t?e:Math.abs(t-i)<Math.abs(e-i)?t:e),m=R(s)?window.innerHeight:window.innerWidth;if(r>.4&&Math.abs(e)<.4*m){let e=f?1:-1;return e>0&&g&&n?void x(w[n.length-1]):void(c&&e<0&&o&&t(),null===h||x(w[h+e]))}x(p)},onDrag:function({draggedDistance:e}){if(null===y)return;let t="bottom"===s||"right"===s?y-e:y+e;("bottom"===s||"right"===s)&&t<w[w.length-1]||("top"===s||"left"===s)&&t>w[w.length-1]||j(r.current,{transform:R(s)?`translate3d(0, ${t}px, 0)`:`translate3d(${t}px, 0, 0)`})},snapPointsOffset:w}}({snapPoints:m,activeSnapPointProp:z,setActiveSnapPointProp:L,drawerRef:ew,fadeFromIndex:O,overlayRef:ei,onSnapPointChange:eD,direction:W,container:J,snapToSequentialPoint:U});!function(e={}){let{isDisabled:n}=e;c(()=>{if(!n){var e,r,a;let n,o,l,i,s,d,c;return 1==++v&&u()&&(l=0,i=window.pageXOffset,s=window.pageYOffset,d=f((e=document.documentElement,r="paddingRight",a=`${window.innerWidth-document.documentElement.clientWidth}px`,n=e.style[r],e.style[r]=a,()=>{e.style[r]=n})),window.scrollTo(0,0),c=f(w(document,"touchstart",e=>{((o=g(e.target))!==document.documentElement||o!==document.body)&&(l=e.changedTouches[0].pageY)},{passive:!1,capture:!0}),w(document,"touchmove",e=>{if(!o||o===document.documentElement||o===document.body)return void e.preventDefault();let t=e.changedTouches[0].pageY,n=o.scrollTop,r=o.scrollHeight-o.clientHeight;0!==r&&((n<=0&&t>l||n>=r&&t<l)&&e.preventDefault(),l=t)},{passive:!1,capture:!0}),w(document,"touchend",e=>{let t=e.target;x(t)&&t!==document.activeElement&&(e.preventDefault(),t.style.transform="translateY(-2000px)",t.focus(),requestAnimationFrame(()=>{t.style.transform=""}))},{passive:!1,capture:!0}),w(document,"focus",e=>{let t=e.target;x(t)&&(t.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{t.style.transform="",p&&(p.height<window.innerHeight?requestAnimationFrame(()=>{y(t)}):p.addEventListener("resize",()=>y(t),{once:!0}))}))},!0),w(window,"scroll",()=>{window.scrollTo(0,0)})),t=()=>{d(),c(),window.scrollTo(i,s)}),()=>{0==--v&&(null==t||t())}}},[n])}({isDisabled:!Z||er||!F||eo||!et||!V||!Y});let{restorePositionSetting:ek}=function({isOpen:e,modal:t,nested:n,hasBeenOpened:r,preventScrollRestoration:a,noBodyStyles:l}){let[i,u]=o.default.useState(()=>"u">typeof window?window.location.href:""),d=o.default.useRef(0),c=o.default.useCallback(()=>{if(s()&&null===P&&e&&!l){P={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};let{scrollX:e,innerHeight:t}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-d.current}px`,left:`${-e}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{let e=t-window.innerHeight;e&&d.current>=t&&(document.body.style.top=`${-(d.current+e)}px`)}),300)}},[e]),f=o.default.useCallback(()=>{if(s()&&null!==P&&!l){let e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);Object.assign(document.body.style,P),window.requestAnimationFrame(()=>{a&&i!==window.location.href?u(window.location.href):window.scrollTo(t,e)}),P=null}},[i]);return o.default.useEffect(()=>{function e(){d.current=window.scrollY}return e(),window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}},[]),o.default.useEffect(()=>{if(t)return()=>{"u"<typeof document||document.querySelector("[data-vaul-drawer]")||f()}},[t,f]),o.default.useEffect(()=>{!n&&r&&(e?(window.matchMedia("(display-mode: standalone)").matches||c(),t||window.setTimeout(()=>{f()},500)):f())},[e,r,i,t,n,c,f]),{restorePositionSetting:f}}({isOpen:Z,modal:F,nested:null!=I&&I,hasBeenOpened:et,preventScrollRestoration:X,noBodyStyles:H});function eP(){return(window.innerWidth-26)/window.innerWidth}function eM(e,t){var n;let r=e,a=null==(n=window.getSelection())?void 0:n.toString(),o=ew.current?C(ew.current,W):null,l=new Date;if("SELECT"===r.tagName||r.hasAttribute("data-vaul-no-drag")||r.closest("[data-vaul-no-drag]"))return!1;if("right"===W||"left"===W)return!0;if(es.current&&l.getTime()-es.current.getTime()<500)return!1;if(null!==o&&("bottom"===W?o>0:o<0))return!0;if(a&&a.length>0)return!1;if(ec.current&&l.getTime()-ec.current.getTime()<S&&0===o||t)return ec.current=l,!1;for(;r;){if(r.scrollHeight>r.clientHeight){if(0!==r.scrollTop)return ec.current=new Date,!1;if("dialog"===r.getAttribute("role"))break}r=r.parentNode}return!0}function eO(e){er&&ew.current&&(ew.current.classList.remove(E),ef.current=!1,ea(!1),ed.current=new Date),null==A||A(),e||ee(!1),setTimeout(()=>{m&&eC(m[0])},500)}function ez(){if(!ew.current)return;let e=document.querySelector("[data-vaul-drawer-wrapper]"),t=C(ew.current,W);j(ew.current,{transform:"translate3d(0, 0, 0)",transition:`transform 0.5s cubic-bezier(${N.join(",")})`}),j(ei.current,{transition:`opacity 0.5s cubic-bezier(${N.join(",")})`,opacity:"1"}),h&&t&&t>0&&Z&&j(e,{borderRadius:"8px",overflow:"hidden",...R(W)?{transform:`scale(${eP()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${eP()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:"0.5s",transitionTimingFunction:`cubic-bezier(${N.join(",")})`},!0)}return o.default.useEffect(()=>{window.requestAnimationFrame(()=>{eh.current=!0})},[]),o.default.useEffect(()=>{var e;function t(){if(ew.current&&V&&(x(document.activeElement)||eg.current)){var e;let t=(null==(e=window.visualViewport)?void 0:e.height)||0,n=window.innerHeight,r=n-t,a=ew.current.getBoundingClientRect().height||0;eb.current||(eb.current=a);let o=ew.current.getBoundingClientRect().top;if(Math.abs(ev.current-r)>60&&(eg.current=!eg.current),m&&m.length>0&&eN&&eR&&(r+=eN[eR]||0),ev.current=r,a>t||eg.current){let e=ew.current.getBoundingClientRect().height,l=e;e>t&&(l=t-(a>.8*n?o:26)),B?ew.current.style.height=`${e-Math.max(r,0)}px`:ew.current.style.height=`${Math.max(l,t-o)}px`}else{let e;e=navigator.userAgent,"u">typeof window&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))||(ew.current.style.height=`${eb.current}px`)}m&&m.length>0&&!eg.current?ew.current.style.bottom="0px":ew.current.style.bottom=`${Math.max(r,0)}px`}}return null==(e=window.visualViewport)||e.addEventListener("resize",t),()=>{var e;return null==(e=window.visualViewport)?void 0:e.removeEventListener("resize",t)}},[eR,m,eN]),o.default.useEffect(()=>(Z&&(j(document.documentElement,{scrollBehavior:"auto"}),es.current=new Date),()=>{!function(e,t){if(!e||!(e instanceof HTMLElement))return;let n=D.get(e);n&&(e.style[t]=n[t])}(document.documentElement,"scrollBehavior")}),[Z]),o.default.useEffect(()=>{F||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[F]),o.default.createElement(a.Root,{defaultOpen:q,onOpenChange:e=>{(k||e)&&(e?en(!0):eO(!0),ee(e))},open:Z},o.default.createElement(l.Provider,{value:{activeSnapPoint:ej,snapPoints:m,setActiveSnapPoint:eC,drawerRef:ew,overlayRef:ei,onOpenChange:n,onPress:function(e){var t,n;!k&&!m||(!ew.current||ew.current.contains(e.target))&&(ey.current=(null==(t=ew.current)?void 0:t.getBoundingClientRect().height)||0,ex.current=(null==(n=ew.current)?void 0:n.getBoundingClientRect().width)||0,ea(!0),eu.current=new Date,u()&&window.addEventListener("touchend",()=>ef.current=!1,{once:!0}),e.target.setPointerCapture(e.pointerId),em.current=R(W)?e.pageY:e.pageX)},onRelease:function(e){var t,n;if(!er||!ew.current)return;ew.current.classList.remove(E),ef.current=!1,ea(!1),ed.current=new Date;let r=C(ew.current,W);if(!e||!eM(e.target,!1)||!r||Number.isNaN(r)||null===eu.current)return;let a=ed.current.getTime()-eu.current.getTime(),o=em.current-(R(W)?e.pageY:e.pageX),l=Math.abs(o)/a;if(l>.05&&(el(!0),setTimeout(()=>{el(!1)},200)),m){eT({draggedDistance:o*("bottom"===W||"right"===W?1:-1),closeDrawer:eO,velocity:l,dismissible:k}),null==d||d(e,!0);return}if("bottom"===W||"right"===W?o>0:o<0){ez(),null==d||d(e,!0);return}if(l>.4){eO(),null==d||d(e,!1);return}let i=Math.min(null!=(t=ew.current.getBoundingClientRect().height)?t:0,window.innerHeight),s=Math.min(null!=(n=ew.current.getBoundingClientRect().width)?n:0,window.innerWidth);if(Math.abs(r)>=("left"===W||"right"===W?s:i)*T){eO(),null==d||d(e,!1);return}null==d||d(e,!0),ez()},onDrag:function(e){if(ew.current&&er){let t="bottom"===W||"right"===W?1:-1,n=(em.current-(R(W)?e.pageY:e.pageX))*t,r=n>0,a=m&&!k&&!r;if(a&&0===eR)return;let o=Math.abs(n),l=document.querySelector("[data-vaul-drawer-wrapper]"),s=o/("bottom"===W||"top"===W?ey.current:ex.current),u=e$(o,r);if(null!==u&&(s=u),a&&s>=1||!ef.current&&!eM(e.target,r))return;if(ew.current.classList.add(E),ef.current=!0,j(ew.current,{transition:"none"}),j(ei.current,{transition:"none"}),m&&eE({draggedDistance:n}),r&&!m){let e=Math.min(-(8*(Math.log(n+1)-2)*1),0)*t;j(ew.current,{transform:R(W)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`});return}let d=1-s;if((eS||O&&eR===O-1)&&(null==i||i(e,s),j(ei.current,{opacity:`${d}`,transition:"none"},!0)),l&&ei.current&&h){let e=Math.min(eP()+s*(1-eP()),1),t=8-8*s,n=Math.max(0,14-14*s);j(l,{borderRadius:`${t}px`,transform:R(W)?`scale(${e}) translate3d(0, ${n}px, 0)`:`scale(${e}) translate3d(${n}px, 0, 0)`,transition:"none"},!0)}if(!m){let e=o*t;j(ew.current,{transform:R(W)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})}}},dismissible:k,shouldAnimate:eh,handleOnly:M,isOpen:Z,isDragging:er,shouldFade:eS,closeDrawer:eO,onNestedDrag:function(e,t){if(t<0)return;let n=(window.innerWidth-16)/window.innerWidth,r=n+t*(1-n),a=-16+16*t;j(ew.current,{transform:R(W)?`scale(${r}) translate3d(0, ${a}px, 0)`:`scale(${r}) translate3d(${a}px, 0, 0)`,transition:"none"})},onNestedOpenChange:function(e){let t=e?(window.innerWidth-16)/window.innerWidth:1,n=e?-16:0;ep.current&&window.clearTimeout(ep.current),j(ew.current,{transition:`transform 0.5s cubic-bezier(${N.join(",")})`,transform:R(W)?`scale(${t}) translate3d(0, ${n}px, 0)`:`scale(${t}) translate3d(${n}px, 0, 0)`}),!e&&ew.current&&(ep.current=setTimeout(()=>{let e=C(ew.current,W);j(ew.current,{transition:"none",transform:R(W)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})},500))},onNestedRelease:function(e,t){let n=R(W)?window.innerHeight:window.innerWidth,r=t?(n-16)/n:1,a=t?-16:0;t&&j(ew.current,{transition:`transform 0.5s cubic-bezier(${N.join(",")})`,transform:R(W)?`scale(${r}) translate3d(0, ${a}px, 0)`:`scale(${r}) translate3d(${a}px, 0, 0)`})},keyboardIsOpen:eg,modal:F,snapPointsOffset:eN,activeSnapPointIndex:eR,direction:W,shouldScaleBackground:h,setBackgroundColorOnScale:b,noBodyStyles:H,container:J,autoFocus:_}},r))}let O=o.default.forwardRef(function({...e},t){let{overlayRef:n,snapPoints:r,onRelease:l,shouldFade:s,isOpen:u,modal:d,shouldAnimate:c}=i(),f=b(t,n),p=r&&r.length>0;if(!d)return null;let m=o.default.useCallback(e=>l(e),[l]);return o.default.createElement(a.Overlay,{onMouseUp:m,ref:f,"data-vaul-overlay":"","data-vaul-snap-points":u&&p?"true":"false","data-vaul-snap-points-overlay":u&&s?"true":"false","data-vaul-animate":(null==c?void 0:c.current)?"true":"false",...e})});O.displayName="Drawer.Overlay";let z=o.default.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...r},l){let{drawerRef:s,onPress:u,onRelease:d,onDrag:c,keyboardIsOpen:f,snapPointsOffset:p,activeSnapPointIndex:m,modal:g,isOpen:h,direction:v,snapPoints:w,container:y,handleOnly:x,shouldAnimate:D,autoFocus:j}=i(),[C,E]=o.default.useState(!1),S=b(l,s),$=o.default.useRef(null),P=o.default.useRef(null),M=o.default.useRef(!1),O=w&&w.length>0;function z(e){$.current=null,M.current=!1,d(e)}return!function(){let{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:a}=i(),l=o.default.useRef(null),s=(0,o.useMemo)(()=>document.body.style.backgroundColor,[]);function u(){return(window.innerWidth-26)/window.innerWidth}o.default.useEffect(()=>{if(t&&n){l.current&&clearTimeout(l.current);let t=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!t)return;!function(...e){}(r&&!a?T(document.body,{background:"black"}):k,T(t,{transformOrigin:R(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:"0.5s",transitionTimingFunction:`cubic-bezier(${N.join(",")})`}));let n=T(t,{borderRadius:"8px",overflow:"hidden",...R(e)?{transform:`scale(${u()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${u()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{n(),l.current=window.setTimeout(()=>{s?document.body.style.background=s:document.body.style.removeProperty("background")},500)}}},[t,n,s])}(),o.default.useEffect(()=>{O&&window.requestAnimationFrame(()=>{E(!0)})},[]),o.default.createElement(a.Content,{"data-vaul-drawer-direction":v,"data-vaul-drawer":"","data-vaul-delayed-snap-points":C?"true":"false","data-vaul-snap-points":h&&O?"true":"false","data-vaul-custom-container":y?"true":"false","data-vaul-animate":(null==D?void 0:D.current)?"true":"false",...r,ref:S,style:p&&p.length>0?{"--snap-point-height":`${p[null!=m?m:0]}px`,...t}:t,onPointerDown:e=>{x||(null==r.onPointerDown||r.onPointerDown.call(r,e),$.current={x:e.pageX,y:e.pageY},u(e))},onOpenAutoFocus:e=>{null==n||n(e),j||e.preventDefault()},onPointerDownOutside:t=>{(null==e||e(t),!g||t.defaultPrevented)?t.preventDefault():f.current&&(f.current=!1)},onFocusOutside:e=>{if(!g)return void e.preventDefault()},onPointerMove:e=>{if(P.current=e,x||(null==r.onPointerMove||r.onPointerMove.call(r,e),!$.current))return;let t=e.pageY-$.current.y,n=e.pageX-$.current.x,a="touch"===e.pointerType?10:2;((e,t,n=0)=>{if(M.current)return!0;let r=Math.abs(e.y),a=Math.abs(e.x),o=a>r,l=["bottom","right"].includes(t)?1:-1;if("left"===t||"right"===t){if(!(e.x*l<0)&&a>=0&&a<=n)return o}else if(!(e.y*l<0)&&r>=0&&r<=n)return!o;return M.current=!0,!0})({x:n,y:t},v,a)?c(e):(Math.abs(n)>a||Math.abs(t)>a)&&($.current=null)},onPointerUp:e=>{null==r.onPointerUp||r.onPointerUp.call(r,e),$.current=null,M.current=!1,d(e)},onPointerOut:e=>{null==r.onPointerOut||r.onPointerOut.call(r,e),z(P.current)},onContextMenu:e=>{null==r.onContextMenu||r.onContextMenu.call(r,e),P.current&&z(P.current)}})});z.displayName="Drawer.Content";let L=o.default.forwardRef(function({preventCycle:e=!1,children:t,...n},r){let{closeDrawer:a,isDragging:l,snapPoints:s,activeSnapPoint:u,setActiveSnapPoint:d,dismissible:c,handleOnly:f,isOpen:p,onPress:m,onDrag:g}=i(),h=o.default.useRef(null),v=o.default.useRef(!1);function w(){h.current&&window.clearTimeout(h.current),v.current=!1}return o.default.createElement("div",{onClick:function(){v.current?w():window.setTimeout(()=>{!function(){if(l||e||v.current)return w();if(w(),!s||0===s.length){c||a();return}if(u===s[s.length-1]&&c)return a();let t=s.findIndex(e=>e===u);-1===t||d(s[t+1])}()},120)},onPointerCancel:w,onPointerDown:e=>{f&&m(e),h.current=window.setTimeout(()=>{v.current=!0},250)},onPointerMove:e=>{f&&g(e)},ref:r,"data-vaul-drawer-visible":p?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},o.default.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});L.displayName="Drawer.Handle";let B={Root:M,NestedRoot:function({onDrag:e,onOpenChange:t,open:n,...r}){let{onNestedDrag:a,onNestedOpenChange:l,onNestedRelease:s}=i();if(!a)throw Error("Drawer.NestedRoot must be placed in another drawer");return o.default.createElement(M,{nested:!0,open:n,onClose:()=>{l(!1)},onDrag:(t,n)=>{a(t,n),null==e||e(t,n)},onOpenChange:e=>{e&&l(e),null==t||t(e)},onRelease:s,...r})},Content:z,Overlay:O,Trigger:a.Trigger,Portal:function(e){let t=i(),{container:n=t.container,...r}=e;return o.default.createElement(a.Portal,{container:n,...r})},Handle:L,Close:a.Close,Title:a.Title,Description:a.Description};var F=e.i(31777);function A({...e}){return(0,n.jsx)(B.Root,{"data-slot":"drawer",...e})}function I({...e}){return(0,n.jsx)(B.Portal,{"data-slot":"drawer-portal",...e})}function H({className:e,...t}){return(0,n.jsx)(B.Overlay,{"data-slot":"drawer-overlay",className:(0,F.cn)("fixed inset-0 z-50 bg-black/50",e),...t})}function W({className:e,children:t,direction:a="bottom",showCloseButton:o=!0,...l}){return(0,n.jsx)(I,{children:(0,n.jsxs)(B.Content,{"data-slot":"drawer-content",className:(0,F.cn)("bg-background fixed z-50 flex flex-col shadow-lg","bottom"===a&&"inset-x-0 bottom-0 mb-24 rounded-t-lg border-t","top"===a&&"inset-x-0 top-0 mt-24 rounded-b-lg border-b","right"===a&&"inset-y-0 right-0 h-full w-3/4 border-l","left"===a&&"inset-y-0 left-0 h-full w-3/4 border-r",e),style:{"--initial-transform":"right"===a?"calc(100% + 8px)":"left"===a||"top"===a?"calc(-100% - 8px)":"calc(100% + 8px)",userSelect:"text",...l.style??{}},...l,children:[t,o?(0,n.jsxs)(B.Close,{className:"ring-offset-background focus:ring-ring absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[(0,n.jsx)(r.XIcon,{className:"size-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Close"})]}):null]})})}function q({className:e,...t}){return(0,n.jsx)("div",{"data-slot":"drawer-header",className:(0,F.cn)("flex flex-col gap-1.5 p-4",e),...t})}function Y({className:e,...t}){return(0,n.jsx)("div",{"data-slot":"drawer-footer",className:(0,F.cn)("mt-auto flex flex-col gap-2 p-4",e),...t})}function U({className:e,...t}){return(0,n.jsx)(B.Title,{"data-slot":"drawer-title",className:(0,F.cn)("text-foreground font-semibold",e),...t})}function X({className:e,...t}){return(0,n.jsx)(B.Description,{"data-slot":"drawer-description",className:(0,F.cn)("text-muted-foreground text-sm",e),...t})}e.s(["Drawer",()=>A,"DrawerContent",()=>W,"DrawerDescription",()=>X,"DrawerFooter",()=>Y,"DrawerHeader",()=>q,"DrawerOverlay",()=>H,"DrawerTitle",()=>U],45811)},8537,e=>{"use strict";var t=e.i(79054),n=e.i(18354),r=e.i(21023);let a=(0,r.createServerReference)("4042b814108ac49bebf4019fde270086b5d81d7651",r.callServer,void 0,r.findSourceMapURL,"deployFeature"),o=(0,r.createServerReference)("40619f3c0df5417b9b7c8fa5c95fc83dc528d22925",r.callServer,void 0,r.findSourceMapURL,"deployRepository"),l=(0,r.createServerReference)("406988495b5f3a578334756e67739906f8550d9ad6",r.callServer,void 0,r.findSourceMapURL,"stopDeployment"),i=(0,r.createServerReference)("40c068f1d29b3c0a3482895e23c0e503be4d0091ca",r.callServer,void 0,r.findSourceMapURL,"getDeploymentStatus"),s=(0,n.createLogger)("[useDeployAction]");function u(e){let[n,r]=(0,t.useState)(!1),[u,d]=(0,t.useState)(!1),[c,f]=(0,t.useState)(null),[p,m]=(0,t.useState)(null),[g,h]=(0,t.useState)(null),v=(0,t.useRef)(null),w=(0,t.useRef)(null),y=(0,t.useRef)(!0),x=(0,t.useRef)(p);(0,t.useEffect)(()=>{x.current=p},[p]),(0,t.useEffect)(()=>(y.current=!0,()=>{y.current=!1}),[]),(0,t.useEffect)(()=>()=>{v.current&&clearTimeout(v.current),w.current&&clearInterval(w.current)},[]);let b=(0,t.useCallback)(()=>{w.current&&(s.debug("stopping polling"),clearInterval(w.current),w.current=null)},[]),D=(0,t.useCallback)(e=>{b(),s.debug(`starting polling for "${e}" every 3000ms`),w.current=setInterval(async()=>{if(!y.current)return void b();let t=await i(e);y.current&&(t&&"Stopped"!==t.state?(t.state!==x.current&&s.info(`poll state changed: ${x.current} → ${t.state}, url=${t.url}`),m(t.state),h(t.url)):(s.info(`poll result: ${t?`state=${t.state}`:"null (deployment gone)"} — stopping poll`),m(null),h(null),b()))},3e3)},[b]),j=(0,t.useCallback)(async()=>{if(!e)return void s.warn("deploy() called but input is null — no-op");if(n)return void s.warn("deploy() called but already loading — no-op");s.info(`deploy() — targetType="${e.targetType}", targetId="${e.targetId}", repositoryPath="${e.repositoryPath}"`),v.current&&clearTimeout(v.current),r(!0),f(null);try{let t="feature"===e.targetType?await a(e.targetId):await o(e.repositoryPath);if(s.info("server action result:",t),!y.current)return void s.warn("component unmounted after deploy — discarding result");if(t.success)s.info(`deploy succeeded — initial state=${t.state}, starting polling`),m(t.state??null),h(null),D(e.targetId);else{let e=t.error??"An unexpected error occurred";s.error(`deploy failed: ${e}`),f(e),v.current=setTimeout(()=>f(null),5e3)}}catch(t){if(!y.current)return;let e=t instanceof Error?t.message:"An unexpected error occurred";s.error(`deploy threw exception: ${e}`,t),f(e),v.current=setTimeout(()=>f(null),5e3)}finally{y.current&&r(!1)}},[e,n,D]),R=(0,t.useCallback)(async()=>{if(e&&!u){s.info(`stop() — targetId="${e.targetId}"`),d(!0);try{let t=await l(e.targetId);if(s.info("stop result:",t),!y.current)return;t.success&&(b(),m(null),h(null))}catch(e){s.warn("stop error (non-critical):",e)}finally{y.current&&d(!1)}}},[e,u,b]);return{deploy:j,stop:R,deployLoading:n,stopLoading:u,deployError:c,status:p,url:g}}e.s(["useDeployAction",()=>u],8537)},11495,e=>{"use strict";var t=e.i(20314),n=e.i(79054),r=e.i(48249),a=e.i(24042),o=e.i(64970),l=e.i(94237),i=e.i(31777);e.i(81803);var s=e.i(72714);e.i(99348);var u=e.i(17466),d=e.i(45811),c=e.i(25235),f=e.i(2828),p=e.i(8537),m=e.i(75921);let g=(0,l.cva)("",{variants:{size:{sm:"w-96",md:"w-xl"}},defaultVariants:{size:"sm"}});function h({open:e,onClose:a,modal:o=!1,dismissOnOutsideClick:l=!1,title:s="Drawer",size:u,header:f,children:p,footer:h,className:w,"data-testid":y,deployTarget:x}){let b=(0,m.useFeatureFlags)(),D=(0,n.useRef)(null);return(0,n.useEffect)(()=>{if(!e||o)return;let t=e=>{let t=e.target;!document.body.contains(t)||D.current?.contains(t)||t.closest(l?'[role="alertdialog"], [role="dialog"], [role="menu"], [role="listbox"], [data-radix-popper-content-wrapper]':'[data-no-drawer-close], [role="alertdialog"], [role="dialog"], [role="menu"], [role="listbox"], [data-radix-popper-content-wrapper]')||a()};return document.addEventListener("click",t),()=>document.removeEventListener("click",t)},[e,o,a,l]),(0,t.jsxs)(d.Drawer,{direction:"right",modal:o,handleOnly:!0,open:e,onOpenChange:e=>{e||a()},children:[o?(0,t.jsx)(d.DrawerOverlay,{}):null,(0,t.jsxs)(d.DrawerContent,{ref:D,direction:"right",showCloseButton:!1,className:(0,i.cn)(g({size:u}),w),"data-testid":y,onInteractOutside:o?void 0:e=>e.preventDefault(),children:[(0,t.jsx)(d.DrawerTitle,{asChild:!0,children:(0,t.jsx)("span",{className:"sr-only",children:s})}),(0,t.jsx)(d.DrawerDescription,{asChild:!0,children:(0,t.jsx)("span",{className:"sr-only",children:s})}),(0,t.jsxs)("button",{type:"button","aria-label":"Close",onClick:a,className:"ring-offset-background focus:ring-ring absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden","data-testid":y?`${y}-close-button`:void 0,children:[(0,t.jsx)(r.XIcon,{className:"size-4"}),(0,t.jsx)("span",{className:"sr-only",children:"Close"})]}),f?(0,t.jsx)(d.DrawerHeader,{className:"shrink-0",children:f}):null,f?(0,t.jsx)(c.Separator,{}):null,b.envDeploy&&x?(0,t.jsx)(v,{deployTarget:x}):null,(0,t.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:p}),h?(0,t.jsx)(d.DrawerFooter,{className:"shrink-0",children:h}):null]})]})}function v({deployTarget:e}){let n=(0,p.useDeployAction)(e),r="Booting"===n.status||"Ready"===n.status;return(0,t.jsxs)("div",{"data-testid":"base-drawer-deploy-bar",className:"flex items-center gap-2 px-4 pb-3",children:[(0,t.jsx)(f.TooltipProvider,{children:(0,t.jsxs)(f.Tooltip,{children:[(0,t.jsx)(f.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{children:(0,t.jsx)(s.ActionButton,{label:r?"Stop Dev Server":"Start Dev Server",onClick:r?n.stop:n.deploy,loading:n.deployLoading||n.stopLoading,error:!!n.deployError,icon:r?o.Square:a.Play,iconOnly:!0,variant:"outline",size:"icon-sm"})})}),(0,t.jsx)(f.TooltipContent,{children:r?"Stop Dev Server":"Start Dev Server"})]})}),r?(0,t.jsx)(u.DeploymentStatusBadge,{status:n.status,url:n.url,targetId:e.targetId}):null]})}e.s(["BaseDrawer",()=>h])}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,24042,64970,e=>{"use strict";var t=e.i(3645);let n=(0,t.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);e.s(["Play",()=>n],24042);let r=(0,t.default)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);e.s(["Square",()=>r],64970)},81803,72714,60253,2287,17466,99348,e=>{"use strict";var t=e.i(20314),n=e.i(83428),r=e.i(51251),a=e.i(31777),o=e.i(35364),l=e.i(8361);function i({label:e,onClick:i,loading:s,error:u,icon:d,iconOnly:c=!1,variant:f="outline",size:p="sm"}){let m=(0,l.useSoundAction)("click");return(0,t.jsxs)(o.Button,{variant:f,size:p,"aria-label":e,disabled:s,onClick:()=>{m.play(),i()},className:(0,a.cn)("gap-1.5",u&&"text-destructive hover:text-destructive",!u&&c&&"ghost"===f&&"text-muted-foreground cursor-pointer rounded-full transition-colors hover:text-blue-500"),children:[s?(0,t.jsx)(n.Loader2,{className:"size-4 animate-spin"}):u?(0,t.jsx)(r.CircleAlert,{className:"size-4"}):(0,t.jsx)(d,{className:"size-4"}),c?null:e]})}e.s(["ActionButton",()=>i],72714),e.s([],81803);var s=e.i(79054),u=e.i(30702),d=e.i(38573),c=e.i(17406),f=e.i(81846),p=e.i(90033),m=e.i(90537);e.s(["X",()=>m.default],60253);var m=m;let g=p.Dialog.Root,h=p.Dialog.Trigger,v=p.Dialog.Portal,w=p.Dialog.Close,y=s.forwardRef(({className:e,onClick:n,...r},o)=>(0,t.jsx)(p.Dialog.Overlay,{ref:o,className:(0,a.cn)("fixed inset-0 z-50 bg-black/80",e),onClick:e=>{e.stopPropagation(),n?.(e)},...r}));y.displayName=p.Dialog.Overlay.displayName;let x=s.forwardRef(({className:e,children:n,...r},o)=>(0,t.jsxs)(v,{children:[(0,t.jsx)(y,{}),(0,t.jsxs)(p.Dialog.Content,{ref:o,className:(0,a.cn)("bg-background fixed top-[50%] left-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg sm:rounded-lg",e),...r,children:[n,(0,t.jsxs)(p.Dialog.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 cursor-pointer rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:pointer-events-none",children:[(0,t.jsx)(m.default,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));x.displayName=p.Dialog.Content.displayName;let b=({className:e,...n})=>(0,t.jsx)("div",{className:(0,a.cn)("flex flex-col space-y-1.5 text-center sm:text-left",e),...n});b.displayName="DialogHeader";let D=({className:e,...n})=>(0,t.jsx)("div",{className:(0,a.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...n});D.displayName="DialogFooter";let j=s.forwardRef(({className:e,...n},r)=>(0,t.jsx)(p.Dialog.Title,{ref:r,className:(0,a.cn)("text-lg leading-none font-semibold tracking-tight",e),...n}));j.displayName=p.Dialog.Title.displayName;let R=s.forwardRef(({className:e,...n},r)=>(0,t.jsx)(p.Dialog.Description,{ref:r,className:(0,a.cn)("text-muted-foreground text-sm",e),...n}));R.displayName=p.Dialog.Description.displayName,e.s(["Dialog",()=>g,"DialogClose",()=>w,"DialogContent",()=>x,"DialogDescription",()=>R,"DialogFooter",()=>D,"DialogHeader",()=>b,"DialogTitle",()=>j,"DialogTrigger",()=>h],2287);var C=e.i(21023);let T=(0,C.createServerReference)("40362687fe5627aded35d8a1bc33e67ae550512891",C.callServer,void 0,C.findSourceMapURL,"getDeploymentLogs");function N({open:e,onOpenChange:n,targetId:r}){let{logs:a,isConnected:o}=function(e){let[t,n]=(0,s.useState)([]),[r,a]=(0,s.useState)(!1),o=(0,s.useRef)(null),l=(0,s.useCallback)(()=>{o.current&&(o.current.close(),o.current=null),a(!1)},[]);return(0,s.useEffect)(()=>{if(!e){n([]),a(!1);return}T(e).then(e=>{e&&n(e)}).catch(()=>{});let t=new EventSource(`/api/deployment-logs?targetId=${e}`);return o.current=t,t.onopen=()=>{a(!0)},t.addEventListener("log",e=>{let t=JSON.parse(e.data);n(e=>[...e,t])}),t.onerror=()=>{a(!1)},()=>{t.close(),o.current=null}},[e,l]),{logs:t,isConnected:r}}(e?r:null);return(0,t.jsx)(E,{open:e,onOpenChange:n,logs:a,isConnected:o})}function E({open:e,onOpenChange:n,logs:r,isConnected:a}){let o=(0,s.useRef)(null),l=(0,s.useRef)(!0),i=(0,s.useCallback)(()=>{let e=o.current;e&&(l.current=e.scrollTop+e.clientHeight>=e.scrollHeight-50)},[]);return(0,s.useEffect)(()=>{l.current&&o.current&&(o.current.scrollTop=o.current.scrollHeight)},[r]),(0,t.jsx)(g,{open:e,onOpenChange:n,children:(0,t.jsxs)(x,{className:"flex h-[calc(100vh-48px)] max-h-[calc(100vh-48px)] w-full max-w-[calc(100vw-48px)] flex-col gap-0 bg-zinc-950 p-0 text-zinc-100 sm:rounded-lg","aria-describedby":void 0,children:[(0,t.jsxs)(b,{className:"flex flex-row items-center justify-between border-b border-zinc-800 px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(d.Terminal,{className:"h-4 w-4 text-zinc-400"}),(0,t.jsx)(j,{className:"text-sm font-medium text-zinc-100",children:"Server Logs"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 pr-8",children:[(0,t.jsx)("span",{className:`inline-block h-2 w-2 rounded-full ${a?"bg-green-500":"bg-zinc-500"}`}),(0,t.jsx)("span",{className:"text-xs text-zinc-400",children:a?"Connected":"Disconnected"})]})]}),(0,t.jsxs)("div",{ref:o,onScroll:i,className:"flex-1 overflow-auto p-4 font-mono text-sm leading-relaxed",children:[0===r.length?(0,t.jsx)("p",{className:"text-zinc-500",children:"Waiting for log output..."}):r.map(e=>(0,t.jsx)(S,{entry:e},`${e.timestamp}-${e.stream}-${e.line}`)),!a&&r.length>0&&(0,t.jsx)("div",{className:"mt-2 border-t border-zinc-800 pt-2 text-zinc-500",children:"[Server stopped]"})]})]})})}function S({entry:e}){return(0,t.jsx)("div",{"data-stream":e.stream,className:"stderr"===e.stream?"text-red-400":"text-zinc-200",children:(0,t.jsx)("span",{className:"break-all whitespace-pre-wrap",children:e.line})})}function $({status:e,url:r,targetId:a}){let[o,l]=(0,s.useState)(!1),i=a&&(e===c.DeploymentState.Booting||e===c.DeploymentState.Ready);switch(e){case c.DeploymentState.Booting:return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(f.Badge,{className:"border-transparent bg-blue-50 text-blue-700 hover:bg-blue-50",children:[(0,t.jsx)(n.Loader2,{className:"mr-1 h-3.5 w-3.5 animate-spin"}),"Starting...",i?(0,t.jsx)("button",{type:"button","aria-label":"View server logs",className:"ml-1.5 inline-flex items-center rounded-sm p-0.5 hover:bg-blue-100",onClick:e=>{e.stopPropagation(),l(!0)},children:(0,t.jsx)(d.Terminal,{className:"h-3 w-3"})}):null]}),i?(0,t.jsx)(N,{open:o,onOpenChange:l,targetId:a}):null]});case c.DeploymentState.Ready:return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(f.Badge,{className:"border-transparent bg-green-50 text-green-700 hover:bg-green-50",children:[(0,t.jsx)("span",{className:"mr-1 inline-block h-2 w-2 rounded-full bg-green-500"}),r?(0,t.jsxs)("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 hover:underline",onClick:e=>e.stopPropagation(),children:[r,(0,t.jsx)(u.ExternalLink,{className:"h-3 w-3"})]}):"Ready",i?(0,t.jsx)("button",{type:"button","aria-label":"View server logs",className:"ml-1.5 inline-flex items-center rounded-sm p-0.5 hover:bg-green-100",onClick:e=>{e.stopPropagation(),l(!0)},children:(0,t.jsx)(d.Terminal,{className:"h-3 w-3"})}):null]}),i?(0,t.jsx)(N,{open:o,onOpenChange:l,targetId:a}):null]});default:return null}}e.s(["DeploymentStatusBadge",()=>$],17466),e.s([],99348)},45811,e=>{"use strict";let t;var n=e.i(20314),r=e.i(48249),a=e.i(567),o=e.i(79054);let l=o.default.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),i=()=>{let e=o.default.useContext(l);if(!e)throw Error("useDrawerContext must be used within a Drawer.Root");return e};function s(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function u(){return d(/^iPhone/)||d(/^iPad/)||d(/^Mac/)&&navigator.maxTouchPoints>1}function d(e){return"u">typeof window&&null!=window.navigator?e.test(window.navigator.platform):void 0}!function(e){if(!e||"u"<typeof document)return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}("[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(\n[data-state=closed]\n){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}");let c="u">typeof window?o.useLayoutEffect:o.useEffect;function f(...e){return(...t)=>{for(let n of e)"function"==typeof n&&n(...t)}}let p="u">typeof document&&window.visualViewport;function m(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function g(e){for(m(e)&&(e=e.parentElement);e&&!m(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}let h=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),v=0;function w(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function y(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let t=g(e);if(t!==document.documentElement&&t!==document.body&&t!==e){let n=t.getBoundingClientRect().top,r=e.getBoundingClientRect().top;e.getBoundingClientRect().bottom>t.getBoundingClientRect().bottom+24&&(t.scrollTop+=r-n)}e=t.parentElement}}function x(e){return e instanceof HTMLInputElement&&!h.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function b(...e){return o.useCallback(function(...e){return t=>e.forEach(e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)})}(...e),e)}let D=new WeakMap;function j(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([t,n])=>{t.startsWith("--")?e.style.setProperty(t,n):(r[t]=e.style[t],e.style[t]=n)}),n||D.set(e,r)}let R=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function C(e,t){if(!e)return null;let n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform,a=r.match(/^matrix3d\((.+)\)$/);return a?parseFloat(a[1].split(", ")[R(t)?13:12]):(a=r.match(/^matrix\((.+)\)$/))?parseFloat(a[1].split(", ")[R(t)?5:4]):null}function T(e,t){if(!e)return()=>{};let n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}let N=[.32,.72,0,1],E="vaul-dragging";function S(e){let t=o.default.useRef(e);return o.default.useEffect(()=>{t.current=e}),o.default.useMemo(()=>(...e)=>null==t.current?void 0:t.current.call(t,...e),[])}function $({prop:e,defaultProp:t,onChange:n=()=>{}}){let[r,a]=function({defaultProp:e,onChange:t}){let n=o.default.useState(e),[r]=n,a=o.default.useRef(r),l=S(t);return o.default.useEffect(()=>{a.current!==r&&(l(r),a.current=r)},[r,a,l]),n}({defaultProp:t,onChange:n}),l=void 0!==e,i=l?e:r,s=S(n);return[i,o.default.useCallback(t=>{if(l){let n="function"==typeof t?t(e):t;n!==e&&s(n)}else a(t)},[l,e,a,s])]}let k=()=>()=>{},P=null;function M({open:e,onOpenChange:n,children:r,onDrag:i,onRelease:d,snapPoints:m,shouldScaleBackground:h=!1,setBackgroundColorOnScale:b=!0,closeThreshold:T=.25,scrollLockTimeout:S=100,dismissible:k=!0,handleOnly:M=!1,fadeFromIndex:O=m&&m.length-1,activeSnapPoint:z,setActiveSnapPoint:L,fixed:B,modal:F=!0,onClose:A,nested:I,noBodyStyles:H=!1,direction:W="bottom",defaultOpen:q=!1,disablePreventScroll:Y=!0,snapToSequentialPoint:U=!1,preventScrollRestoration:X=!1,repositionInputs:V=!0,onAnimationEnd:K,container:J,autoFocus:_=!1}){var G,Q;let[Z=!1,ee]=$({defaultProp:q,prop:e,onChange:e=>{null==n||n(e),e||I||ek(),setTimeout(()=>{null==K||K(e)},500),e&&!F&&"u">typeof window&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),e||(document.body.style.pointerEvents="auto")}}),[et,en]=o.default.useState(!1),[er,ea]=o.default.useState(!1),[eo,el]=o.default.useState(!1),ei=o.default.useRef(null),es=o.default.useRef(null),eu=o.default.useRef(null),ed=o.default.useRef(null),ec=o.default.useRef(null),ef=o.default.useRef(!1),ep=o.default.useRef(null),em=o.default.useRef(0),eg=o.default.useRef(!1),eh=o.default.useRef(!q),ev=o.default.useRef(0),ew=o.default.useRef(null),ey=o.default.useRef((null==(G=ew.current)?void 0:G.getBoundingClientRect().height)||0),ex=o.default.useRef((null==(Q=ew.current)?void 0:Q.getBoundingClientRect().width)||0),eb=o.default.useRef(0),eD=o.default.useCallback(e=>{m&&e===eN.length-1&&(es.current=new Date)},[]),{activeSnapPoint:ej,activeSnapPointIndex:eR,setActiveSnapPoint:eC,onRelease:eT,snapPointsOffset:eN,onDrag:eE,shouldFade:eS,getPercentageDragged:e$}=function({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:r,overlayRef:a,fadeFromIndex:l,onSnapPointChange:i,direction:s="bottom",container:u,snapToSequentialPoint:d}){let[c,f]=$({prop:e,defaultProp:null==n?void 0:n[0],onChange:t}),[p,m]=o.default.useState("u">typeof window?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);o.default.useEffect(()=>{function e(){m({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);let g=o.default.useMemo(()=>c===(null==n?void 0:n[n.length-1])||null,[n,c]),h=o.default.useMemo(()=>{var e;return null!=(e=null==n?void 0:n.findIndex(e=>e===c))?e:null},[n,c]),v=n&&n.length>0&&(l||0===l)&&!Number.isNaN(l)&&n[l]===c||!n,w=o.default.useMemo(()=>{var e;let t=u?{width:u.getBoundingClientRect().width,height:u.getBoundingClientRect().height}:"u">typeof window?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};return null!=(e=null==n?void 0:n.map(e=>{let n="string"==typeof e,r=0;if(n&&(r=parseInt(e,10)),R(s)){let a=n?r:p?e*t.height:0;return p?"bottom"===s?t.height-a:-t.height+a:a}let a=n?r:p?e*t.width:0;return p?"right"===s?t.width-a:-t.width+a:a}))?e:[]},[n,p,u]),y=o.default.useMemo(()=>null!==h?null==w?void 0:w[h]:null,[w,h]),x=o.default.useCallback(e=>{var t;let o=null!=(t=null==w?void 0:w.findIndex(t=>t===e))?t:null;i(o),j(r.current,{transition:`transform 0.5s cubic-bezier(${N.join(",")})`,transform:R(s)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`}),w&&o!==w.length-1&&void 0!==l&&o!==l&&o<l?j(a.current,{transition:`opacity 0.5s cubic-bezier(${N.join(",")})`,opacity:"0"}):j(a.current,{transition:`opacity 0.5s cubic-bezier(${N.join(",")})`,opacity:"1"}),f(null==n?void 0:n[Math.max(o,0)])},[r.current,n,w,l,a,f]);return o.default.useEffect(()=>{if(c||e){var t;let r=null!=(t=null==n?void 0:n.findIndex(t=>t===e||t===c))?t:-1;w&&-1!==r&&"number"==typeof w[r]&&x(w[r])}},[c,e,n,w,x]),{isLastSnapPoint:g,activeSnapPoint:c,shouldFade:v,getPercentageDragged:function(e,t){if(!n||"number"!=typeof h||!w||void 0===l)return null;let r=h===l-1;if(h>=l&&t)return 0;if(r&&!t)return 1;if(!v&&!r)return null;let a=r?h+1:h-1,o=e/Math.abs(r?w[a]-w[a-1]:w[a+1]-w[a]);return r?1-o:o},setActiveSnapPoint:f,activeSnapPointIndex:h,onRelease:function({draggedDistance:e,closeDrawer:t,velocity:r,dismissible:o}){if(void 0===l)return;let i="bottom"===s||"right"===s?(null!=y?y:0)-e:(null!=y?y:0)+e,u=h===l-1,c=0===h,f=e>0;if(u&&j(a.current,{transition:`opacity 0.5s cubic-bezier(${N.join(",")})`}),!d&&r>2&&!f)return void(o?t():x(w[0]));if(!d&&r>2&&f&&w&&n)return void x(w[n.length-1]);let p=null==w?void 0:w.reduce((e,t)=>"number"!=typeof e||"number"!=typeof t?e:Math.abs(t-i)<Math.abs(e-i)?t:e),m=R(s)?window.innerHeight:window.innerWidth;if(r>.4&&Math.abs(e)<.4*m){let e=f?1:-1;return e>0&&g&&n?void x(w[n.length-1]):void(c&&e<0&&o&&t(),null===h||x(w[h+e]))}x(p)},onDrag:function({draggedDistance:e}){if(null===y)return;let t="bottom"===s||"right"===s?y-e:y+e;("bottom"===s||"right"===s)&&t<w[w.length-1]||("top"===s||"left"===s)&&t>w[w.length-1]||j(r.current,{transform:R(s)?`translate3d(0, ${t}px, 0)`:`translate3d(${t}px, 0, 0)`})},snapPointsOffset:w}}({snapPoints:m,activeSnapPointProp:z,setActiveSnapPointProp:L,drawerRef:ew,fadeFromIndex:O,overlayRef:ei,onSnapPointChange:eD,direction:W,container:J,snapToSequentialPoint:U});!function(e={}){let{isDisabled:n}=e;c(()=>{if(!n){var e,r,a;let n,o,l,i,s,d,c;return 1==++v&&u()&&(l=0,i=window.pageXOffset,s=window.pageYOffset,d=f((e=document.documentElement,r="paddingRight",a=`${window.innerWidth-document.documentElement.clientWidth}px`,n=e.style[r],e.style[r]=a,()=>{e.style[r]=n})),window.scrollTo(0,0),c=f(w(document,"touchstart",e=>{((o=g(e.target))!==document.documentElement||o!==document.body)&&(l=e.changedTouches[0].pageY)},{passive:!1,capture:!0}),w(document,"touchmove",e=>{if(!o||o===document.documentElement||o===document.body)return void e.preventDefault();let t=e.changedTouches[0].pageY,n=o.scrollTop,r=o.scrollHeight-o.clientHeight;0!==r&&((n<=0&&t>l||n>=r&&t<l)&&e.preventDefault(),l=t)},{passive:!1,capture:!0}),w(document,"touchend",e=>{let t=e.target;x(t)&&t!==document.activeElement&&(e.preventDefault(),t.style.transform="translateY(-2000px)",t.focus(),requestAnimationFrame(()=>{t.style.transform=""}))},{passive:!1,capture:!0}),w(document,"focus",e=>{let t=e.target;x(t)&&(t.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{t.style.transform="",p&&(p.height<window.innerHeight?requestAnimationFrame(()=>{y(t)}):p.addEventListener("resize",()=>y(t),{once:!0}))}))},!0),w(window,"scroll",()=>{window.scrollTo(0,0)})),t=()=>{d(),c(),window.scrollTo(i,s)}),()=>{0==--v&&(null==t||t())}}},[n])}({isDisabled:!Z||er||!F||eo||!et||!V||!Y});let{restorePositionSetting:ek}=function({isOpen:e,modal:t,nested:n,hasBeenOpened:r,preventScrollRestoration:a,noBodyStyles:l}){let[i,u]=o.default.useState(()=>"u">typeof window?window.location.href:""),d=o.default.useRef(0),c=o.default.useCallback(()=>{if(s()&&null===P&&e&&!l){P={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};let{scrollX:e,innerHeight:t}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-d.current}px`,left:`${-e}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{let e=t-window.innerHeight;e&&d.current>=t&&(document.body.style.top=`${-(d.current+e)}px`)}),300)}},[e]),f=o.default.useCallback(()=>{if(s()&&null!==P&&!l){let e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);Object.assign(document.body.style,P),window.requestAnimationFrame(()=>{a&&i!==window.location.href?u(window.location.href):window.scrollTo(t,e)}),P=null}},[i]);return o.default.useEffect(()=>{function e(){d.current=window.scrollY}return e(),window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}},[]),o.default.useEffect(()=>{if(t)return()=>{"u"<typeof document||document.querySelector("[data-vaul-drawer]")||f()}},[t,f]),o.default.useEffect(()=>{!n&&r&&(e?(window.matchMedia("(display-mode: standalone)").matches||c(),t||window.setTimeout(()=>{f()},500)):f())},[e,r,i,t,n,c,f]),{restorePositionSetting:f}}({isOpen:Z,modal:F,nested:null!=I&&I,hasBeenOpened:et,preventScrollRestoration:X,noBodyStyles:H});function eP(){return(window.innerWidth-26)/window.innerWidth}function eM(e,t){var n;let r=e,a=null==(n=window.getSelection())?void 0:n.toString(),o=ew.current?C(ew.current,W):null,l=new Date;if("SELECT"===r.tagName||r.hasAttribute("data-vaul-no-drag")||r.closest("[data-vaul-no-drag]"))return!1;if("right"===W||"left"===W)return!0;if(es.current&&l.getTime()-es.current.getTime()<500)return!1;if(null!==o&&("bottom"===W?o>0:o<0))return!0;if(a&&a.length>0)return!1;if(ec.current&&l.getTime()-ec.current.getTime()<S&&0===o||t)return ec.current=l,!1;for(;r;){if(r.scrollHeight>r.clientHeight){if(0!==r.scrollTop)return ec.current=new Date,!1;if("dialog"===r.getAttribute("role"))break}r=r.parentNode}return!0}function eO(e){er&&ew.current&&(ew.current.classList.remove(E),ef.current=!1,ea(!1),ed.current=new Date),null==A||A(),e||ee(!1),setTimeout(()=>{m&&eC(m[0])},500)}function ez(){if(!ew.current)return;let e=document.querySelector("[data-vaul-drawer-wrapper]"),t=C(ew.current,W);j(ew.current,{transform:"translate3d(0, 0, 0)",transition:`transform 0.5s cubic-bezier(${N.join(",")})`}),j(ei.current,{transition:`opacity 0.5s cubic-bezier(${N.join(",")})`,opacity:"1"}),h&&t&&t>0&&Z&&j(e,{borderRadius:"8px",overflow:"hidden",...R(W)?{transform:`scale(${eP()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${eP()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:"0.5s",transitionTimingFunction:`cubic-bezier(${N.join(",")})`},!0)}return o.default.useEffect(()=>{window.requestAnimationFrame(()=>{eh.current=!0})},[]),o.default.useEffect(()=>{var e;function t(){if(ew.current&&V&&(x(document.activeElement)||eg.current)){var e;let t=(null==(e=window.visualViewport)?void 0:e.height)||0,n=window.innerHeight,r=n-t,a=ew.current.getBoundingClientRect().height||0;eb.current||(eb.current=a);let o=ew.current.getBoundingClientRect().top;if(Math.abs(ev.current-r)>60&&(eg.current=!eg.current),m&&m.length>0&&eN&&eR&&(r+=eN[eR]||0),ev.current=r,a>t||eg.current){let e=ew.current.getBoundingClientRect().height,l=e;e>t&&(l=t-(a>.8*n?o:26)),B?ew.current.style.height=`${e-Math.max(r,0)}px`:ew.current.style.height=`${Math.max(l,t-o)}px`}else{let e;e=navigator.userAgent,"u">typeof window&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))||(ew.current.style.height=`${eb.current}px`)}m&&m.length>0&&!eg.current?ew.current.style.bottom="0px":ew.current.style.bottom=`${Math.max(r,0)}px`}}return null==(e=window.visualViewport)||e.addEventListener("resize",t),()=>{var e;return null==(e=window.visualViewport)?void 0:e.removeEventListener("resize",t)}},[eR,m,eN]),o.default.useEffect(()=>(Z&&(j(document.documentElement,{scrollBehavior:"auto"}),es.current=new Date),()=>{!function(e,t){if(!e||!(e instanceof HTMLElement))return;let n=D.get(e);n&&(e.style[t]=n[t])}(document.documentElement,"scrollBehavior")}),[Z]),o.default.useEffect(()=>{F||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[F]),o.default.createElement(a.Root,{defaultOpen:q,onOpenChange:e=>{(k||e)&&(e?en(!0):eO(!0),ee(e))},open:Z},o.default.createElement(l.Provider,{value:{activeSnapPoint:ej,snapPoints:m,setActiveSnapPoint:eC,drawerRef:ew,overlayRef:ei,onOpenChange:n,onPress:function(e){var t,n;!k&&!m||(!ew.current||ew.current.contains(e.target))&&(ey.current=(null==(t=ew.current)?void 0:t.getBoundingClientRect().height)||0,ex.current=(null==(n=ew.current)?void 0:n.getBoundingClientRect().width)||0,ea(!0),eu.current=new Date,u()&&window.addEventListener("touchend",()=>ef.current=!1,{once:!0}),e.target.setPointerCapture(e.pointerId),em.current=R(W)?e.pageY:e.pageX)},onRelease:function(e){var t,n;if(!er||!ew.current)return;ew.current.classList.remove(E),ef.current=!1,ea(!1),ed.current=new Date;let r=C(ew.current,W);if(!e||!eM(e.target,!1)||!r||Number.isNaN(r)||null===eu.current)return;let a=ed.current.getTime()-eu.current.getTime(),o=em.current-(R(W)?e.pageY:e.pageX),l=Math.abs(o)/a;if(l>.05&&(el(!0),setTimeout(()=>{el(!1)},200)),m){eT({draggedDistance:o*("bottom"===W||"right"===W?1:-1),closeDrawer:eO,velocity:l,dismissible:k}),null==d||d(e,!0);return}if("bottom"===W||"right"===W?o>0:o<0){ez(),null==d||d(e,!0);return}if(l>.4){eO(),null==d||d(e,!1);return}let i=Math.min(null!=(t=ew.current.getBoundingClientRect().height)?t:0,window.innerHeight),s=Math.min(null!=(n=ew.current.getBoundingClientRect().width)?n:0,window.innerWidth);if(Math.abs(r)>=("left"===W||"right"===W?s:i)*T){eO(),null==d||d(e,!1);return}null==d||d(e,!0),ez()},onDrag:function(e){if(ew.current&&er){let t="bottom"===W||"right"===W?1:-1,n=(em.current-(R(W)?e.pageY:e.pageX))*t,r=n>0,a=m&&!k&&!r;if(a&&0===eR)return;let o=Math.abs(n),l=document.querySelector("[data-vaul-drawer-wrapper]"),s=o/("bottom"===W||"top"===W?ey.current:ex.current),u=e$(o,r);if(null!==u&&(s=u),a&&s>=1||!ef.current&&!eM(e.target,r))return;if(ew.current.classList.add(E),ef.current=!0,j(ew.current,{transition:"none"}),j(ei.current,{transition:"none"}),m&&eE({draggedDistance:n}),r&&!m){let e=Math.min(-(8*(Math.log(n+1)-2)*1),0)*t;j(ew.current,{transform:R(W)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`});return}let d=1-s;if((eS||O&&eR===O-1)&&(null==i||i(e,s),j(ei.current,{opacity:`${d}`,transition:"none"},!0)),l&&ei.current&&h){let e=Math.min(eP()+s*(1-eP()),1),t=8-8*s,n=Math.max(0,14-14*s);j(l,{borderRadius:`${t}px`,transform:R(W)?`scale(${e}) translate3d(0, ${n}px, 0)`:`scale(${e}) translate3d(${n}px, 0, 0)`,transition:"none"},!0)}if(!m){let e=o*t;j(ew.current,{transform:R(W)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})}}},dismissible:k,shouldAnimate:eh,handleOnly:M,isOpen:Z,isDragging:er,shouldFade:eS,closeDrawer:eO,onNestedDrag:function(e,t){if(t<0)return;let n=(window.innerWidth-16)/window.innerWidth,r=n+t*(1-n),a=-16+16*t;j(ew.current,{transform:R(W)?`scale(${r}) translate3d(0, ${a}px, 0)`:`scale(${r}) translate3d(${a}px, 0, 0)`,transition:"none"})},onNestedOpenChange:function(e){let t=e?(window.innerWidth-16)/window.innerWidth:1,n=e?-16:0;ep.current&&window.clearTimeout(ep.current),j(ew.current,{transition:`transform 0.5s cubic-bezier(${N.join(",")})`,transform:R(W)?`scale(${t}) translate3d(0, ${n}px, 0)`:`scale(${t}) translate3d(${n}px, 0, 0)`}),!e&&ew.current&&(ep.current=setTimeout(()=>{let e=C(ew.current,W);j(ew.current,{transition:"none",transform:R(W)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})},500))},onNestedRelease:function(e,t){let n=R(W)?window.innerHeight:window.innerWidth,r=t?(n-16)/n:1,a=t?-16:0;t&&j(ew.current,{transition:`transform 0.5s cubic-bezier(${N.join(",")})`,transform:R(W)?`scale(${r}) translate3d(0, ${a}px, 0)`:`scale(${r}) translate3d(${a}px, 0, 0)`})},keyboardIsOpen:eg,modal:F,snapPointsOffset:eN,activeSnapPointIndex:eR,direction:W,shouldScaleBackground:h,setBackgroundColorOnScale:b,noBodyStyles:H,container:J,autoFocus:_}},r))}let O=o.default.forwardRef(function({...e},t){let{overlayRef:n,snapPoints:r,onRelease:l,shouldFade:s,isOpen:u,modal:d,shouldAnimate:c}=i(),f=b(t,n),p=r&&r.length>0;if(!d)return null;let m=o.default.useCallback(e=>l(e),[l]);return o.default.createElement(a.Overlay,{onMouseUp:m,ref:f,"data-vaul-overlay":"","data-vaul-snap-points":u&&p?"true":"false","data-vaul-snap-points-overlay":u&&s?"true":"false","data-vaul-animate":(null==c?void 0:c.current)?"true":"false",...e})});O.displayName="Drawer.Overlay";let z=o.default.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...r},l){let{drawerRef:s,onPress:u,onRelease:d,onDrag:c,keyboardIsOpen:f,snapPointsOffset:p,activeSnapPointIndex:m,modal:g,isOpen:h,direction:v,snapPoints:w,container:y,handleOnly:x,shouldAnimate:D,autoFocus:j}=i(),[C,E]=o.default.useState(!1),S=b(l,s),$=o.default.useRef(null),P=o.default.useRef(null),M=o.default.useRef(!1),O=w&&w.length>0;function z(e){$.current=null,M.current=!1,d(e)}return!function(){let{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:a}=i(),l=o.default.useRef(null),s=(0,o.useMemo)(()=>document.body.style.backgroundColor,[]);function u(){return(window.innerWidth-26)/window.innerWidth}o.default.useEffect(()=>{if(t&&n){l.current&&clearTimeout(l.current);let t=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!t)return;!function(...e){}(r&&!a?T(document.body,{background:"black"}):k,T(t,{transformOrigin:R(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:"0.5s",transitionTimingFunction:`cubic-bezier(${N.join(",")})`}));let n=T(t,{borderRadius:"8px",overflow:"hidden",...R(e)?{transform:`scale(${u()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${u()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{n(),l.current=window.setTimeout(()=>{s?document.body.style.background=s:document.body.style.removeProperty("background")},500)}}},[t,n,s])}(),o.default.useEffect(()=>{O&&window.requestAnimationFrame(()=>{E(!0)})},[]),o.default.createElement(a.Content,{"data-vaul-drawer-direction":v,"data-vaul-drawer":"","data-vaul-delayed-snap-points":C?"true":"false","data-vaul-snap-points":h&&O?"true":"false","data-vaul-custom-container":y?"true":"false","data-vaul-animate":(null==D?void 0:D.current)?"true":"false",...r,ref:S,style:p&&p.length>0?{"--snap-point-height":`${p[null!=m?m:0]}px`,...t}:t,onPointerDown:e=>{x||(null==r.onPointerDown||r.onPointerDown.call(r,e),$.current={x:e.pageX,y:e.pageY},u(e))},onOpenAutoFocus:e=>{null==n||n(e),j||e.preventDefault()},onPointerDownOutside:t=>{(null==e||e(t),!g||t.defaultPrevented)?t.preventDefault():f.current&&(f.current=!1)},onFocusOutside:e=>{if(!g)return void e.preventDefault()},onPointerMove:e=>{if(P.current=e,x||(null==r.onPointerMove||r.onPointerMove.call(r,e),!$.current))return;let t=e.pageY-$.current.y,n=e.pageX-$.current.x,a="touch"===e.pointerType?10:2;((e,t,n=0)=>{if(M.current)return!0;let r=Math.abs(e.y),a=Math.abs(e.x),o=a>r,l=["bottom","right"].includes(t)?1:-1;if("left"===t||"right"===t){if(!(e.x*l<0)&&a>=0&&a<=n)return o}else if(!(e.y*l<0)&&r>=0&&r<=n)return!o;return M.current=!0,!0})({x:n,y:t},v,a)?c(e):(Math.abs(n)>a||Math.abs(t)>a)&&($.current=null)},onPointerUp:e=>{null==r.onPointerUp||r.onPointerUp.call(r,e),$.current=null,M.current=!1,d(e)},onPointerOut:e=>{null==r.onPointerOut||r.onPointerOut.call(r,e),z(P.current)},onContextMenu:e=>{null==r.onContextMenu||r.onContextMenu.call(r,e),P.current&&z(P.current)}})});z.displayName="Drawer.Content";let L=o.default.forwardRef(function({preventCycle:e=!1,children:t,...n},r){let{closeDrawer:a,isDragging:l,snapPoints:s,activeSnapPoint:u,setActiveSnapPoint:d,dismissible:c,handleOnly:f,isOpen:p,onPress:m,onDrag:g}=i(),h=o.default.useRef(null),v=o.default.useRef(!1);function w(){h.current&&window.clearTimeout(h.current),v.current=!1}return o.default.createElement("div",{onClick:function(){v.current?w():window.setTimeout(()=>{!function(){if(l||e||v.current)return w();if(w(),!s||0===s.length){c||a();return}if(u===s[s.length-1]&&c)return a();let t=s.findIndex(e=>e===u);-1===t||d(s[t+1])}()},120)},onPointerCancel:w,onPointerDown:e=>{f&&m(e),h.current=window.setTimeout(()=>{v.current=!0},250)},onPointerMove:e=>{f&&g(e)},ref:r,"data-vaul-drawer-visible":p?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},o.default.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});L.displayName="Drawer.Handle";let B={Root:M,NestedRoot:function({onDrag:e,onOpenChange:t,open:n,...r}){let{onNestedDrag:a,onNestedOpenChange:l,onNestedRelease:s}=i();if(!a)throw Error("Drawer.NestedRoot must be placed in another drawer");return o.default.createElement(M,{nested:!0,open:n,onClose:()=>{l(!1)},onDrag:(t,n)=>{a(t,n),null==e||e(t,n)},onOpenChange:e=>{e&&l(e),null==t||t(e)},onRelease:s,...r})},Content:z,Overlay:O,Trigger:a.Trigger,Portal:function(e){let t=i(),{container:n=t.container,...r}=e;return o.default.createElement(a.Portal,{container:n,...r})},Handle:L,Close:a.Close,Title:a.Title,Description:a.Description};var F=e.i(31777);function A({...e}){return(0,n.jsx)(B.Root,{"data-slot":"drawer",...e})}function I({...e}){return(0,n.jsx)(B.Portal,{"data-slot":"drawer-portal",...e})}function H({className:e,...t}){return(0,n.jsx)(B.Overlay,{"data-slot":"drawer-overlay",className:(0,F.cn)("fixed inset-0 z-50 bg-black/50",e),...t})}function W({className:e,children:t,direction:a="bottom",showCloseButton:o=!0,...l}){return(0,n.jsx)(I,{children:(0,n.jsxs)(B.Content,{"data-slot":"drawer-content",className:(0,F.cn)("bg-background fixed z-50 flex flex-col shadow-lg","bottom"===a&&"inset-x-0 bottom-0 mb-24 rounded-t-lg border-t","top"===a&&"inset-x-0 top-0 mt-24 rounded-b-lg border-b","right"===a&&"inset-y-0 right-0 h-full w-3/4 border-l","left"===a&&"inset-y-0 left-0 h-full w-3/4 border-r",e),style:{"--initial-transform":"right"===a?"calc(100% + 8px)":"left"===a||"top"===a?"calc(-100% - 8px)":"calc(100% + 8px)",userSelect:"text",...l.style??{}},...l,children:[t,o?(0,n.jsxs)(B.Close,{className:"ring-offset-background focus:ring-ring absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[(0,n.jsx)(r.XIcon,{className:"size-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Close"})]}):null]})})}function q({className:e,...t}){return(0,n.jsx)("div",{"data-slot":"drawer-header",className:(0,F.cn)("flex flex-col gap-1.5 p-4",e),...t})}function Y({className:e,...t}){return(0,n.jsx)("div",{"data-slot":"drawer-footer",className:(0,F.cn)("mt-auto flex flex-col gap-2 p-4",e),...t})}function U({className:e,...t}){return(0,n.jsx)(B.Title,{"data-slot":"drawer-title",className:(0,F.cn)("text-foreground font-semibold",e),...t})}function X({className:e,...t}){return(0,n.jsx)(B.Description,{"data-slot":"drawer-description",className:(0,F.cn)("text-muted-foreground text-sm",e),...t})}e.s(["Drawer",()=>A,"DrawerContent",()=>W,"DrawerDescription",()=>X,"DrawerFooter",()=>Y,"DrawerHeader",()=>q,"DrawerOverlay",()=>H,"DrawerTitle",()=>U],45811)},8537,e=>{"use strict";var t=e.i(79054),n=e.i(18354),r=e.i(21023);let a=(0,r.createServerReference)("40d6ad80d7f8b9a7a57b25d57bd06262f5afa6e3df",r.callServer,void 0,r.findSourceMapURL,"deployFeature"),o=(0,r.createServerReference)("40dc762b3f23e9134fcb4405b46a0553c8808ae420",r.callServer,void 0,r.findSourceMapURL,"deployRepository"),l=(0,r.createServerReference)("40eea30c1681496ecedbcfd076533d7c7f88b2d1d2",r.callServer,void 0,r.findSourceMapURL,"stopDeployment"),i=(0,r.createServerReference)("4075a6905de1ad4699ca6273876b4fd709ba00c820",r.callServer,void 0,r.findSourceMapURL,"getDeploymentStatus"),s=(0,n.createLogger)("[useDeployAction]");function u(e){let[n,r]=(0,t.useState)(!1),[u,d]=(0,t.useState)(!1),[c,f]=(0,t.useState)(null),[p,m]=(0,t.useState)(null),[g,h]=(0,t.useState)(null),v=(0,t.useRef)(null),w=(0,t.useRef)(null),y=(0,t.useRef)(!0),x=(0,t.useRef)(p);(0,t.useEffect)(()=>{x.current=p},[p]),(0,t.useEffect)(()=>(y.current=!0,()=>{y.current=!1}),[]),(0,t.useEffect)(()=>()=>{v.current&&clearTimeout(v.current),w.current&&clearInterval(w.current)},[]);let b=(0,t.useCallback)(()=>{w.current&&(s.debug("stopping polling"),clearInterval(w.current),w.current=null)},[]),D=(0,t.useCallback)(e=>{b(),s.debug(`starting polling for "${e}" every 3000ms`),w.current=setInterval(async()=>{if(!y.current)return void b();let t=await i(e);y.current&&(t&&"Stopped"!==t.state?(t.state!==x.current&&s.info(`poll state changed: ${x.current} → ${t.state}, url=${t.url}`),m(t.state),h(t.url)):(s.info(`poll result: ${t?`state=${t.state}`:"null (deployment gone)"} — stopping poll`),m(null),h(null),b()))},3e3)},[b]),j=(0,t.useCallback)(async()=>{if(!e)return void s.warn("deploy() called but input is null — no-op");if(n)return void s.warn("deploy() called but already loading — no-op");s.info(`deploy() — targetType="${e.targetType}", targetId="${e.targetId}", repositoryPath="${e.repositoryPath}"`),v.current&&clearTimeout(v.current),r(!0),f(null);try{let t="feature"===e.targetType?await a(e.targetId):await o(e.repositoryPath);if(s.info("server action result:",t),!y.current)return void s.warn("component unmounted after deploy — discarding result");if(t.success)s.info(`deploy succeeded — initial state=${t.state}, starting polling`),m(t.state??null),h(null),D(e.targetId);else{let e=t.error??"An unexpected error occurred";s.error(`deploy failed: ${e}`),f(e),v.current=setTimeout(()=>f(null),5e3)}}catch(t){if(!y.current)return;let e=t instanceof Error?t.message:"An unexpected error occurred";s.error(`deploy threw exception: ${e}`,t),f(e),v.current=setTimeout(()=>f(null),5e3)}finally{y.current&&r(!1)}},[e,n,D]),R=(0,t.useCallback)(async()=>{if(e&&!u){s.info(`stop() — targetId="${e.targetId}"`),d(!0);try{let t=await l(e.targetId);if(s.info("stop result:",t),!y.current)return;t.success&&(b(),m(null),h(null))}catch(e){s.warn("stop error (non-critical):",e)}finally{y.current&&d(!1)}}},[e,u,b]);return{deploy:j,stop:R,deployLoading:n,stopLoading:u,deployError:c,status:p,url:g}}e.s(["useDeployAction",()=>u],8537)},11495,e=>{"use strict";var t=e.i(20314),n=e.i(79054),r=e.i(48249),a=e.i(24042),o=e.i(64970),l=e.i(94237),i=e.i(31777);e.i(81803);var s=e.i(72714);e.i(99348);var u=e.i(17466),d=e.i(45811),c=e.i(25235),f=e.i(2828),p=e.i(8537),m=e.i(75921);let g=(0,l.cva)("",{variants:{size:{sm:"w-96",md:"w-xl"}},defaultVariants:{size:"sm"}});function h({open:e,onClose:a,modal:o=!1,dismissOnOutsideClick:l=!1,title:s="Drawer",size:u,header:f,children:p,footer:h,className:w,"data-testid":y,deployTarget:x}){let b=(0,m.useFeatureFlags)(),D=(0,n.useRef)(null);return(0,n.useEffect)(()=>{if(!e||o)return;let t=e=>{let t=e.target;!document.body.contains(t)||D.current?.contains(t)||t.closest(l?'[role="alertdialog"], [role="dialog"], [role="menu"], [role="listbox"], [data-radix-popper-content-wrapper]':'[data-no-drawer-close], [role="alertdialog"], [role="dialog"], [role="menu"], [role="listbox"], [data-radix-popper-content-wrapper]')||a()};return document.addEventListener("click",t),()=>document.removeEventListener("click",t)},[e,o,a,l]),(0,t.jsxs)(d.Drawer,{direction:"right",modal:o,handleOnly:!0,open:e,onOpenChange:e=>{e||a()},children:[o?(0,t.jsx)(d.DrawerOverlay,{}):null,(0,t.jsxs)(d.DrawerContent,{ref:D,direction:"right",showCloseButton:!1,className:(0,i.cn)(g({size:u}),w),"data-testid":y,onInteractOutside:o?void 0:e=>e.preventDefault(),children:[(0,t.jsx)(d.DrawerTitle,{asChild:!0,children:(0,t.jsx)("span",{className:"sr-only",children:s})}),(0,t.jsx)(d.DrawerDescription,{asChild:!0,children:(0,t.jsx)("span",{className:"sr-only",children:s})}),(0,t.jsxs)("button",{type:"button","aria-label":"Close",onClick:a,className:"ring-offset-background focus:ring-ring absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden","data-testid":y?`${y}-close-button`:void 0,children:[(0,t.jsx)(r.XIcon,{className:"size-4"}),(0,t.jsx)("span",{className:"sr-only",children:"Close"})]}),f?(0,t.jsx)(d.DrawerHeader,{className:"shrink-0",children:f}):null,f?(0,t.jsx)(c.Separator,{}):null,b.envDeploy&&x?(0,t.jsx)(v,{deployTarget:x}):null,(0,t.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:p}),h?(0,t.jsx)(d.DrawerFooter,{className:"shrink-0",children:h}):null]})]})}function v({deployTarget:e}){let n=(0,p.useDeployAction)(e),r="Booting"===n.status||"Ready"===n.status;return(0,t.jsxs)("div",{"data-testid":"base-drawer-deploy-bar",className:"flex items-center gap-2 px-4 pb-3",children:[(0,t.jsx)(f.TooltipProvider,{children:(0,t.jsxs)(f.Tooltip,{children:[(0,t.jsx)(f.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{children:(0,t.jsx)(s.ActionButton,{label:r?"Stop Dev Server":"Start Dev Server",onClick:r?n.stop:n.deploy,loading:n.deployLoading||n.stopLoading,error:!!n.deployError,icon:r?o.Square:a.Play,iconOnly:!0,variant:"outline",size:"icon-sm"})})}),(0,t.jsx)(f.TooltipContent,{children:r?"Stop Dev Server":"Start Dev Server"})]})}),r?(0,t.jsx)(u.DeploymentStatusBadge,{status:n.status,url:n.url,targetId:e.targetId}):null]})}e.s(["BaseDrawer",()=>h])}]);
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,54277,30090,e=>{"use strict";let t=(0,e.i(3645).default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);e.s(["default",()=>t],30090),e.s(["CircleX",()=>t],54277)},33548,e=>{"use strict";let t=(0,e.i(3645).default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);e.s(["Copy",()=>t],33548)},16298,e=>{"use strict";let t=(0,e.i(3645).default)("file-text",[["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:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);e.s(["default",()=>t])},53360,e=>{"use strict";let t=(0,e.i(3645).default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);e.s(["Zap",()=>t],53360)},97667,e=>{"use strict";var t=e.i(1012);e.s(["CheckIcon",()=>t.default])},23925,1012,e=>{"use strict";let t=(0,e.i(3645).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["default",()=>t],1012),e.s(["Check",()=>t],23925)},23405,e=>{"use strict";var t=e.i(79054);function r(e){let r=t.useRef({value:e,previous:e});return t.useMemo(()=>(r.current.value!==e&&(r.current.previous=r.current.value,r.current.value=e),r.current.previous),[e])}e.s(["usePrevious",()=>r])},41957,e=>{"use strict";var t=e.i(20314),r=e.i(79054),a=e.i(87620),s=r.forwardRef((e,r)=>(0,t.jsx)(a.Primitive.label,{...e,ref:r,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));s.displayName="Label",e.s(["Label",()=>s,"Root",()=>s],27572);var l=e.i(27572),l=l,u=e.i(94237),i=e.i(31777);let c=(0,u.cva)("text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),n=r.forwardRef(({className:e,...r},a)=>(0,t.jsx)(l.Root,{ref:a,className:(0,i.cn)(c(),e),...r}));n.displayName=l.Root.displayName,e.s(["Label",()=>n],41957)},61569,e=>{"use strict";let t=(0,e.i(3645).default)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);e.s(["default",()=>t])},54793,7729,e=>{"use strict";var t=e.i(20314),r=e.i(31777);function a({icon:e,title:a,description:s,action:l,className:u,...i}){return(0,t.jsxs)("div",{className:(0,r.cn)("flex flex-col items-center gap-4 px-4 py-12 text-center",u),...i,children:[e?(0,t.jsx)("div",{className:"text-muted-foreground",children:e}):null,(0,t.jsx)("h3",{className:"text-lg font-semibold",children:a}),s?(0,t.jsx)("p",{className:"text-muted-foreground max-w-md text-sm",children:s}):null,l?(0,t.jsx)("div",{className:"mt-2",children:l}):null]})}e.s(["EmptyState",()=>a],7729),e.s([],54793)},38573,e=>{"use strict";let t=(0,e.i(3645).default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);e.s(["Terminal",()=>t],38573)},30702,e=>{"use strict";let t=(0,e.i(3645).default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);e.s(["ExternalLink",()=>t],30702)},81846,e=>{"use strict";var t=e.i(20314),r=e.i(94237),a=e.i(31777);let s=(0,r.cva)("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-none",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function l({className:e,variant:r,...l}){return(0,t.jsx)("div",{className:(0,a.cn)(s({variant:r}),e),...l})}e.s(["Badge",()=>l])},1650,e=>{"use strict";e.i(11495),e.s([])},19933,e=>{"use strict";let t=(0,e.i(3645).default)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);e.s(["FolderOpen",()=>t],19933)},8986,46899,34445,46307,e=>{"use strict";let t=(0,e.i(3645).default)("code-xml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);e.s(["Code2",()=>t],8986);var r=e.i(21023);let a=(0,r.createServerReference)("40faa0da099befe4eac9fd650890f9fb8cfa4c14e9",r.callServer,void 0,r.findSourceMapURL,"openIde");e.s(["openIde",()=>a],46899);let s=(0,r.createServerReference)("40cad1f353dc865624cf776dc182eeefd2b75b4aaa",r.callServer,void 0,r.findSourceMapURL,"openShell");e.s(["openShell",()=>s],34445);let l=(0,r.createServerReference)("40b3d8ef4ebb6bfc85c5c22b99b935f6a116ed389e",r.callServer,void 0,r.findSourceMapURL,"openFolder");e.s(["openFolder",()=>l],46307)},76852,e=>{"use strict";var t=e.i(79054),r=e.i(46899),a=e.i(34445),s=e.i(46307);function l(e){let[l,u]=(0,t.useState)(!1),[i,c]=(0,t.useState)(!1),[n,o]=(0,t.useState)(!1),[d,f]=(0,t.useState)(null),[p,h]=(0,t.useState)(null),[y,m]=(0,t.useState)(null),v=(0,t.useRef)(null),b=(0,t.useRef)(null),x=(0,t.useRef)(null);(0,t.useEffect)(()=>()=>{v.current&&clearTimeout(v.current),b.current&&clearTimeout(b.current),x.current&&clearTimeout(x.current)},[]);let k=(0,t.useCallback)(async(t,r,a,s,l)=>{if(e&&!l){s.current&&clearTimeout(s.current),r(!0),a(null);try{let e=await t();if(!e.success){let t=e.error??"An unexpected error occurred";a(t),s.current=setTimeout(()=>a(null),5e3)}}catch(e){a(e instanceof Error?e.message:"An unexpected error occurred"),s.current=setTimeout(()=>a(null),5e3)}finally{r(!1)}}},[e]);return{openInIde:(0,t.useCallback)(()=>k(()=>(0,r.openIde)({repositoryPath:e.repositoryPath}),u,f,v,l),[k,l,e]),openInShell:(0,t.useCallback)(()=>k(()=>(0,a.openShell)({repositoryPath:e.repositoryPath}),c,h,b,i),[k,i,e]),openFolder:(0,t.useCallback)(()=>k(()=>(0,s.openFolder)(e.repositoryPath),o,m,x,n),[k,n,e]),ideLoading:l,shellLoading:i,folderLoading:n,ideError:d,shellError:p,folderError:y}}e.s(["useRepositoryActions",()=>l])}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,54277,30090,e=>{"use strict";let t=(0,e.i(3645).default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);e.s(["default",()=>t],30090),e.s(["CircleX",()=>t],54277)},33548,e=>{"use strict";let t=(0,e.i(3645).default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);e.s(["Copy",()=>t],33548)},16298,e=>{"use strict";let t=(0,e.i(3645).default)("file-text",[["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:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);e.s(["default",()=>t])},53360,e=>{"use strict";let t=(0,e.i(3645).default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);e.s(["Zap",()=>t],53360)},97667,e=>{"use strict";var t=e.i(1012);e.s(["CheckIcon",()=>t.default])},23925,1012,e=>{"use strict";let t=(0,e.i(3645).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["default",()=>t],1012),e.s(["Check",()=>t],23925)},23405,e=>{"use strict";var t=e.i(79054);function r(e){let r=t.useRef({value:e,previous:e});return t.useMemo(()=>(r.current.value!==e&&(r.current.previous=r.current.value,r.current.value=e),r.current.previous),[e])}e.s(["usePrevious",()=>r])},41957,e=>{"use strict";var t=e.i(20314),r=e.i(79054),a=e.i(87620),s=r.forwardRef((e,r)=>(0,t.jsx)(a.Primitive.label,{...e,ref:r,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));s.displayName="Label",e.s(["Label",()=>s,"Root",()=>s],27572);var l=e.i(27572),l=l,u=e.i(94237),i=e.i(31777);let n=(0,u.cva)("text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=r.forwardRef(({className:e,...r},a)=>(0,t.jsx)(l.Root,{ref:a,className:(0,i.cn)(n(),e),...r}));c.displayName=l.Root.displayName,e.s(["Label",()=>c],41957)},61569,e=>{"use strict";let t=(0,e.i(3645).default)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);e.s(["default",()=>t])},54793,7729,e=>{"use strict";var t=e.i(20314),r=e.i(31777);function a({icon:e,title:a,description:s,action:l,className:u,...i}){return(0,t.jsxs)("div",{className:(0,r.cn)("flex flex-col items-center gap-4 px-4 py-12 text-center",u),...i,children:[e?(0,t.jsx)("div",{className:"text-muted-foreground",children:e}):null,(0,t.jsx)("h3",{className:"text-lg font-semibold",children:a}),s?(0,t.jsx)("p",{className:"text-muted-foreground max-w-md text-sm",children:s}):null,l?(0,t.jsx)("div",{className:"mt-2",children:l}):null]})}e.s(["EmptyState",()=>a],7729),e.s([],54793)},38573,e=>{"use strict";let t=(0,e.i(3645).default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);e.s(["Terminal",()=>t],38573)},30702,e=>{"use strict";let t=(0,e.i(3645).default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);e.s(["ExternalLink",()=>t],30702)},81846,e=>{"use strict";var t=e.i(20314),r=e.i(94237),a=e.i(31777);let s=(0,r.cva)("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-none",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function l({className:e,variant:r,...l}){return(0,t.jsx)("div",{className:(0,a.cn)(s({variant:r}),e),...l})}e.s(["Badge",()=>l])},1650,e=>{"use strict";e.i(11495),e.s([])},19933,e=>{"use strict";let t=(0,e.i(3645).default)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);e.s(["FolderOpen",()=>t],19933)},8986,69849,51771,20782,e=>{"use strict";let t=(0,e.i(3645).default)("code-xml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);e.s(["Code2",()=>t],8986);var r=e.i(21023);let a=(0,r.createServerReference)("40a8fe32748ad647faed2fb670c8394a01a9d18a6e",r.callServer,void 0,r.findSourceMapURL,"openIde");e.s(["openIde",()=>a],69849);let s=(0,r.createServerReference)("40668488068b8e360ccde73c30985d396585ba3933",r.callServer,void 0,r.findSourceMapURL,"openShell");e.s(["openShell",()=>s],51771);let l=(0,r.createServerReference)("4050b6ec2c684f806cd9a92d2dffe03197255a0a4c",r.callServer,void 0,r.findSourceMapURL,"openFolder");e.s(["openFolder",()=>l],20782)},76852,e=>{"use strict";var t=e.i(79054),r=e.i(69849),a=e.i(51771),s=e.i(20782);function l(e){let[l,u]=(0,t.useState)(!1),[i,n]=(0,t.useState)(!1),[c,o]=(0,t.useState)(!1),[d,f]=(0,t.useState)(null),[p,h]=(0,t.useState)(null),[y,m]=(0,t.useState)(null),v=(0,t.useRef)(null),x=(0,t.useRef)(null),b=(0,t.useRef)(null);(0,t.useEffect)(()=>()=>{v.current&&clearTimeout(v.current),x.current&&clearTimeout(x.current),b.current&&clearTimeout(b.current)},[]);let k=(0,t.useCallback)(async(t,r,a,s,l)=>{if(e&&!l){s.current&&clearTimeout(s.current),r(!0),a(null);try{let e=await t();if(!e.success){let t=e.error??"An unexpected error occurred";a(t),s.current=setTimeout(()=>a(null),5e3)}}catch(e){a(e instanceof Error?e.message:"An unexpected error occurred"),s.current=setTimeout(()=>a(null),5e3)}finally{r(!1)}}},[e]);return{openInIde:(0,t.useCallback)(()=>k(()=>(0,r.openIde)({repositoryPath:e.repositoryPath}),u,f,v,l),[k,l,e]),openInShell:(0,t.useCallback)(()=>k(()=>(0,a.openShell)({repositoryPath:e.repositoryPath}),n,h,x,i),[k,i,e]),openFolder:(0,t.useCallback)(()=>k(()=>(0,s.openFolder)(e.repositoryPath),o,m,b,c),[k,c,e]),ideLoading:l,shellLoading:i,folderLoading:c,ideError:d,shellError:p,folderError:y}}e.s(["useRepositoryActions",()=>l])}]);
@@ -1 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,76016,e=>{"use strict";let t=(0,e.i(3645).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["ChevronRight",()=>t],76016)},11345,e=>{"use strict";let t=(0,e.i(3645).default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);e.s(["ChevronLeft",()=>t],11345)},93752,e=>{"use strict";let t=(0,e.i(3645).default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);e.s(["default",()=>t])},99105,e=>{"use strict";let t=(0,e.i(3645).default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);e.s(["ChevronDown",()=>t],99105)},87889,e=>{"use strict";let t=(0,e.i(3645).default)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);e.s(["Eye",()=>t],87889)},16868,48306,86254,50032,42076,e=>{"use strict";var t=e.i(3645);let r=(0,t.default)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]);e.s(["PaperclipIcon",()=>r],16868);var i=e.i(20314),s=e.i(31777);function n({className:e,...t}){return(0,i.jsx)("textarea",{"data-slot":"textarea",className:(0,s.cn)("placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input field-sizing-content min-h-[80px] w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...t})}e.s(["Textarea",()=>n],48306);var a=e.i(60253),l=e.i(15506),l=l,o=e.i(95230),o=o,c=e.i(2287),u=e.i(1693),u=u;let d=(0,t.default)("file",[["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:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]);var f=e.i(16298),f=f;let h=(0,t.default)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);var p=e.i(93752),p=p;e.i(35364);let m=new Set([".png",".jpg",".jpeg",".gif",".svg",".webp",".ico",".bmp"]),v=new Set([".ts",".tsx",".js",".jsx",".json",".yaml",".yml",".xml",".html",".css",".md"]);function g(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024));return`${(e/Math.pow(1024,t)).toFixed(+(0!==t))} ${["B","KB","MB","GB"][t]}`}let x=new Set([".png",".jpg",".jpeg",".gif",".svg",".webp",".ico",".bmp"]);function y(e,t){let r=new URLSearchParams({path:e,mimeType:t});return`/api/attachments/preview?${r.toString()}`}function b({name:e,size:t,mimeType:r,path:n,onRemove:b,loading:w=!1,disabled:k=!1}){let j,R,C=(j=e.lastIndexOf("."))>=0?e.slice(j).toLowerCase():"",N=m.has(C)?h:".pdf"===C?f.default:v.has(C)?p.default:d,T=".pdf"===C?"bg-red-50 text-red-600":m.has(C)?"bg-blue-50 text-blue-600":v.has(C)?"bg-emerald-50 text-emerald-600":"bg-gray-50 text-gray-600",A=(R=e.lastIndexOf("."))>=0&&x.has(e.slice(R).toLowerCase());return w?(0,i.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-md border",children:(0,i.jsx)(l.default,{className:"text-muted-foreground h-5 w-5 animate-spin"})}):A?(0,i.jsxs)(c.Dialog,{children:[(0,i.jsxs)("div",{className:"group relative",children:[(0,i.jsx)(c.DialogTrigger,{asChild:!0,children:(0,i.jsx)("img",{src:y(n,r),alt:e,title:e,className:"h-12 w-12 cursor-pointer rounded-md border object-cover transition-opacity hover:opacity-80"})}),!k&&(0,i.jsx)("button",{type:"button",onClick:b,className:"absolute -top-1.5 -right-1.5 hidden h-5 w-5 cursor-pointer items-center justify-center rounded-full bg-black/70 text-white group-hover:flex","aria-label":`Remove ${e}`,children:(0,i.jsx)(a.X,{className:"h-3 w-3"})})]}),(0,i.jsxs)(c.DialogContent,{className:"max-w-3xl gap-0 overflow-hidden border-0 p-0 [&>button:last-child]:!cursor-pointer [&>button:last-child]:!rounded-full [&>button:last-child]:!bg-black/70 [&>button:last-child]:!p-1.5 [&>button:last-child]:!text-white [&>button:last-child]:!opacity-100 [&>button:last-child]:!shadow-lg [&>button:last-child]:!backdrop-blur-md [&>button:last-child]:hover:!bg-black/90",children:[(0,i.jsx)(u.Root,{children:(0,i.jsxs)(c.DialogTitle,{children:["Preview: ",e]})}),(0,i.jsx)("div",{className:"relative bg-black/90",children:(0,i.jsx)("img",{src:y(n,r),alt:e,className:"h-auto max-h-[70vh] w-full object-contain"})}),(0,i.jsxs)("div",{className:"bg-background flex items-center gap-3 px-4 py-3",children:[(0,i.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,i.jsx)("span",{className:"truncate text-sm font-medium",children:e}),(0,i.jsx)("span",{className:"text-muted-foreground text-xs",children:g(t)})]}),(0,i.jsx)("a",{href:y(n,r),download:e,className:"text-muted-foreground hover:text-foreground shrink-0 cursor-pointer rounded p-1.5 transition-colors","aria-label":`Download ${e}`,children:(0,i.jsx)(o.default,{className:"h-4 w-4"})})]})]})]}):(0,i.jsxs)("div",{className:"group relative flex items-center gap-2 rounded-full border py-1 pr-3 pl-2",children:[(0,i.jsx)("div",{className:(0,s.cn)("flex h-6 w-6 shrink-0 items-center justify-center rounded-full",T),children:(0,i.jsx)(N,{className:"h-3 w-3"})}),(0,i.jsx)("span",{className:"max-w-[120px] truncate text-sm",children:e}),(0,i.jsx)("span",{className:"text-muted-foreground text-xs",children:g(t)}),!k&&(0,i.jsx)("button",{type:"button",onClick:b,className:"absolute -top-1.5 -right-1.5 hidden h-5 w-5 cursor-pointer items-center justify-center rounded-full bg-black/70 text-white group-hover:flex","aria-label":`Remove ${e}`,children:(0,i.jsx)(a.X,{className:"h-3 w-3"})})]})}async function w(){let e=await fetch("/api/dialog/pick-files",{method:"POST"});if(!e.ok)throw Error("Failed to open file dialog");let t=await e.json();return t.cancelled?null:t.files}e.s(["AttachmentChip",()=>b],86254),e.s([],50032),e.s(["pickFiles",()=>w],42076)},68304,51080,e=>{"use strict";var t=e.i(20314),r=e.i(79054),i=e.i(91967),s=e.i(22528),n=e.i(87342),a=e.i(5978),l=e.i(13123),o=e.i(87620),c=e.i(29297),u=e.i(36589),d=e.i(66033),f="rovingFocusGroup.onEntryFocus",h={bubbles:!1,cancelable:!0},p="RovingFocusGroup",[m,v,g]=(0,n.createCollection)(p),[x,y]=(0,s.createContextScope)(p,[g]),[b,w]=x(p),k=r.forwardRef((e,r)=>(0,t.jsx)(m.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,t.jsx)(m.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,t.jsx)(j,{...e,ref:r})})}));k.displayName=p;var j=r.forwardRef((e,s)=>{let{__scopeRovingFocusGroup:n,orientation:l,loop:m=!1,dir:g,currentTabStopId:x,defaultCurrentTabStopId:y,onCurrentTabStopIdChange:w,onEntryFocus:k,preventScrollOnEntryFocus:j=!1,...R}=e,C=r.useRef(null),N=(0,a.useComposedRefs)(s,C),A=(0,d.useDirection)(g),[S,I]=(0,u.useControllableState)({prop:x,defaultProp:y??null,onChange:w,caller:p}),[M,D]=r.useState(!1),E=(0,c.useCallbackRef)(k),F=v(n),P=r.useRef(!1),[z,O]=r.useState(0);return r.useEffect(()=>{let e=C.current;if(e)return e.addEventListener(f,E),()=>e.removeEventListener(f,E)},[E]),(0,t.jsx)(b,{scope:n,orientation:l,dir:A,loop:m,currentTabStopId:S,onItemFocus:r.useCallback(e=>I(e),[I]),onItemShiftTab:r.useCallback(()=>D(!0),[]),onFocusableItemAdd:r.useCallback(()=>O(e=>e+1),[]),onFocusableItemRemove:r.useCallback(()=>O(e=>e-1),[]),children:(0,t.jsx)(o.Primitive.div,{tabIndex:M||0===z?-1:0,"data-orientation":l,...R,ref:N,style:{outline:"none",...e.style},onMouseDown:(0,i.composeEventHandlers)(e.onMouseDown,()=>{P.current=!0}),onFocus:(0,i.composeEventHandlers)(e.onFocus,e=>{let t=!P.current;if(e.target===e.currentTarget&&t&&!M){let t=new CustomEvent(f,h);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=F().filter(e=>e.focusable);T([e.find(e=>e.active),e.find(e=>e.id===S),...e].filter(Boolean).map(e=>e.ref.current),j)}}P.current=!1}),onBlur:(0,i.composeEventHandlers)(e.onBlur,()=>D(!1))})})}),R="RovingFocusGroupItem",C=r.forwardRef((e,s)=>{let{__scopeRovingFocusGroup:n,focusable:a=!0,active:c=!1,tabStopId:u,children:d,...f}=e,h=(0,l.useId)(),p=u||h,g=w(R,n),x=g.currentTabStopId===p,y=v(n),{onFocusableItemAdd:b,onFocusableItemRemove:k,currentTabStopId:j}=g;return r.useEffect(()=>{if(a)return b(),()=>k()},[a,b,k]),(0,t.jsx)(m.ItemSlot,{scope:n,id:p,focusable:a,active:c,children:(0,t.jsx)(o.Primitive.span,{tabIndex:x?0:-1,"data-orientation":g.orientation,...f,ref:s,onMouseDown:(0,i.composeEventHandlers)(e.onMouseDown,e=>{a?g.onItemFocus(p):e.preventDefault()}),onFocus:(0,i.composeEventHandlers)(e.onFocus,()=>g.onItemFocus(p)),onKeyDown:(0,i.composeEventHandlers)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void g.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=function(e,t,r){var i;let s=(i=e.key,"rtl"!==r?i:"ArrowLeft"===i?"ArrowRight":"ArrowRight"===i?"ArrowLeft":i);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(s))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(s)))return N[s]}(e,g.orientation,g.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let s=y().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)s.reverse();else if("prev"===t||"next"===t){var r,i;"prev"===t&&s.reverse();let n=s.indexOf(e.currentTarget);s=g.loop?(r=s,i=n+1,r.map((e,t)=>r[(i+t)%r.length])):s.slice(n+1)}setTimeout(()=>T(s))}}),children:"function"==typeof d?d({isCurrentTabStop:x,hasTabStop:null!=j}):d})})});C.displayName=R;var N={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function T(e,t=!1){let r=document.activeElement;for(let i of e)if(i===r||(i.focus({preventScroll:t}),document.activeElement!==r))return}e.s(["Item",()=>C,"Root",()=>k,"createRovingFocusGroupScope",()=>y],51080);var A=e.i(85995),S="Tabs",[I,M]=(0,s.createContextScope)(S,[y]),D=y(),[E,F]=I(S),P=r.forwardRef((e,r)=>{let{__scopeTabs:i,value:s,onValueChange:n,defaultValue:a,orientation:c="horizontal",dir:f,activationMode:h="automatic",...p}=e,m=(0,d.useDirection)(f),[v,g]=(0,u.useControllableState)({prop:s,onChange:n,defaultProp:a??"",caller:S});return(0,t.jsx)(E,{scope:i,baseId:(0,l.useId)(),value:v,onValueChange:g,orientation:c,dir:m,activationMode:h,children:(0,t.jsx)(o.Primitive.div,{dir:m,"data-orientation":c,...p,ref:r})})});P.displayName=S;var z="TabsList",O=r.forwardRef((e,r)=>{let{__scopeTabs:i,loop:s=!0,...n}=e,a=F(z,i),l=D(i);return(0,t.jsx)(k,{asChild:!0,...l,orientation:a.orientation,dir:a.dir,loop:s,children:(0,t.jsx)(o.Primitive.div,{role:"tablist","aria-orientation":a.orientation,...n,ref:r})})});O.displayName=z;var L="TabsTrigger",K=r.forwardRef((e,r)=>{let{__scopeTabs:s,value:n,disabled:a=!1,...l}=e,c=F(L,s),u=D(s),d=$(c.baseId,n),f=G(c.baseId,n),h=n===c.value;return(0,t.jsx)(C,{asChild:!0,...u,focusable:!a,active:h,children:(0,t.jsx)(o.Primitive.button,{type:"button",role:"tab","aria-selected":h,"aria-controls":f,"data-state":h?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:d,...l,ref:r,onMouseDown:(0,i.composeEventHandlers)(e.onMouseDown,e=>{a||0!==e.button||!1!==e.ctrlKey?e.preventDefault():c.onValueChange(n)}),onKeyDown:(0,i.composeEventHandlers)(e.onKeyDown,e=>{[" ","Enter"].includes(e.key)&&c.onValueChange(n)}),onFocus:(0,i.composeEventHandlers)(e.onFocus,()=>{let e="manual"!==c.activationMode;h||a||!e||c.onValueChange(n)})})})});K.displayName=L;var B="TabsContent",H=r.forwardRef((e,i)=>{let{__scopeTabs:s,value:n,forceMount:a,children:l,...c}=e,u=F(B,s),d=$(u.baseId,n),f=G(u.baseId,n),h=n===u.value,p=r.useRef(h);return r.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,t.jsx)(A.Presence,{present:a||h,children:({present:r})=>(0,t.jsx)(o.Primitive.div,{"data-state":h?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":d,hidden:!r,id:f,tabIndex:0,...c,ref:i,style:{...e.style,animationDuration:p.current?"0s":void 0},children:r&&l})})});function $(e,t){return`${e}-trigger-${t}`}function G(e,t){return`${e}-content-${t}`}H.displayName=B,e.s(["Content",()=>H,"List",()=>O,"Root",()=>P,"Tabs",()=>P,"TabsContent",()=>H,"TabsList",()=>O,"TabsTrigger",()=>K,"Trigger",()=>K,"createTabsScope",()=>M],43133);var q=e.i(43133),q=q,U=e.i(31777);let V=q.Root,_=r.forwardRef(({className:e,...r},i)=>(0,t.jsx)(q.List,{ref:i,className:(0,U.cn)("bg-muted text-muted-foreground inline-flex h-9 items-center justify-center rounded-lg p-1",e),...r}));_.displayName=q.List.displayName;let X=r.forwardRef(({className:e,...r},i)=>(0,t.jsx)(q.Trigger,{ref:i,className:(0,U.cn)("ring-offset-background focus-visible:ring-ring data-[state=active]:bg-background data-[state=active]:text-foreground inline-flex items-center justify-center rounded-md px-3 py-1 text-sm font-medium whitespace-nowrap transition-all focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow",e),...r}));X.displayName=q.Trigger.displayName;let W=r.forwardRef(({className:e,...r},i)=>(0,t.jsx)(q.Content,{ref:i,className:(0,U.cn)("ring-offset-background focus-visible:ring-ring mt-2 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",e),...r}));W.displayName=q.Content.displayName,e.s(["Tabs",()=>V,"TabsContent",()=>W,"TabsList",()=>_,"TabsTrigger",()=>X],68304)},87342,e=>{"use strict";var t=e.i(79054),r=e.i(22528),i=e.i(5978),s=e.i(86874),n=e.i(20314);function a(e){let a=e+"CollectionProvider",[l,o]=(0,r.createContextScope)(a),[c,u]=l(a,{collectionRef:{current:null},itemMap:new Map}),d=e=>{let{scope:r,children:i}=e,s=t.default.useRef(null),a=t.default.useRef(new Map).current;return(0,n.jsx)(c,{scope:r,itemMap:a,collectionRef:s,children:i})};d.displayName=a;let f=e+"CollectionSlot",h=(0,s.createSlot)(f),p=t.default.forwardRef((e,t)=>{let{scope:r,children:s}=e,a=u(f,r),l=(0,i.useComposedRefs)(t,a.collectionRef);return(0,n.jsx)(h,{ref:l,children:s})});p.displayName=f;let m=e+"CollectionItemSlot",v="data-radix-collection-item",g=(0,s.createSlot)(m),x=t.default.forwardRef((e,r)=>{let{scope:s,children:a,...l}=e,o=t.default.useRef(null),c=(0,i.useComposedRefs)(r,o),d=u(m,s);return t.default.useEffect(()=>(d.itemMap.set(o,{ref:o,...l}),()=>void d.itemMap.delete(o))),(0,n.jsx)(g,{...{[v]:""},ref:c,children:a})});return x.displayName=m,[{Provider:d,Slot:p,ItemSlot:x},function(r){let i=u(e+"CollectionConsumer",r);return t.default.useCallback(()=>{let e=i.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${v}]`));return Array.from(i.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current))},[i.collectionRef,i.itemMap])},o]}var l=new WeakMap;function o(e,t){var r,i;let s,n,a;if("at"in Array.prototype)return Array.prototype.at.call(e,t);let l=(r=e,i=t,s=r.length,(a=(n=c(i))>=0?n:s+n)<0||a>=s?-1:a);return -1===l?void 0:e[l]}function c(e){return e!=e||0===e?0:Math.trunc(e)}(class e extends Map{#e;constructor(e){super(e),this.#e=[...super.keys()],l.set(this,!0)}set(e,t){return l.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,r){let i,s=this.has(t),n=this.#e.length,a=c(e),l=a>=0?a:n+a,o=l<0||l>=n?-1:l;if(o===this.size||s&&o===this.size-1||-1===o)return this.set(t,r),this;let u=this.size+ +!s;a<0&&l++;let d=[...this.#e],f=!1;for(let e=l;e<u;e++)if(l===e){let n=d[e];d[e]===t&&(n=d[e+1]),s&&this.delete(t),i=this.get(n),this.set(t,r)}else{f||d[e-1]!==t||(f=!0);let r=d[f?e:e-1],s=i;i=this.get(r),this.delete(r),this.set(r,s)}return this}with(t,r,i){let s=new e(this);return s.insert(t,r,i),s}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,r){let i=this.#e.indexOf(e);return -1===i?this:this.insert(i,t,r)}after(e){let t=this.#e.indexOf(e);if(-1!==(t=-1===t||t===this.size-1?-1:t+1))return this.entryAt(t)}setAfter(e,t,r){let i=this.#e.indexOf(e);return -1===i?this:this.insert(i+1,t,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){let t=o(this.#e,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=o(this.#e,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return o(this.#e,e)}from(e,t){let r=this.indexOf(e);if(-1===r)return;let i=r+t;return i<0&&(i=0),i>=this.size&&(i=this.size-1),this.at(i)}keyFrom(e,t){let r=this.indexOf(e);if(-1===r)return;let i=r+t;return i<0&&(i=0),i>=this.size&&(i=this.size-1),this.keyAt(i)}find(e,t){let r=0;for(let i of this){if(Reflect.apply(e,t,[i,r,this]))return i;r++}}findIndex(e,t){let r=0;for(let i of this){if(Reflect.apply(e,t,[i,r,this]))return r;r++}return -1}filter(t,r){let i=[],s=0;for(let e of this)Reflect.apply(t,r,[e,s,this])&&i.push(e),s++;return new e(i)}map(t,r){let i=[],s=0;for(let e of this)i.push([e[0],Reflect.apply(t,r,[e,s,this])]),s++;return new e(i)}reduce(...e){let[t,r]=e,i=0,s=r??this.at(0);for(let r of this)s=0===i&&1===e.length?r:Reflect.apply(t,this,[s,r,i,this]),i++;return s}reduceRight(...e){let[t,r]=e,i=r??this.at(-1);for(let r=this.size-1;r>=0;r--){let s=this.at(r);i=r===this.size-1&&1===e.length?s:Reflect.apply(t,this,[i,s,r,this])}return i}toSorted(t){return new e([...this.entries()].sort(t))}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let r=this.keyAt(e),i=this.get(r);t.set(r,i)}return t}toSpliced(...t){let r=[...this.entries()];return r.splice(...t),new e(r)}slice(t,r){let i=new e,s=this.size-1;if(void 0===t)return i;t<0&&(t+=this.size),void 0!==r&&r>0&&(s=r-1);for(let e=t;e<=s;e++){let t=this.keyAt(e),r=this.get(t);i.set(t,r)}return i}every(e,t){let r=0;for(let i of this){if(!Reflect.apply(e,t,[i,r,this]))return!1;r++}return!0}some(e,t){let r=0;for(let i of this){if(Reflect.apply(e,t,[i,r,this]))return!0;r++}return!1}}),e.s(["createCollection",()=>a])},49228,e=>{"use strict";let t=(0,e.i(3645).default)("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);e.s(["GitBranch",()=>t],49228)},95230,e=>{"use strict";let t=(0,e.i(3645).default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);e.s(["default",()=>t])},95812,35e3,e=>{"use strict";let t=(0,e.i(3645).default)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);e.s(["Circle",()=>t],95812);var r=e.i(80986);e.s(["CheckCircle2",()=>r.default],35e3)}]);
@@ -1 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,93752,e=>{"use strict";let t=(0,e.i(3645).default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);e.s(["default",()=>t])},11345,e=>{"use strict";let t=(0,e.i(3645).default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);e.s(["ChevronLeft",()=>t],11345)},76016,e=>{"use strict";let t=(0,e.i(3645).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["ChevronRight",()=>t],76016)},95230,e=>{"use strict";let t=(0,e.i(3645).default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);e.s(["default",()=>t])},16868,48306,86254,50032,42076,e=>{"use strict";var t=e.i(3645);let r=(0,t.default)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]);e.s(["PaperclipIcon",()=>r],16868);var a=e.i(20314),o=e.i(31777);function s({className:e,...t}){return(0,a.jsx)("textarea",{"data-slot":"textarea",className:(0,o.cn)("placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input field-sizing-content min-h-[80px] w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...t})}e.s(["Textarea",()=>s],48306);var i=e.i(60253),n=e.i(15506),n=n,l=e.i(95230),l=l,d=e.i(2287),c=e.i(1693),c=c;let u=(0,t.default)("file",[["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:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]);var p=e.i(16298),p=p;let h=(0,t.default)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);var m=e.i(93752),m=m;e.i(35364);let f=new Set([".png",".jpg",".jpeg",".gif",".svg",".webp",".ico",".bmp"]),x=new Set([".ts",".tsx",".js",".jsx",".json",".yaml",".yml",".xml",".html",".css",".md"]);function g(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024));return`${(e/Math.pow(1024,t)).toFixed(+(0!==t))} ${["B","KB","MB","GB"][t]}`}let b=new Set([".png",".jpg",".jpeg",".gif",".svg",".webp",".ico",".bmp"]);function v(e,t){let r=new URLSearchParams({path:e,mimeType:t});return`/api/attachments/preview?${r.toString()}`}function j({name:e,size:t,mimeType:r,path:s,onRemove:j,loading:w=!1,disabled:y=!1}){let C,k,N=(C=e.lastIndexOf("."))>=0?e.slice(C).toLowerCase():"",P=f.has(N)?h:".pdf"===N?p.default:x.has(N)?m.default:u,T=".pdf"===N?"bg-red-50 text-red-600":f.has(N)?"bg-blue-50 text-blue-600":x.has(N)?"bg-emerald-50 text-emerald-600":"bg-gray-50 text-gray-600",S=(k=e.lastIndexOf("."))>=0&&b.has(e.slice(k).toLowerCase());return w?(0,a.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-md border",children:(0,a.jsx)(n.default,{className:"text-muted-foreground h-5 w-5 animate-spin"})}):S?(0,a.jsxs)(d.Dialog,{children:[(0,a.jsxs)("div",{className:"group relative",children:[(0,a.jsx)(d.DialogTrigger,{asChild:!0,children:(0,a.jsx)("img",{src:v(s,r),alt:e,title:e,className:"h-12 w-12 cursor-pointer rounded-md border object-cover transition-opacity hover:opacity-80"})}),!y&&(0,a.jsx)("button",{type:"button",onClick:j,className:"absolute -top-1.5 -right-1.5 hidden h-5 w-5 cursor-pointer items-center justify-center rounded-full bg-black/70 text-white group-hover:flex","aria-label":`Remove ${e}`,children:(0,a.jsx)(i.X,{className:"h-3 w-3"})})]}),(0,a.jsxs)(d.DialogContent,{className:"max-w-3xl gap-0 overflow-hidden border-0 p-0 [&>button:last-child]:!cursor-pointer [&>button:last-child]:!rounded-full [&>button:last-child]:!bg-black/70 [&>button:last-child]:!p-1.5 [&>button:last-child]:!text-white [&>button:last-child]:!opacity-100 [&>button:last-child]:!shadow-lg [&>button:last-child]:!backdrop-blur-md [&>button:last-child]:hover:!bg-black/90",children:[(0,a.jsx)(c.Root,{children:(0,a.jsxs)(d.DialogTitle,{children:["Preview: ",e]})}),(0,a.jsx)("div",{className:"relative bg-black/90",children:(0,a.jsx)("img",{src:v(s,r),alt:e,className:"h-auto max-h-[70vh] w-full object-contain"})}),(0,a.jsxs)("div",{className:"bg-background flex items-center gap-3 px-4 py-3",children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,a.jsx)("span",{className:"truncate text-sm font-medium",children:e}),(0,a.jsx)("span",{className:"text-muted-foreground text-xs",children:g(t)})]}),(0,a.jsx)("a",{href:v(s,r),download:e,className:"text-muted-foreground hover:text-foreground shrink-0 cursor-pointer rounded p-1.5 transition-colors","aria-label":`Download ${e}`,children:(0,a.jsx)(l.default,{className:"h-4 w-4"})})]})]})]}):(0,a.jsxs)("div",{className:"group relative flex items-center gap-2 rounded-full border py-1 pr-3 pl-2",children:[(0,a.jsx)("div",{className:(0,o.cn)("flex h-6 w-6 shrink-0 items-center justify-center rounded-full",T),children:(0,a.jsx)(P,{className:"h-3 w-3"})}),(0,a.jsx)("span",{className:"max-w-[120px] truncate text-sm",children:e}),(0,a.jsx)("span",{className:"text-muted-foreground text-xs",children:g(t)}),!y&&(0,a.jsx)("button",{type:"button",onClick:j,className:"absolute -top-1.5 -right-1.5 hidden h-5 w-5 cursor-pointer items-center justify-center rounded-full bg-black/70 text-white group-hover:flex","aria-label":`Remove ${e}`,children:(0,a.jsx)(i.X,{className:"h-3 w-3"})})]})}async function w(){let e=await fetch("/api/dialog/pick-files",{method:"POST"});if(!e.ok)throw Error("Failed to open file dialog");let t=await e.json();return t.cancelled?null:t.files}e.s(["AttachmentChip",()=>j],86254),e.s([],50032),e.s(["pickFiles",()=>w],42076)},90382,e=>{"use strict";var t=e.i(20314),r=e.i(79054),a=e.i(91967),o=e.i(5978),s=e.i(22528),i=e.i(53532),n=e.i(41687),l=e.i(56720),d=e.i(13123),c=e.i(52740),u=e.i(39979),p=e.i(85995),h=e.i(87620),m=e.i(86874),f=e.i(36589),x=e.i(73772),g=e.i(13044),b="Popover",[v,j]=(0,s.createContextScope)(b,[c.createPopperScope]),w=(0,c.createPopperScope)(),[y,C]=v(b),k=e=>{let{__scopePopover:a,children:o,open:s,defaultOpen:i,onOpenChange:n,modal:l=!1}=e,u=w(a),p=r.useRef(null),[h,m]=r.useState(!1),[x,g]=(0,f.useControllableState)({prop:s,defaultProp:i??!1,onChange:n,caller:b});return(0,t.jsx)(c.Root,{...u,children:(0,t.jsx)(y,{scope:a,contentId:(0,d.useId)(),triggerRef:p,open:x,onOpenChange:g,onOpenToggle:r.useCallback(()=>g(e=>!e),[g]),hasCustomAnchor:h,onCustomAnchorAdd:r.useCallback(()=>m(!0),[]),onCustomAnchorRemove:r.useCallback(()=>m(!1),[]),modal:l,children:o})})};k.displayName=b;var N="PopoverAnchor",P=r.forwardRef((e,a)=>{let{__scopePopover:o,...s}=e,i=C(N,o),n=w(o),{onCustomAnchorAdd:l,onCustomAnchorRemove:d}=i;return r.useEffect(()=>(l(),()=>d()),[l,d]),(0,t.jsx)(c.Anchor,{...n,...s,ref:a})});P.displayName=N;var T="PopoverTrigger",S=r.forwardRef((e,r)=>{let{__scopePopover:s,...i}=e,n=C(T,s),l=w(s),d=(0,o.useComposedRefs)(r,n.triggerRef),u=(0,t.jsx)(h.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":q(n.open),...i,ref:d,onClick:(0,a.composeEventHandlers)(e.onClick,n.onOpenToggle)});return n.hasCustomAnchor?u:(0,t.jsx)(c.Anchor,{asChild:!0,...l,children:u})});S.displayName=T;var R="PopoverPortal",[A,D]=v(R,{forceMount:void 0}),F=e=>{let{__scopePopover:r,forceMount:a,children:o,container:s}=e,i=C(R,r);return(0,t.jsx)(A,{scope:r,forceMount:a,children:(0,t.jsx)(p.Presence,{present:a||i.open,children:(0,t.jsx)(u.Portal,{asChild:!0,container:s,children:o})})})};F.displayName=R;var E="PopoverContent",M=r.forwardRef((e,r)=>{let a=D(E,e.__scopePopover),{forceMount:o=a.forceMount,...s}=e,i=C(E,e.__scopePopover);return(0,t.jsx)(p.Presence,{present:o||i.open,children:i.modal?(0,t.jsx)(z,{...s,ref:r}):(0,t.jsx)(I,{...s,ref:r})})});M.displayName=E;var O=(0,m.createSlot)("PopoverContent.RemoveScroll"),z=r.forwardRef((e,s)=>{let i=C(E,e.__scopePopover),n=r.useRef(null),l=(0,o.useComposedRefs)(s,n),d=r.useRef(!1);return r.useEffect(()=>{let e=n.current;if(e)return(0,x.hideOthers)(e)},[]),(0,t.jsx)(g.RemoveScroll,{as:O,allowPinchZoom:!0,children:(0,t.jsx)(L,{...e,ref:l,trapFocus:i.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,a.composeEventHandlers)(e.onCloseAutoFocus,e=>{e.preventDefault(),d.current||i.triggerRef.current?.focus()}),onPointerDownOutside:(0,a.composeEventHandlers)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;d.current=2===t.button||r},{checkForDefaultPrevented:!1}),onFocusOutside:(0,a.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),I=r.forwardRef((e,a)=>{let o=C(E,e.__scopePopover),s=r.useRef(!1),i=r.useRef(!1);return(0,t.jsx)(L,{...e,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(s.current||o.triggerRef.current?.focus(),t.preventDefault()),s.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(s.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));let r=t.target;o.triggerRef.current?.contains(r)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),L=r.forwardRef((e,r)=>{let{__scopePopover:a,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:d,disableOutsidePointerEvents:u,onEscapeKeyDown:p,onPointerDownOutside:h,onFocusOutside:m,onInteractOutside:f,...x}=e,g=C(E,a),b=w(a);return(0,n.useFocusGuards)(),(0,t.jsx)(l.FocusScope,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:s,onUnmountAutoFocus:d,children:(0,t.jsx)(i.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:f,onEscapeKeyDown:p,onPointerDownOutside:h,onFocusOutside:m,onDismiss:()=>g.onOpenChange(!1),children:(0,t.jsx)(c.Content,{"data-state":q(g.open),role:"dialog",id:g.contentId,...b,...x,ref:r,style:{...x.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),U="PopoverClose",B=r.forwardRef((e,r)=>{let{__scopePopover:o,...s}=e,i=C(U,o);return(0,t.jsx)(h.Primitive.button,{type:"button",...s,ref:r,onClick:(0,a.composeEventHandlers)(e.onClick,()=>i.onOpenChange(!1))})});B.displayName=U;var $=r.forwardRef((e,r)=>{let{__scopePopover:a,...o}=e,s=w(a);return(0,t.jsx)(c.Arrow,{...s,...o,ref:r})});function q(e){return e?"open":"closed"}$.displayName="PopoverArrow",e.s(["Anchor",()=>P,"Arrow",()=>$,"Close",()=>B,"Content",()=>M,"Popover",()=>k,"PopoverAnchor",()=>P,"PopoverArrow",()=>$,"PopoverClose",()=>B,"PopoverContent",()=>M,"PopoverPortal",()=>F,"PopoverTrigger",()=>S,"Portal",()=>F,"Root",()=>k,"Trigger",()=>S,"createPopoverScope",()=>j],89920);var H=e.i(89920),H=H,G=e.i(31777);let _=H.Root,K=H.Trigger;H.Anchor;let X=r.forwardRef(({className:e,align:r="center",sideOffset:a=4,...o},s)=>(0,t.jsx)(H.Portal,{children:(0,t.jsx)(H.Content,{ref:s,align:r,sideOffset:a,className:(0,G.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-none",e),...o})}));X.displayName=H.Content.displayName,e.s(["Popover",()=>_,"PopoverContent",()=>X,"PopoverTrigger",()=>K],90382)},51911,32639,39188,e=>{"use strict";var t=e.i(20314),r=e.i(79054),a=e.i(91967),o=e.i(5978),s=e.i(22528),i=e.i(36589),n=e.i(23405),l=e.i(77624),d=e.i(87620),c="Switch",[u,p]=(0,s.createContextScope)(c),[h,m]=u(c),f=r.forwardRef((e,s)=>{let{__scopeSwitch:n,name:l,checked:u,defaultChecked:p,required:m,disabled:f,value:x="on",onCheckedChange:g,form:j,...w}=e,[y,C]=r.useState(null),k=(0,o.useComposedRefs)(s,e=>C(e)),N=r.useRef(!1),P=!y||j||!!y.closest("form"),[T,S]=(0,i.useControllableState)({prop:u,defaultProp:p??!1,onChange:g,caller:c});return(0,t.jsxs)(h,{scope:n,checked:T,disabled:f,children:[(0,t.jsx)(d.Primitive.button,{type:"button",role:"switch","aria-checked":T,"aria-required":m,"data-state":v(T),"data-disabled":f?"":void 0,disabled:f,value:x,...w,ref:k,onClick:(0,a.composeEventHandlers)(e.onClick,e=>{S(e=>!e),P&&(N.current=e.isPropagationStopped(),N.current||e.stopPropagation())})}),P&&(0,t.jsx)(b,{control:y,bubbles:!N.current,name:l,value:x,checked:T,required:m,disabled:f,form:j,style:{transform:"translateX(-100%)"}})]})});f.displayName=c;var x="SwitchThumb",g=r.forwardRef((e,r)=>{let{__scopeSwitch:a,...o}=e,s=m(x,a);return(0,t.jsx)(d.Primitive.span,{"data-state":v(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:r})});g.displayName=x;var b=r.forwardRef(({__scopeSwitch:e,control:a,checked:s,bubbles:i=!0,...d},c)=>{let u=r.useRef(null),p=(0,o.useComposedRefs)(u,c),h=(0,n.usePrevious)(s),m=(0,l.useSize)(a);return r.useEffect(()=>{let e=u.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(h!==s&&t){let r=new Event("click",{bubbles:i});t.call(e,s),e.dispatchEvent(r)}},[h,s,i]),(0,t.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:s,...d,tabIndex:-1,ref:p,style:{...d.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function v(e){return e?"checked":"unchecked"}b.displayName="SwitchBubbleInput",e.s(["Root",()=>f,"Switch",()=>f,"SwitchThumb",()=>g,"Thumb",()=>g,"createSwitchScope",()=>p],95291);var j=e.i(95291),j=j,w=e.i(31777);function y({className:e,size:r="default",...a}){return(0,t.jsx)(j.Root,{"data-slot":"switch","data-size":r,className:(0,w.cn)("peer group/switch focus-visible:border-ring focus-visible:ring-ring/50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80 inline-flex shrink-0 cursor-pointer items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6",e),...a,children:(0,t.jsx)(j.Thumb,{"data-slot":"switch-thumb",className:(0,w.cn)("bg-background dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}e.s(["Switch",()=>y],51911);var C=e.i(21023);let k=(0,C.createServerReference)("00b3d3258a7fdab47eb0bc75b98e6190613d394380",C.callServer,void 0,C.findSourceMapURL,"getAllAgentModels");e.s(["getAllAgentModels",()=>k],32639);let N=(0,C.createServerReference)("600c6cafd7fa51135ad9fba70f11cff6784b8b960e",C.callServer,void 0,C.findSourceMapURL,"updateAgentAndModel");e.s(["updateAgentAndModel",()=>N],39188)},41413,e=>{"use strict";var t=e.i(20314),r=e.i(79054),a=e.i(23925),o=e.i(11345),s=e.i(76016),i=e.i(32639),n=e.i(39188),l=e.i(86782),d=e.i(29847),c=e.i(35364),u=e.i(90382),p=e.i(31777);function h({initialAgentType:e,initialModel:h,onAgentModelChange:m,disabled:f,className:x,mode:g}){let[b,v]=r.useState(!1),[j,w]=r.useState([]),[y,C]=r.useState(!0),[k,N]=r.useState(e),[P,T]=r.useState(h),[S,R]=r.useState(null),[A,D]=r.useState(0),[F,E]=r.useState(null);r.useEffect(()=>{(0,i.getAllAgentModels)().then(w).finally(()=>C(!1))},[]),r.useEffect(()=>{if(!b){let e=setTimeout(()=>{D(0),E(null)},150);return()=>clearTimeout(e)}},[b]);let M=async(e,t)=>{if(v(!1),e!==k||t!==P){if("override"===g){N(e),T(t),m?.(e,t);return}N(e),T(t),m?.(e,t),R(null);try{let r=await (0,n.updateAgentAndModel)(e,t||null);r.ok||(N(k),T(P),m?.(k,P),R(r.error??"Failed to save"))}catch{N(k),T(P),m?.(k,P),R("Failed to save")}}},O=(0,l.getAgentTypeIcon)(k),z=j.find(e=>e.agentType===k)?.label??k,I=P?(0,d.getModelMeta)(P).displayName||P:null,L=F?j.find(e=>e.agentType===F):null;return(0,t.jsxs)("div",{className:(0,p.cn)("flex flex-col gap-1",x),children:[(0,t.jsxs)(u.Popover,{open:b,onOpenChange:v,children:[(0,t.jsx)(u.PopoverTrigger,{asChild:!0,children:(0,t.jsx)(c.Button,{variant:"outline",role:"combobox","aria-expanded":b,disabled:(f??!1)||y,className:"w-auto cursor-pointer justify-start font-normal hover:border-violet-300 hover:bg-violet-50/50 dark:hover:border-violet-700 dark:hover:bg-violet-950/30",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 truncate",children:[(0,t.jsx)(O,{className:"h-4 w-4 shrink-0"}),y?"Loading…":(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:z}),I?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-muted-foreground/50 text-xs",children:"·"}),(0,t.jsx)("span",{className:"text-xs font-medium",children:I})]}):null]})]})})}),(0,t.jsx)(u.PopoverContent,{className:"w-(--radix-popover-trigger-width) overflow-hidden p-0",align:"start",children:(0,t.jsxs)("div",{className:"flex transition-transform duration-200 ease-in-out",style:{transform:`translateX(${1===A?"-50%":"0%"})`,width:"200%"},children:[(0,t.jsxs)("div",{className:"w-1/2 shrink-0",children:[(0,t.jsx)("div",{className:"text-muted-foreground border-b px-3 py-2 text-xs font-medium",children:"Select agent"}),j.map(e=>{let r=(0,l.getAgentTypeIcon)(e.agentType),o=k===e.agentType,i=e.models.length>0;return(0,t.jsxs)("button",{type:"button",className:(0,p.cn)("flex w-full cursor-pointer items-center gap-2.5 px-3 py-2 text-xs transition-colors","hover:bg-accent hover:text-accent-foreground",o&&"bg-accent/50"),onClick:()=>{i?(E(e.agentType),requestAnimationFrame(()=>{requestAnimationFrame(()=>D(1))})):M(e.agentType,"")},children:[(0,t.jsx)(r,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"flex-1 text-left",children:e.label}),o&&!i?(0,t.jsx)(a.Check,{className:"text-primary h-3.5 w-3.5 shrink-0"}):null,i?(0,t.jsx)(s.ChevronRight,{className:"text-muted-foreground h-3.5 w-3.5 shrink-0"}):null]},e.agentType)})]}),(0,t.jsx)("div",{className:"w-1/2 shrink-0",children:L?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{type:"button",className:"text-muted-foreground hover:text-foreground flex w-full cursor-pointer items-center gap-1.5 border-b px-3 py-2 text-xs font-medium transition-colors",onClick:()=>{D(0),setTimeout(()=>E(null),220)},children:[(0,t.jsx)(o.ChevronLeft,{className:"h-3.5 w-3.5"}),L.label]}),L.models.map(e=>{let r=k===L.agentType&&P===e.id;return(0,t.jsxs)("button",{type:"button",className:(0,p.cn)("flex w-full cursor-pointer items-center gap-3 px-3 py-2 text-left transition-colors","hover:bg-accent hover:text-accent-foreground",r&&"bg-accent/50"),onClick:()=>M(L.agentType,e.id),children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,t.jsx)("span",{className:"text-xs font-medium",children:e.displayName}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:e.description})]}),r?(0,t.jsx)(a.Check,{className:"text-primary h-3.5 w-3.5 shrink-0"}):null]},e.id)})]}):null})]})})]}),!!S&&(0,t.jsx)("p",{className:"text-destructive text-sm",children:S})]})}e.s(["AgentModelPicker",()=>h])},15203,e=>{"use strict";var t=e.i(20314),r=e.i(79054),a=e.i(31406),o=e.i(60112),s=e.i(21023);let i=(0,s.createServerReference)("40b13e06fa11567de729600e2d4c9355962d3767b1",s.callServer,void 0,s.findSourceMapURL,"createFeature");var n=e.i(16868);let l=(0,e.i(3645).default)("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);var d=e.i(97667),c=e.i(53360),u=e.i(31777),p=e.i(8361);e.i(1650);var h=e.i(11495),m=e.i(45811),f=e.i(35364),x=e.i(98127),g=e.i(48306),b=e.i(41957),v=e.i(81846),j=e.i(90382),w=e.i(51911),y=e.i(2828),C=e.i(30153);e.i(50032);var k=e.i(86254),N=e.i(41413),P=e.i(42076);let T=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg",".bmp",".ico",".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".txt",".md",".csv",".json",".yaml",".yml",".xml",".ts",".tsx",".js",".jsx",".py",".rb",".go",".rs",".java",".c",".cpp",".h",".hpp",".cs",".swift",".kt",".html",".css",".scss",".less",".sh",".bash",".zsh",".fish",".toml",".ini",".cfg",".conf",".env",".zip",".tar",".gz",".log"]),S=[{id:"allowPrd",label:"PRD",description:"Auto-approve requirements move to planning."},{id:"allowPlan",label:"Plan",description:"Auto-approve planning move to implementation."},{id:"allowMerge",label:"Merge",description:"Auto-approve merge move to Done."}],R={allowPrd:!1,allowPlan:!1,allowMerge:!1};function A({open:e,onClose:a,onSubmit:o,repositoryPath:s,isSubmitting:i=!1,workflowDefaults:l,features:d,initialParentId:x,currentAgentType:j,currentModel:A}){let F=(0,p.useSoundAction)("create"),E=l?.approvalGates??R,M=l?.push??!1,O=l?.openPr??!1,[z,I]=(0,r.useState)(""),[L,U]=(0,r.useState)([]),[B,$]=(0,r.useState)({...E}),[q,H]=(0,r.useState)(M),[G,_]=(0,r.useState)(O),[K,X]=(0,r.useState)(void 0),[V,W]=(0,r.useState)(!1),[Z,J]=(0,r.useState)(void 0),[Y,Q]=(0,r.useState)(void 0),[ee,et]=(0,r.useState)(!1),[er,ea]=(0,r.useState)(null),[eo,es]=(0,r.useState)(!1),ei=(0,r.useRef)(crypto.randomUUID()),en=(0,r.useRef)(0),el=(0,r.useRef)(null);(0,r.useEffect)(()=>{l&&($({...l.approvalGates}),H(l.push),_(l.openPr))},[l]),(0,r.useEffect)(()=>{e&&x&&X(x)},[e,x]);let ed=(0,r.useCallback)(()=>{I(""),U([]),$({...E}),H(M),_(O),X(void 0),W(!1),J(void 0),Q(void 0),ea(null),en.current=0,et(!1)},[E,M,O]),ec=""!==z.trim()||L.length>0,{attemptClose:eu}=(0,C.useGuardedDrawerClose)({open:e,isDirty:ec,onClose:a,onReset:ed}),ep=(0,r.useCallback)(async e=>{for(let t of(ea(null),e)){if(t.size>0xa00000)return void ea(`"${t.name}" exceeds 10 MB limit`);let e=function(e){let t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}(t.name);if(e&&!T.has(e))return void ea(`File type "${e}" is not allowed`)}for(let t of e){let e=crypto.randomUUID();U(r=>[...r,{id:e,name:t.name,size:t.size,mimeType:t.type||"application/octet-stream",path:"",loading:!0}]);try{let r=new FormData;r.append("file",t),r.append("sessionId",ei.current);let a=await fetch("/api/attachments/upload",{method:"POST",body:r});if(!a.ok){let t=await a.json().catch(()=>({error:"Upload failed"}));U(t=>t.filter(t=>t.id!==e)),ea(t.error??"Upload failed");return}let o=await a.json();U(t=>t.some(t=>t.id!==e&&t.path===o.path)?t.filter(t=>t.id!==e):t.map(t=>t.id===e?{...o,id:e,loading:!1}:t))}catch{U(t=>t.filter(t=>t.id!==e)),ea("Upload failed")}}},[]),eh=(0,r.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),en.current+=1,1===en.current&&et(!0)},[]),em=(0,r.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),en.current-=1,0===en.current&&et(!1)},[]),ef=(0,r.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]),ex=(0,r.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),en.current=0,et(!1);let t=Array.from(e.dataTransfer.files);t.length>0&&ep(t)},[ep]),eg=(0,r.useCallback)(e=>{let t=e.clipboardData?.items;if(!t)return;let r=[];for(let e of Array.from(t))if("file"===e.kind){let t=e.getAsFile();t&&r.push(t)}r.length>0&&(e.preventDefault(),ep(r))},[ep]),eb=(0,r.useCallback)(e=>{e.preventDefault(),z.trim()&&(F.play(),o({description:z.trim(),attachments:L.filter(e=>!e.loading),repositoryPath:s,approvalGates:{allowPrd:B.allowPrd??!1,allowPlan:B.allowPlan??!1,allowMerge:B.allowMerge??!1},push:q||G,openPr:G,fast:V,...Z?{agentType:Z}:{},...Y?{model:Y}:{},...K?{parentId:K}:{},sessionId:ei.current}),ed())},[z,L,B,s,o,q,G,V,Z,Y,K,F,ed]),ev=(0,r.useCallback)(async()=>{try{let e=await (0,P.pickFiles)();if(!e)return;for(let t of e){let e=crypto.randomUUID();U(r=>[...r,{id:e,name:t.name,size:t.size,mimeType:"application/octet-stream",path:"",loading:!0}]);try{let r=await fetch("/api/attachments/upload-from-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t.path,sessionId:ei.current})});if(!r.ok){let t=await r.json().catch(()=>({error:"Upload failed"}));U(t=>t.filter(t=>t.id!==e)),ea(t.error??"Upload failed");return}let a=await r.json();U(t=>t.some(t=>t.id!==e&&t.path===a.path)?t.filter(t=>t.id!==e):t.map(t=>t.id===e?{...a,id:e,loading:!1}:t))}catch{U(t=>t.filter(t=>t.id!==e)),ea("Upload failed")}}}catch{}},[]),ej=(0,r.useCallback)(e=>{U(t=>t.filter(t=>t.id!==e))},[]),ew=(0,r.useRef)(null),ey=(0,r.useCallback)(e=>{(e.ctrlKey||e.metaKey)&&"Enter"===e.key&&(e.preventDefault(),ew.current?.requestSubmit())},[]),eC=(0,r.useCallback)(()=>{es(!0)},[]),ek=(0,r.useCallback)(()=>{setTimeout(()=>{let e=el.current?.contains(document.activeElement),t=el.current?.querySelector('[aria-expanded="true"]')!==null;e||t||es(!1)},0)},[]),eN=d&&d.length>0;return(0,t.jsx)(h.BaseDrawer,{open:e,onClose:eu,size:"md",modal:!1,dismissOnOutsideClick:!0,"data-testid":"feature-create-drawer",header:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"h-2.5 w-2.5 shrink-0 rounded-full bg-blue-500"}),(0,t.jsx)(m.DrawerTitle,{children:"NEW FEATURE"})]}),i?(0,t.jsx)(m.DrawerDescription,{asChild:!0,children:(0,t.jsx)("div",{children:(0,t.jsx)(v.Badge,{variant:"secondary",children:"Creating..."})})}):null]}),footer:(0,t.jsxs)("div",{className:"flex flex-row justify-end gap-2",children:[(0,t.jsx)(f.Button,{variant:"outline",onClick:eu,disabled:i,children:"Cancel"}),(0,t.jsx)(f.Button,{type:"submit",form:"create-feature-form",disabled:!z.trim()||i,children:i?"Creating...":"+ Create Feature"})]}),children:(0,t.jsx)("div",{className:"overflow-y-auto p-4",children:(0,t.jsx)(y.TooltipProvider,{delayDuration:400,children:(0,t.jsxs)("form",{ref:ew,id:"create-feature-form",onSubmit:eb,className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{role:"region","aria-label":"File drop zone","data-drag-over":ee?"true":"false",onDragEnter:eh,onDragLeave:em,onDragOver:ef,onDrop:ex,className:(0,u.cn)("flex flex-col gap-1.5 rounded-md border-2 border-transparent p-1 transition-colors",ee&&"border-primary/50 bg-primary/5"),children:[(0,t.jsx)(b.Label,{htmlFor:"feature-description",className:"text-muted-foreground text-xs font-semibold tracking-wider",children:"DESCRIBE YOUR FEATURE"}),(0,t.jsxs)("div",{ref:el,onFocus:eC,onBlur:ek,className:(0,u.cn)("border-input flex h-56 flex-col overflow-hidden rounded-md border shadow-xs transition-[color,box-shadow]",eo&&"ring-ring/50 border-ring ring-[3px]"),children:[(0,t.jsx)(g.Textarea,{id:"feature-description",placeholder:"e.g. Add GitHub OAuth login with callback handling and token refresh...",value:z,onChange:e=>I(e.target.value),onKeyDown:ey,onPaste:eg,required:!0,disabled:i,className:"min-h-0 flex-1 resize-none rounded-none border-0 shadow-none focus-visible:ring-0"}),L.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-2",children:L.map(e=>(0,t.jsx)(k.AttachmentChip,{name:e.name,size:e.size,mimeType:e.mimeType,path:e.path,onRemove:()=>ej(e.id),disabled:i,loading:e.loading},e.id))}),er?(0,t.jsx)("p",{className:"text-destructive px-3 pb-2 text-xs",children:er}):null,(0,t.jsxs)("div",{className:"border-input flex items-center gap-3 border-t px-3 py-1.5",children:[(0,t.jsx)(N.AgentModelPicker,{initialAgentType:Z??j??"claude-code",initialModel:Y??A??"claude-sonnet-4-6",mode:"override",onAgentModelChange:(e,t)=>{J(e),Q(t)},disabled:i,className:"w-55"}),(0,t.jsxs)(y.Tooltip,{children:[(0,t.jsx)(y.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"ml-auto flex cursor-pointer items-center gap-2",children:[(0,t.jsx)(w.Switch,{id:"fast-mode",checked:V,onCheckedChange:W,disabled:i}),(0,t.jsxs)(b.Label,{htmlFor:"fast-mode",className:"flex cursor-pointer items-center gap-1 text-sm font-medium",children:[(0,t.jsx)(c.Zap,{className:"h-3.5 w-3.5"}),"Fast Mode"]})]})}),(0,t.jsx)(y.TooltipContent,{side:"bottom",children:"Skip SDLC phases and implement directly from your prompt."})]}),(0,t.jsxs)(y.Tooltip,{children:[(0,t.jsx)(y.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",onClick:ev,disabled:i,"aria-label":"Attach files",className:"text-muted-foreground hover:text-foreground cursor-pointer rounded p-1 transition-colors",children:(0,t.jsx)(n.PaperclipIcon,{className:"h-4 w-4"})})}),(0,t.jsx)(y.TooltipContent,{side:"bottom",children:"Attach files"})]})]})]})]}),eN&&void 0!==x?(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)(b.Label,{htmlFor:"parent-feature",className:"text-muted-foreground text-xs font-semibold tracking-wider",children:"PARENT FEATURE"}),(0,t.jsx)(D,{features:d,value:K,onChange:X,disabled:i})]}):null,(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsxs)("div",{className:"border-input flex items-center gap-4 rounded-md border px-3 py-2.5",children:[(0,t.jsxs)(y.Tooltip,{children:[(0,t.jsx)(y.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"text-muted-foreground w-16 shrink-0 cursor-default text-xs font-semibold tracking-wider",children:"APPROVE"})}),(0,t.jsx)(y.TooltipContent,{side:"bottom",children:"Auto-approve phase transitions without manual review."})]}),(0,t.jsx)("div",{className:"flex flex-1 items-center gap-4",children:S.map(e=>(0,t.jsxs)(y.Tooltip,{children:[(0,t.jsx)(y.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-1.5",children:[(0,t.jsx)(w.Switch,{id:`approve-${e.id}`,size:"sm",checked:B[e.id]??!1,onCheckedChange:t=>$(r=>({...r,[e.id]:t})),disabled:i||V&&("allowPrd"===e.id||"allowPlan"===e.id)}),(0,t.jsx)(b.Label,{htmlFor:`approve-${e.id}`,className:"cursor-pointer text-xs font-medium",children:e.label})]})}),(0,t.jsx)(y.TooltipContent,{side:"bottom",children:V&&("allowPrd"===e.id||"allowPlan"===e.id)?"Skipped in Fast Mode":e.description})]},e.id))}),(0,t.jsxs)(y.Tooltip,{children:[(0,t.jsx)(y.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",onClick:()=>{let e=S.every(e=>B[e.id]),t={};for(let r of S)t[r.id]=!e;$(t)},disabled:i,className:(0,u.cn)("text-muted-foreground hover:text-foreground cursor-pointer rounded px-1.5 py-0.5 text-[10px] font-semibold tracking-wider uppercase transition-colors",S.every(e=>B[e.id])&&"text-primary"),children:"All"})}),(0,t.jsx)(y.TooltipContent,{side:"bottom",children:"Toggle all approval gates"})]})]}),(0,t.jsxs)("div",{className:"border-input flex items-center gap-4 rounded-md border px-3 py-2.5",children:[(0,t.jsx)("span",{className:"text-muted-foreground w-16 shrink-0 text-xs font-semibold tracking-wider",children:"GIT"}),(0,t.jsxs)("div",{className:"flex flex-1 items-center gap-4",children:[(0,t.jsxs)(y.Tooltip,{children:[(0,t.jsx)(y.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-1.5",children:[(0,t.jsx)(w.Switch,{id:"push",size:"sm",checked:q||G,onCheckedChange:e=>{H(e),!e&&G&&_(!1)},disabled:i}),(0,t.jsx)(b.Label,{htmlFor:"push",className:"cursor-pointer text-xs font-medium",children:"Push"})]})}),(0,t.jsx)(y.TooltipContent,{side:"bottom",children:"Push branch to remote after implementation."})]}),(0,t.jsxs)(y.Tooltip,{children:[(0,t.jsx)(y.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-1.5",children:[(0,t.jsx)(w.Switch,{id:"open-pr",size:"sm",checked:G,onCheckedChange:_,disabled:i}),(0,t.jsx)(b.Label,{htmlFor:"open-pr",className:"cursor-pointer text-xs font-medium",children:"PR"})]})}),(0,t.jsx)(y.TooltipContent,{side:"bottom",children:"Open a pull request after pushing."})]})]})]})]})]})})})})}function D({features:e,value:a,onChange:o,disabled:s}){let[i,n]=(0,r.useState)(!1),[c,p]=(0,r.useState)(""),h=(0,r.useRef)(null),m=e.find(e=>e.id===a),f=c.trim()?e.filter(e=>e.name.toLowerCase().includes(c.toLowerCase())||e.id.toLowerCase().includes(c.toLowerCase())):e,g=(0,r.useCallback)(e=>{o(e),n(!1),p("")},[o]);return(0,r.useEffect)(()=>{i?setTimeout(()=>h.current?.focus(),0):p("")},[i]),(0,t.jsxs)(j.Popover,{open:i,onOpenChange:n,children:[(0,t.jsx)(j.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)("button",{id:"parent-feature",type:"button",role:"combobox","aria-expanded":i,"aria-label":"Parent Feature",disabled:s,"data-testid":"parent-feature-combobox",className:(0,u.cn)("border-input bg-background ring-offset-background focus:ring-ring flex h-9 w-full items-center justify-between rounded-md border px-3 py-2 text-sm focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",!m&&"text-muted-foreground"),children:[(0,t.jsx)("span",{className:"truncate",children:m?`${m.name} (${m.id.slice(0,8)})`:"Select parent feature..."}),(0,t.jsx)(l,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),(0,t.jsx)(j.PopoverContent,{className:"w-80 p-0",align:"start","data-testid":"parent-feature-combobox-content",children:(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsx)("div",{className:"border-b p-2",children:(0,t.jsx)(x.Input,{ref:h,placeholder:"Search features...",value:c,onChange:e=>p(e.target.value),className:"h-8 border-0 p-0 text-sm shadow-none focus-visible:ring-0","data-testid":"parent-feature-search"})}),(0,t.jsxs)("div",{className:"max-h-48 overflow-y-auto py-1",role:"listbox","aria-label":"Features",children:[(0,t.jsxs)("button",{type:"button",role:"option","aria-selected":void 0===a,onClick:()=>g(void 0),className:(0,u.cn)("hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 px-3 py-2 text-sm",void 0===a&&"bg-accent/50"),"data-testid":"parent-feature-option-none",children:[(0,t.jsx)(d.CheckIcon,{className:(0,u.cn)("h-4 w-4 shrink-0",void 0!==a&&"invisible")}),(0,t.jsx)("span",{className:"text-muted-foreground italic",children:"No parent"})]}),0===f.length&&c?(0,t.jsx)("p",{className:"text-muted-foreground px-3 py-2 text-sm",children:"No features found."}):f.map(e=>(0,t.jsxs)("button",{type:"button",role:"option","aria-selected":a===e.id,onClick:()=>g(e.id),className:(0,u.cn)("hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 px-3 py-2 text-sm",a===e.id&&"bg-accent/50"),"data-testid":`parent-feature-option-${e.id}`,children:[(0,t.jsx)(d.CheckIcon,{className:(0,u.cn)("h-4 w-4 shrink-0",a!==e.id&&"invisible")}),(0,t.jsxs)("span",{className:"truncate",children:[e.name," ",(0,t.jsxs)("span",{className:"text-muted-foreground font-mono text-xs",children:["(",e.id.slice(0,8),")"]})]})]},e.id))]})]})})]})}function F({repositoryPath:e,initialParentId:s,features:n,workflowDefaults:l,currentAgentType:d,currentModel:c}){let u=(0,a.useRouter)(),[p,h]=(0,r.useState)(!1),m=(0,a.usePathname)().startsWith("/create"),f=!p&&m;(0,r.useEffect)(()=>{!m&&p&&h(!1)},[m,p]);let x=(0,r.useCallback)(()=>{u.push("/")},[u]),g=(0,r.useCallback)(e=>{h(!0),u.push("/"),i(e).then(t=>{t.error?o.toast.error(t.error):window.dispatchEvent(new CustomEvent("shep:feature-created",{detail:{featureId:t.feature.id,name:t.feature.name,description:t.feature.description,repositoryPath:t.feature.repositoryPath,parentId:e.parentId}}))}).catch(()=>{o.toast.error("Failed to create feature"),h(!1)})},[u]);return(0,t.jsx)(A,{open:f,onClose:x,onSubmit:g,repositoryPath:e,features:n,workflowDefaults:l,initialParentId:s,isSubmitting:p,currentAgentType:d,currentModel:c})}e.s(["CreateDrawerClient",()=>F],15203)}]);