1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4703],{6916:function(e,t,r){Promise.resolve().then(r.bind(r,4953))},4953:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return f}});var n=r(7437),a=r(2089),l=r(8841),s=r(2265),o=r(2617),i=r(7648),c=r(7062),d=r(9412);function m(e){let{open:t,title:r,message:a,onConfirm:l,onCancel:o,confirmLabel:i="Delete",danger:c=!0}=e,d=(0,s.useRef)(null);return((0,s.useEffect)(()=>{var e;if(!t)return;null===(e=d.current)||void 0===e||e.focus();let r=e=>{"Escape"===e.key&&o()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[t,o]),t)?(0,n.jsxs)("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center",children:[(0,n.jsx)("div",{role:"presentation",className:"absolute inset-0 bg-black-1000/60 backdrop-blur-sm",onClick:o}),(0,n.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"confirm-modal-title",className:"relative mx-4 w-full max-w-md rounded-2xl border border-oc-border bg-oc-surface p-6 shadow-2xl md:mx-0 md:p-8",children:[(0,n.jsx)("h3",{id:"confirm-modal-title",className:"text-xl font-medium text-oc-primary",children:r}),a&&(0,n.jsx)("p",{className:"mt-2 text-sm text-oc-muted",children:a}),(0,n.jsxs)("div",{className:"mt-6 flex justify-end gap-3",children:[(0,n.jsx)("button",{ref:d,onClick:o,className:"rounded-lg border border-oc-border px-5 py-2.5 text-sm font-medium text-oc-secondary transition-all hover:border-oc-primary hover:text-oc-primary focus:outline-none focus:ring-2 focus:ring-oc-muted/50",children:"Cancel"}),(0,n.jsx)("button",{onClick:l,className:"rounded-lg px-5 py-2.5 text-sm font-medium text-white-0 transition-all active:scale-[0.98] focus:outline-none focus:ring-2 focus:ring-red-light/50 ".concat(c?"bg-red-light hover:bg-red-dark":"bg-oc-raised hover:bg-oc-muted"),children:i})]})]})]}):null}function u(e){if(!e)return null;let t=JSON.parse(localStorage.getItem("openclaw-names")||"{}");if(t[e])return t[e];let r=(0,d.x)();return t[e]=r,localStorage.setItem("openclaw-names",JSON.stringify(t)),r}function x(e){return"Failed"===e.state?"Failed":"Terminating"===e.state?"Terminating":!function(e){var t,r,n,a;let l=null!==(n=null===(t=e.replicas)||void 0===t?void 0:t.desired)&&void 0!==n?n:0,s=null!==(a=null===(r=e.replicas)||void 0===r?void 0:r.ready)&&void 0!==a?a:0;return("Active"===e.state||"Ready"===e.state)&&s>=l&&l>0}(e)?"Active"===e.state?"Starting":e.state||"Pending":"Ready"}
1function p(){let[e,t]=(0,s.useState)([]),[r,a]=(0,s.useState)(!0),[l,d]=(0,s.useState)(null),[p,f]=(0,s.useState)(null),[h,g]=(0,s.useState)(null),[y,b]=(0,s.useState)({}),[v,j]=(0,s.useState)({}),N=(0,s.useRef)(null),w=(0,s.useRef)(null),k=(0,s.useCallback)(async()=>{try{let e=await o.hi.listDeployments(),r=Array.isArray(e)?e:e.deployments||[];t(r),d(null)}catch(e){d(e.message)}finally{a(!1)}},[]),C=(0,s.useCallback)(e=>{N.current&&clearInterval(N.current),N.current=setInterval(k,e)},[k]);function S(e){let t=y[e];return!!t&&Date.now()-t<15e3}async function T(e){let t=v[e];if(null==t?void 0:t.token){j(t=>{let r={...t};return delete r[e],r});return}j(t=>({...t,[e]:{loading:!0}}));try{let t=localStorage.getItem("openclaw-token-".concat(e));if(t){j(r=>({...r,[e]:{token:t}}));return}let r=await o.hi.getDeploymentEnvVar(e,"OPENCLAW_GATEWAY_TOKEN");if(null==r?void 0:r.value){j(t=>({...t,[e]:{token:r.value}}));return}j(t=>({...t,[e]:{error:"Token not found"}}))}catch(t){j(r=>({...r,[e]:{error:t.message}}))}}async function D(e){var t;let r=null===(t=v[e])||void 0===t?void 0:t.token;if(r)try{await navigator.clipboard.writeText(r)}catch(e){}}async function E(){if(p)try{await o.hi.deleteDeployment(p),await k()}catch(e){d("Failed to delete: ".concat(e.message))}finally{f(null)}}async function R(){if(h){g(null),b(e=>({...e,[h]:Date.now()}));try{await o.hi.restartDeployment(h),C(2e3),w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{C(8e3)},3e4),await k()}catch(e){d("Failed to restart: ".concat(e.message)),b(e=>{let t={...e};return delete t[h],t})}}}return((0,s.useEffect)(()=>(k(),C(8e3),()=>{N.current&&clearInterval(N.current),w.current&&clearTimeout(w.current)}),[k,C]),(0,s.useEffect)(()=>{let e=Object.entries(y).filter(e=>{let[,t]=e;return Date.now()-t>=15e3});if(e.length>0){let t=setTimeout(()=>{b(t=>{let r={...t};for(let[t]of e)Date.now()-r[t]>=15e3&&delete r[t];return r})},15e3);return()=>clearTimeout(t)}},[y]),r)?(0,n.jsxs)("div",{className:"rounded-xl border border-oc-border bg-oc-surface p-6",children:[(0,n.jsx)("h3",{className:"font-aeonik text-[1.1rem] uppercase tracking-[0.1em] text-oc-muted",children:"Deployments"}),(0,n.jsx)("div",{className:"mt-4 space-y-3",children:[1,2].map(e=>(0,n.jsx)("div",{className:"h-16 animate-pulse rounded-lg bg-oc-raised"},e))})]}):(0,n.jsxs)("div",{className:"rounded-xl border border-oc-border bg-oc-surface p-4 md:p-6",children:[(0,n.jsx)("h3",{className:"font-aeonik text-xs uppercase tracking-[0.1em] text-oc-muted md:text-[1.1rem]",children:"Deployments"}),l&&(0,n.jsx)("p",{className:"mt-3 text-sm text-red-light md:text-[1.3rem]",children:l}),0!==e.length||l?(0,n.jsx)("div",{className:"mt-4 space-y-2",children:e.map(e=>(0,n.jsxs)("div",{className:"flex flex-col gap-3 rounded-lg border border-oc-border bg-oc-base px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:px-5 sm:py-4",children:[(0,n.jsx)("div",{className:"flex items-center gap-3 sm:gap-4",children:(()=>{let t=e.instanceName||e.instance_name,r=S(t)?"Restarting":x(e),a=u(t);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{"aria-hidden":"true",className:(0,c.cn)("h-2 w-2 shrink-0 rounded-full","Ready"===r?"bg-green-400":"Restarting"===r?"bg-yellow-400 animate-pulse":"Starting"===r?"bg-yellow-400 animate-pulse":"Pending"===r?"bg-yellow-400":"Failed"===r?"bg-red-light":"bg-oc-muted")}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("p",{className:"truncate text-sm text-oc-primary md:text-[1.4rem]",children:a||(null==t?void 0:t.slice(0,8))}),(0,n.jsxs)("p",{className:"truncate font-mono text-xs text-oc-muted md:text-[0.95rem]",children:[null==t?void 0:t.slice(0,12),"..."]}),(0,n.jsx)("p",{className:(0,c.cn)("text-xs md:text-[1.1rem]","Ready"===r?"text-green-400":"Restarting"===r?"text-yellow-400":"Starting"===r?"text-yellow-400":"Pending"===r?"text-yellow-400":"Failed"===r?"text-red-light":"text-oc-muted"),children:r})]})]})})()}),(0,n.jsx)("div",{className:"flex items-center gap-2 sm:gap-3",children:(()=>{var t,r,a;let l=e.instanceName||e.instance_name,s=x(e),o=S(l),c="Terminating"===s;return(0,n.jsxs)(n.Fragment,{children:[!c&&(0,n.jsx)(i.default,{href:"/openclaw/chat/".concat(l),className:"flex-1 rounded-md bg-red-light px-3 py-2 text-center text-xs text-white-0 transition-all duration-200 hover:bg-red-dark sm:flex-none sm:px-4 md:text-[1.2rem]",children:"Open Chat"}),!c&&(0,n.jsx)("button",{onClick:()=>g(l),disabled:o,className:"flex-1 rounded-md border border-oc-border px-3 py-2 text-center text-xs text-oc-muted transition-all duration-200 hover:border-oc-primary hover:text-oc-primary disabled:opacity-50 sm:flex-none md:text-[1.2rem]",children:o?"Restarting...":"Restart"}),(0,n.jsx)(i.default,{href:"/openclaw/logs/".concat(l),className:"flex-1 rounded-md border border-oc-border px-3 py-2 text-center text-xs text-oc-muted transition-all duration-200 hover:border-oc-primary hover:text-oc-primary sm:flex-none md:text-[1.2rem]",children:"Logs"}),(0,n.jsx)("button",{onClick:()=>T(l),disabled:null===(t=v[l])||void 0===t?void 0:t.loading,className:"flex-1 rounded-md border border-oc-border px-3 py-2 text-center text-xs text-oc-muted transition-all duration-200 hover:border-oc-primary hover:text-oc-primary disabled:opacity-50 sm:flex-none md:text-[1.2rem]",children:(null===(r=v[l])||void 0===r?void 0:r.loading)?"...":(null===(a=v[l])||void 0===a?void 0:a.token)?"Hide Token":"Token"}),(0,n.jsx)("button",{onClick:()=>f(l),className:"flex-1 rounded-md border border-oc-border px-3 py-2 text-center text-xs text-oc-muted transition-all duration-200 hover:border-red-light hover:text-red-light sm:flex-none md:text-[1.2rem]",children:"Delete"})]})})()}),(()=>
1{let t=e.instanceName||e.instance_name,r=v[t];return!r||r.loading?null:r.error?(0,n.jsx)("p",{className:"text-xs text-red-light md:text-[1.1rem]",children:r.error}):r.token?(0,n.jsxs)("div",{className:"flex items-center gap-2 rounded-md bg-oc-raised px-3 py-2",children:[(0,n.jsx)("code",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap font-mono text-xs text-oc-primary md:text-[1rem]",children:r.token}),(0,n.jsx)("button",{onClick:()=>D(t),title:"Copy token",className:"shrink-0 text-xs text-oc-muted transition-colors hover:text-oc-primary md:text-[1.1rem]",children:"Copy"})]}):null})()]},e.instanceName||e.instance_name))}):(0,n.jsx)("p",{className:"mt-4 text-sm text-oc-muted md:text-[1.4rem]",children:"No active deployments. Deploy OpenClaw to get started."}),(0,n.jsx)(m,{open:!!p,title:"Delete deployment",message:'Are you sure you want to delete "'.concat(u(p)||p,'"? This action cannot be undone.'),confirmLabel:"Delete",danger:!0,onConfirm:E,onCancel:()=>f(null)}),(0,n.jsx)(m,{open:!!h,title:"Restart deployment",message:'This will perform a rolling restart of "'.concat(u(h)||h,'". The deployment will be briefly unavailable.'),confirmLabel:"Restart",danger:!1,onConfirm:R,onCancel:()=>g(null)})]})}function f(){return(0,n.jsxs)("div",{className:"mx-auto max-w-[96rem] space-y-6 md:space-y-8",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"text-[2rem] font-medium leading-1 text-oc-primary md:text-[2.8rem]",children:"OpenClaw"}),(0,n.jsx)("p",{className:"mt-2 text-sm text-oc-muted md:text-[1.5rem]",children:"Deploy and manage your OpenClaw AI gateway instances."})]}),(0,n.jsxs)("div",{className:"grid gap-4 md:gap-6 lg:grid-cols-2",children:[(0,n.jsx)(a.Z,{}),(0,n.jsx)(l.Z,{})]}),(0,n.jsx)(p,{})]})}},2089:function(e,t,r){"use strict";r.d(t,{Z:function(){return i}});var n=r(7437),a=r(2265),l=r(2617),s=r(7648),o=r(9376);function i(){let e=(0,o.usePathname)(),[t,r]=(0,a.useState)(null),[i,c]=(0,a.useState)(!0),[d,m]=(0,a.useState)(null);return(0,a.useEffect)(()=>{let e=!0;async function t(){try{let t=await l.hi.getBalance();e&&(r(t.balance),m(null))}catch(t){e&&m(t.message)}finally{e&&c(!1)}}t();let n=setInterval(t,3e4);return()=>{e=!1,clearInterval(n)}},[]),(0,n.jsxs)("div",{className:"rounded-xl border border-oc-border bg-oc-surface p-4 md:p-6",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("h3",{className:"font-aeonik text-xs uppercase tracking-[0.1em] text-oc-muted md:text-[1.1rem]",children:"Credit Balance"}),"/openclaw/fund"!==e&&(0,n.jsx)(s.default,{href:"/openclaw/fund",className:"font-aeonik text-xs uppercase tracking-[0.08em] text-red-light transition-colors duration-200 hover:text-oc-primary md:text-[1.1rem]",children:"+ Add Credits"})]}),(0,n.jsx)("div",{className:"mt-3 md:mt-4",children:i?(0,n.jsx)("div",{className:"h-10 w-32 animate-pulse rounded bg-oc-raised"}):d?(0,n.jsx)("p",{className:"text-sm text-red-light md:text-[1.3rem]",children:d}):(0,n.jsxs)("p",{className:"text-[2rem] font-medium leading-1 text-oc-primary md:text-[3.2rem]",children:["$",parseFloat(t||0).toFixed(2)]})})]})}},7062:function(e,t,r){"use strict";r.d(t,{cn:function(){return l}});var n=r(1994),a=r(3335);function l(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,a.m6)((0,n.W)(t))}}},function(e){e.O(0,[118,257,8841,2971,2117,1744],function(){return e(e.s=6916)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.