limixbot 0.3.155 → 0.3.156
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ActivityPanel-Dqbr10Z_.js → ActivityPanel-CIcegi4I.js} +1 -1
- package/dist/assets/{App-uoPBLmmn.js → App-pmVj8PQL.js} +113 -113
- package/dist/assets/{AppEventEditor-CCe9Z0N8.js → AppEventEditor-BSbLHyIG.js} +1 -1
- package/dist/assets/{BotSettingsDialog-Cmba9cGz.js → BotSettingsDialog-DhwCcd_c.js} +1 -1
- package/dist/assets/{BrowserPanel-B6iHt39M.js → BrowserPanel-B9EG2hkL.js} +1 -1
- package/dist/assets/{BrowserProfilesManager-C9ezndzC.js → BrowserProfilesManager-7gXLhvdG.js} +1 -1
- package/dist/assets/{CloudAddDialog-CI5KrDAK.js → CloudAddDialog-DAU9zT0G.js} +1 -1
- package/dist/assets/{ComputerFilesPane-B6qvtesL.js → ComputerFilesPane-BdelYMDl.js} +1 -1
- package/dist/assets/{ComputerPanel-DKwvVKmU.js → ComputerPanel-CTkFIMhM.js} +2 -2
- package/dist/assets/{DataPanel-0N3mrCDA.js → DataPanel-ky6awqbd.js} +1 -1
- package/dist/assets/{GrokMoveDialog-DvpI_tPM.js → GrokMoveDialog-DY4cjKaR.js} +1 -1
- package/dist/assets/{InspectorPanel-DuTyfoo6.js → InspectorPanel-Cazbi0Jp.js} +1 -1
- package/dist/assets/{KeyboardShortcutsModal-BZ-uOLjK.js → KeyboardShortcutsModal-SrQRsFJo.js} +1 -1
- package/dist/assets/{KnowledgePanel-CJmLajJP.js → KnowledgePanel-DAMnMYRB.js} +1 -1
- package/dist/assets/{LiveDesktop-BzmpYGbu.js → LiveDesktop-BePBs19I.js} +1 -1
- package/dist/assets/{LocalVmWorkspace-Dyaqp6Wt.js → LocalVmWorkspace-Bs-XTnWt.js} +1 -1
- package/dist/assets/{MacLocalControl-BvlKsh2Q.js → MacLocalControl-BAlrVtJ-.js} +1 -1
- package/dist/assets/{MarkdownFilePreview-qeZ4oP4K.js → MarkdownFilePreview-BYQJ5P1w.js} +1 -1
- package/dist/assets/{NewBotDialog-DhzR6nNq.js → NewBotDialog-C8YP9t-F.js} +1 -1
- package/dist/assets/{PhoneAppDialog-Dp2tWPuC.js → PhoneAppDialog-T8CFYCke.js} +1 -1
- package/dist/assets/{PluginsPanel-DNvYcp9p.js → PluginsPanel-DDa7rnvd.js} +1 -1
- package/dist/assets/{ProIntroduction-BfQjUPyg.js → ProIntroduction-Cax5R1NX.js} +1 -1
- package/dist/assets/{RemoteAgentSettingsPanel-ae-Sl0mj.js → RemoteAgentSettingsPanel-BdehVPmO.js} +1 -1
- package/dist/assets/{RoomPanel-Culuj3c3.js → RoomPanel-Y1iUyFr5.js} +1 -1
- package/dist/assets/{RoutinesPage-LLBkjCgH.js → RoutinesPage-BeXp1F4M.js} +1 -1
- package/dist/assets/{SettingsModal-BP6ZRuvi.js → SettingsModal-DTh6QsEq.js} +1 -1
- package/dist/assets/{ShareTeamDialog-bcaYH8Fa.js → ShareTeamDialog-b2XiPOFK.js} +1 -1
- package/dist/assets/{SignedInSites-Cw-z2pHg.js → SignedInSites-SH5MXRbv.js} +1 -1
- package/dist/assets/{TeamLibraryPanel-DaFRiK5K.js → TeamLibraryPanel-DQh29ree.js} +1 -1
- package/dist/assets/{TeamMapPage-DdZPHt-V.js → TeamMapPage-C6gpnCZ7.js} +1 -1
- package/dist/assets/{TriggersPage-Bn-bFPJr.js → TriggersPage-wVB0oSPu.js} +1 -1
- package/dist/assets/{VisibilitySection-CaWfmXSj.js → VisibilitySection-kafl4usf.js} +1 -1
- package/dist/assets/{WebhookTrigger-8ol0waxh.js → WebhookTrigger-hbUwoDRU.js} +1 -1
- package/dist/assets/{WorksOnGrid-BQaOGo2O.js → WorksOnGrid-BNKjJjzY.js} +1 -1
- package/dist/assets/{core-Con7kH_C.js → core-BS_6LQwX.js} +1 -1
- package/dist/assets/{import-name-a8ENd5Mj.js → import-name-M5bCwQjb.js} +1 -1
- package/dist/assets/{index-0Js8mqlU.js → index-1ZCeupvI.js} +1 -1
- package/dist/assets/{index-uM78wvX0.js → index-fLYBrnZ7.js} +2 -2
- package/dist/assets/{new-bot-DsFULuKY.js → new-bot-As3gyL6X.js} +1 -1
- package/dist/assets/{org-library-BP5jkVsQ.js → org-library-D5s2ZatJ.js} +1 -1
- package/dist/assets/{package-format-CX-_DYU-.js → package-format-FQGWcyJL.js} +1 -1
- package/dist/assets/{remote-desktop-panel-BhCQ6ldP.js → remote-desktop-panel-Tv4VMSFH.js} +1 -1
- package/dist/index.html +1 -1
- package/dist-server/package.json +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,t as a,b as ne,j as e,X as le,d as ce}from"./styles-C4OYlVF_.js";import{r as ie,L as K}from"./PlacesRail-DbAKPGkj.js";import{S as B,a as de,p as J,r as oe,s as V,b as me,c as xe,t as pe,n as ue,d as he,e as fe,f as ge}from"./team-share-U-ZV6moM.js";import{u as Se,j as I,D as be}from"./App-uoPBLmmn.js";import"./monitor-Cif4agWy.js";import"./index-uM78wvX0.js";import"./MenuMotion-DZa0_5mG.js";function G({preview:l,includeMemory:x,localSkips:b}){const i=l.document.package,c=l.summary.counts,L=i.team?.leader?i.agents.find(s=>s.key===i.team?.leader)?.name:void 0,j=i.agents.filter(s=>s.appearance.avatar).length,T=i.agents.reduce((s,p)=>s+Object.keys(p.seed?.memory??{}).length,0),k=[[a("teamShare.part.bots"),`${c.bots} · ${l.summary.botNames.join(", ")}`],[a("teamShare.part.skills"),String(c.skills)],[a("teamShare.part.playbooks"),String(c.playbooks)],[a("teamShare.part.rooms"),String(c.rooms)],[a("teamShare.part.routines"),String(c.routines)],[a("teamShare.part.brief"),i.team?.brief?a("teamShare.yes"):a("teamShare.none")],[a("teamShare.part.leader"),L??a("teamShare.none")],[a("teamShare.part.connections"),String(c.connections)],[a("teamShare.part.pictures"),String(j)],[a("teamShare.part.notes"),x?String(T):a("teamShare.none")],...c.presets?[[a("teamShare.part.presets"),`${c.presets} · ${l.summary.presetNames.join(", ")}`]]:[]],C=[...b,...l.skipped.map(s=>he(s,l.document))];return e.jsxs("div",{children:[e.jsx("div",{className:"text-[12px] font-medium text-ink-secondary",children:a("teamShare.included")}),e.jsx("dl",{className:"mt-2 grid grid-cols-[minmax(0,1fr)_auto] gap-x-4 gap-y-1.5 rounded-xl bg-raised/45 px-4 py-3 text-[13px]",children:k.map(([s,p])=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"text-ink-secondary",children:s}),e.jsx("dd",{className:"max-w-[260px] truncate text-right text-ink",title:p,children:p})]},s))}),i.connections?.length?e.jsxs("div",{className:"mt-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:a("teamShare.addresses")}),e.jsx("ul",{className:"mt-1 space-y-0.5",children:i.connections.map(s=>e.jsxs("li",{className:"break-all",children:[e.jsx("span",{className:"text-ink",children:s.label})," · ",s.mcp.url]},s.key))})]}):null,e.jsxs("p",{className:"mt-3 flex items-start gap-2 text-[13px] leading-relaxed text-ink-secondary",children:[e.jsx(be,{size:15,className:"mt-0.5 shrink-0 text-success"}),e.jsx("span",{children:a("teamShare.never")})]}),l.redacted.length>0&&e.jsxs("div",{className:"mt-3 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:a("teamShare.redacted")}),e.jsx("ul",{className:"mt-1 list-disc pl-5",children:l.redacted.map(s=>e.jsx("li",{children:fe(s,l.document)},s))})]}),C.length>0&&e.jsxs("div",{className:"mt-3 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:a("teamShare.skipped")}),e.jsx("ul",{className:"mt-1 list-disc pl-5",children:C.map((s,p)=>e.jsx("li",{children:s},`${s}-${p}`))})]})]})}function je({available:l,ticked:x,counted:b,onToggle:i}){return e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:a("teamShare.includeSkills")}),b&&l.length===0&&e.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:a("teamShare.noSkills")}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-x-4 gap-y-1",children:l.map(c=>e.jsxs("label",{className:"flex items-center gap-1.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"size-3.5 accent-accent",checked:x.has(c),onChange:()=>i(c)}),c]},c))})]})}function Pe({team:l,onClose:x}){const{state:b}=Se(),i=r.useRef(null),c=r.useMemo(()=>b.bots.filter(t=>!t.hidden&&(t.section?.trim()??"")===l),[b.bots,l]),L=r.useMemo(()=>new Map(c.map(t=>[t.id,t.name])),[c]),[j,T]=r.useState(l||a("teamLibrary.general")),[k,C]=r.useState(""),[s,p]=r.useState(""),[z,M]=r.useState(""),[D,W]=r.useState(""),[h,X]=r.useState(B.includePictures),[f,Q]=r.useState(B.includeMemory),[u,Y]=r.useState(!1),[g,H]=r.useState(null),[y,Z]=r.useState(null),[S,O]=r.useState(null),[ee,E]=r.useState(de),{preview:R,available:N,included:te,error:$}=ee,U=t=>E(n=>({...n,error:t})),[d,_]=r.useState(!1),[P,ae]=r.useState(null),A=r.useRef(0);r.useEffect(()=>{let t=!1;return J(c).then(n=>{t||O({avatars:n.avatars,skipped:n.skipped.map(o=>`${L.get(o.botId)??o.botId} · ${a("teamShare.field.picture")} — ${ne(`teamShare.skip.${o.reason}`,o.reason)}`)})}).catch(()=>{t||O({avatars:{},skipped:[]})}),()=>{t=!0}},[]),r.useEffect(()=>{if(!u||g)return;let t=!1;return I("/api/bot-defaults").then(({defaults:n})=>J([{id:"defaults",avatarUrl:n.profile.avatarUrl,avatarCrop:n.profile.avatarCrop}])).then(n=>{t||H({dataUrl:n.avatars.defaults})}).catch(()=>{t||H({})}),()=>{t=!0}},[u,g]);const q=r.useCallback(t=>({team:l,name:j,tagline:k,summary:s,release:z,notes:D,skills:oe(y,N),includeMemory:f,...h&&S?{avatars:S.avatars}:{},...u?{includeDefaultsPreset:!0,...h&&g?.dataUrl?{presetAvatar:g.dataUrl}:{}}:{},dryRun:t}),[l,j,k,s,z,D,y,N,f,h,S,u,g]);r.useEffect(()=>{if(!S)return;if(u&&!g){E(m=>({...m,preview:null}));return}const t=++A.current,n=y===null,o=window.setTimeout(()=>{I("/api/teams/export",{method:"POST",body:JSON.stringify(V({...q(!0),release:void 0}))}).then(m=>{t===A.current&&(E(w=>me(w,m,n)),M(w=>w||m.document.package.release))}).catch(m=>{t===A.current&&E(w=>xe(w,m))})},250);return()=>window.clearTimeout(o)},[S,y,f,h,u,g]);const se=async()=>{if(!d){_(!0),U("");try{const t=await I("/api/teams/export",{method:"POST",body:JSON.stringify(V(q(!1)))});ge(t.filename,t.document),ae(t)}catch(t){U(t instanceof Error?t.message:String(t))}finally{_(!1)}}};r.useEffect(()=>{const t=document.activeElement instanceof HTMLElement?document.activeElement:null;return i.current?.focus(),()=>{t?.isConnected&&t.focus()}},[]);const F=pe(y,te,N),re=t=>{const n=new Set(F);n.has(t)?n.delete(t):n.add(t),Z(n)},v="mt-1 w-full rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[14px] text-ink disabled:opacity-60";return ie.createPortal(e.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/55 p-4",onMouseDown:t=>t.stopPropagation(),children:e.jsxs("div",{ref:i,role:"dialog","aria-modal":"true","aria-labelledby":"share-team-title",tabIndex:-1,className:"flex max-h-[90vh] w-full max-w-[620px] flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-panel text-ink shadow-2xl outline-none",onKeyDown:t=>{if(t.key==="Escape"&&!d&&(t.stopPropagation(),x()),t.key==="Tab"){const n=i.current?.querySelectorAll("input:enabled, textarea:enabled, button:enabled");if(!n?.length)return;const o=n[0],m=n[n.length-1];t.shiftKey&&document.activeElement===o?(t.preventDefault(),m.focus()):!t.shiftKey&&document.activeElement===m&&(t.preventDefault(),o.focus())}},children:[e.jsxs("header",{className:"flex items-start justify-between gap-3 px-6 pb-2 pt-5",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"share-team-title",className:"text-[17px] font-semibold",children:a("teamShare.title",{name:l||a("teamLibrary.general")})}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:a("teamShare.intro")})]}),e.jsx("button",{"aria-label":a("teamShare.close"),disabled:d,onClick:x,className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised",children:e.jsx(le,{size:18})})]}),P?e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-4 pt-2",children:[e.jsxs("p",{className:"flex items-center gap-2 text-[14px] font-medium text-ink",children:[e.jsx(ce,{size:16,className:"text-success"}),a("teamShare.saved",{filename:P.filename})]}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:a("teamShare.savedHint")}),e.jsx("div",{className:"mt-4",children:e.jsx(G,{preview:P,includeMemory:f,localSkips:h?S?.skipped??[]:[]})})]}):e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-4 pt-2",children:[R?e.jsx(G,{preview:R,includeMemory:f,localSkips:h?S?.skipped??[]:[]}):!$&&e.jsxs("div",{className:"flex items-center gap-2 py-6 text-[13px] text-ink-secondary",children:[e.jsx(K,{size:15,className:"animate-spin"}),a("teamShare.preparing")]}),e.jsxs("fieldset",{className:"mt-4 space-y-2 text-[13px]",disabled:d,children:[e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:h,onChange:t=>X(t.target.checked)}),a("teamShare.includePictures")]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:f,onChange:t=>Q(t.target.checked)}),a("teamShare.includeNotes")]}),e.jsx("p",{className:"pl-6 text-[12px] leading-relaxed text-ink-secondary",children:ue(f)}),e.jsx(je,{available:N??[],ticked:F,counted:N!==null,onToggle:re}),e.jsxs("label",{className:"flex items-center gap-2 pt-1",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:u,onChange:t=>Y(t.target.checked)}),a("teamShare.includePreset")]}),u&&e.jsx("p",{className:"pl-6 text-[12px] leading-relaxed text-ink-secondary",children:a("teamShare.presetHint")})]}),e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:[e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[a("teamShare.name"),e.jsx("input",{value:j,maxLength:100,disabled:d,onChange:t=>T(t.target.value),className:v})]}),e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[a("teamShare.release"),e.jsx("input",{value:z,maxLength:20,disabled:d,placeholder:"1.0.0",onChange:t=>M(t.target.value),className:v})]})]}),e.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:a("teamShare.releaseHint")}),e.jsxs("label",{className:"mt-3 block text-[13px] text-ink-secondary",children:[a("teamShare.notes"),e.jsx("textarea",{value:D,maxLength:4e3,rows:2,disabled:d,onChange:t=>W(t.target.value),className:v})]}),e.jsxs("label",{className:"mt-3 block text-[13px] text-ink-secondary",children:[a("teamShare.tagline"),e.jsx("input",{value:k,maxLength:160,disabled:d,onChange:t=>C(t.target.value),className:v})]}),e.jsxs("label",{className:"mt-3 block text-[13px] text-ink-secondary",children:[a("teamShare.summary"),e.jsx("textarea",{value:s,maxLength:2e3,rows:2,disabled:d,onChange:t=>p(t.target.value),className:v})]})]}),$&&e.jsx("p",{role:"alert",className:"mx-6 mb-2 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:$}),e.jsx("footer",{className:"flex justify-end gap-2 border-t border-hairline/35 px-6 py-3",children:P?e.jsx("button",{onClick:x,className:"rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white",children:a("teamShare.done")}):e.jsxs(e.Fragment,{children:[e.jsx("button",{disabled:d,onClick:x,className:"rounded-lg px-3 py-2 text-[13px] text-ink-secondary hover:bg-raised",children:a("common.cancel")}),e.jsxs("button",{disabled:d||!R||!j.trim(),onClick:()=>{se()},className:"flex items-center gap-2 rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white disabled:opacity-40",children:[d&&e.jsx(K,{size:14,className:"animate-spin"}),d?a("teamShare.saving"):a("teamShare.save")]})]})})]})}),document.body)}export{je as ShareSkillChoices,G as ShareTeamContents,Pe as ShareTeamDialog};
|
|
1
|
+
import{r,t as a,b as ne,j as e,X as le,d as ce}from"./styles-C4OYlVF_.js";import{r as ie,L as K}from"./PlacesRail-DbAKPGkj.js";import{S as B,a as de,p as J,r as oe,s as V,b as me,c as xe,t as pe,n as ue,d as he,e as fe,f as ge}from"./team-share-U-ZV6moM.js";import{u as Se,j as I,D as be}from"./App-pmVj8PQL.js";import"./monitor-Cif4agWy.js";import"./index-fLYBrnZ7.js";import"./MenuMotion-DZa0_5mG.js";function G({preview:l,includeMemory:x,localSkips:b}){const i=l.document.package,c=l.summary.counts,L=i.team?.leader?i.agents.find(s=>s.key===i.team?.leader)?.name:void 0,j=i.agents.filter(s=>s.appearance.avatar).length,T=i.agents.reduce((s,p)=>s+Object.keys(p.seed?.memory??{}).length,0),k=[[a("teamShare.part.bots"),`${c.bots} · ${l.summary.botNames.join(", ")}`],[a("teamShare.part.skills"),String(c.skills)],[a("teamShare.part.playbooks"),String(c.playbooks)],[a("teamShare.part.rooms"),String(c.rooms)],[a("teamShare.part.routines"),String(c.routines)],[a("teamShare.part.brief"),i.team?.brief?a("teamShare.yes"):a("teamShare.none")],[a("teamShare.part.leader"),L??a("teamShare.none")],[a("teamShare.part.connections"),String(c.connections)],[a("teamShare.part.pictures"),String(j)],[a("teamShare.part.notes"),x?String(T):a("teamShare.none")],...c.presets?[[a("teamShare.part.presets"),`${c.presets} · ${l.summary.presetNames.join(", ")}`]]:[]],C=[...b,...l.skipped.map(s=>he(s,l.document))];return e.jsxs("div",{children:[e.jsx("div",{className:"text-[12px] font-medium text-ink-secondary",children:a("teamShare.included")}),e.jsx("dl",{className:"mt-2 grid grid-cols-[minmax(0,1fr)_auto] gap-x-4 gap-y-1.5 rounded-xl bg-raised/45 px-4 py-3 text-[13px]",children:k.map(([s,p])=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"text-ink-secondary",children:s}),e.jsx("dd",{className:"max-w-[260px] truncate text-right text-ink",title:p,children:p})]},s))}),i.connections?.length?e.jsxs("div",{className:"mt-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:a("teamShare.addresses")}),e.jsx("ul",{className:"mt-1 space-y-0.5",children:i.connections.map(s=>e.jsxs("li",{className:"break-all",children:[e.jsx("span",{className:"text-ink",children:s.label})," · ",s.mcp.url]},s.key))})]}):null,e.jsxs("p",{className:"mt-3 flex items-start gap-2 text-[13px] leading-relaxed text-ink-secondary",children:[e.jsx(be,{size:15,className:"mt-0.5 shrink-0 text-success"}),e.jsx("span",{children:a("teamShare.never")})]}),l.redacted.length>0&&e.jsxs("div",{className:"mt-3 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:a("teamShare.redacted")}),e.jsx("ul",{className:"mt-1 list-disc pl-5",children:l.redacted.map(s=>e.jsx("li",{children:fe(s,l.document)},s))})]}),C.length>0&&e.jsxs("div",{className:"mt-3 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:a("teamShare.skipped")}),e.jsx("ul",{className:"mt-1 list-disc pl-5",children:C.map((s,p)=>e.jsx("li",{children:s},`${s}-${p}`))})]})]})}function je({available:l,ticked:x,counted:b,onToggle:i}){return e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:a("teamShare.includeSkills")}),b&&l.length===0&&e.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:a("teamShare.noSkills")}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-x-4 gap-y-1",children:l.map(c=>e.jsxs("label",{className:"flex items-center gap-1.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"size-3.5 accent-accent",checked:x.has(c),onChange:()=>i(c)}),c]},c))})]})}function Pe({team:l,onClose:x}){const{state:b}=Se(),i=r.useRef(null),c=r.useMemo(()=>b.bots.filter(t=>!t.hidden&&(t.section?.trim()??"")===l),[b.bots,l]),L=r.useMemo(()=>new Map(c.map(t=>[t.id,t.name])),[c]),[j,T]=r.useState(l||a("teamLibrary.general")),[k,C]=r.useState(""),[s,p]=r.useState(""),[z,M]=r.useState(""),[D,W]=r.useState(""),[h,X]=r.useState(B.includePictures),[f,Q]=r.useState(B.includeMemory),[u,Y]=r.useState(!1),[g,H]=r.useState(null),[y,Z]=r.useState(null),[S,O]=r.useState(null),[ee,E]=r.useState(de),{preview:R,available:N,included:te,error:$}=ee,U=t=>E(n=>({...n,error:t})),[d,_]=r.useState(!1),[P,ae]=r.useState(null),A=r.useRef(0);r.useEffect(()=>{let t=!1;return J(c).then(n=>{t||O({avatars:n.avatars,skipped:n.skipped.map(o=>`${L.get(o.botId)??o.botId} · ${a("teamShare.field.picture")} — ${ne(`teamShare.skip.${o.reason}`,o.reason)}`)})}).catch(()=>{t||O({avatars:{},skipped:[]})}),()=>{t=!0}},[]),r.useEffect(()=>{if(!u||g)return;let t=!1;return I("/api/bot-defaults").then(({defaults:n})=>J([{id:"defaults",avatarUrl:n.profile.avatarUrl,avatarCrop:n.profile.avatarCrop}])).then(n=>{t||H({dataUrl:n.avatars.defaults})}).catch(()=>{t||H({})}),()=>{t=!0}},[u,g]);const q=r.useCallback(t=>({team:l,name:j,tagline:k,summary:s,release:z,notes:D,skills:oe(y,N),includeMemory:f,...h&&S?{avatars:S.avatars}:{},...u?{includeDefaultsPreset:!0,...h&&g?.dataUrl?{presetAvatar:g.dataUrl}:{}}:{},dryRun:t}),[l,j,k,s,z,D,y,N,f,h,S,u,g]);r.useEffect(()=>{if(!S)return;if(u&&!g){E(m=>({...m,preview:null}));return}const t=++A.current,n=y===null,o=window.setTimeout(()=>{I("/api/teams/export",{method:"POST",body:JSON.stringify(V({...q(!0),release:void 0}))}).then(m=>{t===A.current&&(E(w=>me(w,m,n)),M(w=>w||m.document.package.release))}).catch(m=>{t===A.current&&E(w=>xe(w,m))})},250);return()=>window.clearTimeout(o)},[S,y,f,h,u,g]);const se=async()=>{if(!d){_(!0),U("");try{const t=await I("/api/teams/export",{method:"POST",body:JSON.stringify(V(q(!1)))});ge(t.filename,t.document),ae(t)}catch(t){U(t instanceof Error?t.message:String(t))}finally{_(!1)}}};r.useEffect(()=>{const t=document.activeElement instanceof HTMLElement?document.activeElement:null;return i.current?.focus(),()=>{t?.isConnected&&t.focus()}},[]);const F=pe(y,te,N),re=t=>{const n=new Set(F);n.has(t)?n.delete(t):n.add(t),Z(n)},v="mt-1 w-full rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[14px] text-ink disabled:opacity-60";return ie.createPortal(e.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/55 p-4",onMouseDown:t=>t.stopPropagation(),children:e.jsxs("div",{ref:i,role:"dialog","aria-modal":"true","aria-labelledby":"share-team-title",tabIndex:-1,className:"flex max-h-[90vh] w-full max-w-[620px] flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-panel text-ink shadow-2xl outline-none",onKeyDown:t=>{if(t.key==="Escape"&&!d&&(t.stopPropagation(),x()),t.key==="Tab"){const n=i.current?.querySelectorAll("input:enabled, textarea:enabled, button:enabled");if(!n?.length)return;const o=n[0],m=n[n.length-1];t.shiftKey&&document.activeElement===o?(t.preventDefault(),m.focus()):!t.shiftKey&&document.activeElement===m&&(t.preventDefault(),o.focus())}},children:[e.jsxs("header",{className:"flex items-start justify-between gap-3 px-6 pb-2 pt-5",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"share-team-title",className:"text-[17px] font-semibold",children:a("teamShare.title",{name:l||a("teamLibrary.general")})}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:a("teamShare.intro")})]}),e.jsx("button",{"aria-label":a("teamShare.close"),disabled:d,onClick:x,className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised",children:e.jsx(le,{size:18})})]}),P?e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-4 pt-2",children:[e.jsxs("p",{className:"flex items-center gap-2 text-[14px] font-medium text-ink",children:[e.jsx(ce,{size:16,className:"text-success"}),a("teamShare.saved",{filename:P.filename})]}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:a("teamShare.savedHint")}),e.jsx("div",{className:"mt-4",children:e.jsx(G,{preview:P,includeMemory:f,localSkips:h?S?.skipped??[]:[]})})]}):e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-4 pt-2",children:[R?e.jsx(G,{preview:R,includeMemory:f,localSkips:h?S?.skipped??[]:[]}):!$&&e.jsxs("div",{className:"flex items-center gap-2 py-6 text-[13px] text-ink-secondary",children:[e.jsx(K,{size:15,className:"animate-spin"}),a("teamShare.preparing")]}),e.jsxs("fieldset",{className:"mt-4 space-y-2 text-[13px]",disabled:d,children:[e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:h,onChange:t=>X(t.target.checked)}),a("teamShare.includePictures")]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:f,onChange:t=>Q(t.target.checked)}),a("teamShare.includeNotes")]}),e.jsx("p",{className:"pl-6 text-[12px] leading-relaxed text-ink-secondary",children:ue(f)}),e.jsx(je,{available:N??[],ticked:F,counted:N!==null,onToggle:re}),e.jsxs("label",{className:"flex items-center gap-2 pt-1",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:u,onChange:t=>Y(t.target.checked)}),a("teamShare.includePreset")]}),u&&e.jsx("p",{className:"pl-6 text-[12px] leading-relaxed text-ink-secondary",children:a("teamShare.presetHint")})]}),e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:[e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[a("teamShare.name"),e.jsx("input",{value:j,maxLength:100,disabled:d,onChange:t=>T(t.target.value),className:v})]}),e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[a("teamShare.release"),e.jsx("input",{value:z,maxLength:20,disabled:d,placeholder:"1.0.0",onChange:t=>M(t.target.value),className:v})]})]}),e.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:a("teamShare.releaseHint")}),e.jsxs("label",{className:"mt-3 block text-[13px] text-ink-secondary",children:[a("teamShare.notes"),e.jsx("textarea",{value:D,maxLength:4e3,rows:2,disabled:d,onChange:t=>W(t.target.value),className:v})]}),e.jsxs("label",{className:"mt-3 block text-[13px] text-ink-secondary",children:[a("teamShare.tagline"),e.jsx("input",{value:k,maxLength:160,disabled:d,onChange:t=>C(t.target.value),className:v})]}),e.jsxs("label",{className:"mt-3 block text-[13px] text-ink-secondary",children:[a("teamShare.summary"),e.jsx("textarea",{value:s,maxLength:2e3,rows:2,disabled:d,onChange:t=>p(t.target.value),className:v})]})]}),$&&e.jsx("p",{role:"alert",className:"mx-6 mb-2 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:$}),e.jsx("footer",{className:"flex justify-end gap-2 border-t border-hairline/35 px-6 py-3",children:P?e.jsx("button",{onClick:x,className:"rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white",children:a("teamShare.done")}):e.jsxs(e.Fragment,{children:[e.jsx("button",{disabled:d,onClick:x,className:"rounded-lg px-3 py-2 text-[13px] text-ink-secondary hover:bg-raised",children:a("common.cancel")}),e.jsxs("button",{disabled:d||!R||!j.trim(),onClick:()=>{se()},className:"flex items-center gap-2 rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white disabled:opacity-40",children:[d&&e.jsx(K,{size:14,className:"animate-spin"}),d?a("teamShare.saving"):a("teamShare.save")]})]})})]})}),document.body)}export{je as ShareSkillChoices,G as ShareTeamContents,Pe as ShareTeamDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,j as s,t}from"./styles-C4OYlVF_.js";import{j as b}from"./App-
|
|
1
|
+
import{r,j as s,t}from"./styles-C4OYlVF_.js";import{j as b}from"./App-pmVj8PQL.js";import{a as k}from"./PlacesRail-DbAKPGkj.js";function E({target:i,scope:a={},sharedBy:x,disabled:N=!1,bare:l=!1}){const[n,S]=r.useState(null),[o,m]=r.useState(!1),[c,u]=r.useState(""),p=async e=>{m(!0),u("");try{S((await e()).sites)}catch(d){u(d instanceof Error&&d.message?d.message:t("settings.sites.error"))}finally{m(!1)}},g=()=>p(()=>b(`/api/browser-sites?${new URLSearchParams({...i,...a}).toString()}`)),f=e=>p(()=>b("/api/browser-sites/sign-out",{method:"POST",body:JSON.stringify({...i,...a,...e?{site:e}:{}})})),v=`${"bot"in i?`bot:${i.bot}`:`profile:${i.profile}`}${a.threadId?`:${a.threadId}`:""}`;r.useEffect(()=>{l&&g()},[l,v]);const h=N||o,j="flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-[12px] text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-50",y=s.jsxs("div",{className:l?"flex min-w-0 flex-col gap-2":"mt-2 flex flex-col gap-2","aria-busy":o,children:[x.length>1&&s.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:t("settings.sites.shared",{names:x.join(", ")})}),n===null&&!c&&s.jsx("p",{className:"text-[12px] text-ink-secondary",children:t("settings.sites.loading")}),n?.length===0&&s.jsx("p",{className:"text-[12px] text-ink-secondary",children:t("settings.sites.none")}),!!n?.length&&s.jsx("ul",{className:"divide-y divide-hairline/30",children:n.map(e=>s.jsxs("li",{className:"flex min-w-0 items-center gap-2 py-1.5",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] text-ink",title:e.site,children:e.site}),s.jsxs("button",{type:"button",disabled:h,onClick:()=>{f(e.site)},"aria-label":t("settings.sites.signOutOf",{site:e.site}),className:j,children:[s.jsx(k,{size:13}),t("settings.sites.signOut")]})]},e.site))}),!!n?.length&&s.jsxs("button",{type:"button",disabled:h,onClick:()=>{f()},className:`${j} self-start`,children:[s.jsx(k,{size:13}),t("settings.sites.signOutAll")]}),c&&s.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:c})]});return l?y:s.jsxs("details",{className:"min-w-0",onToggle:e=>{e.currentTarget.open&&!o&&g()},children:[s.jsx("summary",{className:"cursor-pointer text-[12px] font-medium text-ink-secondary hover:text-ink",children:t("settings.sites.title")}),y]})}export{E as S};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{t as a,m as F,r as i,l as p,j as e,X as ht,a as C,d as Ee,S as Mt}from"./styles-C4OYlVF_.js";import{r as Ie,L as $,P as gt,M as rt,N as Ft,v as it,O as _t,t as ge}from"./PlacesRail-DbAKPGkj.js";import{t as be,o as bt,a as Gt,b as Ut,c as Kt,d as Yt,e as Ht,M as qt}from"./org-library-
|
|
1
|
+
import{t as a,m as F,r as i,l as p,j as e,X as ht,a as C,d as Ee,S as Mt}from"./styles-C4OYlVF_.js";import{r as Ie,L as $,P as gt,M as rt,N as Ft,v as it,O as _t,t as ge}from"./PlacesRail-DbAKPGkj.js";import{t as be,o as bt,a as Gt,b as Ut,c as Kt,d as Yt,e as Ht,M as qt}from"./org-library-D5s2ZatJ.js";import{t as Jt,a as Wt}from"./import-name-M5bCwQjb.js";import{bw as Xt,bx as ze,by as ft,bz as Zt,bA as Qt,j as S,bB as Vt,bC as es,bD as ts,C as ss,bE as lt,bF as as,aP as yt,u as kt,ba as A,bG as Te,bH as ns,bI as rs,bJ as is,bK as ls,bL as jt,bM as os,bN as cs,bO as ds,bP as ms,bQ as xs,bR as ot,bS as ps,ae as us,bT as hs}from"./App-pmVj8PQL.js";import{L as gs}from"./LimixResizeHandles-BdmQCBKT.js";import{ShareTeamDialog as bs}from"./ShareTeamDialog-b2XiPOFK.js";import{R as fs}from"./MenuMotion-DZa0_5mG.js";import"./monitor-Cif4agWy.js";import"./package-format-FQGWcyJL.js";import"./index-fLYBrnZ7.js";import"./team-share-U-ZV6moM.js";const ys={"seo growth team":"seoGrowth","engineering team":"engineering","100x marketing team":"marketing100x","reddit lead miner":"redditLeadMiner","competitor watch":"competitorWatch","inbox follow-up":"inboxFollowup"};function $e(t){const m=t.builtIn&&ze.find(u=>`industry-${u.slug}`===t.slug);if(m)return{...t,...Qt(m,F())};const d=ys[t.name.trim().toLowerCase()];return d?{...t,name:a(`templates.catalog.${d}.name`),summary:a(`templates.catalog.${d}.summary`),outcome:t.outcome?a(`templates.catalog.${d}.outcome`):void 0}:t}function ks(t,m){const d=$e(t);return`${d.name} ${d.summary} ${t.name} ${t.summary} ${t.category} ${t.skills.join(" ")} ${t.requires.apps.join(" ")}`.toLowerCase().includes(m)}function Oe(t){const m=F();if(t==="industry-customer-care")return Xt(m).intake;const d=ze.find(u=>`industry-${u.slug}`===t);return d?`${ft(d,m).name} · ${d.roles.map(u=>Zt(u,m).name).join(", ")}`:t}function Nt({title:t,subtitle:m,icon:d,loading:u,error:c,sections:j,useLabel:k,onUse:v,onClose:w}){const x=i.useRef(null);i.useEffect(()=>{x.current?.querySelector("[data-details-close]")?.focus();const b=T=>{T.key==="Escape"&&(T.preventDefault(),T.stopPropagation(),w())};return window.addEventListener("keydown",b,!0),()=>window.removeEventListener("keydown",b,!0)},[w]);const N=j.filter(b=>typeof b.body=="string"?b.body.trim():b.body.length);return Ie.createPortal(e.jsx("div",{className:"ui-scrim fixed inset-0 z-[90] flex items-center justify-center p-4",onMouseDown:b=>{b.target===b.currentTarget&&w()},children:e.jsxs("div",{ref:x,role:"dialog","aria-modal":"true","aria-labelledby":"template-details-title","data-template-details":"",className:"ui-modal relative flex max-h-[min(720px,calc(100dvh-32px))] w-[min(560px,calc(100vw-32px))] flex-col border-0 p-0 text-ink",children:[e.jsxs("div",{className:"flex items-center gap-3 border-b border-hairline/40 px-5 py-4 pe-12",children:[d,e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{id:"template-details-title",className:"break-words text-[17px] font-semibold",children:t}),m&&e.jsx("p",{className:"break-words text-[13px] text-ink-secondary",children:m})]})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-4",children:[u&&e.jsxs("p",{className:"flex items-center gap-2 py-2 text-[13px] text-ink-secondary",children:[e.jsx($,{size:14,className:"animate-spin","aria-hidden":"true"}),p("Đang tải chi tiết…","Loading details…")]}),c&&e.jsx("p",{role:"alert",className:"mb-3 rounded-xl bg-danger/10 px-3 py-2 text-[13px] text-danger",children:c}),N.map(b=>e.jsxs("section",{className:"mb-4 last:mb-0",children:[e.jsx("h3",{className:"mb-1 text-[12px] font-medium uppercase tracking-wide text-ink-tertiary",children:b.label}),typeof b.body=="string"?e.jsx("p",{className:"whitespace-pre-line break-words text-[13px] leading-[1.5] text-ink-secondary",children:b.body}):e.jsx("ul",{className:"list-disc space-y-0.5 ps-5 text-[13px] leading-[1.5] text-ink-secondary",children:b.body.map((T,I)=>e.jsx("li",{className:"break-words",children:T},I))})]},b.label))]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-hairline/40 px-5 py-3",children:[e.jsx("button",{type:"button",onClick:w,className:"rounded-full px-4 py-2 text-[13px] text-ink-secondary hover:text-ink",children:p("Đóng","Close")}),v&&e.jsxs("button",{type:"button",onClick:v,className:"flex items-center gap-1 rounded-full bg-raised px-4 py-2 text-[13px] font-medium text-ink hover:bg-raised-hover",children:[e.jsx(gt,{size:14,"aria-hidden":"true"}),k]})]}),e.jsx("button",{type:"button","data-details-close":"",onClick:w,"aria-label":p("Đóng","Close"),className:"ui-icon-button absolute end-3 top-3",children:e.jsx(ht,{size:16})})]})}),document.body)}function js({entry:t,onUse:m,onClose:d}){const u=$e(t),[c,j]=i.useState(null),[k,v]=i.useState("");i.useEffect(()=>{let x=!0;return S(`/api/team-library/teams/${t.slug}${t.builtIn?`?locale=${F()}`:""}`).then(N=>{x&&j(be(N))},N=>{x&&v(N instanceof Error?N.message:String(N))}),()=>{x=!1}},[t.slug]);const w=[a("templates.botCount",{count:c?.members.length??t.members}),...c?[p(`${c.rooms} phòng`,`${c.rooms} rooms`),p(`${c.routines} lịch định kỳ`,`${c.routines} routines`)]:[],...t.setupMinutes?[a("templates.minutes",{count:t.setupMinutes})]:[]];return e.jsx(Nt,{title:u.name,subtitle:u.category,loading:!c&&!k,error:k,sections:[{label:p("Nhóm này làm gì","What the team does"),body:[u.summary,u.outcome].filter(Boolean).join(`
|
|
2
2
|
|
|
3
3
|
`)},{label:p("Tổng quan","At a glance"),body:w},{label:p("Thành viên","Members"),body:(c?.members??[]).map(x=>x.title?`${x.name} — ${x.title}`:x.name)},{label:p("Kỹ năng đi kèm","Skills included"),body:t.builtIn?t.skills.map(Oe):c?.skills?.length?c.skills:t.skills},{label:p("Ứng dụng cần kết nối","Apps needed"),body:c?.apps.length?c.apps.map(x=>x.optional?p(`${x.label} (không bắt buộc)`,`${x.label} (optional)`):x.label):t.requires.apps},{label:p("Lưu ý","Notes"),body:c?.warnings??[]}],useLabel:a("templates.load"),onUse:m,onClose:d})}const q=["bg-purple-500/15 text-purple-300","bg-cyan-500/15 text-cyan-300","bg-orange-500/15 text-orange-300","bg-emerald-500/15 text-emerald-300"];function Ns({pending:t,importedNames:m,org:d=!1}){return e.jsxs(e.Fragment,{children:[t.description&&e.jsx("p",{className:"max-w-2xl text-[14px] leading-relaxed text-ink-secondary",children:t.description}),t.brief&&e.jsxs("div",{className:"mt-4 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:a("teamImport.brief")}),e.jsx("p",{className:"mt-1 line-clamp-4 whitespace-pre-wrap break-words",children:t.brief})]}),!!t.warnings?.length&&e.jsxs("div",{className:"mt-4 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"mb-2 font-medium text-ink",children:a("templates.backupNotes")}),t.warnings?.map((u,c)=>e.jsx("p",{children:u},c))]}),(t.kind==="package"||t.kind==="backup")&&e.jsxs("div",{className:"mt-5 flex flex-wrap gap-2 text-[12px] text-ink-secondary",children:[t.chiefOfStaff&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(Vt,{size:13}),a("templates.leads",{name:t.chiefOfStaff})]}),!t.library&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(es,{size:13}),a("templates.groupChats",{count:t.rooms})]}),!(t.library&&!t.playbooks)&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(ts,{size:13}),a("templates.playbooks",{count:t.playbooks})]}),!t.library&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(ss,{size:13}),t.version===2?a("teamImport.routinesPaused",{count:t.routines}):a("templates.pausedRoutines",{count:t.routines})]}),t.kind==="package"&&t.version!==2&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(lt,{size:13}),a("templates.connections",{count:t.apps.length})]}),!!t.connections?.length&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(lt,{size:13}),a("teamImport.connections",{count:t.connections?.length??0})]}),!!t.notes&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(as,{size:13}),a("teamImport.notes",{count:t.notes??0})]}),!!t.presets?.length&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(yt,{size:13}),a("teamImport.presets",{count:t.presets?.length??0})]})]}),!!t.skills?.length&&e.jsxs("div",{className:"mt-4 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:d?a("orgLibrary.skillsOn"):t.version===2?a("teamImport.skillsOff"):a("templates.skillsDisabled")}),e.jsx("p",{className:"mt-1 break-words",children:t.skills?.join(", ")}),!d&&e.jsx("p",{className:"mt-1",children:t.version===2?a("teamImport.skillsReview"):a("templates.skillsReview")})]}),t.library&&!!t.presets?.length&&e.jsxs("div",{className:"mt-4 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:a("teamImport.presetList")}),e.jsx("p",{className:"mt-1 break-words",children:t.presets?.join(", ")})]}),!!t.offeredSkills?.length&&e.jsxs("div",{className:"mt-4 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:a("teamImport.offeredSkills")}),e.jsx("p",{className:"mt-1 break-words",children:t.offeredSkills?.join(", ")})]}),!!t.connections?.length&&e.jsxs("div",{className:"mt-4 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:a("teamImport.connections",{count:t.connections?.length??0})}),e.jsx("ul",{className:"mt-1",children:t.connections?.map((u,c)=>e.jsxs("li",{className:"truncate",children:[u.label," · ",u.url]},`${u.label}-${c}`))})]}),t.members.length>0&&e.jsx("div",{className:"mt-6 text-[12px] font-medium text-ink-secondary",children:a("templates.teamMembers")}),e.jsx("div",{className:"mt-2 grid grid-cols-1 gap-x-10 md:grid-cols-2",children:t.members.map((u,c)=>e.jsxs("div",{className:"flex min-h-[72px] items-center gap-3 border-b border-hairline/35 px-1 py-3",children:[t.pictures?.[c]?e.jsx("img",{src:t.pictures[c],alt:"",className:"size-9 shrink-0 rounded-lg object-cover"}):e.jsx("div",{className:C("flex size-9 shrink-0 items-center justify-center rounded-lg text-[13px] font-semibold",q[c%q.length]),children:u.name.slice(0,1).toUpperCase()}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-[14px] font-medium text-ink",children:m[c]}),m[c]!==u.name&&e.jsx("div",{className:"text-[12px] text-ink-secondary",children:a("templates.newCopyOf",{name:u.name})}),e.jsx("div",{className:"mt-0.5 truncate text-[13px] text-ink-secondary",children:u.title||a("templates.generalAssistant")})]})]},`${u.name}-${c}`))}),e.jsxs("div",{className:"mt-6 flex items-start gap-2.5 rounded-xl bg-raised/45 px-4 py-3 text-[13px] leading-relaxed text-ink-secondary",children:[e.jsx(Ee,{size:15,className:"mt-0.5 shrink-0 text-success"}),e.jsx("p",{children:t.kind==="backup"?a("templates.backupSafety",{archived:t.archivedBots?a("templates.archivedBots",{count:t.archivedBots}):""}):d?t.members.length?a("orgLibrary.teamSafety"):a("orgLibrary.librarySafety"):t.library?a("teamImport.librarySafety"):t.version===2?a("teamImport.sharedTeamSafety"):t.kind==="package"?a("templates.packageSafety"):a("templates.legacySafety")})]})]})}async function vs(t,m){for(const d of m??[])await fetch(`/api/limix/skill-store/${encodeURIComponent(t)}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:d,add:!0})}).catch(()=>{})}const ct={gmail:"Gmail",github:"GitHub",discord:"Discord",slack:"Slack",googlecalendar:"Google Calendar",notion:"Notion",linear:"Linear",figma:"Figma",gong:"Gong",hubspot:"HubSpot",postiz:"Postiz"},Be={everyday:"readyBots.category.everyday",work:"readyBots.category.work",writing:"readyBots.category.writing",design:"readyBots.category.design",sales:"readyBots.category.sales",personal:"readyBots.category.personal"};function fe(t){t=A(t.id,F())??t;const m=ds(t);return{id:t.id,name:t.name,title:m.title,category:t.category,description:m.description,try:m.tryAsking,look:t.look,apps:t.apps,routines:t.routines?.length??0,builtIn:!0}}function H(t){const m=t.length?[fe(jt("video-workflow")),...t.filter(d=>d.id!=="video-workflow"&&!A(d.id)).map(d=>({...d,builtIn:!1}))]:os.map(fe);return[...cs.map(fe),...m]}let M=null;async function ws(){const{bots:t}=await S("/api/limix/bots/refresh",{method:"POST"});return M=t.length?H(t):null,(M??H([])).length}const dt=(t,m)=>{const d=m.trim().toLowerCase();return!d||[t.name,t.title,t.description,t.category].some(u=>u.toLowerCase().includes(d))};function Ss({search:t,onDialog:m,onAdded:d,revision:u=0,suggestion:c}){const{state:j,dispatch:k}=kt(),[v,w]=i.useState(null),[x,N]=i.useState(""),[b,T]=i.useState(()=>M??H([])),[I,J]=i.useState(!1),[O,W]=i.useState(null),[X,_]=i.useState(""),[R,G]=i.useState(null);i.useEffect(()=>{if(u>0){T(M??H([])),J(!1);return}let n=!0;return S("/api/limix/bots").then(({bots:f})=>{if(!n)return;const o=H(f);M=f.length?o:null,T(o),J(!1)}).catch(()=>{n&&(T(M??H([])),J(!M))}),()=>{n=!1}},[u]);const V=()=>{G(null),m(!1)},[g,B]=i.useState(null),ee=n=>{if(m(!0),n.builtIn){B({card:n,bot:A(n.id,F())??jt(n.id)});return}B({card:n}),S(`/api/limix/bots/${n.id}`).then(({bot:f})=>B(o=>o?.card.id===n.id?{card:n,bot:f}:o),f=>B(o=>o?.card.id===n.id?{card:n,error:f instanceof Error?f.message:String(f)}:o))},ye=()=>{B(null),m(!1)},te=async n=>{if(!(O||ms(j))){if(_(""),window.ogb?.remoteClient?.active){A(n.id)?(m(!1),_(p("Hãy mở mẫu này trên máy chủ Limix Bot để cài bộ công cụ CSKH.","Open this template on the Limix Bot host to install its customer care tools."))):k({type:"newBot",onCreated:d});return}if(n.builtIn){G({id:n.id}),m(!0);return}W(n.id);try{const{bot:f}=await S(`/api/limix/bots/${n.id}`);G({id:n.id,data:f,skills:f.skills}),m(!0)}catch(f){_(f instanceof Error?f.message:String(f))}finally{W(null)}}},D=b.map(n=>{const f=n.builtIn&&A(n.id);return f?fe(f):n}).filter(n=>c==="support"?n.builtIn&&n.id===Te&&dt(n,t):c==="department"&&(!n.builtIn||n.id===Te||!A(n.id))?!1:(!v||n.category===v)&&dt(n,t)&&(!x||n.builtIn&&(n.id===Te||n.id.startsWith(`industry-${x}-`))));return!x&&t.trim()&&D.length===0?null:e.jsxs("section",{className:"mb-8","aria-labelledby":"ready-bots-title",children:[e.jsxs("div",{className:"mb-1 flex flex-wrap items-baseline justify-between gap-2",children:[e.jsx("h3",{id:"ready-bots-title",className:"text-[12px] font-medium text-ink-secondary",children:a("readyBots.title")}),e.jsx("div",{className:"flex flex-wrap items-center gap-3",children:e.jsx("p",{className:"text-[12px] text-ink-tertiary",role:"status","aria-live":"polite",children:I?p("Đang dùng bản có sẵn trong ứng dụng (chưa tải được kho mẫu).","Showing the bots built into the app (the template library could not be loaded)."):a("readyBots.subtitle")})})]}),e.jsxs("div",{className:"mb-3 mt-2 flex flex-wrap gap-1.5",role:"group","aria-label":a("readyBots.categories"),children:[!c&&[null,...ns].map(n=>e.jsx("button",{type:"button","aria-pressed":v===n,onClick:()=>{w(n),N("")},className:C("rounded-full px-3 py-1 text-[13px] transition-colors",v===n?"bg-ink text-panel":"bg-raised/70 text-ink-secondary hover:text-ink"),children:n?a(Be[n]):a("readyBots.all")},n??"all")),c!=="support"&&e.jsxs("select",{value:x,"aria-label":p("Lọc mẫu bot theo ngành","Filter bot templates by industry"),className:"rounded-full border border-hairline bg-panel px-3 py-1 text-[13px] text-ink",onChange:n=>{N(n.target.value),w(null)},children:[e.jsx("option",{value:"",children:p("Tất cả ngành","All industries")}),ze.map(n=>e.jsx("option",{value:n.slug,children:ft(n,F()).name},n.slug))]})]}),X&&e.jsx("p",{role:"alert",className:"mb-3 rounded-xl bg-danger/10 px-3 py-2 text-[13px] text-danger",children:X}),e.jsx("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(min(100%,280px),1fr))] gap-3",children:D.map(n=>e.jsxs("article",{"data-ready-bot":n.id,className:"flex min-w-0 flex-col rounded-2xl border border-hairline/40 bg-card p-4 [overflow-wrap:anywhere]",children:[e.jsxs("div",{className:"grid grid-cols-[auto_minmax(0,1fr)] items-center gap-3",children:[e.jsx(rt,{color:n.look.color,bodyId:n.look.mascotBody,state:n.look.mascotExpression??"idle",size:40,animated:!1,label:n.name}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"text-[14px] font-medium text-ink",children:n.name}),e.jsxs("p",{className:"text-[12px] text-ink-secondary",children:[n.title," · ",a(Be[n.category])]})]})]}),e.jsx("p",{className:"mt-3 text-[13px] leading-[1.45] text-ink-secondary",children:n.description}),e.jsx("p",{className:"mt-2 text-[12px] italic text-ink-tertiary",children:a("readyBots.try",{prompt:n.try})}),e.jsxs("div",{className:"mt-auto flex flex-wrap items-center justify-between gap-2 pt-3",children:[e.jsxs("button",{type:"button","data-ready-bot-details":n.id,onClick:()=>ee(n),"aria-label":p(`Xem thêm về ${n.name}`,`More about ${n.name}`),className:"flex w-fit items-center gap-1 text-[12px] font-medium text-accent-text hover:underline focus-visible:outline-2 focus-visible:outline-accent",children:[e.jsx(rs,{size:13,"aria-hidden":"true"}),p("Xem thêm","See more")]}),e.jsxs("button",{type:"button",onClick:()=>{te(n)},disabled:O!==null,"aria-label":p(`Dùng mẫu ${n.name}, ${n.title}`,`Use template ${n.name}, ${n.title}`),className:"flex h-8 shrink-0 items-center gap-1 rounded-full bg-raised px-3 text-[13px] font-medium text-ink hover:bg-raised-hover disabled:opacity-50 focus-visible:outline-2 focus-visible:outline-accent",children:[O===n.id?e.jsx($,{size:14,className:"animate-spin","aria-hidden":"true"}):e.jsx(gt,{size:14,"aria-hidden":"true"}),p("Dùng mẫu","Use template")]})]}),(n.apps.length>0||n.routines>0)&&e.jsx("p",{className:"pt-2 text-[12px] text-ink-tertiary",children:[n.apps.length>0&&a("readyBots.worksWith",{apps:n.apps.map(f=>ct[f]??f).join(", ")}),n.routines>0&&a("readyBots.pausedRoutine")].filter(Boolean).join(" · ")})]},n.id))}),g&&e.jsx(Nt,{title:g.card.name,subtitle:`${g.card.title} · ${a(Be[g.card.category])}`,icon:e.jsx(rt,{color:g.card.look.color,bodyId:g.card.look.mascotBody,state:g.card.look.mascotExpression??"idle",size:44,animated:!1,label:g.card.name}),loading:!g.bot&&!g.error,error:g.error,sections:[{label:p("Bot này làm gì","What it does"),body:g.bot?.description??g.card.description},{label:p("Cách bot làm việc","How it works"),body:g.bot?.soul??""},{label:p("Bạn có thể hỏi","Things to ask"),body:g.bot?.tryAsking??[g.card.try]},{label:p("Kỹ năng đi kèm","Skills included"),body:A(g.card.id)?is(g.card.id).map(Oe):g.bot?.skills??[]},{label:p("Kênh chăm sóc khách hàng","Customer service channels"),body:A(g.card.id)?p("Sau khi tạo bot, mở Cài đặt của bot để kết nối Zalo, Facebook Page, Messenger hoặc Telegram.","After creating the bot, open its settings to connect Zalo, a Facebook Page, Messenger or Telegram."):""},{label:p("Ứng dụng nên kết nối","Apps it works with"),body:(g.bot?.apps??g.card.apps).map(n=>ct[n]??n)},{label:p("Lịch định kỳ (tạo ở trạng thái tạm dừng)","Routines (created paused)"),body:(g.bot?.routines??[]).map(n=>n.schedule&&"time"in n.schedule&&n.schedule.time?`${n.name} · ${n.schedule.time}`:n.name)}],useLabel:p("Dùng mẫu","Use template"),onUse:()=>{const n=g.card;B(null),te(n)},onClose:ye}),R&&Ie.createPortal(e.jsx(ls,{readyBotId:R.id,readyBotData:R.data,onClose:V,onCreated:n=>{m(!1),vs(n.id,R.skills),d(n)}}),document.body)]})}const mt=["bg-cyan-500/15 text-cyan-300","bg-purple-500/15 text-purple-300","bg-emerald-500/15 text-emerald-300","bg-orange-500/15 text-orange-300"];function Cs({listing:t,busy:m,notice:d,error:u,onAdd:c,onDetails:j}){const k=t.organization.name;return e.jsxs("div",{children:[e.jsx("p",{className:"max-w-2xl text-[13px] leading-relaxed text-ink-secondary",children:a("orgLibrary.intro",{name:k})}),t.packages.length===0?e.jsx("p",{className:"mt-6 text-[13px] text-ink-secondary",children:a("orgLibrary.empty",{name:k})}):e.jsx("div",{className:"mt-4 grid grid-cols-1 gap-x-10 md:grid-cols-2",children:t.packages.map((v,w)=>e.jsx(Ls,{entry:v,index:w,busy:m,onAdd:c,onDetails:j},v.packageId))}),d&&e.jsx("div",{role:"status",className:"mt-4 rounded-lg bg-raised/60 px-3 py-2 text-[13px] text-ink-secondary",children:d}),u&&e.jsx("div",{role:"alert",className:"mt-4 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:u})]})}function Ls({entry:t,index:m,busy:d,onAdd:u,onDetails:c}){const j=bt(t),k=Gt(t),v=Ut(t),w=d===t.packageId;return e.jsxs("article",{className:"flex min-h-[104px] items-center gap-3 border-b border-hairline/35 px-1 py-4",children:[e.jsx("div",{className:C("flex size-11 shrink-0 items-center justify-center rounded-xl",mt[m%mt.length]),children:e.jsx(Ft,{size:20})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"truncate text-[14px] font-medium text-ink",children:t.name}),e.jsx("p",{className:"mt-0.5 truncate text-[13px] text-ink-secondary",children:t.tagline}),e.jsxs("p",{className:"mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-[12px] text-ink-tertiary",children:[e.jsx("span",{children:Kt(t)}),k&&e.jsx("span",{className:"rounded-full bg-accent/10 px-2 py-0.5 text-accent-text",children:k}),t.release&&e.jsx("span",{children:t.release.version})]}),e.jsx("p",{className:"mt-0.5 truncate text-[12px] text-ink-tertiary",children:Yt(t.contents)}),v.map(x=>e.jsx("p",{className:"mt-0.5 text-[12px] text-warning",children:x},x))]}),e.jsxs("div",{className:"flex shrink-0 flex-col items-end gap-1.5",children:[j==="add"&&e.jsxs("button",{onClick:()=>u(t),disabled:d!==null,"aria-label":a("orgLibrary.addAria",{name:t.name}),className:"flex min-w-[72px] items-center justify-center gap-1.5 rounded-full bg-accent px-3.5 py-2 text-[13px] font-medium text-white hover:bg-accent/90 disabled:opacity-40",children:[w&&e.jsx($,{size:13,className:"animate-spin"}),w?a("orgLibrary.adding"):a("orgLibrary.add")]}),j==="added"&&e.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-raised px-3 py-1.5 text-[12px] text-ink-secondary",children:[e.jsx(Ee,{size:13,className:"text-success"}),a("orgLibrary.added")]}),j==="updateApp"&&e.jsx("span",{className:"max-w-[140px] text-right text-[12px] text-ink-secondary",children:a("orgLibrary.updateApp")}),j==="notReady"&&e.jsx("span",{className:"text-[12px] text-ink-secondary",children:a("orgLibrary.notReady")}),j==="noRelease"&&e.jsx("span",{className:"text-[12px] text-ink-secondary",children:a("orgLibrary.noRelease")}),t.blob==="ready"&&e.jsx("button",{onClick:()=>c(t),disabled:d!==null,"aria-label":a("orgLibrary.detailsAria",{name:t.name}),className:"rounded-full px-2.5 py-1 text-[12px] text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-40",children:a("orgLibrary.details")})]})]})}const Ts="https://github.com/leomieo/limix-bot-teams",xt=["cyan","red","purple","green","orange"];async function pt(t){if(window.ogb?.openExternal){await window.ogb.openExternal(t);return}const m=window.open(t,"_blank","noopener,noreferrer");m&&(m.opener=null)}function Bs(t,m){const d=new Map;for(const c of m){if(c.hidden)continue;const j=c.section?.trim()??"";d.set(j,(d.get(j)??0)+1)}return[...[...new Set([...t.map(c=>c.trim()).filter(Boolean),...d.keys()])].filter(c=>c!==""),""].flatMap(c=>d.get(c)?[{name:c,bots:d.get(c)}]:[])}function ut({index:t}){return e.jsx("div",{className:C("flex size-11 shrink-0 items-center justify-center rounded-xl",q[t%q.length]),children:e.jsx(yt,{size:20})})}function Gs({onClose:t,onImported:m,returnFocusRef:d,initialUrl:u,initialIndustrySuggestion:c}){const{state:j,dispatch:k}=kt(),v=i.useRef(null),w=i.useRef(null),[x,N]=i.useState(c==="team"?"teams":"explore"),[b,T]=i.useState(c),[I,J]=i.useState(null),[O,W]=i.useState(!0),[X,_]=i.useState(""),[R,G]=i.useState(!1),[V,g]=i.useState(""),[B,ee]=i.useState(""),[ye,te]=i.useState(0),D=i.useRef(0),[n,f]=i.useState(null),[o,Z]=i.useState(null),[vt,wt]=i.useState("file"),[ke,Re]=i.useState(""),[Pe,Ae]=i.useState(!1),[z,se]=i.useState(!1),[St,je]=i.useState(!1),[Ne,Ct]=i.useState(""),[U,y]=i.useState(""),[De,Me]=i.useState(""),[ae,Fe]=i.useState(!1),[L,_e]=i.useState(null),[Lt,Tt]=i.useState(""),[ne,ve]=i.useState(null),[Ge,Ue]=i.useState(new Set),[Ke,Ye]=i.useState(""),[re,He]=i.useState(!1),[ie,qe]=i.useState(null),[Je,le]=i.useState(!1),[we,Se]=i.useState(null),[oe,We]=i.useState(null),[Bt,ce]=i.useState(null),[Et,Xe]=i.useState(""),[It,de]=i.useState(""),[K,me]=i.useState(null),P=i.useRef(!!c),Y=i.useRef(0),Ce=j.bots.filter(s=>!s.hidden).length,Ze=Bs(j.sections??[],j.bots),zt=new Set(j.bots.map(s=>s.name.trim().toLowerCase())),$t=o?.members.map(s=>Jt(s.name,zt))??[],xe=i.useCallback(async(s=!1)=>{const r=++D.current;W(!0),_("");try{const l=await S(`/api/team-library/catalog${s?"?fresh=1":""}`);return r===D.current&&J(l),l.communityAvailable!==!1}catch(l){return r===D.current&&_(l instanceof Error?l.message:String(l)),!1}finally{r===D.current&&W(!1)}},[]),Ot=async()=>{if(!R){G(!0),g(""),ee("");try{const[s,r]=await Promise.allSettled([ws(),xe(!0)]);if(s.status==="fulfilled"&&te(l=>l+1),s.status==="fulfilled"&&r.status==="fulfilled"&&r.value)g(p("Đã cập nhật mẫu Bot và mẫu nhóm Bot.","Bot and team templates updated."));else{const l=[...s.status==="rejected"?[p("mẫu Bot","bot templates")]:[],...r.status==="rejected"||!r.value?[p("mẫu nhóm Bot","team templates")]:[]];ee(p(`Chưa cập nhật được ${l.join(", ")}. Hãy thử lại.`,`Could not update ${l.join(", ")}. Please retry.`))}}finally{G(!1)}}};i.useEffect(()=>{xe()},[xe]);const pe=i.useCallback(async()=>{try{const s=await S("/api/org-library");We(s),s.organization&&!P.current&&N("org")}catch{We({organization:null,packages:[]})}},[]);i.useEffect(()=>{pe()},[pe]),i.useEffect(()=>(v.current?.focus(),()=>d.current?.focus()),[d]),i.useEffect(()=>{const s=r=>{if(ie!==null||Je)return;if(r.key==="Escape"&&!z){r.preventDefault(),r.stopPropagation(),o?(Z(null),me(null)):t();return}if(r.key!=="Tab")return;const l=v.current,h=Array.from(l?.querySelectorAll('button:not([disabled]), a[href], input:not([disabled]), [tabindex]:not([tabindex="-1"])')??[]);if(!l||h.length===0)return;const E=h[0],he=h.at(-1);r.shiftKey&&(document.activeElement===E||!l.contains(document.activeElement))?(r.preventDefault(),he.focus()):!r.shiftKey&&document.activeElement===he&&(r.preventDefault(),E.focus())};return window.addEventListener("keydown",s,!0),()=>window.removeEventListener("keydown",s,!0)},[z,t,o,ie,Je]);const ue=(s,r)=>{Z(s),wt(r),y("")},Qe=async s=>{if(s.size>qt)throw new Error(a("templates.fileTooLarge"));const r=await s.text();let l=r;if(!s.name.toLowerCase().endsWith(".md"))try{l=JSON.parse(r)}catch(h){throw h instanceof SyntaxError?new Error(a("teamLibrary.invalidJson")):h}if(l&&typeof l=="object"&&"format"in l&&l.format==="limix.bot"){const h=await S("/api/limix/bots/preview",{method:"POST",body:JSON.stringify(l)});ue({manifest:l,kind:"bot",name:h.name,description:h.description,members:[{name:h.name,title:h.title}],rooms:0,playbooks:0,routines:h.routines,apps:[]},"file");return}ue(be(l),"file")},Ve=async s=>{f(s.slug),y("");try{const r=be(await S(`/api/team-library/teams/${s.slug}${s.builtIn?`?locale=${F()}`:""}`));ue(s.builtIn||s.slug==="engineering"?{...r,builtInTeam:s.slug}:r,"library")}catch(r){y(r instanceof Error?r.message:String(r))}finally{f(null)}},et=async()=>{await tt(ke)},tt=async s=>{if(s.trim()){Ae(!0),y("");try{const r=await S("/api/team-library/github",{method:"POST",body:JSON.stringify({url:s.trim()})});ue(be(r),"github")}catch(r){y(r instanceof Error?r.message:String(r))}finally{Ae(!1)}}};i.useEffect(()=>{u&&(P.current=!0,N("import"),Re(u),tt(u))},[u]);const Rt=async()=>{if(o){se(!0),y("");try{if(o.kind==="bot"){const{bot:r}=await S("/api/bots",{method:"POST",body:JSON.stringify({botTemplate:o.manifest})});k({type:"botAdded",bot:r}),t();return}const s=await Wt(o.manifest,k,o.builtInTeam);ge("team_imported",{members:s.bots.length,source:vt,mode:"add",format:o.kind}),m({name:o.name,members:s.bots.length,...s.connections?.length?{connections:s.connections.length}:{},...s.presets?.length?{presets:s.presets.length}:{}})}catch(s){y(s instanceof Error?s.message:String(s))}finally{se(!1)}}},Pt=async s=>{ce(s.packageId),de("");try{const r=await S(`/api/org-library/packages/${s.packageId}`);Z(Ht(r.document)),me(s),y("")}catch(r){de(r instanceof Error?r.message:String(r))}finally{ce(null)}},st=async s=>{ce(s.packageId),se(!0),de(""),Xe(""),y("");try{const r=await S("/api/org-library/add",{method:"POST",body:JSON.stringify({packageId:s.packageId})});for(const h of r.bots??[])k({type:"botAdded",bot:h});for(const h of r.groups??[])k({type:"groupPatched",group:h});for(const h of r.routines??[])k({type:"routinePatched",routine:h});const l=r.bots?.find(h=>!h.hidden);if(ge("team_imported",{members:r.bots?.length??0,source:"organization",mode:"add",format:"package"}),l){k({type:"select",id:l.id}),m({name:s.name,members:r.bots.length,...r.connections?.length?{connections:r.connections.length}:{}});return}Z(null),me(null),r.alreadyAdded||Xe(a("orgLibrary.addedSkills",{name:s.name})),await pe()}catch(r){const l=r instanceof Error?r.message:String(r);K?y(l):de(l),await pe()}finally{ce(null),se(!1)}},Q=De.trim(),Le=async s=>{const r=++Y.current;Fe(!0),y(""),_e(null),ve(null),Ue(new Set);try{const l=await S(`/api/teams/scout?cwd=${encodeURIComponent(s)}`);if(r!==Y.current)return;_e(l),Tt(s),Ye(l.suggestion.roomName),ge("team_scouted",{signals:l.suggestion.manifest.team.members.length-1}),S(`/api/teams/scout/directory?cwd=${encodeURIComponent(s)}`).then(h=>{r===Y.current&&ve(h.directory)}).catch(()=>{r===Y.current&&ve([])})}catch(l){if(r!==Y.current)return;y(l instanceof Error?l.message:String(l))}finally{r===Y.current&&Fe(!1)}},At=async()=>{const s=await window.ogb?.pickFolder?.(Q||void 0);s&&(Me(s),await Le(s))},Dt=async()=>{if(!(!L||re)){He(!0),y("");try{const s=(ne??[]).filter(E=>Ge.has(E.slug)).map((E,he)=>({key:`dir-${E.slug}`,name:E.name,title:E.category||a("templates.communityBot"),description:E.prompt,appearance:{color:xt[he%xt.length]}})),r={...L.suggestion.manifest,team:{...L.suggestion.manifest.team,members:[...L.suggestion.manifest.team.members,...s]}},l=Ke.trim()||L.suggestion.roomName,h=await S(`/api/teams/import?mode=project&cwd=${encodeURIComponent(Lt)}&room=${encodeURIComponent(l)}`,{method:"POST",body:JSON.stringify(r)});for(const E of h.bots)k({type:"botAdded",bot:E});h.group&&(k({type:"groupPatched",group:{...h.group,messages:[]}}),k({type:"select",id:h.group.id})),ge("team_imported",{members:h.bots.length,source:"scout",mode:"project"}),m({name:l,members:h.bots.length})}catch(s){y(s instanceof Error?s.message:String(s))}finally{He(!1)}}},at=Ne.trim().toLowerCase(),nt=(I?.teams??[]).filter(s=>(b!=="team"||s.builtIn)&&(!at||ks(s,at)));return Ie.createPortal(e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-4 sm:p-6",onMouseDown:s=>s.stopPropagation(),children:[e.jsxs("div",{ref:v,role:"dialog","aria-modal":"true","aria-labelledby":"team-library-title",tabIndex:-1,className:"animate-pop-in relative flex h-[min(780px,calc(100dvh-2rem))] max-h-full w-[min(100%,1040px)] flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-panel shadow-2xl shadow-black/50 outline-none",children:[e.jsxs("header",{className:"flex items-start justify-between gap-4 px-6 pb-3 pt-6 sm:px-8 sm:pt-7",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[o&&e.jsx("button",{onClick:()=>{Z(null),me(null),y("")},disabled:z,className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-50","aria-label":a("templates.back"),children:e.jsx(xs,{size:18})}),e.jsx("h2",{id:"team-library-title",className:"[overflow-wrap:anywhere] text-[22px] font-semibold tracking-[-0.01em] text-ink",children:o?o.name:a("templates.title")})]}),e.jsx("p",{className:C("mt-1 text-[13px] text-ink-secondary",o&&"ml-9"),children:o?o.kind==="bot"?o.members[0]?.title:o.kind==="backup"?a("templates.backupSummary",{bots:o.members.length,conversations:o.conversations??0}):o.kind==="package"?o.library?a("teamImport.library"):o.version===2?a("teamImport.sharedTeam",{count:o.members.length}):a("templates.playbookSummary",{count:o.members.length}):a("templates.readyBots",{count:o.members.length}):a("templates.subtitle")})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[!o&&e.jsxs("button",{onClick:()=>{pt(I?.repositoryUrl??Ts)},className:"flex items-center gap-1.5 rounded-lg px-2.5 py-2 text-[13px] text-ink-secondary hover:bg-raised hover:text-ink",title:a("templates.openRepository"),children:[e.jsx(ot,{size:16}),e.jsx("span",{className:"max-sm:hidden",children:a("templates.communityRepo")}),e.jsx(it,{size:12})]}),e.jsx("button",{onClick:t,disabled:z,className:"rounded-lg p-2 text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-50","aria-label":a("templates.close"),children:e.jsx(ht,{size:21})})]})]}),o?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-6 pt-6 sm:px-8",children:[o.kind==="bot"?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"max-w-2xl text-[14px] leading-relaxed text-ink-secondary",children:o.description}),o.routines>0&&e.jsx("p",{className:"mt-5 text-[13px] text-ink-secondary",children:a("teamImport.routinesPaused",{count:o.routines})})]}):e.jsx(Ns,{pending:o,importedNames:$t,org:K!==null}),o.builtInTeam&&e.jsxs("p",{className:"mt-3 text-[13px] text-ink-secondary",children:[I?.teams.find(s=>s.slug===o.builtInTeam)?.skills.map(Oe).join(" · "),e.jsx("br",{}),p("Mỗi thành viên có kỹ năng CSKH, công cụ phân loại yêu cầu và tra danh mục công khai riêng. Kết nối kênh và nạp dữ liệu của doanh nghiệp sau khi tạo.","Each member gets the customer-care skill, ticket triage and its own public catalog lookup. Set up your business data and channels after creation.")]}),U&&e.jsx("div",{role:"alert",className:"mt-4 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:U})]}),e.jsxs("footer",{className:"flex flex-col gap-3 border-t border-hairline/35 px-6 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-8",children:[e.jsxs("div",{className:"text-[13px] text-ink-secondary",children:[a(Ce===0?"templates.existingNone":Ce===1?"templates.existingOne":"templates.existingMany",{count:Ce})," ",o.kind==="bot"?p("Thêm bot riêng vào danh sách bot.","Adds a standalone bot to your bot list."):o.kind==="backup"?a("teamImport.backupCopies"):o.library?a("teamImport.libraryAdds"):o.members.length===0?"":a("teamImport.newSection",{name:o.teamName??o.name})]}),K?bt(K)==="add"?e.jsxs("button",{onClick:()=>{st(K)},disabled:z,"aria-label":a("orgLibrary.addAria",{name:K.name}),className:"flex shrink-0 items-center justify-center gap-2 rounded-full bg-accent px-5 py-2.5 text-[14px] font-medium text-white hover:bg-accent/90 disabled:opacity-60",children:[z&&e.jsx($,{size:15,className:"animate-spin"}),z?a("orgLibrary.adding"):a("orgLibrary.add")]}):e.jsxs("span",{className:"flex shrink-0 items-center gap-1 rounded-full bg-raised px-4 py-2 text-[13px] text-ink-secondary",children:[e.jsx(Ee,{size:14,className:"text-success"}),a("orgLibrary.added")]}):e.jsxs("button",{onClick:()=>{Rt()},disabled:z,className:"flex shrink-0 items-center justify-center gap-2 rounded-full bg-accent px-5 py-2.5 text-[14px] font-medium text-white hover:bg-accent/90 disabled:opacity-60",children:[z&&e.jsx($,{size:15,className:"animate-spin"}),z?a("templates.importing"):o.kind==="bot"?p("Thêm bot","Add bot"):o.kind==="backup"?a("templates.importBackup"):o.library?a("teamImport.addPresets"):a("templates.addTeam")]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3 px-6 pb-4 pt-5 sm:px-8",children:[e.jsxs("div",{className:"flex max-w-full flex-wrap rounded-xl bg-raised/70 p-1",role:"tablist","aria-label":a("templates.source"),children:[oe?.organization&&e.jsx("button",{role:"tab","aria-selected":x==="org",onClick:()=>{P.current=!0,N("org"),y("")},className:C("max-w-[220px] truncate rounded-lg px-4 py-2 text-[14px] transition-colors",x==="org"?"bg-card text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:a("orgLibrary.tab",{name:oe.organization.name})}),e.jsx("button",{role:"tab","aria-selected":x==="explore",onClick:()=>{P.current=!0,N("explore"),y("")},className:C("rounded-lg px-4 py-2 text-[14px] transition-colors",x==="explore"?"bg-card text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:a("templates.explore")}),e.jsx("button",{role:"tab","aria-selected":x==="import",onClick:()=>{P.current=!0,N("import"),y("")},className:C("rounded-lg px-4 py-2 text-[14px] transition-colors",x==="import"?"bg-card text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:a("templates.import")}),e.jsx("button",{role:"tab","aria-selected":x==="scout",onClick:()=>{P.current=!0,N("scout"),y("")},className:C("rounded-lg px-4 py-2 text-[14px] transition-colors",x==="scout"?"bg-card text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:a("templates.fromFolder")}),e.jsx("button",{role:"tab","aria-selected":x==="share",onClick:()=>{P.current=!0,N("share"),y("")},className:C("rounded-lg px-4 py-2 text-[14px] transition-colors",x==="share"?"bg-card text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:a("teamLibrary.shareTab")}),e.jsx("button",{role:"tab","aria-selected":x==="teams",onClick:()=>{P.current=!0,N("teams"),y("")},className:C("rounded-lg px-4 py-2 text-[14px] transition-colors",x==="teams"?"bg-card text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:p("Bản mẫu Nhóm","Team templates")})]}),e.jsxs("button",{type:"button",onClick:()=>{Ot()},disabled:R,title:p("Tải lại mẫu Bot và mẫu nhóm Bot mới nhất từ kho","Reload the latest bot and team templates"),className:"flex h-10 shrink-0 items-center gap-1.5 rounded-xl bg-raised/70 px-3 text-[13px] font-medium text-ink hover:bg-raised-hover disabled:opacity-60",children:[e.jsx(fs,{size:14,"aria-hidden":"true",className:R?"animate-spin":void 0}),R?p("Đang cập nhật","Updating"):p("Cập nhật","Update")]}),(x==="explore"||x==="teams")&&e.jsxs("label",{className:"flex h-11 w-full items-center gap-2.5 rounded-xl bg-raised/70 px-3.5 sm:ml-auto sm:w-[240px]",children:[e.jsx(Mt,{size:17,className:"shrink-0 text-ink-secondary"}),e.jsx("input",{value:Ne,onChange:s=>Ct(s.target.value),placeholder:a("templates.search"),"aria-label":a("templates.search"),className:"min-w-0 flex-1 bg-transparent text-[14px] text-ink placeholder:text-ink-secondary focus:outline-none"})]})]}),(V||B)&&e.jsx("p",{role:B?"alert":"status",className:C("px-6 pb-2 text-[13px] sm:px-8",B?"text-danger":"text-ink-secondary"),children:B||V}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-7 pt-5 sm:px-8",children:[b&&(b==="team"&&x==="teams"||b!=="team"&&x==="explore")&&e.jsx("button",{type:"button",onClick:()=>T(void 0),className:"mb-3 text-[13px] text-ink-secondary underline hover:text-ink",children:p("Xem tất cả mẫu","Browse all templates")}),x==="org"&&oe?.organization&&e.jsx(Cs,{listing:oe,busy:Bt,notice:Et,error:It,onAdd:s=>{st(s)},onDetails:s=>{Pt(s)}}),x==="explore"&&e.jsx(Ss,{revision:ye,search:Ne,suggestion:b==="team"?void 0:b,onDialog:le,onAdded:t}),x==="teams"&&e.jsxs("div",{children:[we&&e.jsx(js,{entry:we,onClose:()=>{Se(null),le(!1)},onUse:()=>{const s=we;Se(null),le(!1),Ve(s)}}),O&&e.jsxs("div",{className:"flex items-center justify-center gap-2 py-24 text-[13px] text-ink-secondary",children:[e.jsx($,{size:16,className:"animate-spin"})," ",a("templates.loading")]}),!O&&X&&e.jsxs("div",{className:"rounded-xl bg-danger/10 p-4 text-[13px] text-danger",children:[e.jsx("p",{children:X}),e.jsx("button",{onClick:()=>{xe()},className:"mt-3 rounded-full bg-raised px-3.5 py-2 text-ink hover:bg-raised-hover",children:a("common.tryAgain")})]}),!O&&I?.communityAvailable===!1&&e.jsx("p",{role:"status",className:"mb-4 text-[13px] text-ink-secondary",children:p("Đang hiển thị các nhóm có sẵn trong Limix Bot. Thư viện cộng đồng chưa kết nối được.","Showing built-in Limix Bot teams. The community library is currently unavailable.")}),!O&&I&&e.jsx("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(min(100%,360px),1fr))] gap-x-10",children:nt.map((s,r)=>{const l=$e(s);return e.jsxs("article",{className:"grid grid-cols-[auto_minmax(0,1fr)] items-start gap-3 border-b border-hairline/35 px-1 py-4",children:[e.jsx(ut,{index:r}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"[overflow-wrap:anywhere] text-[14px] font-medium text-ink",children:l.name}),e.jsx("p",{className:"mt-0.5 [overflow-wrap:anywhere] text-[13px] text-ink-secondary",children:l.outcome??l.summary}),e.jsxs("p",{className:"mt-1 [overflow-wrap:anywhere] text-[12px] text-ink-tertiary",children:[a("templates.botCount",{count:s.members})," · ",a("templates.playbookCount",{count:s.builtIn?1:s.skills.length}),s.requires.apps.length>0&&` · ${s.requires.apps.join(", ")}`,s.setupMinutes&&` · ${a("templates.minutes",{count:s.setupMinutes})}`]})]}),e.jsxs("div",{className:"col-span-2 flex flex-wrap justify-end gap-2",children:[e.jsx("button",{type:"button","data-team-details":s.slug,onClick:()=>{Se(s),le(!0)},className:"shrink-0 rounded-full px-2.5 py-2 text-[13px] text-accent-text hover:underline",children:p("Xem thêm","See more")}),e.jsxs("button",{onClick:()=>{Ve(s)},disabled:n!==null,className:"flex min-w-[72px] items-center justify-center gap-1.5 rounded-full bg-raised px-3.5 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-40",children:[n===s.slug&&e.jsx($,{size:13,className:"animate-spin"}),n===s.slug?a("templates.loadingShort"):a("templates.load")]})]})]},s.slug)})}),!O&&I&&nt.length===0&&e.jsxs("div",{className:"flex min-h-56 flex-col items-center justify-center text-center",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:a("templates.noneFound")}),e.jsx("div",{className:"mt-1 text-[13px] text-ink-secondary",children:a("templates.tryDifferentSearch")})]})]}),x==="import"&&e.jsxs("div",{children:[e.jsx("input",{ref:w,type:"file",accept:".md,.json,.mausbackup.json,.mausteam.json,text/markdown,application/json",className:"hidden",onChange:s=>{const r=s.currentTarget.files?.[0];s.currentTarget.value="",r&&Qe(r).catch(l=>y(l instanceof Error?l.message:String(l)))}}),e.jsx("div",{className:"mb-3 text-[12px] font-medium text-ink-secondary",children:a("templates.bringYourOwn")}),e.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[e.jsxs("button",{onClick:()=>w.current?.click(),onDragEnter:s=>{s.preventDefault(),je(!0)},onDragOver:s=>s.preventDefault(),onDragLeave:()=>je(!1),onDrop:s=>{s.preventDefault(),je(!1);const r=s.dataTransfer.files[0];r&&Qe(r).catch(l=>y(l instanceof Error?l.message:String(l)))},className:C("flex min-h-56 flex-col items-center justify-center rounded-2xl border border-dashed px-6 text-center transition-colors",St?"border-accent bg-accent/5":"border-hairline/60 bg-raised/20 hover:bg-raised/35"),children:[e.jsx(_t,{size:27,className:"text-accent"}),e.jsx("span",{className:"mt-3 text-[14px] font-medium text-ink",children:a("templates.chooseFile")}),e.jsx("span",{className:"mt-1 text-[13px] text-ink-secondary",children:a("templates.dropFile")})]}),e.jsxs("div",{className:"flex min-h-56 flex-col justify-center rounded-2xl bg-raised/25 px-6",children:[e.jsx(ot,{size:25,className:"text-ink-secondary"}),e.jsx("h3",{className:"mt-3 text-[14px] font-medium text-ink",children:a("templates.loadGithub")}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:a("templates.githubHint")}),e.jsxs("div",{className:"mt-4 flex gap-2",children:[e.jsx("input",{value:ke,onChange:s=>Re(s.target.value),onKeyDown:s=>s.key==="Enter"&&void et(),placeholder:a("templates.githubPlaceholder"),"aria-label":a("templates.githubUrl"),className:"min-w-0 flex-1 rounded-xl bg-raised/80 px-3 py-2.5 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"}),e.jsxs("button",{onClick:()=>{et()},disabled:!ke.trim()||Pe,className:"flex items-center gap-1.5 rounded-full bg-accent px-4 py-2.5 text-[13px] font-medium text-white hover:bg-accent/90 disabled:opacity-40",children:[Pe&&e.jsx($,{size:13,className:"animate-spin"}),a("templates.load")]})]})]})]}),U&&e.jsx("div",{role:"alert",className:"mt-4 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:U})]}),x==="share"&&e.jsxs("div",{children:[e.jsx("p",{className:"max-w-2xl text-[13px] leading-relaxed text-ink-secondary",children:a("teamLibrary.shareIntro")}),Ze.length===0?e.jsx("p",{className:"mt-6 text-[13px] text-ink-secondary",children:a("teamLibrary.shareEmpty")}):e.jsx("div",{className:"mt-4 grid grid-cols-1 gap-x-10 md:grid-cols-2",children:Ze.map((s,r)=>e.jsxs("article",{className:"flex min-h-[84px] items-center gap-3 border-b border-hairline/35 px-1 py-4",children:[e.jsx(ut,{index:r}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"truncate text-[14px] font-medium text-ink",children:s.name||a("teamLibrary.general")}),e.jsx("p",{className:"mt-0.5 text-[13px] text-ink-secondary",children:a("teamLibrary.shareBots",{count:s.bots})})]}),e.jsxs("button",{onClick:()=>qe(s.name),"aria-label":a("teamLibrary.shareTeamAria",{name:s.name||a("teamLibrary.general")}),className:"flex items-center gap-1.5 rounded-full bg-raised px-3.5 py-2 text-[13px] text-ink hover:bg-raised-hover",children:[e.jsx(ps,{size:13}),a("teamLibrary.shareTeam")]})]},s.name||"general"))})]}),x==="scout"&&e.jsxs("div",{children:[e.jsx("div",{className:"mb-3 text-[12px] font-medium text-ink-secondary",children:a("templates.startFolder")}),e.jsx("p",{className:"max-w-2xl text-[13px] leading-relaxed text-ink-secondary",children:a("templates.scoutHint")}),e.jsxs("div",{className:"mt-4 flex flex-col gap-2 sm:flex-row",children:[e.jsx("input",{value:De,onChange:s=>Me(s.target.value),onKeyDown:s=>s.key==="Enter"&&Q&&void Le(Q),placeholder:"/path/to/your/project","aria-label":a("templates.projectFolder"),className:"min-w-0 flex-1 rounded-xl bg-raised/80 px-3 py-2.5 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"}),!!window.ogb?.pickFolder&&e.jsxs("button",{onClick:()=>{At()},disabled:ae,className:"flex items-center justify-center gap-1.5 rounded-full bg-raised px-4 py-2.5 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-40",children:[e.jsx(us,{size:14}),a("templates.browse")]}),e.jsxs("button",{onClick:()=>{Le(Q)},disabled:!Q||ae,className:"flex items-center justify-center gap-1.5 rounded-full bg-accent px-4 py-2.5 text-[13px] font-medium text-white hover:bg-accent/90 disabled:opacity-40",children:[ae?e.jsx($,{size:14,className:"animate-spin"}):e.jsx(hs,{size:14}),ae?a("templates.scouting"):a("templates.scout")]})]}),L&&e.jsxs("div",{className:"mt-6",children:[e.jsxs("div",{className:"rounded-2xl bg-raised/25 px-5 py-4",children:[e.jsx("div",{className:"text-[15px] font-semibold text-ink",children:L.profile.name}),L.profile.summary&&e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:L.profile.summary}),L.profile.stacks.length>0&&e.jsx("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:L.profile.stacks.map(s=>e.jsx("span",{className:"rounded-full bg-raised px-2.5 py-1 text-[12px] text-ink-secondary",children:s},s))})]}),e.jsx("div",{className:"mt-5 text-[12px] font-medium text-ink-secondary",children:a("templates.suggestedTeam")}),e.jsx("div",{className:"mt-1 grid grid-cols-1 gap-x-10 md:grid-cols-2",children:L.suggestion.manifest.team.members.map((s,r)=>e.jsxs("div",{className:"flex min-h-[64px] items-center gap-3 border-b border-hairline/35 px-1 py-3",children:[e.jsx("div",{className:C("flex size-9 shrink-0 items-center justify-center rounded-lg text-[13px] font-semibold",q[r%q.length]),children:s.name.slice(0,1).toUpperCase()}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"truncate text-[14px] font-medium text-ink",children:[s.name," ",e.jsxs("span",{className:"font-normal text-ink-secondary",children:["· ",s.title]})]}),e.jsx("div",{className:"mt-0.5 truncate text-[12px] text-ink-secondary",children:L.suggestion.reasons[s.key]??""})]})]},s.key))}),ne&&ne.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-5 text-[12px] font-medium text-ink-secondary",children:a("templates.communityDirectory")}),e.jsx("div",{className:"mt-1 flex flex-col",children:ne.map(s=>e.jsxs("div",{className:"flex items-center gap-3 border-b border-hairline/35 px-1 py-3",children:[e.jsxs("label",{className:"flex min-w-0 flex-1 cursor-pointer items-center gap-3",children:[e.jsx("input",{type:"checkbox",checked:Ge.has(s.slug),onChange:()=>Ue(r=>{const l=new Set(r);return l.has(s.slug)?l.delete(s.slug):l.add(s.slug),l}),className:"size-4 accent-accent"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"truncate text-[14px] font-medium text-ink",children:[s.name,s.category&&e.jsxs("span",{className:"font-normal text-ink-secondary",children:[" · ",s.category]})]}),e.jsx("div",{className:"mt-0.5 truncate text-[12px] text-ink-secondary",children:a("templates.matches",{values:s.matched.join(", ")})})]})]}),e.jsx("button",{onClick:()=>{pt(s.detailUrl)},"aria-label":a("templates.openDirectory",{name:s.name}),title:a("templates.readBeforeAdding"),className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised hover:text-ink",children:e.jsx(it,{size:14})})]},s.slug))})]}),e.jsxs("div",{className:"mt-6 flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsx("input",{value:Ke,onChange:s=>Ye(s.target.value),"aria-label":a("templates.groupChatName"),className:"min-w-0 flex-1 rounded-xl bg-raised/80 px-3 py-2.5 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"}),e.jsxs("button",{onClick:()=>{Dt()},disabled:re,className:"flex shrink-0 items-center justify-center gap-2 rounded-full bg-accent px-5 py-2.5 text-[14px] font-medium text-white hover:bg-accent/90 disabled:opacity-60",children:[re&&e.jsx($,{size:15,className:"animate-spin"}),re?a("templates.creating"):a("templates.createGroupChat")]})]}),e.jsx("p",{className:"mt-2 text-[12px] text-ink-secondary",children:a("templates.createGroupHint")})]}),U&&e.jsx("div",{role:"alert",className:"mt-4 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:U})]})]})]}),e.jsx(gs,{storageKey:"limix.templates.size",widthInset:48,heightInset:48,showGrip:!0})]}),ie!==null&&e.jsx(bs,{team:ie,onClose:()=>qe(null)})]}),document.body)}export{Ns as TeamImportDetails,Gs as TeamLibraryPanel,Bs as shareableTeamList};
|