import{r as e,j as s}from"./vendor-react-Dp9pL_Wn.js";import{af as a,h as t,aj as n,ak as i,al as r,am as l,an as o,U as c,ao as d}from"./c4b350ac1-KLFM4jkb.js";import{u as m,M as x}from"./vendor-intl-BDR1NhN_.js";import{d as f,o as u,b as g,e as b,s as p,l as j}from"./vendor-zod-DIcz3Rbr.js";import{a5 as h,a6 as y}from"./index-CSvjYuL_.js";const v=["info","warning","blocking"],N=f("enabled",[u({enabled:j(!1),message:p().optional(),severity:b(v).optional(),dismissable:g().optional()}),u({enabled:j(!0),message:p(),severity:b(v).optional(),dismissable:g().optional()})]),k={enabled:!1},w="claude_code_web_error_banner",C="claude_code_desktop_error_banner";function _(e=w){const s=a(e,k,N);if(!s.enabled)return{enabled:!1,message:"",severity:"warning",dismissable:!1};const t=s.severity??"warning";return{enabled:!0,message:s.message||"Claude Code is temporarily unavailable. You can try again later.",severity:t,dismissable:"blocking"!==t&&(s.dismissable??!0)}}const M={info:{Icon:r,container:"bg-accent-900 text-accent-000"},warning:{Icon:i,container:"bg-warning-900 text-warning-000"}};function z({message:e,severity:a,onDismiss:t}){const n=m(),{Icon:i,container:r}=M[a];return s.jsxs("div",{className:`relative flex select-text items-center justify-center gap-2 py-2 ${t?"px-10":"px-4"} ${r}`,children:[s.jsx(i,{size:16,className:"shrink-0"}),s.jsx("p",{className:"text-sm",children:e}),t&&s.jsx("button",{type:"button",onClick:t,"aria-label":n.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:s.jsx(l,{size:14})})]})}const D=e.memo(function({configName:a=w}){const{enabled:i,message:r,severity:l,dismissable:o}=_(a),[c,d]=t(`code-error-banner-dismissed:${a}`,null),m=n(),x=e.useCallback(()=>d(r),[r,d]);return i&&"blocking"!==l?m&&o&&c===r?null:s.jsx(z,{message:r,severity:l,onDismiss:o?x:void 0}):null});const F=e.memo(function({message:a,configName:t,onRetry:n}){const[i,r]=e.useState(!1);return s.jsxs("div",{className:"flex h-screen flex-col overflow-hidden",children:[s.jsx(D,{configName:t}),s.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center px-4 py-10 text-center",children:[s.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 pb-14",children:[s.jsx(o,{className:"mb-11 mr-px h-7"}),s.jsx("h1",{className:"font-ui-serif text-2xl font-medium sm:text-[2rem]",children:s.jsx(x,{defaultMessage:"Claude Code is unavailable",id:"jgrc0uF1bT"})}),s.jsx("p",{className:"text-text-200 max-w-xl sm:text-lg",children:a}),n&&s.jsx(c,{variant:"secondary",className:"mt-4",onClick:async()=>{if(n){r(!0);try{await n()}finally{r(!1)}}},disabled:i,children:i?s.jsx(x,{defaultMessage:"Retrying...",id:"l02CSgKsHf"}):s.jsx(x,{defaultMessage:"Try again",id:"FazwRldA7z"})}),s.jsx("p",{className:"text-text-300 mt-4 text-sm",children:s.jsx(x,{defaultMessage:"Check {statusLink} for updates.",id:"xC+jsFS2O9",values:{statusLink:s.jsx(d,{href:h,children:h.replace(/\/$/,"")})}})})]}),s.jsx("a",{href:"https://anthropic.com",title:"Learn more about Anthropic",className:"text-text-300 hover:text-text-100",children:s.jsx(y,{height:12})})]})]})});export{C,F as a,w as b,D as c,_ as u};
