@flexkit/studio 0.2.32 → 0.2.34

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 (157) hide show
  1. package/dist/activity-nav-button-ZHQOZBCC.js +2 -0
  2. package/dist/{activity-nav-button-E4I4YC3X.js.map → activity-nav-button-ZHQOZBCC.js.map} +1 -1
  3. package/dist/astro.js +1 -1
  4. package/dist/chat-page-7XT4K75G.js +4 -0
  5. package/dist/chat-page-7XT4K75G.js.map +1 -0
  6. package/dist/chunk-2FCVATRT.js +4 -0
  7. package/dist/{chunk-R2O4WC3H.js.map → chunk-2FCVATRT.js.map} +1 -1
  8. package/dist/{chunk-ERCVR23U.js → chunk-36DLIVZF.js} +2 -2
  9. package/dist/{chunk-ERCVR23U.js.map → chunk-36DLIVZF.js.map} +1 -1
  10. package/dist/{chunk-ONB3FWK5.js → chunk-3OBELKJU.js} +2 -2
  11. package/dist/{chunk-ONB3FWK5.js.map → chunk-3OBELKJU.js.map} +1 -1
  12. package/dist/chunk-4ZWQ44NZ.js +2 -0
  13. package/dist/{chunk-2NXQF2F7.js.map → chunk-4ZWQ44NZ.js.map} +1 -1
  14. package/dist/chunk-5JUG4BEF.js +2 -0
  15. package/dist/chunk-5JUG4BEF.js.map +1 -0
  16. package/dist/{chunk-XV7U33XQ.js → chunk-6AJRQSFO.js} +3 -3
  17. package/dist/{chunk-XV7U33XQ.js.map → chunk-6AJRQSFO.js.map} +1 -1
  18. package/dist/chunk-7JA6SI5H.js +2 -0
  19. package/dist/{chunk-5AJXR47U.js.map → chunk-7JA6SI5H.js.map} +1 -1
  20. package/dist/{chunk-SZEGGBOC.js → chunk-A4DPLZZF.js} +2 -2
  21. package/dist/{chunk-SZEGGBOC.js.map → chunk-A4DPLZZF.js.map} +1 -1
  22. package/dist/{chunk-C4XLDODU.js → chunk-C2KPTRYM.js} +3 -1
  23. package/dist/{chunk-GSGPULRL.js → chunk-CHNQZU2P.js} +2 -2
  24. package/dist/{chunk-GSGPULRL.js.map → chunk-CHNQZU2P.js.map} +1 -1
  25. package/dist/chunk-DFBG7PUJ.js +10 -0
  26. package/dist/{chunk-JAPZBEBZ.js.map → chunk-DFBG7PUJ.js.map} +1 -1
  27. package/dist/{chunk-V7C4EHK3.js → chunk-DSLPTDZX.js} +2 -2
  28. package/dist/{chunk-V7C4EHK3.js.map → chunk-DSLPTDZX.js.map} +1 -1
  29. package/dist/{chunk-EMFHKTAV.js → chunk-EUWIIL3X.js} +2 -2
  30. package/dist/{chunk-EMFHKTAV.js.map → chunk-EUWIIL3X.js.map} +1 -1
  31. package/dist/chunk-G5N6HEPW.js +2 -0
  32. package/dist/chunk-G5N6HEPW.js.map +1 -0
  33. package/dist/chunk-HR4QZ5TD.js +3 -0
  34. package/dist/chunk-HR4QZ5TD.js.map +1 -0
  35. package/dist/chunk-KO2JLLUJ.js +2 -0
  36. package/dist/chunk-KO2JLLUJ.js.map +1 -0
  37. package/dist/chunk-MBBE4RND.js +3 -0
  38. package/dist/chunk-MBBE4RND.js.map +1 -0
  39. package/dist/{chunk-USNXQOMJ.js → chunk-N33S7BSG.js} +2 -2
  40. package/dist/{chunk-USNXQOMJ.js.map → chunk-N33S7BSG.js.map} +1 -1
  41. package/dist/{chunk-KN7OJFEX.js → chunk-N52JTYBJ.js} +2 -2
  42. package/dist/{chunk-KN7OJFEX.js.map → chunk-N52JTYBJ.js.map} +1 -1
  43. package/dist/{chunk-KR27GOH6.js → chunk-PC5Z37LT.js} +3 -3
  44. package/dist/{chunk-KR27GOH6.js.map → chunk-PC5Z37LT.js.map} +1 -1
  45. package/dist/{chunk-2NQ2RZ2M.js → chunk-PSECMZJC.js} +3 -3
  46. package/dist/{chunk-2NQ2RZ2M.js.map → chunk-PSECMZJC.js.map} +1 -1
  47. package/dist/chunk-RBGXXVF4.js +7 -0
  48. package/dist/{chunk-NNISUDZX.js.map → chunk-RBGXXVF4.js.map} +1 -1
  49. package/dist/chunk-RULCANNM.js +7 -0
  50. package/dist/chunk-RULCANNM.js.map +1 -0
  51. package/dist/chunk-S7Z6KKIN.js +2 -0
  52. package/dist/chunk-S7Z6KKIN.js.map +1 -0
  53. package/dist/{chunk-AY2RXJWS.js → chunk-U6NFYYTF.js} +2 -2
  54. package/dist/{chunk-AY2RXJWS.js.map → chunk-U6NFYYTF.js.map} +1 -1
  55. package/dist/chunk-VFV44YZB.js +2 -0
  56. package/dist/{chunk-54AXLGAK.js.map → chunk-VFV44YZB.js.map} +1 -1
  57. package/dist/chunk-VRDTHLA3.js +3 -0
  58. package/dist/chunk-VRDTHLA3.js.map +1 -0
  59. package/dist/chunk-WU2KCXBC.js +2 -0
  60. package/dist/{chunk-5LGIALCK.js.map → chunk-WU2KCXBC.js.map} +1 -1
  61. package/dist/chunk-X3SHNHHM.js +2 -0
  62. package/dist/chunk-X3SHNHHM.js.map +1 -0
  63. package/dist/chunk-XYFS6X74.js +2 -0
  64. package/dist/{chunk-JWJJZVP3.js.map → chunk-XYFS6X74.js.map} +1 -1
  65. package/dist/chunk-YC7PBLTK.js +2 -0
  66. package/dist/{chunk-MRHZN4G4.js.map → chunk-YC7PBLTK.js.map} +1 -1
  67. package/dist/electron.js +1 -1
  68. package/dist/{entry-CA2QAEHN.js → entry-APJ4V7PW.js} +2 -2
  69. package/dist/{entry-CA2QAEHN.js.map → entry-APJ4V7PW.js.map} +1 -1
  70. package/dist/index.css +43 -0
  71. package/dist/index.d.ts +10 -1
  72. package/dist/index.js +8 -8
  73. package/dist/index.js.map +1 -1
  74. package/dist/list-7IHDJM54.js +3 -0
  75. package/dist/{list-Q2KAEJ26.js.map → list-7IHDJM54.js.map} +1 -1
  76. package/dist/list-7WFALOUT.js +2 -0
  77. package/dist/{list-UMMVRYVD.js.map → list-7WFALOUT.js.map} +1 -1
  78. package/dist/nextjs.js +1 -1
  79. package/dist/pages-BV3ABSFQ.js +5 -0
  80. package/dist/{pages-KZ66JVNU.js.map → pages-BV3ABSFQ.js.map} +1 -1
  81. package/dist/plugin-pages-OWGJPPWV.js +2 -0
  82. package/dist/{plugin-pages-SR2WSUKZ.js.map → plugin-pages-OWGJPPWV.js.map} +1 -1
  83. package/dist/project-selector-V5N2724B.js +2 -0
  84. package/dist/project-selector-V5N2724B.js.map +1 -0
  85. package/dist/record-links-3P3XSW66.js +2 -0
  86. package/dist/{record-links-3WZGSVFU.js.map → record-links-3P3XSW66.js.map} +1 -1
  87. package/dist/root-F2GTYDJM.js +2 -0
  88. package/dist/{root-6QTQUYK4.js.map → root-F2GTYDJM.js.map} +1 -1
  89. package/dist/root-GBBZ3DX5.js +31 -0
  90. package/dist/{root-7BUVDOMV.js.map → root-GBBZ3DX5.js.map} +1 -1
  91. package/dist/root-J62PBDZ2.js +2 -0
  92. package/dist/{root-2VBLPRG7.js.map → root-J62PBDZ2.js.map} +1 -1
  93. package/dist/root-LYRL7VPN.js +14 -0
  94. package/dist/{root-LFJ5BQSY.js.map → root-LYRL7VPN.js.map} +1 -1
  95. package/dist/root-NIL2UHKS.js +2 -0
  96. package/dist/{root-OXS3QQX6.js.map → root-NIL2UHKS.js.map} +1 -1
  97. package/dist/root-RGZZYETM.js +23 -0
  98. package/dist/{root-FZLKYL5W.js.map → root-RGZZYETM.js.map} +1 -1
  99. package/dist/search-IIGNCQEZ.js +2 -0
  100. package/dist/{search-AZK3Q2KX.js.map → search-IIGNCQEZ.js.map} +1 -1
  101. package/dist/skills-pages-T52MF4DO.js +2 -0
  102. package/dist/{skills-pages-7IYBJ4QI.js.map → skills-pages-T52MF4DO.js.map} +1 -1
  103. package/dist/source-IJAAJDGW.js +2 -0
  104. package/dist/{source-4BP5PJ2N.js.map → source-IJAAJDGW.js.map} +1 -1
  105. package/dist/spec-renderer-Z6GVHLFU.js +2 -0
  106. package/dist/{spec-renderer-3GAVSV52.js.map → spec-renderer-Z6GVHLFU.js.map} +1 -1
  107. package/dist/tanstack-start.js +1 -1
  108. package/dist/ui.js +1 -1
  109. package/dist/user-nav-ZH63YHX7.js +2 -0
  110. package/dist/{user-nav-OWTTAXZS.js.map → user-nav-ZH63YHX7.js.map} +1 -1
  111. package/package.json +2 -2
  112. package/dist/activity-nav-button-E4I4YC3X.js +0 -2
  113. package/dist/chat-page-7UB3BMBF.js +0 -4
  114. package/dist/chat-page-7UB3BMBF.js.map +0 -1
  115. package/dist/chunk-2NXQF2F7.js +0 -2
  116. package/dist/chunk-32ZU4MLE.js +0 -2
  117. package/dist/chunk-32ZU4MLE.js.map +0 -1
  118. package/dist/chunk-54AXLGAK.js +0 -2
  119. package/dist/chunk-5AJXR47U.js +0 -2
  120. package/dist/chunk-5LGIALCK.js +0 -2
  121. package/dist/chunk-6NRQMG26.js +0 -2
  122. package/dist/chunk-6NRQMG26.js.map +0 -1
  123. package/dist/chunk-AKQ6ELDX.js +0 -2
  124. package/dist/chunk-AKQ6ELDX.js.map +0 -1
  125. package/dist/chunk-DGIY4SKN.js +0 -7
  126. package/dist/chunk-DGIY4SKN.js.map +0 -1
  127. package/dist/chunk-HDOIOXMP.js +0 -2
  128. package/dist/chunk-HDOIOXMP.js.map +0 -1
  129. package/dist/chunk-HZOD2HOF.js +0 -3
  130. package/dist/chunk-HZOD2HOF.js.map +0 -1
  131. package/dist/chunk-JAPZBEBZ.js +0 -10
  132. package/dist/chunk-JWJJZVP3.js +0 -2
  133. package/dist/chunk-MRHZN4G4.js +0 -2
  134. package/dist/chunk-NNISUDZX.js +0 -7
  135. package/dist/chunk-O2QMYUPS.js +0 -2
  136. package/dist/chunk-O2QMYUPS.js.map +0 -1
  137. package/dist/chunk-R2O4WC3H.js +0 -4
  138. package/dist/chunk-WPCPL2TQ.js +0 -3
  139. package/dist/chunk-WPCPL2TQ.js.map +0 -1
  140. package/dist/list-Q2KAEJ26.js +0 -3
  141. package/dist/list-UMMVRYVD.js +0 -2
  142. package/dist/pages-KZ66JVNU.js +0 -5
  143. package/dist/plugin-pages-SR2WSUKZ.js +0 -2
  144. package/dist/project-selector-72VM6SUI.js +0 -2
  145. package/dist/project-selector-72VM6SUI.js.map +0 -1
  146. package/dist/record-links-3WZGSVFU.js +0 -2
  147. package/dist/root-2VBLPRG7.js +0 -2
  148. package/dist/root-6QTQUYK4.js +0 -2
  149. package/dist/root-7BUVDOMV.js +0 -31
  150. package/dist/root-FZLKYL5W.js +0 -23
  151. package/dist/root-LFJ5BQSY.js +0 -14
  152. package/dist/root-OXS3QQX6.js +0 -2
  153. package/dist/search-AZK3Q2KX.js +0 -2
  154. package/dist/skills-pages-7IYBJ4QI.js +0 -2
  155. package/dist/source-4BP5PJ2N.js +0 -2
  156. package/dist/spec-renderer-3GAVSV52.js +0 -2
  157. package/dist/user-nav-OWTTAXZS.js +0 -2
@@ -0,0 +1,2 @@
1
+ import'./index.css';import {a,c}from'./chunk-X3SHNHHM.js';import {Select,Dialog}from'radix-ui';import {ChevronDownIcon,CheckIcon,ChevronUpIcon,XIcon}from'lucide-react';import {jsx,jsxs}from'react/jsx-runtime';function h({...e}){return jsx(Select.Root,{"data-slot":"select",...e})}function D({...e}){return jsx(Select.Group,{"data-slot":"select-group",...e})}function w({...e}){return jsx(Select.Value,{"data-slot":"select-value",...e})}function R({className:e,size:t="default",children:n,...f}){return jsxs(Select.Trigger,{"data-slot":"select-trigger","data-size":t,className:a("fk:flex fk:w-full fk:items-center fk:justify-between fk:gap-2 fk:rounded-md fk:border fk:border-input fk:bg-background fk:px-3 fk:py-2 fk:text-sm fk:whitespace-nowrap fk:shadow-xs fk:transition-[color,box-shadow] fk:outline-none fk:focus-visible:border-ring fk:focus-visible:ring-[3px] fk:focus-visible:ring-ring/50 fk:disabled:cursor-not-allowed fk:disabled:opacity-50 fk:aria-invalid:border-destructive fk:aria-invalid:ring-destructive/20 fk:data-placeholder:text-muted-foreground fk:data-[size=default]:h-9 fk:data-[size=sm]:h-8 fk:*:data-[slot=select-value]:line-clamp-1 fk:*:data-[slot=select-value]:flex fk:*:data-[slot=select-value]:items-center fk:*:data-[slot=select-value]:gap-2 fk:hover:bg-accent fk:dark:aria-invalid:ring-destructive/40 fk:*[_svg]:pointer-events-none fk:*[_svg]:shrink-0 fk:*[_svg:not([class*='size-'])]:size-4 fk:*[_svg:not([class*='text-'])]:text-muted-foreground fk:corner-squircle",e),...f,children:[n,jsx(Select.Icon,{asChild:true,children:jsx(ChevronDownIcon,{className:"fk:size-4 fk:opacity-50"})})]})}function z({className:e,children:t,position:n="item-aligned",align:f="center",...p}){return jsx(Select.Portal,{children:jsxs(Select.Content,{"data-slot":"select-content",className:a("fk:relative fk:z-50 fk:max-h-(--radix-select-content-available-height) fk:min-w-[8rem] fk:origin-(--radix-select-content-transform-origin) fk:overflow-x-hidden fk:overflow-y-auto fk:rounded-md fk:border fk:bg-popover fk:text-popover-foreground fk:shadow-md fk:data-[side=bottom]:slide-in-from-top-2 fk:data-[side=left]:slide-in-from-right-2 fk:data-[side=right]:slide-in-from-left-2 fk:data-[side=top]:slide-in-from-bottom-2 fk:data-[state=closed]:animate-out fk:data-[state=closed]:fade-out-0 fk:data-[state=closed]:zoom-out-95 fk:data-[state=open]:animate-in fk:data-[state=open]:fade-in-0 fk:data-[state=open]:zoom-in-95 fk:corner-squircle",n==="popper"&&"fk:data-[side=bottom]:translate-y-1 fk:data-[side=left]:-translate-x-1 fk:data-[side=right]:translate-x-1 fk:data-[side=top]:-translate-y-1",e),position:n,align:f,...p,children:[jsx(g,{}),jsx(Select.Viewport,{className:a("fk:p-1",n==="popper"&&"fk:h-(--radix-select-trigger-height) fk:w-full fk:min-w-(--radix-select-trigger-width) fk:scroll-my-1"),children:t}),jsx(v,{})]})})}function N({className:e,...t}){return jsx(Select.Label,{"data-slot":"select-label",className:a("fk:px-2 fk:py-1.5 fk:text-xs fk:text-muted-foreground",e),...t})}function I({className:e,children:t,...n}){return jsxs(Select.Item,{"data-slot":"select-item",className:a("fk:relative fk:flex fk:w-full fk:cursor-default fk:items-center fk:gap-2 fk:rounded-sm fk:py-1.5 fk:pr-8 fk:pl-2 fk:text-sm fk:outline-hidden fk:select-none fk:hover:bg-accent fk:hover:text-accent-foreground fk:focus:bg-accent fk:focus:text-accent-foreground fk:data-[disabled]:pointer-events-none fk:data-[disabled]:opacity-50 fk:*[_svg]:pointer-events-none fk:*[_svg]:shrink-0 fk:*[_svg:not([class*='size-'])]:size-4 fk:*[_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 fk:corner-squircle",e),...n,children:[jsx("span",{"data-slot":"select-item-indicator",className:"fk:absolute fk:right-2 fk:flex fk:size-3.5 fk:items-center fk:justify-center",children:jsx(Select.ItemIndicator,{children:jsx(CheckIcon,{className:"fk:size-4"})})}),jsx(Select.ItemText,{children:t})]})}function B({className:e,...t}){return jsx(Select.Separator,{"data-slot":"select-separator",className:a("fk:pointer-events-none fk:-mx-1 fk:my-1 fk:h-px fk:bg-border",e),...t})}function g({className:e,...t}){return jsx(Select.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:a("fk:flex fk:cursor-default fk:items-center fk:justify-center fk:py-1",e),...t,children:jsx(ChevronUpIcon,{className:"size-4"})})}function v({className:e,...t}){return jsx(Select.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:a("fk:flex fk:cursor-default fk:items-center fk:justify-center fk:py-1",e),...t,children:jsx(ChevronDownIcon,{className:"size-4"})})}function G({...e}){return jsx(Dialog.Root,{"data-slot":"dialog",...e})}function L({...e}){return jsx(Dialog.Trigger,{"data-slot":"dialog-trigger",...e})}function x({...e}){return jsx(Dialog.Portal,{"data-slot":"dialog-portal",...e})}function O({...e}){return jsx(Dialog.Close,{"data-slot":"dialog-close",...e})}function b({className:e,...t}){return jsx(Dialog.Overlay,{"data-slot":"dialog-overlay",className:a("fk:fixed fk:inset-0 fk:z-50 fk:bg-black/50 fk:data-[state=closed]:animate-out fk:data-[state=closed]:fade-out-0 fk:data-[state=open]:animate-in fk:data-[state=open]:fade-in-0",e),...t})}function F({className:e,children:t,showCloseButton:n=true,...f}){return jsxs(x,{"data-slot":"dialog-portal",children:[jsx(b,{}),jsxs(Dialog.Content,{"data-slot":"dialog-content",className:a("fk:fixed fk:top-[50%] fk:left-[50%] fk:z-50 fk:grid fk:w-full fk:max-w-[calc(100%-2rem)] fk:translate-x-[-50%] fk:translate-y-[-50%] fk:gap-4 fk:rounded-lg fk:border fk:bg-background fk:p-6 fk:shadow-lg fk:duration-200 fk:outline-none fk:data-[state=closed]:animate-out fk:data-[state=closed]:fade-out-0 fk:data-[state=closed]:zoom-out-95 fk:data-[state=open]:animate-in fk:data-[state=open]:fade-in-0 fk:data-[state=open]:zoom-in-95 fk:sm:max-w-lg fk:corner-squircle",e),...f,children:[t,n&&jsxs(Dialog.Close,{"data-slot":"dialog-close",className:"fk:absolute fk:top-4 fk:right-4 fk:rounded-xs fk:opacity-70 fk:ring-offset-background fk:transition-opacity fk:hover:opacity-100 fk:focus:ring-2 fk:focus:ring-ring fk:focus:ring-offset-2 fk:focus:outline-hidden fk:disabled:pointer-events-none fk:data-[state=open]:bg-accent fk:data-[state=open]:text-muted-foreground fk:[&_svg]:pointer-events-none fk:[&_svg]:shrink-0 fk:[&_svg:not([class*='size-'])]:size-4 fk:corner-squircle",children:[jsx(XIcon,{}),jsx("span",{className:"fk:sr-only",children:"Close"})]})]})]})}function H({className:e,...t}){return jsx("div",{"data-slot":"dialog-header",className:a("fk:flex fk:flex-col fk:gap-2 fk:text-center fk:sm:text-left",e),...t})}function X({className:e,showCloseButton:t=false,children:n,...f}){return jsxs("div",{"data-slot":"dialog-footer",className:a("fk:flex fk:flex-col-reverse fk:gap-2 fk:sm:flex-row fk:sm:justify-end",e),...f,children:[n,t&&jsx(Dialog.Close,{asChild:true,children:jsx(c,{variant:"outline",children:"Close"})})]})}function A({className:e,...t}){return jsx(Dialog.Title,{"data-slot":"dialog-title",className:a("fk:text-lg fk:leading-none fk:font-semibold fk:text-left",e),...t})}function E({className:e,...t}){return jsx(Dialog.Description,{"data-slot":"dialog-description",className:a("fk:text-sm fk:text-muted-foreground fk:text-left",e),...t})}export{h as a,D as b,w as c,R as d,z as e,N as f,I as g,B as h,g as i,v as j,G as k,L as l,x as m,O as n,b as o,F as p,H as q,X as r,A as s,E as t};//# sourceMappingURL=chunk-S7Z6KKIN.js.map
2
+ //# sourceMappingURL=chunk-S7Z6KKIN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ui/primitives/select.tsx","../src/ui/primitives/dialog.tsx"],"names":["Select","props","jsx","SelectPrimitive","SelectGroup","SelectValue","SelectTrigger","className","size","children","jsxs","cn","ChevronDownIcon","SelectContent","position","align","SelectScrollUpButton","SelectScrollDownButton","SelectLabel","SelectItem","CheckIcon","SelectSeparator","ChevronUpIcon","Dialog","DialogPrimitive","DialogTrigger","DialogPortal","DialogClose","DialogOverlay","DialogContent","showCloseButton","XIcon","DialogHeader","DialogFooter","Button","DialogTitle","DialogDescription"],"mappings":"iNAOA,SAASA,CAAAA,CAAO,CAAE,GAAGC,CAAM,CAAA,CAAsD,CAC/E,OAAOC,GAAAA,CAACC,OAAgB,IAAA,CAAhB,CAAqB,WAAA,CAAU,QAAA,CAAU,GAAGF,CAAAA,CAAO,CAC7D,CAEA,SAASG,EAAY,CAAE,GAAGH,CAAM,CAAA,CAAuD,CACrF,OAAOC,GAAAA,CAACC,MAAAA,CAAgB,KAAA,CAAhB,CAAsB,WAAA,CAAU,cAAA,CAAgB,GAAGF,CAAAA,CAAO,CACpE,CAEA,SAASI,CAAAA,CAAY,CAAE,GAAGJ,CAAM,CAAA,CAAuD,CACrF,OAAOC,IAACC,MAAAA,CAAgB,KAAA,CAAhB,CAAsB,WAAA,CAAU,eAAgB,GAAGF,CAAAA,CAAO,CACpE,CAEA,SAASK,CAAAA,CAAc,CACrB,UAAAC,CAAAA,CACA,IAAA,CAAAC,EAAO,SAAA,CACP,QAAA,CAAAC,CAAAA,CACA,GAAGR,CACL,CAAA,CAEG,CACD,OACES,IAAAA,CAACP,OAAgB,OAAA,CAAhB,CACC,WAAA,CAAU,gBAAA,CACV,YAAWK,CAAAA,CACX,SA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,CAAO,OAAA,CAAQ,SAAA,CAAU,iBAAK,CAAA,CACjC,CAAA,CAAA,CAEJ,CAEJ,CAEA,SAASC,CAAAA,CAAY,CAAE,UAAA5B,CAAAA,CAAW,GAAGN,CAAM,CAAA,CAAuD,CAChG,OACEC,GAAAA,CAACsB,OAAgB,KAAA,CAAhB,CACC,WAAA,CAAU,cAAA,CACV,UAAWb,CAAAA,CAAG,0DAAA,CAA4DJ,CAAS,CAAA,CAClF,GAAGN,CAAAA,CACN,CAEJ,CAEA,SAASmC,EAAkB,CAAE,SAAA,CAAA7B,CAAAA,CAAW,GAAGN,CAAM,CAAA,CAA6D,CAC5G,OACEC,GAAAA,CAACsB,OAAgB,WAAA,CAAhB,CACC,WAAA,CAAU,oBAAA,CACV,UAAWb,CAAAA,CAAG,kDAAA,CAAoDJ,CAAS,CAAA,CAC1E,GAAGN,EACN,CAEJ","file":"chunk-S7Z6KKIN.js","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Select as SelectPrimitive } from 'radix-ui';\nimport { CheckIcon, ChevronDownIcon, ChevronUpIcon } from 'lucide-react';\nimport { cn } from '../lib/utils';\n\nfunction Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>) {\n return <SelectPrimitive.Root data-slot=\"select\" {...props} />;\n}\n\nfunction SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>) {\n return <SelectPrimitive.Group data-slot=\"select-group\" {...props} />;\n}\n\nfunction SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>) {\n return <SelectPrimitive.Value data-slot=\"select-value\" {...props} />;\n}\n\nfunction SelectTrigger({\n className,\n size = 'default',\n children,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {\n size?: 'sm' | 'default';\n}) {\n return (\n <SelectPrimitive.Trigger\n data-slot=\"select-trigger\"\n data-size={size}\n className={cn(\n \"fk:flex fk:w-full fk:items-center fk:justify-between fk:gap-2 fk:rounded-md fk:border fk:border-input fk:bg-background fk:px-3 fk:py-2 fk:text-sm fk:whitespace-nowrap fk:shadow-xs fk:transition-[color,box-shadow] fk:outline-none fk:focus-visible:border-ring fk:focus-visible:ring-[3px] fk:focus-visible:ring-ring/50 fk:disabled:cursor-not-allowed fk:disabled:opacity-50 fk:aria-invalid:border-destructive fk:aria-invalid:ring-destructive/20 fk:data-placeholder:text-muted-foreground fk:data-[size=default]:h-9 fk:data-[size=sm]:h-8 fk:*:data-[slot=select-value]:line-clamp-1 fk:*:data-[slot=select-value]:flex fk:*:data-[slot=select-value]:items-center fk:*:data-[slot=select-value]:gap-2 fk:hover:bg-accent fk:dark:aria-invalid:ring-destructive/40 fk:*[_svg]:pointer-events-none fk:*[_svg]:shrink-0 fk:*[_svg:not([class*='size-'])]:size-4 fk:*[_svg:not([class*='text-'])]:text-muted-foreground fk:corner-squircle\",\n className\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild>\n <ChevronDownIcon className=\"fk:size-4 fk:opacity-50\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n );\n}\n\nfunction SelectContent({\n className,\n children,\n position = 'item-aligned',\n align = 'center',\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Content>) {\n return (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n data-slot=\"select-content\"\n className={cn(\n 'fk:relative fk:z-50 fk:max-h-(--radix-select-content-available-height) fk:min-w-[8rem] fk:origin-(--radix-select-content-transform-origin) fk:overflow-x-hidden fk:overflow-y-auto fk:rounded-md fk:border fk:bg-popover fk:text-popover-foreground fk:shadow-md fk:data-[side=bottom]:slide-in-from-top-2 fk:data-[side=left]:slide-in-from-right-2 fk:data-[side=right]:slide-in-from-left-2 fk:data-[side=top]:slide-in-from-bottom-2 fk:data-[state=closed]:animate-out fk:data-[state=closed]:fade-out-0 fk:data-[state=closed]:zoom-out-95 fk:data-[state=open]:animate-in fk:data-[state=open]:fade-in-0 fk:data-[state=open]:zoom-in-95 fk:corner-squircle',\n position === 'popper' &&\n 'fk:data-[side=bottom]:translate-y-1 fk:data-[side=left]:-translate-x-1 fk:data-[side=right]:translate-x-1 fk:data-[side=top]:-translate-y-1',\n className\n )}\n position={position}\n align={align}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n className={cn(\n 'fk:p-1',\n position === 'popper' &&\n 'fk:h-(--radix-select-trigger-height) fk:w-full fk:min-w-(--radix-select-trigger-width) fk:scroll-my-1'\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n );\n}\n\nfunction SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>) {\n return (\n <SelectPrimitive.Label\n data-slot=\"select-label\"\n className={cn('fk:px-2 fk:py-1.5 fk:text-xs fk:text-muted-foreground', className)}\n {...props}\n />\n );\n}\n\nfunction SelectItem({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>) {\n return (\n <SelectPrimitive.Item\n data-slot=\"select-item\"\n className={cn(\n \"fk:relative fk:flex fk:w-full fk:cursor-default fk:items-center fk:gap-2 fk:rounded-sm fk:py-1.5 fk:pr-8 fk:pl-2 fk:text-sm fk:outline-hidden fk:select-none fk:hover:bg-accent fk:hover:text-accent-foreground fk:focus:bg-accent fk:focus:text-accent-foreground fk:data-[disabled]:pointer-events-none fk:data-[disabled]:opacity-50 fk:*[_svg]:pointer-events-none fk:*[_svg]:shrink-0 fk:*[_svg:not([class*='size-'])]:size-4 fk:*[_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 fk:corner-squircle\",\n className\n )}\n {...props}\n >\n <span\n data-slot=\"select-item-indicator\"\n className=\"fk:absolute fk:right-2 fk:flex fk:size-3.5 fk:items-center fk:justify-center\"\n >\n <SelectPrimitive.ItemIndicator>\n <CheckIcon className=\"fk:size-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n );\n}\n\nfunction SelectSeparator({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Separator>) {\n return (\n <SelectPrimitive.Separator\n data-slot=\"select-separator\"\n className={cn('fk:pointer-events-none fk:-mx-1 fk:my-1 fk:h-px fk:bg-border', className)}\n {...props}\n />\n );\n}\n\nfunction SelectScrollUpButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {\n return (\n <SelectPrimitive.ScrollUpButton\n data-slot=\"select-scroll-up-button\"\n className={cn('fk:flex fk:cursor-default fk:items-center fk:justify-center fk:py-1', className)}\n {...props}\n >\n <ChevronUpIcon className=\"size-4\" />\n </SelectPrimitive.ScrollUpButton>\n );\n}\n\nfunction SelectScrollDownButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {\n return (\n <SelectPrimitive.ScrollDownButton\n data-slot=\"select-scroll-down-button\"\n className={cn('fk:flex fk:cursor-default fk:items-center fk:justify-center fk:py-1', className)}\n {...props}\n >\n <ChevronDownIcon className=\"size-4\" />\n </SelectPrimitive.ScrollDownButton>\n );\n}\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n};\n","'use client';\n\nimport * as React from 'react';\nimport { Dialog as DialogPrimitive } from 'radix-ui';\nimport { XIcon } from 'lucide-react';\nimport { cn } from '../lib/utils';\nimport { Button } from './button';\n\nfunction Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) {\n return <DialogPrimitive.Root data-slot=\"dialog\" {...props} />;\n}\n\nfunction DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />;\n}\n\nfunction DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />;\n}\n\nfunction DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />;\n}\n\nfunction DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>) {\n return (\n <DialogPrimitive.Overlay\n data-slot=\"dialog-overlay\"\n className={cn(\n 'fk:fixed fk:inset-0 fk:z-50 fk:bg-black/50 fk:data-[state=closed]:animate-out fk:data-[state=closed]:fade-out-0 fk:data-[state=open]:animate-in fk:data-[state=open]:fade-in-0',\n className\n )}\n {...props}\n />\n );\n}\n\nfunction DialogContent({\n className,\n children,\n showCloseButton = true,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Content> & {\n showCloseButton?: boolean;\n}) {\n return (\n <DialogPortal data-slot=\"dialog-portal\">\n <DialogOverlay />\n <DialogPrimitive.Content\n data-slot=\"dialog-content\"\n className={cn(\n 'fk:fixed fk:top-[50%] fk:left-[50%] fk:z-50 fk:grid fk:w-full fk:max-w-[calc(100%-2rem)] fk:translate-x-[-50%] fk:translate-y-[-50%] fk:gap-4 fk:rounded-lg fk:border fk:bg-background fk:p-6 fk:shadow-lg fk:duration-200 fk:outline-none fk:data-[state=closed]:animate-out fk:data-[state=closed]:fade-out-0 fk:data-[state=closed]:zoom-out-95 fk:data-[state=open]:animate-in fk:data-[state=open]:fade-in-0 fk:data-[state=open]:zoom-in-95 fk:sm:max-w-lg fk:corner-squircle',\n className\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close\n data-slot=\"dialog-close\"\n className=\"fk:absolute fk:top-4 fk:right-4 fk:rounded-xs fk:opacity-70 fk:ring-offset-background fk:transition-opacity fk:hover:opacity-100 fk:focus:ring-2 fk:focus:ring-ring fk:focus:ring-offset-2 fk:focus:outline-hidden fk:disabled:pointer-events-none fk:data-[state=open]:bg-accent fk:data-[state=open]:text-muted-foreground fk:[&_svg]:pointer-events-none fk:[&_svg]:shrink-0 fk:[&_svg:not([class*='size-'])]:size-4 fk:corner-squircle\"\n >\n <XIcon />\n <span className=\"fk:sr-only\">Close</span>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DialogPortal>\n );\n}\n\nfunction DialogHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn('fk:flex fk:flex-col fk:gap-2 fk:text-center fk:sm:text-left', className)}\n {...props}\n />\n );\n}\n\nfunction DialogFooter({\n className,\n showCloseButton = false,\n children,\n ...props\n}: React.ComponentProps<'div'> & {\n showCloseButton?: boolean;\n}) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn('fk:flex fk:flex-col-reverse fk:gap-2 fk:sm:flex-row fk:sm:justify-end', className)}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close asChild>\n <Button variant=\"outline\">Close</Button>\n </DialogPrimitive.Close>\n )}\n </div>\n );\n}\n\nfunction DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={cn('fk:text-lg fk:leading-none fk:font-semibold fk:text-left', className)}\n {...props}\n />\n );\n}\n\nfunction DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={cn('fk:text-sm fk:text-muted-foreground fk:text-left', className)}\n {...props}\n />\n );\n}\n\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n};\n"]}
@@ -1,2 +1,2 @@
1
- import'./index.css';import {c}from'./chunk-XMOSCJOI.js';import {a}from'./chunk-ERDARDGB.js';import {f}from'./chunk-HZOD2HOF.js';import {d}from'./chunk-WPCPL2TQ.js';import {useMemo}from'react';import A from'swr';import {find,propEq}from'ramda';function T(n,o){let{scope:c$1}=c(),{currentProject:r}=f(),a=useMemo(()=>r?.schema??[],[r]),m=r?.scopes?.find(t=>t.isDefault)?.name??"default",e=o?.commonParams.q?JSON.stringify(o):null,{data:s,error:i,isLoading:y}=A(e,()=>fetch(d(n).search,{headers:{"Content-Type":"application/json"},body:JSON.stringify(o),method:"POST",mode:"cors"}).then(t=>t.json()),{keepPreviousData:true});return {results:useMemo(()=>e?E(s?.results??[],n,a,c$1,m)??[]:[],[s,m,n,a,c$1,e]),error:i,isLoading:y}}function E(n,o,c,r,a$1){return n?.filter(l=>l?.hits?.length>0).map(l=>{let m=l,e=m.collection.replace(`${o}_`,"").replace(/_\d+$/,""),s=find(propEq(e,"plural"))(c);if(!s)return [];let i=a(s)?.name??"",y=s?.name??e;return m.hits.map(({document:u})=>{let t=u[i],b=(t&&typeof t!="string"?t[r]??t[a$1]:null)??u[i],N=Object.entries(u).reduce((d,[p,f])=>{if(p!==i&&p!=="id"&&p!=="_updatedAt"){let _=typeof f!="string"?f[r]??f[a$1]:f;d[p]=_;}return d},{});return {_id:u.id,_entityName:y,_entityNamePlural:e,[i]:b,...N}})}).flat()}export{T as a};//# sourceMappingURL=chunk-AY2RXJWS.js.map
2
- //# sourceMappingURL=chunk-AY2RXJWS.js.map
1
+ import'./index.css';import {c}from'./chunk-XMOSCJOI.js';import {a}from'./chunk-ERDARDGB.js';import {f}from'./chunk-VRDTHLA3.js';import {d}from'./chunk-MBBE4RND.js';import {useMemo}from'react';import A from'swr';import {find,propEq}from'ramda';function T(n,o){let{scope:c$1}=c(),{currentProject:r}=f(),a=useMemo(()=>r?.schema??[],[r]),m=r?.scopes?.find(t=>t.isDefault)?.name??"default",e=o?.commonParams.q?JSON.stringify(o):null,{data:s,error:i,isLoading:y}=A(e,()=>fetch(d(n).search,{headers:{"Content-Type":"application/json"},body:JSON.stringify(o),method:"POST",mode:"cors"}).then(t=>t.json()),{keepPreviousData:true});return {results:useMemo(()=>e?E(s?.results??[],n,a,c$1,m)??[]:[],[s,m,n,a,c$1,e]),error:i,isLoading:y}}function E(n,o,c,r,a$1){return n?.filter(l=>l?.hits?.length>0).map(l=>{let m=l,e=m.collection.replace(`${o}_`,"").replace(/_\d+$/,""),s=find(propEq(e,"plural"))(c);if(!s)return [];let i=a(s)?.name??"",y=s?.name??e;return m.hits.map(({document:u})=>{let t=u[i],b=(t&&typeof t!="string"?t[r]??t[a$1]:null)??u[i],N=Object.entries(u).reduce((d,[p,f])=>{if(p!==i&&p!=="id"&&p!=="_updatedAt"){let _=typeof f!="string"?f[r]??f[a$1]:f;d[p]=_;}return d},{});return {_id:u.id,_entityName:y,_entityNamePlural:e,[i]:b,...N}})}).flat()}export{T as a};//# sourceMappingURL=chunk-U6NFYYTF.js.map
2
+ //# sourceMappingURL=chunk-U6NFYYTF.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/core/use-search.tsx"],"names":["useSearch","projectId","searchRequest","scope","useAppContext","currentProject","useConfig","schema","useMemo","defaultScope","s","swrKey","data","error","isLoading","useSWR","apiPaths","res","mapResults","results","result","item","entityNamePlural","entitySchema","find","propEq","primaryAttributeName","getDisplayAttribute","entityName","document","primaryAttribute","primaryAttributeValue","attributes","acc","key","value","scopedValue"],"mappings":"mPAWO,SAASA,EACdC,CAAAA,CACAC,CAAAA,CACwE,CACxE,GAAM,CAAE,KAAA,CAAAC,GAAM,CAAA,CAAIC,GAAc,CAC1B,CAAE,cAAA,CAAAC,CAAe,EAAIC,CAAAA,EAAU,CAC/BC,CAAAA,CAASC,OAAAA,CAAQ,IAAMH,CAAAA,EAAgB,MAAA,EAAU,EAAC,CAAG,CAACA,CAAc,CAAC,CAAA,CAErEI,EADSJ,CAAAA,EAAgB,MAAA,EACF,IAAA,CAAMK,CAAAA,EAAMA,EAAE,SAAS,CAAA,EAAG,IAAA,EAAQ,SAAA,CACzDC,EAAST,CAAAA,EAAe,YAAA,CAAa,CAAA,CAAI,IAAA,CAAK,SAAA,CAAUA,CAAa,CAAA,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';\nimport useSWR from 'swr';\nimport { find, propEq } from 'ramda';\nimport { apiPaths } from './api-paths';\nimport { useAppContext } from './app-context';\nimport { useConfig } from './config/config-context';\nimport { getDisplayAttribute } from './get-display-attribute';\nimport type { Entity, RawResultItem, RawSearchResultItems, SearchRequestProps, SearchResultItem } from './types';\n\nexport function useSearch(\n projectId: string,\n searchRequest: SearchRequestProps | null\n): { results: SearchResultItem[] | []; error: Error; isLoading: boolean } {\n const { scope } = useAppContext();\n const { currentProject } = useConfig();\n const schema = useMemo(() => currentProject?.schema ?? [], [currentProject]);\n const scopes = currentProject?.scopes;\n const defaultScope = scopes?.find((s) => s.isDefault)?.name ?? 'default';\n const swrKey = searchRequest?.commonParams.q ? JSON.stringify(searchRequest) : null;\n const { data, error, isLoading } = useSWR(\n swrKey,\n () =>\n fetch(apiPaths(projectId).search, {\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(searchRequest),\n method: 'POST',\n mode: 'cors',\n }).then((res) => res.json() as Promise<{ results: RawSearchResultItems }>),\n // Show the previous hits until the next request lands instead of flashing an empty list per keystroke.\n { keepPreviousData: true }\n );\n const results = useMemo(\n // SWR keeps the previous key's data while a new key loads, and also after the key becomes null.\n // Callers treat an empty query as \"no search\", so return no hits once there is nothing to search for.\n () => (swrKey ? (mapResults(data?.results ?? [], projectId, schema, scope, defaultScope) ?? []) : []),\n [data, defaultScope, projectId, schema, scope, swrKey]\n );\n\n return { results, error, isLoading };\n}\n\nfunction mapResults(\n results: RawSearchResultItems | undefined,\n projectId: string,\n schema: Entity[],\n scope: string,\n defaultScope: string\n): SearchResultItem[] | undefined {\n return results\n ?.filter((result) => (result as RawResultItem)?.hits?.length > 0)\n .map((result) => {\n const item = result as RawResultItem;\n const entityNamePlural = item.collection.replace(`${projectId}_`, '').replace(/_\\d+$/, '');\n const entitySchema = find<Entity>(propEq(entityNamePlural, 'plural'))(schema);\n\n if (!entitySchema) {\n return [];\n }\n\n const primaryAttributeName = getDisplayAttribute(entitySchema)?.name ?? '';\n const entityName = entitySchema?.name ?? entityNamePlural;\n\n // iterate over the hits and return an object with the primary attribute value first and then the rest of the attributes.\n return item.hits.map(({ document }) => {\n const primaryAttribute = document[primaryAttributeName];\n const scopedPrimaryAttribute =\n primaryAttribute && typeof primaryAttribute !== 'string'\n ? (primaryAttribute[scope] ?? primaryAttribute[defaultScope])\n : null;\n const primaryAttributeValue = scopedPrimaryAttribute ?? document[primaryAttributeName];\n const attributes = Object.entries(document).reduce(\n (acc: Omit<SearchResultItem, '_id' | '_entityName' | '_entityNamePlural'>, [key, value]) => {\n if (key !== primaryAttributeName && key !== 'id' && key !== '_updatedAt') {\n const scopedValue = typeof value !== 'string' ? (value[scope] ?? value[defaultScope]) : value;\n\n acc[key] = scopedValue;\n }\n\n return acc;\n },\n {}\n );\n\n return {\n _id: document.id,\n _entityName: entityName,\n _entityNamePlural: entityNamePlural,\n [primaryAttributeName]: primaryAttributeValue as string,\n ...attributes,\n };\n });\n })\n .flat();\n}\n"]}
1
+ {"version":3,"sources":["../src/core/use-search.tsx"],"names":["useSearch","projectId","searchRequest","scope","useAppContext","currentProject","useConfig","schema","useMemo","defaultScope","s","swrKey","data","error","isLoading","useSWR","apiPaths","res","mapResults","results","result","item","entityNamePlural","entitySchema","find","propEq","primaryAttributeName","getDisplayAttribute","entityName","document","primaryAttribute","primaryAttributeValue","attributes","acc","key","value","scopedValue"],"mappings":"mPAWO,SAASA,EACdC,CAAAA,CACAC,CAAAA,CACwE,CACxE,GAAM,CAAE,KAAA,CAAAC,GAAM,CAAA,CAAIC,GAAc,CAC1B,CAAE,cAAA,CAAAC,CAAe,EAAIC,CAAAA,EAAU,CAC/BC,CAAAA,CAASC,OAAAA,CAAQ,IAAMH,CAAAA,EAAgB,MAAA,EAAU,EAAC,CAAG,CAACA,CAAc,CAAC,CAAA,CAErEI,EADSJ,CAAAA,EAAgB,MAAA,EACF,IAAA,CAAMK,CAAAA,EAAMA,EAAE,SAAS,CAAA,EAAG,IAAA,EAAQ,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,CACF,CAAC,CACH,CAAC,CAAA,CACA,MACL","file":"chunk-U6NFYYTF.js","sourcesContent":["'use client';\n\nimport { useMemo } from 'react';\nimport useSWR from 'swr';\nimport { find, propEq } from 'ramda';\nimport { apiPaths } from './api-paths';\nimport { useAppContext } from './app-context';\nimport { useConfig } from './config/config-context';\nimport { getDisplayAttribute } from './get-display-attribute';\nimport type { Entity, RawResultItem, RawSearchResultItems, SearchRequestProps, SearchResultItem } from './types';\n\nexport function useSearch(\n projectId: string,\n searchRequest: SearchRequestProps | null\n): { results: SearchResultItem[] | []; error: Error; isLoading: boolean } {\n const { scope } = useAppContext();\n const { currentProject } = useConfig();\n const schema = useMemo(() => currentProject?.schema ?? [], [currentProject]);\n const scopes = currentProject?.scopes;\n const defaultScope = scopes?.find((s) => s.isDefault)?.name ?? 'default';\n const swrKey = searchRequest?.commonParams.q ? JSON.stringify(searchRequest) : null;\n const { data, error, isLoading } = useSWR(\n swrKey,\n () =>\n fetch(apiPaths(projectId).search, {\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(searchRequest),\n method: 'POST',\n mode: 'cors',\n }).then((res) => res.json() as Promise<{ results: RawSearchResultItems }>),\n // Show the previous hits until the next request lands instead of flashing an empty list per keystroke.\n { keepPreviousData: true }\n );\n const results = useMemo(\n // SWR keeps the previous key's data while a new key loads, and also after the key becomes null.\n // Callers treat an empty query as \"no search\", so return no hits once there is nothing to search for.\n () => (swrKey ? (mapResults(data?.results ?? [], projectId, schema, scope, defaultScope) ?? []) : []),\n [data, defaultScope, projectId, schema, scope, swrKey]\n );\n\n return { results, error, isLoading };\n}\n\nfunction mapResults(\n results: RawSearchResultItems | undefined,\n projectId: string,\n schema: Entity[],\n scope: string,\n defaultScope: string\n): SearchResultItem[] | undefined {\n return results\n ?.filter((result) => (result as RawResultItem)?.hits?.length > 0)\n .map((result) => {\n const item = result as RawResultItem;\n const entityNamePlural = item.collection.replace(`${projectId}_`, '').replace(/_\\d+$/, '');\n const entitySchema = find<Entity>(propEq(entityNamePlural, 'plural'))(schema);\n\n if (!entitySchema) {\n return [];\n }\n\n const primaryAttributeName = getDisplayAttribute(entitySchema)?.name ?? '';\n const entityName = entitySchema?.name ?? entityNamePlural;\n\n // iterate over the hits and return an object with the primary attribute value first and then the rest of the attributes.\n return item.hits.map(({ document }) => {\n const primaryAttribute = document[primaryAttributeName];\n const scopedPrimaryAttribute =\n primaryAttribute && typeof primaryAttribute !== 'string'\n ? (primaryAttribute[scope] ?? primaryAttribute[defaultScope])\n : null;\n const primaryAttributeValue = scopedPrimaryAttribute ?? document[primaryAttributeName];\n const attributes = Object.entries(document).reduce(\n (acc: Omit<SearchResultItem, '_id' | '_entityName' | '_entityNamePlural'>, [key, value]) => {\n if (key !== primaryAttributeName && key !== 'id' && key !== '_updatedAt') {\n const scopedValue = typeof value !== 'string' ? (value[scope] ?? value[defaultScope]) : value;\n\n acc[key] = scopedValue;\n }\n\n return acc;\n },\n {}\n );\n\n return {\n _id: document.id,\n _entityName: entityName,\n _entityNamePlural: entityNamePlural,\n [primaryAttributeName]: primaryAttributeValue as string,\n ...attributes,\n };\n });\n })\n .flat();\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import'./index.css';import {r,s,t}from'./chunk-RULCANNM.js';import {l,b,c as c$1,e,f,g,h,j,i}from'./chunk-5JUG4BEF.js';import {c,a}from'./chunk-X3SHNHHM.js';import {CirclePlus,Check}from'lucide-react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';function w({column:s$1,title:i$1,options:d}){let r$1=new Set(s$1?.getFilterValue());return jsxs(r,{children:[jsx(s,{asChild:true,children:jsxs(c,{variant:"outline",size:"sm",className:"fk:h-8 fk:border-dashed",children:[jsx(CirclePlus,{className:"fk:mr-2 fk:h-4 fk:w-4"}),i$1,r$1?.size>0&&jsxs(Fragment,{children:[jsx(l,{orientation:"vertical",className:"fk:mx-2 fk:h-4"}),jsx(b,{variant:"secondary",className:"fk:rounded-xs fk:px-1 fk:font-normal fk:lg:hidden fk:corner-squircle",children:r$1.size}),jsx("div",{className:"fk:space-x-1 fk:lg:flex",children:r$1.size>2?jsxs(b,{variant:"secondary",className:"fk:rounded-xs fk:px-1 fk:font-normal fk:corner-squircle",children:[r$1.size," selected"]}):d.filter(a=>r$1.has(a.value)).map(a=>jsx(b,{variant:"secondary",className:"fk:rounded-xs fk:px-1 fk:font-normal fk:corner-squircle",children:a.label},a.value))})]})]})}),jsx(t,{className:"fk:w-50 fk:p-0",align:"start",children:jsxs(c$1,{children:[jsx(e,{placeholder:i$1}),jsxs(f,{children:[jsx(g,{children:"No results found."}),jsx(h,{children:d.map(a$1=>{let m=r$1.has(a$1.value);return jsxs(j,{onSelect:()=>{m?r$1.delete(a$1.value):r$1.add(a$1.value);let c=Array.from(r$1);s$1?.setFilterValue(c.length?c:void 0);},children:[jsx("div",{className:a("fk:mr-2 fk:flex fk:h-4 fk:w-4 fk:items-center fk:justify-center fk:rounded-xs fk:border fk:border-primary fk:corner-squircle",m?"fk:bg-primary fk:text-primary-foreground":"fk:opacity-50 fk:[&_svg]:invisible"),children:jsx(Check,{className:a("fk:size-3.5",m?"fk:text-primary-foreground":"fk:text-muted-foreground")})}),a$1.icon&&jsx(a$1.icon,{className:"fk:mr-2 fk:h-4 fk:w-4 fk:text-muted-foreground"}),jsx("span",{children:a$1.label})]},a$1.value)})}),r$1.size>0&&jsxs(Fragment,{children:[jsx(i,{}),jsx(h,{children:jsx(j,{onSelect:()=>s$1?.setFilterValue(void 0),className:"fk:justify-center fk:text-center",children:"Clear filters"})})]})]})]})})]})}export{w as a};//# sourceMappingURL=chunk-VFV44YZB.js.map
2
+ //# sourceMappingURL=chunk-VFV44YZB.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/data-grid/data-table-faceted-filter.tsx"],"names":["DataTableFacetedFilter","column","title","options","selectedValues","jsxs","Popover","jsx","PopoverTrigger","Button","CirclePlusIcon","Fragment","Separator","Badge","option","PopoverContent","Command","CommandInput","CommandList","CommandEmpty","CommandGroup","isS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D,CAAAA,CACT,aAAA,CACAH,CAAAA,CAAa,4BAAA,CAA+B,0BAC9C,CAAA,CACF,EACF,CAAA,CACCP,GAAAA,CAAO,IAAA,EAAQP,GAAAA,CAACO,GAAAA,CAAO,IAAA,CAAP,CAAY,SAAA,CAAU,iDAAiD,CAAA,CACxFP,GAAAA,CAAC,MAAA,CAAA,CAAM,QAAA,CAAAO,GAAAA,CAAO,KAAA,CAAM,CAAA,CAAA,CAAA,CAzBfA,GAAAA,CAAO,KA0Bd,CAEJ,CAAC,CAAA,CACH,CAAA,CACCV,GAAAA,CAAe,IAAA,CAAO,CAAA,EACrBC,IAAAA,CAAAM,SAAA,CACE,QAAA,CAAA,CAAAJ,GAAAA,CAACmB,CAAAA,CAAA,EAAiB,CAAA,CAClBnB,GAAAA,CAACa,CAAAA,CAAA,CACC,QAAA,CAAAb,GAAAA,CAACe,GAAAA,CAAA,CACC,QAAA,CAAU,IAAMrB,GAAAA,EAAQ,cAAA,CAAe,MAAS,CAAA,CAChD,SAAA,CAAU,kCAAA,CACX,QAAA,CAAA,eAAA,CAED,EACF,CAAA,CAAA,CACF,CAAA,CAAA,CAEJ,CAAA,CAAA,CACF,CAAA,CACF,GACF,CAEJ","file":"chunk-54AXLGAK.js","sourcesContent":["import * as React from 'react';\nimport { Check as CheckIcon, CirclePlus as CirclePlusIcon } from 'lucide-react';\nimport { Column } from '@tanstack/react-table';\nimport { cn } from '../ui/lib/utils';\nimport { Badge } from '../ui/primitives/badge';\nimport { Button } from '../ui/primitives/button';\nimport {\n Command,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n} from '../ui/primitives/command';\nimport { Popover, PopoverContent, PopoverTrigger } from '../ui/primitives/popover';\nimport { Separator } from '../ui/primitives/separator';\n\ninterface DataTableFacetedFilterProps<TData, TValue> {\n column?: Column<TData, TValue>;\n title?: string;\n options: {\n label: string;\n value: string;\n icon?: React.ComponentType<{ className?: string }>;\n }[];\n}\n\nexport function DataTableFacetedFilter<TData, TValue>({\n column,\n title,\n options,\n}: DataTableFacetedFilterProps<TData, TValue>) {\n const selectedValues = new Set(column?.getFilterValue() as string[]);\n\n return (\n <Popover>\n <PopoverTrigger asChild>\n <Button variant=\"outline\" size=\"sm\" className=\"fk:h-8 fk:border-dashed\">\n <CirclePlusIcon className=\"fk:mr-2 fk:h-4 fk:w-4\" />\n {title}\n {selectedValues?.size > 0 && (\n <>\n <Separator orientation=\"vertical\" className=\"fk:mx-2 fk:h-4\" />\n <Badge variant=\"secondary\" className=\"fk:rounded-xs fk:px-1 fk:font-normal fk:lg:hidden fk:corner-squircle\">\n {selectedValues.size}\n </Badge>\n <div className=\"fk:space-x-1 fk:lg:flex\">\n {selectedValues.size > 2 ? (\n <Badge variant=\"secondary\" className=\"fk:rounded-xs fk:px-1 fk:font-normal fk:corner-squircle\">\n {selectedValues.size} selected\n </Badge>\n ) : (\n options\n .filter((option) => selectedValues.has(option.value))\n .map((option) => (\n <Badge variant=\"secondary\" key={option.value} className=\"fk:rounded-xs fk:px-1 fk:font-normal fk:corner-squircle\">\n {option.label}\n </Badge>\n ))\n )}\n </div>\n </>\n )}\n </Button>\n </PopoverTrigger>\n <PopoverContent className=\"fk:w-50 fk:p-0\" align=\"start\">\n <Command>\n <CommandInput placeholder={title} />\n <CommandList>\n <CommandEmpty>No results found.</CommandEmpty>\n <CommandGroup>\n {options.map((option) => {\n const isSelected = selectedValues.has(option.value);\n return (\n <CommandItem\n key={option.value}\n onSelect={() => {\n if (isSelected) {\n selectedValues.delete(option.value);\n } else {\n selectedValues.add(option.value);\n }\n const filterValues = Array.from(selectedValues);\n column?.setFilterValue(filterValues.length ? filterValues : undefined);\n }}\n >\n <div\n className={cn(\n 'fk:mr-2 fk:flex fk:h-4 fk:w-4 fk:items-center fk:justify-center fk:rounded-xs fk:border fk:border-primary fk:corner-squircle',\n isSelected ? 'fk:bg-primary fk:text-primary-foreground' : 'fk:opacity-50 fk:[&_svg]:invisible'\n )}\n >\n <CheckIcon\n className={cn(\n 'fk:size-3.5',\n isSelected ? 'fk:text-primary-foreground' : 'fk:text-muted-foreground'\n )}\n />\n </div>\n {option.icon && <option.icon className=\"fk:mr-2 fk:h-4 fk:w-4 fk:text-muted-foreground\" />}\n <span>{option.label}</span>\n </CommandItem>\n );\n })}\n </CommandGroup>\n {selectedValues.size > 0 && (\n <>\n <CommandSeparator />\n <CommandGroup>\n <CommandItem\n onSelect={() => column?.setFilterValue(undefined)}\n className=\"fk:justify-center fk:text-center\"\n >\n Clear filters\n </CommandItem>\n </CommandGroup>\n </>\n )}\n </CommandList>\n </Command>\n </PopoverContent>\n </Popover>\n );\n}\n"]}
1
+ {"version":3,"sources":["../src/data-grid/data-table-faceted-filter.tsx"],"names":["DataTableFacetedFilter","column","title","options","selectedValues","jsxs","Popover","jsx","PopoverTrigger","Button","CirclePlusIcon","Fragment","Separator","Badge","option","PopoverContent","Command","CommandInput","CommandList","CommandEmpty","CommandGroup","isSelected","CommandItem","filterValues","cn","CheckIcon","CommandSeparator"],"mappings":"2PA4BO,SAASA,CAAAA,CAAsC,CACpD,MAAA,CAAAC,GAAAA,CACA,KAAA,CAAAC,GAAAA,CACA,OAAA,CAAAC,CACF,EAA+C,CAC7C,IAAMC,GAAAA,CAAiB,IAAI,GAAA,CAAIH,GAAAA,EAAQ,cAAA,EAA4B,EAEnE,OACEI,IAAAA,CAACC,CAAAA,CAAA,CACC,QAAA,CAAA,CAAAC,GAAAA,CAACC,CAAAA,CAAA,CAAe,QAAO,IAAA,CACrB,QAAA,CAAAH,IAAAA,CAACI,CAAAA,CAAA,CAAO,OAAA,CAAQ,SAAA,CAAU,IAAA,CAAK,KAAK,SAAA,CAAU,yBAAA,CAC5C,QAAA,CAAA,CAAAF,GAAAA,CAACG,UAAAA,CAAA,CAAe,SAAA,CAAU,uBAAA,CAAwB,EACjDR,GAAAA,CACAE,GAAAA,EAAgB,IAAA,CAAO,CAAA,EACtBC,IAAAA,CAAAM,QAAAA,CAAA,C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AAU,kCAAA,CACX,QAAA,CAAA,eAAA,CAED,EACF,CAAA,CAAA,CACF,CAAA,CAAA,CAEJ,CAAA,CAAA,CACF,CAAA,CACF,GACF,CAEJ","file":"chunk-VFV44YZB.js","sourcesContent":["import * as React from 'react';\nimport { Check as CheckIcon, CirclePlus as CirclePlusIcon } from 'lucide-react';\nimport { Column } from '@tanstack/react-table';\nimport { cn } from '../ui/lib/utils';\nimport { Badge } from '../ui/primitives/badge';\nimport { Button } from '../ui/primitives/button';\nimport {\n Command,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n} from '../ui/primitives/command';\nimport { Popover, PopoverContent, PopoverTrigger } from '../ui/primitives/popover';\nimport { Separator } from '../ui/primitives/separator';\n\ninterface DataTableFacetedFilterProps<TData, TValue> {\n column?: Column<TData, TValue>;\n title?: string;\n options: {\n label: string;\n value: string;\n icon?: React.ComponentType<{ className?: string }>;\n }[];\n}\n\nexport function DataTableFacetedFilter<TData, TValue>({\n column,\n title,\n options,\n}: DataTableFacetedFilterProps<TData, TValue>) {\n const selectedValues = new Set(column?.getFilterValue() as string[]);\n\n return (\n <Popover>\n <PopoverTrigger asChild>\n <Button variant=\"outline\" size=\"sm\" className=\"fk:h-8 fk:border-dashed\">\n <CirclePlusIcon className=\"fk:mr-2 fk:h-4 fk:w-4\" />\n {title}\n {selectedValues?.size > 0 && (\n <>\n <Separator orientation=\"vertical\" className=\"fk:mx-2 fk:h-4\" />\n <Badge variant=\"secondary\" className=\"fk:rounded-xs fk:px-1 fk:font-normal fk:lg:hidden fk:corner-squircle\">\n {selectedValues.size}\n </Badge>\n <div className=\"fk:space-x-1 fk:lg:flex\">\n {selectedValues.size > 2 ? (\n <Badge variant=\"secondary\" className=\"fk:rounded-xs fk:px-1 fk:font-normal fk:corner-squircle\">\n {selectedValues.size} selected\n </Badge>\n ) : (\n options\n .filter((option) => selectedValues.has(option.value))\n .map((option) => (\n <Badge variant=\"secondary\" key={option.value} className=\"fk:rounded-xs fk:px-1 fk:font-normal fk:corner-squircle\">\n {option.label}\n </Badge>\n ))\n )}\n </div>\n </>\n )}\n </Button>\n </PopoverTrigger>\n <PopoverContent className=\"fk:w-50 fk:p-0\" align=\"start\">\n <Command>\n <CommandInput placeholder={title} />\n <CommandList>\n <CommandEmpty>No results found.</CommandEmpty>\n <CommandGroup>\n {options.map((option) => {\n const isSelected = selectedValues.has(option.value);\n return (\n <CommandItem\n key={option.value}\n onSelect={() => {\n if (isSelected) {\n selectedValues.delete(option.value);\n } else {\n selectedValues.add(option.value);\n }\n const filterValues = Array.from(selectedValues);\n column?.setFilterValue(filterValues.length ? filterValues : undefined);\n }}\n >\n <div\n className={cn(\n 'fk:mr-2 fk:flex fk:h-4 fk:w-4 fk:items-center fk:justify-center fk:rounded-xs fk:border fk:border-primary fk:corner-squircle',\n isSelected ? 'fk:bg-primary fk:text-primary-foreground' : 'fk:opacity-50 fk:[&_svg]:invisible'\n )}\n >\n <CheckIcon\n className={cn(\n 'fk:size-3.5',\n isSelected ? 'fk:text-primary-foreground' : 'fk:text-muted-foreground'\n )}\n />\n </div>\n {option.icon && <option.icon className=\"fk:mr-2 fk:h-4 fk:w-4 fk:text-muted-foreground\" />}\n <span>{option.label}</span>\n </CommandItem>\n );\n })}\n </CommandGroup>\n {selectedValues.size > 0 && (\n <>\n <CommandSeparator />\n <CommandGroup>\n <CommandItem\n onSelect={() => column?.setFilterValue(undefined)}\n className=\"fk:justify-center fk:text-center\"\n >\n Clear filters\n </CommandItem>\n </CommandGroup>\n </>\n )}\n </CommandList>\n </Command>\n </PopoverContent>\n </Popover>\n );\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import'./index.css';import {g,d}from'./chunk-MBBE4RND.js';import {b as b$1}from'./chunk-U45E5X3H.js';import w,{mutate}from'swr';import {createContext,lazy,Suspense,useMemo,useContext}from'react';import {Navigate,useParams}from'react-router-dom';import {Bot,Layout,FileStack,BookOpenText,Waypoints,SquarePlay}from'lucide-react';import {jsx,jsxs}from'react/jsx-runtime';var h={name:"_asset",plural:"_assets",display:"originalFilename",menu:{hidden:true},attributes:[{name:"path",label:"Asset",scope:"global",options:{size:140},dataType:"string",inputType:"text",previewType:"assetPreviewField",defaultValue:""},{name:"originalFilename",label:"Filename",scope:"global",options:{size:320},dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"size",label:"Size",scope:"global",options:{size:120},dataType:"int",inputType:"text",previewType:"text",defaultValue:""},{name:"width",label:"Width",scope:"global",options:{size:90},dataType:"int",inputType:"text",previewType:"text",defaultValue:""},{name:"height",label:"Height",scope:"global",options:{size:100},dataType:"int",inputType:"text",previewType:"text",defaultValue:""},{name:"mimeType",label:"Mime Type",scope:"global",options:{size:160},dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"lqip",label:"lqip",scope:"global",hidden:true,dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"url",label:"URL",scope:"global",hidden:true,readOnly:true,dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"_updatedAt",label:"Updated At",scope:"global",options:{size:220},readOnly:true,hidden:true,dataType:"datetime",inputType:"datetime",previewType:"datetime",defaultValue:""},{name:"tags",label:"Tags",scope:"relationship",dataType:"string",inputType:"relationship",defaultValue:"",previewType:"tags",options:{size:300},relationship:{mode:"multiple",field:"name",entity:"_tag"}}]};var f={name:"_tag",plural:"_tags",display:"name",menu:{hidden:true},attributes:[{name:"name",label:"Tag Name",scope:"global",options:{size:220},dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"_updatedAt",label:"Updated At",scope:"global",options:{size:220},readOnly:true,hidden:true,dataType:"datetime",inputType:"datetime",previewType:"datetime",defaultValue:""},{name:"assets",label:"Assets",scope:"relationship",dataType:"string",inputType:"relationship",defaultValue:"",relationship:{mode:"multiple",field:"originalFilename",entity:"_asset"}}]};async function C(e){try{let t=await fetch(d(e).schema,{credentials:"include",mode:"cors",cache:"no-cache"});if(!t.ok){let n=t.statusText||`Request failed with status ${String(t.status)}`;try{let i=await t.json();n=i.error??i.message??n;}catch{}return {ok:!1,projectId:e,error:{status:t.status,message:n}}}let a=await t.json();return {ok:!0,project:{...a,projectId:a.projectId||e}}}catch(t){return {ok:false,projectId:e,error:{status:0,message:t instanceof Error?t.message:"Network error"}}}}function b(e,t){let a=[],n={};for(let i of e??[])i.ok?a.push(i.project):n[i.projectId]=i.error;return {projects:a,errors:n,isLoading:t}}var A={revalidateOnFocus:true,focusThrottleInterval:15e3,revalidateOnReconnect:false};function L(e,t){return !t.ok&&e?.ok?e:t}function E(e,t){let a=t&&e.length>0?["project-schemas",t,...e]:null,{data:n,isLoading:i}=w(a,async()=>(await Promise.all(e.map(r=>C(r)))).map((r,m)=>L(n?.[m],r)),A);return b(n,!!a&&(i||n===void 0))}function N(e,t){return b(e?[e]:void 0,t)}function I(e,t){let a=t&&e?["project-schema",t,e]:null,{data:n,isLoading:i}=w(a,async()=>L(n,await C(e??"")),A);return N(n,!!a&&(i||n===void 0))}function _(e,t){return Array.isArray(e)&&(e[0]==="project-schema"||e[0]==="project-schemas")&&e.slice(2).includes(t)}function Oe(e){return mutate(t=>_(t,e))}function R(){let{resolvedTheme:e}=b$1();return jsx("div",{className:"fk:flex fk:w-full fk:h-full fk:justify-center fk:items-center fk:bg-background",children:jsxs("div",{className:"fk:flex fk:flex-col fk:items-center",children:[e==="dark"?jsxs("svg",{className:"fk:h-8 fk:w-8 fk:animate-bounce",fill:"none",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M7 8H41V40H7V8Z",fill:"#020817"}),jsx("path",{d:"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z",fill:"white"})]}):jsxs("svg",{className:"fk:h-8 fk:w-8 fk:animate-bounce",fill:"none",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M7 8H41V40H7V8Z",fill:"white"}),jsx("path",{d:"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z",fill:"#020817"})]}),jsx("div",{className:"fk:text-foreground fk:text-center fk:mt-4 fk:animate-pulse",children:"Loading..."})]})})}var $=Navigate;function o(e){let t=lazy(e);return jsx(Suspense,{fallback:jsx(R,{}),children:jsx(t,{})})}var Q=o(()=>import('./root-F2GTYDJM.js').then(e=>({default:e.Root}))),Y=o(()=>import('./list-7WFALOUT.js').then(e=>({default:e.List}))),ee=o(()=>import('./edit-entity-PVT34FD7.js').then(e=>({default:e.EditEntity}))),te=o(()=>import('./root-RGZZYETM.js').then(e=>({default:e.Root}))),oe=o(()=>import('./root-J62PBDZ2.js').then(e=>({default:e.Root}))),ne=o(()=>import('./list-7IHDJM54.js').then(e=>({default:e.List}))),ae=o(()=>import('./source-IJAAJDGW.js').then(e=>({default:e.Source}))),ie=o(()=>import('./root-LYRL7VPN.js').then(e=>({default:e.Root}))),re=o(()=>import('./root-GBBZ3DX5.js').then(e=>({default:e.Root}))),se=o(()=>import('./root-NIL2UHKS.js').then(e=>({default:e.Root}))),pe=o(()=>import('./plugin-pages-OWGJPPWV.js').then(e=>({default:e.PluginsPage}))),ce=o(()=>import('./plugin-pages-OWGJPPWV.js').then(e=>({default:e.InstalledPluginsPage}))),le=o(()=>import('./plugin-pages-OWGJPPWV.js').then(e=>({default:e.PluginDetailPage}))),O=o(()=>import('./chat-page-7XT4K75G.js').then(e=>({default:e.AgentChatPage}))),me=o(()=>import('./pages-BV3ABSFQ.js').then(e=>({default:e.AutomationsPage}))),ue=o(()=>import('./pages-BV3ABSFQ.js').then(e=>({default:e.RunHistoryPage}))),de=o(()=>import('./pages-BV3ABSFQ.js').then(e=>({default:e.ApprovalsPage}))),he=o(()=>import('./pages-BV3ABSFQ.js').then(e=>({default:e.ActivityPage}))),fe=o(()=>import('./pages-BV3ABSFQ.js').then(e=>({default:e.ActivityItemPage}))),ge=o(()=>import('./pages-BV3ABSFQ.js').then(e=>({default:e.CreateAutomationPage}))),ye=o(()=>import('./pages-BV3ABSFQ.js').then(e=>({default:e.AutomationDetailPage}))),Pe=o(()=>import('./pages-BV3ABSFQ.js').then(e=>({default:e.RunsPage}))),Se=o(()=>import('./pages-BV3ABSFQ.js').then(e=>({default:e.RunDetailPage}))),ke=o(()=>import('./skills-pages-T52MF4DO.js').then(e=>({default:e.SkillsPage}))),je=o(()=>import('./skills-pages-T52MF4DO.js').then(e=>({default:e.CreateSkillPage}))),Te=o(()=>import('./skills-pages-T52MF4DO.js').then(e=>({default:e.SkillDetailPage}))),l=[{name:"ai",icon:jsx(Bot,{strokeWidth:1.5}),title:"AI",component:se,routes:[{path:"plugins",component:pe},{path:"plugins/installed",component:ce},{path:"plugins/:pluginId",component:le},{component:jsx($,{replace:true,to:"agent"}),path:""},{component:O,path:"agent"},{component:O,path:"agent/chats/:chatId"},{component:me,path:"automations"},{component:ue,path:"runs"},{component:de,path:"approvals"},{component:he,path:"activity"},{component:fe,path:"activity/:itemId"},{component:ge,path:"automations/new"},{component:ye,path:"automations/:automationId"},{component:Pe,path:"automations/:automationId/runs"},{component:Se,path:"automations/:automationId/runs/:runId"},{component:ke,path:"skills"},{component:je,path:"skills/new"},{component:Te,path:"skills/:skillId"}]},{name:"desk",icon:jsx(Layout,{strokeWidth:1.5}),title:"Desk",component:Q,routes:[{path:"list/:entity",component:Y,children:[{path:"edit/:id",component:ee}]}]},{name:"asset-manager",icon:jsx(FileStack,{strokeWidth:1.5}),title:"Asset Manager",component:te,routes:[]},{name:"knowledge",icon:jsx(BookOpenText,{strokeWidth:1.5}),title:"Knowledge",component:oe,routes:[{component:ne,path:""},{component:ae,path:":sourceId"}]},{name:"graph",icon:jsx(Waypoints,{strokeWidth:1.5}),title:"Graph",component:ie,routes:[]},{name:"explorer",icon:jsx(SquarePlay,{strokeWidth:1.5}),title:"Explorer",component:re,routes:[]}];var H=createContext({mode:"projects",apps:l,contributions:{apps:l},currentProjectId:void 0,currentProject:void 0,currentProjectSchema:[],projects:[],projectIds:[],projectSummaries:[],teams:[],schemaErrors:{},isLoadingSchemas:false}),Ce=[];function be(e){return [...e.filter(a=>a.name!==h.name&&a.name!==f.name),h,f]}function $e({projectIds:e,projectSummaries:t=[],teams:a=Ce,mode:n="projects",userId:i,children:y}){let{projectId:r}=useParams(),[,m]=g(),P=m.user?.id??i,F=E(n==="projects"?e:[],P),M=I(n==="hosted"&&r&&e.includes(r)?r:void 0,P),{projects:S,errors:k,isLoading:j}=n==="hosted"?M:F,u=useMemo(()=>e.map(p=>S.find(d=>d.projectId===p)).filter(p=>p!==void 0).map(p=>({...p,schema:be(p.schema)})),[S,e]),z=useMemo(()=>{let p=u.find(d=>d.projectId===r);return {mode:n,apps:l,contributions:{apps:l},currentProjectId:r,currentProject:p,currentProjectSchema:p?.schema??[],projects:u,projectIds:e,projectSummaries:t,teams:a,schemaErrors:k,isLoadingSchemas:j}},[r,k,j,n,e,t,u,a]);return jsx(H.Provider,{value:z,children:y})}function Qe(){return useContext(H)}
2
+ export{R as a,h as b,f as c,Oe as d,$e as e,Qe as f};//# sourceMappingURL=chunk-VRDTHLA3.js.map
3
+ //# sourceMappingURL=chunk-VRDTHLA3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/entities/assets-schema.ts","../src/entities/tags-schema.ts","../src/core/config/use-project-schemas.ts","../src/ui/components/loading.tsx","../src/core/apps/built-in-apps.tsx","../src/core/config/config-context.tsx"],"names":["assetSchema","tagSchema","fetchProjectSchema","projectId","response","apiPaths","message","body","project","error","toProjectSchemasState","outcomes","isLoading","projects","errors","outcome","SCHEMA_SWR_OPTIONS","keepLoadedSchema","previous","next","useProjectSchemas","projectIds","userId","key","data","useSWR","index","toProjectSchemaState","useProjectSchema","isProjectSchemaKey","revalidateProjectSchema","mutate","Loading","resolvedTheme","useTheme","jsx","jsxs","NavigateCompat","Navigate","lazyElement","loader","Component","lazy","Suspense","deskRoot","m","deskList","deskEditEntity","assetManagerRoot","knowledgeRoot","knowledgeList","knowledgeSource","graphRoot","explorerRoot","aiRoot","aiPluginsPage","aiInstalledPluginsPage","aiPluginDetailPage","aiAgentChatPage","aiAutomationsPage","aiRunHistoryPage","aiApprovalsPage","aiActivityPage","aiActivityItemPage","aiCreateAutomationPage","aiAutomationDetailPage","aiRunsPage","aiRunDetailPage","aiSkillsPage","aiCreateSkillPage","aiSkillDetailPage","builtInApps","BotIcon","LayoutIcon","FileStackIcon","BookOpenTextIcon","WaypointsIcon","SquarePlayIcon","ConfigContext","createContext","NO_TEAMS","upsertReservedEntities","schema","entity","ConfigProvider","projectSummaries","teams","mode","children","currentProjectId","useParams","auth","useAuth","schemaUserId","allSchemas","currentSchema","loadedProjects","useMemo","value","currentProject","useConfig","useContext"],"mappings":"gXAEO,IAAMA,CAAAA,CAAsB,CACjC,IAAA,CAAM,QAAA,CACN,OAAQ,SAAA,CACR,OAAA,CAAS,kBAAA,CACT,IAAA,CAAM,CACJ,MAAA,CAAQ,IACV,CAAA,CACA,UAAA,CAAY,CACV,CACE,IAAA,CAAM,OACN,KAAA,CAAO,OAAA,CACP,KAAA,CAAO,QAAA,CACP,OAAA,CAAS,CACP,KAAM,GACR,CAAA,CACA,SAAU,QAAA,CACV,SAAA,CAAW,OACX,WAAA,CAAa,mBAAA,CACb,YAAA,CAAc,EAChB,CAAA,CACA,CACE,KAAM,kBAAA,CACN,KAAA,CAAO,UAAA,CACP,KAAA,CAAO,QAAA,CACP,OAAA,CAAS,CACP,IAAA,CAAM,GAC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type { Entity } from '../core/types';\n\nexport const assetSchema: Entity = {\n name: '_asset',\n plural: '_assets',\n display: 'originalFilename',\n menu: {\n hidden: true,\n },\n attributes: [\n {\n name: 'path',\n label: 'Asset',\n scope: 'global',\n options: {\n size: 140,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'assetPreviewField',\n defaultValue: '',\n },\n {\n name: 'originalFilename',\n label: 'Filename',\n scope: 'global',\n options: {\n size: 320,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'size',\n label: 'Size',\n scope: 'global',\n options: {\n size: 120,\n },\n dataType: 'int',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'width',\n label: 'Width',\n scope: 'global',\n options: {\n size: 90,\n },\n dataType: 'int',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'height',\n label: 'Height',\n scope: 'global',\n options: {\n size: 100,\n },\n dataType: 'int',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'mimeType',\n label: 'Mime Type',\n scope: 'global',\n options: {\n size: 160,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'lqip',\n label: 'lqip',\n scope: 'global',\n hidden: true,\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'url',\n label: 'URL',\n scope: 'global',\n hidden: true,\n readOnly: true,\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: '_updatedAt',\n label: 'Updated At',\n scope: 'global',\n options: {\n size: 220,\n },\n readOnly: true,\n hidden: true,\n dataType: 'datetime',\n inputType: 'datetime',\n previewType: 'datetime',\n defaultValue: '',\n },\n {\n name: 'tags',\n label: 'Tags',\n scope: 'relationship',\n dataType: 'string',\n inputType: 'relationship',\n defaultValue: '',\n previewType: 'tags',\n options: {\n size: 300,\n },\n relationship: {\n mode: 'multiple',\n field: 'name',\n entity: '_tag',\n },\n },\n ],\n};\n","import type { Entity } from '../core/types';\n\nexport const tagSchema: Entity = {\n name: '_tag',\n plural: '_tags',\n display: 'name',\n menu: {\n hidden: true,\n },\n attributes: [\n {\n name: 'name',\n label: 'Tag Name',\n scope: 'global',\n options: {\n size: 220,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: '_updatedAt',\n label: 'Updated At',\n scope: 'global',\n options: {\n size: 220,\n },\n readOnly: true,\n hidden: true,\n dataType: 'datetime',\n inputType: 'datetime',\n previewType: 'datetime',\n defaultValue: '',\n },\n {\n name: 'assets',\n label: 'Assets',\n scope: 'relationship',\n dataType: 'string',\n inputType: 'relationship',\n defaultValue: '',\n relationship: {\n mode: 'multiple',\n field: 'originalFilename',\n entity: '_asset',\n },\n },\n ],\n};\n","'use client';\n\nimport useSWR, { mutate } from 'swr';\nimport { apiPaths } from '../api-paths';\nimport type { ProjectSchemaError, ProjectUiConfig } from './types';\n\nexport type ProjectSchemasState = {\n projects: ProjectUiConfig[];\n errors: { [projectId: string]: ProjectSchemaError };\n isLoading: boolean;\n};\n\nexport type FetchOutcome =\n | { ok: true; project: ProjectUiConfig }\n | { ok: false; projectId: string; error: ProjectSchemaError };\n\nasync function fetchProjectSchema(projectId: string): Promise<FetchOutcome> {\n try {\n const response = await fetch(apiPaths(projectId).schema, {\n credentials: 'include',\n mode: 'cors',\n // Revalidate with the server on every fetch (304 when unchanged), so a\n // refetch after a deploy never reads a stale HTTP-cached schema.\n cache: 'no-cache',\n });\n\n if (!response.ok) {\n let message = response.statusText || `Request failed with status ${String(response.status)}`;\n\n try {\n const body = (await response.json()) as { error?: string; message?: string };\n message = body.error ?? body.message ?? message;\n } catch {\n // keep the status text\n }\n\n return { ok: false, projectId, error: { status: response.status, message } };\n }\n\n const project = (await response.json()) as ProjectUiConfig;\n\n return { ok: true, project: { ...project, projectId: project.projectId || projectId } };\n } catch (error) {\n return {\n ok: false,\n projectId,\n error: { status: 0, message: error instanceof Error ? error.message : 'Network error' },\n };\n }\n}\n\nexport function toProjectSchemasState(outcomes: FetchOutcome[] | undefined, isLoading: boolean): ProjectSchemasState {\n const projects: ProjectUiConfig[] = [];\n const errors: { [projectId: string]: ProjectSchemaError } = {};\n\n for (const outcome of outcomes ?? []) {\n if (outcome.ok) {\n projects.push(outcome.project);\n } else {\n errors[outcome.projectId] = outcome.error;\n }\n }\n\n return { projects, errors, isLoading };\n}\n\n/**\n * Schemas change on deploy, which can happen outside this tab (the agent, the\n * CLI). Refetch when the user comes back to the tab, at most every 15s;\n * SWR compares the result, so an unchanged schema does not re-render.\n */\nconst SCHEMA_SWR_OPTIONS = {\n revalidateOnFocus: true,\n focusThrottleInterval: 15_000,\n revalidateOnReconnect: false,\n} as const;\n\n/**\n * A refetch (tab focus, reload button, watched deploy) must never replace a\n * schema that already loaded with an error: that would swap the whole app for\n * an error screen and drop an open edit drawer. Offline, an expired session or\n * revoked access still surface through the GraphQL requests themselves.\n */\nexport function keepLoadedSchema(previous: FetchOutcome | undefined, next: FetchOutcome): FetchOutcome {\n return !next.ok && previous?.ok ? previous : next;\n}\n\n/**\n * Loads the deployed schema of every project the Studio can open. Fetching\n * starts once the user is known (the endpoint needs a session). The result is\n * refetched on tab focus, on the list's reload button and after a deploy the\n * Studio watched.\n */\nexport function useProjectSchemas(projectIds: string[], userId: string | undefined): ProjectSchemasState {\n const key = userId && projectIds.length > 0 ? ['project-schemas', userId, ...projectIds] : null;\n const { data, isLoading } = useSWR(\n key,\n async (): Promise<FetchOutcome[]> => {\n const outcomes = await Promise.all(projectIds.map((projectId) => fetchProjectSchema(projectId)));\n\n // The key fixes the order of projectIds, so outcomes line up with the previous data.\n return outcomes.map((outcome, index) => keepLoadedSchema(data?.[index], outcome));\n },\n SCHEMA_SWR_OPTIONS\n );\n\n return toProjectSchemasState(data, Boolean(key) && (isLoading || data === undefined));\n}\n\n/** State of a single project's schema, in the same shape as the multi-project hook. */\nexport function toProjectSchemaState(outcome: FetchOutcome | undefined, isLoading: boolean): ProjectSchemasState {\n return toProjectSchemasState(outcome ? [outcome] : undefined, isLoading);\n}\n\n/**\n * Hosted mode: loads only the project currently open. Each project has its own\n * SWR key, so switching back to a project reuses the schema already fetched.\n */\nexport function useProjectSchema(projectId: string | undefined, userId: string | undefined): ProjectSchemasState {\n const key = userId && projectId ? ['project-schema', userId, projectId] : null;\n const { data, isLoading } = useSWR(\n key,\n async (): Promise<FetchOutcome> => keepLoadedSchema(data, await fetchProjectSchema(projectId ?? '')),\n SCHEMA_SWR_OPTIONS\n );\n\n return toProjectSchemaState(data, Boolean(key) && (isLoading || data === undefined));\n}\n\n/** True for the SWR keys that hold `projectId`'s schema (single- and multi-project hooks). */\nexport function isProjectSchemaKey(key: unknown, projectId: string): boolean {\n return (\n Array.isArray(key) &&\n (key[0] === 'project-schema' || key[0] === 'project-schemas') &&\n key.slice(2).includes(projectId)\n );\n}\n\n/** Refetches the deployed schema of `projectId`, e.g. after the agent deployed a schema change. */\nexport function revalidateProjectSchema(projectId: string): Promise<unknown> {\n return mutate((key) => isProjectSchemaKey(key, projectId));\n}\n","import type { JSX } from 'react';\nimport { useTheme } from '../theme-context';\n\nexport function Loading(): JSX.Element {\n const { resolvedTheme } = useTheme();\n\n return (\n <div className=\"fk:flex fk:w-full fk:h-full fk:justify-center fk:items-center fk:bg-background\">\n <div className=\"fk:flex fk:flex-col fk:items-center\">\n {resolvedTheme === 'dark' ? (\n <svg\n className=\"fk:h-8 fk:w-8 fk:animate-bounce\"\n fill=\"none\"\n viewBox=\"0 0 48 48\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M7 8H41V40H7V8Z\" fill=\"#020817\" />\n <path\n d=\"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z\"\n fill=\"white\"\n />\n </svg>\n ) : (\n <svg\n className=\"fk:h-8 fk:w-8 fk:animate-bounce\"\n fill=\"none\"\n viewBox=\"0 0 48 48\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M7 8H41V40H7V8Z\" fill=\"white\" />\n <path\n d=\"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z\"\n fill=\"#020817\"\n />\n </svg>\n )}\n <div className=\"fk:text-foreground fk:text-center fk:mt-4 fk:animate-pulse\">Loading...</div>\n </div>\n </div>\n );\n}\n","import { lazy, Suspense } from 'react';\nimport type { ComponentType, JSX } from 'react';\nimport {\n BookOpenText as BookOpenTextIcon,\n Bot as BotIcon,\n FileStack as FileStackIcon,\n Layout as LayoutIcon,\n SquarePlay as SquarePlayIcon,\n Waypoints as WaypointsIcon,\n} from 'lucide-react';\nimport { Navigate } from 'react-router-dom';\nimport { Loading } from '../../ui/components/loading';\nimport type { AppOptions } from '../config/types';\n\nconst NavigateCompat = Navigate as unknown as ComponentType<{\n replace?: boolean;\n to: string;\n}>;\n\n/**\n * Wraps a lazily imported component in Suspense so each built-in app (and each of its routes)\n * is only downloaded when it is first rendered.\n */\nfunction lazyElement(loader: () => Promise<{ default: ComponentType }>): JSX.Element {\n const Component = lazy(loader);\n\n return (\n <Suspense fallback={<Loading />}>\n <Component />\n </Suspense>\n );\n}\n\n// Desk\nconst deskRoot = lazyElement(() => import('../../apps/desk/root').then((m) => ({ default: m.Root })));\nconst deskList = lazyElement(() => import('../../apps/desk/list').then((m) => ({ default: m.List })));\nconst deskEditEntity = lazyElement(() =>\n import('../../apps/desk/edit-entity').then((m) => ({ default: m.EditEntity }))\n);\n\n// Asset Manager\nconst assetManagerRoot = lazyElement(() => import('../../apps/asset-manager/root').then((m) => ({ default: m.Root })));\n\n// Knowledge\nconst knowledgeRoot = lazyElement(() => import('../../apps/knowledge/root').then((m) => ({ default: m.Root })));\nconst knowledgeList = lazyElement(() => import('../../apps/knowledge/list').then((m) => ({ default: m.List })));\nconst knowledgeSource = lazyElement(() => import('../../apps/knowledge/source').then((m) => ({ default: m.Source })));\n\n// Graph\nconst graphRoot = lazyElement(() => import('../../apps/graph/root').then((m) => ({ default: m.Root })));\n\n// Explorer\nconst explorerRoot = lazyElement(() => import('../../apps/explorer/root').then((m) => ({ default: m.Root })));\n\n// AI\nconst aiRoot = lazyElement(() => import('../../apps/ai/root').then((m) => ({ default: m.Root })));\nconst aiPluginsPage = lazyElement(() => import('../../apps/ai/plugin-pages').then((m) => ({ default: m.PluginsPage })));\nconst aiInstalledPluginsPage = lazyElement(() =>\n import('../../apps/ai/plugin-pages').then((m) => ({ default: m.InstalledPluginsPage }))\n);\nconst aiPluginDetailPage = lazyElement(() =>\n import('../../apps/ai/plugin-pages').then((m) => ({ default: m.PluginDetailPage }))\n);\nconst aiAgentChatPage = lazyElement(() =>\n import('../../apps/ai/agent/chat-page').then((m) => ({ default: m.AgentChatPage }))\n);\nconst aiAutomationsPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.AutomationsPage }))\n);\nconst aiRunHistoryPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.RunHistoryPage })));\nconst aiApprovalsPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.ApprovalsPage })));\nconst aiActivityPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.ActivityPage })));\nconst aiActivityItemPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.ActivityItemPage }))\n);\nconst aiCreateAutomationPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.CreateAutomationPage }))\n);\nconst aiAutomationDetailPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.AutomationDetailPage }))\n);\nconst aiRunsPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.RunsPage })));\nconst aiRunDetailPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.RunDetailPage })));\nconst aiSkillsPage = lazyElement(() => import('../../apps/ai/skills-pages').then((m) => ({ default: m.SkillsPage })));\nconst aiCreateSkillPage = lazyElement(() =>\n import('../../apps/ai/skills-pages').then((m) => ({ default: m.CreateSkillPage }))\n);\nconst aiSkillDetailPage = lazyElement(() =>\n import('../../apps/ai/skills-pages').then((m) => ({ default: m.SkillDetailPage }))\n);\n\nexport const builtInApps: AppOptions[] = [\n {\n name: 'ai',\n icon: <BotIcon strokeWidth={1.5} />,\n title: 'AI',\n component: aiRoot,\n routes: [\n { path: 'plugins', component: aiPluginsPage },\n { path: 'plugins/installed', component: aiInstalledPluginsPage },\n { path: 'plugins/:pluginId', component: aiPluginDetailPage },\n {\n component: <NavigateCompat replace to=\"agent\" />,\n path: '',\n },\n {\n component: aiAgentChatPage,\n path: 'agent',\n },\n {\n component: aiAgentChatPage,\n path: 'agent/chats/:chatId',\n },\n {\n component: aiAutomationsPage,\n path: 'automations',\n },\n {\n component: aiRunHistoryPage,\n path: 'runs',\n },\n {\n component: aiApprovalsPage,\n path: 'approvals',\n },\n {\n component: aiActivityPage,\n path: 'activity',\n },\n {\n component: aiActivityItemPage,\n path: 'activity/:itemId',\n },\n {\n component: aiCreateAutomationPage,\n path: 'automations/new',\n },\n {\n component: aiAutomationDetailPage,\n path: 'automations/:automationId',\n },\n {\n component: aiRunsPage,\n path: 'automations/:automationId/runs',\n },\n {\n component: aiRunDetailPage,\n path: 'automations/:automationId/runs/:runId',\n },\n {\n component: aiSkillsPage,\n path: 'skills',\n },\n {\n component: aiCreateSkillPage,\n path: 'skills/new',\n },\n {\n component: aiSkillDetailPage,\n path: 'skills/:skillId',\n },\n ],\n },\n {\n name: 'desk',\n icon: <LayoutIcon strokeWidth={1.5} />,\n title: 'Desk',\n component: deskRoot,\n routes: [\n {\n path: 'list/:entity',\n component: deskList,\n children: [\n {\n path: 'edit/:id',\n component: deskEditEntity, // Not used, left here as an example of how to nest routes in apps\n },\n ],\n },\n ],\n },\n {\n name: 'asset-manager',\n icon: <FileStackIcon strokeWidth={1.5} />,\n title: 'Asset Manager',\n component: assetManagerRoot,\n routes: [],\n },\n {\n name: 'knowledge',\n icon: <BookOpenTextIcon strokeWidth={1.5} />,\n title: 'Knowledge',\n component: knowledgeRoot,\n routes: [\n {\n component: knowledgeList,\n path: '',\n },\n {\n component: knowledgeSource,\n path: ':sourceId',\n },\n ],\n },\n {\n name: 'graph',\n icon: <WaypointsIcon strokeWidth={1.5} />,\n title: 'Graph',\n component: graphRoot,\n routes: [],\n },\n {\n name: 'explorer',\n icon: <SquarePlayIcon strokeWidth={1.5} />,\n title: 'Explorer',\n component: explorerRoot,\n routes: [],\n },\n];\n","'use client';\n\nimport { createContext, useContext, useMemo } from 'react';\nimport type { JSX } from 'react';\nimport { useParams } from 'react-router-dom';\nimport { useAuth } from '../../auth/auth-context';\nimport { assetSchema } from '../../entities/assets-schema';\nimport { tagSchema } from '../../entities/tags-schema';\nimport { builtInApps } from '../apps/built-in-apps';\nimport type { AppOptions, HostedTeam, ProjectSchemaError, ProjectSummary, ProjectUiConfig, StudioMode } from './types';\nimport type { Entity } from '../types';\nimport { useProjectSchema, useProjectSchemas } from './use-project-schemas';\n\nexport interface ConfigContext {\n /** `projects` when the host passed `projectIds`, `hosted` when the Studio listed the user's projects itself. */\n mode: StudioMode;\n /** The Studio apps shown in the app bar, in order. */\n apps: AppOptions[];\n /** Kept for callers that read `contributions.apps`; same list as `apps`. */\n contributions: {\n apps: AppOptions[];\n };\n currentProjectId?: string;\n /** The project named by the `:projectId` route param, once its schema has loaded. */\n currentProject?: ProjectUiConfig;\n currentProjectSchema: Entity[];\n /** Projects whose schema loaded, in `projectIds` order. */\n projects: ProjectUiConfig[];\n /** Every project id the Studio can open, loaded or not. */\n projectIds: string[];\n /** Hosted mode: name, avatar, role and team of each project, known before any schema loads. */\n projectSummaries: ProjectSummary[];\n /** Hosted mode: the user's teams with their role; owners can create projects in them. */\n teams: HostedTeam[];\n /** Per project id: why its schema could not be loaded. */\n schemaErrors: { [projectId: string]: ProjectSchemaError };\n isLoadingSchemas: boolean;\n}\n\nconst ConfigContext = createContext<ConfigContext>({\n mode: 'projects',\n apps: builtInApps,\n contributions: { apps: builtInApps },\n currentProjectId: undefined,\n currentProject: undefined,\n currentProjectSchema: [],\n projects: [],\n projectIds: [],\n projectSummaries: [],\n teams: [],\n schemaErrors: {},\n isLoadingSchemas: false,\n});\n\nconst NO_TEAMS: HostedTeam[] = [];\n\n/** Appends the reserved asset and tag entities to a deployed schema. */\nexport function upsertReservedEntities(schema: Entity[]): Entity[] {\n const withoutReserved = schema.filter((entity) => entity.name !== assetSchema.name && entity.name !== tagSchema.name);\n\n return [...withoutReserved, assetSchema, tagSchema];\n}\n\nexport function ConfigProvider({\n projectIds,\n projectSummaries = [],\n teams = NO_TEAMS,\n mode = 'projects',\n userId,\n children,\n}: {\n projectIds: string[];\n projectSummaries?: ProjectSummary[];\n teams?: HostedTeam[];\n mode?: StudioMode;\n /** Hosted mode: the signed-in user's id, known before the per-project `/users/me` call. */\n userId?: string;\n children: React.ReactNode;\n}): JSX.Element {\n /**\n * Getting the projectId from the URL via react-router-dom's useParams hook triggers a rerender of this Context\n * every time the URL changes.\n */\n const { projectId: currentProjectId } = useParams<{ projectId: string }>();\n const [, auth] = useAuth();\n const schemaUserId = auth.user?.id ?? userId;\n // Project mode loads every project up front (short, host-defined list); hosted mode only the one open.\n const allSchemas = useProjectSchemas(mode === 'projects' ? projectIds : [], schemaUserId);\n const currentSchema = useProjectSchema(\n mode === 'hosted' && currentProjectId && projectIds.includes(currentProjectId) ? currentProjectId : undefined,\n schemaUserId\n );\n const { projects: loadedProjects, errors, isLoading } = mode === 'hosted' ? currentSchema : allSchemas;\n const projects = useMemo(\n () =>\n projectIds\n .map((projectId) => loadedProjects.find((project) => project.projectId === projectId))\n .filter((project): project is ProjectUiConfig => project !== undefined)\n .map((project) => ({ ...project, schema: upsertReservedEntities(project.schema) })),\n [loadedProjects, projectIds]\n );\n\n const value = useMemo<ConfigContext>(() => {\n const currentProject = projects.find((project) => project.projectId === currentProjectId);\n\n return {\n mode,\n apps: builtInApps,\n contributions: { apps: builtInApps },\n currentProjectId,\n currentProject,\n currentProjectSchema: currentProject?.schema ?? [],\n projects,\n projectIds,\n projectSummaries,\n teams,\n schemaErrors: errors,\n isLoadingSchemas: isLoading,\n };\n }, [currentProjectId, errors, isLoading, mode, projectIds, projectSummaries, projects, teams]);\n\n return <ConfigContext.Provider value={value}>{children}</ConfigContext.Provider>;\n}\n\nexport function useConfig(): ConfigContext {\n return useContext(ConfigContext);\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import'./index.css';import {b as b$1}from'./chunk-U6VZY3V2.js';import {b}from'./chunk-G5N6HEPW.js';import {k,p,q as q$1,s,t,r}from'./chunk-S7Z6KKIN.js';import {c}from'./chunk-X3SHNHHM.js';import {useSyncExternalStore,useId,useState}from'react';import {LoaderCircle,ExternalLinkIcon}from'lucide-react';import {jsx,jsxs}from'react/jsx-runtime';var K="/plugins/oauth/start",R=class extends Error{code="account_mismatch";constructor(){super('You signed in with a different account. Use "Connect another account" to add it.'),this.name="PluginAccountMismatchError";}};function U(t){let e;try{e=new URL(t);}catch{return null}return e.protocol!=="https:"||e.username!==""||e.password!==""?null:e}function Q(t,e){let n=b$1(),r=U(t),o=U(e);return !r||!o||r.origin!==n||r.pathname!==K||o.origin!==n||o.pathname!=="/"?null:{href:r.href,origin:n}}async function O(t,e,n,r){let o=window.open("about:blank",`flexkit-plugin-${crypto.randomUUID()}`,"popup,width=560,height=720");if(!o)throw new Error("Allow popups for Studio, then connect again.");let a;try{a=await t.connectPlugins({pluginId:e,scope:n,studioOrigin:window.location.origin,...r?.connectionId?{connectionId:r.connectionId}:{}});}catch(u){throw o.close(),u}let d=Q(a.authorizeUrl,a.completionOrigin);if(!d)throw o.close(),new Error("Connection could not be started.");let g=d.origin;await new Promise((u,m)=>{let c=false,f=false,k=false,h=i=>{if(!f){if(f=true,window.clearInterval(l),window.clearTimeout(C),window.removeEventListener("message",P),o.close(),i){m(i);return}u();}},v=async()=>{if(c||f)return;c=true;let i;try{i=await t.pluginOAuthStatus(a.transactionId);}catch{c=false;return}if(c=false,i.status==="complete"){h();return}if(!k&&o.closed&&i.status==="pending"){h(new Error("Connection window was closed."));return}(i.status==="failed"||new Date(i.expires_at).getTime()<Date.now())&&h(new Error("Connection was not completed. Please try again."));},P=i=>{if(i.origin!==g||i.source!==o||!i.data||typeof i.data!="object")return;let y=i.data;if(y.type==="flexkit:plugin-oauth-ready"&&y.transactionId===a.transactionId){k=true,o.postMessage({type:"flexkit:plugin-oauth-start",transactionId:a.transactionId,ticket:a.launchTicket},g);return}if(y.type==="flexkit:plugin-oauth"&&y.transactionId===a.transactionId){if(y.status==="failed"&&y.error==="account_mismatch"){h(new R);return}v();}},l=window.setInterval(()=>{v();},2e3),C=window.setTimeout(()=>h(new Error("Connection timed out. Please try again.")),6e5);window.addEventListener("message",P),o.location.href=d.href;});}function W(t){let{connect:e}=t;return e?.type==="api-token"?e.pattern?[{label:e.tokenLabel,pattern:e.pattern}]:[]:e?.type==="credentials"?[...e.fields,...e.methods.flatMap(n=>n.fields)].filter(n=>n.kind==="secret"&&n.detect).map(n=>({label:n.label,pattern:n.detect})):[]}function M(t,e){let n=t.methods.find(r=>r.key===e);return [...t.fields,...n?.fields??[]]}function z(t,e){return t.every(n=>!n.required||!!e[n.key]?.trim())}function X(t,e){for(let n of t){let r=e[n.key]?.trim()??"";if(!r){if(n.required)return {field:n.key,message:`Enter the ${n.label}.`};continue}if(r.length>4096)return {field:n.key,message:`The ${n.label} is too long; paste only the value.`};if(!S(r,n.pattern))return {field:n.key,message:`That is not a valid ${n.label}.`}}return null}function S(t,e){if(!e)return true;try{return new RegExp(e,"u").test(t)}catch{return true}}function Z(t){if(!t)return null;try{return new RegExp(t,"u")}catch{return null}}function ae(t,e){let n=t.split(/[\s"'`()<>[\]{},;:=!?&]+/).map(a=>a.replace(/\.+$/,"")).filter(Boolean),r=null,o=new Set;for(let a of e)for(let d of W(a)){let g=Z(d.pattern);for(let u of g?n:[])g.test(u)&&(r??={plugin:a,label:d.label},o.add(u));}return r?{...r,tokens:[...o]}:null}var _=null,q=0,L=null,N=new Set;function B(t){_=t,N.forEach(e=>e());}function ne(t){return N.add(t),()=>N.delete(t)}function me(t,e,n,r){let{connect:o}=e;if(o?.type!=="api-token"&&o?.type!=="credentials")return O(t,e.id,n,r).then(()=>true);L?.();let a=++q,d=r?.connectionId?{connectionId:r.connectionId}:{};return new Promise(g=>{let u=c=>{_?.id===a&&B(null),q===a&&(L=null),g(c);},m=o.type==="api-token"?{kind:"token",id:a,plugin:{...e,connect:o},submit:async c=>{await t.connectPluginToken({pluginId:e.id,scope:n,token:c,...d});},settle:u}:{kind:"credentials",id:a,plugin:{...e,connect:o},submit:async(c,f)=>{await t.connectPluginCredentials({pluginId:e.id,scope:n,method:c,values:f,...d});},settle:u};L=()=>u(false),setTimeout(()=>{q===a&&B(m);});})}function oe(t){if(!t)return null;try{let e=new URL(t);return e.protocol==="https:"?e.href:null}catch{return null}}function ke(){let t=useSyncExternalStore(ne,()=>_,()=>null);return t?t.kind==="token"?jsx(le,{request:t},t.id):jsx(re,{request:t},t.id):null}function $({id:t,message:e}){return e?jsx("p",{className:"fk:text-sm fk:text-destructive",id:t,children:e}):null}function V({href:t,label:e}){let n=oe(t);return n?jsxs("a",{className:"fk:inline-flex fk:items-center fk:gap-1 fk:text-sm fk:text-muted-foreground fk:underline-offset-4 fk:hover:underline",href:n,rel:"noreferrer",target:"_blank",children:[e,jsx(ExternalLinkIcon,{className:"fk:size-3.5"})]}):null}function re({request:t$1}){let{connect:e,name:n}=t$1.plugin,r$1=useId(),[o,a]=useState(e.methods[0]?.key??null),[d,g]=useState({}),[u,m]=useState(null),[c$1,f]=useState(false),k$1=M(e,o),h=e.methods.find(l=>l.key===o)??null,v=z(k$1,d);async function P(l){if(l.preventDefault(),c$1)return;let C=X(k$1,d);if(C){m(C);return}f(true),m(null);try{await t$1.submit(o??void 0,Object.fromEntries(k$1.map(i=>[i.key,d[i.key]?.trim()??""]).filter(([,i])=>i))),g({}),t$1.settle(!0);}catch(i){m({field:null,message:i instanceof Error?i.message:`${n} could not be connected.`});}finally{f(false);}}return jsx(k,{open:true,onOpenChange:l=>{!l&&!c$1&&t$1.settle(false);},children:jsx(p,{children:jsxs("form",{className:"fk:flex fk:flex-col fk:gap-4",onSubmit:l=>{P(l);},children:[jsxs(q$1,{children:[jsxs(s,{children:["Connect ",n]}),jsxs(t,{children:[e.description," Flexkit checks the credentials with ",n,", stores them encrypted and sends them only to Flexkit's own ",n," server; the agent can use the tools but never sees them."]})]}),e.methods.length>1?jsx("div",{className:"fk:space-y-1.5",role:"group","aria-label":"How to connect",children:e.methods.map(l=>jsxs("button",{"aria-pressed":o===l.key,className:`fk:flex fk:w-full fk:flex-col fk:rounded-lg fk:border fk:px-3 fk:py-2 fk:text-left fk:corner-squircle ${o===l.key?"fk:border-primary fk:bg-primary/5":"fk:border-border fk:hover:bg-muted/60"}`,disabled:c$1,onClick:()=>{a(l.key),m(null);},type:"button",children:[jsx("span",{className:"fk:text-sm fk:font-medium",children:l.label}),l.description?jsx("span",{className:"fk:text-xs fk:text-muted-foreground",children:l.description}):null]},l.key))}):h?.description?jsx("p",{className:"fk:text-sm fk:text-muted-foreground",children:h.description}):null,k$1.map((l,C)=>{let i=`${r$1}-${l.key}`,y=u?.field===l.key?u.message:null;return jsxs("div",{className:"fk:flex fk:flex-col fk:gap-2",children:[jsx("label",{className:"fk:text-sm fk:font-medium",htmlFor:i,children:l.label}),jsx(b,{"aria-describedby":y?`${i}-error`:l.help?`${i}-help`:void 0,"aria-invalid":y?true:void 0,autoComplete:"off",autoFocus:C===0,disabled:c$1,id:i,placeholder:l.placeholder??void 0,spellCheck:false,type:l.kind==="secret"?"password":"text",value:d[l.key]??"",onChange:j=>{g(Y=>({...Y,[l.key]:j.target.value})),m(null);}}),l.help&&!y?jsx("p",{className:"fk:text-sm fk:text-muted-foreground",id:`${i}-help`,children:l.help}):null,jsx($,{id:`${i}-error`,message:y})]},l.key)}),jsx($,{id:`${r$1}-error`,message:u?.field===null?u.message:null}),jsx(V,{href:e.helpUrl,label:`How to set up ${n}`}),jsxs(r,{children:[jsx(c,{disabled:c$1,size:"sm",type:"button",variant:"outline",onClick:()=>t$1.settle(false),children:"Cancel"}),jsxs(c,{disabled:c$1||!v,size:"sm",type:"submit",children:[c$1?jsx(LoaderCircle,{className:"fk:size-4 fk:animate-spin"}):null,"Connect"]})]})]})})})}function le({request:t$1}){let{connect:e,name:n}=t$1.plugin,r$1=useId(),[o,a]=useState(""),[d,g]=useState(null),[u,m]=useState(false);async function c$1(f){f.preventDefault();let k=o.trim();if(!(u||!k)){if(!S(k,e.pattern)){g(`That does not look like a ${e.tokenLabel}.`);return}m(true),g(null);try{await t$1.submit(k),a(""),t$1.settle(!0);}catch(h){g(h instanceof Error?h.message:`${n} could not be connected.`);}finally{m(false);}}}return jsx(k,{open:true,onOpenChange:f=>{!f&&!u&&t$1.settle(false);},children:jsx(p,{children:jsxs("form",{className:"fk:flex fk:flex-col fk:gap-4",onSubmit:f=>{c$1(f);},children:[jsxs(q$1,{children:[jsxs(s,{children:["Connect ",n]}),jsxs(t,{children:["Paste a ",e.tokenLabel,". Flexkit stores it encrypted and sends it only to ",n,"; the agent can use"," ",n,"'s tools but never sees the token. Give it read access only, unless the agent should change things in ",n,"."]})]}),jsxs("div",{className:"fk:flex fk:flex-col fk:gap-2",children:[jsx("label",{className:"fk:text-sm fk:font-medium",htmlFor:r$1,children:e.tokenLabel}),jsx(b,{"aria-describedby":d?`${r$1}-error`:void 0,"aria-invalid":d?true:void 0,autoComplete:"off",autoFocus:true,disabled:u,id:r$1,placeholder:e.placeholder??void 0,spellCheck:false,type:"password",value:o,onChange:f=>{a(f.target.value),g(null);}}),jsx($,{id:`${r$1}-error`,message:d}),jsx(V,{href:e.helpUrl,label:`How to create a ${e.tokenLabel}`})]}),jsxs(r,{children:[jsx(c,{disabled:u,size:"sm",type:"button",variant:"outline",onClick:()=>t$1.settle(false),children:"Cancel"}),jsxs(c,{disabled:u||!o.trim(),size:"sm",type:"submit",children:[u?jsx(LoaderCircle,{className:"fk:size-4 fk:animate-spin"}):null,"Connect"]})]})]})})})}export{R as a,O as b,ae as c,me as d,ke as e};//# sourceMappingURL=chunk-WU2KCXBC.js.map
2
+ //# sourceMappingURL=chunk-WU2KCXBC.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/apps/ai/plugin-oauth.ts","../src/apps/ai/plugin-token-format.ts","../src/apps/ai/plugin-token.tsx"],"names":["OAUTH_START_PATH","PluginAccountMismatchError","httpsUrl","value","url","trustedPluginOAuthTargets","authorizeUrl","completionOrigin","origin","getPlatformOrigin","authorize","completion","connectPluginPopup","api","pluginId","scope","options","popup","transaction","error","targets","expectedOrigin","resolve","reject","polling","finished","handedOff","finish","interval","timeout","onMessage","poll","status","event","payload","pluginSecretFormats","plugin","connect","method","field","credentialFormFields","selected","item","credentialFormComplete","fields","values","credentialFormError","matchesTokenPattern","token","pattern","compileTokenPattern","findPastedPluginToken","text","plugins","words","word","found","tokens","format","request","lastRequestId","cancelLatest","listeners","setRequest","next","listener","subscribe","connectPlugin","id","connectionId","settle","connected","httpsHref","PluginTokenDialogHost","current","useSyncExternalStore","jsx","PluginTokenDialog","PluginCredentialsDialog","FieldError","message","HelpLink","href","label","safeHref","jsxs","ExternalLinkIcon","name","formId","useId","setMethod","useState","setValues","setError","saving","setSaving","selectedMethod","ready","save","problem","failure","Dialog","open","DialogContent","DialogHeader","DialogTitle","DialogDescription","index","inputId","fieldError","Input","previous","DialogFooter","Button","LoaderCircle","setToken"],"mappings":"+UAGA,IAAMA,CAAAA,CAAmB,sBAAA,CAGZC,CAAAA,CAAN,cAAyC,KAAM,CAC3C,IAAA,CAAO,kBAAA,CAEhB,WAAA,EAAc,CACZ,KAAA,CAAM,kFAAkF,EACxF,IAAA,CAAK,IAAA,CAAO,6BACd,CACF,EAEA,SAASC,CAAAA,CAASC,CAAAA,CAA2B,CAC3C,IAAIC,CAAAA,CAEJ,GAAI,CACFA,CAAAA,CAAM,IAAI,GAAA,CAAID,CAAK,EACrB,CAAA,KAAQ,CACN,OAAO,IACT,CAEA,OAAIC,CAAAA,CAAI,QAAA,GAAa,QAAA,EAAYA,CAAAA,CAAI,QAAA,GAAa,IAAMA,CAAAA,CAAI,QAAA,GAAa,EAAA,CAChE,IAAA,CAGFA,CACT,CAGA,SAASC,CAAAA,CACPC,CAAAA,CACAC,CAAAA,CACyC,CACzC,IAAMC,CAAAA,CAASC,GAAAA,GACTC,CAAAA,CAAYR,CAAAA,CAASI,CAAY,CAAA,CACjCK,CAAAA,CAAaT,CAAAA,CAASK,CAAgB,CAAA,CAU5C,OARI,CAACG,CAAAA,EAAa,CAACC,CAAAA,EAIfD,CAAAA,CAAU,SAAWF,CAAAA,EAAUE,CAAAA,CAAU,QAAA,GAAaV,CAAAA,EAItDW,CAAAA,CAAW,MAAA,GAAWH,CAAAA,EAAUG,CAAAA,CAAW,QAAA,GAAa,GAAA,CACnD,IAAA,CAGF,CAAE,IAAA,CAAMD,CAAAA,CAAU,KAAM,MAAA,CAAAF,CAAO,CACxC,CAGA,eAAsBI,CAAAA,CACpBC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACe,CACf,IAAMC,CAAAA,CAAQ,MAAA,CAAO,KAAK,aAAA,CAAe,CAAA,eAAA,EAAkB,MAAA,CAAO,UAAA,EAAY,CAAA,CAAA,CAAI,4BAA4B,CAAA,CAE9G,GAAI,CAACA,CA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AO,KAAK,CAAA,CAC3B4D,CAAAA,CAAS,IAAI,EACf,CAAA,CACF,CAAA,CACAjB,IAACG,CAAAA,CAAA,CAAW,EAAA,CAAI,CAAA,EAAG6B,CAAO,CAAA,MAAA,CAAA,CAAU,OAAA,CAASzF,CAAAA,CAAO,CAAA,CACpDyD,GAAAA,CAACK,CAAAA,CAAA,CAAS,IAAA,CAAM5C,CAAAA,CAAQ,QAAS,KAAA,CAAO,CAAA,gBAAA,EAAmBA,CAAAA,CAAQ,UAAU,CAAA,CAAA,CAAI,CAAA,CAAA,CACnF,CAAA,CACAgD,IAAAA,CAAC2B,CAAAA,CAAA,CACC,QAAA,CAAA,CAAApC,GAAAA,CAACqC,CAAAA,CAAA,CAAO,SAAUnB,CAAAA,CAAQ,IAAA,CAAK,IAAA,CAAK,IAAA,CAAK,QAAA,CAAS,OAAA,CAAQ,SAAA,CAAU,OAAA,CAAS,IAAMpB,CAAAA,CAAQ,MAAA,CAAO,KAAK,CAAA,CAAG,QAAA,CAAA,QAAA,CAE1G,EACAW,IAAAA,CAAC4B,CAAAA,CAAA,CAAO,QAAA,CAAUnB,CAAAA,EAAU,CAAC9C,CAAAA,CAAM,IAAA,EAAK,CAAG,IAAA,CAAK,IAAA,CAAK,IAAA,CAAK,QAAA,CACvD,QAAA,CAAA,CAAA8C,EAASlB,GAAAA,CAACsC,YAAAA,CAAA,CAAa,SAAA,CAAU,2BAAA,CAA4B,CAAA,CAAK,IAAA,CAAK,SAAA,CAAA,CAE1E,CAAA,CAAA,CACF,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CACF,CAEJ","file":"chunk-5LGIALCK.js","sourcesContent":["import { getPlatformOrigin, type ApiClient } from './api';\nimport type { PluginScope } from './plugin-types';\n\nconst OAUTH_START_PATH = '/plugins/oauth/start';\n\n/** A Reconnect was completed with a different provider account than the one being reconnected. */\nexport class PluginAccountMismatchError extends Error {\n readonly code = 'account_mismatch';\n\n constructor() {\n super('You signed in with a different account. Use \"Connect another account\" to add it.');\n this.name = 'PluginAccountMismatchError';\n }\n}\n\nfunction httpsUrl(value: string): URL | null {\n let url: URL;\n\n try {\n url = new URL(value);\n } catch {\n return null;\n }\n\n if (url.protocol !== 'https:' || url.username !== '' || url.password !== '') {\n return null;\n }\n\n return url;\n}\n\n/** Popup navigation and postMessage stay on the platform OAuth start page. */\nfunction trustedPluginOAuthTargets(\n authorizeUrl: string,\n completionOrigin: string\n): { href: string; origin: string } | null {\n const origin = getPlatformOrigin();\n const authorize = httpsUrl(authorizeUrl);\n const completion = httpsUrl(completionOrigin);\n\n if (!authorize || !completion) {\n return null;\n }\n\n if (authorize.origin !== origin || authorize.pathname !== OAUTH_START_PATH) {\n return null;\n }\n\n if (completion.origin !== origin || completion.pathname !== '/') {\n return null;\n }\n\n return { href: authorize.href, origin };\n}\n\n/** Must be called directly from the click handler so browsers allow the popup. */\nexport async function connectPluginPopup(\n api: ApiClient,\n pluginId: string,\n scope: PluginScope,\n options?: { connectionId?: string }\n): Promise<void> {\n const popup = window.open('about:blank', `flexkit-plugin-${crypto.randomUUID()}`, 'popup,width=560,height=720');\n\n if (!popup) {\n throw new Error('Allow popups for Studio, then connect again.');\n }\n\n let transaction: Awaited<ReturnType<ApiClient['connectPlugins']>>;\n\n try {\n transaction = await api.connectPlugins({\n pluginId,\n scope,\n studioOrigin: window.location.origin,\n ...(options?.connectionId ? { connectionId: options.connectionId } : {}),\n });\n } catch (error) {\n popup.close();\n throw error;\n }\n\n const targets = trustedPluginOAuthTargets(transaction.authorizeUrl, transaction.completionOrigin);\n\n if (!targets) {\n popup.close();\n throw new Error('Connection could not be started.');\n }\n\n const expectedOrigin = targets.origin;\n\n await new Promise<void>((resolve, reject) => {\n let polling = false;\n let finished = false;\n // Once the popup leaves for the provider, `popup.closed` says nothing:\n // providers isolate their pages (Cross-Origin-Opener-Policy), which severs\n // the opener and reports the window as closed while it is open. From then\n // on only the transaction's status (and the timeout) ends the wait.\n let handedOff = false;\n const finish = (error?: Error) => {\n if (finished) {\n return;\n }\n\n finished = true;\n window.clearInterval(interval);\n window.clearTimeout(timeout);\n window.removeEventListener('message', onMessage);\n popup.close();\n\n if (error) {\n reject(error);\n\n return;\n }\n\n resolve();\n };\n const poll = async () => {\n if (polling || finished) {\n return;\n }\n\n polling = true;\n let status: Awaited<ReturnType<ApiClient['pluginOAuthStatus']>>;\n\n try {\n status = await api.pluginOAuthStatus(transaction.transactionId);\n } catch {\n polling = false;\n\n return;\n }\n\n polling = false;\n\n if (status.status === 'complete') {\n finish();\n\n return;\n }\n\n if (!handedOff && popup.closed && status.status === 'pending') {\n finish(new Error('Connection window was closed.'));\n\n return;\n }\n\n if (status.status === 'failed' || new Date(status.expires_at).getTime() < Date.now()) {\n finish(new Error('Connection was not completed. Please try again.'));\n }\n };\n const onMessage = (event: MessageEvent<unknown>) => {\n if (event.origin !== expectedOrigin || event.source !== popup || !event.data || typeof event.data !== 'object') {\n return;\n }\n\n const payload = event.data as { type?: string; transactionId?: string; status?: string; error?: string };\n\n if (payload.type === 'flexkit:plugin-oauth-ready' && payload.transactionId === transaction.transactionId) {\n handedOff = true;\n popup.postMessage(\n {\n type: 'flexkit:plugin-oauth-start',\n transactionId: transaction.transactionId,\n ticket: transaction.launchTicket,\n },\n expectedOrigin\n );\n\n return;\n }\n\n if (payload.type === 'flexkit:plugin-oauth' && payload.transactionId === transaction.transactionId) {\n if (payload.status === 'failed' && payload.error === 'account_mismatch') {\n finish(new PluginAccountMismatchError());\n\n return;\n }\n\n void poll();\n }\n };\n const interval = window.setInterval(() => {\n void poll();\n }, 2000);\n const timeout = window.setTimeout(() => finish(new Error('Connection timed out. Please try again.')), 600_000);\n window.addEventListener('message', onMessage);\n popup.location.href = targets.href;\n });\n}\n","import type { MarketplacePlugin, PluginCredentialField, PluginCredentialsConnect } from './plugin-types';\n\nexport type ConnectablePlugin = Pick<MarketplacePlugin, 'connect' | 'id' | 'name'>;\n\n/** Longer than any credential a provider issues; the server rejects more. */\nexport const MAX_CREDENTIAL_VALUE_LENGTH = 4096;\n\n/**\n * The secrets a plugin's connect form takes that can be recognized on their\n * own (a distinctive prefix, say), each with that pattern and what to call it.\n */\nexport function pluginSecretFormats(plugin: ConnectablePlugin): Array<{ label: string; pattern: string }> {\n const { connect } = plugin;\n\n if (connect?.type === 'api-token') {\n return connect.pattern ? [{ label: connect.tokenLabel, pattern: connect.pattern }] : [];\n }\n\n if (connect?.type === 'credentials') {\n return [...connect.fields, ...connect.methods.flatMap((method) => method.fields)]\n .filter((field) => field.kind === 'secret' && field.detect)\n .map((field) => ({ label: field.label, pattern: field.detect! }));\n }\n\n return [];\n}\n\n/** The fields a credentials form shows: the shared ones, then those of the chosen method. */\nexport function credentialFormFields(connect: PluginCredentialsConnect, method: string | null): PluginCredentialField[] {\n const selected = connect.methods.find((item) => item.key === method);\n\n return [...connect.fields, ...(selected?.fields ?? [])];\n}\n\n/** Whether every required field has a value: what the Connect button waits for. */\nexport function credentialFormComplete(\n fields: readonly PluginCredentialField[],\n values: { [key: string]: string }\n): boolean {\n return fields.every((field) => !field.required || Boolean(values[field.key]?.trim()));\n}\n\n/** The first problem with the values entered, or null when they can be submitted. */\nexport function credentialFormError(\n fields: readonly PluginCredentialField[],\n values: { [key: string]: string }\n): { field: string; message: string } | null {\n for (const field of fields) {\n const value = values[field.key]?.trim() ?? '';\n\n if (!value) {\n if (field.required) {\n return { field: field.key, message: `Enter the ${field.label}.` };\n }\n\n continue;\n }\n\n if (value.length > MAX_CREDENTIAL_VALUE_LENGTH) {\n return { field: field.key, message: `The ${field.label} is too long; paste only the value.` };\n }\n\n if (!matchesTokenPattern(value, field.pattern)) {\n return { field: field.key, message: `That is not a valid ${field.label}.` };\n }\n }\n\n return null;\n}\n\nexport function matchesTokenPattern(token: string, pattern: string | null): boolean {\n if (!pattern) {\n return true;\n }\n\n try {\n return new RegExp(pattern, 'u').test(token);\n } catch {\n // The server validates the pattern when it admits the plugin; never block on a bad one here.\n return true;\n }\n}\n\n/** A pattern that compiles; an empty or broken one detects nothing rather than every word. */\nfunction compileTokenPattern(pattern: string | null): RegExp | null {\n if (!pattern) {\n return null;\n }\n\n try {\n return new RegExp(pattern, 'u');\n } catch {\n return null;\n }\n}\n\n/**\n * The first plugin whose secret format `text` contains, if any, with every\n * secret-shaped word in the message and what the plugin calls that secret: a\n * token pasted into the chat would be stored in the conversation and sent to\n * the model.\n */\nexport function findPastedPluginToken(\n text: string,\n plugins: readonly ConnectablePlugin[]\n): { plugin: ConnectablePlugin; tokens: string[]; label: string } | null {\n // A token is often glued to a label (`token=…`, `key: …`) or wrapped in\n // brackets, quotes or a sentence's punctuation; none of those are part of it.\n const words = text\n .split(/[\\s\"'`()<>[\\]{},;:=!?&]+/)\n .map((word) => word.replace(/\\.+$/, ''))\n .filter(Boolean);\n let found: { plugin: ConnectablePlugin; label: string } | null = null;\n const tokens = new Set<string>();\n\n for (const plugin of plugins) {\n for (const format of pluginSecretFormats(plugin)) {\n const pattern = compileTokenPattern(format.pattern);\n\n for (const word of pattern ? words : []) {\n if (pattern!.test(word)) {\n found ??= { plugin, label: format.label };\n tokens.add(word);\n }\n }\n }\n }\n\n return found ? { ...found, tokens: [...tokens] } : null;\n}\n","import type { FormEvent, JSX } from 'react';\nimport { useId, useState, useSyncExternalStore } from 'react';\nimport { ExternalLinkIcon, LoaderCircle } from 'lucide-react';\nimport {\n Button,\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n Input,\n} from '../../ui';\nimport type { ApiClient } from './api';\nimport { connectPluginPopup } from './plugin-oauth';\nimport {\n credentialFormComplete,\n credentialFormError,\n credentialFormFields,\n matchesTokenPattern,\n type ConnectablePlugin,\n} from './plugin-token-format';\nimport type { PluginApiTokenConnect, PluginCredentialsConnect, PluginScope } from './plugin-types';\n\ninterface TokenRequest {\n id: number;\n plugin: ConnectablePlugin & { connect: PluginApiTokenConnect };\n /** Saves the token; rejects with a message the dialog shows next to the field. */\n submit: (_token: string) => Promise<void>;\n settle: (_connected: boolean) => void;\n}\n\ninterface CredentialsRequest {\n id: number;\n plugin: ConnectablePlugin & { connect: PluginCredentialsConnect };\n /** Saves the form; rejects with a message the dialog shows under the fields. */\n submit: (_method: string | undefined, _values: { [key: string]: string }) => Promise<void>;\n settle: (_connected: boolean) => void;\n}\n\ntype FormRequest = ({ kind: 'token' } & TokenRequest) | ({ kind: 'credentials' } & CredentialsRequest);\n\n/** The one open connect form, outside React so any connect button can open it. */\nlet request: FormRequest | null = null;\nlet lastRequestId = 0;\n/** Cancels the latest request, whether its dialog has opened yet or not. */\nlet cancelLatest: (() => void) | null = null;\nconst listeners = new Set<() => void>();\n\nfunction setRequest(next: FormRequest | null): void {\n request = next;\n listeners.forEach((listener) => listener());\n}\n\nfunction subscribe(listener: () => void): () => void {\n listeners.add(listener);\n\n return () => listeners.delete(listener);\n}\n\n/**\n * Connects a plugin: a sign-in popup for OAuth plugins, the token dialog for\n * plugins that take a pasted token, the credentials dialog for plugins that\n * take the credentials of an app the user created at the provider. Resolves\n * `false` when the user closes a dialog without connecting.\n *\n * Call it straight from a click handler: browsers only allow the popup there.\n */\nexport function connectPlugin(\n api: ApiClient,\n plugin: ConnectablePlugin,\n scope: PluginScope,\n options?: { connectionId?: string }\n): Promise<boolean> {\n const { connect } = plugin;\n\n if (connect?.type !== 'api-token' && connect?.type !== 'credentials') {\n return connectPluginPopup(api, plugin.id, scope, options).then(() => true);\n }\n\n // Opening a second dialog closes the first, as if cancelled.\n cancelLatest?.();\n\n const id = ++lastRequestId;\n const connectionId = options?.connectionId ? { connectionId: options.connectionId } : {};\n\n return new Promise<boolean>((resolve) => {\n const settle = (connected: boolean): void => {\n // A save still running for a replaced dialog must not close its successor.\n if (request?.id === id) {\n setRequest(null);\n }\n\n if (lastRequestId === id) {\n cancelLatest = null;\n }\n\n resolve(connected);\n };\n const next: FormRequest =\n connect.type === 'api-token'\n ? {\n kind: 'token',\n id,\n plugin: { ...plugin, connect },\n submit: async (token) => {\n await api.connectPluginToken({ pluginId: plugin.id, scope, token, ...connectionId });\n },\n settle,\n }\n : {\n kind: 'credentials',\n id,\n plugin: { ...plugin, connect },\n submit: async (method, values) => {\n await api.connectPluginCredentials({ pluginId: plugin.id, scope, method, values, ...connectionId });\n },\n settle,\n };\n\n cancelLatest = () => settle(false);\n\n // Open after the current event: a menu item that started this closes first\n // and returns focus to its trigger, which would take it from the first field.\n setTimeout(() => {\n if (lastRequestId === id) {\n setRequest(next);\n }\n });\n });\n}\n\nfunction httpsHref(value: string | null): string | null {\n if (!value) {\n return null;\n }\n\n try {\n const url = new URL(value);\n\n return url.protocol === 'https:' ? url.href : null;\n } catch {\n return null;\n }\n}\n\n/** Mounted once by the Studio layout; renders the dialog `connectPlugin` opens for token and credentials plugins. */\nexport function PluginTokenDialogHost(): JSX.Element | null {\n const current = useSyncExternalStore(\n subscribe,\n () => request,\n () => null\n );\n\n if (!current) {\n return null;\n }\n\n // A new key per request resets the fields, so a secret never outlives its dialog.\n return current.kind === 'token' ? (\n <PluginTokenDialog key={current.id} request={current} />\n ) : (\n <PluginCredentialsDialog key={current.id} request={current} />\n );\n}\n\nfunction FieldError({ id, message }: { id: string; message: string | null }): JSX.Element | null {\n return message ? (\n <p className=\"fk:text-sm fk:text-destructive\" id={id}>\n {message}\n </p>\n ) : null;\n}\n\nfunction HelpLink({ href, label }: { href: string | null; label: string }): JSX.Element | null {\n const safeHref = httpsHref(href);\n\n return safeHref ? (\n <a\n className=\"fk:inline-flex fk:items-center fk:gap-1 fk:text-sm fk:text-muted-foreground fk:underline-offset-4 fk:hover:underline\"\n href={safeHref}\n rel=\"noreferrer\"\n target=\"_blank\"\n >\n {label}\n <ExternalLinkIcon className=\"fk:size-3.5\" />\n </a>\n ) : null;\n}\n\nfunction PluginCredentialsDialog({ request: current }: { request: CredentialsRequest }): JSX.Element {\n const { connect, name } = current.plugin;\n const formId = useId();\n const [method, setMethod] = useState<string | null>(connect.methods[0]?.key ?? null);\n const [values, setValues] = useState<{ [key: string]: string }>({});\n const [error, setError] = useState<{ field: string | null; message: string } | null>(null);\n const [saving, setSaving] = useState(false);\n const fields = credentialFormFields(connect, method);\n const selectedMethod = connect.methods.find((item) => item.key === method) ?? null;\n // Submitting surfaces which field is malformed; the button only waits for the required values.\n const ready = credentialFormComplete(fields, values);\n\n async function save(event: FormEvent): Promise<void> {\n event.preventDefault();\n\n if (saving) {\n return;\n }\n\n const problem = credentialFormError(fields, values);\n\n if (problem) {\n setError(problem);\n\n return;\n }\n\n setSaving(true);\n setError(null);\n\n try {\n await current.submit(\n method ?? undefined,\n Object.fromEntries(fields.map((field) => [field.key, values[field.key]?.trim() ?? '']).filter(([, value]) => value))\n );\n setValues({});\n current.settle(true);\n } catch (failure) {\n setError({ field: null, message: failure instanceof Error ? failure.message : `${name} could not be connected.` });\n } finally {\n setSaving(false);\n }\n }\n\n return (\n <Dialog\n open\n onOpenChange={(open) => {\n if (!open && !saving) {\n current.settle(false);\n }\n }}\n >\n <DialogContent>\n <form className=\"fk:flex fk:flex-col fk:gap-4\" onSubmit={(event) => void save(event)}>\n <DialogHeader>\n <DialogTitle>Connect {name}</DialogTitle>\n <DialogDescription>\n {connect.description} Flexkit checks the credentials with {name}, stores them encrypted and sends them\n only to Flexkit&apos;s own {name} server; the agent can use the tools but never sees them.\n </DialogDescription>\n </DialogHeader>\n {connect.methods.length > 1 ? (\n <div className=\"fk:space-y-1.5\" role=\"group\" aria-label=\"How to connect\">\n {connect.methods.map((item) => (\n <button\n aria-pressed={method === item.key}\n className={`fk:flex fk:w-full fk:flex-col fk:rounded-lg fk:border fk:px-3 fk:py-2 fk:text-left fk:corner-squircle ${\n method === item.key ? 'fk:border-primary fk:bg-primary/5' : 'fk:border-border fk:hover:bg-muted/60'\n }`}\n disabled={saving}\n key={item.key}\n onClick={() => {\n setMethod(item.key);\n setError(null);\n }}\n type=\"button\"\n >\n <span className=\"fk:text-sm fk:font-medium\">{item.label}</span>\n {item.description ? (\n <span className=\"fk:text-xs fk:text-muted-foreground\">{item.description}</span>\n ) : null}\n </button>\n ))}\n </div>\n ) : selectedMethod?.description ? (\n <p className=\"fk:text-sm fk:text-muted-foreground\">{selectedMethod.description}</p>\n ) : null}\n {fields.map((field, index) => {\n const inputId = `${formId}-${field.key}`;\n const fieldError = error?.field === field.key ? error.message : null;\n\n return (\n <div className=\"fk:flex fk:flex-col fk:gap-2\" key={field.key}>\n <label className=\"fk:text-sm fk:font-medium\" htmlFor={inputId}>\n {field.label}\n </label>\n <Input\n aria-describedby={fieldError ? `${inputId}-error` : field.help ? `${inputId}-help` : undefined}\n aria-invalid={fieldError ? true : undefined}\n autoComplete=\"off\"\n autoFocus={index === 0}\n disabled={saving}\n id={inputId}\n placeholder={field.placeholder ?? undefined}\n spellCheck={false}\n type={field.kind === 'secret' ? 'password' : 'text'}\n value={values[field.key] ?? ''}\n onChange={(event) => {\n setValues((previous) => ({ ...previous, [field.key]: event.target.value }));\n setError(null);\n }}\n />\n {field.help && !fieldError ? (\n <p className=\"fk:text-sm fk:text-muted-foreground\" id={`${inputId}-help`}>\n {field.help}\n </p>\n ) : null}\n <FieldError id={`${inputId}-error`} message={fieldError} />\n </div>\n );\n })}\n <FieldError id={`${formId}-error`} message={error?.field === null ? error.message : null} />\n <HelpLink href={connect.helpUrl} label={`How to set up ${name}`} />\n <DialogFooter>\n <Button disabled={saving} size=\"sm\" type=\"button\" variant=\"outline\" onClick={() => current.settle(false)}>\n Cancel\n </Button>\n <Button disabled={saving || !ready} size=\"sm\" type=\"submit\">\n {saving ? <LoaderCircle className=\"fk:size-4 fk:animate-spin\" /> : null}\n Connect\n </Button>\n </DialogFooter>\n </form>\n </DialogContent>\n </Dialog>\n );\n}\n\nfunction PluginTokenDialog({ request: current }: { request: TokenRequest }): JSX.Element {\n const { connect, name } = current.plugin;\n const inputId = useId();\n const [token, setToken] = useState('');\n const [error, setError] = useState<string | null>(null);\n const [saving, setSaving] = useState(false);\n\n async function save(event: FormEvent): Promise<void> {\n event.preventDefault();\n const value = token.trim();\n\n if (saving || !value) {\n return;\n }\n\n if (!matchesTokenPattern(value, connect.pattern)) {\n setError(`That does not look like a ${connect.tokenLabel}.`);\n\n return;\n }\n\n setSaving(true);\n setError(null);\n\n try {\n await current.submit(value);\n setToken('');\n current.settle(true);\n } catch (failure) {\n setError(failure instanceof Error ? failure.message : `${name} could not be connected.`);\n } finally {\n setSaving(false);\n }\n }\n\n return (\n <Dialog\n open\n onOpenChange={(open) => {\n if (!open && !saving) {\n current.settle(false);\n }\n }}\n >\n <DialogContent>\n <form className=\"fk:flex fk:flex-col fk:gap-4\" onSubmit={(event) => void save(event)}>\n <DialogHeader>\n <DialogTitle>Connect {name}</DialogTitle>\n <DialogDescription>\n Paste a {connect.tokenLabel}. Flexkit stores it encrypted and sends it only to {name}; the agent can use{' '}\n {name}&apos;s tools but never sees the token. Give it read access only, unless the agent should change\n things in {name}.\n </DialogDescription>\n </DialogHeader>\n <div className=\"fk:flex fk:flex-col fk:gap-2\">\n <label className=\"fk:text-sm fk:font-medium\" htmlFor={inputId}>\n {connect.tokenLabel}\n </label>\n <Input\n aria-describedby={error ? `${inputId}-error` : undefined}\n aria-invalid={error ? true : undefined}\n autoComplete=\"off\"\n autoFocus\n disabled={saving}\n id={inputId}\n placeholder={connect.placeholder ?? undefined}\n spellCheck={false}\n type=\"password\"\n value={token}\n onChange={(event) => {\n setToken(event.target.value);\n setError(null);\n }}\n />\n <FieldError id={`${inputId}-error`} message={error} />\n <HelpLink href={connect.helpUrl} label={`How to create a ${connect.tokenLabel}`} />\n </div>\n <DialogFooter>\n <Button disabled={saving} size=\"sm\" type=\"button\" variant=\"outline\" onClick={() => current.settle(false)}>\n Cancel\n </Button>\n <Button disabled={saving || !token.trim()} size=\"sm\" type=\"submit\">\n {saving ? <LoaderCircle className=\"fk:size-4 fk:animate-spin\" /> : null}\n Connect\n </Button>\n </DialogFooter>\n </form>\n </DialogContent>\n </Dialog>\n );\n}\n"]}
1
+ {"version":3,"sources":["../src/apps/ai/plugin-oauth.ts","../src/apps/ai/plugin-token-format.ts","../src/apps/ai/plugin-token.tsx"],"names":["OAUTH_START_PATH","PluginAccountMismatchError","httpsUrl","value","url","trustedPluginOAuthTargets","authorizeUrl","completionOrigin","origin","getPlatformOrigin","authorize","completion","connectPluginPopup","api","pluginId","scope","options","popup","transaction","error","targets","expectedOrigin","resolve","reject","polling","finished","handedOff","finish","interval","timeout","onMessage","poll","status","event","payload","pluginSecretFormats","plugin","connect","method","field","credentialFormFields","selected","item","credentialFormComplete","fields","values","credentialFormError","matchesTokenPattern","token","pattern","compileTokenPattern","findPastedPluginToken","text","plugins","words","word","found","tokens","format","request","lastRequestId","cancelLatest","listeners","setRequest","next","listener","subscribe","connectPlugin","id","connectionId","settle","connected","httpsHref","PluginTokenDialogHost","current","useSyncExternalStore","jsx","PluginTokenDialog","PluginCredentialsDialog","FieldError","message","HelpLink","href","label","safeHref","jsxs","ExternalLinkIcon","name","formId","useId","setMethod","useState","setValues","setError","saving","setSaving","selectedMethod","ready","save","problem","failure","Dialog","open","DialogContent","DialogHeader","DialogTitle","DialogDescription","index","inputId","fieldError","Input","previous","DialogFooter","Button","LoaderCircle","setToken"],"mappings":"sVAGA,IAAMA,CAAAA,CAAmB,sBAAA,CAGZC,CAAAA,CAAN,cAAyC,KAAM,CAC3C,IAAA,CAAO,kBAAA,CAEhB,WAAA,EAAc,CACZ,KAAA,CAAM,kFAAkF,EACxF,IAAA,CAAK,IAAA,CAAO,6BACd,CACF,EAEA,SAASC,CAAAA,CAASC,CAAAA,CAA2B,CAC3C,IAAIC,CAAAA,CAEJ,GAAI,CACFA,CAAAA,CAAM,IAAI,GAAA,CAAID,CAAK,EACrB,CAAA,KAAQ,CACN,OAAO,IACT,CAEA,OAAIC,CAAAA,CAAI,QAAA,GAAa,QAAA,EAAYA,CAAAA,CAAI,QAAA,GAAa,IAAMA,CAAAA,CAAI,QAAA,GAAa,EAAA,CAChE,IAAA,CAGFA,CACT,CAGA,SAASC,CAAAA,CACPC,CAAAA,CACAC,CAAAA,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,MAAA,CAAO,KAAK,CAAA,CAAG,QAAA,CAAA,QAAA,CAE1G,EACAW,IAAAA,CAAC4B,CAAAA,CAAA,CAAO,QAAA,CAAUnB,CAAAA,EAAU,CAAC9C,CAAAA,CAAM,IAAA,EAAK,CAAG,IAAA,CAAK,IAAA,CAAK,IAAA,CAAK,QAAA,CACvD,QAAA,CAAA,CAAA8C,EAASlB,GAAAA,CAACsC,YAAAA,CAAA,CAAa,SAAA,CAAU,2BAAA,CAA4B,CAAA,CAAK,IAAA,CAAK,SAAA,CAAA,CAE1E,CAAA,CAAA,CACF,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CACF,CAEJ","file":"chunk-WU2KCXBC.js","sourcesContent":["import { getPlatformOrigin, type ApiClient } from './api';\nimport type { PluginScope } from './plugin-types';\n\nconst OAUTH_START_PATH = '/plugins/oauth/start';\n\n/** A Reconnect was completed with a different provider account than the one being reconnected. */\nexport class PluginAccountMismatchError extends Error {\n readonly code = 'account_mismatch';\n\n constructor() {\n super('You signed in with a different account. Use \"Connect another account\" to add it.');\n this.name = 'PluginAccountMismatchError';\n }\n}\n\nfunction httpsUrl(value: string): URL | null {\n let url: URL;\n\n try {\n url = new URL(value);\n } catch {\n return null;\n }\n\n if (url.protocol !== 'https:' || url.username !== '' || url.password !== '') {\n return null;\n }\n\n return url;\n}\n\n/** Popup navigation and postMessage stay on the platform OAuth start page. */\nfunction trustedPluginOAuthTargets(\n authorizeUrl: string,\n completionOrigin: string\n): { href: string; origin: string } | null {\n const origin = getPlatformOrigin();\n const authorize = httpsUrl(authorizeUrl);\n const completion = httpsUrl(completionOrigin);\n\n if (!authorize || !completion) {\n return null;\n }\n\n if (authorize.origin !== origin || authorize.pathname !== OAUTH_START_PATH) {\n return null;\n }\n\n if (completion.origin !== origin || completion.pathname !== '/') {\n return null;\n }\n\n return { href: authorize.href, origin };\n}\n\n/** Must be called directly from the click handler so browsers allow the popup. */\nexport async function connectPluginPopup(\n api: ApiClient,\n pluginId: string,\n scope: PluginScope,\n options?: { connectionId?: string }\n): Promise<void> {\n const popup = window.open('about:blank', `flexkit-plugin-${crypto.randomUUID()}`, 'popup,width=560,height=720');\n\n if (!popup) {\n throw new Error('Allow popups for Studio, then connect again.');\n }\n\n let transaction: Awaited<ReturnType<ApiClient['connectPlugins']>>;\n\n try {\n transaction = await api.connectPlugins({\n pluginId,\n scope,\n studioOrigin: window.location.origin,\n ...(options?.connectionId ? { connectionId: options.connectionId } : {}),\n });\n } catch (error) {\n popup.close();\n throw error;\n }\n\n const targets = trustedPluginOAuthTargets(transaction.authorizeUrl, transaction.completionOrigin);\n\n if (!targets) {\n popup.close();\n throw new Error('Connection could not be started.');\n }\n\n const expectedOrigin = targets.origin;\n\n await new Promise<void>((resolve, reject) => {\n let polling = false;\n let finished = false;\n // Once the popup leaves for the provider, `popup.closed` says nothing:\n // providers isolate their pages (Cross-Origin-Opener-Policy), which severs\n // the opener and reports the window as closed while it is open. From then\n // on only the transaction's status (and the timeout) ends the wait.\n let handedOff = false;\n const finish = (error?: Error) => {\n if (finished) {\n return;\n }\n\n finished = true;\n window.clearInterval(interval);\n window.clearTimeout(timeout);\n window.removeEventListener('message', onMessage);\n popup.close();\n\n if (error) {\n reject(error);\n\n return;\n }\n\n resolve();\n };\n const poll = async () => {\n if (polling || finished) {\n return;\n }\n\n polling = true;\n let status: Awaited<ReturnType<ApiClient['pluginOAuthStatus']>>;\n\n try {\n status = await api.pluginOAuthStatus(transaction.transactionId);\n } catch {\n polling = false;\n\n return;\n }\n\n polling = false;\n\n if (status.status === 'complete') {\n finish();\n\n return;\n }\n\n if (!handedOff && popup.closed && status.status === 'pending') {\n finish(new Error('Connection window was closed.'));\n\n return;\n }\n\n if (status.status === 'failed' || new Date(status.expires_at).getTime() < Date.now()) {\n finish(new Error('Connection was not completed. Please try again.'));\n }\n };\n const onMessage = (event: MessageEvent<unknown>) => {\n if (event.origin !== expectedOrigin || event.source !== popup || !event.data || typeof event.data !== 'object') {\n return;\n }\n\n const payload = event.data as { type?: string; transactionId?: string; status?: string; error?: string };\n\n if (payload.type === 'flexkit:plugin-oauth-ready' && payload.transactionId === transaction.transactionId) {\n handedOff = true;\n popup.postMessage(\n {\n type: 'flexkit:plugin-oauth-start',\n transactionId: transaction.transactionId,\n ticket: transaction.launchTicket,\n },\n expectedOrigin\n );\n\n return;\n }\n\n if (payload.type === 'flexkit:plugin-oauth' && payload.transactionId === transaction.transactionId) {\n if (payload.status === 'failed' && payload.error === 'account_mismatch') {\n finish(new PluginAccountMismatchError());\n\n return;\n }\n\n void poll();\n }\n };\n const interval = window.setInterval(() => {\n void poll();\n }, 2000);\n const timeout = window.setTimeout(() => finish(new Error('Connection timed out. Please try again.')), 600_000);\n window.addEventListener('message', onMessage);\n popup.location.href = targets.href;\n });\n}\n","import type { MarketplacePlugin, PluginCredentialField, PluginCredentialsConnect } from './plugin-types';\n\nexport type ConnectablePlugin = Pick<MarketplacePlugin, 'connect' | 'id' | 'name'>;\n\n/** Longer than any credential a provider issues; the server rejects more. */\nexport const MAX_CREDENTIAL_VALUE_LENGTH = 4096;\n\n/**\n * The secrets a plugin's connect form takes that can be recognized on their\n * own (a distinctive prefix, say), each with that pattern and what to call it.\n */\nexport function pluginSecretFormats(plugin: ConnectablePlugin): Array<{ label: string; pattern: string }> {\n const { connect } = plugin;\n\n if (connect?.type === 'api-token') {\n return connect.pattern ? [{ label: connect.tokenLabel, pattern: connect.pattern }] : [];\n }\n\n if (connect?.type === 'credentials') {\n return [...connect.fields, ...connect.methods.flatMap((method) => method.fields)]\n .filter((field) => field.kind === 'secret' && field.detect)\n .map((field) => ({ label: field.label, pattern: field.detect! }));\n }\n\n return [];\n}\n\n/** The fields a credentials form shows: the shared ones, then those of the chosen method. */\nexport function credentialFormFields(connect: PluginCredentialsConnect, method: string | null): PluginCredentialField[] {\n const selected = connect.methods.find((item) => item.key === method);\n\n return [...connect.fields, ...(selected?.fields ?? [])];\n}\n\n/** Whether every required field has a value: what the Connect button waits for. */\nexport function credentialFormComplete(\n fields: readonly PluginCredentialField[],\n values: { [key: string]: string }\n): boolean {\n return fields.every((field) => !field.required || Boolean(values[field.key]?.trim()));\n}\n\n/** The first problem with the values entered, or null when they can be submitted. */\nexport function credentialFormError(\n fields: readonly PluginCredentialField[],\n values: { [key: string]: string }\n): { field: string; message: string } | null {\n for (const field of fields) {\n const value = values[field.key]?.trim() ?? '';\n\n if (!value) {\n if (field.required) {\n return { field: field.key, message: `Enter the ${field.label}.` };\n }\n\n continue;\n }\n\n if (value.length > MAX_CREDENTIAL_VALUE_LENGTH) {\n return { field: field.key, message: `The ${field.label} is too long; paste only the value.` };\n }\n\n if (!matchesTokenPattern(value, field.pattern)) {\n return { field: field.key, message: `That is not a valid ${field.label}.` };\n }\n }\n\n return null;\n}\n\nexport function matchesTokenPattern(token: string, pattern: string | null): boolean {\n if (!pattern) {\n return true;\n }\n\n try {\n return new RegExp(pattern, 'u').test(token);\n } catch {\n // The server validates the pattern when it admits the plugin; never block on a bad one here.\n return true;\n }\n}\n\n/** A pattern that compiles; an empty or broken one detects nothing rather than every word. */\nfunction compileTokenPattern(pattern: string | null): RegExp | null {\n if (!pattern) {\n return null;\n }\n\n try {\n return new RegExp(pattern, 'u');\n } catch {\n return null;\n }\n}\n\n/**\n * The first plugin whose secret format `text` contains, if any, with every\n * secret-shaped word in the message and what the plugin calls that secret: a\n * token pasted into the chat would be stored in the conversation and sent to\n * the model.\n */\nexport function findPastedPluginToken(\n text: string,\n plugins: readonly ConnectablePlugin[]\n): { plugin: ConnectablePlugin; tokens: string[]; label: string } | null {\n // A token is often glued to a label (`token=…`, `key: …`) or wrapped in\n // brackets, quotes or a sentence's punctuation; none of those are part of it.\n const words = text\n .split(/[\\s\"'`()<>[\\]{},;:=!?&]+/)\n .map((word) => word.replace(/\\.+$/, ''))\n .filter(Boolean);\n let found: { plugin: ConnectablePlugin; label: string } | null = null;\n const tokens = new Set<string>();\n\n for (const plugin of plugins) {\n for (const format of pluginSecretFormats(plugin)) {\n const pattern = compileTokenPattern(format.pattern);\n\n for (const word of pattern ? words : []) {\n if (pattern!.test(word)) {\n found ??= { plugin, label: format.label };\n tokens.add(word);\n }\n }\n }\n }\n\n return found ? { ...found, tokens: [...tokens] } : null;\n}\n","import type { FormEvent, JSX } from 'react';\nimport { useId, useState, useSyncExternalStore } from 'react';\nimport { ExternalLinkIcon, LoaderCircle } from 'lucide-react';\nimport {\n Button,\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n Input,\n} from '../../ui';\nimport type { ApiClient } from './api';\nimport { connectPluginPopup } from './plugin-oauth';\nimport {\n credentialFormComplete,\n credentialFormError,\n credentialFormFields,\n matchesTokenPattern,\n type ConnectablePlugin,\n} from './plugin-token-format';\nimport type { PluginApiTokenConnect, PluginCredentialsConnect, PluginScope } from './plugin-types';\n\ninterface TokenRequest {\n id: number;\n plugin: ConnectablePlugin & { connect: PluginApiTokenConnect };\n /** Saves the token; rejects with a message the dialog shows next to the field. */\n submit: (_token: string) => Promise<void>;\n settle: (_connected: boolean) => void;\n}\n\ninterface CredentialsRequest {\n id: number;\n plugin: ConnectablePlugin & { connect: PluginCredentialsConnect };\n /** Saves the form; rejects with a message the dialog shows under the fields. */\n submit: (_method: string | undefined, _values: { [key: string]: string }) => Promise<void>;\n settle: (_connected: boolean) => void;\n}\n\ntype FormRequest = ({ kind: 'token' } & TokenRequest) | ({ kind: 'credentials' } & CredentialsRequest);\n\n/** The one open connect form, outside React so any connect button can open it. */\nlet request: FormRequest | null = null;\nlet lastRequestId = 0;\n/** Cancels the latest request, whether its dialog has opened yet or not. */\nlet cancelLatest: (() => void) | null = null;\nconst listeners = new Set<() => void>();\n\nfunction setRequest(next: FormRequest | null): void {\n request = next;\n listeners.forEach((listener) => listener());\n}\n\nfunction subscribe(listener: () => void): () => void {\n listeners.add(listener);\n\n return () => listeners.delete(listener);\n}\n\n/**\n * Connects a plugin: a sign-in popup for OAuth plugins, the token dialog for\n * plugins that take a pasted token, the credentials dialog for plugins that\n * take the credentials of an app the user created at the provider. Resolves\n * `false` when the user closes a dialog without connecting.\n *\n * Call it straight from a click handler: browsers only allow the popup there.\n */\nexport function connectPlugin(\n api: ApiClient,\n plugin: ConnectablePlugin,\n scope: PluginScope,\n options?: { connectionId?: string }\n): Promise<boolean> {\n const { connect } = plugin;\n\n if (connect?.type !== 'api-token' && connect?.type !== 'credentials') {\n return connectPluginPopup(api, plugin.id, scope, options).then(() => true);\n }\n\n // Opening a second dialog closes the first, as if cancelled.\n cancelLatest?.();\n\n const id = ++lastRequestId;\n const connectionId = options?.connectionId ? { connectionId: options.connectionId } : {};\n\n return new Promise<boolean>((resolve) => {\n const settle = (connected: boolean): void => {\n // A save still running for a replaced dialog must not close its successor.\n if (request?.id === id) {\n setRequest(null);\n }\n\n if (lastRequestId === id) {\n cancelLatest = null;\n }\n\n resolve(connected);\n };\n const next: FormRequest =\n connect.type === 'api-token'\n ? {\n kind: 'token',\n id,\n plugin: { ...plugin, connect },\n submit: async (token) => {\n await api.connectPluginToken({ pluginId: plugin.id, scope, token, ...connectionId });\n },\n settle,\n }\n : {\n kind: 'credentials',\n id,\n plugin: { ...plugin, connect },\n submit: async (method, values) => {\n await api.connectPluginCredentials({ pluginId: plugin.id, scope, method, values, ...connectionId });\n },\n settle,\n };\n\n cancelLatest = () => settle(false);\n\n // Open after the current event: a menu item that started this closes first\n // and returns focus to its trigger, which would take it from the first field.\n setTimeout(() => {\n if (lastRequestId === id) {\n setRequest(next);\n }\n });\n });\n}\n\nfunction httpsHref(value: string | null): string | null {\n if (!value) {\n return null;\n }\n\n try {\n const url = new URL(value);\n\n return url.protocol === 'https:' ? url.href : null;\n } catch {\n return null;\n }\n}\n\n/** Mounted once by the Studio layout; renders the dialog `connectPlugin` opens for token and credentials plugins. */\nexport function PluginTokenDialogHost(): JSX.Element | null {\n const current = useSyncExternalStore(\n subscribe,\n () => request,\n () => null\n );\n\n if (!current) {\n return null;\n }\n\n // A new key per request resets the fields, so a secret never outlives its dialog.\n return current.kind === 'token' ? (\n <PluginTokenDialog key={current.id} request={current} />\n ) : (\n <PluginCredentialsDialog key={current.id} request={current} />\n );\n}\n\nfunction FieldError({ id, message }: { id: string; message: string | null }): JSX.Element | null {\n return message ? (\n <p className=\"fk:text-sm fk:text-destructive\" id={id}>\n {message}\n </p>\n ) : null;\n}\n\nfunction HelpLink({ href, label }: { href: string | null; label: string }): JSX.Element | null {\n const safeHref = httpsHref(href);\n\n return safeHref ? (\n <a\n className=\"fk:inline-flex fk:items-center fk:gap-1 fk:text-sm fk:text-muted-foreground fk:underline-offset-4 fk:hover:underline\"\n href={safeHref}\n rel=\"noreferrer\"\n target=\"_blank\"\n >\n {label}\n <ExternalLinkIcon className=\"fk:size-3.5\" />\n </a>\n ) : null;\n}\n\nfunction PluginCredentialsDialog({ request: current }: { request: CredentialsRequest }): JSX.Element {\n const { connect, name } = current.plugin;\n const formId = useId();\n const [method, setMethod] = useState<string | null>(connect.methods[0]?.key ?? null);\n const [values, setValues] = useState<{ [key: string]: string }>({});\n const [error, setError] = useState<{ field: string | null; message: string } | null>(null);\n const [saving, setSaving] = useState(false);\n const fields = credentialFormFields(connect, method);\n const selectedMethod = connect.methods.find((item) => item.key === method) ?? null;\n // Submitting surfaces which field is malformed; the button only waits for the required values.\n const ready = credentialFormComplete(fields, values);\n\n async function save(event: FormEvent): Promise<void> {\n event.preventDefault();\n\n if (saving) {\n return;\n }\n\n const problem = credentialFormError(fields, values);\n\n if (problem) {\n setError(problem);\n\n return;\n }\n\n setSaving(true);\n setError(null);\n\n try {\n await current.submit(\n method ?? undefined,\n Object.fromEntries(fields.map((field) => [field.key, values[field.key]?.trim() ?? '']).filter(([, value]) => value))\n );\n setValues({});\n current.settle(true);\n } catch (failure) {\n setError({ field: null, message: failure instanceof Error ? failure.message : `${name} could not be connected.` });\n } finally {\n setSaving(false);\n }\n }\n\n return (\n <Dialog\n open\n onOpenChange={(open) => {\n if (!open && !saving) {\n current.settle(false);\n }\n }}\n >\n <DialogContent>\n <form className=\"fk:flex fk:flex-col fk:gap-4\" onSubmit={(event) => void save(event)}>\n <DialogHeader>\n <DialogTitle>Connect {name}</DialogTitle>\n <DialogDescription>\n {connect.description} Flexkit checks the credentials with {name}, stores them encrypted and sends them\n only to Flexkit&apos;s own {name} server; the agent can use the tools but never sees them.\n </DialogDescription>\n </DialogHeader>\n {connect.methods.length > 1 ? (\n <div className=\"fk:space-y-1.5\" role=\"group\" aria-label=\"How to connect\">\n {connect.methods.map((item) => (\n <button\n aria-pressed={method === item.key}\n className={`fk:flex fk:w-full fk:flex-col fk:rounded-lg fk:border fk:px-3 fk:py-2 fk:text-left fk:corner-squircle ${\n method === item.key ? 'fk:border-primary fk:bg-primary/5' : 'fk:border-border fk:hover:bg-muted/60'\n }`}\n disabled={saving}\n key={item.key}\n onClick={() => {\n setMethod(item.key);\n setError(null);\n }}\n type=\"button\"\n >\n <span className=\"fk:text-sm fk:font-medium\">{item.label}</span>\n {item.description ? (\n <span className=\"fk:text-xs fk:text-muted-foreground\">{item.description}</span>\n ) : null}\n </button>\n ))}\n </div>\n ) : selectedMethod?.description ? (\n <p className=\"fk:text-sm fk:text-muted-foreground\">{selectedMethod.description}</p>\n ) : null}\n {fields.map((field, index) => {\n const inputId = `${formId}-${field.key}`;\n const fieldError = error?.field === field.key ? error.message : null;\n\n return (\n <div className=\"fk:flex fk:flex-col fk:gap-2\" key={field.key}>\n <label className=\"fk:text-sm fk:font-medium\" htmlFor={inputId}>\n {field.label}\n </label>\n <Input\n aria-describedby={fieldError ? `${inputId}-error` : field.help ? `${inputId}-help` : undefined}\n aria-invalid={fieldError ? true : undefined}\n autoComplete=\"off\"\n autoFocus={index === 0}\n disabled={saving}\n id={inputId}\n placeholder={field.placeholder ?? undefined}\n spellCheck={false}\n type={field.kind === 'secret' ? 'password' : 'text'}\n value={values[field.key] ?? ''}\n onChange={(event) => {\n setValues((previous) => ({ ...previous, [field.key]: event.target.value }));\n setError(null);\n }}\n />\n {field.help && !fieldError ? (\n <p className=\"fk:text-sm fk:text-muted-foreground\" id={`${inputId}-help`}>\n {field.help}\n </p>\n ) : null}\n <FieldError id={`${inputId}-error`} message={fieldError} />\n </div>\n );\n })}\n <FieldError id={`${formId}-error`} message={error?.field === null ? error.message : null} />\n <HelpLink href={connect.helpUrl} label={`How to set up ${name}`} />\n <DialogFooter>\n <Button disabled={saving} size=\"sm\" type=\"button\" variant=\"outline\" onClick={() => current.settle(false)}>\n Cancel\n </Button>\n <Button disabled={saving || !ready} size=\"sm\" type=\"submit\">\n {saving ? <LoaderCircle className=\"fk:size-4 fk:animate-spin\" /> : null}\n Connect\n </Button>\n </DialogFooter>\n </form>\n </DialogContent>\n </Dialog>\n );\n}\n\nfunction PluginTokenDialog({ request: current }: { request: TokenRequest }): JSX.Element {\n const { connect, name } = current.plugin;\n const inputId = useId();\n const [token, setToken] = useState('');\n const [error, setError] = useState<string | null>(null);\n const [saving, setSaving] = useState(false);\n\n async function save(event: FormEvent): Promise<void> {\n event.preventDefault();\n const value = token.trim();\n\n if (saving || !value) {\n return;\n }\n\n if (!matchesTokenPattern(value, connect.pattern)) {\n setError(`That does not look like a ${connect.tokenLabel}.`);\n\n return;\n }\n\n setSaving(true);\n setError(null);\n\n try {\n await current.submit(value);\n setToken('');\n current.settle(true);\n } catch (failure) {\n setError(failure instanceof Error ? failure.message : `${name} could not be connected.`);\n } finally {\n setSaving(false);\n }\n }\n\n return (\n <Dialog\n open\n onOpenChange={(open) => {\n if (!open && !saving) {\n current.settle(false);\n }\n }}\n >\n <DialogContent>\n <form className=\"fk:flex fk:flex-col fk:gap-4\" onSubmit={(event) => void save(event)}>\n <DialogHeader>\n <DialogTitle>Connect {name}</DialogTitle>\n <DialogDescription>\n Paste a {connect.tokenLabel}. Flexkit stores it encrypted and sends it only to {name}; the agent can use{' '}\n {name}&apos;s tools but never sees the token. Give it read access only, unless the agent should change\n things in {name}.\n </DialogDescription>\n </DialogHeader>\n <div className=\"fk:flex fk:flex-col fk:gap-2\">\n <label className=\"fk:text-sm fk:font-medium\" htmlFor={inputId}>\n {connect.tokenLabel}\n </label>\n <Input\n aria-describedby={error ? `${inputId}-error` : undefined}\n aria-invalid={error ? true : undefined}\n autoComplete=\"off\"\n autoFocus\n disabled={saving}\n id={inputId}\n placeholder={connect.placeholder ?? undefined}\n spellCheck={false}\n type=\"password\"\n value={token}\n onChange={(event) => {\n setToken(event.target.value);\n setError(null);\n }}\n />\n <FieldError id={`${inputId}-error`} message={error} />\n <HelpLink href={connect.helpUrl} label={`How to create a ${connect.tokenLabel}`} />\n </div>\n <DialogFooter>\n <Button disabled={saving} size=\"sm\" type=\"button\" variant=\"outline\" onClick={() => current.settle(false)}>\n Cancel\n </Button>\n <Button disabled={saving || !token.trim()} size=\"sm\" type=\"submit\">\n {saving ? <LoaderCircle className=\"fk:size-4 fk:animate-spin\" /> : null}\n Connect\n </Button>\n </DialogFooter>\n </form>\n </DialogContent>\n </Dialog>\n );\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import'./index.css';import {clsx}from'clsx';import {extendTailwindMerge}from'tailwind-merge';import {Slot}from'radix-ui';import {cva}from'class-variance-authority';import {jsx}from'react/jsx-runtime';var k=extendTailwindMerge({prefix:"fk"});function f(...e){return k(clsx(e))}var u=cva("fk:inline-flex fk:shrink-0 fk:items-center fk:justify-center fk:gap-1 fk:rounded-md fk:text-sm fk:font-medium fk:whitespace-nowrap fk:transition-all fk:outline-none fk:focus-visible:border-ring fk:focus-visible:ring-[3px] fk:focus-visible:ring-ring/50 fk:disabled:pointer-events-none fk:disabled:opacity-50 fk:aria-invalid:border-destructive fk:aria-invalid:ring-destructive/20 fk:dark:aria-invalid:ring-destructive/40 fk:[&_svg]:pointer-events-none fk:[&_svg]:shrink-0 fk:[&_svg:not([class*='size-'])]:size-4 fk:corner-squircle",{variants:{variant:{default:"fk:bg-primary fk:text-primary-foreground fk:hover:bg-primary/90",destructive:"fk:bg-destructive fk:text-white fk:hover:bg-destructive/90 fk:focus-visible:ring-destructive/20 fk:dark:bg-destructive/60 fk:dark:focus-visible:ring-destructive/40",outline:"fk:border fk:bg-background fk:shadow-xs fk:hover:bg-accent fk:hover:text-accent-foreground fk:dark:border-input",secondary:"fk:bg-secondary fk:text-secondary-foreground fk:hover:bg-secondary/80",ghost:"fk:hover:bg-accent fk:hover:text-accent-foreground fk:dark:hover:bg-accent/50",link:"fk:text-primary fk:underline-offset-4 fk:hover:underline"},size:{default:"fk:h-9 fk:px-4 fk:py-2 fk:has-[>svg]:px-3",xs:"fk:h-6 fk:rounded-md fk:px-2 fk:text-xs fk:has-[>svg]:px-1.5 fk:[&_svg:not([class*='size-'])]:size-3 fk:corner-squircle",sm:"fk:h-8 fk:rounded-md fk:px-3 fk:has-[>svg]:px-2.5 fk:corner-squircle",lg:"fk:h-10 fk:rounded-md fk:px-6 fk:has-[>svg]:px-4 fk:corner-squircle",icon:"fk:size-9","icon-xs":"fk:size-6 fk:rounded-md fk:[&_svg:not([class*='size-'])]:size-3 fk:corner-squircle","icon-sm":"fk:size-8","icon-lg":"fk:size-10"}},defaultVariants:{variant:"default",size:"default"}});function h({className:e,variant:r="default",size:t="default",asChild:i=false,...n}){let o=i?Slot.Root:"button";return jsx(o,{"data-slot":"button","data-variant":r,"data-size":t,className:f(u({variant:r,size:t,className:e})),...n})}export{f as a,u as b,h as c};//# sourceMappingURL=chunk-X3SHNHHM.js.map
2
+ //# sourceMappingURL=chunk-X3SHNHHM.js.map