PageSourceSearch

https://wodeapp.ai/assets/AgentTemplatesPage-DwOi2WQJ.js

js wodeapp.ai collected 2026-10-02 00:42:37 UTC 25,759 bytes, 6 lines download raw bytes

1import{r as n,j as e}from"./react-vendor-BxoUhqX6.js";import{D as Me,j as Ie,I as Ae,a as $e,d as oe,s as Ee,u as Re,b as De,c as Le,y as C,a3 as ne,L as F,X as ie,a4 as Fe,G as Oe,$ as ze}from"./index-CR94Sc3y.js";import{u as We}from"./usePageMeta-C94jjl0E.js";import{C as p,u as Ue,T as _e}from"./TemplateCard-BIQjJsaQ.js";import{g as ce}from"./projectSiteUrl-BbCyNoMb.js";import{p as qe,T as Be,g as de,S as me}from"./ThemeInjector-DcZ0RDoy.js";import{C as He}from"./check-DJEGI8P0.js";import{F as Ve}from"./flag-xc4qWjf6.js";import{H as Ge}from"./heart-D37skX5b.js";import{P as Je}from"./plus-bmJO-mQK.js";import{S as pe}from"./search-BcM2zlN5.js";import{S as Ye}from"./star-CmfM70DE.js";import{C as Qe}from"./circle-alert-BNoxmRWo.js";import"./clsx-B-dksMZM.js";import"./i18n-vendor-Coo-X0AG.js";import"./eye-CeYfnDN5.js";import"./file-text-D19QWnZi.js";import"./image-B37tbJ4L.js";import"./layers-CfVMtdnX.js";import"./message-circle-Cu3ygOzR.js";import"./user-check-DFAOK8RH.js";import"./users-CNzTcDeG.js";import"./zap-ukup0K1h.js";import"./chart-column-0czevgXX.js";import"./ComponentRegistry-6pCWxLE-.js";import"./LoadingState-vmk7wexW.js";import"./GridSection-5L57r2iO.js";/**
2 * @license lucide-react v0.446.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Ke=Me("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);function Xe(i){let c=i?.config;if(typeof c=="string")try{c=JSON.parse(c)}catch{c={}}return{sections:c?.sections||i?.sections||[],theme:c?.theme||i?.theme,stylePreset:c?.stylePreset||i?.stylePreset}}function Ze(i,c,m){return i.map(u=>{const{sections:x,theme:P,stylePreset:s}=Xe(u);return{path:u.path||"/",title:u.title||u.path||"/",isHome:u.isHome,config:{sections:x,theme:P||c,stylePreset:s||m}}})}function et(i){if(!i||typeof i!="object"||Object.keys(i).length===0)return null;if(Array.isArray(i.pages)&&i.pages.length>0){const c=Ze(i.pages,i.theme,i.stylePreset),m=c.find(x=>x.isHome&&x.config.sections.length>0)||c.find(x=>x.config.sections.length>0)||c[0],u=m.config.sections;return u.length===0?null:{sections:u,theme:m.config.theme,stylePreset:m.config.stylePreset,pages:c}}return Array.isArray(i.sections)&&i.sections.length>0?{sections:i.sections,theme:i.theme,stylePreset:i.stylePreset}:null}async function tt(i,c){const x=await(await fetch(`/mainserver/api/json-schema/templates/${i}?language=${c==="en-US"?"en-US":"zh-CN"}`)).json();if(!x.success)return null;const P=x.template?.config||x.data?.config;return et(P)}const ue=new Set(["WorkflowSection","Workflow","ChatBotSection","ChatBot","ParallelAgentSection","MultiRoleAgentSection","RolePlaySection","RolePlay","ParallelAgentSection","ParallelAgent","MultiRoleAgentSection","MultiRoleAgent","DebateSection","Debate","KonvaImageEditor","ImageComposer","Canvas","CanvasSection","VideoEditorSection","VideoEditor","Live2DDialogSection","Live2DDialog","DeepSearchSection","DeepSearch"]),st=new Set(["WorkflowSection","Workflow"]);function w(...i){return i.filter(Boolean).join(" ")}class at extends n.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(c){console.warn("[WorkflowPreview] render error, falling back:",c.message)}render(){return this.state.hasError?this.props.fallback:this.props.children}}const At=()=>{const i=Ie(),{templateId:c}=Ae(),[m]=$e(),{user:u}=oe(),x=oe(Ee),P=Re(),{t:s,i18n:y}=De();We({title:s("workbench.templateSection.allTemplates"),description:s("seo.templatesDescription")}),n.useEffect(()=>{const t=m.get("ref");t&&localStorage.setItem("pending_referral_code",t)},[m]);const xe=n.useMemo(()=>[{id:"all",name:s("templates.categories.all"),icon:p.all},{id:"community",name:s("templates.categories.community","社区模板"),icon:p.community||p.all},{id:"ai-agent",name:s("templates.categories.ai-agent","AI 智能体"),icon:p["ai-agent"]||p["multi-agent"]},{id:"multi-agent",name:s("templates.categories.multi-agent"),icon:p["multi-agent"]},{id:"image",name:s("templates.categories.image"),icon:p.image},{id:"document",name:s("templates.categories.document"),icon:p.document},{id:"workflow",name:s("templates.categories.workflow"),icon:p.workflow},{id:"creative",name:s("templates.categories.creative"),icon:p.creative},{id:"learning",name:s("templates.categories.learning"),icon:p.learning}
6,{id:"decision",name:s("templates.categories.decision"),icon:p.decision},{id:"roleplay",name:s("templates.categories.roleplay"),icon:p.roleplay}],[s,y.language]),[N,M]=n.useState([]),[he,B]=n.useState(!0),[I,A]=n.useState(""),[S,ge]=n.useState("all"),[h,$]=n.useState(null),[b,O]=n.useState(null),[fe,H]=n.useState(!1),[je,V]=n.useState(0),[z,be]=n.useState("popular"),[G,T]=n.useState(!1),[j,ve]=n.useState(null),[g,W]=n.useState("project"),[k,we]=n.useState(""),[E,J]=n.useState(""),[Y,Q]=n.useState(""),[K,U]=n.useState(!1),[X,ye]=n.useState([]),v=Le(),Z=n.useRef(null),Ne=Ue(E,G&&g==="project"),{checking:ee,available:R,errorMessage:Pe,generatedDomain:te}=Ne;n.useEffect(()=>{(async()=>{B(!0);try{const l=await(await fetch(`/mainserver/api/json-schema/templates?language=${y.language}`)).json();if(l.success&&Array.isArray(l.templates)&&l.templates.length>0){const a=l.templates.map((o,f)=>({...o,author:o.author||`${P.name} Team`,stars:o.stars||Math.floor(Math.random()*500+100),downloads:o.downloads||Math.floor(Math.random()*1e4+1e3),createdAt:o.createdAt||"2025-01-01",updatedAt:o.updatedAt||"2026-01-28",featured:o.featured||!1,_sortOrder:f}));M(a)}else M([])}catch(r){console.error("加载模板失败:",r),M([])}finally{B(!1)}})()},[y.language]),n.useEffect(()=>{const t=m.get("q")||m.get("search"),r=t||c;if(!r)return;const l=decodeURIComponent(r).replace(/-/g," ");A(l),requestAnimationFrame(()=>{Z.current?.focus()}),c&&!t&&i(`/templates?q=${encodeURIComponent(r)}`,{replace:!0})},[c]),n.useEffect(()=>{const r=m.get("q")||m.get("search")||c;if(!r||N.length===0)return;const l=decodeURIComponent(r),a=N.find(o=>o.id===l)||N.find(o=>o.id===`user-${l}`)||N.find(o=>o.id.endsWith(l));if(a){a.name&&A(a.name),_(a);return}(async()=>{try{const f=await(await fetch(`/mainserver/api/json-schema/templates/${encodeURIComponent(l)}?language=${y.language}`)).json(),d=f.template||f;f.success!==!1&&d.id&&(d.name&&A(d.name),_({id:d.id,name:d.name||"",description:d.description||"",category:d.category||"other",tags:d.tags||[],thumbnail:d.thumbnail||"",author:d.author||`${P.name} Team`,stars:d.stars||0,downloads:d.downloads||0,featured:d.featured||!1,createdAt:d.createdAt||"",updatedAt:d.updatedAt||""}))}catch{}})()},[N]);const _=n.useCallback(async t=>{$(t),O(null),V(0),H(!0);try{const r=await tt(t.id,y.language);if(r){O(r);const l=r.sections.map(a=>a.type).filter(a=>!ue.has(a));l.length>0&&qe([...new Set(l)]).catch(()=>{})}}catch(r){console.error("加载模板预览失败:",r)}finally{H(!1)}},[y.language]);n.useEffect(()=>{(async()=>{try{const r=await C("/mainserver/api/json-schema/projects");if(r.ok){const l=await r.json();ye((l.data||l.projects||[]).map(a=>({id:a.id,name:a.name})))}}catch(r){console.error("加载项目列表失败:",r)}})()},[]);const se=n.useCallback(t=>{if(!I.trim())return!0;const r=I.toLowerCase(),l=`${t.id} ${t.name} ${t.description} ${t.tags.join(" ")}`.toLowerCase();if(l.includes(r))return!0;const a=r.split(/\s+/).filter(Boolean);return a.length>1?a.every(o=>l.includes(o)):!1},[I]),ae=n.useCallback(t=>S==="all"||S==="community"?!0:t.category===S,[S]),q=n.useMemo(()=>{let t=N.filter(ae).filter(se);const r=t.filter(a=>a.featured).sort((a,o)=>(a._sortOrder??0)-(o._sortOrder??0)),l=t.filter(a=>!a.featured);switch(z){case"popular":l.sort((a,o)=>(o.downloads||0)-(a.downloads||0));break;case"newest":l.sort((a,o)=>new Date(o.updatedAt||0).getTime()-new Date(a.updatedAt||0).getTime());break;case"stars":l.sort((a,o)=>(o.stars||0)-(a.stars||0));break}return[...r,...l]},[N,S,se,ae,z]),Se=n.useCallback(async t=>{try{const l=await(await C(`/mainserver/api/json-schema/user-templates/${t}/like`,{method:"POST"})).json();l.success&&M(a=>a.map(o=>o.id===t?{...o,stars:l.likeCount??(o.stars||0)}:o))}catch{}},[]),ke=n.useCallback(async t=>{if(confirm(s("templates.confirmReport","确定要举报此模板吗?")))try{(await(await C(`/mainserver/api/json-schema/user-templates/${t}/report`,{method:"POST",body:JSON.stringify({reason:"user_report"})})).json()).message==="Already reported"?v.info?.(s("templates.alreadyReported","您已举报过此模板"))??v.success(s("templates.alreadyReported","您已举报过此模板")):v.success(s("templates.reportSuccess","举报已提交"))}catch{v.error(s("templates.reportFailed","举报失败"))}},[s,v]),re=t=>{ve(t);let r="";if(x&&u?.name)r=u.name;else{const a=document.cookie.split("; ").find(o=>o.startsWith("guest_id="))?.split("=")[1];r=a?`${s("templates.guest")}${a.slice(-6)}`:`${s("templates.guest")}${Date.now().toString().slice(-6)}`}const l=`${r}-${t.name}`;J(l),Q(t.name),W("project"),T(!0)},Ce=async()=>
6{if(j){if(g==="project"&&R!==!0){v.warning(s("templates.saveModal.waitCheck"));return}U(!0);try{const r=document.cookie.split("; ").find(a=>a.startsWith("guest_id="))?.split("=")[1]||`guest_${Date.now()}`,l=y.language.startsWith("zh")?"zh-CN":"en-US";if(g==="project"){const a=await C("/mainserver/api/json-schema/projects",{method:"POST",body:JSON.stringify({name:E||j.name,description:j.description,templateId:j.id,userId:r,language:l})});if(!a.ok){const D=await a.json();throw new Error(D.error||D.message||s("templates.saveModal.createFailed"))}const o=await a.json(),f=o.data||o.project;T(!1);const d=ce(f.slug);d?window.location.href=d:i(`/json-builder/${f.id}`)}else{if(!k){v.warning(s("templates.saveModal.selectTargetProject")),U(!1);return}const a=`/${j.id}-${Date.now()}`,o=Y||j.name,f=await C(`/mainserver/api/json-schema/projects/${k}/pages`,{method:"POST",body:JSON.stringify({path:a,title:o,templateId:j.id,language:l})});if(!f.ok){const L=await f.json();throw new Error(L.error||L.message||s("templates.saveModal.createPageFailed"))}const d=await f.json(),D=d.data||d.page;T(!1);const Te=X.find(L=>L.id===k),le=ce(Te?.slug);le?window.location.href=le:i(`/json-builder/${k}?page=${D.id}`)}}catch(t){console.error("Save failed:",t),v.error(t instanceof Error?t.message:s("templates.saveModal.saveFailed"))}finally{U(!1),j?.source==="community"&&C(`/mainserver/api/json-schema/user-templates/${j.id}/use`,{method:"POST",body:JSON.stringify({creditCost:2e4})}).catch(()=>{})}}};return e.jsxs("div",{className:"h-full w-full bg-slate-50 overflow-auto",children:[e.jsx("div",{className:"border-b border-slate-200 bg-white",children:e.jsxs("div",{className:"max-w-7xl mx-auto px-6 py-10",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("div",{className:"p-2.5 rounded-xl bg-purple-100 text-purple-600",children:e.jsx(ne,{className:"w-7 h-7"})}),e.jsx("h1",{className:"text-3xl font-bold text-slate-900",children:s("templates.title")})]}),e.jsx("p",{className:"text-slate-500 text-lg max-w-2xl",children:s("templates.subtitle")}),e.jsxs("div",{className:"mt-5 rounded-xl border border-indigo-200 bg-gradient-to-r from-indigo-50 to-amber-50 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"text-lg"}),e.jsx("p",{className:"text-sm font-semibold text-slate-900",children:s("templates.creatorGrowthTitle","创作者增长计划")})]}),e.jsxs("p",{className:"text-sm text-slate-700",children:[e.jsx("span",{className:"font-medium",children:s("templates.creatorIncentiveEntry","创作者激励计划")}),e.jsx("span",{className:"mx-1.5 text-slate-400",children:"·"}),e.jsx("span",{children:s("templates.creatorIncentiveDesc","发布优质作品,参与官方活动,长期有效")})]}),e.jsxs("p",{className:"text-sm text-slate-700 mt-1",children:[e.jsx("span",{className:"font-medium",children:s("templates.revenueTip","创作者分佣计划")}),e.jsx("span",{className:"mx-1.5 text-slate-400",children:"·"}),e.jsx("span",{children:s("templates.revenueDetail","用户通过你的模板消耗的积分,5% 将作为分佣奖励给你")})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsx("button",{onClick:()=>i("/creator-incentive"),className:"inline-flex items-center gap-2 px-3.5 py-2 rounded-lg bg-indigo-600 text-white text-sm font-medium hover:bg-indigo-700 transition-colors",children:s("templates.goIncentive","去创作者激励")}),e.jsx("button",{onClick:()=>i("/referral"),className:"inline-flex items-center gap-2 px-3.5 py-2 rounded-lg bg-amber-500 text-white text-sm font-medium hover:bg-amber-600 transition-colors",children:s("templates.goRevenue","去邀请分佣")})]})]})]})}),e.jsxs("div",{className:"max-w-7xl mx-auto px-6 py-8",children:[e.jsx("div",{className:"mb-8",children:e.jsxs("div",{className:"relative max-w-lg",children:[e.jsx(pe,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-slate-400"}),e.jsx("input",{ref:Z,type:"text",placeholder:s("templates.search"),value:I,onChange:t=>A(t.target.value),className:"w-full pl-10 pr-4 py-3 bg-white border border-slate-200 rounded-xl text-slate-900 placeholder-slate-400 focus:outline-none focus:border-purple-500 focus:ring-2 focus:ring-purple-500/20"})]})}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-8 pb-6 border-b border-slate-200",children:xe.map(t=>{const r=t.icon;return e.jsxs("button",{onClick:()=>ge(t.id),className:w("px-4 py-2 rounded-full flex items-center gap-2 text-sm font-medium transition-all",S===t.id?"bg-purple-600 text-white shadow-md shadow-purple-200":"bg-white text-slate-600 border border-slate-200 hover:bg-slate-50 hover:border-slate-300"),children:[e.jsx(r,{className:"w-4 h-4"}),t.name]},t.id)})}),e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("p",{className:"text-slate-500 text-sm",children:s("templates.total",{count:q.length})}),e.jsx("div",{className:"flex gap-1.5",children:["popular","newest","stars"].map(t=>e.jsx("button",{onClick:()=>be(t),className:w("px-3 py-1.5 rounded-lg text-xs font-medium transition-colors",z===t?"bg-purple-100 text-purple-700 border border-purple-200":"bg-white text-slate-500 border border-slate-200 hover:bg-slate-50"),children:s(t==="popular"?"templates.sortPopular":t==="newest"?"templates.sortNewest":"templates.sortStars")},t))})]}),he?e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(F,{className:"w-8 h-8 text-purple-500 animate-spin"})}):q.length===0?e.jsxs("div",{className:"text-center py-20",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-slate-100 flex items-center justify-center",children:e.jsx(pe,{className:"w-8 h-8 text-slate-400"})}),e.jsx("p",{className:"text-slate-600 text-lg",children:s("templates.noResults")}),e.jsx("p",{className:"text-slate-400 mt-2",children:s("templates.noResultsHint")})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:q.map(t=>e.jsxs("div",{className:"relative group",children:[e.jsx(_e,{template:t,onUse:re,onPreview:_,featured:t.featured}),t.source==="community"&&e.jsxs("div",{className:"absolute top-3 right-3 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity z-10",children:[e.jsx("button",{onClick:r=>{r.stopPropagation(),Se(t.id)},className:"p-1.5 rounded-full bg-white/90 shadow-sm hover:bg-rose-50 transition-colors",title:s("templates.like","点赞"),children:e.jsx(Ge,{className:"w-3.5 h-3.5 text-rose-400"})}),e.jsx("button",{onClick:r=>{r.stopPropagation(),ke(t.id)},className:"p-1.5 rounded-full bg-white/90 shadow-sm hover:bg-yellow-50 transition-colors",title:s("templates.report","举报"),children:e.jsx(Ve,{className:"w-3.5 h-3.5 text-yellow-500"})})]})]},t.id))})]}),h&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-white rounded-2xl w-full max-w-4xl h-[90vh] border border-slate-200 shadow-2xl flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-100 shrink-0 gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-100 flex items-center justify-center text-xl shrink-0",children:(h.category==="multi-agent"||h.category==="workflow"||h.category==="roleplay"||h.category==="image","")}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"text-lg font-semibold text-slate-900 truncate",children:h.name}),e.jsx("p",{className:"text-sm text-slate-500 truncate",children:h.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("button",{onClick:()=>{i(`/community/t/${encodeURIComponent(h.id)}`),$(null)},className:"px-3 sm:px-4 py-2 border border-violet-200 text-violet-700 rounded-lg font-medium flex items-center gap-1.5 hover:bg-violet-50 transition-colors whitespace-nowrap shrink-0 text-sm",children:s("communityHub.discuss")}),e.jsxs("button",{onClick:()=>{re(h),$(null)},className:"px-3 sm:px-4 py-2 bg-purple-600 text-white rounded-lg font-medium flex items-center gap-1.5 sm:gap-2 hover:bg-purple-700 transition-colors whitespace-nowrap shrink-0 text-sm sm:text-base",children:[e.jsx(Je,{className:"w-4 h-4 shrink-0"}),s("templates.useTemplate")]}),e.jsx("button",{onClick:()=>$(null),className:"p-2 hover:bg-slate-100 rounded-lg transition-colors shrink-0",children:e.jsx(ie,{className:"w-5 h-5 text-slate-500"})})]})]}),b?.pages&&b.pages.length>1&&e.jsx("div",{className:"flex items-center gap-1 px-4 py-2 border-b border-slate-100 bg-slate-50/50 overflow-x-auto",children:b.pages.map((t,r)=>e.jsx("button",{onClick:()=>{V(r);const l=b.pages[r];O(a=>a&&{...a,sections:l.config?.sections||[],theme:l.config?.theme||a.theme,stylePreset:l.config?.stylePreset||a.stylePreset})},className:`px-3 py-1.5 text-xs font-medium rounded-full whitespace-nowrap transition-all ${je===r?"bg-purple-100 text-purple-700 shadow-sm ring-1 ring-purple-200/60":"text-slate-400 hover:text-slate-600 hover:bg-slate-100"}`,children:t.title||t.path},t.path))}),e.jsx("div",{className:"flex-1 overflow-auto bg-white",children:fe?e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx(F,{className:"w-8 h-8 animate-spin text-purple-500"})}):b&&b.sections.length>0?e.jsx(Be,{theme:b.theme,preset:b.stylePreset,children:e.jsx("div",{className:"pointer-events-none template-preview-compact",children:b.sections.map(t=>{if(st.has(t.type)){const l=de(t.type),a=e.jsxs("div",{className:"p-12 bg-gradient-to-br from-purple-50 to-indigo-50 text-center rounded-xl border border-purple-100",children:[e.jsx("div",{className:"text-4xl mb-3"}),e.jsx("p",{className:"text-sm font-medium text-purple-700",children:t.props?.title||"Workflow"}),e.jsx("p",{className:"text-xs text-purple-500/70 mt-1",children:"工作流预览加载失败 — 使用模板后可体验完整功能"})]});return e.jsx(at,{fallback:a,children:e.jsx(n.Suspense,{fallback:e.jsx(me,{type:t.type}),children:e.jsx(l,{...t.props||{},previewMode:!0})})},t.id)}if(ue.has(t.type))return e.jsxs("div",{className:"p-12 bg-gradient-to-br from-purple-50 to-indigo-50 text-center rounded-xl border border-purple-100",children:[e.jsx("div",{className:"text-4xl mb-3"}),e.jsx("p",{className:"text-sm font-medium text-purple-700",children:t.props?.title||t.type}),e.jsx("p",{className:"text-xs text-purple-500/70 mt-1",children:t.props?.subt
6itle||"交互式组件 — 使用模板后可体验完整功能"})]},t.id);const r=de(t.type);return e.jsx(n.Suspense,{fallback:e.jsx(me,{type:t.type}),children:e.jsx(r,{...t.props||{}})},t.id)})})}):e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-slate-400",children:[e.jsx(ne,{className:"w-12 h-12 mb-3 opacity-50"}),e.jsx("p",{children:s("templates.noPreview")})]})}),e.jsx("div",{className:"p-3 border-t border-slate-100 bg-white shrink-0",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex flex-wrap gap-2",children:h.tags.map(t=>e.jsx("span",{className:"px-2 py-1 bg-slate-100 text-slate-600 rounded text-xs",children:t},t))}),e.jsxs("div",{className:"flex gap-4 text-xs text-slate-500",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ye,{className:"w-3 h-3 text-amber-500"}),h.stars]}),e.jsxs("span",{children:[h.downloads.toLocaleString()," ",s("templates.uses")]})]})]})})]})}),G&&j&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-white rounded-2xl w-full max-w-lg border border-slate-200 shadow-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-slate-100",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-xl font-semibold text-slate-900",children:s("templates.saveModal.title")}),e.jsx("p",{className:"text-slate-500 text-sm mt-1",children:j.name})]}),e.jsx("button",{onClick:()=>T(!1),className:"p-2 hover:bg-slate-100 rounded-lg transition-colors",children:e.jsx(ie,{className:"w-5 h-5 text-slate-400"})})]}),e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("button",{onClick:()=>W("project"),className:w("p-4 rounded-xl border-2 transition-all text-left",g==="project"?"border-purple-500 bg-purple-50":"border-slate-200 hover:border-slate-300"),children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:w("p-2 rounded-lg",g==="project"?"bg-purple-100 text-purple-600":"bg-slate-100 text-slate-500"),children:e.jsx(Fe,{className:"w-5 h-5"})}),e.jsx("span",{className:w("font-medium",g==="project"?"text-slate-900":"text-slate-700"),children:s("templates.saveModal.createProject")})]}),e.jsx("p",{className:"text-slate-500 text-sm",children:s("templates.saveModal.createProjectDesc")})]}),e.jsxs("button",{onClick:()=>W("page"),className:w("p-4 rounded-xl border-2 transition-all text-left",g==="page"?"border-purple-500 bg-purple-50":"border-slate-200 hover:border-slate-300"),children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:w("p-2 rounded-lg",g==="page"?"bg-purple-100 text-purple-600":"bg-slate-100 text-slate-500"),children:e.jsx(Ke,{className:"w-5 h-5"})}),e.jsx("span",{className:w("font-medium",g==="page"?"text-slate-900":"text-slate-700"),children:s("templates.saveModal.addToProject")})]}),e.jsx("p",{className:"text-slate-500 text-sm",children:s("templates.saveModal.addToProjectDesc")})]})]}),g==="project"?e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-700 mb-2",children:s("templates.saveModal.projectName")}),e.jsx("input",{type:"text",value:E,onChange:t=>J(t.target.value.replace(/\s+/g,"")),placeholder:s("templates.saveModal.projectNamePlaceholder"),className:"w-full px-4 py-3 bg-slate-50 border border-slate-200 rounded-xl text-slate-900 placeholder-slate-400 focus:outline-none focus:border-purple-500 focus:ring-2 focus:ring-purple-500/20"}),te&&e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx(Oe,{size:14,className:"text-slate-400"}),e.jsx("span",{className:"text-sm text-slate-500",children:s("templates.saveModal.visitUrl")}),e.jsx("span",{className:"text-sm font-mono text-slate-700",children:te}),ee?e.jsx(F,{size:14,className:"animate-spin text-slate-400"}):R===!0?e.jsxs("span",{className:"flex items-center gap-1 text-xs text-green-600",children:[e.jsx(ze,{size:12}),s("templates.saveModal.available")]}):R===!1?e.jsxs("span",{className:"flex items-center gap-1 text-xs text-red-500",children:[e.jsx(Qe,{size:12}),Pe||s("templates.saveModal.unavailable")]}):null]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-700 mb-2",children:s("templates.saveModal.selectProject")}),e.jsxs("select",{value:k,onChange:t=>we(t.target.value),className:"w-full px-4 py-3 bg-slate-50 border border-slate-200 rounded-xl text-slate-900 focus:outline-none focus:border-purple-500 focus:ring-2 focus:ring-purple-500/20",children:[e.jsx("option",{value:"",children:s("templates.saveModal.selectProjectPlaceholder")}),X.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-700 mb-2",children:s("templates.saveModal.pageName")}
6),e.jsx("input",{type:"text",value:Y,onChange:t=>Q(t.target.value),placeholder:s("templates.saveModal.pageNamePlaceholder"),className:"w-full px-4 py-3 bg-slate-50 border border-slate-200 rounded-xl text-slate-900 placeholder-slate-400 focus:outline-none focus:border-purple-500 focus:ring-2 focus:ring-purple-500/20"})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 p-6 border-t border-slate-100",children:[e.jsx("button",{onClick:()=>T(!1),className:"px-5 py-2.5 rounded-lg text-slate-600 hover:text-slate-900 hover:bg-slate-100 transition-colors",children:s("templates.saveModal.cancel")}),e.jsx("button",{onClick:Ce,disabled:K||g==="project"&&(!E.trim()||R!==!0||ee)||g==="page"&&!k,className:"px-5 py-2.5 rounded-lg bg-purple-600 text-white font-medium hover:bg-purple-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:K?e.jsxs(e.Fragment,{children:[e.jsx(F,{className:"w-4 h-4 animate-spin"}),s("templates.saveModal.saving")]}):e.jsxs(e.Fragment,{children:[e.jsx(He,{className:"w-4 h-4"}),s("templates.saveModal.confirm")]})})]})]})})]})};export{At as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.