mastra 1.40.2-alpha.2 → 1.40.2-alpha.4

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 (163) hide show
  1. package/dist/docs/SKILL.md +1 -1
  2. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  3. package/dist/factory/assets/AlertDialog.es-Z2cFKrup.js +1 -0
  4. package/dist/factory/assets/BoardConfigPage-CNnVTJJ0.js +1 -0
  5. package/dist/factory/assets/BoardIcons-DXB--WrY.js +1 -0
  6. package/dist/factory/assets/BoardIntakePage-1Qjo4ul-.js +1 -0
  7. package/dist/factory/assets/BoardRulesPage-CIAfbl-f.js +1 -0
  8. package/dist/factory/assets/Breadcrumb.es-D9PSmzYq.js +1 -0
  9. package/dist/factory/assets/{Card-BbxDmj8W-9N7pulL8.js → Card-BbxDmj8W-BRp0MNo6.js} +1 -1
  10. package/dist/factory/assets/CodeBlock.es-BeD4YikJ.js +6 -0
  11. package/dist/factory/assets/CodeEditor-CfxlNg4f-D29InJfs.js +1 -0
  12. package/dist/factory/assets/{Command.es-DYj7l4_8.js → Command.es-Dzh7LzCA.js} +2 -2
  13. package/dist/factory/assets/CompositeItem-CD2x3KaL.js +1 -0
  14. package/dist/factory/assets/CompositeRoot-C9XORM0H.js +1 -0
  15. package/dist/factory/assets/ConditionRows-CJG9M2Dv.js +1 -0
  16. package/dist/factory/assets/CreateFactoryPage-lJR2YkRF.js +1 -0
  17. package/dist/factory/assets/{DescriptionMarkdown-BH7uH0Yx.js → DescriptionMarkdown-CoP2xvHU.js} +1 -1
  18. package/dist/factory/assets/FactorySkillPage-jc5BL6ZL.js +3 -0
  19. package/dist/factory/assets/FactorySkillsPage-CXHW7kNe.js +1 -0
  20. package/dist/factory/assets/Field.es-BmqB8MIv.js +1 -0
  21. package/dist/factory/assets/{GithubIcon.es-BPBhMx2H.js → GithubIcon.es-B1lB1Q-8.js} +5 -5
  22. package/dist/factory/assets/HrefLink-Q5kgIdVD.js +1 -0
  23. package/dist/factory/assets/IconArrowRotateClockwise.es-C13-sgU6.js +1 -0
  24. package/dist/factory/assets/{IconFormCircle.es-DRfpxito.js → IconFormCircle.es-DT5Y3tym.js} +1 -1
  25. package/dist/factory/assets/IconPencil.es-D_eBYY1c.js +1 -0
  26. package/dist/factory/assets/IconScript.es-b9CvRY9n.js +1 -0
  27. package/dist/factory/assets/IconSettingsSliderHor.es-CSwP_iSG.js +1 -0
  28. package/dist/factory/assets/IconUserDuo.es-0xR_m2_v.js +1 -0
  29. package/dist/factory/assets/{Input-DTmflfQ4.js → Input-CNUJ--WV.js} +1 -1
  30. package/dist/factory/assets/InputNumber.es-BoS5sRR-.js +1 -0
  31. package/dist/factory/assets/KnowledgePage-J33Xcyhj.js +13 -0
  32. package/dist/factory/assets/LoadErrorState-DVbqZ6DX.js +1 -0
  33. package/dist/factory/assets/{MarkdownRenderer-Y8TNNi2F-Dq4iwrPa.js → MarkdownRenderer-CfkpBq7t-B3F-Cy2O.js} +3 -3
  34. package/dist/factory/assets/MastraGatewayBilling-ButNucYj.js +1 -0
  35. package/dist/factory/assets/NewBoardPage-a5zbVJZr.js +2 -0
  36. package/dist/factory/assets/NewPage-CAC_4Xst.js +1 -0
  37. package/dist/factory/assets/OnboardingPage-COpr2FmK.js +1 -0
  38. package/dist/factory/assets/{ProviderBrandIcon-C7mph6N5.js → ProviderBrandIcon-B-aKKQdi.js} +1 -1
  39. package/dist/factory/assets/RadioGroup-CM2PCyNZ.js +1 -0
  40. package/dist/factory/assets/{RadioGroup.es-CyxlfqIJ.js → RadioGroup.es-Ws4_oCJe.js} +1 -1
  41. package/dist/factory/assets/RootGuards-dZlWJMm5.js +1 -0
  42. package/dist/factory/assets/RulesPage-D6xs4PcH.js +1 -0
  43. package/dist/factory/assets/SearchInput.es-CzE_Qk4w.js +1 -0
  44. package/dist/factory/assets/SessionLayout-D9E5aqnm.js +4 -0
  45. package/dist/factory/assets/SessionPage-DStU9z1q.js +1 -0
  46. package/dist/factory/assets/SessionSharingPopover-B-YZDS4X.js +1 -0
  47. package/dist/factory/assets/SettingsPage-hHef3e63.js +3 -0
  48. package/dist/factory/assets/SettingsSubsection-DznON6FW.js +1 -0
  49. package/dist/factory/assets/Sidebar.es-9pwBnu_Z.js +1 -0
  50. package/dist/factory/assets/SignInPage-NxXJAPal.js +1 -0
  51. package/dist/factory/assets/SkeletonRows-6RPIfKEw.js +1 -0
  52. package/dist/factory/assets/SkillBadges-DbbPhC5O.js +1 -0
  53. package/dist/factory/assets/SlackConnectionPage-Cnp4CA2n.js +1 -0
  54. package/dist/factory/assets/{StackedDiffs-BFXdSF8w.js → StackedDiffs-BCYXM5ZL.js} +1 -1
  55. package/dist/factory/assets/TabsRoot-C1o0G1CK.js +1 -0
  56. package/dist/factory/assets/{ThinkingLevel.es-Dk-VbgE7.js → ThinkingLevel.es-D6B6ha12.js} +1 -1
  57. package/dist/factory/assets/{Tree-B90XgTY4-cZ-SkEZr.js → Tree-B90XgTY4-D-CiuNjX.js} +1 -1
  58. package/dist/factory/assets/{buttons-group-DA_wORqQ-BsTwZ3ww.js → buttons-group-DA_wORqQ-DfA-q_d9.js} +1 -1
  59. package/dist/factory/assets/combobox-parts-s-DJvMW4-CR5ZbuEq.js +1 -0
  60. package/dist/factory/assets/copy-button-Brk8iwgE-DHsIfP0z.js +1 -0
  61. package/dist/factory/assets/{esm-DH1__fiI.js → esm-Dp9Y59hS.js} +1 -1
  62. package/dist/factory/assets/index-4Y__z3vn.css +1 -0
  63. package/dist/factory/assets/index-D4fnG4KO.js +125 -0
  64. package/dist/factory/assets/{input-DqReKX0A-BMaPtvZH.js → input-DqReKX0A-B4MUvQwj.js} +3 -3
  65. package/dist/factory/assets/{input-group-CXvse9n7-C3ds8HOQ.js → input-group-C2kg3je7-38FwKlyX.js} +1 -1
  66. package/dist/factory/assets/{onboardingFlow-DHRTMH3J.js → onboardingFlow-D-slZE6d.js} +1 -1
  67. package/dist/factory/assets/relative-time.es-DgA3Kbhv.js +1 -0
  68. package/dist/factory/assets/{ruleLanes-DEg70O95.js → ruleLanes-D9QkgLJm.js} +1 -1
  69. package/dist/factory/assets/select-Bdt18YBg-DJqvU5Dv.js +1 -0
  70. package/dist/factory/assets/settings-DTWGb7K_-PW2CFx0g.js +1 -0
  71. package/dist/factory/assets/{spinner-B9ykw74u-BLKI_KJ9.js → spinner-B9ykw74u-oAX9C1zS.js} +1 -1
  72. package/dist/factory/assets/{useBoardCatalog-vK4woIAH.js → useBoardCatalog-DZf1osB2.js} +1 -1
  73. package/dist/factory/assets/useBoardEditor-Dm78Yoiu.js +1 -0
  74. package/dist/factory/assets/useChatSessionContext-BHyuVY1T.js +1 -0
  75. package/dist/factory/assets/useDraftModelGuards-C_NJl4y3.js +29 -0
  76. package/dist/factory/assets/useDraftModelGuards-Cky35Lcg.css +1 -0
  77. package/dist/factory/assets/useFactoryDecisions-C9GWqAN_.js +1 -0
  78. package/dist/factory/assets/{useGlobalSearchControls-CicrSU7j.js → useGlobalSearchControls-BbAiVtBx.js} +1 -1
  79. package/dist/factory/assets/{useInfiniteQuery-BayiW-x6.js → useInfiniteQuery-hSoUGHIM.js} +1 -1
  80. package/dist/factory/assets/useIntakeRoutes-BNBPe6sx.js +1 -0
  81. package/dist/factory/assets/useLinearData-XOkwHgla.js +1 -0
  82. package/dist/factory/assets/{usePlatformConnections-CYfXtAjx.js → usePlatformConnections-R32iBFFQ.js} +1 -1
  83. package/dist/factory/assets/useRouteSessionId-DhLFIOOv.js +1 -0
  84. package/dist/factory/assets/{useRowDrag-Bmj1hhAE.js → useRowDrag-DQBjWerU.js} +1 -1
  85. package/dist/factory/assets/{useSessionCard-Cva55kO-.js → useSessionCard-CiybjeGQ.js} +1 -1
  86. package/dist/factory/assets/{useSessionRepository-D8yeB29J.js → useSessionRepository-BEhYLqfE.js} +1 -1
  87. package/dist/factory/assets/useSessionRows-aTHnrKGG.js +1 -0
  88. package/dist/factory/assets/{useThreadWorkspacePath-BAc6-H_t.js → useThreadWorkspacePath-B11HTzns.js} +1 -1
  89. package/dist/factory/assets/workspaces-ybaLGjJ3.js +2 -0
  90. package/dist/factory/index.html +45 -44
  91. package/dist/index.js +1 -1
  92. package/dist/studio/assets/{index-B4zG_u8m.js → index-D79YwdXE.js} +2 -2
  93. package/dist/studio/assets/{main-CEtWndOQ.js → main-I58UwnyS.js} +391 -328
  94. package/dist/studio/assets/style-Du5ShnBp.css +3 -0
  95. package/dist/studio/index.html +2 -2
  96. package/package.json +4 -4
  97. package/dist/factory/assets/AlertDialog.es-DDAl3sXA.js +0 -1
  98. package/dist/factory/assets/BoardConfigPage-Dan9VyhL.js +0 -1
  99. package/dist/factory/assets/BoardIcons-Cml_taka.js +0 -1
  100. package/dist/factory/assets/BoardIntakePage-BYZy_ru_.js +0 -1
  101. package/dist/factory/assets/BoardRulesPage-CxNhQl3d.js +0 -1
  102. package/dist/factory/assets/Breadcrumb.es-BpvMnN1l.js +0 -1
  103. package/dist/factory/assets/CodeBlock.es-lPYMhQRD.js +0 -6
  104. package/dist/factory/assets/CodeEditor-DmElSGLM-BqTClSRY.js +0 -1
  105. package/dist/factory/assets/CompositeRoot-DSl5I499.js +0 -1
  106. package/dist/factory/assets/ConditionRows-DJVG4EHd.js +0 -1
  107. package/dist/factory/assets/CreateFactoryPage-CoxfdoDW.js +0 -1
  108. package/dist/factory/assets/FactorySkillPage-ix3Ct4E0.js +0 -3
  109. package/dist/factory/assets/FactorySkillsPage-SPaAjjue.js +0 -1
  110. package/dist/factory/assets/Field.es-BPlWASZ-.js +0 -1
  111. package/dist/factory/assets/HrefLink-C-5Xp-pL.js +0 -1
  112. package/dist/factory/assets/IconArrowRotateClockwise.es-DnnDHxyi.js +0 -1
  113. package/dist/factory/assets/IconLock.es-9mYeLe9c.js +0 -1
  114. package/dist/factory/assets/IconMerged.es-BudaK6HC.js +0 -1
  115. package/dist/factory/assets/IconPencil.es-C5rZ8A6j.js +0 -1
  116. package/dist/factory/assets/IconScript.es-BQPM-6BN.js +0 -1
  117. package/dist/factory/assets/IconUserDuo.es-X0H45vYw.js +0 -1
  118. package/dist/factory/assets/InputNumber.es-Dvj2CMW7.js +0 -1
  119. package/dist/factory/assets/KnowledgePage-nfIFPgp6.js +0 -13
  120. package/dist/factory/assets/LoadErrorState-CtPpeSh8.js +0 -1
  121. package/dist/factory/assets/Logo-DGvSvSWS.css +0 -1
  122. package/dist/factory/assets/Logo.es-Cc55x-sI.js +0 -1
  123. package/dist/factory/assets/MastraGatewayBilling-Bpx-h8Vt.js +0 -1
  124. package/dist/factory/assets/NewBoardPage-VIlgPMpB.js +0 -2
  125. package/dist/factory/assets/NewPage-BnMyEhkh.js +0 -1
  126. package/dist/factory/assets/OnboardingPage-CHfAWT72.js +0 -1
  127. package/dist/factory/assets/RadioGroup-CDj-r4Ik.js +0 -1
  128. package/dist/factory/assets/RootGuards-DQCyOUvo.js +0 -1
  129. package/dist/factory/assets/RulesPage-Bm395CUB.js +0 -1
  130. package/dist/factory/assets/SearchInput.es-ClJxNeIv.js +0 -1
  131. package/dist/factory/assets/SessionLayout-BShjmacL.js +0 -4
  132. package/dist/factory/assets/SessionPage-B9E-jG8M.js +0 -1
  133. package/dist/factory/assets/SessionSharingPopover-Bpr3D3Hc.js +0 -1
  134. package/dist/factory/assets/SettingsPage-BKDcpSlF.js +0 -3
  135. package/dist/factory/assets/SettingsSubsection-BGJrlda9.js +0 -1
  136. package/dist/factory/assets/Sidebar.es-DSPzNNju.js +0 -1
  137. package/dist/factory/assets/SignInPage-DUISUrUI.js +0 -1
  138. package/dist/factory/assets/SkeletonRows-C85xPCWB.js +0 -1
  139. package/dist/factory/assets/SkillBadges-BN_VjOtf.js +0 -1
  140. package/dist/factory/assets/SlackConnectionPage-ChNhPiV-.js +0 -1
  141. package/dist/factory/assets/combobox-parts-Bmj5kzrt-DzYjyBt5.js +0 -1
  142. package/dist/factory/assets/copy-button-5PzdvEQI-xyTDh-Ck.js +0 -1
  143. package/dist/factory/assets/icons-C18D46Pv.js +0 -1
  144. package/dist/factory/assets/index-Bi7K7czv.css +0 -1
  145. package/dist/factory/assets/index-CD4tM4nf.js +0 -125
  146. package/dist/factory/assets/lib-DkXXjRNC.js +0 -1
  147. package/dist/factory/assets/page-header-Maytcmgh--oRyXaDt.js +0 -1
  148. package/dist/factory/assets/page-header-Maytcmgh-B6awZy-2.css +0 -1
  149. package/dist/factory/assets/settings-DAvFqX1V-D4umTesm.js +0 -1
  150. package/dist/factory/assets/settingsColumn-CrKuH8q1.js +0 -1
  151. package/dist/factory/assets/useBoardEditor-DiWa4Lcl.js +0 -1
  152. package/dist/factory/assets/useChatSessionContext-DVtYX3bf.js +0 -1
  153. package/dist/factory/assets/useDraftModelGuards-Bna6hyHj.css +0 -1
  154. package/dist/factory/assets/useDraftModelGuards-BwRi1qov.js +0 -29
  155. package/dist/factory/assets/useFactoryDecisions-DJSz_rYq.js +0 -1
  156. package/dist/factory/assets/useIntakeRoutes-CdL4o1Vv.js +0 -1
  157. package/dist/factory/assets/useLinearData-C1EljeRN.js +0 -1
  158. package/dist/factory/assets/useRouteSessionId-BHCXPCt_.js +0 -1
  159. package/dist/factory/assets/useSessionRows-BXScIz1L.js +0 -1
  160. package/dist/factory/assets/workspaces-CF_kIkTd.js +0 -2
  161. package/dist/studio/assets/style-CW1SmVpP.css +0 -3
  162. /package/dist/factory/assets/{MarkdownRenderer-Y8TNNi2F-C04mQel5.css → MarkdownRenderer-CfkpBq7t-C04mQel5.css} +0 -0
  163. /package/dist/factory/assets/{combobox-parts-Bmj5kzrt-CYlMQsMB.css → combobox-parts-s-DJvMW4-CYlMQsMB.css} +0 -0
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{O as t,b as n,k as r,m as i,x as a,y as o}from"./IconChevronRightMedium.es-BjSIsine.js";import{gt as s,mt as c}from"./useSessionRows-aTHnrKGG.js";import{Bn as l,Fn as u,Ga as d,Hi as f,Hn as p,In as m,Ka as h,Ln as g,Os as _,Pn as v,Rn as y,Ua as b,Un as x,Xa as S,Ya as C,ao as w,as as T,ui as E}from"./GithubIcon.es-B1lB1Q-8.js";var D=e(r(),1),O=`data-composite-item-active`;function k(e){let{loopFocus:t=!0,orientation:r=`both`,grid:i,onLoop:a,direction:c,highlightedIndex:l,onHighlightedIndexChange:f,rootRef:E,enableHomeAndEndKeys:O=!1,stopEventPropagation:k,disabledIndices:M,modifierKeys:N=n}=e,[P,F]=D.useState(0),I=i!=null,L=D.useRef(null),R=o(L,E),z=D.useRef([]),B=D.useRef(!1),V=D.useRef(null),H=l??P,U=w((e,t=!1)=>{if(V.current=z.current[e]??null,(f??F)(e),t){let t=z.current[e];x(L.current,t,c,r)}}),W=w(e=>{if(e.size===0)return;if(B.current){let e=z.current,t=e.indexOf(V.current);if(t===-1){let t=e[H];!t||S(e,H,M)?U(A(e,M)):V.current=t}else t!==H&&U(t);return}B.current=!0;let t=Array.from(e.keys()),n=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=n?e.get(n)?.index??-1:-1;if(i!==-1)U(i);else if(S(t,H,M)){let e=b(t,{disabledIndices:M});C(t,e)||U(e)}x(L.current,n,c,r)});_(()=>{if(M==null||l!=null||!B.current)return;let e=z.current;if(S(e,H,M)){let t=b(e,{disabledIndices:M});C(e,t)||U(t)}},[M,l,H,z,U]);let G=w((e,t,n)=>a?a(e,t,n,z):n),K=w(e=>{let n=e.key===`Home`||e.key===`End`;if(!y.has(e.key)||!O&&n||j(e,N)||!L.current)return;let o=c===`rtl`,l=o?u:m,f=o?m:u,_=r===`vertical`?v:l,x=r===`vertical`?g:f,S=T(e.nativeEvent);if(S!=null&&p(S)&&!s(S)){let t=S.selectionStart,n=S.selectionEnd,r=S.value;if(t==null||e.shiftKey||t!==n||e.key!==x&&t<r.length||e.key!==_&&t>0)return}let w=H,E=h(z,M),D=d(z,M);i!=null&&(w=i({disabledIndices:M,elementsRef:z,event:e,highlightedIndex:H,loopFocus:t,maxIndex:D,minIndex:E,onLoop:G,orientation:r,rtl:o}));let A=r!==`vertical`&&e.key===l||r!==`horizontal`&&e.key===`ArrowDown`,P=r!==`vertical`&&e.key===f||r!==`horizontal`&&e.key===`ArrowUp`;O&&(e.key===`Home`?w=E:e.key===`End`&&(w=D)),w===H&&(A||P)&&(t&&w===D&&A?(w=E,a&&(w=a(e,H,w,z))):t&&w===E&&P?(w=D,a&&(w=a(e,H,w,z))):w=b(z.current,{startingIndex:w,decrement:P,disabledIndices:M})),w!==H&&!C(z.current,w)&&(k&&e.stopPropagation(),(I||n||A||P)&&e.preventDefault(),U(w,!0),queueMicrotask(()=>{z.current[w]?.focus()}))});return{props:{ref:R,onFocus(e){let t=L.current,n=T(e.nativeEvent);t&&n!=null&&p(n)&&n.setSelectionRange(0,n.value.length)},onKeyDown:K},highlightedIndex:H,onHighlightedIndexChange:U,elementsRef:z,onMapChange:W,relayKeyboardEvent:K}}function A(e,t){let n=-1;for(let r=0;r<e.length;r+=1){let i=e[r];if(i&&!S(e,r,t)){if(i.hasAttribute(`data-composite-item-active`))return r;n===-1&&(n=r)}}return Math.max(n,0)}function j(e,t){for(let n of l)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}var M=t();function N(e){let{render:t,className:r,style:o,refs:s=n,props:l=n,state:u=a,stateAttributesMapping:d,highlightedIndex:p,onHighlightedIndexChange:m,orientation:h,grid:g,loopFocus:_,onLoop:v,enableHomeAndEndKeys:y,onMapChange:b,stopEventPropagation:x=!0,rootRef:S,disabledIndices:C,modifierKeys:w,highlightItemOnHover:T=!1,tag:O=`div`,...A}=e,{props:j,highlightedIndex:N,onHighlightedIndexChange:P,elementsRef:F,onMapChange:I,relayKeyboardEvent:L}=k({grid:g,loopFocus:_,onLoop:v,orientation:h,highlightedIndex:p,onHighlightedIndexChange:m,rootRef:S,stopEventPropagation:x,enableHomeAndEndKeys:y,direction:f(),disabledIndices:C,modifierKeys:w}),R=i(O,e,{state:u,ref:s,props:[j,...l,A],stateAttributesMapping:d}),z=D.useMemo(()=>({highlightedIndex:N,onHighlightedIndexChange:P,highlightItemOnHover:T,relayKeyboardEvent:L}),[N,P,T,L]);return(0,M.jsx)(E.Provider,{value:z,children:(0,M.jsx)(c,{elementsRef:F,onMapChange:e=>{b?.(e),I(e)},children:R})})}export{O as n,N as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{O as t,T as n,f as r,i,k as a,n as o,s}from"./IconChevronRightMedium.es-BjSIsine.js";import{c,h as l,ni as u,qn as d}from"./GithubIcon.es-B1lB1Q-8.js";import{i as f,n as p,r as m,t as h}from"./select-Bdt18YBg-DJqvU5Dv.js";import{J as g,q as _}from"./useSessionRows-aTHnrKGG.js";import{t as ee}from"./IconPlusMedium.es-QmObHPf-.js";import{a as v,c as y,d as b,i as x,l as S,s as C,u as w}from"./combobox-parts-s-DJvMW4-CR5ZbuEq.js";import{t as te}from"./IconUser.es-8QnHQfy-.js";import{t as ne}from"./IconCircleCheck.es-e9o_0ikv.js";import{D as re,O as ie,S as ae,b as T,x as E}from"./ruleLanes-D9QkgLJm.js";import{m as oe}from"./useIntakeRoutes-BNBPe6sx.js";import{t as se}from"./createLucideIcon-B6gALBEh.js";import{t as ce}from"./TrashIcon.es-CLx-KWTg.js";import{t as le}from"./IconUserDuo.es-0xR_m2_v.js";import{t as ue}from"./input-DqReKX0A-B4MUvQwj.js";import{d as de,o as fe,r as pe}from"./useLinearData-XOkwHgla.js";import{Bn as D,En as me,Sr as he,kn as ge,vr as _e,yr as ve,zn as O}from"./index-D4fnG4KO.js";import{t as ye}from"./IconHashtag.es-DPNqJOUe.js";import{t as k}from"./IconPlugin1.es-cRNReen7.js";import{t as A}from"./IconShieldCheck.es-vPJGxBAr.js";var j={name:`folder-git-2`,size:24,node:[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]};j.node;var be=se(j);function xe({factoryProjectId:e,repositories:t=[],bindings:n=[],linearProjects:r=[],linearTeams:i=[],jiraProjects:a=[]}){let o=t=>new Set(n.filter(n=>n.integrationId===t&&n.factoryProjectId===e).map(e=>e.sourceId)),s=o(`linear`),c=o(`jira`),l=[...t.map(e=>({value:e.slug,provider:e.provider??`github`})),...r.filter(e=>s.has(e.id)).flatMap(e=>e.teams.map(e=>({value:e.key,provider:`linear`}))),...i.filter(e=>s.has(de(e))).map(e=>({value:e.key,provider:`linear`})),...a.filter(e=>c.has(e.id)).map(e=>({value:e.key,provider:`jira`}))],u=new Set;return l.filter(e=>{let t=`${e.provider}\0${e.value.toLowerCase()}`;return!u.has(t)&&(u.add(t),!0)})}var Se=e=>`provider`in e&&typeof e.provider==`string`;function Ce(e,t){if(!Array.isArray(e.suggestions))return e;let n=ve(t),r=new Set;return{...e,suggestions:e.suggestions.filter(e=>{if(n&&Se(e)&&!n.has(e.provider))return!1;let t=e.value.toLowerCase();return!r.has(t)&&(r.add(t),!0)})}}function we(e){let t=c(e),n=l(),r=t=>(n.data??[]).some(n=>n.integrationId===t&&n.factoryProjectId===e),i=pe(r(`linear`)),a=fe(r(`linear`)),o=ge(r(`jira`));return xe({factoryProjectId:e,repositories:t.data?.repositories,bindings:n.data,linearProjects:i.data?.projects,linearTeams:a.data?.teams,jiraProjects:o.data})}var M=t(),N=`flex h-control-sm w-14 shrink-0 items-center`;function P({className:e,...t}){return(0,M.jsx)(`div`,{"data-slot":`rule-lines`,className:n(`flex flex-col gap-2`,e),...t})}function F({className:e,...t}){return(0,M.jsx)(`div`,{"data-slot":`rule-line`,className:n(`flex items-start gap-2`,e),...t})}function I({className:e,children:t,...r}){return(0,M.jsx)(`span`,{"data-slot":`rule-line-keyword`,"aria-hidden":t===void 0||void 0,className:n(N,i({variant:`caption`,tone:`muted`}),e),...r,children:t})}function Te({value:e,onValueChange:t,"aria-label":n=`Match all or any`}){return(0,M.jsx)(`div`,{"data-slot":`rule-line-logic`,className:N,children:(0,M.jsxs)(h,{value:e,onValueChange:e=>e&&t(e),children:[(0,M.jsx)(f,{size:`sm`,variant:`ghost`,"aria-label":n,className:`-ml-2 w-fit px-2`,children:(0,M.jsx)(`span`,{className:i({variant:`caption`,tone:`ink`}),children:e===`AND`?`and`:`or`})}),(0,M.jsxs)(p,{children:[(0,M.jsx)(m,{value:`AND`,children:`and`}),(0,M.jsx)(m,{value:`OR`,children:`or`})]})]})})}function L({className:e,...t}){return(0,M.jsx)(`div`,{"data-slot":`rule-line-content`,className:n(`flex min-h-control-sm min-w-0 flex-1 flex-wrap items-center gap-1.5`,e),...t})}function Ee({depth:e,className:t,...r}){return(0,M.jsx)(`div`,{role:`group`,"data-slot":`rule-line-group`,className:n(`flex min-w-0 flex-1 items-start gap-2 rounded-lg border border-border p-2`,e%2==0?`bg-fill-subtle`:`bg-card`,`[&>[data-slot=rule-lines]]:min-w-0 [&>[data-slot=rule-lines]]:flex-1`,t),...r})}function De({className:e,...t}){return(0,M.jsx)(u,{variant:`ghost`,size:`icon-sm`,className:n(`ml-auto`,e),...t,children:(0,M.jsx)(d,{})})}function Oe({className:e,children:t,...r}){return(0,M.jsxs)(u,{variant:`ghost`,size:`sm`,className:n(`ml-auto`,e),...r,children:[(0,M.jsx)(ce,{}),t]})}function ke({className:e,...t}){return(0,M.jsx)(`span`,{"data-slot":`rule-line-hint`,className:n(i({variant:`caption`,tone:`muted`}),`px-1`,e),...t})}function R({icon:e,className:t,children:r,...a}){return(0,M.jsxs)(`button`,{type:`button`,"data-slot":`rule-add-button`,className:n(i({variant:`caption`,tone:`muted`}),`inline-flex h-control-sm items-center gap-1.5 rounded-full border border-dashed border-border px-3 hover:border-border-strong hover:text-foreground [&_svg]:size-icon-sm`,s,t),...a,children:[e,r]})}var Ae=r(`IconColumns3`,()=>(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`path`,{d:`M18 4H6C4.89543 4 4 4.89543 4 6V18C4 19.1046 4.89543 20 6 20H18C19.1046 20 20 19.1046 20 18V6C20 4.89543 19.1046 4 18 4Z`,stroke:`currentColor`,strokeWidth:`2`,strokeLinejoin:`round`}),(0,M.jsx)(`path`,{d:`M9.33984 4V20`,stroke:`currentColor`,strokeWidth:`2`}),(0,M.jsx)(`path`,{d:`M14.6602 4V20`,stroke:`currentColor`,strokeWidth:`2`})]})),je=r(`IconFontStyle`,()=>(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M19.4639 19H20C20.5523 19 21 19.4477 21 20C21 20.5523 20.5523 21 20 21H14.5C13.9477 21 13.5 20.5523 13.5 20C13.5 19.4477 13.9477 19 14.5 19H15.2578L13.9551 15H8.15625L6.85449 19H7.5C8.05228 19 8.5 19.4477 8.5 20C8.5 20.5523 8.05228 21 7.5 21H4.5C3.94772 21 3.5 20.5523 3.5 20C3.5 19.4477 3.94772 19 4.5 19H4.75L9.29418 5.04203C9.69064 3.82426 10.8258 3 12.1065 3C13.3871 3 14.5223 3.82418 14.9188 5.04188L19.4639 19ZM8.80762 13H13.3037L11.3409 6.97096C11.251 6.69479 10.8603 6.69479 10.7704 6.97096L8.80762 13Z`,fill:`currentColor`})),Me=r(`IconMerged`,()=>(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`circle`,{cx:`6`,cy:`6`,r:`2`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,M.jsx)(`circle`,{cx:`6`,cy:`18`,r:`2`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,M.jsx)(`circle`,{cx:`18`,cy:`18`,r:`2`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,M.jsx)(`path`,{d:`M6 8V16`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,M.jsx)(`path`,{d:`M8 6H16C17.1046 6 18 6.89543 18 8V16`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})]})),Ne=r(`IconZap`,()=>(0,M.jsx)(`path`,{d:`M19.5657 9H13.5C13.2239 9 13 8.77614 13 8.5V2.40139C13 1.90668 12.3584 1.71242 12.084 2.12404L4.01823 14.2226C3.79672 14.5549 4.03491 15 4.43426 15H10.5C10.7761 15 11 15.2239 11 15.5V21.5986C11 22.0933 11.6416 22.2876 11.916 21.876L19.9818 9.77735C20.2033 9.44507 19.9651 9 19.5657 9Z`,stroke:`currentColor`,strokeWidth:`2`,strokeLinejoin:`round`})),z=e(a(),1),B=new Set([`exists`,`not_exists`]),V=new Set([`in`,`not_in`]),H=e=>`items`in e,Pe=0,U=()=>`condition-${++Pe}`,W=()=>({key:U(),field:``,operator:``}),Fe=e=>e+2<=3;function Ie(e){let t=e=>`conditions`in e?{key:U(),logic:e.operator,items:e.conditions.map(t)}:{key:U(),field:e.field,operator:e.operator,value:e.value};return{key:`root`,logic:e?.operator??`AND`,items:e?.conditions.map(t)??[]}}var Le=e=>oe.some(t=>t===e);function Re(e){if(!e.field)return!1;if(B.has(e.operator))return!0;let{value:t}=e;return t===void 0?!1:Array.isArray(t)?t.length>0:typeof t!=`string`||t.trim()!==``}function G(e){let t=!1,n=e=>{if(H(e)){let t=e.items.map(n).filter(e=>e!==void 0);return t.length>0?{operator:e.logic,conditions:t}:void 0}let{operator:r}=e;if(!Le(r)||!Re(e))t=!0;else return B.has(r)?{field:e.field,operator:r}:{field:e.field,operator:r,value:e.value}},r=e.items.map(n).filter(e=>e!==void 0);return{rule:r.length>0?{operator:e.logic,conditions:r}:null,incomplete:t}}function K(e,t,n){if(!B.has(t))return e.type===`boolean`?typeof n!=`boolean`||n:V.has(t)?Array.isArray(n)?n:n===void 0||n===``?[]:[n]:Array.isArray(n)?n[0]:n}var ze=r(`IconListAdd`,()=>(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`path`,{d:`M4 6H20`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,M.jsx)(`path`,{d:`M4 12H10`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,M.jsx)(`path`,{d:`M15 15L21 15`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,M.jsx)(`path`,{d:`M18 12V18`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,M.jsx)(`path`,{d:`M4 18H10`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})]})),Be={"item.labels":me,"item.title":je,"item.author":te,"item.key":ye,"item.state":_,"item.assignees":le,"item.pullRequest":g,"item.trusted":A,"pullRequest.trusted":A,"source.kind":g,"source.integration":k,"source.provider":k,"source.repository":be,"pullRequest.closesIssue":Me,"closedIssue.phase":Ae,"closedIssue.hasPullRequest":g,"event.type":Ne,"event.reason":ne},Ve=ie();function q(e,t){return e?.operatorLabels?.[t]??T.find(e=>e.id===t)?.label??t}function J(e){return Array.isArray(e?.suggestions)&&e.suggestions.length>0?e.suggestions:void 0}function Y({label:e,rule:t,facts:n,options:r,emptyHint:i,onChange:a}){let s=ae(n,r),[c,l]=(0,z.useState)(()=>Ie(t)),{rule:u,incomplete:d}=G(c),f=he(u);return(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(X,{role:`group`,"aria-label":e,group:c,depth:0,fields:s,emptyHint:i,onChange:e=>{l(e);let{rule:t,incomplete:n}=G(e);a(t,n)}}),d&&(0,M.jsx)(o,{as:`p`,variant:`caption`,tone:`muted`,children:`Finish or remove unfinished conditions to save.`}),f&&(0,M.jsx)(o,{as:`p`,variant:`caption`,tone:`muted`,children:f})]})}function X({role:e,"aria-label":t,group:n,depth:r,fields:i,limits:a=[],emptyHint:o,onChange:s,onRemove:c}){let l=(e,t)=>s({...n,items:t===void 0?n.items.filter((t,n)=>n!==e):n.items.with(e,t)}),u=e=>s({...n,items:[...n.items,e]}),d=(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(R,{icon:(0,M.jsx)(ee,{}),onClick:()=>u(W()),children:`Add condition`}),Fe(r)&&(0,M.jsx)(R,{icon:(0,M.jsx)(ze,{}),onClick:()=>u({key:U(),logic:n.logic===`AND`?`OR`:`AND`,items:[W()]}),children:`Add group`}),c&&(0,M.jsx)(Oe,{onClick:c,children:`Remove group`})]});if(n.items.length===0)return(0,M.jsx)(P,{role:e,"aria-label":t,children:(0,M.jsxs)(F,{children:[(0,M.jsx)(I,{children:`Where`}),(0,M.jsxs)(L,{children:[d,o&&(0,M.jsx)(ke,{children:o})]})]})});let f=n.logic===`AND`?`and`:`or`,p=_e(n.logic,a,n.items.filter(e=>!H(e)));return(0,M.jsxs)(P,{role:e,"aria-label":t,children:[n.items.map((e,t)=>(0,M.jsxs)(F,{children:[t===1?(0,M.jsx)(Te,{value:n.logic,onValueChange:e=>s({...n,logic:e})}):(0,M.jsx)(I,{children:t===0?`Where`:f}),H(e)?(0,M.jsx)(Ee,{depth:r,"aria-label":e.logic===`AND`?`All of these`:`Any of these`,children:(0,M.jsx)(X,{group:e,depth:r+1,fields:i,limits:p,onChange:e=>l(t,e.items.length>0?e:void 0),onRemove:()=>l(t,void 0)})}):(0,M.jsx)(He,{row:e,fields:i,limits:p.filter(t=>t!==e),onChange:e=>l(t,e),onRemove:()=>l(t,void 0)})]},e.key)),(0,M.jsxs)(F,{children:[(0,M.jsx)(I,{}),(0,M.jsx)(L,{children:d})]})]})}function Z({id:e}){let t=Be[e]??_;return(0,M.jsx)(t,{"aria-hidden":`true`,className:`text-muted-foreground size-3.5 shrink-0`})}function He({row:e,fields:t,limits:n,onChange:r,onRemove:i}){let a=Ve.find(t=>t.id===e.field),s=a&&!t.some(e=>e.id===a.id)?[a,...t]:t,c=s.find(t=>t.id===e.field),l=c&&Ce(c,n),u=!!l&&re(l.id)&&(!e.operator||e.operator===`exists`||e.operator===`not_exists`);return(0,M.jsxs)(L,{children:[(0,M.jsxs)(h,{value:e.field||null,onValueChange:t=>{let n=s.find(e=>e.id===t);if(!n)return;let i=n.operators?.[0]??`equals`;r({...e,field:n.id,operator:i,value:K(n,i,void 0)})},children:[(0,M.jsx)(f,{size:`sm`,"aria-label":`Field`,className:`w-fit max-w-full`,children:(0,M.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[l&&(0,M.jsx)(Z,{id:l.id}),(0,M.jsx)(o,{as:`span`,variant:`caption`,className:`truncate`,children:l?.label??(e.field||`Choose a field`)})]})}),(0,M.jsx)(p,{children:s.map(e=>(0,M.jsx)(m,{value:e.id,children:(0,M.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(Z,{id:e.id}),e.label]})},e.id))})]}),l?.type===`boolean`&&(0,M.jsx)(Ue,{row:e,field:l,onChange:r}),l&&u&&(0,M.jsx)(We,{row:e,field:l,onChange:r}),l&&l.type!==`boolean`&&!u&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(h,{value:e.operator,onValueChange:t=>t&&r({...e,operator:t,value:K(l,t,e.value)}),children:[(0,M.jsx)(f,{size:`sm`,variant:`ghost`,"aria-label":`Operator`,className:`w-fit`,children:(0,M.jsx)(o,{as:`span`,variant:`caption`,children:q(l,e.operator)})}),(0,M.jsx)(p,{children:(l.operators??[]).map(e=>(0,M.jsx)(m,{value:e,children:q(l,e)},e))})]}),!B.has(e.operator)&&(0,M.jsx)(Ge,{row:e,field:l,onChange:r})]}),(0,M.jsx)(De,{"aria-label":`Remove condition`,onClick:i})]})}function Ue({row:e,field:t,onChange:n}){let r=J(t)??[{value:`true`,label:`Yes`},{value:`false`,label:`No`}],i=e.operator!==`not_equals`==(e.value!==!1);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(o,{as:`span`,variant:`caption`,tone:`muted`,children:`is`}),(0,M.jsx)(O,{size:`sm`,"aria-label":t.label,value:String(i),onValueChange:t=>n({...e,operator:`equals`,value:t===`true`}),children:r.map(e=>(0,M.jsx)(D,{value:e.value,children:e.label},e.value))})]})}function We({row:e,field:t,onChange:n}){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(o,{as:`span`,variant:`caption`,tone:`muted`,children:`is`}),(0,M.jsxs)(O,{size:`sm`,"aria-label":t.label,value:e.operator===`not_exists`?`false`:`true`,onValueChange:t=>n({...e,operator:t===`true`?`exists`:`not_exists`,value:void 0}),children:[(0,M.jsx)(D,{value:`true`,children:`Yes`}),(0,M.jsx)(D,{value:`false`,children:`No`})]})]})}function Ge({row:e,field:t,onChange:n}){let r=J(t),i=V.has(e.operator),a=T.find(t=>t.id===e.operator)?.freeText===!0;if(t.strict===!1&&!a){let a=Array.isArray(e.value)?e.value.map(String):e.value===void 0?[]:[String(e.value)];return(0,M.jsx)(qe,{options:(r??[]).map(e=>({value:e.value,label:e.label??e.value})),values:a,many:i,placeholder:E[t.id]??`Search or type a value`,onChange:t=>n({...e,value:i?t:t[0]})})}if(r&&i){let t=Array.isArray(e.value)?e.value.map(String):[];return(0,M.jsx)(Ke,{options:r.map(e=>({value:e.value,label:e.label??e.value})),values:t,onChange:t=>n({...e,value:t})})}if(r){let t=r.find(t=>t.value===String(e.value??``));return(0,M.jsxs)(h,{value:e.value===void 0?null:String(e.value),onValueChange:t=>t!==null&&n({...e,value:t}),children:[(0,M.jsx)(f,{size:`sm`,"aria-label":`Value`,className:`w-fit`,children:(0,M.jsx)(o,{as:`span`,variant:`caption`,className:`font-medium`,children:t?.label??(e.value===void 0?`Choose a value`:String(e.value))})}),(0,M.jsx)(p,{children:r.map(e=>(0,M.jsx)(m,{value:e.value,children:e.label},e.value))})]})}return(0,M.jsx)(Je,{row:e,field:t,many:i,onChange:n})}function Q(e){return e.length===0?`Choose values`:e.length>3?`${e.slice(0,2).join(`, `)} +${e.length-2}`:e.length===1?e[0]:`${e.slice(0,-1).join(`, `)} or ${e.at(-1)}`}function Ke({options:e,values:t,onChange:r}){let i=t.map(t=>e.find(e=>e.value===t)??{value:t,label:t}),a=[...e,...i.filter(t=>!e.includes(t))],s=i.map(e=>e.label);return(0,M.jsxs)(S,{multiple:!0,autoHighlight:!0,items:a,value:i,itemToStringLabel:e=>e.label,isItemEqualToValue:(e,t)=>e.value===t.value,onValueChange:e=>r(e.map(e=>e.value)),children:[(0,M.jsx)(b,{size:`sm`,"aria-label":`Values`,title:s.join(`, `),className:`w-fit max-w-64`,children:(0,M.jsx)(o,{as:`span`,variant:`caption`,className:n(`font-medium`,s.length===0&&`text-muted-foreground`),children:Q(s)})}),(0,M.jsxs)(x,{children:[(0,M.jsx)(w,{placeholder:`Search`}),(0,M.jsx)(v,{children:`No option found.`}),(0,M.jsx)(y,{children:e=>(0,M.jsx)(C,{value:e,children:e.label},e.value)})]})]})}function qe({options:e,values:t,many:r,placeholder:i,onChange:a}){let[s,c]=(0,z.useState)(``),l=s.trim(),u=t=>e.some(e=>e.value.toLowerCase()===t.toLowerCase()),d=t.map(t=>e.find(e=>e.value===t)??{value:t,label:t}),f=[...e,...d.filter(t=>!e.includes(t)),...l&&!u(l)&&!t.includes(l)?[{value:l,label:`Use “${l}”`}]:[]],p=d.map(e=>e.value),m={autoHighlight:!0,items:f,inputValue:s,onInputValueChange:c,itemToStringLabel:e=>e.label,isItemEqualToValue:(e,t)=>e.value===t.value},h=(0,M.jsxs)(x,{children:[(0,M.jsx)(w,{placeholder:i}),(0,M.jsx)(v,{children:`Type a value to use it.`}),(0,M.jsx)(y,{children:e=>(0,M.jsx)(C,{value:e,children:e.label},e.value)})]}),g=(0,M.jsx)(o,{as:`span`,variant:`caption`,className:n(`font-medium`,p.length===0&&`text-muted-foreground`),children:p.length===0?i:Q(p)});return r?(0,M.jsxs)(S,{...m,multiple:!0,value:d,onValueChange:e=>a(e.map(e=>e.value)),children:[(0,M.jsx)(b,{size:`sm`,"aria-label":`Values`,title:p.join(`, `),className:`w-fit max-w-64`,children:g}),h]}):(0,M.jsxs)(S,{...m,value:d[0]??null,onValueChange:e=>e&&a([e.value]),children:[(0,M.jsx)(b,{size:`sm`,"aria-label":`Value`,title:p[0],className:`w-fit max-w-64`,children:g}),h]})}function $(e){return Array.isArray(e)?e.join(`, `):e===void 0?``:String(e)}function Je({row:e,field:t,many:n,onChange:r}){let[i,a]=(0,z.useState)(),o=i??$(e.value),s=()=>{if(i===void 0||(a(void 0),i===$(e.value)))return;if(n){let t=i.split(`,`).map(e=>e.trim());r({...e,value:t.filter(e=>e!==``)});return}if(t.type!==`number`){r({...e,value:i.trim()});return}let o=Number(i.trim());r({...e,value:i.trim()!==``&&Number.isFinite(o)?o:void 0})};return(0,M.jsx)(ue,{size:`sm`,"aria-label":`Value`,type:t.type===`number`&&!n?`number`:`text`,placeholder:E[t.id]??(n?`Values, comma separated`:`Value`),value:o,className:`w-48`,onChange:e=>a(e.target.value),onBlur:s,onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),s()):e.key===`Escape`&&a(void 0)}})}export{we as n,Y as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{An as t,Ln as n,M as r,N as i,Pr as a,Rn as o,Tr as s,jn as c,kn as l,n as u,t as d}from"./index-D4fnG4KO.js";import{n as f,t as p}from"./SkeletonRows-6RPIfKEw.js";import{O as m,T as h,k as g,n as _}from"./IconChevronRightMedium.es-BjSIsine.js";import{N as v,Qr as y,U as b,Zn as x,a as ee,b as te,dr as ne,fr as re,gr as ie,k as S,l as C,lr as ae,ni as w,q as oe,t as T,v as se,w as ce,x as le,y as E,zt as ue}from"./GithubIcon.es-B1lB1Q-8.js";import{a as de,f as D,i as fe,m as O,n as pe,o as me,p as he,r as ge,t as _e}from"./MastraGatewayBilling-ButNucYj.js";import{g as ve,h as ye,i as k,m as A,n as j,r as M}from"./usePlatformConnections-R32iBFFQ.js";import{a as N,c as P,i as be,s as xe}from"./useLinearData-XOkwHgla.js";import{K as F,U as I,V as L,vt as Se,yt as R}from"./useSessionRows-aTHnrKGG.js";import{_ as Ce,t as we}from"./IconArrowRotateClockwise.es-C13-sgU6.js";import{n as z}from"./IconSquareArrowTopRight.es-C-xkvcAK.js";import{i as B,s as Te,t as Ee}from"./Command.es-Dzh7LzCA.js";import{a as V,i as H,r as De}from"./CompositeItem-CD2x3KaL.js";import{t as U}from"./IconArrowRight.es-B8AZJjlM.js";import{t as W}from"./spinner-B9ykw74u-oAX9C1zS.js";import{S as G,c as Oe,t as K}from"./ProviderBrandIcon-B-aKKQdi.js";import{t as ke}from"./IconSettingsSliderHor.es-CSwP_iSG.js";import{t as Ae}from"./HrefLink-Q5kgIdVD.js";var q=e(g(),1);function je({draft:e,onFactoryCreated:t,onRepositoryLinked:n,onCreated:r}){let{baseUrl:i}=x(),a=y(),o=ee(),s=C(),c=se(),l=E(`linear`),u=E(`jira`),d=async e=>{try{await c.mutateAsync({integrationId:e.integrationId,sourceId:e.sourceId,factoryProjectId:e.factoryProjectId})}catch(e){if(!(e instanceof te))throw e;R.warning(`This Jira project already feeds another factory`,{description:`Add a label filter in Settings › Work Intake to route some of its issues here.`});return}let t=await le(i),n=ce(t[e.integrationId],e.sourceId);n!==t[e.integrationId]&&await(e.integrationId===`linear`?l:u).mutateAsync(n)};return ie({mutationFn:async({modelId:c})=>{if(!e?.name||!e.repository)throw Error(`Start over from the name step.`);let l=e.factoryId?{id:e.factoryId,name:e.name}:await o.mutateAsync({name:e.name});return e.factoryId||await t(l),e.linkedRepositoryId||await n((await s.mutateAsync({factoryProjectId:l.id,repo:e.repository})).projectRepositoryId),await Promise.all([oe(i,l.id,c),e.linearProjectId?d({integrationId:`linear`,sourceId:e.linearProjectId,factoryProjectId:l.id}):void 0,e.jiraProjectId?d({integrationId:`jira`,sourceId:e.jiraProjectId,factoryProjectId:l.id}):void 0]),await a.invalidateQueries({queryKey:ue.factories()}),await r(l),l}})}var J=m();function Y({label:e,rows:t=3}){return(0,J.jsx)(p,{label:e,rows:t,className:`gap-0 p-1`,children:(0,J.jsxs)(`div`,{"aria-hidden":!0,className:`flex items-start gap-3 rounded-lg border border-transparent px-3 py-2.5`,children:[(0,J.jsx)(De,{className:`mt-0.5 size-4 shrink-0 motion-reduce:before:animate-none`}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,J.jsx)(H,{line:`text-label`,className:`w-3/5 max-w-48 motion-reduce:before:animate-none`}),(0,J.jsx)(H,{line:`text-meta`,className:`w-4/5 max-w-64 motion-reduce:before:animate-none`})]})]})})}var X=`animate-in fade-in slide-in-from-bottom-2 duration-200 motion-reduce:animate-none`;function Me({step:e,title:t,placeholder:n,searchable:i=!0,value:a,onValueChange:o,onBack:s,onSkip:c,children:l}){let u=d.indexOf(e);return(0,J.jsxs)(Ee,{loop:!0,shouldFilter:!1,label:t,className:`flex max-h-[34rem] w-full flex-col gap-2 overflow-visible bg-transparent`,children:[(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3`,children:[s&&(0,J.jsxs)(w,{variant:`ghost`,size:`sm`,onMouseDown:e=>e.preventDefault(),onClick:s,"aria-label":`Go back to previous step`,children:[(0,J.jsx)(Se,{"aria-hidden":`true`}),`Back`]}),(0,J.jsx)(_,{tone:`ink`,as:`p`,"aria-hidden":`true`,variant:`body`,className:h(`min-w-0 flex-1 truncate`,X),children:t},e),c&&(0,J.jsxs)(w,{variant:`ghost`,size:`sm`,onMouseDown:e=>e.preventDefault(),onClick:c,children:[`Skip`,(0,J.jsx)(U,{"aria-hidden":`true`})]}),(0,J.jsx)(`ol`,{className:`flex shrink-0 gap-1`,"aria-label":`Step ${u+1} of ${d.length}`,children:d.map((t,n)=>(0,J.jsx)(`li`,{"aria-current":t===e?`step`:void 0,className:h(`h-1 w-6 rounded-full transition-colors`,n<=u?`bg-success-indicator`:`bg-fill`)},t))})]}),(0,J.jsx)(r,{autoFocus:!0,placeholder:n,value:a,onValueChange:o,rightSlot:(0,J.jsx)(V,{size:`sm`,children:`Esc`}),wrapperClassName:h(`h-14 px-4`,!i&&`[&>svg]:hidden`)}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-1.5 px-1`,children:[(0,J.jsx)(V,{size:`sm`,children:`↑`}),(0,J.jsx)(V,{size:`sm`,children:`↓`}),(0,J.jsx)(V,{size:`sm`,children:`↵`}),(0,J.jsx)(V,{size:`sm`,children:`Esc`})]}),(0,J.jsx)(Te,{scrollArea:!0,"aria-label":t,className:`max-h-none rounded-none border-none bg-transparent px-0 py-1 shadow-none`,scrollAreaClassName:`min-h-0 flex-1`,children:(0,J.jsx)(`div`,{className:X,onMouseDown:e=>e.preventDefault(),children:l},e)})]})}function Z({children:e}){return(0,J.jsx)(_,{as:`p`,role:`alert`,variant:`caption`,className:`text-destructive-foreground m-0 px-3 py-2`,children:e})}function Q({children:e}){return(0,J.jsx)(_,{tone:`muted`,as:`p`,variant:`caption`,className:`m-0 px-3 py-2`,children:e})}function Ne({query:e,onSelectProject:n}){let r=t(),a=r.data,o=a?.configured===!0,s=l(o),u=M(`jira`,a?.mode===`platform`),d=j(`jira`),f=k(`jira`),p=a?.connections?.find(e=>e.status===`needs_reauth`),m=e.trim().toLowerCase(),h=e=>e.toLowerCase().includes(m),g=d.isPending||f.isPending,_=p?`Reconnect Jira`:`Connect Jira`,v=f.error??d.error,y=()=>{p?f.mutate({connectionId:p.id}):d.mutate({})};if(r.isPending||o&&s.isPending)return(0,J.jsx)(Y,{label:`Loading Jira projects`,rows:2});if(!o){let e=a?.mode===`platform`&&u.isSuccess;return!e&&a?.reason===`missing_config`?null:(0,J.jsxs)(B,{heading:`Jira`,children:[v&&(0,J.jsx)(Z,{children:v.message}),e&&h(_)?(0,J.jsx)(i,{icon:(0,J.jsx)(I,{}),title:g?`Connecting Jira…`:_,subtitle:`Import Jira issues into the Factory Work board`,value:`connect-jira`,disabled:g,onSelect:y}):!e&&(0,J.jsx)(Q,{children:`Jira is not available for this organization.`})]})}if(s.isError)return(0,J.jsx)(B,{heading:`Jira`,children:c(s.error)&&p?(0,J.jsx)(i,{icon:(0,J.jsx)(I,{}),title:g?`Connecting Jira…`:`Reconnect Jira`,subtitle:`Its authorization expired, so its projects cannot be read`,value:`reconnect-jira`,disabled:g,onSelect:y}):(0,J.jsx)(Z,{children:s.error.message})});let b=s.data??[],x=b.filter(e=>h(`${e.name} ${e.key} ${e.site??``}`));return(0,J.jsxs)(B,{heading:`Jira projects`,children:[x.map(e=>(0,J.jsx)(i,{icon:(0,J.jsx)(I,{}),title:e.name,subtitle:e.key||e.site?(0,J.jsxs)(z,{singleLine:!0,children:[e.key&&(0,J.jsx)(z.Item,{className:`shrink-0`,children:e.key}),e.site&&(0,J.jsx)(z.Item,{children:e.site})]}):`Its issues feed this Factory Work board`,shortcut:(0,J.jsx)(V,{size:`sm`,children:`↵`}),value:`jira-${e.id}`,onSelect:()=>n(e.id)},e.id)),x.length===0&&(0,J.jsx)(Q,{children:b.length>0?`No Jira project matches this search.`:`No Jira projects are available yet.`})]})}function Pe({query:e,onConnect:t,onSelectProject:n,onSkip:r}){let a=N(),o=a.data,s=o?.connected===!0,c=be(s),l=e.trim().toLowerCase(),u=e=>e.toLowerCase().includes(l),d=u(`Skip for now`)&&(0,J.jsx)(i,{icon:(0,J.jsx)(U,{}),title:`Skip for now`,subtitle:`This Factory takes its work from GitHub only`,value:`skip-linear`,onSelect:r});if(a.isPending||s&&c.isPending)return(0,J.jsx)(Y,{label:`Loading Linear projects`,rows:2});if(!s){let e=o?.reason!==`missing_config`&&o?.reason!==`organization_required`,n=o?.reason===`not_connected`?`Connect Linear`:`Reconnect Linear`;return(0,J.jsxs)(B,{heading:`Linear`,children:[d,e?u(n)&&(0,J.jsx)(i,{icon:(0,J.jsx)(F,{}),title:n,subtitle:`Import issues and priorities into the Factory board`,value:`connect-linear`,onSelect:t}):(0,J.jsx)(Q,{children:`Linear is not configured for this deployment.`})]})}if(c.isError)return(0,J.jsxs)(B,{heading:`Linear`,children:[d,P(c.error)?(0,J.jsx)(i,{icon:(0,J.jsx)(F,{}),title:`Reconnect Linear`,subtitle:`Its authorization expired, so its projects cannot be read`,value:`connect-linear`,onSelect:t}):(0,J.jsx)(Z,{children:c.error.message})]});let f=c.data??[],p=f.filter(e=>u(e.name));return(0,J.jsxs)(B,{heading:`Projects in ${o.workspace?.name??`Linear`}`,children:[d,p.map(e=>(0,J.jsx)(i,{icon:(0,J.jsx)(F,{}),title:e.name,subtitle:e.teams.map(e=>e.name).join(`, `)||`Its issues feed this Factory board`,shortcut:(0,J.jsx)(V,{size:`sm`,children:`↵`}),value:`linear-${e.id}`,onSelect:()=>n(e.id)},e.id)),p.length===0&&(0,J.jsx)(Q,{children:f.length>0?`No Linear project matches this search.`:`This workspace has no projects yet.`})]})}function Fe({provider:e,query:t,savingModelId:n,error:r,onPick:a,onChangeProvider:o}){let s=fe(e.provider);if(s.isPending)return(0,J.jsx)(Y,{label:`Loading models`,rows:3});if(s.catalogError)return(0,J.jsx)(Z,{children:s.catalogError.message});let c=ge(e.provider),l=t.trim().toLowerCase(),u=s.models.filter(e=>e.id.toLowerCase().includes(l)||e.modelName.toLowerCase().includes(l)).toSorted((e,t)=>Number(t.id===c)-Number(e.id===c)||Oe(e.releaseDate,t.releaseDate)||e.modelName.localeCompare(t.modelName)),d=n!==void 0;return(0,J.jsxs)(J.Fragment,{children:[r&&(0,J.jsx)(Z,{children:r}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-2 px-3 pt-2`,children:[(0,J.jsx)(de,{modelId:s.suggestedModelId}),e.connectWithMastraAccount&&(0,J.jsx)(pe,{})]}),u.length>0?(0,J.jsx)(B,{heading:`${G(e.provider)} models`,children:u.map(e=>(0,J.jsx)(i,{icon:n===e.id?(0,J.jsx)(W,{size:`sm`,"aria-label":`Creating Factory`}):(0,J.jsx)(K,{provider:e.provider}),title:e.id,subtitle:e.modelName,badge:e.id===s.suggestedModelId?`Suggested`:void 0,shortcut:(0,J.jsx)(V,{size:`sm`,children:`↵`}),value:e.id,disabled:d,onSelect:()=>a(e.id)},e.id))}):(0,J.jsx)(Q,{children:`No models match this search.`}),(0,J.jsx)(B,{heading:`Provider`,children:(0,J.jsx)(i,{icon:(0,J.jsx)(we,{}),title:`Change provider`,subtitle:G(e.provider),value:`change-provider`,disabled:d,onSelect:o})})]})}function Ie({connection:e,query:t,error:n}){if(e.isPending)return(0,J.jsx)(Y,{label:`Loading model providers`,rows:3});if(e.catalogError)return(0,J.jsx)(Z,{children:e.catalogError.message});let r=e.gatewayProvider&&D(e.gatewayProvider,t)?e.gatewayProvider:void 0,a=e.signInProviders.filter(e=>D(e,t)),o=e.keyProviders.filter(e=>e.oauth?.supported!==!0&&D(e,t));return(0,J.jsxs)(J.Fragment,{children:[n&&(0,J.jsx)(Z,{children:n}),!r&&a.length===0&&o.length===0&&(0,J.jsx)(Q,{children:`No providers match this search.`}),r&&(0,J.jsx)(B,{heading:`Recommended`,children:(0,J.jsx)(i,{icon:(0,J.jsx)(K,{provider:r.provider}),title:G(r.provider),subtitle:(0,J.jsx)(_e,{}),badge:e.isConfigured(r)?`Connected`:void 0,value:`gateway-${r.provider}`,disabled:e.pending,onSelect:e.chooseGateway})}),a.length>0&&(0,J.jsx)(B,{heading:`Sign in`,children:a.map(t=>(0,J.jsx)(i,{icon:(0,J.jsx)(K,{provider:t.provider}),title:G(t.provider),subtitle:e.isConfigured(t)?`Signed in on this deployment`:`Sign in with your account`,badge:e.isConfigured(t)?`Connected`:void 0,value:`signin-${t.provider}`,disabled:e.pending,onSelect:()=>e.chooseSignInProvider(t)},t.provider))}),o.length>0&&(0,J.jsx)(B,{heading:`API key`,children:o.map(t=>(0,J.jsx)(i,{icon:(0,J.jsx)(K,{provider:t.provider}),title:G(t.provider),subtitle:e.isConfigured(t)?`API key saved`:`Connect with an API key`,badge:e.isConfigured(t)?`Connected`:void 0,value:`key-${t.provider}`,disabled:e.pending,onSelect:()=>e.chooseKeyProvider(t)},t.provider))})]})}function Le({query:e,savingModelId:t,error:n,onPick:r}){let i=he(),a=i.connected?i.provider:void 0;return(0,J.jsxs)(J.Fragment,{children:[a?(0,J.jsx)(Fe,{provider:a,query:e,savingModelId:t,error:n,onPick:e=>r(a.provider,e),onChangeProvider:i.clear}):(0,J.jsx)(Ie,{connection:i,query:e,error:i.error??n}),(0,J.jsx)(me,{keyProvider:i.keyDialogProvider,oauth:i.activeOAuth,authEnabled:i.authEnabled,onCloseKeyDialog:i.closeKeyDialog,onCloseOAuth:i.closeOAuth,onCompleteOAuth:i.completeOAuth})]})}function $({name:e,onSubmit:t}){let n=e.trim();return(0,J.jsx)(B,{heading:`Create`,children:(0,J.jsx)(i,{icon:(0,J.jsx)(ve,{}),title:n?`Create “${n}”`:`Type a name to create your Factory`,shortcut:(0,J.jsx)(V,{size:`sm`,children:`↵`}),value:`create-factory`,disabled:!n,onSelect:()=>t(n)})})}function Re(e){switch(e?.reason){case`missing_config`:return`GitHub is not configured for this deployment.`;case`organization_required`:return`Join an organization to connect GitHub repositories.`;case`auth_required`:return`Sign in again to connect GitHub.`;default:return`Install the GitHub App to grant access to repositories.`}}function ze({query:e,githubRedirecting:t,onConnect:r,onManageConnection:a,onSelectRepository:s}){let c=A(),l=c.data?.connected===!0,u=o(),d=!!(u.data?.enabled&&u.data.configured),f=n(d),p=j(`gitlab`),m=p.isPending,h=async()=>{try{await p.mutateAsync({}),R.success(`GitLab connected`)}catch(e){R.error(e instanceof Error?e.message:`Failed to connect GitLab`)}};if(c.isPending||u.isPending)return(0,J.jsx)(Y,{label:`Loading repositories`,rows:3});let g=l?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Be,{query:e,onSelectRepository:s}),(0,J.jsx)(B,{heading:`GitHub`,children:(0,J.jsx)(i,{icon:(0,J.jsx)(ke,{}),title:`Manage GitHub connection`,subtitle:`Add installations or grant access to more repositories`,value:`manage-github`,onSelect:a})})]}):(()=>{let e=c.data?.reason===`organization_required`||c.data?.reason===`missing_config`;return(0,J.jsx)(B,{heading:`GitHub`,children:(0,J.jsx)(i,{icon:t?(0,J.jsx)(W,{size:`sm`,"aria-label":`Connecting to GitHub`}):(0,J.jsx)(T,{}),title:e?`GitHub unavailable`:`Connect GitHub`,subtitle:Re(c.data),value:`connect-github`,disabled:e||t,onSelect:r})})})();return(0,J.jsxs)(J.Fragment,{children:[g,d?(0,J.jsx)(Ve,{query:e,projects:f.data?.flatMap(e=>{let t=S(e);return t?[t]:[]}),pending:f.isPending,error:f.error,onSelectRepository:s}):(()=>{let e=!u.data?.enabled||u.data.reason===`organization_required`,t=u.data?.enabled?u.data.reason===`organization_required`?`Join an organization to connect GitLab repositories.`:`Sign in to GitLab to grant access to your projects.`:`GitLab is not available for this deployment.`;return(0,J.jsx)(B,{heading:`GitLab`,children:(0,J.jsx)(i,{icon:m?(0,J.jsx)(W,{size:`sm`,"aria-label":`Connecting to GitLab`}):(0,J.jsx)(L,{}),title:e?`GitLab unavailable`:`Connect GitLab`,subtitle:t,value:`connect-gitlab`,disabled:e||m,onSelect:()=>void h()})})})()]})}function Be({query:e,onSelectRepository:t}){let n=ye(e,750),r=O(n||void 0,!0);return r.isPending?(0,J.jsx)(Y,{label:`Loading repositories`,rows:3}):r.isError?(0,J.jsx)(Z,{children:r.error.message}):r.data.length===0?(0,J.jsx)(Q,{children:`No repositories found.`}):(0,J.jsx)(B,{heading:`Repositories`,children:r.data.map(e=>(0,J.jsx)(i,{icon:(0,J.jsx)(T,{}),title:e.fullName,subtitle:(0,J.jsxs)(z,{singleLine:!0,children:[(0,J.jsx)(z.Item,{className:`shrink-0`,children:e.private?`Private`:`Public`}),(0,J.jsx)(z.Item,{children:e.defaultBranch})]}),value:`repo-${e.id}`,onSelect:()=>t(e)},e.id))})}function Ve({query:e,projects:t,pending:n,error:r,onSelectRepository:a}){let o=e.trim().toLowerCase(),s=(t??[]).filter(e=>e.fullName.toLowerCase().includes(o));return n?(0,J.jsx)(Y,{label:`Loading GitLab repositories`,rows:3}):r?(0,J.jsx)(Z,{children:r.message}):(0,J.jsx)(B,{heading:`GitLab repositories`,children:s.length===0?(0,J.jsx)(Q,{children:`No GitLab repositories found.`}):s.map(e=>(0,J.jsx)(i,{icon:(0,J.jsx)(L,{}),title:e.fullName,subtitle:(0,J.jsxs)(z,{singleLine:!0,children:[(0,J.jsx)(z.Item,{className:`shrink-0`,children:`GitLab`}),(0,J.jsx)(z.Item,{children:e.defaultBranch})]}),value:`gitlab-repo-${e.id}`,onSelect:()=>a(e)},e.id))})}var He={name:{title:`Name your new Factory`,placeholder:`e.g. Mastra`,searchable:!1},vcs:{title:`Choose your codebase`,placeholder:`Search repositories`},"project-management":{title:`Connect the work behind the code`,placeholder:`Search options`},"model-provider":{title:`Choose your Factory model`,placeholder:`Search models and providers`}};function Ue(e){return e instanceof Error?e.message:`Something went wrong. Please try again.`}function We(){let e=ne(),t=ae(),{factoryId:n}=re(),{baseUrl:r}=x(),i=u(),[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(),l=i.draft,d=A();O(void 0,l?.step===`name`&&d.data?.connected===!0);let p=je({draft:l,onFactoryCreated:e=>i.rememberFactory(e),onRepositoryLinked:e=>i.rememberLinkedRepository(e),onCreated:()=>i.clear()}),m=p.isPending;f({Escape:()=>{t.key==="default"?e(n?`/factories/${n}`:`/`):e(-1)}},{enabled:!m,insideFields:!0});let h=l?.step;if(!h)return null;let g=(s?.step===h?s.value:void 0)??(h===`name`?l.name??``:``);return(0,J.jsx)(`div`,{className:`flex min-h-0 flex-col gap-2`,children:(0,J.jsxs)(Me,{...He[h],step:h,value:g,onValueChange:e=>c({step:h,value:e}),onBack:h===`name`||m||l.factoryId||l.linkedRepositoryId?void 0:()=>{c(void 0),i.back()},onSkip:h===`project-management`?()=>void i.skipProjectManagement():void 0,children:[h===`name`&&(0,J.jsx)($,{name:g,onSubmit:i.startVcs}),h===`vcs`&&(0,J.jsx)(ze,{query:g,githubRedirecting:a,onConnect:()=>{o(!0),i.persistBeforeRedirect(n),v(r)},onManageConnection:()=>{i.persistBeforeRedirect(n),b(r)},onSelectRepository:e=>void i.chooseRepository(e)}),h===`project-management`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Pe,{query:g,onConnect:()=>{i.persistBeforeRedirect(n),xe(r)},onSelectProject:e=>void i.chooseLinearProject(e),onSkip:()=>void i.skipProjectManagement()}),(0,J.jsx)(Ne,{query:g,onSelectProject:e=>void i.chooseJiraProject(e)})]}),h===`model-provider`&&(0,J.jsx)(Le,{query:g,savingModelId:p.isPending?p.variables?.modelId:void 0,error:p.error?Ue(p.error):void 0,onPick:(t,n)=>p.mutate({modelId:n},{onSuccess:t=>void e(Ce(t))})})]})})}function Ge(){let e=s();return(0,J.jsx)(a,{variant:`form`,backHref:`/factories/${e.id}`,backLabel:e.name,title:`New Factory`,LinkComponent:Ae,children:(0,J.jsx)(We,{})})}export{Ge as CreateFactoryPage};
@@ -1 +1 @@
1
- import{t as e}from"./MarkdownRenderer-Y8TNNi2F-Dq4iwrPa.js";import{O as t}from"./IconChevronRightMedium.es-BjSIsine.js";var n=t();function r(e){return function({node:t,...r}){return(0,n.jsx)(e,{...r})}}function i(e,t,n){return{h1:r(e),h2:r(e),h3:r(t),h4:r(n),h5:r(n),h6:r(n)}}var a={h2:i(`h3`,`h4`,`h5`),h3:i(`h4`,`h5`,`h6`)};function o({children:t,titleLevel:r}){return(0,n.jsx)(e,{className:`text-foreground text-caption max-w-none [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,components:a[r],children:t})}export{o as t};
1
+ import{t as e}from"./MarkdownRenderer-CfkpBq7t-B3F-Cy2O.js";import{O as t}from"./IconChevronRightMedium.es-BjSIsine.js";var n=t();function r(e){return function({node:t,...r}){return(0,n.jsx)(e,{...r})}}function i(e,t,n){return{h1:r(e),h2:r(e),h3:r(t),h4:r(n),h5:r(n),h6:r(n)}}var a={h2:i(`h3`,`h4`,`h5`),h3:i(`h4`,`h5`,`h6`)};function o({children:t,titleLevel:r}){return(0,n.jsx)(e,{className:`text-foreground text-caption max-w-none [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,components:a[r],children:t})}export{o as t};
@@ -0,0 +1,3 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Hn as t,Pr as n,Tr as r,Un as i,nn as a}from"./index-D4fnG4KO.js";import{$n as o,Ps as s,Rs as c,cr as l,dr as u,fr as d,mi as f,n as p,ni as m,rr as h,vi as g,za as _}from"./GithubIcon.es-B1lB1Q-8.js";import{t as v}from"./EmptyState-DJaZF543-Cw3WDQUb.js";import{r as y}from"./CompositeItem-CD2x3KaL.js";import{i as b,n as x,r as S,t as ee}from"./SkillBadges-DbbPhC5O.js";import{c as C,l as w}from"./boardConfigPaths-Btimpi_r.js";import{O as T,T as E,k as te,n as D}from"./IconChevronRightMedium.es-BjSIsine.js";import{t as O}from"./AlertDialog.es-Z2cFKrup.js";import{t as k}from"./InlineText-vWKzGKx_.js";import{o as ne}from"./CodeBlock.es-BeD4YikJ.js";import{t as re}from"./MarkdownRenderer-CfkpBq7t-B3F-Cy2O.js";import{O as ie}from"./TabsRoot-C1o0G1CK.js";import{t as ae}from"./IconChainLink3.es-CNFznS2g.js";import{t as oe}from"./IconCodeBrackets.es-o1byTuto.js";import{a as se,i as ce,n as le,o as ue,r as de,t as fe}from"./esm-Dp9Y59hS.js";import{t as pe}from"./createLucideIcon-B6gALBEh.js";import{a as A,i as me}from"./dist-6WNNvkM4.js";import{n as he,r as j}from"./dist-CMX7_OjZ.js";import{F as M,L as ge,M as N,N as P,R as _e,X as ve,dt as ye,it as be,j as xe,mt as F,ut as I,vt as Se,yt as L}from"./dist-Sr6WSEaV.js";import{t as Ce}from"./HrefLink-Q5kgIdVD.js";import{t as we}from"./LoadErrorState-DVbqZ6DX.js";var R={name:`italic`,size:24,node:[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]};R.node;var Te=pe(R),z={name:`letter-b`,size:24,node:[[`path`,{d:`M6 12h9a4 4 0 010 8H7a1 1 0 01-1-1V5a1 1 0 011-1h7a4 4 0 010 8`,key:`n8tvfh`}]],aliases:[`bold`]};z.node;var Ee=pe(z),B=e(te(),1);function V(e){let t=(0,B.useRef)(!1),n=()=>e&&!t.current,r=l(({currentLocation:e,nextLocation:t})=>n()&&e.pathname!==t.pathname);return h(e=>{n()&&e.preventDefault()}),{blocker:r,leave:e=>{t.current=!0,e()}}}var H=T();function U({blocker:e,title:t,description:n}){return(0,H.jsx)(O,{open:e.state===`blocked`,onOpenChange:t=>!t&&e.reset?.(),children:(0,H.jsxs)(O.Content,{children:[(0,H.jsxs)(O.Header,{children:[(0,H.jsx)(O.Title,{children:t}),(0,H.jsx)(O.Description,{children:n})]}),(0,H.jsxs)(O.Footer,{children:[(0,H.jsx)(O.Cancel,{children:`Keep editing`}),(0,H.jsx)(m,{variant:`destructive`,size:`md`,onClick:()=>e.proceed?.(),children:`Discard`})]})]})})}function W({notices:e,status:t,children:n}){return(0,H.jsxs)(`div`,{className:`rounded-card bg-card shadow-overlay dark:bg-muted sticky bottom-4 z-10 flex flex-col gap-3 p-3`,children:[e,(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(D,{variant:`body-sm`,tone:`muted`,className:`min-w-0 flex-1`,role:`status`,children:t}),n]})]})}function De({name:e,description:t,frontmatter:n,instructions:r}){return`---\n${[`name: ${JSON.stringify(e)}`,`description: ${JSON.stringify(t)}`,...Object.entries(n??{}).map(([e,t])=>`${e}: ${JSON.stringify(t)}`)].join(`
2
+ `)}\n---\n\n${r.trim()}\n`}function Oe({value:e,required:t,readOnly:n,onChange:r}){return(0,H.jsx)(D,{as:`p`,variant:`body`,tone:`muted`,children:(0,H.jsx)(k,{value:e,label:`Description`,placeholder:`Describe when agents should use it`,multiline:!0,required:t,readOnly:n,variant:`body`,tone:`muted`,className:`zoom-safe-text w-full`,onChange:r})})}var ke=e(_(),1),Ae=class extends _e{eq(){return!0}toDOM(){let e=document.createElement(`span`);return e.className=`cm-md-bullet`,e.textContent=`•`,e}},je=P.replace({}),Me=P.replace({widget:new Ae}),Ne=new Map,Pe=e=>{let t=Ne.get(e);return t||(t=P.line({class:e}),Ne.set(e,t)),t},Fe={EmphasisMark:[`Emphasis`,`StrongEmphasis`],StrikethroughMark:[`Strikethrough`],CodeMark:[`InlineCode`]},Ie=(e,t)=>e.some(e=>e.from<=t.to&&e.to>=t.from),Le=e=>e.length-e.trimStart().length;function Re(e,t,n){let r=e.doc.lineAt(t.from);if(t.from===n.from)return{from:t.from,to:t.to+Le(e.sliceDoc(t.to,r.to))};let i=e.sliceDoc(r.from,t.from);return{from:t.from-(i.length-i.trimEnd().length),to:t.to}}function ze(e){let{state:t}=e,n=e.hasFocus?t.selection.ranges:[],r=[],i=new Map,a=(e,t)=>{let n=i.get(e)??new Set;n.add(t),i.set(e,n)},o=(e,n,r)=>{let i=t.doc.lineAt(Math.max(e.from,n.from)),o=t.doc.lineAt(Math.min(e.to,n.to));for(let e=i.number;e<=o.number;e++)a(t.doc.line(e).from,r)},s=(e,t,i=je)=>{Ie(n,t)||r.push(i.range(e.from,e.to))};for(let i of e.visibleRanges)N(t).iterate({from:i.from,to:i.to,enter:e=>{let{name:c}=e;if(c===`FencedCode`)return o(e,i,`cm-md-fence-line`),e.from>=i.from&&a(t.doc.lineAt(e.from).from,`cm-md-fence-start`),e.to<=i.to&&a(t.doc.lineAt(e.to).from,`cm-md-fence-end`),!1;if(c===`Blockquote`){o(e,i,`cm-md-quote-line`);return}let l=e.node;if(c===`Link`){let[n,r]=l.getChildren(`LinkMark`);n&&r&&l.getChild(`URL`)&&t.doc.lineAt(r.from).to>=e.to&&(s(n,e),s({from:r.from,to:e.to},e));return}let u=t.doc.lineAt(e.from);if(c===`HorizontalRule`){Ie(n,u)||(r.push(je.range(e.from,e.to)),a(u.from,`cm-md-rule-line`));return}let d=l.parent;if(d){if(c===`HeaderMark`&&d.name.startsWith(`ATXHeading`))s(Re(t,l,d),u);else if(c===`QuoteMark`){let n=Math.min(1,Le(t.sliceDoc(e.to,u.to)));s({from:e.from,to:e.to+n},u)}else c===`ListMark`&&d.parent?.name===`BulletList`?s(e,u,Me):Fe[c]?.includes(d.name)&&s(e,d)}}});for(let[e,t]of i)r.push(Pe([...t].join(` `)).range(e));return P.set(r,!0)}var Be=ge.fromClass(class{decorations;constructor(e){this.decorations=ze(e)}update(e){let t=N(e.startState)!==N(e.state);(e.docChanged||e.selectionSet||e.focusChanged||e.viewportChanged||t)&&(this.decorations=ze(e.view))}},{decorations:e=>e.decorations}),G={node:`StrongEmphasis`,marker:`**`},K={node:`Emphasis`,marker:`*`},Ve={node:`InlineCode`,marker:"`"},He=/^https?:\/\/\S+$/,Ue=/^\s*(?:(?:[-*+]|\d+[.)])\s+(?:\[[ xX]\]\s+)?|>\s?|#{1,6}\s+)*/,We=/^(?:FencedCode|CodeBlock)$/,Ge=/^(?:Paragraph|ATXHeading\d|SetextHeading\d|Task|TableCell)$/,Ke=[1,-1],qe=G.marker.length+K.marker.length;function q(e,t,n){let r=N(e);for(let e of Ke)for(let i=r.resolveInner(t.from,e);i;i=i.parent)if(i.name===n&&i.from<=t.from&&i.to>=t.to)return i;return null}function Je(e,t){for(let n=e;n;n=n.parent)if(t.test(n.name))return n;return null}var J=(e,t)=>Ke.some(n=>Je(N(e).resolveInner(t,n),We)!==null),Ye=(e,t)=>{let n=N(e).resolveInner(t.from,1);if(n.name===`HeaderMark`)return!1;let r=Je(n,Ge);return r!==null&&t.to<=r.to};function Xe(e,t){let n=[];for(let r=t.from;r<=t.to;){let i=e.doc.lineAt(r),a=i.from+(Ue.exec(i.text)?.[0].length??0),o=Math.max(t.from,a),s=Math.min(t.to,i.to),c=e.sliceDoc(o,s),l=o+c.length-c.trimStart().length,u=s-(c.length-c.trimEnd().length),d={from:l,to:u};l<u&&Ye(e,d)&&n.push(d),r=i.to+1}return n}function Ze(e,t,n){let r=q(e,{from:t,to:t},n.node);return!r?.firstChild||!r.lastChild?null:t>=r.firstChild.to&&t<=r.lastChild.from?r:null}function Qe(e,t,n){if(t.empty)return!!Ze(e,t.from,n);let r=Xe(e,t);return r.length>0&&r.every(t=>q(e,t,n.node))}var Y=e=>e.firstChild&&e.lastChild?[{from:e.from,to:e.firstChild.to},{from:e.lastChild.from,to:e.to}]:[];function $e(e,t,n){let r=[];return N(e).iterate({from:t.from,to:t.to,enter:e=>{e.name===n&&e.to>t.from&&e.from<t.to&&r.push(e.node)}}),r}function X(e,t,n){let r=e.changes(t),i=r.mapPos(n.from,1),a=Math.max(i,r.mapPos(n.to,-1));return{changes:r,range:n.anchor===n.from?I.range(i,a):I.range(a,i)}}function et(e,t,n){let r=e.doc.lineAt(t),i=t-r.from,a=0;for(;r.text.charAt(i-a-1)===n;)a++;let o=0;for(;r.text.charAt(i+o)===n;)o++;return{before:a,after:o}}function tt(e,t,n,r){let i=t.from;if(J(e,i))return{range:t};let a=r?Ze(e,i,n):null;if(a?.lastChild&&i===a.lastChild.from)return{range:I.cursor(a.to)};if(a)return X(e,Y(a),t);let{marker:o}=n,{before:s,after:c}=et(e,i,o.charAt(0));return s===c&&(s===o.length||s===qe)?{changes:{from:i-o.length,to:i+o.length},range:I.cursor(i-o.length)}:{changes:{from:i,insert:o+o},range:I.cursor(i+o.length)}}function nt(e,t,n,r){let i=[];for(let a of Xe(e,t)){if(r){let t=q(e,a,n.node);t&&i.push(...Y(t));continue}let t=$e(e,a,n.node),o=Math.min(a.from,...t.map(e=>e.from)),s=Math.max(a.to,...t.map(e=>e.to));i.push(...t.flatMap(Y),{from:o,insert:n.marker},{from:s,insert:n.marker})}return X(e,i,t)}var Z=(e,t)=>e.selection.ranges.every(n=>Qe(e,n,t)),Q=e=>({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=Z(t,e),i=t.changeByRange(n=>n.empty?tt(t,n,e,r):nt(t,n,e,r));return n(t.update(i,{scrollIntoView:!0,userEvent:`input.format`})),!0},rt=(e,t)=>{let n=q(e,t,`Link`);return n?.getChild(`URL`)?n:null},it=e=>e.selection.ranges.every(t=>rt(e,t));function at(e,t,n){if(n){let n=rt(e,t),[r,i]=n?.getChildren(`LinkMark`)??[];return!n||!r||!i?{range:t}:X(e,[{from:n.from,to:r.to},{from:i.from,to:n.to}],t)}if(J(e,t.from)||e.doc.lineAt(t.from).number!==e.doc.lineAt(t.to).number)return{range:t};let r=e.sliceDoc(t.from,t.to);return He.test(r)?{changes:{from:t.from,to:t.to,insert:`[](${r})`},range:I.cursor(t.from+1)}:t.empty?{changes:{from:t.from,insert:`[]()`},range:I.cursor(t.from+1)}:{changes:[{from:t.from,insert:`[`},{from:t.to,insert:`]()`}],range:I.cursor(t.to+3)}}var ot=[{id:`bold`,label:`Bold`,key:`b`,run:Q(G),isActive:e=>Z(e,G)},{id:`italic`,label:`Italic`,key:`i`,run:Q(K),isActive:e=>Z(e,K)},{id:`code`,label:`Code`,key:`e`,run:Q(Ve),isActive:e=>Z(e,Ve)},{id:`link`,label:`Link`,key:`k`,run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=it(e);return t(e.update(e.changeByRange(t=>at(e,t,n)),{scrollIntoView:!0,userEvent:`input.format`})),!0},isActive:it}],st=F.high(ve.of(ot.map(e=>({key:`Mod-${e.key}`,run:e.run})))),ct=me([...ne,{tag:A.heading1,class:`cm-md-heading cm-md-h1`},{tag:A.heading2,class:`cm-md-heading cm-md-h2`},{tag:A.heading3,class:`cm-md-heading cm-md-h3`},{tag:[A.heading4,A.heading5,A.heading6],class:`cm-md-heading`},{tag:A.strong,class:`cm-md-strong`},{tag:A.emphasis,class:`cm-md-emphasis`},{tag:A.strikethrough,class:`cm-md-strike`},{tag:A.link,class:`cm-md-link`},{tag:A.url,class:`cm-md-url`},{tag:A.monospace,class:`cm-md-code`},{tag:A.quote,class:`cm-md-quote`},{tag:[A.processingInstruction,A.contentSeparator,A.labelName],class:`cm-md-mark`}]),lt=M.theme({"&.cm-editor":{fontSize:`var(--text-body)`},".cm-content":{lineHeight:`var(--markdown-leading)`},".cm-placeholder":{color:`var(--placeholder)`},".cm-md-link.cm-md-url, .cm-md-link.cm-md-mark":{color:`var(--placeholder)`,textDecoration:`none`},".cm-md-mark":{color:`var(--placeholder)`},".cm-md-bullet":{color:`var(--muted-foreground)`},".cm-line.cm-md-quote-line":{borderLeft:`var(--markdown-quote-rule)`,paddingLeft:`var(--markdown-quote-inset)`},".cm-line.cm-md-fence-line":{backgroundColor:`var(--fill)`,padding:`0 0.75em`,fontFamily:`var(--font-mono)`,fontSize:`0.875em`},".cm-line.cm-md-fence-start":{borderTopLeftRadius:`6px`,borderTopRightRadius:`6px`,paddingTop:`0.25em`},".cm-line.cm-md-fence-end":{borderBottomLeftRadius:`6px`,borderBottomRightRadius:`6px`,paddingBottom:`0.25em`},".cm-md-fence-line .cm-md-code":{backgroundColor:`transparent`,padding:`0`,fontSize:`inherit`},".cm-line.cm-md-rule-line":{background:`linear-gradient(var(--border), var(--border)) no-repeat center / 100% 1px`},"&.cm-editor .cm-tooltip.cm-tooltip-autocomplete > ul":{maxHeight:`none`,padding:`4px`,fontFamily:`var(--font-body)`},"&.cm-editor .cm-tooltip.cm-tooltip-autocomplete > ul > li":{display:`flex`,alignItems:`baseline`,borderRadius:`4px`,padding:`4px 8px`,lineHeight:`1.5`},"&.cm-editor .cm-completionDetail":{fontFamily:`var(--font-mono)`,fontStyle:`normal`}}),ut=[M.editorAttributes.of({class:`mastra-markdown-editor`}),xe(ct),lt],dt=Se.define(),$=L.define({create:()=>!1,update:(e,t)=>t.effects.reduce((e,t)=>t.is(dt)?t.value:e,e)}),ft=M.theme({".cm-tooltip.cm-md-toolbar":{border:`none`,backgroundColor:`transparent`}});function pt(){let e=null,t=new Set,n=n=>{e=n;for(let e of t)e()},r=e=>{let t=document.createElement(`div`);return t.className=`cm-md-toolbar`,{dom:t,offset:{x:0,y:6},mount:()=>n({host:t,view:e,state:e.state}),update:r=>{(r.docChanged||r.selectionSet)&&n({host:t,view:e,state:r.state})},destroy:()=>n(null)}},i=(e,t)=>{let{from:n,to:i,empty:a}=e.selection.main;return a||e.readOnly||!e.field($)?null:t?.pos===n&&t.end===i?t:{pos:n,end:i,above:!0,arrow:!1,create:r}},a=L.define({create:e=>i(e,null),update:(e,t)=>i(t.state,e),provide:e=>be.from(e)});return{extension:[$,M.focusChangeEffect.of((e,t)=>dt.of(t)),a,ft],subscribe:e=>(t.add(e),()=>t.delete(e)),getSnapshot:()=>e}}var mt=[{label:`Heading 1`,markdown:`#`,insert:`# `},{label:`Heading 2`,markdown:`##`,insert:`## `},{label:`Heading 3`,markdown:`###`,insert:`### `},{label:`Bulleted list`,markdown:`-`,insert:`- `},{label:`Numbered list`,markdown:`1.`,insert:`1. `},{label:`Quote`,markdown:`>`,insert:`> `},{label:`Code block`,markdown:"```",insert:"```\n\n```",caret:4},{label:`Divider`,markdown:`***`,insert:`***
3
+ `}].map((e,t)=>({label:e.label,detail:e.markdown,type:`keyword`,boost:-t,apply:(t,n,r,i)=>{let a=r-1;t.dispatch({changes:{from:a,to:i,insert:e.insert},selection:{anchor:a+(e.caret??e.insert.length)},scrollIntoView:!0,userEvent:`input.complete`})}}));function ht(e){if(e.state.readOnly)return null;let t=e.matchBefore(/\/\w*$/);if(!t)return null;let n=e.state.doc.lineAt(t.from);return e.state.sliceDoc(n.from,t.from).trim()!==``||J(e.state,t.from)?null:{from:t.from+1,options:mt,validFor:/^\w*$/}}var gt=j.data.of({autocomplete:ht}),_t={bold:(0,H.jsx)(Ee,{}),italic:(0,H.jsx)(Te,{}),code:(0,H.jsx)(oe,{}),link:(0,H.jsx)(ae,{})},vt=e=>e.preventDefault();function yt({toolbar:e}){let n=(0,B.useSyncExternalStore)(e.subscribe,e.getSnapshot,()=>null),r=i();if(!n)return null;let{host:a,view:o,state:c}=n;return(0,ke.createPortal)((0,H.jsx)(`div`,{role:`toolbar`,"aria-label":`Formatting`,className:E(s,`flex items-center gap-0.5 rounded-full p-1`),children:ot.map(e=>{let n=e.isActive(c),i=t(e.key,r),a=e.key.toUpperCase();return(0,H.jsx)(m,{type:`button`,size:`icon-sm`,variant:n?`subtle`:`ghost`,"aria-label":e.label,"aria-pressed":n,"aria-keyshortcuts":r?`Meta+${a}`:`Control+${a}`,tooltip:(0,H.jsx)(ie,{label:e.label,shortcut:i}),tabIndex:-1,onMouseDown:vt,onClick:()=>e.run(o),children:_t[e.id]},e.id)})}),a)}var bt=c(`relative transition-colors duration-normal ease-out-custom`,{variants:{variant:{default:E(g,`rounded-md px-3 py-2`,f),inline:``}},defaultVariants:{variant:`default`}}),xt={lineNumbers:!1,foldGutter:!1,highlightActiveLine:!1,highlightActiveLineGutter:!1,highlightSelectionMatches:!1,bracketMatching:!1,closeBrackets:!1},St=[...ce,se,M.lineWrapping,he({base:j,codeLanguages:le}),ut,Be,st,gt],Ct=[ye.readOnly.of(!0),F.highest(M.domEventHandlers({paste:()=>!0}))],wt=(0,B.forwardRef)(function({value:e,onChange:t,placeholder:n,editable:r=!0,autoFocus:i,variant:a,className:o,id:s,"aria-label":c,"aria-labelledby":l,"aria-describedby":u,"aria-invalid":d,...f},p){let{contentAttributes:m}=ue({id:s,"aria-label":c,"aria-labelledby":l,"aria-describedby":u,"aria-invalid":d},`Markdown editor`),[h]=(0,B.useState)(pt),g=(0,B.useMemo)(()=>[...St,m,h.extension,...r?[]:[Ct]],[m,h,r]);return(0,H.jsxs)(`div`,{className:E(bt({variant:a}),o),...f,children:[(0,H.jsx)(fe,{ref:p,value:e,theme:de(`body`),extensions:g,onChange:t,editable:r,placeholder:n,autoFocus:i,basicSetup:xt}),(0,H.jsx)(yt,{toolbar:h})]})});function Tt({value:e,readOnly:t,onChange:n}){return t&&e?(0,H.jsx)(re,{children:e}):t?(0,H.jsx)(D,{variant:`body`,tone:`muted`,children:`No instructions`}):(0,H.jsx)(wt,{"aria-label":`Instructions`,value:e,placeholder:`Write the instructions agents follow`,onChange:n,variant:`inline`})}var Et=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,Dt=64;function Ot(e){if(!(e===``||Et.test(e)&&e.length<=Dt))return`Use up to ${Dt} lowercase letters, digits, and single hyphens, such as release-notes.`}function kt(e,t){if(e===``)return`Name the skill to create it.`;if(Ot(e))return`Fix the name to create it.`;if(t.trim()===``)return`Add a description to create it.`}function At({factoryId:e,onCreated:t}){let[n,r]=(0,B.useState)(``),[i,a]=(0,B.useState)(``),[o,s]=(0,B.useState)(``),c=x(e),l=n!==``||i!==``||o!==``,{blocker:u,leave:d}=V(l),f=Ot(n),h=kt(n,i);return(0,H.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,H.jsxs)(`div`,{inert:c.isPending,className:`flex flex-col gap-8`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,H.jsx)(D,{as:`p`,variant:`body`,tone:`ink`,className:`min-w-0 break-words`,children:(0,H.jsx)(k,{value:n,label:`Name`,placeholder:`skill-name`,readOnly:!1,autoFocus:!0,variant:`body`,tone:`ink`,className:`zoom-safe-text`,onChange:e=>r(e.trim())})}),f&&(0,H.jsx)(D,{as:`p`,variant:`caption`,className:`text-destructive-foreground`,children:f}),(0,H.jsx)(Oe,{value:i,required:!1,readOnly:!1,onChange:a})]}),(0,H.jsx)(Tt,{value:o,readOnly:!1,onChange:s})]}),l&&(0,H.jsxs)(W,{status:h??`Only this Factory gets the skill. Agents can load it from their next session.`,notices:c.error&&(0,H.jsx)(p,{variant:`destructive`,role:`alert`,children:(0,H.jsx)(p.Message,{children:c.error.message})}),children:[(0,H.jsx)(m,{size:`sm`,variant:`ghost`,onClick:()=>{r(``),a(``),s(``),c.reset()},disabled:c.isPending,children:`Discard`}),(0,H.jsx)(m,{size:`sm`,variant:`primary`,onClick:()=>c.mutate({name:n,content:De({name:n,description:i,instructions:o})},{onSuccess:()=>d(()=>t(n))}),disabled:h!==void 0||c.isPending,children:c.isPending?`Creating…`:`Create`})]}),(0,H.jsx)(U,{blocker:u,title:`Discard this new skill?`,description:`It has not been created yet.`})]})}function jt({factoryId:e,skill:t,canEdit:n,onDeleted:r}){let[i,a]=(0,B.useState)(),[o,s]=(0,B.useState)(),c=i??t.description,l=o??t.content,[u,d]=(0,B.useState)(!1),f=(0,B.useRef)(null),h=S(e),g=S(e),_=h.isPending||g.isPending,v=n&&(c!==t.description||l!==t.content),{blocker:y,leave:b}=V(v),x=n&&!!t.edited,C=n&&t.origin===`project`,w=(e,t)=>e===t&&!_?void 0:e,T=e=>()=>{a(t=>t===e.description?void 0:t),s(t=>t===e.instructions?void 0:t)};return(0,H.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex min-h-8 flex-wrap items-center gap-2 empty:hidden`,children:[(0,H.jsx)(ee,{skill:t}),(!n||x||C)&&(0,H.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[!n&&(0,H.jsx)(D,{variant:`caption`,tone:`muted`,children:`Only organization admins can edit skills.`}),x&&(0,H.jsx)(m,{size:`sm`,variant:`ghost`,onClick:()=>g.mutate({name:t.name,content:null},{onSuccess:T({description:c,instructions:l})}),disabled:_,children:`Revert to original`}),C&&(0,H.jsx)(m,{ref:f,size:`sm`,variant:`ghost`,onClick:()=>d(!0),disabled:_,children:`Delete`})]})]}),u&&(0,H.jsx)(p,{variant:`warning`,title:`Delete ${t.name}?`,actionPlacement:`end`,action:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(m,{size:`sm`,onClick:()=>{d(!1),f.current?.focus()},disabled:_,autoFocus:!0,children:`Keep`}),(0,H.jsx)(m,{size:`sm`,variant:`destructive`,onClick:()=>g.mutate({name:t.name,content:null},{onSuccess:()=>b(r)}),disabled:_,children:`Delete skill`})]}),children:(0,H.jsx)(p.Message,{children:`Cards entering a phase that runs it won't start until the phase gets another skill.`})}),g.error&&(0,H.jsx)(p,{variant:`destructive`,role:`alert`,children:(0,H.jsx)(p.Message,{children:g.error.message})}),t.error&&(0,H.jsx)(p,{variant:`destructive`,role:`alert`,children:(0,H.jsxs)(p.Message,{children:[`Agents cannot load this skill: `,t.error]})}),t.edited&&t.originalChanged&&(0,H.jsx)(p,{variant:`info`,role:`note`,children:(0,H.jsx)(p.Message,{children:`The original changed since this was edited. Revert to use the new original.`})}),(0,H.jsx)(Oe,{value:c,required:!0,readOnly:!n,onChange:e=>a(w(e,t.description))})]}),(0,H.jsx)(Tt,{value:l,readOnly:!n,onChange:e=>s(w(e,t.content))}),v&&(0,H.jsxs)(W,{status:`Unsaved changes for this Factory. Running sessions keep the version they started with.`,notices:h.error&&(0,H.jsx)(p,{variant:`destructive`,role:`alert`,children:(0,H.jsx)(p.Message,{children:h.error.message})}),children:[(0,H.jsx)(m,{size:`sm`,variant:`ghost`,onClick:()=>{a(void 0),s(void 0),h.reset()},disabled:_,children:`Discard`}),(0,H.jsx)(m,{size:`sm`,variant:`primary`,onClick:()=>h.mutate({name:t.name,content:De({name:t.name,description:c,frontmatter:t.frontmatter,instructions:l})},{onSuccess:T({description:c,instructions:l})}),disabled:_,children:h.isPending?`Saving…`:`Save`})]}),(0,H.jsx)(U,{blocker:y,title:`Discard changes to ${t.name}?`,description:`Your unsaved changes to this skill will be lost.`})]})}function Mt(){let e=r(),t=a()?.boardId??``,{skillName:i}=d(),o=w(e.id,t);return(0,H.jsx)(n,{variant:`form`,backHref:o,backLabel:`Skills`,title:i??`New skill`,LinkComponent:Ce,children:(0,H.jsx)(Nt,{factoryId:e.id,boardId:t,skillName:i})})}function Nt({factoryId:e,boardId:t,skillName:n}){let r=u(),i=b(e),a=w(e,t);if(i.isPending)return(0,H.jsxs)(`div`,{role:`status`,"aria-label":`Loading skill`,className:`flex flex-col gap-4`,children:[(0,H.jsx)(y,{className:`h-9 w-2/3`}),(0,H.jsx)(y,{className:`h-5 w-full`}),(0,H.jsx)(y,{className:`h-40 w-full`})]});if(i.isLoadingError)return(0,H.jsx)(we,{title:`Couldn’t load skills`,error:i.error,onRetry:()=>void i.refetch(),retrying:i.isFetching});let s=i.data.canEdit??!1;if(n===void 0&&!s)return(0,H.jsx)(p,{variant:`info`,children:`Only organization admins can create skills.`});if(n===void 0)return(0,H.jsx)(At,{factoryId:e,onCreated:n=>void r(C(e,t,n),{replace:!0})},e);let c=i.data.skills.find(e=>e.name===n);return c?(0,H.jsx)(jt,{factoryId:e,skill:c,canEdit:s,onDeleted:()=>void r(a,{replace:!0})},`${e}/${c.name}`):(0,H.jsx)(v,{variant:`fill`,titleSlot:(0,H.jsxs)(`span`,{role:`alert`,children:[`This factory has no `,n,` skill.`]}),actionSlot:(0,H.jsx)(m,{render:(0,H.jsx)(o,{to:a}),children:`Back to skills`})})}export{Mt as FactorySkillPage};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-XKyaHtl9.js";import{Fr as e,Nr as t,Pr as n,Tr as r,nn as i}from"./index-D4fnG4KO.js";import{n as a,t as o}from"./Breadcrumb.es-D9PSmzYq.js";import{$n as s,ni as c}from"./GithubIcon.es-B1lB1Q-8.js";import{a as l}from"./Sidebar.es-9pwBnu_Z.js";import{t as u}from"./IconPlusMedium.es-QmObHPf-.js";import{r as d}from"./useBoardEditor-Dm78Yoiu.js";import{i as f,t as p}from"./SkillBadges-DbbPhC5O.js";import{a as m,c as h,d as g}from"./boardConfigPaths-Btimpi_r.js";import{k as _}from"./TabsRoot-C1o0G1CK.js";import{n as v,r as y}from"./Card-BbxDmj8W-BRp0MNo6.js";import{O as b,n as x,t as S}from"./IconChevronRightMedium.es-BjSIsine.js";import{n as C}from"./useBoardCatalog-DZf1osB2.js";import{t as w}from"./HrefLink-Q5kgIdVD.js";import{n as T}from"./boardCatalog-y-s19dQU.js";var E=b();function D(e){return new Set((e??[]).flatMap(e=>e.phases.flatMap(e=>e.skill?[e.skill]:[])))}function O({skill:e,href:t}){return(0,E.jsx)(y,{elevation:`flat`,href:t,LinkComponent:w,children:(0,E.jsxs)(v,{className:`flex items-center gap-4`,children:[(0,E.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(x,{tone:`ink`,as:`span`,variant:`body`,children:e.name}),e.error&&(0,E.jsx)(_,{variant:`destructive`,children:`Failed to load`}),(0,E.jsx)(p,{skill:e})]}),e.error?(0,E.jsxs)(x,{as:`span`,variant:`caption`,className:`text-destructive-foreground whitespace-pre-wrap`,children:[`Agents cannot load this skill: `,e.error]}):(0,E.jsx)(x,{tone:`muted`,as:`span`,variant:`caption`,children:e.description})]}),(0,E.jsx)(S,{"aria-hidden":!0,className:`text-muted-foreground size-icon-md shrink-0`})]})})}function k({factoryId:e,boardId:t}){let n=f(e),r=C(e),i=D(r.data===void 0?void 0:T(r.data)),a=(n.data?.skills??[]).filter(e=>!i.has(e.name)),o=n.isPending||r.isLoading;return(0,E.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[o&&(0,E.jsx)(x,{tone:`muted`,as:`p`,variant:`caption`,role:`status`,children:`Loading skills…`}),n.error&&(0,E.jsx)(x,{as:`p`,variant:`caption`,className:`text-destructive-foreground`,children:n.error instanceof Error?n.error.message:`Failed to load skills`}),r.error&&(0,E.jsx)(x,{as:`p`,variant:`caption`,className:`text-destructive-foreground`,children:`Installed boards could not be loaded, so some of these skills may run in a board phase.`}),!o&&n.isSuccess&&a.length===0&&(0,E.jsx)(x,{tone:`muted`,as:`p`,variant:`caption`,children:`Every skill runs in a board phase.`}),!o&&a.map(n=>(0,E.jsx)(O,{skill:n,href:h(e,t,n.name)},n.name))]})}function A(){let p=r(),h=i()?.boardId??``,{isMobile:_,desktopState:v}=l(),y=_||v===`collapsed`,b=d(p.id,h).data?.board,x=f(p.id).data?.canEdit??!1,S=t({breadcrumbs:y&&b?(0,E.jsxs)(o,{label:`Breadcrumb`,className:`min-w-0 flex-1 overflow-hidden`,children:[(0,E.jsx)(a,{as:s,to:m(p.id,h),children:b.name}),(0,E.jsx)(a,{as:`span`,isCurrent:!0,children:`Skills`})]}):void 0});return(0,E.jsx)(n,{variant:`settings`,header:(0,E.jsxs)(e,{children:[(0,E.jsx)(e.Title,{children:`Skills`}),(0,E.jsx)(e.Description,{children:`Agents load these when they need them. Skills a phase runs are on that phase's page.`}),x&&(0,E.jsx)(e.Action,{children:(0,E.jsx)(c,{size:`sm`,icon:(0,E.jsx)(u,{}),render:(0,E.jsx)(s,{to:g(p.id,h)}),children:`New skill`})})]}),...S,children:(0,E.jsx)(k,{factoryId:p.id,boardId:h})})}export{A as FactorySkillsPage};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{C as t,O as n,T as r,k as i,m as a,o,s}from"./IconChevronRightMedium.es-BjSIsine.js";import{Fi as c,Li as l,Mi as u,Os as d,Pi as f,Wi as p,Yo as m,_t as h,ao as g,as as _,bt as v,ds as y,ei as b,gt as x,lt as S,mt as C,no as w,ps as T,pt as ee,rs as E,st as D,ti as te,ut as O,vt as k,xa as A,ya as ne}from"./GithubIcon.es-B1lB1Q-8.js";import{a as j,c as M,n as N,o as P,r as F,s as I}from"./input-DqReKX0A-B4MUvQwj.js";var L=e(i(),1),R=n(),z=`flex flex-col items-center justify-end gap-1 rounded-md bg-fill p-3`;function B({title:e,caption:t,children:n,className:i,...a}){return(0,R.jsxs)(`figure`,{className:r(`row-span-3 grid grid-rows-subgrid justify-items-start text-start`,i),...a,children:[(0,R.jsx)(`figcaption`,{className:`text-column text-foreground`,children:e}),(0,R.jsx)(`div`,{"aria-hidden":!0,className:r(z,`justify-self-stretch`),children:n}),(0,R.jsx)(`p`,{className:`text-caption text-muted-foreground`,children:t})]})}var V={text:`max-w-64`,illustrated:`w-80 max-w-(--available-width) p-3`};function re({children:e,side:t,align:n,variant:i=`text`,contentClassName:a,...d}){let p=L.useId(),[m,h]=L.useState(!1),g=L.useRef(void 0),_=L.useRef(null),v=i===`illustrated`&&n===void 0;return(0,R.jsxs)(f,{open:m,onOpenChange:h,children:[(0,R.jsx)(l,{ref:_,onPointerDown:e=>{g.current=e.pointerType===`touch`?{wasOpen:m}:void 0,g.current&&e.preventBaseUIHandler()},onClick:e=>{let t=g.current;g.current=void 0,t&&(e.preventBaseUIHandler(),h(!t.wasOpen))},render:(0,R.jsx)(`button`,{type:`button`,...d,"aria-describedby":p,className:r(`relative flex shrink-0 cursor-default items-center rounded-full text-placeholder/80 hover:text-muted-foreground focus-visible:text-muted-foreground`,`pointer-coarse:before:absolute pointer-coarse:before:-inset-1.5 pointer-coarse:before:content-['']`,o,s)}),children:(0,R.jsx)(u,{size:`xs`,children:(0,R.jsx)(te,{})})}),(0,R.jsx)(c,{id:p,keepMounted:!0,side:t??(i===`illustrated`?`bottom`:`top`),align:v?`start`:n,alignOffset:v?({side:e,positioner:t})=>{let n=_.current,r=n?.parentElement?.firstElementChild;if(!n||!r||e===`left`||e===`right`)return 0;let i=r.getBoundingClientRect().left-n.getBoundingClientRect().left;return Math.max(i,24-t.width)}:void 0,className:r(V[i],a),children:i===`illustrated`?(0,R.jsx)(`div`,{className:`grid auto-cols-fr grid-flow-col gap-x-4 gap-y-1.5`,children:e}):e})]})}var H=Object.assign(re,{Panel:B});function U(e,t){let n=p(e);return d(()=>(t(n),()=>{t(e=>e===n?void 0:e)}),[n,t]),n}function W(e={}){let{id:t,fallbackControlId:n,native:r=!1,setLabelId:i,focusControl:a}=e,{controlId:o,setLabelId:s}=O(),c=U(t,g(e=>{s(e),i?.(e)})),l=o??n;function u(e){if(a){a(e,l);return}if(!l)return;let t=G(e.currentTarget,l);y(t)&&K(t)}function d(e){let t=_(e.nativeEvent);E(t,`button,input,select,textarea`)||(!e.defaultPrevented&&e.detail>1&&e.preventDefault(),r||u(e))}return r?{id:c,htmlFor:l,onMouseDown:d}:{id:c,onClick:d,onPointerDown(e){e.preventDefault()}}}function G(e,t){let n=e.getRootNode();for(;T(n);){let e=n.getElementById(t);if(e)return e;n=n.host.getRootNode()}return w(e).getElementById(t)}function K(e){e.focus({focusVisible:!0})}var q=function(e){let n=p(),[r,i]=L.useState(n),[a,o]=L.useState(),[s,c]=L.useState([]),l=r===void 0?n:r,u=t(()=>new Map),{messageIds:d}=O(),f=g((e,t)=>{let n=u.current;t===void 0?n.delete(e):n.set(e,t),i(e=>{if(n.size===0)return e;let t;for(let r of n.values()){if(r===e)return e;t===void 0&&(t=r)}return t})}),m=g(()=>{u.current.size===0&&i(n)}),h=L.useCallback(e=>{let t=e[`aria-describedby`]?e[`aria-describedby`].split(` `):[];return t.push(...d,...s),{...e,"aria-describedby":Array.from(new Set(t)).join(` `)||void 0}},[d,s]),_=L.useMemo(()=>({controlId:l,registerControlId:f,resetControlId:m,labelId:a,setLabelId:o,messageIds:s,setMessageIds:c,getDescriptionProps:h}),[l,f,m,a,o,s,c,h]);return(0,R.jsx)(S.Provider,{value:_,children:e.children})};function ie(e){let{change:t,commit:n,invalid:r,markedDirtyRef:i,name:a,setRegisteredFieldName:o,registeredFieldIdRef:s,setValidityData:c,validityData:l}=e,{formRef:u}=D(),f=L.useRef(null),p=L.useRef(null),m=L.useRef(!1),h=g(()=>{let e=p.current;if(e)return e.getValue?e.getValue():e.value});function _(e){return e.value===void 0?h():e.value}let v=g(()=>{let e=p.current;i.current=!0,n(e?_(e):l.value)});function y(){let e=p.current;e&&e.id&&u.current.fields.set(e.id,{getValue:h,name:a??e.name,controlRef:e.controlRef,validityData:P(l,r),validate:v})}function b(e=p.current?.id){e&&u.current.fields.delete(e)}function x(e){if(m.current)return;m.current=!0;let t=_(e);c(e=>e.initialValue===t?e:{...e,initialValue:t})}return d(()=>{let e=p.current;e&&e.id&&(o(a?void 0:e.name),u.current.fields.set(e.id,{getValue:h,name:a??e.name,controlRef:e.controlRef,validityData:P(l,r),validate:v}))},[u,h,r,a,o,v,l]),d(()=>{let e=u.current.fields;return()=>{let t=p.current?.id;t&&e.delete(t)}},[u]),[v,g((e,n)=>{if(!n){f.current===e&&(f.current=null,t(void 0,!0),b(),p.current=null,o(void 0),s.current=void 0);return}let r=p.current?.id,i=f.current;i&&i!==e&&t(void 0,!0),f.current=e,p.current=n,a||o(n.name),s.current=n.id,r&&r!==n.id&&b(r),x(n),y()})]}var ae=L.forwardRef(function(e,t){let{errors:n,validationMode:r,submitCountRef:i}=D(),{render:o,className:s,validate:c,validationDebounceTime:l=0,validationMode:u=r,name:f,disabled:p=!1,invalid:m,dirty:_,touched:v,actionsRef:y,style:b,...S}=e,C=F(!0)?.disabled,w=g(c||(()=>null)),T=C||p,[E,te]=L.useState(!1),[O,k]=L.useState(!1),[A,ne]=L.useState(!1),[M,N]=L.useState(!1),P=L.useRef(void 0),I=_??O,z=v??E,B=L.useRef(I),V=L.useRef(void 0),[re,H]=L.useState(),U=f??re;d(()=>{_!==void 0&&(B.current=_)},[_]);let W=g(e=>{_===void 0&&(e&&(B.current=!0),k(e))}),G=g(e=>{v===void 0&&te(e)}),K=g(()=>u===`onChange`||u===`onSubmit`&&i.current>0),q=U&&Object.hasOwn(n,U)?n[U]:null,ae=!!(Array.isArray(q)?q.length:q),J=m===!0||ae,[Y,X]=L.useState({state:x,error:``,errors:[],value:null,initialValue:null}),Z=!J&&(T?null:Y.state.valid),Q=L.useMemo(()=>({disabled:T,touched:z,dirty:I,valid:Z,filled:A,focused:M}),[T,z,I,Z,A,M]),$=j({setValidityData:X,validate:w,validityData:Y,validationDebounceTime:l,invalid:J,markedDirtyRef:B,state:Q,shouldValidateOnChange:K,validationMode:u,registeredFieldIdRef:V}),[oe,se]=ie({change:$.change,commit:$.commit,invalid:J,markedDirtyRef:B,name:f,setRegisteredFieldName:H,registeredFieldIdRef:V,setValidityData:X,validityData:Y});L.useImperativeHandle(y,()=>({validate:oe}),[oe]);let ce=L.useMemo(()=>({invalid:J,name:U,validityData:Y,setValidityData:X,disabled:T,setTouched:G,setDirty:W,setFilled:ne,setFocused:N,focusOwnerRef:P,validationMode:u,shouldValidateOnChange:K,state:Q,registerFieldControl:se,validation:$}),[J,U,Y,T,G,W,ne,N,u,K,Q,se,$]),le=a(`div`,e,{ref:t,state:Q,props:S,stateAttributesMapping:h});return(0,R.jsx)(ee.Provider,{value:ce,children:le})}),J=L.forwardRef(function(e,t){return(0,R.jsx)(q,{children:(0,R.jsx)(ae,{...e,ref:t})})}),Y=L.forwardRef(function(e,t){let{render:n,className:r,style:i,id:o,nativeLabel:s=!0,...c}=e,l=C(!1),u=M(),{labelId:d}=O(),f={...l.state,disabled:l.disabled||u.disabled},p=L.useRef(null),m=W({id:d??o,native:s});return a(`label`,e,{ref:[t,p],state:f,props:[m,c],stateAttributesMapping:h})}),X={...h,...m},Z=L.forwardRef(function(e,t){let{render:n,id:r,className:i,match:o,style:s,...c}=e,l=p(r),{validityData:u,state:f,name:m}=C(!1),{setMessageIds:h}=O(),{errors:g}=D(),_=m&&Object.hasOwn(g,m)?g[m]:null,v=!!(Array.isArray(_)?_.length:_),y=typeof o==`string`,b=!1;b=o===!0?!0:f.disabled?!1:y?!!u.state[o]:v||u.state.valid===!1;let{mounted:x,transitionStatus:S,setMounted:w}=A(b);d(()=>{if(b&&l)return h(e=>e.concat(l)),()=>{h(e=>e.filter(e=>e!==l))}},[b,l,h]);let T=L.useRef(null),[ee,E]=L.useState(null),[te,k]=L.useState(null),j=u.error;!y&&v?j=_:u.errors.length>1&&(j=u.errors);let M=j;Array.isArray(j)&&(M=j.length>1?(0,R.jsx)(`ul`,{children:j.map(e=>(0,R.jsx)(`li`,{children:e},e))}):j[0]);let N=Array.isArray(j)?JSON.stringify(j):j;b&&N!==te&&(k(N),E(M)),ne({open:b,ref:T,onComplete(){b||w(!1)}});let P={...f,transitionStatus:S},F=a(`div`,e,{ref:[t,T],state:P,props:[{id:l,children:b?M:ee},c],stateAttributesMapping:X,enabled:x});return x?F:null}),Q=L.forwardRef(function(e,t){let{render:n,id:r,className:i,style:o,...s}=e,c=p(r),l=C(!1),u=M(),{setMessageIds:f}=O(),m={...l.state,disabled:l.disabled||u.disabled};return d(()=>{if(c)return f(e=>e.concat(c)),()=>{f(e=>e.filter(e=>e!==c))}},[c,f]),a(`p`,e,{ref:t,state:m,props:[{id:c},s],stateAttributesMapping:h})}),$=L.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:o=!1,...s}=e,{state:c,disabled:l}=C(!1),u=l||o,d={...c,disabled:u},f=L.useMemo(()=>({disabled:u}),[u]),p=a(`div`,e,{ref:t,state:d,props:s,stateAttributesMapping:h});return(0,R.jsx)(q,{children:(0,R.jsx)(I.Provider,{value:f,children:p})})}),oe=L.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:o=!1,...s}=e,[c,l]=L.useState(void 0),u=F(!0)?.disabled||o,d=a(`fieldset`,e,{ref:t,state:{disabled:u},props:[{"aria-labelledby":c,disabled:u},s]}),f=L.useMemo(()=>({legendId:c,setLegendId:l,disabled:u}),[c,l,u]);return(0,R.jsx)(N.Provider,{value:f,children:d})}),se={vertical:`grid gap-2`,horizontal:`flex items-center gap-2 has-[>[data-slot=field-label]:first-child,>[data-slot=field-label-row]:first-child]:justify-between`,responsive:`flex flex-col gap-2 sm:flex-row sm:items-center`};function ce({className:e,orientation:t=`vertical`,invalid:n=!1,...i}){let a=L.useId(),[o,s]=L.useState(!1),c=L.useMemo(()=>({labelId:`${a}-label`,descriptionId:`${a}-description`,errorId:`${a}-error`,controlId:`${a}-control`,invalid:n,hasDescription:o,setHasDescription:s}),[a,n,o]);return(0,R.jsx)(k.Provider,{value:c,children:(0,R.jsx)(J,{invalid:n,"data-slot":`field`,"data-orientation":t,className:r(`min-w-0 text-foreground`,se[t],e),...i})})}function le({className:e,...t}){let n=v()===null?J:$;return(0,R.jsx)(k.Provider,{value:null,children:(0,R.jsx)(n,{"data-slot":`field-item`,className:r(`flex min-w-0 items-center gap-2`,e),...t})})}function ue(){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{"aria-hidden":!0,className:`ml-0.5 text-destructive-foreground in-data-disabled:text-muted-foreground`,children:`*`}),` `,(0,R.jsx)(`span`,{className:`sr-only`,children:`(required)`})]})}function de(e){let t=L.Children.toArray(e);if(t.every(e=>typeof e==`string`||typeof e==`number`))return t.join(``)}function fe({label:e,labelId:t,aboutId:n}){let r=de(e);return r?{"aria-label":`About ${r}`}:t?{"aria-labelledby":`${n} ${t}`}:{"aria-label":`About this field`}}function pe({children:e,label:t,labelId:n}){let r=L.useId(),i=fe({label:t,labelId:n,aboutId:r}),a=`aria-labelledby`in i;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(H,{...i,children:e}),a?(0,R.jsx)(`span`,{id:r,hidden:!0,children:`About`}):null]})}function me({className:e,required:t=!1,size:n=`default`,info:i,children:a,onClick:o,...s}){let c=v(),l=(0,R.jsxs)(Y,{id:c?.labelId,"data-slot":`field-label`,className:r(`inline-flex shrink-0 items-center text-label text-foreground data-disabled:text-muted-foreground`,`[:where(&:not(:has([role=checkbox],[role=switch],[role=radio])))]:w-fit`,`not-data-disabled:has-[[role=checkbox],[role=switch],[role=radio]]:cursor-pointer`,`not-data-disabled:[:is([data-slot=field],[data-slot=field-item]):has(>[role=checkbox],>[role=switch],>[role=radio])_&]:cursor-pointer`,`data-disabled:cursor-not-allowed`,n===`smaller`&&`text-column`,n===`bigger`&&`text-body`,e),onClick:e=>{o?.(e),c&&!e.defaultPrevented&&e.currentTarget.ownerDocument.getElementById(c.controlId)?.focus()},...s,children:[a,t?(0,R.jsx)(ue,{}):null]});return i?(0,R.jsxs)(`span`,{"data-slot":`field-label-row`,className:`flex w-fit items-center gap-1`,children:[l,(0,R.jsx)(pe,{label:a,labelId:c?.labelId,children:i})]}):l}function he({className:e,...t}){let n=v(),i=n?.setHasDescription;return L.useEffect(()=>{if(i)return i(!0),()=>i(!1)},[i]),(0,R.jsx)(Q,{id:n?.descriptionId,"data-slot":`field-description`,className:r(`-mt-1 text-caption text-muted-foreground`,e),...t})}var ge=`-mt-1 flex gap-1 text-body-sm text-destructive-foreground`;function _e(){return(0,R.jsx)(u,{size:`xs`,className:`mt-1 shrink-0`,"aria-hidden":!0,children:(0,R.jsx)(b,{})})}function ve({className:e,children:t,...n}){let i=v();return t?(0,R.jsxs)(Z,{id:i?.errorId,match:!0,role:`alert`,"data-slot":`field-error`,className:r(ge,e),...n,children:[(0,R.jsx)(_e,{}),(0,R.jsx)(`span`,{className:`min-w-0`,children:t})]},`external`):(0,R.jsx)(Z,{id:i?.errorId,role:`alert`,"data-slot":`field-error`,className:r(ge,e),...n,render:({children:e,...t})=>(0,R.jsxs)(`div`,{...t,children:[(0,R.jsx)(_e,{}),(0,R.jsx)(`span`,{className:`min-w-0`,children:e})]})},`native`)}function ye({className:e,...t}){return(0,R.jsx)(oe,{"data-slot":`fieldset`,className:r(`m-0 grid min-w-0 gap-3 border-0 p-0`,e),...t})}export{me as a,le as i,he as n,ye as o,ve as r,H as s,ce as t};