const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/chunks/index.js","assets/chunks/index2.js","assets/chunks/vendor-common.js","assets/chunks/vendor-react.js","assets/chunks/_commonjsHelpers.js","assets/chunks/preload-helper.js","assets/chunks/_commonjs-dynamic-modules.js"])))=>i.map(i=>d[i]); import{j as e,r,R as be,d as ql}from"./chunks/vendor-react.js?v=1775123024591";import{a as In,G as Zl,b as Xo,c as fe,B as te,D as Js,d as Qs,e as mn,f as Xs,F as Dt,g as At,I as Ps,h as Ea,L as io,T as Yo,i as Ta,j as Un,u as Rr,k as vt,l as Et,m as Tt,n as It,A as Jl}from"./chunks/AppDialogProvider.js?v=1775123024591";import{aH as Ql,aI as gt,aJ as Xl,aK as La,aL as ei,aM as ti,aN as H,aO as si,aP as ni,aQ as ai,aR as Yl,aS as ri,aT as oi,aU as ii,aV as li,aW as Fn,aX as ci,aY as di,aZ as ui,a_ as mi,a$ as ec,b0 as tc,b1 as en,b2 as ss,b3 as hi,b4 as sc,b5 as pi,b6 as nc,b7 as ac,b8 as ns,b9 as Ia,ba as as,bb as _n,bc as hn,bd as fi,be as rc,bf as xi,bg as oc,bh as ic,bi as gi,bj as yi,bk as lc,bl as bi,bm as wi,bn as ji,bo as cc,bp as Ni,bq as vi,br as Si,bs as dn,bt as ta,bu as dc,bv as pn,bw as un,bx as Ln,by as _s,bz as Ci,bA as Ma,bB as ki,bC as Ei,bD as uc,bE as Ti,bF as mc,bG as Ii,bH as hc,bI as Pi,bJ as pc,bK as Di,bL as fc,bM as Ai,bN as Ri,bO as xc,bP as gc,bQ as $i,bR as yc,bS as bc,bT as Oi,bU as wc,bV as jc,bW as Nc,bX as _i,bY as Li,bZ as vc,b_ as Mi,b$ as Ui,c0 as Sc,c1 as Fi,c2 as Pa,c3 as Xa,c4 as Ds,c5 as Cc,c6 as lo,c7 as kc,c8 as Ec,c9 as gr,ca as Tc,cb as Ic,cc as Pc,cd as zi,ce as Bi,cf as Dc,cg as Ac,ch as Wi,ci as Rc,cj as $c,ck as co,cl as Oc,cm as _c,cn as Lc,co as Mc,cp as pa,cq as uo,cr as Uc,cs as Fc,ct as zc,cu as Tn,cv as Bc,cw as rn,cx as Wc,cy as mo,cz as Gc,cA as Kc,cB as Vc,cC as Sa,cD as fa,cE as Ya,cF as Hc,cG as ho,cH as po,cI as Gi,cJ as qc,cK as Zc,cL as Jc,cM as Qc,cN as Ki,cO as Xc,cP as Yc}from"./chunks/vendor-common.js?v=1775123024591";import{I as Ua,a as Fa,b as $r,c as Or,d as sa,e as _r,f as na,g as yr,h as Vi}from"./chunks/vendor-assistant.js?v=1775123024591";import{S as fo,y as er,Q as ed}from"./chunks/vendor-antd.js?v=1775123024591";import{G as Hi}from"./chunks/use-feedback-bridge.js?v=1775123024591";import{P as td}from"./chunks/vendor-export.js?v=1775123024591";import{_ as sd}from"./chunks/preload-helper.js?v=1775123024591";import"./chunks/_commonjsHelpers.js?v=1775123024591";import"./chunks/_commonjs-dynamic-modules.js?v=1775123024591";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))a(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&a(l)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function a(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();const nd=({...t})=>e.jsx(Ql,{className:"toaster group",icons:{success:e.jsx(ti,{className:"size-4"}),info:e.jsx(ei,{className:"size-4"}),warning:e.jsx(La,{className:"size-4"}),error:e.jsx(Xl,{className:"size-4"}),loading:e.jsx(gt,{className:"size-4 animate-spin"})},style:{"--normal-bg":"hsl(var(--popover))","--normal-text":"hsl(var(--popover-foreground))","--normal-border":"hsl(var(--border))","--border-radius":"var(--radius)"},...t}),ad="axhub-admin-active-tab",xo="axhub-make-dark-mode",$n="axhub-make-welcome-dismissed",go="axhub:assistant-panel-width",Ca="axhub:open-assistant-url",rd="./skills/project-guide/SKILL.md",yo=["我是新人,请先阅读项目引导技能文档,带我熟悉 Axhub Make:",rd].join(` `),od=1,id="2026-03-28",ld=[{id:"brainstorming",title:"Brainstorming",titleZh:"头脑风暴",description:"用于快速发散想法、明确文档主题与结构方向。",defaultSelected:!0,localPaths:["/skills/third-party/brainstorming/SKILL.md"],references:["obra/superpowers@brainstorming"],category:"研究与探索"},{id:"deep-research",title:"Deep Research",titleZh:"深度研究",description:"用于系统化收集证据、形成深入研究材料。",defaultSelected:!1,localPaths:["/skills/third-party/deep-research/SKILL.md"],references:["199-biotechnologies/claude-deep-research-skill@deep-research"],category:"研究与探索"},{id:"anything-to-notebooklm",title:"Anything to NotebookLM",titleZh:"资料转 NotebookLM",description:"将原始素材整理为适合 NotebookLM 使用的输入结构。",defaultSelected:!1,localPaths:["/skills/third-party/anything-to-notebooklm/SKILL.md"],references:["joeseesun/anything-to-notebooklm@anything-to-notebooklm"],category:"研究与探索"},{id:"prd",title:"PRD",titleZh:"产品需求文档",description:"用于生成或完善 PRD 结构与内容。",defaultSelected:!1,localPaths:["/skills/third-party/prd/SKILL.md"],references:["https://skills.sh/github/awesome-copilot/prd"],category:"产品与需求"},{id:"product-requirements",title:"Product Requirements",titleZh:"产品需求",description:"用于整理产品目标、范围与需求细节。",defaultSelected:!1,localPaths:["/skills/third-party/product-requirements/SKILL.md"],references:["https://skills.sh/cexll/myclaude/product-requirements"],category:"产品与需求"},{id:"research",title:"Research",titleZh:"研究分析",description:"用于进行主题研究、资料筛选与结果归纳。",defaultSelected:!1,localPaths:["/skills/third-party/research/SKILL.md"],references:["https://skills.sh/tavily-ai/skills/research"],category:"研究与探索"},{id:"user-story-writing",title:"User Story Writing",titleZh:"用户故事编写",description:"用于编写清晰可执行的用户故事。",defaultSelected:!1,localPaths:["/skills/third-party/user-story-writing/SKILL.md"],references:["https://skills.sh/aj-geddes/useful-ai-prompts/user-story-writing"],category:"产品与需求"}],cd={version:od,generatedAt:id,skills:ld},dd=3,ud="2026-03-28",md=[{id:"project-guide",titleZh:"项目引导",titleEn:"Project Guide",description:"不知道从何开始或需要获得开发建议时,执行该技能。AI 会为你评估当前项目状态,并推荐最佳的下一步操作与平台使用技巧。",localPath:"/skills/project-guide",skillMdPath:"/skills/project-guide/SKILL.md",slashCommand:"/project-guide",category:"项目管理"},{id:"create-workflow",titleZh:"创建内容",titleEn:"Unified Create",description:"想创建任何新内容(如原型、组件、主题或文档)时执行此技能。AI 会引导你完成规范的创建流程,无需手动记忆繁杂的规则。",localPath:"/skills/create-workflow",skillMdPath:"/skills/create-workflow/SKILL.md",slashCommand:"/create-workflow",category:"日常工作流"},{id:"design-review",titleZh:"设计 Review",titleEn:"Design Review",description:"界面开发完成后,想检查是否符合项目 UI 规范时执行此技能。AI 会帮你找出违规样式并提供修改建议,或帮你将新设计沉淀为主题。",localPath:"/skills/design-review",skillMdPath:"/skills/design-review/SKILL.md",slashCommand:"/design-review",category:"日常工作流"},{id:"project-memory",titleZh:"项目整理",titleEn:"Project Memory",description:"想整理项目积累的经验时执行此技能。AI 会把近期的代码变更、零散信息和新增逻辑沉淀至说明文档中,以保持项目资产井井有条。",localPath:"/skills/project-memory",skillMdPath:"/skills/project-memory/SKILL.md",slashCommand:"/project-memory",category:"日常工作流"},{id:"work-summary",titleZh:"工作总结",titleEn:"Work Summary",description:"日常报告编写利器。随时执行该技能来回顾近期的成果,AI 会自动追踪你的代码变更,直接为你生成一份清晰的日报或工作总结。",localPath:"/skills/work-summary",skillMdPath:"/skills/work-summary/SKILL.md",slashCommand:"/work-summary",category:"日常工作流"},{id:"skills-management",titleZh:"技能管理",titleEn:"Skills Management",description:"管理和维护当前项目的技能库。当你想为团队添加新的自定义技能、修改现有描述或恢复官方默认技能时,执行此技能。",localPath:"/skills/skills-management",skillMdPath:"/skills/skills-management/SKILL.md",slashCommand:"/skills-management",category:"项目管理"}],hd={version:dd,generatedAt:ud,skills:md},pd=1,fd="2026-03-28",xd=[{id:"frontend-design",title:"Landing & Marketing",titleEn:"Landing & Marketing",titleZh:"C端展示与落地页",description:"使用场景:需要打造高辨识度视觉风格的页面/落地页/展示型界面时;强调创意审美、版式与动效表达,避免模板化“AI 味”。",localPaths:["/skills/third-party/frontend-design/SKILL.md"],sourcePageUrl:"https://skills.sh/anthropics/skills/frontend-design",sourceRepoUrl:"https://github.com/anthropics/skills",sourcePath:"skills/frontend-design",license:null,category:"设计与体验"},{id:"interface-design",title:"Admin & SaaS Interface",titleEn:"Admin & SaaS Interface",titleZh:"B端后台与SaaS",description:"使用场景:后台、SaaS、工具类产品的交互界面设计(仪表盘/设置页/数据界面);强调信息架构与可用性,不用于营销落地页。",localPaths:["/skills/third-party/interface-design/SKILL.md"],sourcePageUrl:"https://skills.sh/dammyjay93/interface-design/interface-design",sourceRepoUrl:"https://github.com/Dammyjay93/interface-design",sourcePath:".claude/skills/interface-design",license:null,category:"设计与体验"},{id:"ui-ux-pro-max",title:"UI/UX Pro Max",titleEn:"UI/UX Pro Max",titleZh:"UI/UX 专家指南",description:"使用场景:需要快速选型和评审 UI/UX 方案时(色板、字体、图表、无障碍、响应式、性能);更偏规则库与优化清单,而非单一风格生成。",localPaths:["/skills/ui-ux-pro-max/SKILL.md"],sourcePageUrl:"https://skills.sh/nextlevelbuilder/ui-ux-pro-max-skill/ui-ux-pro-max",sourceRepoUrl:"https://github.com/nextlevelbuilder/ui-ux-pro-max-skill",sourcePath:".claude/skills/ui-ux-pro-max",license:null,category:"设计与体验"},{id:"implement-design",title:"figma-implement-design",titleEn:"figma-implement-design",titleZh:"Figma 设计实现还原",description:"使用场景:拿到 Figma 链接或选中节点后,基于 Figma MCP 进行 1:1 设计还原并输出可落地代码。",localPaths:["/skills/third-party/implement-design/SKILL.md"],sourcePageUrl:"https://skills.sh/figma/mcp-server-guide/implement-design",sourceRepoUrl:"https://github.com/figma/mcp-server-guide",sourcePath:"skills/implement-design",license:null,category:"开发与实现"},{id:"baoyu-image-gen",title:"Baoyu Image Gen",titleEn:"Baoyu Image Gen",titleZh:"宝玉图像生成",description:"使用场景:批量生成视觉素材(插画、封面、背景图等)而非页面结构;支持 OpenAI/Google/DashScope、多比例与参考图生成。",localPaths:["/skills/third-party/baoyu-image-gen/SKILL.md"],sourcePageUrl:"https://skills.sh/jimliu/baoyu-skills/baoyu-image-gen",sourceRepoUrl:"https://github.com/jimliu/baoyu-skills",sourcePath:"skills/baoyu-image-gen",license:null,category:"设计与体验"},{id:"shadcn-ui",title:"shadcn/ui",titleEn:"shadcn/ui",titleZh:"shadcn 组件体系",description:"使用场景:React + Tailwind 项目搭建/扩展 shadcn/ui 组件体系;侧重可访问性、表单模式、主题变量与组件工程化复用。",localPaths:["/skills/third-party/shadcn-ui/SKILL.md"],sourcePageUrl:"https://skills.sh/giuseppe-trisciuoglio/developer-kit/shadcn-ui",sourceRepoUrl:"https://github.com/giuseppe-trisciuoglio/developer-kit",sourcePath:"plugins/developer-kit-typescript/skills/shadcn-ui",license:null,category:"开发与实现"},{id:"ant-design",title:"Ant Design",titleEn:"Ant Design",titleZh:"Ant Design 企业后台",description:"使用场景:企业后台/管理系统采用 antd 6 + Pro + X 时的组件选型与架构决策;强调 token 主题、SSR、CRUD 与 AI 聊天 UI 模式。",localPaths:["/skills/third-party/ant-design/SKILL.md"],sourcePageUrl:"https://skills.sh/ant-design/antd-skill/ant-design",sourceRepoUrl:"https://github.com/ant-design/antd-skill",sourcePath:"skills/ant-design",license:null,category:"开发与实现"},{id:"stitch-skills",title:"Stitch Skills",titleEn:"Stitch Skills",titleZh:"Stitch 主流程编排",description:"使用场景:以 spec.md 驱动 Stitch 设计并确认后再生成代码;统一编排 design-md、stitch-loop、react-components,避免跳过设计 gate。",localPaths:["/skills/third-party/stitch-skills/stitch-main-workflow/SKILL.md"],sourcePageUrl:"https://github.com/google-labs-code/stitch-skills",sourceRepoUrl:"https://github.com/google-labs-code/stitch-skills",sourcePaths:["skills/design-md","skills/react-components","skills/stitch-loop"],license:"Apache-2.0",category:"开发与实现"},{id:"gemini-cli-uiux",title:"Gemini CLI UI/UX",titleEn:"Gemini CLI UI/UX",titleZh:"Gemini 设计",description:"AI 直接调用 Gemini CLI 进行 UI/UX 设计与落地",localPaths:["/skills/gemini-cli-uiux/SKILL.md"],activeTabs:["prototypes"],license:null,category:"开发与实现"},{id:"design-bid-proposals",title:"Design Bid Proposals",titleEn:"Design Bid Proposals",titleZh:"设计比稿三案",description:"使用场景:在原型或组件新建时默认生成 A 稳健型、B 平衡型、C 突破型三案;严格在 3–6 个未锁死维度上拉开差异,并输出差异对比表与推荐方向。",localPaths:["/skills/design-bid-proposals/SKILL.md"],license:null,category:"设计与体验"},{id:"pencil-sync-after-prototype-workflow",title:"Pencil Sync After Prototype Workflow",titleEn:"Pencil Sync After Prototype Workflow",titleZh:"原型后置 Pencil 同步",description:"使用场景:先完成 spec.md 与 index.tsx 原型实现,再 1:1 回建 Pencil,并要求后续代码、规格与 .pen 强同步。",localPaths:["/skills/pencil-sync-after-prototype-workflow/SKILL.md"],activeTabs:["prototypes"],license:null,category:"开发与实现"},{id:"taste-skill",title:"Design Taste",titleEn:"Design Taste",titleZh:"高品质前端设计",description:"使用场景:打造高品质、去 AI 味的前端界面;通过设计方差、动效强度、视觉密度三个维度精确控制输出风格,内置反 AI 模板化规则与高端设计灵感库。",localPaths:["/skills/third-party/taste-skill/SKILL.md"],sourceRepoUrl:"https://github.com/Leonxlnx/taste-skill",sourcePath:"taste-skill",license:null,category:"设计与体验"}],gd={version:pd,generatedAt:fd,skills:xd},yd=1,bd="2026-03-28",wd=[{id:"tailwind-design-system",title:"Tailwind Design System",titleZh:"Tailwind 设计系统",description:"用于基于 Tailwind CSS v4 设计和落地可扩展主题系统,覆盖 token、变量、组件模式与响应式规范。",defaultSelected:!0,localPaths:["/skills/third-party/tailwind-design-system/SKILL.md"],category:"开发与实现"},{id:"theme-factory",title:"Theme Factory",titleZh:"主题工厂",description:"用于快速构建和应用视觉主题方案,包含颜色体系与字体搭配参考,适合主题风格探索与定稿。",defaultSelected:!1,localPaths:["/skills/third-party/theme-factory/SKILL.md"],category:"设计与体验"},{id:"ui-ux-pro-max",title:"UI/UX Pro Max",titleZh:"UI/UX 专家指南",description:"用于补充 UI/UX 规则库与评审清单,覆盖可访问性、色板、排版、交互、响应式与性能优化建议。",defaultSelected:!1,localPaths:["/skills/ui-ux-pro-max/SKILL.md"],category:"设计与体验"},{id:"ui-design-brain",title:"UI Design Brain",titleZh:"UI 设计大脑",description:"用于基于 60+ 真实组件模式与界面最佳实践来辅助主题和界面风格设计,减少通用 AI 模板感。",defaultSelected:!1,localPaths:["/skills/third-party/ui-design-brain/SKILL.md"],sourceRepoUrl:"https://github.com/carmahhawwari/ui-design-brain",sourcePath:".",license:"MIT",category:"设计与体验"},{id:"gemini-cli-uiux",title:"Gemini CLI UI/UX",titleZh:"Gemini 设计",description:"AI 直接调用 Gemini CLI 进行 UI/UX 设计与落地",defaultSelected:!1,localPaths:["/skills/gemini-cli-uiux/SKILL.md"],category:"设计与体验"}],jd={version:yd,generatedAt:bd,skills:wd},za=Object.assign({"../../../../axhub-make/.axhub/make/skills/doc-skills-manifest.default.json?v=1775123024591":cd,"../../../../axhub-make/.axhub/make/skills/install-skills-manifest.default.json?v=1775123024591":hd,"../../../../axhub-make/.axhub/make/skills/skills-manifest.default.json?v=1775123024591":gd,"../../../../axhub-make/.axhub/make/skills/theme-skills-manifest.default.json?v=1775123024591":jd});function bo(t){var s;return((s=t.split("?")[0])==null?void 0:s.split("#")[0])||t}function Ba(t,s){const n=`${s}.json`,a=`${s}.default.json`,o=Object.entries(t).find(([l])=>bo(l).endsWith(`/${n}`));if(o)return o[1];const i=Object.entries(t).find(([l])=>bo(l).endsWith(`/${a}`));if(i)return i[1];throw new Error(`Missing skill manifest: ${n} or ${a}`)}const qi=Ba(za,"doc-skills-manifest"),Nd=Ba(za,"install-skills-manifest"),Lr=Ba(za,"skills-manifest"),Zi=Ba(za,"theme-skills-manifest"),br="skills",vd=`/${br}/`;function aa(t){if(typeof t!="string"||t.includes("\0"))return null;const s=t.trim();if(!s||s.includes(":"))return null;const n=s.replace(/\\+/g,"/"),o=(n.startsWith("/")?n:`/${n}`).split("/").filter(Boolean);if(o.length<2||o[0]!==br)return null;const i=[br];for(let c=1;c{const l=a.find(c=>c.name===i);return` ${o(i,l)}`}).join("")}`}function Ed(t,s=[]){const n=new Set(t.map(l=>String(l||"").trim()).filter(Boolean)),a=new Set,o=[],i=Array.isArray(wo.skills)?wo.skills:[];for(const l of i)if(n.has(l.id)&&Array.isArray(l.localPaths))for(const c of l.localPaths){const d=aa(c);d&&(a.has(d)||(a.add(d),o.push(d)))}for(const l of s){const c=aa(l);c&&(a.has(c)||(a.add(c),o.push(c)))}return o.length===0?"":` **使用项目技能**: ${o.map(l=>`- \`${l}\``).join(` `)}`}function Td(t,s){const n=`\`/src/themes/${t}/DESIGN.md\``,a=`\`/src/themes/${t}/designToken.json\``,o=`\`/src/themes/${t}/globals.css\``,i=`\`/src/themes/${t}/index.tsx\``;if([s==null?void 0:s.hasDesignSpec,s==null?void 0:s.hasDesignToken,s==null?void 0:s.hasGlobals,s==null?void 0:s.hasIndexTsx].some(c=>typeof c=="boolean")){const c=[];return s!=null&&s.hasDesignSpec&&c.push(` - ${n}`),s!=null&&s.hasDesignToken&&c.push(` - ${a}`),s!=null&&s.hasGlobals&&c.push(` - ${o}`),s!=null&&s.hasIndexTsx&&c.push(` - ${i}`),c}return[` - ${n}(如果存在)`,` - ${a}(如果存在)`,` - ${o}(如果存在)`,` - ${i}(如果存在)`]}function Id(t,s=[],n=[],a=[],o=[],i=[],l=[],c=[]){const w=t==="components"?"组件":"原型",j=`**系统指令**:你将作为UI/UX 设计架构师 × 前端工程师(复合型),创建一个${w}`,$=Sd({itemType:w}),v=kd(),D=tr({title:"**📚 参考文档**:",selected:n,available:a,toLine:(y,P)=>`- **\`/docs/${y}\`** - ${(P==null?void 0:P.displayName)||y}`}),u=tr({title:"**🎨 主题配置**:",selected:o,available:i,toLine:(y,P)=>{const R=Td(y,P);return R.length?`- ${(P==null?void 0:P.displayName)||y} ${R.join(` `)}`:`- ${(P==null?void 0:P.displayName)||y}`}}),C=tr({title:"**📊 参考数据**:",selected:l,available:c,toLine:(y,P)=>`- **\`/src/database/${y}\`** - ${(P==null?void 0:P.displayName)||y}`}),K=Ed(s);return`${j} ⚠️ **重要提示**:请务必完整阅读以下所有规范文档和参考资料,不要偷懒!这些文档包含了关键的开发规范和最佳实践。 ${K}${v}${u}${D}${C} ${$}`}(Lr.skills??[]).map(t=>({id:String(t.id??t.key??t.name??t.title??"").trim(),title:String(t.titleEn??t.title??t.name??t.titleZh??t.titleCn??"").trim(),titleZh:String(t.titleZh??t.titleCn??"").trim()||void 0,titleEn:String(t.titleEn??t.title??t.name??"").trim()||void 0,description:String(t.description??""),localPaths:Array.isArray(t.localPaths)?t.localPaths:[]}));function Pd(t,s){const[n,a]=r.useState(!1),[o,i]=r.useState([]),[l,c]=r.useState([]),[d,w]=r.useState([]),[j,$]=r.useState([]),[v,D]=r.useState([]),[u,C]=r.useState([]),[K,y]=r.useState([]),[P,R]=r.useState(!1);return r.useEffect(()=>{if(!P)return;(async()=>{try{const re=await fetch("/api/docs");if(re.ok){const B=await re.json();$(B)}}catch(re){console.error("Failed to load docs:",re)}})()},[P]),r.useEffect(()=>{if(!P)return;(async()=>{try{const re=await fetch("/api/themes");if(re.ok){const B=await re.json();c(B)}}catch(re){console.error("Failed to load themes:",re)}})()},[P]),r.useEffect(()=>{if(!P)return;(async()=>{try{const re=await fetch("/api/data/tables");if(re.ok){const xe=(await re.json()).map(ie=>({name:`${ie.fileName}.json`,displayName:ie.tableName}));C(xe)}}catch(re){console.error("Failed to load data assets:",re)}})()},[P]),r.useEffect(()=>{n&&(y([]),R(!0))},[n]),{createDialogVisible:n,selectedThemes:o,availableThemes:l,selectedDocs:d,availableDocs:j,selectedDataAssets:v,availableDataAssets:u,selectedSkills:K,setCreateDialogVisible:a,setSelectedThemes:i,setSelectedDocs:w,setSelectedDataAssets:D,setSelectedSkills:y,buildPrompt:async()=>Id(t,K,d,j,o,l,v,u),clearCreateDialogState:()=>{a(!1),w([]),i([]),D([]),y([]),R(!1),$([]),c([]),C([])},handleCreateCancel:()=>{a(!1),w([]),i([]),D([]),y([]),R(!1),$([]),c([]),C([])}}}async function Dd(t){const s=await fetch("/api/prompt/execute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await s.json();if(!s.ok)throw new Error((n==null?void 0:n.error)||"自动执行失败");if(!(n!=null&&n.url)||typeof n.url!="string")throw new Error("自动执行返回地址无效");return{...n,url:In(n.url)}}const Pt={async deleteItem(t){const s=await fetch("/api/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});if(!s.ok){const n=await s.json();throw new Error(n.error||"删除失败")}return s.json()},async getWsClients(){const t=await fetch("/api/ws/clients");return t.ok?(await t.json()).clients||[]:[]},async sendWsMessage(t){const s=await fetch("/api/ws/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!s.ok){const n=await s.text();throw new Error(n||"发送失败")}return s.json()},async fetchCode(t){const s=await fetch(t);if(!s.ok)throw new Error(`获取构建代码失败,请让 AI 修复: ${s.statusText}`);return s.text()},async fetchHackCss(t,s){const n=`${window.location.origin}/${t}/${s}/hack.css`;try{const a=await fetch(n);if(a.ok)return await a.text()}catch(a){console.warn("fetch hack.css failed",a)}return""},async fetchSpecMd(t,s){const n=`${window.location.origin}/${t}/${s}/spec.md`;try{const a=await fetch(n);if(a.ok)return await a.text()}catch(a){console.warn("Error fetching spec.md",a)}return""},async reviewCode(t,s={}){const n=await fetch("/api/code-review",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,enforceComponentExportName:s.enforceComponentExportName===!0})});if(!n.ok){const a=await n.json();throw new Error(a.error||"代码检查失败")}return n.json()},async getAxureApiPreview(t){const s=await fetch("/api/axure-api-preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})}),n=await s.json();if(!s.ok)throw new Error((n==null?void 0:n.error)||"加载 Axure API 预览失败");return n},async probeExportMake(t){const s=await fetch(`/api/export-make?path=${encodeURIComponent(t)}&probe=1`),n=await s.json();if(!s.ok)throw new Error((n==null?void 0:n.error)||"加载 .fig 导出状态失败");return n},async getExportMakePrompt(t){const s=await fetch(`/api/export-make?path=${encodeURIComponent(t)}&prompt=1`),n=await s.json();if(!s.ok)throw new Error((n==null?void 0:n.error)||"加载 .fig 导出 Prompt 失败");return n},async executePrompt(t){const s={scene:t.scene,client:t.client,prompt:t.prompt};return Dd(s)},async getConfig(){const t=await fetch("/api/config");if(!t.ok)throw new Error("加载配置失败");return t.json()},async getAssistantRuntime(t){const s=(t==null?void 0:t.autoStart)===!1?"?autoStart=false":"",n=await fetch(`/api/assistant/runtime${s}`);if(!n.ok)throw new Error("加载助手运行时配置失败");return n.json()},async bootstrapAssistant(t){const s=await fetch("/api/assistant/bootstrap",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await s.json();if(!s.ok)throw new Error((n==null?void 0:n.error)||"启动 Axhub Genie 失败");return n},async openIDE(t){const s=await fetch("/api/ide/open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await s.json();if(!s.ok)throw new Error((n==null?void 0:n.error)||"打开 IDE 失败");return n}},Ad=["genieApiBaseUrl","apiBaseUrl","genieIntegrationChannel","integrationChannel","genieTargetClientId","integrationClientId","cwd","workdir","provider","tool","targetPath","context","editorIntegrationWs","editorApiBaseUrl","editorIntegrationChannel","editorClientId","editorSessionId","editorPageUrl"];function jo(t){for(const s of Ad)t.searchParams.delete(s)}function Rd(t){return String(t||"").trim().replace(/^\/+/,"").replace(/\/+$/,"").replace(/\/{2,}/g,"/")}function $d(t){return Rd(t).split("/").filter(Boolean).map(s=>encodeURIComponent(s)).join("/")}function wr(t,s,n){var i;if(!t)return null;const a=s==="demo"?t.demoUrl:t.specUrl,o=new URL(a,window.location.origin);if(s==="demo"){const l=$d(((i=n==null?void 0:n.selectedSubPage)==null?void 0:i.path)||"");if(l){const c=o.pathname.replace(/\/+$/,"");o.pathname=`${c}/${l}`}}return o}function Od(t,s,n,a){const o=wr(t,s,{selectedSubPage:s==="demo"?a==null?void 0:a.selectedSubPage:null});if(!o)return"";const i=String((t==null?void 0:t.displayName)||"").trim(),l=a==null?void 0:a.integrationWs,c=a==null?void 0:a.genieBridge,d=!!(l!=null&&l.enabled&&String(l.channel).trim()&&String(l.clientId||"").trim()),w=String((c==null?void 0:c.projectPath)||"").trim();if(i?o.searchParams.set("axhubDisplayName",i):o.searchParams.delete("axhubDisplayName"),s==="demo"&&n==="webEditorV2"){if(o.searchParams.set("editor","webEditorV2"),d){o.searchParams.set("editorIntegrationWs","1"),o.searchParams.set("editorIntegrationChannel",String(l==null?void 0:l.channel).trim()),o.searchParams.set("editorClientId",String((l==null?void 0:l.clientId)||"").trim());const j=String((l==null?void 0:l.apiBaseUrl)||"").trim();j?o.searchParams.set("editorApiBaseUrl",j):o.searchParams.delete("editorApiBaseUrl");const $=String((l==null?void 0:l.sessionId)||"").trim();$?o.searchParams.set("editorSessionId",$):o.searchParams.delete("editorSessionId")}else o.searchParams.delete("editorIntegrationWs"),o.searchParams.delete("editorApiBaseUrl"),o.searchParams.delete("editorIntegrationChannel"),o.searchParams.delete("editorClientId"),o.searchParams.delete("editorSessionId");w?o.searchParams.set("cwd",w):o.searchParams.delete("cwd")}else s==="spec"&&n==="specAnnotation"?(jo(o),o.searchParams.set("editor","specAnnotation"),o.searchParams.set("specEdit","1")):(jo(o),o.searchParams.delete("editor"),o.searchParams.delete("specEdit"));return a!=null&&a.width&&Number.isFinite(a.width)?o.searchParams.set("width",String(Math.round(a.width))):o.searchParams.delete("width"),o.toString()}function Pn(t,s){const n=t;if(n.filePath){const o=n.filePath.indexOf("src/");if(o>=0){let i=n.filePath.substring(o);return i=i.replace(/\/index\.(t|j)sx?$/i,""),i}return n.filePath}return`${s==="prototypes"?"src/prototypes":"src/components"}/${t.name}`}const _d="AXHUB_WEB_EDITOR_GENIE_REQUEST",Ji=["workspacePaths","relatedFiles","extraContext"];function ws(t){return typeof t=="string"?t.trim():""}function Zt(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function Qi(t){const s=[],n=new Set;for(const a of t){const o=ws(a);!o||n.has(o)||(n.add(o),s.push(o))}return s}function Ld(t){return Array.isArray(t)?Qi(t):[]}function sr(t){const n=t.replace(/\\/g,"/").split("/").filter(Boolean);return n[n.length-1]||t}function Md(t){const s=ws(t);if(s==="claude"||s==="cursor"||s==="codex"||s==="gemini"||s==="opencode")return s}function Ud(t){if(!Zt(t))return null;const s=ws(t.tag),n=ws(t.selector),a=ws(t.label);return!s||!n||!a?null:{tag:s,selector:n,label:a}}function Fd(t){if(!Array.isArray(t))return[];const s=[],n=new Set;for(const a of t){const o=Ud(a);if(!o)continue;const i=`${o.tag}::${o.selector}::${o.label}`;n.has(i)||(n.add(i),s.push(o))}return s}function No(t){if(!Zt(t))return{};const s={};for(const n of Ji){const a=Ld(t[n]);a.length>0&&(s[n]=a)}return s}function Xi(t,s){const n=No(t),a=No(s),o={};for(const i of Ji){const l=Qi([...n[i]??[],...a[i]??[]]);l.length>0&&(o[i]=l)}return o}function jr(t,s){if(!Zt(t)&&!s)return;const n=Zt(t)?{...t}:{},a=Xi(Zt(n.promptContext)?n.promptContext:n,s);return Object.keys(a).length>0&&(n.promptContext={...Zt(n.promptContext)?n.promptContext:{},...a}),Object.keys(n).length>0?n:void 0}function zd(t,s){const n=jr(t),a=jr(s),o=Xi(Zt(n)?Zt(n.promptContext)?n.promptContext:n:void 0,Zt(a)?Zt(a.promptContext)?a.promptContext:a:void 0),i={...n??{},...a??{}};return Object.keys(o).length>0&&(i.promptContext={...Zt(n==null?void 0:n.promptContext)?n.promptContext:{},...Zt(a==null?void 0:a.promptContext)?a.promptContext:{},...o}),Object.keys(i).length>0?i:void 0}function Bd(t){if(!t||typeof t!="object")return!1;const s=t;if(s.type!==_d||!s.payload||typeof s.payload!="object")return!1;const n=s.payload;return typeof n.preferCurrentSession=="boolean"&&typeof n.mode=="string"}function bs(t,s={}){const n=ws(s.path),a=ws(s.displayName);if(typeof t=="string"){const l=ws(t)||n;return{path:l,displayName:a||sr(l)}}if(!Zt(t))return{path:n,displayName:a||sr(n)};const o=ws(t.path)||n,i=ws(t.displayName)||a||sr(o);return{path:o,displayName:i}}function Nr(t){return bs(t).path}function Mr(t,s={}){if(!Zt(t))return null;const n=bs(t.currentFile,{...bs(s.fallbackCurrentFile)});return{version:"1",systemContext:typeof t.systemContext=="string"?t.systemContext:"",currentFile:n,selectedElements:Fd(t.selectedElements),extensions:jr(t.extensions,s.promptContext)}}function nr(t,s){return!t&&!s?null:t?s?{version:"1",systemContext:s.systemContext||t.systemContext,currentFile:bs(s.currentFile,bs(t.currentFile)),selectedElements:s.selectedElements.length>0?s.selectedElements:t.selectedElements,extensions:zd(t.extensions,s.extensions)}:t:s??null}function Wd(t,s={}){if(!Zt(t))return null;const n=ws(t.mode);return n!=="selection_context"&&n!=="save"||typeof t.preferCurrentSession!="boolean"?null:{mode:n,provider:Md(t.provider),prompt:typeof t.prompt=="string"?t.prompt:void 0,targetPath:ws(t.targetPath)||void 0,preferCurrentSession:t.preferCurrentSession,context:t.context?Mr(t.context,{fallbackCurrentFile:s.fallbackCurrentFile,promptContext:s.promptContext})??void 0:void 0}}function Gd(t,s){const n=String(t||"").trim(),a=String(s||"").trim();return!!(n&&a&&n!==a)}function Kd(t){return{...t,currentFile:bs(t.currentFile),selectedElements:[]}}function vr(t){return Nr(t.currentFile)}function Vd(t){const s=r.useRef(null),[n,a]=r.useState(!1),o=r.useRef(!1);r.useEffect(()=>{a(!1)},[t]),r.useEffect(()=>{o.current=n},[n]);const i=r.useCallback(()=>{try{return new URL(t).origin}catch{return"*"}},[t]),l=r.useCallback((j,$="replace")=>{const v=s.current;if(!v||!v.contentWindow)return!1;const D={type:"update_context",mode:$,context:{version:j.version,systemContext:j.systemContext,currentFile:j.currentFile,selectedElements:j.selectedElements,extensions:j.extensions}};return v.contentWindow.postMessage(D,i()),!0},[i]),c=r.useCallback((j,$)=>{const v=s.current;if(!v||!v.contentWindow)return!1;const D={type:"update_prompt",prompt:j,autoSend:$};return v.contentWindow.postMessage(D,i()),!0},[i]),d=r.useCallback((j,$="replace")=>{l(j,$),$==="replace"&&(window.setTimeout(()=>l(j,$),160),window.setTimeout(()=>l(j,$),520))},[l]),w=r.useCallback(async(j=8e3)=>{var v;const $=Date.now();for(;Date.now()-$setTimeout(D,120))}return!1},[]);return{iframeRef:s,iframeLoaded:n,setIframeLoaded:a,syncContext:l,syncContextWithRetry:d,syncPrompt:c,waitForReady:w}}const ar="__axhub_assistant_runtime_page_store__";function Hd(){return{runtime:null,initialized:!1,initialProbePromise:null,requests:{},listeners:new Set}}function Ys(){const t=globalThis;return t[ar]||(t[ar]=Hd()),t[ar]}function qd(t){Ys().listeners.forEach(n=>{n(t)})}function Ur(t){const s=Ys();s.runtime=t,t&&(s.initialized=!0),qd(t)}function Zd(t){const s=Ys();return s.listeners.add(t),()=>{s.listeners.delete(t)}}function Jd(t){return(t==null?void 0:t.autoStart)===!1?"probe":"auto-start"}async function Yi(t){const s=Ys(),n=Jd(t),a=s.requests[n];if(a)return a;const o=(async()=>{const i=await Pt.getAssistantRuntime({autoStart:(t==null?void 0:t.autoStart)??!0});return Ur(i),i})().finally(()=>{const i=Ys();i.requests[n]===o&&delete i.requests[n]});return s.requests[n]=o,o}async function Qd(t){const s=Ys();return s.initialized&&s.runtime?s.runtime:s.runtime?(s.initialized=!0,s.runtime):(s.initialProbePromise||(s.initialProbePromise=Yi({autoStart:!1}).catch(()=>(Ur(t),t)).finally(()=>{const n=Ys();n.initialized=!0,n.initialProbePromise=null})),s.initialProbePromise)}function Xd({defaultRuntime:t}){const s=r.useRef(t),[n,a]=r.useState(()=>Ys().runtime),[o,i]=r.useState(!1);r.useEffect(()=>{s.current=t},[t]);const l=r.useCallback(d=>{Ur(d)},[]),c=r.useCallback(async d=>Yi({autoStart:(d==null?void 0:d.autoStart)??!1}),[]);return r.useEffect(()=>{let d=!1;const w=Zd(j=>{d||a(j)});return Qd(s.current).then(j=>{d||a(j)}),()=>{d=!0,w()}},[]),{runtime:n,setRuntime:l,checking:o,setChecking:i,refreshRuntime:c}}function Yd(t,s){const n=Array.isArray(t)?t:[],a=Array.isArray(s)?s:[],o=[...n],i=new Set(o.map(l=>String((l==null?void 0:l.selector)||"").trim()).filter(Boolean));for(const l of a){const c=String((l==null?void 0:l.selector)||"").trim();!c||i.has(c)||(o.push(l),i.add(c))}return o}function eu(t){const s=Array.isArray(t)?t:[],n=[],a=new Set;for(const o of s){const i=String((o==null?void 0:o.tag)||"").trim(),l=String((o==null?void 0:o.selector)||"").trim(),c=String((o==null?void 0:o.label)||"").trim();if(!i||!l||!c)continue;const d=`${i}::${l}::${c}`;a.has(d)||(a.add(d),n.push({tag:i,selector:l,label:c}))}return n}const tu=3e3,vo=5e3,su=5,nu=1500,au=3,el="Genie 页面未在线,请先打开对应 Genie 页面。",tl="Genie 连接配置不完整。",So="Genie 连接未建立,请稍后重试。";function rr(t){const s=Math.random().toString(36).slice(2,10);return`${t}_${Date.now().toString(36)}_${s}`}function Co(t,s){return typeof t!="number"||!Number.isFinite(t)||t<=0?s:Math.max(100,Math.round(t))}function ko(t){return!!t&&typeof t=="object"}function ru(t,s){const n=t.payload;if(!n||typeof n!="object")return!1;const a=n.frontend;return ko(a)?typeof a.connected=="boolean"?a.connected:Array.isArray(a.clients)?a.clients.some(o=>ko(o)&&o.clientId===s):!1:!1}function ou(t,s){if(t==="FRONTEND_NOT_ONLINE")return el;const n=typeof s=="string"?s.trim():"";return n||(typeof t=="string"&&t.trim()?`Genie 集成失败:${t.trim()}`:"Genie 集成失败,请稍后重试。")}function iu(t,s){const n=String(t??"").trim();if(!n)throw new Error(tl);const a=new URL(n);a.protocol=a.protocol==="https:"?"wss:":"ws:",a.pathname=`${a.pathname.replace(/\/+$/,"")}/agent/ws`;const o=String(s??"").trim();return o?a.searchParams.set("apiKey",o):a.searchParams.delete("apiKey"),a.toString()}function lu(t){let s=!1,n=!1,a=null,o=null,i=null,l=null,c=null,d=null,w=0,j=0;const $=new Map;function v(k){var N;n!==k&&(n=k,(N=t.onAvailabilityChange)==null||N.call(t,k))}function D(){return String(t.apiBaseUrl).trim().length>0&&String(t.integrationChannel).trim().length>0&&String(t.targetClientId).trim().length>0&&String(t.externalClientId).trim().length>0}function u(){l!==null&&(window.clearTimeout(l),l=null)}function C(){c!==null&&(window.clearTimeout(c),c=null)}function K(){d!==null&&(window.clearTimeout(d),d=null)}function y(k){const N=$.get(k);N&&(window.clearTimeout(N.timeoutId),$.delete(k))}function P(k,N,U){const A=$.get(k);A&&(window.clearTimeout(A.timeoutId),$.delete(k),U==="FRONTEND_NOT_ONLINE"&&v(!1),A.reject(new Error(N)))}function R(k){const N=$.get(k);N&&(window.clearTimeout(N.timeoutId),$.delete(k),N.resolve())}function L(k){for(const[N,U]of $.entries())window.clearTimeout(U.timeoutId),U.reject(new Error(k)),$.delete(N)}function F(k,N){return new Promise((U,A)=>{const q=window.setTimeout(()=>{$.delete(k),A(new Error("等待 Genie 响应超时,请稍后重试。"))},N);$.set(k,{resolve:U,reject:A,timeoutId:q})})}function x(k){if(!a||a.readyState!==WebSocket.OPEN)throw new Error(So);a.send(JSON.stringify(k))}function V(){!s||!D()||d!==null||w>=su||(w+=1,d=window.setTimeout(()=>{d=null,z()},tu))}function re(){j=0,C()}function B(){!s||!D()||c!==null||!a||a.readyState!==WebSocket.OPEN||j>=au||(j+=1,c=window.setTimeout(()=>{c=null,se()},nu))}function xe(k){a===k&&(a=null,o=null,i=null,u(),C(),v(!1),L("Genie 连接已断开,请稍后重试。"),V())}function ie(k){let N=null;try{N=JSON.parse(k.data)}catch{return}if(N!=null&&N.type){if(N.type==="integration.connected"){w=0,re(),N.requestId===o&&t.probeOnStart!==!1&&se();return}if(N.type==="integration.pong"){if(N.requestId!==i)return;i=null,u();const U=ru(N,t.targetClientId);v(U),U?re():B();return}if(N.type==="integration.presence"){const U=N.payload;if(!U||U.channel!==t.integrationChannel||U.clientId!==t.targetClientId)return;U.event==="frontend-online"?(re(),v(!0)):U.event==="frontend-offline"&&v(!1);return}if(N.type==="integration.ack"&&N.requestId){R(N.requestId);return}if(N.type==="integration.error"){const U=N.payload,A=ou(U==null?void 0:U.code,U==null?void 0:U.message);N.requestId===i&&(i=null,u(),v(!1),B()),N.requestId&&P(N.requestId,A,U==null?void 0:U.code)}}}function z(){if(!s||!D()||a)return;let k;try{k=new WebSocket(iu(t.apiBaseUrl,t.apiKey))}catch{v(!1),V();return}a=k,k.onopen=()=>{if(a===k){K(),w=0,o=rr("genie_connect");try{x({type:"integration.connect",requestId:o,payload:{role:"external-client",channel:t.integrationChannel,clientId:t.externalClientId,capabilities:["presence.query","context.push"]}})}catch{k.close()}}},k.onmessage=ie,k.onerror=()=>{v(!1)},k.onclose=()=>{xe(k)}}async function se(){if(!s||!D())return;const k=rr("genie_probe"),N=Co(t.probeTimeoutMs,vo);i=k,u();try{x({type:"integration.ping",requestId:k,payload:{channel:t.integrationChannel,targetClientId:t.targetClientId}})}catch{i=null,v(!1),B();return}l=window.setTimeout(()=>{i===k&&(i=null,v(!1),B())},N)}async function W(k,N="replace"){if(!D())throw new Error(tl);if(!n)throw new Error(el);if(!a||a.readyState!==WebSocket.OPEN)throw new Error(So);const U=rr("genie_context"),A=F(U,Co(t.probeTimeoutMs,vo));try{x({type:"integration.context.update",requestId:U,payload:{channel:t.integrationChannel,targetClientId:t.targetClientId,mode:N,context:k}})}catch(q){throw y(U),q}await A}function S(){s=!1,K(),u(),C(),i=null,o=null,w=0,j=0,L("Genie bridge 已停止。");const k=a;a=null,k&&(k.onopen=null,k.onmessage=null,k.onerror=null,k.onclose=null,k.close()),v(!1)}function Y(){if(s){(t.probeOnStart??!0)&&(a==null?void 0:a.readyState)===WebSocket.OPEN&&se();return}s=!0,v(!1),w=0,j=0,C(),!(!D()||typeof window>"u"||typeof WebSocket>"u")&&z()}return{start:Y,stop:S,isAvailable(){return n},updateContext:W}}const cu={claude:"genie:claude",codex:"genie:codex",gemini:"genie:gemini",opencode:"genie:opencode"},sl=new Set(["genie:claude","genie:codex","genie:gemini","genie:opencode"]),nl=new Set(["local:cursor","local:qoder"]);function Da(t){if(t==null||typeof t!="string")return null;const s=t.trim().toLowerCase();return s?sl.has(s)||nl.has(s)?s:cu[s]||null:null}function al(t){return typeof t=="string"&&sl.has(t)}function rl(t){return typeof t=="string"&&nl.has(t)}function Fr(t){if(!al(t))return null;const s=t.split(":")[1];return s==="claude"||s==="codex"||s==="gemini"||s==="opencode"?s:null}function du(t){const s=new URL("cursor://anysphere.cursor-deeplink/prompt");return s.searchParams.set("text",t),s.toString()}function uu(t){const s=new URL("qoder://aicoding.aicoding-deeplink/chat");return s.searchParams.set("text",t),s.searchParams.set("mode","agent"),s.toString()}function Sr(t,s){if(!s)throw new Error("Prompt 不能为空");if(t==="local:cursor")return du(s);if(t==="local:qoder")return uu(s);throw new Error("不支持的本地编辑器类型")}function Eo(t,s){try{const a=sessionStorage.getItem(t);if(a)return a}catch{}const n=`${s}-${Math.random().toString(36).slice(2,10)}`;try{sessionStorage.setItem(t,n)}catch{}return n}function mu({messageApi:t,modal:s,preferredPromptClient:n,activeTab:a,viewMode:o,currentSpecDocKey:i,selectedItem:l}){const c="[assistant-runtime-ui]",d="http://localhost:32123",w=/mac/i.test(navigator.platform)?"sudo npm install -g @axhub/genie":"npm install -g @axhub/genie",j=320,$=320,v=640,D={webBaseUrl:d,apiBaseUrl:`${d}/api`,projectPath:"",source:"default",health:{status:"runtime_unreachable",message:"助手运行时不可用,请先启动 Axhub Genie。",checkedAt:new Date().toISOString(),commandSource:"default",hints:{installGlobal:w,start:"axhub-genie",status:"axhub-genie status"}}},u=r.useMemo(()=>Fr(n),[n]),[C,K]=r.useState(!1),[y,P]=r.useState(!1),[R,L]=r.useState(()=>{const ue=localStorage.getItem(go),ne=ue?Number(ue):Number.NaN;return Number.isFinite(ne)&&ne>=$?Math.min(ne,v):j}),[F,x]=r.useState(null),[V,re]=r.useState(null),B=r.useRef(null),xe=r.useRef(""),ie=r.useRef(!1),z=r.useRef(""),se=r.useRef(Eo("__axhub_make_host_client_id__","make-host")),W=r.useRef(Eo("__axhub_make_editor_client_id__","make-editor")),{runtime:S,setRuntime:Y,checking:k,setChecking:N,refreshRuntime:U}=Xd({defaultRuntime:D}),A=r.useMemo(()=>{const ue=((S==null?void 0:S.webBaseUrl)||d).replace(/\/+$/g,""),ne=new URL(`${ue}/`),me=(S==null?void 0:S.projectPath)||"";return me&&ne.searchParams.set("cwd",me),u&&ne.searchParams.set("provider",u),In(ne.toString(),window.location.origin)},[S,u]),q=F||A,{iframeRef:pe,iframeLoaded:Ne,setIframeLoaded:Ce,syncContext:Ie,syncContextWithRetry:ve,syncPrompt:Ue,waitForReady:Fe}=Vd(q);r.useEffect(()=>{localStorage.setItem(go,String(Math.round(R)))},[R]);const Oe=r.useCallback((ue,ne)=>{try{const me=new URL(In(ue,window.location.origin));return me.searchParams.set("context",JSON.stringify(ne)),me.toString()}catch(me){return console.warn("Failed to serialize assistant context into URL:",me),In(ue,window.location.origin)}},[]),We=r.useCallback(()=>{var ue;(ue=B.current)==null||ue.stop(),B.current=null,xe.current=""},[]),E=r.useCallback(ue=>{ie.current=!0;const ne=String((ue==null?void 0:ue.apiBaseUrl)||(S==null?void 0:S.apiBaseUrl)||D.apiBaseUrl).trim();if(!ne||B.current&&xe.current===ne)return;We();const me=lu({apiBaseUrl:ne,integrationChannel:Xo,targetClientId:Zl,externalClientId:se.current,probeOnStart:!0});me.start(),B.current=me,xe.current=ne},[S==null?void 0:S.apiBaseUrl,We,D.apiBaseUrl]);r.useEffect(()=>{ie.current&&E(S)},[S,E]),r.useEffect(()=>()=>{We()},[We]);const ce=r.useMemo(()=>{const ue=l?Pn(l,a):null,ne=i==="prd"?"prd":"spec",je=ue?o==="spec"?`${ue}/${ne==="prd"?"prd.md":"spec.md"}`:`${ue}/index.tsx`:null,De=(l==null?void 0:l.displayName)||"",ge={version:"1",systemContext:"",currentFile:bs(je,{displayName:De}),selectedElements:[],extensions:{source:"axhub-runtime",projectPath:(S==null?void 0:S.projectPath)||"",provider:u,viewMode:o,activeTab:a,currentSpecDocKey:ne,selectedItem:l?{name:l.name,displayName:l.displayName,demoUrl:l.demoUrl,specUrl:l.specUrl}:null,paths:{itemSourcePath:ue,currentFilePath:je,currentFileDirectory:ue},updatedAt:new Date().toISOString()}};return V?nr(ge,V)??ge:ge},[a,V,S==null?void 0:S.projectPath,i,u,l,o]),Pe=r.useCallback((ue,ne)=>{const me=(ne==null?void 0:ne.viewMode)??"demo",je=(ne==null?void 0:ne.activeTab)??a,De=(ne==null?void 0:ne.specDocKey)==="prd"?"prd":"spec",ge=Pn(ue,je),Ze=me==="spec"?`${ge}/${De==="prd"?"prd.md":"spec.md"}`:`${ge}/index.tsx`,dt={version:"1",systemContext:"",currentFile:bs(Ze,{displayName:ue.displayName||ue.name}),selectedElements:[],extensions:{source:"axhub-runtime",projectPath:(S==null?void 0:S.projectPath)||"",provider:u,viewMode:me,activeTab:je,currentSpecDocKey:De,selectedItem:{name:ue.name,displayName:ue.displayName,demoUrl:ue.demoUrl,specUrl:ue.specUrl},paths:{itemSourcePath:ge,currentFilePath:Ze,currentFileDirectory:ge},updatedAt:new Date().toISOString()}},St=ne==null?void 0:ne.externalContext;return St?nr(dt,St)??dt:dt},[a,S==null?void 0:S.projectPath,u]);r.useEffect(()=>{var je;const ue=vr(ce),ne=z.current;if(z.current=ue,!Gd(ne,ue)||(re(De=>{if(!De)return De;const ge=bs(ce.currentFile);return Nr(De.currentFile)===ge.path&&De.selectedElements.length===0?De:{...De,currentFile:ge,selectedElements:[]}}),!ie.current))return;const me=Kd(ce);(je=B.current)==null||je.updateContext(me,"replace").catch(()=>{})},[ce]),r.useEffect(()=>{!C||!Ne||Ie(ce,"replace")},[ce,Ne,C,Ie]);const Ee=r.useCallback((ue,ne)=>{const me=ue||A;let je=me;try{const De=new URL(In(me,window.location.origin)),ge=(S==null?void 0:S.projectPath)||"";!De.searchParams.get("cwd")&&ge&&De.searchParams.set("cwd",ge),!De.searchParams.get("provider")&&u&&De.searchParams.set("provider",u),ne&&!De.searchParams.get("targetPath")&&De.searchParams.set("targetPath",ne),De.searchParams.get("context")?je=De.toString():je=Oe(De.toString(),ce)}catch{je=Oe(me,ce)}return In(je,window.location.origin)},[ce,A,S==null?void 0:S.projectPath,Oe,u]),Te=r.useCallback((ue,ne)=>{const me=Ee(ue,ne);P(!0),K(!0),Ce(!1),x(me)},[Ee,Ce]),Ye=r.useCallback((ue,ne)=>{const me=Ee(ue,ne);window.open(me,"_blank","noopener,noreferrer")},[Ee]),nt=r.useCallback((ue,ne,me,je,De="iframe")=>{const ge=ue.health.hints,Ze=String(ge.installGlobal||w).trim()||w;s.confirm({title:"Axhub Genie 未就绪",content:e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"whitespace-pre-line text-sm leading-6 text-muted-foreground",children:ue.health.message}),e.jsx("div",{className:"rounded-2xl border border-border/70 bg-muted/70 px-4 py-3 font-mono text-[13px] leading-6 text-foreground shadow-sm",children:Ze}),e.jsx("div",{className:"text-xs leading-5 text-muted-foreground",children:"先在终端执行这一条命令,完成后再回来打开 Genie。"})]}),okText:"复制命令",cancelText:"稍后再说",onOk:async()=>{try{await navigator.clipboard.writeText(Ze),t.success("npx 命令已复制")}catch{t.warning("复制命令失败,请手动复制")}}}),ne==="event"&&t.warning("Genie 未就绪,已回退为安装引导。")},[t,s,w]),Me=r.useCallback(async ue=>{if(ue.health.status!=="runtime_unreachable")return ue;let ne=ue;const me=5,je=700;for(let De=0;DesetTimeout(ge,je));try{const ge=await U();if(ne=ge,Y(ge),ge.health.status==="ready"||ge.health.status==="missing_cli"||ge.health.status==="needs_update"||ge.health.status==="cli_error")return ge}catch(ge){console.warn(`${c} runtime poll failed`,ge);break}}return ne},[U]),b=r.useCallback(async(ue,ne,me,je="iframe")=>{if(k)return!1;N(!0);const De=t.loading("正在启动并检测 Axhub Genie...",0);console.info(`${c} begin runtime check`,{trigger:ue,openTarget:je,targetUrl:ne||null,targetPath:me||null});try{const ge=await Pt.getAssistantRuntime();Y(ge),console.info(`${c} runtime response`,{status:ge.health.status,message:ge.health.message,source:ge.source,commandSource:ge.health.commandSource,webBaseUrl:ge.webBaseUrl,apiBaseUrl:ge.apiBaseUrl});const Ze=await Me(ge);if(Ze.health.status==="ready")return E(Ze),je==="window"?Ye(ne,me):Te(ne,me),!0;console.warn(`${c} runtime not ready`,{status:Ze.health.status,message:Ze.health.message,hints:Ze.health.hints}),nt(Ze,ue,ne,me,je)}catch(ge){const Ze=S||D;Y(Ze),console.error(`${c} runtime check failed`,ge),t.error((ge==null?void 0:ge.message)||"检测 Axhub Genie 状态失败"),nt(Ze,ue,ne,me,je)}finally{De(),N(!1)}return!1},[k,S,E,t,Ye,Te,N,nt,Me,D]),he=r.useCallback(async ue=>{var wt,Je;const ne=Wd(ue,{fallbackCurrentFile:ce.currentFile});if(!ne){t.warning("收到无效的 Genie 请求");return}const me=((wt=ne.targetPath)==null?void 0:wt.trim())||void 0,je=ne.context,De=String(ne.prompt||"").trim(),ge=ne.mode==="selection_context",Ze=(()=>{if(!je)return V;const tt=Mr(V??ce,{fallbackCurrentFile:ce.currentFile})??{version:"1",systemContext:"",currentFile:bs(ce.currentFile),selectedElements:[],extensions:{}},st=Yd(tt.selectedElements,je.selectedElements);return nr(tt,{version:"1",systemContext:je.systemContext||tt.systemContext,currentFile:bs(je.currentFile,bs(tt.currentFile)),selectedElements:eu(st),extensions:{...tt.extensions||{},...je.extensions||{}}})})();Ze&&re(Ze);let dt=C&&Ne&&!!((Je=pe.current)!=null&&Je.contentWindow),St=!1;if(!dt){const tt=ge?je:Ze,st=tt?Oe(A,tt):void 0;if(!await b("event",st,me))return;if(St=!!tt,dt=await Fe(8e3),!dt){t.warning("助手面板尚未加载完成,请稍后再试。");return}}if(Ze){const tt=ge?"append":"replace",st=ge?je:Ze;st&&!(ge&&St)&&ve(st,tt)}if(ge)return;if(!De){t.warning("缺少发送内容");return}Ue(De,!0)||t.error("发送失败:无法写入助手输入框")},[ce,V,Ne,pe,A,C,Oe,b,t,ve,Ue,Fe]),ke=r.useCallback(()=>{if(C){K(!1),P(!1),Ce(!1),x(null),ie.current=!1,We();return}if(y){K(!0);return}b("button")},[y,C,b,Ce,We]);r.useEffect(()=>{const ue=ne=>{const me=ne,je=me.detail,De=je==null?void 0:je.url;!De||typeof De!="string"||(b("event",De,je==null?void 0:je.targetPath),me.preventDefault())};return window.addEventListener(Ca,ue),()=>{window.removeEventListener(Ca,ue)}},[b]);const T=r.useCallback((ue,ne)=>{try{const me=new CustomEvent(Ca,{detail:{url:ue,...ne?{targetPath:ne}:{}},cancelable:!0});return!window.dispatchEvent(me)}catch{return!1}},[]),Z=r.useCallback(()=>{var ue;re(ne=>ne&&{...ne,selectedElements:[]}),C&&Ne&&((ue=pe.current)!=null&&ue.contentWindow)&&ve({version:ce.version,systemContext:ce.systemContext,currentFile:ce.currentFile,selectedElements:[],extensions:ce.extensions},"replace")},[ce,Ne,pe,C,ve]),de=r.useCallback(()=>{try{const ue=new URL(A);ue.searchParams.set("context",JSON.stringify({version:"1"})),b("button",ue.toString(),void 0,"window")}catch{b("button",A,void 0,"window")}},[A,b]),J=r.useCallback(ue=>{const ne=Pe(ue,{viewMode:"demo",activeTab:"prototypes",specDocKey:"spec"}),me=Nr(ne.currentFile),je=Oe(A,ne);try{const De=new URL(je);De.searchParams.set("targetPath",me),b("button",De.toString(),void 0,"window")}catch{b("button",je,me,"window")}},[A,Pe,Oe,b]),Ae=r.useCallback(async()=>{const ue=((S==null?void 0:S.projectPath)||"").trim();if(!ue){t.warning("当前未获取到项目目录");return}try{await navigator.clipboard.writeText(ue),t.success("项目目录已复制")}catch(ne){console.error("Failed to copy project path: ",ne),t.error("复制失败")}},[S==null?void 0:S.projectPath,t]),ze=r.useCallback(()=>{Ce(!0)},[Ce]);return{assistantVisible:C,assistantPanelMounted:y,assistantPanelWidth:R,setAssistantPanelWidth:L,assistantPanelMinWidth:$,assistantPanelMaxWidth:v,assistantIframeRef:pe,assistantIframeSrc:q,handleAssistantIframeLoad:ze,assistantContextV1:ce,assistantProjectPath:(S==null?void 0:S.projectPath)||"",assistantApiBaseUrl:((S==null?void 0:S.apiBaseUrl)||D.apiBaseUrl).trim(),assistantWebEditorClientId:W.current,handleToggleAssistant:ke,handleWebEditorGenieRequest:he,clearAssistantSelectedElementsOnExit:Z,tryOpenByAssistantIframe:T,handleOpenAssistantInNewWindowNoContext:de,handleOpenAssistantWithItemContext:J,handleCopyProjectDirectory:Ae}}async function an(t,s){if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error((n==null?void 0:n.error)||s)}return t.json()}const kt={async getProjectTitle(){const t=await fetch("/api/prototype-admin/project-title");return((await an(t,"加载项目标题失败")).title||"").trim()||"未命名项目"},async updateProjectTitle(t){const s=await fetch("/api/prototype-admin/project-title",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:t})});return an(s,"保存项目标题失败")},async getSidebarTree(t){const s=await fetch(`/api/prototype-admin/sidebar-tree?tab=${encodeURIComponent(t)}`);return an(s,"加载侧边栏树失败")},async saveSidebarTree(t,s){const n=await fetch(`/api/prototype-admin/sidebar-tree?tab=${encodeURIComponent(t)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({tree:s})});return an(n,"保存侧边栏树失败")},async createSidebarFolder(t){const s=await fetch(`/api/prototype-admin/sidebar-tree/folder?tab=${encodeURIComponent(t)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});return an(s,"新建文件夹失败")},async getResourceOrder(t){const s=await fetch(`/api/prototype-admin/resource-order?type=${encodeURIComponent(t)}`);return an(s,"加载资源排序失败")},async saveResourceOrder(t,s){const n=await fetch(`/api/prototype-admin/resource-order?type=${encodeURIComponent(t)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({order:s})});return an(n,"保存资源排序失败")}},hu="subpage-group:";function Cr(t,s){return{id:`item:${t}:${s.name}`,kind:"item",title:s.displayName||s.name,itemKey:`${t}/${s.name}`}}function pu(t){return`folder:${t}:${Math.random().toString(36).slice(2,8)}`}function To(t,s){return s.map(n=>Cr(t,n))}function Vs(t,s,n){const a=new Map(n.map(d=>[`${t}/${d.name}`,d])),o=new Set,i=d=>{const w=[];return d.forEach(j=>{var D;if(j.kind==="folder"){const u=i(Array.isArray(j.children)?j.children:[]);if((D=j.id)!=null&&D.startsWith(hu)){w.push(...u);return}w.push({...j,id:j.id||pu(t),title:j.title||"未命名文件夹",kind:"folder",children:u});return}const $=j.itemKey||"";if(!$||!a.has($))return;const v=a.get($);o.add($),w.push(Cr(t,v))}),w},l=i(s);return[...n.filter(d=>!o.has(`${t}/${d.name}`)).map(d=>Cr(t,d)),...l]}const Hs="src/docs",On="src/docs/templates";function ol(t){return String(t||"").trim().replace(/\\/g,"/").replace(/^\/+/,"").replace(/\/+/g,"/")}function il(t){let s=ol(t);return!s||s==="api/docs"?"":s.startsWith("api/docs/templates/")?s.slice(19):s.startsWith("api/docs/")?s.slice(9):s==="docs"?"":s.startsWith("docs/templates/")?s.slice(15):s.startsWith("docs/")?s.slice(5):s===On?"":s.startsWith(`${On}/`)?s.slice(`${On}/`.length):s===Hs?"":s.startsWith(`${Hs}/`)?s.slice(`${Hs}/`.length):s}function zr(t,s){const n=il(s);return n?t==="template"&&n.startsWith("templates/")?n.slice(10):n:""}function Is(t,s){const n=ol(s);if(!n)return t==="template"?On:Hs;if(n===Hs||n===On||n.startsWith(`${Hs}/`))return n;if(n==="docs"||n.startsWith("docs/"))return n?`src/${n}`:Hs;if(n==="api/docs"||n.startsWith("api/docs/"))return Is(t,il(n));const a=zr(t,n),o=t==="template"?On:Hs;return a?`${o}/${a}`:o}const fu={width:500,height:300},Io="/api/axure-bridge",ll="需先安装并打开 3743 及以上版本的 Axure",Po={desktop:{width:1920,height:1080},mobile:{width:390,height:846},tablet:{width:768,height:1098}};function xu(t){if(typeof window<"u"&&"requestIdleCallback"in window){const n=window.requestIdleCallback(()=>{t()});return()=>window.cancelIdleCallback(n)}const s=globalThis.setTimeout(t,0);return()=>globalThis.clearTimeout(s)}function Do(t){return t==="1"||t==="true"}function gu(t){const s=`${$n}:`;for(let n=0;n"u"?"unknown-origin":window.location.origin;return`${$n}:origin:${o}`}function Ao(t){const s=localStorage.getItem(t);if(s!==null)return Do(s);const n=localStorage.getItem($n);return n!==null&&!gu(localStorage)?(localStorage.setItem(t,n),localStorage.removeItem($n),Do(n)):!1}function yu(t,s){localStorage.setItem(t,"1")}function bu(t){return t==="document"?"docs":t==="canvas"?"canvas":t==="assets"?"components":"prototypes"}function xa(){return{enabled:!1,dirty:!1,saving:!1,quickEditMode:"annotation"}}function qs(t){return String(t||"").trim().replace(/\.[^./\\]+$/u,"")}function wu(t){const s=String(t||"").trim().replace(/\\/g,"/"),n=s.split("/");return n[n.length-1]||s}function Ro(t){return qs(wu(t))==="project-overview"}function ir(t){return qs(t)==="spec-template"}function cl(t){const s=zr("doc",String((t==null?void 0:t.name)||"").trim()),n=qs(s);return{name:s,displayName:n||s,jsUrl:"",demoUrl:"",specUrl:"",filePath:Is("doc",s)}}function $o(t){return Array.isArray(t)?t.map(s=>cl(s)).filter(s=>!!s.name):[]}function ln(t){const s=zr("template",String((t==null?void 0:t.name)||"").trim()),n=qs(s);return{name:s,displayName:n||s,jsUrl:"",demoUrl:"",specUrl:"",filePath:Is("template",s)}}function ju(t){return{name:t.name,displayName:t.displayName,jsUrl:"",demoUrl:"",specUrl:""}}function Nu(t){return t.map(s=>ju(s))}function vu(t,s,n,a){let o=!1;const i=l=>l.map(c=>c.kind==="folder"?{...c,children:Array.isArray(c.children)?i(c.children):c.children}:c.itemKey!==s?c:(o=!0,{...c,itemKey:n,title:a||c.title}));return{nextTree:i(t),replaced:o}}function ga(t,s,n){const a=[],o=new Set;return t.forEach(i=>{const l=i===s?n:i;!l||o.has(l)||(o.add(l),a.push(l))}),a}function Ls(t,s,n){if(!Array.isArray(t)||t.length<=1)return t;const a=new Map;return s.forEach((o,i)=>{a.set(o,i)}),[...t].sort((o,i)=>{const l=a.get(n(o)),c=a.get(n(i));return l!==void 0&&c!==void 0?l-c:l!==void 0?-1:c!==void 0?1:n(o).localeCompare(n(i))})}function Su(t,s){return t==="components"?fu:Po[s]??Po.desktop}function ds(t){return typeof t=="string"?t.trim():""}function Oo(t){var i,l;const s=[],n=ds(t==null?void 0:t.message),a=ds((i=t==null?void 0:t.cause)==null?void 0:i.message),o=ds(t==null?void 0:t.code)||ds((l=t==null?void 0:t.cause)==null?void 0:l.code);return n&&s.push(n),a&&a!==n&&s.push(`cause=${a}`),o&&s.push(`code=${o}`),s.join(";")||"未知错误"}async function _o(t){let s="";try{s=(await t.text()).trim()}catch{s=""}if(!s)return{body:null,text:""};try{return{body:JSON.parse(s),text:s}}catch{return{body:null,text:s}}}function ya(t,s,n){const a=ds(s==null?void 0:s.error)||ds(s==null?void 0:s.message)||ds(n)||t,o=[],i=ds(s==null?void 0:s.details),l=ds(s==null?void 0:s.causeMessage),c=ds(s==null?void 0:s.code),d=ds(s==null?void 0:s.route),w=ds(s==null?void 0:s.bridgeUrl),j=typeof(s==null?void 0:s.payloadBytes)=="number"?s.payloadBytes:null;return i&&i!==a&&o.push(i),l&&l!==i&&l!==a&&o.push(`cause=${l}`),c&&o.push(`code=${c}`),d&&o.push(`route=${d}`),w&&o.push(`bridge=${w}`),j!==null&&o.push(`payload=${j}B`),o.length===0?a:`${a}(${o.join(";")})`}function Cu(t){const s=ds(t);return s?s.includes("ECONNREFUSED")||s.includes("localhost:32767")||s.includes("/api/axure-bridge/available")||s.includes("/available")||s.includes("Axure Bridge")?ll:s.includes("导出超时")?"复制到 Axure 超时,请重试":s.startsWith("复制到 Axure 失败:")?"复制到 Axure 失败,请查看控制台":s:"复制到 Axure 失败,请查看控制台"}function ku({messageApi:t}){const[s,n]=r.useState(!0),[a,o]=r.useState({components:[],prototypes:[]}),[i,l]=r.useState([]),[c,d]=r.useState([]),[w,j]=r.useState([]),[$,v]=r.useState([]),[D,u]=r.useState([]),[C,K]=r.useState({themes:[],data:[],templates:[]}),[y,P]=r.useState({components:[],prototypes:[],docs:[],canvas:[]}),[R,L]=r.useState(!1),[F,x]=r.useState("未命名项目"),[V,re]=r.useState(""),B=r.useRef(new Set),xe=r.useRef(!1),ie=r.useCallback(async()=>{try{const N=await fetch("/api/entries.json");if(!N.ok)throw new Error("Failed to fetch data");const U=await N.json();o(U)}catch(N){t.error(`加载数据失败: ${N.message}`)}finally{n(!1)}},[t]),z=r.useCallback(async()=>{try{const[N,U,A,q,pe,Ne,Ce,Ie]=await Promise.all([fetch("/api/docs"),fetch("/api/canvas"),fetch("/api/themes"),fetch("/api/data/tables"),fetch("/api/docs/templates"),kt.getResourceOrder("themes").catch(()=>null),kt.getResourceOrder("data").catch(()=>null),kt.getResourceOrder("templates").catch(()=>null)]),ve=Array.isArray(Ne==null?void 0:Ne.order)?Ne.order:[],Ue=Array.isArray(Ce==null?void 0:Ce.order)?Ce.order:[],Fe=Array.isArray(Ie==null?void 0:Ie.order)?Ie.order:[];if(K({themes:ve,data:Ue,templates:Fe}),N.ok){const Oe=await N.json();l($o(Oe))}if(U.ok){const Oe=await U.json();d(Array.isArray(Oe)?Oe:[])}if(A.ok){const Oe=await A.json(),We=Array.isArray(Oe)?Oe:[];j(Ls(We,ve,E=>E.name))}if(q.ok){const Oe=await q.json(),We=Array.isArray(Oe)?Oe:[];v(Ls(We,Ue,E=>E.fileName))}if(pe.ok){const Oe=await pe.json(),We=Array.isArray(Oe)?Oe.map(E=>({name:String((E==null?void 0:E.name)||"").trim(),displayName:qs(String((E==null?void 0:E.name)||"").trim()),description:String((E==null?void 0:E.description)||"").trim()||void 0})).filter(E=>!!E.name):[];u(Ls(We,Fe,E=>E.name))}else u([])}catch(N){console.warn("Failed to load docs/themes/data/templates assets:",N),u([])}finally{L(!0)}},[]),se=r.useCallback(async()=>{const N=await fetch("/api/docs");if(!N.ok)throw new Error("Failed to fetch docs");const U=await N.json(),A=$o(U);return l(A),A},[]),W=r.useCallback(async()=>{const N=await fetch("/api/canvas");if(!N.ok)throw new Error("Failed to fetch canvas items");const U=await N.json(),A=Array.isArray(U)?U:[];return d(A),A},[]),S=r.useCallback(N=>N==="docs"?i:N==="components"?a.components:N==="canvas"?Nu(c):a.prototypes,[c,a.components,a.prototypes,i]),Y=r.useCallback(async(N,U)=>{if(!(U!=null&&U.force)&&B.current.has(N)||(N==="prototypes"||N==="components")&&s||(N==="docs"||N==="canvas")&&!R)return;const A=S(N);P(q=>({...q,[N]:q[N].length>0?q[N]:To(N,A)}));try{const q=await kt.getSidebarTree(N),pe=Vs(N,Array.isArray(q.tree)?q.tree:[],A);B.current.add(N),P(Ne=>({...Ne,[N]:pe}))}catch{B.current.add(N),P(q=>({...q,[N]:To(N,A)}))}},[S,s,R]);r.useEffect(()=>{ie()},[ie]),r.useEffect(()=>{let N=!1;return kt.getProjectTitle().then(U=>{N||x(U)}).catch(()=>{N||x("未命名项目")}),()=>{N=!0}},[]),r.useEffect(()=>{document.title=`${F||"未命名项目"} - Axhub Make`},[F]),r.useEffect(()=>{if(!xe.current)return xe.current=!0,xu(()=>{z()})},[z]),r.useEffect(()=>{P(N=>{let U=!1;const A={...N},q=["prototypes","components","docs","canvas"];for(const pe of q){if(!B.current.has(pe))continue;const Ne=Vs(pe,N[pe]||[],S(pe));Ne!==N[pe]&&(A[pe]=Ne,U=!0)}return U?A:N})},[S]);const k=r.useCallback(N=>{const U=bu(N);Y(U)},[Y]);return{loading:s,setLoading:n,data:a,setData:o,docsItems:i,setDocsItems:l,canvasItems:c,setCanvasItems:d,themes:w,setThemes:j,dataTables:$,setDataTables:v,templateAssets:D,setTemplateAssets:u,resourceOrders:C,setResourceOrders:K,sidebarTrees:y,setSidebarTrees:P,sidebarAssetsLoaded:R,setSidebarAssetsLoaded:L,projectTitle:F,setProjectTitle:x,searchText:V,setSearchText:re,loadedSidebarTreeTabsRef:B,sidebarAssetsRequestedRef:xe,loadData:ie,reloadSidebarAssets:z,reloadDocsItems:se,reloadCanvasItems:W,getSidebarTabItems:S,loadSidebarTree:Y,ensureSidebarTreeLoaded:k}}const Mn=[{value:"cursor",label:"Cursor"},{value:"trae",label:"TRAE"},{value:"vscode",label:"Visual Studio Code"},{value:"trae_cn",label:"TRAE CN"},{value:"windsurf",label:"Windsurf"},{value:"kiro",label:"Kiro"},{value:"qoder",label:"Qoder"},{value:"antigravity",label:"Antigravity"}],Eu=Mn.map(t=>t.value),Br={cursor:"Cursor",trae:"TRAE",vscode:"Visual Studio Code",trae_cn:"TRAE CN",windsurf:"Windsurf",kiro:"Kiro",qoder:"Qoder",antigravity:"Antigravity"},Tu=["vscode","cursor"],Iu=[/system cannot find the file/i,/cannot find the file specified/i,/系统找不到指定的文件/,/no such file or directory/i,/is not recognized as an internal or external command/i,/command not found/i,/enoent/i];function Pu(t,s,n){const a=typeof(t==null?void 0:t.message)=="string"?t.message.trim():"",o=s?Br[s]:"编辑器",i=`未检测到 ${o},请先安装后再试`,l=`打开${o}失败,请稍后重试`,c=a&&Iu.some(d=>d.test(a))?i:l;return n?`${c},已继续后续操作`:c}async function Aa({preferredIDE:t,targetPath:s}){if(!t)return!1;try{return await Pt.openIDE({ide:t,targetPath:s&&s.trim()?s.trim():void 0}),!0}catch(n){return console.error("Failed to auto open IDE:",n),H.warning(Pu(n,t,!!s)),!1}}function Du({messageApi:t,preferredIDE:s,selectedItem:n,activeTab:a,viewMode:o,currentSpecDocKey:i,currentMarkdownResource:l,selectedTheme:c,selectedDataTable:d}){const w=r.useCallback(async({filePath:y,copyText:P,fallbackPath:R,fallbackPaths:L,emptySelectionMessage:F})=>{const x=(y||"").trim();if(!x){t.warning(F);return}const V=[...Tu],re=t.loading("正在发送到 IDE...",0);try{P&&await navigator.clipboard.writeText(P);const B=await Aa({preferredIDE:s,targetPath:x}),xe=B?10:1;let ie=!1;for(let S=0;SsetTimeout(k,500))}if(!ie){t.info("编辑器正在启动中,已复制文件标题,可稍后在编辑器中打开");return}const z=B?3:1;let se=!1;const W=Array.from(new Set([x,...L||[],R||""].map(S=>S.trim()).filter(Boolean)));for(let S=0;SsetTimeout(Y,300))}if(!se){t.warning("编辑器未连接,已复制了文件标题,可前往使用");return}t.success("已在编辑器中打开,并复制了文件标题,可前往编辑")}catch(B){t.error((B==null?void 0:B.message)||"发送失败")}finally{re()}},[t,s]),j=r.useCallback(async()=>{let y="",P="";if(n){const R=n;if(o==="spec"){const L=i==="prd"?"prd.md":"spec.md";y=`src/${a}/${n.name}/${L}`,P=`[${n.displayName} - ${L==="prd.md"?"PRD":"SPEC"}](${Pn(n,a)}/${L})`}else{if(R.filePath){const L=R.filePath.indexOf("src/");L>=0?y=R.filePath.substring(L):y=R.filePath}else y=`src/${a}/${n.name}/index.tsx`;P=`[${n.displayName}](${Pn(n,a)})`}}else{await w({emptySelectionMessage:"请先选择条目"});return}await w({filePath:y,copyText:P,emptySelectionMessage:"请先选择条目"})},[a,i,w,n,o]),$=r.useCallback(async(y,P)=>{const R=P??l.kind,L=y??l.item,F=R==="template"?"模板":"文档";if(!L){t.warning(`请先选择${F}`);return}const x=Is(R==="template"?"template":"doc",L.filePath||L.name),V=`[${L.displayName||L.name}](${x})`;await w({filePath:x,copyText:V,emptySelectionMessage:`请先选择${F}`})},[l.item,l.kind,t,w]),v=r.useCallback(async y=>{const P=y??c;if(!P){t.warning("请先选择主题");return}const R=`src/themes/${P.name}`,L=P.hasIndexTsx===!1?`${R}/designToken.json`:`${R}/index.tsx`,F=[`${R}/designToken.json`,`${R}/globals.css`,`${R}/README.md`,`${R}/DESIGN-SPEC.md`,R],x=`[${P.displayName}](src/themes/${P.name})`;await w({filePath:L,fallbackPaths:F,copyText:x,emptySelectionMessage:"请先选择主题"})},[t,w,c]),D=r.useCallback(async y=>{const P=y??c;if(!P){t.warning("请先选择主题");return}if(!P.hasDoc){t.warning("当前主题暂无规范文档");return}const R=`src/themes/${P.name}/README.md`,L=`src/themes/${P.name}/DESIGN-SPEC.md`,F=`[${P.displayName} 规范文档](${R})`;await w({filePath:R,fallbackPath:L,copyText:F,emptySelectionMessage:"请先选择主题"})},[t,w,c]),u=r.useCallback(async y=>{const P=y??d;if(!P){t.warning("请先选择数据表");return}const R=(P.fileName||"").trim(),L=/\.json$/i.test(R),F=L?R.replace(/\.json$/i,""):R,x=L?`src/database/${R}`:`src/database/${R}.json`,V=[`src/database/${F}.json`,`src/database/${F}`],re=`[${P.tableName}](${x})`;await w({filePath:x,fallbackPaths:V,copyText:re,emptySelectionMessage:"请先选择数据表"})},[t,w,d]),C=r.useCallback(async y=>Aa({preferredIDE:y||s}),[s]),K=r.useCallback(async y=>{let P="";if(o==="spec"){const R=i==="prd"?"prd.md":"spec.md";P=`[${y.displayName} - ${R==="prd.md"?"PRD":"SPEC"}](${Pn(y,a)}/${R})`}else P=`[${y.displayName}](${Pn(y,a)})`;if(!P){t.warning("无法获取路径");return}try{await navigator.clipboard.writeText(P),t.success("路径已复制")}catch(R){console.error("Failed to copy: ",R),t.error("复制失败")}},[a,i,t,o]);return{openFileInIDE:w,handleOpenIdeFile:j,handleOpenSelectedDocInIDE:$,handleOpenSelectedThemeInIDE:v,handleOpenSelectedThemeDocInIDE:D,handleOpenSelectedDataTableInIDE:u,handleOpenProjectInIDE:C,handleCopyItemPath:K}}const Au={"genie:claude":"ClaudeCode","genie:cursor":"Cursor CLI","genie:codex":"Codex","genie:gemini":"Gemini CLI","genie:opencode":"OpenCode","local:cursor":"Cursor","local:qoder":"Qoder"},Ru=["genie:claude","genie:codex","genie:gemini","genie:opencode"];function lr(t){return`ide:${t}`}function $u(t){return t==="local:cursor"?"cursor":"qoder"}function Ou(t){return typeof t=="string"&&t.startsWith("genie:")}function _u(t){return t==="local:cursor"||t==="local:qoder"}function Lu(t,s){const n={key:"copy",label:"复制 Prompt"},a=Ru.map(c=>({key:c,label:`用 ${Au[c]} 执行`})),o=Mn.map(c=>({key:lr(c.value),label:`在 ${Br[c.value]} 中执行`})),i=[{key:"automation",label:"自动化执行",actions:a},{key:"ide",label:"本地编辑器",actions:o}],l=(()=>{if(Ou(t)){const c=a.find(d=>d.key===t);if(c)return c}if(s)return o.find(c=>c.key===lr(s))??n;if(_u(t)){const c=$u(t);return o.find(d=>d.key===lr(c))??n}return n})();return{mainAction:l,copyAction:n,actionGroups:i,includeCopyInMenu:l.key!=="copy"}}const us=ec,ms=tc,Mu=be.forwardRef(({className:t,inset:s,children:n,...a},o)=>e.jsxs(si,{ref:o,className:fe("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",s&&"pl-8",t),...a,children:[n,e.jsx(ni,{className:"ml-auto h-4 w-4"})]}));Mu.displayName=si.displayName;const Uu=be.forwardRef(({className:t,...s},n)=>e.jsx(ai,{ref:n,className:fe("z-[2000] min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg",t),...s}));Uu.displayName=ai.displayName;const ts=be.forwardRef(({className:t,sideOffset:s=4,...n},a)=>e.jsx(Yl,{children:e.jsx(ri,{ref:a,sideOffset:s,className:fe("z-[2000] min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",t),...n})}));ts.displayName=ri.displayName;const Re=be.forwardRef(({className:t,inset:s,...n},a)=>e.jsx(oi,{ref:a,className:fe("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s&&"pl-8",t),...n}));Re.displayName=oi.displayName;const Fu=be.forwardRef(({className:t,children:s,checked:n,...a},o)=>e.jsxs(ii,{ref:o,className:fe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:n,...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(li,{children:e.jsx(Fn,{className:"h-4 w-4"})})}),s]}));Fu.displayName=ii.displayName;const zu=be.forwardRef(({className:t,children:s,...n},a)=>e.jsxs(ci,{ref:a,className:fe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(li,{children:e.jsx(di,{className:"h-2 w-2 fill-current"})})}),s]}));zu.displayName=ci.displayName;const ra=be.forwardRef(({className:t,inset:s,...n},a)=>e.jsx(ui,{ref:a,className:fe("px-2 py-1.5 text-sm font-semibold",s&&"pl-8",t),...n}));ra.displayName=ui.displayName;const Mt=be.forwardRef(({className:t,...s},n)=>e.jsx(mi,{ref:n,className:fe("-mx-1 my-1 h-px bg-border",t),...s}));Mt.displayName=mi.displayName;const Bu={"genie:claude":Vi,"genie:cursor":na,"genie:codex":yr,"genie:gemini":Ua,"genie:opencode":yr,"local:cursor":na,"local:qoder":Fa},Wu={cursor:na,trae:sa,vscode:_r,trae_cn:sa,windsurf:Or,kiro:$r,qoder:Fa,antigravity:Ua};function hs({preferredClient:t,scene:s,buildPrompt:n,disabled:a,type:o="primary",onAfterCopy:i,copySuccessMessage:l="Prompt 已复制到剪贴板",executeSuccessMessage:c="已打开新会话",fallbackMessage:d="自动执行失败,已回退为复制 Prompt",preferredIDE:w=null,getIdeTargetPath:j,block:$=!1,className:v,copyLabel:D="复制 Prompt",style:u}){const[C,K]=r.useState(!1),y=r.useRef(!1),P=W=>{if(typeof W!="string"||!W.startsWith("ide:"))return!1;const S=W.slice(4);return Eu.includes(S)},R=W=>W.slice(4),{mainAction:L,copyAction:F,actionGroups:x,includeCopyInMenu:V}=r.useMemo(()=>{const W=Lu(t,w);if(D==="复制 Prompt")return W;const S=Y=>Y.key!=="copy"?Y:{...Y,label:D};return{mainAction:S(W.mainAction),copyAction:S(W.copyAction),includeCopyInMenu:W.includeCopyInMenu,actionGroups:W.actionGroups.map(Y=>({...Y,actions:Y.actions.map(S)}))}},[t,w,D]),re=W=>{if(W==="copy")return e.jsx(ss,{className:"h-4 w-4"});if(P(W)){const Y=R(W),k=Wu[Y];return k?e.jsx(k,{size:16,color:"currentColor"}):e.jsx(hi,{className:"h-4 w-4"})}const S=Bu[W];if(S)return e.jsx(S,{size:16,color:"currentColor"})},B=(W,S)=>{try{const Y=new CustomEvent(Ca,{detail:{url:W,...S?{targetPath:S}:{}},cancelable:!0});return!window.dispatchEvent(Y)}catch{return!1}},xe=W=>{try{return window.open(W,"_blank","noopener,noreferrer")||(window.location.href=W),!0}catch{return!1}},ie=async W=>{var S,Y;if(!(C||y.current)){y.current=!0,K(!0);try{const k=await n();if(!k||!String(k).trim()){H.warning("没有可用的 Prompt");return}const N=W==="copy"?l:d;await navigator.clipboard.writeText(k);const U=(j==null?void 0:j())||void 0;if(W==="copy"){H.success(l),i==null||i();return}if(P(W)){const q=R(W),pe=Br[q];H.info(`已复制 Prompt,正尝试打开 ${pe} 编辑器`);const Ne=q==="cursor"?"local:cursor":q==="qoder"?"local:qoder":null;if(Ne){try{const Ie=Sr(Ne,k);xe(Ie)||H.success(N)}catch(Ie){Ie!=null&&Ie.message&&console.error("open deeplink failed:",Ie.message),H.success(N)}i==null||i();return}await Aa({preferredIDE:q,targetPath:U})||H.success(N),i==null||i();return}if(rl(W)){try{const q=Sr(W,k);xe(q)?H.success(c):H.success(N)}catch(q){q!=null&&q.message&&console.error("open deeplink failed:",q.message),H.success(N)}i==null||i();return}if(!al(W)){H.success(N),i==null||i();return}const A=Fr(W);if(!A){H.success(N),i==null||i();return}try{const q=await Pt.executePrompt({scene:s,client:A,prompt:k});B(q.url,U)||window.open(q.url,"_blank"),H.success(c),i==null||i()}catch(q){(S=q==null?void 0:q.message)!=null&&S.includes("Axhub Genie")||(Y=q==null?void 0:q.message)!=null&&Y.includes("@axhub/genie")?H.warning("Genie 未就绪,已回退为复制 Prompt。请先安装/启动 Axhub Genie。"):H.success(N),i==null||i(),q!=null&&q.message&&console.error("execute prompt failed:",q.message)}}catch(k){H.error((k==null?void 0:k.message)||"操作失败")}finally{y.current=!1,K(!1)}}},z=fe("inline-flex items-center",$?"w-full":"w-auto",v),se=o==="primary"?"brand":"outline";return e.jsxs(us,{modal:!1,children:[e.jsxs("div",{className:z,style:u,children:[e.jsxs(te,{variant:se,size:"sm",disabled:a||C,className:fe("rounded-r-none",$?"flex-1 min-w-0":""),onClick:()=>void ie(L.key),children:[C?e.jsx(gt,{className:"h-4 w-4 animate-spin"}):re(L.key),e.jsx("span",{className:"truncate",children:L.label})]}),e.jsx(ms,{asChild:!0,children:e.jsx(te,{variant:se,size:"sm",disabled:a||C,className:"rounded-l-none border-l border-white/20 px-2",children:e.jsx(en,{className:"h-3.5 w-3.5"})})})]}),e.jsxs(ts,{align:"end",side:"top",sideOffset:6,avoidCollisions:!1,className:"w-64",children:[x.map((W,S)=>e.jsxs(be.Fragment,{children:[e.jsx(ra,{children:W.label}),W.actions.map(Y=>e.jsxs(Re,{onClick:()=>void ie(Y.key),className:"gap-2",children:[re(Y.key),Y.label]},Y.key)),S0?e.jsx(Mt,{}):null,V&&e.jsxs(Re,{onClick:()=>void ie(F.key),className:"gap-2",children:[re(F.key),F.label]})]})]})}function Gu(t){const s=new Set,n=[];for(const a of t){const o=String(a||"").trim();if(!o)continue;const i=o.startsWith("/")?o:`/${o}`;s.has(i)||(s.add(i),n.push(i))}return n}function Lo(t){const s=t.targetType,n=Gu(Array.isArray(t.docs)?t.docs:[]);if(s!=="prototypes")throw new Error(`Unsupported targetType: ${String(s)}`);return`**系统指令**:你将作为 UI/UX 设计架构师 × 前端工程师(复合型),协助用户「从 Pencil 导入并创建原型」(无需上传文件)。 ${n.length>0?`**📋 参考文档(必须阅读)**: ${n.map(o=>`- \`${o}\``).join(` `)} `:""} **关键约束(必须遵守)**: 1. 必须先通过 Pencil MCP 获取当前打开的 .pen 与 selection: - 优先调用:\`mcp__pencil__get_editor_state\` - 若不确定工具前缀/命名空间:先使用 MCP 的 \`list_tools\`(或等价能力)列出可用工具,找到 pencil 相关工具后再调用 - 若工具不可用/调用失败:立刻停止,并提示用户 - 打开 Pencil 桌面端并打开目标 .pen 文件 - 选中要导入的 Frame(可多选) - 检查 MCP 配置(参考:\`/skills/mcp-installer/SKILL.md\`) 2. 构建候选 Frame 列表(“已有的 frame”): - 若 selection 中包含 Frame:候选 = selection Frames - 若 selection 为空或不是 Frame:使用 \`mcp__pencil__batch_get\` 在当前文件中搜索/列出 Frame 候选 - 对每个候选 Frame,至少输出:序号 / frameId / frameName / 尺寸(若可得) - 若候选过多导致无法确认:要求用户回到 Pencil 先选中需要的 Frame,再重试读取 - 候选较少时(可选):用 \`mcp__pencil__get_screenshot\` 辅助用户辨认 3. 在用户确认导入范围与输出结构之前,禁止创建/修改任何文件、代码或文档。 **需要用户决定(不要推荐,列出选项并等待用户回答)**: - 导入范围:全部 / 只导入部分(用序号或 frameId 指定)/ 回到 Pencil 重新选择后再读 - 输出结构(二选一): A. 单原型多屏:生成 1 个 \`src/prototypes//\`,在 \`index.tsx\` 内提供轻量导航切换各 Frame 对应 Screen B. 多原型批量:每个 Frame 生成 1 个 \`src/prototypes//\` - 命名规则:\`\` / \`\` 如何从 Frame 名称派生(kebab-case),以及重名冲突处理 **目标输出(对每个生成的原型目录)**: - \`src/prototypes//spec.md\`(必须记录 Pencil 来源信息:.pen 标识/路径若可得、导入的 frameId 列表、frameName 列表、Screen 到实现模块的映射) - \`src/prototypes//index.tsx\` - (可选)\`src/prototypes//style.css\` **验收**: - 单原型:\`node scripts/check-app-ready.mjs /prototypes/\` - 多原型:对每个生成的原型逐个运行 \`check-app-ready\`;如用户明确要求加速,可按用户指示减少验收次数 - READY 之前必须修复到通过 **首次回复模板**: \`\`\` 收到,我将从 Pencil 导入并创建原型(无需上传)。 我会先通过 Pencil MCP 读取: 1) 当前打开的 .pen 文件 2) 当前选中的 Frame(或可用 Frame 列表) 请确认: - Pencil 桌面端已打开目标 .pen 文件 - 已选中要导入的 Frame(可多选;也可以先不选,我会列候选给你选) 现在开始读取... \`\`\``}const Wr=nc,Gr=ac,Wa=be.forwardRef(({className:t,align:s="center",sideOffset:n=6,container:a,...o},i)=>e.jsx(sc,{container:a??void 0,children:e.jsx(pi,{ref:i,align:s,sideOffset:n,className:fe("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out",t),...o})}));Wa.displayName=pi.displayName;const Kr=be.forwardRef(({className:t,...s},n)=>e.jsx(ns,{ref:n,className:fe("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...s}));Kr.displayName=ns.displayName;const Vr=be.forwardRef(({className:t,...s},n)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(Ia,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(ns.Input,{ref:n,className:fe("flex h-10 w-full rounded-md bg-transparent py-3 text-[14px] leading-5 outline-none placeholder:text-[14px] placeholder:leading-5 placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...s})]}));Vr.displayName=ns.Input.displayName;const Hr=be.forwardRef(({className:t,onWheelCapture:s,...n},a)=>e.jsx(ns.List,{ref:a,className:fe("max-h-[300px] overflow-y-auto overflow-x-hidden overscroll-contain",t),onWheelCapture:o=>{o.stopPropagation(),s==null||s(o)},...n}));Hr.displayName=ns.List.displayName;const qr=be.forwardRef((t,s)=>e.jsx(ns.Empty,{ref:s,className:"py-6 text-center text-sm",...t}));qr.displayName=ns.Empty.displayName;const Ra=be.forwardRef(({className:t,...s},n)=>e.jsx(ns.Group,{ref:n,className:fe("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...s}));Ra.displayName=ns.Group.displayName;const Ku=be.forwardRef(({className:t,...s},n)=>e.jsx(ns.Separator,{ref:n,className:fe("-mx-1 h-px bg-border",t),...s}));Ku.displayName=ns.Separator.displayName;const Zr=be.forwardRef(({className:t,...s},n)=>e.jsx(ns.Item,{ref:n,className:fe("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50",t),...s}));Zr.displayName=ns.Item.displayName;function Ms({options:t,value:s,onChange:n,placeholder:a="请选择",searchPlaceholder:o="搜索选项...",className:i,disabled:l,portalContainer:c}){const[d,w]=be.useState(!1),j=be.useMemo(()=>{const D=new Map(t.map(u=>[u.value,u]));return s.map(u=>D.get(u)).filter(u=>!!u)},[t,s]),$=D=>{if(s.includes(D)){n(s.filter(u=>u!==D));return}n([...s,D])},v=D=>{n(s.filter(u=>u!==D))};return e.jsxs(Wr,{open:d,onOpenChange:w,children:[e.jsx(Gr,{asChild:!0,children:e.jsxs(te,{type:"button",variant:"outline",role:"combobox","aria-expanded":d,className:fe("h-auto min-h-9 w-full justify-between px-3 py-1.5 text-left font-normal ring-1 ring-transparent focus-visible:ring-ring",i),disabled:l,children:[e.jsx("div",{className:"flex min-h-5 flex-1 flex-wrap items-center gap-1",children:j.length===0?e.jsx("span",{className:"text-sm text-muted-foreground",children:a}):j.map(D=>e.jsxs("span",{className:"inline-flex items-center gap-1 rounded bg-muted px-2 py-0.5 text-sm text-foreground",children:[D.label,e.jsx("button",{type:"button",className:"inline-flex h-3.5 w-3.5 items-center justify-center rounded text-muted-foreground hover:text-foreground",onClick:u=>{u.preventDefault(),u.stopPropagation(),v(D.value)},"aria-label":`移除 ${D.label}`,children:e.jsx(as,{className:"h-3 w-3"})})]},D.value))}),e.jsx(en,{className:"ml-2 h-4 w-4 shrink-0 opacity-60"})]})}),e.jsx(Wa,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",container:c,children:e.jsxs(Kr,{children:[e.jsx(Vr,{placeholder:o}),e.jsxs(Hr,{children:[e.jsx(qr,{children:"暂无结果"}),e.jsx(Ra,{children:t.map(D=>{const u=s.includes(D.value);return e.jsxs(Zr,{value:D.value,disabled:D.disabled,onSelect:()=>$(D.value),className:"gap-2",children:[e.jsx("span",{className:fe("inline-flex h-4 w-4 items-center justify-center rounded border border-muted-foreground/40",u&&"border-foreground bg-foreground text-background"),children:u?e.jsx(Fn,{className:"h-3 w-3"}):null}),e.jsx("span",{className:"text-sm",children:D.label})]},D.value)})})]})]})})]})}function Jr({options:t,value:s,onChange:n,placeholder:a="请选择",searchPlaceholder:o="搜索选项...",className:i,disabled:l,columns:c=1,portalContainer:d,presentation:w="popover",dialogTitle:j="请选择"}){const[$,v]=be.useState(!1),D=be.useMemo(()=>{const L=new Map(t.map(F=>[F.value,F]));return s.map(F=>L.get(F)).filter(F=>!!F)},[t,s]),u=be.useMemo(()=>{const L={},F=[];return t.forEach(x=>{x.category?(L[x.category]||(L[x.category]=[]),L[x.category].push(x)):F.push(x)}),{groups:L,ungrouped:F}},[t]),C=L=>{if(s.includes(L)){n(s.filter(F=>F!==L));return}n([...s,L])},K=L=>{n(s.filter(F=>F!==L))},y=L=>{const F=s.includes(L.value);return e.jsx(Zr,{value:`${L.value} ${L.label} ${L.secondaryLabel??""}`.trim(),disabled:L.disabled,onSelect:()=>C(L.value),className:fe("h-full min-h-[96px] rounded-md border px-3.5 py-3",F?"border-foreground/40 bg-muted/50 text-foreground":"border-border","data-[selected=true]:bg-muted/70 data-[selected=true]:text-foreground"),children:e.jsxs("div",{className:"flex w-full items-start gap-2",children:[e.jsx("span",{className:fe("mt-0.5 inline-flex h-4 w-4 items-center justify-center rounded border border-muted-foreground/40",F&&"border-foreground bg-foreground text-background"),children:F?e.jsx(Fn,{className:"h-3 w-3"}):null}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"line-clamp-1 text-sm font-medium text-foreground",children:L.label}),L.secondaryLabel?e.jsx("div",{className:"mt-0.5 line-clamp-1 text-[11px] font-normal leading-4 text-muted-foreground/60",children:L.secondaryLabel}):null,L.description?e.jsx("div",{className:"mt-1 line-clamp-2 text-sm leading-5 text-muted-foreground",children:L.description}):null]})]})},L.value)},P=L=>e.jsxs(Kr,{className:"h-full min-h-0 justify-start",children:[e.jsx(Vr,{placeholder:o}),e.jsxs(Hr,{className:L,children:[e.jsx(qr,{children:"暂无结果"}),Object.entries(u.groups).map(([F,x])=>e.jsxs(Ra,{className:"p-2",children:[e.jsx("div",{className:"mb-2.5 px-1.5 text-xs font-semibold text-muted-foreground",children:F}),e.jsx("div",{className:fe("grid gap-3",c===2&&"grid-cols-2"),children:x.map(y)})]},F)),u.ungrouped.length>0&&e.jsx(Ra,{className:"p-2",children:e.jsx("div",{className:fe("grid gap-3",c===2&&"grid-cols-2"),children:u.ungrouped.map(y)})})]})]}),R=e.jsxs(te,{type:"button",variant:"outline",role:"combobox","aria-expanded":$,className:fe("h-auto min-h-9 w-full justify-between px-3 py-1.5 text-left font-normal ring-1 ring-transparent focus-visible:ring-ring",i),disabled:l,onClick:w==="dialog"?()=>v(!0):void 0,children:[e.jsx("div",{className:"flex min-h-5 flex-1 flex-wrap items-center gap-1",children:D.length===0?e.jsx("span",{className:"text-sm text-muted-foreground",children:a}):D.map(L=>e.jsxs("span",{className:"inline-flex items-center gap-1 rounded bg-muted px-2 py-0.5 text-sm text-foreground",children:[L.label,e.jsx("button",{type:"button",className:"inline-flex h-3.5 w-3.5 items-center justify-center rounded text-muted-foreground hover:text-foreground",onClick:F=>{F.preventDefault(),F.stopPropagation(),K(L.value)},"aria-label":`移除 ${L.label}`,children:e.jsx(as,{className:"h-3 w-3"})})]},L.value))}),e.jsx(en,{className:"ml-2 h-4 w-4 shrink-0 opacity-60"})]});return w==="dialog"?e.jsxs(e.Fragment,{children:[R,e.jsx(Js,{open:$,onOpenChange:v,children:e.jsxs(Qs,{className:"!top-6 sm:!top-8 !translate-y-0 !flex !flex-col h-[560px] max-h-[calc(100vh-3rem)] sm:max-h-[calc(100vh-4rem)] max-w-[780px] gap-0 overflow-hidden p-0 [&>button[aria-label='关闭']]:right-4 [&>button[aria-label='关闭']]:top-2.5 [&>button[aria-label='关闭']]:h-7 [&>button[aria-label='关闭']]:w-7",children:[e.jsx(mn,{className:"h-12 flex-row items-center border-b px-4 py-0 text-left !space-y-0",children:e.jsx(Xs,{asChild:!0,children:e.jsx("div",{className:"m-0 flex h-full items-center text-base font-semibold leading-none tracking-tight",children:j})})}),e.jsx("div",{className:"flex min-h-0 flex-1 flex-col px-4 pb-4 pt-2",children:P("max-h-none min-h-0 flex-1")})]})})]}):e.jsxs(Wr,{open:$,onOpenChange:v,children:[e.jsx(Gr,{asChild:!0,children:R}),e.jsx(Wa,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",container:d,children:P()})]})}function dl({title:t,description:s,accept:n,multiple:a=!1,disabled:o=!1,loading:i=!1,allowDrop:l=!0,className:c,browseLabel:d="选择文件",emptyIcon:w,selectedFiles:j=[],onFilesSelected:$,onClear:v,inputProps:D}){const u=r.useRef(null),[C,K]=r.useState(!1),y=r.useMemo(()=>j.slice(0,3),[j]),P=Math.max(j.length-y.length,0),R=()=>{var B;o||(B=u.current)==null||B.click()},L=B=>{const xe=Array.from(B.currentTarget.files??[]);xe.length>0&&$(xe),B.currentTarget.value=""},F=B=>{o||(B.key==="Enter"||B.key===" ")&&(B.preventDefault(),R())},x=B=>{o||!l||(B.preventDefault(),B.dataTransfer.dropEffect="copy",K(!0))},V=B=>{if(o||!l)return;B.preventDefault();const xe=B.relatedTarget;xe instanceof Node&&B.currentTarget.contains(xe)||K(!1)},re=B=>{if(o||!l)return;B.preventDefault(),K(!1);const xe=Array.from(B.dataTransfer.files??[]);xe.length>0&&$(xe)};return e.jsxs("div",{children:[e.jsxs("div",{role:"button",tabIndex:o?-1:0,onClick:R,onKeyDown:F,onDragOver:x,onDragEnter:x,onDragLeave:V,onDrop:re,className:fe("flex min-h-[150px] flex-col items-center justify-center gap-2 rounded-md border border-dashed border-border/70 bg-muted/10 p-6 text-center transition-colors",!o&&"cursor-pointer hover:bg-muted/30",C&&l&&"border-primary bg-primary/5",o&&"cursor-not-allowed opacity-60",c),"aria-disabled":o,children:[i?e.jsx(gt,{className:"h-7 w-7 animate-spin text-primary"}):w??e.jsx(_n,{className:"h-7 w-7 text-primary"}),e.jsx("div",{className:"text-sm font-medium",children:t}),s?e.jsx("div",{className:"max-w-md text-[12px] leading-4 text-muted-foreground",children:s}):null,e.jsx("div",{className:"mt-2 inline-flex items-center rounded-md border border-border/70 bg-background px-3 py-1.5 text-xs font-medium text-foreground shadow-sm",children:d}),l?null:e.jsx("div",{className:"text-[11px] text-muted-foreground",children:"当前模式仅支持点击选择"})]}),e.jsx("input",{ref:u,type:"file",accept:n,multiple:a,className:"hidden",onChange:L,disabled:o,...D}),j.length>0?e.jsx("div",{className:"mt-3 rounded-md border border-border/70 bg-muted/20 p-3",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"mb-2 text-xs font-medium text-foreground",children:["已选择 ",j.length," 个文件"]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[y.map(B=>e.jsxs("div",{className:"inline-flex max-w-full items-center gap-1.5 rounded-full bg-background px-2.5 py-1 text-xs text-muted-foreground shadow-sm",title:B.name,children:[e.jsx(hn,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"max-w-[220px] truncate",children:B.name})]},B.name)),P>0?e.jsxs("div",{className:"inline-flex items-center rounded-full bg-background px-2.5 py-1 text-xs text-muted-foreground shadow-sm",children:["+",P," 个文件"]}):null]})]}),v?e.jsx(te,{variant:"ghost",size:"icon-xs",onClick:B=>{B.stopPropagation(),v()},"aria-label":"清空已选择文件",children:e.jsx(as,{className:"h-3.5 w-3.5"})}):null]})}):null]})}function Vu(t){return t?typeof t=="string"?t.trim():t instanceof Error||typeof t=="object"&&"message"in t?String(t.message||"").trim():String(t).trim():""}function $a(t,s="上传失败,请稍后重试"){var o;const n=Vu(t);if(!n)return s;if(n==="请上传 ZIP 文件"||n==="当前来源不支持文件夹上传")return n;if(n.includes("local_axure 暂不支持文件夹上传"))return"当前来源暂不支持文件夹上传,请使用 ZIP 文件";if(n.includes("上传的文件为空"))return"上传失败,文件内容为空";if(n.includes("临时文件不存在"))return"上传失败,请重新选择文件后重试";if(n.includes("ENAMETOOLONG"))return"解压失败,压缩包内部路径过长,请缩短路径后重试";if(n.includes("MODULE_NOT_FOUND")||n.includes("Cannot find module")||n.includes("executeUserEntryPoint"))return"解压失败,运行环境异常,请重启应用后重试";if(n.includes("extract-zip")||n.includes("Zip not found")||n.includes("local-axure-extract failed"))return"解压失败,请确认 ZIP 文件完整且格式正确后重试";if(n.startsWith("解压失败:"))return"解压失败,请检查 ZIP 文件后重试";if(n.startsWith("预处理脚本执行失败:"))return"预处理失败,请检查导入内容后重试";const a=((o=n.split(/\r?\n/).find(Boolean))==null?void 0:o.trim())||"";return a&&a.length<=60&&!/[A-Za-z]:\\|node:internal|requireStack|at\s+\w+/i.test(a)?a:s}const zn=lc,Hu=rc,ul=be.forwardRef(({className:t,...s},n)=>e.jsx(fi,{className:fe("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s,ref:n}));ul.displayName=fi.displayName;const qu=ic("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),fn=be.forwardRef(({side:t="right",className:s,children:n,...a},o)=>e.jsxs(Hu,{children:[e.jsx(ul,{}),e.jsxs(xi,{ref:o,className:fe(qu({side:t}),s),...a,children:[n,e.jsxs(oc,{"data-sheet-close":"",className:"absolute right-4 top-4 inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",children:[e.jsx(as,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));fn.displayName=xi.displayName;const xn=({className:t,...s})=>e.jsx("div",{className:fe("flex flex-col space-y-2 text-center sm:text-left",t),...s});xn.displayName="SheetHeader";const Bn=({className:t,...s})=>e.jsx("div",{className:fe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s});Bn.displayName="SheetFooter";const gn=be.forwardRef(({className:t,...s},n)=>e.jsx(gi,{ref:n,className:fe("m-0 text-lg font-semibold leading-none tracking-tight text-foreground",t),...s}));gn.displayName=gi.displayName;const Zu=be.forwardRef(({className:t,...s},n)=>e.jsx(yi,{ref:n,className:fe("m-0 text-sm text-muted-foreground",t),...s}));Zu.displayName=yi.displayName;const ca=cc,Wn=be.forwardRef(({className:t,...s},n)=>e.jsx(bi,{ref:n,className:fe("inline-flex h-9 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...s}));Wn.displayName=bi.displayName;const Jt=be.forwardRef(({className:t,...s},n)=>e.jsx(wi,{ref:n,className:fe("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium transition-all focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",t),...s}));Jt.displayName=wi.displayName;const Ju=be.forwardRef(({className:t,...s},n)=>e.jsx(ji,{ref:n,className:fe("mt-2 focus:outline-none focus-visible:ring-1 focus-visible:ring-ring",t),...s}));Ju.displayName=ji.displayName;const Ga=be.forwardRef(({className:t,...s},n)=>e.jsx(Ni,{ref:n,className:fe("inline-flex items-center gap-1",t),...s}));Ga.displayName=Ni.displayName;const Zs=be.forwardRef(({className:t,...s},n)=>e.jsx(vi,{ref:n,className:fe("inline-flex items-center justify-center rounded-md px-2 py-1.5 text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",t),...s}));Zs.displayName=vi.displayName;function Qu({visible:t,onClose:s,activeTab:n,selectedThemes:a,setSelectedThemes:o,availableThemes:i,selectedDocs:l,setSelectedDocs:c,availableDocs:d,selectedDataAssets:w,setSelectedDataAssets:j,availableDataAssets:$,preferredPromptClient:v,preferredIDE:D,buildCreatePrompt:u,onAfterCreatePromptAction:C,onUploadSuccess:K,selectedSkills:y,setSelectedSkills:P}){const[R,L]=r.useState(null),[F,x]=r.useState("create"),[V,re]=r.useState("make"),[B,xe]=r.useState("zip"),[ie,z]=r.useState(!1),[se,W]=r.useState(null),[S,Y]=r.useState([]),k=n==="components"?"新建组件":"新建原型",N=n==="components"?"导入组件":"导入原型",U=r.useMemo(()=>(Lr.skills??[]).reduce((ce,Pe)=>{const Ee=String(Pe.id??"").trim(),Te=String(Pe.titleZh??Pe.titleCn??"").trim(),Ye=String(Pe.titleEn??Pe.title??"").trim(),nt=Te||Ye;if(!Ee||!nt)return ce;const Me=Array.isArray(Pe.activeTabs)?Pe.activeTabs.map(he=>String(he||"").trim()).filter(Boolean):[];if(Me.length>0&&!Me.includes(n))return ce;const b={value:Ee,label:nt,secondaryLabel:Te&&Ye&&Te!==Ye?Ye:void 0,description:String(Pe.description??"").trim()||"适用于界面设计与前端实现相关的通用场景。",category:Pe.category};return ce.push(b),ce},[]),[n]);r.useEffect(()=>{t&&(x("create"),re("make"),xe("zip"),z(!1),W(null),Y([]))},[t]),r.useEffect(()=>{pe(V)&&B!=="zip"&&xe("zip")},[B,V]);const A=E=>["make","axhub"].includes(E),q=(E,ce)=>A(E)?!0:E==="google_stitch"?(ce==null?void 0:ce.requiresAi)!==!0:!1,pe=E=>E==="figma_make",Ne=E=>["axure_prototype","web_page"].includes(E),Ce=E=>E==="pencil",Ie=E=>Ne(E)||Ce(E),ve="/skills",Ue=r.useMemo(()=>{const E=[{key:"make",title:"Axbub Make",description:"支持自己或他人的 ZIP 包",docs:[`${ve}/local-axure-workflow/SKILL.md`],icon:e.jsx(dn,{className:"h-8 w-8 text-sky-500"})},{key:"axhub",title:"Axbub 扩展",description:"可导出任意网页(静态)",docs:[`${ve}/screenshot-page-workflow/SKILL.md`],icon:e.jsx(ta,{className:"h-8 w-8 text-violet-500"})},{key:"google_stitch",title:"Google Stitch",description:"AI 驱动的 UI 设计工具(静态)",docs:[`${ve}/screenshot-page-workflow/SKILL.md`],icon:e.jsx(dc,{className:"h-8 w-8 text-rose-500"})},{key:"figma_make",title:"Figma Make",description:"上传 Figma 原始导出的 ZIP 工程包",docs:[`${ve}/figma-make-project-converter/SKILL.md`],icon:e.jsx(ta,{className:"h-8 w-8 text-pink-500"})},{key:"v0",title:"V0 App",description:"在线应用生成平台",docs:[`${ve}/v0-project-converter/SKILL.md`],icon:e.jsx(_n,{className:"h-8 w-8 text-emerald-500"})},{key:"google_aistudio",title:"Google AIStudio",description:"在线应用生成平台",docs:[`${ve}/ai-studio-project-converter/SKILL.md`],icon:e.jsx(pn,{className:"h-8 w-8 text-amber-500"})},{key:"axure_prototype",title:"Axure 原型链接",description:"支持在线或本地预览的链接",docs:[`${ve}/axure-prototype-workflow/SKILL.md`,`${ve}/axure-prototype-workflow/prototype-restoration.md`],icon:e.jsx(un,{className:"h-8 w-8 text-sky-500"})},{key:"web_page",title:"网页链接",description:"支持任意网页链接",docs:[`${ve}/web-page-workflow/SKILL.md`,`${ve}/web-page-workflow/prototype-restoration.md`],icon:e.jsx(pn,{className:"h-8 w-8 text-cyan-500"})}];return n==="prototypes"&&E.push({key:"pencil",title:"Pencil 导入",description:"读取当前打开的 Pencil 文件",docs:[`${ve}/pencil-import-workflow/SKILL.md`,`${ve}/pencil-sync-after-prototype-workflow/SKILL.md`,`${ve}/mcp-installer/SKILL.md`],icon:e.jsx(Si,{className:"h-8 w-8 text-slate-500"})}),E},[n]),Fe=async E=>{var Pe;if(E.length===0)return;if(pe(V)&&B!=="zip"){H.error("当前来源仅支持 ZIP 上传");return}const ce=new FormData;if(ce.append("uploadType",V),ce.append("targetType",n),ce.append("uploadMode",B),B==="zip"){const Ee=E[0];if(!Ee.name.endsWith(".zip")){H.error("请上传 ZIP 文件");return}ce.append("file",Ee,Ee.name)}else{if(E.length===0){H.error(B==="folder"?"请选择文件夹":"请选择文件");return}if(B==="folder"){const Te=(((Pe=E[0])==null?void 0:Pe.webkitRelativePath)||"").split("/").filter(Boolean)[0];Te&&ce.append("folderName",Te)}E.forEach(Ee=>{ce.append("files",Ee,Ee.name);const Te=B==="folder"&&Ee.webkitRelativePath||Ee.name;ce.append("relativePaths",Te)})}Y(E),z(!0);try{const Ee=await fetch("/api/upload",{method:"POST",body:ce}),Te=await Ee.json();Ee.ok&&Te.success?(W(Te),q(V,Te)?(H.success(Te.message||"上传成功"),setTimeout(()=>{s(),K==null||K()},800)):H.success(Te.message||"页面已准备好,可继续交给 AI 完善")):(console.error("[CreateDialog] 上传失败:",{status:Ee.status,statusText:Ee.statusText,result:Te}),H.error($a(Te==null?void 0:Te.error,"上传失败,请稍后重试")))}catch(Ee){console.error("[CreateDialog] 上传异常详情:",Ee),H.error($a(Ee,"上传失败,请稍后重试"))}finally{z(!1)}},Oe=r.useCallback(()=>{const E=Ue.find(Ee=>Ee.key===V),ce=(E==null?void 0:E.docs)||[];if(Ce(V))return Lo({targetType:"prototypes",docs:ce});if(Ne(V)){const Ee=n==="components"?"组件":"原型",Te=V==="axure_prototype"?"Axure 原型链接":"网页链接";return`**系统指令**:你将作为UI/UX 设计架构师 × 前端工程师(复合型),协助用户「基于${Te}导入并创建一个${Ee}」。 **📋 参考技能文档(必须阅读)**: ${ce.map(Ye=>`- \`${Ye}\``).join(` `)} **首次回复模板**: \`\`\` 收到,我将基于 ${Te} 导入并创建一个${Ee}。 请把链接发我(URL): \`\`\``}if(!(se!=null&&se.prompt))throw new Error("没有可复制的 Prompt");let Pe=se.prompt;return ce.length>0&&(Pe+=` 📋 参考技能文档: ${ce.map(Ee=>`- \`${Ee}\``).join(` `)}`),Pe},[n,Lo,Ne,Ce,Ue,se,V]),We=B==="folder"?{directory:"",webkitdirectory:""}:{};return e.jsx(zn,{open:t,onOpenChange:E=>!E&&s(),children:e.jsx(fn,{ref:L,side:"left",className:"flex w-full max-w-[620px] flex-col p-0 text-sm sm:max-w-[620px] [&>[data-sheet-close]]:hidden",children:e.jsxs(ca,{value:F,onValueChange:E=>{(E==="create"||E==="upload")&&x(E)},className:"flex h-full flex-col",children:[e.jsxs(xn,{className:"border-b px-5 py-3.5",children:[e.jsx(gn,{className:"sr-only",children:`${k} / ${N}`}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(Wn,{className:"grid h-8 w-full max-w-[280px] grid-cols-2 rounded-lg border border-border/70 bg-muted/50 p-0.5",children:[e.jsx(Jt,{value:"create",className:"h-full rounded-md px-2.5 py-0 text-[13px] leading-none data-[state=active]:shadow-none",children:k}),e.jsx(Jt,{value:"upload",className:"h-full rounded-md px-2.5 py-0 text-[13px] leading-none data-[state=active]:shadow-none",children:N})]}),e.jsx(te,{variant:"ghost",size:"icon-sm",className:"h-7 w-7 rounded-md",onClick:s,"aria-label":"关闭",children:e.jsx(as,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"flex-1 space-y-4 overflow-y-auto px-5 py-4.5",children:F==="create"?e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"rounded-md border border-border/60 bg-muted/30 px-3.5 py-2.5 text-[13px] leading-relaxed text-muted-foreground",children:"💡 你也可以直接与 AI 对话生成原型,以下选项可帮助生成更精准的提示词。"}),e.jsxs(Dt,{children:[e.jsx(At,{hint:"从技能列表中选择,AI 会参考对应应用场景生成方案",tooltipClassName:"max-w-none w-fit whitespace-nowrap",children:"使用技能"}),e.jsx(Jr,{value:y,onChange:P,placeholder:"请选择技能(可多选)",searchPlaceholder:"搜索技能...",options:U,columns:2,portalContainer:R,presentation:"dialog",dialogTitle:"选择技能(可多选)"})]}),e.jsxs(Dt,{children:[e.jsx(At,{hint:"AI 会根据所选主题生成原型,主题可在资产管理原型中进行管理",children:"主题"}),e.jsx(Ms,{value:a,onChange:o,placeholder:"自动",searchPlaceholder:"搜索主题...",options:i.map(E=>({value:E.name,label:E.displayName})),portalContainer:R})]}),e.jsxs(Dt,{children:[e.jsx(At,{hint:"AI 会根据所选文档生成原型,文档可在资产管理原型中进行管理",children:"文档"}),e.jsx(Ms,{value:l,onChange:c,placeholder:"自动",searchPlaceholder:"搜索文档...",options:d.map(E=>({value:E.name,label:E.displayName})),portalContainer:R})]}),e.jsxs(Dt,{children:[e.jsx(At,{hint:"AI 会根据所选数据生成原型,数据可在数据管理原型中进行管理",children:"数据"}),e.jsx(Ms,{value:w,onChange:j,placeholder:"自动",searchPlaceholder:"搜索数据...",options:$.map(E=>({value:E.name,label:E.displayName})),portalContainer:R})]})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"grid grid-cols-2 gap-4",children:Ue.map(E=>{const ce=E.key===V;return e.jsxs("button",{type:"button",onClick:()=>{re(E.key),xe((pe(E.key),"zip")),W(null),Y([])},className:`flex items-center gap-2.5 rounded-md border p-3 text-left transition ${ce?"border-foreground/60 bg-muted/40":"border-border hover:bg-muted/30"}`,children:[e.jsx("div",{className:"flex-shrink-0 text-muted-foreground/80 [&_svg]:h-6 [&_svg]:w-6",children:E.icon}),e.jsxs("div",{className:"grid gap-1",children:[e.jsx("div",{className:"text-sm font-medium leading-none",children:E.title}),e.jsx("div",{className:"text-[12px] leading-4 text-muted-foreground line-clamp-2",children:E.description})]})]},E.key)})}),Ie(V)?e.jsx("div",{className:"rounded-md border border-dashed p-3 text-sm text-muted-foreground",children:Ce(V)?"当前来源无需上传文件。请确保 Pencil 桌面端已打开目标 .pen 文件,点击底部按钮完成后续导入。":"当前来源无需上传文件。点击底部按钮开始对话,并将链接发送给 AI 即可。"}):e.jsxs("div",{className:"space-y-3 pt-2",children:[pe(V)?e.jsx("div",{className:"rounded-md border border-dashed p-3 text-sm text-muted-foreground",children:"Figma Make 导入仅支持原始导出的 ZIP 工程包。请直接上传 Figma 导出的 ZIP,不要先手动解压、删改文件或重组目录。"}):e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-sm font-medium",children:"上传方式"}),e.jsxs(Ga,{type:"single",value:B,onValueChange:E=>{(E==="zip"||E==="folder")&&(xe(E),W(null),Y([]))},children:[e.jsx(Zs,{value:"zip",children:"ZIP"}),e.jsx(Zs,{value:"folder",children:"文件夹"})]})]}),e.jsx(dl,{title:pe(V)?"点击上传或拖拽 Figma 原始 ZIP 到此区域":B==="zip"?"点击上传或拖拽 ZIP 文件到此区域":"点击上传文件夹",description:pe(V)?"请上传 Figma Make 原始导出的 ZIP 工程包,系统会按官方项目结构直接处理。":B==="zip"?"建议优先使用 ZIP 上传,导入更稳定。":"请选择本地文件夹,系统会按原目录结构上传。",accept:pe(V)||B==="zip"?".zip":void 0,multiple:!pe(V)&&B==="folder",disabled:ie,loading:ie,allowDrop:pe(V)||B!=="folder",browseLabel:pe(V)||B==="zip"?"选择 ZIP 文件":"选择文件夹",selectedFiles:S,onFilesSelected:Fe,onClear:()=>{Y([]),W(null)},inputProps:pe(V)?void 0:We}),se!=null&&se.requiresAi?e.jsxs("div",{className:"rounded-md border border-emerald-200 bg-emerald-50/70 p-3 text-sm text-emerald-900",children:[e.jsx("div",{className:"font-medium",children:"页面已可预览"}),e.jsx("div",{className:"mt-1 leading-6 text-emerald-800",children:se.message||"当前可先查看页面结构与样式效果,部分细节还可继续完善。"}),se.hint?e.jsx("div",{className:"mt-1 text-[12px] leading-5 text-emerald-700",children:se.hint}):null]}):null]})]})}),e.jsxs(Bn,{className:"flex flex-row justify-end gap-2 border-t px-5 py-3.5",children:[e.jsx(te,{variant:"outline",size:"sm",onClick:s,children:"取消"}),F==="create"?e.jsx(hs,{type:"primary",preferredClient:v,preferredIDE:D,scene:`create-${n}`,buildPrompt:()=>u(),onAfterCopy:C,copySuccessMessage:"复制成功,请返回 IDE 发送给 AI",executeSuccessMessage:"已打开新会话",fallbackMessage:"自动执行失败,已回退为复制 Prompt"}):Ie(V)||!q(V,se)?e.jsx(hs,{type:"primary",preferredClient:v,preferredIDE:D,scene:`upload-${V}-${n}`,buildPrompt:Oe,copySuccessMessage:"提示词已复制到剪贴板,请粘贴给 AI 继续完善",executeSuccessMessage:"已打开新会话",fallbackMessage:"自动执行失败,已回退为复制 Prompt",disabled:!Ie(V)&&!se}):null]})]})})})}function Xu({state:t,actions:s}){return e.jsx(Qu,{visible:t.visible,onClose:s.onClose,activeTab:t.activeTab,selectedDocs:t.selectedDocs,setSelectedDocs:s.setSelectedDocs,availableDocs:t.availableDocs,selectedThemes:t.selectedThemes,setSelectedThemes:s.setSelectedThemes,availableThemes:t.availableThemes,selectedDataAssets:t.selectedDataAssets,setSelectedDataAssets:s.setSelectedDataAssets,availableDataAssets:t.availableDataAssets,preferredPromptClient:t.preferredPromptClient,preferredIDE:t.preferredIDE,buildCreatePrompt:s.buildCreatePrompt,onAfterCreatePromptAction:s.onAfterCreatePromptAction,onUploadSuccess:s.onUploadSuccess,selectedSkills:t.selectedSkills??[],setSelectedSkills:s.setSelectedSkills??(()=>{})})}const cr=[".md",".txt",".pdf",".docx",".pptx",".xlsx",".csv",".json",".html",".xml"];function dr(t){return t.slice(Math.max(0,t.lastIndexOf("."))).toLowerCase()}function Yu({visible:t,onClose:s,selectedSkillIds:n,setSelectedSkillIds:a,availableDocSkills:o,selectedDocs:i,setSelectedDocs:l,availableDocs:c,selectedDataAssets:d,setSelectedDataAssets:w,availableDataAssets:j,selectedTemplates:$,setSelectedTemplates:v,availableTemplates:D,selectedReferencePrototypes:u,setSelectedReferencePrototypes:C,availableReferencePrototypes:K,preferredPromptClient:y,preferredIDE:P,buildCreateDocPrompt:R,onAfterCreatePromptAction:L,onManualCreateSuccess:F,onImportSuccess:x}){const[V,re]=r.useState(null),[B,xe]=r.useState("ai"),[ie,z]=r.useState(""),[se,W]=r.useState(""),[S,Y]=r.useState(!1),[k,N]=r.useState({checking:!1,installed:!1,commandSource:"unavailable",version:"",installHints:[],error:""}),[U,A]=r.useState([]),[q,pe]=r.useState(!1),[Ne,Ce]=r.useState([]),[Ie,ve]=r.useState(""),Ue=r.useCallback(async()=>{N(b=>({...b,checking:!0,error:""}));try{const b=await fetch("/api/docs/import/markitdown-status"),he=await b.json().catch(()=>null);if(!b.ok)throw new Error((he==null?void 0:he.error)||"检测 markitdown 失败");N({checking:!1,installed:!!(he!=null&&he.installed),commandSource:String((he==null?void 0:he.commandSource)||"unavailable"),version:String((he==null?void 0:he.version)||""),installHints:Array.isArray(he==null?void 0:he.installHints)?he.installHints:[],error:String((he==null?void 0:he.error)||"")})}catch(b){N(he=>({...he,checking:!1,installed:!1,commandSource:"unavailable",version:"",error:(b==null?void 0:b.message)||"检测失败",installHints:he.installHints.length>0?he.installHints:["brew install python@3.11","python3.11 -m pip install -U 'markitdown[pdf,docx,pptx,xlsx]'"]}))}},[]);r.useEffect(()=>{t&&(xe("ai"),z(""),W(""),Y(!1),A([]),Ce([]),ve(""),pe(!1),Ue())},[Ue,t]);const Fe=r.useMemo(()=>o.map(b=>({value:b.id,label:b.titleZh||b.title,secondaryLabel:b.titleZh&&b.title&&b.titleZh!==b.title?b.title:void 0,description:String(b.description||"").trim()||"适用于文档内容生成与结构化整理场景。",category:b.category})),[o]),Oe=r.useMemo(()=>U.some(b=>dr(b.name)!==".md"),[U]),We=r.useMemo(()=>Ne.filter(b=>!b.success),[Ne]),E=r.useMemo(()=>!!(k.error||Ie||We.length>0),[We.length,Ie,k.error]),ce=U.length>0&&(k.installed||!Oe),Pe=r.useCallback(()=>{const b=(k.installHints.length>0?k.installHints:["python3 -m pip install -U 'markitdown[pdf,docx,pptx,xlsx]'"]).map(Z=>`- \`${Z}\``).join(` `),he=U.length>0?U.map(Z=>{const de=dr(Z.name)||"unknown",J=Math.max(1,Math.round(Z.size/1024));return`- ${Z.name} (${de}, ${J} KB)`}).join(` `):"- 当前未选择文件",ke=We.length>0?We.map(Z=>`- ${Z.originalName} [${Z.extension||"unknown"}]:${Z.error||"未知错误"}`).join(` `):"- 暂无单文件失败明细",T=[k.commandSource||"unavailable",k.version].filter(Boolean).join(" · ")||"unavailable";return["请帮我排查 Axhub Runtime 中的文档导入 / markitdown 环境问题,并给出可直接复制执行的修复方案。","","请按下面要求回答:","- 先根据错误信息判断最可能的根因。","- 输出 macOS + zsh 环境下可直接执行的检查命令和修复命令。","- 优先给最小修复路径;如果有多种可能,请按“先检查 → 再修复”组织。","- 最后补充“修复后如何验证”的步骤。","","## 当前信息",`- markitdown 状态:${k.installed?"可用":"当前不可用"}`,`- 命令来源 / 版本:${T}`,`- 状态检测报错:${k.error||"无"}`,`- 最近一次导入报错:${Ie||"无"}`,"- 建议安装命令:",b,"- 当前待导入文件:",he,"- 最近一次失败明细:",ke,"","## 请按这个结构回复","1. 根因判断","2. 检查命令","3. 修复命令","4. 修复后验证步骤","5. 如果仍失败,还需要补充采集哪些信息"].join(` `)},[We,U,Ie,k.commandSource,k.error,k.installHints,k.installed,k.version]),Ee=r.useCallback(async()=>{const b=ie.trim();if(!b){W("请输入文档名称");return}W(""),Y(!0);try{const he=await fetch("/api/docs/manual-create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({displayName:b})}),ke=await he.json().catch(()=>({}));if(!he.ok||!(ke!=null&&ke.success))throw new Error((ke==null?void 0:ke.error)||"创建失败");H.success(`文档「${ke.displayName||b}」创建成功`),await(F==null?void 0:F()),L()}catch(he){const ke=(he==null?void 0:he.message)||"创建失败";W(ke),H.error(ke)}finally{Y(!1)}},[ie,L,F]),Te=r.useCallback(b=>{if(!b||b.length===0)return;const he=new Set(U.map(de=>`${de.name}:${de.size}:${de.lastModified}`)),ke=[];let T=0,Z=0;Array.from(b).forEach(de=>{const J=dr(de.name);if(!cr.includes(J)){T+=1;return}if(!k.installed&&J!==".md"){Z+=1;return}const Ae=`${de.name}:${de.size}:${de.lastModified}`;he.has(Ae)||(he.add(Ae),ke.push(de))}),T>0&&H.warning(`已忽略 ${T} 个不支持的文件格式`),Z>0&&H.warning(`markitdown 当前不可用,已忽略 ${Z} 个非 .md 文件`),ke.length>0&&A(de=>[...de,...ke])},[U,k.installed]),Ye=r.useCallback(async()=>{if(!ce){H.warning("请选择可导入的文件");return}const b=new FormData;U.forEach(he=>{b.append("files",he,he.name)}),pe(!0),Ce([]),ve("");try{const he=await fetch("/api/docs/import",{method:"POST",body:b}),ke=await he.json().catch(()=>({})),T=Array.isArray(ke==null?void 0:ke.results)?ke.results:[];Ce(T);const Z=Number((ke==null?void 0:ke.successCount)||0),de=Number((ke==null?void 0:ke.failedCount)||0),J=T.find(ze=>!ze.success&&ze.error),Ae=String((ke==null?void 0:ke.error)||(ke==null?void 0:ke.markitdownError)||(J==null?void 0:J.error)||"").trim();if(!he.ok&&Z===0)throw new Error(Ae||"导入失败");if(Z>0&&await(x==null?void 0:x()),de===0){ve(""),H.success(`导入成功,共 ${Z} 个文档`),L();return}ve(Ae||`已导入 ${Z} 个文档,${de} 个失败`),H.warning(`已导入 ${Z} 个文档,${de} 个失败`)}catch(he){const ke=(he==null?void 0:he.message)||"导入失败";ve(ke),H.error(ke)}finally{pe(!1)}},[ce,U,L,x]),nt=r.useCallback(async b=>{try{await navigator.clipboard.writeText(b),H.success("安装命令已复制")}catch{H.error("复制安装命令失败")}},[]),Me=S||q;return e.jsx(zn,{open:t,onOpenChange:b=>!b&&s(),children:e.jsx(fn,{ref:re,side:"left",className:"flex w-full max-w-[620px] flex-col p-0 text-sm sm:max-w-[620px] [&>[data-sheet-close]]:hidden",children:e.jsxs(ca,{value:B,onValueChange:b=>{(b==="ai"||b==="manual"||b==="import")&&(xe(b),W(""))},className:"flex h-full flex-col",children:[e.jsxs(xn,{className:"border-b px-5 py-3.5",children:[e.jsx(gn,{className:"sr-only",children:"新建文档 / 导入文档"}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs(Wn,{className:"grid h-8 w-full max-w-[340px] grid-cols-3 rounded-lg border border-border/70 bg-muted/50 p-0.5",children:[e.jsx(Jt,{value:"ai",className:"h-full rounded-md px-2.5 py-0 text-[13px] leading-none data-[state=active]:shadow-none",children:"AI 新建"}),e.jsx(Jt,{value:"manual",className:"h-full rounded-md px-2.5 py-0 text-[13px] leading-none data-[state=active]:shadow-none",children:"手动新建"}),e.jsx(Jt,{value:"import",className:"h-full rounded-md px-2.5 py-0 text-[13px] leading-none data-[state=active]:shadow-none",children:"导入文档"})]}),e.jsx(te,{variant:"ghost",size:"icon-sm",className:"h-7 w-7 rounded-md",onClick:s,"aria-label":"关闭",disabled:Me,children:e.jsx(as,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex-1 space-y-4 overflow-y-auto px-5 py-4.5",children:[B==="manual"?e.jsxs(Dt,{children:[e.jsx(At,{hint:"输入文档名称后会在 src/docs 下直接创建 .md 文件",children:"文档名称"}),e.jsx(Ps,{value:ie,onChange:b=>{z(b.target.value),se&&W("")},placeholder:"例如:订单流程说明",autoFocus:!0,disabled:S,onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),Ee())},"aria-invalid":!!se}),se?e.jsx(Ea,{className:"text-destructive",children:se}):e.jsx(Ea,{children:"将创建一个空白 Markdown 文档,后续可继续编辑内容。"})]}):null,B==="ai"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"rounded-md border border-border/60 bg-muted/30 px-3.5 py-2.5 text-[13px] leading-relaxed text-muted-foreground",children:"💡 你也可以直接与 AI 对话生成文档,以下选项可帮助生成更精准的提示词。"}),e.jsxs(Dt,{children:[e.jsx(At,{hint:"从文档技能列表中选择,AI 会参考对应技能生成文档方案",tooltipClassName:"max-w-none w-fit whitespace-nowrap",children:"使用技能"}),e.jsx(Jr,{value:n,onChange:a,placeholder:"请选择技能(可多选)",searchPlaceholder:"搜索技能...",options:Fe,columns:2,portalContainer:V,presentation:"dialog",dialogTitle:"选择技能(可多选)"})]}),e.jsxs(Dt,{children:[e.jsx(At,{hint:"AI 会参考所选文档补充上下文信息",children:"文档"}),e.jsx(Ms,{value:i,onChange:l,placeholder:"自动",searchPlaceholder:"搜索文档...",options:c.map(b=>({value:b.name,label:b.displayName})),portalContainer:V})]}),e.jsxs(Dt,{children:[e.jsx(At,{hint:"选择参考原型后,AI 会读取原型源码与 spec 作为文档编写参考",children:"参考原型"}),e.jsx(Ms,{value:u,onChange:C,placeholder:"自动",searchPlaceholder:"搜索参考原型...",options:K.map(b=>({value:b.name,label:b.displayName})),portalContainer:V})]}),e.jsxs(Dt,{children:[e.jsx(At,{hint:"AI 会参考所选数据辅助文档编写",children:"数据"}),e.jsx(Ms,{value:d,onChange:w,placeholder:"自动",searchPlaceholder:"搜索数据...",options:j.map(b=>({value:b.name,label:b.displayName})),portalContainer:V})]}),e.jsxs(Dt,{children:[e.jsx(At,{hint:"AI 会参考所选模板组织文档结构与格式",children:"模板"}),e.jsx(Ms,{value:$,onChange:v,placeholder:"自动",searchPlaceholder:"搜索模板...",options:D.map(b=>({value:b.name,label:b.displayName})),portalContainer:V})]})]}):null,B==="import"?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:`rounded-md border px-3 py-2.5 ${k.installed?"border-emerald-300/70 bg-emerald-50/30":"border-amber-300/70 bg-amber-50/30"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[k.installed?e.jsx(ti,{className:"h-4 w-4 text-emerald-600"}):e.jsx(La,{className:"h-4 w-4 text-amber-600"}),e.jsx("span",{children:k.installed?"markitdown 已可用":"markitdown 当前不可用"})]}),e.jsx(te,{type:"button",variant:"outline",size:"sm",className:"h-7",onClick:()=>void Ue(),disabled:k.checking||q,children:k.checking?e.jsxs(e.Fragment,{children:[e.jsx(gt,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"检测中"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ln,{className:"mr-1.5 h-3.5 w-3.5"}),"重新检测"]})})]}),e.jsxs("div",{className:"mt-1 text-[12px] text-muted-foreground",children:["命令来源:",k.commandSource||"unavailable",k.version?` · ${k.version}`:""]}),k.error?e.jsx("div",{className:"mt-1 text-[12px] text-destructive",children:k.error}):null]}),k.installed?null:e.jsxs("div",{className:"rounded-md border border-dashed p-3",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"修复引导(修复后支持非 .md 文档导入)"}),e.jsx("div",{className:"space-y-2",children:(k.installHints.length>0?k.installHints:["python3 -m pip install -U 'markitdown[pdf,docx,pptx,xlsx]'"]).map(b=>e.jsxs("div",{className:"flex items-center gap-2 rounded-md border bg-muted/30 px-2 py-1.5",children:[e.jsx("code",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-[12px]",children:b}),e.jsx(te,{type:"button",variant:"ghost",size:"icon-sm",className:"h-6 w-6",onClick:()=>void nt(b),children:e.jsx(ss,{className:"h-3.5 w-3.5"})})]},b))}),e.jsx("div",{className:"mt-2 text-[12px] text-muted-foreground",children:"当前仅允许导入 .md 文件,其它格式需先修复 markitdown 环境后使用。"})]}),E?e.jsxs("div",{className:"rounded-md border border-dashed p-3",children:[e.jsx("div",{className:"mb-1 text-sm font-medium",children:"让 AI 帮你修复"}),e.jsx("div",{className:"mb-3 text-[12px] text-muted-foreground",children:"会自动带上当前检测状态、报错信息、安装命令和失败文件明细,方便你的 AI 直接给出修复步骤。"}),e.jsx(hs,{type:"default",block:!0,preferredClient:y,preferredIDE:P,scene:"repair-doc-import",buildPrompt:Pe,copyLabel:"复制诊断 Prompt",copySuccessMessage:"诊断 Prompt 已复制,请发送给 AI 排查",executeSuccessMessage:"已打开新会话",fallbackMessage:"自动执行失败,已回退为复制诊断 Prompt"})]}):null,e.jsxs("label",{className:"flex min-h-[150px] cursor-pointer flex-col items-center justify-center gap-2 rounded-md border border-dashed p-6 text-center hover:bg-muted/40",onDragOver:b=>{b.preventDefault()},onDrop:b=>{b.preventDefault(),Te(b.dataTransfer.files)},children:[e.jsx(_n,{className:"h-7 w-7 text-primary"}),e.jsx("div",{className:"text-sm font-medium",children:"点击选择或拖拽文档文件"}),e.jsxs("div",{className:"text-[12px] leading-4 text-muted-foreground",children:["支持 ",cr.join(", "),",并统一导入为 .md"]}),e.jsx("input",{type:"file",multiple:!0,className:"hidden",accept:cr.join(","),onChange:b=>{Te(b.target.files),b.currentTarget.value=""},disabled:q})]}),U.length>0?e.jsxs("div",{className:"rounded-md border p-2.5",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsxs("div",{className:"text-sm font-medium",children:["待导入文件(",U.length,")"]}),e.jsx(te,{type:"button",variant:"ghost",size:"sm",className:"h-7",onClick:()=>A([]),disabled:q,children:"清空"})]}),e.jsx("div",{className:"max-h-[160px] space-y-1.5 overflow-y-auto pr-1",children:U.map((b,he)=>e.jsxs("div",{className:"flex items-center gap-2 rounded border px-2 py-1.5",children:[e.jsx(hn,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("span",{className:"flex-1 truncate text-[12px]",children:b.name}),e.jsx(te,{type:"button",variant:"ghost",size:"icon-sm",className:"h-6 w-6",onClick:()=>{A(ke=>ke.filter((T,Z)=>Z!==he))},disabled:q,children:e.jsx(_s,{className:"h-3.5 w-3.5"})})]},`${b.name}-${b.size}-${b.lastModified}-${he}`))})]}):null,Ne.length>0?e.jsxs("div",{className:"rounded-md border p-2.5",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"导入结果"}),e.jsx("div",{className:"max-h-[140px] space-y-1.5 overflow-y-auto pr-1",children:Ne.map((b,he)=>e.jsxs("div",{className:"rounded border px-2 py-1.5 text-[12px]",children:[e.jsxs("div",{className:"font-medium",children:[b.success?"成功":"失败"," · ",b.originalName]}),b.savedName?e.jsxs("div",{className:"text-muted-foreground",children:["输出:",b.savedName]}):null,b.error?e.jsx("div",{className:"text-destructive",children:b.error}):null]},`${b.originalName}-${he}`))})]}):null]}):null]}),e.jsxs(Bn,{className:"flex flex-row justify-end gap-2 border-t px-5 py-3.5",children:[e.jsx(te,{variant:"outline",size:"sm",onClick:s,disabled:Me,children:"取消"}),B==="manual"?e.jsx(te,{variant:"brand",size:"sm",onClick:()=>void Ee(),disabled:S,children:S?e.jsxs(e.Fragment,{children:[e.jsx(gt,{className:"mr-2 h-4 w-4 animate-spin"}),"创建中..."]}):"创建"}):null,B==="ai"?e.jsx(hs,{type:"primary",preferredClient:y,preferredIDE:P,scene:"create-doc",buildPrompt:()=>R(),onAfterCopy:L,copySuccessMessage:"复制成功,请返回 IDE 发送给 AI",executeSuccessMessage:"已打开新会话",fallbackMessage:"自动执行失败,已回退为复制 Prompt"}):null,B==="import"?e.jsx(te,{variant:"brand",size:"sm",onClick:()=>void Ye(),disabled:q||!ce,children:q?e.jsxs(e.Fragment,{children:[e.jsx(gt,{className:"mr-2 h-4 w-4 animate-spin"}),"导入中..."]}):"导入文档"}):null]})]})})})}function em({state:t,actions:s}){return e.jsx(Yu,{visible:t.visible,onClose:s.onClose,selectedSkillIds:t.selectedSkillIds,setSelectedSkillIds:s.setSelectedSkillIds,availableDocSkills:t.availableDocSkills,selectedDocs:t.selectedDocs,setSelectedDocs:s.setSelectedDocs,availableDocs:t.availableDocs,selectedDataAssets:t.selectedDataAssets,setSelectedDataAssets:s.setSelectedDataAssets,availableDataAssets:t.availableDataAssets,selectedTemplates:t.selectedTemplates,setSelectedTemplates:s.setSelectedTemplates,availableTemplates:t.availableTemplates,selectedReferencePrototypes:t.selectedReferencePrototypes,setSelectedReferencePrototypes:s.setSelectedReferencePrototypes,availableReferencePrototypes:t.availableReferencePrototypes,preferredPromptClient:t.preferredPromptClient,preferredIDE:t.preferredIDE,buildCreateDocPrompt:s.buildCreateDocPrompt,onAfterCreatePromptAction:s.onAfterCreatePromptAction,onManualCreateSuccess:s.onManualCreateSuccess,onImportSuccess:s.onImportSuccess})}const ml=Zi,tm=["/skills/axure-prototype-workflow/theme-generation.md","/skills/axure-prototype-workflow/doc-generation.md","/skills/axure-prototype-workflow/data-generation.md","/skills/web-page-workflow/theme-generation.md","/skills/web-page-workflow/doc-generation.md","/skills/web-page-workflow/data-generation.md"],sm={make_zip:["/skills/local-axure-workflow/SKILL.md"],local_axure:["/skills/local-axure-workflow/SKILL.md"],axure_prototype:["/skills/axure-prototype-workflow/SKILL.md","/skills/axure-prototype-workflow/asset-extraction.md"],web_page:["/skills/web-page-workflow/SKILL.md","/skills/web-page-workflow/asset-extraction.md"],screenshot:["/skills/screen-to-code/SKILL.md","/skills/screen-to-code/screenshot-collection.md"],v0:["/skills/v0-project-converter/SKILL.md"],google_aistudio:["/skills/ai-studio-project-converter/SKILL.md"],figma_make:["/skills/figma-make-project-converter/SKILL.md"],app_direct:[]};function Qr(t){const s=String(t||"").trim();return s?s.startsWith("/")?s:`/${s}`:""}function nm(t){const s=[],n=new Set;for(const a of t){const o=Qr(a);!o||n.has(o)||(n.add(o),s.push(o))}return s}function am(t){const s=new Set,n=t.matchAll(/`([^`\n]+)`/g);for(const a of n){const o=Qr(a[1]||"");o&&s.add(o)}return s}function ba(t){return t==="axure_prototype"||t==="web_page"}function Jn(t){return t==="app_direct"}function hl(t){return t==="app_direct"?[]:nm([...sm[t]||[],...tm])}function rm(t){const s=t==="axure_prototype"?"Axure 原型链接":"网页链接",n=hl(t);return`**系统指令**:你将作为UI/UX 设计架构师 × 前端工程师(复合型),协助用户「基于${s}导入并创建主题」。 **📋 参考文档(必须阅读)**: ${n.map(a=>`- \`${a}\``).join(` `)} **目标输出**: - \`src/themes//\`(主题 token、\`DESIGN.md\`、\`index.tsx\`) - \`src/docs/\`(按需生成项目文档) - \`src/database/\`(按需生成数据模型) **首次回复模板**: \`\`\` 收到,我将基于${s}导入并创建主题。 请把链接发我(URL): \`\`\``}function om(t,s){const n=String(t||"").trim();if(!n)return"";const a=hl(s);if(a.length===0)return n;const o=am(n),i=a.filter(l=>!o.has(Qr(l)));return i.length===0?n:`${n} 📋 主题导入参考文档: ${i.map(l=>`- \`${l}\``).join(` `)}`}function Mo(t){const{title:s,selected:n,available:a,toLine:o}=t;return n.length===0?"":` ${s}${n.map(i=>{const l=a.find(c=>c.name===i);return` ${o(i,l)}`}).join("")}`}function im(t){const s=new Set(t.map(c=>String(c||"").trim()).filter(Boolean));if(s.size===0)return"";const n=new Set,a=[],o=new Set,i=[];for(const c of ml.skills??[]){if(!s.has(c.id))continue;let d=!1;for(const w of c.localPaths??[]){const j=aa(String(w||"").trim());!j||n.has(j)||(n.add(j),a.push(j),d=!0)}if(!d)for(const w of c.references??[]){const j=String(w||"").trim();!j||o.has(j)||(o.add(j),i.push(j))}}return a.length===0&&i.length===0?"":` **使用项目技能**: ${(a.length>0?a:i).map(c=>`- \`${c}\``).join(` `)}`}function Uo(){const t=(ml.skills??[]).filter(s=>!!s.defaultSelected).map(s=>s.id).filter(Boolean);return t.length>0?t:["tailwind-design-system"]}function lm(t=[],s=[],n=[],a=[],o=[]){const i=im(t),l=Mo({title:"**📚 参考文档**:",selected:s,available:n,toLine:(d,w)=>`- **\`/docs/${d}\`** - ${(w==null?void 0:w.displayName)||d}`}),c=Mo({title:"**🖼️ 参考原型页面**:",selected:a,available:o,toLine:(d,w)=>`- **\`/src/prototypes/${d}/spec.md\`** - ${(w==null?void 0:w.displayName)||d}`});return`**系统指令**:你将作为UI/UX 设计架构师 × 前端工程师(复合型),协助用户「新建一个主题」。 ⚠️ **重要提示**:请务必完整阅读以下规范和参考资料,先完成需求对齐,再进行任何文件写入。 ${i} **📋 必读规范文档**: - **\`/rules/theme-generation-guide.md\`** ⭐️ 主题生成完整规范 **系统交互要求**: - 收到本条系统指令后,必须先向用户回复一次,并等待用户补充信息/确认;确认前不要写入或修改文件 - 首次回复保持轻量友好,不要让用户有压力 - 告知:已准备好开始新建主题 ${c?` ⚠️ **对于参考原型页面,请直接读取其源代码和 spec 及任何相关信息,此外如果你有能力截图,请结合页面截图界面来进行视觉风格分析,辅助生成主题。** `:""}${l}${c} **目标目录**:\`src/themes//\` **输出目标**:遵循规范生成主题文件(如 \`globals.css\` 或 \`designToken.json\`、\`index.tsx\`,必要时补充 \`DESIGN.md\`) **首次回复模板**: \`\`\` 收到,准备新建主题。 请先告诉我你的主题目标(品牌/业务场景/风格偏好/参考素材均可), 我会先给出建议的 theme-key 与交付文件清单,待你确认后再开始生成。 \`\`\``}function cm({visible:t,onClose:s,selectedSkillIds:n,setSelectedSkillIds:a,selectedDocs:o,setSelectedDocs:i,availableDocs:l,selectedReferencePages:c,setSelectedReferencePages:d,availableReferencePages:w,preferredPromptClient:j,preferredIDE:$,buildCreateThemePrompt:v,onAfterCreatePromptAction:D,onImportSuccess:u}){const[C,K]=r.useState(null),[y,P]=r.useState("ai"),[R,L]=r.useState("local_axure"),[F,x]=r.useState("zip"),[V,re]=r.useState(!1),[B,xe]=r.useState(null),ie=r.useMemo(()=>[{key:"local_axure",title:"本地 Axure ZIP",description:"扩展转后化导出的 zip",icon:e.jsx(ta,{className:"h-8 w-8 text-emerald-500"}),uploadModeSupport:"zip"},{key:"make_zip",title:"Make 导入 ZIP",description:"上传 Axhub Make 导出的 ZIP 包",icon:e.jsx(dn,{className:"h-8 w-8 text-sky-500"}),uploadModeSupport:"zip"},{key:"axure_prototype",title:"Axure 原型链接",description:"支持在线或本地预览的链接",icon:e.jsx(un,{className:"h-8 w-8 text-sky-500"}),uploadModeSupport:"none"},{key:"web_page",title:"网页链接",description:"支持任意网页链接",icon:e.jsx(pn,{className:"h-8 w-8 text-cyan-500"}),uploadModeSupport:"none"},{key:"screenshot",title:"截图导入",description:"支持多张截图",icon:e.jsx(Ci,{className:"h-8 w-8 text-violet-500"}),uploadModeSupport:"none"},{key:"figma_make",title:"Figma Make",description:"Figma 设计稿代码导出",icon:e.jsx(ta,{className:"h-8 w-8 text-pink-500"}),uploadModeSupport:"folder"},{key:"v0",title:"V0 App",description:"在线应用生成平台",icon:e.jsx(_n,{className:"h-8 w-8 text-emerald-500"}),uploadModeSupport:"folder"},{key:"google_aistudio",title:"Google AIStudio",description:"在线应用生成平台",icon:e.jsx(pn,{className:"h-8 w-8 text-amber-500"}),uploadModeSupport:"folder"},{key:"app_direct",title:"移动端 APP",description:"暂未开放",icon:e.jsx(Ma,{className:"h-8 w-8 text-muted-foreground/60"}),uploadModeSupport:"none"}],[]),se=r.useMemo(()=>ie.find(A=>A.key===R)||ie[0],[ie,R]).uploadModeSupport==="folder",W=r.useMemo(()=>(Zi.skills??[]).reduce((q,pe)=>{const Ne=String(pe.id??"").trim(),Ce=String(pe.titleZh??pe.titleCn??"").trim(),Ie=String(pe.titleEn??pe.title??"").trim(),ve=Ce||Ie;return!Ne||!ve||q.push({value:Ne,label:ve,secondaryLabel:Ce&&Ie&&Ce!==Ie?Ie:void 0,description:String(pe.description??"").trim()||"适用于主题方案生成与视觉规范设计场景。",category:pe.category}),q},[]),[]);r.useEffect(()=>{t&&(P("ai"),L("local_axure"),x("zip"),re(!1),xe(null))},[t]),r.useEffect(()=>{!se&&F==="folder"&&(x("zip"),xe(null))},[se,F]);const S=r.useCallback(async A=>{var Ie;if(!A||A.length===0||ba(R)||Jn(R))return;const q=Array.from(A),pe=R==="screenshot",Ne=R==="make_zip"?"local_axure":R,Ce=new FormData;if(pe)Ce.append("targetType","themes"),q.forEach(ve=>{Ce.append("files",ve,ve.name)});else if(Ce.append("uploadType",Ne),Ce.append("targetType","themes"),Ce.append("uploadMode",F),F==="zip"){const ve=q[0];if(!ve.name.toLowerCase().endsWith(".zip")){H.error("请上传 ZIP 文件");return}Ce.append("file",ve,ve.name)}else{if(!se){H.error("当前来源不支持文件夹上传");return}const Ue=(((Ie=q[0])==null?void 0:Ie.webkitRelativePath)||"").split("/").filter(Boolean)[0];Ue&&Ce.append("folderName",Ue),q.forEach(Fe=>{Ce.append("files",Fe,Fe.name);const Oe=Fe.webkitRelativePath||Fe.name;Ce.append("relativePaths",Oe)})}re(!0);try{const ve=pe?"/api/upload-screenshots":"/api/upload",Ue=await fetch(ve,{method:"POST",body:Ce}),Fe=await Ue.json().catch(()=>({}));if(!Ue.ok||!(Fe!=null&&Fe.success))throw console.error("[CreateThemeDialog] 主题导入上传失败:",{endpoint:ve,status:Ue.status,statusText:Ue.statusText,result:Fe}),new Error((Fe==null?void 0:Fe.error)||"上传失败");xe(Fe),H.success(Fe.message||"上传成功,请点击复制 Prompt")}catch(ve){console.error("[CreateThemeDialog] 主题导入异常详情:",ve),H.error($a(ve,"上传失败,请稍后重试"))}finally{re(!1)}},[R,se,F]),Y=r.useCallback(()=>{if(Jn(R))throw new Error("该导入来源暂未开放");if(ba(R))return rm(R);const A=String((B==null?void 0:B.prompt)||"").trim();if(!A)throw new Error("请先上传文件并生成导入结果");return om(A,R)},[R,B]),k=r.useCallback(async()=>{try{await(u==null?void 0:u())}finally{D()}},[D,u]),N=se&&F==="folder"?{directory:"",webkitdirectory:""}:{},U=Jn(R)||!ba(R)&&!B;return e.jsx(zn,{open:t,onOpenChange:A=>!A&&s(),children:e.jsx(fn,{ref:K,side:"left",className:"flex w-full max-w-[620px] flex-col p-0 text-sm sm:max-w-[620px] [&>[data-sheet-close]]:hidden",children:e.jsxs(ca,{value:y,onValueChange:A=>{(A==="ai"||A==="import")&&P(A)},className:"flex h-full flex-col",children:[e.jsxs(xn,{className:"border-b px-5 py-3.5",children:[e.jsx(gn,{className:"sr-only",children:"新建主题 / 导入主题"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(Wn,{className:"grid h-8 w-full max-w-[280px] grid-cols-2 rounded-lg border border-border/70 bg-muted/50 p-0.5",children:[e.jsx(Jt,{value:"ai",className:"h-full rounded-md px-2.5 py-0 text-[13px] leading-none data-[state=active]:shadow-none",children:"新建主题"}),e.jsx(Jt,{value:"import",className:"h-full rounded-md px-2.5 py-0 text-[13px] leading-none data-[state=active]:shadow-none",children:"导入主题"})]}),e.jsx(te,{variant:"ghost",size:"icon-sm",className:"h-7 w-7 rounded-md",onClick:s,"aria-label":"关闭",disabled:V,children:e.jsx(as,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"flex-1 space-y-4 overflow-y-auto px-5 py-4.5",children:y==="ai"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"rounded-md border border-border/60 bg-muted/30 px-3.5 py-2.5 text-[13px] leading-relaxed text-muted-foreground",children:"💡 你也可以直接与 AI 对话生成主题,以下选项可帮助生成更精准的提示词。"}),e.jsxs(Dt,{children:[e.jsx(At,{hint:"从技能列表中选择,AI 会参考对应应用场景生成方案",tooltipClassName:"max-w-none w-fit whitespace-nowrap",children:"使用技能"}),e.jsx(Jr,{value:n,onChange:a,placeholder:"请选择技能(可多选)",searchPlaceholder:"搜索技能...",options:W,columns:2,portalContainer:C,presentation:"dialog",dialogTitle:"选择技能(可多选)"})]}),e.jsxs(Dt,{children:[e.jsx(At,{hint:"AI 会根据所选文档生成主题,文档可在资产管理中进行管理",children:"文档"}),e.jsx(Ms,{value:o,onChange:i,placeholder:"自动",searchPlaceholder:"搜索文档...",options:l.map(A=>({value:A.name,label:A.displayName})),portalContainer:C})]}),e.jsxs(Dt,{children:[e.jsx(At,{hint:"选择参考页面后,AI 会读取并在有能力时截图分析页面来辅助生成主题",children:"参考页面(多选)"}),e.jsx(Ms,{value:c??[],onChange:A=>d==null?void 0:d(A),placeholder:"自动",searchPlaceholder:"搜索参考页面...",options:(w==null?void 0:w.map(A=>({value:A.name,label:A.displayName})))||[],portalContainer:C})]})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"grid grid-cols-2 gap-4",children:ie.map(A=>{const q=A.key===R,pe=A.key==="app_direct";return e.jsxs("button",{type:"button",onClick:()=>{pe||(L(A.key),xe(null))},disabled:pe,className:`flex items-center gap-2.5 rounded-md border p-3 text-left transition ${pe?"cursor-not-allowed border-border/50 bg-muted/20 text-muted-foreground":q?"border-foreground/60 bg-muted/40":"border-border hover:bg-muted/30"}`,children:[e.jsx("div",{className:"flex-shrink-0 text-muted-foreground/80 [&_svg]:h-6 [&_svg]:w-6",children:A.icon}),e.jsxs("div",{className:"grid gap-1",children:[e.jsx("div",{className:"text-sm font-medium leading-none",children:A.title}),e.jsx("div",{className:"text-[12px] leading-4 text-muted-foreground line-clamp-2",children:A.description})]})]},A.key)})}),Jn(R)?e.jsx("div",{className:"rounded-md border border-dashed p-3 text-sm text-muted-foreground",children:"暂未开放"}):ba(R)?e.jsx("div",{className:"rounded-md border border-dashed p-3 text-sm text-muted-foreground",children:"当前来源无需上传文件。点击底部按钮开始对话,并将链接发送给 AI 即可。"}):e.jsxs("div",{className:"space-y-3",children:[se?e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-sm font-medium",children:"上传方式"}),e.jsxs(Ga,{type:"single",value:F,onValueChange:A=>{(A==="zip"||A==="folder")&&(x(A),xe(null))},children:[e.jsx(Zs,{value:"zip",children:"ZIP"}),e.jsx(Zs,{value:"folder",children:"文件夹"})]})]}):null,e.jsxs("label",{className:"flex min-h-[150px] cursor-pointer flex-col items-center justify-center gap-2 rounded-md border border-dashed p-6 text-center hover:bg-muted/40",children:[V?e.jsx(gt,{className:"h-7 w-7 animate-spin text-primary"}):e.jsx(_n,{className:"h-7 w-7 text-primary"}),e.jsx("div",{className:"text-sm font-medium",children:R==="screenshot"?"点击上传截图":F==="folder"?"点击上传文件夹":"点击上传 ZIP 文件"}),e.jsx("div",{className:"text-[12px] leading-4 text-muted-foreground",children:R==="screenshot"?"系统会基于截图生成导入任务。":F==="folder"?"请选择本地文件夹,系统会按原目录结构上传。":"建议优先使用 ZIP 上传,导入更稳定。"}),e.jsx("input",{type:"file",accept:R==="screenshot"?"image/*":F==="zip"?".zip":void 0,multiple:R==="screenshot"||F==="folder",className:"hidden",onChange:A=>{S(A.target.files),A.currentTarget.value=""},disabled:V,...N})]})]})]})}),e.jsxs(Bn,{className:"flex flex-row justify-end gap-2 border-t px-5 py-3.5",children:[e.jsx(te,{variant:"outline",size:"sm",onClick:s,disabled:V,children:"取消"}),y==="ai"?e.jsx(hs,{type:"primary",preferredClient:j,preferredIDE:$,scene:"create-theme",buildPrompt:()=>v(),onAfterCopy:D,copySuccessMessage:"复制成功,请返回 IDE 发送给 AI",executeSuccessMessage:"已打开新会话",fallbackMessage:"自动执行失败,已回退为复制 Prompt"}):Jn(R)?null:e.jsx(hs,{type:"primary",preferredClient:j,preferredIDE:$,scene:`theme-import-${R}`,buildPrompt:Y,onAfterCopy:()=>{k()},copySuccessMessage:"主题导入 Prompt 已复制,请返回 IDE 发送给 AI",executeSuccessMessage:"已打开新会话",fallbackMessage:"自动执行失败,已回退为复制 Prompt",disabled:U})]})]})})})}function dm({state:t,actions:s}){return e.jsx(cm,{visible:t.visible,onClose:s.onClose,selectedSkillIds:t.selectedSkillIds,setSelectedSkillIds:s.setSelectedSkillIds,selectedDocs:t.selectedDocs,setSelectedDocs:s.setSelectedDocs,availableDocs:t.availableDocs,selectedReferencePages:t.selectedReferencePages,setSelectedReferencePages:s.setSelectedReferencePages,availableReferencePages:t.availableReferencePages,preferredPromptClient:t.preferredPromptClient,preferredIDE:t.preferredIDE,buildCreateThemePrompt:s.buildCreateThemePrompt,onAfterCreatePromptAction:s.onAfterCreatePromptAction,onImportSuccess:s.onImportSuccess})}function um(t){const s=String((t==null?void 0:t.tableName)||"").trim();return`**系统指令**:你将作为 UI/UX 设计架构师 × 前端工程师(复合型),协助用户「新建一个数据资产(数据表)」。 ⚠️ **重要提示**:先完成需求对齐与字段确认,再写入任何文件。 **📋 必读规范文档**: - **\`/src/database/README.md\`** ⭐️ 数据表 JSON 格式强约束(必须遵循) **系统交互要求**: - 收到本条系统指令后,必须先向用户回复一次,并等待用户补充信息/确认;确认前不要写入或修改文件 - 首次回复保持轻量友好,并提示用户可以直接发任何材料(需求描述 / 截图 / 现有字段清单 / 参考页面 / 示例数据) **目标目录**:\`src/database\` **输出格式**:\`src/database/.json\`${s?`(建议表名:${s})`:""} **执行要求**: - 文件名使用英文,优先 kebab-case(如 \`users.json\`、\`order-items.json\`) - JSON 必须是对象,包含 \`tableName\`(中文)+ \`records\`(数组) - 每条记录必须有唯一 \`id\`,并保证同一张表里 \`id\` 类型一致(number 或 string) - 先给出:字段定义表(字段名/类型/含义/示例),以及 2-3 条示例记录;用户确认后再生成完整数据并落盘 **首次回复模板**: \`\`\` 收到,准备新建数据表。 请告诉我: 1) 这个表要服务哪个页面/场景? 2) 你希望的表名(中文)和文件名(英文)是什么? 3) 字段清单(你可以先给核心 5-10 个字段),以及 id 用 number 还是 string? \`\`\` **完成后请输出**: - 你创建/更新的文件路径(\`src/database/.json\`) - 字段定义(Markdown 表格)与示例记录(用于复核)`}const mm={local_axure:["/skills/local-axure-workflow/SKILL.md"],axure_prototype:["/skills/axure-prototype-workflow/SKILL.md","/skills/axure-prototype-workflow/asset-extraction.md","/skills/axure-prototype-workflow/data-generation.md"],web_page:["/skills/web-page-workflow/SKILL.md","/skills/web-page-workflow/asset-extraction.md","/skills/web-page-workflow/data-generation.md"],screenshot:["/skills/screen-to-code/SKILL.md","/skills/screen-to-code/screenshot-collection.md"],app_direct:[]};function hm(t){const s=String(t||"").trim();return s?s.startsWith("/")?s:`/${s}`:""}function pm(t){const s=[],n=new Set;for(const a of t){const o=hm(a);!o||n.has(o)||(n.add(o),s.push(o))}return s}function pl(t){return t.map(s=>`- \`${s}\``).join(` `)}function fm(t){return Array.isArray(t)?t.map(s=>String(s||"").trim()).filter(Boolean):[]}function wa(t){return t==="axure_prototype"||t==="web_page"}function Qn(t){return t==="app_direct"}function fl(t){return t==="app_direct"?[]:pm(mm[t]||[])}function xm(t){const s=t==="axure_prototype"?"Axure 原型链接":"网页链接",n=fl(t);return`**系统指令**:你将作为 UI/UX 设计架构师 × 前端工程师(复合型),协助用户「基于${s}导入并创建数据资产」。 **📋 参考文档(必须阅读)**: ${pl(n)} **目标输出**: - \`src/database/.json\`(可多表) - 如需补充说明,可在 \`src/docs/\` 产出简要数据说明文档 **执行要求**: - 先和用户确认:目标数据表范围、字段定义、主键策略、是否允许覆盖已有数据 - 未完成确认前,不要写入文件 - 输出数据前先给出字段映射与示例记录,待用户确认后再落盘 **首次回复模板**: \`\`\` 收到,我将基于${s}协助你导入数据。 请先提供链接(URL),并告诉我目标数据表名称与关键字段。 \`\`\``}function gm(t,s){const n=fl(t),a=t==="screenshot"?"截图":"本地 Axure ZIP",o=String((s==null?void 0:s.filePath)||"").trim(),i=fm(s==null?void 0:s.files),l=String((s==null?void 0:s.prompt)||"").trim(),c=[];if(o&&c.push(`上传上下文目录:\`${o}\``),i.length>0&&c.push(`上传文件清单: ${i.map(d=>`- \`${d}\``).join(` `)}`),c.length===0&&!l)throw new Error("请先上传文件并生成导入结果");return`**系统指令**:你将作为 UI/UX 设计架构师 × 前端工程师(复合型),协助用户「基于${a}导入并创建数据资产」。 **📋 参考文档(必须阅读)**: ${pl(n)} **上传上下文**: ${c.length>0?c.join(` `):"- 已完成上传,请结合系统上传结果继续处理"} ${l?`**系统上传结果补充**: ${l} `:""}**目标输出**: - \`src/database/.json\`(可多表) - 如需补充说明,可在 \`src/docs/\` 产出简要数据说明文档 **执行要求**: - 先和用户确认:目标数据表范围、字段定义、主键策略、是否允许覆盖已有数据 - 未完成确认前,不要写入文件 - 输出数据前先给出字段映射与示例记录,待用户确认后再落盘`}function ym({visible:t,onClose:s,newTableName:n,setNewTableName:a,newTableNameError:o,clearNewTableNameError:i,dataTableCreating:l,onCreateSubmit:c,preferredPromptClient:d,preferredIDE:w,onImportSuccess:j}){const[$,v]=r.useState("create"),[D,u]=r.useState("local_axure"),[C,K]=r.useState(!1),[y,P]=r.useState(null),[R,L]=r.useState([]),F=l||C,x=r.useMemo(()=>[{key:"local_axure",title:"本地 Axure ZIP",description:"扩展导出的 ZIP 包",icon:e.jsx(ta,{className:"h-8 w-8 text-emerald-500"}),uploadModeSupport:"zip"},{key:"axure_prototype",title:"Axure 原型链接",description:"支持在线或本地预览的链接",icon:e.jsx(un,{className:"h-8 w-8 text-sky-500"}),uploadModeSupport:"none"},{key:"web_page",title:"网页链接",description:"支持任意网页链接",icon:e.jsx(pn,{className:"h-8 w-8 text-cyan-500"}),uploadModeSupport:"none"},{key:"screenshot",title:"截图导入",description:"支持多张截图",icon:e.jsx(Ci,{className:"h-8 w-8 text-violet-500"}),uploadModeSupport:"image"},{key:"app_direct",title:"移动端 APP",description:"暂未开放",icon:e.jsx(Ma,{className:"h-8 w-8 text-muted-foreground/60"}),uploadModeSupport:"none"}],[]),V=r.useMemo(()=>x.find(z=>z.key===D)||x[0],[x,D]);r.useEffect(()=>{t&&(v("create"),u("local_axure"),K(!1),P(null),L([]))},[t]);const re=r.useCallback(async z=>{if(z.length===0||wa(D)||Qn(D))return;const se=D==="screenshot",W=new FormData;if(se)z.forEach(S=>{W.append("files",S,S.name)});else{const S=z[0];if(!S.name.toLowerCase().endsWith(".zip")){H.error("请上传 ZIP 文件");return}W.append("uploadType",D),W.append("uploadMode","zip"),W.append("file",S,S.name)}L(z),K(!0);try{const S=se?"/api/upload-screenshots":"/api/upload",Y=await fetch(S,{method:"POST",body:W}),k=await Y.json().catch(()=>({}));if(!Y.ok||!(k!=null&&k.success))throw console.error("[CreateDataDialog] 数据导入上传失败:",{endpoint:S,status:Y.status,statusText:Y.statusText,result:k}),new Error((k==null?void 0:k.error)||"上传失败");P(k),H.success(k.message||"上传成功,请点击复制 Prompt")}catch(S){console.error("[CreateDataDialog] 数据导入异常详情:",S),H.error($a(S,"上传失败,请稍后重试"))}finally{K(!1)}},[D]),B=r.useCallback(()=>{if(Qn(D))throw new Error("该导入来源暂未开放");return wa(D)?xm(D):gm(D,y)},[D,y]),xe=r.useCallback(async()=>{try{await(j==null?void 0:j())}finally{s()}},[s,j]),ie=Qn(D)||!wa(D)&&!y;return e.jsx(zn,{open:t,onOpenChange:z=>{!z&&!F&&s()},children:e.jsx(fn,{side:"left",className:"flex w-full max-w-[620px] flex-col p-0 text-sm sm:max-w-[620px] [&>[data-sheet-close]]:hidden",children:e.jsxs(ca,{value:$,onValueChange:z=>{(z==="create"||z==="import")&&v(z)},className:"flex h-full flex-col",children:[e.jsxs(xn,{className:"border-b px-5 py-3.5",children:[e.jsx(gn,{className:"sr-only",children:"新建数据 / 导入数据"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(Wn,{className:"grid h-8 w-full max-w-[280px] grid-cols-2 rounded-lg border border-border/70 bg-muted/50 p-0.5",children:[e.jsx(Jt,{value:"create",className:"h-full rounded-md px-2.5 py-0 text-[13px] leading-none data-[state=active]:shadow-none",children:"新建数据"}),e.jsx(Jt,{value:"import",className:"h-full rounded-md px-2.5 py-0 text-[13px] leading-none data-[state=active]:shadow-none",children:"导入数据"})]}),e.jsx(te,{variant:"ghost",size:"icon-sm",className:"h-7 w-7 rounded-md",onClick:s,"aria-label":"关闭",disabled:F,children:e.jsx(as,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"flex-1 space-y-4 overflow-y-auto px-5 py-4.5",children:$==="create"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"rounded-md border border-border/60 bg-muted/30 px-3.5 py-2.5 text-[13px] leading-relaxed text-muted-foreground",children:"💡 你也可以直接与 AI 对话生成数据表,以下选项可帮助生成更精准的提示词。"}),e.jsxs(Dt,{children:[e.jsx(At,{children:"数据表名称"}),e.jsx(Ps,{value:n,onChange:z=>{a(z.target.value),o&&i()},placeholder:"例如:用户表、产品列表",autoFocus:!0,disabled:l,onKeyDown:z=>{z.key==="Enter"&&(z.preventDefault(),c())},"aria-invalid":!!o}),o?e.jsx(Ea,{className:"text-destructive",children:o}):null]})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"grid grid-cols-2 gap-4",children:x.map(z=>{const se=z.key===D,W=z.key==="app_direct";return e.jsxs("button",{type:"button",onClick:()=>{W||(u(z.key),P(null),L([]))},disabled:W,className:`flex items-center gap-2.5 rounded-md border p-3 text-left transition ${W?"cursor-not-allowed border-border/50 bg-muted/20 text-muted-foreground":se?"border-foreground/60 bg-muted/40":"border-border hover:bg-muted/30"}`,children:[e.jsx("div",{className:"flex-shrink-0 text-muted-foreground/80 [&_svg]:h-6 [&_svg]:w-6",children:z.icon}),e.jsxs("div",{className:"grid gap-1",children:[e.jsx("div",{className:"text-sm font-medium leading-none",children:z.title}),e.jsx("div",{className:"line-clamp-2 text-[12px] leading-4 text-muted-foreground",children:z.description})]})]},z.key)})}),Qn(D)?e.jsx("div",{className:"rounded-md border border-dashed p-3 text-sm text-muted-foreground",children:"暂未开放"}):wa(D)?e.jsx("div",{className:"rounded-md border border-dashed p-3 text-sm text-muted-foreground",children:"当前来源无需上传文件。点击底部按钮开始对话,并将链接发送给 AI 即可。"}):e.jsx(dl,{title:V.uploadModeSupport==="image"?"点击上传或拖拽截图到此区域":"点击上传或拖拽 ZIP 文件到此区域",description:V.uploadModeSupport==="image"?"支持多张截图,上传后可生成数据导入 Prompt。":"建议优先使用 ZIP 上传,导入更稳定。",accept:V.uploadModeSupport==="image"?"image/*":".zip",multiple:V.uploadModeSupport==="image",disabled:C,loading:C,browseLabel:V.uploadModeSupport==="image"?"选择截图":"选择 ZIP 文件",selectedFiles:R,onFilesSelected:re,onClear:()=>{L([]),P(null)}})]})}),e.jsxs(Bn,{className:"flex flex-row justify-end gap-2 border-t px-5 py-3.5",children:[e.jsx(te,{variant:"outline",size:"sm",onClick:s,disabled:F,children:"取消"}),$==="create"?e.jsxs(e.Fragment,{children:[e.jsx(hs,{type:"primary",preferredClient:d,preferredIDE:w,scene:"create-data",buildPrompt:()=>um({tableName:n.trim()}),copySuccessMessage:"复制成功,请返回 IDE 发送给 AI",executeSuccessMessage:"已打开新会话",fallbackMessage:"自动执行失败,已回退为复制 Prompt",copyLabel:"AI Prompt"}),e.jsx(te,{variant:"brand",size:"sm",onClick:()=>void c(),disabled:l,children:l?e.jsxs(e.Fragment,{children:[e.jsx(Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"创建中..."]}):"创建"})]}):Qn(D)?null:e.jsx(hs,{type:"primary",preferredClient:d,preferredIDE:w,scene:`data-import-${D}`,buildPrompt:B,onAfterCopy:()=>{xe()},copySuccessMessage:"数据导入 Prompt 已复制,请返回 IDE 发送给 AI",executeSuccessMessage:"已打开新会话",fallbackMessage:"自动执行失败,已回退为复制 Prompt",disabled:ie})]})]})})})}function bm({state:t,actions:s}){return e.jsx(ym,{visible:t.visible,onClose:s.onClose,newTableName:t.newTableName,setNewTableName:s.setNewTableName,newTableNameError:t.newTableNameError,clearNewTableNameError:s.clearNewTableNameError,dataTableCreating:t.dataTableCreating,onCreateSubmit:s.onCreateSubmit,preferredPromptClient:t.preferredPromptClient,preferredIDE:t.preferredIDE,onImportSuccess:s.onImportSuccess})}const wm=["/skills/axure-export-workflow/SKILL.md","/rules/axure-api-guide.md"];function jm(t){const{activeTab:s,itemName:n}=t,a=`src/${s}/${n}`,o=`${a}/index.tsx`,i=`${a}/spec.md`;return`请为当前项目执行「新增或更新 Axure API(代码+文档)」任务,严格按固定要求处理,不依赖已有解析结果。 必须先阅读并遵循以下固定技能/规范: ${wm.map(l=>`- \`${l}\``).join(` `)} 目标文件: - \`${o}\` - \`${i}\` 任务要求: 1. 以 \`useImperativeHandle\` 返回对象作为 Axure API 真值来源,补齐或更新 \`eventList\` / \`actionList\` / \`varList\` / \`configList\` / \`dataList\`。 2. 保持现有业务行为、交互和视觉表现不变,只做 Axure API 相关必要改动。 3. 同步更新 \`${i}\` 的 5.x Axure API 章节(5.1-5.5),确保与代码一致;若文件不存在请创建。 4. 输出结果时给出改动摘要,并明确列出新增/更新了哪些 API。 5. 如当前文件缺失任意列表,完整新增并保证可被静态识别;如已存在,补齐字段描述并确保命名与规范一致。 输出要求: - 列出 5 类列表各自是“新增 / 更新 / 保持不变”。 - 标注 \`${i}\` 是否已同步完成。 `}const Fo="axhub-admin-export-modal-preferences",Nm=["dynamicPrototype","staticPrototype","axureApi","copyConfig","usageGuide"],vm=["","code","codeAndDocs","codeAndDocsAndSource"];function Xr(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function zo(t){return typeof t=="number"&&Number.isFinite(t)&&t>0}function Sm(t){if(!Xr(t))return;const s=zo(t.width)?Math.round(t.width):void 0,n=zo(t.height)?Math.round(t.height):void 0,a=t.includeConfig==="none"||t.includeConfig==="code"||t.includeConfig==="codeAndDocs"||t.includeConfig==="codeAndDocsAndSource"?t.includeConfig:void 0,o=t.contentType==="title"||t.contentType==="screenshot"?t.contentType:void 0;if(!(s===void 0&&n===void 0&&a===void 0&&o===void 0))return{width:s??500,height:n??300,includeConfig:a??"code",contentType:o??"title"}}function Cm(t){if(!Xr(t))return;const s=typeof t.preserveHierarchy=="boolean"?t.preserveHierarchy:void 0,n=typeof t.preserveSvgIcons=="boolean"?t.preserveSvgIcons:void 0;if(!(s===void 0&&n===void 0))return{preserveHierarchy:s??!1,preserveSvgIcons:n??!0}}function xl(t){if(!Xr(t))return{version:1};const s=typeof t.activeTabKey=="string"&&Nm.includes(t.activeTabKey)?t.activeTabKey:void 0,n=typeof t.selectedExportType=="string"&&vm.includes(t.selectedExportType)?t.selectedExportType:void 0;return{version:1,activeTabKey:s,selectedExportType:n,imageConfig:Sm(t.imageConfig),axureCopyOptions:Cm(t.axureCopyOptions)}}function km(t){const s=typeof t=="string"?t.trim():"";return s?`${Fo}:${encodeURIComponent(s)}`:Fo}function Yr(t){if(typeof window>"u")return{version:1};try{const s=window.localStorage.getItem(t);return s?xl(JSON.parse(s)):{version:1}}catch{return{version:1}}}function gl(t,s){const n=Yr(t),a=xl({...n,...s,imageConfig:s.imageConfig?{...n.imageConfig,...s.imageConfig}:n.imageConfig,axureCopyOptions:s.axureCopyOptions?{...n.axureCopyOptions,...s.axureCopyOptions}:n.axureCopyOptions});if(typeof window<"u")try{window.localStorage.setItem(t,JSON.stringify(a))}catch{}return a}const yl=be.forwardRef(({className:t,...s},n)=>e.jsx(ki,{className:fe("grid gap-3",t),...s,ref:n}));yl.displayName=ki.displayName;const kr=be.forwardRef(({className:t,...s},n)=>e.jsx(Ei,{ref:n,className:fe("aspect-square h-4 w-4 rounded-full border border-foreground text-foreground ring-offset-background focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-white",t),...s,children:e.jsx(uc,{className:"flex items-center justify-center text-primary-foreground",children:e.jsx(di,{className:"h-2.5 w-2.5 fill-current text-current"})})}));kr.displayName=Ei.displayName;const Oa=yc,_a=bc,oa=be.forwardRef(({className:t,children:s,clearable:n=!1,hasValue:a=!1,onClear:o,disabled:i,...l},c)=>e.jsxs(Ti,{ref:c,className:fe("flex h-9 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),disabled:i,...l,children:[s,e.jsxs("div",{className:"flex items-center gap-1",children:[n&&a&&!i?e.jsx("span",{role:"button","aria-label":"清除选择",className:"inline-flex h-4 w-4 items-center justify-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground",onPointerDown:d=>{d.preventDefault(),d.stopPropagation(),o==null||o()},children:e.jsx(as,{className:"h-3.5 w-3.5"})}):null,e.jsx(mc,{asChild:!0,children:e.jsx(en,{className:"h-4 w-4 opacity-50"})})]})]}));oa.displayName=Ti.displayName;const bl=be.forwardRef(({className:t,...s},n)=>e.jsx(Ii,{ref:n,className:fe("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(hc,{className:"h-4 w-4"})}));bl.displayName=Ii.displayName;const wl=be.forwardRef(({className:t,...s},n)=>e.jsx(Pi,{ref:n,className:fe("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(en,{className:"h-4 w-4"})}));wl.displayName=Pi.displayName;const ia=be.forwardRef(({className:t,children:s,position:n="popper",...a},o)=>e.jsx(pc,{children:e.jsxs(Di,{ref:o,className:fe("relative z-[120] max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...a,children:[e.jsx(bl,{}),e.jsx(fc,{className:fe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),e.jsx(wl,{})]})}));ia.displayName=Di.displayName;const Em=be.forwardRef(({className:t,...s},n)=>e.jsx(Ai,{ref:n,className:fe("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...s}));Em.displayName=Ai.displayName;const vs=be.forwardRef(({className:t,children:s,...n},a)=>e.jsxs(Ri,{ref:a,className:fe("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(xc,{children:e.jsx(Fn,{className:"h-4 w-4"})})}),e.jsx(gc,{children:s})]}));vs.displayName=Ri.displayName;const Tm=be.forwardRef(({className:t,...s},n)=>e.jsx($i,{ref:n,className:fe("-mx-1 my-1 h-px bg-muted",t),...s}));Tm.displayName=$i.displayName;const Er=be.forwardRef(({className:t,...s},n)=>e.jsx(Oi,{ref:n,className:fe("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-transparent bg-input shadow-xs transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary",t),...s,children:e.jsx(wc,{className:fe("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-sm ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Er.displayName=Oi.displayName;const jl=vc,Dn=be.forwardRef(({className:t,...s},n)=>e.jsx(jc,{ref:n,className:fe("border-b",t),...s}));Dn.displayName="AccordionItem";const An=be.forwardRef(({className:t,children:s,...n},a)=>e.jsx(Nc,{asChild:!0,children:e.jsx("div",{className:"m-0 flex h-full flex-1 items-center",children:e.jsxs(_i,{ref:a,className:fe("flex flex-1 items-center justify-between py-2 text-sm transition-all hover:underline [&[data-state=open]>svg]:rotate-180",t),...n,children:[s,e.jsx(en,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})})}));An.displayName=_i.displayName;const Rn=be.forwardRef(({className:t,children:s,...n},a)=>e.jsx(Li,{ref:a,className:fe("overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",t),...n,children:e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:s})}));Rn.displayName=Li.displayName;const Im=[{key:"eventList",title:"eventList 事件列表"},{key:"actionList",title:"actionList 动作列表"},{key:"varList",title:"varList 变量列表"},{key:"configList",title:"configList 配置列表"},{key:"dataList",title:"dataList 数据列表"}];function es(t){if(t==null)return"—";if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean")return String(t);try{return JSON.stringify(t)}catch{return String(t)}}function Pm(t){return t==="parsed"?"结构化":t==="raw"?"部分解析":"未定义"}function Dm({open:t,preferencesStorageKey:s,onClose:n,imageConfig:a,setImageConfig:o,axureCopyOptions:i,setAxureCopyOptions:l,onDimensionChange:c,onSwapDimensions:d,onDimensionBlur:w,isExporting:j,onExport:$,onCopyRuntimeComponent:v,onCopyToAxure:D,onCopyConfig:u,activeTab:C,itemName:K,preferredPromptClient:y,preferredIDE:P}){const R=C==="components"?"组件":"原型",L='">