@shepai/cli 1.172.0-pr528.619145 → 1.172.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 (173) hide show
  1. package/dist/src/presentation/web/components/common/repo-group/repo-group.js +1 -1
  2. package/dist/tsconfig.build.tsbuildinfo +1 -1
  3. package/package.json +1 -1
  4. package/web/.next/BUILD_ID +1 -1
  5. package/web/.next/build-manifest.json +2 -2
  6. package/web/.next/fallback-build-manifest.json +2 -2
  7. package/web/.next/prerender-manifest.json +3 -3
  8. package/web/.next/required-server-files.js +3 -3
  9. package/web/.next/required-server-files.json +3 -3
  10. package/web/.next/server/app/(dashboard)/@drawer/adopt/page/server-reference-manifest.json +29 -29
  11. package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js.nft.json +1 -1
  12. package/web/.next/server/app/(dashboard)/@drawer/adopt/page_client-reference-manifest.js +1 -1
  13. package/web/.next/server/app/(dashboard)/@drawer/chat/page/server-reference-manifest.json +27 -27
  14. package/web/.next/server/app/(dashboard)/@drawer/chat/page.js.nft.json +1 -1
  15. package/web/.next/server/app/(dashboard)/@drawer/chat/page_client-reference-manifest.js +1 -1
  16. package/web/.next/server/app/(dashboard)/@drawer/create/page/server-reference-manifest.json +30 -30
  17. package/web/.next/server/app/(dashboard)/@drawer/create/page.js.nft.json +1 -1
  18. package/web/.next/server/app/(dashboard)/@drawer/create/page_client-reference-manifest.js +1 -1
  19. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/server-reference-manifest.json +38 -38
  20. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  21. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  22. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/server-reference-manifest.json +38 -38
  23. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js.nft.json +1 -1
  24. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page_client-reference-manifest.js +1 -1
  25. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page/server-reference-manifest.json +28 -28
  26. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page.js.nft.json +1 -1
  27. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page_client-reference-manifest.js +1 -1
  28. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/server-reference-manifest.json +28 -28
  29. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js.nft.json +1 -1
  30. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  31. package/web/.next/server/app/(dashboard)/chat/page/server-reference-manifest.json +27 -27
  32. package/web/.next/server/app/(dashboard)/chat/page.js.nft.json +1 -1
  33. package/web/.next/server/app/(dashboard)/chat/page_client-reference-manifest.js +1 -1
  34. package/web/.next/server/app/(dashboard)/create/page/server-reference-manifest.json +30 -30
  35. package/web/.next/server/app/(dashboard)/create/page.js.nft.json +1 -1
  36. package/web/.next/server/app/(dashboard)/create/page_client-reference-manifest.js +1 -1
  37. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/server-reference-manifest.json +38 -38
  38. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  39. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  40. package/web/.next/server/app/(dashboard)/feature/[featureId]/page/server-reference-manifest.json +38 -38
  41. package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js.nft.json +1 -1
  42. package/web/.next/server/app/(dashboard)/feature/[featureId]/page_client-reference-manifest.js +1 -1
  43. package/web/.next/server/app/(dashboard)/page/server-reference-manifest.json +27 -27
  44. package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
  45. package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
  46. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page/server-reference-manifest.json +28 -28
  47. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page.js.nft.json +1 -1
  48. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page_client-reference-manifest.js +1 -1
  49. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/server-reference-manifest.json +28 -28
  50. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js.nft.json +1 -1
  51. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  52. package/web/.next/server/app/_global-error.html +2 -2
  53. package/web/.next/server/app/_global-error.rsc +1 -1
  54. package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  55. package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  56. package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  57. package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  58. package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  59. package/web/.next/server/app/_not-found/page/server-reference-manifest.json +6 -6
  60. package/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  61. package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  62. package/web/.next/server/app/features/page/server-reference-manifest.json +6 -6
  63. package/web/.next/server/app/features/page.js.nft.json +1 -1
  64. package/web/.next/server/app/features/page_client-reference-manifest.js +1 -1
  65. package/web/.next/server/app/settings/page/server-reference-manifest.json +9 -9
  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 +13 -13
  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 +11 -11
  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 +6 -6
  75. package/web/.next/server/app/version/page.js.nft.json +1 -1
  76. package/web/.next/server/app/version/page_client-reference-manifest.js +1 -1
  77. package/web/.next/server/chunks/[root-of-the-server]__a402b567._.js +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/744ca_web_components_common_control-center-drawer_feature-drawer-client_tsx_e9755fc8._.js +2 -2
  81. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_feature-drawer-client_tsx_e9755fc8._.js.map +1 -1
  82. package/web/.next/server/chunks/ssr/[root-of-the-server]__1cd4327c._.js +1 -1
  83. package/web/.next/server/chunks/ssr/[root-of-the-server]__1cd4327c._.js.map +1 -1
  84. package/web/.next/server/chunks/ssr/[root-of-the-server]__1f389e5d._.js +1 -1
  85. package/web/.next/server/chunks/ssr/[root-of-the-server]__1f389e5d._.js.map +1 -1
  86. package/web/.next/server/chunks/ssr/[root-of-the-server]__357d99f9._.js +1 -1
  87. package/web/.next/server/chunks/ssr/[root-of-the-server]__4fb81977._.js +1 -1
  88. package/web/.next/server/chunks/ssr/[root-of-the-server]__4fb81977._.js.map +1 -1
  89. package/web/.next/server/chunks/ssr/[root-of-the-server]__6c7d3936._.js +1 -1
  90. package/web/.next/server/chunks/ssr/[root-of-the-server]__6c7d3936._.js.map +1 -1
  91. package/web/.next/server/chunks/ssr/[root-of-the-server]__7dcd0917._.js +1 -1
  92. package/web/.next/server/chunks/ssr/[root-of-the-server]__7dcd0917._.js.map +1 -1
  93. package/web/.next/server/chunks/ssr/[root-of-the-server]__92ffd5ee._.js +2 -2
  94. package/web/.next/server/chunks/ssr/[root-of-the-server]__92ffd5ee._.js.map +1 -1
  95. package/web/.next/server/chunks/ssr/[root-of-the-server]__b020c17d._.js +2 -2
  96. package/web/.next/server/chunks/ssr/[root-of-the-server]__b020c17d._.js.map +1 -1
  97. package/web/.next/server/chunks/ssr/[root-of-the-server]__b7b96453._.js +1 -1
  98. package/web/.next/server/chunks/ssr/[root-of-the-server]__b7b96453._.js.map +1 -1
  99. package/web/.next/server/chunks/ssr/[root-of-the-server]__ba7f5873._.js +1 -1
  100. package/web/.next/server/chunks/ssr/[root-of-the-server]__ba7f5873._.js.map +1 -1
  101. package/web/.next/server/chunks/ssr/[root-of-the-server]__c5e09f6f._.js +1 -1
  102. package/web/.next/server/chunks/ssr/[root-of-the-server]__c5e09f6f._.js.map +1 -1
  103. package/web/.next/server/chunks/ssr/_02e01240._.js +1 -1
  104. package/web/.next/server/chunks/ssr/_02e01240._.js.map +1 -1
  105. package/web/.next/server/chunks/ssr/_05c23ad9._.js +1 -1
  106. package/web/.next/server/chunks/ssr/_05c23ad9._.js.map +1 -1
  107. package/web/.next/server/chunks/ssr/_16eb4fec._.js +1 -1
  108. package/web/.next/server/chunks/ssr/_16eb4fec._.js.map +1 -1
  109. package/web/.next/server/chunks/ssr/_18886033._.js +1 -1
  110. package/web/.next/server/chunks/ssr/_18886033._.js.map +1 -1
  111. package/web/.next/server/chunks/ssr/_22e00a14._.js +1 -1
  112. package/web/.next/server/chunks/ssr/_22e00a14._.js.map +1 -1
  113. package/web/.next/server/chunks/ssr/{_39147808._.js → _40918326._.js} +2 -2
  114. package/web/.next/server/chunks/ssr/{_39147808._.js.map → _40918326._.js.map} +1 -1
  115. package/web/.next/server/chunks/ssr/_4cbb7f95._.js +1 -1
  116. package/web/.next/server/chunks/ssr/_4cbb7f95._.js.map +1 -1
  117. package/web/.next/server/chunks/ssr/_56b9d60f._.js +1 -1
  118. package/web/.next/server/chunks/ssr/_56b9d60f._.js.map +1 -1
  119. package/web/.next/server/chunks/ssr/{_3cfb4ce1._.js → _7b946eeb._.js} +2 -2
  120. package/web/.next/server/chunks/ssr/{_3cfb4ce1._.js.map → _7b946eeb._.js.map} +1 -1
  121. package/web/.next/server/chunks/ssr/{_8e3828d3._.js → _890fafe7._.js} +2 -2
  122. package/web/.next/server/chunks/ssr/{_8e3828d3._.js.map → _890fafe7._.js.map} +1 -1
  123. package/web/.next/server/chunks/ssr/_a5a5901d._.js +1 -1
  124. package/web/.next/server/chunks/ssr/_a5a5901d._.js.map +1 -1
  125. package/web/.next/server/chunks/ssr/_ad09f271._.js +1 -1
  126. package/web/.next/server/chunks/ssr/_ad09f271._.js.map +1 -1
  127. package/web/.next/server/chunks/ssr/_c3f595c6._.js +1 -1
  128. package/web/.next/server/chunks/ssr/_c3f595c6._.js.map +1 -1
  129. package/web/.next/server/chunks/ssr/_df737cce._.js +1 -1
  130. package/web/.next/server/chunks/ssr/_ea9e1556._.js +1 -1
  131. package/web/.next/server/chunks/ssr/_ea9e1556._.js.map +1 -1
  132. package/web/.next/server/chunks/ssr/_f1ba9be6._.js +2 -2
  133. package/web/.next/server/chunks/ssr/_f1ba9be6._.js.map +1 -1
  134. package/web/.next/server/chunks/ssr/_f33cd07e._.js +2 -2
  135. package/web/.next/server/chunks/ssr/_f33cd07e._.js.map +1 -1
  136. package/web/.next/server/chunks/ssr/_f8b45233._.js +1 -1
  137. package/web/.next/server/chunks/ssr/_f8b45233._.js.map +1 -1
  138. package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js +1 -1
  139. package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js.map +1 -1
  140. package/web/.next/server/chunks/ssr/f3a1f_components_common_control-center-drawer_repository-drawer-client_tsx_39a00c03._.js +1 -1
  141. package/web/.next/server/chunks/ssr/f3a1f_components_common_control-center-drawer_repository-drawer-client_tsx_39a00c03._.js.map +1 -1
  142. package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_open-ide_ts_baaca5d5._.js +1 -1
  143. package/web/.next/server/chunks/ssr/src_presentation_web_components_895e5bfa._.js +1 -1
  144. package/web/.next/server/chunks/ssr/src_presentation_web_components_895e5bfa._.js.map +1 -1
  145. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js +1 -1
  146. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js.map +1 -1
  147. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_skills_8a174cac._.js +1 -1
  148. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_skills_8a174cac._.js.map +1 -1
  149. package/web/.next/server/pages/500.html +2 -2
  150. package/web/.next/server/server-reference-manifest.js +1 -1
  151. package/web/.next/server/server-reference-manifest.json +50 -50
  152. package/web/.next/static/chunks/{ae79dcb88796c551.js → 2a17ddad9b7638db.js} +1 -1
  153. package/web/.next/static/chunks/3506d521396f9164.js +1 -0
  154. package/web/.next/static/chunks/{5ea512f99e0640fe.js → 43c9aeed1753dd81.js} +1 -1
  155. package/web/.next/static/chunks/{d51a12d63fb56be7.js → 49e9841d15fa664f.js} +1 -1
  156. package/web/.next/static/chunks/4cb1df635716be2b.js +1 -0
  157. package/web/.next/static/chunks/{de69c00721590908.js → 712d96368dc18c1e.js} +1 -1
  158. package/web/.next/static/chunks/{beb5358e4841c286.js → 785b2df10318bd60.js} +2 -2
  159. package/web/.next/static/chunks/{49f2125c4881efbc.js → a6bc96e6d5328505.js} +1 -1
  160. package/web/.next/static/chunks/{724db95300328e0d.js → a92d22657e3e6700.js} +1 -1
  161. package/web/.next/static/chunks/b14085e99b88e7f7.css +1 -0
  162. package/web/.next/static/chunks/{79363cfd15eac50d.js → b2f98efed01ed1e3.js} +1 -1
  163. package/web/.next/static/chunks/{64f42c465e85ae70.js → c055ce9033cd57d7.js} +3 -3
  164. package/web/.next/static/chunks/{539b4b3ff91bd762.js → c139f0b8a7f76f12.js} +1 -1
  165. package/web/.next/static/chunks/{ab32ef049942210e.js → cde2742a766567a2.js} +1 -1
  166. package/web/.next/static/chunks/{8c1e3f6dbbbb59e7.js → e343129b58522131.js} +1 -1
  167. package/web/.next/static/chunks/{3dbdf0c81a29f5a5.js → ee2e17b69eb559f8.js} +1 -1
  168. package/web/.next/static/chunks/109f58becff0eaa2.js +0 -1
  169. package/web/.next/static/chunks/4d53de52318846f4.js +0 -1
  170. package/web/.next/static/chunks/dcf8bb4389557a76.css +0 -1
  171. /package/web/.next/static/{Gv_GqdT_QwPhH-8wWF2nQ → zsdHmcbky5vsmzUX-NSIh}/_buildManifest.js +0 -0
  172. /package/web/.next/static/{Gv_GqdT_QwPhH-8wWF2nQ → zsdHmcbky5vsmzUX-NSIh}/_clientMiddlewareManifest.json +0 -0
  173. /package/web/.next/static/{Gv_GqdT_QwPhH-8wWF2nQ → zsdHmcbky5vsmzUX-NSIh}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,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])},41413,e=>{"use strict";var t=e.i(20314),s=e.i(79054),r=e.i(23925),i=e.i(11345),n=e.i(76016),a=e.i(82538),o=e.i(43275),l=e.i(86782),u=e.i(29847),c=e.i(35364),h=e.i(90382),d=e.i(31777);function p({initialAgentType:e,initialModel:p,agentType:f,model:m,onAgentModelChange:y,onSave:v,saveError:b,saving:g,disabled:x,className:w,mode:S}){let[j,T]=s.useState(!1),[R,k]=s.useState([]),[C,O]=s.useState(!0),[I,E]=s.useState(f??e),[F,M]=s.useState(m??p),[Q,N]=s.useState(!1),[D,P]=s.useState(null),[U,A]=s.useState(0),[q,L]=s.useState(null);s.useEffect(()=>{(0,a.getAllAgentModels)().then(k).finally(()=>O(!1))},[]),s.useEffect(()=>{E(f??e)},[f,e]),s.useEffect(()=>{M(m??p)},[m,p]);let H=s.useRef(j);s.useEffect(()=>{let e=H.current;if(H.current=j,e&&!j){let e=setTimeout(()=>{A(0),L(null)},150);return()=>clearTimeout(e)}},[j]);let K=async(e,t)=>{if(T(!1),e===I&&t===F)return;if(P(null),"override"===S){E(e),M(t),y?.(e,t);return}let s=v??(async(e,t)=>(0,o.updateAgentAndModel)(e,t||null));N(!0);try{let r=await s(e,t);if(r&&"ok"in r&&!r.ok)return void P(r.error??"Failed to save");E(e),M(t),y?.(e,t)}catch{P("Failed to save")}finally{N(!1)}},z=b??D,B=(0,l.getAgentTypeIcon)(I),_=R.find(e=>e.agentType===I)?.label??I,V=F?(0,u.getModelMeta)(F).displayName||F:null,G=q?R.find(e=>e.agentType===q):null;return(0,t.jsxs)("div",{className:(0,d.cn)("flex flex-col gap-1",w),children:[(0,t.jsxs)(h.Popover,{open:j,onOpenChange:T,children:[(0,t.jsx)(h.PopoverTrigger,{asChild:!0,children:(0,t.jsx)(c.Button,{type:"button",variant:"outline",role:"combobox","aria-expanded":j,disabled:(x??!1)||C||(g??!1)||Q,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)(B,{className:"h-4 w-4 shrink-0"}),C?"Loading…":(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:_}),V?(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:V})]}):null]})]})})}),(0,t.jsx)(h.PopoverContent,{className:"z-[70] 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===U?"-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"}),R.map(e=>{let s=(0,l.getAgentTypeIcon)(e.agentType),i=I===e.agentType,a=e.models.length>0;return(0,t.jsxs)("button",{type:"button",className:(0,d.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",i&&"bg-accent/50"),onClick:()=>{a?(L(e.agentType),requestAnimationFrame(()=>{requestAnimationFrame(()=>A(1))})):K(e.agentType,"")},children:[(0,t.jsx)(s,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"flex-1 text-start",children:e.label}),i&&!a?(0,t.jsx)(r.Check,{className:"text-primary h-3.5 w-3.5 shrink-0"}):null,a?(0,t.jsx)(n.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:G?(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:()=>{A(0),setTimeout(()=>L(null),220)},children:[(0,t.jsx)(i.ChevronLeft,{className:"h-3.5 w-3.5"}),G.label]}),G.models.map(e=>{let s=I===G.agentType&&F===e.id;return(0,t.jsxs)("button",{type:"button",className:(0,d.cn)("flex w-full cursor-pointer items-center gap-3 px-3 py-2 text-start transition-colors","hover:bg-accent hover:text-accent-foreground",s&&"bg-accent/50"),onClick:()=>K(G.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})]}),s?(0,t.jsx)(r.Check,{className:"text-primary h-3.5 w-3.5 shrink-0"}):null]},e.id)})]}):null})]})})]}),!!z&&(0,t.jsx)("p",{className:"text-destructive text-sm",children:z})]})}e.s(["AgentModelPicker",()=>p])},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])},43698,e=>{"use strict";let t=(0,e.i(3645).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(["default",()=>t])},64764,80436,17087,e=>{"use strict";var t=e.i(15506);e.s(["Loader2Icon",()=>t.default],64764);var s=e.i(95230);e.s(["DownloadIcon",()=>s.default],80436);let r=(0,e.i(3645).default)("sticky-note",[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",key:"1dfntj"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5",key:"6s6qgf"}]]);e.s(["StickyNoteIcon",()=>r],17087)},48306,e=>{"use strict";var t=e.i(20314),s=e.i(31777);function r({className:e,...r}){return(0,t.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),...r})}e.s(["Textarea",()=>r])},28267,57484,e=>{"use strict";var t=e.i(1693);e.s(["VisuallyHidden",0,t],28267);let s=(0,e.i(3645).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"}]]);e.s(["FileIcon",()=>s],57484)},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])},50032,86254,e=>{"use strict";var t=e.i(20314),s=e.i(60253),r=e.i(64764),i=e.i(80436),n=e.i(17087),a=e.i(31777),o=e.i(2287),l=e.i(48306),u=e.i(2828),c=e.i(28267),h=e.i(57484),d=e.i(16298),d=d;let p=(0,e.i(3645).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 f=e.i(93752),f=f;e.i(35364);let m=new Set([".png",".jpg",".jpeg",".gif",".svg",".webp",".ico",".bmp"]),y=new Set([".ts",".tsx",".js",".jsx",".json",".yaml",".yml",".xml",".html",".css",".md"]);function v(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 g(e,t){let s=new URLSearchParams({path:e,mimeType:t});return`/api/attachments/preview?${s.toString()}`}function x({name:e,size:x,mimeType:w,path:S,onRemove:j,loading:T=!1,disabled:R=!1,notes:k,onNotesChange:C}){let O,I,E=(O=e.lastIndexOf("."))>=0?e.slice(O).toLowerCase():"",F=m.has(E)?p:".pdf"===E?d.default:y.has(E)?f.default:h.FileIcon,M=".pdf"===E?"bg-red-50 text-red-600":m.has(E)?"bg-blue-50 text-blue-600":y.has(E)?"bg-emerald-50 text-emerald-600":"bg-gray-50 text-gray-600",Q=(I=e.lastIndexOf("."))>=0&&b.has(e.slice(I).toLowerCase());if(T)return(0,t.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-md border",children:(0,t.jsx)(r.Loader2Icon,{className:"text-muted-foreground h-5 w-5 animate-spin"})});if(Q){let r=(0,t.jsxs)("button",{type:"button",className:"relative block cursor-pointer rounded-md",children:[(0,t.jsx)("img",{src:g(S,w),alt:e,title:e,className:"h-12 w-12 rounded-md border object-cover transition-opacity hover:opacity-80"}),k?(0,t.jsx)("span",{className:"ring-background absolute -right-1 -bottom-1 flex h-4 w-4 items-center justify-center rounded-full bg-amber-500 text-white shadow-sm ring-2",children:(0,t.jsx)(n.StickyNoteIcon,{className:"h-2.5 w-2.5"})}):null]});return(0,t.jsx)(u.TooltipProvider,{delayDuration:200,children:(0,t.jsxs)(o.Dialog,{children:[(0,t.jsxs)(u.Tooltip,{children:[(0,t.jsxs)("div",{className:"group relative",children:[(0,t.jsx)(u.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(o.DialogTrigger,{asChild:!0,children:r})}),!R&&(0,t.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,t.jsx)(s.X,{className:"h-3 w-3"})})]}),k?(0,t.jsx)(u.TooltipContent,{side:"bottom",className:"max-w-[220px] border border-amber-200 bg-amber-50 text-amber-950 dark:border-amber-800 dark:bg-amber-950 dark:text-amber-100",children:(0,t.jsx)("p",{className:"line-clamp-3 text-xs leading-snug",children:k})}):null]}),(0,t.jsxs)(o.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,t.jsx)(c.VisuallyHidden.Root,{children:(0,t.jsxs)(o.DialogTitle,{children:["Preview: ",e]})}),(0,t.jsx)("div",{className:"relative bg-black/90",children:(0,t.jsx)("img",{src:g(S,w),alt:e,className:"h-auto max-h-[70vh] w-full object-contain"})}),(0,t.jsxs)("div",{className:"bg-background flex flex-col gap-2 px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,t.jsx)("span",{className:"truncate text-sm font-medium",children:e}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:v(x)})]}),(0,t.jsx)("a",{href:g(S,w),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,t.jsx)(i.DownloadIcon,{className:"h-4 w-4"})})]}),C?(0,t.jsx)(l.Textarea,{placeholder:"Add notes about this image…",value:k??"",onChange:e=>C(e.target.value),rows:2,className:"resize-none text-sm","aria-label":"Image notes"}):k?(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:k}):null]})]})]})})}return(0,t.jsxs)("div",{className:"group relative flex items-center gap-2 rounded-full border py-1 ps-2 pe-3",children:[(0,t.jsx)("div",{className:(0,a.cn)("flex h-6 w-6 shrink-0 items-center justify-center rounded-full",M),children:(0,t.jsx)(F,{className:"h-3 w-3"})}),(0,t.jsx)("span",{className:"max-w-[120px] truncate text-sm",children:e}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:v(x)}),!R&&(0,t.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,t.jsx)(s.X,{className:"h-3 w-3"})})]})}e.s(["AttachmentChip",()=>x],86254),e.s([],50032)},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)},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)},67669,e=>{"use strict";let t=(0,e.i(3645).default)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);e.s(["Trash2",()=>t],67669)},94365,e=>{"use strict";let t=(0,e.i(3645).default)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);e.s(["User",()=>t],94365)},4520,77501,e=>{"use strict";var t=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};e.s(["Subscribable",()=>t],77501);var s=new class extends t{#e;#t;#s;constructor(){super(),this.#s=e=>{if("u">typeof window&&window.addEventListener){let t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#s=e,this.#t?.(),this.#t=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#e?this.#e:globalThis.document?.visibilityState!=="hidden"}};e.s(["focusManager",()=>s],4520)},3,68911,e=>{"use strict";e.i(44172);var t={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},s=new class{#r=t;#i=!1;setTimeoutProvider(e){this.#r=e}setTimeout(e,t){return this.#r.setTimeout(e,t)}clearTimeout(e){this.#r.clearTimeout(e)}setInterval(e,t){return this.#r.setInterval(e,t)}clearInterval(e){this.#r.clearInterval(e)}};function r(e){setTimeout(e,0)}e.s(["systemSetTimeoutZero",()=>r,"timeoutManager",()=>s],68911);var i="u"<typeof window||"Deno"in globalThis;function n(){}function a(e,t){return"function"==typeof e?e(t):e}function o(e){return"number"==typeof e&&e>=0&&e!==1/0}function l(e,t){return Math.max(e+(t||0)-Date.now(),0)}function u(e,t){return"function"==typeof e?e(t):e}function c(e,t){return"function"==typeof e?e(t):e}function h(e,t){let{type:s="all",exact:r,fetchStatus:i,predicate:n,queryKey:a,stale:o}=e;if(a){if(r){if(t.queryHash!==p(a,t.options))return!1}else if(!m(t.queryKey,a))return!1}if("all"!==s){let e=t.isActive();if("active"===s&&!e||"inactive"===s&&e)return!1}return("boolean"!=typeof o||t.isStale()===o)&&(!i||i===t.state.fetchStatus)&&(!n||!!n(t))}function d(e,t){let{exact:s,status:r,predicate:i,mutationKey:n}=e;if(n){if(!t.options.mutationKey)return!1;if(s){if(f(t.options.mutationKey)!==f(n))return!1}else if(!m(t.options.mutationKey,n))return!1}return(!r||t.state.status===r)&&(!i||!!i(t))}function p(e,t){return(t?.queryKeyHashFn||f)(e)}function f(e){return JSON.stringify(e,(e,t)=>g(t)?Object.keys(t).sort().reduce((e,s)=>(e[s]=t[s],e),{}):t)}function m(e,t){return e===t||typeof e==typeof t&&!!e&&!!t&&"object"==typeof e&&"object"==typeof t&&Object.keys(t).every(s=>m(e[s],t[s]))}var y=Object.prototype.hasOwnProperty;function v(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let s in e)if(e[s]!==t[s])return!1;return!0}function b(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function g(e){if(!x(e))return!1;let t=e.constructor;if(void 0===t)return!0;let s=t.prototype;return!!x(s)&&!!s.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function x(e){return"[object Object]"===Object.prototype.toString.call(e)}function w(e){return new Promise(t=>{s.setTimeout(t,e)})}function S(e,t,s){return"function"==typeof s.structuralSharing?s.structuralSharing(e,t):!1!==s.structuralSharing?function e(t,s,r=0){if(t===s)return t;if(r>500)return s;let i=b(t)&&b(s);if(!i&&!(g(t)&&g(s)))return s;let n=(i?t:Object.keys(t)).length,a=i?s:Object.keys(s),o=a.length,l=i?Array(o):{},u=0;for(let c=0;c<o;c++){let o=i?c:a[c],h=t[o],d=s[o];if(h===d){l[o]=h,(i?c<n:y.call(t,o))&&u++;continue}if(null===h||null===d||"object"!=typeof h||"object"!=typeof d){l[o]=d;continue}let p=e(h,d,r+1);l[o]=p,p===h&&u++}return n===o&&u===n?t:l}(e,t):t}function j(e,t,s=0){let r=[...e,t];return s&&r.length>s?r.slice(1):r}function T(e,t,s=0){let r=[t,...e];return s&&r.length>s?r.slice(0,-1):r}var R=Symbol();function k(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==R?e.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`))}function C(e,t){return"function"==typeof e?e(...t):!!e}function O(e,t,s){let r,i=!1;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(r??=t(),i||(i=!0,r.aborted?s():r.addEventListener("abort",s,{once:!0})),r)}),e}e.s(["addConsumeAwareSignal",()=>O,"addToEnd",()=>j,"addToStart",()=>T,"ensureQueryFn",()=>k,"functionalUpdate",()=>a,"hashKey",()=>f,"hashQueryKeyByOptions",()=>p,"isServer",()=>i,"isValidTimeout",()=>o,"matchMutation",()=>d,"matchQuery",()=>h,"noop",()=>n,"partialMatchKey",()=>m,"replaceData",()=>S,"resolveEnabled",()=>c,"resolveStaleTime",()=>u,"shallowEqualObjects",()=>v,"shouldThrowError",()=>C,"skipToken",()=>R,"sleep",()=>w,"timeUntilStale",()=>l],3)},65617,e=>{"use strict";let t;var s=e.i(3),r=(t=()=>s.isServer,{isServer:()=>t(),setIsServer(e){t=e}});e.s(["environmentManager",()=>r])},6786,e=>{"use strict";let t,s,r,i,n,a;var o=e.i(68911).systemSetTimeoutZero,l=(t=[],s=0,r=e=>{e()},i=e=>{e()},n=o,{batch:e=>{let a;s++;try{a=e()}finally{let e;--s||(e=t,t=[],e.length&&n(()=>{i(()=>{e.forEach(e=>{r(e)})})}))}return a},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a=e=>{s?t.push(e):n(()=>{r(e)})},setNotifyFunction:e=>{r=e},setBatchNotifyFunction:e=>{i=e},setScheduler:e=>{n=e}});e.s(["notifyManager",()=>l])},13598,20820,e=>{"use strict";var t=e.i(77501),s=new class extends t.Subscribable{#n=!0;#t;#s;constructor(){super(),this.#s=e=>{if("u">typeof window&&window.addEventListener){let t=()=>e(!0),s=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",s)}}}}onSubscribe(){this.#t||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#s=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#n!==e&&(this.#n=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#n}};function r(){let e,t,s=new Promise((s,r)=>{e=s,t=r});function r(e){Object.assign(s,e),delete s.resolve,delete s.reject}return s.status="pending",s.catch(()=>{}),s.resolve=t=>{r({status:"fulfilled",value:t}),e(t)},s.reject=e=>{r({status:"rejected",reason:e}),t(e)},s}e.s(["onlineManager",()=>s],13598),e.i(3),e.s(["pendingThenable",()=>r],20820)},28574,20979,19644,34682,e=>{"use strict";e.i(44172);var t=e.i(3),s=e.i(6786),r=e.i(4520),i=e.i(13598),n=e.i(20820),a=e.i(65617);function o(e){return Math.min(1e3*2**e,3e4)}function l(e){return(e??"online")!=="online"||i.onlineManager.isOnline()}var u=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function c(e){let s,c=!1,h=0,d=(0,n.pendingThenable)(),p=()=>r.focusManager.isFocused()&&("always"===e.networkMode||i.onlineManager.isOnline())&&e.canRun(),f=()=>l(e.networkMode)&&e.canRun(),m=e=>{"pending"===d.status&&(s?.(),d.resolve(e))},y=e=>{"pending"===d.status&&(s?.(),d.reject(e))},v=()=>new Promise(t=>{s=e=>{("pending"!==d.status||p())&&t(e)},e.onPause?.()}).then(()=>{s=void 0,"pending"===d.status&&e.onContinue?.()}),b=()=>{let s;if("pending"!==d.status)return;let r=0===h?e.initialPromise:void 0;try{s=r??e.fn()}catch(e){s=Promise.reject(e)}Promise.resolve(s).then(m).catch(s=>{if("pending"!==d.status)return;let r=e.retry??3*!a.environmentManager.isServer(),i=e.retryDelay??o,n="function"==typeof i?i(h,s):i,l=!0===r||"number"==typeof r&&h<r||"function"==typeof r&&r(h,s);c||!l?y(s):(h++,e.onFail?.(h,s),(0,t.sleep)(n).then(()=>p()?void 0:v()).then(()=>{c?y(s):b()}))})};return{promise:d,status:()=>d.status,cancel:t=>{if("pending"===d.status){let s=new u(t);y(s),e.onCancel?.(s)}},continue:()=>(s?.(),d),cancelRetry:()=>{c=!0},continueRetry:()=>{c=!1},canStart:f,start:()=>(f()?b():v().then(b),d)}}e.s(["CancelledError",()=>u,"canFetch",()=>l,"createRetryer",()=>c],20979);var h=e.i(68911),d=class{#a;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),(0,t.isValidTimeout)(this.gcTime)&&(this.#a=h.timeoutManager.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(a.environmentManager.isServer()?1/0:3e5))}clearGcTimeout(){this.#a&&(h.timeoutManager.clearTimeout(this.#a),this.#a=void 0)}};e.s(["Removable",()=>d],19644);var p=class extends d{#o;#l;#u;#c;#h;#d;#p;constructor(e){super(),this.#p=!1,this.#d=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#c=e.client,this.#u=this.#c.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#o=y(this.options),this.state=e.state??this.#o,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#h?.promise}setOptions(e){if(this.options={...this.#d,...e},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){let e=y(this.options);void 0!==e.data&&(this.setState(m(e.data,e.dataUpdatedAt)),this.#o=e)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#u.remove(this)}setData(e,s){let r=(0,t.replaceData)(this.state.data,e,this.options);return this.#f({data:r,type:"success",dataUpdatedAt:s?.updatedAt,manual:s?.manual}),r}setState(e,t){this.#f({type:"setState",state:e,setStateOptions:t})}cancel(e){let s=this.#h?.promise;return this.#h?.cancel(e),s?s.then(t.noop).catch(t.noop):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#o}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>!1!==(0,t.resolveEnabled)(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===t.skipToken||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===(0,t.resolveStaleTime)(e.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(e=0){return void 0===this.state.data||"static"!==e&&(!!this.state.isInvalidated||!(0,t.timeUntilStale)(this.state.dataUpdatedAt,e))}onFocus(){let e=this.observers.find(e=>e.shouldFetchOnWindowFocus());e?.refetch({cancelRefetch:!1}),this.#h?.continue()}onOnline(){let e=this.observers.find(e=>e.shouldFetchOnReconnect());e?.refetch({cancelRefetch:!1}),this.#h?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#u.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#h&&(this.#p||this.#m()?this.#h.cancel({revert:!0}):this.#h.cancelRetry()),this.scheduleGc()),this.#u.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}#m(){return"paused"===this.state.fetchStatus&&"pending"===this.state.status}invalidate(){this.state.isInvalidated||this.#f({type:"invalidate"})}async fetch(e,s){let r;if("idle"!==this.state.fetchStatus&&this.#h?.status()!=="rejected"){if(void 0!==this.state.data&&s?.cancelRefetch)this.cancel({silent:!0});else if(this.#h)return this.#h.continueRetry(),this.#h.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let i=new AbortController,n=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#p=!0,i.signal)})},a=()=>{let e,r=(0,t.ensureQueryFn)(this.options,s),i=(n(e={client:this.#c,queryKey:this.queryKey,meta:this.meta}),e);return(this.#p=!1,this.options.persister)?this.options.persister(r,i,this):r(i)},o=(n(r={fetchOptions:s,options:this.options,queryKey:this.queryKey,client:this.#c,state:this.state,fetchFn:a}),r);this.options.behavior?.onFetch(o,this),this.#l=this.state,("idle"===this.state.fetchStatus||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#f({type:"fetch",meta:o.fetchOptions?.meta}),this.#h=c({initialPromise:s?.initialPromise,fn:o.fetchFn,onCancel:e=>{e instanceof u&&e.revert&&this.setState({...this.#l,fetchStatus:"idle"}),i.abort()},onFail:(e,t)=>{this.#f({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#f({type:"pause"})},onContinue:()=>{this.#f({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{let e=await this.#h.start();if(void 0===e)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#u.config.onSuccess?.(e,this),this.#u.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof u){if(e.silent)return this.#h.promise;else if(e.revert){if(void 0===this.state.data)throw e;return this.state.data}}throw this.#f({type:"error",error:e}),this.#u.config.onError?.(e,this),this.#u.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#f(e){let t=t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...f(t.data,this.options),fetchMeta:e.meta??null};case"success":let s={...t,...m(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#l=e.manual?s:void 0,s;case"error":let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}};this.state=t(this.state),s.notifyManager.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#u.notify({query:this,type:"updated",action:e})})}};function f(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:l(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}function m(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function y(e){let t="function"==typeof e.initialData?e.initialData():e.initialData,s=void 0!==t,r=s?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:s?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}e.s(["Query",()=>p,"fetchState",()=>f],28574);var v=e.i(79054),b=e.i(20314),g=v.createContext(void 0),x=e=>{let t=v.useContext(g);if(e)return e;if(!t)throw Error("No QueryClient set, use QueryClientProvider to set one");return t},w=({client:e,children:t})=>(v.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,b.jsx)(g.Provider,{value:e,children:t}));e.s(["QueryClientProvider",()=>w,"useQueryClient",()=>x],34682)},62885,e=>{"use strict";let t;var s=e.i(4520),r=e.i(65617),i=e.i(6786),n=e.i(28574),a=e.i(77501),o=e.i(20820),l=e.i(3),u=e.i(68911),c=class extends a.Subscribable{constructor(e,t){super(),this.options=t,this.#c=e,this.#y=null,this.#v=(0,o.pendingThenable)(),this.bindMethods(),this.setOptions(t)}#c;#b=void 0;#g=void 0;#x=void 0;#w;#S;#v;#y;#j;#T;#R;#k;#C;#O;#I=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#b.addObserver(this),h(this.#b,this.options)?this.#E():this.updateResult(),this.#F())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return d(this.#b,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return d(this.#b,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#M(),this.#Q(),this.#b.removeObserver(this)}setOptions(e){let t=this.options,s=this.#b;if(this.options=this.#c.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof(0,l.resolveEnabled)(this.options.enabled,this.#b))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#N(),this.#b.setOptions(this.options),t._defaulted&&!(0,l.shallowEqualObjects)(this.options,t)&&this.#c.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#b,observer:this});let r=this.hasListeners();r&&p(this.#b,s,this.options,t)&&this.#E(),this.updateResult(),r&&(this.#b!==s||(0,l.resolveEnabled)(this.options.enabled,this.#b)!==(0,l.resolveEnabled)(t.enabled,this.#b)||(0,l.resolveStaleTime)(this.options.staleTime,this.#b)!==(0,l.resolveStaleTime)(t.staleTime,this.#b))&&this.#D();let i=this.#P();r&&(this.#b!==s||(0,l.resolveEnabled)(this.options.enabled,this.#b)!==(0,l.resolveEnabled)(t.enabled,this.#b)||i!==this.#O)&&this.#U(i)}getOptimisticResult(e){var t,s;let r=this.#c.getQueryCache().build(this.#c,e),i=this.createResult(r,e);return t=this,s=i,(0,l.shallowEqualObjects)(t.getCurrentResult(),s)||(this.#x=i,this.#S=this.options,this.#w=this.#b.state),i}getCurrentResult(){return this.#x}trackResult(e,t){return new Proxy(e,{get:(e,s)=>(this.trackProp(s),t?.(s),"promise"===s&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#v.status||this.#v.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,s))})}trackProp(e){this.#I.add(e)}getCurrentQuery(){return this.#b}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#c.defaultQueryOptions(e),s=this.#c.getQueryCache().build(this.#c,t);return s.fetch().then(()=>this.createResult(s,t))}fetch(e){return this.#E({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#x))}#E(e){this.#N();let t=this.#b.fetch(this.options,e);return e?.throwOnError||(t=t.catch(l.noop)),t}#D(){this.#M();let e=(0,l.resolveStaleTime)(this.options.staleTime,this.#b);if(r.environmentManager.isServer()||this.#x.isStale||!(0,l.isValidTimeout)(e))return;let t=(0,l.timeUntilStale)(this.#x.dataUpdatedAt,e);this.#k=u.timeoutManager.setTimeout(()=>{this.#x.isStale||this.updateResult()},t+1)}#P(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#b):this.options.refetchInterval)??!1}#U(e){this.#Q(),this.#O=e,!r.environmentManager.isServer()&&!1!==(0,l.resolveEnabled)(this.options.enabled,this.#b)&&(0,l.isValidTimeout)(this.#O)&&0!==this.#O&&(this.#C=u.timeoutManager.setInterval(()=>{(this.options.refetchIntervalInBackground||s.focusManager.isFocused())&&this.#E()},this.#O))}#F(){this.#D(),this.#U(this.#P())}#M(){this.#k&&(u.timeoutManager.clearTimeout(this.#k),this.#k=void 0)}#Q(){this.#C&&(u.timeoutManager.clearInterval(this.#C),this.#C=void 0)}createResult(e,t){let s,r=this.#b,i=this.options,a=this.#x,u=this.#w,c=this.#S,d=e!==r?e.state:this.#g,{state:m}=e,y={...m},v=!1;if(t._optimisticResults){let s=this.hasListeners(),a=!s&&h(e,t),o=s&&p(e,r,t,i);(a||o)&&(y={...y,...(0,n.fetchState)(m.data,e.options)}),"isRestoring"===t._optimisticResults&&(y.fetchStatus="idle")}let{error:b,errorUpdatedAt:g,status:x}=y;s=y.data;let w=!1;if(void 0!==t.placeholderData&&void 0===s&&"pending"===x){let e;a?.isPlaceholderData&&t.placeholderData===c?.placeholderData?(e=a.data,w=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#R?.state.data,this.#R):t.placeholderData,void 0!==e&&(x="success",s=(0,l.replaceData)(a?.data,e,t),v=!0)}if(t.select&&void 0!==s&&!w)if(a&&s===u?.data&&t.select===this.#j)s=this.#T;else try{this.#j=t.select,s=t.select(s),s=(0,l.replaceData)(a?.data,s,t),this.#T=s,this.#y=null}catch(e){this.#y=e}this.#y&&(b=this.#y,s=this.#T,g=Date.now(),x="error");let S="fetching"===y.fetchStatus,j="pending"===x,T="error"===x,R=j&&S,k=void 0!==s,C={status:x,fetchStatus:y.fetchStatus,isPending:j,isSuccess:"success"===x,isError:T,isInitialLoading:R,isLoading:R,data:s,dataUpdatedAt:y.dataUpdatedAt,error:b,errorUpdatedAt:g,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:y.dataUpdateCount>d.dataUpdateCount||y.errorUpdateCount>d.errorUpdateCount,isFetching:S,isRefetching:S&&!j,isLoadingError:T&&!k,isPaused:"paused"===y.fetchStatus,isPlaceholderData:v,isRefetchError:T&&k,isStale:f(e,t),refetch:this.refetch,promise:this.#v,isEnabled:!1!==(0,l.resolveEnabled)(t.enabled,e)};if(this.options.experimental_prefetchInRender){let t=void 0!==C.data,s="error"===C.status&&!t,i=e=>{s?e.reject(C.error):t&&e.resolve(C.data)},n=()=>{i(this.#v=C.promise=(0,o.pendingThenable)())},a=this.#v;switch(a.status){case"pending":e.queryHash===r.queryHash&&i(a);break;case"fulfilled":(s||C.data!==a.value)&&n();break;case"rejected":s&&C.error===a.reason||n()}}return C}updateResult(){let e=this.#x,t=this.createResult(this.#b,this.options);if(this.#w=this.#b.state,this.#S=this.options,void 0!==this.#w.data&&(this.#R=this.#b),(0,l.shallowEqualObjects)(t,e))return;this.#x=t;let s=()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,s="function"==typeof t?t():t;if("all"===s||!s&&!this.#I.size)return!0;let r=new Set(s??this.#I);return this.options.throwOnError&&r.add("error"),Object.keys(this.#x).some(t=>this.#x[t]!==e[t]&&r.has(t))};this.#A({listeners:s()})}#N(){let e=this.#c.getQueryCache().build(this.#c,this.options);if(e===this.#b)return;let t=this.#b;this.#b=e,this.#g=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#F()}#A(e){i.notifyManager.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#x)}),this.#c.getQueryCache().notify({query:this.#b,type:"observerResultsUpdated"})})}};function h(e,t){return!1!==(0,l.resolveEnabled)(t.enabled,e)&&void 0===e.state.data&&("error"!==e.state.status||!1!==t.retryOnMount)||void 0!==e.state.data&&d(e,t,t.refetchOnMount)}function d(e,t,s){if(!1!==(0,l.resolveEnabled)(t.enabled,e)&&"static"!==(0,l.resolveStaleTime)(t.staleTime,e)){let r="function"==typeof s?s(e):s;return"always"===r||!1!==r&&f(e,t)}return!1}function p(e,t,s,r){return(e!==t||!1===(0,l.resolveEnabled)(r.enabled,e))&&(!s.suspense||"error"!==e.state.status)&&f(e,s)}function f(e,t){return!1!==(0,l.resolveEnabled)(t.enabled,e)&&e.isStaleByTime((0,l.resolveStaleTime)(t.staleTime,e))}e.i(44172);var m=e.i(79054),y=e.i(34682);e.i(20314);var v=m.createContext((t=!1,{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t})),b=m.createContext(!1);b.Provider;var g=(e,t,s)=>t.fetchOptimistic(e).catch(()=>{s.clearReset()});function x(e,t){return function(e,t,s){let n,a=m.useContext(b),o=m.useContext(v),u=(0,y.useQueryClient)(s),c=u.defaultQueryOptions(e);u.getDefaultOptions().queries?._experimental_beforeQuery?.(c);let h=u.getQueryCache().get(c.queryHash);if(c._optimisticResults=a?"isRestoring":"optimistic",c.suspense){let e=e=>"static"===e?e:Math.max(e??1e3,1e3),t=c.staleTime;c.staleTime="function"==typeof t?(...s)=>e(t(...s)):e(t),"number"==typeof c.gcTime&&(c.gcTime=Math.max(c.gcTime,1e3))}n=h?.state.error&&"function"==typeof c.throwOnError?(0,l.shouldThrowError)(c.throwOnError,[h.state.error,h]):c.throwOnError,(c.suspense||c.experimental_prefetchInRender||n)&&!o.isReset()&&(c.retryOnMount=!1),m.useEffect(()=>{o.clearReset()},[o]);let d=!u.getQueryCache().get(c.queryHash),[p]=m.useState(()=>new t(u,c)),f=p.getOptimisticResult(c),x=!a&&!1!==e.subscribed;if(m.useSyncExternalStore(m.useCallback(e=>{let t=x?p.subscribe(i.notifyManager.batchCalls(e)):l.noop;return p.updateResult(),t},[p,x]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),m.useEffect(()=>{p.setOptions(c)},[c,p]),c?.suspense&&f.isPending)throw g(c,p,o);if((({result:e,errorResetBoundary:t,throwOnError:s,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&void 0===e.data||(0,l.shouldThrowError)(s,[e.error,r])))({result:f,errorResetBoundary:o,throwOnError:c.throwOnError,query:h,suspense:c.suspense}))throw f.error;if(u.getDefaultOptions().queries?._experimental_afterQuery?.(c,f),c.experimental_prefetchInRender&&!r.environmentManager.isServer()&&f.isLoading&&f.isFetching&&!a){let e=d?g(c,p,o):h?.promise;e?.catch(l.noop).finally(()=>{p.updateResult()})}return c.notifyOnChangeProps?f:p.trackResult(f)}(e,c,t)}e.s(["useQuery",()=>x],62885)}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,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])},41413,e=>{"use strict";var t=e.i(20314),s=e.i(79054),r=e.i(23925),i=e.i(11345),n=e.i(76016),a=e.i(99175),o=e.i(44138),l=e.i(86782),u=e.i(29847),c=e.i(35364),h=e.i(90382),d=e.i(31777);function p({initialAgentType:e,initialModel:p,agentType:f,model:m,onAgentModelChange:y,onSave:v,saveError:b,saving:g,disabled:x,className:w,mode:S}){let[j,T]=s.useState(!1),[R,k]=s.useState([]),[C,O]=s.useState(!0),[I,E]=s.useState(f??e),[F,M]=s.useState(m??p),[Q,N]=s.useState(!1),[D,P]=s.useState(null),[U,A]=s.useState(0),[q,L]=s.useState(null);s.useEffect(()=>{(0,a.getAllAgentModels)().then(k).finally(()=>O(!1))},[]),s.useEffect(()=>{E(f??e)},[f,e]),s.useEffect(()=>{M(m??p)},[m,p]);let H=s.useRef(j);s.useEffect(()=>{let e=H.current;if(H.current=j,e&&!j){let e=setTimeout(()=>{A(0),L(null)},150);return()=>clearTimeout(e)}},[j]);let K=async(e,t)=>{if(T(!1),e===I&&t===F)return;if(P(null),"override"===S){E(e),M(t),y?.(e,t);return}let s=v??(async(e,t)=>(0,o.updateAgentAndModel)(e,t||null));N(!0);try{let r=await s(e,t);if(r&&"ok"in r&&!r.ok)return void P(r.error??"Failed to save");E(e),M(t),y?.(e,t)}catch{P("Failed to save")}finally{N(!1)}},z=b??D,B=(0,l.getAgentTypeIcon)(I),_=R.find(e=>e.agentType===I)?.label??I,V=F?(0,u.getModelMeta)(F).displayName||F:null,G=q?R.find(e=>e.agentType===q):null;return(0,t.jsxs)("div",{className:(0,d.cn)("flex flex-col gap-1",w),children:[(0,t.jsxs)(h.Popover,{open:j,onOpenChange:T,children:[(0,t.jsx)(h.PopoverTrigger,{asChild:!0,children:(0,t.jsx)(c.Button,{type:"button",variant:"outline",role:"combobox","aria-expanded":j,disabled:(x??!1)||C||(g??!1)||Q,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)(B,{className:"h-4 w-4 shrink-0"}),C?"Loading…":(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:_}),V?(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:V})]}):null]})]})})}),(0,t.jsx)(h.PopoverContent,{className:"z-[70] 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===U?"-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"}),R.map(e=>{let s=(0,l.getAgentTypeIcon)(e.agentType),i=I===e.agentType,a=e.models.length>0;return(0,t.jsxs)("button",{type:"button",className:(0,d.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",i&&"bg-accent/50"),onClick:()=>{a?(L(e.agentType),requestAnimationFrame(()=>{requestAnimationFrame(()=>A(1))})):K(e.agentType,"")},children:[(0,t.jsx)(s,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"flex-1 text-start",children:e.label}),i&&!a?(0,t.jsx)(r.Check,{className:"text-primary h-3.5 w-3.5 shrink-0"}):null,a?(0,t.jsx)(n.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:G?(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:()=>{A(0),setTimeout(()=>L(null),220)},children:[(0,t.jsx)(i.ChevronLeft,{className:"h-3.5 w-3.5"}),G.label]}),G.models.map(e=>{let s=I===G.agentType&&F===e.id;return(0,t.jsxs)("button",{type:"button",className:(0,d.cn)("flex w-full cursor-pointer items-center gap-3 px-3 py-2 text-start transition-colors","hover:bg-accent hover:text-accent-foreground",s&&"bg-accent/50"),onClick:()=>K(G.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})]}),s?(0,t.jsx)(r.Check,{className:"text-primary h-3.5 w-3.5 shrink-0"}):null]},e.id)})]}):null})]})})]}),!!z&&(0,t.jsx)("p",{className:"text-destructive text-sm",children:z})]})}e.s(["AgentModelPicker",()=>p])},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])},43698,e=>{"use strict";let t=(0,e.i(3645).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(["default",()=>t])},64764,80436,17087,e=>{"use strict";var t=e.i(15506);e.s(["Loader2Icon",()=>t.default],64764);var s=e.i(95230);e.s(["DownloadIcon",()=>s.default],80436);let r=(0,e.i(3645).default)("sticky-note",[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",key:"1dfntj"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5",key:"6s6qgf"}]]);e.s(["StickyNoteIcon",()=>r],17087)},48306,e=>{"use strict";var t=e.i(20314),s=e.i(31777);function r({className:e,...r}){return(0,t.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),...r})}e.s(["Textarea",()=>r])},28267,57484,e=>{"use strict";var t=e.i(1693);e.s(["VisuallyHidden",0,t],28267);let s=(0,e.i(3645).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"}]]);e.s(["FileIcon",()=>s],57484)},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])},50032,86254,e=>{"use strict";var t=e.i(20314),s=e.i(60253),r=e.i(64764),i=e.i(80436),n=e.i(17087),a=e.i(31777),o=e.i(2287),l=e.i(48306),u=e.i(2828),c=e.i(28267),h=e.i(57484),d=e.i(16298),d=d;let p=(0,e.i(3645).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 f=e.i(93752),f=f;e.i(35364);let m=new Set([".png",".jpg",".jpeg",".gif",".svg",".webp",".ico",".bmp"]),y=new Set([".ts",".tsx",".js",".jsx",".json",".yaml",".yml",".xml",".html",".css",".md"]);function v(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 g(e,t){let s=new URLSearchParams({path:e,mimeType:t});return`/api/attachments/preview?${s.toString()}`}function x({name:e,size:x,mimeType:w,path:S,onRemove:j,loading:T=!1,disabled:R=!1,notes:k,onNotesChange:C}){let O,I,E=(O=e.lastIndexOf("."))>=0?e.slice(O).toLowerCase():"",F=m.has(E)?p:".pdf"===E?d.default:y.has(E)?f.default:h.FileIcon,M=".pdf"===E?"bg-red-50 text-red-600":m.has(E)?"bg-blue-50 text-blue-600":y.has(E)?"bg-emerald-50 text-emerald-600":"bg-gray-50 text-gray-600",Q=(I=e.lastIndexOf("."))>=0&&b.has(e.slice(I).toLowerCase());if(T)return(0,t.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-md border",children:(0,t.jsx)(r.Loader2Icon,{className:"text-muted-foreground h-5 w-5 animate-spin"})});if(Q){let r=(0,t.jsxs)("button",{type:"button",className:"relative block cursor-pointer rounded-md",children:[(0,t.jsx)("img",{src:g(S,w),alt:e,title:e,className:"h-12 w-12 rounded-md border object-cover transition-opacity hover:opacity-80"}),k?(0,t.jsx)("span",{className:"ring-background absolute -right-1 -bottom-1 flex h-4 w-4 items-center justify-center rounded-full bg-amber-500 text-white shadow-sm ring-2",children:(0,t.jsx)(n.StickyNoteIcon,{className:"h-2.5 w-2.5"})}):null]});return(0,t.jsx)(u.TooltipProvider,{delayDuration:200,children:(0,t.jsxs)(o.Dialog,{children:[(0,t.jsxs)(u.Tooltip,{children:[(0,t.jsxs)("div",{className:"group relative",children:[(0,t.jsx)(u.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(o.DialogTrigger,{asChild:!0,children:r})}),!R&&(0,t.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,t.jsx)(s.X,{className:"h-3 w-3"})})]}),k?(0,t.jsx)(u.TooltipContent,{side:"bottom",className:"max-w-[220px] border border-amber-200 bg-amber-50 text-amber-950 dark:border-amber-800 dark:bg-amber-950 dark:text-amber-100",children:(0,t.jsx)("p",{className:"line-clamp-3 text-xs leading-snug",children:k})}):null]}),(0,t.jsxs)(o.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,t.jsx)(c.VisuallyHidden.Root,{children:(0,t.jsxs)(o.DialogTitle,{children:["Preview: ",e]})}),(0,t.jsx)("div",{className:"relative bg-black/90",children:(0,t.jsx)("img",{src:g(S,w),alt:e,className:"h-auto max-h-[70vh] w-full object-contain"})}),(0,t.jsxs)("div",{className:"bg-background flex flex-col gap-2 px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,t.jsx)("span",{className:"truncate text-sm font-medium",children:e}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:v(x)})]}),(0,t.jsx)("a",{href:g(S,w),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,t.jsx)(i.DownloadIcon,{className:"h-4 w-4"})})]}),C?(0,t.jsx)(l.Textarea,{placeholder:"Add notes about this image…",value:k??"",onChange:e=>C(e.target.value),rows:2,className:"resize-none text-sm","aria-label":"Image notes"}):k?(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:k}):null]})]})]})})}return(0,t.jsxs)("div",{className:"group relative flex items-center gap-2 rounded-full border py-1 ps-2 pe-3",children:[(0,t.jsx)("div",{className:(0,a.cn)("flex h-6 w-6 shrink-0 items-center justify-center rounded-full",M),children:(0,t.jsx)(F,{className:"h-3 w-3"})}),(0,t.jsx)("span",{className:"max-w-[120px] truncate text-sm",children:e}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:v(x)}),!R&&(0,t.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,t.jsx)(s.X,{className:"h-3 w-3"})})]})}e.s(["AttachmentChip",()=>x],86254),e.s([],50032)},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)},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)},67669,e=>{"use strict";let t=(0,e.i(3645).default)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);e.s(["Trash2",()=>t],67669)},94365,e=>{"use strict";let t=(0,e.i(3645).default)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);e.s(["User",()=>t],94365)},4520,77501,e=>{"use strict";var t=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};e.s(["Subscribable",()=>t],77501);var s=new class extends t{#e;#t;#s;constructor(){super(),this.#s=e=>{if("u">typeof window&&window.addEventListener){let t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#s=e,this.#t?.(),this.#t=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#e?this.#e:globalThis.document?.visibilityState!=="hidden"}};e.s(["focusManager",()=>s],4520)},3,68911,e=>{"use strict";e.i(44172);var t={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},s=new class{#r=t;#i=!1;setTimeoutProvider(e){this.#r=e}setTimeout(e,t){return this.#r.setTimeout(e,t)}clearTimeout(e){this.#r.clearTimeout(e)}setInterval(e,t){return this.#r.setInterval(e,t)}clearInterval(e){this.#r.clearInterval(e)}};function r(e){setTimeout(e,0)}e.s(["systemSetTimeoutZero",()=>r,"timeoutManager",()=>s],68911);var i="u"<typeof window||"Deno"in globalThis;function n(){}function a(e,t){return"function"==typeof e?e(t):e}function o(e){return"number"==typeof e&&e>=0&&e!==1/0}function l(e,t){return Math.max(e+(t||0)-Date.now(),0)}function u(e,t){return"function"==typeof e?e(t):e}function c(e,t){return"function"==typeof e?e(t):e}function h(e,t){let{type:s="all",exact:r,fetchStatus:i,predicate:n,queryKey:a,stale:o}=e;if(a){if(r){if(t.queryHash!==p(a,t.options))return!1}else if(!m(t.queryKey,a))return!1}if("all"!==s){let e=t.isActive();if("active"===s&&!e||"inactive"===s&&e)return!1}return("boolean"!=typeof o||t.isStale()===o)&&(!i||i===t.state.fetchStatus)&&(!n||!!n(t))}function d(e,t){let{exact:s,status:r,predicate:i,mutationKey:n}=e;if(n){if(!t.options.mutationKey)return!1;if(s){if(f(t.options.mutationKey)!==f(n))return!1}else if(!m(t.options.mutationKey,n))return!1}return(!r||t.state.status===r)&&(!i||!!i(t))}function p(e,t){return(t?.queryKeyHashFn||f)(e)}function f(e){return JSON.stringify(e,(e,t)=>g(t)?Object.keys(t).sort().reduce((e,s)=>(e[s]=t[s],e),{}):t)}function m(e,t){return e===t||typeof e==typeof t&&!!e&&!!t&&"object"==typeof e&&"object"==typeof t&&Object.keys(t).every(s=>m(e[s],t[s]))}var y=Object.prototype.hasOwnProperty;function v(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let s in e)if(e[s]!==t[s])return!1;return!0}function b(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function g(e){if(!x(e))return!1;let t=e.constructor;if(void 0===t)return!0;let s=t.prototype;return!!x(s)&&!!s.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function x(e){return"[object Object]"===Object.prototype.toString.call(e)}function w(e){return new Promise(t=>{s.setTimeout(t,e)})}function S(e,t,s){return"function"==typeof s.structuralSharing?s.structuralSharing(e,t):!1!==s.structuralSharing?function e(t,s,r=0){if(t===s)return t;if(r>500)return s;let i=b(t)&&b(s);if(!i&&!(g(t)&&g(s)))return s;let n=(i?t:Object.keys(t)).length,a=i?s:Object.keys(s),o=a.length,l=i?Array(o):{},u=0;for(let c=0;c<o;c++){let o=i?c:a[c],h=t[o],d=s[o];if(h===d){l[o]=h,(i?c<n:y.call(t,o))&&u++;continue}if(null===h||null===d||"object"!=typeof h||"object"!=typeof d){l[o]=d;continue}let p=e(h,d,r+1);l[o]=p,p===h&&u++}return n===o&&u===n?t:l}(e,t):t}function j(e,t,s=0){let r=[...e,t];return s&&r.length>s?r.slice(1):r}function T(e,t,s=0){let r=[t,...e];return s&&r.length>s?r.slice(0,-1):r}var R=Symbol();function k(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==R?e.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`))}function C(e,t){return"function"==typeof e?e(...t):!!e}function O(e,t,s){let r,i=!1;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(r??=t(),i||(i=!0,r.aborted?s():r.addEventListener("abort",s,{once:!0})),r)}),e}e.s(["addConsumeAwareSignal",()=>O,"addToEnd",()=>j,"addToStart",()=>T,"ensureQueryFn",()=>k,"functionalUpdate",()=>a,"hashKey",()=>f,"hashQueryKeyByOptions",()=>p,"isServer",()=>i,"isValidTimeout",()=>o,"matchMutation",()=>d,"matchQuery",()=>h,"noop",()=>n,"partialMatchKey",()=>m,"replaceData",()=>S,"resolveEnabled",()=>c,"resolveStaleTime",()=>u,"shallowEqualObjects",()=>v,"shouldThrowError",()=>C,"skipToken",()=>R,"sleep",()=>w,"timeUntilStale",()=>l],3)},65617,e=>{"use strict";let t;var s=e.i(3),r=(t=()=>s.isServer,{isServer:()=>t(),setIsServer(e){t=e}});e.s(["environmentManager",()=>r])},6786,e=>{"use strict";let t,s,r,i,n,a;var o=e.i(68911).systemSetTimeoutZero,l=(t=[],s=0,r=e=>{e()},i=e=>{e()},n=o,{batch:e=>{let a;s++;try{a=e()}finally{let e;--s||(e=t,t=[],e.length&&n(()=>{i(()=>{e.forEach(e=>{r(e)})})}))}return a},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a=e=>{s?t.push(e):n(()=>{r(e)})},setNotifyFunction:e=>{r=e},setBatchNotifyFunction:e=>{i=e},setScheduler:e=>{n=e}});e.s(["notifyManager",()=>l])},13598,20820,e=>{"use strict";var t=e.i(77501),s=new class extends t.Subscribable{#n=!0;#t;#s;constructor(){super(),this.#s=e=>{if("u">typeof window&&window.addEventListener){let t=()=>e(!0),s=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",s)}}}}onSubscribe(){this.#t||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#s=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#n!==e&&(this.#n=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#n}};function r(){let e,t,s=new Promise((s,r)=>{e=s,t=r});function r(e){Object.assign(s,e),delete s.resolve,delete s.reject}return s.status="pending",s.catch(()=>{}),s.resolve=t=>{r({status:"fulfilled",value:t}),e(t)},s.reject=e=>{r({status:"rejected",reason:e}),t(e)},s}e.s(["onlineManager",()=>s],13598),e.i(3),e.s(["pendingThenable",()=>r],20820)},28574,20979,19644,34682,e=>{"use strict";e.i(44172);var t=e.i(3),s=e.i(6786),r=e.i(4520),i=e.i(13598),n=e.i(20820),a=e.i(65617);function o(e){return Math.min(1e3*2**e,3e4)}function l(e){return(e??"online")!=="online"||i.onlineManager.isOnline()}var u=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function c(e){let s,c=!1,h=0,d=(0,n.pendingThenable)(),p=()=>r.focusManager.isFocused()&&("always"===e.networkMode||i.onlineManager.isOnline())&&e.canRun(),f=()=>l(e.networkMode)&&e.canRun(),m=e=>{"pending"===d.status&&(s?.(),d.resolve(e))},y=e=>{"pending"===d.status&&(s?.(),d.reject(e))},v=()=>new Promise(t=>{s=e=>{("pending"!==d.status||p())&&t(e)},e.onPause?.()}).then(()=>{s=void 0,"pending"===d.status&&e.onContinue?.()}),b=()=>{let s;if("pending"!==d.status)return;let r=0===h?e.initialPromise:void 0;try{s=r??e.fn()}catch(e){s=Promise.reject(e)}Promise.resolve(s).then(m).catch(s=>{if("pending"!==d.status)return;let r=e.retry??3*!a.environmentManager.isServer(),i=e.retryDelay??o,n="function"==typeof i?i(h,s):i,l=!0===r||"number"==typeof r&&h<r||"function"==typeof r&&r(h,s);c||!l?y(s):(h++,e.onFail?.(h,s),(0,t.sleep)(n).then(()=>p()?void 0:v()).then(()=>{c?y(s):b()}))})};return{promise:d,status:()=>d.status,cancel:t=>{if("pending"===d.status){let s=new u(t);y(s),e.onCancel?.(s)}},continue:()=>(s?.(),d),cancelRetry:()=>{c=!0},continueRetry:()=>{c=!1},canStart:f,start:()=>(f()?b():v().then(b),d)}}e.s(["CancelledError",()=>u,"canFetch",()=>l,"createRetryer",()=>c],20979);var h=e.i(68911),d=class{#a;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),(0,t.isValidTimeout)(this.gcTime)&&(this.#a=h.timeoutManager.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(a.environmentManager.isServer()?1/0:3e5))}clearGcTimeout(){this.#a&&(h.timeoutManager.clearTimeout(this.#a),this.#a=void 0)}};e.s(["Removable",()=>d],19644);var p=class extends d{#o;#l;#u;#c;#h;#d;#p;constructor(e){super(),this.#p=!1,this.#d=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#c=e.client,this.#u=this.#c.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#o=y(this.options),this.state=e.state??this.#o,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#h?.promise}setOptions(e){if(this.options={...this.#d,...e},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){let e=y(this.options);void 0!==e.data&&(this.setState(m(e.data,e.dataUpdatedAt)),this.#o=e)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#u.remove(this)}setData(e,s){let r=(0,t.replaceData)(this.state.data,e,this.options);return this.#f({data:r,type:"success",dataUpdatedAt:s?.updatedAt,manual:s?.manual}),r}setState(e,t){this.#f({type:"setState",state:e,setStateOptions:t})}cancel(e){let s=this.#h?.promise;return this.#h?.cancel(e),s?s.then(t.noop).catch(t.noop):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#o}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>!1!==(0,t.resolveEnabled)(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===t.skipToken||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===(0,t.resolveStaleTime)(e.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(e=0){return void 0===this.state.data||"static"!==e&&(!!this.state.isInvalidated||!(0,t.timeUntilStale)(this.state.dataUpdatedAt,e))}onFocus(){let e=this.observers.find(e=>e.shouldFetchOnWindowFocus());e?.refetch({cancelRefetch:!1}),this.#h?.continue()}onOnline(){let e=this.observers.find(e=>e.shouldFetchOnReconnect());e?.refetch({cancelRefetch:!1}),this.#h?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#u.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#h&&(this.#p||this.#m()?this.#h.cancel({revert:!0}):this.#h.cancelRetry()),this.scheduleGc()),this.#u.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}#m(){return"paused"===this.state.fetchStatus&&"pending"===this.state.status}invalidate(){this.state.isInvalidated||this.#f({type:"invalidate"})}async fetch(e,s){let r;if("idle"!==this.state.fetchStatus&&this.#h?.status()!=="rejected"){if(void 0!==this.state.data&&s?.cancelRefetch)this.cancel({silent:!0});else if(this.#h)return this.#h.continueRetry(),this.#h.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let i=new AbortController,n=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#p=!0,i.signal)})},a=()=>{let e,r=(0,t.ensureQueryFn)(this.options,s),i=(n(e={client:this.#c,queryKey:this.queryKey,meta:this.meta}),e);return(this.#p=!1,this.options.persister)?this.options.persister(r,i,this):r(i)},o=(n(r={fetchOptions:s,options:this.options,queryKey:this.queryKey,client:this.#c,state:this.state,fetchFn:a}),r);this.options.behavior?.onFetch(o,this),this.#l=this.state,("idle"===this.state.fetchStatus||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#f({type:"fetch",meta:o.fetchOptions?.meta}),this.#h=c({initialPromise:s?.initialPromise,fn:o.fetchFn,onCancel:e=>{e instanceof u&&e.revert&&this.setState({...this.#l,fetchStatus:"idle"}),i.abort()},onFail:(e,t)=>{this.#f({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#f({type:"pause"})},onContinue:()=>{this.#f({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{let e=await this.#h.start();if(void 0===e)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#u.config.onSuccess?.(e,this),this.#u.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof u){if(e.silent)return this.#h.promise;else if(e.revert){if(void 0===this.state.data)throw e;return this.state.data}}throw this.#f({type:"error",error:e}),this.#u.config.onError?.(e,this),this.#u.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#f(e){let t=t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...f(t.data,this.options),fetchMeta:e.meta??null};case"success":let s={...t,...m(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#l=e.manual?s:void 0,s;case"error":let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}};this.state=t(this.state),s.notifyManager.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#u.notify({query:this,type:"updated",action:e})})}};function f(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:l(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}function m(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function y(e){let t="function"==typeof e.initialData?e.initialData():e.initialData,s=void 0!==t,r=s?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:s?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}e.s(["Query",()=>p,"fetchState",()=>f],28574);var v=e.i(79054),b=e.i(20314),g=v.createContext(void 0),x=e=>{let t=v.useContext(g);if(e)return e;if(!t)throw Error("No QueryClient set, use QueryClientProvider to set one");return t},w=({client:e,children:t})=>(v.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,b.jsx)(g.Provider,{value:e,children:t}));e.s(["QueryClientProvider",()=>w,"useQueryClient",()=>x],34682)},62885,e=>{"use strict";let t;var s=e.i(4520),r=e.i(65617),i=e.i(6786),n=e.i(28574),a=e.i(77501),o=e.i(20820),l=e.i(3),u=e.i(68911),c=class extends a.Subscribable{constructor(e,t){super(),this.options=t,this.#c=e,this.#y=null,this.#v=(0,o.pendingThenable)(),this.bindMethods(),this.setOptions(t)}#c;#b=void 0;#g=void 0;#x=void 0;#w;#S;#v;#y;#j;#T;#R;#k;#C;#O;#I=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#b.addObserver(this),h(this.#b,this.options)?this.#E():this.updateResult(),this.#F())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return d(this.#b,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return d(this.#b,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#M(),this.#Q(),this.#b.removeObserver(this)}setOptions(e){let t=this.options,s=this.#b;if(this.options=this.#c.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof(0,l.resolveEnabled)(this.options.enabled,this.#b))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#N(),this.#b.setOptions(this.options),t._defaulted&&!(0,l.shallowEqualObjects)(this.options,t)&&this.#c.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#b,observer:this});let r=this.hasListeners();r&&p(this.#b,s,this.options,t)&&this.#E(),this.updateResult(),r&&(this.#b!==s||(0,l.resolveEnabled)(this.options.enabled,this.#b)!==(0,l.resolveEnabled)(t.enabled,this.#b)||(0,l.resolveStaleTime)(this.options.staleTime,this.#b)!==(0,l.resolveStaleTime)(t.staleTime,this.#b))&&this.#D();let i=this.#P();r&&(this.#b!==s||(0,l.resolveEnabled)(this.options.enabled,this.#b)!==(0,l.resolveEnabled)(t.enabled,this.#b)||i!==this.#O)&&this.#U(i)}getOptimisticResult(e){var t,s;let r=this.#c.getQueryCache().build(this.#c,e),i=this.createResult(r,e);return t=this,s=i,(0,l.shallowEqualObjects)(t.getCurrentResult(),s)||(this.#x=i,this.#S=this.options,this.#w=this.#b.state),i}getCurrentResult(){return this.#x}trackResult(e,t){return new Proxy(e,{get:(e,s)=>(this.trackProp(s),t?.(s),"promise"===s&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#v.status||this.#v.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,s))})}trackProp(e){this.#I.add(e)}getCurrentQuery(){return this.#b}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#c.defaultQueryOptions(e),s=this.#c.getQueryCache().build(this.#c,t);return s.fetch().then(()=>this.createResult(s,t))}fetch(e){return this.#E({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#x))}#E(e){this.#N();let t=this.#b.fetch(this.options,e);return e?.throwOnError||(t=t.catch(l.noop)),t}#D(){this.#M();let e=(0,l.resolveStaleTime)(this.options.staleTime,this.#b);if(r.environmentManager.isServer()||this.#x.isStale||!(0,l.isValidTimeout)(e))return;let t=(0,l.timeUntilStale)(this.#x.dataUpdatedAt,e);this.#k=u.timeoutManager.setTimeout(()=>{this.#x.isStale||this.updateResult()},t+1)}#P(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#b):this.options.refetchInterval)??!1}#U(e){this.#Q(),this.#O=e,!r.environmentManager.isServer()&&!1!==(0,l.resolveEnabled)(this.options.enabled,this.#b)&&(0,l.isValidTimeout)(this.#O)&&0!==this.#O&&(this.#C=u.timeoutManager.setInterval(()=>{(this.options.refetchIntervalInBackground||s.focusManager.isFocused())&&this.#E()},this.#O))}#F(){this.#D(),this.#U(this.#P())}#M(){this.#k&&(u.timeoutManager.clearTimeout(this.#k),this.#k=void 0)}#Q(){this.#C&&(u.timeoutManager.clearInterval(this.#C),this.#C=void 0)}createResult(e,t){let s,r=this.#b,i=this.options,a=this.#x,u=this.#w,c=this.#S,d=e!==r?e.state:this.#g,{state:m}=e,y={...m},v=!1;if(t._optimisticResults){let s=this.hasListeners(),a=!s&&h(e,t),o=s&&p(e,r,t,i);(a||o)&&(y={...y,...(0,n.fetchState)(m.data,e.options)}),"isRestoring"===t._optimisticResults&&(y.fetchStatus="idle")}let{error:b,errorUpdatedAt:g,status:x}=y;s=y.data;let w=!1;if(void 0!==t.placeholderData&&void 0===s&&"pending"===x){let e;a?.isPlaceholderData&&t.placeholderData===c?.placeholderData?(e=a.data,w=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#R?.state.data,this.#R):t.placeholderData,void 0!==e&&(x="success",s=(0,l.replaceData)(a?.data,e,t),v=!0)}if(t.select&&void 0!==s&&!w)if(a&&s===u?.data&&t.select===this.#j)s=this.#T;else try{this.#j=t.select,s=t.select(s),s=(0,l.replaceData)(a?.data,s,t),this.#T=s,this.#y=null}catch(e){this.#y=e}this.#y&&(b=this.#y,s=this.#T,g=Date.now(),x="error");let S="fetching"===y.fetchStatus,j="pending"===x,T="error"===x,R=j&&S,k=void 0!==s,C={status:x,fetchStatus:y.fetchStatus,isPending:j,isSuccess:"success"===x,isError:T,isInitialLoading:R,isLoading:R,data:s,dataUpdatedAt:y.dataUpdatedAt,error:b,errorUpdatedAt:g,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:y.dataUpdateCount>d.dataUpdateCount||y.errorUpdateCount>d.errorUpdateCount,isFetching:S,isRefetching:S&&!j,isLoadingError:T&&!k,isPaused:"paused"===y.fetchStatus,isPlaceholderData:v,isRefetchError:T&&k,isStale:f(e,t),refetch:this.refetch,promise:this.#v,isEnabled:!1!==(0,l.resolveEnabled)(t.enabled,e)};if(this.options.experimental_prefetchInRender){let t=void 0!==C.data,s="error"===C.status&&!t,i=e=>{s?e.reject(C.error):t&&e.resolve(C.data)},n=()=>{i(this.#v=C.promise=(0,o.pendingThenable)())},a=this.#v;switch(a.status){case"pending":e.queryHash===r.queryHash&&i(a);break;case"fulfilled":(s||C.data!==a.value)&&n();break;case"rejected":s&&C.error===a.reason||n()}}return C}updateResult(){let e=this.#x,t=this.createResult(this.#b,this.options);if(this.#w=this.#b.state,this.#S=this.options,void 0!==this.#w.data&&(this.#R=this.#b),(0,l.shallowEqualObjects)(t,e))return;this.#x=t;let s=()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,s="function"==typeof t?t():t;if("all"===s||!s&&!this.#I.size)return!0;let r=new Set(s??this.#I);return this.options.throwOnError&&r.add("error"),Object.keys(this.#x).some(t=>this.#x[t]!==e[t]&&r.has(t))};this.#A({listeners:s()})}#N(){let e=this.#c.getQueryCache().build(this.#c,this.options);if(e===this.#b)return;let t=this.#b;this.#b=e,this.#g=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#F()}#A(e){i.notifyManager.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#x)}),this.#c.getQueryCache().notify({query:this.#b,type:"observerResultsUpdated"})})}};function h(e,t){return!1!==(0,l.resolveEnabled)(t.enabled,e)&&void 0===e.state.data&&("error"!==e.state.status||!1!==t.retryOnMount)||void 0!==e.state.data&&d(e,t,t.refetchOnMount)}function d(e,t,s){if(!1!==(0,l.resolveEnabled)(t.enabled,e)&&"static"!==(0,l.resolveStaleTime)(t.staleTime,e)){let r="function"==typeof s?s(e):s;return"always"===r||!1!==r&&f(e,t)}return!1}function p(e,t,s,r){return(e!==t||!1===(0,l.resolveEnabled)(r.enabled,e))&&(!s.suspense||"error"!==e.state.status)&&f(e,s)}function f(e,t){return!1!==(0,l.resolveEnabled)(t.enabled,e)&&e.isStaleByTime((0,l.resolveStaleTime)(t.staleTime,e))}e.i(44172);var m=e.i(79054),y=e.i(34682);e.i(20314);var v=m.createContext((t=!1,{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t})),b=m.createContext(!1);b.Provider;var g=(e,t,s)=>t.fetchOptimistic(e).catch(()=>{s.clearReset()});function x(e,t){return function(e,t,s){let n,a=m.useContext(b),o=m.useContext(v),u=(0,y.useQueryClient)(s),c=u.defaultQueryOptions(e);u.getDefaultOptions().queries?._experimental_beforeQuery?.(c);let h=u.getQueryCache().get(c.queryHash);if(c._optimisticResults=a?"isRestoring":"optimistic",c.suspense){let e=e=>"static"===e?e:Math.max(e??1e3,1e3),t=c.staleTime;c.staleTime="function"==typeof t?(...s)=>e(t(...s)):e(t),"number"==typeof c.gcTime&&(c.gcTime=Math.max(c.gcTime,1e3))}n=h?.state.error&&"function"==typeof c.throwOnError?(0,l.shouldThrowError)(c.throwOnError,[h.state.error,h]):c.throwOnError,(c.suspense||c.experimental_prefetchInRender||n)&&!o.isReset()&&(c.retryOnMount=!1),m.useEffect(()=>{o.clearReset()},[o]);let d=!u.getQueryCache().get(c.queryHash),[p]=m.useState(()=>new t(u,c)),f=p.getOptimisticResult(c),x=!a&&!1!==e.subscribed;if(m.useSyncExternalStore(m.useCallback(e=>{let t=x?p.subscribe(i.notifyManager.batchCalls(e)):l.noop;return p.updateResult(),t},[p,x]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),m.useEffect(()=>{p.setOptions(c)},[c,p]),c?.suspense&&f.isPending)throw g(c,p,o);if((({result:e,errorResetBoundary:t,throwOnError:s,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&void 0===e.data||(0,l.shouldThrowError)(s,[e.error,r])))({result:f,errorResetBoundary:o,throwOnError:c.throwOnError,query:h,suspense:c.suspense}))throw f.error;if(u.getDefaultOptions().queries?._experimental_afterQuery?.(c,f),c.experimental_prefetchInRender&&!r.environmentManager.isServer()&&f.isLoading&&f.isFetching&&!a){let e=d?g(c,p,o):h?.promise;e?.catch(l.noop).finally(()=>{p.updateResult()})}return c.notifyOnChangeProps?f:p.trackResult(f)}(e,c,t)}e.s(["useQuery",()=>x],62885)}]);
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,24042,6910,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],6910)},72714,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:u,error:s,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:u,onClick:()=>{m.play(),i()},className:(0,a.cn)("gap-1.5",s&&"text-destructive hover:text-destructive",!s&&c&&"ghost"===f&&"text-muted-foreground cursor-pointer rounded-full transition-colors hover:text-blue-500"),children:[u?(0,t.jsx)(n.Loader2,{className:"size-4 animate-spin"}):s?(0,t.jsx)(r.CircleAlert,{className:"size-4"}):(0,t.jsx)(d,{className:"size-4"}),c?null:e]})}e.s(["ActionButton",()=>i])},8537,e=>{"use strict";var t=e.i(79054),n=e.i(18354),r=e.i(21023);let a=(0,r.createServerReference)("40fd3e18dbe33ca404effe2248277f211e526f570e",r.callServer,void 0,r.findSourceMapURL,"deployFeature"),o=(0,r.createServerReference)("407deb66958d84d6ddaeed62e9c1169e2495bfc0b3",r.callServer,void 0,r.findSourceMapURL,"deployRepository"),l=(0,r.createServerReference)("40be34940c30b83afd636d89435338a9160348228a",r.callServer,void 0,r.findSourceMapURL,"stopDeployment"),i=(0,r.createServerReference)("403023ac62a5cc4adc763f789ac58a9bee7afb093c",r.callServer,void 0,r.findSourceMapURL,"getDeploymentStatus"),u=(0,n.createLogger)("[useDeployAction]");function s(e){let[n,r]=(0,t.useState)(!1),[s,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)(!0),y=(0,t.useRef)(p);(0,t.useEffect)(()=>{y.current=p},[p]),(0,t.useEffect)(()=>(w.current=!0,()=>{w.current=!1}),[]),(0,t.useEffect)(()=>()=>{v.current&&clearInterval(v.current)},[]);let x=(0,t.useCallback)(()=>{v.current&&(u.debug("stopping polling"),clearInterval(v.current),v.current=null)},[]),b=(0,t.useCallback)(e=>{x(),u.debug(`starting polling for "${e}" every 3000ms`),v.current=setInterval(async()=>{let t;if(!w.current)return void x();try{t=await i(e)}catch(t){u.warn(`poll fetch failed for "${e}":`,t),w.current&&(m(null),h(null),x());return}w.current&&(t&&"Stopped"!==t.state?(t.state!==y.current&&u.info(`poll state changed: ${y.current} → ${t.state}, url=${t.url}`),m(t.state),h(t.url)):(u.info(`poll result: ${t?`state=${t.state}`:"null (deployment gone)"} — stopping poll`),m(null),h(null),x()))},3e3)},[x]),j=(0,t.useCallback)(async()=>{if(!e)return void u.warn("deploy() called but input is null — no-op");if(n)return void u.warn("deploy() called but already loading — no-op");u.info(`deploy() — targetType="${e.targetType}", targetId="${e.targetId}", repositoryPath="${e.repositoryPath}"`),r(!0),f(null);try{let t="feature"===e.targetType?await a(e.targetId):await o(e.repositoryPath);if(u.info("server action result:",t),!w.current)return void u.warn("component unmounted after deploy — discarding result");if(t.success)u.info(`deploy succeeded — initial state=${t.state}, starting polling`),m(t.state??null),h(null),b(e.targetId);else{let e=t.error??"An unexpected error occurred";u.warn(`deploy failed: ${e}`),f(e)}}catch(t){if(!w.current)return;let e=t instanceof Error?t.message:"An unexpected error occurred";u.error(`deploy threw exception: ${e}`,t),f(e)}finally{w.current&&r(!1)}},[e,n,b]),T=(0,t.useCallback)(async()=>{if(e&&!s){u.info(`stop() — targetId="${e.targetId}"`),d(!0);try{let t=await l(e.targetId);if(u.info("stop result:",t),!w.current)return;t.success&&(x(),m(null),h(null))}catch(e){u.warn("stop error (non-critical):",e)}finally{w.current&&d(!1)}}},[e,s,x]);return{deploy:j,stop:T,deployLoading:n,stopLoading:s,deployError:c,status:p,url:g}}e.s(["useDeployAction",()=>s],8537)},81803,5259,99348,45811,e=>{"use strict";let t;e.i(72714),e.s([],81803);var n=e.i(20314),r=e.i(79054),a=e.i(83428),o=e.i(30702),l=e.i(38573),i=e.i(17406),u=e.i(2828),s=e.i(2287),d=e.i(21023);let c=(0,d.createServerReference)("401f6477d0b25abf0e7aea43a755d6be94a82a6d58",d.callServer,void 0,d.findSourceMapURL,"getDeploymentLogs");function f({open:e,onOpenChange:t,targetId:a}){let{logs:o,isConnected:l}=function(e){let[t,n]=(0,r.useState)([]),[a,o]=(0,r.useState)(!1),l=(0,r.useRef)(null),i=(0,r.useCallback)(()=>{l.current&&(l.current.close(),l.current=null),o(!1)},[]);return(0,r.useEffect)(()=>{if(!e){n([]),o(!1);return}c(e).then(e=>{e&&n(e)}).catch(()=>{});let t=new EventSource(`/api/deployment-logs?targetId=${e}`);return l.current=t,t.onopen=()=>{o(!0)},t.addEventListener("log",e=>{let t=JSON.parse(e.data);n(e=>[...e,t])}),t.onerror=()=>{o(!1)},()=>{t.close(),l.current=null}},[e,i]),{logs:t,isConnected:a}}(e?a:null);return(0,n.jsx)(p,{open:e,onOpenChange:t,logs:o,isConnected:l})}function p({open:e,onOpenChange:t,logs:a,isConnected:o}){let i=(0,r.useRef)(null),u=(0,r.useRef)(!0),d=(0,r.useCallback)(()=>{let e=i.current;e&&(u.current=e.scrollTop+e.clientHeight>=e.scrollHeight-50)},[]);return(0,r.useEffect)(()=>{u.current&&i.current&&(i.current.scrollTop=i.current.scrollHeight)},[a]),(0,n.jsx)(s.Dialog,{open:e,onOpenChange:t,children:(0,n.jsxs)(s.DialogContent,{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,n.jsxs)(s.DialogHeader,{className:"flex flex-row items-center justify-between border-b border-zinc-800 px-4 py-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(l.Terminal,{className:"h-4 w-4 text-zinc-400"}),(0,n.jsx)(s.DialogTitle,{className:"text-sm font-medium text-zinc-100",children:"Server Logs"})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2 pe-8",children:[(0,n.jsx)("span",{className:`inline-block h-2 w-2 rounded-full ${o?"bg-green-500":"bg-zinc-500"}`}),(0,n.jsx)("span",{className:"text-xs text-zinc-400",children:o?"Connected":"Disconnected"})]})]}),(0,n.jsxs)("div",{ref:i,onScroll:d,className:"flex-1 overflow-auto p-4 font-mono text-sm leading-relaxed",children:[0===a.length?(0,n.jsx)("p",{className:"text-zinc-500",children:"Waiting for log output..."}):a.map(e=>(0,n.jsx)(m,{entry:e},`${e.timestamp}-${e.stream}-${e.line}`)),!o&&a.length>0&&(0,n.jsx)("div",{className:"mt-2 border-t border-zinc-800 pt-2 text-zinc-500",children:"[Server stopped]"})]})]})})}function m({entry:e}){return(0,n.jsx)("div",{"data-stream":e.stream,className:"stderr"===e.stream?"text-red-400":"text-zinc-200",children:(0,n.jsx)("span",{className:"break-all whitespace-pre-wrap",children:e.line})})}let g="text-muted-foreground hover:bg-foreground/8 hover:text-foreground inline-flex size-7 items-center justify-center rounded-[3px]";function h({status:e,url:t,targetId:s}){let[d,c]=(0,r.useState)(!1),p=s&&(e===i.DeploymentState.Booting||e===i.DeploymentState.Ready);switch(e){case i.DeploymentState.Booting:return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex items-center gap-1 pl-1",children:[(0,n.jsx)(a.Loader2,{className:"size-3 animate-spin text-blue-500"}),(0,n.jsx)("span",{className:"text-muted-foreground text-[11px]",children:"Starting..."}),p?(0,n.jsx)(u.TooltipProvider,{delayDuration:300,children:(0,n.jsxs)(u.Tooltip,{children:[(0,n.jsx)(u.TooltipTrigger,{asChild:!0,children:(0,n.jsx)("button",{type:"button","aria-label":"View server logs",className:g,onClick:e=>{e.stopPropagation(),c(!0)},children:(0,n.jsx)(l.Terminal,{className:"size-3.5"})})}),(0,n.jsx)(u.TooltipContent,{side:"bottom",className:"text-xs",children:"Server logs"})]})}):null]}),p?(0,n.jsx)(f,{open:d,onOpenChange:c,targetId:s}):null]});case i.DeploymentState.Ready:return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex translate-y-px items-center gap-1 pl-1",children:[(0,n.jsx)("span",{className:"inline-block size-1.5 rounded-full bg-green-500"}),t?(0,n.jsxs)("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-0.5 text-[11px] text-green-600 hover:text-green-500 dark:text-green-400 dark:hover:text-green-300",onClick:e=>e.stopPropagation(),children:[t,(0,n.jsx)(o.ExternalLink,{className:"size-2.5 shrink-0"})]}):(0,n.jsx)("span",{className:"text-[11px] text-green-600 dark:text-green-400",children:"Ready"}),p?(0,n.jsx)(u.TooltipProvider,{delayDuration:300,children:(0,n.jsxs)(u.Tooltip,{children:[(0,n.jsx)(u.TooltipTrigger,{asChild:!0,children:(0,n.jsx)("button",{type:"button","aria-label":"View server logs",className:g,onClick:e=>{e.stopPropagation(),c(!0)},children:(0,n.jsx)(l.Terminal,{className:"size-3.5"})})}),(0,n.jsx)(u.TooltipContent,{side:"bottom",className:"text-xs",children:"Server logs"})]})}):null]}),p?(0,n.jsx)(f,{open:d,onOpenChange:c,targetId:s}):null]});default:return null}}e.s(["DeploymentStatusBadge",()=>h],5259),e.s([],99348);var v=e.i(48249),w=e.i(567);let y=r.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}),x=()=>{let e=r.default.useContext(y);if(!e)throw Error("useDrawerContext must be used within a Drawer.Root");return e};function b(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function j(){return T(/^iPhone/)||T(/^iPad/)||T(/^Mac/)&&navigator.maxTouchPoints>1}function T(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?r.useLayoutEffect:r.useEffect;function R(...e){return(...t)=>{for(let n of e)"function"==typeof n&&n(...t)}}let D="u">typeof document&&window.visualViewport;function S(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function E(e){for(S(e)&&(e=e.parentElement);e&&!S(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}let $=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),N=0;function k(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function P(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let t=E(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 M(e){return e instanceof HTMLInputElement&&!$.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function z(...e){return r.useCallback(function(...e){return t=>e.forEach(e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)})}(...e),e)}let O=new WeakMap;function L(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||O.set(e,r)}let B=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function F(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(", ")[B(t)?13:12]):(a=r.match(/^matrix\((.+)\)$/))?parseFloat(a[1].split(", ")[B(t)?5:4]):null}function A(e,t){if(!e)return()=>{};let n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}let I=[.32,.72,0,1],H="vaul-dragging";function W(e){let t=r.default.useRef(e);return r.default.useEffect(()=>{t.current=e}),r.default.useMemo(()=>(...e)=>null==t.current?void 0:t.current.call(t,...e),[])}function q({prop:e,defaultProp:t,onChange:n=()=>{}}){let[a,o]=function({defaultProp:e,onChange:t}){let n=r.default.useState(e),[a]=n,o=r.default.useRef(a),l=W(t);return r.default.useEffect(()=>{o.current!==a&&(l(a),o.current=a)},[a,o,l]),n}({defaultProp:t,onChange:n}),l=void 0!==e,i=l?e:a,u=W(n);return[i,r.default.useCallback(t=>{if(l){let n="function"==typeof t?t(e):t;n!==e&&u(n)}else o(t)},[l,e,o,u])]}let Y=()=>()=>{},U=null;function X({open:e,onOpenChange:n,children:a,onDrag:o,onRelease:l,snapPoints:i,shouldScaleBackground:u=!1,setBackgroundColorOnScale:s=!0,closeThreshold:d=.25,scrollLockTimeout:c=100,dismissible:f=!0,handleOnly:p=!1,fadeFromIndex:m=i&&i.length-1,activeSnapPoint:g,setActiveSnapPoint:h,fixed:v,modal:x=!0,onClose:T,nested:S,noBodyStyles:$=!1,direction:z="bottom",defaultOpen:A=!1,disablePreventScroll:W=!0,snapToSequentialPoint:Y=!1,preventScrollRestoration:X=!1,repositionInputs:V=!0,onAnimationEnd:K,container:J,autoFocus:_=!1}){var G,Q;let[Z=!1,ee]=q({defaultProp:A,prop:e,onChange:e=>{null==n||n(e),e||S||ek(),setTimeout(()=>{null==K||K(e)},500),e&&!x&&"u">typeof window&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),e||(document.body.style.pointerEvents="auto")}}),[et,en]=r.default.useState(!1),[er,ea]=r.default.useState(!1),[eo,el]=r.default.useState(!1),ei=r.default.useRef(null),eu=r.default.useRef(null),es=r.default.useRef(null),ed=r.default.useRef(null),ec=r.default.useRef(null),ef=r.default.useRef(!1),ep=r.default.useRef(null),em=r.default.useRef(0),eg=r.default.useRef(!1),eh=r.default.useRef(!A),ev=r.default.useRef(0),ew=r.default.useRef(null),ey=r.default.useRef((null==(G=ew.current)?void 0:G.getBoundingClientRect().height)||0),ex=r.default.useRef((null==(Q=ew.current)?void 0:Q.getBoundingClientRect().width)||0),eb=r.default.useRef(0),ej=r.default.useCallback(e=>{i&&e===eS.length-1&&(eu.current=new Date)},[]),{activeSnapPoint:eT,activeSnapPointIndex:eC,setActiveSnapPoint:eR,onRelease:eD,snapPointsOffset:eS,onDrag:eE,shouldFade:e$,getPercentageDragged:eN}=function({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:a,overlayRef:o,fadeFromIndex:l,onSnapPointChange:i,direction:u="bottom",container:s,snapToSequentialPoint:d}){let[c,f]=q({prop:e,defaultProp:null==n?void 0:n[0],onChange:t}),[p,m]=r.default.useState("u">typeof window?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);r.default.useEffect(()=>{function e(){m({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);let g=r.default.useMemo(()=>c===(null==n?void 0:n[n.length-1])||null,[n,c]),h=r.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=r.default.useMemo(()=>{var e;let t=s?{width:s.getBoundingClientRect().width,height:s.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)),B(u)){let a=n?r:p?e*t.height:0;return p?"bottom"===u?t.height-a:-t.height+a:a}let a=n?r:p?e*t.width:0;return p?"right"===u?t.width-a:-t.width+a:a}))?e:[]},[n,p,s]),y=r.default.useMemo(()=>null!==h?null==w?void 0:w[h]:null,[w,h]),x=r.default.useCallback(e=>{var t;let r=null!=(t=null==w?void 0:w.findIndex(t=>t===e))?t:null;i(r),L(a.current,{transition:`transform 0.5s cubic-bezier(${I.join(",")})`,transform:B(u)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`}),w&&r!==w.length-1&&void 0!==l&&r!==l&&r<l?L(o.current,{transition:`opacity 0.5s cubic-bezier(${I.join(",")})`,opacity:"0"}):L(o.current,{transition:`opacity 0.5s cubic-bezier(${I.join(",")})`,opacity:"1"}),f(null==n?void 0:n[Math.max(r,0)])},[a.current,n,w,l,o,f]);return r.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:a}){if(void 0===l)return;let i="bottom"===u||"right"===u?(null!=y?y:0)-e:(null!=y?y:0)+e,s=h===l-1,c=0===h,f=e>0;if(s&&L(o.current,{transition:`opacity 0.5s cubic-bezier(${I.join(",")})`}),!d&&r>2&&!f)return void(a?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=B(u)?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&&a&&t(),null===h||x(w[h+e]))}x(p)},onDrag:function({draggedDistance:e}){if(null===y)return;let t="bottom"===u||"right"===u?y-e:y+e;("bottom"===u||"right"===u)&&t<w[w.length-1]||("top"===u||"left"===u)&&t>w[w.length-1]||L(a.current,{transform:B(u)?`translate3d(0, ${t}px, 0)`:`translate3d(${t}px, 0, 0)`})},snapPointsOffset:w}}({snapPoints:i,activeSnapPointProp:g,setActiveSnapPointProp:h,drawerRef:ew,fadeFromIndex:m,overlayRef:ei,onSnapPointChange:ej,direction:z,container:J,snapToSequentialPoint:Y});!function(e={}){let{isDisabled:n}=e;C(()=>{if(!n){var e,r,a;let n,o,l,i,u,s,d;return 1==++N&&j()&&(l=0,i=window.pageXOffset,u=window.pageYOffset,s=R((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),d=R(k(document,"touchstart",e=>{((o=E(e.target))!==document.documentElement||o!==document.body)&&(l=e.changedTouches[0].pageY)},{passive:!1,capture:!0}),k(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}),k(document,"touchend",e=>{let t=e.target;M(t)&&t!==document.activeElement&&(e.preventDefault(),t.style.transform="translateY(-2000px)",t.focus(),requestAnimationFrame(()=>{t.style.transform=""}))},{passive:!1,capture:!0}),k(document,"focus",e=>{let t=e.target;M(t)&&(t.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{t.style.transform="",D&&(D.height<window.innerHeight?requestAnimationFrame(()=>{P(t)}):D.addEventListener("resize",()=>P(t),{once:!0}))}))},!0),k(window,"scroll",()=>{window.scrollTo(0,0)})),t=()=>{s(),d(),window.scrollTo(i,u)}),()=>{0==--N&&(null==t||t())}}},[n])}({isDisabled:!Z||er||!x||eo||!et||!V||!W});let{restorePositionSetting:ek}=function({isOpen:e,modal:t,nested:n,hasBeenOpened:a,preventScrollRestoration:o,noBodyStyles:l}){let[i,u]=r.default.useState(()=>"u">typeof window?window.location.href:""),s=r.default.useRef(0),d=r.default.useCallback(()=>{if(b()&&null===U&&e&&!l){U={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:`${-s.current}px`,left:`${-e}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{let e=t-window.innerHeight;e&&s.current>=t&&(document.body.style.top=`${-(s.current+e)}px`)}),300)}},[e]),c=r.default.useCallback(()=>{if(b()&&null!==U&&!l){let e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);Object.assign(document.body.style,U),window.requestAnimationFrame(()=>{o&&i!==window.location.href?u(window.location.href):window.scrollTo(t,e)}),U=null}},[i]);return r.default.useEffect(()=>{function e(){s.current=window.scrollY}return e(),window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}},[]),r.default.useEffect(()=>{if(t)return()=>{"u"<typeof document||document.querySelector("[data-vaul-drawer]")||c()}},[t,c]),r.default.useEffect(()=>{!n&&a&&(e?(window.matchMedia("(display-mode: standalone)").matches||d(),t||window.setTimeout(()=>{c()},500)):c())},[e,a,i,t,n,d,c]),{restorePositionSetting:c}}({isOpen:Z,modal:x,nested:null!=S&&S,hasBeenOpened:et,preventScrollRestoration:X,noBodyStyles:$});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?F(ew.current,z):null,l=new Date;if("SELECT"===r.tagName||r.hasAttribute("data-vaul-no-drag")||r.closest("[data-vaul-no-drag]"))return!1;if("right"===z||"left"===z)return!0;if(eu.current&&l.getTime()-eu.current.getTime()<500)return!1;if(null!==o&&("bottom"===z?o>0:o<0))return!0;if(a&&a.length>0)return!1;if(ec.current&&l.getTime()-ec.current.getTime()<c&&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 ez(e){er&&ew.current&&(ew.current.classList.remove(H),ef.current=!1,ea(!1),ed.current=new Date),null==T||T(),e||ee(!1),setTimeout(()=>{i&&eR(i[0])},500)}function eO(){if(!ew.current)return;let e=document.querySelector("[data-vaul-drawer-wrapper]"),t=F(ew.current,z);L(ew.current,{transform:"translate3d(0, 0, 0)",transition:`transform 0.5s cubic-bezier(${I.join(",")})`}),L(ei.current,{transition:`opacity 0.5s cubic-bezier(${I.join(",")})`,opacity:"1"}),u&&t&&t>0&&Z&&L(e,{borderRadius:"8px",overflow:"hidden",...B(z)?{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(${I.join(",")})`},!0)}return r.default.useEffect(()=>{window.requestAnimationFrame(()=>{eh.current=!0})},[]),r.default.useEffect(()=>{var e;function t(){if(ew.current&&V&&(M(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),i&&i.length>0&&eS&&eC&&(r+=eS[eC]||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)),v?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`)}i&&i.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)}},[eC,i,eS]),r.default.useEffect(()=>(Z&&(L(document.documentElement,{scrollBehavior:"auto"}),eu.current=new Date),()=>{!function(e,t){if(!e||!(e instanceof HTMLElement))return;let n=O.get(e);n&&(e.style[t]=n[t])}(document.documentElement,"scrollBehavior")}),[Z]),r.default.useEffect(()=>{x||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[x]),r.default.createElement(w.Root,{defaultOpen:A,onOpenChange:e=>{(f||e)&&(e?en(!0):ez(!0),ee(e))},open:Z},r.default.createElement(y.Provider,{value:{activeSnapPoint:eT,snapPoints:i,setActiveSnapPoint:eR,drawerRef:ew,overlayRef:ei,onOpenChange:n,onPress:function(e){var t,n;!f&&!i||(!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),es.current=new Date,j()&&window.addEventListener("touchend",()=>ef.current=!1,{once:!0}),e.target.setPointerCapture(e.pointerId),em.current=B(z)?e.pageY:e.pageX)},onRelease:function(e){var t,n;if(!er||!ew.current)return;ew.current.classList.remove(H),ef.current=!1,ea(!1),ed.current=new Date;let r=F(ew.current,z);if(!e||!eM(e.target,!1)||!r||Number.isNaN(r)||null===es.current)return;let a=ed.current.getTime()-es.current.getTime(),o=em.current-(B(z)?e.pageY:e.pageX),u=Math.abs(o)/a;if(u>.05&&(el(!0),setTimeout(()=>{el(!1)},200)),i){eD({draggedDistance:o*("bottom"===z||"right"===z?1:-1),closeDrawer:ez,velocity:u,dismissible:f}),null==l||l(e,!0);return}if("bottom"===z||"right"===z?o>0:o<0){eO(),null==l||l(e,!0);return}if(u>.4){ez(),null==l||l(e,!1);return}let s=Math.min(null!=(t=ew.current.getBoundingClientRect().height)?t:0,window.innerHeight),c=Math.min(null!=(n=ew.current.getBoundingClientRect().width)?n:0,window.innerWidth);if(Math.abs(r)>=("left"===z||"right"===z?c:s)*d){ez(),null==l||l(e,!1);return}null==l||l(e,!0),eO()},onDrag:function(e){if(ew.current&&er){let t="bottom"===z||"right"===z?1:-1,n=(em.current-(B(z)?e.pageY:e.pageX))*t,r=n>0,a=i&&!f&&!r;if(a&&0===eC)return;let l=Math.abs(n),s=document.querySelector("[data-vaul-drawer-wrapper]"),d=l/("bottom"===z||"top"===z?ey.current:ex.current),c=eN(l,r);if(null!==c&&(d=c),a&&d>=1||!ef.current&&!eM(e.target,r))return;if(ew.current.classList.add(H),ef.current=!0,L(ew.current,{transition:"none"}),L(ei.current,{transition:"none"}),i&&eE({draggedDistance:n}),r&&!i){let e=Math.min(-(8*(Math.log(n+1)-2)*1),0)*t;L(ew.current,{transform:B(z)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`});return}let p=1-d;if((e$||m&&eC===m-1)&&(null==o||o(e,d),L(ei.current,{opacity:`${p}`,transition:"none"},!0)),s&&ei.current&&u){let e=Math.min(eP()+d*(1-eP()),1),t=8-8*d,n=Math.max(0,14-14*d);L(s,{borderRadius:`${t}px`,transform:B(z)?`scale(${e}) translate3d(0, ${n}px, 0)`:`scale(${e}) translate3d(${n}px, 0, 0)`,transition:"none"},!0)}if(!i){let e=l*t;L(ew.current,{transform:B(z)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})}}},dismissible:f,shouldAnimate:eh,handleOnly:p,isOpen:Z,isDragging:er,shouldFade:e$,closeDrawer:ez,onNestedDrag:function(e,t){if(t<0)return;let n=(window.innerWidth-16)/window.innerWidth,r=n+t*(1-n),a=-16+16*t;L(ew.current,{transform:B(z)?`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),L(ew.current,{transition:`transform 0.5s cubic-bezier(${I.join(",")})`,transform:B(z)?`scale(${t}) translate3d(0, ${n}px, 0)`:`scale(${t}) translate3d(${n}px, 0, 0)`}),!e&&ew.current&&(ep.current=setTimeout(()=>{let e=F(ew.current,z);L(ew.current,{transition:"none",transform:B(z)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})},500))},onNestedRelease:function(e,t){let n=B(z)?window.innerHeight:window.innerWidth,r=t?(n-16)/n:1,a=t?-16:0;t&&L(ew.current,{transition:`transform 0.5s cubic-bezier(${I.join(",")})`,transform:B(z)?`scale(${r}) translate3d(0, ${a}px, 0)`:`scale(${r}) translate3d(${a}px, 0, 0)`})},keyboardIsOpen:eg,modal:x,snapPointsOffset:eS,activeSnapPointIndex:eC,direction:z,shouldScaleBackground:u,setBackgroundColorOnScale:s,noBodyStyles:$,container:J,autoFocus:_}},a))}let V=r.default.forwardRef(function({...e},t){let{overlayRef:n,snapPoints:a,onRelease:o,shouldFade:l,isOpen:i,modal:u,shouldAnimate:s}=x(),d=z(t,n),c=a&&a.length>0;if(!u)return null;let f=r.default.useCallback(e=>o(e),[o]);return r.default.createElement(w.Overlay,{onMouseUp:f,ref:d,"data-vaul-overlay":"","data-vaul-snap-points":i&&c?"true":"false","data-vaul-snap-points-overlay":i&&l?"true":"false","data-vaul-animate":(null==s?void 0:s.current)?"true":"false",...e})});V.displayName="Drawer.Overlay";let K=r.default.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...a},o){let{drawerRef:l,onPress:i,onRelease:u,onDrag:s,keyboardIsOpen:d,snapPointsOffset:c,activeSnapPointIndex:f,modal:p,isOpen:m,direction:g,snapPoints:h,container:v,handleOnly:y,shouldAnimate:b,autoFocus:j}=x(),[T,C]=r.default.useState(!1),R=z(o,l),D=r.default.useRef(null),S=r.default.useRef(null),E=r.default.useRef(!1),$=h&&h.length>0;function N(e){D.current=null,E.current=!1,u(e)}return!function(){let{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:a,noBodyStyles:o}=x(),l=r.default.useRef(null),i=(0,r.useMemo)(()=>document.body.style.backgroundColor,[]);function u(){return(window.innerWidth-26)/window.innerWidth}r.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){}(a&&!o?A(document.body,{background:"black"}):Y,A(t,{transformOrigin:B(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:"0.5s",transitionTimingFunction:`cubic-bezier(${I.join(",")})`}));let n=A(t,{borderRadius:"8px",overflow:"hidden",...B(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(()=>{i?document.body.style.background=i:document.body.style.removeProperty("background")},500)}}},[t,n,i])}(),r.default.useEffect(()=>{$&&window.requestAnimationFrame(()=>{C(!0)})},[]),r.default.createElement(w.Content,{"data-vaul-drawer-direction":g,"data-vaul-drawer":"","data-vaul-delayed-snap-points":T?"true":"false","data-vaul-snap-points":m&&$?"true":"false","data-vaul-custom-container":v?"true":"false","data-vaul-animate":(null==b?void 0:b.current)?"true":"false",...a,ref:R,style:c&&c.length>0?{"--snap-point-height":`${c[null!=f?f:0]}px`,...t}:t,onPointerDown:e=>{y||(null==a.onPointerDown||a.onPointerDown.call(a,e),D.current={x:e.pageX,y:e.pageY},i(e))},onOpenAutoFocus:e=>{null==n||n(e),j||e.preventDefault()},onPointerDownOutside:t=>{(null==e||e(t),!p||t.defaultPrevented)?t.preventDefault():d.current&&(d.current=!1)},onFocusOutside:e=>{if(!p)return void e.preventDefault()},onPointerMove:e=>{if(S.current=e,y||(null==a.onPointerMove||a.onPointerMove.call(a,e),!D.current))return;let t=e.pageY-D.current.y,n=e.pageX-D.current.x,r="touch"===e.pointerType?10:2;((e,t,n=0)=>{if(E.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 E.current=!0,!0})({x:n,y:t},g,r)?s(e):(Math.abs(n)>r||Math.abs(t)>r)&&(D.current=null)},onPointerUp:e=>{null==a.onPointerUp||a.onPointerUp.call(a,e),D.current=null,E.current=!1,u(e)},onPointerOut:e=>{null==a.onPointerOut||a.onPointerOut.call(a,e),N(S.current)},onContextMenu:e=>{null==a.onContextMenu||a.onContextMenu.call(a,e),S.current&&N(S.current)}})});K.displayName="Drawer.Content";let J=r.default.forwardRef(function({preventCycle:e=!1,children:t,...n},a){let{closeDrawer:o,isDragging:l,snapPoints:i,activeSnapPoint:u,setActiveSnapPoint:s,dismissible:d,handleOnly:c,isOpen:f,onPress:p,onDrag:m}=x(),g=r.default.useRef(null),h=r.default.useRef(!1);function v(){g.current&&window.clearTimeout(g.current),h.current=!1}return r.default.createElement("div",{onClick:function(){h.current?v():window.setTimeout(()=>{!function(){if(l||e||h.current)return v();if(v(),!i||0===i.length){d||o();return}if(u===i[i.length-1]&&d)return o();let t=i.findIndex(e=>e===u);-1===t||s(i[t+1])}()},120)},onPointerCancel:v,onPointerDown:e=>{c&&p(e),g.current=window.setTimeout(()=>{h.current=!0},250)},onPointerMove:e=>{c&&m(e)},ref:a,"data-vaul-drawer-visible":f?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},r.default.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});J.displayName="Drawer.Handle";let _={Root:X,NestedRoot:function({onDrag:e,onOpenChange:t,open:n,...a}){let{onNestedDrag:o,onNestedOpenChange:l,onNestedRelease:i}=x();if(!o)throw Error("Drawer.NestedRoot must be placed in another drawer");return r.default.createElement(X,{nested:!0,open:n,onClose:()=>{l(!1)},onDrag:(t,n)=>{o(t,n),null==e||e(t,n)},onOpenChange:e=>{e&&l(e),null==t||t(e)},onRelease:i,...a})},Content:K,Overlay:V,Trigger:w.Trigger,Portal:function(e){let t=x(),{container:n=t.container,...a}=e;return r.default.createElement(w.Portal,{container:n,...a})},Handle:J,Close:w.Close,Title:w.Title,Description:w.Description};var G=e.i(31777);function Q({...e}){return(0,n.jsx)(_.Root,{"data-slot":"drawer",...e})}function Z({...e}){return(0,n.jsx)(_.Portal,{"data-slot":"drawer-portal",...e})}function ee({className:e,...t}){return(0,n.jsx)(_.Overlay,{"data-slot":"drawer-overlay",className:(0,G.cn)("fixed inset-0 z-50 bg-black/50",e),...t})}function et({className:e,children:t,direction:r="bottom",showCloseButton:a=!0,...o}){return(0,n.jsx)(Z,{children:(0,n.jsxs)(_.Content,{"data-slot":"drawer-content",className:(0,G.cn)("bg-background fixed z-50 flex flex-col shadow-lg","bottom"===r&&"inset-x-0 bottom-0 mb-24 rounded-t-lg border-t","top"===r&&"inset-x-0 top-0 mt-24 rounded-b-lg border-b","right"===r&&"inset-y-0 right-0 h-full w-3/4 border-l","left"===r&&"inset-y-0 left-0 h-full w-3/4 border-r",e),style:{"--initial-transform":"calc(100% + 8px)",userSelect:"text",...o.style??{}},...o,children:[t,a?(0,n.jsxs)(_.Close,{className:"ring-offset-background focus:ring-ring absolute end-4 top-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)(v.XIcon,{className:"size-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Close"})]}):null]})})}function en({className:e,...t}){return(0,n.jsx)("div",{"data-slot":"drawer-header",className:(0,G.cn)("flex flex-col gap-1.5 p-4",e),...t})}function er({className:e,...t}){return(0,n.jsx)("div",{"data-slot":"drawer-footer",className:(0,G.cn)("mt-auto flex flex-col gap-2 p-4",e),...t})}function ea({className:e,...t}){return(0,n.jsx)(_.Title,{"data-slot":"drawer-title",className:(0,G.cn)("text-foreground font-semibold",e),...t})}function eo({className:e,...t}){return(0,n.jsx)(_.Description,{"data-slot":"drawer-description",className:(0,G.cn)("text-muted-foreground text-sm",e),...t})}e.s(["Drawer",()=>Q,"DrawerContent",()=>et,"DrawerDescription",()=>eo,"DrawerFooter",()=>er,"DrawerHeader",()=>en,"DrawerOverlay",()=>ee,"DrawerTitle",()=>ea],45811)},11495,e=>{"use strict";var t=e.i(20314),n=e.i(79054),r=e.i(48249),a=e.i(24042),o=e.i(6910),l=e.i(94237),i=e.i(31777);e.i(81803);var u=e.i(72714);e.i(99348);var s=e.i(5259),d=e.i(45811),c=e.i(25235),f=e.i(2828);e.i(41001);var p=e.i(64780),m=e.i(8537),g=e.i(75921);let h=(0,l.cva)("",{variants:{size:{sm:"w-96",md:"w-2xl",lg:"w-[772px]"}},defaultVariants:{size:"sm"}});function v({open:e,onClose:a,modal:o=!1,dismissOnOutsideClick:l=!1,title:u="Drawer",size:s,header:f,children:m,footer:v,className:y,"data-testid":x,deployTarget:b}){let{i18n:j}=(0,p.useTranslation)(),T=(0,g.useFeatureFlags)(),C=(0,n.useRef)(null),R="rtl"===j.dir()?"left":"right";return(0,n.useEffect)(()=>{if(!e||o)return;let t=e=>{let t=e.target;!document.body.contains(t)||C.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:R,modal:o,handleOnly:!0,open:e,onOpenChange:e=>{e||a()},children:[o?(0,t.jsx)(d.DrawerOverlay,{}):null,(0,t.jsxs)(d.DrawerContent,{ref:C,direction:R,showCloseButton:!1,className:(0,i.cn)(h({size:s}),"bg-white/85 backdrop-blur-xl dark:bg-neutral-800/85",y),"data-testid":x,onInteractOutside:o?void 0:e=>e.preventDefault(),children:[(0,t.jsx)(d.DrawerTitle,{asChild:!0,children:(0,t.jsx)("span",{className:"sr-only",children:u})}),(0,t.jsx)(d.DrawerDescription,{asChild:!0,children:(0,t.jsx)("span",{className:"sr-only",children:u})}),(0,t.jsxs)("button",{type:"button","aria-label":"Close",onClick:a,className:"ring-offset-background focus:ring-ring absolute end-3 top-2 z-50 rounded-sm p-1 opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden","data-testid":x?`${x}-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,T.envDeploy&&b?(0,t.jsx)(w,{deployTarget:b}):null,(0,t.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:m}),v?(0,t.jsx)(d.DrawerFooter,{className:"shrink-0",children:v}):null]})]})}function w({deployTarget:e}){let n=(0,m.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 pt-3 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)(u.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)(s.DeploymentStatusBadge,{status:n.status,url:n.url,targetId:e.targetId}):null]})}e.s(["BaseDrawer",()=>v])}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,24042,6910,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],6910)},72714,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:u,error:s,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:u,onClick:()=>{m.play(),i()},className:(0,a.cn)("gap-1.5",s&&"text-destructive hover:text-destructive",!s&&c&&"ghost"===f&&"text-muted-foreground cursor-pointer rounded-full transition-colors hover:text-blue-500"),children:[u?(0,t.jsx)(n.Loader2,{className:"size-4 animate-spin"}):s?(0,t.jsx)(r.CircleAlert,{className:"size-4"}):(0,t.jsx)(d,{className:"size-4"}),c?null:e]})}e.s(["ActionButton",()=>i])},8537,e=>{"use strict";var t=e.i(79054),n=e.i(18354),r=e.i(21023);let a=(0,r.createServerReference)("40df93ad335107496a15985187af3d707c2aff0850",r.callServer,void 0,r.findSourceMapURL,"deployFeature"),o=(0,r.createServerReference)("402d7bb90c2b2d35eecd3e2360bea51cf754a7df71",r.callServer,void 0,r.findSourceMapURL,"deployRepository"),l=(0,r.createServerReference)("40a4be9330c7f728f151a1520d1b09291aeccd4b09",r.callServer,void 0,r.findSourceMapURL,"stopDeployment"),i=(0,r.createServerReference)("409755432c6c50c6446c56bd14cf967b3f19c2ddef",r.callServer,void 0,r.findSourceMapURL,"getDeploymentStatus"),u=(0,n.createLogger)("[useDeployAction]");function s(e){let[n,r]=(0,t.useState)(!1),[s,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)(!0),y=(0,t.useRef)(p);(0,t.useEffect)(()=>{y.current=p},[p]),(0,t.useEffect)(()=>(w.current=!0,()=>{w.current=!1}),[]),(0,t.useEffect)(()=>()=>{v.current&&clearInterval(v.current)},[]);let x=(0,t.useCallback)(()=>{v.current&&(u.debug("stopping polling"),clearInterval(v.current),v.current=null)},[]),b=(0,t.useCallback)(e=>{x(),u.debug(`starting polling for "${e}" every 3000ms`),v.current=setInterval(async()=>{let t;if(!w.current)return void x();try{t=await i(e)}catch(t){u.warn(`poll fetch failed for "${e}":`,t),w.current&&(m(null),h(null),x());return}w.current&&(t&&"Stopped"!==t.state?(t.state!==y.current&&u.info(`poll state changed: ${y.current} → ${t.state}, url=${t.url}`),m(t.state),h(t.url)):(u.info(`poll result: ${t?`state=${t.state}`:"null (deployment gone)"} — stopping poll`),m(null),h(null),x()))},3e3)},[x]),j=(0,t.useCallback)(async()=>{if(!e)return void u.warn("deploy() called but input is null — no-op");if(n)return void u.warn("deploy() called but already loading — no-op");u.info(`deploy() — targetType="${e.targetType}", targetId="${e.targetId}", repositoryPath="${e.repositoryPath}"`),r(!0),f(null);try{let t="feature"===e.targetType?await a(e.targetId):await o(e.repositoryPath);if(u.info("server action result:",t),!w.current)return void u.warn("component unmounted after deploy — discarding result");if(t.success)u.info(`deploy succeeded — initial state=${t.state}, starting polling`),m(t.state??null),h(null),b(e.targetId);else{let e=t.error??"An unexpected error occurred";u.warn(`deploy failed: ${e}`),f(e)}}catch(t){if(!w.current)return;let e=t instanceof Error?t.message:"An unexpected error occurred";u.error(`deploy threw exception: ${e}`,t),f(e)}finally{w.current&&r(!1)}},[e,n,b]),T=(0,t.useCallback)(async()=>{if(e&&!s){u.info(`stop() — targetId="${e.targetId}"`),d(!0);try{let t=await l(e.targetId);if(u.info("stop result:",t),!w.current)return;t.success&&(x(),m(null),h(null))}catch(e){u.warn("stop error (non-critical):",e)}finally{w.current&&d(!1)}}},[e,s,x]);return{deploy:j,stop:T,deployLoading:n,stopLoading:s,deployError:c,status:p,url:g}}e.s(["useDeployAction",()=>s],8537)},81803,5259,99348,45811,e=>{"use strict";let t;e.i(72714),e.s([],81803);var n=e.i(20314),r=e.i(79054),a=e.i(83428),o=e.i(30702),l=e.i(38573),i=e.i(17406),u=e.i(2828),s=e.i(2287),d=e.i(21023);let c=(0,d.createServerReference)("40ddaa5b969ad2062323e2ab41cb8d2fedb5f1bcab",d.callServer,void 0,d.findSourceMapURL,"getDeploymentLogs");function f({open:e,onOpenChange:t,targetId:a}){let{logs:o,isConnected:l}=function(e){let[t,n]=(0,r.useState)([]),[a,o]=(0,r.useState)(!1),l=(0,r.useRef)(null),i=(0,r.useCallback)(()=>{l.current&&(l.current.close(),l.current=null),o(!1)},[]);return(0,r.useEffect)(()=>{if(!e){n([]),o(!1);return}c(e).then(e=>{e&&n(e)}).catch(()=>{});let t=new EventSource(`/api/deployment-logs?targetId=${e}`);return l.current=t,t.onopen=()=>{o(!0)},t.addEventListener("log",e=>{let t=JSON.parse(e.data);n(e=>[...e,t])}),t.onerror=()=>{o(!1)},()=>{t.close(),l.current=null}},[e,i]),{logs:t,isConnected:a}}(e?a:null);return(0,n.jsx)(p,{open:e,onOpenChange:t,logs:o,isConnected:l})}function p({open:e,onOpenChange:t,logs:a,isConnected:o}){let i=(0,r.useRef)(null),u=(0,r.useRef)(!0),d=(0,r.useCallback)(()=>{let e=i.current;e&&(u.current=e.scrollTop+e.clientHeight>=e.scrollHeight-50)},[]);return(0,r.useEffect)(()=>{u.current&&i.current&&(i.current.scrollTop=i.current.scrollHeight)},[a]),(0,n.jsx)(s.Dialog,{open:e,onOpenChange:t,children:(0,n.jsxs)(s.DialogContent,{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,n.jsxs)(s.DialogHeader,{className:"flex flex-row items-center justify-between border-b border-zinc-800 px-4 py-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(l.Terminal,{className:"h-4 w-4 text-zinc-400"}),(0,n.jsx)(s.DialogTitle,{className:"text-sm font-medium text-zinc-100",children:"Server Logs"})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2 pe-8",children:[(0,n.jsx)("span",{className:`inline-block h-2 w-2 rounded-full ${o?"bg-green-500":"bg-zinc-500"}`}),(0,n.jsx)("span",{className:"text-xs text-zinc-400",children:o?"Connected":"Disconnected"})]})]}),(0,n.jsxs)("div",{ref:i,onScroll:d,className:"flex-1 overflow-auto p-4 font-mono text-sm leading-relaxed",children:[0===a.length?(0,n.jsx)("p",{className:"text-zinc-500",children:"Waiting for log output..."}):a.map(e=>(0,n.jsx)(m,{entry:e},`${e.timestamp}-${e.stream}-${e.line}`)),!o&&a.length>0&&(0,n.jsx)("div",{className:"mt-2 border-t border-zinc-800 pt-2 text-zinc-500",children:"[Server stopped]"})]})]})})}function m({entry:e}){return(0,n.jsx)("div",{"data-stream":e.stream,className:"stderr"===e.stream?"text-red-400":"text-zinc-200",children:(0,n.jsx)("span",{className:"break-all whitespace-pre-wrap",children:e.line})})}let g="text-muted-foreground hover:bg-foreground/8 hover:text-foreground inline-flex size-7 items-center justify-center rounded-[3px]";function h({status:e,url:t,targetId:s}){let[d,c]=(0,r.useState)(!1),p=s&&(e===i.DeploymentState.Booting||e===i.DeploymentState.Ready);switch(e){case i.DeploymentState.Booting:return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex items-center gap-1 pl-1",children:[(0,n.jsx)(a.Loader2,{className:"size-3 animate-spin text-blue-500"}),(0,n.jsx)("span",{className:"text-muted-foreground text-[11px]",children:"Starting..."}),p?(0,n.jsx)(u.TooltipProvider,{delayDuration:300,children:(0,n.jsxs)(u.Tooltip,{children:[(0,n.jsx)(u.TooltipTrigger,{asChild:!0,children:(0,n.jsx)("button",{type:"button","aria-label":"View server logs",className:g,onClick:e=>{e.stopPropagation(),c(!0)},children:(0,n.jsx)(l.Terminal,{className:"size-3.5"})})}),(0,n.jsx)(u.TooltipContent,{side:"bottom",className:"text-xs",children:"Server logs"})]})}):null]}),p?(0,n.jsx)(f,{open:d,onOpenChange:c,targetId:s}):null]});case i.DeploymentState.Ready:return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex translate-y-px items-center gap-1 pl-1",children:[(0,n.jsx)("span",{className:"inline-block size-1.5 rounded-full bg-green-500"}),t?(0,n.jsxs)("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-0.5 text-[11px] text-green-600 hover:text-green-500 dark:text-green-400 dark:hover:text-green-300",onClick:e=>e.stopPropagation(),children:[t,(0,n.jsx)(o.ExternalLink,{className:"size-2.5 shrink-0"})]}):(0,n.jsx)("span",{className:"text-[11px] text-green-600 dark:text-green-400",children:"Ready"}),p?(0,n.jsx)(u.TooltipProvider,{delayDuration:300,children:(0,n.jsxs)(u.Tooltip,{children:[(0,n.jsx)(u.TooltipTrigger,{asChild:!0,children:(0,n.jsx)("button",{type:"button","aria-label":"View server logs",className:g,onClick:e=>{e.stopPropagation(),c(!0)},children:(0,n.jsx)(l.Terminal,{className:"size-3.5"})})}),(0,n.jsx)(u.TooltipContent,{side:"bottom",className:"text-xs",children:"Server logs"})]})}):null]}),p?(0,n.jsx)(f,{open:d,onOpenChange:c,targetId:s}):null]});default:return null}}e.s(["DeploymentStatusBadge",()=>h],5259),e.s([],99348);var v=e.i(48249),w=e.i(567);let y=r.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}),x=()=>{let e=r.default.useContext(y);if(!e)throw Error("useDrawerContext must be used within a Drawer.Root");return e};function b(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function j(){return T(/^iPhone/)||T(/^iPad/)||T(/^Mac/)&&navigator.maxTouchPoints>1}function T(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?r.useLayoutEffect:r.useEffect;function R(...e){return(...t)=>{for(let n of e)"function"==typeof n&&n(...t)}}let D="u">typeof document&&window.visualViewport;function S(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function E(e){for(S(e)&&(e=e.parentElement);e&&!S(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}let $=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),N=0;function k(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function P(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let t=E(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 M(e){return e instanceof HTMLInputElement&&!$.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function z(...e){return r.useCallback(function(...e){return t=>e.forEach(e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)})}(...e),e)}let O=new WeakMap;function L(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||O.set(e,r)}let B=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function F(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(", ")[B(t)?13:12]):(a=r.match(/^matrix\((.+)\)$/))?parseFloat(a[1].split(", ")[B(t)?5:4]):null}function A(e,t){if(!e)return()=>{};let n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}let I=[.32,.72,0,1],H="vaul-dragging";function W(e){let t=r.default.useRef(e);return r.default.useEffect(()=>{t.current=e}),r.default.useMemo(()=>(...e)=>null==t.current?void 0:t.current.call(t,...e),[])}function q({prop:e,defaultProp:t,onChange:n=()=>{}}){let[a,o]=function({defaultProp:e,onChange:t}){let n=r.default.useState(e),[a]=n,o=r.default.useRef(a),l=W(t);return r.default.useEffect(()=>{o.current!==a&&(l(a),o.current=a)},[a,o,l]),n}({defaultProp:t,onChange:n}),l=void 0!==e,i=l?e:a,u=W(n);return[i,r.default.useCallback(t=>{if(l){let n="function"==typeof t?t(e):t;n!==e&&u(n)}else o(t)},[l,e,o,u])]}let Y=()=>()=>{},U=null;function X({open:e,onOpenChange:n,children:a,onDrag:o,onRelease:l,snapPoints:i,shouldScaleBackground:u=!1,setBackgroundColorOnScale:s=!0,closeThreshold:d=.25,scrollLockTimeout:c=100,dismissible:f=!0,handleOnly:p=!1,fadeFromIndex:m=i&&i.length-1,activeSnapPoint:g,setActiveSnapPoint:h,fixed:v,modal:x=!0,onClose:T,nested:S,noBodyStyles:$=!1,direction:z="bottom",defaultOpen:A=!1,disablePreventScroll:W=!0,snapToSequentialPoint:Y=!1,preventScrollRestoration:X=!1,repositionInputs:V=!0,onAnimationEnd:K,container:J,autoFocus:_=!1}){var G,Q;let[Z=!1,ee]=q({defaultProp:A,prop:e,onChange:e=>{null==n||n(e),e||S||ek(),setTimeout(()=>{null==K||K(e)},500),e&&!x&&"u">typeof window&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),e||(document.body.style.pointerEvents="auto")}}),[et,en]=r.default.useState(!1),[er,ea]=r.default.useState(!1),[eo,el]=r.default.useState(!1),ei=r.default.useRef(null),eu=r.default.useRef(null),es=r.default.useRef(null),ed=r.default.useRef(null),ec=r.default.useRef(null),ef=r.default.useRef(!1),ep=r.default.useRef(null),em=r.default.useRef(0),eg=r.default.useRef(!1),eh=r.default.useRef(!A),ev=r.default.useRef(0),ew=r.default.useRef(null),ey=r.default.useRef((null==(G=ew.current)?void 0:G.getBoundingClientRect().height)||0),ex=r.default.useRef((null==(Q=ew.current)?void 0:Q.getBoundingClientRect().width)||0),eb=r.default.useRef(0),ej=r.default.useCallback(e=>{i&&e===eS.length-1&&(eu.current=new Date)},[]),{activeSnapPoint:eT,activeSnapPointIndex:eC,setActiveSnapPoint:eR,onRelease:eD,snapPointsOffset:eS,onDrag:eE,shouldFade:e$,getPercentageDragged:eN}=function({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:a,overlayRef:o,fadeFromIndex:l,onSnapPointChange:i,direction:u="bottom",container:s,snapToSequentialPoint:d}){let[c,f]=q({prop:e,defaultProp:null==n?void 0:n[0],onChange:t}),[p,m]=r.default.useState("u">typeof window?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);r.default.useEffect(()=>{function e(){m({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);let g=r.default.useMemo(()=>c===(null==n?void 0:n[n.length-1])||null,[n,c]),h=r.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=r.default.useMemo(()=>{var e;let t=s?{width:s.getBoundingClientRect().width,height:s.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)),B(u)){let a=n?r:p?e*t.height:0;return p?"bottom"===u?t.height-a:-t.height+a:a}let a=n?r:p?e*t.width:0;return p?"right"===u?t.width-a:-t.width+a:a}))?e:[]},[n,p,s]),y=r.default.useMemo(()=>null!==h?null==w?void 0:w[h]:null,[w,h]),x=r.default.useCallback(e=>{var t;let r=null!=(t=null==w?void 0:w.findIndex(t=>t===e))?t:null;i(r),L(a.current,{transition:`transform 0.5s cubic-bezier(${I.join(",")})`,transform:B(u)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`}),w&&r!==w.length-1&&void 0!==l&&r!==l&&r<l?L(o.current,{transition:`opacity 0.5s cubic-bezier(${I.join(",")})`,opacity:"0"}):L(o.current,{transition:`opacity 0.5s cubic-bezier(${I.join(",")})`,opacity:"1"}),f(null==n?void 0:n[Math.max(r,0)])},[a.current,n,w,l,o,f]);return r.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:a}){if(void 0===l)return;let i="bottom"===u||"right"===u?(null!=y?y:0)-e:(null!=y?y:0)+e,s=h===l-1,c=0===h,f=e>0;if(s&&L(o.current,{transition:`opacity 0.5s cubic-bezier(${I.join(",")})`}),!d&&r>2&&!f)return void(a?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=B(u)?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&&a&&t(),null===h||x(w[h+e]))}x(p)},onDrag:function({draggedDistance:e}){if(null===y)return;let t="bottom"===u||"right"===u?y-e:y+e;("bottom"===u||"right"===u)&&t<w[w.length-1]||("top"===u||"left"===u)&&t>w[w.length-1]||L(a.current,{transform:B(u)?`translate3d(0, ${t}px, 0)`:`translate3d(${t}px, 0, 0)`})},snapPointsOffset:w}}({snapPoints:i,activeSnapPointProp:g,setActiveSnapPointProp:h,drawerRef:ew,fadeFromIndex:m,overlayRef:ei,onSnapPointChange:ej,direction:z,container:J,snapToSequentialPoint:Y});!function(e={}){let{isDisabled:n}=e;C(()=>{if(!n){var e,r,a;let n,o,l,i,u,s,d;return 1==++N&&j()&&(l=0,i=window.pageXOffset,u=window.pageYOffset,s=R((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),d=R(k(document,"touchstart",e=>{((o=E(e.target))!==document.documentElement||o!==document.body)&&(l=e.changedTouches[0].pageY)},{passive:!1,capture:!0}),k(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}),k(document,"touchend",e=>{let t=e.target;M(t)&&t!==document.activeElement&&(e.preventDefault(),t.style.transform="translateY(-2000px)",t.focus(),requestAnimationFrame(()=>{t.style.transform=""}))},{passive:!1,capture:!0}),k(document,"focus",e=>{let t=e.target;M(t)&&(t.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{t.style.transform="",D&&(D.height<window.innerHeight?requestAnimationFrame(()=>{P(t)}):D.addEventListener("resize",()=>P(t),{once:!0}))}))},!0),k(window,"scroll",()=>{window.scrollTo(0,0)})),t=()=>{s(),d(),window.scrollTo(i,u)}),()=>{0==--N&&(null==t||t())}}},[n])}({isDisabled:!Z||er||!x||eo||!et||!V||!W});let{restorePositionSetting:ek}=function({isOpen:e,modal:t,nested:n,hasBeenOpened:a,preventScrollRestoration:o,noBodyStyles:l}){let[i,u]=r.default.useState(()=>"u">typeof window?window.location.href:""),s=r.default.useRef(0),d=r.default.useCallback(()=>{if(b()&&null===U&&e&&!l){U={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:`${-s.current}px`,left:`${-e}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{let e=t-window.innerHeight;e&&s.current>=t&&(document.body.style.top=`${-(s.current+e)}px`)}),300)}},[e]),c=r.default.useCallback(()=>{if(b()&&null!==U&&!l){let e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);Object.assign(document.body.style,U),window.requestAnimationFrame(()=>{o&&i!==window.location.href?u(window.location.href):window.scrollTo(t,e)}),U=null}},[i]);return r.default.useEffect(()=>{function e(){s.current=window.scrollY}return e(),window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}},[]),r.default.useEffect(()=>{if(t)return()=>{"u"<typeof document||document.querySelector("[data-vaul-drawer]")||c()}},[t,c]),r.default.useEffect(()=>{!n&&a&&(e?(window.matchMedia("(display-mode: standalone)").matches||d(),t||window.setTimeout(()=>{c()},500)):c())},[e,a,i,t,n,d,c]),{restorePositionSetting:c}}({isOpen:Z,modal:x,nested:null!=S&&S,hasBeenOpened:et,preventScrollRestoration:X,noBodyStyles:$});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?F(ew.current,z):null,l=new Date;if("SELECT"===r.tagName||r.hasAttribute("data-vaul-no-drag")||r.closest("[data-vaul-no-drag]"))return!1;if("right"===z||"left"===z)return!0;if(eu.current&&l.getTime()-eu.current.getTime()<500)return!1;if(null!==o&&("bottom"===z?o>0:o<0))return!0;if(a&&a.length>0)return!1;if(ec.current&&l.getTime()-ec.current.getTime()<c&&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 ez(e){er&&ew.current&&(ew.current.classList.remove(H),ef.current=!1,ea(!1),ed.current=new Date),null==T||T(),e||ee(!1),setTimeout(()=>{i&&eR(i[0])},500)}function eO(){if(!ew.current)return;let e=document.querySelector("[data-vaul-drawer-wrapper]"),t=F(ew.current,z);L(ew.current,{transform:"translate3d(0, 0, 0)",transition:`transform 0.5s cubic-bezier(${I.join(",")})`}),L(ei.current,{transition:`opacity 0.5s cubic-bezier(${I.join(",")})`,opacity:"1"}),u&&t&&t>0&&Z&&L(e,{borderRadius:"8px",overflow:"hidden",...B(z)?{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(${I.join(",")})`},!0)}return r.default.useEffect(()=>{window.requestAnimationFrame(()=>{eh.current=!0})},[]),r.default.useEffect(()=>{var e;function t(){if(ew.current&&V&&(M(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),i&&i.length>0&&eS&&eC&&(r+=eS[eC]||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)),v?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`)}i&&i.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)}},[eC,i,eS]),r.default.useEffect(()=>(Z&&(L(document.documentElement,{scrollBehavior:"auto"}),eu.current=new Date),()=>{!function(e,t){if(!e||!(e instanceof HTMLElement))return;let n=O.get(e);n&&(e.style[t]=n[t])}(document.documentElement,"scrollBehavior")}),[Z]),r.default.useEffect(()=>{x||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[x]),r.default.createElement(w.Root,{defaultOpen:A,onOpenChange:e=>{(f||e)&&(e?en(!0):ez(!0),ee(e))},open:Z},r.default.createElement(y.Provider,{value:{activeSnapPoint:eT,snapPoints:i,setActiveSnapPoint:eR,drawerRef:ew,overlayRef:ei,onOpenChange:n,onPress:function(e){var t,n;!f&&!i||(!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),es.current=new Date,j()&&window.addEventListener("touchend",()=>ef.current=!1,{once:!0}),e.target.setPointerCapture(e.pointerId),em.current=B(z)?e.pageY:e.pageX)},onRelease:function(e){var t,n;if(!er||!ew.current)return;ew.current.classList.remove(H),ef.current=!1,ea(!1),ed.current=new Date;let r=F(ew.current,z);if(!e||!eM(e.target,!1)||!r||Number.isNaN(r)||null===es.current)return;let a=ed.current.getTime()-es.current.getTime(),o=em.current-(B(z)?e.pageY:e.pageX),u=Math.abs(o)/a;if(u>.05&&(el(!0),setTimeout(()=>{el(!1)},200)),i){eD({draggedDistance:o*("bottom"===z||"right"===z?1:-1),closeDrawer:ez,velocity:u,dismissible:f}),null==l||l(e,!0);return}if("bottom"===z||"right"===z?o>0:o<0){eO(),null==l||l(e,!0);return}if(u>.4){ez(),null==l||l(e,!1);return}let s=Math.min(null!=(t=ew.current.getBoundingClientRect().height)?t:0,window.innerHeight),c=Math.min(null!=(n=ew.current.getBoundingClientRect().width)?n:0,window.innerWidth);if(Math.abs(r)>=("left"===z||"right"===z?c:s)*d){ez(),null==l||l(e,!1);return}null==l||l(e,!0),eO()},onDrag:function(e){if(ew.current&&er){let t="bottom"===z||"right"===z?1:-1,n=(em.current-(B(z)?e.pageY:e.pageX))*t,r=n>0,a=i&&!f&&!r;if(a&&0===eC)return;let l=Math.abs(n),s=document.querySelector("[data-vaul-drawer-wrapper]"),d=l/("bottom"===z||"top"===z?ey.current:ex.current),c=eN(l,r);if(null!==c&&(d=c),a&&d>=1||!ef.current&&!eM(e.target,r))return;if(ew.current.classList.add(H),ef.current=!0,L(ew.current,{transition:"none"}),L(ei.current,{transition:"none"}),i&&eE({draggedDistance:n}),r&&!i){let e=Math.min(-(8*(Math.log(n+1)-2)*1),0)*t;L(ew.current,{transform:B(z)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`});return}let p=1-d;if((e$||m&&eC===m-1)&&(null==o||o(e,d),L(ei.current,{opacity:`${p}`,transition:"none"},!0)),s&&ei.current&&u){let e=Math.min(eP()+d*(1-eP()),1),t=8-8*d,n=Math.max(0,14-14*d);L(s,{borderRadius:`${t}px`,transform:B(z)?`scale(${e}) translate3d(0, ${n}px, 0)`:`scale(${e}) translate3d(${n}px, 0, 0)`,transition:"none"},!0)}if(!i){let e=l*t;L(ew.current,{transform:B(z)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})}}},dismissible:f,shouldAnimate:eh,handleOnly:p,isOpen:Z,isDragging:er,shouldFade:e$,closeDrawer:ez,onNestedDrag:function(e,t){if(t<0)return;let n=(window.innerWidth-16)/window.innerWidth,r=n+t*(1-n),a=-16+16*t;L(ew.current,{transform:B(z)?`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),L(ew.current,{transition:`transform 0.5s cubic-bezier(${I.join(",")})`,transform:B(z)?`scale(${t}) translate3d(0, ${n}px, 0)`:`scale(${t}) translate3d(${n}px, 0, 0)`}),!e&&ew.current&&(ep.current=setTimeout(()=>{let e=F(ew.current,z);L(ew.current,{transition:"none",transform:B(z)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})},500))},onNestedRelease:function(e,t){let n=B(z)?window.innerHeight:window.innerWidth,r=t?(n-16)/n:1,a=t?-16:0;t&&L(ew.current,{transition:`transform 0.5s cubic-bezier(${I.join(",")})`,transform:B(z)?`scale(${r}) translate3d(0, ${a}px, 0)`:`scale(${r}) translate3d(${a}px, 0, 0)`})},keyboardIsOpen:eg,modal:x,snapPointsOffset:eS,activeSnapPointIndex:eC,direction:z,shouldScaleBackground:u,setBackgroundColorOnScale:s,noBodyStyles:$,container:J,autoFocus:_}},a))}let V=r.default.forwardRef(function({...e},t){let{overlayRef:n,snapPoints:a,onRelease:o,shouldFade:l,isOpen:i,modal:u,shouldAnimate:s}=x(),d=z(t,n),c=a&&a.length>0;if(!u)return null;let f=r.default.useCallback(e=>o(e),[o]);return r.default.createElement(w.Overlay,{onMouseUp:f,ref:d,"data-vaul-overlay":"","data-vaul-snap-points":i&&c?"true":"false","data-vaul-snap-points-overlay":i&&l?"true":"false","data-vaul-animate":(null==s?void 0:s.current)?"true":"false",...e})});V.displayName="Drawer.Overlay";let K=r.default.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...a},o){let{drawerRef:l,onPress:i,onRelease:u,onDrag:s,keyboardIsOpen:d,snapPointsOffset:c,activeSnapPointIndex:f,modal:p,isOpen:m,direction:g,snapPoints:h,container:v,handleOnly:y,shouldAnimate:b,autoFocus:j}=x(),[T,C]=r.default.useState(!1),R=z(o,l),D=r.default.useRef(null),S=r.default.useRef(null),E=r.default.useRef(!1),$=h&&h.length>0;function N(e){D.current=null,E.current=!1,u(e)}return!function(){let{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:a,noBodyStyles:o}=x(),l=r.default.useRef(null),i=(0,r.useMemo)(()=>document.body.style.backgroundColor,[]);function u(){return(window.innerWidth-26)/window.innerWidth}r.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){}(a&&!o?A(document.body,{background:"black"}):Y,A(t,{transformOrigin:B(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:"0.5s",transitionTimingFunction:`cubic-bezier(${I.join(",")})`}));let n=A(t,{borderRadius:"8px",overflow:"hidden",...B(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(()=>{i?document.body.style.background=i:document.body.style.removeProperty("background")},500)}}},[t,n,i])}(),r.default.useEffect(()=>{$&&window.requestAnimationFrame(()=>{C(!0)})},[]),r.default.createElement(w.Content,{"data-vaul-drawer-direction":g,"data-vaul-drawer":"","data-vaul-delayed-snap-points":T?"true":"false","data-vaul-snap-points":m&&$?"true":"false","data-vaul-custom-container":v?"true":"false","data-vaul-animate":(null==b?void 0:b.current)?"true":"false",...a,ref:R,style:c&&c.length>0?{"--snap-point-height":`${c[null!=f?f:0]}px`,...t}:t,onPointerDown:e=>{y||(null==a.onPointerDown||a.onPointerDown.call(a,e),D.current={x:e.pageX,y:e.pageY},i(e))},onOpenAutoFocus:e=>{null==n||n(e),j||e.preventDefault()},onPointerDownOutside:t=>{(null==e||e(t),!p||t.defaultPrevented)?t.preventDefault():d.current&&(d.current=!1)},onFocusOutside:e=>{if(!p)return void e.preventDefault()},onPointerMove:e=>{if(S.current=e,y||(null==a.onPointerMove||a.onPointerMove.call(a,e),!D.current))return;let t=e.pageY-D.current.y,n=e.pageX-D.current.x,r="touch"===e.pointerType?10:2;((e,t,n=0)=>{if(E.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 E.current=!0,!0})({x:n,y:t},g,r)?s(e):(Math.abs(n)>r||Math.abs(t)>r)&&(D.current=null)},onPointerUp:e=>{null==a.onPointerUp||a.onPointerUp.call(a,e),D.current=null,E.current=!1,u(e)},onPointerOut:e=>{null==a.onPointerOut||a.onPointerOut.call(a,e),N(S.current)},onContextMenu:e=>{null==a.onContextMenu||a.onContextMenu.call(a,e),S.current&&N(S.current)}})});K.displayName="Drawer.Content";let J=r.default.forwardRef(function({preventCycle:e=!1,children:t,...n},a){let{closeDrawer:o,isDragging:l,snapPoints:i,activeSnapPoint:u,setActiveSnapPoint:s,dismissible:d,handleOnly:c,isOpen:f,onPress:p,onDrag:m}=x(),g=r.default.useRef(null),h=r.default.useRef(!1);function v(){g.current&&window.clearTimeout(g.current),h.current=!1}return r.default.createElement("div",{onClick:function(){h.current?v():window.setTimeout(()=>{!function(){if(l||e||h.current)return v();if(v(),!i||0===i.length){d||o();return}if(u===i[i.length-1]&&d)return o();let t=i.findIndex(e=>e===u);-1===t||s(i[t+1])}()},120)},onPointerCancel:v,onPointerDown:e=>{c&&p(e),g.current=window.setTimeout(()=>{h.current=!0},250)},onPointerMove:e=>{c&&m(e)},ref:a,"data-vaul-drawer-visible":f?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},r.default.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});J.displayName="Drawer.Handle";let _={Root:X,NestedRoot:function({onDrag:e,onOpenChange:t,open:n,...a}){let{onNestedDrag:o,onNestedOpenChange:l,onNestedRelease:i}=x();if(!o)throw Error("Drawer.NestedRoot must be placed in another drawer");return r.default.createElement(X,{nested:!0,open:n,onClose:()=>{l(!1)},onDrag:(t,n)=>{o(t,n),null==e||e(t,n)},onOpenChange:e=>{e&&l(e),null==t||t(e)},onRelease:i,...a})},Content:K,Overlay:V,Trigger:w.Trigger,Portal:function(e){let t=x(),{container:n=t.container,...a}=e;return r.default.createElement(w.Portal,{container:n,...a})},Handle:J,Close:w.Close,Title:w.Title,Description:w.Description};var G=e.i(31777);function Q({...e}){return(0,n.jsx)(_.Root,{"data-slot":"drawer",...e})}function Z({...e}){return(0,n.jsx)(_.Portal,{"data-slot":"drawer-portal",...e})}function ee({className:e,...t}){return(0,n.jsx)(_.Overlay,{"data-slot":"drawer-overlay",className:(0,G.cn)("fixed inset-0 z-50 bg-black/50",e),...t})}function et({className:e,children:t,direction:r="bottom",showCloseButton:a=!0,...o}){return(0,n.jsx)(Z,{children:(0,n.jsxs)(_.Content,{"data-slot":"drawer-content",className:(0,G.cn)("bg-background fixed z-50 flex flex-col shadow-lg","bottom"===r&&"inset-x-0 bottom-0 mb-24 rounded-t-lg border-t","top"===r&&"inset-x-0 top-0 mt-24 rounded-b-lg border-b","right"===r&&"inset-y-0 right-0 h-full w-3/4 border-l","left"===r&&"inset-y-0 left-0 h-full w-3/4 border-r",e),style:{"--initial-transform":"calc(100% + 8px)",userSelect:"text",...o.style??{}},...o,children:[t,a?(0,n.jsxs)(_.Close,{className:"ring-offset-background focus:ring-ring absolute end-4 top-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)(v.XIcon,{className:"size-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Close"})]}):null]})})}function en({className:e,...t}){return(0,n.jsx)("div",{"data-slot":"drawer-header",className:(0,G.cn)("flex flex-col gap-1.5 p-4",e),...t})}function er({className:e,...t}){return(0,n.jsx)("div",{"data-slot":"drawer-footer",className:(0,G.cn)("mt-auto flex flex-col gap-2 p-4",e),...t})}function ea({className:e,...t}){return(0,n.jsx)(_.Title,{"data-slot":"drawer-title",className:(0,G.cn)("text-foreground font-semibold",e),...t})}function eo({className:e,...t}){return(0,n.jsx)(_.Description,{"data-slot":"drawer-description",className:(0,G.cn)("text-muted-foreground text-sm",e),...t})}e.s(["Drawer",()=>Q,"DrawerContent",()=>et,"DrawerDescription",()=>eo,"DrawerFooter",()=>er,"DrawerHeader",()=>en,"DrawerOverlay",()=>ee,"DrawerTitle",()=>ea],45811)},11495,e=>{"use strict";var t=e.i(20314),n=e.i(79054),r=e.i(48249),a=e.i(24042),o=e.i(6910),l=e.i(94237),i=e.i(31777);e.i(81803);var u=e.i(72714);e.i(99348);var s=e.i(5259),d=e.i(45811),c=e.i(25235),f=e.i(2828);e.i(41001);var p=e.i(64780),m=e.i(8537),g=e.i(75921);let h=(0,l.cva)("",{variants:{size:{sm:"w-96",md:"w-2xl",lg:"w-[772px]"}},defaultVariants:{size:"sm"}});function v({open:e,onClose:a,modal:o=!1,dismissOnOutsideClick:l=!1,title:u="Drawer",size:s,header:f,children:m,footer:v,className:y,"data-testid":x,deployTarget:b}){let{i18n:j}=(0,p.useTranslation)(),T=(0,g.useFeatureFlags)(),C=(0,n.useRef)(null),R="rtl"===j.dir()?"left":"right";return(0,n.useEffect)(()=>{if(!e||o)return;let t=e=>{let t=e.target;!document.body.contains(t)||C.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:R,modal:o,handleOnly:!0,open:e,onOpenChange:e=>{e||a()},children:[o?(0,t.jsx)(d.DrawerOverlay,{}):null,(0,t.jsxs)(d.DrawerContent,{ref:C,direction:R,showCloseButton:!1,className:(0,i.cn)(h({size:s}),"bg-white/85 backdrop-blur-xl dark:bg-neutral-800/85",y),"data-testid":x,onInteractOutside:o?void 0:e=>e.preventDefault(),children:[(0,t.jsx)(d.DrawerTitle,{asChild:!0,children:(0,t.jsx)("span",{className:"sr-only",children:u})}),(0,t.jsx)(d.DrawerDescription,{asChild:!0,children:(0,t.jsx)("span",{className:"sr-only",children:u})}),(0,t.jsxs)("button",{type:"button","aria-label":"Close",onClick:a,className:"ring-offset-background focus:ring-ring absolute end-3 top-2 z-50 rounded-sm p-1 opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden","data-testid":x?`${x}-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,T.envDeploy&&b?(0,t.jsx)(w,{deployTarget:b}):null,(0,t.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:m}),v?(0,t.jsx)(d.DrawerFooter,{className:"shrink-0",children:v}):null]})]})}function w({deployTarget:e}){let n=(0,m.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 pt-3 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)(u.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)(s.DeploymentStatusBadge,{status:n.status,url:n.url,targetId:e.targetId}):null]})}e.s(["BaseDrawer",()=>v])}]);