@flexkit/studio 0.2.18 → 0.2.20
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.
- package/dist/activity-nav-button-V5DFHADL.js +2 -0
- package/dist/{activity-nav-button-7SVTTHBQ.js.map → activity-nav-button-V5DFHADL.js.map} +1 -1
- package/dist/chat-page-4G4XQ26P.js +4 -0
- package/dist/chat-page-4G4XQ26P.js.map +1 -0
- package/dist/chunk-2NXQF2F7.js +2 -0
- package/dist/chunk-2NXQF2F7.js.map +1 -0
- package/dist/chunk-2P2QV3K6.js +2 -0
- package/dist/chunk-2P2QV3K6.js.map +1 -0
- package/dist/chunk-445XKMAG.js +379 -0
- package/dist/chunk-445XKMAG.js.map +1 -0
- package/dist/{chunk-3C2EG3SI.js → chunk-54AXLGAK.js} +2 -2
- package/dist/{chunk-3C2EG3SI.js.map → chunk-54AXLGAK.js.map} +1 -1
- package/dist/chunk-A7XHA2P6.js +3 -0
- package/dist/chunk-A7XHA2P6.js.map +1 -0
- package/dist/chunk-B7QMGBK5.js +3 -0
- package/dist/chunk-B7QMGBK5.js.map +1 -0
- package/dist/chunk-BMO7JFAX.js +2 -0
- package/dist/chunk-BMO7JFAX.js.map +1 -0
- package/dist/{chunk-U5D3EDCY.js → chunk-BMX4URYN.js} +2 -2
- package/dist/{chunk-U5D3EDCY.js.map → chunk-BMX4URYN.js.map} +1 -1
- package/dist/chunk-BXN72PW2.js +2 -0
- package/dist/chunk-BXN72PW2.js.map +1 -0
- package/dist/chunk-DGIY4SKN.js +7 -0
- package/dist/chunk-DGIY4SKN.js.map +1 -0
- package/dist/chunk-DHVKE36X.js +3 -0
- package/dist/chunk-DHVKE36X.js.map +1 -0
- package/dist/{chunk-ROABFYCX.js → chunk-EMFHKTAV.js} +2 -2
- package/dist/{chunk-ROABFYCX.js.map → chunk-EMFHKTAV.js.map} +1 -1
- package/dist/chunk-ERDARDGB.js +2 -0
- package/dist/chunk-ERDARDGB.js.map +1 -0
- package/dist/{chunk-YVAUTJOK.js → chunk-F2DT6NRK.js} +2 -2
- package/dist/{chunk-YVAUTJOK.js.map → chunk-F2DT6NRK.js.map} +1 -1
- package/dist/{chunk-YUSNU6C5.js → chunk-HLHLBMLJ.js} +2 -2
- package/dist/{chunk-YUSNU6C5.js.map → chunk-HLHLBMLJ.js.map} +1 -1
- package/dist/{chunk-X5JOYGD7.js → chunk-JWBER5NX.js} +2 -2
- package/dist/{chunk-X5JOYGD7.js.map → chunk-JWBER5NX.js.map} +1 -1
- package/dist/chunk-LK67JOQA.js +4 -0
- package/dist/chunk-LK67JOQA.js.map +1 -0
- package/dist/chunk-ME55YNBF.js +30 -0
- package/dist/chunk-ME55YNBF.js.map +1 -0
- package/dist/chunk-MKK65RQB.js +8 -0
- package/dist/chunk-MKK65RQB.js.map +1 -0
- package/dist/chunk-NYSQU73M.js +7 -0
- package/dist/chunk-NYSQU73M.js.map +1 -0
- package/dist/chunk-RY6PECIT.js +2 -0
- package/dist/{chunk-KHVGPM7I.js.map → chunk-RY6PECIT.js.map} +1 -1
- package/dist/{chunk-ALCK2BJY.js → chunk-UOR437J2.js} +2 -2
- package/dist/{chunk-ALCK2BJY.js.map → chunk-UOR437J2.js.map} +1 -1
- package/dist/chunk-XMOSCJOI.js +2 -0
- package/dist/chunk-XMOSCJOI.js.map +1 -0
- package/dist/chunk-YDVO6XWD.js +2 -0
- package/dist/chunk-YDVO6XWD.js.map +1 -0
- package/dist/entry-XVLXKEQV.js +2 -0
- package/dist/entry-XVLXKEQV.js.map +1 -0
- package/dist/index.css +689 -249
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/dist/list-4OJMI4CB.js +3 -0
- package/dist/list-4OJMI4CB.js.map +1 -0
- package/dist/list-RABV2F3H.js +2 -0
- package/dist/{list-QMDBJ4TR.js.map → list-RABV2F3H.js.map} +1 -1
- package/dist/pages-7LWBCW2X.js +5 -0
- package/dist/{pages-W77Q4U2W.js.map → pages-7LWBCW2X.js.map} +1 -1
- package/dist/plugin-pages-PQWTH7P5.js +2 -0
- package/dist/{plugin-pages-R6JOJG7N.js.map → plugin-pages-PQWTH7P5.js.map} +1 -1
- package/dist/record-links-BFHPBOAL.js +2 -0
- package/dist/record-links-BFHPBOAL.js.map +1 -0
- package/dist/{root-Z3ACOWCY.js → root-BS6QCYLO.js} +3 -3
- package/dist/{root-Z3ACOWCY.js.map → root-BS6QCYLO.js.map} +1 -1
- package/dist/root-COI626G2.js +2 -0
- package/dist/root-COI626G2.js.map +1 -0
- package/dist/root-FTT4XDCE.js +23 -0
- package/dist/{root-NRHGA62D.js.map → root-FTT4XDCE.js.map} +1 -1
- package/dist/root-PDSTTPHO.js +2 -0
- package/dist/root-PDSTTPHO.js.map +1 -0
- package/dist/root-RXMRNU4M.js +2 -0
- package/dist/root-RXMRNU4M.js.map +1 -0
- package/dist/root-TZYOIXVG.js +2 -0
- package/dist/root-TZYOIXVG.js.map +1 -0
- package/dist/search-VPS2UHPQ.js +2 -0
- package/dist/{search-J3BCOUFX.js.map → search-VPS2UHPQ.js.map} +1 -1
- package/dist/skills-pages-G6JK7KKQ.js +2 -0
- package/dist/{skills-pages-KN2VDVVR.js.map → skills-pages-G6JK7KKQ.js.map} +1 -1
- package/dist/source-MNHZQD4T.js +2 -0
- package/dist/source-MNHZQD4T.js.map +1 -0
- package/dist/spec-renderer-3GAVSV52.js +2 -0
- package/dist/{spec-renderer-EX7SCFWH.js.map → spec-renderer-3GAVSV52.js.map} +1 -1
- package/dist/ui.d.ts +15 -5
- package/dist/ui.js +1 -1
- package/package.json +13 -6
- package/dist/activity-nav-button-7SVTTHBQ.js +0 -2
- package/dist/chat-page-YOQKLRHG.js +0 -4
- package/dist/chat-page-YOQKLRHG.js.map +0 -1
- package/dist/chunk-4X4ROJQL.js +0 -4
- package/dist/chunk-4X4ROJQL.js.map +0 -1
- package/dist/chunk-6Y2GBUTM.js +0 -8
- package/dist/chunk-6Y2GBUTM.js.map +0 -1
- package/dist/chunk-7QYC57EO.js +0 -384
- package/dist/chunk-7QYC57EO.js.map +0 -1
- package/dist/chunk-FR6PTSKU.js +0 -3
- package/dist/chunk-FR6PTSKU.js.map +0 -1
- package/dist/chunk-JVWYYQX5.js +0 -3
- package/dist/chunk-JVWYYQX5.js.map +0 -1
- package/dist/chunk-KHVGPM7I.js +0 -2
- package/dist/chunk-NLRSLQUT.js +0 -3
- package/dist/chunk-NLRSLQUT.js.map +0 -1
- package/dist/chunk-P6BZ4QP7.js +0 -2
- package/dist/chunk-P6BZ4QP7.js.map +0 -1
- package/dist/chunk-VLAK2VJK.js +0 -2
- package/dist/chunk-VLAK2VJK.js.map +0 -1
- package/dist/chunk-YCCFUGWJ.js +0 -7
- package/dist/chunk-YCCFUGWJ.js.map +0 -1
- package/dist/list-HYAFHLLI.js +0 -3
- package/dist/list-HYAFHLLI.js.map +0 -1
- package/dist/list-QMDBJ4TR.js +0 -2
- package/dist/pages-W77Q4U2W.js +0 -5
- package/dist/plugin-pages-R6JOJG7N.js +0 -2
- package/dist/root-FDZWRKNZ.js +0 -2
- package/dist/root-FDZWRKNZ.js.map +0 -1
- package/dist/root-MPY5JACF.js +0 -2
- package/dist/root-MPY5JACF.js.map +0 -1
- package/dist/root-NRHGA62D.js +0 -23
- package/dist/root-QAPXBSOQ.js +0 -2
- package/dist/root-QAPXBSOQ.js.map +0 -1
- package/dist/search-J3BCOUFX.js +0 -2
- package/dist/skills-pages-KN2VDVVR.js +0 -2
- package/dist/source-763I64NT.js +0 -2
- package/dist/source-763I64NT.js.map +0 -1
- package/dist/spec-renderer-EX7SCFWH.js +0 -2
package/dist/search-J3BCOUFX.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import'./index.css';import {a}from'./chunk-KHVGPM7I.js';import'./chunk-P6BZ4QP7.js';import'./chunk-JVWYYQX5.js';import'./chunk-2HYQVMP3.js';import'./chunk-5CVDMZUI.js';import {z,m,w,q,p,r,t,b as b$1}from'./chunk-32ZU4MLE.js';import {a as a$1,d,c,e,g}from'./chunk-HDOIOXMP.js';import'./chunk-U45E5X3H.js';import {b}from'./chunk-6NRQMG26.js';import {a as a$2}from'./chunk-O2QMYUPS.js';import {useState,useMemo,useRef}from'react';import {useDebounce}from'use-debounce';import {LoaderCircle,Search,X}from'lucide-react';import {Command}from'cmdk';import {useNavigate}from'react-router-dom';import {jsxs,jsx}from'react/jsx-runtime';var s="all",ne=200,oe=2,ae=8,le=25;function se(t){let n=t.replace(/([A-Z])/g," $1");return n.charAt(0).toUpperCase()+n.slice(1).trim()}function ie(t){return t.filter(n=>n.attributes.some(o=>o.searchable))}function fe(t,n){return n===s?t.map(o=>o.plural):t.filter(o=>o.plural===n).map(o=>o.plural)}function ce(t,n){return n===s?s:t.some(o=>o.plural===n)?n:s}function ue(t,n){let o=n.trim();return o.length<oe?null:{searchRequests:{searches:t.map(m=>({collection:m}))},commonParams:{q:o,limit:t.length>1?ae:le}}}function me(t){return t.menu?.label??se(t.plural)}function Ee({onSelect:t$1,searchPlaceholder:n="Search...",noResultsMsg:o="Nothing found",className:m$1,onSearchChange:S,projectId:G,schema:C}){let[V,l]=useState(false),[i,N]=useState(""),[U,X$1]=useState(s),f=useMemo(()=>ie(C),[C]),k=ce(f,U),I=useMemo(()=>fe(f,k),[f,k]),[d$1]=useDebounce(i,ne),w$1=useMemo(()=>ue(I,d$1),[I,d$1]),c$1=useRef(null),{results:p$1,isLoading:j}=a(G,w$1),h=j||d$1!==i,z$1=V&&w$1!==null&&(p$1.length>0||!h),H=useNavigate();function F(e){N(e),e.length>0&&l(true),e.length===0&&l(false),S&&S(e);}function J(e){X$1(e),i.length>0&&l(true);}function Q(){N(""),l(false),c$1.current&&(c$1.current.value="");let e=new URL(window.location.href);e.searchParams.has("id")&&(e.searchParams.delete("id"),H(e.pathname+e.search));}return jsxs(z,{children:[jsxs(a$1,{onValueChange:J,value:k,children:[jsx(d,{"aria-label":"Filter search by entity",className:"fk:w-36 fk:h-9 fk:py-1 fk:rounded-r-none fk:border-border fk:shadow-none fk:corner-squircle",children:jsx(c,{})}),jsxs(e,{children:[jsx(g,{value:s,children:"All"}),f.map(e=>jsx(g,{value:e.plural,children:me(e)},e.plural))]})]}),jsxs(m,{className:"fk:relative fk:overflow-visible fk:h-auto fk:justify-center fk:rounded-none fk:bg-transparent fk:corner-squircle",onBlur:()=>{setTimeout(()=>{l(false);},300);},onKeyDown:e=>{e.key==="Escape"&&(e.preventDefault(),l(false));},shouldFilter:false,children:[jsxs("div",{className:a$2("fk:flex fk:items-center fk:border-y fk:border-r fk:border-border fk:rounded-r-md fk:bg-background fk:pl-3 fk:pr-2 fk:h-9 fk:md:w-25 fk:lg:w-75 fk:corner-squircle","fk:outline-none fk:transition-[color,box-shadow] fk:has-[input:focus-visible]:border-ring fk:has-[input:focus-visible]:ring-[3px] fk:has-[input:focus-visible]:ring-ring/50"),children:[h?jsx(LoaderCircle,{className:"fk:mr-2 fk:h-4 fk:w-4 fk:shrink-0 fk:opacity-50 fk:animate-spin"}):jsx(Search,{className:"fk:mr-2 fk:h-4 fk:w-4 fk:shrink-0 fk:opacity-50"}),jsx(Command.Input,{className:a$2("fk:flex fk:h-9 fk:w-full fk:rounded-none fk:bg-transparent fk:py-1 fk:text-sm fk:outline-hidden fk:placeholder:text-muted-foreground fk:disabled:cursor-not-allowed fk:disabled:opacity-50 fk:corner-squircle",m$1),placeholder:n,onMouseDown:()=>{(c$1.current?.value.length??0)>0&&l(true);},onValueChange:F,ref:c$1,value:i}),i&&jsx(b,{"aria-label":"Clear search",className:"fk:flex fk:items-center fk:justify-center fk:ml-2 fk:h-6 fk:w-6 fk:text-muted-foreground fk:hover:text-foreground fk:hover:bg-foreground/10 fk:cursor-pointer fk:rounded-full fk:bg-transparent fk:corner-squircle",onClick:Q,type:"button",children:jsx(X,{className:"fk:h-4 fk:w-4"})})]}),jsx("div",{className:"fk:relative fk:max-w-150",children:jsx("div",{className:a$2("fk:mt-1 fk:animate-in fk:fade-in-0 fk:zoom-in-95 fk:absolute fk:top-0 fk:z-50 fk:w-full fk:rounded-md fk:bg-popover fk:outline-hidden fk:drop-shadow-md fk:border fk:border-border fk:corner-squircle",z$1?"fk:block":"fk:hidden"),children:jsxs(w,{className:"fk:max-h-55 fk:overflow-auto",children:[!h&&jsx(q,{children:o}),jsx(p,{children:jsxs(r,{children:[p$1.length>0&&jsx(t,{"aria-hidden":"true",className:"fk:hidden!",value:"-"}),p$1.map(e=>jsxs(t,{className:"fk:flex",value:e._id,onSelect:K=>{t$1({entityName:e._entityName,entityNamePlural:e._entityNamePlural,entityId:K});},children:[jsx("span",{className:"fk:basis-full",children:e[Object.keys(e)[3]]}),jsx(b$1,{className:"fk:py-px fk:text-[0.6875rem] fk:leading-3 fk:bg-teal-400",children:e._entityName})]},e._id))]})})]})})})]})]})}export{Ee as Search};//# sourceMappingURL=search-J3BCOUFX.js.map
|
|
2
|
-
//# sourceMappingURL=search-J3BCOUFX.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import'./index.css';import {b as b$1}from'./chunk-YVAUTJOK.js';import'./chunk-ALCK2BJY.js';import {f,g,d as d$1}from'./chunk-NLRSLQUT.js';import {b}from'./chunk-ZZRA4567.js';import {f as f$1}from'./chunk-JVWYYQX5.js';import {g as g$1}from'./chunk-2HYQVMP3.js';import'./chunk-5CVDMZUI.js';import {Rc,Tc,s,ma,oa,N,e as e$2,ga,ha,ia}from'./chunk-YCCFUGWJ.js';import {v,w,b as b$4}from'./chunk-32ZU4MLE.js';import {a,d,c,e,g as g$2}from'./chunk-HDOIOXMP.js';import {t}from'./chunk-SZEGGBOC.js';import'./chunk-U45E5X3H.js';import {b as b$3,c as c$1,e as e$1}from'./chunk-USNXQOMJ.js';import {b as b$2}from'./chunk-6NRQMG26.js';import'./chunk-O2QMYUPS.js';import {useState,useRef,useMemo,useEffect}from'react';import {Plus,LoaderCircle,Trash2,GraduationCapIcon,ArrowLeft,Info,PenLine,Eye}from'lucide-react';import Pt from'react-markdown';import {useNavigate,Link,useParams}from'react-router-dom';import ve from'swr';import At from'swr/infinite';import {history,defaultKeymap,historyKeymap,indentWithTab}from'@codemirror/commands';import {markdown}from'@codemirror/lang-markdown';import {languages}from'@codemirror/language-data';import {foldGutter,indentOnInput,bracketMatching,foldKeymap}from'@codemirror/language';import {highlightSelectionMatches,searchKeymap}from'@codemirror/search';import {Compartment,EditorState,Prec}from'@codemirror/state';import {EditorView,lineNumbers,highlightActiveLineGutter,highlightSpecialChars,drawSelection,dropCursor,highlightActiveLine,keymap,placeholder}from'@codemirror/view';import {tags}from'@lezer/highlight';import {createTheme}from'@uiw/codemirror-themes';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var je="var(--font-geist-mono), ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",Q="#212121",Y="#fafafa";function ze(t,i,o){return [t,EditorView.theme({"&":{backgroundColor:i},".cm-scroller":{backgroundColor:i},".cm-gutters":{backgroundColor:o}})]}var ce=ze(createTheme({settings:{background:Q,caret:"#f8f8f0",fontFamily:je,foreground:"#f8f8f2",gutterBackground:Q,gutterBorder:"transparent",gutterForeground:"#6d8a88",lineHighlight:"rgba(255, 255, 255, 0.1)",selection:"rgba(255, 255, 255, 0.1)",selectionMatch:"rgba(255, 255, 255, 0.2)"},styles:[{color:"#6272a4",tag:[tags.comment,tags.quote,tags.strikethrough]},{color:"#6272a4",tag:[tags.meta,tags.processingInstruction]},{color:"#f1fa8c",tag:tags.string},{color:"#f91f6f",tag:[tags.atom,tags.bool,tags.number,tags.heading]},{color:"#ff79c6",tag:[tags.keyword,tags.operator,tags.tagName]},{color:"#8be9fd",tag:[tags.typeName,tags.link,tags.url]},{color:"#009fb8",tag:[tags.className,tags.attributeName,tags.monospace]},{color:"#66d9ef",tag:[tags.propertyName,tags.function(tags.propertyName)]},{color:"#009fb8",tag:[tags.definition(tags.variableName),tags.function(tags.variableName)]},{color:"#0072f5",tag:[tags.strong,tags.emphasis]},{color:"#ff5555",tag:tags.invalid}],theme:"dark"}),Q,Q),de=ze(createTheme({settings:{background:Y,caret:"#526fff",fontFamily:je,foreground:"#383a42",gutterBackground:Y,gutterBorder:"transparent",gutterForeground:"#9d9d9f",lineHighlight:"#383a420c",selection:"#e5e5e6",selectionMatch:"#e5e5e6"},styles:[{color:"#a0a1a7",tag:[tags.comment,tags.quote,tags.strikethrough]},{color:"#a0a1a7",tag:[tags.meta,tags.processingInstruction]},{color:"#50a14f",tag:tags.string},{color:"#986801",tag:[tags.attributeName]},{color:"#a626a4",tag:tags.keyword},{color:"#0072f5",tag:[tags.operator,tags.strong,tags.emphasis]},{color:"#f91f6f",tag:[tags.atom,tags.bool,tags.number,tags.heading]},{color:"#c18401",tag:[tags.typeName,tags.className]},{color:"#009fb8",tag:[tags.tagName,tags.propertyName,tags.monospace]},{color:"#4078f2",tag:[tags.link,tags.url,tags.function(tags.variableName),tags.definition(tags.variableName)]},{color:"#f91f6f",tag:tags.invalid}],theme:"light"}),Y,Y);function me(){let t=document.documentElement;return t.getAttribute("data-theme")==="dark"||t.classList.contains("dark")||t.style.colorScheme==="dark"}var xt=EditorView.theme({"&":{fontSize:"13px",height:"100%",maxHeight:"100%",maxWidth:"100%",minHeight:"0",minWidth:"0",width:"100%"},"&.cm-focused":{outline:"none"},".cm-scroller":{height:"100%",lineHeight:"1.6",minHeight:"0",minWidth:"0",overflow:"auto",width:"100%"},".cm-content":{fontSize:"13px",fontStyle:"normal",fontWeight:"400",minWidth:"0 !important",padding:"12px 0"},".cm-line, .cm-line span":{fontSize:"inherit",fontStyle:"inherit",fontWeight:"inherit",lineHeight:"inherit"},".cm-gutters":{borderRight:"1px solid transparent"},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none"}});function ue(t){return [t?ce:de,xt]}function He(t){return [EditorState.readOnly.of(t),EditorView.editable.of(!t)]}function Oe(t){let i={"aria-multiline":"true",role:"textbox"};return t.ariaLabel&&(i["aria-label"]=t.ariaLabel),t.ariaLabelledBy&&(i["aria-labelledby"]=t.ariaLabelledBy),t.ariaDescribedBy&&(i["aria-describedby"]=t.ariaDescribedBy),t.ariaInvalid&&(i["aria-invalid"]="true"),t.readOnly&&(i["aria-readonly"]="true"),i}function Xe({ariaDescribedBy:t,ariaInvalid:i,ariaLabel:o,ariaLabelledBy:l,className:f,onBlur:d,onChange:k,onSave:u,placeholder:m,readOnly:c=false,value:p}){let h=useRef(null),y=useRef(null),L=useRef(new Compartment),P=useRef(new Compartment),N=useRef(new Compartment),C=useRef(d),w=useRef(k),I=useRef(u),v=useRef(p);return C.current=d,w.current=k,I.current=u,v.current=p,useEffect(()=>{let s=h.current;if(!s)return;let g=new EditorView({parent:s,state:EditorState.create({doc:v.current,extensions:[lineNumbers(),highlightActiveLineGutter(),highlightSpecialChars(),history(),foldGutter(),drawSelection(),dropCursor(),EditorState.allowMultipleSelections.of(true),indentOnInput(),bracketMatching(),highlightActiveLine(),highlightSelectionMatches(),EditorView.lineWrapping,markdown({codeLanguages:languages}),keymap.of([...defaultKeymap,...historyKeymap,...searchKeymap,...foldKeymap,indentWithTab]),Prec.highest(keymap.of([{key:"Mod-s",run:()=>(I.current?.(),true)}])),EditorView.updateListener.of(B=>{B.docChanged&&w.current?.(B.state.doc.toString()),B.focusChanged&&!B.view.hasFocus&&C.current?.();}),L.current.of(ue(me())),P.current.of(He(c)),N.current.of(EditorView.contentAttributes.of(Oe({ariaDescribedBy:t,ariaInvalid:i,ariaLabel:o,ariaLabelledBy:l,readOnly:c}))),...m?[placeholder(m)]:[]]})});y.current=g;let K=new ResizeObserver(()=>{g.requestMeasure();});K.observe(s);let G=new MutationObserver(()=>{g.dispatch({effects:L.current.reconfigure(ue(me()))});});return G.observe(document.documentElement,{attributeFilter:["class","data-theme","style"],attributes:true}),()=>{K.disconnect(),G.disconnect(),g.destroy(),y.current=null;}},[]),useEffect(()=>{let s=y.current;s&&s.dispatch({effects:L.current.reconfigure(ue(me()))});},[de,ce]),useEffect(()=>{let s=y.current;if(!s)return;let g=s.state.doc.toString();g!==p&&s.dispatch({changes:{from:0,to:g.length,insert:p}});},[p]),useEffect(()=>{let s=y.current;s&&s.dispatch({effects:[P.current.reconfigure(He(c)),N.current.reconfigure(EditorView.contentAttributes.of(Oe({ariaDescribedBy:t,ariaInvalid:i,ariaLabel:o,ariaLabelledBy:l,readOnly:c})))]});},[t,i,o,l,c]),jsx("div",{className:f??"fk:h-full fk:min-h-0 fk:min-w-0 fk:w-full fk:overflow-hidden",ref:h})}var Je=25,Bt=[{descriptionWidth:"fk:w-44",id:"skill-a",nameWidth:"fk:w-28"},{descriptionWidth:"fk:w-52",id:"skill-b",nameWidth:"fk:w-20"},{descriptionWidth:"fk:w-40",id:"skill-c",nameWidth:"fk:w-36"},{descriptionWidth:"fk:w-48",id:"skill-d",nameWidth:"fk:w-24"},{descriptionWidth:"fk:w-36",id:"skill-e",nameWidth:"fk:w-32"},{descriptionWidth:"fk:w-56",id:"skill-f",nameWidth:"fk:w-16"}];function Wt(){return jsxs("div",{"aria-busy":"true",className:"fk:grid fk:grid-cols-1 fk:gap-x-16 fk:gap-y-1 fk:lg:grid-cols-2",children:[jsx("span",{className:"fk:sr-only",children:"Loading skills"}),Bt.map(t$1=>jsxs("div",{className:"fk:-mx-3 fk:flex fk:min-w-0 fk:items-center fk:gap-3 fk:px-3 fk:py-2",children:[jsx(t,{className:"fk:size-10 fk:shrink-0 fk:rounded-lg"}),jsxs("span",{className:"fk:flex fk:min-w-0 fk:flex-1 fk:flex-col fk:gap-1.5",children:[jsx(t,{className:`fk:h-4 ${t$1.nameWidth}`}),jsx(t,{className:`fk:h-4 ${t$1.descriptionWidth}`})]})]},t$1.id))]})}var Rt={code({children:t,className:i,node:o,...l}){return typeof i=="string"&&i.split(" ").some(d=>d.startsWith("language-"))?jsx("code",{className:i,...l,children:t}):jsx("code",{className:"fk:rounded fk:bg-muted fk:px-1.5 fk:py-0.5 fk:font-mono fk:text-[0.875em] fk:font-medium fk:before:content-none fk:after:content-none fk:corner-squircle",...l,children:t})}};function be(){let{currentProjectId:t}=f$1();return {api:useMemo(()=>t?d$1(t):null,[t]),projectId:t}}function ie({children:t}){return jsx("div",{className:"fk:rounded-md fk:border fk:border-dashed fk:p-8 fk:text-center fk:text-sm fk:text-muted-foreground fk:corner-squircle",children:t})}function jt({onVisible:t}){let i=useRef(null),o=useRef(t);return o.current=t,useEffect(()=>{let l=i.current;if(!l)return;let f=new IntersectionObserver(d=>{d.some(k=>k.isIntersecting)&&o.current();});return f.observe(l),()=>{f.disconnect();}},[]),jsx("div",{"aria-hidden":true,className:"fk:h-px",ref:i})}function zt(t,i){return t.visibility==="space"?(t.spaceId?i.get(t.spaceId):void 0)??"Space":t.visibility==="personal"?"Personal":"Project"}function Dt({skill:t}){return t.logoUrl?jsx("img",{alt:"",className:"fk:size-10 fk:shrink-0 fk:rounded-lg fk:corner-squircle",src:t.logoUrl}):jsx("span",{className:"fk:flex fk:size-10 fk:shrink-0 fk:items-center fk:justify-center fk:rounded-lg fk:bg-muted fk:text-muted-foreground fk:corner-squircle",children:jsx(GraduationCapIcon,{className:"fk:size-5"})})}function hi(){let{api:t,projectId:i}=be(),o=useNavigate(),[l,f$1]=useState(""),d=b(),k=l.trim().length>0,u=(s,g$1)=>!i||g$1&&!g$1.hasMore?null:g(i).skills({limit:Je,offset:s*Je,search:l.trim()||void 0}),{data:m,isLoading:c,setSize:p,size:h}=At(u,f),y=m?.flatMap(s=>s.skills)??[],P=m?.[m.length-1]?.hasMore??false,N=m!==void 0&&h>m.length,C=c&&y.length===0;if(!i||!t)return jsx(ie,{children:"Select a project to view skills."});function w(){p(s=>s+1);}let I="No skills yet.";k&&(I="No skills match your search.");let v=jsx("div",{className:"fk:grid fk:grid-cols-1 fk:gap-x-16 fk:gap-y-1 fk:lg:grid-cols-2",children:y.map(s=>jsxs("button",{type:"button",onClick:()=>o(s.id),className:"fk:-mx-3 fk:flex fk:min-w-0 fk:items-center fk:gap-3 fk:rounded-lg fk:px-3 fk:py-2 fk:text-left fk:transition-colors fk:hover:bg-accent fk:focus-visible:bg-accent fk:focus-visible:outline-none fk:corner-squircle",children:[jsx(Dt,{skill:s}),jsxs("span",{className:"fk:min-w-0 fk:flex-1",children:[jsx("span",{className:"fk:block fk:truncate fk:text-sm fk:font-medium",children:s.name}),jsx("span",{className:"fk:block fk:truncate fk:text-sm fk:text-muted-foreground",children:s.description})]})]},s.id))});return C?v=jsx(Wt,{}):y.length===0&&(v=jsx(Rc,{children:jsx(Tc,{children:I})})),jsxs("main",{className:"fk:flex fk:min-h-0 fk:flex-1 fk:flex-col",children:[jsx(b$1,{}),jsx("div",{className:"fk:min-h-0 fk:flex-1 fk:overflow-auto",children:jsxs("div",{className:"fk:mx-auto fk:flex fk:w-full fk:max-w-4xl fk:flex-col fk:gap-8 fk:py-6 fk:pl-4 fk:pr-6",children:[jsxs("div",{children:[jsx("h2",{className:"fk:text-2xl fk:font-semibold",children:"Skills for your agents"}),jsx("p",{className:"fk:mt-2 fk:text-muted-foreground",children:"Reusable Markdown instructions that agents load when relevant, or always when attached to an automation."})]}),jsxs("div",{className:"fk:flex fk:flex-wrap fk:items-center fk:gap-3",children:[jsx(s,{"aria-label":"Search skills",className:"fk:w-full fk:max-w-xs",placeholder:"Search skills\u2026",value:l,onChange:s=>{p(1),f$1(s.target.value);}}),d?jsx(b$2,{asChild:true,className:"fk:ml-auto",size:"sm",children:jsxs(Link,{to:"new",children:[jsx(Plus,{}),"New Skill"]})}):jsx(ma,{disabled:true,children:jsxs(b$2,{className:"fk:ml-auto",disabled:true,size:"sm",children:[jsx(Plus,{}),"New Skill"]})})]}),v,P&&!N?jsx(jt,{onVisible:w}):null,N?jsxs("div",{className:"fk:flex fk:items-center fk:justify-center fk:gap-2 fk:py-4 fk:text-sm fk:text-muted-foreground",children:[jsx(LoaderCircle,{className:"fk:size-4 fk:animate-spin"}),jsx("span",{children:"Loading more skills..."})]}):null]})})]})}function te({className:t,id:i,message:o}){return jsx("p",{className:`fk:text-sm fk:text-destructive ${t??""}`,id:i,children:o})}function D({children:t,hint:i,htmlFor:o,id:l}){return jsxs("div",{className:"fk:mb-1.5 fk:pl-2.5 fk:flex fk:items-center fk:gap-1",children:[jsx(e$2,{htmlFor:o,id:l,children:t}),jsxs(b$3,{children:[jsx(c$1,{asChild:true,children:jsx("button",{"aria-label":`About ${t.toLowerCase()}`,className:"fk:rounded-sm fk:text-muted-foreground hover:fk:text-foreground fk:corner-squircle",type:"button",children:jsx(Info,{className:"fk:size-3.5"})})}),jsx(e$1,{className:"fk:max-w-xs",children:i})]})]})}function Se({actions:t,title:i}){return jsxs(Fragment,{children:[jsxs("div",{className:"fk:flex fk:shrink-0 fk:items-center fk:gap-2 fk:pr-4",children:[jsxs(b$3,{children:[jsx(c$1,{asChild:true,children:jsx(N,{className:"fk:-ml-1 fk:h-4 fk:w-4"})}),jsx(e$1,{children:"Toggle Sidebar"})]}),jsx(v,{orientation:"vertical",className:"fk:h-4"}),jsx("h1",{className:"fk:min-w-0 fk:flex-1 fk:truncate fk:text-lg fk:font-semibold fk:leading-none fk:tracking-tight",children:i}),t]}),jsx(b$2,{asChild:true,className:"fk:shrink-0 fk:w-fit",size:"sm",variant:"ghost",children:jsxs(Link,{relative:"path",to:"..",children:[jsx(ArrowLeft,{className:"fk:mr-2 fk:size-4"}),"Skills"]})})]})}function Ht(){return jsxs("div",{"aria-busy":"true",className:"fk:flex fk:h-full fk:min-h-0 fk:min-w-0 fk:flex-col fk:gap-3 fk:overflow-hidden fk:pb-3",children:[jsx("span",{className:"fk:sr-only",children:"Loading skill"}),jsx(Se,{actions:jsx(t,{className:"fk:h-8 fk:w-24"}),title:jsx(t,{className:"fk:h-5 fk:w-40"})}),jsxs("div",{className:"fk:m-auto fk:flex fk:min-h-0 fk:w-full fk:max-w-6xl fk:flex-1 fk:flex-col fk:gap-8 fk:px-6",children:[jsxs("div",{className:"fk:grid fk:shrink-0 fk:gap-3 fk:lg:grid-cols-[minmax(0,1fr)_minmax(0,1.6fr)_auto]",children:[["name","description"].map(t$1=>jsxs("div",{className:"fk:flex fk:flex-col fk:gap-2",children:[jsx(t,{className:"fk:h-4 fk:w-20"}),jsx(t,{className:"fk:h-9 fk:w-full"})]},t$1)),jsxs("div",{className:"fk:flex fk:flex-col fk:gap-2",children:[jsx(t,{className:"fk:h-4 fk:w-20"}),jsx(t,{className:"fk:h-9 fk:w-32"})]})]}),jsxs("div",{className:"fk:flex fk:min-h-0 fk:flex-1 fk:flex-col fk:gap-1.5",children:[jsx(t,{className:"fk:h-4 fk:w-16"}),jsx(t,{className:"fk:min-h-48 fk:flex-1 fk:rounded-md"})]})]})]})}function Ke({content:t,onBlur:i,onChange:o,onSave:l,readOnly:f=false,showContentError:d,validationMessage:k}){let[u,m]=useState("write"),c=t.length>5e4,p;return t.trim()?p=jsx(Pt,{components:Rt,children:t}):p=jsx("p",{className:"fk:text-muted-foreground",children:"Nothing to preview."}),jsxs("div",{className:"fk:flex fk:min-h-0 fk:min-w-0 fk:flex-1 fk:flex-col fk:gap-1.5",children:[jsxs("div",{className:"fk:pl-3.25 fk:flex fk:shrink-0 fk:items-center fk:gap-1",children:[jsx(e$2,{htmlFor:"skill-content",id:"skill-content-label",children:"Content"}),jsxs(b$3,{children:[jsx(c$1,{asChild:true,children:jsx("button",{"aria-label":"About skill content",className:"fk:rounded-sm fk:text-muted-foreground hover:fk:text-foreground fk:corner-squircle",type:"button",children:jsx(Info,{className:"fk:size-3.5"})})}),jsx(e$1,{className:"fk:max-w-sm",children:"The skill itself, in Markdown. Write it like instructions for a capable colleague: procedures, rules, examples, and edge cases. Attached skills are always loaded; other visible skills are loaded on demand."})]})]}),jsxs("div",{className:`fk:flex fk:min-h-0 fk:min-w-0 fk:flex-1 fk:flex-col fk:ml-0.75 fk:overflow-hidden fk:rounded-md fk:border ${d?"fk:border-destructive":""} fk:corner-squircle`,children:[jsxs("div",{className:"fk:flex fk:shrink-0 fk:items-center fk:justify-between fk:gap-2 fk:border-b fk:px-2.5 fk:py-1",children:[jsx(ga,{value:u,onValueChange:h=>{m(h==="preview"?"preview":"write");},children:jsxs(ha,{children:[jsxs(b$3,{children:[jsx(c$1,{asChild:true,children:jsx("span",{className:"fk:inline-flex",children:jsx(ia,{"aria-label":"Write",className:"fk:px-2.5",value:"write",children:jsx(PenLine,{className:"fk:size-3.5"})})})}),jsx(e$1,{children:"Write"})]}),jsxs(b$3,{children:[jsx(c$1,{asChild:true,children:jsx("span",{className:"fk:inline-flex",children:jsx(ia,{"aria-label":"Preview",className:"fk:px-2.5",value:"preview",children:jsx(Eye,{className:"fk:size-3.5"})})})}),jsx(e$1,{children:"Preview"})]})]})}),jsxs("span",{className:c?"fk:text-xs fk:text-destructive":"fk:text-xs fk:text-muted-foreground",children:[t.length.toLocaleString()," / ",5e4.toLocaleString()]})]}),jsx("div",{className:"fk:min-h-0 fk:min-w-0 fk:flex-1 fk:overflow-hidden",hidden:u!=="write",children:jsx(Xe,{ariaDescribedBy:d?"skill-content-error":void 0,ariaInvalid:d,ariaLabelledBy:"skill-content-label",className:"fk:h-full fk:min-h-0 fk:min-w-0 fk:w-full fk:overflow-hidden",readOnly:f,value:t,onBlur:i,onChange:o,onSave:l})}),u==="preview"?jsx(w,{className:"fk:min-h-0 fk:flex-1",children:jsx("div",{className:"fk:prose fk:prose-sm fk:dark:prose-invert fk:max-w-none fk:px-4 fk:py-3",children:p})}):null,d&&k?jsx(te,{className:"fk:border-t fk:px-3 fk:py-2",id:"skill-content-error",message:k}):null]})]})}function Ge({api:t,mode:i,onSaved:o,projectId:l,skill:f$1}){let[d$1,k]=useState(f$1?.name??""),[u,m]=useState(f$1?.description??""),[c$1,p]=useState(f$1?.content??""),[h,y]=useState(f$1?.visibility??"project"),[L,P]=useState(f$1?.spaceId??null),[N,C]=useState(false),w=useRef(false),[I,v]=useState(""),[s$1,g$3]=useState({content:false,description:false,name:false}),K=useNavigate(),{data:G}=ve(g(l).spaces,f),[,B]=g$1(),H=b(),$e=B.user?.spaces??[],xe=(G?.spaces??[]).filter(a=>$e.includes(a.code)),ne="";c$1.trim()?c$1.length>5e4&&(ne=`Content must be at most ${String(5e4)} characters`):ne="Content is required";let b$1={content:ne,description:u.trim()?"":"Description is required",name:d$1.trim()?"":"Name is required",space:h==="space"&&!L?"Select a space":""},ae=!b$1.content&&!b$1.description&&!b$1.name&&!b$1.space,$=s$1.name&&!!b$1.name,U=s$1.description&&!!b$1.description,Ue=s$1.content&&!!b$1.content,Ze=i==="create"?"New Skill":f$1?.name??"Skill",se="Update skill";N?se="Saving...":i==="create"&&(se="Create skill");async function ye(){if(!H||w.current)return;if(!ae){g$3({content:true,description:true,name:true});return}w.current=true,C(true),v("");let a={content:c$1,description:u,name:d$1,spaceId:h==="space"?L:null,visibility:h};try{let M=i==="create"||!f$1?await t.createSkill(a):await t.updateSkill(f$1.id,a);if(!M.success){v(Array.isArray(M.errorMessage)?M.errorMessage.join(", "):M.errorMessage);return}oa.success(i==="create"||!f$1?"Skill created.":"Skill saved."),o(M.skill);}catch(M){v(M instanceof Error?M.message:"Failed to save skill.");}finally{w.current=false,C(false);}}async function Qe(a){a.preventDefault(),await ye();}async function Ye(){if(!(!f$1||!H||w.current)){w.current=true,C(true),v("");try{let a=await t.deleteSkill(f$1.id);if(!a.success){v(Array.isArray(a.errorMessage)?a.errorMessage.join(", "):a.errorMessage);return}K("..",{relative:"path"});}catch(a){v(a instanceof Error?a.message:"Failed to delete skill.");}finally{w.current=false,C(false);}}}return jsxs("div",{className:"fk:flex fk:h-full fk:min-h-0 fk:min-w-0 fk:flex-col fk:gap-3 fk:pb-3",children:[jsx(Se,{actions:jsxs("div",{className:"fk:flex fk:items-center fk:gap-3",children:[ae?null:jsx("span",{className:"fk:text-xs fk:text-muted-foreground",children:"Complete the required fields to save"}),i==="edit"&&f$1?jsxs(b$2,{disabled:N||!H,size:"sm",type:"button",variant:"outline",onClick:()=>{Ye();},children:[jsx(Trash2,{}),"Delete"]}):null,jsx(ma,{disabled:!H,children:jsx(b$2,{disabled:N||!ae||!H,form:"skill-editor-form",size:"sm",type:"submit",children:se})})]}),title:Ze}),I?jsx("div",{className:"fk:shrink-0 fk:rounded-md fk:border fk:border-destructive/30 fk:bg-destructive/5 fk:p-3 fk:text-sm fk:text-destructive fk:corner-squircle",children:I}):null,jsxs("form",{className:"fk:flex fk:min-h-0 fk:min-w-0 fk:flex-1 fk:flex-col fk:gap-6 fk:w-full fk:max-w-6xl fk:m-auto fk:gap-8 fk:px-4",id:"skill-editor-form",onSubmit:a=>{Qe(a);},children:[jsxs("div",{className:"fk:grid fk:min-w-0 fk:shrink-0 fk:gap-3 fk:px-0.75 fk:lg:grid-cols-[minmax(0,1fr)_minmax(0,1.6fr)_auto]",children:[jsxs("div",{children:[jsx(D,{hint:"Identifying label for this skill",htmlFor:"skill-name",children:"Name"}),jsx(s,{"aria-describedby":$?"skill-name-error":void 0,"aria-invalid":$,className:$?"fk:border-destructive focus-visible:fk:ring-destructive":"",id:"skill-name",value:d$1,onBlur:()=>g$3(a=>({...a,name:true})),onChange:a=>k(a.target.value)}),$?jsx(te,{id:"skill-name-error",message:b$1.name}):null]}),jsxs("div",{children:[jsx(D,{hint:"One or two sentences describing when to use this skill. Agents rely on it to decide whether the skill applies to their current task.",htmlFor:"skill-description",children:"Description"}),jsx(s,{"aria-describedby":U?"skill-description-error":void 0,"aria-invalid":U,className:U?"fk:border-destructive focus-visible:fk:ring-destructive":"",id:"skill-description",placeholder:"e.g. Rules for writing product descriptions in our brand voice",value:u,onBlur:()=>g$3(a=>({...a,description:true})),onChange:a=>m(a.target.value)}),U?jsx(te,{id:"skill-description-error",message:b$1.description}):null]}),jsxs("div",{children:[jsx(D,{hint:"Who can see and use this skill. Space skills are only visible to members of the selected space and only usable by automations in that space; personal skills are private to you.",htmlFor:"skill-visibility",children:"Visibility"}),jsxs("div",{className:"fk:flex fk:items-center fk:gap-2",children:[jsxs(a,{value:h,onValueChange:a=>{y(a==="space"||a==="personal"?a:"project"),a!=="space"&&P(null);},children:[jsx(d,{"aria-label":"Visibility",className:"fk:w-fit fk:min-w-26",id:"skill-visibility",children:jsx(c,{})}),jsxs(e,{align:"start",children:[jsx(g$2,{value:"project",children:"Project"}),jsx(g$2,{disabled:xe.length===0,value:"space",children:"Space"}),jsx(g$2,{value:"personal",children:"Personal"})]})]}),h==="space"?jsxs(a,{value:L??"",onValueChange:a=>{P(a||null);},children:[jsx(d,{"aria-label":"Space",className:"fk:w-fit fk:min-w-34",children:jsx(c,{placeholder:"Select a space"})}),jsx(e,{align:"start",children:xe.map(a=>jsx(g$2,{value:a.id,children:a.label},a.id))})]}):null]}),h==="space"&&b$1.space?jsx(te,{message:b$1.space}):null]})]}),jsx(Ke,{content:c$1,showContentError:Ue,validationMessage:b$1.content,onBlur:()=>g$3(a=>({...a,content:true})),onChange:p,onSave:()=>{ye();}})]})]})}function Ot({projectId:t,skill:i,spaceLabelById:o}){let l=b(),f=useNavigate(),[d$1,k]=useState(false),[u,m]=useState("");async function c$1(){k(true),m("");let p;try{p=await fetch(`/api/flexkit/${t}/skills/${i.id}/fork`,{method:"POST",credentials:"include"});}catch{m("Unable to create a copy. Try again."),k(false);return}if(k(false),!p.ok){m("Unable to create a copy. Check your permissions.");return}f("..",{relative:"path"});}return jsxs("div",{className:"fk:flex fk:h-full fk:min-h-0 fk:min-w-0 fk:flex-col fk:gap-3 fk:pb-3",children:[jsx(Se,{actions:jsxs("div",{className:"fk:flex fk:items-center fk:gap-2",children:[jsx(b$4,{variant:"secondary",children:i.source==="plugin"?"Plugin":"Code"}),i.source==="plugin"&&jsx(b$2,{type:"button",disabled:d$1||!l,onClick:()=>{c$1();},size:"sm",children:"Edit a copy"})]}),title:i.name}),jsxs("div",{className:"fk:flex fk:flex-col fk:h-full fk:px-4 fk:gap-3 fk:max-w-6xl fk:m-auto",children:[jsxs("div",{className:"fk:shrink-0 fk:rounded-md fk:border fk:bg-muted/30 fk:px-3 fk:py-2 fk:corner-squircle",children:[jsx("p",{className:"fk:text-sm fk:font-medium",children:"Version-controlled skill"}),jsx("p",{className:"fk:text-sm fk:text-muted-foreground",children:i.source==="plugin"?"This skill is managed by its plugin. Edit a copy to create a personal Studio skill.":"Edit this skill in your repository and re-sync it from the Custom Tools settings."})]}),jsxs("div",{className:"fk:grid fk:min-w-0 fk:shrink-0 fk:gap-3 fk:lg:grid-cols-[minmax(0,1fr)_minmax(0,1.6fr)_auto]",children:[jsxs("div",{children:[jsx(D,{hint:"Identifying label for this skill",htmlFor:"skill-name",children:"Name"}),jsx(s,{className:"fk:opacity-100!",disabled:true,id:"skill-name",value:i.name})]}),jsxs("div",{children:[jsx(D,{hint:"One or two sentences describing when to use this skill. Agents rely on it to decide whether the skill applies to their current task.",htmlFor:"skill-description",children:"Description"}),jsx(s,{className:"fk:opacity-100!",disabled:true,id:"skill-description",placeholder:"e.g. Rules for writing product descriptions in our brand voice",value:i.description})]}),jsxs("div",{children:[jsx(D,{hint:"Who can see and use this skill. Space skills are only visible to members of the selected space and only usable by automations in that space; personal skills are private to you.",htmlFor:"skill-visibility",children:"Visibility"}),jsxs("div",{className:"fk:flex fk:items-center fk:gap-2",children:[jsxs(a,{disabled:true,value:i.visibility,children:[jsx(d,{"aria-label":"Visibility",className:"fk:w-fit fk:min-w-26 fk:opacity-100!",id:"skill-visibility",children:jsx(c,{})}),jsxs(e,{align:"start",children:[jsx(g$2,{value:"project",children:"Project"}),jsx(g$2,{disabled:!i.spaceId,value:"space",children:"Space"}),jsx(g$2,{value:"personal",children:"Personal"})]})]}),i.visibility==="space"?jsxs(a,{disabled:true,value:i.spaceId??"",children:[jsx(d,{"aria-label":"Space",className:"fk:w-fit fk:min-w-34 fk:opacity-100!",children:jsx(c,{placeholder:"Select a space"})}),jsx(e,{align:"start",children:jsx(g$2,{value:i.spaceId??"",children:zt(i,o)})})]}):null]})]})]}),u&&jsx("p",{role:"alert",children:u}),jsx(Ke,{content:i.content,readOnly:true})]})]})}function vi(){let{api:t,projectId:i}=be(),o=useNavigate();return !i||!t?jsx(ie,{children:"Select a project to create skills."}):jsx(Ge,{api:t,mode:"create",projectId:i,onSaved:()=>o("..",{relative:"path"})})}function bi(){let{api:t,projectId:i}=be(),{skillId:o}=useParams(),{data:l,error:f$1,isLoading:d,mutate:k}=ve(i&&o?g(i).skill(o):null,f),{data:u}=ve(i?g(i).spaces:null,f);if(!i||!t||!o)return jsx(ie,{children:"Select a skill."});if(f$1)return jsx(ie,{children:"Failed to load skill."});if(d||!l?.skill)return jsx(Ht,{});let m=new Map((u?.spaces??[]).map(c=>[c.id,c.label]));return l.skill.source!=="studio"?jsx(Ot,{projectId:i,skill:l.skill,spaceLabelById:m}):jsx(Ge,{api:t,mode:"edit",projectId:i,skill:l.skill,onSaved:c=>{c?k({skill:c},{revalidate:false}):k();}})}export{vi as CreateSkillPage,bi as SkillDetailPage,Ge as SkillForm,hi as SkillsPage};//# sourceMappingURL=skills-pages-KN2VDVVR.js.map
|
|
2
|
-
//# sourceMappingURL=skills-pages-KN2VDVVR.js.map
|
package/dist/source-763I64NT.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import'./index.css';import {n,b as b$1,a,i,r,j,h,f,t,s,l,p,o,m,k}from'./chunk-FR6PTSKU.js';import {a as a$1,b as b$3,d,e,g,h as h$1,f as f$1,j as j$1,i as i$1}from'./chunk-VLAK2VJK.js';import {c}from'./chunk-CAZ6EUR2.js';import {b}from'./chunk-ZZRA4567.js';import'./chunk-JVWYYQX5.js';import {g as g$1}from'./chunk-2HYQVMP3.js';import'./chunk-5CVDMZUI.js';import {ma,Rc,Tc,oa,N,e as e$2,s as s$1,Z,o as o$1}from'./chunk-YCCFUGWJ.js';import {v}from'./chunk-32ZU4MLE.js';import'./chunk-HDOIOXMP.js';import {t as t$1}from'./chunk-SZEGGBOC.js';import'./chunk-U45E5X3H.js';import {b as b$4,c as c$1,e as e$1}from'./chunk-USNXQOMJ.js';import {b as b$2}from'./chunk-6NRQMG26.js';import'./chunk-O2QMYUPS.js';import {useState,useEffect}from'react';import {formatDistance}from'date-fns';import {ExternalLinkIcon,LoaderCircle,RefreshCwIcon,Trash2,BookOpenIcon,ArrowLeft}from'lucide-react';import {useParams,useNavigate,Link}from'react-router-dom';import ve from'swr';import Ie from'swr/infinite';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var Ke=2e3;function Le({actions:f,title:n}){return jsxs(Fragment,{children:[jsxs("div",{className:"fk:flex fk:shrink-0 fk:items-center fk:gap-2 fk:pr-4",children:[jsxs(b$4,{children:[jsx(c$1,{asChild:true,children:jsx(N,{className:"fk:-ml-1 fk:h-4 fk:w-4"})}),jsx(e$1,{children:"Toggle Sidebar"})]}),jsx(v,{orientation:"vertical",className:"fk:h-4"}),jsx("h1",{className:"fk:min-w-0 fk:flex-1 fk:truncate fk:text-lg fk:font-semibold fk:leading-none fk:tracking-tight",children:n}),f]}),jsx(b$2,{asChild:true,className:"fk:w-fit fk:shrink-0",size:"sm",variant:"ghost",children:jsxs(Link,{relative:"path",to:"..",children:[jsx(ArrowLeft,{className:"fk:mr-2 fk:size-4"}),"All documents"]})})]})}function je(){return jsxs("div",{"aria-busy":"true",className:"fk:flex fk:flex-col fk:gap-6 fk:py-6 fk:pl-4 fk:pr-6",children:[jsx("span",{className:"fk:sr-only",children:"Loading document"}),jsx(t$1,{className:"fk:h-6 fk:w-64"}),jsx(t$1,{className:"fk:h-4 fk:w-96"}),jsx(t$1,{className:"fk:h-32 fk:w-full"})]})}function he({children:f}){return jsx("h3",{className:"fk:text-sm fk:font-semibold fk:tracking-tight",children:f})}function ze({projectId:f,source:n}){let g=n.currentVersion?.status==="published"?n.currentVersion:null,i=g?.passageCount??0,c=g?.id??null,y=r=>{if(!c||r*20>=i)return null;let m=r*20;return `${b$1(f).passages(n.id,{from:m,to:Math.min(m+20-1,i-1)})}&version=${encodeURIComponent(c)}`},{data:A,error:v,isLoading:x,setSize:u,size:p}=Ie(y,a,{revalidateFirstPage:false}),d=A?.flatMap(r=>r.passages)??[],l=d.length;return useEffect(()=>{u(1);},[u,c]),i===0?jsx("p",{className:"fk:text-sm fk:text-muted-foreground",children:"Passages appear here once the document is indexed."}):v?jsx("p",{className:"fk:text-sm fk:text-destructive",children:"The passages could not be loaded."}):jsxs("div",{className:"fk:flex fk:flex-col fk:gap-3",children:[d.map(r=>{let m=k(r.locator);return jsxs("article",{className:"fk:rounded-lg fk:border fk:bg-background fk:px-4 fk:py-3 fk:corner-squircle",children:[jsxs("header",{className:"fk:mb-1.5 fk:flex fk:items-center fk:gap-2 fk:text-xs fk:text-muted-foreground",children:[jsxs("span",{className:"fk:font-medium",children:["#",String(r.order+1)]}),m?jsx("span",{className:"fk:truncate",children:m}):null]}),jsx("p",{className:"fk:whitespace-pre-wrap fk:text-sm fk:leading-relaxed",children:r.text})]},r.id)}),x?jsxs("div",{className:"fk:flex fk:items-center fk:gap-2 fk:py-2 fk:text-sm fk:text-muted-foreground",children:[jsx(LoaderCircle,{className:"fk:size-4 fk:animate-spin"}),"Loading passages\u2026"]}):null,l<i&&!x?jsxs(b$2,{className:"fk:w-fit",size:"sm",variant:"outline",onClick:()=>{u(p+1);},children:["Show more (",String(l)," of ",String(i),")"]}):null]})}function Re({api:f,onSaved:n,projectId:g,source:i}){let c=b(),[,y]=g$1(),{data:A}=ve(b$1(g).spaces,a),v=y.user?.spaces??[],x=A?.spaces??[],u=x.filter(a=>v.includes(a.code)),p$1=i.spaces.filter(a=>!v.includes(a)),[d,l]=useState(i.title),[r,m$1]=useState(false),b$3=d.trim()!==i.title&&d.trim().length>0;useEffect(()=>{l(i.title);},[i.title]);async function k(a){if(c){m$1(true);try{let S=await f.updateSource(i.id,a);n(S.source),o();}catch(S){oa.error(p(S,"The document could not be updated."));}finally{m$1(false);}}}let s=!c||r||p$1.length>0,h="This project has no spaces yet, so every member can read it.";return x.length>0&&(h="You are not a member of any space in this project."),jsxs("div",{className:"fk:flex fk:flex-col fk:gap-5",children:[p$1.length>0?jsx(Rc,{children:jsxs(Tc,{children:["This document is shared with spaces you are not a member of (",p$1.join(", "),"), so only an owner or a member of all of them can change it."]})}):null,jsxs("div",{className:"fk:flex fk:flex-col fk:gap-1.5",children:[jsx(e$2,{htmlFor:"knowledge-title",children:"Title"}),jsxs("div",{className:"fk:flex fk:items-center fk:gap-2",children:[jsx(s$1,{className:"fk:max-w-md",disabled:s,id:"knowledge-title",maxLength:200,value:d,onChange:a=>l(a.target.value),onKeyDown:a=>{a.key==="Enter"&&b$3&&(a.preventDefault(),k({title:d.trim()}));}}),b$3?jsx(b$2,{disabled:s,size:"sm",variant:"outline",onClick:()=>{k({title:d.trim()});},children:"Save"}):null]}),jsx("p",{className:"fk:text-xs fk:text-muted-foreground",children:"The agent cites the document by this title."})]}),jsxs("label",{className:"fk:flex fk:w-fit fk:cursor-pointer fk:items-center fk:gap-3",children:[jsx(Z,{checked:i.agentVisible,disabled:s,onCheckedChange:a=>{k({agentVisible:a});}}),jsxs("span",{className:"fk:flex fk:flex-col",children:[jsx("span",{className:"fk:text-sm fk:font-medium",children:"Visible to the agent"}),jsx("span",{className:"fk:text-xs fk:text-muted-foreground",children:"Off keeps the document in the list for people but out of the agent's searches."})]})]}),jsxs("div",{className:"fk:flex fk:flex-col fk:gap-2",children:[jsx("span",{className:"fk:text-sm fk:font-medium",children:"Spaces"}),jsx("p",{className:"fk:text-xs fk:text-muted-foreground",children:i.spaces.length===0?"Every project member can read this document. Pick spaces to limit it to their members.":"Only members of the selected spaces (and the agent working for them) can read this document."}),u.length===0?jsx("p",{className:"fk:text-sm fk:text-muted-foreground",children:h}):jsx("div",{className:"fk:flex fk:flex-wrap fk:gap-x-6 fk:gap-y-2",children:u.map(a=>jsxs("label",{className:"fk:flex fk:cursor-pointer fk:items-center fk:gap-2 fk:text-sm",children:[jsx(o$1,{checked:i.spaces.includes(a.code),disabled:s,onCheckedChange:()=>{k({spaces:m(i.spaces,a.code)});}}),a.label]},a.id))})]})]})}function Ze(){let{api:f$2,projectId:n$1}=n(),{sourceId:g$1}=useParams(),i$2=useNavigate(),c$1=b(),y=c(),[A,v$1]=useState(false),[x,u]=useState(false),[p$1,d$1]=useState(false),{data:l$1,error:r$1,isLoading:m,mutate:b$4}=ve(n$1&&g$1?b$1(n$1).source(g$1):null,a,{refreshInterval:y&&A?Ke:0});if(useEffect(()=>{v$1(l$1?i(l$1.source,l$1.job):false);},[l$1]),!n$1||!f$2||!g$1)return jsx(r,{children:"Select a document."});if(r$1&&!l$1)return jsx(r,{children:"This document does not exist or is not shared with you."});if(m||!l$1)return jsx(je,{});let{job:k,source:s$1}=l$1,h$2=j(s$1,k),a$2=s$1.currentVersion,S=x||p$1;async function be(){d$1(true);try{let o=await f$2.reingestSource(s$1.id);oa.success("Re-indexing started."),await b$4({job:o.job,source:{...s$1,status:"processing"}},{revalidate:!0});}catch(o){oa.error(p(o,"The document could not be re-indexed."));}finally{d$1(false);}}async function Se(){u(true);try{await f$2.deleteSource(s$1.id),oa.success(`Removed "${s$1.title}".`),await o(),i$2("..",{relative:"path"});}catch(o){oa.error(p(o,"The document could not be removed.")),u(false);}}let D=[{label:"Type",value:h(s$1)}];return s$1.originUrl&&D.push({label:"Address",value:jsxs("a",{className:"fk:inline-flex fk:items-center fk:gap-1 fk:underline fk:underline-offset-2",href:s$1.originUrl,rel:"noreferrer",target:"_blank",children:[jsx("span",{className:"fk:truncate",children:s$1.originUrl}),jsx(ExternalLinkIcon,{className:"fk:size-3.5 fk:shrink-0"})]})}),s$1.size!==null&&D.push({label:"Size",value:f(s$1.size)}),D.push({label:"Added",value:formatDistance(new Date(s$1.createdAt),new Date,{addSuffix:true})}),a$2?.publishedAt&&D.push({label:"Indexed",value:formatDistance(new Date(a$2.publishedAt),new Date,{addSuffix:true})}),jsxs("div",{className:"fk:flex fk:h-full fk:min-h-0 fk:min-w-0 fk:flex-col fk:gap-3 fk:pb-3",children:[jsx(Le,{actions:jsxs("div",{className:"fk:flex fk:items-center fk:gap-2",children:[jsx(ma,{disabled:!c$1,children:jsxs(b$2,{disabled:!c$1||S||h$2.tone==="busy",size:"sm",variant:"outline",onClick:()=>{be();},children:[p$1?jsx(LoaderCircle,{className:"fk:animate-spin"}):jsx(RefreshCwIcon,{}),"Re-index"]})}),jsxs(a$1,{children:[jsx(ma,{disabled:!c$1,children:jsx(b$3,{asChild:true,children:jsxs(b$2,{disabled:!c$1||S,size:"sm",variant:"outline",children:[jsx(Trash2,{}),"Remove"]})})}),jsxs(d,{children:[jsxs(e,{children:[jsx(g,{children:"Remove this document?"}),jsxs(h$1,{children:['"',s$1.title,'" and its indexed passages are deleted for everyone. Answers the agent gave earlier keep their citations, but the document can no longer be opened.']})]}),jsxs(f$1,{children:[jsx(j$1,{children:"Cancel"}),jsx(i$1,{onClick:()=>{Se();},children:"Remove document"})]})]})]})]}),title:s$1.title}),jsx("div",{className:"fk:min-h-0 fk:flex-1 fk:overflow-auto",children:jsxs("div",{className:"fk:mx-auto fk:flex fk:w-full fk:max-w-4xl fk:flex-col fk:gap-8 fk:py-2 fk:pl-4 fk:pr-6",children:[jsxs("section",{className:"fk:flex fk:items-start fk:gap-4",children:[jsx(t,{source:s$1}),jsxs("div",{className:"fk:flex fk:min-w-0 fk:flex-1 fk:flex-col fk:gap-2",children:[jsxs("div",{className:"fk:flex fk:flex-wrap fk:items-center fk:gap-2",children:[jsx(s,{label:h$2.label,tone:h$2.tone}),jsx("span",{className:"fk:text-sm fk:text-muted-foreground",children:h$2.detail})]}),k?.error?.hint&&(h$2.tone==="error"||k.state==="failed")?jsx("p",{className:"fk:text-sm fk:text-muted-foreground",children:k.error.hint}):null,jsx("dl",{className:"fk:grid fk:grid-cols-[auto_1fr] fk:gap-x-4 fk:gap-y-1 fk:text-sm",children:D.map(o=>jsxs("div",{className:"fk:contents",children:[jsx("dt",{className:"fk:text-muted-foreground",children:o.label}),jsx("dd",{className:"fk:min-w-0 fk:truncate",children:o.value})]},o.label))}),a$2&&a$2.warnings.length>0?jsx(Rc,{children:jsx(Tc,{children:jsx("ul",{className:"fk:list-disc fk:pl-4",children:a$2.warnings.map(o=>jsx("li",{children:l(o)},o))})})}):null]})]}),jsx(v,{}),jsxs("section",{className:"fk:flex fk:flex-col fk:gap-4",children:[jsx(he,{children:"Settings"}),jsx(Re,{api:f$2,projectId:n$1,source:s$1,onSaved:o=>{b$4({job:k,source:o},{revalidate:false});}})]}),jsx(v,{}),jsxs("section",{className:"fk:flex fk:flex-col fk:gap-4",children:[jsxs("div",{className:"fk:flex fk:items-center fk:gap-2",children:[jsx(BookOpenIcon,{className:"fk:size-4 fk:text-muted-foreground"}),jsx(he,{children:"Passages"})]}),jsx("p",{className:"fk:text-sm fk:text-muted-foreground",children:"The document is split into passages the agent searches and cites. Each one keeps its page, slide or section so a citation points back to the right place."}),jsx(ze,{projectId:n$1,source:s$1})]})]})})]})}export{Ze as Source};//# sourceMappingURL=source-763I64NT.js.map
|
|
2
|
-
//# sourceMappingURL=source-763I64NT.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/apps/knowledge/source.tsx"],"names":["DETAIL_POLL_INTERVAL_MS","SourcePageHeader","actions","title","jsxs","Fragment","Tooltip","jsx","TooltipTrigger","SidebarTrigger","TooltipContent","Separator","Button","Link","ArrowLeft","SourceDetailSkeleton","Skeleton","SectionTitle","children","PassageList","projectId","source","version","passageCount","versionId","getPassagesKey","pageIndex","from","knowledgePaths","pages","error","isLoading","setSize","size","useSWRInfinite","fetcher","passages","page","loaded","useEffect","passage","where","formatKnowledgeLocator","LoaderCircle","SourceSettings","api","onSaved","canMutate","useCanMutate","auth","useAuth","spacesData","useSWR","userSpaceCodes","projectSpaces","selectableSpaces","space","foreignSpaces","code","setTitle","useState","isSaving","setIsSaving","titleChanged","save","patch","result","invalidateKnowledgeLists","toast","describeApiError","disabled","spacesEmptyMessage","Alert","AlertDescription","Label","Input","event","Switch","checked","Checkbox","toggleSpaceCode","Source","useProjectKnowledge","sourceId","useParams","navigate","useNavigate","isViewing","useIsViewing","isBusy","setIsBusy","isDeleting","setIsDeleting","isReindexing","setIsReindexing","data","mutate","isKnowledgeSourceBusy","PageMessage","job","status","summarizeKnowledgeStatus","isWorking","reindex","reindexError","remove","deleteError","facts","getKnowledgeKindLabel","ExternalLinkIcon","formatFileSize","formatDistance","PermissionTooltip","RefreshCwIcon","AlertDialog","AlertDialogTrigger","Trash2","AlertDialogContent","AlertDialogHeader","AlertDialogTitle","AlertDialogDescription","AlertDialogFooter","AlertDialogCancel","AlertDialogAction","SourceIcon","StatusBadge","fact","warning","formatKnowledgeWarning","saved","BookOpenIcon"],"mappings":"2gCA+DA,IAAMA,EAAAA,CAA0B,IAEhC,SAASC,EAAAA,CAAiB,CAAE,OAAA,CAAAC,CAAAA,CAAS,MAAAC,CAAM,CAAA,CAA0D,CACnG,OACEC,IAAAA,CAAAC,SAAA,CACE,QAAA,CAAA,CAAAD,KAAC,KAAA,CAAA,CAAI,SAAA,CAAU,uDACb,QAAA,CAAA,CAAAA,IAAAA,CAACE,IAAA,CACC,QAAA,CAAA,CAAAC,IAACC,GAAAA,CAAA,CAAe,QAAO,IAAA,CACrB,QAAA,CAAAD,IAACE,CAAAA,CAAA,CAAe,UAAU,wBAAA,CAAyB,CAAA,CACrD,EACAF,GAAAA,CAACG,GAAAA,CAAA,CAAe,QAAA,CAAA,gBAAA,CAAc,CAAA,CAAA,CAChC,EACAH,GAAAA,CAACI,CAAAA,CAAA,CAAU,WAAA,CAAY,UAAA,CAAW,SAAA,CAAU,SAAS,CAAA,CACrDJ,GAAAA,CAAC,MAAG,SAAA,CAAU,gGAAA,CACX,SAAAJ,CAAAA,CACH,CAAA,CACCD,GACH,CAAA,CACAK,GAAAA,CAACK,IAAA,CAAO,OAAA,CAAO,KAAC,SAAA,CAAU,sBAAA,CAAuB,KAAK,IAAA,CAAK,OAAA,CAAQ,QACjE,QAAA,CAAAR,IAAAA,CAACS,KAAA,CAAK,QAAA,CAAS,OAAO,EAAA,CAAG,IAAA,CACvB,UAAAN,GAAAA,CAACO,SAAAA,CAAA,CAAU,SAAA,CAAU,mBAAA,CAAoB,EAAE,eAAA,CAAA,CAE7C,CAAA,CACF,GACF,CAEJ,CAEA,SAASC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F,CAEJ","file":"source-763I64NT.js","sourcesContent":["import type { JSX } from 'react';\nimport { useEffect, useState } from 'react';\nimport { formatDistance } from 'date-fns';\nimport { ArrowLeft, BookOpenIcon, ExternalLinkIcon, LoaderCircle, RefreshCwIcon, Trash2 } from 'lucide-react';\nimport { Link, useNavigate, useParams } from 'react-router-dom';\nimport useSWR from 'swr';\nimport useSWRInfinite from 'swr/infinite';\nimport { useAuth } from '../../auth/auth-context';\nimport { useIsViewing } from '../../core/apps/app-active';\nimport { useCanMutate } from '../../core/permissions';\nimport {\n Alert,\n AlertDescription,\n Button,\n Checkbox,\n Input,\n Label,\n PermissionTooltip,\n Separator,\n SidebarTrigger,\n Skeleton,\n Switch,\n toast,\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from '../../ui';\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n AlertDialogTrigger,\n} from '../../ui/primitives/alert-dialog';\nimport { fetcher, knowledgePaths, type KnowledgeApi, type ProjectSpace } from './api';\nimport {\n formatFileSize,\n formatKnowledgeLocator,\n formatKnowledgeWarning,\n getKnowledgeKindLabel,\n isKnowledgeSourceBusy,\n KNOWLEDGE_MAX_TITLE_LENGTH,\n KNOWLEDGE_PASSAGES_PAGE_SIZE,\n summarizeKnowledgeStatus,\n toggleSpaceCode,\n type KnowledgePassage,\n type KnowledgePassagesPage,\n type KnowledgeSource,\n type KnowledgeSourceDetail,\n} from './knowledge';\nimport {\n describeApiError,\n invalidateKnowledgeLists,\n PageMessage,\n SourceIcon,\n StatusBadge,\n useProjectKnowledge,\n} from './shared';\n\nconst DETAIL_POLL_INTERVAL_MS = 2_000;\n\nfunction SourcePageHeader({ actions, title }: { actions?: JSX.Element; title: string }): JSX.Element {\n return (\n <>\n <div className=\"fk:flex fk:shrink-0 fk:items-center fk:gap-2 fk:pr-4\">\n <Tooltip>\n <TooltipTrigger asChild>\n <SidebarTrigger className=\"fk:-ml-1 fk:h-4 fk:w-4\" />\n </TooltipTrigger>\n <TooltipContent>Toggle Sidebar</TooltipContent>\n </Tooltip>\n <Separator orientation=\"vertical\" className=\"fk:h-4\" />\n <h1 className=\"fk:min-w-0 fk:flex-1 fk:truncate fk:text-lg fk:font-semibold fk:leading-none fk:tracking-tight\">\n {title}\n </h1>\n {actions}\n </div>\n <Button asChild className=\"fk:w-fit fk:shrink-0\" size=\"sm\" variant=\"ghost\">\n <Link relative=\"path\" to=\"..\">\n <ArrowLeft className=\"fk:mr-2 fk:size-4\" />\n All documents\n </Link>\n </Button>\n </>\n );\n}\n\nfunction SourceDetailSkeleton(): JSX.Element {\n return (\n <div aria-busy=\"true\" className=\"fk:flex fk:flex-col fk:gap-6 fk:py-6 fk:pl-4 fk:pr-6\">\n <span className=\"fk:sr-only\">Loading document</span>\n <Skeleton className=\"fk:h-6 fk:w-64\" />\n <Skeleton className=\"fk:h-4 fk:w-96\" />\n <Skeleton className=\"fk:h-32 fk:w-full\" />\n </div>\n );\n}\n\nfunction SectionTitle({ children }: { children: string }): JSX.Element {\n return <h3 className=\"fk:text-sm fk:font-semibold fk:tracking-tight\">{children}</h3>;\n}\n\nfunction PassageList({ projectId, source }: { projectId: string; source: KnowledgeSource }): JSX.Element {\n const version = source.currentVersion?.status === 'published' ? source.currentVersion : null;\n const passageCount = version?.passageCount ?? 0;\n const versionId = version?.id ?? null;\n const getPassagesKey = (pageIndex: number): string | null => {\n if (!versionId || pageIndex * KNOWLEDGE_PASSAGES_PAGE_SIZE >= passageCount) {\n return null;\n }\n\n const from = pageIndex * KNOWLEDGE_PASSAGES_PAGE_SIZE;\n const path = knowledgePaths(projectId).passages(source.id, {\n from,\n to: Math.min(from + KNOWLEDGE_PASSAGES_PAGE_SIZE - 1, passageCount - 1),\n });\n\n // The version is part of the key, so a re-index swaps the pages instead\n // of serving the retired ones; the server ignores the extra parameter.\n return `${path}&version=${encodeURIComponent(versionId)}`;\n };\n const {\n data: pages,\n error,\n isLoading,\n setSize,\n size,\n } = useSWRInfinite<KnowledgePassagesPage>(getPassagesKey, fetcher, {\n revalidateFirstPage: false,\n });\n const passages: KnowledgePassage[] = pages?.flatMap((page) => page.passages) ?? [];\n const loaded = passages.length;\n\n // A new version starts from its first page again.\n useEffect(() => {\n void setSize(1);\n }, [setSize, versionId]);\n\n if (passageCount === 0) {\n return <p className=\"fk:text-sm fk:text-muted-foreground\">Passages appear here once the document is indexed.</p>;\n }\n\n if (error) {\n return <p className=\"fk:text-sm fk:text-destructive\">The passages could not be loaded.</p>;\n }\n\n return (\n <div className=\"fk:flex fk:flex-col fk:gap-3\">\n {passages.map((passage) => {\n const where = formatKnowledgeLocator(passage.locator);\n\n return (\n <article\n className=\"fk:rounded-lg fk:border fk:bg-background fk:px-4 fk:py-3 fk:corner-squircle\"\n key={passage.id}\n >\n <header className=\"fk:mb-1.5 fk:flex fk:items-center fk:gap-2 fk:text-xs fk:text-muted-foreground\">\n <span className=\"fk:font-medium\">#{String(passage.order + 1)}</span>\n {where ? <span className=\"fk:truncate\">{where}</span> : null}\n </header>\n <p className=\"fk:whitespace-pre-wrap fk:text-sm fk:leading-relaxed\">{passage.text}</p>\n </article>\n );\n })}\n {isLoading ? (\n <div className=\"fk:flex fk:items-center fk:gap-2 fk:py-2 fk:text-sm fk:text-muted-foreground\">\n <LoaderCircle className=\"fk:size-4 fk:animate-spin\" />\n Loading passages…\n </div>\n ) : null}\n {loaded < passageCount && !isLoading ? (\n <Button className=\"fk:w-fit\" size=\"sm\" variant=\"outline\" onClick={() => void setSize(size + 1)}>\n Show more ({String(loaded)} of {String(passageCount)})\n </Button>\n ) : null}\n </div>\n );\n}\n\nfunction SourceSettings({\n api,\n onSaved,\n projectId,\n source,\n}: {\n api: KnowledgeApi;\n onSaved: (_source: KnowledgeSource) => void;\n projectId: string;\n source: KnowledgeSource;\n}): JSX.Element {\n const canMutate = useCanMutate();\n const [, auth] = useAuth();\n const { data: spacesData } = useSWR<{ spaces: ProjectSpace[] }>(knowledgePaths(projectId).spaces, fetcher);\n const userSpaceCodes = auth.user?.spaces ?? [];\n // Only the caller's own spaces are offered: changing a source needs every\n // space it is shared with, and the server refuses codes the caller lacks.\n const projectSpaces = spacesData?.spaces ?? [];\n const selectableSpaces = projectSpaces.filter((space) => userSpaceCodes.includes(space.code));\n const foreignSpaces = source.spaces.filter((code) => !userSpaceCodes.includes(code));\n const [title, setTitle] = useState(source.title);\n const [isSaving, setIsSaving] = useState(false);\n const titleChanged = title.trim() !== source.title && title.trim().length > 0;\n\n useEffect(() => {\n setTitle(source.title);\n }, [source.title]);\n\n async function save(patch: { agentVisible?: boolean; spaces?: string[]; title?: string }): Promise<void> {\n if (!canMutate) {\n return;\n }\n\n setIsSaving(true);\n\n try {\n const result = await api.updateSource(source.id, patch);\n\n onSaved(result.source);\n void invalidateKnowledgeLists();\n } catch (error) {\n toast.error(describeApiError(error, 'The document could not be updated.'));\n } finally {\n setIsSaving(false);\n }\n }\n\n const disabled = !canMutate || isSaving || foreignSpaces.length > 0;\n let spacesEmptyMessage = 'This project has no spaces yet, so every member can read it.';\n\n if (projectSpaces.length > 0) {\n spacesEmptyMessage = 'You are not a member of any space in this project.';\n }\n\n return (\n <div className=\"fk:flex fk:flex-col fk:gap-5\">\n {foreignSpaces.length > 0 ? (\n <Alert>\n <AlertDescription>\n This document is shared with spaces you are not a member of ({foreignSpaces.join(', ')}), so only an owner\n or a member of all of them can change it.\n </AlertDescription>\n </Alert>\n ) : null}\n <div className=\"fk:flex fk:flex-col fk:gap-1.5\">\n <Label htmlFor=\"knowledge-title\">Title</Label>\n <div className=\"fk:flex fk:items-center fk:gap-2\">\n <Input\n className=\"fk:max-w-md\"\n disabled={disabled}\n id=\"knowledge-title\"\n maxLength={KNOWLEDGE_MAX_TITLE_LENGTH}\n value={title}\n onChange={(event) => setTitle(event.target.value)}\n onKeyDown={(event) => {\n if (event.key === 'Enter' && titleChanged) {\n event.preventDefault();\n void save({ title: title.trim() });\n }\n }}\n />\n {titleChanged ? (\n <Button disabled={disabled} size=\"sm\" variant=\"outline\" onClick={() => void save({ title: title.trim() })}>\n Save\n </Button>\n ) : null}\n </div>\n <p className=\"fk:text-xs fk:text-muted-foreground\">The agent cites the document by this title.</p>\n </div>\n <label className=\"fk:flex fk:w-fit fk:cursor-pointer fk:items-center fk:gap-3\">\n <Switch\n checked={source.agentVisible}\n disabled={disabled}\n onCheckedChange={(checked) => void save({ agentVisible: checked })}\n />\n <span className=\"fk:flex fk:flex-col\">\n <span className=\"fk:text-sm fk:font-medium\">Visible to the agent</span>\n <span className=\"fk:text-xs fk:text-muted-foreground\">\n Off keeps the document in the list for people but out of the agent's searches.\n </span>\n </span>\n </label>\n <div className=\"fk:flex fk:flex-col fk:gap-2\">\n <span className=\"fk:text-sm fk:font-medium\">Spaces</span>\n <p className=\"fk:text-xs fk:text-muted-foreground\">\n {source.spaces.length === 0\n ? 'Every project member can read this document. Pick spaces to limit it to their members.'\n : 'Only members of the selected spaces (and the agent working for them) can read this document.'}\n </p>\n {selectableSpaces.length === 0 ? (\n <p className=\"fk:text-sm fk:text-muted-foreground\">{spacesEmptyMessage}</p>\n ) : (\n <div className=\"fk:flex fk:flex-wrap fk:gap-x-6 fk:gap-y-2\">\n {selectableSpaces.map((space) => (\n <label className=\"fk:flex fk:cursor-pointer fk:items-center fk:gap-2 fk:text-sm\" key={space.id}>\n <Checkbox\n checked={source.spaces.includes(space.code)}\n disabled={disabled}\n onCheckedChange={() => void save({ spaces: toggleSpaceCode(source.spaces, space.code) })}\n />\n {space.label}\n </label>\n ))}\n </div>\n )}\n </div>\n </div>\n );\n}\n\nexport function Source(): JSX.Element {\n const { api, projectId } = useProjectKnowledge();\n const { sourceId } = useParams<{ sourceId: string }>();\n const navigate = useNavigate();\n const canMutate = useCanMutate();\n const isViewing = useIsViewing();\n const [isBusy, setIsBusy] = useState(false);\n const [isDeleting, setIsDeleting] = useState(false);\n const [isReindexing, setIsReindexing] = useState(false);\n const { data, error, isLoading, mutate } = useSWR<KnowledgeSourceDetail>(\n projectId && sourceId ? knowledgePaths(projectId).source(sourceId) : null,\n fetcher,\n { refreshInterval: isViewing && isBusy ? DETAIL_POLL_INTERVAL_MS : 0 }\n );\n\n useEffect(() => {\n setIsBusy(data ? isKnowledgeSourceBusy(data.source, data.job) : false);\n }, [data]);\n\n if (!projectId || !api || !sourceId) {\n return <PageMessage>Select a document.</PageMessage>;\n }\n\n // A failed background refresh keeps the last good data on screen; only a\n // document that never loaded is reported as missing.\n if (error && !data) {\n return <PageMessage>This document does not exist or is not shared with you.</PageMessage>;\n }\n\n if (isLoading || !data) {\n return <SourceDetailSkeleton />;\n }\n\n const { job, source } = data;\n const status = summarizeKnowledgeStatus(source, job);\n const version = source.currentVersion;\n const isWorking = isDeleting || isReindexing;\n\n async function reindex(): Promise<void> {\n setIsReindexing(true);\n\n try {\n const result = await api!.reingestSource(source.id);\n\n toast.success('Re-indexing started.');\n await mutate({ job: result.job, source: { ...source, status: 'processing' } }, { revalidate: true });\n } catch (reindexError) {\n toast.error(describeApiError(reindexError, 'The document could not be re-indexed.'));\n } finally {\n setIsReindexing(false);\n }\n }\n\n async function remove(): Promise<void> {\n setIsDeleting(true);\n\n try {\n await api!.deleteSource(source.id);\n toast.success(`Removed \"${source.title}\".`);\n await invalidateKnowledgeLists();\n navigate('..', { relative: 'path' });\n } catch (deleteError) {\n toast.error(describeApiError(deleteError, 'The document could not be removed.'));\n setIsDeleting(false);\n }\n }\n\n const facts: { label: string; value: JSX.Element | string }[] = [\n { label: 'Type', value: getKnowledgeKindLabel(source) },\n ];\n\n if (source.originUrl) {\n facts.push({\n label: 'Address',\n value: (\n <a\n className=\"fk:inline-flex fk:items-center fk:gap-1 fk:underline fk:underline-offset-2\"\n href={source.originUrl}\n rel=\"noreferrer\"\n target=\"_blank\"\n >\n <span className=\"fk:truncate\">{source.originUrl}</span>\n <ExternalLinkIcon className=\"fk:size-3.5 fk:shrink-0\" />\n </a>\n ),\n });\n }\n\n if (source.size !== null) {\n facts.push({ label: 'Size', value: formatFileSize(source.size) });\n }\n\n facts.push({ label: 'Added', value: formatDistance(new Date(source.createdAt), new Date(), { addSuffix: true }) });\n\n if (version?.publishedAt) {\n facts.push({\n label: 'Indexed',\n value: formatDistance(new Date(version.publishedAt), new Date(), { addSuffix: true }),\n });\n }\n\n return (\n <div className=\"fk:flex fk:h-full fk:min-h-0 fk:min-w-0 fk:flex-col fk:gap-3 fk:pb-3\">\n <SourcePageHeader\n actions={\n <div className=\"fk:flex fk:items-center fk:gap-2\">\n <PermissionTooltip disabled={!canMutate}>\n <Button\n disabled={!canMutate || isWorking || status.tone === 'busy'}\n size=\"sm\"\n variant=\"outline\"\n onClick={() => void reindex()}\n >\n {isReindexing ? <LoaderCircle className=\"fk:animate-spin\" /> : <RefreshCwIcon />}\n Re-index\n </Button>\n </PermissionTooltip>\n <AlertDialog>\n <PermissionTooltip disabled={!canMutate}>\n <AlertDialogTrigger asChild>\n <Button disabled={!canMutate || isWorking} size=\"sm\" variant=\"outline\">\n <Trash2 />\n Remove\n </Button>\n </AlertDialogTrigger>\n </PermissionTooltip>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>Remove this document?</AlertDialogTitle>\n <AlertDialogDescription>\n \"{source.title}\" and its indexed passages are deleted for everyone. Answers the agent gave earlier\n keep their citations, but the document can no longer be opened.\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>Cancel</AlertDialogCancel>\n <AlertDialogAction onClick={() => void remove()}>Remove document</AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </div>\n }\n title={source.title}\n />\n <div className=\"fk:min-h-0 fk:flex-1 fk:overflow-auto\">\n <div className=\"fk:mx-auto fk:flex fk:w-full fk:max-w-4xl fk:flex-col fk:gap-8 fk:py-2 fk:pl-4 fk:pr-6\">\n <section className=\"fk:flex fk:items-start fk:gap-4\">\n <SourceIcon source={source} />\n <div className=\"fk:flex fk:min-w-0 fk:flex-1 fk:flex-col fk:gap-2\">\n <div className=\"fk:flex fk:flex-wrap fk:items-center fk:gap-2\">\n <StatusBadge label={status.label} tone={status.tone} />\n <span className=\"fk:text-sm fk:text-muted-foreground\">{status.detail}</span>\n </div>\n {job?.error?.hint && (status.tone === 'error' || job.state === 'failed') ? (\n <p className=\"fk:text-sm fk:text-muted-foreground\">{job.error.hint}</p>\n ) : null}\n <dl className=\"fk:grid fk:grid-cols-[auto_1fr] fk:gap-x-4 fk:gap-y-1 fk:text-sm\">\n {facts.map((fact) => (\n <div className=\"fk:contents\" key={fact.label}>\n <dt className=\"fk:text-muted-foreground\">{fact.label}</dt>\n <dd className=\"fk:min-w-0 fk:truncate\">{fact.value}</dd>\n </div>\n ))}\n </dl>\n {version && version.warnings.length > 0 ? (\n <Alert>\n <AlertDescription>\n <ul className=\"fk:list-disc fk:pl-4\">\n {version.warnings.map((warning) => (\n <li key={warning}>{formatKnowledgeWarning(warning)}</li>\n ))}\n </ul>\n </AlertDescription>\n </Alert>\n ) : null}\n </div>\n </section>\n <Separator />\n <section className=\"fk:flex fk:flex-col fk:gap-4\">\n <SectionTitle>Settings</SectionTitle>\n <SourceSettings\n api={api}\n projectId={projectId}\n source={source}\n onSaved={(saved) => void mutate({ job, source: saved }, { revalidate: false })}\n />\n </section>\n <Separator />\n <section className=\"fk:flex fk:flex-col fk:gap-4\">\n <div className=\"fk:flex fk:items-center fk:gap-2\">\n <BookOpenIcon className=\"fk:size-4 fk:text-muted-foreground\" />\n <SectionTitle>Passages</SectionTitle>\n </div>\n <p className=\"fk:text-sm fk:text-muted-foreground\">\n The document is split into passages the agent searches and cites. Each one keeps its page, slide or\n section so a citation points back to the right place.\n </p>\n <PassageList projectId={projectId} source={source} />\n </section>\n </div>\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import'./index.css';import {ga,ha,ia,_,fa,$,ca,da,aa,ea,ja,f}from'./chunk-YCCFUGWJ.js';import {v as v$1,b as b$1}from'./chunk-32ZU4MLE.js';import'./chunk-HDOIOXMP.js';import {t}from'./chunk-SZEGGBOC.js';import'./chunk-U45E5X3H.js';import'./chunk-USNXQOMJ.js';import'./chunk-6NRQMG26.js';import'./chunk-O2QMYUPS.js';import {useMemo,useId,useState,useEffect}from'react';import {buildSpecFromParts,StateProvider,VisibilityProvider,ActionProvider,Renderer}from'@json-render/react';import {TrendingUpIcon,TrendingDownIcon,MinusIcon,InfoIcon,OctagonAlertIcon,AlertTriangleIcon,LightbulbIcon,XCircleIcon,CheckCircle2Icon}from'lucide-react';import {PieChart,Tooltip,Pie,Cell,LineChart,CartesianGrid,XAxis,YAxis,Line,BarChart,Bar,ResponsiveContainer}from'recharts';import {jsx,jsxs}from'react/jsx-runtime';var ke={sm:"fk:max-w-sm",md:"fk:max-w-md",lg:"fk:max-w-lg",full:"fk:max-w-full"},pe=({children:e,element:t})=>{let{props:n}=t,s=n.maxWidth?ke[n.maxWidth]:"",a=n.centered?"fk:mx-auto":"";return jsxs("div",{className:`fk:w-full fk:rounded-lg fk:border fk:border-border fk:bg-card fk:p-4 fk:gap-2 fk:flex fk:flex-col ${s} ${a} ${n.className??""} fk:corner-squircle`,children:[n.title&&jsx("div",{className:"fk:text-sm fk:font-medium",children:n.title}),n.description&&jsx("div",{className:"fk:mt-0.5 fk:text-xs fk:text-muted-foreground",children:n.description}),(n.title??n.description)&&e?jsx("div",{className:"fk:mt-3"}):null,e]})},me={none:"fk:gap-0",sm:"fk:gap-2",md:"fk:gap-3",lg:"fk:gap-4",xl:"fk:gap-6"},ge={start:"fk:items-start",center:"fk:items-center",end:"fk:items-end",stretch:"fk:items-stretch"},he={start:"fk:justify-start",center:"fk:justify-center",end:"fk:justify-end",between:"fk:justify-between",around:"fk:justify-around"},be=({children:e,element:t})=>{let{props:n}=t,s=n.direction==="horizontal"?"fk:flex-row fk:flex-wrap":"fk:flex-col",a=me[n.gap??"md"],i=n.align?ge[n.align]:"",l=n.justify?he[n.justify]:"";return jsx("div",{className:`fk:flex fk:w-full ${s} ${a} ${i} ${l} ${n.className??""}`,children:e})},ve={1:"fk:grid-cols-1",2:"fk:grid-cols-2",3:"fk:grid-cols-3",4:"fk:grid-cols-4",5:"fk:grid-cols-5",6:"fk:grid-cols-6"},ye={sm:"fk:gap-2",md:"fk:gap-3",lg:"fk:gap-4",xl:"fk:gap-6"},xe=({children:e,element:t})=>{let{props:n}=t,s=ve[n.columns??1]??"fk:grid-cols-1",a=ye[n.gap??"md"];return jsx("div",{className:`fk:grid fk:w-full ${s} ${a} ${n.className??""}`,children:e})},Ce=({element:e})=>jsx(v$1,{orientation:e.props.orientation??"horizontal"}),Pe={h1:"fk:text-xl fk:font-semibold fk:tracking-tight",h2:"fk:text-lg fk:font-semibold fk:tracking-tight",h3:"fk:text-base fk:font-medium",h4:"fk:text-sm fk:font-medium"},we=({element:e})=>{let t=e.props.level??"h2";return jsx(t,{className:Pe[t],children:e.props.text})},Ne={body:"fk:text-sm",muted:"fk:text-sm fk:text-muted-foreground",caption:"fk:text-xs fk:text-muted-foreground",lead:"fk:text-base",code:"fk:rounded fk:bg-muted fk:px-1 fk:py-0.5 fk:font-mono fk:text-xs fk:corner-squircle"},Se=({element:e})=>jsx("p",{className:Ne[e.props.variant??"body"],children:e.props.text}),Te=({element:e})=>jsx(b$1,{variant:e.props.variant??"default",children:e.props.text});function Re({type:e}){switch(e){case "success":return jsx(CheckCircle2Icon,{className:"fk:size-4 fk:translate-y-0.5"});case "warning":return jsx(AlertTriangleIcon,{className:"fk:size-4 fk:translate-y-0.5"});case "error":return jsx(XCircleIcon,{className:"fk:size-4 fk:translate-y-0.5"});default:return jsx(InfoIcon,{className:"fk:size-4 fk:translate-y-0.5"})}}var Ae=({element:e})=>{let{props:t}=e,n=t.type==="error"?"fk:border-destructive/50 fk:text-destructive":"fk:text-foreground";return jsxs("div",{className:`fk:flex fk:w-full fk:gap-3 fk:rounded-lg fk:border fk:bg-card fk:px-4 fk:py-3 fk:text-sm ${n} fk:corner-squircle`,role:"alert",children:[jsx(Re,{type:t.type}),jsxs("div",{className:"fk:min-w-0",children:[jsx("div",{className:"fk:font-medium",children:t.title}),t.message&&jsx("div",{className:"fk:text-muted-foreground",children:t.message})]})]})},Le=({element:e})=>{let t=e.props.columns??[],n=(e.props.rows??[]).map(s=>s.map(String));return jsx("div",{className:"fk:w-full fk:overflow-hidden fk:rounded-md fk:mt-2 fk:corner-squircle",children:jsxs(_,{children:[e.props.caption&&jsx(fa,{children:e.props.caption}),jsx($,{children:jsx(ca,{children:t.map((s,a)=>jsx(da,{children:s},`${a.toString()}-${s}`))})}),jsx(aa,{children:n.map((s,a)=>jsx(ca,{children:s.map((i,l)=>jsx(ea,{children:i},l))},a))})]})})},ze=({element:e})=>{let{props:t}=e,n=t.max??100,s=n>0?Math.min(100,Math.max(0,t.value/n*100)):0;return jsxs("div",{className:"fk:w-full",children:[t.label&&jsxs("div",{className:"fk:mb-1 fk:flex fk:items-center fk:justify-between fk:text-xs fk:text-muted-foreground",children:[jsx("span",{children:t.label}),jsxs("span",{className:"fk:tabular-nums",children:[Math.round(s),"%"]})]}),jsx("div",{className:"fk:h-2 fk:w-full fk:overflow-hidden fk:rounded-full fk:bg-secondary fk:corner-squircle",children:jsx("div",{className:"fk:h-full fk:rounded-full fk:bg-primary fk:corner-squircle",style:{width:`${s.toString()}%`}})})]})},Ke=({element:e})=>jsx(t,{className:e.props.rounded?"fk:rounded-full fk:corner-squircle":"",style:{height:e.props.height??"1rem",width:e.props.width??"100%"}}),Me=({element:e})=>jsx(f,{href:e.props.href,children:e.props.label}),$e=({element:e})=>e.props.src?jsx("img",{alt:e.props.alt,className:"fk:max-w-full fk:rounded-md fk:corner-squircle",height:e.props.height??void 0,src:e.props.src,width:e.props.width??void 0}):null,Ie=({element:e})=>jsx("div",{className:"fk:w-full fk:divide-y fk:divide-border fk:rounded-md fk:border fk:border-border fk:corner-squircle",children:(e.props.items??[]).map((t,n)=>jsxs("details",{className:"fk:group fk:px-4 fk:py-3",children:[jsx("summary",{className:"fk:cursor-pointer fk:list-none fk:text-sm fk:font-medium",children:t.title}),jsx("p",{className:"fk:mt-2 fk:text-sm fk:text-muted-foreground",children:t.content})]},n))}),Ee=({children:e,element:t})=>{let n=t.props.tabs??[];return jsxs(ga,{defaultValue:t.props.value??t.props.defaultValue??n[0]?.value,children:[jsx(ha,{children:n.map(s=>jsx(ia,{value:s.value,children:s.label},s.value))}),e]})},qe=({children:e,element:t})=>jsx(ja,{value:t.props.value,children:e}),je={up:"fk:text-success",down:"fk:text-destructive",neutral:"fk:text-muted-foreground"};function Be({trend:e}){return e==="up"?jsx(TrendingUpIcon,{className:"fk:size-4"}):e==="down"?jsx(TrendingDownIcon,{className:"fk:size-4"}):jsx(MinusIcon,{className:"fk:size-4"})}var He=({element:e})=>{let{props:t}=e;return jsxs("div",{className:"fk:w-full fk:rounded-lg fk:border fk:border-border fk:bg-card fk:p-4 fk:corner-squircle",children:[jsx("div",{className:"fk:text-xs fk:font-medium fk:text-muted-foreground",children:t.label}),jsxs("div",{className:"fk:mt-1 fk:flex fk:items-center fk:gap-2",children:[jsx("span",{className:"fk:text-2xl fk:font-semibold fk:tabular-nums fk:tracking-tight",children:t.value}),t.trend&&jsx("span",{className:je[t.trend],children:jsx(Be,{trend:t.trend})})]}),t.detail&&jsx("div",{className:"fk:mt-1 fk:text-xs fk:text-muted-foreground",children:t.detail})]})},Je={info:"fk:border-blue-500/30 fk:bg-blue-500/5 fk:text-blue-700 fk:dark:text-blue-400",tip:"fk:border-emerald-500/30 fk:bg-emerald-500/5 fk:text-emerald-700 fk:dark:text-emerald-400",warning:"fk:border-amber-500/30 fk:bg-amber-500/5 fk:text-amber-700 fk:dark:text-amber-400",important:"fk:border-red-500/30 fk:bg-red-500/5 fk:text-red-700 fk:dark:text-red-400"};function Xe({type:e}){switch(e){case "tip":return jsx(LightbulbIcon,{className:"fk:size-4 fk:shrink-0 fk:translate-y-0.5"});case "warning":return jsx(AlertTriangleIcon,{className:"fk:size-4 fk:shrink-0 fk:translate-y-0.5"});case "important":return jsx(OctagonAlertIcon,{className:"fk:size-4 fk:shrink-0 fk:translate-y-0.5"});default:return jsx(InfoIcon,{className:"fk:size-4 fk:shrink-0 fk:translate-y-0.5"})}}var Fe=({element:e})=>{let{props:t}=e,n=t.type??"info";return jsxs("div",{className:`fk:flex fk:w-full fk:gap-3 fk:rounded-lg fk:border fk:px-4 fk:py-3 fk:text-sm ${Je[n]} fk:corner-squircle`,children:[jsx(Xe,{type:n}),jsxs("div",{className:"fk:min-w-0",children:[t.title&&jsx("div",{className:"fk:font-medium",children:t.title}),jsx("div",{className:"fk:text-foreground",children:t.content})]})]})},Oe={completed:"fk:border-success fk:bg-success",current:"fk:border-primary fk:bg-primary",upcoming:"fk:border-border fk:bg-background"},Ge=({element:e})=>jsx("div",{className:"fk:w-full",children:(e.props.items??[]).map((t,n,s)=>jsxs("div",{className:"fk:relative fk:flex fk:gap-3 fk:pb-4 fk:last:pb-0",children:[n<s.length-1&&jsx("div",{className:"fk:absolute fk:left-[5px] fk:top-4 fk:h-full fk:w-px fk:bg-border"}),jsx("div",{className:`fk:mt-1 fk:size-[11px] fk:shrink-0 fk:rounded-full fk:border-2 ${Oe[t.status??"upcoming"]} fk:corner-squircle`}),jsxs("div",{className:"fk:min-w-0",children:[jsxs("div",{className:"fk:flex fk:flex-wrap fk:items-baseline fk:gap-x-2",children:[jsx("span",{className:"fk:text-sm fk:font-medium",children:t.title}),t.date&&jsx("span",{className:"fk:text-xs fk:text-muted-foreground",children:t.date})]}),t.description&&jsx("div",{className:"fk:text-sm fk:text-muted-foreground",children:t.description})]})]},n))}),c=["#6366f1","#10b981","#f59e0b","#ef4444","#06b6d4"],b={background:"hsl(var(--background))",border:"1px solid hsl(var(--border))",borderRadius:6,color:"hsl(var(--foreground))",fontSize:12},v={color:"hsl(var(--foreground))"},y={color:"hsl(var(--foreground))"},u={fill:"hsl(var(--muted-foreground))",fontSize:11};function g(e){let t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?t:0}function X(e){let t=e.data??[];if(!e.aggregate)return t.map(s=>({x:String(s[e.xKey]??""),y:g(s[e.yKey])}));let n=new Map;for(let s of t){let a=String(s[e.xKey]??""),i=n.get(a)??{count:0,sum:0};i.count+=1,i.sum+=g(s[e.yKey]),n.set(a,i);}return Array.from(n.entries()).map(([s,a])=>e.aggregate==="count"?{x:s,y:a.count}:e.aggregate==="avg"?{x:s,y:a.count===0?0:a.sum/a.count}:{x:s,y:a.sum})}function x({children:e,height:t,title:n}){return jsxs("div",{className:"fk:w-full",children:[n&&jsx("div",{className:"fk:mb-2 fk:text-sm fk:font-medium",children:n}),jsx("div",{style:{height:t??256},children:jsx(ResponsiveContainer,{height:"100%",width:"100%",children:e})})]})}var We=({element:e})=>{let t=X(e.props),n=e.props.color??c[0];return jsx(x,{height:e.props.height,title:e.props.title,children:jsxs(BarChart,{data:t,children:[jsx(CartesianGrid,{stroke:"hsl(var(--border))",vertical:false}),jsx(XAxis,{axisLine:false,dataKey:"x",tick:u,tickLine:false,tickMargin:8}),jsx(YAxis,{axisLine:false,tick:u,tickLine:false,width:40}),jsx(Tooltip,{contentStyle:b,cursor:{fill:"hsl(var(--muted))"},itemStyle:v,labelStyle:y}),jsx(Bar,{dataKey:"y",fill:n,isAnimationActive:false,name:e.props.yKey,radius:4})]})})},_e=({element:e})=>{let t=X(e.props),n=e.props.color??c[0];return jsx(x,{height:e.props.height,title:e.props.title,children:jsxs(LineChart,{data:t,children:[jsx(CartesianGrid,{stroke:"hsl(var(--border))",vertical:false}),jsx(XAxis,{axisLine:false,dataKey:"x",tick:u,tickLine:false,tickMargin:8}),jsx(YAxis,{axisLine:false,tick:u,tickLine:false,width:40}),jsx(Tooltip,{contentStyle:b,itemStyle:v,labelStyle:y}),jsx(Line,{dataKey:"y",dot:false,isAnimationActive:false,name:e.props.yKey,stroke:n,strokeWidth:2,type:"monotone"})]})})},Ve=({element:e})=>{let t=(e.props.data??[]).map(n=>({name:String(n[e.props.nameKey]??""),value:g(n[e.props.valueKey])}));return jsx(x,{height:e.props.height,title:e.props.title,children:jsxs(PieChart,{children:[jsx(Tooltip,{contentStyle:b,itemStyle:v,labelStyle:y}),jsx(Pie,{data:t,dataKey:"value",innerRadius:"45%",isAnimationActive:false,nameKey:"name",children:t.map((n,s)=>jsx(Cell,{fill:c[s%c.length]},`${n.name}-${s.toString()}`))})]})})},De=({element:e})=>{let{chart:t$1,title:n}=e.props,s=useId().replace(/[^a-zA-Z0-9]/g,""),[a,i]=useState(null),[l,f]=useState(null);return useEffect(()=>{let k=false;return (async()=>{try{let{default:d}=await import('mermaid'),F=document.documentElement.classList.contains("dark");d.initialize({securityLevel:"strict",startOnLoad:!1,theme:F?"dark":"default"});let O=await d.render(`fk-mermaid-${s}`,t$1);k||(i(O.svg),f(null));}catch(d){k||f(d instanceof Error?d.message:"Failed to render the diagram.");}})(),()=>{k=true;}},[t$1,s]),jsxs("div",{className:"fk:w-full fk:rounded-lg fk:border fk:border-border fk:bg-card fk:p-4 fk:corner-squircle",children:[n&&jsx("div",{className:"fk:mb-2 fk:text-sm fk:font-medium",children:n}),l?jsx("pre",{className:"fk:overflow-x-auto fk:whitespace-pre-wrap fk:text-xs fk:text-muted-foreground",children:t$1}):null,!l&&a?jsx("div",{className:"fk:flex fk:justify-center fk:overflow-x-auto",dangerouslySetInnerHTML:{__html:a}}):null,!l&&!a?jsx(t,{className:"fk:h-40 fk:w-full"}):null]})},Ue={Accordion:Ie,Alert:Ae,Badge:Te,BarChart:We,Callout:Fe,Card:pe,Grid:xe,Heading:we,Image:$e,LineChart:_e,Link:Me,Mermaid:De,Metric:He,PieChart:Ve,Progress:ze,Separator:Ce,Skeleton:Ke,Stack:be,TabContent:qe,Table:Le,Tabs:Ee,Text:Se,Timeline:Ge},Ye=({element:e})=>jsxs("div",{className:"fk:rounded-md fk:border fk:border-dashed fk:border-border fk:p-3 fk:text-sm fk:text-muted-foreground fk:corner-squircle",children:["Unsupported component: ",e.type]});function Ze(e,t){let n=new Set,s=[];for(let a of e??[]){let i=String(a);n.has(i)||!t[i]||(n.add(i),s.push(i));}return s}function Qe(e,t){return e.length!==t.length?true:t.some((n,s)=>n!==e[s])}function et(e){if(!e.elements[e.root])return null;let t=false,n={};for(let s of Object.keys(e.elements)){let a=e.elements[s];if(!a)continue;let i=a.children??[],l=Ze(i,e.elements),f=Qe(i,l);f&&(t=true),n[s]=f?{...a,children:l}:a;}return t?{...e,elements:n}:e}var tt="data-spec";function rt(e){let t=new Set,n=[];for(let s of e){if(s.type!==tt)continue;let a=s.data;if(a&&typeof a=="object"&&"type"in a&&a.type==="patch"&&"patch"in a){let i=JSON.stringify(a.patch);if(t.has(i))continue;t.add(i);}n.push(s);}return n}function ft({parts:e}){let t=useMemo(()=>{let s=buildSpecFromParts(rt(e));return s?et(s):null},[e]),n=useMemo(()=>JSON.stringify(t?.state??{}),[t]);return t?jsx(StateProvider,{initialState:t.state,children:jsx(VisibilityProvider,{children:jsx(ActionProvider,{children:jsx(Renderer,{fallback:Ye,registry:Ue,spec:t})})})},n):null}export{ft as RunSpecPart};//# sourceMappingURL=spec-renderer-EX7SCFWH.js.map
|
|
2
|
-
//# sourceMappingURL=spec-renderer-EX7SCFWH.js.map
|