@taskforcehq/taskforce 0.3.320 → 0.3.322
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/TaskforceCore.js +8 -3
- package/dist/hooks/workspace/useTaskforceWorkspaceBootstrap.js +29 -5
- package/dist/mcp/runtime.js +72 -10
- package/dist/mcp/taskPlanningRegistrar.js +1 -0
- package/dist/server/routes/admin.d.ts +1 -0
- package/dist/server/routes/admin.js +17 -0
- package/dist/ui/assets/{AgentsModule-BZG0WHDN.js → AgentsModule-7jpDeuVR.js} +1 -1
- package/dist/ui/assets/{AnnotatedAttachmentWorkspace-EQEzsETm.js → AnnotatedAttachmentWorkspace-BJLe8DFj.js} +1 -1
- package/dist/ui/assets/{ContextAttachmentManager-B3hESx6y.js → ContextAttachmentManager-AmEny3eI.js} +1 -1
- package/dist/ui/assets/{DocumentWorkspace-Z7bykYtA.js → DocumentWorkspace-Cqdq31Ha.js} +1 -1
- package/dist/ui/assets/{EntityActivityTimeline-B2aXkxiE.js → EntityActivityTimeline-BlS7DhA4.js} +1 -1
- package/dist/ui/assets/{InitiativesModule-CSzXelzW.js → InitiativesModule-C1qfO1uZ.js} +1 -1
- package/dist/ui/assets/{PlansPage-2vebpTBs.js → PlansPage-DFt5w-0Y.js} +1 -1
- package/dist/ui/assets/{TaskContextUpload-Bz06La5A.js → TaskContextUpload-zuro5gDT.js} +1 -1
- package/dist/ui/assets/{TaskSettings-4PbrcOqD.js → TaskSettings-CJPC2Bft.js} +1 -1
- package/dist/ui/assets/{WorkflowsModule-AyOzrP3y.js → WorkflowsModule-CEEGuxsf.js} +1 -1
- package/dist/ui/assets/documentReferences-Ca2P--i5.js +1 -0
- package/dist/ui/assets/index-CGDQY0nN.js +5 -0
- package/dist/ui/index.html +1 -1
- package/package.json +1 -1
- package/dist/ui/assets/documentReferences-CKk8ylqA.js +0 -1
- package/dist/ui/assets/index-rB9GGUCz.js +0 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as l,j as e,R as Ke}from"./vendor-react-CKJs5o3c.js";import{p as gn,t as s,T as Ls,P as Ve,A as Ps,I as de,r as X,D as xn,a as ra,b as yn,l as ja,c as bn,d as ca}from"./index-
|
|
1
|
+
import{r as l,j as e,R as Ke}from"./vendor-react-CKJs5o3c.js";import{p as gn,t as s,T as Ls,P as Ve,A as Ps,I as de,r as X,D as xn,a as ra,b as yn,l as ja,c as bn,d as ca}from"./index-CGDQY0nN.js";import{T as qe,P as as,X as Is,g as ka,f as Ca,I as ht,a6 as _s,n as vn,h as _e,q as Na,a7 as da,m as ce,d as fn,a8 as pa,a9 as ua,aa as yt,L as Ta,ab as jn,b as ae,j as Te,ac as kn,ad as Cn,p as Nn,ae as bt,a as gt,af as Tn,Z as ws,B as ma,c as Ss,o as wn,a0 as ha,ag as Sn,ah as $n,ai as wa,aj as In,ak as _n,al as Ln,am as Pn}from"./vendor-icons-CLnehDTw.js";import"./vendor-markdown-BUxTU7dS.js";import"./vendor-dnd-DRzYolkg.js";import"./vendor-router-BbWMxlnO.js";const An={aiProfileToken:"X-Taskforce-AI-Profile-Token",aiProfileName:"X-Taskforce-AI-Name",aiProfileIcon:"X-Taskforce-AI-Icon",aiProfileColor:"X-Taskforce-AI-Color",aiProfileDescription:"X-Taskforce-AI-Description",aiProfileRole:"X-Taskforce-AI-Role",aiProfileProvider:"X-Taskforce-AI-Provider",aiProfileModel:"X-Taskforce-AI-Model",aiProfileSurfaceType:"X-Taskforce-AI-Surface-Type"};function Ne(a){return String(a||"").trim()||null}function Bn(a){return a==null?null:gn(a)}function Mn(a){return{aiProfileToken:Ne(a.aiProfileToken),aiProfileName:Ne(a.aiProfileName),aiProfileIcon:Ne(a.aiProfileIcon),aiProfileColor:Ne(a.aiProfileColor),aiProfileDescription:Ne(a.aiProfileDescription),aiProfileRole:Ne(a.aiProfileRole),aiProfileProvider:Ne(a.aiProfileProvider),aiProfileModel:Ne(a.aiProfileModel),aiProfileSurfaceType:Bn(a.aiProfileSurfaceType)}}function Dn(a){const o=Mn(a),h={};for(const[g,b]of Object.entries(An)){const N=o[g];N&&(h[b]=N)}return h}const ga={general:{name:"Taskforce MCP Agent",icon:"Bot",role:"AI collaborator",provider:"MCP client",model:"Local MCP",surfaceType:"agent"},cursor:{name:"Cursor",icon:"Bot",role:"IDE coding assistant",provider:"Cursor",model:"Cursor",surfaceType:"ide"},cline:{name:"Cline",icon:"Bot",role:"IDE coding assistant",provider:"Cline",model:"Cline",surfaceType:"ide"},vscode:{name:"VS Code Copilot",icon:"Bot",role:"IDE coding assistant",provider:"Microsoft",model:"Copilot",surfaceType:"ide"},windsurf:{name:"Windsurf",icon:"Bot",role:"IDE coding assistant",provider:"Windsurf",model:"Windsurf",surfaceType:"ide"},antigravity:{name:"Antigravity",icon:"Bot",role:"Coding agent",provider:"Google",model:"Antigravity",surfaceType:"coding_tool"},openclaw:{name:"OpenClaw",icon:"Bot",role:"AI agent",provider:"OpenClaw",model:"OpenClaw",surfaceType:"agent"},codex:{name:"Codex",icon:"Bot",role:"Coding agent",provider:"OpenAI",model:"Codex",surfaceType:"cli"},"claude-code":{name:"Claude Code",icon:"Bot",role:"Coding agent",provider:"Anthropic",model:"Claude Code",surfaceType:"cli"},"gemini-cli":{name:"Gemini CLI",icon:"Bot",role:"Coding agent",provider:"Google",model:"Gemini CLI",surfaceType:"cli"},"claude-desktop":{name:"Claude Desktop",icon:"Bot",role:"Desktop AI collaborator",provider:"Anthropic",model:"Claude Desktop",surfaceType:"chat_app"},"chatgpt-desktop":{name:"ChatGPT Desktop",icon:"Bot",role:"Desktop AI collaborator",provider:"OpenAI",model:"ChatGPT Desktop",surfaceType:"chat_app"}};function En(a){const o=ga[a]||ga.general;return{TASKFORCE_AI_NAME:o.name,TASKFORCE_AI_ICON:o.icon,TASKFORCE_AI_ROLE:o.role,TASKFORCE_AI_PROVIDER:o.provider,TASKFORCE_AI_MODEL:o.model,TASKFORCE_AI_SURFACE_TYPE:o.surfaceType}}const xt=[{id:"general",label:"General"},{id:"antigravity",label:"Antigravity"},{id:"claude-code",label:"Claude Code CLI"},{id:"cline",label:"Cline"},{id:"codex",label:"Codex"},{id:"cursor",label:"Cursor"},{id:"gemini-cli",label:"Gemini CLI"},{id:"openclaw",label:"OpenClaw"},{id:"vscode",label:"VS Code / Copilot"},{id:"windsurf",label:"Windsurf"}];function vt(a,o){return String(a||"").toLowerCase().replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/-+/g,"-").replace(/^[-_]+|[-_]+$/g,"")||o.toLowerCase()}function Rn(a,o){const g=vt(a||o||"workspace","workspace").slice(0,25)||"workspace";return vt(`taskforce-${g}`,"taskforce-workspace")}function zn(a,o){return o}function Gn(a){return{Authorization:`Bearer ${a.tokenValue}`,...Dn(a)}}function On(a){return`${a} Keep the generated AI bootstrap headers intact so Taskforce can bind and restore the same AI profile automatically.`}function xe(a,o){return On(`${a} Use the generated config exactly as shown.`)}function ye(a){return`${a} Use the generated config exactly as shown. No token is required for local stdio MCP.`}function ft(a){return JSON.stringify(a)}function Fn(a){return`[${a.map(o=>ft(o)).join(", ")}]`}function Hn(a){return!a||Object.keys(a).length===0?[]:[`env = { ${Object.entries(a).map(([o,h])=>`${o} = ${ft(h)}`).join(", ")} }`]}function xa(a){return/^[A-Za-z0-9_./:@%+=,-]+$/.test(a)?a:`'${a.replace(/'/g,`'"'"'`)}'`}function Wn(a){const{clientId:o,endpoint:h,tokenValue:g,serverId:b}=a,N=Gn(a);N.Authorization;const w=Object.entries(N).filter(([$])=>$!=="Authorization").map(([$,A])=>` --header "${$}: ${A}"`).join("");switch(o){case"general":return{clientId:o,kind:"json",rootKey:"mcpServers",serverConfig:{url:h,headers:N},instructionLabel:"General MCP Configuration Instructions",instructionText:xe("Add this server to your MCP client using its standard remote HTTP configuration format.")};case"cursor":return{clientId:o,kind:"json",rootKey:"mcpServers",serverConfig:{url:h,headers:N},instructionLabel:"Cursor Configuration Instructions",instructionText:xe("Open Cursor settings, find MCP servers, and paste this config.")};case"cline":return{clientId:o,kind:"json",rootKey:"mcpServers",serverConfig:{url:h,type:"streamableHttp",headers:N},instructionLabel:"Cline Configuration Instructions",instructionText:xe("Open Cline MCP Servers, add a remote server, or paste this into the Cline MCP config with Streamable HTTP selected.")};case"vscode":return{clientId:o,kind:"json",rootKey:"servers",serverConfig:{type:"http",url:h,headers:N},instructionLabel:"VS Code Configuration Instructions",instructionText:xe("Open .vscode/mcp.json or MCP: Open User Configuration and add this server under the servers object.")};case"windsurf":return{clientId:o,kind:"json",rootKey:"mcpServers",serverConfig:{serverUrl:h,headers:N},instructionLabel:"Windsurf Configuration Instructions",instructionText:xe("Open Windsurf MCP settings, add a server, and paste this config.")};case"antigravity":return{clientId:o,kind:"json",rootKey:"mcpServers",serverConfig:{serverUrl:h,headers:N},instructionLabel:"Antigravity Configuration Instructions",instructionText:xe("Open Antigravity MCP settings, view the raw config, and paste this Antigravity-specific configuration.")};case"openclaw":return{clientId:o,kind:"json",rootKey:"servers",wrapperKeys:["mcp"],serverConfig:{transport:"streamable-http",url:h,headers:N},instructionLabel:"OpenClaw Configuration Instructions",instructionText:xe("Open ~/.openclaw/openclaw.json and add this server under mcp.servers.")};case"codex":return{clientId:o,kind:"text",renderedText:[`[mcp_servers.${b}]`,`url = "${h}"`,`http_headers = { ${Object.entries(N).map(([$,A])=>`${$} = "${A}"`).join(", ")} }`].join(`
|
|
2
2
|
`),instructionLabel:"Codex Configuration Instructions",instructionText:xe("Open ~/.codex/config.toml and add this Codex MCP entry.")};case"claude-code":return{clientId:o,kind:"text",renderedText:`claude mcp add --transport http ${b} ${h} --header "Authorization: Bearer ${g}"${w}`,instructionLabel:"Claude Code Configuration Instructions",instructionText:xe("Run this Claude Code command in your terminal to add the remote Taskforce MCP server.")};case"gemini-cli":return{clientId:o,kind:"text",renderedText:`gemini mcp add ${b} ${h} --transport http --header "Authorization: Bearer ${g}"${w}`,instructionLabel:"Gemini CLI Configuration Instructions",instructionText:xe("Run this Gemini CLI command in your terminal to add the remote Taskforce MCP server. Add --scope user if you want it available across all projects.")};case"claude-desktop":return{clientId:o,kind:"text",renderedText:zn(o,h),instructionLabel:"Claude Desktop Configuration Instructions",instructionText:"Open Claude Desktop Settings > Connectors, paste this MCP server URL, and complete the Taskforce OAuth flow to authorize one workspace."};case"chatgpt-desktop":return{clientId:o,kind:"text",renderedText:h,instructionLabel:"ChatGPT Desktop Configuration Instructions",instructionText:"Open ChatGPT Apps & Connectors / developer mode, paste this MCP server URL, and complete the Taskforce OAuth authorize flow when ChatGPT opens it."};default:{const $=o;throw new Error(`Unsupported MCP client: ${$}`)}}}function Un(a){const{clientId:o,serverId:h,serverConfig:g}=a,b={command:g.command,args:g.args,...g.env&&Object.keys(g.env).length>0?{env:g.env}:{}},N=Object.entries(g.env||{}).map(([$,A])=>` --env ${xa(`${$}=${A}`)}`).join(""),w=[g.command,...g.args].map($=>xa($)).join(" ");switch(o){case"general":return{clientId:o,kind:"json",rootKey:"mcpServers",serverConfig:b,instructionLabel:"General MCP Configuration Instructions",instructionText:ye("Add this server to your MCP client using its standard local stdio configuration format.")};case"cursor":return{clientId:o,kind:"json",rootKey:"mcpServers",serverConfig:b,instructionLabel:"Cursor Configuration Instructions",instructionText:ye("Open Cursor settings, find MCP servers, and paste this local stdio config.")};case"cline":return{clientId:o,kind:"json",rootKey:"mcpServers",serverConfig:b,instructionLabel:"Cline Configuration Instructions",instructionText:ye("Open Cline MCP Servers and paste this local stdio server config.")};case"vscode":return{clientId:o,kind:"json",rootKey:"servers",serverConfig:{type:"stdio",...b},instructionLabel:"VS Code Configuration Instructions",instructionText:ye("Open .vscode/mcp.json or MCP: Open User Configuration and add this server under the servers object.")};case"windsurf":return{clientId:o,kind:"json",rootKey:"mcpServers",serverConfig:b,instructionLabel:"Windsurf Configuration Instructions",instructionText:ye("Open Windsurf MCP settings and paste this local stdio config.")};case"antigravity":return{clientId:o,kind:"json",rootKey:"mcpServers",serverConfig:b,instructionLabel:"Antigravity Configuration Instructions",instructionText:ye("Open Antigravity MCP settings, view the raw config, and paste this local stdio configuration.")};case"openclaw":return{clientId:o,kind:"json",rootKey:"servers",wrapperKeys:["mcp"],serverConfig:{transport:"stdio",...b},instructionLabel:"OpenClaw Configuration Instructions",instructionText:ye("Open ~/.openclaw/openclaw.json and add this local stdio server under mcp.servers.")};case"codex":return{clientId:o,kind:"text",renderedText:[`[mcp_servers.${h}]`,`command = ${ft(g.command)}`,`args = ${Fn(g.args)}`,...Hn(g.env)].join(`
|
|
3
3
|
`),instructionLabel:"Codex Configuration Instructions",instructionText:ye("Open ~/.codex/config.toml and add this local MCP entry.")};case"claude-code":return{clientId:o,kind:"text",renderedText:`claude mcp add ${h}${N} -- ${w}`,instructionLabel:"Claude Code Configuration Instructions",instructionText:ye("Run this Claude Code command in your terminal to add the local Taskforce MCP server.")};case"gemini-cli":return{clientId:o,kind:"json",rootKey:"mcpServers",serverConfig:b,instructionLabel:"Gemini CLI Configuration Instructions",instructionText:ye("Open ~/.gemini/settings.json and add this local MCP server under mcpServers.")};case"claude-desktop":case"chatgpt-desktop":throw new Error(`Unsupported local MCP client: ${o}`);default:{const $=o;throw new Error(`Unsupported local MCP client: ${$}`)}}}const Kn="_categoryManagerContainer_1ibti_1",Vn="_pathInputGroupStretch_1ibti_9",qn="_emptyStateItalic_1ibti_13",Jn="_emptyStateBox_1ibti_28",Yn="_emptyStateBare_1ibti_44",Xn="_emptyStateIcon_1ibti_49",Zn="_taxonomyGrid_1ibti_55",Qn="_checkboxRow_1ibti_61",ei="_checkboxLabel_1ibti_67",si="_checkboxSmall_1ibti_75",ti="_flexGap8_1ibti_80",ai="_optionOrderButtons_1ibti_85",ni="_addTaxonomyBtnSmall_1ibti_92",R={categoryManagerContainer:Kn,pathInputGroupStretch:Vn,emptyStateItalic:qn,emptyStateBox:Jn,emptyStateBare:Yn,emptyStateIcon:Xn,taxonomyGrid:Zn,checkboxRow:Qn,checkboxLabel:ei,checkboxSmall:si,flexGap8:ti,optionOrderButtons:ai,addTaxonomyBtnSmall:ni},ii="_taxonomyDrillDown_1oekr_1",oi="_drillDownList_1oekr_7",li="_librarySection_1oekr_13",ri="_libraryLauncher_1oekr_18",ci="_libraryLauncherInfo_1oekr_40",di="_libraryLauncherIcon_1oekr_47",pi="_libraryLauncherText_1oekr_60",ui="_libraryLauncherLabel_1oekr_67",mi="_libraryLauncherSubtext_1oekr_73",hi="_libraryLauncherMeta_1oekr_79",gi="_drillDownSection_1oekr_89",xi="_drillDownSectionHeader_1oekr_95",yi="_drillDownSectionTitle_1oekr_102",bi="_drillDownItem_1oekr_111",vi="_drillDownItemAction_1oekr_126",fi="_drillDownItemDimmed_1oekr_145",ji="_drillDownItemInfo_1oekr_153",ki="_drillDownItemText_1oekr_159",Ci="_drillDownItemLabel_1oekr_165",Ni="_drillDownItemSubtext_1oekr_170",Ti="_systemIcon_1oekr_175",wi="_chevron_1oekr_179",Si="_orderButtons_1oekr_184",$i="_createOverlay_1oekr_195",Ii="_createDialog_1oekr_209",_i="_createDialogTitle_1oekr_218",Li="_inputGroup_1oekr_224",Pi="_dialogActions_1oekr_228",Ai="_createSubmit_1oekr_234",Bi="_createCancel_1oekr_238",Mi="_taxonomyDetailView_1oekr_242",Di="_detailHeader_1oekr_249",Ei="_taxonomyBreadcrumbs_1oekr_257",Ri="_breadcrumbPrev_1oekr_263",zi="_breadcrumbIcon_1oekr_284",Gi="_breadcrumbDivider_1oekr_288",Oi="_breadcrumbActive_1oekr_293",Fi="_detailContent_1oekr_301",y={taxonomyDrillDown:ii,drillDownList:oi,librarySection:li,libraryLauncher:ri,libraryLauncherInfo:ci,libraryLauncherIcon:di,libraryLauncherText:pi,libraryLauncherLabel:ui,libraryLauncherSubtext:mi,libraryLauncherMeta:hi,drillDownSection:gi,drillDownSectionHeader:xi,drillDownSectionTitle:yi,drillDownItem:bi,drillDownItemAction:vi,drillDownItemDimmed:fi,drillDownItemInfo:ji,drillDownItemText:ki,drillDownItemLabel:Ci,drillDownItemSubtext:Ni,systemIcon:Ti,chevron:wi,orderButtons:Si,createOverlay:$i,createDialog:Ii,createDialogTitle:_i,inputGroup:Li,dialogActions:Pi,createSubmit:Ai,createCancel:Bi,taxonomyDetailView:Mi,detailHeader:Di,taxonomyBreadcrumbs:Ei,breadcrumbPrev:Ri,breadcrumbIcon:zi,breadcrumbDivider:Gi,breadcrumbActive:Oi,detailContent:Fi};function Hi(a){const o=[{id:"categories",label:a.displayLabels?.category||"Categories",kind:"system",summary:`${a.categories.length} configured`},{id:"types",label:a.displayLabels?.type||"Task Types",kind:"system",summary:`${a.types.length} active`},{id:"priorities",label:a.displayLabels?.priority||"Priority Levels",kind:"system",summary:`${a.priorities.length} levels`},{id:"complexities",label:"Complexity",kind:"attribute",summary:a.manualComplexityEnabled?"Enabled":"Disabled (default)"}],h=a.taxonomies.map(g=>({id:g.id,label:g.label,kind:"custom",summary:`${g.options.length} options${g.status==="retired"?" · Retired":""}`,taxonomy:g}));return[...o,...h]}function Wi({taxonomy:a,onUpdateTaxonomy:o,onRemoveTaxonomy:h,onRestoreTaxonomy:g}){const[b,N]=l.useState(""),[w,$]=l.useState(!1),[A,z]=l.useState(""),[O,j]=l.useState(a.label),[I,P]=l.useState((a.aliases||[]).join(", ")),[U,B]=l.useState(""),[x,S]=l.useState(null),E=n=>{const d=n.split(",").map(L=>L.trim()).filter(Boolean);return d.length>0?Array.from(new Set(d)):void 0};l.useEffect(()=>{j(a.label),P((a.aliases||[]).join(", "));const n=a.options.find(d=>String(d.value)===String(b));S(n||null),B((n?.aliases||[]).join(", "))},[a,b]);const C=n=>{o({...a,...n})},M=()=>{if(!A.trim())return;const n=A.toLowerCase().trim().replace(/\s+/g,"-");if(a.options.some(L=>L.value===n)){alert("Option value already exists");return}const d={value:n,label:A.trim(),color:Ve[a.options.length%Ve.length],status:"active"};C({options:[...a.options,d]}),z(""),$(!1),N(n)},c=(n,d)=>{C({options:a.options.map(L=>String(L.value)===String(n)?{...L,...d}:L)})},W=n=>{c(n,{status:"retired"})},m=n=>{c(n,{status:"active"})},_=(n,d)=>{const L=a.options.findIndex(F=>String(F.value)===String(n));if(L<0)return;const f=L+d;if(f<0||f>=a.options.length)return;const G=[...a.options],[u]=G.splice(L,1);G.splice(f,0,u),C({options:G})};return e.jsxs("div",{className:R.categoryManagerContainer,children:[e.jsxs("div",{className:`${s.categoryConfigPanel} ${s.configPanel} ${s.marginBottom24}`,children:[e.jsxs("div",{className:`${s.flexBetween} ${s.marginBottom16}`,children:[e.jsx("div",{className:s.flex1,children:e.jsx("label",{className:`${s.subLabel} ${s.subLabelBlock} ${s.marginBottom8}`,children:"Taxonomy Settings"})}),!a.isSystem&&(a.status==="retired"?e.jsx("button",{type:"button",className:s.saveSettingsBtn,onClick:()=>g?.(a.id),children:"Restore Taxonomy"}):h&&e.jsxs("button",{type:"button",className:`${s.destructiveBtn} ${s.deleteBtnSmall}`,onClick:()=>{confirm(`Retire taxonomy "${a.label}"? Existing task data will be preserved as legacy values.`)&&h(a.id)},children:[e.jsx(qe,{size:14,className:s.trashIcon})," Retire Taxonomy"]}))]}),a.status==="retired"&&e.jsx("p",{className:s.settingsHint,style:{marginTop:"-4px",marginBottom:"16px"},children:"This taxonomy is retired. Existing tasks keep their values, but it is hidden from normal new-task entry unless a task already uses it."}),e.jsxs("div",{className:R.taxonomyGrid,children:[e.jsxs("div",{className:s.settingGroup,style:{margin:0},children:[e.jsx("label",{className:`${s.label} ${s.inputLabel}`,children:"Display Label"}),e.jsx("input",{className:s.input,value:O,onChange:n=>j(n.target.value),onBlur:()=>C({label:O}),disabled:a.isSystem,placeholder:"e.g. Sprint, Phase..."})]}),e.jsxs("div",{className:s.settingGroup,style:{margin:0},children:[e.jsx("label",{className:`${s.label} ${s.inputLabel}`,children:"Description"}),e.jsx("textarea",{className:s.textarea,value:a.description||"",onChange:n=>C({description:n.target.value}),placeholder:"Optional guidance for when and how to use this taxonomy...",rows:3,style:{minHeight:"88px"}})]}),e.jsxs("div",{className:s.settingGroup,style:{margin:0},children:[e.jsx("label",{className:`${s.label} ${s.inputLabel}`,children:"Aliases"}),e.jsx("input",{className:s.input,value:I,onChange:n=>P(n.target.value),onBlur:()=>C({aliases:E(I)}),placeholder:"Optional aliases, comma-separated"})]}),e.jsxs("div",{className:s.settingGroup,style:{margin:0},children:[e.jsx("label",{className:`${s.label} ${s.inputLabel}`,children:"Widget Type"}),e.jsxs("select",{className:s.select,value:a.widgetType,onChange:n=>{const d=n.target.value;C({widgetType:d,multiSelect:d==="level"?!1:a.multiSelect})},children:[e.jsx("option",{value:"select",children:"Dropdown (Select Box)"}),e.jsx("option",{value:"level",children:"Level Selector (Segmented)"})]})]})]}),e.jsxs("div",{className:R.checkboxRow,children:[e.jsxs("label",{className:R.checkboxLabel,children:[e.jsx("input",{type:"checkbox",checked:a.isRequired,onChange:n=>C({isRequired:n.target.checked}),className:R.checkboxSmall}),"Mark as Required"]}),e.jsxs("label",{className:`${R.checkboxLabel} ${a.widgetType==="level"?s.opacity50:""}`,children:[e.jsx("input",{type:"checkbox",checked:a.multiSelect,onChange:n=>C({multiSelect:n.target.checked}),disabled:a.widgetType==="level",className:R.checkboxSmall}),"Allow Multi-select"]})]}),e.jsxs("div",{className:R.checkboxRow,children:[e.jsxs("label",{className:R.checkboxLabel,children:[e.jsx("input",{type:"checkbox",checked:a.formEnabled!==!1,onChange:n=>C({formEnabled:n.target.checked}),className:R.checkboxSmall}),"Show in Task Form"]}),e.jsxs("label",{className:R.checkboxLabel,children:[e.jsx("input",{type:"checkbox",checked:a.filterEnabled!==!1,onChange:n=>C({filterEnabled:n.target.checked}),className:R.checkboxSmall}),"Show in Filters"]}),e.jsxs("label",{className:R.checkboxLabel,children:[e.jsx("input",{type:"checkbox",checked:a.sortEnabled===!0,onChange:n=>C({sortEnabled:n.target.checked}),className:R.checkboxSmall}),"Show in Sorts"]})]})]}),e.jsx("div",{className:`${s.configDivider} ${s.configDividerMargin24}`}),e.jsxs("div",{className:`${s.configPanel} ${s.flex1} ${s.flexCol}`,children:[e.jsxs("div",{className:`${s.headerFlex}`,style:{marginBottom:x&&!w||w?"16px":"0"},children:[e.jsx("div",{style:{flex:1},children:e.jsx(Ls,{value:b,options:[{value:"",label:"Select an option to configure...",icon:"HelpCircle",color:"var(--text-secondary)"},...a.options.map(n=>({value:n.value,label:n.status==="retired"?`${n.label} (Retired)`:n.label,icon:n.icon,color:n.color}))],onChange:n=>{N(n),$(!1)},disabled:w})}),w?e.jsx("button",{type:"button",onClick:()=>$(!1),title:"Cancel",className:`${s.browseBtn} ${s.cancelBtnRed}`,children:e.jsx(Is,{size:18})}):e.jsx("button",{type:"button",className:s.browseBtn,onClick:()=>$(!0),title:"Add Option",children:e.jsx(as,{size:18})})]}),w&&e.jsx("div",{className:`${s.configItem} ${s.marginBottom16}`,children:e.jsxs("div",{className:R.flexGap8,children:[e.jsx("input",{type:"text",className:s.input,placeholder:"New option label...",value:A,onChange:n=>z(n.target.value),onKeyDown:n=>{n.key==="Enter"&&M()},autoFocus:!0}),e.jsx("button",{type:"button",className:s.saveSettingsBtn,onClick:M,disabled:!A.trim(),children:"Add Option"})]})}),x&&!w&&e.jsxs("div",{className:s.flex1,children:[e.jsx("div",{className:`${s.configDivider} ${s.marginBottom20}`}),e.jsxs("div",{className:`${s.flexBetweenCenter} ${s.marginBottom20}`,children:[e.jsxs("div",{className:`${s.flexColGap4} ${s.flex1}`,children:[e.jsx("label",{className:`${s.label} ${s.inputLabel}`,children:"Option Label"}),e.jsxs("div",{className:s.gridConfig,children:[e.jsx("input",{className:s.input,value:x.label,onChange:n=>c(x.value,{label:n.target.value}),placeholder:"Option Label"}),x.status==="retired"?e.jsx("button",{type:"button",className:s.saveSettingsBtn,onClick:()=>m(x.value),title:"Restore Option",children:"Restore"}):e.jsxs("button",{type:"button",className:`${s.destructiveBtn} ${s.deleteBtnMedium}`,onClick:()=>W(x.value),title:"Retire Option",children:[e.jsx(qe,{size:14,className:s.trashIcon})," Retire"]})]})]}),e.jsxs("div",{className:R.optionOrderButtons,children:[e.jsx("button",{type:"button",className:s.browseBtn,title:"Move option up",onClick:()=>_(x.value,-1),disabled:a.options[0]?.value===x.value,children:e.jsx(ka,{size:16})}),e.jsx("button",{type:"button",className:s.browseBtn,title:"Move option down",onClick:()=>_(x.value,1),disabled:a.options[a.options.length-1]?.value===x.value,children:e.jsx(Ca,{size:16})})]})]}),e.jsx("p",{className:s.settingsHint,style:{marginBottom:"20px"},children:"Retired options stay visible for existing tasks and filters, but they should not be used for new work."}),e.jsxs("div",{className:s.settingGroup,style:{marginBottom:"20px"},children:[e.jsx("label",{className:`${s.label} ${s.inputLabel}`,children:"Aliases"}),e.jsx("input",{className:s.input,value:U,onChange:n=>B(n.target.value),onBlur:()=>c(x.value,{aliases:E(U)}),placeholder:"Optional aliases, comma-separated"})]}),e.jsx("div",{className:`${s.configDivider} ${s.configDividerMargin}`}),e.jsxs("div",{className:s.configSection,children:[e.jsx("label",{className:`${s.label} ${s.inputLabelBlock}`,children:"Visual Style"}),e.jsxs("div",{className:s.categorySubConfig,children:[e.jsx("div",{className:s.colorPickerGrid,children:Ve.map(n=>{const d=X(n)||"#000000",L=x.color===n,f=x.icon&&ht[x.icon]?ht[x.icon]:_s;return e.jsx("button",{type:"button",className:`${s.colorSwatch} ${L?s.colorSwatchActive:""}`,style:{borderColor:L?d:void 0,"--swatch-color":d,"--swatch-border-color":`${d}80`},onClick:()=>c(x.value,{color:n}),title:n,children:e.jsx(f,{size:14,style:{color:d}})},n)})}),e.jsx("div",{className:s.iconGrid,children:Ps.map(n=>{const d=ht[n]||de[n]||_s;return e.jsx("button",{type:"button",className:`${s.iconPickerBtn} ${x.icon===n?s.iconPickerBtnActive:""}`,style:x.icon===n?{borderColor:X(x.color),color:X(x.color),background:`${X(x.color)}15`}:{},onClick:()=>c(x.value,{icon:n}),title:n,children:e.jsx(d,{size:16})},n)})})]})]})]}),!x&&!w&&e.jsxs("div",{className:`${R.emptyStateBox} ${R.emptyStateBare}`,children:[e.jsx(vn,{size:24,className:R.emptyStateIcon}),"Select an option above to configure its appearance"]})]})]})}function Ui(a){const{displayLabel:o,categories:h,pathValidation:g,onUpdateDisplayLabel:b,onUpdateCategory:N,onRemoveCategory:w,onSaveCategory:$,onAddPath:A,onRemovePath:z,onUpdateCategoryIcon:O,onUpdateCategoryColor:j,onBrowseFolders:I}=a,[P,U]=l.useState(""),[B,x]=l.useState(!1),[S,E]=l.useState(""),[C,M]=l.useState(""),[c,W]=l.useState(o||""),[m,_]=l.useState("");l.useEffect(()=>{W(o||"")},[o]),l.useEffect(()=>{const u=h.find(F=>F.value===P);u&&M(u.label)},[P,h]);const n=()=>{if(!S.trim())return;$(S);const u=S.trim().toLowerCase().replace(/\s+/g,"-");E(""),x(!1),setTimeout(()=>U(u),100)},d=u=>{C&&C!==u.label&&N({...u,label:C},u.label)},L=u=>{const F=[];if(u.path&&F.push(u.path),u.paths&&u.paths.length>0)for(const K of u.paths)F.includes(K)||F.push(K);return F},f=h.find(u=>u.value===P),G=f?.value===xn;return e.jsxs("div",{className:`${s.configPanel} ${s.flex1}`,children:[e.jsxs("div",{className:`${s.headerFlex}`,style:{marginBottom:f&&!B||B?"20px":"0"},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx("label",{id:"category-config-label",className:s.label,style:{display:"none"},children:"Select Category"}),e.jsx(Ls,{value:P,options:[{value:"",label:"Select a category to configure...",icon:"HelpCircle",color:"var(--text-secondary)"},...h.map(u=>({value:u.value,label:`${u.label}${u.disabled?" (Legacy)":""}`,icon:u.icon,color:u.color}))],onChange:u=>{U(String(u)),x(!1)},disabled:B,ariaLabelledBy:"category-config-label"})]}),B?e.jsx("button",{type:"button",className:`${s.browseBtn} ${s.cancelBtnRed}`,onClick:()=>x(!1),title:"Cancel creation",children:e.jsx(Is,{size:18})}):e.jsx("button",{type:"button",className:s.browseBtn,onClick:()=>x(!0),title:"Create new category",children:e.jsx(as,{size:18})})]}),B&&e.jsxs("div",{className:`${s.configItem} ${s.marginBottom16}`,children:[e.jsx("div",{className:`${s.labelRow} ${s.marginBottom8}`,children:e.jsx("label",{className:s.settingsLabel,children:"New Category Name"})}),e.jsxs("div",{style:{display:"flex",gap:"8px"},children:[e.jsx("input",{type:"text",className:s.input,placeholder:"e.g. Backend, Frontend, API...",value:S,onChange:u=>E(u.target.value),onKeyDown:u=>{u.key==="Enter"&&n()},autoFocus:!0}),e.jsx("button",{type:"button",className:s.saveSettingsBtn,onClick:n,disabled:!S.trim(),children:"Create"})]})]}),f&&!B&&e.jsxs("div",{className:s.flex1,style:{overflowY:"auto",marginRight:"-8px",paddingRight:"8px"},children:[e.jsx("div",{className:`${s.configDivider} ${s.marginBottom20}`}),e.jsxs("div",{className:`${s.configSection} ${s.marginBottom20}`,children:[e.jsxs("div",{className:s.flexBetween,children:[e.jsx("label",{className:`${s.subLabel} ${s.subLabelBlock}`,children:"General"}),!G&&e.jsxs("button",{type:"button",onClick:()=>{confirm(`Retire category "${f.label}"? Existing tasks will be reassigned to ${ra}.`)&&(w(f.value),U(""))},title:"Retire Category",className:`${s.destructiveBtn} ${s.deleteBtnSmall}`,children:[e.jsx(qe,{size:14,className:s.trashIcon})," Retire"]})]}),G&&e.jsxs("p",{className:s.settingsHint,style:{marginBottom:"12px"},children:[ra," is the protected fallback category and cannot be retired."]}),e.jsxs("div",{className:s.gridConfig,children:[e.jsxs("div",{className:s.flexColGap4,children:[e.jsx("label",{className:`${s.label} ${s.inputLabel}`,children:"Display Label"}),e.jsx("input",{className:s.input,value:c,onChange:u=>W(u.target.value),onBlur:()=>b?.(c.trim())})]}),e.jsxs("div",{className:s.flexColGap4,children:[e.jsx("label",{className:`${s.label} ${s.inputLabel}`,children:"Label"}),e.jsx("input",{className:s.input,value:C,onChange:u=>M(u.target.value),onBlur:()=>d(f),onKeyDown:u=>{u.key==="Enter"&&(d(f),u.target.blur())}})]}),e.jsxs("div",{className:s.flexColGap4Center,children:[e.jsx("label",{className:`${s.label} ${s.inputLabel}`,children:"Available for New Tasks"}),e.jsx("input",{type:"checkbox",checked:!f.disabled,onChange:()=>N({...f,disabled:!f.disabled}),className:s.checkboxInput})]})]}),e.jsx("p",{className:s.settingsHint,style:{marginTop:"12px"},children:"Turn this off to keep the category on existing tasks while removing it from new task selection by default."})]}),e.jsx("div",{className:`${s.configDivider} ${s.configDividerMargin}`}),e.jsxs("div",{className:`${s.configSection} ${s.marginBottom20}`,children:[e.jsx("label",{className:s.subLabel,style:{fontSize:"14px",fontWeight:600,display:"block",marginBottom:"8px"},children:"Context Paths"}),e.jsx("p",{className:s.settingsHint,style:{marginBottom:"12px"},children:"Files in these paths will be included as context for tasks in this category."}),L(f).length>0&&e.jsx("div",{className:`${s.pathList} ${s.pathListMargin}`,children:L(f).map((u,F)=>{const K=g[u],ee=K?.exists,Je=K?.isFile;return e.jsxs("div",{className:`${s.pathChip} ${ee===!1?s.pathInvalid:ee?s.pathValid:""}`,children:[ee===void 0?e.jsx(_e,{size:12,className:s.spinner}):ee?Je?e.jsx(Na,{size:12,className:s.pathValidIcon}):e.jsx(da,{size:12,className:s.pathValidIcon}):e.jsx(ce,{size:12,className:s.pathInvalidIcon}),e.jsx("span",{className:s.pathText,title:u,children:u}),e.jsx("button",{type:"button",className:s.removePathBtn,onClick:()=>z(f.value,u),title:"Remove path",children:e.jsx(Is,{size:10})})]},F)})}),e.jsxs("div",{className:`${s.pathInputGroup} ${R.pathInputGroupStretch}`,children:[e.jsx("input",{type:"text",className:s.input,value:m,onChange:u=>_(u.target.value),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),m.trim()&&(A(f.value,m.trim()),_("")))},placeholder:"Add path (e.g. frontend/src/...)"}),e.jsx("button",{type:"button",className:s.browseBtn,onClick:()=>{m.trim()&&(A(f.value,m.trim()),_(""))},disabled:!m.trim(),title:"Add path",children:e.jsx(as,{size:18})}),e.jsx("button",{type:"button",className:s.browseBtn,onClick:()=>I(f.value),title:"Browse folders",children:e.jsx(da,{size:16})})]})]}),e.jsx("div",{className:`${s.configDivider} ${s.configDividerMargin}`}),e.jsxs("div",{className:s.configSection,children:[e.jsx("label",{className:`${s.subLabel} ${s.subLabelBlock} ${s.subLabelBlock12}`,children:"Visual Style"}),e.jsxs("div",{className:s.categorySubConfig,children:[e.jsx("div",{className:s.colorPickerGrid,children:Ve.map(u=>{const F=X(u)||"#000000",K=f.color===u,ee=f.icon&&de[f.icon]?de[f.icon]:fn;return e.jsx("button",{type:"button",className:`${s.colorSwatch} ${K?s.colorSwatchActive:""}`,style:{borderColor:K?F:void 0,"--swatch-color":F,"--swatch-border-color":`${F}80`},onClick:()=>j(f.value,u),title:u,children:e.jsx(ee,{size:14,style:{color:F}})},u)})}),e.jsx("div",{className:s.iconGrid,children:Ps.map(u=>{const F=de[u];return e.jsx("button",{type:"button",className:`${s.iconPickerBtn} ${f.icon===u?s.iconPickerBtnActive:""}`,style:f.icon===u?{borderColor:X(f.color),color:X(f.color),background:`${X(f.color)}15`}:{},onClick:()=>O(f.value,u),title:u,children:e.jsx(F,{size:16})},u)})})]})]})]}),!f&&!B&&e.jsx("div",{className:`${R.emptyStateItalic} ${R.emptyStateBare}`,children:"Select a category above to configure settings"})]})}function Ki(a){const{types:o,onSaveType:h,onRemoveType:g,onUpdateType:b,displayLabel:N,onUpdateDisplayLabel:w}=a,[$,A]=l.useState(""),[z,O]=l.useState(!1),[j,I]=l.useState(""),[P,U]=l.useState(""),[B,x]=l.useState(N||"");l.useEffect(()=>{const c=o.find(W=>W.value===$);c&&U(c.label)},[$,o]),l.useEffect(()=>{x(N||"")},[N]);const S=o.find(c=>c.value===$),E=S?.value===yn,C=S?.status==="retired",M=()=>{if(!j.trim())return;h(j);const c=j.trim().toLowerCase().replace(/\s+/g,"-");I(""),O(!1),setTimeout(()=>A(c),100)};return e.jsxs("div",{className:`${s.configPanel} ${s.flex1}`,children:[e.jsxs("div",{className:`${s.headerFlex}`,style:{marginBottom:S&&!z||z?"20px":"0"},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx("label",{id:"type-config-label",className:s.label,style:{display:"none"},children:"Select Type"}),e.jsx(Ls,{value:$,options:[{value:"",label:"Select a type to configure...",icon:"HelpCircle",color:"var(--text-secondary)"},...o.map(c=>({value:c.value,label:c.status==="retired"?`${c.label} (Retired)`:c.label,icon:c.icon||"Box",color:c.color||"violet-500"}))],onChange:c=>{A(String(c)),O(!1)},disabled:z,ariaLabelledBy:"type-config-label"})]}),z?e.jsx("button",{type:"button",className:`${s.browseBtn} ${s.cancelBtnRed}`,onClick:()=>O(!1),title:"Cancel creation",children:e.jsx(Is,{size:18})}):e.jsx("button",{type:"button",className:s.browseBtn,onClick:()=>O(!0),title:"Create new type",children:e.jsx(as,{size:18})})]}),z&&e.jsxs("div",{className:`${s.configItem} ${s.marginBottom16}`,children:[e.jsx("div",{className:`${s.labelRow} ${s.marginBottom8}`,children:e.jsx("label",{className:s.settingsLabel,children:"New Type Label"})}),e.jsxs("div",{style:{display:"flex",gap:"8px"},children:[e.jsx("input",{type:"text",className:s.input,placeholder:"e.g. Bug, Feature, Chore...",value:j,onChange:c=>I(c.target.value),onKeyDown:c=>{c.key==="Enter"&&M()},autoFocus:!0}),e.jsx("button",{type:"button",className:s.saveSettingsBtn,onClick:M,disabled:!j.trim(),children:"Create"})]})]}),S&&!z&&e.jsxs("div",{className:s.flex1,children:[e.jsx("div",{className:`${s.configDivider} ${s.marginBottom20}`}),e.jsx("div",{className:s.flexBetweenCenter,children:e.jsxs("div",{className:`${s.flexColGap4} ${s.flex1}`,children:[e.jsx("label",{className:`${s.label} ${s.inputLabel}`,children:"Display Label"}),e.jsx("input",{className:s.input,value:B,onChange:c=>x(c.target.value),onBlur:()=>w?.(B.trim())}),e.jsx("label",{className:`${s.label} ${s.inputLabel}`,children:"Label"}),e.jsxs("div",{className:s.gridConfig,children:[e.jsx("input",{className:s.input,value:P,onChange:c=>U(c.target.value),onBlur:()=>b(S.value,{label:P}),onKeyDown:c=>{c.key==="Enter"&&c.currentTarget.blur()}}),!E&&e.jsxs("button",{type:"button",onClick:()=>{if(C){b(S.value,{status:"active"});return}confirm(`Retire type "${S.label}"? Existing tasks using it will keep it as a legacy type until reassigned.`)&&g(S.value)},title:C?"Restore Type":"Retire Type",className:`${s.destructiveBtn} ${s.deleteBtnMedium}`,children:[e.jsx(qe,{size:14,className:s.trashIcon})," ",C?"Restore":"Retire"]})]})]})}),e.jsx("p",{className:`${s.settingsHint} ${s.marginTop12}`,children:E?"Task is the protected fallback type and cannot be retired.":C?"Retired types stay available as legacy values on existing tasks until you reassign them.":"Retiring a type removes it from new task selection while preserving it as a legacy value on tasks that already use it."}),e.jsx("div",{className:`${s.configDivider} ${s.configDividerMargin}`}),e.jsxs("div",{className:s.configSection,children:[e.jsx("label",{className:`${s.subLabel} ${s.subLabelBlock} ${s.subLabelBlock12}`,children:"Visual Style"}),e.jsxs("div",{className:s.categorySubConfig,children:[e.jsx("div",{className:s.colorPickerGrid,children:Ve.map(c=>{const W=X(c)||"#000000",m=S.color===c,_=S.icon&&de[S.icon]?de[S.icon]:_s;return e.jsx("button",{type:"button",className:`${s.colorSwatch} ${m?s.colorSwatchActive:""}`,style:{borderColor:m?W:void 0,"--swatch-color":W,"--swatch-border-color":`${W}80`},onClick:()=>b(S.value,{color:c}),title:c,children:e.jsx(_,{size:14,style:{color:W}})},c)})}),e.jsx("div",{className:s.iconGrid,children:Ps.map(c=>{const W=de[c];return e.jsx("button",{type:"button",className:`${s.iconPickerBtn} ${S.icon===c?s.iconPickerBtnActive:""}`,style:S.icon===c?{borderColor:X(S.color),color:X(S.color),background:`${X(S.color)}15`}:{},onClick:()=>b(S.value,{icon:c}),title:c,children:e.jsx(W,{size:16})},c)})})]})]})]}),!S&&!z&&e.jsx("div",{className:`${R.emptyStateItalic} ${R.emptyStateBare}`,children:"Select a type above to manage"})]})}function Vi({priorities:a,onUpdatePriorities:o,displayLabel:h,onUpdateDisplayLabel:g}){const[b,N]=l.useState(""),[w,$]=l.useState(null),[A,z]=l.useState(h||"");l.useEffect(()=>{const j=a.find(I=>String(I.value)===String(b))||null;$(j)},[a,b]),l.useEffect(()=>{z(h||"")},[h]);const O=(j,I)=>{o(a.map(P=>String(P.value)===String(j)?{...P,...I}:P))};return e.jsxs("div",{className:`${s.configPanel} ${s.flex1}`,children:[e.jsxs("div",{className:s.marginBottom20,children:[e.jsx("label",{id:"priority-config-label",className:s.label,style:{display:"none"},children:"Select Priority"}),e.jsx(Ls,{value:b,options:[{value:"",label:"Select a priority level to configure...",icon:"HelpCircle",color:"var(--text-secondary)"},...a.map(j=>({value:j.value,label:j.label,icon:j.icon||"Gauge",color:j.color||"blue-500"}))],onChange:j=>N(j),ariaLabelledBy:"priority-config-label"})]}),w?e.jsxs("div",{className:s.flex1,style:{overflowY:"auto",marginRight:"-8px",paddingRight:"8px"},children:[e.jsx("div",{className:`${s.configDivider} ${s.marginBottom20}`}),e.jsxs("div",{className:`${s.configSection} ${s.marginBottom20}`,children:[e.jsx("label",{className:`${s.subLabel} ${s.subLabelBlock}`,children:"General"}),e.jsx("p",{className:s.settingsHint,style:{marginBottom:"12px"},children:"Priority uses a fixed ordered scale. You can rename and restyle levels, but not add, remove, or reorder them here."}),e.jsxs("div",{className:s.gridConfig,children:[e.jsxs("div",{className:s.flexColGap4,children:[e.jsx("label",{className:`${s.label} ${s.inputLabel}`,children:"Display Label"}),e.jsx("input",{className:s.input,value:A,onChange:j=>z(j.target.value),onBlur:()=>g?.(A.trim())})]}),e.jsxs("div",{className:s.flexColGap4,children:[e.jsx("label",{className:`${s.label} ${s.inputLabel}`,children:"Label"}),e.jsx("input",{className:s.input,value:w.label,onChange:j=>O(w.value,{label:j.target.value})})]})]})]}),e.jsx("div",{className:`${s.configDivider} ${s.configDividerMargin}`}),e.jsxs("div",{className:s.configSection,children:[e.jsx("label",{className:`${s.subLabel} ${s.subLabelBlock} ${s.subLabelBlock12}`,children:"Visual Style"}),e.jsxs("div",{className:s.categorySubConfig,children:[e.jsx("div",{className:s.colorPickerGrid,children:Ve.map(j=>{const I=X(j)||"#000000",P=w.color===j,U=w.icon&&de[w.icon]?de[w.icon]:pa;return e.jsx("button",{type:"button",className:`${s.colorSwatch} ${P?s.colorSwatchActive:""}`,style:{borderColor:P?I:void 0,"--swatch-color":I,"--swatch-border-color":`${I}80`},onClick:()=>O(w.value,{color:j}),title:j,children:e.jsx(U,{size:14,style:{color:I}})},j)})}),e.jsx("div",{className:s.iconGrid,children:Ps.map(j=>{const I=de[j]||pa;return e.jsx("button",{type:"button",className:`${s.iconPickerBtn} ${w.icon===j?s.iconPickerBtnActive:""}`,style:w.icon===j?{borderColor:X(w.color),color:X(w.color),background:`${X(w.color)}15`}:{},onClick:()=>O(w.value,{icon:j}),title:j,children:e.jsx(I,{size:16})},j)})})]})]})]}):e.jsx("div",{className:`${R.emptyStateItalic} ${R.emptyStateBare}`,children:"Select a priority above to manage"})]})}function qi(a){return a.map(o=>({...o,aliases:Array.isArray(o.aliases)?[...o.aliases]:void 0}))}function Ji(a){return a.map(o=>({...o,aliases:Array.isArray(o.aliases)?[...o.aliases]:void 0,options:qi(Array.isArray(o.options)?o.options:[])}))}const Yi=[{id:"client-delivery",label:"Client Delivery",description:"Taxonomies for client-facing work, approvals, and service commitments.",domainTag:"operations",bestFor:"Agencies, consulting, and service delivery work.",taxonomies:[{id:"approval-stage",label:"Approval Stage",description:"Track where work sits in the client or internal approval pipeline.",widgetType:"select",isSystem:!1,multiSelect:!1,isRequired:!1,formEnabled:!0,filterEnabled:!0,sortEnabled:!0,status:"active",options:[{value:"draft",label:"Draft",color:"blue-200",icon:"Pencil",status:"active"},{value:"internal-review",label:"Internal Review",color:"blue-500",icon:"Users",status:"active"},{value:"client-review",label:"Client Review",color:"amber-500",icon:"MessageSquare",status:"active"},{value:"approved",label:"Approved",color:"emerald-500",icon:"CheckCircle",status:"active"}]},{id:"service-line",label:"Service Line",description:"Identify which delivery lane owns or contributes to this work.",widgetType:"select",isSystem:!1,multiSelect:!0,isRequired:!1,formEnabled:!0,filterEnabled:!0,sortEnabled:!1,status:"active",options:[{value:"strategy",label:"Strategy",color:"violet-500",icon:"Target",status:"active"},{value:"content",label:"Content",color:"sky-500",icon:"Pencil",status:"active"},{value:"delivery",label:"Delivery",color:"emerald-500",icon:"Briefcase",status:"active"},{value:"reporting",label:"Reporting",color:"amber-500",icon:"Activity",status:"active"}]}]},{id:"content-operations",label:"Content Operations",description:"Reusable taxonomies for channels, publishing readiness, and editorial planning.",domainTag:"content",bestFor:"Editorial calendars, content teams, and publishing operations.",taxonomies:[{id:"content-channel",label:"Content Channel",description:"Show where a piece of work will be published or reused.",widgetType:"select",isSystem:!1,multiSelect:!0,isRequired:!1,formEnabled:!0,filterEnabled:!0,sortEnabled:!1,status:"active",options:[{value:"blog",label:"Blog",color:"blue-500",icon:"FileText",status:"active"},{value:"email",label:"Email",color:"amber-500",icon:"Mail",status:"active"},{value:"social",label:"Social",color:"violet-500",icon:"Flag",status:"active"},{value:"webinar",label:"Webinar",color:"violet-500",icon:"Video",status:"active"}]},{id:"publish-readiness",label:"Publish Readiness",description:"Track whether a content task is ready to move into scheduling or release.",widgetType:"select",isSystem:!1,multiSelect:!1,isRequired:!0,formEnabled:!0,filterEnabled:!0,sortEnabled:!0,status:"active",options:[{value:"not-started",label:"Not Started",color:"blue-200",icon:"Circle",status:"active"},{value:"in-review",label:"In Review",color:"amber-500",icon:"Search",status:"active"},{value:"ready",label:"Ready",color:"emerald-500",icon:"Rocket",status:"active"}]},{id:"effort-band",label:"Effort Band",description:"A lightweight numeric scale for content effort without using complexity.",widgetType:"level",isSystem:!1,multiSelect:!1,isRequired:!1,formEnabled:!1,filterEnabled:!0,sortEnabled:!0,status:"active",options:[{value:1,label:"Light",color:"teal-500",icon:"Wind",status:"active"},{value:2,label:"Standard",color:"blue-500",icon:"Minus",status:"active"},{value:3,label:"Heavy",color:"orange-500",icon:"Gauge",status:"active"}]}]},{id:"product-delivery",label:"Product Delivery",description:"Useful planning taxonomies for delivery stages, stakeholders, and delivery risk.",domainTag:"product",bestFor:"Product teams, implementation work, and cross-functional delivery.",taxonomies:[{id:"delivery-stage",label:"Delivery Stage",description:"Track how work moves from intake through active delivery.",widgetType:"select",isSystem:!1,multiSelect:!1,isRequired:!0,formEnabled:!0,filterEnabled:!0,sortEnabled:!0,status:"active",options:[{value:"backlog",label:"Backlog",color:"blue-200",icon:"Inbox",status:"active"},{value:"scoping",label:"Scoping",color:"sky-500",icon:"Search",status:"active"},{value:"ready",label:"Ready",color:"blue-500",icon:"Check",status:"active"},{value:"in-flight",label:"In Flight",color:"indigo-500",icon:"Play",status:"active"},{value:"blocked",label:"Blocked",color:"amber-500",icon:"Pause",status:"active"},{value:"done",label:"Done",color:"green-500",icon:"CheckCircle",status:"active"}]},{id:"stakeholder",label:"Stakeholder",description:"Show which audience or stakeholder group is most relevant to the work.",widgetType:"select",isSystem:!1,multiSelect:!0,isRequired:!1,formEnabled:!0,filterEnabled:!0,sortEnabled:!1,status:"active",options:[{value:"internal",label:"Internal",color:"blue-500",icon:"Users",status:"active"},{value:"client",label:"Client",color:"amber-500",icon:"Briefcase",status:"active"},{value:"leadership",label:"Leadership",color:"violet-500",icon:"Flag",status:"active"},{value:"partner",label:"Partner",color:"teal-500",icon:"Globe",status:"active"}]},{id:"risk-level",label:"Risk Level",description:"A simple signal for delivery or coordination risk.",widgetType:"level",isSystem:!1,multiSelect:!1,isRequired:!1,formEnabled:!1,filterEnabled:!0,sortEnabled:!0,status:"active",options:[{value:1,label:"Low",color:"teal-500",icon:"Wind",status:"active"},{value:2,label:"Medium",color:"amber-500",icon:"Gauge",status:"active"},{value:3,label:"High",color:"red-500",icon:"TriangleAlert",status:"active"}]}]},{id:"content-production",label:"Content Production",description:"Production-oriented taxonomies for content stages, channels, and asset effort.",domainTag:"marketing",bestFor:"Marketing teams, campaigns, and multi-channel asset production.",taxonomies:[{id:"content-stage",label:"Content Stage",description:"Track where a content asset sits in the production lifecycle.",widgetType:"select",isSystem:!1,multiSelect:!1,isRequired:!0,formEnabled:!0,filterEnabled:!0,sortEnabled:!0,status:"active",options:[{value:"outline",label:"Outline",color:"blue-200",icon:"Pencil",status:"active"},{value:"draft",label:"Draft",color:"blue-500",icon:"FileText",status:"active"},{value:"review",label:"Review",color:"amber-500",icon:"Search",status:"active"},{value:"approved",label:"Approved",color:"green-500",icon:"CheckCircle",status:"active"},{value:"published",label:"Published",color:"violet-500",icon:"Rocket",status:"active"}]},{id:"distribution-channel",label:"Distribution Channel",description:"Capture where the asset will be published or promoted.",widgetType:"select",isSystem:!1,multiSelect:!0,isRequired:!1,formEnabled:!0,filterEnabled:!0,sortEnabled:!1,status:"active",options:[{value:"blog",label:"Blog",color:"blue-500",icon:"FileText",status:"active"},{value:"email",label:"Email",color:"amber-500",icon:"Mail",status:"active"},{value:"video",label:"Video",color:"violet-500",icon:"Video",status:"active"},{value:"social",label:"Social",color:"indigo-500",icon:"Flag",status:"active"},{value:"docs",label:"Docs",color:"sky-500",icon:"Book",status:"active"}]},{id:"asset-effort",label:"Asset Effort",description:"Estimate the relative production effort for a content asset.",widgetType:"level",isSystem:!1,multiSelect:!1,isRequired:!1,formEnabled:!1,filterEnabled:!0,sortEnabled:!0,status:"active",options:[{value:1,label:"Quick",color:"teal-500",icon:"Wind",status:"active"},{value:2,label:"Standard",color:"blue-500",icon:"Minus",status:"active"},{value:3,label:"Campaign",color:"orange-500",icon:"Rocket",status:"active"}]}]}];function Xi(){return Yi.map(a=>({...a,taxonomies:Ji(a.taxonomies)}))}const Zi="_libraryContainer_94zm2_1",Qi="_introCard_94zm2_7",eo="_eyebrow_94zm2_17",so="_introTitle_94zm2_28",to="_introCopy_94zm2_35",ao="_prototypeNotice_94zm2_43",no="_libraryGrid_94zm2_49",io="_packList_94zm2_56",oo="_packCard_94zm2_62",lo="_packCardInteractive_94zm2_73",ro="_packCardActive_94zm2_88",co="_packHeader_94zm2_94",po="_packHeaderText_94zm2_101",uo="_packTitleRow_94zm2_108",mo="_packTitle_94zm2_108",ho="_packBadge_94zm2_122",go="_packDescription_94zm2_137",xo="_packBestFor_94zm2_144",yo="_packCounts_94zm2_151",bo="_packTaxonomyPreview_94zm2_157",vo="_packTaxonomyChip_94zm2_163",fo="_packTaxonomyMore_94zm2_175",jo="_packCountChip_94zm2_185",ko="_packActions_94zm2_198",Co="_packActionHint_94zm2_204",No="_previewPanel_94zm2_212",To="_previewHeader_94zm2_224",wo="_previewSummaryRow_94zm2_230",So="_previewTitle_94zm2_236",$o="_previewBestFor_94zm2_243",Io="_previewSubtext_94zm2_250",_o="_previewSection_94zm2_256",Lo="_previewSectionTitle_94zm2_262",Po="_previewList_94zm2_271",Ao="_previewItem_94zm2_277",Bo="_previewItemLabel_94zm2_288",Mo="_previewItemMeta_94zm2_298",Do="_customTaxonomyCard_94zm2_304",Eo="_customTaxonomyHeader_94zm2_314",Ro="_customTaxonomyDescription_94zm2_321",zo="_customTaxonomyBadges_94zm2_328",Go="_customTaxonomyBadge_94zm2_328",Oo="_applyPanel_94zm2_347",Fo="_applyTitle_94zm2_357",Ho="_applyCopy_94zm2_364",Wo="_analysisPanel_94zm2_371",Uo="_analysisCopy_94zm2_381",Ko="_analysisWarning_94zm2_388",Vo="_checkboxList_94zm2_395",qo="_checkboxLabel_94zm2_401",Jo="_prototypeResult_94zm2_409",Yo="_prototypeError_94zm2_415",r={libraryContainer:Zi,introCard:Qi,eyebrow:eo,introTitle:so,introCopy:to,prototypeNotice:ao,libraryGrid:no,packList:io,packCard:oo,packCardInteractive:lo,packCardActive:ro,packHeader:co,packHeaderText:po,packTitleRow:uo,packTitle:mo,packBadge:ho,packDescription:go,packBestFor:xo,packCounts:yo,packTaxonomyPreview:bo,packTaxonomyChip:vo,packTaxonomyMore:fo,packCountChip:jo,packActions:ko,packActionHint:Co,previewPanel:No,previewHeader:To,previewSummaryRow:wo,previewTitle:So,previewBestFor:$o,previewSubtext:Io,previewSection:_o,previewSectionTitle:Lo,previewList:Po,previewItem:Ao,previewItemLabel:Bo,previewItemMeta:Mo,customTaxonomyCard:Do,customTaxonomyHeader:Eo,customTaxonomyDescription:Ro,customTaxonomyBadges:zo,customTaxonomyBadge:Go,applyPanel:Oo,applyTitle:Fo,applyCopy:Ho,analysisPanel:Wo,analysisCopy:Uo,analysisWarning:Ko,checkboxList:Vo,checkboxLabel:qo,prototypeResult:Jo,prototypeError:Yo};function Xo(a,o="Layers"){const h=de[a||o]||de[o];return e.jsx(h,{size:15})}function ya(a){return{categories:a.categories.length>0,types:a.types.length>0,priorities:a.priorities.length>0}}function $s(a){const{title:o,items:h}=a;return e.jsxs("section",{className:r.previewSection,children:[e.jsx("h4",{className:r.previewSectionTitle,children:o}),e.jsx("div",{className:r.previewList,children:h.map(g=>e.jsxs("div",{className:r.previewItem,children:[e.jsxs("span",{className:r.previewItemLabel,children:[e.jsx("span",{style:{color:g.color?`var(--color-${g.color}, var(--text-secondary))`:"var(--text-secondary)"},children:Xo(g.icon)}),e.jsx("span",{children:g.label})]}),g.meta?e.jsx("span",{className:r.previewItemMeta,children:g.meta}):null]},g.key))})]})}function ba(a){let o=0,h=0,g=0,b=0;return a.taxonomies.forEach(N=>{N.multiSelect&&(o+=1),N.widgetType==="level"&&(h+=1),N.isRequired&&(g+=1),N.formEnabled!==!1&&(b+=1)}),{multiSelectCount:o,numericCount:h,requiredCount:g,formEnabledCount:b}}function Zo(a){const o=[];return o.push(a.widgetType==="level"?"Numeric":"Descriptive"),a.multiSelect&&o.push("Multi-select"),a.isRequired&&o.push("Required"),a.formEnabled!==!1&&o.push("Shows in forms"),a.filterEnabled&&o.push("Filterable"),a.sortEnabled&&o.push("Sortable"),o}function Qo(a){return{...a,aliases:Array.isArray(a.aliases)?[...a.aliases]:void 0,options:Array.isArray(a.options)?a.options.map(o=>({...o,aliases:Array.isArray(o.aliases)?[...o.aliases]:void 0})):[]}}function Sa(a,o){a.key!=="Enter"&&a.key!==" "||(a.preventDefault(),o())}function el(a){const{onAnalyzeSystemTaxonomyPack:o,onApplySystemTaxonomyPack:h}=a,g=l.useMemo(()=>ja(),[]),[b,N]=l.useState(g),[w,$]=l.useState(g[0]?.id||""),[A,z]=l.useState(()=>g[0]?ya(g[0]):{categories:!0,types:!0,priorities:!0}),[O,j]=l.useState(!1),[I,P]=l.useState(null),[U,B]=l.useState(!1),[x,S]=l.useState(!1),E=b.find(m=>m.id===w)||b[0]||null,C=l.useMemo(()=>!E||!o?null:o(E),[o,E]);l.useEffect(()=>{let m=!1;return B(!0),fetch("/api/taskforce/taxonomy-library").then(async _=>{if(!_.ok)return null;const n=await _.json().catch(()=>({})),d=Array.isArray(n?.packs)?n.packs:[];return!m&&d.length>0&&(N(d),$(L=>d.some(f=>f.id===L)?L:d[0].id)),null}).catch(()=>null).finally(()=>{m||B(!1)}),()=>{m=!0}},[]);const M=m=>{const _=b.find(n=>n.id===m);$(m),z(_?ya(_):{categories:!0,types:!0,priorities:!0}),j(!1),P(null)},c=m=>{z(_=>({..._,[m]:!_[m]}))},W=()=>{if(!E)return;if(Object.entries(A).filter(([,_])=>_).map(([_])=>_).length===0){P({type:"error",message:"Select at least one taxonomy section to apply."});return}if(!h){P({type:"error",message:"System taxonomy pack apply is not available in this surface yet."});return}S(!0),P(null),h({pack:E,sections:A,remapExistingValuesToDefault:O}).then(_=>{if(_?.success){P({type:"success",message:`${E.label} was applied to the selected taxonomy sections.`});return}P({type:"error",message:_?.error||"Failed to apply the selected taxonomy pack."})}).catch(_=>{P({type:"error",message:_ instanceof Error?_.message:"Failed to apply the selected taxonomy pack."})}).finally(()=>{S(!1)})};return E?e.jsxs("div",{className:r.libraryContainer,children:[e.jsxs("section",{className:r.introCard,children:[e.jsxs("span",{className:r.eyebrow,children:[e.jsx(yt,{size:14}),"System Taxonomy Library"]}),e.jsx("h3",{className:r.introTitle,children:"Browse starter packs before you replace anything."}),e.jsx("p",{className:r.introCopy,children:"Library packs give you coordinated categories, task types, and priority scales. Apply replaces only the sections you choose."}),U?e.jsx("p",{className:r.prototypeNotice,children:"Loading available packs…"}):null]}),e.jsxs("div",{className:r.libraryGrid,children:[e.jsx("div",{className:r.packList,children:b.map(m=>{const _=m.id===w;return e.jsxs("article",{className:`${r.packCard} ${r.packCardInteractive} ${_?r.packCardActive:""}`,role:"button",tabIndex:0,"aria-pressed":_,onClick:()=>M(m.id),onKeyDown:n=>Sa(n,()=>M(m.id)),children:[e.jsx("div",{className:r.packHeader,children:e.jsxs("div",{className:r.packHeaderText,children:[e.jsx("div",{className:r.packTitleRow,children:e.jsx("h4",{className:r.packTitle,children:m.label})}),e.jsx("p",{className:r.packDescription,children:m.description})]})}),e.jsxs("div",{className:r.packCounts,children:[e.jsxs("span",{className:r.packCountChip,children:[e.jsx(Ta,{size:13}),m.categories.length," categories"]}),e.jsxs("span",{className:r.packCountChip,children:[e.jsx(jn,{size:13}),m.types.length," types"]}),e.jsxs("span",{className:r.packCountChip,children:[e.jsx(ae,{size:13}),m.priorities.length," priority levels"]})]}),e.jsx("div",{className:r.packActions,children:e.jsx("button",{type:"button",className:s.submitBtn,onClick:()=>M(m.id),children:"Apply"})})]},m.id)})}),e.jsxs("aside",{className:r.previewPanel,children:[e.jsxs("div",{className:r.previewHeader,children:[e.jsx("h3",{className:r.previewTitle,children:E.label}),e.jsx("p",{className:r.previewSubtext,children:"Read-only preview. Applying this pack will replace only the sections you choose."})]}),e.jsx($s,{title:"Categories",items:E.categories.map(m=>({key:m.value,label:m.label,icon:m.icon,color:m.color}))}),e.jsx($s,{title:"Task Types",items:E.types.map(m=>({key:m.value,label:m.label,icon:m.icon,color:m.color,meta:m.status==="retired"?"Retired":void 0}))}),e.jsx($s,{title:"Priority Levels",items:E.priorities.map(m=>({key:String(m.value),label:m.label,icon:m.icon,color:m.color,meta:`Level ${m.value}`}))}),e.jsxs("section",{className:r.applyPanel,children:[e.jsx("h4",{className:r.applyTitle,children:"Apply Selected Sections"}),e.jsx("p",{className:r.applyCopy,children:"Applying this pack will replace the selected taxonomy sections in this workspace."}),C?e.jsxs("div",{className:r.analysisPanel,children:[C.unmatchedCategoryValues.length>0?e.jsxs("p",{className:r.analysisCopy,children:[C.unmatchedCategoryValues.length," category value",C.unmatchedCategoryValues.length===1?"":"s"," will be preserved as legacy unless you remap to default."]}):null,C.unmatchedTypeValues.length>0?e.jsxs("p",{className:r.analysisCopy,children:[C.unmatchedTypeValues.length," type value",C.unmatchedTypeValues.length===1?"":"s"," will be preserved as legacy unless you remap to default."]}):null,C.incompatiblePriorityValues.length>0?e.jsxs("p",{className:r.analysisWarning,children:["Existing tasks use priority level",C.incompatiblePriorityValues.length===1?"":"s"," ",C.incompatiblePriorityValues.join(", "),". Priority replacement will be blocked unless you remap unmatched existing values to default."]}):null,C.unmatchedCategoryValues.length===0&&C.unmatchedTypeValues.length===0&&C.incompatiblePriorityValues.length===0?e.jsx("p",{className:r.analysisCopy,children:"This pack lines up with the current workspace values for the selected taxonomy sections."}):null]}):null,e.jsxs("div",{className:r.checkboxList,children:[e.jsxs("label",{className:r.checkboxLabel,children:[e.jsx("input",{type:"checkbox",checked:A.categories,onChange:()=>c("categories")}),e.jsx("span",{children:"Categories"})]}),e.jsxs("label",{className:r.checkboxLabel,children:[e.jsx("input",{type:"checkbox",checked:A.types,onChange:()=>c("types")}),e.jsx("span",{children:"Types"})]}),e.jsxs("label",{className:r.checkboxLabel,children:[e.jsx("input",{type:"checkbox",checked:A.priorities,onChange:()=>c("priorities")}),e.jsx("span",{children:"Priorities"})]})]}),e.jsxs("label",{className:r.checkboxLabel,children:[e.jsx("input",{type:"checkbox",checked:O,onChange:()=>j(m=>!m)}),e.jsx("span",{children:"Remap unmatched existing values to default"})]}),e.jsx("p",{className:r.applyCopy,children:"Leave this off to preserve unmatched category and type values as legacy entries. Priority replacement will be blocked if existing tasks use values outside the selected pack."}),e.jsx("div",{className:r.packActions,children:e.jsx("button",{type:"button",className:s.submitBtn,onClick:W,disabled:x,children:x?"Applying…":"Apply Pack"})}),I?e.jsx("p",{className:`${r.prototypeResult} ${I.type==="error"?r.prototypeError:""}`,children:I.message}):null]})]})]})]}):e.jsx("div",{className:s.emptyState,children:e.jsx("p",{className:"tf-empty-copy",children:"No system taxonomy library packs are available."})})}function sl(a){const{taxonomies:o=[],onUpdateCustomTaxonomies:h}=a,g=l.useMemo(()=>Xi(),[]),[b,N]=l.useState(g),[w,$]=l.useState(g[0]?.id||""),[A,z]=l.useState(!1),[O,j]=l.useState(null),[I,P]=l.useState(g[0]?.taxonomies.map(n=>n.id)||[]),[U,B]=l.useState(null),x=b.find(n=>n.id===w)||b[0]||null,S=x?ba(x):null,E=l.useMemo(()=>x?x.taxonomies.filter(n=>I.includes(n.id)):[],[x,I]),C=l.useMemo(()=>new Set(I),[I]),M=l.useMemo(()=>{const n=new Set(o.map(d=>d.id));return E.map(d=>d.id).filter(d=>n.has(d))},[E,o]),c=l.useMemo(()=>{if(!x)return[];const n=new Set(o.map(d=>d.id));return x.taxonomies.filter(d=>C.has(d.id)&&!n.has(d.id))},[x,C,o]);if(l.useEffect(()=>{let n=!1;return z(!0),j(null),fetch("/api/taskforce/custom-taxonomy-library").then(async d=>{if(!d.ok)throw new Error(`Failed to load custom taxonomy packs (${d.status})`);const L=await d.json().catch(()=>({})),f=Array.isArray(L?.packs)?L.packs:[];!n&&f.length>0&&(N(f),$(G=>f.some(u=>u.id===G)?G:f[0].id))}).catch(d=>{n||j(d instanceof Error?d.message:"Failed to load custom taxonomy packs.")}).finally(()=>{n||z(!1)}),()=>{n=!0}},[]),l.useEffect(()=>{P(x?.taxonomies.map(n=>n.id)||[]),B(null)},[w,x]),!x)return e.jsx("div",{className:s.emptyState,children:e.jsx("p",{className:"tf-empty-copy",children:"No custom taxonomy library packs are available."})});const W=n=>{P(d=>d.includes(n)?d.filter(L=>L!==n):[...d,n]),B(null)},m=()=>{P(c.map(n=>n.id)),B(null)},_=()=>{if(I.length===0){B({type:"error",message:"Select at least one taxonomy to install."});return}if(M.length>0){B({type:"error",message:`This workspace already has ${M.length} taxonomy ${M.length===1?"id":"ids"} that match your current selection. Deselect conflicting taxonomies before installing this pack.`});return}if(!h){B({type:"error",message:"Custom taxonomy install is not available in this surface yet."});return}h([...o,...c.map(n=>Qo(n))]),B({type:"success",message:`${c.length} custom ${c.length===1?"taxonomy was":"taxonomies were"} added to this workspace.`})};return e.jsxs("div",{className:r.libraryContainer,children:[e.jsxs("section",{className:r.introCard,children:[e.jsxs("span",{className:r.eyebrow,children:[e.jsx(ua,{size:14}),"Custom Taxonomy Library"]}),e.jsx("h3",{className:r.introTitle,children:"Browse reusable custom taxonomy packs."}),e.jsx("p",{className:r.introCopy,children:"These packs install workspace-owned custom taxonomies such as approval stages, channels, and effort bands. Review a pack, choose the taxonomies you want, and install them into this workspace."}),A?e.jsx("p",{className:r.prototypeNotice,children:"Loading available packs…"}):null,O?e.jsx("p",{className:`${r.prototypeResult} ${r.prototypeError}`,children:O}):null]}),e.jsxs("div",{className:r.libraryGrid,children:[e.jsx("div",{className:r.packList,children:b.map(n=>{const d=n.id===w,L=ba(n),f=n.taxonomies.slice(0,3).map(G=>G.label);return e.jsxs("article",{className:`${r.packCard} ${r.packCardInteractive} ${d?r.packCardActive:""}`,role:"button",tabIndex:0,"aria-pressed":d,onClick:()=>$(n.id),onKeyDown:G=>Sa(G,()=>$(n.id)),children:[e.jsx("div",{className:r.packHeader,children:e.jsxs("div",{className:r.packHeaderText,children:[e.jsxs("div",{className:r.packTitleRow,children:[e.jsx("h4",{className:r.packTitle,children:n.label}),n.domainTag?e.jsx("span",{className:r.packBadge,children:n.domainTag}):null]}),e.jsx("p",{className:r.packDescription,children:n.description}),n.bestFor?e.jsxs("p",{className:r.packBestFor,children:[e.jsx("strong",{children:"Best for:"})," ",n.bestFor]}):null]})}),e.jsxs("div",{className:r.packCounts,children:[e.jsxs("span",{className:r.packCountChip,children:[e.jsx(ua,{size:13}),n.taxonomies.length," taxonomies"]}),L.multiSelectCount>0?e.jsx("span",{className:r.packCountChip,children:"Multi-select"}):null,L.numericCount>0?e.jsx("span",{className:r.packCountChip,children:"Numeric"}):null,L.requiredCount>0?e.jsx("span",{className:r.packCountChip,children:"Required"}):null]}),e.jsxs("div",{className:r.packTaxonomyPreview,children:[f.map(G=>e.jsx("span",{className:r.packTaxonomyChip,children:G},G)),n.taxonomies.length>f.length?e.jsxs("span",{className:r.packTaxonomyMore,children:["+",n.taxonomies.length-f.length," more"]}):null]}),e.jsx("div",{className:r.packActions,children:e.jsx("span",{className:r.packActionHint,children:d?"Previewing":"Click to Preview"})})]},n.id)})}),e.jsxs("aside",{className:r.previewPanel,children:[e.jsxs("div",{className:r.previewHeader,children:[e.jsx("h3",{className:r.previewTitle,children:x.label}),x.bestFor?e.jsxs("p",{className:r.previewBestFor,children:[e.jsx("strong",{children:"Best for:"})," ",x.bestFor]}):null,e.jsx("p",{className:r.previewSubtext,children:"Review each taxonomy before installing it into this workspace. Installed taxonomies become normal workspace-owned custom taxonomies."})]}),e.jsxs("div",{className:r.previewSummaryRow,children:[e.jsxs("span",{className:r.packCountChip,children:[x.taxonomies.length," taxonomies"]}),(S?.formEnabledCount||0)>0?e.jsxs("span",{className:r.packCountChip,children:[S.formEnabledCount," show in forms"]}):null,(S?.numericCount||0)>0?e.jsxs("span",{className:r.packCountChip,children:[S.numericCount," numeric"]}):null,(S?.requiredCount||0)>0?e.jsxs("span",{className:r.packCountChip,children:[S.requiredCount," required"]}):null]}),e.jsxs("section",{className:r.applyPanel,children:[e.jsx("h4",{className:r.applyTitle,children:"Choose Taxonomies to Install"}),e.jsx("p",{className:r.applyCopy,children:"Select only the taxonomies you want to add. This first pass installs new custom taxonomies only and asks you to skip conflicts rather than replace them."}),e.jsx("div",{className:r.checkboxList,children:x.taxonomies.map(n=>e.jsxs("label",{className:r.checkboxLabel,children:[e.jsx("input",{type:"checkbox",checked:I.includes(n.id),onChange:()=>W(n.id)}),e.jsxs("span",{children:[n.label,o.some(d=>d.id===n.id)?" (Already installed)":""]})]},n.id))}),e.jsxs("div",{className:r.analysisPanel,children:[e.jsxs("p",{className:r.analysisCopy,children:[I.length," ",I.length===1?"taxonomy is":"taxonomies are"," currently selected from this pack."]}),c.length>0?e.jsxs("p",{className:r.analysisCopy,children:[c.length," selected ",c.length===1?"taxonomy is":"taxonomies are"," ready to install right now."]}):e.jsx("p",{className:r.analysisCopy,children:"No selected taxonomies are currently installable."}),M.length>0?e.jsxs("p",{className:r.analysisWarning,children:[M.length," selected ",M.length===1?"taxonomy conflicts":"taxonomies conflict"," with existing workspace ids: ",M.join(", "),"."]}):null]}),e.jsxs("div",{className:r.packActions,children:[M.length>0?e.jsx("button",{type:"button",className:s.cancelBtn,onClick:m,children:"Select Installable Only"}):null,e.jsx("button",{type:"button",className:s.submitBtn,onClick:_,disabled:I.length===0||c.length===0,children:"Install Selected Taxonomies"})]}),U?e.jsx("p",{className:`${r.prototypeResult} ${U.type==="error"?r.prototypeError:""}`,children:U.message}):null]}),x.taxonomies.map(n=>e.jsxs("section",{className:r.customTaxonomyCard,children:[e.jsx("div",{className:r.customTaxonomyHeader,children:e.jsxs("div",{children:[e.jsx("h4",{className:r.previewSectionTitle,children:n.label}),n.description?e.jsx("p",{className:r.customTaxonomyDescription,children:n.description}):null]})}),M.includes(n.id)?e.jsx("p",{className:r.analysisWarning,children:"Conflicts with an existing taxonomy id in this workspace."}):null,e.jsx("div",{className:r.customTaxonomyBadges,children:Zo(n).map(d=>e.jsx("span",{className:r.customTaxonomyBadge,children:d},d))}),e.jsx($s,{title:n.widgetType==="level"?"Levels":"Options",items:n.options.map(d=>({key:`${n.id}:${d.value}`,label:d.label,icon:d.icon,color:d.color,meta:n.widgetType==="level"?`Level ${d.value}`:String(d.value)}))})]},n.id))]})]})]})}function va(a){const{mode:o="system",taxonomies:h,onUpdateCustomTaxonomies:g,onAnalyzeSystemTaxonomyPack:b,onApplySystemTaxonomyPack:N}=a;return o==="custom"?e.jsx(sl,{taxonomies:h,onUpdateCustomTaxonomies:g}):e.jsx(el,{onAnalyzeSystemTaxonomyPack:b,onApplySystemTaxonomyPack:N})}function tl(a){const{taxonomies:o,onUpdateTaxonomies:h,taxonomyDisplayLabels:g,onUpdateTaxonomyDisplayLabels:b,categories:N,pathValidation:w,onUpdateCategory:$,onRemoveCategory:A,onSaveCategory:z,onAddPath:O,onRemovePath:j,onUpdateCategoryIcon:I,onUpdateCategoryColor:P,onBrowseFolders:U,types:B,onSaveType:x,onRemoveType:S,onUpdateType:E,priorities:C,onUpdatePriorities:M,onAnalyzeSystemTaxonomyPack:c,onApplySystemTaxonomyPack:W,manualComplexityEnabled:m,onManualComplexityEnabledChange:_,initialTab:n}=a,[d,L]=l.useState(n||""),[f,G]=l.useState(n?"detail":"list"),[u,F]=l.useState(!1),[K,ee]=l.useState(""),Je=l.useMemo(()=>ja().length,[]),ns=l.useMemo(()=>Hi({categories:N,types:B,priorities:C,taxonomies:o,manualComplexityEnabled:m,displayLabels:g}),[N,m,C,o,g,B]),As=()=>{if(!K.trim())return;const v=K.toLowerCase().trim().replace(/\s+/g,"-");if(o.some(Z=>Z.id===v)){alert("A taxonomy with this ID already exists");return}const Y={id:v,label:K.trim(),options:[],widgetType:"select",isSystem:!1,multiSelect:!1,formEnabled:!1,filterEnabled:!0,sortEnabled:!1};h([...o,Y]),ee(""),F(!1),L(v),G("detail")},Bs=v=>{h(o.map(Y=>Y.id===v.id?v:Y))},Ms=v=>{const Y=o.map(Z=>Z.id===v?{...Z,status:"retired"}:Z);h(Y),G("list")},Ds=v=>{const Y=o.map(Z=>Z.id===v?{...Z,status:"active"}:Z);h(Y)},Le=v=>{L(v),G("detail")},is=(v,Y)=>{const Z=o.findIndex(zs=>zs.id===v);if(Z<0)return;const Ye=Z+Y;if(Ye<0||Ye>=o.length)return;const Xe=[...o],[Rs]=Xe.splice(Z,1);Xe.splice(Ye,0,Rs),h(Xe)},os=ns.find(v=>v.id===d),ls=os?.taxonomy,Es=ns.filter(v=>v.kind!=="custom"),we=ns.filter(v=>v.kind==="custom");return f==="list"?e.jsxs("div",{className:y.taxonomyDrillDown,children:[e.jsxs("div",{className:y.drillDownList,children:[e.jsx("section",{className:y.librarySection,children:e.jsxs("button",{className:y.libraryLauncher,onClick:()=>Le("library"),children:[e.jsxs("div",{className:y.libraryLauncherInfo,children:[e.jsx("span",{className:y.libraryLauncherIcon,children:e.jsx(yt,{size:18})}),e.jsxs("div",{className:y.libraryLauncherText,children:[e.jsx("span",{className:y.libraryLauncherLabel,children:"System Taxonomy Library"}),e.jsx("span",{className:y.libraryLauncherSubtext,children:"Browse curated packs for categories, task types, and priority scales."})]})]}),e.jsxs("span",{className:y.libraryLauncherMeta,children:[Je," curated packs",e.jsx(Te,{size:16,className:y.chevron})]})]})}),e.jsxs("div",{className:y.drillDownSection,children:[e.jsx("h4",{className:y.drillDownSectionTitle,children:"System Taxonomies"}),Es.map(v=>e.jsxs("button",{className:`${y.drillDownItem} ${v.id==="complexities"&&!m?y.drillDownItemDimmed:""}`,onClick:()=>Le(v.id),children:[e.jsxs("div",{className:y.drillDownItemInfo,children:[e.jsx(kn,{size:16,className:y.systemIcon}),e.jsxs("div",{className:y.drillDownItemText,children:[e.jsx("span",{className:y.drillDownItemLabel,children:v.label}),e.jsx("span",{className:y.drillDownItemSubtext,children:v.summary})]})]}),e.jsx(Te,{size:16,className:y.chevron})]},v.id))]}),e.jsxs("div",{className:y.drillDownSection,children:[e.jsxs("div",{className:y.drillDownSectionHeader,children:[e.jsx("h4",{className:y.drillDownSectionTitle,children:"Custom Taxonomies"}),e.jsxs("button",{className:R.addTaxonomyBtnSmall,onClick:()=>F(!0),title:"Add Custom Taxonomy",children:[e.jsx(as,{size:14})," New"]})]}),e.jsxs("button",{className:y.drillDownItem,onClick:()=>Le("custom-library"),children:[e.jsxs("div",{className:y.drillDownItemInfo,children:[e.jsx(yt,{size:16,className:y.systemIcon}),e.jsxs("div",{className:y.drillDownItemText,children:[e.jsx("span",{className:y.drillDownItemLabel,children:"Custom Taxonomy Library"}),e.jsx("span",{className:y.drillDownItemSubtext,children:"Reusable templates for future custom taxonomy packs"})]})]}),e.jsx(Te,{size:16,className:y.chevron})]}),we.length===0?e.jsx("div",{className:s.emptyState,children:e.jsx("p",{className:"tf-empty-copy",children:"No custom taxonomies yet."})}):we.map(v=>e.jsxs("div",{className:`${y.drillDownItem} ${v.taxonomy?.status==="retired"?y.drillDownItemDimmed:""}`,children:[e.jsxs("button",{className:y.drillDownItemAction,onClick:()=>Le(v.id),children:[e.jsxs("div",{className:y.drillDownItemInfo,children:[e.jsx(Cn,{size:16}),e.jsxs("div",{className:y.drillDownItemText,children:[e.jsx("span",{className:y.drillDownItemLabel,children:v.taxonomy?.status==="retired"?`${v.label} (Retired)`:v.label}),e.jsx("span",{className:y.drillDownItemSubtext,children:v.summary})]})]}),e.jsx(Te,{size:16,className:y.chevron})]}),e.jsxs("div",{className:y.orderButtons,children:[e.jsx("button",{type:"button",className:s.browseBtn,title:"Move taxonomy up",onClick:Y=>{Y.stopPropagation(),is(v.id,-1)},disabled:we[0]?.id===v.id,children:e.jsx(ka,{size:16})}),e.jsx("button",{type:"button",className:s.browseBtn,title:"Move taxonomy down",onClick:Y=>{Y.stopPropagation(),is(v.id,1)},disabled:we[we.length-1]?.id===v.id,children:e.jsx(Ca,{size:16})})]})]},v.id))]})]}),u&&e.jsx("div",{className:y.createOverlay,children:e.jsxs("div",{className:y.createDialog,children:[e.jsx("h3",{className:y.createDialogTitle,children:"New Taxonomy"}),e.jsxs("div",{className:y.inputGroup,children:[e.jsx("label",{className:s.label,children:"Name"}),e.jsx("input",{className:s.input,placeholder:"e.g. Sprint, Phase",value:K,onChange:v=>ee(v.target.value),autoFocus:!0})]}),e.jsxs("div",{className:y.dialogActions,children:[e.jsx("button",{className:`${s.submitBtn} ${y.createSubmit}`,onClick:As,disabled:!K.trim(),children:"Create"}),e.jsx("button",{className:`${s.cancelBtn} ${y.createCancel}`,onClick:()=>{F(!1),ee("")},children:"Cancel"})]})]})})]}):e.jsxs("div",{className:y.taxonomyDetailView,children:[e.jsx("div",{className:y.detailHeader,children:e.jsxs("div",{className:y.taxonomyBreadcrumbs,children:[e.jsxs("button",{className:y.breadcrumbPrev,onClick:()=>G("list"),title:"Back to All Taxonomies",children:[e.jsx(Nn,{size:16,className:y.breadcrumbIcon}),"Taxonomies"]}),e.jsx(Te,{size:14,className:y.breadcrumbDivider}),e.jsx("h3",{className:y.breadcrumbActive,children:d==="library"?"System Taxonomy Library":d==="custom-library"?"Custom Taxonomy Library":os?.label||"Taxonomy"})]})}),e.jsx("div",{className:y.detailContent,children:d==="library"?e.jsx(va,{mode:"system",onAnalyzeSystemTaxonomyPack:c,onApplySystemTaxonomyPack:W}):d==="custom-library"?e.jsx(va,{mode:"custom",taxonomies:o,onUpdateCustomTaxonomies:h}):d==="categories"?e.jsx(Ui,{displayLabel:g?.category,onUpdateDisplayLabel:v=>b?.({category:v}),categories:N,pathValidation:w,onUpdateCategory:$,onRemoveCategory:A,onSaveCategory:z,onAddPath:O,onRemovePath:j,onUpdateCategoryIcon:I,onUpdateCategoryColor:P,onBrowseFolders:U}):d==="types"?e.jsx(Ki,{displayLabel:g?.type,onUpdateDisplayLabel:v=>b?.({type:v}),types:B,onSaveType:x,onRemoveType:S,onUpdateType:E}):d==="complexities"?e.jsxs("div",{className:s.settingGroup,children:[e.jsx("h4",{className:s.settingSubtitle,children:"Complexity"}),e.jsx("p",{className:s.settingsHint,children:"Complexity is estimated by AI and system logic by default."}),e.jsx("p",{className:s.settingsHint,children:"Enable this to let users set complexity manually and show the Complexity field in Add/Edit Task. When disabled, the Complexity field is hidden from the task form."}),e.jsxs("label",{className:s.archiveToggle,children:[e.jsx("input",{type:"checkbox",checked:m,onChange:v=>{_(v.target.checked)}}),e.jsx("span",{children:"Manual Complexity"})]})]}):ls?e.jsx(Wi,{taxonomy:ls,onUpdateTaxonomy:Bs,onRemoveTaxonomy:Ms,onRestoreTaxonomy:Ds}):d==="priorities"?e.jsx(Vi,{displayLabel:g?.priority,onUpdateDisplayLabel:v=>b?.({priority:v}),priorities:C,onUpdatePriorities:M}):e.jsxs("div",{className:s.emptyState,children:[e.jsx("p",{className:"tf-empty-copy",children:"Taxonomy not found."}),e.jsx("button",{className:s.submitBtn,onClick:()=>G("list"),children:"Return to List"})]})})]})}const al={sun:Pn,wind:wa,moon:Ln,sparkles:bt},fa=["tasks:read","tasks:write","workspace:read"];function ml(a){const{settingsModel:o,onSectionChange:h,renderMode:g="full"}=a,b=g==="mcp-only",{currentTheme:N,globalTheme:w,themeUseGlobalDefault:$,keyShortcut:A,jsonBackupEnabled:z,globalJsonBackupEnabled:O,globalWeekStartsOn:j,locale:I="en-US",supportedLocales:P=["en-US","es-419","pt-BR"],jsonBackupUseGlobalDefault:U,manualComplexityEnabled:B,checklistDropdownEnabled:x=!0,showTaskCardStatusLabel:S=!0,exportWorkflowsPath:E,exportingResource:C,exportResult:M,initialSection:c,onThemeChange:W,onSaveTheme:m,onSaveGlobalTheme:_,onResetProjectToGlobal:n,onKeyShortcutChange:d,onJsonBackupEnabledChange:L,onSaveGlobalJsonBackupEnabled:f,onSaveGlobalWeekStartsOn:G,onSaveLocale:u,onManualComplexityEnabledChange:F,onChecklistDropdownEnabledChange:K,onShowTaskCardStatusLabelChange:ee,onSaveSettings:Je,onExportWorkflowsPathChange:ns,onShowFolderBrowserChange:As,onBrowserTargetChange:Bs,onFetchFolders:Ms,categories:Ds,pathValidation:Le,taxonomyDisplayLabels:is,onUpdateCategory:os,onRemoveCategory:ls,onSaveCategory:Es,onAddPath:we,onRemovePath:v,onUpdateCategoryIcon:Y,onUpdateCategoryColor:Z,types:Ye,onSaveType:Xe,onRemoveType:Rs,onUpdateType:zs,taxonomies:$a,onUpdateTaxonomies:Ia,priorities:_a,onUpdatePriorities:La,onAnalyzeSystemTaxonomyPack:Pa,onApplySystemTaxonomyPack:Aa,onUpdateTaxonomyDisplayLabels:Ba,projectRoot:Se,projectName:Pe,mcpHostRoot:rs,serverHostRoot:cs,mcpScriptPath:pe,tenantId:jt,workspaceId:le,runtimeMode:Ae="local",cloudAuthBaseUrl:Gs="",cloudMcpBaseUrl:Os="",fetchCloudAuthApi:Be,workspaceSwitchingEnabled:Ma=!1,currentWorkspaceRole:Da="member",currentWorkspaceName:Me="",onDeleteWorkspace:Fs,onMcpHostRootChange:Ea,onOpenCloudAuth:Hs,isAuthenticated:kt=!1,exportEnvironment:Ct,setupState:se=null,buildInfo:nl=null,onExportEnvironmentChange:Ra,onSaveSetupMode:il,onSaveWorkspaceProfile:Ws,availableWorkflows:De=[],onExportWorkflows:za,initiativeTemplates:Ee=[],onRefreshInitiativeTemplates:Us,onCreateInitiativeFromTemplate:Ks,onRefreshWorkflows:Ga}=o,Nt=Ae!=="cloud",[Ze,ds]=l.useState([]);l.useEffect(()=>{De.length>0&&Ze.length===0&&ds(De)},[De]);const Oa=t=>{ds(i=>i.includes(t)?i.filter(p=>p!==t):[...i,t])},Fa=()=>ds(De),Ha=()=>ds([]),[Re,V]=l.useState(null),[ps,Wa]=l.useState(()=>se?.mode==="operations"?"operations":"core"),[Tt,wt]=l.useState(()=>String(se?.workspace?.name||"").trim()),[St,$t]=l.useState(()=>String(se?.workspace?.description||"")),[Qe,It]=l.useState(""),[Vs,Ua]=l.useState(""),[_t,Lt]=l.useState(!1),[D,ne]=l.useState(()=>b?"mcp":"general"),[qs,es]=l.useState(!0),[ue,us]=l.useState(()=>"project"),[Js,Pt]=l.useState([]),[Ys,At]=l.useState(!1),[ke,Xs]=l.useState(null),[ms,hs]=l.useState(null),gs=Ke.useCallback(async()=>{if(le){At(!0);try{const t=typeof window<"u"?new URL(`/api/taskforce/workspace/assignee-options?workspaceId=${encodeURIComponent(le)}`,window.location.origin).toString():`/api/taskforce/workspace/assignee-options?workspaceId=${encodeURIComponent(le)}`,i=await fetch(t,{credentials:"include"});if(!i.ok)return;const p=await i.json().catch(()=>({})),T=Array.isArray(p?.assignees)?p.assignees.filter(k=>k.kind==="agent").map(k=>({id:String(k.value||""),name:String(k.label||""),username:String(k.username||k.value||""),icon:String(k.icon||"Bot"),color:String(k.color||"#6B7280"),kind:"agent",description:typeof k.description=="string"?k.description:null,role:typeof k.role=="string"?k.role:null,provider:typeof k.provider=="string"?k.provider:null,model:typeof k.model=="string"?k.model:null,surfaceType:typeof k.surfaceType=="string"?k.surfaceType:null})):[];Pt(T)}catch{Pt([])}finally{At(!1)}}},[le]),Ka=Ke.useCallback(async(t,i)=>{if(le){hs(null);try{const p=await fetch("/api/taskforce/workspace/ai-profiles/merge",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceId:le,keepId:t,mergeId:i})}),T=await p.json().catch(()=>({}));p.ok?(hs({type:"success",message:"Profiles merged successfully."}),Xs(null),await gs()):hs({type:"error",message:T?.error||"Merge failed."})}catch{hs({type:"error",message:"Network error during merge."})}}},[le,gs]);l.useEffect(()=>{(D==="agents"||D==="mcp")&&gs()},[D,gs]),l.useEffect(()=>{Ee.length>0&&!Qe&&It(Ee[0].id)},[Ee,Qe]),l.useEffect(()=>{if(!Re)return;const t=setTimeout(()=>V(null),2500);return()=>clearTimeout(t)},[Re]),l.useEffect(()=>{Wa(se?.mode==="operations"?"operations":"core")},[se?.mode]),l.useEffect(()=>{wt(String(se?.workspace?.name||"").trim()),$t(String(se?.workspace?.description||""))},[se?.workspace?.name,se?.workspace?.description]);const Va=async t=>{W(t);const i=await m(t);V({type:i?"success":"error",message:i?"Project theme saved.":"Failed to save project theme."})},Bt=(t,i,p)=>{const T=al[t.icon];return e.jsxs("button",{className:`${s.themeBtn} tf-button-tile ${i===t.id?s.activeTheme:""}`,onClick:()=>{p(t.id)},children:[e.jsx(T,{size:20})," ",t.label]},t.id)},Zs=Ae==="cloud"?"cloud":"local",[xs,Qs]=l.useState(Zs),[be,Mt]=l.useState(!1),[ze,Dt]=l.useState(!0),[Et,Rt]=l.useState(!1),[et,zt]=l.useState(!0),[st,ys]=l.useState([]),[qa,Gt]=l.useState(!1),[Ot,tt]=l.useState(null),[ss,bs]=l.useState(null),vs=l.useMemo(()=>`${String(Me||se?.workspace?.name||Pe||le||"Taskforce Workspace").trim()} MCP`,[Me,se?.workspace?.name,Pe,le]),[Ft,at]=l.useState(vs),[nt,Ht]=l.useState(""),[Ge,ts]=l.useState(null),[me,it]=l.useState(null),[Oe,$e]=l.useState(null),[Wt,ot]=l.useState(null),[te,lt]=l.useState("general"),[Ut,Kt]=l.useState(!1),[H,ve]=l.useState(null),[fs,Vt]=l.useState([]),[Ja,qt]=l.useState(!1),[Jt,Fe]=l.useState(null),[Yt,Xt]=l.useState(null);l.useEffect(()=>{Qs(Zs)},[Zs]),l.useEffect(()=>{at(t=>t.trim().length>0?t:vs)},[vs]),l.useEffect(()=>{if(!Ge)return;const t=setTimeout(()=>ts(null),3500);return()=>clearTimeout(t)},[Ge]),l.useEffect(()=>{if(!me)return;const t=setTimeout(()=>it(null),3500);return()=>clearTimeout(t)},[me]),l.useEffect(()=>{if(!Oe)return;const t=setTimeout(()=>$e(null),3500);return()=>clearTimeout(t)},[Oe]);const He=l.useMemo(()=>{const t=bn(Os||Gs||""),i=String(t||Os||Gs||"").trim().replace(/\/+$/,"");return i?`${i}/mcp`:typeof window>"u"?"/mcp":`${window.location.origin.replace(/\/+$/,"")}/mcp`},[Os,Gs]),Ya=Ae!=="cloud",js=Ae==="cloud"||xs==="cloud",Xa=Ae!=="cloud"&&xs==="local",We=kt,Za=l.useMemo(()=>{const t={active:0,expired:1,revoked:2};return[...st].sort((i,p)=>{const T=(t[i.status]??99)-(t[p.status]??99);return T!==0?T:String(p.createdAt||"").localeCompare(String(i.createdAt||""))})},[st]),Ue=l.useMemo(()=>Rn(Me||null,Pe||null),[Me,Pe]),Ie=Wt?.trim()||"",ks=Ie||"<<GENERATE_TOKEN>>",q=l.useMemo(()=>Wn({clientId:te,endpoint:He,tokenValue:ks,serverId:Ue}),[He,Ue,ks,te]),Cs=q.kind==="json"?q.serverConfig??null:null,Zt=te==="chatgpt-desktop"||te==="claude-desktop",Qt="Resolve your profile with Taskforce.",ea=l.useMemo(()=>fs.find(t=>t.provider==="chatgpt"&&t.status==="active")||null,[fs]),sa=l.useMemo(()=>fs.find(t=>t.provider==="claude"&&t.status==="active")||null,[fs]),Ns=te==="chatgpt-desktop"?ea:te==="claude-desktop"?sa:null,Qa=l.useMemo(()=>{if(q.kind==="text")return q.renderedText||"";let t={[q.rootKey||"mcpServers"]:{[Ue]:q.serverConfig}};for(const i of[...q.wrapperKeys||[]].reverse())t={[i]:t};return JSON.stringify(t,null,2)},[q,Ue]),rt=(t,i,p="mcpServers",T=[])=>{const k={color:"var(--text-helper)"},J={color:"var(--brand-primary-strong)",fontWeight:"bold"},Q={color:"var(--text-secondary)"},re={color:"var(--text-primary, #fff)"},fe=ks,oe=[...T,p],he=" ".repeat(oe.length+1),la=JSON.stringify(i,null,2).split(`
|
|
4
4
|
`).map((je,ge)=>ge===0?je:`${he}${je}`).join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as i,j as e}from"./vendor-react-CKJs5o3c.js";import{t as s}from"./index-
|
|
1
|
+
import{r as i,j as e}from"./vendor-react-CKJs5o3c.js";import{t as s}from"./index-CGDQY0nN.js";import{h as R,R as ae,c as le,q as ie,b as ne,m as oe}from"./vendor-icons-CLnehDTw.js";import"./vendor-markdown-BUxTU7dS.js";import"./vendor-dnd-DRzYolkg.js";import"./vendor-router-BbWMxlnO.js";const re={do:["aliasesText","dispatchDefault","criticalToolsText","contentDefault"],execute:["aliasesText","dispatchDefault","criticalToolsText","contentDefault"]},V=["do","evaluate","collaborate","plan","review","execute"];function w(o){return{description:o.description||"",aliasesText:(o.dispatch?.aliases||[]).join(", "),dispatchDefault:o.dispatch?.default||"",criticalToolsText:(o.compat?.requiredToolsCritical||[]).join(`
|
|
2
2
|
`),optionalToolsText:(o.compat?.requiredToolsOptional||[]).join(`
|
|
3
3
|
`),contentDefault:o.content?.default||""}}function g(o){return o.split(/\n|,/).map(f=>f.trim()).filter(Boolean)}function ce(o){return Array.from(new Set(o.map(f=>f.trim()).filter(Boolean)))}function de(o){const{availableWorkflows:f,onFetchWorkflowTemplate:j,onFetchWorkflowOverrideNames:T,onSaveWorkflowTemplateDraft:b,onResetWorkflowTemplateDraft:v}=o,[c,D]=i.useState(""),[A,k]=i.useState(!1),[C,y]=i.useState(null),[d,m]=i.useState(null),[a,h]=i.useState(null),[r,u]=i.useState(null),[S,W]=i.useState(!1),[P,E]=i.useState(!1),[X,L]=i.useState([]),[H,_]=i.useState(""),[O,K]=i.useState(""),[F,U]=i.useState(""),B=i.useMemo(()=>{const t=V.filter(n=>f.includes(n)),l=f.filter(n=>!V.includes(n)).sort((n,x)=>n.localeCompare(x));return[...t,...l]},[f]);i.useEffect(()=>{!c&&B.length>0&&D(B[0])},[B,c]),i.useEffect(()=>{let t=!1;return(async()=>{if(!T)return;const n=await T();t||L(n)})(),()=>{t=!0}},[T,f]),i.useEffect(()=>{let t=!1;return(async()=>{if(!c||!j)return;k(!0),y(null);const n=await j(c);if(t)return;if(!n){m(null),h(null),y("Unable to load workflow template. Reload Taskforce, and if needed restart the dev/server process."),k(!1);return}const x=n;m(x),h(w(x)),k(!1)})(),()=>{t=!0}},[c,j]);const $=i.useMemo(()=>{if(!a)return[];const t=[];return a.description.trim()||t.push("Description is required."),a.dispatchDefault.trim()||t.push("Dispatch default is required."),g(a.criticalToolsText).length===0&&t.push("At least one critical tool is required."),a.contentDefault.trim()||t.push("Default content cannot be empty."),t},[a]),I=i.useMemo(()=>re[c]||[],[c]),p=t=>I.includes(t),M=i.useMemo(()=>{if(!d||!a)return[];const t=w(d),l=[];return t.description!==a.description&&l.push("description"),t.aliasesText!==a.aliasesText&&l.push("aliases"),t.dispatchDefault!==a.dispatchDefault&&l.push("dispatch.default"),t.criticalToolsText!==a.criticalToolsText&&l.push("compat.requiredToolsCritical"),t.optionalToolsText!==a.optionalToolsText&&l.push("compat.requiredToolsOptional"),t.contentDefault!==a.contentDefault&&l.push("content.default"),l},[d,a]),G=i.useMemo(()=>!d||!a?"":[`# ${d.name} Preview`,"",`Description: ${a.description}`,`Aliases: ${a.aliasesText||"(none)"}`,`Dispatch default: ${a.dispatchDefault||"(none)"}`,"","## Critical Tools",...g(a.criticalToolsText).map(t=>`- ${t}`),"","## Optional Tools",...g(a.optionalToolsText).map(t=>`- ${t}`),"","## Prompt Content Preview",a.contentDefault].join(`
|
|
4
4
|
`),[d,a]),N=i.useMemo(()=>d?w(d):null,[d]),Y=i.useMemo(()=>{if(!N||!a)return[];const t=[],l=(n,x,Q)=>{x!==Q&&t.push({field:n,before:x,after:Q})};return l("description",N.description,a.description),l("aliases",N.aliasesText,a.aliasesText),l("dispatch.default",N.dispatchDefault,a.dispatchDefault),l("compat.requiredToolsCritical",N.criticalToolsText,a.criticalToolsText),l("compat.requiredToolsOptional",N.optionalToolsText,a.optionalToolsText),l("content.default",N.contentDefault,a.contentDefault),t},[N,a]),Z=()=>{d&&h(w(d))},ee=async()=>{G&&await navigator.clipboard.writeText(G)},se=async()=>{if(!c||!a||$.length>0||!b)return;W(!0),u(null);const t=await b(c,a);if(!t.success){u({type:"error",message:t.error||"Failed to save workflow draft."}),W(!1);return}const l=j?await j(c):null;if(l&&(m(l),h(w(l))),u({type:"success",message:"Workflow draft saved and templates regenerated."}),T){const n=await T();L(n)}W(!1)},te=async()=>{if(!c||!v)return;E(!0),u(null);const t=await v(c);if(!t.success){u({type:"error",message:t.error||"Failed to reset workflow override."}),E(!1);return}const l=j?await j(c):null;if(l&&(m(l),h(w(l))),u({type:"success",message:"Workflow override reset and templates regenerated."}),T){const n=await T();L(n)}E(!1)},J=(t,l)=>{if(!a)return;const n=ce(l).join(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a2 as t}from"./index-CGDQY0nN.js";const n="D-";function E(e){return t(n,e)}export{E as g};
|