import{j as e,r as t}from"./vendor-react-RSDKEZ60.js";import{bb as s,p2 as a,a9 as n,q as o,at as r,ci as i,fd as l,dH as c,p3 as d,p4 as u,p5 as p,p6 as h,y as m,bi as f,di as g,dj as b,m as y,dY as x,B as _,V as v,p7 as M,gi as j,bY as w,M as k,g9 as I,aB as C,aC as S,h as O,bZ as A,gf as N,cy as P,fg as T,fQ as D,gj as E,gk as z,gl as G,d_ as R,gm as F,p8 as $,cA as U,p9 as H,R as K,u as L,pa as Q,s as B,h4 as V,pb as Y,gZ as Z,f as W,cX as q,pc as X,pd as J,pe as ee,gY as te,e as se,pf as ae,h1 as ne,h2 as oe,cL as re,nh as ie,cO as le,cT as ce,pg as de,S as ue,bN as pe,g_ as he,ph as me,pi as fe,l8 as ge,a3 as be,pj as ye,en as xe,eq as _e,hz as ve,pk as Me,pl as je}from"./c818056db-BBpc4u6S.js";import{u as we,M as ke}from"./vendor-intl-BNW8a19h.js";import{y as Ie}from"./vendor-icons-CjJMeNuY.js";import{w as Ce,x as Se,a as Oe,u as Ae}from"./cbf215181-BtpZx0Q9.js";import{I as Ne,n as Pe}from"./vendor-lodash-wKOE1Xsv.js";import{L as Te}from"./c93f725a0-HHLLVuUn.js";import{o as De,B as Ee,l as ze,q as Ge,k as Re,T as Fe,D as $e}from"./vendor-ant-cds-CBh5POw1.js";import{o as Ue,s as He,a as Ke,n as Le}from"./vendor-zod-D1-NLVm9.js";import{a as Qe}from"./c516a3ba1-V3Ebwoql.js";import{c as Be}from"./vendor-zustand-IIUY2Tf-.js";import{D as Ve}from"./vendor-luxon-CuMIhNDL.js";import{m as Ye}from"./vendor-motion-Bnihp5FA.js";const Ze=t=>e.jsx(s,{...t,children:e.jsx("path",{d:"M8.146 4.646a.5.5 0 0 1 .708.708L4.707 9.5H16.5a.5.5 0 0 1 0 1H4.707l4.147 4.147a.5.5 0 0 1-.708.707l-5-5a.5.5 0 0 1-.062-.631l.062-.077z"})}),We=t=>e.jsx(s,{...t,children:e.jsx("path",{d:"M10 2.5a7.5 7.5 0 1 1 0 15 7.5 7.5 0 0 1 0-15M5.064 5.771a6.5 6.5 0 0 0 9.163 9.163zM10 3.5a6.48 6.48 0 0 0-4.229 1.564l9.164 9.164A6.5 6.5 0 0 0 10 3.5"})}),qe="ant.dir.ant.anthropic.filesystem";function Xe(){const{moveToProject:s}=a(),{addSuccess:i,addError:l}=n(),c=we(),d=o();return{moveToProject:t.useCallback(async(t,a,n,o={})=>{const{showSuccess:u=!0,showError:p=!0,enableNavigation:h=!0,onSuccess:m}=o;try{const o=await s(t,a),f=t.length>1,g=`move-to-project:${a}`;if(o.totalMoved>0&&u)if(f){const t=h?e.jsx(ke,{defaultMessage:"{count, plural, one {# chat} other {# chats}} moved to {projectName}",id:"NV3PpRB1tb",values:{count:o.totalMoved,projectName:e.jsx(r,{onClick:()=>d.push(`/project/${a}`),className:"-my-2 !px-1 !min-w-0",children:n||c.formatMessage({defaultMessage:"project",id:"RbFAl7UGmp"})})}}):c.formatMessage({defaultMessage:"{count, plural, one {# chat} other {# chats}} moved to {projectName}",id:"NV3PpRB1tb"},{count:o.totalMoved,projectName:n||c.formatMessage({defaultMessage:"project",id:"RbFAl7UGmp"})});i(t,{uniqueKey:g})}else{const t=h?e.jsx(ke,{defaultMessage:"Chat moved to {projectName}",id:"t6VGfzHSDj",values:{projectName:e.jsx(r,{onClick:()=>d.push(`/project/${a}`),className:"-my-2 !px-1 !min-w-0",children:n||c.formatMessage({defaultMessage:"project",id:"RbFAl7UGmp"})})}}):c.formatMessage({defaultMessage:"Chat moved to {projectName}",id:"t6VGfzHSDj"},{projectName:n||c.formatMessage({defaultMessage:"project",id:"RbFAl7UGmp"})});i(t,{uniqueKey:g})}return o.totalFailed>0&&p&&(f?l(c.formatMessage({defaultMessage:"{count, plural, one {Failed to move # chat. You can try again.} other {Failed to move # chats. You can try again.}}",id:"43D5uv51my"},{count:o.totalFailed}),{messageForLogging:"{count, plural, one {Failed to move # chat. You can try again.} other {Failed to move # chats. You can try again.}}"}):l(c.formatMessage({defaultMessage:"This chat does not exist or was deleted",id:"57wYxTOkNA"}),{messageForLogging:"This chat does not exist or was deleted"})),m?.(o),o}catch(f){throw p&&l(c.formatMessage({defaultMessage:"Failed to move chats. You can try again.",id:"icpocvB+Op"}),{error:f,messageForLogging:"Failed to move chats. You can try again."}),f}},[s,i,l,c,d])}}const Je="chat-input-menu-search-input";function et(){if(i())return;const e=document.getElementById(Je);e&&e.focus()}const tt={includeScore:!0,isCaseSensitive:!1,ignoreLocation:!0,threshold:.4};function st({actions:s,inputMenuSearchQuery:a,inputMenuIsOpen:n,pathItems:o,path:r,menuType:i}){const m=we(),f=t.useRef(a),{handleSearchDrive:g,searchedDriveItems:b}=function({path:e,actions:s,inputMenuSearchQuery:a,inputMenuIsOpen:n,menuType:o}){const r=("drive"===e||!e)&&n&&"plus"===o;Ce(),c();const[i,l]=t.useState([]),{recentDriveDocs:u}=Se(r);return t.useMemo(()=>new d(u,{...tt,keys:["title"]}),[u]),{handleSearchDrive:()=>[],searchedDriveItems:[]}}({path:r,actions:s,inputMenuSearchQuery:a,inputMenuIsOpen:n,menuType:i}),{handleSearchProjects:y,searchedProjectItems:x}=function({path:e,actions:s,inputMenuSearchQuery:a,inputMenuIsOpen:n,menuType:o,pathItems:r}){u(),r.map(({key:e})=>e).indexOf("projects");const i=!1,[l,c]=t.useState([]),{data:m}=p({enabled:i,limit:h});return t.useMemo(()=>new d(m||[],{...tt,keys:["name","description"]}),[m]),{handleSearchProjects:()=>[],searchedProjectItems:[]}}({path:r,actions:s,inputMenuSearchQuery:a,inputMenuIsOpen:n,menuType:i,pathItems:o}),_=function({path:e,inputMenuSearchQuery:s,pathItems:a}){const n="projects"!==e&&"drive"!==e;return t.useMemo(()=>{const e=s.toLowerCase();if(!n||!e)return[];const t=a.filter(({menuItemHidden:e})=>!e),o=[];for(const s of t)o.push(s),!s.isDisabled&&"projects"!==s.key&&"drive"!==s.key&&"children"in s&&s.children&&o.push(...s.children);return o.filter(t=>!t.nonSearchable&&"toggleAll"!==t.type&&"back"!==t.type&&"divider"!==t.type&&"string"==typeof t.label&&t.label.toLowerCase().includes(e)).slice(0,7)},[n,a,s])}({path:r,inputMenuSearchQuery:a,pathItems:o}),v=l(()=>{y(),g()}),M=t.useMemo(()=>Ne(v,100),[v]);if(t.useEffect(()=>()=>M.cancel(),[M]),t.useEffect(()=>{a&&n&&a!==f.current&&(f.current=a,M())},[n,a,M]),!_.length&&!x.length&&!b.length)return[{key:"loading",type:"button",label:m.formatMessage({defaultMessage:"No results found",id:"hX5PAbCTOR"}),icon:e.jsx(Ie,{size:16}),onClick:()=>{},isDisabled:!0}];return[_,x,b].reduce((e,t,s)=>[...e,...e.length&&t.length?[{key:`divider${s+1}`,type:"divider",label:""}]:[],...t],[])}const at={path:null,inputMenuSearchQuery:"",setInputMenuSearchQuery:Pe,inputMenuIsOpen:!1,setInputMenuIsOpen:Pe,menuView:{rootItems:[],currentItems:[]},handleClickItem:Pe,handleBack:Pe,highlightedItemKey:null,setHighlightedItemKey:Pe,animationDirection:"none"},nt={createProjectModalIsOpen:null,setCreateProjectModalIsOpen:Pe,githubModalIsOpen:!1,setGithubModalIsOpen:Pe,gmailAuthModalIsOpen:!1,setGmailAuthModalIsOpen:Pe,createPromptArgumentModalIsOpen:null,setCreatePromptArgumentModalIsOpen:Pe},ot={...at,createProjectModalIsOpen:null,setCreateProjectModalIsOpen:Pe,githubModalIsOpen:!1,setGithubModalIsOpen:Pe,gmailAuthModalIsOpen:!1,setGmailAuthModalIsOpen:Pe,createPromptArgumentModalIsOpen:null,setCreatePromptArgumentModalIsOpen:Pe},rt=t.createContext(nt),it=t.createContext(ot);function lt({actions:e,rootItems:s,menuType:a,inputMenuIsOpen:n,setInputMenuIsOpen:o}){m();const r=t.useRef(null),[i,c]=t.useState(null),[d,u]=t.useState(null),[p,h]=t.useState(""),f=(e,t={})=>{if(!e){h("");const e=()=>{g(null,!0),u(null),document.getElementById(`input-${a}-menu-trigger`)?.focus()};t.withDelay?setTimeout(e,200):e()}},g=(e,t)=>{r.current=t?e:i,c(e)},b=(()=>{if(i){const e=s.find(e=>e.key===i);if(e&&"children"in e)return e.children}return s})(),y=st({actions:e,inputMenuSearchQuery:p,inputMenuIsOpen:n,pathItems:b,path:i,menuType:a}),x=p.trim().length?y:b,_={rootItems:s,currentItems:x},{handleClickItem:v,handleBack:M}=function({currentItems:e,inputMenuIsOpen:s,setInputMenuIsOpen:a,inputMenuSearchQuery:n,setInputMenuSearchQuery:o,path:r,handleUpdatePath:i,highlightedItemKey:c,setHighlightedItemKey:d}){const u=t.useCallback(e=>{"toggleGroup"===e.type||"optionGroup"===e.type||"buttonGroup"===e.type?(a(!0),i(e.key,!0)):"button"!==e.type&&"switch"!==e.type&&"toggle"!==e.type&&"option"!==e.type||e.onClick?.()},[a,i]),p=t.useCallback(e=>{r&&(e?.preventDefault(),i(null),d(r),et())},[r,d,i]),h=t.useCallback(t=>{const s=e.filter(e=>!["subheader","divider"].includes(e.type)&&!e.isDisabled&&!e.menuItemHidden),a=s.findIndex(({key:e})=>e===c);let n;n="ArrowUp"===t?a>0?a-1:s.length-1:a<s.length-1?a+1:0,d(s[n].key)},[e,c,d]),m=t.useCallback(e=>{if(!e.isDisabled)if(o(""),"back"!==e.type){if("button"===e.type)return e.onClick?.(),void(e.skipCloseOnClick||a(!1));if("toggleGroup"===e.type||"optionGroup"===e.type||"buttonGroup"===e.type)return i(e.key),d(null),void et();"option"===e.type&&(e.onClick?.(),e.skipCloseOnClick||a(!1,{withDelay:!0})),"toggleAll"!==e.type&&"toggle"!==e.type&&"switch"!==e.type||(e.onClick?.(),et())}else p()},[p,u,i,s,o,a,d]),f=t.useCallback((t,s)=>{if(!c)return;const a=e.find(({key:e})=>e===c);a&&("Enter"===t||["optionGroup","toggleGroup","buttonGroup"].includes(a.type))&&(s.preventDefault(),m(a))},[c,e,m]),g=l(e=>{"Tab"===e.key?e.preventDefault():"Escape"===e.key?(e.preventDefault(),a(!1)):"ArrowUp"===e.key||"ArrowDown"===e.key?(e.preventDefault(),h(e.key)):"ArrowRight"===e.key||"Enter"===e.key?f(e.key,e):"ArrowLeft"!==e.key||n||p(e)});return t.useEffect(()=>(document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)),[s,g]),{handleClickItem:m,handleBack:p}}({currentItems:x,inputMenuIsOpen:n,setInputMenuIsOpen:f,inputMenuSearchQuery:p,setInputMenuSearchQuery:h,path:i,handleUpdatePath:g,highlightedItemKey:d,setHighlightedItemKey:u}),j=r.current&&!i?"back":!r.current&&i?"forward":"none";return{path:i,inputMenuSearchQuery:p,setInputMenuSearchQuery:h,inputMenuIsOpen:n,setInputMenuIsOpen:f,menuView:_,handleClickItem:v,handleBack:M,highlightedItemKey:d,setHighlightedItemKey:u,animationDirection:j}}function ct({children:s}){const[a,n]=t.useState(null),[o,r]=t.useState(!1),[i,l]=t.useState(!1),[c,d]=t.useState(null),u=t.useMemo(()=>({createProjectModalIsOpen:a,setCreateProjectModalIsOpen:n,githubModalIsOpen:o,setGithubModalIsOpen:r,gmailAuthModalIsOpen:i,setGmailAuthModalIsOpen:l,createPromptArgumentModalIsOpen:c,setCreatePromptArgumentModalIsOpen:d}),[a,o,i,c]),p=t.useMemo(()=>({...at,createProjectModalIsOpen:a,setCreateProjectModalIsOpen:n,githubModalIsOpen:o,setGithubModalIsOpen:r,gmailAuthModalIsOpen:i,setGmailAuthModalIsOpen:l,createPromptArgumentModalIsOpen:c,setCreatePromptArgumentModalIsOpen:d}),[a,o,i,c]);return e.jsx(rt.Provider,{value:u,children:e.jsx(it.Provider,{value:p,children:s})})}function dt(){return t.useContext(rt)}function ut(e){return`https://drive.google.com/open?id=${encodeURIComponent(e)}`}function pt(e){const t=`https://github.com/${e.owner}/${e.repo}`;return e.branch?`${t}/tree/${e.branch.split("/").map(encodeURIComponent).join("/")}`:t}async function ht(e){const t="CaptureController"in window?new CaptureController:null;let s;t?.setFocusBehavior("no-focus-change");try{s=await navigator.mediaDevices.getDisplayMedia({video:!0,controller:t})}catch(i){if(i instanceof DOMException&&"NotAllowedError"===i.name)return null;throw i}const a=document.createElement("video");a.srcObject=s,await new Promise((e,t)=>{a.onloadedmetadata=()=>{a.play().then(e,t)}});const n=document.createElement("canvas");if(e){const t=e.width/Math.min(a.videoWidth,e.width),s=e.height/Math.min(a.videoHeight,e.height),o=Math.min(t,s);n.width=a.videoWidth*o,n.height=a.videoHeight*o}else n.width=a.videoWidth,n.height=a.videoHeight;const o=n.getContext("2d");if(!o)throw Error("Could not create 2D context");o.drawImage(a,0,0,n.width,n.height);const r=n.toDataURL("image/png");return s.getTracks().forEach(e=>e.stop()),{imageDataUrl:r}}const mt=/^([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,ft=e=>mt.test(e),gt=e=>{if(!e)return!1;if("*"===e)return!0;if(e.startsWith("*.")){const t=e.slice(2);return ft(t)||/^[a-zA-Z]{2,}$/.test(t)}return ft(e)};function bt(e,t=40){if(e.length<=t)return e;const s=Math.floor((t-3)/2),a=t-3-s;return`${e.slice(0,s)}...${e.slice(-a)}`}function yt(e){if(!e.trim())return{isValid:!0};const t=e.split("\n").map(e=>e.trim()).filter(e=>e.length>0);for(const s of t){if(s.startsWith("https://")||s.startsWith("http://"))return{isValid:!1,error:`Remove the protocol prefix. Enter domains only, like "example.com" instead of "${bt(s)}".`,invalidHost:s};if(s.includes("/"))return{isValid:!1,error:`Remove the path. Enter domains only, like "example.com" instead of "${bt(s)}".`,invalidHost:s};if(s.includes(":"))return{isValid:!1,error:`Remove the port number. Enter domains only, like "example.com" instead of "${bt(s)}".`,invalidHost:s};if(!gt(s))return{isValid:!1,error:`"${bt(s)}" is not a valid domain. Use formats like "example.com" or "*.example.com".`,invalidHost:s}}return{isValid:!0}}function xt(){const e=f(),t=g(b.OrganizationManage),s=y("omelette_admin_settings");return e&&t&&s}function _t(){M(),y("claudeai_mcp_apps_visualize");const e=j(),t=w(),s=k(),a=g(b.IntegrationsManage),n=I(),o=C("c4e_show_tool_permissioning_always_allow"),r=C("operon_access"),i=y("frontier_services_admin_toggle_visibility"),l=xt();return{showChat:s,showDesign:(s||t)&&!l,showOperon:r&&(s||t),showLabsDataSharing:i&&s,showDataInputs:true,showArtifacts:!0,showIntegrationPermissions:o&&(s||t),showWiggle:e&&a&&(s||t),showMemory:n&&s}}const vt="https://support.anthropic.com/en/articles/12111783-create-and-edit-files-with-claude";function Mt({host:t,allowedHosts:s,onRemove:a,isPending:n}){const o=we().formatMessage({defaultMessage:"Remove {host}",id:"Lb3kzopnez"},{host:t});return e.jsxs("div",{className:"flex w-full items-center justify-between px-3 py-2 bg-alpha-1 hover:bg-alpha-2 transition-colors",children:[e.jsx("span",{className:"text-sm",children:t}),e.jsx(Ee,{iconOnly:!0,icon:"Trash",variant:"ghost",size:"sm",onClick:()=>a(s.filter(e=>e!==t)),disabled:n,"aria-label":o})]})}function jt({hosts:t,onRemove:s,isPending:a}){return e.jsx("div",{className:"flex flex-col rounded-card bg-alpha-2 max-h-[200px] overflow-y-auto border-0.5 border-strong",children:t.map(n=>e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(Mt,{host:n,allowedHosts:t,onRemove:s,isPending:a})},n))})}function wt({hostsTemplate:s,onUpdate:a,isPending:n}){const o=we(),r=t.useMemo(()=>[{value:"custom",label:o.formatMessage({defaultMessage:"None",id:"450Fty8ldn"})},{value:"package_managers",label:o.formatMessage({defaultMessage:"Package managers only",id:"0B9fsRTvg7"})},{value:"full_egress",label:o.formatMessage({defaultMessage:"All domains",id:"21lfYfOCKS"})}],[o]);return e.jsx(Ge,{mode:"select",searchable:!1,items:r,value:s,onChange:e=>{e&&a({wiggle_egress_hosts_template:e})},disabled:n,className:"min-w-[180px] max-w-[300px]"})}function kt({enabled:s,allowedHosts:a,hostsTemplate:n,onUpdate:o,isPending:r,isStandalone:i=!1,isFreeUser:l=!1}){const c=we(),[d,u]=t.useState(""),[p,h]=t.useState(!1),m="custom"===n,f=e=>{if("*"===e)return!1;if(e.startsWith("*.")){const t=e.slice(2);return ft(t)||/^[a-zA-Z]{2,}$/.test(t)}return ft(e)},g=()=>{if(d&&f(d)&&!a.includes(d.toLowerCase())){const e=[...a,d];o({wiggle_egress_allowed_hosts:e}),u("")}},b=p&&!!d&&!f(d),y=e.jsxs(e.Fragment,{children:[s&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(x,{label:e.jsx(ke,{defaultMessage:"Domain allowlist",id:"xdLHvAfnNt"}),description:e.jsx(ke,{defaultMessage:"Choose which domains the sandbox can access",id:"LlFKnFYrPO"}),control:e.jsx(wt,{hostsTemplate:n,onUpdate:o,isPending:r})}),e.jsx(_,{variant:"neutral",className:"!w-full",children:"full_egress"===n?e.jsx(ke,{defaultMessage:"Claude can access all domains on the internet.",id:"sbNMNgwkYb"}):m?e.jsx(ke,{defaultMessage:"Claude can only access domains you specify below. Add domains individually using wildcards if needed.",id:"RB89xnraOT"}):e.jsx(ke,{defaultMessage:"Claude can access common package managers plus any additional domains you specify below. <a>View package manager domains</a>.",id:"dQalIf3eYu",values:{a:t=>e.jsx(v,{href:`${vt}#h_152729314d`,external:!0,children:t})}})})]}),s&&"full_egress"!==n&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("div",{className:"text-body text-primary",children:e.jsx(ke,{defaultMessage:"Additional allowed domains",id:"t1fxOYQiAS"})}),e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx(De,{value:d,onChange:e=>{u(e.target.value),h(!1)},onBlur:()=>h(!0),onKeyDown:e=>{"Enter"===e.key&&g()},placeholder:c.formatMessage({defaultMessage:"example.com or *.example.com",id:"HK8X6txiip"}),size:"lg",required:!0,disabled:r,"data-invalid":b?"":void 0,className:"flex-1"}),e.jsx(Ee,{variant:"primary",size:"lg",disabled:!d||!f(d)||a.includes(d.toLowerCase()),busy:r,onClick:g,children:e.jsx(ke,{defaultMessage:"Add",description:"Button that adds a domain",id:"NkHVQqZyPE"})})]}),b&&e.jsx("p",{className:"text-danger text-xs mt-1 pb-2",children:e.jsx(ke,{defaultMessage:"Enter a valid domain (e.g., example.com or *.example.com)",id:"lGZhqTsPpf"})})]})]}),a.length>0&&e.jsx(jt,{hosts:a,onRemove:e=>o({wiggle_egress_allowed_hosts:e}),isPending:r})]})]});if(l){const t=e=>{o(e?{enabled_wiggle_egress:!0,wiggle_egress_hosts_template:"package_managers",wiggle_egress_allowed_hosts:[]}:{enabled_wiggle_egress:!1})},a=e.jsx(x,{label:e.jsx(ke,{defaultMessage:"Allow network egress",id:"lf4gxmVtIr"}),description:e.jsx(ke,{defaultMessage:"Allow Claude to access common package managers to install packages and libraries for data analysis, visualizations, and file processing. <a>View package manager domains</a>. Monitor chats closely as this comes with <b>security risks</b>.",id:"fzCeeOLRpx",values:{a:t=>e.jsx(v,{href:`${vt}#h_152729314d`,external:!0,children:t}),b:t=>e.jsx(v,{href:`${vt}#h_0ee9d698a1`,external:!0,children:t})}}),control:({labelId:a,descriptionId:n})=>e.jsx(ze,{checked:s,onCheckedChange:t,disabled:r,"aria-labelledby":a,"aria-describedby":n})});return i?e.jsx("div",{className:"flex flex-col gap-4",children:a}):e.jsx("div",{className:"flex flex-col rounded-card bg-alpha-1 p-6 gap-6 border border-alpha-2",children:a})}return i?e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(x,{label:e.jsx(ke,{defaultMessage:"Allow network egress",id:"lf4gxmVtIr"}),description:e.jsx(ke,{defaultMessage:"Give Claude network access to install packages and libraries in order to perform advanced data analysis, custom visualizations, and specialized file processing. Monitor chats closely as this comes with <a>security risks</a>.",id:"lj7pOfmu2J",values:{a:t=>e.jsx(v,{href:`${vt}#h_0ee9d698a1`,external:!0,children:t})}}),control:({labelId:t,descriptionId:a})=>e.jsx(ze,{checked:s,onCheckedChange:e=>o({enabled_wiggle_egress:e}),disabled:r,"aria-labelledby":t,"aria-describedby":a})}),s&&e.jsx("div",{className:"flex flex-col rounded-card bg-alpha-1 p-6 gap-6 border border-alpha-2",children:y})]}):e.jsxs("div",{className:"flex flex-col rounded-card bg-alpha-1 p-6 gap-6 border border-alpha-2",children:[e.jsx(x,{label:e.jsx(ke,{defaultMessage:"Allow network egress",id:"lf4gxmVtIr"}),description:e.jsx(ke,{defaultMessage:"Give Claude network access to install packages and libraries in order to perform advanced data analysis, custom visualizations, and specialized file processing. Monitor chats closely as this comes with <a>security risks</a>.",id:"lj7pOfmu2J",values:{a:t=>e.jsx(v,{href:`${vt}#h_0ee9d698a1`,external:"with-icon",children:t})}}),control:({labelId:t,descriptionId:a})=>e.jsx(ze,{checked:s,onCheckedChange:e=>o({enabled_wiggle_egress:e}),disabled:r,"aria-labelledby":t,"aria-describedby":a})}),y]})}const It=Ue({title:He(),description:He(),shortDescription:He().optional(),titleKey:He().optional(),descriptionKey:He().optional(),shortDescriptionKey:He().optional()}),Ct=Ue({preview_feature_uses_artifacts:It.optional(),preview_feature_uses_latex:It.optional(),preview_feature_uses_citations:It.optional(),enabled_artifacts_attachments:It.optional(),enabled_turmeric:It.optional(),enabled_gdrive:It.optional(),enabled_bananagrams:It.optional(),enabled_web_search:It.optional(),enabled_sourdough:It.optional(),enabled_foccacia:It.optional()}),St={},Ot=t.createContext({openFeaturePreviewModal:Pe}),At=({children:s})=>{const[a,n]=t.useState(!1);return e.jsxs(Ot.Provider,{value:{openFeaturePreviewModal:()=>n(!0)},children:[s,e.jsx(S,{modalSize:"xl",isOpen:a,onClose:()=>n(!1),hasCloseButton:!0,title:e.jsx(ke,{defaultMessage:"Feature preview",id:"3H/t1552xG"}),children:e.jsx(Nt,{})})]})};function Nt({includeTitle:s}){const a=function(){const e=T("fp_menu","features",St,Ct),t=y("claudeai_analysis_tool_allowed"),s=j(),a=y("wiggle_graduated"),n=N(),{preview_feature_uses_artifacts:o,enabled_artifacts_attachments:r,preview_feature_uses_latex:i,enabled_turmeric:l,...c}=e,d={...c};t&&(d.enabled_artifacts_attachments=r);const u=n;!s||a||u||(d.enabled_monkeys_in_a_barrel={title:"Code execution and file creation",description:"Claude can execute code and create and edit docs, spreadsheets, presentations, PDFs, and data reports."});return d}(),n=Object.keys(a).length>0,{account:o}=O(),{mutate:r}=A(),i=t.useRef(!1),l=N();if(t.useEffect(()=>{if(!o?.settings)return;if(l)return void(i.current=!1);if(i.current)return;i.current=!0;const e=o.settings.enabled_monkeys_in_a_barrel,t=o.settings.preview_feature_uses_artifacts,s=o.settings.enabled_artifacts_attachments;e&&!t&&r({preview_feature_uses_artifacts:!0}),e&&s&&r({enabled_artifacts_attachments:!1})},[o?.settings,r,l]),!n)return;const c=Object.entries(a).map(([t,s])=>e.jsx(Pt,{label:t,...s},t));return s?e.jsx(Re,{children:e.jsxs(P,{title:e.jsx(ke,{defaultMessage:"Experimental",id:"GOx7x4mbZd"}),children:[e.jsx("p",{id:"feature-preview",className:"pb-md text-footnote text-secondary",children:e.jsx(ke,{defaultMessage:"Preview and provide feedback on upcoming enhancements to our platform. Please note: experimental features might influence Claude\u2019s behavior and some interactions may differ from the standard experience.",id:"TJ0Nj7aQ5C"})}),c]})}):e.jsx(Re,{children:e.jsx("div",{className:"divide-y divide-alpha-1",children:c})})}function Pt({label:s,...a}){const o=we(),{track:r}=m(),{addSuccess:i}=n(),{account:l}=O(),{mutate:c,isPending:d}=A(),{checked:u}=function(e){const{account:t}=O(),{value:s}=H(t?.settings??{}),a=D(),n=a.isAvailable,o=t?.settings?.preview_feature_uses_artifacts??!1;if("enabled_monkeys_in_a_barrel"===e)return{checked:n};if("enabled_artifacts_attachments"===e)return{checked:s};if("preview_feature_uses_artifacts"===e)return{checked:o};return{checked:t?.settings?.[e]??!1}}(s),p=D(),h=N(),g="enabled_monkeys_in_a_barrel"===s&&("blocked_by_org_admin"===p.status||"blocked_by_entitlement"===p.status||"blocked_by_org_tier"===p.status||"blocked_by_platform"===p.status),b=f(),_=y("claudeai_wiggle_egress_settings"),v=E(),M=z(),j=G(),w=t.useCallback(()=>{if(!l||g)return;r({event_key:"claudeai.settings.preview_feature.toggled",account_uuid:l.uuid,feature_id:s,action:!0===u?"disable":"enable"});const e=!u,t=o.formatMessage({defaultMessage:"{title} {action}",id:"XuGv50sPs9"},{title:a.title,action:u?"disabled":"enabled"});if(i(t),e)if("enabled_monkeys_in_a_barrel"===s){const e=l.settings?.enabled_artifacts_attachments,t=[];e&&t.push("Analysis Tool"),t.length>0&&i(o.formatMessage({defaultMessage:"Automatically disabled: {features}",id:"7StJBCedWA"},{features:t.join(", ")})),l.settings?.preview_feature_uses_artifacts||i(o.formatMessage({defaultMessage:"Automatically enabled: Artifacts",id:"v5zt5SRUyk"}))}else"enabled_artifacts_attachments"===s&&l.settings?.enabled_monkeys_in_a_barrel&&!h&&i(o.formatMessage({defaultMessage:"Automatically disabled: Files feature",id:"8T9PGQkYRT"}));c({[s]:e,..."enabled_monkeys_in_a_barrel"===s&&e&&{enabled_artifacts_attachments:!1,preview_feature_uses_artifacts:!0},..."enabled_artifacts_attachments"===s&&e&&!h&&{enabled_monkeys_in_a_barrel:!1}})},[l,r,s,u,i,o,a.title,c,g,h]);return e.jsxs("div",{className:"flex w-full flex-col",children:[e.jsx(x,{label:e.jsxs("span",{className:"flex items-center gap-3",children:[e.jsx("img",{loading:"lazy",src:`/images/feature-preview/square/${Tt[s]??"generic"}.png`,style:{objectFit:"cover",width:40,height:40},className:"rounded-lg border border-border-300",width:248,height:248,alt:o.formatMessage({defaultMessage:"Preview image of feature",id:"6VliGZPeZA"})}),e.jsx("span",{id:`feature-${s}-title`,children:a.titleKey?e.jsx($,{id:a.titleKey}):a.title})]}),description:e.jsxs("span",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{children:a.descriptionKey?e.jsx($,{id:a.descriptionKey}):a.description}),"enabled_monkeys_in_a_barrel"===s&&!_&&e.jsx("span",{children:e.jsx(ke,{defaultMessage:"This feature gives Claude network access to create and analyze files, which has <a>security risks</a>. Monitor chats closely when using this feature.",id:"2tm+lICYTm",values:{a:t=>e.jsx(U,{href:"https://support.claude.com/en/articles/12111783-create-and-edit-files-with-claude#h_0ee9d698a1",target:"_blank",children:t})}})})]}),control:e.jsx(Fe,{multiline:!0,className:"[overflow-wrap:anywhere]",content:g&&"blocked_by_entitlement"===p.status?e.jsx(ke,{...F.blockedByEntitlement}):g?e.jsx(ke,{defaultMessage:"This feature has been disabled by an organization owner.",id:"CQtCl/WEBs"}):"enabled_monkeys_in_a_barrel"===s?e.jsx(ke,{defaultMessage:"This is an upgrade to the analysis tool. It does not support versioning or remixing of Artifacts.",id:"OT4Z/tnKXZ"}):null,children:e.jsx(R,{checked:!!u,onCheckedChange:w,"aria-labelledby":`feature-${s}-title`,disabled:g})})}),"enabled_monkeys_in_a_barrel"===s&&u&&!b&&_&&e.jsx("div",{className:"pb-md",children:e.jsx(kt,{enabled:v,allowedHosts:M,hostsTemplate:j,onUpdate:c,isPending:d})})]})}const Tt={preview_feature_uses_artifacts:"artifacts",preview_feature_uses_latex:"latex",preview_feature_uses_citations:"generic",enabled_artifacts_attachments:"analyse",enabled_turmeric:"turmeric",enabled_gdrive:"google-drive",enabled_web_search:"web-search",enabled_bananagrams:"bananagrams",enabled_foccacia:"foccacia",enabled_sourdough:"sourdough",enabled_monkeys_in_a_barrel:"wiggle"};function Dt({setCreateProjectModalIsOpen:e,setGithubModalIsOpen:s,setGmailAuthModalIsOpen:a,setCreatePromptArgumentModalIsOpen:o}){const r=function(){const{addError:e}=n(),t=we(),{handleUpload:s}=L(),a=m(),o=async()=>{a.track({event_key:"claudeai.plus_menu.screenshot_clicked"});let n=null;try{n=await ht({width:1568,height:1568})}catch(i){V(i,{source:"screen_capture"}),e(t.formatMessage({defaultMessage:"Could not capture screen",id:"GT8HkzCHoM"}),{error:i,messageForLogging:"Could not capture screen"})}if(!n)return;const o=await fetch(n.imageDataUrl).then(e=>e.blob()),r=new File([o],"screenshot.png",{type:"image/png"});await s([r])};return o}(),i=Et(),{openFeaturePreviewModal:l}=t.useContext(Ot),{checkIsGithubAuthenticated:c,initGithubAuth:d}=Oe(),{initDriveAuth:u}=Ae(),p=B();return{onAddScreenshot:()=>{r()},openGithubModal:()=>{c().then(e=>{e||d()})},openGmailAuthModal:()=>{},openMcpDirectoryModal:()=>{p({section:"connectors"})},initDriveAuth:u,insertDriveDocLink:function(){const{promptInputRef:e}=L();return t=>{const s=e?.current?.getEditor();s&&s.chain().focus().insertContent({type:"text",text:`${ut(t)} `}).run()}}(),onSelectProject:(e,t)=>{i(e,t)},onCreateProject:e=>{Qe()},openFeaturePreviewModal:l,onEnterPromptArguments:(e,t)=>{}}}function Et(){const e=K(),{setProjectUuid:t,conversation:s}=L(),{moveToProject:a}=Xe(),{removeFromProject:n}=Q();return async(o,r)=>{e===o?s?.id?await n([s.id],{showSuccess:!1}):t(void 0):s?.id&&o?await a([s.id],o,r,{enableNavigation:!0}):t(o)}}function zt({path:t,inputMenuSearchQuery:s,setInputMenuSearchQuery:a,handleBack:n}){const o=we(),r=i(),l={[Y.DRIVE]:o.formatMessage({defaultMessage:"Search Google Drive",id:"1bbXc6Z3S1"}),[Y.PROJECTS]:o.formatMessage({defaultMessage:"Search projects",id:"doPT7U8q21"}),[Y.STYLES]:o.formatMessage({defaultMessage:"Search styles",id:"9oQ0JkPwFY"})},c=t&&t in l?l[t]:o.formatMessage({defaultMessage:"Search menu",id:"lL4HM3zEqr"}),d=null===t||!!s.trim().length;return e.jsxs("div",{className:"flex flex-row items-center gap-2.5 px-1.5 w-full rounded-md h-[2rem]",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-4 h-4 flex items-center justify-center",children:e.jsx(Z,{className:W("text-text-500/50 transition-opacity",d?"opacity-100":"opacity-0")})}),e.jsx("button",{onClick:n,className:W("transition-opacity text-text-500 hover:text-text-100 absolute left-0 top-0",d?"opacity-0":"opacity-100"),disabled:d,"aria-label":o.formatMessage({defaultMessage:"Back",id:"cyR7KhiuaU"}),children:e.jsx("div",{className:"w-4 h-4 flex items-center justify-center",children:e.jsx(Ze,{})})})]}),e.jsx("input",{autoFocus:!r,id:Je,className:"block bg-transparent hide-focus-ring placeholder:text-text-500/70 font-base text-text-300 w-full",placeholder:c,"aria-label":c,value:s,onChange:e=>a(e.target.value),role:"combobox","aria-expanded":!0,"aria-controls":void 0})]})}const Gt={type:"remote"};function Rt(){const s=q(Gt),{blocksMcp:a}=X(),n=J(),i=ee(),{account:l}=O(),c=l?.settings.enabled_mcp_tools??{},d=te("enabled_mcp_tools")??{},[u,p]=t.useState(()=>{const e=new Set(s.map(e=>e.uuid));return Object.fromEntries(Object.entries(d).filter(([t])=>{const s=t.split(":")[0];return e.has(s)}))});function h(e,t){p(s=>({...s,...Array.isArray(e)?Object.fromEntries(e.map(e=>[e,t])):{[e]:t}}))}const m=function({showConnectAction:s,mcpToolsSetting:a,toggleMcpToolEnabled:n,remoteOnly:i,activeServers:l}){const c=se(),d=ae(),u=o(),p=we(),h=ne({source:oe.ChatInputToolsMenu}),{blocksMcp:m}=X(),f=re(),{conversation:g}=L(),b=t.useMemo(()=>({isConnecting:!1,toolsLoaded:!0,type:"remote",isConnected:!0}),[i,s]);return q(b).filter(e=>!ie(e)&&!(e.name.startsWith("plugin:")&&!c)&&(!c||!l||l.has(e.uuid))).map(t=>{const s=d&&t.localId===qe,o={key:t.uuid,label:t.name,icon:e.jsx(le,{size:16,type:t.iconType,src:t.iconSrc,name:t.name})};if(m)return{...o,type:"switch",onClick:()=>{},...(i=t.name,{isDisabled:!0,isChecked:!1,icon:e.jsx(Te,{size:16}),tooltip:e.jsx(ue,{id:"11vaed6",dangerouslyVisiblePublicValues:{connectorName:i,a:t=>e.jsx(r,{onClick:()=>u.push("/new"),children:t})}})})};var i;if(!t.isConnected)return{...o,type:"button",isExternal:!0,secondaryText:p.formatMessage({defaultMessage:"Connect",id:"+vVZ/G11Zg"}),onClick:()=>h({uuid:t.uuid,url:t.url})};if(ce({name:t.name,uuid:t.uuid})){const e=t.tools.length;return{...o,type:"toggle",isChecked:f.isEnabled,enabledCount:f.isEnabled?e:0,totalCount:e,onClick:f.toggle,isDisabled:c&&!!g?.id}}const b=s?{isDisabled:!0,tooltip:p.formatMessage({defaultMessage:"Not needed in Cowork mode. Use mounted folders instead.",id:"PCS4zH1esA"}),isChecked:!1}:{},y=t.tools.map(s=>{const o=s.enabledKey,r=de(o,a,!1);return{key:o,type:"switch",label:s.displayName,icon:e.jsx(le,{size:16,type:t.iconType,src:t.iconSrc,name:t.name}),isChecked:r,onClick:()=>{n(o,!r,t.url)},...b}}),x=y.filter(e=>"switch"===e.type&&e.isChecked).length,_=x>0,v=t.tools.length,M=[];y.length>1&&M.push({key:"select-all",type:"button",label:_?p.formatMessage({defaultMessage:"Disable all tools",id:"8A9N39nihk"}):p.formatMessage({defaultMessage:"Enable all tools",id:"x4/g36jIjW"}),onClick:()=>{const e=t.tools.map(e=>e.enabledKey);n(e,!_,t.url)},skipCloseOnClick:!0,nonSearchable:!0},{key:"divider1",type:"divider",label:""}),M.push(...y),0===M.length&&M.push({key:"empty",type:"button",label:p.formatMessage({defaultMessage:"No tools available",id:"+XSkrzcF/0"}),icon:e.jsx(We,{size:16}),onClick:()=>{},isDisabled:!0});const j={enabledCount:x,totalCount:v,isChecked:_,onClick:()=>{const e=t.tools.map(e=>e.enabledKey);n(e,!_,t.url)}};return c?{...o,...j,isChecked:!!l||j.isChecked,isDisabled:!!g?.id,type:"toggle"}:{...o,...j,type:"toggleGroup",children:M}})}({showConnectAction:!1,mcpToolsSetting:u,toggleMcpToolEnabled:h,remoteOnly:!0}),f=t.useMemo(()=>{if(a)return[];const e=[];for(const t of s)for(const s of t.tools)e.push(s.enabledKey);return e},[s,a]),g=t.useMemo(()=>!a&&(0!==f.length&&f.some(e=>!1!==u[e])),[f,u,a]);return{menuOptions:m,getEnabledRemoteTools:()=>{if(a)return[];const e=[];for(const t of s)for(const s of t.tools)!1!==u[s.enabledKey]&&e.push({tool_name:s.name,server_uuid:t.uuid});return e},getEnabledAlwaysAllowedTools:()=>{if(a)return{tools:[],connectorCount:0};const e=[];let t=0;for(const a of s){if(!a.isConnected||!a.toolsLoaded||a.isConnecting||ie(a))continue;let s=!1;for(const t of a.tools)!1!==u[t.enabledKey]&&!1!==n(a,t).showAlwaysAllowed&&(!0===i&&!0===n(a,t,"cowork").coworkAlwaysAllowDisabledByOrg||t.alwaysApprovedKey&&!1===c[t.alwaysApprovedKey]||(e.push({tool_name:t.name,server_uuid:a.uuid}),s=!0));s&&(t+=1)}return{tools:e,connectorCount:t}},allToolKeys:f,anyConnectorEnabled:g,toggleAllConnectors:e=>{h(f,e)}}}function Ft({onCancel:s,onConfirm:a}){const n=we(),o=t.useRef(null),r=pe("tool_approval_default_always_allow"),i=y("compass_honor_tool_approval_state"),{menuOptions:l,getEnabledRemoteTools:c,getEnabledAlwaysAllowedTools:d,allToolKeys:u,anyConnectorEnabled:p,toggleAllConnectors:h}=Rt(),m=lt({actions:Dt({setCreateProjectModalIsOpen:$t,setGithubModalIsOpen:$t,setGmailAuthModalIsOpen:$t,setCreatePromptArgumentModalIsOpen:$t}),inputMenuIsOpen:!0,setInputMenuIsOpen:()=>{},rootItems:l,menuType:"research"}),{tools:f,connectorCount:g}=d(),b=i&&r.isAvailable&&f.length>0,[x,M]=t.useState(!1),j=t.useId();return t.useEffect(()=>{setTimeout(()=>{o.current&&o.current.focus()})},[]),e.jsx($e.Root,{open:!0,onOpenChange:e=>!e&&s(),children:e.jsxs($e.Popup,{size:"md",children:[e.jsx($e.Header,{showClose:!1,children:e.jsx(ke,{defaultMessage:"Enable connectors for Claude to use in research",id:"bnGGwdCceV"})}),e.jsxs("div",{className:"flex flex-col gap-md",children:[u.length>0&&e.jsx("div",{className:"flex justify-end",children:e.jsx(v,{onClick:()=>h(!p),children:p?n.formatMessage({defaultMessage:"Disable all tools",id:"8A9N39nihk"}):n.formatMessage({defaultMessage:"Enable all tools",id:"x4/g36jIjW"})})}),e.jsx("div",{className:"border rounded-card",children:e.jsxs("div",{className:"p-2",children:[m.path&&e.jsx(zt,{path:m.path,inputMenuSearchQuery:m.inputMenuSearchQuery,setInputMenuSearchQuery:m.setInputMenuSearchQuery,handleBack:m.handleBack}),e.jsx("div",{className:"space-y-1",children:m.menuView.currentItems.filter(({menuItemHidden:e})=>!e).map(t=>e.jsx(he,{item:t,onClick:()=>m.handleClickItem(t),isHighlighted:m.highlightedItemKey===t.key},t.key))})]})}),b&&e.jsxs("label",{htmlFor:j,className:"flex items-center justify-between gap-md",children:[e.jsx("span",{className:"text-body",children:e.jsx(ke,{defaultMessage:"Always allow {count, plural, one {# selected connector} other {# selected connectors}}",id:"8zjlFNDV2Q",values:{count:g}})}),e.jsx(ze,{id:j,checked:x,onCheckedChange:M})]}),e.jsx(_,{icon:null,children:e.jsx(ke,{defaultMessage:"Ensure you have appropriate permissions and trust third-party tools before continuing. <link>Learn more</link> about safely using research with connected apps.",id:"VU67M+9esK",values:{link:t=>e.jsx(v,{external:!0,href:"https://support.anthropic.com/",children:t})}})})]}),e.jsxs($e.Footer,{children:[e.jsx(Ee,{onClick:s,children:e.jsx(ke,{defaultMessage:"Cancel",id:"47FYwba+bI"})}),e.jsx(Ee,{ref:o,variant:"primary",shortcut:"enter",onClick:function(){a({tools:c(),alwaysAllowTools:x&&b?f:null})},children:e.jsx(ke,{defaultMessage:"Confirm",id:"N2IrpMDHDB"})})]})]})})}function $t(){}const Ut=Be()(e=>({inlineModalToolUseIds:new Set,actedToolUseIds:new Set,registerInlineModal:t=>e(e=>{const s=new Set(e.inlineModalToolUseIds);return s.add(t),{inlineModalToolUseIds:s}}),unregisterInlineModal:t=>e(e=>{if(!e.inlineModalToolUseIds.has(t))return e;const s=new Set(e.inlineModalToolUseIds);return s.delete(t),{inlineModalToolUseIds:s}}),markActed:t=>e(e=>{if(e.actedToolUseIds.has(t))return e;const s=new Set(e.actedToolUseIds);return s.add(t),{actedToolUseIds:s}})}));function Ht({hrefs:t}){const s=t.map((t,s)=>e.jsx(Ye.div,{className:W("shadow-xs h-5 w-5 rounded-full overflow-hidden border-0.5 border-border-300 bg-bg-100 flex items-stretch justify-stretch",`z-${s+1}`),initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{delay:.1+.05*s,duration:.3},children:e.jsx(Me,{url:t,shouldFillBackground:!0,size:14})},s));return e.jsx("div",{className:"flex items-center -space-x-2",children:s})}function Kt({agents:e,n:t=5}){const s=new Set;for(const n of e)for(const e of n.annotated_snippets)for(const n of e.tool_calls)if("web_search"===n.tool_name&&"rich_content"===n.output?.type&&n.output.content.length)for(const e of n.output.content.map(({url:e})=>e).filter(Boolean))if("string"==typeof e)try{const a=new URL(e);if(s.add(a.origin),s.size>=t)return Array.from(s).slice(0,t)}catch(a){}return Array.from(s)}const Lt=Ke(Ue({intervalSeconds:Le(),durationSeconds:Le().optional()})),Qt=[{intervalSeconds:30}];function Bt(e,s){const a=!s||s===_e.Completed,n=t.useRef(a),{mutate:o}=je(e,{refetchOnSettled:!0});t.useEffect(()=>{a&&!n.current&&o({settings:{compass_mode:null}}),n.current=a},[o,a,e])}function Vt({organizationUuid:e,conversationUuid:s,taskId:a,isShared:n,enabled:o}){const[r,i]=t.useState(!0),[,l]=t.useState(0),c=T("use_confused_carousel_sounds","polling",Qt,Lt),d=c[0]?.intervalSeconds??30,[u,p]=t.useState(d),h=me(s),m=fe(e=>e.setCurrentCompassTask),f=ge(),g=t.useRef(null),b=t.useRef(!1),y=t.useRef(!1),x=t.useRef(!1),_=n?`/api/organizations/${e}/chat_snapshots/${s}/task/${a}/status`:`/api/organizations/${e}/chat_conversations/${s}/task/${a}/status`,{data:v,isLoading:M,error:j}=be(_,{refetchInterval:!!r&&1e3*u,enabled:Boolean(o&&s&&e&&a&&!f.claudeai_compass_task_polling),meta:{noToast:!0}}),w=void 0!==v?.status&&!ye(v?.status);return t.useEffect(()=>{if(o&&s&&e&&a)if(null===g.current&&(g.current=Date.now()),w){if(i(!1),m(void 0),h(),l(0),!y.current&&b.current){y.current=!0;const e=v?.started_at&&v?.finished_at?Ve.fromISO(v.finished_at).diff(Ve.fromISO(v.started_at),"milliseconds").milliseconds:void 0;xe("chat.compass_task_completed",{attributes:{task_id:a,terminal_status:v?.status,agent_count:v?.agents?.length,client_elapsed_ms:Date.now()-g.current,server_elapsed_ms:e}})}}else if(j){if(x.current||(x.current=!0,V(j,{source:"compass_status_poll",task_id:a})),!v?.started_at)return void i(!1);l(e=>{const t=e+1,s=Ve.fromISO(v.started_at).plus({hours:3}),n=Ve.now()>=s,o=t<3&&!n;return o||y.current||(y.current=!0,xe("chat.compass_status_poll_gave_up",{attributes:{task_id:a,reason:n?"exceeded_3h":"consecutive_errors"}})),i(o),t})}else v&&!w&&(b.current=!0,l(0),m(a))},[o,a,w,j,h,e,s,v,m]),t.useEffect(()=>{if(!v?.started_at||!r)return;const e=setInterval(()=>{const e=function(e,t){const s=Ve.fromISO(e),a=Ve.now().diff(s,"seconds").seconds;for(const n of t){if(!n.durationSeconds)return n.intervalSeconds;if(a<n.durationSeconds)return n.intervalSeconds}return 30}(v.started_at,c);e!==u&&p(e)},1e3*u);return()=>clearInterval(e)},[v?.started_at,r,c,u]),{compassStatus:v,isLoading:M,error:j,completed:w,pollIntervalMs:1e3*u}}function Yt(e){return e?.agents?.[0]?.name}function Zt(e){const t=we(),s=Yt(e);if(s)return s;return e.status!==_e.Completed?t.formatMessage({defaultMessage:"Researching...",id:"eD084+/kcH"}):t.formatMessage({defaultMessage:"Done researching",id:"/ONMTL4lXm"})}const Wt=Ue({thought:He()});function qt(e){const s=e?.agents[0];return t.useMemo(()=>{const e=s?.annotated_snippets[0]?.thinking_blocks,t=e&&e.length>0?e[0]:void 0;if(t)return t.thinking;const a=s?.annotated_snippets[0]?.tool_calls?.find(e=>"think"===e.tool_name);if(a?.tool_input)try{const e=JSON.parse(a.tool_input),{data:t}=Wt.safeParse(e);return t?.thought}catch(n){return}},[s?.annotated_snippets])}function Xt(e){const t=Math.floor(e/1e3),s=Math.floor(t/60),a=Math.floor(s/60);return a>0?`${a}h ${s%60}m`:s>0?`${s}m ${t%60}s`:t>0?`${t}s`:"0s"}function Jt({startedAt:s,completedAt:a}){const[n,o]=t.useState(()=>Ve.now());if(t.useEffect(()=>{if(!s)return;if(a)return;const e=setInterval(()=>{o(Ve.now())},1e3);return()=>clearInterval(e)},[s,a,o]),!s)return"Starting";const r=Ve.fromISO(s);if(a){const t=Ve.fromISO(a).diff(r,"milliseconds").milliseconds;return t<=0?"Starting":e.jsx(e.Fragment,{children:Xt(t)})}const i=n.diff(r,"milliseconds").milliseconds;return i<=1e3?"Starting":e.jsx(e.Fragment,{children:Xt(i)})}function es({thought:t,className:s}){return t?e.jsx("div",{className:W("text-text-100 font-claude-response-body",s),children:e.jsx(ve,{text:t})}):null}export{Ze as A,Jt as E,Ht as F,ct as I,We as P,Ft as R,es as T,kt as W,Ut as a,Vt as b,Bt as c,qt as d,Kt as e,Nt as f,Yt as g,_t as h,ft as i,xt as j,At as k,qe as l,dt as m,ut as n,Et as o,ht as p,pt as q,Zt as r,Xe as u,yt as v};
