import{g as e,o as s,e as a,f as t,s as n,l as i,r as l,j as r,u as c,M as o}from"./vendor--leCAzSo.js";import{h as d,d as m,q as x,W as u,o as f,X as g,B as b}from"./ca9c256b9-7brFE8T2.js";import{T as p}from"./c57c2877c-dpgWZiV5.js";import{ac as j,ad as h}from"./index-DZuQva-j.js";const y=["info","warning","blocking"],v=e("enabled",[s({enabled:i(!1),message:n().optional(),severity:t(y).optional(),dismissable:a().optional()}),s({enabled:i(!0),message:n(),severity:t(y).optional(),dismissable:a().optional()})]),N={enabled:!1},k="claude_code_web_error_banner",C="claude_code_desktop_error_banner",w=(e=k)=>{const s=d(e,N,v);if(!s.enabled)return{enabled:!1,message:"",severity:"warning",dismissable:!1};const a=s.severity??"warning";return{enabled:!0,message:s.message||"Claude Code is temporarily unavailable. You can try again later.",severity:a,dismissable:"blocking"!==a&&(s.dismissable??!0)}},M={info:{Icon:f,container:"bg-accent-900 text-accent-000"},warning:{Icon:u,container:"bg-warning-900 text-warning-000"}};function _({message:e,severity:s,onDismiss:a}){const t=c(),{Icon:n,container:i}=M[s];return r.jsxs("div",{className:`relative flex select-text items-center justify-center gap-2 py-2 ${a?"px-10":"px-4"} ${i}`,children:[r.jsx(n,{size:16,className:"shrink-0"}),r.jsx("p",{className:"text-sm",children:e}),a&&r.jsx("button",{type:"button",onClick:a,"aria-label":t.formatMessage({defaultMessage:"Dismiss",id:"TDaF6JVgG6"}),className:"absolute right-2 top-1/2 -translate-y-1/2 rounded p-1 opacity-70 transition-opacity hover:opacity-100",children:r.jsx(g,{size:14})})]})}const T=l.memo(function({configName:e=k}){const{enabled:s,message:a,severity:t,dismissable:n}=w(e),[i,c]=m(`code-error-banner-dismissed:${e}`,null),o=x(),d=l.useCallback(()=>c(a),[a,c]);return s&&"blocking"!==t?o&&n&&i===a?null:r.jsx(_,{message:a,severity:t,onDismiss:n?d:void 0}):null});const z=l.memo(function({message:e,configName:s,onRetry:a}){const[t,n]=l.useState(!1);return r.jsxs("div",{className:"flex h-screen flex-col overflow-hidden",children:[r.jsx(T,{configName:s}),r.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center px-4 py-10 text-center",children:[r.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 pb-14",children:[r.jsx(j,{className:"mb-11 mr-px h-7"}),r.jsx("h1",{className:"font-ui-serif text-2xl font-medium sm:text-[2rem]",children:r.jsx(o,{defaultMessage:"Claude Code is unavailable",id:"jgrc0uF1bT"})}),r.jsx("p",{className:"text-text-200 max-w-xl sm:text-lg",children:e}),a&&r.jsx(b,{variant:"secondary",className:"mt-4",onClick:async()=>{if(a){n(!0);try{await a()}finally{n(!1)}}},disabled:t,children:t?r.jsx(o,{defaultMessage:"Retrying...",id:"l02CSgKsHf"}):r.jsx(o,{defaultMessage:"Try again",id:"FazwRldA7z"})}),r.jsx("p",{className:"text-text-300 mt-4 text-sm",children:r.jsx(o,{defaultMessage:"Check {statusLink} for updates.",id:"xC+jsFS2O9",values:{statusLink:r.jsx(p,{href:"https://status.claude.com/",children:r.jsx(o,{defaultMessage:"status.claude.com",id:"A2T4C1rkYn"})})}})})]}),r.jsx("a",{href:"https://anthropic.com",title:"Learn more about Anthropic",className:"text-text-300 hover:text-text-100",children:r.jsx(h,{height:12})})]})]})});export{z as C,T as a,C as b,k as c,w as u};
