local-operator-ui 0.54.1 → 0.54.2
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/renderer/assets/{agent-details-page-VqTezyZQ.js → agent-details-page-r7XsOsut.js} +1 -1
- package/out/renderer/assets/{agent-hub-page-BdmdeZ9-.js → agent-hub-page-DupbEbG4.js} +1 -1
- package/out/renderer/assets/{agents-page-BIkXtdsZ.js → agents-page-hfglkUdb.js} +3 -3
- package/out/renderer/assets/{avatar-cropper-cVo3b0Am.js → avatar-cropper-Da10lKtU.js} +1 -1
- package/out/renderer/assets/{browser-page-2hApOquI.js → browser-page-DQ_gmVXl.js} +1 -1
- package/out/renderer/assets/{browser-webauthn-prompt-uvOW0PVn.js → browser-webauthn-prompt-Bz1_5kqL.js} +1 -1
- package/out/renderer/assets/{index-BWr5Qxzh.js → index-CpBVFG4F.js} +2 -2
- package/out/renderer/assets/{legacy-agents-page-BRN4TSXW.js → legacy-agents-page-Bs8qpukA.js} +1 -1
- package/out/renderer/assets/{library-page-B6GdFXB9.js → library-page-BLG4EkzG.js} +3 -3
- package/out/renderer/assets/{mesh-page-CqPglNbN.js → mesh-page-BtOLRam5.js} +1 -1
- package/out/renderer/assets/{notifications-page-DqYuwhBz.js → notifications-page-BIX8K6xg.js} +1 -1
- package/out/renderer/assets/{org-access-DgfPe_pd.js → org-access-CIjrfPW5.js} +1 -1
- package/out/renderer/assets/{projects-page-BwoHYhLO.js → projects-page-C_CUMJSf.js} +1 -1
- package/out/renderer/assets/{publication-validation-Cmbe1C9x.js → publication-validation-Dl95qnyh.js} +1 -1
- package/out/renderer/assets/{radient-auth-buttons-BW2Y_w80.js → radient-auth-buttons-Dez2dTCx.js} +1 -1
- package/out/renderer/assets/{schedules-page-BUsz5UvW.js → schedules-page-D_JgXQSr.js} +1 -1
- package/out/renderer/assets/{settings-page-B4riMU5w.js → settings-page-Q631XSK_.js} +1 -1
- package/out/renderer/assets/{smartart-hgPTFSyx.js → smartart-BRwLTdz6.js} +1 -1
- package/out/renderer/assets/{team-bridge-page-qWl7PO20.js → team-bridge-page-BdFE0KY8.js} +2 -2
- package/out/renderer/assets/{team-bridge-scope-preference-CjrTyJLW.js → team-bridge-scope-preference-BoQ9Urzi.js} +1 -1
- package/out/renderer/assets/{use-download-agent-mutation-BEja5w1L.js → use-download-agent-mutation-DyxllOvY.js} +1 -1
- package/out/renderer/index.html +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as v,j as s,c as E}from"./index-C6-RmJN4.js";import{y as J,z as Y,D as V,E as X,G as C,H as K,I as Z,J as M,K as L,L as ee,M as te,O as ie,Q as A,T as se}from"./index-BWr5Qxzh.js";import{u as w,B as k,h as ae,n as ne,o as le,z as re,p as oe,F as ue,G as ce}from"./error-boundary-UYiQxpgl.js";import{t as r}from"./messages-DDxK-jTd.js";import{M as l,h as P,u as x,a as U,c as F,r as B,d as I,N as H,O as de}from"./appearance-06MzzYY4.js";import{bB as W,b2 as m,bv as N}from"./conversation-input-sync-IYrZgM7R.js";const S=e=>e==null?"":typeof e=="string"?e:JSON.stringify(e,null,2),be={available:"border-hairline",updating:"border-hairline",applied:"border-hairline",review:"border-warning-border",failed:"border-danger-border"};function pe(e){const t=[];for(const i of e??[])for(const n of i.fields??[])for(const a of n.regions??[])(a.provenance==="unresolved"||S(a.local)!==S(a.remote))&&t.push({field:n.field,region:a});return t}function he({regions:e}){return w(),e.length?s.jsx("ul",{className:"space-y-3","data-testid":"hub-update-preview",children:e.map(({field:t,region:i},n)=>s.jsxs("li",{className:"space-y-1 text-meta",children:[s.jsx("p",{className:"font-medium text-ink",children:i.heading||i.name||t}),s.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-ink-muted",children:r("ui.agents.navigation.updates.preview.local")}),s.jsx("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap rounded-sm border border-hairline p-2 text-ink",children:S(i.local)||r("ui.agents.navigation.updates.preview.nothing")})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-ink-muted",children:r("ui.agents.navigation.updates.preview.remote")}),s.jsx("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap rounded-sm border border-hairline p-2 text-ink",children:S(i.remote)||r("ui.agents.navigation.updates.preview.nothing")})]})]})]},`${t}:${i.id??n}`))}):s.jsx("p",{className:"text-meta text-ink-muted",children:r("ui.agents.navigation.updates.preview.empty")})}function He({kind:e,name:t,enabled:i}){w();const n=J(i),a=Y(),[u,p]=v.useState(null),g=X(e,t),f=V(n.data).get(g),d=C(f),b=a.notes[g],o=a.pending.has(g);if(!f||!d)return b?s.jsx("section",{"data-testid":"hub-update-panel","aria-label":r("ui.agents.navigation.updates.accessible"),className:"mb-8 rounded-md border border-hairline p-3 text-body-sm",children:s.jsx("p",{role:b.tone==="error"?"alert":"status",className:b.tone==="error"?"text-danger":"text-ink",children:b.message})}):null;const h=d.kind==="review",c=f.classification==="baseline-unknown",y=q=>({prefer:q,acknowledgeUnknownBaseline:c}),G=async()=>{const q=await a.applyItem(e,t,{...y(),dryRun:!0});p(q??[])};return s.jsxs("section",{"data-testid":"hub-update-panel","aria-label":r("ui.agents.navigation.updates.accessible"),className:E("mb-8 space-y-2 rounded-md border p-3 text-body-sm",be[d.kind]),children:[s.jsxs("p",{className:"flex items-start gap-2 text-ink",children:[s.jsx(K,{mark:d,className:"mt-0.5"}),s.jsx("span",{className:E(d.kind==="failed"&&"text-danger"),children:Z(f,d)})]}),a.upgradeMessage&&s.jsx("output",{className:"block text-meta text-warning","data-hub-core-upgrade":!0,children:a.upgradeMessage}),h&&c&&s.jsx("p",{className:"text-meta text-ink-muted",children:r("ui.agents.navigation.updates.baseline_unknown")}),h&&!c&&s.jsx("p",{className:"text-meta text-ink-muted",children:r("ui.agents.navigation.updates.merge_guidance")}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[d.kind==="available"&&s.jsx(k,{size:"sm",variant:"outline","aria-disabled":o||!a.canWrite||void 0,onClick:()=>!o&&a.canWrite&&void a.applyItem(e,t),children:o?r("ui.agents.navigation.updates.action.updating"):r("ui.agents.navigation.updates.action.update")}),d.kind==="failed"&&d.retryable&&s.jsx(k,{size:"sm",variant:"outline","aria-disabled":o||!a.canWrite||void 0,onClick:()=>!o&&a.canWrite&&void a.retryItem(e,t),children:o?r("ui.agents.navigation.updates.action.retrying"):r("ui.agents.navigation.updates.action.retry")}),h&&s.jsxs(s.Fragment,{children:[s.jsx(k,{size:"sm",variant:"outline","aria-disabled":o||!a.canWrite||void 0,onClick:()=>!o&&a.canWrite&&void G(),children:o&&!u?r("ui.agents.navigation.updates.action.loading"):r("ui.agents.navigation.updates.action.preview")}),s.jsx(k,{size:"sm",variant:"ghost","aria-disabled":o||!a.canWrite||void 0,onClick:()=>!o&&a.canWrite&&void a.applyItem(e,t,y("local")),children:r("ui.agents.navigation.updates.action.keep_local")}),s.jsx(k,{size:"sm",variant:"ghost","aria-disabled":o||!a.canWrite||void 0,onClick:()=>!o&&a.canWrite&&void a.applyItem(e,t,y("remote")),children:r("ui.agents.navigation.updates.action.use_remote")})]})]}),u&&h&&s.jsx(he,{regions:pe(u)}),b&&s.jsx("p",{role:b.tone==="error"?"alert":"status",className:b.tone==="error"?"text-meta text-danger":"text-meta text-ink-muted",children:b.message})]})}const ge=/\/+$/;function Q(e){const t=e.replace(ge,"");try{const{pathname:i}=new URL(t);return i===""||i==="/"?`${t}/v1`:t}catch{return`${t}/v1`}}function me(e){const t=Array.isArray(e.files)?e.files.flatMap(a=>{const u=a;return u&&typeof u=="object"&&typeof u.path=="string"?[{path:u.path,content:typeof u.content=="string"?u.content:""}]:[]}):[],i=e.bundle&&typeof e.bundle=="object"?e.bundle:null,n=i?.file_count;return{...e,files:t,bundle:i,file_count:typeof n=="number"&&Number.isFinite(n)&&n>=0?n:t.length}}const $=e=>({...e,result:e.result?me(e.result):e.result}),Oe=e=>e?.skills===1&&e.revision_cas===1;function fe(e,t=1,i=20){const n=new URL(M(e,"skills"));return n.searchParams.set("page",String(t)),n.searchParams.set("per_page",String(i)),L(n.toString())}function ke(e,t){return L(M(e,"skills",t)).then($)}function ye(e){return W({operation:"org_skills.list",tenantId:e})}function xe(e,t){return W({operation:"org_skill.get",tenantId:e,skillId:t}).then($)}const _e=l.enum(["merge","keep-local","take-hub"]),Ce=l.object({adoption:l.object({state:l.enum(["equal","ready","needs-choice"]),strategy:l.union([_e,l.literal("equal")]).nullable().optional(),files:l.array(l.object({path:l.string(),local_path:l.string().nullable().optional(),action:l.string(),proposed:l.string().nullable(),diff_vs_local:l.string(),diff_vs_hub:l.string(),kept:l.record(l.array(l.string())).optional(),engine:l.object({model:l.string().nullable().optional()}).passthrough().optional(),reason:l.string().nullable().optional()}).passthrough()),model:l.string().nullable().optional(),warnings:l.array(l.string()).optional()}).passthrough(),adoption_receipt:l.string().min(16).max(128),snapshot:l.object({path:l.string().min(1),tree_hash:l.string(),manifest:l.array(l.unknown())}).passthrough(),confirmation_required:l.literal(!0)}).passthrough();function ve(e,t){return!t&&!e.dry_run&&!e.confirmation_required&&e.reports.some(i=>i.applied||i.outcome==="unchanged")}const Se=12,j={all:["public-teams"],list:(e,t)=>[...j.all,"list",{page:e,perPage:t}],detail:e=>[...j.all,"detail",e]},R=(e,t)=>t instanceof ee?t.status===null?!1:t.status>=500&&e<1:e<1,Ke=({page:e=1,perPage:t=Se,enabled:i=!0}={})=>{const n=P({queryKey:j.list(e,t),queryFn:()=>te(m.radientBaseUrl,e,t),select:a=>a.result,enabled:i,retry:R,staleTime:3e5,gcTime:6e5,refetchOnWindowFocus:!1,placeholderData:a=>a});return{...n,teams:n.data?.records??[],isRefreshing:n.isFetching&&n.data!==void 0,pagination:n.data?{page:n.data.page,perPage:n.data.per_page,totalPages:n.data.total_pages,totalRecords:n.data.total_records}:void 0}},Me=({teamId:e,enabled:t=!0})=>{const i=P({queryKey:j.detail(e??""),queryFn:()=>ie(m.radientBaseUrl,e),select:n=>n.result,enabled:t&&!!e,retry:R,staleTime:3e5,gcTime:6e5,refetchOnWindowFocus:!1,retryOnMount:!1});return{...i,team:i.data}};function _(e){if(e.getQueryState(H.capabilities)?.status!=="success"||!F(e.getQueryData(H.capabilities),"hub_skills"))throw new Error("This backend does not support the complete Hub Skills adapter.")}function Le(e,t,i){const n=x(),a=U();return P({queryKey:["hub-skills",m.radientBaseUrl,e.visibility,e.tenantId,t],enabled:i&&!a.isError&&F(a.data,"hub_skills"),queryFn:async()=>{if(_(n),e.visibility==="org"){const p=(await ye(e.tenantId)).result;return{rows:p.skills,pages:1,total:p.skills.length,contract:p.sync_contract}}const u=(await fe(m.radientBaseUrl,t,20)).result;return{rows:u.records,pages:u.total_pages,total:u.total_records,contract:u.sync_contract}},staleTime:3e4,retry:e.visibility==="org"?B:R,retryOnMount:!1,refetchOnWindowFocus:!1})}function Ue(e,t,i){const n=x(),a=U();return P({queryKey:["hub-skill",m.radientBaseUrl,e.visibility,e.tenantId,t],enabled:i&&t!==null&&!a.isError&&F(a.data,"hub_skills"),queryFn:async()=>(_(n),(e.visibility==="org"?await xe(e.tenantId,t):await ke(m.radientBaseUrl,t)).result),staleTime:3e4,retry:e.visibility==="org"?B:R,retryOnMount:!1})}function D(e,t){e.setQueryData(A,t.links)}function T(e){e.invalidateQueries({queryKey:A}),e.invalidateQueries({queryKey:["desktop","skills"]})}function Be(e={}){const t=x();return N({...e.retry===void 0?{}:{retry:e.retry},mutationFn:i=>(_(t),I({op:"hub.skillPull",requestId:i.requestId,hubId:i.remoteId,hubSource:Q(m.radientBaseUrl),visibility:i.scope.visibility,tenantId:i.scope.tenantId,localAlias:i.alias,subscribe:i.subscribe,autoPush:i.autoPush,confirmPublicEgress:i.consent,...i.dryRun!==void 0?{dryRun:i.dryRun}:{},...i.adoptionStrategy!==void 0?{adoptionStrategy:i.adoptionStrategy}:{},...i.allowLlm!==void 0?{allowLlm:i.allowLlm}:{},...i.confirm!==void 0?{confirm:i.confirm}:{},...i.adoptionReceipt!==void 0?{adoptionReceipt:i.adoptionReceipt}:{}})),onSuccess:(i,n)=>{ve(i,n.dryRun)&&D(t,i)},onSettled:(i,n,a)=>{!a.dryRun&&!i?.dry_run&&!i?.confirmation_required&&T(t)}})}function We(){const e=x();return N({mutationFn:t=>(_(e),I({op:"hub.skillSubscribe",requestId:t.requestId,hubId:t.remoteId,hubSource:Q(m.radientBaseUrl),visibility:t.scope.visibility,tenantId:t.scope.tenantId,localAlias:t.alias})),onSuccess:t=>{D(e,t)},onSettled:()=>{T(e)}})}function Qe(){const e=x();return N({mutationFn:t=>(_(e),I({op:"hub.skillUnpull",requestId:t.requestId,linkId:t.linkId})),onSuccess:t=>{D(e,t)},onSettled:()=>{T(e)}})}function $e(){const e=x();return N({mutationFn:t=>(_(e),I({op:"hub.skillPublish",requestId:t.requestId,...t.draft,dryRun:t.previewReceipt===void 0,...t.previewReceipt?{previewReceipt:t.previewReceipt,confirmPublish:!0}:{}})),onSuccess:t=>{t.local_link_receipt?.state==="complete"&&(e.invalidateQueries({queryKey:A}),e.invalidateQueries({queryKey:["desktop","skills"]}),e.invalidateQueries({queryKey:["hub-skills"]}))}})}const je=/\/+$/;function O(e){return e.replace(je,"")}function ze(e,t){return t.visibility==="public"?e.visibility==="public"&&!e.tenant_id:e.visibility==="org"&&e.tenant_id===t.tenantId}function we(e){const t=e.id??e.hub_id??"",i=e.tenantId??e.tenant_id??"";return`${t}\0${e.visibility}\0${i}`}function Ge(e,t){const i=O(t),n=new Map;for(const a of e??[])a.kind==="skill"&&O(a.hub_source)===i&&n.set(we({hub_id:a.hub_id,visibility:a.visibility,tenantId:a.tenant_id}),a);return n}function Je(e,t,i=!0){if(!i)return{kind:"unknown"};if(!e)return{kind:"not-present"};const n=se(e);return n==="present"&&(e.pull.state==="available"||t?.state==="available"&&!t.error_class)?{kind:"update",link:e,automatic:t?.auto_will_apply===!0||e.auto_will_apply}:n==="absent"?e.policy.subscribe?{kind:"subscribed",link:e}:{kind:"detached",link:e}:e.policy.subscribe?{kind:"pulled",link:e}:{kind:"manual",link:e}}function Ye(e){return e?"policy":"create"}function Ve(e){return JSON.stringify({op:"pull",selected:e.selected,scope:e.scope,localAlias:e.localAlias,subscribe:e.subscribe,autoPush:e.autoPush,consent:e.consent})}const Pe={available:"text-accent",applied:"text-success",failed:"text-danger",review:"text-warning",updating:"text-ink-muted"},Ie={available:"ui.hub.skills.update_available",applied:"ui.hub.skills.update_applied",failed:"ui.hub.skills.update_failed",review:"ui.hub.links.mark_review",updating:"ui.hub.links.mark_busy"},Ne={"not-present":"ui.hub.skills.not_downloaded",subscribed:"ui.hub.skills.subscribed_absent",pulled:"ui.hub.skills.pulled",manual:"ui.hub.skills.manual",detached:"ui.hub.skills.detached"};function Xe(e,t,i){const n=t?C(t):null;return n&&(e.kind==="update"||i&&(t?.state==="applied"||t?.state==="failed"||t?.error_class))?n:e.kind==="update"?{kind:"available",auto:e.automatic}:null}function Ze(e,t){return e.kind==="unknown"?t:e.kind!=="update"?r(Ne[e.kind]):r(e.link.policy.subscribe?"ui.hub.skills.pulled":"ui.hub.skills.manual")}function et({mark:e,className:t,labels:i}){return w(),e?s.jsxs("span",{"data-hub-mark-state":e.kind,className:E("flex shrink-0 items-center gap-1 text-meta",Pe[e.kind],t),children:[s.jsx(K,{mark:e}),s.jsx("span",{children:r(i?.[e.kind]??Ie[e.kind])})]}):null}const tt=()=>({subscribe:!0,autoPush:!1,confirmPublicEgress:!1});function it({value:e,onChange:t,source:i,item:n,visibility:a,organization:u,destinationKey:p,canEnableAutoPush:g,disabled:f=!1}){w();const d=v.useId(),b=v.useRef(null),[o,h]=v.useState(null);return v.useEffect(()=>{o!==null&&o!==p&&h(null)},[o,p]),s.jsxs("div",{className:"flex flex-col gap-3","data-initial-hub-policy":!0,children:[s.jsx("p",{className:"text-meta text-ink-muted",children:r("ui.hub.skills.initial_policy_description")}),["subscribe","autoPush"].map(c=>s.jsxs("label",{htmlFor:`${d}-${c}`,className:"flex items-start gap-3 text-body-sm text-ink",children:[s.jsx(ae,{id:`${d}-${c}`,checked:e[c],disabled:f||c==="autoPush"&&!g&&!e.autoPush,onCheckedChange:y=>{c==="subscribe"?t({...e,subscribe:y===!0}):y!==!0?t({...e,autoPush:!1,confirmPublicEgress:!1}):g&&h(p)}}),s.jsxs("span",{children:[s.jsx("span",{className:"block",children:r(c==="subscribe"?"ui.hub.subscriptions.subscribe":"ui.hub.subscriptions.auto_push")}),s.jsx("span",{className:"block text-meta text-ink-muted",children:r(c==="subscribe"?"ui.hub.subscriptions.subscribe_description":"ui.hub.subscriptions.auto_push_description",{source:i})})]})]},c)),!g&&s.jsx("p",{className:"text-meta text-ink-muted",children:r("ui.hub.subscriptions.unsupported")}),s.jsx(ne,{open:o!==null,onOpenChange:c=>{c||h(null)},children:s.jsxs(le,{onOpenAutoFocus:c=>{c.preventDefault(),b.current?.focus()},children:[s.jsxs(re,{children:[s.jsx(oe,{children:r("ui.hub.subscriptions.enable_title",{source:i})}),s.jsx(ue,{children:a==="public"?r("ui.hub.subscriptions.enable_public",{item:n}):r("ui.hub.subscriptions.enable_private",{item:n,organization:u??i})})]}),s.jsx("p",{className:"text-body-sm text-ink-muted",children:r("ui.hub.subscriptions.enable_safety")}),s.jsxs(ce,{children:[s.jsx(k,{ref:b,"data-testid":"hub-policy-cancel",variant:"outline",onClick:()=>h(null),children:r("ui.hub.subscriptions.cancel")}),s.jsx(k,{"data-testid":"hub-policy-enable",disabled:f||!g||o!==p,onClick:()=>{t({...e,autoPush:!0,confirmPublicEgress:a==="public"}),h(null)},children:r("ui.hub.subscriptions.enable")})]})]})})]})}function st(e,t,i=Date.now()){return e.can_confirm===!0&&e.kind==="skill"&&e.direction==="push"&&e.publication==="create"&&e.proposal?.kind==="skill"&&e.proposal.fields?.document_version===1&&e.preview_receipt.length>0&&e.local_fingerprint.length>0&&e.draft_fingerprint.length>0&&e.proposal_fingerprint.length>0&&e.source_skill===t.sourceSkill&&e.local_alias===t.localAlias&&e.visibility===t.visibility&&e.tenant_id===t.tenantId&&e.policy?.subscribe===t.subscribe&&e.policy?.auto_push===t.autoPush&&e.policy?.confirm_public_egress===t.confirmPublicEgress&&Number.isFinite(Date.parse(e.expires_at))&&Date.parse(e.expires_at)>i}function at(e){return e.local_link_receipt?.state==="complete"&&!!e.link&&e.local_link_receipt.link_id===e.link.link_id&&typeof e.link.policy?.subscribe=="boolean"&&typeof e.link.policy.auto_push=="boolean"&&typeof e.link.policy.revision=="string"&&e.link.policy.revision.length>0}const Re=e=>e==="active"||e==="past_due",z=e=>e.status!=="active"?"no_access":Re(e.plan.status)?"available":"plan_inactive",nt=e=>e.filter(t=>z(t)==="available"),lt=e=>e.filter(t=>z(t)==="plan_inactive"),rt=e=>{if(!(e instanceof de))return null;switch(e.code){case"team_plan_required":return"plan";case"not_a_member":case"insufficient_role":return"no_access";default:return null}};export{lt as A,it as H,Se as P,et as S,Ce as a,$e as b,Le as c,Ue as d,We as e,Qe as f,Ge as g,Oe as h,st as i,Q as j,ze as k,we as l,Je as m,tt as n,Xe as o,at as p,Ze as q,He as r,ve as s,Ve as t,Be as u,Ye as v,rt as w,Ke as x,Me as y,nt as z};
|
|
1
|
+
import{r as v,j as s,c as E}from"./index-C6-RmJN4.js";import{y as J,z as Y,D as V,E as X,G as C,H as K,I as Z,J as M,K as L,L as ee,M as te,O as ie,Q as A,T as se}from"./index-CpBVFG4F.js";import{u as w,B as k,h as ae,n as ne,o as le,z as re,p as oe,F as ue,G as ce}from"./error-boundary-UYiQxpgl.js";import{t as r}from"./messages-DDxK-jTd.js";import{M as l,h as P,u as x,a as U,c as F,r as B,d as I,N as H,O as de}from"./appearance-06MzzYY4.js";import{bB as W,b2 as m,bv as N}from"./conversation-input-sync-IYrZgM7R.js";const S=e=>e==null?"":typeof e=="string"?e:JSON.stringify(e,null,2),be={available:"border-hairline",updating:"border-hairline",applied:"border-hairline",review:"border-warning-border",failed:"border-danger-border"};function pe(e){const t=[];for(const i of e??[])for(const n of i.fields??[])for(const a of n.regions??[])(a.provenance==="unresolved"||S(a.local)!==S(a.remote))&&t.push({field:n.field,region:a});return t}function he({regions:e}){return w(),e.length?s.jsx("ul",{className:"space-y-3","data-testid":"hub-update-preview",children:e.map(({field:t,region:i},n)=>s.jsxs("li",{className:"space-y-1 text-meta",children:[s.jsx("p",{className:"font-medium text-ink",children:i.heading||i.name||t}),s.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-ink-muted",children:r("ui.agents.navigation.updates.preview.local")}),s.jsx("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap rounded-sm border border-hairline p-2 text-ink",children:S(i.local)||r("ui.agents.navigation.updates.preview.nothing")})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-ink-muted",children:r("ui.agents.navigation.updates.preview.remote")}),s.jsx("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap rounded-sm border border-hairline p-2 text-ink",children:S(i.remote)||r("ui.agents.navigation.updates.preview.nothing")})]})]})]},`${t}:${i.id??n}`))}):s.jsx("p",{className:"text-meta text-ink-muted",children:r("ui.agents.navigation.updates.preview.empty")})}function He({kind:e,name:t,enabled:i}){w();const n=J(i),a=Y(),[u,p]=v.useState(null),g=X(e,t),f=V(n.data).get(g),d=C(f),b=a.notes[g],o=a.pending.has(g);if(!f||!d)return b?s.jsx("section",{"data-testid":"hub-update-panel","aria-label":r("ui.agents.navigation.updates.accessible"),className:"mb-8 rounded-md border border-hairline p-3 text-body-sm",children:s.jsx("p",{role:b.tone==="error"?"alert":"status",className:b.tone==="error"?"text-danger":"text-ink",children:b.message})}):null;const h=d.kind==="review",c=f.classification==="baseline-unknown",y=q=>({prefer:q,acknowledgeUnknownBaseline:c}),G=async()=>{const q=await a.applyItem(e,t,{...y(),dryRun:!0});p(q??[])};return s.jsxs("section",{"data-testid":"hub-update-panel","aria-label":r("ui.agents.navigation.updates.accessible"),className:E("mb-8 space-y-2 rounded-md border p-3 text-body-sm",be[d.kind]),children:[s.jsxs("p",{className:"flex items-start gap-2 text-ink",children:[s.jsx(K,{mark:d,className:"mt-0.5"}),s.jsx("span",{className:E(d.kind==="failed"&&"text-danger"),children:Z(f,d)})]}),a.upgradeMessage&&s.jsx("output",{className:"block text-meta text-warning","data-hub-core-upgrade":!0,children:a.upgradeMessage}),h&&c&&s.jsx("p",{className:"text-meta text-ink-muted",children:r("ui.agents.navigation.updates.baseline_unknown")}),h&&!c&&s.jsx("p",{className:"text-meta text-ink-muted",children:r("ui.agents.navigation.updates.merge_guidance")}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[d.kind==="available"&&s.jsx(k,{size:"sm",variant:"outline","aria-disabled":o||!a.canWrite||void 0,onClick:()=>!o&&a.canWrite&&void a.applyItem(e,t),children:o?r("ui.agents.navigation.updates.action.updating"):r("ui.agents.navigation.updates.action.update")}),d.kind==="failed"&&d.retryable&&s.jsx(k,{size:"sm",variant:"outline","aria-disabled":o||!a.canWrite||void 0,onClick:()=>!o&&a.canWrite&&void a.retryItem(e,t),children:o?r("ui.agents.navigation.updates.action.retrying"):r("ui.agents.navigation.updates.action.retry")}),h&&s.jsxs(s.Fragment,{children:[s.jsx(k,{size:"sm",variant:"outline","aria-disabled":o||!a.canWrite||void 0,onClick:()=>!o&&a.canWrite&&void G(),children:o&&!u?r("ui.agents.navigation.updates.action.loading"):r("ui.agents.navigation.updates.action.preview")}),s.jsx(k,{size:"sm",variant:"ghost","aria-disabled":o||!a.canWrite||void 0,onClick:()=>!o&&a.canWrite&&void a.applyItem(e,t,y("local")),children:r("ui.agents.navigation.updates.action.keep_local")}),s.jsx(k,{size:"sm",variant:"ghost","aria-disabled":o||!a.canWrite||void 0,onClick:()=>!o&&a.canWrite&&void a.applyItem(e,t,y("remote")),children:r("ui.agents.navigation.updates.action.use_remote")})]})]}),u&&h&&s.jsx(he,{regions:pe(u)}),b&&s.jsx("p",{role:b.tone==="error"?"alert":"status",className:b.tone==="error"?"text-meta text-danger":"text-meta text-ink-muted",children:b.message})]})}const ge=/\/+$/;function Q(e){const t=e.replace(ge,"");try{const{pathname:i}=new URL(t);return i===""||i==="/"?`${t}/v1`:t}catch{return`${t}/v1`}}function me(e){const t=Array.isArray(e.files)?e.files.flatMap(a=>{const u=a;return u&&typeof u=="object"&&typeof u.path=="string"?[{path:u.path,content:typeof u.content=="string"?u.content:""}]:[]}):[],i=e.bundle&&typeof e.bundle=="object"?e.bundle:null,n=i?.file_count;return{...e,files:t,bundle:i,file_count:typeof n=="number"&&Number.isFinite(n)&&n>=0?n:t.length}}const $=e=>({...e,result:e.result?me(e.result):e.result}),Oe=e=>e?.skills===1&&e.revision_cas===1;function fe(e,t=1,i=20){const n=new URL(M(e,"skills"));return n.searchParams.set("page",String(t)),n.searchParams.set("per_page",String(i)),L(n.toString())}function ke(e,t){return L(M(e,"skills",t)).then($)}function ye(e){return W({operation:"org_skills.list",tenantId:e})}function xe(e,t){return W({operation:"org_skill.get",tenantId:e,skillId:t}).then($)}const _e=l.enum(["merge","keep-local","take-hub"]),Ce=l.object({adoption:l.object({state:l.enum(["equal","ready","needs-choice"]),strategy:l.union([_e,l.literal("equal")]).nullable().optional(),files:l.array(l.object({path:l.string(),local_path:l.string().nullable().optional(),action:l.string(),proposed:l.string().nullable(),diff_vs_local:l.string(),diff_vs_hub:l.string(),kept:l.record(l.array(l.string())).optional(),engine:l.object({model:l.string().nullable().optional()}).passthrough().optional(),reason:l.string().nullable().optional()}).passthrough()),model:l.string().nullable().optional(),warnings:l.array(l.string()).optional()}).passthrough(),adoption_receipt:l.string().min(16).max(128),snapshot:l.object({path:l.string().min(1),tree_hash:l.string(),manifest:l.array(l.unknown())}).passthrough(),confirmation_required:l.literal(!0)}).passthrough();function ve(e,t){return!t&&!e.dry_run&&!e.confirmation_required&&e.reports.some(i=>i.applied||i.outcome==="unchanged")}const Se=12,j={all:["public-teams"],list:(e,t)=>[...j.all,"list",{page:e,perPage:t}],detail:e=>[...j.all,"detail",e]},R=(e,t)=>t instanceof ee?t.status===null?!1:t.status>=500&&e<1:e<1,Ke=({page:e=1,perPage:t=Se,enabled:i=!0}={})=>{const n=P({queryKey:j.list(e,t),queryFn:()=>te(m.radientBaseUrl,e,t),select:a=>a.result,enabled:i,retry:R,staleTime:3e5,gcTime:6e5,refetchOnWindowFocus:!1,placeholderData:a=>a});return{...n,teams:n.data?.records??[],isRefreshing:n.isFetching&&n.data!==void 0,pagination:n.data?{page:n.data.page,perPage:n.data.per_page,totalPages:n.data.total_pages,totalRecords:n.data.total_records}:void 0}},Me=({teamId:e,enabled:t=!0})=>{const i=P({queryKey:j.detail(e??""),queryFn:()=>ie(m.radientBaseUrl,e),select:n=>n.result,enabled:t&&!!e,retry:R,staleTime:3e5,gcTime:6e5,refetchOnWindowFocus:!1,retryOnMount:!1});return{...i,team:i.data}};function _(e){if(e.getQueryState(H.capabilities)?.status!=="success"||!F(e.getQueryData(H.capabilities),"hub_skills"))throw new Error("This backend does not support the complete Hub Skills adapter.")}function Le(e,t,i){const n=x(),a=U();return P({queryKey:["hub-skills",m.radientBaseUrl,e.visibility,e.tenantId,t],enabled:i&&!a.isError&&F(a.data,"hub_skills"),queryFn:async()=>{if(_(n),e.visibility==="org"){const p=(await ye(e.tenantId)).result;return{rows:p.skills,pages:1,total:p.skills.length,contract:p.sync_contract}}const u=(await fe(m.radientBaseUrl,t,20)).result;return{rows:u.records,pages:u.total_pages,total:u.total_records,contract:u.sync_contract}},staleTime:3e4,retry:e.visibility==="org"?B:R,retryOnMount:!1,refetchOnWindowFocus:!1})}function Ue(e,t,i){const n=x(),a=U();return P({queryKey:["hub-skill",m.radientBaseUrl,e.visibility,e.tenantId,t],enabled:i&&t!==null&&!a.isError&&F(a.data,"hub_skills"),queryFn:async()=>(_(n),(e.visibility==="org"?await xe(e.tenantId,t):await ke(m.radientBaseUrl,t)).result),staleTime:3e4,retry:e.visibility==="org"?B:R,retryOnMount:!1})}function D(e,t){e.setQueryData(A,t.links)}function T(e){e.invalidateQueries({queryKey:A}),e.invalidateQueries({queryKey:["desktop","skills"]})}function Be(e={}){const t=x();return N({...e.retry===void 0?{}:{retry:e.retry},mutationFn:i=>(_(t),I({op:"hub.skillPull",requestId:i.requestId,hubId:i.remoteId,hubSource:Q(m.radientBaseUrl),visibility:i.scope.visibility,tenantId:i.scope.tenantId,localAlias:i.alias,subscribe:i.subscribe,autoPush:i.autoPush,confirmPublicEgress:i.consent,...i.dryRun!==void 0?{dryRun:i.dryRun}:{},...i.adoptionStrategy!==void 0?{adoptionStrategy:i.adoptionStrategy}:{},...i.allowLlm!==void 0?{allowLlm:i.allowLlm}:{},...i.confirm!==void 0?{confirm:i.confirm}:{},...i.adoptionReceipt!==void 0?{adoptionReceipt:i.adoptionReceipt}:{}})),onSuccess:(i,n)=>{ve(i,n.dryRun)&&D(t,i)},onSettled:(i,n,a)=>{!a.dryRun&&!i?.dry_run&&!i?.confirmation_required&&T(t)}})}function We(){const e=x();return N({mutationFn:t=>(_(e),I({op:"hub.skillSubscribe",requestId:t.requestId,hubId:t.remoteId,hubSource:Q(m.radientBaseUrl),visibility:t.scope.visibility,tenantId:t.scope.tenantId,localAlias:t.alias})),onSuccess:t=>{D(e,t)},onSettled:()=>{T(e)}})}function Qe(){const e=x();return N({mutationFn:t=>(_(e),I({op:"hub.skillUnpull",requestId:t.requestId,linkId:t.linkId})),onSuccess:t=>{D(e,t)},onSettled:()=>{T(e)}})}function $e(){const e=x();return N({mutationFn:t=>(_(e),I({op:"hub.skillPublish",requestId:t.requestId,...t.draft,dryRun:t.previewReceipt===void 0,...t.previewReceipt?{previewReceipt:t.previewReceipt,confirmPublish:!0}:{}})),onSuccess:t=>{t.local_link_receipt?.state==="complete"&&(e.invalidateQueries({queryKey:A}),e.invalidateQueries({queryKey:["desktop","skills"]}),e.invalidateQueries({queryKey:["hub-skills"]}))}})}const je=/\/+$/;function O(e){return e.replace(je,"")}function ze(e,t){return t.visibility==="public"?e.visibility==="public"&&!e.tenant_id:e.visibility==="org"&&e.tenant_id===t.tenantId}function we(e){const t=e.id??e.hub_id??"",i=e.tenantId??e.tenant_id??"";return`${t}\0${e.visibility}\0${i}`}function Ge(e,t){const i=O(t),n=new Map;for(const a of e??[])a.kind==="skill"&&O(a.hub_source)===i&&n.set(we({hub_id:a.hub_id,visibility:a.visibility,tenantId:a.tenant_id}),a);return n}function Je(e,t,i=!0){if(!i)return{kind:"unknown"};if(!e)return{kind:"not-present"};const n=se(e);return n==="present"&&(e.pull.state==="available"||t?.state==="available"&&!t.error_class)?{kind:"update",link:e,automatic:t?.auto_will_apply===!0||e.auto_will_apply}:n==="absent"?e.policy.subscribe?{kind:"subscribed",link:e}:{kind:"detached",link:e}:e.policy.subscribe?{kind:"pulled",link:e}:{kind:"manual",link:e}}function Ye(e){return e?"policy":"create"}function Ve(e){return JSON.stringify({op:"pull",selected:e.selected,scope:e.scope,localAlias:e.localAlias,subscribe:e.subscribe,autoPush:e.autoPush,consent:e.consent})}const Pe={available:"text-accent",applied:"text-success",failed:"text-danger",review:"text-warning",updating:"text-ink-muted"},Ie={available:"ui.hub.skills.update_available",applied:"ui.hub.skills.update_applied",failed:"ui.hub.skills.update_failed",review:"ui.hub.links.mark_review",updating:"ui.hub.links.mark_busy"},Ne={"not-present":"ui.hub.skills.not_downloaded",subscribed:"ui.hub.skills.subscribed_absent",pulled:"ui.hub.skills.pulled",manual:"ui.hub.skills.manual",detached:"ui.hub.skills.detached"};function Xe(e,t,i){const n=t?C(t):null;return n&&(e.kind==="update"||i&&(t?.state==="applied"||t?.state==="failed"||t?.error_class))?n:e.kind==="update"?{kind:"available",auto:e.automatic}:null}function Ze(e,t){return e.kind==="unknown"?t:e.kind!=="update"?r(Ne[e.kind]):r(e.link.policy.subscribe?"ui.hub.skills.pulled":"ui.hub.skills.manual")}function et({mark:e,className:t,labels:i}){return w(),e?s.jsxs("span",{"data-hub-mark-state":e.kind,className:E("flex shrink-0 items-center gap-1 text-meta",Pe[e.kind],t),children:[s.jsx(K,{mark:e}),s.jsx("span",{children:r(i?.[e.kind]??Ie[e.kind])})]}):null}const tt=()=>({subscribe:!0,autoPush:!1,confirmPublicEgress:!1});function it({value:e,onChange:t,source:i,item:n,visibility:a,organization:u,destinationKey:p,canEnableAutoPush:g,disabled:f=!1}){w();const d=v.useId(),b=v.useRef(null),[o,h]=v.useState(null);return v.useEffect(()=>{o!==null&&o!==p&&h(null)},[o,p]),s.jsxs("div",{className:"flex flex-col gap-3","data-initial-hub-policy":!0,children:[s.jsx("p",{className:"text-meta text-ink-muted",children:r("ui.hub.skills.initial_policy_description")}),["subscribe","autoPush"].map(c=>s.jsxs("label",{htmlFor:`${d}-${c}`,className:"flex items-start gap-3 text-body-sm text-ink",children:[s.jsx(ae,{id:`${d}-${c}`,checked:e[c],disabled:f||c==="autoPush"&&!g&&!e.autoPush,onCheckedChange:y=>{c==="subscribe"?t({...e,subscribe:y===!0}):y!==!0?t({...e,autoPush:!1,confirmPublicEgress:!1}):g&&h(p)}}),s.jsxs("span",{children:[s.jsx("span",{className:"block",children:r(c==="subscribe"?"ui.hub.subscriptions.subscribe":"ui.hub.subscriptions.auto_push")}),s.jsx("span",{className:"block text-meta text-ink-muted",children:r(c==="subscribe"?"ui.hub.subscriptions.subscribe_description":"ui.hub.subscriptions.auto_push_description",{source:i})})]})]},c)),!g&&s.jsx("p",{className:"text-meta text-ink-muted",children:r("ui.hub.subscriptions.unsupported")}),s.jsx(ne,{open:o!==null,onOpenChange:c=>{c||h(null)},children:s.jsxs(le,{onOpenAutoFocus:c=>{c.preventDefault(),b.current?.focus()},children:[s.jsxs(re,{children:[s.jsx(oe,{children:r("ui.hub.subscriptions.enable_title",{source:i})}),s.jsx(ue,{children:a==="public"?r("ui.hub.subscriptions.enable_public",{item:n}):r("ui.hub.subscriptions.enable_private",{item:n,organization:u??i})})]}),s.jsx("p",{className:"text-body-sm text-ink-muted",children:r("ui.hub.subscriptions.enable_safety")}),s.jsxs(ce,{children:[s.jsx(k,{ref:b,"data-testid":"hub-policy-cancel",variant:"outline",onClick:()=>h(null),children:r("ui.hub.subscriptions.cancel")}),s.jsx(k,{"data-testid":"hub-policy-enable",disabled:f||!g||o!==p,onClick:()=>{t({...e,autoPush:!0,confirmPublicEgress:a==="public"}),h(null)},children:r("ui.hub.subscriptions.enable")})]})]})})]})}function st(e,t,i=Date.now()){return e.can_confirm===!0&&e.kind==="skill"&&e.direction==="push"&&e.publication==="create"&&e.proposal?.kind==="skill"&&e.proposal.fields?.document_version===1&&e.preview_receipt.length>0&&e.local_fingerprint.length>0&&e.draft_fingerprint.length>0&&e.proposal_fingerprint.length>0&&e.source_skill===t.sourceSkill&&e.local_alias===t.localAlias&&e.visibility===t.visibility&&e.tenant_id===t.tenantId&&e.policy?.subscribe===t.subscribe&&e.policy?.auto_push===t.autoPush&&e.policy?.confirm_public_egress===t.confirmPublicEgress&&Number.isFinite(Date.parse(e.expires_at))&&Date.parse(e.expires_at)>i}function at(e){return e.local_link_receipt?.state==="complete"&&!!e.link&&e.local_link_receipt.link_id===e.link.link_id&&typeof e.link.policy?.subscribe=="boolean"&&typeof e.link.policy.auto_push=="boolean"&&typeof e.link.policy.revision=="string"&&e.link.policy.revision.length>0}const Re=e=>e==="active"||e==="past_due",z=e=>e.status!=="active"?"no_access":Re(e.plan.status)?"available":"plan_inactive",nt=e=>e.filter(t=>z(t)==="available"),lt=e=>e.filter(t=>z(t)==="plan_inactive"),rt=e=>{if(!(e instanceof de))return null;switch(e.code){case"team_plan_required":return"plan";case"not_a_member":case"insufficient_role":return"no_access";default:return null}};export{lt as A,it as H,Se as P,et as S,Ce as a,$e as b,Le as c,Ue as d,We as e,Qe as f,Ge as g,Oe as h,st as i,Q as j,ze as k,we as l,Je as m,tt as n,Xe as o,at as p,Ze as q,He as r,ve as s,Ve as t,Be as u,Ye as v,rt as w,Ke as x,Me as y,nt as z};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as t,c as R,r as d,u as Fn}from"./index-C6-RmJN4.js";import{t as n}from"./messages-DDxK-jTd.js";import{h as hs,d as _e,at as qn,r as gs,u as Un,n as V,aj as Tt,m as Bn,av as $n,aw as zn,ax as Ve,ay as Gn,O as Ft,a as rt,c as ye,s as qt,az as es,x as Rt,ao as Yn,y as Kn,w as Hn,z as Wn,G as Vn,q as Xn,t as Jn}from"./appearance-06MzzYY4.js";import{c as ft,u as L,U as Xe,x as Ut,V as Je,W as Qe,Y as Ze,Z as Oe,B as G,D as xs,b as bs,S as Te,d as vs,e as be,ad as Qn,ae as Zn,af as ea,l as ta,m as sa,I as ra,i as ke,a8 as ys,aj as ws,aa as ks,K as ue,X as Bt,a as Ns,s as Sr,L as pe,a0 as Cr,h as Er,n as na,o as aa,p as oa,A as ts,M as ia,N as ca,O as la,P as ua,f as Ke}from"./error-boundary-UYiQxpgl.js";import{bv as $e,d2 as Bs,az as $s,d3 as zs,c6 as da,ay as ve,d4 as pa,a1 as Tr,aR as _t,bz as et,d5 as ma,cL as fa,bC as Rr,bA as Dt,cc as _a,bf as ja,cC as ha,ct as ga,cs as xa,cr as Gs,co as ba,d6 as va,d0 as ya,cN as wa,cK as ka,cM as Na,aF as le,d7 as Dr,d8 as Ar,cT as $t,d9 as Ue,da as Sa,db as jt,cX as Ca,cY as Ys,dc as ht,dd as Pr,cU as Ea,de as Ta,df as Or,bw as Ra,b5 as Da,b6 as Aa,b7 as Pa,b8 as Oa,b9 as Ma,dg as Ia,dh as Mr,c5 as La,di as Fa,be as qa}from"./conversation-input-sync-IYrZgM7R.js";import{P as Ks}from"./page-header-D1Bi0Lq9.js";import{b_ as Ua,bI as Ir,b$ as Ba,c0 as $a,bQ as za,a as dt,A as Hs,c1 as Lr,F as Ws,R as Ga}from"./index-
|
|
1
|
+
import{j as t,c as R,r as d,u as Fn}from"./index-C6-RmJN4.js";import{t as n}from"./messages-DDxK-jTd.js";import{h as hs,d as _e,at as qn,r as gs,u as Un,n as V,aj as Tt,m as Bn,av as $n,aw as zn,ax as Ve,ay as Gn,O as Ft,a as rt,c as ye,s as qt,az as es,x as Rt,ao as Yn,y as Kn,w as Hn,z as Wn,G as Vn,q as Xn,t as Jn}from"./appearance-06MzzYY4.js";import{c as ft,u as L,U as Xe,x as Ut,V as Je,W as Qe,Y as Ze,Z as Oe,B as G,D as xs,b as bs,S as Te,d as vs,e as be,ad as Qn,ae as Zn,af as ea,l as ta,m as sa,I as ra,i as ke,a8 as ys,aj as ws,aa as ks,K as ue,X as Bt,a as Ns,s as Sr,L as pe,a0 as Cr,h as Er,n as na,o as aa,p as oa,A as ts,M as ia,N as ca,O as la,P as ua,f as Ke}from"./error-boundary-UYiQxpgl.js";import{bv as $e,d2 as Bs,az as $s,d3 as zs,c6 as da,ay as ve,d4 as pa,a1 as Tr,aR as _t,bz as et,d5 as ma,cL as fa,bC as Rr,bA as Dt,cc as _a,bf as ja,cC as ha,ct as ga,cs as xa,cr as Gs,co as ba,d6 as va,d0 as ya,cN as wa,cK as ka,cM as Na,aF as le,d7 as Dr,d8 as Ar,cT as $t,d9 as Ue,da as Sa,db as jt,cX as Ca,cY as Ys,dc as ht,dd as Pr,cU as Ea,de as Ta,df as Or,bw as Ra,b5 as Da,b6 as Aa,b7 as Pa,b8 as Oa,b9 as Ma,dg as Ia,dh as Mr,c5 as La,di as Fa,be as qa}from"./conversation-input-sync-IYrZgM7R.js";import{P as Ks}from"./page-header-D1Bi0Lq9.js";import{b_ as Ua,bI as Ir,b$ as Ba,c0 as $a,bQ as za,a as dt,A as Hs,c1 as Lr,F as Ws,R as Ga}from"./index-CpBVFG4F.js";import{o as Fr}from"./console-mirror-DV8lF0jT.js";import{P as tt}from"./project-markdown-C5wSF-31.js";import{u as Ya}from"./use-session-snapshot-BD1Gk4L3.js";import"./roles-D1pcbxAx.js";/**
|
|
2
2
|
* @license lucide-react v0.507.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f,g as v,p as c,P as w,h as A,r as L,i as T,j as P,k as R,l as N}from"./appearance-06MzzYY4.js";import{T as S,U as E,V as O}from"./conversation-input-sync-IYrZgM7R.js";import{t as e}from"./messages-DDxK-jTd.js";import"./index-C6-RmJN4.js";import{l as U,b as j}from"./index-BWr5Qxzh.js";const h={get malware_or_exploitation(){return e("ui.agents.publication.category.malware_or_exploitation")},get credential_theft(){return e("ui.agents.publication.category.credential_theft")},get fraud_or_deception(){return e("ui.agents.publication.category.fraud_or_deception")},get harassment_or_hate(){return e("ui.agents.publication.category.harassment_or_hate")},get sexual_content_minors(){return e("ui.agents.publication.category.sexual_content_minors")},get sexual_content(){return e("ui.agents.publication.category.sexual_content")},get violence_or_weapons(){return e("ui.agents.publication.category.violence_or_weapons")},get drugs_or_controlled_substances(){return e("ui.agents.publication.category.drugs_or_controlled_substances")},get self_harm(){return e("ui.agents.publication.category.self_harm")},get mass_surveillance_or_privacy_abuse(){return e("ui.agents.publication.category.mass_surveillance_or_privacy_abuse")},get evasion_or_abuse_tooling(){return e("ui.agents.publication.category.evasion_or_abuse_tooling")},get prompt_injection(){return e("ui.agents.publication.category.prompt_injection")},get unclear_dual_use(){return e("ui.agents.publication.category.unclear_dual_use")},get other_harmful(){return e("ui.agents.publication.category.other_harmful")}},q=n=>{const t=n.trim();return t.length>12&&/\s/.test(t)&&!/^(not found|bad request|unauthorized|error|internal server error)\.?$/i.test(t)};function C(n){const t=n?.categories?.[0];return t&&O(t)?h[t]:h.other_harmful}function k(n,t){const i=t?.rule?.trim()??"";switch(t?.field){case"name":return{body:i?e("ui.agents.publication.invalid.field.name_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.name"),field:"name"};case"instructions":return{body:i?e("ui.agents.publication.invalid.field.instructions_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.instructions",{max:String(w)}),field:"instructions"};case"description":return{body:i?e("ui.agents.publication.invalid.field.description_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.description"),field:"description"};case"tools":return{body:i?e("ui.agents.publication.invalid.field.tools_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.tools"),field:"tools"};case"when_to_use":return{body:i?e("ui.agents.publication.invalid.field.when_to_use_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.when_to_use"),field:"when_to_use"};case"categories":return{body:i?e("ui.agents.publication.invalid.field.categories_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.categories"),field:"categories"};case"tags":return{body:i?e("ui.agents.publication.invalid.field.tags_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.tags"),field:"tags"};default:return{body:n,field:null}}}function Y(n,t){const i=t.surface==="pull",o=t.name.trim(),a=o||(i?e("ui.agents.publication.subject.team"):e("ui.agents.publication.subject.agent"));switch(n.code){case"name_taken":return n.details?.owned_by_caller===!0?{variant:"danger",headline:e("ui.agents.publication.name_taken.owned_headline"),body:e("ui.agents.publication.name_taken.owned_body",{name:a}),note:null,actions:n.details?.existing_agent_id||t.hubAgentId?["update-listing","focus-name"]:["focus-name"]}:{variant:"danger",headline:e("ui.agents.publication.name_taken.headline"),body:e("ui.agents.publication.name_taken.body",{name:a}),note:null,actions:["focus-name"]};case"name_claim_in_flight":return{variant:"warning",headline:e("ui.agents.publication.name_claim_in_flight.headline"),body:e("ui.agents.publication.name_claim_in_flight.body",{name:a}),note:null,actions:["retry"]};case"name_reserved_builtin":{const u=n.details?.builtin_name,l=u?c(u)===c(a):!1;return{variant:"danger",headline:e("ui.agents.publication.name_reserved_builtin.headline"),body:u&&!l?e("ui.agents.publication.name_reserved_builtin.body",{name:a,builtin:u}):e("ui.agents.publication.name_reserved_builtin.body_same_name",{builtin:u??a}),note:null,actions:["focus-name","install-builtin"]}}case"moderation_rejected":return{variant:"danger",headline:e("ui.agents.publication.moderation_rejected.headline"),body:n.details?.reason?.trim()||n.message,note:C(n.details),actions:["edit-instructions"]};case"moderation_unavailable":return{variant:"warning",headline:e("ui.agents.publication.moderation_unavailable.headline"),body:e("ui.agents.publication.moderation_unavailable.body"),note:null,actions:["retry"]};case"invalid_instruction_set":{const{body:u,field:l}=k(n.message,n.details);return{variant:"danger",headline:e("ui.agents.publication.invalid.headline"),body:u,note:null,actions:l==="name"?["focus-name"]:l==="instructions"?["edit-instructions"]:["edit-agent"]}}case"payload_too_large":{const u=n.details?.limit_bytes;return{variant:"danger",headline:e("ui.agents.publication.payload_too_large.headline"),body:u?e("ui.agents.publication.payload_too_large.body_with_limit",{size:String(Math.round(u/1024))}):e("ui.agents.publication.payload_too_large.body"),note:null,actions:["edit-instructions"]}}case"not_owner":return{variant:"danger",headline:e("ui.agents.publication.not_owner.headline"),body:e("ui.agents.publication.not_owner.body"),note:null,actions:["publish-as-new"]};case"agent_not_found":return{variant:"danger",headline:e("ui.agents.publication.agent_not_found.headline"),body:e("ui.agents.publication.agent_not_found.body"),note:null,actions:["publish-as-new","refresh-hub"]};case"hub_unauthorized":return{variant:"danger",headline:e("ui.agents.publication.hub_unauthorized.headline"),body:i?e("ui.agents.publication.hub_unauthorized.body_pull"):e("ui.agents.publication.hub_unauthorized.body"),note:null,actions:["sign-in"]};case"hub_unavailable":return{variant:"warning",headline:i?e("ui.agents.publication.hub_unavailable.headline_pull"):e("ui.agents.publication.hub_unavailable.headline"),body:q(n.message)?n.message:i?e("ui.agents.publication.hub_unavailable.body_pull"):e("ui.agents.publication.hub_unavailable.body"),note:null,actions:["retry"]};case"local_failure":return{variant:"warning",headline:i?e("ui.agents.publication.local_failure.headline_pull"):e("ui.agents.publication.local_failure.headline"),body:n.message,note:null,actions:["retry"]};case"team_plan_required":return{variant:"warning",headline:e("ui.agents.publication.team_plan_required.headline"),body:i?e("ui.agents.publication.team_plan_required.body_pull"):e("ui.agents.publication.team_plan_required.body"),note:null,actions:["retry","open-console"]};case"not_a_member":return{variant:"danger",headline:e("ui.agents.publication.not_a_member.headline"),body:i?e("ui.agents.publication.not_a_member.body_pull"):e("ui.agents.publication.not_a_member.body"),note:null,actions:[]};case"insufficient_role":{const u=n.details?.required;return{variant:"danger",headline:e("ui.agents.publication.insufficient_role.headline"),body:u?e(i?"ui.agents.publication.insufficient_role.body_with_role_pull":"ui.agents.publication.insufficient_role.body_with_role",{required:u}):e(i?"ui.agents.publication.insufficient_role.body_pull":"ui.agents.publication.insufficient_role.body"),note:null,actions:[]}}case"team_not_found":return{variant:"danger",headline:e("ui.agents.publication.team_not_found.headline"),body:e("ui.agents.publication.team_not_found.body"),note:null,actions:["refresh-hub"]};default:return{variant:"danger",headline:e("ui.agents.publication.fallback.headline"),body:n.message,note:null,actions:["retry"]}}}const x=[/^(?: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*/],F=/^(\d{3})\b/,I=new Set([404,410]),B=["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"],D=n=>{const t=n.toLowerCase();return B.some(i=>t.includes(i))||E(n)},K=(n,t)=>{const i=t.trim()?e("ui.agents.publication.subject.name",{name:t.trim()}):e("ui.agents.publication.subject.unknown");if(S(n))switch(n.code){case"agent_not_found":return e("ui.agents.publication.pull.not_found",{subject:i});case"hub_unavailable":return e("ui.agents.publication.pull.hub_unavailable",{subject:i});default:return e("ui.agents.publication.pull.refused",{subject:i,reason:n.message})}const o=x.reduce((u,l)=>u.replace(l,""),v(n,"").trim()).trim();if(!o)return e("ui.agents.publication.pull.no_reason",{subject:i});const a=Number(F.exec(o)?.[1]??Number.NaN);return I.has(a)?e("ui.agents.publication.pull.not_found",{subject:i}):D(o)||a===408?e("ui.agents.publication.pull.reach_failure",{subject:i}):a===429?e("ui.agents.publication.pull.busy",{subject:i}):a===401||a===403?e("ui.agents.publication.pull.sign_in_refused",{subject:i}):a>=500?e("ui.agents.publication.pull.incomplete",{subject:i}):a>=400?e("ui.agents.publication.pull.refused_download",{subject:i}):e("ui.agents.publication.pull.prose",{subject:i,reason:o})},M=()=>e("ui.agents.publication.other_action_lead"),Z=(n,t,i)=>n==="download"?K(t,i):f(M(),t),J={get"focus-name"(){return e("ui.agents.publication.action.focus_name")},get"update-listing"(){return e("ui.agents.publication.action.update_listing")},get"install-builtin"(){return e("ui.agents.publication.action.install_builtin")},get retry(){return e("ui.agents.publication.action.retry")},get"edit-instructions"(){return e("ui.agents.publication.action.edit_instructions")},get"edit-agent"(){return e("ui.agents.publication.action.edit_agent")},get"publish-as-new"(){return e("ui.agents.publication.action.publish_as_new")},get"sign-in"(){return e("ui.agents.publication.action.sign_in")},get"refresh-hub"(){return e("ui.agents.publication.action.refresh_hub")},get"open-console"(){return e("ui.chat.radient_session.action.open_console")}},z="download_count",_={all:["public-agents"],list:n=>[..._.all,"list",{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}]},g={all:["org-agents"],list:(n,t)=>[...g.all,"list",n,{page:t.page,perPage:t.perPage,categories:t.categories?.join(",")??void 0,name:t.name??void 0,description:t.description??void 0,sort:t.sort,order:t.order}]},Q=n=>n&&n[0]===g.all[0]?String(n[2]??""):null,ee=n=>n.invalidateQueries({queryKey:_.all}),ne=(n,t)=>n.invalidateQueries({queryKey:t?[...g.all,"list",t]:g.all}),ie=({page:n=1,perPage:t=20,enabled:i=!0,categories:o,name:a,description:u,sort:l=z,order:b="desc",tenantId:d}={})=>{const p={page:n,perPage:t,categories:o,name:a,description:u,sort:l,order:b},y=d?g.list(d,p):_.list(p),r=A({queryKey:y,queryFn:async()=>{const s={};return o&&o.length>0&&(s.categories=o.join(",")),a&&(s.name=a),u&&(s.description=u),s.sort=l,s.order=b,d?await U(d,n,t,s):await j(n,t,s)},select:s=>s.result,enabled:i,retry:L,staleTime:5*60*1e3,gcTime:10*60*1e3,refetchOnWindowFocus:!1,placeholderData:(s,m)=>Q(m?.queryKey)===(d??null)?s:void 0});return{...r,agents:r.data?.records,isRefreshing:r.isFetching&&r.data!==void 0,pagination:r.data?{page:r.data.page,perPage:r.data.per_page,totalPages:r.data.total_pages,totalRecords:r.data.total_records}:void 0}},G={name:"Name",description:"Description",instructions:"The instruction body",tools:"Tools"};function te(n){const t=[],i=(o,a)=>{a&&t.push({field:o,message:`${G[o]} ${a}.`})};return i("name",T(n.name)),i("description",P(n.description)),n.instructions!==null&&i("instructions",R(n.instructions)),i("tools",N(n.tools??[])),t}function ae(n,t){const i=c(n);return t.some(o=>c(o)===i)}function oe(n){for(const t of n??[]){const i=t.indexOf(":");if(i<0||t.slice(0,i).trim().toLowerCase()!=="tools")continue;const o=t.slice(i+1).split(",").map(a=>a.trim()).filter(Boolean);return o.length>0?o:null}return null}function ue(n,t){const i=c(n);return t.find(o=>c(o)===i)??null}export{J as P,Z as a,_ as b,ne as c,ae as d,te as e,ee as i,ue as l,Y as p,oe as t,ie as u};
|
|
1
|
+
import{f,g as v,p as c,P as w,h as A,r as L,i as T,j as P,k as R,l as N}from"./appearance-06MzzYY4.js";import{T as S,U as E,V as O}from"./conversation-input-sync-IYrZgM7R.js";import{t as e}from"./messages-DDxK-jTd.js";import"./index-C6-RmJN4.js";import{l as U,b as j}from"./index-CpBVFG4F.js";const h={get malware_or_exploitation(){return e("ui.agents.publication.category.malware_or_exploitation")},get credential_theft(){return e("ui.agents.publication.category.credential_theft")},get fraud_or_deception(){return e("ui.agents.publication.category.fraud_or_deception")},get harassment_or_hate(){return e("ui.agents.publication.category.harassment_or_hate")},get sexual_content_minors(){return e("ui.agents.publication.category.sexual_content_minors")},get sexual_content(){return e("ui.agents.publication.category.sexual_content")},get violence_or_weapons(){return e("ui.agents.publication.category.violence_or_weapons")},get drugs_or_controlled_substances(){return e("ui.agents.publication.category.drugs_or_controlled_substances")},get self_harm(){return e("ui.agents.publication.category.self_harm")},get mass_surveillance_or_privacy_abuse(){return e("ui.agents.publication.category.mass_surveillance_or_privacy_abuse")},get evasion_or_abuse_tooling(){return e("ui.agents.publication.category.evasion_or_abuse_tooling")},get prompt_injection(){return e("ui.agents.publication.category.prompt_injection")},get unclear_dual_use(){return e("ui.agents.publication.category.unclear_dual_use")},get other_harmful(){return e("ui.agents.publication.category.other_harmful")}},q=n=>{const t=n.trim();return t.length>12&&/\s/.test(t)&&!/^(not found|bad request|unauthorized|error|internal server error)\.?$/i.test(t)};function C(n){const t=n?.categories?.[0];return t&&O(t)?h[t]:h.other_harmful}function k(n,t){const i=t?.rule?.trim()??"";switch(t?.field){case"name":return{body:i?e("ui.agents.publication.invalid.field.name_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.name"),field:"name"};case"instructions":return{body:i?e("ui.agents.publication.invalid.field.instructions_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.instructions",{max:String(w)}),field:"instructions"};case"description":return{body:i?e("ui.agents.publication.invalid.field.description_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.description"),field:"description"};case"tools":return{body:i?e("ui.agents.publication.invalid.field.tools_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.tools"),field:"tools"};case"when_to_use":return{body:i?e("ui.agents.publication.invalid.field.when_to_use_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.when_to_use"),field:"when_to_use"};case"categories":return{body:i?e("ui.agents.publication.invalid.field.categories_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.categories"),field:"categories"};case"tags":return{body:i?e("ui.agents.publication.invalid.field.tags_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.tags"),field:"tags"};default:return{body:n,field:null}}}function Y(n,t){const i=t.surface==="pull",o=t.name.trim(),a=o||(i?e("ui.agents.publication.subject.team"):e("ui.agents.publication.subject.agent"));switch(n.code){case"name_taken":return n.details?.owned_by_caller===!0?{variant:"danger",headline:e("ui.agents.publication.name_taken.owned_headline"),body:e("ui.agents.publication.name_taken.owned_body",{name:a}),note:null,actions:n.details?.existing_agent_id||t.hubAgentId?["update-listing","focus-name"]:["focus-name"]}:{variant:"danger",headline:e("ui.agents.publication.name_taken.headline"),body:e("ui.agents.publication.name_taken.body",{name:a}),note:null,actions:["focus-name"]};case"name_claim_in_flight":return{variant:"warning",headline:e("ui.agents.publication.name_claim_in_flight.headline"),body:e("ui.agents.publication.name_claim_in_flight.body",{name:a}),note:null,actions:["retry"]};case"name_reserved_builtin":{const u=n.details?.builtin_name,l=u?c(u)===c(a):!1;return{variant:"danger",headline:e("ui.agents.publication.name_reserved_builtin.headline"),body:u&&!l?e("ui.agents.publication.name_reserved_builtin.body",{name:a,builtin:u}):e("ui.agents.publication.name_reserved_builtin.body_same_name",{builtin:u??a}),note:null,actions:["focus-name","install-builtin"]}}case"moderation_rejected":return{variant:"danger",headline:e("ui.agents.publication.moderation_rejected.headline"),body:n.details?.reason?.trim()||n.message,note:C(n.details),actions:["edit-instructions"]};case"moderation_unavailable":return{variant:"warning",headline:e("ui.agents.publication.moderation_unavailable.headline"),body:e("ui.agents.publication.moderation_unavailable.body"),note:null,actions:["retry"]};case"invalid_instruction_set":{const{body:u,field:l}=k(n.message,n.details);return{variant:"danger",headline:e("ui.agents.publication.invalid.headline"),body:u,note:null,actions:l==="name"?["focus-name"]:l==="instructions"?["edit-instructions"]:["edit-agent"]}}case"payload_too_large":{const u=n.details?.limit_bytes;return{variant:"danger",headline:e("ui.agents.publication.payload_too_large.headline"),body:u?e("ui.agents.publication.payload_too_large.body_with_limit",{size:String(Math.round(u/1024))}):e("ui.agents.publication.payload_too_large.body"),note:null,actions:["edit-instructions"]}}case"not_owner":return{variant:"danger",headline:e("ui.agents.publication.not_owner.headline"),body:e("ui.agents.publication.not_owner.body"),note:null,actions:["publish-as-new"]};case"agent_not_found":return{variant:"danger",headline:e("ui.agents.publication.agent_not_found.headline"),body:e("ui.agents.publication.agent_not_found.body"),note:null,actions:["publish-as-new","refresh-hub"]};case"hub_unauthorized":return{variant:"danger",headline:e("ui.agents.publication.hub_unauthorized.headline"),body:i?e("ui.agents.publication.hub_unauthorized.body_pull"):e("ui.agents.publication.hub_unauthorized.body"),note:null,actions:["sign-in"]};case"hub_unavailable":return{variant:"warning",headline:i?e("ui.agents.publication.hub_unavailable.headline_pull"):e("ui.agents.publication.hub_unavailable.headline"),body:q(n.message)?n.message:i?e("ui.agents.publication.hub_unavailable.body_pull"):e("ui.agents.publication.hub_unavailable.body"),note:null,actions:["retry"]};case"local_failure":return{variant:"warning",headline:i?e("ui.agents.publication.local_failure.headline_pull"):e("ui.agents.publication.local_failure.headline"),body:n.message,note:null,actions:["retry"]};case"team_plan_required":return{variant:"warning",headline:e("ui.agents.publication.team_plan_required.headline"),body:i?e("ui.agents.publication.team_plan_required.body_pull"):e("ui.agents.publication.team_plan_required.body"),note:null,actions:["retry","open-console"]};case"not_a_member":return{variant:"danger",headline:e("ui.agents.publication.not_a_member.headline"),body:i?e("ui.agents.publication.not_a_member.body_pull"):e("ui.agents.publication.not_a_member.body"),note:null,actions:[]};case"insufficient_role":{const u=n.details?.required;return{variant:"danger",headline:e("ui.agents.publication.insufficient_role.headline"),body:u?e(i?"ui.agents.publication.insufficient_role.body_with_role_pull":"ui.agents.publication.insufficient_role.body_with_role",{required:u}):e(i?"ui.agents.publication.insufficient_role.body_pull":"ui.agents.publication.insufficient_role.body"),note:null,actions:[]}}case"team_not_found":return{variant:"danger",headline:e("ui.agents.publication.team_not_found.headline"),body:e("ui.agents.publication.team_not_found.body"),note:null,actions:["refresh-hub"]};default:return{variant:"danger",headline:e("ui.agents.publication.fallback.headline"),body:n.message,note:null,actions:["retry"]}}}const x=[/^(?: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*/],F=/^(\d{3})\b/,I=new Set([404,410]),B=["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"],D=n=>{const t=n.toLowerCase();return B.some(i=>t.includes(i))||E(n)},K=(n,t)=>{const i=t.trim()?e("ui.agents.publication.subject.name",{name:t.trim()}):e("ui.agents.publication.subject.unknown");if(S(n))switch(n.code){case"agent_not_found":return e("ui.agents.publication.pull.not_found",{subject:i});case"hub_unavailable":return e("ui.agents.publication.pull.hub_unavailable",{subject:i});default:return e("ui.agents.publication.pull.refused",{subject:i,reason:n.message})}const o=x.reduce((u,l)=>u.replace(l,""),v(n,"").trim()).trim();if(!o)return e("ui.agents.publication.pull.no_reason",{subject:i});const a=Number(F.exec(o)?.[1]??Number.NaN);return I.has(a)?e("ui.agents.publication.pull.not_found",{subject:i}):D(o)||a===408?e("ui.agents.publication.pull.reach_failure",{subject:i}):a===429?e("ui.agents.publication.pull.busy",{subject:i}):a===401||a===403?e("ui.agents.publication.pull.sign_in_refused",{subject:i}):a>=500?e("ui.agents.publication.pull.incomplete",{subject:i}):a>=400?e("ui.agents.publication.pull.refused_download",{subject:i}):e("ui.agents.publication.pull.prose",{subject:i,reason:o})},M=()=>e("ui.agents.publication.other_action_lead"),Z=(n,t,i)=>n==="download"?K(t,i):f(M(),t),J={get"focus-name"(){return e("ui.agents.publication.action.focus_name")},get"update-listing"(){return e("ui.agents.publication.action.update_listing")},get"install-builtin"(){return e("ui.agents.publication.action.install_builtin")},get retry(){return e("ui.agents.publication.action.retry")},get"edit-instructions"(){return e("ui.agents.publication.action.edit_instructions")},get"edit-agent"(){return e("ui.agents.publication.action.edit_agent")},get"publish-as-new"(){return e("ui.agents.publication.action.publish_as_new")},get"sign-in"(){return e("ui.agents.publication.action.sign_in")},get"refresh-hub"(){return e("ui.agents.publication.action.refresh_hub")},get"open-console"(){return e("ui.chat.radient_session.action.open_console")}},z="download_count",_={all:["public-agents"],list:n=>[..._.all,"list",{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}]},g={all:["org-agents"],list:(n,t)=>[...g.all,"list",n,{page:t.page,perPage:t.perPage,categories:t.categories?.join(",")??void 0,name:t.name??void 0,description:t.description??void 0,sort:t.sort,order:t.order}]},Q=n=>n&&n[0]===g.all[0]?String(n[2]??""):null,ee=n=>n.invalidateQueries({queryKey:_.all}),ne=(n,t)=>n.invalidateQueries({queryKey:t?[...g.all,"list",t]:g.all}),ie=({page:n=1,perPage:t=20,enabled:i=!0,categories:o,name:a,description:u,sort:l=z,order:b="desc",tenantId:d}={})=>{const p={page:n,perPage:t,categories:o,name:a,description:u,sort:l,order:b},y=d?g.list(d,p):_.list(p),r=A({queryKey:y,queryFn:async()=>{const s={};return o&&o.length>0&&(s.categories=o.join(",")),a&&(s.name=a),u&&(s.description=u),s.sort=l,s.order=b,d?await U(d,n,t,s):await j(n,t,s)},select:s=>s.result,enabled:i,retry:L,staleTime:5*60*1e3,gcTime:10*60*1e3,refetchOnWindowFocus:!1,placeholderData:(s,m)=>Q(m?.queryKey)===(d??null)?s:void 0});return{...r,agents:r.data?.records,isRefreshing:r.isFetching&&r.data!==void 0,pagination:r.data?{page:r.data.page,perPage:r.data.per_page,totalPages:r.data.total_pages,totalRecords:r.data.total_records}:void 0}},G={name:"Name",description:"Description",instructions:"The instruction body",tools:"Tools"};function te(n){const t=[],i=(o,a)=>{a&&t.push({field:o,message:`${G[o]} ${a}.`})};return i("name",T(n.name)),i("description",P(n.description)),n.instructions!==null&&i("instructions",R(n.instructions)),i("tools",N(n.tools??[])),t}function ae(n,t){const i=c(n);return t.some(o=>c(o)===i)}function oe(n){for(const t of n??[]){const i=t.indexOf(":");if(i<0||t.slice(0,i).trim().toLowerCase()!=="tools")continue;const o=t.slice(i+1).split(",").map(a=>a.trim()).filter(Boolean);return o.length>0?o:null}return null}function ue(n,t){const i=c(n);return t.find(o=>c(o)===i)??null}export{J as P,Z as a,_ as b,ne as c,ae as d,te as e,ee as i,ue as l,Y as p,oe as t,ie as u};
|
package/out/renderer/assets/{radient-auth-buttons-BW2Y_w80.js → radient-auth-buttons-Dez2dTCx.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t}from"./index-C6-RmJN4.js";import{P as l}from"./index-
|
|
1
|
+
import{j as t}from"./index-C6-RmJN4.js";import{P as l}from"./index-CpBVFG4F.js";import{u as p,a as b,c as x,e as h}from"./appearance-06MzzYY4.js";import{u as f,A as c,S as v}from"./error-boundary-UYiQxpgl.js";import{b as g}from"./conversation-input-sync-IYrZgM7R.js";import{t as e}from"./messages-DDxK-jTd.js";const j="radient",A=({onSignInSuccess:u,onAfterCredentialUpdate:d,titleText:a=e("ui.common.account.radient_auth_buttons.sign_in_to_radient"),descriptionText:i=e("ui.common.account.radient_auth_buttons.connect_your_radient_account_to_use_radient_services")})=>{f();const _=p(),n=b(),s=x(n.data,"auth"),r=h(s),o=r.data?.find(m=>m.id===j);return n.isSuccess&&!s?t.jsx(c,{variant:"warning",children:e("ui.common.account.radient_auth_buttons.signing_in_needs_a_newer_local_operator_backend_update_the_backen")}):r.isLoading||n.isLoading?t.jsx("div",{className:"flex h-24 items-center justify-center",children:t.jsx(v,{size:"md",label:e("ui.common.account.radient_auth_buttons.loading_sign_in_options")})}):o?t.jsxs("div",{className:"mx-auto w-full max-w-md",children:[a&&t.jsx("p",{className:"mb-2 text-center text-heading text-ink",children:a}),i&&t.jsx("p",{className:"mb-6 text-center text-body-sm text-ink-muted",children:i}),t.jsx(l,{provider:o,onConnected:()=>{_.invalidateQueries({queryKey:g.all}),d?.(),u?.()}})]}):t.jsx(c,{variant:"warning",children:e("ui.common.account.radient_auth_buttons.radient_is_not_available_from_this_backend_s_provider_registry")})};export{A as R};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as p,p as Ti,j as u,q as Ii,v as gu,w as Ys,h as Zr,f as ie,x as bu,b as Dt,y as ce,z as Re,A as qs,B as Ri,C as Jr,c as Le}from"./index-C6-RmJN4.js";import{dH as yu,dI as vu,dJ as es,dK as xu,dL as wu,dM as _i,dN as Cu,dO as ku,dP as Su,dQ as Ei,dR as Pu,dS as Oi,dT as Tt,dU as yo,dV as ts,dW as Mu,dX as Ct,dY as vo,dZ as Fi,d_ as Ni,d$ as Du,bK as Tu,e0 as Iu,S as Ru,e1 as _u,p as Ai,e2 as Eu,e3 as $i,e4 as Ou,e5 as Fu,e6 as Nu,e7 as Au,e8 as $u,a as _r,e9 as ju,ea as Lu,eb as Vu,ec as Ks,ed as Bu,ee as Lo,ef as zu,eg as Hu,eh as Wu,ei as Uu,ej as Yu,ek as qu,bi as Ku,el as Gu,em as Qu,en as Xu,eo as Zu,R as Ju,ep as ed,bw as td,eq as nd,er as od,es as rd}from"./index-
|
|
1
|
+
import{r as p,p as Ti,j as u,q as Ii,v as gu,w as Ys,h as Zr,f as ie,x as bu,b as Dt,y as ce,z as Re,A as qs,B as Ri,C as Jr,c as Le}from"./index-C6-RmJN4.js";import{dH as yu,dI as vu,dJ as es,dK as xu,dL as wu,dM as _i,dN as Cu,dO as ku,dP as Su,dQ as Ei,dR as Pu,dS as Oi,dT as Tt,dU as yo,dV as ts,dW as Mu,dX as Ct,dY as vo,dZ as Fi,d_ as Ni,d$ as Du,bK as Tu,e0 as Iu,S as Ru,e1 as _u,p as Ai,e2 as Eu,e3 as $i,e4 as Ou,e5 as Fu,e6 as Nu,e7 as Au,e8 as $u,a as _r,e9 as ju,ea as Lu,eb as Vu,ec as Ks,ed as Bu,ee as Lo,ef as zu,eg as Hu,eh as Wu,ei as Uu,ej as Yu,ek as qu,bi as Ku,el as Gu,em as Qu,en as Xu,eo as Zu,R as Ju,ep as ed,bw as td,eq as nd,er as od,es as rd}from"./index-CpBVFG4F.js";import{h as ji,u as ns,x as Li,n as Gs,s as sd,a as ad,c as id}from"./appearance-06MzzYY4.js";import{P as ld}from"./page-header-D1Bi0Lq9.js";import{aA as _o,ak as cd,u as Gt,x as Kt,B as yt,S as os,a7 as Qs,L as bt,s as Vi,K as Wo,U as vn,V as xn,W as wn,Y as Cn,Z as et,$ as Er,a8 as ud,a9 as dd,k as pd,aa as fd,f as md,X as hd,A as Xs}from"./error-boundary-UYiQxpgl.js";import{t as V}from"./messages-DDxK-jTd.js";import{b2 as nr,bv as Bi,gV as rs,gW as D,ds as gd,bz as zi,bA as Hi,aR as Wi,aF as Pn,bw as bd,c7 as yd,gX as vd,ay as Mn,bC as xd,gY as wd}from"./conversation-input-sync-IYrZgM7R.js";import{b as or,s as Or,g as Cd,c as Uo,d as Ui,e as Yi,h as kd,l as Fr,j as Sd,w as Zs,k as Pd,i as to,f as Md,m as Dd,p as Js}from"./parseISO-CxPiCKvF.js";import{t as Ce,c as at,d as qi,f as Ki,n as rr,g as ss,k as Td,a as Gi,e as Qi}from"./en-US-CW_dDnkH.js";import"./console-mirror-DV8lF0jT.js";import"./roles-D1pcbxAx.js";var Id=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,Rd=yu(function(e){return Id.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),_d=Rd,Ed=function(t){return t!=="theme"},ea=function(t){return typeof t=="string"&&t.charCodeAt(0)>96?_d:Ed},ta=function(t,n,o){var r;if(n){var s=n.shouldForwardProp;r=t.__emotion_forwardProp&&s?function(a){return t.__emotion_forwardProp(a)&&s(a)}:s}return typeof r!="function"&&o&&(r=t.__emotion_forwardProp),r},Od=function(t){var n=t.cache,o=t.serialized,r=t.isStringTag;return Cu(n,o,r),ku(function(){return Su(n,o,r)}),null},Fd=function e(t,n){var o=t.__emotion_real===t,r=o&&t.__emotion_base||t,s,a;n!==void 0&&(s=n.label,a=n.target);var i=ta(t,n,o),l=i||ea(r),c=!l("as");return function(){var d=arguments,m=o&&t.__emotion_styles!==void 0?t.__emotion_styles.slice(0):[];if(s!==void 0&&m.push("label:"+s+";"),d[0]==null||d[0].raw===void 0)m.push.apply(m,d);else{var y=d[0];m.push(y[0]);for(var g=d.length,h=1;h<g;h++)m.push(d[h],y[h])}var v=vu(function(f,b,C){var w=c&&f.as||r,x="",S=[],P=f;if(f.theme==null){P={};for(var k in f)P[k]=f[k];P.theme=p.useContext(xu)}typeof f.className=="string"?x=wu(b.registered,S,f.className):f.className!=null&&(x=f.className+" ");var R=_i(m.concat(S),b.registered,P);x+=b.key+"-"+R.name,a!==void 0&&(x+=" "+a);var _=c&&i===void 0?ea(w):l,O={};for(var $ in f)c&&$==="as"||_($)&&(O[$]=f[$]);return O.className=x,C&&(O.ref=C),p.createElement(p.Fragment,null,p.createElement(Od,{cache:b,serialized:R,isStringTag:typeof w=="string"}),p.createElement(w,O))});return v.displayName=s!==void 0?s:"Styled("+(typeof r=="string"?r:r.displayName||r.name||"Component")+")",v.defaultProps=t.defaultProps,v.__emotion_real=v,v.__emotion_base=r,v.__emotion_styles=m,v.__emotion_forwardProp=i,Object.defineProperty(v,"toString",{value:function(){return"."+a}}),v.withComponent=function(f,b){var C=e(f,es({},n,b,{shouldForwardProp:ta(v,b,!0)}));return C.apply(void 0,m)},v}},Nd=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"],Nr=Fd.bind(null);Nd.forEach(function(e){Nr[e]=Nr(e)});/**
|
|
2
2
|
* @mui/styled-engine v6.4.11
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as o,j as e,c as pe,n as bt,t as Qe,l as it}from"./index-C6-RmJN4.js";import{h as De,u as kt,aN as Nr,aD as Sr,aO as Cr,aP as lt,a as jt,c as mt,aQ as Mr,al as Ar,aR as Er,aS as Rr,aT as Ir,aU as Tr,d as je,aV as rs,aW as Lr,aX as Or,aY as $r,aZ as Dr,F as xe,a_ as os,a$ as Fr,b0 as zr,b1 as Pr,b2 as Ur,b3 as Kr,af as Br,b4 as ri,b5 as qr,b6 as Tt,b7 as Ut,b8 as In,b9 as Tn,ba as Hr,bb as Js,bc as Vr,bd as Gr,be as Xs,bf as Wr,O as Ns,bg as Yr,x as Ot,bh as Qr,s as oi,au as cs,t as ci,N as Zr,bi as Kt,M as $e,r as Jr,bj as Lt,bk as Xr,bl as ea,bm as ta,bn as eo,bo as li,ac as to,ad as no}from"./appearance-06MzzYY4.js";import{o as so}from"./console-mirror-DV8lF0jT.js";import{f2 as ls,f3 as ao,f4 as na,f5 as st,cD as io,b1 as di,b2 as Ss,aF as ui,bv as ro,ay as Cs,f6 as oo,f7 as co,f8 as lo,f9 as uo,fa as mi,fb as Ms,a$ as gi,fc as mo,fd as go,fe as ln,ff as pi,fg as po,bx as ds,fh as sa,fi as fo,fj as xt,fk as ut,c5 as As,fl as Es,cS as dn,cg as ho,fm as fi,fn as Rs,fo as vn,fp as xo,fq as _o,fr as yo,fs as Ln,ft as bo,fu as Cn,fv as vo,fw as ko,aR as hi,bz as us,bA as ms,a1 as Is,az as gs,fx as jo,fy as wo,fz as ps,fA as No,fB as So,fC as Co,fD as xi,fE as Mo,fF as Ao,fG as Eo,fH as Ro,fI as _i,fJ as Io,fK as To,fL as Lo,fM as Oo,fN as Ct,fO as Qt,e9 as $o,fP as fs,fQ as Do,e8 as Fo,fR as zo,fS as Po,fT as Uo,fU as Ko,fV as Bo,fW as aa,ca as Ts,fX as ot,fY as Mt,fZ as qo,f_ as Ho,f$ as ia,g0 as Vo,g1 as Go,g2 as Wo,g3 as Yo,g4 as Qo,g5 as Zo,du as _t,ex as Jo,dj as yi,dv as Xo,b as ra,dk as ec,c8 as Mn,a0 as bi,bu as tc,g6 as vi,by as ki,g7 as ji,g8 as nc,g9 as sc,ga as ac,gb as ic,gc as rc,gd as oc,dR as cc,a_ as lc,ge as dc,gf as uc,cc as mc,gg as At,gh as oa,gi as gc,gj as pc,gk as fc,ef as hc,eh as xc,r as _c,gl as On,gm as Zt,gn as yc,go as bc,gp as vc,gq as kc,gr as jc,gs as wc,gt as $n,gu as ca,gv as Nc,cx as Sc,gw as Cc,gx as Mc,cF as Ac,gy as Ec,gz as Rc,gA as Ic,cC as Tc,eC as Dn,gB as Lc,gC as Oc}from"./conversation-input-sync-IYrZgM7R.js";import{di as wi,dj as $c,dk as Dc,dl as Ni,dm as Fc,cf as zc,dn as qe,N as Pc,S as Si,bE as Gt,bF as Te,dp as Bt,dq as Re,dr as Fn,ds as Uc,R as Kc,bk as Ci,a as kn,c1 as Bc,bz as qc,c as Hc,dt as Vc,du as Gc,cd as Wc,dv as Yc,dw as Jt,dx as Xt,dy as la,bS as Qc,bD as Zc,bP as Jc,dz as Xc,dA as el,dB as tl,dC as nl,bt as da,dD as sl,bA as ua,bZ as al,bB as il,bC as rl,dE as ol,dF as cl,dG as ll}from"./index-
|
|
1
|
+
import{r as o,j as e,c as pe,n as bt,t as Qe,l as it}from"./index-C6-RmJN4.js";import{h as De,u as kt,aN as Nr,aD as Sr,aO as Cr,aP as lt,a as jt,c as mt,aQ as Mr,al as Ar,aR as Er,aS as Rr,aT as Ir,aU as Tr,d as je,aV as rs,aW as Lr,aX as Or,aY as $r,aZ as Dr,F as xe,a_ as os,a$ as Fr,b0 as zr,b1 as Pr,b2 as Ur,b3 as Kr,af as Br,b4 as ri,b5 as qr,b6 as Tt,b7 as Ut,b8 as In,b9 as Tn,ba as Hr,bb as Js,bc as Vr,bd as Gr,be as Xs,bf as Wr,O as Ns,bg as Yr,x as Ot,bh as Qr,s as oi,au as cs,t as ci,N as Zr,bi as Kt,M as $e,r as Jr,bj as Lt,bk as Xr,bl as ea,bm as ta,bn as eo,bo as li,ac as to,ad as no}from"./appearance-06MzzYY4.js";import{o as so}from"./console-mirror-DV8lF0jT.js";import{f2 as ls,f3 as ao,f4 as na,f5 as st,cD as io,b1 as di,b2 as Ss,aF as ui,bv as ro,ay as Cs,f6 as oo,f7 as co,f8 as lo,f9 as uo,fa as mi,fb as Ms,a$ as gi,fc as mo,fd as go,fe as ln,ff as pi,fg as po,bx as ds,fh as sa,fi as fo,fj as xt,fk as ut,c5 as As,fl as Es,cS as dn,cg as ho,fm as fi,fn as Rs,fo as vn,fp as xo,fq as _o,fr as yo,fs as Ln,ft as bo,fu as Cn,fv as vo,fw as ko,aR as hi,bz as us,bA as ms,a1 as Is,az as gs,fx as jo,fy as wo,fz as ps,fA as No,fB as So,fC as Co,fD as xi,fE as Mo,fF as Ao,fG as Eo,fH as Ro,fI as _i,fJ as Io,fK as To,fL as Lo,fM as Oo,fN as Ct,fO as Qt,e9 as $o,fP as fs,fQ as Do,e8 as Fo,fR as zo,fS as Po,fT as Uo,fU as Ko,fV as Bo,fW as aa,ca as Ts,fX as ot,fY as Mt,fZ as qo,f_ as Ho,f$ as ia,g0 as Vo,g1 as Go,g2 as Wo,g3 as Yo,g4 as Qo,g5 as Zo,du as _t,ex as Jo,dj as yi,dv as Xo,b as ra,dk as ec,c8 as Mn,a0 as bi,bu as tc,g6 as vi,by as ki,g7 as ji,g8 as nc,g9 as sc,ga as ac,gb as ic,gc as rc,gd as oc,dR as cc,a_ as lc,ge as dc,gf as uc,cc as mc,gg as At,gh as oa,gi as gc,gj as pc,gk as fc,ef as hc,eh as xc,r as _c,gl as On,gm as Zt,gn as yc,go as bc,gp as vc,gq as kc,gr as jc,gs as wc,gt as $n,gu as ca,gv as Nc,cx as Sc,gw as Cc,gx as Mc,cF as Ac,gy as Ec,gz as Rc,gA as Ic,cC as Tc,eC as Dn,gB as Lc,gC as Oc}from"./conversation-input-sync-IYrZgM7R.js";import{di as wi,dj as $c,dk as Dc,dl as Ni,dm as Fc,cf as zc,dn as qe,N as Pc,S as Si,bE as Gt,bF as Te,dp as Bt,dq as Re,dr as Fn,ds as Uc,R as Kc,bk as Ci,a as kn,c1 as Bc,bz as qc,c as Hc,dt as Vc,du as Gc,cd as Wc,dv as Yc,dw as Jt,dx as Xt,dy as la,bS as Qc,bD as Zc,bP as Jc,dz as Xc,dA as el,dB as tl,dC as nl,bt as da,dD as sl,bA as ua,bZ as al,bB as il,bC as rl,dE as ol,dF as cl,dG as ll}from"./index-CpBVFG4F.js";import{P as dl}from"./page-header-D1Bi0Lq9.js";import{c as ee,u as se,B as z,S as Ce,$ as Ls,x as Ze,N as qt,O as Ht,P as dt,A as ge,q as jn,y as He,f as Pe,U as Os,V as $s,W as Ds,Y as Fs,Z as yt,L as Ve,K as Le,a7 as wn,a0 as Mi,i as vt,h as hs,ag as Ai,a as An,_ as ul,ab as Ei,a8 as ml,a9 as gl,aa as pl,as as xs,r as Ri,T as Ii,au as fl,av as ma,s as zs,D as Ps,b as Us,d as Ks,I as hl,e as at,aw as Ti,ax as xl,X as ga,R as Nn,E as Li,ah as _l,ai as yl,ay as bl,az as vl,n as un,o as mn,p as gn,F as pn}from"./error-boundary-UYiQxpgl.js";import{t as n,L as zn}from"./messages-DDxK-jTd.js";import{u as pa,d as kl,e as jl,D as wl,l as Nl,o as Sl,S as Cl}from"./team-bridge-scope-preference-BoQ9Urzi.js";import{s as Ml}from"./team-bridge-trial-model-DLdMGEm0.js";import{R as Al}from"./radient-auth-buttons-Dez2dTCx.js";import{u as El,A as Rl,d as Il}from"./avatar-cropper-Da10lKtU.js";import{N as Tl}from"./notebook-pen-B3_Nn5_T.js";import{k as ft,p as Oi}from"./roles-D1pcbxAx.js";import{B as Ll}from"./book-open-BBAaZNMQ.js";import{i as Ol,a as ct,b as $l,p as Pn,f as Dl}from"./parseISO-CxPiCKvF.js";import{t as Fl}from"./en-US-CW_dDnkH.js";/**
|
|
2
2
|
* @license lucide-react v0.507.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as Y,a as E,b as F}from"./library-page-B6GdFXB9.js";import"./index-C6-RmJN4.js";import"./messages-DDxK-jTd.js";import"./console-mirror-DV8lF0jT.js";import"./appearance-06MzzYY4.js";import"./roles-D1pcbxAx.js";import"./page-header-D1Bi0Lq9.js";import"./conversation-input-sync-IYrZgM7R.js";import"./error-boundary-UYiQxpgl.js";import"./index-BWr5Qxzh.js";import"./heart-BHDKqrxe.js";import"./use-session-snapshot-BD1Gk4L3.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 gn(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{gn as renderSmartArt};
|
|
1
|
+
import{g as Y,a as E,b as F}from"./library-page-BLG4EkzG.js";import"./index-C6-RmJN4.js";import"./messages-DDxK-jTd.js";import"./console-mirror-DV8lF0jT.js";import"./appearance-06MzzYY4.js";import"./roles-D1pcbxAx.js";import"./page-header-D1Bi0Lq9.js";import"./conversation-input-sync-IYrZgM7R.js";import"./error-boundary-UYiQxpgl.js";import"./index-CpBVFG4F.js";import"./heart-BHDKqrxe.js";import"./use-session-snapshot-BD1Gk4L3.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 gn(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{gn as renderSmartArt};
|