import{o as e}from"./rolldown-runtime-iuO8RvI4.js";import{Jt as s,en as a,fn as t,nn as n,sn as i,vn as r}from"./vendor-all-0-fRSUBfCr.js";import{A_ as l,av as o,el as c}from"./shared-0-C4kdVF7Y.js";import{Mi as m,ki as d}from"./vendor-frame-CwiylG4Y.js";import{Ih as x,Qf as f,Rh as u,xc as g,xg as p}from"./shared-1-3-6x7RKF.js";import{nn as b,rn as j}from"./vendor-all-2-BJdkbLSj.js";import{Ds as h}from"./shared-4-6CEyRAHb.js";import{ot as v}from"./shared-11-EQw1fy-I.js";import{rr as y}from"./index-C9LAU4f-.js";var N=e(m()),k=["info","warning","blocking"],w=n("enabled",[t({enabled:i(!1),message:r().optional(),severity:s(k).optional(),dismissable:a().optional()}),t({enabled:i(!0),message:r(),severity:s(k).optional(),dismissable:a().optional()})]),C={enabled:!1},_="claude_code_web_error_banner",M="claude_code_desktop_error_banner";function D(e=_){const s=l(e,C,w);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)}}var z=d(),F={info:{Icon:p,container:"bg-accent-900 text-accent-000"},warning:{Icon:u,container:"bg-warning-900 text-warning-000"}};function I({message:e,severity:s,onDismiss:a}){const t=j(),{Icon:n,container:i}=F[s];return(0,z.jsxs)("div",{className:`relative flex select-text items-center justify-center gap-2 py-2 ${a?"px-10":"px-4"} ${i}`,children:[(0,z.jsx)(n,{size:16,className:"shrink-0"}),(0,z.jsx)("p",{className:"text-sm",children:e}),a&&(0,z.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:(0,z.jsx)(x,{size:14})})]})}var R=(0,N.memo)(function({configName:e=_}){const{enabled:s,message:a,severity:t,dismissable:n}=D(e),[i,r]=c(`code-error-banner-dismissed:${e}`,null),l=o(),m=(0,N.useCallback)(()=>r(a),[a,r]);return s&&"blocking"!==t?l&&n&&i===a?null:(0,z.jsx)(I,{message:a,severity:t,onDismiss:n?m:void 0}):null});var $=(0,N.memo)(function({message:e,configName:s,onRetry:a}){const[t,n]=(0,N.useState)(!1);return(0,z.jsxs)("div",{className:"flex h-screen flex-col overflow-hidden",children:[(0,z.jsx)(R,{configName:s}),(0,z.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center px-4 py-10 text-center",children:[(0,z.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 pb-14",children:[(0,z.jsx)(h,{className:"mb-11 mr-px h-7"}),(0,z.jsx)("h1",{className:"font-ui-serif text-2xl font-medium sm:text-[2rem]",children:(0,z.jsx)(b,{defaultMessage:"Claude Code is unavailable",id:"jgrc0uF1bT"})}),(0,z.jsx)("p",{className:"text-text-200 max-w-xl sm:text-lg",children:e}),a&&(0,z.jsx)(f,{variant:"secondary",className:"mt-4",onClick:async()=>{if(a){n(!0);try{await a()}finally{n(!1)}}},disabled:t,children:t?(0,z.jsx)(b,{defaultMessage:"Retrying...",id:"l02CSgKsHf"}):(0,z.jsx)(b,{defaultMessage:"Try again",id:"FazwRldA7z"})}),(0,z.jsx)("p",{className:"text-text-300 mt-4 text-sm",children:(0,z.jsx)(b,{defaultMessage:"Check {statusLink} for updates.",id:"xC+jsFS2O9",values:{statusLink:(0,z.jsx)(g,{href:v,children:v.replace(/\/$/,"")})}})})]}),(0,z.jsx)("a",{href:"https://anthropic.com",title:"Learn more about Anthropic",className:"text-text-300 hover:text-text-100",children:(0,z.jsx)(y,{height:12})})]})]})});export{D as a,_ as i,R as n,M as r,$ as t};