local-operator-ui 0.36.9 → 0.38.0
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/out/main/index.js +2046 -71
- package/out/preload/index.js +60 -3
- package/out/renderer/assets/{_basePickBy-DMcJ3S7k.js → _basePickBy-DhcDqJuW.js} +1 -1
- package/out/renderer/assets/{_baseUniq-D1lM95PP.js → _baseUniq-DlAVpNmp.js} +1 -1
- package/out/renderer/assets/{agent-details-page-BtlkMdIG.js → agent-details-page-ydYZH4Kq.js} +2 -2
- package/out/renderer/assets/agent-hub-page-C46GCUT2.js +6 -0
- package/out/renderer/assets/agents-page-BaARss9y.js +7 -0
- package/out/renderer/assets/{arc-DsWPhFjP.js → arc-C-BSLMbh.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-IEHRJDOE-DNfaqYw7.js → architectureDiagram-IEHRJDOE-nDfnCWAM.js} +1 -1
- package/out/renderer/assets/{arrow-up-Begz0H6P.js → arrow-up-JQ86w8h2.js} +1 -1
- package/out/renderer/assets/{blockDiagram-JOT3LUYC-BJENelAS.js → blockDiagram-JOT3LUYC-BJgd2uGT.js} +1 -1
- package/out/renderer/assets/{book-open-5BRzSc1Z.js → book-open-yjstLkVS.js} +1 -1
- package/out/renderer/assets/browser-page-BVFs2_w9.js +1 -0
- package/out/renderer/assets/{browser-webauthn-prompt-yiiGM34k.js → browser-webauthn-prompt-Ch0P_oH9.js} +1 -1
- package/out/renderer/assets/{building-2-T3OwRXqF.js → building-2-Cupv31tS.js} +1 -1
- package/out/renderer/assets/{c4Diagram-VJAJSXHY-CEijvBuX.js → c4Diagram-VJAJSXHY-lIXnBLZ5.js} +1 -1
- package/out/renderer/assets/channel-BqEnrEwi.js +1 -0
- package/out/renderer/assets/{chunk-4BMEZGHF-CtdEc_y-.js → chunk-4BMEZGHF-DF2ktHZp.js} +1 -1
- package/out/renderer/assets/{chunk-A2AXSNBT-DzhnEf46.js → chunk-A2AXSNBT-CNRON9Qy.js} +1 -1
- package/out/renderer/assets/{chunk-AEK57VVT-BNPXglh5.js → chunk-AEK57VVT-BGXI1SR5.js} +1 -1
- package/out/renderer/assets/{chunk-D6G4REZN-xyBvlSTD.js → chunk-D6G4REZN-CW_SyuGg.js} +1 -1
- package/out/renderer/assets/{chunk-RZ5BOZE2-8dmoMKQZ.js → chunk-RZ5BOZE2-gU0oYsA6.js} +1 -1
- package/out/renderer/assets/{chunk-XZIHB7SX-DLfyXOIE.js → chunk-XZIHB7SX-BrVtbfMc.js} +1 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-DNUqXdeF.js +1 -0
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-DNUqXdeF.js +1 -0
- package/out/renderer/assets/clone-_PvxPvQz.js +1 -0
- package/out/renderer/assets/{console-mirror-Ddv0LHdM.js → console-mirror-CkCxHgcU.js} +1 -1
- package/out/renderer/assets/{consoleCapture-Cm0PxzNK.js → consoleCapture-EZYleEWx.js} +1 -1
- package/out/renderer/assets/{conversation-input-sync-i6ilfEnc.js → conversation-input-sync-bgD4kyw3.js} +280 -280
- package/out/renderer/assets/{dagre-OKDRZEBW-Dob_U_wx.js → dagre-OKDRZEBW-BDR0956-.js} +1 -1
- package/out/renderer/assets/{diagram-SSKATNLV-Dh8_PC2b.js → diagram-SSKATNLV-DbCZDtm7.js} +1 -1
- package/out/renderer/assets/{diagram-VNBRO52H-NZ9qo5oG.js → diagram-VNBRO52H-BpXb_OjM.js} +1 -1
- package/out/renderer/assets/{erDiagram-Q7BY3M3F-BOUqITNj.js → erDiagram-Q7BY3M3F-CZukR1Y4.js} +1 -1
- package/out/renderer/assets/{error-boundary-LwhkYl0Z.js → error-boundary-DJAF_aYL.js} +2 -2
- package/out/renderer/assets/{flowDiagram-4HSFHLVR-CZiUXOWe.js → flowDiagram-4HSFHLVR-CqKOnXAd.js} +1 -1
- package/out/renderer/assets/{ganttDiagram-APWFNJXF-DqweVTOi.js → ganttDiagram-APWFNJXF-B9I0smi4.js} +1 -1
- package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-KbIhBWBs.js → gitGraphDiagram-7IBYFJ6S-Bj6-u-5w.js} +1 -1
- package/out/renderer/assets/{graph-O8aHYPDC.js → graph-BsgoQZc2.js} +1 -1
- package/out/renderer/assets/{hash-WYoE1Khd.js → hash-BLfEUuGg.js} +1 -1
- package/out/renderer/assets/index-CL2MVLxd.css +1 -0
- package/out/renderer/assets/{index-D8fns19J.js → index-D7pJoOu_.js} +1 -1
- package/out/renderer/assets/index-N0lyyVVo.js +57 -0
- package/out/renderer/assets/index-jVCAPb0a.js +825 -0
- package/out/renderer/assets/{index-D4j9Ycfd.js → index-lMi7GI2V.js} +1 -1
- package/out/renderer/assets/{infoDiagram-PH2N3AL5-DU0dbmt7.js → infoDiagram-PH2N3AL5-DQ3aMjor.js} +1 -1
- package/out/renderer/assets/{installer-C-rmt1Yr.js → installer-Ch3nb3kq.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-U35MCT3I-DUybkPWl.js → journeyDiagram-U35MCT3I-B_RccO_x.js} +1 -1
- package/out/renderer/assets/{kanban-definition-NDS4AKOZ-onKwvi0l.js → kanban-definition-NDS4AKOZ-BvVJZaiy.js} +1 -1
- package/out/renderer/assets/{layout-RKbPA5d2.js → layout-DCACUDHF.js} +1 -1
- package/out/renderer/assets/legacy-agents-page-BovdqsXe.js +33 -0
- package/out/renderer/assets/library-page-Cm-o3Z-q.js +157 -0
- package/out/renderer/assets/{mermaid.core-DdYe4AYl.js → mermaid.core-BXcegHmP.js} +5 -5
- package/out/renderer/assets/{mesh-page-CW4tQHZJ.js → mesh-page-ChyvMUoR.js} +1 -1
- package/out/renderer/assets/{mindmap-definition-ALO5MXBD-DrsGVqDZ.js → mindmap-definition-ALO5MXBD-Bx_gU6ka.js} +1 -1
- package/out/renderer/assets/{mini-CHtVBEDV.js → mini-DRt4PdyG.js} +1 -1
- package/out/renderer/assets/{notebook-pen-BHmA9Aor.js → notebook-pen-CKr2WSrK.js} +1 -1
- package/out/renderer/assets/org-access-CU1oOVqv.js +1 -0
- package/out/renderer/assets/{org-surface-gate-UD-oXlvB.js → org-surface-gate-C86b758Z.js} +1 -1
- package/out/renderer/assets/{page-header-CoSSp6Ks.js → page-header-CZcbRwLy.js} +1 -1
- package/out/renderer/assets/{pieDiagram-IB7DONF6-C0gYyuJA.js → pieDiagram-IB7DONF6-jEzs31M9.js} +1 -1
- package/out/renderer/assets/{projects-page-DU4wZXNY.js → projects-page-BSvdM2gY.js} +2 -2
- package/out/renderer/assets/publication-validation-g2Kk53C8.js +1 -0
- package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-DbEt_1Ti.js → quadrantDiagram-7GDLP6J5-C07DLJe_.js} +1 -1
- package/out/renderer/assets/{radar-MK3ICKWK-BCsS7AKJ.js → radar-MK3ICKWK-DFqDL3G4.js} +1 -1
- package/out/renderer/assets/{radient-auth-buttons-vBcfzZdx.js → radient-auth-buttons-DP81yj6b.js} +1 -1
- package/out/renderer/assets/{requirementDiagram-KVF5MWMF-C3WoUU_2.js → requirementDiagram-KVF5MWMF-DZVSGDrD.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-vE9T4I2u.js → sankeyDiagram-QLVOVGJD-Efyu9UfS.js} +1 -1
- package/out/renderer/assets/{schedules-page-CGCopxbo.js → schedules-page-CNIApkVt.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-CqwLiiP3.js → sequenceDiagram-X6HHIX6F-C5QQ4cH3.js} +1 -1
- package/out/renderer/assets/{settings-page-DrZcB4mR.js → settings-page-Cd8GUEn_.js} +7 -7
- package/out/renderer/assets/smartart-DAuiyto3.js +1 -0
- package/out/renderer/assets/{stateDiagram-DGXRK772-W9r7i0O7.js → stateDiagram-DGXRK772-DlvSEVs4.js} +1 -1
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-CCLt0TcZ.js +1 -0
- package/out/renderer/assets/team-bridge-page-CosfhCZV.js +11 -0
- package/out/renderer/assets/{timeline-definition-BDJGKUSR-QYcBKPg2.js → timeline-definition-BDJGKUSR-XgOjVv3O.js} +1 -1
- package/out/renderer/assets/ui-preferences-store-C91RrpgH.js +1 -0
- package/out/renderer/assets/{use-download-agent-mutation-CNw_prc9.js → use-download-agent-mutation-B-kxWpF6.js} +4 -4
- package/out/renderer/assets/{use-session-snapshot-CzQdg29b.js → use-session-snapshot-BiiULlsj.js} +1 -1
- package/out/renderer/assets/{xychartDiagram-VJFVF3MP-B37S1SAD.js → xychartDiagram-VJFVF3MP-B0CsPCbY.js} +1 -1
- package/out/renderer/console-capture.html +5 -5
- package/out/renderer/index.html +7 -7
- package/out/renderer/installer.html +4 -4
- package/out/renderer/mini.html +7 -7
- package/package.json +4 -3
- package/out/renderer/assets/agent-hub-page-CvnosPnb.js +0 -6
- package/out/renderer/assets/agents-page-C3p0casO.js +0 -7
- package/out/renderer/assets/browser-page-Dwy1BXTz.js +0 -1
- package/out/renderer/assets/channel-BuIK1RR0.js +0 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-CcLuC1It.js +0 -1
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-CcLuC1It.js +0 -1
- package/out/renderer/assets/clone-C-B3TV1U.js +0 -1
- package/out/renderer/assets/index-6crVx9hx.js +0 -57
- package/out/renderer/assets/index-O8V3Lal4.css +0 -1
- package/out/renderer/assets/index-Re5k_KqO.js +0 -824
- package/out/renderer/assets/legacy-agents-page-DmUlGbZ_.js +0 -33
- package/out/renderer/assets/library-page-CsUF7SOa.js +0 -157
- package/out/renderer/assets/org-access-Bqdb8uRz.js +0 -1
- package/out/renderer/assets/publication-validation-D4Bef-1h.js +0 -1
- package/out/renderer/assets/smartart-C6SIDcio.js +0 -1
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-cX4iVUJF.js +0 -1
- package/out/renderer/assets/tags-input-chips-CqW7e8j3.js +0 -1
- package/out/renderer/assets/team-bridge-page-Dt4lEU3y.js +0 -11
- package/out/renderer/assets/ui-preferences-store-BWYRkg79.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r,j as i,t}from"./index-6crVx9hx.js";import{u as k,C as j,D as y,b as D,d as P,e as C,f as N,g as E,a as m}from"./error-boundary-LwhkYl0Z.js";import"./ui-preferences-store-BWYRkg79.js";import{V as F}from"./conversation-input-sync-i6ilfEnc.js";const S=()=>({subscribe:!0,autoPush:!1,confirmPublicEgress:!1});function B({value:s,onChange:n,source:l,item:b,visibility:p,organization:g,destinationKey:o,canEnableAutoPush:u,disabled:h=!1}){k();const d=r.useId(),_=r.useRef(null),[c,a]=r.useState(null);return r.useEffect(()=>{c!==null&&c!==o&&a(null)},[c,o]),i.jsxs("div",{className:"flex flex-col gap-3","data-initial-hub-policy":!0,children:[i.jsx("p",{className:"text-meta text-ink-muted",children:t("ui.hub.skills.initial_policy_description")}),["subscribe","autoPush"].map(e=>i.jsxs("label",{htmlFor:`${d}-${e}`,className:"flex items-start gap-3 text-body-sm text-ink",children:[i.jsx(j,{id:`${d}-${e}`,checked:s[e],disabled:h||e==="autoPush"&&!u&&!s.autoPush,onCheckedChange:f=>{e==="subscribe"?n({...s,subscribe:f===!0}):f!==!0?n({...s,autoPush:!1,confirmPublicEgress:!1}):u&&a(o)}}),i.jsxs("span",{children:[i.jsx("span",{className:"block",children:t(e==="subscribe"?"ui.hub.subscriptions.subscribe":"ui.hub.subscriptions.auto_push")}),i.jsx("span",{className:"block text-meta text-ink-muted",children:t(e==="subscribe"?"ui.hub.subscriptions.subscribe_description":"ui.hub.subscriptions.auto_push_description",{source:l})})]})]},e)),!u&&i.jsx("p",{className:"text-meta text-ink-muted",children:t("ui.hub.subscriptions.unsupported")}),i.jsx(y,{open:c!==null,onOpenChange:e=>{e||a(null)},children:i.jsxs(D,{onOpenAutoFocus:e=>{e.preventDefault(),_.current?.focus()},children:[i.jsxs(P,{children:[i.jsx(C,{children:t("ui.hub.subscriptions.enable_title",{source:l})}),i.jsx(N,{children:p==="public"?t("ui.hub.subscriptions.enable_public",{item:b}):t("ui.hub.subscriptions.enable_private",{item:b,organization:g??l})})]}),i.jsx("p",{className:"text-body-sm text-ink-muted",children:t("ui.hub.subscriptions.enable_safety")}),i.jsxs(E,{children:[i.jsx(m,{ref:_,"data-testid":"hub-policy-cancel",variant:"outline",onClick:()=>a(null),children:t("ui.hub.subscriptions.cancel")}),i.jsx(m,{"data-testid":"hub-policy-enable",disabled:h||!u||c!==o,onClick:()=>{n({...s,autoPush:!0,confirmPublicEgress:p==="public"}),a(null)},children:t("ui.hub.subscriptions.enable")})]})]})})]})}function q(s,n,l=Date.now()){return s.can_confirm===!0&&s.kind==="skill"&&s.direction==="push"&&s.publication==="create"&&s.proposal?.kind==="skill"&&s.proposal.fields?.document_version===1&&s.preview_receipt.length>0&&s.local_fingerprint.length>0&&s.draft_fingerprint.length>0&&s.proposal_fingerprint.length>0&&s.source_skill===n.sourceSkill&&s.local_alias===n.localAlias&&s.visibility===n.visibility&&s.tenant_id===n.tenantId&&s.policy?.subscribe===n.subscribe&&s.policy?.auto_push===n.autoPush&&s.policy?.confirm_public_egress===n.confirmPublicEgress&&Number.isFinite(Date.parse(s.expires_at))&&Date.parse(s.expires_at)>l}function z(s){return s.local_link_receipt?.state==="complete"&&!!s.link&&s.local_link_receipt.link_id===s.link.link_id&&typeof s.link.policy?.subscribe=="boolean"&&typeof s.link.policy.auto_push=="boolean"&&typeof s.link.policy.revision=="string"&&s.link.policy.revision.length>0}const O=s=>s==="active"||s==="past_due",x=s=>s.status!=="active"?"no_access":O(s.plan.status)?"available":"plan_inactive",A=s=>s.filter(n=>x(n)==="available"),L=s=>s.filter(n=>x(n)==="plan_inactive"),M=s=>{if(!(s instanceof F))return null;switch(s.code){case"team_plan_required":return"plan";case"not_a_member":case"insufficient_role":return"no_access";default:return null}};export{B as H,L as a,q as i,S as n,M as o,z as p,A as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{W as y,X as w,Y as f,Z as T,_ as v,$,a0 as A}from"./conversation-input-sync-i6ilfEnc.js";import{p as d,P as R,a as L,b as I,c as N,d as P}from"./ui-preferences-store-BWYRkg79.js";import{l as S,b as E}from"./index-Re5k_KqO.js";const p={malware_or_exploitation:"Instructions to build or spread malware, or to attack systems you do not own, cannot be published.",credential_theft:"Instructions to obtain someone else's credentials or tokens cannot be published.",fraud_or_deception:"Instructions to deceive or defraud people cannot be published.",harassment_or_hate:"Instructions to harass, threaten or target people cannot be published.",sexual_content_minors:"This agent cannot be published. If you believe this is a mistake, contact support.",sexual_content:"Explicit sexual content cannot be published.",violence_or_weapons:"Instructions to build weapons or to injure people cannot be published.",drugs_or_controlled_substances:"Instructions to make or traffic illegal drugs cannot be published.",self_harm:"This agent cannot be published. If you believe this is a mistake, contact support.",mass_surveillance_or_privacy_abuse:"Instructions to surveil or profile people without their consent cannot be published.",evasion_or_abuse_tooling:"Instructions to evade or defeat safety and anti-abuse systems cannot be published.",prompt_injection:"This instruction set tries to instruct the reviewer rather than describe an agent, so it cannot be published.",unclear_dual_use:"We could not tell whether this is aimed at your own systems or someone else's. Add a sentence stating the scope and target, then publish again.",other_harmful:"This agent was rejected because its instructions would cause harm."},O=e=>{const n=e.trim();return n.length>12&&/\s/.test(n)&&!/^(not found|bad request|unauthorized|error|internal server error)\.?$/i.test(n)};function z(e){const n=e?.categories?.[0];return n&&v(n)?p[n]:p.other_harmful}function k(e,n){const t=n?.rule?` ${n.rule}`:"";switch(n?.field){case"name":return{body:`Name${t||" is not acceptable"}.`,field:"name"};case"instructions":return{body:t?`The instruction body${t}.`:`The instruction body must be between 1 and ${R} characters.`,field:"instructions"};case"description":return{body:`Description${t}.`,field:"description"};case"tools":return{body:`Tools${t}.`,field:"tools"};case"when_to_use":return{body:`When to use${t}.`,field:"when_to_use"};case"categories":return{body:`Categories${t}.`,field:"categories"};case"tags":return{body:`Tags${t}.`,field:"tags"};default:return{body:e,field:null}}}function H(e,n){const t=n.surface==="pull",a=t?"Nothing was pulled.":"Nothing was published.",o=t?"pull again":"publish again",s=n.name.trim()||(t?"this team":"this agent");switch(e.code){case"name_taken":return e.details?.owned_by_caller===!0?{variant:"danger",headline:"You already published this agent",body:`You published "${s}" already. Update that listing instead of publishing a second one.`,note:null,actions:e.details?.existing_agent_id||n.hubAgentId?["update-listing","focus-name"]:["focus-name"]}:{variant:"danger",headline:"That name is taken",body:`"${s}" is already published on the hub by another account. Agent names are unique across the hub.`,note:null,actions:["focus-name"]};case"name_claim_in_flight":return{variant:"warning",headline:"That name is being published right now",body:`Someone is publishing an agent called "${s}" at this moment. It is not claimed — try again in a moment.`,note:null,actions:["retry"]};case"name_reserved_builtin":{const i=e.details?.builtin_name,u=i?d(i)===d(s):!1;return{variant:"danger",headline:"That name is reserved",body:i&&!u?`"${s}" is reserved by the built-in agent "${i}". Built-in names cannot be published to the hub.`:`"${i??s}" is the name of a built-in agent. Built-in names cannot be published to the hub.`,note:null,actions:["focus-name","install-builtin"]}}case"moderation_rejected":return{variant:"danger",headline:"This agent was not accepted",body:e.details?.reason?.trim()||e.message,note:z(e.details),actions:["edit-instructions"]};case"moderation_unavailable":return{variant:"warning",headline:"Review is temporarily unavailable",body:"We could not review this agent just now. Nothing was published. Try again in a minute.",note:null,actions:["retry"]};case"invalid_instruction_set":{const{body:i,field:u}=k(e.message,e.details);return{variant:"danger",headline:"The agent document is not valid",body:i,note:null,actions:u==="name"?["focus-name"]:u==="instructions"?["edit-instructions"]:["edit-agent"]}}case"payload_too_large":{const i=e.details?.limit_bytes;return{variant:"danger",headline:"This agent is too large to publish",body:i?`The instruction set is larger than ${Math.round(i/1024)} KiB. Shorten the instructions.`:"The instruction set is larger than the hub accepts. Shorten the instructions.",note:null,actions:["edit-instructions"]}}case"not_owner":return{variant:"danger",headline:"You cannot update this listing",body:"This listing belongs to another account.",note:null,actions:["publish-as-new"]};case"agent_not_found":return{variant:"danger",headline:"That listing no longer exists",body:"It may have been delisted.",note:null,actions:["publish-as-new","refresh-hub"]};case"hub_unauthorized":return{variant:"danger",headline:"The hub refused this machine's sign-in",body:`${a} Sign in to Radient again to replace the credential the hub refused, then ${o}.`,note:null,actions:["sign-in"]};case"hub_unavailable":return{variant:"warning",headline:t?"The pull did not go through":"The publication did not go through",body:O(e.message)?e.message:`${a} Try again in a moment, or update the backend if the hub has moved.`,note:null,actions:["retry"]};case"local_failure":return{variant:"warning",headline:t?"The team could not be pulled from this machine":"The agent could not be published from this machine",body:e.message,note:null,actions:["retry"]};case"team_plan_required":return{variant:"warning",headline:"That organization needs an active Team plan",body:t?"Reading an organization's teams is part of the Team plan. Ask an owner of the organization to activate it in the Radient console, then pull again.":"Sharing agents inside an organization is part of the Team plan. Ask an owner of the organization to activate it in the Radient console, then publish again.",note:null,actions:["retry"]};case"not_a_member":return{variant:"danger",headline:"You are not a member of that organization",body:`${a} Ask an owner of the organization to invite you, then ${o}.`,note:null,actions:[]};case"insufficient_role":{const i=e.details?.required;return{variant:"danger",headline:"Your organization role does not allow this",body:i?`${t?"Reading an organization's teams needs":"Publishing into an organization needs"} the ${i} role. Ask an owner of the organization to change your role, then ${o}.`:`${t?"Reading an organization's teams needs":"Publishing into an organization needs"} a higher role than yours. Ask an owner of the organization to change your role, then ${o}.`,note:null,actions:[]}}case"team_not_found":return{variant:"danger",headline:"That team is no longer published",body:"It may have been delisted since this page was loaded.",note:null,actions:["refresh-hub"]};default:return{variant:"danger",headline:"The agent could not be published",body:e.message,note:null,actions:["retry"]}}}const C=[/^(?:Download agent from Radient failed: )?(?:Error downloading agent from Radient: )?\s*/,/^Failed to download agent(?: [^\s]+)? from Radient Agent Hub(?: due to a requests error)?:\s*/,/^[A-Za-z_][\w.]*\([^)]*\):\s*/],U=/^(\d{3})\b/,B=new Set([404,410]),q=["read timed out","connection timed out","connection refused","connection aborted","connection reset","connectionerror","connecttimeout","remote end closed connection","max retries exceeded","temporary failure in name resolution","name or service not known","no route to host"],x=e=>{const n=e.toLowerCase();return q.some(t=>n.includes(t))||T(e)},D=(e,n)=>{const t=n.trim()?`"${n.trim()}"`:"That agent";if(w(e))switch(e.code){case"agent_not_found":return`${t} is no longer on the hub, so nothing was downloaded.`;case"hub_unavailable":return`The hub did not complete the download, so ${t} was not downloaded.`;default:return`${t} was not downloaded: ${e.message}`}const a=C.reduce((s,i)=>s.replace(i,""),f(e,"").trim()).trim();if(!a)return`${t} could not be downloaded.`;const o=Number(U.exec(a)?.[1]??Number.NaN);return B.has(o)?`${t} is no longer on the hub, so nothing was downloaded.`:x(a)||o===408?`The hub could not be reached, so ${t} was not downloaded.`:o===429?`The hub is busy, so ${t} was not downloaded. Try again in a moment.`:o===401||o===403?`The hub refused this machine's sign-in, so ${t} was not downloaded.`:o>=500?`The hub could not complete the download, so ${t} was not downloaded. Try again in a moment.`:o>=400?`The hub refused the download, so ${t} is not here.`:`${t} was not downloaded: ${a}`},F="The action did not complete.",G=(e,n,t)=>e==="download"?D(n,t):y(F,n),X={"focus-name":"Choose another name","update-listing":"Update the existing listing","install-builtin":"Install the built-in instead",retry:"Try again","edit-instructions":"Edit the instructions","edit-agent":"Edit the agent","publish-as-new":"Publish as a new listing","sign-in":"Sign in again","refresh-hub":"Refresh the hub"},j="download_count",g={all:["public-agents"],list:e=>[...g.all,"list",{page:e.page,perPage:e.perPage,categories:e.categories?.join(",")??void 0,name:e.name??void 0,description:e.description??void 0,sort:e.sort,order:e.order}]},h={all:["org-agents"],list:(e,n)=>[...h.all,"list",e,{page:n.page,perPage:n.perPage,categories:n.categories?.join(",")??void 0,name:n.name??void 0,description:n.description??void 0,sort:n.sort,order:n.order}]},K=e=>e&&e[0]===h.all[0]?String(e[2]??""):null,Z=e=>e.invalidateQueries({queryKey:g.all}),J=(e,n)=>e.invalidateQueries({queryKey:n?[...h.all,"list",n]:h.all}),V=({page:e=1,perPage:n=20,enabled:t=!0,categories:a,name:o,description:s,sort:i=j,order:u="desc",tenantId:c}={})=>{const b={page:e,perPage:n,categories:a,name:o,description:s,sort:i,order:u},_=c?h.list(c,b):g.list(b),l=$({queryKey:_,queryFn:async()=>{const r={};return a&&a.length>0&&(r.categories=a.join(",")),o&&(r.name=o),s&&(r.description=s),r.sort=i,r.order=u,c?await S(c,e,n,r):await E(e,n,r)},select:r=>r.result,enabled:t,retry:A,staleTime:5*60*1e3,gcTime:10*60*1e3,refetchOnWindowFocus:!1,placeholderData:(r,m)=>K(m?.queryKey)===(c??null)?r:void 0});return{...l,agents:l.data?.records,isRefreshing:l.isFetching&&l.data!==void 0,pagination:l.data?{page:l.data.page,perPage:l.data.per_page,totalPages:l.data.total_pages,totalRecords:l.data.total_records}:void 0}},M={name:"Name",description:"Description",instructions:"The instruction body",tools:"Tools"};function ee(e){const n=[],t=(a,o)=>{o&&n.push({field:a,message:`${M[a]} ${o}.`})};return t("name",L(e.name)),t("description",I(e.description)),e.instructions!==null&&t("instructions",N(e.instructions)),t("tools",P(e.tools??[])),n}function ne(e,n){const t=d(e);return n.some(a=>d(a)===t)}function te(e){for(const n of e??[]){const t=n.indexOf(":");if(t<0||n.slice(0,t).trim().toLowerCase()!=="tools")continue;const a=n.slice(t+1).split(",").map(o=>o.trim()).filter(Boolean);return a.length>0?a:null}return null}function ae(e,n){const t=d(e);return n.find(a=>d(a)===t)??null}export{X as P,G as a,g as b,J as c,ne as d,ee as e,Z as i,ae as l,H as p,te as t,V as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as Y,a as E,b as F}from"./library-page-CsUF7SOa.js";import"./index-6crVx9hx.js";import"./index-Re5k_KqO.js";import"./conversation-input-sync-i6ilfEnc.js";import"./ui-preferences-store-BWYRkg79.js";import"./error-boundary-LwhkYl0Z.js";import"./console-mirror-Ddv0LHdM.js";import"./page-header-CoSSp6Ks.js";import"./hash-WYoE1Khd.js";import"./tags-input-chips-CqW7e8j3.js";import"./arrow-up-Begz0H6P.js";const B=["#4472C4","#ED7D31","#A9D18E","#FF0000","#FFC000","#5B9BD5","#70AD47","#C00000","#7030A0","#00B0F0"];function W(n,t){const c=`accent${n%6+1}`;return t[c]?"#"+t[c]:B[n%B.length]}function j(n,t=.45){const c=parseInt(n.slice(1,3),16),s=parseInt(n.slice(3,5),16),a=parseInt(n.slice(5,7),16),p=Math.round(c+(255-c)*t),M=Math.round(s+(255-s)*t),o=Math.round(a+(255-a)*t);return`rgb(${p},${M},${o})`}function G(n){const t=[];for(const c of E(n,"t")){const s=c.textContent.trim();s&&t.push(s)}return t.join(" ")}function V(n){if(!n)return[];const t=Y(n,"ptLst");if(!t)return[];const c=[];for(const s of E(t,"pt")){const a=F(s,"type","node");if(a==="parTrans"||a==="sibTrans")continue;const p=G(s);(p||a==="node")&&c.push({id:F(s,"modelId",""),type:a,text:p})}return c.filter(s=>s.text)}function z(n){if(!n)return"list";const t=Y(n,"layoutDef")||n,s=(F(t,"uniqueId","")||F(t,"defStyle","")||"").toLowerCase();return s.includes("chevron")||s.includes("arrowprocess")||s.includes("process")?"process":s.includes("cycle")||s.includes("continuouscycle")?"cycle":s.includes("hierarchy")||s.includes("orgchart")||s.includes("org")?"hierarchy":s.includes("radial")||s.includes("diverging")?"radial":s.includes("pyramid")||s.includes("invertedpyramid")?"pyramid":s.includes("funnel")?"funnel":s.includes("venn")?"venn":s.includes("matrix")?"matrix":s.includes("list")||s.includes("bullet")?"list":s.includes("relationship")||s.includes("balance")?"relationship":"list"}function $(n,t,c,s,a,p,M,o="#fff",f="center"){if(!t)return;n.save(),n.fillStyle=o,n.textAlign=f,n.textBaseline="middle";const l=t.split(" "),g=M*1.3;let h=[],r="";for(const u of l){const y=r?r+" "+u:u;n.measureText(y).width>a-4&&r?(h.push(r),r=u):r=y}r&&h.push(r);const i=Math.max(1,Math.floor(p/g));h.length>i&&(h=h.slice(0,i));const e=s-(h.length-1)*g/2;for(let u=0;u<h.length;u++)n.fillText(h[u],c,e+u*g);n.restore()}function I(n,t,c,s=14){const a=Math.floor(t/(s*.55)),p=n.split(" "),M=Math.ceil(p.join(" ").length/Math.max(a,1)),o=c/(M*1.4);return Math.max(8,Math.min(s,o))}function L(n,t,c,s,a,p,M,o){n.save(),n.beginPath(),p=Math.min(p,s/2,a/2),n.moveTo(t+p,c),n.arcTo(t+s,c,t+s,c+a,p),n.arcTo(t+s,c+a,t,c+a,p),n.arcTo(t,c+a,t,c,p),n.arcTo(t,c,t+s,c,p),n.closePath(),M&&(n.fillStyle=M,n.fill()),n.restore()}function X(n,t,c,s,a,p,M=1.5){const o=Math.atan2(a-c,s-t),f=8;n.save(),n.strokeStyle=p,n.fillStyle=p,n.lineWidth=M,n.beginPath(),n.moveTo(t,c),n.lineTo(s,a),n.stroke(),n.beginPath(),n.moveTo(s,a),n.lineTo(s-f*Math.cos(o-.4),a-f*Math.sin(o-.4)),n.lineTo(s-f*Math.cos(o+.4),a-f*Math.sin(o+.4)),n.closePath(),n.fill(),n.restore()}function J(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t.length,l=a/f,g=Math.min(l*.08,10*o),h=Math.min(l*.12,18*o),r=l-h-g,i=p*.7,e=s+(p-i)/2;for(let u=0;u<f;u++){const y=W(u,M),d=c+l*u+g/2,b=u===f-1;n.save(),n.beginPath();const P=d+r+(b?0:h);n.moveTo(d,e),n.lineTo(d+r,e),b||n.lineTo(P,e+i/2),n.lineTo(d+r,e+i),n.lineTo(d,e+i),u>0&&n.lineTo(d+h,e+i/2),n.closePath(),n.fillStyle=y,n.fill(),n.restore();const m=I(t[u].text,r-h,i)*o;n.font=`${m}px sans-serif`;const T=d+(r+(u>0?h:0))/2;$(n,t[u].text,T,e+i/2,r,i,m)}}function K(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t.length,l=c+a/2,g=s+p/2,h=Math.min(a,p)*.33,r=Math.min(h*.32,40*o);n.save(),n.strokeStyle="#ccc",n.lineWidth=2*o,n.setLineDash([4*o,4*o]),n.beginPath(),n.arc(l,g,h,0,Math.PI*2),n.stroke(),n.setLineDash([]),n.restore();for(let i=0;i<f;i++){const e=i/f*Math.PI*2-Math.PI/2,u=l+h*Math.cos(e),y=g+h*Math.sin(e),d=W(i,M);if(n.save(),n.beginPath(),n.arc(u,y,r,0,Math.PI*2),n.fillStyle=d,n.fill(),n.restore(),f>1){const P=(i+1)/f*Math.PI*2-Math.PI/2,m=(e+P)/2,T=l+h*Math.cos(e+.15),v=g+h*Math.sin(e+.15),k=l+h*Math.cos(P-.15),S=g+h*Math.sin(P-.15);n.save(),n.strokeStyle=d+"99",n.lineWidth=1.5*o,n.beginPath(),n.moveTo(T,v),n.quadraticCurveTo(l+h*1.1*Math.cos(m),g+h*1.1*Math.sin(m),k,S),n.stroke(),n.restore()}const b=I(t[i].text,r*1.7,r*1.2)*o;n.font=`${b}px sans-serif`,$(n,t[i].text,u,y,r*2,r*1.8,b)}}function O(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t[0],l=t.slice(1),g=Math.max(l.length,1),h=p/(l.length>0?2.8:1.2),r=h*.75,i=Math.min(a*.3,160*o),e=r,u=c+(a-i)/2,y=s+(h-e)/2,d=W(0,M);L(n,u,y,i,e,6*o,d);const b=I(f.text,i-10*o,e)*o;if(n.font=`bold ${b}px sans-serif`,$(n,f.text,u+i/2,y+e/2,i-10,e,b),!l.length)return;const P=(a-20*o)/g,m=s+h*1.5,T=y+e,v=m-4*o;n.save(),n.strokeStyle="#999",n.lineWidth=1.5*o,n.beginPath(),n.moveTo(u+i/2,T),n.lineTo(u+i/2,(T+v)/2),n.lineTo(c+10*o,(T+v)/2),n.lineTo(c+a-10*o,(T+v)/2),n.stroke(),n.restore();for(let k=0;k<l.length;k++){const S=c+P*k+8*o,R=m,A=P-16*o,H=r,N=W(k+1,M);n.save(),n.strokeStyle="#999",n.lineWidth=1.5*o,n.beginPath(),n.moveTo(S+A/2,(T+v)/2),n.lineTo(S+A/2,R),n.stroke(),n.restore(),L(n,S,R,A,H,5*o,N);const D=I(l[k].text,A-8*o,H)*o;n.font=`${D}px sans-serif`,$(n,l[k].text,S+A/2,R+H/2,A-8,H,D)}}function Q(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t[0],l=t.slice(1),g=c+a/2,h=s+p/2,r=Math.min(a,p)*.18,i=Math.min(a,p)*.36,e=Math.min(i*.28,38*o),u=l.length||1,y=W(0,M);n.save(),n.beginPath(),n.arc(g,h,r,0,Math.PI*2),n.fillStyle=y,n.fill(),n.restore();const d=I(f.text,r*1.6,r*1.2)*o;n.font=`bold ${d}px sans-serif`,$(n,f.text,g,h,r*2,r*2,d);for(let b=0;b<u;b++){const P=b/u*Math.PI*2-Math.PI/2,m=g+i*Math.cos(P),T=h+i*Math.sin(P),v=W(b+1,M),k=g+r*Math.cos(P),S=h+r*Math.sin(P),R=m-e*Math.cos(P),A=T-e*Math.sin(P);X(n,k,S,R,A,v+"99",1.5*o),n.save(),n.beginPath(),n.arc(m,T,e,0,Math.PI*2),n.fillStyle=v,n.fill(),n.restore();const H=I(l[b].text,e*1.7,e*1.2)*o;n.font=`${H}px sans-serif`,$(n,l[b].text,m,T,e*2,e*1.8,H)}}function U(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t.length,l=p/f;for(let g=0;g<f;g++){const h=(f-g)/f,r=a*h,i=c+(a-r)/2,e=s+g*l,u=W(g,M);n.save(),n.beginPath(),n.moveTo(i,e+l),n.lineTo(i+r,e+l);const y=a*((f-g-1)/f);n.lineTo(c+(a+y)/2,e),n.lineTo(c+(a-y)/2,e),n.closePath(),n.fillStyle=u,n.strokeStyle="#fff",n.lineWidth=2*o,n.fill(),n.stroke(),n.restore();const d=I(t[g].text,r*.6,l*.7)*o;n.font=`${d}px sans-serif`,$(n,t[g].text,c+a/2,e+l/2,r*.6,l*.7,d)}}function Z(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t.length,l=p/f;for(let g=0;g<f;g++){const h=1-g/f*.55,r=1-(g+1)/f*.55,i=a*h,e=a*r,u=c+(a-i)/2,y=c+(a-e)/2,d=s+g*l,b=W(g,M);n.save(),n.beginPath(),n.moveTo(u,d),n.lineTo(u+i,d),n.lineTo(y+e,d+l),n.lineTo(y,d+l),n.closePath(),n.fillStyle=b,n.strokeStyle="#fff",n.lineWidth=2*o,n.fill(),n.stroke(),n.restore();const P=(i+e)/2,m=I(t[g].text,P*.8,l*.7)*o;n.font=`${m}px sans-serif`,$(n,t[g].text,c+a/2,d+l/2,P*.8,l*.7,m)}}function _(n,t,c,s,a,p,M,o){if(!t.length)return;const f=Math.min(t.length,4),l=c+a/2,g=s+p/2,h=Math.min(a,p)*(f<=2?.32:.28),r=h*.65,i=[];for(let e=0;e<f;e++)i.push(e/f*Math.PI*2-Math.PI/2);for(let e=0;e<f;e++){const u=f>1?l+r*Math.cos(i[e]):l,y=f>1?g+r*Math.sin(i[e]):g,d=W(e,M);n.save(),n.globalAlpha=.55,n.beginPath(),n.arc(u,y,h,0,Math.PI*2),n.fillStyle=d,n.fill(),n.globalAlpha=1,n.strokeStyle="#fff",n.lineWidth=1.5*o,n.stroke(),n.restore();const b=f>1?l+(r+h*.45)*Math.cos(i[e]):l,P=f>1?g+(r+h*.45)*Math.sin(i[e]):g,m=I(t[e].text,h*1.2,h*.7)*o;n.font=`${m}px sans-serif`,$(n,t[e].text,b,P,h*1.2,h*.7,m,"#333")}}function w(n,t,c,s,a,p,M,o){const f=[t[0]||{text:""},t[1]||{text:""},t[2]||{text:""},t[3]||{text:""}],l=a/2,g=p/2,h=8*o;for(let r=0;r<2;r++)for(let i=0;i<2;i++){const e=r*2+i,u=c+i*l+h,y=s+r*g+h,d=l-h*2,b=g-h*2,P=W(e,M);L(n,u,y,d,b,8*o,P);const m=I(f[e].text,d-10,b)*o;n.font=`${m}px sans-serif`,$(n,f[e].text,u+d/2,y+b/2,d-10,b,m)}}function q(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t.length,l=p/f,g=Math.min(l*.2,14*o),h=g*3;for(let r=0;r<f;r++){const i=s+r*l,e=i+l/2,u=W(r,M);n.save(),n.beginPath(),n.arc(c+g,e,g,0,Math.PI*2),n.fillStyle=u,n.fill(),n.restore(),L(n,c+h,i+l*.1,a-h-4*o,l*.8,4*o,u+"22");const y=I(t[r].text,a-h-20*o,l*.7)*o;n.font=`${y}px sans-serif`,n.fillStyle="#333",n.textAlign="left",n.textBaseline="middle",n.fillText(t[r].text,c+h+8*o,e)}}function C(n,t,c,s,a,p,M,o){if(t.length<2){q(n,t,c,s,a,p,M,o);return}const f=t[Math.floor(t.length/2)],l=t.slice(0,Math.floor(t.length/2)),g=t.slice(Math.floor(t.length/2)+1),h=c+a/2,r=s+p/2,i=Math.min(a*.14,p*.25),e=W(Math.floor(t.length/2),M);n.save(),n.beginPath(),n.arc(h,r,i,0,Math.PI*2),n.fillStyle=e,n.fill(),n.restore();const u=I(f.text,i*1.6,i*1.2)*o;n.font=`bold ${u}px sans-serif`,$(n,f.text,h,r,i*2,i*1.8,u);const y=p/Math.max(l.length,g.length,1),d=a*.3,b=y*.7,P=(m,T)=>{const v=T==="left"?c:c+a-d,k=T==="left"?h-i:h+i;for(let S=0;S<m.length;S++){const R=s+y*S+(y-b)/2,A=W(S+(T==="right"?l.length+1:0),M);L(n,v,R,d,b,5*o,A);const H=I(m[S].text,d-8,b)*o;n.font=`${H}px sans-serif`,$(n,m[S].text,v+d/2,R+b/2,d-8,b,H);const N=T==="left"?v+d:v;X(n,N,R+b/2,k,r,A+"88",1.5*o)}};P(l,"left"),P(g,"right")}function x(n,t,c,s,a,p,M,o){const f=t.length;if(!f)return;const l=Math.ceil(Math.sqrt(f)),g=Math.ceil(f/l),h=a/l,r=p/g,i=Math.min(h,r)*.1;for(let e=0;e<f;e++){const u=e%l,y=Math.floor(e/l),d=c+u*h+i,b=s+y*r+i,P=h-i*2,m=r-i*2,T=W(e,M);L(n,d,b,P,m,8*o,T),j(T),n.save();const v=n.createLinearGradient(d,b,d,b+m*.5);v.addColorStop(0,"rgba(255,255,255,0.18)"),v.addColorStop(1,"rgba(255,255,255,0)"),n.fillStyle=v,n.beginPath(),n.roundRect?.(d,b,P,m,8*o),n.fill(),n.restore();const k=I(t[e].text,P-12*o,m)*o;n.font=`${k}px sans-serif`,$(n,t[e].text,d+P/2,b+m/2,P-12*o,m,k)}}function un(n,t,c,s,a,p,M,o,f){const l=V(t),g=z(c),h=16*f;n.save(),n.fillStyle="#f7f9fc",n.strokeStyle="#e0e4ec",n.lineWidth=1,n.beginPath(),n.roundRect?.(s,a,p,M,6*f)||n.rect(s,a,p,M),n.fill(),n.stroke();const r=s+h,i=a+h,e=p-h*2,u=M-h*2;if(!l.length){n.fillStyle="#aaa",n.font=`${12*f}px sans-serif`,n.textAlign="center",n.textBaseline="middle",n.fillText("SmartArt Diagram",s+p/2,a+M/2),n.restore();return}switch(g){case"process":J(n,l,r,i,e,u,o,f);break;case"cycle":K(n,l,r,i,e,u,o,f);break;case"hierarchy":O(n,l,r,i,e,u,o,f);break;case"radial":Q(n,l,r,i,e,u,o,f);break;case"pyramid":U(n,l,r,i,e,u,o,f);break;case"funnel":Z(n,l,r,i,e,u,o,f);break;case"venn":_(n,l,r,i,e,u,o,f);break;case"matrix":w(n,l,r,i,e,u,o,f);break;case"list":q(n,l,r,i,e,u,o,f);break;case"relationship":C(n,l,r,i,e,u,o,f);break;default:x(n,l,r,i,e,u,o,f)}n.restore()}export{un as renderSmartArt};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as r,b as e,a,S as s}from"./chunk-AEK57VVT-BNPXglh5.js";import{_ as i}from"./mermaid.core-DdYe4AYl.js";import"./chunk-RZ5BOZE2-8dmoMKQZ.js";import"./conversation-input-sync-i6ilfEnc.js";import"./index-6crVx9hx.js";import"./ui-preferences-store-BWYRkg79.js";import"./error-boundary-LwhkYl0Z.js";var n={parser:a,get db(){return new s(2)},renderer:e,styles:r,init:i(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{n as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as o,j as t,c as r}from"./index-6crVx9hx.js";import{L as g,B as j,X as y,a as N}from"./error-boundary-LwhkYl0Z.js";import{a as v}from"./index-Re5k_KqO.js";const C=({value:s,label:l,onChange:a,placeholder:p="Add tag...",disabled:i=!1,icon:x})=>{const[n,c]=o.useState(""),d=o.useRef(null),u=o.useId(),f=e=>{c(e.target.value)},m=()=>{const e=n.trim().toLowerCase();e&&!s.includes(e)&&a([...s,e]),c("")},h=e=>{e.key==="Enter"&&n.trim()?(e.preventDefault(),m()):e.key==="Backspace"&&!n&&s.length>0&&a(s.slice(0,-1))},b=e=>{a(s.filter(k=>k!==e))};return t.jsxs("div",{children:[t.jsxs(g,{htmlFor:u,className:"mb-1.5 flex items-center gap-2 text-ink-muted",children:[x,l]}),t.jsxs("div",{className:r("flex min-h-11 flex-wrap items-center gap-2 rounded-sm border border-control bg-surface p-2","has-[input:focus-visible]:outline-solid has-[input:focus-visible]:outline-2","has-[input:focus-visible]:outline-accent has-[input:focus-visible]:outline-offset-2",i&&"border-hairline bg-sunken"),children:[s.map(e=>t.jsxs(j,{className:"gap-1 pr-1 text-ink",children:[e,t.jsx("button",{type:"button","aria-label":`Remove tag ${e}`,disabled:i,onClick:()=>b(e),className:r("rounded-xs text-ink-dim","transition-colors duration-fast ease-out-quart","hover:text-danger disabled:text-ink-disabled"),children:t.jsx(y,{})})]},e)),t.jsx("input",{id:u,ref:d,type:"text",value:n,onChange:f,onKeyDown:h,placeholder:p,disabled:i,"aria-label":l,className:r("min-w-20 flex-1 bg-transparent px-1 py-0.5 outline-none","text-body-sm text-ink placeholder:text-ink-dim","disabled:text-ink-disabled disabled:placeholder:text-ink-disabled")}),n.trim()&&t.jsx(N,{variant:"ghost",size:"icon-sm","aria-label":"Add tag",disabled:i,onClick:()=>{m(),d.current?.focus()},className:"text-accent hover:text-accent",children:t.jsx(v,{})})]}),s.length===0&&!n&&t.jsx("span",{className:"mt-1 ml-1 block text-ink-dim text-meta",children:"No tags added"})]})};export{C as T};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{j as e,t as a,r as p,c as k}from"./index-6crVx9hx.js";import{g as ye,t as Ne,T as Be,h as ke,a as $,o as we,i as I,j as _e,k as Ce,m as W,v as oe,p as re,q as me,s as Me,x as Te,y as ue,z as le,A as Se,C as Ie,D as De,E as ze,F as Ee,G as Re,H as Pe,I as Oe,J as Fe,K as Le,L as qe,M as Ae,N as Ve,O as Ue,Q as Ge,R as He}from"./index-Re5k_KqO.js";import{c as xe,u as R,i as pe,j as he,a as y,k as ge,l as fe,m as je,n as L,o as ve,p as X,D as Ke,b as Qe,e as Je,f as $e,I as Q,X as Xe,q as Ye,B as q,r as Y,s as de,S as ce}from"./error-boundary-LwhkYl0Z.js";import{aI as We,aJ as Ze,aK as ea,aL as aa,aM as J}from"./conversation-input-sync-i6ilfEnc.js";import"./ui-preferences-store-BWYRkg79.js";import{B as ta}from"./building-2-T3OwRXqF.js";import{H as sa}from"./hash-WYoE1Khd.js";import"./console-mirror-Ddv0LHdM.js";/**
|
|
2
|
-
* @license lucide-react v0.507.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 ia=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]],be=xe("bell-off",ia);/**
|
|
7
|
-
* @license lucide-react v0.507.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const na=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],ra=xe("bell",na),la=({conversation:t,onNotifyChange:d,defaultOpen:m=!1})=>{R();const s=ye(t),n=s==="mute";return e.jsxs(pe,{defaultOpen:m,children:[e.jsx(he,{asChild:!0,children:e.jsx(y,{type:"button",size:"icon-sm",variant:"ghost","aria-label":a("ui.teamBridge.menu.label"),title:a("ui.teamBridge.menu.label"),children:e.jsx(We,{size:16,"aria-hidden":"true"})})}),e.jsxs(ge,{align:"end",className:"w-60",children:[e.jsxs(fe,{onSelect:()=>d(Ne(s)),children:[n?e.jsx(ra,{size:16,"aria-hidden":"true"}):e.jsx(be,{size:16,"aria-hidden":"true"}),e.jsx("span",{children:n?a("ui.teamBridge.menu.unmute"):a("ui.teamBridge.menu.mute")})]}),e.jsx(je,{}),e.jsx(L,{children:a("ui.teamBridge.notify.label")}),e.jsx(ve,{value:s,"aria-label":a("ui.teamBridge.notify.label"),onValueChange:c=>d(ke(c)),children:Be.map(c=>e.jsx(X,{value:c.value,children:e.jsx("span",{className:"min-w-0 flex-1 truncate",children:a(c.labelKey)})},c.value))})]})]})},da=({open:t,onClose:d,onCreate:m,pending:s=!1,error:n})=>{R();const[c,g]=p.useState("dm"),[x,v]=p.useState(""),[h,o]=p.useState([{account_id:"",kind:"human",display_label:"",rowId:crypto.randomUUID()}]),w=(i,f)=>{o(j=>j.map((b,N)=>N===i?{...b,...f}:b))},M=h.some(i=>i.account_id.trim()&&i.display_label.trim())&&(c==="dm"||x.trim().length>0||c==="group");return e.jsx(Ke,{open:t,onOpenChange:i=>{i||d()},children:e.jsxs(Qe,{className:"gap-4",children:[e.jsx(Je,{children:a("ui.teamBridge.create.title")}),e.jsx($e,{className:"sr-only",children:a("ui.teamBridge.page.subtitle")}),e.jsxs("fieldset",{className:"flex gap-1",children:[e.jsx("legend",{className:"sr-only",children:a("ui.teamBridge.create.title")}),["dm","group","channel"].map(i=>e.jsx(y,{type:"button",size:"sm",variant:c===i?"primary":"ghost",onClick:()=>g(i),children:a(`ui.teamBridge.kind.${i}`)},i))]}),c!=="dm"&&e.jsxs("span",{className:"flex flex-col gap-1 text-[13px] text-ink-muted",children:[a("ui.teamBridge.create.name"),e.jsx(Q,{value:x,onChange:i=>v(i.target.value),"aria-label":a("ui.teamBridge.create.name"),maxLength:128})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] text-ink-muted",children:a("ui.teamBridge.create.members")}),h.map((i,f)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Q,{value:i.account_id,onChange:j=>w(f,{account_id:j.target.value}),placeholder:a("ui.teamBridge.create.account_placeholder"),"aria-label":a("ui.teamBridge.create.member_account"),className:"flex-1"}),e.jsx(Q,{value:i.display_label,onChange:j=>w(f,{display_label:j.target.value}),placeholder:a("ui.teamBridge.create.member_name"),"aria-label":a("ui.teamBridge.create.member_name"),maxLength:64,className:"flex-1"}),e.jsxs("select",{value:i.kind,onChange:j=>w(f,{kind:j.target.value}),"aria-label":a("ui.teamBridge.create.member_kind"),className:"h-8 rounded-md border border-hairline bg-surface px-1 text-[13px]",children:[e.jsx("option",{value:"human",children:a("ui.teamBridge.create.member_person")}),e.jsx("option",{value:"agent",children:a("ui.teamBridge.create.member_agent")})]}),e.jsx(y,{type:"button",size:"icon-sm",variant:"ghost","aria-label":a("ui.teamBridge.create.remove_member"),onClick:()=>o(j=>j.filter((b,N)=>N!==f)),children:e.jsx(Xe,{size:14})})]},i.rowId)),e.jsxs(y,{type:"button",size:"sm",variant:"ghost",onClick:()=>o(i=>[...i,{account_id:"",kind:"human",display_label:"",rowId:crypto.randomUUID()}]),children:[e.jsx($,{size:14}),a("ui.teamBridge.create.add_member")]})]}),n&&e.jsx("p",{role:"alert",className:"text-[13px] text-danger",children:n}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(y,{type:"button",variant:"ghost",onClick:d,children:a("ui.teamBridge.create.cancel")}),e.jsx(y,{type:"button",variant:"primary",disabled:!M||s,onClick:()=>m({kind:c,...x.trim()?{name:x.trim()}:{},visibility:c==="channel"?"tenant":"private",agentCapable:h.some(i=>i.kind==="agent"),members:h.filter(i=>i.account_id.trim()&&i.display_label.trim())}),children:a("ui.teamBridge.create.confirm")})]})]})})},ca=({organizations:t,scope:d,onScopeChange:m,totalUnread:s,membershipsLoading:n=!1,organizationsFailed:c=!1,defaultOpen:g=!1,onRetry:x})=>{R();const v=we(t,d),h=d===I?a("ui.teamBridge.scope.all"):v?.name??a("ui.teamBridge.scope.unknown");return e.jsxs(pe,{defaultOpen:g,children:[e.jsx(he,{asChild:!0,children:e.jsxs("button",{type:"button","aria-label":a("ui.teamBridge.scope.trigger",{name:h}),title:h,className:k("group flex h-[30px] min-w-0 flex-1 items-center gap-2 rounded-md px-2","text-left text-[13px] text-ink transition-colors duration-fast","hover:bg-row-hover data-[state=open]:bg-row-hover"),children:[e.jsx(ta,{size:16,"aria-hidden":"true",className:"shrink-0 text-ink-muted"}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:h}),e.jsx(Ye,{size:14,"aria-hidden":"true",className:"shrink-0 text-ink-dim"})]})}),e.jsxs(ge,{align:"start",className:"w-64",children:[e.jsx(L,{children:a("ui.teamBridge.scope.label")}),e.jsxs(ve,{value:d,onValueChange:o=>m(_e(o)),children:[e.jsxs(X,{value:I,children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:a("ui.teamBridge.scope.all")}),s>0&&e.jsx(q,{variant:"attentionQuiet",size:"count","aria-label":a("ui.teamBridge.unread.count",{count:s}),title:a("ui.teamBridge.unread.count",{count:s}),children:Y(s,99)})]}),t.length>0&&e.jsx(je,{}),t.map(o=>e.jsxs(X,{value:o.tenantId,children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:o.name}),e.jsx("span",{className:"shrink-0 text-meta-sm text-ink-dim capitalize",children:o.role}),o.unread>0&&e.jsx(q,{variant:"attentionQuiet",size:"count","aria-label":a("ui.teamBridge.unread.count",{count:o.unread}),title:a("ui.teamBridge.unread.count",{count:o.unread}),children:Y(o.unread,99)})]},o.tenantId))]}),n&&e.jsx(L,{children:a("ui.teamBridge.scope.loading")}),!n&&c&&e.jsxs(e.Fragment,{children:[e.jsx(L,{children:a("ui.teamBridge.scope.error")}),x&&e.jsx(fe,{onSelect:()=>x(),children:a("ui.teamBridge.list.retry")})]}),!n&&!c&&t.length===0&&e.jsx(L,{children:a("ui.teamBridge.scope.empty")})]})]})},oa=({conversation:t,selected:d,selfAccountId:m,organizationName:s,showOrganization:n,onSelect:c})=>{const g=R(),x=Ue(t),v=x==="hash"?sa:x==="users"?aa:He,h=me(t,m)??a("ui.teamBridge.list.untitled"),o=t.unread_count,w=W(t),M=Ge(t),i=t.last_message_at?ma(t.last_message_at,g):"";return e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:c,"aria-current":d?"page":void 0,"data-conversation-id":t.id,"data-conversation-tenant":t.tenant_id,className:k("flex w-full items-center gap-2 rounded-md px-2 text-left","transition-colors duration-fast ease-out-quart",n?"min-h-[38px] py-1":"h-[30px]",d?"bg-row-selected text-ink":"text-ink-muted hover:bg-row-hover hover:text-ink"),children:[e.jsx(v,{size:16,"aria-hidden":"true",className:"shrink-0"}),e.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px]",children:h}),w&&e.jsx(q,{variant:"attentionQuiet",className:"shrink-0",children:a("ui.teamBridge.preview.chip")}),M&&e.jsxs("span",{className:"shrink-0 text-ink-dim",title:a("ui.teamBridge.notify.muted"),children:[e.jsx(be,{size:12,"aria-hidden":"true"}),e.jsx("span",{className:"sr-only",children:a("ui.teamBridge.notify.muted")})]}),i&&!n&&e.jsx("span",{className:"min-w-0 truncate text-meta-sm text-ink-dim",children:i}),o>0&&e.jsx("span",{className:"ml-1 inline-flex shrink-0",children:e.jsx(q,{variant:"attentionQuiet",shape:"pill",size:"count","aria-label":a("ui.teamBridge.unread.count",{count:o}),children:Y(o,99)})})]}),n&&e.jsxs("span",{className:"mt-0.5 flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{className:"truncate rounded-sm border border-control bg-elevated px-1 text-meta-sm text-ink-dim",children:s??a("ui.teamBridge.scope.unknown")}),i&&e.jsx("span",{className:"shrink-0 text-meta-sm text-ink-dim",children:i})]})]})]})})};function ma(t,d){const m=Date.parse(t);if(Number.isNaN(m))return"";const s=Math.round((m-Date.now())/6e4);if(Math.abs(s)<60)return J(s,"minute",{numeric:"auto"},d);const n=Math.round(s/60);return Math.abs(n)<24?J(n,"hour",{numeric:"auto"},d):J(Math.round(n/24),"day",{numeric:"auto"},d)}const ua=({message:t,selfAccountId:d})=>{const m=t.sender.account_id===d,s=t.sender.kind==="agent",n=new Date(t.created_at);return e.jsxs("li",{className:k("flex gap-2 px-1",m&&"flex-row-reverse text-right"),children:[e.jsx("span",{className:k("mt-0.5 flex size-6 shrink-0 items-center justify-center rounded-full",s?"bg-accent-wash text-accent":"bg-sunken text-ink-muted"),"aria-hidden":"true",children:s?e.jsx(ue,{size:14}):t.sender.display_label[0]??"?"}),e.jsxs("div",{className:k("min-w-0 max-w-[min(72ch,80%)]",m&&"items-end"),children:[e.jsxs("div",{className:k("flex items-baseline gap-2 text-[12px] text-ink-dim",m&&"justify-end"),children:[e.jsx("span",{className:"truncate font-medium text-ink-muted",children:t.sender.display_label}),s&&e.jsx(q,{variant:"accent",shape:"pill",size:"count",children:a("ui.teamBridge.member.agent")}),e.jsx("time",{dateTime:t.created_at,children:Number.isNaN(n.getTime())?"":n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})})]}),e.jsx("p",{className:k("mt-0.5 whitespace-pre-wrap break-words rounded-md text-[13px] leading-relaxed",m?"bg-accent-wash px-2.5 py-1.5 text-ink":"text-ink"),children:t.body??e.jsx("span",{className:"text-ink-dim italic",children:a("ui.teamBridge.thread.withheld")})})]})]})},xa=({listState:t,messageState:d,conversations:m,selected:s,messages:n,organizations:c,scope:g,totalUnread:x,membershipsLoading:v=!1,organizationsFailed:h=!1,selfAccountId:o,sending:w=!1,sendFailed:M=!1,joining:i=!1,joinFailed:f=!1,notifyFailed:j=!1,onJoin:b,onNotifyChange:N,defaultMenuOpen:A=!1,initialDraft:G="",onSelect:D,onSend:u,onNewConversation:V,onRetry:T,onScopeChange:z,onRetryMemberships:P})=>{R();const[O,S]=p.useState(G),E=p.useRef(null),_=p.useMemo(()=>Ce(n),[n]),r=g===I,B=s!==null&&W(s),C=p.useMemo(()=>oe(m,g,c),[m,g,c]),H=s?re(s,c):null,K=r&&s!==null&&H===null,U="team-bridge-create-hint",Z=r;p.useEffect(()=>{E.current?.scrollIntoView({block:"end"})},[s?.id,_.length]);const F=p.useRef(null),ee=()=>{const l=O.trim();if(!l||w)return;const ae=F.current?.body===l?F.current.clientRef:crypto.randomUUID(),te={body:l,clientRef:ae};F.current=te;const se=u(l,ae),ie=()=>{F.current===te&&(F.current=null),S(ne=>ne.trim()===l?"":ne)};se instanceof Promise?se.then(ie).catch(()=>{}):ie()};return e.jsxs("div",{"data-glass-region":"canvas",className:"flex h-full min-h-0 w-full overflow-hidden",children:[e.jsxs("aside",{"data-glass-region":"page-sidebar",className:"flex w-72 shrink-0 flex-col",children:[e.jsx("h1",{className:"sr-only",children:a("ui.teamBridge.page.title")}),e.jsxs("header",{className:"flex h-11 shrink-0 items-center gap-2 px-3",children:[e.jsx(ca,{organizations:c,scope:g,onScopeChange:z,totalUnread:x,membershipsLoading:v,organizationsFailed:h,onRetry:P}),e.jsx(y,{size:"icon-sm",variant:"ghost","aria-label":a("ui.teamBridge.page.new_conversation"),"aria-disabled":r||void 0,"aria-describedby":Z?U:void 0,className:r?"text-ink-disabled hover:bg-transparent":void 0,onClick:()=>{r||V()},children:e.jsx($,{size:16})})]}),r&&(C.length>0||t!=="ready")&&e.jsx("p",{id:U,className:"px-3 pb-2 text-[12px] text-ink-dim",children:a("ui.teamBridge.scope.create_needs_org")}),e.jsxs(de,{className:"min-h-0 flex-1",children:[t==="loading"&&e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(ce,{size:"sm",label:a("ui.teamBridge.list.loading")})}),t==="error"&&e.jsxs("div",{className:"flex flex-col items-start gap-2 px-3 py-6",children:[e.jsx("p",{className:"text-[13px] text-ink-muted",children:a("ui.teamBridge.list.error")}),T&&e.jsx(y,{size:"sm",variant:"outline",onClick:T,children:a("ui.teamBridge.list.retry")})]}),t==="ready"&&C.length>0&&e.jsx("ul",{className:"flex flex-col gap-0.5 px-1 pb-2",children:C.map(l=>e.jsx(oa,{conversation:l,selected:s?.id===l.id,selfAccountId:o,showOrganization:r,organizationName:r?re(l,c):void 0,onSelect:()=>D(l.id)},l.id))})]})]}),e.jsx("section",{className:"flex min-w-0 flex-1 flex-col bg-surface",children:s===null?t==="ready"?e.jsx("div",{className:"flex flex-1 items-center justify-center px-6",children:e.jsxs("div",{className:"max-w-sm text-center",children:[e.jsx("p",{className:"font-medium text-[13px] text-ink",children:a("ui.teamBridge.list.empty.title")}),e.jsx("p",{id:r&&t==="ready"&&C.length===0?U:void 0,className:"mt-1 text-[13px] text-ink-muted",children:r&&t==="ready"&&C.length===0?a("ui.teamBridge.scope.create_needs_org"):a("ui.teamBridge.list.empty.body")}),e.jsxs(y,{size:"sm",variant:"primary",className:r?"mt-3 opacity-60":"mt-3","aria-disabled":r||void 0,"aria-describedby":Z?U:void 0,onClick:()=>{r||V()},children:[e.jsx($,{size:14}),a("ui.teamBridge.page.new_conversation")]})]})}):null:e.jsxs(e.Fragment,{children:[e.jsxs("header",{className:"flex h-11 shrink-0 items-center gap-2 px-3",children:[e.jsx("h2",{className:"min-w-0 truncate font-medium text-[13px] text-ink",children:me(s,o)??a("ui.teamBridge.list.untitled")}),r&&H&&e.jsx("span",{className:"shrink-0 rounded-sm bg-elevated px-1.5 py-0.5 text-meta-sm text-ink-dim",children:H}),e.jsx("span",{className:"shrink-0 text-meta-sm text-ink-dim",children:a("ui.teamBridge.member.count",{count:Me(s)})}),e.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[Te(s).filter(l=>l.state==="active").slice(0,6).map(l=>e.jsx("span",{className:k("flex size-5 items-center justify-center rounded-full text-[10px]",l.kind==="agent"?"bg-accent-wash text-accent":"bg-sunken text-ink-muted"),title:l.display_label,children:l.kind==="agent"?e.jsx(ue,{size:12,"aria-hidden":"true"}):l.display_label[0]??"?"},`${l.kind}:${l.account_id}`)),!B&&N&&e.jsx(la,{conversation:s,onNotifyChange:N,defaultOpen:A})]})]}),j&&e.jsx("p",{role:"alert",className:"px-3 pb-1 text-[12px] text-danger",children:a("ui.teamBridge.notify.error")}),e.jsx(de,{className:"min-h-0 flex-1 [&_[data-radix-scroll-area-viewport]>div]:block [&_[data-radix-scroll-area-viewport]>div]:h-full",children:e.jsx("div",{className:"flex h-full flex-col",children:B?e.jsx(pa,{joining:i,joinFailed:f,onJoin:b}):e.jsxs(e.Fragment,{children:[d==="loading"&&e.jsx("div",{className:"flex items-center justify-center py-10",children:e.jsx(ce,{size:"sm",label:a("ui.teamBridge.thread.loading")})}),d==="error"&&e.jsx("p",{className:"px-4 py-8 text-[13px] text-ink-muted",children:a("ui.teamBridge.thread.error")}),K&&e.jsx("p",{className:"px-4 py-8 text-[13px] text-ink-muted",children:a("ui.teamBridge.scope.thread_unknown")}),!K&&d==="ready"&&_.length===0&&e.jsx("p",{className:"px-4 py-10 text-center text-[13px] text-ink-muted",children:a("ui.teamBridge.thread.empty")}),!K&&d==="ready"&&_.length>0&&e.jsxs("ul",{className:"mt-auto flex flex-col gap-3 px-4 py-4",children:[_.map(l=>e.jsx(ua,{message:l,selfAccountId:o},l.id)),e.jsx("div",{ref:E})]})]})})}),!B&&e.jsxs("div",{className:"shrink-0 px-3 pb-3",children:[M&&e.jsx("p",{role:"alert",className:"px-2 pb-1 text-[12px] text-danger",children:a("ui.teamBridge.composer.error")}),e.jsxs("div",{className:k("rounded-xl bg-elevated","transition-colors duration-fast ease-out-quart","has-[textarea:focus-visible]:outline-solid has-[textarea:focus-visible]:outline-2","has-[textarea:focus-visible]:outline-accent has-[textarea:focus-visible]:outline-offset-2"),children:[e.jsx("textarea",{value:O,onChange:l=>S(l.target.value),onKeyDown:l=>{l.key==="Enter"&&!l.shiftKey&&!l.nativeEvent.isComposing&&(l.preventDefault(),ee())},rows:1,placeholder:a("ui.teamBridge.composer.placeholder"),"aria-label":a("ui.teamBridge.composer.placeholder"),className:k("block max-h-40 min-h-9 w-full resize-none bg-transparent px-3 pt-2.5 pb-1","text-[13px] text-ink placeholder:text-ink-dim","outline-none")}),e.jsxs("div",{className:"flex items-center gap-2 px-2 pb-2",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate pl-1 text-meta-sm text-ink-dim",children:a("ui.teamBridge.composer.hint")}),e.jsx(y,{size:"icon-sm",variant:"primary",className:"rounded-full",disabled:!O.trim()||w,"aria-label":a("ui.teamBridge.composer.send"),onClick:ee,children:e.jsx(Ze,{size:16})})]})]})]})]})})]})},pa=({joining:t=!1,joinFailed:d=!1,onJoin:m})=>(R(),e.jsx("div",{className:"flex flex-1 items-center justify-center px-6 py-10",children:e.jsxs("div",{className:"flex max-w-md flex-col items-center gap-3 text-center",children:[e.jsx("p",{className:"text-[13px] text-ink",children:a("ui.teamBridge.preview.banner")}),d&&e.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:a("ui.teamBridge.preview.join_error")}),e.jsx(y,{type:"button",size:"sm",variant:"primary",disabled:t,onClick:m,children:a("ui.teamBridge.preview.join")})]})})),Ba=()=>{const[t,d]=ea(),m=t.get("conversation"),s=t.get("tenant"),[n,c]=p.useState(()=>s?le(s):I),g=p.useRef(!!s),x=Se(),v=Ie(!0,I),h=p.useMemo(()=>De(x.memberships,v.data?.organizations),[x.memberships,v.data]),o=ze(n),M=Ee().data??void 0,[i,f]=p.useState(()=>m),[j,b]=p.useState(!1),N=o.data?.conversations??[],A=n===I;p.useEffect(()=>{!m||!s||(g.current=!0,c(le(s)),f(m),b(!1),d({},{replace:!0}))},[m,s,d]);const G=r=>{g.current=!0,c(r),f(null),b(!1)};p.useEffect(()=>{c(r=>Re(h,r,g.current))},[h]);const D=p.useMemo(()=>oe(N,n,h),[N,n,h]);p.useEffect(()=>{i===null&&D.length>0&&f(D[0].id)},[D,i]);const u=D.find(r=>r.id===i)??null,V=u!==null&&W(u),T=Pe(V?null:u?.id??null,u?.tenant_id),z=Oe(u?.id??"",u?.tenant_id),P=Fe(n===I?void 0:n),O=Le(u?.id??"",u?.tenant_id),S=qe(u?.id??"",u?.tenant_id),E=Ae();p.useEffect(()=>{z.reset(),S.reset(),E.reset()},[u?.id]);const _=T.data?.messages.reduce((r,B)=>r===void 0||B.seq>r?B.seq:r,void 0);return p.useEffect(()=>{u===null||_===void 0||_<=u.last_read_seq||O.mutate({seq:_})},[u?.id,_]),e.jsxs(e.Fragment,{children:[e.jsx(xa,{listState:o.isPending||A&&x.isLoading?"loading":o.isError||A&&x.isError?"error":"ready",messageState:u===null?"idle":T.isPending?"loading":T.isError?"error":"ready",conversations:N,selected:u,messages:T.data?.messages??[],organizations:h,scope:n,totalUnread:v.data?.total??0,membershipsLoading:x.isLoading,organizationsFailed:x.isError,selfAccountId:M,sending:z.isPending,sendFailed:z.isError,joining:S.isPending,joinFailed:S.isError,notifyFailed:Ve(E,u?.id??null),onJoin:()=>S.mutate(),onNotifyChange:r=>{u!==null&&E.mutate({conversationId:u.id,tenantId:u.tenant_id,notify:r})},onSelect:f,onSend:(r,B)=>{if(u!==null)return z.mutateAsync({clientRef:B,body:r})},onNewConversation:()=>b(!0),onRetry:()=>{o.refetch(),x.isError&&x.refetch()},onScopeChange:G,onRetryMemberships:()=>{x.refetch()}}),e.jsx(da,{open:j,pending:P.isPending,error:P.isError?a("ui.teamBridge.create.error"):void 0,onClose:()=>b(!1),onCreate:r=>{P.mutate(r,{onSuccess:B=>{b(!1);const C=B;C.id&&f(C.id)}})}})]})};export{Ba as TeamBridgePage,xa as TeamBridgePageView,pa as TeamBridgePreviewBanner};
|